From 2fa71ca5c9eae9f29653c603bb1db27f0c8e68e1 Mon Sep 17 00:00:00 2001 From: Apratim Mukherjee <78898747+apratimmukherjee@users.noreply.github.com> Date: Wed, 24 Jul 2024 17:33:10 +0530 Subject: [PATCH 01/10] openapi art updated to 0.3.16 --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index e6abd21d..e763b066 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,3 +1,3 @@ --prefer-binary requests -openapiart==0.3.14 +openapiart==0.3.16 From 96c9babc6a051a1149bcde21334f9db5558ef19f Mon Sep 17 00:00:00 2001 From: Github Actions Bot Date: Wed, 24 Jul 2024 12:06:36 +0000 Subject: [PATCH 02/10] Update auto generated go snappi --- gosnappi/go.mod | 19 +- gosnappi/go.sum | 2615 +----------------------------------------- gosnappi/gosnappi.go | 104 +- requirements.txt | 12 +- 4 files changed, 85 insertions(+), 2665 deletions(-) diff --git a/gosnappi/go.mod b/gosnappi/go.mod index b753359a..7ee71472 100644 --- a/gosnappi/go.mod +++ b/gosnappi/go.mod @@ -1,12 +1,27 @@ module github.com/open-traffic-generator/snappi/gosnappi -go 1.16 +go 1.21 + +toolchain go1.21.12 require ( github.com/Masterminds/semver/v3 v3.2.1 github.com/ghodss/yaml v1.0.0 github.com/gorilla/mux v1.8.1 github.com/stretchr/testify v1.9.0 - google.golang.org/grpc v1.64.0 + google.golang.org/grpc v1.65.0 google.golang.org/protobuf v1.34.2 ) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + gopkg.in/yaml.v2 v2.2.3 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/gosnappi/go.sum b/gosnappi/go.sum index 2df1d872..dbb827f7 100644 --- a/gosnappi/go.sum +++ b/gosnappi/go.sum @@ -1,2639 +1,44 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go v0.78.0/go.mod h1:QjdrLG0uq+YwhjoVOLsS1t7TW8fs36kLs4XO5R5ECHg= -cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb8= -cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= -cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= -cloud.google.com/go v0.84.0/go.mod h1:RazrYuxIK6Kb7YrzzhPoLmCVzl7Sup4NrbKPg8KHSUM= -cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWcY= -cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= -cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= -cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= -cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= -cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= -cloud.google.com/go v0.100.1/go.mod h1:fs4QogzfH5n2pBXBP9vRiU+eCny7lD2vmFZy79Iuw1U= -cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= -cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= -cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= -cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= -cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFOKM= -cloud.google.com/go v0.107.0/go.mod h1:wpc2eNrD7hXUTy8EKS10jkxpZBjASrORK7goS+3YX2I= -cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= -cloud.google.com/go v0.110.2/go.mod h1:k04UEeEtb6ZBRTv3dZz4CeJC3jKGxyhl0sAiVVquxiw= -cloud.google.com/go v0.110.4/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= -cloud.google.com/go v0.110.6/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= -cloud.google.com/go v0.110.7/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= -cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= -cloud.google.com/go v0.110.9/go.mod h1:rpxevX/0Lqvlbc88b7Sc1SPNdyK1riNBTUU6JXhYNpM= -cloud.google.com/go v0.110.10/go.mod h1:v1OoFqYxiBkUrruItNM3eT4lLByNjxmJSV/xDKJNnic= -cloud.google.com/go v0.111.0/go.mod h1:0mibmpKP1TyOOFYQY5izo0LnT+ecvOQ0Sg3OdmMiNRU= -cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= -cloud.google.com/go v0.112.1/go.mod h1:+Vbu+Y1UU+I1rjmzeMOb/8RfkKJK2Gyxi1X6jJCZLo4= -cloud.google.com/go/accessapproval v1.4.0/go.mod h1:zybIuC3KpDOvotz59lFe5qxRZx6C75OtwbisN56xYB4= -cloud.google.com/go/accessapproval v1.5.0/go.mod h1:HFy3tuiGvMdcd/u+Cu5b9NkO1pEICJ46IR82PoUdplw= -cloud.google.com/go/accessapproval v1.6.0/go.mod h1:R0EiYnwV5fsRFiKZkPHr6mwyk2wxUJ30nL4j2pcFY2E= -cloud.google.com/go/accessapproval v1.7.1/go.mod h1:JYczztsHRMK7NTXb6Xw+dwbs/WnOJxbo/2mTI+Kgg68= -cloud.google.com/go/accessapproval v1.7.2/go.mod h1:/gShiq9/kK/h8T/eEn1BTzalDvk0mZxJlhfw0p+Xuc0= -cloud.google.com/go/accessapproval v1.7.3/go.mod h1:4l8+pwIxGTNqSf4T3ds8nLO94NQf0W/KnMNuQ9PbnP8= -cloud.google.com/go/accessapproval v1.7.4/go.mod h1:/aTEh45LzplQgFYdQdwPMR9YdX0UlhBmvB84uAmQKUc= -cloud.google.com/go/accessapproval v1.7.5/go.mod h1:g88i1ok5dvQ9XJsxpUInWWvUBrIZhyPDPbk4T01OoJ0= -cloud.google.com/go/accesscontextmanager v1.3.0/go.mod h1:TgCBehyr5gNMz7ZaH9xubp+CE8dkrszb4oK9CWyvD4o= -cloud.google.com/go/accesscontextmanager v1.4.0/go.mod h1:/Kjh7BBu/Gh83sv+K60vN9QE5NJcd80sU33vIe2IFPE= -cloud.google.com/go/accesscontextmanager v1.6.0/go.mod h1:8XCvZWfYw3K/ji0iVnp+6pu7huxoQTLmxAbVjbloTtM= -cloud.google.com/go/accesscontextmanager v1.7.0/go.mod h1:CEGLewx8dwa33aDAZQujl7Dx+uYhS0eay198wB/VumQ= -cloud.google.com/go/accesscontextmanager v1.8.0/go.mod h1:uI+AI/r1oyWK99NN8cQ3UK76AMelMzgZCvJfsi2c+ps= -cloud.google.com/go/accesscontextmanager v1.8.1/go.mod h1:JFJHfvuaTC+++1iL1coPiG1eu5D24db2wXCDWDjIrxo= -cloud.google.com/go/accesscontextmanager v1.8.2/go.mod h1:E6/SCRM30elQJ2PKtFMs2YhfJpZSNcJyejhuzoId4Zk= -cloud.google.com/go/accesscontextmanager v1.8.3/go.mod h1:4i/JkF2JiFbhLnnpnfoTX5vRXfhf9ukhU1ANOTALTOQ= -cloud.google.com/go/accesscontextmanager v1.8.4/go.mod h1:ParU+WbMpD34s5JFEnGAnPBYAgUHozaTmDJU7aCU9+M= -cloud.google.com/go/accesscontextmanager v1.8.5/go.mod h1:TInEhcZ7V9jptGNqN3EzZ5XMhT6ijWxTGjzyETwmL0Q= -cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= -cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= -cloud.google.com/go/aiplatform v1.27.0/go.mod h1:Bvxqtl40l0WImSb04d0hXFU7gDOiq9jQmorivIiWcKg= -cloud.google.com/go/aiplatform v1.35.0/go.mod h1:7MFT/vCaOyZT/4IIFfxH4ErVg/4ku6lKv3w0+tFTgXQ= -cloud.google.com/go/aiplatform v1.36.1/go.mod h1:WTm12vJRPARNvJ+v6P52RDHCNe4AhvjcIZ/9/RRHy/k= -cloud.google.com/go/aiplatform v1.37.0/go.mod h1:IU2Cv29Lv9oCn/9LkFiiuKfwrRTq+QQMbW+hPCxJGZw= -cloud.google.com/go/aiplatform v1.45.0/go.mod h1:Iu2Q7sC7QGhXUeOhAj/oCK9a+ULz1O4AotZiqjQ8MYA= -cloud.google.com/go/aiplatform v1.48.0/go.mod h1:Iu2Q7sC7QGhXUeOhAj/oCK9a+ULz1O4AotZiqjQ8MYA= -cloud.google.com/go/aiplatform v1.50.0/go.mod h1:IRc2b8XAMTa9ZmfJV1BCCQbieWWvDnP1A8znyz5N7y4= -cloud.google.com/go/aiplatform v1.51.0/go.mod h1:IRc2b8XAMTa9ZmfJV1BCCQbieWWvDnP1A8znyz5N7y4= -cloud.google.com/go/aiplatform v1.51.1/go.mod h1:kY3nIMAVQOK2XDqDPHaOuD9e+FdMA6OOpfBjsvaFSOo= -cloud.google.com/go/aiplatform v1.51.2/go.mod h1:hCqVYB3mY45w99TmetEoe8eCQEwZEp9WHxeZdcv9phw= -cloud.google.com/go/aiplatform v1.52.0/go.mod h1:pwZMGvqe0JRkI1GWSZCtnAfrR4K1bv65IHILGA//VEU= -cloud.google.com/go/aiplatform v1.54.0/go.mod h1:pwZMGvqe0JRkI1GWSZCtnAfrR4K1bv65IHILGA//VEU= -cloud.google.com/go/aiplatform v1.57.0/go.mod h1:pwZMGvqe0JRkI1GWSZCtnAfrR4K1bv65IHILGA//VEU= -cloud.google.com/go/aiplatform v1.58.0/go.mod h1:pwZMGvqe0JRkI1GWSZCtnAfrR4K1bv65IHILGA//VEU= -cloud.google.com/go/aiplatform v1.58.2/go.mod h1:c3kCiVmb6UC1dHAjZjcpDj6ZS0bHQ2slL88ZjC2LtlA= -cloud.google.com/go/aiplatform v1.60.0/go.mod h1:eTlGuHOahHprZw3Hio5VKmtThIOak5/qy6pzdsqcQnM= -cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= -cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4= -cloud.google.com/go/analytics v0.17.0/go.mod h1:WXFa3WSym4IZ+JiKmavYdJwGG/CvpqiqczmL59bTD9M= -cloud.google.com/go/analytics v0.18.0/go.mod h1:ZkeHGQlcIPkw0R/GW+boWHhCOR43xz9RN/jn7WcqfIE= -cloud.google.com/go/analytics v0.19.0/go.mod h1:k8liqf5/HCnOUkbawNtrWWc+UAzyDlW89doe8TtoDsE= -cloud.google.com/go/analytics v0.21.2/go.mod h1:U8dcUtmDmjrmUTnnnRnI4m6zKn/yaA5N9RlEkYFHpQo= -cloud.google.com/go/analytics v0.21.3/go.mod h1:U8dcUtmDmjrmUTnnnRnI4m6zKn/yaA5N9RlEkYFHpQo= -cloud.google.com/go/analytics v0.21.4/go.mod h1:zZgNCxLCy8b2rKKVfC1YkC2vTrpfZmeRCySM3aUbskA= -cloud.google.com/go/analytics v0.21.5/go.mod h1:BQtOBHWTlJ96axpPPnw5CvGJ6i3Ve/qX2fTxR8qWyr8= -cloud.google.com/go/analytics v0.21.6/go.mod h1:eiROFQKosh4hMaNhF85Oc9WO97Cpa7RggD40e/RBy8w= -cloud.google.com/go/analytics v0.22.0/go.mod h1:eiROFQKosh4hMaNhF85Oc9WO97Cpa7RggD40e/RBy8w= -cloud.google.com/go/analytics v0.23.0/go.mod h1:YPd7Bvik3WS95KBok2gPXDqQPHy08TsCQG6CdUCb+u0= -cloud.google.com/go/apigateway v1.3.0/go.mod h1:89Z8Bhpmxu6AmUxuVRg/ECRGReEdiP3vQtk4Z1J9rJk= -cloud.google.com/go/apigateway v1.4.0/go.mod h1:pHVY9MKGaH9PQ3pJ4YLzoj6U5FUDeDFBllIz7WmzJoc= -cloud.google.com/go/apigateway v1.5.0/go.mod h1:GpnZR3Q4rR7LVu5951qfXPJCHquZt02jf7xQx7kpqN8= -cloud.google.com/go/apigateway v1.6.1/go.mod h1:ufAS3wpbRjqfZrzpvLC2oh0MFlpRJm2E/ts25yyqmXA= -cloud.google.com/go/apigateway v1.6.2/go.mod h1:CwMC90nnZElorCW63P2pAYm25AtQrHfuOkbRSHj0bT8= -cloud.google.com/go/apigateway v1.6.3/go.mod h1:k68PXWpEs6BVDTtnLQAyG606Q3mz8pshItwPXjgv44Y= -cloud.google.com/go/apigateway v1.6.4/go.mod h1:0EpJlVGH5HwAN4VF4Iec8TAzGN1aQgbxAWGJsnPCGGY= -cloud.google.com/go/apigateway v1.6.5/go.mod h1:6wCwvYRckRQogyDDltpANi3zsCDl6kWi0b4Je+w2UiI= -cloud.google.com/go/apigeeconnect v1.3.0/go.mod h1:G/AwXFAKo0gIXkPTVfZDd2qA1TxBXJ3MgMRBQkIi9jc= -cloud.google.com/go/apigeeconnect v1.4.0/go.mod h1:kV4NwOKqjvt2JYR0AoIWo2QGfoRtn/pkS3QlHp0Ni04= -cloud.google.com/go/apigeeconnect v1.5.0/go.mod h1:KFaCqvBRU6idyhSNyn3vlHXc8VMDJdRmwDF6JyFRqZ8= -cloud.google.com/go/apigeeconnect v1.6.1/go.mod h1:C4awq7x0JpLtrlQCr8AzVIzAaYgngRqWf9S5Uhg+wWs= -cloud.google.com/go/apigeeconnect v1.6.2/go.mod h1:s6O0CgXT9RgAxlq3DLXvG8riw8PYYbU/v25jqP3Dy18= -cloud.google.com/go/apigeeconnect v1.6.3/go.mod h1:peG0HFQ0si2bN15M6QSjEW/W7Gy3NYkWGz7pFz13cbo= -cloud.google.com/go/apigeeconnect v1.6.4/go.mod h1:CapQCWZ8TCjnU0d7PobxhpOdVz/OVJ2Hr/Zcuu1xFx0= -cloud.google.com/go/apigeeconnect v1.6.5/go.mod h1:MEKm3AiT7s11PqTfKE3KZluZA9O91FNysvd3E6SJ6Ow= -cloud.google.com/go/apigeeregistry v0.4.0/go.mod h1:EUG4PGcsZvxOXAdyEghIdXwAEi/4MEaoqLMLDMIwKXY= -cloud.google.com/go/apigeeregistry v0.5.0/go.mod h1:YR5+s0BVNZfVOUkMa5pAR2xGd0A473vA5M7j247o1wM= -cloud.google.com/go/apigeeregistry v0.6.0/go.mod h1:BFNzW7yQVLZ3yj0TKcwzb8n25CFBri51GVGOEUcgQsc= -cloud.google.com/go/apigeeregistry v0.7.1/go.mod h1:1XgyjZye4Mqtw7T9TsY4NW10U7BojBvG4RMD+vRDrIw= -cloud.google.com/go/apigeeregistry v0.7.2/go.mod h1:9CA2B2+TGsPKtfi3F7/1ncCCsL62NXBRfM6iPoGSM+8= -cloud.google.com/go/apigeeregistry v0.8.1/go.mod h1:MW4ig1N4JZQsXmBSwH4rwpgDonocz7FPBSw6XPGHmYw= -cloud.google.com/go/apigeeregistry v0.8.2/go.mod h1:h4v11TDGdeXJDJvImtgK2AFVvMIgGWjSb0HRnBSjcX8= -cloud.google.com/go/apigeeregistry v0.8.3/go.mod h1:aInOWnqF4yMQx8kTjDqHNXjZGh/mxeNlAf52YqtASUs= -cloud.google.com/go/apikeys v0.4.0/go.mod h1:XATS/yqZbaBK0HOssf+ALHp8jAlNHUgyfprvNcBIszU= -cloud.google.com/go/apikeys v0.5.0/go.mod h1:5aQfwY4D+ewMMWScd3hm2en3hCj+BROlyrt3ytS7KLI= -cloud.google.com/go/apikeys v0.6.0/go.mod h1:kbpXu5upyiAlGkKrJgQl8A0rKNNJ7dQ377pdroRSSi8= -cloud.google.com/go/appengine v1.4.0/go.mod h1:CS2NhuBuDXM9f+qscZ6V86m1MIIqPj3WC/UoEuR1Sno= -cloud.google.com/go/appengine v1.5.0/go.mod h1:TfasSozdkFI0zeoxW3PTBLiNqRmzraodCWatWI9Dmak= -cloud.google.com/go/appengine v1.6.0/go.mod h1:hg6i0J/BD2cKmDJbaFSYHFyZkgBEfQrDg/X0V5fJn84= -cloud.google.com/go/appengine v1.7.0/go.mod h1:eZqpbHFCqRGa2aCdope7eC0SWLV1j0neb/QnMJVWx6A= -cloud.google.com/go/appengine v1.7.1/go.mod h1:IHLToyb/3fKutRysUlFO0BPt5j7RiQ45nrzEJmKTo6E= -cloud.google.com/go/appengine v1.8.1/go.mod h1:6NJXGLVhZCN9aQ/AEDvmfzKEfoYBlfB80/BHiKVputY= -cloud.google.com/go/appengine v1.8.2/go.mod h1:WMeJV9oZ51pvclqFN2PqHoGnys7rK0rz6s3Mp6yMvDo= -cloud.google.com/go/appengine v1.8.3/go.mod h1:2oUPZ1LVZ5EXi+AF1ihNAF+S8JrzQ3till5m9VQkrsk= -cloud.google.com/go/appengine v1.8.4/go.mod h1:TZ24v+wXBujtkK77CXCpjZbnuTvsFNT41MUaZ28D6vg= -cloud.google.com/go/appengine v1.8.5/go.mod h1:uHBgNoGLTS5di7BvU25NFDuKa82v0qQLjyMJLuPQrVo= -cloud.google.com/go/area120 v0.5.0/go.mod h1:DE/n4mp+iqVyvxHN41Vf1CR602GiHQjFPusMFW6bGR4= -cloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0= -cloud.google.com/go/area120 v0.7.0/go.mod h1:a3+8EUD1SX5RUcCs3MY5YasiO1z6yLiNLRiFrykbynY= -cloud.google.com/go/area120 v0.7.1/go.mod h1:j84i4E1RboTWjKtZVWXPqvK5VHQFJRF2c1Nm69pWm9k= -cloud.google.com/go/area120 v0.8.1/go.mod h1:BVfZpGpB7KFVNxPiQBuHkX6Ed0rS51xIgmGyjrAfzsg= -cloud.google.com/go/area120 v0.8.2/go.mod h1:a5qfo+x77SRLXnCynFWPUZhnZGeSgvQ+Y0v1kSItkh4= -cloud.google.com/go/area120 v0.8.3/go.mod h1:5zj6pMzVTH+SVHljdSKC35sriR/CVvQZzG/Icdyriw0= -cloud.google.com/go/area120 v0.8.4/go.mod h1:jfawXjxf29wyBXr48+W+GyX/f8fflxp642D/bb9v68M= -cloud.google.com/go/area120 v0.8.5/go.mod h1:BcoFCbDLZjsfe4EkCnEq1LKvHSK0Ew/zk5UFu6GMyA0= -cloud.google.com/go/artifactregistry v1.6.0/go.mod h1:IYt0oBPSAGYj/kprzsBjZ/4LnG/zOcHyFHjWPCi6SAQ= -cloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk= -cloud.google.com/go/artifactregistry v1.8.0/go.mod h1:w3GQXkJX8hiKN0v+at4b0qotwijQbYUqF2GWkZzAhC0= -cloud.google.com/go/artifactregistry v1.9.0/go.mod h1:2K2RqvA2CYvAeARHRkLDhMDJ3OXy26h3XW+3/Jh2uYc= -cloud.google.com/go/artifactregistry v1.11.1/go.mod h1:lLYghw+Itq9SONbCa1YWBoWs1nOucMH0pwXN1rOBZFI= -cloud.google.com/go/artifactregistry v1.11.2/go.mod h1:nLZns771ZGAwVLzTX/7Al6R9ehma4WUEhZGWV6CeQNQ= -cloud.google.com/go/artifactregistry v1.12.0/go.mod h1:o6P3MIvtzTOnmvGagO9v/rOjjA0HmhJ+/6KAXrmYDCI= -cloud.google.com/go/artifactregistry v1.13.0/go.mod h1:uy/LNfoOIivepGhooAUpL1i30Hgee3Cu0l4VTWHUC08= -cloud.google.com/go/artifactregistry v1.14.1/go.mod h1:nxVdG19jTaSTu7yA7+VbWL346r3rIdkZ142BSQqhn5E= -cloud.google.com/go/artifactregistry v1.14.2/go.mod h1:Xk+QbsKEb0ElmyeMfdHAey41B+qBq3q5R5f5xD4XT3U= -cloud.google.com/go/artifactregistry v1.14.3/go.mod h1:A2/E9GXnsyXl7GUvQ/2CjHA+mVRoWAXC0brg2os+kNI= -cloud.google.com/go/artifactregistry v1.14.4/go.mod h1:SJJcZTMv6ce0LDMUnihCN7WSrI+kBSFV0KIKo8S8aYU= -cloud.google.com/go/artifactregistry v1.14.6/go.mod h1:np9LSFotNWHcjnOgh8UVK0RFPCTUGbO0ve3384xyHfE= -cloud.google.com/go/artifactregistry v1.14.7/go.mod h1:0AUKhzWQzfmeTvT4SjfI4zjot72EMfrkvL9g9aRjnnM= -cloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o= -cloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s= -cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjbytpUaW0= -cloud.google.com/go/asset v1.9.0/go.mod h1:83MOE6jEJBMqFKadM9NLRcs80Gdw76qGuHn8m3h8oHQ= -cloud.google.com/go/asset v1.10.0/go.mod h1:pLz7uokL80qKhzKr4xXGvBQXnzHn5evJAEAtZiIb0wY= -cloud.google.com/go/asset v1.11.1/go.mod h1:fSwLhbRvC9p9CXQHJ3BgFeQNM4c9x10lqlrdEUYXlJo= -cloud.google.com/go/asset v1.12.0/go.mod h1:h9/sFOa4eDIyKmH6QMpm4eUK3pDojWnUhTgJlk762Hg= -cloud.google.com/go/asset v1.13.0/go.mod h1:WQAMyYek/b7NBpYq/K4KJWcRqzoalEsxz/t/dTk4THw= -cloud.google.com/go/asset v1.14.1/go.mod h1:4bEJ3dnHCqWCDbWJ/6Vn7GVI9LerSi7Rfdi03hd+WTQ= -cloud.google.com/go/asset v1.15.0/go.mod h1:tpKafV6mEut3+vN9ScGvCHXHj7FALFVta+okxFECHcg= -cloud.google.com/go/asset v1.15.1/go.mod h1:yX/amTvFWRpp5rcFq6XbCxzKT8RJUam1UoboE179jU4= -cloud.google.com/go/asset v1.15.2/go.mod h1:B6H5tclkXvXz7PD22qCA2TDxSVQfasa3iDlM89O2NXs= -cloud.google.com/go/asset v1.15.3/go.mod h1:yYLfUD4wL4X589A9tYrv4rFrba0QlDeag0CMcM5ggXU= -cloud.google.com/go/asset v1.16.0/go.mod h1:yYLfUD4wL4X589A9tYrv4rFrba0QlDeag0CMcM5ggXU= -cloud.google.com/go/asset v1.17.0/go.mod h1:yYLfUD4wL4X589A9tYrv4rFrba0QlDeag0CMcM5ggXU= -cloud.google.com/go/asset v1.17.1/go.mod h1:byvDw36UME5AzGNK7o4JnOnINkwOZ1yRrGrKIahHrng= -cloud.google.com/go/asset v1.17.2/go.mod h1:SVbzde67ehddSoKf5uebOD1sYw8Ab/jD/9EIeWg99q4= -cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= -cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= -cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= -cloud.google.com/go/assuredworkloads v1.8.0/go.mod h1:AsX2cqyNCOvEQC8RMPnoc0yEarXQk6WEKkxYfL6kGIo= -cloud.google.com/go/assuredworkloads v1.9.0/go.mod h1:kFuI1P78bplYtT77Tb1hi0FMxM0vVpRC7VVoJC3ZoT0= -cloud.google.com/go/assuredworkloads v1.10.0/go.mod h1:kwdUQuXcedVdsIaKgKTp9t0UJkE5+PAVNhdQm4ZVq2E= -cloud.google.com/go/assuredworkloads v1.11.1/go.mod h1:+F04I52Pgn5nmPG36CWFtxmav6+7Q+c5QyJoL18Lry0= -cloud.google.com/go/assuredworkloads v1.11.2/go.mod h1:O1dfr+oZJMlE6mw0Bp0P1KZSlj5SghMBvTpZqIcUAW4= -cloud.google.com/go/assuredworkloads v1.11.3/go.mod h1:vEjfTKYyRUaIeA0bsGJceFV2JKpVRgyG2op3jfa59Zs= -cloud.google.com/go/assuredworkloads v1.11.4/go.mod h1:4pwwGNwy1RP0m+y12ef3Q/8PaiWrIDQ6nD2E8kvWI9U= -cloud.google.com/go/assuredworkloads v1.11.5/go.mod h1:FKJ3g3ZvkL2D7qtqIGnDufFkHxwIpNM9vtmhvt+6wqk= -cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= -cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= -cloud.google.com/go/automl v1.7.0/go.mod h1:RL9MYCCsJEOmt0Wf3z9uzG0a7adTT1fe+aObgSpkCt8= -cloud.google.com/go/automl v1.8.0/go.mod h1:xWx7G/aPEe/NP+qzYXktoBSDfjO+vnKMGgsApGJJquM= -cloud.google.com/go/automl v1.12.0/go.mod h1:tWDcHDp86aMIuHmyvjuKeeHEGq76lD7ZqfGLN6B0NuU= -cloud.google.com/go/automl v1.13.1/go.mod h1:1aowgAHWYZU27MybSCFiukPO7xnyawv7pt3zK4bheQE= -cloud.google.com/go/automl v1.13.2/go.mod h1:gNY/fUmDEN40sP8amAX3MaXkxcqPIn7F1UIIPZpy4Mg= -cloud.google.com/go/automl v1.13.3/go.mod h1:Y8KwvyAZFOsMAPqUCfNu1AyclbC6ivCUF/MTwORymyY= -cloud.google.com/go/automl v1.13.4/go.mod h1:ULqwX/OLZ4hBVfKQaMtxMSTlPx0GqGbWN8uA/1EqCP8= -cloud.google.com/go/automl v1.13.5/go.mod h1:MDw3vLem3yh+SvmSgeYUmUKqyls6NzSumDm9OJ3xJ1Y= -cloud.google.com/go/baremetalsolution v0.3.0/go.mod h1:XOrocE+pvK1xFfleEnShBlNAXf+j5blPPxrhjKgnIFc= -cloud.google.com/go/baremetalsolution v0.4.0/go.mod h1:BymplhAadOO/eBa7KewQ0Ppg4A4Wplbn+PsFKRLo0uI= -cloud.google.com/go/baremetalsolution v0.5.0/go.mod h1:dXGxEkmR9BMwxhzBhV0AioD0ULBmuLZI8CdwalUxuss= -cloud.google.com/go/baremetalsolution v1.1.1/go.mod h1:D1AV6xwOksJMV4OSlWHtWuFNZZYujJknMAP4Qa27QIA= -cloud.google.com/go/baremetalsolution v1.2.0/go.mod h1:68wi9AwPYkEWIUT4SvSGS9UJwKzNpshjHsH4lzk8iOw= -cloud.google.com/go/baremetalsolution v1.2.1/go.mod h1:3qKpKIw12RPXStwQXcbhfxVj1dqQGEvcmA+SX/mUR88= -cloud.google.com/go/baremetalsolution v1.2.2/go.mod h1:O5V6Uu1vzVelYahKfwEWRMaS3AbCkeYHy3145s1FkhM= -cloud.google.com/go/baremetalsolution v1.2.3/go.mod h1:/UAQ5xG3faDdy180rCUv47e0jvpp3BFxT+Cl0PFjw5g= -cloud.google.com/go/baremetalsolution v1.2.4/go.mod h1:BHCmxgpevw9IEryE99HbYEfxXkAEA3hkMJbYYsHtIuY= -cloud.google.com/go/batch v0.3.0/go.mod h1:TR18ZoAekj1GuirsUsR1ZTKN3FC/4UDnScjT8NXImFE= -cloud.google.com/go/batch v0.4.0/go.mod h1:WZkHnP43R/QCGQsZ+0JyG4i79ranE2u8xvjq/9+STPE= -cloud.google.com/go/batch v0.7.0/go.mod h1:vLZN95s6teRUqRQ4s3RLDsH8PvboqBK+rn1oevL159g= -cloud.google.com/go/batch v1.3.1/go.mod h1:VguXeQKXIYaeeIYbuozUmBR13AfL4SJP7IltNPS+A4A= -cloud.google.com/go/batch v1.4.1/go.mod h1:KdBmDD61K0ovcxoRHGrN6GmOBWeAOyCgKD0Mugx4Fkk= -cloud.google.com/go/batch v1.5.0/go.mod h1:KdBmDD61K0ovcxoRHGrN6GmOBWeAOyCgKD0Mugx4Fkk= -cloud.google.com/go/batch v1.5.1/go.mod h1:RpBuIYLkQu8+CWDk3dFD/t/jOCGuUpkpX+Y0n1Xccs8= -cloud.google.com/go/batch v1.6.1/go.mod h1:urdpD13zPe6YOK+6iZs/8/x2VBRofvblLpx0t57vM98= -cloud.google.com/go/batch v1.6.3/go.mod h1:J64gD4vsNSA2O5TtDB5AAux3nJ9iV8U3ilg3JDBYejU= -cloud.google.com/go/batch v1.7.0/go.mod h1:J64gD4vsNSA2O5TtDB5AAux3nJ9iV8U3ilg3JDBYejU= -cloud.google.com/go/batch v1.8.0/go.mod h1:k8V7f6VE2Suc0zUM4WtoibNrA6D3dqBpB+++e3vSGYc= -cloud.google.com/go/beyondcorp v0.2.0/go.mod h1:TB7Bd+EEtcw9PCPQhCJtJGjk/7TC6ckmnSFS+xwTfm4= -cloud.google.com/go/beyondcorp v0.3.0/go.mod h1:E5U5lcrcXMsCuoDNyGrpyTm/hn7ne941Jz2vmksAxW8= -cloud.google.com/go/beyondcorp v0.4.0/go.mod h1:3ApA0mbhHx6YImmuubf5pyW8srKnCEPON32/5hj+RmM= -cloud.google.com/go/beyondcorp v0.5.0/go.mod h1:uFqj9X+dSfrheVp7ssLTaRHd2EHqSL4QZmH4e8WXGGU= -cloud.google.com/go/beyondcorp v0.6.1/go.mod h1:YhxDWw946SCbmcWo3fAhw3V4XZMSpQ/VYfcKGAEU8/4= -cloud.google.com/go/beyondcorp v1.0.0/go.mod h1:YhxDWw946SCbmcWo3fAhw3V4XZMSpQ/VYfcKGAEU8/4= -cloud.google.com/go/beyondcorp v1.0.1/go.mod h1:zl/rWWAFVeV+kx+X2Javly7o1EIQThU4WlkynffL/lk= -cloud.google.com/go/beyondcorp v1.0.2/go.mod h1:m8cpG7caD+5su+1eZr+TSvF6r21NdLJk4f9u4SP2Ntc= -cloud.google.com/go/beyondcorp v1.0.3/go.mod h1:HcBvnEd7eYr+HGDd5ZbuVmBYX019C6CEXBonXbCVwJo= -cloud.google.com/go/beyondcorp v1.0.4/go.mod h1:Gx8/Rk2MxrvWfn4WIhHIG1NV7IBfg14pTKv1+EArVcc= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= -cloud.google.com/go/bigquery v1.43.0/go.mod h1:ZMQcXHsl+xmU1z36G2jNGZmKp9zNY5BUua5wDgmNCfw= -cloud.google.com/go/bigquery v1.44.0/go.mod h1:0Y33VqXTEsbamHJvJHdFmtqHvMIY28aK1+dFsvaChGc= -cloud.google.com/go/bigquery v1.47.0/go.mod h1:sA9XOgy0A8vQK9+MWhEQTY6Tix87M/ZurWFIxmF9I/E= -cloud.google.com/go/bigquery v1.48.0/go.mod h1:QAwSz+ipNgfL5jxiaK7weyOhzdoAy1zFm0Nf1fysJac= -cloud.google.com/go/bigquery v1.49.0/go.mod h1:Sv8hMmTFFYBlt/ftw2uN6dFdQPzBlREY9yBh7Oy7/4Q= -cloud.google.com/go/bigquery v1.50.0/go.mod h1:YrleYEh2pSEbgTBZYMJ5SuSr0ML3ypjRB1zgf7pvQLU= -cloud.google.com/go/bigquery v1.52.0/go.mod h1:3b/iXjRQGU4nKa87cXeg6/gogLjO8C6PmuM8i5Bi/u4= -cloud.google.com/go/bigquery v1.53.0/go.mod h1:3b/iXjRQGU4nKa87cXeg6/gogLjO8C6PmuM8i5Bi/u4= -cloud.google.com/go/bigquery v1.55.0/go.mod h1:9Y5I3PN9kQWuid6183JFhOGOW3GcirA5LpsKCUn+2ec= -cloud.google.com/go/bigquery v1.56.0/go.mod h1:KDcsploXTEY7XT3fDQzMUZlpQLHzE4itubHrnmhUrZA= -cloud.google.com/go/bigquery v1.57.1/go.mod h1:iYzC0tGVWt1jqSzBHqCr3lrRn0u13E8e+AqowBsDgug= -cloud.google.com/go/bigquery v1.58.0/go.mod h1:0eh4mWNY0KrBTjUzLjoYImapGORq9gEPT7MWjCy9lik= -cloud.google.com/go/bigquery v1.59.1/go.mod h1:VP1UJYgevyTwsV7desjzNzDND5p6hZB+Z8gZJN1GQUc= -cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= -cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= -cloud.google.com/go/billing v1.6.0/go.mod h1:WoXzguj+BeHXPbKfNWkqVtDdzORazmCjraY+vrxcyvI= -cloud.google.com/go/billing v1.7.0/go.mod h1:q457N3Hbj9lYwwRbnlD7vUpyjq6u5U1RAOArInEiD5Y= -cloud.google.com/go/billing v1.12.0/go.mod h1:yKrZio/eu+okO/2McZEbch17O5CB5NpZhhXG6Z766ss= -cloud.google.com/go/billing v1.13.0/go.mod h1:7kB2W9Xf98hP9Sr12KfECgfGclsH3CQR0R08tnRlRbc= -cloud.google.com/go/billing v1.16.0/go.mod h1:y8vx09JSSJG02k5QxbycNRrN7FGZB6F3CAcgum7jvGA= -cloud.google.com/go/billing v1.17.0/go.mod h1:Z9+vZXEq+HwH7bhJkyI4OQcR6TSbeMrjlpEjO2vzY64= -cloud.google.com/go/billing v1.17.1/go.mod h1:Z9+vZXEq+HwH7bhJkyI4OQcR6TSbeMrjlpEjO2vzY64= -cloud.google.com/go/billing v1.17.2/go.mod h1:u/AdV/3wr3xoRBk5xvUzYMS1IawOAPwQMuHgHMdljDg= -cloud.google.com/go/billing v1.17.3/go.mod h1:z83AkoZ7mZwBGT3yTnt6rSGI1OOsHSIi6a5M3mJ8NaU= -cloud.google.com/go/billing v1.17.4/go.mod h1:5DOYQStCxquGprqfuid/7haD7th74kyMBHkjO/OvDtk= -cloud.google.com/go/billing v1.18.0/go.mod h1:5DOYQStCxquGprqfuid/7haD7th74kyMBHkjO/OvDtk= -cloud.google.com/go/billing v1.18.2/go.mod h1:PPIwVsOOQ7xzbADCwNe8nvK776QpfrOAUkvKjCUcpSE= -cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM= -cloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI= -cloud.google.com/go/binaryauthorization v1.3.0/go.mod h1:lRZbKgjDIIQvzYQS1p99A7/U1JqvqeZg0wiI5tp6tg0= -cloud.google.com/go/binaryauthorization v1.4.0/go.mod h1:tsSPQrBd77VLplV70GUhBf/Zm3FsKmgSqgm4UmiDItk= -cloud.google.com/go/binaryauthorization v1.5.0/go.mod h1:OSe4OU1nN/VswXKRBmciKpo9LulY41gch5c68htf3/Q= -cloud.google.com/go/binaryauthorization v1.6.1/go.mod h1:TKt4pa8xhowwffiBmbrbcxijJRZED4zrqnwZ1lKH51U= -cloud.google.com/go/binaryauthorization v1.7.0/go.mod h1:Zn+S6QqTMn6odcMU1zDZCJxPjU2tZPV1oDl45lWY154= -cloud.google.com/go/binaryauthorization v1.7.1/go.mod h1:GTAyfRWYgcbsP3NJogpV3yeunbUIjx2T9xVeYovtURE= -cloud.google.com/go/binaryauthorization v1.7.2/go.mod h1:kFK5fQtxEp97m92ziy+hbu+uKocka1qRRL8MVJIgjv0= -cloud.google.com/go/binaryauthorization v1.7.3/go.mod h1:VQ/nUGRKhrStlGr+8GMS8f6/vznYLkdK5vaKfdCIpvU= -cloud.google.com/go/binaryauthorization v1.8.0/go.mod h1:VQ/nUGRKhrStlGr+8GMS8f6/vznYLkdK5vaKfdCIpvU= -cloud.google.com/go/binaryauthorization v1.8.1/go.mod h1:1HVRyBerREA/nhI7yLang4Zn7vfNVA3okoAR9qYQJAQ= -cloud.google.com/go/certificatemanager v1.3.0/go.mod h1:n6twGDvcUBFu9uBgt4eYvvf3sQ6My8jADcOVwHmzadg= -cloud.google.com/go/certificatemanager v1.4.0/go.mod h1:vowpercVFyqs8ABSmrdV+GiFf2H/ch3KyudYQEMM590= -cloud.google.com/go/certificatemanager v1.6.0/go.mod h1:3Hh64rCKjRAX8dXgRAyOcY5vQ/fE1sh8o+Mdd6KPgY8= -cloud.google.com/go/certificatemanager v1.7.1/go.mod h1:iW8J3nG6SaRYImIa+wXQ0g8IgoofDFRp5UMzaNk1UqI= -cloud.google.com/go/certificatemanager v1.7.2/go.mod h1:15SYTDQMd00kdoW0+XY5d9e+JbOPjp24AvF48D8BbcQ= -cloud.google.com/go/certificatemanager v1.7.3/go.mod h1:T/sZYuC30PTag0TLo28VedIRIj1KPGcOQzjWAptHa00= -cloud.google.com/go/certificatemanager v1.7.4/go.mod h1:FHAylPe/6IIKuaRmHbjbdLhGhVQ+CWHSD5Jq0k4+cCE= -cloud.google.com/go/certificatemanager v1.7.5/go.mod h1:uX+v7kWqy0Y3NG/ZhNvffh0kuqkKZIXdvlZRO7z0VtM= -cloud.google.com/go/channel v1.8.0/go.mod h1:W5SwCXDJsq/rg3tn3oG0LOxpAo6IMxNa09ngphpSlnk= -cloud.google.com/go/channel v1.9.0/go.mod h1:jcu05W0my9Vx4mt3/rEHpfxc9eKi9XwsdDL8yBMbKUk= -cloud.google.com/go/channel v1.11.0/go.mod h1:IdtI0uWGqhEeatSB62VOoJ8FSUhJ9/+iGkJVqp74CGE= -cloud.google.com/go/channel v1.12.0/go.mod h1:VkxCGKASi4Cq7TbXxlaBezonAYpp1GCnKMY6tnMQnLU= -cloud.google.com/go/channel v1.16.0/go.mod h1:eN/q1PFSl5gyu0dYdmxNXscY/4Fi7ABmeHCJNf/oHmc= -cloud.google.com/go/channel v1.17.0/go.mod h1:RpbhJsGi/lXWAUM1eF4IbQGbsfVlg2o8Iiy2/YLfVT0= -cloud.google.com/go/channel v1.17.1/go.mod h1:xqfzcOZAcP4b/hUDH0GkGg1Sd5to6di1HOJn/pi5uBQ= -cloud.google.com/go/channel v1.17.2/go.mod h1:aT2LhnftnyfQceFql5I/mP8mIbiiJS4lWqgXA815zMk= -cloud.google.com/go/channel v1.17.3/go.mod h1:QcEBuZLGGrUMm7kNj9IbU1ZfmJq2apotsV83hbxX7eE= -cloud.google.com/go/channel v1.17.4/go.mod h1:QcEBuZLGGrUMm7kNj9IbU1ZfmJq2apotsV83hbxX7eE= -cloud.google.com/go/channel v1.17.5/go.mod h1:FlpaOSINDAXgEext0KMaBq/vwpLMkkPAw9b2mApQeHc= -cloud.google.com/go/cloudbuild v1.3.0/go.mod h1:WequR4ULxlqvMsjDEEEFnOG5ZSRSgWOywXYDb1vPE6U= -cloud.google.com/go/cloudbuild v1.4.0/go.mod h1:5Qwa40LHiOXmz3386FrjrYM93rM/hdRr7b53sySrTqA= -cloud.google.com/go/cloudbuild v1.6.0/go.mod h1:UIbc/w9QCbH12xX+ezUsgblrWv+Cv4Tw83GiSMHOn9M= -cloud.google.com/go/cloudbuild v1.7.0/go.mod h1:zb5tWh2XI6lR9zQmsm1VRA+7OCuve5d8S+zJUul8KTg= -cloud.google.com/go/cloudbuild v1.9.0/go.mod h1:qK1d7s4QlO0VwfYn5YuClDGg2hfmLZEb4wQGAbIgL1s= -cloud.google.com/go/cloudbuild v1.10.1/go.mod h1:lyJg7v97SUIPq4RC2sGsz/9tNczhyv2AjML/ci4ulzU= -cloud.google.com/go/cloudbuild v1.13.0/go.mod h1:lyJg7v97SUIPq4RC2sGsz/9tNczhyv2AjML/ci4ulzU= -cloud.google.com/go/cloudbuild v1.14.0/go.mod h1:lyJg7v97SUIPq4RC2sGsz/9tNczhyv2AjML/ci4ulzU= -cloud.google.com/go/cloudbuild v1.14.1/go.mod h1:K7wGc/3zfvmYWOWwYTgF/d/UVJhS4pu+HAy7PL7mCsU= -cloud.google.com/go/cloudbuild v1.14.2/go.mod h1:Bn6RO0mBYk8Vlrt+8NLrru7WXlQ9/RDWz2uo5KG1/sg= -cloud.google.com/go/cloudbuild v1.14.3/go.mod h1:eIXYWmRt3UtggLnFGx4JvXcMj4kShhVzGndL1LwleEM= -cloud.google.com/go/cloudbuild v1.15.0/go.mod h1:eIXYWmRt3UtggLnFGx4JvXcMj4kShhVzGndL1LwleEM= -cloud.google.com/go/cloudbuild v1.15.1/go.mod h1:gIofXZSu+XD2Uy+qkOrGKEx45zd7s28u/k8f99qKals= -cloud.google.com/go/clouddms v1.3.0/go.mod h1:oK6XsCDdW4Ib3jCCBugx+gVjevp2TMXFtgxvPSee3OM= -cloud.google.com/go/clouddms v1.4.0/go.mod h1:Eh7sUGCC+aKry14O1NRljhjyrr0NFC0G2cjwX0cByRk= -cloud.google.com/go/clouddms v1.5.0/go.mod h1:QSxQnhikCLUw13iAbffF2CZxAER3xDGNHjsTAkQJcQA= -cloud.google.com/go/clouddms v1.6.1/go.mod h1:Ygo1vL52Ov4TBZQquhz5fiw2CQ58gvu+PlS6PVXCpZI= -cloud.google.com/go/clouddms v1.7.0/go.mod h1:MW1dC6SOtI/tPNCciTsXtsGNEM0i0OccykPvv3hiYeM= -cloud.google.com/go/clouddms v1.7.1/go.mod h1:o4SR8U95+P7gZ/TX+YbJxehOCsM+fe6/brlrFquiszk= -cloud.google.com/go/clouddms v1.7.2/go.mod h1:Rk32TmWmHo64XqDvW7jgkFQet1tUKNVzs7oajtJT3jU= -cloud.google.com/go/clouddms v1.7.3/go.mod h1:fkN2HQQNUYInAU3NQ3vRLkV2iWs8lIdmBKOx4nrL6Hc= -cloud.google.com/go/clouddms v1.7.4/go.mod h1:RdrVqoFG9RWI5AvZ81SxJ/xvxPdtcRhFotwdE79DieY= -cloud.google.com/go/cloudtasks v1.5.0/go.mod h1:fD92REy1x5woxkKEkLdvavGnPJGEn8Uic9nWuLzqCpY= -cloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI= -cloud.google.com/go/cloudtasks v1.7.0/go.mod h1:ImsfdYWwlWNJbdgPIIGJWC+gemEGTBK/SunNQQNCAb4= -cloud.google.com/go/cloudtasks v1.8.0/go.mod h1:gQXUIwCSOI4yPVK7DgTVFiiP0ZW/eQkydWzwVMdHxrI= -cloud.google.com/go/cloudtasks v1.9.0/go.mod h1:w+EyLsVkLWHcOaqNEyvcKAsWp9p29dL6uL9Nst1cI7Y= -cloud.google.com/go/cloudtasks v1.10.0/go.mod h1:NDSoTLkZ3+vExFEWu2UJV1arUyzVDAiZtdWcsUyNwBs= -cloud.google.com/go/cloudtasks v1.11.1/go.mod h1:a9udmnou9KO2iulGscKR0qBYjreuX8oHwpmFsKspEvM= -cloud.google.com/go/cloudtasks v1.12.1/go.mod h1:a9udmnou9KO2iulGscKR0qBYjreuX8oHwpmFsKspEvM= -cloud.google.com/go/cloudtasks v1.12.2/go.mod h1:A7nYkjNlW2gUoROg1kvJrQGhJP/38UaWwsnuBDOBVUk= -cloud.google.com/go/cloudtasks v1.12.3/go.mod h1:GPVXhIOSGEaR+3xT4Fp72ScI+HjHffSS4B8+BaBB5Ys= -cloud.google.com/go/cloudtasks v1.12.4/go.mod h1:BEPu0Gtt2dU6FxZHNqqNdGqIG86qyWKBPGnsb7udGY0= -cloud.google.com/go/cloudtasks v1.12.6/go.mod h1:b7c7fe4+TJsFZfDyzO51F7cjq7HLUlRi/KZQLQjDsaY= -cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= -cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= -cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= -cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= -cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= -cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= -cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.12.0/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= -cloud.google.com/go/compute v1.12.1/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= -cloud.google.com/go/compute v1.13.0/go.mod h1:5aPTS0cUNMIc1CE546K+Th6weJUNQErARyZtRXDJ8GE= -cloud.google.com/go/compute v1.14.0/go.mod h1:YfLtxrj9sU4Yxv+sXzZkyPjEyPBZfXHUvjxega5vAdo= -cloud.google.com/go/compute v1.15.1/go.mod h1:bjjoF/NtFUrkD/urWfdHaKuOPDR5nWIs63rR+SXhcpA= -cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs= -cloud.google.com/go/compute v1.19.0/go.mod h1:rikpw2y+UMidAe9tISo04EHNOIf42RLYF/q8Bs93scU= -cloud.google.com/go/compute v1.19.1/go.mod h1:6ylj3a05WF8leseCdIf77NK0g1ey+nj5IKd5/kvShxE= -cloud.google.com/go/compute v1.19.3/go.mod h1:qxvISKp/gYnXkSAD1ppcSOveRAmzxicEv/JlizULFrI= -cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute v1.21.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute v1.23.1/go.mod h1:CqB3xpmPKKt3OJpW2ndFIXnA9A4xAy/F3Xp1ixncW78= -cloud.google.com/go/compute v1.23.2/go.mod h1:JJ0atRC0J/oWYiiVBmsSsrRnh92DhZPG4hFDcR04Rns= -cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= -cloud.google.com/go/compute v1.23.4/go.mod h1:/EJMj55asU6kAFnuZET8zqgwgJ9FvXWXOkkfQZa4ioI= -cloud.google.com/go/compute v1.24.0/go.mod h1:kw1/T+h/+tK2LJK0wiPPx1intgdAM3j/g3hFDlscY40= -cloud.google.com/go/compute v1.25.1/go.mod h1:oopOIR53ly6viBYxaDhBfJwzUAxf1zE//uf3IB011ls= -cloud.google.com/go/compute/metadata v0.1.0/go.mod h1:Z1VN+bulIf6bt4P/C37K4DyZYZEXYonfTBHHFPO/4UU= -cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= -cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= -cloud.google.com/go/contactcenterinsights v1.3.0/go.mod h1:Eu2oemoePuEFc/xKFPjbTuPSj0fYJcPls9TFlPNnHHY= -cloud.google.com/go/contactcenterinsights v1.4.0/go.mod h1:L2YzkGbPsv+vMQMCADxJoT9YiTTnSEd6fEvCeHTYVck= -cloud.google.com/go/contactcenterinsights v1.6.0/go.mod h1:IIDlT6CLcDoyv79kDv8iWxMSTZhLxSCofVV5W6YFM/w= -cloud.google.com/go/contactcenterinsights v1.9.1/go.mod h1:bsg/R7zGLYMVxFFzfh9ooLTruLRCG9fnzhH9KznHhbM= -cloud.google.com/go/contactcenterinsights v1.10.0/go.mod h1:bsg/R7zGLYMVxFFzfh9ooLTruLRCG9fnzhH9KznHhbM= -cloud.google.com/go/contactcenterinsights v1.11.0/go.mod h1:hutBdImE4XNZ1NV4vbPJKSFOnQruhC5Lj9bZqWMTKiU= -cloud.google.com/go/contactcenterinsights v1.11.1/go.mod h1:FeNP3Kg8iteKM80lMwSk3zZZKVxr+PGnAId6soKuXwE= -cloud.google.com/go/contactcenterinsights v1.11.2/go.mod h1:A9PIR5ov5cRcd28KlDbmmXE8Aay+Gccer2h4wzkYFso= -cloud.google.com/go/contactcenterinsights v1.11.3/go.mod h1:HHX5wrz5LHVAwfI2smIotQG9x8Qd6gYilaHcLLLmNis= -cloud.google.com/go/contactcenterinsights v1.12.0/go.mod h1:HHX5wrz5LHVAwfI2smIotQG9x8Qd6gYilaHcLLLmNis= -cloud.google.com/go/contactcenterinsights v1.12.1/go.mod h1:HHX5wrz5LHVAwfI2smIotQG9x8Qd6gYilaHcLLLmNis= -cloud.google.com/go/contactcenterinsights v1.13.0/go.mod h1:ieq5d5EtHsu8vhe2y3amtZ+BE+AQwX5qAy7cpo0POsI= -cloud.google.com/go/container v1.6.0/go.mod h1:Xazp7GjJSeUYo688S+6J5V+n/t+G5sKBTFkKNudGRxg= -cloud.google.com/go/container v1.7.0/go.mod h1:Dp5AHtmothHGX3DwwIHPgq45Y8KmNsgN3amoYfxVkLo= -cloud.google.com/go/container v1.13.1/go.mod h1:6wgbMPeQRw9rSnKBCAJXnds3Pzj03C4JHamr8asWKy4= -cloud.google.com/go/container v1.14.0/go.mod h1:3AoJMPhHfLDxLvrlVWaK57IXzaPnLaZq63WX59aQBfM= -cloud.google.com/go/container v1.15.0/go.mod h1:ft+9S0WGjAyjDggg5S06DXj+fHJICWg8L7isCQe9pQA= -cloud.google.com/go/container v1.22.1/go.mod h1:lTNExE2R7f+DLbAN+rJiKTisauFCaoDq6NURZ83eVH4= -cloud.google.com/go/container v1.24.0/go.mod h1:lTNExE2R7f+DLbAN+rJiKTisauFCaoDq6NURZ83eVH4= -cloud.google.com/go/container v1.26.0/go.mod h1:YJCmRet6+6jnYYRS000T6k0D0xUXQgBSaJ7VwI8FBj4= -cloud.google.com/go/container v1.26.1/go.mod h1:5smONjPRUxeEpDG7bMKWfDL4sauswqEtnBK1/KKpR04= -cloud.google.com/go/container v1.26.2/go.mod h1:YlO84xCt5xupVbLaMY4s3XNE79MUJ+49VmkInr6HvF4= -cloud.google.com/go/container v1.27.1/go.mod h1:b1A1gJeTBXVLQ6GGw9/9M4FG94BEGsqJ5+t4d/3N7O4= -cloud.google.com/go/container v1.28.0/go.mod h1:b1A1gJeTBXVLQ6GGw9/9M4FG94BEGsqJ5+t4d/3N7O4= -cloud.google.com/go/container v1.29.0/go.mod h1:b1A1gJeTBXVLQ6GGw9/9M4FG94BEGsqJ5+t4d/3N7O4= -cloud.google.com/go/container v1.30.1/go.mod h1:vkbfX0EnAKL/vgVECs5BZn24e1cJROzgszJirRKQ4Bg= -cloud.google.com/go/container v1.31.0/go.mod h1:7yABn5s3Iv3lmw7oMmyGbeV6tQj86njcTijkkGuvdZA= -cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= -cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= -cloud.google.com/go/containeranalysis v0.7.0/go.mod h1:9aUL+/vZ55P2CXfuZjS4UjQ9AgXoSw8Ts6lemfmxBxI= -cloud.google.com/go/containeranalysis v0.9.0/go.mod h1:orbOANbwk5Ejoom+s+DUCTTJ7IBdBQJDcSylAx/on9s= -cloud.google.com/go/containeranalysis v0.10.1/go.mod h1:Ya2jiILITMY68ZLPaogjmOMNkwsDrWBSTyBubGXO7j0= -cloud.google.com/go/containeranalysis v0.11.0/go.mod h1:4n2e99ZwpGxpNcz+YsFT1dfOHPQFGcAC8FN2M2/ne/U= -cloud.google.com/go/containeranalysis v0.11.1/go.mod h1:rYlUOM7nem1OJMKwE1SadufX0JP3wnXj844EtZAwWLY= -cloud.google.com/go/containeranalysis v0.11.2/go.mod h1:xibioGBC1MD2j4reTyV1xY1/MvKaz+fyM9ENWhmIeP8= -cloud.google.com/go/containeranalysis v0.11.3/go.mod h1:kMeST7yWFQMGjiG9K7Eov+fPNQcGhb8mXj/UcTiWw9U= -cloud.google.com/go/containeranalysis v0.11.4/go.mod h1:cVZT7rXYBS9NG1rhQbWL9pWbXCKHWJPYraE8/FTSYPE= -cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= -cloud.google.com/go/datacatalog v1.5.0/go.mod h1:M7GPLNQeLfWqeIm3iuiruhPzkt65+Bx8dAKvScX8jvs= -cloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc= -cloud.google.com/go/datacatalog v1.7.0/go.mod h1:9mEl4AuDYWw81UGc41HonIHH7/sn52H0/tc8f8ZbZIE= -cloud.google.com/go/datacatalog v1.8.0/go.mod h1:KYuoVOv9BM8EYz/4eMFxrr4DUKhGIOXxZoKYF5wdISM= -cloud.google.com/go/datacatalog v1.8.1/go.mod h1:RJ58z4rMp3gvETA465Vg+ag8BGgBdnRPEMMSTr5Uv+M= -cloud.google.com/go/datacatalog v1.12.0/go.mod h1:CWae8rFkfp6LzLumKOnmVh4+Zle4A3NXLzVJ1d1mRm0= -cloud.google.com/go/datacatalog v1.13.0/go.mod h1:E4Rj9a5ZtAxcQJlEBTLgMTphfP11/lNaAshpoBgemX8= -cloud.google.com/go/datacatalog v1.14.0/go.mod h1:h0PrGtlihoutNMp/uvwhawLQ9+c63Kz65UFqh49Yo+E= -cloud.google.com/go/datacatalog v1.14.1/go.mod h1:d2CevwTG4yedZilwe+v3E3ZBDRMobQfSG/a6cCCN5R4= -cloud.google.com/go/datacatalog v1.16.0/go.mod h1:d2CevwTG4yedZilwe+v3E3ZBDRMobQfSG/a6cCCN5R4= -cloud.google.com/go/datacatalog v1.17.1/go.mod h1:nCSYFHgtxh2MiEktWIz71s/X+7ds/UT9kp0PC7waCzE= -cloud.google.com/go/datacatalog v1.18.0/go.mod h1:nCSYFHgtxh2MiEktWIz71s/X+7ds/UT9kp0PC7waCzE= -cloud.google.com/go/datacatalog v1.18.1/go.mod h1:TzAWaz+ON1tkNr4MOcak8EBHX7wIRX/gZKM+yTVsv+A= -cloud.google.com/go/datacatalog v1.18.2/go.mod h1:SPVgWW2WEMuWHA+fHodYjmxPiMqcOiWfhc9OD5msigk= -cloud.google.com/go/datacatalog v1.18.3/go.mod h1:5FR6ZIF8RZrtml0VUao22FxhdjkoG+a0866rEnObryM= -cloud.google.com/go/datacatalog v1.19.0/go.mod h1:5FR6ZIF8RZrtml0VUao22FxhdjkoG+a0866rEnObryM= -cloud.google.com/go/datacatalog v1.19.2/go.mod h1:2YbODwmhpLM4lOFe3PuEhHK9EyTzQJ5AXgIy7EDKTEE= -cloud.google.com/go/datacatalog v1.19.3/go.mod h1:ra8V3UAsciBpJKQ+z9Whkxzxv7jmQg1hfODr3N3YPJ4= -cloud.google.com/go/dataflow v0.6.0/go.mod h1:9QwV89cGoxjjSR9/r7eFDqqjtvbKxAK2BaYU6PVk9UM= -cloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ= -cloud.google.com/go/dataflow v0.8.0/go.mod h1:Rcf5YgTKPtQyYz8bLYhFoIV/vP39eL7fWNcSOyFfLJE= -cloud.google.com/go/dataflow v0.9.1/go.mod h1:Wp7s32QjYuQDWqJPFFlnBKhkAtiFpMTdg00qGbnIHVw= -cloud.google.com/go/dataflow v0.9.2/go.mod h1:vBfdBZ/ejlTaYIGB3zB4T08UshH70vbtZeMD+urnUSo= -cloud.google.com/go/dataflow v0.9.3/go.mod h1:HI4kMVjcHGTs3jTHW/kv3501YW+eloiJSLxkJa/vqFE= -cloud.google.com/go/dataflow v0.9.4/go.mod h1:4G8vAkHYCSzU8b/kmsoR2lWyHJD85oMJPHMtan40K8w= -cloud.google.com/go/dataflow v0.9.5/go.mod h1:udl6oi8pfUHnL0z6UN9Lf9chGqzDMVqcYTcZ1aPnCZQ= -cloud.google.com/go/dataform v0.3.0/go.mod h1:cj8uNliRlHpa6L3yVhDOBrUXH+BPAO1+KFMQQNSThKo= -cloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE= -cloud.google.com/go/dataform v0.5.0/go.mod h1:GFUYRe8IBa2hcomWplodVmUx/iTL0FrsauObOM3Ipr0= -cloud.google.com/go/dataform v0.6.0/go.mod h1:QPflImQy33e29VuapFdf19oPbE4aYTJxr31OAPV+ulA= -cloud.google.com/go/dataform v0.7.0/go.mod h1:7NulqnVozfHvWUBpMDfKMUESr+85aJsC/2O0o3jWPDE= -cloud.google.com/go/dataform v0.8.1/go.mod h1:3BhPSiw8xmppbgzeBbmDvmSWlwouuJkXsXsb8UBih9M= -cloud.google.com/go/dataform v0.8.2/go.mod h1:X9RIqDs6NbGPLR80tnYoPNiO1w0wenKTb8PxxlhTMKM= -cloud.google.com/go/dataform v0.8.3/go.mod h1:8nI/tvv5Fso0drO3pEjtowz58lodx8MVkdV2q0aPlqg= -cloud.google.com/go/dataform v0.9.1/go.mod h1:pWTg+zGQ7i16pyn0bS1ruqIE91SdL2FDMvEYu/8oQxs= -cloud.google.com/go/dataform v0.9.2/go.mod h1:S8cQUwPNWXo7m/g3DhWHsLBoufRNn9EgFrMgne2j7cI= -cloud.google.com/go/datafusion v1.4.0/go.mod h1:1Zb6VN+W6ALo85cXnM1IKiPw+yQMKMhB9TsTSRDo/38= -cloud.google.com/go/datafusion v1.5.0/go.mod h1:Kz+l1FGHB0J+4XF2fud96WMmRiq/wj8N9u007vyXZ2w= -cloud.google.com/go/datafusion v1.6.0/go.mod h1:WBsMF8F1RhSXvVM8rCV3AeyWVxcC2xY6vith3iw3S+8= -cloud.google.com/go/datafusion v1.7.1/go.mod h1:KpoTBbFmoToDExJUso/fcCiguGDk7MEzOWXUsJo0wsI= -cloud.google.com/go/datafusion v1.7.2/go.mod h1:62K2NEC6DRlpNmI43WHMWf9Vg/YvN6QVi8EVwifElI0= -cloud.google.com/go/datafusion v1.7.3/go.mod h1:eoLt1uFXKGBq48jy9LZ+Is8EAVLnmn50lNncLzwYokE= -cloud.google.com/go/datafusion v1.7.4/go.mod h1:BBs78WTOLYkT4GVZIXQCZT3GFpkpDN4aBY4NDX/jVlM= -cloud.google.com/go/datafusion v1.7.5/go.mod h1:bYH53Oa5UiqahfbNK9YuYKteeD4RbQSNMx7JF7peGHc= -cloud.google.com/go/datalabeling v0.5.0/go.mod h1:TGcJ0G2NzcsXSE/97yWjIZO0bXj0KbVlINXMG9ud42I= -cloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ= -cloud.google.com/go/datalabeling v0.7.0/go.mod h1:WPQb1y08RJbmpM3ww0CSUAGweL0SxByuW2E+FU+wXcM= -cloud.google.com/go/datalabeling v0.8.1/go.mod h1:XS62LBSVPbYR54GfYQsPXZjTW8UxCK2fkDciSrpRFdY= -cloud.google.com/go/datalabeling v0.8.2/go.mod h1:cyDvGHuJWu9U/cLDA7d8sb9a0tWLEletStu2sTmg3BE= -cloud.google.com/go/datalabeling v0.8.3/go.mod h1:tvPhpGyS/V7lqjmb3V0TaDdGvhzgR1JoW7G2bpi2UTI= -cloud.google.com/go/datalabeling v0.8.4/go.mod h1:Z1z3E6LHtffBGrNUkKwbwbDxTiXEApLzIgmymj8A3S8= -cloud.google.com/go/datalabeling v0.8.5/go.mod h1:IABB2lxQnkdUbMnQaOl2prCOfms20mcPxDBm36lps+s= -cloud.google.com/go/dataplex v1.3.0/go.mod h1:hQuRtDg+fCiFgC8j0zV222HvzFQdRd+SVX8gdmFcZzA= -cloud.google.com/go/dataplex v1.4.0/go.mod h1:X51GfLXEMVJ6UN47ESVqvlsRplbLhcsAt0kZCCKsU0A= -cloud.google.com/go/dataplex v1.5.2/go.mod h1:cVMgQHsmfRoI5KFYq4JtIBEUbYwc3c7tXmIDhRmNNVQ= -cloud.google.com/go/dataplex v1.6.0/go.mod h1:bMsomC/aEJOSpHXdFKFGQ1b0TDPIeL28nJObeO1ppRs= -cloud.google.com/go/dataplex v1.8.1/go.mod h1:7TyrDT6BCdI8/38Uvp0/ZxBslOslP2X2MPDucliyvSE= -cloud.google.com/go/dataplex v1.9.0/go.mod h1:7TyrDT6BCdI8/38Uvp0/ZxBslOslP2X2MPDucliyvSE= -cloud.google.com/go/dataplex v1.9.1/go.mod h1:7TyrDT6BCdI8/38Uvp0/ZxBslOslP2X2MPDucliyvSE= -cloud.google.com/go/dataplex v1.10.1/go.mod h1:1MzmBv8FvjYfc7vDdxhnLFNskikkB+3vl475/XdCDhs= -cloud.google.com/go/dataplex v1.10.2/go.mod h1:xdC8URdTrCrZMW6keY779ZT1cTOfV8KEPNsw+LTRT1Y= -cloud.google.com/go/dataplex v1.11.1/go.mod h1:mHJYQQ2VEJHsyoC0OdNyy988DvEbPhqFs5OOLffLX0c= -cloud.google.com/go/dataplex v1.11.2/go.mod h1:mHJYQQ2VEJHsyoC0OdNyy988DvEbPhqFs5OOLffLX0c= -cloud.google.com/go/dataplex v1.13.0/go.mod h1:mHJYQQ2VEJHsyoC0OdNyy988DvEbPhqFs5OOLffLX0c= -cloud.google.com/go/dataplex v1.14.0/go.mod h1:mHJYQQ2VEJHsyoC0OdNyy988DvEbPhqFs5OOLffLX0c= -cloud.google.com/go/dataplex v1.14.1/go.mod h1:bWxQAbg6Smg+sca2+Ex7s8D9a5qU6xfXtwmq4BVReps= -cloud.google.com/go/dataplex v1.14.2/go.mod h1:0oGOSFlEKef1cQeAHXy4GZPB/Ife0fz/PxBf+ZymA2U= -cloud.google.com/go/dataproc v1.7.0/go.mod h1:CKAlMjII9H90RXaMpSxQ8EU6dQx6iAYNPcYPOkSbi8s= -cloud.google.com/go/dataproc v1.8.0/go.mod h1:5OW+zNAH0pMpw14JVrPONsxMQYMBqJuzORhIBfBn9uI= -cloud.google.com/go/dataproc v1.12.0/go.mod h1:zrF3aX0uV3ikkMz6z4uBbIKyhRITnxvr4i3IjKsKrw4= -cloud.google.com/go/dataproc/v2 v2.0.1/go.mod h1:7Ez3KRHdFGcfY7GcevBbvozX+zyWGcwLJvvAMwCaoZ4= -cloud.google.com/go/dataproc/v2 v2.2.0/go.mod h1:lZR7AQtwZPvmINx5J87DSOOpTfof9LVZju6/Qo4lmcY= -cloud.google.com/go/dataproc/v2 v2.2.1/go.mod h1:QdAJLaBjh+l4PVlVZcmrmhGccosY/omC1qwfQ61Zv/o= -cloud.google.com/go/dataproc/v2 v2.2.2/go.mod h1:aocQywVmQVF4i8CL740rNI/ZRpsaaC1Wh2++BJ7HEJ4= -cloud.google.com/go/dataproc/v2 v2.2.3/go.mod h1:G5R6GBc9r36SXv/RtZIVfB8SipI+xVn0bX5SxUzVYbY= -cloud.google.com/go/dataproc/v2 v2.3.0/go.mod h1:G5R6GBc9r36SXv/RtZIVfB8SipI+xVn0bX5SxUzVYbY= -cloud.google.com/go/dataproc/v2 v2.4.0/go.mod h1:3B1Ht2aRB8VZIteGxQS/iNSJGzt9+CA0WGnDVMEm7Z4= -cloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4cK3vbhkeo= -cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA= -cloud.google.com/go/dataqna v0.7.0/go.mod h1:Lx9OcIIeqCrw1a6KdO3/5KMP1wAmTc0slZWwP12Qq3c= -cloud.google.com/go/dataqna v0.8.1/go.mod h1:zxZM0Bl6liMePWsHA8RMGAfmTG34vJMapbHAxQ5+WA8= -cloud.google.com/go/dataqna v0.8.2/go.mod h1:KNEqgx8TTmUipnQsScOoDpq/VlXVptUqVMZnt30WAPs= -cloud.google.com/go/dataqna v0.8.3/go.mod h1:wXNBW2uvc9e7Gl5k8adyAMnLush1KVV6lZUhB+rqNu4= -cloud.google.com/go/dataqna v0.8.4/go.mod h1:mySRKjKg5Lz784P6sCov3p1QD+RZQONRMRjzGNcFd0c= -cloud.google.com/go/dataqna v0.8.5/go.mod h1:vgihg1mz6n7pb5q2YJF7KlXve6tCglInd6XO0JGOlWM= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/datastore v1.10.0/go.mod h1:PC5UzAmDEkAmkfaknstTYbNpgE49HAgW2J1gcgUfmdM= -cloud.google.com/go/datastore v1.11.0/go.mod h1:TvGxBIHCS50u8jzG+AW/ppf87v1of8nwzFNgEZU1D3c= -cloud.google.com/go/datastore v1.12.0/go.mod h1:KjdB88W897MRITkvWWJrg2OUtrR5XVj1EoLgSp6/N70= -cloud.google.com/go/datastore v1.12.1/go.mod h1:KjdB88W897MRITkvWWJrg2OUtrR5XVj1EoLgSp6/N70= -cloud.google.com/go/datastore v1.13.0/go.mod h1:KjdB88W897MRITkvWWJrg2OUtrR5XVj1EoLgSp6/N70= -cloud.google.com/go/datastore v1.14.0/go.mod h1:GAeStMBIt9bPS7jMJA85kgkpsMkvseWWXiaHya9Jes8= -cloud.google.com/go/datastore v1.15.0/go.mod h1:GAeStMBIt9bPS7jMJA85kgkpsMkvseWWXiaHya9Jes8= -cloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo= -cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ= -cloud.google.com/go/datastream v1.4.0/go.mod h1:h9dpzScPhDTs5noEMQVWP8Wx8AFBRyS0s8KWPx/9r0g= -cloud.google.com/go/datastream v1.5.0/go.mod h1:6TZMMNPwjUqZHBKPQ1wwXpb0d5VDVPl2/XoS5yi88q4= -cloud.google.com/go/datastream v1.6.0/go.mod h1:6LQSuswqLa7S4rPAOZFVjHIG3wJIjZcZrw8JDEDJuIs= -cloud.google.com/go/datastream v1.7.0/go.mod h1:uxVRMm2elUSPuh65IbZpzJNMbuzkcvu5CjMqVIUHrww= -cloud.google.com/go/datastream v1.9.1/go.mod h1:hqnmr8kdUBmrnk65k5wNRoHSCYksvpdZIcZIEl8h43Q= -cloud.google.com/go/datastream v1.10.0/go.mod h1:hqnmr8kdUBmrnk65k5wNRoHSCYksvpdZIcZIEl8h43Q= -cloud.google.com/go/datastream v1.10.1/go.mod h1:7ngSYwnw95YFyTd5tOGBxHlOZiL+OtpjheqU7t2/s/c= -cloud.google.com/go/datastream v1.10.2/go.mod h1:W42TFgKAs/om6x/CdXX5E4oiAsKlH+e8MTGy81zdYt0= -cloud.google.com/go/datastream v1.10.3/go.mod h1:YR0USzgjhqA/Id0Ycu1VvZe8hEWwrkjuXrGbzeDOSEA= -cloud.google.com/go/datastream v1.10.4/go.mod h1:7kRxPdxZxhPg3MFeCSulmAJnil8NJGGvSNdn4p1sRZo= -cloud.google.com/go/deploy v1.4.0/go.mod h1:5Xghikd4VrmMLNaF6FiRFDlHb59VM59YoDQnOUdsH/c= -cloud.google.com/go/deploy v1.5.0/go.mod h1:ffgdD0B89tToyW/U/D2eL0jN2+IEV/3EMuXHA0l4r+s= -cloud.google.com/go/deploy v1.6.0/go.mod h1:f9PTHehG/DjCom3QH0cntOVRm93uGBDt2vKzAPwpXQI= -cloud.google.com/go/deploy v1.8.0/go.mod h1:z3myEJnA/2wnB4sgjqdMfgxCA0EqC3RBTNcVPs93mtQ= -cloud.google.com/go/deploy v1.11.0/go.mod h1:tKuSUV5pXbn67KiubiUNUejqLs4f5cxxiCNCeyl0F2g= -cloud.google.com/go/deploy v1.13.0/go.mod h1:tKuSUV5pXbn67KiubiUNUejqLs4f5cxxiCNCeyl0F2g= -cloud.google.com/go/deploy v1.13.1/go.mod h1:8jeadyLkH9qu9xgO3hVWw8jVr29N1mnW42gRJT8GY6g= -cloud.google.com/go/deploy v1.14.1/go.mod h1:N8S0b+aIHSEeSr5ORVoC0+/mOPUysVt8ae4QkZYolAw= -cloud.google.com/go/deploy v1.14.2/go.mod h1:e5XOUI5D+YGldyLNZ21wbp9S8otJbBE4i88PtO9x/2g= -cloud.google.com/go/deploy v1.15.0/go.mod h1:e5XOUI5D+YGldyLNZ21wbp9S8otJbBE4i88PtO9x/2g= -cloud.google.com/go/deploy v1.16.0/go.mod h1:e5XOUI5D+YGldyLNZ21wbp9S8otJbBE4i88PtO9x/2g= -cloud.google.com/go/deploy v1.17.0/go.mod h1:XBr42U5jIr64t92gcpOXxNrqL2PStQCXHuKK5GRUuYo= -cloud.google.com/go/deploy v1.17.1/go.mod h1:SXQyfsXrk0fBmgBHRzBjQbZhMfKZ3hMQBw5ym7MN/50= -cloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4= -cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0= -cloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8= -cloud.google.com/go/dialogflow v1.18.0/go.mod h1:trO7Zu5YdyEuR+BhSNOqJezyFQ3aUzz0njv7sMx/iek= -cloud.google.com/go/dialogflow v1.19.0/go.mod h1:JVmlG1TwykZDtxtTXujec4tQ+D8SBFMoosgy+6Gn0s0= -cloud.google.com/go/dialogflow v1.29.0/go.mod h1:b+2bzMe+k1s9V+F2jbJwpHPzrnIyHihAdRFMtn2WXuM= -cloud.google.com/go/dialogflow v1.31.0/go.mod h1:cuoUccuL1Z+HADhyIA7dci3N5zUssgpBJmCzI6fNRB4= -cloud.google.com/go/dialogflow v1.32.0/go.mod h1:jG9TRJl8CKrDhMEcvfcfFkkpp8ZhgPz3sBGmAUYJ2qE= -cloud.google.com/go/dialogflow v1.38.0/go.mod h1:L7jnH+JL2mtmdChzAIcXQHXMvQkE3U4hTaNltEuxXn4= -cloud.google.com/go/dialogflow v1.40.0/go.mod h1:L7jnH+JL2mtmdChzAIcXQHXMvQkE3U4hTaNltEuxXn4= -cloud.google.com/go/dialogflow v1.43.0/go.mod h1:pDUJdi4elL0MFmt1REMvFkdsUTYSHq+rTCS8wg0S3+M= -cloud.google.com/go/dialogflow v1.44.0/go.mod h1:pDUJdi4elL0MFmt1REMvFkdsUTYSHq+rTCS8wg0S3+M= -cloud.google.com/go/dialogflow v1.44.1/go.mod h1:n/h+/N2ouKOO+rbe/ZnI186xImpqvCVj2DdsWS/0EAk= -cloud.google.com/go/dialogflow v1.44.2/go.mod h1:QzFYndeJhpVPElnFkUXxdlptx0wPnBWLCBT9BvtC3/c= -cloud.google.com/go/dialogflow v1.44.3/go.mod h1:mHly4vU7cPXVweuB5R0zsYKPMzy240aQdAu06SqBbAQ= -cloud.google.com/go/dialogflow v1.47.0/go.mod h1:mHly4vU7cPXVweuB5R0zsYKPMzy240aQdAu06SqBbAQ= -cloud.google.com/go/dialogflow v1.48.0/go.mod h1:mHly4vU7cPXVweuB5R0zsYKPMzy240aQdAu06SqBbAQ= -cloud.google.com/go/dialogflow v1.48.1/go.mod h1:C1sjs2/g9cEwjCltkKeYp3FFpz8BOzNondEaAlCpt+A= -cloud.google.com/go/dialogflow v1.48.2/go.mod h1:7A2oDf6JJ1/+hdpnFRfb/RjJUOh2X3rhIa5P8wQSEX4= -cloud.google.com/go/dialogflow v1.49.0/go.mod h1:dhVrXKETtdPlpPhE7+2/k4Z8FRNUp6kMV3EW3oz/fe0= -cloud.google.com/go/dlp v1.6.0/go.mod h1:9eyB2xIhpU0sVwUixfBubDoRwP+GjeUoxxeueZmqvmM= -cloud.google.com/go/dlp v1.7.0/go.mod h1:68ak9vCiMBjbasxeVD17hVPxDEck+ExiHavX8kiHG+Q= -cloud.google.com/go/dlp v1.9.0/go.mod h1:qdgmqgTyReTz5/YNSSuueR8pl7hO0o9bQ39ZhtgkWp4= -cloud.google.com/go/dlp v1.10.1/go.mod h1:IM8BWz1iJd8njcNcG0+Kyd9OPnqnRNkDV8j42VT5KOI= -cloud.google.com/go/dlp v1.10.2/go.mod h1:ZbdKIhcnyhILgccwVDzkwqybthh7+MplGC3kZVZsIOQ= -cloud.google.com/go/dlp v1.10.3/go.mod h1:iUaTc/ln8I+QT6Ai5vmuwfw8fqTk2kaz0FvCwhLCom0= -cloud.google.com/go/dlp v1.11.1/go.mod h1:/PA2EnioBeXTL/0hInwgj0rfsQb3lpE3R8XUJxqUNKI= -cloud.google.com/go/dlp v1.11.2/go.mod h1:9Czi+8Y/FegpWzgSfkRlyz+jwW6Te9Rv26P3UfU/h/w= -cloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU= -cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU= -cloud.google.com/go/documentai v1.9.0/go.mod h1:FS5485S8R00U10GhgBC0aNGrJxBP8ZVpEeJ7PQDZd6k= -cloud.google.com/go/documentai v1.10.0/go.mod h1:vod47hKQIPeCfN2QS/jULIvQTugbmdc0ZvxxfQY1bg4= -cloud.google.com/go/documentai v1.16.0/go.mod h1:o0o0DLTEZ+YnJZ+J4wNfTxmDVyrkzFvttBXXtYRMHkM= -cloud.google.com/go/documentai v1.18.0/go.mod h1:F6CK6iUH8J81FehpskRmhLq/3VlwQvb7TvwOceQ2tbs= -cloud.google.com/go/documentai v1.20.0/go.mod h1:yJkInoMcK0qNAEdRnqY/D5asy73tnPe88I1YTZT+a8E= -cloud.google.com/go/documentai v1.22.0/go.mod h1:yJkInoMcK0qNAEdRnqY/D5asy73tnPe88I1YTZT+a8E= -cloud.google.com/go/documentai v1.22.1/go.mod h1:LKs22aDHbJv7ufXuPypzRO7rG3ALLJxzdCXDPutw4Qc= -cloud.google.com/go/documentai v1.23.0/go.mod h1:LKs22aDHbJv7ufXuPypzRO7rG3ALLJxzdCXDPutw4Qc= -cloud.google.com/go/documentai v1.23.2/go.mod h1:Q/wcRT+qnuXOpjAkvOV4A+IeQl04q2/ReT7SSbytLSo= -cloud.google.com/go/documentai v1.23.4/go.mod h1:4MYAaEMnADPN1LPN5xboDR5QVB6AgsaxgFdJhitlE2Y= -cloud.google.com/go/documentai v1.23.5/go.mod h1:ghzBsyVTiVdkfKaUCum/9bGBEyBjDO4GfooEcYKhN+g= -cloud.google.com/go/documentai v1.23.6/go.mod h1:ghzBsyVTiVdkfKaUCum/9bGBEyBjDO4GfooEcYKhN+g= -cloud.google.com/go/documentai v1.23.7/go.mod h1:ghzBsyVTiVdkfKaUCum/9bGBEyBjDO4GfooEcYKhN+g= -cloud.google.com/go/documentai v1.23.8/go.mod h1:Vd/y5PosxCpUHmwC+v9arZyeMfTqBR9VIwOwIqQYYfA= -cloud.google.com/go/documentai v1.25.0/go.mod h1:ftLnzw5VcXkLItp6pw1mFic91tMRyfv6hHEY5br4KzY= -cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y= -cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg= -cloud.google.com/go/domains v0.8.0/go.mod h1:M9i3MMDzGFXsydri9/vW+EWz9sWb4I6WyHqdlAk0idE= -cloud.google.com/go/domains v0.9.1/go.mod h1:aOp1c0MbejQQ2Pjf1iJvnVyT+z6R6s8pX66KaCSDYfE= -cloud.google.com/go/domains v0.9.2/go.mod h1:3YvXGYzZG1Temjbk7EyGCuGGiXHJwVNmwIf+E/cUp5I= -cloud.google.com/go/domains v0.9.3/go.mod h1:29k66YNDLDY9LCFKpGFeh6Nj9r62ZKm5EsUJxAl84KU= -cloud.google.com/go/domains v0.9.4/go.mod h1:27jmJGShuXYdUNjyDG0SodTfT5RwLi7xmH334Gvi3fY= -cloud.google.com/go/domains v0.9.5/go.mod h1:dBzlxgepazdFhvG7u23XMhmMKBjrkoUNaw0A8AQB55Y= -cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk= -cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w= -cloud.google.com/go/edgecontainer v0.3.0/go.mod h1:FLDpP4nykgwwIfcLt6zInhprzw0lEi2P1fjO6Ie0qbc= -cloud.google.com/go/edgecontainer v1.0.0/go.mod h1:cttArqZpBB2q58W/upSG++ooo6EsblxDIolxa3jSjbY= -cloud.google.com/go/edgecontainer v1.1.1/go.mod h1:O5bYcS//7MELQZs3+7mabRqoWQhXCzenBu0R8bz2rwk= -cloud.google.com/go/edgecontainer v1.1.2/go.mod h1:wQRjIzqxEs9e9wrtle4hQPSR1Y51kqN75dgF7UllZZ4= -cloud.google.com/go/edgecontainer v1.1.3/go.mod h1:Ll2DtIABzEfaxaVSbwj3QHFaOOovlDFiWVDu349jSsA= -cloud.google.com/go/edgecontainer v1.1.4/go.mod h1:AvFdVuZuVGdgaE5YvlL1faAoa1ndRR/5XhXZvPBHbsE= -cloud.google.com/go/edgecontainer v1.1.5/go.mod h1:rgcjrba3DEDEQAidT4yuzaKWTbkTI5zAMu3yy6ZWS0M= -cloud.google.com/go/errorreporting v0.3.0/go.mod h1:xsP2yaAp+OAW4OIm60An2bbLpqIhKXdWR/tawvl7QzU= -cloud.google.com/go/essentialcontacts v1.3.0/go.mod h1:r+OnHa5jfj90qIfZDO/VztSFqbQan7HV75p8sA+mdGI= -cloud.google.com/go/essentialcontacts v1.4.0/go.mod h1:8tRldvHYsmnBCHdFpvU+GL75oWiBKl80BiqlFh9tp+8= -cloud.google.com/go/essentialcontacts v1.5.0/go.mod h1:ay29Z4zODTuwliK7SnX8E86aUF2CTzdNtvv42niCX0M= -cloud.google.com/go/essentialcontacts v1.6.2/go.mod h1:T2tB6tX+TRak7i88Fb2N9Ok3PvY3UNbUsMag9/BARh4= -cloud.google.com/go/essentialcontacts v1.6.3/go.mod h1:yiPCD7f2TkP82oJEFXFTou8Jl8L6LBRPeBEkTaO0Ggo= -cloud.google.com/go/essentialcontacts v1.6.4/go.mod h1:iju5Vy3d9tJUg0PYMd1nHhjV7xoCXaOAVabrwLaPBEM= -cloud.google.com/go/essentialcontacts v1.6.5/go.mod h1:jjYbPzw0x+yglXC890l6ECJWdYeZ5dlYACTFL0U/VuM= -cloud.google.com/go/essentialcontacts v1.6.6/go.mod h1:XbqHJGaiH0v2UvtuucfOzFXN+rpL/aU5BCZLn4DYl1Q= -cloud.google.com/go/eventarc v1.7.0/go.mod h1:6ctpF3zTnaQCxUjHUdcfgcA1A2T309+omHZth7gDfmc= -cloud.google.com/go/eventarc v1.8.0/go.mod h1:imbzxkyAU4ubfsaKYdQg04WS1NvncblHEup4kvF+4gw= -cloud.google.com/go/eventarc v1.10.0/go.mod h1:u3R35tmZ9HvswGRBnF48IlYgYeBcPUCjkr4BTdem2Kw= -cloud.google.com/go/eventarc v1.11.0/go.mod h1:PyUjsUKPWoRBCHeOxZd/lbOOjahV41icXyUY5kSTvVY= -cloud.google.com/go/eventarc v1.12.1/go.mod h1:mAFCW6lukH5+IZjkvrEss+jmt2kOdYlN8aMx3sRJiAI= -cloud.google.com/go/eventarc v1.13.0/go.mod h1:mAFCW6lukH5+IZjkvrEss+jmt2kOdYlN8aMx3sRJiAI= -cloud.google.com/go/eventarc v1.13.1/go.mod h1:EqBxmGHFrruIara4FUQ3RHlgfCn7yo1HYsu2Hpt/C3Y= -cloud.google.com/go/eventarc v1.13.2/go.mod h1:X9A80ShVu19fb4e5sc/OLV7mpFUKZMwfJFeeWhcIObM= -cloud.google.com/go/eventarc v1.13.3/go.mod h1:RWH10IAZIRcj1s/vClXkBgMHwh59ts7hSWcqD3kaclg= -cloud.google.com/go/eventarc v1.13.4/go.mod h1:zV5sFVoAa9orc/52Q+OuYUG9xL2IIZTbbuTHC6JSY8s= -cloud.google.com/go/filestore v1.3.0/go.mod h1:+qbvHGvXU1HaKX2nD0WEPo92TP/8AQuCVEBXNY9z0+w= -cloud.google.com/go/filestore v1.4.0/go.mod h1:PaG5oDfo9r224f8OYXURtAsY+Fbyq/bLYoINEK8XQAI= -cloud.google.com/go/filestore v1.5.0/go.mod h1:FqBXDWBp4YLHqRnVGveOkHDf8svj9r5+mUDLupOWEDs= -cloud.google.com/go/filestore v1.6.0/go.mod h1:di5unNuss/qfZTw2U9nhFqo8/ZDSc466dre85Kydllg= -cloud.google.com/go/filestore v1.7.1/go.mod h1:y10jsorq40JJnjR/lQ8AfFbbcGlw3g+Dp8oN7i7FjV4= -cloud.google.com/go/filestore v1.7.2/go.mod h1:TYOlyJs25f/omgj+vY7/tIG/E7BX369triSPzE4LdgE= -cloud.google.com/go/filestore v1.7.3/go.mod h1:Qp8WaEERR3cSkxToxFPHh/b8AACkSut+4qlCjAmKTV0= -cloud.google.com/go/filestore v1.7.4/go.mod h1:S5JCxIbFjeBhWMTfIYH2Jx24J6BqjwpkkPl+nBA5DlI= -cloud.google.com/go/filestore v1.8.0/go.mod h1:S5JCxIbFjeBhWMTfIYH2Jx24J6BqjwpkkPl+nBA5DlI= -cloud.google.com/go/filestore v1.8.1/go.mod h1:MbN9KcaM47DRTIuLfQhJEsjaocVebNtNQhSLhKCF5GM= -cloud.google.com/go/firestore v1.9.0/go.mod h1:HMkjKHNTtRyZNiMzu7YAsLr9K3X2udY2AMwDaMEQiiE= -cloud.google.com/go/firestore v1.11.0/go.mod h1:b38dKhgzlmNNGTNZZwe7ZRFEuRab1Hay3/DBsIGKKy4= -cloud.google.com/go/firestore v1.12.0/go.mod h1:b38dKhgzlmNNGTNZZwe7ZRFEuRab1Hay3/DBsIGKKy4= -cloud.google.com/go/firestore v1.13.0/go.mod h1:QojqqOh8IntInDUSTAh0c8ZsPYAr68Ma8c5DWOy8xb8= -cloud.google.com/go/firestore v1.14.0/go.mod h1:96MVaHLsEhbvkBEdZgfN+AS/GIkco1LRpH9Xp9YZfzQ= -cloud.google.com/go/functions v1.6.0/go.mod h1:3H1UA3qiIPRWD7PeZKLvHZ9SaQhR26XIJcC0A5GbvAk= -cloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg= -cloud.google.com/go/functions v1.8.0/go.mod h1:RTZ4/HsQjIqIYP9a9YPbU+QFoQsAlYgrwOXJWHn1POY= -cloud.google.com/go/functions v1.9.0/go.mod h1:Y+Dz8yGguzO3PpIjhLTbnqV1CWmgQ5UwtlpzoyquQ08= -cloud.google.com/go/functions v1.10.0/go.mod h1:0D3hEOe3DbEvCXtYOZHQZmD+SzYsi1YbI7dGvHfldXw= -cloud.google.com/go/functions v1.12.0/go.mod h1:AXWGrF3e2C/5ehvwYo/GH6O5s09tOPksiKhz+hH8WkA= -cloud.google.com/go/functions v1.13.0/go.mod h1:EU4O007sQm6Ef/PwRsI8N2umygGqPBS/IZQKBQBcJ3c= -cloud.google.com/go/functions v1.15.1/go.mod h1:P5yNWUTkyU+LvW/S9O6V+V423VZooALQlqoXdoPz5AE= -cloud.google.com/go/functions v1.15.2/go.mod h1:CHAjtcR6OU4XF2HuiVeriEdELNcnvRZSk1Q8RMqy4lE= -cloud.google.com/go/functions v1.15.3/go.mod h1:r/AMHwBheapkkySEhiZYLDBwVJCdlRwsm4ieJu35/Ug= -cloud.google.com/go/functions v1.15.4/go.mod h1:CAsTc3VlRMVvx+XqXxKqVevguqJpnVip4DdonFsX28I= -cloud.google.com/go/functions v1.16.0/go.mod h1:nbNpfAG7SG7Duw/o1iZ6ohvL7mc6MapWQVpqtM29n8k= -cloud.google.com/go/gaming v1.5.0/go.mod h1:ol7rGcxP/qHTRQE/RO4bxkXq+Fix0j6D4LFPzYTIrDM= -cloud.google.com/go/gaming v1.6.0/go.mod h1:YMU1GEvA39Qt3zWGyAVA9bpYz/yAhTvaQ1t2sK4KPUA= -cloud.google.com/go/gaming v1.7.0/go.mod h1:LrB8U7MHdGgFG851iHAfqUdLcKBdQ55hzXy9xBJz0+w= -cloud.google.com/go/gaming v1.8.0/go.mod h1:xAqjS8b7jAVW0KFYeRUxngo9My3f33kFmua++Pi+ggM= -cloud.google.com/go/gaming v1.9.0/go.mod h1:Fc7kEmCObylSWLO334NcO+O9QMDyz+TKC4v1D7X+Bc0= -cloud.google.com/go/gaming v1.10.1/go.mod h1:XQQvtfP8Rb9Rxnxm5wFVpAp9zCQkJi2bLIb7iHGwB3s= -cloud.google.com/go/gkebackup v0.2.0/go.mod h1:XKvv/4LfG829/B8B7xRkk8zRrOEbKtEam6yNfuQNH60= -cloud.google.com/go/gkebackup v0.3.0/go.mod h1:n/E671i1aOQvUxT541aTkCwExO/bTer2HDlj4TsBRAo= -cloud.google.com/go/gkebackup v0.4.0/go.mod h1:byAyBGUwYGEEww7xsbnUTBHIYcOPy/PgUWUtOeRm9Vg= -cloud.google.com/go/gkebackup v1.3.0/go.mod h1:vUDOu++N0U5qs4IhG1pcOnD1Mac79xWy6GoBFlWCWBU= -cloud.google.com/go/gkebackup v1.3.1/go.mod h1:vUDOu++N0U5qs4IhG1pcOnD1Mac79xWy6GoBFlWCWBU= -cloud.google.com/go/gkebackup v1.3.2/go.mod h1:OMZbXzEJloyXMC7gqdSB+EOEQ1AKcpGYvO3s1ec5ixk= -cloud.google.com/go/gkebackup v1.3.3/go.mod h1:eMk7/wVV5P22KBakhQnJxWSVftL1p4VBFLpv0kIft7I= -cloud.google.com/go/gkebackup v1.3.4/go.mod h1:gLVlbM8h/nHIs09ns1qx3q3eaXcGSELgNu1DWXYz1HI= -cloud.google.com/go/gkebackup v1.3.5/go.mod h1:KJ77KkNN7Wm1LdMopOelV6OodM01pMuK2/5Zt1t4Tvc= -cloud.google.com/go/gkeconnect v0.5.0/go.mod h1:c5lsNAg5EwAy7fkqX/+goqFsU1Da/jQFqArp+wGNr/o= -cloud.google.com/go/gkeconnect v0.6.0/go.mod h1:Mln67KyU/sHJEBY8kFZ0xTeyPtzbq9StAVvEULYK16A= -cloud.google.com/go/gkeconnect v0.7.0/go.mod h1:SNfmVqPkaEi3bF/B3CNZOAYPYdg7sU+obZ+QTky2Myw= -cloud.google.com/go/gkeconnect v0.8.1/go.mod h1:KWiK1g9sDLZqhxB2xEuPV8V9NYzrqTUmQR9shJHpOZw= -cloud.google.com/go/gkeconnect v0.8.2/go.mod h1:6nAVhwchBJYgQCXD2pHBFQNiJNyAd/wyxljpaa6ZPrY= -cloud.google.com/go/gkeconnect v0.8.3/go.mod h1:i9GDTrfzBSUZGCe98qSu1B8YB8qfapT57PenIb820Jo= -cloud.google.com/go/gkeconnect v0.8.4/go.mod h1:84hZz4UMlDCKl8ifVW8layK4WHlMAFeq8vbzjU0yJkw= -cloud.google.com/go/gkeconnect v0.8.5/go.mod h1:LC/rS7+CuJ5fgIbXv8tCD/mdfnlAadTaUufgOkmijuk= -cloud.google.com/go/gkehub v0.9.0/go.mod h1:WYHN6WG8w9bXU0hqNxt8rm5uxnk8IH+lPY9J2TV7BK0= -cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y977wO+hBH0= -cloud.google.com/go/gkehub v0.11.0/go.mod h1:JOWHlmN+GHyIbuWQPl47/C2RFhnFKH38jH9Ascu3n0E= -cloud.google.com/go/gkehub v0.12.0/go.mod h1:djiIwwzTTBrF5NaXCGv3mf7klpEMcST17VBTVVDcuaw= -cloud.google.com/go/gkehub v0.14.1/go.mod h1:VEXKIJZ2avzrbd7u+zeMtW00Y8ddk/4V9511C9CQGTY= -cloud.google.com/go/gkehub v0.14.2/go.mod h1:iyjYH23XzAxSdhrbmfoQdePnlMj2EWcvnR+tHdBQsCY= -cloud.google.com/go/gkehub v0.14.3/go.mod h1:jAl6WafkHHW18qgq7kqcrXYzN08hXeK/Va3utN8VKg8= -cloud.google.com/go/gkehub v0.14.4/go.mod h1:Xispfu2MqnnFt8rV/2/3o73SK1snL8s9dYJ9G2oQMfc= -cloud.google.com/go/gkehub v0.14.5/go.mod h1:6bzqxM+a+vEH/h8W8ec4OJl4r36laxTs3A/fMNHJ0wA= -cloud.google.com/go/gkemulticloud v0.3.0/go.mod h1:7orzy7O0S+5kq95e4Hpn7RysVA7dPs8W/GgfUtsPbrA= -cloud.google.com/go/gkemulticloud v0.4.0/go.mod h1:E9gxVBnseLWCk24ch+P9+B2CoDFJZTyIgLKSalC7tuI= -cloud.google.com/go/gkemulticloud v0.5.0/go.mod h1:W0JDkiyi3Tqh0TJr//y19wyb1yf8llHVto2Htf2Ja3Y= -cloud.google.com/go/gkemulticloud v0.6.1/go.mod h1:kbZ3HKyTsiwqKX7Yw56+wUGwwNZViRnxWK2DVknXWfw= -cloud.google.com/go/gkemulticloud v1.0.0/go.mod h1:kbZ3HKyTsiwqKX7Yw56+wUGwwNZViRnxWK2DVknXWfw= -cloud.google.com/go/gkemulticloud v1.0.1/go.mod h1:AcrGoin6VLKT/fwZEYuqvVominLriQBCKmbjtnbMjG8= -cloud.google.com/go/gkemulticloud v1.0.2/go.mod h1:+ee5VXxKb3H1l4LZAcgWB/rvI16VTNTrInWxDjAGsGo= -cloud.google.com/go/gkemulticloud v1.0.3/go.mod h1:7NpJBN94U6DY1xHIbsDqB2+TFZUfjLUKLjUX8NGLor0= -cloud.google.com/go/gkemulticloud v1.1.0/go.mod h1:7NpJBN94U6DY1xHIbsDqB2+TFZUfjLUKLjUX8NGLor0= -cloud.google.com/go/gkemulticloud v1.1.1/go.mod h1:C+a4vcHlWeEIf45IB5FFR5XGjTeYhF83+AYIpTy4i2Q= -cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= -cloud.google.com/go/grafeas v0.3.0/go.mod h1:P7hgN24EyONOTMyeJH6DxG4zD7fwiYa5Q6GUgyFSOU8= -cloud.google.com/go/grafeas v0.3.4/go.mod h1:A5m316hcG+AulafjAbPKXBO/+I5itU4LOdKO2R/uDIc= -cloud.google.com/go/gsuiteaddons v1.3.0/go.mod h1:EUNK/J1lZEZO8yPtykKxLXI6JSVN2rg9bN8SXOa0bgM= -cloud.google.com/go/gsuiteaddons v1.4.0/go.mod h1:rZK5I8hht7u7HxFQcFei0+AtfS9uSushomRlg+3ua1o= -cloud.google.com/go/gsuiteaddons v1.5.0/go.mod h1:TFCClYLd64Eaa12sFVmUyG62tk4mdIsI7pAnSXRkcFo= -cloud.google.com/go/gsuiteaddons v1.6.1/go.mod h1:CodrdOqRZcLp5WOwejHWYBjZvfY0kOphkAKpF/3qdZY= -cloud.google.com/go/gsuiteaddons v1.6.2/go.mod h1:K65m9XSgs8hTF3X9nNTPi8IQueljSdYo9F+Mi+s4MyU= -cloud.google.com/go/gsuiteaddons v1.6.3/go.mod h1:sCFJkZoMrLZT3JTb8uJqgKPNshH2tfXeCwTFRebTq48= -cloud.google.com/go/gsuiteaddons v1.6.4/go.mod h1:rxtstw7Fx22uLOXBpsvb9DUbC+fiXs7rF4U29KHM/pE= -cloud.google.com/go/gsuiteaddons v1.6.5/go.mod h1:Lo4P2IvO8uZ9W+RaC6s1JVxo42vgy+TX5a6hfBZ0ubs= -cloud.google.com/go/iam v0.1.0/go.mod h1:vcUNEa0pEm0qRVpmWepWaFMIAI8/hjB9mO8rNCJtF6c= -cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= -cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v0.6.0/go.mod h1:+1AH33ueBne5MzYccyMHtEKqLE4/kJOibtffMHDMFMc= -cloud.google.com/go/iam v0.7.0/go.mod h1:H5Br8wRaDGNc8XP3keLc4unfUUZeyH3Sfl9XpQEYOeg= -cloud.google.com/go/iam v0.8.0/go.mod h1:lga0/y3iH6CX7sYqypWJ33hf7kkfXJag67naqGESjkE= -cloud.google.com/go/iam v0.11.0/go.mod h1:9PiLDanza5D+oWFZiH1uG+RnRCfEGKoyl6yo4cgWZGY= -cloud.google.com/go/iam v0.12.0/go.mod h1:knyHGviacl11zrtZUoDuYpDgLjvr28sLQaG0YB2GYAY= -cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0= -cloud.google.com/go/iam v1.0.1/go.mod h1:yR3tmSL8BcZB4bxByRv2jkSIahVmCtfKZwLYGBalRE8= -cloud.google.com/go/iam v1.1.0/go.mod h1:nxdHjaKfCr7fNYx/HJMM8LgiMugmveWlkatear5gVyk= -cloud.google.com/go/iam v1.1.1/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= -cloud.google.com/go/iam v1.1.2/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= -cloud.google.com/go/iam v1.1.3/go.mod h1:3khUlaBXfPKKe7huYgEpDn6FtgRyMEqbkvBxrQyY5SE= -cloud.google.com/go/iam v1.1.4/go.mod h1:l/rg8l1AaA+VFMho/HYx2Vv6xinPSLMF8qfhRPIZ0L8= -cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= -cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= -cloud.google.com/go/iap v1.4.0/go.mod h1:RGFwRJdihTINIe4wZ2iCP0zF/qu18ZwyKxrhMhygBEc= -cloud.google.com/go/iap v1.5.0/go.mod h1:UH/CGgKd4KyohZL5Pt0jSKE4m3FR51qg6FKQ/z/Ix9A= -cloud.google.com/go/iap v1.6.0/go.mod h1:NSuvI9C/j7UdjGjIde7t7HBz+QTwBcapPE07+sSRcLk= -cloud.google.com/go/iap v1.7.0/go.mod h1:beqQx56T9O1G1yNPph+spKpNibDlYIiIixiqsQXxLIo= -cloud.google.com/go/iap v1.7.1/go.mod h1:WapEwPc7ZxGt2jFGB/C/bm+hP0Y6NXzOYGjpPnmMS74= -cloud.google.com/go/iap v1.8.1/go.mod h1:sJCbeqg3mvWLqjZNsI6dfAtbbV1DL2Rl7e1mTyXYREQ= -cloud.google.com/go/iap v1.9.0/go.mod h1:01OFxd1R+NFrg78S+hoPV5PxEzv22HXaNqUUlmNHFuY= -cloud.google.com/go/iap v1.9.1/go.mod h1:SIAkY7cGMLohLSdBR25BuIxO+I4fXJiL06IBL7cy/5Q= -cloud.google.com/go/iap v1.9.2/go.mod h1:GwDTOs047PPSnwRD0Us5FKf4WDRcVvHg1q9WVkKBhdI= -cloud.google.com/go/iap v1.9.3/go.mod h1:DTdutSZBqkkOm2HEOTBzhZxh2mwwxshfD/h3yofAiCw= -cloud.google.com/go/iap v1.9.4/go.mod h1:vO4mSq0xNf/Pu6E5paORLASBwEmphXEjgCFg7aeNu1w= -cloud.google.com/go/ids v1.1.0/go.mod h1:WIuwCaYVOzHIj2OhN9HAwvW+DBdmUAdcWlFxRl+KubM= -cloud.google.com/go/ids v1.2.0/go.mod h1:5WXvp4n25S0rA/mQWAg1YEEBBq6/s+7ml1RDCW1IrcY= -cloud.google.com/go/ids v1.3.0/go.mod h1:JBdTYwANikFKaDP6LtW5JAi4gubs57SVNQjemdt6xV4= -cloud.google.com/go/ids v1.4.1/go.mod h1:np41ed8YMU8zOgv53MMMoCntLTn2lF+SUzlM+O3u/jw= -cloud.google.com/go/ids v1.4.2/go.mod h1:3vw8DX6YddRu9BncxuzMyWn0g8+ooUjI2gslJ7FH3vk= -cloud.google.com/go/ids v1.4.3/go.mod h1:9CXPqI3GedjmkjbMWCUhMZ2P2N7TUMzAkVXYEH2orYU= -cloud.google.com/go/ids v1.4.4/go.mod h1:z+WUc2eEl6S/1aZWzwtVNWoSZslgzPxAboS0lZX0HjI= -cloud.google.com/go/ids v1.4.5/go.mod h1:p0ZnyzjMWxww6d2DvMGnFwCsSxDJM666Iir1bK1UuBo= -cloud.google.com/go/iot v1.3.0/go.mod h1:r7RGh2B61+B8oz0AGE+J72AhA0G7tdXItODWsaA2oLs= -cloud.google.com/go/iot v1.4.0/go.mod h1:dIDxPOn0UvNDUMD8Ger7FIaTuvMkj+aGk94RPP0iV+g= -cloud.google.com/go/iot v1.5.0/go.mod h1:mpz5259PDl3XJthEmh9+ap0affn/MqNSP4My77Qql9o= -cloud.google.com/go/iot v1.6.0/go.mod h1:IqdAsmE2cTYYNO1Fvjfzo9po179rAtJeVGUvkLN3rLE= -cloud.google.com/go/iot v1.7.1/go.mod h1:46Mgw7ev1k9KqK1ao0ayW9h0lI+3hxeanz+L1zmbbbk= -cloud.google.com/go/iot v1.7.2/go.mod h1:q+0P5zr1wRFpw7/MOgDXrG/HVA+l+cSwdObffkrpnSg= -cloud.google.com/go/iot v1.7.3/go.mod h1:t8itFchkol4VgNbHnIq9lXoOOtHNR3uAACQMYbN9N4I= -cloud.google.com/go/iot v1.7.4/go.mod h1:3TWqDVvsddYBG++nHSZmluoCAVGr1hAcabbWZNKEZLk= -cloud.google.com/go/iot v1.7.5/go.mod h1:nq3/sqTz3HGaWJi1xNiX7F41ThOzpud67vwk0YsSsqs= -cloud.google.com/go/kms v1.4.0/go.mod h1:fajBHndQ+6ubNw6Ss2sSd+SWvjL26RNo/dr7uxsnnOA= -cloud.google.com/go/kms v1.5.0/go.mod h1:QJS2YY0eJGBg3mnDfuaCyLauWwBJiHRboYxJ++1xJNg= -cloud.google.com/go/kms v1.6.0/go.mod h1:Jjy850yySiasBUDi6KFUwUv2n1+o7QZFyuUJg6OgjA0= -cloud.google.com/go/kms v1.8.0/go.mod h1:4xFEhYFqvW+4VMELtZyxomGSYtSQKzM178ylFW4jMAg= -cloud.google.com/go/kms v1.9.0/go.mod h1:qb1tPTgfF9RQP8e1wq4cLFErVuTJv7UsSC915J8dh3w= -cloud.google.com/go/kms v1.10.0/go.mod h1:ng3KTUtQQU9bPX3+QGLsflZIHlkbn8amFAMY63m8d24= -cloud.google.com/go/kms v1.10.1/go.mod h1:rIWk/TryCkR59GMC3YtHtXeLzd634lBbKenvyySAyYI= -cloud.google.com/go/kms v1.11.0/go.mod h1:hwdiYC0xjnWsKQQCQQmIQnS9asjYVSK6jtXm+zFqXLM= -cloud.google.com/go/kms v1.12.1/go.mod h1:c9J991h5DTl+kg7gi3MYomh12YEENGrf48ee/N/2CDM= -cloud.google.com/go/kms v1.15.0/go.mod h1:c9J991h5DTl+kg7gi3MYomh12YEENGrf48ee/N/2CDM= -cloud.google.com/go/kms v1.15.2/go.mod h1:3hopT4+7ooWRCjc2DxgnpESFxhIraaI2IpAVUEhbT/w= -cloud.google.com/go/kms v1.15.3/go.mod h1:AJdXqHxS2GlPyduM99s9iGqi2nwbviBbhV/hdmt4iOQ= -cloud.google.com/go/kms v1.15.4/go.mod h1:L3Sdj6QTHK8dfwK5D1JLsAyELsNMnd3tAIwGS4ltKpc= -cloud.google.com/go/kms v1.15.5/go.mod h1:cU2H5jnp6G2TDpUGZyqTCoy1n16fbubHZjmVXSMtwDI= -cloud.google.com/go/kms v1.15.6/go.mod h1:yF75jttnIdHfGBoE51AKsD/Yqf+/jICzB9v1s1acsms= -cloud.google.com/go/kms v1.15.7/go.mod h1:ub54lbsa6tDkUwnu4W7Yt1aAIFLnspgh0kPGToDukeI= -cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= -cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= -cloud.google.com/go/language v1.7.0/go.mod h1:DJ6dYN/W+SQOjF8e1hLQXMF21AkH2w9wiPzPCJa2MIE= -cloud.google.com/go/language v1.8.0/go.mod h1:qYPVHf7SPoNNiCL2Dr0FfEFNil1qi3pQEyygwpgVKB8= -cloud.google.com/go/language v1.9.0/go.mod h1:Ns15WooPM5Ad/5no/0n81yUetis74g3zrbeJBE+ptUY= -cloud.google.com/go/language v1.10.1/go.mod h1:CPp94nsdVNiQEt1CNjF5WkTcisLiHPyIbMhvR8H2AW0= -cloud.google.com/go/language v1.11.0/go.mod h1:uDx+pFDdAKTY8ehpWbiXyQdz8tDSYLJbQcXsCkjYyvQ= -cloud.google.com/go/language v1.11.1/go.mod h1:Xyid9MG9WOX3utvDbpX7j3tXDmmDooMyMDqgUVpH17U= -cloud.google.com/go/language v1.12.1/go.mod h1:zQhalE2QlQIxbKIZt54IASBzmZpN/aDASea5zl1l+J4= -cloud.google.com/go/language v1.12.2/go.mod h1:9idWapzr/JKXBBQ4lWqVX/hcadxB194ry20m/bTrhWc= -cloud.google.com/go/language v1.12.3/go.mod h1:evFX9wECX6mksEva8RbRnr/4wi/vKGYnAJrTRXU8+f8= -cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= -cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= -cloud.google.com/go/lifesciences v0.8.0/go.mod h1:lFxiEOMqII6XggGbOnKiyZ7IBwoIqA84ClvoezaA/bo= -cloud.google.com/go/lifesciences v0.9.1/go.mod h1:hACAOd1fFbCGLr/+weUKRAJas82Y4vrL3O5326N//Wc= -cloud.google.com/go/lifesciences v0.9.2/go.mod h1:QHEOO4tDzcSAzeJg7s2qwnLM2ji8IRpQl4p6m5Z9yTA= -cloud.google.com/go/lifesciences v0.9.3/go.mod h1:gNGBOJV80IWZdkd+xz4GQj4mbqaz737SCLHn2aRhQKM= -cloud.google.com/go/lifesciences v0.9.4/go.mod h1:bhm64duKhMi7s9jR9WYJYvjAFJwRqNj+Nia7hF0Z7JA= -cloud.google.com/go/lifesciences v0.9.5/go.mod h1:OdBm0n7C0Osh5yZB7j9BXyrMnTRGBJIZonUMxo5CzPw= -cloud.google.com/go/logging v1.6.1/go.mod h1:5ZO0mHHbvm8gEmeEUHrmDlTDSu5imF6MUP9OfilNXBw= -cloud.google.com/go/logging v1.7.0/go.mod h1:3xjP2CjkM3ZkO73aj4ASA5wRPGGCRrPIAeNqVNkzY8M= -cloud.google.com/go/logging v1.8.1/go.mod h1:TJjR+SimHwuC8MZ9cjByQulAMgni+RkXeI3wwctHJEI= -cloud.google.com/go/logging v1.9.0/go.mod h1:1Io0vnZv4onoUnsVUQY3HZ3Igb1nBchky0A0y7BBBhE= -cloud.google.com/go/longrunning v0.1.1/go.mod h1:UUFxuDWkv22EuY93jjmDMFT5GPQKeFVJBIF6QlTqdsE= -cloud.google.com/go/longrunning v0.3.0/go.mod h1:qth9Y41RRSUE69rDcOn6DdK3HfQfsUI0YSmW3iIlLJc= -cloud.google.com/go/longrunning v0.4.1/go.mod h1:4iWDqhBZ70CvZ6BfETbvam3T8FMvLK+eFj0E6AaRQTo= -cloud.google.com/go/longrunning v0.4.2/go.mod h1:OHrnaYyLUV6oqwh0xiS7e5sLQhP1m0QU9R+WhGDMgIQ= -cloud.google.com/go/longrunning v0.5.0/go.mod h1:0JNuqRShmscVAhIACGtskSAWtqtOoPkwP0YF1oVEchc= -cloud.google.com/go/longrunning v0.5.1/go.mod h1:spvimkwdz6SPWKEt/XBij79E9fiTkHSQl/fRUUQJYJc= -cloud.google.com/go/longrunning v0.5.2/go.mod h1:nqo6DQbNV2pXhGDbDMoN2bWz68MjZUzqv2YttZiveCs= -cloud.google.com/go/longrunning v0.5.3/go.mod h1:y/0ga59EYu58J6SHmmQOvekvND2qODbu8ywBBW7EK7Y= -cloud.google.com/go/longrunning v0.5.4/go.mod h1:zqNVncI0BOP8ST6XQD1+VcvuShMmq7+xFSzOL++V0dI= -cloud.google.com/go/longrunning v0.5.5/go.mod h1:WV2LAxD8/rg5Z1cNW6FJ/ZpX4E4VnDnoTk0yawPBB7s= -cloud.google.com/go/managedidentities v1.3.0/go.mod h1:UzlW3cBOiPrzucO5qWkNkh0w33KFtBJU281hacNvsdE= -cloud.google.com/go/managedidentities v1.4.0/go.mod h1:NWSBYbEMgqmbZsLIyKvxrYbtqOsxY1ZrGM+9RgDqInM= -cloud.google.com/go/managedidentities v1.5.0/go.mod h1:+dWcZ0JlUmpuxpIDfyP5pP5y0bLdRwOS4Lp7gMni/LA= -cloud.google.com/go/managedidentities v1.6.1/go.mod h1:h/irGhTN2SkZ64F43tfGPMbHnypMbu4RB3yl8YcuEak= -cloud.google.com/go/managedidentities v1.6.2/go.mod h1:5c2VG66eCa0WIq6IylRk3TBW83l161zkFvCj28X7jn8= -cloud.google.com/go/managedidentities v1.6.3/go.mod h1:tewiat9WLyFN0Fi7q1fDD5+0N4VUoL0SCX0OTCthZq4= -cloud.google.com/go/managedidentities v1.6.4/go.mod h1:WgyaECfHmF00t/1Uk8Oun3CQ2PGUtjc3e9Alh79wyiM= -cloud.google.com/go/managedidentities v1.6.5/go.mod h1:fkFI2PwwyRQbjLxlm5bQ8SjtObFMW3ChBGNqaMcgZjI= -cloud.google.com/go/maps v0.1.0/go.mod h1:BQM97WGyfw9FWEmQMpZ5T6cpovXXSd1cGmFma94eubI= -cloud.google.com/go/maps v0.6.0/go.mod h1:o6DAMMfb+aINHz/p/jbcY+mYeXBoZoxTfdSQ8VAJaCw= -cloud.google.com/go/maps v0.7.0/go.mod h1:3GnvVl3cqeSvgMcpRlQidXsPYuDGQ8naBis7MVzpXsY= -cloud.google.com/go/maps v1.3.0/go.mod h1:6mWTUv+WhnOwAgjVsSW2QPPECmW+s3PcRyOa9vgG/5s= -cloud.google.com/go/maps v1.4.0/go.mod h1:6mWTUv+WhnOwAgjVsSW2QPPECmW+s3PcRyOa9vgG/5s= -cloud.google.com/go/maps v1.4.1/go.mod h1:BxSa0BnW1g2U2gNdbq5zikLlHUuHW0GFWh7sgML2kIY= -cloud.google.com/go/maps v1.5.1/go.mod h1:NPMZw1LJwQZYCfz4y+EIw+SI+24A4bpdFJqdKVr0lt4= -cloud.google.com/go/maps v1.6.1/go.mod h1:4+buOHhYXFBp58Zj/K+Lc1rCmJssxxF4pJ5CJnhdz18= -cloud.google.com/go/maps v1.6.2/go.mod h1:4+buOHhYXFBp58Zj/K+Lc1rCmJssxxF4pJ5CJnhdz18= -cloud.google.com/go/maps v1.6.3/go.mod h1:VGAn809ADswi1ASofL5lveOHPnE6Rk/SFTTBx1yuOLw= -cloud.google.com/go/maps v1.6.4/go.mod h1:rhjqRy8NWmDJ53saCfsXQ0LKwBHfi6OSh5wkq6BaMhI= -cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= -cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= -cloud.google.com/go/mediatranslation v0.7.0/go.mod h1:LCnB/gZr90ONOIQLgSXagp8XUW1ODs2UmUMvcgMfI2I= -cloud.google.com/go/mediatranslation v0.8.1/go.mod h1:L/7hBdEYbYHQJhX2sldtTO5SZZ1C1vkapubj0T2aGig= -cloud.google.com/go/mediatranslation v0.8.2/go.mod h1:c9pUaDRLkgHRx3irYE5ZC8tfXGrMYwNZdmDqKMSfFp8= -cloud.google.com/go/mediatranslation v0.8.3/go.mod h1:F9OnXTy336rteOEywtY7FOqCk+J43o2RF638hkOQl4Y= -cloud.google.com/go/mediatranslation v0.8.4/go.mod h1:9WstgtNVAdN53m6TQa5GjIjLqKQPXe74hwSCxUP6nj4= -cloud.google.com/go/mediatranslation v0.8.5/go.mod h1:y7kTHYIPCIfgyLbKncgqouXJtLsU+26hZhHEEy80fSs= -cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= -cloud.google.com/go/memcache v1.5.0/go.mod h1:dk3fCK7dVo0cUU2c36jKb4VqKPS22BTkf81Xq617aWM= -cloud.google.com/go/memcache v1.6.0/go.mod h1:XS5xB0eQZdHtTuTF9Hf8eJkKtR3pVRCcvJwtm68T3rA= -cloud.google.com/go/memcache v1.7.0/go.mod h1:ywMKfjWhNtkQTxrWxCkCFkoPjLHPW6A7WOTVI8xy3LY= -cloud.google.com/go/memcache v1.9.0/go.mod h1:8oEyzXCu+zo9RzlEaEjHl4KkgjlNDaXbCQeQWlzNFJM= -cloud.google.com/go/memcache v1.10.1/go.mod h1:47YRQIarv4I3QS5+hoETgKO40InqzLP6kpNLvyXuyaA= -cloud.google.com/go/memcache v1.10.2/go.mod h1:f9ZzJHLBrmd4BkguIAa/l/Vle6uTHzHokdnzSWOdQ6A= -cloud.google.com/go/memcache v1.10.3/go.mod h1:6z89A41MT2DVAW0P4iIRdu5cmRTsbsFn4cyiIx8gbwo= -cloud.google.com/go/memcache v1.10.4/go.mod h1:v/d8PuC8d1gD6Yn5+I3INzLR01IDn0N4Ym56RgikSI0= -cloud.google.com/go/memcache v1.10.5/go.mod h1:/FcblbNd0FdMsx4natdj+2GWzTq+cjZvMa1I+9QsuMA= -cloud.google.com/go/metastore v1.5.0/go.mod h1:2ZNrDcQwghfdtCwJ33nM0+GrBGlVuh8rakL3vdPY3XY= -cloud.google.com/go/metastore v1.6.0/go.mod h1:6cyQTls8CWXzk45G55x57DVQ9gWg7RiH65+YgPsNh9s= -cloud.google.com/go/metastore v1.7.0/go.mod h1:s45D0B4IlsINu87/AsWiEVYbLaIMeUSoxlKKDqBGFS8= -cloud.google.com/go/metastore v1.8.0/go.mod h1:zHiMc4ZUpBiM7twCIFQmJ9JMEkDSyZS9U12uf7wHqSI= -cloud.google.com/go/metastore v1.10.0/go.mod h1:fPEnH3g4JJAk+gMRnrAnoqyv2lpUCqJPWOodSaf45Eo= -cloud.google.com/go/metastore v1.11.1/go.mod h1:uZuSo80U3Wd4zi6C22ZZliOUJ3XeM/MlYi/z5OAOWRA= -cloud.google.com/go/metastore v1.12.0/go.mod h1:uZuSo80U3Wd4zi6C22ZZliOUJ3XeM/MlYi/z5OAOWRA= -cloud.google.com/go/metastore v1.13.0/go.mod h1:URDhpG6XLeh5K+Glq0NOt74OfrPKTwS62gEPZzb5SOk= -cloud.google.com/go/metastore v1.13.1/go.mod h1:IbF62JLxuZmhItCppcIfzBBfUFq0DIB9HPDoLgWrVOU= -cloud.google.com/go/metastore v1.13.2/go.mod h1:KS59dD+unBji/kFebVp8XU/quNSyo8b6N6tPGspKszA= -cloud.google.com/go/metastore v1.13.3/go.mod h1:K+wdjXdtkdk7AQg4+sXS8bRrQa9gcOr+foOMF2tqINE= -cloud.google.com/go/metastore v1.13.4/go.mod h1:FMv9bvPInEfX9Ac1cVcRXp8EBBQnBcqH6gz3KvJ9BAE= -cloud.google.com/go/monitoring v1.7.0/go.mod h1:HpYse6kkGo//7p6sT0wsIC6IBDET0RhIsnmlA53dvEk= -cloud.google.com/go/monitoring v1.8.0/go.mod h1:E7PtoMJ1kQXWxPjB6mv2fhC5/15jInuulFdYYtlcvT4= -cloud.google.com/go/monitoring v1.12.0/go.mod h1:yx8Jj2fZNEkL/GYZyTLS4ZtZEZN8WtDEiEqG4kLK50w= -cloud.google.com/go/monitoring v1.13.0/go.mod h1:k2yMBAB1H9JT/QETjNkgdCGD9bPF712XiLTVr+cBrpw= -cloud.google.com/go/monitoring v1.15.1/go.mod h1:lADlSAlFdbqQuwwpaImhsJXu1QSdd3ojypXrFSMr2rM= -cloud.google.com/go/monitoring v1.16.0/go.mod h1:Ptp15HgAyM1fNICAojDMoNc/wUmn67mLHQfyqbw+poY= -cloud.google.com/go/monitoring v1.16.1/go.mod h1:6HsxddR+3y9j+o/cMJH6q/KJ/CBTvM/38L/1m7bTRJ4= -cloud.google.com/go/monitoring v1.16.2/go.mod h1:B44KGwi4ZCF8Rk/5n+FWeispDXoKSk9oss2QNlXJBgc= -cloud.google.com/go/monitoring v1.16.3/go.mod h1:KwSsX5+8PnXv5NJnICZzW2R8pWTis8ypC4zmdRD63Tw= -cloud.google.com/go/monitoring v1.17.0/go.mod h1:KwSsX5+8PnXv5NJnICZzW2R8pWTis8ypC4zmdRD63Tw= -cloud.google.com/go/monitoring v1.17.1/go.mod h1:SJzPMakCF0GHOuKEH/r4hxVKF04zl+cRPQyc3d/fqII= -cloud.google.com/go/monitoring v1.18.0/go.mod h1:c92vVBCeq/OB4Ioyo+NbN2U7tlg5ZH41PZcdvfc+Lcg= -cloud.google.com/go/networkconnectivity v1.4.0/go.mod h1:nOl7YL8odKyAOtzNX73/M5/mGZgqqMeryi6UPZTk/rA= -cloud.google.com/go/networkconnectivity v1.5.0/go.mod h1:3GzqJx7uhtlM3kln0+x5wyFvuVH1pIBJjhCpjzSt75o= -cloud.google.com/go/networkconnectivity v1.6.0/go.mod h1:OJOoEXW+0LAxHh89nXd64uGG+FbQoeH8DtxCHVOMlaM= -cloud.google.com/go/networkconnectivity v1.7.0/go.mod h1:RMuSbkdbPwNMQjB5HBWD5MpTBnNm39iAVpC3TmsExt8= -cloud.google.com/go/networkconnectivity v1.10.0/go.mod h1:UP4O4sWXJG13AqrTdQCD9TnLGEbtNRqjuaaA7bNjF5E= -cloud.google.com/go/networkconnectivity v1.11.0/go.mod h1:iWmDD4QF16VCDLXUqvyspJjIEtBR/4zq5hwnY2X3scM= -cloud.google.com/go/networkconnectivity v1.12.1/go.mod h1:PelxSWYM7Sh9/guf8CFhi6vIqf19Ir/sbfZRUwXh92E= -cloud.google.com/go/networkconnectivity v1.13.0/go.mod h1:SAnGPes88pl7QRLUen2HmcBSE9AowVAcdug8c0RSBFk= -cloud.google.com/go/networkconnectivity v1.14.0/go.mod h1:SAnGPes88pl7QRLUen2HmcBSE9AowVAcdug8c0RSBFk= -cloud.google.com/go/networkconnectivity v1.14.1/go.mod h1:LyGPXR742uQcDxZ/wv4EI0Vu5N6NKJ77ZYVnDe69Zug= -cloud.google.com/go/networkconnectivity v1.14.2/go.mod h1:5UFlwIisZylSkGG1AdwK/WZUaoz12PKu6wODwIbFzJo= -cloud.google.com/go/networkconnectivity v1.14.3/go.mod h1:4aoeFdrJpYEXNvrnfyD5kIzs8YtHg945Og4koAjHQek= -cloud.google.com/go/networkconnectivity v1.14.4/go.mod h1:PU12q++/IMnDJAB+3r+tJtuCXCfwfN+C6Niyj6ji1Po= -cloud.google.com/go/networkmanagement v1.4.0/go.mod h1:Q9mdLLRn60AsOrPc8rs8iNV6OHXaGcDdsIQe1ohekq8= -cloud.google.com/go/networkmanagement v1.5.0/go.mod h1:ZnOeZ/evzUdUsnvRt792H0uYEnHQEMaz+REhhzJRcf4= -cloud.google.com/go/networkmanagement v1.6.0/go.mod h1:5pKPqyXjB/sgtvB5xqOemumoQNB7y95Q7S+4rjSOPYY= -cloud.google.com/go/networkmanagement v1.8.0/go.mod h1:Ho/BUGmtyEqrttTgWEe7m+8vDdK74ibQc+Be0q7Fof0= -cloud.google.com/go/networkmanagement v1.9.0/go.mod h1:UTUaEU9YwbCAhhz3jEOHr+2/K/MrBk2XxOLS89LQzFw= -cloud.google.com/go/networkmanagement v1.9.1/go.mod h1:CCSYgrQQvW73EJawO2QamemYcOb57LvrDdDU51F0mcI= -cloud.google.com/go/networkmanagement v1.9.2/go.mod h1:iDGvGzAoYRghhp4j2Cji7sF899GnfGQcQRQwgVOWnDw= -cloud.google.com/go/networkmanagement v1.9.3/go.mod h1:y7WMO1bRLaP5h3Obm4tey+NquUvB93Co1oh4wpL+XcU= -cloud.google.com/go/networkmanagement v1.9.4/go.mod h1:daWJAl0KTFytFL7ar33I6R/oNBH8eEOX/rBNHrC/8TA= -cloud.google.com/go/networksecurity v0.5.0/go.mod h1:xS6fOCoqpVC5zx15Z/MqkfDwH4+m/61A3ODiDV1xmiQ= -cloud.google.com/go/networksecurity v0.6.0/go.mod h1:Q5fjhTr9WMI5mbpRYEbiexTzROf7ZbDzvzCrNl14nyU= -cloud.google.com/go/networksecurity v0.7.0/go.mod h1:mAnzoxx/8TBSyXEeESMy9OOYwo1v+gZ5eMRnsT5bC8k= -cloud.google.com/go/networksecurity v0.8.0/go.mod h1:B78DkqsxFG5zRSVuwYFRZ9Xz8IcQ5iECsNrPn74hKHU= -cloud.google.com/go/networksecurity v0.9.1/go.mod h1:MCMdxOKQ30wsBI1eI659f9kEp4wuuAueoC9AJKSPWZQ= -cloud.google.com/go/networksecurity v0.9.2/go.mod h1:jG0SeAttWzPMUILEHDUvFYdQTl8L/E/KC8iZDj85lEI= -cloud.google.com/go/networksecurity v0.9.3/go.mod h1:l+C0ynM6P+KV9YjOnx+kk5IZqMSLccdBqW6GUoF4p/0= -cloud.google.com/go/networksecurity v0.9.4/go.mod h1:E9CeMZ2zDsNBkr8axKSYm8XyTqNhiCHf1JO/Vb8mD1w= -cloud.google.com/go/networksecurity v0.9.5/go.mod h1:KNkjH/RsylSGyyZ8wXpue8xpCEK+bTtvof8SBfIhMG8= -cloud.google.com/go/notebooks v1.2.0/go.mod h1:9+wtppMfVPUeJ8fIWPOq1UnATHISkGXGqTkxeieQ6UY= -cloud.google.com/go/notebooks v1.3.0/go.mod h1:bFR5lj07DtCPC7YAAJ//vHskFBxA5JzYlH68kXVdk34= -cloud.google.com/go/notebooks v1.4.0/go.mod h1:4QPMngcwmgb6uw7Po99B2xv5ufVoIQ7nOGDyL4P8AgA= -cloud.google.com/go/notebooks v1.5.0/go.mod h1:q8mwhnP9aR8Hpfnrc5iN5IBhrXUy8S2vuYs+kBJ/gu0= -cloud.google.com/go/notebooks v1.7.0/go.mod h1:PVlaDGfJgj1fl1S3dUwhFMXFgfYGhYQt2164xOMONmE= -cloud.google.com/go/notebooks v1.8.0/go.mod h1:Lq6dYKOYOWUCTvw5t2q1gp1lAp0zxAxRycayS0iJcqQ= -cloud.google.com/go/notebooks v1.9.1/go.mod h1:zqG9/gk05JrzgBt4ghLzEepPHNwE5jgPcHZRKhlC1A8= -cloud.google.com/go/notebooks v1.10.0/go.mod h1:SOPYMZnttHxqot0SGSFSkRrwE29eqnKPBJFqgWmiK2k= -cloud.google.com/go/notebooks v1.10.1/go.mod h1:5PdJc2SgAybE76kFQCWrTfJolCOUQXF97e+gteUUA6A= -cloud.google.com/go/notebooks v1.11.1/go.mod h1:V2Zkv8wX9kDCGRJqYoI+bQAaoVeE5kSiz4yYHd2yJwQ= -cloud.google.com/go/notebooks v1.11.2/go.mod h1:z0tlHI/lREXC8BS2mIsUeR3agM1AkgLiS+Isov3SS70= -cloud.google.com/go/notebooks v1.11.3/go.mod h1:0wQyI2dQC3AZyQqWnRsp+yA+kY4gC7ZIVP4Qg3AQcgo= -cloud.google.com/go/optimization v1.1.0/go.mod h1:5po+wfvX5AQlPznyVEZjGJTMr4+CAkJf2XSTQOOl9l4= -cloud.google.com/go/optimization v1.2.0/go.mod h1:Lr7SOHdRDENsh+WXVmQhQTrzdu9ybg0NecjHidBq6xs= -cloud.google.com/go/optimization v1.3.1/go.mod h1:IvUSefKiwd1a5p0RgHDbWCIbDFgKuEdB+fPPuP0IDLI= -cloud.google.com/go/optimization v1.4.1/go.mod h1:j64vZQP7h9bO49m2rVaTVoNM0vEBEN5eKPUPbZyXOrk= -cloud.google.com/go/optimization v1.5.0/go.mod h1:evo1OvTxeBRBu6ydPlrIRizKY/LJKo/drDMMRKqGEUU= -cloud.google.com/go/optimization v1.5.1/go.mod h1:NC0gnUD5MWVAF7XLdoYVPmYYVth93Q6BUzqAq3ZwtV8= -cloud.google.com/go/optimization v1.6.1/go.mod h1:hH2RYPTTM9e9zOiTaYPTiGPcGdNZVnBSBxjIAJzUkqo= -cloud.google.com/go/optimization v1.6.2/go.mod h1:mWNZ7B9/EyMCcwNl1frUGEuY6CPijSkz88Fz2vwKPOY= -cloud.google.com/go/optimization v1.6.3/go.mod h1:8ve3svp3W6NFcAEFr4SfJxrldzhUl4VMUJmhrqVKtYA= -cloud.google.com/go/orchestration v1.3.0/go.mod h1:Sj5tq/JpWiB//X/q3Ngwdl5K7B7Y0KZ7bfv0wL6fqVA= -cloud.google.com/go/orchestration v1.4.0/go.mod h1:6W5NLFWs2TlniBphAViZEVhrXRSMgUGDfW7vrWKvsBk= -cloud.google.com/go/orchestration v1.6.0/go.mod h1:M62Bevp7pkxStDfFfTuCOaXgaaqRAga1yKyoMtEoWPQ= -cloud.google.com/go/orchestration v1.8.1/go.mod h1:4sluRF3wgbYVRqz7zJ1/EUNc90TTprliq9477fGobD8= -cloud.google.com/go/orchestration v1.8.2/go.mod h1:T1cP+6WyTmh6LSZzeUhvGf0uZVmJyTx7t8z7Vg87+A0= -cloud.google.com/go/orchestration v1.8.3/go.mod h1:xhgWAYqlbYjlz2ftbFghdyqENYW+JXuhBx9KsjMoGHs= -cloud.google.com/go/orchestration v1.8.4/go.mod h1:d0lywZSVYtIoSZXb0iFjv9SaL13PGyVOKDxqGxEf/qI= -cloud.google.com/go/orchestration v1.8.5/go.mod h1:C1J7HesE96Ba8/hZ71ISTV2UAat0bwN+pi85ky38Yq8= -cloud.google.com/go/orgpolicy v1.4.0/go.mod h1:xrSLIV4RePWmP9P3tBl8S93lTmlAxjm06NSm2UTmKvE= -cloud.google.com/go/orgpolicy v1.5.0/go.mod h1:hZEc5q3wzwXJaKrsx5+Ewg0u1LxJ51nNFlext7Tanwc= -cloud.google.com/go/orgpolicy v1.10.0/go.mod h1:w1fo8b7rRqlXlIJbVhOMPrwVljyuW5mqssvBtU18ONc= -cloud.google.com/go/orgpolicy v1.11.0/go.mod h1:2RK748+FtVvnfuynxBzdnyu7sygtoZa1za/0ZfpOs1M= -cloud.google.com/go/orgpolicy v1.11.1/go.mod h1:8+E3jQcpZJQliP+zaFfayC2Pg5bmhuLK755wKhIIUCE= -cloud.google.com/go/orgpolicy v1.11.2/go.mod h1:biRDpNwfyytYnmCRWZWxrKF22Nkz9eNVj9zyaBdpm1o= -cloud.google.com/go/orgpolicy v1.11.3/go.mod h1:oKAtJ/gkMjum5icv2aujkP4CxROxPXsBbYGCDbPO8MM= -cloud.google.com/go/orgpolicy v1.11.4/go.mod h1:0+aNV/nrfoTQ4Mytv+Aw+stBDBjNf4d8fYRA9herfJI= -cloud.google.com/go/orgpolicy v1.12.0/go.mod h1:0+aNV/nrfoTQ4Mytv+Aw+stBDBjNf4d8fYRA9herfJI= -cloud.google.com/go/orgpolicy v1.12.1/go.mod h1:aibX78RDl5pcK3jA8ysDQCFkVxLj3aOQqrbBaUL2V5I= -cloud.google.com/go/osconfig v1.7.0/go.mod h1:oVHeCeZELfJP7XLxcBGTMBvRO+1nQ5tFG9VQTmYS2Fs= -cloud.google.com/go/osconfig v1.8.0/go.mod h1:EQqZLu5w5XA7eKizepumcvWx+m8mJUhEwiPqWiZeEdg= -cloud.google.com/go/osconfig v1.9.0/go.mod h1:Yx+IeIZJ3bdWmzbQU4fxNl8xsZ4amB+dygAwFPlvnNo= -cloud.google.com/go/osconfig v1.10.0/go.mod h1:uMhCzqC5I8zfD9zDEAfvgVhDS8oIjySWh+l4WK6GnWw= -cloud.google.com/go/osconfig v1.11.0/go.mod h1:aDICxrur2ogRd9zY5ytBLV89KEgT2MKB2L/n6x1ooPw= -cloud.google.com/go/osconfig v1.12.0/go.mod h1:8f/PaYzoS3JMVfdfTubkowZYGmAhUCjjwnjqWI7NVBc= -cloud.google.com/go/osconfig v1.12.1/go.mod h1:4CjBxND0gswz2gfYRCUoUzCm9zCABp91EeTtWXyz0tE= -cloud.google.com/go/osconfig v1.12.2/go.mod h1:eh9GPaMZpI6mEJEuhEjUJmaxvQ3gav+fFEJon1Y8Iw0= -cloud.google.com/go/osconfig v1.12.3/go.mod h1:L/fPS8LL6bEYUi1au832WtMnPeQNT94Zo3FwwV1/xGM= -cloud.google.com/go/osconfig v1.12.4/go.mod h1:B1qEwJ/jzqSRslvdOCI8Kdnp0gSng0xW4LOnIebQomA= -cloud.google.com/go/osconfig v1.12.5/go.mod h1:D9QFdxzfjgw3h/+ZaAb5NypM8bhOMqBzgmbhzWViiW8= -cloud.google.com/go/oslogin v1.4.0/go.mod h1:YdgMXWRaElXz/lDk1Na6Fh5orF7gvmJ0FGLIs9LId4E= -cloud.google.com/go/oslogin v1.5.0/go.mod h1:D260Qj11W2qx/HVF29zBg+0fd6YCSjSqLUkY/qEenQU= -cloud.google.com/go/oslogin v1.6.0/go.mod h1:zOJ1O3+dTU8WPlGEkFSh7qeHPPSoxrcMbbK1Nm2iX70= -cloud.google.com/go/oslogin v1.7.0/go.mod h1:e04SN0xO1UNJ1M5GP0vzVBFicIe4O53FOfcixIqTyXo= -cloud.google.com/go/oslogin v1.9.0/go.mod h1:HNavntnH8nzrn8JCTT5fj18FuJLFJc4NaZJtBnQtKFs= -cloud.google.com/go/oslogin v1.10.1/go.mod h1:x692z7yAue5nE7CsSnoG0aaMbNoRJRXO4sn73R+ZqAs= -cloud.google.com/go/oslogin v1.11.0/go.mod h1:8GMTJs4X2nOAUVJiPGqIWVcDaF0eniEto3xlOxaboXE= -cloud.google.com/go/oslogin v1.11.1/go.mod h1:OhD2icArCVNUxKqtK0mcSmKL7lgr0LVlQz+v9s1ujTg= -cloud.google.com/go/oslogin v1.12.1/go.mod h1:VfwTeFJGbnakxAY236eN8fsnglLiVXndlbcNomY4iZU= -cloud.google.com/go/oslogin v1.12.2/go.mod h1:CQ3V8Jvw4Qo4WRhNPF0o+HAM4DiLuE27Ul9CX9g2QdY= -cloud.google.com/go/oslogin v1.13.0/go.mod h1:xPJqLwpTZ90LSE5IL1/svko+6c5avZLluiyylMb/sRA= -cloud.google.com/go/oslogin v1.13.1/go.mod h1:vS8Sr/jR7QvPWpCjNqy6LYZr5Zs1e8ZGW/KPn9gmhws= -cloud.google.com/go/phishingprotection v0.5.0/go.mod h1:Y3HZknsK9bc9dMi+oE8Bim0lczMU6hrX0UpADuMefr0= -cloud.google.com/go/phishingprotection v0.6.0/go.mod h1:9Y3LBLgy0kDTcYET8ZH3bq/7qni15yVUoAxiFxnlSUA= -cloud.google.com/go/phishingprotection v0.7.0/go.mod h1:8qJI4QKHoda/sb/7/YmMQ2omRLSLYSu9bU0EKCNI+Lk= -cloud.google.com/go/phishingprotection v0.8.1/go.mod h1:AxonW7GovcA8qdEk13NfHq9hNx5KPtfxXNeUxTDxB6I= -cloud.google.com/go/phishingprotection v0.8.2/go.mod h1:LhJ91uyVHEYKSKcMGhOa14zMMWfbEdxG032oT6ECbC8= -cloud.google.com/go/phishingprotection v0.8.3/go.mod h1:3B01yO7T2Ra/TMojifn8EoGd4G9jts/6cIO0DgDY9J8= -cloud.google.com/go/phishingprotection v0.8.4/go.mod h1:6b3kNPAc2AQ6jZfFHioZKg9MQNybDg4ixFd4RPZZ2nE= -cloud.google.com/go/phishingprotection v0.8.5/go.mod h1:g1smd68F7mF1hgQPuYn3z8HDbNre8L6Z0b7XMYFmX7I= -cloud.google.com/go/policytroubleshooter v1.3.0/go.mod h1:qy0+VwANja+kKrjlQuOzmlvscn4RNsAc0e15GGqfMxg= -cloud.google.com/go/policytroubleshooter v1.4.0/go.mod h1:DZT4BcRw3QoO8ota9xw/LKtPa8lKeCByYeKTIf/vxdE= -cloud.google.com/go/policytroubleshooter v1.5.0/go.mod h1:Rz1WfV+1oIpPdN2VvvuboLVRsB1Hclg3CKQ53j9l8vw= -cloud.google.com/go/policytroubleshooter v1.6.0/go.mod h1:zYqaPTsmfvpjm5ULxAyD/lINQxJ0DDsnWOP/GZ7xzBc= -cloud.google.com/go/policytroubleshooter v1.7.1/go.mod h1:0NaT5v3Ag1M7U5r0GfDCpUFkWd9YqpubBWsQlhanRv0= -cloud.google.com/go/policytroubleshooter v1.8.0/go.mod h1:tmn5Ir5EToWe384EuboTcVQT7nTag2+DuH3uHmKd1HU= -cloud.google.com/go/policytroubleshooter v1.9.0/go.mod h1:+E2Lga7TycpeSTj2FsH4oXxTnrbHJGRlKhVZBLGgU64= -cloud.google.com/go/policytroubleshooter v1.9.1/go.mod h1:MYI8i0bCrL8cW+VHN1PoiBTyNZTstCg2WUw2eVC4c4U= -cloud.google.com/go/policytroubleshooter v1.10.1/go.mod h1:5C0rhT3TDZVxAu8813bwmTvd57Phbl8mr9F4ipOsxEs= -cloud.google.com/go/policytroubleshooter v1.10.2/go.mod h1:m4uF3f6LseVEnMV6nknlN2vYGRb+75ylQwJdnOXfnv0= -cloud.google.com/go/policytroubleshooter v1.10.3/go.mod h1:+ZqG3agHT7WPb4EBIRqUv4OyIwRTZvsVDHZ8GlZaoxk= -cloud.google.com/go/privatecatalog v0.5.0/go.mod h1:XgosMUvvPyxDjAVNDYxJ7wBW8//hLDDYmnsNcMGq1K0= -cloud.google.com/go/privatecatalog v0.6.0/go.mod h1:i/fbkZR0hLN29eEWiiwue8Pb+GforiEIBnV9yrRUOKI= -cloud.google.com/go/privatecatalog v0.7.0/go.mod h1:2s5ssIFO69F5csTXcwBP7NPFTZvps26xGzvQ2PQaBYg= -cloud.google.com/go/privatecatalog v0.8.0/go.mod h1:nQ6pfaegeDAq/Q5lrfCQzQLhubPiZhSaNhIgfJlnIXs= -cloud.google.com/go/privatecatalog v0.9.1/go.mod h1:0XlDXW2unJXdf9zFz968Hp35gl/bhF4twwpXZAW50JA= -cloud.google.com/go/privatecatalog v0.9.2/go.mod h1:RMA4ATa8IXfzvjrhhK8J6H4wwcztab+oZph3c6WmtFc= -cloud.google.com/go/privatecatalog v0.9.3/go.mod h1:K5pn2GrVmOPjXz3T26mzwXLcKivfIJ9R5N79AFCF9UE= -cloud.google.com/go/privatecatalog v0.9.4/go.mod h1:SOjm93f+5hp/U3PqMZAHTtBtluqLygrDrVO8X8tYtG0= -cloud.google.com/go/privatecatalog v0.9.5/go.mod h1:fVWeBOVe7uj2n3kWRGlUQqR/pOd450J9yZoOECcQqJk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/pubsub v1.26.0/go.mod h1:QgBH3U/jdJy/ftjPhTkyXNj543Tin1pRYcdcPRnFIRI= -cloud.google.com/go/pubsub v1.27.1/go.mod h1:hQN39ymbV9geqBnfQq6Xf63yNhUAhv9CZhzp5O6qsW0= -cloud.google.com/go/pubsub v1.28.0/go.mod h1:vuXFpwaVoIPQMGXqRyUQigu/AX1S3IWugR9xznmcXX8= -cloud.google.com/go/pubsub v1.30.0/go.mod h1:qWi1OPS0B+b5L+Sg6Gmc9zD1Y+HaM0MdUr7LsupY1P4= -cloud.google.com/go/pubsub v1.32.0/go.mod h1:f+w71I33OMyxf9VpMVcZbnG5KSUkCOUHYpFd5U1GdRc= -cloud.google.com/go/pubsub v1.33.0/go.mod h1:f+w71I33OMyxf9VpMVcZbnG5KSUkCOUHYpFd5U1GdRc= -cloud.google.com/go/pubsub v1.34.0/go.mod h1:alj4l4rBg+N3YTFDDC+/YyFTs6JAjam2QfYsddcAW4c= -cloud.google.com/go/pubsub v1.36.1/go.mod h1:iYjCa9EzWOoBiTdd4ps7QoMtMln5NwaZQpK1hbRfBDE= -cloud.google.com/go/pubsublite v1.5.0/go.mod h1:xapqNQ1CuLfGi23Yda/9l4bBCKz/wC3KIJ5gKcxveZg= -cloud.google.com/go/pubsublite v1.6.0/go.mod h1:1eFCS0U11xlOuMFV/0iBqw3zP12kddMeCbj/F3FSj9k= -cloud.google.com/go/pubsublite v1.7.0/go.mod h1:8hVMwRXfDfvGm3fahVbtDbiLePT3gpoiJYJY+vxWxVM= -cloud.google.com/go/pubsublite v1.8.1/go.mod h1:fOLdU4f5xldK4RGJrBMm+J7zMWNj/k4PxwEZXy39QS0= -cloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4= -cloud.google.com/go/recaptchaenterprise/v2 v2.1.0/go.mod h1:w9yVqajwroDNTfGuhmOjPDN//rZGySaf6PtFVcSCa7o= -cloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk= -cloud.google.com/go/recaptchaenterprise/v2 v2.3.0/go.mod h1:O9LwGCjrhGHBQET5CA7dd5NwwNQUErSgEDit1DLNTdo= -cloud.google.com/go/recaptchaenterprise/v2 v2.4.0/go.mod h1:Am3LHfOuBstrLrNCBrlI5sbwx9LBg3te2N6hGvHn2mE= -cloud.google.com/go/recaptchaenterprise/v2 v2.5.0/go.mod h1:O8LzcHXN3rz0j+LBC91jrwI3R+1ZSZEWrfL7XHgNo9U= -cloud.google.com/go/recaptchaenterprise/v2 v2.6.0/go.mod h1:RPauz9jeLtB3JVzg6nCbe12qNoaa8pXc4d/YukAmcnA= -cloud.google.com/go/recaptchaenterprise/v2 v2.7.0/go.mod h1:19wVj/fs5RtYtynAPJdDTb69oW0vNHYDBTbB4NvMD9c= -cloud.google.com/go/recaptchaenterprise/v2 v2.7.2/go.mod h1:kR0KjsJS7Jt1YSyWFkseQ756D45kaYNTlDPPaRAvDBU= -cloud.google.com/go/recaptchaenterprise/v2 v2.8.0/go.mod h1:QuE8EdU9dEnesG8/kG3XuJyNsjEqMlMzg3v3scCJ46c= -cloud.google.com/go/recaptchaenterprise/v2 v2.8.1/go.mod h1:JZYZJOeZjgSSTGP4uz7NlQ4/d1w5hGmksVgM0lbEij0= -cloud.google.com/go/recaptchaenterprise/v2 v2.8.2/go.mod h1:kpaDBOpkwD4G0GVMzG1W6Doy1tFFC97XAV3xy+Rd/pw= -cloud.google.com/go/recaptchaenterprise/v2 v2.8.3/go.mod h1:Dak54rw6lC2gBY8FBznpOCAR58wKf+R+ZSJRoeJok4w= -cloud.google.com/go/recaptchaenterprise/v2 v2.8.4/go.mod h1:Dak54rw6lC2gBY8FBznpOCAR58wKf+R+ZSJRoeJok4w= -cloud.google.com/go/recaptchaenterprise/v2 v2.9.0/go.mod h1:Dak54rw6lC2gBY8FBznpOCAR58wKf+R+ZSJRoeJok4w= -cloud.google.com/go/recaptchaenterprise/v2 v2.9.2/go.mod h1:trwwGkfhCmp05Ll5MSJPXY7yvnO0p4v3orGANAFHAuU= -cloud.google.com/go/recommendationengine v0.5.0/go.mod h1:E5756pJcVFeVgaQv3WNpImkFP8a+RptV6dDLGPILjvg= -cloud.google.com/go/recommendationengine v0.6.0/go.mod h1:08mq2umu9oIqc7tDy8sx+MNJdLG0fUi3vaSVbztHgJ4= -cloud.google.com/go/recommendationengine v0.7.0/go.mod h1:1reUcE3GIu6MeBz/h5xZJqNLuuVjNg1lmWMPyjatzac= -cloud.google.com/go/recommendationengine v0.8.1/go.mod h1:MrZihWwtFYWDzE6Hz5nKcNz3gLizXVIDI/o3G1DLcrE= -cloud.google.com/go/recommendationengine v0.8.2/go.mod h1:QIybYHPK58qir9CV2ix/re/M//Ty10OxjnnhWdaKS1Y= -cloud.google.com/go/recommendationengine v0.8.3/go.mod h1:m3b0RZV02BnODE9FeSvGv1qibFo8g0OnmB/RMwYy4V8= -cloud.google.com/go/recommendationengine v0.8.4/go.mod h1:GEteCf1PATl5v5ZsQ60sTClUE0phbWmo3rQ1Js8louU= -cloud.google.com/go/recommendationengine v0.8.5/go.mod h1:A38rIXHGFvoPvmy6pZLozr0g59NRNREz4cx7F58HAsQ= -cloud.google.com/go/recommender v1.5.0/go.mod h1:jdoeiBIVrJe9gQjwd759ecLJbxCDED4A6p+mqoqDvTg= -cloud.google.com/go/recommender v1.6.0/go.mod h1:+yETpm25mcoiECKh9DEScGzIRyDKpZ0cEhWGo+8bo+c= -cloud.google.com/go/recommender v1.7.0/go.mod h1:XLHs/W+T8olwlGOgfQenXBTbIseGclClff6lhFVe9Bs= -cloud.google.com/go/recommender v1.8.0/go.mod h1:PkjXrTT05BFKwxaUxQmtIlrtj0kph108r02ZZQ5FE70= -cloud.google.com/go/recommender v1.9.0/go.mod h1:PnSsnZY7q+VL1uax2JWkt/UegHssxjUVVCrX52CuEmQ= -cloud.google.com/go/recommender v1.10.1/go.mod h1:XFvrE4Suqn5Cq0Lf+mCP6oBHD/yRMA8XxP5sb7Q7gpA= -cloud.google.com/go/recommender v1.11.0/go.mod h1:kPiRQhPyTJ9kyXPCG6u/dlPLbYfFlkwHNRwdzPVAoII= -cloud.google.com/go/recommender v1.11.1/go.mod h1:sGwFFAyI57v2Hc5LbIj+lTwXipGu9NW015rkaEM5B18= -cloud.google.com/go/recommender v1.11.2/go.mod h1:AeoJuzOvFR/emIcXdVFkspVXVTYpliRCmKNYDnyBv6Y= -cloud.google.com/go/recommender v1.11.3/go.mod h1:+FJosKKJSId1MBFeJ/TTyoGQZiEelQQIZMKYYD8ruK4= -cloud.google.com/go/recommender v1.12.0/go.mod h1:+FJosKKJSId1MBFeJ/TTyoGQZiEelQQIZMKYYD8ruK4= -cloud.google.com/go/recommender v1.12.1/go.mod h1:gf95SInWNND5aPas3yjwl0I572dtudMhMIG4ni8nr+0= -cloud.google.com/go/redis v1.7.0/go.mod h1:V3x5Jq1jzUcg+UNsRvdmsfuFnit1cfe3Z/PGyq/lm4Y= -cloud.google.com/go/redis v1.8.0/go.mod h1:Fm2szCDavWzBk2cDKxrkmWBqoCiL1+Ctwq7EyqBCA/A= -cloud.google.com/go/redis v1.9.0/go.mod h1:HMYQuajvb2D0LvMgZmLDZW8V5aOC/WxstZHiy4g8OiA= -cloud.google.com/go/redis v1.10.0/go.mod h1:ThJf3mMBQtW18JzGgh41/Wld6vnDDc/F/F35UolRZPM= -cloud.google.com/go/redis v1.11.0/go.mod h1:/X6eicana+BWcUda5PpwZC48o37SiFVTFSs0fWAJ7uQ= -cloud.google.com/go/redis v1.13.1/go.mod h1:VP7DGLpE91M6bcsDdMuyCm2hIpB6Vp2hI090Mfd1tcg= -cloud.google.com/go/redis v1.13.2/go.mod h1:0Hg7pCMXS9uz02q+LoEVl5dNHUkIQv+C/3L76fandSA= -cloud.google.com/go/redis v1.13.3/go.mod h1:vbUpCKUAZSYzFcWKmICnYgRAhTFg9r+djWqFxDYXi4U= -cloud.google.com/go/redis v1.14.1/go.mod h1:MbmBxN8bEnQI4doZPC1BzADU4HGocHBk2de3SbgOkqs= -cloud.google.com/go/redis v1.14.2/go.mod h1:g0Lu7RRRz46ENdFKQ2EcQZBAJ2PtJHJLuiiRuEXwyQw= -cloud.google.com/go/resourcemanager v1.3.0/go.mod h1:bAtrTjZQFJkiWTPDb1WBjzvc6/kifjj4QBYuKCCoqKA= -cloud.google.com/go/resourcemanager v1.4.0/go.mod h1:MwxuzkumyTX7/a3n37gmsT3py7LIXwrShilPh3P1tR0= -cloud.google.com/go/resourcemanager v1.5.0/go.mod h1:eQoXNAiAvCf5PXxWxXjhKQoTMaUSNrEfg+6qdf/wots= -cloud.google.com/go/resourcemanager v1.6.0/go.mod h1:YcpXGRs8fDzcUl1Xw8uOVmI8JEadvhRIkoXXUNVYcVo= -cloud.google.com/go/resourcemanager v1.7.0/go.mod h1:HlD3m6+bwhzj9XCouqmeiGuni95NTrExfhoSrkC/3EI= -cloud.google.com/go/resourcemanager v1.9.1/go.mod h1:dVCuosgrh1tINZ/RwBufr8lULmWGOkPS8gL5gqyjdT8= -cloud.google.com/go/resourcemanager v1.9.2/go.mod h1:OujkBg1UZg5lX2yIyMo5Vz9O5hf7XQOSV7WxqxxMtQE= -cloud.google.com/go/resourcemanager v1.9.3/go.mod h1:IqrY+g0ZgLsihcfcmqSe+RKp1hzjXwG904B92AwBz6U= -cloud.google.com/go/resourcemanager v1.9.4/go.mod h1:N1dhP9RFvo3lUfwtfLWVxfUWq8+KUQ+XLlHLH3BoFJ0= -cloud.google.com/go/resourcemanager v1.9.5/go.mod h1:hep6KjelHA+ToEjOfO3garMKi/CLYwTqeAw7YiEI9x8= -cloud.google.com/go/resourcesettings v1.3.0/go.mod h1:lzew8VfESA5DQ8gdlHwMrqZs1S9V87v3oCnKCWoOuQU= -cloud.google.com/go/resourcesettings v1.4.0/go.mod h1:ldiH9IJpcrlC3VSuCGvjR5of/ezRrOxFtpJoJo5SmXg= -cloud.google.com/go/resourcesettings v1.5.0/go.mod h1:+xJF7QSG6undsQDfsCJyqWXyBwUoJLhetkRMDRnIoXA= -cloud.google.com/go/resourcesettings v1.6.1/go.mod h1:M7mk9PIZrC5Fgsu1kZJci6mpgN8o0IUzVx3eJU3y4Jw= -cloud.google.com/go/resourcesettings v1.6.2/go.mod h1:mJIEDd9MobzunWMeniaMp6tzg4I2GvD3TTmPkc8vBXk= -cloud.google.com/go/resourcesettings v1.6.3/go.mod h1:pno5D+7oDYkMWZ5BpPsb4SO0ewg3IXcmmrUZaMJrFic= -cloud.google.com/go/resourcesettings v1.6.4/go.mod h1:pYTTkWdv2lmQcjsthbZLNBP4QW140cs7wqA3DuqErVI= -cloud.google.com/go/resourcesettings v1.6.5/go.mod h1:WBOIWZraXZOGAgoR4ukNj0o0HiSMO62H9RpFi9WjP9I= -cloud.google.com/go/retail v1.8.0/go.mod h1:QblKS8waDmNUhghY2TI9O3JLlFk8jybHeV4BF19FrE4= -cloud.google.com/go/retail v1.9.0/go.mod h1:g6jb6mKuCS1QKnH/dpu7isX253absFl6iE92nHwlBUY= -cloud.google.com/go/retail v1.10.0/go.mod h1:2gDk9HsL4HMS4oZwz6daui2/jmKvqShXKQuB2RZ+cCc= -cloud.google.com/go/retail v1.11.0/go.mod h1:MBLk1NaWPmh6iVFSz9MeKG/Psyd7TAgm6y/9L2B4x9Y= -cloud.google.com/go/retail v1.12.0/go.mod h1:UMkelN/0Z8XvKymXFbD4EhFJlYKRx1FGhQkVPU5kF14= -cloud.google.com/go/retail v1.14.1/go.mod h1:y3Wv3Vr2k54dLNIrCzenyKG8g8dhvhncT2NcNjb/6gE= -cloud.google.com/go/retail v1.14.2/go.mod h1:W7rrNRChAEChX336QF7bnMxbsjugcOCPU44i5kbLiL8= -cloud.google.com/go/retail v1.14.3/go.mod h1:Omz2akDHeSlfCq8ArPKiBxlnRpKEBjUH386JYFLUvXo= -cloud.google.com/go/retail v1.14.4/go.mod h1:l/N7cMtY78yRnJqp5JW8emy7MB1nz8E4t2yfOmklYfg= -cloud.google.com/go/retail v1.15.1/go.mod h1:In9nSBOYhLbDGa87QvWlnE1XA14xBN2FpQRiRsUs9wU= -cloud.google.com/go/retail v1.16.0/go.mod h1:LW7tllVveZo4ReWt68VnldZFWJRzsh9np+01J9dYWzE= -cloud.google.com/go/run v0.2.0/go.mod h1:CNtKsTA1sDcnqqIFR3Pb5Tq0usWxJJvsWOCPldRU3Do= -cloud.google.com/go/run v0.3.0/go.mod h1:TuyY1+taHxTjrD0ZFk2iAR+xyOXEA0ztb7U3UNA0zBo= -cloud.google.com/go/run v0.8.0/go.mod h1:VniEnuBwqjigv0A7ONfQUaEItaiCRVujlMqerPPiktM= -cloud.google.com/go/run v0.9.0/go.mod h1:Wwu+/vvg8Y+JUApMwEDfVfhetv30hCG4ZwDR/IXl2Qg= -cloud.google.com/go/run v1.2.0/go.mod h1:36V1IlDzQ0XxbQjUx6IYbw8H3TJnWvhii963WW3B/bo= -cloud.google.com/go/run v1.3.0/go.mod h1:S/osX/4jIPZGg+ssuqh6GNgg7syixKe3YnprwehzHKU= -cloud.google.com/go/run v1.3.1/go.mod h1:cymddtZOzdwLIAsmS6s+Asl4JoXIDm/K1cpZTxV4Q5s= -cloud.google.com/go/run v1.3.2/go.mod h1:SIhmqArbjdU/D9M6JoHaAqnAMKLFtXaVdNeq04NjnVE= -cloud.google.com/go/run v1.3.3/go.mod h1:WSM5pGyJ7cfYyYbONVQBN4buz42zFqwG67Q3ch07iK4= -cloud.google.com/go/run v1.3.4/go.mod h1:FGieuZvQ3tj1e9GnzXqrMABSuir38AJg5xhiYq+SF3o= -cloud.google.com/go/scheduler v1.4.0/go.mod h1:drcJBmxF3aqZJRhmkHQ9b3uSSpQoltBPGPxGAWROx6s= -cloud.google.com/go/scheduler v1.5.0/go.mod h1:ri073ym49NW3AfT6DZi21vLZrG07GXr5p3H1KxN5QlI= -cloud.google.com/go/scheduler v1.6.0/go.mod h1:SgeKVM7MIwPn3BqtcBntpLyrIJftQISRrYB5ZtT+KOk= -cloud.google.com/go/scheduler v1.7.0/go.mod h1:jyCiBqWW956uBjjPMMuX09n3x37mtyPJegEWKxRsn44= -cloud.google.com/go/scheduler v1.8.0/go.mod h1:TCET+Y5Gp1YgHT8py4nlg2Sew8nUHMqcpousDgXJVQc= -cloud.google.com/go/scheduler v1.9.0/go.mod h1:yexg5t+KSmqu+njTIh3b7oYPheFtBWGcbVUYF1GGMIc= -cloud.google.com/go/scheduler v1.10.1/go.mod h1:R63Ldltd47Bs4gnhQkmNDse5w8gBRrhObZ54PxgR2Oo= -cloud.google.com/go/scheduler v1.10.2/go.mod h1:O3jX6HRH5eKCA3FutMw375XHZJudNIKVonSCHv7ropY= -cloud.google.com/go/scheduler v1.10.3/go.mod h1:8ANskEM33+sIbpJ+R4xRfw/jzOG+ZFE8WVLy7/yGvbc= -cloud.google.com/go/scheduler v1.10.4/go.mod h1:MTuXcrJC9tqOHhixdbHDFSIuh7xZF2IysiINDuiq6NI= -cloud.google.com/go/scheduler v1.10.5/go.mod h1:MTuXcrJC9tqOHhixdbHDFSIuh7xZF2IysiINDuiq6NI= -cloud.google.com/go/scheduler v1.10.6/go.mod h1:pe2pNCtJ+R01E06XCDOJs1XvAMbv28ZsQEbqknxGOuE= -cloud.google.com/go/secretmanager v1.6.0/go.mod h1:awVa/OXF6IiyaU1wQ34inzQNc4ISIDIrId8qE5QGgKA= -cloud.google.com/go/secretmanager v1.8.0/go.mod h1:hnVgi/bN5MYHd3Gt0SPuTPPp5ENina1/LxM+2W9U9J4= -cloud.google.com/go/secretmanager v1.9.0/go.mod h1:b71qH2l1yHmWQHt9LC80akm86mX8AL6X1MA01dW8ht4= -cloud.google.com/go/secretmanager v1.10.0/go.mod h1:MfnrdvKMPNra9aZtQFvBcvRU54hbPD8/HayQdlUgJpU= -cloud.google.com/go/secretmanager v1.11.1/go.mod h1:znq9JlXgTNdBeQk9TBW/FnR/W4uChEKGeqQWAJ8SXFw= -cloud.google.com/go/secretmanager v1.11.2/go.mod h1:MQm4t3deoSub7+WNwiC4/tRYgDBHJgJPvswqQVB1Vss= -cloud.google.com/go/secretmanager v1.11.3/go.mod h1:0bA2o6FabmShrEy328i67aV+65XoUFFSmVeLBn/51jI= -cloud.google.com/go/secretmanager v1.11.4/go.mod h1:wreJlbS9Zdq21lMzWmJ0XhWW2ZxgPeahsqeV/vZoJ3w= -cloud.google.com/go/secretmanager v1.11.5/go.mod h1:eAGv+DaCHkeVyQi0BeXgAHOU0RdrMeZIASKc+S7VqH4= -cloud.google.com/go/security v1.5.0/go.mod h1:lgxGdyOKKjHL4YG3/YwIL2zLqMFCKs0UbQwgyZmfJl4= -cloud.google.com/go/security v1.7.0/go.mod h1:mZklORHl6Bg7CNnnjLH//0UlAlaXqiG7Lb9PsPXLfD0= -cloud.google.com/go/security v1.8.0/go.mod h1:hAQOwgmaHhztFhiQ41CjDODdWP0+AE1B3sX4OFlq+GU= -cloud.google.com/go/security v1.9.0/go.mod h1:6Ta1bO8LXI89nZnmnsZGp9lVoVWXqsVbIq/t9dzI+2Q= -cloud.google.com/go/security v1.10.0/go.mod h1:QtOMZByJVlibUT2h9afNDWRZ1G96gVywH8T5GUSb9IA= -cloud.google.com/go/security v1.12.0/go.mod h1:rV6EhrpbNHrrxqlvW0BWAIawFWq3X90SduMJdFwtLB8= -cloud.google.com/go/security v1.13.0/go.mod h1:Q1Nvxl1PAgmeW0y3HTt54JYIvUdtcpYKVfIB8AOMZ+0= -cloud.google.com/go/security v1.15.1/go.mod h1:MvTnnbsWnehoizHi09zoiZob0iCHVcL4AUBj76h9fXA= -cloud.google.com/go/security v1.15.2/go.mod h1:2GVE/v1oixIRHDaClVbHuPcZwAqFM28mXuAKCfMgYIg= -cloud.google.com/go/security v1.15.3/go.mod h1:gQ/7Q2JYUZZgOzqKtw9McShH+MjNvtDpL40J1cT+vBs= -cloud.google.com/go/security v1.15.4/go.mod h1:oN7C2uIZKhxCLiAAijKUCuHLZbIt/ghYEo8MqwD/Ty4= -cloud.google.com/go/security v1.15.5/go.mod h1:KS6X2eG3ynWjqcIX976fuToN5juVkF6Ra6c7MPnldtc= -cloud.google.com/go/securitycenter v1.13.0/go.mod h1:cv5qNAqjY84FCN6Y9z28WlkKXyWsgLO832YiWwkCWcU= -cloud.google.com/go/securitycenter v1.14.0/go.mod h1:gZLAhtyKv85n52XYWt6RmeBdydyxfPeTrpToDPw4Auc= -cloud.google.com/go/securitycenter v1.15.0/go.mod h1:PeKJ0t8MoFmmXLXWm41JidyzI3PJjd8sXWaVqg43WWk= -cloud.google.com/go/securitycenter v1.16.0/go.mod h1:Q9GMaLQFUD+5ZTabrbujNWLtSLZIZF7SAR0wWECrjdk= -cloud.google.com/go/securitycenter v1.18.1/go.mod h1:0/25gAzCM/9OL9vVx4ChPeM/+DlfGQJDwBy/UC8AKK0= -cloud.google.com/go/securitycenter v1.19.0/go.mod h1:LVLmSg8ZkkyaNy4u7HCIshAngSQ8EcIRREP3xBnyfag= -cloud.google.com/go/securitycenter v1.23.0/go.mod h1:8pwQ4n+Y9WCWM278R8W3nF65QtY172h4S8aXyI9/hsQ= -cloud.google.com/go/securitycenter v1.23.1/go.mod h1:w2HV3Mv/yKhbXKwOCu2i8bCuLtNP1IMHuiYQn4HJq5s= -cloud.google.com/go/securitycenter v1.24.1/go.mod h1:3h9IdjjHhVMXdQnmqzVnM7b0wMn/1O/U20eWVpMpZjI= -cloud.google.com/go/securitycenter v1.24.2/go.mod h1:l1XejOngggzqwr4Fa2Cn+iWZGf+aBLTXtB/vXjy5vXM= -cloud.google.com/go/securitycenter v1.24.3/go.mod h1:l1XejOngggzqwr4Fa2Cn+iWZGf+aBLTXtB/vXjy5vXM= -cloud.google.com/go/securitycenter v1.24.4/go.mod h1:PSccin+o1EMYKcFQzz9HMMnZ2r9+7jbc+LvPjXhpwcU= -cloud.google.com/go/servicecontrol v1.4.0/go.mod h1:o0hUSJ1TXJAmi/7fLJAedOovnujSEvjKCAFNXPQ1RaU= -cloud.google.com/go/servicecontrol v1.5.0/go.mod h1:qM0CnXHhyqKVuiZnGKrIurvVImCs8gmqWsDoqe9sU1s= -cloud.google.com/go/servicecontrol v1.10.0/go.mod h1:pQvyvSRh7YzUF2efw7H87V92mxU8FnFDawMClGCNuAA= -cloud.google.com/go/servicecontrol v1.11.0/go.mod h1:kFmTzYzTUIuZs0ycVqRHNaNhgR+UMUpw9n02l/pY+mc= -cloud.google.com/go/servicecontrol v1.11.1/go.mod h1:aSnNNlwEFBY+PWGQ2DoM0JJ/QUXqV5/ZD9DOLB7SnUk= -cloud.google.com/go/servicedirectory v1.4.0/go.mod h1:gH1MUaZCgtP7qQiI+F+A+OpeKF/HQWgtAddhTbhL2bs= -cloud.google.com/go/servicedirectory v1.5.0/go.mod h1:QMKFL0NUySbpZJ1UZs3oFAmdvVxhhxB6eJ/Vlp73dfg= -cloud.google.com/go/servicedirectory v1.6.0/go.mod h1:pUlbnWsLH9c13yGkxCmfumWEPjsRs1RlmJ4pqiNjVL4= -cloud.google.com/go/servicedirectory v1.7.0/go.mod h1:5p/U5oyvgYGYejufvxhgwjL8UVXjkuw7q5XcG10wx1U= -cloud.google.com/go/servicedirectory v1.8.0/go.mod h1:srXodfhY1GFIPvltunswqXpVxFPpZjf8nkKQT7XcXaY= -cloud.google.com/go/servicedirectory v1.9.0/go.mod h1:29je5JjiygNYlmsGz8k6o+OZ8vd4f//bQLtvzkPPT/s= -cloud.google.com/go/servicedirectory v1.10.1/go.mod h1:Xv0YVH8s4pVOwfM/1eMTl0XJ6bzIOSLDt8f8eLaGOxQ= -cloud.google.com/go/servicedirectory v1.11.0/go.mod h1:Xv0YVH8s4pVOwfM/1eMTl0XJ6bzIOSLDt8f8eLaGOxQ= -cloud.google.com/go/servicedirectory v1.11.1/go.mod h1:tJywXimEWzNzw9FvtNjsQxxJ3/41jseeILgwU/QLrGI= -cloud.google.com/go/servicedirectory v1.11.2/go.mod h1:KD9hCLhncWRV5jJphwIpugKwM5bn1x0GyVVD4NO8mGg= -cloud.google.com/go/servicedirectory v1.11.3/go.mod h1:LV+cHkomRLr67YoQy3Xq2tUXBGOs5z5bPofdq7qtiAw= -cloud.google.com/go/servicedirectory v1.11.4/go.mod h1:Bz2T9t+/Ehg6x+Y7Ycq5xiShYLD96NfEsWNHyitj1qM= -cloud.google.com/go/servicemanagement v1.4.0/go.mod h1:d8t8MDbezI7Z2R1O/wu8oTggo3BI2GKYbdG4y/SJTco= -cloud.google.com/go/servicemanagement v1.5.0/go.mod h1:XGaCRe57kfqu4+lRxaFEAuqmjzF0r+gWHjWqKqBvKFo= -cloud.google.com/go/servicemanagement v1.6.0/go.mod h1:aWns7EeeCOtGEX4OvZUWCCJONRZeFKiptqKf1D0l/Jc= -cloud.google.com/go/servicemanagement v1.8.0/go.mod h1:MSS2TDlIEQD/fzsSGfCdJItQveu9NXnUniTrq/L8LK4= -cloud.google.com/go/serviceusage v1.3.0/go.mod h1:Hya1cozXM4SeSKTAgGXgj97GlqUvF5JaoXacR1JTP/E= -cloud.google.com/go/serviceusage v1.4.0/go.mod h1:SB4yxXSaYVuUBYUml6qklyONXNLt83U0Rb+CXyhjEeU= -cloud.google.com/go/serviceusage v1.5.0/go.mod h1:w8U1JvqUqwJNPEOTQjrMHkw3IaIFLoLsPLvsE3xueec= -cloud.google.com/go/serviceusage v1.6.0/go.mod h1:R5wwQcbOWsyuOfbP9tGdAnCAc6B9DRwPG1xtWMDeuPA= -cloud.google.com/go/shell v1.3.0/go.mod h1:VZ9HmRjZBsjLGXusm7K5Q5lzzByZmJHf1d0IWHEN5X4= -cloud.google.com/go/shell v1.4.0/go.mod h1:HDxPzZf3GkDdhExzD/gs8Grqk+dmYcEjGShZgYa9URw= -cloud.google.com/go/shell v1.6.0/go.mod h1:oHO8QACS90luWgxP3N9iZVuEiSF84zNyLytb+qE2f9A= -cloud.google.com/go/shell v1.7.1/go.mod h1:u1RaM+huXFaTojTbW4g9P5emOrrmLE69KrxqQahKn4g= -cloud.google.com/go/shell v1.7.2/go.mod h1:KqRPKwBV0UyLickMn0+BY1qIyE98kKyI216sH/TuHmc= -cloud.google.com/go/shell v1.7.3/go.mod h1:cTTEz/JdaBsQAeTQ3B6HHldZudFoYBOqjteev07FbIc= -cloud.google.com/go/shell v1.7.4/go.mod h1:yLeXB8eKLxw0dpEmXQ/FjriYrBijNsONpwnWsdPqlKM= -cloud.google.com/go/shell v1.7.5/go.mod h1:hL2++7F47/IfpfTO53KYf1EC+F56k3ThfNEXd4zcuiE= -cloud.google.com/go/spanner v1.41.0/go.mod h1:MLYDBJR/dY4Wt7ZaMIQ7rXOTLjYrmxLE/5ve9vFfWos= -cloud.google.com/go/spanner v1.44.0/go.mod h1:G8XIgYdOK+Fbcpbs7p2fiprDw4CaZX63whnSMLVBxjk= -cloud.google.com/go/spanner v1.45.0/go.mod h1:FIws5LowYz8YAE1J8fOS7DJup8ff7xJeetWEo5REA2M= -cloud.google.com/go/spanner v1.47.0/go.mod h1:IXsJwVW2j4UKs0eYDqodab6HgGuA1bViSqW4uH9lfUI= -cloud.google.com/go/spanner v1.49.0/go.mod h1:eGj9mQGK8+hkgSVbHNQ06pQ4oS+cyc4tXXd6Dif1KoM= -cloud.google.com/go/spanner v1.50.0/go.mod h1:eGj9mQGK8+hkgSVbHNQ06pQ4oS+cyc4tXXd6Dif1KoM= -cloud.google.com/go/spanner v1.51.0/go.mod h1:c5KNo5LQ1X5tJwma9rSQZsXNBDNvj4/n8BVc3LNahq0= -cloud.google.com/go/spanner v1.53.0/go.mod h1:liG4iCeLqm5L3fFLU5whFITqP0e0orsAW1uUSrd4rws= -cloud.google.com/go/spanner v1.53.1/go.mod h1:liG4iCeLqm5L3fFLU5whFITqP0e0orsAW1uUSrd4rws= -cloud.google.com/go/spanner v1.54.0/go.mod h1:wZvSQVBgngF0Gq86fKup6KIYmN2be7uOKjtK97X+bQU= -cloud.google.com/go/spanner v1.55.0/go.mod h1:HXEznMUVhC+PC+HDyo9YFG2Ajj5BQDkcbqB9Z2Ffxi0= -cloud.google.com/go/spanner v1.56.0/go.mod h1:DndqtUKQAt3VLuV2Le+9Y3WTnq5cNKrnLb/Piqcj+h0= -cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM= -cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ= -cloud.google.com/go/speech v1.8.0/go.mod h1:9bYIl1/tjsAnMgKGHKmBZzXKEkGgtU+MpdDPTE9f7y0= -cloud.google.com/go/speech v1.9.0/go.mod h1:xQ0jTcmnRFFM2RfX/U+rk6FQNUF6DQlydUSyoooSpco= -cloud.google.com/go/speech v1.14.1/go.mod h1:gEosVRPJ9waG7zqqnsHpYTOoAS4KouMRLDFMekpJ0J0= -cloud.google.com/go/speech v1.15.0/go.mod h1:y6oH7GhqCaZANH7+Oe0BhgIogsNInLlz542tg3VqeYI= -cloud.google.com/go/speech v1.17.1/go.mod h1:8rVNzU43tQvxDaGvqOhpDqgkJTFowBpDvCJ14kGlJYo= -cloud.google.com/go/speech v1.19.0/go.mod h1:8rVNzU43tQvxDaGvqOhpDqgkJTFowBpDvCJ14kGlJYo= -cloud.google.com/go/speech v1.19.1/go.mod h1:WcuaWz/3hOlzPFOVo9DUsblMIHwxP589y6ZMtaG+iAA= -cloud.google.com/go/speech v1.19.2/go.mod h1:2OYFfj+Ch5LWjsaSINuCZsre/789zlcCI3SY4oAi2oI= -cloud.google.com/go/speech v1.20.1/go.mod h1:wwolycgONvfz2EDU8rKuHRW3+wc9ILPsAWoikBEWavY= -cloud.google.com/go/speech v1.21.0/go.mod h1:wwolycgONvfz2EDU8rKuHRW3+wc9ILPsAWoikBEWavY= -cloud.google.com/go/speech v1.21.1/go.mod h1:E5GHZXYQlkqWQwY5xRSLHw2ci5NMQNG52FfMU1aZrIA= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= -cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= -cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= -cloud.google.com/go/storage v1.28.1/go.mod h1:Qnisd4CqDdo6BGs2AD5LLnEsmSQ80wQ5ogcBBKhU86Y= -cloud.google.com/go/storage v1.29.0/go.mod h1:4puEjyTKnku6gfKoTfNOU/W+a9JyuVNxjpS5GBrB8h4= -cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= -cloud.google.com/go/storage v1.36.0/go.mod h1:M6M/3V/D3KpzMTJyPOR/HU6n2Si5QdaXYEsng2xgOs8= -cloud.google.com/go/storage v1.37.0/go.mod h1:i34TiT2IhiNDmcj65PqwCjcoUX7Z5pLzS8DEmoiFq1k= -cloud.google.com/go/storage v1.38.0/go.mod h1:tlUADB0mAb9BgYls9lq+8MGkfzOXuLrnHXlpHmvFJoY= -cloud.google.com/go/storagetransfer v1.5.0/go.mod h1:dxNzUopWy7RQevYFHewchb29POFv3/AaBgnhqzqiK0w= -cloud.google.com/go/storagetransfer v1.6.0/go.mod h1:y77xm4CQV/ZhFZH75PLEXY0ROiS7Gh6pSKrM8dJyg6I= -cloud.google.com/go/storagetransfer v1.7.0/go.mod h1:8Giuj1QNb1kfLAiWM1bN6dHzfdlDAVC9rv9abHot2W4= -cloud.google.com/go/storagetransfer v1.8.0/go.mod h1:JpegsHHU1eXg7lMHkvf+KE5XDJ7EQu0GwNJbbVGanEw= -cloud.google.com/go/storagetransfer v1.10.0/go.mod h1:DM4sTlSmGiNczmV6iZyceIh2dbs+7z2Ayg6YAiQlYfA= -cloud.google.com/go/storagetransfer v1.10.1/go.mod h1:rS7Sy0BtPviWYTTJVWCSV4QrbBitgPeuK4/FKa4IdLs= -cloud.google.com/go/storagetransfer v1.10.2/go.mod h1:meIhYQup5rg9juQJdyppnA/WLQCOguxtk1pr3/vBWzA= -cloud.google.com/go/storagetransfer v1.10.3/go.mod h1:Up8LY2p6X68SZ+WToswpQbQHnJpOty/ACcMafuey8gc= -cloud.google.com/go/storagetransfer v1.10.4/go.mod h1:vef30rZKu5HSEf/x1tK3WfWrL0XVoUQN/EPDRGPzjZs= -cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= -cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= -cloud.google.com/go/talent v1.3.0/go.mod h1:CmcxwJ/PKfRgd1pBjQgU6W3YBwiewmUzQYH5HHmSCmM= -cloud.google.com/go/talent v1.4.0/go.mod h1:ezFtAgVuRf8jRsvyE6EwmbTK5LKciD4KVnHuDEFmOOA= -cloud.google.com/go/talent v1.5.0/go.mod h1:G+ODMj9bsasAEJkQSzO2uHQWXHHXUomArjWQQYkqK6c= -cloud.google.com/go/talent v1.6.2/go.mod h1:CbGvmKCG61mkdjcqTcLOkb2ZN1SrQI8MDyma2l7VD24= -cloud.google.com/go/talent v1.6.3/go.mod h1:xoDO97Qd4AK43rGjJvyBHMskiEf3KulgYzcH6YWOVoo= -cloud.google.com/go/talent v1.6.4/go.mod h1:QsWvi5eKeh6gG2DlBkpMaFYZYrYUnIpo34f6/V5QykY= -cloud.google.com/go/talent v1.6.5/go.mod h1:Mf5cma696HmE+P2BWJ/ZwYqeJXEeU0UqjHFXVLadEDI= -cloud.google.com/go/talent v1.6.6/go.mod h1:y/WQDKrhVz12WagoarpAIyKKMeKGKHWPoReZ0g8tseQ= -cloud.google.com/go/texttospeech v1.4.0/go.mod h1:FX8HQHA6sEpJ7rCMSfXuzBcysDAuWusNNNvN9FELDd8= -cloud.google.com/go/texttospeech v1.5.0/go.mod h1:oKPLhR4n4ZdQqWKURdwxMy0uiTS1xU161C8W57Wkea4= -cloud.google.com/go/texttospeech v1.6.0/go.mod h1:YmwmFT8pj1aBblQOI3TfKmwibnsfvhIBzPXcW4EBovc= -cloud.google.com/go/texttospeech v1.7.1/go.mod h1:m7QfG5IXxeneGqTapXNxv2ItxP/FS0hCZBwXYqucgSk= -cloud.google.com/go/texttospeech v1.7.2/go.mod h1:VYPT6aTOEl3herQjFHYErTlSZJ4vB00Q2ZTmuVgluD4= -cloud.google.com/go/texttospeech v1.7.3/go.mod h1:Av/zpkcgWfXlDLRYob17lqMstGZ3GqlvJXqKMp2u8so= -cloud.google.com/go/texttospeech v1.7.4/go.mod h1:vgv0002WvR4liGuSd5BJbWy4nDn5Ozco0uJymY5+U74= -cloud.google.com/go/texttospeech v1.7.5/go.mod h1:tzpCuNWPwrNJnEa4Pu5taALuZL4QRRLcb+K9pbhXT6M= -cloud.google.com/go/tpu v1.3.0/go.mod h1:aJIManG0o20tfDQlRIej44FcwGGl/cD0oiRyMKG19IQ= -cloud.google.com/go/tpu v1.4.0/go.mod h1:mjZaX8p0VBgllCzF6wcU2ovUXN9TONFLd7iz227X2Xg= -cloud.google.com/go/tpu v1.5.0/go.mod h1:8zVo1rYDFuW2l4yZVY0R0fb/v44xLh3llq7RuV61fPM= -cloud.google.com/go/tpu v1.6.1/go.mod h1:sOdcHVIgDEEOKuqUoi6Fq53MKHJAtOwtz0GuKsWSH3E= -cloud.google.com/go/tpu v1.6.2/go.mod h1:NXh3NDwt71TsPZdtGWgAG5ThDfGd32X1mJ2cMaRlVgU= -cloud.google.com/go/tpu v1.6.3/go.mod h1:lxiueqfVMlSToZY1151IaZqp89ELPSrk+3HIQ5HRkbY= -cloud.google.com/go/tpu v1.6.4/go.mod h1:NAm9q3Rq2wIlGnOhpYICNI7+bpBebMJbh0yyp3aNw1Y= -cloud.google.com/go/tpu v1.6.5/go.mod h1:P9DFOEBIBhuEcZhXi+wPoVy/cji+0ICFi4TtTkMHSSs= -cloud.google.com/go/trace v1.3.0/go.mod h1:FFUE83d9Ca57C+K8rDl/Ih8LwOzWIV1krKgxg6N0G28= -cloud.google.com/go/trace v1.4.0/go.mod h1:UG0v8UBqzusp+z63o7FK74SdFE+AXpCLdFb1rshXG+Y= -cloud.google.com/go/trace v1.8.0/go.mod h1:zH7vcsbAhklH8hWFig58HvxcxyQbaIqMarMg9hn5ECA= -cloud.google.com/go/trace v1.9.0/go.mod h1:lOQqpE5IaWY0Ixg7/r2SjixMuc6lfTFeO4QGM4dQWOk= -cloud.google.com/go/trace v1.10.1/go.mod h1:gbtL94KE5AJLH3y+WVpfWILmqgc6dXcqgNXdOPAQTYk= -cloud.google.com/go/trace v1.10.2/go.mod h1:NPXemMi6MToRFcSxRl2uDnu/qAlAQ3oULUphcHGh1vA= -cloud.google.com/go/trace v1.10.3/go.mod h1:Ke1bgfc73RV3wUFml+uQp7EsDw4dGaETLxB7Iq/r4CY= -cloud.google.com/go/trace v1.10.4/go.mod h1:Nso99EDIK8Mj5/zmB+iGr9dosS/bzWCJ8wGmE6TXNWY= -cloud.google.com/go/trace v1.10.5/go.mod h1:9hjCV1nGBCtXbAE4YK7OqJ8pmPYSxPA0I67JwRd5s3M= -cloud.google.com/go/translate v1.3.0/go.mod h1:gzMUwRjvOqj5i69y/LYLd8RrNQk+hOmIXTi9+nb3Djs= -cloud.google.com/go/translate v1.4.0/go.mod h1:06Dn/ppvLD6WvA5Rhdp029IX2Mi3Mn7fpMRLPvXT5Wg= -cloud.google.com/go/translate v1.5.0/go.mod h1:29YDSYveqqpA1CQFD7NQuP49xymq17RXNaUDdc0mNu0= -cloud.google.com/go/translate v1.6.0/go.mod h1:lMGRudH1pu7I3n3PETiOB2507gf3HnfLV8qlkHZEyos= -cloud.google.com/go/translate v1.7.0/go.mod h1:lMGRudH1pu7I3n3PETiOB2507gf3HnfLV8qlkHZEyos= -cloud.google.com/go/translate v1.8.1/go.mod h1:d1ZH5aaOA0CNhWeXeC8ujd4tdCFw8XoNWRljklu5RHs= -cloud.google.com/go/translate v1.8.2/go.mod h1:d1ZH5aaOA0CNhWeXeC8ujd4tdCFw8XoNWRljklu5RHs= -cloud.google.com/go/translate v1.9.0/go.mod h1:d1ZH5aaOA0CNhWeXeC8ujd4tdCFw8XoNWRljklu5RHs= -cloud.google.com/go/translate v1.9.1/go.mod h1:TWIgDZknq2+JD4iRcojgeDtqGEp154HN/uL6hMvylS8= -cloud.google.com/go/translate v1.9.2/go.mod h1:E3Tc6rUTsQkVrXW6avbUhKJSr7ZE3j7zNmqzXKHqRrY= -cloud.google.com/go/translate v1.9.3/go.mod h1:Kbq9RggWsbqZ9W5YpM94Q1Xv4dshw/gr/SHfsl5yCZ0= -cloud.google.com/go/translate v1.10.0/go.mod h1:Kbq9RggWsbqZ9W5YpM94Q1Xv4dshw/gr/SHfsl5yCZ0= -cloud.google.com/go/translate v1.10.1/go.mod h1:adGZcQNom/3ogU65N9UXHOnnSvjPwA/jKQUMnsYXOyk= -cloud.google.com/go/video v1.8.0/go.mod h1:sTzKFc0bUSByE8Yoh8X0mn8bMymItVGPfTuUBUyRgxk= -cloud.google.com/go/video v1.9.0/go.mod h1:0RhNKFRF5v92f8dQt0yhaHrEuH95m068JYOvLZYnJSw= -cloud.google.com/go/video v1.12.0/go.mod h1:MLQew95eTuaNDEGriQdcYn0dTwf9oWiA4uYebxM5kdg= -cloud.google.com/go/video v1.13.0/go.mod h1:ulzkYlYgCp15N2AokzKjy7MQ9ejuynOJdf1tR5lGthk= -cloud.google.com/go/video v1.14.0/go.mod h1:SkgaXwT+lIIAKqWAJfktHT/RbgjSuY6DobxEp0C5yTQ= -cloud.google.com/go/video v1.15.0/go.mod h1:SkgaXwT+lIIAKqWAJfktHT/RbgjSuY6DobxEp0C5yTQ= -cloud.google.com/go/video v1.17.1/go.mod h1:9qmqPqw/Ib2tLqaeHgtakU+l5TcJxCJbhFXM7UJjVzU= -cloud.google.com/go/video v1.19.0/go.mod h1:9qmqPqw/Ib2tLqaeHgtakU+l5TcJxCJbhFXM7UJjVzU= -cloud.google.com/go/video v1.20.0/go.mod h1:U3G3FTnsvAGqglq9LxgqzOiBc/Nt8zis8S+850N2DUM= -cloud.google.com/go/video v1.20.1/go.mod h1:3gJS+iDprnj8SY6pe0SwLeC5BUW80NjhwX7INWEuWGU= -cloud.google.com/go/video v1.20.2/go.mod h1:lrixr5JeKNThsgfM9gqtwb6Okuqzfo4VrY2xynaViTA= -cloud.google.com/go/video v1.20.3/go.mod h1:TnH/mNZKVHeNtpamsSPygSR0iHtvrR/cW1/GDjN5+GU= -cloud.google.com/go/video v1.20.4/go.mod h1:LyUVjyW+Bwj7dh3UJnUGZfyqjEto9DnrvTe1f/+QrW0= -cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= -cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4= -cloud.google.com/go/videointelligence v1.8.0/go.mod h1:dIcCn4gVDdS7yte/w+koiXn5dWVplOZkE+xwG9FgK+M= -cloud.google.com/go/videointelligence v1.9.0/go.mod h1:29lVRMPDYHikk3v8EdPSaL8Ku+eMzDljjuvRs105XoU= -cloud.google.com/go/videointelligence v1.10.0/go.mod h1:LHZngX1liVtUhZvi2uNS0VQuOzNi2TkY1OakiuoUOjU= -cloud.google.com/go/videointelligence v1.11.1/go.mod h1:76xn/8InyQHarjTWsBR058SmlPCwQjgcvoW0aZykOvo= -cloud.google.com/go/videointelligence v1.11.2/go.mod h1:ocfIGYtIVmIcWk1DsSGOoDiXca4vaZQII1C85qtoplc= -cloud.google.com/go/videointelligence v1.11.3/go.mod h1:tf0NUaGTjU1iS2KEkGWvO5hRHeCkFK3nPo0/cOZhZAo= -cloud.google.com/go/videointelligence v1.11.4/go.mod h1:kPBMAYsTPFiQxMLmmjpcZUMklJp3nC9+ipJJtprccD8= -cloud.google.com/go/videointelligence v1.11.5/go.mod h1:/PkeQjpRponmOerPeJxNPuxvi12HlW7Em0lJO14FC3I= -cloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0= -cloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo= -cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo= -cloud.google.com/go/vision/v2 v2.4.0/go.mod h1:VtI579ll9RpVTrdKdkMzckdnwMyX2JILb+MhPqRbPsY= -cloud.google.com/go/vision/v2 v2.5.0/go.mod h1:MmaezXOOE+IWa+cS7OhRRLK2cNv1ZL98zhqFFZaaH2E= -cloud.google.com/go/vision/v2 v2.6.0/go.mod h1:158Hes0MvOS9Z/bDMSFpjwsUrZ5fPrdwuyyvKSGAGMY= -cloud.google.com/go/vision/v2 v2.7.0/go.mod h1:H89VysHy21avemp6xcf9b9JvZHVehWbET0uT/bcuY/0= -cloud.google.com/go/vision/v2 v2.7.2/go.mod h1:jKa8oSYBWhYiXarHPvP4USxYANYUEdEsQrloLjrSwJU= -cloud.google.com/go/vision/v2 v2.7.3/go.mod h1:V0IcLCY7W+hpMKXK1JYE0LV5llEqVmj+UJChjvA1WsM= -cloud.google.com/go/vision/v2 v2.7.4/go.mod h1:ynDKnsDN/0RtqkKxQZ2iatv3Dm9O+HfRb5djl7l4Vvw= -cloud.google.com/go/vision/v2 v2.7.5/go.mod h1:GcviprJLFfK9OLf0z8Gm6lQb6ZFUulvpZws+mm6yPLM= -cloud.google.com/go/vision/v2 v2.7.6/go.mod h1:ZkvWTVNPBU3YZYzgF9Y1jwEbD1NBOCyJn0KFdQfE6Bw= -cloud.google.com/go/vision/v2 v2.8.0/go.mod h1:ocqDiA2j97pvgogdyhoxiQp2ZkDCyr0HWpicywGGRhU= -cloud.google.com/go/vmmigration v1.2.0/go.mod h1:IRf0o7myyWFSmVR1ItrBSFLFD/rJkfDCUTO4vLlJvsE= -cloud.google.com/go/vmmigration v1.3.0/go.mod h1:oGJ6ZgGPQOFdjHuocGcLqX4lc98YQ7Ygq8YQwHh9A7g= -cloud.google.com/go/vmmigration v1.5.0/go.mod h1:E4YQ8q7/4W9gobHjQg4JJSgXXSgY21nA5r8swQV+Xxc= -cloud.google.com/go/vmmigration v1.6.0/go.mod h1:bopQ/g4z+8qXzichC7GW1w2MjbErL54rk3/C843CjfY= -cloud.google.com/go/vmmigration v1.7.1/go.mod h1:WD+5z7a/IpZ5bKK//YmT9E047AD+rjycCAvyMxGJbro= -cloud.google.com/go/vmmigration v1.7.2/go.mod h1:iA2hVj22sm2LLYXGPT1pB63mXHhrH1m/ruux9TwWLd8= -cloud.google.com/go/vmmigration v1.7.3/go.mod h1:ZCQC7cENwmSWlwyTrZcWivchn78YnFniEQYRWQ65tBo= -cloud.google.com/go/vmmigration v1.7.4/go.mod h1:yBXCmiLaB99hEl/G9ZooNx2GyzgsjKnw5fWcINRgD70= -cloud.google.com/go/vmmigration v1.7.5/go.mod h1:pkvO6huVnVWzkFioxSghZxIGcsstDvYiVCxQ9ZH3eYI= -cloud.google.com/go/vmwareengine v0.1.0/go.mod h1:RsdNEf/8UDvKllXhMz5J40XxDrNJNN4sagiox+OI208= -cloud.google.com/go/vmwareengine v0.2.2/go.mod h1:sKdctNJxb3KLZkE/6Oui94iw/xs9PRNC2wnNLXsHvH8= -cloud.google.com/go/vmwareengine v0.3.0/go.mod h1:wvoyMvNWdIzxMYSpH/R7y2h5h3WFkx6d+1TIsP39WGY= -cloud.google.com/go/vmwareengine v0.4.1/go.mod h1:Px64x+BvjPZwWuc4HdmVhoygcXqEkGHXoa7uyfTgSI0= -cloud.google.com/go/vmwareengine v1.0.0/go.mod h1:Px64x+BvjPZwWuc4HdmVhoygcXqEkGHXoa7uyfTgSI0= -cloud.google.com/go/vmwareengine v1.0.1/go.mod h1:aT3Xsm5sNx0QShk1Jc1B8OddrxAScYLwzVoaiXfdzzk= -cloud.google.com/go/vmwareengine v1.0.2/go.mod h1:xMSNjIk8/itYrz1JA8nV3Ajg4L4n3N+ugP8JKzk3OaA= -cloud.google.com/go/vmwareengine v1.0.3/go.mod h1:QSpdZ1stlbfKtyt6Iu19M6XRxjmXO+vb5a/R6Fvy2y4= -cloud.google.com/go/vmwareengine v1.1.1/go.mod h1:nMpdsIVkUrSaX8UvmnBhzVzG7PPvNYc5BszcvIVudYs= -cloud.google.com/go/vpcaccess v1.4.0/go.mod h1:aQHVbTWDYUR1EbTApSVvMq1EnT57ppDmQzZ3imqIk4w= -cloud.google.com/go/vpcaccess v1.5.0/go.mod h1:drmg4HLk9NkZpGfCmZ3Tz0Bwnm2+DKqViEpeEpOq0m8= -cloud.google.com/go/vpcaccess v1.6.0/go.mod h1:wX2ILaNhe7TlVa4vC5xce1bCnqE3AeH27RV31lnmZes= -cloud.google.com/go/vpcaccess v1.7.1/go.mod h1:FogoD46/ZU+JUBX9D606X21EnxiszYi2tArQwLY4SXs= -cloud.google.com/go/vpcaccess v1.7.2/go.mod h1:mmg/MnRHv+3e8FJUjeSibVFvQF1cCy2MsFaFqxeY1HU= -cloud.google.com/go/vpcaccess v1.7.3/go.mod h1:YX4skyfW3NC8vI3Fk+EegJnlYFatA+dXK4o236EUCUc= -cloud.google.com/go/vpcaccess v1.7.4/go.mod h1:lA0KTvhtEOb/VOdnH/gwPuOzGgM+CWsmGu6bb4IoMKk= -cloud.google.com/go/vpcaccess v1.7.5/go.mod h1:slc5ZRvvjP78c2dnL7m4l4R9GwL3wDLcpIWz6P/ziig= -cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE= -cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= -cloud.google.com/go/webrisk v1.6.0/go.mod h1:65sW9V9rOosnc9ZY7A7jsy1zoHS5W9IAXv6dGqhMQMc= -cloud.google.com/go/webrisk v1.7.0/go.mod h1:mVMHgEYH0r337nmt1JyLthzMr6YxwN1aAIEc2fTcq7A= -cloud.google.com/go/webrisk v1.8.0/go.mod h1:oJPDuamzHXgUc+b8SiHRcVInZQuybnvEW72PqTc7sSg= -cloud.google.com/go/webrisk v1.9.1/go.mod h1:4GCmXKcOa2BZcZPn6DCEvE7HypmEJcJkr4mtM+sqYPc= -cloud.google.com/go/webrisk v1.9.2/go.mod h1:pY9kfDgAqxUpDBOrG4w8deLfhvJmejKB0qd/5uQIPBc= -cloud.google.com/go/webrisk v1.9.3/go.mod h1:RUYXe9X/wBDXhVilss7EDLW9ZNa06aowPuinUOPCXH8= -cloud.google.com/go/webrisk v1.9.4/go.mod h1:w7m4Ib4C+OseSr2GL66m0zMBywdrVNTDKsdEsfMl7X0= -cloud.google.com/go/webrisk v1.9.5/go.mod h1:aako0Fzep1Q714cPEM5E+mtYX8/jsfegAuS8aivxy3U= -cloud.google.com/go/websecurityscanner v1.3.0/go.mod h1:uImdKm2wyeXQevQJXeh8Uun/Ym1VqworNDlBXQevGMo= -cloud.google.com/go/websecurityscanner v1.4.0/go.mod h1:ebit/Fp0a+FWu5j4JOmJEV8S8CzdTkAS77oDsiSqYWQ= -cloud.google.com/go/websecurityscanner v1.5.0/go.mod h1:Y6xdCPy81yi0SQnDY1xdNTNpfY1oAgXUlcfN3B3eSng= -cloud.google.com/go/websecurityscanner v1.6.1/go.mod h1:Njgaw3rttgRHXzwCB8kgCYqv5/rGpFCsBOvPbYgszpg= -cloud.google.com/go/websecurityscanner v1.6.2/go.mod h1:7YgjuU5tun7Eg2kpKgGnDuEOXWIrh8x8lWrJT4zfmas= -cloud.google.com/go/websecurityscanner v1.6.3/go.mod h1:x9XANObUFR+83Cya3g/B9M/yoHVqzxPnFtgF8yYGAXw= -cloud.google.com/go/websecurityscanner v1.6.4/go.mod h1:mUiyMQ+dGpPPRkHgknIZeCzSHJ45+fY4F52nZFDHm2o= -cloud.google.com/go/websecurityscanner v1.6.5/go.mod h1:QR+DWaxAz2pWooylsBF854/Ijvuoa3FCyS1zBa1rAVQ= -cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= -cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cloud.google.com/go/workflows v1.8.0/go.mod h1:ysGhmEajwZxGn1OhGOGKsTXc5PyxOc0vfKf5Af+to4M= -cloud.google.com/go/workflows v1.9.0/go.mod h1:ZGkj1aFIOd9c8Gerkjjq7OW7I5+l6cSvT3ujaO/WwSA= -cloud.google.com/go/workflows v1.10.0/go.mod h1:fZ8LmRmZQWacon9UCX1r/g/DfAXx5VcPALq2CxzdePw= -cloud.google.com/go/workflows v1.11.1/go.mod h1:Z+t10G1wF7h8LgdY/EmRcQY8ptBD/nvofaL6FqlET6g= -cloud.google.com/go/workflows v1.12.0/go.mod h1:PYhSk2b6DhZ508tj8HXKaBh+OFe+xdl0dHF/tJdzPQM= -cloud.google.com/go/workflows v1.12.1/go.mod h1:5A95OhD/edtOhQd/O741NSfIMezNTbCwLM1P1tBRGHM= -cloud.google.com/go/workflows v1.12.2/go.mod h1:+OmBIgNqYJPVggnMo9nqmizW0qEXHhmnAzK/CnBqsHc= -cloud.google.com/go/workflows v1.12.3/go.mod h1:fmOUeeqEwPzIU81foMjTRQIdwQHADi/vEr1cx9R1m5g= -cloud.google.com/go/workflows v1.12.4/go.mod h1:yQ7HUqOkdJK4duVtMeBCAOPiN1ZF1E9pAMX51vpwB/w= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -gioui.org v0.0.0-20210308172011-57750fc8a0a6/go.mod h1:RSH6KIUZ0p2xy5zHDxgAM4zumjgTw83q2ge/PI+yyw8= -git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk= github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= -github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= -github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM= -github.com/alecthomas/assert/v2 v2.2.2/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= -github.com/alecthomas/assert/v2 v2.3.0/go.mod h1:pXcQ2Asjp247dahGEmsZ6ru0UVwnkhktn7S0bBDLxvQ= -github.com/alecthomas/participle/v2 v2.0.0/go.mod h1:rAKZdJldHu8084ojcWevWAL8KmEU+AT+Olodb+WoN2Y= -github.com/alecthomas/participle/v2 v2.1.0/go.mod h1:Y1+hAs8DHPmc3YUFzqllV+eSQ9ljPTk0ZkPMtEdAx2c= -github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= -github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= -github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0Ih0vcRo/gZ1M0= -github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4xei5aX110hRiI= -github.com/apache/arrow/go/v12 v12.0.0/go.mod h1:d+tV/eHZZ7Dz7RPrFKtPK02tpr+c9/PEd/zm8mDS9Vg= -github.com/apache/arrow/go/v12 v12.0.1/go.mod h1:weuTY7JvTG/HDPtMQxEUp7pU73vkLWMLpY67QwZ/WWw= -github.com/apache/arrow/go/v14 v14.0.2/go.mod h1:u3fgh3EdgN/YQ8cVQRguVW3R+seMybFg8QBQ5LU+eBY= -github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU= -github.com/apache/thrift v0.17.0/go.mod h1:OLxhMRJxomX+1I/KUw03qoV3mMz16BwaKI+d4fPBx7Q= -github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= -github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/logex v1.2.0/go.mod h1:9+9sk7u7pGNWYMkh0hdiL++6OeibzJccyQU4p4MedaY= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/readline v1.5.0/go.mod h1:x22KAscuvRqlLoK9CsoYsmxoXZMMFVyOl86cAH8qUic= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20220314180256-7f1daf1720fc/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230105202645-06c439db220b/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230310173818-32f1caf87195/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230428030218-4003588d1b74/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20231109132714-523115ebc101/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= -github.com/cncf/xds/go v0.0.0-20240318125728-8a4994d93e50/go.mod h1:5e1+Vvlzido69INQaVO6d87Qn543Xr6nooe9Kz7oBFM= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/go-control-plane v0.10.3/go.mod h1:fJJn/j26vwOu972OllsvAgJJM//w9BV6Fxbg2LuVd34= -github.com/envoyproxy/go-control-plane v0.11.0/go.mod h1:VnHyVMpzcLvCFt9yUz1UnCwHLhwx1WguiVDV7pTG/tI= -github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f/go.mod h1:sfYdkwUW4BA3PbKjySwjJy+O4Pu0h62rlqCMHNk+K+Q= -github.com/envoyproxy/go-control-plane v0.11.1/go.mod h1:uhMcXKCQMEJHiAb0w+YGefQLaTEw+YhGluxZkrTmD0g= -github.com/envoyproxy/go-control-plane v0.12.0/go.mod h1:ZBTaoJ23lqITozF0M6G4/IragXCQKCnYbmlmtHvwRG0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= -github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0++PMirau2/yoOwVac3AbF2w= -github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= -github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= -github.com/envoyproxy/protoc-gen-validate v1.0.1/go.mod h1:0vj8bNkYbSTNS2PIyH87KZaeN4x9zpL9Qt8fQC7d+vs= -github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= -github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= -github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= -github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= -github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g= -github.com/go-fonts/latin-modern v0.2.0/go.mod h1:rQVLdDMK+mK1xscDwsqM5J8U2jrRa3T0ecnM9pNujks= -github.com/go-fonts/liberation v0.1.1/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= -github.com/go-fonts/liberation v0.2.0/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= -github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmnUIzUY= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-latex/latex v0.0.0-20210118124228-b3d85cf34e07/go.mod h1:CO1AlKB2CSIqUrmQPqA0gdRIlnLEY0gK5JGjh37zN5U= -github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpxhq9o2S/CELCSUxEWWAuoCUcVCQWv7G2OCk= -github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= -github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= -github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/goccy/go-yaml v1.9.8/go.mod h1:JubOolP3gh0HpiBc4BLRD4YmjEjHAmIIB2aaXKkTfoE= -github.com/goccy/go-yaml v1.11.0/go.mod h1:H+mJrWtjPTJAHvRbV09MCK9xYwODM+wRTVFFTWckfng= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= -github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= -github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/flatbuffers v2.0.8+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/flatbuffers v23.5.26+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-pkcs11 v0.2.0/go.mod h1:6eQoGcuNJpa7jnd5pMGdkSaQpNDYvPlXWMcjXXThLlY= -github.com/google/go-pkcs11 v0.2.1-0.20230907215043-c6f79328ddf9/go.mod h1:6eQoGcuNJpa7jnd5pMGdkSaQpNDYvPlXWMcjXXThLlY= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/s2a-go v0.1.0/go.mod h1:OJpEgntRZo8ugHpF9hkoLJbS5dSI20XZeXJ9JVywLlM= -github.com/google/s2a-go v0.1.3/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= -github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= -github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= -github.com/googleapis/enterprise-certificate-proxy v0.2.1/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= -github.com/googleapis/enterprise-certificate-proxy v0.2.5/go.mod h1:RxW0N9901Cko1VOCW3SXCpWP+mlIEkk2tP7jnHy9a3w= -github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= -github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= -github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= -github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= -github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= -github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= -github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= -github.com/googleapis/gax-go/v2 v2.7.1/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= -github.com/googleapis/gax-go/v2 v2.8.0/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= -github.com/googleapis/gax-go/v2 v2.10.0/go.mod h1:4UOEnMCrxsSqQ940WnTiD6qJ63le2ev3xfyagutxiPw= -github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= -github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= -github.com/googleapis/gax-go/v2 v2.12.1/go.mod h1:61M8vcyyXR2kqKFxKrfA22jaA8JGF7Dc8App1U3H6jc= -github.com/googleapis/gax-go/v2 v2.12.2/go.mod h1:61M8vcyyXR2kqKFxKrfA22jaA8JGF7Dc8App1U3H6jc= -github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= -github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= -github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE= -github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= -github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= -github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= -github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= -github.com/lyft/protoc-gen-star/v2 v2.0.1/go.mod h1:RcCdONR2ScXaYnQC5tUzxzlpA3WVYF7/opLeUgcQs/o= -github.com/lyft/protoc-gen-star/v2 v2.0.3/go.mod h1:amey7yeodaJhXSbf/TlLvWiqQfLOSpEk//mLlc+axEk= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= -github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= -github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY= -github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= -github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= -github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= -github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= -github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= -github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= -github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.3.3/go.mod h1:5KUK8ByomD5Ti5Artl0RtHeI5pTF7MIDuXL3yY520V4= -github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= -github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= -github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= -github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/substrait-io/substrait-go v0.4.2/go.mod h1:qhpnLmrcvAnlZsUyPXZRqldiHapPTXC3t7xFgDi3aQg= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= -github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= -go.einride.tech/aip v0.66.0/go.mod h1:qAhMsfT7plxBX+Oy7Huol6YUvZ0ZzdUz26yZsQwfl1M= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0/go.mod h1:r9vWsPS/3AQItv3OSlEJ/E4mbrhUbbw18meOjArPtKQ= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.48.0/go.mod h1:tIKj3DbO8N9Y2xo52og3irLsPI4GW02DSMtrVgNMgxg= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0/go.mod h1:Mjt1i1INqiaoZOMGR1RIUJN+i3ChKoFRqzrRQhlkbs0= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.48.0/go.mod h1:rdENBZMT2OE6Ne/KLwpiXudnAsbdrdBaqBvTN8M8BgA= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= -go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= -go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= -go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= -go.opentelemetry.io/otel v1.23.0/go.mod h1:YCycw9ZeKhcJFrb34iVSkyT0iczq/zYDtZYFufObyB0= -go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= -go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= -go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= -go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= -go.opentelemetry.io/otel/metric v1.23.0/go.mod h1:MqUW2X2a6Q8RN96E2/nqNoT+z9BSms20Jb7Bbp+HiTo= -go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= -go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= -go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= -go.opentelemetry.io/otel/sdk v1.22.0/go.mod h1:iu7luyVGYovrRpe2fmj3CVKouQNdTOkxtLzPvPz1DOc= -go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= -go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= -go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= -go.opentelemetry.io/otel/trace v1.23.0/go.mod h1:GSGTbIClEsuZrGIzoEHqsVfxgn5UkggkflQwDScNUsk= -go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= -go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= -golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= -golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3/go.mod h1:NOZ3BPKG0ec/BKJQgnvsSFpcKLM5xXVWnvZS97DWHgE= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20220827204233-334a2380cb91/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE= -golang.org/x/exp v0.0.0-20230206171751-46f607a40771/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= -golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200618115811-c13761719519/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20210216034530-4410531fe030/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/image v0.0.0-20220302094943-723b81ca9867/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= -golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= -golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= -golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= -golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec= -golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= -golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= -golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= -golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= -golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= -golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= -golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0= -golang.org/x/oauth2 v0.14.0/go.mod h1:lAtNWgaWfL4cm7j2OV8TxGi9Qb7ECORx8DktCY74OwM= -golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= -golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o= -golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= -golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220406163625-3f8b81556e12/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220624220833-87e55d714810/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= -golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= -golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= -golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= -golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190927191325-030b2cf1153e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= -golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= -golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= -golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= -golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= -gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= -gonum.org/v1/gonum v0.9.3/go.mod h1:TZumC3NeyVQskjXqmyWt4S3bINhy7B4eYwW69EbyX+0= -gonum.org/v1/gonum v0.11.0/go.mod h1:fSG4YDCxxUZQJ7rKsQrj0gMOg00Il0Z96/qMA4bVQhA= -gonum.org/v1/gonum v0.12.0/go.mod h1:73TDxJfAAHeA8Mk9mf8NlIppyhQNo5GLTcYeqgo2lvY= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= -gonum.org/v1/plot v0.9.0/go.mod h1:3Pcqqmp6RHvJI72kgb8fThyUnav364FOsdDo2aGW5lY= -gonum.org/v1/plot v0.10.1/go.mod h1:VZW5OlhkL1mysU9vaqNHnsy86inf6Ot+jB3r+BczCEo= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/api v0.41.0/go.mod h1:RkxM5lITDfTzmyKFPt+wGrCJbVfniCr2ool8kTBzRTU= -google.golang.org/api v0.43.0/go.mod h1:nQsDGjRXMo4lvh5hP0TKqF244gqhGcr/YSIykhUk/94= -google.golang.org/api v0.47.0/go.mod h1:Wbvgpq1HddcWVtzsVLyfLp8lDg6AA241LmgIL59tHXo= -google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtukyy4= -google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw= -google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= -google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= -google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= -google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= -google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= -google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= -google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= -google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= -google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= -google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= -google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= -google.golang.org/api v0.77.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= -google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= -google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= -google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= -google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g= -google.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= -google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= -google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI= -google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= -google.golang.org/api v0.99.0/go.mod h1:1YOf74vkVndF7pG6hIHuINsM7eWwpVTAfNMNiL91A08= -google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.102.0/go.mod h1:3VFl6/fzoA+qNuS1N1/VfXY4LjoXN/wzeIp7TweWwGo= -google.golang.org/api v0.103.0/go.mod h1:hGtW6nK1AC+d9si/UBhw8Xli+QMOf6xyNAyJw4qU9w0= -google.golang.org/api v0.106.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= -google.golang.org/api v0.107.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= -google.golang.org/api v0.108.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/O9MY= -google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= -google.golang.org/api v0.111.0/go.mod h1:qtFHvU9mhgTJegR31csQ+rwxyUTHOKFqCKWp1J0fdw0= -google.golang.org/api v0.114.0/go.mod h1:ifYI2ZsFK6/uGddGfAD5BMxlnkBqCmqHSDUVi45N5Yg= -google.golang.org/api v0.118.0/go.mod h1:76TtD3vkgmZ66zZzp72bUUklpmQmKlhh6sYtIjYK+5E= -google.golang.org/api v0.122.0/go.mod h1:gcitW0lvnyWjSp9nKxAbdHKIZ6vF4aajGueeslZOyms= -google.golang.org/api v0.124.0/go.mod h1:xu2HQurE5gi/3t1aFCvhPD781p0a3p11sdunTJ2BlP4= -google.golang.org/api v0.125.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= -google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= -google.golang.org/api v0.128.0/go.mod h1:Y611qgqaE92On/7g65MQgxYul3c0rEB894kniWLY750= -google.golang.org/api v0.139.0/go.mod h1:CVagp6Eekz9CjGZ718Z+sloknzkDJE7Vc1Ckj9+viBk= -google.golang.org/api v0.149.0/go.mod h1:Mwn1B7JTXrzXtnvmzQE2BD6bYZQ8DShKZDZbeN9I7qI= -google.golang.org/api v0.150.0/go.mod h1:ccy+MJ6nrYFgE3WgRx/AMXOxOmU8Q4hSa+jjibzhxcg= -google.golang.org/api v0.155.0/go.mod h1:GI5qK5f40kCpHfPn6+YzGAByIKWv8ujFnmoWm7Igduk= -google.golang.org/api v0.157.0/go.mod h1:+z4v4ufbZ1WEpld6yMGHyggs+PmAHiaLNj5ytP3N01g= -google.golang.org/api v0.160.0/go.mod h1:0mu0TpK33qnydLvWqbImq2b1eQ5FHRSDCBzAxX9ZHyw= -google.golang.org/api v0.162.0/go.mod h1:6SulDkfoBIg4NFmCuZ39XeeAgSHCPecfSUuDyYlAHs0= -google.golang.org/api v0.164.0/go.mod h1:2OatzO7ZDQsoS7IFf3rvsE17/TldiU3F/zxFHeqUB5o= -google.golang.org/api v0.166.0/go.mod h1:4FcBc686KFi7QI/U51/2GKKevfZMpM17sCdibqe/bSA= -google.golang.org/api v0.169.0/go.mod h1:gpNOiMA2tZ4mf5R9Iwf4rK/Dcz0fbdIgWYWVoxmsyLg= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210222152913-aa3ee6e6a81c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210303154014-9728d6b83eeb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210329143202-679c6ae281ee/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= -google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= -google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210713002101-d411969a0d9a/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210716133855-ce7ef5c701ea/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= -google.golang.org/genproto v0.0.0-20210728212813-7823e685a01f/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210805201207-89edb61ffb67/go.mod h1:ob2IJxKrgPT52GcgX759i1sleT07tiKowYBGbczaW48= -google.golang.org/genproto v0.0.0-20210813162853-db860fec028c/go.mod h1:cFeNkxwySK631ADgubI+/XFU/xp8FD5KIVV4rj8UC5w= -google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= -google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220207164111-0872dc986b00/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= -google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= -google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= -google.golang.org/genproto v0.0.0-20220329172620-7be39ac1afc7/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= -google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220722212130-b98a9ff5e252/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE= -google.golang.org/genproto v0.0.0-20220801145646-83ce21fca29f/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= -google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220817144833-d7fd3f11b9b1/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220829144015-23454907ede3/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= -google.golang.org/genproto v0.0.0-20220913154956-18f8339a66a5/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220914142337-ca0e39ece12f/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220916172020-2692e8806bfa/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= -google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw= -google.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= -google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= -google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= -google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= -google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= -google.golang.org/genproto v0.0.0-20221024153911-1573dae28c9c/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c/go.mod h1:CGI5F/G+E5bKwmfYo09AXuVN4dD894kIKUFmVbP2/Fo= -google.golang.org/genproto v0.0.0-20221109142239-94d6d90a7d66/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221117204609-8f9c96812029/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221201204527-e3fa12d562f3/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg= -google.golang.org/genproto v0.0.0-20221202195650-67e5cbc046fd/go.mod h1:cTsE614GARnxrLsqKREzmNYJACSWWpAWdNMwnD7c2BE= -google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230112194545-e10362b5ecf9/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230113154510-dbe35b8444a5/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230123190316-2c411cf9d197/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230124163310-31e0e69b6fc2/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230125152338-dcaf20b6aeaa/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230127162408-596548ed4efa/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230209215440-0dfe4f8abfcc/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= -google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44/go.mod h1:8B0gmkoRebU8ukX6HP+4wrVQUY1+6PkQ44BSyIlflHA= -google.golang.org/genproto v0.0.0-20230222225845-10f96fb3dbec/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw= -google.golang.org/genproto v0.0.0-20230223222841-637eb2293923/go.mod h1:3Dl5ZL0q0isWJt+FVcfpQyirqemEuLAK/iFvg1UP1Hw= -google.golang.org/genproto v0.0.0-20230303212802-e74f57abe488/go.mod h1:TvhZT5f700eVlTNwND1xoEZQeWTB2RY/65kplwl/bFA= -google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/genproto v0.0.0-20230320184635-7606e756e683/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s= -google.golang.org/genproto v0.0.0-20230323212658-478b75c54725/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230330154414-c0448cd141ea/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230331144136-dcfb400f0633/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230403163135-c38d8f061ccd/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= -google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/genproto v0.0.0-20230525234025-438c736192d0/go.mod h1:9ExIQyXL5hZrHzQceCwuSYwZZ5QZBazOcprJ5rgs3lY= -google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54/go.mod h1:zqTuNwFlFRsw5zIts5VnzLQxSRqh+CGOTVMlYbY0Eyk= -google.golang.org/genproto v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:zqTuNwFlFRsw5zIts5VnzLQxSRqh+CGOTVMlYbY0Eyk= -google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= -google.golang.org/genproto v0.0.0-20230629202037-9506855d4529/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= -google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:O9kGHb51iE/nOGvQaDUuadVYqovW56s5emA88lQnj6Y= -google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98/go.mod h1:S7mY02OqCJTD0E1OiQy1F72PWFB4bZJ87cAtLPYgDR0= -google.golang.org/genproto v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:0ggbjUrZYpy1q+ANUS30SEoGZ53cdfwtbuG7Ptgy108= -google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5/go.mod h1:oH/ZOT02u4kWEp7oYBGYFFkCdKS/uYR9Z7+0/xuuFp8= -google.golang.org/genproto v0.0.0-20230821184602-ccc8af3d0e93/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:CCviP9RmpZ1mxVr8MUjCnSiY09IbAXZxhLE6EhHIdPU= -google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97/go.mod h1:t1VqOqqvce95G3hIDCT5FeO3YUc6Q4Oe24L/+rNMxRk= -google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:EMfReVxb80Dq1hhioy0sOsY9jCE46YDgHlJ7fWVUWRE= -google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:CgAqfJo+Xmu0GwA0411Ht3OU3OntXwsGmrmjI8ioGXI= -google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405/go.mod h1:3WDQMjmJk36UQhjQ89emUzb1mdaHcPeeAh4SCBKznB4= -google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:J7XzRzVy1+IPwWHZUzoD0IccYZIrXILAQpc+Qy9CMhY= -google.golang.org/genproto v0.0.0-20231120223509-83a465c0220f/go.mod h1:nWSwAFPb+qfNJXsoeO3Io7zf4tMSfN8EA8RlDA04GhY= -google.golang.org/genproto v0.0.0-20231211222908-989df2bf70f3/go.mod h1:5RBcpGRxr25RbDzY5w+dmaqpSEvl8Gwl1x2CICf60ic= -google.golang.org/genproto v0.0.0-20231212172506-995d672761c0/go.mod h1:l/k7rMz0vFTBPy+tFSGvXEd3z+BcoG1k7EHbqm+YBsY= -google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917/go.mod h1:pZqR+glSb11aJ+JQcczCvgf47+duRuzNSKqE8YAQnV0= -google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:+Rvu7ElI+aLzyDQhpHMFMMltsD6m7nqpuWDd2CwJw3k= -google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80/go.mod h1:cc8bqMqtv9gMOr0zHg2Vzff5ULhhL2IXP4sbcn32Dro= -google.golang.org/genproto v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:cc8bqMqtv9gMOr0zHg2Vzff5ULhhL2IXP4sbcn32Dro= -google.golang.org/genproto v0.0.0-20240205150955-31a09d347014/go.mod h1:xEgQu1e4stdSSsxPDK8Azkrk/ECl5HvdPf6nbZrTS5M= -google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= -google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s= -google.golang.org/genproto/googleapis/api v0.0.0-20230525234020-1aefcd67740a/go.mod h1:ts19tUU+Z0ZShN1y3aPyq2+O3d5FUNNgT6FtOzmrNn8= -google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20230629202037-9506855d4529/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= -google.golang.org/genproto/googleapis/api v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:mPBs5jNgx2GuQGvFwUvVKqtn6HsUw9nP64BedgvqEsQ= -google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= -google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e/go.mod h1:rsr7RhLuwsDKL7RmgDDCUc6yaGr1iqceVb5Wv6f6YvQ= -google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5/go.mod h1:5DZzOUPCLYL3mNkQ0ms0F3EuUNZ7py1Bqeq6sxzI7/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:RdyHbowztCGQySiCvQPgWQWgWhGnouTdCflKoDBt32U= -google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= -google.golang.org/genproto/googleapis/api v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:SUBoKXbI1Efip18FClrQVGjWcyd0QZd8KkvdP34t7ww= -google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:IBQ646DjkDkvUIsVq/cc03FUFQ9wbZu7yE396YcL870= -google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405/go.mod h1:oT32Z4o8Zv2xPQTg0pbVaPr0MPOH6f14RgXt7zfIpwg= -google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:0xJLfVdJqpAPl8tDg1ujOCGzx6LFLttXT5NhllGOXY4= -google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f/go.mod h1:Uy9bTZJqmfrw2rIBxgGLnamc78euZULUBrLZ9XTITKI= -google.golang.org/genproto/googleapis/api v0.0.0-20231211222908-989df2bf70f3/go.mod h1:k2dtGpRrbsSyKcNPKKI5sstZkrNCZwpU/ns96JoHbGg= -google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0/go.mod h1:CAny0tYF+0/9rmDB9fahA9YLzX3+AEVl1qXbv5hhj6c= -google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917/go.mod h1:CmlNWB9lSezaYELKS5Ym1r44VrrbPUa7JTvw+6MbpJ0= -google.golang.org/genproto/googleapis/api v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:B5xPO//w8qmBDjGReYLpR6UJPnkldGkCSMoH/2vxJeg= -google.golang.org/genproto/googleapis/api v0.0.0-20240122161410-6c6643bf1457/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA= -google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA= -google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA= -google.golang.org/genproto/googleapis/api v0.0.0-20240205150955-31a09d347014/go.mod h1:rbHMSEDyoYX62nRVLOCc4Qt1HbsdytAYoVwgjiOhF3I= -google.golang.org/genproto/googleapis/api v0.0.0-20240221002015-b0ce06bbee7c/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= -google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2/go.mod h1:O1cOfN1Cy6QEYr7VxtjOyP5AdAuR0aJ/MYZaaof623Y= -google.golang.org/genproto/googleapis/api v0.0.0-20240318140521-94a12d6c2237/go.mod h1:Z5Iiy3jtmioajWHDGFk7CeugTyHtPvMHA4UTmUkyalE= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20230807174057-1744710a1577/go.mod h1:NjCQG/D8JandXxM57PZbAJL1DCNL6EypA0vPPwfsc7c= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20231030173426-d783a09b4405/go.mod h1:GRUCuLdzVqZte8+Dl/D4N25yLzcGqqWaYkeVOwulFqw= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20231212172506-995d672761c0/go.mod h1:guYXGPwC6jwxgWKW5Y405fKWOFNwlvUlUnzyp9i0uqo= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:ZSvZ8l+AWJwXw91DoTjWjaVLpWU6o0eZ4YLYpH8aLeQ= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:SCz6T5xjNXM4QFPRwxHcfChp7V+9DcXR3ay2TkHR8Tg= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20240205150955-31a09d347014/go.mod h1:EhZbXt+eY4Yr3YVaEGLdNZF5viWowOJZ8KTPqjYMKzg= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:om8Bj876Z0v9ei+RD1LnEWig7vpHQ371PUqsgjmLQEA= -google.golang.org/genproto/googleapis/bytestream v0.0.0-20240304161311-37d4d3c04a78/go.mod h1:vh/N7795ftP0AkN1w8XKqN4w1OdUKXW5Eummda+ofv8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234015-3fc162c6f38a/go.mod h1:xURIpW9ES5+/GZhnV6beoEtxQrnkRGIfP5VQG2tCBLc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230526203410-71b5a4ffd15e/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:8mL13HKkDa+IuJ8yruA3ci0q+0vsUz4m//+ottjwS5o= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920183334-c177e329c48b/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:4cYg8o5yUbm77w8ZX00LhMVNl/YVBFJRYWDc0uYWMs0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405/go.mod h1:67X1fPuzjcrkymZzZV1vvkFeTn2Rvc6lYF9MYFGCcwE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f/go.mod h1:L9KNLi232K1/xB6f7AlSX692koaRnKaWSR0stBki0Yc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231211222908-989df2bf70f3/go.mod h1:eJVxU6o+4G1PSczBr85xmyvSNYAKvAYgkub40YGomFM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0/go.mod h1:FUoWkonphQm3RhTS+kOEhF8h0iDpm4tdXolVCeZ9KKA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917/go.mod h1:xtjpI3tXFPP051KaWnhvxkiubL/6dJ18vLVf7q2pTOU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240122161410-6c6643bf1457/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240205150955-31a09d347014/go.mod h1:SaPjaZGWb0lPqs6Ittu0spdfrOArqji4ZdeP5IC/9N4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:YUWgXUFRPfoYK1IHMuxH5K6nPEXSCzIMljnQ59lLRCk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240221002015-b0ce06bbee7c/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240228201840-1f18d85a4ec2/go.mod h1:UCOku4NytXMJuLQE5VuqA5lX3PcHCBo8pxNyvkf4xBs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240228224816-df926f6c8641/go.mod h1:UCOku4NytXMJuLQE5VuqA5lX3PcHCBo8pxNyvkf4xBs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240304161311-37d4d3c04a78/go.mod h1:UCOku4NytXMJuLQE5VuqA5lX3PcHCBo8pxNyvkf4xBs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 h1:NnYq6UN9ReLM9/Y01KWNOWyI5xQ9kbIms5GGJVwS/Yc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= -google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= -google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= -google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= -google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= -google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= -google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= -google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= -google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= -google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= -google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= -google.golang.org/grpc v1.60.1/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM= -google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= -google.golang.org/grpc v1.61.1/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= -google.golang.org/grpc v1.62.0/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= -google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= -google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY= -google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg= -google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3 h1:fvjTMHxHEw/mxHbtzPi3JCcKXQRAnQTBRo6YCJSVHKI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -lukechampine.com/uint128 v1.3.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -modernc.org/cc/v3 v3.36.0/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= -modernc.org/cc/v3 v3.36.2/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= -modernc.org/cc/v3 v3.36.3/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI= -modernc.org/cc/v3 v3.37.0/go.mod h1:vtL+3mdHx/wcj3iEGz84rQa8vEqR6XM84v5Lcvfph20= -modernc.org/cc/v3 v3.38.1/go.mod h1:vtL+3mdHx/wcj3iEGz84rQa8vEqR6XM84v5Lcvfph20= -modernc.org/cc/v3 v3.40.0/go.mod h1:/bTg4dnWkSXowUO6ssQKnOV0yMVxDYNIsIrzqTFDGH0= -modernc.org/ccgo/v3 v3.0.0-20220428102840-41399a37e894/go.mod h1:eI31LL8EwEBKPpNpA4bU1/i+sKOwOrQy8D87zWUcRZc= -modernc.org/ccgo/v3 v3.0.0-20220430103911-bc99d88307be/go.mod h1:bwdAnOoaIt8Ax9YdWGjxWsdkPcZyRPHqrOvJxaKAKGw= -modernc.org/ccgo/v3 v3.0.0-20220904174949-82d86e1b6d56/go.mod h1:YSXjPL62P2AMSxBphRHPn7IkzhVHqkvOnRKAKh+W6ZI= -modernc.org/ccgo/v3 v3.0.0-20220910160915-348f15de615a/go.mod h1:8p47QxPkdugex9J4n9P2tLZ9bK01yngIVp00g4nomW0= -modernc.org/ccgo/v3 v3.16.4/go.mod h1:tGtX0gE9Jn7hdZFeU88slbTh1UtCYKusWOoCJuvkWsQ= -modernc.org/ccgo/v3 v3.16.6/go.mod h1:tGtX0gE9Jn7hdZFeU88slbTh1UtCYKusWOoCJuvkWsQ= -modernc.org/ccgo/v3 v3.16.8/go.mod h1:zNjwkizS+fIFDrDjIAgBSCLkWbJuHF+ar3QRn+Z9aws= -modernc.org/ccgo/v3 v3.16.9/go.mod h1:zNMzC9A9xeNUepy6KuZBbugn3c0Mc9TeiJO4lgvkJDo= -modernc.org/ccgo/v3 v3.16.13-0.20221017192402-261537637ce8/go.mod h1:fUB3Vn0nVPReA+7IG7yZDfjv1TMWjhQP8gCxrFAtL5g= -modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY= -modernc.org/ccorpus v1.11.6/go.mod h1:2gEUTrWqdpH2pXsmTM1ZkjeSrUWDpjMu2T6m29L/ErQ= -modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= -modernc.org/libc v0.0.0-20220428101251-2d5f3daf273b/go.mod h1:p7Mg4+koNjc8jkqwcoFBJx7tXkpj00G77X7A72jXPXA= -modernc.org/libc v1.16.0/go.mod h1:N4LD6DBE9cf+Dzf9buBlzVJndKr/iJHG97vGLHYnb5A= -modernc.org/libc v1.16.1/go.mod h1:JjJE0eu4yeK7tab2n4S1w8tlWd9MxXLRzheaRnAKymU= -modernc.org/libc v1.16.17/go.mod h1:hYIV5VZczAmGZAnG15Vdngn5HSF5cSkbvfz2B7GRuVU= -modernc.org/libc v1.16.19/go.mod h1:p7Mg4+koNjc8jkqwcoFBJx7tXkpj00G77X7A72jXPXA= -modernc.org/libc v1.17.0/go.mod h1:XsgLldpP4aWlPlsjqKRdHPqCxCjISdHfM/yeWC5GyW0= -modernc.org/libc v1.17.1/go.mod h1:FZ23b+8LjxZs7XtFMbSzL/EhPxNbfZbErxEHc7cbD9s= -modernc.org/libc v1.17.4/go.mod h1:WNg2ZH56rDEwdropAJeZPQkXmDwh+JCA1s/htl6r2fA= -modernc.org/libc v1.18.0/go.mod h1:vj6zehR5bfc98ipowQOM2nIDUZnVew/wNC/2tOGS+q0= -modernc.org/libc v1.19.0/go.mod h1:ZRfIaEkgrYgZDl6pa4W39HgN5G/yDW+NRmNKZBDFrk0= -modernc.org/libc v1.20.3/go.mod h1:ZRfIaEkgrYgZDl6pa4W39HgN5G/yDW+NRmNKZBDFrk0= -modernc.org/libc v1.21.2/go.mod h1:przBsL5RDOZajTVslkugzLBj1evTue36jEomFQOoYuI= -modernc.org/libc v1.21.4/go.mod h1:przBsL5RDOZajTVslkugzLBj1evTue36jEomFQOoYuI= -modernc.org/libc v1.22.2/go.mod h1:uvQavJ1pZ0hIoC/jfqNoMLURIMhKzINIWypNM17puug= -modernc.org/libc v1.22.4/go.mod h1:jj+Z7dTNX8fBScMVNRAYZ/jF91K8fdT2hYMThc3YjBY= -modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/memory v1.1.1/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw= -modernc.org/memory v1.2.0/go.mod h1:/0wo5ibyrQiaoUoH7f9D8dnglAmILJ5/cxZlRECf+Nw= -modernc.org/memory v1.2.1/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/memory v1.3.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/memory v1.4.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= -modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.18.1/go.mod h1:6ho+Gow7oX5V+OiOQ6Tr4xeqbx13UZ6t+Fw9IRUG4d4= -modernc.org/sqlite v1.18.2/go.mod h1:kvrTLEWgxUcHa2GfHBQtanR1H9ht3hTJNtKpzH9k1u0= -modernc.org/sqlite v1.21.2/go.mod h1:cxbLkB5WS32DnQqeH4h4o1B0eMr8W/y8/RGuxQ3JsC0= -modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= -modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= -modernc.org/tcl v1.13.1/go.mod h1:XOLfOwzhkljL4itZkK6T72ckMgvj0BDsnKNdZVUOecw= -modernc.org/tcl v1.13.2/go.mod h1:7CLiGIPo1M8Rv1Mitpv5akc2+8fxUd2y2UzC/MfMzy0= -modernc.org/tcl v1.15.1/go.mod h1:aEjeGJX2gz1oWKOLDVZ2tnEWLUrIn8H+GFu+akoDhqs= -modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/token v1.0.1/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/z v1.5.1/go.mod h1:eWFB510QWW5Th9YGZT81s+LwvaAs3Q2yr4sP0rmLkv8= -modernc.org/z v1.7.0/go.mod h1:hVdgNMh8ggTuRG1rGU8x+xGRFfiQUIAw0ZqlPy8+HyQ= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/gosnappi/gosnappi.go b/gosnappi/gosnappi.go index 83292dd3..a2b4bc1c 100644 --- a/gosnappi/gosnappi.go +++ b/gosnappi/gosnappi.go @@ -23425,10 +23425,10 @@ type MetricsResponse interface { setChoice(value MetricsResponseChoiceEnum) MetricsResponse // HasChoice checks if Choice has been set in MetricsResponse HasChoice() bool - // getter for Dhcpv4Client to set choice. - Dhcpv4Client() // getter for Dhcpv4Server to set choice. Dhcpv4Server() + // getter for Dhcpv4Client to set choice. + Dhcpv4Client() // PortMetrics returns MetricsResponsePortMetricIterIter, set in MetricsResponse PortMetrics() MetricsResponsePortMetricIter // FlowMetrics returns MetricsResponseFlowMetricIterIter, set in MetricsResponse @@ -23487,16 +23487,16 @@ func (obj *metricsResponse) Choice() MetricsResponseChoiceEnum { return MetricsResponseChoiceEnum(obj.obj.Choice.Enum().String()) } -// 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) } +// getter for Dhcpv4Client to set choice +func (obj *metricsResponse) Dhcpv4Client() { + obj.setChoice(MetricsResponseChoice.DHCPV4_CLIENT) +} + // description is TBD // Choice returns a string func (obj *metricsResponse) HasChoice() bool { @@ -400635,14 +400635,14 @@ type BgpAttributesCommunity interface { Choice() BgpAttributesCommunityChoiceEnum // setChoice assigns BgpAttributesCommunityChoiceEnum provided by user to BgpAttributesCommunity setChoice(value BgpAttributesCommunityChoiceEnum) BgpAttributesCommunity - // getter for NoExportSubconfed to set choice. - NoExportSubconfed() // getter for LlgrStale to set choice. LlgrStale() - // getter for NoExport to set choice. - NoExport() + // getter for NoExportSubconfed to set choice. + NoExportSubconfed() // getter for NoAdvertised to set choice. NoAdvertised() + // getter for NoExport to set choice. + NoExport() // getter for NoLlgr to set choice. NoLlgr() // CustomCommunity returns BgpAttributesCustomCommunity, set in BgpAttributesCommunity. @@ -400679,19 +400679,14 @@ func (obj *bgpAttributesCommunity) Choice() BgpAttributesCommunityChoiceEnum { return BgpAttributesCommunityChoiceEnum(obj.obj.Choice.Enum().String()) } -// getter for NoExportSubconfed to set choice -func (obj *bgpAttributesCommunity) NoExportSubconfed() { - obj.setChoice(BgpAttributesCommunityChoice.NO_EXPORT_SUBCONFED) -} - // getter for LlgrStale to set choice func (obj *bgpAttributesCommunity) LlgrStale() { obj.setChoice(BgpAttributesCommunityChoice.LLGR_STALE) } -// 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) } // getter for NoAdvertised to set choice @@ -400699,6 +400694,11 @@ func (obj *bgpAttributesCommunity) NoAdvertised() { obj.setChoice(BgpAttributesCommunityChoice.NO_ADVERTISED) } +// getter for NoExport to set choice +func (obj *bgpAttributesCommunity) NoExport() { + obj.setChoice(BgpAttributesCommunityChoice.NO_EXPORT) +} + // getter for NoLlgr to set choice func (obj *bgpAttributesCommunity) NoLlgr() { obj.setChoice(BgpAttributesCommunityChoice.NO_LLGR) @@ -422981,16 +422981,16 @@ type BgpAttributesSrPolicyExplicitNullPolicy interface { setChoice(value BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum) BgpAttributesSrPolicyExplicitNullPolicy // HasChoice checks if Choice has been set in BgpAttributesSrPolicyExplicitNullPolicy HasChoice() bool - // getter for DonotPush to set choice. - DonotPush() - // getter for PushIpv4 to set choice. - PushIpv4() - // getter for PushIpv4AndIpv6 to set choice. - PushIpv4AndIpv6() // getter for Unknown to set choice. Unknown() // getter for PushIpv6 to set choice. PushIpv6() + // getter for DonotPush to set choice. + DonotPush() + // getter for PushIpv4AndIpv6 to set choice. + PushIpv4AndIpv6() + // getter for PushIpv4 to set choice. + PushIpv4() } type BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum string @@ -423014,29 +423014,29 @@ func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Choice() BgpAttributesSrPoli return BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum(obj.obj.Choice.Enum().String()) } +// getter for Unknown to set choice +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Unknown() { + obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.UNKNOWN) +} + +// 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 PushIpv4 to set choice -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) PushIpv4() { - obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV4) -} - // 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 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) } // The Explicit NULL Label policy. @@ -428848,12 +428848,12 @@ type FlowRSVPLspTunnelFlag interface { setChoice(value FlowRSVPLspTunnelFlagChoiceEnum) FlowRSVPLspTunnelFlag // HasChoice checks if Choice has been set in FlowRSVPLspTunnelFlag HasChoice() bool - // getter for LocalProtectionDesired to set choice. - LocalProtectionDesired() // getter for SeStyleDesired to set choice. SeStyleDesired() // getter for LabelRecordingDesired to set choice. LabelRecordingDesired() + // getter for LocalProtectionDesired to set choice. + LocalProtectionDesired() } type FlowRSVPLspTunnelFlagChoiceEnum string @@ -428873,11 +428873,6 @@ func (obj *flowRSVPLspTunnelFlag) Choice() FlowRSVPLspTunnelFlagChoiceEnum { return FlowRSVPLspTunnelFlagChoiceEnum(obj.obj.Choice.Enum().String()) } -// getter for LocalProtectionDesired to set choice -func (obj *flowRSVPLspTunnelFlag) LocalProtectionDesired() { - obj.setChoice(FlowRSVPLspTunnelFlagChoice.LOCAL_PROTECTION_DESIRED) -} - // getter for SeStyleDesired to set choice func (obj *flowRSVPLspTunnelFlag) SeStyleDesired() { obj.setChoice(FlowRSVPLspTunnelFlagChoice.SE_STYLE_DESIRED) @@ -428888,6 +428883,11 @@ func (obj *flowRSVPLspTunnelFlag) LabelRecordingDesired() { obj.setChoice(FlowRSVPLspTunnelFlagChoice.LABEL_RECORDING_DESIRED) } +// getter for LocalProtectionDesired to set choice +func (obj *flowRSVPLspTunnelFlag) LocalProtectionDesired() { + obj.setChoice(FlowRSVPLspTunnelFlagChoice.LOCAL_PROTECTION_DESIRED) +} + // description is TBD // Choice returns a string func (obj *flowRSVPLspTunnelFlag) HasChoice() bool { @@ -464096,10 +464096,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 @@ -464117,16 +464117,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/requirements.txt b/requirements.txt index f25de952..b8026cdf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,11 @@ --prefer-binary -grpcio~=1.35.0 ; python_version <= '3.6' -grpcio~=1.59.0 ; python_version > '3.6' -grpcio-tools~=1.59.0 ; python_version > '3.6' -grpcio-tools~=1.35.0 ; python_version <= '3.6' -requests +PyYAML protobuf~=3.15.0 ; python_version <= '3.6' protobuf~=4.24.4 ; python_version > '3.6' -PyYAML +requests +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' +grpcio-tools~=1.35.0 ; python_version <= '3.6' urllib3 semantic_version From ce3be618d3a1780f06deb8ce9f8d2c23bb476bda Mon Sep 17 00:00:00 2001 From: Apratim Mukherjee <78898747+apratimmukherjee@users.noreply.github.com> Date: Wed, 24 Jul 2024 18:11:34 +0530 Subject: [PATCH 03/10] v1.7.0 --- version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.py b/version.py index 2dce198f..5c1d80a5 100644 --- a/version.py +++ b/version.py @@ -2,8 +2,8 @@ class Version: - models_version = "1.6.2" - version = "1.6.2" + models_version = "1.7.0" + version = "1.7.0" package_name = "snappi" protobuf_name = "otg" go_package_name = "gosnappi" From 4cd738ff08f16a527846554fdee1114dba0b9d1a Mon Sep 17 00:00:00 2001 From: Github Actions Bot Date: Wed, 24 Jul 2024 12:45:22 +0000 Subject: [PATCH 04/10] Update auto generated go snappi --- gosnappi/gosnappi.go | 3369 ++++- gosnappi/otg/otg.pb.go | 25507 +++++++++++++++++++------------------ gosnappi/otg/otg.proto | 195 +- requirements.txt | 10 +- snappi/__init__.py | 7 + snappi/docs/openapi.yaml | 297 +- snappi/otg_pb2.py | 1956 +-- snappi/snappi.py | 1131 +- 8 files changed, 19067 insertions(+), 13405 deletions(-) diff --git a/gosnappi/gosnappi.go b/gosnappi/gosnappi.go index a2b4bc1c..6e422917 100644 --- a/gosnappi/gosnappi.go +++ b/gosnappi/gosnappi.go @@ -1,4 +1,4 @@ -/* Open Traffic Generator API 1.6.2 +/* Open Traffic Generator API 1.7.0 * Open Traffic Generator API defines a model-driven, vendor-neutral and standard * interface for emulating layer 2-7 network devices and generating test traffic. * @@ -250,7 +250,7 @@ type Api interface { func (api *gosnappiApi) GetLocalVersion() Version { if api.versionMeta.localVersion == nil { - api.versionMeta.localVersion = NewVersion().SetApiSpecVersion("1.6.2").SetSdkVersion("1.6.2") + api.versionMeta.localVersion = NewVersion().SetApiSpecVersion("1.7.0").SetSdkVersion("1.7.0") } return api.versionMeta.localVersion @@ -23425,10 +23425,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 @@ -23487,16 +23487,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 { @@ -126524,6 +126524,7 @@ type patternFlowIpv4Src struct { decrementHolder PatternFlowIpv4SrcCounter metricTagsHolder PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter autoHolder FlowIpv4Auto + randomHolder PatternFlowIpv4SrcRandom } func NewPatternFlowIpv4Src() PatternFlowIpv4Src { @@ -126755,6 +126756,7 @@ func (obj *patternFlowIpv4Src) setNil() { obj.decrementHolder = nil obj.metricTagsHolder = nil obj.autoHolder = nil + obj.randomHolder = nil obj.validationErrors = nil obj.warnings = nil obj.constraints = make(map[string]map[string]Constraints) @@ -126821,6 +126823,14 @@ type PatternFlowIpv4Src interface { Auto() FlowIpv4Auto // HasAuto checks if Auto has been set in PatternFlowIpv4Src HasAuto() bool + // Random returns PatternFlowIpv4SrcRandom, set in PatternFlowIpv4Src. + // PatternFlowIpv4SrcRandom is ipv4 random pattern + Random() PatternFlowIpv4SrcRandom + // SetRandom assigns PatternFlowIpv4SrcRandom provided by user to PatternFlowIpv4Src. + // PatternFlowIpv4SrcRandom is ipv4 random pattern + SetRandom(value PatternFlowIpv4SrcRandom) PatternFlowIpv4Src + // HasRandom checks if Random has been set in PatternFlowIpv4Src + HasRandom() bool setNil() } @@ -126830,15 +126840,17 @@ type PatternFlowIpv4SrcChoiceEnum string var PatternFlowIpv4SrcChoice = struct { VALUE PatternFlowIpv4SrcChoiceEnum VALUES PatternFlowIpv4SrcChoiceEnum - AUTO PatternFlowIpv4SrcChoiceEnum INCREMENT PatternFlowIpv4SrcChoiceEnum DECREMENT PatternFlowIpv4SrcChoiceEnum + AUTO PatternFlowIpv4SrcChoiceEnum + RANDOM PatternFlowIpv4SrcChoiceEnum }{ VALUE: PatternFlowIpv4SrcChoiceEnum("value"), VALUES: PatternFlowIpv4SrcChoiceEnum("values"), - AUTO: PatternFlowIpv4SrcChoiceEnum("auto"), INCREMENT: PatternFlowIpv4SrcChoiceEnum("increment"), DECREMENT: PatternFlowIpv4SrcChoiceEnum("decrement"), + AUTO: PatternFlowIpv4SrcChoiceEnum("auto"), + RANDOM: PatternFlowIpv4SrcChoiceEnum("random"), } func (obj *patternFlowIpv4Src) Choice() PatternFlowIpv4SrcChoiceEnum { @@ -126860,6 +126872,8 @@ func (obj *patternFlowIpv4Src) setChoice(value PatternFlowIpv4SrcChoiceEnum) Pat } enumValue := otg.PatternFlowIpv4Src_Choice_Enum(intValue) obj.obj.Choice = &enumValue + obj.obj.Random = nil + obj.randomHolder = nil obj.obj.Auto = nil obj.autoHolder = nil obj.obj.Decrement = nil @@ -126891,6 +126905,10 @@ func (obj *patternFlowIpv4Src) setChoice(value PatternFlowIpv4SrcChoiceEnum) Pat obj.obj.Auto = NewFlowIpv4Auto().msg() } + if value == PatternFlowIpv4SrcChoice.RANDOM { + obj.obj.Random = NewPatternFlowIpv4SrcRandom().msg() + } + return obj } @@ -127102,6 +127120,34 @@ func (obj *patternFlowIpv4Src) HasAuto() bool { return obj.obj.Auto != nil } +// description is TBD +// Random returns a PatternFlowIpv4SrcRandom +func (obj *patternFlowIpv4Src) Random() PatternFlowIpv4SrcRandom { + if obj.obj.Random == nil { + obj.setChoice(PatternFlowIpv4SrcChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &patternFlowIpv4SrcRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a PatternFlowIpv4SrcRandom +func (obj *patternFlowIpv4Src) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the PatternFlowIpv4SrcRandom value in the PatternFlowIpv4Src object +func (obj *patternFlowIpv4Src) SetRandom(value PatternFlowIpv4SrcRandom) PatternFlowIpv4Src { + obj.setChoice(PatternFlowIpv4SrcChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + func (obj *patternFlowIpv4Src) validateObj(vObj *validation, set_default bool) { if set_default { obj.setDefault() @@ -127154,6 +127200,11 @@ func (obj *patternFlowIpv4Src) validateObj(vObj *validation, set_default bool) { obj.Auto().validateObj(vObj, set_default) } + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + } func (obj *patternFlowIpv4Src) setDefault() { @@ -127170,11 +127221,6 @@ func (obj *patternFlowIpv4Src) setDefault() { choice = PatternFlowIpv4SrcChoice.VALUES } - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowIpv4SrcChoice.AUTO - } - if obj.obj.Increment != nil { choices_set += 1 choice = PatternFlowIpv4SrcChoice.INCREMENT @@ -127184,6 +127230,16 @@ func (obj *patternFlowIpv4Src) setDefault() { choices_set += 1 choice = PatternFlowIpv4SrcChoice.DECREMENT } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowIpv4SrcChoice.AUTO + } + + if obj.obj.Random != nil { + choices_set += 1 + choice = PatternFlowIpv4SrcChoice.RANDOM + } if choices_set == 0 { if obj.obj.Choice == nil { obj.setChoice(PatternFlowIpv4SrcChoice.VALUE) @@ -127214,6 +127270,7 @@ type patternFlowIpv4Dst struct { decrementHolder PatternFlowIpv4DstCounter metricTagsHolder PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter autoHolder FlowIpv4Auto + randomHolder PatternFlowIpv4DstRandom } func NewPatternFlowIpv4Dst() PatternFlowIpv4Dst { @@ -127445,6 +127502,7 @@ func (obj *patternFlowIpv4Dst) setNil() { obj.decrementHolder = nil obj.metricTagsHolder = nil obj.autoHolder = nil + obj.randomHolder = nil obj.validationErrors = nil obj.warnings = nil obj.constraints = make(map[string]map[string]Constraints) @@ -127511,6 +127569,14 @@ type PatternFlowIpv4Dst interface { Auto() FlowIpv4Auto // HasAuto checks if Auto has been set in PatternFlowIpv4Dst HasAuto() bool + // Random returns PatternFlowIpv4DstRandom, set in PatternFlowIpv4Dst. + // PatternFlowIpv4DstRandom is ipv4 random pattern + Random() PatternFlowIpv4DstRandom + // SetRandom assigns PatternFlowIpv4DstRandom provided by user to PatternFlowIpv4Dst. + // PatternFlowIpv4DstRandom is ipv4 random pattern + SetRandom(value PatternFlowIpv4DstRandom) PatternFlowIpv4Dst + // HasRandom checks if Random has been set in PatternFlowIpv4Dst + HasRandom() bool setNil() } @@ -127520,15 +127586,17 @@ type PatternFlowIpv4DstChoiceEnum string var PatternFlowIpv4DstChoice = struct { VALUE PatternFlowIpv4DstChoiceEnum VALUES PatternFlowIpv4DstChoiceEnum - AUTO PatternFlowIpv4DstChoiceEnum INCREMENT PatternFlowIpv4DstChoiceEnum DECREMENT PatternFlowIpv4DstChoiceEnum + AUTO PatternFlowIpv4DstChoiceEnum + RANDOM PatternFlowIpv4DstChoiceEnum }{ VALUE: PatternFlowIpv4DstChoiceEnum("value"), VALUES: PatternFlowIpv4DstChoiceEnum("values"), - AUTO: PatternFlowIpv4DstChoiceEnum("auto"), INCREMENT: PatternFlowIpv4DstChoiceEnum("increment"), DECREMENT: PatternFlowIpv4DstChoiceEnum("decrement"), + AUTO: PatternFlowIpv4DstChoiceEnum("auto"), + RANDOM: PatternFlowIpv4DstChoiceEnum("random"), } func (obj *patternFlowIpv4Dst) Choice() PatternFlowIpv4DstChoiceEnum { @@ -127550,6 +127618,8 @@ func (obj *patternFlowIpv4Dst) setChoice(value PatternFlowIpv4DstChoiceEnum) Pat } enumValue := otg.PatternFlowIpv4Dst_Choice_Enum(intValue) obj.obj.Choice = &enumValue + obj.obj.Random = nil + obj.randomHolder = nil obj.obj.Auto = nil obj.autoHolder = nil obj.obj.Decrement = nil @@ -127581,6 +127651,10 @@ func (obj *patternFlowIpv4Dst) setChoice(value PatternFlowIpv4DstChoiceEnum) Pat obj.obj.Auto = NewFlowIpv4Auto().msg() } + if value == PatternFlowIpv4DstChoice.RANDOM { + obj.obj.Random = NewPatternFlowIpv4DstRandom().msg() + } + return obj } @@ -127792,6 +127866,34 @@ func (obj *patternFlowIpv4Dst) HasAuto() bool { return obj.obj.Auto != nil } +// description is TBD +// Random returns a PatternFlowIpv4DstRandom +func (obj *patternFlowIpv4Dst) Random() PatternFlowIpv4DstRandom { + if obj.obj.Random == nil { + obj.setChoice(PatternFlowIpv4DstChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &patternFlowIpv4DstRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a PatternFlowIpv4DstRandom +func (obj *patternFlowIpv4Dst) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the PatternFlowIpv4DstRandom value in the PatternFlowIpv4Dst object +func (obj *patternFlowIpv4Dst) SetRandom(value PatternFlowIpv4DstRandom) PatternFlowIpv4Dst { + obj.setChoice(PatternFlowIpv4DstChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + func (obj *patternFlowIpv4Dst) validateObj(vObj *validation, set_default bool) { if set_default { obj.setDefault() @@ -127844,6 +127946,11 @@ func (obj *patternFlowIpv4Dst) validateObj(vObj *validation, set_default bool) { obj.Auto().validateObj(vObj, set_default) } + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + } func (obj *patternFlowIpv4Dst) setDefault() { @@ -127860,11 +127967,6 @@ func (obj *patternFlowIpv4Dst) setDefault() { choice = PatternFlowIpv4DstChoice.VALUES } - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowIpv4DstChoice.AUTO - } - if obj.obj.Increment != nil { choices_set += 1 choice = PatternFlowIpv4DstChoice.INCREMENT @@ -127874,6 +127976,16 @@ func (obj *patternFlowIpv4Dst) setDefault() { choices_set += 1 choice = PatternFlowIpv4DstChoice.DECREMENT } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowIpv4DstChoice.AUTO + } + + if obj.obj.Random != nil { + choices_set += 1 + choice = PatternFlowIpv4DstChoice.RANDOM + } if choices_set == 0 { if obj.obj.Choice == nil { obj.setChoice(PatternFlowIpv4DstChoice.VALUE) @@ -129601,6 +129713,7 @@ type patternFlowIpv6FlowLabel struct { incrementHolder PatternFlowIpv6FlowLabelCounter decrementHolder PatternFlowIpv6FlowLabelCounter metricTagsHolder PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter + randomHolder PatternFlowIpv6FlowLabelRandom } func NewPatternFlowIpv6FlowLabel() PatternFlowIpv6FlowLabel { @@ -129831,6 +129944,7 @@ func (obj *patternFlowIpv6FlowLabel) setNil() { obj.incrementHolder = nil obj.decrementHolder = nil obj.metricTagsHolder = nil + obj.randomHolder = nil obj.validationErrors = nil obj.warnings = nil obj.constraints = make(map[string]map[string]Constraints) @@ -129892,6 +130006,14 @@ type PatternFlowIpv6FlowLabel interface { HasDecrement() bool // MetricTags returns PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIterIter, set in PatternFlowIpv6FlowLabel MetricTags() PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter + // Random returns PatternFlowIpv6FlowLabelRandom, set in PatternFlowIpv6FlowLabel. + // PatternFlowIpv6FlowLabelRandom is integer random pattern + Random() PatternFlowIpv6FlowLabelRandom + // SetRandom assigns PatternFlowIpv6FlowLabelRandom provided by user to PatternFlowIpv6FlowLabel. + // PatternFlowIpv6FlowLabelRandom is integer random pattern + SetRandom(value PatternFlowIpv6FlowLabelRandom) PatternFlowIpv6FlowLabel + // HasRandom checks if Random has been set in PatternFlowIpv6FlowLabel + HasRandom() bool setNil() } @@ -129903,11 +130025,13 @@ var PatternFlowIpv6FlowLabelChoice = struct { VALUES PatternFlowIpv6FlowLabelChoiceEnum INCREMENT PatternFlowIpv6FlowLabelChoiceEnum DECREMENT PatternFlowIpv6FlowLabelChoiceEnum + RANDOM PatternFlowIpv6FlowLabelChoiceEnum }{ VALUE: PatternFlowIpv6FlowLabelChoiceEnum("value"), VALUES: PatternFlowIpv6FlowLabelChoiceEnum("values"), INCREMENT: PatternFlowIpv6FlowLabelChoiceEnum("increment"), DECREMENT: PatternFlowIpv6FlowLabelChoiceEnum("decrement"), + RANDOM: PatternFlowIpv6FlowLabelChoiceEnum("random"), } func (obj *patternFlowIpv6FlowLabel) Choice() PatternFlowIpv6FlowLabelChoiceEnum { @@ -129929,6 +130053,8 @@ func (obj *patternFlowIpv6FlowLabel) setChoice(value PatternFlowIpv6FlowLabelCho } enumValue := otg.PatternFlowIpv6FlowLabel_Choice_Enum(intValue) obj.obj.Choice = &enumValue + obj.obj.Random = nil + obj.randomHolder = nil obj.obj.Decrement = nil obj.decrementHolder = nil obj.obj.Increment = nil @@ -129954,6 +130080,10 @@ func (obj *patternFlowIpv6FlowLabel) setChoice(value PatternFlowIpv6FlowLabelCho obj.obj.Decrement = NewPatternFlowIpv6FlowLabelCounter().msg() } + if value == PatternFlowIpv6FlowLabelChoice.RANDOM { + obj.obj.Random = NewPatternFlowIpv6FlowLabelRandom().msg() + } + return obj } @@ -130147,6 +130277,34 @@ func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) append return obj } +// description is TBD +// Random returns a PatternFlowIpv6FlowLabelRandom +func (obj *patternFlowIpv6FlowLabel) Random() PatternFlowIpv6FlowLabelRandom { + if obj.obj.Random == nil { + obj.setChoice(PatternFlowIpv6FlowLabelChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &patternFlowIpv6FlowLabelRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a PatternFlowIpv6FlowLabelRandom +func (obj *patternFlowIpv6FlowLabel) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the PatternFlowIpv6FlowLabelRandom value in the PatternFlowIpv6FlowLabel object +func (obj *patternFlowIpv6FlowLabel) SetRandom(value PatternFlowIpv6FlowLabelRandom) PatternFlowIpv6FlowLabel { + obj.setChoice(PatternFlowIpv6FlowLabelChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + func (obj *patternFlowIpv6FlowLabel) validateObj(vObj *validation, set_default bool) { if set_default { obj.setDefault() @@ -130199,6 +130357,11 @@ func (obj *patternFlowIpv6FlowLabel) validateObj(vObj *validation, set_default b } + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + } func (obj *patternFlowIpv6FlowLabel) setDefault() { @@ -130224,6 +130387,11 @@ func (obj *patternFlowIpv6FlowLabel) setDefault() { choices_set += 1 choice = PatternFlowIpv6FlowLabelChoice.DECREMENT } + + if obj.obj.Random != nil { + choices_set += 1 + choice = PatternFlowIpv6FlowLabelChoice.RANDOM + } if choices_set == 0 { if obj.obj.Choice == nil { obj.setChoice(PatternFlowIpv6FlowLabelChoice.VALUE) @@ -145317,6 +145485,7 @@ type patternFlowTcpSrcPort struct { incrementHolder PatternFlowTcpSrcPortCounter decrementHolder PatternFlowTcpSrcPortCounter metricTagsHolder PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter + randomHolder PatternFlowTcpSrcPortRandom } func NewPatternFlowTcpSrcPort() PatternFlowTcpSrcPort { @@ -145547,6 +145716,7 @@ func (obj *patternFlowTcpSrcPort) setNil() { obj.incrementHolder = nil obj.decrementHolder = nil obj.metricTagsHolder = nil + obj.randomHolder = nil obj.validationErrors = nil obj.warnings = nil obj.constraints = make(map[string]map[string]Constraints) @@ -145608,6 +145778,14 @@ type PatternFlowTcpSrcPort interface { HasDecrement() bool // MetricTags returns PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIterIter, set in PatternFlowTcpSrcPort MetricTags() PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter + // Random returns PatternFlowTcpSrcPortRandom, set in PatternFlowTcpSrcPort. + // PatternFlowTcpSrcPortRandom is integer random pattern + Random() PatternFlowTcpSrcPortRandom + // SetRandom assigns PatternFlowTcpSrcPortRandom provided by user to PatternFlowTcpSrcPort. + // PatternFlowTcpSrcPortRandom is integer random pattern + SetRandom(value PatternFlowTcpSrcPortRandom) PatternFlowTcpSrcPort + // HasRandom checks if Random has been set in PatternFlowTcpSrcPort + HasRandom() bool setNil() } @@ -145619,11 +145797,13 @@ var PatternFlowTcpSrcPortChoice = struct { VALUES PatternFlowTcpSrcPortChoiceEnum INCREMENT PatternFlowTcpSrcPortChoiceEnum DECREMENT PatternFlowTcpSrcPortChoiceEnum + RANDOM PatternFlowTcpSrcPortChoiceEnum }{ VALUE: PatternFlowTcpSrcPortChoiceEnum("value"), VALUES: PatternFlowTcpSrcPortChoiceEnum("values"), INCREMENT: PatternFlowTcpSrcPortChoiceEnum("increment"), DECREMENT: PatternFlowTcpSrcPortChoiceEnum("decrement"), + RANDOM: PatternFlowTcpSrcPortChoiceEnum("random"), } func (obj *patternFlowTcpSrcPort) Choice() PatternFlowTcpSrcPortChoiceEnum { @@ -145645,6 +145825,8 @@ func (obj *patternFlowTcpSrcPort) setChoice(value PatternFlowTcpSrcPortChoiceEnu } enumValue := otg.PatternFlowTcpSrcPort_Choice_Enum(intValue) obj.obj.Choice = &enumValue + obj.obj.Random = nil + obj.randomHolder = nil obj.obj.Decrement = nil obj.decrementHolder = nil obj.obj.Increment = nil @@ -145670,6 +145852,10 @@ func (obj *patternFlowTcpSrcPort) setChoice(value PatternFlowTcpSrcPortChoiceEnu obj.obj.Decrement = NewPatternFlowTcpSrcPortCounter().msg() } + if value == PatternFlowTcpSrcPortChoice.RANDOM { + obj.obj.Random = NewPatternFlowTcpSrcPortRandom().msg() + } + return obj } @@ -145863,6 +146049,34 @@ func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) appendHolder return obj } +// description is TBD +// Random returns a PatternFlowTcpSrcPortRandom +func (obj *patternFlowTcpSrcPort) Random() PatternFlowTcpSrcPortRandom { + if obj.obj.Random == nil { + obj.setChoice(PatternFlowTcpSrcPortChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &patternFlowTcpSrcPortRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a PatternFlowTcpSrcPortRandom +func (obj *patternFlowTcpSrcPort) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the PatternFlowTcpSrcPortRandom value in the PatternFlowTcpSrcPort object +func (obj *patternFlowTcpSrcPort) SetRandom(value PatternFlowTcpSrcPortRandom) PatternFlowTcpSrcPort { + obj.setChoice(PatternFlowTcpSrcPortChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + func (obj *patternFlowTcpSrcPort) validateObj(vObj *validation, set_default bool) { if set_default { obj.setDefault() @@ -145915,6 +146129,11 @@ func (obj *patternFlowTcpSrcPort) validateObj(vObj *validation, set_default bool } + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + } func (obj *patternFlowTcpSrcPort) setDefault() { @@ -145940,6 +146159,11 @@ func (obj *patternFlowTcpSrcPort) setDefault() { choices_set += 1 choice = PatternFlowTcpSrcPortChoice.DECREMENT } + + if obj.obj.Random != nil { + choices_set += 1 + choice = PatternFlowTcpSrcPortChoice.RANDOM + } if choices_set == 0 { if obj.obj.Choice == nil { obj.setChoice(PatternFlowTcpSrcPortChoice.VALUE) @@ -145969,6 +146193,7 @@ type patternFlowTcpDstPort struct { incrementHolder PatternFlowTcpDstPortCounter decrementHolder PatternFlowTcpDstPortCounter metricTagsHolder PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter + randomHolder PatternFlowTcpDstPortRandom } func NewPatternFlowTcpDstPort() PatternFlowTcpDstPort { @@ -146199,6 +146424,7 @@ func (obj *patternFlowTcpDstPort) setNil() { obj.incrementHolder = nil obj.decrementHolder = nil obj.metricTagsHolder = nil + obj.randomHolder = nil obj.validationErrors = nil obj.warnings = nil obj.constraints = make(map[string]map[string]Constraints) @@ -146260,6 +146486,14 @@ type PatternFlowTcpDstPort interface { HasDecrement() bool // MetricTags returns PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIterIter, set in PatternFlowTcpDstPort MetricTags() PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter + // Random returns PatternFlowTcpDstPortRandom, set in PatternFlowTcpDstPort. + // PatternFlowTcpDstPortRandom is integer random pattern + Random() PatternFlowTcpDstPortRandom + // SetRandom assigns PatternFlowTcpDstPortRandom provided by user to PatternFlowTcpDstPort. + // PatternFlowTcpDstPortRandom is integer random pattern + SetRandom(value PatternFlowTcpDstPortRandom) PatternFlowTcpDstPort + // HasRandom checks if Random has been set in PatternFlowTcpDstPort + HasRandom() bool setNil() } @@ -146271,11 +146505,13 @@ var PatternFlowTcpDstPortChoice = struct { VALUES PatternFlowTcpDstPortChoiceEnum INCREMENT PatternFlowTcpDstPortChoiceEnum DECREMENT PatternFlowTcpDstPortChoiceEnum + RANDOM PatternFlowTcpDstPortChoiceEnum }{ VALUE: PatternFlowTcpDstPortChoiceEnum("value"), VALUES: PatternFlowTcpDstPortChoiceEnum("values"), INCREMENT: PatternFlowTcpDstPortChoiceEnum("increment"), DECREMENT: PatternFlowTcpDstPortChoiceEnum("decrement"), + RANDOM: PatternFlowTcpDstPortChoiceEnum("random"), } func (obj *patternFlowTcpDstPort) Choice() PatternFlowTcpDstPortChoiceEnum { @@ -146297,6 +146533,8 @@ func (obj *patternFlowTcpDstPort) setChoice(value PatternFlowTcpDstPortChoiceEnu } enumValue := otg.PatternFlowTcpDstPort_Choice_Enum(intValue) obj.obj.Choice = &enumValue + obj.obj.Random = nil + obj.randomHolder = nil obj.obj.Decrement = nil obj.decrementHolder = nil obj.obj.Increment = nil @@ -146322,6 +146560,10 @@ func (obj *patternFlowTcpDstPort) setChoice(value PatternFlowTcpDstPortChoiceEnu obj.obj.Decrement = NewPatternFlowTcpDstPortCounter().msg() } + if value == PatternFlowTcpDstPortChoice.RANDOM { + obj.obj.Random = NewPatternFlowTcpDstPortRandom().msg() + } + return obj } @@ -146515,6 +146757,34 @@ func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) appendHolder return obj } +// description is TBD +// Random returns a PatternFlowTcpDstPortRandom +func (obj *patternFlowTcpDstPort) Random() PatternFlowTcpDstPortRandom { + if obj.obj.Random == nil { + obj.setChoice(PatternFlowTcpDstPortChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &patternFlowTcpDstPortRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a PatternFlowTcpDstPortRandom +func (obj *patternFlowTcpDstPort) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the PatternFlowTcpDstPortRandom value in the PatternFlowTcpDstPort object +func (obj *patternFlowTcpDstPort) SetRandom(value PatternFlowTcpDstPortRandom) PatternFlowTcpDstPort { + obj.setChoice(PatternFlowTcpDstPortChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + func (obj *patternFlowTcpDstPort) validateObj(vObj *validation, set_default bool) { if set_default { obj.setDefault() @@ -146567,6 +146837,11 @@ func (obj *patternFlowTcpDstPort) validateObj(vObj *validation, set_default bool } + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + } func (obj *patternFlowTcpDstPort) setDefault() { @@ -146592,6 +146867,11 @@ func (obj *patternFlowTcpDstPort) setDefault() { choices_set += 1 choice = PatternFlowTcpDstPortChoice.DECREMENT } + + if obj.obj.Random != nil { + choices_set += 1 + choice = PatternFlowTcpDstPortChoice.RANDOM + } if choices_set == 0 { if obj.obj.Choice == nil { obj.setChoice(PatternFlowTcpDstPortChoice.VALUE) @@ -155474,6 +155754,7 @@ type patternFlowUdpSrcPort struct { incrementHolder PatternFlowUdpSrcPortCounter decrementHolder PatternFlowUdpSrcPortCounter metricTagsHolder PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter + randomHolder PatternFlowUdpSrcPortRandom } func NewPatternFlowUdpSrcPort() PatternFlowUdpSrcPort { @@ -155704,6 +155985,7 @@ func (obj *patternFlowUdpSrcPort) setNil() { obj.incrementHolder = nil obj.decrementHolder = nil obj.metricTagsHolder = nil + obj.randomHolder = nil obj.validationErrors = nil obj.warnings = nil obj.constraints = make(map[string]map[string]Constraints) @@ -155765,6 +156047,14 @@ type PatternFlowUdpSrcPort interface { HasDecrement() bool // MetricTags returns PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIterIter, set in PatternFlowUdpSrcPort MetricTags() PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter + // Random returns PatternFlowUdpSrcPortRandom, set in PatternFlowUdpSrcPort. + // PatternFlowUdpSrcPortRandom is integer random pattern + Random() PatternFlowUdpSrcPortRandom + // SetRandom assigns PatternFlowUdpSrcPortRandom provided by user to PatternFlowUdpSrcPort. + // PatternFlowUdpSrcPortRandom is integer random pattern + SetRandom(value PatternFlowUdpSrcPortRandom) PatternFlowUdpSrcPort + // HasRandom checks if Random has been set in PatternFlowUdpSrcPort + HasRandom() bool setNil() } @@ -155776,11 +156066,13 @@ var PatternFlowUdpSrcPortChoice = struct { VALUES PatternFlowUdpSrcPortChoiceEnum INCREMENT PatternFlowUdpSrcPortChoiceEnum DECREMENT PatternFlowUdpSrcPortChoiceEnum + RANDOM PatternFlowUdpSrcPortChoiceEnum }{ VALUE: PatternFlowUdpSrcPortChoiceEnum("value"), VALUES: PatternFlowUdpSrcPortChoiceEnum("values"), INCREMENT: PatternFlowUdpSrcPortChoiceEnum("increment"), DECREMENT: PatternFlowUdpSrcPortChoiceEnum("decrement"), + RANDOM: PatternFlowUdpSrcPortChoiceEnum("random"), } func (obj *patternFlowUdpSrcPort) Choice() PatternFlowUdpSrcPortChoiceEnum { @@ -155802,6 +156094,8 @@ func (obj *patternFlowUdpSrcPort) setChoice(value PatternFlowUdpSrcPortChoiceEnu } enumValue := otg.PatternFlowUdpSrcPort_Choice_Enum(intValue) obj.obj.Choice = &enumValue + obj.obj.Random = nil + obj.randomHolder = nil obj.obj.Decrement = nil obj.decrementHolder = nil obj.obj.Increment = nil @@ -155827,6 +156121,10 @@ func (obj *patternFlowUdpSrcPort) setChoice(value PatternFlowUdpSrcPortChoiceEnu obj.obj.Decrement = NewPatternFlowUdpSrcPortCounter().msg() } + if value == PatternFlowUdpSrcPortChoice.RANDOM { + obj.obj.Random = NewPatternFlowUdpSrcPortRandom().msg() + } + return obj } @@ -156020,6 +156318,34 @@ func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) appendHolder return obj } +// description is TBD +// Random returns a PatternFlowUdpSrcPortRandom +func (obj *patternFlowUdpSrcPort) Random() PatternFlowUdpSrcPortRandom { + if obj.obj.Random == nil { + obj.setChoice(PatternFlowUdpSrcPortChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &patternFlowUdpSrcPortRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a PatternFlowUdpSrcPortRandom +func (obj *patternFlowUdpSrcPort) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the PatternFlowUdpSrcPortRandom value in the PatternFlowUdpSrcPort object +func (obj *patternFlowUdpSrcPort) SetRandom(value PatternFlowUdpSrcPortRandom) PatternFlowUdpSrcPort { + obj.setChoice(PatternFlowUdpSrcPortChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + func (obj *patternFlowUdpSrcPort) validateObj(vObj *validation, set_default bool) { if set_default { obj.setDefault() @@ -156072,6 +156398,11 @@ func (obj *patternFlowUdpSrcPort) validateObj(vObj *validation, set_default bool } + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + } func (obj *patternFlowUdpSrcPort) setDefault() { @@ -156097,6 +156428,11 @@ func (obj *patternFlowUdpSrcPort) setDefault() { choices_set += 1 choice = PatternFlowUdpSrcPortChoice.DECREMENT } + + if obj.obj.Random != nil { + choices_set += 1 + choice = PatternFlowUdpSrcPortChoice.RANDOM + } if choices_set == 0 { if obj.obj.Choice == nil { obj.setChoice(PatternFlowUdpSrcPortChoice.VALUE) @@ -156126,6 +156462,7 @@ type patternFlowUdpDstPort struct { incrementHolder PatternFlowUdpDstPortCounter decrementHolder PatternFlowUdpDstPortCounter metricTagsHolder PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter + randomHolder PatternFlowUdpDstPortRandom } func NewPatternFlowUdpDstPort() PatternFlowUdpDstPort { @@ -156356,6 +156693,7 @@ func (obj *patternFlowUdpDstPort) setNil() { obj.incrementHolder = nil obj.decrementHolder = nil obj.metricTagsHolder = nil + obj.randomHolder = nil obj.validationErrors = nil obj.warnings = nil obj.constraints = make(map[string]map[string]Constraints) @@ -156417,6 +156755,14 @@ type PatternFlowUdpDstPort interface { HasDecrement() bool // MetricTags returns PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIterIter, set in PatternFlowUdpDstPort MetricTags() PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter + // Random returns PatternFlowUdpDstPortRandom, set in PatternFlowUdpDstPort. + // PatternFlowUdpDstPortRandom is integer random pattern + Random() PatternFlowUdpDstPortRandom + // SetRandom assigns PatternFlowUdpDstPortRandom provided by user to PatternFlowUdpDstPort. + // PatternFlowUdpDstPortRandom is integer random pattern + SetRandom(value PatternFlowUdpDstPortRandom) PatternFlowUdpDstPort + // HasRandom checks if Random has been set in PatternFlowUdpDstPort + HasRandom() bool setNil() } @@ -156428,11 +156774,13 @@ var PatternFlowUdpDstPortChoice = struct { VALUES PatternFlowUdpDstPortChoiceEnum INCREMENT PatternFlowUdpDstPortChoiceEnum DECREMENT PatternFlowUdpDstPortChoiceEnum + RANDOM PatternFlowUdpDstPortChoiceEnum }{ VALUE: PatternFlowUdpDstPortChoiceEnum("value"), VALUES: PatternFlowUdpDstPortChoiceEnum("values"), INCREMENT: PatternFlowUdpDstPortChoiceEnum("increment"), DECREMENT: PatternFlowUdpDstPortChoiceEnum("decrement"), + RANDOM: PatternFlowUdpDstPortChoiceEnum("random"), } func (obj *patternFlowUdpDstPort) Choice() PatternFlowUdpDstPortChoiceEnum { @@ -156454,6 +156802,8 @@ func (obj *patternFlowUdpDstPort) setChoice(value PatternFlowUdpDstPortChoiceEnu } enumValue := otg.PatternFlowUdpDstPort_Choice_Enum(intValue) obj.obj.Choice = &enumValue + obj.obj.Random = nil + obj.randomHolder = nil obj.obj.Decrement = nil obj.decrementHolder = nil obj.obj.Increment = nil @@ -156479,6 +156829,10 @@ func (obj *patternFlowUdpDstPort) setChoice(value PatternFlowUdpDstPortChoiceEnu obj.obj.Decrement = NewPatternFlowUdpDstPortCounter().msg() } + if value == PatternFlowUdpDstPortChoice.RANDOM { + obj.obj.Random = NewPatternFlowUdpDstPortRandom().msg() + } + return obj } @@ -156672,6 +157026,34 @@ func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) appendHolder return obj } +// description is TBD +// Random returns a PatternFlowUdpDstPortRandom +func (obj *patternFlowUdpDstPort) Random() PatternFlowUdpDstPortRandom { + if obj.obj.Random == nil { + obj.setChoice(PatternFlowUdpDstPortChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &patternFlowUdpDstPortRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a PatternFlowUdpDstPortRandom +func (obj *patternFlowUdpDstPort) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the PatternFlowUdpDstPortRandom value in the PatternFlowUdpDstPort object +func (obj *patternFlowUdpDstPort) SetRandom(value PatternFlowUdpDstPortRandom) PatternFlowUdpDstPort { + obj.setChoice(PatternFlowUdpDstPortChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + func (obj *patternFlowUdpDstPort) validateObj(vObj *validation, set_default bool) { if set_default { obj.setDefault() @@ -156724,6 +157106,11 @@ func (obj *patternFlowUdpDstPort) validateObj(vObj *validation, set_default bool } + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + } func (obj *patternFlowUdpDstPort) setDefault() { @@ -156749,6 +157136,11 @@ func (obj *patternFlowUdpDstPort) setDefault() { choices_set += 1 choice = PatternFlowUdpDstPortChoice.DECREMENT } + + if obj.obj.Random != nil { + choices_set += 1 + choice = PatternFlowUdpDstPortChoice.RANDOM + } if choices_set == 0 { if obj.obj.Choice == nil { obj.setChoice(PatternFlowUdpDstPortChoice.VALUE) @@ -236125,6 +236517,415 @@ func (obj *flowIpv4Auto) setDefault() { } +// ***** PatternFlowIpv4SrcRandom ***** +type patternFlowIpv4SrcRandom struct { + validation + obj *otg.PatternFlowIpv4SrcRandom + marshaller marshalPatternFlowIpv4SrcRandom + unMarshaller unMarshalPatternFlowIpv4SrcRandom +} + +func NewPatternFlowIpv4SrcRandom() PatternFlowIpv4SrcRandom { + obj := patternFlowIpv4SrcRandom{obj: &otg.PatternFlowIpv4SrcRandom{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4SrcRandom) msg() *otg.PatternFlowIpv4SrcRandom { + return obj.obj +} + +func (obj *patternFlowIpv4SrcRandom) setMsg(msg *otg.PatternFlowIpv4SrcRandom) PatternFlowIpv4SrcRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4SrcRandom struct { + obj *patternFlowIpv4SrcRandom +} + +type marshalPatternFlowIpv4SrcRandom interface { + // ToProto marshals PatternFlowIpv4SrcRandom to protobuf object *otg.PatternFlowIpv4SrcRandom + ToProto() (*otg.PatternFlowIpv4SrcRandom, error) + // ToPbText marshals PatternFlowIpv4SrcRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4SrcRandom to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4SrcRandom to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4SrcRandom struct { + obj *patternFlowIpv4SrcRandom +} + +type unMarshalPatternFlowIpv4SrcRandom interface { + // FromProto unmarshals PatternFlowIpv4SrcRandom from protobuf object *otg.PatternFlowIpv4SrcRandom + FromProto(msg *otg.PatternFlowIpv4SrcRandom) (PatternFlowIpv4SrcRandom, error) + // FromPbText unmarshals PatternFlowIpv4SrcRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4SrcRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4SrcRandom from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4SrcRandom) Marshal() marshalPatternFlowIpv4SrcRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4SrcRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4SrcRandom) Unmarshal() unMarshalPatternFlowIpv4SrcRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4SrcRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4SrcRandom) ToProto() (*otg.PatternFlowIpv4SrcRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4SrcRandom) FromProto(msg *otg.PatternFlowIpv4SrcRandom) (PatternFlowIpv4SrcRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4SrcRandom) 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 *unMarshalpatternFlowIpv4SrcRandom) 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 *marshalpatternFlowIpv4SrcRandom) 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 *unMarshalpatternFlowIpv4SrcRandom) 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 *marshalpatternFlowIpv4SrcRandom) 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 *unMarshalpatternFlowIpv4SrcRandom) 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 *patternFlowIpv4SrcRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4SrcRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4SrcRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4SrcRandom) Clone() (PatternFlowIpv4SrcRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4SrcRandom() + 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 +} + +// PatternFlowIpv4SrcRandom is ipv4 random pattern +type PatternFlowIpv4SrcRandom interface { + Validation + // msg marshals PatternFlowIpv4SrcRandom to protobuf object *otg.PatternFlowIpv4SrcRandom + // and doesn't set defaults + msg() *otg.PatternFlowIpv4SrcRandom + // setMsg unmarshals PatternFlowIpv4SrcRandom from protobuf object *otg.PatternFlowIpv4SrcRandom + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4SrcRandom) PatternFlowIpv4SrcRandom + // provides marshal interface + Marshal() marshalPatternFlowIpv4SrcRandom + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4SrcRandom + // validate validates PatternFlowIpv4SrcRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4SrcRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns string, set in PatternFlowIpv4SrcRandom. + Min() string + // SetMin assigns string provided by user to PatternFlowIpv4SrcRandom + SetMin(value string) PatternFlowIpv4SrcRandom + // HasMin checks if Min has been set in PatternFlowIpv4SrcRandom + HasMin() bool + // Max returns string, set in PatternFlowIpv4SrcRandom. + Max() string + // SetMax assigns string provided by user to PatternFlowIpv4SrcRandom + SetMax(value string) PatternFlowIpv4SrcRandom + // HasMax checks if Max has been set in PatternFlowIpv4SrcRandom + HasMax() bool + // Seed returns uint32, set in PatternFlowIpv4SrcRandom. + Seed() uint32 + // SetSeed assigns uint32 provided by user to PatternFlowIpv4SrcRandom + SetSeed(value uint32) PatternFlowIpv4SrcRandom + // HasSeed checks if Seed has been set in PatternFlowIpv4SrcRandom + HasSeed() bool + // Count returns uint32, set in PatternFlowIpv4SrcRandom. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4SrcRandom + SetCount(value uint32) PatternFlowIpv4SrcRandom + // HasCount checks if Count has been set in PatternFlowIpv4SrcRandom + HasCount() bool +} + +// The minimum possible value generated by the random value generator. +// Min returns a string +func (obj *patternFlowIpv4SrcRandom) Min() string { + + return *obj.obj.Min + +} + +// The minimum possible value generated by the random value generator. +// Min returns a string +func (obj *patternFlowIpv4SrcRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// The minimum possible value generated by the random value generator. +// SetMin sets the string value in the PatternFlowIpv4SrcRandom object +func (obj *patternFlowIpv4SrcRandom) SetMin(value string) PatternFlowIpv4SrcRandom { + + obj.obj.Min = &value + return obj +} + +// The maximum possible value generated by the random value generator. +// Max returns a string +func (obj *patternFlowIpv4SrcRandom) Max() string { + + return *obj.obj.Max + +} + +// The maximum possible value generated by the random value generator. +// Max returns a string +func (obj *patternFlowIpv4SrcRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// The maximum possible value generated by the random value generator. +// SetMax sets the string value in the PatternFlowIpv4SrcRandom object +func (obj *patternFlowIpv4SrcRandom) SetMax(value string) PatternFlowIpv4SrcRandom { + + obj.obj.Max = &value + return obj +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowIpv4SrcRandom) Seed() uint32 { + + return *obj.obj.Seed + +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowIpv4SrcRandom) HasSeed() bool { + return obj.obj.Seed != nil +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// SetSeed sets the uint32 value in the PatternFlowIpv4SrcRandom object +func (obj *patternFlowIpv4SrcRandom) SetSeed(value uint32) PatternFlowIpv4SrcRandom { + + obj.obj.Seed = &value + return obj +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowIpv4SrcRandom) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowIpv4SrcRandom) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of values to be generated by the random value generator. +// SetCount sets the uint32 value in the PatternFlowIpv4SrcRandom object +func (obj *patternFlowIpv4SrcRandom) SetCount(value uint32) PatternFlowIpv4SrcRandom { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4SrcRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Min != nil { + + err := obj.validateIpv4(obj.Min()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4SrcRandom.Min")) + } + + } + + if obj.obj.Max != nil { + + err := obj.validateIpv4(obj.Max()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4SrcRandom.Max")) + } + + } + +} + +func (obj *patternFlowIpv4SrcRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin("0.0.0.0") + } + if obj.obj.Max == nil { + obj.SetMax("255.255.255.255") + } + if obj.obj.Seed == nil { + obj.SetSeed(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} + // ***** PatternFlowIpv4DstCounter ***** type patternFlowIpv4DstCounter struct { validation @@ -236877,6 +237678,415 @@ func (obj *patternFlowIpv4DstMetricTag) setDefault() { } +// ***** PatternFlowIpv4DstRandom ***** +type patternFlowIpv4DstRandom struct { + validation + obj *otg.PatternFlowIpv4DstRandom + marshaller marshalPatternFlowIpv4DstRandom + unMarshaller unMarshalPatternFlowIpv4DstRandom +} + +func NewPatternFlowIpv4DstRandom() PatternFlowIpv4DstRandom { + obj := patternFlowIpv4DstRandom{obj: &otg.PatternFlowIpv4DstRandom{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4DstRandom) msg() *otg.PatternFlowIpv4DstRandom { + return obj.obj +} + +func (obj *patternFlowIpv4DstRandom) setMsg(msg *otg.PatternFlowIpv4DstRandom) PatternFlowIpv4DstRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4DstRandom struct { + obj *patternFlowIpv4DstRandom +} + +type marshalPatternFlowIpv4DstRandom interface { + // ToProto marshals PatternFlowIpv4DstRandom to protobuf object *otg.PatternFlowIpv4DstRandom + ToProto() (*otg.PatternFlowIpv4DstRandom, error) + // ToPbText marshals PatternFlowIpv4DstRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4DstRandom to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4DstRandom to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4DstRandom struct { + obj *patternFlowIpv4DstRandom +} + +type unMarshalPatternFlowIpv4DstRandom interface { + // FromProto unmarshals PatternFlowIpv4DstRandom from protobuf object *otg.PatternFlowIpv4DstRandom + FromProto(msg *otg.PatternFlowIpv4DstRandom) (PatternFlowIpv4DstRandom, error) + // FromPbText unmarshals PatternFlowIpv4DstRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4DstRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4DstRandom from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4DstRandom) Marshal() marshalPatternFlowIpv4DstRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4DstRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4DstRandom) Unmarshal() unMarshalPatternFlowIpv4DstRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4DstRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4DstRandom) ToProto() (*otg.PatternFlowIpv4DstRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4DstRandom) FromProto(msg *otg.PatternFlowIpv4DstRandom) (PatternFlowIpv4DstRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4DstRandom) 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 *unMarshalpatternFlowIpv4DstRandom) 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 *marshalpatternFlowIpv4DstRandom) 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 *unMarshalpatternFlowIpv4DstRandom) 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 *marshalpatternFlowIpv4DstRandom) 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 *unMarshalpatternFlowIpv4DstRandom) 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 *patternFlowIpv4DstRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DstRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DstRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4DstRandom) Clone() (PatternFlowIpv4DstRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4DstRandom() + 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 +} + +// PatternFlowIpv4DstRandom is ipv4 random pattern +type PatternFlowIpv4DstRandom interface { + Validation + // msg marshals PatternFlowIpv4DstRandom to protobuf object *otg.PatternFlowIpv4DstRandom + // and doesn't set defaults + msg() *otg.PatternFlowIpv4DstRandom + // setMsg unmarshals PatternFlowIpv4DstRandom from protobuf object *otg.PatternFlowIpv4DstRandom + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4DstRandom) PatternFlowIpv4DstRandom + // provides marshal interface + Marshal() marshalPatternFlowIpv4DstRandom + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4DstRandom + // validate validates PatternFlowIpv4DstRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4DstRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns string, set in PatternFlowIpv4DstRandom. + Min() string + // SetMin assigns string provided by user to PatternFlowIpv4DstRandom + SetMin(value string) PatternFlowIpv4DstRandom + // HasMin checks if Min has been set in PatternFlowIpv4DstRandom + HasMin() bool + // Max returns string, set in PatternFlowIpv4DstRandom. + Max() string + // SetMax assigns string provided by user to PatternFlowIpv4DstRandom + SetMax(value string) PatternFlowIpv4DstRandom + // HasMax checks if Max has been set in PatternFlowIpv4DstRandom + HasMax() bool + // Seed returns uint32, set in PatternFlowIpv4DstRandom. + Seed() uint32 + // SetSeed assigns uint32 provided by user to PatternFlowIpv4DstRandom + SetSeed(value uint32) PatternFlowIpv4DstRandom + // HasSeed checks if Seed has been set in PatternFlowIpv4DstRandom + HasSeed() bool + // Count returns uint32, set in PatternFlowIpv4DstRandom. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4DstRandom + SetCount(value uint32) PatternFlowIpv4DstRandom + // HasCount checks if Count has been set in PatternFlowIpv4DstRandom + HasCount() bool +} + +// The minimum possible value generated by the random value generator. +// Min returns a string +func (obj *patternFlowIpv4DstRandom) Min() string { + + return *obj.obj.Min + +} + +// The minimum possible value generated by the random value generator. +// Min returns a string +func (obj *patternFlowIpv4DstRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// The minimum possible value generated by the random value generator. +// SetMin sets the string value in the PatternFlowIpv4DstRandom object +func (obj *patternFlowIpv4DstRandom) SetMin(value string) PatternFlowIpv4DstRandom { + + obj.obj.Min = &value + return obj +} + +// The maximum possible value generated by the random value generator. +// Max returns a string +func (obj *patternFlowIpv4DstRandom) Max() string { + + return *obj.obj.Max + +} + +// The maximum possible value generated by the random value generator. +// Max returns a string +func (obj *patternFlowIpv4DstRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// The maximum possible value generated by the random value generator. +// SetMax sets the string value in the PatternFlowIpv4DstRandom object +func (obj *patternFlowIpv4DstRandom) SetMax(value string) PatternFlowIpv4DstRandom { + + obj.obj.Max = &value + return obj +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowIpv4DstRandom) Seed() uint32 { + + return *obj.obj.Seed + +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowIpv4DstRandom) HasSeed() bool { + return obj.obj.Seed != nil +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// SetSeed sets the uint32 value in the PatternFlowIpv4DstRandom object +func (obj *patternFlowIpv4DstRandom) SetSeed(value uint32) PatternFlowIpv4DstRandom { + + obj.obj.Seed = &value + return obj +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowIpv4DstRandom) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowIpv4DstRandom) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of values to be generated by the random value generator. +// SetCount sets the uint32 value in the PatternFlowIpv4DstRandom object +func (obj *patternFlowIpv4DstRandom) SetCount(value uint32) PatternFlowIpv4DstRandom { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4DstRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Min != nil { + + err := obj.validateIpv4(obj.Min()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4DstRandom.Min")) + } + + } + + if obj.obj.Max != nil { + + err := obj.validateIpv4(obj.Max()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4DstRandom.Max")) + } + + } + +} + +func (obj *patternFlowIpv4DstRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin("0.0.0.0") + } + if obj.obj.Max == nil { + obj.SetMax("255.255.255.255") + } + if obj.obj.Seed == nil { + obj.SetSeed(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} + // ***** FlowIpv4OptionsCustom ***** type flowIpv4OptionsCustom struct { validation @@ -239572,6 +240782,417 @@ func (obj *patternFlowIpv6FlowLabelMetricTag) setDefault() { } +// ***** PatternFlowIpv6FlowLabelRandom ***** +type patternFlowIpv6FlowLabelRandom struct { + validation + obj *otg.PatternFlowIpv6FlowLabelRandom + marshaller marshalPatternFlowIpv6FlowLabelRandom + unMarshaller unMarshalPatternFlowIpv6FlowLabelRandom +} + +func NewPatternFlowIpv6FlowLabelRandom() PatternFlowIpv6FlowLabelRandom { + obj := patternFlowIpv6FlowLabelRandom{obj: &otg.PatternFlowIpv6FlowLabelRandom{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6FlowLabelRandom) msg() *otg.PatternFlowIpv6FlowLabelRandom { + return obj.obj +} + +func (obj *patternFlowIpv6FlowLabelRandom) setMsg(msg *otg.PatternFlowIpv6FlowLabelRandom) PatternFlowIpv6FlowLabelRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6FlowLabelRandom struct { + obj *patternFlowIpv6FlowLabelRandom +} + +type marshalPatternFlowIpv6FlowLabelRandom interface { + // ToProto marshals PatternFlowIpv6FlowLabelRandom to protobuf object *otg.PatternFlowIpv6FlowLabelRandom + ToProto() (*otg.PatternFlowIpv6FlowLabelRandom, error) + // ToPbText marshals PatternFlowIpv6FlowLabelRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6FlowLabelRandom to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6FlowLabelRandom to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6FlowLabelRandom struct { + obj *patternFlowIpv6FlowLabelRandom +} + +type unMarshalPatternFlowIpv6FlowLabelRandom interface { + // FromProto unmarshals PatternFlowIpv6FlowLabelRandom from protobuf object *otg.PatternFlowIpv6FlowLabelRandom + FromProto(msg *otg.PatternFlowIpv6FlowLabelRandom) (PatternFlowIpv6FlowLabelRandom, error) + // FromPbText unmarshals PatternFlowIpv6FlowLabelRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6FlowLabelRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6FlowLabelRandom from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6FlowLabelRandom) Marshal() marshalPatternFlowIpv6FlowLabelRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6FlowLabelRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6FlowLabelRandom) Unmarshal() unMarshalPatternFlowIpv6FlowLabelRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6FlowLabelRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6FlowLabelRandom) ToProto() (*otg.PatternFlowIpv6FlowLabelRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6FlowLabelRandom) FromProto(msg *otg.PatternFlowIpv6FlowLabelRandom) (PatternFlowIpv6FlowLabelRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6FlowLabelRandom) 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 *unMarshalpatternFlowIpv6FlowLabelRandom) 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 *marshalpatternFlowIpv6FlowLabelRandom) 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 *unMarshalpatternFlowIpv6FlowLabelRandom) 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 *marshalpatternFlowIpv6FlowLabelRandom) 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 *unMarshalpatternFlowIpv6FlowLabelRandom) 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 *patternFlowIpv6FlowLabelRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6FlowLabelRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6FlowLabelRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6FlowLabelRandom) Clone() (PatternFlowIpv6FlowLabelRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6FlowLabelRandom() + 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 +} + +// PatternFlowIpv6FlowLabelRandom is integer random pattern +type PatternFlowIpv6FlowLabelRandom interface { + Validation + // msg marshals PatternFlowIpv6FlowLabelRandom to protobuf object *otg.PatternFlowIpv6FlowLabelRandom + // and doesn't set defaults + msg() *otg.PatternFlowIpv6FlowLabelRandom + // setMsg unmarshals PatternFlowIpv6FlowLabelRandom from protobuf object *otg.PatternFlowIpv6FlowLabelRandom + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6FlowLabelRandom) PatternFlowIpv6FlowLabelRandom + // provides marshal interface + Marshal() marshalPatternFlowIpv6FlowLabelRandom + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6FlowLabelRandom + // validate validates PatternFlowIpv6FlowLabelRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6FlowLabelRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns uint32, set in PatternFlowIpv6FlowLabelRandom. + Min() uint32 + // SetMin assigns uint32 provided by user to PatternFlowIpv6FlowLabelRandom + SetMin(value uint32) PatternFlowIpv6FlowLabelRandom + // HasMin checks if Min has been set in PatternFlowIpv6FlowLabelRandom + HasMin() bool + // Max returns uint32, set in PatternFlowIpv6FlowLabelRandom. + Max() uint32 + // SetMax assigns uint32 provided by user to PatternFlowIpv6FlowLabelRandom + SetMax(value uint32) PatternFlowIpv6FlowLabelRandom + // HasMax checks if Max has been set in PatternFlowIpv6FlowLabelRandom + HasMax() bool + // Seed returns uint32, set in PatternFlowIpv6FlowLabelRandom. + Seed() uint32 + // SetSeed assigns uint32 provided by user to PatternFlowIpv6FlowLabelRandom + SetSeed(value uint32) PatternFlowIpv6FlowLabelRandom + // HasSeed checks if Seed has been set in PatternFlowIpv6FlowLabelRandom + HasSeed() bool + // Count returns uint32, set in PatternFlowIpv6FlowLabelRandom. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv6FlowLabelRandom + SetCount(value uint32) PatternFlowIpv6FlowLabelRandom + // HasCount checks if Count has been set in PatternFlowIpv6FlowLabelRandom + HasCount() bool +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) Min() uint32 { + + return *obj.obj.Min + +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// The minimum possible value generated by the random value generator. +// SetMin sets the uint32 value in the PatternFlowIpv6FlowLabelRandom object +func (obj *patternFlowIpv6FlowLabelRandom) SetMin(value uint32) PatternFlowIpv6FlowLabelRandom { + + obj.obj.Min = &value + return obj +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) Max() uint32 { + + return *obj.obj.Max + +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// The maximum possible value generated by the random value generator. +// SetMax sets the uint32 value in the PatternFlowIpv6FlowLabelRandom object +func (obj *patternFlowIpv6FlowLabelRandom) SetMax(value uint32) PatternFlowIpv6FlowLabelRandom { + + obj.obj.Max = &value + return obj +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) Seed() uint32 { + + return *obj.obj.Seed + +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) HasSeed() bool { + return obj.obj.Seed != nil +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// SetSeed sets the uint32 value in the PatternFlowIpv6FlowLabelRandom object +func (obj *patternFlowIpv6FlowLabelRandom) SetSeed(value uint32) PatternFlowIpv6FlowLabelRandom { + + obj.obj.Seed = &value + return obj +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of values to be generated by the random value generator. +// SetCount sets the uint32 value in the PatternFlowIpv6FlowLabelRandom object +func (obj *patternFlowIpv6FlowLabelRandom) SetCount(value uint32) PatternFlowIpv6FlowLabelRandom { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv6FlowLabelRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Min != nil { + + if *obj.obj.Min > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6FlowLabelRandom.Min <= 1048575 but Got %d", *obj.obj.Min)) + } + + } + + if obj.obj.Max != nil { + + if *obj.obj.Max > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6FlowLabelRandom.Max <= 1048575 but Got %d", *obj.obj.Max)) + } + + } + +} + +func (obj *patternFlowIpv6FlowLabelRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin(0) + } + if obj.obj.Max == nil { + obj.SetMax(1048575) + } + if obj.obj.Seed == nil { + obj.SetSeed(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} + // ***** PatternFlowIpv6PayloadLengthCounter ***** type patternFlowIpv6PayloadLengthCounter struct { validation @@ -257836,6 +259457,417 @@ func (obj *patternFlowTcpSrcPortMetricTag) setDefault() { } +// ***** PatternFlowTcpSrcPortRandom ***** +type patternFlowTcpSrcPortRandom struct { + validation + obj *otg.PatternFlowTcpSrcPortRandom + marshaller marshalPatternFlowTcpSrcPortRandom + unMarshaller unMarshalPatternFlowTcpSrcPortRandom +} + +func NewPatternFlowTcpSrcPortRandom() PatternFlowTcpSrcPortRandom { + obj := patternFlowTcpSrcPortRandom{obj: &otg.PatternFlowTcpSrcPortRandom{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpSrcPortRandom) msg() *otg.PatternFlowTcpSrcPortRandom { + return obj.obj +} + +func (obj *patternFlowTcpSrcPortRandom) setMsg(msg *otg.PatternFlowTcpSrcPortRandom) PatternFlowTcpSrcPortRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpSrcPortRandom struct { + obj *patternFlowTcpSrcPortRandom +} + +type marshalPatternFlowTcpSrcPortRandom interface { + // ToProto marshals PatternFlowTcpSrcPortRandom to protobuf object *otg.PatternFlowTcpSrcPortRandom + ToProto() (*otg.PatternFlowTcpSrcPortRandom, error) + // ToPbText marshals PatternFlowTcpSrcPortRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpSrcPortRandom to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpSrcPortRandom to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpSrcPortRandom struct { + obj *patternFlowTcpSrcPortRandom +} + +type unMarshalPatternFlowTcpSrcPortRandom interface { + // FromProto unmarshals PatternFlowTcpSrcPortRandom from protobuf object *otg.PatternFlowTcpSrcPortRandom + FromProto(msg *otg.PatternFlowTcpSrcPortRandom) (PatternFlowTcpSrcPortRandom, error) + // FromPbText unmarshals PatternFlowTcpSrcPortRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpSrcPortRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpSrcPortRandom from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpSrcPortRandom) Marshal() marshalPatternFlowTcpSrcPortRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpSrcPortRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpSrcPortRandom) Unmarshal() unMarshalPatternFlowTcpSrcPortRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpSrcPortRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpSrcPortRandom) ToProto() (*otg.PatternFlowTcpSrcPortRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpSrcPortRandom) FromProto(msg *otg.PatternFlowTcpSrcPortRandom) (PatternFlowTcpSrcPortRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpSrcPortRandom) 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 *unMarshalpatternFlowTcpSrcPortRandom) 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 *marshalpatternFlowTcpSrcPortRandom) 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 *unMarshalpatternFlowTcpSrcPortRandom) 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 *marshalpatternFlowTcpSrcPortRandom) 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 *unMarshalpatternFlowTcpSrcPortRandom) 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 *patternFlowTcpSrcPortRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpSrcPortRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpSrcPortRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpSrcPortRandom) Clone() (PatternFlowTcpSrcPortRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpSrcPortRandom() + 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 +} + +// PatternFlowTcpSrcPortRandom is integer random pattern +type PatternFlowTcpSrcPortRandom interface { + Validation + // msg marshals PatternFlowTcpSrcPortRandom to protobuf object *otg.PatternFlowTcpSrcPortRandom + // and doesn't set defaults + msg() *otg.PatternFlowTcpSrcPortRandom + // setMsg unmarshals PatternFlowTcpSrcPortRandom from protobuf object *otg.PatternFlowTcpSrcPortRandom + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpSrcPortRandom) PatternFlowTcpSrcPortRandom + // provides marshal interface + Marshal() marshalPatternFlowTcpSrcPortRandom + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpSrcPortRandom + // validate validates PatternFlowTcpSrcPortRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpSrcPortRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns uint32, set in PatternFlowTcpSrcPortRandom. + Min() uint32 + // SetMin assigns uint32 provided by user to PatternFlowTcpSrcPortRandom + SetMin(value uint32) PatternFlowTcpSrcPortRandom + // HasMin checks if Min has been set in PatternFlowTcpSrcPortRandom + HasMin() bool + // Max returns uint32, set in PatternFlowTcpSrcPortRandom. + Max() uint32 + // SetMax assigns uint32 provided by user to PatternFlowTcpSrcPortRandom + SetMax(value uint32) PatternFlowTcpSrcPortRandom + // HasMax checks if Max has been set in PatternFlowTcpSrcPortRandom + HasMax() bool + // Seed returns uint32, set in PatternFlowTcpSrcPortRandom. + Seed() uint32 + // SetSeed assigns uint32 provided by user to PatternFlowTcpSrcPortRandom + SetSeed(value uint32) PatternFlowTcpSrcPortRandom + // HasSeed checks if Seed has been set in PatternFlowTcpSrcPortRandom + HasSeed() bool + // Count returns uint32, set in PatternFlowTcpSrcPortRandom. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpSrcPortRandom + SetCount(value uint32) PatternFlowTcpSrcPortRandom + // HasCount checks if Count has been set in PatternFlowTcpSrcPortRandom + HasCount() bool +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) Min() uint32 { + + return *obj.obj.Min + +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// The minimum possible value generated by the random value generator. +// SetMin sets the uint32 value in the PatternFlowTcpSrcPortRandom object +func (obj *patternFlowTcpSrcPortRandom) SetMin(value uint32) PatternFlowTcpSrcPortRandom { + + obj.obj.Min = &value + return obj +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) Max() uint32 { + + return *obj.obj.Max + +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// The maximum possible value generated by the random value generator. +// SetMax sets the uint32 value in the PatternFlowTcpSrcPortRandom object +func (obj *patternFlowTcpSrcPortRandom) SetMax(value uint32) PatternFlowTcpSrcPortRandom { + + obj.obj.Max = &value + return obj +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) Seed() uint32 { + + return *obj.obj.Seed + +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) HasSeed() bool { + return obj.obj.Seed != nil +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// SetSeed sets the uint32 value in the PatternFlowTcpSrcPortRandom object +func (obj *patternFlowTcpSrcPortRandom) SetSeed(value uint32) PatternFlowTcpSrcPortRandom { + + obj.obj.Seed = &value + return obj +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of values to be generated by the random value generator. +// SetCount sets the uint32 value in the PatternFlowTcpSrcPortRandom object +func (obj *patternFlowTcpSrcPortRandom) SetCount(value uint32) PatternFlowTcpSrcPortRandom { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpSrcPortRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Min != nil { + + if *obj.obj.Min > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpSrcPortRandom.Min <= 65535 but Got %d", *obj.obj.Min)) + } + + } + + if obj.obj.Max != nil { + + if *obj.obj.Max > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpSrcPortRandom.Max <= 65535 but Got %d", *obj.obj.Max)) + } + + } + +} + +func (obj *patternFlowTcpSrcPortRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin(0) + } + if obj.obj.Max == nil { + obj.SetMax(65535) + } + if obj.obj.Seed == nil { + obj.SetSeed(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} + // ***** PatternFlowTcpDstPortCounter ***** type patternFlowTcpDstPortCounter struct { validation @@ -258600,6 +260632,417 @@ func (obj *patternFlowTcpDstPortMetricTag) setDefault() { } +// ***** PatternFlowTcpDstPortRandom ***** +type patternFlowTcpDstPortRandom struct { + validation + obj *otg.PatternFlowTcpDstPortRandom + marshaller marshalPatternFlowTcpDstPortRandom + unMarshaller unMarshalPatternFlowTcpDstPortRandom +} + +func NewPatternFlowTcpDstPortRandom() PatternFlowTcpDstPortRandom { + obj := patternFlowTcpDstPortRandom{obj: &otg.PatternFlowTcpDstPortRandom{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpDstPortRandom) msg() *otg.PatternFlowTcpDstPortRandom { + return obj.obj +} + +func (obj *patternFlowTcpDstPortRandom) setMsg(msg *otg.PatternFlowTcpDstPortRandom) PatternFlowTcpDstPortRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpDstPortRandom struct { + obj *patternFlowTcpDstPortRandom +} + +type marshalPatternFlowTcpDstPortRandom interface { + // ToProto marshals PatternFlowTcpDstPortRandom to protobuf object *otg.PatternFlowTcpDstPortRandom + ToProto() (*otg.PatternFlowTcpDstPortRandom, error) + // ToPbText marshals PatternFlowTcpDstPortRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpDstPortRandom to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpDstPortRandom to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpDstPortRandom struct { + obj *patternFlowTcpDstPortRandom +} + +type unMarshalPatternFlowTcpDstPortRandom interface { + // FromProto unmarshals PatternFlowTcpDstPortRandom from protobuf object *otg.PatternFlowTcpDstPortRandom + FromProto(msg *otg.PatternFlowTcpDstPortRandom) (PatternFlowTcpDstPortRandom, error) + // FromPbText unmarshals PatternFlowTcpDstPortRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpDstPortRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpDstPortRandom from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpDstPortRandom) Marshal() marshalPatternFlowTcpDstPortRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpDstPortRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpDstPortRandom) Unmarshal() unMarshalPatternFlowTcpDstPortRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpDstPortRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpDstPortRandom) ToProto() (*otg.PatternFlowTcpDstPortRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpDstPortRandom) FromProto(msg *otg.PatternFlowTcpDstPortRandom) (PatternFlowTcpDstPortRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpDstPortRandom) 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 *unMarshalpatternFlowTcpDstPortRandom) 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 *marshalpatternFlowTcpDstPortRandom) 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 *unMarshalpatternFlowTcpDstPortRandom) 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 *marshalpatternFlowTcpDstPortRandom) 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 *unMarshalpatternFlowTcpDstPortRandom) 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 *patternFlowTcpDstPortRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpDstPortRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpDstPortRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpDstPortRandom) Clone() (PatternFlowTcpDstPortRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpDstPortRandom() + 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 +} + +// PatternFlowTcpDstPortRandom is integer random pattern +type PatternFlowTcpDstPortRandom interface { + Validation + // msg marshals PatternFlowTcpDstPortRandom to protobuf object *otg.PatternFlowTcpDstPortRandom + // and doesn't set defaults + msg() *otg.PatternFlowTcpDstPortRandom + // setMsg unmarshals PatternFlowTcpDstPortRandom from protobuf object *otg.PatternFlowTcpDstPortRandom + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpDstPortRandom) PatternFlowTcpDstPortRandom + // provides marshal interface + Marshal() marshalPatternFlowTcpDstPortRandom + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpDstPortRandom + // validate validates PatternFlowTcpDstPortRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpDstPortRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns uint32, set in PatternFlowTcpDstPortRandom. + Min() uint32 + // SetMin assigns uint32 provided by user to PatternFlowTcpDstPortRandom + SetMin(value uint32) PatternFlowTcpDstPortRandom + // HasMin checks if Min has been set in PatternFlowTcpDstPortRandom + HasMin() bool + // Max returns uint32, set in PatternFlowTcpDstPortRandom. + Max() uint32 + // SetMax assigns uint32 provided by user to PatternFlowTcpDstPortRandom + SetMax(value uint32) PatternFlowTcpDstPortRandom + // HasMax checks if Max has been set in PatternFlowTcpDstPortRandom + HasMax() bool + // Seed returns uint32, set in PatternFlowTcpDstPortRandom. + Seed() uint32 + // SetSeed assigns uint32 provided by user to PatternFlowTcpDstPortRandom + SetSeed(value uint32) PatternFlowTcpDstPortRandom + // HasSeed checks if Seed has been set in PatternFlowTcpDstPortRandom + HasSeed() bool + // Count returns uint32, set in PatternFlowTcpDstPortRandom. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpDstPortRandom + SetCount(value uint32) PatternFlowTcpDstPortRandom + // HasCount checks if Count has been set in PatternFlowTcpDstPortRandom + HasCount() bool +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowTcpDstPortRandom) Min() uint32 { + + return *obj.obj.Min + +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowTcpDstPortRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// The minimum possible value generated by the random value generator. +// SetMin sets the uint32 value in the PatternFlowTcpDstPortRandom object +func (obj *patternFlowTcpDstPortRandom) SetMin(value uint32) PatternFlowTcpDstPortRandom { + + obj.obj.Min = &value + return obj +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowTcpDstPortRandom) Max() uint32 { + + return *obj.obj.Max + +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowTcpDstPortRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// The maximum possible value generated by the random value generator. +// SetMax sets the uint32 value in the PatternFlowTcpDstPortRandom object +func (obj *patternFlowTcpDstPortRandom) SetMax(value uint32) PatternFlowTcpDstPortRandom { + + obj.obj.Max = &value + return obj +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowTcpDstPortRandom) Seed() uint32 { + + return *obj.obj.Seed + +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowTcpDstPortRandom) HasSeed() bool { + return obj.obj.Seed != nil +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// SetSeed sets the uint32 value in the PatternFlowTcpDstPortRandom object +func (obj *patternFlowTcpDstPortRandom) SetSeed(value uint32) PatternFlowTcpDstPortRandom { + + obj.obj.Seed = &value + return obj +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowTcpDstPortRandom) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowTcpDstPortRandom) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of values to be generated by the random value generator. +// SetCount sets the uint32 value in the PatternFlowTcpDstPortRandom object +func (obj *patternFlowTcpDstPortRandom) SetCount(value uint32) PatternFlowTcpDstPortRandom { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpDstPortRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Min != nil { + + if *obj.obj.Min > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpDstPortRandom.Min <= 65535 but Got %d", *obj.obj.Min)) + } + + } + + if obj.obj.Max != nil { + + if *obj.obj.Max > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpDstPortRandom.Max <= 65535 but Got %d", *obj.obj.Max)) + } + + } + +} + +func (obj *patternFlowTcpDstPortRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin(0) + } + if obj.obj.Max == nil { + obj.SetMax(65535) + } + if obj.obj.Seed == nil { + obj.SetSeed(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} + // ***** PatternFlowTcpSeqNumCounter ***** type patternFlowTcpSeqNumCounter struct { validation @@ -269236,6 +271679,417 @@ func (obj *patternFlowUdpSrcPortMetricTag) setDefault() { } +// ***** PatternFlowUdpSrcPortRandom ***** +type patternFlowUdpSrcPortRandom struct { + validation + obj *otg.PatternFlowUdpSrcPortRandom + marshaller marshalPatternFlowUdpSrcPortRandom + unMarshaller unMarshalPatternFlowUdpSrcPortRandom +} + +func NewPatternFlowUdpSrcPortRandom() PatternFlowUdpSrcPortRandom { + obj := patternFlowUdpSrcPortRandom{obj: &otg.PatternFlowUdpSrcPortRandom{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowUdpSrcPortRandom) msg() *otg.PatternFlowUdpSrcPortRandom { + return obj.obj +} + +func (obj *patternFlowUdpSrcPortRandom) setMsg(msg *otg.PatternFlowUdpSrcPortRandom) PatternFlowUdpSrcPortRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowUdpSrcPortRandom struct { + obj *patternFlowUdpSrcPortRandom +} + +type marshalPatternFlowUdpSrcPortRandom interface { + // ToProto marshals PatternFlowUdpSrcPortRandom to protobuf object *otg.PatternFlowUdpSrcPortRandom + ToProto() (*otg.PatternFlowUdpSrcPortRandom, error) + // ToPbText marshals PatternFlowUdpSrcPortRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowUdpSrcPortRandom to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowUdpSrcPortRandom to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowUdpSrcPortRandom struct { + obj *patternFlowUdpSrcPortRandom +} + +type unMarshalPatternFlowUdpSrcPortRandom interface { + // FromProto unmarshals PatternFlowUdpSrcPortRandom from protobuf object *otg.PatternFlowUdpSrcPortRandom + FromProto(msg *otg.PatternFlowUdpSrcPortRandom) (PatternFlowUdpSrcPortRandom, error) + // FromPbText unmarshals PatternFlowUdpSrcPortRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowUdpSrcPortRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowUdpSrcPortRandom from JSON text + FromJson(value string) error +} + +func (obj *patternFlowUdpSrcPortRandom) Marshal() marshalPatternFlowUdpSrcPortRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowUdpSrcPortRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowUdpSrcPortRandom) Unmarshal() unMarshalPatternFlowUdpSrcPortRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowUdpSrcPortRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowUdpSrcPortRandom) ToProto() (*otg.PatternFlowUdpSrcPortRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowUdpSrcPortRandom) FromProto(msg *otg.PatternFlowUdpSrcPortRandom) (PatternFlowUdpSrcPortRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowUdpSrcPortRandom) 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 *unMarshalpatternFlowUdpSrcPortRandom) 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 *marshalpatternFlowUdpSrcPortRandom) 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 *unMarshalpatternFlowUdpSrcPortRandom) 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 *marshalpatternFlowUdpSrcPortRandom) 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 *unMarshalpatternFlowUdpSrcPortRandom) 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 *patternFlowUdpSrcPortRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowUdpSrcPortRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowUdpSrcPortRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowUdpSrcPortRandom) Clone() (PatternFlowUdpSrcPortRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowUdpSrcPortRandom() + 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 +} + +// PatternFlowUdpSrcPortRandom is integer random pattern +type PatternFlowUdpSrcPortRandom interface { + Validation + // msg marshals PatternFlowUdpSrcPortRandom to protobuf object *otg.PatternFlowUdpSrcPortRandom + // and doesn't set defaults + msg() *otg.PatternFlowUdpSrcPortRandom + // setMsg unmarshals PatternFlowUdpSrcPortRandom from protobuf object *otg.PatternFlowUdpSrcPortRandom + // and doesn't set defaults + setMsg(*otg.PatternFlowUdpSrcPortRandom) PatternFlowUdpSrcPortRandom + // provides marshal interface + Marshal() marshalPatternFlowUdpSrcPortRandom + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowUdpSrcPortRandom + // validate validates PatternFlowUdpSrcPortRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowUdpSrcPortRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns uint32, set in PatternFlowUdpSrcPortRandom. + Min() uint32 + // SetMin assigns uint32 provided by user to PatternFlowUdpSrcPortRandom + SetMin(value uint32) PatternFlowUdpSrcPortRandom + // HasMin checks if Min has been set in PatternFlowUdpSrcPortRandom + HasMin() bool + // Max returns uint32, set in PatternFlowUdpSrcPortRandom. + Max() uint32 + // SetMax assigns uint32 provided by user to PatternFlowUdpSrcPortRandom + SetMax(value uint32) PatternFlowUdpSrcPortRandom + // HasMax checks if Max has been set in PatternFlowUdpSrcPortRandom + HasMax() bool + // Seed returns uint32, set in PatternFlowUdpSrcPortRandom. + Seed() uint32 + // SetSeed assigns uint32 provided by user to PatternFlowUdpSrcPortRandom + SetSeed(value uint32) PatternFlowUdpSrcPortRandom + // HasSeed checks if Seed has been set in PatternFlowUdpSrcPortRandom + HasSeed() bool + // Count returns uint32, set in PatternFlowUdpSrcPortRandom. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowUdpSrcPortRandom + SetCount(value uint32) PatternFlowUdpSrcPortRandom + // HasCount checks if Count has been set in PatternFlowUdpSrcPortRandom + HasCount() bool +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) Min() uint32 { + + return *obj.obj.Min + +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// The minimum possible value generated by the random value generator. +// SetMin sets the uint32 value in the PatternFlowUdpSrcPortRandom object +func (obj *patternFlowUdpSrcPortRandom) SetMin(value uint32) PatternFlowUdpSrcPortRandom { + + obj.obj.Min = &value + return obj +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) Max() uint32 { + + return *obj.obj.Max + +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// The maximum possible value generated by the random value generator. +// SetMax sets the uint32 value in the PatternFlowUdpSrcPortRandom object +func (obj *patternFlowUdpSrcPortRandom) SetMax(value uint32) PatternFlowUdpSrcPortRandom { + + obj.obj.Max = &value + return obj +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) Seed() uint32 { + + return *obj.obj.Seed + +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) HasSeed() bool { + return obj.obj.Seed != nil +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// SetSeed sets the uint32 value in the PatternFlowUdpSrcPortRandom object +func (obj *patternFlowUdpSrcPortRandom) SetSeed(value uint32) PatternFlowUdpSrcPortRandom { + + obj.obj.Seed = &value + return obj +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of values to be generated by the random value generator. +// SetCount sets the uint32 value in the PatternFlowUdpSrcPortRandom object +func (obj *patternFlowUdpSrcPortRandom) SetCount(value uint32) PatternFlowUdpSrcPortRandom { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowUdpSrcPortRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Min != nil { + + if *obj.obj.Min > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpSrcPortRandom.Min <= 65535 but Got %d", *obj.obj.Min)) + } + + } + + if obj.obj.Max != nil { + + if *obj.obj.Max > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpSrcPortRandom.Max <= 65535 but Got %d", *obj.obj.Max)) + } + + } + +} + +func (obj *patternFlowUdpSrcPortRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin(0) + } + if obj.obj.Max == nil { + obj.SetMax(65535) + } + if obj.obj.Seed == nil { + obj.SetSeed(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} + // ***** PatternFlowUdpDstPortCounter ***** type patternFlowUdpDstPortCounter struct { validation @@ -270000,6 +272854,417 @@ func (obj *patternFlowUdpDstPortMetricTag) setDefault() { } +// ***** PatternFlowUdpDstPortRandom ***** +type patternFlowUdpDstPortRandom struct { + validation + obj *otg.PatternFlowUdpDstPortRandom + marshaller marshalPatternFlowUdpDstPortRandom + unMarshaller unMarshalPatternFlowUdpDstPortRandom +} + +func NewPatternFlowUdpDstPortRandom() PatternFlowUdpDstPortRandom { + obj := patternFlowUdpDstPortRandom{obj: &otg.PatternFlowUdpDstPortRandom{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowUdpDstPortRandom) msg() *otg.PatternFlowUdpDstPortRandom { + return obj.obj +} + +func (obj *patternFlowUdpDstPortRandom) setMsg(msg *otg.PatternFlowUdpDstPortRandom) PatternFlowUdpDstPortRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowUdpDstPortRandom struct { + obj *patternFlowUdpDstPortRandom +} + +type marshalPatternFlowUdpDstPortRandom interface { + // ToProto marshals PatternFlowUdpDstPortRandom to protobuf object *otg.PatternFlowUdpDstPortRandom + ToProto() (*otg.PatternFlowUdpDstPortRandom, error) + // ToPbText marshals PatternFlowUdpDstPortRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowUdpDstPortRandom to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowUdpDstPortRandom to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowUdpDstPortRandom struct { + obj *patternFlowUdpDstPortRandom +} + +type unMarshalPatternFlowUdpDstPortRandom interface { + // FromProto unmarshals PatternFlowUdpDstPortRandom from protobuf object *otg.PatternFlowUdpDstPortRandom + FromProto(msg *otg.PatternFlowUdpDstPortRandom) (PatternFlowUdpDstPortRandom, error) + // FromPbText unmarshals PatternFlowUdpDstPortRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowUdpDstPortRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowUdpDstPortRandom from JSON text + FromJson(value string) error +} + +func (obj *patternFlowUdpDstPortRandom) Marshal() marshalPatternFlowUdpDstPortRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowUdpDstPortRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowUdpDstPortRandom) Unmarshal() unMarshalPatternFlowUdpDstPortRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowUdpDstPortRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowUdpDstPortRandom) ToProto() (*otg.PatternFlowUdpDstPortRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowUdpDstPortRandom) FromProto(msg *otg.PatternFlowUdpDstPortRandom) (PatternFlowUdpDstPortRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowUdpDstPortRandom) 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 *unMarshalpatternFlowUdpDstPortRandom) 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 *marshalpatternFlowUdpDstPortRandom) 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 *unMarshalpatternFlowUdpDstPortRandom) 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 *marshalpatternFlowUdpDstPortRandom) 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 *unMarshalpatternFlowUdpDstPortRandom) 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 *patternFlowUdpDstPortRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowUdpDstPortRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowUdpDstPortRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowUdpDstPortRandom) Clone() (PatternFlowUdpDstPortRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowUdpDstPortRandom() + 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 +} + +// PatternFlowUdpDstPortRandom is integer random pattern +type PatternFlowUdpDstPortRandom interface { + Validation + // msg marshals PatternFlowUdpDstPortRandom to protobuf object *otg.PatternFlowUdpDstPortRandom + // and doesn't set defaults + msg() *otg.PatternFlowUdpDstPortRandom + // setMsg unmarshals PatternFlowUdpDstPortRandom from protobuf object *otg.PatternFlowUdpDstPortRandom + // and doesn't set defaults + setMsg(*otg.PatternFlowUdpDstPortRandom) PatternFlowUdpDstPortRandom + // provides marshal interface + Marshal() marshalPatternFlowUdpDstPortRandom + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowUdpDstPortRandom + // validate validates PatternFlowUdpDstPortRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowUdpDstPortRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns uint32, set in PatternFlowUdpDstPortRandom. + Min() uint32 + // SetMin assigns uint32 provided by user to PatternFlowUdpDstPortRandom + SetMin(value uint32) PatternFlowUdpDstPortRandom + // HasMin checks if Min has been set in PatternFlowUdpDstPortRandom + HasMin() bool + // Max returns uint32, set in PatternFlowUdpDstPortRandom. + Max() uint32 + // SetMax assigns uint32 provided by user to PatternFlowUdpDstPortRandom + SetMax(value uint32) PatternFlowUdpDstPortRandom + // HasMax checks if Max has been set in PatternFlowUdpDstPortRandom + HasMax() bool + // Seed returns uint32, set in PatternFlowUdpDstPortRandom. + Seed() uint32 + // SetSeed assigns uint32 provided by user to PatternFlowUdpDstPortRandom + SetSeed(value uint32) PatternFlowUdpDstPortRandom + // HasSeed checks if Seed has been set in PatternFlowUdpDstPortRandom + HasSeed() bool + // Count returns uint32, set in PatternFlowUdpDstPortRandom. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowUdpDstPortRandom + SetCount(value uint32) PatternFlowUdpDstPortRandom + // HasCount checks if Count has been set in PatternFlowUdpDstPortRandom + HasCount() bool +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowUdpDstPortRandom) Min() uint32 { + + return *obj.obj.Min + +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowUdpDstPortRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// The minimum possible value generated by the random value generator. +// SetMin sets the uint32 value in the PatternFlowUdpDstPortRandom object +func (obj *patternFlowUdpDstPortRandom) SetMin(value uint32) PatternFlowUdpDstPortRandom { + + obj.obj.Min = &value + return obj +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowUdpDstPortRandom) Max() uint32 { + + return *obj.obj.Max + +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowUdpDstPortRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// The maximum possible value generated by the random value generator. +// SetMax sets the uint32 value in the PatternFlowUdpDstPortRandom object +func (obj *patternFlowUdpDstPortRandom) SetMax(value uint32) PatternFlowUdpDstPortRandom { + + obj.obj.Max = &value + return obj +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowUdpDstPortRandom) Seed() uint32 { + + return *obj.obj.Seed + +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowUdpDstPortRandom) HasSeed() bool { + return obj.obj.Seed != nil +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// SetSeed sets the uint32 value in the PatternFlowUdpDstPortRandom object +func (obj *patternFlowUdpDstPortRandom) SetSeed(value uint32) PatternFlowUdpDstPortRandom { + + obj.obj.Seed = &value + return obj +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowUdpDstPortRandom) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowUdpDstPortRandom) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of values to be generated by the random value generator. +// SetCount sets the uint32 value in the PatternFlowUdpDstPortRandom object +func (obj *patternFlowUdpDstPortRandom) SetCount(value uint32) PatternFlowUdpDstPortRandom { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowUdpDstPortRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Min != nil { + + if *obj.obj.Min > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpDstPortRandom.Min <= 65535 but Got %d", *obj.obj.Min)) + } + + } + + if obj.obj.Max != nil { + + if *obj.obj.Max > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpDstPortRandom.Max <= 65535 but Got %d", *obj.obj.Max)) + } + + } + +} + +func (obj *patternFlowUdpDstPortRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin(0) + } + if obj.obj.Max == nil { + obj.SetMax(65535) + } + if obj.obj.Seed == nil { + obj.SetSeed(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} + // ***** PatternFlowUdpLengthCounter ***** type patternFlowUdpLengthCounter struct { validation @@ -400635,16 +403900,16 @@ type BgpAttributesCommunity interface { Choice() BgpAttributesCommunityChoiceEnum // setChoice assigns BgpAttributesCommunityChoiceEnum provided by user to BgpAttributesCommunity setChoice(value BgpAttributesCommunityChoiceEnum) BgpAttributesCommunity + // getter for NoLlgr to set choice. + NoLlgr() // getter for LlgrStale to set choice. LlgrStale() - // getter for NoExportSubconfed to set choice. - NoExportSubconfed() // getter for NoAdvertised to set choice. NoAdvertised() // getter for NoExport to set choice. NoExport() - // 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 @@ -400679,16 +403944,16 @@ func (obj *bgpAttributesCommunity) Choice() BgpAttributesCommunityChoiceEnum { return BgpAttributesCommunityChoiceEnum(obj.obj.Choice.Enum().String()) } +// 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 NoExportSubconfed to set choice -func (obj *bgpAttributesCommunity) NoExportSubconfed() { - obj.setChoice(BgpAttributesCommunityChoice.NO_EXPORT_SUBCONFED) -} - // getter for NoAdvertised to set choice func (obj *bgpAttributesCommunity) NoAdvertised() { obj.setChoice(BgpAttributesCommunityChoice.NO_ADVERTISED) @@ -400699,9 +403964,9 @@ func (obj *bgpAttributesCommunity) NoExport() { obj.setChoice(BgpAttributesCommunityChoice.NO_EXPORT) } -// getter for NoLlgr to set choice -func (obj *bgpAttributesCommunity) NoLlgr() { - obj.setChoice(BgpAttributesCommunityChoice.NO_LLGR) +// getter for NoExportSubconfed to set choice +func (obj *bgpAttributesCommunity) NoExportSubconfed() { + obj.setChoice(BgpAttributesCommunityChoice.NO_EXPORT_SUBCONFED) } func (obj *bgpAttributesCommunity) setChoice(value BgpAttributesCommunityChoiceEnum) BgpAttributesCommunity { @@ -422981,16 +426246,16 @@ type BgpAttributesSrPolicyExplicitNullPolicy interface { setChoice(value BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum) BgpAttributesSrPolicyExplicitNullPolicy // HasChoice checks if Choice has been set in BgpAttributesSrPolicyExplicitNullPolicy HasChoice() bool - // getter for Unknown to set choice. - Unknown() - // getter for PushIpv6 to set choice. - PushIpv6() + // getter for PushIpv4 to set choice. + PushIpv4() // getter for DonotPush to set choice. DonotPush() + // getter for Unknown to set choice. + Unknown() // getter for PushIpv4AndIpv6 to set choice. PushIpv4AndIpv6() - // getter for PushIpv4 to set choice. - PushIpv4() + // getter for PushIpv6 to set choice. + PushIpv6() } type BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum string @@ -423014,14 +426279,9 @@ func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Choice() BgpAttributesSrPoli return BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum(obj.obj.Choice.Enum().String()) } -// getter for Unknown to set choice -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Unknown() { - obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.UNKNOWN) -} - -// 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) } // getter for DonotPush to set choice @@ -423029,14 +426289,19 @@ func (obj *bgpAttributesSrPolicyExplicitNullPolicy) DonotPush() { obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.DONOT_PUSH) } +// getter for Unknown to set choice +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Unknown() { + obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.UNKNOWN) +} + // 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) } // The Explicit NULL Label policy. diff --git a/gosnappi/otg/otg.pb.go b/gosnappi/otg/otg.pb.go index 3e45e322..8361f219 100644 --- a/gosnappi/otg/otg.pb.go +++ b/gosnappi/otg/otg.pb.go @@ -1,4 +1,4 @@ -// Open Traffic Generator API 1.6.2 +// Open Traffic Generator API 1.7.0 // Open Traffic Generator API defines a model-driven, vendor-neutral and standard // interface for emulating layer 2-7 network devices and generating test traffic. // @@ -13234,9 +13234,10 @@ const ( PatternFlowIpv4Src_Choice_unspecified PatternFlowIpv4Src_Choice_Enum = 0 PatternFlowIpv4Src_Choice_value PatternFlowIpv4Src_Choice_Enum = 2 PatternFlowIpv4Src_Choice_values PatternFlowIpv4Src_Choice_Enum = 3 - PatternFlowIpv4Src_Choice_auto PatternFlowIpv4Src_Choice_Enum = 1 PatternFlowIpv4Src_Choice_increment PatternFlowIpv4Src_Choice_Enum = 4 PatternFlowIpv4Src_Choice_decrement PatternFlowIpv4Src_Choice_Enum = 5 + PatternFlowIpv4Src_Choice_auto PatternFlowIpv4Src_Choice_Enum = 1 + PatternFlowIpv4Src_Choice_random PatternFlowIpv4Src_Choice_Enum = 6 ) // Enum value maps for PatternFlowIpv4Src_Choice_Enum. @@ -13245,17 +13246,19 @@ var ( 0: "unspecified", 2: "value", 3: "values", - 1: "auto", 4: "increment", 5: "decrement", + 1: "auto", + 6: "random", } PatternFlowIpv4Src_Choice_Enum_value = map[string]int32{ "unspecified": 0, "value": 2, "values": 3, - "auto": 1, "increment": 4, "decrement": 5, + "auto": 1, + "random": 6, } ) @@ -13283,7 +13286,7 @@ func (x PatternFlowIpv4Src_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIpv4Src_Choice_Enum.Descriptor instead. func (PatternFlowIpv4Src_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{554, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{555, 0, 0} } type PatternFlowIpv4Dst_Choice_Enum int32 @@ -13292,9 +13295,10 @@ const ( PatternFlowIpv4Dst_Choice_unspecified PatternFlowIpv4Dst_Choice_Enum = 0 PatternFlowIpv4Dst_Choice_value PatternFlowIpv4Dst_Choice_Enum = 2 PatternFlowIpv4Dst_Choice_values PatternFlowIpv4Dst_Choice_Enum = 3 - PatternFlowIpv4Dst_Choice_auto PatternFlowIpv4Dst_Choice_Enum = 1 PatternFlowIpv4Dst_Choice_increment PatternFlowIpv4Dst_Choice_Enum = 4 PatternFlowIpv4Dst_Choice_decrement PatternFlowIpv4Dst_Choice_Enum = 5 + PatternFlowIpv4Dst_Choice_auto PatternFlowIpv4Dst_Choice_Enum = 1 + PatternFlowIpv4Dst_Choice_random PatternFlowIpv4Dst_Choice_Enum = 6 ) // Enum value maps for PatternFlowIpv4Dst_Choice_Enum. @@ -13303,17 +13307,19 @@ var ( 0: "unspecified", 2: "value", 3: "values", - 1: "auto", 4: "increment", 5: "decrement", + 1: "auto", + 6: "random", } PatternFlowIpv4Dst_Choice_Enum_value = map[string]int32{ "unspecified": 0, "value": 2, "values": 3, - "auto": 1, "increment": 4, "decrement": 5, + "auto": 1, + "random": 6, } ) @@ -13341,7 +13347,7 @@ func (x PatternFlowIpv4Dst_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIpv4Dst_Choice_Enum.Descriptor instead. func (PatternFlowIpv4Dst_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{557, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{559, 0, 0} } type PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice_Enum int32 @@ -13396,7 +13402,7 @@ func (x PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice_Enum) Number() protore // Deprecated: Use PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice_Enum.Descriptor instead. func (PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{559, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{561, 0, 0} } type PatternFlowIpv4OptionsCustomTypeOptionClass_Choice_Enum int32 @@ -13451,7 +13457,7 @@ func (x PatternFlowIpv4OptionsCustomTypeOptionClass_Choice_Enum) Number() protor // Deprecated: Use PatternFlowIpv4OptionsCustomTypeOptionClass_Choice_Enum.Descriptor instead. func (PatternFlowIpv4OptionsCustomTypeOptionClass_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{561, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{563, 0, 0} } type PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice_Enum int32 @@ -13506,7 +13512,7 @@ func (x PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice_Enum) Number() proto // Deprecated: Use PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice_Enum.Descriptor instead. func (PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{563, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{565, 0, 0} } type PatternFlowIpv4PriorityRaw_Choice_Enum int32 @@ -13561,7 +13567,7 @@ func (x PatternFlowIpv4PriorityRaw_Choice_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowIpv4PriorityRaw_Choice_Enum.Descriptor instead. func (PatternFlowIpv4PriorityRaw_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{566, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{568, 0, 0} } type PatternFlowIpv4DscpPhb_Choice_Enum int32 @@ -13616,7 +13622,7 @@ func (x PatternFlowIpv4DscpPhb_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIpv4DscpPhb_Choice_Enum.Descriptor instead. func (PatternFlowIpv4DscpPhb_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{569, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{571, 0, 0} } type PatternFlowIpv4DscpEcn_Choice_Enum int32 @@ -13671,7 +13677,7 @@ func (x PatternFlowIpv4DscpEcn_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIpv4DscpEcn_Choice_Enum.Descriptor instead. func (PatternFlowIpv4DscpEcn_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{572, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{574, 0, 0} } type PatternFlowIpv4TosPrecedence_Choice_Enum int32 @@ -13726,7 +13732,7 @@ func (x PatternFlowIpv4TosPrecedence_Choice_Enum) Number() protoreflect.EnumNumb // Deprecated: Use PatternFlowIpv4TosPrecedence_Choice_Enum.Descriptor instead. func (PatternFlowIpv4TosPrecedence_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{575, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{577, 0, 0} } type PatternFlowIpv4TosDelay_Choice_Enum int32 @@ -13781,7 +13787,7 @@ func (x PatternFlowIpv4TosDelay_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIpv4TosDelay_Choice_Enum.Descriptor instead. func (PatternFlowIpv4TosDelay_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{578, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{580, 0, 0} } type PatternFlowIpv4TosThroughput_Choice_Enum int32 @@ -13836,7 +13842,7 @@ func (x PatternFlowIpv4TosThroughput_Choice_Enum) Number() protoreflect.EnumNumb // Deprecated: Use PatternFlowIpv4TosThroughput_Choice_Enum.Descriptor instead. func (PatternFlowIpv4TosThroughput_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{581, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{583, 0, 0} } type PatternFlowIpv4TosReliability_Choice_Enum int32 @@ -13891,7 +13897,7 @@ func (x PatternFlowIpv4TosReliability_Choice_Enum) Number() protoreflect.EnumNum // Deprecated: Use PatternFlowIpv4TosReliability_Choice_Enum.Descriptor instead. func (PatternFlowIpv4TosReliability_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{584, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{586, 0, 0} } type PatternFlowIpv4TosMonetary_Choice_Enum int32 @@ -13946,7 +13952,7 @@ func (x PatternFlowIpv4TosMonetary_Choice_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowIpv4TosMonetary_Choice_Enum.Descriptor instead. func (PatternFlowIpv4TosMonetary_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{587, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{589, 0, 0} } type PatternFlowIpv4TosUnused_Choice_Enum int32 @@ -14001,7 +14007,7 @@ func (x PatternFlowIpv4TosUnused_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIpv4TosUnused_Choice_Enum.Descriptor instead. func (PatternFlowIpv4TosUnused_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{590, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{592, 0, 0} } type PatternFlowIpv6Version_Choice_Enum int32 @@ -14056,7 +14062,7 @@ func (x PatternFlowIpv6Version_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIpv6Version_Choice_Enum.Descriptor instead. func (PatternFlowIpv6Version_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{593, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{595, 0, 0} } type PatternFlowIpv6TrafficClass_Choice_Enum int32 @@ -14111,7 +14117,7 @@ func (x PatternFlowIpv6TrafficClass_Choice_Enum) Number() protoreflect.EnumNumbe // Deprecated: Use PatternFlowIpv6TrafficClass_Choice_Enum.Descriptor instead. func (PatternFlowIpv6TrafficClass_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{596, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{598, 0, 0} } type PatternFlowIpv6FlowLabel_Choice_Enum int32 @@ -14122,6 +14128,7 @@ const ( PatternFlowIpv6FlowLabel_Choice_values PatternFlowIpv6FlowLabel_Choice_Enum = 3 PatternFlowIpv6FlowLabel_Choice_increment PatternFlowIpv6FlowLabel_Choice_Enum = 4 PatternFlowIpv6FlowLabel_Choice_decrement PatternFlowIpv6FlowLabel_Choice_Enum = 5 + PatternFlowIpv6FlowLabel_Choice_random PatternFlowIpv6FlowLabel_Choice_Enum = 6 ) // Enum value maps for PatternFlowIpv6FlowLabel_Choice_Enum. @@ -14132,6 +14139,7 @@ var ( 3: "values", 4: "increment", 5: "decrement", + 6: "random", } PatternFlowIpv6FlowLabel_Choice_Enum_value = map[string]int32{ "unspecified": 0, @@ -14139,6 +14147,7 @@ var ( "values": 3, "increment": 4, "decrement": 5, + "random": 6, } ) @@ -14166,7 +14175,7 @@ func (x PatternFlowIpv6FlowLabel_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIpv6FlowLabel_Choice_Enum.Descriptor instead. func (PatternFlowIpv6FlowLabel_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{599, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{602, 0, 0} } type PatternFlowIpv6PayloadLength_Choice_Enum int32 @@ -14224,7 +14233,7 @@ func (x PatternFlowIpv6PayloadLength_Choice_Enum) Number() protoreflect.EnumNumb // Deprecated: Use PatternFlowIpv6PayloadLength_Choice_Enum.Descriptor instead. func (PatternFlowIpv6PayloadLength_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{602, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{605, 0, 0} } type PatternFlowIpv6NextHeader_Choice_Enum int32 @@ -14282,7 +14291,7 @@ func (x PatternFlowIpv6NextHeader_Choice_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowIpv6NextHeader_Choice_Enum.Descriptor instead. func (PatternFlowIpv6NextHeader_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{605, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{608, 0, 0} } type PatternFlowIpv6HopLimit_Choice_Enum int32 @@ -14337,7 +14346,7 @@ func (x PatternFlowIpv6HopLimit_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIpv6HopLimit_Choice_Enum.Descriptor instead. func (PatternFlowIpv6HopLimit_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{608, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{611, 0, 0} } type PatternFlowIpv6Src_Choice_Enum int32 @@ -14392,7 +14401,7 @@ func (x PatternFlowIpv6Src_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIpv6Src_Choice_Enum.Descriptor instead. func (PatternFlowIpv6Src_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{611, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{614, 0, 0} } type PatternFlowIpv6Dst_Choice_Enum int32 @@ -14447,7 +14456,7 @@ func (x PatternFlowIpv6Dst_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIpv6Dst_Choice_Enum.Descriptor instead. func (PatternFlowIpv6Dst_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{614, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{617, 0, 0} } type PatternFlowPfcPauseDst_Choice_Enum int32 @@ -14502,7 +14511,7 @@ func (x PatternFlowPfcPauseDst_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowPfcPauseDst_Choice_Enum.Descriptor instead. func (PatternFlowPfcPauseDst_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{617, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{620, 0, 0} } type PatternFlowPfcPauseSrc_Choice_Enum int32 @@ -14557,7 +14566,7 @@ func (x PatternFlowPfcPauseSrc_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowPfcPauseSrc_Choice_Enum.Descriptor instead. func (PatternFlowPfcPauseSrc_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{620, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{623, 0, 0} } type PatternFlowPfcPauseEtherType_Choice_Enum int32 @@ -14612,7 +14621,7 @@ func (x PatternFlowPfcPauseEtherType_Choice_Enum) Number() protoreflect.EnumNumb // Deprecated: Use PatternFlowPfcPauseEtherType_Choice_Enum.Descriptor instead. func (PatternFlowPfcPauseEtherType_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{623, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{626, 0, 0} } type PatternFlowPfcPauseControlOpCode_Choice_Enum int32 @@ -14667,7 +14676,7 @@ func (x PatternFlowPfcPauseControlOpCode_Choice_Enum) Number() protoreflect.Enum // Deprecated: Use PatternFlowPfcPauseControlOpCode_Choice_Enum.Descriptor instead. func (PatternFlowPfcPauseControlOpCode_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{626, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{629, 0, 0} } type PatternFlowPfcPauseClassEnableVector_Choice_Enum int32 @@ -14722,7 +14731,7 @@ func (x PatternFlowPfcPauseClassEnableVector_Choice_Enum) Number() protoreflect. // Deprecated: Use PatternFlowPfcPauseClassEnableVector_Choice_Enum.Descriptor instead. func (PatternFlowPfcPauseClassEnableVector_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{629, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{632, 0, 0} } type PatternFlowPfcPausePauseClass0_Choice_Enum int32 @@ -14777,7 +14786,7 @@ func (x PatternFlowPfcPausePauseClass0_Choice_Enum) Number() protoreflect.EnumNu // Deprecated: Use PatternFlowPfcPausePauseClass0_Choice_Enum.Descriptor instead. func (PatternFlowPfcPausePauseClass0_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{632, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{635, 0, 0} } type PatternFlowPfcPausePauseClass1_Choice_Enum int32 @@ -14832,7 +14841,7 @@ func (x PatternFlowPfcPausePauseClass1_Choice_Enum) Number() protoreflect.EnumNu // Deprecated: Use PatternFlowPfcPausePauseClass1_Choice_Enum.Descriptor instead. func (PatternFlowPfcPausePauseClass1_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{635, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{638, 0, 0} } type PatternFlowPfcPausePauseClass2_Choice_Enum int32 @@ -14887,7 +14896,7 @@ func (x PatternFlowPfcPausePauseClass2_Choice_Enum) Number() protoreflect.EnumNu // Deprecated: Use PatternFlowPfcPausePauseClass2_Choice_Enum.Descriptor instead. func (PatternFlowPfcPausePauseClass2_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{638, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{641, 0, 0} } type PatternFlowPfcPausePauseClass3_Choice_Enum int32 @@ -14942,7 +14951,7 @@ func (x PatternFlowPfcPausePauseClass3_Choice_Enum) Number() protoreflect.EnumNu // Deprecated: Use PatternFlowPfcPausePauseClass3_Choice_Enum.Descriptor instead. func (PatternFlowPfcPausePauseClass3_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{641, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{644, 0, 0} } type PatternFlowPfcPausePauseClass4_Choice_Enum int32 @@ -14997,7 +15006,7 @@ func (x PatternFlowPfcPausePauseClass4_Choice_Enum) Number() protoreflect.EnumNu // Deprecated: Use PatternFlowPfcPausePauseClass4_Choice_Enum.Descriptor instead. func (PatternFlowPfcPausePauseClass4_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{644, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{647, 0, 0} } type PatternFlowPfcPausePauseClass5_Choice_Enum int32 @@ -15052,7 +15061,7 @@ func (x PatternFlowPfcPausePauseClass5_Choice_Enum) Number() protoreflect.EnumNu // Deprecated: Use PatternFlowPfcPausePauseClass5_Choice_Enum.Descriptor instead. func (PatternFlowPfcPausePauseClass5_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{647, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{650, 0, 0} } type PatternFlowPfcPausePauseClass6_Choice_Enum int32 @@ -15107,7 +15116,7 @@ func (x PatternFlowPfcPausePauseClass6_Choice_Enum) Number() protoreflect.EnumNu // Deprecated: Use PatternFlowPfcPausePauseClass6_Choice_Enum.Descriptor instead. func (PatternFlowPfcPausePauseClass6_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{650, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{653, 0, 0} } type PatternFlowPfcPausePauseClass7_Choice_Enum int32 @@ -15162,7 +15171,7 @@ func (x PatternFlowPfcPausePauseClass7_Choice_Enum) Number() protoreflect.EnumNu // Deprecated: Use PatternFlowPfcPausePauseClass7_Choice_Enum.Descriptor instead. func (PatternFlowPfcPausePauseClass7_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{653, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{656, 0, 0} } type PatternFlowEthernetPauseDst_Choice_Enum int32 @@ -15217,7 +15226,7 @@ func (x PatternFlowEthernetPauseDst_Choice_Enum) Number() protoreflect.EnumNumbe // Deprecated: Use PatternFlowEthernetPauseDst_Choice_Enum.Descriptor instead. func (PatternFlowEthernetPauseDst_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{656, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{659, 0, 0} } type PatternFlowEthernetPauseSrc_Choice_Enum int32 @@ -15272,7 +15281,7 @@ func (x PatternFlowEthernetPauseSrc_Choice_Enum) Number() protoreflect.EnumNumbe // Deprecated: Use PatternFlowEthernetPauseSrc_Choice_Enum.Descriptor instead. func (PatternFlowEthernetPauseSrc_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{659, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{662, 0, 0} } type PatternFlowEthernetPauseEtherType_Choice_Enum int32 @@ -15327,7 +15336,7 @@ func (x PatternFlowEthernetPauseEtherType_Choice_Enum) Number() protoreflect.Enu // Deprecated: Use PatternFlowEthernetPauseEtherType_Choice_Enum.Descriptor instead. func (PatternFlowEthernetPauseEtherType_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{662, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{665, 0, 0} } type PatternFlowEthernetPauseControlOpCode_Choice_Enum int32 @@ -15382,7 +15391,7 @@ func (x PatternFlowEthernetPauseControlOpCode_Choice_Enum) Number() protoreflect // Deprecated: Use PatternFlowEthernetPauseControlOpCode_Choice_Enum.Descriptor instead. func (PatternFlowEthernetPauseControlOpCode_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{665, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{668, 0, 0} } type PatternFlowEthernetPauseTime_Choice_Enum int32 @@ -15437,7 +15446,7 @@ func (x PatternFlowEthernetPauseTime_Choice_Enum) Number() protoreflect.EnumNumb // Deprecated: Use PatternFlowEthernetPauseTime_Choice_Enum.Descriptor instead. func (PatternFlowEthernetPauseTime_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{668, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{671, 0, 0} } type PatternFlowTcpSrcPort_Choice_Enum int32 @@ -15448,6 +15457,7 @@ const ( PatternFlowTcpSrcPort_Choice_values PatternFlowTcpSrcPort_Choice_Enum = 3 PatternFlowTcpSrcPort_Choice_increment PatternFlowTcpSrcPort_Choice_Enum = 4 PatternFlowTcpSrcPort_Choice_decrement PatternFlowTcpSrcPort_Choice_Enum = 5 + PatternFlowTcpSrcPort_Choice_random PatternFlowTcpSrcPort_Choice_Enum = 6 ) // Enum value maps for PatternFlowTcpSrcPort_Choice_Enum. @@ -15458,6 +15468,7 @@ var ( 3: "values", 4: "increment", 5: "decrement", + 6: "random", } PatternFlowTcpSrcPort_Choice_Enum_value = map[string]int32{ "unspecified": 0, @@ -15465,6 +15476,7 @@ var ( "values": 3, "increment": 4, "decrement": 5, + "random": 6, } ) @@ -15492,7 +15504,7 @@ func (x PatternFlowTcpSrcPort_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpSrcPort_Choice_Enum.Descriptor instead. func (PatternFlowTcpSrcPort_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{671, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{675, 0, 0} } type PatternFlowTcpDstPort_Choice_Enum int32 @@ -15503,6 +15515,7 @@ const ( PatternFlowTcpDstPort_Choice_values PatternFlowTcpDstPort_Choice_Enum = 3 PatternFlowTcpDstPort_Choice_increment PatternFlowTcpDstPort_Choice_Enum = 4 PatternFlowTcpDstPort_Choice_decrement PatternFlowTcpDstPort_Choice_Enum = 5 + PatternFlowTcpDstPort_Choice_random PatternFlowTcpDstPort_Choice_Enum = 6 ) // Enum value maps for PatternFlowTcpDstPort_Choice_Enum. @@ -15513,6 +15526,7 @@ var ( 3: "values", 4: "increment", 5: "decrement", + 6: "random", } PatternFlowTcpDstPort_Choice_Enum_value = map[string]int32{ "unspecified": 0, @@ -15520,6 +15534,7 @@ var ( "values": 3, "increment": 4, "decrement": 5, + "random": 6, } ) @@ -15547,7 +15562,7 @@ func (x PatternFlowTcpDstPort_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpDstPort_Choice_Enum.Descriptor instead. func (PatternFlowTcpDstPort_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{674, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{679, 0, 0} } type PatternFlowTcpSeqNum_Choice_Enum int32 @@ -15602,7 +15617,7 @@ func (x PatternFlowTcpSeqNum_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpSeqNum_Choice_Enum.Descriptor instead. func (PatternFlowTcpSeqNum_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{677, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{682, 0, 0} } type PatternFlowTcpAckNum_Choice_Enum int32 @@ -15657,7 +15672,7 @@ func (x PatternFlowTcpAckNum_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpAckNum_Choice_Enum.Descriptor instead. func (PatternFlowTcpAckNum_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{680, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{685, 0, 0} } type PatternFlowTcpDataOffset_Choice_Enum int32 @@ -15712,7 +15727,7 @@ func (x PatternFlowTcpDataOffset_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpDataOffset_Choice_Enum.Descriptor instead. func (PatternFlowTcpDataOffset_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{683, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{688, 0, 0} } type PatternFlowTcpEcnNs_Choice_Enum int32 @@ -15767,7 +15782,7 @@ func (x PatternFlowTcpEcnNs_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpEcnNs_Choice_Enum.Descriptor instead. func (PatternFlowTcpEcnNs_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{686, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{691, 0, 0} } type PatternFlowTcpEcnCwr_Choice_Enum int32 @@ -15822,7 +15837,7 @@ func (x PatternFlowTcpEcnCwr_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpEcnCwr_Choice_Enum.Descriptor instead. func (PatternFlowTcpEcnCwr_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{689, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{694, 0, 0} } type PatternFlowTcpEcnEcho_Choice_Enum int32 @@ -15877,7 +15892,7 @@ func (x PatternFlowTcpEcnEcho_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpEcnEcho_Choice_Enum.Descriptor instead. func (PatternFlowTcpEcnEcho_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{692, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{697, 0, 0} } type PatternFlowTcpCtlUrg_Choice_Enum int32 @@ -15932,7 +15947,7 @@ func (x PatternFlowTcpCtlUrg_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpCtlUrg_Choice_Enum.Descriptor instead. func (PatternFlowTcpCtlUrg_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{695, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{700, 0, 0} } type PatternFlowTcpCtlAck_Choice_Enum int32 @@ -15987,7 +16002,7 @@ func (x PatternFlowTcpCtlAck_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpCtlAck_Choice_Enum.Descriptor instead. func (PatternFlowTcpCtlAck_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{698, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{703, 0, 0} } type PatternFlowTcpCtlPsh_Choice_Enum int32 @@ -16042,7 +16057,7 @@ func (x PatternFlowTcpCtlPsh_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpCtlPsh_Choice_Enum.Descriptor instead. func (PatternFlowTcpCtlPsh_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{701, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{706, 0, 0} } type PatternFlowTcpCtlRst_Choice_Enum int32 @@ -16097,7 +16112,7 @@ func (x PatternFlowTcpCtlRst_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpCtlRst_Choice_Enum.Descriptor instead. func (PatternFlowTcpCtlRst_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{704, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{709, 0, 0} } type PatternFlowTcpCtlSyn_Choice_Enum int32 @@ -16152,7 +16167,7 @@ func (x PatternFlowTcpCtlSyn_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpCtlSyn_Choice_Enum.Descriptor instead. func (PatternFlowTcpCtlSyn_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{707, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{712, 0, 0} } type PatternFlowTcpCtlFin_Choice_Enum int32 @@ -16207,7 +16222,7 @@ func (x PatternFlowTcpCtlFin_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpCtlFin_Choice_Enum.Descriptor instead. func (PatternFlowTcpCtlFin_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{710, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{715, 0, 0} } type PatternFlowTcpWindow_Choice_Enum int32 @@ -16262,7 +16277,7 @@ func (x PatternFlowTcpWindow_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpWindow_Choice_Enum.Descriptor instead. func (PatternFlowTcpWindow_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{713, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{718, 0, 0} } type PatternFlowTcpChecksum_Choice_Enum int32 @@ -16311,7 +16326,7 @@ func (x PatternFlowTcpChecksum_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowTcpChecksum_Choice_Enum.Descriptor instead. func (PatternFlowTcpChecksum_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{714, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{719, 0, 0} } type PatternFlowTcpChecksum_Generated_Enum int32 @@ -16360,7 +16375,7 @@ func (x PatternFlowTcpChecksum_Generated_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowTcpChecksum_Generated_Enum.Descriptor instead. func (PatternFlowTcpChecksum_Generated_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{714, 1, 0} + return file_otg_proto_rawDescGZIP(), []int{719, 1, 0} } type PatternFlowUdpSrcPort_Choice_Enum int32 @@ -16371,6 +16386,7 @@ const ( PatternFlowUdpSrcPort_Choice_values PatternFlowUdpSrcPort_Choice_Enum = 3 PatternFlowUdpSrcPort_Choice_increment PatternFlowUdpSrcPort_Choice_Enum = 4 PatternFlowUdpSrcPort_Choice_decrement PatternFlowUdpSrcPort_Choice_Enum = 5 + PatternFlowUdpSrcPort_Choice_random PatternFlowUdpSrcPort_Choice_Enum = 6 ) // Enum value maps for PatternFlowUdpSrcPort_Choice_Enum. @@ -16381,6 +16397,7 @@ var ( 3: "values", 4: "increment", 5: "decrement", + 6: "random", } PatternFlowUdpSrcPort_Choice_Enum_value = map[string]int32{ "unspecified": 0, @@ -16388,6 +16405,7 @@ var ( "values": 3, "increment": 4, "decrement": 5, + "random": 6, } ) @@ -16415,7 +16433,7 @@ func (x PatternFlowUdpSrcPort_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowUdpSrcPort_Choice_Enum.Descriptor instead. func (PatternFlowUdpSrcPort_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{717, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{723, 0, 0} } type PatternFlowUdpDstPort_Choice_Enum int32 @@ -16426,6 +16444,7 @@ const ( PatternFlowUdpDstPort_Choice_values PatternFlowUdpDstPort_Choice_Enum = 3 PatternFlowUdpDstPort_Choice_increment PatternFlowUdpDstPort_Choice_Enum = 4 PatternFlowUdpDstPort_Choice_decrement PatternFlowUdpDstPort_Choice_Enum = 5 + PatternFlowUdpDstPort_Choice_random PatternFlowUdpDstPort_Choice_Enum = 6 ) // Enum value maps for PatternFlowUdpDstPort_Choice_Enum. @@ -16436,6 +16455,7 @@ var ( 3: "values", 4: "increment", 5: "decrement", + 6: "random", } PatternFlowUdpDstPort_Choice_Enum_value = map[string]int32{ "unspecified": 0, @@ -16443,6 +16463,7 @@ var ( "values": 3, "increment": 4, "decrement": 5, + "random": 6, } ) @@ -16470,7 +16491,7 @@ func (x PatternFlowUdpDstPort_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowUdpDstPort_Choice_Enum.Descriptor instead. func (PatternFlowUdpDstPort_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{720, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{727, 0, 0} } type PatternFlowUdpLength_Choice_Enum int32 @@ -16525,7 +16546,7 @@ func (x PatternFlowUdpLength_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowUdpLength_Choice_Enum.Descriptor instead. func (PatternFlowUdpLength_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{723, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{730, 0, 0} } type PatternFlowUdpChecksum_Choice_Enum int32 @@ -16574,7 +16595,7 @@ func (x PatternFlowUdpChecksum_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowUdpChecksum_Choice_Enum.Descriptor instead. func (PatternFlowUdpChecksum_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{724, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{731, 0, 0} } type PatternFlowUdpChecksum_Generated_Enum int32 @@ -16623,7 +16644,7 @@ func (x PatternFlowUdpChecksum_Generated_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowUdpChecksum_Generated_Enum.Descriptor instead. func (PatternFlowUdpChecksum_Generated_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{724, 1, 0} + return file_otg_proto_rawDescGZIP(), []int{731, 1, 0} } type PatternFlowGreChecksumPresent_Choice_Enum int32 @@ -16678,7 +16699,7 @@ func (x PatternFlowGreChecksumPresent_Choice_Enum) Number() protoreflect.EnumNum // Deprecated: Use PatternFlowGreChecksumPresent_Choice_Enum.Descriptor instead. func (PatternFlowGreChecksumPresent_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{727, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{734, 0, 0} } type PatternFlowGreReserved0_Choice_Enum int32 @@ -16733,7 +16754,7 @@ func (x PatternFlowGreReserved0_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGreReserved0_Choice_Enum.Descriptor instead. func (PatternFlowGreReserved0_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{730, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{737, 0, 0} } type PatternFlowGreVersion_Choice_Enum int32 @@ -16788,7 +16809,7 @@ func (x PatternFlowGreVersion_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGreVersion_Choice_Enum.Descriptor instead. func (PatternFlowGreVersion_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{733, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{740, 0, 0} } type PatternFlowGreProtocol_Choice_Enum int32 @@ -16843,7 +16864,7 @@ func (x PatternFlowGreProtocol_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGreProtocol_Choice_Enum.Descriptor instead. func (PatternFlowGreProtocol_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{736, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{743, 0, 0} } type PatternFlowGreChecksum_Choice_Enum int32 @@ -16892,7 +16913,7 @@ func (x PatternFlowGreChecksum_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGreChecksum_Choice_Enum.Descriptor instead. func (PatternFlowGreChecksum_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{737, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{744, 0, 0} } type PatternFlowGreChecksum_Generated_Enum int32 @@ -16941,7 +16962,7 @@ func (x PatternFlowGreChecksum_Generated_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowGreChecksum_Generated_Enum.Descriptor instead. func (PatternFlowGreChecksum_Generated_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{737, 1, 0} + return file_otg_proto_rawDescGZIP(), []int{744, 1, 0} } type PatternFlowGreReserved1_Choice_Enum int32 @@ -16996,7 +17017,7 @@ func (x PatternFlowGreReserved1_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGreReserved1_Choice_Enum.Descriptor instead. func (PatternFlowGreReserved1_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{740, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{747, 0, 0} } type PatternFlowGtpv1Version_Choice_Enum int32 @@ -17051,7 +17072,7 @@ func (x PatternFlowGtpv1Version_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGtpv1Version_Choice_Enum.Descriptor instead. func (PatternFlowGtpv1Version_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{743, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{750, 0, 0} } type PatternFlowGtpv1ProtocolType_Choice_Enum int32 @@ -17106,7 +17127,7 @@ func (x PatternFlowGtpv1ProtocolType_Choice_Enum) Number() protoreflect.EnumNumb // Deprecated: Use PatternFlowGtpv1ProtocolType_Choice_Enum.Descriptor instead. func (PatternFlowGtpv1ProtocolType_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{746, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{753, 0, 0} } type PatternFlowGtpv1Reserved_Choice_Enum int32 @@ -17161,7 +17182,7 @@ func (x PatternFlowGtpv1Reserved_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGtpv1Reserved_Choice_Enum.Descriptor instead. func (PatternFlowGtpv1Reserved_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{749, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{756, 0, 0} } type PatternFlowGtpv1EFlag_Choice_Enum int32 @@ -17216,7 +17237,7 @@ func (x PatternFlowGtpv1EFlag_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGtpv1EFlag_Choice_Enum.Descriptor instead. func (PatternFlowGtpv1EFlag_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{752, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{759, 0, 0} } type PatternFlowGtpv1SFlag_Choice_Enum int32 @@ -17271,7 +17292,7 @@ func (x PatternFlowGtpv1SFlag_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGtpv1SFlag_Choice_Enum.Descriptor instead. func (PatternFlowGtpv1SFlag_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{755, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{762, 0, 0} } type PatternFlowGtpv1PnFlag_Choice_Enum int32 @@ -17326,7 +17347,7 @@ func (x PatternFlowGtpv1PnFlag_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGtpv1PnFlag_Choice_Enum.Descriptor instead. func (PatternFlowGtpv1PnFlag_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{758, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{765, 0, 0} } type PatternFlowGtpv1MessageType_Choice_Enum int32 @@ -17381,7 +17402,7 @@ func (x PatternFlowGtpv1MessageType_Choice_Enum) Number() protoreflect.EnumNumbe // Deprecated: Use PatternFlowGtpv1MessageType_Choice_Enum.Descriptor instead. func (PatternFlowGtpv1MessageType_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{761, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{768, 0, 0} } type PatternFlowGtpv1MessageLength_Choice_Enum int32 @@ -17436,7 +17457,7 @@ func (x PatternFlowGtpv1MessageLength_Choice_Enum) Number() protoreflect.EnumNum // Deprecated: Use PatternFlowGtpv1MessageLength_Choice_Enum.Descriptor instead. func (PatternFlowGtpv1MessageLength_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{764, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{771, 0, 0} } type PatternFlowGtpv1Teid_Choice_Enum int32 @@ -17491,7 +17512,7 @@ func (x PatternFlowGtpv1Teid_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGtpv1Teid_Choice_Enum.Descriptor instead. func (PatternFlowGtpv1Teid_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{767, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{774, 0, 0} } type PatternFlowGtpv1SquenceNumber_Choice_Enum int32 @@ -17546,7 +17567,7 @@ func (x PatternFlowGtpv1SquenceNumber_Choice_Enum) Number() protoreflect.EnumNum // Deprecated: Use PatternFlowGtpv1SquenceNumber_Choice_Enum.Descriptor instead. func (PatternFlowGtpv1SquenceNumber_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{770, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{777, 0, 0} } type PatternFlowGtpv1NPduNumber_Choice_Enum int32 @@ -17601,7 +17622,7 @@ func (x PatternFlowGtpv1NPduNumber_Choice_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowGtpv1NPduNumber_Choice_Enum.Descriptor instead. func (PatternFlowGtpv1NPduNumber_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{773, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{780, 0, 0} } type PatternFlowGtpv1NextExtensionHeaderType_Choice_Enum int32 @@ -17656,7 +17677,7 @@ func (x PatternFlowGtpv1NextExtensionHeaderType_Choice_Enum) Number() protorefle // Deprecated: Use PatternFlowGtpv1NextExtensionHeaderType_Choice_Enum.Descriptor instead. func (PatternFlowGtpv1NextExtensionHeaderType_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{776, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{783, 0, 0} } type PatternFlowGtpExtensionExtensionLength_Choice_Enum int32 @@ -17711,7 +17732,7 @@ func (x PatternFlowGtpExtensionExtensionLength_Choice_Enum) Number() protoreflec // Deprecated: Use PatternFlowGtpExtensionExtensionLength_Choice_Enum.Descriptor instead. func (PatternFlowGtpExtensionExtensionLength_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{779, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{786, 0, 0} } type PatternFlowGtpExtensionContents_Choice_Enum int32 @@ -17766,7 +17787,7 @@ func (x PatternFlowGtpExtensionContents_Choice_Enum) Number() protoreflect.EnumN // Deprecated: Use PatternFlowGtpExtensionContents_Choice_Enum.Descriptor instead. func (PatternFlowGtpExtensionContents_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{782, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{789, 0, 0} } type PatternFlowGtpExtensionNextExtensionHeader_Choice_Enum int32 @@ -17821,7 +17842,7 @@ func (x PatternFlowGtpExtensionNextExtensionHeader_Choice_Enum) Number() protore // Deprecated: Use PatternFlowGtpExtensionNextExtensionHeader_Choice_Enum.Descriptor instead. func (PatternFlowGtpExtensionNextExtensionHeader_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{785, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{792, 0, 0} } type PatternFlowGtpv2Version_Choice_Enum int32 @@ -17876,7 +17897,7 @@ func (x PatternFlowGtpv2Version_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGtpv2Version_Choice_Enum.Descriptor instead. func (PatternFlowGtpv2Version_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{788, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{795, 0, 0} } type PatternFlowGtpv2PiggybackingFlag_Choice_Enum int32 @@ -17931,7 +17952,7 @@ func (x PatternFlowGtpv2PiggybackingFlag_Choice_Enum) Number() protoreflect.Enum // Deprecated: Use PatternFlowGtpv2PiggybackingFlag_Choice_Enum.Descriptor instead. func (PatternFlowGtpv2PiggybackingFlag_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{791, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{798, 0, 0} } type PatternFlowGtpv2TeidFlag_Choice_Enum int32 @@ -17986,7 +18007,7 @@ func (x PatternFlowGtpv2TeidFlag_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGtpv2TeidFlag_Choice_Enum.Descriptor instead. func (PatternFlowGtpv2TeidFlag_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{794, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{801, 0, 0} } type PatternFlowGtpv2Spare1_Choice_Enum int32 @@ -18041,7 +18062,7 @@ func (x PatternFlowGtpv2Spare1_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGtpv2Spare1_Choice_Enum.Descriptor instead. func (PatternFlowGtpv2Spare1_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{797, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{804, 0, 0} } type PatternFlowGtpv2MessageType_Choice_Enum int32 @@ -18096,7 +18117,7 @@ func (x PatternFlowGtpv2MessageType_Choice_Enum) Number() protoreflect.EnumNumbe // Deprecated: Use PatternFlowGtpv2MessageType_Choice_Enum.Descriptor instead. func (PatternFlowGtpv2MessageType_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{800, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{807, 0, 0} } type PatternFlowGtpv2MessageLength_Choice_Enum int32 @@ -18151,7 +18172,7 @@ func (x PatternFlowGtpv2MessageLength_Choice_Enum) Number() protoreflect.EnumNum // Deprecated: Use PatternFlowGtpv2MessageLength_Choice_Enum.Descriptor instead. func (PatternFlowGtpv2MessageLength_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{803, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{810, 0, 0} } type PatternFlowGtpv2Teid_Choice_Enum int32 @@ -18206,7 +18227,7 @@ func (x PatternFlowGtpv2Teid_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGtpv2Teid_Choice_Enum.Descriptor instead. func (PatternFlowGtpv2Teid_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{806, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{813, 0, 0} } type PatternFlowGtpv2SequenceNumber_Choice_Enum int32 @@ -18261,7 +18282,7 @@ func (x PatternFlowGtpv2SequenceNumber_Choice_Enum) Number() protoreflect.EnumNu // Deprecated: Use PatternFlowGtpv2SequenceNumber_Choice_Enum.Descriptor instead. func (PatternFlowGtpv2SequenceNumber_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{809, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{816, 0, 0} } type PatternFlowGtpv2Spare2_Choice_Enum int32 @@ -18316,7 +18337,7 @@ func (x PatternFlowGtpv2Spare2_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowGtpv2Spare2_Choice_Enum.Descriptor instead. func (PatternFlowGtpv2Spare2_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{812, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{819, 0, 0} } type PatternFlowArpHardwareType_Choice_Enum int32 @@ -18371,7 +18392,7 @@ func (x PatternFlowArpHardwareType_Choice_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowArpHardwareType_Choice_Enum.Descriptor instead. func (PatternFlowArpHardwareType_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{815, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{822, 0, 0} } type PatternFlowArpProtocolType_Choice_Enum int32 @@ -18426,7 +18447,7 @@ func (x PatternFlowArpProtocolType_Choice_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowArpProtocolType_Choice_Enum.Descriptor instead. func (PatternFlowArpProtocolType_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{818, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{825, 0, 0} } type PatternFlowArpHardwareLength_Choice_Enum int32 @@ -18481,7 +18502,7 @@ func (x PatternFlowArpHardwareLength_Choice_Enum) Number() protoreflect.EnumNumb // Deprecated: Use PatternFlowArpHardwareLength_Choice_Enum.Descriptor instead. func (PatternFlowArpHardwareLength_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{821, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{828, 0, 0} } type PatternFlowArpProtocolLength_Choice_Enum int32 @@ -18536,7 +18557,7 @@ func (x PatternFlowArpProtocolLength_Choice_Enum) Number() protoreflect.EnumNumb // Deprecated: Use PatternFlowArpProtocolLength_Choice_Enum.Descriptor instead. func (PatternFlowArpProtocolLength_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{824, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{831, 0, 0} } type PatternFlowArpOperation_Choice_Enum int32 @@ -18591,7 +18612,7 @@ func (x PatternFlowArpOperation_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowArpOperation_Choice_Enum.Descriptor instead. func (PatternFlowArpOperation_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{827, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{834, 0, 0} } type PatternFlowArpSenderHardwareAddr_Choice_Enum int32 @@ -18646,7 +18667,7 @@ func (x PatternFlowArpSenderHardwareAddr_Choice_Enum) Number() protoreflect.Enum // Deprecated: Use PatternFlowArpSenderHardwareAddr_Choice_Enum.Descriptor instead. func (PatternFlowArpSenderHardwareAddr_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{830, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{837, 0, 0} } type PatternFlowArpSenderProtocolAddr_Choice_Enum int32 @@ -18701,7 +18722,7 @@ func (x PatternFlowArpSenderProtocolAddr_Choice_Enum) Number() protoreflect.Enum // Deprecated: Use PatternFlowArpSenderProtocolAddr_Choice_Enum.Descriptor instead. func (PatternFlowArpSenderProtocolAddr_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{833, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{840, 0, 0} } type PatternFlowArpTargetHardwareAddr_Choice_Enum int32 @@ -18756,7 +18777,7 @@ func (x PatternFlowArpTargetHardwareAddr_Choice_Enum) Number() protoreflect.Enum // Deprecated: Use PatternFlowArpTargetHardwareAddr_Choice_Enum.Descriptor instead. func (PatternFlowArpTargetHardwareAddr_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{836, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{843, 0, 0} } type PatternFlowArpTargetProtocolAddr_Choice_Enum int32 @@ -18811,7 +18832,7 @@ func (x PatternFlowArpTargetProtocolAddr_Choice_Enum) Number() protoreflect.Enum // Deprecated: Use PatternFlowArpTargetProtocolAddr_Choice_Enum.Descriptor instead. func (PatternFlowArpTargetProtocolAddr_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{839, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{846, 0, 0} } type PatternFlowIcmpEchoType_Choice_Enum int32 @@ -18866,7 +18887,7 @@ func (x PatternFlowIcmpEchoType_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIcmpEchoType_Choice_Enum.Descriptor instead. func (PatternFlowIcmpEchoType_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{842, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{849, 0, 0} } type PatternFlowIcmpEchoCode_Choice_Enum int32 @@ -18921,7 +18942,7 @@ func (x PatternFlowIcmpEchoCode_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIcmpEchoCode_Choice_Enum.Descriptor instead. func (PatternFlowIcmpEchoCode_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{845, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{852, 0, 0} } type PatternFlowIcmpEchoChecksum_Choice_Enum int32 @@ -18970,7 +18991,7 @@ func (x PatternFlowIcmpEchoChecksum_Choice_Enum) Number() protoreflect.EnumNumbe // Deprecated: Use PatternFlowIcmpEchoChecksum_Choice_Enum.Descriptor instead. func (PatternFlowIcmpEchoChecksum_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{846, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{853, 0, 0} } type PatternFlowIcmpEchoChecksum_Generated_Enum int32 @@ -19019,7 +19040,7 @@ func (x PatternFlowIcmpEchoChecksum_Generated_Enum) Number() protoreflect.EnumNu // Deprecated: Use PatternFlowIcmpEchoChecksum_Generated_Enum.Descriptor instead. func (PatternFlowIcmpEchoChecksum_Generated_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{846, 1, 0} + return file_otg_proto_rawDescGZIP(), []int{853, 1, 0} } type PatternFlowIcmpEchoIdentifier_Choice_Enum int32 @@ -19074,7 +19095,7 @@ func (x PatternFlowIcmpEchoIdentifier_Choice_Enum) Number() protoreflect.EnumNum // Deprecated: Use PatternFlowIcmpEchoIdentifier_Choice_Enum.Descriptor instead. func (PatternFlowIcmpEchoIdentifier_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{849, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{856, 0, 0} } type PatternFlowIcmpEchoSequenceNumber_Choice_Enum int32 @@ -19129,7 +19150,7 @@ func (x PatternFlowIcmpEchoSequenceNumber_Choice_Enum) Number() protoreflect.Enu // Deprecated: Use PatternFlowIcmpEchoSequenceNumber_Choice_Enum.Descriptor instead. func (PatternFlowIcmpEchoSequenceNumber_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{852, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{859, 0, 0} } type PatternFlowIcmpCommonChecksum_Choice_Enum int32 @@ -19178,7 +19199,7 @@ func (x PatternFlowIcmpCommonChecksum_Choice_Enum) Number() protoreflect.EnumNum // Deprecated: Use PatternFlowIcmpCommonChecksum_Choice_Enum.Descriptor instead. func (PatternFlowIcmpCommonChecksum_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{853, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{860, 0, 0} } type PatternFlowIcmpCommonChecksum_Generated_Enum int32 @@ -19227,7 +19248,7 @@ func (x PatternFlowIcmpCommonChecksum_Generated_Enum) Number() protoreflect.Enum // Deprecated: Use PatternFlowIcmpCommonChecksum_Generated_Enum.Descriptor instead. func (PatternFlowIcmpCommonChecksum_Generated_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{853, 1, 0} + return file_otg_proto_rawDescGZIP(), []int{860, 1, 0} } type PatternFlowIcmpNextFieldsIdentifier_Choice_Enum int32 @@ -19282,7 +19303,7 @@ func (x PatternFlowIcmpNextFieldsIdentifier_Choice_Enum) Number() protoreflect.E // Deprecated: Use PatternFlowIcmpNextFieldsIdentifier_Choice_Enum.Descriptor instead. func (PatternFlowIcmpNextFieldsIdentifier_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{856, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{863, 0, 0} } type PatternFlowIcmpNextFieldsSequenceNumber_Choice_Enum int32 @@ -19337,7 +19358,7 @@ func (x PatternFlowIcmpNextFieldsSequenceNumber_Choice_Enum) Number() protorefle // Deprecated: Use PatternFlowIcmpNextFieldsSequenceNumber_Choice_Enum.Descriptor instead. func (PatternFlowIcmpNextFieldsSequenceNumber_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{859, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{866, 0, 0} } type PatternFlowIcmpv6EchoType_Choice_Enum int32 @@ -19392,7 +19413,7 @@ func (x PatternFlowIcmpv6EchoType_Choice_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowIcmpv6EchoType_Choice_Enum.Descriptor instead. func (PatternFlowIcmpv6EchoType_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{862, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{869, 0, 0} } type PatternFlowIcmpv6EchoCode_Choice_Enum int32 @@ -19447,7 +19468,7 @@ func (x PatternFlowIcmpv6EchoCode_Choice_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowIcmpv6EchoCode_Choice_Enum.Descriptor instead. func (PatternFlowIcmpv6EchoCode_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{865, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{872, 0, 0} } type PatternFlowIcmpv6EchoIdentifier_Choice_Enum int32 @@ -19502,7 +19523,7 @@ func (x PatternFlowIcmpv6EchoIdentifier_Choice_Enum) Number() protoreflect.EnumN // Deprecated: Use PatternFlowIcmpv6EchoIdentifier_Choice_Enum.Descriptor instead. func (PatternFlowIcmpv6EchoIdentifier_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{868, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{875, 0, 0} } type PatternFlowIcmpv6EchoSequenceNumber_Choice_Enum int32 @@ -19557,7 +19578,7 @@ func (x PatternFlowIcmpv6EchoSequenceNumber_Choice_Enum) Number() protoreflect.E // Deprecated: Use PatternFlowIcmpv6EchoSequenceNumber_Choice_Enum.Descriptor instead. func (PatternFlowIcmpv6EchoSequenceNumber_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{871, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{878, 0, 0} } type PatternFlowIcmpv6EchoChecksum_Choice_Enum int32 @@ -19606,7 +19627,7 @@ func (x PatternFlowIcmpv6EchoChecksum_Choice_Enum) Number() protoreflect.EnumNum // Deprecated: Use PatternFlowIcmpv6EchoChecksum_Choice_Enum.Descriptor instead. func (PatternFlowIcmpv6EchoChecksum_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{872, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{879, 0, 0} } type PatternFlowIcmpv6EchoChecksum_Generated_Enum int32 @@ -19655,7 +19676,7 @@ func (x PatternFlowIcmpv6EchoChecksum_Generated_Enum) Number() protoreflect.Enum // Deprecated: Use PatternFlowIcmpv6EchoChecksum_Generated_Enum.Descriptor instead. func (PatternFlowIcmpv6EchoChecksum_Generated_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{872, 1, 0} + return file_otg_proto_rawDescGZIP(), []int{879, 1, 0} } type PatternFlowIcmpv6CommonChecksum_Choice_Enum int32 @@ -19704,7 +19725,7 @@ func (x PatternFlowIcmpv6CommonChecksum_Choice_Enum) Number() protoreflect.EnumN // Deprecated: Use PatternFlowIcmpv6CommonChecksum_Choice_Enum.Descriptor instead. func (PatternFlowIcmpv6CommonChecksum_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{873, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{880, 0, 0} } type PatternFlowIcmpv6CommonChecksum_Generated_Enum int32 @@ -19753,7 +19774,7 @@ func (x PatternFlowIcmpv6CommonChecksum_Generated_Enum) Number() protoreflect.En // Deprecated: Use PatternFlowIcmpv6CommonChecksum_Generated_Enum.Descriptor instead. func (PatternFlowIcmpv6CommonChecksum_Generated_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{873, 1, 0} + return file_otg_proto_rawDescGZIP(), []int{880, 1, 0} } type PatternFlowPppAddress_Choice_Enum int32 @@ -19808,7 +19829,7 @@ func (x PatternFlowPppAddress_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowPppAddress_Choice_Enum.Descriptor instead. func (PatternFlowPppAddress_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{876, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{883, 0, 0} } type PatternFlowPppControl_Choice_Enum int32 @@ -19863,7 +19884,7 @@ func (x PatternFlowPppControl_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowPppControl_Choice_Enum.Descriptor instead. func (PatternFlowPppControl_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{879, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{886, 0, 0} } type PatternFlowPppProtocolType_Choice_Enum int32 @@ -19921,7 +19942,7 @@ func (x PatternFlowPppProtocolType_Choice_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowPppProtocolType_Choice_Enum.Descriptor instead. func (PatternFlowPppProtocolType_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{882, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{889, 0, 0} } type PatternFlowIgmpv1Version_Choice_Enum int32 @@ -19976,7 +19997,7 @@ func (x PatternFlowIgmpv1Version_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIgmpv1Version_Choice_Enum.Descriptor instead. func (PatternFlowIgmpv1Version_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{885, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{892, 0, 0} } type PatternFlowIgmpv1Type_Choice_Enum int32 @@ -20031,7 +20052,7 @@ func (x PatternFlowIgmpv1Type_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIgmpv1Type_Choice_Enum.Descriptor instead. func (PatternFlowIgmpv1Type_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{888, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{895, 0, 0} } type PatternFlowIgmpv1Unused_Choice_Enum int32 @@ -20086,7 +20107,7 @@ func (x PatternFlowIgmpv1Unused_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowIgmpv1Unused_Choice_Enum.Descriptor instead. func (PatternFlowIgmpv1Unused_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{891, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{898, 0, 0} } type PatternFlowIgmpv1Checksum_Choice_Enum int32 @@ -20135,7 +20156,7 @@ func (x PatternFlowIgmpv1Checksum_Choice_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowIgmpv1Checksum_Choice_Enum.Descriptor instead. func (PatternFlowIgmpv1Checksum_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{892, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{899, 0, 0} } type PatternFlowIgmpv1Checksum_Generated_Enum int32 @@ -20184,7 +20205,7 @@ func (x PatternFlowIgmpv1Checksum_Generated_Enum) Number() protoreflect.EnumNumb // Deprecated: Use PatternFlowIgmpv1Checksum_Generated_Enum.Descriptor instead. func (PatternFlowIgmpv1Checksum_Generated_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{892, 1, 0} + return file_otg_proto_rawDescGZIP(), []int{899, 1, 0} } type PatternFlowIgmpv1GroupAddress_Choice_Enum int32 @@ -20239,7 +20260,7 @@ func (x PatternFlowIgmpv1GroupAddress_Choice_Enum) Number() protoreflect.EnumNum // Deprecated: Use PatternFlowIgmpv1GroupAddress_Choice_Enum.Descriptor instead. func (PatternFlowIgmpv1GroupAddress_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{895, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{902, 0, 0} } type PatternFlowMplsLabel_Choice_Enum int32 @@ -20297,7 +20318,7 @@ func (x PatternFlowMplsLabel_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowMplsLabel_Choice_Enum.Descriptor instead. func (PatternFlowMplsLabel_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{898, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{905, 0, 0} } type PatternFlowMplsTrafficClass_Choice_Enum int32 @@ -20352,7 +20373,7 @@ func (x PatternFlowMplsTrafficClass_Choice_Enum) Number() protoreflect.EnumNumbe // Deprecated: Use PatternFlowMplsTrafficClass_Choice_Enum.Descriptor instead. func (PatternFlowMplsTrafficClass_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{901, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{908, 0, 0} } type PatternFlowMplsBottomOfStack_Choice_Enum int32 @@ -20410,7 +20431,7 @@ func (x PatternFlowMplsBottomOfStack_Choice_Enum) Number() protoreflect.EnumNumb // Deprecated: Use PatternFlowMplsBottomOfStack_Choice_Enum.Descriptor instead. func (PatternFlowMplsBottomOfStack_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{904, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{911, 0, 0} } type PatternFlowMplsTimeToLive_Choice_Enum int32 @@ -20465,7 +20486,7 @@ func (x PatternFlowMplsTimeToLive_Choice_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowMplsTimeToLive_Choice_Enum.Descriptor instead. func (PatternFlowMplsTimeToLive_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{907, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{914, 0, 0} } type PatternFlowSnmpv2CVersion_Choice_Enum int32 @@ -20520,7 +20541,7 @@ func (x PatternFlowSnmpv2CVersion_Choice_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowSnmpv2CVersion_Choice_Enum.Descriptor instead. func (PatternFlowSnmpv2CVersion_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{909, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{916, 0, 0} } type PatternFlowSnmpv2CPDURequestId_Choice_Enum int32 @@ -20575,7 +20596,7 @@ func (x PatternFlowSnmpv2CPDURequestId_Choice_Enum) Number() protoreflect.EnumNu // Deprecated: Use PatternFlowSnmpv2CPDURequestId_Choice_Enum.Descriptor instead. func (PatternFlowSnmpv2CPDURequestId_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{911, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{918, 0, 0} } type PatternFlowSnmpv2CPDUErrorIndex_Choice_Enum int32 @@ -20630,7 +20651,7 @@ func (x PatternFlowSnmpv2CPDUErrorIndex_Choice_Enum) Number() protoreflect.EnumN // Deprecated: Use PatternFlowSnmpv2CPDUErrorIndex_Choice_Enum.Descriptor instead. func (PatternFlowSnmpv2CPDUErrorIndex_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{913, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{920, 0, 0} } type PatternFlowSnmpv2CBulkPDURequestId_Choice_Enum int32 @@ -20685,7 +20706,7 @@ func (x PatternFlowSnmpv2CBulkPDURequestId_Choice_Enum) Number() protoreflect.En // Deprecated: Use PatternFlowSnmpv2CBulkPDURequestId_Choice_Enum.Descriptor instead. func (PatternFlowSnmpv2CBulkPDURequestId_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{915, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{922, 0, 0} } type PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice_Enum int32 @@ -20734,7 +20755,7 @@ func (x PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice_Enum) Number() protoreflect // Deprecated: Use PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice_Enum.Descriptor instead. func (PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{916, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{923, 0, 0} } type PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice_Enum int32 @@ -20789,7 +20810,7 @@ func (x PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice_Enum) Number() protorefle // Deprecated: Use PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice_Enum.Descriptor instead. func (PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{918, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{925, 0, 0} } type PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice_Enum int32 @@ -20844,7 +20865,7 @@ func (x PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice_Enum) Number() // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice_Enum.Descriptor instead. func (PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{920, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{927, 0, 0} } type PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice_Enum int32 @@ -20899,7 +20920,7 @@ func (x PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice_Enum) Number // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice_Enum.Descriptor instead. func (PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{922, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{929, 0, 0} } type PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice_Enum int32 @@ -20954,7 +20975,7 @@ func (x PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice_Enum) Number() // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice_Enum.Descriptor instead. func (PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{924, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{931, 0, 0} } type PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice_Enum int32 @@ -21009,7 +21030,7 @@ func (x PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice_Enum) Number // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice_Enum.Descriptor instead. func (PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{926, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{933, 0, 0} } type PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice_Enum int32 @@ -21064,7 +21085,7 @@ func (x PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice_Enum) Numbe // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice_Enum.Descriptor instead. func (PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{928, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{935, 0, 0} } type PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice_Enum int32 @@ -21119,7 +21140,7 @@ func (x PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice_Enum) // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice_Enum.Descriptor instead. func (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{930, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{937, 0, 0} } type PatternFlowSnmpv2CCommonRequestId_Choice_Enum int32 @@ -21174,7 +21195,7 @@ func (x PatternFlowSnmpv2CCommonRequestId_Choice_Enum) Number() protoreflect.Enu // Deprecated: Use PatternFlowSnmpv2CCommonRequestId_Choice_Enum.Descriptor instead. func (PatternFlowSnmpv2CCommonRequestId_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{932, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{939, 0, 0} } type PatternFlowRsvpRsvpChecksum_Choice_Enum int32 @@ -21223,7 +21244,7 @@ func (x PatternFlowRsvpRsvpChecksum_Choice_Enum) Number() protoreflect.EnumNumbe // Deprecated: Use PatternFlowRsvpRsvpChecksum_Choice_Enum.Descriptor instead. func (PatternFlowRsvpRsvpChecksum_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{933, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{940, 0, 0} } type PatternFlowRsvpRsvpChecksum_Generated_Enum int32 @@ -21272,7 +21293,7 @@ func (x PatternFlowRsvpRsvpChecksum_Generated_Enum) Number() protoreflect.EnumNu // Deprecated: Use PatternFlowRsvpRsvpChecksum_Generated_Enum.Descriptor instead. func (PatternFlowRsvpRsvpChecksum_Generated_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{933, 1, 0} + return file_otg_proto_rawDescGZIP(), []int{940, 1, 0} } type PatternFlowRsvpTimeToLive_Choice_Enum int32 @@ -21327,7 +21348,7 @@ func (x PatternFlowRsvpTimeToLive_Choice_Enum) Number() protoreflect.EnumNumber // Deprecated: Use PatternFlowRsvpTimeToLive_Choice_Enum.Descriptor instead. func (PatternFlowRsvpTimeToLive_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{935, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{942, 0, 0} } type PatternFlowRsvpReserved_Choice_Enum int32 @@ -21382,7 +21403,7 @@ func (x PatternFlowRsvpReserved_Choice_Enum) Number() protoreflect.EnumNumber { // Deprecated: Use PatternFlowRsvpReserved_Choice_Enum.Descriptor instead. func (PatternFlowRsvpReserved_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{937, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{944, 0, 0} } type PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice_Enum int32 @@ -21437,7 +21458,7 @@ func (x PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice_ // Deprecated: Use PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{939, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{946, 0, 0} } type PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice_Enum int32 @@ -21492,7 +21513,7 @@ func (x PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice_Enum) Number() pr // Deprecated: Use PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{941, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{948, 0, 0} } type PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice_Enum int32 @@ -21547,7 +21568,7 @@ func (x PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice_Enum) Number() pr // Deprecated: Use PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{943, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{950, 0, 0} } type PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice_Enum int32 @@ -21602,7 +21623,7 @@ func (x PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice_Enum) Number() pro // Deprecated: Use PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{945, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{952, 0, 0} } type PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice_Enum int32 @@ -21657,7 +21678,7 @@ func (x PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice_Enum) Number() protor // Deprecated: Use PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{947, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{954, 0, 0} } type PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice_Enum int32 @@ -21712,7 +21733,7 @@ func (x PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice_Enum) Number() protoref // Deprecated: Use PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{949, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{956, 0, 0} } type PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice_Enum int32 @@ -21767,7 +21788,7 @@ func (x PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice_Enum) Number // Deprecated: Use PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{951, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{958, 0, 0} } type PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice_Enum int32 @@ -21822,7 +21843,7 @@ func (x PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice_Enum) Number() p // Deprecated: Use PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{953, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{960, 0, 0} } type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice_Enum int32 @@ -21877,7 +21898,7 @@ func (x PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice_Enum) Number( // Deprecated: Use PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{955, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{962, 0, 0} } type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice_Enum int32 @@ -21932,7 +21953,7 @@ func (x PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice_Enum) // Deprecated: Use PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{957, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{964, 0, 0} } type PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice_Enum int32 @@ -21987,7 +22008,7 @@ func (x PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice_Enum) Number() // Deprecated: Use PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{959, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{966, 0, 0} } type PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice_Enum int32 @@ -22042,7 +22063,7 @@ func (x PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice_Enum) Nu // Deprecated: Use PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{961, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{968, 0, 0} } type PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice_Enum int32 @@ -22097,7 +22118,7 @@ func (x PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice_Enum) Numbe // Deprecated: Use PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{963, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{970, 0, 0} } type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice_Enum int32 @@ -22152,7 +22173,7 @@ func (x PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Ch // Deprecated: Use PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{965, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{972, 0, 0} } type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice_Enum int32 @@ -22207,7 +22228,7 @@ func (x PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice_Enum) Numb // Deprecated: Use PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{967, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{974, 0, 0} } type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice_Enum int32 @@ -22262,7 +22283,7 @@ func (x PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice_Enum) Number( // Deprecated: Use PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{969, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{976, 0, 0} } type PatternFlowRSVPPathSenderTspecIntServVersion_Choice_Enum int32 @@ -22317,7 +22338,7 @@ func (x PatternFlowRSVPPathSenderTspecIntServVersion_Choice_Enum) Number() proto // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServVersion_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTspecIntServVersion_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{971, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{978, 0, 0} } type PatternFlowRSVPPathSenderTspecIntServReserved1_Choice_Enum int32 @@ -22372,7 +22393,7 @@ func (x PatternFlowRSVPPathSenderTspecIntServReserved1_Choice_Enum) Number() pro // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServReserved1_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTspecIntServReserved1_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{973, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{980, 0, 0} } type PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice_Enum int32 @@ -22427,7 +22448,7 @@ func (x PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice_Enum) Number() // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{975, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{982, 0, 0} } type PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice_Enum int32 @@ -22482,7 +22503,7 @@ func (x PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice_Enum) Number() // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{977, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{984, 0, 0} } type PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice_Enum int32 @@ -22537,7 +22558,7 @@ func (x PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice_Enum) Number() proto // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{979, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{986, 0, 0} } type PatternFlowRSVPPathSenderTspecIntServReserved2_Choice_Enum int32 @@ -22592,7 +22613,7 @@ func (x PatternFlowRSVPPathSenderTspecIntServReserved2_Choice_Enum) Number() pro // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServReserved2_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTspecIntServReserved2_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{981, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{988, 0, 0} } type PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice_Enum int32 @@ -22647,7 +22668,7 @@ func (x PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice_Enum) Nu // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{983, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{990, 0, 0} } type PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice_Enum int32 @@ -22702,7 +22723,7 @@ func (x PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice_ // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{985, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{992, 0, 0} } type PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice_Enum int32 @@ -22757,7 +22778,7 @@ func (x PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice_Enum) Numbe // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{987, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{994, 0, 0} } type PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice_Enum int32 @@ -22812,7 +22833,7 @@ func (x PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice_Enum) Num // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{989, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{996, 0, 0} } type PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice_Enum int32 @@ -22867,7 +22888,7 @@ func (x PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice_Enum) Num // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{991, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{998, 0, 0} } type PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice_Enum int32 @@ -22922,7 +22943,7 @@ func (x PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice_Enum) Numb // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{993, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{1000, 0, 0} } type PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice_Enum int32 @@ -22977,7 +22998,7 @@ func (x PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice_Enum) N // Deprecated: Use PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{995, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{1002, 0, 0} } type PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice_Enum int32 @@ -23032,7 +23053,7 @@ func (x PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice_Enum) // Deprecated: Use PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{997, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{1004, 0, 0} } type PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice_Enum int32 @@ -23081,7 +23102,7 @@ func (x PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice_Enum) Number() prot // Deprecated: Use PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{998, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{1005, 0, 0} } type PatternFlowRSVPPathRecordRouteType1LabelCType_Choice_Enum int32 @@ -23130,7 +23151,7 @@ func (x PatternFlowRSVPPathRecordRouteType1LabelCType_Choice_Enum) Number() prot // Deprecated: Use PatternFlowRSVPPathRecordRouteType1LabelCType_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathRecordRouteType1LabelCType_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{999, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{1006, 0, 0} } type PatternFlowRSVPPathObjectsCustomType_Choice_Enum int32 @@ -23185,7 +23206,7 @@ func (x PatternFlowRSVPPathObjectsCustomType_Choice_Enum) Number() protoreflect. // Deprecated: Use PatternFlowRSVPPathObjectsCustomType_Choice_Enum.Descriptor instead. func (PatternFlowRSVPPathObjectsCustomType_Choice_Enum) EnumDescriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1001, 0, 0} + return file_otg_proto_rawDescGZIP(), []int{1008, 0, 0} } // A container for all models that are part of the configuration. @@ -69756,6 +69777,89 @@ func (x *PatternFlowIpv4SrcMetricTag) GetLength() uint32 { return 0 } +// ipv4 random pattern +type PatternFlowIpv4SrcRandom struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The minimum possible value generated by the random value generator. + // default = 0.0.0.0 + Min *string `protobuf:"bytes,1,opt,name=min,proto3,oneof" json:"min,omitempty"` + // The maximum possible value generated by the random value generator. + // default = 255.255.255.255 + Max *string `protobuf:"bytes,2,opt,name=max,proto3,oneof" json:"max,omitempty"` + // The seed value is used to initialize the random number generator to a deterministic + // state. If the user provides a seed value of 0, the implementation will generate a + // sequence of non-deterministic random values. For any other seed value, the sequence + // of random numbers will be generated in a deterministic manner (specific to the implementation). + // default = 1 + Seed *uint32 `protobuf:"varint,3,opt,name=seed,proto3,oneof" json:"seed,omitempty"` + // The total number of values to be generated by the random value generator. + // default = 1 + Count *uint32 `protobuf:"varint,4,opt,name=count,proto3,oneof" json:"count,omitempty"` +} + +func (x *PatternFlowIpv4SrcRandom) Reset() { + *x = PatternFlowIpv4SrcRandom{} + if protoimpl.UnsafeEnabled { + mi := &file_otg_proto_msgTypes[554] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PatternFlowIpv4SrcRandom) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatternFlowIpv4SrcRandom) ProtoMessage() {} + +func (x *PatternFlowIpv4SrcRandom) ProtoReflect() protoreflect.Message { + mi := &file_otg_proto_msgTypes[554] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PatternFlowIpv4SrcRandom.ProtoReflect.Descriptor instead. +func (*PatternFlowIpv4SrcRandom) Descriptor() ([]byte, []int) { + return file_otg_proto_rawDescGZIP(), []int{554} +} + +func (x *PatternFlowIpv4SrcRandom) GetMin() string { + if x != nil && x.Min != nil { + return *x.Min + } + return "" +} + +func (x *PatternFlowIpv4SrcRandom) GetMax() string { + if x != nil && x.Max != nil { + return *x.Max + } + return "" +} + +func (x *PatternFlowIpv4SrcRandom) GetSeed() uint32 { + if x != nil && x.Seed != nil { + return *x.Seed + } + return 0 +} + +func (x *PatternFlowIpv4SrcRandom) GetCount() uint32 { + if x != nil && x.Count != nil { + return *x.Count + } + return 0 +} + // Source address type PatternFlowIpv4Src struct { state protoimpl.MessageState @@ -69781,12 +69885,14 @@ type PatternFlowIpv4Src struct { MetricTags []*PatternFlowIpv4SrcMetricTag `protobuf:"bytes,7,rep,name=metric_tags,json=metricTags,proto3" json:"metric_tags,omitempty"` // Description missing in models Auto *FlowIpv4Auto `protobuf:"bytes,8,opt,name=auto,proto3" json:"auto,omitempty"` + // Description missing in models + Random *PatternFlowIpv4SrcRandom `protobuf:"bytes,9,opt,name=random,proto3" json:"random,omitempty"` } func (x *PatternFlowIpv4Src) Reset() { *x = PatternFlowIpv4Src{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[554] + mi := &file_otg_proto_msgTypes[555] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -69799,7 +69905,7 @@ func (x *PatternFlowIpv4Src) String() string { func (*PatternFlowIpv4Src) ProtoMessage() {} func (x *PatternFlowIpv4Src) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[554] + mi := &file_otg_proto_msgTypes[555] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -69812,7 +69918,7 @@ func (x *PatternFlowIpv4Src) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4Src.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4Src) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{554} + return file_otg_proto_rawDescGZIP(), []int{555} } func (x *PatternFlowIpv4Src) GetChoice() PatternFlowIpv4Src_Choice_Enum { @@ -69864,6 +69970,13 @@ func (x *PatternFlowIpv4Src) GetAuto() *FlowIpv4Auto { return nil } +func (x *PatternFlowIpv4Src) GetRandom() *PatternFlowIpv4SrcRandom { + if x != nil { + return x.Random + } + return nil +} + // ipv4 counter pattern type PatternFlowIpv4DstCounter struct { state protoimpl.MessageState @@ -69884,7 +69997,7 @@ type PatternFlowIpv4DstCounter struct { func (x *PatternFlowIpv4DstCounter) Reset() { *x = PatternFlowIpv4DstCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[555] + mi := &file_otg_proto_msgTypes[556] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -69897,7 +70010,7 @@ func (x *PatternFlowIpv4DstCounter) String() string { func (*PatternFlowIpv4DstCounter) ProtoMessage() {} func (x *PatternFlowIpv4DstCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[555] + mi := &file_otg_proto_msgTypes[556] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -69910,7 +70023,7 @@ func (x *PatternFlowIpv4DstCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4DstCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4DstCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{555} + return file_otg_proto_rawDescGZIP(), []int{556} } func (x *PatternFlowIpv4DstCounter) GetStart() string { @@ -69958,7 +70071,7 @@ type PatternFlowIpv4DstMetricTag struct { func (x *PatternFlowIpv4DstMetricTag) Reset() { *x = PatternFlowIpv4DstMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[556] + mi := &file_otg_proto_msgTypes[557] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -69971,7 +70084,7 @@ func (x *PatternFlowIpv4DstMetricTag) String() string { func (*PatternFlowIpv4DstMetricTag) ProtoMessage() {} func (x *PatternFlowIpv4DstMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[556] + mi := &file_otg_proto_msgTypes[557] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -69984,7 +70097,7 @@ func (x *PatternFlowIpv4DstMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4DstMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4DstMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{556} + return file_otg_proto_rawDescGZIP(), []int{557} } func (x *PatternFlowIpv4DstMetricTag) GetName() string { @@ -70008,6 +70121,89 @@ func (x *PatternFlowIpv4DstMetricTag) GetLength() uint32 { return 0 } +// ipv4 random pattern +type PatternFlowIpv4DstRandom struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The minimum possible value generated by the random value generator. + // default = 0.0.0.0 + Min *string `protobuf:"bytes,1,opt,name=min,proto3,oneof" json:"min,omitempty"` + // The maximum possible value generated by the random value generator. + // default = 255.255.255.255 + Max *string `protobuf:"bytes,2,opt,name=max,proto3,oneof" json:"max,omitempty"` + // The seed value is used to initialize the random number generator to a deterministic + // state. If the user provides a seed value of 0, the implementation will generate a + // sequence of non-deterministic random values. For any other seed value, the sequence + // of random numbers will be generated in a deterministic manner (specific to the implementation). + // default = 1 + Seed *uint32 `protobuf:"varint,3,opt,name=seed,proto3,oneof" json:"seed,omitempty"` + // The total number of values to be generated by the random value generator. + // default = 1 + Count *uint32 `protobuf:"varint,4,opt,name=count,proto3,oneof" json:"count,omitempty"` +} + +func (x *PatternFlowIpv4DstRandom) Reset() { + *x = PatternFlowIpv4DstRandom{} + if protoimpl.UnsafeEnabled { + mi := &file_otg_proto_msgTypes[558] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PatternFlowIpv4DstRandom) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatternFlowIpv4DstRandom) ProtoMessage() {} + +func (x *PatternFlowIpv4DstRandom) ProtoReflect() protoreflect.Message { + mi := &file_otg_proto_msgTypes[558] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PatternFlowIpv4DstRandom.ProtoReflect.Descriptor instead. +func (*PatternFlowIpv4DstRandom) Descriptor() ([]byte, []int) { + return file_otg_proto_rawDescGZIP(), []int{558} +} + +func (x *PatternFlowIpv4DstRandom) GetMin() string { + if x != nil && x.Min != nil { + return *x.Min + } + return "" +} + +func (x *PatternFlowIpv4DstRandom) GetMax() string { + if x != nil && x.Max != nil { + return *x.Max + } + return "" +} + +func (x *PatternFlowIpv4DstRandom) GetSeed() uint32 { + if x != nil && x.Seed != nil { + return *x.Seed + } + return 0 +} + +func (x *PatternFlowIpv4DstRandom) GetCount() uint32 { + if x != nil && x.Count != nil { + return *x.Count + } + return 0 +} + // Destination address type PatternFlowIpv4Dst struct { state protoimpl.MessageState @@ -70033,12 +70229,14 @@ type PatternFlowIpv4Dst struct { MetricTags []*PatternFlowIpv4DstMetricTag `protobuf:"bytes,7,rep,name=metric_tags,json=metricTags,proto3" json:"metric_tags,omitempty"` // Description missing in models Auto *FlowIpv4Auto `protobuf:"bytes,8,opt,name=auto,proto3" json:"auto,omitempty"` + // Description missing in models + Random *PatternFlowIpv4DstRandom `protobuf:"bytes,9,opt,name=random,proto3" json:"random,omitempty"` } func (x *PatternFlowIpv4Dst) Reset() { *x = PatternFlowIpv4Dst{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[557] + mi := &file_otg_proto_msgTypes[559] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -70051,7 +70249,7 @@ func (x *PatternFlowIpv4Dst) String() string { func (*PatternFlowIpv4Dst) ProtoMessage() {} func (x *PatternFlowIpv4Dst) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[557] + mi := &file_otg_proto_msgTypes[559] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -70064,7 +70262,7 @@ func (x *PatternFlowIpv4Dst) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4Dst.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4Dst) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{557} + return file_otg_proto_rawDescGZIP(), []int{559} } func (x *PatternFlowIpv4Dst) GetChoice() PatternFlowIpv4Dst_Choice_Enum { @@ -70116,6 +70314,13 @@ func (x *PatternFlowIpv4Dst) GetAuto() *FlowIpv4Auto { return nil } +func (x *PatternFlowIpv4Dst) GetRandom() *PatternFlowIpv4DstRandom { + if x != nil { + return x.Random + } + return nil +} + // integer counter pattern type PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter struct { state protoimpl.MessageState @@ -70136,7 +70341,7 @@ type PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter struct { func (x *PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) Reset() { *x = PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[558] + mi := &file_otg_proto_msgTypes[560] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -70149,7 +70354,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) String() string { func (*PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) ProtoMessage() {} func (x *PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[558] + mi := &file_otg_proto_msgTypes[560] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -70162,7 +70367,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) ProtoReflect() proto // Deprecated: Use PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{558} + return file_otg_proto_rawDescGZIP(), []int{560} } func (x *PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) GetStart() uint32 { @@ -70210,7 +70415,7 @@ type PatternFlowIpv4OptionsCustomTypeCopiedFlag struct { func (x *PatternFlowIpv4OptionsCustomTypeCopiedFlag) Reset() { *x = PatternFlowIpv4OptionsCustomTypeCopiedFlag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[559] + mi := &file_otg_proto_msgTypes[561] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -70223,7 +70428,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeCopiedFlag) String() string { func (*PatternFlowIpv4OptionsCustomTypeCopiedFlag) ProtoMessage() {} func (x *PatternFlowIpv4OptionsCustomTypeCopiedFlag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[559] + mi := &file_otg_proto_msgTypes[561] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -70236,7 +70441,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeCopiedFlag) ProtoReflect() protoreflect // Deprecated: Use PatternFlowIpv4OptionsCustomTypeCopiedFlag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4OptionsCustomTypeCopiedFlag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{559} + return file_otg_proto_rawDescGZIP(), []int{561} } func (x *PatternFlowIpv4OptionsCustomTypeCopiedFlag) GetChoice() PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice_Enum { @@ -70294,7 +70499,7 @@ type PatternFlowIpv4OptionsCustomTypeOptionClassCounter struct { func (x *PatternFlowIpv4OptionsCustomTypeOptionClassCounter) Reset() { *x = PatternFlowIpv4OptionsCustomTypeOptionClassCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[560] + mi := &file_otg_proto_msgTypes[562] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -70307,7 +70512,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeOptionClassCounter) String() string { func (*PatternFlowIpv4OptionsCustomTypeOptionClassCounter) ProtoMessage() {} func (x *PatternFlowIpv4OptionsCustomTypeOptionClassCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[560] + mi := &file_otg_proto_msgTypes[562] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -70320,7 +70525,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeOptionClassCounter) ProtoReflect() prot // Deprecated: Use PatternFlowIpv4OptionsCustomTypeOptionClassCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4OptionsCustomTypeOptionClassCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{560} + return file_otg_proto_rawDescGZIP(), []int{562} } func (x *PatternFlowIpv4OptionsCustomTypeOptionClassCounter) GetStart() uint32 { @@ -70368,7 +70573,7 @@ type PatternFlowIpv4OptionsCustomTypeOptionClass struct { func (x *PatternFlowIpv4OptionsCustomTypeOptionClass) Reset() { *x = PatternFlowIpv4OptionsCustomTypeOptionClass{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[561] + mi := &file_otg_proto_msgTypes[563] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -70381,7 +70586,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeOptionClass) String() string { func (*PatternFlowIpv4OptionsCustomTypeOptionClass) ProtoMessage() {} func (x *PatternFlowIpv4OptionsCustomTypeOptionClass) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[561] + mi := &file_otg_proto_msgTypes[563] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -70394,7 +70599,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeOptionClass) ProtoReflect() protoreflec // Deprecated: Use PatternFlowIpv4OptionsCustomTypeOptionClass.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4OptionsCustomTypeOptionClass) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{561} + return file_otg_proto_rawDescGZIP(), []int{563} } func (x *PatternFlowIpv4OptionsCustomTypeOptionClass) GetChoice() PatternFlowIpv4OptionsCustomTypeOptionClass_Choice_Enum { @@ -70452,7 +70657,7 @@ type PatternFlowIpv4OptionsCustomTypeOptionNumberCounter struct { func (x *PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) Reset() { *x = PatternFlowIpv4OptionsCustomTypeOptionNumberCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[562] + mi := &file_otg_proto_msgTypes[564] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -70465,7 +70670,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) String() string { func (*PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) ProtoMessage() {} func (x *PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[562] + mi := &file_otg_proto_msgTypes[564] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -70478,7 +70683,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) ProtoReflect() pro // Deprecated: Use PatternFlowIpv4OptionsCustomTypeOptionNumberCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{562} + return file_otg_proto_rawDescGZIP(), []int{564} } func (x *PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) GetStart() uint32 { @@ -70526,7 +70731,7 @@ type PatternFlowIpv4OptionsCustomTypeOptionNumber struct { func (x *PatternFlowIpv4OptionsCustomTypeOptionNumber) Reset() { *x = PatternFlowIpv4OptionsCustomTypeOptionNumber{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[563] + mi := &file_otg_proto_msgTypes[565] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -70539,7 +70744,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeOptionNumber) String() string { func (*PatternFlowIpv4OptionsCustomTypeOptionNumber) ProtoMessage() {} func (x *PatternFlowIpv4OptionsCustomTypeOptionNumber) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[563] + mi := &file_otg_proto_msgTypes[565] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -70552,7 +70757,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeOptionNumber) ProtoReflect() protorefle // Deprecated: Use PatternFlowIpv4OptionsCustomTypeOptionNumber.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4OptionsCustomTypeOptionNumber) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{563} + return file_otg_proto_rawDescGZIP(), []int{565} } func (x *PatternFlowIpv4OptionsCustomTypeOptionNumber) GetChoice() PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice_Enum { @@ -70610,7 +70815,7 @@ type PatternFlowIpv4PriorityRawCounter struct { func (x *PatternFlowIpv4PriorityRawCounter) Reset() { *x = PatternFlowIpv4PriorityRawCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[564] + mi := &file_otg_proto_msgTypes[566] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -70623,7 +70828,7 @@ func (x *PatternFlowIpv4PriorityRawCounter) String() string { func (*PatternFlowIpv4PriorityRawCounter) ProtoMessage() {} func (x *PatternFlowIpv4PriorityRawCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[564] + mi := &file_otg_proto_msgTypes[566] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -70636,7 +70841,7 @@ func (x *PatternFlowIpv4PriorityRawCounter) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowIpv4PriorityRawCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4PriorityRawCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{564} + return file_otg_proto_rawDescGZIP(), []int{566} } func (x *PatternFlowIpv4PriorityRawCounter) GetStart() uint32 { @@ -70684,7 +70889,7 @@ type PatternFlowIpv4PriorityRawMetricTag struct { func (x *PatternFlowIpv4PriorityRawMetricTag) Reset() { *x = PatternFlowIpv4PriorityRawMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[565] + mi := &file_otg_proto_msgTypes[567] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -70697,7 +70902,7 @@ func (x *PatternFlowIpv4PriorityRawMetricTag) String() string { func (*PatternFlowIpv4PriorityRawMetricTag) ProtoMessage() {} func (x *PatternFlowIpv4PriorityRawMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[565] + mi := &file_otg_proto_msgTypes[567] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -70710,7 +70915,7 @@ func (x *PatternFlowIpv4PriorityRawMetricTag) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowIpv4PriorityRawMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4PriorityRawMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{565} + return file_otg_proto_rawDescGZIP(), []int{567} } func (x *PatternFlowIpv4PriorityRawMetricTag) GetName() string { @@ -70762,7 +70967,7 @@ type PatternFlowIpv4PriorityRaw struct { func (x *PatternFlowIpv4PriorityRaw) Reset() { *x = PatternFlowIpv4PriorityRaw{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[566] + mi := &file_otg_proto_msgTypes[568] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -70775,7 +70980,7 @@ func (x *PatternFlowIpv4PriorityRaw) String() string { func (*PatternFlowIpv4PriorityRaw) ProtoMessage() {} func (x *PatternFlowIpv4PriorityRaw) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[566] + mi := &file_otg_proto_msgTypes[568] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -70788,7 +70993,7 @@ func (x *PatternFlowIpv4PriorityRaw) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4PriorityRaw.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4PriorityRaw) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{566} + return file_otg_proto_rawDescGZIP(), []int{568} } func (x *PatternFlowIpv4PriorityRaw) GetChoice() PatternFlowIpv4PriorityRaw_Choice_Enum { @@ -70853,7 +71058,7 @@ type PatternFlowIpv4DscpPhbCounter struct { func (x *PatternFlowIpv4DscpPhbCounter) Reset() { *x = PatternFlowIpv4DscpPhbCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[567] + mi := &file_otg_proto_msgTypes[569] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -70866,7 +71071,7 @@ func (x *PatternFlowIpv4DscpPhbCounter) String() string { func (*PatternFlowIpv4DscpPhbCounter) ProtoMessage() {} func (x *PatternFlowIpv4DscpPhbCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[567] + mi := &file_otg_proto_msgTypes[569] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -70879,7 +71084,7 @@ func (x *PatternFlowIpv4DscpPhbCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4DscpPhbCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4DscpPhbCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{567} + return file_otg_proto_rawDescGZIP(), []int{569} } func (x *PatternFlowIpv4DscpPhbCounter) GetStart() uint32 { @@ -70927,7 +71132,7 @@ type PatternFlowIpv4DscpPhbMetricTag struct { func (x *PatternFlowIpv4DscpPhbMetricTag) Reset() { *x = PatternFlowIpv4DscpPhbMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[568] + mi := &file_otg_proto_msgTypes[570] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -70940,7 +71145,7 @@ func (x *PatternFlowIpv4DscpPhbMetricTag) String() string { func (*PatternFlowIpv4DscpPhbMetricTag) ProtoMessage() {} func (x *PatternFlowIpv4DscpPhbMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[568] + mi := &file_otg_proto_msgTypes[570] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -70953,7 +71158,7 @@ func (x *PatternFlowIpv4DscpPhbMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4DscpPhbMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4DscpPhbMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{568} + return file_otg_proto_rawDescGZIP(), []int{570} } func (x *PatternFlowIpv4DscpPhbMetricTag) GetName() string { @@ -71005,7 +71210,7 @@ type PatternFlowIpv4DscpPhb struct { func (x *PatternFlowIpv4DscpPhb) Reset() { *x = PatternFlowIpv4DscpPhb{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[569] + mi := &file_otg_proto_msgTypes[571] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -71018,7 +71223,7 @@ func (x *PatternFlowIpv4DscpPhb) String() string { func (*PatternFlowIpv4DscpPhb) ProtoMessage() {} func (x *PatternFlowIpv4DscpPhb) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[569] + mi := &file_otg_proto_msgTypes[571] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -71031,7 +71236,7 @@ func (x *PatternFlowIpv4DscpPhb) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4DscpPhb.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4DscpPhb) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{569} + return file_otg_proto_rawDescGZIP(), []int{571} } func (x *PatternFlowIpv4DscpPhb) GetChoice() PatternFlowIpv4DscpPhb_Choice_Enum { @@ -71096,7 +71301,7 @@ type PatternFlowIpv4DscpEcnCounter struct { func (x *PatternFlowIpv4DscpEcnCounter) Reset() { *x = PatternFlowIpv4DscpEcnCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[570] + mi := &file_otg_proto_msgTypes[572] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -71109,7 +71314,7 @@ func (x *PatternFlowIpv4DscpEcnCounter) String() string { func (*PatternFlowIpv4DscpEcnCounter) ProtoMessage() {} func (x *PatternFlowIpv4DscpEcnCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[570] + mi := &file_otg_proto_msgTypes[572] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -71122,7 +71327,7 @@ func (x *PatternFlowIpv4DscpEcnCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4DscpEcnCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4DscpEcnCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{570} + return file_otg_proto_rawDescGZIP(), []int{572} } func (x *PatternFlowIpv4DscpEcnCounter) GetStart() uint32 { @@ -71170,7 +71375,7 @@ type PatternFlowIpv4DscpEcnMetricTag struct { func (x *PatternFlowIpv4DscpEcnMetricTag) Reset() { *x = PatternFlowIpv4DscpEcnMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[571] + mi := &file_otg_proto_msgTypes[573] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -71183,7 +71388,7 @@ func (x *PatternFlowIpv4DscpEcnMetricTag) String() string { func (*PatternFlowIpv4DscpEcnMetricTag) ProtoMessage() {} func (x *PatternFlowIpv4DscpEcnMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[571] + mi := &file_otg_proto_msgTypes[573] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -71196,7 +71401,7 @@ func (x *PatternFlowIpv4DscpEcnMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4DscpEcnMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4DscpEcnMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{571} + return file_otg_proto_rawDescGZIP(), []int{573} } func (x *PatternFlowIpv4DscpEcnMetricTag) GetName() string { @@ -71248,7 +71453,7 @@ type PatternFlowIpv4DscpEcn struct { func (x *PatternFlowIpv4DscpEcn) Reset() { *x = PatternFlowIpv4DscpEcn{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[572] + mi := &file_otg_proto_msgTypes[574] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -71261,7 +71466,7 @@ func (x *PatternFlowIpv4DscpEcn) String() string { func (*PatternFlowIpv4DscpEcn) ProtoMessage() {} func (x *PatternFlowIpv4DscpEcn) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[572] + mi := &file_otg_proto_msgTypes[574] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -71274,7 +71479,7 @@ func (x *PatternFlowIpv4DscpEcn) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4DscpEcn.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4DscpEcn) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{572} + return file_otg_proto_rawDescGZIP(), []int{574} } func (x *PatternFlowIpv4DscpEcn) GetChoice() PatternFlowIpv4DscpEcn_Choice_Enum { @@ -71339,7 +71544,7 @@ type PatternFlowIpv4TosPrecedenceCounter struct { func (x *PatternFlowIpv4TosPrecedenceCounter) Reset() { *x = PatternFlowIpv4TosPrecedenceCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[573] + mi := &file_otg_proto_msgTypes[575] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -71352,7 +71557,7 @@ func (x *PatternFlowIpv4TosPrecedenceCounter) String() string { func (*PatternFlowIpv4TosPrecedenceCounter) ProtoMessage() {} func (x *PatternFlowIpv4TosPrecedenceCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[573] + mi := &file_otg_proto_msgTypes[575] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -71365,7 +71570,7 @@ func (x *PatternFlowIpv4TosPrecedenceCounter) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowIpv4TosPrecedenceCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosPrecedenceCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{573} + return file_otg_proto_rawDescGZIP(), []int{575} } func (x *PatternFlowIpv4TosPrecedenceCounter) GetStart() uint32 { @@ -71413,7 +71618,7 @@ type PatternFlowIpv4TosPrecedenceMetricTag struct { func (x *PatternFlowIpv4TosPrecedenceMetricTag) Reset() { *x = PatternFlowIpv4TosPrecedenceMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[574] + mi := &file_otg_proto_msgTypes[576] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -71426,7 +71631,7 @@ func (x *PatternFlowIpv4TosPrecedenceMetricTag) String() string { func (*PatternFlowIpv4TosPrecedenceMetricTag) ProtoMessage() {} func (x *PatternFlowIpv4TosPrecedenceMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[574] + mi := &file_otg_proto_msgTypes[576] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -71439,7 +71644,7 @@ func (x *PatternFlowIpv4TosPrecedenceMetricTag) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowIpv4TosPrecedenceMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosPrecedenceMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{574} + return file_otg_proto_rawDescGZIP(), []int{576} } func (x *PatternFlowIpv4TosPrecedenceMetricTag) GetName() string { @@ -71491,7 +71696,7 @@ type PatternFlowIpv4TosPrecedence struct { func (x *PatternFlowIpv4TosPrecedence) Reset() { *x = PatternFlowIpv4TosPrecedence{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[575] + mi := &file_otg_proto_msgTypes[577] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -71504,7 +71709,7 @@ func (x *PatternFlowIpv4TosPrecedence) String() string { func (*PatternFlowIpv4TosPrecedence) ProtoMessage() {} func (x *PatternFlowIpv4TosPrecedence) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[575] + mi := &file_otg_proto_msgTypes[577] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -71517,7 +71722,7 @@ func (x *PatternFlowIpv4TosPrecedence) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4TosPrecedence.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosPrecedence) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{575} + return file_otg_proto_rawDescGZIP(), []int{577} } func (x *PatternFlowIpv4TosPrecedence) GetChoice() PatternFlowIpv4TosPrecedence_Choice_Enum { @@ -71582,7 +71787,7 @@ type PatternFlowIpv4TosDelayCounter struct { func (x *PatternFlowIpv4TosDelayCounter) Reset() { *x = PatternFlowIpv4TosDelayCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[576] + mi := &file_otg_proto_msgTypes[578] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -71595,7 +71800,7 @@ func (x *PatternFlowIpv4TosDelayCounter) String() string { func (*PatternFlowIpv4TosDelayCounter) ProtoMessage() {} func (x *PatternFlowIpv4TosDelayCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[576] + mi := &file_otg_proto_msgTypes[578] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -71608,7 +71813,7 @@ func (x *PatternFlowIpv4TosDelayCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4TosDelayCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosDelayCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{576} + return file_otg_proto_rawDescGZIP(), []int{578} } func (x *PatternFlowIpv4TosDelayCounter) GetStart() uint32 { @@ -71656,7 +71861,7 @@ type PatternFlowIpv4TosDelayMetricTag struct { func (x *PatternFlowIpv4TosDelayMetricTag) Reset() { *x = PatternFlowIpv4TosDelayMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[577] + mi := &file_otg_proto_msgTypes[579] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -71669,7 +71874,7 @@ func (x *PatternFlowIpv4TosDelayMetricTag) String() string { func (*PatternFlowIpv4TosDelayMetricTag) ProtoMessage() {} func (x *PatternFlowIpv4TosDelayMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[577] + mi := &file_otg_proto_msgTypes[579] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -71682,7 +71887,7 @@ func (x *PatternFlowIpv4TosDelayMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4TosDelayMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosDelayMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{577} + return file_otg_proto_rawDescGZIP(), []int{579} } func (x *PatternFlowIpv4TosDelayMetricTag) GetName() string { @@ -71734,7 +71939,7 @@ type PatternFlowIpv4TosDelay struct { func (x *PatternFlowIpv4TosDelay) Reset() { *x = PatternFlowIpv4TosDelay{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[578] + mi := &file_otg_proto_msgTypes[580] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -71747,7 +71952,7 @@ func (x *PatternFlowIpv4TosDelay) String() string { func (*PatternFlowIpv4TosDelay) ProtoMessage() {} func (x *PatternFlowIpv4TosDelay) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[578] + mi := &file_otg_proto_msgTypes[580] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -71760,7 +71965,7 @@ func (x *PatternFlowIpv4TosDelay) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4TosDelay.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosDelay) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{578} + return file_otg_proto_rawDescGZIP(), []int{580} } func (x *PatternFlowIpv4TosDelay) GetChoice() PatternFlowIpv4TosDelay_Choice_Enum { @@ -71825,7 +72030,7 @@ type PatternFlowIpv4TosThroughputCounter struct { func (x *PatternFlowIpv4TosThroughputCounter) Reset() { *x = PatternFlowIpv4TosThroughputCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[579] + mi := &file_otg_proto_msgTypes[581] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -71838,7 +72043,7 @@ func (x *PatternFlowIpv4TosThroughputCounter) String() string { func (*PatternFlowIpv4TosThroughputCounter) ProtoMessage() {} func (x *PatternFlowIpv4TosThroughputCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[579] + mi := &file_otg_proto_msgTypes[581] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -71851,7 +72056,7 @@ func (x *PatternFlowIpv4TosThroughputCounter) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowIpv4TosThroughputCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosThroughputCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{579} + return file_otg_proto_rawDescGZIP(), []int{581} } func (x *PatternFlowIpv4TosThroughputCounter) GetStart() uint32 { @@ -71899,7 +72104,7 @@ type PatternFlowIpv4TosThroughputMetricTag struct { func (x *PatternFlowIpv4TosThroughputMetricTag) Reset() { *x = PatternFlowIpv4TosThroughputMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[580] + mi := &file_otg_proto_msgTypes[582] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -71912,7 +72117,7 @@ func (x *PatternFlowIpv4TosThroughputMetricTag) String() string { func (*PatternFlowIpv4TosThroughputMetricTag) ProtoMessage() {} func (x *PatternFlowIpv4TosThroughputMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[580] + mi := &file_otg_proto_msgTypes[582] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -71925,7 +72130,7 @@ func (x *PatternFlowIpv4TosThroughputMetricTag) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowIpv4TosThroughputMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosThroughputMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{580} + return file_otg_proto_rawDescGZIP(), []int{582} } func (x *PatternFlowIpv4TosThroughputMetricTag) GetName() string { @@ -71977,7 +72182,7 @@ type PatternFlowIpv4TosThroughput struct { func (x *PatternFlowIpv4TosThroughput) Reset() { *x = PatternFlowIpv4TosThroughput{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[581] + mi := &file_otg_proto_msgTypes[583] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -71990,7 +72195,7 @@ func (x *PatternFlowIpv4TosThroughput) String() string { func (*PatternFlowIpv4TosThroughput) ProtoMessage() {} func (x *PatternFlowIpv4TosThroughput) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[581] + mi := &file_otg_proto_msgTypes[583] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -72003,7 +72208,7 @@ func (x *PatternFlowIpv4TosThroughput) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4TosThroughput.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosThroughput) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{581} + return file_otg_proto_rawDescGZIP(), []int{583} } func (x *PatternFlowIpv4TosThroughput) GetChoice() PatternFlowIpv4TosThroughput_Choice_Enum { @@ -72068,7 +72273,7 @@ type PatternFlowIpv4TosReliabilityCounter struct { func (x *PatternFlowIpv4TosReliabilityCounter) Reset() { *x = PatternFlowIpv4TosReliabilityCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[582] + mi := &file_otg_proto_msgTypes[584] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -72081,7 +72286,7 @@ func (x *PatternFlowIpv4TosReliabilityCounter) String() string { func (*PatternFlowIpv4TosReliabilityCounter) ProtoMessage() {} func (x *PatternFlowIpv4TosReliabilityCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[582] + mi := &file_otg_proto_msgTypes[584] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -72094,7 +72299,7 @@ func (x *PatternFlowIpv4TosReliabilityCounter) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowIpv4TosReliabilityCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosReliabilityCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{582} + return file_otg_proto_rawDescGZIP(), []int{584} } func (x *PatternFlowIpv4TosReliabilityCounter) GetStart() uint32 { @@ -72142,7 +72347,7 @@ type PatternFlowIpv4TosReliabilityMetricTag struct { func (x *PatternFlowIpv4TosReliabilityMetricTag) Reset() { *x = PatternFlowIpv4TosReliabilityMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[583] + mi := &file_otg_proto_msgTypes[585] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -72155,7 +72360,7 @@ func (x *PatternFlowIpv4TosReliabilityMetricTag) String() string { func (*PatternFlowIpv4TosReliabilityMetricTag) ProtoMessage() {} func (x *PatternFlowIpv4TosReliabilityMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[583] + mi := &file_otg_proto_msgTypes[585] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -72168,7 +72373,7 @@ func (x *PatternFlowIpv4TosReliabilityMetricTag) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowIpv4TosReliabilityMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosReliabilityMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{583} + return file_otg_proto_rawDescGZIP(), []int{585} } func (x *PatternFlowIpv4TosReliabilityMetricTag) GetName() string { @@ -72220,7 +72425,7 @@ type PatternFlowIpv4TosReliability struct { func (x *PatternFlowIpv4TosReliability) Reset() { *x = PatternFlowIpv4TosReliability{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[584] + mi := &file_otg_proto_msgTypes[586] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -72233,7 +72438,7 @@ func (x *PatternFlowIpv4TosReliability) String() string { func (*PatternFlowIpv4TosReliability) ProtoMessage() {} func (x *PatternFlowIpv4TosReliability) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[584] + mi := &file_otg_proto_msgTypes[586] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -72246,7 +72451,7 @@ func (x *PatternFlowIpv4TosReliability) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4TosReliability.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosReliability) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{584} + return file_otg_proto_rawDescGZIP(), []int{586} } func (x *PatternFlowIpv4TosReliability) GetChoice() PatternFlowIpv4TosReliability_Choice_Enum { @@ -72311,7 +72516,7 @@ type PatternFlowIpv4TosMonetaryCounter struct { func (x *PatternFlowIpv4TosMonetaryCounter) Reset() { *x = PatternFlowIpv4TosMonetaryCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[585] + mi := &file_otg_proto_msgTypes[587] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -72324,7 +72529,7 @@ func (x *PatternFlowIpv4TosMonetaryCounter) String() string { func (*PatternFlowIpv4TosMonetaryCounter) ProtoMessage() {} func (x *PatternFlowIpv4TosMonetaryCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[585] + mi := &file_otg_proto_msgTypes[587] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -72337,7 +72542,7 @@ func (x *PatternFlowIpv4TosMonetaryCounter) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowIpv4TosMonetaryCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosMonetaryCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{585} + return file_otg_proto_rawDescGZIP(), []int{587} } func (x *PatternFlowIpv4TosMonetaryCounter) GetStart() uint32 { @@ -72385,7 +72590,7 @@ type PatternFlowIpv4TosMonetaryMetricTag struct { func (x *PatternFlowIpv4TosMonetaryMetricTag) Reset() { *x = PatternFlowIpv4TosMonetaryMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[586] + mi := &file_otg_proto_msgTypes[588] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -72398,7 +72603,7 @@ func (x *PatternFlowIpv4TosMonetaryMetricTag) String() string { func (*PatternFlowIpv4TosMonetaryMetricTag) ProtoMessage() {} func (x *PatternFlowIpv4TosMonetaryMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[586] + mi := &file_otg_proto_msgTypes[588] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -72411,7 +72616,7 @@ func (x *PatternFlowIpv4TosMonetaryMetricTag) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowIpv4TosMonetaryMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosMonetaryMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{586} + return file_otg_proto_rawDescGZIP(), []int{588} } func (x *PatternFlowIpv4TosMonetaryMetricTag) GetName() string { @@ -72463,7 +72668,7 @@ type PatternFlowIpv4TosMonetary struct { func (x *PatternFlowIpv4TosMonetary) Reset() { *x = PatternFlowIpv4TosMonetary{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[587] + mi := &file_otg_proto_msgTypes[589] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -72476,7 +72681,7 @@ func (x *PatternFlowIpv4TosMonetary) String() string { func (*PatternFlowIpv4TosMonetary) ProtoMessage() {} func (x *PatternFlowIpv4TosMonetary) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[587] + mi := &file_otg_proto_msgTypes[589] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -72489,7 +72694,7 @@ func (x *PatternFlowIpv4TosMonetary) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4TosMonetary.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosMonetary) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{587} + return file_otg_proto_rawDescGZIP(), []int{589} } func (x *PatternFlowIpv4TosMonetary) GetChoice() PatternFlowIpv4TosMonetary_Choice_Enum { @@ -72554,7 +72759,7 @@ type PatternFlowIpv4TosUnusedCounter struct { func (x *PatternFlowIpv4TosUnusedCounter) Reset() { *x = PatternFlowIpv4TosUnusedCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[588] + mi := &file_otg_proto_msgTypes[590] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -72567,7 +72772,7 @@ func (x *PatternFlowIpv4TosUnusedCounter) String() string { func (*PatternFlowIpv4TosUnusedCounter) ProtoMessage() {} func (x *PatternFlowIpv4TosUnusedCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[588] + mi := &file_otg_proto_msgTypes[590] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -72580,7 +72785,7 @@ func (x *PatternFlowIpv4TosUnusedCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4TosUnusedCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosUnusedCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{588} + return file_otg_proto_rawDescGZIP(), []int{590} } func (x *PatternFlowIpv4TosUnusedCounter) GetStart() uint32 { @@ -72628,7 +72833,7 @@ type PatternFlowIpv4TosUnusedMetricTag struct { func (x *PatternFlowIpv4TosUnusedMetricTag) Reset() { *x = PatternFlowIpv4TosUnusedMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[589] + mi := &file_otg_proto_msgTypes[591] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -72641,7 +72846,7 @@ func (x *PatternFlowIpv4TosUnusedMetricTag) String() string { func (*PatternFlowIpv4TosUnusedMetricTag) ProtoMessage() {} func (x *PatternFlowIpv4TosUnusedMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[589] + mi := &file_otg_proto_msgTypes[591] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -72654,7 +72859,7 @@ func (x *PatternFlowIpv4TosUnusedMetricTag) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowIpv4TosUnusedMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosUnusedMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{589} + return file_otg_proto_rawDescGZIP(), []int{591} } func (x *PatternFlowIpv4TosUnusedMetricTag) GetName() string { @@ -72706,7 +72911,7 @@ type PatternFlowIpv4TosUnused struct { func (x *PatternFlowIpv4TosUnused) Reset() { *x = PatternFlowIpv4TosUnused{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[590] + mi := &file_otg_proto_msgTypes[592] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -72719,7 +72924,7 @@ func (x *PatternFlowIpv4TosUnused) String() string { func (*PatternFlowIpv4TosUnused) ProtoMessage() {} func (x *PatternFlowIpv4TosUnused) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[590] + mi := &file_otg_proto_msgTypes[592] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -72732,7 +72937,7 @@ func (x *PatternFlowIpv4TosUnused) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4TosUnused.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosUnused) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{590} + return file_otg_proto_rawDescGZIP(), []int{592} } func (x *PatternFlowIpv4TosUnused) GetChoice() PatternFlowIpv4TosUnused_Choice_Enum { @@ -72797,7 +73002,7 @@ type PatternFlowIpv6VersionCounter struct { func (x *PatternFlowIpv6VersionCounter) Reset() { *x = PatternFlowIpv6VersionCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[591] + mi := &file_otg_proto_msgTypes[593] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -72810,7 +73015,7 @@ func (x *PatternFlowIpv6VersionCounter) String() string { func (*PatternFlowIpv6VersionCounter) ProtoMessage() {} func (x *PatternFlowIpv6VersionCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[591] + mi := &file_otg_proto_msgTypes[593] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -72823,7 +73028,7 @@ func (x *PatternFlowIpv6VersionCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6VersionCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6VersionCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{591} + return file_otg_proto_rawDescGZIP(), []int{593} } func (x *PatternFlowIpv6VersionCounter) GetStart() uint32 { @@ -72871,7 +73076,7 @@ type PatternFlowIpv6VersionMetricTag struct { func (x *PatternFlowIpv6VersionMetricTag) Reset() { *x = PatternFlowIpv6VersionMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[592] + mi := &file_otg_proto_msgTypes[594] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -72884,7 +73089,7 @@ func (x *PatternFlowIpv6VersionMetricTag) String() string { func (*PatternFlowIpv6VersionMetricTag) ProtoMessage() {} func (x *PatternFlowIpv6VersionMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[592] + mi := &file_otg_proto_msgTypes[594] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -72897,7 +73102,7 @@ func (x *PatternFlowIpv6VersionMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6VersionMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6VersionMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{592} + return file_otg_proto_rawDescGZIP(), []int{594} } func (x *PatternFlowIpv6VersionMetricTag) GetName() string { @@ -72949,7 +73154,7 @@ type PatternFlowIpv6Version struct { func (x *PatternFlowIpv6Version) Reset() { *x = PatternFlowIpv6Version{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[593] + mi := &file_otg_proto_msgTypes[595] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -72962,7 +73167,7 @@ func (x *PatternFlowIpv6Version) String() string { func (*PatternFlowIpv6Version) ProtoMessage() {} func (x *PatternFlowIpv6Version) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[593] + mi := &file_otg_proto_msgTypes[595] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -72975,7 +73180,7 @@ func (x *PatternFlowIpv6Version) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6Version.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6Version) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{593} + return file_otg_proto_rawDescGZIP(), []int{595} } func (x *PatternFlowIpv6Version) GetChoice() PatternFlowIpv6Version_Choice_Enum { @@ -73040,7 +73245,7 @@ type PatternFlowIpv6TrafficClassCounter struct { func (x *PatternFlowIpv6TrafficClassCounter) Reset() { *x = PatternFlowIpv6TrafficClassCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[594] + mi := &file_otg_proto_msgTypes[596] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -73053,7 +73258,7 @@ func (x *PatternFlowIpv6TrafficClassCounter) String() string { func (*PatternFlowIpv6TrafficClassCounter) ProtoMessage() {} func (x *PatternFlowIpv6TrafficClassCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[594] + mi := &file_otg_proto_msgTypes[596] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -73066,7 +73271,7 @@ func (x *PatternFlowIpv6TrafficClassCounter) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowIpv6TrafficClassCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6TrafficClassCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{594} + return file_otg_proto_rawDescGZIP(), []int{596} } func (x *PatternFlowIpv6TrafficClassCounter) GetStart() uint32 { @@ -73114,7 +73319,7 @@ type PatternFlowIpv6TrafficClassMetricTag struct { func (x *PatternFlowIpv6TrafficClassMetricTag) Reset() { *x = PatternFlowIpv6TrafficClassMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[595] + mi := &file_otg_proto_msgTypes[597] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -73127,7 +73332,7 @@ func (x *PatternFlowIpv6TrafficClassMetricTag) String() string { func (*PatternFlowIpv6TrafficClassMetricTag) ProtoMessage() {} func (x *PatternFlowIpv6TrafficClassMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[595] + mi := &file_otg_proto_msgTypes[597] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -73140,7 +73345,7 @@ func (x *PatternFlowIpv6TrafficClassMetricTag) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowIpv6TrafficClassMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6TrafficClassMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{595} + return file_otg_proto_rawDescGZIP(), []int{597} } func (x *PatternFlowIpv6TrafficClassMetricTag) GetName() string { @@ -73192,7 +73397,7 @@ type PatternFlowIpv6TrafficClass struct { func (x *PatternFlowIpv6TrafficClass) Reset() { *x = PatternFlowIpv6TrafficClass{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[596] + mi := &file_otg_proto_msgTypes[598] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -73205,7 +73410,7 @@ func (x *PatternFlowIpv6TrafficClass) String() string { func (*PatternFlowIpv6TrafficClass) ProtoMessage() {} func (x *PatternFlowIpv6TrafficClass) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[596] + mi := &file_otg_proto_msgTypes[598] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -73218,7 +73423,7 @@ func (x *PatternFlowIpv6TrafficClass) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6TrafficClass.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6TrafficClass) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{596} + return file_otg_proto_rawDescGZIP(), []int{598} } func (x *PatternFlowIpv6TrafficClass) GetChoice() PatternFlowIpv6TrafficClass_Choice_Enum { @@ -73283,7 +73488,7 @@ type PatternFlowIpv6FlowLabelCounter struct { func (x *PatternFlowIpv6FlowLabelCounter) Reset() { *x = PatternFlowIpv6FlowLabelCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[597] + mi := &file_otg_proto_msgTypes[599] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -73296,7 +73501,7 @@ func (x *PatternFlowIpv6FlowLabelCounter) String() string { func (*PatternFlowIpv6FlowLabelCounter) ProtoMessage() {} func (x *PatternFlowIpv6FlowLabelCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[597] + mi := &file_otg_proto_msgTypes[599] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -73309,7 +73514,7 @@ func (x *PatternFlowIpv6FlowLabelCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6FlowLabelCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6FlowLabelCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{597} + return file_otg_proto_rawDescGZIP(), []int{599} } func (x *PatternFlowIpv6FlowLabelCounter) GetStart() uint32 { @@ -73357,7 +73562,7 @@ type PatternFlowIpv6FlowLabelMetricTag struct { func (x *PatternFlowIpv6FlowLabelMetricTag) Reset() { *x = PatternFlowIpv6FlowLabelMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[598] + mi := &file_otg_proto_msgTypes[600] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -73370,7 +73575,7 @@ func (x *PatternFlowIpv6FlowLabelMetricTag) String() string { func (*PatternFlowIpv6FlowLabelMetricTag) ProtoMessage() {} func (x *PatternFlowIpv6FlowLabelMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[598] + mi := &file_otg_proto_msgTypes[600] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -73383,7 +73588,7 @@ func (x *PatternFlowIpv6FlowLabelMetricTag) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowIpv6FlowLabelMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6FlowLabelMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{598} + return file_otg_proto_rawDescGZIP(), []int{600} } func (x *PatternFlowIpv6FlowLabelMetricTag) GetName() string { @@ -73407,6 +73612,89 @@ func (x *PatternFlowIpv6FlowLabelMetricTag) GetLength() uint32 { return 0 } +// integer random pattern +type PatternFlowIpv6FlowLabelRandom struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The minimum possible value generated by the random value generator. + // default = 0 + Min *uint32 `protobuf:"varint,1,opt,name=min,proto3,oneof" json:"min,omitempty"` + // The maximum possible value generated by the random value generator. + // default = 1048575 + Max *uint32 `protobuf:"varint,2,opt,name=max,proto3,oneof" json:"max,omitempty"` + // The seed value is used to initialize the random number generator to a deterministic + // state. If the user provides a seed value of 0, the implementation will generate a + // sequence of non-deterministic random values. For any other seed value, the sequence + // of random numbers will be generated in a deterministic manner (specific to the implementation). + // default = 1 + Seed *uint32 `protobuf:"varint,3,opt,name=seed,proto3,oneof" json:"seed,omitempty"` + // The total number of values to be generated by the random value generator. + // default = 1 + Count *uint32 `protobuf:"varint,4,opt,name=count,proto3,oneof" json:"count,omitempty"` +} + +func (x *PatternFlowIpv6FlowLabelRandom) Reset() { + *x = PatternFlowIpv6FlowLabelRandom{} + if protoimpl.UnsafeEnabled { + mi := &file_otg_proto_msgTypes[601] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PatternFlowIpv6FlowLabelRandom) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatternFlowIpv6FlowLabelRandom) ProtoMessage() {} + +func (x *PatternFlowIpv6FlowLabelRandom) ProtoReflect() protoreflect.Message { + mi := &file_otg_proto_msgTypes[601] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PatternFlowIpv6FlowLabelRandom.ProtoReflect.Descriptor instead. +func (*PatternFlowIpv6FlowLabelRandom) Descriptor() ([]byte, []int) { + return file_otg_proto_rawDescGZIP(), []int{601} +} + +func (x *PatternFlowIpv6FlowLabelRandom) GetMin() uint32 { + if x != nil && x.Min != nil { + return *x.Min + } + return 0 +} + +func (x *PatternFlowIpv6FlowLabelRandom) GetMax() uint32 { + if x != nil && x.Max != nil { + return *x.Max + } + return 0 +} + +func (x *PatternFlowIpv6FlowLabelRandom) GetSeed() uint32 { + if x != nil && x.Seed != nil { + return *x.Seed + } + return 0 +} + +func (x *PatternFlowIpv6FlowLabelRandom) GetCount() uint32 { + if x != nil && x.Count != nil { + return *x.Count + } + return 0 +} + // Flow label type PatternFlowIpv6FlowLabel struct { state protoimpl.MessageState @@ -73430,12 +73718,14 @@ type PatternFlowIpv6FlowLabel struct { // a corresponding header field for metrics per each applicable value. These would appear // as tagged metrics in corresponding flow metrics. MetricTags []*PatternFlowIpv6FlowLabelMetricTag `protobuf:"bytes,7,rep,name=metric_tags,json=metricTags,proto3" json:"metric_tags,omitempty"` + // Description missing in models + Random *PatternFlowIpv6FlowLabelRandom `protobuf:"bytes,8,opt,name=random,proto3" json:"random,omitempty"` } func (x *PatternFlowIpv6FlowLabel) Reset() { *x = PatternFlowIpv6FlowLabel{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[599] + mi := &file_otg_proto_msgTypes[602] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -73448,7 +73738,7 @@ func (x *PatternFlowIpv6FlowLabel) String() string { func (*PatternFlowIpv6FlowLabel) ProtoMessage() {} func (x *PatternFlowIpv6FlowLabel) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[599] + mi := &file_otg_proto_msgTypes[602] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -73461,7 +73751,7 @@ func (x *PatternFlowIpv6FlowLabel) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6FlowLabel.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6FlowLabel) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{599} + return file_otg_proto_rawDescGZIP(), []int{602} } func (x *PatternFlowIpv6FlowLabel) GetChoice() PatternFlowIpv6FlowLabel_Choice_Enum { @@ -73506,6 +73796,13 @@ func (x *PatternFlowIpv6FlowLabel) GetMetricTags() []*PatternFlowIpv6FlowLabelMe return nil } +func (x *PatternFlowIpv6FlowLabel) GetRandom() *PatternFlowIpv6FlowLabelRandom { + if x != nil { + return x.Random + } + return nil +} + // integer counter pattern type PatternFlowIpv6PayloadLengthCounter struct { state protoimpl.MessageState @@ -73526,7 +73823,7 @@ type PatternFlowIpv6PayloadLengthCounter struct { func (x *PatternFlowIpv6PayloadLengthCounter) Reset() { *x = PatternFlowIpv6PayloadLengthCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[600] + mi := &file_otg_proto_msgTypes[603] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -73539,7 +73836,7 @@ func (x *PatternFlowIpv6PayloadLengthCounter) String() string { func (*PatternFlowIpv6PayloadLengthCounter) ProtoMessage() {} func (x *PatternFlowIpv6PayloadLengthCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[600] + mi := &file_otg_proto_msgTypes[603] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -73552,7 +73849,7 @@ func (x *PatternFlowIpv6PayloadLengthCounter) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowIpv6PayloadLengthCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6PayloadLengthCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{600} + return file_otg_proto_rawDescGZIP(), []int{603} } func (x *PatternFlowIpv6PayloadLengthCounter) GetStart() uint32 { @@ -73600,7 +73897,7 @@ type PatternFlowIpv6PayloadLengthMetricTag struct { func (x *PatternFlowIpv6PayloadLengthMetricTag) Reset() { *x = PatternFlowIpv6PayloadLengthMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[601] + mi := &file_otg_proto_msgTypes[604] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -73613,7 +73910,7 @@ func (x *PatternFlowIpv6PayloadLengthMetricTag) String() string { func (*PatternFlowIpv6PayloadLengthMetricTag) ProtoMessage() {} func (x *PatternFlowIpv6PayloadLengthMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[601] + mi := &file_otg_proto_msgTypes[604] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -73626,7 +73923,7 @@ func (x *PatternFlowIpv6PayloadLengthMetricTag) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowIpv6PayloadLengthMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6PayloadLengthMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{601} + return file_otg_proto_rawDescGZIP(), []int{604} } func (x *PatternFlowIpv6PayloadLengthMetricTag) GetName() string { @@ -73683,7 +73980,7 @@ type PatternFlowIpv6PayloadLength struct { func (x *PatternFlowIpv6PayloadLength) Reset() { *x = PatternFlowIpv6PayloadLength{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[602] + mi := &file_otg_proto_msgTypes[605] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -73696,7 +73993,7 @@ func (x *PatternFlowIpv6PayloadLength) String() string { func (*PatternFlowIpv6PayloadLength) ProtoMessage() {} func (x *PatternFlowIpv6PayloadLength) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[602] + mi := &file_otg_proto_msgTypes[605] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -73709,7 +74006,7 @@ func (x *PatternFlowIpv6PayloadLength) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6PayloadLength.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6PayloadLength) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{602} + return file_otg_proto_rawDescGZIP(), []int{605} } func (x *PatternFlowIpv6PayloadLength) GetChoice() PatternFlowIpv6PayloadLength_Choice_Enum { @@ -73781,7 +74078,7 @@ type PatternFlowIpv6NextHeaderCounter struct { func (x *PatternFlowIpv6NextHeaderCounter) Reset() { *x = PatternFlowIpv6NextHeaderCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[603] + mi := &file_otg_proto_msgTypes[606] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -73794,7 +74091,7 @@ func (x *PatternFlowIpv6NextHeaderCounter) String() string { func (*PatternFlowIpv6NextHeaderCounter) ProtoMessage() {} func (x *PatternFlowIpv6NextHeaderCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[603] + mi := &file_otg_proto_msgTypes[606] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -73807,7 +74104,7 @@ func (x *PatternFlowIpv6NextHeaderCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6NextHeaderCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6NextHeaderCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{603} + return file_otg_proto_rawDescGZIP(), []int{606} } func (x *PatternFlowIpv6NextHeaderCounter) GetStart() uint32 { @@ -73855,7 +74152,7 @@ type PatternFlowIpv6NextHeaderMetricTag struct { func (x *PatternFlowIpv6NextHeaderMetricTag) Reset() { *x = PatternFlowIpv6NextHeaderMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[604] + mi := &file_otg_proto_msgTypes[607] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -73868,7 +74165,7 @@ func (x *PatternFlowIpv6NextHeaderMetricTag) String() string { func (*PatternFlowIpv6NextHeaderMetricTag) ProtoMessage() {} func (x *PatternFlowIpv6NextHeaderMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[604] + mi := &file_otg_proto_msgTypes[607] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -73881,7 +74178,7 @@ func (x *PatternFlowIpv6NextHeaderMetricTag) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowIpv6NextHeaderMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6NextHeaderMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{604} + return file_otg_proto_rawDescGZIP(), []int{607} } func (x *PatternFlowIpv6NextHeaderMetricTag) GetName() string { @@ -73938,7 +74235,7 @@ type PatternFlowIpv6NextHeader struct { func (x *PatternFlowIpv6NextHeader) Reset() { *x = PatternFlowIpv6NextHeader{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[605] + mi := &file_otg_proto_msgTypes[608] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -73951,7 +74248,7 @@ func (x *PatternFlowIpv6NextHeader) String() string { func (*PatternFlowIpv6NextHeader) ProtoMessage() {} func (x *PatternFlowIpv6NextHeader) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[605] + mi := &file_otg_proto_msgTypes[608] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -73964,7 +74261,7 @@ func (x *PatternFlowIpv6NextHeader) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6NextHeader.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6NextHeader) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{605} + return file_otg_proto_rawDescGZIP(), []int{608} } func (x *PatternFlowIpv6NextHeader) GetChoice() PatternFlowIpv6NextHeader_Choice_Enum { @@ -74036,7 +74333,7 @@ type PatternFlowIpv6HopLimitCounter struct { func (x *PatternFlowIpv6HopLimitCounter) Reset() { *x = PatternFlowIpv6HopLimitCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[606] + mi := &file_otg_proto_msgTypes[609] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -74049,7 +74346,7 @@ func (x *PatternFlowIpv6HopLimitCounter) String() string { func (*PatternFlowIpv6HopLimitCounter) ProtoMessage() {} func (x *PatternFlowIpv6HopLimitCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[606] + mi := &file_otg_proto_msgTypes[609] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -74062,7 +74359,7 @@ func (x *PatternFlowIpv6HopLimitCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6HopLimitCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6HopLimitCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{606} + return file_otg_proto_rawDescGZIP(), []int{609} } func (x *PatternFlowIpv6HopLimitCounter) GetStart() uint32 { @@ -74110,7 +74407,7 @@ type PatternFlowIpv6HopLimitMetricTag struct { func (x *PatternFlowIpv6HopLimitMetricTag) Reset() { *x = PatternFlowIpv6HopLimitMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[607] + mi := &file_otg_proto_msgTypes[610] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -74123,7 +74420,7 @@ func (x *PatternFlowIpv6HopLimitMetricTag) String() string { func (*PatternFlowIpv6HopLimitMetricTag) ProtoMessage() {} func (x *PatternFlowIpv6HopLimitMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[607] + mi := &file_otg_proto_msgTypes[610] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -74136,7 +74433,7 @@ func (x *PatternFlowIpv6HopLimitMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6HopLimitMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6HopLimitMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{607} + return file_otg_proto_rawDescGZIP(), []int{610} } func (x *PatternFlowIpv6HopLimitMetricTag) GetName() string { @@ -74188,7 +74485,7 @@ type PatternFlowIpv6HopLimit struct { func (x *PatternFlowIpv6HopLimit) Reset() { *x = PatternFlowIpv6HopLimit{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[608] + mi := &file_otg_proto_msgTypes[611] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -74201,7 +74498,7 @@ func (x *PatternFlowIpv6HopLimit) String() string { func (*PatternFlowIpv6HopLimit) ProtoMessage() {} func (x *PatternFlowIpv6HopLimit) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[608] + mi := &file_otg_proto_msgTypes[611] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -74214,7 +74511,7 @@ func (x *PatternFlowIpv6HopLimit) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6HopLimit.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6HopLimit) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{608} + return file_otg_proto_rawDescGZIP(), []int{611} } func (x *PatternFlowIpv6HopLimit) GetChoice() PatternFlowIpv6HopLimit_Choice_Enum { @@ -74279,7 +74576,7 @@ type PatternFlowIpv6SrcCounter struct { func (x *PatternFlowIpv6SrcCounter) Reset() { *x = PatternFlowIpv6SrcCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[609] + mi := &file_otg_proto_msgTypes[612] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -74292,7 +74589,7 @@ func (x *PatternFlowIpv6SrcCounter) String() string { func (*PatternFlowIpv6SrcCounter) ProtoMessage() {} func (x *PatternFlowIpv6SrcCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[609] + mi := &file_otg_proto_msgTypes[612] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -74305,7 +74602,7 @@ func (x *PatternFlowIpv6SrcCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6SrcCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6SrcCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{609} + return file_otg_proto_rawDescGZIP(), []int{612} } func (x *PatternFlowIpv6SrcCounter) GetStart() string { @@ -74353,7 +74650,7 @@ type PatternFlowIpv6SrcMetricTag struct { func (x *PatternFlowIpv6SrcMetricTag) Reset() { *x = PatternFlowIpv6SrcMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[610] + mi := &file_otg_proto_msgTypes[613] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -74366,7 +74663,7 @@ func (x *PatternFlowIpv6SrcMetricTag) String() string { func (*PatternFlowIpv6SrcMetricTag) ProtoMessage() {} func (x *PatternFlowIpv6SrcMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[610] + mi := &file_otg_proto_msgTypes[613] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -74379,7 +74676,7 @@ func (x *PatternFlowIpv6SrcMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6SrcMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6SrcMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{610} + return file_otg_proto_rawDescGZIP(), []int{613} } func (x *PatternFlowIpv6SrcMetricTag) GetName() string { @@ -74431,7 +74728,7 @@ type PatternFlowIpv6Src struct { func (x *PatternFlowIpv6Src) Reset() { *x = PatternFlowIpv6Src{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[611] + mi := &file_otg_proto_msgTypes[614] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -74444,7 +74741,7 @@ func (x *PatternFlowIpv6Src) String() string { func (*PatternFlowIpv6Src) ProtoMessage() {} func (x *PatternFlowIpv6Src) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[611] + mi := &file_otg_proto_msgTypes[614] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -74457,7 +74754,7 @@ func (x *PatternFlowIpv6Src) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6Src.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6Src) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{611} + return file_otg_proto_rawDescGZIP(), []int{614} } func (x *PatternFlowIpv6Src) GetChoice() PatternFlowIpv6Src_Choice_Enum { @@ -74522,7 +74819,7 @@ type PatternFlowIpv6DstCounter struct { func (x *PatternFlowIpv6DstCounter) Reset() { *x = PatternFlowIpv6DstCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[612] + mi := &file_otg_proto_msgTypes[615] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -74535,7 +74832,7 @@ func (x *PatternFlowIpv6DstCounter) String() string { func (*PatternFlowIpv6DstCounter) ProtoMessage() {} func (x *PatternFlowIpv6DstCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[612] + mi := &file_otg_proto_msgTypes[615] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -74548,7 +74845,7 @@ func (x *PatternFlowIpv6DstCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6DstCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6DstCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{612} + return file_otg_proto_rawDescGZIP(), []int{615} } func (x *PatternFlowIpv6DstCounter) GetStart() string { @@ -74596,7 +74893,7 @@ type PatternFlowIpv6DstMetricTag struct { func (x *PatternFlowIpv6DstMetricTag) Reset() { *x = PatternFlowIpv6DstMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[613] + mi := &file_otg_proto_msgTypes[616] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -74609,7 +74906,7 @@ func (x *PatternFlowIpv6DstMetricTag) String() string { func (*PatternFlowIpv6DstMetricTag) ProtoMessage() {} func (x *PatternFlowIpv6DstMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[613] + mi := &file_otg_proto_msgTypes[616] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -74622,7 +74919,7 @@ func (x *PatternFlowIpv6DstMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6DstMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6DstMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{613} + return file_otg_proto_rawDescGZIP(), []int{616} } func (x *PatternFlowIpv6DstMetricTag) GetName() string { @@ -74674,7 +74971,7 @@ type PatternFlowIpv6Dst struct { func (x *PatternFlowIpv6Dst) Reset() { *x = PatternFlowIpv6Dst{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[614] + mi := &file_otg_proto_msgTypes[617] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -74687,7 +74984,7 @@ func (x *PatternFlowIpv6Dst) String() string { func (*PatternFlowIpv6Dst) ProtoMessage() {} func (x *PatternFlowIpv6Dst) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[614] + mi := &file_otg_proto_msgTypes[617] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -74700,7 +74997,7 @@ func (x *PatternFlowIpv6Dst) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6Dst.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6Dst) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{614} + return file_otg_proto_rawDescGZIP(), []int{617} } func (x *PatternFlowIpv6Dst) GetChoice() PatternFlowIpv6Dst_Choice_Enum { @@ -74765,7 +75062,7 @@ type PatternFlowPfcPauseDstCounter struct { func (x *PatternFlowPfcPauseDstCounter) Reset() { *x = PatternFlowPfcPauseDstCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[615] + mi := &file_otg_proto_msgTypes[618] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -74778,7 +75075,7 @@ func (x *PatternFlowPfcPauseDstCounter) String() string { func (*PatternFlowPfcPauseDstCounter) ProtoMessage() {} func (x *PatternFlowPfcPauseDstCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[615] + mi := &file_otg_proto_msgTypes[618] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -74791,7 +75088,7 @@ func (x *PatternFlowPfcPauseDstCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPauseDstCounter.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseDstCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{615} + return file_otg_proto_rawDescGZIP(), []int{618} } func (x *PatternFlowPfcPauseDstCounter) GetStart() string { @@ -74839,7 +75136,7 @@ type PatternFlowPfcPauseDstMetricTag struct { func (x *PatternFlowPfcPauseDstMetricTag) Reset() { *x = PatternFlowPfcPauseDstMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[616] + mi := &file_otg_proto_msgTypes[619] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -74852,7 +75149,7 @@ func (x *PatternFlowPfcPauseDstMetricTag) String() string { func (*PatternFlowPfcPauseDstMetricTag) ProtoMessage() {} func (x *PatternFlowPfcPauseDstMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[616] + mi := &file_otg_proto_msgTypes[619] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -74865,7 +75162,7 @@ func (x *PatternFlowPfcPauseDstMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPauseDstMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseDstMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{616} + return file_otg_proto_rawDescGZIP(), []int{619} } func (x *PatternFlowPfcPauseDstMetricTag) GetName() string { @@ -74917,7 +75214,7 @@ type PatternFlowPfcPauseDst struct { func (x *PatternFlowPfcPauseDst) Reset() { *x = PatternFlowPfcPauseDst{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[617] + mi := &file_otg_proto_msgTypes[620] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -74930,7 +75227,7 @@ func (x *PatternFlowPfcPauseDst) String() string { func (*PatternFlowPfcPauseDst) ProtoMessage() {} func (x *PatternFlowPfcPauseDst) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[617] + mi := &file_otg_proto_msgTypes[620] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -74943,7 +75240,7 @@ func (x *PatternFlowPfcPauseDst) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPauseDst.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseDst) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{617} + return file_otg_proto_rawDescGZIP(), []int{620} } func (x *PatternFlowPfcPauseDst) GetChoice() PatternFlowPfcPauseDst_Choice_Enum { @@ -75008,7 +75305,7 @@ type PatternFlowPfcPauseSrcCounter struct { func (x *PatternFlowPfcPauseSrcCounter) Reset() { *x = PatternFlowPfcPauseSrcCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[618] + mi := &file_otg_proto_msgTypes[621] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -75021,7 +75318,7 @@ func (x *PatternFlowPfcPauseSrcCounter) String() string { func (*PatternFlowPfcPauseSrcCounter) ProtoMessage() {} func (x *PatternFlowPfcPauseSrcCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[618] + mi := &file_otg_proto_msgTypes[621] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -75034,7 +75331,7 @@ func (x *PatternFlowPfcPauseSrcCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPauseSrcCounter.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseSrcCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{618} + return file_otg_proto_rawDescGZIP(), []int{621} } func (x *PatternFlowPfcPauseSrcCounter) GetStart() string { @@ -75082,7 +75379,7 @@ type PatternFlowPfcPauseSrcMetricTag struct { func (x *PatternFlowPfcPauseSrcMetricTag) Reset() { *x = PatternFlowPfcPauseSrcMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[619] + mi := &file_otg_proto_msgTypes[622] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -75095,7 +75392,7 @@ func (x *PatternFlowPfcPauseSrcMetricTag) String() string { func (*PatternFlowPfcPauseSrcMetricTag) ProtoMessage() {} func (x *PatternFlowPfcPauseSrcMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[619] + mi := &file_otg_proto_msgTypes[622] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -75108,7 +75405,7 @@ func (x *PatternFlowPfcPauseSrcMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPauseSrcMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseSrcMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{619} + return file_otg_proto_rawDescGZIP(), []int{622} } func (x *PatternFlowPfcPauseSrcMetricTag) GetName() string { @@ -75160,7 +75457,7 @@ type PatternFlowPfcPauseSrc struct { func (x *PatternFlowPfcPauseSrc) Reset() { *x = PatternFlowPfcPauseSrc{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[620] + mi := &file_otg_proto_msgTypes[623] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -75173,7 +75470,7 @@ func (x *PatternFlowPfcPauseSrc) String() string { func (*PatternFlowPfcPauseSrc) ProtoMessage() {} func (x *PatternFlowPfcPauseSrc) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[620] + mi := &file_otg_proto_msgTypes[623] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -75186,7 +75483,7 @@ func (x *PatternFlowPfcPauseSrc) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPauseSrc.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseSrc) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{620} + return file_otg_proto_rawDescGZIP(), []int{623} } func (x *PatternFlowPfcPauseSrc) GetChoice() PatternFlowPfcPauseSrc_Choice_Enum { @@ -75251,7 +75548,7 @@ type PatternFlowPfcPauseEtherTypeCounter struct { func (x *PatternFlowPfcPauseEtherTypeCounter) Reset() { *x = PatternFlowPfcPauseEtherTypeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[621] + mi := &file_otg_proto_msgTypes[624] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -75264,7 +75561,7 @@ func (x *PatternFlowPfcPauseEtherTypeCounter) String() string { func (*PatternFlowPfcPauseEtherTypeCounter) ProtoMessage() {} func (x *PatternFlowPfcPauseEtherTypeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[621] + mi := &file_otg_proto_msgTypes[624] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -75277,7 +75574,7 @@ func (x *PatternFlowPfcPauseEtherTypeCounter) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowPfcPauseEtherTypeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseEtherTypeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{621} + return file_otg_proto_rawDescGZIP(), []int{624} } func (x *PatternFlowPfcPauseEtherTypeCounter) GetStart() uint32 { @@ -75325,7 +75622,7 @@ type PatternFlowPfcPauseEtherTypeMetricTag struct { func (x *PatternFlowPfcPauseEtherTypeMetricTag) Reset() { *x = PatternFlowPfcPauseEtherTypeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[622] + mi := &file_otg_proto_msgTypes[625] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -75338,7 +75635,7 @@ func (x *PatternFlowPfcPauseEtherTypeMetricTag) String() string { func (*PatternFlowPfcPauseEtherTypeMetricTag) ProtoMessage() {} func (x *PatternFlowPfcPauseEtherTypeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[622] + mi := &file_otg_proto_msgTypes[625] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -75351,7 +75648,7 @@ func (x *PatternFlowPfcPauseEtherTypeMetricTag) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPauseEtherTypeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseEtherTypeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{622} + return file_otg_proto_rawDescGZIP(), []int{625} } func (x *PatternFlowPfcPauseEtherTypeMetricTag) GetName() string { @@ -75403,7 +75700,7 @@ type PatternFlowPfcPauseEtherType struct { func (x *PatternFlowPfcPauseEtherType) Reset() { *x = PatternFlowPfcPauseEtherType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[623] + mi := &file_otg_proto_msgTypes[626] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -75416,7 +75713,7 @@ func (x *PatternFlowPfcPauseEtherType) String() string { func (*PatternFlowPfcPauseEtherType) ProtoMessage() {} func (x *PatternFlowPfcPauseEtherType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[623] + mi := &file_otg_proto_msgTypes[626] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -75429,7 +75726,7 @@ func (x *PatternFlowPfcPauseEtherType) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPauseEtherType.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseEtherType) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{623} + return file_otg_proto_rawDescGZIP(), []int{626} } func (x *PatternFlowPfcPauseEtherType) GetChoice() PatternFlowPfcPauseEtherType_Choice_Enum { @@ -75494,7 +75791,7 @@ type PatternFlowPfcPauseControlOpCodeCounter struct { func (x *PatternFlowPfcPauseControlOpCodeCounter) Reset() { *x = PatternFlowPfcPauseControlOpCodeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[624] + mi := &file_otg_proto_msgTypes[627] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -75507,7 +75804,7 @@ func (x *PatternFlowPfcPauseControlOpCodeCounter) String() string { func (*PatternFlowPfcPauseControlOpCodeCounter) ProtoMessage() {} func (x *PatternFlowPfcPauseControlOpCodeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[624] + mi := &file_otg_proto_msgTypes[627] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -75520,7 +75817,7 @@ func (x *PatternFlowPfcPauseControlOpCodeCounter) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowPfcPauseControlOpCodeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseControlOpCodeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{624} + return file_otg_proto_rawDescGZIP(), []int{627} } func (x *PatternFlowPfcPauseControlOpCodeCounter) GetStart() uint32 { @@ -75568,7 +75865,7 @@ type PatternFlowPfcPauseControlOpCodeMetricTag struct { func (x *PatternFlowPfcPauseControlOpCodeMetricTag) Reset() { *x = PatternFlowPfcPauseControlOpCodeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[625] + mi := &file_otg_proto_msgTypes[628] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -75581,7 +75878,7 @@ func (x *PatternFlowPfcPauseControlOpCodeMetricTag) String() string { func (*PatternFlowPfcPauseControlOpCodeMetricTag) ProtoMessage() {} func (x *PatternFlowPfcPauseControlOpCodeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[625] + mi := &file_otg_proto_msgTypes[628] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -75594,7 +75891,7 @@ func (x *PatternFlowPfcPauseControlOpCodeMetricTag) ProtoReflect() protoreflect. // Deprecated: Use PatternFlowPfcPauseControlOpCodeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseControlOpCodeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{625} + return file_otg_proto_rawDescGZIP(), []int{628} } func (x *PatternFlowPfcPauseControlOpCodeMetricTag) GetName() string { @@ -75646,7 +75943,7 @@ type PatternFlowPfcPauseControlOpCode struct { func (x *PatternFlowPfcPauseControlOpCode) Reset() { *x = PatternFlowPfcPauseControlOpCode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[626] + mi := &file_otg_proto_msgTypes[629] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -75659,7 +75956,7 @@ func (x *PatternFlowPfcPauseControlOpCode) String() string { func (*PatternFlowPfcPauseControlOpCode) ProtoMessage() {} func (x *PatternFlowPfcPauseControlOpCode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[626] + mi := &file_otg_proto_msgTypes[629] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -75672,7 +75969,7 @@ func (x *PatternFlowPfcPauseControlOpCode) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPauseControlOpCode.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseControlOpCode) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{626} + return file_otg_proto_rawDescGZIP(), []int{629} } func (x *PatternFlowPfcPauseControlOpCode) GetChoice() PatternFlowPfcPauseControlOpCode_Choice_Enum { @@ -75737,7 +76034,7 @@ type PatternFlowPfcPauseClassEnableVectorCounter struct { func (x *PatternFlowPfcPauseClassEnableVectorCounter) Reset() { *x = PatternFlowPfcPauseClassEnableVectorCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[627] + mi := &file_otg_proto_msgTypes[630] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -75750,7 +76047,7 @@ func (x *PatternFlowPfcPauseClassEnableVectorCounter) String() string { func (*PatternFlowPfcPauseClassEnableVectorCounter) ProtoMessage() {} func (x *PatternFlowPfcPauseClassEnableVectorCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[627] + mi := &file_otg_proto_msgTypes[630] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -75763,7 +76060,7 @@ func (x *PatternFlowPfcPauseClassEnableVectorCounter) ProtoReflect() protoreflec // Deprecated: Use PatternFlowPfcPauseClassEnableVectorCounter.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseClassEnableVectorCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{627} + return file_otg_proto_rawDescGZIP(), []int{630} } func (x *PatternFlowPfcPauseClassEnableVectorCounter) GetStart() uint32 { @@ -75811,7 +76108,7 @@ type PatternFlowPfcPauseClassEnableVectorMetricTag struct { func (x *PatternFlowPfcPauseClassEnableVectorMetricTag) Reset() { *x = PatternFlowPfcPauseClassEnableVectorMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[628] + mi := &file_otg_proto_msgTypes[631] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -75824,7 +76121,7 @@ func (x *PatternFlowPfcPauseClassEnableVectorMetricTag) String() string { func (*PatternFlowPfcPauseClassEnableVectorMetricTag) ProtoMessage() {} func (x *PatternFlowPfcPauseClassEnableVectorMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[628] + mi := &file_otg_proto_msgTypes[631] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -75837,7 +76134,7 @@ func (x *PatternFlowPfcPauseClassEnableVectorMetricTag) ProtoReflect() protorefl // Deprecated: Use PatternFlowPfcPauseClassEnableVectorMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseClassEnableVectorMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{628} + return file_otg_proto_rawDescGZIP(), []int{631} } func (x *PatternFlowPfcPauseClassEnableVectorMetricTag) GetName() string { @@ -75889,7 +76186,7 @@ type PatternFlowPfcPauseClassEnableVector struct { func (x *PatternFlowPfcPauseClassEnableVector) Reset() { *x = PatternFlowPfcPauseClassEnableVector{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[629] + mi := &file_otg_proto_msgTypes[632] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -75902,7 +76199,7 @@ func (x *PatternFlowPfcPauseClassEnableVector) String() string { func (*PatternFlowPfcPauseClassEnableVector) ProtoMessage() {} func (x *PatternFlowPfcPauseClassEnableVector) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[629] + mi := &file_otg_proto_msgTypes[632] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -75915,7 +76212,7 @@ func (x *PatternFlowPfcPauseClassEnableVector) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowPfcPauseClassEnableVector.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseClassEnableVector) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{629} + return file_otg_proto_rawDescGZIP(), []int{632} } func (x *PatternFlowPfcPauseClassEnableVector) GetChoice() PatternFlowPfcPauseClassEnableVector_Choice_Enum { @@ -75980,7 +76277,7 @@ type PatternFlowPfcPausePauseClass0Counter struct { func (x *PatternFlowPfcPausePauseClass0Counter) Reset() { *x = PatternFlowPfcPausePauseClass0Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[630] + mi := &file_otg_proto_msgTypes[633] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -75993,7 +76290,7 @@ func (x *PatternFlowPfcPausePauseClass0Counter) String() string { func (*PatternFlowPfcPausePauseClass0Counter) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass0Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[630] + mi := &file_otg_proto_msgTypes[633] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -76006,7 +76303,7 @@ func (x *PatternFlowPfcPausePauseClass0Counter) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass0Counter.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass0Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{630} + return file_otg_proto_rawDescGZIP(), []int{633} } func (x *PatternFlowPfcPausePauseClass0Counter) GetStart() uint32 { @@ -76054,7 +76351,7 @@ type PatternFlowPfcPausePauseClass0MetricTag struct { func (x *PatternFlowPfcPausePauseClass0MetricTag) Reset() { *x = PatternFlowPfcPausePauseClass0MetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[631] + mi := &file_otg_proto_msgTypes[634] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -76067,7 +76364,7 @@ func (x *PatternFlowPfcPausePauseClass0MetricTag) String() string { func (*PatternFlowPfcPausePauseClass0MetricTag) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass0MetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[631] + mi := &file_otg_proto_msgTypes[634] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -76080,7 +76377,7 @@ func (x *PatternFlowPfcPausePauseClass0MetricTag) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowPfcPausePauseClass0MetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass0MetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{631} + return file_otg_proto_rawDescGZIP(), []int{634} } func (x *PatternFlowPfcPausePauseClass0MetricTag) GetName() string { @@ -76132,7 +76429,7 @@ type PatternFlowPfcPausePauseClass0 struct { func (x *PatternFlowPfcPausePauseClass0) Reset() { *x = PatternFlowPfcPausePauseClass0{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[632] + mi := &file_otg_proto_msgTypes[635] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -76145,7 +76442,7 @@ func (x *PatternFlowPfcPausePauseClass0) String() string { func (*PatternFlowPfcPausePauseClass0) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass0) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[632] + mi := &file_otg_proto_msgTypes[635] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -76158,7 +76455,7 @@ func (x *PatternFlowPfcPausePauseClass0) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPausePauseClass0.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass0) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{632} + return file_otg_proto_rawDescGZIP(), []int{635} } func (x *PatternFlowPfcPausePauseClass0) GetChoice() PatternFlowPfcPausePauseClass0_Choice_Enum { @@ -76223,7 +76520,7 @@ type PatternFlowPfcPausePauseClass1Counter struct { func (x *PatternFlowPfcPausePauseClass1Counter) Reset() { *x = PatternFlowPfcPausePauseClass1Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[633] + mi := &file_otg_proto_msgTypes[636] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -76236,7 +76533,7 @@ func (x *PatternFlowPfcPausePauseClass1Counter) String() string { func (*PatternFlowPfcPausePauseClass1Counter) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass1Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[633] + mi := &file_otg_proto_msgTypes[636] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -76249,7 +76546,7 @@ func (x *PatternFlowPfcPausePauseClass1Counter) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass1Counter.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass1Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{633} + return file_otg_proto_rawDescGZIP(), []int{636} } func (x *PatternFlowPfcPausePauseClass1Counter) GetStart() uint32 { @@ -76297,7 +76594,7 @@ type PatternFlowPfcPausePauseClass1MetricTag struct { func (x *PatternFlowPfcPausePauseClass1MetricTag) Reset() { *x = PatternFlowPfcPausePauseClass1MetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[634] + mi := &file_otg_proto_msgTypes[637] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -76310,7 +76607,7 @@ func (x *PatternFlowPfcPausePauseClass1MetricTag) String() string { func (*PatternFlowPfcPausePauseClass1MetricTag) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass1MetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[634] + mi := &file_otg_proto_msgTypes[637] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -76323,7 +76620,7 @@ func (x *PatternFlowPfcPausePauseClass1MetricTag) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowPfcPausePauseClass1MetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass1MetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{634} + return file_otg_proto_rawDescGZIP(), []int{637} } func (x *PatternFlowPfcPausePauseClass1MetricTag) GetName() string { @@ -76375,7 +76672,7 @@ type PatternFlowPfcPausePauseClass1 struct { func (x *PatternFlowPfcPausePauseClass1) Reset() { *x = PatternFlowPfcPausePauseClass1{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[635] + mi := &file_otg_proto_msgTypes[638] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -76388,7 +76685,7 @@ func (x *PatternFlowPfcPausePauseClass1) String() string { func (*PatternFlowPfcPausePauseClass1) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass1) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[635] + mi := &file_otg_proto_msgTypes[638] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -76401,7 +76698,7 @@ func (x *PatternFlowPfcPausePauseClass1) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPausePauseClass1.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass1) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{635} + return file_otg_proto_rawDescGZIP(), []int{638} } func (x *PatternFlowPfcPausePauseClass1) GetChoice() PatternFlowPfcPausePauseClass1_Choice_Enum { @@ -76466,7 +76763,7 @@ type PatternFlowPfcPausePauseClass2Counter struct { func (x *PatternFlowPfcPausePauseClass2Counter) Reset() { *x = PatternFlowPfcPausePauseClass2Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[636] + mi := &file_otg_proto_msgTypes[639] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -76479,7 +76776,7 @@ func (x *PatternFlowPfcPausePauseClass2Counter) String() string { func (*PatternFlowPfcPausePauseClass2Counter) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass2Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[636] + mi := &file_otg_proto_msgTypes[639] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -76492,7 +76789,7 @@ func (x *PatternFlowPfcPausePauseClass2Counter) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass2Counter.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass2Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{636} + return file_otg_proto_rawDescGZIP(), []int{639} } func (x *PatternFlowPfcPausePauseClass2Counter) GetStart() uint32 { @@ -76540,7 +76837,7 @@ type PatternFlowPfcPausePauseClass2MetricTag struct { func (x *PatternFlowPfcPausePauseClass2MetricTag) Reset() { *x = PatternFlowPfcPausePauseClass2MetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[637] + mi := &file_otg_proto_msgTypes[640] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -76553,7 +76850,7 @@ func (x *PatternFlowPfcPausePauseClass2MetricTag) String() string { func (*PatternFlowPfcPausePauseClass2MetricTag) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass2MetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[637] + mi := &file_otg_proto_msgTypes[640] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -76566,7 +76863,7 @@ func (x *PatternFlowPfcPausePauseClass2MetricTag) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowPfcPausePauseClass2MetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass2MetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{637} + return file_otg_proto_rawDescGZIP(), []int{640} } func (x *PatternFlowPfcPausePauseClass2MetricTag) GetName() string { @@ -76618,7 +76915,7 @@ type PatternFlowPfcPausePauseClass2 struct { func (x *PatternFlowPfcPausePauseClass2) Reset() { *x = PatternFlowPfcPausePauseClass2{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[638] + mi := &file_otg_proto_msgTypes[641] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -76631,7 +76928,7 @@ func (x *PatternFlowPfcPausePauseClass2) String() string { func (*PatternFlowPfcPausePauseClass2) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass2) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[638] + mi := &file_otg_proto_msgTypes[641] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -76644,7 +76941,7 @@ func (x *PatternFlowPfcPausePauseClass2) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPausePauseClass2.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass2) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{638} + return file_otg_proto_rawDescGZIP(), []int{641} } func (x *PatternFlowPfcPausePauseClass2) GetChoice() PatternFlowPfcPausePauseClass2_Choice_Enum { @@ -76709,7 +77006,7 @@ type PatternFlowPfcPausePauseClass3Counter struct { func (x *PatternFlowPfcPausePauseClass3Counter) Reset() { *x = PatternFlowPfcPausePauseClass3Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[639] + mi := &file_otg_proto_msgTypes[642] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -76722,7 +77019,7 @@ func (x *PatternFlowPfcPausePauseClass3Counter) String() string { func (*PatternFlowPfcPausePauseClass3Counter) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass3Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[639] + mi := &file_otg_proto_msgTypes[642] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -76735,7 +77032,7 @@ func (x *PatternFlowPfcPausePauseClass3Counter) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass3Counter.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass3Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{639} + return file_otg_proto_rawDescGZIP(), []int{642} } func (x *PatternFlowPfcPausePauseClass3Counter) GetStart() uint32 { @@ -76783,7 +77080,7 @@ type PatternFlowPfcPausePauseClass3MetricTag struct { func (x *PatternFlowPfcPausePauseClass3MetricTag) Reset() { *x = PatternFlowPfcPausePauseClass3MetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[640] + mi := &file_otg_proto_msgTypes[643] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -76796,7 +77093,7 @@ func (x *PatternFlowPfcPausePauseClass3MetricTag) String() string { func (*PatternFlowPfcPausePauseClass3MetricTag) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass3MetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[640] + mi := &file_otg_proto_msgTypes[643] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -76809,7 +77106,7 @@ func (x *PatternFlowPfcPausePauseClass3MetricTag) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowPfcPausePauseClass3MetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass3MetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{640} + return file_otg_proto_rawDescGZIP(), []int{643} } func (x *PatternFlowPfcPausePauseClass3MetricTag) GetName() string { @@ -76861,7 +77158,7 @@ type PatternFlowPfcPausePauseClass3 struct { func (x *PatternFlowPfcPausePauseClass3) Reset() { *x = PatternFlowPfcPausePauseClass3{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[641] + mi := &file_otg_proto_msgTypes[644] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -76874,7 +77171,7 @@ func (x *PatternFlowPfcPausePauseClass3) String() string { func (*PatternFlowPfcPausePauseClass3) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass3) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[641] + mi := &file_otg_proto_msgTypes[644] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -76887,7 +77184,7 @@ func (x *PatternFlowPfcPausePauseClass3) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPausePauseClass3.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass3) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{641} + return file_otg_proto_rawDescGZIP(), []int{644} } func (x *PatternFlowPfcPausePauseClass3) GetChoice() PatternFlowPfcPausePauseClass3_Choice_Enum { @@ -76952,7 +77249,7 @@ type PatternFlowPfcPausePauseClass4Counter struct { func (x *PatternFlowPfcPausePauseClass4Counter) Reset() { *x = PatternFlowPfcPausePauseClass4Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[642] + mi := &file_otg_proto_msgTypes[645] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -76965,7 +77262,7 @@ func (x *PatternFlowPfcPausePauseClass4Counter) String() string { func (*PatternFlowPfcPausePauseClass4Counter) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass4Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[642] + mi := &file_otg_proto_msgTypes[645] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -76978,7 +77275,7 @@ func (x *PatternFlowPfcPausePauseClass4Counter) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass4Counter.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass4Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{642} + return file_otg_proto_rawDescGZIP(), []int{645} } func (x *PatternFlowPfcPausePauseClass4Counter) GetStart() uint32 { @@ -77026,7 +77323,7 @@ type PatternFlowPfcPausePauseClass4MetricTag struct { func (x *PatternFlowPfcPausePauseClass4MetricTag) Reset() { *x = PatternFlowPfcPausePauseClass4MetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[643] + mi := &file_otg_proto_msgTypes[646] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -77039,7 +77336,7 @@ func (x *PatternFlowPfcPausePauseClass4MetricTag) String() string { func (*PatternFlowPfcPausePauseClass4MetricTag) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass4MetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[643] + mi := &file_otg_proto_msgTypes[646] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -77052,7 +77349,7 @@ func (x *PatternFlowPfcPausePauseClass4MetricTag) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowPfcPausePauseClass4MetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass4MetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{643} + return file_otg_proto_rawDescGZIP(), []int{646} } func (x *PatternFlowPfcPausePauseClass4MetricTag) GetName() string { @@ -77104,7 +77401,7 @@ type PatternFlowPfcPausePauseClass4 struct { func (x *PatternFlowPfcPausePauseClass4) Reset() { *x = PatternFlowPfcPausePauseClass4{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[644] + mi := &file_otg_proto_msgTypes[647] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -77117,7 +77414,7 @@ func (x *PatternFlowPfcPausePauseClass4) String() string { func (*PatternFlowPfcPausePauseClass4) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass4) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[644] + mi := &file_otg_proto_msgTypes[647] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -77130,7 +77427,7 @@ func (x *PatternFlowPfcPausePauseClass4) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPausePauseClass4.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass4) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{644} + return file_otg_proto_rawDescGZIP(), []int{647} } func (x *PatternFlowPfcPausePauseClass4) GetChoice() PatternFlowPfcPausePauseClass4_Choice_Enum { @@ -77195,7 +77492,7 @@ type PatternFlowPfcPausePauseClass5Counter struct { func (x *PatternFlowPfcPausePauseClass5Counter) Reset() { *x = PatternFlowPfcPausePauseClass5Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[645] + mi := &file_otg_proto_msgTypes[648] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -77208,7 +77505,7 @@ func (x *PatternFlowPfcPausePauseClass5Counter) String() string { func (*PatternFlowPfcPausePauseClass5Counter) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass5Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[645] + mi := &file_otg_proto_msgTypes[648] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -77221,7 +77518,7 @@ func (x *PatternFlowPfcPausePauseClass5Counter) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass5Counter.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass5Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{645} + return file_otg_proto_rawDescGZIP(), []int{648} } func (x *PatternFlowPfcPausePauseClass5Counter) GetStart() uint32 { @@ -77269,7 +77566,7 @@ type PatternFlowPfcPausePauseClass5MetricTag struct { func (x *PatternFlowPfcPausePauseClass5MetricTag) Reset() { *x = PatternFlowPfcPausePauseClass5MetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[646] + mi := &file_otg_proto_msgTypes[649] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -77282,7 +77579,7 @@ func (x *PatternFlowPfcPausePauseClass5MetricTag) String() string { func (*PatternFlowPfcPausePauseClass5MetricTag) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass5MetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[646] + mi := &file_otg_proto_msgTypes[649] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -77295,7 +77592,7 @@ func (x *PatternFlowPfcPausePauseClass5MetricTag) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowPfcPausePauseClass5MetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass5MetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{646} + return file_otg_proto_rawDescGZIP(), []int{649} } func (x *PatternFlowPfcPausePauseClass5MetricTag) GetName() string { @@ -77347,7 +77644,7 @@ type PatternFlowPfcPausePauseClass5 struct { func (x *PatternFlowPfcPausePauseClass5) Reset() { *x = PatternFlowPfcPausePauseClass5{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[647] + mi := &file_otg_proto_msgTypes[650] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -77360,7 +77657,7 @@ func (x *PatternFlowPfcPausePauseClass5) String() string { func (*PatternFlowPfcPausePauseClass5) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass5) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[647] + mi := &file_otg_proto_msgTypes[650] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -77373,7 +77670,7 @@ func (x *PatternFlowPfcPausePauseClass5) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPausePauseClass5.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass5) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{647} + return file_otg_proto_rawDescGZIP(), []int{650} } func (x *PatternFlowPfcPausePauseClass5) GetChoice() PatternFlowPfcPausePauseClass5_Choice_Enum { @@ -77438,7 +77735,7 @@ type PatternFlowPfcPausePauseClass6Counter struct { func (x *PatternFlowPfcPausePauseClass6Counter) Reset() { *x = PatternFlowPfcPausePauseClass6Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[648] + mi := &file_otg_proto_msgTypes[651] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -77451,7 +77748,7 @@ func (x *PatternFlowPfcPausePauseClass6Counter) String() string { func (*PatternFlowPfcPausePauseClass6Counter) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass6Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[648] + mi := &file_otg_proto_msgTypes[651] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -77464,7 +77761,7 @@ func (x *PatternFlowPfcPausePauseClass6Counter) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass6Counter.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass6Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{648} + return file_otg_proto_rawDescGZIP(), []int{651} } func (x *PatternFlowPfcPausePauseClass6Counter) GetStart() uint32 { @@ -77512,7 +77809,7 @@ type PatternFlowPfcPausePauseClass6MetricTag struct { func (x *PatternFlowPfcPausePauseClass6MetricTag) Reset() { *x = PatternFlowPfcPausePauseClass6MetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[649] + mi := &file_otg_proto_msgTypes[652] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -77525,7 +77822,7 @@ func (x *PatternFlowPfcPausePauseClass6MetricTag) String() string { func (*PatternFlowPfcPausePauseClass6MetricTag) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass6MetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[649] + mi := &file_otg_proto_msgTypes[652] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -77538,7 +77835,7 @@ func (x *PatternFlowPfcPausePauseClass6MetricTag) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowPfcPausePauseClass6MetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass6MetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{649} + return file_otg_proto_rawDescGZIP(), []int{652} } func (x *PatternFlowPfcPausePauseClass6MetricTag) GetName() string { @@ -77590,7 +77887,7 @@ type PatternFlowPfcPausePauseClass6 struct { func (x *PatternFlowPfcPausePauseClass6) Reset() { *x = PatternFlowPfcPausePauseClass6{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[650] + mi := &file_otg_proto_msgTypes[653] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -77603,7 +77900,7 @@ func (x *PatternFlowPfcPausePauseClass6) String() string { func (*PatternFlowPfcPausePauseClass6) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass6) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[650] + mi := &file_otg_proto_msgTypes[653] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -77616,7 +77913,7 @@ func (x *PatternFlowPfcPausePauseClass6) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPausePauseClass6.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass6) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{650} + return file_otg_proto_rawDescGZIP(), []int{653} } func (x *PatternFlowPfcPausePauseClass6) GetChoice() PatternFlowPfcPausePauseClass6_Choice_Enum { @@ -77681,7 +77978,7 @@ type PatternFlowPfcPausePauseClass7Counter struct { func (x *PatternFlowPfcPausePauseClass7Counter) Reset() { *x = PatternFlowPfcPausePauseClass7Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[651] + mi := &file_otg_proto_msgTypes[654] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -77694,7 +77991,7 @@ func (x *PatternFlowPfcPausePauseClass7Counter) String() string { func (*PatternFlowPfcPausePauseClass7Counter) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass7Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[651] + mi := &file_otg_proto_msgTypes[654] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -77707,7 +78004,7 @@ func (x *PatternFlowPfcPausePauseClass7Counter) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass7Counter.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass7Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{651} + return file_otg_proto_rawDescGZIP(), []int{654} } func (x *PatternFlowPfcPausePauseClass7Counter) GetStart() uint32 { @@ -77755,7 +78052,7 @@ type PatternFlowPfcPausePauseClass7MetricTag struct { func (x *PatternFlowPfcPausePauseClass7MetricTag) Reset() { *x = PatternFlowPfcPausePauseClass7MetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[652] + mi := &file_otg_proto_msgTypes[655] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -77768,7 +78065,7 @@ func (x *PatternFlowPfcPausePauseClass7MetricTag) String() string { func (*PatternFlowPfcPausePauseClass7MetricTag) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass7MetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[652] + mi := &file_otg_proto_msgTypes[655] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -77781,7 +78078,7 @@ func (x *PatternFlowPfcPausePauseClass7MetricTag) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowPfcPausePauseClass7MetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass7MetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{652} + return file_otg_proto_rawDescGZIP(), []int{655} } func (x *PatternFlowPfcPausePauseClass7MetricTag) GetName() string { @@ -77833,7 +78130,7 @@ type PatternFlowPfcPausePauseClass7 struct { func (x *PatternFlowPfcPausePauseClass7) Reset() { *x = PatternFlowPfcPausePauseClass7{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[653] + mi := &file_otg_proto_msgTypes[656] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -77846,7 +78143,7 @@ func (x *PatternFlowPfcPausePauseClass7) String() string { func (*PatternFlowPfcPausePauseClass7) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass7) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[653] + mi := &file_otg_proto_msgTypes[656] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -77859,7 +78156,7 @@ func (x *PatternFlowPfcPausePauseClass7) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPausePauseClass7.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass7) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{653} + return file_otg_proto_rawDescGZIP(), []int{656} } func (x *PatternFlowPfcPausePauseClass7) GetChoice() PatternFlowPfcPausePauseClass7_Choice_Enum { @@ -77924,7 +78221,7 @@ type PatternFlowEthernetPauseDstCounter struct { func (x *PatternFlowEthernetPauseDstCounter) Reset() { *x = PatternFlowEthernetPauseDstCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[654] + mi := &file_otg_proto_msgTypes[657] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -77937,7 +78234,7 @@ func (x *PatternFlowEthernetPauseDstCounter) String() string { func (*PatternFlowEthernetPauseDstCounter) ProtoMessage() {} func (x *PatternFlowEthernetPauseDstCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[654] + mi := &file_otg_proto_msgTypes[657] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -77950,7 +78247,7 @@ func (x *PatternFlowEthernetPauseDstCounter) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowEthernetPauseDstCounter.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseDstCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{654} + return file_otg_proto_rawDescGZIP(), []int{657} } func (x *PatternFlowEthernetPauseDstCounter) GetStart() string { @@ -77998,7 +78295,7 @@ type PatternFlowEthernetPauseDstMetricTag struct { func (x *PatternFlowEthernetPauseDstMetricTag) Reset() { *x = PatternFlowEthernetPauseDstMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[655] + mi := &file_otg_proto_msgTypes[658] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -78011,7 +78308,7 @@ func (x *PatternFlowEthernetPauseDstMetricTag) String() string { func (*PatternFlowEthernetPauseDstMetricTag) ProtoMessage() {} func (x *PatternFlowEthernetPauseDstMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[655] + mi := &file_otg_proto_msgTypes[658] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -78024,7 +78321,7 @@ func (x *PatternFlowEthernetPauseDstMetricTag) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowEthernetPauseDstMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseDstMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{655} + return file_otg_proto_rawDescGZIP(), []int{658} } func (x *PatternFlowEthernetPauseDstMetricTag) GetName() string { @@ -78076,7 +78373,7 @@ type PatternFlowEthernetPauseDst struct { func (x *PatternFlowEthernetPauseDst) Reset() { *x = PatternFlowEthernetPauseDst{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[656] + mi := &file_otg_proto_msgTypes[659] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -78089,7 +78386,7 @@ func (x *PatternFlowEthernetPauseDst) String() string { func (*PatternFlowEthernetPauseDst) ProtoMessage() {} func (x *PatternFlowEthernetPauseDst) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[656] + mi := &file_otg_proto_msgTypes[659] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -78102,7 +78399,7 @@ func (x *PatternFlowEthernetPauseDst) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowEthernetPauseDst.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseDst) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{656} + return file_otg_proto_rawDescGZIP(), []int{659} } func (x *PatternFlowEthernetPauseDst) GetChoice() PatternFlowEthernetPauseDst_Choice_Enum { @@ -78167,7 +78464,7 @@ type PatternFlowEthernetPauseSrcCounter struct { func (x *PatternFlowEthernetPauseSrcCounter) Reset() { *x = PatternFlowEthernetPauseSrcCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[657] + mi := &file_otg_proto_msgTypes[660] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -78180,7 +78477,7 @@ func (x *PatternFlowEthernetPauseSrcCounter) String() string { func (*PatternFlowEthernetPauseSrcCounter) ProtoMessage() {} func (x *PatternFlowEthernetPauseSrcCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[657] + mi := &file_otg_proto_msgTypes[660] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -78193,7 +78490,7 @@ func (x *PatternFlowEthernetPauseSrcCounter) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowEthernetPauseSrcCounter.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseSrcCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{657} + return file_otg_proto_rawDescGZIP(), []int{660} } func (x *PatternFlowEthernetPauseSrcCounter) GetStart() string { @@ -78241,7 +78538,7 @@ type PatternFlowEthernetPauseSrcMetricTag struct { func (x *PatternFlowEthernetPauseSrcMetricTag) Reset() { *x = PatternFlowEthernetPauseSrcMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[658] + mi := &file_otg_proto_msgTypes[661] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -78254,7 +78551,7 @@ func (x *PatternFlowEthernetPauseSrcMetricTag) String() string { func (*PatternFlowEthernetPauseSrcMetricTag) ProtoMessage() {} func (x *PatternFlowEthernetPauseSrcMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[658] + mi := &file_otg_proto_msgTypes[661] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -78267,7 +78564,7 @@ func (x *PatternFlowEthernetPauseSrcMetricTag) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowEthernetPauseSrcMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseSrcMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{658} + return file_otg_proto_rawDescGZIP(), []int{661} } func (x *PatternFlowEthernetPauseSrcMetricTag) GetName() string { @@ -78319,7 +78616,7 @@ type PatternFlowEthernetPauseSrc struct { func (x *PatternFlowEthernetPauseSrc) Reset() { *x = PatternFlowEthernetPauseSrc{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[659] + mi := &file_otg_proto_msgTypes[662] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -78332,7 +78629,7 @@ func (x *PatternFlowEthernetPauseSrc) String() string { func (*PatternFlowEthernetPauseSrc) ProtoMessage() {} func (x *PatternFlowEthernetPauseSrc) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[659] + mi := &file_otg_proto_msgTypes[662] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -78345,7 +78642,7 @@ func (x *PatternFlowEthernetPauseSrc) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowEthernetPauseSrc.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseSrc) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{659} + return file_otg_proto_rawDescGZIP(), []int{662} } func (x *PatternFlowEthernetPauseSrc) GetChoice() PatternFlowEthernetPauseSrc_Choice_Enum { @@ -78410,7 +78707,7 @@ type PatternFlowEthernetPauseEtherTypeCounter struct { func (x *PatternFlowEthernetPauseEtherTypeCounter) Reset() { *x = PatternFlowEthernetPauseEtherTypeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[660] + mi := &file_otg_proto_msgTypes[663] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -78423,7 +78720,7 @@ func (x *PatternFlowEthernetPauseEtherTypeCounter) String() string { func (*PatternFlowEthernetPauseEtherTypeCounter) ProtoMessage() {} func (x *PatternFlowEthernetPauseEtherTypeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[660] + mi := &file_otg_proto_msgTypes[663] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -78436,7 +78733,7 @@ func (x *PatternFlowEthernetPauseEtherTypeCounter) ProtoReflect() protoreflect.M // Deprecated: Use PatternFlowEthernetPauseEtherTypeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseEtherTypeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{660} + return file_otg_proto_rawDescGZIP(), []int{663} } func (x *PatternFlowEthernetPauseEtherTypeCounter) GetStart() uint32 { @@ -78484,7 +78781,7 @@ type PatternFlowEthernetPauseEtherTypeMetricTag struct { func (x *PatternFlowEthernetPauseEtherTypeMetricTag) Reset() { *x = PatternFlowEthernetPauseEtherTypeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[661] + mi := &file_otg_proto_msgTypes[664] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -78497,7 +78794,7 @@ func (x *PatternFlowEthernetPauseEtherTypeMetricTag) String() string { func (*PatternFlowEthernetPauseEtherTypeMetricTag) ProtoMessage() {} func (x *PatternFlowEthernetPauseEtherTypeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[661] + mi := &file_otg_proto_msgTypes[664] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -78510,7 +78807,7 @@ func (x *PatternFlowEthernetPauseEtherTypeMetricTag) ProtoReflect() protoreflect // Deprecated: Use PatternFlowEthernetPauseEtherTypeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseEtherTypeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{661} + return file_otg_proto_rawDescGZIP(), []int{664} } func (x *PatternFlowEthernetPauseEtherTypeMetricTag) GetName() string { @@ -78562,7 +78859,7 @@ type PatternFlowEthernetPauseEtherType struct { func (x *PatternFlowEthernetPauseEtherType) Reset() { *x = PatternFlowEthernetPauseEtherType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[662] + mi := &file_otg_proto_msgTypes[665] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -78575,7 +78872,7 @@ func (x *PatternFlowEthernetPauseEtherType) String() string { func (*PatternFlowEthernetPauseEtherType) ProtoMessage() {} func (x *PatternFlowEthernetPauseEtherType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[662] + mi := &file_otg_proto_msgTypes[665] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -78588,7 +78885,7 @@ func (x *PatternFlowEthernetPauseEtherType) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowEthernetPauseEtherType.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseEtherType) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{662} + return file_otg_proto_rawDescGZIP(), []int{665} } func (x *PatternFlowEthernetPauseEtherType) GetChoice() PatternFlowEthernetPauseEtherType_Choice_Enum { @@ -78653,7 +78950,7 @@ type PatternFlowEthernetPauseControlOpCodeCounter struct { func (x *PatternFlowEthernetPauseControlOpCodeCounter) Reset() { *x = PatternFlowEthernetPauseControlOpCodeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[663] + mi := &file_otg_proto_msgTypes[666] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -78666,7 +78963,7 @@ func (x *PatternFlowEthernetPauseControlOpCodeCounter) String() string { func (*PatternFlowEthernetPauseControlOpCodeCounter) ProtoMessage() {} func (x *PatternFlowEthernetPauseControlOpCodeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[663] + mi := &file_otg_proto_msgTypes[666] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -78679,7 +78976,7 @@ func (x *PatternFlowEthernetPauseControlOpCodeCounter) ProtoReflect() protorefle // Deprecated: Use PatternFlowEthernetPauseControlOpCodeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseControlOpCodeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{663} + return file_otg_proto_rawDescGZIP(), []int{666} } func (x *PatternFlowEthernetPauseControlOpCodeCounter) GetStart() uint32 { @@ -78727,7 +79024,7 @@ type PatternFlowEthernetPauseControlOpCodeMetricTag struct { func (x *PatternFlowEthernetPauseControlOpCodeMetricTag) Reset() { *x = PatternFlowEthernetPauseControlOpCodeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[664] + mi := &file_otg_proto_msgTypes[667] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -78740,7 +79037,7 @@ func (x *PatternFlowEthernetPauseControlOpCodeMetricTag) String() string { func (*PatternFlowEthernetPauseControlOpCodeMetricTag) ProtoMessage() {} func (x *PatternFlowEthernetPauseControlOpCodeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[664] + mi := &file_otg_proto_msgTypes[667] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -78753,7 +79050,7 @@ func (x *PatternFlowEthernetPauseControlOpCodeMetricTag) ProtoReflect() protoref // Deprecated: Use PatternFlowEthernetPauseControlOpCodeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseControlOpCodeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{664} + return file_otg_proto_rawDescGZIP(), []int{667} } func (x *PatternFlowEthernetPauseControlOpCodeMetricTag) GetName() string { @@ -78805,7 +79102,7 @@ type PatternFlowEthernetPauseControlOpCode struct { func (x *PatternFlowEthernetPauseControlOpCode) Reset() { *x = PatternFlowEthernetPauseControlOpCode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[665] + mi := &file_otg_proto_msgTypes[668] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -78818,7 +79115,7 @@ func (x *PatternFlowEthernetPauseControlOpCode) String() string { func (*PatternFlowEthernetPauseControlOpCode) ProtoMessage() {} func (x *PatternFlowEthernetPauseControlOpCode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[665] + mi := &file_otg_proto_msgTypes[668] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -78831,7 +79128,7 @@ func (x *PatternFlowEthernetPauseControlOpCode) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowEthernetPauseControlOpCode.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseControlOpCode) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{665} + return file_otg_proto_rawDescGZIP(), []int{668} } func (x *PatternFlowEthernetPauseControlOpCode) GetChoice() PatternFlowEthernetPauseControlOpCode_Choice_Enum { @@ -78896,7 +79193,7 @@ type PatternFlowEthernetPauseTimeCounter struct { func (x *PatternFlowEthernetPauseTimeCounter) Reset() { *x = PatternFlowEthernetPauseTimeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[666] + mi := &file_otg_proto_msgTypes[669] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -78909,7 +79206,7 @@ func (x *PatternFlowEthernetPauseTimeCounter) String() string { func (*PatternFlowEthernetPauseTimeCounter) ProtoMessage() {} func (x *PatternFlowEthernetPauseTimeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[666] + mi := &file_otg_proto_msgTypes[669] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -78922,7 +79219,7 @@ func (x *PatternFlowEthernetPauseTimeCounter) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowEthernetPauseTimeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseTimeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{666} + return file_otg_proto_rawDescGZIP(), []int{669} } func (x *PatternFlowEthernetPauseTimeCounter) GetStart() uint32 { @@ -78970,7 +79267,7 @@ type PatternFlowEthernetPauseTimeMetricTag struct { func (x *PatternFlowEthernetPauseTimeMetricTag) Reset() { *x = PatternFlowEthernetPauseTimeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[667] + mi := &file_otg_proto_msgTypes[670] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -78983,7 +79280,7 @@ func (x *PatternFlowEthernetPauseTimeMetricTag) String() string { func (*PatternFlowEthernetPauseTimeMetricTag) ProtoMessage() {} func (x *PatternFlowEthernetPauseTimeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[667] + mi := &file_otg_proto_msgTypes[670] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -78996,7 +79293,7 @@ func (x *PatternFlowEthernetPauseTimeMetricTag) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowEthernetPauseTimeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseTimeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{667} + return file_otg_proto_rawDescGZIP(), []int{670} } func (x *PatternFlowEthernetPauseTimeMetricTag) GetName() string { @@ -79048,7 +79345,7 @@ type PatternFlowEthernetPauseTime struct { func (x *PatternFlowEthernetPauseTime) Reset() { *x = PatternFlowEthernetPauseTime{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[668] + mi := &file_otg_proto_msgTypes[671] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -79061,7 +79358,7 @@ func (x *PatternFlowEthernetPauseTime) String() string { func (*PatternFlowEthernetPauseTime) ProtoMessage() {} func (x *PatternFlowEthernetPauseTime) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[668] + mi := &file_otg_proto_msgTypes[671] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -79074,7 +79371,7 @@ func (x *PatternFlowEthernetPauseTime) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowEthernetPauseTime.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseTime) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{668} + return file_otg_proto_rawDescGZIP(), []int{671} } func (x *PatternFlowEthernetPauseTime) GetChoice() PatternFlowEthernetPauseTime_Choice_Enum { @@ -79139,7 +79436,7 @@ type PatternFlowTcpSrcPortCounter struct { func (x *PatternFlowTcpSrcPortCounter) Reset() { *x = PatternFlowTcpSrcPortCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[669] + mi := &file_otg_proto_msgTypes[672] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -79152,7 +79449,7 @@ func (x *PatternFlowTcpSrcPortCounter) String() string { func (*PatternFlowTcpSrcPortCounter) ProtoMessage() {} func (x *PatternFlowTcpSrcPortCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[669] + mi := &file_otg_proto_msgTypes[672] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -79165,7 +79462,7 @@ func (x *PatternFlowTcpSrcPortCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpSrcPortCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpSrcPortCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{669} + return file_otg_proto_rawDescGZIP(), []int{672} } func (x *PatternFlowTcpSrcPortCounter) GetStart() uint32 { @@ -79213,7 +79510,7 @@ type PatternFlowTcpSrcPortMetricTag struct { func (x *PatternFlowTcpSrcPortMetricTag) Reset() { *x = PatternFlowTcpSrcPortMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[670] + mi := &file_otg_proto_msgTypes[673] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -79226,7 +79523,7 @@ func (x *PatternFlowTcpSrcPortMetricTag) String() string { func (*PatternFlowTcpSrcPortMetricTag) ProtoMessage() {} func (x *PatternFlowTcpSrcPortMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[670] + mi := &file_otg_proto_msgTypes[673] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -79239,7 +79536,7 @@ func (x *PatternFlowTcpSrcPortMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpSrcPortMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpSrcPortMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{670} + return file_otg_proto_rawDescGZIP(), []int{673} } func (x *PatternFlowTcpSrcPortMetricTag) GetName() string { @@ -79263,6 +79560,89 @@ func (x *PatternFlowTcpSrcPortMetricTag) GetLength() uint32 { return 0 } +// integer random pattern +type PatternFlowTcpSrcPortRandom struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The minimum possible value generated by the random value generator. + // default = 0 + Min *uint32 `protobuf:"varint,1,opt,name=min,proto3,oneof" json:"min,omitempty"` + // The maximum possible value generated by the random value generator. + // default = 65535 + Max *uint32 `protobuf:"varint,2,opt,name=max,proto3,oneof" json:"max,omitempty"` + // The seed value is used to initialize the random number generator to a deterministic + // state. If the user provides a seed value of 0, the implementation will generate a + // sequence of non-deterministic random values. For any other seed value, the sequence + // of random numbers will be generated in a deterministic manner (specific to the implementation). + // default = 1 + Seed *uint32 `protobuf:"varint,3,opt,name=seed,proto3,oneof" json:"seed,omitempty"` + // The total number of values to be generated by the random value generator. + // default = 1 + Count *uint32 `protobuf:"varint,4,opt,name=count,proto3,oneof" json:"count,omitempty"` +} + +func (x *PatternFlowTcpSrcPortRandom) Reset() { + *x = PatternFlowTcpSrcPortRandom{} + if protoimpl.UnsafeEnabled { + mi := &file_otg_proto_msgTypes[674] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PatternFlowTcpSrcPortRandom) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatternFlowTcpSrcPortRandom) ProtoMessage() {} + +func (x *PatternFlowTcpSrcPortRandom) ProtoReflect() protoreflect.Message { + mi := &file_otg_proto_msgTypes[674] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PatternFlowTcpSrcPortRandom.ProtoReflect.Descriptor instead. +func (*PatternFlowTcpSrcPortRandom) Descriptor() ([]byte, []int) { + return file_otg_proto_rawDescGZIP(), []int{674} +} + +func (x *PatternFlowTcpSrcPortRandom) GetMin() uint32 { + if x != nil && x.Min != nil { + return *x.Min + } + return 0 +} + +func (x *PatternFlowTcpSrcPortRandom) GetMax() uint32 { + if x != nil && x.Max != nil { + return *x.Max + } + return 0 +} + +func (x *PatternFlowTcpSrcPortRandom) GetSeed() uint32 { + if x != nil && x.Seed != nil { + return *x.Seed + } + return 0 +} + +func (x *PatternFlowTcpSrcPortRandom) GetCount() uint32 { + if x != nil && x.Count != nil { + return *x.Count + } + return 0 +} + // Source port type PatternFlowTcpSrcPort struct { state protoimpl.MessageState @@ -79286,12 +79666,14 @@ type PatternFlowTcpSrcPort struct { // a corresponding header field for metrics per each applicable value. These would appear // as tagged metrics in corresponding flow metrics. MetricTags []*PatternFlowTcpSrcPortMetricTag `protobuf:"bytes,7,rep,name=metric_tags,json=metricTags,proto3" json:"metric_tags,omitempty"` + // Description missing in models + Random *PatternFlowTcpSrcPortRandom `protobuf:"bytes,8,opt,name=random,proto3" json:"random,omitempty"` } func (x *PatternFlowTcpSrcPort) Reset() { *x = PatternFlowTcpSrcPort{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[671] + mi := &file_otg_proto_msgTypes[675] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -79304,7 +79686,7 @@ func (x *PatternFlowTcpSrcPort) String() string { func (*PatternFlowTcpSrcPort) ProtoMessage() {} func (x *PatternFlowTcpSrcPort) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[671] + mi := &file_otg_proto_msgTypes[675] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -79317,7 +79699,7 @@ func (x *PatternFlowTcpSrcPort) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpSrcPort.ProtoReflect.Descriptor instead. func (*PatternFlowTcpSrcPort) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{671} + return file_otg_proto_rawDescGZIP(), []int{675} } func (x *PatternFlowTcpSrcPort) GetChoice() PatternFlowTcpSrcPort_Choice_Enum { @@ -79362,6 +79744,13 @@ func (x *PatternFlowTcpSrcPort) GetMetricTags() []*PatternFlowTcpSrcPortMetricTa return nil } +func (x *PatternFlowTcpSrcPort) GetRandom() *PatternFlowTcpSrcPortRandom { + if x != nil { + return x.Random + } + return nil +} + // integer counter pattern type PatternFlowTcpDstPortCounter struct { state protoimpl.MessageState @@ -79382,7 +79771,7 @@ type PatternFlowTcpDstPortCounter struct { func (x *PatternFlowTcpDstPortCounter) Reset() { *x = PatternFlowTcpDstPortCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[672] + mi := &file_otg_proto_msgTypes[676] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -79395,7 +79784,7 @@ func (x *PatternFlowTcpDstPortCounter) String() string { func (*PatternFlowTcpDstPortCounter) ProtoMessage() {} func (x *PatternFlowTcpDstPortCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[672] + mi := &file_otg_proto_msgTypes[676] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -79408,7 +79797,7 @@ func (x *PatternFlowTcpDstPortCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpDstPortCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpDstPortCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{672} + return file_otg_proto_rawDescGZIP(), []int{676} } func (x *PatternFlowTcpDstPortCounter) GetStart() uint32 { @@ -79456,7 +79845,7 @@ type PatternFlowTcpDstPortMetricTag struct { func (x *PatternFlowTcpDstPortMetricTag) Reset() { *x = PatternFlowTcpDstPortMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[673] + mi := &file_otg_proto_msgTypes[677] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -79469,7 +79858,7 @@ func (x *PatternFlowTcpDstPortMetricTag) String() string { func (*PatternFlowTcpDstPortMetricTag) ProtoMessage() {} func (x *PatternFlowTcpDstPortMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[673] + mi := &file_otg_proto_msgTypes[677] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -79482,7 +79871,7 @@ func (x *PatternFlowTcpDstPortMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpDstPortMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpDstPortMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{673} + return file_otg_proto_rawDescGZIP(), []int{677} } func (x *PatternFlowTcpDstPortMetricTag) GetName() string { @@ -79506,6 +79895,89 @@ func (x *PatternFlowTcpDstPortMetricTag) GetLength() uint32 { return 0 } +// integer random pattern +type PatternFlowTcpDstPortRandom struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The minimum possible value generated by the random value generator. + // default = 0 + Min *uint32 `protobuf:"varint,1,opt,name=min,proto3,oneof" json:"min,omitempty"` + // The maximum possible value generated by the random value generator. + // default = 65535 + Max *uint32 `protobuf:"varint,2,opt,name=max,proto3,oneof" json:"max,omitempty"` + // The seed value is used to initialize the random number generator to a deterministic + // state. If the user provides a seed value of 0, the implementation will generate a + // sequence of non-deterministic random values. For any other seed value, the sequence + // of random numbers will be generated in a deterministic manner (specific to the implementation). + // default = 1 + Seed *uint32 `protobuf:"varint,3,opt,name=seed,proto3,oneof" json:"seed,omitempty"` + // The total number of values to be generated by the random value generator. + // default = 1 + Count *uint32 `protobuf:"varint,4,opt,name=count,proto3,oneof" json:"count,omitempty"` +} + +func (x *PatternFlowTcpDstPortRandom) Reset() { + *x = PatternFlowTcpDstPortRandom{} + if protoimpl.UnsafeEnabled { + mi := &file_otg_proto_msgTypes[678] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PatternFlowTcpDstPortRandom) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatternFlowTcpDstPortRandom) ProtoMessage() {} + +func (x *PatternFlowTcpDstPortRandom) ProtoReflect() protoreflect.Message { + mi := &file_otg_proto_msgTypes[678] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PatternFlowTcpDstPortRandom.ProtoReflect.Descriptor instead. +func (*PatternFlowTcpDstPortRandom) Descriptor() ([]byte, []int) { + return file_otg_proto_rawDescGZIP(), []int{678} +} + +func (x *PatternFlowTcpDstPortRandom) GetMin() uint32 { + if x != nil && x.Min != nil { + return *x.Min + } + return 0 +} + +func (x *PatternFlowTcpDstPortRandom) GetMax() uint32 { + if x != nil && x.Max != nil { + return *x.Max + } + return 0 +} + +func (x *PatternFlowTcpDstPortRandom) GetSeed() uint32 { + if x != nil && x.Seed != nil { + return *x.Seed + } + return 0 +} + +func (x *PatternFlowTcpDstPortRandom) GetCount() uint32 { + if x != nil && x.Count != nil { + return *x.Count + } + return 0 +} + // Destination port type PatternFlowTcpDstPort struct { state protoimpl.MessageState @@ -79529,12 +80001,14 @@ type PatternFlowTcpDstPort struct { // a corresponding header field for metrics per each applicable value. These would appear // as tagged metrics in corresponding flow metrics. MetricTags []*PatternFlowTcpDstPortMetricTag `protobuf:"bytes,7,rep,name=metric_tags,json=metricTags,proto3" json:"metric_tags,omitempty"` + // Description missing in models + Random *PatternFlowTcpDstPortRandom `protobuf:"bytes,8,opt,name=random,proto3" json:"random,omitempty"` } func (x *PatternFlowTcpDstPort) Reset() { *x = PatternFlowTcpDstPort{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[674] + mi := &file_otg_proto_msgTypes[679] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -79547,7 +80021,7 @@ func (x *PatternFlowTcpDstPort) String() string { func (*PatternFlowTcpDstPort) ProtoMessage() {} func (x *PatternFlowTcpDstPort) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[674] + mi := &file_otg_proto_msgTypes[679] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -79560,7 +80034,7 @@ func (x *PatternFlowTcpDstPort) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpDstPort.ProtoReflect.Descriptor instead. func (*PatternFlowTcpDstPort) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{674} + return file_otg_proto_rawDescGZIP(), []int{679} } func (x *PatternFlowTcpDstPort) GetChoice() PatternFlowTcpDstPort_Choice_Enum { @@ -79605,6 +80079,13 @@ func (x *PatternFlowTcpDstPort) GetMetricTags() []*PatternFlowTcpDstPortMetricTa return nil } +func (x *PatternFlowTcpDstPort) GetRandom() *PatternFlowTcpDstPortRandom { + if x != nil { + return x.Random + } + return nil +} + // integer counter pattern type PatternFlowTcpSeqNumCounter struct { state protoimpl.MessageState @@ -79625,7 +80106,7 @@ type PatternFlowTcpSeqNumCounter struct { func (x *PatternFlowTcpSeqNumCounter) Reset() { *x = PatternFlowTcpSeqNumCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[675] + mi := &file_otg_proto_msgTypes[680] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -79638,7 +80119,7 @@ func (x *PatternFlowTcpSeqNumCounter) String() string { func (*PatternFlowTcpSeqNumCounter) ProtoMessage() {} func (x *PatternFlowTcpSeqNumCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[675] + mi := &file_otg_proto_msgTypes[680] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -79651,7 +80132,7 @@ func (x *PatternFlowTcpSeqNumCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpSeqNumCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpSeqNumCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{675} + return file_otg_proto_rawDescGZIP(), []int{680} } func (x *PatternFlowTcpSeqNumCounter) GetStart() uint32 { @@ -79699,7 +80180,7 @@ type PatternFlowTcpSeqNumMetricTag struct { func (x *PatternFlowTcpSeqNumMetricTag) Reset() { *x = PatternFlowTcpSeqNumMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[676] + mi := &file_otg_proto_msgTypes[681] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -79712,7 +80193,7 @@ func (x *PatternFlowTcpSeqNumMetricTag) String() string { func (*PatternFlowTcpSeqNumMetricTag) ProtoMessage() {} func (x *PatternFlowTcpSeqNumMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[676] + mi := &file_otg_proto_msgTypes[681] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -79725,7 +80206,7 @@ func (x *PatternFlowTcpSeqNumMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpSeqNumMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpSeqNumMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{676} + return file_otg_proto_rawDescGZIP(), []int{681} } func (x *PatternFlowTcpSeqNumMetricTag) GetName() string { @@ -79777,7 +80258,7 @@ type PatternFlowTcpSeqNum struct { func (x *PatternFlowTcpSeqNum) Reset() { *x = PatternFlowTcpSeqNum{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[677] + mi := &file_otg_proto_msgTypes[682] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -79790,7 +80271,7 @@ func (x *PatternFlowTcpSeqNum) String() string { func (*PatternFlowTcpSeqNum) ProtoMessage() {} func (x *PatternFlowTcpSeqNum) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[677] + mi := &file_otg_proto_msgTypes[682] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -79803,7 +80284,7 @@ func (x *PatternFlowTcpSeqNum) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpSeqNum.ProtoReflect.Descriptor instead. func (*PatternFlowTcpSeqNum) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{677} + return file_otg_proto_rawDescGZIP(), []int{682} } func (x *PatternFlowTcpSeqNum) GetChoice() PatternFlowTcpSeqNum_Choice_Enum { @@ -79868,7 +80349,7 @@ type PatternFlowTcpAckNumCounter struct { func (x *PatternFlowTcpAckNumCounter) Reset() { *x = PatternFlowTcpAckNumCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[678] + mi := &file_otg_proto_msgTypes[683] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -79881,7 +80362,7 @@ func (x *PatternFlowTcpAckNumCounter) String() string { func (*PatternFlowTcpAckNumCounter) ProtoMessage() {} func (x *PatternFlowTcpAckNumCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[678] + mi := &file_otg_proto_msgTypes[683] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -79894,7 +80375,7 @@ func (x *PatternFlowTcpAckNumCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpAckNumCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpAckNumCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{678} + return file_otg_proto_rawDescGZIP(), []int{683} } func (x *PatternFlowTcpAckNumCounter) GetStart() uint32 { @@ -79942,7 +80423,7 @@ type PatternFlowTcpAckNumMetricTag struct { func (x *PatternFlowTcpAckNumMetricTag) Reset() { *x = PatternFlowTcpAckNumMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[679] + mi := &file_otg_proto_msgTypes[684] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -79955,7 +80436,7 @@ func (x *PatternFlowTcpAckNumMetricTag) String() string { func (*PatternFlowTcpAckNumMetricTag) ProtoMessage() {} func (x *PatternFlowTcpAckNumMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[679] + mi := &file_otg_proto_msgTypes[684] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -79968,7 +80449,7 @@ func (x *PatternFlowTcpAckNumMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpAckNumMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpAckNumMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{679} + return file_otg_proto_rawDescGZIP(), []int{684} } func (x *PatternFlowTcpAckNumMetricTag) GetName() string { @@ -80020,7 +80501,7 @@ type PatternFlowTcpAckNum struct { func (x *PatternFlowTcpAckNum) Reset() { *x = PatternFlowTcpAckNum{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[680] + mi := &file_otg_proto_msgTypes[685] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -80033,7 +80514,7 @@ func (x *PatternFlowTcpAckNum) String() string { func (*PatternFlowTcpAckNum) ProtoMessage() {} func (x *PatternFlowTcpAckNum) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[680] + mi := &file_otg_proto_msgTypes[685] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -80046,7 +80527,7 @@ func (x *PatternFlowTcpAckNum) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpAckNum.ProtoReflect.Descriptor instead. func (*PatternFlowTcpAckNum) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{680} + return file_otg_proto_rawDescGZIP(), []int{685} } func (x *PatternFlowTcpAckNum) GetChoice() PatternFlowTcpAckNum_Choice_Enum { @@ -80111,7 +80592,7 @@ type PatternFlowTcpDataOffsetCounter struct { func (x *PatternFlowTcpDataOffsetCounter) Reset() { *x = PatternFlowTcpDataOffsetCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[681] + mi := &file_otg_proto_msgTypes[686] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -80124,7 +80605,7 @@ func (x *PatternFlowTcpDataOffsetCounter) String() string { func (*PatternFlowTcpDataOffsetCounter) ProtoMessage() {} func (x *PatternFlowTcpDataOffsetCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[681] + mi := &file_otg_proto_msgTypes[686] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -80137,7 +80618,7 @@ func (x *PatternFlowTcpDataOffsetCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpDataOffsetCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpDataOffsetCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{681} + return file_otg_proto_rawDescGZIP(), []int{686} } func (x *PatternFlowTcpDataOffsetCounter) GetStart() uint32 { @@ -80185,7 +80666,7 @@ type PatternFlowTcpDataOffsetMetricTag struct { func (x *PatternFlowTcpDataOffsetMetricTag) Reset() { *x = PatternFlowTcpDataOffsetMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[682] + mi := &file_otg_proto_msgTypes[687] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -80198,7 +80679,7 @@ func (x *PatternFlowTcpDataOffsetMetricTag) String() string { func (*PatternFlowTcpDataOffsetMetricTag) ProtoMessage() {} func (x *PatternFlowTcpDataOffsetMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[682] + mi := &file_otg_proto_msgTypes[687] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -80211,7 +80692,7 @@ func (x *PatternFlowTcpDataOffsetMetricTag) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowTcpDataOffsetMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpDataOffsetMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{682} + return file_otg_proto_rawDescGZIP(), []int{687} } func (x *PatternFlowTcpDataOffsetMetricTag) GetName() string { @@ -80263,7 +80744,7 @@ type PatternFlowTcpDataOffset struct { func (x *PatternFlowTcpDataOffset) Reset() { *x = PatternFlowTcpDataOffset{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[683] + mi := &file_otg_proto_msgTypes[688] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -80276,7 +80757,7 @@ func (x *PatternFlowTcpDataOffset) String() string { func (*PatternFlowTcpDataOffset) ProtoMessage() {} func (x *PatternFlowTcpDataOffset) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[683] + mi := &file_otg_proto_msgTypes[688] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -80289,7 +80770,7 @@ func (x *PatternFlowTcpDataOffset) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpDataOffset.ProtoReflect.Descriptor instead. func (*PatternFlowTcpDataOffset) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{683} + return file_otg_proto_rawDescGZIP(), []int{688} } func (x *PatternFlowTcpDataOffset) GetChoice() PatternFlowTcpDataOffset_Choice_Enum { @@ -80354,7 +80835,7 @@ type PatternFlowTcpEcnNsCounter struct { func (x *PatternFlowTcpEcnNsCounter) Reset() { *x = PatternFlowTcpEcnNsCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[684] + mi := &file_otg_proto_msgTypes[689] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -80367,7 +80848,7 @@ func (x *PatternFlowTcpEcnNsCounter) String() string { func (*PatternFlowTcpEcnNsCounter) ProtoMessage() {} func (x *PatternFlowTcpEcnNsCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[684] + mi := &file_otg_proto_msgTypes[689] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -80380,7 +80861,7 @@ func (x *PatternFlowTcpEcnNsCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpEcnNsCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpEcnNsCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{684} + return file_otg_proto_rawDescGZIP(), []int{689} } func (x *PatternFlowTcpEcnNsCounter) GetStart() uint32 { @@ -80428,7 +80909,7 @@ type PatternFlowTcpEcnNsMetricTag struct { func (x *PatternFlowTcpEcnNsMetricTag) Reset() { *x = PatternFlowTcpEcnNsMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[685] + mi := &file_otg_proto_msgTypes[690] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -80441,7 +80922,7 @@ func (x *PatternFlowTcpEcnNsMetricTag) String() string { func (*PatternFlowTcpEcnNsMetricTag) ProtoMessage() {} func (x *PatternFlowTcpEcnNsMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[685] + mi := &file_otg_proto_msgTypes[690] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -80454,7 +80935,7 @@ func (x *PatternFlowTcpEcnNsMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpEcnNsMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpEcnNsMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{685} + return file_otg_proto_rawDescGZIP(), []int{690} } func (x *PatternFlowTcpEcnNsMetricTag) GetName() string { @@ -80506,7 +80987,7 @@ type PatternFlowTcpEcnNs struct { func (x *PatternFlowTcpEcnNs) Reset() { *x = PatternFlowTcpEcnNs{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[686] + mi := &file_otg_proto_msgTypes[691] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -80519,7 +81000,7 @@ func (x *PatternFlowTcpEcnNs) String() string { func (*PatternFlowTcpEcnNs) ProtoMessage() {} func (x *PatternFlowTcpEcnNs) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[686] + mi := &file_otg_proto_msgTypes[691] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -80532,7 +81013,7 @@ func (x *PatternFlowTcpEcnNs) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpEcnNs.ProtoReflect.Descriptor instead. func (*PatternFlowTcpEcnNs) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{686} + return file_otg_proto_rawDescGZIP(), []int{691} } func (x *PatternFlowTcpEcnNs) GetChoice() PatternFlowTcpEcnNs_Choice_Enum { @@ -80597,7 +81078,7 @@ type PatternFlowTcpEcnCwrCounter struct { func (x *PatternFlowTcpEcnCwrCounter) Reset() { *x = PatternFlowTcpEcnCwrCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[687] + mi := &file_otg_proto_msgTypes[692] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -80610,7 +81091,7 @@ func (x *PatternFlowTcpEcnCwrCounter) String() string { func (*PatternFlowTcpEcnCwrCounter) ProtoMessage() {} func (x *PatternFlowTcpEcnCwrCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[687] + mi := &file_otg_proto_msgTypes[692] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -80623,7 +81104,7 @@ func (x *PatternFlowTcpEcnCwrCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpEcnCwrCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpEcnCwrCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{687} + return file_otg_proto_rawDescGZIP(), []int{692} } func (x *PatternFlowTcpEcnCwrCounter) GetStart() uint32 { @@ -80671,7 +81152,7 @@ type PatternFlowTcpEcnCwrMetricTag struct { func (x *PatternFlowTcpEcnCwrMetricTag) Reset() { *x = PatternFlowTcpEcnCwrMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[688] + mi := &file_otg_proto_msgTypes[693] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -80684,7 +81165,7 @@ func (x *PatternFlowTcpEcnCwrMetricTag) String() string { func (*PatternFlowTcpEcnCwrMetricTag) ProtoMessage() {} func (x *PatternFlowTcpEcnCwrMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[688] + mi := &file_otg_proto_msgTypes[693] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -80697,7 +81178,7 @@ func (x *PatternFlowTcpEcnCwrMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpEcnCwrMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpEcnCwrMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{688} + return file_otg_proto_rawDescGZIP(), []int{693} } func (x *PatternFlowTcpEcnCwrMetricTag) GetName() string { @@ -80749,7 +81230,7 @@ type PatternFlowTcpEcnCwr struct { func (x *PatternFlowTcpEcnCwr) Reset() { *x = PatternFlowTcpEcnCwr{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[689] + mi := &file_otg_proto_msgTypes[694] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -80762,7 +81243,7 @@ func (x *PatternFlowTcpEcnCwr) String() string { func (*PatternFlowTcpEcnCwr) ProtoMessage() {} func (x *PatternFlowTcpEcnCwr) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[689] + mi := &file_otg_proto_msgTypes[694] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -80775,7 +81256,7 @@ func (x *PatternFlowTcpEcnCwr) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpEcnCwr.ProtoReflect.Descriptor instead. func (*PatternFlowTcpEcnCwr) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{689} + return file_otg_proto_rawDescGZIP(), []int{694} } func (x *PatternFlowTcpEcnCwr) GetChoice() PatternFlowTcpEcnCwr_Choice_Enum { @@ -80840,7 +81321,7 @@ type PatternFlowTcpEcnEchoCounter struct { func (x *PatternFlowTcpEcnEchoCounter) Reset() { *x = PatternFlowTcpEcnEchoCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[690] + mi := &file_otg_proto_msgTypes[695] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -80853,7 +81334,7 @@ func (x *PatternFlowTcpEcnEchoCounter) String() string { func (*PatternFlowTcpEcnEchoCounter) ProtoMessage() {} func (x *PatternFlowTcpEcnEchoCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[690] + mi := &file_otg_proto_msgTypes[695] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -80866,7 +81347,7 @@ func (x *PatternFlowTcpEcnEchoCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpEcnEchoCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpEcnEchoCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{690} + return file_otg_proto_rawDescGZIP(), []int{695} } func (x *PatternFlowTcpEcnEchoCounter) GetStart() uint32 { @@ -80914,7 +81395,7 @@ type PatternFlowTcpEcnEchoMetricTag struct { func (x *PatternFlowTcpEcnEchoMetricTag) Reset() { *x = PatternFlowTcpEcnEchoMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[691] + mi := &file_otg_proto_msgTypes[696] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -80927,7 +81408,7 @@ func (x *PatternFlowTcpEcnEchoMetricTag) String() string { func (*PatternFlowTcpEcnEchoMetricTag) ProtoMessage() {} func (x *PatternFlowTcpEcnEchoMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[691] + mi := &file_otg_proto_msgTypes[696] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -80940,7 +81421,7 @@ func (x *PatternFlowTcpEcnEchoMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpEcnEchoMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpEcnEchoMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{691} + return file_otg_proto_rawDescGZIP(), []int{696} } func (x *PatternFlowTcpEcnEchoMetricTag) GetName() string { @@ -80993,7 +81474,7 @@ type PatternFlowTcpEcnEcho struct { func (x *PatternFlowTcpEcnEcho) Reset() { *x = PatternFlowTcpEcnEcho{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[692] + mi := &file_otg_proto_msgTypes[697] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -81006,7 +81487,7 @@ func (x *PatternFlowTcpEcnEcho) String() string { func (*PatternFlowTcpEcnEcho) ProtoMessage() {} func (x *PatternFlowTcpEcnEcho) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[692] + mi := &file_otg_proto_msgTypes[697] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -81019,7 +81500,7 @@ func (x *PatternFlowTcpEcnEcho) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpEcnEcho.ProtoReflect.Descriptor instead. func (*PatternFlowTcpEcnEcho) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{692} + return file_otg_proto_rawDescGZIP(), []int{697} } func (x *PatternFlowTcpEcnEcho) GetChoice() PatternFlowTcpEcnEcho_Choice_Enum { @@ -81084,7 +81565,7 @@ type PatternFlowTcpCtlUrgCounter struct { func (x *PatternFlowTcpCtlUrgCounter) Reset() { *x = PatternFlowTcpCtlUrgCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[693] + mi := &file_otg_proto_msgTypes[698] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -81097,7 +81578,7 @@ func (x *PatternFlowTcpCtlUrgCounter) String() string { func (*PatternFlowTcpCtlUrgCounter) ProtoMessage() {} func (x *PatternFlowTcpCtlUrgCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[693] + mi := &file_otg_proto_msgTypes[698] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -81110,7 +81591,7 @@ func (x *PatternFlowTcpCtlUrgCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlUrgCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlUrgCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{693} + return file_otg_proto_rawDescGZIP(), []int{698} } func (x *PatternFlowTcpCtlUrgCounter) GetStart() uint32 { @@ -81158,7 +81639,7 @@ type PatternFlowTcpCtlUrgMetricTag struct { func (x *PatternFlowTcpCtlUrgMetricTag) Reset() { *x = PatternFlowTcpCtlUrgMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[694] + mi := &file_otg_proto_msgTypes[699] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -81171,7 +81652,7 @@ func (x *PatternFlowTcpCtlUrgMetricTag) String() string { func (*PatternFlowTcpCtlUrgMetricTag) ProtoMessage() {} func (x *PatternFlowTcpCtlUrgMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[694] + mi := &file_otg_proto_msgTypes[699] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -81184,7 +81665,7 @@ func (x *PatternFlowTcpCtlUrgMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlUrgMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlUrgMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{694} + return file_otg_proto_rawDescGZIP(), []int{699} } func (x *PatternFlowTcpCtlUrgMetricTag) GetName() string { @@ -81236,7 +81717,7 @@ type PatternFlowTcpCtlUrg struct { func (x *PatternFlowTcpCtlUrg) Reset() { *x = PatternFlowTcpCtlUrg{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[695] + mi := &file_otg_proto_msgTypes[700] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -81249,7 +81730,7 @@ func (x *PatternFlowTcpCtlUrg) String() string { func (*PatternFlowTcpCtlUrg) ProtoMessage() {} func (x *PatternFlowTcpCtlUrg) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[695] + mi := &file_otg_proto_msgTypes[700] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -81262,7 +81743,7 @@ func (x *PatternFlowTcpCtlUrg) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlUrg.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlUrg) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{695} + return file_otg_proto_rawDescGZIP(), []int{700} } func (x *PatternFlowTcpCtlUrg) GetChoice() PatternFlowTcpCtlUrg_Choice_Enum { @@ -81327,7 +81808,7 @@ type PatternFlowTcpCtlAckCounter struct { func (x *PatternFlowTcpCtlAckCounter) Reset() { *x = PatternFlowTcpCtlAckCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[696] + mi := &file_otg_proto_msgTypes[701] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -81340,7 +81821,7 @@ func (x *PatternFlowTcpCtlAckCounter) String() string { func (*PatternFlowTcpCtlAckCounter) ProtoMessage() {} func (x *PatternFlowTcpCtlAckCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[696] + mi := &file_otg_proto_msgTypes[701] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -81353,7 +81834,7 @@ func (x *PatternFlowTcpCtlAckCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlAckCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlAckCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{696} + return file_otg_proto_rawDescGZIP(), []int{701} } func (x *PatternFlowTcpCtlAckCounter) GetStart() uint32 { @@ -81401,7 +81882,7 @@ type PatternFlowTcpCtlAckMetricTag struct { func (x *PatternFlowTcpCtlAckMetricTag) Reset() { *x = PatternFlowTcpCtlAckMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[697] + mi := &file_otg_proto_msgTypes[702] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -81414,7 +81895,7 @@ func (x *PatternFlowTcpCtlAckMetricTag) String() string { func (*PatternFlowTcpCtlAckMetricTag) ProtoMessage() {} func (x *PatternFlowTcpCtlAckMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[697] + mi := &file_otg_proto_msgTypes[702] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -81427,7 +81908,7 @@ func (x *PatternFlowTcpCtlAckMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlAckMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlAckMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{697} + return file_otg_proto_rawDescGZIP(), []int{702} } func (x *PatternFlowTcpCtlAckMetricTag) GetName() string { @@ -81479,7 +81960,7 @@ type PatternFlowTcpCtlAck struct { func (x *PatternFlowTcpCtlAck) Reset() { *x = PatternFlowTcpCtlAck{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[698] + mi := &file_otg_proto_msgTypes[703] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -81492,7 +81973,7 @@ func (x *PatternFlowTcpCtlAck) String() string { func (*PatternFlowTcpCtlAck) ProtoMessage() {} func (x *PatternFlowTcpCtlAck) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[698] + mi := &file_otg_proto_msgTypes[703] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -81505,7 +81986,7 @@ func (x *PatternFlowTcpCtlAck) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlAck.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlAck) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{698} + return file_otg_proto_rawDescGZIP(), []int{703} } func (x *PatternFlowTcpCtlAck) GetChoice() PatternFlowTcpCtlAck_Choice_Enum { @@ -81570,7 +82051,7 @@ type PatternFlowTcpCtlPshCounter struct { func (x *PatternFlowTcpCtlPshCounter) Reset() { *x = PatternFlowTcpCtlPshCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[699] + mi := &file_otg_proto_msgTypes[704] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -81583,7 +82064,7 @@ func (x *PatternFlowTcpCtlPshCounter) String() string { func (*PatternFlowTcpCtlPshCounter) ProtoMessage() {} func (x *PatternFlowTcpCtlPshCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[699] + mi := &file_otg_proto_msgTypes[704] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -81596,7 +82077,7 @@ func (x *PatternFlowTcpCtlPshCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlPshCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlPshCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{699} + return file_otg_proto_rawDescGZIP(), []int{704} } func (x *PatternFlowTcpCtlPshCounter) GetStart() uint32 { @@ -81644,7 +82125,7 @@ type PatternFlowTcpCtlPshMetricTag struct { func (x *PatternFlowTcpCtlPshMetricTag) Reset() { *x = PatternFlowTcpCtlPshMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[700] + mi := &file_otg_proto_msgTypes[705] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -81657,7 +82138,7 @@ func (x *PatternFlowTcpCtlPshMetricTag) String() string { func (*PatternFlowTcpCtlPshMetricTag) ProtoMessage() {} func (x *PatternFlowTcpCtlPshMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[700] + mi := &file_otg_proto_msgTypes[705] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -81670,7 +82151,7 @@ func (x *PatternFlowTcpCtlPshMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlPshMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlPshMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{700} + return file_otg_proto_rawDescGZIP(), []int{705} } func (x *PatternFlowTcpCtlPshMetricTag) GetName() string { @@ -81722,7 +82203,7 @@ type PatternFlowTcpCtlPsh struct { func (x *PatternFlowTcpCtlPsh) Reset() { *x = PatternFlowTcpCtlPsh{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[701] + mi := &file_otg_proto_msgTypes[706] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -81735,7 +82216,7 @@ func (x *PatternFlowTcpCtlPsh) String() string { func (*PatternFlowTcpCtlPsh) ProtoMessage() {} func (x *PatternFlowTcpCtlPsh) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[701] + mi := &file_otg_proto_msgTypes[706] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -81748,7 +82229,7 @@ func (x *PatternFlowTcpCtlPsh) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlPsh.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlPsh) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{701} + return file_otg_proto_rawDescGZIP(), []int{706} } func (x *PatternFlowTcpCtlPsh) GetChoice() PatternFlowTcpCtlPsh_Choice_Enum { @@ -81813,7 +82294,7 @@ type PatternFlowTcpCtlRstCounter struct { func (x *PatternFlowTcpCtlRstCounter) Reset() { *x = PatternFlowTcpCtlRstCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[702] + mi := &file_otg_proto_msgTypes[707] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -81826,7 +82307,7 @@ func (x *PatternFlowTcpCtlRstCounter) String() string { func (*PatternFlowTcpCtlRstCounter) ProtoMessage() {} func (x *PatternFlowTcpCtlRstCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[702] + mi := &file_otg_proto_msgTypes[707] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -81839,7 +82320,7 @@ func (x *PatternFlowTcpCtlRstCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlRstCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlRstCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{702} + return file_otg_proto_rawDescGZIP(), []int{707} } func (x *PatternFlowTcpCtlRstCounter) GetStart() uint32 { @@ -81887,7 +82368,7 @@ type PatternFlowTcpCtlRstMetricTag struct { func (x *PatternFlowTcpCtlRstMetricTag) Reset() { *x = PatternFlowTcpCtlRstMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[703] + mi := &file_otg_proto_msgTypes[708] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -81900,7 +82381,7 @@ func (x *PatternFlowTcpCtlRstMetricTag) String() string { func (*PatternFlowTcpCtlRstMetricTag) ProtoMessage() {} func (x *PatternFlowTcpCtlRstMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[703] + mi := &file_otg_proto_msgTypes[708] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -81913,7 +82394,7 @@ func (x *PatternFlowTcpCtlRstMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlRstMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlRstMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{703} + return file_otg_proto_rawDescGZIP(), []int{708} } func (x *PatternFlowTcpCtlRstMetricTag) GetName() string { @@ -81965,7 +82446,7 @@ type PatternFlowTcpCtlRst struct { func (x *PatternFlowTcpCtlRst) Reset() { *x = PatternFlowTcpCtlRst{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[704] + mi := &file_otg_proto_msgTypes[709] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -81978,7 +82459,7 @@ func (x *PatternFlowTcpCtlRst) String() string { func (*PatternFlowTcpCtlRst) ProtoMessage() {} func (x *PatternFlowTcpCtlRst) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[704] + mi := &file_otg_proto_msgTypes[709] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -81991,7 +82472,7 @@ func (x *PatternFlowTcpCtlRst) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlRst.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlRst) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{704} + return file_otg_proto_rawDescGZIP(), []int{709} } func (x *PatternFlowTcpCtlRst) GetChoice() PatternFlowTcpCtlRst_Choice_Enum { @@ -82056,7 +82537,7 @@ type PatternFlowTcpCtlSynCounter struct { func (x *PatternFlowTcpCtlSynCounter) Reset() { *x = PatternFlowTcpCtlSynCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[705] + mi := &file_otg_proto_msgTypes[710] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82069,7 +82550,7 @@ func (x *PatternFlowTcpCtlSynCounter) String() string { func (*PatternFlowTcpCtlSynCounter) ProtoMessage() {} func (x *PatternFlowTcpCtlSynCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[705] + mi := &file_otg_proto_msgTypes[710] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -82082,7 +82563,7 @@ func (x *PatternFlowTcpCtlSynCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlSynCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlSynCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{705} + return file_otg_proto_rawDescGZIP(), []int{710} } func (x *PatternFlowTcpCtlSynCounter) GetStart() uint32 { @@ -82130,7 +82611,7 @@ type PatternFlowTcpCtlSynMetricTag struct { func (x *PatternFlowTcpCtlSynMetricTag) Reset() { *x = PatternFlowTcpCtlSynMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[706] + mi := &file_otg_proto_msgTypes[711] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82143,7 +82624,7 @@ func (x *PatternFlowTcpCtlSynMetricTag) String() string { func (*PatternFlowTcpCtlSynMetricTag) ProtoMessage() {} func (x *PatternFlowTcpCtlSynMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[706] + mi := &file_otg_proto_msgTypes[711] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -82156,7 +82637,7 @@ func (x *PatternFlowTcpCtlSynMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlSynMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlSynMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{706} + return file_otg_proto_rawDescGZIP(), []int{711} } func (x *PatternFlowTcpCtlSynMetricTag) GetName() string { @@ -82208,7 +82689,7 @@ type PatternFlowTcpCtlSyn struct { func (x *PatternFlowTcpCtlSyn) Reset() { *x = PatternFlowTcpCtlSyn{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[707] + mi := &file_otg_proto_msgTypes[712] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82221,7 +82702,7 @@ func (x *PatternFlowTcpCtlSyn) String() string { func (*PatternFlowTcpCtlSyn) ProtoMessage() {} func (x *PatternFlowTcpCtlSyn) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[707] + mi := &file_otg_proto_msgTypes[712] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -82234,7 +82715,7 @@ func (x *PatternFlowTcpCtlSyn) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlSyn.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlSyn) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{707} + return file_otg_proto_rawDescGZIP(), []int{712} } func (x *PatternFlowTcpCtlSyn) GetChoice() PatternFlowTcpCtlSyn_Choice_Enum { @@ -82299,7 +82780,7 @@ type PatternFlowTcpCtlFinCounter struct { func (x *PatternFlowTcpCtlFinCounter) Reset() { *x = PatternFlowTcpCtlFinCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[708] + mi := &file_otg_proto_msgTypes[713] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82312,7 +82793,7 @@ func (x *PatternFlowTcpCtlFinCounter) String() string { func (*PatternFlowTcpCtlFinCounter) ProtoMessage() {} func (x *PatternFlowTcpCtlFinCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[708] + mi := &file_otg_proto_msgTypes[713] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -82325,7 +82806,7 @@ func (x *PatternFlowTcpCtlFinCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlFinCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlFinCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{708} + return file_otg_proto_rawDescGZIP(), []int{713} } func (x *PatternFlowTcpCtlFinCounter) GetStart() uint32 { @@ -82373,7 +82854,7 @@ type PatternFlowTcpCtlFinMetricTag struct { func (x *PatternFlowTcpCtlFinMetricTag) Reset() { *x = PatternFlowTcpCtlFinMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[709] + mi := &file_otg_proto_msgTypes[714] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82386,7 +82867,7 @@ func (x *PatternFlowTcpCtlFinMetricTag) String() string { func (*PatternFlowTcpCtlFinMetricTag) ProtoMessage() {} func (x *PatternFlowTcpCtlFinMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[709] + mi := &file_otg_proto_msgTypes[714] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -82399,7 +82880,7 @@ func (x *PatternFlowTcpCtlFinMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlFinMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlFinMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{709} + return file_otg_proto_rawDescGZIP(), []int{714} } func (x *PatternFlowTcpCtlFinMetricTag) GetName() string { @@ -82451,7 +82932,7 @@ type PatternFlowTcpCtlFin struct { func (x *PatternFlowTcpCtlFin) Reset() { *x = PatternFlowTcpCtlFin{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[710] + mi := &file_otg_proto_msgTypes[715] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82464,7 +82945,7 @@ func (x *PatternFlowTcpCtlFin) String() string { func (*PatternFlowTcpCtlFin) ProtoMessage() {} func (x *PatternFlowTcpCtlFin) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[710] + mi := &file_otg_proto_msgTypes[715] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -82477,7 +82958,7 @@ func (x *PatternFlowTcpCtlFin) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlFin.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlFin) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{710} + return file_otg_proto_rawDescGZIP(), []int{715} } func (x *PatternFlowTcpCtlFin) GetChoice() PatternFlowTcpCtlFin_Choice_Enum { @@ -82542,7 +83023,7 @@ type PatternFlowTcpWindowCounter struct { func (x *PatternFlowTcpWindowCounter) Reset() { *x = PatternFlowTcpWindowCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[711] + mi := &file_otg_proto_msgTypes[716] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82555,7 +83036,7 @@ func (x *PatternFlowTcpWindowCounter) String() string { func (*PatternFlowTcpWindowCounter) ProtoMessage() {} func (x *PatternFlowTcpWindowCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[711] + mi := &file_otg_proto_msgTypes[716] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -82568,7 +83049,7 @@ func (x *PatternFlowTcpWindowCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpWindowCounter.ProtoReflect.Descriptor instead. func (*PatternFlowTcpWindowCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{711} + return file_otg_proto_rawDescGZIP(), []int{716} } func (x *PatternFlowTcpWindowCounter) GetStart() uint32 { @@ -82616,7 +83097,7 @@ type PatternFlowTcpWindowMetricTag struct { func (x *PatternFlowTcpWindowMetricTag) Reset() { *x = PatternFlowTcpWindowMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[712] + mi := &file_otg_proto_msgTypes[717] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82629,7 +83110,7 @@ func (x *PatternFlowTcpWindowMetricTag) String() string { func (*PatternFlowTcpWindowMetricTag) ProtoMessage() {} func (x *PatternFlowTcpWindowMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[712] + mi := &file_otg_proto_msgTypes[717] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -82642,7 +83123,7 @@ func (x *PatternFlowTcpWindowMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpWindowMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowTcpWindowMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{712} + return file_otg_proto_rawDescGZIP(), []int{717} } func (x *PatternFlowTcpWindowMetricTag) GetName() string { @@ -82694,7 +83175,7 @@ type PatternFlowTcpWindow struct { func (x *PatternFlowTcpWindow) Reset() { *x = PatternFlowTcpWindow{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[713] + mi := &file_otg_proto_msgTypes[718] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82707,7 +83188,7 @@ func (x *PatternFlowTcpWindow) String() string { func (*PatternFlowTcpWindow) ProtoMessage() {} func (x *PatternFlowTcpWindow) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[713] + mi := &file_otg_proto_msgTypes[718] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -82720,7 +83201,7 @@ func (x *PatternFlowTcpWindow) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpWindow.ProtoReflect.Descriptor instead. func (*PatternFlowTcpWindow) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{713} + return file_otg_proto_rawDescGZIP(), []int{718} } func (x *PatternFlowTcpWindow) GetChoice() PatternFlowTcpWindow_Choice_Enum { @@ -82786,7 +83267,7 @@ type PatternFlowTcpChecksum struct { func (x *PatternFlowTcpChecksum) Reset() { *x = PatternFlowTcpChecksum{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[714] + mi := &file_otg_proto_msgTypes[719] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82799,7 +83280,7 @@ func (x *PatternFlowTcpChecksum) String() string { func (*PatternFlowTcpChecksum) ProtoMessage() {} func (x *PatternFlowTcpChecksum) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[714] + mi := &file_otg_proto_msgTypes[719] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -82812,7 +83293,7 @@ func (x *PatternFlowTcpChecksum) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpChecksum.ProtoReflect.Descriptor instead. func (*PatternFlowTcpChecksum) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{714} + return file_otg_proto_rawDescGZIP(), []int{719} } func (x *PatternFlowTcpChecksum) GetChoice() PatternFlowTcpChecksum_Choice_Enum { @@ -82856,7 +83337,7 @@ type PatternFlowUdpSrcPortCounter struct { func (x *PatternFlowUdpSrcPortCounter) Reset() { *x = PatternFlowUdpSrcPortCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[715] + mi := &file_otg_proto_msgTypes[720] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82869,7 +83350,7 @@ func (x *PatternFlowUdpSrcPortCounter) String() string { func (*PatternFlowUdpSrcPortCounter) ProtoMessage() {} func (x *PatternFlowUdpSrcPortCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[715] + mi := &file_otg_proto_msgTypes[720] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -82882,7 +83363,7 @@ func (x *PatternFlowUdpSrcPortCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpSrcPortCounter.ProtoReflect.Descriptor instead. func (*PatternFlowUdpSrcPortCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{715} + return file_otg_proto_rawDescGZIP(), []int{720} } func (x *PatternFlowUdpSrcPortCounter) GetStart() uint32 { @@ -82930,7 +83411,7 @@ type PatternFlowUdpSrcPortMetricTag struct { func (x *PatternFlowUdpSrcPortMetricTag) Reset() { *x = PatternFlowUdpSrcPortMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[716] + mi := &file_otg_proto_msgTypes[721] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -82943,7 +83424,7 @@ func (x *PatternFlowUdpSrcPortMetricTag) String() string { func (*PatternFlowUdpSrcPortMetricTag) ProtoMessage() {} func (x *PatternFlowUdpSrcPortMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[716] + mi := &file_otg_proto_msgTypes[721] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -82956,7 +83437,7 @@ func (x *PatternFlowUdpSrcPortMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpSrcPortMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowUdpSrcPortMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{716} + return file_otg_proto_rawDescGZIP(), []int{721} } func (x *PatternFlowUdpSrcPortMetricTag) GetName() string { @@ -82980,6 +83461,89 @@ func (x *PatternFlowUdpSrcPortMetricTag) GetLength() uint32 { return 0 } +// integer random pattern +type PatternFlowUdpSrcPortRandom struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The minimum possible value generated by the random value generator. + // default = 0 + Min *uint32 `protobuf:"varint,1,opt,name=min,proto3,oneof" json:"min,omitempty"` + // The maximum possible value generated by the random value generator. + // default = 65535 + Max *uint32 `protobuf:"varint,2,opt,name=max,proto3,oneof" json:"max,omitempty"` + // The seed value is used to initialize the random number generator to a deterministic + // state. If the user provides a seed value of 0, the implementation will generate a + // sequence of non-deterministic random values. For any other seed value, the sequence + // of random numbers will be generated in a deterministic manner (specific to the implementation). + // default = 1 + Seed *uint32 `protobuf:"varint,3,opt,name=seed,proto3,oneof" json:"seed,omitempty"` + // The total number of values to be generated by the random value generator. + // default = 1 + Count *uint32 `protobuf:"varint,4,opt,name=count,proto3,oneof" json:"count,omitempty"` +} + +func (x *PatternFlowUdpSrcPortRandom) Reset() { + *x = PatternFlowUdpSrcPortRandom{} + if protoimpl.UnsafeEnabled { + mi := &file_otg_proto_msgTypes[722] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PatternFlowUdpSrcPortRandom) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatternFlowUdpSrcPortRandom) ProtoMessage() {} + +func (x *PatternFlowUdpSrcPortRandom) ProtoReflect() protoreflect.Message { + mi := &file_otg_proto_msgTypes[722] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PatternFlowUdpSrcPortRandom.ProtoReflect.Descriptor instead. +func (*PatternFlowUdpSrcPortRandom) Descriptor() ([]byte, []int) { + return file_otg_proto_rawDescGZIP(), []int{722} +} + +func (x *PatternFlowUdpSrcPortRandom) GetMin() uint32 { + if x != nil && x.Min != nil { + return *x.Min + } + return 0 +} + +func (x *PatternFlowUdpSrcPortRandom) GetMax() uint32 { + if x != nil && x.Max != nil { + return *x.Max + } + return 0 +} + +func (x *PatternFlowUdpSrcPortRandom) GetSeed() uint32 { + if x != nil && x.Seed != nil { + return *x.Seed + } + return 0 +} + +func (x *PatternFlowUdpSrcPortRandom) GetCount() uint32 { + if x != nil && x.Count != nil { + return *x.Count + } + return 0 +} + // Source port type PatternFlowUdpSrcPort struct { state protoimpl.MessageState @@ -83003,12 +83567,14 @@ type PatternFlowUdpSrcPort struct { // a corresponding header field for metrics per each applicable value. These would appear // as tagged metrics in corresponding flow metrics. MetricTags []*PatternFlowUdpSrcPortMetricTag `protobuf:"bytes,7,rep,name=metric_tags,json=metricTags,proto3" json:"metric_tags,omitempty"` + // Description missing in models + Random *PatternFlowUdpSrcPortRandom `protobuf:"bytes,8,opt,name=random,proto3" json:"random,omitempty"` } func (x *PatternFlowUdpSrcPort) Reset() { *x = PatternFlowUdpSrcPort{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[717] + mi := &file_otg_proto_msgTypes[723] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -83021,7 +83587,7 @@ func (x *PatternFlowUdpSrcPort) String() string { func (*PatternFlowUdpSrcPort) ProtoMessage() {} func (x *PatternFlowUdpSrcPort) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[717] + mi := &file_otg_proto_msgTypes[723] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -83034,7 +83600,7 @@ func (x *PatternFlowUdpSrcPort) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpSrcPort.ProtoReflect.Descriptor instead. func (*PatternFlowUdpSrcPort) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{717} + return file_otg_proto_rawDescGZIP(), []int{723} } func (x *PatternFlowUdpSrcPort) GetChoice() PatternFlowUdpSrcPort_Choice_Enum { @@ -83079,6 +83645,13 @@ func (x *PatternFlowUdpSrcPort) GetMetricTags() []*PatternFlowUdpSrcPortMetricTa return nil } +func (x *PatternFlowUdpSrcPort) GetRandom() *PatternFlowUdpSrcPortRandom { + if x != nil { + return x.Random + } + return nil +} + // integer counter pattern type PatternFlowUdpDstPortCounter struct { state protoimpl.MessageState @@ -83099,7 +83672,7 @@ type PatternFlowUdpDstPortCounter struct { func (x *PatternFlowUdpDstPortCounter) Reset() { *x = PatternFlowUdpDstPortCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[718] + mi := &file_otg_proto_msgTypes[724] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -83112,7 +83685,7 @@ func (x *PatternFlowUdpDstPortCounter) String() string { func (*PatternFlowUdpDstPortCounter) ProtoMessage() {} func (x *PatternFlowUdpDstPortCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[718] + mi := &file_otg_proto_msgTypes[724] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -83125,7 +83698,7 @@ func (x *PatternFlowUdpDstPortCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpDstPortCounter.ProtoReflect.Descriptor instead. func (*PatternFlowUdpDstPortCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{718} + return file_otg_proto_rawDescGZIP(), []int{724} } func (x *PatternFlowUdpDstPortCounter) GetStart() uint32 { @@ -83173,7 +83746,7 @@ type PatternFlowUdpDstPortMetricTag struct { func (x *PatternFlowUdpDstPortMetricTag) Reset() { *x = PatternFlowUdpDstPortMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[719] + mi := &file_otg_proto_msgTypes[725] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -83186,7 +83759,7 @@ func (x *PatternFlowUdpDstPortMetricTag) String() string { func (*PatternFlowUdpDstPortMetricTag) ProtoMessage() {} func (x *PatternFlowUdpDstPortMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[719] + mi := &file_otg_proto_msgTypes[725] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -83199,7 +83772,7 @@ func (x *PatternFlowUdpDstPortMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpDstPortMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowUdpDstPortMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{719} + return file_otg_proto_rawDescGZIP(), []int{725} } func (x *PatternFlowUdpDstPortMetricTag) GetName() string { @@ -83223,6 +83796,89 @@ func (x *PatternFlowUdpDstPortMetricTag) GetLength() uint32 { return 0 } +// integer random pattern +type PatternFlowUdpDstPortRandom struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The minimum possible value generated by the random value generator. + // default = 0 + Min *uint32 `protobuf:"varint,1,opt,name=min,proto3,oneof" json:"min,omitempty"` + // The maximum possible value generated by the random value generator. + // default = 65535 + Max *uint32 `protobuf:"varint,2,opt,name=max,proto3,oneof" json:"max,omitempty"` + // The seed value is used to initialize the random number generator to a deterministic + // state. If the user provides a seed value of 0, the implementation will generate a + // sequence of non-deterministic random values. For any other seed value, the sequence + // of random numbers will be generated in a deterministic manner (specific to the implementation). + // default = 1 + Seed *uint32 `protobuf:"varint,3,opt,name=seed,proto3,oneof" json:"seed,omitempty"` + // The total number of values to be generated by the random value generator. + // default = 1 + Count *uint32 `protobuf:"varint,4,opt,name=count,proto3,oneof" json:"count,omitempty"` +} + +func (x *PatternFlowUdpDstPortRandom) Reset() { + *x = PatternFlowUdpDstPortRandom{} + if protoimpl.UnsafeEnabled { + mi := &file_otg_proto_msgTypes[726] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PatternFlowUdpDstPortRandom) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PatternFlowUdpDstPortRandom) ProtoMessage() {} + +func (x *PatternFlowUdpDstPortRandom) ProtoReflect() protoreflect.Message { + mi := &file_otg_proto_msgTypes[726] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PatternFlowUdpDstPortRandom.ProtoReflect.Descriptor instead. +func (*PatternFlowUdpDstPortRandom) Descriptor() ([]byte, []int) { + return file_otg_proto_rawDescGZIP(), []int{726} +} + +func (x *PatternFlowUdpDstPortRandom) GetMin() uint32 { + if x != nil && x.Min != nil { + return *x.Min + } + return 0 +} + +func (x *PatternFlowUdpDstPortRandom) GetMax() uint32 { + if x != nil && x.Max != nil { + return *x.Max + } + return 0 +} + +func (x *PatternFlowUdpDstPortRandom) GetSeed() uint32 { + if x != nil && x.Seed != nil { + return *x.Seed + } + return 0 +} + +func (x *PatternFlowUdpDstPortRandom) GetCount() uint32 { + if x != nil && x.Count != nil { + return *x.Count + } + return 0 +} + // Destination port type PatternFlowUdpDstPort struct { state protoimpl.MessageState @@ -83246,12 +83902,14 @@ type PatternFlowUdpDstPort struct { // a corresponding header field for metrics per each applicable value. These would appear // as tagged metrics in corresponding flow metrics. MetricTags []*PatternFlowUdpDstPortMetricTag `protobuf:"bytes,7,rep,name=metric_tags,json=metricTags,proto3" json:"metric_tags,omitempty"` + // Description missing in models + Random *PatternFlowUdpDstPortRandom `protobuf:"bytes,8,opt,name=random,proto3" json:"random,omitempty"` } func (x *PatternFlowUdpDstPort) Reset() { *x = PatternFlowUdpDstPort{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[720] + mi := &file_otg_proto_msgTypes[727] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -83264,7 +83922,7 @@ func (x *PatternFlowUdpDstPort) String() string { func (*PatternFlowUdpDstPort) ProtoMessage() {} func (x *PatternFlowUdpDstPort) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[720] + mi := &file_otg_proto_msgTypes[727] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -83277,7 +83935,7 @@ func (x *PatternFlowUdpDstPort) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpDstPort.ProtoReflect.Descriptor instead. func (*PatternFlowUdpDstPort) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{720} + return file_otg_proto_rawDescGZIP(), []int{727} } func (x *PatternFlowUdpDstPort) GetChoice() PatternFlowUdpDstPort_Choice_Enum { @@ -83322,6 +83980,13 @@ func (x *PatternFlowUdpDstPort) GetMetricTags() []*PatternFlowUdpDstPortMetricTa return nil } +func (x *PatternFlowUdpDstPort) GetRandom() *PatternFlowUdpDstPortRandom { + if x != nil { + return x.Random + } + return nil +} + // integer counter pattern type PatternFlowUdpLengthCounter struct { state protoimpl.MessageState @@ -83342,7 +84007,7 @@ type PatternFlowUdpLengthCounter struct { func (x *PatternFlowUdpLengthCounter) Reset() { *x = PatternFlowUdpLengthCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[721] + mi := &file_otg_proto_msgTypes[728] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -83355,7 +84020,7 @@ func (x *PatternFlowUdpLengthCounter) String() string { func (*PatternFlowUdpLengthCounter) ProtoMessage() {} func (x *PatternFlowUdpLengthCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[721] + mi := &file_otg_proto_msgTypes[728] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -83368,7 +84033,7 @@ func (x *PatternFlowUdpLengthCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpLengthCounter.ProtoReflect.Descriptor instead. func (*PatternFlowUdpLengthCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{721} + return file_otg_proto_rawDescGZIP(), []int{728} } func (x *PatternFlowUdpLengthCounter) GetStart() uint32 { @@ -83416,7 +84081,7 @@ type PatternFlowUdpLengthMetricTag struct { func (x *PatternFlowUdpLengthMetricTag) Reset() { *x = PatternFlowUdpLengthMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[722] + mi := &file_otg_proto_msgTypes[729] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -83429,7 +84094,7 @@ func (x *PatternFlowUdpLengthMetricTag) String() string { func (*PatternFlowUdpLengthMetricTag) ProtoMessage() {} func (x *PatternFlowUdpLengthMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[722] + mi := &file_otg_proto_msgTypes[729] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -83442,7 +84107,7 @@ func (x *PatternFlowUdpLengthMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpLengthMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowUdpLengthMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{722} + return file_otg_proto_rawDescGZIP(), []int{729} } func (x *PatternFlowUdpLengthMetricTag) GetName() string { @@ -83494,7 +84159,7 @@ type PatternFlowUdpLength struct { func (x *PatternFlowUdpLength) Reset() { *x = PatternFlowUdpLength{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[723] + mi := &file_otg_proto_msgTypes[730] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -83507,7 +84172,7 @@ func (x *PatternFlowUdpLength) String() string { func (*PatternFlowUdpLength) ProtoMessage() {} func (x *PatternFlowUdpLength) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[723] + mi := &file_otg_proto_msgTypes[730] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -83520,7 +84185,7 @@ func (x *PatternFlowUdpLength) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpLength.ProtoReflect.Descriptor instead. func (*PatternFlowUdpLength) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{723} + return file_otg_proto_rawDescGZIP(), []int{730} } func (x *PatternFlowUdpLength) GetChoice() PatternFlowUdpLength_Choice_Enum { @@ -83584,7 +84249,7 @@ type PatternFlowUdpChecksum struct { func (x *PatternFlowUdpChecksum) Reset() { *x = PatternFlowUdpChecksum{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[724] + mi := &file_otg_proto_msgTypes[731] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -83597,7 +84262,7 @@ func (x *PatternFlowUdpChecksum) String() string { func (*PatternFlowUdpChecksum) ProtoMessage() {} func (x *PatternFlowUdpChecksum) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[724] + mi := &file_otg_proto_msgTypes[731] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -83610,7 +84275,7 @@ func (x *PatternFlowUdpChecksum) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpChecksum.ProtoReflect.Descriptor instead. func (*PatternFlowUdpChecksum) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{724} + return file_otg_proto_rawDescGZIP(), []int{731} } func (x *PatternFlowUdpChecksum) GetChoice() PatternFlowUdpChecksum_Choice_Enum { @@ -83654,7 +84319,7 @@ type PatternFlowGreChecksumPresentCounter struct { func (x *PatternFlowGreChecksumPresentCounter) Reset() { *x = PatternFlowGreChecksumPresentCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[725] + mi := &file_otg_proto_msgTypes[732] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -83667,7 +84332,7 @@ func (x *PatternFlowGreChecksumPresentCounter) String() string { func (*PatternFlowGreChecksumPresentCounter) ProtoMessage() {} func (x *PatternFlowGreChecksumPresentCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[725] + mi := &file_otg_proto_msgTypes[732] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -83680,7 +84345,7 @@ func (x *PatternFlowGreChecksumPresentCounter) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowGreChecksumPresentCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGreChecksumPresentCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{725} + return file_otg_proto_rawDescGZIP(), []int{732} } func (x *PatternFlowGreChecksumPresentCounter) GetStart() uint32 { @@ -83728,7 +84393,7 @@ type PatternFlowGreChecksumPresentMetricTag struct { func (x *PatternFlowGreChecksumPresentMetricTag) Reset() { *x = PatternFlowGreChecksumPresentMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[726] + mi := &file_otg_proto_msgTypes[733] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -83741,7 +84406,7 @@ func (x *PatternFlowGreChecksumPresentMetricTag) String() string { func (*PatternFlowGreChecksumPresentMetricTag) ProtoMessage() {} func (x *PatternFlowGreChecksumPresentMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[726] + mi := &file_otg_proto_msgTypes[733] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -83754,7 +84419,7 @@ func (x *PatternFlowGreChecksumPresentMetricTag) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowGreChecksumPresentMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGreChecksumPresentMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{726} + return file_otg_proto_rawDescGZIP(), []int{733} } func (x *PatternFlowGreChecksumPresentMetricTag) GetName() string { @@ -83806,7 +84471,7 @@ type PatternFlowGreChecksumPresent struct { func (x *PatternFlowGreChecksumPresent) Reset() { *x = PatternFlowGreChecksumPresent{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[727] + mi := &file_otg_proto_msgTypes[734] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -83819,7 +84484,7 @@ func (x *PatternFlowGreChecksumPresent) String() string { func (*PatternFlowGreChecksumPresent) ProtoMessage() {} func (x *PatternFlowGreChecksumPresent) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[727] + mi := &file_otg_proto_msgTypes[734] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -83832,7 +84497,7 @@ func (x *PatternFlowGreChecksumPresent) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreChecksumPresent.ProtoReflect.Descriptor instead. func (*PatternFlowGreChecksumPresent) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{727} + return file_otg_proto_rawDescGZIP(), []int{734} } func (x *PatternFlowGreChecksumPresent) GetChoice() PatternFlowGreChecksumPresent_Choice_Enum { @@ -83897,7 +84562,7 @@ type PatternFlowGreReserved0Counter struct { func (x *PatternFlowGreReserved0Counter) Reset() { *x = PatternFlowGreReserved0Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[728] + mi := &file_otg_proto_msgTypes[735] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -83910,7 +84575,7 @@ func (x *PatternFlowGreReserved0Counter) String() string { func (*PatternFlowGreReserved0Counter) ProtoMessage() {} func (x *PatternFlowGreReserved0Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[728] + mi := &file_otg_proto_msgTypes[735] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -83923,7 +84588,7 @@ func (x *PatternFlowGreReserved0Counter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreReserved0Counter.ProtoReflect.Descriptor instead. func (*PatternFlowGreReserved0Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{728} + return file_otg_proto_rawDescGZIP(), []int{735} } func (x *PatternFlowGreReserved0Counter) GetStart() uint32 { @@ -83971,7 +84636,7 @@ type PatternFlowGreReserved0MetricTag struct { func (x *PatternFlowGreReserved0MetricTag) Reset() { *x = PatternFlowGreReserved0MetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[729] + mi := &file_otg_proto_msgTypes[736] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -83984,7 +84649,7 @@ func (x *PatternFlowGreReserved0MetricTag) String() string { func (*PatternFlowGreReserved0MetricTag) ProtoMessage() {} func (x *PatternFlowGreReserved0MetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[729] + mi := &file_otg_proto_msgTypes[736] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -83997,7 +84662,7 @@ func (x *PatternFlowGreReserved0MetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreReserved0MetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGreReserved0MetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{729} + return file_otg_proto_rawDescGZIP(), []int{736} } func (x *PatternFlowGreReserved0MetricTag) GetName() string { @@ -84049,7 +84714,7 @@ type PatternFlowGreReserved0 struct { func (x *PatternFlowGreReserved0) Reset() { *x = PatternFlowGreReserved0{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[730] + mi := &file_otg_proto_msgTypes[737] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -84062,7 +84727,7 @@ func (x *PatternFlowGreReserved0) String() string { func (*PatternFlowGreReserved0) ProtoMessage() {} func (x *PatternFlowGreReserved0) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[730] + mi := &file_otg_proto_msgTypes[737] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -84075,7 +84740,7 @@ func (x *PatternFlowGreReserved0) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreReserved0.ProtoReflect.Descriptor instead. func (*PatternFlowGreReserved0) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{730} + return file_otg_proto_rawDescGZIP(), []int{737} } func (x *PatternFlowGreReserved0) GetChoice() PatternFlowGreReserved0_Choice_Enum { @@ -84140,7 +84805,7 @@ type PatternFlowGreVersionCounter struct { func (x *PatternFlowGreVersionCounter) Reset() { *x = PatternFlowGreVersionCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[731] + mi := &file_otg_proto_msgTypes[738] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -84153,7 +84818,7 @@ func (x *PatternFlowGreVersionCounter) String() string { func (*PatternFlowGreVersionCounter) ProtoMessage() {} func (x *PatternFlowGreVersionCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[731] + mi := &file_otg_proto_msgTypes[738] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -84166,7 +84831,7 @@ func (x *PatternFlowGreVersionCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreVersionCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGreVersionCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{731} + return file_otg_proto_rawDescGZIP(), []int{738} } func (x *PatternFlowGreVersionCounter) GetStart() uint32 { @@ -84214,7 +84879,7 @@ type PatternFlowGreVersionMetricTag struct { func (x *PatternFlowGreVersionMetricTag) Reset() { *x = PatternFlowGreVersionMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[732] + mi := &file_otg_proto_msgTypes[739] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -84227,7 +84892,7 @@ func (x *PatternFlowGreVersionMetricTag) String() string { func (*PatternFlowGreVersionMetricTag) ProtoMessage() {} func (x *PatternFlowGreVersionMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[732] + mi := &file_otg_proto_msgTypes[739] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -84240,7 +84905,7 @@ func (x *PatternFlowGreVersionMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreVersionMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGreVersionMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{732} + return file_otg_proto_rawDescGZIP(), []int{739} } func (x *PatternFlowGreVersionMetricTag) GetName() string { @@ -84292,7 +84957,7 @@ type PatternFlowGreVersion struct { func (x *PatternFlowGreVersion) Reset() { *x = PatternFlowGreVersion{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[733] + mi := &file_otg_proto_msgTypes[740] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -84305,7 +84970,7 @@ func (x *PatternFlowGreVersion) String() string { func (*PatternFlowGreVersion) ProtoMessage() {} func (x *PatternFlowGreVersion) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[733] + mi := &file_otg_proto_msgTypes[740] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -84318,7 +84983,7 @@ func (x *PatternFlowGreVersion) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreVersion.ProtoReflect.Descriptor instead. func (*PatternFlowGreVersion) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{733} + return file_otg_proto_rawDescGZIP(), []int{740} } func (x *PatternFlowGreVersion) GetChoice() PatternFlowGreVersion_Choice_Enum { @@ -84383,7 +85048,7 @@ type PatternFlowGreProtocolCounter struct { func (x *PatternFlowGreProtocolCounter) Reset() { *x = PatternFlowGreProtocolCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[734] + mi := &file_otg_proto_msgTypes[741] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -84396,7 +85061,7 @@ func (x *PatternFlowGreProtocolCounter) String() string { func (*PatternFlowGreProtocolCounter) ProtoMessage() {} func (x *PatternFlowGreProtocolCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[734] + mi := &file_otg_proto_msgTypes[741] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -84409,7 +85074,7 @@ func (x *PatternFlowGreProtocolCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreProtocolCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGreProtocolCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{734} + return file_otg_proto_rawDescGZIP(), []int{741} } func (x *PatternFlowGreProtocolCounter) GetStart() uint32 { @@ -84457,7 +85122,7 @@ type PatternFlowGreProtocolMetricTag struct { func (x *PatternFlowGreProtocolMetricTag) Reset() { *x = PatternFlowGreProtocolMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[735] + mi := &file_otg_proto_msgTypes[742] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -84470,7 +85135,7 @@ func (x *PatternFlowGreProtocolMetricTag) String() string { func (*PatternFlowGreProtocolMetricTag) ProtoMessage() {} func (x *PatternFlowGreProtocolMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[735] + mi := &file_otg_proto_msgTypes[742] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -84483,7 +85148,7 @@ func (x *PatternFlowGreProtocolMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreProtocolMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGreProtocolMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{735} + return file_otg_proto_rawDescGZIP(), []int{742} } func (x *PatternFlowGreProtocolMetricTag) GetName() string { @@ -84535,7 +85200,7 @@ type PatternFlowGreProtocol struct { func (x *PatternFlowGreProtocol) Reset() { *x = PatternFlowGreProtocol{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[736] + mi := &file_otg_proto_msgTypes[743] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -84548,7 +85213,7 @@ func (x *PatternFlowGreProtocol) String() string { func (*PatternFlowGreProtocol) ProtoMessage() {} func (x *PatternFlowGreProtocol) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[736] + mi := &file_otg_proto_msgTypes[743] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -84561,7 +85226,7 @@ func (x *PatternFlowGreProtocol) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreProtocol.ProtoReflect.Descriptor instead. func (*PatternFlowGreProtocol) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{736} + return file_otg_proto_rawDescGZIP(), []int{743} } func (x *PatternFlowGreProtocol) GetChoice() PatternFlowGreProtocol_Choice_Enum { @@ -84626,7 +85291,7 @@ type PatternFlowGreChecksum struct { func (x *PatternFlowGreChecksum) Reset() { *x = PatternFlowGreChecksum{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[737] + mi := &file_otg_proto_msgTypes[744] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -84639,7 +85304,7 @@ func (x *PatternFlowGreChecksum) String() string { func (*PatternFlowGreChecksum) ProtoMessage() {} func (x *PatternFlowGreChecksum) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[737] + mi := &file_otg_proto_msgTypes[744] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -84652,7 +85317,7 @@ func (x *PatternFlowGreChecksum) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreChecksum.ProtoReflect.Descriptor instead. func (*PatternFlowGreChecksum) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{737} + return file_otg_proto_rawDescGZIP(), []int{744} } func (x *PatternFlowGreChecksum) GetChoice() PatternFlowGreChecksum_Choice_Enum { @@ -84696,7 +85361,7 @@ type PatternFlowGreReserved1Counter struct { func (x *PatternFlowGreReserved1Counter) Reset() { *x = PatternFlowGreReserved1Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[738] + mi := &file_otg_proto_msgTypes[745] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -84709,7 +85374,7 @@ func (x *PatternFlowGreReserved1Counter) String() string { func (*PatternFlowGreReserved1Counter) ProtoMessage() {} func (x *PatternFlowGreReserved1Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[738] + mi := &file_otg_proto_msgTypes[745] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -84722,7 +85387,7 @@ func (x *PatternFlowGreReserved1Counter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreReserved1Counter.ProtoReflect.Descriptor instead. func (*PatternFlowGreReserved1Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{738} + return file_otg_proto_rawDescGZIP(), []int{745} } func (x *PatternFlowGreReserved1Counter) GetStart() uint32 { @@ -84770,7 +85435,7 @@ type PatternFlowGreReserved1MetricTag struct { func (x *PatternFlowGreReserved1MetricTag) Reset() { *x = PatternFlowGreReserved1MetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[739] + mi := &file_otg_proto_msgTypes[746] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -84783,7 +85448,7 @@ func (x *PatternFlowGreReserved1MetricTag) String() string { func (*PatternFlowGreReserved1MetricTag) ProtoMessage() {} func (x *PatternFlowGreReserved1MetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[739] + mi := &file_otg_proto_msgTypes[746] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -84796,7 +85461,7 @@ func (x *PatternFlowGreReserved1MetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreReserved1MetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGreReserved1MetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{739} + return file_otg_proto_rawDescGZIP(), []int{746} } func (x *PatternFlowGreReserved1MetricTag) GetName() string { @@ -84848,7 +85513,7 @@ type PatternFlowGreReserved1 struct { func (x *PatternFlowGreReserved1) Reset() { *x = PatternFlowGreReserved1{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[740] + mi := &file_otg_proto_msgTypes[747] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -84861,7 +85526,7 @@ func (x *PatternFlowGreReserved1) String() string { func (*PatternFlowGreReserved1) ProtoMessage() {} func (x *PatternFlowGreReserved1) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[740] + mi := &file_otg_proto_msgTypes[747] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -84874,7 +85539,7 @@ func (x *PatternFlowGreReserved1) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreReserved1.ProtoReflect.Descriptor instead. func (*PatternFlowGreReserved1) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{740} + return file_otg_proto_rawDescGZIP(), []int{747} } func (x *PatternFlowGreReserved1) GetChoice() PatternFlowGreReserved1_Choice_Enum { @@ -84939,7 +85604,7 @@ type PatternFlowGtpv1VersionCounter struct { func (x *PatternFlowGtpv1VersionCounter) Reset() { *x = PatternFlowGtpv1VersionCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[741] + mi := &file_otg_proto_msgTypes[748] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -84952,7 +85617,7 @@ func (x *PatternFlowGtpv1VersionCounter) String() string { func (*PatternFlowGtpv1VersionCounter) ProtoMessage() {} func (x *PatternFlowGtpv1VersionCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[741] + mi := &file_otg_proto_msgTypes[748] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -84965,7 +85630,7 @@ func (x *PatternFlowGtpv1VersionCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1VersionCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1VersionCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{741} + return file_otg_proto_rawDescGZIP(), []int{748} } func (x *PatternFlowGtpv1VersionCounter) GetStart() uint32 { @@ -85013,7 +85678,7 @@ type PatternFlowGtpv1VersionMetricTag struct { func (x *PatternFlowGtpv1VersionMetricTag) Reset() { *x = PatternFlowGtpv1VersionMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[742] + mi := &file_otg_proto_msgTypes[749] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -85026,7 +85691,7 @@ func (x *PatternFlowGtpv1VersionMetricTag) String() string { func (*PatternFlowGtpv1VersionMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv1VersionMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[742] + mi := &file_otg_proto_msgTypes[749] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -85039,7 +85704,7 @@ func (x *PatternFlowGtpv1VersionMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1VersionMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1VersionMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{742} + return file_otg_proto_rawDescGZIP(), []int{749} } func (x *PatternFlowGtpv1VersionMetricTag) GetName() string { @@ -85091,7 +85756,7 @@ type PatternFlowGtpv1Version struct { func (x *PatternFlowGtpv1Version) Reset() { *x = PatternFlowGtpv1Version{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[743] + mi := &file_otg_proto_msgTypes[750] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -85104,7 +85769,7 @@ func (x *PatternFlowGtpv1Version) String() string { func (*PatternFlowGtpv1Version) ProtoMessage() {} func (x *PatternFlowGtpv1Version) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[743] + mi := &file_otg_proto_msgTypes[750] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -85117,7 +85782,7 @@ func (x *PatternFlowGtpv1Version) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1Version.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1Version) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{743} + return file_otg_proto_rawDescGZIP(), []int{750} } func (x *PatternFlowGtpv1Version) GetChoice() PatternFlowGtpv1Version_Choice_Enum { @@ -85182,7 +85847,7 @@ type PatternFlowGtpv1ProtocolTypeCounter struct { func (x *PatternFlowGtpv1ProtocolTypeCounter) Reset() { *x = PatternFlowGtpv1ProtocolTypeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[744] + mi := &file_otg_proto_msgTypes[751] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -85195,7 +85860,7 @@ func (x *PatternFlowGtpv1ProtocolTypeCounter) String() string { func (*PatternFlowGtpv1ProtocolTypeCounter) ProtoMessage() {} func (x *PatternFlowGtpv1ProtocolTypeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[744] + mi := &file_otg_proto_msgTypes[751] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -85208,7 +85873,7 @@ func (x *PatternFlowGtpv1ProtocolTypeCounter) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowGtpv1ProtocolTypeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1ProtocolTypeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{744} + return file_otg_proto_rawDescGZIP(), []int{751} } func (x *PatternFlowGtpv1ProtocolTypeCounter) GetStart() uint32 { @@ -85256,7 +85921,7 @@ type PatternFlowGtpv1ProtocolTypeMetricTag struct { func (x *PatternFlowGtpv1ProtocolTypeMetricTag) Reset() { *x = PatternFlowGtpv1ProtocolTypeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[745] + mi := &file_otg_proto_msgTypes[752] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -85269,7 +85934,7 @@ func (x *PatternFlowGtpv1ProtocolTypeMetricTag) String() string { func (*PatternFlowGtpv1ProtocolTypeMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv1ProtocolTypeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[745] + mi := &file_otg_proto_msgTypes[752] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -85282,7 +85947,7 @@ func (x *PatternFlowGtpv1ProtocolTypeMetricTag) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowGtpv1ProtocolTypeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1ProtocolTypeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{745} + return file_otg_proto_rawDescGZIP(), []int{752} } func (x *PatternFlowGtpv1ProtocolTypeMetricTag) GetName() string { @@ -85334,7 +85999,7 @@ type PatternFlowGtpv1ProtocolType struct { func (x *PatternFlowGtpv1ProtocolType) Reset() { *x = PatternFlowGtpv1ProtocolType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[746] + mi := &file_otg_proto_msgTypes[753] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -85347,7 +86012,7 @@ func (x *PatternFlowGtpv1ProtocolType) String() string { func (*PatternFlowGtpv1ProtocolType) ProtoMessage() {} func (x *PatternFlowGtpv1ProtocolType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[746] + mi := &file_otg_proto_msgTypes[753] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -85360,7 +86025,7 @@ func (x *PatternFlowGtpv1ProtocolType) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1ProtocolType.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1ProtocolType) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{746} + return file_otg_proto_rawDescGZIP(), []int{753} } func (x *PatternFlowGtpv1ProtocolType) GetChoice() PatternFlowGtpv1ProtocolType_Choice_Enum { @@ -85425,7 +86090,7 @@ type PatternFlowGtpv1ReservedCounter struct { func (x *PatternFlowGtpv1ReservedCounter) Reset() { *x = PatternFlowGtpv1ReservedCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[747] + mi := &file_otg_proto_msgTypes[754] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -85438,7 +86103,7 @@ func (x *PatternFlowGtpv1ReservedCounter) String() string { func (*PatternFlowGtpv1ReservedCounter) ProtoMessage() {} func (x *PatternFlowGtpv1ReservedCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[747] + mi := &file_otg_proto_msgTypes[754] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -85451,7 +86116,7 @@ func (x *PatternFlowGtpv1ReservedCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1ReservedCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1ReservedCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{747} + return file_otg_proto_rawDescGZIP(), []int{754} } func (x *PatternFlowGtpv1ReservedCounter) GetStart() uint32 { @@ -85499,7 +86164,7 @@ type PatternFlowGtpv1ReservedMetricTag struct { func (x *PatternFlowGtpv1ReservedMetricTag) Reset() { *x = PatternFlowGtpv1ReservedMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[748] + mi := &file_otg_proto_msgTypes[755] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -85512,7 +86177,7 @@ func (x *PatternFlowGtpv1ReservedMetricTag) String() string { func (*PatternFlowGtpv1ReservedMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv1ReservedMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[748] + mi := &file_otg_proto_msgTypes[755] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -85525,7 +86190,7 @@ func (x *PatternFlowGtpv1ReservedMetricTag) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowGtpv1ReservedMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1ReservedMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{748} + return file_otg_proto_rawDescGZIP(), []int{755} } func (x *PatternFlowGtpv1ReservedMetricTag) GetName() string { @@ -85577,7 +86242,7 @@ type PatternFlowGtpv1Reserved struct { func (x *PatternFlowGtpv1Reserved) Reset() { *x = PatternFlowGtpv1Reserved{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[749] + mi := &file_otg_proto_msgTypes[756] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -85590,7 +86255,7 @@ func (x *PatternFlowGtpv1Reserved) String() string { func (*PatternFlowGtpv1Reserved) ProtoMessage() {} func (x *PatternFlowGtpv1Reserved) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[749] + mi := &file_otg_proto_msgTypes[756] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -85603,7 +86268,7 @@ func (x *PatternFlowGtpv1Reserved) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1Reserved.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1Reserved) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{749} + return file_otg_proto_rawDescGZIP(), []int{756} } func (x *PatternFlowGtpv1Reserved) GetChoice() PatternFlowGtpv1Reserved_Choice_Enum { @@ -85668,7 +86333,7 @@ type PatternFlowGtpv1EFlagCounter struct { func (x *PatternFlowGtpv1EFlagCounter) Reset() { *x = PatternFlowGtpv1EFlagCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[750] + mi := &file_otg_proto_msgTypes[757] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -85681,7 +86346,7 @@ func (x *PatternFlowGtpv1EFlagCounter) String() string { func (*PatternFlowGtpv1EFlagCounter) ProtoMessage() {} func (x *PatternFlowGtpv1EFlagCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[750] + mi := &file_otg_proto_msgTypes[757] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -85694,7 +86359,7 @@ func (x *PatternFlowGtpv1EFlagCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1EFlagCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1EFlagCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{750} + return file_otg_proto_rawDescGZIP(), []int{757} } func (x *PatternFlowGtpv1EFlagCounter) GetStart() uint32 { @@ -85742,7 +86407,7 @@ type PatternFlowGtpv1EFlagMetricTag struct { func (x *PatternFlowGtpv1EFlagMetricTag) Reset() { *x = PatternFlowGtpv1EFlagMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[751] + mi := &file_otg_proto_msgTypes[758] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -85755,7 +86420,7 @@ func (x *PatternFlowGtpv1EFlagMetricTag) String() string { func (*PatternFlowGtpv1EFlagMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv1EFlagMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[751] + mi := &file_otg_proto_msgTypes[758] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -85768,7 +86433,7 @@ func (x *PatternFlowGtpv1EFlagMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1EFlagMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1EFlagMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{751} + return file_otg_proto_rawDescGZIP(), []int{758} } func (x *PatternFlowGtpv1EFlagMetricTag) GetName() string { @@ -85820,7 +86485,7 @@ type PatternFlowGtpv1EFlag struct { func (x *PatternFlowGtpv1EFlag) Reset() { *x = PatternFlowGtpv1EFlag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[752] + mi := &file_otg_proto_msgTypes[759] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -85833,7 +86498,7 @@ func (x *PatternFlowGtpv1EFlag) String() string { func (*PatternFlowGtpv1EFlag) ProtoMessage() {} func (x *PatternFlowGtpv1EFlag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[752] + mi := &file_otg_proto_msgTypes[759] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -85846,7 +86511,7 @@ func (x *PatternFlowGtpv1EFlag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1EFlag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1EFlag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{752} + return file_otg_proto_rawDescGZIP(), []int{759} } func (x *PatternFlowGtpv1EFlag) GetChoice() PatternFlowGtpv1EFlag_Choice_Enum { @@ -85911,7 +86576,7 @@ type PatternFlowGtpv1SFlagCounter struct { func (x *PatternFlowGtpv1SFlagCounter) Reset() { *x = PatternFlowGtpv1SFlagCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[753] + mi := &file_otg_proto_msgTypes[760] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -85924,7 +86589,7 @@ func (x *PatternFlowGtpv1SFlagCounter) String() string { func (*PatternFlowGtpv1SFlagCounter) ProtoMessage() {} func (x *PatternFlowGtpv1SFlagCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[753] + mi := &file_otg_proto_msgTypes[760] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -85937,7 +86602,7 @@ func (x *PatternFlowGtpv1SFlagCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1SFlagCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1SFlagCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{753} + return file_otg_proto_rawDescGZIP(), []int{760} } func (x *PatternFlowGtpv1SFlagCounter) GetStart() uint32 { @@ -85985,7 +86650,7 @@ type PatternFlowGtpv1SFlagMetricTag struct { func (x *PatternFlowGtpv1SFlagMetricTag) Reset() { *x = PatternFlowGtpv1SFlagMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[754] + mi := &file_otg_proto_msgTypes[761] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -85998,7 +86663,7 @@ func (x *PatternFlowGtpv1SFlagMetricTag) String() string { func (*PatternFlowGtpv1SFlagMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv1SFlagMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[754] + mi := &file_otg_proto_msgTypes[761] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -86011,7 +86676,7 @@ func (x *PatternFlowGtpv1SFlagMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1SFlagMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1SFlagMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{754} + return file_otg_proto_rawDescGZIP(), []int{761} } func (x *PatternFlowGtpv1SFlagMetricTag) GetName() string { @@ -86063,7 +86728,7 @@ type PatternFlowGtpv1SFlag struct { func (x *PatternFlowGtpv1SFlag) Reset() { *x = PatternFlowGtpv1SFlag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[755] + mi := &file_otg_proto_msgTypes[762] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -86076,7 +86741,7 @@ func (x *PatternFlowGtpv1SFlag) String() string { func (*PatternFlowGtpv1SFlag) ProtoMessage() {} func (x *PatternFlowGtpv1SFlag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[755] + mi := &file_otg_proto_msgTypes[762] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -86089,7 +86754,7 @@ func (x *PatternFlowGtpv1SFlag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1SFlag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1SFlag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{755} + return file_otg_proto_rawDescGZIP(), []int{762} } func (x *PatternFlowGtpv1SFlag) GetChoice() PatternFlowGtpv1SFlag_Choice_Enum { @@ -86154,7 +86819,7 @@ type PatternFlowGtpv1PnFlagCounter struct { func (x *PatternFlowGtpv1PnFlagCounter) Reset() { *x = PatternFlowGtpv1PnFlagCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[756] + mi := &file_otg_proto_msgTypes[763] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -86167,7 +86832,7 @@ func (x *PatternFlowGtpv1PnFlagCounter) String() string { func (*PatternFlowGtpv1PnFlagCounter) ProtoMessage() {} func (x *PatternFlowGtpv1PnFlagCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[756] + mi := &file_otg_proto_msgTypes[763] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -86180,7 +86845,7 @@ func (x *PatternFlowGtpv1PnFlagCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1PnFlagCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1PnFlagCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{756} + return file_otg_proto_rawDescGZIP(), []int{763} } func (x *PatternFlowGtpv1PnFlagCounter) GetStart() uint32 { @@ -86228,7 +86893,7 @@ type PatternFlowGtpv1PnFlagMetricTag struct { func (x *PatternFlowGtpv1PnFlagMetricTag) Reset() { *x = PatternFlowGtpv1PnFlagMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[757] + mi := &file_otg_proto_msgTypes[764] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -86241,7 +86906,7 @@ func (x *PatternFlowGtpv1PnFlagMetricTag) String() string { func (*PatternFlowGtpv1PnFlagMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv1PnFlagMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[757] + mi := &file_otg_proto_msgTypes[764] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -86254,7 +86919,7 @@ func (x *PatternFlowGtpv1PnFlagMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1PnFlagMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1PnFlagMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{757} + return file_otg_proto_rawDescGZIP(), []int{764} } func (x *PatternFlowGtpv1PnFlagMetricTag) GetName() string { @@ -86306,7 +86971,7 @@ type PatternFlowGtpv1PnFlag struct { func (x *PatternFlowGtpv1PnFlag) Reset() { *x = PatternFlowGtpv1PnFlag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[758] + mi := &file_otg_proto_msgTypes[765] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -86319,7 +86984,7 @@ func (x *PatternFlowGtpv1PnFlag) String() string { func (*PatternFlowGtpv1PnFlag) ProtoMessage() {} func (x *PatternFlowGtpv1PnFlag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[758] + mi := &file_otg_proto_msgTypes[765] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -86332,7 +86997,7 @@ func (x *PatternFlowGtpv1PnFlag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1PnFlag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1PnFlag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{758} + return file_otg_proto_rawDescGZIP(), []int{765} } func (x *PatternFlowGtpv1PnFlag) GetChoice() PatternFlowGtpv1PnFlag_Choice_Enum { @@ -86397,7 +87062,7 @@ type PatternFlowGtpv1MessageTypeCounter struct { func (x *PatternFlowGtpv1MessageTypeCounter) Reset() { *x = PatternFlowGtpv1MessageTypeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[759] + mi := &file_otg_proto_msgTypes[766] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -86410,7 +87075,7 @@ func (x *PatternFlowGtpv1MessageTypeCounter) String() string { func (*PatternFlowGtpv1MessageTypeCounter) ProtoMessage() {} func (x *PatternFlowGtpv1MessageTypeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[759] + mi := &file_otg_proto_msgTypes[766] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -86423,7 +87088,7 @@ func (x *PatternFlowGtpv1MessageTypeCounter) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowGtpv1MessageTypeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1MessageTypeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{759} + return file_otg_proto_rawDescGZIP(), []int{766} } func (x *PatternFlowGtpv1MessageTypeCounter) GetStart() uint32 { @@ -86471,7 +87136,7 @@ type PatternFlowGtpv1MessageTypeMetricTag struct { func (x *PatternFlowGtpv1MessageTypeMetricTag) Reset() { *x = PatternFlowGtpv1MessageTypeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[760] + mi := &file_otg_proto_msgTypes[767] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -86484,7 +87149,7 @@ func (x *PatternFlowGtpv1MessageTypeMetricTag) String() string { func (*PatternFlowGtpv1MessageTypeMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv1MessageTypeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[760] + mi := &file_otg_proto_msgTypes[767] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -86497,7 +87162,7 @@ func (x *PatternFlowGtpv1MessageTypeMetricTag) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowGtpv1MessageTypeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1MessageTypeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{760} + return file_otg_proto_rawDescGZIP(), []int{767} } func (x *PatternFlowGtpv1MessageTypeMetricTag) GetName() string { @@ -86550,7 +87215,7 @@ type PatternFlowGtpv1MessageType struct { func (x *PatternFlowGtpv1MessageType) Reset() { *x = PatternFlowGtpv1MessageType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[761] + mi := &file_otg_proto_msgTypes[768] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -86563,7 +87228,7 @@ func (x *PatternFlowGtpv1MessageType) String() string { func (*PatternFlowGtpv1MessageType) ProtoMessage() {} func (x *PatternFlowGtpv1MessageType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[761] + mi := &file_otg_proto_msgTypes[768] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -86576,7 +87241,7 @@ func (x *PatternFlowGtpv1MessageType) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1MessageType.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1MessageType) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{761} + return file_otg_proto_rawDescGZIP(), []int{768} } func (x *PatternFlowGtpv1MessageType) GetChoice() PatternFlowGtpv1MessageType_Choice_Enum { @@ -86641,7 +87306,7 @@ type PatternFlowGtpv1MessageLengthCounter struct { func (x *PatternFlowGtpv1MessageLengthCounter) Reset() { *x = PatternFlowGtpv1MessageLengthCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[762] + mi := &file_otg_proto_msgTypes[769] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -86654,7 +87319,7 @@ func (x *PatternFlowGtpv1MessageLengthCounter) String() string { func (*PatternFlowGtpv1MessageLengthCounter) ProtoMessage() {} func (x *PatternFlowGtpv1MessageLengthCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[762] + mi := &file_otg_proto_msgTypes[769] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -86667,7 +87332,7 @@ func (x *PatternFlowGtpv1MessageLengthCounter) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowGtpv1MessageLengthCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1MessageLengthCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{762} + return file_otg_proto_rawDescGZIP(), []int{769} } func (x *PatternFlowGtpv1MessageLengthCounter) GetStart() uint32 { @@ -86715,7 +87380,7 @@ type PatternFlowGtpv1MessageLengthMetricTag struct { func (x *PatternFlowGtpv1MessageLengthMetricTag) Reset() { *x = PatternFlowGtpv1MessageLengthMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[763] + mi := &file_otg_proto_msgTypes[770] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -86728,7 +87393,7 @@ func (x *PatternFlowGtpv1MessageLengthMetricTag) String() string { func (*PatternFlowGtpv1MessageLengthMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv1MessageLengthMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[763] + mi := &file_otg_proto_msgTypes[770] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -86741,7 +87406,7 @@ func (x *PatternFlowGtpv1MessageLengthMetricTag) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowGtpv1MessageLengthMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1MessageLengthMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{763} + return file_otg_proto_rawDescGZIP(), []int{770} } func (x *PatternFlowGtpv1MessageLengthMetricTag) GetName() string { @@ -86794,7 +87459,7 @@ type PatternFlowGtpv1MessageLength struct { func (x *PatternFlowGtpv1MessageLength) Reset() { *x = PatternFlowGtpv1MessageLength{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[764] + mi := &file_otg_proto_msgTypes[771] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -86807,7 +87472,7 @@ func (x *PatternFlowGtpv1MessageLength) String() string { func (*PatternFlowGtpv1MessageLength) ProtoMessage() {} func (x *PatternFlowGtpv1MessageLength) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[764] + mi := &file_otg_proto_msgTypes[771] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -86820,7 +87485,7 @@ func (x *PatternFlowGtpv1MessageLength) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1MessageLength.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1MessageLength) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{764} + return file_otg_proto_rawDescGZIP(), []int{771} } func (x *PatternFlowGtpv1MessageLength) GetChoice() PatternFlowGtpv1MessageLength_Choice_Enum { @@ -86885,7 +87550,7 @@ type PatternFlowGtpv1TeidCounter struct { func (x *PatternFlowGtpv1TeidCounter) Reset() { *x = PatternFlowGtpv1TeidCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[765] + mi := &file_otg_proto_msgTypes[772] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -86898,7 +87563,7 @@ func (x *PatternFlowGtpv1TeidCounter) String() string { func (*PatternFlowGtpv1TeidCounter) ProtoMessage() {} func (x *PatternFlowGtpv1TeidCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[765] + mi := &file_otg_proto_msgTypes[772] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -86911,7 +87576,7 @@ func (x *PatternFlowGtpv1TeidCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1TeidCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1TeidCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{765} + return file_otg_proto_rawDescGZIP(), []int{772} } func (x *PatternFlowGtpv1TeidCounter) GetStart() uint32 { @@ -86959,7 +87624,7 @@ type PatternFlowGtpv1TeidMetricTag struct { func (x *PatternFlowGtpv1TeidMetricTag) Reset() { *x = PatternFlowGtpv1TeidMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[766] + mi := &file_otg_proto_msgTypes[773] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -86972,7 +87637,7 @@ func (x *PatternFlowGtpv1TeidMetricTag) String() string { func (*PatternFlowGtpv1TeidMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv1TeidMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[766] + mi := &file_otg_proto_msgTypes[773] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -86985,7 +87650,7 @@ func (x *PatternFlowGtpv1TeidMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1TeidMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1TeidMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{766} + return file_otg_proto_rawDescGZIP(), []int{773} } func (x *PatternFlowGtpv1TeidMetricTag) GetName() string { @@ -87037,7 +87702,7 @@ type PatternFlowGtpv1Teid struct { func (x *PatternFlowGtpv1Teid) Reset() { *x = PatternFlowGtpv1Teid{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[767] + mi := &file_otg_proto_msgTypes[774] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -87050,7 +87715,7 @@ func (x *PatternFlowGtpv1Teid) String() string { func (*PatternFlowGtpv1Teid) ProtoMessage() {} func (x *PatternFlowGtpv1Teid) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[767] + mi := &file_otg_proto_msgTypes[774] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -87063,7 +87728,7 @@ func (x *PatternFlowGtpv1Teid) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1Teid.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1Teid) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{767} + return file_otg_proto_rawDescGZIP(), []int{774} } func (x *PatternFlowGtpv1Teid) GetChoice() PatternFlowGtpv1Teid_Choice_Enum { @@ -87128,7 +87793,7 @@ type PatternFlowGtpv1SquenceNumberCounter struct { func (x *PatternFlowGtpv1SquenceNumberCounter) Reset() { *x = PatternFlowGtpv1SquenceNumberCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[768] + mi := &file_otg_proto_msgTypes[775] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -87141,7 +87806,7 @@ func (x *PatternFlowGtpv1SquenceNumberCounter) String() string { func (*PatternFlowGtpv1SquenceNumberCounter) ProtoMessage() {} func (x *PatternFlowGtpv1SquenceNumberCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[768] + mi := &file_otg_proto_msgTypes[775] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -87154,7 +87819,7 @@ func (x *PatternFlowGtpv1SquenceNumberCounter) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowGtpv1SquenceNumberCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1SquenceNumberCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{768} + return file_otg_proto_rawDescGZIP(), []int{775} } func (x *PatternFlowGtpv1SquenceNumberCounter) GetStart() uint32 { @@ -87202,7 +87867,7 @@ type PatternFlowGtpv1SquenceNumberMetricTag struct { func (x *PatternFlowGtpv1SquenceNumberMetricTag) Reset() { *x = PatternFlowGtpv1SquenceNumberMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[769] + mi := &file_otg_proto_msgTypes[776] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -87215,7 +87880,7 @@ func (x *PatternFlowGtpv1SquenceNumberMetricTag) String() string { func (*PatternFlowGtpv1SquenceNumberMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv1SquenceNumberMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[769] + mi := &file_otg_proto_msgTypes[776] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -87228,7 +87893,7 @@ func (x *PatternFlowGtpv1SquenceNumberMetricTag) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowGtpv1SquenceNumberMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1SquenceNumberMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{769} + return file_otg_proto_rawDescGZIP(), []int{776} } func (x *PatternFlowGtpv1SquenceNumberMetricTag) GetName() string { @@ -87281,7 +87946,7 @@ type PatternFlowGtpv1SquenceNumber struct { func (x *PatternFlowGtpv1SquenceNumber) Reset() { *x = PatternFlowGtpv1SquenceNumber{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[770] + mi := &file_otg_proto_msgTypes[777] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -87294,7 +87959,7 @@ func (x *PatternFlowGtpv1SquenceNumber) String() string { func (*PatternFlowGtpv1SquenceNumber) ProtoMessage() {} func (x *PatternFlowGtpv1SquenceNumber) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[770] + mi := &file_otg_proto_msgTypes[777] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -87307,7 +87972,7 @@ func (x *PatternFlowGtpv1SquenceNumber) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1SquenceNumber.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1SquenceNumber) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{770} + return file_otg_proto_rawDescGZIP(), []int{777} } func (x *PatternFlowGtpv1SquenceNumber) GetChoice() PatternFlowGtpv1SquenceNumber_Choice_Enum { @@ -87372,7 +88037,7 @@ type PatternFlowGtpv1NPduNumberCounter struct { func (x *PatternFlowGtpv1NPduNumberCounter) Reset() { *x = PatternFlowGtpv1NPduNumberCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[771] + mi := &file_otg_proto_msgTypes[778] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -87385,7 +88050,7 @@ func (x *PatternFlowGtpv1NPduNumberCounter) String() string { func (*PatternFlowGtpv1NPduNumberCounter) ProtoMessage() {} func (x *PatternFlowGtpv1NPduNumberCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[771] + mi := &file_otg_proto_msgTypes[778] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -87398,7 +88063,7 @@ func (x *PatternFlowGtpv1NPduNumberCounter) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowGtpv1NPduNumberCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1NPduNumberCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{771} + return file_otg_proto_rawDescGZIP(), []int{778} } func (x *PatternFlowGtpv1NPduNumberCounter) GetStart() uint32 { @@ -87446,7 +88111,7 @@ type PatternFlowGtpv1NPduNumberMetricTag struct { func (x *PatternFlowGtpv1NPduNumberMetricTag) Reset() { *x = PatternFlowGtpv1NPduNumberMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[772] + mi := &file_otg_proto_msgTypes[779] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -87459,7 +88124,7 @@ func (x *PatternFlowGtpv1NPduNumberMetricTag) String() string { func (*PatternFlowGtpv1NPduNumberMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv1NPduNumberMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[772] + mi := &file_otg_proto_msgTypes[779] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -87472,7 +88137,7 @@ func (x *PatternFlowGtpv1NPduNumberMetricTag) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowGtpv1NPduNumberMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1NPduNumberMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{772} + return file_otg_proto_rawDescGZIP(), []int{779} } func (x *PatternFlowGtpv1NPduNumberMetricTag) GetName() string { @@ -87525,7 +88190,7 @@ type PatternFlowGtpv1NPduNumber struct { func (x *PatternFlowGtpv1NPduNumber) Reset() { *x = PatternFlowGtpv1NPduNumber{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[773] + mi := &file_otg_proto_msgTypes[780] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -87538,7 +88203,7 @@ func (x *PatternFlowGtpv1NPduNumber) String() string { func (*PatternFlowGtpv1NPduNumber) ProtoMessage() {} func (x *PatternFlowGtpv1NPduNumber) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[773] + mi := &file_otg_proto_msgTypes[780] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -87551,7 +88216,7 @@ func (x *PatternFlowGtpv1NPduNumber) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1NPduNumber.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1NPduNumber) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{773} + return file_otg_proto_rawDescGZIP(), []int{780} } func (x *PatternFlowGtpv1NPduNumber) GetChoice() PatternFlowGtpv1NPduNumber_Choice_Enum { @@ -87616,7 +88281,7 @@ type PatternFlowGtpv1NextExtensionHeaderTypeCounter struct { func (x *PatternFlowGtpv1NextExtensionHeaderTypeCounter) Reset() { *x = PatternFlowGtpv1NextExtensionHeaderTypeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[774] + mi := &file_otg_proto_msgTypes[781] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -87629,7 +88294,7 @@ func (x *PatternFlowGtpv1NextExtensionHeaderTypeCounter) String() string { func (*PatternFlowGtpv1NextExtensionHeaderTypeCounter) ProtoMessage() {} func (x *PatternFlowGtpv1NextExtensionHeaderTypeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[774] + mi := &file_otg_proto_msgTypes[781] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -87642,7 +88307,7 @@ func (x *PatternFlowGtpv1NextExtensionHeaderTypeCounter) ProtoReflect() protoref // Deprecated: Use PatternFlowGtpv1NextExtensionHeaderTypeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1NextExtensionHeaderTypeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{774} + return file_otg_proto_rawDescGZIP(), []int{781} } func (x *PatternFlowGtpv1NextExtensionHeaderTypeCounter) GetStart() uint32 { @@ -87690,7 +88355,7 @@ type PatternFlowGtpv1NextExtensionHeaderTypeMetricTag struct { func (x *PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) Reset() { *x = PatternFlowGtpv1NextExtensionHeaderTypeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[775] + mi := &file_otg_proto_msgTypes[782] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -87703,7 +88368,7 @@ func (x *PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) String() string { func (*PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[775] + mi := &file_otg_proto_msgTypes[782] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -87716,7 +88381,7 @@ func (x *PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) ProtoReflect() protor // Deprecated: Use PatternFlowGtpv1NextExtensionHeaderTypeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{775} + return file_otg_proto_rawDescGZIP(), []int{782} } func (x *PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) GetName() string { @@ -87769,7 +88434,7 @@ type PatternFlowGtpv1NextExtensionHeaderType struct { func (x *PatternFlowGtpv1NextExtensionHeaderType) Reset() { *x = PatternFlowGtpv1NextExtensionHeaderType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[776] + mi := &file_otg_proto_msgTypes[783] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -87782,7 +88447,7 @@ func (x *PatternFlowGtpv1NextExtensionHeaderType) String() string { func (*PatternFlowGtpv1NextExtensionHeaderType) ProtoMessage() {} func (x *PatternFlowGtpv1NextExtensionHeaderType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[776] + mi := &file_otg_proto_msgTypes[783] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -87795,7 +88460,7 @@ func (x *PatternFlowGtpv1NextExtensionHeaderType) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowGtpv1NextExtensionHeaderType.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1NextExtensionHeaderType) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{776} + return file_otg_proto_rawDescGZIP(), []int{783} } func (x *PatternFlowGtpv1NextExtensionHeaderType) GetChoice() PatternFlowGtpv1NextExtensionHeaderType_Choice_Enum { @@ -87860,7 +88525,7 @@ type PatternFlowGtpExtensionExtensionLengthCounter struct { func (x *PatternFlowGtpExtensionExtensionLengthCounter) Reset() { *x = PatternFlowGtpExtensionExtensionLengthCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[777] + mi := &file_otg_proto_msgTypes[784] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -87873,7 +88538,7 @@ func (x *PatternFlowGtpExtensionExtensionLengthCounter) String() string { func (*PatternFlowGtpExtensionExtensionLengthCounter) ProtoMessage() {} func (x *PatternFlowGtpExtensionExtensionLengthCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[777] + mi := &file_otg_proto_msgTypes[784] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -87886,7 +88551,7 @@ func (x *PatternFlowGtpExtensionExtensionLengthCounter) ProtoReflect() protorefl // Deprecated: Use PatternFlowGtpExtensionExtensionLengthCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpExtensionExtensionLengthCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{777} + return file_otg_proto_rawDescGZIP(), []int{784} } func (x *PatternFlowGtpExtensionExtensionLengthCounter) GetStart() uint32 { @@ -87934,7 +88599,7 @@ type PatternFlowGtpExtensionExtensionLengthMetricTag struct { func (x *PatternFlowGtpExtensionExtensionLengthMetricTag) Reset() { *x = PatternFlowGtpExtensionExtensionLengthMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[778] + mi := &file_otg_proto_msgTypes[785] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -87947,7 +88612,7 @@ func (x *PatternFlowGtpExtensionExtensionLengthMetricTag) String() string { func (*PatternFlowGtpExtensionExtensionLengthMetricTag) ProtoMessage() {} func (x *PatternFlowGtpExtensionExtensionLengthMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[778] + mi := &file_otg_proto_msgTypes[785] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -87960,7 +88625,7 @@ func (x *PatternFlowGtpExtensionExtensionLengthMetricTag) ProtoReflect() protore // Deprecated: Use PatternFlowGtpExtensionExtensionLengthMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpExtensionExtensionLengthMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{778} + return file_otg_proto_rawDescGZIP(), []int{785} } func (x *PatternFlowGtpExtensionExtensionLengthMetricTag) GetName() string { @@ -88014,7 +88679,7 @@ type PatternFlowGtpExtensionExtensionLength struct { func (x *PatternFlowGtpExtensionExtensionLength) Reset() { *x = PatternFlowGtpExtensionExtensionLength{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[779] + mi := &file_otg_proto_msgTypes[786] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -88027,7 +88692,7 @@ func (x *PatternFlowGtpExtensionExtensionLength) String() string { func (*PatternFlowGtpExtensionExtensionLength) ProtoMessage() {} func (x *PatternFlowGtpExtensionExtensionLength) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[779] + mi := &file_otg_proto_msgTypes[786] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -88040,7 +88705,7 @@ func (x *PatternFlowGtpExtensionExtensionLength) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowGtpExtensionExtensionLength.ProtoReflect.Descriptor instead. func (*PatternFlowGtpExtensionExtensionLength) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{779} + return file_otg_proto_rawDescGZIP(), []int{786} } func (x *PatternFlowGtpExtensionExtensionLength) GetChoice() PatternFlowGtpExtensionExtensionLength_Choice_Enum { @@ -88105,7 +88770,7 @@ type PatternFlowGtpExtensionContentsCounter struct { func (x *PatternFlowGtpExtensionContentsCounter) Reset() { *x = PatternFlowGtpExtensionContentsCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[780] + mi := &file_otg_proto_msgTypes[787] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -88118,7 +88783,7 @@ func (x *PatternFlowGtpExtensionContentsCounter) String() string { func (*PatternFlowGtpExtensionContentsCounter) ProtoMessage() {} func (x *PatternFlowGtpExtensionContentsCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[780] + mi := &file_otg_proto_msgTypes[787] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -88131,7 +88796,7 @@ func (x *PatternFlowGtpExtensionContentsCounter) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowGtpExtensionContentsCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpExtensionContentsCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{780} + return file_otg_proto_rawDescGZIP(), []int{787} } func (x *PatternFlowGtpExtensionContentsCounter) GetStart() uint64 { @@ -88179,7 +88844,7 @@ type PatternFlowGtpExtensionContentsMetricTag struct { func (x *PatternFlowGtpExtensionContentsMetricTag) Reset() { *x = PatternFlowGtpExtensionContentsMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[781] + mi := &file_otg_proto_msgTypes[788] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -88192,7 +88857,7 @@ func (x *PatternFlowGtpExtensionContentsMetricTag) String() string { func (*PatternFlowGtpExtensionContentsMetricTag) ProtoMessage() {} func (x *PatternFlowGtpExtensionContentsMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[781] + mi := &file_otg_proto_msgTypes[788] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -88205,7 +88870,7 @@ func (x *PatternFlowGtpExtensionContentsMetricTag) ProtoReflect() protoreflect.M // Deprecated: Use PatternFlowGtpExtensionContentsMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpExtensionContentsMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{781} + return file_otg_proto_rawDescGZIP(), []int{788} } func (x *PatternFlowGtpExtensionContentsMetricTag) GetName() string { @@ -88257,7 +88922,7 @@ type PatternFlowGtpExtensionContents struct { func (x *PatternFlowGtpExtensionContents) Reset() { *x = PatternFlowGtpExtensionContents{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[782] + mi := &file_otg_proto_msgTypes[789] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -88270,7 +88935,7 @@ func (x *PatternFlowGtpExtensionContents) String() string { func (*PatternFlowGtpExtensionContents) ProtoMessage() {} func (x *PatternFlowGtpExtensionContents) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[782] + mi := &file_otg_proto_msgTypes[789] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -88283,7 +88948,7 @@ func (x *PatternFlowGtpExtensionContents) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpExtensionContents.ProtoReflect.Descriptor instead. func (*PatternFlowGtpExtensionContents) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{782} + return file_otg_proto_rawDescGZIP(), []int{789} } func (x *PatternFlowGtpExtensionContents) GetChoice() PatternFlowGtpExtensionContents_Choice_Enum { @@ -88348,7 +89013,7 @@ type PatternFlowGtpExtensionNextExtensionHeaderCounter struct { func (x *PatternFlowGtpExtensionNextExtensionHeaderCounter) Reset() { *x = PatternFlowGtpExtensionNextExtensionHeaderCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[783] + mi := &file_otg_proto_msgTypes[790] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -88361,7 +89026,7 @@ func (x *PatternFlowGtpExtensionNextExtensionHeaderCounter) String() string { func (*PatternFlowGtpExtensionNextExtensionHeaderCounter) ProtoMessage() {} func (x *PatternFlowGtpExtensionNextExtensionHeaderCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[783] + mi := &file_otg_proto_msgTypes[790] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -88374,7 +89039,7 @@ func (x *PatternFlowGtpExtensionNextExtensionHeaderCounter) ProtoReflect() proto // Deprecated: Use PatternFlowGtpExtensionNextExtensionHeaderCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpExtensionNextExtensionHeaderCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{783} + return file_otg_proto_rawDescGZIP(), []int{790} } func (x *PatternFlowGtpExtensionNextExtensionHeaderCounter) GetStart() uint32 { @@ -88422,7 +89087,7 @@ type PatternFlowGtpExtensionNextExtensionHeaderMetricTag struct { func (x *PatternFlowGtpExtensionNextExtensionHeaderMetricTag) Reset() { *x = PatternFlowGtpExtensionNextExtensionHeaderMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[784] + mi := &file_otg_proto_msgTypes[791] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -88435,7 +89100,7 @@ func (x *PatternFlowGtpExtensionNextExtensionHeaderMetricTag) String() string { func (*PatternFlowGtpExtensionNextExtensionHeaderMetricTag) ProtoMessage() {} func (x *PatternFlowGtpExtensionNextExtensionHeaderMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[784] + mi := &file_otg_proto_msgTypes[791] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -88448,7 +89113,7 @@ func (x *PatternFlowGtpExtensionNextExtensionHeaderMetricTag) ProtoReflect() pro // Deprecated: Use PatternFlowGtpExtensionNextExtensionHeaderMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpExtensionNextExtensionHeaderMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{784} + return file_otg_proto_rawDescGZIP(), []int{791} } func (x *PatternFlowGtpExtensionNextExtensionHeaderMetricTag) GetName() string { @@ -88501,7 +89166,7 @@ type PatternFlowGtpExtensionNextExtensionHeader struct { func (x *PatternFlowGtpExtensionNextExtensionHeader) Reset() { *x = PatternFlowGtpExtensionNextExtensionHeader{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[785] + mi := &file_otg_proto_msgTypes[792] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -88514,7 +89179,7 @@ func (x *PatternFlowGtpExtensionNextExtensionHeader) String() string { func (*PatternFlowGtpExtensionNextExtensionHeader) ProtoMessage() {} func (x *PatternFlowGtpExtensionNextExtensionHeader) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[785] + mi := &file_otg_proto_msgTypes[792] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -88527,7 +89192,7 @@ func (x *PatternFlowGtpExtensionNextExtensionHeader) ProtoReflect() protoreflect // Deprecated: Use PatternFlowGtpExtensionNextExtensionHeader.ProtoReflect.Descriptor instead. func (*PatternFlowGtpExtensionNextExtensionHeader) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{785} + return file_otg_proto_rawDescGZIP(), []int{792} } func (x *PatternFlowGtpExtensionNextExtensionHeader) GetChoice() PatternFlowGtpExtensionNextExtensionHeader_Choice_Enum { @@ -88592,7 +89257,7 @@ type PatternFlowGtpv2VersionCounter struct { func (x *PatternFlowGtpv2VersionCounter) Reset() { *x = PatternFlowGtpv2VersionCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[786] + mi := &file_otg_proto_msgTypes[793] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -88605,7 +89270,7 @@ func (x *PatternFlowGtpv2VersionCounter) String() string { func (*PatternFlowGtpv2VersionCounter) ProtoMessage() {} func (x *PatternFlowGtpv2VersionCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[786] + mi := &file_otg_proto_msgTypes[793] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -88618,7 +89283,7 @@ func (x *PatternFlowGtpv2VersionCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2VersionCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2VersionCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{786} + return file_otg_proto_rawDescGZIP(), []int{793} } func (x *PatternFlowGtpv2VersionCounter) GetStart() uint32 { @@ -88666,7 +89331,7 @@ type PatternFlowGtpv2VersionMetricTag struct { func (x *PatternFlowGtpv2VersionMetricTag) Reset() { *x = PatternFlowGtpv2VersionMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[787] + mi := &file_otg_proto_msgTypes[794] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -88679,7 +89344,7 @@ func (x *PatternFlowGtpv2VersionMetricTag) String() string { func (*PatternFlowGtpv2VersionMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv2VersionMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[787] + mi := &file_otg_proto_msgTypes[794] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -88692,7 +89357,7 @@ func (x *PatternFlowGtpv2VersionMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2VersionMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2VersionMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{787} + return file_otg_proto_rawDescGZIP(), []int{794} } func (x *PatternFlowGtpv2VersionMetricTag) GetName() string { @@ -88744,7 +89409,7 @@ type PatternFlowGtpv2Version struct { func (x *PatternFlowGtpv2Version) Reset() { *x = PatternFlowGtpv2Version{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[788] + mi := &file_otg_proto_msgTypes[795] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -88757,7 +89422,7 @@ func (x *PatternFlowGtpv2Version) String() string { func (*PatternFlowGtpv2Version) ProtoMessage() {} func (x *PatternFlowGtpv2Version) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[788] + mi := &file_otg_proto_msgTypes[795] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -88770,7 +89435,7 @@ func (x *PatternFlowGtpv2Version) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2Version.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2Version) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{788} + return file_otg_proto_rawDescGZIP(), []int{795} } func (x *PatternFlowGtpv2Version) GetChoice() PatternFlowGtpv2Version_Choice_Enum { @@ -88835,7 +89500,7 @@ type PatternFlowGtpv2PiggybackingFlagCounter struct { func (x *PatternFlowGtpv2PiggybackingFlagCounter) Reset() { *x = PatternFlowGtpv2PiggybackingFlagCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[789] + mi := &file_otg_proto_msgTypes[796] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -88848,7 +89513,7 @@ func (x *PatternFlowGtpv2PiggybackingFlagCounter) String() string { func (*PatternFlowGtpv2PiggybackingFlagCounter) ProtoMessage() {} func (x *PatternFlowGtpv2PiggybackingFlagCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[789] + mi := &file_otg_proto_msgTypes[796] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -88861,7 +89526,7 @@ func (x *PatternFlowGtpv2PiggybackingFlagCounter) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowGtpv2PiggybackingFlagCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2PiggybackingFlagCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{789} + return file_otg_proto_rawDescGZIP(), []int{796} } func (x *PatternFlowGtpv2PiggybackingFlagCounter) GetStart() uint32 { @@ -88909,7 +89574,7 @@ type PatternFlowGtpv2PiggybackingFlagMetricTag struct { func (x *PatternFlowGtpv2PiggybackingFlagMetricTag) Reset() { *x = PatternFlowGtpv2PiggybackingFlagMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[790] + mi := &file_otg_proto_msgTypes[797] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -88922,7 +89587,7 @@ func (x *PatternFlowGtpv2PiggybackingFlagMetricTag) String() string { func (*PatternFlowGtpv2PiggybackingFlagMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv2PiggybackingFlagMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[790] + mi := &file_otg_proto_msgTypes[797] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -88935,7 +89600,7 @@ func (x *PatternFlowGtpv2PiggybackingFlagMetricTag) ProtoReflect() protoreflect. // Deprecated: Use PatternFlowGtpv2PiggybackingFlagMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2PiggybackingFlagMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{790} + return file_otg_proto_rawDescGZIP(), []int{797} } func (x *PatternFlowGtpv2PiggybackingFlagMetricTag) GetName() string { @@ -88988,7 +89653,7 @@ type PatternFlowGtpv2PiggybackingFlag struct { func (x *PatternFlowGtpv2PiggybackingFlag) Reset() { *x = PatternFlowGtpv2PiggybackingFlag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[791] + mi := &file_otg_proto_msgTypes[798] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -89001,7 +89666,7 @@ func (x *PatternFlowGtpv2PiggybackingFlag) String() string { func (*PatternFlowGtpv2PiggybackingFlag) ProtoMessage() {} func (x *PatternFlowGtpv2PiggybackingFlag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[791] + mi := &file_otg_proto_msgTypes[798] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -89014,7 +89679,7 @@ func (x *PatternFlowGtpv2PiggybackingFlag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2PiggybackingFlag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2PiggybackingFlag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{791} + return file_otg_proto_rawDescGZIP(), []int{798} } func (x *PatternFlowGtpv2PiggybackingFlag) GetChoice() PatternFlowGtpv2PiggybackingFlag_Choice_Enum { @@ -89079,7 +89744,7 @@ type PatternFlowGtpv2TeidFlagCounter struct { func (x *PatternFlowGtpv2TeidFlagCounter) Reset() { *x = PatternFlowGtpv2TeidFlagCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[792] + mi := &file_otg_proto_msgTypes[799] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -89092,7 +89757,7 @@ func (x *PatternFlowGtpv2TeidFlagCounter) String() string { func (*PatternFlowGtpv2TeidFlagCounter) ProtoMessage() {} func (x *PatternFlowGtpv2TeidFlagCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[792] + mi := &file_otg_proto_msgTypes[799] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -89105,7 +89770,7 @@ func (x *PatternFlowGtpv2TeidFlagCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2TeidFlagCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2TeidFlagCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{792} + return file_otg_proto_rawDescGZIP(), []int{799} } func (x *PatternFlowGtpv2TeidFlagCounter) GetStart() uint32 { @@ -89153,7 +89818,7 @@ type PatternFlowGtpv2TeidFlagMetricTag struct { func (x *PatternFlowGtpv2TeidFlagMetricTag) Reset() { *x = PatternFlowGtpv2TeidFlagMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[793] + mi := &file_otg_proto_msgTypes[800] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -89166,7 +89831,7 @@ func (x *PatternFlowGtpv2TeidFlagMetricTag) String() string { func (*PatternFlowGtpv2TeidFlagMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv2TeidFlagMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[793] + mi := &file_otg_proto_msgTypes[800] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -89179,7 +89844,7 @@ func (x *PatternFlowGtpv2TeidFlagMetricTag) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowGtpv2TeidFlagMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2TeidFlagMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{793} + return file_otg_proto_rawDescGZIP(), []int{800} } func (x *PatternFlowGtpv2TeidFlagMetricTag) GetName() string { @@ -89233,7 +89898,7 @@ type PatternFlowGtpv2TeidFlag struct { func (x *PatternFlowGtpv2TeidFlag) Reset() { *x = PatternFlowGtpv2TeidFlag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[794] + mi := &file_otg_proto_msgTypes[801] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -89246,7 +89911,7 @@ func (x *PatternFlowGtpv2TeidFlag) String() string { func (*PatternFlowGtpv2TeidFlag) ProtoMessage() {} func (x *PatternFlowGtpv2TeidFlag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[794] + mi := &file_otg_proto_msgTypes[801] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -89259,7 +89924,7 @@ func (x *PatternFlowGtpv2TeidFlag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2TeidFlag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2TeidFlag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{794} + return file_otg_proto_rawDescGZIP(), []int{801} } func (x *PatternFlowGtpv2TeidFlag) GetChoice() PatternFlowGtpv2TeidFlag_Choice_Enum { @@ -89324,7 +89989,7 @@ type PatternFlowGtpv2Spare1Counter struct { func (x *PatternFlowGtpv2Spare1Counter) Reset() { *x = PatternFlowGtpv2Spare1Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[795] + mi := &file_otg_proto_msgTypes[802] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -89337,7 +90002,7 @@ func (x *PatternFlowGtpv2Spare1Counter) String() string { func (*PatternFlowGtpv2Spare1Counter) ProtoMessage() {} func (x *PatternFlowGtpv2Spare1Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[795] + mi := &file_otg_proto_msgTypes[802] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -89350,7 +90015,7 @@ func (x *PatternFlowGtpv2Spare1Counter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2Spare1Counter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2Spare1Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{795} + return file_otg_proto_rawDescGZIP(), []int{802} } func (x *PatternFlowGtpv2Spare1Counter) GetStart() uint32 { @@ -89398,7 +90063,7 @@ type PatternFlowGtpv2Spare1MetricTag struct { func (x *PatternFlowGtpv2Spare1MetricTag) Reset() { *x = PatternFlowGtpv2Spare1MetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[796] + mi := &file_otg_proto_msgTypes[803] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -89411,7 +90076,7 @@ func (x *PatternFlowGtpv2Spare1MetricTag) String() string { func (*PatternFlowGtpv2Spare1MetricTag) ProtoMessage() {} func (x *PatternFlowGtpv2Spare1MetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[796] + mi := &file_otg_proto_msgTypes[803] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -89424,7 +90089,7 @@ func (x *PatternFlowGtpv2Spare1MetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2Spare1MetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2Spare1MetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{796} + return file_otg_proto_rawDescGZIP(), []int{803} } func (x *PatternFlowGtpv2Spare1MetricTag) GetName() string { @@ -89476,7 +90141,7 @@ type PatternFlowGtpv2Spare1 struct { func (x *PatternFlowGtpv2Spare1) Reset() { *x = PatternFlowGtpv2Spare1{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[797] + mi := &file_otg_proto_msgTypes[804] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -89489,7 +90154,7 @@ func (x *PatternFlowGtpv2Spare1) String() string { func (*PatternFlowGtpv2Spare1) ProtoMessage() {} func (x *PatternFlowGtpv2Spare1) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[797] + mi := &file_otg_proto_msgTypes[804] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -89502,7 +90167,7 @@ func (x *PatternFlowGtpv2Spare1) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2Spare1.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2Spare1) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{797} + return file_otg_proto_rawDescGZIP(), []int{804} } func (x *PatternFlowGtpv2Spare1) GetChoice() PatternFlowGtpv2Spare1_Choice_Enum { @@ -89567,7 +90232,7 @@ type PatternFlowGtpv2MessageTypeCounter struct { func (x *PatternFlowGtpv2MessageTypeCounter) Reset() { *x = PatternFlowGtpv2MessageTypeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[798] + mi := &file_otg_proto_msgTypes[805] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -89580,7 +90245,7 @@ func (x *PatternFlowGtpv2MessageTypeCounter) String() string { func (*PatternFlowGtpv2MessageTypeCounter) ProtoMessage() {} func (x *PatternFlowGtpv2MessageTypeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[798] + mi := &file_otg_proto_msgTypes[805] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -89593,7 +90258,7 @@ func (x *PatternFlowGtpv2MessageTypeCounter) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowGtpv2MessageTypeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2MessageTypeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{798} + return file_otg_proto_rawDescGZIP(), []int{805} } func (x *PatternFlowGtpv2MessageTypeCounter) GetStart() uint32 { @@ -89641,7 +90306,7 @@ type PatternFlowGtpv2MessageTypeMetricTag struct { func (x *PatternFlowGtpv2MessageTypeMetricTag) Reset() { *x = PatternFlowGtpv2MessageTypeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[799] + mi := &file_otg_proto_msgTypes[806] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -89654,7 +90319,7 @@ func (x *PatternFlowGtpv2MessageTypeMetricTag) String() string { func (*PatternFlowGtpv2MessageTypeMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv2MessageTypeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[799] + mi := &file_otg_proto_msgTypes[806] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -89667,7 +90332,7 @@ func (x *PatternFlowGtpv2MessageTypeMetricTag) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowGtpv2MessageTypeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2MessageTypeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{799} + return file_otg_proto_rawDescGZIP(), []int{806} } func (x *PatternFlowGtpv2MessageTypeMetricTag) GetName() string { @@ -89720,7 +90385,7 @@ type PatternFlowGtpv2MessageType struct { func (x *PatternFlowGtpv2MessageType) Reset() { *x = PatternFlowGtpv2MessageType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[800] + mi := &file_otg_proto_msgTypes[807] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -89733,7 +90398,7 @@ func (x *PatternFlowGtpv2MessageType) String() string { func (*PatternFlowGtpv2MessageType) ProtoMessage() {} func (x *PatternFlowGtpv2MessageType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[800] + mi := &file_otg_proto_msgTypes[807] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -89746,7 +90411,7 @@ func (x *PatternFlowGtpv2MessageType) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2MessageType.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2MessageType) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{800} + return file_otg_proto_rawDescGZIP(), []int{807} } func (x *PatternFlowGtpv2MessageType) GetChoice() PatternFlowGtpv2MessageType_Choice_Enum { @@ -89811,7 +90476,7 @@ type PatternFlowGtpv2MessageLengthCounter struct { func (x *PatternFlowGtpv2MessageLengthCounter) Reset() { *x = PatternFlowGtpv2MessageLengthCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[801] + mi := &file_otg_proto_msgTypes[808] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -89824,7 +90489,7 @@ func (x *PatternFlowGtpv2MessageLengthCounter) String() string { func (*PatternFlowGtpv2MessageLengthCounter) ProtoMessage() {} func (x *PatternFlowGtpv2MessageLengthCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[801] + mi := &file_otg_proto_msgTypes[808] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -89837,7 +90502,7 @@ func (x *PatternFlowGtpv2MessageLengthCounter) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowGtpv2MessageLengthCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2MessageLengthCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{801} + return file_otg_proto_rawDescGZIP(), []int{808} } func (x *PatternFlowGtpv2MessageLengthCounter) GetStart() uint32 { @@ -89885,7 +90550,7 @@ type PatternFlowGtpv2MessageLengthMetricTag struct { func (x *PatternFlowGtpv2MessageLengthMetricTag) Reset() { *x = PatternFlowGtpv2MessageLengthMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[802] + mi := &file_otg_proto_msgTypes[809] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -89898,7 +90563,7 @@ func (x *PatternFlowGtpv2MessageLengthMetricTag) String() string { func (*PatternFlowGtpv2MessageLengthMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv2MessageLengthMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[802] + mi := &file_otg_proto_msgTypes[809] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -89911,7 +90576,7 @@ func (x *PatternFlowGtpv2MessageLengthMetricTag) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowGtpv2MessageLengthMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2MessageLengthMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{802} + return file_otg_proto_rawDescGZIP(), []int{809} } func (x *PatternFlowGtpv2MessageLengthMetricTag) GetName() string { @@ -89964,7 +90629,7 @@ type PatternFlowGtpv2MessageLength struct { func (x *PatternFlowGtpv2MessageLength) Reset() { *x = PatternFlowGtpv2MessageLength{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[803] + mi := &file_otg_proto_msgTypes[810] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -89977,7 +90642,7 @@ func (x *PatternFlowGtpv2MessageLength) String() string { func (*PatternFlowGtpv2MessageLength) ProtoMessage() {} func (x *PatternFlowGtpv2MessageLength) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[803] + mi := &file_otg_proto_msgTypes[810] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -89990,7 +90655,7 @@ func (x *PatternFlowGtpv2MessageLength) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2MessageLength.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2MessageLength) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{803} + return file_otg_proto_rawDescGZIP(), []int{810} } func (x *PatternFlowGtpv2MessageLength) GetChoice() PatternFlowGtpv2MessageLength_Choice_Enum { @@ -90055,7 +90720,7 @@ type PatternFlowGtpv2TeidCounter struct { func (x *PatternFlowGtpv2TeidCounter) Reset() { *x = PatternFlowGtpv2TeidCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[804] + mi := &file_otg_proto_msgTypes[811] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -90068,7 +90733,7 @@ func (x *PatternFlowGtpv2TeidCounter) String() string { func (*PatternFlowGtpv2TeidCounter) ProtoMessage() {} func (x *PatternFlowGtpv2TeidCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[804] + mi := &file_otg_proto_msgTypes[811] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -90081,7 +90746,7 @@ func (x *PatternFlowGtpv2TeidCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2TeidCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2TeidCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{804} + return file_otg_proto_rawDescGZIP(), []int{811} } func (x *PatternFlowGtpv2TeidCounter) GetStart() uint32 { @@ -90129,7 +90794,7 @@ type PatternFlowGtpv2TeidMetricTag struct { func (x *PatternFlowGtpv2TeidMetricTag) Reset() { *x = PatternFlowGtpv2TeidMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[805] + mi := &file_otg_proto_msgTypes[812] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -90142,7 +90807,7 @@ func (x *PatternFlowGtpv2TeidMetricTag) String() string { func (*PatternFlowGtpv2TeidMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv2TeidMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[805] + mi := &file_otg_proto_msgTypes[812] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -90155,7 +90820,7 @@ func (x *PatternFlowGtpv2TeidMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2TeidMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2TeidMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{805} + return file_otg_proto_rawDescGZIP(), []int{812} } func (x *PatternFlowGtpv2TeidMetricTag) GetName() string { @@ -90208,7 +90873,7 @@ type PatternFlowGtpv2Teid struct { func (x *PatternFlowGtpv2Teid) Reset() { *x = PatternFlowGtpv2Teid{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[806] + mi := &file_otg_proto_msgTypes[813] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -90221,7 +90886,7 @@ func (x *PatternFlowGtpv2Teid) String() string { func (*PatternFlowGtpv2Teid) ProtoMessage() {} func (x *PatternFlowGtpv2Teid) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[806] + mi := &file_otg_proto_msgTypes[813] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -90234,7 +90899,7 @@ func (x *PatternFlowGtpv2Teid) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2Teid.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2Teid) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{806} + return file_otg_proto_rawDescGZIP(), []int{813} } func (x *PatternFlowGtpv2Teid) GetChoice() PatternFlowGtpv2Teid_Choice_Enum { @@ -90299,7 +90964,7 @@ type PatternFlowGtpv2SequenceNumberCounter struct { func (x *PatternFlowGtpv2SequenceNumberCounter) Reset() { *x = PatternFlowGtpv2SequenceNumberCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[807] + mi := &file_otg_proto_msgTypes[814] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -90312,7 +90977,7 @@ func (x *PatternFlowGtpv2SequenceNumberCounter) String() string { func (*PatternFlowGtpv2SequenceNumberCounter) ProtoMessage() {} func (x *PatternFlowGtpv2SequenceNumberCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[807] + mi := &file_otg_proto_msgTypes[814] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -90325,7 +90990,7 @@ func (x *PatternFlowGtpv2SequenceNumberCounter) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowGtpv2SequenceNumberCounter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2SequenceNumberCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{807} + return file_otg_proto_rawDescGZIP(), []int{814} } func (x *PatternFlowGtpv2SequenceNumberCounter) GetStart() uint32 { @@ -90373,7 +91038,7 @@ type PatternFlowGtpv2SequenceNumberMetricTag struct { func (x *PatternFlowGtpv2SequenceNumberMetricTag) Reset() { *x = PatternFlowGtpv2SequenceNumberMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[808] + mi := &file_otg_proto_msgTypes[815] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -90386,7 +91051,7 @@ func (x *PatternFlowGtpv2SequenceNumberMetricTag) String() string { func (*PatternFlowGtpv2SequenceNumberMetricTag) ProtoMessage() {} func (x *PatternFlowGtpv2SequenceNumberMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[808] + mi := &file_otg_proto_msgTypes[815] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -90399,7 +91064,7 @@ func (x *PatternFlowGtpv2SequenceNumberMetricTag) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowGtpv2SequenceNumberMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2SequenceNumberMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{808} + return file_otg_proto_rawDescGZIP(), []int{815} } func (x *PatternFlowGtpv2SequenceNumberMetricTag) GetName() string { @@ -90451,7 +91116,7 @@ type PatternFlowGtpv2SequenceNumber struct { func (x *PatternFlowGtpv2SequenceNumber) Reset() { *x = PatternFlowGtpv2SequenceNumber{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[809] + mi := &file_otg_proto_msgTypes[816] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -90464,7 +91129,7 @@ func (x *PatternFlowGtpv2SequenceNumber) String() string { func (*PatternFlowGtpv2SequenceNumber) ProtoMessage() {} func (x *PatternFlowGtpv2SequenceNumber) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[809] + mi := &file_otg_proto_msgTypes[816] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -90477,7 +91142,7 @@ func (x *PatternFlowGtpv2SequenceNumber) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2SequenceNumber.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2SequenceNumber) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{809} + return file_otg_proto_rawDescGZIP(), []int{816} } func (x *PatternFlowGtpv2SequenceNumber) GetChoice() PatternFlowGtpv2SequenceNumber_Choice_Enum { @@ -90542,7 +91207,7 @@ type PatternFlowGtpv2Spare2Counter struct { func (x *PatternFlowGtpv2Spare2Counter) Reset() { *x = PatternFlowGtpv2Spare2Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[810] + mi := &file_otg_proto_msgTypes[817] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -90555,7 +91220,7 @@ func (x *PatternFlowGtpv2Spare2Counter) String() string { func (*PatternFlowGtpv2Spare2Counter) ProtoMessage() {} func (x *PatternFlowGtpv2Spare2Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[810] + mi := &file_otg_proto_msgTypes[817] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -90568,7 +91233,7 @@ func (x *PatternFlowGtpv2Spare2Counter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2Spare2Counter.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2Spare2Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{810} + return file_otg_proto_rawDescGZIP(), []int{817} } func (x *PatternFlowGtpv2Spare2Counter) GetStart() uint32 { @@ -90616,7 +91281,7 @@ type PatternFlowGtpv2Spare2MetricTag struct { func (x *PatternFlowGtpv2Spare2MetricTag) Reset() { *x = PatternFlowGtpv2Spare2MetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[811] + mi := &file_otg_proto_msgTypes[818] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -90629,7 +91294,7 @@ func (x *PatternFlowGtpv2Spare2MetricTag) String() string { func (*PatternFlowGtpv2Spare2MetricTag) ProtoMessage() {} func (x *PatternFlowGtpv2Spare2MetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[811] + mi := &file_otg_proto_msgTypes[818] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -90642,7 +91307,7 @@ func (x *PatternFlowGtpv2Spare2MetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2Spare2MetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2Spare2MetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{811} + return file_otg_proto_rawDescGZIP(), []int{818} } func (x *PatternFlowGtpv2Spare2MetricTag) GetName() string { @@ -90694,7 +91359,7 @@ type PatternFlowGtpv2Spare2 struct { func (x *PatternFlowGtpv2Spare2) Reset() { *x = PatternFlowGtpv2Spare2{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[812] + mi := &file_otg_proto_msgTypes[819] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -90707,7 +91372,7 @@ func (x *PatternFlowGtpv2Spare2) String() string { func (*PatternFlowGtpv2Spare2) ProtoMessage() {} func (x *PatternFlowGtpv2Spare2) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[812] + mi := &file_otg_proto_msgTypes[819] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -90720,7 +91385,7 @@ func (x *PatternFlowGtpv2Spare2) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2Spare2.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2Spare2) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{812} + return file_otg_proto_rawDescGZIP(), []int{819} } func (x *PatternFlowGtpv2Spare2) GetChoice() PatternFlowGtpv2Spare2_Choice_Enum { @@ -90785,7 +91450,7 @@ type PatternFlowArpHardwareTypeCounter struct { func (x *PatternFlowArpHardwareTypeCounter) Reset() { *x = PatternFlowArpHardwareTypeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[813] + mi := &file_otg_proto_msgTypes[820] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -90798,7 +91463,7 @@ func (x *PatternFlowArpHardwareTypeCounter) String() string { func (*PatternFlowArpHardwareTypeCounter) ProtoMessage() {} func (x *PatternFlowArpHardwareTypeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[813] + mi := &file_otg_proto_msgTypes[820] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -90811,7 +91476,7 @@ func (x *PatternFlowArpHardwareTypeCounter) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowArpHardwareTypeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowArpHardwareTypeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{813} + return file_otg_proto_rawDescGZIP(), []int{820} } func (x *PatternFlowArpHardwareTypeCounter) GetStart() uint32 { @@ -90859,7 +91524,7 @@ type PatternFlowArpHardwareTypeMetricTag struct { func (x *PatternFlowArpHardwareTypeMetricTag) Reset() { *x = PatternFlowArpHardwareTypeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[814] + mi := &file_otg_proto_msgTypes[821] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -90872,7 +91537,7 @@ func (x *PatternFlowArpHardwareTypeMetricTag) String() string { func (*PatternFlowArpHardwareTypeMetricTag) ProtoMessage() {} func (x *PatternFlowArpHardwareTypeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[814] + mi := &file_otg_proto_msgTypes[821] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -90885,7 +91550,7 @@ func (x *PatternFlowArpHardwareTypeMetricTag) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowArpHardwareTypeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowArpHardwareTypeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{814} + return file_otg_proto_rawDescGZIP(), []int{821} } func (x *PatternFlowArpHardwareTypeMetricTag) GetName() string { @@ -90937,7 +91602,7 @@ type PatternFlowArpHardwareType struct { func (x *PatternFlowArpHardwareType) Reset() { *x = PatternFlowArpHardwareType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[815] + mi := &file_otg_proto_msgTypes[822] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -90950,7 +91615,7 @@ func (x *PatternFlowArpHardwareType) String() string { func (*PatternFlowArpHardwareType) ProtoMessage() {} func (x *PatternFlowArpHardwareType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[815] + mi := &file_otg_proto_msgTypes[822] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -90963,7 +91628,7 @@ func (x *PatternFlowArpHardwareType) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowArpHardwareType.ProtoReflect.Descriptor instead. func (*PatternFlowArpHardwareType) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{815} + return file_otg_proto_rawDescGZIP(), []int{822} } func (x *PatternFlowArpHardwareType) GetChoice() PatternFlowArpHardwareType_Choice_Enum { @@ -91028,7 +91693,7 @@ type PatternFlowArpProtocolTypeCounter struct { func (x *PatternFlowArpProtocolTypeCounter) Reset() { *x = PatternFlowArpProtocolTypeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[816] + mi := &file_otg_proto_msgTypes[823] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -91041,7 +91706,7 @@ func (x *PatternFlowArpProtocolTypeCounter) String() string { func (*PatternFlowArpProtocolTypeCounter) ProtoMessage() {} func (x *PatternFlowArpProtocolTypeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[816] + mi := &file_otg_proto_msgTypes[823] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -91054,7 +91719,7 @@ func (x *PatternFlowArpProtocolTypeCounter) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowArpProtocolTypeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowArpProtocolTypeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{816} + return file_otg_proto_rawDescGZIP(), []int{823} } func (x *PatternFlowArpProtocolTypeCounter) GetStart() uint32 { @@ -91102,7 +91767,7 @@ type PatternFlowArpProtocolTypeMetricTag struct { func (x *PatternFlowArpProtocolTypeMetricTag) Reset() { *x = PatternFlowArpProtocolTypeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[817] + mi := &file_otg_proto_msgTypes[824] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -91115,7 +91780,7 @@ func (x *PatternFlowArpProtocolTypeMetricTag) String() string { func (*PatternFlowArpProtocolTypeMetricTag) ProtoMessage() {} func (x *PatternFlowArpProtocolTypeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[817] + mi := &file_otg_proto_msgTypes[824] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -91128,7 +91793,7 @@ func (x *PatternFlowArpProtocolTypeMetricTag) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowArpProtocolTypeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowArpProtocolTypeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{817} + return file_otg_proto_rawDescGZIP(), []int{824} } func (x *PatternFlowArpProtocolTypeMetricTag) GetName() string { @@ -91180,7 +91845,7 @@ type PatternFlowArpProtocolType struct { func (x *PatternFlowArpProtocolType) Reset() { *x = PatternFlowArpProtocolType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[818] + mi := &file_otg_proto_msgTypes[825] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -91193,7 +91858,7 @@ func (x *PatternFlowArpProtocolType) String() string { func (*PatternFlowArpProtocolType) ProtoMessage() {} func (x *PatternFlowArpProtocolType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[818] + mi := &file_otg_proto_msgTypes[825] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -91206,7 +91871,7 @@ func (x *PatternFlowArpProtocolType) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowArpProtocolType.ProtoReflect.Descriptor instead. func (*PatternFlowArpProtocolType) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{818} + return file_otg_proto_rawDescGZIP(), []int{825} } func (x *PatternFlowArpProtocolType) GetChoice() PatternFlowArpProtocolType_Choice_Enum { @@ -91271,7 +91936,7 @@ type PatternFlowArpHardwareLengthCounter struct { func (x *PatternFlowArpHardwareLengthCounter) Reset() { *x = PatternFlowArpHardwareLengthCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[819] + mi := &file_otg_proto_msgTypes[826] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -91284,7 +91949,7 @@ func (x *PatternFlowArpHardwareLengthCounter) String() string { func (*PatternFlowArpHardwareLengthCounter) ProtoMessage() {} func (x *PatternFlowArpHardwareLengthCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[819] + mi := &file_otg_proto_msgTypes[826] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -91297,7 +91962,7 @@ func (x *PatternFlowArpHardwareLengthCounter) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowArpHardwareLengthCounter.ProtoReflect.Descriptor instead. func (*PatternFlowArpHardwareLengthCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{819} + return file_otg_proto_rawDescGZIP(), []int{826} } func (x *PatternFlowArpHardwareLengthCounter) GetStart() uint32 { @@ -91345,7 +92010,7 @@ type PatternFlowArpHardwareLengthMetricTag struct { func (x *PatternFlowArpHardwareLengthMetricTag) Reset() { *x = PatternFlowArpHardwareLengthMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[820] + mi := &file_otg_proto_msgTypes[827] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -91358,7 +92023,7 @@ func (x *PatternFlowArpHardwareLengthMetricTag) String() string { func (*PatternFlowArpHardwareLengthMetricTag) ProtoMessage() {} func (x *PatternFlowArpHardwareLengthMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[820] + mi := &file_otg_proto_msgTypes[827] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -91371,7 +92036,7 @@ func (x *PatternFlowArpHardwareLengthMetricTag) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowArpHardwareLengthMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowArpHardwareLengthMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{820} + return file_otg_proto_rawDescGZIP(), []int{827} } func (x *PatternFlowArpHardwareLengthMetricTag) GetName() string { @@ -91423,7 +92088,7 @@ type PatternFlowArpHardwareLength struct { func (x *PatternFlowArpHardwareLength) Reset() { *x = PatternFlowArpHardwareLength{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[821] + mi := &file_otg_proto_msgTypes[828] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -91436,7 +92101,7 @@ func (x *PatternFlowArpHardwareLength) String() string { func (*PatternFlowArpHardwareLength) ProtoMessage() {} func (x *PatternFlowArpHardwareLength) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[821] + mi := &file_otg_proto_msgTypes[828] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -91449,7 +92114,7 @@ func (x *PatternFlowArpHardwareLength) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowArpHardwareLength.ProtoReflect.Descriptor instead. func (*PatternFlowArpHardwareLength) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{821} + return file_otg_proto_rawDescGZIP(), []int{828} } func (x *PatternFlowArpHardwareLength) GetChoice() PatternFlowArpHardwareLength_Choice_Enum { @@ -91514,7 +92179,7 @@ type PatternFlowArpProtocolLengthCounter struct { func (x *PatternFlowArpProtocolLengthCounter) Reset() { *x = PatternFlowArpProtocolLengthCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[822] + mi := &file_otg_proto_msgTypes[829] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -91527,7 +92192,7 @@ func (x *PatternFlowArpProtocolLengthCounter) String() string { func (*PatternFlowArpProtocolLengthCounter) ProtoMessage() {} func (x *PatternFlowArpProtocolLengthCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[822] + mi := &file_otg_proto_msgTypes[829] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -91540,7 +92205,7 @@ func (x *PatternFlowArpProtocolLengthCounter) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowArpProtocolLengthCounter.ProtoReflect.Descriptor instead. func (*PatternFlowArpProtocolLengthCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{822} + return file_otg_proto_rawDescGZIP(), []int{829} } func (x *PatternFlowArpProtocolLengthCounter) GetStart() uint32 { @@ -91588,7 +92253,7 @@ type PatternFlowArpProtocolLengthMetricTag struct { func (x *PatternFlowArpProtocolLengthMetricTag) Reset() { *x = PatternFlowArpProtocolLengthMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[823] + mi := &file_otg_proto_msgTypes[830] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -91601,7 +92266,7 @@ func (x *PatternFlowArpProtocolLengthMetricTag) String() string { func (*PatternFlowArpProtocolLengthMetricTag) ProtoMessage() {} func (x *PatternFlowArpProtocolLengthMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[823] + mi := &file_otg_proto_msgTypes[830] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -91614,7 +92279,7 @@ func (x *PatternFlowArpProtocolLengthMetricTag) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowArpProtocolLengthMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowArpProtocolLengthMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{823} + return file_otg_proto_rawDescGZIP(), []int{830} } func (x *PatternFlowArpProtocolLengthMetricTag) GetName() string { @@ -91666,7 +92331,7 @@ type PatternFlowArpProtocolLength struct { func (x *PatternFlowArpProtocolLength) Reset() { *x = PatternFlowArpProtocolLength{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[824] + mi := &file_otg_proto_msgTypes[831] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -91679,7 +92344,7 @@ func (x *PatternFlowArpProtocolLength) String() string { func (*PatternFlowArpProtocolLength) ProtoMessage() {} func (x *PatternFlowArpProtocolLength) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[824] + mi := &file_otg_proto_msgTypes[831] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -91692,7 +92357,7 @@ func (x *PatternFlowArpProtocolLength) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowArpProtocolLength.ProtoReflect.Descriptor instead. func (*PatternFlowArpProtocolLength) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{824} + return file_otg_proto_rawDescGZIP(), []int{831} } func (x *PatternFlowArpProtocolLength) GetChoice() PatternFlowArpProtocolLength_Choice_Enum { @@ -91757,7 +92422,7 @@ type PatternFlowArpOperationCounter struct { func (x *PatternFlowArpOperationCounter) Reset() { *x = PatternFlowArpOperationCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[825] + mi := &file_otg_proto_msgTypes[832] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -91770,7 +92435,7 @@ func (x *PatternFlowArpOperationCounter) String() string { func (*PatternFlowArpOperationCounter) ProtoMessage() {} func (x *PatternFlowArpOperationCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[825] + mi := &file_otg_proto_msgTypes[832] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -91783,7 +92448,7 @@ func (x *PatternFlowArpOperationCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowArpOperationCounter.ProtoReflect.Descriptor instead. func (*PatternFlowArpOperationCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{825} + return file_otg_proto_rawDescGZIP(), []int{832} } func (x *PatternFlowArpOperationCounter) GetStart() uint32 { @@ -91831,7 +92496,7 @@ type PatternFlowArpOperationMetricTag struct { func (x *PatternFlowArpOperationMetricTag) Reset() { *x = PatternFlowArpOperationMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[826] + mi := &file_otg_proto_msgTypes[833] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -91844,7 +92509,7 @@ func (x *PatternFlowArpOperationMetricTag) String() string { func (*PatternFlowArpOperationMetricTag) ProtoMessage() {} func (x *PatternFlowArpOperationMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[826] + mi := &file_otg_proto_msgTypes[833] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -91857,7 +92522,7 @@ func (x *PatternFlowArpOperationMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowArpOperationMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowArpOperationMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{826} + return file_otg_proto_rawDescGZIP(), []int{833} } func (x *PatternFlowArpOperationMetricTag) GetName() string { @@ -91909,7 +92574,7 @@ type PatternFlowArpOperation struct { func (x *PatternFlowArpOperation) Reset() { *x = PatternFlowArpOperation{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[827] + mi := &file_otg_proto_msgTypes[834] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -91922,7 +92587,7 @@ func (x *PatternFlowArpOperation) String() string { func (*PatternFlowArpOperation) ProtoMessage() {} func (x *PatternFlowArpOperation) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[827] + mi := &file_otg_proto_msgTypes[834] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -91935,7 +92600,7 @@ func (x *PatternFlowArpOperation) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowArpOperation.ProtoReflect.Descriptor instead. func (*PatternFlowArpOperation) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{827} + return file_otg_proto_rawDescGZIP(), []int{834} } func (x *PatternFlowArpOperation) GetChoice() PatternFlowArpOperation_Choice_Enum { @@ -92000,7 +92665,7 @@ type PatternFlowArpSenderHardwareAddrCounter struct { func (x *PatternFlowArpSenderHardwareAddrCounter) Reset() { *x = PatternFlowArpSenderHardwareAddrCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[828] + mi := &file_otg_proto_msgTypes[835] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92013,7 +92678,7 @@ func (x *PatternFlowArpSenderHardwareAddrCounter) String() string { func (*PatternFlowArpSenderHardwareAddrCounter) ProtoMessage() {} func (x *PatternFlowArpSenderHardwareAddrCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[828] + mi := &file_otg_proto_msgTypes[835] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92026,7 +92691,7 @@ func (x *PatternFlowArpSenderHardwareAddrCounter) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowArpSenderHardwareAddrCounter.ProtoReflect.Descriptor instead. func (*PatternFlowArpSenderHardwareAddrCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{828} + return file_otg_proto_rawDescGZIP(), []int{835} } func (x *PatternFlowArpSenderHardwareAddrCounter) GetStart() string { @@ -92074,7 +92739,7 @@ type PatternFlowArpSenderHardwareAddrMetricTag struct { func (x *PatternFlowArpSenderHardwareAddrMetricTag) Reset() { *x = PatternFlowArpSenderHardwareAddrMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[829] + mi := &file_otg_proto_msgTypes[836] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92087,7 +92752,7 @@ func (x *PatternFlowArpSenderHardwareAddrMetricTag) String() string { func (*PatternFlowArpSenderHardwareAddrMetricTag) ProtoMessage() {} func (x *PatternFlowArpSenderHardwareAddrMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[829] + mi := &file_otg_proto_msgTypes[836] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92100,7 +92765,7 @@ func (x *PatternFlowArpSenderHardwareAddrMetricTag) ProtoReflect() protoreflect. // Deprecated: Use PatternFlowArpSenderHardwareAddrMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowArpSenderHardwareAddrMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{829} + return file_otg_proto_rawDescGZIP(), []int{836} } func (x *PatternFlowArpSenderHardwareAddrMetricTag) GetName() string { @@ -92152,7 +92817,7 @@ type PatternFlowArpSenderHardwareAddr struct { func (x *PatternFlowArpSenderHardwareAddr) Reset() { *x = PatternFlowArpSenderHardwareAddr{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[830] + mi := &file_otg_proto_msgTypes[837] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92165,7 +92830,7 @@ func (x *PatternFlowArpSenderHardwareAddr) String() string { func (*PatternFlowArpSenderHardwareAddr) ProtoMessage() {} func (x *PatternFlowArpSenderHardwareAddr) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[830] + mi := &file_otg_proto_msgTypes[837] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92178,7 +92843,7 @@ func (x *PatternFlowArpSenderHardwareAddr) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowArpSenderHardwareAddr.ProtoReflect.Descriptor instead. func (*PatternFlowArpSenderHardwareAddr) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{830} + return file_otg_proto_rawDescGZIP(), []int{837} } func (x *PatternFlowArpSenderHardwareAddr) GetChoice() PatternFlowArpSenderHardwareAddr_Choice_Enum { @@ -92243,7 +92908,7 @@ type PatternFlowArpSenderProtocolAddrCounter struct { func (x *PatternFlowArpSenderProtocolAddrCounter) Reset() { *x = PatternFlowArpSenderProtocolAddrCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[831] + mi := &file_otg_proto_msgTypes[838] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92256,7 +92921,7 @@ func (x *PatternFlowArpSenderProtocolAddrCounter) String() string { func (*PatternFlowArpSenderProtocolAddrCounter) ProtoMessage() {} func (x *PatternFlowArpSenderProtocolAddrCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[831] + mi := &file_otg_proto_msgTypes[838] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92269,7 +92934,7 @@ func (x *PatternFlowArpSenderProtocolAddrCounter) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowArpSenderProtocolAddrCounter.ProtoReflect.Descriptor instead. func (*PatternFlowArpSenderProtocolAddrCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{831} + return file_otg_proto_rawDescGZIP(), []int{838} } func (x *PatternFlowArpSenderProtocolAddrCounter) GetStart() string { @@ -92317,7 +92982,7 @@ type PatternFlowArpSenderProtocolAddrMetricTag struct { func (x *PatternFlowArpSenderProtocolAddrMetricTag) Reset() { *x = PatternFlowArpSenderProtocolAddrMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[832] + mi := &file_otg_proto_msgTypes[839] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92330,7 +92995,7 @@ func (x *PatternFlowArpSenderProtocolAddrMetricTag) String() string { func (*PatternFlowArpSenderProtocolAddrMetricTag) ProtoMessage() {} func (x *PatternFlowArpSenderProtocolAddrMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[832] + mi := &file_otg_proto_msgTypes[839] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92343,7 +93008,7 @@ func (x *PatternFlowArpSenderProtocolAddrMetricTag) ProtoReflect() protoreflect. // Deprecated: Use PatternFlowArpSenderProtocolAddrMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowArpSenderProtocolAddrMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{832} + return file_otg_proto_rawDescGZIP(), []int{839} } func (x *PatternFlowArpSenderProtocolAddrMetricTag) GetName() string { @@ -92395,7 +93060,7 @@ type PatternFlowArpSenderProtocolAddr struct { func (x *PatternFlowArpSenderProtocolAddr) Reset() { *x = PatternFlowArpSenderProtocolAddr{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[833] + mi := &file_otg_proto_msgTypes[840] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92408,7 +93073,7 @@ func (x *PatternFlowArpSenderProtocolAddr) String() string { func (*PatternFlowArpSenderProtocolAddr) ProtoMessage() {} func (x *PatternFlowArpSenderProtocolAddr) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[833] + mi := &file_otg_proto_msgTypes[840] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92421,7 +93086,7 @@ func (x *PatternFlowArpSenderProtocolAddr) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowArpSenderProtocolAddr.ProtoReflect.Descriptor instead. func (*PatternFlowArpSenderProtocolAddr) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{833} + return file_otg_proto_rawDescGZIP(), []int{840} } func (x *PatternFlowArpSenderProtocolAddr) GetChoice() PatternFlowArpSenderProtocolAddr_Choice_Enum { @@ -92486,7 +93151,7 @@ type PatternFlowArpTargetHardwareAddrCounter struct { func (x *PatternFlowArpTargetHardwareAddrCounter) Reset() { *x = PatternFlowArpTargetHardwareAddrCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[834] + mi := &file_otg_proto_msgTypes[841] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92499,7 +93164,7 @@ func (x *PatternFlowArpTargetHardwareAddrCounter) String() string { func (*PatternFlowArpTargetHardwareAddrCounter) ProtoMessage() {} func (x *PatternFlowArpTargetHardwareAddrCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[834] + mi := &file_otg_proto_msgTypes[841] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92512,7 +93177,7 @@ func (x *PatternFlowArpTargetHardwareAddrCounter) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowArpTargetHardwareAddrCounter.ProtoReflect.Descriptor instead. func (*PatternFlowArpTargetHardwareAddrCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{834} + return file_otg_proto_rawDescGZIP(), []int{841} } func (x *PatternFlowArpTargetHardwareAddrCounter) GetStart() string { @@ -92560,7 +93225,7 @@ type PatternFlowArpTargetHardwareAddrMetricTag struct { func (x *PatternFlowArpTargetHardwareAddrMetricTag) Reset() { *x = PatternFlowArpTargetHardwareAddrMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[835] + mi := &file_otg_proto_msgTypes[842] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92573,7 +93238,7 @@ func (x *PatternFlowArpTargetHardwareAddrMetricTag) String() string { func (*PatternFlowArpTargetHardwareAddrMetricTag) ProtoMessage() {} func (x *PatternFlowArpTargetHardwareAddrMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[835] + mi := &file_otg_proto_msgTypes[842] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92586,7 +93251,7 @@ func (x *PatternFlowArpTargetHardwareAddrMetricTag) ProtoReflect() protoreflect. // Deprecated: Use PatternFlowArpTargetHardwareAddrMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowArpTargetHardwareAddrMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{835} + return file_otg_proto_rawDescGZIP(), []int{842} } func (x *PatternFlowArpTargetHardwareAddrMetricTag) GetName() string { @@ -92638,7 +93303,7 @@ type PatternFlowArpTargetHardwareAddr struct { func (x *PatternFlowArpTargetHardwareAddr) Reset() { *x = PatternFlowArpTargetHardwareAddr{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[836] + mi := &file_otg_proto_msgTypes[843] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92651,7 +93316,7 @@ func (x *PatternFlowArpTargetHardwareAddr) String() string { func (*PatternFlowArpTargetHardwareAddr) ProtoMessage() {} func (x *PatternFlowArpTargetHardwareAddr) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[836] + mi := &file_otg_proto_msgTypes[843] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92664,7 +93329,7 @@ func (x *PatternFlowArpTargetHardwareAddr) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowArpTargetHardwareAddr.ProtoReflect.Descriptor instead. func (*PatternFlowArpTargetHardwareAddr) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{836} + return file_otg_proto_rawDescGZIP(), []int{843} } func (x *PatternFlowArpTargetHardwareAddr) GetChoice() PatternFlowArpTargetHardwareAddr_Choice_Enum { @@ -92729,7 +93394,7 @@ type PatternFlowArpTargetProtocolAddrCounter struct { func (x *PatternFlowArpTargetProtocolAddrCounter) Reset() { *x = PatternFlowArpTargetProtocolAddrCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[837] + mi := &file_otg_proto_msgTypes[844] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92742,7 +93407,7 @@ func (x *PatternFlowArpTargetProtocolAddrCounter) String() string { func (*PatternFlowArpTargetProtocolAddrCounter) ProtoMessage() {} func (x *PatternFlowArpTargetProtocolAddrCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[837] + mi := &file_otg_proto_msgTypes[844] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92755,7 +93420,7 @@ func (x *PatternFlowArpTargetProtocolAddrCounter) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowArpTargetProtocolAddrCounter.ProtoReflect.Descriptor instead. func (*PatternFlowArpTargetProtocolAddrCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{837} + return file_otg_proto_rawDescGZIP(), []int{844} } func (x *PatternFlowArpTargetProtocolAddrCounter) GetStart() string { @@ -92803,7 +93468,7 @@ type PatternFlowArpTargetProtocolAddrMetricTag struct { func (x *PatternFlowArpTargetProtocolAddrMetricTag) Reset() { *x = PatternFlowArpTargetProtocolAddrMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[838] + mi := &file_otg_proto_msgTypes[845] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92816,7 +93481,7 @@ func (x *PatternFlowArpTargetProtocolAddrMetricTag) String() string { func (*PatternFlowArpTargetProtocolAddrMetricTag) ProtoMessage() {} func (x *PatternFlowArpTargetProtocolAddrMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[838] + mi := &file_otg_proto_msgTypes[845] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92829,7 +93494,7 @@ func (x *PatternFlowArpTargetProtocolAddrMetricTag) ProtoReflect() protoreflect. // Deprecated: Use PatternFlowArpTargetProtocolAddrMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowArpTargetProtocolAddrMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{838} + return file_otg_proto_rawDescGZIP(), []int{845} } func (x *PatternFlowArpTargetProtocolAddrMetricTag) GetName() string { @@ -92881,7 +93546,7 @@ type PatternFlowArpTargetProtocolAddr struct { func (x *PatternFlowArpTargetProtocolAddr) Reset() { *x = PatternFlowArpTargetProtocolAddr{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[839] + mi := &file_otg_proto_msgTypes[846] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92894,7 +93559,7 @@ func (x *PatternFlowArpTargetProtocolAddr) String() string { func (*PatternFlowArpTargetProtocolAddr) ProtoMessage() {} func (x *PatternFlowArpTargetProtocolAddr) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[839] + mi := &file_otg_proto_msgTypes[846] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92907,7 +93572,7 @@ func (x *PatternFlowArpTargetProtocolAddr) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowArpTargetProtocolAddr.ProtoReflect.Descriptor instead. func (*PatternFlowArpTargetProtocolAddr) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{839} + return file_otg_proto_rawDescGZIP(), []int{846} } func (x *PatternFlowArpTargetProtocolAddr) GetChoice() PatternFlowArpTargetProtocolAddr_Choice_Enum { @@ -92972,7 +93637,7 @@ type PatternFlowIcmpEchoTypeCounter struct { func (x *PatternFlowIcmpEchoTypeCounter) Reset() { *x = PatternFlowIcmpEchoTypeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[840] + mi := &file_otg_proto_msgTypes[847] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -92985,7 +93650,7 @@ func (x *PatternFlowIcmpEchoTypeCounter) String() string { func (*PatternFlowIcmpEchoTypeCounter) ProtoMessage() {} func (x *PatternFlowIcmpEchoTypeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[840] + mi := &file_otg_proto_msgTypes[847] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -92998,7 +93663,7 @@ func (x *PatternFlowIcmpEchoTypeCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpEchoTypeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoTypeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{840} + return file_otg_proto_rawDescGZIP(), []int{847} } func (x *PatternFlowIcmpEchoTypeCounter) GetStart() uint32 { @@ -93046,7 +93711,7 @@ type PatternFlowIcmpEchoTypeMetricTag struct { func (x *PatternFlowIcmpEchoTypeMetricTag) Reset() { *x = PatternFlowIcmpEchoTypeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[841] + mi := &file_otg_proto_msgTypes[848] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93059,7 +93724,7 @@ func (x *PatternFlowIcmpEchoTypeMetricTag) String() string { func (*PatternFlowIcmpEchoTypeMetricTag) ProtoMessage() {} func (x *PatternFlowIcmpEchoTypeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[841] + mi := &file_otg_proto_msgTypes[848] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -93072,7 +93737,7 @@ func (x *PatternFlowIcmpEchoTypeMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpEchoTypeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoTypeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{841} + return file_otg_proto_rawDescGZIP(), []int{848} } func (x *PatternFlowIcmpEchoTypeMetricTag) GetName() string { @@ -93124,7 +93789,7 @@ type PatternFlowIcmpEchoType struct { func (x *PatternFlowIcmpEchoType) Reset() { *x = PatternFlowIcmpEchoType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[842] + mi := &file_otg_proto_msgTypes[849] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93137,7 +93802,7 @@ func (x *PatternFlowIcmpEchoType) String() string { func (*PatternFlowIcmpEchoType) ProtoMessage() {} func (x *PatternFlowIcmpEchoType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[842] + mi := &file_otg_proto_msgTypes[849] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -93150,7 +93815,7 @@ func (x *PatternFlowIcmpEchoType) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpEchoType.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoType) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{842} + return file_otg_proto_rawDescGZIP(), []int{849} } func (x *PatternFlowIcmpEchoType) GetChoice() PatternFlowIcmpEchoType_Choice_Enum { @@ -93215,7 +93880,7 @@ type PatternFlowIcmpEchoCodeCounter struct { func (x *PatternFlowIcmpEchoCodeCounter) Reset() { *x = PatternFlowIcmpEchoCodeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[843] + mi := &file_otg_proto_msgTypes[850] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93228,7 +93893,7 @@ func (x *PatternFlowIcmpEchoCodeCounter) String() string { func (*PatternFlowIcmpEchoCodeCounter) ProtoMessage() {} func (x *PatternFlowIcmpEchoCodeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[843] + mi := &file_otg_proto_msgTypes[850] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -93241,7 +93906,7 @@ func (x *PatternFlowIcmpEchoCodeCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpEchoCodeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoCodeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{843} + return file_otg_proto_rawDescGZIP(), []int{850} } func (x *PatternFlowIcmpEchoCodeCounter) GetStart() uint32 { @@ -93289,7 +93954,7 @@ type PatternFlowIcmpEchoCodeMetricTag struct { func (x *PatternFlowIcmpEchoCodeMetricTag) Reset() { *x = PatternFlowIcmpEchoCodeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[844] + mi := &file_otg_proto_msgTypes[851] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93302,7 +93967,7 @@ func (x *PatternFlowIcmpEchoCodeMetricTag) String() string { func (*PatternFlowIcmpEchoCodeMetricTag) ProtoMessage() {} func (x *PatternFlowIcmpEchoCodeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[844] + mi := &file_otg_proto_msgTypes[851] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -93315,7 +93980,7 @@ func (x *PatternFlowIcmpEchoCodeMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpEchoCodeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoCodeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{844} + return file_otg_proto_rawDescGZIP(), []int{851} } func (x *PatternFlowIcmpEchoCodeMetricTag) GetName() string { @@ -93367,7 +94032,7 @@ type PatternFlowIcmpEchoCode struct { func (x *PatternFlowIcmpEchoCode) Reset() { *x = PatternFlowIcmpEchoCode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[845] + mi := &file_otg_proto_msgTypes[852] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93380,7 +94045,7 @@ func (x *PatternFlowIcmpEchoCode) String() string { func (*PatternFlowIcmpEchoCode) ProtoMessage() {} func (x *PatternFlowIcmpEchoCode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[845] + mi := &file_otg_proto_msgTypes[852] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -93393,7 +94058,7 @@ func (x *PatternFlowIcmpEchoCode) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpEchoCode.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoCode) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{845} + return file_otg_proto_rawDescGZIP(), []int{852} } func (x *PatternFlowIcmpEchoCode) GetChoice() PatternFlowIcmpEchoCode_Choice_Enum { @@ -93457,7 +94122,7 @@ type PatternFlowIcmpEchoChecksum struct { func (x *PatternFlowIcmpEchoChecksum) Reset() { *x = PatternFlowIcmpEchoChecksum{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[846] + mi := &file_otg_proto_msgTypes[853] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93470,7 +94135,7 @@ func (x *PatternFlowIcmpEchoChecksum) String() string { func (*PatternFlowIcmpEchoChecksum) ProtoMessage() {} func (x *PatternFlowIcmpEchoChecksum) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[846] + mi := &file_otg_proto_msgTypes[853] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -93483,7 +94148,7 @@ func (x *PatternFlowIcmpEchoChecksum) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpEchoChecksum.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoChecksum) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{846} + return file_otg_proto_rawDescGZIP(), []int{853} } func (x *PatternFlowIcmpEchoChecksum) GetChoice() PatternFlowIcmpEchoChecksum_Choice_Enum { @@ -93527,7 +94192,7 @@ type PatternFlowIcmpEchoIdentifierCounter struct { func (x *PatternFlowIcmpEchoIdentifierCounter) Reset() { *x = PatternFlowIcmpEchoIdentifierCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[847] + mi := &file_otg_proto_msgTypes[854] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93540,7 +94205,7 @@ func (x *PatternFlowIcmpEchoIdentifierCounter) String() string { func (*PatternFlowIcmpEchoIdentifierCounter) ProtoMessage() {} func (x *PatternFlowIcmpEchoIdentifierCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[847] + mi := &file_otg_proto_msgTypes[854] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -93553,7 +94218,7 @@ func (x *PatternFlowIcmpEchoIdentifierCounter) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowIcmpEchoIdentifierCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoIdentifierCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{847} + return file_otg_proto_rawDescGZIP(), []int{854} } func (x *PatternFlowIcmpEchoIdentifierCounter) GetStart() uint32 { @@ -93601,7 +94266,7 @@ type PatternFlowIcmpEchoIdentifierMetricTag struct { func (x *PatternFlowIcmpEchoIdentifierMetricTag) Reset() { *x = PatternFlowIcmpEchoIdentifierMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[848] + mi := &file_otg_proto_msgTypes[855] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93614,7 +94279,7 @@ func (x *PatternFlowIcmpEchoIdentifierMetricTag) String() string { func (*PatternFlowIcmpEchoIdentifierMetricTag) ProtoMessage() {} func (x *PatternFlowIcmpEchoIdentifierMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[848] + mi := &file_otg_proto_msgTypes[855] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -93627,7 +94292,7 @@ func (x *PatternFlowIcmpEchoIdentifierMetricTag) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowIcmpEchoIdentifierMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoIdentifierMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{848} + return file_otg_proto_rawDescGZIP(), []int{855} } func (x *PatternFlowIcmpEchoIdentifierMetricTag) GetName() string { @@ -93679,7 +94344,7 @@ type PatternFlowIcmpEchoIdentifier struct { func (x *PatternFlowIcmpEchoIdentifier) Reset() { *x = PatternFlowIcmpEchoIdentifier{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[849] + mi := &file_otg_proto_msgTypes[856] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93692,7 +94357,7 @@ func (x *PatternFlowIcmpEchoIdentifier) String() string { func (*PatternFlowIcmpEchoIdentifier) ProtoMessage() {} func (x *PatternFlowIcmpEchoIdentifier) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[849] + mi := &file_otg_proto_msgTypes[856] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -93705,7 +94370,7 @@ func (x *PatternFlowIcmpEchoIdentifier) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpEchoIdentifier.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoIdentifier) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{849} + return file_otg_proto_rawDescGZIP(), []int{856} } func (x *PatternFlowIcmpEchoIdentifier) GetChoice() PatternFlowIcmpEchoIdentifier_Choice_Enum { @@ -93770,7 +94435,7 @@ type PatternFlowIcmpEchoSequenceNumberCounter struct { func (x *PatternFlowIcmpEchoSequenceNumberCounter) Reset() { *x = PatternFlowIcmpEchoSequenceNumberCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[850] + mi := &file_otg_proto_msgTypes[857] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93783,7 +94448,7 @@ func (x *PatternFlowIcmpEchoSequenceNumberCounter) String() string { func (*PatternFlowIcmpEchoSequenceNumberCounter) ProtoMessage() {} func (x *PatternFlowIcmpEchoSequenceNumberCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[850] + mi := &file_otg_proto_msgTypes[857] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -93796,7 +94461,7 @@ func (x *PatternFlowIcmpEchoSequenceNumberCounter) ProtoReflect() protoreflect.M // Deprecated: Use PatternFlowIcmpEchoSequenceNumberCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoSequenceNumberCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{850} + return file_otg_proto_rawDescGZIP(), []int{857} } func (x *PatternFlowIcmpEchoSequenceNumberCounter) GetStart() uint32 { @@ -93844,7 +94509,7 @@ type PatternFlowIcmpEchoSequenceNumberMetricTag struct { func (x *PatternFlowIcmpEchoSequenceNumberMetricTag) Reset() { *x = PatternFlowIcmpEchoSequenceNumberMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[851] + mi := &file_otg_proto_msgTypes[858] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93857,7 +94522,7 @@ func (x *PatternFlowIcmpEchoSequenceNumberMetricTag) String() string { func (*PatternFlowIcmpEchoSequenceNumberMetricTag) ProtoMessage() {} func (x *PatternFlowIcmpEchoSequenceNumberMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[851] + mi := &file_otg_proto_msgTypes[858] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -93870,7 +94535,7 @@ func (x *PatternFlowIcmpEchoSequenceNumberMetricTag) ProtoReflect() protoreflect // Deprecated: Use PatternFlowIcmpEchoSequenceNumberMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoSequenceNumberMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{851} + return file_otg_proto_rawDescGZIP(), []int{858} } func (x *PatternFlowIcmpEchoSequenceNumberMetricTag) GetName() string { @@ -93922,7 +94587,7 @@ type PatternFlowIcmpEchoSequenceNumber struct { func (x *PatternFlowIcmpEchoSequenceNumber) Reset() { *x = PatternFlowIcmpEchoSequenceNumber{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[852] + mi := &file_otg_proto_msgTypes[859] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93935,7 +94600,7 @@ func (x *PatternFlowIcmpEchoSequenceNumber) String() string { func (*PatternFlowIcmpEchoSequenceNumber) ProtoMessage() {} func (x *PatternFlowIcmpEchoSequenceNumber) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[852] + mi := &file_otg_proto_msgTypes[859] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -93948,7 +94613,7 @@ func (x *PatternFlowIcmpEchoSequenceNumber) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowIcmpEchoSequenceNumber.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoSequenceNumber) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{852} + return file_otg_proto_rawDescGZIP(), []int{859} } func (x *PatternFlowIcmpEchoSequenceNumber) GetChoice() PatternFlowIcmpEchoSequenceNumber_Choice_Enum { @@ -94012,7 +94677,7 @@ type PatternFlowIcmpCommonChecksum struct { func (x *PatternFlowIcmpCommonChecksum) Reset() { *x = PatternFlowIcmpCommonChecksum{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[853] + mi := &file_otg_proto_msgTypes[860] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94025,7 +94690,7 @@ func (x *PatternFlowIcmpCommonChecksum) String() string { func (*PatternFlowIcmpCommonChecksum) ProtoMessage() {} func (x *PatternFlowIcmpCommonChecksum) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[853] + mi := &file_otg_proto_msgTypes[860] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -94038,7 +94703,7 @@ func (x *PatternFlowIcmpCommonChecksum) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpCommonChecksum.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpCommonChecksum) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{853} + return file_otg_proto_rawDescGZIP(), []int{860} } func (x *PatternFlowIcmpCommonChecksum) GetChoice() PatternFlowIcmpCommonChecksum_Choice_Enum { @@ -94082,7 +94747,7 @@ type PatternFlowIcmpNextFieldsIdentifierCounter struct { func (x *PatternFlowIcmpNextFieldsIdentifierCounter) Reset() { *x = PatternFlowIcmpNextFieldsIdentifierCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[854] + mi := &file_otg_proto_msgTypes[861] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94095,7 +94760,7 @@ func (x *PatternFlowIcmpNextFieldsIdentifierCounter) String() string { func (*PatternFlowIcmpNextFieldsIdentifierCounter) ProtoMessage() {} func (x *PatternFlowIcmpNextFieldsIdentifierCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[854] + mi := &file_otg_proto_msgTypes[861] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -94108,7 +94773,7 @@ func (x *PatternFlowIcmpNextFieldsIdentifierCounter) ProtoReflect() protoreflect // Deprecated: Use PatternFlowIcmpNextFieldsIdentifierCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpNextFieldsIdentifierCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{854} + return file_otg_proto_rawDescGZIP(), []int{861} } func (x *PatternFlowIcmpNextFieldsIdentifierCounter) GetStart() uint32 { @@ -94156,7 +94821,7 @@ type PatternFlowIcmpNextFieldsIdentifierMetricTag struct { func (x *PatternFlowIcmpNextFieldsIdentifierMetricTag) Reset() { *x = PatternFlowIcmpNextFieldsIdentifierMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[855] + mi := &file_otg_proto_msgTypes[862] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94169,7 +94834,7 @@ func (x *PatternFlowIcmpNextFieldsIdentifierMetricTag) String() string { func (*PatternFlowIcmpNextFieldsIdentifierMetricTag) ProtoMessage() {} func (x *PatternFlowIcmpNextFieldsIdentifierMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[855] + mi := &file_otg_proto_msgTypes[862] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -94182,7 +94847,7 @@ func (x *PatternFlowIcmpNextFieldsIdentifierMetricTag) ProtoReflect() protorefle // Deprecated: Use PatternFlowIcmpNextFieldsIdentifierMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpNextFieldsIdentifierMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{855} + return file_otg_proto_rawDescGZIP(), []int{862} } func (x *PatternFlowIcmpNextFieldsIdentifierMetricTag) GetName() string { @@ -94234,7 +94899,7 @@ type PatternFlowIcmpNextFieldsIdentifier struct { func (x *PatternFlowIcmpNextFieldsIdentifier) Reset() { *x = PatternFlowIcmpNextFieldsIdentifier{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[856] + mi := &file_otg_proto_msgTypes[863] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94247,7 +94912,7 @@ func (x *PatternFlowIcmpNextFieldsIdentifier) String() string { func (*PatternFlowIcmpNextFieldsIdentifier) ProtoMessage() {} func (x *PatternFlowIcmpNextFieldsIdentifier) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[856] + mi := &file_otg_proto_msgTypes[863] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -94260,7 +94925,7 @@ func (x *PatternFlowIcmpNextFieldsIdentifier) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowIcmpNextFieldsIdentifier.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpNextFieldsIdentifier) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{856} + return file_otg_proto_rawDescGZIP(), []int{863} } func (x *PatternFlowIcmpNextFieldsIdentifier) GetChoice() PatternFlowIcmpNextFieldsIdentifier_Choice_Enum { @@ -94325,7 +94990,7 @@ type PatternFlowIcmpNextFieldsSequenceNumberCounter struct { func (x *PatternFlowIcmpNextFieldsSequenceNumberCounter) Reset() { *x = PatternFlowIcmpNextFieldsSequenceNumberCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[857] + mi := &file_otg_proto_msgTypes[864] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94338,7 +95003,7 @@ func (x *PatternFlowIcmpNextFieldsSequenceNumberCounter) String() string { func (*PatternFlowIcmpNextFieldsSequenceNumberCounter) ProtoMessage() {} func (x *PatternFlowIcmpNextFieldsSequenceNumberCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[857] + mi := &file_otg_proto_msgTypes[864] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -94351,7 +95016,7 @@ func (x *PatternFlowIcmpNextFieldsSequenceNumberCounter) ProtoReflect() protoref // Deprecated: Use PatternFlowIcmpNextFieldsSequenceNumberCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpNextFieldsSequenceNumberCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{857} + return file_otg_proto_rawDescGZIP(), []int{864} } func (x *PatternFlowIcmpNextFieldsSequenceNumberCounter) GetStart() uint32 { @@ -94399,7 +95064,7 @@ type PatternFlowIcmpNextFieldsSequenceNumberMetricTag struct { func (x *PatternFlowIcmpNextFieldsSequenceNumberMetricTag) Reset() { *x = PatternFlowIcmpNextFieldsSequenceNumberMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[858] + mi := &file_otg_proto_msgTypes[865] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94412,7 +95077,7 @@ func (x *PatternFlowIcmpNextFieldsSequenceNumberMetricTag) String() string { func (*PatternFlowIcmpNextFieldsSequenceNumberMetricTag) ProtoMessage() {} func (x *PatternFlowIcmpNextFieldsSequenceNumberMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[858] + mi := &file_otg_proto_msgTypes[865] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -94425,7 +95090,7 @@ func (x *PatternFlowIcmpNextFieldsSequenceNumberMetricTag) ProtoReflect() protor // Deprecated: Use PatternFlowIcmpNextFieldsSequenceNumberMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpNextFieldsSequenceNumberMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{858} + return file_otg_proto_rawDescGZIP(), []int{865} } func (x *PatternFlowIcmpNextFieldsSequenceNumberMetricTag) GetName() string { @@ -94477,7 +95142,7 @@ type PatternFlowIcmpNextFieldsSequenceNumber struct { func (x *PatternFlowIcmpNextFieldsSequenceNumber) Reset() { *x = PatternFlowIcmpNextFieldsSequenceNumber{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[859] + mi := &file_otg_proto_msgTypes[866] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94490,7 +95155,7 @@ func (x *PatternFlowIcmpNextFieldsSequenceNumber) String() string { func (*PatternFlowIcmpNextFieldsSequenceNumber) ProtoMessage() {} func (x *PatternFlowIcmpNextFieldsSequenceNumber) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[859] + mi := &file_otg_proto_msgTypes[866] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -94503,7 +95168,7 @@ func (x *PatternFlowIcmpNextFieldsSequenceNumber) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowIcmpNextFieldsSequenceNumber.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpNextFieldsSequenceNumber) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{859} + return file_otg_proto_rawDescGZIP(), []int{866} } func (x *PatternFlowIcmpNextFieldsSequenceNumber) GetChoice() PatternFlowIcmpNextFieldsSequenceNumber_Choice_Enum { @@ -94568,7 +95233,7 @@ type PatternFlowIcmpv6EchoTypeCounter struct { func (x *PatternFlowIcmpv6EchoTypeCounter) Reset() { *x = PatternFlowIcmpv6EchoTypeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[860] + mi := &file_otg_proto_msgTypes[867] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94581,7 +95246,7 @@ func (x *PatternFlowIcmpv6EchoTypeCounter) String() string { func (*PatternFlowIcmpv6EchoTypeCounter) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoTypeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[860] + mi := &file_otg_proto_msgTypes[867] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -94594,7 +95259,7 @@ func (x *PatternFlowIcmpv6EchoTypeCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpv6EchoTypeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoTypeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{860} + return file_otg_proto_rawDescGZIP(), []int{867} } func (x *PatternFlowIcmpv6EchoTypeCounter) GetStart() uint32 { @@ -94642,7 +95307,7 @@ type PatternFlowIcmpv6EchoTypeMetricTag struct { func (x *PatternFlowIcmpv6EchoTypeMetricTag) Reset() { *x = PatternFlowIcmpv6EchoTypeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[861] + mi := &file_otg_proto_msgTypes[868] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94655,7 +95320,7 @@ func (x *PatternFlowIcmpv6EchoTypeMetricTag) String() string { func (*PatternFlowIcmpv6EchoTypeMetricTag) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoTypeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[861] + mi := &file_otg_proto_msgTypes[868] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -94668,7 +95333,7 @@ func (x *PatternFlowIcmpv6EchoTypeMetricTag) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowIcmpv6EchoTypeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoTypeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{861} + return file_otg_proto_rawDescGZIP(), []int{868} } func (x *PatternFlowIcmpv6EchoTypeMetricTag) GetName() string { @@ -94720,7 +95385,7 @@ type PatternFlowIcmpv6EchoType struct { func (x *PatternFlowIcmpv6EchoType) Reset() { *x = PatternFlowIcmpv6EchoType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[862] + mi := &file_otg_proto_msgTypes[869] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94733,7 +95398,7 @@ func (x *PatternFlowIcmpv6EchoType) String() string { func (*PatternFlowIcmpv6EchoType) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[862] + mi := &file_otg_proto_msgTypes[869] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -94746,7 +95411,7 @@ func (x *PatternFlowIcmpv6EchoType) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpv6EchoType.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoType) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{862} + return file_otg_proto_rawDescGZIP(), []int{869} } func (x *PatternFlowIcmpv6EchoType) GetChoice() PatternFlowIcmpv6EchoType_Choice_Enum { @@ -94811,7 +95476,7 @@ type PatternFlowIcmpv6EchoCodeCounter struct { func (x *PatternFlowIcmpv6EchoCodeCounter) Reset() { *x = PatternFlowIcmpv6EchoCodeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[863] + mi := &file_otg_proto_msgTypes[870] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94824,7 +95489,7 @@ func (x *PatternFlowIcmpv6EchoCodeCounter) String() string { func (*PatternFlowIcmpv6EchoCodeCounter) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoCodeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[863] + mi := &file_otg_proto_msgTypes[870] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -94837,7 +95502,7 @@ func (x *PatternFlowIcmpv6EchoCodeCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpv6EchoCodeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoCodeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{863} + return file_otg_proto_rawDescGZIP(), []int{870} } func (x *PatternFlowIcmpv6EchoCodeCounter) GetStart() uint32 { @@ -94885,7 +95550,7 @@ type PatternFlowIcmpv6EchoCodeMetricTag struct { func (x *PatternFlowIcmpv6EchoCodeMetricTag) Reset() { *x = PatternFlowIcmpv6EchoCodeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[864] + mi := &file_otg_proto_msgTypes[871] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94898,7 +95563,7 @@ func (x *PatternFlowIcmpv6EchoCodeMetricTag) String() string { func (*PatternFlowIcmpv6EchoCodeMetricTag) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoCodeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[864] + mi := &file_otg_proto_msgTypes[871] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -94911,7 +95576,7 @@ func (x *PatternFlowIcmpv6EchoCodeMetricTag) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowIcmpv6EchoCodeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoCodeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{864} + return file_otg_proto_rawDescGZIP(), []int{871} } func (x *PatternFlowIcmpv6EchoCodeMetricTag) GetName() string { @@ -94963,7 +95628,7 @@ type PatternFlowIcmpv6EchoCode struct { func (x *PatternFlowIcmpv6EchoCode) Reset() { *x = PatternFlowIcmpv6EchoCode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[865] + mi := &file_otg_proto_msgTypes[872] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -94976,7 +95641,7 @@ func (x *PatternFlowIcmpv6EchoCode) String() string { func (*PatternFlowIcmpv6EchoCode) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoCode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[865] + mi := &file_otg_proto_msgTypes[872] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -94989,7 +95654,7 @@ func (x *PatternFlowIcmpv6EchoCode) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpv6EchoCode.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoCode) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{865} + return file_otg_proto_rawDescGZIP(), []int{872} } func (x *PatternFlowIcmpv6EchoCode) GetChoice() PatternFlowIcmpv6EchoCode_Choice_Enum { @@ -95054,7 +95719,7 @@ type PatternFlowIcmpv6EchoIdentifierCounter struct { func (x *PatternFlowIcmpv6EchoIdentifierCounter) Reset() { *x = PatternFlowIcmpv6EchoIdentifierCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[866] + mi := &file_otg_proto_msgTypes[873] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -95067,7 +95732,7 @@ func (x *PatternFlowIcmpv6EchoIdentifierCounter) String() string { func (*PatternFlowIcmpv6EchoIdentifierCounter) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoIdentifierCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[866] + mi := &file_otg_proto_msgTypes[873] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95080,7 +95745,7 @@ func (x *PatternFlowIcmpv6EchoIdentifierCounter) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowIcmpv6EchoIdentifierCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoIdentifierCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{866} + return file_otg_proto_rawDescGZIP(), []int{873} } func (x *PatternFlowIcmpv6EchoIdentifierCounter) GetStart() uint32 { @@ -95128,7 +95793,7 @@ type PatternFlowIcmpv6EchoIdentifierMetricTag struct { func (x *PatternFlowIcmpv6EchoIdentifierMetricTag) Reset() { *x = PatternFlowIcmpv6EchoIdentifierMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[867] + mi := &file_otg_proto_msgTypes[874] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -95141,7 +95806,7 @@ func (x *PatternFlowIcmpv6EchoIdentifierMetricTag) String() string { func (*PatternFlowIcmpv6EchoIdentifierMetricTag) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoIdentifierMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[867] + mi := &file_otg_proto_msgTypes[874] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95154,7 +95819,7 @@ func (x *PatternFlowIcmpv6EchoIdentifierMetricTag) ProtoReflect() protoreflect.M // Deprecated: Use PatternFlowIcmpv6EchoIdentifierMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoIdentifierMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{867} + return file_otg_proto_rawDescGZIP(), []int{874} } func (x *PatternFlowIcmpv6EchoIdentifierMetricTag) GetName() string { @@ -95206,7 +95871,7 @@ type PatternFlowIcmpv6EchoIdentifier struct { func (x *PatternFlowIcmpv6EchoIdentifier) Reset() { *x = PatternFlowIcmpv6EchoIdentifier{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[868] + mi := &file_otg_proto_msgTypes[875] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -95219,7 +95884,7 @@ func (x *PatternFlowIcmpv6EchoIdentifier) String() string { func (*PatternFlowIcmpv6EchoIdentifier) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoIdentifier) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[868] + mi := &file_otg_proto_msgTypes[875] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95232,7 +95897,7 @@ func (x *PatternFlowIcmpv6EchoIdentifier) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpv6EchoIdentifier.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoIdentifier) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{868} + return file_otg_proto_rawDescGZIP(), []int{875} } func (x *PatternFlowIcmpv6EchoIdentifier) GetChoice() PatternFlowIcmpv6EchoIdentifier_Choice_Enum { @@ -95297,7 +95962,7 @@ type PatternFlowIcmpv6EchoSequenceNumberCounter struct { func (x *PatternFlowIcmpv6EchoSequenceNumberCounter) Reset() { *x = PatternFlowIcmpv6EchoSequenceNumberCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[869] + mi := &file_otg_proto_msgTypes[876] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -95310,7 +95975,7 @@ func (x *PatternFlowIcmpv6EchoSequenceNumberCounter) String() string { func (*PatternFlowIcmpv6EchoSequenceNumberCounter) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoSequenceNumberCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[869] + mi := &file_otg_proto_msgTypes[876] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95323,7 +95988,7 @@ func (x *PatternFlowIcmpv6EchoSequenceNumberCounter) ProtoReflect() protoreflect // Deprecated: Use PatternFlowIcmpv6EchoSequenceNumberCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoSequenceNumberCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{869} + return file_otg_proto_rawDescGZIP(), []int{876} } func (x *PatternFlowIcmpv6EchoSequenceNumberCounter) GetStart() uint32 { @@ -95371,7 +96036,7 @@ type PatternFlowIcmpv6EchoSequenceNumberMetricTag struct { func (x *PatternFlowIcmpv6EchoSequenceNumberMetricTag) Reset() { *x = PatternFlowIcmpv6EchoSequenceNumberMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[870] + mi := &file_otg_proto_msgTypes[877] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -95384,7 +96049,7 @@ func (x *PatternFlowIcmpv6EchoSequenceNumberMetricTag) String() string { func (*PatternFlowIcmpv6EchoSequenceNumberMetricTag) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoSequenceNumberMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[870] + mi := &file_otg_proto_msgTypes[877] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95397,7 +96062,7 @@ func (x *PatternFlowIcmpv6EchoSequenceNumberMetricTag) ProtoReflect() protorefle // Deprecated: Use PatternFlowIcmpv6EchoSequenceNumberMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoSequenceNumberMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{870} + return file_otg_proto_rawDescGZIP(), []int{877} } func (x *PatternFlowIcmpv6EchoSequenceNumberMetricTag) GetName() string { @@ -95449,7 +96114,7 @@ type PatternFlowIcmpv6EchoSequenceNumber struct { func (x *PatternFlowIcmpv6EchoSequenceNumber) Reset() { *x = PatternFlowIcmpv6EchoSequenceNumber{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[871] + mi := &file_otg_proto_msgTypes[878] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -95462,7 +96127,7 @@ func (x *PatternFlowIcmpv6EchoSequenceNumber) String() string { func (*PatternFlowIcmpv6EchoSequenceNumber) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoSequenceNumber) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[871] + mi := &file_otg_proto_msgTypes[878] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95475,7 +96140,7 @@ func (x *PatternFlowIcmpv6EchoSequenceNumber) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowIcmpv6EchoSequenceNumber.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoSequenceNumber) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{871} + return file_otg_proto_rawDescGZIP(), []int{878} } func (x *PatternFlowIcmpv6EchoSequenceNumber) GetChoice() PatternFlowIcmpv6EchoSequenceNumber_Choice_Enum { @@ -95539,7 +96204,7 @@ type PatternFlowIcmpv6EchoChecksum struct { func (x *PatternFlowIcmpv6EchoChecksum) Reset() { *x = PatternFlowIcmpv6EchoChecksum{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[872] + mi := &file_otg_proto_msgTypes[879] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -95552,7 +96217,7 @@ func (x *PatternFlowIcmpv6EchoChecksum) String() string { func (*PatternFlowIcmpv6EchoChecksum) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoChecksum) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[872] + mi := &file_otg_proto_msgTypes[879] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95565,7 +96230,7 @@ func (x *PatternFlowIcmpv6EchoChecksum) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpv6EchoChecksum.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoChecksum) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{872} + return file_otg_proto_rawDescGZIP(), []int{879} } func (x *PatternFlowIcmpv6EchoChecksum) GetChoice() PatternFlowIcmpv6EchoChecksum_Choice_Enum { @@ -95608,7 +96273,7 @@ type PatternFlowIcmpv6CommonChecksum struct { func (x *PatternFlowIcmpv6CommonChecksum) Reset() { *x = PatternFlowIcmpv6CommonChecksum{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[873] + mi := &file_otg_proto_msgTypes[880] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -95621,7 +96286,7 @@ func (x *PatternFlowIcmpv6CommonChecksum) String() string { func (*PatternFlowIcmpv6CommonChecksum) ProtoMessage() {} func (x *PatternFlowIcmpv6CommonChecksum) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[873] + mi := &file_otg_proto_msgTypes[880] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95634,7 +96299,7 @@ func (x *PatternFlowIcmpv6CommonChecksum) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpv6CommonChecksum.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6CommonChecksum) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{873} + return file_otg_proto_rawDescGZIP(), []int{880} } func (x *PatternFlowIcmpv6CommonChecksum) GetChoice() PatternFlowIcmpv6CommonChecksum_Choice_Enum { @@ -95678,7 +96343,7 @@ type PatternFlowPppAddressCounter struct { func (x *PatternFlowPppAddressCounter) Reset() { *x = PatternFlowPppAddressCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[874] + mi := &file_otg_proto_msgTypes[881] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -95691,7 +96356,7 @@ func (x *PatternFlowPppAddressCounter) String() string { func (*PatternFlowPppAddressCounter) ProtoMessage() {} func (x *PatternFlowPppAddressCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[874] + mi := &file_otg_proto_msgTypes[881] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95704,7 +96369,7 @@ func (x *PatternFlowPppAddressCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPppAddressCounter.ProtoReflect.Descriptor instead. func (*PatternFlowPppAddressCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{874} + return file_otg_proto_rawDescGZIP(), []int{881} } func (x *PatternFlowPppAddressCounter) GetStart() uint32 { @@ -95752,7 +96417,7 @@ type PatternFlowPppAddressMetricTag struct { func (x *PatternFlowPppAddressMetricTag) Reset() { *x = PatternFlowPppAddressMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[875] + mi := &file_otg_proto_msgTypes[882] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -95765,7 +96430,7 @@ func (x *PatternFlowPppAddressMetricTag) String() string { func (*PatternFlowPppAddressMetricTag) ProtoMessage() {} func (x *PatternFlowPppAddressMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[875] + mi := &file_otg_proto_msgTypes[882] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95778,7 +96443,7 @@ func (x *PatternFlowPppAddressMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPppAddressMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPppAddressMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{875} + return file_otg_proto_rawDescGZIP(), []int{882} } func (x *PatternFlowPppAddressMetricTag) GetName() string { @@ -95830,7 +96495,7 @@ type PatternFlowPppAddress struct { func (x *PatternFlowPppAddress) Reset() { *x = PatternFlowPppAddress{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[876] + mi := &file_otg_proto_msgTypes[883] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -95843,7 +96508,7 @@ func (x *PatternFlowPppAddress) String() string { func (*PatternFlowPppAddress) ProtoMessage() {} func (x *PatternFlowPppAddress) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[876] + mi := &file_otg_proto_msgTypes[883] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95856,7 +96521,7 @@ func (x *PatternFlowPppAddress) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPppAddress.ProtoReflect.Descriptor instead. func (*PatternFlowPppAddress) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{876} + return file_otg_proto_rawDescGZIP(), []int{883} } func (x *PatternFlowPppAddress) GetChoice() PatternFlowPppAddress_Choice_Enum { @@ -95921,7 +96586,7 @@ type PatternFlowPppControlCounter struct { func (x *PatternFlowPppControlCounter) Reset() { *x = PatternFlowPppControlCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[877] + mi := &file_otg_proto_msgTypes[884] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -95934,7 +96599,7 @@ func (x *PatternFlowPppControlCounter) String() string { func (*PatternFlowPppControlCounter) ProtoMessage() {} func (x *PatternFlowPppControlCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[877] + mi := &file_otg_proto_msgTypes[884] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -95947,7 +96612,7 @@ func (x *PatternFlowPppControlCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPppControlCounter.ProtoReflect.Descriptor instead. func (*PatternFlowPppControlCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{877} + return file_otg_proto_rawDescGZIP(), []int{884} } func (x *PatternFlowPppControlCounter) GetStart() uint32 { @@ -95995,7 +96660,7 @@ type PatternFlowPppControlMetricTag struct { func (x *PatternFlowPppControlMetricTag) Reset() { *x = PatternFlowPppControlMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[878] + mi := &file_otg_proto_msgTypes[885] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96008,7 +96673,7 @@ func (x *PatternFlowPppControlMetricTag) String() string { func (*PatternFlowPppControlMetricTag) ProtoMessage() {} func (x *PatternFlowPppControlMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[878] + mi := &file_otg_proto_msgTypes[885] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -96021,7 +96686,7 @@ func (x *PatternFlowPppControlMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPppControlMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPppControlMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{878} + return file_otg_proto_rawDescGZIP(), []int{885} } func (x *PatternFlowPppControlMetricTag) GetName() string { @@ -96073,7 +96738,7 @@ type PatternFlowPppControl struct { func (x *PatternFlowPppControl) Reset() { *x = PatternFlowPppControl{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[879] + mi := &file_otg_proto_msgTypes[886] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96086,7 +96751,7 @@ func (x *PatternFlowPppControl) String() string { func (*PatternFlowPppControl) ProtoMessage() {} func (x *PatternFlowPppControl) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[879] + mi := &file_otg_proto_msgTypes[886] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -96099,7 +96764,7 @@ func (x *PatternFlowPppControl) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPppControl.ProtoReflect.Descriptor instead. func (*PatternFlowPppControl) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{879} + return file_otg_proto_rawDescGZIP(), []int{886} } func (x *PatternFlowPppControl) GetChoice() PatternFlowPppControl_Choice_Enum { @@ -96164,7 +96829,7 @@ type PatternFlowPppProtocolTypeCounter struct { func (x *PatternFlowPppProtocolTypeCounter) Reset() { *x = PatternFlowPppProtocolTypeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[880] + mi := &file_otg_proto_msgTypes[887] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96177,7 +96842,7 @@ func (x *PatternFlowPppProtocolTypeCounter) String() string { func (*PatternFlowPppProtocolTypeCounter) ProtoMessage() {} func (x *PatternFlowPppProtocolTypeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[880] + mi := &file_otg_proto_msgTypes[887] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -96190,7 +96855,7 @@ func (x *PatternFlowPppProtocolTypeCounter) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowPppProtocolTypeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowPppProtocolTypeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{880} + return file_otg_proto_rawDescGZIP(), []int{887} } func (x *PatternFlowPppProtocolTypeCounter) GetStart() uint32 { @@ -96238,7 +96903,7 @@ type PatternFlowPppProtocolTypeMetricTag struct { func (x *PatternFlowPppProtocolTypeMetricTag) Reset() { *x = PatternFlowPppProtocolTypeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[881] + mi := &file_otg_proto_msgTypes[888] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96251,7 +96916,7 @@ func (x *PatternFlowPppProtocolTypeMetricTag) String() string { func (*PatternFlowPppProtocolTypeMetricTag) ProtoMessage() {} func (x *PatternFlowPppProtocolTypeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[881] + mi := &file_otg_proto_msgTypes[888] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -96264,7 +96929,7 @@ func (x *PatternFlowPppProtocolTypeMetricTag) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowPppProtocolTypeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowPppProtocolTypeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{881} + return file_otg_proto_rawDescGZIP(), []int{888} } func (x *PatternFlowPppProtocolTypeMetricTag) GetName() string { @@ -96321,7 +96986,7 @@ type PatternFlowPppProtocolType struct { func (x *PatternFlowPppProtocolType) Reset() { *x = PatternFlowPppProtocolType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[882] + mi := &file_otg_proto_msgTypes[889] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96334,7 +96999,7 @@ func (x *PatternFlowPppProtocolType) String() string { func (*PatternFlowPppProtocolType) ProtoMessage() {} func (x *PatternFlowPppProtocolType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[882] + mi := &file_otg_proto_msgTypes[889] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -96347,7 +97012,7 @@ func (x *PatternFlowPppProtocolType) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPppProtocolType.ProtoReflect.Descriptor instead. func (*PatternFlowPppProtocolType) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{882} + return file_otg_proto_rawDescGZIP(), []int{889} } func (x *PatternFlowPppProtocolType) GetChoice() PatternFlowPppProtocolType_Choice_Enum { @@ -96419,7 +97084,7 @@ type PatternFlowIgmpv1VersionCounter struct { func (x *PatternFlowIgmpv1VersionCounter) Reset() { *x = PatternFlowIgmpv1VersionCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[883] + mi := &file_otg_proto_msgTypes[890] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96432,7 +97097,7 @@ func (x *PatternFlowIgmpv1VersionCounter) String() string { func (*PatternFlowIgmpv1VersionCounter) ProtoMessage() {} func (x *PatternFlowIgmpv1VersionCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[883] + mi := &file_otg_proto_msgTypes[890] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -96445,7 +97110,7 @@ func (x *PatternFlowIgmpv1VersionCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIgmpv1VersionCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1VersionCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{883} + return file_otg_proto_rawDescGZIP(), []int{890} } func (x *PatternFlowIgmpv1VersionCounter) GetStart() uint32 { @@ -96493,7 +97158,7 @@ type PatternFlowIgmpv1VersionMetricTag struct { func (x *PatternFlowIgmpv1VersionMetricTag) Reset() { *x = PatternFlowIgmpv1VersionMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[884] + mi := &file_otg_proto_msgTypes[891] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96506,7 +97171,7 @@ func (x *PatternFlowIgmpv1VersionMetricTag) String() string { func (*PatternFlowIgmpv1VersionMetricTag) ProtoMessage() {} func (x *PatternFlowIgmpv1VersionMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[884] + mi := &file_otg_proto_msgTypes[891] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -96519,7 +97184,7 @@ func (x *PatternFlowIgmpv1VersionMetricTag) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowIgmpv1VersionMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1VersionMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{884} + return file_otg_proto_rawDescGZIP(), []int{891} } func (x *PatternFlowIgmpv1VersionMetricTag) GetName() string { @@ -96571,7 +97236,7 @@ type PatternFlowIgmpv1Version struct { func (x *PatternFlowIgmpv1Version) Reset() { *x = PatternFlowIgmpv1Version{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[885] + mi := &file_otg_proto_msgTypes[892] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96584,7 +97249,7 @@ func (x *PatternFlowIgmpv1Version) String() string { func (*PatternFlowIgmpv1Version) ProtoMessage() {} func (x *PatternFlowIgmpv1Version) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[885] + mi := &file_otg_proto_msgTypes[892] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -96597,7 +97262,7 @@ func (x *PatternFlowIgmpv1Version) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIgmpv1Version.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1Version) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{885} + return file_otg_proto_rawDescGZIP(), []int{892} } func (x *PatternFlowIgmpv1Version) GetChoice() PatternFlowIgmpv1Version_Choice_Enum { @@ -96662,7 +97327,7 @@ type PatternFlowIgmpv1TypeCounter struct { func (x *PatternFlowIgmpv1TypeCounter) Reset() { *x = PatternFlowIgmpv1TypeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[886] + mi := &file_otg_proto_msgTypes[893] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96675,7 +97340,7 @@ func (x *PatternFlowIgmpv1TypeCounter) String() string { func (*PatternFlowIgmpv1TypeCounter) ProtoMessage() {} func (x *PatternFlowIgmpv1TypeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[886] + mi := &file_otg_proto_msgTypes[893] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -96688,7 +97353,7 @@ func (x *PatternFlowIgmpv1TypeCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIgmpv1TypeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1TypeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{886} + return file_otg_proto_rawDescGZIP(), []int{893} } func (x *PatternFlowIgmpv1TypeCounter) GetStart() uint32 { @@ -96736,7 +97401,7 @@ type PatternFlowIgmpv1TypeMetricTag struct { func (x *PatternFlowIgmpv1TypeMetricTag) Reset() { *x = PatternFlowIgmpv1TypeMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[887] + mi := &file_otg_proto_msgTypes[894] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96749,7 +97414,7 @@ func (x *PatternFlowIgmpv1TypeMetricTag) String() string { func (*PatternFlowIgmpv1TypeMetricTag) ProtoMessage() {} func (x *PatternFlowIgmpv1TypeMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[887] + mi := &file_otg_proto_msgTypes[894] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -96762,7 +97427,7 @@ func (x *PatternFlowIgmpv1TypeMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIgmpv1TypeMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1TypeMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{887} + return file_otg_proto_rawDescGZIP(), []int{894} } func (x *PatternFlowIgmpv1TypeMetricTag) GetName() string { @@ -96814,7 +97479,7 @@ type PatternFlowIgmpv1Type struct { func (x *PatternFlowIgmpv1Type) Reset() { *x = PatternFlowIgmpv1Type{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[888] + mi := &file_otg_proto_msgTypes[895] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96827,7 +97492,7 @@ func (x *PatternFlowIgmpv1Type) String() string { func (*PatternFlowIgmpv1Type) ProtoMessage() {} func (x *PatternFlowIgmpv1Type) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[888] + mi := &file_otg_proto_msgTypes[895] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -96840,7 +97505,7 @@ func (x *PatternFlowIgmpv1Type) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIgmpv1Type.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1Type) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{888} + return file_otg_proto_rawDescGZIP(), []int{895} } func (x *PatternFlowIgmpv1Type) GetChoice() PatternFlowIgmpv1Type_Choice_Enum { @@ -96905,7 +97570,7 @@ type PatternFlowIgmpv1UnusedCounter struct { func (x *PatternFlowIgmpv1UnusedCounter) Reset() { *x = PatternFlowIgmpv1UnusedCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[889] + mi := &file_otg_proto_msgTypes[896] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96918,7 +97583,7 @@ func (x *PatternFlowIgmpv1UnusedCounter) String() string { func (*PatternFlowIgmpv1UnusedCounter) ProtoMessage() {} func (x *PatternFlowIgmpv1UnusedCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[889] + mi := &file_otg_proto_msgTypes[896] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -96931,7 +97596,7 @@ func (x *PatternFlowIgmpv1UnusedCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIgmpv1UnusedCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1UnusedCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{889} + return file_otg_proto_rawDescGZIP(), []int{896} } func (x *PatternFlowIgmpv1UnusedCounter) GetStart() uint32 { @@ -96979,7 +97644,7 @@ type PatternFlowIgmpv1UnusedMetricTag struct { func (x *PatternFlowIgmpv1UnusedMetricTag) Reset() { *x = PatternFlowIgmpv1UnusedMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[890] + mi := &file_otg_proto_msgTypes[897] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -96992,7 +97657,7 @@ func (x *PatternFlowIgmpv1UnusedMetricTag) String() string { func (*PatternFlowIgmpv1UnusedMetricTag) ProtoMessage() {} func (x *PatternFlowIgmpv1UnusedMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[890] + mi := &file_otg_proto_msgTypes[897] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -97005,7 +97670,7 @@ func (x *PatternFlowIgmpv1UnusedMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIgmpv1UnusedMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1UnusedMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{890} + return file_otg_proto_rawDescGZIP(), []int{897} } func (x *PatternFlowIgmpv1UnusedMetricTag) GetName() string { @@ -97057,7 +97722,7 @@ type PatternFlowIgmpv1Unused struct { func (x *PatternFlowIgmpv1Unused) Reset() { *x = PatternFlowIgmpv1Unused{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[891] + mi := &file_otg_proto_msgTypes[898] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97070,7 +97735,7 @@ func (x *PatternFlowIgmpv1Unused) String() string { func (*PatternFlowIgmpv1Unused) ProtoMessage() {} func (x *PatternFlowIgmpv1Unused) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[891] + mi := &file_otg_proto_msgTypes[898] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -97083,7 +97748,7 @@ func (x *PatternFlowIgmpv1Unused) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIgmpv1Unused.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1Unused) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{891} + return file_otg_proto_rawDescGZIP(), []int{898} } func (x *PatternFlowIgmpv1Unused) GetChoice() PatternFlowIgmpv1Unused_Choice_Enum { @@ -97147,7 +97812,7 @@ type PatternFlowIgmpv1Checksum struct { func (x *PatternFlowIgmpv1Checksum) Reset() { *x = PatternFlowIgmpv1Checksum{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[892] + mi := &file_otg_proto_msgTypes[899] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97160,7 +97825,7 @@ func (x *PatternFlowIgmpv1Checksum) String() string { func (*PatternFlowIgmpv1Checksum) ProtoMessage() {} func (x *PatternFlowIgmpv1Checksum) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[892] + mi := &file_otg_proto_msgTypes[899] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -97173,7 +97838,7 @@ func (x *PatternFlowIgmpv1Checksum) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIgmpv1Checksum.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1Checksum) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{892} + return file_otg_proto_rawDescGZIP(), []int{899} } func (x *PatternFlowIgmpv1Checksum) GetChoice() PatternFlowIgmpv1Checksum_Choice_Enum { @@ -97217,7 +97882,7 @@ type PatternFlowIgmpv1GroupAddressCounter struct { func (x *PatternFlowIgmpv1GroupAddressCounter) Reset() { *x = PatternFlowIgmpv1GroupAddressCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[893] + mi := &file_otg_proto_msgTypes[900] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97230,7 +97895,7 @@ func (x *PatternFlowIgmpv1GroupAddressCounter) String() string { func (*PatternFlowIgmpv1GroupAddressCounter) ProtoMessage() {} func (x *PatternFlowIgmpv1GroupAddressCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[893] + mi := &file_otg_proto_msgTypes[900] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -97243,7 +97908,7 @@ func (x *PatternFlowIgmpv1GroupAddressCounter) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowIgmpv1GroupAddressCounter.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1GroupAddressCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{893} + return file_otg_proto_rawDescGZIP(), []int{900} } func (x *PatternFlowIgmpv1GroupAddressCounter) GetStart() string { @@ -97291,7 +97956,7 @@ type PatternFlowIgmpv1GroupAddressMetricTag struct { func (x *PatternFlowIgmpv1GroupAddressMetricTag) Reset() { *x = PatternFlowIgmpv1GroupAddressMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[894] + mi := &file_otg_proto_msgTypes[901] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97304,7 +97969,7 @@ func (x *PatternFlowIgmpv1GroupAddressMetricTag) String() string { func (*PatternFlowIgmpv1GroupAddressMetricTag) ProtoMessage() {} func (x *PatternFlowIgmpv1GroupAddressMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[894] + mi := &file_otg_proto_msgTypes[901] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -97317,7 +97982,7 @@ func (x *PatternFlowIgmpv1GroupAddressMetricTag) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowIgmpv1GroupAddressMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1GroupAddressMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{894} + return file_otg_proto_rawDescGZIP(), []int{901} } func (x *PatternFlowIgmpv1GroupAddressMetricTag) GetName() string { @@ -97369,7 +98034,7 @@ type PatternFlowIgmpv1GroupAddress struct { func (x *PatternFlowIgmpv1GroupAddress) Reset() { *x = PatternFlowIgmpv1GroupAddress{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[895] + mi := &file_otg_proto_msgTypes[902] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97382,7 +98047,7 @@ func (x *PatternFlowIgmpv1GroupAddress) String() string { func (*PatternFlowIgmpv1GroupAddress) ProtoMessage() {} func (x *PatternFlowIgmpv1GroupAddress) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[895] + mi := &file_otg_proto_msgTypes[902] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -97395,7 +98060,7 @@ func (x *PatternFlowIgmpv1GroupAddress) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIgmpv1GroupAddress.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1GroupAddress) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{895} + return file_otg_proto_rawDescGZIP(), []int{902} } func (x *PatternFlowIgmpv1GroupAddress) GetChoice() PatternFlowIgmpv1GroupAddress_Choice_Enum { @@ -97460,7 +98125,7 @@ type PatternFlowMplsLabelCounter struct { func (x *PatternFlowMplsLabelCounter) Reset() { *x = PatternFlowMplsLabelCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[896] + mi := &file_otg_proto_msgTypes[903] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97473,7 +98138,7 @@ func (x *PatternFlowMplsLabelCounter) String() string { func (*PatternFlowMplsLabelCounter) ProtoMessage() {} func (x *PatternFlowMplsLabelCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[896] + mi := &file_otg_proto_msgTypes[903] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -97486,7 +98151,7 @@ func (x *PatternFlowMplsLabelCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowMplsLabelCounter.ProtoReflect.Descriptor instead. func (*PatternFlowMplsLabelCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{896} + return file_otg_proto_rawDescGZIP(), []int{903} } func (x *PatternFlowMplsLabelCounter) GetStart() uint32 { @@ -97534,7 +98199,7 @@ type PatternFlowMplsLabelMetricTag struct { func (x *PatternFlowMplsLabelMetricTag) Reset() { *x = PatternFlowMplsLabelMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[897] + mi := &file_otg_proto_msgTypes[904] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97547,7 +98212,7 @@ func (x *PatternFlowMplsLabelMetricTag) String() string { func (*PatternFlowMplsLabelMetricTag) ProtoMessage() {} func (x *PatternFlowMplsLabelMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[897] + mi := &file_otg_proto_msgTypes[904] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -97560,7 +98225,7 @@ func (x *PatternFlowMplsLabelMetricTag) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowMplsLabelMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowMplsLabelMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{897} + return file_otg_proto_rawDescGZIP(), []int{904} } func (x *PatternFlowMplsLabelMetricTag) GetName() string { @@ -97617,7 +98282,7 @@ type PatternFlowMplsLabel struct { func (x *PatternFlowMplsLabel) Reset() { *x = PatternFlowMplsLabel{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[898] + mi := &file_otg_proto_msgTypes[905] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97630,7 +98295,7 @@ func (x *PatternFlowMplsLabel) String() string { func (*PatternFlowMplsLabel) ProtoMessage() {} func (x *PatternFlowMplsLabel) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[898] + mi := &file_otg_proto_msgTypes[905] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -97643,7 +98308,7 @@ func (x *PatternFlowMplsLabel) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowMplsLabel.ProtoReflect.Descriptor instead. func (*PatternFlowMplsLabel) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{898} + return file_otg_proto_rawDescGZIP(), []int{905} } func (x *PatternFlowMplsLabel) GetChoice() PatternFlowMplsLabel_Choice_Enum { @@ -97715,7 +98380,7 @@ type PatternFlowMplsTrafficClassCounter struct { func (x *PatternFlowMplsTrafficClassCounter) Reset() { *x = PatternFlowMplsTrafficClassCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[899] + mi := &file_otg_proto_msgTypes[906] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97728,7 +98393,7 @@ func (x *PatternFlowMplsTrafficClassCounter) String() string { func (*PatternFlowMplsTrafficClassCounter) ProtoMessage() {} func (x *PatternFlowMplsTrafficClassCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[899] + mi := &file_otg_proto_msgTypes[906] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -97741,7 +98406,7 @@ func (x *PatternFlowMplsTrafficClassCounter) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowMplsTrafficClassCounter.ProtoReflect.Descriptor instead. func (*PatternFlowMplsTrafficClassCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{899} + return file_otg_proto_rawDescGZIP(), []int{906} } func (x *PatternFlowMplsTrafficClassCounter) GetStart() uint32 { @@ -97789,7 +98454,7 @@ type PatternFlowMplsTrafficClassMetricTag struct { func (x *PatternFlowMplsTrafficClassMetricTag) Reset() { *x = PatternFlowMplsTrafficClassMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[900] + mi := &file_otg_proto_msgTypes[907] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97802,7 +98467,7 @@ func (x *PatternFlowMplsTrafficClassMetricTag) String() string { func (*PatternFlowMplsTrafficClassMetricTag) ProtoMessage() {} func (x *PatternFlowMplsTrafficClassMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[900] + mi := &file_otg_proto_msgTypes[907] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -97815,7 +98480,7 @@ func (x *PatternFlowMplsTrafficClassMetricTag) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowMplsTrafficClassMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowMplsTrafficClassMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{900} + return file_otg_proto_rawDescGZIP(), []int{907} } func (x *PatternFlowMplsTrafficClassMetricTag) GetName() string { @@ -97867,7 +98532,7 @@ type PatternFlowMplsTrafficClass struct { func (x *PatternFlowMplsTrafficClass) Reset() { *x = PatternFlowMplsTrafficClass{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[901] + mi := &file_otg_proto_msgTypes[908] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97880,7 +98545,7 @@ func (x *PatternFlowMplsTrafficClass) String() string { func (*PatternFlowMplsTrafficClass) ProtoMessage() {} func (x *PatternFlowMplsTrafficClass) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[901] + mi := &file_otg_proto_msgTypes[908] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -97893,7 +98558,7 @@ func (x *PatternFlowMplsTrafficClass) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowMplsTrafficClass.ProtoReflect.Descriptor instead. func (*PatternFlowMplsTrafficClass) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{901} + return file_otg_proto_rawDescGZIP(), []int{908} } func (x *PatternFlowMplsTrafficClass) GetChoice() PatternFlowMplsTrafficClass_Choice_Enum { @@ -97958,7 +98623,7 @@ type PatternFlowMplsBottomOfStackCounter struct { func (x *PatternFlowMplsBottomOfStackCounter) Reset() { *x = PatternFlowMplsBottomOfStackCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[902] + mi := &file_otg_proto_msgTypes[909] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -97971,7 +98636,7 @@ func (x *PatternFlowMplsBottomOfStackCounter) String() string { func (*PatternFlowMplsBottomOfStackCounter) ProtoMessage() {} func (x *PatternFlowMplsBottomOfStackCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[902] + mi := &file_otg_proto_msgTypes[909] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -97984,7 +98649,7 @@ func (x *PatternFlowMplsBottomOfStackCounter) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowMplsBottomOfStackCounter.ProtoReflect.Descriptor instead. func (*PatternFlowMplsBottomOfStackCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{902} + return file_otg_proto_rawDescGZIP(), []int{909} } func (x *PatternFlowMplsBottomOfStackCounter) GetStart() uint32 { @@ -98032,7 +98697,7 @@ type PatternFlowMplsBottomOfStackMetricTag struct { func (x *PatternFlowMplsBottomOfStackMetricTag) Reset() { *x = PatternFlowMplsBottomOfStackMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[903] + mi := &file_otg_proto_msgTypes[910] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -98045,7 +98710,7 @@ func (x *PatternFlowMplsBottomOfStackMetricTag) String() string { func (*PatternFlowMplsBottomOfStackMetricTag) ProtoMessage() {} func (x *PatternFlowMplsBottomOfStackMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[903] + mi := &file_otg_proto_msgTypes[910] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -98058,7 +98723,7 @@ func (x *PatternFlowMplsBottomOfStackMetricTag) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowMplsBottomOfStackMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowMplsBottomOfStackMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{903} + return file_otg_proto_rawDescGZIP(), []int{910} } func (x *PatternFlowMplsBottomOfStackMetricTag) GetName() string { @@ -98115,7 +98780,7 @@ type PatternFlowMplsBottomOfStack struct { func (x *PatternFlowMplsBottomOfStack) Reset() { *x = PatternFlowMplsBottomOfStack{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[904] + mi := &file_otg_proto_msgTypes[911] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -98128,7 +98793,7 @@ func (x *PatternFlowMplsBottomOfStack) String() string { func (*PatternFlowMplsBottomOfStack) ProtoMessage() {} func (x *PatternFlowMplsBottomOfStack) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[904] + mi := &file_otg_proto_msgTypes[911] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -98141,7 +98806,7 @@ func (x *PatternFlowMplsBottomOfStack) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowMplsBottomOfStack.ProtoReflect.Descriptor instead. func (*PatternFlowMplsBottomOfStack) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{904} + return file_otg_proto_rawDescGZIP(), []int{911} } func (x *PatternFlowMplsBottomOfStack) GetChoice() PatternFlowMplsBottomOfStack_Choice_Enum { @@ -98213,7 +98878,7 @@ type PatternFlowMplsTimeToLiveCounter struct { func (x *PatternFlowMplsTimeToLiveCounter) Reset() { *x = PatternFlowMplsTimeToLiveCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[905] + mi := &file_otg_proto_msgTypes[912] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -98226,7 +98891,7 @@ func (x *PatternFlowMplsTimeToLiveCounter) String() string { func (*PatternFlowMplsTimeToLiveCounter) ProtoMessage() {} func (x *PatternFlowMplsTimeToLiveCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[905] + mi := &file_otg_proto_msgTypes[912] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -98239,7 +98904,7 @@ func (x *PatternFlowMplsTimeToLiveCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowMplsTimeToLiveCounter.ProtoReflect.Descriptor instead. func (*PatternFlowMplsTimeToLiveCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{905} + return file_otg_proto_rawDescGZIP(), []int{912} } func (x *PatternFlowMplsTimeToLiveCounter) GetStart() uint32 { @@ -98287,7 +98952,7 @@ type PatternFlowMplsTimeToLiveMetricTag struct { func (x *PatternFlowMplsTimeToLiveMetricTag) Reset() { *x = PatternFlowMplsTimeToLiveMetricTag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[906] + mi := &file_otg_proto_msgTypes[913] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -98300,7 +98965,7 @@ func (x *PatternFlowMplsTimeToLiveMetricTag) String() string { func (*PatternFlowMplsTimeToLiveMetricTag) ProtoMessage() {} func (x *PatternFlowMplsTimeToLiveMetricTag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[906] + mi := &file_otg_proto_msgTypes[913] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -98313,7 +98978,7 @@ func (x *PatternFlowMplsTimeToLiveMetricTag) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowMplsTimeToLiveMetricTag.ProtoReflect.Descriptor instead. func (*PatternFlowMplsTimeToLiveMetricTag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{906} + return file_otg_proto_rawDescGZIP(), []int{913} } func (x *PatternFlowMplsTimeToLiveMetricTag) GetName() string { @@ -98365,7 +99030,7 @@ type PatternFlowMplsTimeToLive struct { func (x *PatternFlowMplsTimeToLive) Reset() { *x = PatternFlowMplsTimeToLive{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[907] + mi := &file_otg_proto_msgTypes[914] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -98378,7 +99043,7 @@ func (x *PatternFlowMplsTimeToLive) String() string { func (*PatternFlowMplsTimeToLive) ProtoMessage() {} func (x *PatternFlowMplsTimeToLive) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[907] + mi := &file_otg_proto_msgTypes[914] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -98391,7 +99056,7 @@ func (x *PatternFlowMplsTimeToLive) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowMplsTimeToLive.ProtoReflect.Descriptor instead. func (*PatternFlowMplsTimeToLive) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{907} + return file_otg_proto_rawDescGZIP(), []int{914} } func (x *PatternFlowMplsTimeToLive) GetChoice() PatternFlowMplsTimeToLive_Choice_Enum { @@ -98456,7 +99121,7 @@ type PatternFlowSnmpv2CVersionCounter struct { func (x *PatternFlowSnmpv2CVersionCounter) Reset() { *x = PatternFlowSnmpv2CVersionCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[908] + mi := &file_otg_proto_msgTypes[915] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -98469,7 +99134,7 @@ func (x *PatternFlowSnmpv2CVersionCounter) String() string { func (*PatternFlowSnmpv2CVersionCounter) ProtoMessage() {} func (x *PatternFlowSnmpv2CVersionCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[908] + mi := &file_otg_proto_msgTypes[915] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -98482,7 +99147,7 @@ func (x *PatternFlowSnmpv2CVersionCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowSnmpv2CVersionCounter.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVersionCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{908} + return file_otg_proto_rawDescGZIP(), []int{915} } func (x *PatternFlowSnmpv2CVersionCounter) GetStart() uint32 { @@ -98530,7 +99195,7 @@ type PatternFlowSnmpv2CVersion struct { func (x *PatternFlowSnmpv2CVersion) Reset() { *x = PatternFlowSnmpv2CVersion{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[909] + mi := &file_otg_proto_msgTypes[916] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -98543,7 +99208,7 @@ func (x *PatternFlowSnmpv2CVersion) String() string { func (*PatternFlowSnmpv2CVersion) ProtoMessage() {} func (x *PatternFlowSnmpv2CVersion) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[909] + mi := &file_otg_proto_msgTypes[916] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -98556,7 +99221,7 @@ func (x *PatternFlowSnmpv2CVersion) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowSnmpv2CVersion.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVersion) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{909} + return file_otg_proto_rawDescGZIP(), []int{916} } func (x *PatternFlowSnmpv2CVersion) GetChoice() PatternFlowSnmpv2CVersion_Choice_Enum { @@ -98614,7 +99279,7 @@ type PatternFlowSnmpv2CPDURequestIdCounter struct { func (x *PatternFlowSnmpv2CPDURequestIdCounter) Reset() { *x = PatternFlowSnmpv2CPDURequestIdCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[910] + mi := &file_otg_proto_msgTypes[917] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -98627,7 +99292,7 @@ func (x *PatternFlowSnmpv2CPDURequestIdCounter) String() string { func (*PatternFlowSnmpv2CPDURequestIdCounter) ProtoMessage() {} func (x *PatternFlowSnmpv2CPDURequestIdCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[910] + mi := &file_otg_proto_msgTypes[917] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -98640,7 +99305,7 @@ func (x *PatternFlowSnmpv2CPDURequestIdCounter) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowSnmpv2CPDURequestIdCounter.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CPDURequestIdCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{910} + return file_otg_proto_rawDescGZIP(), []int{917} } func (x *PatternFlowSnmpv2CPDURequestIdCounter) GetStart() int32 { @@ -98693,7 +99358,7 @@ type PatternFlowSnmpv2CPDURequestId struct { func (x *PatternFlowSnmpv2CPDURequestId) Reset() { *x = PatternFlowSnmpv2CPDURequestId{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[911] + mi := &file_otg_proto_msgTypes[918] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -98706,7 +99371,7 @@ func (x *PatternFlowSnmpv2CPDURequestId) String() string { func (*PatternFlowSnmpv2CPDURequestId) ProtoMessage() {} func (x *PatternFlowSnmpv2CPDURequestId) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[911] + mi := &file_otg_proto_msgTypes[918] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -98719,7 +99384,7 @@ func (x *PatternFlowSnmpv2CPDURequestId) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowSnmpv2CPDURequestId.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CPDURequestId) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{911} + return file_otg_proto_rawDescGZIP(), []int{918} } func (x *PatternFlowSnmpv2CPDURequestId) GetChoice() PatternFlowSnmpv2CPDURequestId_Choice_Enum { @@ -98777,7 +99442,7 @@ type PatternFlowSnmpv2CPDUErrorIndexCounter struct { func (x *PatternFlowSnmpv2CPDUErrorIndexCounter) Reset() { *x = PatternFlowSnmpv2CPDUErrorIndexCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[912] + mi := &file_otg_proto_msgTypes[919] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -98790,7 +99455,7 @@ func (x *PatternFlowSnmpv2CPDUErrorIndexCounter) String() string { func (*PatternFlowSnmpv2CPDUErrorIndexCounter) ProtoMessage() {} func (x *PatternFlowSnmpv2CPDUErrorIndexCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[912] + mi := &file_otg_proto_msgTypes[919] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -98803,7 +99468,7 @@ func (x *PatternFlowSnmpv2CPDUErrorIndexCounter) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowSnmpv2CPDUErrorIndexCounter.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CPDUErrorIndexCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{912} + return file_otg_proto_rawDescGZIP(), []int{919} } func (x *PatternFlowSnmpv2CPDUErrorIndexCounter) GetStart() uint32 { @@ -98852,7 +99517,7 @@ type PatternFlowSnmpv2CPDUErrorIndex struct { func (x *PatternFlowSnmpv2CPDUErrorIndex) Reset() { *x = PatternFlowSnmpv2CPDUErrorIndex{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[913] + mi := &file_otg_proto_msgTypes[920] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -98865,7 +99530,7 @@ func (x *PatternFlowSnmpv2CPDUErrorIndex) String() string { func (*PatternFlowSnmpv2CPDUErrorIndex) ProtoMessage() {} func (x *PatternFlowSnmpv2CPDUErrorIndex) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[913] + mi := &file_otg_proto_msgTypes[920] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -98878,7 +99543,7 @@ func (x *PatternFlowSnmpv2CPDUErrorIndex) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowSnmpv2CPDUErrorIndex.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CPDUErrorIndex) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{913} + return file_otg_proto_rawDescGZIP(), []int{920} } func (x *PatternFlowSnmpv2CPDUErrorIndex) GetChoice() PatternFlowSnmpv2CPDUErrorIndex_Choice_Enum { @@ -98936,7 +99601,7 @@ type PatternFlowSnmpv2CBulkPDURequestIdCounter struct { func (x *PatternFlowSnmpv2CBulkPDURequestIdCounter) Reset() { *x = PatternFlowSnmpv2CBulkPDURequestIdCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[914] + mi := &file_otg_proto_msgTypes[921] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -98949,7 +99614,7 @@ func (x *PatternFlowSnmpv2CBulkPDURequestIdCounter) String() string { func (*PatternFlowSnmpv2CBulkPDURequestIdCounter) ProtoMessage() {} func (x *PatternFlowSnmpv2CBulkPDURequestIdCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[914] + mi := &file_otg_proto_msgTypes[921] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -98962,7 +99627,7 @@ func (x *PatternFlowSnmpv2CBulkPDURequestIdCounter) ProtoReflect() protoreflect. // Deprecated: Use PatternFlowSnmpv2CBulkPDURequestIdCounter.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CBulkPDURequestIdCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{914} + return file_otg_proto_rawDescGZIP(), []int{921} } func (x *PatternFlowSnmpv2CBulkPDURequestIdCounter) GetStart() int32 { @@ -99015,7 +99680,7 @@ type PatternFlowSnmpv2CBulkPDURequestId struct { func (x *PatternFlowSnmpv2CBulkPDURequestId) Reset() { *x = PatternFlowSnmpv2CBulkPDURequestId{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[915] + mi := &file_otg_proto_msgTypes[922] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99028,7 +99693,7 @@ func (x *PatternFlowSnmpv2CBulkPDURequestId) String() string { func (*PatternFlowSnmpv2CBulkPDURequestId) ProtoMessage() {} func (x *PatternFlowSnmpv2CBulkPDURequestId) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[915] + mi := &file_otg_proto_msgTypes[922] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -99041,7 +99706,7 @@ func (x *PatternFlowSnmpv2CBulkPDURequestId) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowSnmpv2CBulkPDURequestId.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CBulkPDURequestId) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{915} + return file_otg_proto_rawDescGZIP(), []int{922} } func (x *PatternFlowSnmpv2CBulkPDURequestId) GetChoice() PatternFlowSnmpv2CBulkPDURequestId_Choice_Enum { @@ -99100,7 +99765,7 @@ type PatternFlowSnmpv2CBulkPDUNonRepeaters struct { func (x *PatternFlowSnmpv2CBulkPDUNonRepeaters) Reset() { *x = PatternFlowSnmpv2CBulkPDUNonRepeaters{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[916] + mi := &file_otg_proto_msgTypes[923] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99113,7 +99778,7 @@ func (x *PatternFlowSnmpv2CBulkPDUNonRepeaters) String() string { func (*PatternFlowSnmpv2CBulkPDUNonRepeaters) ProtoMessage() {} func (x *PatternFlowSnmpv2CBulkPDUNonRepeaters) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[916] + mi := &file_otg_proto_msgTypes[923] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -99126,7 +99791,7 @@ func (x *PatternFlowSnmpv2CBulkPDUNonRepeaters) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowSnmpv2CBulkPDUNonRepeaters.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CBulkPDUNonRepeaters) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{916} + return file_otg_proto_rawDescGZIP(), []int{923} } func (x *PatternFlowSnmpv2CBulkPDUNonRepeaters) GetChoice() PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice_Enum { @@ -99170,7 +99835,7 @@ type PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter struct { func (x *PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) Reset() { *x = PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[917] + mi := &file_otg_proto_msgTypes[924] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99183,7 +99848,7 @@ func (x *PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) String() string { func (*PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) ProtoMessage() {} func (x *PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[917] + mi := &file_otg_proto_msgTypes[924] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -99196,7 +99861,7 @@ func (x *PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) ProtoReflect() protoref // Deprecated: Use PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{917} + return file_otg_proto_rawDescGZIP(), []int{924} } func (x *PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) GetStart() uint32 { @@ -99246,7 +99911,7 @@ type PatternFlowSnmpv2CBulkPDUMaxRepetitions struct { func (x *PatternFlowSnmpv2CBulkPDUMaxRepetitions) Reset() { *x = PatternFlowSnmpv2CBulkPDUMaxRepetitions{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[918] + mi := &file_otg_proto_msgTypes[925] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99259,7 +99924,7 @@ func (x *PatternFlowSnmpv2CBulkPDUMaxRepetitions) String() string { func (*PatternFlowSnmpv2CBulkPDUMaxRepetitions) ProtoMessage() {} func (x *PatternFlowSnmpv2CBulkPDUMaxRepetitions) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[918] + mi := &file_otg_proto_msgTypes[925] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -99272,7 +99937,7 @@ func (x *PatternFlowSnmpv2CBulkPDUMaxRepetitions) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowSnmpv2CBulkPDUMaxRepetitions.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CBulkPDUMaxRepetitions) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{918} + return file_otg_proto_rawDescGZIP(), []int{925} } func (x *PatternFlowSnmpv2CBulkPDUMaxRepetitions) GetChoice() PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice_Enum { @@ -99330,7 +99995,7 @@ type PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter struct { func (x *PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[919] + mi := &file_otg_proto_msgTypes[926] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99343,7 +100008,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) String() str func (*PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[919] + mi := &file_otg_proto_msgTypes[926] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -99356,7 +100021,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) ProtoReflect // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{919} + return file_otg_proto_rawDescGZIP(), []int{926} } func (x *PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) GetStart() int32 { @@ -99404,7 +100069,7 @@ type PatternFlowSnmpv2CVariableBindingValueIntegerValue struct { func (x *PatternFlowSnmpv2CVariableBindingValueIntegerValue) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueIntegerValue{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[920] + mi := &file_otg_proto_msgTypes[927] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99417,7 +100082,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueIntegerValue) String() string { func (*PatternFlowSnmpv2CVariableBindingValueIntegerValue) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueIntegerValue) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[920] + mi := &file_otg_proto_msgTypes[927] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -99430,7 +100095,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueIntegerValue) ProtoReflect() prot // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueIntegerValue.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueIntegerValue) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{920} + return file_otg_proto_rawDescGZIP(), []int{927} } func (x *PatternFlowSnmpv2CVariableBindingValueIntegerValue) GetChoice() PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice_Enum { @@ -99488,7 +100153,7 @@ type PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter struct { func (x *PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[921] + mi := &file_otg_proto_msgTypes[928] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99501,7 +100166,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) String() s func (*PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[921] + mi := &file_otg_proto_msgTypes[928] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -99514,7 +100179,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) ProtoRefle // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{921} + return file_otg_proto_rawDescGZIP(), []int{928} } func (x *PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) GetStart() string { @@ -99562,7 +100227,7 @@ type PatternFlowSnmpv2CVariableBindingValueIpAddressValue struct { func (x *PatternFlowSnmpv2CVariableBindingValueIpAddressValue) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueIpAddressValue{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[922] + mi := &file_otg_proto_msgTypes[929] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99575,7 +100240,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueIpAddressValue) String() string { func (*PatternFlowSnmpv2CVariableBindingValueIpAddressValue) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueIpAddressValue) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[922] + mi := &file_otg_proto_msgTypes[929] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -99588,7 +100253,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueIpAddressValue) ProtoReflect() pr // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueIpAddressValue.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueIpAddressValue) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{922} + return file_otg_proto_rawDescGZIP(), []int{929} } func (x *PatternFlowSnmpv2CVariableBindingValueIpAddressValue) GetChoice() PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice_Enum { @@ -99646,7 +100311,7 @@ type PatternFlowSnmpv2CVariableBindingValueCounterValueCounter struct { func (x *PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueCounterValueCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[923] + mi := &file_otg_proto_msgTypes[930] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99659,7 +100324,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) String() str func (*PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[923] + mi := &file_otg_proto_msgTypes[930] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -99672,7 +100337,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) ProtoReflect // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueCounterValueCounter.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{923} + return file_otg_proto_rawDescGZIP(), []int{930} } func (x *PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) GetStart() uint32 { @@ -99720,7 +100385,7 @@ type PatternFlowSnmpv2CVariableBindingValueCounterValue struct { func (x *PatternFlowSnmpv2CVariableBindingValueCounterValue) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueCounterValue{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[924] + mi := &file_otg_proto_msgTypes[931] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99733,7 +100398,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueCounterValue) String() string { func (*PatternFlowSnmpv2CVariableBindingValueCounterValue) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueCounterValue) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[924] + mi := &file_otg_proto_msgTypes[931] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -99746,7 +100411,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueCounterValue) ProtoReflect() prot // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueCounterValue.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueCounterValue) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{924} + return file_otg_proto_rawDescGZIP(), []int{931} } func (x *PatternFlowSnmpv2CVariableBindingValueCounterValue) GetChoice() PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice_Enum { @@ -99804,7 +100469,7 @@ type PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter struct { func (x *PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[925] + mi := &file_otg_proto_msgTypes[932] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99817,7 +100482,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) String() s func (*PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[925] + mi := &file_otg_proto_msgTypes[932] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -99830,7 +100495,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) ProtoRefle // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{925} + return file_otg_proto_rawDescGZIP(), []int{932} } func (x *PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) GetStart() uint32 { @@ -99878,7 +100543,7 @@ type PatternFlowSnmpv2CVariableBindingValueTimeticksValue struct { func (x *PatternFlowSnmpv2CVariableBindingValueTimeticksValue) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueTimeticksValue{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[926] + mi := &file_otg_proto_msgTypes[933] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99891,7 +100556,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueTimeticksValue) String() string { func (*PatternFlowSnmpv2CVariableBindingValueTimeticksValue) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueTimeticksValue) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[926] + mi := &file_otg_proto_msgTypes[933] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -99904,7 +100569,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueTimeticksValue) ProtoReflect() pr // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueTimeticksValue.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueTimeticksValue) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{926} + return file_otg_proto_rawDescGZIP(), []int{933} } func (x *PatternFlowSnmpv2CVariableBindingValueTimeticksValue) GetChoice() PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice_Enum { @@ -99962,7 +100627,7 @@ type PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter struct { func (x *PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[927] + mi := &file_otg_proto_msgTypes[934] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -99975,7 +100640,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) String() func (*PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[927] + mi := &file_otg_proto_msgTypes[934] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -99988,7 +100653,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) ProtoRefl // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{927} + return file_otg_proto_rawDescGZIP(), []int{934} } func (x *PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) GetStart() uint64 { @@ -100036,7 +100701,7 @@ type PatternFlowSnmpv2CVariableBindingValueBigCounterValue struct { func (x *PatternFlowSnmpv2CVariableBindingValueBigCounterValue) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueBigCounterValue{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[928] + mi := &file_otg_proto_msgTypes[935] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100049,7 +100714,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueBigCounterValue) String() string func (*PatternFlowSnmpv2CVariableBindingValueBigCounterValue) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueBigCounterValue) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[928] + mi := &file_otg_proto_msgTypes[935] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -100062,7 +100727,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueBigCounterValue) ProtoReflect() p // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueBigCounterValue.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueBigCounterValue) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{928} + return file_otg_proto_rawDescGZIP(), []int{935} } func (x *PatternFlowSnmpv2CVariableBindingValueBigCounterValue) GetChoice() PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice_Enum { @@ -100120,7 +100785,7 @@ type PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter struct { func (x *PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[929] + mi := &file_otg_proto_msgTypes[936] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100133,7 +100798,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Stri func (*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[929] + mi := &file_otg_proto_msgTypes[936] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -100146,7 +100811,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Prot // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{929} + return file_otg_proto_rawDescGZIP(), []int{936} } func (x *PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) GetStart() uint32 { @@ -100194,7 +100859,7 @@ type PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue struct { func (x *PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[930] + mi := &file_otg_proto_msgTypes[937] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100207,7 +100872,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) String() st func (*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[930] + mi := &file_otg_proto_msgTypes[937] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -100220,7 +100885,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) ProtoReflec // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{930} + return file_otg_proto_rawDescGZIP(), []int{937} } func (x *PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) GetChoice() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice_Enum { @@ -100278,7 +100943,7 @@ type PatternFlowSnmpv2CCommonRequestIdCounter struct { func (x *PatternFlowSnmpv2CCommonRequestIdCounter) Reset() { *x = PatternFlowSnmpv2CCommonRequestIdCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[931] + mi := &file_otg_proto_msgTypes[938] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100291,7 +100956,7 @@ func (x *PatternFlowSnmpv2CCommonRequestIdCounter) String() string { func (*PatternFlowSnmpv2CCommonRequestIdCounter) ProtoMessage() {} func (x *PatternFlowSnmpv2CCommonRequestIdCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[931] + mi := &file_otg_proto_msgTypes[938] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -100304,7 +100969,7 @@ func (x *PatternFlowSnmpv2CCommonRequestIdCounter) ProtoReflect() protoreflect.M // Deprecated: Use PatternFlowSnmpv2CCommonRequestIdCounter.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CCommonRequestIdCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{931} + return file_otg_proto_rawDescGZIP(), []int{938} } func (x *PatternFlowSnmpv2CCommonRequestIdCounter) GetStart() int32 { @@ -100357,7 +101022,7 @@ type PatternFlowSnmpv2CCommonRequestId struct { func (x *PatternFlowSnmpv2CCommonRequestId) Reset() { *x = PatternFlowSnmpv2CCommonRequestId{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[932] + mi := &file_otg_proto_msgTypes[939] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100370,7 +101035,7 @@ func (x *PatternFlowSnmpv2CCommonRequestId) String() string { func (*PatternFlowSnmpv2CCommonRequestId) ProtoMessage() {} func (x *PatternFlowSnmpv2CCommonRequestId) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[932] + mi := &file_otg_proto_msgTypes[939] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -100383,7 +101048,7 @@ func (x *PatternFlowSnmpv2CCommonRequestId) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowSnmpv2CCommonRequestId.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CCommonRequestId) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{932} + return file_otg_proto_rawDescGZIP(), []int{939} } func (x *PatternFlowSnmpv2CCommonRequestId) GetChoice() PatternFlowSnmpv2CCommonRequestId_Choice_Enum { @@ -100442,7 +101107,7 @@ type PatternFlowRsvpRsvpChecksum struct { func (x *PatternFlowRsvpRsvpChecksum) Reset() { *x = PatternFlowRsvpRsvpChecksum{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[933] + mi := &file_otg_proto_msgTypes[940] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100455,7 +101120,7 @@ func (x *PatternFlowRsvpRsvpChecksum) String() string { func (*PatternFlowRsvpRsvpChecksum) ProtoMessage() {} func (x *PatternFlowRsvpRsvpChecksum) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[933] + mi := &file_otg_proto_msgTypes[940] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -100468,7 +101133,7 @@ func (x *PatternFlowRsvpRsvpChecksum) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowRsvpRsvpChecksum.ProtoReflect.Descriptor instead. func (*PatternFlowRsvpRsvpChecksum) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{933} + return file_otg_proto_rawDescGZIP(), []int{940} } func (x *PatternFlowRsvpRsvpChecksum) GetChoice() PatternFlowRsvpRsvpChecksum_Choice_Enum { @@ -100512,7 +101177,7 @@ type PatternFlowRsvpTimeToLiveCounter struct { func (x *PatternFlowRsvpTimeToLiveCounter) Reset() { *x = PatternFlowRsvpTimeToLiveCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[934] + mi := &file_otg_proto_msgTypes[941] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100525,7 +101190,7 @@ func (x *PatternFlowRsvpTimeToLiveCounter) String() string { func (*PatternFlowRsvpTimeToLiveCounter) ProtoMessage() {} func (x *PatternFlowRsvpTimeToLiveCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[934] + mi := &file_otg_proto_msgTypes[941] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -100538,7 +101203,7 @@ func (x *PatternFlowRsvpTimeToLiveCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowRsvpTimeToLiveCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRsvpTimeToLiveCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{934} + return file_otg_proto_rawDescGZIP(), []int{941} } func (x *PatternFlowRsvpTimeToLiveCounter) GetStart() uint32 { @@ -100586,7 +101251,7 @@ type PatternFlowRsvpTimeToLive struct { func (x *PatternFlowRsvpTimeToLive) Reset() { *x = PatternFlowRsvpTimeToLive{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[935] + mi := &file_otg_proto_msgTypes[942] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100599,7 +101264,7 @@ func (x *PatternFlowRsvpTimeToLive) String() string { func (*PatternFlowRsvpTimeToLive) ProtoMessage() {} func (x *PatternFlowRsvpTimeToLive) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[935] + mi := &file_otg_proto_msgTypes[942] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -100612,7 +101277,7 @@ func (x *PatternFlowRsvpTimeToLive) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowRsvpTimeToLive.ProtoReflect.Descriptor instead. func (*PatternFlowRsvpTimeToLive) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{935} + return file_otg_proto_rawDescGZIP(), []int{942} } func (x *PatternFlowRsvpTimeToLive) GetChoice() PatternFlowRsvpTimeToLive_Choice_Enum { @@ -100670,7 +101335,7 @@ type PatternFlowRsvpReservedCounter struct { func (x *PatternFlowRsvpReservedCounter) Reset() { *x = PatternFlowRsvpReservedCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[936] + mi := &file_otg_proto_msgTypes[943] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100683,7 +101348,7 @@ func (x *PatternFlowRsvpReservedCounter) String() string { func (*PatternFlowRsvpReservedCounter) ProtoMessage() {} func (x *PatternFlowRsvpReservedCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[936] + mi := &file_otg_proto_msgTypes[943] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -100696,7 +101361,7 @@ func (x *PatternFlowRsvpReservedCounter) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowRsvpReservedCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRsvpReservedCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{936} + return file_otg_proto_rawDescGZIP(), []int{943} } func (x *PatternFlowRsvpReservedCounter) GetStart() uint32 { @@ -100744,7 +101409,7 @@ type PatternFlowRsvpReserved struct { func (x *PatternFlowRsvpReserved) Reset() { *x = PatternFlowRsvpReserved{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[937] + mi := &file_otg_proto_msgTypes[944] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100757,7 +101422,7 @@ func (x *PatternFlowRsvpReserved) String() string { func (*PatternFlowRsvpReserved) ProtoMessage() {} func (x *PatternFlowRsvpReserved) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[937] + mi := &file_otg_proto_msgTypes[944] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -100770,7 +101435,7 @@ func (x *PatternFlowRsvpReserved) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowRsvpReserved.ProtoReflect.Descriptor instead. func (*PatternFlowRsvpReserved) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{937} + return file_otg_proto_rawDescGZIP(), []int{944} } func (x *PatternFlowRsvpReserved) GetChoice() PatternFlowRsvpReserved_Choice_Enum { @@ -100828,7 +101493,7 @@ type PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter str func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) Reset() { *x = PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[938] + mi := &file_otg_proto_msgTypes[945] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100841,7 +101506,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter func (*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[938] + mi := &file_otg_proto_msgTypes[945] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -100854,7 +101519,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter // Deprecated: Use PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{938} + return file_otg_proto_rawDescGZIP(), []int{945} } func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) GetStart() string { @@ -100902,7 +101567,7 @@ type PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress struct { func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Reset() { *x = PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[939] + mi := &file_otg_proto_msgTypes[946] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100915,7 +101580,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Strin func (*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[939] + mi := &file_otg_proto_msgTypes[946] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -100928,7 +101593,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Proto // Deprecated: Use PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{939} + return file_otg_proto_rawDescGZIP(), []int{946} } func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) GetChoice() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice_Enum { @@ -100986,7 +101651,7 @@ type PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter struct { func (x *PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) Reset() { *x = PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[940] + mi := &file_otg_proto_msgTypes[947] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -100999,7 +101664,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) String() string func (*PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[940] + mi := &file_otg_proto_msgTypes[947] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -101012,7 +101677,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) ProtoReflect() // Deprecated: Use PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{940} + return file_otg_proto_rawDescGZIP(), []int{947} } func (x *PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) GetStart() uint32 { @@ -101060,7 +101725,7 @@ type PatternFlowRSVPPathSessionLspTunnelIpv4Reserved struct { func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) Reset() { *x = PatternFlowRSVPPathSessionLspTunnelIpv4Reserved{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[941] + mi := &file_otg_proto_msgTypes[948] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101073,7 +101738,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) String() string { func (*PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[941] + mi := &file_otg_proto_msgTypes[948] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -101086,7 +101751,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) ProtoReflect() protore // Deprecated: Use PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{941} + return file_otg_proto_rawDescGZIP(), []int{948} } func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) GetChoice() PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice_Enum { @@ -101144,7 +101809,7 @@ type PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter struct { func (x *PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) Reset() { *x = PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[942] + mi := &file_otg_proto_msgTypes[949] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101157,7 +101822,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) String() string func (*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[942] + mi := &file_otg_proto_msgTypes[949] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -101170,7 +101835,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) ProtoReflect() // Deprecated: Use PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{942} + return file_otg_proto_rawDescGZIP(), []int{949} } func (x *PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) GetStart() uint32 { @@ -101219,7 +101884,7 @@ type PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId struct { func (x *PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Reset() { *x = PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[943] + mi := &file_otg_proto_msgTypes[950] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101232,7 +101897,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) String() string { func (*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[943] + mi := &file_otg_proto_msgTypes[950] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -101245,7 +101910,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) ProtoReflect() protore // Deprecated: Use PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{943} + return file_otg_proto_rawDescGZIP(), []int{950} } func (x *PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) GetChoice() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice_Enum { @@ -101303,7 +101968,7 @@ type PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter struct { func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) Reset() { *x = PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[944] + mi := &file_otg_proto_msgTypes[951] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101316,7 +101981,7 @@ func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) String() string func (*PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[944] + mi := &file_otg_proto_msgTypes[951] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -101329,7 +101994,7 @@ func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) ProtoReflect() p // Deprecated: Use PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{944} + return file_otg_proto_rawDescGZIP(), []int{951} } func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) GetStart() uint32 { @@ -101377,7 +102042,7 @@ type PatternFlowRSVPPathSessionExtTunnelIdAsInteger struct { func (x *PatternFlowRSVPPathSessionExtTunnelIdAsInteger) Reset() { *x = PatternFlowRSVPPathSessionExtTunnelIdAsInteger{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[945] + mi := &file_otg_proto_msgTypes[952] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101390,7 +102055,7 @@ func (x *PatternFlowRSVPPathSessionExtTunnelIdAsInteger) String() string { func (*PatternFlowRSVPPathSessionExtTunnelIdAsInteger) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionExtTunnelIdAsInteger) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[945] + mi := &file_otg_proto_msgTypes[952] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -101403,7 +102068,7 @@ func (x *PatternFlowRSVPPathSessionExtTunnelIdAsInteger) ProtoReflect() protoref // Deprecated: Use PatternFlowRSVPPathSessionExtTunnelIdAsInteger.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionExtTunnelIdAsInteger) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{945} + return file_otg_proto_rawDescGZIP(), []int{952} } func (x *PatternFlowRSVPPathSessionExtTunnelIdAsInteger) GetChoice() PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice_Enum { @@ -101461,7 +102126,7 @@ type PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter struct { func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) Reset() { *x = PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[946] + mi := &file_otg_proto_msgTypes[953] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101474,7 +102139,7 @@ func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) String() string { func (*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[946] + mi := &file_otg_proto_msgTypes[953] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -101487,7 +102152,7 @@ func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) ProtoReflect() prot // Deprecated: Use PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{946} + return file_otg_proto_rawDescGZIP(), []int{953} } func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) GetStart() string { @@ -101535,7 +102200,7 @@ type PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 struct { func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) Reset() { *x = PatternFlowRSVPPathSessionExtTunnelIdAsIpv4{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[947] + mi := &file_otg_proto_msgTypes[954] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101548,7 +102213,7 @@ func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) String() string { func (*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[947] + mi := &file_otg_proto_msgTypes[954] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -101561,7 +102226,7 @@ func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) ProtoReflect() protoreflec // Deprecated: Use PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{947} + return file_otg_proto_rawDescGZIP(), []int{954} } func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) GetChoice() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice_Enum { @@ -101619,7 +102284,7 @@ type PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter struct { func (x *PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) Reset() { *x = PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[948] + mi := &file_otg_proto_msgTypes[955] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101632,7 +102297,7 @@ func (x *PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) String() string { func (*PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[948] + mi := &file_otg_proto_msgTypes[955] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -101645,7 +102310,7 @@ func (x *PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) ProtoReflect() protor // Deprecated: Use PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{948} + return file_otg_proto_rawDescGZIP(), []int{955} } func (x *PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) GetStart() string { @@ -101694,7 +102359,7 @@ type PatternFlowRSVPPathRsvpHopIpv4Ipv4Address struct { func (x *PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) Reset() { *x = PatternFlowRSVPPathRsvpHopIpv4Ipv4Address{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[949] + mi := &file_otg_proto_msgTypes[956] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101707,7 +102372,7 @@ func (x *PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) String() string { func (*PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) ProtoMessage() {} func (x *PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[949] + mi := &file_otg_proto_msgTypes[956] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -101720,7 +102385,7 @@ func (x *PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) ProtoReflect() protoreflect. // Deprecated: Use PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{949} + return file_otg_proto_rawDescGZIP(), []int{956} } func (x *PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) GetChoice() PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice_Enum { @@ -101778,7 +102443,7 @@ type PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter struct { func (x *PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) Reset() { *x = PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[950] + mi := &file_otg_proto_msgTypes[957] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101791,7 +102456,7 @@ func (x *PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) String() s func (*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[950] + mi := &file_otg_proto_msgTypes[957] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -101804,7 +102469,7 @@ func (x *PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) ProtoRefle // Deprecated: Use PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{950} + return file_otg_proto_rawDescGZIP(), []int{957} } func (x *PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) GetStart() uint32 { @@ -101855,7 +102520,7 @@ type PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle struct { func (x *PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Reset() { *x = PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[951] + mi := &file_otg_proto_msgTypes[958] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101868,7 +102533,7 @@ func (x *PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) String() string { func (*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) ProtoMessage() {} func (x *PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[951] + mi := &file_otg_proto_msgTypes[958] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -101881,7 +102546,7 @@ func (x *PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) ProtoReflect() pr // Deprecated: Use PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{951} + return file_otg_proto_rawDescGZIP(), []int{958} } func (x *PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) GetChoice() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice_Enum { @@ -101939,7 +102604,7 @@ type PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter struct { func (x *PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) Reset() { *x = PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[952] + mi := &file_otg_proto_msgTypes[959] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101952,7 +102617,7 @@ func (x *PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) String() strin func (*PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[952] + mi := &file_otg_proto_msgTypes[959] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -101965,7 +102630,7 @@ func (x *PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) ProtoReflect() // Deprecated: Use PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{952} + return file_otg_proto_rawDescGZIP(), []int{959} } func (x *PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) GetStart() uint32 { @@ -102013,7 +102678,7 @@ type PatternFlowRSVPPathTimeValuesType1RefreshPeriodR struct { func (x *PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) Reset() { *x = PatternFlowRSVPPathTimeValuesType1RefreshPeriodR{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[953] + mi := &file_otg_proto_msgTypes[960] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102026,7 +102691,7 @@ func (x *PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) String() string { func (*PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) ProtoMessage() {} func (x *PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[953] + mi := &file_otg_proto_msgTypes[960] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -102039,7 +102704,7 @@ func (x *PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) ProtoReflect() protor // Deprecated: Use PatternFlowRSVPPathTimeValuesType1RefreshPeriodR.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{953} + return file_otg_proto_rawDescGZIP(), []int{960} } func (x *PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) GetChoice() PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice_Enum { @@ -102097,7 +102762,7 @@ type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter struct { func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) Reset() { *x = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[954] + mi := &file_otg_proto_msgTypes[961] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102110,7 +102775,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) String() st func (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[954] + mi := &file_otg_proto_msgTypes[961] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -102123,7 +102788,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) ProtoReflec // Deprecated: Use PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{954} + return file_otg_proto_rawDescGZIP(), []int{961} } func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) GetStart() uint32 { @@ -102173,7 +102838,7 @@ type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit struct { func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Reset() { *x = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[955] + mi := &file_otg_proto_msgTypes[962] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102186,7 +102851,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) String() string { func (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) ProtoMessage() {} func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[955] + mi := &file_otg_proto_msgTypes[962] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -102199,7 +102864,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) ProtoReflect() pro // Deprecated: Use PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{955} + return file_otg_proto_rawDescGZIP(), []int{962} } func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) GetChoice() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice_Enum { @@ -102257,7 +102922,7 @@ type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter struct { func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Reset() { *x = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[956] + mi := &file_otg_proto_msgTypes[963] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102270,7 +102935,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Stri func (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[956] + mi := &file_otg_proto_msgTypes[963] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -102283,7 +102948,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Prot // Deprecated: Use PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{956} + return file_otg_proto_rawDescGZIP(), []int{963} } func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) GetStart() string { @@ -102332,7 +102997,7 @@ type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address struct { func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Reset() { *x = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[957] + mi := &file_otg_proto_msgTypes[964] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102345,7 +103010,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) String() st func (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) ProtoMessage() {} func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[957] + mi := &file_otg_proto_msgTypes[964] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -102358,7 +103023,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) ProtoReflec // Deprecated: Use PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{957} + return file_otg_proto_rawDescGZIP(), []int{964} } func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) GetChoice() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice_Enum { @@ -102416,7 +103081,7 @@ type PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter struct { func (x *PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) Reset() { *x = PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[958] + mi := &file_otg_proto_msgTypes[965] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102429,7 +103094,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) String() stri func (*PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[958] + mi := &file_otg_proto_msgTypes[965] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -102442,7 +103107,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) ProtoReflect( // Deprecated: Use PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{958} + return file_otg_proto_rawDescGZIP(), []int{965} } func (x *PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) GetStart() uint32 { @@ -102492,7 +103157,7 @@ type PatternFlowRSVPPathExplicitRouteType1ASNumberLBit struct { func (x *PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) Reset() { *x = PatternFlowRSVPPathExplicitRouteType1ASNumberLBit{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[959] + mi := &file_otg_proto_msgTypes[966] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102505,7 +103170,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) String() string { func (*PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) ProtoMessage() {} func (x *PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[959] + mi := &file_otg_proto_msgTypes[966] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -102518,7 +103183,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) ProtoReflect() proto // Deprecated: Use PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{959} + return file_otg_proto_rawDescGZIP(), []int{966} } func (x *PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) GetChoice() PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice_Enum { @@ -102576,7 +103241,7 @@ type PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter struct { func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) Reset() { *x = PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[960] + mi := &file_otg_proto_msgTypes[967] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102589,7 +103254,7 @@ func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) String func (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[960] + mi := &file_otg_proto_msgTypes[967] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -102602,7 +103267,7 @@ func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) ProtoR // Deprecated: Use PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{960} + return file_otg_proto_rawDescGZIP(), []int{967} } func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) GetStart() uint32 { @@ -102651,7 +103316,7 @@ type PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved struct { func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Reset() { *x = PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[961] + mi := &file_otg_proto_msgTypes[968] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102664,7 +103329,7 @@ func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) String() stri func (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) ProtoMessage() {} func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[961] + mi := &file_otg_proto_msgTypes[968] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -102677,7 +103342,7 @@ func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) ProtoReflect( // Deprecated: Use PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{961} + return file_otg_proto_rawDescGZIP(), []int{968} } func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) GetChoice() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice_Enum { @@ -102735,7 +103400,7 @@ type PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter struct { func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) Reset() { *x = PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[962] + mi := &file_otg_proto_msgTypes[969] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102748,7 +103413,7 @@ func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) String() func (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[962] + mi := &file_otg_proto_msgTypes[969] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -102761,7 +103426,7 @@ func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) ProtoRefl // Deprecated: Use PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{962} + return file_otg_proto_rawDescGZIP(), []int{969} } func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) GetStart() uint32 { @@ -102810,7 +103475,7 @@ type PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid struct { func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Reset() { *x = PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[963] + mi := &file_otg_proto_msgTypes[970] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102823,7 +103488,7 @@ func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) String() string func (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) ProtoMessage() {} func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[963] + mi := &file_otg_proto_msgTypes[970] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -102836,7 +103501,7 @@ func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) ProtoReflect() p // Deprecated: Use PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{963} + return file_otg_proto_rawDescGZIP(), []int{970} } func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) GetChoice() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice_Enum { @@ -102894,7 +103559,7 @@ type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounte func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) Reset() { *x = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[964] + mi := &file_otg_proto_msgTypes[971] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102907,7 +103572,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCo func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[964] + mi := &file_otg_proto_msgTypes[971] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -102920,7 +103585,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCo // Deprecated: Use PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{964} + return file_otg_proto_rawDescGZIP(), []int{971} } func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) GetStart() string { @@ -102968,7 +103633,7 @@ type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress struc func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Reset() { *x = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[965] + mi := &file_otg_proto_msgTypes[972] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -102981,7 +103646,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[965] + mi := &file_otg_proto_msgTypes[972] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -102994,7 +103659,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) // Deprecated: Use PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{965} + return file_otg_proto_rawDescGZIP(), []int{972} } func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) GetChoice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice_Enum { @@ -103052,7 +103717,7 @@ type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter struct { func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) Reset() { *x = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[966] + mi := &file_otg_proto_msgTypes[973] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -103065,7 +103730,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) String() func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[966] + mi := &file_otg_proto_msgTypes[973] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -103078,7 +103743,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) ProtoRef // Deprecated: Use PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{966} + return file_otg_proto_rawDescGZIP(), []int{973} } func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) GetStart() uint32 { @@ -103126,7 +103791,7 @@ type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved struct { func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Reset() { *x = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[967] + mi := &file_otg_proto_msgTypes[974] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -103139,7 +103804,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) String() string func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[967] + mi := &file_otg_proto_msgTypes[974] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -103152,7 +103817,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) ProtoReflect() // Deprecated: Use PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{967} + return file_otg_proto_rawDescGZIP(), []int{974} } func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) GetChoice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice_Enum { @@ -103210,7 +103875,7 @@ type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter struct { func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) Reset() { *x = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[968] + mi := &file_otg_proto_msgTypes[975] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -103223,7 +103888,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) String() st func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[968] + mi := &file_otg_proto_msgTypes[975] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -103236,7 +103901,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) ProtoReflec // Deprecated: Use PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{968} + return file_otg_proto_rawDescGZIP(), []int{975} } func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) GetStart() uint32 { @@ -103285,7 +103950,7 @@ type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId struct { func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Reset() { *x = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[969] + mi := &file_otg_proto_msgTypes[976] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -103298,7 +103963,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) String() string { func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[969] + mi := &file_otg_proto_msgTypes[976] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -103311,7 +103976,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) ProtoReflect() pro // Deprecated: Use PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{969} + return file_otg_proto_rawDescGZIP(), []int{976} } func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) GetChoice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice_Enum { @@ -103369,7 +104034,7 @@ type PatternFlowRSVPPathSenderTspecIntServVersionCounter struct { func (x *PatternFlowRSVPPathSenderTspecIntServVersionCounter) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServVersionCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[970] + mi := &file_otg_proto_msgTypes[977] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -103382,7 +104047,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServVersionCounter) String() string { func (*PatternFlowRSVPPathSenderTspecIntServVersionCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServVersionCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[970] + mi := &file_otg_proto_msgTypes[977] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -103395,7 +104060,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServVersionCounter) ProtoReflect() pro // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServVersionCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServVersionCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{970} + return file_otg_proto_rawDescGZIP(), []int{977} } func (x *PatternFlowRSVPPathSenderTspecIntServVersionCounter) GetStart() uint32 { @@ -103443,7 +104108,7 @@ type PatternFlowRSVPPathSenderTspecIntServVersion struct { func (x *PatternFlowRSVPPathSenderTspecIntServVersion) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServVersion{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[971] + mi := &file_otg_proto_msgTypes[978] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -103456,7 +104121,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServVersion) String() string { func (*PatternFlowRSVPPathSenderTspecIntServVersion) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServVersion) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[971] + mi := &file_otg_proto_msgTypes[978] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -103469,7 +104134,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServVersion) ProtoReflect() protorefle // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServVersion.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServVersion) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{971} + return file_otg_proto_rawDescGZIP(), []int{978} } func (x *PatternFlowRSVPPathSenderTspecIntServVersion) GetChoice() PatternFlowRSVPPathSenderTspecIntServVersion_Choice_Enum { @@ -103527,7 +104192,7 @@ type PatternFlowRSVPPathSenderTspecIntServReserved1Counter struct { func (x *PatternFlowRSVPPathSenderTspecIntServReserved1Counter) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServReserved1Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[972] + mi := &file_otg_proto_msgTypes[979] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -103540,7 +104205,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServReserved1Counter) String() string func (*PatternFlowRSVPPathSenderTspecIntServReserved1Counter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServReserved1Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[972] + mi := &file_otg_proto_msgTypes[979] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -103553,7 +104218,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServReserved1Counter) ProtoReflect() p // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServReserved1Counter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServReserved1Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{972} + return file_otg_proto_rawDescGZIP(), []int{979} } func (x *PatternFlowRSVPPathSenderTspecIntServReserved1Counter) GetStart() uint32 { @@ -103601,7 +104266,7 @@ type PatternFlowRSVPPathSenderTspecIntServReserved1 struct { func (x *PatternFlowRSVPPathSenderTspecIntServReserved1) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServReserved1{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[973] + mi := &file_otg_proto_msgTypes[980] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -103614,7 +104279,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServReserved1) String() string { func (*PatternFlowRSVPPathSenderTspecIntServReserved1) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServReserved1) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[973] + mi := &file_otg_proto_msgTypes[980] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -103627,7 +104292,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServReserved1) ProtoReflect() protoref // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServReserved1.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServReserved1) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{973} + return file_otg_proto_rawDescGZIP(), []int{980} } func (x *PatternFlowRSVPPathSenderTspecIntServReserved1) GetChoice() PatternFlowRSVPPathSenderTspecIntServReserved1_Choice_Enum { @@ -103685,7 +104350,7 @@ type PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter struct { func (x *PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[974] + mi := &file_otg_proto_msgTypes[981] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -103698,7 +104363,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) String() str func (*PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[974] + mi := &file_otg_proto_msgTypes[981] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -103711,7 +104376,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) ProtoReflect // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{974} + return file_otg_proto_rawDescGZIP(), []int{981} } func (x *PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) GetStart() uint32 { @@ -103759,7 +104424,7 @@ type PatternFlowRSVPPathSenderTspecIntServOverallLength struct { func (x *PatternFlowRSVPPathSenderTspecIntServOverallLength) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServOverallLength{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[975] + mi := &file_otg_proto_msgTypes[982] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -103772,7 +104437,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServOverallLength) String() string { func (*PatternFlowRSVPPathSenderTspecIntServOverallLength) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServOverallLength) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[975] + mi := &file_otg_proto_msgTypes[982] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -103785,7 +104450,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServOverallLength) ProtoReflect() prot // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServOverallLength.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServOverallLength) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{975} + return file_otg_proto_rawDescGZIP(), []int{982} } func (x *PatternFlowRSVPPathSenderTspecIntServOverallLength) GetChoice() PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice_Enum { @@ -103843,7 +104508,7 @@ type PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter struct { func (x *PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[976] + mi := &file_otg_proto_msgTypes[983] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -103856,7 +104521,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) String() str func (*PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[976] + mi := &file_otg_proto_msgTypes[983] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -103869,7 +104534,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) ProtoReflect // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{976} + return file_otg_proto_rawDescGZIP(), []int{983} } func (x *PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) GetStart() uint32 { @@ -103917,7 +104582,7 @@ type PatternFlowRSVPPathSenderTspecIntServServiceHeader struct { func (x *PatternFlowRSVPPathSenderTspecIntServServiceHeader) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServServiceHeader{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[977] + mi := &file_otg_proto_msgTypes[984] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -103930,7 +104595,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServServiceHeader) String() string { func (*PatternFlowRSVPPathSenderTspecIntServServiceHeader) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServServiceHeader) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[977] + mi := &file_otg_proto_msgTypes[984] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -103943,7 +104608,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServServiceHeader) ProtoReflect() prot // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServServiceHeader.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServServiceHeader) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{977} + return file_otg_proto_rawDescGZIP(), []int{984} } func (x *PatternFlowRSVPPathSenderTspecIntServServiceHeader) GetChoice() PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice_Enum { @@ -104001,7 +104666,7 @@ type PatternFlowRSVPPathSenderTspecIntServZeroBitCounter struct { func (x *PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServZeroBitCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[978] + mi := &file_otg_proto_msgTypes[985] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -104014,7 +104679,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) String() string { func (*PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[978] + mi := &file_otg_proto_msgTypes[985] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -104027,7 +104692,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) ProtoReflect() pro // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServZeroBitCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{978} + return file_otg_proto_rawDescGZIP(), []int{985} } func (x *PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) GetStart() uint32 { @@ -104075,7 +104740,7 @@ type PatternFlowRSVPPathSenderTspecIntServZeroBit struct { func (x *PatternFlowRSVPPathSenderTspecIntServZeroBit) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServZeroBit{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[979] + mi := &file_otg_proto_msgTypes[986] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -104088,7 +104753,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServZeroBit) String() string { func (*PatternFlowRSVPPathSenderTspecIntServZeroBit) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServZeroBit) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[979] + mi := &file_otg_proto_msgTypes[986] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -104101,7 +104766,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServZeroBit) ProtoReflect() protorefle // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServZeroBit.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServZeroBit) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{979} + return file_otg_proto_rawDescGZIP(), []int{986} } func (x *PatternFlowRSVPPathSenderTspecIntServZeroBit) GetChoice() PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice_Enum { @@ -104159,7 +104824,7 @@ type PatternFlowRSVPPathSenderTspecIntServReserved2Counter struct { func (x *PatternFlowRSVPPathSenderTspecIntServReserved2Counter) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServReserved2Counter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[980] + mi := &file_otg_proto_msgTypes[987] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -104172,7 +104837,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServReserved2Counter) String() string func (*PatternFlowRSVPPathSenderTspecIntServReserved2Counter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServReserved2Counter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[980] + mi := &file_otg_proto_msgTypes[987] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -104185,7 +104850,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServReserved2Counter) ProtoReflect() p // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServReserved2Counter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServReserved2Counter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{980} + return file_otg_proto_rawDescGZIP(), []int{987} } func (x *PatternFlowRSVPPathSenderTspecIntServReserved2Counter) GetStart() uint32 { @@ -104233,7 +104898,7 @@ type PatternFlowRSVPPathSenderTspecIntServReserved2 struct { func (x *PatternFlowRSVPPathSenderTspecIntServReserved2) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServReserved2{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[981] + mi := &file_otg_proto_msgTypes[988] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -104246,7 +104911,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServReserved2) String() string { func (*PatternFlowRSVPPathSenderTspecIntServReserved2) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServReserved2) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[981] + mi := &file_otg_proto_msgTypes[988] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -104259,7 +104924,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServReserved2) ProtoReflect() protoref // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServReserved2.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServReserved2) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{981} + return file_otg_proto_rawDescGZIP(), []int{988} } func (x *PatternFlowRSVPPathSenderTspecIntServReserved2) GetChoice() PatternFlowRSVPPathSenderTspecIntServReserved2_Choice_Enum { @@ -104317,7 +104982,7 @@ type PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter struct { func (x *PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[982] + mi := &file_otg_proto_msgTypes[989] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -104330,7 +104995,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) String func (*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[982] + mi := &file_otg_proto_msgTypes[989] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -104343,7 +105008,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) ProtoR // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{982} + return file_otg_proto_rawDescGZIP(), []int{989} } func (x *PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) GetStart() uint32 { @@ -104391,7 +105056,7 @@ type PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData struct { func (x *PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[983] + mi := &file_otg_proto_msgTypes[990] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -104404,7 +105069,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) String() stri func (*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[983] + mi := &file_otg_proto_msgTypes[990] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -104417,7 +105082,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) ProtoReflect( // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{983} + return file_otg_proto_rawDescGZIP(), []int{990} } func (x *PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) GetChoice() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice_Enum { @@ -104475,7 +105140,7 @@ type PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter str func (x *PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[984] + mi := &file_otg_proto_msgTypes[991] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -104488,7 +105153,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter func (*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[984] + mi := &file_otg_proto_msgTypes[991] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -104501,7 +105166,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{984} + return file_otg_proto_rawDescGZIP(), []int{991} } func (x *PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) GetStart() uint32 { @@ -104549,7 +105214,7 @@ type PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec struct { func (x *PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[985] + mi := &file_otg_proto_msgTypes[992] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -104562,7 +105227,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Strin func (*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[985] + mi := &file_otg_proto_msgTypes[992] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -104575,7 +105240,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Proto // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{985} + return file_otg_proto_rawDescGZIP(), []int{992} } func (x *PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) GetChoice() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice_Enum { @@ -104633,7 +105298,7 @@ type PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter struct { func (x *PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[986] + mi := &file_otg_proto_msgTypes[993] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -104646,7 +105311,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) String() func (*PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[986] + mi := &file_otg_proto_msgTypes[993] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -104659,7 +105324,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) ProtoRefl // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{986} + return file_otg_proto_rawDescGZIP(), []int{993} } func (x *PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) GetStart() uint32 { @@ -104707,7 +105372,7 @@ type PatternFlowRSVPPathSenderTspecIntServParameter127Flag struct { func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Flag) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServParameter127Flag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[987] + mi := &file_otg_proto_msgTypes[994] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -104720,7 +105385,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Flag) String() string func (*PatternFlowRSVPPathSenderTspecIntServParameter127Flag) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Flag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[987] + mi := &file_otg_proto_msgTypes[994] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -104733,7 +105398,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Flag) ProtoReflect() p // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServParameter127Flag.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServParameter127Flag) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{987} + return file_otg_proto_rawDescGZIP(), []int{994} } func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Flag) GetChoice() PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice_Enum { @@ -104791,7 +105456,7 @@ type PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter struct { func (x *PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[988] + mi := &file_otg_proto_msgTypes[995] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -104804,7 +105469,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) String( func (*PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[988] + mi := &file_otg_proto_msgTypes[995] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -104817,7 +105482,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) ProtoRe // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{988} + return file_otg_proto_rawDescGZIP(), []int{995} } func (x *PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) GetStart() uint32 { @@ -104865,7 +105530,7 @@ type PatternFlowRSVPPathSenderTspecIntServParameter127Length struct { func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Length) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServParameter127Length{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[989] + mi := &file_otg_proto_msgTypes[996] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -104878,7 +105543,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Length) String() strin func (*PatternFlowRSVPPathSenderTspecIntServParameter127Length) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Length) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[989] + mi := &file_otg_proto_msgTypes[996] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -104891,7 +105556,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Length) ProtoReflect() // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServParameter127Length.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServParameter127Length) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{989} + return file_otg_proto_rawDescGZIP(), []int{996} } func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Length) GetChoice() PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice_Enum { @@ -104949,7 +105614,7 @@ type PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter struct { func (x *PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[990] + mi := &file_otg_proto_msgTypes[997] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -104962,7 +105627,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) String( func (*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[990] + mi := &file_otg_proto_msgTypes[997] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -104975,7 +105640,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) ProtoRe // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{990} + return file_otg_proto_rawDescGZIP(), []int{997} } func (x *PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) GetStart() uint32 { @@ -105024,7 +105689,7 @@ type PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit struct { func (x *PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[991] + mi := &file_otg_proto_msgTypes[998] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -105037,7 +105702,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) String() strin func (*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[991] + mi := &file_otg_proto_msgTypes[998] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105050,7 +105715,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) ProtoReflect() // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{991} + return file_otg_proto_rawDescGZIP(), []int{998} } func (x *PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) GetChoice() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice_Enum { @@ -105108,7 +105773,7 @@ type PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter struct { func (x *PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[992] + mi := &file_otg_proto_msgTypes[999] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -105121,7 +105786,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) String() func (*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[992] + mi := &file_otg_proto_msgTypes[999] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105134,7 +105799,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) ProtoRef // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{992} + return file_otg_proto_rawDescGZIP(), []int{999} } func (x *PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) GetStart() uint32 { @@ -105184,7 +105849,7 @@ type PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize struct { func (x *PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[993] + mi := &file_otg_proto_msgTypes[1000] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -105197,7 +105862,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) String() string func (*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[993] + mi := &file_otg_proto_msgTypes[1000] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105210,7 +105875,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) ProtoReflect() // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{993} + return file_otg_proto_rawDescGZIP(), []int{1000} } func (x *PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) GetChoice() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice_Enum { @@ -105268,7 +105933,7 @@ type PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter struct { func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Reset() { *x = PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[994] + mi := &file_otg_proto_msgTypes[1001] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -105281,7 +105946,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Strin func (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[994] + mi := &file_otg_proto_msgTypes[1001] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105294,7 +105959,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Proto // Deprecated: Use PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{994} + return file_otg_proto_rawDescGZIP(), []int{1001} } func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) GetStart() string { @@ -105343,7 +106008,7 @@ type PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address struct { func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Reset() { *x = PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[995] + mi := &file_otg_proto_msgTypes[1002] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -105356,7 +106021,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) String() str func (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) ProtoMessage() {} func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[995] + mi := &file_otg_proto_msgTypes[1002] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105369,7 +106034,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) ProtoReflect // Deprecated: Use PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{995} + return file_otg_proto_rawDescGZIP(), []int{1002} } func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) GetChoice() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice_Enum { @@ -105427,7 +106092,7 @@ type PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter struct { func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Reset() { *x = PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[996] + mi := &file_otg_proto_msgTypes[1003] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -105440,7 +106105,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Stri func (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[996] + mi := &file_otg_proto_msgTypes[1003] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105453,7 +106118,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Prot // Deprecated: Use PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{996} + return file_otg_proto_rawDescGZIP(), []int{1003} } func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) GetStart() uint32 { @@ -105501,7 +106166,7 @@ type PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength struct { func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Reset() { *x = PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[997] + mi := &file_otg_proto_msgTypes[1004] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -105514,7 +106179,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) String() st func (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) ProtoMessage() {} func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[997] + mi := &file_otg_proto_msgTypes[1004] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105527,7 +106192,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) ProtoReflec // Deprecated: Use PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{997} + return file_otg_proto_rawDescGZIP(), []int{1004} } func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) GetChoice() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice_Enum { @@ -105586,7 +106251,7 @@ type PatternFlowRSVPPathRecordRouteType1LabelFlags struct { func (x *PatternFlowRSVPPathRecordRouteType1LabelFlags) Reset() { *x = PatternFlowRSVPPathRecordRouteType1LabelFlags{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[998] + mi := &file_otg_proto_msgTypes[1005] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -105599,7 +106264,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1LabelFlags) String() string { func (*PatternFlowRSVPPathRecordRouteType1LabelFlags) ProtoMessage() {} func (x *PatternFlowRSVPPathRecordRouteType1LabelFlags) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[998] + mi := &file_otg_proto_msgTypes[1005] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105612,7 +106277,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1LabelFlags) ProtoReflect() protorefl // Deprecated: Use PatternFlowRSVPPathRecordRouteType1LabelFlags.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRecordRouteType1LabelFlags) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{998} + return file_otg_proto_rawDescGZIP(), []int{1005} } func (x *PatternFlowRSVPPathRecordRouteType1LabelFlags) GetChoice() PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice_Enum { @@ -105656,7 +106321,7 @@ type PatternFlowRSVPPathRecordRouteType1LabelCType struct { func (x *PatternFlowRSVPPathRecordRouteType1LabelCType) Reset() { *x = PatternFlowRSVPPathRecordRouteType1LabelCType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[999] + mi := &file_otg_proto_msgTypes[1006] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -105669,7 +106334,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1LabelCType) String() string { func (*PatternFlowRSVPPathRecordRouteType1LabelCType) ProtoMessage() {} func (x *PatternFlowRSVPPathRecordRouteType1LabelCType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[999] + mi := &file_otg_proto_msgTypes[1006] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105682,7 +106347,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1LabelCType) ProtoReflect() protorefl // Deprecated: Use PatternFlowRSVPPathRecordRouteType1LabelCType.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRecordRouteType1LabelCType) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{999} + return file_otg_proto_rawDescGZIP(), []int{1006} } func (x *PatternFlowRSVPPathRecordRouteType1LabelCType) GetChoice() PatternFlowRSVPPathRecordRouteType1LabelCType_Choice_Enum { @@ -105726,7 +106391,7 @@ type PatternFlowRSVPPathObjectsCustomTypeCounter struct { func (x *PatternFlowRSVPPathObjectsCustomTypeCounter) Reset() { *x = PatternFlowRSVPPathObjectsCustomTypeCounter{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1000] + mi := &file_otg_proto_msgTypes[1007] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -105739,7 +106404,7 @@ func (x *PatternFlowRSVPPathObjectsCustomTypeCounter) String() string { func (*PatternFlowRSVPPathObjectsCustomTypeCounter) ProtoMessage() {} func (x *PatternFlowRSVPPathObjectsCustomTypeCounter) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1000] + mi := &file_otg_proto_msgTypes[1007] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105752,7 +106417,7 @@ func (x *PatternFlowRSVPPathObjectsCustomTypeCounter) ProtoReflect() protoreflec // Deprecated: Use PatternFlowRSVPPathObjectsCustomTypeCounter.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathObjectsCustomTypeCounter) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1000} + return file_otg_proto_rawDescGZIP(), []int{1007} } func (x *PatternFlowRSVPPathObjectsCustomTypeCounter) GetStart() uint32 { @@ -105800,7 +106465,7 @@ type PatternFlowRSVPPathObjectsCustomType struct { func (x *PatternFlowRSVPPathObjectsCustomType) Reset() { *x = PatternFlowRSVPPathObjectsCustomType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1001] + mi := &file_otg_proto_msgTypes[1008] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -105813,7 +106478,7 @@ func (x *PatternFlowRSVPPathObjectsCustomType) String() string { func (*PatternFlowRSVPPathObjectsCustomType) ProtoMessage() {} func (x *PatternFlowRSVPPathObjectsCustomType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1001] + mi := &file_otg_proto_msgTypes[1008] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105826,7 +106491,7 @@ func (x *PatternFlowRSVPPathObjectsCustomType) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowRSVPPathObjectsCustomType.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathObjectsCustomType) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1001} + return file_otg_proto_rawDescGZIP(), []int{1008} } func (x *PatternFlowRSVPPathObjectsCustomType) GetChoice() PatternFlowRSVPPathObjectsCustomType_Choice_Enum { @@ -105884,7 +106549,7 @@ type Version struct { func (x *Version) Reset() { *x = Version{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1002] + mi := &file_otg_proto_msgTypes[1009] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -105897,7 +106562,7 @@ func (x *Version) String() string { func (*Version) ProtoMessage() {} func (x *Version) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1002] + mi := &file_otg_proto_msgTypes[1009] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105910,7 +106575,7 @@ func (x *Version) ProtoReflect() protoreflect.Message { // Deprecated: Use Version.ProtoReflect.Descriptor instead. func (*Version) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1002} + return file_otg_proto_rawDescGZIP(), []int{1009} } func (x *Version) GetApiSpecVersion() string { @@ -105947,7 +106612,7 @@ type Success struct { func (x *Success) Reset() { *x = Success{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1003] + mi := &file_otg_proto_msgTypes[1010] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -105960,7 +106625,7 @@ func (x *Success) String() string { func (*Success) ProtoMessage() {} func (x *Success) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1003] + mi := &file_otg_proto_msgTypes[1010] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -105973,7 +106638,7 @@ func (x *Success) ProtoReflect() protoreflect.Message { // Deprecated: Use Success.ProtoReflect.Descriptor instead. func (*Success) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1003} + return file_otg_proto_rawDescGZIP(), []int{1010} } func (x *Success) GetWarning() *Warning { @@ -105995,7 +106660,7 @@ type Failure struct { func (x *Failure) Reset() { *x = Failure{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1004] + mi := &file_otg_proto_msgTypes[1011] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106008,7 +106673,7 @@ func (x *Failure) String() string { func (*Failure) ProtoMessage() {} func (x *Failure) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1004] + mi := &file_otg_proto_msgTypes[1011] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106021,7 +106686,7 @@ func (x *Failure) ProtoReflect() protoreflect.Message { // Deprecated: Use Failure.ProtoReflect.Descriptor instead. func (*Failure) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1004} + return file_otg_proto_rawDescGZIP(), []int{1011} } func (x *Failure) GetError() *Error { @@ -106042,7 +106707,7 @@ type SetConfigRequest struct { func (x *SetConfigRequest) Reset() { *x = SetConfigRequest{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1005] + mi := &file_otg_proto_msgTypes[1012] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106055,7 +106720,7 @@ func (x *SetConfigRequest) String() string { func (*SetConfigRequest) ProtoMessage() {} func (x *SetConfigRequest) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1005] + mi := &file_otg_proto_msgTypes[1012] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106068,7 +106733,7 @@ func (x *SetConfigRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SetConfigRequest.ProtoReflect.Descriptor instead. func (*SetConfigRequest) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1005} + return file_otg_proto_rawDescGZIP(), []int{1012} } func (x *SetConfigRequest) GetConfig() *Config { @@ -106089,7 +106754,7 @@ type UpdateConfigRequest struct { func (x *UpdateConfigRequest) Reset() { *x = UpdateConfigRequest{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1006] + mi := &file_otg_proto_msgTypes[1013] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106102,7 +106767,7 @@ func (x *UpdateConfigRequest) String() string { func (*UpdateConfigRequest) ProtoMessage() {} func (x *UpdateConfigRequest) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1006] + mi := &file_otg_proto_msgTypes[1013] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106115,7 +106780,7 @@ func (x *UpdateConfigRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateConfigRequest.ProtoReflect.Descriptor instead. func (*UpdateConfigRequest) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1006} + return file_otg_proto_rawDescGZIP(), []int{1013} } func (x *UpdateConfigRequest) GetConfigUpdate() *ConfigUpdate { @@ -106136,7 +106801,7 @@ type SetConfigResponse struct { func (x *SetConfigResponse) Reset() { *x = SetConfigResponse{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1007] + mi := &file_otg_proto_msgTypes[1014] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106149,7 +106814,7 @@ func (x *SetConfigResponse) String() string { func (*SetConfigResponse) ProtoMessage() {} func (x *SetConfigResponse) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1007] + mi := &file_otg_proto_msgTypes[1014] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106162,7 +106827,7 @@ func (x *SetConfigResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SetConfigResponse.ProtoReflect.Descriptor instead. func (*SetConfigResponse) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1007} + return file_otg_proto_rawDescGZIP(), []int{1014} } func (x *SetConfigResponse) GetWarning() *Warning { @@ -106183,7 +106848,7 @@ type GetConfigResponse struct { func (x *GetConfigResponse) Reset() { *x = GetConfigResponse{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1008] + mi := &file_otg_proto_msgTypes[1015] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106196,7 +106861,7 @@ func (x *GetConfigResponse) String() string { func (*GetConfigResponse) ProtoMessage() {} func (x *GetConfigResponse) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1008] + mi := &file_otg_proto_msgTypes[1015] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106209,7 +106874,7 @@ func (x *GetConfigResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetConfigResponse.ProtoReflect.Descriptor instead. func (*GetConfigResponse) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1008} + return file_otg_proto_rawDescGZIP(), []int{1015} } func (x *GetConfigResponse) GetConfig() *Config { @@ -106230,7 +106895,7 @@ type UpdateConfigResponse struct { func (x *UpdateConfigResponse) Reset() { *x = UpdateConfigResponse{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1009] + mi := &file_otg_proto_msgTypes[1016] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106243,7 +106908,7 @@ func (x *UpdateConfigResponse) String() string { func (*UpdateConfigResponse) ProtoMessage() {} func (x *UpdateConfigResponse) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1009] + mi := &file_otg_proto_msgTypes[1016] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106256,7 +106921,7 @@ func (x *UpdateConfigResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UpdateConfigResponse.ProtoReflect.Descriptor instead. func (*UpdateConfigResponse) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1009} + return file_otg_proto_rawDescGZIP(), []int{1016} } func (x *UpdateConfigResponse) GetWarning() *Warning { @@ -106277,7 +106942,7 @@ type SetControlStateRequest struct { func (x *SetControlStateRequest) Reset() { *x = SetControlStateRequest{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1010] + mi := &file_otg_proto_msgTypes[1017] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106290,7 +106955,7 @@ func (x *SetControlStateRequest) String() string { func (*SetControlStateRequest) ProtoMessage() {} func (x *SetControlStateRequest) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1010] + mi := &file_otg_proto_msgTypes[1017] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106303,7 +106968,7 @@ func (x *SetControlStateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SetControlStateRequest.ProtoReflect.Descriptor instead. func (*SetControlStateRequest) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1010} + return file_otg_proto_rawDescGZIP(), []int{1017} } func (x *SetControlStateRequest) GetControlState() *ControlState { @@ -106324,7 +106989,7 @@ type SetControlStateResponse struct { func (x *SetControlStateResponse) Reset() { *x = SetControlStateResponse{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1011] + mi := &file_otg_proto_msgTypes[1018] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106337,7 +107002,7 @@ func (x *SetControlStateResponse) String() string { func (*SetControlStateResponse) ProtoMessage() {} func (x *SetControlStateResponse) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1011] + mi := &file_otg_proto_msgTypes[1018] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106350,7 +107015,7 @@ func (x *SetControlStateResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SetControlStateResponse.ProtoReflect.Descriptor instead. func (*SetControlStateResponse) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1011} + return file_otg_proto_rawDescGZIP(), []int{1018} } func (x *SetControlStateResponse) GetWarning() *Warning { @@ -106371,7 +107036,7 @@ type SetControlActionRequest struct { func (x *SetControlActionRequest) Reset() { *x = SetControlActionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1012] + mi := &file_otg_proto_msgTypes[1019] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106384,7 +107049,7 @@ func (x *SetControlActionRequest) String() string { func (*SetControlActionRequest) ProtoMessage() {} func (x *SetControlActionRequest) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1012] + mi := &file_otg_proto_msgTypes[1019] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106397,7 +107062,7 @@ func (x *SetControlActionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SetControlActionRequest.ProtoReflect.Descriptor instead. func (*SetControlActionRequest) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1012} + return file_otg_proto_rawDescGZIP(), []int{1019} } func (x *SetControlActionRequest) GetControlAction() *ControlAction { @@ -106418,7 +107083,7 @@ type SetControlActionResponse struct { func (x *SetControlActionResponse) Reset() { *x = SetControlActionResponse{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1013] + mi := &file_otg_proto_msgTypes[1020] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106431,7 +107096,7 @@ func (x *SetControlActionResponse) String() string { func (*SetControlActionResponse) ProtoMessage() {} func (x *SetControlActionResponse) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1013] + mi := &file_otg_proto_msgTypes[1020] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106444,7 +107109,7 @@ func (x *SetControlActionResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use SetControlActionResponse.ProtoReflect.Descriptor instead. func (*SetControlActionResponse) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1013} + return file_otg_proto_rawDescGZIP(), []int{1020} } func (x *SetControlActionResponse) GetControlActionResponse() *ControlActionResponse { @@ -106465,7 +107130,7 @@ type GetMetricsRequest struct { func (x *GetMetricsRequest) Reset() { *x = GetMetricsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1014] + mi := &file_otg_proto_msgTypes[1021] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106478,7 +107143,7 @@ func (x *GetMetricsRequest) String() string { func (*GetMetricsRequest) ProtoMessage() {} func (x *GetMetricsRequest) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1014] + mi := &file_otg_proto_msgTypes[1021] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106491,7 +107156,7 @@ func (x *GetMetricsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetMetricsRequest.ProtoReflect.Descriptor instead. func (*GetMetricsRequest) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1014} + return file_otg_proto_rawDescGZIP(), []int{1021} } func (x *GetMetricsRequest) GetMetricsRequest() *MetricsRequest { @@ -106512,7 +107177,7 @@ type GetMetricsResponse struct { func (x *GetMetricsResponse) Reset() { *x = GetMetricsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1015] + mi := &file_otg_proto_msgTypes[1022] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106525,7 +107190,7 @@ func (x *GetMetricsResponse) String() string { func (*GetMetricsResponse) ProtoMessage() {} func (x *GetMetricsResponse) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1015] + mi := &file_otg_proto_msgTypes[1022] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106538,7 +107203,7 @@ func (x *GetMetricsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetMetricsResponse.ProtoReflect.Descriptor instead. func (*GetMetricsResponse) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1015} + return file_otg_proto_rawDescGZIP(), []int{1022} } func (x *GetMetricsResponse) GetMetricsResponse() *MetricsResponse { @@ -106559,7 +107224,7 @@ type GetStatesRequest struct { func (x *GetStatesRequest) Reset() { *x = GetStatesRequest{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1016] + mi := &file_otg_proto_msgTypes[1023] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106572,7 +107237,7 @@ func (x *GetStatesRequest) String() string { func (*GetStatesRequest) ProtoMessage() {} func (x *GetStatesRequest) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1016] + mi := &file_otg_proto_msgTypes[1023] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106585,7 +107250,7 @@ func (x *GetStatesRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetStatesRequest.ProtoReflect.Descriptor instead. func (*GetStatesRequest) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1016} + return file_otg_proto_rawDescGZIP(), []int{1023} } func (x *GetStatesRequest) GetStatesRequest() *StatesRequest { @@ -106606,7 +107271,7 @@ type GetStatesResponse struct { func (x *GetStatesResponse) Reset() { *x = GetStatesResponse{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1017] + mi := &file_otg_proto_msgTypes[1024] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106619,7 +107284,7 @@ func (x *GetStatesResponse) String() string { func (*GetStatesResponse) ProtoMessage() {} func (x *GetStatesResponse) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1017] + mi := &file_otg_proto_msgTypes[1024] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106632,7 +107297,7 @@ func (x *GetStatesResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetStatesResponse.ProtoReflect.Descriptor instead. func (*GetStatesResponse) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1017} + return file_otg_proto_rawDescGZIP(), []int{1024} } func (x *GetStatesResponse) GetStatesResponse() *StatesResponse { @@ -106653,7 +107318,7 @@ type GetCaptureRequest struct { func (x *GetCaptureRequest) Reset() { *x = GetCaptureRequest{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1018] + mi := &file_otg_proto_msgTypes[1025] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106666,7 +107331,7 @@ func (x *GetCaptureRequest) String() string { func (*GetCaptureRequest) ProtoMessage() {} func (x *GetCaptureRequest) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1018] + mi := &file_otg_proto_msgTypes[1025] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106679,7 +107344,7 @@ func (x *GetCaptureRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetCaptureRequest.ProtoReflect.Descriptor instead. func (*GetCaptureRequest) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1018} + return file_otg_proto_rawDescGZIP(), []int{1025} } func (x *GetCaptureRequest) GetCaptureRequest() *CaptureRequest { @@ -106700,7 +107365,7 @@ type GetCaptureResponse struct { func (x *GetCaptureResponse) Reset() { *x = GetCaptureResponse{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1019] + mi := &file_otg_proto_msgTypes[1026] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106713,7 +107378,7 @@ func (x *GetCaptureResponse) String() string { func (*GetCaptureResponse) ProtoMessage() {} func (x *GetCaptureResponse) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1019] + mi := &file_otg_proto_msgTypes[1026] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106726,7 +107391,7 @@ func (x *GetCaptureResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetCaptureResponse.ProtoReflect.Descriptor instead. func (*GetCaptureResponse) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1019} + return file_otg_proto_rawDescGZIP(), []int{1026} } func (x *GetCaptureResponse) GetResponseBytes() []byte { @@ -106747,7 +107412,7 @@ type GetVersionResponse struct { func (x *GetVersionResponse) Reset() { *x = GetVersionResponse{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1020] + mi := &file_otg_proto_msgTypes[1027] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106760,7 +107425,7 @@ func (x *GetVersionResponse) String() string { func (*GetVersionResponse) ProtoMessage() {} func (x *GetVersionResponse) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1020] + mi := &file_otg_proto_msgTypes[1027] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106773,7 +107438,7 @@ func (x *GetVersionResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetVersionResponse.ProtoReflect.Descriptor instead. func (*GetVersionResponse) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1020} + return file_otg_proto_rawDescGZIP(), []int{1027} } func (x *GetVersionResponse) GetVersion() *Version { @@ -106792,7 +107457,7 @@ type LagProtocol_Choice struct { func (x *LagProtocol_Choice) Reset() { *x = LagProtocol_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1021] + mi := &file_otg_proto_msgTypes[1028] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106805,7 +107470,7 @@ func (x *LagProtocol_Choice) String() string { func (*LagProtocol_Choice) ProtoMessage() {} func (x *LagProtocol_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1021] + mi := &file_otg_proto_msgTypes[1028] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106830,7 +107495,7 @@ type LagPortLacp_ActorActivity struct { func (x *LagPortLacp_ActorActivity) Reset() { *x = LagPortLacp_ActorActivity{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1022] + mi := &file_otg_proto_msgTypes[1029] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106843,7 +107508,7 @@ func (x *LagPortLacp_ActorActivity) String() string { func (*LagPortLacp_ActorActivity) ProtoMessage() {} func (x *LagPortLacp_ActorActivity) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1022] + mi := &file_otg_proto_msgTypes[1029] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106868,7 +107533,7 @@ type EthernetConnection_Choice struct { func (x *EthernetConnection_Choice) Reset() { *x = EthernetConnection_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1023] + mi := &file_otg_proto_msgTypes[1030] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106881,7 +107546,7 @@ func (x *EthernetConnection_Choice) String() string { func (*EthernetConnection_Choice) ProtoMessage() {} func (x *EthernetConnection_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1023] + mi := &file_otg_proto_msgTypes[1030] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106906,7 +107571,7 @@ type DeviceVlan_Tpid struct { func (x *DeviceVlan_Tpid) Reset() { *x = DeviceVlan_Tpid{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1024] + mi := &file_otg_proto_msgTypes[1031] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106919,7 +107584,7 @@ func (x *DeviceVlan_Tpid) String() string { func (*DeviceVlan_Tpid) ProtoMessage() {} func (x *DeviceVlan_Tpid) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1024] + mi := &file_otg_proto_msgTypes[1031] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106944,7 +107609,7 @@ type DeviceIpv4GatewayMAC_Choice struct { func (x *DeviceIpv4GatewayMAC_Choice) Reset() { *x = DeviceIpv4GatewayMAC_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1025] + mi := &file_otg_proto_msgTypes[1032] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106957,7 +107622,7 @@ func (x *DeviceIpv4GatewayMAC_Choice) String() string { func (*DeviceIpv4GatewayMAC_Choice) ProtoMessage() {} func (x *DeviceIpv4GatewayMAC_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1025] + mi := &file_otg_proto_msgTypes[1032] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106982,7 +107647,7 @@ type DeviceIpv6GatewayMAC_Choice struct { func (x *DeviceIpv6GatewayMAC_Choice) Reset() { *x = DeviceIpv6GatewayMAC_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1026] + mi := &file_otg_proto_msgTypes[1033] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -106995,7 +107660,7 @@ func (x *DeviceIpv6GatewayMAC_Choice) String() string { func (*DeviceIpv6GatewayMAC_Choice) ProtoMessage() {} func (x *DeviceIpv6GatewayMAC_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1026] + mi := &file_otg_proto_msgTypes[1033] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107020,7 +107685,7 @@ type DeviceDhcpv4Client_Choice struct { func (x *DeviceDhcpv4Client_Choice) Reset() { *x = DeviceDhcpv4Client_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1027] + mi := &file_otg_proto_msgTypes[1034] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107033,7 +107698,7 @@ func (x *DeviceDhcpv4Client_Choice) String() string { func (*DeviceDhcpv4Client_Choice) ProtoMessage() {} func (x *DeviceDhcpv4Client_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1027] + mi := &file_otg_proto_msgTypes[1034] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107058,7 +107723,7 @@ type Layer1_Speed struct { func (x *Layer1_Speed) Reset() { *x = Layer1_Speed{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1028] + mi := &file_otg_proto_msgTypes[1035] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107071,7 +107736,7 @@ func (x *Layer1_Speed) String() string { func (*Layer1_Speed) ProtoMessage() {} func (x *Layer1_Speed) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1028] + mi := &file_otg_proto_msgTypes[1035] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107096,7 +107761,7 @@ type Layer1_Media struct { func (x *Layer1_Media) Reset() { *x = Layer1_Media{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1029] + mi := &file_otg_proto_msgTypes[1036] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107109,7 +107774,7 @@ func (x *Layer1_Media) String() string { func (*Layer1_Media) ProtoMessage() {} func (x *Layer1_Media) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1029] + mi := &file_otg_proto_msgTypes[1036] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107134,7 +107799,7 @@ type Layer1FlowControl_Choice struct { func (x *Layer1FlowControl_Choice) Reset() { *x = Layer1FlowControl_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1030] + mi := &file_otg_proto_msgTypes[1037] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107147,7 +107812,7 @@ func (x *Layer1FlowControl_Choice) String() string { func (*Layer1FlowControl_Choice) ProtoMessage() {} func (x *Layer1FlowControl_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1030] + mi := &file_otg_proto_msgTypes[1037] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107172,7 +107837,7 @@ type Capture_Format struct { func (x *Capture_Format) Reset() { *x = Capture_Format{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1031] + mi := &file_otg_proto_msgTypes[1038] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107185,7 +107850,7 @@ func (x *Capture_Format) String() string { func (*Capture_Format) ProtoMessage() {} func (x *Capture_Format) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1031] + mi := &file_otg_proto_msgTypes[1038] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107210,7 +107875,7 @@ type CaptureFilter_Choice struct { func (x *CaptureFilter_Choice) Reset() { *x = CaptureFilter_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1032] + mi := &file_otg_proto_msgTypes[1039] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107223,7 +107888,7 @@ func (x *CaptureFilter_Choice) String() string { func (*CaptureFilter_Choice) ProtoMessage() {} func (x *CaptureFilter_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1032] + mi := &file_otg_proto_msgTypes[1039] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107248,7 +107913,7 @@ type IsisInterface_NetworkType struct { func (x *IsisInterface_NetworkType) Reset() { *x = IsisInterface_NetworkType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1033] + mi := &file_otg_proto_msgTypes[1040] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107261,7 +107926,7 @@ func (x *IsisInterface_NetworkType) String() string { func (*IsisInterface_NetworkType) ProtoMessage() {} func (x *IsisInterface_NetworkType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1033] + mi := &file_otg_proto_msgTypes[1040] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107286,7 +107951,7 @@ type IsisInterface_LevelType struct { func (x *IsisInterface_LevelType) Reset() { *x = IsisInterface_LevelType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1034] + mi := &file_otg_proto_msgTypes[1041] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107299,7 +107964,7 @@ func (x *IsisInterface_LevelType) String() string { func (*IsisInterface_LevelType) ProtoMessage() {} func (x *IsisInterface_LevelType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1034] + mi := &file_otg_proto_msgTypes[1041] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107324,7 +107989,7 @@ type IsisInterfaceAuthentication_AuthType struct { func (x *IsisInterfaceAuthentication_AuthType) Reset() { *x = IsisInterfaceAuthentication_AuthType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1035] + mi := &file_otg_proto_msgTypes[1042] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107337,7 +108002,7 @@ func (x *IsisInterfaceAuthentication_AuthType) String() string { func (*IsisInterfaceAuthentication_AuthType) ProtoMessage() {} func (x *IsisInterfaceAuthentication_AuthType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1035] + mi := &file_otg_proto_msgTypes[1042] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107362,7 +108027,7 @@ type IsisAuthenticationBase_AuthType struct { func (x *IsisAuthenticationBase_AuthType) Reset() { *x = IsisAuthenticationBase_AuthType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1036] + mi := &file_otg_proto_msgTypes[1043] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107375,7 +108040,7 @@ func (x *IsisAuthenticationBase_AuthType) String() string { func (*IsisAuthenticationBase_AuthType) ProtoMessage() {} func (x *IsisAuthenticationBase_AuthType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1036] + mi := &file_otg_proto_msgTypes[1043] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107400,7 +108065,7 @@ type IsisV4RouteRange_OriginType struct { func (x *IsisV4RouteRange_OriginType) Reset() { *x = IsisV4RouteRange_OriginType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1037] + mi := &file_otg_proto_msgTypes[1044] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107413,7 +108078,7 @@ func (x *IsisV4RouteRange_OriginType) String() string { func (*IsisV4RouteRange_OriginType) ProtoMessage() {} func (x *IsisV4RouteRange_OriginType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1037] + mi := &file_otg_proto_msgTypes[1044] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107438,7 +108103,7 @@ type IsisV4RouteRange_RedistributionType struct { func (x *IsisV4RouteRange_RedistributionType) Reset() { *x = IsisV4RouteRange_RedistributionType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1038] + mi := &file_otg_proto_msgTypes[1045] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107451,7 +108116,7 @@ func (x *IsisV4RouteRange_RedistributionType) String() string { func (*IsisV4RouteRange_RedistributionType) ProtoMessage() {} func (x *IsisV4RouteRange_RedistributionType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1038] + mi := &file_otg_proto_msgTypes[1045] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107476,7 +108141,7 @@ type IsisV6RouteRange_OriginType struct { func (x *IsisV6RouteRange_OriginType) Reset() { *x = IsisV6RouteRange_OriginType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1039] + mi := &file_otg_proto_msgTypes[1046] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107489,7 +108154,7 @@ func (x *IsisV6RouteRange_OriginType) String() string { func (*IsisV6RouteRange_OriginType) ProtoMessage() {} func (x *IsisV6RouteRange_OriginType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1039] + mi := &file_otg_proto_msgTypes[1046] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107514,7 +108179,7 @@ type IsisV6RouteRange_RedistributionType struct { func (x *IsisV6RouteRange_RedistributionType) Reset() { *x = IsisV6RouteRange_RedistributionType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1040] + mi := &file_otg_proto_msgTypes[1047] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107527,7 +108192,7 @@ func (x *IsisV6RouteRange_RedistributionType) String() string { func (*IsisV6RouteRange_RedistributionType) ProtoMessage() {} func (x *IsisV6RouteRange_RedistributionType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1040] + mi := &file_otg_proto_msgTypes[1047] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107552,7 +108217,7 @@ type DeviceBgpMessageHeaderError_Subcode struct { func (x *DeviceBgpMessageHeaderError_Subcode) Reset() { *x = DeviceBgpMessageHeaderError_Subcode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1041] + mi := &file_otg_proto_msgTypes[1048] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107565,7 +108230,7 @@ func (x *DeviceBgpMessageHeaderError_Subcode) String() string { func (*DeviceBgpMessageHeaderError_Subcode) ProtoMessage() {} func (x *DeviceBgpMessageHeaderError_Subcode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1041] + mi := &file_otg_proto_msgTypes[1048] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107590,7 +108255,7 @@ type DeviceBgpOpenMessageError_Subcode struct { func (x *DeviceBgpOpenMessageError_Subcode) Reset() { *x = DeviceBgpOpenMessageError_Subcode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1042] + mi := &file_otg_proto_msgTypes[1049] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107603,7 +108268,7 @@ func (x *DeviceBgpOpenMessageError_Subcode) String() string { func (*DeviceBgpOpenMessageError_Subcode) ProtoMessage() {} func (x *DeviceBgpOpenMessageError_Subcode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1042] + mi := &file_otg_proto_msgTypes[1049] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107628,7 +108293,7 @@ type DeviceBgpUpdateMessageError_Subcode struct { func (x *DeviceBgpUpdateMessageError_Subcode) Reset() { *x = DeviceBgpUpdateMessageError_Subcode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1043] + mi := &file_otg_proto_msgTypes[1050] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107641,7 +108306,7 @@ func (x *DeviceBgpUpdateMessageError_Subcode) String() string { func (*DeviceBgpUpdateMessageError_Subcode) ProtoMessage() {} func (x *DeviceBgpUpdateMessageError_Subcode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1043] + mi := &file_otg_proto_msgTypes[1050] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107666,7 +108331,7 @@ type DeviceBgpCeaseError_Subcode struct { func (x *DeviceBgpCeaseError_Subcode) Reset() { *x = DeviceBgpCeaseError_Subcode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1044] + mi := &file_otg_proto_msgTypes[1051] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107679,7 +108344,7 @@ func (x *DeviceBgpCeaseError_Subcode) String() string { func (*DeviceBgpCeaseError_Subcode) ProtoMessage() {} func (x *DeviceBgpCeaseError_Subcode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1044] + mi := &file_otg_proto_msgTypes[1051] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107704,7 +108369,7 @@ type BgpV4Peer_AsType struct { func (x *BgpV4Peer_AsType) Reset() { *x = BgpV4Peer_AsType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1045] + mi := &file_otg_proto_msgTypes[1052] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107717,7 +108382,7 @@ func (x *BgpV4Peer_AsType) String() string { func (*BgpV4Peer_AsType) ProtoMessage() {} func (x *BgpV4Peer_AsType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1045] + mi := &file_otg_proto_msgTypes[1052] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107742,7 +108407,7 @@ type BgpV4Peer_AsNumberWidth struct { func (x *BgpV4Peer_AsNumberWidth) Reset() { *x = BgpV4Peer_AsNumberWidth{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1046] + mi := &file_otg_proto_msgTypes[1053] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107755,7 +108420,7 @@ func (x *BgpV4Peer_AsNumberWidth) String() string { func (*BgpV4Peer_AsNumberWidth) ProtoMessage() {} func (x *BgpV4Peer_AsNumberWidth) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1046] + mi := &file_otg_proto_msgTypes[1053] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107780,7 +108445,7 @@ type BgpV4EthernetSegment_ActiveMode struct { func (x *BgpV4EthernetSegment_ActiveMode) Reset() { *x = BgpV4EthernetSegment_ActiveMode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1047] + mi := &file_otg_proto_msgTypes[1054] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107793,7 +108458,7 @@ func (x *BgpV4EthernetSegment_ActiveMode) String() string { func (*BgpV4EthernetSegment_ActiveMode) ProtoMessage() {} func (x *BgpV4EthernetSegment_ActiveMode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1047] + mi := &file_otg_proto_msgTypes[1054] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107818,7 +108483,7 @@ type BgpRouteAdvanced_Origin struct { func (x *BgpRouteAdvanced_Origin) Reset() { *x = BgpRouteAdvanced_Origin{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1048] + mi := &file_otg_proto_msgTypes[1055] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107831,7 +108496,7 @@ func (x *BgpRouteAdvanced_Origin) String() string { func (*BgpRouteAdvanced_Origin) ProtoMessage() {} func (x *BgpRouteAdvanced_Origin) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1048] + mi := &file_otg_proto_msgTypes[1055] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107856,7 +108521,7 @@ type BgpCommunity_Type struct { func (x *BgpCommunity_Type) Reset() { *x = BgpCommunity_Type{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1049] + mi := &file_otg_proto_msgTypes[1056] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107869,7 +108534,7 @@ func (x *BgpCommunity_Type) String() string { func (*BgpCommunity_Type) ProtoMessage() {} func (x *BgpCommunity_Type) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1049] + mi := &file_otg_proto_msgTypes[1056] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107894,7 +108559,7 @@ type BgpExtCommunity_Type struct { func (x *BgpExtCommunity_Type) Reset() { *x = BgpExtCommunity_Type{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1050] + mi := &file_otg_proto_msgTypes[1057] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107907,7 +108572,7 @@ func (x *BgpExtCommunity_Type) String() string { func (*BgpExtCommunity_Type) ProtoMessage() {} func (x *BgpExtCommunity_Type) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1050] + mi := &file_otg_proto_msgTypes[1057] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107932,7 +108597,7 @@ type BgpExtCommunity_Subtype struct { func (x *BgpExtCommunity_Subtype) Reset() { *x = BgpExtCommunity_Subtype{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1051] + mi := &file_otg_proto_msgTypes[1058] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107945,7 +108610,7 @@ func (x *BgpExtCommunity_Subtype) String() string { func (*BgpExtCommunity_Subtype) ProtoMessage() {} func (x *BgpExtCommunity_Subtype) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1051] + mi := &file_otg_proto_msgTypes[1058] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -107970,7 +108635,7 @@ type BgpAsPath_AsSetMode struct { func (x *BgpAsPath_AsSetMode) Reset() { *x = BgpAsPath_AsSetMode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1052] + mi := &file_otg_proto_msgTypes[1059] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107983,7 +108648,7 @@ func (x *BgpAsPath_AsSetMode) String() string { func (*BgpAsPath_AsSetMode) ProtoMessage() {} func (x *BgpAsPath_AsSetMode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1052] + mi := &file_otg_proto_msgTypes[1059] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108008,7 +108673,7 @@ type BgpAsPathSegment_Type struct { func (x *BgpAsPathSegment_Type) Reset() { *x = BgpAsPathSegment_Type{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1053] + mi := &file_otg_proto_msgTypes[1060] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108021,7 +108686,7 @@ func (x *BgpAsPathSegment_Type) String() string { func (*BgpAsPathSegment_Type) ProtoMessage() {} func (x *BgpAsPathSegment_Type) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1053] + mi := &file_otg_proto_msgTypes[1060] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108046,7 +108711,7 @@ type BgpV4EvpnEvis_Choice struct { func (x *BgpV4EvpnEvis_Choice) Reset() { *x = BgpV4EvpnEvis_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1054] + mi := &file_otg_proto_msgTypes[1061] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108059,7 +108724,7 @@ func (x *BgpV4EvpnEvis_Choice) String() string { func (*BgpV4EvpnEvis_Choice) ProtoMessage() {} func (x *BgpV4EvpnEvis_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1054] + mi := &file_otg_proto_msgTypes[1061] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108084,7 +108749,7 @@ type BgpV4EviVxlan_ReplicationType struct { func (x *BgpV4EviVxlan_ReplicationType) Reset() { *x = BgpV4EviVxlan_ReplicationType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1055] + mi := &file_otg_proto_msgTypes[1062] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108097,7 +108762,7 @@ func (x *BgpV4EviVxlan_ReplicationType) String() string { func (*BgpV4EviVxlan_ReplicationType) ProtoMessage() {} func (x *BgpV4EviVxlan_ReplicationType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1055] + mi := &file_otg_proto_msgTypes[1062] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108122,7 +108787,7 @@ type BgpRouteDistinguisher_RdType struct { func (x *BgpRouteDistinguisher_RdType) Reset() { *x = BgpRouteDistinguisher_RdType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1056] + mi := &file_otg_proto_msgTypes[1063] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108135,7 +108800,7 @@ func (x *BgpRouteDistinguisher_RdType) String() string { func (*BgpRouteDistinguisher_RdType) ProtoMessage() {} func (x *BgpRouteDistinguisher_RdType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1056] + mi := &file_otg_proto_msgTypes[1063] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108160,7 +108825,7 @@ type BgpRouteTarget_RtType struct { func (x *BgpRouteTarget_RtType) Reset() { *x = BgpRouteTarget_RtType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1057] + mi := &file_otg_proto_msgTypes[1064] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108173,7 +108838,7 @@ func (x *BgpRouteTarget_RtType) String() string { func (*BgpRouteTarget_RtType) ProtoMessage() {} func (x *BgpRouteTarget_RtType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1057] + mi := &file_otg_proto_msgTypes[1064] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108198,7 +108863,7 @@ type BgpV4RouteRange_NextHopMode struct { func (x *BgpV4RouteRange_NextHopMode) Reset() { *x = BgpV4RouteRange_NextHopMode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1058] + mi := &file_otg_proto_msgTypes[1065] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108211,7 +108876,7 @@ func (x *BgpV4RouteRange_NextHopMode) String() string { func (*BgpV4RouteRange_NextHopMode) ProtoMessage() {} func (x *BgpV4RouteRange_NextHopMode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1058] + mi := &file_otg_proto_msgTypes[1065] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108236,7 +108901,7 @@ type BgpV4RouteRange_NextHopAddressType struct { func (x *BgpV4RouteRange_NextHopAddressType) Reset() { *x = BgpV4RouteRange_NextHopAddressType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1059] + mi := &file_otg_proto_msgTypes[1066] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108249,7 +108914,7 @@ func (x *BgpV4RouteRange_NextHopAddressType) String() string { func (*BgpV4RouteRange_NextHopAddressType) ProtoMessage() {} func (x *BgpV4RouteRange_NextHopAddressType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1059] + mi := &file_otg_proto_msgTypes[1066] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108274,7 +108939,7 @@ type BgpExtendedCommunity_Choice struct { func (x *BgpExtendedCommunity_Choice) Reset() { *x = BgpExtendedCommunity_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1060] + mi := &file_otg_proto_msgTypes[1067] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108287,7 +108952,7 @@ func (x *BgpExtendedCommunity_Choice) String() string { func (*BgpExtendedCommunity_Choice) ProtoMessage() {} func (x *BgpExtendedCommunity_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1060] + mi := &file_otg_proto_msgTypes[1067] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108312,7 +108977,7 @@ type BgpExtendedCommunityTransitive2OctetAsType_Choice struct { func (x *BgpExtendedCommunityTransitive2OctetAsType_Choice) Reset() { *x = BgpExtendedCommunityTransitive2OctetAsType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1061] + mi := &file_otg_proto_msgTypes[1068] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108325,7 +108990,7 @@ func (x *BgpExtendedCommunityTransitive2OctetAsType_Choice) String() string { func (*BgpExtendedCommunityTransitive2OctetAsType_Choice) ProtoMessage() {} func (x *BgpExtendedCommunityTransitive2OctetAsType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1061] + mi := &file_otg_proto_msgTypes[1068] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108350,7 +109015,7 @@ type BgpExtendedCommunityTransitiveIpv4AddressType_Choice struct { func (x *BgpExtendedCommunityTransitiveIpv4AddressType_Choice) Reset() { *x = BgpExtendedCommunityTransitiveIpv4AddressType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1062] + mi := &file_otg_proto_msgTypes[1069] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108363,7 +109028,7 @@ func (x *BgpExtendedCommunityTransitiveIpv4AddressType_Choice) String() string { func (*BgpExtendedCommunityTransitiveIpv4AddressType_Choice) ProtoMessage() {} func (x *BgpExtendedCommunityTransitiveIpv4AddressType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1062] + mi := &file_otg_proto_msgTypes[1069] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108388,7 +109053,7 @@ type BgpExtendedCommunityTransitive4OctetAsType_Choice struct { func (x *BgpExtendedCommunityTransitive4OctetAsType_Choice) Reset() { *x = BgpExtendedCommunityTransitive4OctetAsType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1063] + mi := &file_otg_proto_msgTypes[1070] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108401,7 +109066,7 @@ func (x *BgpExtendedCommunityTransitive4OctetAsType_Choice) String() string { func (*BgpExtendedCommunityTransitive4OctetAsType_Choice) ProtoMessage() {} func (x *BgpExtendedCommunityTransitive4OctetAsType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1063] + mi := &file_otg_proto_msgTypes[1070] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108426,7 +109091,7 @@ type BgpExtendedCommunityTransitiveOpaqueType_Choice struct { func (x *BgpExtendedCommunityTransitiveOpaqueType_Choice) Reset() { *x = BgpExtendedCommunityTransitiveOpaqueType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1064] + mi := &file_otg_proto_msgTypes[1071] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108439,7 +109104,7 @@ func (x *BgpExtendedCommunityTransitiveOpaqueType_Choice) String() string { func (*BgpExtendedCommunityTransitiveOpaqueType_Choice) ProtoMessage() {} func (x *BgpExtendedCommunityTransitiveOpaqueType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1064] + mi := &file_otg_proto_msgTypes[1071] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108464,7 +109129,7 @@ type BgpExtendedCommunityTransitiveEvpnType_Choice struct { func (x *BgpExtendedCommunityTransitiveEvpnType_Choice) Reset() { *x = BgpExtendedCommunityTransitiveEvpnType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1065] + mi := &file_otg_proto_msgTypes[1072] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108477,7 +109142,7 @@ func (x *BgpExtendedCommunityTransitiveEvpnType_Choice) String() string { func (*BgpExtendedCommunityTransitiveEvpnType_Choice) ProtoMessage() {} func (x *BgpExtendedCommunityTransitiveEvpnType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1065] + mi := &file_otg_proto_msgTypes[1072] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108502,7 +109167,7 @@ type BgpExtendedCommunityNonTransitive2OctetAsType_Choice struct { func (x *BgpExtendedCommunityNonTransitive2OctetAsType_Choice) Reset() { *x = BgpExtendedCommunityNonTransitive2OctetAsType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1066] + mi := &file_otg_proto_msgTypes[1073] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108515,7 +109180,7 @@ func (x *BgpExtendedCommunityNonTransitive2OctetAsType_Choice) String() string { func (*BgpExtendedCommunityNonTransitive2OctetAsType_Choice) ProtoMessage() {} func (x *BgpExtendedCommunityNonTransitive2OctetAsType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1066] + mi := &file_otg_proto_msgTypes[1073] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108540,7 +109205,7 @@ type BgpV6RouteRange_NextHopMode struct { func (x *BgpV6RouteRange_NextHopMode) Reset() { *x = BgpV6RouteRange_NextHopMode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1067] + mi := &file_otg_proto_msgTypes[1074] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108553,7 +109218,7 @@ func (x *BgpV6RouteRange_NextHopMode) String() string { func (*BgpV6RouteRange_NextHopMode) ProtoMessage() {} func (x *BgpV6RouteRange_NextHopMode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1067] + mi := &file_otg_proto_msgTypes[1074] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108578,7 +109243,7 @@ type BgpV6RouteRange_NextHopAddressType struct { func (x *BgpV6RouteRange_NextHopAddressType) Reset() { *x = BgpV6RouteRange_NextHopAddressType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1068] + mi := &file_otg_proto_msgTypes[1075] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108591,7 +109256,7 @@ func (x *BgpV6RouteRange_NextHopAddressType) String() string { func (*BgpV6RouteRange_NextHopAddressType) ProtoMessage() {} func (x *BgpV6RouteRange_NextHopAddressType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1068] + mi := &file_otg_proto_msgTypes[1075] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108616,7 +109281,7 @@ type BgpSrteV4Policy_NextHopMode struct { func (x *BgpSrteV4Policy_NextHopMode) Reset() { *x = BgpSrteV4Policy_NextHopMode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1069] + mi := &file_otg_proto_msgTypes[1076] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108629,7 +109294,7 @@ func (x *BgpSrteV4Policy_NextHopMode) String() string { func (*BgpSrteV4Policy_NextHopMode) ProtoMessage() {} func (x *BgpSrteV4Policy_NextHopMode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1069] + mi := &file_otg_proto_msgTypes[1076] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108654,7 +109319,7 @@ type BgpSrteV4Policy_NextHopAddressType struct { func (x *BgpSrteV4Policy_NextHopAddressType) Reset() { *x = BgpSrteV4Policy_NextHopAddressType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1070] + mi := &file_otg_proto_msgTypes[1077] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108667,7 +109332,7 @@ func (x *BgpSrteV4Policy_NextHopAddressType) String() string { func (*BgpSrteV4Policy_NextHopAddressType) ProtoMessage() {} func (x *BgpSrteV4Policy_NextHopAddressType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1070] + mi := &file_otg_proto_msgTypes[1077] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108692,7 +109357,7 @@ type BgpSrteRemoteEndpointSubTlv_AddressFamily struct { func (x *BgpSrteRemoteEndpointSubTlv_AddressFamily) Reset() { *x = BgpSrteRemoteEndpointSubTlv_AddressFamily{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1071] + mi := &file_otg_proto_msgTypes[1078] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108705,7 +109370,7 @@ func (x *BgpSrteRemoteEndpointSubTlv_AddressFamily) String() string { func (*BgpSrteRemoteEndpointSubTlv_AddressFamily) ProtoMessage() {} func (x *BgpSrteRemoteEndpointSubTlv_AddressFamily) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1071] + mi := &file_otg_proto_msgTypes[1078] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108730,7 +109395,7 @@ type BgpSrteBindingSubTlv_BindingSidType struct { func (x *BgpSrteBindingSubTlv_BindingSidType) Reset() { *x = BgpSrteBindingSubTlv_BindingSidType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1072] + mi := &file_otg_proto_msgTypes[1079] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108743,7 +109408,7 @@ func (x *BgpSrteBindingSubTlv_BindingSidType) String() string { func (*BgpSrteBindingSubTlv_BindingSidType) ProtoMessage() {} func (x *BgpSrteBindingSubTlv_BindingSidType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1072] + mi := &file_otg_proto_msgTypes[1079] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108768,7 +109433,7 @@ type BgpSrteExplicitNullLabelPolicySubTlv_ExplicitNullLabelPolicy struct { func (x *BgpSrteExplicitNullLabelPolicySubTlv_ExplicitNullLabelPolicy) Reset() { *x = BgpSrteExplicitNullLabelPolicySubTlv_ExplicitNullLabelPolicy{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1073] + mi := &file_otg_proto_msgTypes[1080] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108781,7 +109446,7 @@ func (x *BgpSrteExplicitNullLabelPolicySubTlv_ExplicitNullLabelPolicy) String() func (*BgpSrteExplicitNullLabelPolicySubTlv_ExplicitNullLabelPolicy) ProtoMessage() {} func (x *BgpSrteExplicitNullLabelPolicySubTlv_ExplicitNullLabelPolicy) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1073] + mi := &file_otg_proto_msgTypes[1080] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108806,7 +109471,7 @@ type BgpSrteSegment_SegmentType struct { func (x *BgpSrteSegment_SegmentType) Reset() { *x = BgpSrteSegment_SegmentType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1074] + mi := &file_otg_proto_msgTypes[1081] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108819,7 +109484,7 @@ func (x *BgpSrteSegment_SegmentType) String() string { func (*BgpSrteSegment_SegmentType) ProtoMessage() {} func (x *BgpSrteSegment_SegmentType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1074] + mi := &file_otg_proto_msgTypes[1081] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108844,7 +109509,7 @@ type BgpSrteV6Policy_NextHopMode struct { func (x *BgpSrteV6Policy_NextHopMode) Reset() { *x = BgpSrteV6Policy_NextHopMode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1075] + mi := &file_otg_proto_msgTypes[1082] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108857,7 +109522,7 @@ func (x *BgpSrteV6Policy_NextHopMode) String() string { func (*BgpSrteV6Policy_NextHopMode) ProtoMessage() {} func (x *BgpSrteV6Policy_NextHopMode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1075] + mi := &file_otg_proto_msgTypes[1082] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108882,7 +109547,7 @@ type BgpSrteV6Policy_NextHopAddressType struct { func (x *BgpSrteV6Policy_NextHopAddressType) Reset() { *x = BgpSrteV6Policy_NextHopAddressType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1076] + mi := &file_otg_proto_msgTypes[1083] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108895,7 +109560,7 @@ func (x *BgpSrteV6Policy_NextHopAddressType) String() string { func (*BgpSrteV6Policy_NextHopAddressType) ProtoMessage() {} func (x *BgpSrteV6Policy_NextHopAddressType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1076] + mi := &file_otg_proto_msgTypes[1083] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108920,7 +109585,7 @@ type BgpUpdateReplay_Choice struct { func (x *BgpUpdateReplay_Choice) Reset() { *x = BgpUpdateReplay_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1077] + mi := &file_otg_proto_msgTypes[1084] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108933,7 +109598,7 @@ func (x *BgpUpdateReplay_Choice) String() string { func (*BgpUpdateReplay_Choice) ProtoMessage() {} func (x *BgpUpdateReplay_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1077] + mi := &file_otg_proto_msgTypes[1084] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108958,7 +109623,7 @@ type BgpAttributes_Origin struct { func (x *BgpAttributes_Origin) Reset() { *x = BgpAttributes_Origin{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1078] + mi := &file_otg_proto_msgTypes[1085] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -108971,7 +109636,7 @@ func (x *BgpAttributes_Origin) String() string { func (*BgpAttributes_Origin) ProtoMessage() {} func (x *BgpAttributes_Origin) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1078] + mi := &file_otg_proto_msgTypes[1085] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -108996,7 +109661,7 @@ type BgpAttributesAsPath_Choice struct { func (x *BgpAttributesAsPath_Choice) Reset() { *x = BgpAttributesAsPath_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1079] + mi := &file_otg_proto_msgTypes[1086] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109009,7 +109674,7 @@ func (x *BgpAttributesAsPath_Choice) String() string { func (*BgpAttributesAsPath_Choice) ProtoMessage() {} func (x *BgpAttributesAsPath_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1079] + mi := &file_otg_proto_msgTypes[1086] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109034,7 +109699,7 @@ type BgpAttributesFourByteAsPathSegment_Type struct { func (x *BgpAttributesFourByteAsPathSegment_Type) Reset() { *x = BgpAttributesFourByteAsPathSegment_Type{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1080] + mi := &file_otg_proto_msgTypes[1087] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109047,7 +109712,7 @@ func (x *BgpAttributesFourByteAsPathSegment_Type) String() string { func (*BgpAttributesFourByteAsPathSegment_Type) ProtoMessage() {} func (x *BgpAttributesFourByteAsPathSegment_Type) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1080] + mi := &file_otg_proto_msgTypes[1087] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109072,7 +109737,7 @@ type BgpAttributesTwoByteAsPathSegment_Type struct { func (x *BgpAttributesTwoByteAsPathSegment_Type) Reset() { *x = BgpAttributesTwoByteAsPathSegment_Type{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1081] + mi := &file_otg_proto_msgTypes[1088] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109085,7 +109750,7 @@ func (x *BgpAttributesTwoByteAsPathSegment_Type) String() string { func (*BgpAttributesTwoByteAsPathSegment_Type) ProtoMessage() {} func (x *BgpAttributesTwoByteAsPathSegment_Type) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1081] + mi := &file_otg_proto_msgTypes[1088] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109110,7 +109775,7 @@ type BgpAttributesAggregator_Choice struct { func (x *BgpAttributesAggregator_Choice) Reset() { *x = BgpAttributesAggregator_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1082] + mi := &file_otg_proto_msgTypes[1089] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109123,7 +109788,7 @@ func (x *BgpAttributesAggregator_Choice) String() string { func (*BgpAttributesAggregator_Choice) ProtoMessage() {} func (x *BgpAttributesAggregator_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1082] + mi := &file_otg_proto_msgTypes[1089] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109148,7 +109813,7 @@ type BgpAttributesCommunity_Choice struct { func (x *BgpAttributesCommunity_Choice) Reset() { *x = BgpAttributesCommunity_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1083] + mi := &file_otg_proto_msgTypes[1090] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109161,7 +109826,7 @@ func (x *BgpAttributesCommunity_Choice) String() string { func (*BgpAttributesCommunity_Choice) ProtoMessage() {} func (x *BgpAttributesCommunity_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1083] + mi := &file_otg_proto_msgTypes[1090] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109186,7 +109851,7 @@ type BgpAttributesNextHop_Choice struct { func (x *BgpAttributesNextHop_Choice) Reset() { *x = BgpAttributesNextHop_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1084] + mi := &file_otg_proto_msgTypes[1091] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109199,7 +109864,7 @@ func (x *BgpAttributesNextHop_Choice) String() string { func (*BgpAttributesNextHop_Choice) ProtoMessage() {} func (x *BgpAttributesNextHop_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1084] + mi := &file_otg_proto_msgTypes[1091] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109224,7 +109889,7 @@ type BgpAttributesMpReachNlri_Choice struct { func (x *BgpAttributesMpReachNlri_Choice) Reset() { *x = BgpAttributesMpReachNlri_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1085] + mi := &file_otg_proto_msgTypes[1092] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109237,7 +109902,7 @@ func (x *BgpAttributesMpReachNlri_Choice) String() string { func (*BgpAttributesMpReachNlri_Choice) ProtoMessage() {} func (x *BgpAttributesMpReachNlri_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1085] + mi := &file_otg_proto_msgTypes[1092] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109262,7 +109927,7 @@ type BgpAttributesMpUnreachNlri_Choice struct { func (x *BgpAttributesMpUnreachNlri_Choice) Reset() { *x = BgpAttributesMpUnreachNlri_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1086] + mi := &file_otg_proto_msgTypes[1093] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109275,7 +109940,7 @@ func (x *BgpAttributesMpUnreachNlri_Choice) String() string { func (*BgpAttributesMpUnreachNlri_Choice) ProtoMessage() {} func (x *BgpAttributesMpUnreachNlri_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1086] + mi := &file_otg_proto_msgTypes[1093] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109300,7 +109965,7 @@ type BgpAttributesTunnelEncapsulation_Choice struct { func (x *BgpAttributesTunnelEncapsulation_Choice) Reset() { *x = BgpAttributesTunnelEncapsulation_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1087] + mi := &file_otg_proto_msgTypes[1094] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109313,7 +109978,7 @@ func (x *BgpAttributesTunnelEncapsulation_Choice) String() string { func (*BgpAttributesTunnelEncapsulation_Choice) ProtoMessage() {} func (x *BgpAttributesTunnelEncapsulation_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1087] + mi := &file_otg_proto_msgTypes[1094] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109338,7 +110003,7 @@ type BgpAttributesBsid_Choice struct { func (x *BgpAttributesBsid_Choice) Reset() { *x = BgpAttributesBsid_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1088] + mi := &file_otg_proto_msgTypes[1095] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109351,7 +110016,7 @@ func (x *BgpAttributesBsid_Choice) String() string { func (*BgpAttributesBsid_Choice) ProtoMessage() {} func (x *BgpAttributesBsid_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1088] + mi := &file_otg_proto_msgTypes[1095] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109376,7 +110041,7 @@ type BgpAttributesSrPolicyExplicitNullPolicy_Choice struct { func (x *BgpAttributesSrPolicyExplicitNullPolicy_Choice) Reset() { *x = BgpAttributesSrPolicyExplicitNullPolicy_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1089] + mi := &file_otg_proto_msgTypes[1096] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109389,7 +110054,7 @@ func (x *BgpAttributesSrPolicyExplicitNullPolicy_Choice) String() string { func (*BgpAttributesSrPolicyExplicitNullPolicy_Choice) ProtoMessage() {} func (x *BgpAttributesSrPolicyExplicitNullPolicy_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1089] + mi := &file_otg_proto_msgTypes[1096] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109414,7 +110079,7 @@ type BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice struct { func (x *BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice) Reset() { *x = BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1090] + mi := &file_otg_proto_msgTypes[1097] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109427,7 +110092,7 @@ func (x *BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice) String() st func (*BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice) ProtoMessage() {} func (x *BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1090] + mi := &file_otg_proto_msgTypes[1097] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109452,7 +110117,7 @@ type BgpV6Peer_AsType struct { func (x *BgpV6Peer_AsType) Reset() { *x = BgpV6Peer_AsType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1091] + mi := &file_otg_proto_msgTypes[1098] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109465,7 +110130,7 @@ func (x *BgpV6Peer_AsType) String() string { func (*BgpV6Peer_AsType) ProtoMessage() {} func (x *BgpV6Peer_AsType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1091] + mi := &file_otg_proto_msgTypes[1098] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109490,7 +110155,7 @@ type BgpV6Peer_AsNumberWidth struct { func (x *BgpV6Peer_AsNumberWidth) Reset() { *x = BgpV6Peer_AsNumberWidth{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1092] + mi := &file_otg_proto_msgTypes[1099] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109503,7 +110168,7 @@ func (x *BgpV6Peer_AsNumberWidth) String() string { func (*BgpV6Peer_AsNumberWidth) ProtoMessage() {} func (x *BgpV6Peer_AsNumberWidth) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1092] + mi := &file_otg_proto_msgTypes[1099] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109528,7 +110193,7 @@ type BgpV6EthernetSegment_ActiveMode struct { func (x *BgpV6EthernetSegment_ActiveMode) Reset() { *x = BgpV6EthernetSegment_ActiveMode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1093] + mi := &file_otg_proto_msgTypes[1100] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109541,7 +110206,7 @@ func (x *BgpV6EthernetSegment_ActiveMode) String() string { func (*BgpV6EthernetSegment_ActiveMode) ProtoMessage() {} func (x *BgpV6EthernetSegment_ActiveMode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1093] + mi := &file_otg_proto_msgTypes[1100] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109566,7 +110231,7 @@ type BgpV6EvpnEvis_Choice struct { func (x *BgpV6EvpnEvis_Choice) Reset() { *x = BgpV6EvpnEvis_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1094] + mi := &file_otg_proto_msgTypes[1101] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109579,7 +110244,7 @@ func (x *BgpV6EvpnEvis_Choice) String() string { func (*BgpV6EvpnEvis_Choice) ProtoMessage() {} func (x *BgpV6EvpnEvis_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1094] + mi := &file_otg_proto_msgTypes[1101] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109604,7 +110269,7 @@ type BgpV6EviVxlan_ReplicationType struct { func (x *BgpV6EviVxlan_ReplicationType) Reset() { *x = BgpV6EviVxlan_ReplicationType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1095] + mi := &file_otg_proto_msgTypes[1102] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109617,7 +110282,7 @@ func (x *BgpV6EviVxlan_ReplicationType) String() string { func (*BgpV6EviVxlan_ReplicationType) ProtoMessage() {} func (x *BgpV6EviVxlan_ReplicationType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1095] + mi := &file_otg_proto_msgTypes[1102] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109642,7 +110307,7 @@ type VxlanV4TunnelDestinationIPMode_Choice struct { func (x *VxlanV4TunnelDestinationIPMode_Choice) Reset() { *x = VxlanV4TunnelDestinationIPMode_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1096] + mi := &file_otg_proto_msgTypes[1103] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109655,7 +110320,7 @@ func (x *VxlanV4TunnelDestinationIPMode_Choice) String() string { func (*VxlanV4TunnelDestinationIPMode_Choice) ProtoMessage() {} func (x *VxlanV4TunnelDestinationIPMode_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1096] + mi := &file_otg_proto_msgTypes[1103] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109680,7 +110345,7 @@ type VxlanV6TunnelDestinationIPMode_Choice struct { func (x *VxlanV6TunnelDestinationIPMode_Choice) Reset() { *x = VxlanV6TunnelDestinationIPMode_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1097] + mi := &file_otg_proto_msgTypes[1104] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109693,7 +110358,7 @@ func (x *VxlanV6TunnelDestinationIPMode_Choice) String() string { func (*VxlanV6TunnelDestinationIPMode_Choice) ProtoMessage() {} func (x *VxlanV6TunnelDestinationIPMode_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1097] + mi := &file_otg_proto_msgTypes[1104] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109718,7 +110383,7 @@ type RsvpLspIpv4InterfaceP2PEgressIpv4Lsp_ReservationStyle struct { func (x *RsvpLspIpv4InterfaceP2PEgressIpv4Lsp_ReservationStyle) Reset() { *x = RsvpLspIpv4InterfaceP2PEgressIpv4Lsp_ReservationStyle{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1098] + mi := &file_otg_proto_msgTypes[1105] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109731,7 +110396,7 @@ func (x *RsvpLspIpv4InterfaceP2PEgressIpv4Lsp_ReservationStyle) String() string func (*RsvpLspIpv4InterfaceP2PEgressIpv4Lsp_ReservationStyle) ProtoMessage() {} func (x *RsvpLspIpv4InterfaceP2PEgressIpv4Lsp_ReservationStyle) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1098] + mi := &file_otg_proto_msgTypes[1105] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109756,7 +110421,7 @@ type RsvpEro_PrependNeighborIp struct { func (x *RsvpEro_PrependNeighborIp) Reset() { *x = RsvpEro_PrependNeighborIp{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1099] + mi := &file_otg_proto_msgTypes[1106] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109769,7 +110434,7 @@ func (x *RsvpEro_PrependNeighborIp) String() string { func (*RsvpEro_PrependNeighborIp) ProtoMessage() {} func (x *RsvpEro_PrependNeighborIp) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1099] + mi := &file_otg_proto_msgTypes[1106] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109794,7 +110459,7 @@ type RsvpEroSubobject_Type struct { func (x *RsvpEroSubobject_Type) Reset() { *x = RsvpEroSubobject_Type{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1100] + mi := &file_otg_proto_msgTypes[1107] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109807,7 +110472,7 @@ func (x *RsvpEroSubobject_Type) String() string { func (*RsvpEroSubobject_Type) ProtoMessage() {} func (x *RsvpEroSubobject_Type) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1100] + mi := &file_otg_proto_msgTypes[1107] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109832,7 +110497,7 @@ type RsvpEroSubobject_HopType struct { func (x *RsvpEroSubobject_HopType) Reset() { *x = RsvpEroSubobject_HopType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1101] + mi := &file_otg_proto_msgTypes[1108] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109845,7 +110510,7 @@ func (x *RsvpEroSubobject_HopType) String() string { func (*RsvpEroSubobject_HopType) ProtoMessage() {} func (x *RsvpEroSubobject_HopType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1101] + mi := &file_otg_proto_msgTypes[1108] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109870,7 +110535,7 @@ type FlowTxRx_Choice struct { func (x *FlowTxRx_Choice) Reset() { *x = FlowTxRx_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1102] + mi := &file_otg_proto_msgTypes[1109] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109883,7 +110548,7 @@ func (x *FlowTxRx_Choice) String() string { func (*FlowTxRx_Choice) ProtoMessage() {} func (x *FlowTxRx_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1102] + mi := &file_otg_proto_msgTypes[1109] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109908,7 +110573,7 @@ type FlowRouter_Mode struct { func (x *FlowRouter_Mode) Reset() { *x = FlowRouter_Mode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1103] + mi := &file_otg_proto_msgTypes[1110] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109921,7 +110586,7 @@ func (x *FlowRouter_Mode) String() string { func (*FlowRouter_Mode) ProtoMessage() {} func (x *FlowRouter_Mode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1103] + mi := &file_otg_proto_msgTypes[1110] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109946,7 +110611,7 @@ type FlowHeader_Choice struct { func (x *FlowHeader_Choice) Reset() { *x = FlowHeader_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1104] + mi := &file_otg_proto_msgTypes[1111] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109959,7 +110624,7 @@ func (x *FlowHeader_Choice) String() string { func (*FlowHeader_Choice) ProtoMessage() {} func (x *FlowHeader_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1104] + mi := &file_otg_proto_msgTypes[1111] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -109984,7 +110649,7 @@ type FlowIpv4Options_Choice struct { func (x *FlowIpv4Options_Choice) Reset() { *x = FlowIpv4Options_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1105] + mi := &file_otg_proto_msgTypes[1112] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -109997,7 +110662,7 @@ func (x *FlowIpv4Options_Choice) String() string { func (*FlowIpv4Options_Choice) ProtoMessage() {} func (x *FlowIpv4Options_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1105] + mi := &file_otg_proto_msgTypes[1112] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110022,7 +110687,7 @@ type FlowIpv4OptionsCustomLength_Choice struct { func (x *FlowIpv4OptionsCustomLength_Choice) Reset() { *x = FlowIpv4OptionsCustomLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1106] + mi := &file_otg_proto_msgTypes[1113] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110035,7 +110700,7 @@ func (x *FlowIpv4OptionsCustomLength_Choice) String() string { func (*FlowIpv4OptionsCustomLength_Choice) ProtoMessage() {} func (x *FlowIpv4OptionsCustomLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1106] + mi := &file_otg_proto_msgTypes[1113] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110060,7 +110725,7 @@ type FlowIpv4Priority_Choice struct { func (x *FlowIpv4Priority_Choice) Reset() { *x = FlowIpv4Priority_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1107] + mi := &file_otg_proto_msgTypes[1114] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110073,7 +110738,7 @@ func (x *FlowIpv4Priority_Choice) String() string { func (*FlowIpv4Priority_Choice) ProtoMessage() {} func (x *FlowIpv4Priority_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1107] + mi := &file_otg_proto_msgTypes[1114] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110098,7 +110763,7 @@ type FlowIpv4Auto_Choice struct { func (x *FlowIpv4Auto_Choice) Reset() { *x = FlowIpv4Auto_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1108] + mi := &file_otg_proto_msgTypes[1115] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110111,7 +110776,7 @@ func (x *FlowIpv4Auto_Choice) String() string { func (*FlowIpv4Auto_Choice) ProtoMessage() {} func (x *FlowIpv4Auto_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1108] + mi := &file_otg_proto_msgTypes[1115] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110136,7 +110801,7 @@ type FlowIcmp_Choice struct { func (x *FlowIcmp_Choice) Reset() { *x = FlowIcmp_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1109] + mi := &file_otg_proto_msgTypes[1116] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110149,7 +110814,7 @@ func (x *FlowIcmp_Choice) String() string { func (*FlowIcmp_Choice) ProtoMessage() {} func (x *FlowIcmp_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1109] + mi := &file_otg_proto_msgTypes[1116] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110174,7 +110839,7 @@ type FlowIcmpv6_Choice struct { func (x *FlowIcmpv6_Choice) Reset() { *x = FlowIcmpv6_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1110] + mi := &file_otg_proto_msgTypes[1117] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110187,7 +110852,7 @@ func (x *FlowIcmpv6_Choice) String() string { func (*FlowIcmpv6_Choice) ProtoMessage() {} func (x *FlowIcmpv6_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1110] + mi := &file_otg_proto_msgTypes[1117] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110212,7 +110877,7 @@ type FlowSnmpv2CData_Choice struct { func (x *FlowSnmpv2CData_Choice) Reset() { *x = FlowSnmpv2CData_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1111] + mi := &file_otg_proto_msgTypes[1118] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110225,7 +110890,7 @@ func (x *FlowSnmpv2CData_Choice) String() string { func (*FlowSnmpv2CData_Choice) ProtoMessage() {} func (x *FlowSnmpv2CData_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1111] + mi := &file_otg_proto_msgTypes[1118] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110250,7 +110915,7 @@ type FlowSnmpv2CPDU_ErrorStatus struct { func (x *FlowSnmpv2CPDU_ErrorStatus) Reset() { *x = FlowSnmpv2CPDU_ErrorStatus{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1112] + mi := &file_otg_proto_msgTypes[1119] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110263,7 +110928,7 @@ func (x *FlowSnmpv2CPDU_ErrorStatus) String() string { func (*FlowSnmpv2CPDU_ErrorStatus) ProtoMessage() {} func (x *FlowSnmpv2CPDU_ErrorStatus) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1112] + mi := &file_otg_proto_msgTypes[1119] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110288,7 +110953,7 @@ type FlowSnmpv2CVariableBindingValue_Choice struct { func (x *FlowSnmpv2CVariableBindingValue_Choice) Reset() { *x = FlowSnmpv2CVariableBindingValue_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1113] + mi := &file_otg_proto_msgTypes[1120] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110301,7 +110966,7 @@ func (x *FlowSnmpv2CVariableBindingValue_Choice) String() string { func (*FlowSnmpv2CVariableBindingValue_Choice) ProtoMessage() {} func (x *FlowSnmpv2CVariableBindingValue_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1113] + mi := &file_otg_proto_msgTypes[1120] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110326,7 +110991,7 @@ type FlowSnmpv2CVariableBindingStringValue_Choice struct { func (x *FlowSnmpv2CVariableBindingStringValue_Choice) Reset() { *x = FlowSnmpv2CVariableBindingStringValue_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1114] + mi := &file_otg_proto_msgTypes[1121] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110339,7 +111004,7 @@ func (x *FlowSnmpv2CVariableBindingStringValue_Choice) String() string { func (*FlowSnmpv2CVariableBindingStringValue_Choice) ProtoMessage() {} func (x *FlowSnmpv2CVariableBindingStringValue_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1114] + mi := &file_otg_proto_msgTypes[1121] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110364,7 +111029,7 @@ type FlowRsvp_Flag struct { func (x *FlowRsvp_Flag) Reset() { *x = FlowRsvp_Flag{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1115] + mi := &file_otg_proto_msgTypes[1122] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110377,7 +111042,7 @@ func (x *FlowRsvp_Flag) String() string { func (*FlowRsvp_Flag) ProtoMessage() {} func (x *FlowRsvp_Flag) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1115] + mi := &file_otg_proto_msgTypes[1122] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110402,7 +111067,7 @@ type FlowRSVPLength_Choice struct { func (x *FlowRSVPLength_Choice) Reset() { *x = FlowRSVPLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1116] + mi := &file_otg_proto_msgTypes[1123] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110415,7 +111080,7 @@ func (x *FlowRSVPLength_Choice) String() string { func (*FlowRSVPLength_Choice) ProtoMessage() {} func (x *FlowRSVPLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1116] + mi := &file_otg_proto_msgTypes[1123] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110440,7 +111105,7 @@ type FlowRSVPMessage_Choice struct { func (x *FlowRSVPMessage_Choice) Reset() { *x = FlowRSVPMessage_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1117] + mi := &file_otg_proto_msgTypes[1124] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110453,7 +111118,7 @@ func (x *FlowRSVPMessage_Choice) String() string { func (*FlowRSVPMessage_Choice) ProtoMessage() {} func (x *FlowRSVPMessage_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1117] + mi := &file_otg_proto_msgTypes[1124] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110478,7 +111143,7 @@ type FlowRSVPObjectLength_Choice struct { func (x *FlowRSVPObjectLength_Choice) Reset() { *x = FlowRSVPObjectLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1118] + mi := &file_otg_proto_msgTypes[1125] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110491,7 +111156,7 @@ func (x *FlowRSVPObjectLength_Choice) String() string { func (*FlowRSVPObjectLength_Choice) ProtoMessage() {} func (x *FlowRSVPObjectLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1118] + mi := &file_otg_proto_msgTypes[1125] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110516,7 +111181,7 @@ type FlowRSVPPathObjectsClass_Choice struct { func (x *FlowRSVPPathObjectsClass_Choice) Reset() { *x = FlowRSVPPathObjectsClass_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1119] + mi := &file_otg_proto_msgTypes[1126] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110529,7 +111194,7 @@ func (x *FlowRSVPPathObjectsClass_Choice) String() string { func (*FlowRSVPPathObjectsClass_Choice) ProtoMessage() {} func (x *FlowRSVPPathObjectsClass_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1119] + mi := &file_otg_proto_msgTypes[1126] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110554,7 +111219,7 @@ type FlowRSVPPathObjectsSessionCType_Choice struct { func (x *FlowRSVPPathObjectsSessionCType_Choice) Reset() { *x = FlowRSVPPathObjectsSessionCType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1120] + mi := &file_otg_proto_msgTypes[1127] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110567,7 +111232,7 @@ func (x *FlowRSVPPathObjectsSessionCType_Choice) String() string { func (*FlowRSVPPathObjectsSessionCType_Choice) ProtoMessage() {} func (x *FlowRSVPPathObjectsSessionCType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1120] + mi := &file_otg_proto_msgTypes[1127] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110592,7 +111257,7 @@ type FlowRSVPPathSessionExtTunnelId_Choice struct { func (x *FlowRSVPPathSessionExtTunnelId_Choice) Reset() { *x = FlowRSVPPathSessionExtTunnelId_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1121] + mi := &file_otg_proto_msgTypes[1128] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110605,7 +111270,7 @@ func (x *FlowRSVPPathSessionExtTunnelId_Choice) String() string { func (*FlowRSVPPathSessionExtTunnelId_Choice) ProtoMessage() {} func (x *FlowRSVPPathSessionExtTunnelId_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1121] + mi := &file_otg_proto_msgTypes[1128] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110630,7 +111295,7 @@ type FlowRSVPPathObjectsRsvpHopCType_Choice struct { func (x *FlowRSVPPathObjectsRsvpHopCType_Choice) Reset() { *x = FlowRSVPPathObjectsRsvpHopCType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1122] + mi := &file_otg_proto_msgTypes[1129] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110643,7 +111308,7 @@ func (x *FlowRSVPPathObjectsRsvpHopCType_Choice) String() string { func (*FlowRSVPPathObjectsRsvpHopCType_Choice) ProtoMessage() {} func (x *FlowRSVPPathObjectsRsvpHopCType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1122] + mi := &file_otg_proto_msgTypes[1129] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110668,7 +111333,7 @@ type FlowRSVPPathObjectsTimeValuesCType_Choice struct { func (x *FlowRSVPPathObjectsTimeValuesCType_Choice) Reset() { *x = FlowRSVPPathObjectsTimeValuesCType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1123] + mi := &file_otg_proto_msgTypes[1130] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110681,7 +111346,7 @@ func (x *FlowRSVPPathObjectsTimeValuesCType_Choice) String() string { func (*FlowRSVPPathObjectsTimeValuesCType_Choice) ProtoMessage() {} func (x *FlowRSVPPathObjectsTimeValuesCType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1123] + mi := &file_otg_proto_msgTypes[1130] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110706,7 +111371,7 @@ type FlowRSVPPathObjectsClassExplicitRouteCType_Choice struct { func (x *FlowRSVPPathObjectsClassExplicitRouteCType_Choice) Reset() { *x = FlowRSVPPathObjectsClassExplicitRouteCType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1124] + mi := &file_otg_proto_msgTypes[1131] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110719,7 +111384,7 @@ func (x *FlowRSVPPathObjectsClassExplicitRouteCType_Choice) String() string { func (*FlowRSVPPathObjectsClassExplicitRouteCType_Choice) ProtoMessage() {} func (x *FlowRSVPPathObjectsClassExplicitRouteCType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1124] + mi := &file_otg_proto_msgTypes[1131] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110744,7 +111409,7 @@ type FlowRSVPType1ExplicitRouteSubobjectsType_Choice struct { func (x *FlowRSVPType1ExplicitRouteSubobjectsType_Choice) Reset() { *x = FlowRSVPType1ExplicitRouteSubobjectsType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1125] + mi := &file_otg_proto_msgTypes[1132] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110757,7 +111422,7 @@ func (x *FlowRSVPType1ExplicitRouteSubobjectsType_Choice) String() string { func (*FlowRSVPType1ExplicitRouteSubobjectsType_Choice) ProtoMessage() {} func (x *FlowRSVPType1ExplicitRouteSubobjectsType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1125] + mi := &file_otg_proto_msgTypes[1132] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110782,7 +111447,7 @@ type FlowRSVPExplicitRouteLength_Choice struct { func (x *FlowRSVPExplicitRouteLength_Choice) Reset() { *x = FlowRSVPExplicitRouteLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1126] + mi := &file_otg_proto_msgTypes[1133] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110795,7 +111460,7 @@ func (x *FlowRSVPExplicitRouteLength_Choice) String() string { func (*FlowRSVPExplicitRouteLength_Choice) ProtoMessage() {} func (x *FlowRSVPExplicitRouteLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1126] + mi := &file_otg_proto_msgTypes[1133] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110820,7 +111485,7 @@ type FlowRSVPExplicitRouteASNumberLength_Choice struct { func (x *FlowRSVPExplicitRouteASNumberLength_Choice) Reset() { *x = FlowRSVPExplicitRouteASNumberLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1127] + mi := &file_otg_proto_msgTypes[1134] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110833,7 +111498,7 @@ func (x *FlowRSVPExplicitRouteASNumberLength_Choice) String() string { func (*FlowRSVPExplicitRouteASNumberLength_Choice) ProtoMessage() {} func (x *FlowRSVPExplicitRouteASNumberLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1127] + mi := &file_otg_proto_msgTypes[1134] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110858,7 +111523,7 @@ type FlowRSVPPathObjectsLabelRequestCType_Choice struct { func (x *FlowRSVPPathObjectsLabelRequestCType_Choice) Reset() { *x = FlowRSVPPathObjectsLabelRequestCType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1128] + mi := &file_otg_proto_msgTypes[1135] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110871,7 +111536,7 @@ func (x *FlowRSVPPathObjectsLabelRequestCType_Choice) String() string { func (*FlowRSVPPathObjectsLabelRequestCType_Choice) ProtoMessage() {} func (x *FlowRSVPPathObjectsLabelRequestCType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1128] + mi := &file_otg_proto_msgTypes[1135] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110896,7 +111561,7 @@ type FlowRSVPPathObjectsSessionAttributeCType_Choice struct { func (x *FlowRSVPPathObjectsSessionAttributeCType_Choice) Reset() { *x = FlowRSVPPathObjectsSessionAttributeCType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1129] + mi := &file_otg_proto_msgTypes[1136] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110909,7 +111574,7 @@ func (x *FlowRSVPPathObjectsSessionAttributeCType_Choice) String() string { func (*FlowRSVPPathObjectsSessionAttributeCType_Choice) ProtoMessage() {} func (x *FlowRSVPPathObjectsSessionAttributeCType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1129] + mi := &file_otg_proto_msgTypes[1136] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110934,7 +111599,7 @@ type FlowRSVPLspTunnelFlag_Choice struct { func (x *FlowRSVPLspTunnelFlag_Choice) Reset() { *x = FlowRSVPLspTunnelFlag_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1130] + mi := &file_otg_proto_msgTypes[1137] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110947,7 +111612,7 @@ func (x *FlowRSVPLspTunnelFlag_Choice) String() string { func (*FlowRSVPLspTunnelFlag_Choice) ProtoMessage() {} func (x *FlowRSVPLspTunnelFlag_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1130] + mi := &file_otg_proto_msgTypes[1137] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -110972,7 +111637,7 @@ type FlowRSVPSessionAttributeNameLength_Choice struct { func (x *FlowRSVPSessionAttributeNameLength_Choice) Reset() { *x = FlowRSVPSessionAttributeNameLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1131] + mi := &file_otg_proto_msgTypes[1138] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -110985,7 +111650,7 @@ func (x *FlowRSVPSessionAttributeNameLength_Choice) String() string { func (*FlowRSVPSessionAttributeNameLength_Choice) ProtoMessage() {} func (x *FlowRSVPSessionAttributeNameLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1131] + mi := &file_otg_proto_msgTypes[1138] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111010,7 +111675,7 @@ type FlowRSVPPathObjectsSenderTemplateCType_Choice struct { func (x *FlowRSVPPathObjectsSenderTemplateCType_Choice) Reset() { *x = FlowRSVPPathObjectsSenderTemplateCType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1132] + mi := &file_otg_proto_msgTypes[1139] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111023,7 +111688,7 @@ func (x *FlowRSVPPathObjectsSenderTemplateCType_Choice) String() string { func (*FlowRSVPPathObjectsSenderTemplateCType_Choice) ProtoMessage() {} func (x *FlowRSVPPathObjectsSenderTemplateCType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1132] + mi := &file_otg_proto_msgTypes[1139] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111048,7 +111713,7 @@ type FlowRSVPPathObjectsSenderTspecCType_Choice struct { func (x *FlowRSVPPathObjectsSenderTspecCType_Choice) Reset() { *x = FlowRSVPPathObjectsSenderTspecCType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1133] + mi := &file_otg_proto_msgTypes[1140] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111061,7 +111726,7 @@ func (x *FlowRSVPPathObjectsSenderTspecCType_Choice) String() string { func (*FlowRSVPPathObjectsSenderTspecCType_Choice) ProtoMessage() {} func (x *FlowRSVPPathObjectsSenderTspecCType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1133] + mi := &file_otg_proto_msgTypes[1140] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111086,7 +111751,7 @@ type FlowRSVPPathObjectsRecordRouteCType_Choice struct { func (x *FlowRSVPPathObjectsRecordRouteCType_Choice) Reset() { *x = FlowRSVPPathObjectsRecordRouteCType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1134] + mi := &file_otg_proto_msgTypes[1141] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111099,7 +111764,7 @@ func (x *FlowRSVPPathObjectsRecordRouteCType_Choice) String() string { func (*FlowRSVPPathObjectsRecordRouteCType_Choice) ProtoMessage() {} func (x *FlowRSVPPathObjectsRecordRouteCType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1134] + mi := &file_otg_proto_msgTypes[1141] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111124,7 +111789,7 @@ type FlowRSVPPathObjectsRecordRouteSubObjectType_Choice struct { func (x *FlowRSVPPathObjectsRecordRouteSubObjectType_Choice) Reset() { *x = FlowRSVPPathObjectsRecordRouteSubObjectType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1135] + mi := &file_otg_proto_msgTypes[1142] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111137,7 +111802,7 @@ func (x *FlowRSVPPathObjectsRecordRouteSubObjectType_Choice) String() string { func (*FlowRSVPPathObjectsRecordRouteSubObjectType_Choice) ProtoMessage() {} func (x *FlowRSVPPathObjectsRecordRouteSubObjectType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1135] + mi := &file_otg_proto_msgTypes[1142] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111162,7 +111827,7 @@ type FlowRSVPRecordRouteIPv4Flag_Choice struct { func (x *FlowRSVPRecordRouteIPv4Flag_Choice) Reset() { *x = FlowRSVPRecordRouteIPv4Flag_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1136] + mi := &file_otg_proto_msgTypes[1143] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111175,7 +111840,7 @@ func (x *FlowRSVPRecordRouteIPv4Flag_Choice) String() string { func (*FlowRSVPRecordRouteIPv4Flag_Choice) ProtoMessage() {} func (x *FlowRSVPRecordRouteIPv4Flag_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1136] + mi := &file_otg_proto_msgTypes[1143] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111200,7 +111865,7 @@ type FlowRSVPPathRecordRouteLabel_Choice struct { func (x *FlowRSVPPathRecordRouteLabel_Choice) Reset() { *x = FlowRSVPPathRecordRouteLabel_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1137] + mi := &file_otg_proto_msgTypes[1144] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111213,7 +111878,7 @@ func (x *FlowRSVPPathRecordRouteLabel_Choice) String() string { func (*FlowRSVPPathRecordRouteLabel_Choice) ProtoMessage() {} func (x *FlowRSVPPathRecordRouteLabel_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1137] + mi := &file_otg_proto_msgTypes[1144] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111238,7 +111903,7 @@ type FlowRSVPRouteRecordLength_Choice struct { func (x *FlowRSVPRouteRecordLength_Choice) Reset() { *x = FlowRSVPRouteRecordLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1138] + mi := &file_otg_proto_msgTypes[1145] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111251,7 +111916,7 @@ func (x *FlowRSVPRouteRecordLength_Choice) String() string { func (*FlowRSVPRouteRecordLength_Choice) ProtoMessage() {} func (x *FlowRSVPRouteRecordLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1138] + mi := &file_otg_proto_msgTypes[1145] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111276,7 +111941,7 @@ type FlowSize_Choice struct { func (x *FlowSize_Choice) Reset() { *x = FlowSize_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1139] + mi := &file_otg_proto_msgTypes[1146] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111289,7 +111954,7 @@ func (x *FlowSize_Choice) String() string { func (*FlowSize_Choice) ProtoMessage() {} func (x *FlowSize_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1139] + mi := &file_otg_proto_msgTypes[1146] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111314,7 +111979,7 @@ type FlowSizeWeightPairs_Choice struct { func (x *FlowSizeWeightPairs_Choice) Reset() { *x = FlowSizeWeightPairs_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1140] + mi := &file_otg_proto_msgTypes[1147] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111327,7 +111992,7 @@ func (x *FlowSizeWeightPairs_Choice) String() string { func (*FlowSizeWeightPairs_Choice) ProtoMessage() {} func (x *FlowSizeWeightPairs_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1140] + mi := &file_otg_proto_msgTypes[1147] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111352,7 +112017,7 @@ type FlowSizeWeightPairs_Predefined struct { func (x *FlowSizeWeightPairs_Predefined) Reset() { *x = FlowSizeWeightPairs_Predefined{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1141] + mi := &file_otg_proto_msgTypes[1148] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111365,7 +112030,7 @@ func (x *FlowSizeWeightPairs_Predefined) String() string { func (*FlowSizeWeightPairs_Predefined) ProtoMessage() {} func (x *FlowSizeWeightPairs_Predefined) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1141] + mi := &file_otg_proto_msgTypes[1148] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111390,7 +112055,7 @@ type FlowRate_Choice struct { func (x *FlowRate_Choice) Reset() { *x = FlowRate_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1142] + mi := &file_otg_proto_msgTypes[1149] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111403,7 +112068,7 @@ func (x *FlowRate_Choice) String() string { func (*FlowRate_Choice) ProtoMessage() {} func (x *FlowRate_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1142] + mi := &file_otg_proto_msgTypes[1149] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111428,7 +112093,7 @@ type FlowDuration_Choice struct { func (x *FlowDuration_Choice) Reset() { *x = FlowDuration_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1143] + mi := &file_otg_proto_msgTypes[1150] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111441,7 +112106,7 @@ func (x *FlowDuration_Choice) String() string { func (*FlowDuration_Choice) ProtoMessage() {} func (x *FlowDuration_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1143] + mi := &file_otg_proto_msgTypes[1150] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111466,7 +112131,7 @@ type FlowDelay_Choice struct { func (x *FlowDelay_Choice) Reset() { *x = FlowDelay_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1144] + mi := &file_otg_proto_msgTypes[1151] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111479,7 +112144,7 @@ func (x *FlowDelay_Choice) String() string { func (*FlowDelay_Choice) ProtoMessage() {} func (x *FlowDelay_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1144] + mi := &file_otg_proto_msgTypes[1151] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111504,7 +112169,7 @@ type FlowDurationInterBurstGap_Choice struct { func (x *FlowDurationInterBurstGap_Choice) Reset() { *x = FlowDurationInterBurstGap_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1145] + mi := &file_otg_proto_msgTypes[1152] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111517,7 +112182,7 @@ func (x *FlowDurationInterBurstGap_Choice) String() string { func (*FlowDurationInterBurstGap_Choice) ProtoMessage() {} func (x *FlowDurationInterBurstGap_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1145] + mi := &file_otg_proto_msgTypes[1152] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111542,7 +112207,7 @@ type FlowLatencyMetrics_Mode struct { func (x *FlowLatencyMetrics_Mode) Reset() { *x = FlowLatencyMetrics_Mode{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1146] + mi := &file_otg_proto_msgTypes[1153] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111555,7 +112220,7 @@ func (x *FlowLatencyMetrics_Mode) String() string { func (*FlowLatencyMetrics_Mode) ProtoMessage() {} func (x *FlowLatencyMetrics_Mode) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1146] + mi := &file_otg_proto_msgTypes[1153] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111580,7 +112245,7 @@ type FlowRxTxRatio_Choice struct { func (x *FlowRxTxRatio_Choice) Reset() { *x = FlowRxTxRatio_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1147] + mi := &file_otg_proto_msgTypes[1154] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111593,7 +112258,7 @@ func (x *FlowRxTxRatio_Choice) String() string { func (*FlowRxTxRatio_Choice) ProtoMessage() {} func (x *FlowRxTxRatio_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1147] + mi := &file_otg_proto_msgTypes[1154] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111618,7 +112283,7 @@ type EventRequest_Type struct { func (x *EventRequest_Type) Reset() { *x = EventRequest_Type{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1148] + mi := &file_otg_proto_msgTypes[1155] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111631,7 +112296,7 @@ func (x *EventRequest_Type) String() string { func (*EventRequest_Type) ProtoMessage() {} func (x *EventRequest_Type) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1148] + mi := &file_otg_proto_msgTypes[1155] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111656,7 +112321,7 @@ type LldpConnection_Choice struct { func (x *LldpConnection_Choice) Reset() { *x = LldpConnection_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1149] + mi := &file_otg_proto_msgTypes[1156] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111669,7 +112334,7 @@ func (x *LldpConnection_Choice) String() string { func (*LldpConnection_Choice) ProtoMessage() {} func (x *LldpConnection_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1149] + mi := &file_otg_proto_msgTypes[1156] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111694,7 +112359,7 @@ type LldpChassisId_Choice struct { func (x *LldpChassisId_Choice) Reset() { *x = LldpChassisId_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1150] + mi := &file_otg_proto_msgTypes[1157] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111707,7 +112372,7 @@ func (x *LldpChassisId_Choice) String() string { func (*LldpChassisId_Choice) ProtoMessage() {} func (x *LldpChassisId_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1150] + mi := &file_otg_proto_msgTypes[1157] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111732,7 +112397,7 @@ type LldpPortId_Choice struct { func (x *LldpPortId_Choice) Reset() { *x = LldpPortId_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1151] + mi := &file_otg_proto_msgTypes[1158] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111745,7 +112410,7 @@ func (x *LldpPortId_Choice) String() string { func (*LldpPortId_Choice) ProtoMessage() {} func (x *LldpPortId_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1151] + mi := &file_otg_proto_msgTypes[1158] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111770,7 +112435,7 @@ type LldpChassisMacSubType_Choice struct { func (x *LldpChassisMacSubType_Choice) Reset() { *x = LldpChassisMacSubType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1152] + mi := &file_otg_proto_msgTypes[1159] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111783,7 +112448,7 @@ func (x *LldpChassisMacSubType_Choice) String() string { func (*LldpChassisMacSubType_Choice) ProtoMessage() {} func (x *LldpChassisMacSubType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1152] + mi := &file_otg_proto_msgTypes[1159] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111808,7 +112473,7 @@ type LldpPortInterfaceNameSubType_Choice struct { func (x *LldpPortInterfaceNameSubType_Choice) Reset() { *x = LldpPortInterfaceNameSubType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1153] + mi := &file_otg_proto_msgTypes[1160] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111821,7 +112486,7 @@ func (x *LldpPortInterfaceNameSubType_Choice) String() string { func (*LldpPortInterfaceNameSubType_Choice) ProtoMessage() {} func (x *LldpPortInterfaceNameSubType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1153] + mi := &file_otg_proto_msgTypes[1160] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111846,7 +112511,7 @@ type LldpSystemName_Choice struct { func (x *LldpSystemName_Choice) Reset() { *x = LldpSystemName_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1154] + mi := &file_otg_proto_msgTypes[1161] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111859,7 +112524,7 @@ func (x *LldpSystemName_Choice) String() string { func (*LldpSystemName_Choice) ProtoMessage() {} func (x *LldpSystemName_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1154] + mi := &file_otg_proto_msgTypes[1161] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111884,7 +112549,7 @@ type Error_Kind struct { func (x *Error_Kind) Reset() { *x = Error_Kind{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1155] + mi := &file_otg_proto_msgTypes[1162] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111897,7 +112562,7 @@ func (x *Error_Kind) String() string { func (*Error_Kind) ProtoMessage() {} func (x *Error_Kind) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1155] + mi := &file_otg_proto_msgTypes[1162] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111922,7 +112587,7 @@ type ConfigUpdate_Choice struct { func (x *ConfigUpdate_Choice) Reset() { *x = ConfigUpdate_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1156] + mi := &file_otg_proto_msgTypes[1163] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111935,7 +112600,7 @@ func (x *ConfigUpdate_Choice) String() string { func (*ConfigUpdate_Choice) ProtoMessage() {} func (x *ConfigUpdate_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1156] + mi := &file_otg_proto_msgTypes[1163] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111960,7 +112625,7 @@ type FlowsUpdate_PropertyNames struct { func (x *FlowsUpdate_PropertyNames) Reset() { *x = FlowsUpdate_PropertyNames{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1157] + mi := &file_otg_proto_msgTypes[1164] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -111973,7 +112638,7 @@ func (x *FlowsUpdate_PropertyNames) String() string { func (*FlowsUpdate_PropertyNames) ProtoMessage() {} func (x *FlowsUpdate_PropertyNames) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1157] + mi := &file_otg_proto_msgTypes[1164] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -111998,7 +112663,7 @@ type ControlState_Choice struct { func (x *ControlState_Choice) Reset() { *x = ControlState_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1158] + mi := &file_otg_proto_msgTypes[1165] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112011,7 +112676,7 @@ func (x *ControlState_Choice) String() string { func (*ControlState_Choice) ProtoMessage() {} func (x *ControlState_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1158] + mi := &file_otg_proto_msgTypes[1165] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112036,7 +112701,7 @@ type StatePort_Choice struct { func (x *StatePort_Choice) Reset() { *x = StatePort_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1159] + mi := &file_otg_proto_msgTypes[1166] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112049,7 +112714,7 @@ func (x *StatePort_Choice) String() string { func (*StatePort_Choice) ProtoMessage() {} func (x *StatePort_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1159] + mi := &file_otg_proto_msgTypes[1166] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112074,7 +112739,7 @@ type StateTraffic_Choice struct { func (x *StateTraffic_Choice) Reset() { *x = StateTraffic_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1160] + mi := &file_otg_proto_msgTypes[1167] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112087,7 +112752,7 @@ func (x *StateTraffic_Choice) String() string { func (*StateTraffic_Choice) ProtoMessage() {} func (x *StateTraffic_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1160] + mi := &file_otg_proto_msgTypes[1167] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112112,7 +112777,7 @@ type StateProtocol_Choice struct { func (x *StateProtocol_Choice) Reset() { *x = StateProtocol_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1161] + mi := &file_otg_proto_msgTypes[1168] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112125,7 +112790,7 @@ func (x *StateProtocol_Choice) String() string { func (*StateProtocol_Choice) ProtoMessage() {} func (x *StateProtocol_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1161] + mi := &file_otg_proto_msgTypes[1168] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112150,7 +112815,7 @@ type StatePortLink_State struct { func (x *StatePortLink_State) Reset() { *x = StatePortLink_State{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1162] + mi := &file_otg_proto_msgTypes[1169] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112163,7 +112828,7 @@ func (x *StatePortLink_State) String() string { func (*StatePortLink_State) ProtoMessage() {} func (x *StatePortLink_State) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1162] + mi := &file_otg_proto_msgTypes[1169] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112188,7 +112853,7 @@ type StatePortCapture_State struct { func (x *StatePortCapture_State) Reset() { *x = StatePortCapture_State{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1163] + mi := &file_otg_proto_msgTypes[1170] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112201,7 +112866,7 @@ func (x *StatePortCapture_State) String() string { func (*StatePortCapture_State) ProtoMessage() {} func (x *StatePortCapture_State) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1163] + mi := &file_otg_proto_msgTypes[1170] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112226,7 +112891,7 @@ type StateTrafficFlowTransmit_State struct { func (x *StateTrafficFlowTransmit_State) Reset() { *x = StateTrafficFlowTransmit_State{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1164] + mi := &file_otg_proto_msgTypes[1171] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112239,7 +112904,7 @@ func (x *StateTrafficFlowTransmit_State) String() string { func (*StateTrafficFlowTransmit_State) ProtoMessage() {} func (x *StateTrafficFlowTransmit_State) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1164] + mi := &file_otg_proto_msgTypes[1171] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112264,7 +112929,7 @@ type StateProtocolAll_State struct { func (x *StateProtocolAll_State) Reset() { *x = StateProtocolAll_State{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1165] + mi := &file_otg_proto_msgTypes[1172] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112277,7 +112942,7 @@ func (x *StateProtocolAll_State) String() string { func (*StateProtocolAll_State) ProtoMessage() {} func (x *StateProtocolAll_State) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1165] + mi := &file_otg_proto_msgTypes[1172] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112302,7 +112967,7 @@ type StateProtocolRoute_State struct { func (x *StateProtocolRoute_State) Reset() { *x = StateProtocolRoute_State{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1166] + mi := &file_otg_proto_msgTypes[1173] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112315,7 +112980,7 @@ func (x *StateProtocolRoute_State) String() string { func (*StateProtocolRoute_State) ProtoMessage() {} func (x *StateProtocolRoute_State) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1166] + mi := &file_otg_proto_msgTypes[1173] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112340,7 +113005,7 @@ type StateProtocolLacp_Choice struct { func (x *StateProtocolLacp_Choice) Reset() { *x = StateProtocolLacp_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1167] + mi := &file_otg_proto_msgTypes[1174] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112353,7 +113018,7 @@ func (x *StateProtocolLacp_Choice) String() string { func (*StateProtocolLacp_Choice) ProtoMessage() {} func (x *StateProtocolLacp_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1167] + mi := &file_otg_proto_msgTypes[1174] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112378,7 +113043,7 @@ type StateProtocolLacpAdmin_State struct { func (x *StateProtocolLacpAdmin_State) Reset() { *x = StateProtocolLacpAdmin_State{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1168] + mi := &file_otg_proto_msgTypes[1175] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112391,7 +113056,7 @@ func (x *StateProtocolLacpAdmin_State) String() string { func (*StateProtocolLacpAdmin_State) ProtoMessage() {} func (x *StateProtocolLacpAdmin_State) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1168] + mi := &file_otg_proto_msgTypes[1175] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112416,7 +113081,7 @@ type StateProtocolLacpMemberPorts_State struct { func (x *StateProtocolLacpMemberPorts_State) Reset() { *x = StateProtocolLacpMemberPorts_State{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1169] + mi := &file_otg_proto_msgTypes[1176] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112429,7 +113094,7 @@ func (x *StateProtocolLacpMemberPorts_State) String() string { func (*StateProtocolLacpMemberPorts_State) ProtoMessage() {} func (x *StateProtocolLacpMemberPorts_State) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1169] + mi := &file_otg_proto_msgTypes[1176] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112454,7 +113119,7 @@ type StateProtocolBgp_Choice struct { func (x *StateProtocolBgp_Choice) Reset() { *x = StateProtocolBgp_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1170] + mi := &file_otg_proto_msgTypes[1177] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112467,7 +113132,7 @@ func (x *StateProtocolBgp_Choice) String() string { func (*StateProtocolBgp_Choice) ProtoMessage() {} func (x *StateProtocolBgp_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1170] + mi := &file_otg_proto_msgTypes[1177] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112492,7 +113157,7 @@ type StateProtocolBgpPeers_State struct { func (x *StateProtocolBgpPeers_State) Reset() { *x = StateProtocolBgpPeers_State{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1171] + mi := &file_otg_proto_msgTypes[1178] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112505,7 +113170,7 @@ func (x *StateProtocolBgpPeers_State) String() string { func (*StateProtocolBgpPeers_State) ProtoMessage() {} func (x *StateProtocolBgpPeers_State) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1171] + mi := &file_otg_proto_msgTypes[1178] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112530,7 +113195,7 @@ type StateProtocolIsis_Choice struct { func (x *StateProtocolIsis_Choice) Reset() { *x = StateProtocolIsis_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1172] + mi := &file_otg_proto_msgTypes[1179] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112543,7 +113208,7 @@ func (x *StateProtocolIsis_Choice) String() string { func (*StateProtocolIsis_Choice) ProtoMessage() {} func (x *StateProtocolIsis_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1172] + mi := &file_otg_proto_msgTypes[1179] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112568,7 +113233,7 @@ type StateProtocolIsisRouters_State struct { func (x *StateProtocolIsisRouters_State) Reset() { *x = StateProtocolIsisRouters_State{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1173] + mi := &file_otg_proto_msgTypes[1180] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112581,7 +113246,7 @@ func (x *StateProtocolIsisRouters_State) String() string { func (*StateProtocolIsisRouters_State) ProtoMessage() {} func (x *StateProtocolIsisRouters_State) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1173] + mi := &file_otg_proto_msgTypes[1180] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112606,7 +113271,7 @@ type ControlAction_Choice struct { func (x *ControlAction_Choice) Reset() { *x = ControlAction_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1174] + mi := &file_otg_proto_msgTypes[1181] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112619,7 +113284,7 @@ func (x *ControlAction_Choice) String() string { func (*ControlAction_Choice) ProtoMessage() {} func (x *ControlAction_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1174] + mi := &file_otg_proto_msgTypes[1181] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112644,7 +113309,7 @@ type ActionResponse_Choice struct { func (x *ActionResponse_Choice) Reset() { *x = ActionResponse_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1175] + mi := &file_otg_proto_msgTypes[1182] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112657,7 +113322,7 @@ func (x *ActionResponse_Choice) String() string { func (*ActionResponse_Choice) ProtoMessage() {} func (x *ActionResponse_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1175] + mi := &file_otg_proto_msgTypes[1182] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112682,7 +113347,7 @@ type ActionProtocol_Choice struct { func (x *ActionProtocol_Choice) Reset() { *x = ActionProtocol_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1176] + mi := &file_otg_proto_msgTypes[1183] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112695,7 +113360,7 @@ func (x *ActionProtocol_Choice) String() string { func (*ActionProtocol_Choice) ProtoMessage() {} func (x *ActionProtocol_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1176] + mi := &file_otg_proto_msgTypes[1183] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112720,7 +113385,7 @@ type ActionResponseProtocol_Choice struct { func (x *ActionResponseProtocol_Choice) Reset() { *x = ActionResponseProtocol_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1177] + mi := &file_otg_proto_msgTypes[1184] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112733,7 +113398,7 @@ func (x *ActionResponseProtocol_Choice) String() string { func (*ActionResponseProtocol_Choice) ProtoMessage() {} func (x *ActionResponseProtocol_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1177] + mi := &file_otg_proto_msgTypes[1184] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112758,7 +113423,7 @@ type ActionProtocolIpv4_Choice struct { func (x *ActionProtocolIpv4_Choice) Reset() { *x = ActionProtocolIpv4_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1178] + mi := &file_otg_proto_msgTypes[1185] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112771,7 +113436,7 @@ func (x *ActionProtocolIpv4_Choice) String() string { func (*ActionProtocolIpv4_Choice) ProtoMessage() {} func (x *ActionProtocolIpv4_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1178] + mi := &file_otg_proto_msgTypes[1185] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112796,7 +113461,7 @@ type ActionResponseProtocolIpv4_Choice struct { func (x *ActionResponseProtocolIpv4_Choice) Reset() { *x = ActionResponseProtocolIpv4_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1179] + mi := &file_otg_proto_msgTypes[1186] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112809,7 +113474,7 @@ func (x *ActionResponseProtocolIpv4_Choice) String() string { func (*ActionResponseProtocolIpv4_Choice) ProtoMessage() {} func (x *ActionResponseProtocolIpv4_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1179] + mi := &file_otg_proto_msgTypes[1186] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112834,7 +113499,7 @@ type ActionResponseProtocolIpv4PingResponse_Result struct { func (x *ActionResponseProtocolIpv4PingResponse_Result) Reset() { *x = ActionResponseProtocolIpv4PingResponse_Result{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1180] + mi := &file_otg_proto_msgTypes[1187] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112847,7 +113512,7 @@ func (x *ActionResponseProtocolIpv4PingResponse_Result) String() string { func (*ActionResponseProtocolIpv4PingResponse_Result) ProtoMessage() {} func (x *ActionResponseProtocolIpv4PingResponse_Result) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1180] + mi := &file_otg_proto_msgTypes[1187] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112872,7 +113537,7 @@ type ActionProtocolIpv6_Choice struct { func (x *ActionProtocolIpv6_Choice) Reset() { *x = ActionProtocolIpv6_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1181] + mi := &file_otg_proto_msgTypes[1188] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112885,7 +113550,7 @@ func (x *ActionProtocolIpv6_Choice) String() string { func (*ActionProtocolIpv6_Choice) ProtoMessage() {} func (x *ActionProtocolIpv6_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1181] + mi := &file_otg_proto_msgTypes[1188] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112910,7 +113575,7 @@ type ActionResponseProtocolIpv6_Choice struct { func (x *ActionResponseProtocolIpv6_Choice) Reset() { *x = ActionResponseProtocolIpv6_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1182] + mi := &file_otg_proto_msgTypes[1189] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112923,7 +113588,7 @@ func (x *ActionResponseProtocolIpv6_Choice) String() string { func (*ActionResponseProtocolIpv6_Choice) ProtoMessage() {} func (x *ActionResponseProtocolIpv6_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1182] + mi := &file_otg_proto_msgTypes[1189] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112948,7 +113613,7 @@ type ActionResponseProtocolIpv6PingResponse_Result struct { func (x *ActionResponseProtocolIpv6PingResponse_Result) Reset() { *x = ActionResponseProtocolIpv6PingResponse_Result{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1183] + mi := &file_otg_proto_msgTypes[1190] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112961,7 +113626,7 @@ func (x *ActionResponseProtocolIpv6PingResponse_Result) String() string { func (*ActionResponseProtocolIpv6PingResponse_Result) ProtoMessage() {} func (x *ActionResponseProtocolIpv6PingResponse_Result) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1183] + mi := &file_otg_proto_msgTypes[1190] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -112986,7 +113651,7 @@ type ActionProtocolBgp_Choice struct { func (x *ActionProtocolBgp_Choice) Reset() { *x = ActionProtocolBgp_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1184] + mi := &file_otg_proto_msgTypes[1191] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -112999,7 +113664,7 @@ func (x *ActionProtocolBgp_Choice) String() string { func (*ActionProtocolBgp_Choice) ProtoMessage() {} func (x *ActionProtocolBgp_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1184] + mi := &file_otg_proto_msgTypes[1191] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113024,7 +113689,7 @@ type ActionProtocolBgpNotification_Choice struct { func (x *ActionProtocolBgpNotification_Choice) Reset() { *x = ActionProtocolBgpNotification_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1185] + mi := &file_otg_proto_msgTypes[1192] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113037,7 +113702,7 @@ func (x *ActionProtocolBgpNotification_Choice) String() string { func (*ActionProtocolBgpNotification_Choice) ProtoMessage() {} func (x *ActionProtocolBgpNotification_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1185] + mi := &file_otg_proto_msgTypes[1192] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113062,7 +113727,7 @@ type MetricsRequest_Choice struct { func (x *MetricsRequest_Choice) Reset() { *x = MetricsRequest_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1186] + mi := &file_otg_proto_msgTypes[1193] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113075,7 +113740,7 @@ func (x *MetricsRequest_Choice) String() string { func (*MetricsRequest_Choice) ProtoMessage() {} func (x *MetricsRequest_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1186] + mi := &file_otg_proto_msgTypes[1193] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113100,7 +113765,7 @@ type MetricsResponse_Choice struct { func (x *MetricsResponse_Choice) Reset() { *x = MetricsResponse_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1187] + mi := &file_otg_proto_msgTypes[1194] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113113,7 +113778,7 @@ func (x *MetricsResponse_Choice) String() string { func (*MetricsResponse_Choice) ProtoMessage() {} func (x *MetricsResponse_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1187] + mi := &file_otg_proto_msgTypes[1194] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113138,7 +113803,7 @@ type PortMetricsRequest_ColumnNames struct { func (x *PortMetricsRequest_ColumnNames) Reset() { *x = PortMetricsRequest_ColumnNames{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1188] + mi := &file_otg_proto_msgTypes[1195] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113151,7 +113816,7 @@ func (x *PortMetricsRequest_ColumnNames) String() string { func (*PortMetricsRequest_ColumnNames) ProtoMessage() {} func (x *PortMetricsRequest_ColumnNames) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1188] + mi := &file_otg_proto_msgTypes[1195] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113176,7 +113841,7 @@ type PortMetric_Link struct { func (x *PortMetric_Link) Reset() { *x = PortMetric_Link{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1189] + mi := &file_otg_proto_msgTypes[1196] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113189,7 +113854,7 @@ func (x *PortMetric_Link) String() string { func (*PortMetric_Link) ProtoMessage() {} func (x *PortMetric_Link) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1189] + mi := &file_otg_proto_msgTypes[1196] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113214,7 +113879,7 @@ type PortMetric_Capture struct { func (x *PortMetric_Capture) Reset() { *x = PortMetric_Capture{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1190] + mi := &file_otg_proto_msgTypes[1197] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113227,7 +113892,7 @@ func (x *PortMetric_Capture) String() string { func (*PortMetric_Capture) ProtoMessage() {} func (x *PortMetric_Capture) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1190] + mi := &file_otg_proto_msgTypes[1197] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113252,7 +113917,7 @@ type PortMetric_Transmit struct { func (x *PortMetric_Transmit) Reset() { *x = PortMetric_Transmit{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1191] + mi := &file_otg_proto_msgTypes[1198] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113265,7 +113930,7 @@ func (x *PortMetric_Transmit) String() string { func (*PortMetric_Transmit) ProtoMessage() {} func (x *PortMetric_Transmit) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1191] + mi := &file_otg_proto_msgTypes[1198] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113290,7 +113955,7 @@ type FlowMetricsRequest_MetricNames struct { func (x *FlowMetricsRequest_MetricNames) Reset() { *x = FlowMetricsRequest_MetricNames{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1192] + mi := &file_otg_proto_msgTypes[1199] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113303,7 +113968,7 @@ func (x *FlowMetricsRequest_MetricNames) String() string { func (*FlowMetricsRequest_MetricNames) ProtoMessage() {} func (x *FlowMetricsRequest_MetricNames) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1192] + mi := &file_otg_proto_msgTypes[1199] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113328,7 +113993,7 @@ type FlowTaggedMetricsFilter_MetricNames struct { func (x *FlowTaggedMetricsFilter_MetricNames) Reset() { *x = FlowTaggedMetricsFilter_MetricNames{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1193] + mi := &file_otg_proto_msgTypes[1200] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113341,7 +114006,7 @@ func (x *FlowTaggedMetricsFilter_MetricNames) String() string { func (*FlowTaggedMetricsFilter_MetricNames) ProtoMessage() {} func (x *FlowTaggedMetricsFilter_MetricNames) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1193] + mi := &file_otg_proto_msgTypes[1200] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113366,7 +114031,7 @@ type FlowMetric_Transmit struct { func (x *FlowMetric_Transmit) Reset() { *x = FlowMetric_Transmit{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1194] + mi := &file_otg_proto_msgTypes[1201] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113379,7 +114044,7 @@ func (x *FlowMetric_Transmit) String() string { func (*FlowMetric_Transmit) ProtoMessage() {} func (x *FlowMetric_Transmit) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1194] + mi := &file_otg_proto_msgTypes[1201] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113404,7 +114069,7 @@ type FlowMetricTagValue_Choice struct { func (x *FlowMetricTagValue_Choice) Reset() { *x = FlowMetricTagValue_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1195] + mi := &file_otg_proto_msgTypes[1202] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113417,7 +114082,7 @@ func (x *FlowMetricTagValue_Choice) String() string { func (*FlowMetricTagValue_Choice) ProtoMessage() {} func (x *FlowMetricTagValue_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1195] + mi := &file_otg_proto_msgTypes[1202] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113442,7 +114107,7 @@ type Bgpv4MetricsRequest_ColumnNames struct { func (x *Bgpv4MetricsRequest_ColumnNames) Reset() { *x = Bgpv4MetricsRequest_ColumnNames{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1196] + mi := &file_otg_proto_msgTypes[1203] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113455,7 +114120,7 @@ func (x *Bgpv4MetricsRequest_ColumnNames) String() string { func (*Bgpv4MetricsRequest_ColumnNames) ProtoMessage() {} func (x *Bgpv4MetricsRequest_ColumnNames) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1196] + mi := &file_otg_proto_msgTypes[1203] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113480,7 +114145,7 @@ type Bgpv4Metric_SessionState struct { func (x *Bgpv4Metric_SessionState) Reset() { *x = Bgpv4Metric_SessionState{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1197] + mi := &file_otg_proto_msgTypes[1204] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113493,7 +114158,7 @@ func (x *Bgpv4Metric_SessionState) String() string { func (*Bgpv4Metric_SessionState) ProtoMessage() {} func (x *Bgpv4Metric_SessionState) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1197] + mi := &file_otg_proto_msgTypes[1204] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113518,7 +114183,7 @@ type Bgpv4Metric_FsmState struct { func (x *Bgpv4Metric_FsmState) Reset() { *x = Bgpv4Metric_FsmState{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1198] + mi := &file_otg_proto_msgTypes[1205] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113531,7 +114196,7 @@ func (x *Bgpv4Metric_FsmState) String() string { func (*Bgpv4Metric_FsmState) ProtoMessage() {} func (x *Bgpv4Metric_FsmState) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1198] + mi := &file_otg_proto_msgTypes[1205] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113556,7 +114221,7 @@ type Bgpv6MetricsRequest_ColumnNames struct { func (x *Bgpv6MetricsRequest_ColumnNames) Reset() { *x = Bgpv6MetricsRequest_ColumnNames{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1199] + mi := &file_otg_proto_msgTypes[1206] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113569,7 +114234,7 @@ func (x *Bgpv6MetricsRequest_ColumnNames) String() string { func (*Bgpv6MetricsRequest_ColumnNames) ProtoMessage() {} func (x *Bgpv6MetricsRequest_ColumnNames) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1199] + mi := &file_otg_proto_msgTypes[1206] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113594,7 +114259,7 @@ type Bgpv6Metric_SessionState struct { func (x *Bgpv6Metric_SessionState) Reset() { *x = Bgpv6Metric_SessionState{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1200] + mi := &file_otg_proto_msgTypes[1207] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113607,7 +114272,7 @@ func (x *Bgpv6Metric_SessionState) String() string { func (*Bgpv6Metric_SessionState) ProtoMessage() {} func (x *Bgpv6Metric_SessionState) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1200] + mi := &file_otg_proto_msgTypes[1207] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113632,7 +114297,7 @@ type Bgpv6Metric_FsmState struct { func (x *Bgpv6Metric_FsmState) Reset() { *x = Bgpv6Metric_FsmState{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1201] + mi := &file_otg_proto_msgTypes[1208] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113645,7 +114310,7 @@ func (x *Bgpv6Metric_FsmState) String() string { func (*Bgpv6Metric_FsmState) ProtoMessage() {} func (x *Bgpv6Metric_FsmState) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1201] + mi := &file_otg_proto_msgTypes[1208] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113670,7 +114335,7 @@ type IsisMetricsRequest_ColumnNames struct { func (x *IsisMetricsRequest_ColumnNames) Reset() { *x = IsisMetricsRequest_ColumnNames{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1202] + mi := &file_otg_proto_msgTypes[1209] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113683,7 +114348,7 @@ func (x *IsisMetricsRequest_ColumnNames) String() string { func (*IsisMetricsRequest_ColumnNames) ProtoMessage() {} func (x *IsisMetricsRequest_ColumnNames) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1202] + mi := &file_otg_proto_msgTypes[1209] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113708,7 +114373,7 @@ type LagMetricsRequest_ColumnNames struct { func (x *LagMetricsRequest_ColumnNames) Reset() { *x = LagMetricsRequest_ColumnNames{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1203] + mi := &file_otg_proto_msgTypes[1210] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113721,7 +114386,7 @@ func (x *LagMetricsRequest_ColumnNames) String() string { func (*LagMetricsRequest_ColumnNames) ProtoMessage() {} func (x *LagMetricsRequest_ColumnNames) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1203] + mi := &file_otg_proto_msgTypes[1210] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113746,7 +114411,7 @@ type LagMetric_OperStatus struct { func (x *LagMetric_OperStatus) Reset() { *x = LagMetric_OperStatus{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1204] + mi := &file_otg_proto_msgTypes[1211] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113759,7 +114424,7 @@ func (x *LagMetric_OperStatus) String() string { func (*LagMetric_OperStatus) ProtoMessage() {} func (x *LagMetric_OperStatus) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1204] + mi := &file_otg_proto_msgTypes[1211] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113784,7 +114449,7 @@ type LacpMetricsRequest_ColumnNames struct { func (x *LacpMetricsRequest_ColumnNames) Reset() { *x = LacpMetricsRequest_ColumnNames{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1205] + mi := &file_otg_proto_msgTypes[1212] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113797,7 +114462,7 @@ func (x *LacpMetricsRequest_ColumnNames) String() string { func (*LacpMetricsRequest_ColumnNames) ProtoMessage() {} func (x *LacpMetricsRequest_ColumnNames) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1205] + mi := &file_otg_proto_msgTypes[1212] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113822,7 +114487,7 @@ type LacpMetric_Activity struct { func (x *LacpMetric_Activity) Reset() { *x = LacpMetric_Activity{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1206] + mi := &file_otg_proto_msgTypes[1213] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113835,7 +114500,7 @@ func (x *LacpMetric_Activity) String() string { func (*LacpMetric_Activity) ProtoMessage() {} func (x *LacpMetric_Activity) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1206] + mi := &file_otg_proto_msgTypes[1213] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113860,7 +114525,7 @@ type LacpMetric_Timeout struct { func (x *LacpMetric_Timeout) Reset() { *x = LacpMetric_Timeout{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1207] + mi := &file_otg_proto_msgTypes[1214] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113873,7 +114538,7 @@ func (x *LacpMetric_Timeout) String() string { func (*LacpMetric_Timeout) ProtoMessage() {} func (x *LacpMetric_Timeout) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1207] + mi := &file_otg_proto_msgTypes[1214] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113898,7 +114563,7 @@ type LacpMetric_Synchronization struct { func (x *LacpMetric_Synchronization) Reset() { *x = LacpMetric_Synchronization{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1208] + mi := &file_otg_proto_msgTypes[1215] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113911,7 +114576,7 @@ func (x *LacpMetric_Synchronization) String() string { func (*LacpMetric_Synchronization) ProtoMessage() {} func (x *LacpMetric_Synchronization) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1208] + mi := &file_otg_proto_msgTypes[1215] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113936,7 +114601,7 @@ type LldpMetricsRequest_ColumnNames struct { func (x *LldpMetricsRequest_ColumnNames) Reset() { *x = LldpMetricsRequest_ColumnNames{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1209] + mi := &file_otg_proto_msgTypes[1216] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113949,7 +114614,7 @@ func (x *LldpMetricsRequest_ColumnNames) String() string { func (*LldpMetricsRequest_ColumnNames) ProtoMessage() {} func (x *LldpMetricsRequest_ColumnNames) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1209] + mi := &file_otg_proto_msgTypes[1216] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -113974,7 +114639,7 @@ type RsvpMetricsRequest_ColumnNames struct { func (x *RsvpMetricsRequest_ColumnNames) Reset() { *x = RsvpMetricsRequest_ColumnNames{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1210] + mi := &file_otg_proto_msgTypes[1217] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -113987,7 +114652,7 @@ func (x *RsvpMetricsRequest_ColumnNames) String() string { func (*RsvpMetricsRequest_ColumnNames) ProtoMessage() {} func (x *RsvpMetricsRequest_ColumnNames) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1210] + mi := &file_otg_proto_msgTypes[1217] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114012,7 +114677,7 @@ type Dhcpv4ClientMetricsRequest_ColumnNames struct { func (x *Dhcpv4ClientMetricsRequest_ColumnNames) Reset() { *x = Dhcpv4ClientMetricsRequest_ColumnNames{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1211] + mi := &file_otg_proto_msgTypes[1218] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114025,7 +114690,7 @@ func (x *Dhcpv4ClientMetricsRequest_ColumnNames) String() string { func (*Dhcpv4ClientMetricsRequest_ColumnNames) ProtoMessage() {} func (x *Dhcpv4ClientMetricsRequest_ColumnNames) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1211] + mi := &file_otg_proto_msgTypes[1218] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114050,7 +114715,7 @@ type Dhcpv4ServerMetricsRequest_ColumnNames struct { func (x *Dhcpv4ServerMetricsRequest_ColumnNames) Reset() { *x = Dhcpv4ServerMetricsRequest_ColumnNames{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1212] + mi := &file_otg_proto_msgTypes[1219] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114063,7 +114728,7 @@ func (x *Dhcpv4ServerMetricsRequest_ColumnNames) String() string { func (*Dhcpv4ServerMetricsRequest_ColumnNames) ProtoMessage() {} func (x *Dhcpv4ServerMetricsRequest_ColumnNames) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1212] + mi := &file_otg_proto_msgTypes[1219] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114088,7 +114753,7 @@ type StatesRequest_Choice struct { func (x *StatesRequest_Choice) Reset() { *x = StatesRequest_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1213] + mi := &file_otg_proto_msgTypes[1220] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114101,7 +114766,7 @@ func (x *StatesRequest_Choice) String() string { func (*StatesRequest_Choice) ProtoMessage() {} func (x *StatesRequest_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1213] + mi := &file_otg_proto_msgTypes[1220] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114126,7 +114791,7 @@ type StatesResponse_Choice struct { func (x *StatesResponse_Choice) Reset() { *x = StatesResponse_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1214] + mi := &file_otg_proto_msgTypes[1221] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114139,7 +114804,7 @@ func (x *StatesResponse_Choice) String() string { func (*StatesResponse_Choice) ProtoMessage() {} func (x *StatesResponse_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1214] + mi := &file_otg_proto_msgTypes[1221] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114164,7 +114829,7 @@ type BgpPrefixStateRequest_PrefixFilters struct { func (x *BgpPrefixStateRequest_PrefixFilters) Reset() { *x = BgpPrefixStateRequest_PrefixFilters{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1215] + mi := &file_otg_proto_msgTypes[1222] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114177,7 +114842,7 @@ func (x *BgpPrefixStateRequest_PrefixFilters) String() string { func (*BgpPrefixStateRequest_PrefixFilters) ProtoMessage() {} func (x *BgpPrefixStateRequest_PrefixFilters) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1215] + mi := &file_otg_proto_msgTypes[1222] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114202,7 +114867,7 @@ type BgpPrefixIpv4UnicastFilter_Origin struct { func (x *BgpPrefixIpv4UnicastFilter_Origin) Reset() { *x = BgpPrefixIpv4UnicastFilter_Origin{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1216] + mi := &file_otg_proto_msgTypes[1223] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114215,7 +114880,7 @@ func (x *BgpPrefixIpv4UnicastFilter_Origin) String() string { func (*BgpPrefixIpv4UnicastFilter_Origin) ProtoMessage() {} func (x *BgpPrefixIpv4UnicastFilter_Origin) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1216] + mi := &file_otg_proto_msgTypes[1223] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114240,7 +114905,7 @@ type BgpPrefixIpv6UnicastFilter_Origin struct { func (x *BgpPrefixIpv6UnicastFilter_Origin) Reset() { *x = BgpPrefixIpv6UnicastFilter_Origin{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1217] + mi := &file_otg_proto_msgTypes[1224] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114253,7 +114918,7 @@ func (x *BgpPrefixIpv6UnicastFilter_Origin) String() string { func (*BgpPrefixIpv6UnicastFilter_Origin) ProtoMessage() {} func (x *BgpPrefixIpv6UnicastFilter_Origin) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1217] + mi := &file_otg_proto_msgTypes[1224] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114278,7 +114943,7 @@ type BgpPrefixIpv4UnicastState_Origin struct { func (x *BgpPrefixIpv4UnicastState_Origin) Reset() { *x = BgpPrefixIpv4UnicastState_Origin{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1218] + mi := &file_otg_proto_msgTypes[1225] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114291,7 +114956,7 @@ func (x *BgpPrefixIpv4UnicastState_Origin) String() string { func (*BgpPrefixIpv4UnicastState_Origin) ProtoMessage() {} func (x *BgpPrefixIpv4UnicastState_Origin) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1218] + mi := &file_otg_proto_msgTypes[1225] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114316,7 +114981,7 @@ type BgpPrefixIpv6UnicastState_Origin struct { func (x *BgpPrefixIpv6UnicastState_Origin) Reset() { *x = BgpPrefixIpv6UnicastState_Origin{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1219] + mi := &file_otg_proto_msgTypes[1226] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114329,7 +114994,7 @@ func (x *BgpPrefixIpv6UnicastState_Origin) String() string { func (*BgpPrefixIpv6UnicastState_Origin) ProtoMessage() {} func (x *BgpPrefixIpv6UnicastState_Origin) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1219] + mi := &file_otg_proto_msgTypes[1226] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114354,7 +115019,7 @@ type ResultExtendedCommunityStructured_Choice struct { func (x *ResultExtendedCommunityStructured_Choice) Reset() { *x = ResultExtendedCommunityStructured_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1220] + mi := &file_otg_proto_msgTypes[1227] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114367,7 +115032,7 @@ func (x *ResultExtendedCommunityStructured_Choice) String() string { func (*ResultExtendedCommunityStructured_Choice) ProtoMessage() {} func (x *ResultExtendedCommunityStructured_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1220] + mi := &file_otg_proto_msgTypes[1227] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114392,7 +115057,7 @@ type ResultExtendedCommunityTransitive2OctetAsType_Choice struct { func (x *ResultExtendedCommunityTransitive2OctetAsType_Choice) Reset() { *x = ResultExtendedCommunityTransitive2OctetAsType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1221] + mi := &file_otg_proto_msgTypes[1228] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114405,7 +115070,7 @@ func (x *ResultExtendedCommunityTransitive2OctetAsType_Choice) String() string { func (*ResultExtendedCommunityTransitive2OctetAsType_Choice) ProtoMessage() {} func (x *ResultExtendedCommunityTransitive2OctetAsType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1221] + mi := &file_otg_proto_msgTypes[1228] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114430,7 +115095,7 @@ type ResultExtendedCommunityTransitiveIpv4AddressType_Choice struct { func (x *ResultExtendedCommunityTransitiveIpv4AddressType_Choice) Reset() { *x = ResultExtendedCommunityTransitiveIpv4AddressType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1222] + mi := &file_otg_proto_msgTypes[1229] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114443,7 +115108,7 @@ func (x *ResultExtendedCommunityTransitiveIpv4AddressType_Choice) String() strin func (*ResultExtendedCommunityTransitiveIpv4AddressType_Choice) ProtoMessage() {} func (x *ResultExtendedCommunityTransitiveIpv4AddressType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1222] + mi := &file_otg_proto_msgTypes[1229] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114468,7 +115133,7 @@ type ResultExtendedCommunityTransitive4OctetAsType_Choice struct { func (x *ResultExtendedCommunityTransitive4OctetAsType_Choice) Reset() { *x = ResultExtendedCommunityTransitive4OctetAsType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1223] + mi := &file_otg_proto_msgTypes[1230] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114481,7 +115146,7 @@ func (x *ResultExtendedCommunityTransitive4OctetAsType_Choice) String() string { func (*ResultExtendedCommunityTransitive4OctetAsType_Choice) ProtoMessage() {} func (x *ResultExtendedCommunityTransitive4OctetAsType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1223] + mi := &file_otg_proto_msgTypes[1230] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114506,7 +115171,7 @@ type ResultExtendedCommunityTransitiveOpaqueType_Choice struct { func (x *ResultExtendedCommunityTransitiveOpaqueType_Choice) Reset() { *x = ResultExtendedCommunityTransitiveOpaqueType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1224] + mi := &file_otg_proto_msgTypes[1231] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114519,7 +115184,7 @@ func (x *ResultExtendedCommunityTransitiveOpaqueType_Choice) String() string { func (*ResultExtendedCommunityTransitiveOpaqueType_Choice) ProtoMessage() {} func (x *ResultExtendedCommunityTransitiveOpaqueType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1224] + mi := &file_otg_proto_msgTypes[1231] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114544,7 +115209,7 @@ type ResultExtendedCommunityNonTransitive2OctetAsType_Choice struct { func (x *ResultExtendedCommunityNonTransitive2OctetAsType_Choice) Reset() { *x = ResultExtendedCommunityNonTransitive2OctetAsType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1225] + mi := &file_otg_proto_msgTypes[1232] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114557,7 +115222,7 @@ func (x *ResultExtendedCommunityNonTransitive2OctetAsType_Choice) String() strin func (*ResultExtendedCommunityNonTransitive2OctetAsType_Choice) ProtoMessage() {} func (x *ResultExtendedCommunityNonTransitive2OctetAsType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1225] + mi := &file_otg_proto_msgTypes[1232] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114582,7 +115247,7 @@ type ResultBgpCommunity_Type struct { func (x *ResultBgpCommunity_Type) Reset() { *x = ResultBgpCommunity_Type{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1226] + mi := &file_otg_proto_msgTypes[1233] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114595,7 +115260,7 @@ func (x *ResultBgpCommunity_Type) String() string { func (*ResultBgpCommunity_Type) ProtoMessage() {} func (x *ResultBgpCommunity_Type) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1226] + mi := &file_otg_proto_msgTypes[1233] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114620,7 +115285,7 @@ type ResultBgpAsPathSegment_Type struct { func (x *ResultBgpAsPathSegment_Type) Reset() { *x = ResultBgpAsPathSegment_Type{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1227] + mi := &file_otg_proto_msgTypes[1234] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114633,7 +115298,7 @@ func (x *ResultBgpAsPathSegment_Type) String() string { func (*ResultBgpAsPathSegment_Type) ProtoMessage() {} func (x *ResultBgpAsPathSegment_Type) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1227] + mi := &file_otg_proto_msgTypes[1234] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114658,7 +115323,7 @@ type IsisLspState_PduType struct { func (x *IsisLspState_PduType) Reset() { *x = IsisLspState_PduType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1228] + mi := &file_otg_proto_msgTypes[1235] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114671,7 +115336,7 @@ func (x *IsisLspState_PduType) String() string { func (*IsisLspState_PduType) ProtoMessage() {} func (x *IsisLspState_PduType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1228] + mi := &file_otg_proto_msgTypes[1235] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114696,7 +115361,7 @@ type IsisLspV4Prefix_RedistributionType struct { func (x *IsisLspV4Prefix_RedistributionType) Reset() { *x = IsisLspV4Prefix_RedistributionType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1229] + mi := &file_otg_proto_msgTypes[1236] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114709,7 +115374,7 @@ func (x *IsisLspV4Prefix_RedistributionType) String() string { func (*IsisLspV4Prefix_RedistributionType) ProtoMessage() {} func (x *IsisLspV4Prefix_RedistributionType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1229] + mi := &file_otg_proto_msgTypes[1236] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114734,7 +115399,7 @@ type IsisLspV4Prefix_OriginType struct { func (x *IsisLspV4Prefix_OriginType) Reset() { *x = IsisLspV4Prefix_OriginType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1230] + mi := &file_otg_proto_msgTypes[1237] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114747,7 +115412,7 @@ func (x *IsisLspV4Prefix_OriginType) String() string { func (*IsisLspV4Prefix_OriginType) ProtoMessage() {} func (x *IsisLspV4Prefix_OriginType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1230] + mi := &file_otg_proto_msgTypes[1237] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114772,7 +115437,7 @@ type IsisLspExtendedV4Prefix_RedistributionType struct { func (x *IsisLspExtendedV4Prefix_RedistributionType) Reset() { *x = IsisLspExtendedV4Prefix_RedistributionType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1231] + mi := &file_otg_proto_msgTypes[1238] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114785,7 +115450,7 @@ func (x *IsisLspExtendedV4Prefix_RedistributionType) String() string { func (*IsisLspExtendedV4Prefix_RedistributionType) ProtoMessage() {} func (x *IsisLspExtendedV4Prefix_RedistributionType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1231] + mi := &file_otg_proto_msgTypes[1238] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114810,7 +115475,7 @@ type IsisLspV6Prefix_RedistributionType struct { func (x *IsisLspV6Prefix_RedistributionType) Reset() { *x = IsisLspV6Prefix_RedistributionType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1232] + mi := &file_otg_proto_msgTypes[1239] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114823,7 +115488,7 @@ func (x *IsisLspV6Prefix_RedistributionType) String() string { func (*IsisLspV6Prefix_RedistributionType) ProtoMessage() {} func (x *IsisLspV6Prefix_RedistributionType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1232] + mi := &file_otg_proto_msgTypes[1239] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114848,7 +115513,7 @@ type IsisLspV6Prefix_OriginType struct { func (x *IsisLspV6Prefix_OriginType) Reset() { *x = IsisLspV6Prefix_OriginType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1233] + mi := &file_otg_proto_msgTypes[1240] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114861,7 +115526,7 @@ func (x *IsisLspV6Prefix_OriginType) String() string { func (*IsisLspV6Prefix_OriginType) ProtoMessage() {} func (x *IsisLspV6Prefix_OriginType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1233] + mi := &file_otg_proto_msgTypes[1240] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114886,7 +115551,7 @@ type LldpNeighborsState_ChassisIdType struct { func (x *LldpNeighborsState_ChassisIdType) Reset() { *x = LldpNeighborsState_ChassisIdType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1234] + mi := &file_otg_proto_msgTypes[1241] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114899,7 +115564,7 @@ func (x *LldpNeighborsState_ChassisIdType) String() string { func (*LldpNeighborsState_ChassisIdType) ProtoMessage() {} func (x *LldpNeighborsState_ChassisIdType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1234] + mi := &file_otg_proto_msgTypes[1241] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114924,7 +115589,7 @@ type LldpNeighborsState_PortIdType struct { func (x *LldpNeighborsState_PortIdType) Reset() { *x = LldpNeighborsState_PortIdType{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1235] + mi := &file_otg_proto_msgTypes[1242] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114937,7 +115602,7 @@ func (x *LldpNeighborsState_PortIdType) String() string { func (*LldpNeighborsState_PortIdType) ProtoMessage() {} func (x *LldpNeighborsState_PortIdType) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1235] + mi := &file_otg_proto_msgTypes[1242] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114962,7 +115627,7 @@ type LldpCapabilityState_CapabilityName struct { func (x *LldpCapabilityState_CapabilityName) Reset() { *x = LldpCapabilityState_CapabilityName{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1236] + mi := &file_otg_proto_msgTypes[1243] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -114975,7 +115640,7 @@ func (x *LldpCapabilityState_CapabilityName) String() string { func (*LldpCapabilityState_CapabilityName) ProtoMessage() {} func (x *LldpCapabilityState_CapabilityName) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1236] + mi := &file_otg_proto_msgTypes[1243] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115000,7 +115665,7 @@ type RsvpLspState_SessionStatus struct { func (x *RsvpLspState_SessionStatus) Reset() { *x = RsvpLspState_SessionStatus{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1237] + mi := &file_otg_proto_msgTypes[1244] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115013,7 +115678,7 @@ func (x *RsvpLspState_SessionStatus) String() string { func (*RsvpLspState_SessionStatus) ProtoMessage() {} func (x *RsvpLspState_SessionStatus) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1237] + mi := &file_otg_proto_msgTypes[1244] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115038,7 +115703,7 @@ type RsvpLspState_LastFlapReason struct { func (x *RsvpLspState_LastFlapReason) Reset() { *x = RsvpLspState_LastFlapReason{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1238] + mi := &file_otg_proto_msgTypes[1245] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115051,7 +115716,7 @@ func (x *RsvpLspState_LastFlapReason) String() string { func (*RsvpLspState_LastFlapReason) ProtoMessage() {} func (x *RsvpLspState_LastFlapReason) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1238] + mi := &file_otg_proto_msgTypes[1245] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115076,7 +115741,7 @@ type RsvpLspIpv4Ero_Type struct { func (x *RsvpLspIpv4Ero_Type) Reset() { *x = RsvpLspIpv4Ero_Type{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1239] + mi := &file_otg_proto_msgTypes[1246] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115089,7 +115754,7 @@ func (x *RsvpLspIpv4Ero_Type) String() string { func (*RsvpLspIpv4Ero_Type) ProtoMessage() {} func (x *RsvpLspIpv4Ero_Type) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1239] + mi := &file_otg_proto_msgTypes[1246] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115114,7 +115779,7 @@ type PatternFlowEthernetDst_Choice struct { func (x *PatternFlowEthernetDst_Choice) Reset() { *x = PatternFlowEthernetDst_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1240] + mi := &file_otg_proto_msgTypes[1247] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115127,7 +115792,7 @@ func (x *PatternFlowEthernetDst_Choice) String() string { func (*PatternFlowEthernetDst_Choice) ProtoMessage() {} func (x *PatternFlowEthernetDst_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1240] + mi := &file_otg_proto_msgTypes[1247] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115152,7 +115817,7 @@ type PatternFlowEthernetSrc_Choice struct { func (x *PatternFlowEthernetSrc_Choice) Reset() { *x = PatternFlowEthernetSrc_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1241] + mi := &file_otg_proto_msgTypes[1248] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115165,7 +115830,7 @@ func (x *PatternFlowEthernetSrc_Choice) String() string { func (*PatternFlowEthernetSrc_Choice) ProtoMessage() {} func (x *PatternFlowEthernetSrc_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1241] + mi := &file_otg_proto_msgTypes[1248] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115190,7 +115855,7 @@ type PatternFlowEthernetEtherType_Choice struct { func (x *PatternFlowEthernetEtherType_Choice) Reset() { *x = PatternFlowEthernetEtherType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1242] + mi := &file_otg_proto_msgTypes[1249] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115203,7 +115868,7 @@ func (x *PatternFlowEthernetEtherType_Choice) String() string { func (*PatternFlowEthernetEtherType_Choice) ProtoMessage() {} func (x *PatternFlowEthernetEtherType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1242] + mi := &file_otg_proto_msgTypes[1249] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115228,7 +115893,7 @@ type PatternFlowEthernetPfcQueue_Choice struct { func (x *PatternFlowEthernetPfcQueue_Choice) Reset() { *x = PatternFlowEthernetPfcQueue_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1243] + mi := &file_otg_proto_msgTypes[1250] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115241,7 +115906,7 @@ func (x *PatternFlowEthernetPfcQueue_Choice) String() string { func (*PatternFlowEthernetPfcQueue_Choice) ProtoMessage() {} func (x *PatternFlowEthernetPfcQueue_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1243] + mi := &file_otg_proto_msgTypes[1250] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115266,7 +115931,7 @@ type PatternFlowVlanPriority_Choice struct { func (x *PatternFlowVlanPriority_Choice) Reset() { *x = PatternFlowVlanPriority_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1244] + mi := &file_otg_proto_msgTypes[1251] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115279,7 +115944,7 @@ func (x *PatternFlowVlanPriority_Choice) String() string { func (*PatternFlowVlanPriority_Choice) ProtoMessage() {} func (x *PatternFlowVlanPriority_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1244] + mi := &file_otg_proto_msgTypes[1251] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115304,7 +115969,7 @@ type PatternFlowVlanCfi_Choice struct { func (x *PatternFlowVlanCfi_Choice) Reset() { *x = PatternFlowVlanCfi_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1245] + mi := &file_otg_proto_msgTypes[1252] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115317,7 +115982,7 @@ func (x *PatternFlowVlanCfi_Choice) String() string { func (*PatternFlowVlanCfi_Choice) ProtoMessage() {} func (x *PatternFlowVlanCfi_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1245] + mi := &file_otg_proto_msgTypes[1252] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115342,7 +116007,7 @@ type PatternFlowVlanId_Choice struct { func (x *PatternFlowVlanId_Choice) Reset() { *x = PatternFlowVlanId_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1246] + mi := &file_otg_proto_msgTypes[1253] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115355,7 +116020,7 @@ func (x *PatternFlowVlanId_Choice) String() string { func (*PatternFlowVlanId_Choice) ProtoMessage() {} func (x *PatternFlowVlanId_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1246] + mi := &file_otg_proto_msgTypes[1253] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115380,7 +116045,7 @@ type PatternFlowVlanTpid_Choice struct { func (x *PatternFlowVlanTpid_Choice) Reset() { *x = PatternFlowVlanTpid_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1247] + mi := &file_otg_proto_msgTypes[1254] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115393,7 +116058,7 @@ func (x *PatternFlowVlanTpid_Choice) String() string { func (*PatternFlowVlanTpid_Choice) ProtoMessage() {} func (x *PatternFlowVlanTpid_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1247] + mi := &file_otg_proto_msgTypes[1254] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115418,7 +116083,7 @@ type PatternFlowVxlanFlags_Choice struct { func (x *PatternFlowVxlanFlags_Choice) Reset() { *x = PatternFlowVxlanFlags_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1248] + mi := &file_otg_proto_msgTypes[1255] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115431,7 +116096,7 @@ func (x *PatternFlowVxlanFlags_Choice) String() string { func (*PatternFlowVxlanFlags_Choice) ProtoMessage() {} func (x *PatternFlowVxlanFlags_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1248] + mi := &file_otg_proto_msgTypes[1255] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115456,7 +116121,7 @@ type PatternFlowVxlanReserved0_Choice struct { func (x *PatternFlowVxlanReserved0_Choice) Reset() { *x = PatternFlowVxlanReserved0_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1249] + mi := &file_otg_proto_msgTypes[1256] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115469,7 +116134,7 @@ func (x *PatternFlowVxlanReserved0_Choice) String() string { func (*PatternFlowVxlanReserved0_Choice) ProtoMessage() {} func (x *PatternFlowVxlanReserved0_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1249] + mi := &file_otg_proto_msgTypes[1256] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115494,7 +116159,7 @@ type PatternFlowVxlanVni_Choice struct { func (x *PatternFlowVxlanVni_Choice) Reset() { *x = PatternFlowVxlanVni_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1250] + mi := &file_otg_proto_msgTypes[1257] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115507,7 +116172,7 @@ func (x *PatternFlowVxlanVni_Choice) String() string { func (*PatternFlowVxlanVni_Choice) ProtoMessage() {} func (x *PatternFlowVxlanVni_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1250] + mi := &file_otg_proto_msgTypes[1257] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115532,7 +116197,7 @@ type PatternFlowVxlanReserved1_Choice struct { func (x *PatternFlowVxlanReserved1_Choice) Reset() { *x = PatternFlowVxlanReserved1_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1251] + mi := &file_otg_proto_msgTypes[1258] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115545,7 +116210,7 @@ func (x *PatternFlowVxlanReserved1_Choice) String() string { func (*PatternFlowVxlanReserved1_Choice) ProtoMessage() {} func (x *PatternFlowVxlanReserved1_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1251] + mi := &file_otg_proto_msgTypes[1258] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115570,7 +116235,7 @@ type PatternFlowIpv4Version_Choice struct { func (x *PatternFlowIpv4Version_Choice) Reset() { *x = PatternFlowIpv4Version_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1252] + mi := &file_otg_proto_msgTypes[1259] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115583,7 +116248,7 @@ func (x *PatternFlowIpv4Version_Choice) String() string { func (*PatternFlowIpv4Version_Choice) ProtoMessage() {} func (x *PatternFlowIpv4Version_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1252] + mi := &file_otg_proto_msgTypes[1259] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115608,7 +116273,7 @@ type PatternFlowIpv4HeaderLength_Choice struct { func (x *PatternFlowIpv4HeaderLength_Choice) Reset() { *x = PatternFlowIpv4HeaderLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1253] + mi := &file_otg_proto_msgTypes[1260] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115621,7 +116286,7 @@ func (x *PatternFlowIpv4HeaderLength_Choice) String() string { func (*PatternFlowIpv4HeaderLength_Choice) ProtoMessage() {} func (x *PatternFlowIpv4HeaderLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1253] + mi := &file_otg_proto_msgTypes[1260] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115646,7 +116311,7 @@ type PatternFlowIpv4TotalLength_Choice struct { func (x *PatternFlowIpv4TotalLength_Choice) Reset() { *x = PatternFlowIpv4TotalLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1254] + mi := &file_otg_proto_msgTypes[1261] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115659,7 +116324,7 @@ func (x *PatternFlowIpv4TotalLength_Choice) String() string { func (*PatternFlowIpv4TotalLength_Choice) ProtoMessage() {} func (x *PatternFlowIpv4TotalLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1254] + mi := &file_otg_proto_msgTypes[1261] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115684,7 +116349,7 @@ type PatternFlowIpv4Identification_Choice struct { func (x *PatternFlowIpv4Identification_Choice) Reset() { *x = PatternFlowIpv4Identification_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1255] + mi := &file_otg_proto_msgTypes[1262] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115697,7 +116362,7 @@ func (x *PatternFlowIpv4Identification_Choice) String() string { func (*PatternFlowIpv4Identification_Choice) ProtoMessage() {} func (x *PatternFlowIpv4Identification_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1255] + mi := &file_otg_proto_msgTypes[1262] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115722,7 +116387,7 @@ type PatternFlowIpv4Reserved_Choice struct { func (x *PatternFlowIpv4Reserved_Choice) Reset() { *x = PatternFlowIpv4Reserved_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1256] + mi := &file_otg_proto_msgTypes[1263] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115735,7 +116400,7 @@ func (x *PatternFlowIpv4Reserved_Choice) String() string { func (*PatternFlowIpv4Reserved_Choice) ProtoMessage() {} func (x *PatternFlowIpv4Reserved_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1256] + mi := &file_otg_proto_msgTypes[1263] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115760,7 +116425,7 @@ type PatternFlowIpv4DontFragment_Choice struct { func (x *PatternFlowIpv4DontFragment_Choice) Reset() { *x = PatternFlowIpv4DontFragment_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1257] + mi := &file_otg_proto_msgTypes[1264] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115773,7 +116438,7 @@ func (x *PatternFlowIpv4DontFragment_Choice) String() string { func (*PatternFlowIpv4DontFragment_Choice) ProtoMessage() {} func (x *PatternFlowIpv4DontFragment_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1257] + mi := &file_otg_proto_msgTypes[1264] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115798,7 +116463,7 @@ type PatternFlowIpv4MoreFragments_Choice struct { func (x *PatternFlowIpv4MoreFragments_Choice) Reset() { *x = PatternFlowIpv4MoreFragments_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1258] + mi := &file_otg_proto_msgTypes[1265] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115811,7 +116476,7 @@ func (x *PatternFlowIpv4MoreFragments_Choice) String() string { func (*PatternFlowIpv4MoreFragments_Choice) ProtoMessage() {} func (x *PatternFlowIpv4MoreFragments_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1258] + mi := &file_otg_proto_msgTypes[1265] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115836,7 +116501,7 @@ type PatternFlowIpv4FragmentOffset_Choice struct { func (x *PatternFlowIpv4FragmentOffset_Choice) Reset() { *x = PatternFlowIpv4FragmentOffset_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1259] + mi := &file_otg_proto_msgTypes[1266] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115849,7 +116514,7 @@ func (x *PatternFlowIpv4FragmentOffset_Choice) String() string { func (*PatternFlowIpv4FragmentOffset_Choice) ProtoMessage() {} func (x *PatternFlowIpv4FragmentOffset_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1259] + mi := &file_otg_proto_msgTypes[1266] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115874,7 +116539,7 @@ type PatternFlowIpv4TimeToLive_Choice struct { func (x *PatternFlowIpv4TimeToLive_Choice) Reset() { *x = PatternFlowIpv4TimeToLive_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1260] + mi := &file_otg_proto_msgTypes[1267] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115887,7 +116552,7 @@ func (x *PatternFlowIpv4TimeToLive_Choice) String() string { func (*PatternFlowIpv4TimeToLive_Choice) ProtoMessage() {} func (x *PatternFlowIpv4TimeToLive_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1260] + mi := &file_otg_proto_msgTypes[1267] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115912,7 +116577,7 @@ type PatternFlowIpv4Protocol_Choice struct { func (x *PatternFlowIpv4Protocol_Choice) Reset() { *x = PatternFlowIpv4Protocol_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1261] + mi := &file_otg_proto_msgTypes[1268] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115925,7 +116590,7 @@ func (x *PatternFlowIpv4Protocol_Choice) String() string { func (*PatternFlowIpv4Protocol_Choice) ProtoMessage() {} func (x *PatternFlowIpv4Protocol_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1261] + mi := &file_otg_proto_msgTypes[1268] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115950,7 +116615,7 @@ type PatternFlowIpv4HeaderChecksum_Choice struct { func (x *PatternFlowIpv4HeaderChecksum_Choice) Reset() { *x = PatternFlowIpv4HeaderChecksum_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1262] + mi := &file_otg_proto_msgTypes[1269] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -115963,7 +116628,7 @@ func (x *PatternFlowIpv4HeaderChecksum_Choice) String() string { func (*PatternFlowIpv4HeaderChecksum_Choice) ProtoMessage() {} func (x *PatternFlowIpv4HeaderChecksum_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1262] + mi := &file_otg_proto_msgTypes[1269] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -115988,7 +116653,7 @@ type PatternFlowIpv4HeaderChecksum_Generated struct { func (x *PatternFlowIpv4HeaderChecksum_Generated) Reset() { *x = PatternFlowIpv4HeaderChecksum_Generated{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1263] + mi := &file_otg_proto_msgTypes[1270] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116001,7 +116666,7 @@ func (x *PatternFlowIpv4HeaderChecksum_Generated) String() string { func (*PatternFlowIpv4HeaderChecksum_Generated) ProtoMessage() {} func (x *PatternFlowIpv4HeaderChecksum_Generated) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1263] + mi := &file_otg_proto_msgTypes[1270] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116026,7 +116691,7 @@ type PatternFlowIpv4Src_Choice struct { func (x *PatternFlowIpv4Src_Choice) Reset() { *x = PatternFlowIpv4Src_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1264] + mi := &file_otg_proto_msgTypes[1271] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116039,7 +116704,7 @@ func (x *PatternFlowIpv4Src_Choice) String() string { func (*PatternFlowIpv4Src_Choice) ProtoMessage() {} func (x *PatternFlowIpv4Src_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1264] + mi := &file_otg_proto_msgTypes[1271] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116052,7 +116717,7 @@ func (x *PatternFlowIpv4Src_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4Src_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4Src_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{554, 0} + return file_otg_proto_rawDescGZIP(), []int{555, 0} } type PatternFlowIpv4Dst_Choice struct { @@ -116064,7 +116729,7 @@ type PatternFlowIpv4Dst_Choice struct { func (x *PatternFlowIpv4Dst_Choice) Reset() { *x = PatternFlowIpv4Dst_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1265] + mi := &file_otg_proto_msgTypes[1272] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116077,7 +116742,7 @@ func (x *PatternFlowIpv4Dst_Choice) String() string { func (*PatternFlowIpv4Dst_Choice) ProtoMessage() {} func (x *PatternFlowIpv4Dst_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1265] + mi := &file_otg_proto_msgTypes[1272] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116090,7 +116755,7 @@ func (x *PatternFlowIpv4Dst_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4Dst_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4Dst_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{557, 0} + return file_otg_proto_rawDescGZIP(), []int{559, 0} } type PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice struct { @@ -116102,7 +116767,7 @@ type PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice struct { func (x *PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice) Reset() { *x = PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1266] + mi := &file_otg_proto_msgTypes[1273] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116115,7 +116780,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice) String() string { func (*PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice) ProtoMessage() {} func (x *PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1266] + mi := &file_otg_proto_msgTypes[1273] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116128,7 +116793,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice) ProtoReflect() proto // Deprecated: Use PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{559, 0} + return file_otg_proto_rawDescGZIP(), []int{561, 0} } type PatternFlowIpv4OptionsCustomTypeOptionClass_Choice struct { @@ -116140,7 +116805,7 @@ type PatternFlowIpv4OptionsCustomTypeOptionClass_Choice struct { func (x *PatternFlowIpv4OptionsCustomTypeOptionClass_Choice) Reset() { *x = PatternFlowIpv4OptionsCustomTypeOptionClass_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1267] + mi := &file_otg_proto_msgTypes[1274] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116153,7 +116818,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeOptionClass_Choice) String() string { func (*PatternFlowIpv4OptionsCustomTypeOptionClass_Choice) ProtoMessage() {} func (x *PatternFlowIpv4OptionsCustomTypeOptionClass_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1267] + mi := &file_otg_proto_msgTypes[1274] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116166,7 +116831,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeOptionClass_Choice) ProtoReflect() prot // Deprecated: Use PatternFlowIpv4OptionsCustomTypeOptionClass_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4OptionsCustomTypeOptionClass_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{561, 0} + return file_otg_proto_rawDescGZIP(), []int{563, 0} } type PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice struct { @@ -116178,7 +116843,7 @@ type PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice struct { func (x *PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice) Reset() { *x = PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1268] + mi := &file_otg_proto_msgTypes[1275] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116191,7 +116856,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice) String() string { func (*PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice) ProtoMessage() {} func (x *PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1268] + mi := &file_otg_proto_msgTypes[1275] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116204,7 +116869,7 @@ func (x *PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice) ProtoReflect() pro // Deprecated: Use PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{563, 0} + return file_otg_proto_rawDescGZIP(), []int{565, 0} } type PatternFlowIpv4PriorityRaw_Choice struct { @@ -116216,7 +116881,7 @@ type PatternFlowIpv4PriorityRaw_Choice struct { func (x *PatternFlowIpv4PriorityRaw_Choice) Reset() { *x = PatternFlowIpv4PriorityRaw_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1269] + mi := &file_otg_proto_msgTypes[1276] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116229,7 +116894,7 @@ func (x *PatternFlowIpv4PriorityRaw_Choice) String() string { func (*PatternFlowIpv4PriorityRaw_Choice) ProtoMessage() {} func (x *PatternFlowIpv4PriorityRaw_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1269] + mi := &file_otg_proto_msgTypes[1276] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116242,7 +116907,7 @@ func (x *PatternFlowIpv4PriorityRaw_Choice) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowIpv4PriorityRaw_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4PriorityRaw_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{566, 0} + return file_otg_proto_rawDescGZIP(), []int{568, 0} } type PatternFlowIpv4DscpPhb_Choice struct { @@ -116254,7 +116919,7 @@ type PatternFlowIpv4DscpPhb_Choice struct { func (x *PatternFlowIpv4DscpPhb_Choice) Reset() { *x = PatternFlowIpv4DscpPhb_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1270] + mi := &file_otg_proto_msgTypes[1277] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116267,7 +116932,7 @@ func (x *PatternFlowIpv4DscpPhb_Choice) String() string { func (*PatternFlowIpv4DscpPhb_Choice) ProtoMessage() {} func (x *PatternFlowIpv4DscpPhb_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1270] + mi := &file_otg_proto_msgTypes[1277] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116280,7 +116945,7 @@ func (x *PatternFlowIpv4DscpPhb_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4DscpPhb_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4DscpPhb_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{569, 0} + return file_otg_proto_rawDescGZIP(), []int{571, 0} } type PatternFlowIpv4DscpEcn_Choice struct { @@ -116292,7 +116957,7 @@ type PatternFlowIpv4DscpEcn_Choice struct { func (x *PatternFlowIpv4DscpEcn_Choice) Reset() { *x = PatternFlowIpv4DscpEcn_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1271] + mi := &file_otg_proto_msgTypes[1278] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116305,7 +116970,7 @@ func (x *PatternFlowIpv4DscpEcn_Choice) String() string { func (*PatternFlowIpv4DscpEcn_Choice) ProtoMessage() {} func (x *PatternFlowIpv4DscpEcn_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1271] + mi := &file_otg_proto_msgTypes[1278] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116318,7 +116983,7 @@ func (x *PatternFlowIpv4DscpEcn_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4DscpEcn_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4DscpEcn_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{572, 0} + return file_otg_proto_rawDescGZIP(), []int{574, 0} } type PatternFlowIpv4TosPrecedence_Choice struct { @@ -116330,7 +116995,7 @@ type PatternFlowIpv4TosPrecedence_Choice struct { func (x *PatternFlowIpv4TosPrecedence_Choice) Reset() { *x = PatternFlowIpv4TosPrecedence_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1272] + mi := &file_otg_proto_msgTypes[1279] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116343,7 +117008,7 @@ func (x *PatternFlowIpv4TosPrecedence_Choice) String() string { func (*PatternFlowIpv4TosPrecedence_Choice) ProtoMessage() {} func (x *PatternFlowIpv4TosPrecedence_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1272] + mi := &file_otg_proto_msgTypes[1279] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116356,7 +117021,7 @@ func (x *PatternFlowIpv4TosPrecedence_Choice) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowIpv4TosPrecedence_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosPrecedence_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{575, 0} + return file_otg_proto_rawDescGZIP(), []int{577, 0} } type PatternFlowIpv4TosDelay_Choice struct { @@ -116368,7 +117033,7 @@ type PatternFlowIpv4TosDelay_Choice struct { func (x *PatternFlowIpv4TosDelay_Choice) Reset() { *x = PatternFlowIpv4TosDelay_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1273] + mi := &file_otg_proto_msgTypes[1280] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116381,7 +117046,7 @@ func (x *PatternFlowIpv4TosDelay_Choice) String() string { func (*PatternFlowIpv4TosDelay_Choice) ProtoMessage() {} func (x *PatternFlowIpv4TosDelay_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1273] + mi := &file_otg_proto_msgTypes[1280] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116394,7 +117059,7 @@ func (x *PatternFlowIpv4TosDelay_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4TosDelay_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosDelay_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{578, 0} + return file_otg_proto_rawDescGZIP(), []int{580, 0} } type PatternFlowIpv4TosThroughput_Choice struct { @@ -116406,7 +117071,7 @@ type PatternFlowIpv4TosThroughput_Choice struct { func (x *PatternFlowIpv4TosThroughput_Choice) Reset() { *x = PatternFlowIpv4TosThroughput_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1274] + mi := &file_otg_proto_msgTypes[1281] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116419,7 +117084,7 @@ func (x *PatternFlowIpv4TosThroughput_Choice) String() string { func (*PatternFlowIpv4TosThroughput_Choice) ProtoMessage() {} func (x *PatternFlowIpv4TosThroughput_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1274] + mi := &file_otg_proto_msgTypes[1281] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116432,7 +117097,7 @@ func (x *PatternFlowIpv4TosThroughput_Choice) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowIpv4TosThroughput_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosThroughput_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{581, 0} + return file_otg_proto_rawDescGZIP(), []int{583, 0} } type PatternFlowIpv4TosReliability_Choice struct { @@ -116444,7 +117109,7 @@ type PatternFlowIpv4TosReliability_Choice struct { func (x *PatternFlowIpv4TosReliability_Choice) Reset() { *x = PatternFlowIpv4TosReliability_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1275] + mi := &file_otg_proto_msgTypes[1282] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116457,7 +117122,7 @@ func (x *PatternFlowIpv4TosReliability_Choice) String() string { func (*PatternFlowIpv4TosReliability_Choice) ProtoMessage() {} func (x *PatternFlowIpv4TosReliability_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1275] + mi := &file_otg_proto_msgTypes[1282] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116470,7 +117135,7 @@ func (x *PatternFlowIpv4TosReliability_Choice) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowIpv4TosReliability_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosReliability_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{584, 0} + return file_otg_proto_rawDescGZIP(), []int{586, 0} } type PatternFlowIpv4TosMonetary_Choice struct { @@ -116482,7 +117147,7 @@ type PatternFlowIpv4TosMonetary_Choice struct { func (x *PatternFlowIpv4TosMonetary_Choice) Reset() { *x = PatternFlowIpv4TosMonetary_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1276] + mi := &file_otg_proto_msgTypes[1283] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116495,7 +117160,7 @@ func (x *PatternFlowIpv4TosMonetary_Choice) String() string { func (*PatternFlowIpv4TosMonetary_Choice) ProtoMessage() {} func (x *PatternFlowIpv4TosMonetary_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1276] + mi := &file_otg_proto_msgTypes[1283] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116508,7 +117173,7 @@ func (x *PatternFlowIpv4TosMonetary_Choice) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowIpv4TosMonetary_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosMonetary_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{587, 0} + return file_otg_proto_rawDescGZIP(), []int{589, 0} } type PatternFlowIpv4TosUnused_Choice struct { @@ -116520,7 +117185,7 @@ type PatternFlowIpv4TosUnused_Choice struct { func (x *PatternFlowIpv4TosUnused_Choice) Reset() { *x = PatternFlowIpv4TosUnused_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1277] + mi := &file_otg_proto_msgTypes[1284] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116533,7 +117198,7 @@ func (x *PatternFlowIpv4TosUnused_Choice) String() string { func (*PatternFlowIpv4TosUnused_Choice) ProtoMessage() {} func (x *PatternFlowIpv4TosUnused_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1277] + mi := &file_otg_proto_msgTypes[1284] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116546,7 +117211,7 @@ func (x *PatternFlowIpv4TosUnused_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv4TosUnused_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv4TosUnused_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{590, 0} + return file_otg_proto_rawDescGZIP(), []int{592, 0} } type PatternFlowIpv6Version_Choice struct { @@ -116558,7 +117223,7 @@ type PatternFlowIpv6Version_Choice struct { func (x *PatternFlowIpv6Version_Choice) Reset() { *x = PatternFlowIpv6Version_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1278] + mi := &file_otg_proto_msgTypes[1285] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116571,7 +117236,7 @@ func (x *PatternFlowIpv6Version_Choice) String() string { func (*PatternFlowIpv6Version_Choice) ProtoMessage() {} func (x *PatternFlowIpv6Version_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1278] + mi := &file_otg_proto_msgTypes[1285] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116584,7 +117249,7 @@ func (x *PatternFlowIpv6Version_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6Version_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6Version_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{593, 0} + return file_otg_proto_rawDescGZIP(), []int{595, 0} } type PatternFlowIpv6TrafficClass_Choice struct { @@ -116596,7 +117261,7 @@ type PatternFlowIpv6TrafficClass_Choice struct { func (x *PatternFlowIpv6TrafficClass_Choice) Reset() { *x = PatternFlowIpv6TrafficClass_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1279] + mi := &file_otg_proto_msgTypes[1286] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116609,7 +117274,7 @@ func (x *PatternFlowIpv6TrafficClass_Choice) String() string { func (*PatternFlowIpv6TrafficClass_Choice) ProtoMessage() {} func (x *PatternFlowIpv6TrafficClass_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1279] + mi := &file_otg_proto_msgTypes[1286] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116622,7 +117287,7 @@ func (x *PatternFlowIpv6TrafficClass_Choice) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowIpv6TrafficClass_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6TrafficClass_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{596, 0} + return file_otg_proto_rawDescGZIP(), []int{598, 0} } type PatternFlowIpv6FlowLabel_Choice struct { @@ -116634,7 +117299,7 @@ type PatternFlowIpv6FlowLabel_Choice struct { func (x *PatternFlowIpv6FlowLabel_Choice) Reset() { *x = PatternFlowIpv6FlowLabel_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1280] + mi := &file_otg_proto_msgTypes[1287] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116647,7 +117312,7 @@ func (x *PatternFlowIpv6FlowLabel_Choice) String() string { func (*PatternFlowIpv6FlowLabel_Choice) ProtoMessage() {} func (x *PatternFlowIpv6FlowLabel_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1280] + mi := &file_otg_proto_msgTypes[1287] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116660,7 +117325,7 @@ func (x *PatternFlowIpv6FlowLabel_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6FlowLabel_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6FlowLabel_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{599, 0} + return file_otg_proto_rawDescGZIP(), []int{602, 0} } type PatternFlowIpv6PayloadLength_Choice struct { @@ -116672,7 +117337,7 @@ type PatternFlowIpv6PayloadLength_Choice struct { func (x *PatternFlowIpv6PayloadLength_Choice) Reset() { *x = PatternFlowIpv6PayloadLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1281] + mi := &file_otg_proto_msgTypes[1288] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116685,7 +117350,7 @@ func (x *PatternFlowIpv6PayloadLength_Choice) String() string { func (*PatternFlowIpv6PayloadLength_Choice) ProtoMessage() {} func (x *PatternFlowIpv6PayloadLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1281] + mi := &file_otg_proto_msgTypes[1288] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116698,7 +117363,7 @@ func (x *PatternFlowIpv6PayloadLength_Choice) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowIpv6PayloadLength_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6PayloadLength_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{602, 0} + return file_otg_proto_rawDescGZIP(), []int{605, 0} } type PatternFlowIpv6NextHeader_Choice struct { @@ -116710,7 +117375,7 @@ type PatternFlowIpv6NextHeader_Choice struct { func (x *PatternFlowIpv6NextHeader_Choice) Reset() { *x = PatternFlowIpv6NextHeader_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1282] + mi := &file_otg_proto_msgTypes[1289] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116723,7 +117388,7 @@ func (x *PatternFlowIpv6NextHeader_Choice) String() string { func (*PatternFlowIpv6NextHeader_Choice) ProtoMessage() {} func (x *PatternFlowIpv6NextHeader_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1282] + mi := &file_otg_proto_msgTypes[1289] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116736,7 +117401,7 @@ func (x *PatternFlowIpv6NextHeader_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6NextHeader_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6NextHeader_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{605, 0} + return file_otg_proto_rawDescGZIP(), []int{608, 0} } type PatternFlowIpv6HopLimit_Choice struct { @@ -116748,7 +117413,7 @@ type PatternFlowIpv6HopLimit_Choice struct { func (x *PatternFlowIpv6HopLimit_Choice) Reset() { *x = PatternFlowIpv6HopLimit_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1283] + mi := &file_otg_proto_msgTypes[1290] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116761,7 +117426,7 @@ func (x *PatternFlowIpv6HopLimit_Choice) String() string { func (*PatternFlowIpv6HopLimit_Choice) ProtoMessage() {} func (x *PatternFlowIpv6HopLimit_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1283] + mi := &file_otg_proto_msgTypes[1290] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116774,7 +117439,7 @@ func (x *PatternFlowIpv6HopLimit_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6HopLimit_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6HopLimit_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{608, 0} + return file_otg_proto_rawDescGZIP(), []int{611, 0} } type PatternFlowIpv6Src_Choice struct { @@ -116786,7 +117451,7 @@ type PatternFlowIpv6Src_Choice struct { func (x *PatternFlowIpv6Src_Choice) Reset() { *x = PatternFlowIpv6Src_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1284] + mi := &file_otg_proto_msgTypes[1291] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116799,7 +117464,7 @@ func (x *PatternFlowIpv6Src_Choice) String() string { func (*PatternFlowIpv6Src_Choice) ProtoMessage() {} func (x *PatternFlowIpv6Src_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1284] + mi := &file_otg_proto_msgTypes[1291] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116812,7 +117477,7 @@ func (x *PatternFlowIpv6Src_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6Src_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6Src_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{611, 0} + return file_otg_proto_rawDescGZIP(), []int{614, 0} } type PatternFlowIpv6Dst_Choice struct { @@ -116824,7 +117489,7 @@ type PatternFlowIpv6Dst_Choice struct { func (x *PatternFlowIpv6Dst_Choice) Reset() { *x = PatternFlowIpv6Dst_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1285] + mi := &file_otg_proto_msgTypes[1292] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116837,7 +117502,7 @@ func (x *PatternFlowIpv6Dst_Choice) String() string { func (*PatternFlowIpv6Dst_Choice) ProtoMessage() {} func (x *PatternFlowIpv6Dst_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1285] + mi := &file_otg_proto_msgTypes[1292] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116850,7 +117515,7 @@ func (x *PatternFlowIpv6Dst_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIpv6Dst_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIpv6Dst_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{614, 0} + return file_otg_proto_rawDescGZIP(), []int{617, 0} } type PatternFlowPfcPauseDst_Choice struct { @@ -116862,7 +117527,7 @@ type PatternFlowPfcPauseDst_Choice struct { func (x *PatternFlowPfcPauseDst_Choice) Reset() { *x = PatternFlowPfcPauseDst_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1286] + mi := &file_otg_proto_msgTypes[1293] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116875,7 +117540,7 @@ func (x *PatternFlowPfcPauseDst_Choice) String() string { func (*PatternFlowPfcPauseDst_Choice) ProtoMessage() {} func (x *PatternFlowPfcPauseDst_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1286] + mi := &file_otg_proto_msgTypes[1293] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116888,7 +117553,7 @@ func (x *PatternFlowPfcPauseDst_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPauseDst_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseDst_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{617, 0} + return file_otg_proto_rawDescGZIP(), []int{620, 0} } type PatternFlowPfcPauseSrc_Choice struct { @@ -116900,7 +117565,7 @@ type PatternFlowPfcPauseSrc_Choice struct { func (x *PatternFlowPfcPauseSrc_Choice) Reset() { *x = PatternFlowPfcPauseSrc_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1287] + mi := &file_otg_proto_msgTypes[1294] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116913,7 +117578,7 @@ func (x *PatternFlowPfcPauseSrc_Choice) String() string { func (*PatternFlowPfcPauseSrc_Choice) ProtoMessage() {} func (x *PatternFlowPfcPauseSrc_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1287] + mi := &file_otg_proto_msgTypes[1294] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116926,7 +117591,7 @@ func (x *PatternFlowPfcPauseSrc_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPfcPauseSrc_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseSrc_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{620, 0} + return file_otg_proto_rawDescGZIP(), []int{623, 0} } type PatternFlowPfcPauseEtherType_Choice struct { @@ -116938,7 +117603,7 @@ type PatternFlowPfcPauseEtherType_Choice struct { func (x *PatternFlowPfcPauseEtherType_Choice) Reset() { *x = PatternFlowPfcPauseEtherType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1288] + mi := &file_otg_proto_msgTypes[1295] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116951,7 +117616,7 @@ func (x *PatternFlowPfcPauseEtherType_Choice) String() string { func (*PatternFlowPfcPauseEtherType_Choice) ProtoMessage() {} func (x *PatternFlowPfcPauseEtherType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1288] + mi := &file_otg_proto_msgTypes[1295] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -116964,7 +117629,7 @@ func (x *PatternFlowPfcPauseEtherType_Choice) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowPfcPauseEtherType_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseEtherType_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{623, 0} + return file_otg_proto_rawDescGZIP(), []int{626, 0} } type PatternFlowPfcPauseControlOpCode_Choice struct { @@ -116976,7 +117641,7 @@ type PatternFlowPfcPauseControlOpCode_Choice struct { func (x *PatternFlowPfcPauseControlOpCode_Choice) Reset() { *x = PatternFlowPfcPauseControlOpCode_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1289] + mi := &file_otg_proto_msgTypes[1296] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116989,7 +117654,7 @@ func (x *PatternFlowPfcPauseControlOpCode_Choice) String() string { func (*PatternFlowPfcPauseControlOpCode_Choice) ProtoMessage() {} func (x *PatternFlowPfcPauseControlOpCode_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1289] + mi := &file_otg_proto_msgTypes[1296] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117002,7 +117667,7 @@ func (x *PatternFlowPfcPauseControlOpCode_Choice) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowPfcPauseControlOpCode_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseControlOpCode_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{626, 0} + return file_otg_proto_rawDescGZIP(), []int{629, 0} } type PatternFlowPfcPauseClassEnableVector_Choice struct { @@ -117014,7 +117679,7 @@ type PatternFlowPfcPauseClassEnableVector_Choice struct { func (x *PatternFlowPfcPauseClassEnableVector_Choice) Reset() { *x = PatternFlowPfcPauseClassEnableVector_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1290] + mi := &file_otg_proto_msgTypes[1297] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117027,7 +117692,7 @@ func (x *PatternFlowPfcPauseClassEnableVector_Choice) String() string { func (*PatternFlowPfcPauseClassEnableVector_Choice) ProtoMessage() {} func (x *PatternFlowPfcPauseClassEnableVector_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1290] + mi := &file_otg_proto_msgTypes[1297] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117040,7 +117705,7 @@ func (x *PatternFlowPfcPauseClassEnableVector_Choice) ProtoReflect() protoreflec // Deprecated: Use PatternFlowPfcPauseClassEnableVector_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPauseClassEnableVector_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{629, 0} + return file_otg_proto_rawDescGZIP(), []int{632, 0} } type PatternFlowPfcPausePauseClass0_Choice struct { @@ -117052,7 +117717,7 @@ type PatternFlowPfcPausePauseClass0_Choice struct { func (x *PatternFlowPfcPausePauseClass0_Choice) Reset() { *x = PatternFlowPfcPausePauseClass0_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1291] + mi := &file_otg_proto_msgTypes[1298] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117065,7 +117730,7 @@ func (x *PatternFlowPfcPausePauseClass0_Choice) String() string { func (*PatternFlowPfcPausePauseClass0_Choice) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass0_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1291] + mi := &file_otg_proto_msgTypes[1298] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117078,7 +117743,7 @@ func (x *PatternFlowPfcPausePauseClass0_Choice) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass0_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass0_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{632, 0} + return file_otg_proto_rawDescGZIP(), []int{635, 0} } type PatternFlowPfcPausePauseClass1_Choice struct { @@ -117090,7 +117755,7 @@ type PatternFlowPfcPausePauseClass1_Choice struct { func (x *PatternFlowPfcPausePauseClass1_Choice) Reset() { *x = PatternFlowPfcPausePauseClass1_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1292] + mi := &file_otg_proto_msgTypes[1299] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117103,7 +117768,7 @@ func (x *PatternFlowPfcPausePauseClass1_Choice) String() string { func (*PatternFlowPfcPausePauseClass1_Choice) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass1_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1292] + mi := &file_otg_proto_msgTypes[1299] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117116,7 +117781,7 @@ func (x *PatternFlowPfcPausePauseClass1_Choice) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass1_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass1_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{635, 0} + return file_otg_proto_rawDescGZIP(), []int{638, 0} } type PatternFlowPfcPausePauseClass2_Choice struct { @@ -117128,7 +117793,7 @@ type PatternFlowPfcPausePauseClass2_Choice struct { func (x *PatternFlowPfcPausePauseClass2_Choice) Reset() { *x = PatternFlowPfcPausePauseClass2_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1293] + mi := &file_otg_proto_msgTypes[1300] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117141,7 +117806,7 @@ func (x *PatternFlowPfcPausePauseClass2_Choice) String() string { func (*PatternFlowPfcPausePauseClass2_Choice) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass2_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1293] + mi := &file_otg_proto_msgTypes[1300] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117154,7 +117819,7 @@ func (x *PatternFlowPfcPausePauseClass2_Choice) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass2_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass2_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{638, 0} + return file_otg_proto_rawDescGZIP(), []int{641, 0} } type PatternFlowPfcPausePauseClass3_Choice struct { @@ -117166,7 +117831,7 @@ type PatternFlowPfcPausePauseClass3_Choice struct { func (x *PatternFlowPfcPausePauseClass3_Choice) Reset() { *x = PatternFlowPfcPausePauseClass3_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1294] + mi := &file_otg_proto_msgTypes[1301] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117179,7 +117844,7 @@ func (x *PatternFlowPfcPausePauseClass3_Choice) String() string { func (*PatternFlowPfcPausePauseClass3_Choice) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass3_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1294] + mi := &file_otg_proto_msgTypes[1301] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117192,7 +117857,7 @@ func (x *PatternFlowPfcPausePauseClass3_Choice) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass3_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass3_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{641, 0} + return file_otg_proto_rawDescGZIP(), []int{644, 0} } type PatternFlowPfcPausePauseClass4_Choice struct { @@ -117204,7 +117869,7 @@ type PatternFlowPfcPausePauseClass4_Choice struct { func (x *PatternFlowPfcPausePauseClass4_Choice) Reset() { *x = PatternFlowPfcPausePauseClass4_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1295] + mi := &file_otg_proto_msgTypes[1302] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117217,7 +117882,7 @@ func (x *PatternFlowPfcPausePauseClass4_Choice) String() string { func (*PatternFlowPfcPausePauseClass4_Choice) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass4_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1295] + mi := &file_otg_proto_msgTypes[1302] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117230,7 +117895,7 @@ func (x *PatternFlowPfcPausePauseClass4_Choice) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass4_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass4_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{644, 0} + return file_otg_proto_rawDescGZIP(), []int{647, 0} } type PatternFlowPfcPausePauseClass5_Choice struct { @@ -117242,7 +117907,7 @@ type PatternFlowPfcPausePauseClass5_Choice struct { func (x *PatternFlowPfcPausePauseClass5_Choice) Reset() { *x = PatternFlowPfcPausePauseClass5_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1296] + mi := &file_otg_proto_msgTypes[1303] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117255,7 +117920,7 @@ func (x *PatternFlowPfcPausePauseClass5_Choice) String() string { func (*PatternFlowPfcPausePauseClass5_Choice) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass5_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1296] + mi := &file_otg_proto_msgTypes[1303] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117268,7 +117933,7 @@ func (x *PatternFlowPfcPausePauseClass5_Choice) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass5_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass5_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{647, 0} + return file_otg_proto_rawDescGZIP(), []int{650, 0} } type PatternFlowPfcPausePauseClass6_Choice struct { @@ -117280,7 +117945,7 @@ type PatternFlowPfcPausePauseClass6_Choice struct { func (x *PatternFlowPfcPausePauseClass6_Choice) Reset() { *x = PatternFlowPfcPausePauseClass6_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1297] + mi := &file_otg_proto_msgTypes[1304] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117293,7 +117958,7 @@ func (x *PatternFlowPfcPausePauseClass6_Choice) String() string { func (*PatternFlowPfcPausePauseClass6_Choice) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass6_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1297] + mi := &file_otg_proto_msgTypes[1304] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117306,7 +117971,7 @@ func (x *PatternFlowPfcPausePauseClass6_Choice) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass6_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass6_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{650, 0} + return file_otg_proto_rawDescGZIP(), []int{653, 0} } type PatternFlowPfcPausePauseClass7_Choice struct { @@ -117318,7 +117983,7 @@ type PatternFlowPfcPausePauseClass7_Choice struct { func (x *PatternFlowPfcPausePauseClass7_Choice) Reset() { *x = PatternFlowPfcPausePauseClass7_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1298] + mi := &file_otg_proto_msgTypes[1305] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117331,7 +117996,7 @@ func (x *PatternFlowPfcPausePauseClass7_Choice) String() string { func (*PatternFlowPfcPausePauseClass7_Choice) ProtoMessage() {} func (x *PatternFlowPfcPausePauseClass7_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1298] + mi := &file_otg_proto_msgTypes[1305] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117344,7 +118009,7 @@ func (x *PatternFlowPfcPausePauseClass7_Choice) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowPfcPausePauseClass7_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPfcPausePauseClass7_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{653, 0} + return file_otg_proto_rawDescGZIP(), []int{656, 0} } type PatternFlowEthernetPauseDst_Choice struct { @@ -117356,7 +118021,7 @@ type PatternFlowEthernetPauseDst_Choice struct { func (x *PatternFlowEthernetPauseDst_Choice) Reset() { *x = PatternFlowEthernetPauseDst_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1299] + mi := &file_otg_proto_msgTypes[1306] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117369,7 +118034,7 @@ func (x *PatternFlowEthernetPauseDst_Choice) String() string { func (*PatternFlowEthernetPauseDst_Choice) ProtoMessage() {} func (x *PatternFlowEthernetPauseDst_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1299] + mi := &file_otg_proto_msgTypes[1306] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117382,7 +118047,7 @@ func (x *PatternFlowEthernetPauseDst_Choice) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowEthernetPauseDst_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseDst_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{656, 0} + return file_otg_proto_rawDescGZIP(), []int{659, 0} } type PatternFlowEthernetPauseSrc_Choice struct { @@ -117394,7 +118059,7 @@ type PatternFlowEthernetPauseSrc_Choice struct { func (x *PatternFlowEthernetPauseSrc_Choice) Reset() { *x = PatternFlowEthernetPauseSrc_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1300] + mi := &file_otg_proto_msgTypes[1307] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117407,7 +118072,7 @@ func (x *PatternFlowEthernetPauseSrc_Choice) String() string { func (*PatternFlowEthernetPauseSrc_Choice) ProtoMessage() {} func (x *PatternFlowEthernetPauseSrc_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1300] + mi := &file_otg_proto_msgTypes[1307] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117420,7 +118085,7 @@ func (x *PatternFlowEthernetPauseSrc_Choice) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowEthernetPauseSrc_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseSrc_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{659, 0} + return file_otg_proto_rawDescGZIP(), []int{662, 0} } type PatternFlowEthernetPauseEtherType_Choice struct { @@ -117432,7 +118097,7 @@ type PatternFlowEthernetPauseEtherType_Choice struct { func (x *PatternFlowEthernetPauseEtherType_Choice) Reset() { *x = PatternFlowEthernetPauseEtherType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1301] + mi := &file_otg_proto_msgTypes[1308] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117445,7 +118110,7 @@ func (x *PatternFlowEthernetPauseEtherType_Choice) String() string { func (*PatternFlowEthernetPauseEtherType_Choice) ProtoMessage() {} func (x *PatternFlowEthernetPauseEtherType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1301] + mi := &file_otg_proto_msgTypes[1308] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117458,7 +118123,7 @@ func (x *PatternFlowEthernetPauseEtherType_Choice) ProtoReflect() protoreflect.M // Deprecated: Use PatternFlowEthernetPauseEtherType_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseEtherType_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{662, 0} + return file_otg_proto_rawDescGZIP(), []int{665, 0} } type PatternFlowEthernetPauseControlOpCode_Choice struct { @@ -117470,7 +118135,7 @@ type PatternFlowEthernetPauseControlOpCode_Choice struct { func (x *PatternFlowEthernetPauseControlOpCode_Choice) Reset() { *x = PatternFlowEthernetPauseControlOpCode_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1302] + mi := &file_otg_proto_msgTypes[1309] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117483,7 +118148,7 @@ func (x *PatternFlowEthernetPauseControlOpCode_Choice) String() string { func (*PatternFlowEthernetPauseControlOpCode_Choice) ProtoMessage() {} func (x *PatternFlowEthernetPauseControlOpCode_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1302] + mi := &file_otg_proto_msgTypes[1309] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117496,7 +118161,7 @@ func (x *PatternFlowEthernetPauseControlOpCode_Choice) ProtoReflect() protorefle // Deprecated: Use PatternFlowEthernetPauseControlOpCode_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseControlOpCode_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{665, 0} + return file_otg_proto_rawDescGZIP(), []int{668, 0} } type PatternFlowEthernetPauseTime_Choice struct { @@ -117508,7 +118173,7 @@ type PatternFlowEthernetPauseTime_Choice struct { func (x *PatternFlowEthernetPauseTime_Choice) Reset() { *x = PatternFlowEthernetPauseTime_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1303] + mi := &file_otg_proto_msgTypes[1310] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117521,7 +118186,7 @@ func (x *PatternFlowEthernetPauseTime_Choice) String() string { func (*PatternFlowEthernetPauseTime_Choice) ProtoMessage() {} func (x *PatternFlowEthernetPauseTime_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1303] + mi := &file_otg_proto_msgTypes[1310] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117534,7 +118199,7 @@ func (x *PatternFlowEthernetPauseTime_Choice) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowEthernetPauseTime_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowEthernetPauseTime_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{668, 0} + return file_otg_proto_rawDescGZIP(), []int{671, 0} } type PatternFlowTcpSrcPort_Choice struct { @@ -117546,7 +118211,7 @@ type PatternFlowTcpSrcPort_Choice struct { func (x *PatternFlowTcpSrcPort_Choice) Reset() { *x = PatternFlowTcpSrcPort_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1304] + mi := &file_otg_proto_msgTypes[1311] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117559,7 +118224,7 @@ func (x *PatternFlowTcpSrcPort_Choice) String() string { func (*PatternFlowTcpSrcPort_Choice) ProtoMessage() {} func (x *PatternFlowTcpSrcPort_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1304] + mi := &file_otg_proto_msgTypes[1311] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117572,7 +118237,7 @@ func (x *PatternFlowTcpSrcPort_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpSrcPort_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpSrcPort_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{671, 0} + return file_otg_proto_rawDescGZIP(), []int{675, 0} } type PatternFlowTcpDstPort_Choice struct { @@ -117584,7 +118249,7 @@ type PatternFlowTcpDstPort_Choice struct { func (x *PatternFlowTcpDstPort_Choice) Reset() { *x = PatternFlowTcpDstPort_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1305] + mi := &file_otg_proto_msgTypes[1312] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117597,7 +118262,7 @@ func (x *PatternFlowTcpDstPort_Choice) String() string { func (*PatternFlowTcpDstPort_Choice) ProtoMessage() {} func (x *PatternFlowTcpDstPort_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1305] + mi := &file_otg_proto_msgTypes[1312] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117610,7 +118275,7 @@ func (x *PatternFlowTcpDstPort_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpDstPort_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpDstPort_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{674, 0} + return file_otg_proto_rawDescGZIP(), []int{679, 0} } type PatternFlowTcpSeqNum_Choice struct { @@ -117622,7 +118287,7 @@ type PatternFlowTcpSeqNum_Choice struct { func (x *PatternFlowTcpSeqNum_Choice) Reset() { *x = PatternFlowTcpSeqNum_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1306] + mi := &file_otg_proto_msgTypes[1313] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117635,7 +118300,7 @@ func (x *PatternFlowTcpSeqNum_Choice) String() string { func (*PatternFlowTcpSeqNum_Choice) ProtoMessage() {} func (x *PatternFlowTcpSeqNum_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1306] + mi := &file_otg_proto_msgTypes[1313] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117648,7 +118313,7 @@ func (x *PatternFlowTcpSeqNum_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpSeqNum_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpSeqNum_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{677, 0} + return file_otg_proto_rawDescGZIP(), []int{682, 0} } type PatternFlowTcpAckNum_Choice struct { @@ -117660,7 +118325,7 @@ type PatternFlowTcpAckNum_Choice struct { func (x *PatternFlowTcpAckNum_Choice) Reset() { *x = PatternFlowTcpAckNum_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1307] + mi := &file_otg_proto_msgTypes[1314] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117673,7 +118338,7 @@ func (x *PatternFlowTcpAckNum_Choice) String() string { func (*PatternFlowTcpAckNum_Choice) ProtoMessage() {} func (x *PatternFlowTcpAckNum_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1307] + mi := &file_otg_proto_msgTypes[1314] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117686,7 +118351,7 @@ func (x *PatternFlowTcpAckNum_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpAckNum_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpAckNum_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{680, 0} + return file_otg_proto_rawDescGZIP(), []int{685, 0} } type PatternFlowTcpDataOffset_Choice struct { @@ -117698,7 +118363,7 @@ type PatternFlowTcpDataOffset_Choice struct { func (x *PatternFlowTcpDataOffset_Choice) Reset() { *x = PatternFlowTcpDataOffset_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1308] + mi := &file_otg_proto_msgTypes[1315] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117711,7 +118376,7 @@ func (x *PatternFlowTcpDataOffset_Choice) String() string { func (*PatternFlowTcpDataOffset_Choice) ProtoMessage() {} func (x *PatternFlowTcpDataOffset_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1308] + mi := &file_otg_proto_msgTypes[1315] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117724,7 +118389,7 @@ func (x *PatternFlowTcpDataOffset_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpDataOffset_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpDataOffset_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{683, 0} + return file_otg_proto_rawDescGZIP(), []int{688, 0} } type PatternFlowTcpEcnNs_Choice struct { @@ -117736,7 +118401,7 @@ type PatternFlowTcpEcnNs_Choice struct { func (x *PatternFlowTcpEcnNs_Choice) Reset() { *x = PatternFlowTcpEcnNs_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1309] + mi := &file_otg_proto_msgTypes[1316] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117749,7 +118414,7 @@ func (x *PatternFlowTcpEcnNs_Choice) String() string { func (*PatternFlowTcpEcnNs_Choice) ProtoMessage() {} func (x *PatternFlowTcpEcnNs_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1309] + mi := &file_otg_proto_msgTypes[1316] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117762,7 +118427,7 @@ func (x *PatternFlowTcpEcnNs_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpEcnNs_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpEcnNs_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{686, 0} + return file_otg_proto_rawDescGZIP(), []int{691, 0} } type PatternFlowTcpEcnCwr_Choice struct { @@ -117774,7 +118439,7 @@ type PatternFlowTcpEcnCwr_Choice struct { func (x *PatternFlowTcpEcnCwr_Choice) Reset() { *x = PatternFlowTcpEcnCwr_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1310] + mi := &file_otg_proto_msgTypes[1317] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117787,7 +118452,7 @@ func (x *PatternFlowTcpEcnCwr_Choice) String() string { func (*PatternFlowTcpEcnCwr_Choice) ProtoMessage() {} func (x *PatternFlowTcpEcnCwr_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1310] + mi := &file_otg_proto_msgTypes[1317] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117800,7 +118465,7 @@ func (x *PatternFlowTcpEcnCwr_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpEcnCwr_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpEcnCwr_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{689, 0} + return file_otg_proto_rawDescGZIP(), []int{694, 0} } type PatternFlowTcpEcnEcho_Choice struct { @@ -117812,7 +118477,7 @@ type PatternFlowTcpEcnEcho_Choice struct { func (x *PatternFlowTcpEcnEcho_Choice) Reset() { *x = PatternFlowTcpEcnEcho_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1311] + mi := &file_otg_proto_msgTypes[1318] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117825,7 +118490,7 @@ func (x *PatternFlowTcpEcnEcho_Choice) String() string { func (*PatternFlowTcpEcnEcho_Choice) ProtoMessage() {} func (x *PatternFlowTcpEcnEcho_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1311] + mi := &file_otg_proto_msgTypes[1318] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117838,7 +118503,7 @@ func (x *PatternFlowTcpEcnEcho_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpEcnEcho_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpEcnEcho_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{692, 0} + return file_otg_proto_rawDescGZIP(), []int{697, 0} } type PatternFlowTcpCtlUrg_Choice struct { @@ -117850,7 +118515,7 @@ type PatternFlowTcpCtlUrg_Choice struct { func (x *PatternFlowTcpCtlUrg_Choice) Reset() { *x = PatternFlowTcpCtlUrg_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1312] + mi := &file_otg_proto_msgTypes[1319] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117863,7 +118528,7 @@ func (x *PatternFlowTcpCtlUrg_Choice) String() string { func (*PatternFlowTcpCtlUrg_Choice) ProtoMessage() {} func (x *PatternFlowTcpCtlUrg_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1312] + mi := &file_otg_proto_msgTypes[1319] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117876,7 +118541,7 @@ func (x *PatternFlowTcpCtlUrg_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlUrg_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlUrg_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{695, 0} + return file_otg_proto_rawDescGZIP(), []int{700, 0} } type PatternFlowTcpCtlAck_Choice struct { @@ -117888,7 +118553,7 @@ type PatternFlowTcpCtlAck_Choice struct { func (x *PatternFlowTcpCtlAck_Choice) Reset() { *x = PatternFlowTcpCtlAck_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1313] + mi := &file_otg_proto_msgTypes[1320] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117901,7 +118566,7 @@ func (x *PatternFlowTcpCtlAck_Choice) String() string { func (*PatternFlowTcpCtlAck_Choice) ProtoMessage() {} func (x *PatternFlowTcpCtlAck_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1313] + mi := &file_otg_proto_msgTypes[1320] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117914,7 +118579,7 @@ func (x *PatternFlowTcpCtlAck_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlAck_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlAck_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{698, 0} + return file_otg_proto_rawDescGZIP(), []int{703, 0} } type PatternFlowTcpCtlPsh_Choice struct { @@ -117926,7 +118591,7 @@ type PatternFlowTcpCtlPsh_Choice struct { func (x *PatternFlowTcpCtlPsh_Choice) Reset() { *x = PatternFlowTcpCtlPsh_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1314] + mi := &file_otg_proto_msgTypes[1321] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117939,7 +118604,7 @@ func (x *PatternFlowTcpCtlPsh_Choice) String() string { func (*PatternFlowTcpCtlPsh_Choice) ProtoMessage() {} func (x *PatternFlowTcpCtlPsh_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1314] + mi := &file_otg_proto_msgTypes[1321] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117952,7 +118617,7 @@ func (x *PatternFlowTcpCtlPsh_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlPsh_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlPsh_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{701, 0} + return file_otg_proto_rawDescGZIP(), []int{706, 0} } type PatternFlowTcpCtlRst_Choice struct { @@ -117964,7 +118629,7 @@ type PatternFlowTcpCtlRst_Choice struct { func (x *PatternFlowTcpCtlRst_Choice) Reset() { *x = PatternFlowTcpCtlRst_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1315] + mi := &file_otg_proto_msgTypes[1322] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117977,7 +118642,7 @@ func (x *PatternFlowTcpCtlRst_Choice) String() string { func (*PatternFlowTcpCtlRst_Choice) ProtoMessage() {} func (x *PatternFlowTcpCtlRst_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1315] + mi := &file_otg_proto_msgTypes[1322] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -117990,7 +118655,7 @@ func (x *PatternFlowTcpCtlRst_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlRst_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlRst_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{704, 0} + return file_otg_proto_rawDescGZIP(), []int{709, 0} } type PatternFlowTcpCtlSyn_Choice struct { @@ -118002,7 +118667,7 @@ type PatternFlowTcpCtlSyn_Choice struct { func (x *PatternFlowTcpCtlSyn_Choice) Reset() { *x = PatternFlowTcpCtlSyn_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1316] + mi := &file_otg_proto_msgTypes[1323] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118015,7 +118680,7 @@ func (x *PatternFlowTcpCtlSyn_Choice) String() string { func (*PatternFlowTcpCtlSyn_Choice) ProtoMessage() {} func (x *PatternFlowTcpCtlSyn_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1316] + mi := &file_otg_proto_msgTypes[1323] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118028,7 +118693,7 @@ func (x *PatternFlowTcpCtlSyn_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlSyn_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlSyn_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{707, 0} + return file_otg_proto_rawDescGZIP(), []int{712, 0} } type PatternFlowTcpCtlFin_Choice struct { @@ -118040,7 +118705,7 @@ type PatternFlowTcpCtlFin_Choice struct { func (x *PatternFlowTcpCtlFin_Choice) Reset() { *x = PatternFlowTcpCtlFin_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1317] + mi := &file_otg_proto_msgTypes[1324] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118053,7 +118718,7 @@ func (x *PatternFlowTcpCtlFin_Choice) String() string { func (*PatternFlowTcpCtlFin_Choice) ProtoMessage() {} func (x *PatternFlowTcpCtlFin_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1317] + mi := &file_otg_proto_msgTypes[1324] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118066,7 +118731,7 @@ func (x *PatternFlowTcpCtlFin_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpCtlFin_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpCtlFin_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{710, 0} + return file_otg_proto_rawDescGZIP(), []int{715, 0} } type PatternFlowTcpWindow_Choice struct { @@ -118078,7 +118743,7 @@ type PatternFlowTcpWindow_Choice struct { func (x *PatternFlowTcpWindow_Choice) Reset() { *x = PatternFlowTcpWindow_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1318] + mi := &file_otg_proto_msgTypes[1325] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118091,7 +118756,7 @@ func (x *PatternFlowTcpWindow_Choice) String() string { func (*PatternFlowTcpWindow_Choice) ProtoMessage() {} func (x *PatternFlowTcpWindow_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1318] + mi := &file_otg_proto_msgTypes[1325] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118104,7 +118769,7 @@ func (x *PatternFlowTcpWindow_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpWindow_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpWindow_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{713, 0} + return file_otg_proto_rawDescGZIP(), []int{718, 0} } type PatternFlowTcpChecksum_Choice struct { @@ -118116,7 +118781,7 @@ type PatternFlowTcpChecksum_Choice struct { func (x *PatternFlowTcpChecksum_Choice) Reset() { *x = PatternFlowTcpChecksum_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1319] + mi := &file_otg_proto_msgTypes[1326] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118129,7 +118794,7 @@ func (x *PatternFlowTcpChecksum_Choice) String() string { func (*PatternFlowTcpChecksum_Choice) ProtoMessage() {} func (x *PatternFlowTcpChecksum_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1319] + mi := &file_otg_proto_msgTypes[1326] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118142,7 +118807,7 @@ func (x *PatternFlowTcpChecksum_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpChecksum_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowTcpChecksum_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{714, 0} + return file_otg_proto_rawDescGZIP(), []int{719, 0} } type PatternFlowTcpChecksum_Generated struct { @@ -118154,7 +118819,7 @@ type PatternFlowTcpChecksum_Generated struct { func (x *PatternFlowTcpChecksum_Generated) Reset() { *x = PatternFlowTcpChecksum_Generated{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1320] + mi := &file_otg_proto_msgTypes[1327] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118167,7 +118832,7 @@ func (x *PatternFlowTcpChecksum_Generated) String() string { func (*PatternFlowTcpChecksum_Generated) ProtoMessage() {} func (x *PatternFlowTcpChecksum_Generated) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1320] + mi := &file_otg_proto_msgTypes[1327] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118180,7 +118845,7 @@ func (x *PatternFlowTcpChecksum_Generated) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowTcpChecksum_Generated.ProtoReflect.Descriptor instead. func (*PatternFlowTcpChecksum_Generated) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{714, 1} + return file_otg_proto_rawDescGZIP(), []int{719, 1} } type PatternFlowUdpSrcPort_Choice struct { @@ -118192,7 +118857,7 @@ type PatternFlowUdpSrcPort_Choice struct { func (x *PatternFlowUdpSrcPort_Choice) Reset() { *x = PatternFlowUdpSrcPort_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1321] + mi := &file_otg_proto_msgTypes[1328] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118205,7 +118870,7 @@ func (x *PatternFlowUdpSrcPort_Choice) String() string { func (*PatternFlowUdpSrcPort_Choice) ProtoMessage() {} func (x *PatternFlowUdpSrcPort_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1321] + mi := &file_otg_proto_msgTypes[1328] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118218,7 +118883,7 @@ func (x *PatternFlowUdpSrcPort_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpSrcPort_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowUdpSrcPort_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{717, 0} + return file_otg_proto_rawDescGZIP(), []int{723, 0} } type PatternFlowUdpDstPort_Choice struct { @@ -118230,7 +118895,7 @@ type PatternFlowUdpDstPort_Choice struct { func (x *PatternFlowUdpDstPort_Choice) Reset() { *x = PatternFlowUdpDstPort_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1322] + mi := &file_otg_proto_msgTypes[1329] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118243,7 +118908,7 @@ func (x *PatternFlowUdpDstPort_Choice) String() string { func (*PatternFlowUdpDstPort_Choice) ProtoMessage() {} func (x *PatternFlowUdpDstPort_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1322] + mi := &file_otg_proto_msgTypes[1329] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118256,7 +118921,7 @@ func (x *PatternFlowUdpDstPort_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpDstPort_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowUdpDstPort_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{720, 0} + return file_otg_proto_rawDescGZIP(), []int{727, 0} } type PatternFlowUdpLength_Choice struct { @@ -118268,7 +118933,7 @@ type PatternFlowUdpLength_Choice struct { func (x *PatternFlowUdpLength_Choice) Reset() { *x = PatternFlowUdpLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1323] + mi := &file_otg_proto_msgTypes[1330] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118281,7 +118946,7 @@ func (x *PatternFlowUdpLength_Choice) String() string { func (*PatternFlowUdpLength_Choice) ProtoMessage() {} func (x *PatternFlowUdpLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1323] + mi := &file_otg_proto_msgTypes[1330] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118294,7 +118959,7 @@ func (x *PatternFlowUdpLength_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpLength_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowUdpLength_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{723, 0} + return file_otg_proto_rawDescGZIP(), []int{730, 0} } type PatternFlowUdpChecksum_Choice struct { @@ -118306,7 +118971,7 @@ type PatternFlowUdpChecksum_Choice struct { func (x *PatternFlowUdpChecksum_Choice) Reset() { *x = PatternFlowUdpChecksum_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1324] + mi := &file_otg_proto_msgTypes[1331] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118319,7 +118984,7 @@ func (x *PatternFlowUdpChecksum_Choice) String() string { func (*PatternFlowUdpChecksum_Choice) ProtoMessage() {} func (x *PatternFlowUdpChecksum_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1324] + mi := &file_otg_proto_msgTypes[1331] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118332,7 +118997,7 @@ func (x *PatternFlowUdpChecksum_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpChecksum_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowUdpChecksum_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{724, 0} + return file_otg_proto_rawDescGZIP(), []int{731, 0} } type PatternFlowUdpChecksum_Generated struct { @@ -118344,7 +119009,7 @@ type PatternFlowUdpChecksum_Generated struct { func (x *PatternFlowUdpChecksum_Generated) Reset() { *x = PatternFlowUdpChecksum_Generated{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1325] + mi := &file_otg_proto_msgTypes[1332] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118357,7 +119022,7 @@ func (x *PatternFlowUdpChecksum_Generated) String() string { func (*PatternFlowUdpChecksum_Generated) ProtoMessage() {} func (x *PatternFlowUdpChecksum_Generated) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1325] + mi := &file_otg_proto_msgTypes[1332] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118370,7 +119035,7 @@ func (x *PatternFlowUdpChecksum_Generated) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowUdpChecksum_Generated.ProtoReflect.Descriptor instead. func (*PatternFlowUdpChecksum_Generated) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{724, 1} + return file_otg_proto_rawDescGZIP(), []int{731, 1} } type PatternFlowGreChecksumPresent_Choice struct { @@ -118382,7 +119047,7 @@ type PatternFlowGreChecksumPresent_Choice struct { func (x *PatternFlowGreChecksumPresent_Choice) Reset() { *x = PatternFlowGreChecksumPresent_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1326] + mi := &file_otg_proto_msgTypes[1333] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118395,7 +119060,7 @@ func (x *PatternFlowGreChecksumPresent_Choice) String() string { func (*PatternFlowGreChecksumPresent_Choice) ProtoMessage() {} func (x *PatternFlowGreChecksumPresent_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1326] + mi := &file_otg_proto_msgTypes[1333] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118408,7 +119073,7 @@ func (x *PatternFlowGreChecksumPresent_Choice) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowGreChecksumPresent_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGreChecksumPresent_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{727, 0} + return file_otg_proto_rawDescGZIP(), []int{734, 0} } type PatternFlowGreReserved0_Choice struct { @@ -118420,7 +119085,7 @@ type PatternFlowGreReserved0_Choice struct { func (x *PatternFlowGreReserved0_Choice) Reset() { *x = PatternFlowGreReserved0_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1327] + mi := &file_otg_proto_msgTypes[1334] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118433,7 +119098,7 @@ func (x *PatternFlowGreReserved0_Choice) String() string { func (*PatternFlowGreReserved0_Choice) ProtoMessage() {} func (x *PatternFlowGreReserved0_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1327] + mi := &file_otg_proto_msgTypes[1334] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118446,7 +119111,7 @@ func (x *PatternFlowGreReserved0_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreReserved0_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGreReserved0_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{730, 0} + return file_otg_proto_rawDescGZIP(), []int{737, 0} } type PatternFlowGreVersion_Choice struct { @@ -118458,7 +119123,7 @@ type PatternFlowGreVersion_Choice struct { func (x *PatternFlowGreVersion_Choice) Reset() { *x = PatternFlowGreVersion_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1328] + mi := &file_otg_proto_msgTypes[1335] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118471,7 +119136,7 @@ func (x *PatternFlowGreVersion_Choice) String() string { func (*PatternFlowGreVersion_Choice) ProtoMessage() {} func (x *PatternFlowGreVersion_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1328] + mi := &file_otg_proto_msgTypes[1335] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118484,7 +119149,7 @@ func (x *PatternFlowGreVersion_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreVersion_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGreVersion_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{733, 0} + return file_otg_proto_rawDescGZIP(), []int{740, 0} } type PatternFlowGreProtocol_Choice struct { @@ -118496,7 +119161,7 @@ type PatternFlowGreProtocol_Choice struct { func (x *PatternFlowGreProtocol_Choice) Reset() { *x = PatternFlowGreProtocol_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1329] + mi := &file_otg_proto_msgTypes[1336] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118509,7 +119174,7 @@ func (x *PatternFlowGreProtocol_Choice) String() string { func (*PatternFlowGreProtocol_Choice) ProtoMessage() {} func (x *PatternFlowGreProtocol_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1329] + mi := &file_otg_proto_msgTypes[1336] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118522,7 +119187,7 @@ func (x *PatternFlowGreProtocol_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreProtocol_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGreProtocol_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{736, 0} + return file_otg_proto_rawDescGZIP(), []int{743, 0} } type PatternFlowGreChecksum_Choice struct { @@ -118534,7 +119199,7 @@ type PatternFlowGreChecksum_Choice struct { func (x *PatternFlowGreChecksum_Choice) Reset() { *x = PatternFlowGreChecksum_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1330] + mi := &file_otg_proto_msgTypes[1337] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118547,7 +119212,7 @@ func (x *PatternFlowGreChecksum_Choice) String() string { func (*PatternFlowGreChecksum_Choice) ProtoMessage() {} func (x *PatternFlowGreChecksum_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1330] + mi := &file_otg_proto_msgTypes[1337] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118560,7 +119225,7 @@ func (x *PatternFlowGreChecksum_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreChecksum_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGreChecksum_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{737, 0} + return file_otg_proto_rawDescGZIP(), []int{744, 0} } type PatternFlowGreChecksum_Generated struct { @@ -118572,7 +119237,7 @@ type PatternFlowGreChecksum_Generated struct { func (x *PatternFlowGreChecksum_Generated) Reset() { *x = PatternFlowGreChecksum_Generated{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1331] + mi := &file_otg_proto_msgTypes[1338] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118585,7 +119250,7 @@ func (x *PatternFlowGreChecksum_Generated) String() string { func (*PatternFlowGreChecksum_Generated) ProtoMessage() {} func (x *PatternFlowGreChecksum_Generated) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1331] + mi := &file_otg_proto_msgTypes[1338] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118598,7 +119263,7 @@ func (x *PatternFlowGreChecksum_Generated) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreChecksum_Generated.ProtoReflect.Descriptor instead. func (*PatternFlowGreChecksum_Generated) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{737, 1} + return file_otg_proto_rawDescGZIP(), []int{744, 1} } type PatternFlowGreReserved1_Choice struct { @@ -118610,7 +119275,7 @@ type PatternFlowGreReserved1_Choice struct { func (x *PatternFlowGreReserved1_Choice) Reset() { *x = PatternFlowGreReserved1_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1332] + mi := &file_otg_proto_msgTypes[1339] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118623,7 +119288,7 @@ func (x *PatternFlowGreReserved1_Choice) String() string { func (*PatternFlowGreReserved1_Choice) ProtoMessage() {} func (x *PatternFlowGreReserved1_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1332] + mi := &file_otg_proto_msgTypes[1339] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118636,7 +119301,7 @@ func (x *PatternFlowGreReserved1_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGreReserved1_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGreReserved1_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{740, 0} + return file_otg_proto_rawDescGZIP(), []int{747, 0} } type PatternFlowGtpv1Version_Choice struct { @@ -118648,7 +119313,7 @@ type PatternFlowGtpv1Version_Choice struct { func (x *PatternFlowGtpv1Version_Choice) Reset() { *x = PatternFlowGtpv1Version_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1333] + mi := &file_otg_proto_msgTypes[1340] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118661,7 +119326,7 @@ func (x *PatternFlowGtpv1Version_Choice) String() string { func (*PatternFlowGtpv1Version_Choice) ProtoMessage() {} func (x *PatternFlowGtpv1Version_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1333] + mi := &file_otg_proto_msgTypes[1340] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118674,7 +119339,7 @@ func (x *PatternFlowGtpv1Version_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1Version_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1Version_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{743, 0} + return file_otg_proto_rawDescGZIP(), []int{750, 0} } type PatternFlowGtpv1ProtocolType_Choice struct { @@ -118686,7 +119351,7 @@ type PatternFlowGtpv1ProtocolType_Choice struct { func (x *PatternFlowGtpv1ProtocolType_Choice) Reset() { *x = PatternFlowGtpv1ProtocolType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1334] + mi := &file_otg_proto_msgTypes[1341] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118699,7 +119364,7 @@ func (x *PatternFlowGtpv1ProtocolType_Choice) String() string { func (*PatternFlowGtpv1ProtocolType_Choice) ProtoMessage() {} func (x *PatternFlowGtpv1ProtocolType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1334] + mi := &file_otg_proto_msgTypes[1341] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118712,7 +119377,7 @@ func (x *PatternFlowGtpv1ProtocolType_Choice) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowGtpv1ProtocolType_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1ProtocolType_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{746, 0} + return file_otg_proto_rawDescGZIP(), []int{753, 0} } type PatternFlowGtpv1Reserved_Choice struct { @@ -118724,7 +119389,7 @@ type PatternFlowGtpv1Reserved_Choice struct { func (x *PatternFlowGtpv1Reserved_Choice) Reset() { *x = PatternFlowGtpv1Reserved_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1335] + mi := &file_otg_proto_msgTypes[1342] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118737,7 +119402,7 @@ func (x *PatternFlowGtpv1Reserved_Choice) String() string { func (*PatternFlowGtpv1Reserved_Choice) ProtoMessage() {} func (x *PatternFlowGtpv1Reserved_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1335] + mi := &file_otg_proto_msgTypes[1342] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118750,7 +119415,7 @@ func (x *PatternFlowGtpv1Reserved_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1Reserved_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1Reserved_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{749, 0} + return file_otg_proto_rawDescGZIP(), []int{756, 0} } type PatternFlowGtpv1EFlag_Choice struct { @@ -118762,7 +119427,7 @@ type PatternFlowGtpv1EFlag_Choice struct { func (x *PatternFlowGtpv1EFlag_Choice) Reset() { *x = PatternFlowGtpv1EFlag_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1336] + mi := &file_otg_proto_msgTypes[1343] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118775,7 +119440,7 @@ func (x *PatternFlowGtpv1EFlag_Choice) String() string { func (*PatternFlowGtpv1EFlag_Choice) ProtoMessage() {} func (x *PatternFlowGtpv1EFlag_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1336] + mi := &file_otg_proto_msgTypes[1343] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118788,7 +119453,7 @@ func (x *PatternFlowGtpv1EFlag_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1EFlag_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1EFlag_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{752, 0} + return file_otg_proto_rawDescGZIP(), []int{759, 0} } type PatternFlowGtpv1SFlag_Choice struct { @@ -118800,7 +119465,7 @@ type PatternFlowGtpv1SFlag_Choice struct { func (x *PatternFlowGtpv1SFlag_Choice) Reset() { *x = PatternFlowGtpv1SFlag_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1337] + mi := &file_otg_proto_msgTypes[1344] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118813,7 +119478,7 @@ func (x *PatternFlowGtpv1SFlag_Choice) String() string { func (*PatternFlowGtpv1SFlag_Choice) ProtoMessage() {} func (x *PatternFlowGtpv1SFlag_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1337] + mi := &file_otg_proto_msgTypes[1344] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118826,7 +119491,7 @@ func (x *PatternFlowGtpv1SFlag_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1SFlag_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1SFlag_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{755, 0} + return file_otg_proto_rawDescGZIP(), []int{762, 0} } type PatternFlowGtpv1PnFlag_Choice struct { @@ -118838,7 +119503,7 @@ type PatternFlowGtpv1PnFlag_Choice struct { func (x *PatternFlowGtpv1PnFlag_Choice) Reset() { *x = PatternFlowGtpv1PnFlag_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1338] + mi := &file_otg_proto_msgTypes[1345] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118851,7 +119516,7 @@ func (x *PatternFlowGtpv1PnFlag_Choice) String() string { func (*PatternFlowGtpv1PnFlag_Choice) ProtoMessage() {} func (x *PatternFlowGtpv1PnFlag_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1338] + mi := &file_otg_proto_msgTypes[1345] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118864,7 +119529,7 @@ func (x *PatternFlowGtpv1PnFlag_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1PnFlag_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1PnFlag_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{758, 0} + return file_otg_proto_rawDescGZIP(), []int{765, 0} } type PatternFlowGtpv1MessageType_Choice struct { @@ -118876,7 +119541,7 @@ type PatternFlowGtpv1MessageType_Choice struct { func (x *PatternFlowGtpv1MessageType_Choice) Reset() { *x = PatternFlowGtpv1MessageType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1339] + mi := &file_otg_proto_msgTypes[1346] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118889,7 +119554,7 @@ func (x *PatternFlowGtpv1MessageType_Choice) String() string { func (*PatternFlowGtpv1MessageType_Choice) ProtoMessage() {} func (x *PatternFlowGtpv1MessageType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1339] + mi := &file_otg_proto_msgTypes[1346] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118902,7 +119567,7 @@ func (x *PatternFlowGtpv1MessageType_Choice) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowGtpv1MessageType_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1MessageType_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{761, 0} + return file_otg_proto_rawDescGZIP(), []int{768, 0} } type PatternFlowGtpv1MessageLength_Choice struct { @@ -118914,7 +119579,7 @@ type PatternFlowGtpv1MessageLength_Choice struct { func (x *PatternFlowGtpv1MessageLength_Choice) Reset() { *x = PatternFlowGtpv1MessageLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1340] + mi := &file_otg_proto_msgTypes[1347] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118927,7 +119592,7 @@ func (x *PatternFlowGtpv1MessageLength_Choice) String() string { func (*PatternFlowGtpv1MessageLength_Choice) ProtoMessage() {} func (x *PatternFlowGtpv1MessageLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1340] + mi := &file_otg_proto_msgTypes[1347] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118940,7 +119605,7 @@ func (x *PatternFlowGtpv1MessageLength_Choice) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowGtpv1MessageLength_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1MessageLength_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{764, 0} + return file_otg_proto_rawDescGZIP(), []int{771, 0} } type PatternFlowGtpv1Teid_Choice struct { @@ -118952,7 +119617,7 @@ type PatternFlowGtpv1Teid_Choice struct { func (x *PatternFlowGtpv1Teid_Choice) Reset() { *x = PatternFlowGtpv1Teid_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1341] + mi := &file_otg_proto_msgTypes[1348] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -118965,7 +119630,7 @@ func (x *PatternFlowGtpv1Teid_Choice) String() string { func (*PatternFlowGtpv1Teid_Choice) ProtoMessage() {} func (x *PatternFlowGtpv1Teid_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1341] + mi := &file_otg_proto_msgTypes[1348] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -118978,7 +119643,7 @@ func (x *PatternFlowGtpv1Teid_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv1Teid_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1Teid_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{767, 0} + return file_otg_proto_rawDescGZIP(), []int{774, 0} } type PatternFlowGtpv1SquenceNumber_Choice struct { @@ -118990,7 +119655,7 @@ type PatternFlowGtpv1SquenceNumber_Choice struct { func (x *PatternFlowGtpv1SquenceNumber_Choice) Reset() { *x = PatternFlowGtpv1SquenceNumber_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1342] + mi := &file_otg_proto_msgTypes[1349] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119003,7 +119668,7 @@ func (x *PatternFlowGtpv1SquenceNumber_Choice) String() string { func (*PatternFlowGtpv1SquenceNumber_Choice) ProtoMessage() {} func (x *PatternFlowGtpv1SquenceNumber_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1342] + mi := &file_otg_proto_msgTypes[1349] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119016,7 +119681,7 @@ func (x *PatternFlowGtpv1SquenceNumber_Choice) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowGtpv1SquenceNumber_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1SquenceNumber_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{770, 0} + return file_otg_proto_rawDescGZIP(), []int{777, 0} } type PatternFlowGtpv1NPduNumber_Choice struct { @@ -119028,7 +119693,7 @@ type PatternFlowGtpv1NPduNumber_Choice struct { func (x *PatternFlowGtpv1NPduNumber_Choice) Reset() { *x = PatternFlowGtpv1NPduNumber_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1343] + mi := &file_otg_proto_msgTypes[1350] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119041,7 +119706,7 @@ func (x *PatternFlowGtpv1NPduNumber_Choice) String() string { func (*PatternFlowGtpv1NPduNumber_Choice) ProtoMessage() {} func (x *PatternFlowGtpv1NPduNumber_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1343] + mi := &file_otg_proto_msgTypes[1350] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119054,7 +119719,7 @@ func (x *PatternFlowGtpv1NPduNumber_Choice) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowGtpv1NPduNumber_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1NPduNumber_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{773, 0} + return file_otg_proto_rawDescGZIP(), []int{780, 0} } type PatternFlowGtpv1NextExtensionHeaderType_Choice struct { @@ -119066,7 +119731,7 @@ type PatternFlowGtpv1NextExtensionHeaderType_Choice struct { func (x *PatternFlowGtpv1NextExtensionHeaderType_Choice) Reset() { *x = PatternFlowGtpv1NextExtensionHeaderType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1344] + mi := &file_otg_proto_msgTypes[1351] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119079,7 +119744,7 @@ func (x *PatternFlowGtpv1NextExtensionHeaderType_Choice) String() string { func (*PatternFlowGtpv1NextExtensionHeaderType_Choice) ProtoMessage() {} func (x *PatternFlowGtpv1NextExtensionHeaderType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1344] + mi := &file_otg_proto_msgTypes[1351] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119092,7 +119757,7 @@ func (x *PatternFlowGtpv1NextExtensionHeaderType_Choice) ProtoReflect() protoref // Deprecated: Use PatternFlowGtpv1NextExtensionHeaderType_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv1NextExtensionHeaderType_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{776, 0} + return file_otg_proto_rawDescGZIP(), []int{783, 0} } type PatternFlowGtpExtensionExtensionLength_Choice struct { @@ -119104,7 +119769,7 @@ type PatternFlowGtpExtensionExtensionLength_Choice struct { func (x *PatternFlowGtpExtensionExtensionLength_Choice) Reset() { *x = PatternFlowGtpExtensionExtensionLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1345] + mi := &file_otg_proto_msgTypes[1352] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119117,7 +119782,7 @@ func (x *PatternFlowGtpExtensionExtensionLength_Choice) String() string { func (*PatternFlowGtpExtensionExtensionLength_Choice) ProtoMessage() {} func (x *PatternFlowGtpExtensionExtensionLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1345] + mi := &file_otg_proto_msgTypes[1352] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119130,7 +119795,7 @@ func (x *PatternFlowGtpExtensionExtensionLength_Choice) ProtoReflect() protorefl // Deprecated: Use PatternFlowGtpExtensionExtensionLength_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpExtensionExtensionLength_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{779, 0} + return file_otg_proto_rawDescGZIP(), []int{786, 0} } type PatternFlowGtpExtensionContents_Choice struct { @@ -119142,7 +119807,7 @@ type PatternFlowGtpExtensionContents_Choice struct { func (x *PatternFlowGtpExtensionContents_Choice) Reset() { *x = PatternFlowGtpExtensionContents_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1346] + mi := &file_otg_proto_msgTypes[1353] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119155,7 +119820,7 @@ func (x *PatternFlowGtpExtensionContents_Choice) String() string { func (*PatternFlowGtpExtensionContents_Choice) ProtoMessage() {} func (x *PatternFlowGtpExtensionContents_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1346] + mi := &file_otg_proto_msgTypes[1353] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119168,7 +119833,7 @@ func (x *PatternFlowGtpExtensionContents_Choice) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowGtpExtensionContents_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpExtensionContents_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{782, 0} + return file_otg_proto_rawDescGZIP(), []int{789, 0} } type PatternFlowGtpExtensionNextExtensionHeader_Choice struct { @@ -119180,7 +119845,7 @@ type PatternFlowGtpExtensionNextExtensionHeader_Choice struct { func (x *PatternFlowGtpExtensionNextExtensionHeader_Choice) Reset() { *x = PatternFlowGtpExtensionNextExtensionHeader_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1347] + mi := &file_otg_proto_msgTypes[1354] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119193,7 +119858,7 @@ func (x *PatternFlowGtpExtensionNextExtensionHeader_Choice) String() string { func (*PatternFlowGtpExtensionNextExtensionHeader_Choice) ProtoMessage() {} func (x *PatternFlowGtpExtensionNextExtensionHeader_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1347] + mi := &file_otg_proto_msgTypes[1354] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119206,7 +119871,7 @@ func (x *PatternFlowGtpExtensionNextExtensionHeader_Choice) ProtoReflect() proto // Deprecated: Use PatternFlowGtpExtensionNextExtensionHeader_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpExtensionNextExtensionHeader_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{785, 0} + return file_otg_proto_rawDescGZIP(), []int{792, 0} } type PatternFlowGtpv2Version_Choice struct { @@ -119218,7 +119883,7 @@ type PatternFlowGtpv2Version_Choice struct { func (x *PatternFlowGtpv2Version_Choice) Reset() { *x = PatternFlowGtpv2Version_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1348] + mi := &file_otg_proto_msgTypes[1355] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119231,7 +119896,7 @@ func (x *PatternFlowGtpv2Version_Choice) String() string { func (*PatternFlowGtpv2Version_Choice) ProtoMessage() {} func (x *PatternFlowGtpv2Version_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1348] + mi := &file_otg_proto_msgTypes[1355] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119244,7 +119909,7 @@ func (x *PatternFlowGtpv2Version_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2Version_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2Version_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{788, 0} + return file_otg_proto_rawDescGZIP(), []int{795, 0} } type PatternFlowGtpv2PiggybackingFlag_Choice struct { @@ -119256,7 +119921,7 @@ type PatternFlowGtpv2PiggybackingFlag_Choice struct { func (x *PatternFlowGtpv2PiggybackingFlag_Choice) Reset() { *x = PatternFlowGtpv2PiggybackingFlag_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1349] + mi := &file_otg_proto_msgTypes[1356] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119269,7 +119934,7 @@ func (x *PatternFlowGtpv2PiggybackingFlag_Choice) String() string { func (*PatternFlowGtpv2PiggybackingFlag_Choice) ProtoMessage() {} func (x *PatternFlowGtpv2PiggybackingFlag_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1349] + mi := &file_otg_proto_msgTypes[1356] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119282,7 +119947,7 @@ func (x *PatternFlowGtpv2PiggybackingFlag_Choice) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowGtpv2PiggybackingFlag_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2PiggybackingFlag_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{791, 0} + return file_otg_proto_rawDescGZIP(), []int{798, 0} } type PatternFlowGtpv2TeidFlag_Choice struct { @@ -119294,7 +119959,7 @@ type PatternFlowGtpv2TeidFlag_Choice struct { func (x *PatternFlowGtpv2TeidFlag_Choice) Reset() { *x = PatternFlowGtpv2TeidFlag_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1350] + mi := &file_otg_proto_msgTypes[1357] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119307,7 +119972,7 @@ func (x *PatternFlowGtpv2TeidFlag_Choice) String() string { func (*PatternFlowGtpv2TeidFlag_Choice) ProtoMessage() {} func (x *PatternFlowGtpv2TeidFlag_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1350] + mi := &file_otg_proto_msgTypes[1357] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119320,7 +119985,7 @@ func (x *PatternFlowGtpv2TeidFlag_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2TeidFlag_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2TeidFlag_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{794, 0} + return file_otg_proto_rawDescGZIP(), []int{801, 0} } type PatternFlowGtpv2Spare1_Choice struct { @@ -119332,7 +119997,7 @@ type PatternFlowGtpv2Spare1_Choice struct { func (x *PatternFlowGtpv2Spare1_Choice) Reset() { *x = PatternFlowGtpv2Spare1_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1351] + mi := &file_otg_proto_msgTypes[1358] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119345,7 +120010,7 @@ func (x *PatternFlowGtpv2Spare1_Choice) String() string { func (*PatternFlowGtpv2Spare1_Choice) ProtoMessage() {} func (x *PatternFlowGtpv2Spare1_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1351] + mi := &file_otg_proto_msgTypes[1358] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119358,7 +120023,7 @@ func (x *PatternFlowGtpv2Spare1_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2Spare1_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2Spare1_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{797, 0} + return file_otg_proto_rawDescGZIP(), []int{804, 0} } type PatternFlowGtpv2MessageType_Choice struct { @@ -119370,7 +120035,7 @@ type PatternFlowGtpv2MessageType_Choice struct { func (x *PatternFlowGtpv2MessageType_Choice) Reset() { *x = PatternFlowGtpv2MessageType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1352] + mi := &file_otg_proto_msgTypes[1359] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119383,7 +120048,7 @@ func (x *PatternFlowGtpv2MessageType_Choice) String() string { func (*PatternFlowGtpv2MessageType_Choice) ProtoMessage() {} func (x *PatternFlowGtpv2MessageType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1352] + mi := &file_otg_proto_msgTypes[1359] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119396,7 +120061,7 @@ func (x *PatternFlowGtpv2MessageType_Choice) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowGtpv2MessageType_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2MessageType_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{800, 0} + return file_otg_proto_rawDescGZIP(), []int{807, 0} } type PatternFlowGtpv2MessageLength_Choice struct { @@ -119408,7 +120073,7 @@ type PatternFlowGtpv2MessageLength_Choice struct { func (x *PatternFlowGtpv2MessageLength_Choice) Reset() { *x = PatternFlowGtpv2MessageLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1353] + mi := &file_otg_proto_msgTypes[1360] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119421,7 +120086,7 @@ func (x *PatternFlowGtpv2MessageLength_Choice) String() string { func (*PatternFlowGtpv2MessageLength_Choice) ProtoMessage() {} func (x *PatternFlowGtpv2MessageLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1353] + mi := &file_otg_proto_msgTypes[1360] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119434,7 +120099,7 @@ func (x *PatternFlowGtpv2MessageLength_Choice) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowGtpv2MessageLength_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2MessageLength_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{803, 0} + return file_otg_proto_rawDescGZIP(), []int{810, 0} } type PatternFlowGtpv2Teid_Choice struct { @@ -119446,7 +120111,7 @@ type PatternFlowGtpv2Teid_Choice struct { func (x *PatternFlowGtpv2Teid_Choice) Reset() { *x = PatternFlowGtpv2Teid_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1354] + mi := &file_otg_proto_msgTypes[1361] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119459,7 +120124,7 @@ func (x *PatternFlowGtpv2Teid_Choice) String() string { func (*PatternFlowGtpv2Teid_Choice) ProtoMessage() {} func (x *PatternFlowGtpv2Teid_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1354] + mi := &file_otg_proto_msgTypes[1361] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119472,7 +120137,7 @@ func (x *PatternFlowGtpv2Teid_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2Teid_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2Teid_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{806, 0} + return file_otg_proto_rawDescGZIP(), []int{813, 0} } type PatternFlowGtpv2SequenceNumber_Choice struct { @@ -119484,7 +120149,7 @@ type PatternFlowGtpv2SequenceNumber_Choice struct { func (x *PatternFlowGtpv2SequenceNumber_Choice) Reset() { *x = PatternFlowGtpv2SequenceNumber_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1355] + mi := &file_otg_proto_msgTypes[1362] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119497,7 +120162,7 @@ func (x *PatternFlowGtpv2SequenceNumber_Choice) String() string { func (*PatternFlowGtpv2SequenceNumber_Choice) ProtoMessage() {} func (x *PatternFlowGtpv2SequenceNumber_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1355] + mi := &file_otg_proto_msgTypes[1362] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119510,7 +120175,7 @@ func (x *PatternFlowGtpv2SequenceNumber_Choice) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowGtpv2SequenceNumber_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2SequenceNumber_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{809, 0} + return file_otg_proto_rawDescGZIP(), []int{816, 0} } type PatternFlowGtpv2Spare2_Choice struct { @@ -119522,7 +120187,7 @@ type PatternFlowGtpv2Spare2_Choice struct { func (x *PatternFlowGtpv2Spare2_Choice) Reset() { *x = PatternFlowGtpv2Spare2_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1356] + mi := &file_otg_proto_msgTypes[1363] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119535,7 +120200,7 @@ func (x *PatternFlowGtpv2Spare2_Choice) String() string { func (*PatternFlowGtpv2Spare2_Choice) ProtoMessage() {} func (x *PatternFlowGtpv2Spare2_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1356] + mi := &file_otg_proto_msgTypes[1363] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119548,7 +120213,7 @@ func (x *PatternFlowGtpv2Spare2_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowGtpv2Spare2_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowGtpv2Spare2_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{812, 0} + return file_otg_proto_rawDescGZIP(), []int{819, 0} } type PatternFlowArpHardwareType_Choice struct { @@ -119560,7 +120225,7 @@ type PatternFlowArpHardwareType_Choice struct { func (x *PatternFlowArpHardwareType_Choice) Reset() { *x = PatternFlowArpHardwareType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1357] + mi := &file_otg_proto_msgTypes[1364] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119573,7 +120238,7 @@ func (x *PatternFlowArpHardwareType_Choice) String() string { func (*PatternFlowArpHardwareType_Choice) ProtoMessage() {} func (x *PatternFlowArpHardwareType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1357] + mi := &file_otg_proto_msgTypes[1364] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119586,7 +120251,7 @@ func (x *PatternFlowArpHardwareType_Choice) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowArpHardwareType_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowArpHardwareType_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{815, 0} + return file_otg_proto_rawDescGZIP(), []int{822, 0} } type PatternFlowArpProtocolType_Choice struct { @@ -119598,7 +120263,7 @@ type PatternFlowArpProtocolType_Choice struct { func (x *PatternFlowArpProtocolType_Choice) Reset() { *x = PatternFlowArpProtocolType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1358] + mi := &file_otg_proto_msgTypes[1365] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119611,7 +120276,7 @@ func (x *PatternFlowArpProtocolType_Choice) String() string { func (*PatternFlowArpProtocolType_Choice) ProtoMessage() {} func (x *PatternFlowArpProtocolType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1358] + mi := &file_otg_proto_msgTypes[1365] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119624,7 +120289,7 @@ func (x *PatternFlowArpProtocolType_Choice) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowArpProtocolType_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowArpProtocolType_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{818, 0} + return file_otg_proto_rawDescGZIP(), []int{825, 0} } type PatternFlowArpHardwareLength_Choice struct { @@ -119636,7 +120301,7 @@ type PatternFlowArpHardwareLength_Choice struct { func (x *PatternFlowArpHardwareLength_Choice) Reset() { *x = PatternFlowArpHardwareLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1359] + mi := &file_otg_proto_msgTypes[1366] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119649,7 +120314,7 @@ func (x *PatternFlowArpHardwareLength_Choice) String() string { func (*PatternFlowArpHardwareLength_Choice) ProtoMessage() {} func (x *PatternFlowArpHardwareLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1359] + mi := &file_otg_proto_msgTypes[1366] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119662,7 +120327,7 @@ func (x *PatternFlowArpHardwareLength_Choice) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowArpHardwareLength_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowArpHardwareLength_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{821, 0} + return file_otg_proto_rawDescGZIP(), []int{828, 0} } type PatternFlowArpProtocolLength_Choice struct { @@ -119674,7 +120339,7 @@ type PatternFlowArpProtocolLength_Choice struct { func (x *PatternFlowArpProtocolLength_Choice) Reset() { *x = PatternFlowArpProtocolLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1360] + mi := &file_otg_proto_msgTypes[1367] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119687,7 +120352,7 @@ func (x *PatternFlowArpProtocolLength_Choice) String() string { func (*PatternFlowArpProtocolLength_Choice) ProtoMessage() {} func (x *PatternFlowArpProtocolLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1360] + mi := &file_otg_proto_msgTypes[1367] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119700,7 +120365,7 @@ func (x *PatternFlowArpProtocolLength_Choice) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowArpProtocolLength_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowArpProtocolLength_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{824, 0} + return file_otg_proto_rawDescGZIP(), []int{831, 0} } type PatternFlowArpOperation_Choice struct { @@ -119712,7 +120377,7 @@ type PatternFlowArpOperation_Choice struct { func (x *PatternFlowArpOperation_Choice) Reset() { *x = PatternFlowArpOperation_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1361] + mi := &file_otg_proto_msgTypes[1368] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119725,7 +120390,7 @@ func (x *PatternFlowArpOperation_Choice) String() string { func (*PatternFlowArpOperation_Choice) ProtoMessage() {} func (x *PatternFlowArpOperation_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1361] + mi := &file_otg_proto_msgTypes[1368] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119738,7 +120403,7 @@ func (x *PatternFlowArpOperation_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowArpOperation_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowArpOperation_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{827, 0} + return file_otg_proto_rawDescGZIP(), []int{834, 0} } type PatternFlowArpSenderHardwareAddr_Choice struct { @@ -119750,7 +120415,7 @@ type PatternFlowArpSenderHardwareAddr_Choice struct { func (x *PatternFlowArpSenderHardwareAddr_Choice) Reset() { *x = PatternFlowArpSenderHardwareAddr_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1362] + mi := &file_otg_proto_msgTypes[1369] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119763,7 +120428,7 @@ func (x *PatternFlowArpSenderHardwareAddr_Choice) String() string { func (*PatternFlowArpSenderHardwareAddr_Choice) ProtoMessage() {} func (x *PatternFlowArpSenderHardwareAddr_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1362] + mi := &file_otg_proto_msgTypes[1369] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119776,7 +120441,7 @@ func (x *PatternFlowArpSenderHardwareAddr_Choice) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowArpSenderHardwareAddr_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowArpSenderHardwareAddr_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{830, 0} + return file_otg_proto_rawDescGZIP(), []int{837, 0} } type PatternFlowArpSenderProtocolAddr_Choice struct { @@ -119788,7 +120453,7 @@ type PatternFlowArpSenderProtocolAddr_Choice struct { func (x *PatternFlowArpSenderProtocolAddr_Choice) Reset() { *x = PatternFlowArpSenderProtocolAddr_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1363] + mi := &file_otg_proto_msgTypes[1370] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119801,7 +120466,7 @@ func (x *PatternFlowArpSenderProtocolAddr_Choice) String() string { func (*PatternFlowArpSenderProtocolAddr_Choice) ProtoMessage() {} func (x *PatternFlowArpSenderProtocolAddr_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1363] + mi := &file_otg_proto_msgTypes[1370] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119814,7 +120479,7 @@ func (x *PatternFlowArpSenderProtocolAddr_Choice) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowArpSenderProtocolAddr_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowArpSenderProtocolAddr_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{833, 0} + return file_otg_proto_rawDescGZIP(), []int{840, 0} } type PatternFlowArpTargetHardwareAddr_Choice struct { @@ -119826,7 +120491,7 @@ type PatternFlowArpTargetHardwareAddr_Choice struct { func (x *PatternFlowArpTargetHardwareAddr_Choice) Reset() { *x = PatternFlowArpTargetHardwareAddr_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1364] + mi := &file_otg_proto_msgTypes[1371] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119839,7 +120504,7 @@ func (x *PatternFlowArpTargetHardwareAddr_Choice) String() string { func (*PatternFlowArpTargetHardwareAddr_Choice) ProtoMessage() {} func (x *PatternFlowArpTargetHardwareAddr_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1364] + mi := &file_otg_proto_msgTypes[1371] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119852,7 +120517,7 @@ func (x *PatternFlowArpTargetHardwareAddr_Choice) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowArpTargetHardwareAddr_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowArpTargetHardwareAddr_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{836, 0} + return file_otg_proto_rawDescGZIP(), []int{843, 0} } type PatternFlowArpTargetProtocolAddr_Choice struct { @@ -119864,7 +120529,7 @@ type PatternFlowArpTargetProtocolAddr_Choice struct { func (x *PatternFlowArpTargetProtocolAddr_Choice) Reset() { *x = PatternFlowArpTargetProtocolAddr_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1365] + mi := &file_otg_proto_msgTypes[1372] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119877,7 +120542,7 @@ func (x *PatternFlowArpTargetProtocolAddr_Choice) String() string { func (*PatternFlowArpTargetProtocolAddr_Choice) ProtoMessage() {} func (x *PatternFlowArpTargetProtocolAddr_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1365] + mi := &file_otg_proto_msgTypes[1372] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119890,7 +120555,7 @@ func (x *PatternFlowArpTargetProtocolAddr_Choice) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowArpTargetProtocolAddr_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowArpTargetProtocolAddr_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{839, 0} + return file_otg_proto_rawDescGZIP(), []int{846, 0} } type PatternFlowIcmpEchoType_Choice struct { @@ -119902,7 +120567,7 @@ type PatternFlowIcmpEchoType_Choice struct { func (x *PatternFlowIcmpEchoType_Choice) Reset() { *x = PatternFlowIcmpEchoType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1366] + mi := &file_otg_proto_msgTypes[1373] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119915,7 +120580,7 @@ func (x *PatternFlowIcmpEchoType_Choice) String() string { func (*PatternFlowIcmpEchoType_Choice) ProtoMessage() {} func (x *PatternFlowIcmpEchoType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1366] + mi := &file_otg_proto_msgTypes[1373] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119928,7 +120593,7 @@ func (x *PatternFlowIcmpEchoType_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpEchoType_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoType_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{842, 0} + return file_otg_proto_rawDescGZIP(), []int{849, 0} } type PatternFlowIcmpEchoCode_Choice struct { @@ -119940,7 +120605,7 @@ type PatternFlowIcmpEchoCode_Choice struct { func (x *PatternFlowIcmpEchoCode_Choice) Reset() { *x = PatternFlowIcmpEchoCode_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1367] + mi := &file_otg_proto_msgTypes[1374] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119953,7 +120618,7 @@ func (x *PatternFlowIcmpEchoCode_Choice) String() string { func (*PatternFlowIcmpEchoCode_Choice) ProtoMessage() {} func (x *PatternFlowIcmpEchoCode_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1367] + mi := &file_otg_proto_msgTypes[1374] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -119966,7 +120631,7 @@ func (x *PatternFlowIcmpEchoCode_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpEchoCode_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoCode_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{845, 0} + return file_otg_proto_rawDescGZIP(), []int{852, 0} } type PatternFlowIcmpEchoChecksum_Choice struct { @@ -119978,7 +120643,7 @@ type PatternFlowIcmpEchoChecksum_Choice struct { func (x *PatternFlowIcmpEchoChecksum_Choice) Reset() { *x = PatternFlowIcmpEchoChecksum_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1368] + mi := &file_otg_proto_msgTypes[1375] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -119991,7 +120656,7 @@ func (x *PatternFlowIcmpEchoChecksum_Choice) String() string { func (*PatternFlowIcmpEchoChecksum_Choice) ProtoMessage() {} func (x *PatternFlowIcmpEchoChecksum_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1368] + mi := &file_otg_proto_msgTypes[1375] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120004,7 +120669,7 @@ func (x *PatternFlowIcmpEchoChecksum_Choice) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowIcmpEchoChecksum_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoChecksum_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{846, 0} + return file_otg_proto_rawDescGZIP(), []int{853, 0} } type PatternFlowIcmpEchoChecksum_Generated struct { @@ -120016,7 +120681,7 @@ type PatternFlowIcmpEchoChecksum_Generated struct { func (x *PatternFlowIcmpEchoChecksum_Generated) Reset() { *x = PatternFlowIcmpEchoChecksum_Generated{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1369] + mi := &file_otg_proto_msgTypes[1376] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120029,7 +120694,7 @@ func (x *PatternFlowIcmpEchoChecksum_Generated) String() string { func (*PatternFlowIcmpEchoChecksum_Generated) ProtoMessage() {} func (x *PatternFlowIcmpEchoChecksum_Generated) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1369] + mi := &file_otg_proto_msgTypes[1376] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120042,7 +120707,7 @@ func (x *PatternFlowIcmpEchoChecksum_Generated) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowIcmpEchoChecksum_Generated.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoChecksum_Generated) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{846, 1} + return file_otg_proto_rawDescGZIP(), []int{853, 1} } type PatternFlowIcmpEchoIdentifier_Choice struct { @@ -120054,7 +120719,7 @@ type PatternFlowIcmpEchoIdentifier_Choice struct { func (x *PatternFlowIcmpEchoIdentifier_Choice) Reset() { *x = PatternFlowIcmpEchoIdentifier_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1370] + mi := &file_otg_proto_msgTypes[1377] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120067,7 +120732,7 @@ func (x *PatternFlowIcmpEchoIdentifier_Choice) String() string { func (*PatternFlowIcmpEchoIdentifier_Choice) ProtoMessage() {} func (x *PatternFlowIcmpEchoIdentifier_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1370] + mi := &file_otg_proto_msgTypes[1377] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120080,7 +120745,7 @@ func (x *PatternFlowIcmpEchoIdentifier_Choice) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowIcmpEchoIdentifier_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoIdentifier_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{849, 0} + return file_otg_proto_rawDescGZIP(), []int{856, 0} } type PatternFlowIcmpEchoSequenceNumber_Choice struct { @@ -120092,7 +120757,7 @@ type PatternFlowIcmpEchoSequenceNumber_Choice struct { func (x *PatternFlowIcmpEchoSequenceNumber_Choice) Reset() { *x = PatternFlowIcmpEchoSequenceNumber_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1371] + mi := &file_otg_proto_msgTypes[1378] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120105,7 +120770,7 @@ func (x *PatternFlowIcmpEchoSequenceNumber_Choice) String() string { func (*PatternFlowIcmpEchoSequenceNumber_Choice) ProtoMessage() {} func (x *PatternFlowIcmpEchoSequenceNumber_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1371] + mi := &file_otg_proto_msgTypes[1378] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120118,7 +120783,7 @@ func (x *PatternFlowIcmpEchoSequenceNumber_Choice) ProtoReflect() protoreflect.M // Deprecated: Use PatternFlowIcmpEchoSequenceNumber_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpEchoSequenceNumber_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{852, 0} + return file_otg_proto_rawDescGZIP(), []int{859, 0} } type PatternFlowIcmpCommonChecksum_Choice struct { @@ -120130,7 +120795,7 @@ type PatternFlowIcmpCommonChecksum_Choice struct { func (x *PatternFlowIcmpCommonChecksum_Choice) Reset() { *x = PatternFlowIcmpCommonChecksum_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1372] + mi := &file_otg_proto_msgTypes[1379] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120143,7 +120808,7 @@ func (x *PatternFlowIcmpCommonChecksum_Choice) String() string { func (*PatternFlowIcmpCommonChecksum_Choice) ProtoMessage() {} func (x *PatternFlowIcmpCommonChecksum_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1372] + mi := &file_otg_proto_msgTypes[1379] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120156,7 +120821,7 @@ func (x *PatternFlowIcmpCommonChecksum_Choice) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowIcmpCommonChecksum_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpCommonChecksum_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{853, 0} + return file_otg_proto_rawDescGZIP(), []int{860, 0} } type PatternFlowIcmpCommonChecksum_Generated struct { @@ -120168,7 +120833,7 @@ type PatternFlowIcmpCommonChecksum_Generated struct { func (x *PatternFlowIcmpCommonChecksum_Generated) Reset() { *x = PatternFlowIcmpCommonChecksum_Generated{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1373] + mi := &file_otg_proto_msgTypes[1380] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120181,7 +120846,7 @@ func (x *PatternFlowIcmpCommonChecksum_Generated) String() string { func (*PatternFlowIcmpCommonChecksum_Generated) ProtoMessage() {} func (x *PatternFlowIcmpCommonChecksum_Generated) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1373] + mi := &file_otg_proto_msgTypes[1380] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120194,7 +120859,7 @@ func (x *PatternFlowIcmpCommonChecksum_Generated) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowIcmpCommonChecksum_Generated.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpCommonChecksum_Generated) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{853, 1} + return file_otg_proto_rawDescGZIP(), []int{860, 1} } type PatternFlowIcmpNextFieldsIdentifier_Choice struct { @@ -120206,7 +120871,7 @@ type PatternFlowIcmpNextFieldsIdentifier_Choice struct { func (x *PatternFlowIcmpNextFieldsIdentifier_Choice) Reset() { *x = PatternFlowIcmpNextFieldsIdentifier_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1374] + mi := &file_otg_proto_msgTypes[1381] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120219,7 +120884,7 @@ func (x *PatternFlowIcmpNextFieldsIdentifier_Choice) String() string { func (*PatternFlowIcmpNextFieldsIdentifier_Choice) ProtoMessage() {} func (x *PatternFlowIcmpNextFieldsIdentifier_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1374] + mi := &file_otg_proto_msgTypes[1381] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120232,7 +120897,7 @@ func (x *PatternFlowIcmpNextFieldsIdentifier_Choice) ProtoReflect() protoreflect // Deprecated: Use PatternFlowIcmpNextFieldsIdentifier_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpNextFieldsIdentifier_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{856, 0} + return file_otg_proto_rawDescGZIP(), []int{863, 0} } type PatternFlowIcmpNextFieldsSequenceNumber_Choice struct { @@ -120244,7 +120909,7 @@ type PatternFlowIcmpNextFieldsSequenceNumber_Choice struct { func (x *PatternFlowIcmpNextFieldsSequenceNumber_Choice) Reset() { *x = PatternFlowIcmpNextFieldsSequenceNumber_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1375] + mi := &file_otg_proto_msgTypes[1382] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120257,7 +120922,7 @@ func (x *PatternFlowIcmpNextFieldsSequenceNumber_Choice) String() string { func (*PatternFlowIcmpNextFieldsSequenceNumber_Choice) ProtoMessage() {} func (x *PatternFlowIcmpNextFieldsSequenceNumber_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1375] + mi := &file_otg_proto_msgTypes[1382] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120270,7 +120935,7 @@ func (x *PatternFlowIcmpNextFieldsSequenceNumber_Choice) ProtoReflect() protoref // Deprecated: Use PatternFlowIcmpNextFieldsSequenceNumber_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpNextFieldsSequenceNumber_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{859, 0} + return file_otg_proto_rawDescGZIP(), []int{866, 0} } type PatternFlowIcmpv6EchoType_Choice struct { @@ -120282,7 +120947,7 @@ type PatternFlowIcmpv6EchoType_Choice struct { func (x *PatternFlowIcmpv6EchoType_Choice) Reset() { *x = PatternFlowIcmpv6EchoType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1376] + mi := &file_otg_proto_msgTypes[1383] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120295,7 +120960,7 @@ func (x *PatternFlowIcmpv6EchoType_Choice) String() string { func (*PatternFlowIcmpv6EchoType_Choice) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1376] + mi := &file_otg_proto_msgTypes[1383] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120308,7 +120973,7 @@ func (x *PatternFlowIcmpv6EchoType_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpv6EchoType_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoType_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{862, 0} + return file_otg_proto_rawDescGZIP(), []int{869, 0} } type PatternFlowIcmpv6EchoCode_Choice struct { @@ -120320,7 +120985,7 @@ type PatternFlowIcmpv6EchoCode_Choice struct { func (x *PatternFlowIcmpv6EchoCode_Choice) Reset() { *x = PatternFlowIcmpv6EchoCode_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1377] + mi := &file_otg_proto_msgTypes[1384] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120333,7 +120998,7 @@ func (x *PatternFlowIcmpv6EchoCode_Choice) String() string { func (*PatternFlowIcmpv6EchoCode_Choice) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoCode_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1377] + mi := &file_otg_proto_msgTypes[1384] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120346,7 +121011,7 @@ func (x *PatternFlowIcmpv6EchoCode_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIcmpv6EchoCode_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoCode_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{865, 0} + return file_otg_proto_rawDescGZIP(), []int{872, 0} } type PatternFlowIcmpv6EchoIdentifier_Choice struct { @@ -120358,7 +121023,7 @@ type PatternFlowIcmpv6EchoIdentifier_Choice struct { func (x *PatternFlowIcmpv6EchoIdentifier_Choice) Reset() { *x = PatternFlowIcmpv6EchoIdentifier_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1378] + mi := &file_otg_proto_msgTypes[1385] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120371,7 +121036,7 @@ func (x *PatternFlowIcmpv6EchoIdentifier_Choice) String() string { func (*PatternFlowIcmpv6EchoIdentifier_Choice) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoIdentifier_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1378] + mi := &file_otg_proto_msgTypes[1385] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120384,7 +121049,7 @@ func (x *PatternFlowIcmpv6EchoIdentifier_Choice) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowIcmpv6EchoIdentifier_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoIdentifier_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{868, 0} + return file_otg_proto_rawDescGZIP(), []int{875, 0} } type PatternFlowIcmpv6EchoSequenceNumber_Choice struct { @@ -120396,7 +121061,7 @@ type PatternFlowIcmpv6EchoSequenceNumber_Choice struct { func (x *PatternFlowIcmpv6EchoSequenceNumber_Choice) Reset() { *x = PatternFlowIcmpv6EchoSequenceNumber_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1379] + mi := &file_otg_proto_msgTypes[1386] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120409,7 +121074,7 @@ func (x *PatternFlowIcmpv6EchoSequenceNumber_Choice) String() string { func (*PatternFlowIcmpv6EchoSequenceNumber_Choice) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoSequenceNumber_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1379] + mi := &file_otg_proto_msgTypes[1386] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120422,7 +121087,7 @@ func (x *PatternFlowIcmpv6EchoSequenceNumber_Choice) ProtoReflect() protoreflect // Deprecated: Use PatternFlowIcmpv6EchoSequenceNumber_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoSequenceNumber_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{871, 0} + return file_otg_proto_rawDescGZIP(), []int{878, 0} } type PatternFlowIcmpv6EchoChecksum_Choice struct { @@ -120434,7 +121099,7 @@ type PatternFlowIcmpv6EchoChecksum_Choice struct { func (x *PatternFlowIcmpv6EchoChecksum_Choice) Reset() { *x = PatternFlowIcmpv6EchoChecksum_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1380] + mi := &file_otg_proto_msgTypes[1387] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120447,7 +121112,7 @@ func (x *PatternFlowIcmpv6EchoChecksum_Choice) String() string { func (*PatternFlowIcmpv6EchoChecksum_Choice) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoChecksum_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1380] + mi := &file_otg_proto_msgTypes[1387] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120460,7 +121125,7 @@ func (x *PatternFlowIcmpv6EchoChecksum_Choice) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowIcmpv6EchoChecksum_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoChecksum_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{872, 0} + return file_otg_proto_rawDescGZIP(), []int{879, 0} } type PatternFlowIcmpv6EchoChecksum_Generated struct { @@ -120472,7 +121137,7 @@ type PatternFlowIcmpv6EchoChecksum_Generated struct { func (x *PatternFlowIcmpv6EchoChecksum_Generated) Reset() { *x = PatternFlowIcmpv6EchoChecksum_Generated{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1381] + mi := &file_otg_proto_msgTypes[1388] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120485,7 +121150,7 @@ func (x *PatternFlowIcmpv6EchoChecksum_Generated) String() string { func (*PatternFlowIcmpv6EchoChecksum_Generated) ProtoMessage() {} func (x *PatternFlowIcmpv6EchoChecksum_Generated) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1381] + mi := &file_otg_proto_msgTypes[1388] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120498,7 +121163,7 @@ func (x *PatternFlowIcmpv6EchoChecksum_Generated) ProtoReflect() protoreflect.Me // Deprecated: Use PatternFlowIcmpv6EchoChecksum_Generated.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6EchoChecksum_Generated) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{872, 1} + return file_otg_proto_rawDescGZIP(), []int{879, 1} } type PatternFlowIcmpv6CommonChecksum_Choice struct { @@ -120510,7 +121175,7 @@ type PatternFlowIcmpv6CommonChecksum_Choice struct { func (x *PatternFlowIcmpv6CommonChecksum_Choice) Reset() { *x = PatternFlowIcmpv6CommonChecksum_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1382] + mi := &file_otg_proto_msgTypes[1389] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120523,7 +121188,7 @@ func (x *PatternFlowIcmpv6CommonChecksum_Choice) String() string { func (*PatternFlowIcmpv6CommonChecksum_Choice) ProtoMessage() {} func (x *PatternFlowIcmpv6CommonChecksum_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1382] + mi := &file_otg_proto_msgTypes[1389] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120536,7 +121201,7 @@ func (x *PatternFlowIcmpv6CommonChecksum_Choice) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowIcmpv6CommonChecksum_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6CommonChecksum_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{873, 0} + return file_otg_proto_rawDescGZIP(), []int{880, 0} } type PatternFlowIcmpv6CommonChecksum_Generated struct { @@ -120548,7 +121213,7 @@ type PatternFlowIcmpv6CommonChecksum_Generated struct { func (x *PatternFlowIcmpv6CommonChecksum_Generated) Reset() { *x = PatternFlowIcmpv6CommonChecksum_Generated{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1383] + mi := &file_otg_proto_msgTypes[1390] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120561,7 +121226,7 @@ func (x *PatternFlowIcmpv6CommonChecksum_Generated) String() string { func (*PatternFlowIcmpv6CommonChecksum_Generated) ProtoMessage() {} func (x *PatternFlowIcmpv6CommonChecksum_Generated) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1383] + mi := &file_otg_proto_msgTypes[1390] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120574,7 +121239,7 @@ func (x *PatternFlowIcmpv6CommonChecksum_Generated) ProtoReflect() protoreflect. // Deprecated: Use PatternFlowIcmpv6CommonChecksum_Generated.ProtoReflect.Descriptor instead. func (*PatternFlowIcmpv6CommonChecksum_Generated) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{873, 1} + return file_otg_proto_rawDescGZIP(), []int{880, 1} } type PatternFlowPppAddress_Choice struct { @@ -120586,7 +121251,7 @@ type PatternFlowPppAddress_Choice struct { func (x *PatternFlowPppAddress_Choice) Reset() { *x = PatternFlowPppAddress_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1384] + mi := &file_otg_proto_msgTypes[1391] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120599,7 +121264,7 @@ func (x *PatternFlowPppAddress_Choice) String() string { func (*PatternFlowPppAddress_Choice) ProtoMessage() {} func (x *PatternFlowPppAddress_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1384] + mi := &file_otg_proto_msgTypes[1391] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120612,7 +121277,7 @@ func (x *PatternFlowPppAddress_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPppAddress_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPppAddress_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{876, 0} + return file_otg_proto_rawDescGZIP(), []int{883, 0} } type PatternFlowPppControl_Choice struct { @@ -120624,7 +121289,7 @@ type PatternFlowPppControl_Choice struct { func (x *PatternFlowPppControl_Choice) Reset() { *x = PatternFlowPppControl_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1385] + mi := &file_otg_proto_msgTypes[1392] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120637,7 +121302,7 @@ func (x *PatternFlowPppControl_Choice) String() string { func (*PatternFlowPppControl_Choice) ProtoMessage() {} func (x *PatternFlowPppControl_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1385] + mi := &file_otg_proto_msgTypes[1392] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120650,7 +121315,7 @@ func (x *PatternFlowPppControl_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowPppControl_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPppControl_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{879, 0} + return file_otg_proto_rawDescGZIP(), []int{886, 0} } type PatternFlowPppProtocolType_Choice struct { @@ -120662,7 +121327,7 @@ type PatternFlowPppProtocolType_Choice struct { func (x *PatternFlowPppProtocolType_Choice) Reset() { *x = PatternFlowPppProtocolType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1386] + mi := &file_otg_proto_msgTypes[1393] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120675,7 +121340,7 @@ func (x *PatternFlowPppProtocolType_Choice) String() string { func (*PatternFlowPppProtocolType_Choice) ProtoMessage() {} func (x *PatternFlowPppProtocolType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1386] + mi := &file_otg_proto_msgTypes[1393] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120688,7 +121353,7 @@ func (x *PatternFlowPppProtocolType_Choice) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowPppProtocolType_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowPppProtocolType_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{882, 0} + return file_otg_proto_rawDescGZIP(), []int{889, 0} } type PatternFlowIgmpv1Version_Choice struct { @@ -120700,7 +121365,7 @@ type PatternFlowIgmpv1Version_Choice struct { func (x *PatternFlowIgmpv1Version_Choice) Reset() { *x = PatternFlowIgmpv1Version_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1387] + mi := &file_otg_proto_msgTypes[1394] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120713,7 +121378,7 @@ func (x *PatternFlowIgmpv1Version_Choice) String() string { func (*PatternFlowIgmpv1Version_Choice) ProtoMessage() {} func (x *PatternFlowIgmpv1Version_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1387] + mi := &file_otg_proto_msgTypes[1394] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120726,7 +121391,7 @@ func (x *PatternFlowIgmpv1Version_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIgmpv1Version_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1Version_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{885, 0} + return file_otg_proto_rawDescGZIP(), []int{892, 0} } type PatternFlowIgmpv1Type_Choice struct { @@ -120738,7 +121403,7 @@ type PatternFlowIgmpv1Type_Choice struct { func (x *PatternFlowIgmpv1Type_Choice) Reset() { *x = PatternFlowIgmpv1Type_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1388] + mi := &file_otg_proto_msgTypes[1395] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120751,7 +121416,7 @@ func (x *PatternFlowIgmpv1Type_Choice) String() string { func (*PatternFlowIgmpv1Type_Choice) ProtoMessage() {} func (x *PatternFlowIgmpv1Type_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1388] + mi := &file_otg_proto_msgTypes[1395] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120764,7 +121429,7 @@ func (x *PatternFlowIgmpv1Type_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIgmpv1Type_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1Type_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{888, 0} + return file_otg_proto_rawDescGZIP(), []int{895, 0} } type PatternFlowIgmpv1Unused_Choice struct { @@ -120776,7 +121441,7 @@ type PatternFlowIgmpv1Unused_Choice struct { func (x *PatternFlowIgmpv1Unused_Choice) Reset() { *x = PatternFlowIgmpv1Unused_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1389] + mi := &file_otg_proto_msgTypes[1396] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120789,7 +121454,7 @@ func (x *PatternFlowIgmpv1Unused_Choice) String() string { func (*PatternFlowIgmpv1Unused_Choice) ProtoMessage() {} func (x *PatternFlowIgmpv1Unused_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1389] + mi := &file_otg_proto_msgTypes[1396] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120802,7 +121467,7 @@ func (x *PatternFlowIgmpv1Unused_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIgmpv1Unused_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1Unused_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{891, 0} + return file_otg_proto_rawDescGZIP(), []int{898, 0} } type PatternFlowIgmpv1Checksum_Choice struct { @@ -120814,7 +121479,7 @@ type PatternFlowIgmpv1Checksum_Choice struct { func (x *PatternFlowIgmpv1Checksum_Choice) Reset() { *x = PatternFlowIgmpv1Checksum_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1390] + mi := &file_otg_proto_msgTypes[1397] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120827,7 +121492,7 @@ func (x *PatternFlowIgmpv1Checksum_Choice) String() string { func (*PatternFlowIgmpv1Checksum_Choice) ProtoMessage() {} func (x *PatternFlowIgmpv1Checksum_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1390] + mi := &file_otg_proto_msgTypes[1397] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120840,7 +121505,7 @@ func (x *PatternFlowIgmpv1Checksum_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowIgmpv1Checksum_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1Checksum_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{892, 0} + return file_otg_proto_rawDescGZIP(), []int{899, 0} } type PatternFlowIgmpv1Checksum_Generated struct { @@ -120852,7 +121517,7 @@ type PatternFlowIgmpv1Checksum_Generated struct { func (x *PatternFlowIgmpv1Checksum_Generated) Reset() { *x = PatternFlowIgmpv1Checksum_Generated{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1391] + mi := &file_otg_proto_msgTypes[1398] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120865,7 +121530,7 @@ func (x *PatternFlowIgmpv1Checksum_Generated) String() string { func (*PatternFlowIgmpv1Checksum_Generated) ProtoMessage() {} func (x *PatternFlowIgmpv1Checksum_Generated) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1391] + mi := &file_otg_proto_msgTypes[1398] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120878,7 +121543,7 @@ func (x *PatternFlowIgmpv1Checksum_Generated) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowIgmpv1Checksum_Generated.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1Checksum_Generated) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{892, 1} + return file_otg_proto_rawDescGZIP(), []int{899, 1} } type PatternFlowIgmpv1GroupAddress_Choice struct { @@ -120890,7 +121555,7 @@ type PatternFlowIgmpv1GroupAddress_Choice struct { func (x *PatternFlowIgmpv1GroupAddress_Choice) Reset() { *x = PatternFlowIgmpv1GroupAddress_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1392] + mi := &file_otg_proto_msgTypes[1399] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120903,7 +121568,7 @@ func (x *PatternFlowIgmpv1GroupAddress_Choice) String() string { func (*PatternFlowIgmpv1GroupAddress_Choice) ProtoMessage() {} func (x *PatternFlowIgmpv1GroupAddress_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1392] + mi := &file_otg_proto_msgTypes[1399] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120916,7 +121581,7 @@ func (x *PatternFlowIgmpv1GroupAddress_Choice) ProtoReflect() protoreflect.Messa // Deprecated: Use PatternFlowIgmpv1GroupAddress_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowIgmpv1GroupAddress_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{895, 0} + return file_otg_proto_rawDescGZIP(), []int{902, 0} } type PatternFlowMplsLabel_Choice struct { @@ -120928,7 +121593,7 @@ type PatternFlowMplsLabel_Choice struct { func (x *PatternFlowMplsLabel_Choice) Reset() { *x = PatternFlowMplsLabel_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1393] + mi := &file_otg_proto_msgTypes[1400] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120941,7 +121606,7 @@ func (x *PatternFlowMplsLabel_Choice) String() string { func (*PatternFlowMplsLabel_Choice) ProtoMessage() {} func (x *PatternFlowMplsLabel_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1393] + mi := &file_otg_proto_msgTypes[1400] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120954,7 +121619,7 @@ func (x *PatternFlowMplsLabel_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowMplsLabel_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowMplsLabel_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{898, 0} + return file_otg_proto_rawDescGZIP(), []int{905, 0} } type PatternFlowMplsTrafficClass_Choice struct { @@ -120966,7 +121631,7 @@ type PatternFlowMplsTrafficClass_Choice struct { func (x *PatternFlowMplsTrafficClass_Choice) Reset() { *x = PatternFlowMplsTrafficClass_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1394] + mi := &file_otg_proto_msgTypes[1401] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120979,7 +121644,7 @@ func (x *PatternFlowMplsTrafficClass_Choice) String() string { func (*PatternFlowMplsTrafficClass_Choice) ProtoMessage() {} func (x *PatternFlowMplsTrafficClass_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1394] + mi := &file_otg_proto_msgTypes[1401] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120992,7 +121657,7 @@ func (x *PatternFlowMplsTrafficClass_Choice) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowMplsTrafficClass_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowMplsTrafficClass_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{901, 0} + return file_otg_proto_rawDescGZIP(), []int{908, 0} } type PatternFlowMplsBottomOfStack_Choice struct { @@ -121004,7 +121669,7 @@ type PatternFlowMplsBottomOfStack_Choice struct { func (x *PatternFlowMplsBottomOfStack_Choice) Reset() { *x = PatternFlowMplsBottomOfStack_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1395] + mi := &file_otg_proto_msgTypes[1402] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121017,7 +121682,7 @@ func (x *PatternFlowMplsBottomOfStack_Choice) String() string { func (*PatternFlowMplsBottomOfStack_Choice) ProtoMessage() {} func (x *PatternFlowMplsBottomOfStack_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1395] + mi := &file_otg_proto_msgTypes[1402] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121030,7 +121695,7 @@ func (x *PatternFlowMplsBottomOfStack_Choice) ProtoReflect() protoreflect.Messag // Deprecated: Use PatternFlowMplsBottomOfStack_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowMplsBottomOfStack_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{904, 0} + return file_otg_proto_rawDescGZIP(), []int{911, 0} } type PatternFlowMplsTimeToLive_Choice struct { @@ -121042,7 +121707,7 @@ type PatternFlowMplsTimeToLive_Choice struct { func (x *PatternFlowMplsTimeToLive_Choice) Reset() { *x = PatternFlowMplsTimeToLive_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1396] + mi := &file_otg_proto_msgTypes[1403] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121055,7 +121720,7 @@ func (x *PatternFlowMplsTimeToLive_Choice) String() string { func (*PatternFlowMplsTimeToLive_Choice) ProtoMessage() {} func (x *PatternFlowMplsTimeToLive_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1396] + mi := &file_otg_proto_msgTypes[1403] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121068,7 +121733,7 @@ func (x *PatternFlowMplsTimeToLive_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowMplsTimeToLive_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowMplsTimeToLive_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{907, 0} + return file_otg_proto_rawDescGZIP(), []int{914, 0} } type PatternFlowSnmpv2CVersion_Choice struct { @@ -121080,7 +121745,7 @@ type PatternFlowSnmpv2CVersion_Choice struct { func (x *PatternFlowSnmpv2CVersion_Choice) Reset() { *x = PatternFlowSnmpv2CVersion_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1397] + mi := &file_otg_proto_msgTypes[1404] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121093,7 +121758,7 @@ func (x *PatternFlowSnmpv2CVersion_Choice) String() string { func (*PatternFlowSnmpv2CVersion_Choice) ProtoMessage() {} func (x *PatternFlowSnmpv2CVersion_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1397] + mi := &file_otg_proto_msgTypes[1404] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121106,7 +121771,7 @@ func (x *PatternFlowSnmpv2CVersion_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowSnmpv2CVersion_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVersion_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{909, 0} + return file_otg_proto_rawDescGZIP(), []int{916, 0} } type PatternFlowSnmpv2CPDURequestId_Choice struct { @@ -121118,7 +121783,7 @@ type PatternFlowSnmpv2CPDURequestId_Choice struct { func (x *PatternFlowSnmpv2CPDURequestId_Choice) Reset() { *x = PatternFlowSnmpv2CPDURequestId_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1398] + mi := &file_otg_proto_msgTypes[1405] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121131,7 +121796,7 @@ func (x *PatternFlowSnmpv2CPDURequestId_Choice) String() string { func (*PatternFlowSnmpv2CPDURequestId_Choice) ProtoMessage() {} func (x *PatternFlowSnmpv2CPDURequestId_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1398] + mi := &file_otg_proto_msgTypes[1405] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121144,7 +121809,7 @@ func (x *PatternFlowSnmpv2CPDURequestId_Choice) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowSnmpv2CPDURequestId_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CPDURequestId_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{911, 0} + return file_otg_proto_rawDescGZIP(), []int{918, 0} } type PatternFlowSnmpv2CPDUErrorIndex_Choice struct { @@ -121156,7 +121821,7 @@ type PatternFlowSnmpv2CPDUErrorIndex_Choice struct { func (x *PatternFlowSnmpv2CPDUErrorIndex_Choice) Reset() { *x = PatternFlowSnmpv2CPDUErrorIndex_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1399] + mi := &file_otg_proto_msgTypes[1406] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121169,7 +121834,7 @@ func (x *PatternFlowSnmpv2CPDUErrorIndex_Choice) String() string { func (*PatternFlowSnmpv2CPDUErrorIndex_Choice) ProtoMessage() {} func (x *PatternFlowSnmpv2CPDUErrorIndex_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1399] + mi := &file_otg_proto_msgTypes[1406] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121182,7 +121847,7 @@ func (x *PatternFlowSnmpv2CPDUErrorIndex_Choice) ProtoReflect() protoreflect.Mes // Deprecated: Use PatternFlowSnmpv2CPDUErrorIndex_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CPDUErrorIndex_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{913, 0} + return file_otg_proto_rawDescGZIP(), []int{920, 0} } type PatternFlowSnmpv2CBulkPDURequestId_Choice struct { @@ -121194,7 +121859,7 @@ type PatternFlowSnmpv2CBulkPDURequestId_Choice struct { func (x *PatternFlowSnmpv2CBulkPDURequestId_Choice) Reset() { *x = PatternFlowSnmpv2CBulkPDURequestId_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1400] + mi := &file_otg_proto_msgTypes[1407] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121207,7 +121872,7 @@ func (x *PatternFlowSnmpv2CBulkPDURequestId_Choice) String() string { func (*PatternFlowSnmpv2CBulkPDURequestId_Choice) ProtoMessage() {} func (x *PatternFlowSnmpv2CBulkPDURequestId_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1400] + mi := &file_otg_proto_msgTypes[1407] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121220,7 +121885,7 @@ func (x *PatternFlowSnmpv2CBulkPDURequestId_Choice) ProtoReflect() protoreflect. // Deprecated: Use PatternFlowSnmpv2CBulkPDURequestId_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CBulkPDURequestId_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{915, 0} + return file_otg_proto_rawDescGZIP(), []int{922, 0} } type PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice struct { @@ -121232,7 +121897,7 @@ type PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice struct { func (x *PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice) Reset() { *x = PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1401] + mi := &file_otg_proto_msgTypes[1408] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121245,7 +121910,7 @@ func (x *PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice) String() string { func (*PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice) ProtoMessage() {} func (x *PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1401] + mi := &file_otg_proto_msgTypes[1408] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121258,7 +121923,7 @@ func (x *PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice) ProtoReflect() protorefle // Deprecated: Use PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{916, 0} + return file_otg_proto_rawDescGZIP(), []int{923, 0} } type PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice struct { @@ -121270,7 +121935,7 @@ type PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice struct { func (x *PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice) Reset() { *x = PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1402] + mi := &file_otg_proto_msgTypes[1409] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121283,7 +121948,7 @@ func (x *PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice) String() string { func (*PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice) ProtoMessage() {} func (x *PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1402] + mi := &file_otg_proto_msgTypes[1409] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121296,7 +121961,7 @@ func (x *PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice) ProtoReflect() protoref // Deprecated: Use PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{918, 0} + return file_otg_proto_rawDescGZIP(), []int{925, 0} } type PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice struct { @@ -121308,7 +121973,7 @@ type PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice struct { func (x *PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1403] + mi := &file_otg_proto_msgTypes[1410] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121321,7 +121986,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice) String() str func (*PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1403] + mi := &file_otg_proto_msgTypes[1410] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121334,7 +121999,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice) ProtoReflect // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{920, 0} + return file_otg_proto_rawDescGZIP(), []int{927, 0} } type PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice struct { @@ -121346,7 +122011,7 @@ type PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice struct { func (x *PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1404] + mi := &file_otg_proto_msgTypes[1411] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121359,7 +122024,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice) String() s func (*PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1404] + mi := &file_otg_proto_msgTypes[1411] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121372,7 +122037,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice) ProtoRefle // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{922, 0} + return file_otg_proto_rawDescGZIP(), []int{929, 0} } type PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice struct { @@ -121384,7 +122049,7 @@ type PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice struct { func (x *PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1405] + mi := &file_otg_proto_msgTypes[1412] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121397,7 +122062,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice) String() str func (*PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1405] + mi := &file_otg_proto_msgTypes[1412] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121410,7 +122075,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice) ProtoReflect // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{924, 0} + return file_otg_proto_rawDescGZIP(), []int{931, 0} } type PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice struct { @@ -121422,7 +122087,7 @@ type PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice struct { func (x *PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1406] + mi := &file_otg_proto_msgTypes[1413] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121435,7 +122100,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice) String() s func (*PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1406] + mi := &file_otg_proto_msgTypes[1413] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121448,7 +122113,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice) ProtoRefle // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{926, 0} + return file_otg_proto_rawDescGZIP(), []int{933, 0} } type PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice struct { @@ -121460,7 +122125,7 @@ type PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice struct { func (x *PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1407] + mi := &file_otg_proto_msgTypes[1414] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121473,7 +122138,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice) String() func (*PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1407] + mi := &file_otg_proto_msgTypes[1414] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121486,7 +122151,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice) ProtoRefl // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{928, 0} + return file_otg_proto_rawDescGZIP(), []int{935, 0} } type PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice struct { @@ -121498,7 +122163,7 @@ type PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice struct { func (x *PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice) Reset() { *x = PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1408] + mi := &file_otg_proto_msgTypes[1415] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121511,7 +122176,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice) Stri func (*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice) ProtoMessage() {} func (x *PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1408] + mi := &file_otg_proto_msgTypes[1415] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121524,7 +122189,7 @@ func (x *PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice) Prot // Deprecated: Use PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{930, 0} + return file_otg_proto_rawDescGZIP(), []int{937, 0} } type PatternFlowSnmpv2CCommonRequestId_Choice struct { @@ -121536,7 +122201,7 @@ type PatternFlowSnmpv2CCommonRequestId_Choice struct { func (x *PatternFlowSnmpv2CCommonRequestId_Choice) Reset() { *x = PatternFlowSnmpv2CCommonRequestId_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1409] + mi := &file_otg_proto_msgTypes[1416] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121549,7 +122214,7 @@ func (x *PatternFlowSnmpv2CCommonRequestId_Choice) String() string { func (*PatternFlowSnmpv2CCommonRequestId_Choice) ProtoMessage() {} func (x *PatternFlowSnmpv2CCommonRequestId_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1409] + mi := &file_otg_proto_msgTypes[1416] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121562,7 +122227,7 @@ func (x *PatternFlowSnmpv2CCommonRequestId_Choice) ProtoReflect() protoreflect.M // Deprecated: Use PatternFlowSnmpv2CCommonRequestId_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowSnmpv2CCommonRequestId_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{932, 0} + return file_otg_proto_rawDescGZIP(), []int{939, 0} } type PatternFlowRsvpRsvpChecksum_Choice struct { @@ -121574,7 +122239,7 @@ type PatternFlowRsvpRsvpChecksum_Choice struct { func (x *PatternFlowRsvpRsvpChecksum_Choice) Reset() { *x = PatternFlowRsvpRsvpChecksum_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1410] + mi := &file_otg_proto_msgTypes[1417] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121587,7 +122252,7 @@ func (x *PatternFlowRsvpRsvpChecksum_Choice) String() string { func (*PatternFlowRsvpRsvpChecksum_Choice) ProtoMessage() {} func (x *PatternFlowRsvpRsvpChecksum_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1410] + mi := &file_otg_proto_msgTypes[1417] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121600,7 +122265,7 @@ func (x *PatternFlowRsvpRsvpChecksum_Choice) ProtoReflect() protoreflect.Message // Deprecated: Use PatternFlowRsvpRsvpChecksum_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRsvpRsvpChecksum_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{933, 0} + return file_otg_proto_rawDescGZIP(), []int{940, 0} } type PatternFlowRsvpRsvpChecksum_Generated struct { @@ -121612,7 +122277,7 @@ type PatternFlowRsvpRsvpChecksum_Generated struct { func (x *PatternFlowRsvpRsvpChecksum_Generated) Reset() { *x = PatternFlowRsvpRsvpChecksum_Generated{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1411] + mi := &file_otg_proto_msgTypes[1418] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121625,7 +122290,7 @@ func (x *PatternFlowRsvpRsvpChecksum_Generated) String() string { func (*PatternFlowRsvpRsvpChecksum_Generated) ProtoMessage() {} func (x *PatternFlowRsvpRsvpChecksum_Generated) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1411] + mi := &file_otg_proto_msgTypes[1418] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121638,7 +122303,7 @@ func (x *PatternFlowRsvpRsvpChecksum_Generated) ProtoReflect() protoreflect.Mess // Deprecated: Use PatternFlowRsvpRsvpChecksum_Generated.ProtoReflect.Descriptor instead. func (*PatternFlowRsvpRsvpChecksum_Generated) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{933, 1} + return file_otg_proto_rawDescGZIP(), []int{940, 1} } type PatternFlowRsvpTimeToLive_Choice struct { @@ -121650,7 +122315,7 @@ type PatternFlowRsvpTimeToLive_Choice struct { func (x *PatternFlowRsvpTimeToLive_Choice) Reset() { *x = PatternFlowRsvpTimeToLive_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1412] + mi := &file_otg_proto_msgTypes[1419] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121663,7 +122328,7 @@ func (x *PatternFlowRsvpTimeToLive_Choice) String() string { func (*PatternFlowRsvpTimeToLive_Choice) ProtoMessage() {} func (x *PatternFlowRsvpTimeToLive_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1412] + mi := &file_otg_proto_msgTypes[1419] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121676,7 +122341,7 @@ func (x *PatternFlowRsvpTimeToLive_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowRsvpTimeToLive_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRsvpTimeToLive_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{935, 0} + return file_otg_proto_rawDescGZIP(), []int{942, 0} } type PatternFlowRsvpReserved_Choice struct { @@ -121688,7 +122353,7 @@ type PatternFlowRsvpReserved_Choice struct { func (x *PatternFlowRsvpReserved_Choice) Reset() { *x = PatternFlowRsvpReserved_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1413] + mi := &file_otg_proto_msgTypes[1420] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121701,7 +122366,7 @@ func (x *PatternFlowRsvpReserved_Choice) String() string { func (*PatternFlowRsvpReserved_Choice) ProtoMessage() {} func (x *PatternFlowRsvpReserved_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1413] + mi := &file_otg_proto_msgTypes[1420] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121714,7 +122379,7 @@ func (x *PatternFlowRsvpReserved_Choice) ProtoReflect() protoreflect.Message { // Deprecated: Use PatternFlowRsvpReserved_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRsvpReserved_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{937, 0} + return file_otg_proto_rawDescGZIP(), []int{944, 0} } type PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice struct { @@ -121726,7 +122391,7 @@ type PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice str func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice) Reset() { *x = PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1414] + mi := &file_otg_proto_msgTypes[1421] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121739,7 +122404,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice func (*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1414] + mi := &file_otg_proto_msgTypes[1421] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121752,7 +122417,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice // Deprecated: Use PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{939, 0} + return file_otg_proto_rawDescGZIP(), []int{946, 0} } type PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice struct { @@ -121764,7 +122429,7 @@ type PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice struct { func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice) Reset() { *x = PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1415] + mi := &file_otg_proto_msgTypes[1422] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121777,7 +122442,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice) String() string func (*PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1415] + mi := &file_otg_proto_msgTypes[1422] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121790,7 +122455,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice) ProtoReflect() // Deprecated: Use PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{941, 0} + return file_otg_proto_rawDescGZIP(), []int{948, 0} } type PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice struct { @@ -121802,7 +122467,7 @@ type PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice struct { func (x *PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice) Reset() { *x = PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1416] + mi := &file_otg_proto_msgTypes[1423] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121815,7 +122480,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice) String() string func (*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1416] + mi := &file_otg_proto_msgTypes[1423] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121828,7 +122493,7 @@ func (x *PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice) ProtoReflect() // Deprecated: Use PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{943, 0} + return file_otg_proto_rawDescGZIP(), []int{950, 0} } type PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice struct { @@ -121840,7 +122505,7 @@ type PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice struct { func (x *PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice) Reset() { *x = PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1417] + mi := &file_otg_proto_msgTypes[1424] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121853,7 +122518,7 @@ func (x *PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice) String() string func (*PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1417] + mi := &file_otg_proto_msgTypes[1424] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121866,7 +122531,7 @@ func (x *PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice) ProtoReflect() p // Deprecated: Use PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{945, 0} + return file_otg_proto_rawDescGZIP(), []int{952, 0} } type PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice struct { @@ -121878,7 +122543,7 @@ type PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice struct { func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice) Reset() { *x = PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1418] + mi := &file_otg_proto_msgTypes[1425] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121891,7 +122556,7 @@ func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice) String() string { func (*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1418] + mi := &file_otg_proto_msgTypes[1425] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121904,7 +122569,7 @@ func (x *PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice) ProtoReflect() prot // Deprecated: Use PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{947, 0} + return file_otg_proto_rawDescGZIP(), []int{954, 0} } type PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice struct { @@ -121916,7 +122581,7 @@ type PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice struct { func (x *PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice) Reset() { *x = PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1419] + mi := &file_otg_proto_msgTypes[1426] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121929,7 +122594,7 @@ func (x *PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice) String() string { func (*PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1419] + mi := &file_otg_proto_msgTypes[1426] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121942,7 +122607,7 @@ func (x *PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice) ProtoReflect() protor // Deprecated: Use PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{949, 0} + return file_otg_proto_rawDescGZIP(), []int{956, 0} } type PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice struct { @@ -121954,7 +122619,7 @@ type PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice struct { func (x *PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice) Reset() { *x = PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1420] + mi := &file_otg_proto_msgTypes[1427] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121967,7 +122632,7 @@ func (x *PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice) String() s func (*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1420] + mi := &file_otg_proto_msgTypes[1427] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -121980,7 +122645,7 @@ func (x *PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice) ProtoRefle // Deprecated: Use PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{951, 0} + return file_otg_proto_rawDescGZIP(), []int{958, 0} } type PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice struct { @@ -121992,7 +122657,7 @@ type PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice struct { func (x *PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice) Reset() { *x = PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1421] + mi := &file_otg_proto_msgTypes[1428] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122005,7 +122670,7 @@ func (x *PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice) String() strin func (*PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1421] + mi := &file_otg_proto_msgTypes[1428] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122018,7 +122683,7 @@ func (x *PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice) ProtoReflect() // Deprecated: Use PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{953, 0} + return file_otg_proto_rawDescGZIP(), []int{960, 0} } type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice struct { @@ -122030,7 +122695,7 @@ type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice struct { func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice) Reset() { *x = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1422] + mi := &file_otg_proto_msgTypes[1429] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122043,7 +122708,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice) String() st func (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1422] + mi := &file_otg_proto_msgTypes[1429] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122056,7 +122721,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice) ProtoReflec // Deprecated: Use PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{955, 0} + return file_otg_proto_rawDescGZIP(), []int{962, 0} } type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice struct { @@ -122068,7 +122733,7 @@ type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice struct { func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice) Reset() { *x = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1423] + mi := &file_otg_proto_msgTypes[1430] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122081,7 +122746,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice) Stri func (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1423] + mi := &file_otg_proto_msgTypes[1430] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122094,7 +122759,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice) Prot // Deprecated: Use PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{957, 0} + return file_otg_proto_rawDescGZIP(), []int{964, 0} } type PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice struct { @@ -122106,7 +122771,7 @@ type PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice struct { func (x *PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice) Reset() { *x = PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1424] + mi := &file_otg_proto_msgTypes[1431] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122119,7 +122784,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice) String() stri func (*PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1424] + mi := &file_otg_proto_msgTypes[1431] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122132,7 +122797,7 @@ func (x *PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice) ProtoReflect( // Deprecated: Use PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{959, 0} + return file_otg_proto_rawDescGZIP(), []int{966, 0} } type PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice struct { @@ -122144,7 +122809,7 @@ type PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice struct { func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice) Reset() { *x = PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1425] + mi := &file_otg_proto_msgTypes[1432] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122157,7 +122822,7 @@ func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice) String func (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1425] + mi := &file_otg_proto_msgTypes[1432] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122170,7 +122835,7 @@ func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice) ProtoR // Deprecated: Use PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{961, 0} + return file_otg_proto_rawDescGZIP(), []int{968, 0} } type PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice struct { @@ -122182,7 +122847,7 @@ type PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice struct { func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice) Reset() { *x = PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1426] + mi := &file_otg_proto_msgTypes[1433] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122195,7 +122860,7 @@ func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice) String() func (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1426] + mi := &file_otg_proto_msgTypes[1433] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122208,7 +122873,7 @@ func (x *PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice) ProtoRefl // Deprecated: Use PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{963, 0} + return file_otg_proto_rawDescGZIP(), []int{970, 0} } type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice struct { @@ -122220,7 +122885,7 @@ type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choic func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice) Reset() { *x = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1427] + mi := &file_otg_proto_msgTypes[1434] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122233,7 +122898,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_C func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1427] + mi := &file_otg_proto_msgTypes[1434] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122246,7 +122911,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_C // Deprecated: Use PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{965, 0} + return file_otg_proto_rawDescGZIP(), []int{972, 0} } type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice struct { @@ -122258,7 +122923,7 @@ type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice struct { func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice) Reset() { *x = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1428] + mi := &file_otg_proto_msgTypes[1435] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122271,7 +122936,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice) String() func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1428] + mi := &file_otg_proto_msgTypes[1435] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122284,7 +122949,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice) ProtoRef // Deprecated: Use PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{967, 0} + return file_otg_proto_rawDescGZIP(), []int{974, 0} } type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice struct { @@ -122296,7 +122961,7 @@ type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice struct { func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice) Reset() { *x = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1429] + mi := &file_otg_proto_msgTypes[1436] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122309,7 +122974,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice) String() st func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1429] + mi := &file_otg_proto_msgTypes[1436] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122322,7 +122987,7 @@ func (x *PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice) ProtoReflec // Deprecated: Use PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{969, 0} + return file_otg_proto_rawDescGZIP(), []int{976, 0} } type PatternFlowRSVPPathSenderTspecIntServVersion_Choice struct { @@ -122334,7 +122999,7 @@ type PatternFlowRSVPPathSenderTspecIntServVersion_Choice struct { func (x *PatternFlowRSVPPathSenderTspecIntServVersion_Choice) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServVersion_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1430] + mi := &file_otg_proto_msgTypes[1437] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122347,7 +123012,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServVersion_Choice) String() string { func (*PatternFlowRSVPPathSenderTspecIntServVersion_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServVersion_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1430] + mi := &file_otg_proto_msgTypes[1437] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122360,7 +123025,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServVersion_Choice) ProtoReflect() pro // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServVersion_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServVersion_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{971, 0} + return file_otg_proto_rawDescGZIP(), []int{978, 0} } type PatternFlowRSVPPathSenderTspecIntServReserved1_Choice struct { @@ -122372,7 +123037,7 @@ type PatternFlowRSVPPathSenderTspecIntServReserved1_Choice struct { func (x *PatternFlowRSVPPathSenderTspecIntServReserved1_Choice) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServReserved1_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1431] + mi := &file_otg_proto_msgTypes[1438] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122385,7 +123050,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServReserved1_Choice) String() string func (*PatternFlowRSVPPathSenderTspecIntServReserved1_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServReserved1_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1431] + mi := &file_otg_proto_msgTypes[1438] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122398,7 +123063,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServReserved1_Choice) ProtoReflect() p // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServReserved1_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServReserved1_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{973, 0} + return file_otg_proto_rawDescGZIP(), []int{980, 0} } type PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice struct { @@ -122410,7 +123075,7 @@ type PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice struct { func (x *PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1432] + mi := &file_otg_proto_msgTypes[1439] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122423,7 +123088,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice) String() str func (*PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1432] + mi := &file_otg_proto_msgTypes[1439] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122436,7 +123101,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice) ProtoReflect // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{975, 0} + return file_otg_proto_rawDescGZIP(), []int{982, 0} } type PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice struct { @@ -122448,7 +123113,7 @@ type PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice struct { func (x *PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1433] + mi := &file_otg_proto_msgTypes[1440] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122461,7 +123126,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice) String() str func (*PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1433] + mi := &file_otg_proto_msgTypes[1440] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122474,7 +123139,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice) ProtoReflect // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{977, 0} + return file_otg_proto_rawDescGZIP(), []int{984, 0} } type PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice struct { @@ -122486,7 +123151,7 @@ type PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice struct { func (x *PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1434] + mi := &file_otg_proto_msgTypes[1441] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122499,7 +123164,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice) String() string { func (*PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1434] + mi := &file_otg_proto_msgTypes[1441] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122512,7 +123177,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice) ProtoReflect() pro // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{979, 0} + return file_otg_proto_rawDescGZIP(), []int{986, 0} } type PatternFlowRSVPPathSenderTspecIntServReserved2_Choice struct { @@ -122524,7 +123189,7 @@ type PatternFlowRSVPPathSenderTspecIntServReserved2_Choice struct { func (x *PatternFlowRSVPPathSenderTspecIntServReserved2_Choice) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServReserved2_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1435] + mi := &file_otg_proto_msgTypes[1442] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122537,7 +123202,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServReserved2_Choice) String() string func (*PatternFlowRSVPPathSenderTspecIntServReserved2_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServReserved2_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1435] + mi := &file_otg_proto_msgTypes[1442] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122550,7 +123215,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServReserved2_Choice) ProtoReflect() p // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServReserved2_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServReserved2_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{981, 0} + return file_otg_proto_rawDescGZIP(), []int{988, 0} } type PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice struct { @@ -122562,7 +123227,7 @@ type PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice struct { func (x *PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1436] + mi := &file_otg_proto_msgTypes[1443] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122575,7 +123240,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice) String func (*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1436] + mi := &file_otg_proto_msgTypes[1443] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122588,7 +123253,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice) ProtoR // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{983, 0} + return file_otg_proto_rawDescGZIP(), []int{990, 0} } type PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice struct { @@ -122600,7 +123265,7 @@ type PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice str func (x *PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1437] + mi := &file_otg_proto_msgTypes[1444] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122613,7 +123278,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice func (*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1437] + mi := &file_otg_proto_msgTypes[1444] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122626,7 +123291,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{985, 0} + return file_otg_proto_rawDescGZIP(), []int{992, 0} } type PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice struct { @@ -122638,7 +123303,7 @@ type PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice struct { func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1438] + mi := &file_otg_proto_msgTypes[1445] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122651,7 +123316,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice) String() func (*PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1438] + mi := &file_otg_proto_msgTypes[1445] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122664,7 +123329,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice) ProtoRefl // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{987, 0} + return file_otg_proto_rawDescGZIP(), []int{994, 0} } type PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice struct { @@ -122676,7 +123341,7 @@ type PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice struct { func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1439] + mi := &file_otg_proto_msgTypes[1446] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122689,7 +123354,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice) String( func (*PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1439] + mi := &file_otg_proto_msgTypes[1446] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122702,7 +123367,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice) ProtoRe // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{989, 0} + return file_otg_proto_rawDescGZIP(), []int{996, 0} } type PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice struct { @@ -122714,7 +123379,7 @@ type PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice struct { func (x *PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1440] + mi := &file_otg_proto_msgTypes[1447] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122727,7 +123392,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice) String( func (*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1440] + mi := &file_otg_proto_msgTypes[1447] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122740,7 +123405,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice) ProtoRe // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{991, 0} + return file_otg_proto_rawDescGZIP(), []int{998, 0} } type PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice struct { @@ -122752,7 +123417,7 @@ type PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice struct { func (x *PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice) Reset() { *x = PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1441] + mi := &file_otg_proto_msgTypes[1448] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122765,7 +123430,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice) String() func (*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1441] + mi := &file_otg_proto_msgTypes[1448] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122778,7 +123443,7 @@ func (x *PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice) ProtoRef // Deprecated: Use PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{993, 0} + return file_otg_proto_rawDescGZIP(), []int{1000, 0} } type PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice struct { @@ -122790,7 +123455,7 @@ type PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice struct { func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice) Reset() { *x = PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1442] + mi := &file_otg_proto_msgTypes[1449] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122803,7 +123468,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice) Strin func (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1442] + mi := &file_otg_proto_msgTypes[1449] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122816,7 +123481,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice) Proto // Deprecated: Use PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{995, 0} + return file_otg_proto_rawDescGZIP(), []int{1002, 0} } type PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice struct { @@ -122828,7 +123493,7 @@ type PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice struct { func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice) Reset() { *x = PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1443] + mi := &file_otg_proto_msgTypes[1450] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122841,7 +123506,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice) Stri func (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1443] + mi := &file_otg_proto_msgTypes[1450] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122854,7 +123519,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice) Prot // Deprecated: Use PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{997, 0} + return file_otg_proto_rawDescGZIP(), []int{1004, 0} } type PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice struct { @@ -122866,7 +123531,7 @@ type PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice struct { func (x *PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice) Reset() { *x = PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1444] + mi := &file_otg_proto_msgTypes[1451] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122879,7 +123544,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice) String() string { func (*PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1444] + mi := &file_otg_proto_msgTypes[1451] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122892,7 +123557,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice) ProtoReflect() pr // Deprecated: Use PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{998, 0} + return file_otg_proto_rawDescGZIP(), []int{1005, 0} } type PatternFlowRSVPPathRecordRouteType1LabelCType_Choice struct { @@ -122904,7 +123569,7 @@ type PatternFlowRSVPPathRecordRouteType1LabelCType_Choice struct { func (x *PatternFlowRSVPPathRecordRouteType1LabelCType_Choice) Reset() { *x = PatternFlowRSVPPathRecordRouteType1LabelCType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1445] + mi := &file_otg_proto_msgTypes[1452] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122917,7 +123582,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1LabelCType_Choice) String() string { func (*PatternFlowRSVPPathRecordRouteType1LabelCType_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathRecordRouteType1LabelCType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1445] + mi := &file_otg_proto_msgTypes[1452] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122930,7 +123595,7 @@ func (x *PatternFlowRSVPPathRecordRouteType1LabelCType_Choice) ProtoReflect() pr // Deprecated: Use PatternFlowRSVPPathRecordRouteType1LabelCType_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathRecordRouteType1LabelCType_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{999, 0} + return file_otg_proto_rawDescGZIP(), []int{1006, 0} } type PatternFlowRSVPPathObjectsCustomType_Choice struct { @@ -122942,7 +123607,7 @@ type PatternFlowRSVPPathObjectsCustomType_Choice struct { func (x *PatternFlowRSVPPathObjectsCustomType_Choice) Reset() { *x = PatternFlowRSVPPathObjectsCustomType_Choice{} if protoimpl.UnsafeEnabled { - mi := &file_otg_proto_msgTypes[1446] + mi := &file_otg_proto_msgTypes[1453] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -122955,7 +123620,7 @@ func (x *PatternFlowRSVPPathObjectsCustomType_Choice) String() string { func (*PatternFlowRSVPPathObjectsCustomType_Choice) ProtoMessage() {} func (x *PatternFlowRSVPPathObjectsCustomType_Choice) ProtoReflect() protoreflect.Message { - mi := &file_otg_proto_msgTypes[1446] + mi := &file_otg_proto_msgTypes[1453] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -122968,7 +123633,7 @@ func (x *PatternFlowRSVPPathObjectsCustomType_Choice) ProtoReflect() protoreflec // Deprecated: Use PatternFlowRSVPPathObjectsCustomType_Choice.ProtoReflect.Descriptor instead. func (*PatternFlowRSVPPathObjectsCustomType_Choice) Descriptor() ([]byte, []int) { - return file_otg_proto_rawDescGZIP(), []int{1001, 0} + return file_otg_proto_rawDescGZIP(), []int{1008, 0} } var File_otg_proto protoreflect.FileDescriptor @@ -134167,245 +134832,661 @@ var file_otg_proto_rawDesc = []byte{ 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x22, 0xe6, 0x03, 0x0a, 0x12, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x70, 0x76, 0x34, 0x53, 0x72, 0x63, 0x12, 0x40, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x53, 0x72, - 0x63, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3c, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x68, 0x22, 0x9f, 0x01, 0x0a, 0x18, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x70, 0x76, 0x34, 0x53, 0x72, 0x63, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x12, 0x15, + 0x0a, 0x03, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x6d, + 0x69, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x01, 0x52, 0x03, 0x6d, 0x61, 0x78, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, + 0x73, 0x65, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x04, 0x73, 0x65, + 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, + 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x6d, 0x69, 0x6e, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x6d, 0x61, 0x78, + 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x65, 0x65, 0x64, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0xa9, 0x04, 0x0a, 0x12, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x53, 0x72, 0x63, 0x12, 0x40, 0x0a, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, + 0x53, 0x72, 0x63, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, + 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x3c, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3c, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x70, 0x76, 0x34, 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x0b, 0x6d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x70, 0x76, 0x34, 0x53, 0x72, 0x63, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x12, 0x25, 0x0a, 0x04, - 0x61, 0x75, 0x74, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x41, 0x75, 0x74, 0x6f, 0x52, 0x04, 0x61, - 0x75, 0x74, 0x6f, 0x1a, 0x60, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x56, 0x0a, - 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, - 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x08, 0x0a, - 0x04, 0x61, 0x75, 0x74, 0x6f, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x19, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, - 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8f, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe6, 0x03, 0x0a, 0x12, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x74, 0x12, 0x40, 0x0a, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x70, 0x76, 0x34, 0x44, 0x73, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x12, 0x3c, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x74, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x3c, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, - 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x73, 0x12, 0x25, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x11, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x41, 0x75, - 0x74, 0x6f, 0x52, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x1a, 0x60, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x22, 0x56, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x0b, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x53, 0x72, 0x63, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, + 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x12, 0x25, + 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x41, 0x75, 0x74, 0x6f, 0x52, + 0x04, 0x61, 0x75, 0x74, 0x6f, 0x12, 0x35, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x53, 0x72, 0x63, 0x52, 0x61, + 0x6e, 0x64, 0x6f, 0x6d, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x1a, 0x6c, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x62, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x12, 0x08, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x10, 0x01, 0x12, 0x0a, + 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x10, 0x06, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x9f, 0x01, 0x0a, 0x31, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, - 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x70, 0x69, 0x65, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, - 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0xd2, 0x03, 0x0a, 0x2a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, - 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x70, 0x69, 0x65, 0x64, 0x46, 0x6c, 0x61, 0x67, - 0x12, 0x58, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x3b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, - 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x70, 0x69, 0x65, 0x64, 0x46, 0x6c, 0x61, - 0x67, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x54, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x36, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, - 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x70, 0x69, 0x65, 0x64, 0x46, 0x6c, 0x61, - 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x54, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x70, - 0x69, 0x65, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa0, 0x01, 0x0a, 0x32, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, + 0x87, 0x01, 0x0a, 0x19, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x70, 0x76, 0x34, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xd6, 0x03, 0x0a, 0x2b, 0x50, 0x61, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8f, 0x01, 0x0a, 0x1b, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x74, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x9f, 0x01, 0x0a, 0x18, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, + 0x73, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x12, 0x15, 0x0a, 0x03, 0x6d, 0x69, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x6d, 0x69, 0x6e, 0x88, 0x01, 0x01, 0x12, + 0x15, 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x03, + 0x6d, 0x61, 0x78, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x65, 0x65, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x04, 0x73, 0x65, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x03, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x6d, + 0x69, 0x6e, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x6d, 0x61, 0x78, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, + 0x65, 0x65, 0x64, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa9, 0x04, + 0x0a, 0x12, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, + 0x34, 0x44, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x74, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3c, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, + 0x76, 0x34, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, + 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, + 0x44, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x12, 0x25, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x70, 0x76, 0x34, 0x41, 0x75, 0x74, 0x6f, 0x52, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x12, + 0x35, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x52, 0x06, + 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x1a, 0x6c, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x22, 0x62, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, + 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, + 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, + 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x12, 0x08, + 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x64, + 0x6f, 0x6d, 0x10, 0x06, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9f, 0x01, 0x0a, 0x31, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x59, 0x0a, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, + 0x70, 0x69, 0x65, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, + 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, + 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xd2, 0x03, 0x0a, 0x2a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x43, 0x6f, 0x70, 0x69, 0x65, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x58, 0x0a, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, + 0x65, 0x43, 0x6f, 0x70, 0x69, 0x65, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x55, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x6f, 0x74, 0x67, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x54, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, - 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x55, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x37, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x65, 0x43, 0x6f, 0x70, 0x69, 0x65, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x54, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x36, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, + 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x70, 0x69, 0x65, 0x64, 0x46, 0x6c, 0x61, + 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, + 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, + 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, + 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, + 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0xa0, 0x01, 0x0a, 0x32, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0xd6, 0x03, 0x0a, 0x2b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, - 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, - 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0xa1, 0x01, 0x0a, 0x33, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, - 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xda, 0x03, 0x0a, 0x2c, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x61, 0x73, 0x73, 0x12, 0x59, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x3c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x43, 0x6c, 0x61, 0x73, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x55, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, - 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x5a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x56, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, - 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x56, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x38, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x55, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, + 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, + 0x70, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, + 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, + 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa1, 0x01, 0x0a, + 0x33, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, + 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, + 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, + 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0xda, 0x03, 0x0a, 0x2c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x12, 0x5a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x3d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, + 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x12, 0x56, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x56, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, + 0x34, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, + 0x70, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, + 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, + 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, + 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8f, 0x01, + 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, + 0x34, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x61, 0x77, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, + 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, + 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0x97, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x70, 0x76, 0x34, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x61, 0x77, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xdd, 0x03, 0x0a, 0x1a, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x69, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x61, 0x77, 0x12, 0x48, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, + 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x61, 0x77, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, + 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x61, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x61, 0x77, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x49, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, + 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x69, 0x6f, + 0x72, 0x69, 0x74, 0x79, 0x52, 0x61, 0x77, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, + 0x70, 0x50, 0x68, 0x62, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, 0x50, + 0x68, 0x62, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, + 0x0a, 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, + 0x34, 0x44, 0x73, 0x63, 0x70, 0x50, 0x68, 0x62, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, + 0x63, 0x70, 0x50, 0x68, 0x62, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, 0x50, 0x68, + 0x62, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, + 0x50, 0x68, 0x62, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, + 0x44, 0x73, 0x63, 0x70, 0x50, 0x68, 0x62, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, + 0x70, 0x45, 0x63, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, 0x45, + 0x63, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, + 0x0a, 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, + 0x34, 0x44, 0x73, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, + 0x63, 0x70, 0x45, 0x63, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, 0x45, 0x63, + 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, + 0x45, 0x63, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, + 0x44, 0x73, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x23, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, + 0x50, 0x72, 0x65, 0x63, 0x65, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, + 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, 0x01, + 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, + 0x34, 0x54, 0x6f, 0x73, 0x50, 0x72, 0x65, 0x63, 0x65, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe7, 0x03, 0x0a, 0x1c, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, + 0x50, 0x72, 0x65, 0x63, 0x65, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x4a, 0x0a, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, + 0x54, 0x6f, 0x73, 0x50, 0x72, 0x65, 0x63, 0x65, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, + 0x76, 0x34, 0x54, 0x6f, 0x73, 0x50, 0x72, 0x65, 0x63, 0x65, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x50, 0x72, 0x65, + 0x63, 0x65, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x50, 0x72, 0x65, 0x63, 0x65, 0x64, 0x65, 0x6e, 0x63, + 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x8f, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, - 0x61, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x97, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, - 0x79, 0x52, 0x61, 0x77, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, - 0xdd, 0x03, 0x0a, 0x1a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x70, 0x76, 0x34, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x61, 0x77, 0x12, 0x48, - 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, + 0x6c, 0x75, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xce, 0x03, 0x0a, 0x17, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, + 0x44, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x44, 0x65, + 0x6c, 0x61, 0x79, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, + 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x44, 0x65, 0x6c, 0x61, 0x79, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x44, 0x65, + 0x6c, 0x61, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, + 0x54, 0x6f, 0x73, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, + 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, + 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, + 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x23, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, + 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x70, 0x75, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, + 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, + 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, + 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, + 0x76, 0x34, 0x54, 0x6f, 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x70, 0x75, 0x74, 0x4d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, + 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, + 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe7, 0x03, 0x0a, 0x1c, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, + 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x70, 0x75, 0x74, 0x12, 0x4a, 0x0a, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, + 0x34, 0x54, 0x6f, 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x70, 0x75, 0x74, 0x2e, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x70, 0x75, 0x74, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x54, 0x68, + 0x72, 0x6f, 0x75, 0x67, 0x68, 0x70, 0x75, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x70, + 0x75, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, + 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, + 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, + 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, + 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x52, 0x65, 0x6c, 0x69, 0x61, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x26, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, + 0x52, 0x65, 0x6c, 0x69, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xec, 0x03, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x52, 0x65, 0x6c, + 0x69, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x4b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, + 0x73, 0x52, 0x65, 0x6c, 0x69, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x2e, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, + 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x47, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, + 0x34, 0x54, 0x6f, 0x73, 0x52, 0x65, 0x6c, 0x69, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x47, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x52, 0x65, 0x6c, + 0x69, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x52, 0x65, 0x6c, 0x69, 0x61, 0x62, 0x69, 0x6c, + 0x69, 0x74, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, + 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, + 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8f, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x4d, 0x6f, 0x6e, 0x65, + 0x74, 0x61, 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x97, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x4d, 0x6f, + 0x6e, 0x65, 0x74, 0x61, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, + 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, + 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x22, 0xdd, 0x03, 0x0a, 0x1a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x4d, 0x6f, 0x6e, 0x65, 0x74, 0x61, 0x72, 0x79, + 0x12, 0x48, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x4d, 0x6f, 0x6e, 0x65, 0x74, 0x61, 0x72, + 0x79, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x44, 0x0a, + 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x4d, 0x6f, 0x6e, 0x65, 0x74, 0x61, 0x72, + 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x4d, + 0x6f, 0x6e, 0x65, 0x74, 0x61, 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x61, 0x77, 0x2e, - 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, + 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x4d, 0x6f, 0x6e, 0x65, 0x74, 0x61, 0x72, 0x79, 0x4d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, + 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, + 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x22, 0x8d, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, + 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x22, 0x95, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xd3, 0x03, 0x0a, 0x18, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, + 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x12, 0x46, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x55, + 0x6e, 0x75, 0x73, 0x65, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x42, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x55, 0x6e, 0x75, + 0x73, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, + 0x73, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x61, 0x77, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x44, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, - 0x74, 0x79, 0x52, 0x61, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, - 0x76, 0x34, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x52, 0x61, 0x77, 0x4d, 0x65, 0x74, + 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, @@ -134415,7 +135496,7 @@ var file_otg_proto_rawDesc = []byte{ 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, 0x50, 0x68, 0x62, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x70, 0x76, 0x36, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, @@ -134424,7 +135505,7 @@ var file_otg_proto_rawDesc = []byte{ 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, - 0x34, 0x44, 0x73, 0x63, 0x70, 0x50, 0x68, 0x62, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x36, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, @@ -134433,1760 +135514,85 @@ var file_otg_proto_rawDesc = []byte{ 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, 0x50, 0x68, 0x62, 0x12, 0x44, + 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, 0x50, 0x68, 0x62, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x49, 0x70, 0x76, 0x36, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, - 0x44, 0x73, 0x63, 0x70, 0x50, 0x68, 0x62, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, - 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, 0x50, 0x68, 0x62, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, 0x50, 0x68, 0x62, 0x4d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, - 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, - 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, - 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, - 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, - 0x34, 0x44, 0x73, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x12, 0x44, - 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, - 0x44, 0x73, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, - 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x44, 0x73, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, - 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, - 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x91, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x50, 0x72, 0x65, 0x63, 0x65, 0x64, 0x65, 0x6e, 0x63, 0x65, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, - 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x50, 0x72, 0x65, 0x63, 0x65, 0x64, - 0x65, 0x6e, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, - 0xe7, 0x03, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x50, 0x72, 0x65, 0x63, 0x65, 0x64, 0x65, 0x6e, 0x63, 0x65, - 0x12, 0x4a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x50, 0x72, 0x65, 0x63, 0x65, 0x64, 0x65, - 0x6e, 0x63, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, - 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, - 0x46, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x50, 0x72, 0x65, 0x63, 0x65, - 0x64, 0x65, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, - 0x54, 0x6f, 0x73, 0x50, 0x72, 0x65, 0x63, 0x65, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x4b, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x50, 0x72, 0x65, - 0x63, 0x65, 0x64, 0x65, 0x6e, 0x63, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, - 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, - 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, - 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, - 0x44, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x44, - 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, - 0xce, 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x12, 0x45, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, - 0x34, 0x54, 0x6f, 0x73, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, - 0x73, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, - 0x34, 0x54, 0x6f, 0x73, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x4d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, - 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, - 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, - 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x91, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x70, 0x75, - 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, - 0x67, 0x68, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, - 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x22, 0xe7, 0x03, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x70, 0x75, - 0x74, 0x12, 0x4a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, - 0x68, 0x70, 0x75, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x12, 0x46, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x54, 0x68, 0x72, 0x6f, - 0x75, 0x67, 0x68, 0x70, 0x75, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, - 0x34, 0x54, 0x6f, 0x73, 0x54, 0x68, 0x72, 0x6f, 0x75, 0x67, 0x68, 0x70, 0x75, 0x74, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x4b, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, - 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x54, 0x68, - 0x72, 0x6f, 0x75, 0x67, 0x68, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, - 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, - 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, - 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x24, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, - 0x73, 0x52, 0x65, 0x6c, 0x69, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, - 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, - 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, - 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, - 0x9a, 0x01, 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x52, 0x65, 0x6c, 0x69, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, - 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, - 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xec, 0x03, 0x0a, - 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, - 0x54, 0x6f, 0x73, 0x52, 0x65, 0x6c, 0x69, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x4b, - 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x52, 0x65, 0x6c, 0x69, 0x61, 0x62, 0x69, 0x6c, 0x69, - 0x74, 0x79, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, - 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x47, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x52, 0x65, 0x6c, 0x69, 0x61, 0x62, - 0x69, 0x6c, 0x69, 0x74, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, - 0x54, 0x6f, 0x73, 0x52, 0x65, 0x6c, 0x69, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x4c, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, - 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x52, 0x65, - 0x6c, 0x69, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, - 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, - 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, - 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8f, 0x01, 0x0a, 0x21, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, - 0x6f, 0x73, 0x4d, 0x6f, 0x6e, 0x65, 0x74, 0x61, 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, - 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x97, 0x01, - 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, - 0x34, 0x54, 0x6f, 0x73, 0x4d, 0x6f, 0x6e, 0x65, 0x74, 0x61, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xdd, 0x03, 0x0a, 0x1a, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x4d, 0x6f, - 0x6e, 0x65, 0x74, 0x61, 0x72, 0x79, 0x12, 0x48, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x4d, - 0x6f, 0x6e, 0x65, 0x74, 0x61, 0x72, 0x79, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, - 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x4d, - 0x6f, 0x6e, 0x65, 0x74, 0x61, 0x72, 0x79, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, - 0x76, 0x34, 0x54, 0x6f, 0x73, 0x4d, 0x6f, 0x6e, 0x65, 0x74, 0x61, 0x72, 0x79, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x49, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x4d, 0x6f, 0x6e, - 0x65, 0x74, 0x61, 0x72, 0x79, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, - 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, - 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8d, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x55, 0x6e, - 0x75, 0x73, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, - 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x95, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x55, 0x6e, - 0x75, 0x73, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, - 0xd3, 0x03, 0x0a, 0x18, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x12, 0x46, 0x0a, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, - 0x76, 0x34, 0x54, 0x6f, 0x73, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, - 0x54, 0x6f, 0x73, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x47, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x34, 0x54, 0x6f, 0x73, 0x55, 0x6e, 0x75, - 0x73, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, - 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, - 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, 0x0a, 0x16, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x40, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, - 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x90, 0x01, 0x0a, 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, - 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x98, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x54, 0x72, 0x61, 0x66, - 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x22, 0xe2, 0x03, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x12, 0x49, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, - 0x43, 0x6c, 0x61, 0x73, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x12, 0x45, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, - 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, - 0x36, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x4a, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, - 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, - 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, - 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8d, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x46, 0x6c, 0x6f, 0x77, - 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x95, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x46, 0x6c, 0x6f, 0x77, - 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, - 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x22, 0xd3, 0x03, 0x0a, 0x18, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x70, 0x76, 0x36, 0x46, 0x6c, 0x6f, 0x77, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x46, 0x0a, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x70, 0x76, 0x36, 0x46, 0x6c, 0x6f, 0x77, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x2e, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, - 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, - 0x36, 0x46, 0x6c, 0x6f, 0x77, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x70, 0x76, 0x36, 0x46, 0x6c, 0x6f, 0x77, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x47, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, - 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x46, 0x6c, 0x6f, 0x77, 0x4c, - 0x61, 0x62, 0x65, 0x6c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x25, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x50, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x93, 0x04, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x4a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x50, 0x61, 0x79, - 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x88, 0x01, 0x01, 0x12, - 0x46, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, - 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x4b, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x08, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, - 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x60, 0x0a, 0x06, - 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x56, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, - 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, - 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x10, 0x01, - 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, - 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x22, 0x8e, 0x01, 0x0a, - 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, - 0x4e, 0x65, 0x78, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, - 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x96, 0x01, - 0x0a, 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, - 0x36, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x84, 0x04, 0x0a, 0x19, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x12, 0x47, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x12, 0x17, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x88, 0x01, 0x01, 0x12, 0x43, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, - 0x76, 0x36, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, - 0x67, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x4e, 0x65, - 0x78, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x60, 0x0a, - 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x56, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, - 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, - 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x10, - 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, - 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x22, 0x8c, 0x01, - 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, - 0x36, 0x48, 0x6f, 0x70, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, - 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, - 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, - 0x48, 0x6f, 0x70, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x22, 0xce, 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x48, 0x6f, 0x70, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, - 0x45, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x70, 0x76, 0x36, 0x48, 0x6f, 0x70, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x43, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, - 0x76, 0x36, 0x48, 0x6f, 0x70, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x70, 0x76, 0x36, 0x48, 0x6f, 0x70, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x48, 0x6f, 0x70, 0x4c, 0x69, 0x6d, - 0x69, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, - 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, - 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x19, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, - 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, - 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8f, - 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, - 0x76, 0x36, 0x53, 0x72, 0x63, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, - 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x22, 0xb5, 0x03, 0x0a, 0x12, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x70, 0x76, 0x36, 0x53, 0x72, 0x63, 0x12, 0x40, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x53, 0x72, 0x63, - 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3c, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x70, 0x76, 0x36, 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x70, 0x76, 0x36, 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x70, 0x76, 0x36, 0x53, 0x72, 0x63, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, - 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, - 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x19, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x44, 0x73, 0x74, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, - 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0x8f, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x44, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, - 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x22, 0xb5, 0x03, 0x0a, 0x12, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x44, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, - 0x36, 0x44, 0x73, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x12, 0x3c, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3c, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x0b, - 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x44, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, - 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, - 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, - 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8b, 0x01, 0x0a, - 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x1f, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, - 0x73, 0x65, 0x44, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, - 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x22, 0xc9, 0x03, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x12, 0x44, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, - 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, - 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x12, 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, - 0x65, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, - 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, - 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, - 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, - 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, - 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8b, 0x01, 0x0a, - 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x1f, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, - 0x73, 0x65, 0x53, 0x72, 0x63, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, - 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x22, 0xc9, 0x03, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x12, 0x44, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, - 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, - 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x12, 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, - 0x65, 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, - 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, - 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, - 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, - 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, - 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x91, 0x01, 0x0a, - 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, - 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0x99, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, - 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, - 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe7, 0x03, 0x0a, - 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x4a, 0x0a, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, - 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, - 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, - 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, - 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0b, - 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, - 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x95, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, - 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, - 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9d, - 0x01, 0x0a, 0x29, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, - 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, - 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, - 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xfb, - 0x03, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, - 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, - 0x6f, 0x64, 0x65, 0x12, 0x4e, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, - 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4f, - 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, - 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, - 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, - 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x99, 0x01, 0x0a, - 0x2b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x56, - 0x65, 0x63, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa1, 0x01, 0x0a, 0x2d, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, - 0x43, 0x6c, 0x61, 0x73, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x65, 0x63, 0x74, 0x6f, - 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, - 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x8f, 0x04, 0x0a, - 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x56, - 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x52, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, - 0x6c, 0x61, 0x73, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, - 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4e, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x30, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x45, 0x6e, - 0x61, 0x62, 0x6c, 0x65, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4e, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x30, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x45, 0x6e, - 0x61, 0x62, 0x6c, 0x65, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x53, 0x0a, 0x0b, - 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x32, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, - 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, - 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, - 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, - 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, - 0x30, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9b, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, - 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x30, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x22, 0xf1, 0x03, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, - 0x6c, 0x61, 0x73, 0x73, 0x30, 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x30, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, - 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x30, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, - 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x30, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x30, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, - 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, - 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9b, 0x01, 0x0a, - 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x31, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf1, 0x03, 0x0a, 0x1e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, - 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x31, 0x12, 0x4c, 0x0a, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, - 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, - 0x73, 0x31, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, - 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x48, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, - 0x43, 0x6c, 0x61, 0x73, 0x73, 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, - 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x31, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, - 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, - 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x31, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, - 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, - 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, - 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, - 0x32, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9b, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, - 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x32, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x22, 0xf1, 0x03, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, - 0x6c, 0x61, 0x73, 0x73, 0x32, 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x32, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, - 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x32, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, - 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x32, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x32, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, - 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x33, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, - 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9b, 0x01, 0x0a, - 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x33, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf1, 0x03, 0x0a, 0x1e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, - 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x33, 0x12, 0x4c, 0x0a, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, - 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, - 0x73, 0x33, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, - 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x48, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, - 0x43, 0x6c, 0x61, 0x73, 0x73, 0x33, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, - 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x33, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, - 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, - 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x33, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, - 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, - 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, - 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, - 0x34, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9b, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, - 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x34, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x22, 0xf1, 0x03, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, - 0x6c, 0x61, 0x73, 0x73, 0x34, 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x34, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, - 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x34, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, - 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x34, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x34, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, - 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x35, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, - 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9b, 0x01, 0x0a, - 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x35, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf1, 0x03, 0x0a, 0x1e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, - 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x35, 0x12, 0x4c, 0x0a, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, - 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, - 0x73, 0x35, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, - 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x48, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, - 0x43, 0x6c, 0x61, 0x73, 0x73, 0x35, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, - 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x35, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, - 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, - 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x35, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, - 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, - 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, - 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, - 0x36, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9b, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, - 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x22, 0xf1, 0x03, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, - 0x6c, 0x61, 0x73, 0x73, 0x36, 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x36, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, - 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x36, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, - 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x36, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, - 0x61, 0x73, 0x73, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, - 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x37, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, - 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9b, 0x01, 0x0a, - 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x37, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf1, 0x03, 0x0a, 0x1e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, - 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x37, 0x12, 0x4c, 0x0a, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, - 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, - 0x73, 0x37, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, - 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x48, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, - 0x43, 0x6c, 0x61, 0x73, 0x73, 0x37, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, - 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x37, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, - 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, - 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x37, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, - 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x90, - 0x01, 0x0a, 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, - 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, - 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, - 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0x98, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, - 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, - 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe2, 0x03, 0x0a, - 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, - 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x12, 0x49, 0x0a, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, - 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x2e, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x45, 0x0a, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, - 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x45, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, - 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, - 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, - 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x90, 0x01, 0x0a, 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, - 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x98, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, - 0x65, 0x53, 0x72, 0x63, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, - 0xe2, 0x03, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, - 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x12, - 0x49, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, - 0x63, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x45, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, - 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, - 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x0b, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, - 0x72, 0x63, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, - 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, - 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0x96, 0x01, 0x0a, 0x28, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, - 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, - 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9e, 0x01, - 0x0a, 0x2a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, - 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, - 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, - 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x80, - 0x04, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, - 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x4f, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, - 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, - 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, - 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, - 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x50, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, - 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, - 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, - 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x9a, 0x01, 0x0a, 0x2c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, - 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, - 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa2, - 0x01, 0x0a, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, - 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x22, 0x94, 0x04, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, - 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x53, 0x0a, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, - 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, - 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, - 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, - 0x70, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x54, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, - 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, - 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, - 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, - 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x23, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, - 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, - 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, - 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, - 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe7, 0x03, 0x0a, 0x1c, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, - 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x4a, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, - 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x2e, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, - 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, - 0x61, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x54, 0x69, - 0x6d, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, - 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, - 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, - 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x54, 0x63, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, - 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x2e, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, - 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, - 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, - 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x54, 0x63, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, - 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, - 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, - 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8a, 0x01, - 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, - 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x73, 0x74, - 0x50, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, - 0xc4, 0x03, 0x0a, 0x15, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, - 0x63, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x73, - 0x74, 0x50, 0x6f, 0x72, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, + 0x76, 0x36, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x90, 0x01, 0x0a, 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x70, 0x76, 0x36, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x22, 0x98, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe2, 0x03, + 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, + 0x36, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x49, 0x0a, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x70, 0x76, 0x36, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x2e, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x45, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x49, 0x70, 0x76, 0x36, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, - 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, - 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x73, 0x74, - 0x50, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x65, 0x71, 0x4e, 0x75, 0x6d, 0x43, + 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x54, 0x72, 0x61, 0x66, 0x66, + 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x49, 0x70, 0x76, 0x36, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, + 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, + 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, + 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, + 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0x8d, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x46, 0x6c, 0x6f, 0x77, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, @@ -136194,679 +135600,267 @@ var file_otg_proto_rawDesc = []byte{ 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x65, 0x71, 0x4e, 0x75, 0x6d, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x65, 0x71, 0x4e, 0x75, 0x6d, 0x12, - 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x54, 0x63, 0x70, 0x53, 0x65, 0x71, 0x4e, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x65, - 0x71, 0x4e, 0x75, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x65, - 0x71, 0x4e, 0x75, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, - 0x53, 0x65, 0x71, 0x4e, 0x75, 0x6d, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, - 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, - 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x41, 0x63, 0x6b, 0x4e, 0x75, - 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x41, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x4d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x41, 0x63, 0x6b, 0x4e, 0x75, - 0x6d, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x41, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, - 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, - 0x41, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, - 0x41, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, - 0x63, 0x70, 0x41, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, - 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, - 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, - 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8d, 0x01, 0x0a, 0x1f, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x61, 0x74, - 0x61, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x95, 0x01, 0x0a, 0x21, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x61, 0x74, - 0x61, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x22, 0xd3, 0x03, 0x0a, 0x18, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x61, 0x74, 0x61, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, + 0x6e, 0x74, 0x22, 0x95, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x46, 0x6c, 0x6f, 0x77, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, + 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, + 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xa5, 0x01, 0x0a, 0x1e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x46, 0x6c, + 0x6f, 0x77, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x12, 0x15, 0x0a, + 0x03, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x03, 0x6d, 0x69, + 0x6e, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x03, 0x6d, 0x61, 0x78, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, + 0x65, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x04, 0x73, 0x65, 0x65, + 0x64, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, + 0x06, 0x0a, 0x04, 0x5f, 0x6d, 0x69, 0x6e, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x6d, 0x61, 0x78, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x65, 0x65, 0x64, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x22, 0x9c, 0x04, 0x0a, 0x18, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x46, 0x6c, 0x6f, 0x77, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x46, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x54, 0x63, 0x70, 0x44, 0x61, 0x74, 0x61, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x2e, 0x43, + 0x77, 0x49, 0x70, 0x76, 0x36, 0x46, 0x6c, 0x6f, 0x77, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, - 0x63, 0x70, 0x44, 0x61, 0x74, 0x61, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x43, 0x6f, 0x75, 0x6e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x70, 0x76, 0x36, 0x46, 0x6c, 0x6f, 0x77, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x61, 0x74, 0x61, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x46, 0x6c, 0x6f, 0x77, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x61, 0x74, 0x61, - 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, - 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, - 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x88, 0x01, 0x0a, 0x1a, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4e, 0x73, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, - 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0x90, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4e, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xba, 0x03, 0x0a, 0x13, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4e, 0x73, 0x12, 0x41, - 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4e, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, - 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4e, - 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4e, 0x73, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, - 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4e, - 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, - 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, - 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x43, 0x77, 0x72, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, - 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, - 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, - 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, - 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, - 0x63, 0x70, 0x45, 0x63, 0x6e, 0x43, 0x77, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x43, 0x77, 0x72, 0x12, 0x42, 0x0a, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, - 0x70, 0x45, 0x63, 0x6e, 0x43, 0x77, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, - 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x43, 0x77, - 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x43, 0x77, - 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, - 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, - 0x43, 0x77, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x46, 0x6c, 0x6f, + 0x77, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, + 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x12, 0x3b, 0x0a, 0x06, 0x72, + 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, + 0x36, 0x46, 0x6c, 0x6f, 0x77, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, + 0x52, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x1a, 0x62, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x22, 0x58, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x45, 0x63, 0x68, 0x6f, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, - 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x45, 0x63, 0x68, 0x6f, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x45, 0x63, 0x68, - 0x6f, 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x45, 0x63, 0x68, 0x6f, 0x2e, 0x43, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, - 0x70, 0x45, 0x63, 0x6e, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, - 0x63, 0x70, 0x45, 0x63, 0x6e, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x45, 0x63, 0x68, 0x6f, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, - 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, + 0x12, 0x0a, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x10, 0x06, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x22, 0x91, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x70, 0x76, 0x36, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, + 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, + 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x22, 0x93, 0x04, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x70, 0x76, 0x36, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x12, 0x4a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x17, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x88, 0x01, 0x01, 0x12, 0x46, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x70, 0x76, 0x36, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x50, 0x61, 0x79, 0x6c, 0x6f, + 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x70, 0x76, 0x36, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x60, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x22, 0x56, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, + 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, + 0x03, 0x12, 0x08, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, - 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, - 0x70, 0x43, 0x74, 0x6c, 0x55, 0x72, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, - 0x55, 0x72, 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, + 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x22, 0x8e, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x4e, 0x65, 0x78, 0x74, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x96, 0x01, 0x0a, 0x22, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x4e, 0x65, 0x78, 0x74, + 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, + 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, + 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x22, 0x84, 0x04, 0x0a, 0x19, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x70, 0x76, 0x36, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x47, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x70, 0x76, 0x36, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x04, 0x61, + 0x75, 0x74, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x04, 0x61, 0x75, 0x74, + 0x6f, 0x88, 0x01, 0x01, 0x12, 0x43, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x4e, 0x65, 0x78, + 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, + 0x76, 0x36, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, + 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x08, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x4e, 0x65, 0x78, 0x74, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x60, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x22, 0x56, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, + 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x48, 0x6f, 0x70, 0x4c, + 0x69, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x48, 0x6f, 0x70, 0x4c, 0x69, + 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, - 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, - 0x70, 0x43, 0x74, 0x6c, 0x55, 0x72, 0x67, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x55, - 0x72, 0x67, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, - 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x55, 0x72, 0x67, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x55, 0x72, 0x67, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, - 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x55, 0x72, 0x67, 0x4d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, - 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, - 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, - 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x41, 0x63, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, - 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, - 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, - 0x74, 0x6c, 0x41, 0x63, 0x6b, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, - 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x41, 0x63, 0x6b, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, - 0x6c, 0x41, 0x63, 0x6b, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x41, 0x63, 0x6b, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x41, 0x63, 0x6b, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, - 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x41, 0x63, 0x6b, - 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, - 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, - 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x50, 0x73, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, - 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, - 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, - 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, - 0x70, 0x43, 0x74, 0x6c, 0x50, 0x73, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x50, 0x73, 0x68, 0x12, 0x42, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, - 0x43, 0x74, 0x6c, 0x50, 0x73, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x50, 0x73, 0x68, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x50, 0x73, 0x68, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, - 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x50, - 0x73, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, - 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, - 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x52, 0x73, 0x74, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, - 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x52, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, - 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x52, 0x73, 0x74, 0x12, 0x42, 0x0a, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, - 0x63, 0x70, 0x43, 0x74, 0x6c, 0x52, 0x73, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, + 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xce, + 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, + 0x76, 0x36, 0x48, 0x6f, 0x70, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, + 0x48, 0x6f, 0x70, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x52, - 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x52, - 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, - 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, - 0x6c, 0x52, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x53, 0x79, 0x6e, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, - 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x53, 0x79, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x53, 0x79, 0x6e, 0x12, - 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x53, 0x79, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, - 0x6c, 0x53, 0x79, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, - 0x6c, 0x53, 0x79, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, - 0x43, 0x74, 0x6c, 0x53, 0x79, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, - 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, - 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x46, 0x69, - 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x46, 0x69, 0x6e, 0x4d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x46, 0x69, - 0x6e, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x46, 0x69, 0x6e, 0x2e, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, - 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, - 0x43, 0x74, 0x6c, 0x46, 0x69, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, - 0x43, 0x74, 0x6c, 0x46, 0x69, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, - 0x63, 0x70, 0x43, 0x74, 0x6c, 0x46, 0x69, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, - 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, - 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, - 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x57, 0x69, 0x6e, - 0x64, 0x6f, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x57, 0x69, 0x6e, - 0x64, 0x6f, 0x77, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, - 0x63, 0x70, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, - 0x63, 0x70, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x54, 0x63, 0x70, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, - 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, - 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, - 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xe5, 0x02, 0x0a, - 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x4d, 0x0a, - 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x47, 0x65, - 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x01, 0x52, 0x09, - 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, - 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, - 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, - 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x63, - 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x64, 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, - 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x08, 0x0a, - 0x04, 0x67, 0x6f, 0x6f, 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x62, 0x61, 0x64, 0x10, 0x02, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, - 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x75, - 0x73, 0x74, 0x6f, 0x6d, 0x22, 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, - 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x55, 0x64, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, - 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x55, 0x64, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x2e, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, - 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, - 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, - 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6d, 0x65, + 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x48, 0x6f, 0x70, + 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, + 0x48, 0x6f, 0x70, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x55, 0x64, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, - 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, - 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, - 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8a, 0x01, - 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, - 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x44, 0x73, 0x74, - 0x50, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, + 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x70, 0x76, 0x36, 0x48, 0x6f, 0x70, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x87, 0x01, 0x0a, 0x19, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x70, 0x76, 0x36, 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8f, 0x01, 0x0a, 0x1b, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x53, 0x72, 0x63, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xb5, 0x03, 0x0a, 0x12, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x53, + 0x72, 0x63, 0x12, 0x40, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x53, 0x72, 0x63, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3c, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, + 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x53, 0x72, + 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, + 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x53, 0x72, + 0x63, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, + 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, + 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, + 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0x87, 0x01, 0x0a, 0x19, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, + 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8f, 0x01, + 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, + 0x36, 0x44, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, @@ -136874,145 +135868,169 @@ var file_otg_proto_rawDesc = []byte{ 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, - 0xc4, 0x03, 0x0a, 0x15, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, - 0x64, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x44, 0x73, - 0x74, 0x50, 0x6f, 0x72, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, + 0xb5, 0x03, 0x0a, 0x12, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x70, 0x76, 0x36, 0x44, 0x73, 0x74, 0x12, 0x40, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, 0x76, 0x36, 0x44, 0x73, 0x74, 0x2e, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3c, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x49, 0x70, 0x76, 0x36, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, + 0x76, 0x36, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x70, + 0x76, 0x36, 0x44, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, + 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, + 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, 0x0a, 0x16, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, + 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, + 0x44, 0x73, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, + 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, - 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x44, 0x73, 0x74, - 0x50, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, - 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x55, 0x64, 0x70, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, - 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x55, 0x64, 0x70, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x4c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x4c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, - 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, - 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, - 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xe5, 0x02, 0x0a, 0x16, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x73, 0x75, 0x6d, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, - 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x4d, 0x0a, 0x09, 0x67, 0x65, 0x6e, - 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, - 0x70, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x01, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, - 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, - 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, - 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, - 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, - 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x67, 0x6f, 0x6f, - 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x62, 0x61, 0x64, 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, - 0x22, 0x92, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x50, 0x72, 0x65, 0x73, 0x65, - 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, + 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x44, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, + 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, + 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, - 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x22, 0xec, 0x03, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x50, 0x72, 0x65, - 0x73, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, - 0x6d, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, - 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x12, 0x47, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x73, 0x75, 0x6d, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x50, 0x72, 0x65, - 0x73, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x4d, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, 0x0a, 0x16, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, + 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, + 0x53, 0x72, 0x63, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, + 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, + 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, + 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x53, 0x72, 0x63, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, + 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, + 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, + 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, + 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x25, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, + 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, + 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe7, 0x03, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, + 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x4a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, + 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, + 0x72, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, + 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, @@ -137021,17 +136039,70 @@ var file_otg_proto_rawDesc = []byte{ 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x30, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, - 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x30, 0x4d, 0x65, 0x74, 0x72, + 0x65, 0x22, 0x95, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9d, 0x01, 0x0a, 0x29, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, + 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xfb, 0x03, 0x0a, 0x20, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, + 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x4e, + 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, + 0x70, 0x43, 0x6f, 0x64, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x4a, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, + 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4f, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, + 0x70, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, + 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x99, 0x01, 0x0a, 0x2b, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, + 0x6c, 0x61, 0x73, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0xa1, 0x01, 0x0a, 0x2d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, @@ -137039,74 +136110,183 @@ var file_otg_proto_rawDesc = []byte{ 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xce, 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x30, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x30, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x30, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x30, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, - 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x30, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, - 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, - 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x72, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x72, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, - 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, + 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x8f, 0x04, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, + 0x6c, 0x61, 0x73, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x12, 0x52, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x35, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x45, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, + 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x56, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, + 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x56, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x53, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, + 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x45, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, + 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x30, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, + 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, + 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0x9b, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, + 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, + 0x73, 0x30, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf1, 0x03, + 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, + 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x30, + 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, + 0x6c, 0x61, 0x73, 0x73, 0x30, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, + 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x30, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x30, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, + 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x30, 0x4d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, + 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, + 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x22, 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9b, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, + 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x31, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, + 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf1, 0x03, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x31, 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x31, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, + 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, + 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, + 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, + 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x31, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, + 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x32, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, + 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, + 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0x9b, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, + 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, + 0x73, 0x32, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf1, 0x03, + 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, + 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x32, + 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, + 0x6c, 0x61, 0x73, 0x73, 0x32, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, + 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x32, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x32, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, + 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x32, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, @@ -137115,17 +136295,18 @@ var file_otg_proto_rawDesc = []byte{ 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, - 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, - 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, - 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, - 0x93, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, - 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x65, 0x22, 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x33, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9b, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, + 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x33, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, @@ -137133,107 +136314,40 @@ var file_otg_proto_rawDesc = []byte{ 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, - 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x43, 0x68, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf1, 0x03, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x33, 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x33, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, - 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x47, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, + 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, + 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x33, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, + 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x33, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, - 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0xe5, 0x02, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x44, 0x0a, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, - 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x4d, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, - 0x75, 0x6d, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x48, 0x01, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, - 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, - 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, - 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, - 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, - 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, - 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x67, 0x6f, 0x6f, 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, - 0x62, 0x61, 0x64, 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x31, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, - 0xce, 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, - 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x12, 0x45, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x4d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, - 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, - 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, - 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x47, 0x74, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, + 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, + 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x33, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, + 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x34, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, @@ -137241,227 +136355,39 @@ var file_otg_proto_rawDesc = []byte{ 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, - 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, - 0x74, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xce, 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, - 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, - 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, - 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, - 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, - 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, - 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x25, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe7, 0x03, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x4a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, - 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, - 0x70, 0x76, 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, - 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x8d, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, - 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0x95, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, - 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, - 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xd3, 0x03, 0x0a, 0x18, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x52, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x46, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x9b, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, + 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, + 0x73, 0x34, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf1, 0x03, + 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, + 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x34, + 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, + 0x6c, 0x61, 0x73, 0x73, 0x34, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x12, 0x42, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x0b, 0x6d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, + 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, + 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x34, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x47, 0x74, 0x70, 0x76, 0x31, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x4d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, - 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, - 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, - 0x74, 0x70, 0x76, 0x31, 0x45, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, - 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, - 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, - 0x31, 0x45, 0x46, 0x6c, 0x61, 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, - 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, - 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x45, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x43, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, - 0x76, 0x31, 0x45, 0x46, 0x6c, 0x61, 0x67, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, - 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x45, 0x46, 0x6c, - 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x45, 0x46, - 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, - 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, - 0x31, 0x45, 0x46, 0x6c, 0x61, 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, - 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, - 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x46, 0x6c, - 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x46, 0x6c, 0x61, 0x67, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, - 0x46, 0x6c, 0x61, 0x67, 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x46, 0x6c, 0x61, 0x67, - 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, - 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x46, 0x6c, 0x61, 0x67, 0x4d, + 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x34, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, + 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x34, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, @@ -137470,17 +136396,18 @@ var file_otg_proto_rawDesc = []byte{ 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x6e, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, - 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, - 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, - 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, - 0x93, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, - 0x74, 0x70, 0x76, 0x31, 0x50, 0x6e, 0x46, 0x6c, 0x61, 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x65, 0x22, 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x35, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9b, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, + 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x35, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, @@ -137488,27 +136415,80 @@ var file_otg_proto_rawDesc = []byte{ 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x6e, 0x46, 0x6c, 0x61, 0x67, - 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x6e, 0x46, 0x6c, 0x61, 0x67, 0x2e, 0x43, 0x68, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf1, 0x03, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x35, 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x35, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, - 0x70, 0x76, 0x31, 0x50, 0x6e, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x6e, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, + 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, + 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x35, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, + 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x35, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x6e, 0x46, 0x6c, 0x61, 0x67, 0x4d, + 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, + 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x35, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, + 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x36, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, + 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, + 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0x9b, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, + 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, + 0x73, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf1, 0x03, + 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, + 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x36, + 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, + 0x6c, 0x61, 0x73, 0x73, 0x36, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, + 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x36, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x36, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, + 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x36, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, @@ -137517,98 +136497,253 @@ var file_otg_proto_rawDesc = []byte{ 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x90, 0x01, 0x0a, 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x98, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, - 0xe2, 0x03, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, - 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x49, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x45, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x0b, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, - 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, - 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x65, 0x22, 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, + 0x61, 0x73, 0x73, 0x37, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9b, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, + 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x37, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, + 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf1, 0x03, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x37, 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x37, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, + 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x37, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, + 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x37, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, + 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x66, 0x63, 0x50, 0x61, 0x75, 0x73, 0x65, 0x50, 0x61, 0x75, 0x73, + 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x37, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x90, 0x01, 0x0a, 0x22, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, + 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, + 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x98, 0x01, 0x0a, + 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, + 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, + 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe2, 0x03, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, + 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x12, 0x49, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, + 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x45, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, + 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, + 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, + 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, + 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x44, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, + 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, + 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x90, 0x01, 0x0a, + 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, + 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, + 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, + 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0x98, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, + 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x4d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, + 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, + 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe2, 0x03, 0x0a, 0x1b, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, + 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x12, 0x49, 0x0a, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, + 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x2e, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x45, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, + 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x45, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, + 0x65, 0x53, 0x72, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, + 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x53, 0x72, 0x63, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x96, 0x01, 0x0a, 0x28, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, + 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, + 0x72, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9e, 0x01, 0x0a, 0x2a, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, + 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x80, 0x04, 0x0a, 0x21, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, + 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x4f, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x32, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, + 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, + 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, + 0x50, 0x61, 0x75, 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x4b, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x50, 0x0a, + 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, + 0x65, 0x45, 0x74, 0x68, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, + 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, + 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9a, 0x01, 0x0a, + 0x2c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, + 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x26, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xec, 0x03, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x4b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, - 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x47, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, - 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa2, 0x01, 0x0a, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, + 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, + 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x94, + 0x04, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, + 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x53, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, + 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, + 0x43, 0x6f, 0x64, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, + 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x12, 0x4f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x47, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x0b, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, + 0x74, 0x12, 0x4f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, + 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, 0x6f, 0x64, 0x65, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x54, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, + 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, + 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4f, 0x70, 0x43, + 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, @@ -137616,17 +136751,18 @@ var file_otg_proto_rawDesc = []byte{ 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x54, 0x65, 0x69, 0x64, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, - 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x54, 0x65, 0x69, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x25, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, + 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, @@ -137634,46 +136770,216 @@ var file_otg_proto_rawDesc = []byte{ 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x54, 0x65, 0x69, 0x64, 0x12, 0x42, - 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x47, 0x74, 0x70, 0x76, 0x31, 0x54, 0x65, 0x69, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe7, 0x03, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, + 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x4a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, + 0x50, 0x61, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x54, - 0x65, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x54, - 0x65, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, - 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, - 0x31, 0x54, 0x65, 0x69, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, - 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, - 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x71, 0x75, 0x65, - 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, + 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x54, + 0x69, 0x6d, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x45, 0x74, 0x68, 0x65, + 0x72, 0x6e, 0x65, 0x74, 0x50, 0x61, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, + 0x63, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, - 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9a, 0x01, 0x0a, - 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, - 0x31, 0x53, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, + 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, + 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, + 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, + 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, + 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x22, 0xa2, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x54, 0x63, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x6f, + 0x6d, 0x12, 0x15, 0x0a, 0x03, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, + 0x52, 0x03, 0x6d, 0x69, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x03, 0x6d, 0x61, 0x78, 0x88, 0x01, 0x01, 0x12, + 0x17, 0x0a, 0x04, 0x73, 0x65, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x04, 0x73, 0x65, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x88, 0x01, 0x01, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x6d, 0x69, 0x6e, 0x42, 0x06, 0x0a, 0x04, 0x5f, + 0x6d, 0x61, 0x78, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x65, 0x65, 0x64, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8a, 0x04, 0x0a, 0x15, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, + 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x2e, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, + 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, + 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, + 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x54, 0x63, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, + 0x12, 0x38, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x61, 0x6e, 0x64, + 0x6f, 0x6d, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x1a, 0x62, 0x0a, 0x06, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x22, 0x58, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, + 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x05, 0x12, 0x0a, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x10, 0x06, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, + 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x54, 0x63, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, + 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xa2, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x52, + 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x12, 0x15, 0x0a, 0x03, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x00, 0x52, 0x03, 0x6d, 0x69, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, + 0x6d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x03, 0x6d, 0x61, 0x78, + 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x65, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x04, 0x73, 0x65, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x03, 0x52, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x6d, 0x69, 0x6e, 0x42, + 0x06, 0x0a, 0x04, 0x5f, 0x6d, 0x61, 0x78, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x65, 0x65, 0x64, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8a, 0x04, 0x0a, 0x15, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x73, 0x74, + 0x50, 0x6f, 0x72, 0x74, 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, + 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x54, 0x63, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, + 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x4d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x54, 0x61, 0x67, 0x73, 0x12, 0x38, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, + 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x1a, 0x62, + 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x58, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, + 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, + 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x12, 0x0a, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, + 0x10, 0x06, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x65, 0x71, 0x4e, 0x75, 0x6d, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x65, 0x71, 0x4e, 0x75, 0x6d, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, + 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x65, 0x71, 0x4e, 0x75, 0x6d, + 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, 0x65, 0x71, 0x4e, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, + 0x65, 0x71, 0x4e, 0x75, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x53, + 0x65, 0x71, 0x4e, 0x75, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, + 0x70, 0x53, 0x65, 0x71, 0x4e, 0x75, 0x6d, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x41, 0x63, 0x6b, 0x4e, + 0x75, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x41, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, @@ -137681,79 +136987,121 @@ var file_otg_proto_rawDesc = []byte{ 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xec, 0x03, 0x0a, 0x1d, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x71, - 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, - 0x76, 0x31, 0x53, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, + 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x41, 0x63, 0x6b, 0x4e, + 0x75, 0x6d, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x41, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, + 0x70, 0x41, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, + 0x70, 0x41, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x54, 0x63, 0x70, 0x41, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, + 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, + 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, + 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, + 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8d, 0x01, 0x0a, 0x1f, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x61, + 0x74, 0x61, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, + 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, + 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x95, 0x01, 0x0a, 0x21, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x61, + 0x74, 0x61, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x22, 0xd3, 0x03, 0x0a, 0x18, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x61, 0x74, 0x61, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x12, 0x46, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x61, 0x74, 0x61, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x47, 0x0a, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, + 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x71, - 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4c, 0x0a, - 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, - 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, - 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, - 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8f, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, 0x50, 0x64, - 0x75, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x97, 0x01, 0x0a, 0x23, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, - 0x50, 0x64, 0x75, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, - 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x22, 0xdd, 0x03, 0x0a, 0x1a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, 0x50, 0x64, 0x75, 0x4e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, 0x50, 0x64, 0x75, 0x4e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x12, 0x44, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, 0x50, 0x64, 0x75, 0x4e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, - 0x4e, 0x50, 0x64, 0x75, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x0b, - 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, 0x50, 0x64, 0x75, 0x4e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, + 0x54, 0x63, 0x70, 0x44, 0x61, 0x74, 0x61, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x42, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x61, 0x74, 0x61, 0x4f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, + 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x44, 0x61, 0x74, + 0x61, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x88, 0x01, 0x0a, 0x1a, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4e, + 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x90, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4e, 0x73, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, + 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xba, 0x03, 0x0a, 0x13, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4e, 0x73, 0x12, + 0x41, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4e, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, + 0x4e, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x4e, + 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, + 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, + 0x4e, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, @@ -137761,322 +137109,54 @@ var file_otg_proto_rawDesc = []byte{ 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9c, 0x01, 0x0a, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, - 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0xa4, 0x01, 0x0a, 0x30, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x9e, 0x04, 0x0a, 0x27, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, - 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, - 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x55, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, 0x65, 0x78, - 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x12, 0x51, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, - 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, 0x65, 0x78, - 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x56, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, - 0x76, 0x31, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, - 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, - 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, - 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x2d, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa3, 0x01, 0x0a, 0x2f, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, - 0x99, 0x04, 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, - 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x54, 0x0a, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x37, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, - 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x12, 0x50, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x50, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x55, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, - 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, - 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, - 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, - 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x94, 0x01, 0x0a, 0x26, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, - 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x48, - 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0x9c, 0x01, 0x0a, 0x28, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, - 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x04, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, - 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x22, 0xf6, 0x03, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x4d, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x04, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x04, 0x52, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x49, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4e, 0x0a, - 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, - 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, - 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, - 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9f, 0x01, 0x0a, 0x31, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, - 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa7, 0x01, 0x0a, - 0x33, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, - 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, - 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xad, 0x04, 0x0a, 0x2a, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, - 0x6f, 0x6e, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, - 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x58, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x12, 0x54, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x54, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, - 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, - 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x59, - 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, - 0x61, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, - 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xce, 0x03, 0x0a, - 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, - 0x32, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, - 0x74, 0x70, 0x76, 0x32, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, - 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, - 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, - 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x95, 0x01, - 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, - 0x76, 0x32, 0x50, 0x69, 0x67, 0x67, 0x79, 0x62, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x6c, - 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9d, 0x01, 0x0a, 0x29, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x50, 0x69, 0x67, 0x67, 0x79, 0x62, - 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x6c, 0x61, 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, - 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, - 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xfb, 0x03, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x50, 0x69, 0x67, 0x67, 0x79, 0x62, - 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x4e, 0x0a, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, - 0x32, 0x50, 0x69, 0x67, 0x67, 0x79, 0x62, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x6c, 0x61, - 0x67, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4a, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x50, 0x69, 0x67, 0x67, 0x79, 0x62, 0x61, 0x63, 0x6b, - 0x69, 0x6e, 0x67, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, - 0x70, 0x76, 0x32, 0x50, 0x69, 0x67, 0x67, 0x79, 0x62, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, - 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4f, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, - 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, - 0x32, 0x50, 0x69, 0x67, 0x67, 0x79, 0x62, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x6c, 0x61, - 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, - 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, - 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x8d, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, 0x46, 0x6c, 0x61, 0x67, + 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x43, 0x77, 0x72, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, + 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x43, 0x77, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, + 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x43, 0x77, 0x72, 0x12, 0x42, 0x0a, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, + 0x63, 0x70, 0x45, 0x63, 0x6e, 0x43, 0x77, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x43, + 0x77, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x43, + 0x77, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, + 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, + 0x6e, 0x43, 0x77, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, + 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, + 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, @@ -138084,37 +137164,82 @@ var file_otg_proto_rawDesc = []byte{ 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0x95, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, 0x46, 0x6c, 0x61, 0x67, - 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xd3, 0x03, 0x0a, 0x18, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, - 0x54, 0x65, 0x69, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x46, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, - 0x65, 0x69, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, - 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, - 0x64, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, - 0x32, 0x54, 0x65, 0x69, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x0b, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x4d, + 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x45, 0x63, 0x68, 0x6f, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x45, 0x63, + 0x68, 0x6f, 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x45, 0x63, 0x68, 0x6f, 0x2e, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, + 0x63, 0x70, 0x45, 0x63, 0x6e, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0b, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x45, 0x63, 0x6e, 0x45, 0x63, 0x68, 0x6f, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, + 0x63, 0x70, 0x43, 0x74, 0x6c, 0x55, 0x72, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, + 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, + 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, + 0x6c, 0x55, 0x72, 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, + 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, + 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, + 0x63, 0x70, 0x43, 0x74, 0x6c, 0x55, 0x72, 0x67, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, + 0x55, 0x72, 0x67, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, + 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x55, 0x72, 0x67, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x55, 0x72, 0x67, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x55, 0x72, 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, @@ -138123,8 +137248,54 @@ var file_otg_proto_rawDesc = []byte{ 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x31, 0x43, 0x6f, 0x75, 0x6e, + 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x41, 0x63, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, + 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, + 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, + 0x43, 0x74, 0x6c, 0x41, 0x63, 0x6b, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, + 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, + 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x41, 0x63, 0x6b, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, + 0x74, 0x6c, 0x41, 0x63, 0x6b, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x41, 0x63, 0x6b, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x41, 0x63, 0x6b, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, + 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x41, 0x63, + 0x6b, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, + 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, + 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, + 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x50, 0x73, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, @@ -138132,136 +137303,36 @@ var file_otg_proto_rawDesc = []byte{ 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, - 0x93, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, - 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x31, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, - 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, - 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x31, - 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x31, 0x2e, 0x43, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, - 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, - 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x31, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, - 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x90, 0x01, 0x0a, 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x98, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, - 0xe2, 0x03, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, - 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x49, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x45, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x0b, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, - 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, - 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, - 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x26, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xec, 0x03, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x4b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, - 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x47, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, - 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x47, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x0b, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, + 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, + 0x63, 0x70, 0x43, 0x74, 0x6c, 0x50, 0x73, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x50, 0x73, 0x68, 0x12, 0x42, 0x0a, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, + 0x70, 0x43, 0x74, 0x6c, 0x50, 0x73, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, + 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x50, 0x73, + 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x50, 0x73, + 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, + 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, + 0x50, 0x73, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, @@ -138270,7 +137341,7 @@ var file_otg_proto_rawDesc = []byte{ 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, 0x43, 0x6f, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x52, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, @@ -138279,7 +137350,7 @@ var file_otg_proto_rawDesc = []byte{ 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x52, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, @@ -138288,26 +137359,26 @@ var file_otg_proto_rawDesc = []byte{ 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, 0x12, 0x42, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x52, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x52, 0x73, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, - 0x65, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, + 0x52, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, - 0x65, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, + 0x52, 0x73, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, - 0x32, 0x54, 0x65, 0x69, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, + 0x74, 0x6c, 0x52, 0x73, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, @@ -138315,18 +137386,109 @@ var file_otg_proto_rawDesc = []byte{ 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x65, 0x71, 0x75, - 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, - 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9b, 0x01, - 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, - 0x76, 0x32, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x53, 0x79, 0x6e, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x53, 0x79, 0x6e, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, + 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x53, 0x79, 0x6e, + 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x53, 0x79, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, + 0x74, 0x6c, 0x53, 0x79, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, + 0x74, 0x6c, 0x53, 0x79, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, + 0x70, 0x43, 0x74, 0x6c, 0x53, 0x79, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x46, + 0x69, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x46, 0x69, 0x6e, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x46, + 0x69, 0x6e, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x46, 0x69, 0x6e, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, + 0x70, 0x43, 0x74, 0x6c, 0x46, 0x69, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, + 0x70, 0x43, 0x74, 0x6c, 0x46, 0x69, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x54, 0x63, 0x70, 0x43, 0x74, 0x6c, 0x46, 0x69, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, + 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, + 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, + 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, + 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x57, 0x69, + 0x6e, 0x64, 0x6f, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, @@ -138334,30 +137496,218 @@ var file_otg_proto_rawDesc = []byte{ 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf1, 0x03, 0x0a, 0x1e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, - 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x4c, - 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, 0x14, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x57, 0x69, + 0x6e, 0x64, 0x6f, 0x77, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, - 0x62, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, - 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, - 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, - 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, - 0x70, 0x76, 0x32, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, - 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, - 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, 0x74, + 0x54, 0x63, 0x70, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x54, 0x63, 0x70, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x54, 0x63, 0x70, 0x57, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, + 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, + 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, + 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, + 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xe5, 0x02, + 0x0a, 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x68, 0x65, + 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x4d, + 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x54, 0x63, 0x70, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x47, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x01, 0x52, + 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, 0x0a, 0x06, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x22, 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, + 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, + 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, + 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, + 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x08, + 0x0a, 0x04, 0x67, 0x6f, 0x6f, 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x62, 0x61, 0x64, 0x10, + 0x02, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, + 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x22, 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x55, 0x64, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, + 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xa2, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, + 0x74, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x12, 0x15, 0x0a, 0x03, 0x6d, 0x69, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x03, 0x6d, 0x69, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x15, + 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x03, 0x6d, + 0x61, 0x78, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x65, 0x65, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x04, 0x73, 0x65, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x03, 0x52, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x6d, 0x69, + 0x6e, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x6d, 0x61, 0x78, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x65, + 0x65, 0x64, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8a, 0x04, 0x0a, + 0x15, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x53, + 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, + 0x72, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, + 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x3f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, 0x74, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x44, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, + 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, 0x72, + 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x12, 0x38, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x53, 0x72, 0x63, 0x50, 0x6f, + 0x72, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x52, 0x06, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, + 0x1a, 0x62, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x58, 0x0a, 0x04, 0x45, 0x6e, + 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, + 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, + 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x12, 0x0a, 0x0a, 0x06, 0x72, 0x61, 0x6e, 0x64, + 0x6f, 0x6d, 0x10, 0x06, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x44, 0x73, 0x74, 0x50, + 0x6f, 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xa2, 0x01, 0x0a, 0x1b, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x44, 0x73, + 0x74, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x12, 0x15, 0x0a, 0x03, 0x6d, + 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x03, 0x6d, 0x69, 0x6e, 0x88, + 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x6d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x03, 0x6d, 0x61, 0x78, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x65, 0x65, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x04, 0x73, 0x65, 0x65, 0x64, 0x88, + 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x06, 0x0a, + 0x04, 0x5f, 0x6d, 0x69, 0x6e, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x6d, 0x61, 0x78, 0x42, 0x07, 0x0a, + 0x05, 0x5f, 0x73, 0x65, 0x65, 0x64, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x8a, 0x04, 0x0a, 0x15, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x55, 0x64, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x44, + 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, + 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, 0x72, + 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x44, 0x73, 0x74, 0x50, 0x6f, + 0x72, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, + 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x44, 0x73, + 0x74, 0x50, 0x6f, 0x72, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x12, 0x38, 0x0a, 0x06, 0x72, 0x61, + 0x6e, 0x64, 0x6f, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x44, + 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x52, 0x06, 0x72, 0x61, + 0x6e, 0x64, 0x6f, 0x6d, 0x1a, 0x62, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x58, + 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, + 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x12, 0x0a, 0x0a, 0x06, + 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x10, 0x06, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, + 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, + 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x4c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, + 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x55, 0x64, 0x70, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x55, 0x64, 0x70, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, + 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, @@ -138366,45 +137716,118 @@ var file_otg_proto_rawDesc = []byte{ 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, - 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x32, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, - 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, - 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, - 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x32, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x32, 0x12, 0x44, - 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, + 0xe5, 0x02, 0x0a, 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, + 0x64, 0x70, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, + 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x4d, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x55, 0x64, 0x70, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, + 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, + 0x01, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, + 0x1b, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x0d, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, + 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, + 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, + 0x12, 0x08, 0x0a, 0x04, 0x67, 0x6f, 0x6f, 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x62, 0x61, + 0x64, 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x0c, + 0x0a, 0x0a, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x22, 0x92, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, + 0x75, 0x6d, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, + 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9a, 0x01, 0x0a, + 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x43, + 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xec, 0x03, 0x0a, 0x1d, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x73, 0x75, 0x6d, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x2e, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x47, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x32, 0x2e, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, - 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x32, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, - 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x32, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x32, 0x4d, 0x65, 0x74, + 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x50, 0x72, 0x65, 0x73, 0x65, + 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x73, 0x75, 0x6d, 0x50, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4c, 0x0a, + 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x50, + 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, + 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, + 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x64, 0x30, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x64, 0x30, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xce, + 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, + 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x30, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x30, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x64, 0x30, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x30, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x30, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, @@ -138413,96 +137836,162 @@ var file_otg_proto_rawDesc = []byte{ 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x8f, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, - 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, - 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0x97, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x54, 0x79, 0x70, 0x65, - 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xdd, 0x03, 0x0a, 0x1a, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, - 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x48, 0x0a, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, - 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, - 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, - 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, - 0x64, 0x77, 0x61, 0x72, 0x65, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, - 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, - 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, - 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8f, 0x01, 0x0a, 0x21, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, - 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x97, 0x01, - 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xdd, 0x03, 0x0a, 0x1a, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, - 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x48, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, + 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, + 0x72, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, + 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, + 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, + 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, + 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x72, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x43, 0x0a, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, - 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x49, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, + 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, + 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, + 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, + 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, 0x0a, + 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, + 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x12, 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, + 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, + 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, + 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xe5, 0x02, 0x0a, 0x16, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x73, 0x75, 0x6d, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, + 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x4d, 0x0a, 0x09, 0x67, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, + 0x65, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x01, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, + 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, + 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, + 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, + 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, + 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, + 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x67, 0x6f, 0x6f, + 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x62, 0x61, 0x64, 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, + 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, + 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, + 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, + 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xce, 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x64, 0x31, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, + 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, + 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x64, 0x31, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, @@ -138510,98 +137999,528 @@ var file_otg_proto_rawDesc = []byte{ 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, - 0x72, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, + 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xce, 0x03, + 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, + 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, + 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x47, 0x74, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, + 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x91, + 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, + 0x70, 0x76, 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, + 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe7, + 0x03, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, + 0x70, 0x76, 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x4a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, + 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, + 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x46, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, + 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, + 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, + 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, + 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8d, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x52, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x95, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x52, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, + 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x22, 0xd3, 0x03, 0x0a, 0x18, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x47, 0x74, 0x70, 0x76, 0x31, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x46, 0x0a, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, + 0x74, 0x70, 0x76, 0x31, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, + 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, + 0x76, 0x31, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x47, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, + 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x52, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, + 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, + 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x45, 0x46, 0x6c, 0x61, 0x67, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x45, 0x46, 0x6c, 0x61, 0x67, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x45, 0x46, 0x6c, + 0x61, 0x67, 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x45, 0x46, 0x6c, 0x61, 0x67, 0x2e, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, + 0x74, 0x70, 0x76, 0x31, 0x45, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x47, 0x74, 0x70, 0x76, 0x31, 0x45, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0b, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x45, 0x46, 0x6c, 0x61, 0x67, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, + 0x74, 0x70, 0x76, 0x31, 0x53, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, + 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, + 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, + 0x31, 0x53, 0x46, 0x6c, 0x61, 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, + 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, + 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x43, 0x0a, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, + 0x76, 0x31, 0x53, 0x46, 0x6c, 0x61, 0x67, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, + 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x46, 0x6c, + 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x46, + 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, + 0x31, 0x53, 0x46, 0x6c, 0x61, 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, + 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, + 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x6e, 0x46, + 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x6e, 0x46, 0x6c, 0x61, + 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, + 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, 0x0a, + 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, + 0x31, 0x50, 0x6e, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x6e, + 0x46, 0x6c, 0x61, 0x67, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, + 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x12, 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x6e, 0x46, 0x6c, 0x61, 0x67, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x50, 0x6e, 0x46, 0x6c, + 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, + 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, + 0x50, 0x6e, 0x46, 0x6c, 0x61, 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, + 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, + 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x90, 0x01, 0x0a, 0x22, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, - 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x25, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, - 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe7, 0x03, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, - 0x72, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x4a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, - 0x64, 0x77, 0x61, 0x72, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x98, 0x01, 0x0a, 0x24, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe2, 0x03, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x49, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x12, 0x45, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, + 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, + 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, + 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, + 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, + 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x24, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, + 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x9a, 0x01, 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xec, 0x03, + 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, + 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, + 0x4b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, + 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x47, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, + 0x76, 0x31, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x4c, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, + 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, + 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, + 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, + 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, + 0x31, 0x54, 0x65, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x54, 0x65, 0x69, + 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, + 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, + 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, + 0x31, 0x54, 0x65, 0x69, 0x64, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x54, 0x65, 0x69, 0x64, + 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x54, 0x65, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x54, 0x65, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x54, 0x65, 0x69, 0x64, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, + 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x92, + 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, + 0x70, 0x76, 0x31, 0x53, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, + 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x22, 0xec, 0x03, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, + 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x12, 0x47, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x71, 0x75, 0x65, + 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x47, 0x74, 0x70, 0x76, 0x31, 0x53, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, + 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, + 0x53, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x8f, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, + 0x74, 0x70, 0x76, 0x31, 0x4e, 0x50, 0x64, 0x75, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, + 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x22, 0x97, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, 0x50, 0x64, 0x75, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xdd, 0x03, 0x0a, 0x1a, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, + 0x4e, 0x50, 0x64, 0x75, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, + 0x31, 0x4e, 0x50, 0x64, 0x75, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, - 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x4c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, - 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, - 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x91, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, - 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, - 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, - 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x22, 0xe7, 0x03, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x12, 0x4a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x12, 0x46, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, - 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, - 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, + 0x31, 0x4e, 0x50, 0x64, 0x75, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, 0x50, 0x64, 0x75, 0x4e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, + 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, + 0x50, 0x64, 0x75, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, @@ -138609,18 +138528,20 @@ var file_otg_proto_rawDesc = []byte{ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x4f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, + 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9c, 0x01, 0x0a, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, + 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x4f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa4, 0x01, 0x0a, 0x30, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, + 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, @@ -138628,27 +138549,32 @@ var file_otg_proto_rawDesc = []byte{ 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x22, 0xce, 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x41, 0x72, 0x70, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, - 0x72, 0x70, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x68, 0x22, 0x9e, 0x04, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, + 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x55, 0x0a, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, + 0x74, 0x70, 0x76, 0x31, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, - 0x72, 0x70, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x51, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, + 0x31, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, + 0x74, 0x70, 0x76, 0x31, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x56, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x31, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, @@ -138657,121 +138583,19 @@ var file_otg_proto_rawDesc = []byte{ 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x95, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x48, 0x61, 0x72, 0x64, 0x77, - 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9d, 0x01, 0x0a, 0x29, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, - 0x64, 0x65, 0x72, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xfb, 0x03, 0x0a, 0x20, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, - 0x64, 0x65, 0x72, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x12, - 0x4e, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, - 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x48, 0x61, 0x72, 0x64, - 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4f, 0x0a, 0x0b, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, - 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, - 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, - 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x95, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, + 0x75, 0x65, 0x22, 0x9b, 0x01, 0x0a, 0x2d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, + 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0x9d, 0x01, 0x0a, 0x29, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x41, 0x64, 0x64, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, - 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x22, 0xfb, 0x03, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x41, 0x64, 0x64, 0x72, 0x12, 0x4e, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x2e, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, - 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, - 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x4f, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, - 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, - 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x95, - 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, - 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, - 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9d, 0x01, 0x0a, 0x29, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, - 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x22, 0xa3, 0x01, 0x0a, 0x2f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, @@ -138779,31 +138603,187 @@ var file_otg_proto_rawDesc = []byte{ 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xfb, 0x03, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, - 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x12, 0x4e, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, - 0x64, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x99, 0x04, 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, + 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x12, 0x54, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x37, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x45, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2e, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x50, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, + 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x50, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x32, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x55, + 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, + 0x6e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, + 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, + 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, + 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, + 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0x94, 0x01, 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, + 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, + 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9c, 0x01, 0x0a, 0x28, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x48, + 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x48, 0x02, 0x52, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf6, 0x03, 0x0a, 0x1f, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, + 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x4d, 0x0a, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, + 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4a, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x49, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x72, 0x64, - 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, - 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, - 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4f, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, - 0x64, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, + 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, + 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, + 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4e, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, + 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x73, 0x4d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, + 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, + 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x22, 0x9f, 0x01, 0x0a, 0x31, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x65, 0x78, + 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0xa7, 0x01, 0x0a, 0x33, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4e, + 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xad, 0x04, + 0x0a, 0x2a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, + 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, + 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x58, 0x0a, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3b, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, + 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x54, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, + 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, + 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x54, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x36, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, + 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x59, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x45, + 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x4e, 0x65, 0x78, 0x74, 0x45, 0x78, 0x74, 0x65, + 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, + 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, + 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, + 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, + 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8c, 0x01, + 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, + 0x76, 0x32, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, + 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, + 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, + 0x32, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x22, 0xce, 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x45, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, + 0x70, 0x76, 0x32, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, @@ -138812,18 +138792,18 @@ var file_otg_proto_rawDesc = []byte{ 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x95, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x50, 0x69, 0x67, 0x67, 0x79, 0x62, 0x61, + 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, + 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9d, 0x01, 0x0a, - 0x29, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, - 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, + 0x29, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, + 0x32, 0x50, 0x69, 0x67, 0x67, 0x79, 0x62, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x6c, 0x61, + 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, @@ -138831,30 +138811,30 @@ var file_otg_proto_rawDesc = []byte{ 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xfb, 0x03, 0x0a, - 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, - 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, - 0x72, 0x12, 0x4e, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, + 0x32, 0x50, 0x69, 0x67, 0x67, 0x79, 0x62, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x6c, 0x61, + 0x67, 0x12, 0x4e, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, + 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x50, 0x69, 0x67, 0x67, 0x79, 0x62, 0x61, 0x63, + 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x6c, 0x61, 0x67, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, - 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x50, 0x69, + 0x67, 0x67, 0x79, 0x62, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x50, 0x69, 0x67, 0x67, 0x79, 0x62, + 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4f, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x50, 0x69, 0x67, 0x67, 0x79, 0x62, 0x61, 0x63, + 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x6c, 0x61, 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, @@ -138862,46 +138842,786 @@ var file_otg_proto_rawDesc = []byte{ 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, - 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, - 0x6f, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, - 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, - 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x22, 0xce, 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, 0x45, 0x0a, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, - 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8d, 0x01, 0x0a, 0x1f, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, + 0x65, 0x69, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, + 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, + 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x95, 0x01, 0x0a, 0x21, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, + 0x65, 0x69, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x22, 0xd3, 0x03, 0x0a, 0x18, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x12, + 0x46, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x2e, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, + 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x42, + 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, 0x46, 0x6c, 0x61, 0x67, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, + 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, + 0x69, 0x64, 0x46, 0x6c, 0x61, 0x67, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, + 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, + 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, + 0x72, 0x65, 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, + 0x31, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, + 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, 0x0a, + 0x16, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, + 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x31, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, + 0x61, 0x72, 0x65, 0x31, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, + 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x12, 0x40, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x31, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, + 0x65, 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, + 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, + 0x53, 0x70, 0x61, 0x72, 0x65, 0x31, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, + 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, + 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x90, 0x01, 0x0a, 0x22, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, + 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, + 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x98, 0x01, 0x0a, 0x24, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe2, 0x03, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x49, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x12, 0x45, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, + 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, + 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, + 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, + 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, + 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x92, 0x01, 0x0a, 0x24, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, + 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x9a, 0x01, 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xec, 0x03, + 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, + 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, + 0x4b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, + 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x47, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, + 0x76, 0x32, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x4c, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, + 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, + 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, + 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, + 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, + 0x32, 0x54, 0x65, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, + 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, + 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, + 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xbf, 0x03, 0x0a, + 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, + 0x32, 0x54, 0x65, 0x69, 0x64, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, + 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3e, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x54, 0x65, 0x69, 0x64, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, + 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, + 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, + 0x70, 0x76, 0x32, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9b, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x22, 0xf1, 0x03, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x65, 0x71, 0x75, + 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, - 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, - 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, - 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x4d, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, + 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, + 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, + 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, + 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8b, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, + 0x32, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x32, 0x4d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, + 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, + 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc9, 0x03, 0x0a, 0x16, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, + 0x70, 0x61, 0x72, 0x65, 0x32, 0x12, 0x44, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, + 0x65, 0x32, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, + 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x40, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x32, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x40, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, 0x61, 0x72, 0x65, 0x32, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, + 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x47, 0x74, 0x70, 0x76, 0x32, 0x53, 0x70, + 0x61, 0x72, 0x65, 0x32, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, + 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, + 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8f, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x97, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, + 0x61, 0x72, 0x65, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x22, 0xdd, 0x03, 0x0a, 0x1a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x48, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, + 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x44, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, + 0x77, 0x61, 0x72, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x54, 0x79, 0x70, 0x65, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, + 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, + 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, + 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, + 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0x8f, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, + 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x97, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, + 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xdd, + 0x03, 0x0a, 0x1a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, + 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x48, 0x0a, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, + 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x44, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, + 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x44, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, + 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x91, + 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, + 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x4c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe7, + 0x03, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, + 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, + 0x4a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, + 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x46, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x4c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, + 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, + 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, + 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, + 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, + 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, + 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe7, 0x03, 0x0a, 0x1c, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x4a, 0x0a, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, + 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x46, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, + 0x72, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, + 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, + 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, + 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, + 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x41, 0x72, 0x70, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, + 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x41, 0x72, 0x70, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xce, 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x4f, 0x70, 0x65, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, + 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, + 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x4f, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x95, 0x01, 0x0a, 0x27, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, + 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, + 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x22, 0x9d, 0x01, 0x0a, 0x29, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, + 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, + 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, + 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x22, 0xfb, 0x03, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, + 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x12, 0x4e, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, + 0x72, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, + 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, + 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x4f, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, + 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, + 0x72, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x95, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, + 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9d, 0x01, 0x0a, 0x29, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, + 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xfb, 0x03, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x12, 0x4e, 0x0a, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, + 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, + 0x64, 0x64, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, + 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x4a, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x41, 0x72, 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4f, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, + 0x70, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, + 0x64, 0x64, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, + 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, + 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x95, 0x01, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, + 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, + 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9d, 0x01, + 0x0a, 0x29, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, + 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, + 0x64, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xfb, 0x03, + 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, + 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, + 0x64, 0x72, 0x12, 0x4e, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x72, + 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x48, 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, + 0x61, 0x72, 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4f, 0x0a, + 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x48, 0x61, 0x72, + 0x64, 0x77, 0x61, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, + 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, + 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, + 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, + 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x95, 0x01, 0x0a, 0x27, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, + 0x72, 0x67, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0x9d, 0x01, 0x0a, 0x29, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x22, 0xfb, 0x03, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x12, 0x4e, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x2e, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4a, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x41, 0x64, 0x64, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, + 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, + 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x4f, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, + 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x41, 0x72, 0x70, 0x54, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, @@ -138911,7 +139631,7 @@ var file_otg_proto_rawDesc = []byte{ 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, + 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, @@ -138920,7 +139640,7 @@ var file_otg_proto_rawDesc = []byte{ 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x72, + 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, @@ -138929,10 +139649,10 @@ var file_otg_proto_rawDesc = []byte{ 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xce, 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x43, - 0x6f, 0x64, 0x65, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, @@ -138940,16 +139660,16 @@ var file_otg_proto_rawDesc = []byte{ 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, + 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, - 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, + 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, @@ -138957,124 +139677,399 @@ var file_otg_proto_rawDesc = []byte{ 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xf4, 0x02, 0x0a, 0x1b, 0x50, 0x61, 0x74, + 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x49, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, - 0x68, 0x6f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x52, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x43, + 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xce, + 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, + 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, + 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, + 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, + 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0xf4, 0x02, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, + 0x49, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, + 0x6d, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x52, 0x0a, 0x09, 0x67, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, + 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x01, + 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1b, + 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, 0x0a, 0x06, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, + 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, + 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, + 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x08, 0x0a, 0x04, 0x67, 0x6f, 0x6f, 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x62, 0x61, 0x64, + 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x0a, + 0x0a, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x22, 0x92, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, + 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, + 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x26, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, + 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, + 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, + 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xec, 0x03, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x01, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, - 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, - 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x32, - 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, - 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x22, - 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x67, 0x6f, 0x6f, 0x64, - 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x62, 0x61, 0x64, 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x22, - 0x92, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, + 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2e, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x47, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x0b, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x66, 0x69, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, + 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x96, 0x01, 0x0a, 0x28, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x53, + 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, + 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x9e, 0x01, 0x0a, 0x2a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, + 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, + 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x22, 0x80, 0x04, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x4f, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, + 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, + 0x70, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x50, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, + 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, + 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, + 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, + 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, + 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x22, 0xfa, 0x02, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x4b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x43, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x54, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x43, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x01, 0x52, 0x09, 0x67, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x63, 0x75, 0x73, + 0x74, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x63, 0x75, 0x73, + 0x74, 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x22, 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, + 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x67, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, + 0x6f, 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, + 0x64, 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, + 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x67, 0x6f, + 0x6f, 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x62, 0x61, 0x64, 0x10, 0x02, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x67, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x22, 0x98, 0x01, 0x0a, 0x2a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, + 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa0, 0x01, 0x0a, + 0x2c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, + 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, + 0x66, 0x69, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, + 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, + 0x8a, 0x04, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, + 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, + 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4d, 0x0a, + 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x52, 0x0a, 0x0b, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, + 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, + 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9c, 0x01, 0x0a, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, + 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, + 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, + 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, + 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa4, 0x01, 0x0a, 0x30, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, + 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, + 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x22, 0x9e, 0x04, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, + 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x55, + 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x53, 0x65, + 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, + 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x51, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, + 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x53, 0x65, 0x71, 0x75, 0x65, + 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x53, 0x65, + 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x56, + 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, + 0x6c, 0x64, 0x73, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, + 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, + 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, + 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0x8e, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, + 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, - 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, - 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, - 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x22, 0xec, 0x03, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, - 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, - 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x12, 0x47, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, - 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x96, 0x01, 0x0a, 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, + 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xd8, 0x03, + 0x0a, 0x19, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, + 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x12, 0x47, 0x0a, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, + 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, - 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, - 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, - 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, - 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x96, 0x01, 0x0a, 0x28, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, - 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x48, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, + 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, + 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, + 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, + 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8e, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, + 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9e, 0x01, 0x0a, 0x2a, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, - 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x80, 0x04, 0x0a, 0x21, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, - 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x12, 0x4f, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x32, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, - 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, - 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, - 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x96, 0x01, 0x0a, 0x22, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, + 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x22, 0xd8, 0x03, 0x0a, 0x19, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, + 0x12, 0x47, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, + 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x4b, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, - 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x50, - 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, - 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x74, 0x12, 0x43, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, + 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, + 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, @@ -139082,86 +140077,9 @@ var file_otg_proto_rawDesc = []byte{ 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xfa, 0x02, - 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, - 0x70, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, - 0x4b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x63, 0x6d, 0x70, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x73, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, - 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x54, 0x0a, 0x09, - 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x63, 0x6d, 0x70, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x43, 0x68, 0x65, 0x63, 0x6b, - 0x73, 0x75, 0x6d, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x48, 0x01, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, - 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, - 0x3c, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, - 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, - 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, - 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, - 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, - 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, - 0x64, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x67, 0x6f, 0x6f, 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, - 0x03, 0x62, 0x61, 0x64, 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x22, 0x98, 0x01, 0x0a, 0x2a, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, - 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa0, 0x01, 0x0a, 0x2c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x8a, 0x04, 0x0a, 0x23, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, - 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, - 0x12, 0x51, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x34, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, - 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, - 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, - 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x52, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, - 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, - 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9c, 0x01, 0x0a, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, - 0x6c, 0x64, 0x73, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, + 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x94, 0x01, + 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, + 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, @@ -139169,43 +140087,40 @@ var file_otg_proto_rawDesc = []byte{ 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa4, 0x01, 0x0a, 0x30, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, - 0x64, 0x73, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, - 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x9e, 0x04, 0x0a, 0x27, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, - 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, - 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x55, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, - 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x12, 0x51, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, - 0x65, 0x6c, 0x64, 0x73, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, - 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x4e, 0x65, 0x78, - 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x56, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x6f, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9c, 0x01, 0x0a, 0x28, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, + 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x22, 0xf6, 0x03, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, + 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x4d, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, + 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x49, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, - 0x6d, 0x70, 0x4e, 0x65, 0x78, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x53, 0x65, 0x71, 0x75, - 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, + 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, + 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x4e, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, + 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, @@ -139213,199 +140128,146 @@ var file_otg_proto_rawDesc = []byte{ 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8e, 0x01, 0x0a, - 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, - 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, - 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x96, 0x01, - 0x0a, 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, - 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xd8, 0x03, 0x0a, 0x19, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x47, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, - 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x12, 0x43, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x54, - 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x98, 0x01, 0x0a, + 0x2a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, + 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa0, 0x01, 0x0a, 0x2c, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, + 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, + 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, + 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, + 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x8a, 0x04, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, - 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x0b, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, - 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x8e, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, - 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0x96, 0x01, 0x0a, 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, - 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xd8, 0x03, 0x0a, 0x19, + 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x12, 0x51, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, + 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, + 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, + 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, + 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x52, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, + 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, + 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, + 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xfa, 0x02, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, + 0x6f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x4b, 0x0a, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, - 0x36, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x47, 0x0a, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x36, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x54, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, - 0x36, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x36, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x01, 0x52, 0x09, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, + 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, + 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, 0x0a, 0x06, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x22, 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, + 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x63, + 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, + 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x08, 0x0a, + 0x04, 0x67, 0x6f, 0x6f, 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x62, 0x61, 0x64, 0x10, 0x02, + 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x75, + 0x73, 0x74, 0x6f, 0x6d, 0x22, 0x80, 0x03, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x4d, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, - 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x48, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, - 0x43, 0x6f, 0x64, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x94, 0x01, 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, - 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, - 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9c, 0x01, - 0x0a, 0x28, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, - 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, - 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xf6, 0x03, 0x0a, - 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, - 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, - 0x12, 0x4d, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x30, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x12, 0x49, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, - 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4e, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, - 0x69, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x98, 0x01, 0x0a, 0x2a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x53, - 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, - 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0xa0, 0x01, 0x0a, 0x2c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, - 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, - 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x22, 0x8a, 0x04, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, - 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x51, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, - 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x12, 0x4d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, - 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x4d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x53, - 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x52, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, - 0x53, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4d, 0x65, + 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x56, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, + 0x76, 0x36, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, + 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, + 0x01, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, + 0x1b, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x0d, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, + 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, + 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, + 0x12, 0x08, 0x0a, 0x04, 0x67, 0x6f, 0x6f, 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x62, 0x61, + 0x64, 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x0c, + 0x0a, 0x0a, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x22, 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x50, 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x50, 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, + 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, @@ -139414,56 +140276,8 @@ var file_otg_proto_rawDesc = []byte{ 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0xfa, 0x02, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, - 0x75, 0x6d, 0x12, 0x4b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x54, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x45, 0x63, 0x68, 0x6f, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, - 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x01, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x88, - 0x01, 0x01, 0x1a, 0x3c, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x32, 0x0a, 0x04, - 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, - 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x10, 0x02, - 0x1a, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x22, 0x2a, 0x0a, - 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x67, 0x6f, 0x6f, 0x64, 0x10, 0x01, - 0x12, 0x07, 0x0a, 0x03, 0x62, 0x61, 0x64, 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x22, 0x80, 0x03, - 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, - 0x70, 0x76, 0x36, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, - 0x6d, 0x12, 0x4d, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x30, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, - 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x56, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x63, 0x6d, 0x70, 0x76, 0x36, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, - 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x01, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, - 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, - 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, - 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, - 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, - 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x67, 0x6f, 0x6f, - 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x62, 0x61, 0x64, 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x67, 0x65, 0x6e, 0x65, - 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x22, 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x50, 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x50, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, @@ -139472,7 +140286,7 @@ var file_otg_proto_rawDesc = []byte{ 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, @@ -139481,26 +140295,26 @@ var file_otg_proto_rawDesc = []byte{ 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x50, 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x43, 0x0a, 0x06, + 0x6f, 0x77, 0x50, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, - 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, + 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x74, + 0x72, 0x6f, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x43, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, @@ -139508,145 +140322,145 @@ var file_otg_proto_rawDesc = []byte{ 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x43, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x50, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x44, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, - 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, - 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x8f, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x50, 0x70, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, - 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x97, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, - 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, - 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x89, - 0x04, 0x0a, 0x1a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, - 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x48, 0x0a, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, - 0x70, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x04, 0x61, 0x75, - 0x74, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x04, 0x61, 0x75, 0x74, 0x6f, - 0x88, 0x01, 0x01, 0x12, 0x44, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, - 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x49, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x08, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8f, 0x01, 0x0a, 0x21, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x50, 0x72, 0x6f, 0x74, + 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, + 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, + 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x97, 0x01, 0x0a, 0x23, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x50, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, + 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x89, 0x04, 0x0a, 0x1a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x48, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, - 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x60, 0x0a, 0x06, 0x43, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x22, 0x56, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, - 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x10, 0x01, 0x12, 0x0d, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x22, 0x8d, 0x01, 0x0a, 0x1f, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x95, 0x01, 0x0a, 0x21, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, - 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x22, 0xd3, 0x03, 0x0a, 0x18, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x46, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x67, 0x6d, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x42, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, - 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x6c, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x17, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x88, 0x01, 0x01, 0x12, 0x44, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, + 0x70, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x44, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x50, 0x70, 0x70, + 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, + 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x73, 0x1a, 0x60, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x56, 0x0a, 0x04, 0x45, + 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x61, + 0x75, 0x74, 0x6f, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x61, 0x75, 0x74, + 0x6f, 0x22, 0x8d, 0x01, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, + 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x22, 0x95, 0x01, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xd3, 0x03, 0x0a, 0x18, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x46, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x42, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x42, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x67, 0x6d, 0x70, 0x76, 0x31, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, + 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, + 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, + 0x76, 0x31, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, + 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, + 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x54, 0x79, 0x70, 0x65, 0x12, 0x43, 0x0a, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, + 0x70, 0x76, 0x31, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, + 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x54, 0x79, + 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x54, + 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, + 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, + 0x76, 0x31, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, @@ -139654,45 +140468,119 @@ var file_otg_proto_rawDesc = []byte{ 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x1c, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x54, 0x79, - 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x55, 0x6e, + 0x75, 0x73, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x55, 0x6e, 0x75, + 0x73, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xce, + 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, + 0x6d, 0x70, 0x76, 0x31, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, + 0x76, 0x31, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x55, + 0x6e, 0x75, 0x73, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, + 0x76, 0x31, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, + 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0xee, 0x02, 0x0a, 0x19, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x67, 0x6d, 0x70, 0x76, 0x31, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x47, 0x0a, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, + 0x67, 0x6d, 0x70, 0x76, 0x31, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x50, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, + 0x31, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x01, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, + 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, + 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, + 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, + 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, + 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, + 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, + 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x67, 0x6f, 0x6f, + 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x62, 0x61, 0x64, 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, + 0x22, 0x92, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x54, 0x79, 0x70, 0x65, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xc4, 0x03, 0x0a, 0x15, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x43, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x54, 0x79, 0x70, 0x65, - 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3f, 0x0a, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9a, 0x01, 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x22, 0xec, 0x03, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x4b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x12, 0x47, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x21, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x44, - 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x54, 0x79, 0x70, 0x65, 0x4d, + 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, + 0x70, 0x76, 0x31, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, @@ -139701,279 +140589,57 @@ var file_otg_proto_rawDesc = []byte{ 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, - 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0x94, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, - 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, - 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xce, 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x55, 0x6e, 0x75, - 0x73, 0x65, 0x64, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x55, 0x6e, 0x75, 0x73, 0x65, - 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x55, 0x6e, 0x75, 0x73, 0x65, - 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, - 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, - 0x55, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, - 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, - 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xee, 0x02, 0x0a, 0x19, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x47, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x50, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, - 0x75, 0x6d, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x48, 0x01, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, - 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, - 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, - 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, - 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, + 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, + 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, + 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, + 0x73, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, + 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, + 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x22, 0xeb, 0x03, 0x0a, 0x14, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, + 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x17, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x88, 0x01, 0x01, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, + 0x70, 0x6c, 0x73, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, + 0x70, 0x6c, 0x73, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, + 0x60, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x56, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, - 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x67, 0x6f, 0x6f, 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, - 0x62, 0x61, 0x64, 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x22, 0x92, 0x01, 0x0a, 0x24, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x47, - 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, - 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, - 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x9a, - 0x01, 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, - 0x6d, 0x70, 0x76, 0x31, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xec, 0x03, 0x0a, 0x1d, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, - 0x31, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4b, 0x0a, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2e, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, - 0x67, 0x6d, 0x70, 0x76, 0x31, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x47, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, - 0x31, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x4c, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x49, 0x67, 0x6d, 0x70, 0x76, 0x31, 0x47, 0x72, 0x6f, 0x75, - 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, - 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, - 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, - 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, - 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x89, 0x01, 0x0a, 0x1b, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x91, 0x01, 0x0a, 0x1d, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x4d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, - 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, - 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xeb, 0x03, 0x0a, 0x14, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x12, 0x42, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x2e, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x04, 0x61, 0x75, - 0x74, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x04, 0x61, 0x75, 0x74, 0x6f, - 0x88, 0x01, 0x01, 0x12, 0x3e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x4c, 0x61, 0x62, 0x65, - 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x4c, 0x61, 0x62, 0x65, - 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, - 0x67, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, - 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x60, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x22, 0x56, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x22, 0x90, 0x01, 0x0a, 0x22, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x72, 0x61, 0x66, - 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, - 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, - 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, - 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x98, 0x01, 0x0a, 0x24, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, - 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe2, 0x03, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, - 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x49, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x72, 0x61, 0x66, - 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, - 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x12, 0x45, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x72, 0x61, - 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, - 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x72, 0x61, - 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, - 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, - 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, - 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x23, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x42, - 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x4f, 0x66, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, - 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, - 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, - 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, - 0x99, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, - 0x70, 0x6c, 0x73, 0x42, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x4f, 0x66, 0x53, 0x74, 0x61, 0x63, 0x6b, - 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0x93, 0x04, 0x0a, 0x1c, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x42, - 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x4f, 0x66, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x12, 0x4a, 0x0a, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, - 0x6c, 0x73, 0x42, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x4f, 0x66, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x2e, - 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x04, 0x61, - 0x75, 0x74, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x04, 0x61, 0x75, 0x74, - 0x6f, 0x88, 0x01, 0x01, 0x12, 0x46, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x42, 0x6f, 0x74, - 0x74, 0x6f, 0x6d, 0x4f, 0x66, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x42, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x4f, 0x66, 0x53, 0x74, 0x61, - 0x63, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, - 0x61, 0x67, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x42, - 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x4f, 0x66, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x4d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, - 0x73, 0x1a, 0x60, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x56, 0x0a, 0x04, 0x45, - 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x61, - 0x75, 0x74, 0x6f, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x61, 0x75, 0x74, - 0x6f, 0x22, 0x8e, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x43, + 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x61, 0x75, 0x74, + 0x6f, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, + 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x22, + 0x90, 0x01, 0x0a, 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, + 0x70, 0x6c, 0x73, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, @@ -139981,277 +140647,209 @@ var file_otg_proto_rawDesc = []byte{ 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0x96, 0x01, 0x0a, 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, - 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, - 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xd8, 0x03, 0x0a, 0x19, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, - 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x12, 0x47, 0x0a, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, - 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x69, - 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, + 0x6e, 0x74, 0x22, 0x98, 0x01, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x12, 0x17, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x88, 0x01, + 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x88, 0x01, 0x01, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6f, 0x66, 0x66, 0x73, + 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x22, 0xe2, 0x03, + 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, + 0x73, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x49, 0x0a, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, - 0x70, 0x6c, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x48, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, - 0x4c, 0x69, 0x76, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, - 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8e, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, - 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8e, 0x03, 0x0a, 0x19, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x47, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x12, 0x43, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, - 0x32, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, - 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, - 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, - 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, - 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa2, - 0x03, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, - 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, - 0x64, 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, 0x44, 0x55, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, 0x44, - 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, - 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, - 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x94, 0x01, 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, 0x44, 0x55, 0x45, 0x72, 0x72, - 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa6, 0x03, 0x0a, 0x1f, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, - 0x63, 0x50, 0x44, 0x55, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x4d, - 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, + 0x70, 0x6c, 0x73, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x2e, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x45, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, 0x44, 0x55, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, - 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x12, 0x49, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, 0x44, 0x55, 0x45, - 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, + 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x72, 0x61, 0x66, 0x66, + 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x0b, 0x6d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, 0x44, 0x55, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, - 0x6e, 0x64, 0x65, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, - 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, - 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x97, 0x01, 0x0a, 0x29, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, - 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x05, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, - 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xb2, 0x03, - 0x0a, 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, - 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x49, 0x64, 0x12, 0x50, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, - 0x6b, 0x50, 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x2e, 0x43, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x05, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4c, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, - 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, - 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, + 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x72, 0x61, 0x66, 0x66, 0x69, 0x63, 0x43, 0x6c, 0x61, 0x73, 0x73, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0xfe, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, 0x55, - 0x4e, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x72, 0x73, 0x12, 0x53, 0x0a, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, - 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, 0x55, 0x4e, 0x6f, 0x6e, 0x52, - 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x72, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, - 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x1a, 0x38, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x2e, - 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, - 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x9c, 0x01, 0x0a, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, - 0x55, 0x4d, 0x61, 0x78, 0x52, 0x65, 0x70, 0x65, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, - 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0xc6, 0x03, 0x0a, 0x27, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, 0x55, - 0x4d, 0x61, 0x78, 0x52, 0x65, 0x70, 0x65, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, - 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, + 0x75, 0x65, 0x22, 0x91, 0x01, 0x0a, 0x23, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x42, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x4f, 0x66, 0x53, 0x74, + 0x61, 0x63, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x99, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x42, 0x6f, 0x74, 0x74, 0x6f, 0x6d, + 0x4f, 0x66, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x22, 0x93, 0x04, 0x0a, 0x1c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x42, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x4f, 0x66, 0x53, 0x74, + 0x61, 0x63, 0x6b, 0x12, 0x4a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x42, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x4f, + 0x66, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, + 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x12, 0x17, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x88, 0x01, 0x01, 0x12, 0x46, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, 0x55, 0x4d, 0x61, - 0x78, 0x52, 0x65, 0x70, 0x65, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x68, 0x6f, + 0x4d, 0x70, 0x6c, 0x73, 0x42, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x4f, 0x66, 0x53, 0x74, 0x61, 0x63, + 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x46, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x42, 0x6f, 0x74, 0x74, + 0x6f, 0x6d, 0x4f, 0x66, 0x53, 0x74, 0x61, 0x63, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x0b, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x42, 0x6f, 0x74, 0x74, 0x6f, 0x6d, 0x4f, 0x66, 0x53, 0x74, + 0x61, 0x63, 0x6b, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, + 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, 0x1a, 0x60, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x22, 0x56, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, + 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x6f, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, + 0x07, 0x0a, 0x05, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x22, 0x8e, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x69, 0x6d, 0x65, + 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x96, 0x01, 0x0a, 0x22, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x69, 0x6d, + 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, + 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x06, 0x6f, 0x66, 0x66, + 0x73, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x22, 0xd8, 0x03, 0x0a, 0x19, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, + 0x12, 0x47, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, + 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x43, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, 0x73, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, + 0x4c, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x5f, 0x74, 0x61, 0x67, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x4d, 0x70, 0x6c, + 0x73, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x54, 0x61, 0x67, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x61, 0x67, 0x73, + 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, + 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, + 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, + 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8e, 0x01, + 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, + 0x70, 0x76, 0x32, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, + 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, + 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8e, + 0x03, 0x0a, 0x19, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, + 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x47, 0x0a, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, + 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, - 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x51, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6f, 0x74, + 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, - 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, 0x55, 0x4d, 0x61, 0x78, 0x52, 0x65, - 0x70, 0x65, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, 0x55, 0x4d, 0x61, - 0x78, 0x52, 0x65, 0x70, 0x65, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, - 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, - 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa7, 0x01, 0x0a, 0x39, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, - 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, - 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x70, 0x76, 0x32, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0x93, 0x01, 0x0a, 0x25, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, + 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xf2, 0x03, 0x0a, 0x32, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, - 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x60, 0x0a, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x43, 0x2e, 0x6f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa2, 0x03, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, 0x44, 0x55, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x4c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, + 0x63, 0x50, 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x05, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x48, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, - 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, - 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x12, 0x5c, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, - 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x5c, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, - 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, - 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, + 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x48, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, + 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, @@ -140259,84 +140857,127 @@ var file_otg_proto_rawDesc = []byte{ 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x3b, 0x50, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x94, 0x01, 0x0a, 0x26, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, - 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xfa, 0x03, 0x0a, 0x34, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, - 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x49, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x62, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x45, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, - 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x70, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, - 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, - 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, - 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, - 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, - 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, - 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0xa7, 0x01, 0x0a, 0x39, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, - 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, - 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xf2, 0x03, - 0x0a, 0x32, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, - 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, - 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x60, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x43, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, - 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x43, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5c, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, - 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, - 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5c, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, + 0x63, 0x50, 0x44, 0x55, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, + 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x22, 0xa6, 0x03, 0x0a, 0x1f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, 0x44, 0x55, 0x45, 0x72, 0x72, 0x6f, 0x72, + 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x4d, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x30, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, 0x44, + 0x55, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x49, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, - 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, - 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x76, 0x32, 0x63, 0x50, 0x44, 0x55, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x49, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x50, 0x44, + 0x55, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, + 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, + 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, + 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x97, 0x01, 0x0a, 0x29, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, + 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, + 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x02, 0x52, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xb2, 0x03, 0x0a, 0x22, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, + 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x50, 0x0a, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, + 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x49, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, + 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x12, 0x4c, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, + 0x50, 0x44, 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4c, + 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x2e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, + 0x55, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xfe, 0x01, 0x0a, 0x25, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, + 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, 0x55, 0x4e, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, + 0x65, 0x72, 0x73, 0x12, 0x53, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x36, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, + 0x50, 0x44, 0x55, 0x4e, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x72, 0x73, 0x2e, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x1a, 0x38, 0x0a, 0x06, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x2e, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, + 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x10, 0x03, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9c, 0x01, 0x0a, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, + 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, 0x55, 0x4d, 0x61, 0x78, 0x52, 0x65, 0x70, 0x65, 0x74, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xc6, 0x03, 0x0a, 0x27, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, + 0x42, 0x75, 0x6c, 0x6b, 0x50, 0x44, 0x55, 0x4d, 0x61, 0x78, 0x52, 0x65, 0x70, 0x65, 0x74, 0x69, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x55, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x38, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, + 0x6c, 0x6b, 0x50, 0x44, 0x55, 0x4d, 0x61, 0x78, 0x52, 0x65, 0x70, 0x65, 0x74, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, + 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x51, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, 0x6c, 0x6b, 0x50, + 0x44, 0x55, 0x4d, 0x61, 0x78, 0x52, 0x65, 0x70, 0x65, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x51, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x33, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x42, 0x75, + 0x6c, 0x6b, 0x50, 0x44, 0x55, 0x4d, 0x61, 0x78, 0x52, 0x65, 0x70, 0x65, 0x74, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, @@ -140344,165 +140985,83 @@ var file_otg_proto_rawDesc = []byte{ 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x3b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x75, 0x65, 0x22, 0xa7, 0x01, 0x0a, 0x39, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, - 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x54, 0x69, 0x6d, - 0x65, 0x74, 0x69, 0x63, 0x6b, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, - 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, - 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xfa, - 0x03, 0x0a, 0x34, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, - 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, - 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x74, 0x69, 0x63, - 0x6b, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x62, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x45, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, - 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x74, 0x69, 0x63, 0x6b, 0x73, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, - 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5e, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x40, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, - 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x54, 0x69, - 0x6d, 0x65, 0x74, 0x69, 0x63, 0x6b, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5e, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x40, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, - 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x54, 0x69, - 0x6d, 0x65, 0x74, 0x69, 0x63, 0x6b, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, - 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, - 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x3c, + 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x6e, 0x74, + 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, + 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x05, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, + 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xf2, 0x03, 0x0a, + 0x32, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, + 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, + 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x12, 0x60, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x43, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, + 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, + 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5c, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, + 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, + 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5c, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, - 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x69, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x04, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x48, - 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xfe, 0x03, 0x0a, 0x35, 0x50, 0x61, 0x74, + 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, + 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, + 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x3b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, + 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x70, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, + 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xfa, 0x03, + 0x0a, 0x34, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, + 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, + 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x62, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x45, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x42, 0x69, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x12, 0x63, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x46, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, - 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, - 0x69, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x04, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5f, 0x0a, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, - 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, - 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x69, 0x67, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5f, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, - 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x69, 0x67, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, - 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, - 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, - 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xaf, 0x01, 0x0a, 0x41, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, - 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x55, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x49, 0x6e, 0x74, 0x65, - 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, - 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, - 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, - 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x04, 0x0a, 0x3a, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, - 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, - 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x55, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x49, 0x6e, - 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x68, 0x0a, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x4b, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, - 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, - 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x55, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x49, - 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x64, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, - 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, - 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x55, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x49, - 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x64, 0x0a, + 0x6c, 0x75, 0x65, 0x49, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5e, 0x0a, + 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x40, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, + 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x70, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x46, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x32, 0x40, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, - 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x55, 0x6e, 0x73, - 0x69, 0x67, 0x6e, 0x65, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, - 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, - 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x96, 0x01, 0x0a, 0x28, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xae, 0x03, 0x0a, 0x21, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, - 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, - 0x4f, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x32, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, - 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, - 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x43, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x4b, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x43, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x49, 0x70, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, @@ -140510,338 +141069,41 @@ var file_otg_proto_rawDesc = []byte{ 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xf4, 0x02, 0x0a, 0x1b, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x52, 0x73, - 0x76, 0x70, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x12, 0x49, 0x0a, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, - 0x52, 0x73, 0x76, 0x70, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x52, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, - 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x52, 0x73, - 0x76, 0x70, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, - 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x01, 0x52, 0x09, 0x67, 0x65, 0x6e, - 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1b, 0x0a, 0x06, 0x63, 0x75, 0x73, - 0x74, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x06, 0x63, 0x75, 0x73, - 0x74, 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x22, 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x67, 0x65, 0x6e, - 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, - 0x6f, 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, - 0x64, 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, - 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x67, 0x6f, - 0x6f, 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x62, 0x61, 0x64, 0x10, 0x02, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x67, 0x65, 0x6e, - 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, - 0x6d, 0x22, 0x8e, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x52, 0x73, 0x76, 0x70, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, - 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0x8e, 0x03, 0x0a, 0x19, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, - 0x12, 0x47, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, - 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x52, 0x73, 0x76, 0x70, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x43, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, - 0x4c, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, - 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, - 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, - 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, - 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0x86, 0x03, 0x0a, 0x17, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x45, - 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x73, 0x76, 0x70, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, - 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, - 0x70, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x73, 0x76, 0x70, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, - 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, - 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xb5, 0x01, 0x0a, 0x47, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, - 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, - 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, - 0x6c, 0x45, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, - 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0xaa, 0x04, 0x0a, 0x40, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, - 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x45, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, - 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x6e, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x51, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, - 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, - 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, - 0x45, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, - 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x6a, 0x0a, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4c, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, - 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, - 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x45, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x6a, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4c, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, - 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, - 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, - 0x65, 0x6c, 0x45, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, - 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, - 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0xa4, 0x01, 0x0a, 0x36, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, - 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x52, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, - 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xe6, 0x03, 0x0a, 0x2f, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, - 0x70, 0x76, 0x34, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x5d, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x40, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, - 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, - 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x59, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x3b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x52, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x59, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, - 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, - 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, - 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, - 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0xa4, 0x01, 0x0a, 0x36, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, - 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, - 0x65, 0x6c, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, - 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, - 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xe6, 0x03, 0x0a, 0x2f, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, - 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x5d, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x40, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, - 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, - 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, - 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x59, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x3b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, - 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x59, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, - 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, - 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, - 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, - 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, - 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, - 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0xa3, 0x01, 0x0a, 0x35, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, - 0x78, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x41, 0x73, 0x49, 0x6e, 0x74, 0x65, - 0x67, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xe2, 0x03, 0x0a, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, - 0x41, 0x73, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x12, 0x5c, 0x0a, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, - 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x54, 0x75, 0x6e, - 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x41, 0x73, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, - 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, - 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x41, 0x73, 0x49, 0x6e, 0x74, 0x65, 0x67, - 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x58, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, - 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, - 0x6c, 0x49, 0x64, 0x41, 0x73, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, - 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, - 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa0, 0x01, 0x0a, 0x32, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, - 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x54, 0x75, 0x6e, - 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x41, 0x73, 0x49, 0x70, 0x76, 0x34, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, - 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, - 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, - 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xd6, - 0x03, 0x0a, 0x2b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, - 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, - 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x41, 0x73, 0x49, 0x70, 0x76, 0x34, 0x12, 0x59, - 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3c, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, - 0x78, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x41, 0x73, 0x49, 0x70, 0x76, 0x34, - 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x55, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x37, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x45, 0x78, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x41, 0x73, 0x49, 0x70, 0x76, - 0x34, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x12, 0x55, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, - 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, - 0x49, 0x64, 0x41, 0x73, 0x49, 0x70, 0x76, 0x34, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, - 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9e, 0x01, 0x0a, 0x30, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, - 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, - 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xce, 0x03, 0x0a, 0x29, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, - 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x57, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, - 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x12, 0x53, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, - 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x53, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, - 0x50, 0x61, 0x74, 0x68, 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, 0x76, 0x34, 0x49, - 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa7, 0x01, 0x0a, 0x39, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, + 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xf2, 0x03, 0x0a, 0x32, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, + 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x60, 0x0a, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x43, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, + 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, + 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, + 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x12, 0x5c, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, + 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5c, + 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, + 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, @@ -140850,10 +141112,10 @@ var file_otg_proto_rawDesc = []byte{ 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x3b, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, - 0x68, 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, 0x76, 0x34, 0x4c, 0x6f, 0x67, 0x69, - 0x63, 0x61, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x48, 0x61, 0x6e, 0x64, - 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, + 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x74, 0x69, 0x63, 0x6b, 0x73, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, @@ -140861,30 +141123,30 @@ var file_otg_proto_rawDesc = []byte{ 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xfa, 0x03, 0x0a, 0x34, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x73, 0x76, - 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, 0x76, 0x34, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, 0x49, - 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x62, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, + 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x54, 0x69, 0x6d, 0x65, 0x74, 0x69, 0x63, 0x6b, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x62, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x45, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, - 0x70, 0x76, 0x34, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, - 0x61, 0x63, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, + 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x74, + 0x69, 0x63, 0x6b, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, - 0x74, 0x68, 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, 0x76, 0x34, 0x4c, 0x6f, 0x67, - 0x69, 0x63, 0x61, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x48, 0x61, 0x6e, - 0x64, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, + 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x74, 0x69, 0x63, 0x6b, 0x73, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x40, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, - 0x74, 0x68, 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, 0x76, 0x34, 0x4c, 0x6f, 0x67, - 0x69, 0x63, 0x61, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x48, 0x61, 0x6e, - 0x64, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, + 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x74, 0x69, 0x63, 0x6b, 0x73, 0x56, 0x61, + 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, @@ -140892,51 +141154,53 @@ var file_otg_proto_rawDesc = []byte{ 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0xa5, 0x01, 0x0a, 0x37, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x31, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, - 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x52, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xea, 0x03, 0x0a, 0x30, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, - 0x74, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, - 0x31, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x52, 0x12, - 0x5e, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x41, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x31, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x50, - 0x65, 0x72, 0x69, 0x6f, 0x64, 0x52, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, - 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x12, 0x5a, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x54, - 0x69, 0x6d, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x31, 0x52, 0x65, - 0x66, 0x72, 0x65, 0x73, 0x68, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x52, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5a, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x3c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x31, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, - 0x68, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x52, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, - 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa8, 0x01, 0x0a, 0x3a, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, - 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, - 0x31, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4c, 0x42, 0x69, 0x74, 0x43, + 0x75, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x3c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, + 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x69, 0x67, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x04, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, + 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x48, 0x01, 0x52, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, + 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0xfe, 0x03, 0x0a, 0x35, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, + 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, + 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x69, 0x67, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x63, 0x0a, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x46, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, + 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, + 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x69, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x04, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x5f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, + 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x42, 0x69, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x5f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, + 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x42, 0x69, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, + 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, + 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, + 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, + 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0xaf, 0x01, 0x0a, 0x41, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, + 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x55, 0x6e, 0x73, 0x69, 0x67, + 0x6e, 0x65, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, @@ -140944,203 +141208,32 @@ var file_otg_proto_rawDesc = []byte{ 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0xf6, 0x03, 0x0a, 0x33, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, - 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, - 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4c, 0x42, 0x69, 0x74, 0x12, 0x61, 0x0a, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x44, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, - 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, - 0x4c, 0x42, 0x69, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x12, 0x5d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, - 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, - 0x70, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4c, 0x42, 0x69, 0x74, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x5d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, - 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, - 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4c, 0x42, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, - 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, - 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, - 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xaf, 0x01, 0x0a, 0x41, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, - 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x49, - 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, - 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x04, - 0x0a, 0x3a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, - 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, - 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, - 0x78, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x68, 0x0a, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x4b, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, - 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, - 0x69, 0x78, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x43, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x64, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, - 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, - 0x69, 0x78, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x64, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, - 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, - 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, - 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, - 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x38, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, - 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x41, 0x53, 0x4e, 0x75, - 0x6d, 0x62, 0x65, 0x72, 0x4c, 0x42, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, - 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, - 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, - 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, - 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xee, 0x03, 0x0a, 0x31, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, - 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, - 0x54, 0x79, 0x70, 0x65, 0x31, 0x41, 0x53, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4c, 0x42, 0x69, - 0x74, 0x12, 0x5f, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x42, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, - 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x41, 0x53, 0x4e, - 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4c, 0x42, 0x69, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5b, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, - 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x31, 0x41, 0x53, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4c, 0x42, 0x69, 0x74, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x5b, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, - 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, - 0x31, 0x41, 0x53, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4c, 0x42, 0x69, 0x74, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, - 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, - 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, - 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xad, 0x01, 0x0a, - 0x3f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, - 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x67, - 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, - 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8a, 0x04, 0x0a, - 0x38, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, - 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x67, - 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x66, 0x0a, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x49, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, - 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x57, - 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, - 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x12, 0x62, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x44, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, - 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, - 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x62, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x44, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, - 0x50, 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, - 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, - 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, - 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x3c, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, - 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, - 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x33, - 0x70, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xfe, 0x03, 0x0a, 0x35, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, - 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, - 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x33, 0x70, 0x69, 0x64, - 0x12, 0x63, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x46, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, 0x62, - 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x33, 0x70, 0x69, 0x64, 0x2e, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, - 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, - 0x50, 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, - 0x67, 0x65, 0x4c, 0x33, 0x70, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5f, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, - 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, - 0x6e, 0x67, 0x65, 0x4c, 0x33, 0x70, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x6e, 0x74, 0x22, 0x92, 0x04, 0x0a, 0x3a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, + 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x55, 0x6e, 0x73, + 0x69, 0x67, 0x6e, 0x65, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x12, 0x68, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x4b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, + 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x55, 0x6e, + 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, + 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x64, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x46, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, + 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x55, 0x6e, + 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x64, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, + 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x56, + 0x61, 0x6c, 0x75, 0x65, 0x55, 0x6e, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x49, 0x6e, 0x74, 0x65, + 0x67, 0x65, 0x72, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, @@ -141148,255 +141241,173 @@ var file_otg_proto_rawDesc = []byte{ 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xba, 0x01, 0x0a, 0x4c, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, - 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, - 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xbe, 0x04, 0x0a, 0x45, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, - 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, - 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, - 0x6c, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x73, - 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x56, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, - 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, - 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x65, 0x6e, - 0x64, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x6f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x51, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, - 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, - 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, - 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x6f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x51, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, - 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, - 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, - 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, - 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, - 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xab, 0x01, 0x0a, 0x3d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, - 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, - 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, - 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0x82, 0x04, 0x0a, 0x36, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, - 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x64, - 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x47, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, - 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, - 0x70, 0x76, 0x34, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x60, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, - 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, - 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x60, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, - 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, - 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, - 0x34, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, - 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa8, 0x01, 0x0a, 0x3a, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, - 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, - 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x4c, 0x73, 0x70, 0x49, 0x64, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, - 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0xf6, 0x03, 0x0a, 0x33, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, - 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x4c, 0x73, 0x70, 0x49, 0x64, 0x12, 0x61, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x44, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, - 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, - 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, - 0x4c, 0x73, 0x70, 0x49, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x12, 0x5d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, - 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, - 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x4c, 0x73, 0x70, 0x49, 0x64, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x12, 0x5d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, - 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, - 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x4c, 0x73, 0x70, 0x49, 0x64, 0x43, 0x6f, 0x75, - 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, - 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, - 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, - 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa1, 0x01, 0x0a, - 0x33, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, - 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, - 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, + 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x96, 0x01, 0x0a, 0x28, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x43, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, - 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0xda, 0x03, 0x0a, 0x2c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, - 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x5a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x3d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x12, 0x56, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, - 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x56, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x56, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, - 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, - 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, - 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, - 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa3, 0x01, - 0x0a, 0x35, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, - 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, - 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, - 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0xe2, 0x03, 0x0a, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x12, 0x5c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, - 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, - 0x72, 0x76, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x2e, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, - 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, - 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x12, 0x58, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, - 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, - 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, - 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa7, 0x01, 0x0a, 0x39, 0x50, 0x61, 0x74, - 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, - 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, - 0x72, 0x76, 0x4f, 0x76, 0x65, 0x72, 0x61, 0x6c, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, - 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, - 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0xf2, 0x03, 0x0a, 0x32, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4f, 0x76, 0x65, 0x72, - 0x61, 0x6c, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x60, 0x0a, 0x06, 0x63, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x43, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, - 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, - 0x74, 0x53, 0x65, 0x72, 0x76, 0x4f, 0x76, 0x65, 0x72, 0x61, 0x6c, 0x6c, 0x4c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, - 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5c, - 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4f, 0x76, 0x65, - 0x72, 0x61, 0x6c, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5c, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, - 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4f, 0x76, 0x65, 0x72, 0x61, - 0x6c, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x22, 0xae, 0x03, 0x0a, 0x21, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x4f, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x43, + 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x2e, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x05, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, + 0x6e, 0x6d, 0x70, 0x76, 0x32, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4b, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x53, 0x6e, 0x6d, 0x70, + 0x76, 0x32, 0x63, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, + 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, + 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x22, 0xf4, 0x02, 0x0a, 0x1b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x52, 0x73, 0x76, 0x70, 0x52, 0x73, 0x76, 0x70, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, + 0x6d, 0x12, 0x49, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x2c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x52, 0x73, 0x76, 0x70, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x73, 0x75, 0x6d, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, + 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x52, 0x0a, 0x09, + 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x2f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x52, 0x73, 0x76, 0x70, 0x52, 0x73, 0x76, 0x70, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, + 0x6d, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2e, 0x45, 0x6e, 0x75, 0x6d, + 0x48, 0x01, 0x52, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x88, 0x01, 0x01, + 0x12, 0x1b, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x88, 0x01, 0x01, 0x1a, 0x3c, 0x0a, + 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x32, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, + 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, + 0x12, 0x0d, 0x0a, 0x09, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x10, 0x01, 0x12, + 0x0a, 0x0a, 0x06, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x10, 0x02, 0x1a, 0x37, 0x0a, 0x09, 0x47, + 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x22, 0x2a, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, + 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, + 0x00, 0x12, 0x08, 0x0a, 0x04, 0x67, 0x6f, 0x6f, 0x64, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x62, + 0x61, 0x64, 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x0c, 0x0a, 0x0a, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x22, 0x8e, 0x01, 0x0a, 0x20, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x54, 0x69, 0x6d, 0x65, + 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8e, 0x03, 0x0a, 0x19, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x54, 0x69, 0x6d, + 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x12, 0x47, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x54, 0x69, 0x6d, + 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, + 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x12, 0x43, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x54, 0x69, 0x6d, 0x65, + 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x43, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, + 0x70, 0x54, 0x69, 0x6d, 0x65, 0x54, 0x6f, 0x4c, 0x69, 0x76, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, + 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, + 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, + 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x1e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x52, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x86, 0x03, 0x0a, 0x17, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x52, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x45, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x52, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, + 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x41, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x41, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x73, 0x76, 0x70, 0x52, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, + 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, + 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, + 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, + 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0xb5, 0x01, 0x0a, 0x47, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, + 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x45, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, + 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, + 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xaa, 0x04, 0x0a, 0x40, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, + 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, + 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x45, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x6e, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x51, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, + 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x45, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, + 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x12, 0x6a, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, + 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x45, 0x6e, 0x64, + 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x6a, + 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x4c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, + 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x45, 0x6e, 0x64, 0x50, 0x6f, 0x69, 0x6e, + 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, @@ -141404,81 +141415,81 @@ var file_otg_proto_rawDesc = []byte{ 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa7, 0x01, 0x0a, 0x39, 0x50, 0x61, 0x74, 0x74, + 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa4, 0x01, 0x0a, 0x36, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, - 0x76, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, - 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0xf2, 0x03, 0x0a, 0x32, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, - 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x60, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x43, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, - 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, - 0x53, 0x65, 0x72, 0x76, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5c, 0x0a, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5c, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, - 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, - 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, - 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa1, 0x01, 0x0a, 0x33, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, - 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, - 0x5a, 0x65, 0x72, 0x6f, 0x42, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xda, 0x03, 0x0a, 0x2c, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, - 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, - 0x53, 0x65, 0x72, 0x76, 0x5a, 0x65, 0x72, 0x6f, 0x42, 0x69, 0x74, 0x12, 0x5a, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3d, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, - 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, - 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x5a, 0x65, 0x72, 0x6f, 0x42, 0x69, 0x74, 0x2e, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x56, 0x0a, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, - 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, - 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x5a, 0x65, 0x72, 0x6f, 0x42, 0x69, 0x74, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x56, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, + 0x70, 0x76, 0x34, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, + 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, + 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xe6, + 0x03, 0x0a, 0x2f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, + 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x64, 0x12, 0x5d, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x40, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, + 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x12, 0x59, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, + 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x49, 0x70, 0x76, 0x34, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x59, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, + 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, + 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa4, 0x01, 0x0a, 0x36, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, - 0x76, 0x5a, 0x65, 0x72, 0x6f, 0x42, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, + 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, + 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, + 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xe6, + 0x03, 0x0a, 0x2f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, + 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x49, 0x64, 0x12, 0x5d, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x40, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, + 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x12, 0x59, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, + 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x59, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, + 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, @@ -141488,8 +141499,8 @@ var file_otg_proto_rawDesc = []byte{ 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa3, 0x01, 0x0a, 0x35, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, - 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, - 0x76, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x32, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, + 0x64, 0x41, 0x73, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, @@ -141498,13 +141509,13 @@ var file_otg_proto_rawDesc = []byte{ 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xe2, 0x03, 0x0a, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, - 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, - 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x32, + 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x54, + 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x41, 0x73, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x12, 0x5c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x52, 0x65, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x64, 0x32, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x45, 0x78, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x41, 0x73, 0x49, 0x6e, + 0x74, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, @@ -141512,14 +141523,14 @@ var file_otg_proto_rawDesc = []byte{ 0x73, 0x12, 0x58, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, - 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x32, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, + 0x41, 0x73, 0x49, 0x6e, 0x74, 0x65, 0x67, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x58, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, - 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x64, 0x32, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, + 0x78, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x41, 0x73, 0x49, 0x6e, 0x74, 0x65, + 0x67, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, @@ -141527,10 +141538,259 @@ var file_otg_proto_rawDesc = []byte{ 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0xad, 0x01, 0x0a, 0x3f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x43, + 0x75, 0x65, 0x22, 0xa0, 0x01, 0x0a, 0x32, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x45, 0x78, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x41, 0x73, 0x49, 0x70, + 0x76, 0x34, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, + 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xd6, 0x03, 0x0a, 0x2b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x41, + 0x73, 0x49, 0x70, 0x76, 0x34, 0x12, 0x59, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, + 0x64, 0x41, 0x73, 0x49, 0x70, 0x76, 0x34, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, + 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x12, 0x55, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x49, 0x64, 0x41, 0x73, 0x49, 0x70, 0x76, 0x34, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, + 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x55, 0x0a, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x37, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, + 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x45, 0x78, + 0x74, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x41, 0x73, 0x49, 0x70, 0x76, 0x34, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, + 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9e, + 0x01, 0x0a, 0x30, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, 0x76, + 0x34, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, + 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, + 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, + 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0xce, 0x03, 0x0a, 0x29, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, + 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, + 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x57, 0x0a, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3a, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, + 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, + 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x53, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, 0x76, + 0x34, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x53, + 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x35, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x73, 0x76, 0x70, 0x48, + 0x6f, 0x70, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, + 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, + 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, + 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, + 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0xa9, 0x01, 0x0a, 0x3b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, + 0x70, 0x76, 0x34, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, + 0x61, 0x63, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, + 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xfa, 0x03, 0x0a, + 0x34, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, + 0x50, 0x61, 0x74, 0x68, 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, 0x76, 0x34, 0x4c, + 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x48, + 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x62, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x45, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, + 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, 0x49, 0x70, 0x76, 0x34, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x61, + 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, + 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5e, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x40, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, + 0x49, 0x70, 0x76, 0x34, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x72, + 0x66, 0x61, 0x63, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5e, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x40, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x73, 0x76, 0x70, 0x48, 0x6f, 0x70, + 0x49, 0x70, 0x76, 0x34, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x61, 0x6c, 0x49, 0x6e, 0x74, 0x65, 0x72, + 0x66, 0x61, 0x63, 0x65, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa5, 0x01, 0x0a, 0x37, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, + 0x68, 0x54, 0x69, 0x6d, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x31, + 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x52, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, + 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, + 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, + 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x22, 0xea, 0x03, 0x0a, 0x30, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x56, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x31, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x50, + 0x65, 0x72, 0x69, 0x6f, 0x64, 0x52, 0x12, 0x5e, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x41, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, + 0x54, 0x69, 0x6d, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x31, 0x52, + 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x52, 0x2e, 0x43, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, + 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5a, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x54, 0x79, 0x70, 0x65, 0x31, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x50, 0x65, 0x72, 0x69, + 0x6f, 0x64, 0x52, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5a, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, + 0x74, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, + 0x31, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x52, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, + 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa8, + 0x01, 0x0a, 0x3a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, + 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, + 0x69, 0x78, 0x4c, 0x42, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xf6, 0x03, 0x0a, 0x33, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, + 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4c, 0x42, 0x69, + 0x74, 0x12, 0x61, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x44, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, + 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, + 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4c, 0x42, 0x69, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, + 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, + 0x4c, 0x42, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, + 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4c, + 0x42, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, + 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, + 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, + 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, + 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, + 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x22, 0xaf, 0x01, 0x0a, 0x41, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, + 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, + 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x04, 0x0a, 0x3a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, + 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, + 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x68, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x4b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, + 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, + 0x70, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, + 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x12, 0x64, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, + 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, + 0x70, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x64, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, + 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x49, + 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa6, 0x01, 0x0a, 0x38, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, + 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, + 0x70, 0x65, 0x31, 0x41, 0x53, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4c, 0x42, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, @@ -141538,31 +141798,207 @@ var file_otg_proto_rawDesc = []byte{ 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x22, 0x8a, 0x04, 0x0a, 0x38, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6e, 0x74, 0x22, 0xee, 0x03, 0x0a, 0x31, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, + 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x41, 0x53, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x4c, 0x42, 0x69, 0x74, 0x12, 0x5f, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x42, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, + 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x31, 0x41, 0x53, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x4c, 0x42, 0x69, 0x74, + 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5b, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x3d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, + 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x41, 0x53, 0x4e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x4c, 0x42, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5b, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x45, 0x78, 0x70, 0x6c, 0x69, 0x63, 0x69, 0x74, 0x52, 0x6f, + 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x41, 0x53, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x4c, 0x42, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, + 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, + 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, + 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0xad, 0x01, 0x0a, 0x3f, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, + 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0x8a, 0x04, 0x0a, 0x38, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, + 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x12, 0x66, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x49, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2e, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x62, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x44, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x62, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x44, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, + 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, + 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, + 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, + 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, + 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, + 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0xaa, 0x01, 0x0a, 0x3c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, + 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x33, 0x70, 0x69, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, + 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xfe, 0x03, + 0x0a, 0x35, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, + 0x50, 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, + 0x67, 0x65, 0x4c, 0x33, 0x70, 0x69, 0x64, 0x12, 0x63, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x46, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, + 0x68, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, + 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x33, + 0x70, 0x69, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, + 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, + 0x5f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, 0x65, + 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, + 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x33, 0x70, 0x69, 0x64, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x5f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, + 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x4c, 0x33, 0x70, 0x69, 0x64, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, + 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xba, + 0x01, 0x0a, 0x4c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, + 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, + 0x34, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x65, 0x6e, 0x64, 0x65, + 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, + 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, + 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xbe, 0x04, 0x0a, 0x45, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, + 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, + 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, + 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x73, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x56, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, + 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, + 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x6f, 0x0a, + 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x51, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, - 0x66, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x49, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, - 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4c, 0x65, 0x6e, 0x67, 0x74, - 0x68, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x62, 0x0a, 0x09, 0x69, 0x6e, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x44, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, - 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, - 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4f, - 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x62, + 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, + 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x53, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x6f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x44, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x0b, 0x32, 0x51, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, + 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, + 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x49, 0x70, 0x76, 0x34, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, + 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, + 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, + 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xab, 0x01, 0x0a, + 0x3d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, + 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x52, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, + 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, + 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x82, 0x04, 0x0a, 0x36, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, + 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x52, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x64, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x47, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, + 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x64, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, + 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x60, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x42, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4c, 0x65, 0x6e, - 0x67, 0x74, 0x68, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, + 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, + 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x12, 0x60, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, + 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, @@ -141571,45 +142007,81 @@ var file_otg_proto_rawDesc = []byte{ 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0xb5, 0x01, 0x0a, 0x47, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, - 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, - 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x49, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x54, - 0x73, 0x70, 0x65, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0xa8, 0x01, 0x0a, 0x3a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, + 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, + 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, + 0x76, 0x34, 0x4c, 0x73, 0x70, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, + 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, + 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xf6, 0x03, 0x0a, 0x33, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, + 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x4c, 0x73, 0x70, + 0x49, 0x64, 0x12, 0x61, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x44, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, + 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x4c, 0x73, 0x70, 0x49, 0x64, 0x2e, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, + 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, + 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, + 0x61, 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, + 0x4c, 0x73, 0x70, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3f, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, + 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, + 0x74, 0x65, 0x4c, 0x73, 0x70, 0x54, 0x75, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x70, 0x76, 0x34, 0x4c, + 0x73, 0x70, 0x49, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, + 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, + 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, + 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, + 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x22, 0xa1, 0x01, 0x0a, 0x33, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, + 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xaa, 0x04, 0x0a, 0x40, 0x50, 0x61, 0x74, 0x74, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xda, 0x03, 0x0a, 0x2c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, - 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x49, 0x64, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x73, 0x70, 0x65, 0x63, 0x12, 0x6e, 0x0a, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x51, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, - 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, - 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x49, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x73, - 0x70, 0x65, 0x63, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, - 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, - 0x6a, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x4c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x76, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x5a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, + 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x56, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, + 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, + 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x56, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x49, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x75, - 0x63, 0x6b, 0x65, 0x74, 0x54, 0x73, 0x70, 0x65, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x6a, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4c, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, - 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, - 0x74, 0x65, 0x72, 0x49, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, - 0x54, 0x73, 0x70, 0x65, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, + 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, @@ -141617,53 +142089,134 @@ var file_otg_proto_rawDesc = []byte{ 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x3c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa3, 0x01, 0x0a, 0x35, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x31, 0x32, 0x37, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, - 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, - 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, - 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, - 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0xfe, 0x03, 0x0a, 0x35, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, - 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x31, 0x32, 0x37, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x63, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x46, 0x2e, 0x6f, 0x74, + 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x52, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, + 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, + 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, + 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xe2, 0x03, 0x0a, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, + 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x12, 0x5c, 0x0a, + 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3f, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, + 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, + 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x64, 0x31, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, + 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x58, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x3a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, + 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x52, 0x65, 0x73, + 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x58, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, - 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, - 0x31, 0x32, 0x37, 0x46, 0x6c, 0x61, 0x67, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, - 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, - 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x12, 0x5f, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x31, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, + 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, + 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, + 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, + 0xa7, 0x01, 0x0a, 0x39, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, + 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, + 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4f, 0x76, 0x65, 0x72, 0x61, 0x6c, 0x6c, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xf2, 0x03, 0x0a, 0x32, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, + 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, + 0x65, 0x72, 0x76, 0x4f, 0x76, 0x65, 0x72, 0x61, 0x6c, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x12, 0x60, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x43, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4f, 0x76, 0x65, 0x72, + 0x61, 0x6c, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5c, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, + 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x4f, 0x76, 0x65, 0x72, 0x61, 0x6c, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x5c, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, - 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x31, 0x32, 0x37, 0x46, 0x6c, - 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5f, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x72, 0x76, 0x4f, 0x76, 0x65, 0x72, 0x61, 0x6c, 0x6c, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, + 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa7, + 0x01, 0x0a, 0x39, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, + 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xf2, 0x03, 0x0a, 0x32, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, + 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, + 0x72, 0x76, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, + 0x60, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x43, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, + 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, + 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, + 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5c, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, - 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x31, 0x32, 0x37, 0x46, - 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, - 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, - 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0xac, 0x01, 0x0a, 0x3e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, - 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x65, 0x74, 0x65, 0x72, 0x31, 0x32, 0x37, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, + 0x65, 0x72, 0x76, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x5c, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, + 0x76, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, + 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, + 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, + 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa1, 0x01, + 0x0a, 0x33, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, + 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, + 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x5a, 0x65, 0x72, 0x6f, 0x42, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, @@ -141671,86 +142224,388 @@ var file_otg_proto_rawDesc = []byte{ 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0x86, 0x04, 0x0a, 0x37, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x74, 0x22, 0xda, 0x03, 0x0a, 0x2c, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, - 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x31, 0x32, 0x37, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x65, 0x0a, - 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x48, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, - 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, - 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x31, 0x32, 0x37, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, - 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x61, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x6f, 0x74, 0x67, - 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, - 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, - 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x31, - 0x32, 0x37, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x61, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x43, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, - 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, - 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, - 0x65, 0x72, 0x31, 0x32, 0x37, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, - 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, - 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, - 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, - 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, - 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xac, 0x01, 0x0a, 0x3e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, - 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, - 0x53, 0x65, 0x72, 0x76, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, - 0x65, 0x64, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, + 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x5a, 0x65, 0x72, 0x6f, 0x42, + 0x69, 0x74, 0x12, 0x5a, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x3d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x5a, 0x65, + 0x72, 0x6f, 0x42, 0x69, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x56, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, + 0x5a, 0x65, 0x72, 0x6f, 0x42, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x56, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, + 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x5a, 0x65, 0x72, 0x6f, 0x42, 0x69, 0x74, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, + 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa3, + 0x01, 0x0a, 0x35, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, + 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x32, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xe2, 0x03, 0x0a, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x52, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x32, 0x12, 0x5c, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3f, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, + 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, + 0x65, 0x72, 0x76, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x32, 0x2e, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, + 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x58, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, + 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, + 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x32, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x58, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, + 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, + 0x76, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x32, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xad, 0x01, 0x0a, 0x3f, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, + 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, + 0x65, 0x72, 0x76, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x86, 0x04, 0x0a, 0x37, 0x50, 0x61, + 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8a, 0x04, 0x0a, 0x38, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, - 0x65, 0x72, 0x76, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x65, - 0x64, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x65, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x48, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x76, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x66, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x49, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, + 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, + 0x72, 0x76, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x44, 0x61, 0x74, 0x61, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, + 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, + 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x12, 0x62, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x44, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x44, + 0x61, 0x74, 0x61, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x62, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x44, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, + 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, + 0x53, 0x65, 0x72, 0x76, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x4f, 0x66, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x44, 0x61, 0x74, 0x61, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, + 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, + 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xb5, 0x01, 0x0a, 0x47, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x49, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x73, 0x70, 0x65, 0x63, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, + 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, + 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, + 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xaa, + 0x04, 0x0a, 0x40, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, + 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x49, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x73, + 0x70, 0x65, 0x63, 0x12, 0x6e, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x51, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x49, 0x64, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x42, + 0x75, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x73, 0x70, 0x65, 0x63, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, + 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x6a, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, + 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, + 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x49, 0x64, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x73, 0x70, 0x65, 0x63, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x6a, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x4c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, - 0x76, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x65, 0x64, 0x55, - 0x6e, 0x69, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, - 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, - 0x61, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x49, 0x64, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x42, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x73, 0x70, 0x65, 0x63, 0x43, 0x6f, 0x75, 0x6e, + 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, + 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, + 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, + 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x3c, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, + 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, + 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x31, 0x32, + 0x37, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xfe, 0x03, 0x0a, 0x35, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, + 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, + 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x31, 0x32, 0x37, 0x46, 0x6c, + 0x61, 0x67, 0x12, 0x63, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x46, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4d, 0x69, - 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x65, 0x64, 0x55, 0x6e, 0x69, 0x74, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x12, 0x61, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x31, 0x32, 0x37, 0x46, 0x6c, 0x61, 0x67, 0x2e, 0x43, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, + 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x5f, 0x0a, 0x09, 0x69, 0x6e, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, + 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, + 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x31, 0x32, 0x37, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, + 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x5f, 0x0a, 0x09, 0x64, + 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x41, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, + 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, + 0x74, 0x65, 0x72, 0x31, 0x32, 0x37, 0x46, 0x6c, 0x61, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xac, 0x01, 0x0a, 0x3e, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, + 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, + 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x31, 0x32, 0x37, 0x4c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, + 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x86, 0x04, 0x0a, 0x37, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, + 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, + 0x72, 0x76, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x31, 0x32, 0x37, 0x4c, 0x65, + 0x6e, 0x67, 0x74, 0x68, 0x12, 0x65, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x48, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x31, 0x32, 0x37, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, + 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x61, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x43, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, + 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x31, 0x32, 0x37, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x12, 0x61, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x31, 0x32, 0x37, 0x4c, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, + 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, + 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, + 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, + 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x22, 0xac, 0x01, 0x0a, 0x3e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, + 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4d, 0x69, 0x6e, 0x69, 0x6d, + 0x75, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x65, 0x64, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, + 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, + 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, + 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x86, 0x04, 0x0a, 0x37, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, + 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, + 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x65, 0x64, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x65, 0x0a, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x48, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, + 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x65, 0x64, 0x55, 0x6e, 0x69, 0x74, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, + 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x61, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, + 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, + 0x74, 0x53, 0x65, 0x72, 0x76, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x50, 0x6f, 0x6c, 0x69, + 0x63, 0x65, 0x64, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x61, 0x0a, 0x09, 0x64, 0x65, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x43, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, + 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x65, 0x64, 0x55, 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, + 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, + 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, + 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xab, 0x01, 0x0a, 0x3d, 0x50, 0x61, + 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, + 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, + 0x65, 0x72, 0x76, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, + 0x53, 0x69, 0x7a, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, + 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, + 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x82, 0x04, 0x0a, 0x36, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, - 0x76, 0x4d, 0x69, 0x6e, 0x69, 0x6d, 0x75, 0x6d, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x65, 0x64, 0x55, - 0x6e, 0x69, 0x74, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, - 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, - 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, - 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, - 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, - 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0xab, 0x01, 0x0a, 0x3d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, + 0x76, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x69, + 0x7a, 0x65, 0x12, 0x64, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x47, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, + 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4d, 0x61, + 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x2e, + 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, + 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x60, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, + 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, + 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, + 0x6d, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, + 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x60, 0x0a, + 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x42, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x43, 0x6f, 0x75, + 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, + 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, + 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, + 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, + 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, + 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xae, 0x01, 0x0a, + 0x40, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, + 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, + 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, + 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, + 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, + 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, + 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8e, 0x04, + 0x0a, 0x39, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, + 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x67, 0x0a, 0x06, 0x63, + 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x4a, 0x2e, 0x6f, 0x74, + 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, + 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x63, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, + 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, + 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, + 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, + 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x63, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x45, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, + 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, + 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, + 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, + 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, + 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, + 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, + 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, + 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xaf, + 0x01, 0x0a, 0x41, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, @@ -141758,31 +142613,32 @@ var file_otg_proto_rawDesc = []byte{ 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x22, 0x82, 0x04, 0x0a, 0x36, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, - 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, - 0x6d, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x64, 0x0a, 0x06, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x47, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, - 0x50, 0x50, 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, - 0x49, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x50, 0x61, - 0x63, 0x6b, 0x65, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, - 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x12, 0x60, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, - 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, - 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, 0x74, 0x53, - 0x65, 0x72, 0x76, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, - 0x53, 0x69, 0x7a, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, - 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x60, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x42, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, - 0x61, 0x74, 0x68, 0x53, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x54, 0x73, 0x70, 0x65, 0x63, 0x49, 0x6e, - 0x74, 0x53, 0x65, 0x72, 0x76, 0x4d, 0x61, 0x78, 0x69, 0x6d, 0x75, 0x6d, 0x50, 0x61, 0x63, 0x6b, - 0x65, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, + 0x22, 0x92, 0x04, 0x0a, 0x3a, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, + 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, + 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, + 0x68, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x4b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, + 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x64, 0x0a, 0x09, + 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x46, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, + 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, + 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x12, 0x64, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, + 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, + 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, + 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, @@ -141790,299 +142646,211 @@ var file_otg_proto_rawDesc = []byte{ 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xae, 0x01, 0x0a, 0x40, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, - 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, - 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, - 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, - 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x8e, 0x04, 0x0a, 0x39, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, - 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x12, 0x67, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x4a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, - 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, - 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, - 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x12, 0x63, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8e, 0x02, 0x0a, 0x2d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, - 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, - 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, - 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x63, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x45, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, - 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x49, 0x70, 0x76, - 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, - 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, - 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, - 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, - 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xaf, 0x01, 0x0a, 0x41, 0x50, 0x61, 0x74, 0x74, - 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, - 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, - 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, - 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, - 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, - 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, - 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, - 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x92, 0x04, 0x0a, 0x3a, 0x50, 0x61, + 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x5b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, - 0x31, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, - 0x69, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x68, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, - 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x4b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, - 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, - 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x72, 0x65, - 0x66, 0x69, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, - 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, - 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x64, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x46, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, + 0x31, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, + 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, + 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x1a, 0x38, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, + 0x65, 0x22, 0x2e, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, + 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, + 0x03, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8e, 0x02, 0x0a, 0x2d, 0x50, 0x61, 0x74, 0x74, 0x65, + 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, + 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x4c, 0x61, + 0x62, 0x65, 0x6c, 0x43, 0x54, 0x79, 0x70, 0x65, 0x12, 0x5b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x72, 0x65, - 0x66, 0x69, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x64, 0x0a, 0x09, 0x64, - 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x46, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x49, 0x70, 0x76, 0x34, 0x41, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, - 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, - 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, - 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, - 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, - 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x8e, - 0x02, 0x0a, 0x2d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, - 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, 0x74, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x46, 0x6c, 0x61, 0x67, 0x73, - 0x12, 0x5b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, - 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, - 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x46, - 0x6c, 0x61, 0x67, 0x73, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, - 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, - 0x1a, 0x38, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x2e, 0x0a, 0x04, 0x45, 0x6e, - 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, - 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, - 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, - 0x8e, 0x02, 0x0a, 0x2d, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, - 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x6f, 0x75, - 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x43, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x5b, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0e, 0x32, 0x3e, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, - 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x52, 0x65, 0x63, 0x6f, 0x72, - 0x64, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x31, 0x4c, 0x61, 0x62, 0x65, 0x6c, - 0x43, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, - 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x73, 0x1a, 0x38, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x2e, 0x0a, 0x04, 0x45, - 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, - 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, - 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x42, 0x09, 0x0a, 0x07, 0x5f, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x99, 0x01, 0x0a, 0x2b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, - 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x43, - 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, - 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, - 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, - 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, - 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, - 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xba, 0x03, 0x0a, - 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, - 0x50, 0x61, 0x74, 0x68, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, - 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x52, 0x0a, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, + 0x65, 0x31, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x43, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, + 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, + 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x1a, 0x38, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, + 0x63, 0x65, 0x22, 0x2e, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, + 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, + 0x10, 0x03, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, + 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x99, 0x01, 0x0a, 0x2b, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, - 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, - 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x4e, 0x0a, 0x09, - 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x30, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, - 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x4e, 0x0a, 0x09, - 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x30, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, - 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, - 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, - 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, - 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, - 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, - 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, - 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, - 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xb9, 0x01, 0x0a, 0x07, 0x56, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x10, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x70, 0x65, - 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x0e, 0x61, 0x70, 0x69, 0x53, 0x70, 0x65, 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x88, 0x01, 0x01, 0x12, 0x24, 0x0a, 0x0b, 0x73, 0x64, 0x6b, 0x5f, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x0a, 0x73, 0x64, 0x6b, - 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x24, 0x0a, 0x0b, 0x61, 0x70, - 0x70, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x02, 0x52, 0x0a, 0x61, 0x70, 0x70, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, - 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x61, 0x70, 0x69, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x5f, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x73, 0x64, 0x6b, 0x5f, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x61, 0x70, 0x70, 0x5f, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x31, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x12, 0x26, 0x0a, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x52, - 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x22, 0x2b, 0x0a, 0x07, 0x46, 0x61, 0x69, 0x6c, - 0x75, 0x72, 0x65, 0x12, 0x20, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x37, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x06, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x4d, - 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, - 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0x3b, 0x0a, - 0x11, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x26, 0x0a, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, - 0x67, 0x52, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x22, 0x38, 0x0a, 0x11, 0x47, 0x65, - 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x23, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x22, 0x3e, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x07, - 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x77, 0x61, 0x72, - 0x6e, 0x69, 0x6e, 0x67, 0x22, 0x50, 0x0a, 0x16, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, - 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x41, 0x0a, 0x17, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x26, 0x0a, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, - 0x52, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x22, 0x54, 0x0a, 0x17, 0x53, 0x65, 0x74, - 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, - 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0x6e, 0x0a, 0x18, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x41, 0x63, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x17, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, - 0x74, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x15, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x51, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x0f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, - 0x6f, 0x74, 0x67, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x52, 0x0e, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x22, 0x55, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x6d, 0x65, 0x74, 0x72, - 0x69, 0x63, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x4d, 0x0a, 0x10, 0x47, 0x65, 0x74, - 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, - 0x0e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x65, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x51, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, - 0x0f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x0e, 0x73, 0x74, 0x61, - 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x51, 0x0a, 0x11, 0x47, - 0x65, 0x74, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x3c, 0x0a, 0x0f, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0e, - 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x3b, - 0x0a, 0x12, 0x47, 0x65, 0x74, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x72, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x3c, 0x0a, 0x12, 0x47, - 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x26, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x32, 0xdf, 0x04, 0x0a, 0x07, 0x4f, 0x70, - 0x65, 0x6e, 0x61, 0x70, 0x69, 0x12, 0x3a, 0x0a, 0x09, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x12, 0x15, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6f, 0x74, 0x67, 0x2e, - 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x3b, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x47, 0x65, 0x74, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, - 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x55, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x00, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x88, + 0x01, 0x01, 0x12, 0x17, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, + 0x48, 0x01, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x88, 0x01, 0x01, 0x12, 0x19, 0x0a, 0x05, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x48, 0x02, 0x52, 0x05, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x22, 0xba, 0x03, 0x0a, 0x24, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, + 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4f, 0x62, 0x6a, 0x65, 0x63, + 0x74, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x12, 0x52, 0x0a, 0x06, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x35, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, + 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x43, 0x75, 0x73, + 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x2e, 0x45, + 0x6e, 0x75, 0x6d, 0x48, 0x00, 0x52, 0x06, 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x88, 0x01, 0x01, + 0x12, 0x19, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x48, + 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x88, 0x01, 0x01, 0x12, 0x16, 0x0a, 0x06, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x06, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x73, 0x12, 0x4e, 0x0a, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, + 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, + 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x12, 0x4e, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x50, 0x61, 0x74, + 0x74, 0x65, 0x72, 0x6e, 0x46, 0x6c, 0x6f, 0x77, 0x52, 0x53, 0x56, 0x50, 0x50, 0x61, 0x74, 0x68, + 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x43, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x54, 0x79, 0x70, + 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x52, 0x09, 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x1a, 0x56, 0x0a, 0x06, 0x43, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x4c, 0x0a, + 0x04, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0f, 0x0a, 0x0b, 0x75, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, + 0x66, 0x69, 0x65, 0x64, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x10, + 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x10, 0x03, 0x12, 0x0d, 0x0a, + 0x09, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, + 0x64, 0x65, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x10, 0x05, 0x42, 0x09, 0x0a, 0x07, 0x5f, + 0x63, 0x68, 0x6f, 0x69, 0x63, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x22, 0xb9, 0x01, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x10, + 0x61, 0x70, 0x69, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0e, 0x61, 0x70, 0x69, 0x53, 0x70, 0x65, + 0x63, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x24, 0x0a, 0x0b, 0x73, + 0x64, 0x6b, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x48, 0x01, 0x52, 0x0a, 0x73, 0x64, 0x6b, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x88, 0x01, + 0x01, 0x12, 0x24, 0x0a, 0x0b, 0x61, 0x70, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x0a, 0x61, 0x70, 0x70, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x88, 0x01, 0x01, 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x61, 0x70, 0x69, 0x5f, + 0x73, 0x70, 0x65, 0x63, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x0e, 0x0a, 0x0c, + 0x5f, 0x73, 0x64, 0x6b, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x0e, 0x0a, 0x0c, + 0x5f, 0x61, 0x70, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x31, 0x0a, 0x07, + 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x26, 0x0a, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, + 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x57, + 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x22, + 0x2b, 0x0a, 0x07, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x12, 0x20, 0x0a, 0x05, 0x65, 0x72, + 0x72, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x37, 0x0a, 0x10, + 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x23, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x4d, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x0d, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x22, 0x3b, 0x0a, 0x11, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x07, 0x77, 0x61, 0x72, + 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, + 0x67, 0x22, 0x38, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x3e, 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0f, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1b, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x53, 0x65, 0x74, - 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x4f, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x41, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x43, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, + 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x57, 0x61, 0x72, 0x6e, 0x69, + 0x6e, 0x67, 0x52, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x22, 0x50, 0x0a, 0x16, 0x53, + 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, + 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x41, 0x0a, + 0x17, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x07, 0x77, 0x61, 0x72, 0x6e, + 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x57, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x52, 0x07, 0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, + 0x22, 0x54, 0x0a, 0x17, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x41, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x0e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x6e, 0x0a, 0x18, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, - 0x12, 0x16, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x47, - 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x3a, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x12, 0x15, - 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, - 0x0a, 0x47, 0x65, 0x74, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x12, 0x16, 0x2e, 0x6f, 0x74, - 0x67, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x61, 0x70, - 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x0a, - 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, - 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0b, 0x5a, 0x09, 0x2e, - 0x2f, 0x6f, 0x74, 0x67, 0x3b, 0x6f, 0x74, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x65, 0x12, 0x52, 0x0a, 0x17, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x5f, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, + 0x15, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x51, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, + 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x0f, 0x6d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0e, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x55, 0x0a, 0x12, 0x47, 0x65, 0x74, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3f, 0x0a, 0x10, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, + 0x0f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x4d, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x39, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x73, 0x5f, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x52, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, + 0x51, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x0f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x73, 0x5f, 0x72, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x51, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3c, 0x0a, 0x0f, 0x63, 0x61, 0x70, 0x74, 0x75, + 0x72, 0x65, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x13, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0e, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x3b, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x43, 0x61, 0x70, 0x74, + 0x75, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x72, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x79, 0x74, + 0x65, 0x73, 0x22, 0x3c, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x32, 0xdf, 0x04, 0x0a, 0x07, 0x4f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x12, 0x3a, 0x0a, 0x09, + 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x15, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x16, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x16, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x19, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0f, 0x53, 0x65, + 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1b, 0x2e, + 0x6f, 0x74, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x43, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x41, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x53, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x41, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x47, 0x65, 0x74, + 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x16, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x47, 0x65, + 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x17, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3a, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x73, 0x12, 0x15, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6f, + 0x74, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x43, 0x61, 0x70, 0x74, 0x75, + 0x72, 0x65, 0x12, 0x16, 0x2e, 0x6f, 0x74, 0x67, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x61, 0x70, 0x74, + 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6f, 0x74, 0x67, + 0x2e, 0x47, 0x65, 0x74, 0x43, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x6f, 0x74, 0x67, 0x2e, + 0x47, 0x65, 0x74, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x6f, 0x74, 0x67, 0x3b, 0x6f, 0x74, 0x67, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -142098,7 +142866,7 @@ func file_otg_proto_rawDescGZIP() []byte { } var file_otg_proto_enumTypes = make([]protoimpl.EnumInfo, 426) -var file_otg_proto_msgTypes = make([]protoimpl.MessageInfo, 1447) +var file_otg_proto_msgTypes = make([]protoimpl.MessageInfo, 1454) var file_otg_proto_goTypes = []interface{}{ (LagProtocol_Choice_Enum)(0), // 0: otg.LagProtocol.Choice.Enum (LagPortLacp_ActorActivity_Enum)(0), // 1: otg.LagPortLacp.ActorActivity.Enum @@ -143080,900 +143848,907 @@ var file_otg_proto_goTypes = []interface{}{ (*PatternFlowIpv4HeaderChecksum)(nil), // 977: otg.PatternFlowIpv4HeaderChecksum (*PatternFlowIpv4SrcCounter)(nil), // 978: otg.PatternFlowIpv4SrcCounter (*PatternFlowIpv4SrcMetricTag)(nil), // 979: otg.PatternFlowIpv4SrcMetricTag - (*PatternFlowIpv4Src)(nil), // 980: otg.PatternFlowIpv4Src - (*PatternFlowIpv4DstCounter)(nil), // 981: otg.PatternFlowIpv4DstCounter - (*PatternFlowIpv4DstMetricTag)(nil), // 982: otg.PatternFlowIpv4DstMetricTag - (*PatternFlowIpv4Dst)(nil), // 983: otg.PatternFlowIpv4Dst - (*PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter)(nil), // 984: otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - (*PatternFlowIpv4OptionsCustomTypeCopiedFlag)(nil), // 985: otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag - (*PatternFlowIpv4OptionsCustomTypeOptionClassCounter)(nil), // 986: otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter - (*PatternFlowIpv4OptionsCustomTypeOptionClass)(nil), // 987: otg.PatternFlowIpv4OptionsCustomTypeOptionClass - (*PatternFlowIpv4OptionsCustomTypeOptionNumberCounter)(nil), // 988: otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - (*PatternFlowIpv4OptionsCustomTypeOptionNumber)(nil), // 989: otg.PatternFlowIpv4OptionsCustomTypeOptionNumber - (*PatternFlowIpv4PriorityRawCounter)(nil), // 990: otg.PatternFlowIpv4PriorityRawCounter - (*PatternFlowIpv4PriorityRawMetricTag)(nil), // 991: otg.PatternFlowIpv4PriorityRawMetricTag - (*PatternFlowIpv4PriorityRaw)(nil), // 992: otg.PatternFlowIpv4PriorityRaw - (*PatternFlowIpv4DscpPhbCounter)(nil), // 993: otg.PatternFlowIpv4DscpPhbCounter - (*PatternFlowIpv4DscpPhbMetricTag)(nil), // 994: otg.PatternFlowIpv4DscpPhbMetricTag - (*PatternFlowIpv4DscpPhb)(nil), // 995: otg.PatternFlowIpv4DscpPhb - (*PatternFlowIpv4DscpEcnCounter)(nil), // 996: otg.PatternFlowIpv4DscpEcnCounter - (*PatternFlowIpv4DscpEcnMetricTag)(nil), // 997: otg.PatternFlowIpv4DscpEcnMetricTag - (*PatternFlowIpv4DscpEcn)(nil), // 998: otg.PatternFlowIpv4DscpEcn - (*PatternFlowIpv4TosPrecedenceCounter)(nil), // 999: otg.PatternFlowIpv4TosPrecedenceCounter - (*PatternFlowIpv4TosPrecedenceMetricTag)(nil), // 1000: otg.PatternFlowIpv4TosPrecedenceMetricTag - (*PatternFlowIpv4TosPrecedence)(nil), // 1001: otg.PatternFlowIpv4TosPrecedence - (*PatternFlowIpv4TosDelayCounter)(nil), // 1002: otg.PatternFlowIpv4TosDelayCounter - (*PatternFlowIpv4TosDelayMetricTag)(nil), // 1003: otg.PatternFlowIpv4TosDelayMetricTag - (*PatternFlowIpv4TosDelay)(nil), // 1004: otg.PatternFlowIpv4TosDelay - (*PatternFlowIpv4TosThroughputCounter)(nil), // 1005: otg.PatternFlowIpv4TosThroughputCounter - (*PatternFlowIpv4TosThroughputMetricTag)(nil), // 1006: otg.PatternFlowIpv4TosThroughputMetricTag - (*PatternFlowIpv4TosThroughput)(nil), // 1007: otg.PatternFlowIpv4TosThroughput - (*PatternFlowIpv4TosReliabilityCounter)(nil), // 1008: otg.PatternFlowIpv4TosReliabilityCounter - (*PatternFlowIpv4TosReliabilityMetricTag)(nil), // 1009: otg.PatternFlowIpv4TosReliabilityMetricTag - (*PatternFlowIpv4TosReliability)(nil), // 1010: otg.PatternFlowIpv4TosReliability - (*PatternFlowIpv4TosMonetaryCounter)(nil), // 1011: otg.PatternFlowIpv4TosMonetaryCounter - (*PatternFlowIpv4TosMonetaryMetricTag)(nil), // 1012: otg.PatternFlowIpv4TosMonetaryMetricTag - (*PatternFlowIpv4TosMonetary)(nil), // 1013: otg.PatternFlowIpv4TosMonetary - (*PatternFlowIpv4TosUnusedCounter)(nil), // 1014: otg.PatternFlowIpv4TosUnusedCounter - (*PatternFlowIpv4TosUnusedMetricTag)(nil), // 1015: otg.PatternFlowIpv4TosUnusedMetricTag - (*PatternFlowIpv4TosUnused)(nil), // 1016: otg.PatternFlowIpv4TosUnused - (*PatternFlowIpv6VersionCounter)(nil), // 1017: otg.PatternFlowIpv6VersionCounter - (*PatternFlowIpv6VersionMetricTag)(nil), // 1018: otg.PatternFlowIpv6VersionMetricTag - (*PatternFlowIpv6Version)(nil), // 1019: otg.PatternFlowIpv6Version - (*PatternFlowIpv6TrafficClassCounter)(nil), // 1020: otg.PatternFlowIpv6TrafficClassCounter - (*PatternFlowIpv6TrafficClassMetricTag)(nil), // 1021: otg.PatternFlowIpv6TrafficClassMetricTag - (*PatternFlowIpv6TrafficClass)(nil), // 1022: otg.PatternFlowIpv6TrafficClass - (*PatternFlowIpv6FlowLabelCounter)(nil), // 1023: otg.PatternFlowIpv6FlowLabelCounter - (*PatternFlowIpv6FlowLabelMetricTag)(nil), // 1024: otg.PatternFlowIpv6FlowLabelMetricTag - (*PatternFlowIpv6FlowLabel)(nil), // 1025: otg.PatternFlowIpv6FlowLabel - (*PatternFlowIpv6PayloadLengthCounter)(nil), // 1026: otg.PatternFlowIpv6PayloadLengthCounter - (*PatternFlowIpv6PayloadLengthMetricTag)(nil), // 1027: otg.PatternFlowIpv6PayloadLengthMetricTag - (*PatternFlowIpv6PayloadLength)(nil), // 1028: otg.PatternFlowIpv6PayloadLength - (*PatternFlowIpv6NextHeaderCounter)(nil), // 1029: otg.PatternFlowIpv6NextHeaderCounter - (*PatternFlowIpv6NextHeaderMetricTag)(nil), // 1030: otg.PatternFlowIpv6NextHeaderMetricTag - (*PatternFlowIpv6NextHeader)(nil), // 1031: otg.PatternFlowIpv6NextHeader - (*PatternFlowIpv6HopLimitCounter)(nil), // 1032: otg.PatternFlowIpv6HopLimitCounter - (*PatternFlowIpv6HopLimitMetricTag)(nil), // 1033: otg.PatternFlowIpv6HopLimitMetricTag - (*PatternFlowIpv6HopLimit)(nil), // 1034: otg.PatternFlowIpv6HopLimit - (*PatternFlowIpv6SrcCounter)(nil), // 1035: otg.PatternFlowIpv6SrcCounter - (*PatternFlowIpv6SrcMetricTag)(nil), // 1036: otg.PatternFlowIpv6SrcMetricTag - (*PatternFlowIpv6Src)(nil), // 1037: otg.PatternFlowIpv6Src - (*PatternFlowIpv6DstCounter)(nil), // 1038: otg.PatternFlowIpv6DstCounter - (*PatternFlowIpv6DstMetricTag)(nil), // 1039: otg.PatternFlowIpv6DstMetricTag - (*PatternFlowIpv6Dst)(nil), // 1040: otg.PatternFlowIpv6Dst - (*PatternFlowPfcPauseDstCounter)(nil), // 1041: otg.PatternFlowPfcPauseDstCounter - (*PatternFlowPfcPauseDstMetricTag)(nil), // 1042: otg.PatternFlowPfcPauseDstMetricTag - (*PatternFlowPfcPauseDst)(nil), // 1043: otg.PatternFlowPfcPauseDst - (*PatternFlowPfcPauseSrcCounter)(nil), // 1044: otg.PatternFlowPfcPauseSrcCounter - (*PatternFlowPfcPauseSrcMetricTag)(nil), // 1045: otg.PatternFlowPfcPauseSrcMetricTag - (*PatternFlowPfcPauseSrc)(nil), // 1046: otg.PatternFlowPfcPauseSrc - (*PatternFlowPfcPauseEtherTypeCounter)(nil), // 1047: otg.PatternFlowPfcPauseEtherTypeCounter - (*PatternFlowPfcPauseEtherTypeMetricTag)(nil), // 1048: otg.PatternFlowPfcPauseEtherTypeMetricTag - (*PatternFlowPfcPauseEtherType)(nil), // 1049: otg.PatternFlowPfcPauseEtherType - (*PatternFlowPfcPauseControlOpCodeCounter)(nil), // 1050: otg.PatternFlowPfcPauseControlOpCodeCounter - (*PatternFlowPfcPauseControlOpCodeMetricTag)(nil), // 1051: otg.PatternFlowPfcPauseControlOpCodeMetricTag - (*PatternFlowPfcPauseControlOpCode)(nil), // 1052: otg.PatternFlowPfcPauseControlOpCode - (*PatternFlowPfcPauseClassEnableVectorCounter)(nil), // 1053: otg.PatternFlowPfcPauseClassEnableVectorCounter - (*PatternFlowPfcPauseClassEnableVectorMetricTag)(nil), // 1054: otg.PatternFlowPfcPauseClassEnableVectorMetricTag - (*PatternFlowPfcPauseClassEnableVector)(nil), // 1055: otg.PatternFlowPfcPauseClassEnableVector - (*PatternFlowPfcPausePauseClass0Counter)(nil), // 1056: otg.PatternFlowPfcPausePauseClass0Counter - (*PatternFlowPfcPausePauseClass0MetricTag)(nil), // 1057: otg.PatternFlowPfcPausePauseClass0MetricTag - (*PatternFlowPfcPausePauseClass0)(nil), // 1058: otg.PatternFlowPfcPausePauseClass0 - (*PatternFlowPfcPausePauseClass1Counter)(nil), // 1059: otg.PatternFlowPfcPausePauseClass1Counter - (*PatternFlowPfcPausePauseClass1MetricTag)(nil), // 1060: otg.PatternFlowPfcPausePauseClass1MetricTag - (*PatternFlowPfcPausePauseClass1)(nil), // 1061: otg.PatternFlowPfcPausePauseClass1 - (*PatternFlowPfcPausePauseClass2Counter)(nil), // 1062: otg.PatternFlowPfcPausePauseClass2Counter - (*PatternFlowPfcPausePauseClass2MetricTag)(nil), // 1063: otg.PatternFlowPfcPausePauseClass2MetricTag - (*PatternFlowPfcPausePauseClass2)(nil), // 1064: otg.PatternFlowPfcPausePauseClass2 - (*PatternFlowPfcPausePauseClass3Counter)(nil), // 1065: otg.PatternFlowPfcPausePauseClass3Counter - (*PatternFlowPfcPausePauseClass3MetricTag)(nil), // 1066: otg.PatternFlowPfcPausePauseClass3MetricTag - (*PatternFlowPfcPausePauseClass3)(nil), // 1067: otg.PatternFlowPfcPausePauseClass3 - (*PatternFlowPfcPausePauseClass4Counter)(nil), // 1068: otg.PatternFlowPfcPausePauseClass4Counter - (*PatternFlowPfcPausePauseClass4MetricTag)(nil), // 1069: otg.PatternFlowPfcPausePauseClass4MetricTag - (*PatternFlowPfcPausePauseClass4)(nil), // 1070: otg.PatternFlowPfcPausePauseClass4 - (*PatternFlowPfcPausePauseClass5Counter)(nil), // 1071: otg.PatternFlowPfcPausePauseClass5Counter - (*PatternFlowPfcPausePauseClass5MetricTag)(nil), // 1072: otg.PatternFlowPfcPausePauseClass5MetricTag - (*PatternFlowPfcPausePauseClass5)(nil), // 1073: otg.PatternFlowPfcPausePauseClass5 - (*PatternFlowPfcPausePauseClass6Counter)(nil), // 1074: otg.PatternFlowPfcPausePauseClass6Counter - (*PatternFlowPfcPausePauseClass6MetricTag)(nil), // 1075: otg.PatternFlowPfcPausePauseClass6MetricTag - (*PatternFlowPfcPausePauseClass6)(nil), // 1076: otg.PatternFlowPfcPausePauseClass6 - (*PatternFlowPfcPausePauseClass7Counter)(nil), // 1077: otg.PatternFlowPfcPausePauseClass7Counter - (*PatternFlowPfcPausePauseClass7MetricTag)(nil), // 1078: otg.PatternFlowPfcPausePauseClass7MetricTag - (*PatternFlowPfcPausePauseClass7)(nil), // 1079: otg.PatternFlowPfcPausePauseClass7 - (*PatternFlowEthernetPauseDstCounter)(nil), // 1080: otg.PatternFlowEthernetPauseDstCounter - (*PatternFlowEthernetPauseDstMetricTag)(nil), // 1081: otg.PatternFlowEthernetPauseDstMetricTag - (*PatternFlowEthernetPauseDst)(nil), // 1082: otg.PatternFlowEthernetPauseDst - (*PatternFlowEthernetPauseSrcCounter)(nil), // 1083: otg.PatternFlowEthernetPauseSrcCounter - (*PatternFlowEthernetPauseSrcMetricTag)(nil), // 1084: otg.PatternFlowEthernetPauseSrcMetricTag - (*PatternFlowEthernetPauseSrc)(nil), // 1085: otg.PatternFlowEthernetPauseSrc - (*PatternFlowEthernetPauseEtherTypeCounter)(nil), // 1086: otg.PatternFlowEthernetPauseEtherTypeCounter - (*PatternFlowEthernetPauseEtherTypeMetricTag)(nil), // 1087: otg.PatternFlowEthernetPauseEtherTypeMetricTag - (*PatternFlowEthernetPauseEtherType)(nil), // 1088: otg.PatternFlowEthernetPauseEtherType - (*PatternFlowEthernetPauseControlOpCodeCounter)(nil), // 1089: otg.PatternFlowEthernetPauseControlOpCodeCounter - (*PatternFlowEthernetPauseControlOpCodeMetricTag)(nil), // 1090: otg.PatternFlowEthernetPauseControlOpCodeMetricTag - (*PatternFlowEthernetPauseControlOpCode)(nil), // 1091: otg.PatternFlowEthernetPauseControlOpCode - (*PatternFlowEthernetPauseTimeCounter)(nil), // 1092: otg.PatternFlowEthernetPauseTimeCounter - (*PatternFlowEthernetPauseTimeMetricTag)(nil), // 1093: otg.PatternFlowEthernetPauseTimeMetricTag - (*PatternFlowEthernetPauseTime)(nil), // 1094: otg.PatternFlowEthernetPauseTime - (*PatternFlowTcpSrcPortCounter)(nil), // 1095: otg.PatternFlowTcpSrcPortCounter - (*PatternFlowTcpSrcPortMetricTag)(nil), // 1096: otg.PatternFlowTcpSrcPortMetricTag - (*PatternFlowTcpSrcPort)(nil), // 1097: otg.PatternFlowTcpSrcPort - (*PatternFlowTcpDstPortCounter)(nil), // 1098: otg.PatternFlowTcpDstPortCounter - (*PatternFlowTcpDstPortMetricTag)(nil), // 1099: otg.PatternFlowTcpDstPortMetricTag - (*PatternFlowTcpDstPort)(nil), // 1100: otg.PatternFlowTcpDstPort - (*PatternFlowTcpSeqNumCounter)(nil), // 1101: otg.PatternFlowTcpSeqNumCounter - (*PatternFlowTcpSeqNumMetricTag)(nil), // 1102: otg.PatternFlowTcpSeqNumMetricTag - (*PatternFlowTcpSeqNum)(nil), // 1103: otg.PatternFlowTcpSeqNum - (*PatternFlowTcpAckNumCounter)(nil), // 1104: otg.PatternFlowTcpAckNumCounter - (*PatternFlowTcpAckNumMetricTag)(nil), // 1105: otg.PatternFlowTcpAckNumMetricTag - (*PatternFlowTcpAckNum)(nil), // 1106: otg.PatternFlowTcpAckNum - (*PatternFlowTcpDataOffsetCounter)(nil), // 1107: otg.PatternFlowTcpDataOffsetCounter - (*PatternFlowTcpDataOffsetMetricTag)(nil), // 1108: otg.PatternFlowTcpDataOffsetMetricTag - (*PatternFlowTcpDataOffset)(nil), // 1109: otg.PatternFlowTcpDataOffset - (*PatternFlowTcpEcnNsCounter)(nil), // 1110: otg.PatternFlowTcpEcnNsCounter - (*PatternFlowTcpEcnNsMetricTag)(nil), // 1111: otg.PatternFlowTcpEcnNsMetricTag - (*PatternFlowTcpEcnNs)(nil), // 1112: otg.PatternFlowTcpEcnNs - (*PatternFlowTcpEcnCwrCounter)(nil), // 1113: otg.PatternFlowTcpEcnCwrCounter - (*PatternFlowTcpEcnCwrMetricTag)(nil), // 1114: otg.PatternFlowTcpEcnCwrMetricTag - (*PatternFlowTcpEcnCwr)(nil), // 1115: otg.PatternFlowTcpEcnCwr - (*PatternFlowTcpEcnEchoCounter)(nil), // 1116: otg.PatternFlowTcpEcnEchoCounter - (*PatternFlowTcpEcnEchoMetricTag)(nil), // 1117: otg.PatternFlowTcpEcnEchoMetricTag - (*PatternFlowTcpEcnEcho)(nil), // 1118: otg.PatternFlowTcpEcnEcho - (*PatternFlowTcpCtlUrgCounter)(nil), // 1119: otg.PatternFlowTcpCtlUrgCounter - (*PatternFlowTcpCtlUrgMetricTag)(nil), // 1120: otg.PatternFlowTcpCtlUrgMetricTag - (*PatternFlowTcpCtlUrg)(nil), // 1121: otg.PatternFlowTcpCtlUrg - (*PatternFlowTcpCtlAckCounter)(nil), // 1122: otg.PatternFlowTcpCtlAckCounter - (*PatternFlowTcpCtlAckMetricTag)(nil), // 1123: otg.PatternFlowTcpCtlAckMetricTag - (*PatternFlowTcpCtlAck)(nil), // 1124: otg.PatternFlowTcpCtlAck - (*PatternFlowTcpCtlPshCounter)(nil), // 1125: otg.PatternFlowTcpCtlPshCounter - (*PatternFlowTcpCtlPshMetricTag)(nil), // 1126: otg.PatternFlowTcpCtlPshMetricTag - (*PatternFlowTcpCtlPsh)(nil), // 1127: otg.PatternFlowTcpCtlPsh - (*PatternFlowTcpCtlRstCounter)(nil), // 1128: otg.PatternFlowTcpCtlRstCounter - (*PatternFlowTcpCtlRstMetricTag)(nil), // 1129: otg.PatternFlowTcpCtlRstMetricTag - (*PatternFlowTcpCtlRst)(nil), // 1130: otg.PatternFlowTcpCtlRst - (*PatternFlowTcpCtlSynCounter)(nil), // 1131: otg.PatternFlowTcpCtlSynCounter - (*PatternFlowTcpCtlSynMetricTag)(nil), // 1132: otg.PatternFlowTcpCtlSynMetricTag - (*PatternFlowTcpCtlSyn)(nil), // 1133: otg.PatternFlowTcpCtlSyn - (*PatternFlowTcpCtlFinCounter)(nil), // 1134: otg.PatternFlowTcpCtlFinCounter - (*PatternFlowTcpCtlFinMetricTag)(nil), // 1135: otg.PatternFlowTcpCtlFinMetricTag - (*PatternFlowTcpCtlFin)(nil), // 1136: otg.PatternFlowTcpCtlFin - (*PatternFlowTcpWindowCounter)(nil), // 1137: otg.PatternFlowTcpWindowCounter - (*PatternFlowTcpWindowMetricTag)(nil), // 1138: otg.PatternFlowTcpWindowMetricTag - (*PatternFlowTcpWindow)(nil), // 1139: otg.PatternFlowTcpWindow - (*PatternFlowTcpChecksum)(nil), // 1140: otg.PatternFlowTcpChecksum - (*PatternFlowUdpSrcPortCounter)(nil), // 1141: otg.PatternFlowUdpSrcPortCounter - (*PatternFlowUdpSrcPortMetricTag)(nil), // 1142: otg.PatternFlowUdpSrcPortMetricTag - (*PatternFlowUdpSrcPort)(nil), // 1143: otg.PatternFlowUdpSrcPort - (*PatternFlowUdpDstPortCounter)(nil), // 1144: otg.PatternFlowUdpDstPortCounter - (*PatternFlowUdpDstPortMetricTag)(nil), // 1145: otg.PatternFlowUdpDstPortMetricTag - (*PatternFlowUdpDstPort)(nil), // 1146: otg.PatternFlowUdpDstPort - (*PatternFlowUdpLengthCounter)(nil), // 1147: otg.PatternFlowUdpLengthCounter - (*PatternFlowUdpLengthMetricTag)(nil), // 1148: otg.PatternFlowUdpLengthMetricTag - (*PatternFlowUdpLength)(nil), // 1149: otg.PatternFlowUdpLength - (*PatternFlowUdpChecksum)(nil), // 1150: otg.PatternFlowUdpChecksum - (*PatternFlowGreChecksumPresentCounter)(nil), // 1151: otg.PatternFlowGreChecksumPresentCounter - (*PatternFlowGreChecksumPresentMetricTag)(nil), // 1152: otg.PatternFlowGreChecksumPresentMetricTag - (*PatternFlowGreChecksumPresent)(nil), // 1153: otg.PatternFlowGreChecksumPresent - (*PatternFlowGreReserved0Counter)(nil), // 1154: otg.PatternFlowGreReserved0Counter - (*PatternFlowGreReserved0MetricTag)(nil), // 1155: otg.PatternFlowGreReserved0MetricTag - (*PatternFlowGreReserved0)(nil), // 1156: otg.PatternFlowGreReserved0 - (*PatternFlowGreVersionCounter)(nil), // 1157: otg.PatternFlowGreVersionCounter - (*PatternFlowGreVersionMetricTag)(nil), // 1158: otg.PatternFlowGreVersionMetricTag - (*PatternFlowGreVersion)(nil), // 1159: otg.PatternFlowGreVersion - (*PatternFlowGreProtocolCounter)(nil), // 1160: otg.PatternFlowGreProtocolCounter - (*PatternFlowGreProtocolMetricTag)(nil), // 1161: otg.PatternFlowGreProtocolMetricTag - (*PatternFlowGreProtocol)(nil), // 1162: otg.PatternFlowGreProtocol - (*PatternFlowGreChecksum)(nil), // 1163: otg.PatternFlowGreChecksum - (*PatternFlowGreReserved1Counter)(nil), // 1164: otg.PatternFlowGreReserved1Counter - (*PatternFlowGreReserved1MetricTag)(nil), // 1165: otg.PatternFlowGreReserved1MetricTag - (*PatternFlowGreReserved1)(nil), // 1166: otg.PatternFlowGreReserved1 - (*PatternFlowGtpv1VersionCounter)(nil), // 1167: otg.PatternFlowGtpv1VersionCounter - (*PatternFlowGtpv1VersionMetricTag)(nil), // 1168: otg.PatternFlowGtpv1VersionMetricTag - (*PatternFlowGtpv1Version)(nil), // 1169: otg.PatternFlowGtpv1Version - (*PatternFlowGtpv1ProtocolTypeCounter)(nil), // 1170: otg.PatternFlowGtpv1ProtocolTypeCounter - (*PatternFlowGtpv1ProtocolTypeMetricTag)(nil), // 1171: otg.PatternFlowGtpv1ProtocolTypeMetricTag - (*PatternFlowGtpv1ProtocolType)(nil), // 1172: otg.PatternFlowGtpv1ProtocolType - (*PatternFlowGtpv1ReservedCounter)(nil), // 1173: otg.PatternFlowGtpv1ReservedCounter - (*PatternFlowGtpv1ReservedMetricTag)(nil), // 1174: otg.PatternFlowGtpv1ReservedMetricTag - (*PatternFlowGtpv1Reserved)(nil), // 1175: otg.PatternFlowGtpv1Reserved - (*PatternFlowGtpv1EFlagCounter)(nil), // 1176: otg.PatternFlowGtpv1EFlagCounter - (*PatternFlowGtpv1EFlagMetricTag)(nil), // 1177: otg.PatternFlowGtpv1EFlagMetricTag - (*PatternFlowGtpv1EFlag)(nil), // 1178: otg.PatternFlowGtpv1EFlag - (*PatternFlowGtpv1SFlagCounter)(nil), // 1179: otg.PatternFlowGtpv1SFlagCounter - (*PatternFlowGtpv1SFlagMetricTag)(nil), // 1180: otg.PatternFlowGtpv1SFlagMetricTag - (*PatternFlowGtpv1SFlag)(nil), // 1181: otg.PatternFlowGtpv1SFlag - (*PatternFlowGtpv1PnFlagCounter)(nil), // 1182: otg.PatternFlowGtpv1PnFlagCounter - (*PatternFlowGtpv1PnFlagMetricTag)(nil), // 1183: otg.PatternFlowGtpv1PnFlagMetricTag - (*PatternFlowGtpv1PnFlag)(nil), // 1184: otg.PatternFlowGtpv1PnFlag - (*PatternFlowGtpv1MessageTypeCounter)(nil), // 1185: otg.PatternFlowGtpv1MessageTypeCounter - (*PatternFlowGtpv1MessageTypeMetricTag)(nil), // 1186: otg.PatternFlowGtpv1MessageTypeMetricTag - (*PatternFlowGtpv1MessageType)(nil), // 1187: otg.PatternFlowGtpv1MessageType - (*PatternFlowGtpv1MessageLengthCounter)(nil), // 1188: otg.PatternFlowGtpv1MessageLengthCounter - (*PatternFlowGtpv1MessageLengthMetricTag)(nil), // 1189: otg.PatternFlowGtpv1MessageLengthMetricTag - (*PatternFlowGtpv1MessageLength)(nil), // 1190: otg.PatternFlowGtpv1MessageLength - (*PatternFlowGtpv1TeidCounter)(nil), // 1191: otg.PatternFlowGtpv1TeidCounter - (*PatternFlowGtpv1TeidMetricTag)(nil), // 1192: otg.PatternFlowGtpv1TeidMetricTag - (*PatternFlowGtpv1Teid)(nil), // 1193: otg.PatternFlowGtpv1Teid - (*PatternFlowGtpv1SquenceNumberCounter)(nil), // 1194: otg.PatternFlowGtpv1SquenceNumberCounter - (*PatternFlowGtpv1SquenceNumberMetricTag)(nil), // 1195: otg.PatternFlowGtpv1SquenceNumberMetricTag - (*PatternFlowGtpv1SquenceNumber)(nil), // 1196: otg.PatternFlowGtpv1SquenceNumber - (*PatternFlowGtpv1NPduNumberCounter)(nil), // 1197: otg.PatternFlowGtpv1NPduNumberCounter - (*PatternFlowGtpv1NPduNumberMetricTag)(nil), // 1198: otg.PatternFlowGtpv1NPduNumberMetricTag - (*PatternFlowGtpv1NPduNumber)(nil), // 1199: otg.PatternFlowGtpv1NPduNumber - (*PatternFlowGtpv1NextExtensionHeaderTypeCounter)(nil), // 1200: otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter - (*PatternFlowGtpv1NextExtensionHeaderTypeMetricTag)(nil), // 1201: otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - (*PatternFlowGtpv1NextExtensionHeaderType)(nil), // 1202: otg.PatternFlowGtpv1NextExtensionHeaderType - (*PatternFlowGtpExtensionExtensionLengthCounter)(nil), // 1203: otg.PatternFlowGtpExtensionExtensionLengthCounter - (*PatternFlowGtpExtensionExtensionLengthMetricTag)(nil), // 1204: otg.PatternFlowGtpExtensionExtensionLengthMetricTag - (*PatternFlowGtpExtensionExtensionLength)(nil), // 1205: otg.PatternFlowGtpExtensionExtensionLength - (*PatternFlowGtpExtensionContentsCounter)(nil), // 1206: otg.PatternFlowGtpExtensionContentsCounter - (*PatternFlowGtpExtensionContentsMetricTag)(nil), // 1207: otg.PatternFlowGtpExtensionContentsMetricTag - (*PatternFlowGtpExtensionContents)(nil), // 1208: otg.PatternFlowGtpExtensionContents - (*PatternFlowGtpExtensionNextExtensionHeaderCounter)(nil), // 1209: otg.PatternFlowGtpExtensionNextExtensionHeaderCounter - (*PatternFlowGtpExtensionNextExtensionHeaderMetricTag)(nil), // 1210: otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag - (*PatternFlowGtpExtensionNextExtensionHeader)(nil), // 1211: otg.PatternFlowGtpExtensionNextExtensionHeader - (*PatternFlowGtpv2VersionCounter)(nil), // 1212: otg.PatternFlowGtpv2VersionCounter - (*PatternFlowGtpv2VersionMetricTag)(nil), // 1213: otg.PatternFlowGtpv2VersionMetricTag - (*PatternFlowGtpv2Version)(nil), // 1214: otg.PatternFlowGtpv2Version - (*PatternFlowGtpv2PiggybackingFlagCounter)(nil), // 1215: otg.PatternFlowGtpv2PiggybackingFlagCounter - (*PatternFlowGtpv2PiggybackingFlagMetricTag)(nil), // 1216: otg.PatternFlowGtpv2PiggybackingFlagMetricTag - (*PatternFlowGtpv2PiggybackingFlag)(nil), // 1217: otg.PatternFlowGtpv2PiggybackingFlag - (*PatternFlowGtpv2TeidFlagCounter)(nil), // 1218: otg.PatternFlowGtpv2TeidFlagCounter - (*PatternFlowGtpv2TeidFlagMetricTag)(nil), // 1219: otg.PatternFlowGtpv2TeidFlagMetricTag - (*PatternFlowGtpv2TeidFlag)(nil), // 1220: otg.PatternFlowGtpv2TeidFlag - (*PatternFlowGtpv2Spare1Counter)(nil), // 1221: otg.PatternFlowGtpv2Spare1Counter - (*PatternFlowGtpv2Spare1MetricTag)(nil), // 1222: otg.PatternFlowGtpv2Spare1MetricTag - (*PatternFlowGtpv2Spare1)(nil), // 1223: otg.PatternFlowGtpv2Spare1 - (*PatternFlowGtpv2MessageTypeCounter)(nil), // 1224: otg.PatternFlowGtpv2MessageTypeCounter - (*PatternFlowGtpv2MessageTypeMetricTag)(nil), // 1225: otg.PatternFlowGtpv2MessageTypeMetricTag - (*PatternFlowGtpv2MessageType)(nil), // 1226: otg.PatternFlowGtpv2MessageType - (*PatternFlowGtpv2MessageLengthCounter)(nil), // 1227: otg.PatternFlowGtpv2MessageLengthCounter - (*PatternFlowGtpv2MessageLengthMetricTag)(nil), // 1228: otg.PatternFlowGtpv2MessageLengthMetricTag - (*PatternFlowGtpv2MessageLength)(nil), // 1229: otg.PatternFlowGtpv2MessageLength - (*PatternFlowGtpv2TeidCounter)(nil), // 1230: otg.PatternFlowGtpv2TeidCounter - (*PatternFlowGtpv2TeidMetricTag)(nil), // 1231: otg.PatternFlowGtpv2TeidMetricTag - (*PatternFlowGtpv2Teid)(nil), // 1232: otg.PatternFlowGtpv2Teid - (*PatternFlowGtpv2SequenceNumberCounter)(nil), // 1233: otg.PatternFlowGtpv2SequenceNumberCounter - (*PatternFlowGtpv2SequenceNumberMetricTag)(nil), // 1234: otg.PatternFlowGtpv2SequenceNumberMetricTag - (*PatternFlowGtpv2SequenceNumber)(nil), // 1235: otg.PatternFlowGtpv2SequenceNumber - (*PatternFlowGtpv2Spare2Counter)(nil), // 1236: otg.PatternFlowGtpv2Spare2Counter - (*PatternFlowGtpv2Spare2MetricTag)(nil), // 1237: otg.PatternFlowGtpv2Spare2MetricTag - (*PatternFlowGtpv2Spare2)(nil), // 1238: otg.PatternFlowGtpv2Spare2 - (*PatternFlowArpHardwareTypeCounter)(nil), // 1239: otg.PatternFlowArpHardwareTypeCounter - (*PatternFlowArpHardwareTypeMetricTag)(nil), // 1240: otg.PatternFlowArpHardwareTypeMetricTag - (*PatternFlowArpHardwareType)(nil), // 1241: otg.PatternFlowArpHardwareType - (*PatternFlowArpProtocolTypeCounter)(nil), // 1242: otg.PatternFlowArpProtocolTypeCounter - (*PatternFlowArpProtocolTypeMetricTag)(nil), // 1243: otg.PatternFlowArpProtocolTypeMetricTag - (*PatternFlowArpProtocolType)(nil), // 1244: otg.PatternFlowArpProtocolType - (*PatternFlowArpHardwareLengthCounter)(nil), // 1245: otg.PatternFlowArpHardwareLengthCounter - (*PatternFlowArpHardwareLengthMetricTag)(nil), // 1246: otg.PatternFlowArpHardwareLengthMetricTag - (*PatternFlowArpHardwareLength)(nil), // 1247: otg.PatternFlowArpHardwareLength - (*PatternFlowArpProtocolLengthCounter)(nil), // 1248: otg.PatternFlowArpProtocolLengthCounter - (*PatternFlowArpProtocolLengthMetricTag)(nil), // 1249: otg.PatternFlowArpProtocolLengthMetricTag - (*PatternFlowArpProtocolLength)(nil), // 1250: otg.PatternFlowArpProtocolLength - (*PatternFlowArpOperationCounter)(nil), // 1251: otg.PatternFlowArpOperationCounter - (*PatternFlowArpOperationMetricTag)(nil), // 1252: otg.PatternFlowArpOperationMetricTag - (*PatternFlowArpOperation)(nil), // 1253: otg.PatternFlowArpOperation - (*PatternFlowArpSenderHardwareAddrCounter)(nil), // 1254: otg.PatternFlowArpSenderHardwareAddrCounter - (*PatternFlowArpSenderHardwareAddrMetricTag)(nil), // 1255: otg.PatternFlowArpSenderHardwareAddrMetricTag - (*PatternFlowArpSenderHardwareAddr)(nil), // 1256: otg.PatternFlowArpSenderHardwareAddr - (*PatternFlowArpSenderProtocolAddrCounter)(nil), // 1257: otg.PatternFlowArpSenderProtocolAddrCounter - (*PatternFlowArpSenderProtocolAddrMetricTag)(nil), // 1258: otg.PatternFlowArpSenderProtocolAddrMetricTag - (*PatternFlowArpSenderProtocolAddr)(nil), // 1259: otg.PatternFlowArpSenderProtocolAddr - (*PatternFlowArpTargetHardwareAddrCounter)(nil), // 1260: otg.PatternFlowArpTargetHardwareAddrCounter - (*PatternFlowArpTargetHardwareAddrMetricTag)(nil), // 1261: otg.PatternFlowArpTargetHardwareAddrMetricTag - (*PatternFlowArpTargetHardwareAddr)(nil), // 1262: otg.PatternFlowArpTargetHardwareAddr - (*PatternFlowArpTargetProtocolAddrCounter)(nil), // 1263: otg.PatternFlowArpTargetProtocolAddrCounter - (*PatternFlowArpTargetProtocolAddrMetricTag)(nil), // 1264: otg.PatternFlowArpTargetProtocolAddrMetricTag - (*PatternFlowArpTargetProtocolAddr)(nil), // 1265: otg.PatternFlowArpTargetProtocolAddr - (*PatternFlowIcmpEchoTypeCounter)(nil), // 1266: otg.PatternFlowIcmpEchoTypeCounter - (*PatternFlowIcmpEchoTypeMetricTag)(nil), // 1267: otg.PatternFlowIcmpEchoTypeMetricTag - (*PatternFlowIcmpEchoType)(nil), // 1268: otg.PatternFlowIcmpEchoType - (*PatternFlowIcmpEchoCodeCounter)(nil), // 1269: otg.PatternFlowIcmpEchoCodeCounter - (*PatternFlowIcmpEchoCodeMetricTag)(nil), // 1270: otg.PatternFlowIcmpEchoCodeMetricTag - (*PatternFlowIcmpEchoCode)(nil), // 1271: otg.PatternFlowIcmpEchoCode - (*PatternFlowIcmpEchoChecksum)(nil), // 1272: otg.PatternFlowIcmpEchoChecksum - (*PatternFlowIcmpEchoIdentifierCounter)(nil), // 1273: otg.PatternFlowIcmpEchoIdentifierCounter - (*PatternFlowIcmpEchoIdentifierMetricTag)(nil), // 1274: otg.PatternFlowIcmpEchoIdentifierMetricTag - (*PatternFlowIcmpEchoIdentifier)(nil), // 1275: otg.PatternFlowIcmpEchoIdentifier - (*PatternFlowIcmpEchoSequenceNumberCounter)(nil), // 1276: otg.PatternFlowIcmpEchoSequenceNumberCounter - (*PatternFlowIcmpEchoSequenceNumberMetricTag)(nil), // 1277: otg.PatternFlowIcmpEchoSequenceNumberMetricTag - (*PatternFlowIcmpEchoSequenceNumber)(nil), // 1278: otg.PatternFlowIcmpEchoSequenceNumber - (*PatternFlowIcmpCommonChecksum)(nil), // 1279: otg.PatternFlowIcmpCommonChecksum - (*PatternFlowIcmpNextFieldsIdentifierCounter)(nil), // 1280: otg.PatternFlowIcmpNextFieldsIdentifierCounter - (*PatternFlowIcmpNextFieldsIdentifierMetricTag)(nil), // 1281: otg.PatternFlowIcmpNextFieldsIdentifierMetricTag - (*PatternFlowIcmpNextFieldsIdentifier)(nil), // 1282: otg.PatternFlowIcmpNextFieldsIdentifier - (*PatternFlowIcmpNextFieldsSequenceNumberCounter)(nil), // 1283: otg.PatternFlowIcmpNextFieldsSequenceNumberCounter - (*PatternFlowIcmpNextFieldsSequenceNumberMetricTag)(nil), // 1284: otg.PatternFlowIcmpNextFieldsSequenceNumberMetricTag - (*PatternFlowIcmpNextFieldsSequenceNumber)(nil), // 1285: otg.PatternFlowIcmpNextFieldsSequenceNumber - (*PatternFlowIcmpv6EchoTypeCounter)(nil), // 1286: otg.PatternFlowIcmpv6EchoTypeCounter - (*PatternFlowIcmpv6EchoTypeMetricTag)(nil), // 1287: otg.PatternFlowIcmpv6EchoTypeMetricTag - (*PatternFlowIcmpv6EchoType)(nil), // 1288: otg.PatternFlowIcmpv6EchoType - (*PatternFlowIcmpv6EchoCodeCounter)(nil), // 1289: otg.PatternFlowIcmpv6EchoCodeCounter - (*PatternFlowIcmpv6EchoCodeMetricTag)(nil), // 1290: otg.PatternFlowIcmpv6EchoCodeMetricTag - (*PatternFlowIcmpv6EchoCode)(nil), // 1291: otg.PatternFlowIcmpv6EchoCode - (*PatternFlowIcmpv6EchoIdentifierCounter)(nil), // 1292: otg.PatternFlowIcmpv6EchoIdentifierCounter - (*PatternFlowIcmpv6EchoIdentifierMetricTag)(nil), // 1293: otg.PatternFlowIcmpv6EchoIdentifierMetricTag - (*PatternFlowIcmpv6EchoIdentifier)(nil), // 1294: otg.PatternFlowIcmpv6EchoIdentifier - (*PatternFlowIcmpv6EchoSequenceNumberCounter)(nil), // 1295: otg.PatternFlowIcmpv6EchoSequenceNumberCounter - (*PatternFlowIcmpv6EchoSequenceNumberMetricTag)(nil), // 1296: otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag - (*PatternFlowIcmpv6EchoSequenceNumber)(nil), // 1297: otg.PatternFlowIcmpv6EchoSequenceNumber - (*PatternFlowIcmpv6EchoChecksum)(nil), // 1298: otg.PatternFlowIcmpv6EchoChecksum - (*PatternFlowIcmpv6CommonChecksum)(nil), // 1299: otg.PatternFlowIcmpv6CommonChecksum - (*PatternFlowPppAddressCounter)(nil), // 1300: otg.PatternFlowPppAddressCounter - (*PatternFlowPppAddressMetricTag)(nil), // 1301: otg.PatternFlowPppAddressMetricTag - (*PatternFlowPppAddress)(nil), // 1302: otg.PatternFlowPppAddress - (*PatternFlowPppControlCounter)(nil), // 1303: otg.PatternFlowPppControlCounter - (*PatternFlowPppControlMetricTag)(nil), // 1304: otg.PatternFlowPppControlMetricTag - (*PatternFlowPppControl)(nil), // 1305: otg.PatternFlowPppControl - (*PatternFlowPppProtocolTypeCounter)(nil), // 1306: otg.PatternFlowPppProtocolTypeCounter - (*PatternFlowPppProtocolTypeMetricTag)(nil), // 1307: otg.PatternFlowPppProtocolTypeMetricTag - (*PatternFlowPppProtocolType)(nil), // 1308: otg.PatternFlowPppProtocolType - (*PatternFlowIgmpv1VersionCounter)(nil), // 1309: otg.PatternFlowIgmpv1VersionCounter - (*PatternFlowIgmpv1VersionMetricTag)(nil), // 1310: otg.PatternFlowIgmpv1VersionMetricTag - (*PatternFlowIgmpv1Version)(nil), // 1311: otg.PatternFlowIgmpv1Version - (*PatternFlowIgmpv1TypeCounter)(nil), // 1312: otg.PatternFlowIgmpv1TypeCounter - (*PatternFlowIgmpv1TypeMetricTag)(nil), // 1313: otg.PatternFlowIgmpv1TypeMetricTag - (*PatternFlowIgmpv1Type)(nil), // 1314: otg.PatternFlowIgmpv1Type - (*PatternFlowIgmpv1UnusedCounter)(nil), // 1315: otg.PatternFlowIgmpv1UnusedCounter - (*PatternFlowIgmpv1UnusedMetricTag)(nil), // 1316: otg.PatternFlowIgmpv1UnusedMetricTag - (*PatternFlowIgmpv1Unused)(nil), // 1317: otg.PatternFlowIgmpv1Unused - (*PatternFlowIgmpv1Checksum)(nil), // 1318: otg.PatternFlowIgmpv1Checksum - (*PatternFlowIgmpv1GroupAddressCounter)(nil), // 1319: otg.PatternFlowIgmpv1GroupAddressCounter - (*PatternFlowIgmpv1GroupAddressMetricTag)(nil), // 1320: otg.PatternFlowIgmpv1GroupAddressMetricTag - (*PatternFlowIgmpv1GroupAddress)(nil), // 1321: otg.PatternFlowIgmpv1GroupAddress - (*PatternFlowMplsLabelCounter)(nil), // 1322: otg.PatternFlowMplsLabelCounter - (*PatternFlowMplsLabelMetricTag)(nil), // 1323: otg.PatternFlowMplsLabelMetricTag - (*PatternFlowMplsLabel)(nil), // 1324: otg.PatternFlowMplsLabel - (*PatternFlowMplsTrafficClassCounter)(nil), // 1325: otg.PatternFlowMplsTrafficClassCounter - (*PatternFlowMplsTrafficClassMetricTag)(nil), // 1326: otg.PatternFlowMplsTrafficClassMetricTag - (*PatternFlowMplsTrafficClass)(nil), // 1327: otg.PatternFlowMplsTrafficClass - (*PatternFlowMplsBottomOfStackCounter)(nil), // 1328: otg.PatternFlowMplsBottomOfStackCounter - (*PatternFlowMplsBottomOfStackMetricTag)(nil), // 1329: otg.PatternFlowMplsBottomOfStackMetricTag - (*PatternFlowMplsBottomOfStack)(nil), // 1330: otg.PatternFlowMplsBottomOfStack - (*PatternFlowMplsTimeToLiveCounter)(nil), // 1331: otg.PatternFlowMplsTimeToLiveCounter - (*PatternFlowMplsTimeToLiveMetricTag)(nil), // 1332: otg.PatternFlowMplsTimeToLiveMetricTag - (*PatternFlowMplsTimeToLive)(nil), // 1333: otg.PatternFlowMplsTimeToLive - (*PatternFlowSnmpv2CVersionCounter)(nil), // 1334: otg.PatternFlowSnmpv2cVersionCounter - (*PatternFlowSnmpv2CVersion)(nil), // 1335: otg.PatternFlowSnmpv2cVersion - (*PatternFlowSnmpv2CPDURequestIdCounter)(nil), // 1336: otg.PatternFlowSnmpv2cPDURequestIdCounter - (*PatternFlowSnmpv2CPDURequestId)(nil), // 1337: otg.PatternFlowSnmpv2cPDURequestId - (*PatternFlowSnmpv2CPDUErrorIndexCounter)(nil), // 1338: otg.PatternFlowSnmpv2cPDUErrorIndexCounter - (*PatternFlowSnmpv2CPDUErrorIndex)(nil), // 1339: otg.PatternFlowSnmpv2cPDUErrorIndex - (*PatternFlowSnmpv2CBulkPDURequestIdCounter)(nil), // 1340: otg.PatternFlowSnmpv2cBulkPDURequestIdCounter - (*PatternFlowSnmpv2CBulkPDURequestId)(nil), // 1341: otg.PatternFlowSnmpv2cBulkPDURequestId - (*PatternFlowSnmpv2CBulkPDUNonRepeaters)(nil), // 1342: otg.PatternFlowSnmpv2cBulkPDUNonRepeaters - (*PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter)(nil), // 1343: otg.PatternFlowSnmpv2cBulkPDUMaxRepetitionsCounter - (*PatternFlowSnmpv2CBulkPDUMaxRepetitions)(nil), // 1344: otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions - (*PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter)(nil), // 1345: otg.PatternFlowSnmpv2cVariableBindingValueIntegerValueCounter - (*PatternFlowSnmpv2CVariableBindingValueIntegerValue)(nil), // 1346: otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue - (*PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter)(nil), // 1347: otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValueCounter - (*PatternFlowSnmpv2CVariableBindingValueIpAddressValue)(nil), // 1348: otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue - (*PatternFlowSnmpv2CVariableBindingValueCounterValueCounter)(nil), // 1349: otg.PatternFlowSnmpv2cVariableBindingValueCounterValueCounter - (*PatternFlowSnmpv2CVariableBindingValueCounterValue)(nil), // 1350: otg.PatternFlowSnmpv2cVariableBindingValueCounterValue - (*PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter)(nil), // 1351: otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValueCounter - (*PatternFlowSnmpv2CVariableBindingValueTimeticksValue)(nil), // 1352: otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue - (*PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter)(nil), // 1353: otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValueCounter - (*PatternFlowSnmpv2CVariableBindingValueBigCounterValue)(nil), // 1354: otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue - (*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter)(nil), // 1355: otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValueCounter - (*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue)(nil), // 1356: otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue - (*PatternFlowSnmpv2CCommonRequestIdCounter)(nil), // 1357: otg.PatternFlowSnmpv2cCommonRequestIdCounter - (*PatternFlowSnmpv2CCommonRequestId)(nil), // 1358: otg.PatternFlowSnmpv2cCommonRequestId - (*PatternFlowRsvpRsvpChecksum)(nil), // 1359: otg.PatternFlowRsvpRsvpChecksum - (*PatternFlowRsvpTimeToLiveCounter)(nil), // 1360: otg.PatternFlowRsvpTimeToLiveCounter - (*PatternFlowRsvpTimeToLive)(nil), // 1361: otg.PatternFlowRsvpTimeToLive - (*PatternFlowRsvpReservedCounter)(nil), // 1362: otg.PatternFlowRsvpReservedCounter - (*PatternFlowRsvpReserved)(nil), // 1363: otg.PatternFlowRsvpReserved - (*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter)(nil), // 1364: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - (*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress)(nil), // 1365: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - (*PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter)(nil), // 1366: otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - (*PatternFlowRSVPPathSessionLspTunnelIpv4Reserved)(nil), // 1367: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - (*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter)(nil), // 1368: otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - (*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId)(nil), // 1369: otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - (*PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter)(nil), // 1370: otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - (*PatternFlowRSVPPathSessionExtTunnelIdAsInteger)(nil), // 1371: otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger - (*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter)(nil), // 1372: otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - (*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4)(nil), // 1373: otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - (*PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter)(nil), // 1374: otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - (*PatternFlowRSVPPathRsvpHopIpv4Ipv4Address)(nil), // 1375: otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - (*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter)(nil), // 1376: otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - (*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle)(nil), // 1377: otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - (*PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter)(nil), // 1378: otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - (*PatternFlowRSVPPathTimeValuesType1RefreshPeriodR)(nil), // 1379: otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter)(nil), // 1380: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit)(nil), // 1381: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter)(nil), // 1382: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address)(nil), // 1383: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - (*PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter)(nil), // 1384: otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - (*PatternFlowRSVPPathExplicitRouteType1ASNumberLBit)(nil), // 1385: otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter)(nil), // 1386: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved)(nil), // 1387: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter)(nil), // 1388: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pidCounter - (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid)(nil), // 1389: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid - (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter)(nil), // 1390: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress)(nil), // 1391: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter)(nil), // 1392: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved)(nil), // 1393: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter)(nil), // 1394: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId)(nil), // 1395: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - (*PatternFlowRSVPPathSenderTspecIntServVersionCounter)(nil), // 1396: otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter - (*PatternFlowRSVPPathSenderTspecIntServVersion)(nil), // 1397: otg.PatternFlowRSVPPathSenderTspecIntServVersion - (*PatternFlowRSVPPathSenderTspecIntServReserved1Counter)(nil), // 1398: otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter - (*PatternFlowRSVPPathSenderTspecIntServReserved1)(nil), // 1399: otg.PatternFlowRSVPPathSenderTspecIntServReserved1 - (*PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter)(nil), // 1400: otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - (*PatternFlowRSVPPathSenderTspecIntServOverallLength)(nil), // 1401: otg.PatternFlowRSVPPathSenderTspecIntServOverallLength - (*PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter)(nil), // 1402: otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - (*PatternFlowRSVPPathSenderTspecIntServServiceHeader)(nil), // 1403: otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader - (*PatternFlowRSVPPathSenderTspecIntServZeroBitCounter)(nil), // 1404: otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - (*PatternFlowRSVPPathSenderTspecIntServZeroBit)(nil), // 1405: otg.PatternFlowRSVPPathSenderTspecIntServZeroBit - (*PatternFlowRSVPPathSenderTspecIntServReserved2Counter)(nil), // 1406: otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter - (*PatternFlowRSVPPathSenderTspecIntServReserved2)(nil), // 1407: otg.PatternFlowRSVPPathSenderTspecIntServReserved2 - (*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter)(nil), // 1408: otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - (*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData)(nil), // 1409: otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - (*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter)(nil), // 1410: otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - (*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec)(nil), // 1411: otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - (*PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter)(nil), // 1412: otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - (*PatternFlowRSVPPathSenderTspecIntServParameter127Flag)(nil), // 1413: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag - (*PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter)(nil), // 1414: otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - (*PatternFlowRSVPPathSenderTspecIntServParameter127Length)(nil), // 1415: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length - (*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter)(nil), // 1416: otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - (*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit)(nil), // 1417: otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - (*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter)(nil), // 1418: otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - (*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize)(nil), // 1419: otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter)(nil), // 1420: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address)(nil), // 1421: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter)(nil), // 1422: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength)(nil), // 1423: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - (*PatternFlowRSVPPathRecordRouteType1LabelFlags)(nil), // 1424: otg.PatternFlowRSVPPathRecordRouteType1LabelFlags - (*PatternFlowRSVPPathRecordRouteType1LabelCType)(nil), // 1425: otg.PatternFlowRSVPPathRecordRouteType1LabelCType - (*PatternFlowRSVPPathObjectsCustomTypeCounter)(nil), // 1426: otg.PatternFlowRSVPPathObjectsCustomTypeCounter - (*PatternFlowRSVPPathObjectsCustomType)(nil), // 1427: otg.PatternFlowRSVPPathObjectsCustomType - (*Version)(nil), // 1428: otg.Version - (*Success)(nil), // 1429: otg.Success - (*Failure)(nil), // 1430: otg.Failure - (*SetConfigRequest)(nil), // 1431: otg.SetConfigRequest - (*UpdateConfigRequest)(nil), // 1432: otg.UpdateConfigRequest - (*SetConfigResponse)(nil), // 1433: otg.SetConfigResponse - (*GetConfigResponse)(nil), // 1434: otg.GetConfigResponse - (*UpdateConfigResponse)(nil), // 1435: otg.UpdateConfigResponse - (*SetControlStateRequest)(nil), // 1436: otg.SetControlStateRequest - (*SetControlStateResponse)(nil), // 1437: otg.SetControlStateResponse - (*SetControlActionRequest)(nil), // 1438: otg.SetControlActionRequest - (*SetControlActionResponse)(nil), // 1439: otg.SetControlActionResponse - (*GetMetricsRequest)(nil), // 1440: otg.GetMetricsRequest - (*GetMetricsResponse)(nil), // 1441: otg.GetMetricsResponse - (*GetStatesRequest)(nil), // 1442: otg.GetStatesRequest - (*GetStatesResponse)(nil), // 1443: otg.GetStatesResponse - (*GetCaptureRequest)(nil), // 1444: otg.GetCaptureRequest - (*GetCaptureResponse)(nil), // 1445: otg.GetCaptureResponse - (*GetVersionResponse)(nil), // 1446: otg.GetVersionResponse - (*LagProtocol_Choice)(nil), // 1447: otg.LagProtocol.Choice - (*LagPortLacp_ActorActivity)(nil), // 1448: otg.LagPortLacp.ActorActivity - (*EthernetConnection_Choice)(nil), // 1449: otg.EthernetConnection.Choice - (*DeviceVlan_Tpid)(nil), // 1450: otg.DeviceVlan.Tpid - (*DeviceIpv4GatewayMAC_Choice)(nil), // 1451: otg.DeviceIpv4GatewayMAC.Choice - (*DeviceIpv6GatewayMAC_Choice)(nil), // 1452: otg.DeviceIpv6GatewayMAC.Choice - (*DeviceDhcpv4Client_Choice)(nil), // 1453: otg.DeviceDhcpv4client.Choice - (*Layer1_Speed)(nil), // 1454: otg.Layer1.Speed - (*Layer1_Media)(nil), // 1455: otg.Layer1.Media - (*Layer1FlowControl_Choice)(nil), // 1456: otg.Layer1FlowControl.Choice - (*Capture_Format)(nil), // 1457: otg.Capture.Format - (*CaptureFilter_Choice)(nil), // 1458: otg.CaptureFilter.Choice - (*IsisInterface_NetworkType)(nil), // 1459: otg.IsisInterface.NetworkType - (*IsisInterface_LevelType)(nil), // 1460: otg.IsisInterface.LevelType - (*IsisInterfaceAuthentication_AuthType)(nil), // 1461: otg.IsisInterfaceAuthentication.AuthType - (*IsisAuthenticationBase_AuthType)(nil), // 1462: otg.IsisAuthenticationBase.AuthType - (*IsisV4RouteRange_OriginType)(nil), // 1463: otg.IsisV4RouteRange.OriginType - (*IsisV4RouteRange_RedistributionType)(nil), // 1464: otg.IsisV4RouteRange.RedistributionType - (*IsisV6RouteRange_OriginType)(nil), // 1465: otg.IsisV6RouteRange.OriginType - (*IsisV6RouteRange_RedistributionType)(nil), // 1466: otg.IsisV6RouteRange.RedistributionType - (*DeviceBgpMessageHeaderError_Subcode)(nil), // 1467: otg.DeviceBgpMessageHeaderError.Subcode - (*DeviceBgpOpenMessageError_Subcode)(nil), // 1468: otg.DeviceBgpOpenMessageError.Subcode - (*DeviceBgpUpdateMessageError_Subcode)(nil), // 1469: otg.DeviceBgpUpdateMessageError.Subcode - (*DeviceBgpCeaseError_Subcode)(nil), // 1470: otg.DeviceBgpCeaseError.Subcode - (*BgpV4Peer_AsType)(nil), // 1471: otg.BgpV4Peer.AsType - (*BgpV4Peer_AsNumberWidth)(nil), // 1472: otg.BgpV4Peer.AsNumberWidth - (*BgpV4EthernetSegment_ActiveMode)(nil), // 1473: otg.BgpV4EthernetSegment.ActiveMode - (*BgpRouteAdvanced_Origin)(nil), // 1474: otg.BgpRouteAdvanced.Origin - (*BgpCommunity_Type)(nil), // 1475: otg.BgpCommunity.Type - (*BgpExtCommunity_Type)(nil), // 1476: otg.BgpExtCommunity.Type - (*BgpExtCommunity_Subtype)(nil), // 1477: otg.BgpExtCommunity.Subtype - (*BgpAsPath_AsSetMode)(nil), // 1478: otg.BgpAsPath.AsSetMode - (*BgpAsPathSegment_Type)(nil), // 1479: otg.BgpAsPathSegment.Type - (*BgpV4EvpnEvis_Choice)(nil), // 1480: otg.BgpV4EvpnEvis.Choice - (*BgpV4EviVxlan_ReplicationType)(nil), // 1481: otg.BgpV4EviVxlan.ReplicationType - (*BgpRouteDistinguisher_RdType)(nil), // 1482: otg.BgpRouteDistinguisher.RdType - (*BgpRouteTarget_RtType)(nil), // 1483: otg.BgpRouteTarget.RtType - (*BgpV4RouteRange_NextHopMode)(nil), // 1484: otg.BgpV4RouteRange.NextHopMode - (*BgpV4RouteRange_NextHopAddressType)(nil), // 1485: otg.BgpV4RouteRange.NextHopAddressType - (*BgpExtendedCommunity_Choice)(nil), // 1486: otg.BgpExtendedCommunity.Choice - (*BgpExtendedCommunityTransitive2OctetAsType_Choice)(nil), // 1487: otg.BgpExtendedCommunityTransitive2OctetAsType.Choice - (*BgpExtendedCommunityTransitiveIpv4AddressType_Choice)(nil), // 1488: otg.BgpExtendedCommunityTransitiveIpv4AddressType.Choice - (*BgpExtendedCommunityTransitive4OctetAsType_Choice)(nil), // 1489: otg.BgpExtendedCommunityTransitive4OctetAsType.Choice - (*BgpExtendedCommunityTransitiveOpaqueType_Choice)(nil), // 1490: otg.BgpExtendedCommunityTransitiveOpaqueType.Choice - (*BgpExtendedCommunityTransitiveEvpnType_Choice)(nil), // 1491: otg.BgpExtendedCommunityTransitiveEvpnType.Choice - (*BgpExtendedCommunityNonTransitive2OctetAsType_Choice)(nil), // 1492: otg.BgpExtendedCommunityNonTransitive2OctetAsType.Choice - (*BgpV6RouteRange_NextHopMode)(nil), // 1493: otg.BgpV6RouteRange.NextHopMode - (*BgpV6RouteRange_NextHopAddressType)(nil), // 1494: otg.BgpV6RouteRange.NextHopAddressType - (*BgpSrteV4Policy_NextHopMode)(nil), // 1495: otg.BgpSrteV4Policy.NextHopMode - (*BgpSrteV4Policy_NextHopAddressType)(nil), // 1496: otg.BgpSrteV4Policy.NextHopAddressType - (*BgpSrteRemoteEndpointSubTlv_AddressFamily)(nil), // 1497: otg.BgpSrteRemoteEndpointSubTlv.AddressFamily - (*BgpSrteBindingSubTlv_BindingSidType)(nil), // 1498: otg.BgpSrteBindingSubTlv.BindingSidType - (*BgpSrteExplicitNullLabelPolicySubTlv_ExplicitNullLabelPolicy)(nil), // 1499: otg.BgpSrteExplicitNullLabelPolicySubTlv.ExplicitNullLabelPolicy - (*BgpSrteSegment_SegmentType)(nil), // 1500: otg.BgpSrteSegment.SegmentType - (*BgpSrteV6Policy_NextHopMode)(nil), // 1501: otg.BgpSrteV6Policy.NextHopMode - (*BgpSrteV6Policy_NextHopAddressType)(nil), // 1502: otg.BgpSrteV6Policy.NextHopAddressType - (*BgpUpdateReplay_Choice)(nil), // 1503: otg.BgpUpdateReplay.Choice - (*BgpAttributes_Origin)(nil), // 1504: otg.BgpAttributes.Origin - (*BgpAttributesAsPath_Choice)(nil), // 1505: otg.BgpAttributesAsPath.Choice - (*BgpAttributesFourByteAsPathSegment_Type)(nil), // 1506: otg.BgpAttributesFourByteAsPathSegment.Type - (*BgpAttributesTwoByteAsPathSegment_Type)(nil), // 1507: otg.BgpAttributesTwoByteAsPathSegment.Type - (*BgpAttributesAggregator_Choice)(nil), // 1508: otg.BgpAttributesAggregator.Choice - (*BgpAttributesCommunity_Choice)(nil), // 1509: otg.BgpAttributesCommunity.Choice - (*BgpAttributesNextHop_Choice)(nil), // 1510: otg.BgpAttributesNextHop.Choice - (*BgpAttributesMpReachNlri_Choice)(nil), // 1511: otg.BgpAttributesMpReachNlri.Choice - (*BgpAttributesMpUnreachNlri_Choice)(nil), // 1512: otg.BgpAttributesMpUnreachNlri.Choice - (*BgpAttributesTunnelEncapsulation_Choice)(nil), // 1513: otg.BgpAttributesTunnelEncapsulation.Choice - (*BgpAttributesBsid_Choice)(nil), // 1514: otg.BgpAttributesBsid.Choice - (*BgpAttributesSrPolicyExplicitNullPolicy_Choice)(nil), // 1515: otg.BgpAttributesSrPolicyExplicitNullPolicy.Choice - (*BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice)(nil), // 1516: otg.BgpAttributesSegmentRoutingPolicySegmentListSegment.Choice - (*BgpV6Peer_AsType)(nil), // 1517: otg.BgpV6Peer.AsType - (*BgpV6Peer_AsNumberWidth)(nil), // 1518: otg.BgpV6Peer.AsNumberWidth - (*BgpV6EthernetSegment_ActiveMode)(nil), // 1519: otg.BgpV6EthernetSegment.ActiveMode - (*BgpV6EvpnEvis_Choice)(nil), // 1520: otg.BgpV6EvpnEvis.Choice - (*BgpV6EviVxlan_ReplicationType)(nil), // 1521: otg.BgpV6EviVxlan.ReplicationType - (*VxlanV4TunnelDestinationIPMode_Choice)(nil), // 1522: otg.VxlanV4TunnelDestinationIPMode.Choice - (*VxlanV6TunnelDestinationIPMode_Choice)(nil), // 1523: otg.VxlanV6TunnelDestinationIPMode.Choice - (*RsvpLspIpv4InterfaceP2PEgressIpv4Lsp_ReservationStyle)(nil), // 1524: otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp.ReservationStyle - (*RsvpEro_PrependNeighborIp)(nil), // 1525: otg.RsvpEro.PrependNeighborIp - (*RsvpEroSubobject_Type)(nil), // 1526: otg.RsvpEroSubobject.Type - (*RsvpEroSubobject_HopType)(nil), // 1527: otg.RsvpEroSubobject.HopType - (*FlowTxRx_Choice)(nil), // 1528: otg.FlowTxRx.Choice - (*FlowRouter_Mode)(nil), // 1529: otg.FlowRouter.Mode - (*FlowHeader_Choice)(nil), // 1530: otg.FlowHeader.Choice - (*FlowIpv4Options_Choice)(nil), // 1531: otg.FlowIpv4Options.Choice - (*FlowIpv4OptionsCustomLength_Choice)(nil), // 1532: otg.FlowIpv4OptionsCustomLength.Choice - (*FlowIpv4Priority_Choice)(nil), // 1533: otg.FlowIpv4Priority.Choice - (*FlowIpv4Auto_Choice)(nil), // 1534: otg.FlowIpv4Auto.Choice - (*FlowIcmp_Choice)(nil), // 1535: otg.FlowIcmp.Choice - (*FlowIcmpv6_Choice)(nil), // 1536: otg.FlowIcmpv6.Choice - (*FlowSnmpv2CData_Choice)(nil), // 1537: otg.FlowSnmpv2cData.Choice - (*FlowSnmpv2CPDU_ErrorStatus)(nil), // 1538: otg.FlowSnmpv2cPDU.ErrorStatus - (*FlowSnmpv2CVariableBindingValue_Choice)(nil), // 1539: otg.FlowSnmpv2cVariableBindingValue.Choice - (*FlowSnmpv2CVariableBindingStringValue_Choice)(nil), // 1540: otg.FlowSnmpv2cVariableBindingStringValue.Choice - (*FlowRsvp_Flag)(nil), // 1541: otg.FlowRsvp.Flag - (*FlowRSVPLength_Choice)(nil), // 1542: otg.FlowRSVPLength.Choice - (*FlowRSVPMessage_Choice)(nil), // 1543: otg.FlowRSVPMessage.Choice - (*FlowRSVPObjectLength_Choice)(nil), // 1544: otg.FlowRSVPObjectLength.Choice - (*FlowRSVPPathObjectsClass_Choice)(nil), // 1545: otg.FlowRSVPPathObjectsClass.Choice - (*FlowRSVPPathObjectsSessionCType_Choice)(nil), // 1546: otg.FlowRSVPPathObjectsSessionCType.Choice - (*FlowRSVPPathSessionExtTunnelId_Choice)(nil), // 1547: otg.FlowRSVPPathSessionExtTunnelId.Choice - (*FlowRSVPPathObjectsRsvpHopCType_Choice)(nil), // 1548: otg.FlowRSVPPathObjectsRsvpHopCType.Choice - (*FlowRSVPPathObjectsTimeValuesCType_Choice)(nil), // 1549: otg.FlowRSVPPathObjectsTimeValuesCType.Choice - (*FlowRSVPPathObjectsClassExplicitRouteCType_Choice)(nil), // 1550: otg.FlowRSVPPathObjectsClassExplicitRouteCType.Choice - (*FlowRSVPType1ExplicitRouteSubobjectsType_Choice)(nil), // 1551: otg.FlowRSVPType1ExplicitRouteSubobjectsType.Choice - (*FlowRSVPExplicitRouteLength_Choice)(nil), // 1552: otg.FlowRSVPExplicitRouteLength.Choice - (*FlowRSVPExplicitRouteASNumberLength_Choice)(nil), // 1553: otg.FlowRSVPExplicitRouteASNumberLength.Choice - (*FlowRSVPPathObjectsLabelRequestCType_Choice)(nil), // 1554: otg.FlowRSVPPathObjectsLabelRequestCType.Choice - (*FlowRSVPPathObjectsSessionAttributeCType_Choice)(nil), // 1555: otg.FlowRSVPPathObjectsSessionAttributeCType.Choice - (*FlowRSVPLspTunnelFlag_Choice)(nil), // 1556: otg.FlowRSVPLspTunnelFlag.Choice - (*FlowRSVPSessionAttributeNameLength_Choice)(nil), // 1557: otg.FlowRSVPSessionAttributeNameLength.Choice - (*FlowRSVPPathObjectsSenderTemplateCType_Choice)(nil), // 1558: otg.FlowRSVPPathObjectsSenderTemplateCType.Choice - (*FlowRSVPPathObjectsSenderTspecCType_Choice)(nil), // 1559: otg.FlowRSVPPathObjectsSenderTspecCType.Choice - (*FlowRSVPPathObjectsRecordRouteCType_Choice)(nil), // 1560: otg.FlowRSVPPathObjectsRecordRouteCType.Choice - (*FlowRSVPPathObjectsRecordRouteSubObjectType_Choice)(nil), // 1561: otg.FlowRSVPPathObjectsRecordRouteSubObjectType.Choice - (*FlowRSVPRecordRouteIPv4Flag_Choice)(nil), // 1562: otg.FlowRSVPRecordRouteIPv4Flag.Choice - (*FlowRSVPPathRecordRouteLabel_Choice)(nil), // 1563: otg.FlowRSVPPathRecordRouteLabel.Choice - (*FlowRSVPRouteRecordLength_Choice)(nil), // 1564: otg.FlowRSVPRouteRecordLength.Choice - (*FlowSize_Choice)(nil), // 1565: otg.FlowSize.Choice - (*FlowSizeWeightPairs_Choice)(nil), // 1566: otg.FlowSizeWeightPairs.Choice - (*FlowSizeWeightPairs_Predefined)(nil), // 1567: otg.FlowSizeWeightPairs.Predefined - (*FlowRate_Choice)(nil), // 1568: otg.FlowRate.Choice - (*FlowDuration_Choice)(nil), // 1569: otg.FlowDuration.Choice - (*FlowDelay_Choice)(nil), // 1570: otg.FlowDelay.Choice - (*FlowDurationInterBurstGap_Choice)(nil), // 1571: otg.FlowDurationInterBurstGap.Choice - (*FlowLatencyMetrics_Mode)(nil), // 1572: otg.FlowLatencyMetrics.Mode - (*FlowRxTxRatio_Choice)(nil), // 1573: otg.FlowRxTxRatio.Choice - (*EventRequest_Type)(nil), // 1574: otg.EventRequest.Type - (*LldpConnection_Choice)(nil), // 1575: otg.LldpConnection.Choice - (*LldpChassisId_Choice)(nil), // 1576: otg.LldpChassisId.Choice - (*LldpPortId_Choice)(nil), // 1577: otg.LldpPortId.Choice - (*LldpChassisMacSubType_Choice)(nil), // 1578: otg.LldpChassisMacSubType.Choice - (*LldpPortInterfaceNameSubType_Choice)(nil), // 1579: otg.LldpPortInterfaceNameSubType.Choice - (*LldpSystemName_Choice)(nil), // 1580: otg.LldpSystemName.Choice - (*Error_Kind)(nil), // 1581: otg.Error.Kind - (*ConfigUpdate_Choice)(nil), // 1582: otg.ConfigUpdate.Choice - (*FlowsUpdate_PropertyNames)(nil), // 1583: otg.FlowsUpdate.PropertyNames - (*ControlState_Choice)(nil), // 1584: otg.ControlState.Choice - (*StatePort_Choice)(nil), // 1585: otg.StatePort.Choice - (*StateTraffic_Choice)(nil), // 1586: otg.StateTraffic.Choice - (*StateProtocol_Choice)(nil), // 1587: otg.StateProtocol.Choice - (*StatePortLink_State)(nil), // 1588: otg.StatePortLink.State - (*StatePortCapture_State)(nil), // 1589: otg.StatePortCapture.State - (*StateTrafficFlowTransmit_State)(nil), // 1590: otg.StateTrafficFlowTransmit.State - (*StateProtocolAll_State)(nil), // 1591: otg.StateProtocolAll.State - (*StateProtocolRoute_State)(nil), // 1592: otg.StateProtocolRoute.State - (*StateProtocolLacp_Choice)(nil), // 1593: otg.StateProtocolLacp.Choice - (*StateProtocolLacpAdmin_State)(nil), // 1594: otg.StateProtocolLacpAdmin.State - (*StateProtocolLacpMemberPorts_State)(nil), // 1595: otg.StateProtocolLacpMemberPorts.State - (*StateProtocolBgp_Choice)(nil), // 1596: otg.StateProtocolBgp.Choice - (*StateProtocolBgpPeers_State)(nil), // 1597: otg.StateProtocolBgpPeers.State - (*StateProtocolIsis_Choice)(nil), // 1598: otg.StateProtocolIsis.Choice - (*StateProtocolIsisRouters_State)(nil), // 1599: otg.StateProtocolIsisRouters.State - (*ControlAction_Choice)(nil), // 1600: otg.ControlAction.Choice - (*ActionResponse_Choice)(nil), // 1601: otg.ActionResponse.Choice - (*ActionProtocol_Choice)(nil), // 1602: otg.ActionProtocol.Choice - (*ActionResponseProtocol_Choice)(nil), // 1603: otg.ActionResponseProtocol.Choice - (*ActionProtocolIpv4_Choice)(nil), // 1604: otg.ActionProtocolIpv4.Choice - (*ActionResponseProtocolIpv4_Choice)(nil), // 1605: otg.ActionResponseProtocolIpv4.Choice - (*ActionResponseProtocolIpv4PingResponse_Result)(nil), // 1606: otg.ActionResponseProtocolIpv4PingResponse.Result - (*ActionProtocolIpv6_Choice)(nil), // 1607: otg.ActionProtocolIpv6.Choice - (*ActionResponseProtocolIpv6_Choice)(nil), // 1608: otg.ActionResponseProtocolIpv6.Choice - (*ActionResponseProtocolIpv6PingResponse_Result)(nil), // 1609: otg.ActionResponseProtocolIpv6PingResponse.Result - (*ActionProtocolBgp_Choice)(nil), // 1610: otg.ActionProtocolBgp.Choice - (*ActionProtocolBgpNotification_Choice)(nil), // 1611: otg.ActionProtocolBgpNotification.Choice - (*MetricsRequest_Choice)(nil), // 1612: otg.MetricsRequest.Choice - (*MetricsResponse_Choice)(nil), // 1613: otg.MetricsResponse.Choice - (*PortMetricsRequest_ColumnNames)(nil), // 1614: otg.PortMetricsRequest.ColumnNames - (*PortMetric_Link)(nil), // 1615: otg.PortMetric.Link - (*PortMetric_Capture)(nil), // 1616: otg.PortMetric.Capture - (*PortMetric_Transmit)(nil), // 1617: otg.PortMetric.Transmit - (*FlowMetricsRequest_MetricNames)(nil), // 1618: otg.FlowMetricsRequest.MetricNames - (*FlowTaggedMetricsFilter_MetricNames)(nil), // 1619: otg.FlowTaggedMetricsFilter.MetricNames - (*FlowMetric_Transmit)(nil), // 1620: otg.FlowMetric.Transmit - (*FlowMetricTagValue_Choice)(nil), // 1621: otg.FlowMetricTagValue.Choice - (*Bgpv4MetricsRequest_ColumnNames)(nil), // 1622: otg.Bgpv4MetricsRequest.ColumnNames - (*Bgpv4Metric_SessionState)(nil), // 1623: otg.Bgpv4Metric.SessionState - (*Bgpv4Metric_FsmState)(nil), // 1624: otg.Bgpv4Metric.FsmState - (*Bgpv6MetricsRequest_ColumnNames)(nil), // 1625: otg.Bgpv6MetricsRequest.ColumnNames - (*Bgpv6Metric_SessionState)(nil), // 1626: otg.Bgpv6Metric.SessionState - (*Bgpv6Metric_FsmState)(nil), // 1627: otg.Bgpv6Metric.FsmState - (*IsisMetricsRequest_ColumnNames)(nil), // 1628: otg.IsisMetricsRequest.ColumnNames - (*LagMetricsRequest_ColumnNames)(nil), // 1629: otg.LagMetricsRequest.ColumnNames - (*LagMetric_OperStatus)(nil), // 1630: otg.LagMetric.OperStatus - (*LacpMetricsRequest_ColumnNames)(nil), // 1631: otg.LacpMetricsRequest.ColumnNames - (*LacpMetric_Activity)(nil), // 1632: otg.LacpMetric.Activity - (*LacpMetric_Timeout)(nil), // 1633: otg.LacpMetric.Timeout - (*LacpMetric_Synchronization)(nil), // 1634: otg.LacpMetric.Synchronization - (*LldpMetricsRequest_ColumnNames)(nil), // 1635: otg.LldpMetricsRequest.ColumnNames - (*RsvpMetricsRequest_ColumnNames)(nil), // 1636: otg.RsvpMetricsRequest.ColumnNames - (*Dhcpv4ClientMetricsRequest_ColumnNames)(nil), // 1637: otg.Dhcpv4ClientMetricsRequest.ColumnNames - (*Dhcpv4ServerMetricsRequest_ColumnNames)(nil), // 1638: otg.Dhcpv4ServerMetricsRequest.ColumnNames - (*StatesRequest_Choice)(nil), // 1639: otg.StatesRequest.Choice - (*StatesResponse_Choice)(nil), // 1640: otg.StatesResponse.Choice - (*BgpPrefixStateRequest_PrefixFilters)(nil), // 1641: otg.BgpPrefixStateRequest.PrefixFilters - (*BgpPrefixIpv4UnicastFilter_Origin)(nil), // 1642: otg.BgpPrefixIpv4UnicastFilter.Origin - (*BgpPrefixIpv6UnicastFilter_Origin)(nil), // 1643: otg.BgpPrefixIpv6UnicastFilter.Origin - (*BgpPrefixIpv4UnicastState_Origin)(nil), // 1644: otg.BgpPrefixIpv4UnicastState.Origin - (*BgpPrefixIpv6UnicastState_Origin)(nil), // 1645: otg.BgpPrefixIpv6UnicastState.Origin - (*ResultExtendedCommunityStructured_Choice)(nil), // 1646: otg.ResultExtendedCommunityStructured.Choice - (*ResultExtendedCommunityTransitive2OctetAsType_Choice)(nil), // 1647: otg.ResultExtendedCommunityTransitive2OctetAsType.Choice - (*ResultExtendedCommunityTransitiveIpv4AddressType_Choice)(nil), // 1648: otg.ResultExtendedCommunityTransitiveIpv4AddressType.Choice - (*ResultExtendedCommunityTransitive4OctetAsType_Choice)(nil), // 1649: otg.ResultExtendedCommunityTransitive4OctetAsType.Choice - (*ResultExtendedCommunityTransitiveOpaqueType_Choice)(nil), // 1650: otg.ResultExtendedCommunityTransitiveOpaqueType.Choice - (*ResultExtendedCommunityNonTransitive2OctetAsType_Choice)(nil), // 1651: otg.ResultExtendedCommunityNonTransitive2OctetAsType.Choice - (*ResultBgpCommunity_Type)(nil), // 1652: otg.ResultBgpCommunity.Type - (*ResultBgpAsPathSegment_Type)(nil), // 1653: otg.ResultBgpAsPathSegment.Type - (*IsisLspState_PduType)(nil), // 1654: otg.IsisLspState.PduType - (*IsisLspV4Prefix_RedistributionType)(nil), // 1655: otg.IsisLspV4Prefix.RedistributionType - (*IsisLspV4Prefix_OriginType)(nil), // 1656: otg.IsisLspV4Prefix.OriginType - (*IsisLspExtendedV4Prefix_RedistributionType)(nil), // 1657: otg.IsisLspExtendedV4Prefix.RedistributionType - (*IsisLspV6Prefix_RedistributionType)(nil), // 1658: otg.IsisLspV6Prefix.RedistributionType - (*IsisLspV6Prefix_OriginType)(nil), // 1659: otg.IsisLspV6Prefix.OriginType - (*LldpNeighborsState_ChassisIdType)(nil), // 1660: otg.LldpNeighborsState.ChassisIdType - (*LldpNeighborsState_PortIdType)(nil), // 1661: otg.LldpNeighborsState.PortIdType - (*LldpCapabilityState_CapabilityName)(nil), // 1662: otg.LldpCapabilityState.CapabilityName - (*RsvpLspState_SessionStatus)(nil), // 1663: otg.RsvpLspState.SessionStatus - (*RsvpLspState_LastFlapReason)(nil), // 1664: otg.RsvpLspState.LastFlapReason - (*RsvpLspIpv4Ero_Type)(nil), // 1665: otg.RsvpLspIpv4Ero.Type - (*PatternFlowEthernetDst_Choice)(nil), // 1666: otg.PatternFlowEthernetDst.Choice - (*PatternFlowEthernetSrc_Choice)(nil), // 1667: otg.PatternFlowEthernetSrc.Choice - (*PatternFlowEthernetEtherType_Choice)(nil), // 1668: otg.PatternFlowEthernetEtherType.Choice - (*PatternFlowEthernetPfcQueue_Choice)(nil), // 1669: otg.PatternFlowEthernetPfcQueue.Choice - (*PatternFlowVlanPriority_Choice)(nil), // 1670: otg.PatternFlowVlanPriority.Choice - (*PatternFlowVlanCfi_Choice)(nil), // 1671: otg.PatternFlowVlanCfi.Choice - (*PatternFlowVlanId_Choice)(nil), // 1672: otg.PatternFlowVlanId.Choice - (*PatternFlowVlanTpid_Choice)(nil), // 1673: otg.PatternFlowVlanTpid.Choice - (*PatternFlowVxlanFlags_Choice)(nil), // 1674: otg.PatternFlowVxlanFlags.Choice - (*PatternFlowVxlanReserved0_Choice)(nil), // 1675: otg.PatternFlowVxlanReserved0.Choice - (*PatternFlowVxlanVni_Choice)(nil), // 1676: otg.PatternFlowVxlanVni.Choice - (*PatternFlowVxlanReserved1_Choice)(nil), // 1677: otg.PatternFlowVxlanReserved1.Choice - (*PatternFlowIpv4Version_Choice)(nil), // 1678: otg.PatternFlowIpv4Version.Choice - (*PatternFlowIpv4HeaderLength_Choice)(nil), // 1679: otg.PatternFlowIpv4HeaderLength.Choice - (*PatternFlowIpv4TotalLength_Choice)(nil), // 1680: otg.PatternFlowIpv4TotalLength.Choice - (*PatternFlowIpv4Identification_Choice)(nil), // 1681: otg.PatternFlowIpv4Identification.Choice - (*PatternFlowIpv4Reserved_Choice)(nil), // 1682: otg.PatternFlowIpv4Reserved.Choice - (*PatternFlowIpv4DontFragment_Choice)(nil), // 1683: otg.PatternFlowIpv4DontFragment.Choice - (*PatternFlowIpv4MoreFragments_Choice)(nil), // 1684: otg.PatternFlowIpv4MoreFragments.Choice - (*PatternFlowIpv4FragmentOffset_Choice)(nil), // 1685: otg.PatternFlowIpv4FragmentOffset.Choice - (*PatternFlowIpv4TimeToLive_Choice)(nil), // 1686: otg.PatternFlowIpv4TimeToLive.Choice - (*PatternFlowIpv4Protocol_Choice)(nil), // 1687: otg.PatternFlowIpv4Protocol.Choice - (*PatternFlowIpv4HeaderChecksum_Choice)(nil), // 1688: otg.PatternFlowIpv4HeaderChecksum.Choice - (*PatternFlowIpv4HeaderChecksum_Generated)(nil), // 1689: otg.PatternFlowIpv4HeaderChecksum.Generated - (*PatternFlowIpv4Src_Choice)(nil), // 1690: otg.PatternFlowIpv4Src.Choice - (*PatternFlowIpv4Dst_Choice)(nil), // 1691: otg.PatternFlowIpv4Dst.Choice - (*PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice)(nil), // 1692: otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag.Choice - (*PatternFlowIpv4OptionsCustomTypeOptionClass_Choice)(nil), // 1693: otg.PatternFlowIpv4OptionsCustomTypeOptionClass.Choice - (*PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice)(nil), // 1694: otg.PatternFlowIpv4OptionsCustomTypeOptionNumber.Choice - (*PatternFlowIpv4PriorityRaw_Choice)(nil), // 1695: otg.PatternFlowIpv4PriorityRaw.Choice - (*PatternFlowIpv4DscpPhb_Choice)(nil), // 1696: otg.PatternFlowIpv4DscpPhb.Choice - (*PatternFlowIpv4DscpEcn_Choice)(nil), // 1697: otg.PatternFlowIpv4DscpEcn.Choice - (*PatternFlowIpv4TosPrecedence_Choice)(nil), // 1698: otg.PatternFlowIpv4TosPrecedence.Choice - (*PatternFlowIpv4TosDelay_Choice)(nil), // 1699: otg.PatternFlowIpv4TosDelay.Choice - (*PatternFlowIpv4TosThroughput_Choice)(nil), // 1700: otg.PatternFlowIpv4TosThroughput.Choice - (*PatternFlowIpv4TosReliability_Choice)(nil), // 1701: otg.PatternFlowIpv4TosReliability.Choice - (*PatternFlowIpv4TosMonetary_Choice)(nil), // 1702: otg.PatternFlowIpv4TosMonetary.Choice - (*PatternFlowIpv4TosUnused_Choice)(nil), // 1703: otg.PatternFlowIpv4TosUnused.Choice - (*PatternFlowIpv6Version_Choice)(nil), // 1704: otg.PatternFlowIpv6Version.Choice - (*PatternFlowIpv6TrafficClass_Choice)(nil), // 1705: otg.PatternFlowIpv6TrafficClass.Choice - (*PatternFlowIpv6FlowLabel_Choice)(nil), // 1706: otg.PatternFlowIpv6FlowLabel.Choice - (*PatternFlowIpv6PayloadLength_Choice)(nil), // 1707: otg.PatternFlowIpv6PayloadLength.Choice - (*PatternFlowIpv6NextHeader_Choice)(nil), // 1708: otg.PatternFlowIpv6NextHeader.Choice - (*PatternFlowIpv6HopLimit_Choice)(nil), // 1709: otg.PatternFlowIpv6HopLimit.Choice - (*PatternFlowIpv6Src_Choice)(nil), // 1710: otg.PatternFlowIpv6Src.Choice - (*PatternFlowIpv6Dst_Choice)(nil), // 1711: otg.PatternFlowIpv6Dst.Choice - (*PatternFlowPfcPauseDst_Choice)(nil), // 1712: otg.PatternFlowPfcPauseDst.Choice - (*PatternFlowPfcPauseSrc_Choice)(nil), // 1713: otg.PatternFlowPfcPauseSrc.Choice - (*PatternFlowPfcPauseEtherType_Choice)(nil), // 1714: otg.PatternFlowPfcPauseEtherType.Choice - (*PatternFlowPfcPauseControlOpCode_Choice)(nil), // 1715: otg.PatternFlowPfcPauseControlOpCode.Choice - (*PatternFlowPfcPauseClassEnableVector_Choice)(nil), // 1716: otg.PatternFlowPfcPauseClassEnableVector.Choice - (*PatternFlowPfcPausePauseClass0_Choice)(nil), // 1717: otg.PatternFlowPfcPausePauseClass0.Choice - (*PatternFlowPfcPausePauseClass1_Choice)(nil), // 1718: otg.PatternFlowPfcPausePauseClass1.Choice - (*PatternFlowPfcPausePauseClass2_Choice)(nil), // 1719: otg.PatternFlowPfcPausePauseClass2.Choice - (*PatternFlowPfcPausePauseClass3_Choice)(nil), // 1720: otg.PatternFlowPfcPausePauseClass3.Choice - (*PatternFlowPfcPausePauseClass4_Choice)(nil), // 1721: otg.PatternFlowPfcPausePauseClass4.Choice - (*PatternFlowPfcPausePauseClass5_Choice)(nil), // 1722: otg.PatternFlowPfcPausePauseClass5.Choice - (*PatternFlowPfcPausePauseClass6_Choice)(nil), // 1723: otg.PatternFlowPfcPausePauseClass6.Choice - (*PatternFlowPfcPausePauseClass7_Choice)(nil), // 1724: otg.PatternFlowPfcPausePauseClass7.Choice - (*PatternFlowEthernetPauseDst_Choice)(nil), // 1725: otg.PatternFlowEthernetPauseDst.Choice - (*PatternFlowEthernetPauseSrc_Choice)(nil), // 1726: otg.PatternFlowEthernetPauseSrc.Choice - (*PatternFlowEthernetPauseEtherType_Choice)(nil), // 1727: otg.PatternFlowEthernetPauseEtherType.Choice - (*PatternFlowEthernetPauseControlOpCode_Choice)(nil), // 1728: otg.PatternFlowEthernetPauseControlOpCode.Choice - (*PatternFlowEthernetPauseTime_Choice)(nil), // 1729: otg.PatternFlowEthernetPauseTime.Choice - (*PatternFlowTcpSrcPort_Choice)(nil), // 1730: otg.PatternFlowTcpSrcPort.Choice - (*PatternFlowTcpDstPort_Choice)(nil), // 1731: otg.PatternFlowTcpDstPort.Choice - (*PatternFlowTcpSeqNum_Choice)(nil), // 1732: otg.PatternFlowTcpSeqNum.Choice - (*PatternFlowTcpAckNum_Choice)(nil), // 1733: otg.PatternFlowTcpAckNum.Choice - (*PatternFlowTcpDataOffset_Choice)(nil), // 1734: otg.PatternFlowTcpDataOffset.Choice - (*PatternFlowTcpEcnNs_Choice)(nil), // 1735: otg.PatternFlowTcpEcnNs.Choice - (*PatternFlowTcpEcnCwr_Choice)(nil), // 1736: otg.PatternFlowTcpEcnCwr.Choice - (*PatternFlowTcpEcnEcho_Choice)(nil), // 1737: otg.PatternFlowTcpEcnEcho.Choice - (*PatternFlowTcpCtlUrg_Choice)(nil), // 1738: otg.PatternFlowTcpCtlUrg.Choice - (*PatternFlowTcpCtlAck_Choice)(nil), // 1739: otg.PatternFlowTcpCtlAck.Choice - (*PatternFlowTcpCtlPsh_Choice)(nil), // 1740: otg.PatternFlowTcpCtlPsh.Choice - (*PatternFlowTcpCtlRst_Choice)(nil), // 1741: otg.PatternFlowTcpCtlRst.Choice - (*PatternFlowTcpCtlSyn_Choice)(nil), // 1742: otg.PatternFlowTcpCtlSyn.Choice - (*PatternFlowTcpCtlFin_Choice)(nil), // 1743: otg.PatternFlowTcpCtlFin.Choice - (*PatternFlowTcpWindow_Choice)(nil), // 1744: otg.PatternFlowTcpWindow.Choice - (*PatternFlowTcpChecksum_Choice)(nil), // 1745: otg.PatternFlowTcpChecksum.Choice - (*PatternFlowTcpChecksum_Generated)(nil), // 1746: otg.PatternFlowTcpChecksum.Generated - (*PatternFlowUdpSrcPort_Choice)(nil), // 1747: otg.PatternFlowUdpSrcPort.Choice - (*PatternFlowUdpDstPort_Choice)(nil), // 1748: otg.PatternFlowUdpDstPort.Choice - (*PatternFlowUdpLength_Choice)(nil), // 1749: otg.PatternFlowUdpLength.Choice - (*PatternFlowUdpChecksum_Choice)(nil), // 1750: otg.PatternFlowUdpChecksum.Choice - (*PatternFlowUdpChecksum_Generated)(nil), // 1751: otg.PatternFlowUdpChecksum.Generated - (*PatternFlowGreChecksumPresent_Choice)(nil), // 1752: otg.PatternFlowGreChecksumPresent.Choice - (*PatternFlowGreReserved0_Choice)(nil), // 1753: otg.PatternFlowGreReserved0.Choice - (*PatternFlowGreVersion_Choice)(nil), // 1754: otg.PatternFlowGreVersion.Choice - (*PatternFlowGreProtocol_Choice)(nil), // 1755: otg.PatternFlowGreProtocol.Choice - (*PatternFlowGreChecksum_Choice)(nil), // 1756: otg.PatternFlowGreChecksum.Choice - (*PatternFlowGreChecksum_Generated)(nil), // 1757: otg.PatternFlowGreChecksum.Generated - (*PatternFlowGreReserved1_Choice)(nil), // 1758: otg.PatternFlowGreReserved1.Choice - (*PatternFlowGtpv1Version_Choice)(nil), // 1759: otg.PatternFlowGtpv1Version.Choice - (*PatternFlowGtpv1ProtocolType_Choice)(nil), // 1760: otg.PatternFlowGtpv1ProtocolType.Choice - (*PatternFlowGtpv1Reserved_Choice)(nil), // 1761: otg.PatternFlowGtpv1Reserved.Choice - (*PatternFlowGtpv1EFlag_Choice)(nil), // 1762: otg.PatternFlowGtpv1EFlag.Choice - (*PatternFlowGtpv1SFlag_Choice)(nil), // 1763: otg.PatternFlowGtpv1SFlag.Choice - (*PatternFlowGtpv1PnFlag_Choice)(nil), // 1764: otg.PatternFlowGtpv1PnFlag.Choice - (*PatternFlowGtpv1MessageType_Choice)(nil), // 1765: otg.PatternFlowGtpv1MessageType.Choice - (*PatternFlowGtpv1MessageLength_Choice)(nil), // 1766: otg.PatternFlowGtpv1MessageLength.Choice - (*PatternFlowGtpv1Teid_Choice)(nil), // 1767: otg.PatternFlowGtpv1Teid.Choice - (*PatternFlowGtpv1SquenceNumber_Choice)(nil), // 1768: otg.PatternFlowGtpv1SquenceNumber.Choice - (*PatternFlowGtpv1NPduNumber_Choice)(nil), // 1769: otg.PatternFlowGtpv1NPduNumber.Choice - (*PatternFlowGtpv1NextExtensionHeaderType_Choice)(nil), // 1770: otg.PatternFlowGtpv1NextExtensionHeaderType.Choice - (*PatternFlowGtpExtensionExtensionLength_Choice)(nil), // 1771: otg.PatternFlowGtpExtensionExtensionLength.Choice - (*PatternFlowGtpExtensionContents_Choice)(nil), // 1772: otg.PatternFlowGtpExtensionContents.Choice - (*PatternFlowGtpExtensionNextExtensionHeader_Choice)(nil), // 1773: otg.PatternFlowGtpExtensionNextExtensionHeader.Choice - (*PatternFlowGtpv2Version_Choice)(nil), // 1774: otg.PatternFlowGtpv2Version.Choice - (*PatternFlowGtpv2PiggybackingFlag_Choice)(nil), // 1775: otg.PatternFlowGtpv2PiggybackingFlag.Choice - (*PatternFlowGtpv2TeidFlag_Choice)(nil), // 1776: otg.PatternFlowGtpv2TeidFlag.Choice - (*PatternFlowGtpv2Spare1_Choice)(nil), // 1777: otg.PatternFlowGtpv2Spare1.Choice - (*PatternFlowGtpv2MessageType_Choice)(nil), // 1778: otg.PatternFlowGtpv2MessageType.Choice - (*PatternFlowGtpv2MessageLength_Choice)(nil), // 1779: otg.PatternFlowGtpv2MessageLength.Choice - (*PatternFlowGtpv2Teid_Choice)(nil), // 1780: otg.PatternFlowGtpv2Teid.Choice - (*PatternFlowGtpv2SequenceNumber_Choice)(nil), // 1781: otg.PatternFlowGtpv2SequenceNumber.Choice - (*PatternFlowGtpv2Spare2_Choice)(nil), // 1782: otg.PatternFlowGtpv2Spare2.Choice - (*PatternFlowArpHardwareType_Choice)(nil), // 1783: otg.PatternFlowArpHardwareType.Choice - (*PatternFlowArpProtocolType_Choice)(nil), // 1784: otg.PatternFlowArpProtocolType.Choice - (*PatternFlowArpHardwareLength_Choice)(nil), // 1785: otg.PatternFlowArpHardwareLength.Choice - (*PatternFlowArpProtocolLength_Choice)(nil), // 1786: otg.PatternFlowArpProtocolLength.Choice - (*PatternFlowArpOperation_Choice)(nil), // 1787: otg.PatternFlowArpOperation.Choice - (*PatternFlowArpSenderHardwareAddr_Choice)(nil), // 1788: otg.PatternFlowArpSenderHardwareAddr.Choice - (*PatternFlowArpSenderProtocolAddr_Choice)(nil), // 1789: otg.PatternFlowArpSenderProtocolAddr.Choice - (*PatternFlowArpTargetHardwareAddr_Choice)(nil), // 1790: otg.PatternFlowArpTargetHardwareAddr.Choice - (*PatternFlowArpTargetProtocolAddr_Choice)(nil), // 1791: otg.PatternFlowArpTargetProtocolAddr.Choice - (*PatternFlowIcmpEchoType_Choice)(nil), // 1792: otg.PatternFlowIcmpEchoType.Choice - (*PatternFlowIcmpEchoCode_Choice)(nil), // 1793: otg.PatternFlowIcmpEchoCode.Choice - (*PatternFlowIcmpEchoChecksum_Choice)(nil), // 1794: otg.PatternFlowIcmpEchoChecksum.Choice - (*PatternFlowIcmpEchoChecksum_Generated)(nil), // 1795: otg.PatternFlowIcmpEchoChecksum.Generated - (*PatternFlowIcmpEchoIdentifier_Choice)(nil), // 1796: otg.PatternFlowIcmpEchoIdentifier.Choice - (*PatternFlowIcmpEchoSequenceNumber_Choice)(nil), // 1797: otg.PatternFlowIcmpEchoSequenceNumber.Choice - (*PatternFlowIcmpCommonChecksum_Choice)(nil), // 1798: otg.PatternFlowIcmpCommonChecksum.Choice - (*PatternFlowIcmpCommonChecksum_Generated)(nil), // 1799: otg.PatternFlowIcmpCommonChecksum.Generated - (*PatternFlowIcmpNextFieldsIdentifier_Choice)(nil), // 1800: otg.PatternFlowIcmpNextFieldsIdentifier.Choice - (*PatternFlowIcmpNextFieldsSequenceNumber_Choice)(nil), // 1801: otg.PatternFlowIcmpNextFieldsSequenceNumber.Choice - (*PatternFlowIcmpv6EchoType_Choice)(nil), // 1802: otg.PatternFlowIcmpv6EchoType.Choice - (*PatternFlowIcmpv6EchoCode_Choice)(nil), // 1803: otg.PatternFlowIcmpv6EchoCode.Choice - (*PatternFlowIcmpv6EchoIdentifier_Choice)(nil), // 1804: otg.PatternFlowIcmpv6EchoIdentifier.Choice - (*PatternFlowIcmpv6EchoSequenceNumber_Choice)(nil), // 1805: otg.PatternFlowIcmpv6EchoSequenceNumber.Choice - (*PatternFlowIcmpv6EchoChecksum_Choice)(nil), // 1806: otg.PatternFlowIcmpv6EchoChecksum.Choice - (*PatternFlowIcmpv6EchoChecksum_Generated)(nil), // 1807: otg.PatternFlowIcmpv6EchoChecksum.Generated - (*PatternFlowIcmpv6CommonChecksum_Choice)(nil), // 1808: otg.PatternFlowIcmpv6CommonChecksum.Choice - (*PatternFlowIcmpv6CommonChecksum_Generated)(nil), // 1809: otg.PatternFlowIcmpv6CommonChecksum.Generated - (*PatternFlowPppAddress_Choice)(nil), // 1810: otg.PatternFlowPppAddress.Choice - (*PatternFlowPppControl_Choice)(nil), // 1811: otg.PatternFlowPppControl.Choice - (*PatternFlowPppProtocolType_Choice)(nil), // 1812: otg.PatternFlowPppProtocolType.Choice - (*PatternFlowIgmpv1Version_Choice)(nil), // 1813: otg.PatternFlowIgmpv1Version.Choice - (*PatternFlowIgmpv1Type_Choice)(nil), // 1814: otg.PatternFlowIgmpv1Type.Choice - (*PatternFlowIgmpv1Unused_Choice)(nil), // 1815: otg.PatternFlowIgmpv1Unused.Choice - (*PatternFlowIgmpv1Checksum_Choice)(nil), // 1816: otg.PatternFlowIgmpv1Checksum.Choice - (*PatternFlowIgmpv1Checksum_Generated)(nil), // 1817: otg.PatternFlowIgmpv1Checksum.Generated - (*PatternFlowIgmpv1GroupAddress_Choice)(nil), // 1818: otg.PatternFlowIgmpv1GroupAddress.Choice - (*PatternFlowMplsLabel_Choice)(nil), // 1819: otg.PatternFlowMplsLabel.Choice - (*PatternFlowMplsTrafficClass_Choice)(nil), // 1820: otg.PatternFlowMplsTrafficClass.Choice - (*PatternFlowMplsBottomOfStack_Choice)(nil), // 1821: otg.PatternFlowMplsBottomOfStack.Choice - (*PatternFlowMplsTimeToLive_Choice)(nil), // 1822: otg.PatternFlowMplsTimeToLive.Choice - (*PatternFlowSnmpv2CVersion_Choice)(nil), // 1823: otg.PatternFlowSnmpv2cVersion.Choice - (*PatternFlowSnmpv2CPDURequestId_Choice)(nil), // 1824: otg.PatternFlowSnmpv2cPDURequestId.Choice - (*PatternFlowSnmpv2CPDUErrorIndex_Choice)(nil), // 1825: otg.PatternFlowSnmpv2cPDUErrorIndex.Choice - (*PatternFlowSnmpv2CBulkPDURequestId_Choice)(nil), // 1826: otg.PatternFlowSnmpv2cBulkPDURequestId.Choice - (*PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice)(nil), // 1827: otg.PatternFlowSnmpv2cBulkPDUNonRepeaters.Choice - (*PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice)(nil), // 1828: otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions.Choice - (*PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice)(nil), // 1829: otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue.Choice - (*PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice)(nil), // 1830: otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue.Choice - (*PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice)(nil), // 1831: otg.PatternFlowSnmpv2cVariableBindingValueCounterValue.Choice - (*PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice)(nil), // 1832: otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue.Choice - (*PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice)(nil), // 1833: otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue.Choice - (*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice)(nil), // 1834: otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue.Choice - (*PatternFlowSnmpv2CCommonRequestId_Choice)(nil), // 1835: otg.PatternFlowSnmpv2cCommonRequestId.Choice - (*PatternFlowRsvpRsvpChecksum_Choice)(nil), // 1836: otg.PatternFlowRsvpRsvpChecksum.Choice - (*PatternFlowRsvpRsvpChecksum_Generated)(nil), // 1837: otg.PatternFlowRsvpRsvpChecksum.Generated - (*PatternFlowRsvpTimeToLive_Choice)(nil), // 1838: otg.PatternFlowRsvpTimeToLive.Choice - (*PatternFlowRsvpReserved_Choice)(nil), // 1839: otg.PatternFlowRsvpReserved.Choice - (*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice)(nil), // 1840: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.Choice - (*PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice)(nil), // 1841: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.Choice - (*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice)(nil), // 1842: otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.Choice - (*PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice)(nil), // 1843: otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger.Choice - (*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice)(nil), // 1844: otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.Choice - (*PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice)(nil), // 1845: otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.Choice - (*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice)(nil), // 1846: otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle.Choice - (*PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice)(nil), // 1847: otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR.Choice - (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice)(nil), // 1848: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.Choice - (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice)(nil), // 1849: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.Choice - (*PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice)(nil), // 1850: otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.Choice - (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice)(nil), // 1851: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.Choice - (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice)(nil), // 1852: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid.Choice - (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice)(nil), // 1853: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.Choice - (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice)(nil), // 1854: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.Choice - (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice)(nil), // 1855: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.Choice - (*PatternFlowRSVPPathSenderTspecIntServVersion_Choice)(nil), // 1856: otg.PatternFlowRSVPPathSenderTspecIntServVersion.Choice - (*PatternFlowRSVPPathSenderTspecIntServReserved1_Choice)(nil), // 1857: otg.PatternFlowRSVPPathSenderTspecIntServReserved1.Choice - (*PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice)(nil), // 1858: otg.PatternFlowRSVPPathSenderTspecIntServOverallLength.Choice - (*PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice)(nil), // 1859: otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader.Choice - (*PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice)(nil), // 1860: otg.PatternFlowRSVPPathSenderTspecIntServZeroBit.Choice - (*PatternFlowRSVPPathSenderTspecIntServReserved2_Choice)(nil), // 1861: otg.PatternFlowRSVPPathSenderTspecIntServReserved2.Choice - (*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice)(nil), // 1862: otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.Choice - (*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice)(nil), // 1863: otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.Choice - (*PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice)(nil), // 1864: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag.Choice - (*PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice)(nil), // 1865: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length.Choice - (*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice)(nil), // 1866: otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit.Choice - (*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice)(nil), // 1867: otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize.Choice - (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice)(nil), // 1868: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.Choice - (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice)(nil), // 1869: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.Choice - (*PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice)(nil), // 1870: otg.PatternFlowRSVPPathRecordRouteType1LabelFlags.Choice - (*PatternFlowRSVPPathRecordRouteType1LabelCType_Choice)(nil), // 1871: otg.PatternFlowRSVPPathRecordRouteType1LabelCType.Choice - (*PatternFlowRSVPPathObjectsCustomType_Choice)(nil), // 1872: otg.PatternFlowRSVPPathObjectsCustomType.Choice - (*emptypb.Empty)(nil), // 1873: google.protobuf.Empty + (*PatternFlowIpv4SrcRandom)(nil), // 980: otg.PatternFlowIpv4SrcRandom + (*PatternFlowIpv4Src)(nil), // 981: otg.PatternFlowIpv4Src + (*PatternFlowIpv4DstCounter)(nil), // 982: otg.PatternFlowIpv4DstCounter + (*PatternFlowIpv4DstMetricTag)(nil), // 983: otg.PatternFlowIpv4DstMetricTag + (*PatternFlowIpv4DstRandom)(nil), // 984: otg.PatternFlowIpv4DstRandom + (*PatternFlowIpv4Dst)(nil), // 985: otg.PatternFlowIpv4Dst + (*PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter)(nil), // 986: otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + (*PatternFlowIpv4OptionsCustomTypeCopiedFlag)(nil), // 987: otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag + (*PatternFlowIpv4OptionsCustomTypeOptionClassCounter)(nil), // 988: otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter + (*PatternFlowIpv4OptionsCustomTypeOptionClass)(nil), // 989: otg.PatternFlowIpv4OptionsCustomTypeOptionClass + (*PatternFlowIpv4OptionsCustomTypeOptionNumberCounter)(nil), // 990: otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + (*PatternFlowIpv4OptionsCustomTypeOptionNumber)(nil), // 991: otg.PatternFlowIpv4OptionsCustomTypeOptionNumber + (*PatternFlowIpv4PriorityRawCounter)(nil), // 992: otg.PatternFlowIpv4PriorityRawCounter + (*PatternFlowIpv4PriorityRawMetricTag)(nil), // 993: otg.PatternFlowIpv4PriorityRawMetricTag + (*PatternFlowIpv4PriorityRaw)(nil), // 994: otg.PatternFlowIpv4PriorityRaw + (*PatternFlowIpv4DscpPhbCounter)(nil), // 995: otg.PatternFlowIpv4DscpPhbCounter + (*PatternFlowIpv4DscpPhbMetricTag)(nil), // 996: otg.PatternFlowIpv4DscpPhbMetricTag + (*PatternFlowIpv4DscpPhb)(nil), // 997: otg.PatternFlowIpv4DscpPhb + (*PatternFlowIpv4DscpEcnCounter)(nil), // 998: otg.PatternFlowIpv4DscpEcnCounter + (*PatternFlowIpv4DscpEcnMetricTag)(nil), // 999: otg.PatternFlowIpv4DscpEcnMetricTag + (*PatternFlowIpv4DscpEcn)(nil), // 1000: otg.PatternFlowIpv4DscpEcn + (*PatternFlowIpv4TosPrecedenceCounter)(nil), // 1001: otg.PatternFlowIpv4TosPrecedenceCounter + (*PatternFlowIpv4TosPrecedenceMetricTag)(nil), // 1002: otg.PatternFlowIpv4TosPrecedenceMetricTag + (*PatternFlowIpv4TosPrecedence)(nil), // 1003: otg.PatternFlowIpv4TosPrecedence + (*PatternFlowIpv4TosDelayCounter)(nil), // 1004: otg.PatternFlowIpv4TosDelayCounter + (*PatternFlowIpv4TosDelayMetricTag)(nil), // 1005: otg.PatternFlowIpv4TosDelayMetricTag + (*PatternFlowIpv4TosDelay)(nil), // 1006: otg.PatternFlowIpv4TosDelay + (*PatternFlowIpv4TosThroughputCounter)(nil), // 1007: otg.PatternFlowIpv4TosThroughputCounter + (*PatternFlowIpv4TosThroughputMetricTag)(nil), // 1008: otg.PatternFlowIpv4TosThroughputMetricTag + (*PatternFlowIpv4TosThroughput)(nil), // 1009: otg.PatternFlowIpv4TosThroughput + (*PatternFlowIpv4TosReliabilityCounter)(nil), // 1010: otg.PatternFlowIpv4TosReliabilityCounter + (*PatternFlowIpv4TosReliabilityMetricTag)(nil), // 1011: otg.PatternFlowIpv4TosReliabilityMetricTag + (*PatternFlowIpv4TosReliability)(nil), // 1012: otg.PatternFlowIpv4TosReliability + (*PatternFlowIpv4TosMonetaryCounter)(nil), // 1013: otg.PatternFlowIpv4TosMonetaryCounter + (*PatternFlowIpv4TosMonetaryMetricTag)(nil), // 1014: otg.PatternFlowIpv4TosMonetaryMetricTag + (*PatternFlowIpv4TosMonetary)(nil), // 1015: otg.PatternFlowIpv4TosMonetary + (*PatternFlowIpv4TosUnusedCounter)(nil), // 1016: otg.PatternFlowIpv4TosUnusedCounter + (*PatternFlowIpv4TosUnusedMetricTag)(nil), // 1017: otg.PatternFlowIpv4TosUnusedMetricTag + (*PatternFlowIpv4TosUnused)(nil), // 1018: otg.PatternFlowIpv4TosUnused + (*PatternFlowIpv6VersionCounter)(nil), // 1019: otg.PatternFlowIpv6VersionCounter + (*PatternFlowIpv6VersionMetricTag)(nil), // 1020: otg.PatternFlowIpv6VersionMetricTag + (*PatternFlowIpv6Version)(nil), // 1021: otg.PatternFlowIpv6Version + (*PatternFlowIpv6TrafficClassCounter)(nil), // 1022: otg.PatternFlowIpv6TrafficClassCounter + (*PatternFlowIpv6TrafficClassMetricTag)(nil), // 1023: otg.PatternFlowIpv6TrafficClassMetricTag + (*PatternFlowIpv6TrafficClass)(nil), // 1024: otg.PatternFlowIpv6TrafficClass + (*PatternFlowIpv6FlowLabelCounter)(nil), // 1025: otg.PatternFlowIpv6FlowLabelCounter + (*PatternFlowIpv6FlowLabelMetricTag)(nil), // 1026: otg.PatternFlowIpv6FlowLabelMetricTag + (*PatternFlowIpv6FlowLabelRandom)(nil), // 1027: otg.PatternFlowIpv6FlowLabelRandom + (*PatternFlowIpv6FlowLabel)(nil), // 1028: otg.PatternFlowIpv6FlowLabel + (*PatternFlowIpv6PayloadLengthCounter)(nil), // 1029: otg.PatternFlowIpv6PayloadLengthCounter + (*PatternFlowIpv6PayloadLengthMetricTag)(nil), // 1030: otg.PatternFlowIpv6PayloadLengthMetricTag + (*PatternFlowIpv6PayloadLength)(nil), // 1031: otg.PatternFlowIpv6PayloadLength + (*PatternFlowIpv6NextHeaderCounter)(nil), // 1032: otg.PatternFlowIpv6NextHeaderCounter + (*PatternFlowIpv6NextHeaderMetricTag)(nil), // 1033: otg.PatternFlowIpv6NextHeaderMetricTag + (*PatternFlowIpv6NextHeader)(nil), // 1034: otg.PatternFlowIpv6NextHeader + (*PatternFlowIpv6HopLimitCounter)(nil), // 1035: otg.PatternFlowIpv6HopLimitCounter + (*PatternFlowIpv6HopLimitMetricTag)(nil), // 1036: otg.PatternFlowIpv6HopLimitMetricTag + (*PatternFlowIpv6HopLimit)(nil), // 1037: otg.PatternFlowIpv6HopLimit + (*PatternFlowIpv6SrcCounter)(nil), // 1038: otg.PatternFlowIpv6SrcCounter + (*PatternFlowIpv6SrcMetricTag)(nil), // 1039: otg.PatternFlowIpv6SrcMetricTag + (*PatternFlowIpv6Src)(nil), // 1040: otg.PatternFlowIpv6Src + (*PatternFlowIpv6DstCounter)(nil), // 1041: otg.PatternFlowIpv6DstCounter + (*PatternFlowIpv6DstMetricTag)(nil), // 1042: otg.PatternFlowIpv6DstMetricTag + (*PatternFlowIpv6Dst)(nil), // 1043: otg.PatternFlowIpv6Dst + (*PatternFlowPfcPauseDstCounter)(nil), // 1044: otg.PatternFlowPfcPauseDstCounter + (*PatternFlowPfcPauseDstMetricTag)(nil), // 1045: otg.PatternFlowPfcPauseDstMetricTag + (*PatternFlowPfcPauseDst)(nil), // 1046: otg.PatternFlowPfcPauseDst + (*PatternFlowPfcPauseSrcCounter)(nil), // 1047: otg.PatternFlowPfcPauseSrcCounter + (*PatternFlowPfcPauseSrcMetricTag)(nil), // 1048: otg.PatternFlowPfcPauseSrcMetricTag + (*PatternFlowPfcPauseSrc)(nil), // 1049: otg.PatternFlowPfcPauseSrc + (*PatternFlowPfcPauseEtherTypeCounter)(nil), // 1050: otg.PatternFlowPfcPauseEtherTypeCounter + (*PatternFlowPfcPauseEtherTypeMetricTag)(nil), // 1051: otg.PatternFlowPfcPauseEtherTypeMetricTag + (*PatternFlowPfcPauseEtherType)(nil), // 1052: otg.PatternFlowPfcPauseEtherType + (*PatternFlowPfcPauseControlOpCodeCounter)(nil), // 1053: otg.PatternFlowPfcPauseControlOpCodeCounter + (*PatternFlowPfcPauseControlOpCodeMetricTag)(nil), // 1054: otg.PatternFlowPfcPauseControlOpCodeMetricTag + (*PatternFlowPfcPauseControlOpCode)(nil), // 1055: otg.PatternFlowPfcPauseControlOpCode + (*PatternFlowPfcPauseClassEnableVectorCounter)(nil), // 1056: otg.PatternFlowPfcPauseClassEnableVectorCounter + (*PatternFlowPfcPauseClassEnableVectorMetricTag)(nil), // 1057: otg.PatternFlowPfcPauseClassEnableVectorMetricTag + (*PatternFlowPfcPauseClassEnableVector)(nil), // 1058: otg.PatternFlowPfcPauseClassEnableVector + (*PatternFlowPfcPausePauseClass0Counter)(nil), // 1059: otg.PatternFlowPfcPausePauseClass0Counter + (*PatternFlowPfcPausePauseClass0MetricTag)(nil), // 1060: otg.PatternFlowPfcPausePauseClass0MetricTag + (*PatternFlowPfcPausePauseClass0)(nil), // 1061: otg.PatternFlowPfcPausePauseClass0 + (*PatternFlowPfcPausePauseClass1Counter)(nil), // 1062: otg.PatternFlowPfcPausePauseClass1Counter + (*PatternFlowPfcPausePauseClass1MetricTag)(nil), // 1063: otg.PatternFlowPfcPausePauseClass1MetricTag + (*PatternFlowPfcPausePauseClass1)(nil), // 1064: otg.PatternFlowPfcPausePauseClass1 + (*PatternFlowPfcPausePauseClass2Counter)(nil), // 1065: otg.PatternFlowPfcPausePauseClass2Counter + (*PatternFlowPfcPausePauseClass2MetricTag)(nil), // 1066: otg.PatternFlowPfcPausePauseClass2MetricTag + (*PatternFlowPfcPausePauseClass2)(nil), // 1067: otg.PatternFlowPfcPausePauseClass2 + (*PatternFlowPfcPausePauseClass3Counter)(nil), // 1068: otg.PatternFlowPfcPausePauseClass3Counter + (*PatternFlowPfcPausePauseClass3MetricTag)(nil), // 1069: otg.PatternFlowPfcPausePauseClass3MetricTag + (*PatternFlowPfcPausePauseClass3)(nil), // 1070: otg.PatternFlowPfcPausePauseClass3 + (*PatternFlowPfcPausePauseClass4Counter)(nil), // 1071: otg.PatternFlowPfcPausePauseClass4Counter + (*PatternFlowPfcPausePauseClass4MetricTag)(nil), // 1072: otg.PatternFlowPfcPausePauseClass4MetricTag + (*PatternFlowPfcPausePauseClass4)(nil), // 1073: otg.PatternFlowPfcPausePauseClass4 + (*PatternFlowPfcPausePauseClass5Counter)(nil), // 1074: otg.PatternFlowPfcPausePauseClass5Counter + (*PatternFlowPfcPausePauseClass5MetricTag)(nil), // 1075: otg.PatternFlowPfcPausePauseClass5MetricTag + (*PatternFlowPfcPausePauseClass5)(nil), // 1076: otg.PatternFlowPfcPausePauseClass5 + (*PatternFlowPfcPausePauseClass6Counter)(nil), // 1077: otg.PatternFlowPfcPausePauseClass6Counter + (*PatternFlowPfcPausePauseClass6MetricTag)(nil), // 1078: otg.PatternFlowPfcPausePauseClass6MetricTag + (*PatternFlowPfcPausePauseClass6)(nil), // 1079: otg.PatternFlowPfcPausePauseClass6 + (*PatternFlowPfcPausePauseClass7Counter)(nil), // 1080: otg.PatternFlowPfcPausePauseClass7Counter + (*PatternFlowPfcPausePauseClass7MetricTag)(nil), // 1081: otg.PatternFlowPfcPausePauseClass7MetricTag + (*PatternFlowPfcPausePauseClass7)(nil), // 1082: otg.PatternFlowPfcPausePauseClass7 + (*PatternFlowEthernetPauseDstCounter)(nil), // 1083: otg.PatternFlowEthernetPauseDstCounter + (*PatternFlowEthernetPauseDstMetricTag)(nil), // 1084: otg.PatternFlowEthernetPauseDstMetricTag + (*PatternFlowEthernetPauseDst)(nil), // 1085: otg.PatternFlowEthernetPauseDst + (*PatternFlowEthernetPauseSrcCounter)(nil), // 1086: otg.PatternFlowEthernetPauseSrcCounter + (*PatternFlowEthernetPauseSrcMetricTag)(nil), // 1087: otg.PatternFlowEthernetPauseSrcMetricTag + (*PatternFlowEthernetPauseSrc)(nil), // 1088: otg.PatternFlowEthernetPauseSrc + (*PatternFlowEthernetPauseEtherTypeCounter)(nil), // 1089: otg.PatternFlowEthernetPauseEtherTypeCounter + (*PatternFlowEthernetPauseEtherTypeMetricTag)(nil), // 1090: otg.PatternFlowEthernetPauseEtherTypeMetricTag + (*PatternFlowEthernetPauseEtherType)(nil), // 1091: otg.PatternFlowEthernetPauseEtherType + (*PatternFlowEthernetPauseControlOpCodeCounter)(nil), // 1092: otg.PatternFlowEthernetPauseControlOpCodeCounter + (*PatternFlowEthernetPauseControlOpCodeMetricTag)(nil), // 1093: otg.PatternFlowEthernetPauseControlOpCodeMetricTag + (*PatternFlowEthernetPauseControlOpCode)(nil), // 1094: otg.PatternFlowEthernetPauseControlOpCode + (*PatternFlowEthernetPauseTimeCounter)(nil), // 1095: otg.PatternFlowEthernetPauseTimeCounter + (*PatternFlowEthernetPauseTimeMetricTag)(nil), // 1096: otg.PatternFlowEthernetPauseTimeMetricTag + (*PatternFlowEthernetPauseTime)(nil), // 1097: otg.PatternFlowEthernetPauseTime + (*PatternFlowTcpSrcPortCounter)(nil), // 1098: otg.PatternFlowTcpSrcPortCounter + (*PatternFlowTcpSrcPortMetricTag)(nil), // 1099: otg.PatternFlowTcpSrcPortMetricTag + (*PatternFlowTcpSrcPortRandom)(nil), // 1100: otg.PatternFlowTcpSrcPortRandom + (*PatternFlowTcpSrcPort)(nil), // 1101: otg.PatternFlowTcpSrcPort + (*PatternFlowTcpDstPortCounter)(nil), // 1102: otg.PatternFlowTcpDstPortCounter + (*PatternFlowTcpDstPortMetricTag)(nil), // 1103: otg.PatternFlowTcpDstPortMetricTag + (*PatternFlowTcpDstPortRandom)(nil), // 1104: otg.PatternFlowTcpDstPortRandom + (*PatternFlowTcpDstPort)(nil), // 1105: otg.PatternFlowTcpDstPort + (*PatternFlowTcpSeqNumCounter)(nil), // 1106: otg.PatternFlowTcpSeqNumCounter + (*PatternFlowTcpSeqNumMetricTag)(nil), // 1107: otg.PatternFlowTcpSeqNumMetricTag + (*PatternFlowTcpSeqNum)(nil), // 1108: otg.PatternFlowTcpSeqNum + (*PatternFlowTcpAckNumCounter)(nil), // 1109: otg.PatternFlowTcpAckNumCounter + (*PatternFlowTcpAckNumMetricTag)(nil), // 1110: otg.PatternFlowTcpAckNumMetricTag + (*PatternFlowTcpAckNum)(nil), // 1111: otg.PatternFlowTcpAckNum + (*PatternFlowTcpDataOffsetCounter)(nil), // 1112: otg.PatternFlowTcpDataOffsetCounter + (*PatternFlowTcpDataOffsetMetricTag)(nil), // 1113: otg.PatternFlowTcpDataOffsetMetricTag + (*PatternFlowTcpDataOffset)(nil), // 1114: otg.PatternFlowTcpDataOffset + (*PatternFlowTcpEcnNsCounter)(nil), // 1115: otg.PatternFlowTcpEcnNsCounter + (*PatternFlowTcpEcnNsMetricTag)(nil), // 1116: otg.PatternFlowTcpEcnNsMetricTag + (*PatternFlowTcpEcnNs)(nil), // 1117: otg.PatternFlowTcpEcnNs + (*PatternFlowTcpEcnCwrCounter)(nil), // 1118: otg.PatternFlowTcpEcnCwrCounter + (*PatternFlowTcpEcnCwrMetricTag)(nil), // 1119: otg.PatternFlowTcpEcnCwrMetricTag + (*PatternFlowTcpEcnCwr)(nil), // 1120: otg.PatternFlowTcpEcnCwr + (*PatternFlowTcpEcnEchoCounter)(nil), // 1121: otg.PatternFlowTcpEcnEchoCounter + (*PatternFlowTcpEcnEchoMetricTag)(nil), // 1122: otg.PatternFlowTcpEcnEchoMetricTag + (*PatternFlowTcpEcnEcho)(nil), // 1123: otg.PatternFlowTcpEcnEcho + (*PatternFlowTcpCtlUrgCounter)(nil), // 1124: otg.PatternFlowTcpCtlUrgCounter + (*PatternFlowTcpCtlUrgMetricTag)(nil), // 1125: otg.PatternFlowTcpCtlUrgMetricTag + (*PatternFlowTcpCtlUrg)(nil), // 1126: otg.PatternFlowTcpCtlUrg + (*PatternFlowTcpCtlAckCounter)(nil), // 1127: otg.PatternFlowTcpCtlAckCounter + (*PatternFlowTcpCtlAckMetricTag)(nil), // 1128: otg.PatternFlowTcpCtlAckMetricTag + (*PatternFlowTcpCtlAck)(nil), // 1129: otg.PatternFlowTcpCtlAck + (*PatternFlowTcpCtlPshCounter)(nil), // 1130: otg.PatternFlowTcpCtlPshCounter + (*PatternFlowTcpCtlPshMetricTag)(nil), // 1131: otg.PatternFlowTcpCtlPshMetricTag + (*PatternFlowTcpCtlPsh)(nil), // 1132: otg.PatternFlowTcpCtlPsh + (*PatternFlowTcpCtlRstCounter)(nil), // 1133: otg.PatternFlowTcpCtlRstCounter + (*PatternFlowTcpCtlRstMetricTag)(nil), // 1134: otg.PatternFlowTcpCtlRstMetricTag + (*PatternFlowTcpCtlRst)(nil), // 1135: otg.PatternFlowTcpCtlRst + (*PatternFlowTcpCtlSynCounter)(nil), // 1136: otg.PatternFlowTcpCtlSynCounter + (*PatternFlowTcpCtlSynMetricTag)(nil), // 1137: otg.PatternFlowTcpCtlSynMetricTag + (*PatternFlowTcpCtlSyn)(nil), // 1138: otg.PatternFlowTcpCtlSyn + (*PatternFlowTcpCtlFinCounter)(nil), // 1139: otg.PatternFlowTcpCtlFinCounter + (*PatternFlowTcpCtlFinMetricTag)(nil), // 1140: otg.PatternFlowTcpCtlFinMetricTag + (*PatternFlowTcpCtlFin)(nil), // 1141: otg.PatternFlowTcpCtlFin + (*PatternFlowTcpWindowCounter)(nil), // 1142: otg.PatternFlowTcpWindowCounter + (*PatternFlowTcpWindowMetricTag)(nil), // 1143: otg.PatternFlowTcpWindowMetricTag + (*PatternFlowTcpWindow)(nil), // 1144: otg.PatternFlowTcpWindow + (*PatternFlowTcpChecksum)(nil), // 1145: otg.PatternFlowTcpChecksum + (*PatternFlowUdpSrcPortCounter)(nil), // 1146: otg.PatternFlowUdpSrcPortCounter + (*PatternFlowUdpSrcPortMetricTag)(nil), // 1147: otg.PatternFlowUdpSrcPortMetricTag + (*PatternFlowUdpSrcPortRandom)(nil), // 1148: otg.PatternFlowUdpSrcPortRandom + (*PatternFlowUdpSrcPort)(nil), // 1149: otg.PatternFlowUdpSrcPort + (*PatternFlowUdpDstPortCounter)(nil), // 1150: otg.PatternFlowUdpDstPortCounter + (*PatternFlowUdpDstPortMetricTag)(nil), // 1151: otg.PatternFlowUdpDstPortMetricTag + (*PatternFlowUdpDstPortRandom)(nil), // 1152: otg.PatternFlowUdpDstPortRandom + (*PatternFlowUdpDstPort)(nil), // 1153: otg.PatternFlowUdpDstPort + (*PatternFlowUdpLengthCounter)(nil), // 1154: otg.PatternFlowUdpLengthCounter + (*PatternFlowUdpLengthMetricTag)(nil), // 1155: otg.PatternFlowUdpLengthMetricTag + (*PatternFlowUdpLength)(nil), // 1156: otg.PatternFlowUdpLength + (*PatternFlowUdpChecksum)(nil), // 1157: otg.PatternFlowUdpChecksum + (*PatternFlowGreChecksumPresentCounter)(nil), // 1158: otg.PatternFlowGreChecksumPresentCounter + (*PatternFlowGreChecksumPresentMetricTag)(nil), // 1159: otg.PatternFlowGreChecksumPresentMetricTag + (*PatternFlowGreChecksumPresent)(nil), // 1160: otg.PatternFlowGreChecksumPresent + (*PatternFlowGreReserved0Counter)(nil), // 1161: otg.PatternFlowGreReserved0Counter + (*PatternFlowGreReserved0MetricTag)(nil), // 1162: otg.PatternFlowGreReserved0MetricTag + (*PatternFlowGreReserved0)(nil), // 1163: otg.PatternFlowGreReserved0 + (*PatternFlowGreVersionCounter)(nil), // 1164: otg.PatternFlowGreVersionCounter + (*PatternFlowGreVersionMetricTag)(nil), // 1165: otg.PatternFlowGreVersionMetricTag + (*PatternFlowGreVersion)(nil), // 1166: otg.PatternFlowGreVersion + (*PatternFlowGreProtocolCounter)(nil), // 1167: otg.PatternFlowGreProtocolCounter + (*PatternFlowGreProtocolMetricTag)(nil), // 1168: otg.PatternFlowGreProtocolMetricTag + (*PatternFlowGreProtocol)(nil), // 1169: otg.PatternFlowGreProtocol + (*PatternFlowGreChecksum)(nil), // 1170: otg.PatternFlowGreChecksum + (*PatternFlowGreReserved1Counter)(nil), // 1171: otg.PatternFlowGreReserved1Counter + (*PatternFlowGreReserved1MetricTag)(nil), // 1172: otg.PatternFlowGreReserved1MetricTag + (*PatternFlowGreReserved1)(nil), // 1173: otg.PatternFlowGreReserved1 + (*PatternFlowGtpv1VersionCounter)(nil), // 1174: otg.PatternFlowGtpv1VersionCounter + (*PatternFlowGtpv1VersionMetricTag)(nil), // 1175: otg.PatternFlowGtpv1VersionMetricTag + (*PatternFlowGtpv1Version)(nil), // 1176: otg.PatternFlowGtpv1Version + (*PatternFlowGtpv1ProtocolTypeCounter)(nil), // 1177: otg.PatternFlowGtpv1ProtocolTypeCounter + (*PatternFlowGtpv1ProtocolTypeMetricTag)(nil), // 1178: otg.PatternFlowGtpv1ProtocolTypeMetricTag + (*PatternFlowGtpv1ProtocolType)(nil), // 1179: otg.PatternFlowGtpv1ProtocolType + (*PatternFlowGtpv1ReservedCounter)(nil), // 1180: otg.PatternFlowGtpv1ReservedCounter + (*PatternFlowGtpv1ReservedMetricTag)(nil), // 1181: otg.PatternFlowGtpv1ReservedMetricTag + (*PatternFlowGtpv1Reserved)(nil), // 1182: otg.PatternFlowGtpv1Reserved + (*PatternFlowGtpv1EFlagCounter)(nil), // 1183: otg.PatternFlowGtpv1EFlagCounter + (*PatternFlowGtpv1EFlagMetricTag)(nil), // 1184: otg.PatternFlowGtpv1EFlagMetricTag + (*PatternFlowGtpv1EFlag)(nil), // 1185: otg.PatternFlowGtpv1EFlag + (*PatternFlowGtpv1SFlagCounter)(nil), // 1186: otg.PatternFlowGtpv1SFlagCounter + (*PatternFlowGtpv1SFlagMetricTag)(nil), // 1187: otg.PatternFlowGtpv1SFlagMetricTag + (*PatternFlowGtpv1SFlag)(nil), // 1188: otg.PatternFlowGtpv1SFlag + (*PatternFlowGtpv1PnFlagCounter)(nil), // 1189: otg.PatternFlowGtpv1PnFlagCounter + (*PatternFlowGtpv1PnFlagMetricTag)(nil), // 1190: otg.PatternFlowGtpv1PnFlagMetricTag + (*PatternFlowGtpv1PnFlag)(nil), // 1191: otg.PatternFlowGtpv1PnFlag + (*PatternFlowGtpv1MessageTypeCounter)(nil), // 1192: otg.PatternFlowGtpv1MessageTypeCounter + (*PatternFlowGtpv1MessageTypeMetricTag)(nil), // 1193: otg.PatternFlowGtpv1MessageTypeMetricTag + (*PatternFlowGtpv1MessageType)(nil), // 1194: otg.PatternFlowGtpv1MessageType + (*PatternFlowGtpv1MessageLengthCounter)(nil), // 1195: otg.PatternFlowGtpv1MessageLengthCounter + (*PatternFlowGtpv1MessageLengthMetricTag)(nil), // 1196: otg.PatternFlowGtpv1MessageLengthMetricTag + (*PatternFlowGtpv1MessageLength)(nil), // 1197: otg.PatternFlowGtpv1MessageLength + (*PatternFlowGtpv1TeidCounter)(nil), // 1198: otg.PatternFlowGtpv1TeidCounter + (*PatternFlowGtpv1TeidMetricTag)(nil), // 1199: otg.PatternFlowGtpv1TeidMetricTag + (*PatternFlowGtpv1Teid)(nil), // 1200: otg.PatternFlowGtpv1Teid + (*PatternFlowGtpv1SquenceNumberCounter)(nil), // 1201: otg.PatternFlowGtpv1SquenceNumberCounter + (*PatternFlowGtpv1SquenceNumberMetricTag)(nil), // 1202: otg.PatternFlowGtpv1SquenceNumberMetricTag + (*PatternFlowGtpv1SquenceNumber)(nil), // 1203: otg.PatternFlowGtpv1SquenceNumber + (*PatternFlowGtpv1NPduNumberCounter)(nil), // 1204: otg.PatternFlowGtpv1NPduNumberCounter + (*PatternFlowGtpv1NPduNumberMetricTag)(nil), // 1205: otg.PatternFlowGtpv1NPduNumberMetricTag + (*PatternFlowGtpv1NPduNumber)(nil), // 1206: otg.PatternFlowGtpv1NPduNumber + (*PatternFlowGtpv1NextExtensionHeaderTypeCounter)(nil), // 1207: otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter + (*PatternFlowGtpv1NextExtensionHeaderTypeMetricTag)(nil), // 1208: otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + (*PatternFlowGtpv1NextExtensionHeaderType)(nil), // 1209: otg.PatternFlowGtpv1NextExtensionHeaderType + (*PatternFlowGtpExtensionExtensionLengthCounter)(nil), // 1210: otg.PatternFlowGtpExtensionExtensionLengthCounter + (*PatternFlowGtpExtensionExtensionLengthMetricTag)(nil), // 1211: otg.PatternFlowGtpExtensionExtensionLengthMetricTag + (*PatternFlowGtpExtensionExtensionLength)(nil), // 1212: otg.PatternFlowGtpExtensionExtensionLength + (*PatternFlowGtpExtensionContentsCounter)(nil), // 1213: otg.PatternFlowGtpExtensionContentsCounter + (*PatternFlowGtpExtensionContentsMetricTag)(nil), // 1214: otg.PatternFlowGtpExtensionContentsMetricTag + (*PatternFlowGtpExtensionContents)(nil), // 1215: otg.PatternFlowGtpExtensionContents + (*PatternFlowGtpExtensionNextExtensionHeaderCounter)(nil), // 1216: otg.PatternFlowGtpExtensionNextExtensionHeaderCounter + (*PatternFlowGtpExtensionNextExtensionHeaderMetricTag)(nil), // 1217: otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag + (*PatternFlowGtpExtensionNextExtensionHeader)(nil), // 1218: otg.PatternFlowGtpExtensionNextExtensionHeader + (*PatternFlowGtpv2VersionCounter)(nil), // 1219: otg.PatternFlowGtpv2VersionCounter + (*PatternFlowGtpv2VersionMetricTag)(nil), // 1220: otg.PatternFlowGtpv2VersionMetricTag + (*PatternFlowGtpv2Version)(nil), // 1221: otg.PatternFlowGtpv2Version + (*PatternFlowGtpv2PiggybackingFlagCounter)(nil), // 1222: otg.PatternFlowGtpv2PiggybackingFlagCounter + (*PatternFlowGtpv2PiggybackingFlagMetricTag)(nil), // 1223: otg.PatternFlowGtpv2PiggybackingFlagMetricTag + (*PatternFlowGtpv2PiggybackingFlag)(nil), // 1224: otg.PatternFlowGtpv2PiggybackingFlag + (*PatternFlowGtpv2TeidFlagCounter)(nil), // 1225: otg.PatternFlowGtpv2TeidFlagCounter + (*PatternFlowGtpv2TeidFlagMetricTag)(nil), // 1226: otg.PatternFlowGtpv2TeidFlagMetricTag + (*PatternFlowGtpv2TeidFlag)(nil), // 1227: otg.PatternFlowGtpv2TeidFlag + (*PatternFlowGtpv2Spare1Counter)(nil), // 1228: otg.PatternFlowGtpv2Spare1Counter + (*PatternFlowGtpv2Spare1MetricTag)(nil), // 1229: otg.PatternFlowGtpv2Spare1MetricTag + (*PatternFlowGtpv2Spare1)(nil), // 1230: otg.PatternFlowGtpv2Spare1 + (*PatternFlowGtpv2MessageTypeCounter)(nil), // 1231: otg.PatternFlowGtpv2MessageTypeCounter + (*PatternFlowGtpv2MessageTypeMetricTag)(nil), // 1232: otg.PatternFlowGtpv2MessageTypeMetricTag + (*PatternFlowGtpv2MessageType)(nil), // 1233: otg.PatternFlowGtpv2MessageType + (*PatternFlowGtpv2MessageLengthCounter)(nil), // 1234: otg.PatternFlowGtpv2MessageLengthCounter + (*PatternFlowGtpv2MessageLengthMetricTag)(nil), // 1235: otg.PatternFlowGtpv2MessageLengthMetricTag + (*PatternFlowGtpv2MessageLength)(nil), // 1236: otg.PatternFlowGtpv2MessageLength + (*PatternFlowGtpv2TeidCounter)(nil), // 1237: otg.PatternFlowGtpv2TeidCounter + (*PatternFlowGtpv2TeidMetricTag)(nil), // 1238: otg.PatternFlowGtpv2TeidMetricTag + (*PatternFlowGtpv2Teid)(nil), // 1239: otg.PatternFlowGtpv2Teid + (*PatternFlowGtpv2SequenceNumberCounter)(nil), // 1240: otg.PatternFlowGtpv2SequenceNumberCounter + (*PatternFlowGtpv2SequenceNumberMetricTag)(nil), // 1241: otg.PatternFlowGtpv2SequenceNumberMetricTag + (*PatternFlowGtpv2SequenceNumber)(nil), // 1242: otg.PatternFlowGtpv2SequenceNumber + (*PatternFlowGtpv2Spare2Counter)(nil), // 1243: otg.PatternFlowGtpv2Spare2Counter + (*PatternFlowGtpv2Spare2MetricTag)(nil), // 1244: otg.PatternFlowGtpv2Spare2MetricTag + (*PatternFlowGtpv2Spare2)(nil), // 1245: otg.PatternFlowGtpv2Spare2 + (*PatternFlowArpHardwareTypeCounter)(nil), // 1246: otg.PatternFlowArpHardwareTypeCounter + (*PatternFlowArpHardwareTypeMetricTag)(nil), // 1247: otg.PatternFlowArpHardwareTypeMetricTag + (*PatternFlowArpHardwareType)(nil), // 1248: otg.PatternFlowArpHardwareType + (*PatternFlowArpProtocolTypeCounter)(nil), // 1249: otg.PatternFlowArpProtocolTypeCounter + (*PatternFlowArpProtocolTypeMetricTag)(nil), // 1250: otg.PatternFlowArpProtocolTypeMetricTag + (*PatternFlowArpProtocolType)(nil), // 1251: otg.PatternFlowArpProtocolType + (*PatternFlowArpHardwareLengthCounter)(nil), // 1252: otg.PatternFlowArpHardwareLengthCounter + (*PatternFlowArpHardwareLengthMetricTag)(nil), // 1253: otg.PatternFlowArpHardwareLengthMetricTag + (*PatternFlowArpHardwareLength)(nil), // 1254: otg.PatternFlowArpHardwareLength + (*PatternFlowArpProtocolLengthCounter)(nil), // 1255: otg.PatternFlowArpProtocolLengthCounter + (*PatternFlowArpProtocolLengthMetricTag)(nil), // 1256: otg.PatternFlowArpProtocolLengthMetricTag + (*PatternFlowArpProtocolLength)(nil), // 1257: otg.PatternFlowArpProtocolLength + (*PatternFlowArpOperationCounter)(nil), // 1258: otg.PatternFlowArpOperationCounter + (*PatternFlowArpOperationMetricTag)(nil), // 1259: otg.PatternFlowArpOperationMetricTag + (*PatternFlowArpOperation)(nil), // 1260: otg.PatternFlowArpOperation + (*PatternFlowArpSenderHardwareAddrCounter)(nil), // 1261: otg.PatternFlowArpSenderHardwareAddrCounter + (*PatternFlowArpSenderHardwareAddrMetricTag)(nil), // 1262: otg.PatternFlowArpSenderHardwareAddrMetricTag + (*PatternFlowArpSenderHardwareAddr)(nil), // 1263: otg.PatternFlowArpSenderHardwareAddr + (*PatternFlowArpSenderProtocolAddrCounter)(nil), // 1264: otg.PatternFlowArpSenderProtocolAddrCounter + (*PatternFlowArpSenderProtocolAddrMetricTag)(nil), // 1265: otg.PatternFlowArpSenderProtocolAddrMetricTag + (*PatternFlowArpSenderProtocolAddr)(nil), // 1266: otg.PatternFlowArpSenderProtocolAddr + (*PatternFlowArpTargetHardwareAddrCounter)(nil), // 1267: otg.PatternFlowArpTargetHardwareAddrCounter + (*PatternFlowArpTargetHardwareAddrMetricTag)(nil), // 1268: otg.PatternFlowArpTargetHardwareAddrMetricTag + (*PatternFlowArpTargetHardwareAddr)(nil), // 1269: otg.PatternFlowArpTargetHardwareAddr + (*PatternFlowArpTargetProtocolAddrCounter)(nil), // 1270: otg.PatternFlowArpTargetProtocolAddrCounter + (*PatternFlowArpTargetProtocolAddrMetricTag)(nil), // 1271: otg.PatternFlowArpTargetProtocolAddrMetricTag + (*PatternFlowArpTargetProtocolAddr)(nil), // 1272: otg.PatternFlowArpTargetProtocolAddr + (*PatternFlowIcmpEchoTypeCounter)(nil), // 1273: otg.PatternFlowIcmpEchoTypeCounter + (*PatternFlowIcmpEchoTypeMetricTag)(nil), // 1274: otg.PatternFlowIcmpEchoTypeMetricTag + (*PatternFlowIcmpEchoType)(nil), // 1275: otg.PatternFlowIcmpEchoType + (*PatternFlowIcmpEchoCodeCounter)(nil), // 1276: otg.PatternFlowIcmpEchoCodeCounter + (*PatternFlowIcmpEchoCodeMetricTag)(nil), // 1277: otg.PatternFlowIcmpEchoCodeMetricTag + (*PatternFlowIcmpEchoCode)(nil), // 1278: otg.PatternFlowIcmpEchoCode + (*PatternFlowIcmpEchoChecksum)(nil), // 1279: otg.PatternFlowIcmpEchoChecksum + (*PatternFlowIcmpEchoIdentifierCounter)(nil), // 1280: otg.PatternFlowIcmpEchoIdentifierCounter + (*PatternFlowIcmpEchoIdentifierMetricTag)(nil), // 1281: otg.PatternFlowIcmpEchoIdentifierMetricTag + (*PatternFlowIcmpEchoIdentifier)(nil), // 1282: otg.PatternFlowIcmpEchoIdentifier + (*PatternFlowIcmpEchoSequenceNumberCounter)(nil), // 1283: otg.PatternFlowIcmpEchoSequenceNumberCounter + (*PatternFlowIcmpEchoSequenceNumberMetricTag)(nil), // 1284: otg.PatternFlowIcmpEchoSequenceNumberMetricTag + (*PatternFlowIcmpEchoSequenceNumber)(nil), // 1285: otg.PatternFlowIcmpEchoSequenceNumber + (*PatternFlowIcmpCommonChecksum)(nil), // 1286: otg.PatternFlowIcmpCommonChecksum + (*PatternFlowIcmpNextFieldsIdentifierCounter)(nil), // 1287: otg.PatternFlowIcmpNextFieldsIdentifierCounter + (*PatternFlowIcmpNextFieldsIdentifierMetricTag)(nil), // 1288: otg.PatternFlowIcmpNextFieldsIdentifierMetricTag + (*PatternFlowIcmpNextFieldsIdentifier)(nil), // 1289: otg.PatternFlowIcmpNextFieldsIdentifier + (*PatternFlowIcmpNextFieldsSequenceNumberCounter)(nil), // 1290: otg.PatternFlowIcmpNextFieldsSequenceNumberCounter + (*PatternFlowIcmpNextFieldsSequenceNumberMetricTag)(nil), // 1291: otg.PatternFlowIcmpNextFieldsSequenceNumberMetricTag + (*PatternFlowIcmpNextFieldsSequenceNumber)(nil), // 1292: otg.PatternFlowIcmpNextFieldsSequenceNumber + (*PatternFlowIcmpv6EchoTypeCounter)(nil), // 1293: otg.PatternFlowIcmpv6EchoTypeCounter + (*PatternFlowIcmpv6EchoTypeMetricTag)(nil), // 1294: otg.PatternFlowIcmpv6EchoTypeMetricTag + (*PatternFlowIcmpv6EchoType)(nil), // 1295: otg.PatternFlowIcmpv6EchoType + (*PatternFlowIcmpv6EchoCodeCounter)(nil), // 1296: otg.PatternFlowIcmpv6EchoCodeCounter + (*PatternFlowIcmpv6EchoCodeMetricTag)(nil), // 1297: otg.PatternFlowIcmpv6EchoCodeMetricTag + (*PatternFlowIcmpv6EchoCode)(nil), // 1298: otg.PatternFlowIcmpv6EchoCode + (*PatternFlowIcmpv6EchoIdentifierCounter)(nil), // 1299: otg.PatternFlowIcmpv6EchoIdentifierCounter + (*PatternFlowIcmpv6EchoIdentifierMetricTag)(nil), // 1300: otg.PatternFlowIcmpv6EchoIdentifierMetricTag + (*PatternFlowIcmpv6EchoIdentifier)(nil), // 1301: otg.PatternFlowIcmpv6EchoIdentifier + (*PatternFlowIcmpv6EchoSequenceNumberCounter)(nil), // 1302: otg.PatternFlowIcmpv6EchoSequenceNumberCounter + (*PatternFlowIcmpv6EchoSequenceNumberMetricTag)(nil), // 1303: otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag + (*PatternFlowIcmpv6EchoSequenceNumber)(nil), // 1304: otg.PatternFlowIcmpv6EchoSequenceNumber + (*PatternFlowIcmpv6EchoChecksum)(nil), // 1305: otg.PatternFlowIcmpv6EchoChecksum + (*PatternFlowIcmpv6CommonChecksum)(nil), // 1306: otg.PatternFlowIcmpv6CommonChecksum + (*PatternFlowPppAddressCounter)(nil), // 1307: otg.PatternFlowPppAddressCounter + (*PatternFlowPppAddressMetricTag)(nil), // 1308: otg.PatternFlowPppAddressMetricTag + (*PatternFlowPppAddress)(nil), // 1309: otg.PatternFlowPppAddress + (*PatternFlowPppControlCounter)(nil), // 1310: otg.PatternFlowPppControlCounter + (*PatternFlowPppControlMetricTag)(nil), // 1311: otg.PatternFlowPppControlMetricTag + (*PatternFlowPppControl)(nil), // 1312: otg.PatternFlowPppControl + (*PatternFlowPppProtocolTypeCounter)(nil), // 1313: otg.PatternFlowPppProtocolTypeCounter + (*PatternFlowPppProtocolTypeMetricTag)(nil), // 1314: otg.PatternFlowPppProtocolTypeMetricTag + (*PatternFlowPppProtocolType)(nil), // 1315: otg.PatternFlowPppProtocolType + (*PatternFlowIgmpv1VersionCounter)(nil), // 1316: otg.PatternFlowIgmpv1VersionCounter + (*PatternFlowIgmpv1VersionMetricTag)(nil), // 1317: otg.PatternFlowIgmpv1VersionMetricTag + (*PatternFlowIgmpv1Version)(nil), // 1318: otg.PatternFlowIgmpv1Version + (*PatternFlowIgmpv1TypeCounter)(nil), // 1319: otg.PatternFlowIgmpv1TypeCounter + (*PatternFlowIgmpv1TypeMetricTag)(nil), // 1320: otg.PatternFlowIgmpv1TypeMetricTag + (*PatternFlowIgmpv1Type)(nil), // 1321: otg.PatternFlowIgmpv1Type + (*PatternFlowIgmpv1UnusedCounter)(nil), // 1322: otg.PatternFlowIgmpv1UnusedCounter + (*PatternFlowIgmpv1UnusedMetricTag)(nil), // 1323: otg.PatternFlowIgmpv1UnusedMetricTag + (*PatternFlowIgmpv1Unused)(nil), // 1324: otg.PatternFlowIgmpv1Unused + (*PatternFlowIgmpv1Checksum)(nil), // 1325: otg.PatternFlowIgmpv1Checksum + (*PatternFlowIgmpv1GroupAddressCounter)(nil), // 1326: otg.PatternFlowIgmpv1GroupAddressCounter + (*PatternFlowIgmpv1GroupAddressMetricTag)(nil), // 1327: otg.PatternFlowIgmpv1GroupAddressMetricTag + (*PatternFlowIgmpv1GroupAddress)(nil), // 1328: otg.PatternFlowIgmpv1GroupAddress + (*PatternFlowMplsLabelCounter)(nil), // 1329: otg.PatternFlowMplsLabelCounter + (*PatternFlowMplsLabelMetricTag)(nil), // 1330: otg.PatternFlowMplsLabelMetricTag + (*PatternFlowMplsLabel)(nil), // 1331: otg.PatternFlowMplsLabel + (*PatternFlowMplsTrafficClassCounter)(nil), // 1332: otg.PatternFlowMplsTrafficClassCounter + (*PatternFlowMplsTrafficClassMetricTag)(nil), // 1333: otg.PatternFlowMplsTrafficClassMetricTag + (*PatternFlowMplsTrafficClass)(nil), // 1334: otg.PatternFlowMplsTrafficClass + (*PatternFlowMplsBottomOfStackCounter)(nil), // 1335: otg.PatternFlowMplsBottomOfStackCounter + (*PatternFlowMplsBottomOfStackMetricTag)(nil), // 1336: otg.PatternFlowMplsBottomOfStackMetricTag + (*PatternFlowMplsBottomOfStack)(nil), // 1337: otg.PatternFlowMplsBottomOfStack + (*PatternFlowMplsTimeToLiveCounter)(nil), // 1338: otg.PatternFlowMplsTimeToLiveCounter + (*PatternFlowMplsTimeToLiveMetricTag)(nil), // 1339: otg.PatternFlowMplsTimeToLiveMetricTag + (*PatternFlowMplsTimeToLive)(nil), // 1340: otg.PatternFlowMplsTimeToLive + (*PatternFlowSnmpv2CVersionCounter)(nil), // 1341: otg.PatternFlowSnmpv2cVersionCounter + (*PatternFlowSnmpv2CVersion)(nil), // 1342: otg.PatternFlowSnmpv2cVersion + (*PatternFlowSnmpv2CPDURequestIdCounter)(nil), // 1343: otg.PatternFlowSnmpv2cPDURequestIdCounter + (*PatternFlowSnmpv2CPDURequestId)(nil), // 1344: otg.PatternFlowSnmpv2cPDURequestId + (*PatternFlowSnmpv2CPDUErrorIndexCounter)(nil), // 1345: otg.PatternFlowSnmpv2cPDUErrorIndexCounter + (*PatternFlowSnmpv2CPDUErrorIndex)(nil), // 1346: otg.PatternFlowSnmpv2cPDUErrorIndex + (*PatternFlowSnmpv2CBulkPDURequestIdCounter)(nil), // 1347: otg.PatternFlowSnmpv2cBulkPDURequestIdCounter + (*PatternFlowSnmpv2CBulkPDURequestId)(nil), // 1348: otg.PatternFlowSnmpv2cBulkPDURequestId + (*PatternFlowSnmpv2CBulkPDUNonRepeaters)(nil), // 1349: otg.PatternFlowSnmpv2cBulkPDUNonRepeaters + (*PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter)(nil), // 1350: otg.PatternFlowSnmpv2cBulkPDUMaxRepetitionsCounter + (*PatternFlowSnmpv2CBulkPDUMaxRepetitions)(nil), // 1351: otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions + (*PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter)(nil), // 1352: otg.PatternFlowSnmpv2cVariableBindingValueIntegerValueCounter + (*PatternFlowSnmpv2CVariableBindingValueIntegerValue)(nil), // 1353: otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue + (*PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter)(nil), // 1354: otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValueCounter + (*PatternFlowSnmpv2CVariableBindingValueIpAddressValue)(nil), // 1355: otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue + (*PatternFlowSnmpv2CVariableBindingValueCounterValueCounter)(nil), // 1356: otg.PatternFlowSnmpv2cVariableBindingValueCounterValueCounter + (*PatternFlowSnmpv2CVariableBindingValueCounterValue)(nil), // 1357: otg.PatternFlowSnmpv2cVariableBindingValueCounterValue + (*PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter)(nil), // 1358: otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValueCounter + (*PatternFlowSnmpv2CVariableBindingValueTimeticksValue)(nil), // 1359: otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue + (*PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter)(nil), // 1360: otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValueCounter + (*PatternFlowSnmpv2CVariableBindingValueBigCounterValue)(nil), // 1361: otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue + (*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter)(nil), // 1362: otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValueCounter + (*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue)(nil), // 1363: otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue + (*PatternFlowSnmpv2CCommonRequestIdCounter)(nil), // 1364: otg.PatternFlowSnmpv2cCommonRequestIdCounter + (*PatternFlowSnmpv2CCommonRequestId)(nil), // 1365: otg.PatternFlowSnmpv2cCommonRequestId + (*PatternFlowRsvpRsvpChecksum)(nil), // 1366: otg.PatternFlowRsvpRsvpChecksum + (*PatternFlowRsvpTimeToLiveCounter)(nil), // 1367: otg.PatternFlowRsvpTimeToLiveCounter + (*PatternFlowRsvpTimeToLive)(nil), // 1368: otg.PatternFlowRsvpTimeToLive + (*PatternFlowRsvpReservedCounter)(nil), // 1369: otg.PatternFlowRsvpReservedCounter + (*PatternFlowRsvpReserved)(nil), // 1370: otg.PatternFlowRsvpReserved + (*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter)(nil), // 1371: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + (*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress)(nil), // 1372: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + (*PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter)(nil), // 1373: otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + (*PatternFlowRSVPPathSessionLspTunnelIpv4Reserved)(nil), // 1374: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + (*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter)(nil), // 1375: otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + (*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId)(nil), // 1376: otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + (*PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter)(nil), // 1377: otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + (*PatternFlowRSVPPathSessionExtTunnelIdAsInteger)(nil), // 1378: otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger + (*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter)(nil), // 1379: otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + (*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4)(nil), // 1380: otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + (*PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter)(nil), // 1381: otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + (*PatternFlowRSVPPathRsvpHopIpv4Ipv4Address)(nil), // 1382: otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + (*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter)(nil), // 1383: otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + (*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle)(nil), // 1384: otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + (*PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter)(nil), // 1385: otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + (*PatternFlowRSVPPathTimeValuesType1RefreshPeriodR)(nil), // 1386: otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter)(nil), // 1387: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit)(nil), // 1388: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter)(nil), // 1389: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address)(nil), // 1390: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + (*PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter)(nil), // 1391: otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + (*PatternFlowRSVPPathExplicitRouteType1ASNumberLBit)(nil), // 1392: otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter)(nil), // 1393: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved)(nil), // 1394: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter)(nil), // 1395: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pidCounter + (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid)(nil), // 1396: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid + (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter)(nil), // 1397: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress)(nil), // 1398: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter)(nil), // 1399: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved)(nil), // 1400: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter)(nil), // 1401: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId)(nil), // 1402: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + (*PatternFlowRSVPPathSenderTspecIntServVersionCounter)(nil), // 1403: otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter + (*PatternFlowRSVPPathSenderTspecIntServVersion)(nil), // 1404: otg.PatternFlowRSVPPathSenderTspecIntServVersion + (*PatternFlowRSVPPathSenderTspecIntServReserved1Counter)(nil), // 1405: otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter + (*PatternFlowRSVPPathSenderTspecIntServReserved1)(nil), // 1406: otg.PatternFlowRSVPPathSenderTspecIntServReserved1 + (*PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter)(nil), // 1407: otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + (*PatternFlowRSVPPathSenderTspecIntServOverallLength)(nil), // 1408: otg.PatternFlowRSVPPathSenderTspecIntServOverallLength + (*PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter)(nil), // 1409: otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + (*PatternFlowRSVPPathSenderTspecIntServServiceHeader)(nil), // 1410: otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader + (*PatternFlowRSVPPathSenderTspecIntServZeroBitCounter)(nil), // 1411: otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + (*PatternFlowRSVPPathSenderTspecIntServZeroBit)(nil), // 1412: otg.PatternFlowRSVPPathSenderTspecIntServZeroBit + (*PatternFlowRSVPPathSenderTspecIntServReserved2Counter)(nil), // 1413: otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter + (*PatternFlowRSVPPathSenderTspecIntServReserved2)(nil), // 1414: otg.PatternFlowRSVPPathSenderTspecIntServReserved2 + (*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter)(nil), // 1415: otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + (*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData)(nil), // 1416: otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + (*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter)(nil), // 1417: otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + (*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec)(nil), // 1418: otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + (*PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter)(nil), // 1419: otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + (*PatternFlowRSVPPathSenderTspecIntServParameter127Flag)(nil), // 1420: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag + (*PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter)(nil), // 1421: otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + (*PatternFlowRSVPPathSenderTspecIntServParameter127Length)(nil), // 1422: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length + (*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter)(nil), // 1423: otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + (*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit)(nil), // 1424: otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + (*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter)(nil), // 1425: otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + (*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize)(nil), // 1426: otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter)(nil), // 1427: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address)(nil), // 1428: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter)(nil), // 1429: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength)(nil), // 1430: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + (*PatternFlowRSVPPathRecordRouteType1LabelFlags)(nil), // 1431: otg.PatternFlowRSVPPathRecordRouteType1LabelFlags + (*PatternFlowRSVPPathRecordRouteType1LabelCType)(nil), // 1432: otg.PatternFlowRSVPPathRecordRouteType1LabelCType + (*PatternFlowRSVPPathObjectsCustomTypeCounter)(nil), // 1433: otg.PatternFlowRSVPPathObjectsCustomTypeCounter + (*PatternFlowRSVPPathObjectsCustomType)(nil), // 1434: otg.PatternFlowRSVPPathObjectsCustomType + (*Version)(nil), // 1435: otg.Version + (*Success)(nil), // 1436: otg.Success + (*Failure)(nil), // 1437: otg.Failure + (*SetConfigRequest)(nil), // 1438: otg.SetConfigRequest + (*UpdateConfigRequest)(nil), // 1439: otg.UpdateConfigRequest + (*SetConfigResponse)(nil), // 1440: otg.SetConfigResponse + (*GetConfigResponse)(nil), // 1441: otg.GetConfigResponse + (*UpdateConfigResponse)(nil), // 1442: otg.UpdateConfigResponse + (*SetControlStateRequest)(nil), // 1443: otg.SetControlStateRequest + (*SetControlStateResponse)(nil), // 1444: otg.SetControlStateResponse + (*SetControlActionRequest)(nil), // 1445: otg.SetControlActionRequest + (*SetControlActionResponse)(nil), // 1446: otg.SetControlActionResponse + (*GetMetricsRequest)(nil), // 1447: otg.GetMetricsRequest + (*GetMetricsResponse)(nil), // 1448: otg.GetMetricsResponse + (*GetStatesRequest)(nil), // 1449: otg.GetStatesRequest + (*GetStatesResponse)(nil), // 1450: otg.GetStatesResponse + (*GetCaptureRequest)(nil), // 1451: otg.GetCaptureRequest + (*GetCaptureResponse)(nil), // 1452: otg.GetCaptureResponse + (*GetVersionResponse)(nil), // 1453: otg.GetVersionResponse + (*LagProtocol_Choice)(nil), // 1454: otg.LagProtocol.Choice + (*LagPortLacp_ActorActivity)(nil), // 1455: otg.LagPortLacp.ActorActivity + (*EthernetConnection_Choice)(nil), // 1456: otg.EthernetConnection.Choice + (*DeviceVlan_Tpid)(nil), // 1457: otg.DeviceVlan.Tpid + (*DeviceIpv4GatewayMAC_Choice)(nil), // 1458: otg.DeviceIpv4GatewayMAC.Choice + (*DeviceIpv6GatewayMAC_Choice)(nil), // 1459: otg.DeviceIpv6GatewayMAC.Choice + (*DeviceDhcpv4Client_Choice)(nil), // 1460: otg.DeviceDhcpv4client.Choice + (*Layer1_Speed)(nil), // 1461: otg.Layer1.Speed + (*Layer1_Media)(nil), // 1462: otg.Layer1.Media + (*Layer1FlowControl_Choice)(nil), // 1463: otg.Layer1FlowControl.Choice + (*Capture_Format)(nil), // 1464: otg.Capture.Format + (*CaptureFilter_Choice)(nil), // 1465: otg.CaptureFilter.Choice + (*IsisInterface_NetworkType)(nil), // 1466: otg.IsisInterface.NetworkType + (*IsisInterface_LevelType)(nil), // 1467: otg.IsisInterface.LevelType + (*IsisInterfaceAuthentication_AuthType)(nil), // 1468: otg.IsisInterfaceAuthentication.AuthType + (*IsisAuthenticationBase_AuthType)(nil), // 1469: otg.IsisAuthenticationBase.AuthType + (*IsisV4RouteRange_OriginType)(nil), // 1470: otg.IsisV4RouteRange.OriginType + (*IsisV4RouteRange_RedistributionType)(nil), // 1471: otg.IsisV4RouteRange.RedistributionType + (*IsisV6RouteRange_OriginType)(nil), // 1472: otg.IsisV6RouteRange.OriginType + (*IsisV6RouteRange_RedistributionType)(nil), // 1473: otg.IsisV6RouteRange.RedistributionType + (*DeviceBgpMessageHeaderError_Subcode)(nil), // 1474: otg.DeviceBgpMessageHeaderError.Subcode + (*DeviceBgpOpenMessageError_Subcode)(nil), // 1475: otg.DeviceBgpOpenMessageError.Subcode + (*DeviceBgpUpdateMessageError_Subcode)(nil), // 1476: otg.DeviceBgpUpdateMessageError.Subcode + (*DeviceBgpCeaseError_Subcode)(nil), // 1477: otg.DeviceBgpCeaseError.Subcode + (*BgpV4Peer_AsType)(nil), // 1478: otg.BgpV4Peer.AsType + (*BgpV4Peer_AsNumberWidth)(nil), // 1479: otg.BgpV4Peer.AsNumberWidth + (*BgpV4EthernetSegment_ActiveMode)(nil), // 1480: otg.BgpV4EthernetSegment.ActiveMode + (*BgpRouteAdvanced_Origin)(nil), // 1481: otg.BgpRouteAdvanced.Origin + (*BgpCommunity_Type)(nil), // 1482: otg.BgpCommunity.Type + (*BgpExtCommunity_Type)(nil), // 1483: otg.BgpExtCommunity.Type + (*BgpExtCommunity_Subtype)(nil), // 1484: otg.BgpExtCommunity.Subtype + (*BgpAsPath_AsSetMode)(nil), // 1485: otg.BgpAsPath.AsSetMode + (*BgpAsPathSegment_Type)(nil), // 1486: otg.BgpAsPathSegment.Type + (*BgpV4EvpnEvis_Choice)(nil), // 1487: otg.BgpV4EvpnEvis.Choice + (*BgpV4EviVxlan_ReplicationType)(nil), // 1488: otg.BgpV4EviVxlan.ReplicationType + (*BgpRouteDistinguisher_RdType)(nil), // 1489: otg.BgpRouteDistinguisher.RdType + (*BgpRouteTarget_RtType)(nil), // 1490: otg.BgpRouteTarget.RtType + (*BgpV4RouteRange_NextHopMode)(nil), // 1491: otg.BgpV4RouteRange.NextHopMode + (*BgpV4RouteRange_NextHopAddressType)(nil), // 1492: otg.BgpV4RouteRange.NextHopAddressType + (*BgpExtendedCommunity_Choice)(nil), // 1493: otg.BgpExtendedCommunity.Choice + (*BgpExtendedCommunityTransitive2OctetAsType_Choice)(nil), // 1494: otg.BgpExtendedCommunityTransitive2OctetAsType.Choice + (*BgpExtendedCommunityTransitiveIpv4AddressType_Choice)(nil), // 1495: otg.BgpExtendedCommunityTransitiveIpv4AddressType.Choice + (*BgpExtendedCommunityTransitive4OctetAsType_Choice)(nil), // 1496: otg.BgpExtendedCommunityTransitive4OctetAsType.Choice + (*BgpExtendedCommunityTransitiveOpaqueType_Choice)(nil), // 1497: otg.BgpExtendedCommunityTransitiveOpaqueType.Choice + (*BgpExtendedCommunityTransitiveEvpnType_Choice)(nil), // 1498: otg.BgpExtendedCommunityTransitiveEvpnType.Choice + (*BgpExtendedCommunityNonTransitive2OctetAsType_Choice)(nil), // 1499: otg.BgpExtendedCommunityNonTransitive2OctetAsType.Choice + (*BgpV6RouteRange_NextHopMode)(nil), // 1500: otg.BgpV6RouteRange.NextHopMode + (*BgpV6RouteRange_NextHopAddressType)(nil), // 1501: otg.BgpV6RouteRange.NextHopAddressType + (*BgpSrteV4Policy_NextHopMode)(nil), // 1502: otg.BgpSrteV4Policy.NextHopMode + (*BgpSrteV4Policy_NextHopAddressType)(nil), // 1503: otg.BgpSrteV4Policy.NextHopAddressType + (*BgpSrteRemoteEndpointSubTlv_AddressFamily)(nil), // 1504: otg.BgpSrteRemoteEndpointSubTlv.AddressFamily + (*BgpSrteBindingSubTlv_BindingSidType)(nil), // 1505: otg.BgpSrteBindingSubTlv.BindingSidType + (*BgpSrteExplicitNullLabelPolicySubTlv_ExplicitNullLabelPolicy)(nil), // 1506: otg.BgpSrteExplicitNullLabelPolicySubTlv.ExplicitNullLabelPolicy + (*BgpSrteSegment_SegmentType)(nil), // 1507: otg.BgpSrteSegment.SegmentType + (*BgpSrteV6Policy_NextHopMode)(nil), // 1508: otg.BgpSrteV6Policy.NextHopMode + (*BgpSrteV6Policy_NextHopAddressType)(nil), // 1509: otg.BgpSrteV6Policy.NextHopAddressType + (*BgpUpdateReplay_Choice)(nil), // 1510: otg.BgpUpdateReplay.Choice + (*BgpAttributes_Origin)(nil), // 1511: otg.BgpAttributes.Origin + (*BgpAttributesAsPath_Choice)(nil), // 1512: otg.BgpAttributesAsPath.Choice + (*BgpAttributesFourByteAsPathSegment_Type)(nil), // 1513: otg.BgpAttributesFourByteAsPathSegment.Type + (*BgpAttributesTwoByteAsPathSegment_Type)(nil), // 1514: otg.BgpAttributesTwoByteAsPathSegment.Type + (*BgpAttributesAggregator_Choice)(nil), // 1515: otg.BgpAttributesAggregator.Choice + (*BgpAttributesCommunity_Choice)(nil), // 1516: otg.BgpAttributesCommunity.Choice + (*BgpAttributesNextHop_Choice)(nil), // 1517: otg.BgpAttributesNextHop.Choice + (*BgpAttributesMpReachNlri_Choice)(nil), // 1518: otg.BgpAttributesMpReachNlri.Choice + (*BgpAttributesMpUnreachNlri_Choice)(nil), // 1519: otg.BgpAttributesMpUnreachNlri.Choice + (*BgpAttributesTunnelEncapsulation_Choice)(nil), // 1520: otg.BgpAttributesTunnelEncapsulation.Choice + (*BgpAttributesBsid_Choice)(nil), // 1521: otg.BgpAttributesBsid.Choice + (*BgpAttributesSrPolicyExplicitNullPolicy_Choice)(nil), // 1522: otg.BgpAttributesSrPolicyExplicitNullPolicy.Choice + (*BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice)(nil), // 1523: otg.BgpAttributesSegmentRoutingPolicySegmentListSegment.Choice + (*BgpV6Peer_AsType)(nil), // 1524: otg.BgpV6Peer.AsType + (*BgpV6Peer_AsNumberWidth)(nil), // 1525: otg.BgpV6Peer.AsNumberWidth + (*BgpV6EthernetSegment_ActiveMode)(nil), // 1526: otg.BgpV6EthernetSegment.ActiveMode + (*BgpV6EvpnEvis_Choice)(nil), // 1527: otg.BgpV6EvpnEvis.Choice + (*BgpV6EviVxlan_ReplicationType)(nil), // 1528: otg.BgpV6EviVxlan.ReplicationType + (*VxlanV4TunnelDestinationIPMode_Choice)(nil), // 1529: otg.VxlanV4TunnelDestinationIPMode.Choice + (*VxlanV6TunnelDestinationIPMode_Choice)(nil), // 1530: otg.VxlanV6TunnelDestinationIPMode.Choice + (*RsvpLspIpv4InterfaceP2PEgressIpv4Lsp_ReservationStyle)(nil), // 1531: otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp.ReservationStyle + (*RsvpEro_PrependNeighborIp)(nil), // 1532: otg.RsvpEro.PrependNeighborIp + (*RsvpEroSubobject_Type)(nil), // 1533: otg.RsvpEroSubobject.Type + (*RsvpEroSubobject_HopType)(nil), // 1534: otg.RsvpEroSubobject.HopType + (*FlowTxRx_Choice)(nil), // 1535: otg.FlowTxRx.Choice + (*FlowRouter_Mode)(nil), // 1536: otg.FlowRouter.Mode + (*FlowHeader_Choice)(nil), // 1537: otg.FlowHeader.Choice + (*FlowIpv4Options_Choice)(nil), // 1538: otg.FlowIpv4Options.Choice + (*FlowIpv4OptionsCustomLength_Choice)(nil), // 1539: otg.FlowIpv4OptionsCustomLength.Choice + (*FlowIpv4Priority_Choice)(nil), // 1540: otg.FlowIpv4Priority.Choice + (*FlowIpv4Auto_Choice)(nil), // 1541: otg.FlowIpv4Auto.Choice + (*FlowIcmp_Choice)(nil), // 1542: otg.FlowIcmp.Choice + (*FlowIcmpv6_Choice)(nil), // 1543: otg.FlowIcmpv6.Choice + (*FlowSnmpv2CData_Choice)(nil), // 1544: otg.FlowSnmpv2cData.Choice + (*FlowSnmpv2CPDU_ErrorStatus)(nil), // 1545: otg.FlowSnmpv2cPDU.ErrorStatus + (*FlowSnmpv2CVariableBindingValue_Choice)(nil), // 1546: otg.FlowSnmpv2cVariableBindingValue.Choice + (*FlowSnmpv2CVariableBindingStringValue_Choice)(nil), // 1547: otg.FlowSnmpv2cVariableBindingStringValue.Choice + (*FlowRsvp_Flag)(nil), // 1548: otg.FlowRsvp.Flag + (*FlowRSVPLength_Choice)(nil), // 1549: otg.FlowRSVPLength.Choice + (*FlowRSVPMessage_Choice)(nil), // 1550: otg.FlowRSVPMessage.Choice + (*FlowRSVPObjectLength_Choice)(nil), // 1551: otg.FlowRSVPObjectLength.Choice + (*FlowRSVPPathObjectsClass_Choice)(nil), // 1552: otg.FlowRSVPPathObjectsClass.Choice + (*FlowRSVPPathObjectsSessionCType_Choice)(nil), // 1553: otg.FlowRSVPPathObjectsSessionCType.Choice + (*FlowRSVPPathSessionExtTunnelId_Choice)(nil), // 1554: otg.FlowRSVPPathSessionExtTunnelId.Choice + (*FlowRSVPPathObjectsRsvpHopCType_Choice)(nil), // 1555: otg.FlowRSVPPathObjectsRsvpHopCType.Choice + (*FlowRSVPPathObjectsTimeValuesCType_Choice)(nil), // 1556: otg.FlowRSVPPathObjectsTimeValuesCType.Choice + (*FlowRSVPPathObjectsClassExplicitRouteCType_Choice)(nil), // 1557: otg.FlowRSVPPathObjectsClassExplicitRouteCType.Choice + (*FlowRSVPType1ExplicitRouteSubobjectsType_Choice)(nil), // 1558: otg.FlowRSVPType1ExplicitRouteSubobjectsType.Choice + (*FlowRSVPExplicitRouteLength_Choice)(nil), // 1559: otg.FlowRSVPExplicitRouteLength.Choice + (*FlowRSVPExplicitRouteASNumberLength_Choice)(nil), // 1560: otg.FlowRSVPExplicitRouteASNumberLength.Choice + (*FlowRSVPPathObjectsLabelRequestCType_Choice)(nil), // 1561: otg.FlowRSVPPathObjectsLabelRequestCType.Choice + (*FlowRSVPPathObjectsSessionAttributeCType_Choice)(nil), // 1562: otg.FlowRSVPPathObjectsSessionAttributeCType.Choice + (*FlowRSVPLspTunnelFlag_Choice)(nil), // 1563: otg.FlowRSVPLspTunnelFlag.Choice + (*FlowRSVPSessionAttributeNameLength_Choice)(nil), // 1564: otg.FlowRSVPSessionAttributeNameLength.Choice + (*FlowRSVPPathObjectsSenderTemplateCType_Choice)(nil), // 1565: otg.FlowRSVPPathObjectsSenderTemplateCType.Choice + (*FlowRSVPPathObjectsSenderTspecCType_Choice)(nil), // 1566: otg.FlowRSVPPathObjectsSenderTspecCType.Choice + (*FlowRSVPPathObjectsRecordRouteCType_Choice)(nil), // 1567: otg.FlowRSVPPathObjectsRecordRouteCType.Choice + (*FlowRSVPPathObjectsRecordRouteSubObjectType_Choice)(nil), // 1568: otg.FlowRSVPPathObjectsRecordRouteSubObjectType.Choice + (*FlowRSVPRecordRouteIPv4Flag_Choice)(nil), // 1569: otg.FlowRSVPRecordRouteIPv4Flag.Choice + (*FlowRSVPPathRecordRouteLabel_Choice)(nil), // 1570: otg.FlowRSVPPathRecordRouteLabel.Choice + (*FlowRSVPRouteRecordLength_Choice)(nil), // 1571: otg.FlowRSVPRouteRecordLength.Choice + (*FlowSize_Choice)(nil), // 1572: otg.FlowSize.Choice + (*FlowSizeWeightPairs_Choice)(nil), // 1573: otg.FlowSizeWeightPairs.Choice + (*FlowSizeWeightPairs_Predefined)(nil), // 1574: otg.FlowSizeWeightPairs.Predefined + (*FlowRate_Choice)(nil), // 1575: otg.FlowRate.Choice + (*FlowDuration_Choice)(nil), // 1576: otg.FlowDuration.Choice + (*FlowDelay_Choice)(nil), // 1577: otg.FlowDelay.Choice + (*FlowDurationInterBurstGap_Choice)(nil), // 1578: otg.FlowDurationInterBurstGap.Choice + (*FlowLatencyMetrics_Mode)(nil), // 1579: otg.FlowLatencyMetrics.Mode + (*FlowRxTxRatio_Choice)(nil), // 1580: otg.FlowRxTxRatio.Choice + (*EventRequest_Type)(nil), // 1581: otg.EventRequest.Type + (*LldpConnection_Choice)(nil), // 1582: otg.LldpConnection.Choice + (*LldpChassisId_Choice)(nil), // 1583: otg.LldpChassisId.Choice + (*LldpPortId_Choice)(nil), // 1584: otg.LldpPortId.Choice + (*LldpChassisMacSubType_Choice)(nil), // 1585: otg.LldpChassisMacSubType.Choice + (*LldpPortInterfaceNameSubType_Choice)(nil), // 1586: otg.LldpPortInterfaceNameSubType.Choice + (*LldpSystemName_Choice)(nil), // 1587: otg.LldpSystemName.Choice + (*Error_Kind)(nil), // 1588: otg.Error.Kind + (*ConfigUpdate_Choice)(nil), // 1589: otg.ConfigUpdate.Choice + (*FlowsUpdate_PropertyNames)(nil), // 1590: otg.FlowsUpdate.PropertyNames + (*ControlState_Choice)(nil), // 1591: otg.ControlState.Choice + (*StatePort_Choice)(nil), // 1592: otg.StatePort.Choice + (*StateTraffic_Choice)(nil), // 1593: otg.StateTraffic.Choice + (*StateProtocol_Choice)(nil), // 1594: otg.StateProtocol.Choice + (*StatePortLink_State)(nil), // 1595: otg.StatePortLink.State + (*StatePortCapture_State)(nil), // 1596: otg.StatePortCapture.State + (*StateTrafficFlowTransmit_State)(nil), // 1597: otg.StateTrafficFlowTransmit.State + (*StateProtocolAll_State)(nil), // 1598: otg.StateProtocolAll.State + (*StateProtocolRoute_State)(nil), // 1599: otg.StateProtocolRoute.State + (*StateProtocolLacp_Choice)(nil), // 1600: otg.StateProtocolLacp.Choice + (*StateProtocolLacpAdmin_State)(nil), // 1601: otg.StateProtocolLacpAdmin.State + (*StateProtocolLacpMemberPorts_State)(nil), // 1602: otg.StateProtocolLacpMemberPorts.State + (*StateProtocolBgp_Choice)(nil), // 1603: otg.StateProtocolBgp.Choice + (*StateProtocolBgpPeers_State)(nil), // 1604: otg.StateProtocolBgpPeers.State + (*StateProtocolIsis_Choice)(nil), // 1605: otg.StateProtocolIsis.Choice + (*StateProtocolIsisRouters_State)(nil), // 1606: otg.StateProtocolIsisRouters.State + (*ControlAction_Choice)(nil), // 1607: otg.ControlAction.Choice + (*ActionResponse_Choice)(nil), // 1608: otg.ActionResponse.Choice + (*ActionProtocol_Choice)(nil), // 1609: otg.ActionProtocol.Choice + (*ActionResponseProtocol_Choice)(nil), // 1610: otg.ActionResponseProtocol.Choice + (*ActionProtocolIpv4_Choice)(nil), // 1611: otg.ActionProtocolIpv4.Choice + (*ActionResponseProtocolIpv4_Choice)(nil), // 1612: otg.ActionResponseProtocolIpv4.Choice + (*ActionResponseProtocolIpv4PingResponse_Result)(nil), // 1613: otg.ActionResponseProtocolIpv4PingResponse.Result + (*ActionProtocolIpv6_Choice)(nil), // 1614: otg.ActionProtocolIpv6.Choice + (*ActionResponseProtocolIpv6_Choice)(nil), // 1615: otg.ActionResponseProtocolIpv6.Choice + (*ActionResponseProtocolIpv6PingResponse_Result)(nil), // 1616: otg.ActionResponseProtocolIpv6PingResponse.Result + (*ActionProtocolBgp_Choice)(nil), // 1617: otg.ActionProtocolBgp.Choice + (*ActionProtocolBgpNotification_Choice)(nil), // 1618: otg.ActionProtocolBgpNotification.Choice + (*MetricsRequest_Choice)(nil), // 1619: otg.MetricsRequest.Choice + (*MetricsResponse_Choice)(nil), // 1620: otg.MetricsResponse.Choice + (*PortMetricsRequest_ColumnNames)(nil), // 1621: otg.PortMetricsRequest.ColumnNames + (*PortMetric_Link)(nil), // 1622: otg.PortMetric.Link + (*PortMetric_Capture)(nil), // 1623: otg.PortMetric.Capture + (*PortMetric_Transmit)(nil), // 1624: otg.PortMetric.Transmit + (*FlowMetricsRequest_MetricNames)(nil), // 1625: otg.FlowMetricsRequest.MetricNames + (*FlowTaggedMetricsFilter_MetricNames)(nil), // 1626: otg.FlowTaggedMetricsFilter.MetricNames + (*FlowMetric_Transmit)(nil), // 1627: otg.FlowMetric.Transmit + (*FlowMetricTagValue_Choice)(nil), // 1628: otg.FlowMetricTagValue.Choice + (*Bgpv4MetricsRequest_ColumnNames)(nil), // 1629: otg.Bgpv4MetricsRequest.ColumnNames + (*Bgpv4Metric_SessionState)(nil), // 1630: otg.Bgpv4Metric.SessionState + (*Bgpv4Metric_FsmState)(nil), // 1631: otg.Bgpv4Metric.FsmState + (*Bgpv6MetricsRequest_ColumnNames)(nil), // 1632: otg.Bgpv6MetricsRequest.ColumnNames + (*Bgpv6Metric_SessionState)(nil), // 1633: otg.Bgpv6Metric.SessionState + (*Bgpv6Metric_FsmState)(nil), // 1634: otg.Bgpv6Metric.FsmState + (*IsisMetricsRequest_ColumnNames)(nil), // 1635: otg.IsisMetricsRequest.ColumnNames + (*LagMetricsRequest_ColumnNames)(nil), // 1636: otg.LagMetricsRequest.ColumnNames + (*LagMetric_OperStatus)(nil), // 1637: otg.LagMetric.OperStatus + (*LacpMetricsRequest_ColumnNames)(nil), // 1638: otg.LacpMetricsRequest.ColumnNames + (*LacpMetric_Activity)(nil), // 1639: otg.LacpMetric.Activity + (*LacpMetric_Timeout)(nil), // 1640: otg.LacpMetric.Timeout + (*LacpMetric_Synchronization)(nil), // 1641: otg.LacpMetric.Synchronization + (*LldpMetricsRequest_ColumnNames)(nil), // 1642: otg.LldpMetricsRequest.ColumnNames + (*RsvpMetricsRequest_ColumnNames)(nil), // 1643: otg.RsvpMetricsRequest.ColumnNames + (*Dhcpv4ClientMetricsRequest_ColumnNames)(nil), // 1644: otg.Dhcpv4ClientMetricsRequest.ColumnNames + (*Dhcpv4ServerMetricsRequest_ColumnNames)(nil), // 1645: otg.Dhcpv4ServerMetricsRequest.ColumnNames + (*StatesRequest_Choice)(nil), // 1646: otg.StatesRequest.Choice + (*StatesResponse_Choice)(nil), // 1647: otg.StatesResponse.Choice + (*BgpPrefixStateRequest_PrefixFilters)(nil), // 1648: otg.BgpPrefixStateRequest.PrefixFilters + (*BgpPrefixIpv4UnicastFilter_Origin)(nil), // 1649: otg.BgpPrefixIpv4UnicastFilter.Origin + (*BgpPrefixIpv6UnicastFilter_Origin)(nil), // 1650: otg.BgpPrefixIpv6UnicastFilter.Origin + (*BgpPrefixIpv4UnicastState_Origin)(nil), // 1651: otg.BgpPrefixIpv4UnicastState.Origin + (*BgpPrefixIpv6UnicastState_Origin)(nil), // 1652: otg.BgpPrefixIpv6UnicastState.Origin + (*ResultExtendedCommunityStructured_Choice)(nil), // 1653: otg.ResultExtendedCommunityStructured.Choice + (*ResultExtendedCommunityTransitive2OctetAsType_Choice)(nil), // 1654: otg.ResultExtendedCommunityTransitive2OctetAsType.Choice + (*ResultExtendedCommunityTransitiveIpv4AddressType_Choice)(nil), // 1655: otg.ResultExtendedCommunityTransitiveIpv4AddressType.Choice + (*ResultExtendedCommunityTransitive4OctetAsType_Choice)(nil), // 1656: otg.ResultExtendedCommunityTransitive4OctetAsType.Choice + (*ResultExtendedCommunityTransitiveOpaqueType_Choice)(nil), // 1657: otg.ResultExtendedCommunityTransitiveOpaqueType.Choice + (*ResultExtendedCommunityNonTransitive2OctetAsType_Choice)(nil), // 1658: otg.ResultExtendedCommunityNonTransitive2OctetAsType.Choice + (*ResultBgpCommunity_Type)(nil), // 1659: otg.ResultBgpCommunity.Type + (*ResultBgpAsPathSegment_Type)(nil), // 1660: otg.ResultBgpAsPathSegment.Type + (*IsisLspState_PduType)(nil), // 1661: otg.IsisLspState.PduType + (*IsisLspV4Prefix_RedistributionType)(nil), // 1662: otg.IsisLspV4Prefix.RedistributionType + (*IsisLspV4Prefix_OriginType)(nil), // 1663: otg.IsisLspV4Prefix.OriginType + (*IsisLspExtendedV4Prefix_RedistributionType)(nil), // 1664: otg.IsisLspExtendedV4Prefix.RedistributionType + (*IsisLspV6Prefix_RedistributionType)(nil), // 1665: otg.IsisLspV6Prefix.RedistributionType + (*IsisLspV6Prefix_OriginType)(nil), // 1666: otg.IsisLspV6Prefix.OriginType + (*LldpNeighborsState_ChassisIdType)(nil), // 1667: otg.LldpNeighborsState.ChassisIdType + (*LldpNeighborsState_PortIdType)(nil), // 1668: otg.LldpNeighborsState.PortIdType + (*LldpCapabilityState_CapabilityName)(nil), // 1669: otg.LldpCapabilityState.CapabilityName + (*RsvpLspState_SessionStatus)(nil), // 1670: otg.RsvpLspState.SessionStatus + (*RsvpLspState_LastFlapReason)(nil), // 1671: otg.RsvpLspState.LastFlapReason + (*RsvpLspIpv4Ero_Type)(nil), // 1672: otg.RsvpLspIpv4Ero.Type + (*PatternFlowEthernetDst_Choice)(nil), // 1673: otg.PatternFlowEthernetDst.Choice + (*PatternFlowEthernetSrc_Choice)(nil), // 1674: otg.PatternFlowEthernetSrc.Choice + (*PatternFlowEthernetEtherType_Choice)(nil), // 1675: otg.PatternFlowEthernetEtherType.Choice + (*PatternFlowEthernetPfcQueue_Choice)(nil), // 1676: otg.PatternFlowEthernetPfcQueue.Choice + (*PatternFlowVlanPriority_Choice)(nil), // 1677: otg.PatternFlowVlanPriority.Choice + (*PatternFlowVlanCfi_Choice)(nil), // 1678: otg.PatternFlowVlanCfi.Choice + (*PatternFlowVlanId_Choice)(nil), // 1679: otg.PatternFlowVlanId.Choice + (*PatternFlowVlanTpid_Choice)(nil), // 1680: otg.PatternFlowVlanTpid.Choice + (*PatternFlowVxlanFlags_Choice)(nil), // 1681: otg.PatternFlowVxlanFlags.Choice + (*PatternFlowVxlanReserved0_Choice)(nil), // 1682: otg.PatternFlowVxlanReserved0.Choice + (*PatternFlowVxlanVni_Choice)(nil), // 1683: otg.PatternFlowVxlanVni.Choice + (*PatternFlowVxlanReserved1_Choice)(nil), // 1684: otg.PatternFlowVxlanReserved1.Choice + (*PatternFlowIpv4Version_Choice)(nil), // 1685: otg.PatternFlowIpv4Version.Choice + (*PatternFlowIpv4HeaderLength_Choice)(nil), // 1686: otg.PatternFlowIpv4HeaderLength.Choice + (*PatternFlowIpv4TotalLength_Choice)(nil), // 1687: otg.PatternFlowIpv4TotalLength.Choice + (*PatternFlowIpv4Identification_Choice)(nil), // 1688: otg.PatternFlowIpv4Identification.Choice + (*PatternFlowIpv4Reserved_Choice)(nil), // 1689: otg.PatternFlowIpv4Reserved.Choice + (*PatternFlowIpv4DontFragment_Choice)(nil), // 1690: otg.PatternFlowIpv4DontFragment.Choice + (*PatternFlowIpv4MoreFragments_Choice)(nil), // 1691: otg.PatternFlowIpv4MoreFragments.Choice + (*PatternFlowIpv4FragmentOffset_Choice)(nil), // 1692: otg.PatternFlowIpv4FragmentOffset.Choice + (*PatternFlowIpv4TimeToLive_Choice)(nil), // 1693: otg.PatternFlowIpv4TimeToLive.Choice + (*PatternFlowIpv4Protocol_Choice)(nil), // 1694: otg.PatternFlowIpv4Protocol.Choice + (*PatternFlowIpv4HeaderChecksum_Choice)(nil), // 1695: otg.PatternFlowIpv4HeaderChecksum.Choice + (*PatternFlowIpv4HeaderChecksum_Generated)(nil), // 1696: otg.PatternFlowIpv4HeaderChecksum.Generated + (*PatternFlowIpv4Src_Choice)(nil), // 1697: otg.PatternFlowIpv4Src.Choice + (*PatternFlowIpv4Dst_Choice)(nil), // 1698: otg.PatternFlowIpv4Dst.Choice + (*PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice)(nil), // 1699: otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag.Choice + (*PatternFlowIpv4OptionsCustomTypeOptionClass_Choice)(nil), // 1700: otg.PatternFlowIpv4OptionsCustomTypeOptionClass.Choice + (*PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice)(nil), // 1701: otg.PatternFlowIpv4OptionsCustomTypeOptionNumber.Choice + (*PatternFlowIpv4PriorityRaw_Choice)(nil), // 1702: otg.PatternFlowIpv4PriorityRaw.Choice + (*PatternFlowIpv4DscpPhb_Choice)(nil), // 1703: otg.PatternFlowIpv4DscpPhb.Choice + (*PatternFlowIpv4DscpEcn_Choice)(nil), // 1704: otg.PatternFlowIpv4DscpEcn.Choice + (*PatternFlowIpv4TosPrecedence_Choice)(nil), // 1705: otg.PatternFlowIpv4TosPrecedence.Choice + (*PatternFlowIpv4TosDelay_Choice)(nil), // 1706: otg.PatternFlowIpv4TosDelay.Choice + (*PatternFlowIpv4TosThroughput_Choice)(nil), // 1707: otg.PatternFlowIpv4TosThroughput.Choice + (*PatternFlowIpv4TosReliability_Choice)(nil), // 1708: otg.PatternFlowIpv4TosReliability.Choice + (*PatternFlowIpv4TosMonetary_Choice)(nil), // 1709: otg.PatternFlowIpv4TosMonetary.Choice + (*PatternFlowIpv4TosUnused_Choice)(nil), // 1710: otg.PatternFlowIpv4TosUnused.Choice + (*PatternFlowIpv6Version_Choice)(nil), // 1711: otg.PatternFlowIpv6Version.Choice + (*PatternFlowIpv6TrafficClass_Choice)(nil), // 1712: otg.PatternFlowIpv6TrafficClass.Choice + (*PatternFlowIpv6FlowLabel_Choice)(nil), // 1713: otg.PatternFlowIpv6FlowLabel.Choice + (*PatternFlowIpv6PayloadLength_Choice)(nil), // 1714: otg.PatternFlowIpv6PayloadLength.Choice + (*PatternFlowIpv6NextHeader_Choice)(nil), // 1715: otg.PatternFlowIpv6NextHeader.Choice + (*PatternFlowIpv6HopLimit_Choice)(nil), // 1716: otg.PatternFlowIpv6HopLimit.Choice + (*PatternFlowIpv6Src_Choice)(nil), // 1717: otg.PatternFlowIpv6Src.Choice + (*PatternFlowIpv6Dst_Choice)(nil), // 1718: otg.PatternFlowIpv6Dst.Choice + (*PatternFlowPfcPauseDst_Choice)(nil), // 1719: otg.PatternFlowPfcPauseDst.Choice + (*PatternFlowPfcPauseSrc_Choice)(nil), // 1720: otg.PatternFlowPfcPauseSrc.Choice + (*PatternFlowPfcPauseEtherType_Choice)(nil), // 1721: otg.PatternFlowPfcPauseEtherType.Choice + (*PatternFlowPfcPauseControlOpCode_Choice)(nil), // 1722: otg.PatternFlowPfcPauseControlOpCode.Choice + (*PatternFlowPfcPauseClassEnableVector_Choice)(nil), // 1723: otg.PatternFlowPfcPauseClassEnableVector.Choice + (*PatternFlowPfcPausePauseClass0_Choice)(nil), // 1724: otg.PatternFlowPfcPausePauseClass0.Choice + (*PatternFlowPfcPausePauseClass1_Choice)(nil), // 1725: otg.PatternFlowPfcPausePauseClass1.Choice + (*PatternFlowPfcPausePauseClass2_Choice)(nil), // 1726: otg.PatternFlowPfcPausePauseClass2.Choice + (*PatternFlowPfcPausePauseClass3_Choice)(nil), // 1727: otg.PatternFlowPfcPausePauseClass3.Choice + (*PatternFlowPfcPausePauseClass4_Choice)(nil), // 1728: otg.PatternFlowPfcPausePauseClass4.Choice + (*PatternFlowPfcPausePauseClass5_Choice)(nil), // 1729: otg.PatternFlowPfcPausePauseClass5.Choice + (*PatternFlowPfcPausePauseClass6_Choice)(nil), // 1730: otg.PatternFlowPfcPausePauseClass6.Choice + (*PatternFlowPfcPausePauseClass7_Choice)(nil), // 1731: otg.PatternFlowPfcPausePauseClass7.Choice + (*PatternFlowEthernetPauseDst_Choice)(nil), // 1732: otg.PatternFlowEthernetPauseDst.Choice + (*PatternFlowEthernetPauseSrc_Choice)(nil), // 1733: otg.PatternFlowEthernetPauseSrc.Choice + (*PatternFlowEthernetPauseEtherType_Choice)(nil), // 1734: otg.PatternFlowEthernetPauseEtherType.Choice + (*PatternFlowEthernetPauseControlOpCode_Choice)(nil), // 1735: otg.PatternFlowEthernetPauseControlOpCode.Choice + (*PatternFlowEthernetPauseTime_Choice)(nil), // 1736: otg.PatternFlowEthernetPauseTime.Choice + (*PatternFlowTcpSrcPort_Choice)(nil), // 1737: otg.PatternFlowTcpSrcPort.Choice + (*PatternFlowTcpDstPort_Choice)(nil), // 1738: otg.PatternFlowTcpDstPort.Choice + (*PatternFlowTcpSeqNum_Choice)(nil), // 1739: otg.PatternFlowTcpSeqNum.Choice + (*PatternFlowTcpAckNum_Choice)(nil), // 1740: otg.PatternFlowTcpAckNum.Choice + (*PatternFlowTcpDataOffset_Choice)(nil), // 1741: otg.PatternFlowTcpDataOffset.Choice + (*PatternFlowTcpEcnNs_Choice)(nil), // 1742: otg.PatternFlowTcpEcnNs.Choice + (*PatternFlowTcpEcnCwr_Choice)(nil), // 1743: otg.PatternFlowTcpEcnCwr.Choice + (*PatternFlowTcpEcnEcho_Choice)(nil), // 1744: otg.PatternFlowTcpEcnEcho.Choice + (*PatternFlowTcpCtlUrg_Choice)(nil), // 1745: otg.PatternFlowTcpCtlUrg.Choice + (*PatternFlowTcpCtlAck_Choice)(nil), // 1746: otg.PatternFlowTcpCtlAck.Choice + (*PatternFlowTcpCtlPsh_Choice)(nil), // 1747: otg.PatternFlowTcpCtlPsh.Choice + (*PatternFlowTcpCtlRst_Choice)(nil), // 1748: otg.PatternFlowTcpCtlRst.Choice + (*PatternFlowTcpCtlSyn_Choice)(nil), // 1749: otg.PatternFlowTcpCtlSyn.Choice + (*PatternFlowTcpCtlFin_Choice)(nil), // 1750: otg.PatternFlowTcpCtlFin.Choice + (*PatternFlowTcpWindow_Choice)(nil), // 1751: otg.PatternFlowTcpWindow.Choice + (*PatternFlowTcpChecksum_Choice)(nil), // 1752: otg.PatternFlowTcpChecksum.Choice + (*PatternFlowTcpChecksum_Generated)(nil), // 1753: otg.PatternFlowTcpChecksum.Generated + (*PatternFlowUdpSrcPort_Choice)(nil), // 1754: otg.PatternFlowUdpSrcPort.Choice + (*PatternFlowUdpDstPort_Choice)(nil), // 1755: otg.PatternFlowUdpDstPort.Choice + (*PatternFlowUdpLength_Choice)(nil), // 1756: otg.PatternFlowUdpLength.Choice + (*PatternFlowUdpChecksum_Choice)(nil), // 1757: otg.PatternFlowUdpChecksum.Choice + (*PatternFlowUdpChecksum_Generated)(nil), // 1758: otg.PatternFlowUdpChecksum.Generated + (*PatternFlowGreChecksumPresent_Choice)(nil), // 1759: otg.PatternFlowGreChecksumPresent.Choice + (*PatternFlowGreReserved0_Choice)(nil), // 1760: otg.PatternFlowGreReserved0.Choice + (*PatternFlowGreVersion_Choice)(nil), // 1761: otg.PatternFlowGreVersion.Choice + (*PatternFlowGreProtocol_Choice)(nil), // 1762: otg.PatternFlowGreProtocol.Choice + (*PatternFlowGreChecksum_Choice)(nil), // 1763: otg.PatternFlowGreChecksum.Choice + (*PatternFlowGreChecksum_Generated)(nil), // 1764: otg.PatternFlowGreChecksum.Generated + (*PatternFlowGreReserved1_Choice)(nil), // 1765: otg.PatternFlowGreReserved1.Choice + (*PatternFlowGtpv1Version_Choice)(nil), // 1766: otg.PatternFlowGtpv1Version.Choice + (*PatternFlowGtpv1ProtocolType_Choice)(nil), // 1767: otg.PatternFlowGtpv1ProtocolType.Choice + (*PatternFlowGtpv1Reserved_Choice)(nil), // 1768: otg.PatternFlowGtpv1Reserved.Choice + (*PatternFlowGtpv1EFlag_Choice)(nil), // 1769: otg.PatternFlowGtpv1EFlag.Choice + (*PatternFlowGtpv1SFlag_Choice)(nil), // 1770: otg.PatternFlowGtpv1SFlag.Choice + (*PatternFlowGtpv1PnFlag_Choice)(nil), // 1771: otg.PatternFlowGtpv1PnFlag.Choice + (*PatternFlowGtpv1MessageType_Choice)(nil), // 1772: otg.PatternFlowGtpv1MessageType.Choice + (*PatternFlowGtpv1MessageLength_Choice)(nil), // 1773: otg.PatternFlowGtpv1MessageLength.Choice + (*PatternFlowGtpv1Teid_Choice)(nil), // 1774: otg.PatternFlowGtpv1Teid.Choice + (*PatternFlowGtpv1SquenceNumber_Choice)(nil), // 1775: otg.PatternFlowGtpv1SquenceNumber.Choice + (*PatternFlowGtpv1NPduNumber_Choice)(nil), // 1776: otg.PatternFlowGtpv1NPduNumber.Choice + (*PatternFlowGtpv1NextExtensionHeaderType_Choice)(nil), // 1777: otg.PatternFlowGtpv1NextExtensionHeaderType.Choice + (*PatternFlowGtpExtensionExtensionLength_Choice)(nil), // 1778: otg.PatternFlowGtpExtensionExtensionLength.Choice + (*PatternFlowGtpExtensionContents_Choice)(nil), // 1779: otg.PatternFlowGtpExtensionContents.Choice + (*PatternFlowGtpExtensionNextExtensionHeader_Choice)(nil), // 1780: otg.PatternFlowGtpExtensionNextExtensionHeader.Choice + (*PatternFlowGtpv2Version_Choice)(nil), // 1781: otg.PatternFlowGtpv2Version.Choice + (*PatternFlowGtpv2PiggybackingFlag_Choice)(nil), // 1782: otg.PatternFlowGtpv2PiggybackingFlag.Choice + (*PatternFlowGtpv2TeidFlag_Choice)(nil), // 1783: otg.PatternFlowGtpv2TeidFlag.Choice + (*PatternFlowGtpv2Spare1_Choice)(nil), // 1784: otg.PatternFlowGtpv2Spare1.Choice + (*PatternFlowGtpv2MessageType_Choice)(nil), // 1785: otg.PatternFlowGtpv2MessageType.Choice + (*PatternFlowGtpv2MessageLength_Choice)(nil), // 1786: otg.PatternFlowGtpv2MessageLength.Choice + (*PatternFlowGtpv2Teid_Choice)(nil), // 1787: otg.PatternFlowGtpv2Teid.Choice + (*PatternFlowGtpv2SequenceNumber_Choice)(nil), // 1788: otg.PatternFlowGtpv2SequenceNumber.Choice + (*PatternFlowGtpv2Spare2_Choice)(nil), // 1789: otg.PatternFlowGtpv2Spare2.Choice + (*PatternFlowArpHardwareType_Choice)(nil), // 1790: otg.PatternFlowArpHardwareType.Choice + (*PatternFlowArpProtocolType_Choice)(nil), // 1791: otg.PatternFlowArpProtocolType.Choice + (*PatternFlowArpHardwareLength_Choice)(nil), // 1792: otg.PatternFlowArpHardwareLength.Choice + (*PatternFlowArpProtocolLength_Choice)(nil), // 1793: otg.PatternFlowArpProtocolLength.Choice + (*PatternFlowArpOperation_Choice)(nil), // 1794: otg.PatternFlowArpOperation.Choice + (*PatternFlowArpSenderHardwareAddr_Choice)(nil), // 1795: otg.PatternFlowArpSenderHardwareAddr.Choice + (*PatternFlowArpSenderProtocolAddr_Choice)(nil), // 1796: otg.PatternFlowArpSenderProtocolAddr.Choice + (*PatternFlowArpTargetHardwareAddr_Choice)(nil), // 1797: otg.PatternFlowArpTargetHardwareAddr.Choice + (*PatternFlowArpTargetProtocolAddr_Choice)(nil), // 1798: otg.PatternFlowArpTargetProtocolAddr.Choice + (*PatternFlowIcmpEchoType_Choice)(nil), // 1799: otg.PatternFlowIcmpEchoType.Choice + (*PatternFlowIcmpEchoCode_Choice)(nil), // 1800: otg.PatternFlowIcmpEchoCode.Choice + (*PatternFlowIcmpEchoChecksum_Choice)(nil), // 1801: otg.PatternFlowIcmpEchoChecksum.Choice + (*PatternFlowIcmpEchoChecksum_Generated)(nil), // 1802: otg.PatternFlowIcmpEchoChecksum.Generated + (*PatternFlowIcmpEchoIdentifier_Choice)(nil), // 1803: otg.PatternFlowIcmpEchoIdentifier.Choice + (*PatternFlowIcmpEchoSequenceNumber_Choice)(nil), // 1804: otg.PatternFlowIcmpEchoSequenceNumber.Choice + (*PatternFlowIcmpCommonChecksum_Choice)(nil), // 1805: otg.PatternFlowIcmpCommonChecksum.Choice + (*PatternFlowIcmpCommonChecksum_Generated)(nil), // 1806: otg.PatternFlowIcmpCommonChecksum.Generated + (*PatternFlowIcmpNextFieldsIdentifier_Choice)(nil), // 1807: otg.PatternFlowIcmpNextFieldsIdentifier.Choice + (*PatternFlowIcmpNextFieldsSequenceNumber_Choice)(nil), // 1808: otg.PatternFlowIcmpNextFieldsSequenceNumber.Choice + (*PatternFlowIcmpv6EchoType_Choice)(nil), // 1809: otg.PatternFlowIcmpv6EchoType.Choice + (*PatternFlowIcmpv6EchoCode_Choice)(nil), // 1810: otg.PatternFlowIcmpv6EchoCode.Choice + (*PatternFlowIcmpv6EchoIdentifier_Choice)(nil), // 1811: otg.PatternFlowIcmpv6EchoIdentifier.Choice + (*PatternFlowIcmpv6EchoSequenceNumber_Choice)(nil), // 1812: otg.PatternFlowIcmpv6EchoSequenceNumber.Choice + (*PatternFlowIcmpv6EchoChecksum_Choice)(nil), // 1813: otg.PatternFlowIcmpv6EchoChecksum.Choice + (*PatternFlowIcmpv6EchoChecksum_Generated)(nil), // 1814: otg.PatternFlowIcmpv6EchoChecksum.Generated + (*PatternFlowIcmpv6CommonChecksum_Choice)(nil), // 1815: otg.PatternFlowIcmpv6CommonChecksum.Choice + (*PatternFlowIcmpv6CommonChecksum_Generated)(nil), // 1816: otg.PatternFlowIcmpv6CommonChecksum.Generated + (*PatternFlowPppAddress_Choice)(nil), // 1817: otg.PatternFlowPppAddress.Choice + (*PatternFlowPppControl_Choice)(nil), // 1818: otg.PatternFlowPppControl.Choice + (*PatternFlowPppProtocolType_Choice)(nil), // 1819: otg.PatternFlowPppProtocolType.Choice + (*PatternFlowIgmpv1Version_Choice)(nil), // 1820: otg.PatternFlowIgmpv1Version.Choice + (*PatternFlowIgmpv1Type_Choice)(nil), // 1821: otg.PatternFlowIgmpv1Type.Choice + (*PatternFlowIgmpv1Unused_Choice)(nil), // 1822: otg.PatternFlowIgmpv1Unused.Choice + (*PatternFlowIgmpv1Checksum_Choice)(nil), // 1823: otg.PatternFlowIgmpv1Checksum.Choice + (*PatternFlowIgmpv1Checksum_Generated)(nil), // 1824: otg.PatternFlowIgmpv1Checksum.Generated + (*PatternFlowIgmpv1GroupAddress_Choice)(nil), // 1825: otg.PatternFlowIgmpv1GroupAddress.Choice + (*PatternFlowMplsLabel_Choice)(nil), // 1826: otg.PatternFlowMplsLabel.Choice + (*PatternFlowMplsTrafficClass_Choice)(nil), // 1827: otg.PatternFlowMplsTrafficClass.Choice + (*PatternFlowMplsBottomOfStack_Choice)(nil), // 1828: otg.PatternFlowMplsBottomOfStack.Choice + (*PatternFlowMplsTimeToLive_Choice)(nil), // 1829: otg.PatternFlowMplsTimeToLive.Choice + (*PatternFlowSnmpv2CVersion_Choice)(nil), // 1830: otg.PatternFlowSnmpv2cVersion.Choice + (*PatternFlowSnmpv2CPDURequestId_Choice)(nil), // 1831: otg.PatternFlowSnmpv2cPDURequestId.Choice + (*PatternFlowSnmpv2CPDUErrorIndex_Choice)(nil), // 1832: otg.PatternFlowSnmpv2cPDUErrorIndex.Choice + (*PatternFlowSnmpv2CBulkPDURequestId_Choice)(nil), // 1833: otg.PatternFlowSnmpv2cBulkPDURequestId.Choice + (*PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice)(nil), // 1834: otg.PatternFlowSnmpv2cBulkPDUNonRepeaters.Choice + (*PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice)(nil), // 1835: otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions.Choice + (*PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice)(nil), // 1836: otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue.Choice + (*PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice)(nil), // 1837: otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue.Choice + (*PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice)(nil), // 1838: otg.PatternFlowSnmpv2cVariableBindingValueCounterValue.Choice + (*PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice)(nil), // 1839: otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue.Choice + (*PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice)(nil), // 1840: otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue.Choice + (*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice)(nil), // 1841: otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue.Choice + (*PatternFlowSnmpv2CCommonRequestId_Choice)(nil), // 1842: otg.PatternFlowSnmpv2cCommonRequestId.Choice + (*PatternFlowRsvpRsvpChecksum_Choice)(nil), // 1843: otg.PatternFlowRsvpRsvpChecksum.Choice + (*PatternFlowRsvpRsvpChecksum_Generated)(nil), // 1844: otg.PatternFlowRsvpRsvpChecksum.Generated + (*PatternFlowRsvpTimeToLive_Choice)(nil), // 1845: otg.PatternFlowRsvpTimeToLive.Choice + (*PatternFlowRsvpReserved_Choice)(nil), // 1846: otg.PatternFlowRsvpReserved.Choice + (*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice)(nil), // 1847: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.Choice + (*PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice)(nil), // 1848: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.Choice + (*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice)(nil), // 1849: otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.Choice + (*PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice)(nil), // 1850: otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger.Choice + (*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice)(nil), // 1851: otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.Choice + (*PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice)(nil), // 1852: otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.Choice + (*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice)(nil), // 1853: otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle.Choice + (*PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice)(nil), // 1854: otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR.Choice + (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice)(nil), // 1855: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.Choice + (*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice)(nil), // 1856: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.Choice + (*PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice)(nil), // 1857: otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.Choice + (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice)(nil), // 1858: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.Choice + (*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice)(nil), // 1859: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid.Choice + (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice)(nil), // 1860: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.Choice + (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice)(nil), // 1861: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.Choice + (*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice)(nil), // 1862: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.Choice + (*PatternFlowRSVPPathSenderTspecIntServVersion_Choice)(nil), // 1863: otg.PatternFlowRSVPPathSenderTspecIntServVersion.Choice + (*PatternFlowRSVPPathSenderTspecIntServReserved1_Choice)(nil), // 1864: otg.PatternFlowRSVPPathSenderTspecIntServReserved1.Choice + (*PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice)(nil), // 1865: otg.PatternFlowRSVPPathSenderTspecIntServOverallLength.Choice + (*PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice)(nil), // 1866: otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader.Choice + (*PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice)(nil), // 1867: otg.PatternFlowRSVPPathSenderTspecIntServZeroBit.Choice + (*PatternFlowRSVPPathSenderTspecIntServReserved2_Choice)(nil), // 1868: otg.PatternFlowRSVPPathSenderTspecIntServReserved2.Choice + (*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice)(nil), // 1869: otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.Choice + (*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice)(nil), // 1870: otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.Choice + (*PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice)(nil), // 1871: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag.Choice + (*PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice)(nil), // 1872: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length.Choice + (*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice)(nil), // 1873: otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit.Choice + (*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice)(nil), // 1874: otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize.Choice + (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice)(nil), // 1875: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.Choice + (*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice)(nil), // 1876: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.Choice + (*PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice)(nil), // 1877: otg.PatternFlowRSVPPathRecordRouteType1LabelFlags.Choice + (*PatternFlowRSVPPathRecordRouteType1LabelCType_Choice)(nil), // 1878: otg.PatternFlowRSVPPathRecordRouteType1LabelCType.Choice + (*PatternFlowRSVPPathObjectsCustomType_Choice)(nil), // 1879: otg.PatternFlowRSVPPathObjectsCustomType.Choice + (*emptypb.Empty)(nil), // 1880: google.protobuf.Empty } var file_otg_proto_depIdxs = []int32{ 428, // 0: otg.Config.ports:type_name -> otg.Port @@ -144474,143 +145249,143 @@ var file_otg_proto_depIdxs = []int32{ 973, // 495: otg.FlowIpv4.time_to_live:type_name -> otg.PatternFlowIpv4TimeToLive 976, // 496: otg.FlowIpv4.protocol:type_name -> otg.PatternFlowIpv4Protocol 977, // 497: otg.FlowIpv4.header_checksum:type_name -> otg.PatternFlowIpv4HeaderChecksum - 980, // 498: otg.FlowIpv4.src:type_name -> otg.PatternFlowIpv4Src - 983, // 499: otg.FlowIpv4.dst:type_name -> otg.PatternFlowIpv4Dst + 981, // 498: otg.FlowIpv4.src:type_name -> otg.PatternFlowIpv4Src + 985, // 499: otg.FlowIpv4.dst:type_name -> otg.PatternFlowIpv4Dst 661, // 500: otg.FlowIpv4.options:type_name -> otg.FlowIpv4Options 84, // 501: otg.FlowIpv4Options.choice:type_name -> otg.FlowIpv4Options.Choice.Enum 662, // 502: otg.FlowIpv4Options.custom:type_name -> otg.FlowIpv4OptionsCustom 663, // 503: otg.FlowIpv4OptionsCustom.type:type_name -> otg.FlowIpv4OptionsCustomType 664, // 504: otg.FlowIpv4OptionsCustom.length:type_name -> otg.FlowIpv4OptionsCustomLength - 985, // 505: otg.FlowIpv4OptionsCustomType.copied_flag:type_name -> otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag - 987, // 506: otg.FlowIpv4OptionsCustomType.option_class:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionClass - 989, // 507: otg.FlowIpv4OptionsCustomType.option_number:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionNumber + 987, // 505: otg.FlowIpv4OptionsCustomType.copied_flag:type_name -> otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag + 989, // 506: otg.FlowIpv4OptionsCustomType.option_class:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionClass + 991, // 507: otg.FlowIpv4OptionsCustomType.option_number:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionNumber 85, // 508: otg.FlowIpv4OptionsCustomLength.choice:type_name -> otg.FlowIpv4OptionsCustomLength.Choice.Enum 86, // 509: otg.FlowIpv4Priority.choice:type_name -> otg.FlowIpv4Priority.Choice.Enum - 992, // 510: otg.FlowIpv4Priority.raw:type_name -> otg.PatternFlowIpv4PriorityRaw + 994, // 510: otg.FlowIpv4Priority.raw:type_name -> otg.PatternFlowIpv4PriorityRaw 667, // 511: otg.FlowIpv4Priority.tos:type_name -> otg.FlowIpv4Tos 666, // 512: otg.FlowIpv4Priority.dscp:type_name -> otg.FlowIpv4Dscp - 995, // 513: otg.FlowIpv4Dscp.phb:type_name -> otg.PatternFlowIpv4DscpPhb - 998, // 514: otg.FlowIpv4Dscp.ecn:type_name -> otg.PatternFlowIpv4DscpEcn - 1001, // 515: otg.FlowIpv4Tos.precedence:type_name -> otg.PatternFlowIpv4TosPrecedence - 1004, // 516: otg.FlowIpv4Tos.delay:type_name -> otg.PatternFlowIpv4TosDelay - 1007, // 517: otg.FlowIpv4Tos.throughput:type_name -> otg.PatternFlowIpv4TosThroughput - 1010, // 518: otg.FlowIpv4Tos.reliability:type_name -> otg.PatternFlowIpv4TosReliability - 1013, // 519: otg.FlowIpv4Tos.monetary:type_name -> otg.PatternFlowIpv4TosMonetary - 1016, // 520: otg.FlowIpv4Tos.unused:type_name -> otg.PatternFlowIpv4TosUnused + 997, // 513: otg.FlowIpv4Dscp.phb:type_name -> otg.PatternFlowIpv4DscpPhb + 1000, // 514: otg.FlowIpv4Dscp.ecn:type_name -> otg.PatternFlowIpv4DscpEcn + 1003, // 515: otg.FlowIpv4Tos.precedence:type_name -> otg.PatternFlowIpv4TosPrecedence + 1006, // 516: otg.FlowIpv4Tos.delay:type_name -> otg.PatternFlowIpv4TosDelay + 1009, // 517: otg.FlowIpv4Tos.throughput:type_name -> otg.PatternFlowIpv4TosThroughput + 1012, // 518: otg.FlowIpv4Tos.reliability:type_name -> otg.PatternFlowIpv4TosReliability + 1015, // 519: otg.FlowIpv4Tos.monetary:type_name -> otg.PatternFlowIpv4TosMonetary + 1018, // 520: otg.FlowIpv4Tos.unused:type_name -> otg.PatternFlowIpv4TosUnused 87, // 521: otg.FlowIpv4Auto.choice:type_name -> otg.FlowIpv4Auto.Choice.Enum - 1019, // 522: otg.FlowIpv6.version:type_name -> otg.PatternFlowIpv6Version - 1022, // 523: otg.FlowIpv6.traffic_class:type_name -> otg.PatternFlowIpv6TrafficClass - 1025, // 524: otg.FlowIpv6.flow_label:type_name -> otg.PatternFlowIpv6FlowLabel - 1028, // 525: otg.FlowIpv6.payload_length:type_name -> otg.PatternFlowIpv6PayloadLength - 1031, // 526: otg.FlowIpv6.next_header:type_name -> otg.PatternFlowIpv6NextHeader - 1034, // 527: otg.FlowIpv6.hop_limit:type_name -> otg.PatternFlowIpv6HopLimit - 1037, // 528: otg.FlowIpv6.src:type_name -> otg.PatternFlowIpv6Src - 1040, // 529: otg.FlowIpv6.dst:type_name -> otg.PatternFlowIpv6Dst - 1043, // 530: otg.FlowPfcPause.dst:type_name -> otg.PatternFlowPfcPauseDst - 1046, // 531: otg.FlowPfcPause.src:type_name -> otg.PatternFlowPfcPauseSrc - 1049, // 532: otg.FlowPfcPause.ether_type:type_name -> otg.PatternFlowPfcPauseEtherType - 1052, // 533: otg.FlowPfcPause.control_op_code:type_name -> otg.PatternFlowPfcPauseControlOpCode - 1055, // 534: otg.FlowPfcPause.class_enable_vector:type_name -> otg.PatternFlowPfcPauseClassEnableVector - 1058, // 535: otg.FlowPfcPause.pause_class_0:type_name -> otg.PatternFlowPfcPausePauseClass0 - 1061, // 536: otg.FlowPfcPause.pause_class_1:type_name -> otg.PatternFlowPfcPausePauseClass1 - 1064, // 537: otg.FlowPfcPause.pause_class_2:type_name -> otg.PatternFlowPfcPausePauseClass2 - 1067, // 538: otg.FlowPfcPause.pause_class_3:type_name -> otg.PatternFlowPfcPausePauseClass3 - 1070, // 539: otg.FlowPfcPause.pause_class_4:type_name -> otg.PatternFlowPfcPausePauseClass4 - 1073, // 540: otg.FlowPfcPause.pause_class_5:type_name -> otg.PatternFlowPfcPausePauseClass5 - 1076, // 541: otg.FlowPfcPause.pause_class_6:type_name -> otg.PatternFlowPfcPausePauseClass6 - 1079, // 542: otg.FlowPfcPause.pause_class_7:type_name -> otg.PatternFlowPfcPausePauseClass7 - 1082, // 543: otg.FlowEthernetPause.dst:type_name -> otg.PatternFlowEthernetPauseDst - 1085, // 544: otg.FlowEthernetPause.src:type_name -> otg.PatternFlowEthernetPauseSrc - 1088, // 545: otg.FlowEthernetPause.ether_type:type_name -> otg.PatternFlowEthernetPauseEtherType - 1091, // 546: otg.FlowEthernetPause.control_op_code:type_name -> otg.PatternFlowEthernetPauseControlOpCode - 1094, // 547: otg.FlowEthernetPause.time:type_name -> otg.PatternFlowEthernetPauseTime - 1097, // 548: otg.FlowTcp.src_port:type_name -> otg.PatternFlowTcpSrcPort - 1100, // 549: otg.FlowTcp.dst_port:type_name -> otg.PatternFlowTcpDstPort - 1103, // 550: otg.FlowTcp.seq_num:type_name -> otg.PatternFlowTcpSeqNum - 1106, // 551: otg.FlowTcp.ack_num:type_name -> otg.PatternFlowTcpAckNum - 1109, // 552: otg.FlowTcp.data_offset:type_name -> otg.PatternFlowTcpDataOffset - 1112, // 553: otg.FlowTcp.ecn_ns:type_name -> otg.PatternFlowTcpEcnNs - 1115, // 554: otg.FlowTcp.ecn_cwr:type_name -> otg.PatternFlowTcpEcnCwr - 1118, // 555: otg.FlowTcp.ecn_echo:type_name -> otg.PatternFlowTcpEcnEcho - 1121, // 556: otg.FlowTcp.ctl_urg:type_name -> otg.PatternFlowTcpCtlUrg - 1124, // 557: otg.FlowTcp.ctl_ack:type_name -> otg.PatternFlowTcpCtlAck - 1127, // 558: otg.FlowTcp.ctl_psh:type_name -> otg.PatternFlowTcpCtlPsh - 1130, // 559: otg.FlowTcp.ctl_rst:type_name -> otg.PatternFlowTcpCtlRst - 1133, // 560: otg.FlowTcp.ctl_syn:type_name -> otg.PatternFlowTcpCtlSyn - 1136, // 561: otg.FlowTcp.ctl_fin:type_name -> otg.PatternFlowTcpCtlFin - 1139, // 562: otg.FlowTcp.window:type_name -> otg.PatternFlowTcpWindow - 1140, // 563: otg.FlowTcp.checksum:type_name -> otg.PatternFlowTcpChecksum - 1143, // 564: otg.FlowUdp.src_port:type_name -> otg.PatternFlowUdpSrcPort - 1146, // 565: otg.FlowUdp.dst_port:type_name -> otg.PatternFlowUdpDstPort - 1149, // 566: otg.FlowUdp.length:type_name -> otg.PatternFlowUdpLength - 1150, // 567: otg.FlowUdp.checksum:type_name -> otg.PatternFlowUdpChecksum - 1153, // 568: otg.FlowGre.checksum_present:type_name -> otg.PatternFlowGreChecksumPresent - 1156, // 569: otg.FlowGre.reserved0:type_name -> otg.PatternFlowGreReserved0 - 1159, // 570: otg.FlowGre.version:type_name -> otg.PatternFlowGreVersion - 1162, // 571: otg.FlowGre.protocol:type_name -> otg.PatternFlowGreProtocol - 1163, // 572: otg.FlowGre.checksum:type_name -> otg.PatternFlowGreChecksum - 1166, // 573: otg.FlowGre.reserved1:type_name -> otg.PatternFlowGreReserved1 - 1169, // 574: otg.FlowGtpv1.version:type_name -> otg.PatternFlowGtpv1Version - 1172, // 575: otg.FlowGtpv1.protocol_type:type_name -> otg.PatternFlowGtpv1ProtocolType - 1175, // 576: otg.FlowGtpv1.reserved:type_name -> otg.PatternFlowGtpv1Reserved - 1178, // 577: otg.FlowGtpv1.e_flag:type_name -> otg.PatternFlowGtpv1EFlag - 1181, // 578: otg.FlowGtpv1.s_flag:type_name -> otg.PatternFlowGtpv1SFlag - 1184, // 579: otg.FlowGtpv1.pn_flag:type_name -> otg.PatternFlowGtpv1PnFlag - 1187, // 580: otg.FlowGtpv1.message_type:type_name -> otg.PatternFlowGtpv1MessageType - 1190, // 581: otg.FlowGtpv1.message_length:type_name -> otg.PatternFlowGtpv1MessageLength - 1193, // 582: otg.FlowGtpv1.teid:type_name -> otg.PatternFlowGtpv1Teid - 1196, // 583: otg.FlowGtpv1.squence_number:type_name -> otg.PatternFlowGtpv1SquenceNumber - 1199, // 584: otg.FlowGtpv1.n_pdu_number:type_name -> otg.PatternFlowGtpv1NPduNumber - 1202, // 585: otg.FlowGtpv1.next_extension_header_type:type_name -> otg.PatternFlowGtpv1NextExtensionHeaderType + 1021, // 522: otg.FlowIpv6.version:type_name -> otg.PatternFlowIpv6Version + 1024, // 523: otg.FlowIpv6.traffic_class:type_name -> otg.PatternFlowIpv6TrafficClass + 1028, // 524: otg.FlowIpv6.flow_label:type_name -> otg.PatternFlowIpv6FlowLabel + 1031, // 525: otg.FlowIpv6.payload_length:type_name -> otg.PatternFlowIpv6PayloadLength + 1034, // 526: otg.FlowIpv6.next_header:type_name -> otg.PatternFlowIpv6NextHeader + 1037, // 527: otg.FlowIpv6.hop_limit:type_name -> otg.PatternFlowIpv6HopLimit + 1040, // 528: otg.FlowIpv6.src:type_name -> otg.PatternFlowIpv6Src + 1043, // 529: otg.FlowIpv6.dst:type_name -> otg.PatternFlowIpv6Dst + 1046, // 530: otg.FlowPfcPause.dst:type_name -> otg.PatternFlowPfcPauseDst + 1049, // 531: otg.FlowPfcPause.src:type_name -> otg.PatternFlowPfcPauseSrc + 1052, // 532: otg.FlowPfcPause.ether_type:type_name -> otg.PatternFlowPfcPauseEtherType + 1055, // 533: otg.FlowPfcPause.control_op_code:type_name -> otg.PatternFlowPfcPauseControlOpCode + 1058, // 534: otg.FlowPfcPause.class_enable_vector:type_name -> otg.PatternFlowPfcPauseClassEnableVector + 1061, // 535: otg.FlowPfcPause.pause_class_0:type_name -> otg.PatternFlowPfcPausePauseClass0 + 1064, // 536: otg.FlowPfcPause.pause_class_1:type_name -> otg.PatternFlowPfcPausePauseClass1 + 1067, // 537: otg.FlowPfcPause.pause_class_2:type_name -> otg.PatternFlowPfcPausePauseClass2 + 1070, // 538: otg.FlowPfcPause.pause_class_3:type_name -> otg.PatternFlowPfcPausePauseClass3 + 1073, // 539: otg.FlowPfcPause.pause_class_4:type_name -> otg.PatternFlowPfcPausePauseClass4 + 1076, // 540: otg.FlowPfcPause.pause_class_5:type_name -> otg.PatternFlowPfcPausePauseClass5 + 1079, // 541: otg.FlowPfcPause.pause_class_6:type_name -> otg.PatternFlowPfcPausePauseClass6 + 1082, // 542: otg.FlowPfcPause.pause_class_7:type_name -> otg.PatternFlowPfcPausePauseClass7 + 1085, // 543: otg.FlowEthernetPause.dst:type_name -> otg.PatternFlowEthernetPauseDst + 1088, // 544: otg.FlowEthernetPause.src:type_name -> otg.PatternFlowEthernetPauseSrc + 1091, // 545: otg.FlowEthernetPause.ether_type:type_name -> otg.PatternFlowEthernetPauseEtherType + 1094, // 546: otg.FlowEthernetPause.control_op_code:type_name -> otg.PatternFlowEthernetPauseControlOpCode + 1097, // 547: otg.FlowEthernetPause.time:type_name -> otg.PatternFlowEthernetPauseTime + 1101, // 548: otg.FlowTcp.src_port:type_name -> otg.PatternFlowTcpSrcPort + 1105, // 549: otg.FlowTcp.dst_port:type_name -> otg.PatternFlowTcpDstPort + 1108, // 550: otg.FlowTcp.seq_num:type_name -> otg.PatternFlowTcpSeqNum + 1111, // 551: otg.FlowTcp.ack_num:type_name -> otg.PatternFlowTcpAckNum + 1114, // 552: otg.FlowTcp.data_offset:type_name -> otg.PatternFlowTcpDataOffset + 1117, // 553: otg.FlowTcp.ecn_ns:type_name -> otg.PatternFlowTcpEcnNs + 1120, // 554: otg.FlowTcp.ecn_cwr:type_name -> otg.PatternFlowTcpEcnCwr + 1123, // 555: otg.FlowTcp.ecn_echo:type_name -> otg.PatternFlowTcpEcnEcho + 1126, // 556: otg.FlowTcp.ctl_urg:type_name -> otg.PatternFlowTcpCtlUrg + 1129, // 557: otg.FlowTcp.ctl_ack:type_name -> otg.PatternFlowTcpCtlAck + 1132, // 558: otg.FlowTcp.ctl_psh:type_name -> otg.PatternFlowTcpCtlPsh + 1135, // 559: otg.FlowTcp.ctl_rst:type_name -> otg.PatternFlowTcpCtlRst + 1138, // 560: otg.FlowTcp.ctl_syn:type_name -> otg.PatternFlowTcpCtlSyn + 1141, // 561: otg.FlowTcp.ctl_fin:type_name -> otg.PatternFlowTcpCtlFin + 1144, // 562: otg.FlowTcp.window:type_name -> otg.PatternFlowTcpWindow + 1145, // 563: otg.FlowTcp.checksum:type_name -> otg.PatternFlowTcpChecksum + 1149, // 564: otg.FlowUdp.src_port:type_name -> otg.PatternFlowUdpSrcPort + 1153, // 565: otg.FlowUdp.dst_port:type_name -> otg.PatternFlowUdpDstPort + 1156, // 566: otg.FlowUdp.length:type_name -> otg.PatternFlowUdpLength + 1157, // 567: otg.FlowUdp.checksum:type_name -> otg.PatternFlowUdpChecksum + 1160, // 568: otg.FlowGre.checksum_present:type_name -> otg.PatternFlowGreChecksumPresent + 1163, // 569: otg.FlowGre.reserved0:type_name -> otg.PatternFlowGreReserved0 + 1166, // 570: otg.FlowGre.version:type_name -> otg.PatternFlowGreVersion + 1169, // 571: otg.FlowGre.protocol:type_name -> otg.PatternFlowGreProtocol + 1170, // 572: otg.FlowGre.checksum:type_name -> otg.PatternFlowGreChecksum + 1173, // 573: otg.FlowGre.reserved1:type_name -> otg.PatternFlowGreReserved1 + 1176, // 574: otg.FlowGtpv1.version:type_name -> otg.PatternFlowGtpv1Version + 1179, // 575: otg.FlowGtpv1.protocol_type:type_name -> otg.PatternFlowGtpv1ProtocolType + 1182, // 576: otg.FlowGtpv1.reserved:type_name -> otg.PatternFlowGtpv1Reserved + 1185, // 577: otg.FlowGtpv1.e_flag:type_name -> otg.PatternFlowGtpv1EFlag + 1188, // 578: otg.FlowGtpv1.s_flag:type_name -> otg.PatternFlowGtpv1SFlag + 1191, // 579: otg.FlowGtpv1.pn_flag:type_name -> otg.PatternFlowGtpv1PnFlag + 1194, // 580: otg.FlowGtpv1.message_type:type_name -> otg.PatternFlowGtpv1MessageType + 1197, // 581: otg.FlowGtpv1.message_length:type_name -> otg.PatternFlowGtpv1MessageLength + 1200, // 582: otg.FlowGtpv1.teid:type_name -> otg.PatternFlowGtpv1Teid + 1203, // 583: otg.FlowGtpv1.squence_number:type_name -> otg.PatternFlowGtpv1SquenceNumber + 1206, // 584: otg.FlowGtpv1.n_pdu_number:type_name -> otg.PatternFlowGtpv1NPduNumber + 1209, // 585: otg.FlowGtpv1.next_extension_header_type:type_name -> otg.PatternFlowGtpv1NextExtensionHeaderType 676, // 586: otg.FlowGtpv1.extension_headers:type_name -> otg.FlowGtpExtension - 1205, // 587: otg.FlowGtpExtension.extension_length:type_name -> otg.PatternFlowGtpExtensionExtensionLength - 1208, // 588: otg.FlowGtpExtension.contents:type_name -> otg.PatternFlowGtpExtensionContents - 1211, // 589: otg.FlowGtpExtension.next_extension_header:type_name -> otg.PatternFlowGtpExtensionNextExtensionHeader - 1214, // 590: otg.FlowGtpv2.version:type_name -> otg.PatternFlowGtpv2Version - 1217, // 591: otg.FlowGtpv2.piggybacking_flag:type_name -> otg.PatternFlowGtpv2PiggybackingFlag - 1220, // 592: otg.FlowGtpv2.teid_flag:type_name -> otg.PatternFlowGtpv2TeidFlag - 1223, // 593: otg.FlowGtpv2.spare1:type_name -> otg.PatternFlowGtpv2Spare1 - 1226, // 594: otg.FlowGtpv2.message_type:type_name -> otg.PatternFlowGtpv2MessageType - 1229, // 595: otg.FlowGtpv2.message_length:type_name -> otg.PatternFlowGtpv2MessageLength - 1232, // 596: otg.FlowGtpv2.teid:type_name -> otg.PatternFlowGtpv2Teid - 1235, // 597: otg.FlowGtpv2.sequence_number:type_name -> otg.PatternFlowGtpv2SequenceNumber - 1238, // 598: otg.FlowGtpv2.spare2:type_name -> otg.PatternFlowGtpv2Spare2 - 1241, // 599: otg.FlowArp.hardware_type:type_name -> otg.PatternFlowArpHardwareType - 1244, // 600: otg.FlowArp.protocol_type:type_name -> otg.PatternFlowArpProtocolType - 1247, // 601: otg.FlowArp.hardware_length:type_name -> otg.PatternFlowArpHardwareLength - 1250, // 602: otg.FlowArp.protocol_length:type_name -> otg.PatternFlowArpProtocolLength - 1253, // 603: otg.FlowArp.operation:type_name -> otg.PatternFlowArpOperation - 1256, // 604: otg.FlowArp.sender_hardware_addr:type_name -> otg.PatternFlowArpSenderHardwareAddr - 1259, // 605: otg.FlowArp.sender_protocol_addr:type_name -> otg.PatternFlowArpSenderProtocolAddr - 1262, // 606: otg.FlowArp.target_hardware_addr:type_name -> otg.PatternFlowArpTargetHardwareAddr - 1265, // 607: otg.FlowArp.target_protocol_addr:type_name -> otg.PatternFlowArpTargetProtocolAddr + 1212, // 587: otg.FlowGtpExtension.extension_length:type_name -> otg.PatternFlowGtpExtensionExtensionLength + 1215, // 588: otg.FlowGtpExtension.contents:type_name -> otg.PatternFlowGtpExtensionContents + 1218, // 589: otg.FlowGtpExtension.next_extension_header:type_name -> otg.PatternFlowGtpExtensionNextExtensionHeader + 1221, // 590: otg.FlowGtpv2.version:type_name -> otg.PatternFlowGtpv2Version + 1224, // 591: otg.FlowGtpv2.piggybacking_flag:type_name -> otg.PatternFlowGtpv2PiggybackingFlag + 1227, // 592: otg.FlowGtpv2.teid_flag:type_name -> otg.PatternFlowGtpv2TeidFlag + 1230, // 593: otg.FlowGtpv2.spare1:type_name -> otg.PatternFlowGtpv2Spare1 + 1233, // 594: otg.FlowGtpv2.message_type:type_name -> otg.PatternFlowGtpv2MessageType + 1236, // 595: otg.FlowGtpv2.message_length:type_name -> otg.PatternFlowGtpv2MessageLength + 1239, // 596: otg.FlowGtpv2.teid:type_name -> otg.PatternFlowGtpv2Teid + 1242, // 597: otg.FlowGtpv2.sequence_number:type_name -> otg.PatternFlowGtpv2SequenceNumber + 1245, // 598: otg.FlowGtpv2.spare2:type_name -> otg.PatternFlowGtpv2Spare2 + 1248, // 599: otg.FlowArp.hardware_type:type_name -> otg.PatternFlowArpHardwareType + 1251, // 600: otg.FlowArp.protocol_type:type_name -> otg.PatternFlowArpProtocolType + 1254, // 601: otg.FlowArp.hardware_length:type_name -> otg.PatternFlowArpHardwareLength + 1257, // 602: otg.FlowArp.protocol_length:type_name -> otg.PatternFlowArpProtocolLength + 1260, // 603: otg.FlowArp.operation:type_name -> otg.PatternFlowArpOperation + 1263, // 604: otg.FlowArp.sender_hardware_addr:type_name -> otg.PatternFlowArpSenderHardwareAddr + 1266, // 605: otg.FlowArp.sender_protocol_addr:type_name -> otg.PatternFlowArpSenderProtocolAddr + 1269, // 606: otg.FlowArp.target_hardware_addr:type_name -> otg.PatternFlowArpTargetHardwareAddr + 1272, // 607: otg.FlowArp.target_protocol_addr:type_name -> otg.PatternFlowArpTargetProtocolAddr 88, // 608: otg.FlowIcmp.choice:type_name -> otg.FlowIcmp.Choice.Enum 680, // 609: otg.FlowIcmp.echo:type_name -> otg.FlowIcmpEcho - 1268, // 610: otg.FlowIcmpEcho.type:type_name -> otg.PatternFlowIcmpEchoType - 1271, // 611: otg.FlowIcmpEcho.code:type_name -> otg.PatternFlowIcmpEchoCode - 1272, // 612: otg.FlowIcmpEcho.checksum:type_name -> otg.PatternFlowIcmpEchoChecksum - 1275, // 613: otg.FlowIcmpEcho.identifier:type_name -> otg.PatternFlowIcmpEchoIdentifier - 1278, // 614: otg.FlowIcmpEcho.sequence_number:type_name -> otg.PatternFlowIcmpEchoSequenceNumber + 1275, // 610: otg.FlowIcmpEcho.type:type_name -> otg.PatternFlowIcmpEchoType + 1278, // 611: otg.FlowIcmpEcho.code:type_name -> otg.PatternFlowIcmpEchoCode + 1279, // 612: otg.FlowIcmpEcho.checksum:type_name -> otg.PatternFlowIcmpEchoChecksum + 1282, // 613: otg.FlowIcmpEcho.identifier:type_name -> otg.PatternFlowIcmpEchoIdentifier + 1285, // 614: otg.FlowIcmpEcho.sequence_number:type_name -> otg.PatternFlowIcmpEchoSequenceNumber 89, // 615: otg.FlowIcmpv6.choice:type_name -> otg.FlowIcmpv6.Choice.Enum 682, // 616: otg.FlowIcmpv6.echo:type_name -> otg.FlowIcmpv6Echo - 1288, // 617: otg.FlowIcmpv6Echo.type:type_name -> otg.PatternFlowIcmpv6EchoType - 1291, // 618: otg.FlowIcmpv6Echo.code:type_name -> otg.PatternFlowIcmpv6EchoCode - 1294, // 619: otg.FlowIcmpv6Echo.identifier:type_name -> otg.PatternFlowIcmpv6EchoIdentifier - 1297, // 620: otg.FlowIcmpv6Echo.sequence_number:type_name -> otg.PatternFlowIcmpv6EchoSequenceNumber - 1298, // 621: otg.FlowIcmpv6Echo.checksum:type_name -> otg.PatternFlowIcmpv6EchoChecksum - 1302, // 622: otg.FlowPpp.address:type_name -> otg.PatternFlowPppAddress - 1305, // 623: otg.FlowPpp.control:type_name -> otg.PatternFlowPppControl - 1308, // 624: otg.FlowPpp.protocol_type:type_name -> otg.PatternFlowPppProtocolType - 1311, // 625: otg.FlowIgmpv1.version:type_name -> otg.PatternFlowIgmpv1Version - 1314, // 626: otg.FlowIgmpv1.type:type_name -> otg.PatternFlowIgmpv1Type - 1317, // 627: otg.FlowIgmpv1.unused:type_name -> otg.PatternFlowIgmpv1Unused - 1318, // 628: otg.FlowIgmpv1.checksum:type_name -> otg.PatternFlowIgmpv1Checksum - 1321, // 629: otg.FlowIgmpv1.group_address:type_name -> otg.PatternFlowIgmpv1GroupAddress - 1324, // 630: otg.FlowMpls.label:type_name -> otg.PatternFlowMplsLabel - 1327, // 631: otg.FlowMpls.traffic_class:type_name -> otg.PatternFlowMplsTrafficClass - 1330, // 632: otg.FlowMpls.bottom_of_stack:type_name -> otg.PatternFlowMplsBottomOfStack - 1333, // 633: otg.FlowMpls.time_to_live:type_name -> otg.PatternFlowMplsTimeToLive - 1335, // 634: otg.FlowSnmpv2c.version:type_name -> otg.PatternFlowSnmpv2cVersion + 1295, // 617: otg.FlowIcmpv6Echo.type:type_name -> otg.PatternFlowIcmpv6EchoType + 1298, // 618: otg.FlowIcmpv6Echo.code:type_name -> otg.PatternFlowIcmpv6EchoCode + 1301, // 619: otg.FlowIcmpv6Echo.identifier:type_name -> otg.PatternFlowIcmpv6EchoIdentifier + 1304, // 620: otg.FlowIcmpv6Echo.sequence_number:type_name -> otg.PatternFlowIcmpv6EchoSequenceNumber + 1305, // 621: otg.FlowIcmpv6Echo.checksum:type_name -> otg.PatternFlowIcmpv6EchoChecksum + 1309, // 622: otg.FlowPpp.address:type_name -> otg.PatternFlowPppAddress + 1312, // 623: otg.FlowPpp.control:type_name -> otg.PatternFlowPppControl + 1315, // 624: otg.FlowPpp.protocol_type:type_name -> otg.PatternFlowPppProtocolType + 1318, // 625: otg.FlowIgmpv1.version:type_name -> otg.PatternFlowIgmpv1Version + 1321, // 626: otg.FlowIgmpv1.type:type_name -> otg.PatternFlowIgmpv1Type + 1324, // 627: otg.FlowIgmpv1.unused:type_name -> otg.PatternFlowIgmpv1Unused + 1325, // 628: otg.FlowIgmpv1.checksum:type_name -> otg.PatternFlowIgmpv1Checksum + 1328, // 629: otg.FlowIgmpv1.group_address:type_name -> otg.PatternFlowIgmpv1GroupAddress + 1331, // 630: otg.FlowMpls.label:type_name -> otg.PatternFlowMplsLabel + 1334, // 631: otg.FlowMpls.traffic_class:type_name -> otg.PatternFlowMplsTrafficClass + 1337, // 632: otg.FlowMpls.bottom_of_stack:type_name -> otg.PatternFlowMplsBottomOfStack + 1340, // 633: otg.FlowMpls.time_to_live:type_name -> otg.PatternFlowMplsTimeToLive + 1342, // 634: otg.FlowSnmpv2c.version:type_name -> otg.PatternFlowSnmpv2cVersion 687, // 635: otg.FlowSnmpv2c.data:type_name -> otg.FlowSnmpv2cData 90, // 636: otg.FlowSnmpv2cData.choice:type_name -> otg.FlowSnmpv2cData.Choice.Enum 688, // 637: otg.FlowSnmpv2cData.get_request:type_name -> otg.FlowSnmpv2cPDU @@ -144621,28 +145396,28 @@ var file_otg_proto_depIdxs = []int32{ 688, // 642: otg.FlowSnmpv2cData.inform_request:type_name -> otg.FlowSnmpv2cPDU 688, // 643: otg.FlowSnmpv2cData.snmpv2_trap:type_name -> otg.FlowSnmpv2cPDU 688, // 644: otg.FlowSnmpv2cData.report:type_name -> otg.FlowSnmpv2cPDU - 1337, // 645: otg.FlowSnmpv2cPDU.request_id:type_name -> otg.PatternFlowSnmpv2cPDURequestId + 1344, // 645: otg.FlowSnmpv2cPDU.request_id:type_name -> otg.PatternFlowSnmpv2cPDURequestId 91, // 646: otg.FlowSnmpv2cPDU.error_status:type_name -> otg.FlowSnmpv2cPDU.ErrorStatus.Enum - 1339, // 647: otg.FlowSnmpv2cPDU.error_index:type_name -> otg.PatternFlowSnmpv2cPDUErrorIndex + 1346, // 647: otg.FlowSnmpv2cPDU.error_index:type_name -> otg.PatternFlowSnmpv2cPDUErrorIndex 690, // 648: otg.FlowSnmpv2cPDU.variable_bindings:type_name -> otg.FlowSnmpv2cVariableBinding - 1341, // 649: otg.FlowSnmpv2cBulkPDU.request_id:type_name -> otg.PatternFlowSnmpv2cBulkPDURequestId - 1342, // 650: otg.FlowSnmpv2cBulkPDU.non_repeaters:type_name -> otg.PatternFlowSnmpv2cBulkPDUNonRepeaters - 1344, // 651: otg.FlowSnmpv2cBulkPDU.max_repetitions:type_name -> otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions + 1348, // 649: otg.FlowSnmpv2cBulkPDU.request_id:type_name -> otg.PatternFlowSnmpv2cBulkPDURequestId + 1349, // 650: otg.FlowSnmpv2cBulkPDU.non_repeaters:type_name -> otg.PatternFlowSnmpv2cBulkPDUNonRepeaters + 1351, // 651: otg.FlowSnmpv2cBulkPDU.max_repetitions:type_name -> otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions 690, // 652: otg.FlowSnmpv2cBulkPDU.variable_bindings:type_name -> otg.FlowSnmpv2cVariableBinding 691, // 653: otg.FlowSnmpv2cVariableBinding.value:type_name -> otg.FlowSnmpv2cVariableBindingValue 92, // 654: otg.FlowSnmpv2cVariableBindingValue.choice:type_name -> otg.FlowSnmpv2cVariableBindingValue.Choice.Enum - 1346, // 655: otg.FlowSnmpv2cVariableBindingValue.integer_value:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue + 1353, // 655: otg.FlowSnmpv2cVariableBindingValue.integer_value:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue 692, // 656: otg.FlowSnmpv2cVariableBindingValue.string_value:type_name -> otg.FlowSnmpv2cVariableBindingStringValue - 1348, // 657: otg.FlowSnmpv2cVariableBindingValue.ip_address_value:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue - 1350, // 658: otg.FlowSnmpv2cVariableBindingValue.counter_value:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueCounterValue - 1352, // 659: otg.FlowSnmpv2cVariableBindingValue.timeticks_value:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue - 1354, // 660: otg.FlowSnmpv2cVariableBindingValue.big_counter_value:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue - 1356, // 661: otg.FlowSnmpv2cVariableBindingValue.unsigned_integer_value:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue + 1355, // 657: otg.FlowSnmpv2cVariableBindingValue.ip_address_value:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue + 1357, // 658: otg.FlowSnmpv2cVariableBindingValue.counter_value:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueCounterValue + 1359, // 659: otg.FlowSnmpv2cVariableBindingValue.timeticks_value:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue + 1361, // 660: otg.FlowSnmpv2cVariableBindingValue.big_counter_value:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue + 1363, // 661: otg.FlowSnmpv2cVariableBindingValue.unsigned_integer_value:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue 93, // 662: otg.FlowSnmpv2cVariableBindingStringValue.choice:type_name -> otg.FlowSnmpv2cVariableBindingStringValue.Choice.Enum 94, // 663: otg.FlowRsvp.flag:type_name -> otg.FlowRsvp.Flag.Enum - 1359, // 664: otg.FlowRsvp.rsvp_checksum:type_name -> otg.PatternFlowRsvpRsvpChecksum - 1361, // 665: otg.FlowRsvp.time_to_live:type_name -> otg.PatternFlowRsvpTimeToLive - 1363, // 666: otg.FlowRsvp.reserved:type_name -> otg.PatternFlowRsvpReserved + 1366, // 664: otg.FlowRsvp.rsvp_checksum:type_name -> otg.PatternFlowRsvpRsvpChecksum + 1368, // 665: otg.FlowRsvp.time_to_live:type_name -> otg.PatternFlowRsvpTimeToLive + 1370, // 666: otg.FlowRsvp.reserved:type_name -> otg.PatternFlowRsvpReserved 694, // 667: otg.FlowRsvp.rsvp_length:type_name -> otg.FlowRSVPLength 695, // 668: otg.FlowRsvp.message_type:type_name -> otg.FlowRSVPMessage 95, // 669: otg.FlowRSVPLength.choice:type_name -> otg.FlowRSVPLength.Choice.Enum @@ -144666,24 +145441,24 @@ var file_otg_proto_depIdxs = []int32{ 701, // 687: otg.FlowRSVPPathObjectsClassSession.c_type:type_name -> otg.FlowRSVPPathObjectsSessionCType 99, // 688: otg.FlowRSVPPathObjectsSessionCType.choice:type_name -> otg.FlowRSVPPathObjectsSessionCType.Choice.Enum 702, // 689: otg.FlowRSVPPathObjectsSessionCType.lsp_tunnel_ipv4:type_name -> otg.FlowRSVPPathSessionLspTunnelIpv4 - 1365, // 690: otg.FlowRSVPPathSessionLspTunnelIpv4.ipv4_tunnel_end_point_address:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - 1367, // 691: otg.FlowRSVPPathSessionLspTunnelIpv4.reserved:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - 1369, // 692: otg.FlowRSVPPathSessionLspTunnelIpv4.tunnel_id:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + 1372, // 690: otg.FlowRSVPPathSessionLspTunnelIpv4.ipv4_tunnel_end_point_address:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + 1374, // 691: otg.FlowRSVPPathSessionLspTunnelIpv4.reserved:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + 1376, // 692: otg.FlowRSVPPathSessionLspTunnelIpv4.tunnel_id:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId 703, // 693: otg.FlowRSVPPathSessionLspTunnelIpv4.extended_tunnel_id:type_name -> otg.FlowRSVPPathSessionExtTunnelId 100, // 694: otg.FlowRSVPPathSessionExtTunnelId.choice:type_name -> otg.FlowRSVPPathSessionExtTunnelId.Choice.Enum - 1371, // 695: otg.FlowRSVPPathSessionExtTunnelId.as_integer:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger - 1373, // 696: otg.FlowRSVPPathSessionExtTunnelId.as_ipv4:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + 1378, // 695: otg.FlowRSVPPathSessionExtTunnelId.as_integer:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger + 1380, // 696: otg.FlowRSVPPathSessionExtTunnelId.as_ipv4:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 698, // 697: otg.FlowRSVPPathObjectsClassRsvpHop.length:type_name -> otg.FlowRSVPObjectLength 705, // 698: otg.FlowRSVPPathObjectsClassRsvpHop.c_type:type_name -> otg.FlowRSVPPathObjectsRsvpHopCType 101, // 699: otg.FlowRSVPPathObjectsRsvpHopCType.choice:type_name -> otg.FlowRSVPPathObjectsRsvpHopCType.Choice.Enum 706, // 700: otg.FlowRSVPPathObjectsRsvpHopCType.ipv4:type_name -> otg.FlowRSVPPathRsvpHopIpv4 - 1375, // 701: otg.FlowRSVPPathRsvpHopIpv4.ipv4_address:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - 1377, // 702: otg.FlowRSVPPathRsvpHopIpv4.logical_interface_handle:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + 1382, // 701: otg.FlowRSVPPathRsvpHopIpv4.ipv4_address:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + 1384, // 702: otg.FlowRSVPPathRsvpHopIpv4.logical_interface_handle:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle 698, // 703: otg.FlowRSVPPathObjectsClassTimeValues.length:type_name -> otg.FlowRSVPObjectLength 708, // 704: otg.FlowRSVPPathObjectsClassTimeValues.c_type:type_name -> otg.FlowRSVPPathObjectsTimeValuesCType 102, // 705: otg.FlowRSVPPathObjectsTimeValuesCType.choice:type_name -> otg.FlowRSVPPathObjectsTimeValuesCType.Choice.Enum 709, // 706: otg.FlowRSVPPathObjectsTimeValuesCType.type_1:type_name -> otg.FlowRSVPPathTimeValuesType1 - 1379, // 707: otg.FlowRSVPPathTimeValuesType1.refresh_period_r:type_name -> otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + 1386, // 707: otg.FlowRSVPPathTimeValuesType1.refresh_period_r:type_name -> otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR 698, // 708: otg.FlowRSVPPathObjectsClassExplicitRoute.length:type_name -> otg.FlowRSVPObjectLength 711, // 709: otg.FlowRSVPPathObjectsClassExplicitRoute.c_type:type_name -> otg.FlowRSVPPathObjectsClassExplicitRouteCType 103, // 710: otg.FlowRSVPPathObjectsClassExplicitRouteCType.choice:type_name -> otg.FlowRSVPPathObjectsClassExplicitRouteCType.Choice.Enum @@ -144693,10 +145468,10 @@ var file_otg_proto_depIdxs = []int32{ 104, // 714: otg.FlowRSVPType1ExplicitRouteSubobjectsType.choice:type_name -> otg.FlowRSVPType1ExplicitRouteSubobjectsType.Choice.Enum 715, // 715: otg.FlowRSVPType1ExplicitRouteSubobjectsType.ipv4_prefix:type_name -> otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix 716, // 716: otg.FlowRSVPType1ExplicitRouteSubobjectsType.as_number:type_name -> otg.FlowRSVPPathExplicitRouteType1ASNumber - 1381, // 717: otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix.l_bit:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + 1388, // 717: otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix.l_bit:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit 717, // 718: otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix.length:type_name -> otg.FlowRSVPExplicitRouteLength - 1383, // 719: otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix.ipv4_address:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - 1385, // 720: otg.FlowRSVPPathExplicitRouteType1ASNumber.l_bit:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + 1390, // 719: otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix.ipv4_address:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + 1392, // 720: otg.FlowRSVPPathExplicitRouteType1ASNumber.l_bit:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit 718, // 721: otg.FlowRSVPPathExplicitRouteType1ASNumber.length:type_name -> otg.FlowRSVPExplicitRouteASNumberLength 105, // 722: otg.FlowRSVPExplicitRouteLength.choice:type_name -> otg.FlowRSVPExplicitRouteLength.Choice.Enum 106, // 723: otg.FlowRSVPExplicitRouteASNumberLength.choice:type_name -> otg.FlowRSVPExplicitRouteASNumberLength.Choice.Enum @@ -144704,8 +145479,8 @@ var file_otg_proto_depIdxs = []int32{ 720, // 725: otg.FlowRSVPPathObjectsClassLabelRequest.c_type:type_name -> otg.FlowRSVPPathObjectsLabelRequestCType 107, // 726: otg.FlowRSVPPathObjectsLabelRequestCType.choice:type_name -> otg.FlowRSVPPathObjectsLabelRequestCType.Choice.Enum 721, // 727: otg.FlowRSVPPathObjectsLabelRequestCType.without_label_range:type_name -> otg.FlowRSVPPathLabelRequestWithoutLabelRange - 1387, // 728: otg.FlowRSVPPathLabelRequestWithoutLabelRange.reserved:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - 1389, // 729: otg.FlowRSVPPathLabelRequestWithoutLabelRange.l3pid:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid + 1394, // 728: otg.FlowRSVPPathLabelRequestWithoutLabelRange.reserved:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + 1396, // 729: otg.FlowRSVPPathLabelRequestWithoutLabelRange.l3pid:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid 698, // 730: otg.FlowRSVPPathObjectsClassSessionAttribute.length:type_name -> otg.FlowRSVPObjectLength 723, // 731: otg.FlowRSVPPathObjectsClassSessionAttribute.c_type:type_name -> otg.FlowRSVPPathObjectsSessionAttributeCType 108, // 732: otg.FlowRSVPPathObjectsSessionAttributeCType.choice:type_name -> otg.FlowRSVPPathObjectsSessionAttributeCType.Choice.Enum @@ -144721,25 +145496,25 @@ var file_otg_proto_depIdxs = []int32{ 729, // 742: otg.FlowRSVPPathObjectsClassSenderTemplate.c_type:type_name -> otg.FlowRSVPPathObjectsSenderTemplateCType 111, // 743: otg.FlowRSVPPathObjectsSenderTemplateCType.choice:type_name -> otg.FlowRSVPPathObjectsSenderTemplateCType.Choice.Enum 730, // 744: otg.FlowRSVPPathObjectsSenderTemplateCType.lsp_tunnel_ipv4:type_name -> otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 - 1391, // 745: otg.FlowRSVPPathSenderTemplateLspTunnelIpv4.ipv4_tunnel_sender_address:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - 1393, // 746: otg.FlowRSVPPathSenderTemplateLspTunnelIpv4.reserved:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - 1395, // 747: otg.FlowRSVPPathSenderTemplateLspTunnelIpv4.lsp_id:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + 1398, // 745: otg.FlowRSVPPathSenderTemplateLspTunnelIpv4.ipv4_tunnel_sender_address:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + 1400, // 746: otg.FlowRSVPPathSenderTemplateLspTunnelIpv4.reserved:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + 1402, // 747: otg.FlowRSVPPathSenderTemplateLspTunnelIpv4.lsp_id:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId 698, // 748: otg.FlowRSVPPathObjectsClassSenderTspec.length:type_name -> otg.FlowRSVPObjectLength 732, // 749: otg.FlowRSVPPathObjectsClassSenderTspec.c_type:type_name -> otg.FlowRSVPPathObjectsSenderTspecCType 112, // 750: otg.FlowRSVPPathObjectsSenderTspecCType.choice:type_name -> otg.FlowRSVPPathObjectsSenderTspecCType.Choice.Enum 733, // 751: otg.FlowRSVPPathObjectsSenderTspecCType.int_serv:type_name -> otg.FlowRSVPPathSenderTspecIntServ - 1397, // 752: otg.FlowRSVPPathSenderTspecIntServ.version:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServVersion - 1399, // 753: otg.FlowRSVPPathSenderTspecIntServ.reserved1:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved1 - 1401, // 754: otg.FlowRSVPPathSenderTspecIntServ.overall_length:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServOverallLength - 1403, // 755: otg.FlowRSVPPathSenderTspecIntServ.service_header:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader - 1405, // 756: otg.FlowRSVPPathSenderTspecIntServ.zero_bit:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServZeroBit - 1407, // 757: otg.FlowRSVPPathSenderTspecIntServ.reserved2:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved2 - 1409, // 758: otg.FlowRSVPPathSenderTspecIntServ.length_of_service_data:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - 1411, // 759: otg.FlowRSVPPathSenderTspecIntServ.parameter_id_token_bucket_tspec:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - 1413, // 760: otg.FlowRSVPPathSenderTspecIntServ.parameter_127_flag:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag - 1415, // 761: otg.FlowRSVPPathSenderTspecIntServ.parameter_127_length:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length - 1417, // 762: otg.FlowRSVPPathSenderTspecIntServ.minimum_policed_unit:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - 1419, // 763: otg.FlowRSVPPathSenderTspecIntServ.maximum_packet_size:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + 1404, // 752: otg.FlowRSVPPathSenderTspecIntServ.version:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServVersion + 1406, // 753: otg.FlowRSVPPathSenderTspecIntServ.reserved1:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved1 + 1408, // 754: otg.FlowRSVPPathSenderTspecIntServ.overall_length:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServOverallLength + 1410, // 755: otg.FlowRSVPPathSenderTspecIntServ.service_header:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader + 1412, // 756: otg.FlowRSVPPathSenderTspecIntServ.zero_bit:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServZeroBit + 1414, // 757: otg.FlowRSVPPathSenderTspecIntServ.reserved2:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved2 + 1416, // 758: otg.FlowRSVPPathSenderTspecIntServ.length_of_service_data:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + 1418, // 759: otg.FlowRSVPPathSenderTspecIntServ.parameter_id_token_bucket_tspec:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + 1420, // 760: otg.FlowRSVPPathSenderTspecIntServ.parameter_127_flag:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag + 1422, // 761: otg.FlowRSVPPathSenderTspecIntServ.parameter_127_length:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length + 1424, // 762: otg.FlowRSVPPathSenderTspecIntServ.minimum_policed_unit:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + 1426, // 763: otg.FlowRSVPPathSenderTspecIntServ.maximum_packet_size:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize 698, // 764: otg.FlowRSVPPathObjectsClassRecordRoute.length:type_name -> otg.FlowRSVPObjectLength 735, // 765: otg.FlowRSVPPathObjectsClassRecordRoute.c_type:type_name -> otg.FlowRSVPPathObjectsRecordRouteCType 113, // 766: otg.FlowRSVPPathObjectsRecordRouteCType.choice:type_name -> otg.FlowRSVPPathObjectsRecordRouteCType.Choice.Enum @@ -144750,17 +145525,17 @@ var file_otg_proto_depIdxs = []int32{ 739, // 771: otg.FlowRSVPPathObjectsRecordRouteSubObjectType.ipv4_address:type_name -> otg.FlowRSVPPathRecordRouteType1Ipv4Address 741, // 772: otg.FlowRSVPPathObjectsRecordRouteSubObjectType.label:type_name -> otg.FlowRSVPPathRecordRouteType1Label 743, // 773: otg.FlowRSVPPathRecordRouteType1Ipv4Address.length:type_name -> otg.FlowRSVPRouteRecordLength - 1421, // 774: otg.FlowRSVPPathRecordRouteType1Ipv4Address.ipv4_address:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - 1423, // 775: otg.FlowRSVPPathRecordRouteType1Ipv4Address.prefix_length:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + 1428, // 774: otg.FlowRSVPPathRecordRouteType1Ipv4Address.ipv4_address:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + 1430, // 775: otg.FlowRSVPPathRecordRouteType1Ipv4Address.prefix_length:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength 740, // 776: otg.FlowRSVPPathRecordRouteType1Ipv4Address.flags:type_name -> otg.FlowRSVPRecordRouteIPv4Flag 115, // 777: otg.FlowRSVPRecordRouteIPv4Flag.choice:type_name -> otg.FlowRSVPRecordRouteIPv4Flag.Choice.Enum 743, // 778: otg.FlowRSVPPathRecordRouteType1Label.length:type_name -> otg.FlowRSVPRouteRecordLength - 1424, // 779: otg.FlowRSVPPathRecordRouteType1Label.flags:type_name -> otg.PatternFlowRSVPPathRecordRouteType1LabelFlags - 1425, // 780: otg.FlowRSVPPathRecordRouteType1Label.c_type:type_name -> otg.PatternFlowRSVPPathRecordRouteType1LabelCType + 1431, // 779: otg.FlowRSVPPathRecordRouteType1Label.flags:type_name -> otg.PatternFlowRSVPPathRecordRouteType1LabelFlags + 1432, // 780: otg.FlowRSVPPathRecordRouteType1Label.c_type:type_name -> otg.PatternFlowRSVPPathRecordRouteType1LabelCType 742, // 781: otg.FlowRSVPPathRecordRouteType1Label.label:type_name -> otg.FlowRSVPPathRecordRouteLabel 116, // 782: otg.FlowRSVPPathRecordRouteLabel.choice:type_name -> otg.FlowRSVPPathRecordRouteLabel.Choice.Enum 117, // 783: otg.FlowRSVPRouteRecordLength.choice:type_name -> otg.FlowRSVPRouteRecordLength.Choice.Enum - 1427, // 784: otg.FlowRSVPPathObjectsCustom.type:type_name -> otg.PatternFlowRSVPPathObjectsCustomType + 1434, // 784: otg.FlowRSVPPathObjectsCustom.type:type_name -> otg.PatternFlowRSVPPathObjectsCustomType 698, // 785: otg.FlowRSVPPathObjectsCustom.length:type_name -> otg.FlowRSVPObjectLength 118, // 786: otg.FlowSize.choice:type_name -> otg.FlowSize.Choice.Enum 746, // 787: otg.FlowSize.increment:type_name -> otg.FlowSizeIncrement @@ -145124,664 +145899,671 @@ var file_otg_proto_depIdxs = []int32{ 978, // 1145: otg.PatternFlowIpv4Src.decrement:type_name -> otg.PatternFlowIpv4SrcCounter 979, // 1146: otg.PatternFlowIpv4Src.metric_tags:type_name -> otg.PatternFlowIpv4SrcMetricTag 668, // 1147: otg.PatternFlowIpv4Src.auto:type_name -> otg.FlowIpv4Auto - 244, // 1148: otg.PatternFlowIpv4Dst.choice:type_name -> otg.PatternFlowIpv4Dst.Choice.Enum - 981, // 1149: otg.PatternFlowIpv4Dst.increment:type_name -> otg.PatternFlowIpv4DstCounter - 981, // 1150: otg.PatternFlowIpv4Dst.decrement:type_name -> otg.PatternFlowIpv4DstCounter - 982, // 1151: otg.PatternFlowIpv4Dst.metric_tags:type_name -> otg.PatternFlowIpv4DstMetricTag - 668, // 1152: otg.PatternFlowIpv4Dst.auto:type_name -> otg.FlowIpv4Auto - 245, // 1153: otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag.choice:type_name -> otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag.Choice.Enum - 984, // 1154: otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag.increment:type_name -> otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - 984, // 1155: otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag.decrement:type_name -> otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - 246, // 1156: otg.PatternFlowIpv4OptionsCustomTypeOptionClass.choice:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionClass.Choice.Enum - 986, // 1157: otg.PatternFlowIpv4OptionsCustomTypeOptionClass.increment:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter - 986, // 1158: otg.PatternFlowIpv4OptionsCustomTypeOptionClass.decrement:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter - 247, // 1159: otg.PatternFlowIpv4OptionsCustomTypeOptionNumber.choice:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionNumber.Choice.Enum - 988, // 1160: otg.PatternFlowIpv4OptionsCustomTypeOptionNumber.increment:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - 988, // 1161: otg.PatternFlowIpv4OptionsCustomTypeOptionNumber.decrement:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - 248, // 1162: otg.PatternFlowIpv4PriorityRaw.choice:type_name -> otg.PatternFlowIpv4PriorityRaw.Choice.Enum - 990, // 1163: otg.PatternFlowIpv4PriorityRaw.increment:type_name -> otg.PatternFlowIpv4PriorityRawCounter - 990, // 1164: otg.PatternFlowIpv4PriorityRaw.decrement:type_name -> otg.PatternFlowIpv4PriorityRawCounter - 991, // 1165: otg.PatternFlowIpv4PriorityRaw.metric_tags:type_name -> otg.PatternFlowIpv4PriorityRawMetricTag - 249, // 1166: otg.PatternFlowIpv4DscpPhb.choice:type_name -> otg.PatternFlowIpv4DscpPhb.Choice.Enum - 993, // 1167: otg.PatternFlowIpv4DscpPhb.increment:type_name -> otg.PatternFlowIpv4DscpPhbCounter - 993, // 1168: otg.PatternFlowIpv4DscpPhb.decrement:type_name -> otg.PatternFlowIpv4DscpPhbCounter - 994, // 1169: otg.PatternFlowIpv4DscpPhb.metric_tags:type_name -> otg.PatternFlowIpv4DscpPhbMetricTag - 250, // 1170: otg.PatternFlowIpv4DscpEcn.choice:type_name -> otg.PatternFlowIpv4DscpEcn.Choice.Enum - 996, // 1171: otg.PatternFlowIpv4DscpEcn.increment:type_name -> otg.PatternFlowIpv4DscpEcnCounter - 996, // 1172: otg.PatternFlowIpv4DscpEcn.decrement:type_name -> otg.PatternFlowIpv4DscpEcnCounter - 997, // 1173: otg.PatternFlowIpv4DscpEcn.metric_tags:type_name -> otg.PatternFlowIpv4DscpEcnMetricTag - 251, // 1174: otg.PatternFlowIpv4TosPrecedence.choice:type_name -> otg.PatternFlowIpv4TosPrecedence.Choice.Enum - 999, // 1175: otg.PatternFlowIpv4TosPrecedence.increment:type_name -> otg.PatternFlowIpv4TosPrecedenceCounter - 999, // 1176: otg.PatternFlowIpv4TosPrecedence.decrement:type_name -> otg.PatternFlowIpv4TosPrecedenceCounter - 1000, // 1177: otg.PatternFlowIpv4TosPrecedence.metric_tags:type_name -> otg.PatternFlowIpv4TosPrecedenceMetricTag - 252, // 1178: otg.PatternFlowIpv4TosDelay.choice:type_name -> otg.PatternFlowIpv4TosDelay.Choice.Enum - 1002, // 1179: otg.PatternFlowIpv4TosDelay.increment:type_name -> otg.PatternFlowIpv4TosDelayCounter - 1002, // 1180: otg.PatternFlowIpv4TosDelay.decrement:type_name -> otg.PatternFlowIpv4TosDelayCounter - 1003, // 1181: otg.PatternFlowIpv4TosDelay.metric_tags:type_name -> otg.PatternFlowIpv4TosDelayMetricTag - 253, // 1182: otg.PatternFlowIpv4TosThroughput.choice:type_name -> otg.PatternFlowIpv4TosThroughput.Choice.Enum - 1005, // 1183: otg.PatternFlowIpv4TosThroughput.increment:type_name -> otg.PatternFlowIpv4TosThroughputCounter - 1005, // 1184: otg.PatternFlowIpv4TosThroughput.decrement:type_name -> otg.PatternFlowIpv4TosThroughputCounter - 1006, // 1185: otg.PatternFlowIpv4TosThroughput.metric_tags:type_name -> otg.PatternFlowIpv4TosThroughputMetricTag - 254, // 1186: otg.PatternFlowIpv4TosReliability.choice:type_name -> otg.PatternFlowIpv4TosReliability.Choice.Enum - 1008, // 1187: otg.PatternFlowIpv4TosReliability.increment:type_name -> otg.PatternFlowIpv4TosReliabilityCounter - 1008, // 1188: otg.PatternFlowIpv4TosReliability.decrement:type_name -> otg.PatternFlowIpv4TosReliabilityCounter - 1009, // 1189: otg.PatternFlowIpv4TosReliability.metric_tags:type_name -> otg.PatternFlowIpv4TosReliabilityMetricTag - 255, // 1190: otg.PatternFlowIpv4TosMonetary.choice:type_name -> otg.PatternFlowIpv4TosMonetary.Choice.Enum - 1011, // 1191: otg.PatternFlowIpv4TosMonetary.increment:type_name -> otg.PatternFlowIpv4TosMonetaryCounter - 1011, // 1192: otg.PatternFlowIpv4TosMonetary.decrement:type_name -> otg.PatternFlowIpv4TosMonetaryCounter - 1012, // 1193: otg.PatternFlowIpv4TosMonetary.metric_tags:type_name -> otg.PatternFlowIpv4TosMonetaryMetricTag - 256, // 1194: otg.PatternFlowIpv4TosUnused.choice:type_name -> otg.PatternFlowIpv4TosUnused.Choice.Enum - 1014, // 1195: otg.PatternFlowIpv4TosUnused.increment:type_name -> otg.PatternFlowIpv4TosUnusedCounter - 1014, // 1196: otg.PatternFlowIpv4TosUnused.decrement:type_name -> otg.PatternFlowIpv4TosUnusedCounter - 1015, // 1197: otg.PatternFlowIpv4TosUnused.metric_tags:type_name -> otg.PatternFlowIpv4TosUnusedMetricTag - 257, // 1198: otg.PatternFlowIpv6Version.choice:type_name -> otg.PatternFlowIpv6Version.Choice.Enum - 1017, // 1199: otg.PatternFlowIpv6Version.increment:type_name -> otg.PatternFlowIpv6VersionCounter - 1017, // 1200: otg.PatternFlowIpv6Version.decrement:type_name -> otg.PatternFlowIpv6VersionCounter - 1018, // 1201: otg.PatternFlowIpv6Version.metric_tags:type_name -> otg.PatternFlowIpv6VersionMetricTag - 258, // 1202: otg.PatternFlowIpv6TrafficClass.choice:type_name -> otg.PatternFlowIpv6TrafficClass.Choice.Enum - 1020, // 1203: otg.PatternFlowIpv6TrafficClass.increment:type_name -> otg.PatternFlowIpv6TrafficClassCounter - 1020, // 1204: otg.PatternFlowIpv6TrafficClass.decrement:type_name -> otg.PatternFlowIpv6TrafficClassCounter - 1021, // 1205: otg.PatternFlowIpv6TrafficClass.metric_tags:type_name -> otg.PatternFlowIpv6TrafficClassMetricTag - 259, // 1206: otg.PatternFlowIpv6FlowLabel.choice:type_name -> otg.PatternFlowIpv6FlowLabel.Choice.Enum - 1023, // 1207: otg.PatternFlowIpv6FlowLabel.increment:type_name -> otg.PatternFlowIpv6FlowLabelCounter - 1023, // 1208: otg.PatternFlowIpv6FlowLabel.decrement:type_name -> otg.PatternFlowIpv6FlowLabelCounter - 1024, // 1209: otg.PatternFlowIpv6FlowLabel.metric_tags:type_name -> otg.PatternFlowIpv6FlowLabelMetricTag - 260, // 1210: otg.PatternFlowIpv6PayloadLength.choice:type_name -> otg.PatternFlowIpv6PayloadLength.Choice.Enum - 1026, // 1211: otg.PatternFlowIpv6PayloadLength.increment:type_name -> otg.PatternFlowIpv6PayloadLengthCounter - 1026, // 1212: otg.PatternFlowIpv6PayloadLength.decrement:type_name -> otg.PatternFlowIpv6PayloadLengthCounter - 1027, // 1213: otg.PatternFlowIpv6PayloadLength.metric_tags:type_name -> otg.PatternFlowIpv6PayloadLengthMetricTag - 261, // 1214: otg.PatternFlowIpv6NextHeader.choice:type_name -> otg.PatternFlowIpv6NextHeader.Choice.Enum - 1029, // 1215: otg.PatternFlowIpv6NextHeader.increment:type_name -> otg.PatternFlowIpv6NextHeaderCounter - 1029, // 1216: otg.PatternFlowIpv6NextHeader.decrement:type_name -> otg.PatternFlowIpv6NextHeaderCounter - 1030, // 1217: otg.PatternFlowIpv6NextHeader.metric_tags:type_name -> otg.PatternFlowIpv6NextHeaderMetricTag - 262, // 1218: otg.PatternFlowIpv6HopLimit.choice:type_name -> otg.PatternFlowIpv6HopLimit.Choice.Enum - 1032, // 1219: otg.PatternFlowIpv6HopLimit.increment:type_name -> otg.PatternFlowIpv6HopLimitCounter - 1032, // 1220: otg.PatternFlowIpv6HopLimit.decrement:type_name -> otg.PatternFlowIpv6HopLimitCounter - 1033, // 1221: otg.PatternFlowIpv6HopLimit.metric_tags:type_name -> otg.PatternFlowIpv6HopLimitMetricTag - 263, // 1222: otg.PatternFlowIpv6Src.choice:type_name -> otg.PatternFlowIpv6Src.Choice.Enum - 1035, // 1223: otg.PatternFlowIpv6Src.increment:type_name -> otg.PatternFlowIpv6SrcCounter - 1035, // 1224: otg.PatternFlowIpv6Src.decrement:type_name -> otg.PatternFlowIpv6SrcCounter - 1036, // 1225: otg.PatternFlowIpv6Src.metric_tags:type_name -> otg.PatternFlowIpv6SrcMetricTag - 264, // 1226: otg.PatternFlowIpv6Dst.choice:type_name -> otg.PatternFlowIpv6Dst.Choice.Enum - 1038, // 1227: otg.PatternFlowIpv6Dst.increment:type_name -> otg.PatternFlowIpv6DstCounter - 1038, // 1228: otg.PatternFlowIpv6Dst.decrement:type_name -> otg.PatternFlowIpv6DstCounter - 1039, // 1229: otg.PatternFlowIpv6Dst.metric_tags:type_name -> otg.PatternFlowIpv6DstMetricTag - 265, // 1230: otg.PatternFlowPfcPauseDst.choice:type_name -> otg.PatternFlowPfcPauseDst.Choice.Enum - 1041, // 1231: otg.PatternFlowPfcPauseDst.increment:type_name -> otg.PatternFlowPfcPauseDstCounter - 1041, // 1232: otg.PatternFlowPfcPauseDst.decrement:type_name -> otg.PatternFlowPfcPauseDstCounter - 1042, // 1233: otg.PatternFlowPfcPauseDst.metric_tags:type_name -> otg.PatternFlowPfcPauseDstMetricTag - 266, // 1234: otg.PatternFlowPfcPauseSrc.choice:type_name -> otg.PatternFlowPfcPauseSrc.Choice.Enum - 1044, // 1235: otg.PatternFlowPfcPauseSrc.increment:type_name -> otg.PatternFlowPfcPauseSrcCounter - 1044, // 1236: otg.PatternFlowPfcPauseSrc.decrement:type_name -> otg.PatternFlowPfcPauseSrcCounter - 1045, // 1237: otg.PatternFlowPfcPauseSrc.metric_tags:type_name -> otg.PatternFlowPfcPauseSrcMetricTag - 267, // 1238: otg.PatternFlowPfcPauseEtherType.choice:type_name -> otg.PatternFlowPfcPauseEtherType.Choice.Enum - 1047, // 1239: otg.PatternFlowPfcPauseEtherType.increment:type_name -> otg.PatternFlowPfcPauseEtherTypeCounter - 1047, // 1240: otg.PatternFlowPfcPauseEtherType.decrement:type_name -> otg.PatternFlowPfcPauseEtherTypeCounter - 1048, // 1241: otg.PatternFlowPfcPauseEtherType.metric_tags:type_name -> otg.PatternFlowPfcPauseEtherTypeMetricTag - 268, // 1242: otg.PatternFlowPfcPauseControlOpCode.choice:type_name -> otg.PatternFlowPfcPauseControlOpCode.Choice.Enum - 1050, // 1243: otg.PatternFlowPfcPauseControlOpCode.increment:type_name -> otg.PatternFlowPfcPauseControlOpCodeCounter - 1050, // 1244: otg.PatternFlowPfcPauseControlOpCode.decrement:type_name -> otg.PatternFlowPfcPauseControlOpCodeCounter - 1051, // 1245: otg.PatternFlowPfcPauseControlOpCode.metric_tags:type_name -> otg.PatternFlowPfcPauseControlOpCodeMetricTag - 269, // 1246: otg.PatternFlowPfcPauseClassEnableVector.choice:type_name -> otg.PatternFlowPfcPauseClassEnableVector.Choice.Enum - 1053, // 1247: otg.PatternFlowPfcPauseClassEnableVector.increment:type_name -> otg.PatternFlowPfcPauseClassEnableVectorCounter - 1053, // 1248: otg.PatternFlowPfcPauseClassEnableVector.decrement:type_name -> otg.PatternFlowPfcPauseClassEnableVectorCounter - 1054, // 1249: otg.PatternFlowPfcPauseClassEnableVector.metric_tags:type_name -> otg.PatternFlowPfcPauseClassEnableVectorMetricTag - 270, // 1250: otg.PatternFlowPfcPausePauseClass0.choice:type_name -> otg.PatternFlowPfcPausePauseClass0.Choice.Enum - 1056, // 1251: otg.PatternFlowPfcPausePauseClass0.increment:type_name -> otg.PatternFlowPfcPausePauseClass0Counter - 1056, // 1252: otg.PatternFlowPfcPausePauseClass0.decrement:type_name -> otg.PatternFlowPfcPausePauseClass0Counter - 1057, // 1253: otg.PatternFlowPfcPausePauseClass0.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass0MetricTag - 271, // 1254: otg.PatternFlowPfcPausePauseClass1.choice:type_name -> otg.PatternFlowPfcPausePauseClass1.Choice.Enum - 1059, // 1255: otg.PatternFlowPfcPausePauseClass1.increment:type_name -> otg.PatternFlowPfcPausePauseClass1Counter - 1059, // 1256: otg.PatternFlowPfcPausePauseClass1.decrement:type_name -> otg.PatternFlowPfcPausePauseClass1Counter - 1060, // 1257: otg.PatternFlowPfcPausePauseClass1.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass1MetricTag - 272, // 1258: otg.PatternFlowPfcPausePauseClass2.choice:type_name -> otg.PatternFlowPfcPausePauseClass2.Choice.Enum - 1062, // 1259: otg.PatternFlowPfcPausePauseClass2.increment:type_name -> otg.PatternFlowPfcPausePauseClass2Counter - 1062, // 1260: otg.PatternFlowPfcPausePauseClass2.decrement:type_name -> otg.PatternFlowPfcPausePauseClass2Counter - 1063, // 1261: otg.PatternFlowPfcPausePauseClass2.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass2MetricTag - 273, // 1262: otg.PatternFlowPfcPausePauseClass3.choice:type_name -> otg.PatternFlowPfcPausePauseClass3.Choice.Enum - 1065, // 1263: otg.PatternFlowPfcPausePauseClass3.increment:type_name -> otg.PatternFlowPfcPausePauseClass3Counter - 1065, // 1264: otg.PatternFlowPfcPausePauseClass3.decrement:type_name -> otg.PatternFlowPfcPausePauseClass3Counter - 1066, // 1265: otg.PatternFlowPfcPausePauseClass3.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass3MetricTag - 274, // 1266: otg.PatternFlowPfcPausePauseClass4.choice:type_name -> otg.PatternFlowPfcPausePauseClass4.Choice.Enum - 1068, // 1267: otg.PatternFlowPfcPausePauseClass4.increment:type_name -> otg.PatternFlowPfcPausePauseClass4Counter - 1068, // 1268: otg.PatternFlowPfcPausePauseClass4.decrement:type_name -> otg.PatternFlowPfcPausePauseClass4Counter - 1069, // 1269: otg.PatternFlowPfcPausePauseClass4.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass4MetricTag - 275, // 1270: otg.PatternFlowPfcPausePauseClass5.choice:type_name -> otg.PatternFlowPfcPausePauseClass5.Choice.Enum - 1071, // 1271: otg.PatternFlowPfcPausePauseClass5.increment:type_name -> otg.PatternFlowPfcPausePauseClass5Counter - 1071, // 1272: otg.PatternFlowPfcPausePauseClass5.decrement:type_name -> otg.PatternFlowPfcPausePauseClass5Counter - 1072, // 1273: otg.PatternFlowPfcPausePauseClass5.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass5MetricTag - 276, // 1274: otg.PatternFlowPfcPausePauseClass6.choice:type_name -> otg.PatternFlowPfcPausePauseClass6.Choice.Enum - 1074, // 1275: otg.PatternFlowPfcPausePauseClass6.increment:type_name -> otg.PatternFlowPfcPausePauseClass6Counter - 1074, // 1276: otg.PatternFlowPfcPausePauseClass6.decrement:type_name -> otg.PatternFlowPfcPausePauseClass6Counter - 1075, // 1277: otg.PatternFlowPfcPausePauseClass6.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass6MetricTag - 277, // 1278: otg.PatternFlowPfcPausePauseClass7.choice:type_name -> otg.PatternFlowPfcPausePauseClass7.Choice.Enum - 1077, // 1279: otg.PatternFlowPfcPausePauseClass7.increment:type_name -> otg.PatternFlowPfcPausePauseClass7Counter - 1077, // 1280: otg.PatternFlowPfcPausePauseClass7.decrement:type_name -> otg.PatternFlowPfcPausePauseClass7Counter - 1078, // 1281: otg.PatternFlowPfcPausePauseClass7.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass7MetricTag - 278, // 1282: otg.PatternFlowEthernetPauseDst.choice:type_name -> otg.PatternFlowEthernetPauseDst.Choice.Enum - 1080, // 1283: otg.PatternFlowEthernetPauseDst.increment:type_name -> otg.PatternFlowEthernetPauseDstCounter - 1080, // 1284: otg.PatternFlowEthernetPauseDst.decrement:type_name -> otg.PatternFlowEthernetPauseDstCounter - 1081, // 1285: otg.PatternFlowEthernetPauseDst.metric_tags:type_name -> otg.PatternFlowEthernetPauseDstMetricTag - 279, // 1286: otg.PatternFlowEthernetPauseSrc.choice:type_name -> otg.PatternFlowEthernetPauseSrc.Choice.Enum - 1083, // 1287: otg.PatternFlowEthernetPauseSrc.increment:type_name -> otg.PatternFlowEthernetPauseSrcCounter - 1083, // 1288: otg.PatternFlowEthernetPauseSrc.decrement:type_name -> otg.PatternFlowEthernetPauseSrcCounter - 1084, // 1289: otg.PatternFlowEthernetPauseSrc.metric_tags:type_name -> otg.PatternFlowEthernetPauseSrcMetricTag - 280, // 1290: otg.PatternFlowEthernetPauseEtherType.choice:type_name -> otg.PatternFlowEthernetPauseEtherType.Choice.Enum - 1086, // 1291: otg.PatternFlowEthernetPauseEtherType.increment:type_name -> otg.PatternFlowEthernetPauseEtherTypeCounter - 1086, // 1292: otg.PatternFlowEthernetPauseEtherType.decrement:type_name -> otg.PatternFlowEthernetPauseEtherTypeCounter - 1087, // 1293: otg.PatternFlowEthernetPauseEtherType.metric_tags:type_name -> otg.PatternFlowEthernetPauseEtherTypeMetricTag - 281, // 1294: otg.PatternFlowEthernetPauseControlOpCode.choice:type_name -> otg.PatternFlowEthernetPauseControlOpCode.Choice.Enum - 1089, // 1295: otg.PatternFlowEthernetPauseControlOpCode.increment:type_name -> otg.PatternFlowEthernetPauseControlOpCodeCounter - 1089, // 1296: otg.PatternFlowEthernetPauseControlOpCode.decrement:type_name -> otg.PatternFlowEthernetPauseControlOpCodeCounter - 1090, // 1297: otg.PatternFlowEthernetPauseControlOpCode.metric_tags:type_name -> otg.PatternFlowEthernetPauseControlOpCodeMetricTag - 282, // 1298: otg.PatternFlowEthernetPauseTime.choice:type_name -> otg.PatternFlowEthernetPauseTime.Choice.Enum - 1092, // 1299: otg.PatternFlowEthernetPauseTime.increment:type_name -> otg.PatternFlowEthernetPauseTimeCounter - 1092, // 1300: otg.PatternFlowEthernetPauseTime.decrement:type_name -> otg.PatternFlowEthernetPauseTimeCounter - 1093, // 1301: otg.PatternFlowEthernetPauseTime.metric_tags:type_name -> otg.PatternFlowEthernetPauseTimeMetricTag - 283, // 1302: otg.PatternFlowTcpSrcPort.choice:type_name -> otg.PatternFlowTcpSrcPort.Choice.Enum - 1095, // 1303: otg.PatternFlowTcpSrcPort.increment:type_name -> otg.PatternFlowTcpSrcPortCounter - 1095, // 1304: otg.PatternFlowTcpSrcPort.decrement:type_name -> otg.PatternFlowTcpSrcPortCounter - 1096, // 1305: otg.PatternFlowTcpSrcPort.metric_tags:type_name -> otg.PatternFlowTcpSrcPortMetricTag - 284, // 1306: otg.PatternFlowTcpDstPort.choice:type_name -> otg.PatternFlowTcpDstPort.Choice.Enum - 1098, // 1307: otg.PatternFlowTcpDstPort.increment:type_name -> otg.PatternFlowTcpDstPortCounter - 1098, // 1308: otg.PatternFlowTcpDstPort.decrement:type_name -> otg.PatternFlowTcpDstPortCounter - 1099, // 1309: otg.PatternFlowTcpDstPort.metric_tags:type_name -> otg.PatternFlowTcpDstPortMetricTag - 285, // 1310: otg.PatternFlowTcpSeqNum.choice:type_name -> otg.PatternFlowTcpSeqNum.Choice.Enum - 1101, // 1311: otg.PatternFlowTcpSeqNum.increment:type_name -> otg.PatternFlowTcpSeqNumCounter - 1101, // 1312: otg.PatternFlowTcpSeqNum.decrement:type_name -> otg.PatternFlowTcpSeqNumCounter - 1102, // 1313: otg.PatternFlowTcpSeqNum.metric_tags:type_name -> otg.PatternFlowTcpSeqNumMetricTag - 286, // 1314: otg.PatternFlowTcpAckNum.choice:type_name -> otg.PatternFlowTcpAckNum.Choice.Enum - 1104, // 1315: otg.PatternFlowTcpAckNum.increment:type_name -> otg.PatternFlowTcpAckNumCounter - 1104, // 1316: otg.PatternFlowTcpAckNum.decrement:type_name -> otg.PatternFlowTcpAckNumCounter - 1105, // 1317: otg.PatternFlowTcpAckNum.metric_tags:type_name -> otg.PatternFlowTcpAckNumMetricTag - 287, // 1318: otg.PatternFlowTcpDataOffset.choice:type_name -> otg.PatternFlowTcpDataOffset.Choice.Enum - 1107, // 1319: otg.PatternFlowTcpDataOffset.increment:type_name -> otg.PatternFlowTcpDataOffsetCounter - 1107, // 1320: otg.PatternFlowTcpDataOffset.decrement:type_name -> otg.PatternFlowTcpDataOffsetCounter - 1108, // 1321: otg.PatternFlowTcpDataOffset.metric_tags:type_name -> otg.PatternFlowTcpDataOffsetMetricTag - 288, // 1322: otg.PatternFlowTcpEcnNs.choice:type_name -> otg.PatternFlowTcpEcnNs.Choice.Enum - 1110, // 1323: otg.PatternFlowTcpEcnNs.increment:type_name -> otg.PatternFlowTcpEcnNsCounter - 1110, // 1324: otg.PatternFlowTcpEcnNs.decrement:type_name -> otg.PatternFlowTcpEcnNsCounter - 1111, // 1325: otg.PatternFlowTcpEcnNs.metric_tags:type_name -> otg.PatternFlowTcpEcnNsMetricTag - 289, // 1326: otg.PatternFlowTcpEcnCwr.choice:type_name -> otg.PatternFlowTcpEcnCwr.Choice.Enum - 1113, // 1327: otg.PatternFlowTcpEcnCwr.increment:type_name -> otg.PatternFlowTcpEcnCwrCounter - 1113, // 1328: otg.PatternFlowTcpEcnCwr.decrement:type_name -> otg.PatternFlowTcpEcnCwrCounter - 1114, // 1329: otg.PatternFlowTcpEcnCwr.metric_tags:type_name -> otg.PatternFlowTcpEcnCwrMetricTag - 290, // 1330: otg.PatternFlowTcpEcnEcho.choice:type_name -> otg.PatternFlowTcpEcnEcho.Choice.Enum - 1116, // 1331: otg.PatternFlowTcpEcnEcho.increment:type_name -> otg.PatternFlowTcpEcnEchoCounter - 1116, // 1332: otg.PatternFlowTcpEcnEcho.decrement:type_name -> otg.PatternFlowTcpEcnEchoCounter - 1117, // 1333: otg.PatternFlowTcpEcnEcho.metric_tags:type_name -> otg.PatternFlowTcpEcnEchoMetricTag - 291, // 1334: otg.PatternFlowTcpCtlUrg.choice:type_name -> otg.PatternFlowTcpCtlUrg.Choice.Enum - 1119, // 1335: otg.PatternFlowTcpCtlUrg.increment:type_name -> otg.PatternFlowTcpCtlUrgCounter - 1119, // 1336: otg.PatternFlowTcpCtlUrg.decrement:type_name -> otg.PatternFlowTcpCtlUrgCounter - 1120, // 1337: otg.PatternFlowTcpCtlUrg.metric_tags:type_name -> otg.PatternFlowTcpCtlUrgMetricTag - 292, // 1338: otg.PatternFlowTcpCtlAck.choice:type_name -> otg.PatternFlowTcpCtlAck.Choice.Enum - 1122, // 1339: otg.PatternFlowTcpCtlAck.increment:type_name -> otg.PatternFlowTcpCtlAckCounter - 1122, // 1340: otg.PatternFlowTcpCtlAck.decrement:type_name -> otg.PatternFlowTcpCtlAckCounter - 1123, // 1341: otg.PatternFlowTcpCtlAck.metric_tags:type_name -> otg.PatternFlowTcpCtlAckMetricTag - 293, // 1342: otg.PatternFlowTcpCtlPsh.choice:type_name -> otg.PatternFlowTcpCtlPsh.Choice.Enum - 1125, // 1343: otg.PatternFlowTcpCtlPsh.increment:type_name -> otg.PatternFlowTcpCtlPshCounter - 1125, // 1344: otg.PatternFlowTcpCtlPsh.decrement:type_name -> otg.PatternFlowTcpCtlPshCounter - 1126, // 1345: otg.PatternFlowTcpCtlPsh.metric_tags:type_name -> otg.PatternFlowTcpCtlPshMetricTag - 294, // 1346: otg.PatternFlowTcpCtlRst.choice:type_name -> otg.PatternFlowTcpCtlRst.Choice.Enum - 1128, // 1347: otg.PatternFlowTcpCtlRst.increment:type_name -> otg.PatternFlowTcpCtlRstCounter - 1128, // 1348: otg.PatternFlowTcpCtlRst.decrement:type_name -> otg.PatternFlowTcpCtlRstCounter - 1129, // 1349: otg.PatternFlowTcpCtlRst.metric_tags:type_name -> otg.PatternFlowTcpCtlRstMetricTag - 295, // 1350: otg.PatternFlowTcpCtlSyn.choice:type_name -> otg.PatternFlowTcpCtlSyn.Choice.Enum - 1131, // 1351: otg.PatternFlowTcpCtlSyn.increment:type_name -> otg.PatternFlowTcpCtlSynCounter - 1131, // 1352: otg.PatternFlowTcpCtlSyn.decrement:type_name -> otg.PatternFlowTcpCtlSynCounter - 1132, // 1353: otg.PatternFlowTcpCtlSyn.metric_tags:type_name -> otg.PatternFlowTcpCtlSynMetricTag - 296, // 1354: otg.PatternFlowTcpCtlFin.choice:type_name -> otg.PatternFlowTcpCtlFin.Choice.Enum - 1134, // 1355: otg.PatternFlowTcpCtlFin.increment:type_name -> otg.PatternFlowTcpCtlFinCounter - 1134, // 1356: otg.PatternFlowTcpCtlFin.decrement:type_name -> otg.PatternFlowTcpCtlFinCounter - 1135, // 1357: otg.PatternFlowTcpCtlFin.metric_tags:type_name -> otg.PatternFlowTcpCtlFinMetricTag - 297, // 1358: otg.PatternFlowTcpWindow.choice:type_name -> otg.PatternFlowTcpWindow.Choice.Enum - 1137, // 1359: otg.PatternFlowTcpWindow.increment:type_name -> otg.PatternFlowTcpWindowCounter - 1137, // 1360: otg.PatternFlowTcpWindow.decrement:type_name -> otg.PatternFlowTcpWindowCounter - 1138, // 1361: otg.PatternFlowTcpWindow.metric_tags:type_name -> otg.PatternFlowTcpWindowMetricTag - 298, // 1362: otg.PatternFlowTcpChecksum.choice:type_name -> otg.PatternFlowTcpChecksum.Choice.Enum - 299, // 1363: otg.PatternFlowTcpChecksum.generated:type_name -> otg.PatternFlowTcpChecksum.Generated.Enum - 300, // 1364: otg.PatternFlowUdpSrcPort.choice:type_name -> otg.PatternFlowUdpSrcPort.Choice.Enum - 1141, // 1365: otg.PatternFlowUdpSrcPort.increment:type_name -> otg.PatternFlowUdpSrcPortCounter - 1141, // 1366: otg.PatternFlowUdpSrcPort.decrement:type_name -> otg.PatternFlowUdpSrcPortCounter - 1142, // 1367: otg.PatternFlowUdpSrcPort.metric_tags:type_name -> otg.PatternFlowUdpSrcPortMetricTag - 301, // 1368: otg.PatternFlowUdpDstPort.choice:type_name -> otg.PatternFlowUdpDstPort.Choice.Enum - 1144, // 1369: otg.PatternFlowUdpDstPort.increment:type_name -> otg.PatternFlowUdpDstPortCounter - 1144, // 1370: otg.PatternFlowUdpDstPort.decrement:type_name -> otg.PatternFlowUdpDstPortCounter - 1145, // 1371: otg.PatternFlowUdpDstPort.metric_tags:type_name -> otg.PatternFlowUdpDstPortMetricTag - 302, // 1372: otg.PatternFlowUdpLength.choice:type_name -> otg.PatternFlowUdpLength.Choice.Enum - 1147, // 1373: otg.PatternFlowUdpLength.increment:type_name -> otg.PatternFlowUdpLengthCounter - 1147, // 1374: otg.PatternFlowUdpLength.decrement:type_name -> otg.PatternFlowUdpLengthCounter - 1148, // 1375: otg.PatternFlowUdpLength.metric_tags:type_name -> otg.PatternFlowUdpLengthMetricTag - 303, // 1376: otg.PatternFlowUdpChecksum.choice:type_name -> otg.PatternFlowUdpChecksum.Choice.Enum - 304, // 1377: otg.PatternFlowUdpChecksum.generated:type_name -> otg.PatternFlowUdpChecksum.Generated.Enum - 305, // 1378: otg.PatternFlowGreChecksumPresent.choice:type_name -> otg.PatternFlowGreChecksumPresent.Choice.Enum - 1151, // 1379: otg.PatternFlowGreChecksumPresent.increment:type_name -> otg.PatternFlowGreChecksumPresentCounter - 1151, // 1380: otg.PatternFlowGreChecksumPresent.decrement:type_name -> otg.PatternFlowGreChecksumPresentCounter - 1152, // 1381: otg.PatternFlowGreChecksumPresent.metric_tags:type_name -> otg.PatternFlowGreChecksumPresentMetricTag - 306, // 1382: otg.PatternFlowGreReserved0.choice:type_name -> otg.PatternFlowGreReserved0.Choice.Enum - 1154, // 1383: otg.PatternFlowGreReserved0.increment:type_name -> otg.PatternFlowGreReserved0Counter - 1154, // 1384: otg.PatternFlowGreReserved0.decrement:type_name -> otg.PatternFlowGreReserved0Counter - 1155, // 1385: otg.PatternFlowGreReserved0.metric_tags:type_name -> otg.PatternFlowGreReserved0MetricTag - 307, // 1386: otg.PatternFlowGreVersion.choice:type_name -> otg.PatternFlowGreVersion.Choice.Enum - 1157, // 1387: otg.PatternFlowGreVersion.increment:type_name -> otg.PatternFlowGreVersionCounter - 1157, // 1388: otg.PatternFlowGreVersion.decrement:type_name -> otg.PatternFlowGreVersionCounter - 1158, // 1389: otg.PatternFlowGreVersion.metric_tags:type_name -> otg.PatternFlowGreVersionMetricTag - 308, // 1390: otg.PatternFlowGreProtocol.choice:type_name -> otg.PatternFlowGreProtocol.Choice.Enum - 1160, // 1391: otg.PatternFlowGreProtocol.increment:type_name -> otg.PatternFlowGreProtocolCounter - 1160, // 1392: otg.PatternFlowGreProtocol.decrement:type_name -> otg.PatternFlowGreProtocolCounter - 1161, // 1393: otg.PatternFlowGreProtocol.metric_tags:type_name -> otg.PatternFlowGreProtocolMetricTag - 309, // 1394: otg.PatternFlowGreChecksum.choice:type_name -> otg.PatternFlowGreChecksum.Choice.Enum - 310, // 1395: otg.PatternFlowGreChecksum.generated:type_name -> otg.PatternFlowGreChecksum.Generated.Enum - 311, // 1396: otg.PatternFlowGreReserved1.choice:type_name -> otg.PatternFlowGreReserved1.Choice.Enum - 1164, // 1397: otg.PatternFlowGreReserved1.increment:type_name -> otg.PatternFlowGreReserved1Counter - 1164, // 1398: otg.PatternFlowGreReserved1.decrement:type_name -> otg.PatternFlowGreReserved1Counter - 1165, // 1399: otg.PatternFlowGreReserved1.metric_tags:type_name -> otg.PatternFlowGreReserved1MetricTag - 312, // 1400: otg.PatternFlowGtpv1Version.choice:type_name -> otg.PatternFlowGtpv1Version.Choice.Enum - 1167, // 1401: otg.PatternFlowGtpv1Version.increment:type_name -> otg.PatternFlowGtpv1VersionCounter - 1167, // 1402: otg.PatternFlowGtpv1Version.decrement:type_name -> otg.PatternFlowGtpv1VersionCounter - 1168, // 1403: otg.PatternFlowGtpv1Version.metric_tags:type_name -> otg.PatternFlowGtpv1VersionMetricTag - 313, // 1404: otg.PatternFlowGtpv1ProtocolType.choice:type_name -> otg.PatternFlowGtpv1ProtocolType.Choice.Enum - 1170, // 1405: otg.PatternFlowGtpv1ProtocolType.increment:type_name -> otg.PatternFlowGtpv1ProtocolTypeCounter - 1170, // 1406: otg.PatternFlowGtpv1ProtocolType.decrement:type_name -> otg.PatternFlowGtpv1ProtocolTypeCounter - 1171, // 1407: otg.PatternFlowGtpv1ProtocolType.metric_tags:type_name -> otg.PatternFlowGtpv1ProtocolTypeMetricTag - 314, // 1408: otg.PatternFlowGtpv1Reserved.choice:type_name -> otg.PatternFlowGtpv1Reserved.Choice.Enum - 1173, // 1409: otg.PatternFlowGtpv1Reserved.increment:type_name -> otg.PatternFlowGtpv1ReservedCounter - 1173, // 1410: otg.PatternFlowGtpv1Reserved.decrement:type_name -> otg.PatternFlowGtpv1ReservedCounter - 1174, // 1411: otg.PatternFlowGtpv1Reserved.metric_tags:type_name -> otg.PatternFlowGtpv1ReservedMetricTag - 315, // 1412: otg.PatternFlowGtpv1EFlag.choice:type_name -> otg.PatternFlowGtpv1EFlag.Choice.Enum - 1176, // 1413: otg.PatternFlowGtpv1EFlag.increment:type_name -> otg.PatternFlowGtpv1EFlagCounter - 1176, // 1414: otg.PatternFlowGtpv1EFlag.decrement:type_name -> otg.PatternFlowGtpv1EFlagCounter - 1177, // 1415: otg.PatternFlowGtpv1EFlag.metric_tags:type_name -> otg.PatternFlowGtpv1EFlagMetricTag - 316, // 1416: otg.PatternFlowGtpv1SFlag.choice:type_name -> otg.PatternFlowGtpv1SFlag.Choice.Enum - 1179, // 1417: otg.PatternFlowGtpv1SFlag.increment:type_name -> otg.PatternFlowGtpv1SFlagCounter - 1179, // 1418: otg.PatternFlowGtpv1SFlag.decrement:type_name -> otg.PatternFlowGtpv1SFlagCounter - 1180, // 1419: otg.PatternFlowGtpv1SFlag.metric_tags:type_name -> otg.PatternFlowGtpv1SFlagMetricTag - 317, // 1420: otg.PatternFlowGtpv1PnFlag.choice:type_name -> otg.PatternFlowGtpv1PnFlag.Choice.Enum - 1182, // 1421: otg.PatternFlowGtpv1PnFlag.increment:type_name -> otg.PatternFlowGtpv1PnFlagCounter - 1182, // 1422: otg.PatternFlowGtpv1PnFlag.decrement:type_name -> otg.PatternFlowGtpv1PnFlagCounter - 1183, // 1423: otg.PatternFlowGtpv1PnFlag.metric_tags:type_name -> otg.PatternFlowGtpv1PnFlagMetricTag - 318, // 1424: otg.PatternFlowGtpv1MessageType.choice:type_name -> otg.PatternFlowGtpv1MessageType.Choice.Enum - 1185, // 1425: otg.PatternFlowGtpv1MessageType.increment:type_name -> otg.PatternFlowGtpv1MessageTypeCounter - 1185, // 1426: otg.PatternFlowGtpv1MessageType.decrement:type_name -> otg.PatternFlowGtpv1MessageTypeCounter - 1186, // 1427: otg.PatternFlowGtpv1MessageType.metric_tags:type_name -> otg.PatternFlowGtpv1MessageTypeMetricTag - 319, // 1428: otg.PatternFlowGtpv1MessageLength.choice:type_name -> otg.PatternFlowGtpv1MessageLength.Choice.Enum - 1188, // 1429: otg.PatternFlowGtpv1MessageLength.increment:type_name -> otg.PatternFlowGtpv1MessageLengthCounter - 1188, // 1430: otg.PatternFlowGtpv1MessageLength.decrement:type_name -> otg.PatternFlowGtpv1MessageLengthCounter - 1189, // 1431: otg.PatternFlowGtpv1MessageLength.metric_tags:type_name -> otg.PatternFlowGtpv1MessageLengthMetricTag - 320, // 1432: otg.PatternFlowGtpv1Teid.choice:type_name -> otg.PatternFlowGtpv1Teid.Choice.Enum - 1191, // 1433: otg.PatternFlowGtpv1Teid.increment:type_name -> otg.PatternFlowGtpv1TeidCounter - 1191, // 1434: otg.PatternFlowGtpv1Teid.decrement:type_name -> otg.PatternFlowGtpv1TeidCounter - 1192, // 1435: otg.PatternFlowGtpv1Teid.metric_tags:type_name -> otg.PatternFlowGtpv1TeidMetricTag - 321, // 1436: otg.PatternFlowGtpv1SquenceNumber.choice:type_name -> otg.PatternFlowGtpv1SquenceNumber.Choice.Enum - 1194, // 1437: otg.PatternFlowGtpv1SquenceNumber.increment:type_name -> otg.PatternFlowGtpv1SquenceNumberCounter - 1194, // 1438: otg.PatternFlowGtpv1SquenceNumber.decrement:type_name -> otg.PatternFlowGtpv1SquenceNumberCounter - 1195, // 1439: otg.PatternFlowGtpv1SquenceNumber.metric_tags:type_name -> otg.PatternFlowGtpv1SquenceNumberMetricTag - 322, // 1440: otg.PatternFlowGtpv1NPduNumber.choice:type_name -> otg.PatternFlowGtpv1NPduNumber.Choice.Enum - 1197, // 1441: otg.PatternFlowGtpv1NPduNumber.increment:type_name -> otg.PatternFlowGtpv1NPduNumberCounter - 1197, // 1442: otg.PatternFlowGtpv1NPduNumber.decrement:type_name -> otg.PatternFlowGtpv1NPduNumberCounter - 1198, // 1443: otg.PatternFlowGtpv1NPduNumber.metric_tags:type_name -> otg.PatternFlowGtpv1NPduNumberMetricTag - 323, // 1444: otg.PatternFlowGtpv1NextExtensionHeaderType.choice:type_name -> otg.PatternFlowGtpv1NextExtensionHeaderType.Choice.Enum - 1200, // 1445: otg.PatternFlowGtpv1NextExtensionHeaderType.increment:type_name -> otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter - 1200, // 1446: otg.PatternFlowGtpv1NextExtensionHeaderType.decrement:type_name -> otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter - 1201, // 1447: otg.PatternFlowGtpv1NextExtensionHeaderType.metric_tags:type_name -> otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - 324, // 1448: otg.PatternFlowGtpExtensionExtensionLength.choice:type_name -> otg.PatternFlowGtpExtensionExtensionLength.Choice.Enum - 1203, // 1449: otg.PatternFlowGtpExtensionExtensionLength.increment:type_name -> otg.PatternFlowGtpExtensionExtensionLengthCounter - 1203, // 1450: otg.PatternFlowGtpExtensionExtensionLength.decrement:type_name -> otg.PatternFlowGtpExtensionExtensionLengthCounter - 1204, // 1451: otg.PatternFlowGtpExtensionExtensionLength.metric_tags:type_name -> otg.PatternFlowGtpExtensionExtensionLengthMetricTag - 325, // 1452: otg.PatternFlowGtpExtensionContents.choice:type_name -> otg.PatternFlowGtpExtensionContents.Choice.Enum - 1206, // 1453: otg.PatternFlowGtpExtensionContents.increment:type_name -> otg.PatternFlowGtpExtensionContentsCounter - 1206, // 1454: otg.PatternFlowGtpExtensionContents.decrement:type_name -> otg.PatternFlowGtpExtensionContentsCounter - 1207, // 1455: otg.PatternFlowGtpExtensionContents.metric_tags:type_name -> otg.PatternFlowGtpExtensionContentsMetricTag - 326, // 1456: otg.PatternFlowGtpExtensionNextExtensionHeader.choice:type_name -> otg.PatternFlowGtpExtensionNextExtensionHeader.Choice.Enum - 1209, // 1457: otg.PatternFlowGtpExtensionNextExtensionHeader.increment:type_name -> otg.PatternFlowGtpExtensionNextExtensionHeaderCounter - 1209, // 1458: otg.PatternFlowGtpExtensionNextExtensionHeader.decrement:type_name -> otg.PatternFlowGtpExtensionNextExtensionHeaderCounter - 1210, // 1459: otg.PatternFlowGtpExtensionNextExtensionHeader.metric_tags:type_name -> otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag - 327, // 1460: otg.PatternFlowGtpv2Version.choice:type_name -> otg.PatternFlowGtpv2Version.Choice.Enum - 1212, // 1461: otg.PatternFlowGtpv2Version.increment:type_name -> otg.PatternFlowGtpv2VersionCounter - 1212, // 1462: otg.PatternFlowGtpv2Version.decrement:type_name -> otg.PatternFlowGtpv2VersionCounter - 1213, // 1463: otg.PatternFlowGtpv2Version.metric_tags:type_name -> otg.PatternFlowGtpv2VersionMetricTag - 328, // 1464: otg.PatternFlowGtpv2PiggybackingFlag.choice:type_name -> otg.PatternFlowGtpv2PiggybackingFlag.Choice.Enum - 1215, // 1465: otg.PatternFlowGtpv2PiggybackingFlag.increment:type_name -> otg.PatternFlowGtpv2PiggybackingFlagCounter - 1215, // 1466: otg.PatternFlowGtpv2PiggybackingFlag.decrement:type_name -> otg.PatternFlowGtpv2PiggybackingFlagCounter - 1216, // 1467: otg.PatternFlowGtpv2PiggybackingFlag.metric_tags:type_name -> otg.PatternFlowGtpv2PiggybackingFlagMetricTag - 329, // 1468: otg.PatternFlowGtpv2TeidFlag.choice:type_name -> otg.PatternFlowGtpv2TeidFlag.Choice.Enum - 1218, // 1469: otg.PatternFlowGtpv2TeidFlag.increment:type_name -> otg.PatternFlowGtpv2TeidFlagCounter - 1218, // 1470: otg.PatternFlowGtpv2TeidFlag.decrement:type_name -> otg.PatternFlowGtpv2TeidFlagCounter - 1219, // 1471: otg.PatternFlowGtpv2TeidFlag.metric_tags:type_name -> otg.PatternFlowGtpv2TeidFlagMetricTag - 330, // 1472: otg.PatternFlowGtpv2Spare1.choice:type_name -> otg.PatternFlowGtpv2Spare1.Choice.Enum - 1221, // 1473: otg.PatternFlowGtpv2Spare1.increment:type_name -> otg.PatternFlowGtpv2Spare1Counter - 1221, // 1474: otg.PatternFlowGtpv2Spare1.decrement:type_name -> otg.PatternFlowGtpv2Spare1Counter - 1222, // 1475: otg.PatternFlowGtpv2Spare1.metric_tags:type_name -> otg.PatternFlowGtpv2Spare1MetricTag - 331, // 1476: otg.PatternFlowGtpv2MessageType.choice:type_name -> otg.PatternFlowGtpv2MessageType.Choice.Enum - 1224, // 1477: otg.PatternFlowGtpv2MessageType.increment:type_name -> otg.PatternFlowGtpv2MessageTypeCounter - 1224, // 1478: otg.PatternFlowGtpv2MessageType.decrement:type_name -> otg.PatternFlowGtpv2MessageTypeCounter - 1225, // 1479: otg.PatternFlowGtpv2MessageType.metric_tags:type_name -> otg.PatternFlowGtpv2MessageTypeMetricTag - 332, // 1480: otg.PatternFlowGtpv2MessageLength.choice:type_name -> otg.PatternFlowGtpv2MessageLength.Choice.Enum - 1227, // 1481: otg.PatternFlowGtpv2MessageLength.increment:type_name -> otg.PatternFlowGtpv2MessageLengthCounter - 1227, // 1482: otg.PatternFlowGtpv2MessageLength.decrement:type_name -> otg.PatternFlowGtpv2MessageLengthCounter - 1228, // 1483: otg.PatternFlowGtpv2MessageLength.metric_tags:type_name -> otg.PatternFlowGtpv2MessageLengthMetricTag - 333, // 1484: otg.PatternFlowGtpv2Teid.choice:type_name -> otg.PatternFlowGtpv2Teid.Choice.Enum - 1230, // 1485: otg.PatternFlowGtpv2Teid.increment:type_name -> otg.PatternFlowGtpv2TeidCounter - 1230, // 1486: otg.PatternFlowGtpv2Teid.decrement:type_name -> otg.PatternFlowGtpv2TeidCounter - 1231, // 1487: otg.PatternFlowGtpv2Teid.metric_tags:type_name -> otg.PatternFlowGtpv2TeidMetricTag - 334, // 1488: otg.PatternFlowGtpv2SequenceNumber.choice:type_name -> otg.PatternFlowGtpv2SequenceNumber.Choice.Enum - 1233, // 1489: otg.PatternFlowGtpv2SequenceNumber.increment:type_name -> otg.PatternFlowGtpv2SequenceNumberCounter - 1233, // 1490: otg.PatternFlowGtpv2SequenceNumber.decrement:type_name -> otg.PatternFlowGtpv2SequenceNumberCounter - 1234, // 1491: otg.PatternFlowGtpv2SequenceNumber.metric_tags:type_name -> otg.PatternFlowGtpv2SequenceNumberMetricTag - 335, // 1492: otg.PatternFlowGtpv2Spare2.choice:type_name -> otg.PatternFlowGtpv2Spare2.Choice.Enum - 1236, // 1493: otg.PatternFlowGtpv2Spare2.increment:type_name -> otg.PatternFlowGtpv2Spare2Counter - 1236, // 1494: otg.PatternFlowGtpv2Spare2.decrement:type_name -> otg.PatternFlowGtpv2Spare2Counter - 1237, // 1495: otg.PatternFlowGtpv2Spare2.metric_tags:type_name -> otg.PatternFlowGtpv2Spare2MetricTag - 336, // 1496: otg.PatternFlowArpHardwareType.choice:type_name -> otg.PatternFlowArpHardwareType.Choice.Enum - 1239, // 1497: otg.PatternFlowArpHardwareType.increment:type_name -> otg.PatternFlowArpHardwareTypeCounter - 1239, // 1498: otg.PatternFlowArpHardwareType.decrement:type_name -> otg.PatternFlowArpHardwareTypeCounter - 1240, // 1499: otg.PatternFlowArpHardwareType.metric_tags:type_name -> otg.PatternFlowArpHardwareTypeMetricTag - 337, // 1500: otg.PatternFlowArpProtocolType.choice:type_name -> otg.PatternFlowArpProtocolType.Choice.Enum - 1242, // 1501: otg.PatternFlowArpProtocolType.increment:type_name -> otg.PatternFlowArpProtocolTypeCounter - 1242, // 1502: otg.PatternFlowArpProtocolType.decrement:type_name -> otg.PatternFlowArpProtocolTypeCounter - 1243, // 1503: otg.PatternFlowArpProtocolType.metric_tags:type_name -> otg.PatternFlowArpProtocolTypeMetricTag - 338, // 1504: otg.PatternFlowArpHardwareLength.choice:type_name -> otg.PatternFlowArpHardwareLength.Choice.Enum - 1245, // 1505: otg.PatternFlowArpHardwareLength.increment:type_name -> otg.PatternFlowArpHardwareLengthCounter - 1245, // 1506: otg.PatternFlowArpHardwareLength.decrement:type_name -> otg.PatternFlowArpHardwareLengthCounter - 1246, // 1507: otg.PatternFlowArpHardwareLength.metric_tags:type_name -> otg.PatternFlowArpHardwareLengthMetricTag - 339, // 1508: otg.PatternFlowArpProtocolLength.choice:type_name -> otg.PatternFlowArpProtocolLength.Choice.Enum - 1248, // 1509: otg.PatternFlowArpProtocolLength.increment:type_name -> otg.PatternFlowArpProtocolLengthCounter - 1248, // 1510: otg.PatternFlowArpProtocolLength.decrement:type_name -> otg.PatternFlowArpProtocolLengthCounter - 1249, // 1511: otg.PatternFlowArpProtocolLength.metric_tags:type_name -> otg.PatternFlowArpProtocolLengthMetricTag - 340, // 1512: otg.PatternFlowArpOperation.choice:type_name -> otg.PatternFlowArpOperation.Choice.Enum - 1251, // 1513: otg.PatternFlowArpOperation.increment:type_name -> otg.PatternFlowArpOperationCounter - 1251, // 1514: otg.PatternFlowArpOperation.decrement:type_name -> otg.PatternFlowArpOperationCounter - 1252, // 1515: otg.PatternFlowArpOperation.metric_tags:type_name -> otg.PatternFlowArpOperationMetricTag - 341, // 1516: otg.PatternFlowArpSenderHardwareAddr.choice:type_name -> otg.PatternFlowArpSenderHardwareAddr.Choice.Enum - 1254, // 1517: otg.PatternFlowArpSenderHardwareAddr.increment:type_name -> otg.PatternFlowArpSenderHardwareAddrCounter - 1254, // 1518: otg.PatternFlowArpSenderHardwareAddr.decrement:type_name -> otg.PatternFlowArpSenderHardwareAddrCounter - 1255, // 1519: otg.PatternFlowArpSenderHardwareAddr.metric_tags:type_name -> otg.PatternFlowArpSenderHardwareAddrMetricTag - 342, // 1520: otg.PatternFlowArpSenderProtocolAddr.choice:type_name -> otg.PatternFlowArpSenderProtocolAddr.Choice.Enum - 1257, // 1521: otg.PatternFlowArpSenderProtocolAddr.increment:type_name -> otg.PatternFlowArpSenderProtocolAddrCounter - 1257, // 1522: otg.PatternFlowArpSenderProtocolAddr.decrement:type_name -> otg.PatternFlowArpSenderProtocolAddrCounter - 1258, // 1523: otg.PatternFlowArpSenderProtocolAddr.metric_tags:type_name -> otg.PatternFlowArpSenderProtocolAddrMetricTag - 343, // 1524: otg.PatternFlowArpTargetHardwareAddr.choice:type_name -> otg.PatternFlowArpTargetHardwareAddr.Choice.Enum - 1260, // 1525: otg.PatternFlowArpTargetHardwareAddr.increment:type_name -> otg.PatternFlowArpTargetHardwareAddrCounter - 1260, // 1526: otg.PatternFlowArpTargetHardwareAddr.decrement:type_name -> otg.PatternFlowArpTargetHardwareAddrCounter - 1261, // 1527: otg.PatternFlowArpTargetHardwareAddr.metric_tags:type_name -> otg.PatternFlowArpTargetHardwareAddrMetricTag - 344, // 1528: otg.PatternFlowArpTargetProtocolAddr.choice:type_name -> otg.PatternFlowArpTargetProtocolAddr.Choice.Enum - 1263, // 1529: otg.PatternFlowArpTargetProtocolAddr.increment:type_name -> otg.PatternFlowArpTargetProtocolAddrCounter - 1263, // 1530: otg.PatternFlowArpTargetProtocolAddr.decrement:type_name -> otg.PatternFlowArpTargetProtocolAddrCounter - 1264, // 1531: otg.PatternFlowArpTargetProtocolAddr.metric_tags:type_name -> otg.PatternFlowArpTargetProtocolAddrMetricTag - 345, // 1532: otg.PatternFlowIcmpEchoType.choice:type_name -> otg.PatternFlowIcmpEchoType.Choice.Enum - 1266, // 1533: otg.PatternFlowIcmpEchoType.increment:type_name -> otg.PatternFlowIcmpEchoTypeCounter - 1266, // 1534: otg.PatternFlowIcmpEchoType.decrement:type_name -> otg.PatternFlowIcmpEchoTypeCounter - 1267, // 1535: otg.PatternFlowIcmpEchoType.metric_tags:type_name -> otg.PatternFlowIcmpEchoTypeMetricTag - 346, // 1536: otg.PatternFlowIcmpEchoCode.choice:type_name -> otg.PatternFlowIcmpEchoCode.Choice.Enum - 1269, // 1537: otg.PatternFlowIcmpEchoCode.increment:type_name -> otg.PatternFlowIcmpEchoCodeCounter - 1269, // 1538: otg.PatternFlowIcmpEchoCode.decrement:type_name -> otg.PatternFlowIcmpEchoCodeCounter - 1270, // 1539: otg.PatternFlowIcmpEchoCode.metric_tags:type_name -> otg.PatternFlowIcmpEchoCodeMetricTag - 347, // 1540: otg.PatternFlowIcmpEchoChecksum.choice:type_name -> otg.PatternFlowIcmpEchoChecksum.Choice.Enum - 348, // 1541: otg.PatternFlowIcmpEchoChecksum.generated:type_name -> otg.PatternFlowIcmpEchoChecksum.Generated.Enum - 349, // 1542: otg.PatternFlowIcmpEchoIdentifier.choice:type_name -> otg.PatternFlowIcmpEchoIdentifier.Choice.Enum - 1273, // 1543: otg.PatternFlowIcmpEchoIdentifier.increment:type_name -> otg.PatternFlowIcmpEchoIdentifierCounter - 1273, // 1544: otg.PatternFlowIcmpEchoIdentifier.decrement:type_name -> otg.PatternFlowIcmpEchoIdentifierCounter - 1274, // 1545: otg.PatternFlowIcmpEchoIdentifier.metric_tags:type_name -> otg.PatternFlowIcmpEchoIdentifierMetricTag - 350, // 1546: otg.PatternFlowIcmpEchoSequenceNumber.choice:type_name -> otg.PatternFlowIcmpEchoSequenceNumber.Choice.Enum - 1276, // 1547: otg.PatternFlowIcmpEchoSequenceNumber.increment:type_name -> otg.PatternFlowIcmpEchoSequenceNumberCounter - 1276, // 1548: otg.PatternFlowIcmpEchoSequenceNumber.decrement:type_name -> otg.PatternFlowIcmpEchoSequenceNumberCounter - 1277, // 1549: otg.PatternFlowIcmpEchoSequenceNumber.metric_tags:type_name -> otg.PatternFlowIcmpEchoSequenceNumberMetricTag - 351, // 1550: otg.PatternFlowIcmpCommonChecksum.choice:type_name -> otg.PatternFlowIcmpCommonChecksum.Choice.Enum - 352, // 1551: otg.PatternFlowIcmpCommonChecksum.generated:type_name -> otg.PatternFlowIcmpCommonChecksum.Generated.Enum - 353, // 1552: otg.PatternFlowIcmpNextFieldsIdentifier.choice:type_name -> otg.PatternFlowIcmpNextFieldsIdentifier.Choice.Enum - 1280, // 1553: otg.PatternFlowIcmpNextFieldsIdentifier.increment:type_name -> otg.PatternFlowIcmpNextFieldsIdentifierCounter - 1280, // 1554: otg.PatternFlowIcmpNextFieldsIdentifier.decrement:type_name -> otg.PatternFlowIcmpNextFieldsIdentifierCounter - 1281, // 1555: otg.PatternFlowIcmpNextFieldsIdentifier.metric_tags:type_name -> otg.PatternFlowIcmpNextFieldsIdentifierMetricTag - 354, // 1556: otg.PatternFlowIcmpNextFieldsSequenceNumber.choice:type_name -> otg.PatternFlowIcmpNextFieldsSequenceNumber.Choice.Enum - 1283, // 1557: otg.PatternFlowIcmpNextFieldsSequenceNumber.increment:type_name -> otg.PatternFlowIcmpNextFieldsSequenceNumberCounter - 1283, // 1558: otg.PatternFlowIcmpNextFieldsSequenceNumber.decrement:type_name -> otg.PatternFlowIcmpNextFieldsSequenceNumberCounter - 1284, // 1559: otg.PatternFlowIcmpNextFieldsSequenceNumber.metric_tags:type_name -> otg.PatternFlowIcmpNextFieldsSequenceNumberMetricTag - 355, // 1560: otg.PatternFlowIcmpv6EchoType.choice:type_name -> otg.PatternFlowIcmpv6EchoType.Choice.Enum - 1286, // 1561: otg.PatternFlowIcmpv6EchoType.increment:type_name -> otg.PatternFlowIcmpv6EchoTypeCounter - 1286, // 1562: otg.PatternFlowIcmpv6EchoType.decrement:type_name -> otg.PatternFlowIcmpv6EchoTypeCounter - 1287, // 1563: otg.PatternFlowIcmpv6EchoType.metric_tags:type_name -> otg.PatternFlowIcmpv6EchoTypeMetricTag - 356, // 1564: otg.PatternFlowIcmpv6EchoCode.choice:type_name -> otg.PatternFlowIcmpv6EchoCode.Choice.Enum - 1289, // 1565: otg.PatternFlowIcmpv6EchoCode.increment:type_name -> otg.PatternFlowIcmpv6EchoCodeCounter - 1289, // 1566: otg.PatternFlowIcmpv6EchoCode.decrement:type_name -> otg.PatternFlowIcmpv6EchoCodeCounter - 1290, // 1567: otg.PatternFlowIcmpv6EchoCode.metric_tags:type_name -> otg.PatternFlowIcmpv6EchoCodeMetricTag - 357, // 1568: otg.PatternFlowIcmpv6EchoIdentifier.choice:type_name -> otg.PatternFlowIcmpv6EchoIdentifier.Choice.Enum - 1292, // 1569: otg.PatternFlowIcmpv6EchoIdentifier.increment:type_name -> otg.PatternFlowIcmpv6EchoIdentifierCounter - 1292, // 1570: otg.PatternFlowIcmpv6EchoIdentifier.decrement:type_name -> otg.PatternFlowIcmpv6EchoIdentifierCounter - 1293, // 1571: otg.PatternFlowIcmpv6EchoIdentifier.metric_tags:type_name -> otg.PatternFlowIcmpv6EchoIdentifierMetricTag - 358, // 1572: otg.PatternFlowIcmpv6EchoSequenceNumber.choice:type_name -> otg.PatternFlowIcmpv6EchoSequenceNumber.Choice.Enum - 1295, // 1573: otg.PatternFlowIcmpv6EchoSequenceNumber.increment:type_name -> otg.PatternFlowIcmpv6EchoSequenceNumberCounter - 1295, // 1574: otg.PatternFlowIcmpv6EchoSequenceNumber.decrement:type_name -> otg.PatternFlowIcmpv6EchoSequenceNumberCounter - 1296, // 1575: otg.PatternFlowIcmpv6EchoSequenceNumber.metric_tags:type_name -> otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag - 359, // 1576: otg.PatternFlowIcmpv6EchoChecksum.choice:type_name -> otg.PatternFlowIcmpv6EchoChecksum.Choice.Enum - 360, // 1577: otg.PatternFlowIcmpv6EchoChecksum.generated:type_name -> otg.PatternFlowIcmpv6EchoChecksum.Generated.Enum - 361, // 1578: otg.PatternFlowIcmpv6CommonChecksum.choice:type_name -> otg.PatternFlowIcmpv6CommonChecksum.Choice.Enum - 362, // 1579: otg.PatternFlowIcmpv6CommonChecksum.generated:type_name -> otg.PatternFlowIcmpv6CommonChecksum.Generated.Enum - 363, // 1580: otg.PatternFlowPppAddress.choice:type_name -> otg.PatternFlowPppAddress.Choice.Enum - 1300, // 1581: otg.PatternFlowPppAddress.increment:type_name -> otg.PatternFlowPppAddressCounter - 1300, // 1582: otg.PatternFlowPppAddress.decrement:type_name -> otg.PatternFlowPppAddressCounter - 1301, // 1583: otg.PatternFlowPppAddress.metric_tags:type_name -> otg.PatternFlowPppAddressMetricTag - 364, // 1584: otg.PatternFlowPppControl.choice:type_name -> otg.PatternFlowPppControl.Choice.Enum - 1303, // 1585: otg.PatternFlowPppControl.increment:type_name -> otg.PatternFlowPppControlCounter - 1303, // 1586: otg.PatternFlowPppControl.decrement:type_name -> otg.PatternFlowPppControlCounter - 1304, // 1587: otg.PatternFlowPppControl.metric_tags:type_name -> otg.PatternFlowPppControlMetricTag - 365, // 1588: otg.PatternFlowPppProtocolType.choice:type_name -> otg.PatternFlowPppProtocolType.Choice.Enum - 1306, // 1589: otg.PatternFlowPppProtocolType.increment:type_name -> otg.PatternFlowPppProtocolTypeCounter - 1306, // 1590: otg.PatternFlowPppProtocolType.decrement:type_name -> otg.PatternFlowPppProtocolTypeCounter - 1307, // 1591: otg.PatternFlowPppProtocolType.metric_tags:type_name -> otg.PatternFlowPppProtocolTypeMetricTag - 366, // 1592: otg.PatternFlowIgmpv1Version.choice:type_name -> otg.PatternFlowIgmpv1Version.Choice.Enum - 1309, // 1593: otg.PatternFlowIgmpv1Version.increment:type_name -> otg.PatternFlowIgmpv1VersionCounter - 1309, // 1594: otg.PatternFlowIgmpv1Version.decrement:type_name -> otg.PatternFlowIgmpv1VersionCounter - 1310, // 1595: otg.PatternFlowIgmpv1Version.metric_tags:type_name -> otg.PatternFlowIgmpv1VersionMetricTag - 367, // 1596: otg.PatternFlowIgmpv1Type.choice:type_name -> otg.PatternFlowIgmpv1Type.Choice.Enum - 1312, // 1597: otg.PatternFlowIgmpv1Type.increment:type_name -> otg.PatternFlowIgmpv1TypeCounter - 1312, // 1598: otg.PatternFlowIgmpv1Type.decrement:type_name -> otg.PatternFlowIgmpv1TypeCounter - 1313, // 1599: otg.PatternFlowIgmpv1Type.metric_tags:type_name -> otg.PatternFlowIgmpv1TypeMetricTag - 368, // 1600: otg.PatternFlowIgmpv1Unused.choice:type_name -> otg.PatternFlowIgmpv1Unused.Choice.Enum - 1315, // 1601: otg.PatternFlowIgmpv1Unused.increment:type_name -> otg.PatternFlowIgmpv1UnusedCounter - 1315, // 1602: otg.PatternFlowIgmpv1Unused.decrement:type_name -> otg.PatternFlowIgmpv1UnusedCounter - 1316, // 1603: otg.PatternFlowIgmpv1Unused.metric_tags:type_name -> otg.PatternFlowIgmpv1UnusedMetricTag - 369, // 1604: otg.PatternFlowIgmpv1Checksum.choice:type_name -> otg.PatternFlowIgmpv1Checksum.Choice.Enum - 370, // 1605: otg.PatternFlowIgmpv1Checksum.generated:type_name -> otg.PatternFlowIgmpv1Checksum.Generated.Enum - 371, // 1606: otg.PatternFlowIgmpv1GroupAddress.choice:type_name -> otg.PatternFlowIgmpv1GroupAddress.Choice.Enum - 1319, // 1607: otg.PatternFlowIgmpv1GroupAddress.increment:type_name -> otg.PatternFlowIgmpv1GroupAddressCounter - 1319, // 1608: otg.PatternFlowIgmpv1GroupAddress.decrement:type_name -> otg.PatternFlowIgmpv1GroupAddressCounter - 1320, // 1609: otg.PatternFlowIgmpv1GroupAddress.metric_tags:type_name -> otg.PatternFlowIgmpv1GroupAddressMetricTag - 372, // 1610: otg.PatternFlowMplsLabel.choice:type_name -> otg.PatternFlowMplsLabel.Choice.Enum - 1322, // 1611: otg.PatternFlowMplsLabel.increment:type_name -> otg.PatternFlowMplsLabelCounter - 1322, // 1612: otg.PatternFlowMplsLabel.decrement:type_name -> otg.PatternFlowMplsLabelCounter - 1323, // 1613: otg.PatternFlowMplsLabel.metric_tags:type_name -> otg.PatternFlowMplsLabelMetricTag - 373, // 1614: otg.PatternFlowMplsTrafficClass.choice:type_name -> otg.PatternFlowMplsTrafficClass.Choice.Enum - 1325, // 1615: otg.PatternFlowMplsTrafficClass.increment:type_name -> otg.PatternFlowMplsTrafficClassCounter - 1325, // 1616: otg.PatternFlowMplsTrafficClass.decrement:type_name -> otg.PatternFlowMplsTrafficClassCounter - 1326, // 1617: otg.PatternFlowMplsTrafficClass.metric_tags:type_name -> otg.PatternFlowMplsTrafficClassMetricTag - 374, // 1618: otg.PatternFlowMplsBottomOfStack.choice:type_name -> otg.PatternFlowMplsBottomOfStack.Choice.Enum - 1328, // 1619: otg.PatternFlowMplsBottomOfStack.increment:type_name -> otg.PatternFlowMplsBottomOfStackCounter - 1328, // 1620: otg.PatternFlowMplsBottomOfStack.decrement:type_name -> otg.PatternFlowMplsBottomOfStackCounter - 1329, // 1621: otg.PatternFlowMplsBottomOfStack.metric_tags:type_name -> otg.PatternFlowMplsBottomOfStackMetricTag - 375, // 1622: otg.PatternFlowMplsTimeToLive.choice:type_name -> otg.PatternFlowMplsTimeToLive.Choice.Enum - 1331, // 1623: otg.PatternFlowMplsTimeToLive.increment:type_name -> otg.PatternFlowMplsTimeToLiveCounter - 1331, // 1624: otg.PatternFlowMplsTimeToLive.decrement:type_name -> otg.PatternFlowMplsTimeToLiveCounter - 1332, // 1625: otg.PatternFlowMplsTimeToLive.metric_tags:type_name -> otg.PatternFlowMplsTimeToLiveMetricTag - 376, // 1626: otg.PatternFlowSnmpv2cVersion.choice:type_name -> otg.PatternFlowSnmpv2cVersion.Choice.Enum - 1334, // 1627: otg.PatternFlowSnmpv2cVersion.increment:type_name -> otg.PatternFlowSnmpv2cVersionCounter - 1334, // 1628: otg.PatternFlowSnmpv2cVersion.decrement:type_name -> otg.PatternFlowSnmpv2cVersionCounter - 377, // 1629: otg.PatternFlowSnmpv2cPDURequestId.choice:type_name -> otg.PatternFlowSnmpv2cPDURequestId.Choice.Enum - 1336, // 1630: otg.PatternFlowSnmpv2cPDURequestId.increment:type_name -> otg.PatternFlowSnmpv2cPDURequestIdCounter - 1336, // 1631: otg.PatternFlowSnmpv2cPDURequestId.decrement:type_name -> otg.PatternFlowSnmpv2cPDURequestIdCounter - 378, // 1632: otg.PatternFlowSnmpv2cPDUErrorIndex.choice:type_name -> otg.PatternFlowSnmpv2cPDUErrorIndex.Choice.Enum - 1338, // 1633: otg.PatternFlowSnmpv2cPDUErrorIndex.increment:type_name -> otg.PatternFlowSnmpv2cPDUErrorIndexCounter - 1338, // 1634: otg.PatternFlowSnmpv2cPDUErrorIndex.decrement:type_name -> otg.PatternFlowSnmpv2cPDUErrorIndexCounter - 379, // 1635: otg.PatternFlowSnmpv2cBulkPDURequestId.choice:type_name -> otg.PatternFlowSnmpv2cBulkPDURequestId.Choice.Enum - 1340, // 1636: otg.PatternFlowSnmpv2cBulkPDURequestId.increment:type_name -> otg.PatternFlowSnmpv2cBulkPDURequestIdCounter - 1340, // 1637: otg.PatternFlowSnmpv2cBulkPDURequestId.decrement:type_name -> otg.PatternFlowSnmpv2cBulkPDURequestIdCounter - 380, // 1638: otg.PatternFlowSnmpv2cBulkPDUNonRepeaters.choice:type_name -> otg.PatternFlowSnmpv2cBulkPDUNonRepeaters.Choice.Enum - 381, // 1639: otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions.choice:type_name -> otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions.Choice.Enum - 1343, // 1640: otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions.increment:type_name -> otg.PatternFlowSnmpv2cBulkPDUMaxRepetitionsCounter - 1343, // 1641: otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions.decrement:type_name -> otg.PatternFlowSnmpv2cBulkPDUMaxRepetitionsCounter - 382, // 1642: otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue.choice:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue.Choice.Enum - 1345, // 1643: otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue.increment:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIntegerValueCounter - 1345, // 1644: otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue.decrement:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIntegerValueCounter - 383, // 1645: otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue.choice:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue.Choice.Enum - 1347, // 1646: otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue.increment:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValueCounter - 1347, // 1647: otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue.decrement:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValueCounter - 384, // 1648: otg.PatternFlowSnmpv2cVariableBindingValueCounterValue.choice:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueCounterValue.Choice.Enum - 1349, // 1649: otg.PatternFlowSnmpv2cVariableBindingValueCounterValue.increment:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueCounterValueCounter - 1349, // 1650: otg.PatternFlowSnmpv2cVariableBindingValueCounterValue.decrement:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueCounterValueCounter - 385, // 1651: otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue.choice:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue.Choice.Enum - 1351, // 1652: otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue.increment:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValueCounter - 1351, // 1653: otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue.decrement:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValueCounter - 386, // 1654: otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue.choice:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue.Choice.Enum - 1353, // 1655: otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue.increment:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValueCounter - 1353, // 1656: otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue.decrement:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValueCounter - 387, // 1657: otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue.choice:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue.Choice.Enum - 1355, // 1658: otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue.increment:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValueCounter - 1355, // 1659: otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue.decrement:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValueCounter - 388, // 1660: otg.PatternFlowSnmpv2cCommonRequestId.choice:type_name -> otg.PatternFlowSnmpv2cCommonRequestId.Choice.Enum - 1357, // 1661: otg.PatternFlowSnmpv2cCommonRequestId.increment:type_name -> otg.PatternFlowSnmpv2cCommonRequestIdCounter - 1357, // 1662: otg.PatternFlowSnmpv2cCommonRequestId.decrement:type_name -> otg.PatternFlowSnmpv2cCommonRequestIdCounter - 389, // 1663: otg.PatternFlowRsvpRsvpChecksum.choice:type_name -> otg.PatternFlowRsvpRsvpChecksum.Choice.Enum - 390, // 1664: otg.PatternFlowRsvpRsvpChecksum.generated:type_name -> otg.PatternFlowRsvpRsvpChecksum.Generated.Enum - 391, // 1665: otg.PatternFlowRsvpTimeToLive.choice:type_name -> otg.PatternFlowRsvpTimeToLive.Choice.Enum - 1360, // 1666: otg.PatternFlowRsvpTimeToLive.increment:type_name -> otg.PatternFlowRsvpTimeToLiveCounter - 1360, // 1667: otg.PatternFlowRsvpTimeToLive.decrement:type_name -> otg.PatternFlowRsvpTimeToLiveCounter - 392, // 1668: otg.PatternFlowRsvpReserved.choice:type_name -> otg.PatternFlowRsvpReserved.Choice.Enum - 1362, // 1669: otg.PatternFlowRsvpReserved.increment:type_name -> otg.PatternFlowRsvpReservedCounter - 1362, // 1670: otg.PatternFlowRsvpReserved.decrement:type_name -> otg.PatternFlowRsvpReservedCounter - 393, // 1671: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.choice:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.Choice.Enum - 1364, // 1672: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.increment:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - 1364, // 1673: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.decrement:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - 394, // 1674: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.choice:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.Choice.Enum - 1366, // 1675: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.increment:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - 1366, // 1676: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.decrement:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - 395, // 1677: otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.choice:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.Choice.Enum - 1368, // 1678: otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.increment:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - 1368, // 1679: otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.decrement:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - 396, // 1680: otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger.choice:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger.Choice.Enum - 1370, // 1681: otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger.increment:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - 1370, // 1682: otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger.decrement:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - 397, // 1683: otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.choice:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.Choice.Enum - 1372, // 1684: otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.increment:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - 1372, // 1685: otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.decrement:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - 398, // 1686: otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.choice:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.Choice.Enum - 1374, // 1687: otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.increment:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - 1374, // 1688: otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.decrement:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - 399, // 1689: otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle.choice:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle.Choice.Enum - 1376, // 1690: otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle.increment:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - 1376, // 1691: otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle.decrement:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - 400, // 1692: otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR.choice:type_name -> otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR.Choice.Enum - 1378, // 1693: otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR.increment:type_name -> otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - 1378, // 1694: otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR.decrement:type_name -> otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - 401, // 1695: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.choice:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.Choice.Enum - 1380, // 1696: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.increment:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - 1380, // 1697: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.decrement:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - 402, // 1698: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.choice:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.Choice.Enum - 1382, // 1699: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.increment:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - 1382, // 1700: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.decrement:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - 403, // 1701: otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.choice:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.Choice.Enum - 1384, // 1702: otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.increment:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - 1384, // 1703: otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.decrement:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - 404, // 1704: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.choice:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.Choice.Enum - 1386, // 1705: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.increment:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - 1386, // 1706: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.decrement:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - 405, // 1707: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid.choice:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid.Choice.Enum - 1388, // 1708: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid.increment:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pidCounter - 1388, // 1709: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid.decrement:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pidCounter - 406, // 1710: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.choice:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.Choice.Enum - 1390, // 1711: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.increment:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - 1390, // 1712: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.decrement:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - 407, // 1713: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.choice:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.Choice.Enum - 1392, // 1714: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.increment:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - 1392, // 1715: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.decrement:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - 408, // 1716: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.choice:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.Choice.Enum - 1394, // 1717: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.increment:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - 1394, // 1718: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.decrement:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - 409, // 1719: otg.PatternFlowRSVPPathSenderTspecIntServVersion.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServVersion.Choice.Enum - 1396, // 1720: otg.PatternFlowRSVPPathSenderTspecIntServVersion.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter - 1396, // 1721: otg.PatternFlowRSVPPathSenderTspecIntServVersion.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter - 410, // 1722: otg.PatternFlowRSVPPathSenderTspecIntServReserved1.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved1.Choice.Enum - 1398, // 1723: otg.PatternFlowRSVPPathSenderTspecIntServReserved1.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter - 1398, // 1724: otg.PatternFlowRSVPPathSenderTspecIntServReserved1.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter - 411, // 1725: otg.PatternFlowRSVPPathSenderTspecIntServOverallLength.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServOverallLength.Choice.Enum - 1400, // 1726: otg.PatternFlowRSVPPathSenderTspecIntServOverallLength.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - 1400, // 1727: otg.PatternFlowRSVPPathSenderTspecIntServOverallLength.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - 412, // 1728: otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader.Choice.Enum - 1402, // 1729: otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - 1402, // 1730: otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - 413, // 1731: otg.PatternFlowRSVPPathSenderTspecIntServZeroBit.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServZeroBit.Choice.Enum - 1404, // 1732: otg.PatternFlowRSVPPathSenderTspecIntServZeroBit.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - 1404, // 1733: otg.PatternFlowRSVPPathSenderTspecIntServZeroBit.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - 414, // 1734: otg.PatternFlowRSVPPathSenderTspecIntServReserved2.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved2.Choice.Enum - 1406, // 1735: otg.PatternFlowRSVPPathSenderTspecIntServReserved2.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter - 1406, // 1736: otg.PatternFlowRSVPPathSenderTspecIntServReserved2.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter - 415, // 1737: otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.Choice.Enum - 1408, // 1738: otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - 1408, // 1739: otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - 416, // 1740: otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.Choice.Enum - 1410, // 1741: otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - 1410, // 1742: otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - 417, // 1743: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag.Choice.Enum - 1412, // 1744: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - 1412, // 1745: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - 418, // 1746: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length.Choice.Enum - 1414, // 1747: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - 1414, // 1748: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - 419, // 1749: otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit.Choice.Enum - 1416, // 1750: otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - 1416, // 1751: otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - 420, // 1752: otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize.Choice.Enum - 1418, // 1753: otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - 1418, // 1754: otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - 421, // 1755: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.choice:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.Choice.Enum - 1420, // 1756: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.increment:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - 1420, // 1757: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.decrement:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - 422, // 1758: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.choice:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.Choice.Enum - 1422, // 1759: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.increment:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - 1422, // 1760: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.decrement:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - 423, // 1761: otg.PatternFlowRSVPPathRecordRouteType1LabelFlags.choice:type_name -> otg.PatternFlowRSVPPathRecordRouteType1LabelFlags.Choice.Enum - 424, // 1762: otg.PatternFlowRSVPPathRecordRouteType1LabelCType.choice:type_name -> otg.PatternFlowRSVPPathRecordRouteType1LabelCType.Choice.Enum - 425, // 1763: otg.PatternFlowRSVPPathObjectsCustomType.choice:type_name -> otg.PatternFlowRSVPPathObjectsCustomType.Choice.Enum - 1426, // 1764: otg.PatternFlowRSVPPathObjectsCustomType.increment:type_name -> otg.PatternFlowRSVPPathObjectsCustomTypeCounter - 1426, // 1765: otg.PatternFlowRSVPPathObjectsCustomType.decrement:type_name -> otg.PatternFlowRSVPPathObjectsCustomTypeCounter - 777, // 1766: otg.Success.warning:type_name -> otg.Warning - 776, // 1767: otg.Failure.error:type_name -> otg.Error - 426, // 1768: otg.SetConfigRequest.config:type_name -> otg.Config - 778, // 1769: otg.UpdateConfigRequest.config_update:type_name -> otg.ConfigUpdate - 777, // 1770: otg.SetConfigResponse.warning:type_name -> otg.Warning - 426, // 1771: otg.GetConfigResponse.config:type_name -> otg.Config - 777, // 1772: otg.UpdateConfigResponse.warning:type_name -> otg.Warning - 780, // 1773: otg.SetControlStateRequest.control_state:type_name -> otg.ControlState - 777, // 1774: otg.SetControlStateResponse.warning:type_name -> otg.Warning - 796, // 1775: otg.SetControlActionRequest.control_action:type_name -> otg.ControlAction - 797, // 1776: otg.SetControlActionResponse.control_action_response:type_name -> otg.ControlActionResponse - 816, // 1777: otg.GetMetricsRequest.metrics_request:type_name -> otg.MetricsRequest - 817, // 1778: otg.GetMetricsResponse.metrics_response:type_name -> otg.MetricsResponse - 847, // 1779: otg.GetStatesRequest.states_request:type_name -> otg.StatesRequest - 848, // 1780: otg.GetStatesResponse.states_response:type_name -> otg.StatesResponse - 910, // 1781: otg.GetCaptureRequest.capture_request:type_name -> otg.CaptureRequest - 1428, // 1782: otg.GetVersionResponse.version:type_name -> otg.Version - 1431, // 1783: otg.Openapi.SetConfig:input_type -> otg.SetConfigRequest - 1873, // 1784: otg.Openapi.GetConfig:input_type -> google.protobuf.Empty - 1432, // 1785: otg.Openapi.UpdateConfig:input_type -> otg.UpdateConfigRequest - 1436, // 1786: otg.Openapi.SetControlState:input_type -> otg.SetControlStateRequest - 1438, // 1787: otg.Openapi.SetControlAction:input_type -> otg.SetControlActionRequest - 1440, // 1788: otg.Openapi.GetMetrics:input_type -> otg.GetMetricsRequest - 1442, // 1789: otg.Openapi.GetStates:input_type -> otg.GetStatesRequest - 1444, // 1790: otg.Openapi.GetCapture:input_type -> otg.GetCaptureRequest - 1873, // 1791: otg.Openapi.GetVersion:input_type -> google.protobuf.Empty - 1433, // 1792: otg.Openapi.SetConfig:output_type -> otg.SetConfigResponse - 1434, // 1793: otg.Openapi.GetConfig:output_type -> otg.GetConfigResponse - 1435, // 1794: otg.Openapi.UpdateConfig:output_type -> otg.UpdateConfigResponse - 1437, // 1795: otg.Openapi.SetControlState:output_type -> otg.SetControlStateResponse - 1439, // 1796: otg.Openapi.SetControlAction:output_type -> otg.SetControlActionResponse - 1441, // 1797: otg.Openapi.GetMetrics:output_type -> otg.GetMetricsResponse - 1443, // 1798: otg.Openapi.GetStates:output_type -> otg.GetStatesResponse - 1445, // 1799: otg.Openapi.GetCapture:output_type -> otg.GetCaptureResponse - 1446, // 1800: otg.Openapi.GetVersion:output_type -> otg.GetVersionResponse - 1792, // [1792:1801] is the sub-list for method output_type - 1783, // [1783:1792] is the sub-list for method input_type - 1783, // [1783:1783] is the sub-list for extension type_name - 1783, // [1783:1783] is the sub-list for extension extendee - 0, // [0:1783] is the sub-list for field type_name + 980, // 1148: otg.PatternFlowIpv4Src.random:type_name -> otg.PatternFlowIpv4SrcRandom + 244, // 1149: otg.PatternFlowIpv4Dst.choice:type_name -> otg.PatternFlowIpv4Dst.Choice.Enum + 982, // 1150: otg.PatternFlowIpv4Dst.increment:type_name -> otg.PatternFlowIpv4DstCounter + 982, // 1151: otg.PatternFlowIpv4Dst.decrement:type_name -> otg.PatternFlowIpv4DstCounter + 983, // 1152: otg.PatternFlowIpv4Dst.metric_tags:type_name -> otg.PatternFlowIpv4DstMetricTag + 668, // 1153: otg.PatternFlowIpv4Dst.auto:type_name -> otg.FlowIpv4Auto + 984, // 1154: otg.PatternFlowIpv4Dst.random:type_name -> otg.PatternFlowIpv4DstRandom + 245, // 1155: otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag.choice:type_name -> otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag.Choice.Enum + 986, // 1156: otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag.increment:type_name -> otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + 986, // 1157: otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag.decrement:type_name -> otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + 246, // 1158: otg.PatternFlowIpv4OptionsCustomTypeOptionClass.choice:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionClass.Choice.Enum + 988, // 1159: otg.PatternFlowIpv4OptionsCustomTypeOptionClass.increment:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter + 988, // 1160: otg.PatternFlowIpv4OptionsCustomTypeOptionClass.decrement:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter + 247, // 1161: otg.PatternFlowIpv4OptionsCustomTypeOptionNumber.choice:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionNumber.Choice.Enum + 990, // 1162: otg.PatternFlowIpv4OptionsCustomTypeOptionNumber.increment:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + 990, // 1163: otg.PatternFlowIpv4OptionsCustomTypeOptionNumber.decrement:type_name -> otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + 248, // 1164: otg.PatternFlowIpv4PriorityRaw.choice:type_name -> otg.PatternFlowIpv4PriorityRaw.Choice.Enum + 992, // 1165: otg.PatternFlowIpv4PriorityRaw.increment:type_name -> otg.PatternFlowIpv4PriorityRawCounter + 992, // 1166: otg.PatternFlowIpv4PriorityRaw.decrement:type_name -> otg.PatternFlowIpv4PriorityRawCounter + 993, // 1167: otg.PatternFlowIpv4PriorityRaw.metric_tags:type_name -> otg.PatternFlowIpv4PriorityRawMetricTag + 249, // 1168: otg.PatternFlowIpv4DscpPhb.choice:type_name -> otg.PatternFlowIpv4DscpPhb.Choice.Enum + 995, // 1169: otg.PatternFlowIpv4DscpPhb.increment:type_name -> otg.PatternFlowIpv4DscpPhbCounter + 995, // 1170: otg.PatternFlowIpv4DscpPhb.decrement:type_name -> otg.PatternFlowIpv4DscpPhbCounter + 996, // 1171: otg.PatternFlowIpv4DscpPhb.metric_tags:type_name -> otg.PatternFlowIpv4DscpPhbMetricTag + 250, // 1172: otg.PatternFlowIpv4DscpEcn.choice:type_name -> otg.PatternFlowIpv4DscpEcn.Choice.Enum + 998, // 1173: otg.PatternFlowIpv4DscpEcn.increment:type_name -> otg.PatternFlowIpv4DscpEcnCounter + 998, // 1174: otg.PatternFlowIpv4DscpEcn.decrement:type_name -> otg.PatternFlowIpv4DscpEcnCounter + 999, // 1175: otg.PatternFlowIpv4DscpEcn.metric_tags:type_name -> otg.PatternFlowIpv4DscpEcnMetricTag + 251, // 1176: otg.PatternFlowIpv4TosPrecedence.choice:type_name -> otg.PatternFlowIpv4TosPrecedence.Choice.Enum + 1001, // 1177: otg.PatternFlowIpv4TosPrecedence.increment:type_name -> otg.PatternFlowIpv4TosPrecedenceCounter + 1001, // 1178: otg.PatternFlowIpv4TosPrecedence.decrement:type_name -> otg.PatternFlowIpv4TosPrecedenceCounter + 1002, // 1179: otg.PatternFlowIpv4TosPrecedence.metric_tags:type_name -> otg.PatternFlowIpv4TosPrecedenceMetricTag + 252, // 1180: otg.PatternFlowIpv4TosDelay.choice:type_name -> otg.PatternFlowIpv4TosDelay.Choice.Enum + 1004, // 1181: otg.PatternFlowIpv4TosDelay.increment:type_name -> otg.PatternFlowIpv4TosDelayCounter + 1004, // 1182: otg.PatternFlowIpv4TosDelay.decrement:type_name -> otg.PatternFlowIpv4TosDelayCounter + 1005, // 1183: otg.PatternFlowIpv4TosDelay.metric_tags:type_name -> otg.PatternFlowIpv4TosDelayMetricTag + 253, // 1184: otg.PatternFlowIpv4TosThroughput.choice:type_name -> otg.PatternFlowIpv4TosThroughput.Choice.Enum + 1007, // 1185: otg.PatternFlowIpv4TosThroughput.increment:type_name -> otg.PatternFlowIpv4TosThroughputCounter + 1007, // 1186: otg.PatternFlowIpv4TosThroughput.decrement:type_name -> otg.PatternFlowIpv4TosThroughputCounter + 1008, // 1187: otg.PatternFlowIpv4TosThroughput.metric_tags:type_name -> otg.PatternFlowIpv4TosThroughputMetricTag + 254, // 1188: otg.PatternFlowIpv4TosReliability.choice:type_name -> otg.PatternFlowIpv4TosReliability.Choice.Enum + 1010, // 1189: otg.PatternFlowIpv4TosReliability.increment:type_name -> otg.PatternFlowIpv4TosReliabilityCounter + 1010, // 1190: otg.PatternFlowIpv4TosReliability.decrement:type_name -> otg.PatternFlowIpv4TosReliabilityCounter + 1011, // 1191: otg.PatternFlowIpv4TosReliability.metric_tags:type_name -> otg.PatternFlowIpv4TosReliabilityMetricTag + 255, // 1192: otg.PatternFlowIpv4TosMonetary.choice:type_name -> otg.PatternFlowIpv4TosMonetary.Choice.Enum + 1013, // 1193: otg.PatternFlowIpv4TosMonetary.increment:type_name -> otg.PatternFlowIpv4TosMonetaryCounter + 1013, // 1194: otg.PatternFlowIpv4TosMonetary.decrement:type_name -> otg.PatternFlowIpv4TosMonetaryCounter + 1014, // 1195: otg.PatternFlowIpv4TosMonetary.metric_tags:type_name -> otg.PatternFlowIpv4TosMonetaryMetricTag + 256, // 1196: otg.PatternFlowIpv4TosUnused.choice:type_name -> otg.PatternFlowIpv4TosUnused.Choice.Enum + 1016, // 1197: otg.PatternFlowIpv4TosUnused.increment:type_name -> otg.PatternFlowIpv4TosUnusedCounter + 1016, // 1198: otg.PatternFlowIpv4TosUnused.decrement:type_name -> otg.PatternFlowIpv4TosUnusedCounter + 1017, // 1199: otg.PatternFlowIpv4TosUnused.metric_tags:type_name -> otg.PatternFlowIpv4TosUnusedMetricTag + 257, // 1200: otg.PatternFlowIpv6Version.choice:type_name -> otg.PatternFlowIpv6Version.Choice.Enum + 1019, // 1201: otg.PatternFlowIpv6Version.increment:type_name -> otg.PatternFlowIpv6VersionCounter + 1019, // 1202: otg.PatternFlowIpv6Version.decrement:type_name -> otg.PatternFlowIpv6VersionCounter + 1020, // 1203: otg.PatternFlowIpv6Version.metric_tags:type_name -> otg.PatternFlowIpv6VersionMetricTag + 258, // 1204: otg.PatternFlowIpv6TrafficClass.choice:type_name -> otg.PatternFlowIpv6TrafficClass.Choice.Enum + 1022, // 1205: otg.PatternFlowIpv6TrafficClass.increment:type_name -> otg.PatternFlowIpv6TrafficClassCounter + 1022, // 1206: otg.PatternFlowIpv6TrafficClass.decrement:type_name -> otg.PatternFlowIpv6TrafficClassCounter + 1023, // 1207: otg.PatternFlowIpv6TrafficClass.metric_tags:type_name -> otg.PatternFlowIpv6TrafficClassMetricTag + 259, // 1208: otg.PatternFlowIpv6FlowLabel.choice:type_name -> otg.PatternFlowIpv6FlowLabel.Choice.Enum + 1025, // 1209: otg.PatternFlowIpv6FlowLabel.increment:type_name -> otg.PatternFlowIpv6FlowLabelCounter + 1025, // 1210: otg.PatternFlowIpv6FlowLabel.decrement:type_name -> otg.PatternFlowIpv6FlowLabelCounter + 1026, // 1211: otg.PatternFlowIpv6FlowLabel.metric_tags:type_name -> otg.PatternFlowIpv6FlowLabelMetricTag + 1027, // 1212: otg.PatternFlowIpv6FlowLabel.random:type_name -> otg.PatternFlowIpv6FlowLabelRandom + 260, // 1213: otg.PatternFlowIpv6PayloadLength.choice:type_name -> otg.PatternFlowIpv6PayloadLength.Choice.Enum + 1029, // 1214: otg.PatternFlowIpv6PayloadLength.increment:type_name -> otg.PatternFlowIpv6PayloadLengthCounter + 1029, // 1215: otg.PatternFlowIpv6PayloadLength.decrement:type_name -> otg.PatternFlowIpv6PayloadLengthCounter + 1030, // 1216: otg.PatternFlowIpv6PayloadLength.metric_tags:type_name -> otg.PatternFlowIpv6PayloadLengthMetricTag + 261, // 1217: otg.PatternFlowIpv6NextHeader.choice:type_name -> otg.PatternFlowIpv6NextHeader.Choice.Enum + 1032, // 1218: otg.PatternFlowIpv6NextHeader.increment:type_name -> otg.PatternFlowIpv6NextHeaderCounter + 1032, // 1219: otg.PatternFlowIpv6NextHeader.decrement:type_name -> otg.PatternFlowIpv6NextHeaderCounter + 1033, // 1220: otg.PatternFlowIpv6NextHeader.metric_tags:type_name -> otg.PatternFlowIpv6NextHeaderMetricTag + 262, // 1221: otg.PatternFlowIpv6HopLimit.choice:type_name -> otg.PatternFlowIpv6HopLimit.Choice.Enum + 1035, // 1222: otg.PatternFlowIpv6HopLimit.increment:type_name -> otg.PatternFlowIpv6HopLimitCounter + 1035, // 1223: otg.PatternFlowIpv6HopLimit.decrement:type_name -> otg.PatternFlowIpv6HopLimitCounter + 1036, // 1224: otg.PatternFlowIpv6HopLimit.metric_tags:type_name -> otg.PatternFlowIpv6HopLimitMetricTag + 263, // 1225: otg.PatternFlowIpv6Src.choice:type_name -> otg.PatternFlowIpv6Src.Choice.Enum + 1038, // 1226: otg.PatternFlowIpv6Src.increment:type_name -> otg.PatternFlowIpv6SrcCounter + 1038, // 1227: otg.PatternFlowIpv6Src.decrement:type_name -> otg.PatternFlowIpv6SrcCounter + 1039, // 1228: otg.PatternFlowIpv6Src.metric_tags:type_name -> otg.PatternFlowIpv6SrcMetricTag + 264, // 1229: otg.PatternFlowIpv6Dst.choice:type_name -> otg.PatternFlowIpv6Dst.Choice.Enum + 1041, // 1230: otg.PatternFlowIpv6Dst.increment:type_name -> otg.PatternFlowIpv6DstCounter + 1041, // 1231: otg.PatternFlowIpv6Dst.decrement:type_name -> otg.PatternFlowIpv6DstCounter + 1042, // 1232: otg.PatternFlowIpv6Dst.metric_tags:type_name -> otg.PatternFlowIpv6DstMetricTag + 265, // 1233: otg.PatternFlowPfcPauseDst.choice:type_name -> otg.PatternFlowPfcPauseDst.Choice.Enum + 1044, // 1234: otg.PatternFlowPfcPauseDst.increment:type_name -> otg.PatternFlowPfcPauseDstCounter + 1044, // 1235: otg.PatternFlowPfcPauseDst.decrement:type_name -> otg.PatternFlowPfcPauseDstCounter + 1045, // 1236: otg.PatternFlowPfcPauseDst.metric_tags:type_name -> otg.PatternFlowPfcPauseDstMetricTag + 266, // 1237: otg.PatternFlowPfcPauseSrc.choice:type_name -> otg.PatternFlowPfcPauseSrc.Choice.Enum + 1047, // 1238: otg.PatternFlowPfcPauseSrc.increment:type_name -> otg.PatternFlowPfcPauseSrcCounter + 1047, // 1239: otg.PatternFlowPfcPauseSrc.decrement:type_name -> otg.PatternFlowPfcPauseSrcCounter + 1048, // 1240: otg.PatternFlowPfcPauseSrc.metric_tags:type_name -> otg.PatternFlowPfcPauseSrcMetricTag + 267, // 1241: otg.PatternFlowPfcPauseEtherType.choice:type_name -> otg.PatternFlowPfcPauseEtherType.Choice.Enum + 1050, // 1242: otg.PatternFlowPfcPauseEtherType.increment:type_name -> otg.PatternFlowPfcPauseEtherTypeCounter + 1050, // 1243: otg.PatternFlowPfcPauseEtherType.decrement:type_name -> otg.PatternFlowPfcPauseEtherTypeCounter + 1051, // 1244: otg.PatternFlowPfcPauseEtherType.metric_tags:type_name -> otg.PatternFlowPfcPauseEtherTypeMetricTag + 268, // 1245: otg.PatternFlowPfcPauseControlOpCode.choice:type_name -> otg.PatternFlowPfcPauseControlOpCode.Choice.Enum + 1053, // 1246: otg.PatternFlowPfcPauseControlOpCode.increment:type_name -> otg.PatternFlowPfcPauseControlOpCodeCounter + 1053, // 1247: otg.PatternFlowPfcPauseControlOpCode.decrement:type_name -> otg.PatternFlowPfcPauseControlOpCodeCounter + 1054, // 1248: otg.PatternFlowPfcPauseControlOpCode.metric_tags:type_name -> otg.PatternFlowPfcPauseControlOpCodeMetricTag + 269, // 1249: otg.PatternFlowPfcPauseClassEnableVector.choice:type_name -> otg.PatternFlowPfcPauseClassEnableVector.Choice.Enum + 1056, // 1250: otg.PatternFlowPfcPauseClassEnableVector.increment:type_name -> otg.PatternFlowPfcPauseClassEnableVectorCounter + 1056, // 1251: otg.PatternFlowPfcPauseClassEnableVector.decrement:type_name -> otg.PatternFlowPfcPauseClassEnableVectorCounter + 1057, // 1252: otg.PatternFlowPfcPauseClassEnableVector.metric_tags:type_name -> otg.PatternFlowPfcPauseClassEnableVectorMetricTag + 270, // 1253: otg.PatternFlowPfcPausePauseClass0.choice:type_name -> otg.PatternFlowPfcPausePauseClass0.Choice.Enum + 1059, // 1254: otg.PatternFlowPfcPausePauseClass0.increment:type_name -> otg.PatternFlowPfcPausePauseClass0Counter + 1059, // 1255: otg.PatternFlowPfcPausePauseClass0.decrement:type_name -> otg.PatternFlowPfcPausePauseClass0Counter + 1060, // 1256: otg.PatternFlowPfcPausePauseClass0.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass0MetricTag + 271, // 1257: otg.PatternFlowPfcPausePauseClass1.choice:type_name -> otg.PatternFlowPfcPausePauseClass1.Choice.Enum + 1062, // 1258: otg.PatternFlowPfcPausePauseClass1.increment:type_name -> otg.PatternFlowPfcPausePauseClass1Counter + 1062, // 1259: otg.PatternFlowPfcPausePauseClass1.decrement:type_name -> otg.PatternFlowPfcPausePauseClass1Counter + 1063, // 1260: otg.PatternFlowPfcPausePauseClass1.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass1MetricTag + 272, // 1261: otg.PatternFlowPfcPausePauseClass2.choice:type_name -> otg.PatternFlowPfcPausePauseClass2.Choice.Enum + 1065, // 1262: otg.PatternFlowPfcPausePauseClass2.increment:type_name -> otg.PatternFlowPfcPausePauseClass2Counter + 1065, // 1263: otg.PatternFlowPfcPausePauseClass2.decrement:type_name -> otg.PatternFlowPfcPausePauseClass2Counter + 1066, // 1264: otg.PatternFlowPfcPausePauseClass2.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass2MetricTag + 273, // 1265: otg.PatternFlowPfcPausePauseClass3.choice:type_name -> otg.PatternFlowPfcPausePauseClass3.Choice.Enum + 1068, // 1266: otg.PatternFlowPfcPausePauseClass3.increment:type_name -> otg.PatternFlowPfcPausePauseClass3Counter + 1068, // 1267: otg.PatternFlowPfcPausePauseClass3.decrement:type_name -> otg.PatternFlowPfcPausePauseClass3Counter + 1069, // 1268: otg.PatternFlowPfcPausePauseClass3.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass3MetricTag + 274, // 1269: otg.PatternFlowPfcPausePauseClass4.choice:type_name -> otg.PatternFlowPfcPausePauseClass4.Choice.Enum + 1071, // 1270: otg.PatternFlowPfcPausePauseClass4.increment:type_name -> otg.PatternFlowPfcPausePauseClass4Counter + 1071, // 1271: otg.PatternFlowPfcPausePauseClass4.decrement:type_name -> otg.PatternFlowPfcPausePauseClass4Counter + 1072, // 1272: otg.PatternFlowPfcPausePauseClass4.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass4MetricTag + 275, // 1273: otg.PatternFlowPfcPausePauseClass5.choice:type_name -> otg.PatternFlowPfcPausePauseClass5.Choice.Enum + 1074, // 1274: otg.PatternFlowPfcPausePauseClass5.increment:type_name -> otg.PatternFlowPfcPausePauseClass5Counter + 1074, // 1275: otg.PatternFlowPfcPausePauseClass5.decrement:type_name -> otg.PatternFlowPfcPausePauseClass5Counter + 1075, // 1276: otg.PatternFlowPfcPausePauseClass5.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass5MetricTag + 276, // 1277: otg.PatternFlowPfcPausePauseClass6.choice:type_name -> otg.PatternFlowPfcPausePauseClass6.Choice.Enum + 1077, // 1278: otg.PatternFlowPfcPausePauseClass6.increment:type_name -> otg.PatternFlowPfcPausePauseClass6Counter + 1077, // 1279: otg.PatternFlowPfcPausePauseClass6.decrement:type_name -> otg.PatternFlowPfcPausePauseClass6Counter + 1078, // 1280: otg.PatternFlowPfcPausePauseClass6.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass6MetricTag + 277, // 1281: otg.PatternFlowPfcPausePauseClass7.choice:type_name -> otg.PatternFlowPfcPausePauseClass7.Choice.Enum + 1080, // 1282: otg.PatternFlowPfcPausePauseClass7.increment:type_name -> otg.PatternFlowPfcPausePauseClass7Counter + 1080, // 1283: otg.PatternFlowPfcPausePauseClass7.decrement:type_name -> otg.PatternFlowPfcPausePauseClass7Counter + 1081, // 1284: otg.PatternFlowPfcPausePauseClass7.metric_tags:type_name -> otg.PatternFlowPfcPausePauseClass7MetricTag + 278, // 1285: otg.PatternFlowEthernetPauseDst.choice:type_name -> otg.PatternFlowEthernetPauseDst.Choice.Enum + 1083, // 1286: otg.PatternFlowEthernetPauseDst.increment:type_name -> otg.PatternFlowEthernetPauseDstCounter + 1083, // 1287: otg.PatternFlowEthernetPauseDst.decrement:type_name -> otg.PatternFlowEthernetPauseDstCounter + 1084, // 1288: otg.PatternFlowEthernetPauseDst.metric_tags:type_name -> otg.PatternFlowEthernetPauseDstMetricTag + 279, // 1289: otg.PatternFlowEthernetPauseSrc.choice:type_name -> otg.PatternFlowEthernetPauseSrc.Choice.Enum + 1086, // 1290: otg.PatternFlowEthernetPauseSrc.increment:type_name -> otg.PatternFlowEthernetPauseSrcCounter + 1086, // 1291: otg.PatternFlowEthernetPauseSrc.decrement:type_name -> otg.PatternFlowEthernetPauseSrcCounter + 1087, // 1292: otg.PatternFlowEthernetPauseSrc.metric_tags:type_name -> otg.PatternFlowEthernetPauseSrcMetricTag + 280, // 1293: otg.PatternFlowEthernetPauseEtherType.choice:type_name -> otg.PatternFlowEthernetPauseEtherType.Choice.Enum + 1089, // 1294: otg.PatternFlowEthernetPauseEtherType.increment:type_name -> otg.PatternFlowEthernetPauseEtherTypeCounter + 1089, // 1295: otg.PatternFlowEthernetPauseEtherType.decrement:type_name -> otg.PatternFlowEthernetPauseEtherTypeCounter + 1090, // 1296: otg.PatternFlowEthernetPauseEtherType.metric_tags:type_name -> otg.PatternFlowEthernetPauseEtherTypeMetricTag + 281, // 1297: otg.PatternFlowEthernetPauseControlOpCode.choice:type_name -> otg.PatternFlowEthernetPauseControlOpCode.Choice.Enum + 1092, // 1298: otg.PatternFlowEthernetPauseControlOpCode.increment:type_name -> otg.PatternFlowEthernetPauseControlOpCodeCounter + 1092, // 1299: otg.PatternFlowEthernetPauseControlOpCode.decrement:type_name -> otg.PatternFlowEthernetPauseControlOpCodeCounter + 1093, // 1300: otg.PatternFlowEthernetPauseControlOpCode.metric_tags:type_name -> otg.PatternFlowEthernetPauseControlOpCodeMetricTag + 282, // 1301: otg.PatternFlowEthernetPauseTime.choice:type_name -> otg.PatternFlowEthernetPauseTime.Choice.Enum + 1095, // 1302: otg.PatternFlowEthernetPauseTime.increment:type_name -> otg.PatternFlowEthernetPauseTimeCounter + 1095, // 1303: otg.PatternFlowEthernetPauseTime.decrement:type_name -> otg.PatternFlowEthernetPauseTimeCounter + 1096, // 1304: otg.PatternFlowEthernetPauseTime.metric_tags:type_name -> otg.PatternFlowEthernetPauseTimeMetricTag + 283, // 1305: otg.PatternFlowTcpSrcPort.choice:type_name -> otg.PatternFlowTcpSrcPort.Choice.Enum + 1098, // 1306: otg.PatternFlowTcpSrcPort.increment:type_name -> otg.PatternFlowTcpSrcPortCounter + 1098, // 1307: otg.PatternFlowTcpSrcPort.decrement:type_name -> otg.PatternFlowTcpSrcPortCounter + 1099, // 1308: otg.PatternFlowTcpSrcPort.metric_tags:type_name -> otg.PatternFlowTcpSrcPortMetricTag + 1100, // 1309: otg.PatternFlowTcpSrcPort.random:type_name -> otg.PatternFlowTcpSrcPortRandom + 284, // 1310: otg.PatternFlowTcpDstPort.choice:type_name -> otg.PatternFlowTcpDstPort.Choice.Enum + 1102, // 1311: otg.PatternFlowTcpDstPort.increment:type_name -> otg.PatternFlowTcpDstPortCounter + 1102, // 1312: otg.PatternFlowTcpDstPort.decrement:type_name -> otg.PatternFlowTcpDstPortCounter + 1103, // 1313: otg.PatternFlowTcpDstPort.metric_tags:type_name -> otg.PatternFlowTcpDstPortMetricTag + 1104, // 1314: otg.PatternFlowTcpDstPort.random:type_name -> otg.PatternFlowTcpDstPortRandom + 285, // 1315: otg.PatternFlowTcpSeqNum.choice:type_name -> otg.PatternFlowTcpSeqNum.Choice.Enum + 1106, // 1316: otg.PatternFlowTcpSeqNum.increment:type_name -> otg.PatternFlowTcpSeqNumCounter + 1106, // 1317: otg.PatternFlowTcpSeqNum.decrement:type_name -> otg.PatternFlowTcpSeqNumCounter + 1107, // 1318: otg.PatternFlowTcpSeqNum.metric_tags:type_name -> otg.PatternFlowTcpSeqNumMetricTag + 286, // 1319: otg.PatternFlowTcpAckNum.choice:type_name -> otg.PatternFlowTcpAckNum.Choice.Enum + 1109, // 1320: otg.PatternFlowTcpAckNum.increment:type_name -> otg.PatternFlowTcpAckNumCounter + 1109, // 1321: otg.PatternFlowTcpAckNum.decrement:type_name -> otg.PatternFlowTcpAckNumCounter + 1110, // 1322: otg.PatternFlowTcpAckNum.metric_tags:type_name -> otg.PatternFlowTcpAckNumMetricTag + 287, // 1323: otg.PatternFlowTcpDataOffset.choice:type_name -> otg.PatternFlowTcpDataOffset.Choice.Enum + 1112, // 1324: otg.PatternFlowTcpDataOffset.increment:type_name -> otg.PatternFlowTcpDataOffsetCounter + 1112, // 1325: otg.PatternFlowTcpDataOffset.decrement:type_name -> otg.PatternFlowTcpDataOffsetCounter + 1113, // 1326: otg.PatternFlowTcpDataOffset.metric_tags:type_name -> otg.PatternFlowTcpDataOffsetMetricTag + 288, // 1327: otg.PatternFlowTcpEcnNs.choice:type_name -> otg.PatternFlowTcpEcnNs.Choice.Enum + 1115, // 1328: otg.PatternFlowTcpEcnNs.increment:type_name -> otg.PatternFlowTcpEcnNsCounter + 1115, // 1329: otg.PatternFlowTcpEcnNs.decrement:type_name -> otg.PatternFlowTcpEcnNsCounter + 1116, // 1330: otg.PatternFlowTcpEcnNs.metric_tags:type_name -> otg.PatternFlowTcpEcnNsMetricTag + 289, // 1331: otg.PatternFlowTcpEcnCwr.choice:type_name -> otg.PatternFlowTcpEcnCwr.Choice.Enum + 1118, // 1332: otg.PatternFlowTcpEcnCwr.increment:type_name -> otg.PatternFlowTcpEcnCwrCounter + 1118, // 1333: otg.PatternFlowTcpEcnCwr.decrement:type_name -> otg.PatternFlowTcpEcnCwrCounter + 1119, // 1334: otg.PatternFlowTcpEcnCwr.metric_tags:type_name -> otg.PatternFlowTcpEcnCwrMetricTag + 290, // 1335: otg.PatternFlowTcpEcnEcho.choice:type_name -> otg.PatternFlowTcpEcnEcho.Choice.Enum + 1121, // 1336: otg.PatternFlowTcpEcnEcho.increment:type_name -> otg.PatternFlowTcpEcnEchoCounter + 1121, // 1337: otg.PatternFlowTcpEcnEcho.decrement:type_name -> otg.PatternFlowTcpEcnEchoCounter + 1122, // 1338: otg.PatternFlowTcpEcnEcho.metric_tags:type_name -> otg.PatternFlowTcpEcnEchoMetricTag + 291, // 1339: otg.PatternFlowTcpCtlUrg.choice:type_name -> otg.PatternFlowTcpCtlUrg.Choice.Enum + 1124, // 1340: otg.PatternFlowTcpCtlUrg.increment:type_name -> otg.PatternFlowTcpCtlUrgCounter + 1124, // 1341: otg.PatternFlowTcpCtlUrg.decrement:type_name -> otg.PatternFlowTcpCtlUrgCounter + 1125, // 1342: otg.PatternFlowTcpCtlUrg.metric_tags:type_name -> otg.PatternFlowTcpCtlUrgMetricTag + 292, // 1343: otg.PatternFlowTcpCtlAck.choice:type_name -> otg.PatternFlowTcpCtlAck.Choice.Enum + 1127, // 1344: otg.PatternFlowTcpCtlAck.increment:type_name -> otg.PatternFlowTcpCtlAckCounter + 1127, // 1345: otg.PatternFlowTcpCtlAck.decrement:type_name -> otg.PatternFlowTcpCtlAckCounter + 1128, // 1346: otg.PatternFlowTcpCtlAck.metric_tags:type_name -> otg.PatternFlowTcpCtlAckMetricTag + 293, // 1347: otg.PatternFlowTcpCtlPsh.choice:type_name -> otg.PatternFlowTcpCtlPsh.Choice.Enum + 1130, // 1348: otg.PatternFlowTcpCtlPsh.increment:type_name -> otg.PatternFlowTcpCtlPshCounter + 1130, // 1349: otg.PatternFlowTcpCtlPsh.decrement:type_name -> otg.PatternFlowTcpCtlPshCounter + 1131, // 1350: otg.PatternFlowTcpCtlPsh.metric_tags:type_name -> otg.PatternFlowTcpCtlPshMetricTag + 294, // 1351: otg.PatternFlowTcpCtlRst.choice:type_name -> otg.PatternFlowTcpCtlRst.Choice.Enum + 1133, // 1352: otg.PatternFlowTcpCtlRst.increment:type_name -> otg.PatternFlowTcpCtlRstCounter + 1133, // 1353: otg.PatternFlowTcpCtlRst.decrement:type_name -> otg.PatternFlowTcpCtlRstCounter + 1134, // 1354: otg.PatternFlowTcpCtlRst.metric_tags:type_name -> otg.PatternFlowTcpCtlRstMetricTag + 295, // 1355: otg.PatternFlowTcpCtlSyn.choice:type_name -> otg.PatternFlowTcpCtlSyn.Choice.Enum + 1136, // 1356: otg.PatternFlowTcpCtlSyn.increment:type_name -> otg.PatternFlowTcpCtlSynCounter + 1136, // 1357: otg.PatternFlowTcpCtlSyn.decrement:type_name -> otg.PatternFlowTcpCtlSynCounter + 1137, // 1358: otg.PatternFlowTcpCtlSyn.metric_tags:type_name -> otg.PatternFlowTcpCtlSynMetricTag + 296, // 1359: otg.PatternFlowTcpCtlFin.choice:type_name -> otg.PatternFlowTcpCtlFin.Choice.Enum + 1139, // 1360: otg.PatternFlowTcpCtlFin.increment:type_name -> otg.PatternFlowTcpCtlFinCounter + 1139, // 1361: otg.PatternFlowTcpCtlFin.decrement:type_name -> otg.PatternFlowTcpCtlFinCounter + 1140, // 1362: otg.PatternFlowTcpCtlFin.metric_tags:type_name -> otg.PatternFlowTcpCtlFinMetricTag + 297, // 1363: otg.PatternFlowTcpWindow.choice:type_name -> otg.PatternFlowTcpWindow.Choice.Enum + 1142, // 1364: otg.PatternFlowTcpWindow.increment:type_name -> otg.PatternFlowTcpWindowCounter + 1142, // 1365: otg.PatternFlowTcpWindow.decrement:type_name -> otg.PatternFlowTcpWindowCounter + 1143, // 1366: otg.PatternFlowTcpWindow.metric_tags:type_name -> otg.PatternFlowTcpWindowMetricTag + 298, // 1367: otg.PatternFlowTcpChecksum.choice:type_name -> otg.PatternFlowTcpChecksum.Choice.Enum + 299, // 1368: otg.PatternFlowTcpChecksum.generated:type_name -> otg.PatternFlowTcpChecksum.Generated.Enum + 300, // 1369: otg.PatternFlowUdpSrcPort.choice:type_name -> otg.PatternFlowUdpSrcPort.Choice.Enum + 1146, // 1370: otg.PatternFlowUdpSrcPort.increment:type_name -> otg.PatternFlowUdpSrcPortCounter + 1146, // 1371: otg.PatternFlowUdpSrcPort.decrement:type_name -> otg.PatternFlowUdpSrcPortCounter + 1147, // 1372: otg.PatternFlowUdpSrcPort.metric_tags:type_name -> otg.PatternFlowUdpSrcPortMetricTag + 1148, // 1373: otg.PatternFlowUdpSrcPort.random:type_name -> otg.PatternFlowUdpSrcPortRandom + 301, // 1374: otg.PatternFlowUdpDstPort.choice:type_name -> otg.PatternFlowUdpDstPort.Choice.Enum + 1150, // 1375: otg.PatternFlowUdpDstPort.increment:type_name -> otg.PatternFlowUdpDstPortCounter + 1150, // 1376: otg.PatternFlowUdpDstPort.decrement:type_name -> otg.PatternFlowUdpDstPortCounter + 1151, // 1377: otg.PatternFlowUdpDstPort.metric_tags:type_name -> otg.PatternFlowUdpDstPortMetricTag + 1152, // 1378: otg.PatternFlowUdpDstPort.random:type_name -> otg.PatternFlowUdpDstPortRandom + 302, // 1379: otg.PatternFlowUdpLength.choice:type_name -> otg.PatternFlowUdpLength.Choice.Enum + 1154, // 1380: otg.PatternFlowUdpLength.increment:type_name -> otg.PatternFlowUdpLengthCounter + 1154, // 1381: otg.PatternFlowUdpLength.decrement:type_name -> otg.PatternFlowUdpLengthCounter + 1155, // 1382: otg.PatternFlowUdpLength.metric_tags:type_name -> otg.PatternFlowUdpLengthMetricTag + 303, // 1383: otg.PatternFlowUdpChecksum.choice:type_name -> otg.PatternFlowUdpChecksum.Choice.Enum + 304, // 1384: otg.PatternFlowUdpChecksum.generated:type_name -> otg.PatternFlowUdpChecksum.Generated.Enum + 305, // 1385: otg.PatternFlowGreChecksumPresent.choice:type_name -> otg.PatternFlowGreChecksumPresent.Choice.Enum + 1158, // 1386: otg.PatternFlowGreChecksumPresent.increment:type_name -> otg.PatternFlowGreChecksumPresentCounter + 1158, // 1387: otg.PatternFlowGreChecksumPresent.decrement:type_name -> otg.PatternFlowGreChecksumPresentCounter + 1159, // 1388: otg.PatternFlowGreChecksumPresent.metric_tags:type_name -> otg.PatternFlowGreChecksumPresentMetricTag + 306, // 1389: otg.PatternFlowGreReserved0.choice:type_name -> otg.PatternFlowGreReserved0.Choice.Enum + 1161, // 1390: otg.PatternFlowGreReserved0.increment:type_name -> otg.PatternFlowGreReserved0Counter + 1161, // 1391: otg.PatternFlowGreReserved0.decrement:type_name -> otg.PatternFlowGreReserved0Counter + 1162, // 1392: otg.PatternFlowGreReserved0.metric_tags:type_name -> otg.PatternFlowGreReserved0MetricTag + 307, // 1393: otg.PatternFlowGreVersion.choice:type_name -> otg.PatternFlowGreVersion.Choice.Enum + 1164, // 1394: otg.PatternFlowGreVersion.increment:type_name -> otg.PatternFlowGreVersionCounter + 1164, // 1395: otg.PatternFlowGreVersion.decrement:type_name -> otg.PatternFlowGreVersionCounter + 1165, // 1396: otg.PatternFlowGreVersion.metric_tags:type_name -> otg.PatternFlowGreVersionMetricTag + 308, // 1397: otg.PatternFlowGreProtocol.choice:type_name -> otg.PatternFlowGreProtocol.Choice.Enum + 1167, // 1398: otg.PatternFlowGreProtocol.increment:type_name -> otg.PatternFlowGreProtocolCounter + 1167, // 1399: otg.PatternFlowGreProtocol.decrement:type_name -> otg.PatternFlowGreProtocolCounter + 1168, // 1400: otg.PatternFlowGreProtocol.metric_tags:type_name -> otg.PatternFlowGreProtocolMetricTag + 309, // 1401: otg.PatternFlowGreChecksum.choice:type_name -> otg.PatternFlowGreChecksum.Choice.Enum + 310, // 1402: otg.PatternFlowGreChecksum.generated:type_name -> otg.PatternFlowGreChecksum.Generated.Enum + 311, // 1403: otg.PatternFlowGreReserved1.choice:type_name -> otg.PatternFlowGreReserved1.Choice.Enum + 1171, // 1404: otg.PatternFlowGreReserved1.increment:type_name -> otg.PatternFlowGreReserved1Counter + 1171, // 1405: otg.PatternFlowGreReserved1.decrement:type_name -> otg.PatternFlowGreReserved1Counter + 1172, // 1406: otg.PatternFlowGreReserved1.metric_tags:type_name -> otg.PatternFlowGreReserved1MetricTag + 312, // 1407: otg.PatternFlowGtpv1Version.choice:type_name -> otg.PatternFlowGtpv1Version.Choice.Enum + 1174, // 1408: otg.PatternFlowGtpv1Version.increment:type_name -> otg.PatternFlowGtpv1VersionCounter + 1174, // 1409: otg.PatternFlowGtpv1Version.decrement:type_name -> otg.PatternFlowGtpv1VersionCounter + 1175, // 1410: otg.PatternFlowGtpv1Version.metric_tags:type_name -> otg.PatternFlowGtpv1VersionMetricTag + 313, // 1411: otg.PatternFlowGtpv1ProtocolType.choice:type_name -> otg.PatternFlowGtpv1ProtocolType.Choice.Enum + 1177, // 1412: otg.PatternFlowGtpv1ProtocolType.increment:type_name -> otg.PatternFlowGtpv1ProtocolTypeCounter + 1177, // 1413: otg.PatternFlowGtpv1ProtocolType.decrement:type_name -> otg.PatternFlowGtpv1ProtocolTypeCounter + 1178, // 1414: otg.PatternFlowGtpv1ProtocolType.metric_tags:type_name -> otg.PatternFlowGtpv1ProtocolTypeMetricTag + 314, // 1415: otg.PatternFlowGtpv1Reserved.choice:type_name -> otg.PatternFlowGtpv1Reserved.Choice.Enum + 1180, // 1416: otg.PatternFlowGtpv1Reserved.increment:type_name -> otg.PatternFlowGtpv1ReservedCounter + 1180, // 1417: otg.PatternFlowGtpv1Reserved.decrement:type_name -> otg.PatternFlowGtpv1ReservedCounter + 1181, // 1418: otg.PatternFlowGtpv1Reserved.metric_tags:type_name -> otg.PatternFlowGtpv1ReservedMetricTag + 315, // 1419: otg.PatternFlowGtpv1EFlag.choice:type_name -> otg.PatternFlowGtpv1EFlag.Choice.Enum + 1183, // 1420: otg.PatternFlowGtpv1EFlag.increment:type_name -> otg.PatternFlowGtpv1EFlagCounter + 1183, // 1421: otg.PatternFlowGtpv1EFlag.decrement:type_name -> otg.PatternFlowGtpv1EFlagCounter + 1184, // 1422: otg.PatternFlowGtpv1EFlag.metric_tags:type_name -> otg.PatternFlowGtpv1EFlagMetricTag + 316, // 1423: otg.PatternFlowGtpv1SFlag.choice:type_name -> otg.PatternFlowGtpv1SFlag.Choice.Enum + 1186, // 1424: otg.PatternFlowGtpv1SFlag.increment:type_name -> otg.PatternFlowGtpv1SFlagCounter + 1186, // 1425: otg.PatternFlowGtpv1SFlag.decrement:type_name -> otg.PatternFlowGtpv1SFlagCounter + 1187, // 1426: otg.PatternFlowGtpv1SFlag.metric_tags:type_name -> otg.PatternFlowGtpv1SFlagMetricTag + 317, // 1427: otg.PatternFlowGtpv1PnFlag.choice:type_name -> otg.PatternFlowGtpv1PnFlag.Choice.Enum + 1189, // 1428: otg.PatternFlowGtpv1PnFlag.increment:type_name -> otg.PatternFlowGtpv1PnFlagCounter + 1189, // 1429: otg.PatternFlowGtpv1PnFlag.decrement:type_name -> otg.PatternFlowGtpv1PnFlagCounter + 1190, // 1430: otg.PatternFlowGtpv1PnFlag.metric_tags:type_name -> otg.PatternFlowGtpv1PnFlagMetricTag + 318, // 1431: otg.PatternFlowGtpv1MessageType.choice:type_name -> otg.PatternFlowGtpv1MessageType.Choice.Enum + 1192, // 1432: otg.PatternFlowGtpv1MessageType.increment:type_name -> otg.PatternFlowGtpv1MessageTypeCounter + 1192, // 1433: otg.PatternFlowGtpv1MessageType.decrement:type_name -> otg.PatternFlowGtpv1MessageTypeCounter + 1193, // 1434: otg.PatternFlowGtpv1MessageType.metric_tags:type_name -> otg.PatternFlowGtpv1MessageTypeMetricTag + 319, // 1435: otg.PatternFlowGtpv1MessageLength.choice:type_name -> otg.PatternFlowGtpv1MessageLength.Choice.Enum + 1195, // 1436: otg.PatternFlowGtpv1MessageLength.increment:type_name -> otg.PatternFlowGtpv1MessageLengthCounter + 1195, // 1437: otg.PatternFlowGtpv1MessageLength.decrement:type_name -> otg.PatternFlowGtpv1MessageLengthCounter + 1196, // 1438: otg.PatternFlowGtpv1MessageLength.metric_tags:type_name -> otg.PatternFlowGtpv1MessageLengthMetricTag + 320, // 1439: otg.PatternFlowGtpv1Teid.choice:type_name -> otg.PatternFlowGtpv1Teid.Choice.Enum + 1198, // 1440: otg.PatternFlowGtpv1Teid.increment:type_name -> otg.PatternFlowGtpv1TeidCounter + 1198, // 1441: otg.PatternFlowGtpv1Teid.decrement:type_name -> otg.PatternFlowGtpv1TeidCounter + 1199, // 1442: otg.PatternFlowGtpv1Teid.metric_tags:type_name -> otg.PatternFlowGtpv1TeidMetricTag + 321, // 1443: otg.PatternFlowGtpv1SquenceNumber.choice:type_name -> otg.PatternFlowGtpv1SquenceNumber.Choice.Enum + 1201, // 1444: otg.PatternFlowGtpv1SquenceNumber.increment:type_name -> otg.PatternFlowGtpv1SquenceNumberCounter + 1201, // 1445: otg.PatternFlowGtpv1SquenceNumber.decrement:type_name -> otg.PatternFlowGtpv1SquenceNumberCounter + 1202, // 1446: otg.PatternFlowGtpv1SquenceNumber.metric_tags:type_name -> otg.PatternFlowGtpv1SquenceNumberMetricTag + 322, // 1447: otg.PatternFlowGtpv1NPduNumber.choice:type_name -> otg.PatternFlowGtpv1NPduNumber.Choice.Enum + 1204, // 1448: otg.PatternFlowGtpv1NPduNumber.increment:type_name -> otg.PatternFlowGtpv1NPduNumberCounter + 1204, // 1449: otg.PatternFlowGtpv1NPduNumber.decrement:type_name -> otg.PatternFlowGtpv1NPduNumberCounter + 1205, // 1450: otg.PatternFlowGtpv1NPduNumber.metric_tags:type_name -> otg.PatternFlowGtpv1NPduNumberMetricTag + 323, // 1451: otg.PatternFlowGtpv1NextExtensionHeaderType.choice:type_name -> otg.PatternFlowGtpv1NextExtensionHeaderType.Choice.Enum + 1207, // 1452: otg.PatternFlowGtpv1NextExtensionHeaderType.increment:type_name -> otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter + 1207, // 1453: otg.PatternFlowGtpv1NextExtensionHeaderType.decrement:type_name -> otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter + 1208, // 1454: otg.PatternFlowGtpv1NextExtensionHeaderType.metric_tags:type_name -> otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + 324, // 1455: otg.PatternFlowGtpExtensionExtensionLength.choice:type_name -> otg.PatternFlowGtpExtensionExtensionLength.Choice.Enum + 1210, // 1456: otg.PatternFlowGtpExtensionExtensionLength.increment:type_name -> otg.PatternFlowGtpExtensionExtensionLengthCounter + 1210, // 1457: otg.PatternFlowGtpExtensionExtensionLength.decrement:type_name -> otg.PatternFlowGtpExtensionExtensionLengthCounter + 1211, // 1458: otg.PatternFlowGtpExtensionExtensionLength.metric_tags:type_name -> otg.PatternFlowGtpExtensionExtensionLengthMetricTag + 325, // 1459: otg.PatternFlowGtpExtensionContents.choice:type_name -> otg.PatternFlowGtpExtensionContents.Choice.Enum + 1213, // 1460: otg.PatternFlowGtpExtensionContents.increment:type_name -> otg.PatternFlowGtpExtensionContentsCounter + 1213, // 1461: otg.PatternFlowGtpExtensionContents.decrement:type_name -> otg.PatternFlowGtpExtensionContentsCounter + 1214, // 1462: otg.PatternFlowGtpExtensionContents.metric_tags:type_name -> otg.PatternFlowGtpExtensionContentsMetricTag + 326, // 1463: otg.PatternFlowGtpExtensionNextExtensionHeader.choice:type_name -> otg.PatternFlowGtpExtensionNextExtensionHeader.Choice.Enum + 1216, // 1464: otg.PatternFlowGtpExtensionNextExtensionHeader.increment:type_name -> otg.PatternFlowGtpExtensionNextExtensionHeaderCounter + 1216, // 1465: otg.PatternFlowGtpExtensionNextExtensionHeader.decrement:type_name -> otg.PatternFlowGtpExtensionNextExtensionHeaderCounter + 1217, // 1466: otg.PatternFlowGtpExtensionNextExtensionHeader.metric_tags:type_name -> otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag + 327, // 1467: otg.PatternFlowGtpv2Version.choice:type_name -> otg.PatternFlowGtpv2Version.Choice.Enum + 1219, // 1468: otg.PatternFlowGtpv2Version.increment:type_name -> otg.PatternFlowGtpv2VersionCounter + 1219, // 1469: otg.PatternFlowGtpv2Version.decrement:type_name -> otg.PatternFlowGtpv2VersionCounter + 1220, // 1470: otg.PatternFlowGtpv2Version.metric_tags:type_name -> otg.PatternFlowGtpv2VersionMetricTag + 328, // 1471: otg.PatternFlowGtpv2PiggybackingFlag.choice:type_name -> otg.PatternFlowGtpv2PiggybackingFlag.Choice.Enum + 1222, // 1472: otg.PatternFlowGtpv2PiggybackingFlag.increment:type_name -> otg.PatternFlowGtpv2PiggybackingFlagCounter + 1222, // 1473: otg.PatternFlowGtpv2PiggybackingFlag.decrement:type_name -> otg.PatternFlowGtpv2PiggybackingFlagCounter + 1223, // 1474: otg.PatternFlowGtpv2PiggybackingFlag.metric_tags:type_name -> otg.PatternFlowGtpv2PiggybackingFlagMetricTag + 329, // 1475: otg.PatternFlowGtpv2TeidFlag.choice:type_name -> otg.PatternFlowGtpv2TeidFlag.Choice.Enum + 1225, // 1476: otg.PatternFlowGtpv2TeidFlag.increment:type_name -> otg.PatternFlowGtpv2TeidFlagCounter + 1225, // 1477: otg.PatternFlowGtpv2TeidFlag.decrement:type_name -> otg.PatternFlowGtpv2TeidFlagCounter + 1226, // 1478: otg.PatternFlowGtpv2TeidFlag.metric_tags:type_name -> otg.PatternFlowGtpv2TeidFlagMetricTag + 330, // 1479: otg.PatternFlowGtpv2Spare1.choice:type_name -> otg.PatternFlowGtpv2Spare1.Choice.Enum + 1228, // 1480: otg.PatternFlowGtpv2Spare1.increment:type_name -> otg.PatternFlowGtpv2Spare1Counter + 1228, // 1481: otg.PatternFlowGtpv2Spare1.decrement:type_name -> otg.PatternFlowGtpv2Spare1Counter + 1229, // 1482: otg.PatternFlowGtpv2Spare1.metric_tags:type_name -> otg.PatternFlowGtpv2Spare1MetricTag + 331, // 1483: otg.PatternFlowGtpv2MessageType.choice:type_name -> otg.PatternFlowGtpv2MessageType.Choice.Enum + 1231, // 1484: otg.PatternFlowGtpv2MessageType.increment:type_name -> otg.PatternFlowGtpv2MessageTypeCounter + 1231, // 1485: otg.PatternFlowGtpv2MessageType.decrement:type_name -> otg.PatternFlowGtpv2MessageTypeCounter + 1232, // 1486: otg.PatternFlowGtpv2MessageType.metric_tags:type_name -> otg.PatternFlowGtpv2MessageTypeMetricTag + 332, // 1487: otg.PatternFlowGtpv2MessageLength.choice:type_name -> otg.PatternFlowGtpv2MessageLength.Choice.Enum + 1234, // 1488: otg.PatternFlowGtpv2MessageLength.increment:type_name -> otg.PatternFlowGtpv2MessageLengthCounter + 1234, // 1489: otg.PatternFlowGtpv2MessageLength.decrement:type_name -> otg.PatternFlowGtpv2MessageLengthCounter + 1235, // 1490: otg.PatternFlowGtpv2MessageLength.metric_tags:type_name -> otg.PatternFlowGtpv2MessageLengthMetricTag + 333, // 1491: otg.PatternFlowGtpv2Teid.choice:type_name -> otg.PatternFlowGtpv2Teid.Choice.Enum + 1237, // 1492: otg.PatternFlowGtpv2Teid.increment:type_name -> otg.PatternFlowGtpv2TeidCounter + 1237, // 1493: otg.PatternFlowGtpv2Teid.decrement:type_name -> otg.PatternFlowGtpv2TeidCounter + 1238, // 1494: otg.PatternFlowGtpv2Teid.metric_tags:type_name -> otg.PatternFlowGtpv2TeidMetricTag + 334, // 1495: otg.PatternFlowGtpv2SequenceNumber.choice:type_name -> otg.PatternFlowGtpv2SequenceNumber.Choice.Enum + 1240, // 1496: otg.PatternFlowGtpv2SequenceNumber.increment:type_name -> otg.PatternFlowGtpv2SequenceNumberCounter + 1240, // 1497: otg.PatternFlowGtpv2SequenceNumber.decrement:type_name -> otg.PatternFlowGtpv2SequenceNumberCounter + 1241, // 1498: otg.PatternFlowGtpv2SequenceNumber.metric_tags:type_name -> otg.PatternFlowGtpv2SequenceNumberMetricTag + 335, // 1499: otg.PatternFlowGtpv2Spare2.choice:type_name -> otg.PatternFlowGtpv2Spare2.Choice.Enum + 1243, // 1500: otg.PatternFlowGtpv2Spare2.increment:type_name -> otg.PatternFlowGtpv2Spare2Counter + 1243, // 1501: otg.PatternFlowGtpv2Spare2.decrement:type_name -> otg.PatternFlowGtpv2Spare2Counter + 1244, // 1502: otg.PatternFlowGtpv2Spare2.metric_tags:type_name -> otg.PatternFlowGtpv2Spare2MetricTag + 336, // 1503: otg.PatternFlowArpHardwareType.choice:type_name -> otg.PatternFlowArpHardwareType.Choice.Enum + 1246, // 1504: otg.PatternFlowArpHardwareType.increment:type_name -> otg.PatternFlowArpHardwareTypeCounter + 1246, // 1505: otg.PatternFlowArpHardwareType.decrement:type_name -> otg.PatternFlowArpHardwareTypeCounter + 1247, // 1506: otg.PatternFlowArpHardwareType.metric_tags:type_name -> otg.PatternFlowArpHardwareTypeMetricTag + 337, // 1507: otg.PatternFlowArpProtocolType.choice:type_name -> otg.PatternFlowArpProtocolType.Choice.Enum + 1249, // 1508: otg.PatternFlowArpProtocolType.increment:type_name -> otg.PatternFlowArpProtocolTypeCounter + 1249, // 1509: otg.PatternFlowArpProtocolType.decrement:type_name -> otg.PatternFlowArpProtocolTypeCounter + 1250, // 1510: otg.PatternFlowArpProtocolType.metric_tags:type_name -> otg.PatternFlowArpProtocolTypeMetricTag + 338, // 1511: otg.PatternFlowArpHardwareLength.choice:type_name -> otg.PatternFlowArpHardwareLength.Choice.Enum + 1252, // 1512: otg.PatternFlowArpHardwareLength.increment:type_name -> otg.PatternFlowArpHardwareLengthCounter + 1252, // 1513: otg.PatternFlowArpHardwareLength.decrement:type_name -> otg.PatternFlowArpHardwareLengthCounter + 1253, // 1514: otg.PatternFlowArpHardwareLength.metric_tags:type_name -> otg.PatternFlowArpHardwareLengthMetricTag + 339, // 1515: otg.PatternFlowArpProtocolLength.choice:type_name -> otg.PatternFlowArpProtocolLength.Choice.Enum + 1255, // 1516: otg.PatternFlowArpProtocolLength.increment:type_name -> otg.PatternFlowArpProtocolLengthCounter + 1255, // 1517: otg.PatternFlowArpProtocolLength.decrement:type_name -> otg.PatternFlowArpProtocolLengthCounter + 1256, // 1518: otg.PatternFlowArpProtocolLength.metric_tags:type_name -> otg.PatternFlowArpProtocolLengthMetricTag + 340, // 1519: otg.PatternFlowArpOperation.choice:type_name -> otg.PatternFlowArpOperation.Choice.Enum + 1258, // 1520: otg.PatternFlowArpOperation.increment:type_name -> otg.PatternFlowArpOperationCounter + 1258, // 1521: otg.PatternFlowArpOperation.decrement:type_name -> otg.PatternFlowArpOperationCounter + 1259, // 1522: otg.PatternFlowArpOperation.metric_tags:type_name -> otg.PatternFlowArpOperationMetricTag + 341, // 1523: otg.PatternFlowArpSenderHardwareAddr.choice:type_name -> otg.PatternFlowArpSenderHardwareAddr.Choice.Enum + 1261, // 1524: otg.PatternFlowArpSenderHardwareAddr.increment:type_name -> otg.PatternFlowArpSenderHardwareAddrCounter + 1261, // 1525: otg.PatternFlowArpSenderHardwareAddr.decrement:type_name -> otg.PatternFlowArpSenderHardwareAddrCounter + 1262, // 1526: otg.PatternFlowArpSenderHardwareAddr.metric_tags:type_name -> otg.PatternFlowArpSenderHardwareAddrMetricTag + 342, // 1527: otg.PatternFlowArpSenderProtocolAddr.choice:type_name -> otg.PatternFlowArpSenderProtocolAddr.Choice.Enum + 1264, // 1528: otg.PatternFlowArpSenderProtocolAddr.increment:type_name -> otg.PatternFlowArpSenderProtocolAddrCounter + 1264, // 1529: otg.PatternFlowArpSenderProtocolAddr.decrement:type_name -> otg.PatternFlowArpSenderProtocolAddrCounter + 1265, // 1530: otg.PatternFlowArpSenderProtocolAddr.metric_tags:type_name -> otg.PatternFlowArpSenderProtocolAddrMetricTag + 343, // 1531: otg.PatternFlowArpTargetHardwareAddr.choice:type_name -> otg.PatternFlowArpTargetHardwareAddr.Choice.Enum + 1267, // 1532: otg.PatternFlowArpTargetHardwareAddr.increment:type_name -> otg.PatternFlowArpTargetHardwareAddrCounter + 1267, // 1533: otg.PatternFlowArpTargetHardwareAddr.decrement:type_name -> otg.PatternFlowArpTargetHardwareAddrCounter + 1268, // 1534: otg.PatternFlowArpTargetHardwareAddr.metric_tags:type_name -> otg.PatternFlowArpTargetHardwareAddrMetricTag + 344, // 1535: otg.PatternFlowArpTargetProtocolAddr.choice:type_name -> otg.PatternFlowArpTargetProtocolAddr.Choice.Enum + 1270, // 1536: otg.PatternFlowArpTargetProtocolAddr.increment:type_name -> otg.PatternFlowArpTargetProtocolAddrCounter + 1270, // 1537: otg.PatternFlowArpTargetProtocolAddr.decrement:type_name -> otg.PatternFlowArpTargetProtocolAddrCounter + 1271, // 1538: otg.PatternFlowArpTargetProtocolAddr.metric_tags:type_name -> otg.PatternFlowArpTargetProtocolAddrMetricTag + 345, // 1539: otg.PatternFlowIcmpEchoType.choice:type_name -> otg.PatternFlowIcmpEchoType.Choice.Enum + 1273, // 1540: otg.PatternFlowIcmpEchoType.increment:type_name -> otg.PatternFlowIcmpEchoTypeCounter + 1273, // 1541: otg.PatternFlowIcmpEchoType.decrement:type_name -> otg.PatternFlowIcmpEchoTypeCounter + 1274, // 1542: otg.PatternFlowIcmpEchoType.metric_tags:type_name -> otg.PatternFlowIcmpEchoTypeMetricTag + 346, // 1543: otg.PatternFlowIcmpEchoCode.choice:type_name -> otg.PatternFlowIcmpEchoCode.Choice.Enum + 1276, // 1544: otg.PatternFlowIcmpEchoCode.increment:type_name -> otg.PatternFlowIcmpEchoCodeCounter + 1276, // 1545: otg.PatternFlowIcmpEchoCode.decrement:type_name -> otg.PatternFlowIcmpEchoCodeCounter + 1277, // 1546: otg.PatternFlowIcmpEchoCode.metric_tags:type_name -> otg.PatternFlowIcmpEchoCodeMetricTag + 347, // 1547: otg.PatternFlowIcmpEchoChecksum.choice:type_name -> otg.PatternFlowIcmpEchoChecksum.Choice.Enum + 348, // 1548: otg.PatternFlowIcmpEchoChecksum.generated:type_name -> otg.PatternFlowIcmpEchoChecksum.Generated.Enum + 349, // 1549: otg.PatternFlowIcmpEchoIdentifier.choice:type_name -> otg.PatternFlowIcmpEchoIdentifier.Choice.Enum + 1280, // 1550: otg.PatternFlowIcmpEchoIdentifier.increment:type_name -> otg.PatternFlowIcmpEchoIdentifierCounter + 1280, // 1551: otg.PatternFlowIcmpEchoIdentifier.decrement:type_name -> otg.PatternFlowIcmpEchoIdentifierCounter + 1281, // 1552: otg.PatternFlowIcmpEchoIdentifier.metric_tags:type_name -> otg.PatternFlowIcmpEchoIdentifierMetricTag + 350, // 1553: otg.PatternFlowIcmpEchoSequenceNumber.choice:type_name -> otg.PatternFlowIcmpEchoSequenceNumber.Choice.Enum + 1283, // 1554: otg.PatternFlowIcmpEchoSequenceNumber.increment:type_name -> otg.PatternFlowIcmpEchoSequenceNumberCounter + 1283, // 1555: otg.PatternFlowIcmpEchoSequenceNumber.decrement:type_name -> otg.PatternFlowIcmpEchoSequenceNumberCounter + 1284, // 1556: otg.PatternFlowIcmpEchoSequenceNumber.metric_tags:type_name -> otg.PatternFlowIcmpEchoSequenceNumberMetricTag + 351, // 1557: otg.PatternFlowIcmpCommonChecksum.choice:type_name -> otg.PatternFlowIcmpCommonChecksum.Choice.Enum + 352, // 1558: otg.PatternFlowIcmpCommonChecksum.generated:type_name -> otg.PatternFlowIcmpCommonChecksum.Generated.Enum + 353, // 1559: otg.PatternFlowIcmpNextFieldsIdentifier.choice:type_name -> otg.PatternFlowIcmpNextFieldsIdentifier.Choice.Enum + 1287, // 1560: otg.PatternFlowIcmpNextFieldsIdentifier.increment:type_name -> otg.PatternFlowIcmpNextFieldsIdentifierCounter + 1287, // 1561: otg.PatternFlowIcmpNextFieldsIdentifier.decrement:type_name -> otg.PatternFlowIcmpNextFieldsIdentifierCounter + 1288, // 1562: otg.PatternFlowIcmpNextFieldsIdentifier.metric_tags:type_name -> otg.PatternFlowIcmpNextFieldsIdentifierMetricTag + 354, // 1563: otg.PatternFlowIcmpNextFieldsSequenceNumber.choice:type_name -> otg.PatternFlowIcmpNextFieldsSequenceNumber.Choice.Enum + 1290, // 1564: otg.PatternFlowIcmpNextFieldsSequenceNumber.increment:type_name -> otg.PatternFlowIcmpNextFieldsSequenceNumberCounter + 1290, // 1565: otg.PatternFlowIcmpNextFieldsSequenceNumber.decrement:type_name -> otg.PatternFlowIcmpNextFieldsSequenceNumberCounter + 1291, // 1566: otg.PatternFlowIcmpNextFieldsSequenceNumber.metric_tags:type_name -> otg.PatternFlowIcmpNextFieldsSequenceNumberMetricTag + 355, // 1567: otg.PatternFlowIcmpv6EchoType.choice:type_name -> otg.PatternFlowIcmpv6EchoType.Choice.Enum + 1293, // 1568: otg.PatternFlowIcmpv6EchoType.increment:type_name -> otg.PatternFlowIcmpv6EchoTypeCounter + 1293, // 1569: otg.PatternFlowIcmpv6EchoType.decrement:type_name -> otg.PatternFlowIcmpv6EchoTypeCounter + 1294, // 1570: otg.PatternFlowIcmpv6EchoType.metric_tags:type_name -> otg.PatternFlowIcmpv6EchoTypeMetricTag + 356, // 1571: otg.PatternFlowIcmpv6EchoCode.choice:type_name -> otg.PatternFlowIcmpv6EchoCode.Choice.Enum + 1296, // 1572: otg.PatternFlowIcmpv6EchoCode.increment:type_name -> otg.PatternFlowIcmpv6EchoCodeCounter + 1296, // 1573: otg.PatternFlowIcmpv6EchoCode.decrement:type_name -> otg.PatternFlowIcmpv6EchoCodeCounter + 1297, // 1574: otg.PatternFlowIcmpv6EchoCode.metric_tags:type_name -> otg.PatternFlowIcmpv6EchoCodeMetricTag + 357, // 1575: otg.PatternFlowIcmpv6EchoIdentifier.choice:type_name -> otg.PatternFlowIcmpv6EchoIdentifier.Choice.Enum + 1299, // 1576: otg.PatternFlowIcmpv6EchoIdentifier.increment:type_name -> otg.PatternFlowIcmpv6EchoIdentifierCounter + 1299, // 1577: otg.PatternFlowIcmpv6EchoIdentifier.decrement:type_name -> otg.PatternFlowIcmpv6EchoIdentifierCounter + 1300, // 1578: otg.PatternFlowIcmpv6EchoIdentifier.metric_tags:type_name -> otg.PatternFlowIcmpv6EchoIdentifierMetricTag + 358, // 1579: otg.PatternFlowIcmpv6EchoSequenceNumber.choice:type_name -> otg.PatternFlowIcmpv6EchoSequenceNumber.Choice.Enum + 1302, // 1580: otg.PatternFlowIcmpv6EchoSequenceNumber.increment:type_name -> otg.PatternFlowIcmpv6EchoSequenceNumberCounter + 1302, // 1581: otg.PatternFlowIcmpv6EchoSequenceNumber.decrement:type_name -> otg.PatternFlowIcmpv6EchoSequenceNumberCounter + 1303, // 1582: otg.PatternFlowIcmpv6EchoSequenceNumber.metric_tags:type_name -> otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag + 359, // 1583: otg.PatternFlowIcmpv6EchoChecksum.choice:type_name -> otg.PatternFlowIcmpv6EchoChecksum.Choice.Enum + 360, // 1584: otg.PatternFlowIcmpv6EchoChecksum.generated:type_name -> otg.PatternFlowIcmpv6EchoChecksum.Generated.Enum + 361, // 1585: otg.PatternFlowIcmpv6CommonChecksum.choice:type_name -> otg.PatternFlowIcmpv6CommonChecksum.Choice.Enum + 362, // 1586: otg.PatternFlowIcmpv6CommonChecksum.generated:type_name -> otg.PatternFlowIcmpv6CommonChecksum.Generated.Enum + 363, // 1587: otg.PatternFlowPppAddress.choice:type_name -> otg.PatternFlowPppAddress.Choice.Enum + 1307, // 1588: otg.PatternFlowPppAddress.increment:type_name -> otg.PatternFlowPppAddressCounter + 1307, // 1589: otg.PatternFlowPppAddress.decrement:type_name -> otg.PatternFlowPppAddressCounter + 1308, // 1590: otg.PatternFlowPppAddress.metric_tags:type_name -> otg.PatternFlowPppAddressMetricTag + 364, // 1591: otg.PatternFlowPppControl.choice:type_name -> otg.PatternFlowPppControl.Choice.Enum + 1310, // 1592: otg.PatternFlowPppControl.increment:type_name -> otg.PatternFlowPppControlCounter + 1310, // 1593: otg.PatternFlowPppControl.decrement:type_name -> otg.PatternFlowPppControlCounter + 1311, // 1594: otg.PatternFlowPppControl.metric_tags:type_name -> otg.PatternFlowPppControlMetricTag + 365, // 1595: otg.PatternFlowPppProtocolType.choice:type_name -> otg.PatternFlowPppProtocolType.Choice.Enum + 1313, // 1596: otg.PatternFlowPppProtocolType.increment:type_name -> otg.PatternFlowPppProtocolTypeCounter + 1313, // 1597: otg.PatternFlowPppProtocolType.decrement:type_name -> otg.PatternFlowPppProtocolTypeCounter + 1314, // 1598: otg.PatternFlowPppProtocolType.metric_tags:type_name -> otg.PatternFlowPppProtocolTypeMetricTag + 366, // 1599: otg.PatternFlowIgmpv1Version.choice:type_name -> otg.PatternFlowIgmpv1Version.Choice.Enum + 1316, // 1600: otg.PatternFlowIgmpv1Version.increment:type_name -> otg.PatternFlowIgmpv1VersionCounter + 1316, // 1601: otg.PatternFlowIgmpv1Version.decrement:type_name -> otg.PatternFlowIgmpv1VersionCounter + 1317, // 1602: otg.PatternFlowIgmpv1Version.metric_tags:type_name -> otg.PatternFlowIgmpv1VersionMetricTag + 367, // 1603: otg.PatternFlowIgmpv1Type.choice:type_name -> otg.PatternFlowIgmpv1Type.Choice.Enum + 1319, // 1604: otg.PatternFlowIgmpv1Type.increment:type_name -> otg.PatternFlowIgmpv1TypeCounter + 1319, // 1605: otg.PatternFlowIgmpv1Type.decrement:type_name -> otg.PatternFlowIgmpv1TypeCounter + 1320, // 1606: otg.PatternFlowIgmpv1Type.metric_tags:type_name -> otg.PatternFlowIgmpv1TypeMetricTag + 368, // 1607: otg.PatternFlowIgmpv1Unused.choice:type_name -> otg.PatternFlowIgmpv1Unused.Choice.Enum + 1322, // 1608: otg.PatternFlowIgmpv1Unused.increment:type_name -> otg.PatternFlowIgmpv1UnusedCounter + 1322, // 1609: otg.PatternFlowIgmpv1Unused.decrement:type_name -> otg.PatternFlowIgmpv1UnusedCounter + 1323, // 1610: otg.PatternFlowIgmpv1Unused.metric_tags:type_name -> otg.PatternFlowIgmpv1UnusedMetricTag + 369, // 1611: otg.PatternFlowIgmpv1Checksum.choice:type_name -> otg.PatternFlowIgmpv1Checksum.Choice.Enum + 370, // 1612: otg.PatternFlowIgmpv1Checksum.generated:type_name -> otg.PatternFlowIgmpv1Checksum.Generated.Enum + 371, // 1613: otg.PatternFlowIgmpv1GroupAddress.choice:type_name -> otg.PatternFlowIgmpv1GroupAddress.Choice.Enum + 1326, // 1614: otg.PatternFlowIgmpv1GroupAddress.increment:type_name -> otg.PatternFlowIgmpv1GroupAddressCounter + 1326, // 1615: otg.PatternFlowIgmpv1GroupAddress.decrement:type_name -> otg.PatternFlowIgmpv1GroupAddressCounter + 1327, // 1616: otg.PatternFlowIgmpv1GroupAddress.metric_tags:type_name -> otg.PatternFlowIgmpv1GroupAddressMetricTag + 372, // 1617: otg.PatternFlowMplsLabel.choice:type_name -> otg.PatternFlowMplsLabel.Choice.Enum + 1329, // 1618: otg.PatternFlowMplsLabel.increment:type_name -> otg.PatternFlowMplsLabelCounter + 1329, // 1619: otg.PatternFlowMplsLabel.decrement:type_name -> otg.PatternFlowMplsLabelCounter + 1330, // 1620: otg.PatternFlowMplsLabel.metric_tags:type_name -> otg.PatternFlowMplsLabelMetricTag + 373, // 1621: otg.PatternFlowMplsTrafficClass.choice:type_name -> otg.PatternFlowMplsTrafficClass.Choice.Enum + 1332, // 1622: otg.PatternFlowMplsTrafficClass.increment:type_name -> otg.PatternFlowMplsTrafficClassCounter + 1332, // 1623: otg.PatternFlowMplsTrafficClass.decrement:type_name -> otg.PatternFlowMplsTrafficClassCounter + 1333, // 1624: otg.PatternFlowMplsTrafficClass.metric_tags:type_name -> otg.PatternFlowMplsTrafficClassMetricTag + 374, // 1625: otg.PatternFlowMplsBottomOfStack.choice:type_name -> otg.PatternFlowMplsBottomOfStack.Choice.Enum + 1335, // 1626: otg.PatternFlowMplsBottomOfStack.increment:type_name -> otg.PatternFlowMplsBottomOfStackCounter + 1335, // 1627: otg.PatternFlowMplsBottomOfStack.decrement:type_name -> otg.PatternFlowMplsBottomOfStackCounter + 1336, // 1628: otg.PatternFlowMplsBottomOfStack.metric_tags:type_name -> otg.PatternFlowMplsBottomOfStackMetricTag + 375, // 1629: otg.PatternFlowMplsTimeToLive.choice:type_name -> otg.PatternFlowMplsTimeToLive.Choice.Enum + 1338, // 1630: otg.PatternFlowMplsTimeToLive.increment:type_name -> otg.PatternFlowMplsTimeToLiveCounter + 1338, // 1631: otg.PatternFlowMplsTimeToLive.decrement:type_name -> otg.PatternFlowMplsTimeToLiveCounter + 1339, // 1632: otg.PatternFlowMplsTimeToLive.metric_tags:type_name -> otg.PatternFlowMplsTimeToLiveMetricTag + 376, // 1633: otg.PatternFlowSnmpv2cVersion.choice:type_name -> otg.PatternFlowSnmpv2cVersion.Choice.Enum + 1341, // 1634: otg.PatternFlowSnmpv2cVersion.increment:type_name -> otg.PatternFlowSnmpv2cVersionCounter + 1341, // 1635: otg.PatternFlowSnmpv2cVersion.decrement:type_name -> otg.PatternFlowSnmpv2cVersionCounter + 377, // 1636: otg.PatternFlowSnmpv2cPDURequestId.choice:type_name -> otg.PatternFlowSnmpv2cPDURequestId.Choice.Enum + 1343, // 1637: otg.PatternFlowSnmpv2cPDURequestId.increment:type_name -> otg.PatternFlowSnmpv2cPDURequestIdCounter + 1343, // 1638: otg.PatternFlowSnmpv2cPDURequestId.decrement:type_name -> otg.PatternFlowSnmpv2cPDURequestIdCounter + 378, // 1639: otg.PatternFlowSnmpv2cPDUErrorIndex.choice:type_name -> otg.PatternFlowSnmpv2cPDUErrorIndex.Choice.Enum + 1345, // 1640: otg.PatternFlowSnmpv2cPDUErrorIndex.increment:type_name -> otg.PatternFlowSnmpv2cPDUErrorIndexCounter + 1345, // 1641: otg.PatternFlowSnmpv2cPDUErrorIndex.decrement:type_name -> otg.PatternFlowSnmpv2cPDUErrorIndexCounter + 379, // 1642: otg.PatternFlowSnmpv2cBulkPDURequestId.choice:type_name -> otg.PatternFlowSnmpv2cBulkPDURequestId.Choice.Enum + 1347, // 1643: otg.PatternFlowSnmpv2cBulkPDURequestId.increment:type_name -> otg.PatternFlowSnmpv2cBulkPDURequestIdCounter + 1347, // 1644: otg.PatternFlowSnmpv2cBulkPDURequestId.decrement:type_name -> otg.PatternFlowSnmpv2cBulkPDURequestIdCounter + 380, // 1645: otg.PatternFlowSnmpv2cBulkPDUNonRepeaters.choice:type_name -> otg.PatternFlowSnmpv2cBulkPDUNonRepeaters.Choice.Enum + 381, // 1646: otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions.choice:type_name -> otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions.Choice.Enum + 1350, // 1647: otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions.increment:type_name -> otg.PatternFlowSnmpv2cBulkPDUMaxRepetitionsCounter + 1350, // 1648: otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions.decrement:type_name -> otg.PatternFlowSnmpv2cBulkPDUMaxRepetitionsCounter + 382, // 1649: otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue.choice:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue.Choice.Enum + 1352, // 1650: otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue.increment:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIntegerValueCounter + 1352, // 1651: otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue.decrement:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIntegerValueCounter + 383, // 1652: otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue.choice:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue.Choice.Enum + 1354, // 1653: otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue.increment:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValueCounter + 1354, // 1654: otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue.decrement:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValueCounter + 384, // 1655: otg.PatternFlowSnmpv2cVariableBindingValueCounterValue.choice:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueCounterValue.Choice.Enum + 1356, // 1656: otg.PatternFlowSnmpv2cVariableBindingValueCounterValue.increment:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueCounterValueCounter + 1356, // 1657: otg.PatternFlowSnmpv2cVariableBindingValueCounterValue.decrement:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueCounterValueCounter + 385, // 1658: otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue.choice:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue.Choice.Enum + 1358, // 1659: otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue.increment:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValueCounter + 1358, // 1660: otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue.decrement:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValueCounter + 386, // 1661: otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue.choice:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue.Choice.Enum + 1360, // 1662: otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue.increment:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValueCounter + 1360, // 1663: otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue.decrement:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValueCounter + 387, // 1664: otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue.choice:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue.Choice.Enum + 1362, // 1665: otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue.increment:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValueCounter + 1362, // 1666: otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue.decrement:type_name -> otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValueCounter + 388, // 1667: otg.PatternFlowSnmpv2cCommonRequestId.choice:type_name -> otg.PatternFlowSnmpv2cCommonRequestId.Choice.Enum + 1364, // 1668: otg.PatternFlowSnmpv2cCommonRequestId.increment:type_name -> otg.PatternFlowSnmpv2cCommonRequestIdCounter + 1364, // 1669: otg.PatternFlowSnmpv2cCommonRequestId.decrement:type_name -> otg.PatternFlowSnmpv2cCommonRequestIdCounter + 389, // 1670: otg.PatternFlowRsvpRsvpChecksum.choice:type_name -> otg.PatternFlowRsvpRsvpChecksum.Choice.Enum + 390, // 1671: otg.PatternFlowRsvpRsvpChecksum.generated:type_name -> otg.PatternFlowRsvpRsvpChecksum.Generated.Enum + 391, // 1672: otg.PatternFlowRsvpTimeToLive.choice:type_name -> otg.PatternFlowRsvpTimeToLive.Choice.Enum + 1367, // 1673: otg.PatternFlowRsvpTimeToLive.increment:type_name -> otg.PatternFlowRsvpTimeToLiveCounter + 1367, // 1674: otg.PatternFlowRsvpTimeToLive.decrement:type_name -> otg.PatternFlowRsvpTimeToLiveCounter + 392, // 1675: otg.PatternFlowRsvpReserved.choice:type_name -> otg.PatternFlowRsvpReserved.Choice.Enum + 1369, // 1676: otg.PatternFlowRsvpReserved.increment:type_name -> otg.PatternFlowRsvpReservedCounter + 1369, // 1677: otg.PatternFlowRsvpReserved.decrement:type_name -> otg.PatternFlowRsvpReservedCounter + 393, // 1678: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.choice:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.Choice.Enum + 1371, // 1679: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.increment:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + 1371, // 1680: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.decrement:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + 394, // 1681: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.choice:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.Choice.Enum + 1373, // 1682: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.increment:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + 1373, // 1683: otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.decrement:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + 395, // 1684: otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.choice:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.Choice.Enum + 1375, // 1685: otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.increment:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + 1375, // 1686: otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.decrement:type_name -> otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + 396, // 1687: otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger.choice:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger.Choice.Enum + 1377, // 1688: otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger.increment:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + 1377, // 1689: otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger.decrement:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + 397, // 1690: otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.choice:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.Choice.Enum + 1379, // 1691: otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.increment:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + 1379, // 1692: otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.decrement:type_name -> otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + 398, // 1693: otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.choice:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.Choice.Enum + 1381, // 1694: otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.increment:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + 1381, // 1695: otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.decrement:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + 399, // 1696: otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle.choice:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle.Choice.Enum + 1383, // 1697: otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle.increment:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + 1383, // 1698: otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle.decrement:type_name -> otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + 400, // 1699: otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR.choice:type_name -> otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR.Choice.Enum + 1385, // 1700: otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR.increment:type_name -> otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + 1385, // 1701: otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR.decrement:type_name -> otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + 401, // 1702: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.choice:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.Choice.Enum + 1387, // 1703: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.increment:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + 1387, // 1704: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.decrement:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + 402, // 1705: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.choice:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.Choice.Enum + 1389, // 1706: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.increment:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + 1389, // 1707: otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.decrement:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + 403, // 1708: otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.choice:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.Choice.Enum + 1391, // 1709: otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.increment:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + 1391, // 1710: otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.decrement:type_name -> otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + 404, // 1711: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.choice:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.Choice.Enum + 1393, // 1712: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.increment:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + 1393, // 1713: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.decrement:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + 405, // 1714: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid.choice:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid.Choice.Enum + 1395, // 1715: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid.increment:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pidCounter + 1395, // 1716: otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid.decrement:type_name -> otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pidCounter + 406, // 1717: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.choice:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.Choice.Enum + 1397, // 1718: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.increment:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + 1397, // 1719: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.decrement:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + 407, // 1720: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.choice:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.Choice.Enum + 1399, // 1721: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.increment:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + 1399, // 1722: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.decrement:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + 408, // 1723: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.choice:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.Choice.Enum + 1401, // 1724: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.increment:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + 1401, // 1725: otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.decrement:type_name -> otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + 409, // 1726: otg.PatternFlowRSVPPathSenderTspecIntServVersion.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServVersion.Choice.Enum + 1403, // 1727: otg.PatternFlowRSVPPathSenderTspecIntServVersion.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter + 1403, // 1728: otg.PatternFlowRSVPPathSenderTspecIntServVersion.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter + 410, // 1729: otg.PatternFlowRSVPPathSenderTspecIntServReserved1.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved1.Choice.Enum + 1405, // 1730: otg.PatternFlowRSVPPathSenderTspecIntServReserved1.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter + 1405, // 1731: otg.PatternFlowRSVPPathSenderTspecIntServReserved1.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter + 411, // 1732: otg.PatternFlowRSVPPathSenderTspecIntServOverallLength.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServOverallLength.Choice.Enum + 1407, // 1733: otg.PatternFlowRSVPPathSenderTspecIntServOverallLength.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + 1407, // 1734: otg.PatternFlowRSVPPathSenderTspecIntServOverallLength.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + 412, // 1735: otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader.Choice.Enum + 1409, // 1736: otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + 1409, // 1737: otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + 413, // 1738: otg.PatternFlowRSVPPathSenderTspecIntServZeroBit.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServZeroBit.Choice.Enum + 1411, // 1739: otg.PatternFlowRSVPPathSenderTspecIntServZeroBit.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + 1411, // 1740: otg.PatternFlowRSVPPathSenderTspecIntServZeroBit.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + 414, // 1741: otg.PatternFlowRSVPPathSenderTspecIntServReserved2.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved2.Choice.Enum + 1413, // 1742: otg.PatternFlowRSVPPathSenderTspecIntServReserved2.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter + 1413, // 1743: otg.PatternFlowRSVPPathSenderTspecIntServReserved2.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter + 415, // 1744: otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.Choice.Enum + 1415, // 1745: otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + 1415, // 1746: otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + 416, // 1747: otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.Choice.Enum + 1417, // 1748: otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + 1417, // 1749: otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + 417, // 1750: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag.Choice.Enum + 1419, // 1751: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + 1419, // 1752: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + 418, // 1753: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length.Choice.Enum + 1421, // 1754: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + 1421, // 1755: otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + 419, // 1756: otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit.Choice.Enum + 1423, // 1757: otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + 1423, // 1758: otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + 420, // 1759: otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize.choice:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize.Choice.Enum + 1425, // 1760: otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize.increment:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + 1425, // 1761: otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize.decrement:type_name -> otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + 421, // 1762: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.choice:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.Choice.Enum + 1427, // 1763: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.increment:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + 1427, // 1764: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.decrement:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + 422, // 1765: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.choice:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.Choice.Enum + 1429, // 1766: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.increment:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + 1429, // 1767: otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.decrement:type_name -> otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + 423, // 1768: otg.PatternFlowRSVPPathRecordRouteType1LabelFlags.choice:type_name -> otg.PatternFlowRSVPPathRecordRouteType1LabelFlags.Choice.Enum + 424, // 1769: otg.PatternFlowRSVPPathRecordRouteType1LabelCType.choice:type_name -> otg.PatternFlowRSVPPathRecordRouteType1LabelCType.Choice.Enum + 425, // 1770: otg.PatternFlowRSVPPathObjectsCustomType.choice:type_name -> otg.PatternFlowRSVPPathObjectsCustomType.Choice.Enum + 1433, // 1771: otg.PatternFlowRSVPPathObjectsCustomType.increment:type_name -> otg.PatternFlowRSVPPathObjectsCustomTypeCounter + 1433, // 1772: otg.PatternFlowRSVPPathObjectsCustomType.decrement:type_name -> otg.PatternFlowRSVPPathObjectsCustomTypeCounter + 777, // 1773: otg.Success.warning:type_name -> otg.Warning + 776, // 1774: otg.Failure.error:type_name -> otg.Error + 426, // 1775: otg.SetConfigRequest.config:type_name -> otg.Config + 778, // 1776: otg.UpdateConfigRequest.config_update:type_name -> otg.ConfigUpdate + 777, // 1777: otg.SetConfigResponse.warning:type_name -> otg.Warning + 426, // 1778: otg.GetConfigResponse.config:type_name -> otg.Config + 777, // 1779: otg.UpdateConfigResponse.warning:type_name -> otg.Warning + 780, // 1780: otg.SetControlStateRequest.control_state:type_name -> otg.ControlState + 777, // 1781: otg.SetControlStateResponse.warning:type_name -> otg.Warning + 796, // 1782: otg.SetControlActionRequest.control_action:type_name -> otg.ControlAction + 797, // 1783: otg.SetControlActionResponse.control_action_response:type_name -> otg.ControlActionResponse + 816, // 1784: otg.GetMetricsRequest.metrics_request:type_name -> otg.MetricsRequest + 817, // 1785: otg.GetMetricsResponse.metrics_response:type_name -> otg.MetricsResponse + 847, // 1786: otg.GetStatesRequest.states_request:type_name -> otg.StatesRequest + 848, // 1787: otg.GetStatesResponse.states_response:type_name -> otg.StatesResponse + 910, // 1788: otg.GetCaptureRequest.capture_request:type_name -> otg.CaptureRequest + 1435, // 1789: otg.GetVersionResponse.version:type_name -> otg.Version + 1438, // 1790: otg.Openapi.SetConfig:input_type -> otg.SetConfigRequest + 1880, // 1791: otg.Openapi.GetConfig:input_type -> google.protobuf.Empty + 1439, // 1792: otg.Openapi.UpdateConfig:input_type -> otg.UpdateConfigRequest + 1443, // 1793: otg.Openapi.SetControlState:input_type -> otg.SetControlStateRequest + 1445, // 1794: otg.Openapi.SetControlAction:input_type -> otg.SetControlActionRequest + 1447, // 1795: otg.Openapi.GetMetrics:input_type -> otg.GetMetricsRequest + 1449, // 1796: otg.Openapi.GetStates:input_type -> otg.GetStatesRequest + 1451, // 1797: otg.Openapi.GetCapture:input_type -> otg.GetCaptureRequest + 1880, // 1798: otg.Openapi.GetVersion:input_type -> google.protobuf.Empty + 1440, // 1799: otg.Openapi.SetConfig:output_type -> otg.SetConfigResponse + 1441, // 1800: otg.Openapi.GetConfig:output_type -> otg.GetConfigResponse + 1442, // 1801: otg.Openapi.UpdateConfig:output_type -> otg.UpdateConfigResponse + 1444, // 1802: otg.Openapi.SetControlState:output_type -> otg.SetControlStateResponse + 1446, // 1803: otg.Openapi.SetControlAction:output_type -> otg.SetControlActionResponse + 1448, // 1804: otg.Openapi.GetMetrics:output_type -> otg.GetMetricsResponse + 1450, // 1805: otg.Openapi.GetStates:output_type -> otg.GetStatesResponse + 1452, // 1806: otg.Openapi.GetCapture:output_type -> otg.GetCaptureResponse + 1453, // 1807: otg.Openapi.GetVersion:output_type -> otg.GetVersionResponse + 1799, // [1799:1808] is the sub-list for method output_type + 1790, // [1790:1799] is the sub-list for method input_type + 1790, // [1790:1790] is the sub-list for extension type_name + 1790, // [1790:1790] is the sub-list for extension extendee + 0, // [0:1790] is the sub-list for field type_name } func init() { file_otg_proto_init() } @@ -152439,7 +153221,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[554].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4Src); i { + switch v := v.(*PatternFlowIpv4SrcRandom); i { case 0: return &v.state case 1: @@ -152451,7 +153233,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[555].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4DstCounter); i { + switch v := v.(*PatternFlowIpv4Src); i { case 0: return &v.state case 1: @@ -152463,7 +153245,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[556].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4DstMetricTag); i { + switch v := v.(*PatternFlowIpv4DstCounter); i { case 0: return &v.state case 1: @@ -152475,7 +153257,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[557].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4Dst); i { + switch v := v.(*PatternFlowIpv4DstMetricTag); i { case 0: return &v.state case 1: @@ -152487,7 +153269,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[558].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter); i { + switch v := v.(*PatternFlowIpv4DstRandom); i { case 0: return &v.state case 1: @@ -152499,7 +153281,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[559].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4OptionsCustomTypeCopiedFlag); i { + switch v := v.(*PatternFlowIpv4Dst); i { case 0: return &v.state case 1: @@ -152511,7 +153293,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[560].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4OptionsCustomTypeOptionClassCounter); i { + switch v := v.(*PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter); i { case 0: return &v.state case 1: @@ -152523,7 +153305,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[561].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4OptionsCustomTypeOptionClass); i { + switch v := v.(*PatternFlowIpv4OptionsCustomTypeCopiedFlag); i { case 0: return &v.state case 1: @@ -152535,7 +153317,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[562].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4OptionsCustomTypeOptionNumberCounter); i { + switch v := v.(*PatternFlowIpv4OptionsCustomTypeOptionClassCounter); i { case 0: return &v.state case 1: @@ -152547,7 +153329,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[563].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4OptionsCustomTypeOptionNumber); i { + switch v := v.(*PatternFlowIpv4OptionsCustomTypeOptionClass); i { case 0: return &v.state case 1: @@ -152559,7 +153341,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[564].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4PriorityRawCounter); i { + switch v := v.(*PatternFlowIpv4OptionsCustomTypeOptionNumberCounter); i { case 0: return &v.state case 1: @@ -152571,7 +153353,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[565].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4PriorityRawMetricTag); i { + switch v := v.(*PatternFlowIpv4OptionsCustomTypeOptionNumber); i { case 0: return &v.state case 1: @@ -152583,7 +153365,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[566].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4PriorityRaw); i { + switch v := v.(*PatternFlowIpv4PriorityRawCounter); i { case 0: return &v.state case 1: @@ -152595,7 +153377,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[567].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4DscpPhbCounter); i { + switch v := v.(*PatternFlowIpv4PriorityRawMetricTag); i { case 0: return &v.state case 1: @@ -152607,7 +153389,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[568].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4DscpPhbMetricTag); i { + switch v := v.(*PatternFlowIpv4PriorityRaw); i { case 0: return &v.state case 1: @@ -152619,7 +153401,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[569].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4DscpPhb); i { + switch v := v.(*PatternFlowIpv4DscpPhbCounter); i { case 0: return &v.state case 1: @@ -152631,7 +153413,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[570].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4DscpEcnCounter); i { + switch v := v.(*PatternFlowIpv4DscpPhbMetricTag); i { case 0: return &v.state case 1: @@ -152643,7 +153425,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[571].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4DscpEcnMetricTag); i { + switch v := v.(*PatternFlowIpv4DscpPhb); i { case 0: return &v.state case 1: @@ -152655,7 +153437,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[572].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4DscpEcn); i { + switch v := v.(*PatternFlowIpv4DscpEcnCounter); i { case 0: return &v.state case 1: @@ -152667,7 +153449,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[573].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosPrecedenceCounter); i { + switch v := v.(*PatternFlowIpv4DscpEcnMetricTag); i { case 0: return &v.state case 1: @@ -152679,7 +153461,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[574].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosPrecedenceMetricTag); i { + switch v := v.(*PatternFlowIpv4DscpEcn); i { case 0: return &v.state case 1: @@ -152691,7 +153473,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[575].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosPrecedence); i { + switch v := v.(*PatternFlowIpv4TosPrecedenceCounter); i { case 0: return &v.state case 1: @@ -152703,7 +153485,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[576].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosDelayCounter); i { + switch v := v.(*PatternFlowIpv4TosPrecedenceMetricTag); i { case 0: return &v.state case 1: @@ -152715,7 +153497,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[577].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosDelayMetricTag); i { + switch v := v.(*PatternFlowIpv4TosPrecedence); i { case 0: return &v.state case 1: @@ -152727,7 +153509,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[578].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosDelay); i { + switch v := v.(*PatternFlowIpv4TosDelayCounter); i { case 0: return &v.state case 1: @@ -152739,7 +153521,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[579].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosThroughputCounter); i { + switch v := v.(*PatternFlowIpv4TosDelayMetricTag); i { case 0: return &v.state case 1: @@ -152751,7 +153533,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[580].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosThroughputMetricTag); i { + switch v := v.(*PatternFlowIpv4TosDelay); i { case 0: return &v.state case 1: @@ -152763,7 +153545,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[581].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosThroughput); i { + switch v := v.(*PatternFlowIpv4TosThroughputCounter); i { case 0: return &v.state case 1: @@ -152775,7 +153557,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[582].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosReliabilityCounter); i { + switch v := v.(*PatternFlowIpv4TosThroughputMetricTag); i { case 0: return &v.state case 1: @@ -152787,7 +153569,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[583].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosReliabilityMetricTag); i { + switch v := v.(*PatternFlowIpv4TosThroughput); i { case 0: return &v.state case 1: @@ -152799,7 +153581,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[584].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosReliability); i { + switch v := v.(*PatternFlowIpv4TosReliabilityCounter); i { case 0: return &v.state case 1: @@ -152811,7 +153593,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[585].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosMonetaryCounter); i { + switch v := v.(*PatternFlowIpv4TosReliabilityMetricTag); i { case 0: return &v.state case 1: @@ -152823,7 +153605,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[586].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosMonetaryMetricTag); i { + switch v := v.(*PatternFlowIpv4TosReliability); i { case 0: return &v.state case 1: @@ -152835,7 +153617,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[587].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosMonetary); i { + switch v := v.(*PatternFlowIpv4TosMonetaryCounter); i { case 0: return &v.state case 1: @@ -152847,7 +153629,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[588].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosUnusedCounter); i { + switch v := v.(*PatternFlowIpv4TosMonetaryMetricTag); i { case 0: return &v.state case 1: @@ -152859,7 +153641,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[589].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosUnusedMetricTag); i { + switch v := v.(*PatternFlowIpv4TosMonetary); i { case 0: return &v.state case 1: @@ -152871,7 +153653,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[590].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv4TosUnused); i { + switch v := v.(*PatternFlowIpv4TosUnusedCounter); i { case 0: return &v.state case 1: @@ -152883,7 +153665,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[591].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6VersionCounter); i { + switch v := v.(*PatternFlowIpv4TosUnusedMetricTag); i { case 0: return &v.state case 1: @@ -152895,7 +153677,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[592].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6VersionMetricTag); i { + switch v := v.(*PatternFlowIpv4TosUnused); i { case 0: return &v.state case 1: @@ -152907,7 +153689,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[593].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6Version); i { + switch v := v.(*PatternFlowIpv6VersionCounter); i { case 0: return &v.state case 1: @@ -152919,7 +153701,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[594].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6TrafficClassCounter); i { + switch v := v.(*PatternFlowIpv6VersionMetricTag); i { case 0: return &v.state case 1: @@ -152931,7 +153713,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[595].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6TrafficClassMetricTag); i { + switch v := v.(*PatternFlowIpv6Version); i { case 0: return &v.state case 1: @@ -152943,7 +153725,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[596].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6TrafficClass); i { + switch v := v.(*PatternFlowIpv6TrafficClassCounter); i { case 0: return &v.state case 1: @@ -152955,7 +153737,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[597].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6FlowLabelCounter); i { + switch v := v.(*PatternFlowIpv6TrafficClassMetricTag); i { case 0: return &v.state case 1: @@ -152967,7 +153749,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[598].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6FlowLabelMetricTag); i { + switch v := v.(*PatternFlowIpv6TrafficClass); i { case 0: return &v.state case 1: @@ -152979,7 +153761,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[599].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6FlowLabel); i { + switch v := v.(*PatternFlowIpv6FlowLabelCounter); i { case 0: return &v.state case 1: @@ -152991,7 +153773,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[600].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6PayloadLengthCounter); i { + switch v := v.(*PatternFlowIpv6FlowLabelMetricTag); i { case 0: return &v.state case 1: @@ -153003,7 +153785,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[601].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6PayloadLengthMetricTag); i { + switch v := v.(*PatternFlowIpv6FlowLabelRandom); i { case 0: return &v.state case 1: @@ -153015,7 +153797,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[602].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6PayloadLength); i { + switch v := v.(*PatternFlowIpv6FlowLabel); i { case 0: return &v.state case 1: @@ -153027,7 +153809,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[603].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6NextHeaderCounter); i { + switch v := v.(*PatternFlowIpv6PayloadLengthCounter); i { case 0: return &v.state case 1: @@ -153039,7 +153821,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[604].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6NextHeaderMetricTag); i { + switch v := v.(*PatternFlowIpv6PayloadLengthMetricTag); i { case 0: return &v.state case 1: @@ -153051,7 +153833,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[605].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6NextHeader); i { + switch v := v.(*PatternFlowIpv6PayloadLength); i { case 0: return &v.state case 1: @@ -153063,7 +153845,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[606].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6HopLimitCounter); i { + switch v := v.(*PatternFlowIpv6NextHeaderCounter); i { case 0: return &v.state case 1: @@ -153075,7 +153857,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[607].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6HopLimitMetricTag); i { + switch v := v.(*PatternFlowIpv6NextHeaderMetricTag); i { case 0: return &v.state case 1: @@ -153087,7 +153869,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[608].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6HopLimit); i { + switch v := v.(*PatternFlowIpv6NextHeader); i { case 0: return &v.state case 1: @@ -153099,7 +153881,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[609].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6SrcCounter); i { + switch v := v.(*PatternFlowIpv6HopLimitCounter); i { case 0: return &v.state case 1: @@ -153111,7 +153893,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[610].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6SrcMetricTag); i { + switch v := v.(*PatternFlowIpv6HopLimitMetricTag); i { case 0: return &v.state case 1: @@ -153123,7 +153905,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[611].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6Src); i { + switch v := v.(*PatternFlowIpv6HopLimit); i { case 0: return &v.state case 1: @@ -153135,7 +153917,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[612].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6DstCounter); i { + switch v := v.(*PatternFlowIpv6SrcCounter); i { case 0: return &v.state case 1: @@ -153147,7 +153929,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[613].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6DstMetricTag); i { + switch v := v.(*PatternFlowIpv6SrcMetricTag); i { case 0: return &v.state case 1: @@ -153159,7 +153941,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[614].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIpv6Dst); i { + switch v := v.(*PatternFlowIpv6Src); i { case 0: return &v.state case 1: @@ -153171,7 +153953,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[615].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseDstCounter); i { + switch v := v.(*PatternFlowIpv6DstCounter); i { case 0: return &v.state case 1: @@ -153183,7 +153965,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[616].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseDstMetricTag); i { + switch v := v.(*PatternFlowIpv6DstMetricTag); i { case 0: return &v.state case 1: @@ -153195,7 +153977,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[617].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseDst); i { + switch v := v.(*PatternFlowIpv6Dst); i { case 0: return &v.state case 1: @@ -153207,7 +153989,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[618].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseSrcCounter); i { + switch v := v.(*PatternFlowPfcPauseDstCounter); i { case 0: return &v.state case 1: @@ -153219,7 +154001,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[619].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseSrcMetricTag); i { + switch v := v.(*PatternFlowPfcPauseDstMetricTag); i { case 0: return &v.state case 1: @@ -153231,7 +154013,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[620].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseSrc); i { + switch v := v.(*PatternFlowPfcPauseDst); i { case 0: return &v.state case 1: @@ -153243,7 +154025,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[621].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseEtherTypeCounter); i { + switch v := v.(*PatternFlowPfcPauseSrcCounter); i { case 0: return &v.state case 1: @@ -153255,7 +154037,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[622].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseEtherTypeMetricTag); i { + switch v := v.(*PatternFlowPfcPauseSrcMetricTag); i { case 0: return &v.state case 1: @@ -153267,7 +154049,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[623].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseEtherType); i { + switch v := v.(*PatternFlowPfcPauseSrc); i { case 0: return &v.state case 1: @@ -153279,7 +154061,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[624].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseControlOpCodeCounter); i { + switch v := v.(*PatternFlowPfcPauseEtherTypeCounter); i { case 0: return &v.state case 1: @@ -153291,7 +154073,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[625].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseControlOpCodeMetricTag); i { + switch v := v.(*PatternFlowPfcPauseEtherTypeMetricTag); i { case 0: return &v.state case 1: @@ -153303,7 +154085,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[626].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseControlOpCode); i { + switch v := v.(*PatternFlowPfcPauseEtherType); i { case 0: return &v.state case 1: @@ -153315,7 +154097,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[627].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseClassEnableVectorCounter); i { + switch v := v.(*PatternFlowPfcPauseControlOpCodeCounter); i { case 0: return &v.state case 1: @@ -153327,7 +154109,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[628].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseClassEnableVectorMetricTag); i { + switch v := v.(*PatternFlowPfcPauseControlOpCodeMetricTag); i { case 0: return &v.state case 1: @@ -153339,7 +154121,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[629].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPauseClassEnableVector); i { + switch v := v.(*PatternFlowPfcPauseControlOpCode); i { case 0: return &v.state case 1: @@ -153351,7 +154133,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[630].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass0Counter); i { + switch v := v.(*PatternFlowPfcPauseClassEnableVectorCounter); i { case 0: return &v.state case 1: @@ -153363,7 +154145,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[631].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass0MetricTag); i { + switch v := v.(*PatternFlowPfcPauseClassEnableVectorMetricTag); i { case 0: return &v.state case 1: @@ -153375,7 +154157,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[632].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass0); i { + switch v := v.(*PatternFlowPfcPauseClassEnableVector); i { case 0: return &v.state case 1: @@ -153387,7 +154169,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[633].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass1Counter); i { + switch v := v.(*PatternFlowPfcPausePauseClass0Counter); i { case 0: return &v.state case 1: @@ -153399,7 +154181,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[634].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass1MetricTag); i { + switch v := v.(*PatternFlowPfcPausePauseClass0MetricTag); i { case 0: return &v.state case 1: @@ -153411,7 +154193,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[635].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass1); i { + switch v := v.(*PatternFlowPfcPausePauseClass0); i { case 0: return &v.state case 1: @@ -153423,7 +154205,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[636].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass2Counter); i { + switch v := v.(*PatternFlowPfcPausePauseClass1Counter); i { case 0: return &v.state case 1: @@ -153435,7 +154217,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[637].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass2MetricTag); i { + switch v := v.(*PatternFlowPfcPausePauseClass1MetricTag); i { case 0: return &v.state case 1: @@ -153447,7 +154229,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[638].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass2); i { + switch v := v.(*PatternFlowPfcPausePauseClass1); i { case 0: return &v.state case 1: @@ -153459,7 +154241,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[639].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass3Counter); i { + switch v := v.(*PatternFlowPfcPausePauseClass2Counter); i { case 0: return &v.state case 1: @@ -153471,7 +154253,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[640].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass3MetricTag); i { + switch v := v.(*PatternFlowPfcPausePauseClass2MetricTag); i { case 0: return &v.state case 1: @@ -153483,7 +154265,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[641].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass3); i { + switch v := v.(*PatternFlowPfcPausePauseClass2); i { case 0: return &v.state case 1: @@ -153495,7 +154277,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[642].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass4Counter); i { + switch v := v.(*PatternFlowPfcPausePauseClass3Counter); i { case 0: return &v.state case 1: @@ -153507,7 +154289,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[643].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass4MetricTag); i { + switch v := v.(*PatternFlowPfcPausePauseClass3MetricTag); i { case 0: return &v.state case 1: @@ -153519,7 +154301,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[644].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass4); i { + switch v := v.(*PatternFlowPfcPausePauseClass3); i { case 0: return &v.state case 1: @@ -153531,7 +154313,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[645].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass5Counter); i { + switch v := v.(*PatternFlowPfcPausePauseClass4Counter); i { case 0: return &v.state case 1: @@ -153543,7 +154325,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[646].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass5MetricTag); i { + switch v := v.(*PatternFlowPfcPausePauseClass4MetricTag); i { case 0: return &v.state case 1: @@ -153555,7 +154337,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[647].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass5); i { + switch v := v.(*PatternFlowPfcPausePauseClass4); i { case 0: return &v.state case 1: @@ -153567,7 +154349,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[648].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass6Counter); i { + switch v := v.(*PatternFlowPfcPausePauseClass5Counter); i { case 0: return &v.state case 1: @@ -153579,7 +154361,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[649].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass6MetricTag); i { + switch v := v.(*PatternFlowPfcPausePauseClass5MetricTag); i { case 0: return &v.state case 1: @@ -153591,7 +154373,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[650].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass6); i { + switch v := v.(*PatternFlowPfcPausePauseClass5); i { case 0: return &v.state case 1: @@ -153603,7 +154385,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[651].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass7Counter); i { + switch v := v.(*PatternFlowPfcPausePauseClass6Counter); i { case 0: return &v.state case 1: @@ -153615,7 +154397,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[652].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass7MetricTag); i { + switch v := v.(*PatternFlowPfcPausePauseClass6MetricTag); i { case 0: return &v.state case 1: @@ -153627,7 +154409,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[653].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPfcPausePauseClass7); i { + switch v := v.(*PatternFlowPfcPausePauseClass6); i { case 0: return &v.state case 1: @@ -153639,7 +154421,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[654].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseDstCounter); i { + switch v := v.(*PatternFlowPfcPausePauseClass7Counter); i { case 0: return &v.state case 1: @@ -153651,7 +154433,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[655].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseDstMetricTag); i { + switch v := v.(*PatternFlowPfcPausePauseClass7MetricTag); i { case 0: return &v.state case 1: @@ -153663,7 +154445,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[656].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseDst); i { + switch v := v.(*PatternFlowPfcPausePauseClass7); i { case 0: return &v.state case 1: @@ -153675,7 +154457,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[657].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseSrcCounter); i { + switch v := v.(*PatternFlowEthernetPauseDstCounter); i { case 0: return &v.state case 1: @@ -153687,7 +154469,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[658].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseSrcMetricTag); i { + switch v := v.(*PatternFlowEthernetPauseDstMetricTag); i { case 0: return &v.state case 1: @@ -153699,7 +154481,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[659].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseSrc); i { + switch v := v.(*PatternFlowEthernetPauseDst); i { case 0: return &v.state case 1: @@ -153711,7 +154493,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[660].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseEtherTypeCounter); i { + switch v := v.(*PatternFlowEthernetPauseSrcCounter); i { case 0: return &v.state case 1: @@ -153723,7 +154505,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[661].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseEtherTypeMetricTag); i { + switch v := v.(*PatternFlowEthernetPauseSrcMetricTag); i { case 0: return &v.state case 1: @@ -153735,7 +154517,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[662].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseEtherType); i { + switch v := v.(*PatternFlowEthernetPauseSrc); i { case 0: return &v.state case 1: @@ -153747,7 +154529,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[663].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseControlOpCodeCounter); i { + switch v := v.(*PatternFlowEthernetPauseEtherTypeCounter); i { case 0: return &v.state case 1: @@ -153759,7 +154541,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[664].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseControlOpCodeMetricTag); i { + switch v := v.(*PatternFlowEthernetPauseEtherTypeMetricTag); i { case 0: return &v.state case 1: @@ -153771,7 +154553,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[665].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseControlOpCode); i { + switch v := v.(*PatternFlowEthernetPauseEtherType); i { case 0: return &v.state case 1: @@ -153783,7 +154565,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[666].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseTimeCounter); i { + switch v := v.(*PatternFlowEthernetPauseControlOpCodeCounter); i { case 0: return &v.state case 1: @@ -153795,7 +154577,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[667].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseTimeMetricTag); i { + switch v := v.(*PatternFlowEthernetPauseControlOpCodeMetricTag); i { case 0: return &v.state case 1: @@ -153807,7 +154589,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[668].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowEthernetPauseTime); i { + switch v := v.(*PatternFlowEthernetPauseControlOpCode); i { case 0: return &v.state case 1: @@ -153819,7 +154601,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[669].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpSrcPortCounter); i { + switch v := v.(*PatternFlowEthernetPauseTimeCounter); i { case 0: return &v.state case 1: @@ -153831,7 +154613,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[670].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpSrcPortMetricTag); i { + switch v := v.(*PatternFlowEthernetPauseTimeMetricTag); i { case 0: return &v.state case 1: @@ -153843,7 +154625,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[671].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpSrcPort); i { + switch v := v.(*PatternFlowEthernetPauseTime); i { case 0: return &v.state case 1: @@ -153855,7 +154637,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[672].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpDstPortCounter); i { + switch v := v.(*PatternFlowTcpSrcPortCounter); i { case 0: return &v.state case 1: @@ -153867,7 +154649,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[673].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpDstPortMetricTag); i { + switch v := v.(*PatternFlowTcpSrcPortMetricTag); i { case 0: return &v.state case 1: @@ -153879,7 +154661,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[674].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpDstPort); i { + switch v := v.(*PatternFlowTcpSrcPortRandom); i { case 0: return &v.state case 1: @@ -153891,7 +154673,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[675].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpSeqNumCounter); i { + switch v := v.(*PatternFlowTcpSrcPort); i { case 0: return &v.state case 1: @@ -153903,7 +154685,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[676].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpSeqNumMetricTag); i { + switch v := v.(*PatternFlowTcpDstPortCounter); i { case 0: return &v.state case 1: @@ -153915,7 +154697,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[677].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpSeqNum); i { + switch v := v.(*PatternFlowTcpDstPortMetricTag); i { case 0: return &v.state case 1: @@ -153927,7 +154709,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[678].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpAckNumCounter); i { + switch v := v.(*PatternFlowTcpDstPortRandom); i { case 0: return &v.state case 1: @@ -153939,7 +154721,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[679].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpAckNumMetricTag); i { + switch v := v.(*PatternFlowTcpDstPort); i { case 0: return &v.state case 1: @@ -153951,7 +154733,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[680].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpAckNum); i { + switch v := v.(*PatternFlowTcpSeqNumCounter); i { case 0: return &v.state case 1: @@ -153963,7 +154745,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[681].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpDataOffsetCounter); i { + switch v := v.(*PatternFlowTcpSeqNumMetricTag); i { case 0: return &v.state case 1: @@ -153975,7 +154757,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[682].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpDataOffsetMetricTag); i { + switch v := v.(*PatternFlowTcpSeqNum); i { case 0: return &v.state case 1: @@ -153987,7 +154769,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[683].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpDataOffset); i { + switch v := v.(*PatternFlowTcpAckNumCounter); i { case 0: return &v.state case 1: @@ -153999,7 +154781,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[684].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpEcnNsCounter); i { + switch v := v.(*PatternFlowTcpAckNumMetricTag); i { case 0: return &v.state case 1: @@ -154011,7 +154793,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[685].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpEcnNsMetricTag); i { + switch v := v.(*PatternFlowTcpAckNum); i { case 0: return &v.state case 1: @@ -154023,7 +154805,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[686].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpEcnNs); i { + switch v := v.(*PatternFlowTcpDataOffsetCounter); i { case 0: return &v.state case 1: @@ -154035,7 +154817,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[687].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpEcnCwrCounter); i { + switch v := v.(*PatternFlowTcpDataOffsetMetricTag); i { case 0: return &v.state case 1: @@ -154047,7 +154829,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[688].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpEcnCwrMetricTag); i { + switch v := v.(*PatternFlowTcpDataOffset); i { case 0: return &v.state case 1: @@ -154059,7 +154841,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[689].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpEcnCwr); i { + switch v := v.(*PatternFlowTcpEcnNsCounter); i { case 0: return &v.state case 1: @@ -154071,7 +154853,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[690].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpEcnEchoCounter); i { + switch v := v.(*PatternFlowTcpEcnNsMetricTag); i { case 0: return &v.state case 1: @@ -154083,7 +154865,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[691].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpEcnEchoMetricTag); i { + switch v := v.(*PatternFlowTcpEcnNs); i { case 0: return &v.state case 1: @@ -154095,7 +154877,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[692].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpEcnEcho); i { + switch v := v.(*PatternFlowTcpEcnCwrCounter); i { case 0: return &v.state case 1: @@ -154107,7 +154889,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[693].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlUrgCounter); i { + switch v := v.(*PatternFlowTcpEcnCwrMetricTag); i { case 0: return &v.state case 1: @@ -154119,7 +154901,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[694].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlUrgMetricTag); i { + switch v := v.(*PatternFlowTcpEcnCwr); i { case 0: return &v.state case 1: @@ -154131,7 +154913,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[695].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlUrg); i { + switch v := v.(*PatternFlowTcpEcnEchoCounter); i { case 0: return &v.state case 1: @@ -154143,7 +154925,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[696].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlAckCounter); i { + switch v := v.(*PatternFlowTcpEcnEchoMetricTag); i { case 0: return &v.state case 1: @@ -154155,7 +154937,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[697].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlAckMetricTag); i { + switch v := v.(*PatternFlowTcpEcnEcho); i { case 0: return &v.state case 1: @@ -154167,7 +154949,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[698].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlAck); i { + switch v := v.(*PatternFlowTcpCtlUrgCounter); i { case 0: return &v.state case 1: @@ -154179,7 +154961,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[699].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlPshCounter); i { + switch v := v.(*PatternFlowTcpCtlUrgMetricTag); i { case 0: return &v.state case 1: @@ -154191,7 +154973,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[700].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlPshMetricTag); i { + switch v := v.(*PatternFlowTcpCtlUrg); i { case 0: return &v.state case 1: @@ -154203,7 +154985,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[701].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlPsh); i { + switch v := v.(*PatternFlowTcpCtlAckCounter); i { case 0: return &v.state case 1: @@ -154215,7 +154997,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[702].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlRstCounter); i { + switch v := v.(*PatternFlowTcpCtlAckMetricTag); i { case 0: return &v.state case 1: @@ -154227,7 +155009,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[703].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlRstMetricTag); i { + switch v := v.(*PatternFlowTcpCtlAck); i { case 0: return &v.state case 1: @@ -154239,7 +155021,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[704].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlRst); i { + switch v := v.(*PatternFlowTcpCtlPshCounter); i { case 0: return &v.state case 1: @@ -154251,7 +155033,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[705].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlSynCounter); i { + switch v := v.(*PatternFlowTcpCtlPshMetricTag); i { case 0: return &v.state case 1: @@ -154263,7 +155045,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[706].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlSynMetricTag); i { + switch v := v.(*PatternFlowTcpCtlPsh); i { case 0: return &v.state case 1: @@ -154275,7 +155057,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[707].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlSyn); i { + switch v := v.(*PatternFlowTcpCtlRstCounter); i { case 0: return &v.state case 1: @@ -154287,7 +155069,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[708].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlFinCounter); i { + switch v := v.(*PatternFlowTcpCtlRstMetricTag); i { case 0: return &v.state case 1: @@ -154299,7 +155081,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[709].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlFinMetricTag); i { + switch v := v.(*PatternFlowTcpCtlRst); i { case 0: return &v.state case 1: @@ -154311,7 +155093,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[710].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpCtlFin); i { + switch v := v.(*PatternFlowTcpCtlSynCounter); i { case 0: return &v.state case 1: @@ -154323,7 +155105,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[711].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpWindowCounter); i { + switch v := v.(*PatternFlowTcpCtlSynMetricTag); i { case 0: return &v.state case 1: @@ -154335,7 +155117,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[712].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpWindowMetricTag); i { + switch v := v.(*PatternFlowTcpCtlSyn); i { case 0: return &v.state case 1: @@ -154347,7 +155129,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[713].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpWindow); i { + switch v := v.(*PatternFlowTcpCtlFinCounter); i { case 0: return &v.state case 1: @@ -154359,7 +155141,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[714].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowTcpChecksum); i { + switch v := v.(*PatternFlowTcpCtlFinMetricTag); i { case 0: return &v.state case 1: @@ -154371,7 +155153,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[715].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowUdpSrcPortCounter); i { + switch v := v.(*PatternFlowTcpCtlFin); i { case 0: return &v.state case 1: @@ -154383,7 +155165,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[716].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowUdpSrcPortMetricTag); i { + switch v := v.(*PatternFlowTcpWindowCounter); i { case 0: return &v.state case 1: @@ -154395,7 +155177,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[717].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowUdpSrcPort); i { + switch v := v.(*PatternFlowTcpWindowMetricTag); i { case 0: return &v.state case 1: @@ -154407,7 +155189,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[718].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowUdpDstPortCounter); i { + switch v := v.(*PatternFlowTcpWindow); i { case 0: return &v.state case 1: @@ -154419,7 +155201,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[719].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowUdpDstPortMetricTag); i { + switch v := v.(*PatternFlowTcpChecksum); i { case 0: return &v.state case 1: @@ -154431,7 +155213,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[720].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowUdpDstPort); i { + switch v := v.(*PatternFlowUdpSrcPortCounter); i { case 0: return &v.state case 1: @@ -154443,7 +155225,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[721].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowUdpLengthCounter); i { + switch v := v.(*PatternFlowUdpSrcPortMetricTag); i { case 0: return &v.state case 1: @@ -154455,7 +155237,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[722].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowUdpLengthMetricTag); i { + switch v := v.(*PatternFlowUdpSrcPortRandom); i { case 0: return &v.state case 1: @@ -154467,7 +155249,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[723].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowUdpLength); i { + switch v := v.(*PatternFlowUdpSrcPort); i { case 0: return &v.state case 1: @@ -154479,7 +155261,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[724].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowUdpChecksum); i { + switch v := v.(*PatternFlowUdpDstPortCounter); i { case 0: return &v.state case 1: @@ -154491,7 +155273,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[725].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreChecksumPresentCounter); i { + switch v := v.(*PatternFlowUdpDstPortMetricTag); i { case 0: return &v.state case 1: @@ -154503,7 +155285,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[726].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreChecksumPresentMetricTag); i { + switch v := v.(*PatternFlowUdpDstPortRandom); i { case 0: return &v.state case 1: @@ -154515,7 +155297,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[727].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreChecksumPresent); i { + switch v := v.(*PatternFlowUdpDstPort); i { case 0: return &v.state case 1: @@ -154527,7 +155309,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[728].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreReserved0Counter); i { + switch v := v.(*PatternFlowUdpLengthCounter); i { case 0: return &v.state case 1: @@ -154539,7 +155321,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[729].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreReserved0MetricTag); i { + switch v := v.(*PatternFlowUdpLengthMetricTag); i { case 0: return &v.state case 1: @@ -154551,7 +155333,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[730].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreReserved0); i { + switch v := v.(*PatternFlowUdpLength); i { case 0: return &v.state case 1: @@ -154563,7 +155345,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[731].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreVersionCounter); i { + switch v := v.(*PatternFlowUdpChecksum); i { case 0: return &v.state case 1: @@ -154575,7 +155357,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[732].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreVersionMetricTag); i { + switch v := v.(*PatternFlowGreChecksumPresentCounter); i { case 0: return &v.state case 1: @@ -154587,7 +155369,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[733].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreVersion); i { + switch v := v.(*PatternFlowGreChecksumPresentMetricTag); i { case 0: return &v.state case 1: @@ -154599,7 +155381,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[734].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreProtocolCounter); i { + switch v := v.(*PatternFlowGreChecksumPresent); i { case 0: return &v.state case 1: @@ -154611,7 +155393,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[735].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreProtocolMetricTag); i { + switch v := v.(*PatternFlowGreReserved0Counter); i { case 0: return &v.state case 1: @@ -154623,7 +155405,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[736].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreProtocol); i { + switch v := v.(*PatternFlowGreReserved0MetricTag); i { case 0: return &v.state case 1: @@ -154635,7 +155417,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[737].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreChecksum); i { + switch v := v.(*PatternFlowGreReserved0); i { case 0: return &v.state case 1: @@ -154647,7 +155429,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[738].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreReserved1Counter); i { + switch v := v.(*PatternFlowGreVersionCounter); i { case 0: return &v.state case 1: @@ -154659,7 +155441,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[739].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreReserved1MetricTag); i { + switch v := v.(*PatternFlowGreVersionMetricTag); i { case 0: return &v.state case 1: @@ -154671,7 +155453,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[740].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGreReserved1); i { + switch v := v.(*PatternFlowGreVersion); i { case 0: return &v.state case 1: @@ -154683,7 +155465,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[741].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1VersionCounter); i { + switch v := v.(*PatternFlowGreProtocolCounter); i { case 0: return &v.state case 1: @@ -154695,7 +155477,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[742].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1VersionMetricTag); i { + switch v := v.(*PatternFlowGreProtocolMetricTag); i { case 0: return &v.state case 1: @@ -154707,7 +155489,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[743].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1Version); i { + switch v := v.(*PatternFlowGreProtocol); i { case 0: return &v.state case 1: @@ -154719,7 +155501,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[744].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1ProtocolTypeCounter); i { + switch v := v.(*PatternFlowGreChecksum); i { case 0: return &v.state case 1: @@ -154731,7 +155513,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[745].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1ProtocolTypeMetricTag); i { + switch v := v.(*PatternFlowGreReserved1Counter); i { case 0: return &v.state case 1: @@ -154743,7 +155525,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[746].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1ProtocolType); i { + switch v := v.(*PatternFlowGreReserved1MetricTag); i { case 0: return &v.state case 1: @@ -154755,7 +155537,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[747].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1ReservedCounter); i { + switch v := v.(*PatternFlowGreReserved1); i { case 0: return &v.state case 1: @@ -154767,7 +155549,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[748].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1ReservedMetricTag); i { + switch v := v.(*PatternFlowGtpv1VersionCounter); i { case 0: return &v.state case 1: @@ -154779,7 +155561,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[749].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1Reserved); i { + switch v := v.(*PatternFlowGtpv1VersionMetricTag); i { case 0: return &v.state case 1: @@ -154791,7 +155573,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[750].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1EFlagCounter); i { + switch v := v.(*PatternFlowGtpv1Version); i { case 0: return &v.state case 1: @@ -154803,7 +155585,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[751].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1EFlagMetricTag); i { + switch v := v.(*PatternFlowGtpv1ProtocolTypeCounter); i { case 0: return &v.state case 1: @@ -154815,7 +155597,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[752].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1EFlag); i { + switch v := v.(*PatternFlowGtpv1ProtocolTypeMetricTag); i { case 0: return &v.state case 1: @@ -154827,7 +155609,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[753].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1SFlagCounter); i { + switch v := v.(*PatternFlowGtpv1ProtocolType); i { case 0: return &v.state case 1: @@ -154839,7 +155621,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[754].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1SFlagMetricTag); i { + switch v := v.(*PatternFlowGtpv1ReservedCounter); i { case 0: return &v.state case 1: @@ -154851,7 +155633,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[755].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1SFlag); i { + switch v := v.(*PatternFlowGtpv1ReservedMetricTag); i { case 0: return &v.state case 1: @@ -154863,7 +155645,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[756].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1PnFlagCounter); i { + switch v := v.(*PatternFlowGtpv1Reserved); i { case 0: return &v.state case 1: @@ -154875,7 +155657,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[757].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1PnFlagMetricTag); i { + switch v := v.(*PatternFlowGtpv1EFlagCounter); i { case 0: return &v.state case 1: @@ -154887,7 +155669,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[758].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1PnFlag); i { + switch v := v.(*PatternFlowGtpv1EFlagMetricTag); i { case 0: return &v.state case 1: @@ -154899,7 +155681,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[759].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1MessageTypeCounter); i { + switch v := v.(*PatternFlowGtpv1EFlag); i { case 0: return &v.state case 1: @@ -154911,7 +155693,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[760].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1MessageTypeMetricTag); i { + switch v := v.(*PatternFlowGtpv1SFlagCounter); i { case 0: return &v.state case 1: @@ -154923,7 +155705,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[761].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1MessageType); i { + switch v := v.(*PatternFlowGtpv1SFlagMetricTag); i { case 0: return &v.state case 1: @@ -154935,7 +155717,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[762].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1MessageLengthCounter); i { + switch v := v.(*PatternFlowGtpv1SFlag); i { case 0: return &v.state case 1: @@ -154947,7 +155729,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[763].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1MessageLengthMetricTag); i { + switch v := v.(*PatternFlowGtpv1PnFlagCounter); i { case 0: return &v.state case 1: @@ -154959,7 +155741,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[764].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1MessageLength); i { + switch v := v.(*PatternFlowGtpv1PnFlagMetricTag); i { case 0: return &v.state case 1: @@ -154971,7 +155753,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[765].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1TeidCounter); i { + switch v := v.(*PatternFlowGtpv1PnFlag); i { case 0: return &v.state case 1: @@ -154983,7 +155765,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[766].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1TeidMetricTag); i { + switch v := v.(*PatternFlowGtpv1MessageTypeCounter); i { case 0: return &v.state case 1: @@ -154995,7 +155777,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[767].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1Teid); i { + switch v := v.(*PatternFlowGtpv1MessageTypeMetricTag); i { case 0: return &v.state case 1: @@ -155007,7 +155789,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[768].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1SquenceNumberCounter); i { + switch v := v.(*PatternFlowGtpv1MessageType); i { case 0: return &v.state case 1: @@ -155019,7 +155801,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[769].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1SquenceNumberMetricTag); i { + switch v := v.(*PatternFlowGtpv1MessageLengthCounter); i { case 0: return &v.state case 1: @@ -155031,7 +155813,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[770].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1SquenceNumber); i { + switch v := v.(*PatternFlowGtpv1MessageLengthMetricTag); i { case 0: return &v.state case 1: @@ -155043,7 +155825,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[771].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1NPduNumberCounter); i { + switch v := v.(*PatternFlowGtpv1MessageLength); i { case 0: return &v.state case 1: @@ -155055,7 +155837,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[772].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1NPduNumberMetricTag); i { + switch v := v.(*PatternFlowGtpv1TeidCounter); i { case 0: return &v.state case 1: @@ -155067,7 +155849,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[773].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1NPduNumber); i { + switch v := v.(*PatternFlowGtpv1TeidMetricTag); i { case 0: return &v.state case 1: @@ -155079,7 +155861,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[774].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1NextExtensionHeaderTypeCounter); i { + switch v := v.(*PatternFlowGtpv1Teid); i { case 0: return &v.state case 1: @@ -155091,7 +155873,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[775].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1NextExtensionHeaderTypeMetricTag); i { + switch v := v.(*PatternFlowGtpv1SquenceNumberCounter); i { case 0: return &v.state case 1: @@ -155103,7 +155885,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[776].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv1NextExtensionHeaderType); i { + switch v := v.(*PatternFlowGtpv1SquenceNumberMetricTag); i { case 0: return &v.state case 1: @@ -155115,7 +155897,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[777].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpExtensionExtensionLengthCounter); i { + switch v := v.(*PatternFlowGtpv1SquenceNumber); i { case 0: return &v.state case 1: @@ -155127,7 +155909,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[778].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpExtensionExtensionLengthMetricTag); i { + switch v := v.(*PatternFlowGtpv1NPduNumberCounter); i { case 0: return &v.state case 1: @@ -155139,7 +155921,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[779].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpExtensionExtensionLength); i { + switch v := v.(*PatternFlowGtpv1NPduNumberMetricTag); i { case 0: return &v.state case 1: @@ -155151,7 +155933,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[780].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpExtensionContentsCounter); i { + switch v := v.(*PatternFlowGtpv1NPduNumber); i { case 0: return &v.state case 1: @@ -155163,7 +155945,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[781].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpExtensionContentsMetricTag); i { + switch v := v.(*PatternFlowGtpv1NextExtensionHeaderTypeCounter); i { case 0: return &v.state case 1: @@ -155175,7 +155957,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[782].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpExtensionContents); i { + switch v := v.(*PatternFlowGtpv1NextExtensionHeaderTypeMetricTag); i { case 0: return &v.state case 1: @@ -155187,7 +155969,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[783].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpExtensionNextExtensionHeaderCounter); i { + switch v := v.(*PatternFlowGtpv1NextExtensionHeaderType); i { case 0: return &v.state case 1: @@ -155199,7 +155981,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[784].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpExtensionNextExtensionHeaderMetricTag); i { + switch v := v.(*PatternFlowGtpExtensionExtensionLengthCounter); i { case 0: return &v.state case 1: @@ -155211,7 +155993,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[785].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpExtensionNextExtensionHeader); i { + switch v := v.(*PatternFlowGtpExtensionExtensionLengthMetricTag); i { case 0: return &v.state case 1: @@ -155223,7 +156005,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[786].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2VersionCounter); i { + switch v := v.(*PatternFlowGtpExtensionExtensionLength); i { case 0: return &v.state case 1: @@ -155235,7 +156017,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[787].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2VersionMetricTag); i { + switch v := v.(*PatternFlowGtpExtensionContentsCounter); i { case 0: return &v.state case 1: @@ -155247,7 +156029,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[788].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2Version); i { + switch v := v.(*PatternFlowGtpExtensionContentsMetricTag); i { case 0: return &v.state case 1: @@ -155259,7 +156041,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[789].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2PiggybackingFlagCounter); i { + switch v := v.(*PatternFlowGtpExtensionContents); i { case 0: return &v.state case 1: @@ -155271,7 +156053,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[790].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2PiggybackingFlagMetricTag); i { + switch v := v.(*PatternFlowGtpExtensionNextExtensionHeaderCounter); i { case 0: return &v.state case 1: @@ -155283,7 +156065,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[791].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2PiggybackingFlag); i { + switch v := v.(*PatternFlowGtpExtensionNextExtensionHeaderMetricTag); i { case 0: return &v.state case 1: @@ -155295,7 +156077,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[792].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2TeidFlagCounter); i { + switch v := v.(*PatternFlowGtpExtensionNextExtensionHeader); i { case 0: return &v.state case 1: @@ -155307,7 +156089,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[793].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2TeidFlagMetricTag); i { + switch v := v.(*PatternFlowGtpv2VersionCounter); i { case 0: return &v.state case 1: @@ -155319,7 +156101,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[794].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2TeidFlag); i { + switch v := v.(*PatternFlowGtpv2VersionMetricTag); i { case 0: return &v.state case 1: @@ -155331,7 +156113,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[795].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2Spare1Counter); i { + switch v := v.(*PatternFlowGtpv2Version); i { case 0: return &v.state case 1: @@ -155343,7 +156125,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[796].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2Spare1MetricTag); i { + switch v := v.(*PatternFlowGtpv2PiggybackingFlagCounter); i { case 0: return &v.state case 1: @@ -155355,7 +156137,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[797].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2Spare1); i { + switch v := v.(*PatternFlowGtpv2PiggybackingFlagMetricTag); i { case 0: return &v.state case 1: @@ -155367,7 +156149,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[798].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2MessageTypeCounter); i { + switch v := v.(*PatternFlowGtpv2PiggybackingFlag); i { case 0: return &v.state case 1: @@ -155379,7 +156161,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[799].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2MessageTypeMetricTag); i { + switch v := v.(*PatternFlowGtpv2TeidFlagCounter); i { case 0: return &v.state case 1: @@ -155391,7 +156173,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[800].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2MessageType); i { + switch v := v.(*PatternFlowGtpv2TeidFlagMetricTag); i { case 0: return &v.state case 1: @@ -155403,7 +156185,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[801].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2MessageLengthCounter); i { + switch v := v.(*PatternFlowGtpv2TeidFlag); i { case 0: return &v.state case 1: @@ -155415,7 +156197,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[802].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2MessageLengthMetricTag); i { + switch v := v.(*PatternFlowGtpv2Spare1Counter); i { case 0: return &v.state case 1: @@ -155427,7 +156209,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[803].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2MessageLength); i { + switch v := v.(*PatternFlowGtpv2Spare1MetricTag); i { case 0: return &v.state case 1: @@ -155439,7 +156221,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[804].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2TeidCounter); i { + switch v := v.(*PatternFlowGtpv2Spare1); i { case 0: return &v.state case 1: @@ -155451,7 +156233,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[805].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2TeidMetricTag); i { + switch v := v.(*PatternFlowGtpv2MessageTypeCounter); i { case 0: return &v.state case 1: @@ -155463,7 +156245,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[806].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2Teid); i { + switch v := v.(*PatternFlowGtpv2MessageTypeMetricTag); i { case 0: return &v.state case 1: @@ -155475,7 +156257,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[807].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2SequenceNumberCounter); i { + switch v := v.(*PatternFlowGtpv2MessageType); i { case 0: return &v.state case 1: @@ -155487,7 +156269,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[808].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2SequenceNumberMetricTag); i { + switch v := v.(*PatternFlowGtpv2MessageLengthCounter); i { case 0: return &v.state case 1: @@ -155499,7 +156281,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[809].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2SequenceNumber); i { + switch v := v.(*PatternFlowGtpv2MessageLengthMetricTag); i { case 0: return &v.state case 1: @@ -155511,7 +156293,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[810].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2Spare2Counter); i { + switch v := v.(*PatternFlowGtpv2MessageLength); i { case 0: return &v.state case 1: @@ -155523,7 +156305,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[811].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2Spare2MetricTag); i { + switch v := v.(*PatternFlowGtpv2TeidCounter); i { case 0: return &v.state case 1: @@ -155535,7 +156317,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[812].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowGtpv2Spare2); i { + switch v := v.(*PatternFlowGtpv2TeidMetricTag); i { case 0: return &v.state case 1: @@ -155547,7 +156329,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[813].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpHardwareTypeCounter); i { + switch v := v.(*PatternFlowGtpv2Teid); i { case 0: return &v.state case 1: @@ -155559,7 +156341,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[814].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpHardwareTypeMetricTag); i { + switch v := v.(*PatternFlowGtpv2SequenceNumberCounter); i { case 0: return &v.state case 1: @@ -155571,7 +156353,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[815].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpHardwareType); i { + switch v := v.(*PatternFlowGtpv2SequenceNumberMetricTag); i { case 0: return &v.state case 1: @@ -155583,7 +156365,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[816].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpProtocolTypeCounter); i { + switch v := v.(*PatternFlowGtpv2SequenceNumber); i { case 0: return &v.state case 1: @@ -155595,7 +156377,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[817].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpProtocolTypeMetricTag); i { + switch v := v.(*PatternFlowGtpv2Spare2Counter); i { case 0: return &v.state case 1: @@ -155607,7 +156389,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[818].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpProtocolType); i { + switch v := v.(*PatternFlowGtpv2Spare2MetricTag); i { case 0: return &v.state case 1: @@ -155619,7 +156401,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[819].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpHardwareLengthCounter); i { + switch v := v.(*PatternFlowGtpv2Spare2); i { case 0: return &v.state case 1: @@ -155631,7 +156413,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[820].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpHardwareLengthMetricTag); i { + switch v := v.(*PatternFlowArpHardwareTypeCounter); i { case 0: return &v.state case 1: @@ -155643,7 +156425,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[821].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpHardwareLength); i { + switch v := v.(*PatternFlowArpHardwareTypeMetricTag); i { case 0: return &v.state case 1: @@ -155655,7 +156437,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[822].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpProtocolLengthCounter); i { + switch v := v.(*PatternFlowArpHardwareType); i { case 0: return &v.state case 1: @@ -155667,7 +156449,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[823].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpProtocolLengthMetricTag); i { + switch v := v.(*PatternFlowArpProtocolTypeCounter); i { case 0: return &v.state case 1: @@ -155679,7 +156461,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[824].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpProtocolLength); i { + switch v := v.(*PatternFlowArpProtocolTypeMetricTag); i { case 0: return &v.state case 1: @@ -155691,7 +156473,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[825].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpOperationCounter); i { + switch v := v.(*PatternFlowArpProtocolType); i { case 0: return &v.state case 1: @@ -155703,7 +156485,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[826].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpOperationMetricTag); i { + switch v := v.(*PatternFlowArpHardwareLengthCounter); i { case 0: return &v.state case 1: @@ -155715,7 +156497,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[827].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpOperation); i { + switch v := v.(*PatternFlowArpHardwareLengthMetricTag); i { case 0: return &v.state case 1: @@ -155727,7 +156509,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[828].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpSenderHardwareAddrCounter); i { + switch v := v.(*PatternFlowArpHardwareLength); i { case 0: return &v.state case 1: @@ -155739,7 +156521,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[829].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpSenderHardwareAddrMetricTag); i { + switch v := v.(*PatternFlowArpProtocolLengthCounter); i { case 0: return &v.state case 1: @@ -155751,7 +156533,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[830].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpSenderHardwareAddr); i { + switch v := v.(*PatternFlowArpProtocolLengthMetricTag); i { case 0: return &v.state case 1: @@ -155763,7 +156545,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[831].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpSenderProtocolAddrCounter); i { + switch v := v.(*PatternFlowArpProtocolLength); i { case 0: return &v.state case 1: @@ -155775,7 +156557,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[832].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpSenderProtocolAddrMetricTag); i { + switch v := v.(*PatternFlowArpOperationCounter); i { case 0: return &v.state case 1: @@ -155787,7 +156569,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[833].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpSenderProtocolAddr); i { + switch v := v.(*PatternFlowArpOperationMetricTag); i { case 0: return &v.state case 1: @@ -155799,7 +156581,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[834].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpTargetHardwareAddrCounter); i { + switch v := v.(*PatternFlowArpOperation); i { case 0: return &v.state case 1: @@ -155811,7 +156593,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[835].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpTargetHardwareAddrMetricTag); i { + switch v := v.(*PatternFlowArpSenderHardwareAddrCounter); i { case 0: return &v.state case 1: @@ -155823,7 +156605,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[836].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpTargetHardwareAddr); i { + switch v := v.(*PatternFlowArpSenderHardwareAddrMetricTag); i { case 0: return &v.state case 1: @@ -155835,7 +156617,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[837].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpTargetProtocolAddrCounter); i { + switch v := v.(*PatternFlowArpSenderHardwareAddr); i { case 0: return &v.state case 1: @@ -155847,7 +156629,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[838].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpTargetProtocolAddrMetricTag); i { + switch v := v.(*PatternFlowArpSenderProtocolAddrCounter); i { case 0: return &v.state case 1: @@ -155859,7 +156641,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[839].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowArpTargetProtocolAddr); i { + switch v := v.(*PatternFlowArpSenderProtocolAddrMetricTag); i { case 0: return &v.state case 1: @@ -155871,7 +156653,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[840].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpEchoTypeCounter); i { + switch v := v.(*PatternFlowArpSenderProtocolAddr); i { case 0: return &v.state case 1: @@ -155883,7 +156665,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[841].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpEchoTypeMetricTag); i { + switch v := v.(*PatternFlowArpTargetHardwareAddrCounter); i { case 0: return &v.state case 1: @@ -155895,7 +156677,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[842].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpEchoType); i { + switch v := v.(*PatternFlowArpTargetHardwareAddrMetricTag); i { case 0: return &v.state case 1: @@ -155907,7 +156689,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[843].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpEchoCodeCounter); i { + switch v := v.(*PatternFlowArpTargetHardwareAddr); i { case 0: return &v.state case 1: @@ -155919,7 +156701,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[844].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpEchoCodeMetricTag); i { + switch v := v.(*PatternFlowArpTargetProtocolAddrCounter); i { case 0: return &v.state case 1: @@ -155931,7 +156713,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[845].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpEchoCode); i { + switch v := v.(*PatternFlowArpTargetProtocolAddrMetricTag); i { case 0: return &v.state case 1: @@ -155943,7 +156725,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[846].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpEchoChecksum); i { + switch v := v.(*PatternFlowArpTargetProtocolAddr); i { case 0: return &v.state case 1: @@ -155955,7 +156737,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[847].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpEchoIdentifierCounter); i { + switch v := v.(*PatternFlowIcmpEchoTypeCounter); i { case 0: return &v.state case 1: @@ -155967,7 +156749,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[848].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpEchoIdentifierMetricTag); i { + switch v := v.(*PatternFlowIcmpEchoTypeMetricTag); i { case 0: return &v.state case 1: @@ -155979,7 +156761,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[849].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpEchoIdentifier); i { + switch v := v.(*PatternFlowIcmpEchoType); i { case 0: return &v.state case 1: @@ -155991,7 +156773,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[850].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpEchoSequenceNumberCounter); i { + switch v := v.(*PatternFlowIcmpEchoCodeCounter); i { case 0: return &v.state case 1: @@ -156003,7 +156785,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[851].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpEchoSequenceNumberMetricTag); i { + switch v := v.(*PatternFlowIcmpEchoCodeMetricTag); i { case 0: return &v.state case 1: @@ -156015,7 +156797,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[852].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpEchoSequenceNumber); i { + switch v := v.(*PatternFlowIcmpEchoCode); i { case 0: return &v.state case 1: @@ -156027,7 +156809,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[853].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpCommonChecksum); i { + switch v := v.(*PatternFlowIcmpEchoChecksum); i { case 0: return &v.state case 1: @@ -156039,7 +156821,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[854].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpNextFieldsIdentifierCounter); i { + switch v := v.(*PatternFlowIcmpEchoIdentifierCounter); i { case 0: return &v.state case 1: @@ -156051,7 +156833,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[855].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpNextFieldsIdentifierMetricTag); i { + switch v := v.(*PatternFlowIcmpEchoIdentifierMetricTag); i { case 0: return &v.state case 1: @@ -156063,7 +156845,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[856].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpNextFieldsIdentifier); i { + switch v := v.(*PatternFlowIcmpEchoIdentifier); i { case 0: return &v.state case 1: @@ -156075,7 +156857,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[857].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpNextFieldsSequenceNumberCounter); i { + switch v := v.(*PatternFlowIcmpEchoSequenceNumberCounter); i { case 0: return &v.state case 1: @@ -156087,7 +156869,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[858].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpNextFieldsSequenceNumberMetricTag); i { + switch v := v.(*PatternFlowIcmpEchoSequenceNumberMetricTag); i { case 0: return &v.state case 1: @@ -156099,7 +156881,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[859].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpNextFieldsSequenceNumber); i { + switch v := v.(*PatternFlowIcmpEchoSequenceNumber); i { case 0: return &v.state case 1: @@ -156111,7 +156893,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[860].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpv6EchoTypeCounter); i { + switch v := v.(*PatternFlowIcmpCommonChecksum); i { case 0: return &v.state case 1: @@ -156123,7 +156905,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[861].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpv6EchoTypeMetricTag); i { + switch v := v.(*PatternFlowIcmpNextFieldsIdentifierCounter); i { case 0: return &v.state case 1: @@ -156135,7 +156917,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[862].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpv6EchoType); i { + switch v := v.(*PatternFlowIcmpNextFieldsIdentifierMetricTag); i { case 0: return &v.state case 1: @@ -156147,7 +156929,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[863].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpv6EchoCodeCounter); i { + switch v := v.(*PatternFlowIcmpNextFieldsIdentifier); i { case 0: return &v.state case 1: @@ -156159,7 +156941,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[864].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpv6EchoCodeMetricTag); i { + switch v := v.(*PatternFlowIcmpNextFieldsSequenceNumberCounter); i { case 0: return &v.state case 1: @@ -156171,7 +156953,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[865].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpv6EchoCode); i { + switch v := v.(*PatternFlowIcmpNextFieldsSequenceNumberMetricTag); i { case 0: return &v.state case 1: @@ -156183,7 +156965,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[866].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpv6EchoIdentifierCounter); i { + switch v := v.(*PatternFlowIcmpNextFieldsSequenceNumber); i { case 0: return &v.state case 1: @@ -156195,7 +156977,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[867].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpv6EchoIdentifierMetricTag); i { + switch v := v.(*PatternFlowIcmpv6EchoTypeCounter); i { case 0: return &v.state case 1: @@ -156207,7 +156989,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[868].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpv6EchoIdentifier); i { + switch v := v.(*PatternFlowIcmpv6EchoTypeMetricTag); i { case 0: return &v.state case 1: @@ -156219,7 +157001,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[869].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpv6EchoSequenceNumberCounter); i { + switch v := v.(*PatternFlowIcmpv6EchoType); i { case 0: return &v.state case 1: @@ -156231,7 +157013,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[870].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpv6EchoSequenceNumberMetricTag); i { + switch v := v.(*PatternFlowIcmpv6EchoCodeCounter); i { case 0: return &v.state case 1: @@ -156243,7 +157025,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[871].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpv6EchoSequenceNumber); i { + switch v := v.(*PatternFlowIcmpv6EchoCodeMetricTag); i { case 0: return &v.state case 1: @@ -156255,7 +157037,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[872].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpv6EchoChecksum); i { + switch v := v.(*PatternFlowIcmpv6EchoCode); i { case 0: return &v.state case 1: @@ -156267,7 +157049,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[873].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIcmpv6CommonChecksum); i { + switch v := v.(*PatternFlowIcmpv6EchoIdentifierCounter); i { case 0: return &v.state case 1: @@ -156279,7 +157061,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[874].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPppAddressCounter); i { + switch v := v.(*PatternFlowIcmpv6EchoIdentifierMetricTag); i { case 0: return &v.state case 1: @@ -156291,7 +157073,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[875].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPppAddressMetricTag); i { + switch v := v.(*PatternFlowIcmpv6EchoIdentifier); i { case 0: return &v.state case 1: @@ -156303,7 +157085,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[876].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPppAddress); i { + switch v := v.(*PatternFlowIcmpv6EchoSequenceNumberCounter); i { case 0: return &v.state case 1: @@ -156315,7 +157097,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[877].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPppControlCounter); i { + switch v := v.(*PatternFlowIcmpv6EchoSequenceNumberMetricTag); i { case 0: return &v.state case 1: @@ -156327,7 +157109,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[878].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPppControlMetricTag); i { + switch v := v.(*PatternFlowIcmpv6EchoSequenceNumber); i { case 0: return &v.state case 1: @@ -156339,7 +157121,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[879].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPppControl); i { + switch v := v.(*PatternFlowIcmpv6EchoChecksum); i { case 0: return &v.state case 1: @@ -156351,7 +157133,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[880].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPppProtocolTypeCounter); i { + switch v := v.(*PatternFlowIcmpv6CommonChecksum); i { case 0: return &v.state case 1: @@ -156363,7 +157145,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[881].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPppProtocolTypeMetricTag); i { + switch v := v.(*PatternFlowPppAddressCounter); i { case 0: return &v.state case 1: @@ -156375,7 +157157,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[882].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowPppProtocolType); i { + switch v := v.(*PatternFlowPppAddressMetricTag); i { case 0: return &v.state case 1: @@ -156387,7 +157169,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[883].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIgmpv1VersionCounter); i { + switch v := v.(*PatternFlowPppAddress); i { case 0: return &v.state case 1: @@ -156399,7 +157181,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[884].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIgmpv1VersionMetricTag); i { + switch v := v.(*PatternFlowPppControlCounter); i { case 0: return &v.state case 1: @@ -156411,7 +157193,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[885].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIgmpv1Version); i { + switch v := v.(*PatternFlowPppControlMetricTag); i { case 0: return &v.state case 1: @@ -156423,7 +157205,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[886].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIgmpv1TypeCounter); i { + switch v := v.(*PatternFlowPppControl); i { case 0: return &v.state case 1: @@ -156435,7 +157217,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[887].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIgmpv1TypeMetricTag); i { + switch v := v.(*PatternFlowPppProtocolTypeCounter); i { case 0: return &v.state case 1: @@ -156447,7 +157229,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[888].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIgmpv1Type); i { + switch v := v.(*PatternFlowPppProtocolTypeMetricTag); i { case 0: return &v.state case 1: @@ -156459,7 +157241,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[889].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIgmpv1UnusedCounter); i { + switch v := v.(*PatternFlowPppProtocolType); i { case 0: return &v.state case 1: @@ -156471,7 +157253,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[890].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIgmpv1UnusedMetricTag); i { + switch v := v.(*PatternFlowIgmpv1VersionCounter); i { case 0: return &v.state case 1: @@ -156483,7 +157265,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[891].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIgmpv1Unused); i { + switch v := v.(*PatternFlowIgmpv1VersionMetricTag); i { case 0: return &v.state case 1: @@ -156495,7 +157277,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[892].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIgmpv1Checksum); i { + switch v := v.(*PatternFlowIgmpv1Version); i { case 0: return &v.state case 1: @@ -156507,7 +157289,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[893].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIgmpv1GroupAddressCounter); i { + switch v := v.(*PatternFlowIgmpv1TypeCounter); i { case 0: return &v.state case 1: @@ -156519,7 +157301,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[894].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIgmpv1GroupAddressMetricTag); i { + switch v := v.(*PatternFlowIgmpv1TypeMetricTag); i { case 0: return &v.state case 1: @@ -156531,7 +157313,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[895].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowIgmpv1GroupAddress); i { + switch v := v.(*PatternFlowIgmpv1Type); i { case 0: return &v.state case 1: @@ -156543,7 +157325,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[896].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowMplsLabelCounter); i { + switch v := v.(*PatternFlowIgmpv1UnusedCounter); i { case 0: return &v.state case 1: @@ -156555,7 +157337,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[897].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowMplsLabelMetricTag); i { + switch v := v.(*PatternFlowIgmpv1UnusedMetricTag); i { case 0: return &v.state case 1: @@ -156567,7 +157349,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[898].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowMplsLabel); i { + switch v := v.(*PatternFlowIgmpv1Unused); i { case 0: return &v.state case 1: @@ -156579,7 +157361,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[899].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowMplsTrafficClassCounter); i { + switch v := v.(*PatternFlowIgmpv1Checksum); i { case 0: return &v.state case 1: @@ -156591,7 +157373,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[900].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowMplsTrafficClassMetricTag); i { + switch v := v.(*PatternFlowIgmpv1GroupAddressCounter); i { case 0: return &v.state case 1: @@ -156603,7 +157385,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[901].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowMplsTrafficClass); i { + switch v := v.(*PatternFlowIgmpv1GroupAddressMetricTag); i { case 0: return &v.state case 1: @@ -156615,7 +157397,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[902].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowMplsBottomOfStackCounter); i { + switch v := v.(*PatternFlowIgmpv1GroupAddress); i { case 0: return &v.state case 1: @@ -156627,7 +157409,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[903].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowMplsBottomOfStackMetricTag); i { + switch v := v.(*PatternFlowMplsLabelCounter); i { case 0: return &v.state case 1: @@ -156639,7 +157421,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[904].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowMplsBottomOfStack); i { + switch v := v.(*PatternFlowMplsLabelMetricTag); i { case 0: return &v.state case 1: @@ -156651,7 +157433,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[905].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowMplsTimeToLiveCounter); i { + switch v := v.(*PatternFlowMplsLabel); i { case 0: return &v.state case 1: @@ -156663,7 +157445,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[906].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowMplsTimeToLiveMetricTag); i { + switch v := v.(*PatternFlowMplsTrafficClassCounter); i { case 0: return &v.state case 1: @@ -156675,7 +157457,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[907].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowMplsTimeToLive); i { + switch v := v.(*PatternFlowMplsTrafficClassMetricTag); i { case 0: return &v.state case 1: @@ -156687,7 +157469,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[908].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CVersionCounter); i { + switch v := v.(*PatternFlowMplsTrafficClass); i { case 0: return &v.state case 1: @@ -156699,7 +157481,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[909].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CVersion); i { + switch v := v.(*PatternFlowMplsBottomOfStackCounter); i { case 0: return &v.state case 1: @@ -156711,7 +157493,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[910].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CPDURequestIdCounter); i { + switch v := v.(*PatternFlowMplsBottomOfStackMetricTag); i { case 0: return &v.state case 1: @@ -156723,7 +157505,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[911].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CPDURequestId); i { + switch v := v.(*PatternFlowMplsBottomOfStack); i { case 0: return &v.state case 1: @@ -156735,7 +157517,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[912].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CPDUErrorIndexCounter); i { + switch v := v.(*PatternFlowMplsTimeToLiveCounter); i { case 0: return &v.state case 1: @@ -156747,7 +157529,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[913].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CPDUErrorIndex); i { + switch v := v.(*PatternFlowMplsTimeToLiveMetricTag); i { case 0: return &v.state case 1: @@ -156759,7 +157541,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[914].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CBulkPDURequestIdCounter); i { + switch v := v.(*PatternFlowMplsTimeToLive); i { case 0: return &v.state case 1: @@ -156771,7 +157553,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[915].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CBulkPDURequestId); i { + switch v := v.(*PatternFlowSnmpv2CVersionCounter); i { case 0: return &v.state case 1: @@ -156783,7 +157565,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[916].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CBulkPDUNonRepeaters); i { + switch v := v.(*PatternFlowSnmpv2CVersion); i { case 0: return &v.state case 1: @@ -156795,7 +157577,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[917].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter); i { + switch v := v.(*PatternFlowSnmpv2CPDURequestIdCounter); i { case 0: return &v.state case 1: @@ -156807,7 +157589,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[918].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CBulkPDUMaxRepetitions); i { + switch v := v.(*PatternFlowSnmpv2CPDURequestId); i { case 0: return &v.state case 1: @@ -156819,7 +157601,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[919].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter); i { + switch v := v.(*PatternFlowSnmpv2CPDUErrorIndexCounter); i { case 0: return &v.state case 1: @@ -156831,7 +157613,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[920].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CVariableBindingValueIntegerValue); i { + switch v := v.(*PatternFlowSnmpv2CPDUErrorIndex); i { case 0: return &v.state case 1: @@ -156843,7 +157625,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[921].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter); i { + switch v := v.(*PatternFlowSnmpv2CBulkPDURequestIdCounter); i { case 0: return &v.state case 1: @@ -156855,7 +157637,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[922].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CVariableBindingValueIpAddressValue); i { + switch v := v.(*PatternFlowSnmpv2CBulkPDURequestId); i { case 0: return &v.state case 1: @@ -156867,7 +157649,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[923].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CVariableBindingValueCounterValueCounter); i { + switch v := v.(*PatternFlowSnmpv2CBulkPDUNonRepeaters); i { case 0: return &v.state case 1: @@ -156879,7 +157661,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[924].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CVariableBindingValueCounterValue); i { + switch v := v.(*PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter); i { case 0: return &v.state case 1: @@ -156891,7 +157673,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[925].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter); i { + switch v := v.(*PatternFlowSnmpv2CBulkPDUMaxRepetitions); i { case 0: return &v.state case 1: @@ -156903,7 +157685,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[926].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CVariableBindingValueTimeticksValue); i { + switch v := v.(*PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter); i { case 0: return &v.state case 1: @@ -156915,7 +157697,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[927].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter); i { + switch v := v.(*PatternFlowSnmpv2CVariableBindingValueIntegerValue); i { case 0: return &v.state case 1: @@ -156927,7 +157709,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[928].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CVariableBindingValueBigCounterValue); i { + switch v := v.(*PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter); i { case 0: return &v.state case 1: @@ -156939,7 +157721,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[929].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter); i { + switch v := v.(*PatternFlowSnmpv2CVariableBindingValueIpAddressValue); i { case 0: return &v.state case 1: @@ -156951,7 +157733,7 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[930].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue); i { + switch v := v.(*PatternFlowSnmpv2CVariableBindingValueCounterValueCounter); i { case 0: return &v.state case 1: @@ -156963,6 +157745,90 @@ func file_otg_proto_init() { } } file_otg_proto_msgTypes[931].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PatternFlowSnmpv2CVariableBindingValueCounterValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_otg_proto_msgTypes[932].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_otg_proto_msgTypes[933].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PatternFlowSnmpv2CVariableBindingValueTimeticksValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_otg_proto_msgTypes[934].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_otg_proto_msgTypes[935].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PatternFlowSnmpv2CVariableBindingValueBigCounterValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_otg_proto_msgTypes[936].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_otg_proto_msgTypes[937].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_otg_proto_msgTypes[938].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CCommonRequestIdCounter); i { case 0: return &v.state @@ -156974,7 +157840,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[932].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[939].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CCommonRequestId); i { case 0: return &v.state @@ -156986,7 +157852,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[933].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[940].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRsvpRsvpChecksum); i { case 0: return &v.state @@ -156998,7 +157864,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[934].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[941].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRsvpTimeToLiveCounter); i { case 0: return &v.state @@ -157010,7 +157876,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[935].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[942].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRsvpTimeToLive); i { case 0: return &v.state @@ -157022,7 +157888,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[936].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[943].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRsvpReservedCounter); i { case 0: return &v.state @@ -157034,7 +157900,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[937].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[944].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRsvpReserved); i { case 0: return &v.state @@ -157046,7 +157912,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[938].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[945].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter); i { case 0: return &v.state @@ -157058,7 +157924,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[939].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[946].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress); i { case 0: return &v.state @@ -157070,7 +157936,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[940].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[947].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter); i { case 0: return &v.state @@ -157082,7 +157948,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[941].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[948].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionLspTunnelIpv4Reserved); i { case 0: return &v.state @@ -157094,7 +157960,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[942].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[949].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter); i { case 0: return &v.state @@ -157106,7 +157972,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[943].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[950].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId); i { case 0: return &v.state @@ -157118,7 +157984,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[944].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[951].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter); i { case 0: return &v.state @@ -157130,7 +157996,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[945].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[952].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionExtTunnelIdAsInteger); i { case 0: return &v.state @@ -157142,7 +158008,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[946].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[953].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter); i { case 0: return &v.state @@ -157154,7 +158020,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[947].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[954].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4); i { case 0: return &v.state @@ -157166,7 +158032,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[948].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[955].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter); i { case 0: return &v.state @@ -157178,7 +158044,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[949].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[956].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRsvpHopIpv4Ipv4Address); i { case 0: return &v.state @@ -157190,7 +158056,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[950].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[957].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter); i { case 0: return &v.state @@ -157202,7 +158068,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[951].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[958].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle); i { case 0: return &v.state @@ -157214,7 +158080,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[952].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[959].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter); i { case 0: return &v.state @@ -157226,7 +158092,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[953].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[960].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathTimeValuesType1RefreshPeriodR); i { case 0: return &v.state @@ -157238,7 +158104,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[954].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[961].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter); i { case 0: return &v.state @@ -157250,7 +158116,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[955].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[962].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit); i { case 0: return &v.state @@ -157262,7 +158128,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[956].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[963].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter); i { case 0: return &v.state @@ -157274,7 +158140,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[957].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[964].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address); i { case 0: return &v.state @@ -157286,7 +158152,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[958].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[965].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter); i { case 0: return &v.state @@ -157298,7 +158164,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[959].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[966].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathExplicitRouteType1ASNumberLBit); i { case 0: return &v.state @@ -157310,7 +158176,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[960].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[967].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter); i { case 0: return &v.state @@ -157322,7 +158188,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[961].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[968].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved); i { case 0: return &v.state @@ -157334,7 +158200,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[962].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[969].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter); i { case 0: return &v.state @@ -157346,7 +158212,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[963].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[970].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid); i { case 0: return &v.state @@ -157358,7 +158224,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[964].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[971].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter); i { case 0: return &v.state @@ -157370,7 +158236,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[965].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[972].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress); i { case 0: return &v.state @@ -157382,7 +158248,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[966].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[973].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter); i { case 0: return &v.state @@ -157394,7 +158260,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[967].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[974].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved); i { case 0: return &v.state @@ -157406,7 +158272,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[968].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[975].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter); i { case 0: return &v.state @@ -157418,7 +158284,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[969].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[976].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId); i { case 0: return &v.state @@ -157430,7 +158296,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[970].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[977].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServVersionCounter); i { case 0: return &v.state @@ -157442,7 +158308,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[971].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[978].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServVersion); i { case 0: return &v.state @@ -157454,7 +158320,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[972].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[979].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServReserved1Counter); i { case 0: return &v.state @@ -157466,7 +158332,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[973].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[980].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServReserved1); i { case 0: return &v.state @@ -157478,7 +158344,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[974].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[981].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter); i { case 0: return &v.state @@ -157490,7 +158356,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[975].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[982].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServOverallLength); i { case 0: return &v.state @@ -157502,7 +158368,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[976].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[983].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter); i { case 0: return &v.state @@ -157514,7 +158380,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[977].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[984].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServServiceHeader); i { case 0: return &v.state @@ -157526,7 +158392,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[978].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[985].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServZeroBitCounter); i { case 0: return &v.state @@ -157538,7 +158404,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[979].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[986].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServZeroBit); i { case 0: return &v.state @@ -157550,7 +158416,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[980].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[987].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServReserved2Counter); i { case 0: return &v.state @@ -157562,7 +158428,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[981].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[988].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServReserved2); i { case 0: return &v.state @@ -157574,7 +158440,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[982].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[989].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter); i { case 0: return &v.state @@ -157586,7 +158452,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[983].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[990].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData); i { case 0: return &v.state @@ -157598,7 +158464,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[984].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[991].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter); i { case 0: return &v.state @@ -157610,7 +158476,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[985].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[992].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec); i { case 0: return &v.state @@ -157622,7 +158488,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[986].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[993].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter); i { case 0: return &v.state @@ -157634,7 +158500,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[987].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[994].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServParameter127Flag); i { case 0: return &v.state @@ -157646,7 +158512,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[988].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[995].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter); i { case 0: return &v.state @@ -157658,7 +158524,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[989].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[996].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServParameter127Length); i { case 0: return &v.state @@ -157670,7 +158536,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[990].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[997].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter); i { case 0: return &v.state @@ -157682,7 +158548,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[991].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[998].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit); i { case 0: return &v.state @@ -157694,7 +158560,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[992].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[999].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter); i { case 0: return &v.state @@ -157706,7 +158572,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[993].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1000].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize); i { case 0: return &v.state @@ -157718,7 +158584,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[994].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1001].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter); i { case 0: return &v.state @@ -157730,7 +158596,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[995].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1002].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address); i { case 0: return &v.state @@ -157742,7 +158608,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[996].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1003].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter); i { case 0: return &v.state @@ -157754,7 +158620,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[997].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1004].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength); i { case 0: return &v.state @@ -157766,7 +158632,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[998].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1005].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRecordRouteType1LabelFlags); i { case 0: return &v.state @@ -157778,7 +158644,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[999].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1006].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRecordRouteType1LabelCType); i { case 0: return &v.state @@ -157790,7 +158656,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1000].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1007].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathObjectsCustomTypeCounter); i { case 0: return &v.state @@ -157802,7 +158668,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1001].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1008].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathObjectsCustomType); i { case 0: return &v.state @@ -157814,7 +158680,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1002].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1009].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Version); i { case 0: return &v.state @@ -157826,7 +158692,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1003].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1010].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Success); i { case 0: return &v.state @@ -157838,7 +158704,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1004].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1011].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Failure); i { case 0: return &v.state @@ -157850,7 +158716,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1005].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1012].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SetConfigRequest); i { case 0: return &v.state @@ -157862,7 +158728,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1006].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1013].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateConfigRequest); i { case 0: return &v.state @@ -157874,7 +158740,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1007].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1014].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SetConfigResponse); i { case 0: return &v.state @@ -157886,7 +158752,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1008].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1015].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetConfigResponse); i { case 0: return &v.state @@ -157898,7 +158764,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1009].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1016].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UpdateConfigResponse); i { case 0: return &v.state @@ -157910,7 +158776,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1010].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1017].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SetControlStateRequest); i { case 0: return &v.state @@ -157922,7 +158788,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1011].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1018].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SetControlStateResponse); i { case 0: return &v.state @@ -157934,7 +158800,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1012].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1019].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SetControlActionRequest); i { case 0: return &v.state @@ -157946,7 +158812,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1013].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1020].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SetControlActionResponse); i { case 0: return &v.state @@ -157958,7 +158824,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1014].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1021].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetMetricsRequest); i { case 0: return &v.state @@ -157970,7 +158836,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1015].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1022].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetMetricsResponse); i { case 0: return &v.state @@ -157982,7 +158848,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1016].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1023].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetStatesRequest); i { case 0: return &v.state @@ -157994,7 +158860,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1017].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1024].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetStatesResponse); i { case 0: return &v.state @@ -158006,7 +158872,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1018].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1025].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetCaptureRequest); i { case 0: return &v.state @@ -158018,7 +158884,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1019].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1026].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetCaptureResponse); i { case 0: return &v.state @@ -158030,7 +158896,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1020].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1027].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GetVersionResponse); i { case 0: return &v.state @@ -158042,7 +158908,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1021].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1028].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LagProtocol_Choice); i { case 0: return &v.state @@ -158054,7 +158920,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1022].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1029].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LagPortLacp_ActorActivity); i { case 0: return &v.state @@ -158066,7 +158932,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1023].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1030].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EthernetConnection_Choice); i { case 0: return &v.state @@ -158078,7 +158944,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1024].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1031].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeviceVlan_Tpid); i { case 0: return &v.state @@ -158090,7 +158956,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1025].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1032].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeviceIpv4GatewayMAC_Choice); i { case 0: return &v.state @@ -158102,7 +158968,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1026].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1033].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeviceIpv6GatewayMAC_Choice); i { case 0: return &v.state @@ -158114,7 +158980,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1027].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1034].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeviceDhcpv4Client_Choice); i { case 0: return &v.state @@ -158126,7 +158992,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1028].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1035].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Layer1_Speed); i { case 0: return &v.state @@ -158138,7 +159004,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1029].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1036].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Layer1_Media); i { case 0: return &v.state @@ -158150,7 +159016,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1030].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1037].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Layer1FlowControl_Choice); i { case 0: return &v.state @@ -158162,7 +159028,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1031].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1038].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Capture_Format); i { case 0: return &v.state @@ -158174,7 +159040,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1032].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1039].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CaptureFilter_Choice); i { case 0: return &v.state @@ -158186,7 +159052,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1033].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1040].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisInterface_NetworkType); i { case 0: return &v.state @@ -158198,7 +159064,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1034].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1041].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisInterface_LevelType); i { case 0: return &v.state @@ -158210,7 +159076,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1035].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1042].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisInterfaceAuthentication_AuthType); i { case 0: return &v.state @@ -158222,7 +159088,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1036].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1043].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisAuthenticationBase_AuthType); i { case 0: return &v.state @@ -158234,7 +159100,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1037].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1044].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisV4RouteRange_OriginType); i { case 0: return &v.state @@ -158246,7 +159112,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1038].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1045].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisV4RouteRange_RedistributionType); i { case 0: return &v.state @@ -158258,7 +159124,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1039].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1046].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisV6RouteRange_OriginType); i { case 0: return &v.state @@ -158270,7 +159136,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1040].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1047].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisV6RouteRange_RedistributionType); i { case 0: return &v.state @@ -158282,7 +159148,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1041].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1048].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeviceBgpMessageHeaderError_Subcode); i { case 0: return &v.state @@ -158294,7 +159160,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1042].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1049].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeviceBgpOpenMessageError_Subcode); i { case 0: return &v.state @@ -158306,7 +159172,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1043].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1050].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeviceBgpUpdateMessageError_Subcode); i { case 0: return &v.state @@ -158318,7 +159184,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1044].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1051].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeviceBgpCeaseError_Subcode); i { case 0: return &v.state @@ -158330,7 +159196,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1045].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1052].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpV4Peer_AsType); i { case 0: return &v.state @@ -158342,7 +159208,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1046].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1053].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpV4Peer_AsNumberWidth); i { case 0: return &v.state @@ -158354,7 +159220,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1047].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1054].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpV4EthernetSegment_ActiveMode); i { case 0: return &v.state @@ -158366,7 +159232,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1048].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1055].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpRouteAdvanced_Origin); i { case 0: return &v.state @@ -158378,7 +159244,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1049].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1056].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpCommunity_Type); i { case 0: return &v.state @@ -158390,7 +159256,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1050].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1057].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpExtCommunity_Type); i { case 0: return &v.state @@ -158402,7 +159268,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1051].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1058].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpExtCommunity_Subtype); i { case 0: return &v.state @@ -158414,7 +159280,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1052].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1059].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAsPath_AsSetMode); i { case 0: return &v.state @@ -158426,7 +159292,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1053].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1060].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAsPathSegment_Type); i { case 0: return &v.state @@ -158438,7 +159304,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1054].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1061].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpV4EvpnEvis_Choice); i { case 0: return &v.state @@ -158450,7 +159316,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1055].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1062].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpV4EviVxlan_ReplicationType); i { case 0: return &v.state @@ -158462,7 +159328,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1056].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1063].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpRouteDistinguisher_RdType); i { case 0: return &v.state @@ -158474,7 +159340,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1057].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1064].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpRouteTarget_RtType); i { case 0: return &v.state @@ -158486,7 +159352,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1058].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1065].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpV4RouteRange_NextHopMode); i { case 0: return &v.state @@ -158498,7 +159364,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1059].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1066].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpV4RouteRange_NextHopAddressType); i { case 0: return &v.state @@ -158510,7 +159376,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1060].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1067].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpExtendedCommunity_Choice); i { case 0: return &v.state @@ -158522,7 +159388,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1061].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1068].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpExtendedCommunityTransitive2OctetAsType_Choice); i { case 0: return &v.state @@ -158534,7 +159400,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1062].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1069].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpExtendedCommunityTransitiveIpv4AddressType_Choice); i { case 0: return &v.state @@ -158546,7 +159412,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1063].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1070].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpExtendedCommunityTransitive4OctetAsType_Choice); i { case 0: return &v.state @@ -158558,7 +159424,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1064].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1071].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpExtendedCommunityTransitiveOpaqueType_Choice); i { case 0: return &v.state @@ -158570,7 +159436,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1065].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1072].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpExtendedCommunityTransitiveEvpnType_Choice); i { case 0: return &v.state @@ -158582,7 +159448,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1066].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1073].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpExtendedCommunityNonTransitive2OctetAsType_Choice); i { case 0: return &v.state @@ -158594,7 +159460,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1067].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1074].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpV6RouteRange_NextHopMode); i { case 0: return &v.state @@ -158606,7 +159472,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1068].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1075].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpV6RouteRange_NextHopAddressType); i { case 0: return &v.state @@ -158618,7 +159484,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1069].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1076].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpSrteV4Policy_NextHopMode); i { case 0: return &v.state @@ -158630,7 +159496,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1070].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1077].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpSrteV4Policy_NextHopAddressType); i { case 0: return &v.state @@ -158642,7 +159508,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1071].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1078].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpSrteRemoteEndpointSubTlv_AddressFamily); i { case 0: return &v.state @@ -158654,7 +159520,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1072].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1079].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpSrteBindingSubTlv_BindingSidType); i { case 0: return &v.state @@ -158666,7 +159532,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1073].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1080].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpSrteExplicitNullLabelPolicySubTlv_ExplicitNullLabelPolicy); i { case 0: return &v.state @@ -158678,7 +159544,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1074].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1081].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpSrteSegment_SegmentType); i { case 0: return &v.state @@ -158690,7 +159556,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1075].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1082].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpSrteV6Policy_NextHopMode); i { case 0: return &v.state @@ -158702,7 +159568,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1076].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1083].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpSrteV6Policy_NextHopAddressType); i { case 0: return &v.state @@ -158714,7 +159580,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1077].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1084].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpUpdateReplay_Choice); i { case 0: return &v.state @@ -158726,7 +159592,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1078].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1085].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAttributes_Origin); i { case 0: return &v.state @@ -158738,7 +159604,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1079].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1086].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAttributesAsPath_Choice); i { case 0: return &v.state @@ -158750,7 +159616,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1080].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1087].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAttributesFourByteAsPathSegment_Type); i { case 0: return &v.state @@ -158762,7 +159628,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1081].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1088].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAttributesTwoByteAsPathSegment_Type); i { case 0: return &v.state @@ -158774,7 +159640,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1082].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1089].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAttributesAggregator_Choice); i { case 0: return &v.state @@ -158786,7 +159652,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1083].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1090].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAttributesCommunity_Choice); i { case 0: return &v.state @@ -158798,7 +159664,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1084].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1091].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAttributesNextHop_Choice); i { case 0: return &v.state @@ -158810,7 +159676,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1085].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1092].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAttributesMpReachNlri_Choice); i { case 0: return &v.state @@ -158822,7 +159688,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1086].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1093].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAttributesMpUnreachNlri_Choice); i { case 0: return &v.state @@ -158834,7 +159700,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1087].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1094].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAttributesTunnelEncapsulation_Choice); i { case 0: return &v.state @@ -158846,7 +159712,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1088].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1095].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAttributesBsid_Choice); i { case 0: return &v.state @@ -158858,7 +159724,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1089].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1096].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAttributesSrPolicyExplicitNullPolicy_Choice); i { case 0: return &v.state @@ -158870,7 +159736,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1090].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1097].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice); i { case 0: return &v.state @@ -158882,7 +159748,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1091].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1098].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpV6Peer_AsType); i { case 0: return &v.state @@ -158894,7 +159760,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1092].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1099].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpV6Peer_AsNumberWidth); i { case 0: return &v.state @@ -158906,7 +159772,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1093].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1100].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpV6EthernetSegment_ActiveMode); i { case 0: return &v.state @@ -158918,7 +159784,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1094].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1101].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpV6EvpnEvis_Choice); i { case 0: return &v.state @@ -158930,7 +159796,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1095].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1102].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpV6EviVxlan_ReplicationType); i { case 0: return &v.state @@ -158942,7 +159808,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1096].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1103].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*VxlanV4TunnelDestinationIPMode_Choice); i { case 0: return &v.state @@ -158954,7 +159820,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1097].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1104].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*VxlanV6TunnelDestinationIPMode_Choice); i { case 0: return &v.state @@ -158966,7 +159832,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1098].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1105].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RsvpLspIpv4InterfaceP2PEgressIpv4Lsp_ReservationStyle); i { case 0: return &v.state @@ -158978,7 +159844,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1099].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1106].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RsvpEro_PrependNeighborIp); i { case 0: return &v.state @@ -158990,7 +159856,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1100].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1107].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RsvpEroSubobject_Type); i { case 0: return &v.state @@ -159002,7 +159868,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1101].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1108].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RsvpEroSubobject_HopType); i { case 0: return &v.state @@ -159014,7 +159880,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1102].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1109].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowTxRx_Choice); i { case 0: return &v.state @@ -159026,7 +159892,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1103].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1110].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRouter_Mode); i { case 0: return &v.state @@ -159038,7 +159904,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1104].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1111].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowHeader_Choice); i { case 0: return &v.state @@ -159050,7 +159916,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1105].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1112].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowIpv4Options_Choice); i { case 0: return &v.state @@ -159062,7 +159928,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1106].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1113].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowIpv4OptionsCustomLength_Choice); i { case 0: return &v.state @@ -159074,7 +159940,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1107].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1114].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowIpv4Priority_Choice); i { case 0: return &v.state @@ -159086,7 +159952,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1108].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1115].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowIpv4Auto_Choice); i { case 0: return &v.state @@ -159098,7 +159964,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1109].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1116].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowIcmp_Choice); i { case 0: return &v.state @@ -159110,7 +159976,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1110].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1117].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowIcmpv6_Choice); i { case 0: return &v.state @@ -159122,7 +159988,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1111].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1118].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowSnmpv2CData_Choice); i { case 0: return &v.state @@ -159134,7 +160000,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1112].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1119].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowSnmpv2CPDU_ErrorStatus); i { case 0: return &v.state @@ -159146,7 +160012,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1113].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1120].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowSnmpv2CVariableBindingValue_Choice); i { case 0: return &v.state @@ -159158,7 +160024,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1114].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1121].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowSnmpv2CVariableBindingStringValue_Choice); i { case 0: return &v.state @@ -159170,7 +160036,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1115].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1122].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRsvp_Flag); i { case 0: return &v.state @@ -159182,7 +160048,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1116].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1123].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPLength_Choice); i { case 0: return &v.state @@ -159194,7 +160060,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1117].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1124].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPMessage_Choice); i { case 0: return &v.state @@ -159206,7 +160072,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1118].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1125].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPObjectLength_Choice); i { case 0: return &v.state @@ -159218,7 +160084,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1119].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1126].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPPathObjectsClass_Choice); i { case 0: return &v.state @@ -159230,7 +160096,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1120].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1127].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPPathObjectsSessionCType_Choice); i { case 0: return &v.state @@ -159242,7 +160108,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1121].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1128].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPPathSessionExtTunnelId_Choice); i { case 0: return &v.state @@ -159254,7 +160120,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1122].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1129].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPPathObjectsRsvpHopCType_Choice); i { case 0: return &v.state @@ -159266,7 +160132,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1123].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1130].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPPathObjectsTimeValuesCType_Choice); i { case 0: return &v.state @@ -159278,7 +160144,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1124].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1131].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPPathObjectsClassExplicitRouteCType_Choice); i { case 0: return &v.state @@ -159290,7 +160156,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1125].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1132].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPType1ExplicitRouteSubobjectsType_Choice); i { case 0: return &v.state @@ -159302,7 +160168,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1126].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1133].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPExplicitRouteLength_Choice); i { case 0: return &v.state @@ -159314,7 +160180,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1127].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1134].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPExplicitRouteASNumberLength_Choice); i { case 0: return &v.state @@ -159326,7 +160192,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1128].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1135].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPPathObjectsLabelRequestCType_Choice); i { case 0: return &v.state @@ -159338,7 +160204,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1129].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1136].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPPathObjectsSessionAttributeCType_Choice); i { case 0: return &v.state @@ -159350,7 +160216,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1130].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1137].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPLspTunnelFlag_Choice); i { case 0: return &v.state @@ -159362,7 +160228,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1131].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1138].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPSessionAttributeNameLength_Choice); i { case 0: return &v.state @@ -159374,7 +160240,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1132].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1139].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPPathObjectsSenderTemplateCType_Choice); i { case 0: return &v.state @@ -159386,7 +160252,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1133].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1140].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPPathObjectsSenderTspecCType_Choice); i { case 0: return &v.state @@ -159398,7 +160264,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1134].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1141].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPPathObjectsRecordRouteCType_Choice); i { case 0: return &v.state @@ -159410,7 +160276,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1135].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1142].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPPathObjectsRecordRouteSubObjectType_Choice); i { case 0: return &v.state @@ -159422,7 +160288,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1136].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1143].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPRecordRouteIPv4Flag_Choice); i { case 0: return &v.state @@ -159434,7 +160300,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1137].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1144].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPPathRecordRouteLabel_Choice); i { case 0: return &v.state @@ -159446,7 +160312,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1138].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1145].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRSVPRouteRecordLength_Choice); i { case 0: return &v.state @@ -159458,7 +160324,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1139].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1146].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowSize_Choice); i { case 0: return &v.state @@ -159470,7 +160336,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1140].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1147].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowSizeWeightPairs_Choice); i { case 0: return &v.state @@ -159482,7 +160348,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1141].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1148].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowSizeWeightPairs_Predefined); i { case 0: return &v.state @@ -159494,7 +160360,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1142].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1149].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRate_Choice); i { case 0: return &v.state @@ -159506,7 +160372,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1143].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1150].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowDuration_Choice); i { case 0: return &v.state @@ -159518,7 +160384,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1144].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1151].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowDelay_Choice); i { case 0: return &v.state @@ -159530,7 +160396,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1145].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1152].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowDurationInterBurstGap_Choice); i { case 0: return &v.state @@ -159542,7 +160408,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1146].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1153].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowLatencyMetrics_Mode); i { case 0: return &v.state @@ -159554,7 +160420,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1147].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1154].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowRxTxRatio_Choice); i { case 0: return &v.state @@ -159566,7 +160432,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1148].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1155].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EventRequest_Type); i { case 0: return &v.state @@ -159578,7 +160444,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1149].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1156].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LldpConnection_Choice); i { case 0: return &v.state @@ -159590,7 +160456,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1150].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1157].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LldpChassisId_Choice); i { case 0: return &v.state @@ -159602,7 +160468,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1151].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1158].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LldpPortId_Choice); i { case 0: return &v.state @@ -159614,7 +160480,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1152].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1159].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LldpChassisMacSubType_Choice); i { case 0: return &v.state @@ -159626,7 +160492,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1153].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1160].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LldpPortInterfaceNameSubType_Choice); i { case 0: return &v.state @@ -159638,7 +160504,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1154].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1161].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LldpSystemName_Choice); i { case 0: return &v.state @@ -159650,7 +160516,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1155].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1162].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Error_Kind); i { case 0: return &v.state @@ -159662,7 +160528,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1156].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1163].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ConfigUpdate_Choice); i { case 0: return &v.state @@ -159674,7 +160540,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1157].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1164].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowsUpdate_PropertyNames); i { case 0: return &v.state @@ -159686,7 +160552,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1158].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1165].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ControlState_Choice); i { case 0: return &v.state @@ -159698,7 +160564,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1159].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1166].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StatePort_Choice); i { case 0: return &v.state @@ -159710,7 +160576,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1160].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1167].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateTraffic_Choice); i { case 0: return &v.state @@ -159722,7 +160588,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1161].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1168].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateProtocol_Choice); i { case 0: return &v.state @@ -159734,7 +160600,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1162].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1169].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StatePortLink_State); i { case 0: return &v.state @@ -159746,7 +160612,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1163].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1170].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StatePortCapture_State); i { case 0: return &v.state @@ -159758,7 +160624,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1164].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1171].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateTrafficFlowTransmit_State); i { case 0: return &v.state @@ -159770,7 +160636,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1165].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1172].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateProtocolAll_State); i { case 0: return &v.state @@ -159782,7 +160648,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1166].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1173].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateProtocolRoute_State); i { case 0: return &v.state @@ -159794,7 +160660,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1167].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1174].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateProtocolLacp_Choice); i { case 0: return &v.state @@ -159806,7 +160672,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1168].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1175].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateProtocolLacpAdmin_State); i { case 0: return &v.state @@ -159818,7 +160684,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1169].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1176].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateProtocolLacpMemberPorts_State); i { case 0: return &v.state @@ -159830,7 +160696,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1170].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1177].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateProtocolBgp_Choice); i { case 0: return &v.state @@ -159842,7 +160708,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1171].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1178].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateProtocolBgpPeers_State); i { case 0: return &v.state @@ -159854,7 +160720,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1172].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1179].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateProtocolIsis_Choice); i { case 0: return &v.state @@ -159866,7 +160732,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1173].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1180].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StateProtocolIsisRouters_State); i { case 0: return &v.state @@ -159878,7 +160744,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1174].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1181].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ControlAction_Choice); i { case 0: return &v.state @@ -159890,7 +160756,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1175].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1182].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ActionResponse_Choice); i { case 0: return &v.state @@ -159902,7 +160768,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1176].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1183].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ActionProtocol_Choice); i { case 0: return &v.state @@ -159914,7 +160780,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1177].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1184].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ActionResponseProtocol_Choice); i { case 0: return &v.state @@ -159926,7 +160792,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1178].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1185].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ActionProtocolIpv4_Choice); i { case 0: return &v.state @@ -159938,7 +160804,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1179].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1186].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ActionResponseProtocolIpv4_Choice); i { case 0: return &v.state @@ -159950,7 +160816,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1180].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1187].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ActionResponseProtocolIpv4PingResponse_Result); i { case 0: return &v.state @@ -159962,7 +160828,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1181].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1188].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ActionProtocolIpv6_Choice); i { case 0: return &v.state @@ -159974,7 +160840,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1182].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1189].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ActionResponseProtocolIpv6_Choice); i { case 0: return &v.state @@ -159986,7 +160852,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1183].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1190].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ActionResponseProtocolIpv6PingResponse_Result); i { case 0: return &v.state @@ -159998,7 +160864,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1184].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1191].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ActionProtocolBgp_Choice); i { case 0: return &v.state @@ -160010,7 +160876,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1185].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1192].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ActionProtocolBgpNotification_Choice); i { case 0: return &v.state @@ -160022,7 +160888,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1186].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1193].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MetricsRequest_Choice); i { case 0: return &v.state @@ -160034,7 +160900,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1187].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1194].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MetricsResponse_Choice); i { case 0: return &v.state @@ -160046,7 +160912,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1188].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1195].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PortMetricsRequest_ColumnNames); i { case 0: return &v.state @@ -160058,7 +160924,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1189].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1196].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PortMetric_Link); i { case 0: return &v.state @@ -160070,7 +160936,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1190].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1197].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PortMetric_Capture); i { case 0: return &v.state @@ -160082,7 +160948,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1191].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1198].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PortMetric_Transmit); i { case 0: return &v.state @@ -160094,7 +160960,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1192].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1199].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowMetricsRequest_MetricNames); i { case 0: return &v.state @@ -160106,7 +160972,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1193].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1200].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowTaggedMetricsFilter_MetricNames); i { case 0: return &v.state @@ -160118,7 +160984,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1194].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1201].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowMetric_Transmit); i { case 0: return &v.state @@ -160130,7 +160996,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1195].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1202].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FlowMetricTagValue_Choice); i { case 0: return &v.state @@ -160142,7 +161008,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1196].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1203].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Bgpv4MetricsRequest_ColumnNames); i { case 0: return &v.state @@ -160154,7 +161020,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1197].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1204].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Bgpv4Metric_SessionState); i { case 0: return &v.state @@ -160166,7 +161032,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1198].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1205].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Bgpv4Metric_FsmState); i { case 0: return &v.state @@ -160178,7 +161044,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1199].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1206].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Bgpv6MetricsRequest_ColumnNames); i { case 0: return &v.state @@ -160190,7 +161056,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1200].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1207].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Bgpv6Metric_SessionState); i { case 0: return &v.state @@ -160202,7 +161068,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1201].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1208].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Bgpv6Metric_FsmState); i { case 0: return &v.state @@ -160214,7 +161080,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1202].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1209].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisMetricsRequest_ColumnNames); i { case 0: return &v.state @@ -160226,7 +161092,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1203].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1210].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LagMetricsRequest_ColumnNames); i { case 0: return &v.state @@ -160238,7 +161104,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1204].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1211].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LagMetric_OperStatus); i { case 0: return &v.state @@ -160250,7 +161116,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1205].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1212].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LacpMetricsRequest_ColumnNames); i { case 0: return &v.state @@ -160262,7 +161128,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1206].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1213].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LacpMetric_Activity); i { case 0: return &v.state @@ -160274,7 +161140,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1207].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1214].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LacpMetric_Timeout); i { case 0: return &v.state @@ -160286,7 +161152,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1208].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1215].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LacpMetric_Synchronization); i { case 0: return &v.state @@ -160298,7 +161164,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1209].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1216].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LldpMetricsRequest_ColumnNames); i { case 0: return &v.state @@ -160310,7 +161176,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1210].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1217].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RsvpMetricsRequest_ColumnNames); i { case 0: return &v.state @@ -160322,7 +161188,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1211].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1218].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Dhcpv4ClientMetricsRequest_ColumnNames); i { case 0: return &v.state @@ -160334,7 +161200,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1212].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1219].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Dhcpv4ServerMetricsRequest_ColumnNames); i { case 0: return &v.state @@ -160346,7 +161212,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1213].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1220].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StatesRequest_Choice); i { case 0: return &v.state @@ -160358,7 +161224,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1214].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1221].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StatesResponse_Choice); i { case 0: return &v.state @@ -160370,7 +161236,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1215].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1222].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpPrefixStateRequest_PrefixFilters); i { case 0: return &v.state @@ -160382,7 +161248,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1216].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1223].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpPrefixIpv4UnicastFilter_Origin); i { case 0: return &v.state @@ -160394,7 +161260,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1217].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1224].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpPrefixIpv6UnicastFilter_Origin); i { case 0: return &v.state @@ -160406,7 +161272,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1218].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1225].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpPrefixIpv4UnicastState_Origin); i { case 0: return &v.state @@ -160418,7 +161284,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1219].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1226].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BgpPrefixIpv6UnicastState_Origin); i { case 0: return &v.state @@ -160430,7 +161296,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1220].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1227].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResultExtendedCommunityStructured_Choice); i { case 0: return &v.state @@ -160442,7 +161308,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1221].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1228].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResultExtendedCommunityTransitive2OctetAsType_Choice); i { case 0: return &v.state @@ -160454,7 +161320,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1222].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1229].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResultExtendedCommunityTransitiveIpv4AddressType_Choice); i { case 0: return &v.state @@ -160466,7 +161332,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1223].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1230].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResultExtendedCommunityTransitive4OctetAsType_Choice); i { case 0: return &v.state @@ -160478,7 +161344,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1224].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1231].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResultExtendedCommunityTransitiveOpaqueType_Choice); i { case 0: return &v.state @@ -160490,7 +161356,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1225].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1232].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResultExtendedCommunityNonTransitive2OctetAsType_Choice); i { case 0: return &v.state @@ -160502,7 +161368,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1226].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1233].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResultBgpCommunity_Type); i { case 0: return &v.state @@ -160514,7 +161380,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1227].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1234].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResultBgpAsPathSegment_Type); i { case 0: return &v.state @@ -160526,7 +161392,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1228].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1235].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisLspState_PduType); i { case 0: return &v.state @@ -160538,7 +161404,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1229].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1236].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisLspV4Prefix_RedistributionType); i { case 0: return &v.state @@ -160550,7 +161416,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1230].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1237].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisLspV4Prefix_OriginType); i { case 0: return &v.state @@ -160562,7 +161428,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1231].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1238].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisLspExtendedV4Prefix_RedistributionType); i { case 0: return &v.state @@ -160574,7 +161440,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1232].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1239].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisLspV6Prefix_RedistributionType); i { case 0: return &v.state @@ -160586,7 +161452,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1233].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1240].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IsisLspV6Prefix_OriginType); i { case 0: return &v.state @@ -160598,7 +161464,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1234].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1241].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LldpNeighborsState_ChassisIdType); i { case 0: return &v.state @@ -160610,7 +161476,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1235].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1242].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LldpNeighborsState_PortIdType); i { case 0: return &v.state @@ -160622,7 +161488,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1236].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1243].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LldpCapabilityState_CapabilityName); i { case 0: return &v.state @@ -160634,7 +161500,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1237].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1244].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RsvpLspState_SessionStatus); i { case 0: return &v.state @@ -160646,7 +161512,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1238].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1245].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RsvpLspState_LastFlapReason); i { case 0: return &v.state @@ -160658,7 +161524,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1239].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1246].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RsvpLspIpv4Ero_Type); i { case 0: return &v.state @@ -160670,7 +161536,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1240].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1247].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowEthernetDst_Choice); i { case 0: return &v.state @@ -160682,7 +161548,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1241].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1248].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowEthernetSrc_Choice); i { case 0: return &v.state @@ -160694,7 +161560,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1242].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1249].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowEthernetEtherType_Choice); i { case 0: return &v.state @@ -160706,7 +161572,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1243].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1250].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowEthernetPfcQueue_Choice); i { case 0: return &v.state @@ -160718,7 +161584,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1244].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1251].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowVlanPriority_Choice); i { case 0: return &v.state @@ -160730,7 +161596,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1245].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1252].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowVlanCfi_Choice); i { case 0: return &v.state @@ -160742,7 +161608,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1246].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1253].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowVlanId_Choice); i { case 0: return &v.state @@ -160754,7 +161620,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1247].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1254].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowVlanTpid_Choice); i { case 0: return &v.state @@ -160766,7 +161632,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1248].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1255].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowVxlanFlags_Choice); i { case 0: return &v.state @@ -160778,7 +161644,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1249].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1256].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowVxlanReserved0_Choice); i { case 0: return &v.state @@ -160790,7 +161656,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1250].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1257].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowVxlanVni_Choice); i { case 0: return &v.state @@ -160802,7 +161668,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1251].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1258].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowVxlanReserved1_Choice); i { case 0: return &v.state @@ -160814,7 +161680,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1252].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1259].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4Version_Choice); i { case 0: return &v.state @@ -160826,7 +161692,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1253].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1260].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4HeaderLength_Choice); i { case 0: return &v.state @@ -160838,7 +161704,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1254].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1261].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4TotalLength_Choice); i { case 0: return &v.state @@ -160850,7 +161716,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1255].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1262].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4Identification_Choice); i { case 0: return &v.state @@ -160862,7 +161728,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1256].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1263].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4Reserved_Choice); i { case 0: return &v.state @@ -160874,7 +161740,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1257].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1264].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4DontFragment_Choice); i { case 0: return &v.state @@ -160886,7 +161752,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1258].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1265].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4MoreFragments_Choice); i { case 0: return &v.state @@ -160898,7 +161764,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1259].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1266].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4FragmentOffset_Choice); i { case 0: return &v.state @@ -160910,7 +161776,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1260].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1267].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4TimeToLive_Choice); i { case 0: return &v.state @@ -160922,7 +161788,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1261].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1268].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4Protocol_Choice); i { case 0: return &v.state @@ -160934,7 +161800,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1262].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1269].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4HeaderChecksum_Choice); i { case 0: return &v.state @@ -160946,7 +161812,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1263].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1270].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4HeaderChecksum_Generated); i { case 0: return &v.state @@ -160958,7 +161824,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1264].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1271].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4Src_Choice); i { case 0: return &v.state @@ -160970,7 +161836,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1265].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1272].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4Dst_Choice); i { case 0: return &v.state @@ -160982,7 +161848,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1266].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1273].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice); i { case 0: return &v.state @@ -160994,7 +161860,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1267].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1274].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4OptionsCustomTypeOptionClass_Choice); i { case 0: return &v.state @@ -161006,7 +161872,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1268].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1275].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice); i { case 0: return &v.state @@ -161018,7 +161884,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1269].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1276].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4PriorityRaw_Choice); i { case 0: return &v.state @@ -161030,7 +161896,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1270].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1277].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4DscpPhb_Choice); i { case 0: return &v.state @@ -161042,7 +161908,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1271].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1278].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4DscpEcn_Choice); i { case 0: return &v.state @@ -161054,7 +161920,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1272].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1279].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4TosPrecedence_Choice); i { case 0: return &v.state @@ -161066,7 +161932,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1273].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1280].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4TosDelay_Choice); i { case 0: return &v.state @@ -161078,7 +161944,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1274].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1281].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4TosThroughput_Choice); i { case 0: return &v.state @@ -161090,7 +161956,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1275].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1282].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4TosReliability_Choice); i { case 0: return &v.state @@ -161102,7 +161968,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1276].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1283].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4TosMonetary_Choice); i { case 0: return &v.state @@ -161114,7 +161980,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1277].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1284].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv4TosUnused_Choice); i { case 0: return &v.state @@ -161126,7 +161992,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1278].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1285].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv6Version_Choice); i { case 0: return &v.state @@ -161138,7 +162004,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1279].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1286].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv6TrafficClass_Choice); i { case 0: return &v.state @@ -161150,7 +162016,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1280].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1287].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv6FlowLabel_Choice); i { case 0: return &v.state @@ -161162,7 +162028,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1281].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1288].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv6PayloadLength_Choice); i { case 0: return &v.state @@ -161174,7 +162040,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1282].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1289].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv6NextHeader_Choice); i { case 0: return &v.state @@ -161186,7 +162052,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1283].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1290].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv6HopLimit_Choice); i { case 0: return &v.state @@ -161198,7 +162064,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1284].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1291].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv6Src_Choice); i { case 0: return &v.state @@ -161210,7 +162076,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1285].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1292].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIpv6Dst_Choice); i { case 0: return &v.state @@ -161222,7 +162088,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1286].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1293].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPfcPauseDst_Choice); i { case 0: return &v.state @@ -161234,7 +162100,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1287].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1294].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPfcPauseSrc_Choice); i { case 0: return &v.state @@ -161246,7 +162112,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1288].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1295].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPfcPauseEtherType_Choice); i { case 0: return &v.state @@ -161258,7 +162124,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1289].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1296].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPfcPauseControlOpCode_Choice); i { case 0: return &v.state @@ -161270,7 +162136,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1290].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1297].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPfcPauseClassEnableVector_Choice); i { case 0: return &v.state @@ -161282,7 +162148,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1291].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1298].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPfcPausePauseClass0_Choice); i { case 0: return &v.state @@ -161294,7 +162160,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1292].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1299].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPfcPausePauseClass1_Choice); i { case 0: return &v.state @@ -161306,7 +162172,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1293].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1300].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPfcPausePauseClass2_Choice); i { case 0: return &v.state @@ -161318,7 +162184,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1294].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1301].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPfcPausePauseClass3_Choice); i { case 0: return &v.state @@ -161330,7 +162196,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1295].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1302].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPfcPausePauseClass4_Choice); i { case 0: return &v.state @@ -161342,7 +162208,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1296].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1303].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPfcPausePauseClass5_Choice); i { case 0: return &v.state @@ -161354,7 +162220,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1297].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1304].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPfcPausePauseClass6_Choice); i { case 0: return &v.state @@ -161366,7 +162232,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1298].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1305].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPfcPausePauseClass7_Choice); i { case 0: return &v.state @@ -161378,7 +162244,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1299].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1306].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowEthernetPauseDst_Choice); i { case 0: return &v.state @@ -161390,7 +162256,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1300].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1307].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowEthernetPauseSrc_Choice); i { case 0: return &v.state @@ -161402,7 +162268,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1301].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1308].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowEthernetPauseEtherType_Choice); i { case 0: return &v.state @@ -161414,7 +162280,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1302].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1309].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowEthernetPauseControlOpCode_Choice); i { case 0: return &v.state @@ -161426,7 +162292,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1303].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1310].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowEthernetPauseTime_Choice); i { case 0: return &v.state @@ -161438,7 +162304,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1304].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1311].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpSrcPort_Choice); i { case 0: return &v.state @@ -161450,7 +162316,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1305].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1312].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpDstPort_Choice); i { case 0: return &v.state @@ -161462,7 +162328,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1306].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1313].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpSeqNum_Choice); i { case 0: return &v.state @@ -161474,7 +162340,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1307].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1314].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpAckNum_Choice); i { case 0: return &v.state @@ -161486,7 +162352,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1308].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1315].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpDataOffset_Choice); i { case 0: return &v.state @@ -161498,7 +162364,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1309].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1316].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpEcnNs_Choice); i { case 0: return &v.state @@ -161510,7 +162376,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1310].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1317].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpEcnCwr_Choice); i { case 0: return &v.state @@ -161522,7 +162388,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1311].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1318].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpEcnEcho_Choice); i { case 0: return &v.state @@ -161534,7 +162400,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1312].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1319].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpCtlUrg_Choice); i { case 0: return &v.state @@ -161546,7 +162412,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1313].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1320].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpCtlAck_Choice); i { case 0: return &v.state @@ -161558,7 +162424,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1314].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1321].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpCtlPsh_Choice); i { case 0: return &v.state @@ -161570,7 +162436,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1315].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1322].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpCtlRst_Choice); i { case 0: return &v.state @@ -161582,7 +162448,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1316].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1323].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpCtlSyn_Choice); i { case 0: return &v.state @@ -161594,7 +162460,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1317].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1324].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpCtlFin_Choice); i { case 0: return &v.state @@ -161606,7 +162472,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1318].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1325].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpWindow_Choice); i { case 0: return &v.state @@ -161618,7 +162484,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1319].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1326].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpChecksum_Choice); i { case 0: return &v.state @@ -161630,7 +162496,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1320].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1327].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowTcpChecksum_Generated); i { case 0: return &v.state @@ -161642,7 +162508,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1321].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1328].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowUdpSrcPort_Choice); i { case 0: return &v.state @@ -161654,7 +162520,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1322].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1329].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowUdpDstPort_Choice); i { case 0: return &v.state @@ -161666,7 +162532,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1323].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1330].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowUdpLength_Choice); i { case 0: return &v.state @@ -161678,7 +162544,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1324].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1331].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowUdpChecksum_Choice); i { case 0: return &v.state @@ -161690,7 +162556,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1325].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1332].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowUdpChecksum_Generated); i { case 0: return &v.state @@ -161702,7 +162568,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1326].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1333].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGreChecksumPresent_Choice); i { case 0: return &v.state @@ -161714,7 +162580,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1327].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1334].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGreReserved0_Choice); i { case 0: return &v.state @@ -161726,7 +162592,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1328].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1335].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGreVersion_Choice); i { case 0: return &v.state @@ -161738,7 +162604,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1329].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1336].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGreProtocol_Choice); i { case 0: return &v.state @@ -161750,7 +162616,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1330].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1337].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGreChecksum_Choice); i { case 0: return &v.state @@ -161762,7 +162628,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1331].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1338].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGreChecksum_Generated); i { case 0: return &v.state @@ -161774,7 +162640,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1332].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1339].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGreReserved1_Choice); i { case 0: return &v.state @@ -161786,7 +162652,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1333].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1340].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv1Version_Choice); i { case 0: return &v.state @@ -161798,7 +162664,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1334].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1341].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv1ProtocolType_Choice); i { case 0: return &v.state @@ -161810,7 +162676,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1335].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1342].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv1Reserved_Choice); i { case 0: return &v.state @@ -161822,7 +162688,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1336].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1343].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv1EFlag_Choice); i { case 0: return &v.state @@ -161834,7 +162700,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1337].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1344].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv1SFlag_Choice); i { case 0: return &v.state @@ -161846,7 +162712,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1338].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1345].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv1PnFlag_Choice); i { case 0: return &v.state @@ -161858,7 +162724,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1339].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1346].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv1MessageType_Choice); i { case 0: return &v.state @@ -161870,7 +162736,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1340].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1347].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv1MessageLength_Choice); i { case 0: return &v.state @@ -161882,7 +162748,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1341].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1348].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv1Teid_Choice); i { case 0: return &v.state @@ -161894,7 +162760,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1342].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1349].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv1SquenceNumber_Choice); i { case 0: return &v.state @@ -161906,7 +162772,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1343].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1350].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv1NPduNumber_Choice); i { case 0: return &v.state @@ -161918,7 +162784,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1344].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1351].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv1NextExtensionHeaderType_Choice); i { case 0: return &v.state @@ -161930,7 +162796,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1345].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1352].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpExtensionExtensionLength_Choice); i { case 0: return &v.state @@ -161942,7 +162808,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1346].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1353].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpExtensionContents_Choice); i { case 0: return &v.state @@ -161954,7 +162820,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1347].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1354].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpExtensionNextExtensionHeader_Choice); i { case 0: return &v.state @@ -161966,7 +162832,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1348].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1355].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv2Version_Choice); i { case 0: return &v.state @@ -161978,7 +162844,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1349].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1356].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv2PiggybackingFlag_Choice); i { case 0: return &v.state @@ -161990,7 +162856,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1350].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1357].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv2TeidFlag_Choice); i { case 0: return &v.state @@ -162002,7 +162868,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1351].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1358].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv2Spare1_Choice); i { case 0: return &v.state @@ -162014,7 +162880,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1352].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1359].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv2MessageType_Choice); i { case 0: return &v.state @@ -162026,7 +162892,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1353].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1360].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv2MessageLength_Choice); i { case 0: return &v.state @@ -162038,7 +162904,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1354].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1361].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv2Teid_Choice); i { case 0: return &v.state @@ -162050,7 +162916,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1355].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1362].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv2SequenceNumber_Choice); i { case 0: return &v.state @@ -162062,7 +162928,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1356].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1363].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowGtpv2Spare2_Choice); i { case 0: return &v.state @@ -162074,7 +162940,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1357].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1364].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowArpHardwareType_Choice); i { case 0: return &v.state @@ -162086,7 +162952,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1358].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1365].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowArpProtocolType_Choice); i { case 0: return &v.state @@ -162098,7 +162964,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1359].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1366].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowArpHardwareLength_Choice); i { case 0: return &v.state @@ -162110,7 +162976,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1360].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1367].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowArpProtocolLength_Choice); i { case 0: return &v.state @@ -162122,7 +162988,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1361].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1368].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowArpOperation_Choice); i { case 0: return &v.state @@ -162134,7 +163000,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1362].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1369].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowArpSenderHardwareAddr_Choice); i { case 0: return &v.state @@ -162146,7 +163012,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1363].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1370].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowArpSenderProtocolAddr_Choice); i { case 0: return &v.state @@ -162158,7 +163024,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1364].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1371].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowArpTargetHardwareAddr_Choice); i { case 0: return &v.state @@ -162170,7 +163036,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1365].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1372].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowArpTargetProtocolAddr_Choice); i { case 0: return &v.state @@ -162182,7 +163048,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1366].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1373].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpEchoType_Choice); i { case 0: return &v.state @@ -162194,7 +163060,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1367].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1374].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpEchoCode_Choice); i { case 0: return &v.state @@ -162206,7 +163072,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1368].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1375].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpEchoChecksum_Choice); i { case 0: return &v.state @@ -162218,7 +163084,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1369].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1376].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpEchoChecksum_Generated); i { case 0: return &v.state @@ -162230,7 +163096,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1370].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1377].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpEchoIdentifier_Choice); i { case 0: return &v.state @@ -162242,7 +163108,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1371].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1378].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpEchoSequenceNumber_Choice); i { case 0: return &v.state @@ -162254,7 +163120,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1372].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1379].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpCommonChecksum_Choice); i { case 0: return &v.state @@ -162266,7 +163132,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1373].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1380].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpCommonChecksum_Generated); i { case 0: return &v.state @@ -162278,7 +163144,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1374].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1381].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpNextFieldsIdentifier_Choice); i { case 0: return &v.state @@ -162290,7 +163156,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1375].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1382].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpNextFieldsSequenceNumber_Choice); i { case 0: return &v.state @@ -162302,7 +163168,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1376].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1383].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpv6EchoType_Choice); i { case 0: return &v.state @@ -162314,7 +163180,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1377].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1384].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpv6EchoCode_Choice); i { case 0: return &v.state @@ -162326,7 +163192,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1378].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1385].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpv6EchoIdentifier_Choice); i { case 0: return &v.state @@ -162338,7 +163204,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1379].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1386].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpv6EchoSequenceNumber_Choice); i { case 0: return &v.state @@ -162350,7 +163216,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1380].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1387].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpv6EchoChecksum_Choice); i { case 0: return &v.state @@ -162362,7 +163228,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1381].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1388].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpv6EchoChecksum_Generated); i { case 0: return &v.state @@ -162374,7 +163240,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1382].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1389].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpv6CommonChecksum_Choice); i { case 0: return &v.state @@ -162386,7 +163252,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1383].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1390].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIcmpv6CommonChecksum_Generated); i { case 0: return &v.state @@ -162398,7 +163264,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1384].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1391].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPppAddress_Choice); i { case 0: return &v.state @@ -162410,7 +163276,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1385].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1392].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPppControl_Choice); i { case 0: return &v.state @@ -162422,7 +163288,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1386].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1393].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowPppProtocolType_Choice); i { case 0: return &v.state @@ -162434,7 +163300,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1387].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1394].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIgmpv1Version_Choice); i { case 0: return &v.state @@ -162446,7 +163312,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1388].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1395].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIgmpv1Type_Choice); i { case 0: return &v.state @@ -162458,7 +163324,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1389].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1396].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIgmpv1Unused_Choice); i { case 0: return &v.state @@ -162470,7 +163336,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1390].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1397].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIgmpv1Checksum_Choice); i { case 0: return &v.state @@ -162482,7 +163348,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1391].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1398].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIgmpv1Checksum_Generated); i { case 0: return &v.state @@ -162494,7 +163360,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1392].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1399].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowIgmpv1GroupAddress_Choice); i { case 0: return &v.state @@ -162506,7 +163372,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1393].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1400].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowMplsLabel_Choice); i { case 0: return &v.state @@ -162518,7 +163384,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1394].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1401].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowMplsTrafficClass_Choice); i { case 0: return &v.state @@ -162530,7 +163396,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1395].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1402].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowMplsBottomOfStack_Choice); i { case 0: return &v.state @@ -162542,7 +163408,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1396].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1403].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowMplsTimeToLive_Choice); i { case 0: return &v.state @@ -162554,7 +163420,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1397].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1404].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CVersion_Choice); i { case 0: return &v.state @@ -162566,7 +163432,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1398].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1405].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CPDURequestId_Choice); i { case 0: return &v.state @@ -162578,7 +163444,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1399].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1406].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CPDUErrorIndex_Choice); i { case 0: return &v.state @@ -162590,7 +163456,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1400].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1407].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CBulkPDURequestId_Choice); i { case 0: return &v.state @@ -162602,7 +163468,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1401].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1408].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice); i { case 0: return &v.state @@ -162614,7 +163480,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1402].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1409].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice); i { case 0: return &v.state @@ -162626,7 +163492,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1403].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1410].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice); i { case 0: return &v.state @@ -162638,7 +163504,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1404].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1411].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice); i { case 0: return &v.state @@ -162650,7 +163516,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1405].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1412].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice); i { case 0: return &v.state @@ -162662,7 +163528,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1406].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1413].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice); i { case 0: return &v.state @@ -162674,7 +163540,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1407].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1414].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice); i { case 0: return &v.state @@ -162686,7 +163552,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1408].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1415].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice); i { case 0: return &v.state @@ -162698,7 +163564,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1409].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1416].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowSnmpv2CCommonRequestId_Choice); i { case 0: return &v.state @@ -162710,7 +163576,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1410].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1417].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRsvpRsvpChecksum_Choice); i { case 0: return &v.state @@ -162722,7 +163588,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1411].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1418].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRsvpRsvpChecksum_Generated); i { case 0: return &v.state @@ -162734,7 +163600,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1412].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1419].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRsvpTimeToLive_Choice); i { case 0: return &v.state @@ -162746,7 +163612,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1413].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1420].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRsvpReserved_Choice); i { case 0: return &v.state @@ -162758,7 +163624,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1414].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1421].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice); i { case 0: return &v.state @@ -162770,7 +163636,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1415].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1422].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice); i { case 0: return &v.state @@ -162782,7 +163648,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1416].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1423].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice); i { case 0: return &v.state @@ -162794,7 +163660,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1417].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1424].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice); i { case 0: return &v.state @@ -162806,7 +163672,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1418].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1425].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice); i { case 0: return &v.state @@ -162818,7 +163684,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1419].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1426].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice); i { case 0: return &v.state @@ -162830,7 +163696,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1420].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1427].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice); i { case 0: return &v.state @@ -162842,7 +163708,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1421].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1428].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice); i { case 0: return &v.state @@ -162854,7 +163720,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1422].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1429].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice); i { case 0: return &v.state @@ -162866,7 +163732,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1423].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1430].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice); i { case 0: return &v.state @@ -162878,7 +163744,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1424].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1431].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice); i { case 0: return &v.state @@ -162890,7 +163756,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1425].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1432].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice); i { case 0: return &v.state @@ -162902,7 +163768,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1426].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1433].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice); i { case 0: return &v.state @@ -162914,7 +163780,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1427].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1434].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice); i { case 0: return &v.state @@ -162926,7 +163792,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1428].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1435].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice); i { case 0: return &v.state @@ -162938,7 +163804,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1429].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1436].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice); i { case 0: return &v.state @@ -162950,7 +163816,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1430].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1437].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServVersion_Choice); i { case 0: return &v.state @@ -162962,7 +163828,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1431].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1438].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServReserved1_Choice); i { case 0: return &v.state @@ -162974,7 +163840,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1432].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1439].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice); i { case 0: return &v.state @@ -162986,7 +163852,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1433].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1440].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice); i { case 0: return &v.state @@ -162998,7 +163864,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1434].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1441].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice); i { case 0: return &v.state @@ -163010,7 +163876,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1435].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1442].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServReserved2_Choice); i { case 0: return &v.state @@ -163022,7 +163888,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1436].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1443].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice); i { case 0: return &v.state @@ -163034,7 +163900,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1437].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1444].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice); i { case 0: return &v.state @@ -163046,7 +163912,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1438].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1445].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice); i { case 0: return &v.state @@ -163058,7 +163924,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1439].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1446].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice); i { case 0: return &v.state @@ -163070,7 +163936,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1440].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1447].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice); i { case 0: return &v.state @@ -163082,7 +163948,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1441].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1448].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice); i { case 0: return &v.state @@ -163094,7 +163960,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1442].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1449].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice); i { case 0: return &v.state @@ -163106,7 +163972,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1443].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1450].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice); i { case 0: return &v.state @@ -163118,7 +163984,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1444].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1451].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice); i { case 0: return &v.state @@ -163130,7 +163996,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1445].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1452].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathRecordRouteType1LabelCType_Choice); i { case 0: return &v.state @@ -163142,7 +164008,7 @@ func file_otg_proto_init() { return nil } } - file_otg_proto_msgTypes[1446].Exporter = func(v interface{}, i int) interface{} { + file_otg_proto_msgTypes[1453].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PatternFlowRSVPPathObjectsCustomType_Choice); i { case 0: return &v.state @@ -164056,13 +164922,20 @@ func file_otg_proto_init() { file_otg_proto_msgTypes[1000].OneofWrappers = []interface{}{} file_otg_proto_msgTypes[1001].OneofWrappers = []interface{}{} file_otg_proto_msgTypes[1002].OneofWrappers = []interface{}{} + file_otg_proto_msgTypes[1003].OneofWrappers = []interface{}{} + file_otg_proto_msgTypes[1004].OneofWrappers = []interface{}{} + file_otg_proto_msgTypes[1005].OneofWrappers = []interface{}{} + file_otg_proto_msgTypes[1006].OneofWrappers = []interface{}{} + file_otg_proto_msgTypes[1007].OneofWrappers = []interface{}{} + file_otg_proto_msgTypes[1008].OneofWrappers = []interface{}{} + file_otg_proto_msgTypes[1009].OneofWrappers = []interface{}{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_otg_proto_rawDesc, NumEnums: 426, - NumMessages: 1447, + NumMessages: 1454, NumExtensions: 0, NumServices: 1, }, diff --git a/gosnappi/otg/otg.proto b/gosnappi/otg/otg.proto index a221a14d..7f2bc11b 100644 --- a/gosnappi/otg/otg.proto +++ b/gosnappi/otg/otg.proto @@ -1,4 +1,4 @@ -/* Open Traffic Generator API 1.6.2 +/* Open Traffic Generator API 1.7.0 * Open Traffic Generator API defines a model-driven, vendor-neutral and standard * interface for emulating layer 2-7 network devices and generating test traffic. * @@ -15001,6 +15001,29 @@ message PatternFlowIpv4SrcMetricTag { optional uint32 length = 3; } +// ipv4 random pattern +message PatternFlowIpv4SrcRandom { + + // The minimum possible value generated by the random value generator. + // default = 0.0.0.0 + optional string min = 1; + + // The maximum possible value generated by the random value generator. + // default = 255.255.255.255 + optional string max = 2; + + // The seed value is used to initialize the random number generator to a deterministic + // state. If the user provides a seed value of 0, the implementation will generate a + // sequence of non-deterministic random values. For any other seed value, the sequence + // of random numbers will be generated in a deterministic manner (specific to the implementation). + // default = 1 + optional uint32 seed = 3; + + // The total number of values to be generated by the random value generator. + // default = 1 + optional uint32 count = 4; +} + // Source address message PatternFlowIpv4Src { @@ -15009,9 +15032,10 @@ message PatternFlowIpv4Src { unspecified = 0; value = 2; values = 3; - auto = 1; increment = 4; decrement = 5; + auto = 1; + random = 6; } } // Description missing in models @@ -15039,6 +15063,9 @@ message PatternFlowIpv4Src { // Description missing in models FlowIpv4Auto auto = 8; + + // Description missing in models + PatternFlowIpv4SrcRandom random = 9; } // ipv4 counter pattern @@ -15077,6 +15104,29 @@ message PatternFlowIpv4DstMetricTag { optional uint32 length = 3; } +// ipv4 random pattern +message PatternFlowIpv4DstRandom { + + // The minimum possible value generated by the random value generator. + // default = 0.0.0.0 + optional string min = 1; + + // The maximum possible value generated by the random value generator. + // default = 255.255.255.255 + optional string max = 2; + + // The seed value is used to initialize the random number generator to a deterministic + // state. If the user provides a seed value of 0, the implementation will generate a + // sequence of non-deterministic random values. For any other seed value, the sequence + // of random numbers will be generated in a deterministic manner (specific to the implementation). + // default = 1 + optional uint32 seed = 3; + + // The total number of values to be generated by the random value generator. + // default = 1 + optional uint32 count = 4; +} + // Destination address message PatternFlowIpv4Dst { @@ -15085,9 +15135,10 @@ message PatternFlowIpv4Dst { unspecified = 0; value = 2; values = 3; - auto = 1; increment = 4; decrement = 5; + auto = 1; + random = 6; } } // Description missing in models @@ -15115,6 +15166,9 @@ message PatternFlowIpv4Dst { // Description missing in models FlowIpv4Auto auto = 8; + + // Description missing in models + PatternFlowIpv4DstRandom random = 9; } // integer counter pattern @@ -16086,6 +16140,29 @@ message PatternFlowIpv6FlowLabelMetricTag { optional uint32 length = 3; } +// integer random pattern +message PatternFlowIpv6FlowLabelRandom { + + // The minimum possible value generated by the random value generator. + // default = 0 + optional uint32 min = 1; + + // The maximum possible value generated by the random value generator. + // default = 1048575 + optional uint32 max = 2; + + // The seed value is used to initialize the random number generator to a deterministic + // state. If the user provides a seed value of 0, the implementation will generate a + // sequence of non-deterministic random values. For any other seed value, the sequence + // of random numbers will be generated in a deterministic manner (specific to the implementation). + // default = 1 + optional uint32 seed = 3; + + // The total number of values to be generated by the random value generator. + // default = 1 + optional uint32 count = 4; +} + // Flow label message PatternFlowIpv6FlowLabel { @@ -16096,6 +16173,7 @@ message PatternFlowIpv6FlowLabel { values = 3; increment = 4; decrement = 5; + random = 6; } } // Description missing in models @@ -16120,6 +16198,9 @@ message PatternFlowIpv6FlowLabel { // a corresponding header field for metrics per each applicable value. These would appear // as tagged metrics in corresponding flow metrics. repeated PatternFlowIpv6FlowLabelMetricTag metric_tags = 7; + + // Description missing in models + PatternFlowIpv6FlowLabelRandom random = 8; } // integer counter pattern @@ -17828,6 +17909,29 @@ message PatternFlowTcpSrcPortMetricTag { optional uint32 length = 3; } +// integer random pattern +message PatternFlowTcpSrcPortRandom { + + // The minimum possible value generated by the random value generator. + // default = 0 + optional uint32 min = 1; + + // The maximum possible value generated by the random value generator. + // default = 65535 + optional uint32 max = 2; + + // The seed value is used to initialize the random number generator to a deterministic + // state. If the user provides a seed value of 0, the implementation will generate a + // sequence of non-deterministic random values. For any other seed value, the sequence + // of random numbers will be generated in a deterministic manner (specific to the implementation). + // default = 1 + optional uint32 seed = 3; + + // The total number of values to be generated by the random value generator. + // default = 1 + optional uint32 count = 4; +} + // Source port message PatternFlowTcpSrcPort { @@ -17838,6 +17942,7 @@ message PatternFlowTcpSrcPort { values = 3; increment = 4; decrement = 5; + random = 6; } } // Description missing in models @@ -17862,6 +17967,9 @@ message PatternFlowTcpSrcPort { // a corresponding header field for metrics per each applicable value. These would appear // as tagged metrics in corresponding flow metrics. repeated PatternFlowTcpSrcPortMetricTag metric_tags = 7; + + // Description missing in models + PatternFlowTcpSrcPortRandom random = 8; } // integer counter pattern @@ -17900,6 +18008,29 @@ message PatternFlowTcpDstPortMetricTag { optional uint32 length = 3; } +// integer random pattern +message PatternFlowTcpDstPortRandom { + + // The minimum possible value generated by the random value generator. + // default = 0 + optional uint32 min = 1; + + // The maximum possible value generated by the random value generator. + // default = 65535 + optional uint32 max = 2; + + // The seed value is used to initialize the random number generator to a deterministic + // state. If the user provides a seed value of 0, the implementation will generate a + // sequence of non-deterministic random values. For any other seed value, the sequence + // of random numbers will be generated in a deterministic manner (specific to the implementation). + // default = 1 + optional uint32 seed = 3; + + // The total number of values to be generated by the random value generator. + // default = 1 + optional uint32 count = 4; +} + // Destination port message PatternFlowTcpDstPort { @@ -17910,6 +18041,7 @@ message PatternFlowTcpDstPort { values = 3; increment = 4; decrement = 5; + random = 6; } } // Description missing in models @@ -17934,6 +18066,9 @@ message PatternFlowTcpDstPort { // a corresponding header field for metrics per each applicable value. These would appear // as tagged metrics in corresponding flow metrics. repeated PatternFlowTcpDstPortMetricTag metric_tags = 7; + + // Description missing in models + PatternFlowTcpDstPortRandom random = 8; } // integer counter pattern @@ -18940,6 +19075,29 @@ message PatternFlowUdpSrcPortMetricTag { optional uint32 length = 3; } +// integer random pattern +message PatternFlowUdpSrcPortRandom { + + // The minimum possible value generated by the random value generator. + // default = 0 + optional uint32 min = 1; + + // The maximum possible value generated by the random value generator. + // default = 65535 + optional uint32 max = 2; + + // The seed value is used to initialize the random number generator to a deterministic + // state. If the user provides a seed value of 0, the implementation will generate a + // sequence of non-deterministic random values. For any other seed value, the sequence + // of random numbers will be generated in a deterministic manner (specific to the implementation). + // default = 1 + optional uint32 seed = 3; + + // The total number of values to be generated by the random value generator. + // default = 1 + optional uint32 count = 4; +} + // Source port message PatternFlowUdpSrcPort { @@ -18950,6 +19108,7 @@ message PatternFlowUdpSrcPort { values = 3; increment = 4; decrement = 5; + random = 6; } } // Description missing in models @@ -18974,6 +19133,9 @@ message PatternFlowUdpSrcPort { // a corresponding header field for metrics per each applicable value. These would appear // as tagged metrics in corresponding flow metrics. repeated PatternFlowUdpSrcPortMetricTag metric_tags = 7; + + // Description missing in models + PatternFlowUdpSrcPortRandom random = 8; } // integer counter pattern @@ -19012,6 +19174,29 @@ message PatternFlowUdpDstPortMetricTag { optional uint32 length = 3; } +// integer random pattern +message PatternFlowUdpDstPortRandom { + + // The minimum possible value generated by the random value generator. + // default = 0 + optional uint32 min = 1; + + // The maximum possible value generated by the random value generator. + // default = 65535 + optional uint32 max = 2; + + // The seed value is used to initialize the random number generator to a deterministic + // state. If the user provides a seed value of 0, the implementation will generate a + // sequence of non-deterministic random values. For any other seed value, the sequence + // of random numbers will be generated in a deterministic manner (specific to the implementation). + // default = 1 + optional uint32 seed = 3; + + // The total number of values to be generated by the random value generator. + // default = 1 + optional uint32 count = 4; +} + // Destination port message PatternFlowUdpDstPort { @@ -19022,6 +19207,7 @@ message PatternFlowUdpDstPort { values = 3; increment = 4; decrement = 5; + random = 6; } } // Description missing in models @@ -19046,6 +19232,9 @@ message PatternFlowUdpDstPort { // a corresponding header field for metrics per each applicable value. These would appear // as tagged metrics in corresponding flow metrics. repeated PatternFlowUdpDstPortMetricTag metric_tags = 7; + + // Description missing in models + PatternFlowUdpDstPortRandom random = 8; } // integer counter pattern diff --git a/requirements.txt b/requirements.txt index b8026cdf..384eded8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,11 @@ --prefer-binary -PyYAML -protobuf~=3.15.0 ; python_version <= '3.6' protobuf~=4.24.4 ; python_version > '3.6' -requests -grpcio-tools~=1.59.0 ; python_version > '3.6' +protobuf~=3.15.0 ; python_version <= '3.6' +PyYAML grpcio~=1.59.0 ; python_version > '3.6' -grpcio~=1.35.0 ; python_version <= '3.6' +grpcio-tools~=1.59.0 ; python_version > '3.6' grpcio-tools~=1.35.0 ; python_version <= '3.6' +grpcio~=1.35.0 ; python_version <= '3.6' +requests urllib3 semantic_version diff --git a/snappi/__init__.py b/snappi/__init__.py index 16d9b633..d74fad4a 100644 --- a/snappi/__init__.py +++ b/snappi/__init__.py @@ -424,10 +424,12 @@ from .snappi import PatternFlowIpv4SrcMetricTag from .snappi import PatternFlowIpv4SrcMetricTagIter from .snappi import FlowIpv4Auto +from .snappi import PatternFlowIpv4SrcRandom from .snappi import PatternFlowIpv4Dst from .snappi import PatternFlowIpv4DstCounter from .snappi import PatternFlowIpv4DstMetricTag from .snappi import PatternFlowIpv4DstMetricTagIter +from .snappi import PatternFlowIpv4DstRandom from .snappi import FlowIpv4Options from .snappi import FlowIpv4OptionsCustom from .snappi import FlowIpv4OptionsCustomType @@ -452,6 +454,7 @@ from .snappi import PatternFlowIpv6FlowLabelCounter from .snappi import PatternFlowIpv6FlowLabelMetricTag from .snappi import PatternFlowIpv6FlowLabelMetricTagIter +from .snappi import PatternFlowIpv6FlowLabelRandom from .snappi import PatternFlowIpv6PayloadLength from .snappi import PatternFlowIpv6PayloadLengthCounter from .snappi import PatternFlowIpv6PayloadLengthMetricTag @@ -551,10 +554,12 @@ from .snappi import PatternFlowTcpSrcPortCounter from .snappi import PatternFlowTcpSrcPortMetricTag from .snappi import PatternFlowTcpSrcPortMetricTagIter +from .snappi import PatternFlowTcpSrcPortRandom from .snappi import PatternFlowTcpDstPort from .snappi import PatternFlowTcpDstPortCounter from .snappi import PatternFlowTcpDstPortMetricTag from .snappi import PatternFlowTcpDstPortMetricTagIter +from .snappi import PatternFlowTcpDstPortRandom from .snappi import PatternFlowTcpSeqNum from .snappi import PatternFlowTcpSeqNumCounter from .snappi import PatternFlowTcpSeqNumMetricTag @@ -613,10 +618,12 @@ from .snappi import PatternFlowUdpSrcPortCounter from .snappi import PatternFlowUdpSrcPortMetricTag from .snappi import PatternFlowUdpSrcPortMetricTagIter +from .snappi import PatternFlowUdpSrcPortRandom from .snappi import PatternFlowUdpDstPort from .snappi import PatternFlowUdpDstPortCounter from .snappi import PatternFlowUdpDstPortMetricTag from .snappi import PatternFlowUdpDstPortMetricTagIter +from .snappi import PatternFlowUdpDstPortRandom from .snappi import PatternFlowUdpLength from .snappi import PatternFlowUdpLengthCounter from .snappi import PatternFlowUdpLengthMetricTag diff --git a/snappi/docs/openapi.yaml b/snappi/docs/openapi.yaml index 90caa123..30a1d3f6 100644 --- a/snappi/docs/openapi.yaml +++ b/snappi/docs/openapi.yaml @@ -7,7 +7,7 @@ info: \ issue](https://github.com/open-traffic-generator/models/issues) in the models\ \ repository\n- [fork the models repository](https://github.com/open-traffic-generator/models)\ \ and submit a PR" - version: 1.6.2 + version: 1.7.0 contact: url: https://github.com/open-traffic-generator/models license: @@ -20437,6 +20437,39 @@ components: minimum: 1 maximum: 32 x-field-uid: 3 + Pattern.Flow.Ipv4.Src.Random: + description: |- + ipv4 random pattern + type: object + properties: + min: + description: |- + The minimum possible value generated by the random value generator. + type: string + x-field-uid: 1 + default: 0.0.0.0 + format: ipv4 + max: + description: |- + The maximum possible value generated by the random value generator. + type: string + x-field-uid: 2 + default: 255.255.255.255 + format: ipv4 + seed: + description: |- + The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). + type: integer + default: 1 + format: uint32 + x-field-uid: 3 + count: + description: |- + The total number of values to be generated by the random value generator. + type: integer + default: 1 + format: uint32 + x-field-uid: 4 Pattern.Flow.Ipv4.Src: description: |- Source address @@ -20449,20 +20482,23 @@ components: x-field-uid: 2 values: x-field-uid: 3 - auto: - x-field-uid: 1 increment: x-field-uid: 4 decrement: x-field-uid: 5 + auto: + x-field-uid: 1 + random: + x-field-uid: 6 default: value x-field-uid: 1 enum: - value - values - - auto - increment - decrement + - auto + - random value: type: string x-field-uid: 2 @@ -20492,6 +20528,9 @@ components: auto: $ref: '#/components/schemas/Flow.Ipv4.Auto' x-field-uid: 8 + random: + $ref: '#/components/schemas/Pattern.Flow.Ipv4.Src.Random' + x-field-uid: 9 Pattern.Flow.Ipv4.Dst.Counter: description: |- ipv4 counter pattern @@ -20542,6 +20581,39 @@ components: minimum: 1 maximum: 32 x-field-uid: 3 + Pattern.Flow.Ipv4.Dst.Random: + description: |- + ipv4 random pattern + type: object + properties: + min: + description: |- + The minimum possible value generated by the random value generator. + type: string + x-field-uid: 1 + default: 0.0.0.0 + format: ipv4 + max: + description: |- + The maximum possible value generated by the random value generator. + type: string + x-field-uid: 2 + default: 255.255.255.255 + format: ipv4 + seed: + description: |- + The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). + type: integer + default: 1 + format: uint32 + x-field-uid: 3 + count: + description: |- + The total number of values to be generated by the random value generator. + type: integer + default: 1 + format: uint32 + x-field-uid: 4 Pattern.Flow.Ipv4.Dst: description: |- Destination address @@ -20554,20 +20626,23 @@ components: x-field-uid: 2 values: x-field-uid: 3 - auto: - x-field-uid: 1 increment: x-field-uid: 4 decrement: x-field-uid: 5 + auto: + x-field-uid: 1 + random: + x-field-uid: 6 default: value x-field-uid: 1 enum: - value - values - - auto - increment - decrement + - auto + - random value: type: string x-field-uid: 2 @@ -20597,6 +20672,9 @@ components: auto: $ref: '#/components/schemas/Flow.Ipv4.Auto' x-field-uid: 8 + random: + $ref: '#/components/schemas/Pattern.Flow.Ipv4.Dst.Random' + x-field-uid: 9 Pattern.Flow.Ipv4Options.Custom.Type.CopiedFlag.Counter: description: |- integer counter pattern @@ -22105,6 +22183,41 @@ components: minimum: 1 maximum: 20 x-field-uid: 3 + Pattern.Flow.Ipv6.FlowLabel.Random: + description: |- + integer random pattern + type: object + properties: + min: + description: |- + The minimum possible value generated by the random value generator. + type: integer + x-field-uid: 1 + default: 0 + format: uint32 + maximum: 1048575 + max: + description: |- + The maximum possible value generated by the random value generator. + type: integer + x-field-uid: 2 + default: 1048575 + format: uint32 + maximum: 1048575 + seed: + description: |- + The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). + type: integer + default: 1 + format: uint32 + x-field-uid: 3 + count: + description: |- + The total number of values to be generated by the random value generator. + type: integer + default: 1 + format: uint32 + x-field-uid: 4 Pattern.Flow.Ipv6.FlowLabel: description: |- Flow label @@ -22121,6 +22234,8 @@ components: x-field-uid: 4 decrement: x-field-uid: 5 + random: + x-field-uid: 6 default: value x-field-uid: 1 enum: @@ -22128,6 +22243,7 @@ components: - values - increment - decrement + - random value: type: integer x-field-uid: 2 @@ -22156,6 +22272,9 @@ components: items: $ref: '#/components/schemas/Pattern.Flow.Ipv6.FlowLabel.MetricTag' x-field-uid: 7 + random: + $ref: '#/components/schemas/Pattern.Flow.Ipv6.FlowLabel.Random' + x-field-uid: 8 Pattern.Flow.Ipv6.PayloadLength.Counter: description: |- integer counter pattern @@ -24629,6 +24748,41 @@ components: minimum: 1 maximum: 16 x-field-uid: 3 + Pattern.Flow.Tcp.SrcPort.Random: + description: |- + integer random pattern + type: object + properties: + min: + description: |- + The minimum possible value generated by the random value generator. + type: integer + x-field-uid: 1 + default: 0 + format: uint32 + maximum: 65535 + max: + description: |- + The maximum possible value generated by the random value generator. + type: integer + x-field-uid: 2 + default: 65535 + format: uint32 + maximum: 65535 + seed: + description: |- + The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). + type: integer + default: 1 + format: uint32 + x-field-uid: 3 + count: + description: |- + The total number of values to be generated by the random value generator. + type: integer + default: 1 + format: uint32 + x-field-uid: 4 Pattern.Flow.Tcp.SrcPort: description: |- Source port @@ -24645,6 +24799,8 @@ components: x-field-uid: 4 decrement: x-field-uid: 5 + random: + x-field-uid: 6 default: value x-field-uid: 1 enum: @@ -24652,6 +24808,7 @@ components: - values - increment - decrement + - random value: type: integer x-field-uid: 2 @@ -24680,6 +24837,9 @@ components: items: $ref: '#/components/schemas/Pattern.Flow.Tcp.SrcPort.MetricTag' x-field-uid: 7 + random: + $ref: '#/components/schemas/Pattern.Flow.Tcp.SrcPort.Random' + x-field-uid: 8 Pattern.Flow.Tcp.DstPort.Counter: description: |- integer counter pattern @@ -24733,6 +24893,41 @@ components: minimum: 1 maximum: 16 x-field-uid: 3 + Pattern.Flow.Tcp.DstPort.Random: + description: |- + integer random pattern + type: object + properties: + min: + description: |- + The minimum possible value generated by the random value generator. + type: integer + x-field-uid: 1 + default: 0 + format: uint32 + maximum: 65535 + max: + description: |- + The maximum possible value generated by the random value generator. + type: integer + x-field-uid: 2 + default: 65535 + format: uint32 + maximum: 65535 + seed: + description: |- + The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). + type: integer + default: 1 + format: uint32 + x-field-uid: 3 + count: + description: |- + The total number of values to be generated by the random value generator. + type: integer + default: 1 + format: uint32 + x-field-uid: 4 Pattern.Flow.Tcp.DstPort: description: |- Destination port @@ -24749,6 +24944,8 @@ components: x-field-uid: 4 decrement: x-field-uid: 5 + random: + x-field-uid: 6 default: value x-field-uid: 1 enum: @@ -24756,6 +24953,7 @@ components: - values - increment - decrement + - random value: type: integer x-field-uid: 2 @@ -24784,6 +24982,9 @@ components: items: $ref: '#/components/schemas/Pattern.Flow.Tcp.DstPort.MetricTag' x-field-uid: 7 + random: + $ref: '#/components/schemas/Pattern.Flow.Tcp.DstPort.Random' + x-field-uid: 8 Pattern.Flow.Tcp.SeqNum.Counter: description: |- integer counter pattern @@ -26215,6 +26416,41 @@ components: minimum: 1 maximum: 16 x-field-uid: 3 + Pattern.Flow.Udp.SrcPort.Random: + description: |- + integer random pattern + type: object + properties: + min: + description: |- + The minimum possible value generated by the random value generator. + type: integer + x-field-uid: 1 + default: 0 + format: uint32 + maximum: 65535 + max: + description: |- + The maximum possible value generated by the random value generator. + type: integer + x-field-uid: 2 + default: 65535 + format: uint32 + maximum: 65535 + seed: + description: |- + The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). + type: integer + default: 1 + format: uint32 + x-field-uid: 3 + count: + description: |- + The total number of values to be generated by the random value generator. + type: integer + default: 1 + format: uint32 + x-field-uid: 4 Pattern.Flow.Udp.SrcPort: description: |- Source port @@ -26231,6 +26467,8 @@ components: x-field-uid: 4 decrement: x-field-uid: 5 + random: + x-field-uid: 6 default: value x-field-uid: 1 enum: @@ -26238,6 +26476,7 @@ components: - values - increment - decrement + - random value: type: integer x-field-uid: 2 @@ -26266,6 +26505,9 @@ components: items: $ref: '#/components/schemas/Pattern.Flow.Udp.SrcPort.MetricTag' x-field-uid: 7 + random: + $ref: '#/components/schemas/Pattern.Flow.Udp.SrcPort.Random' + x-field-uid: 8 Pattern.Flow.Udp.DstPort.Counter: description: |- integer counter pattern @@ -26319,6 +26561,41 @@ components: minimum: 1 maximum: 16 x-field-uid: 3 + Pattern.Flow.Udp.DstPort.Random: + description: |- + integer random pattern + type: object + properties: + min: + description: |- + The minimum possible value generated by the random value generator. + type: integer + x-field-uid: 1 + default: 0 + format: uint32 + maximum: 65535 + max: + description: |- + The maximum possible value generated by the random value generator. + type: integer + x-field-uid: 2 + default: 65535 + format: uint32 + maximum: 65535 + seed: + description: |- + The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). + type: integer + default: 1 + format: uint32 + x-field-uid: 3 + count: + description: |- + The total number of values to be generated by the random value generator. + type: integer + default: 1 + format: uint32 + x-field-uid: 4 Pattern.Flow.Udp.DstPort: description: |- Destination port @@ -26335,6 +26612,8 @@ components: x-field-uid: 4 decrement: x-field-uid: 5 + random: + x-field-uid: 6 default: value x-field-uid: 1 enum: @@ -26342,6 +26621,7 @@ components: - values - increment - decrement + - random value: type: integer x-field-uid: 2 @@ -26370,6 +26650,9 @@ components: items: $ref: '#/components/schemas/Pattern.Flow.Udp.DstPort.MetricTag' x-field-uid: 7 + random: + $ref: '#/components/schemas/Pattern.Flow.Udp.DstPort.Random' + x-field-uid: 8 Pattern.Flow.Udp.Length.Counter: description: |- integer counter pattern diff --git a/snappi/otg_pb2.py b/snappi/otg_pb2.py index d57dd295..3ffda9d5 100644 --- a/snappi/otg_pb2.py +++ b/snappi/otg_pb2.py @@ -15,7 +15,7 @@ from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\totg.proto\x12\x03otg\x1a google/protobuf/descriptor.proto\x1a\x1bgoogle/protobuf/empty.proto\"\x89\x02\n\x06\x43onfig\x12\x18\n\x05ports\x18\x01 \x03(\x0b\x32\t.otg.Port\x12\x16\n\x04lags\x18\x02 \x03(\x0b\x32\x08.otg.Lag\x12\x1b\n\x06layer1\x18\x03 \x03(\x0b\x32\x0b.otg.Layer1\x12\x1e\n\x08\x63\x61ptures\x18\x04 \x03(\x0b\x32\x0c.otg.Capture\x12\x1c\n\x07\x64\x65vices\x18\x05 \x03(\x0b\x32\x0b.otg.Device\x12\x18\n\x05\x66lows\x18\x06 \x03(\x0b\x32\t.otg.Flow\x12\x1a\n\x06\x65vents\x18\x07 \x01(\x0b\x32\n.otg.Event\x12#\n\x07options\x18\x08 \x01(\x0b\x32\x12.otg.ConfigOptions\x12\x17\n\x04lldp\x18\t \x03(\x0b\x32\t.otg.Lldp\"g\n\rConfigOptions\x12&\n\x0cport_options\x18\x01 \x01(\x0b\x32\x10.otg.PortOptions\x12.\n\x10protocol_options\x18\x02 \x01(\x0b\x32\x14.otg.ProtocolOptions\"F\n\x04Port\x12\x15\n\x08location\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04name\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x0b\n\t_locationB\x07\n\x05_name\"G\n\x0bPortOptions\x12 \n\x13location_preemption\x18\x01 \x01(\x08H\x00\x88\x01\x01\x42\x16\n\x14_location_preemption\"\x88\x01\n\x03Lag\x12\x1b\n\x05ports\x18\x01 \x03(\x0b\x32\x0c.otg.LagPort\x12\"\n\x08protocol\x18\x02 \x01(\x0b\x32\x10.otg.LagProtocol\x12\x16\n\tmin_links\x18\x03 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04name\x18\x04 \x01(\tH\x01\x88\x01\x01\x42\x0c\n\n_min_linksB\x07\n\x05_name\"z\n\x07LagPort\x12\x16\n\tport_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x04lacp\x18\x02 \x01(\x0b\x32\x10.otg.LagPortLacp\x12)\n\x08\x65thernet\x18\x03 \x01(\x0b\x32\x17.otg.DeviceEthernetBaseB\x0c\n\n_port_name\"\xd0\x01\n\x0bLagProtocol\x12\x31\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1c.otg.LagProtocol.Choice.EnumH\x00\x88\x01\x01\x12\"\n\x04lacp\x18\x02 \x01(\x0b\x32\x14.otg.LagProtocolLacp\x12&\n\x06static\x18\x03 \x01(\x0b\x32\x16.otg.LagProtocolStatic\x1a\x37\n\x06\x43hoice\"-\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04lacp\x10\x01\x12\n\n\x06static\x10\x02\x42\t\n\x07_choice\"3\n\x11LagProtocolStatic\x12\x13\n\x06lag_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\t\n\x07_lag_id\"\xa7\x01\n\x0fLagProtocolLacp\x12\x1c\n\x0f\x61\x63tor_system_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\"\n\x15\x61\x63tor_system_priority\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\tactor_key\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x12\n\x10_actor_system_idB\x18\n\x16_actor_system_priorityB\x0c\n\n_actor_key\"\x93\x03\n\x0bLagPortLacp\x12\x1e\n\x11\x61\x63tor_port_number\x18\x01 \x01(\rH\x00\x88\x01\x01\x12 \n\x13\x61\x63tor_port_priority\x18\x02 \x01(\rH\x01\x88\x01\x01\x12@\n\x0e\x61\x63tor_activity\x18\x03 \x01(\x0e\x32#.otg.LagPortLacp.ActorActivity.EnumH\x02\x88\x01\x01\x12*\n\x1dlacpdu_periodic_time_interval\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1b\n\x0elacpdu_timeout\x18\x05 \x01(\rH\x04\x88\x01\x01\x1a\x41\n\rActorActivity\"0\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07passive\x10\x01\x12\n\n\x06\x61\x63tive\x10\x02\x42\x14\n\x12_actor_port_numberB\x16\n\x14_actor_port_priorityB\x11\n\x0f_actor_activityB \n\x1e_lacpdu_periodic_time_intervalB\x11\n\x0f_lacpdu_timeout\"\x84\x01\n\x12\x44\x65viceEthernetBase\x12\x10\n\x03mac\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x10\n\x03mtu\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1e\n\x05vlans\x18\x03 \x03(\x0b\x32\x0f.otg.DeviceVlan\x12\x11\n\x04name\x18\x04 \x01(\tH\x02\x88\x01\x01\x42\x06\n\x04_macB\x06\n\x04_mtuB\x07\n\x05_name\"\xb3\x02\n\x0e\x44\x65viceEthernet\x12+\n\nconnection\x18\x02 \x01(\x0b\x32\x17.otg.EthernetConnection\x12\'\n\x0eipv4_addresses\x18\x03 \x03(\x0b\x32\x0f.otg.DeviceIpv4\x12\'\n\x0eipv6_addresses\x18\x04 \x03(\x0b\x32\x0f.otg.DeviceIpv6\x12\x10\n\x03mac\x18\x05 \x01(\tH\x00\x88\x01\x01\x12\x10\n\x03mtu\x18\x06 \x01(\rH\x01\x88\x01\x01\x12\x1e\n\x05vlans\x18\x07 \x03(\x0b\x32\x0f.otg.DeviceVlan\x12\x11\n\x04name\x18\x08 \x01(\tH\x02\x88\x01\x01\x12\x32\n\x11\x64hcpv4_interfaces\x18\t \x03(\x0b\x32\x17.otg.DeviceDhcpv4clientB\x06\n\x04_macB\x06\n\x04_mtuB\x07\n\x05_name\"\x9b\x02\n\x12\x45thernetConnection\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.EthernetConnection.Choice.EnumH\x00\x88\x01\x01\x12\x16\n\tport_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08lag_name\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x17\n\nvxlan_name\x18\x04 \x01(\tH\x03\x88\x01\x01\x1aN\n\x06\x43hoice\"D\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tport_name\x10\x01\x12\x0c\n\x08lag_name\x10\x02\x12\x0e\n\nvxlan_name\x10\x03\x42\t\n\x07_choiceB\x0c\n\n_port_nameB\x0b\n\t_lag_nameB\r\n\x0b_vxlan_name\"\xf3\x01\n\nDeviceVlan\x12,\n\x04tpid\x18\x01 \x01(\x0e\x32\x19.otg.DeviceVlan.Tpid.EnumH\x00\x88\x01\x01\x12\x15\n\x08priority\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0f\n\x02id\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x11\n\x04name\x18\x04 \x01(\tH\x03\x88\x01\x01\x1aV\n\x04Tpid\"N\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05x8100\x10\x01\x12\t\n\x05x88A8\x10\x02\x12\t\n\x05x9100\x10\x03\x12\t\n\x05x9200\x10\x04\x12\t\n\x05x9300\x10\x05\x42\x07\n\x05_tpidB\x0b\n\t_priorityB\x05\n\x03_idB\x07\n\x05_name\"\xbc\x01\n\nDeviceIpv4\x12\x14\n\x07gateway\x18\x01 \x01(\tH\x00\x88\x01\x01\x12.\n\x0bgateway_mac\x18\x02 \x01(\x0b\x32\x19.otg.DeviceIpv4GatewayMAC\x12\x14\n\x07\x61\x64\x64ress\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x13\n\x06prefix\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x11\n\x04name\x18\x05 \x01(\tH\x03\x88\x01\x01\x42\n\n\x08_gatewayB\n\n\x08_addressB\t\n\x07_prefixB\x07\n\x05_name\"v\n\x12\x44\x65viceIpv4Loopback\x12\x15\n\x08\x65th_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x07\x61\x64\x64ress\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x11\n\x04name\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x0b\n\t_eth_nameB\n\n\x08_addressB\x07\n\x05_name\"\xcf\x01\n\x14\x44\x65viceIpv4GatewayMAC\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.DeviceIpv4GatewayMAC.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xbc\x01\n\nDeviceIpv6\x12\x14\n\x07gateway\x18\x01 \x01(\tH\x00\x88\x01\x01\x12.\n\x0bgateway_mac\x18\x02 \x01(\x0b\x32\x19.otg.DeviceIpv6GatewayMAC\x12\x14\n\x07\x61\x64\x64ress\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x13\n\x06prefix\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x11\n\x04name\x18\x05 \x01(\tH\x03\x88\x01\x01\x42\n\n\x08_gatewayB\n\n\x08_addressB\t\n\x07_prefixB\x07\n\x05_name\"v\n\x12\x44\x65viceIpv6Loopback\x12\x15\n\x08\x65th_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x07\x61\x64\x64ress\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x11\n\x04name\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x0b\n\t_eth_nameB\n\n\x08_addressB\x07\n\x05_name\"\xcf\x01\n\x14\x44\x65viceIpv6GatewayMAC\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.DeviceIpv6GatewayMAC.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xce\x02\n\x12\x44\x65viceDhcpv4client\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x38\n\x06\x63hoice\x18\x02 \x01(\x0e\x32#.otg.DeviceDhcpv4client.Choice.EnumH\x01\x88\x01\x01\x12\x1b\n\x0eserver_address\x18\x04 \x01(\tH\x02\x88\x01\x01\x12\x16\n\tbroadcast\x18\x05 \x01(\x08H\x03\x88\x01\x01\x12\x38\n\x17parameters_request_list\x18\x06 \x01(\x0b\x32\x17.otg.Dhcpv4ClientParams\x1aG\n\x06\x43hoice\"=\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0c\x66irst_server\x10\x01\x12\x12\n\x0eserver_address\x10\x02\x42\x07\n\x05_nameB\t\n\x07_choiceB\x11\n\x0f_server_addressB\x0c\n\n_broadcast\"\xbe\x01\n\x12\x44hcpv4ClientParams\x12\x18\n\x0bsubnet_mask\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x13\n\x06router\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x1a\n\rrenewal_timer\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x1c\n\x0frebinding_timer\x18\x04 \x01(\x08H\x03\x88\x01\x01\x42\x0e\n\x0c_subnet_maskB\t\n\x07_routerB\x10\n\x0e_renewal_timerB\x12\n\x10_rebinding_timer\"\xa6\x06\n\x06Layer1\x12\x12\n\nport_names\x18\x01 \x03(\t\x12*\n\x05speed\x18\x02 \x01(\x0e\x32\x16.otg.Layer1.Speed.EnumH\x00\x88\x01\x01\x12*\n\x05media\x18\x03 \x01(\x0e\x32\x16.otg.Layer1.Media.EnumH\x01\x88\x01\x01\x12\x18\n\x0bpromiscuous\x18\x04 \x01(\x08H\x02\x88\x01\x01\x12\x10\n\x03mtu\x18\x05 \x01(\rH\x03\x88\x01\x01\x12 \n\x13ieee_media_defaults\x18\x06 \x01(\x08H\x04\x88\x01\x01\x12\x1b\n\x0e\x61uto_negotiate\x18\x07 \x01(\x08H\x05\x88\x01\x01\x12\x34\n\x10\x61uto_negotiation\x18\x08 \x01(\x0b\x32\x1a.otg.Layer1AutoNegotiation\x12,\n\x0c\x66low_control\x18\t \x01(\x0b\x32\x16.otg.Layer1FlowControl\x12\x11\n\x04name\x18\n \x01(\tH\x06\x88\x01\x01\x1a\xa9\x02\n\x05Speed\"\x9f\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x14\n\x10speed_10_fd_mbps\x10\x01\x12\x14\n\x10speed_10_hd_mbps\x10\x02\x12\x15\n\x11speed_100_fd_mbps\x10\x03\x12\x15\n\x11speed_100_hd_mbps\x10\x04\x12\x10\n\x0cspeed_1_gbps\x10\x05\x12\x11\n\rspeed_10_gbps\x10\x06\x12\x11\n\rspeed_25_gbps\x10\x07\x12\x11\n\rspeed_40_gbps\x10\x08\x12\x11\n\rspeed_50_gbps\x10\t\x12\x12\n\x0espeed_100_gbps\x10\n\x12\x12\n\x0espeed_200_gbps\x10\x0b\x12\x12\n\x0espeed_400_gbps\x10\x0c\x12\x12\n\x0espeed_800_gbps\x10\r\x1a\x42\n\x05Media\"9\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x63opper\x10\x01\x12\t\n\x05\x66iber\x10\x02\x12\t\n\x05sgmii\x10\x03\x42\x08\n\x06_speedB\x08\n\x06_mediaB\x0e\n\x0c_promiscuousB\x06\n\x04_mtuB\x16\n\x14_ieee_media_defaultsB\x11\n\x0f_auto_negotiateB\x07\n\x05_name\"\x93\x03\n\x15Layer1AutoNegotiation\x12 \n\x13\x61\x64vertise_1000_mbps\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\"\n\x15\x61\x64vertise_100_fd_mbps\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\"\n\x15\x61\x64vertise_100_hd_mbps\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12!\n\x14\x61\x64vertise_10_fd_mbps\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12!\n\x14\x61\x64vertise_10_hd_mbps\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x1a\n\rlink_training\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x13\n\x06rs_fec\x18\x07 \x01(\x08H\x06\x88\x01\x01\x42\x16\n\x14_advertise_1000_mbpsB\x18\n\x16_advertise_100_fd_mbpsB\x18\n\x16_advertise_100_hd_mbpsB\x17\n\x15_advertise_10_fd_mbpsB\x17\n\x15_advertise_10_hd_mbpsB\x10\n\x0e_link_trainingB\t\n\x07_rs_fec\"\xac\x02\n\x11Layer1FlowControl\x12\x1d\n\x10\x64irected_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x37\n\x06\x63hoice\x18\x02 \x01(\x0e\x32\".otg.Layer1FlowControl.Choice.EnumH\x01\x88\x01\x01\x12-\n\rieee_802_1qbb\x18\x03 \x01(\x0b\x32\x16.otg.Layer1Ieee8021qbb\x12)\n\x0bieee_802_3x\x18\x04 \x01(\x0b\x32\x14.otg.Layer1Ieee8023x\x1a\x45\n\x06\x43hoice\";\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rieee_802_1qbb\x10\x01\x12\x0f\n\x0bieee_802_3x\x10\x02\x42\x13\n\x11_directed_addressB\t\n\x07_choice\"\x11\n\x0fLayer1Ieee8023x\"\x89\x03\n\x11Layer1Ieee8021qbb\x12\x16\n\tpfc_delay\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x18\n\x0bpfc_class_0\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x18\n\x0bpfc_class_1\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x18\n\x0bpfc_class_2\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x18\n\x0bpfc_class_3\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x18\n\x0bpfc_class_4\x18\x06 \x01(\rH\x05\x88\x01\x01\x12\x18\n\x0bpfc_class_5\x18\x07 \x01(\rH\x06\x88\x01\x01\x12\x18\n\x0bpfc_class_6\x18\x08 \x01(\rH\x07\x88\x01\x01\x12\x18\n\x0bpfc_class_7\x18\t \x01(\rH\x08\x88\x01\x01\x42\x0c\n\n_pfc_delayB\x0e\n\x0c_pfc_class_0B\x0e\n\x0c_pfc_class_1B\x0e\n\x0c_pfc_class_2B\x0e\n\x0c_pfc_class_3B\x0e\n\x0c_pfc_class_4B\x0e\n\x0c_pfc_class_5B\x0e\n\x0c_pfc_class_6B\x0e\n\x0c_pfc_class_7\"\xa1\x02\n\x07\x43\x61pture\x12\x12\n\nport_names\x18\x01 \x03(\t\x12#\n\x07\x66ilters\x18\x02 \x03(\x0b\x32\x12.otg.CaptureFilter\x12\x16\n\toverwrite\x18\x03 \x01(\x08H\x00\x88\x01\x01\x12\x18\n\x0bpacket_size\x18\x04 \x01(\rH\x01\x88\x01\x01\x12-\n\x06\x66ormat\x18\x05 \x01(\x0e\x32\x18.otg.Capture.Format.EnumH\x02\x88\x01\x01\x12\x11\n\x04name\x18\x06 \x01(\tH\x03\x88\x01\x01\x1a\x37\n\x06\x46ormat\"-\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04pcap\x10\x01\x12\n\n\x06pcapng\x10\x02\x42\x0c\n\n_overwriteB\x0e\n\x0c_packet_sizeB\t\n\x07_formatB\x07\n\x05_name\"\xd6\x02\n\rCaptureFilter\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.CaptureFilter.Choice.EnumH\x00\x88\x01\x01\x12\"\n\x06\x63ustom\x18\x02 \x01(\x0b\x32\x12.otg.CaptureCustom\x12&\n\x08\x65thernet\x18\x03 \x01(\x0b\x32\x14.otg.CaptureEthernet\x12\x1e\n\x04vlan\x18\x04 \x01(\x0b\x32\x10.otg.CaptureVlan\x12\x1e\n\x04ipv4\x18\x05 \x01(\x0b\x32\x10.otg.CaptureIpv4\x12\x1e\n\x04ipv6\x18\x06 \x01(\x0b\x32\x10.otg.CaptureIpv6\x1aY\n\x06\x43hoice\"O\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x63ustom\x10\x01\x12\x0c\n\x08\x65thernet\x10\x02\x12\x08\n\x04vlan\x10\x03\x12\x08\n\x04ipv4\x10\x04\x12\x08\n\x04ipv6\x10\x05\x42\t\n\x07_choice\"\xb1\x01\n\rCaptureCustom\x12\x13\n\x06offset\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x17\n\nbit_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x11\n\x04mask\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x13\n\x06negate\x18\x05 \x01(\x08H\x04\x88\x01\x01\x42\t\n\x07_offsetB\r\n\x0b_bit_lengthB\x08\n\x06_valueB\x07\n\x05_maskB\t\n\x07_negate\"h\n\x0c\x43\x61ptureField\x12\x12\n\x05value\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04mask\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x13\n\x06negate\x18\x03 \x01(\x08H\x02\x88\x01\x01\x42\x08\n\x06_valueB\x07\n\x05_maskB\t\n\x07_negate\"\x9e\x01\n\x0f\x43\x61ptureEthernet\x12\x1e\n\x03src\x18\x01 \x01(\x0b\x32\x11.otg.CaptureField\x12\x1e\n\x03\x64st\x18\x02 \x01(\x0b\x32\x11.otg.CaptureField\x12%\n\nether_type\x18\x03 \x01(\x0b\x32\x11.otg.CaptureField\x12$\n\tpfc_queue\x18\x04 \x01(\x0b\x32\x11.otg.CaptureField\"\x96\x01\n\x0b\x43\x61ptureVlan\x12#\n\x08priority\x18\x01 \x01(\x0b\x32\x11.otg.CaptureField\x12\x1e\n\x03\x63\x66i\x18\x02 \x01(\x0b\x32\x11.otg.CaptureField\x12\x1d\n\x02id\x18\x03 \x01(\x0b\x32\x11.otg.CaptureField\x12#\n\x08protocol\x18\x04 \x01(\x0b\x32\x11.otg.CaptureField\"\xb4\x04\n\x0b\x43\x61ptureIpv4\x12\"\n\x07version\x18\x01 \x01(\x0b\x32\x11.otg.CaptureField\x12(\n\rheader_length\x18\x02 \x01(\x0b\x32\x11.otg.CaptureField\x12#\n\x08priority\x18\x03 \x01(\x0b\x32\x11.otg.CaptureField\x12\'\n\x0ctotal_length\x18\x04 \x01(\x0b\x32\x11.otg.CaptureField\x12)\n\x0eidentification\x18\x05 \x01(\x0b\x32\x11.otg.CaptureField\x12#\n\x08reserved\x18\x06 \x01(\x0b\x32\x11.otg.CaptureField\x12(\n\rdont_fragment\x18\x07 \x01(\x0b\x32\x11.otg.CaptureField\x12)\n\x0emore_fragments\x18\x08 \x01(\x0b\x32\x11.otg.CaptureField\x12*\n\x0f\x66ragment_offset\x18\t \x01(\x0b\x32\x11.otg.CaptureField\x12\'\n\x0ctime_to_live\x18\n \x01(\x0b\x32\x11.otg.CaptureField\x12#\n\x08protocol\x18\x0b \x01(\x0b\x32\x11.otg.CaptureField\x12*\n\x0fheader_checksum\x18\x0c \x01(\x0b\x32\x11.otg.CaptureField\x12\x1e\n\x03src\x18\r \x01(\x0b\x32\x11.otg.CaptureField\x12\x1e\n\x03\x64st\x18\x0e \x01(\x0b\x32\x11.otg.CaptureField\"\xbb\x02\n\x0b\x43\x61ptureIpv6\x12\"\n\x07version\x18\x01 \x01(\x0b\x32\x11.otg.CaptureField\x12(\n\rtraffic_class\x18\x02 \x01(\x0b\x32\x11.otg.CaptureField\x12%\n\nflow_label\x18\x03 \x01(\x0b\x32\x11.otg.CaptureField\x12)\n\x0epayload_length\x18\x04 \x01(\x0b\x32\x11.otg.CaptureField\x12&\n\x0bnext_header\x18\x05 \x01(\x0b\x32\x11.otg.CaptureField\x12$\n\thop_limit\x18\x06 \x01(\x0b\x32\x11.otg.CaptureField\x12\x1e\n\x03src\x18\x07 \x01(\x0b\x32\x11.otg.CaptureField\x12\x1e\n\x03\x64st\x18\x08 \x01(\x0b\x32\x11.otg.CaptureField\"\xe2\x02\n\x06\x44\x65vice\x12&\n\tethernets\x18\x01 \x03(\x0b\x32\x13.otg.DeviceEthernet\x12/\n\x0eipv4_loopbacks\x18\x02 \x03(\x0b\x32\x17.otg.DeviceIpv4Loopback\x12/\n\x0eipv6_loopbacks\x18\x03 \x03(\x0b\x32\x17.otg.DeviceIpv6Loopback\x12#\n\x04isis\x18\x04 \x01(\x0b\x32\x15.otg.DeviceIsisRouter\x12!\n\x03\x62gp\x18\x05 \x01(\x0b\x32\x14.otg.DeviceBgpRouter\x12\x1f\n\x05vxlan\x18\x06 \x01(\x0b\x32\x10.otg.DeviceVxlan\x12\x11\n\x04name\x18\x07 \x01(\tH\x00\x88\x01\x01\x12\x1d\n\x04rsvp\x18\x08 \x01(\x0b\x32\x0f.otg.DeviceRsvp\x12*\n\x0b\x64hcp_server\x18\t \x01(\x0b\x32\x15.otg.DeviceDhcpServerB\x07\n\x05_name\"A\n\x0fProtocolOptions\x12\x1b\n\x0e\x61uto_start_all\x18\x01 \x01(\x08H\x00\x88\x01\x01\x42\x11\n\x0f_auto_start_all\"\xf2\x02\n\x10\x44\x65viceIsisRouter\x12.\n\x08instance\x18\x01 \x01(\x0b\x32\x1c.otg.DeviceIsisMultiInstance\x12\x16\n\tsystem_id\x18\x02 \x01(\tH\x00\x88\x01\x01\x12&\n\ninterfaces\x18\x03 \x03(\x0b\x32\x12.otg.IsisInterface\x12\x1d\n\x05\x62\x61sic\x18\x04 \x01(\x0b\x32\x0e.otg.IsisBasic\x12#\n\x08\x61\x64vanced\x18\x05 \x01(\x0b\x32\x11.otg.IsisAdvanced\x12,\n\x0brouter_auth\x18\x06 \x01(\x0b\x32\x17.otg.IsisAuthentication\x12(\n\tv4_routes\x18\x07 \x03(\x0b\x32\x15.otg.IsisV4RouteRange\x12(\n\tv6_routes\x18\x08 \x03(\x0b\x32\x15.otg.IsisV6RouteRange\x12\x11\n\x04name\x18\t \x01(\tH\x01\x88\x01\x01\x42\x0c\n\n_system_idB\x07\n\x05_name\"B\n\x17\x44\x65viceIsisMultiInstance\x12\x10\n\x03iid\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\r\n\x05itids\x18\x02 \x03(\rB\x06\n\x04_iid\"\x91\x06\n\rIsisInterface\x12\x15\n\x08\x65th_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06metric\x18\x02 \x01(\rH\x01\x88\x01\x01\x12>\n\x0cnetwork_type\x18\x03 \x01(\x0e\x32#.otg.IsisInterface.NetworkType.EnumH\x02\x88\x01\x01\x12:\n\nlevel_type\x18\x04 \x01(\x0e\x32!.otg.IsisInterface.LevelType.EnumH\x03\x88\x01\x01\x12,\n\x0bl1_settings\x18\x05 \x01(\x0b\x32\x17.otg.IsisInterfaceLevel\x12,\n\x0bl2_settings\x18\x06 \x01(\x0b\x32\x17.otg.IsisInterfaceLevel\x12\'\n\x12multi_topology_ids\x18\x07 \x03(\x0b\x32\x0b.otg.IsisMT\x12-\n\x13traffic_engineering\x18\x08 \x03(\x0b\x32\x10.otg.LinkStateTE\x12\x38\n\x0e\x61uthentication\x18\t \x01(\x0b\x32 .otg.IsisInterfaceAuthentication\x12,\n\x08\x61\x64vanced\x18\n \x01(\x0b\x32\x1a.otg.IsisInterfaceAdvanced\x12\x39\n\x0flink_protection\x18\x0b \x01(\x0b\x32 .otg.IsisInterfaceLinkProtection\x12\x13\n\x0bsrlg_values\x18\x0c \x03(\r\x12\x11\n\x04name\x18\r \x01(\tH\x04\x88\x01\x01\x1aI\n\x0bNetworkType\":\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tbroadcast\x10\x01\x12\x12\n\x0epoint_to_point\x10\x02\x1aM\n\tLevelType\"@\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07level_1\x10\x01\x12\x0b\n\x07level_2\x10\x02\x12\r\n\tlevel_1_2\x10\x03\x42\x0b\n\t_eth_nameB\t\n\x07_metricB\x0f\n\r_network_typeB\r\n\x0b_level_typeB\x07\n\x05_name\"\x96\x01\n\x12IsisInterfaceLevel\x12\x15\n\x08priority\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1b\n\x0ehello_interval\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1a\n\rdead_interval\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x0b\n\t_priorityB\x11\n\x0f_hello_intervalB\x10\n\x0e_dead_interval\"P\n\x06IsisMT\x12\x12\n\x05mt_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x18\n\x0blink_metric\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x08\n\x06_mt_idB\x0e\n\x0c_link_metric\"\xa4\x02\n\x0bLinkStateTE\x12!\n\x14\x61\x64ministrative_group\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0cmetric_level\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x19\n\x0cmax_bandwith\x18\x03 \x01(\rH\x02\x88\x01\x01\x12%\n\x18max_reservable_bandwidth\x18\x04 \x01(\rH\x03\x88\x01\x01\x12=\n\x13priority_bandwidths\x18\x05 \x01(\x0b\x32 .otg.LinkStatepriorityBandwidthsB\x17\n\x15_administrative_groupB\x0f\n\r_metric_levelB\x0f\n\r_max_bandwithB\x1b\n\x19_max_reservable_bandwidth\"\xed\x01\n\x1bLinkStatepriorityBandwidths\x12\x10\n\x03pb0\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03pb1\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x10\n\x03pb2\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x10\n\x03pb3\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x10\n\x03pb4\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x10\n\x03pb5\x18\x06 \x01(\rH\x05\x88\x01\x01\x12\x10\n\x03pb6\x18\x07 \x01(\rH\x06\x88\x01\x01\x12\x10\n\x03pb7\x18\x08 \x01(\rH\x07\x88\x01\x01\x42\x06\n\x04_pb0B\x06\n\x04_pb1B\x06\n\x04_pb2B\x06\n\x04_pb3B\x06\n\x04_pb4B\x06\n\x04_pb5B\x06\n\x04_pb6B\x06\n\x04_pb7\"\xed\x01\n\x1bIsisInterfaceAuthentication\x12\x46\n\tauth_type\x18\x01 \x01(\x0e\x32..otg.IsisInterfaceAuthentication.AuthType.EnumH\x00\x88\x01\x01\x12\x10\n\x03md5\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08password\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a:\n\x08\x41uthType\".\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03md5\x10\x01\x12\x0c\n\x08password\x10\x02\x42\x0c\n\n_auth_typeB\x06\n\x04_md5B\x0b\n\t_password\"\xd3\x02\n\x15IsisInterfaceAdvanced\x12\x1c\n\x0f\x61uto_adjust_mtu\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x1d\n\x10\x61uto_adjust_area\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12,\n\x1f\x61uto_adjust_supported_protocols\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\"\n\x15\x65nable_3way_handshake\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12&\n\x19p2p_hellos_to_unicast_mac\x18\x05 \x01(\x08H\x04\x88\x01\x01\x42\x12\n\x10_auto_adjust_mtuB\x13\n\x11_auto_adjust_areaB\"\n _auto_adjust_supported_protocolsB\x18\n\x16_enable_3way_handshakeB\x1c\n\x1a_p2p_hellos_to_unicast_mac\"\xf9\x02\n\x1bIsisInterfaceLinkProtection\x12\x1a\n\rextra_traffic\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x18\n\x0bunprotected\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x13\n\x06shared\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x1d\n\x10\x64\x65\x64icated_1_to_1\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x1f\n\x12\x64\x65\x64icated_1_plus_1\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x15\n\x08\x65nhanced\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x18\n\x0breserved_40\x18\x07 \x01(\x08H\x06\x88\x01\x01\x12\x18\n\x0breserved_80\x18\x08 \x01(\x08H\x07\x88\x01\x01\x42\x10\n\x0e_extra_trafficB\x0e\n\x0c_unprotectedB\t\n\x07_sharedB\x13\n\x11_dedicated_1_to_1B\x15\n\x13_dedicated_1_plus_1B\x0b\n\t_enhancedB\x0e\n\x0c_reserved_40B\x0e\n\x0c_reserved_80\"\xd5\x01\n\tIsisBasic\x12\x1e\n\x11ipv4_te_router_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08hostname\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1f\n\x12\x65nable_wide_metric\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x1f\n\x12learned_lsp_filter\x18\x04 \x01(\x08H\x03\x88\x01\x01\x42\x14\n\x12_ipv4_te_router_idB\x0b\n\t_hostnameB\x15\n\x13_enable_wide_metricB\x15\n\x13_learned_lsp_filter\"\x8a\x04\n\x0cIsisAdvanced\x12!\n\x14\x65nable_hello_padding\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x1f\n\x12max_area_addresses\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\x0e\x61rea_addresses\x18\x03 \x03(\t\x12\x1d\n\x10lsp_refresh_rate\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x19\n\x0clsp_lifetime\x18\x05 \x01(\rH\x03\x88\x01\x01\x12\x1a\n\rpsnp_interval\x18\x06 \x01(\rH\x04\x88\x01\x01\x12\x1a\n\rcsnp_interval\x18\x07 \x01(\rH\x05\x88\x01\x01\x12\x19\n\x0cmax_lsp_size\x18\x08 \x01(\rH\x06\x88\x01\x01\x12*\n\x1dlsp_mgroup_min_trans_interval\x18\t \x01(\rH\x07\x88\x01\x01\x12 \n\x13\x65nable_attached_bit\x18\n \x01(\x08H\x08\x88\x01\x01\x42\x17\n\x15_enable_hello_paddingB\x15\n\x13_max_area_addressesB\x13\n\x11_lsp_refresh_rateB\x0f\n\r_lsp_lifetimeB\x10\n\x0e_psnp_intervalB\x10\n\x0e_csnp_intervalB\x0f\n\r_max_lsp_sizeB \n\x1e_lsp_mgroup_min_trans_intervalB\x16\n\x14_enable_attached_bit\"\xae\x01\n\x12IsisAuthentication\x12\x1f\n\x12ignore_receive_md5\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12.\n\tarea_auth\x18\x02 \x01(\x0b\x32\x1b.otg.IsisAuthenticationBase\x12\x30\n\x0b\x64omain_auth\x18\x03 \x01(\x0b\x32\x1b.otg.IsisAuthenticationBaseB\x15\n\x13_ignore_receive_md5\"\xe3\x01\n\x16IsisAuthenticationBase\x12\x41\n\tauth_type\x18\x01 \x01(\x0e\x32).otg.IsisAuthenticationBase.AuthType.EnumH\x00\x88\x01\x01\x12\x10\n\x03md5\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08password\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a:\n\x08\x41uthType\".\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03md5\x10\x01\x12\x0c\n\x08password\x10\x02\x42\x0c\n\n_auth_typeB\x06\n\x04_md5B\x0b\n\t_password\"\xd8\x04\n\x10IsisV4RouteRange\x12&\n\taddresses\x18\x01 \x03(\x0b\x32\x13.otg.V4RouteAddress\x12\x18\n\x0blink_metric\x18\x02 \x01(\rH\x00\x88\x01\x01\x12?\n\x0borigin_type\x18\x03 \x01(\x0e\x32%.otg.IsisV4RouteRange.OriginType.EnumH\x01\x88\x01\x01\x12O\n\x13redistribution_type\x18\x04 \x01(\x0e\x32-.otg.IsisV4RouteRange.RedistributionType.EnumH\x02\x88\x01\x01\x12\x11\n\x04name\x18\x05 \x01(\tH\x03\x88\x01\x01\x12 \n\x13prefix_attr_enabled\x18\x06 \x01(\x08H\x04\x88\x01\x01\x12\x13\n\x06x_flag\x18\x07 \x01(\x08H\x05\x88\x01\x01\x12\x13\n\x06r_flag\x18\x08 \x01(\x08H\x06\x88\x01\x01\x12\x13\n\x06n_flag\x18\t \x01(\x08H\x07\x88\x01\x01\x1a\x41\n\nOriginType\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08internal\x10\x01\x12\x0c\n\x08\x65xternal\x10\x02\x1a?\n\x12RedistributionType\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x0e\n\x0c_link_metricB\x0e\n\x0c_origin_typeB\x16\n\x14_redistribution_typeB\x07\n\x05_nameB\x16\n\x14_prefix_attr_enabledB\t\n\x07_x_flagB\t\n\x07_r_flagB\t\n\x07_n_flag\"\x8c\x01\n\x0eV4RouteAddress\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06prefix\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x11\n\x04step\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\n\n\x08_addressB\t\n\x07_prefixB\x08\n\x06_countB\x07\n\x05_step\"\x8c\x01\n\x0eV6RouteAddress\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06prefix\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x11\n\x04step\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\n\n\x08_addressB\t\n\x07_prefixB\x08\n\x06_countB\x07\n\x05_step\"\x8d\x01\n\x0fMACRouteAddress\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06prefix\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x11\n\x04step\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\n\n\x08_addressB\t\n\x07_prefixB\x08\n\x06_countB\x07\n\x05_step\"\xd8\x04\n\x10IsisV6RouteRange\x12&\n\taddresses\x18\x01 \x03(\x0b\x32\x13.otg.V6RouteAddress\x12\x18\n\x0blink_metric\x18\x02 \x01(\rH\x00\x88\x01\x01\x12?\n\x0borigin_type\x18\x03 \x01(\x0e\x32%.otg.IsisV6RouteRange.OriginType.EnumH\x01\x88\x01\x01\x12O\n\x13redistribution_type\x18\x04 \x01(\x0e\x32-.otg.IsisV6RouteRange.RedistributionType.EnumH\x02\x88\x01\x01\x12\x11\n\x04name\x18\x05 \x01(\tH\x03\x88\x01\x01\x12 \n\x13prefix_attr_enabled\x18\x06 \x01(\x08H\x04\x88\x01\x01\x12\x13\n\x06x_flag\x18\x07 \x01(\x08H\x05\x88\x01\x01\x12\x13\n\x06r_flag\x18\x08 \x01(\x08H\x06\x88\x01\x01\x12\x13\n\x06n_flag\x18\t \x01(\x08H\x07\x88\x01\x01\x1a\x41\n\nOriginType\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08internal\x10\x01\x12\x0c\n\x08\x65xternal\x10\x02\x1a?\n\x12RedistributionType\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x0e\n\x0c_link_metricB\x0e\n\x0c_origin_typeB\x16\n\x14_redistribution_typeB\x07\n\x05_nameB\x16\n\x14_prefix_attr_enabledB\t\n\x07_x_flagB\t\n\x07_r_flagB\t\n\x07_n_flag\"\x93\x01\n\x0f\x44\x65viceBgpRouter\x12\x16\n\trouter_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12,\n\x0fipv4_interfaces\x18\x02 \x03(\x0b\x32\x13.otg.BgpV4Interface\x12,\n\x0fipv6_interfaces\x18\x03 \x03(\x0b\x32\x13.otg.BgpV6InterfaceB\x0c\n\n_router_id\"\x90\x02\n\x1b\x44\x65viceBgpMessageHeaderError\x12\x43\n\x07subcode\x18\x01 \x01(\x0e\x32-.otg.DeviceBgpMessageHeaderError.Subcode.EnumH\x00\x88\x01\x01\x1a\x9f\x01\n\x07Subcode\"\x93\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12.\n*connection_not_synchronized_code1_subcode1\x10\x01\x12%\n!bad_message_length_code1_subcode2\x10\x02\x12#\n\x1f\x62\x61\x64_message_type_code1_subcode3\x10\x03\x42\n\n\x08_subcode\"\xaa\x03\n\x19\x44\x65viceBgpOpenMessageError\x12\x41\n\x07subcode\x18\x01 \x01(\x0e\x32+.otg.DeviceBgpOpenMessageError.Subcode.EnumH\x00\x88\x01\x01\x1a\xbd\x02\n\x07Subcode\"\xb1\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12-\n)unsupported_version_number_code2_subcode1\x10\x01\x12 \n\x1c\x65rror_peer_as_code2_subcode2\x10\x02\x12\x1f\n\x1b\x65rror_bgp_id_code2_subcode3\x10\x03\x12\x31\n-unsupported_optional_parameter_code2_subcode4\x10\x04\x12\x1e\n\x1a\x61uth_failed_code2_subcode5\x10\x05\x12(\n$unsupported_hold_time_code2_subcode6\x10\x06\x12)\n%unsupported_capability_code2_subcode7\x10\x07\x42\n\n\x08_subcode\"\xdc\x04\n\x1b\x44\x65viceBgpUpdateMessageError\x12\x43\n\x07subcode\x18\x01 \x01(\x0e\x32-.otg.DeviceBgpUpdateMessageError.Subcode.EnumH\x00\x88\x01\x01\x1a\xeb\x03\n\x07Subcode\"\xdf\x03\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12(\n$malformed_attrib_list_code3_subcode1\x10\x01\x12\x30\n,unrecognized_wellknown_attrib_code3_subcode2\x10\x02\x12+\n\'wellknown_attrib_missing_code3_subcode3\x10\x03\x12%\n!attrib_flags_error_code3_subcode4\x10\x04\x12&\n\"attrib_length_error_code3_subcode5\x10\x05\x12(\n$invalid_origin_attrib_code3_subcode6\x10\x06\x12\"\n\x1e\x61s_routing_loop_code3_subcode7\x10\x07\x12&\n\"invalid_nhop_attrib_code3_subcode8\x10\x08\x12(\n$error_optional_attrib_code3_subcode9\x10\t\x12)\n%invalid_network_field_code3_subcode10\x10\n\x12#\n\x1f\x61\x62normal_aspath_code3_subcode11\x10\x0b\x42\n\n\x08_subcode\"\x1b\n\x19\x44\x65viceBgpHoldTimerExpired\"\"\n DeviceBgpFiniteStateMachineError\"\xe3\x03\n\x13\x44\x65viceBgpCeaseError\x12;\n\x07subcode\x18\x01 \x01(\x0e\x32%.otg.DeviceBgpCeaseError.Subcode.EnumH\x00\x88\x01\x01\x1a\x82\x03\n\x07Subcode\"\xf6\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12,\n(max_number_prefix_reached_code6_subcode1\x10\x01\x12!\n\x1d\x61\x64min_shutdown_code6_subcode2\x10\x02\x12\x1f\n\x1bpeer_deleted_code6_subcode3\x10\x03\x12\x1e\n\x1a\x61\x64min_reset_code6_subcode4\x10\x04\x12$\n connection_reject_code6_subcode5\x10\x05\x12\'\n#other_config_changes_code6_subcode6\x10\x06\x12\x32\n.connection_collision_resolution_code6_subcode7\x10\x07\x12#\n\x1fout_of_resources_code6_subcode8\x10\x08\x12#\n\x1f\x62\x66\x64_session_down_code6_subcode9\x10\tB\n\n\x08_subcode\"T\n\x14\x44\x65viceBgpCustomError\x12\x11\n\x04\x63ode\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x14\n\x07subcode\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x07\n\x05_codeB\n\n\x08_subcode\"\xe0\x06\n\tBgpV4Peer\x12\x19\n\x0cpeer_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x39\n\x16\x65vpn_ethernet_segments\x18\x02 \x03(\x0b\x32\x19.otg.BgpV4EthernetSegment\x12\x30\n\x07\x61s_type\x18\x03 \x01(\x0e\x32\x1a.otg.BgpV4Peer.AsType.EnumH\x01\x88\x01\x01\x12\x16\n\tas_number\x18\x04 \x01(\rH\x02\x88\x01\x01\x12?\n\x0f\x61s_number_width\x18\x05 \x01(\x0e\x32!.otg.BgpV4Peer.AsNumberWidth.EnumH\x03\x88\x01\x01\x12\"\n\x08\x61\x64vanced\x18\x06 \x01(\x0b\x32\x10.otg.BgpAdvanced\x12&\n\ncapability\x18\x07 \x01(\x0b\x32\x12.otg.BgpCapability\x12\x44\n\x1alearned_information_filter\x18\x08 \x01(\x0b\x32 .otg.BgpLearnedInformationFilter\x12\'\n\tv4_routes\x18\t \x03(\x0b\x32\x14.otg.BgpV4RouteRange\x12\'\n\tv6_routes\x18\n \x03(\x0b\x32\x14.otg.BgpV6RouteRange\x12.\n\x10v4_srte_policies\x18\x0b \x03(\x0b\x32\x14.otg.BgpSrteV4Policy\x12.\n\x10v6_srte_policies\x18\x0c \x03(\x0b\x32\x14.otg.BgpSrteV6Policy\x12\x11\n\x04name\x18\r \x01(\tH\x04\x88\x01\x01\x12\x31\n\x10graceful_restart\x18\x0e \x01(\x0b\x32\x17.otg.BgpGracefulRestart\x12,\n\x0ereplay_updates\x18\x0f \x01(\x0b\x32\x14.otg.BgpUpdateReplay\x1a\x35\n\x06\x41sType\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ibgp\x10\x01\x12\x08\n\x04\x65\x62gp\x10\x02\x1a;\n\rAsNumberWidth\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03two\x10\x01\x12\x08\n\x04\x66our\x10\x02\x42\x0f\n\r_peer_addressB\n\n\x08_as_typeB\x0c\n\n_as_numberB\x12\n\x10_as_number_widthB\x07\n\x05_name\"U\n\x0e\x42gpV4Interface\x12\x16\n\tipv4_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1d\n\x05peers\x18\x02 \x03(\x0b\x32\x0e.otg.BgpV4PeerB\x0c\n\n_ipv4_name\"\xf0\x03\n\x14\x42gpV4EthernetSegment\x12\x36\n\x0b\x64\x66_election\x18\x01 \x01(\x0b\x32!.otg.BgpEthernetSegmentDfElection\x12 \n\x04\x65vis\x18\x02 \x03(\x0b\x32\x12.otg.BgpV4EvpnEvis\x12\x10\n\x03\x65si\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x43\n\x0b\x61\x63tive_mode\x18\x04 \x01(\x0e\x32).otg.BgpV4EthernetSegment.ActiveMode.EnumH\x01\x88\x01\x01\x12\x16\n\tesi_label\x18\x05 \x01(\rH\x02\x88\x01\x01\x12\'\n\x08\x61\x64vanced\x18\x06 \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12&\n\x0b\x63ommunities\x18\x07 \x03(\x0b\x32\x11.otg.BgpCommunity\x12-\n\x0f\x65xt_communities\x18\x08 \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12\x1f\n\x07\x61s_path\x18\t \x01(\x0b\x32\x0e.otg.BgpAsPath\x1aH\n\nActiveMode\":\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rsingle_active\x10\x01\x12\x0e\n\nall_active\x10\x02\x42\x06\n\x04_esiB\x0e\n\x0c_active_modeB\x0c\n\n_esi_label\"N\n\x1c\x42gpEthernetSegmentDfElection\x12\x1b\n\x0e\x65lection_timer\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x11\n\x0f_election_timer\"\xda\x03\n\x10\x42gpRouteAdvanced\x12-\n include_multi_exit_discriminator\x18\x03 \x01(\x08H\x00\x88\x01\x01\x12%\n\x18multi_exit_discriminator\x18\x01 \x01(\rH\x01\x88\x01\x01\x12\x1b\n\x0einclude_origin\x18\x04 \x01(\x08H\x02\x88\x01\x01\x12\x36\n\x06origin\x18\x02 \x01(\x0e\x32!.otg.BgpRouteAdvanced.Origin.EnumH\x03\x88\x01\x01\x12%\n\x18include_local_preference\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x1d\n\x10local_preference\x18\x06 \x01(\rH\x05\x88\x01\x01\x1a\x43\n\x06Origin\"9\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03igp\x10\x01\x12\x07\n\x03\x65gp\x10\x02\x12\x0e\n\nincomplete\x10\x03\x42#\n!_include_multi_exit_discriminatorB\x1b\n\x19_multi_exit_discriminatorB\x11\n\x0f_include_originB\t\n\x07_originB\x1b\n\x19_include_local_preferenceB\x13\n\x11_local_preference\"\xa4\x02\n\x0c\x42gpCommunity\x12.\n\x04type\x18\x01 \x01(\x0e\x32\x1b.otg.BgpCommunity.Type.EnumH\x00\x88\x01\x01\x12\x16\n\tas_number\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\tas_custom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x8e\x01\n\x04Type\"\x85\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x14\n\x10manual_as_number\x10\x01\x12\r\n\tno_export\x10\x02\x12\x11\n\rno_advertised\x10\x03\x12\x17\n\x13no_export_subconfed\x10\x04\x12\x0e\n\nllgr_stale\x10\x05\x12\x0b\n\x07no_llgr\x10\x06\x42\x07\n\x05_typeB\x0c\n\n_as_numberB\x0c\n\n_as_custom\"\xf9\x03\n\x0f\x42gpExtCommunity\x12\x31\n\x04type\x18\x01 \x01(\x0e\x32\x1e.otg.BgpExtCommunity.Type.EnumH\x00\x88\x01\x01\x12\x37\n\x07subtype\x18\x02 \x01(\x0e\x32!.otg.BgpExtCommunity.Subtype.EnumH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\xbc\x01\n\x04Type\"\xb3\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1b\n\x17\x61\x64ministrator_as_2octet\x10\x01\x12\x1e\n\x1a\x61\x64ministrator_ipv4_address\x10\x02\x12\x1b\n\x17\x61\x64ministrator_as_4octet\x10\x03\x12\n\n\x06opaque\x10\x04\x12\x08\n\x04\x65vpn\x10\x05\x12*\n&administrator_as_2octet_link_bandwidth\x10\x06\x1a\x87\x01\n\x07Subtype\"|\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0croute_target\x10\x01\x12\n\n\x06origin\x10\x02\x12\x16\n\x12\x65xtended_bandwidth\x10\x03\x12\t\n\x05\x63olor\x10\x04\x12\x11\n\rencapsulation\x10\x05\x12\x0f\n\x0bmac_address\x10\x06\x42\x07\n\x05_typeB\n\n\x08_subtypeB\x08\n\x06_value\"\xbe\x02\n\tBgpAsPath\x12\x37\n\x0b\x61s_set_mode\x18\x01 \x01(\x0e\x32\x1d.otg.BgpAsPath.AsSetMode.EnumH\x00\x88\x01\x01\x12\'\n\x08segments\x18\x02 \x03(\x0b\x32\x15.otg.BgpAsPathSegment\x1a\xbe\x01\n\tAsSetMode\"\xb0\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1b\n\x17\x64o_not_include_local_as\x10\x01\x12\x12\n\x0einclude_as_seq\x10\x02\x12\x12\n\x0einclude_as_set\x10\x03\x12\x19\n\x15include_as_confed_seq\x10\x04\x12\x19\n\x15include_as_confed_set\x10\x05\x12\x1c\n\x18prepend_to_first_segment\x10\x06\x42\x0e\n\x0c_as_set_mode\"\xc2\x01\n\x10\x42gpAsPathSegment\x12\x32\n\x04type\x18\x01 \x01(\x0e\x32\x1f.otg.BgpAsPathSegment.Type.EnumH\x00\x88\x01\x01\x12\x12\n\nas_numbers\x18\x02 \x03(\r\x1a]\n\x04Type\"U\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x61s_seq\x10\x01\x12\n\n\x06\x61s_set\x10\x02\x12\x11\n\ras_confed_seq\x10\x03\x12\x11\n\ras_confed_set\x10\x04\x42\x07\n\x05_type\"\xa8\x01\n\rBgpV4EvpnEvis\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.BgpV4EvpnEvis.Choice.EnumH\x00\x88\x01\x01\x12%\n\tevi_vxlan\x18\x02 \x01(\x0b\x32\x12.otg.BgpV4EviVxlan\x1a\x30\n\x06\x43hoice\"&\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tevi_vxlan\x10\x01\x42\t\n\x07_choice\"\xe3\x05\n\rBgpV4EviVxlan\x12<\n\x11\x62roadcast_domains\x18\x01 \x03(\x0b\x32!.otg.BgpV4EviVxlanBroadcastDomain\x12\x46\n\x10replication_type\x18\x02 \x01(\x0e\x32\'.otg.BgpV4EviVxlan.ReplicationType.EnumH\x00\x88\x01\x01\x12\x17\n\npmsi_label\x18\x03 \x01(\rH\x01\x88\x01\x01\x12\x15\n\x08\x61\x64_label\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x37\n\x13route_distinguisher\x18\x05 \x01(\x0b\x32\x1a.otg.BgpRouteDistinguisher\x12\x30\n\x13route_target_export\x18\x06 \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\x30\n\x13route_target_import\x18\x07 \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\x33\n\x16l3_route_target_export\x18\x08 \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\x33\n\x16l3_route_target_import\x18\t \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\'\n\x08\x61\x64vanced\x18\n \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12&\n\x0b\x63ommunities\x18\x0b \x03(\x0b\x32\x11.otg.BgpCommunity\x12-\n\x0f\x65xt_communities\x18\x0c \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12\x1f\n\x07\x61s_path\x18\r \x01(\x0b\x32\x0e.otg.BgpAsPath\x1a\x43\n\x0fReplicationType\"0\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x17\n\x13ingress_replication\x10\x01\x42\x13\n\x11_replication_typeB\r\n\x0b_pmsi_labelB\x0b\n\t_ad_label\"\xb4\x01\n\x1c\x42gpV4EviVxlanBroadcastDomain\x12*\n\rcmac_ip_range\x18\x01 \x03(\x0b\x32\x13.otg.BgpCMacIpRange\x12\x1c\n\x0f\x65thernet_tag_id\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1f\n\x12vlan_aware_service\x18\x03 \x01(\x08H\x01\x88\x01\x01\x42\x12\n\x10_ethernet_tag_idB\x15\n\x13_vlan_aware_service\"\xd2\x03\n\x0e\x42gpCMacIpRange\x12+\n\rmac_addresses\x18\x01 \x01(\x0b\x32\x14.otg.MACRouteAddress\x12\x12\n\x05l2vni\x18\x02 \x01(\rH\x00\x88\x01\x01\x12+\n\x0eipv4_addresses\x18\x03 \x01(\x0b\x32\x13.otg.V4RouteAddress\x12+\n\x0eipv6_addresses\x18\x04 \x01(\x0b\x32\x13.otg.V6RouteAddress\x12\x12\n\x05l3vni\x18\x05 \x01(\rH\x01\x88\x01\x01\x12$\n\x17include_default_gateway\x18\x06 \x01(\x08H\x02\x88\x01\x01\x12\'\n\x08\x61\x64vanced\x18\x07 \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12&\n\x0b\x63ommunities\x18\x08 \x03(\x0b\x32\x11.otg.BgpCommunity\x12-\n\x0f\x65xt_communities\x18\t \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12\x1f\n\x07\x61s_path\x18\n \x01(\x0b\x32\x0e.otg.BgpAsPath\x12\x11\n\x04name\x18\x0b \x01(\tH\x03\x88\x01\x01\x42\x08\n\x06_l2vniB\x08\n\x06_l3vniB\x1a\n\x18_include_default_gatewayB\x07\n\x05_name\"\x98\x02\n\x15\x42gpRouteDistinguisher\x12<\n\x07rd_type\x18\x01 \x01(\x0e\x32&.otg.BgpRouteDistinguisher.RdType.EnumH\x00\x88\x01\x01\x12#\n\x16\x61uto_config_rd_ip_addr\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x15\n\x08rd_value\x18\x03 \x01(\tH\x02\x88\x01\x01\x1aQ\n\x06RdType\"G\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tas_2octet\x10\x01\x12\x10\n\x0cipv4_address\x10\x02\x12\r\n\tas_4octet\x10\x03\x42\n\n\x08_rd_typeB\x19\n\x17_auto_config_rd_ip_addrB\x0b\n\t_rd_value\"\xca\x01\n\x0e\x42gpRouteTarget\x12\x35\n\x07rt_type\x18\x01 \x01(\x0e\x32\x1f.otg.BgpRouteTarget.RtType.EnumH\x00\x88\x01\x01\x12\x15\n\x08rt_value\x18\x02 \x01(\tH\x01\x88\x01\x01\x1aQ\n\x06RtType\"G\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tas_2octet\x10\x01\x12\x10\n\x0cipv4_address\x10\x02\x12\r\n\tas_4octet\x10\x03\x42\n\n\x08_rt_typeB\x0b\n\t_rt_value\"\x83\x03\n\x0b\x42gpAdvanced\x12\x1f\n\x12hold_time_interval\x18\x01 \x01(\rH\x00\x88\x01\x01\x12 \n\x13keep_alive_interval\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1c\n\x0fupdate_interval\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x19\n\x0ctime_to_live\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x14\n\x07md5_key\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x19\n\x0cpassive_mode\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x18\n\x0blisten_port\x18\x07 \x01(\rH\x06\x88\x01\x01\x12\x1a\n\rneighbor_port\x18\x08 \x01(\rH\x07\x88\x01\x01\x42\x15\n\x13_hold_time_intervalB\x16\n\x14_keep_alive_intervalB\x12\n\x10_update_intervalB\x0f\n\r_time_to_liveB\n\n\x08_md5_keyB\x0f\n\r_passive_modeB\x0e\n\x0c_listen_portB\x10\n\x0e_neighbor_port\"\x91\n\n\rBgpCapability\x12\x19\n\x0cipv4_unicast\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x1b\n\x0eipv4_multicast\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x19\n\x0cipv6_unicast\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x1b\n\x0eipv6_multicast\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x11\n\x04vpls\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x1a\n\rroute_refresh\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x1d\n\x10route_constraint\x18\x07 \x01(\x08H\x06\x88\x01\x01\x12\x1f\n\x12link_state_non_vpn\x18\x08 \x01(\x08H\x07\x88\x01\x01\x12\x1b\n\x0elink_state_vpn\x18\t \x01(\x08H\x08\x88\x01\x01\x12\x11\n\x04\x65vpn\x18\n \x01(\x08H\t\x88\x01\x01\x12\'\n\x1a\x65xtended_next_hop_encoding\x18\x0b \x01(\x08H\n\x88\x01\x01\x12\x1f\n\x12ipv4_multicast_vpn\x18\x0c \x01(\x08H\x0b\x88\x01\x01\x12\x1a\n\ripv4_mpls_vpn\x18\r \x01(\x08H\x0c\x88\x01\x01\x12\x15\n\x08ipv4_mdt\x18\x0e \x01(\x08H\r\x88\x01\x01\x12$\n\x17ipv4_multicast_mpls_vpn\x18\x0f \x01(\x08H\x0e\x88\x01\x01\x12#\n\x16ipv4_unicast_flow_spec\x18\x10 \x01(\x08H\x0f\x88\x01\x01\x12\x1e\n\x11ipv4_sr_te_policy\x18\x11 \x01(\x08H\x10\x88\x01\x01\x12\"\n\x15ipv4_unicast_add_path\x18\x12 \x01(\x08H\x11\x88\x01\x01\x12\x1f\n\x12ipv6_multicast_vpn\x18\x13 \x01(\x08H\x12\x88\x01\x01\x12\x1a\n\ripv6_mpls_vpn\x18\x14 \x01(\x08H\x13\x88\x01\x01\x12\x15\n\x08ipv6_mdt\x18\x15 \x01(\x08H\x14\x88\x01\x01\x12$\n\x17ipv6_multicast_mpls_vpn\x18\x16 \x01(\x08H\x15\x88\x01\x01\x12#\n\x16ipv6_unicast_flow_spec\x18\x17 \x01(\x08H\x16\x88\x01\x01\x12\x1e\n\x11ipv6_sr_te_policy\x18\x18 \x01(\x08H\x17\x88\x01\x01\x12\"\n\x15ipv6_unicast_add_path\x18\x19 \x01(\x08H\x18\x88\x01\x01\x42\x0f\n\r_ipv4_unicastB\x11\n\x0f_ipv4_multicastB\x0f\n\r_ipv6_unicastB\x11\n\x0f_ipv6_multicastB\x07\n\x05_vplsB\x10\n\x0e_route_refreshB\x13\n\x11_route_constraintB\x15\n\x13_link_state_non_vpnB\x11\n\x0f_link_state_vpnB\x07\n\x05_evpnB\x1d\n\x1b_extended_next_hop_encodingB\x15\n\x13_ipv4_multicast_vpnB\x10\n\x0e_ipv4_mpls_vpnB\x0b\n\t_ipv4_mdtB\x1a\n\x18_ipv4_multicast_mpls_vpnB\x19\n\x17_ipv4_unicast_flow_specB\x14\n\x12_ipv4_sr_te_policyB\x18\n\x16_ipv4_unicast_add_pathB\x15\n\x13_ipv6_multicast_vpnB\x10\n\x0e_ipv6_mpls_vpnB\x0b\n\t_ipv6_mdtB\x1a\n\x18_ipv6_multicast_mpls_vpnB\x19\n\x17_ipv6_unicast_flow_specB\x14\n\x12_ipv6_sr_te_policyB\x18\n\x16_ipv6_unicast_add_path\"\x91\x01\n\x1b\x42gpLearnedInformationFilter\x12 \n\x13unicast_ipv4_prefix\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12 \n\x13unicast_ipv6_prefix\x18\x02 \x01(\x08H\x01\x88\x01\x01\x42\x16\n\x14_unicast_ipv4_prefixB\x16\n\x14_unicast_ipv6_prefix\"\x94\x06\n\x0f\x42gpV4RouteRange\x12&\n\taddresses\x18\x01 \x03(\x0b\x32\x13.otg.V4RouteAddress\x12\x41\n\rnext_hop_mode\x18\x02 \x01(\x0e\x32%.otg.BgpV4RouteRange.NextHopMode.EnumH\x00\x88\x01\x01\x12P\n\x15next_hop_address_type\x18\x03 \x01(\x0e\x32,.otg.BgpV4RouteRange.NextHopAddressType.EnumH\x01\x88\x01\x01\x12\"\n\x15next_hop_ipv4_address\x18\x04 \x01(\tH\x02\x88\x01\x01\x12\"\n\x15next_hop_ipv6_address\x18\x05 \x01(\tH\x03\x88\x01\x01\x12\'\n\x08\x61\x64vanced\x18\x06 \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12&\n\x0b\x63ommunities\x18\x07 \x03(\x0b\x32\x11.otg.BgpCommunity\x12\x1f\n\x07\x61s_path\x18\x08 \x01(\x0b\x32\x0e.otg.BgpAsPath\x12!\n\x08\x61\x64\x64_path\x18\t \x01(\x0b\x32\x0f.otg.BgpAddPath\x12\x11\n\x04name\x18\n \x01(\tH\x04\x88\x01\x01\x12-\n\x0f\x65xt_communities\x18\x0b \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12\x37\n\x14\x65xtended_communities\x18\x0c \x03(\x0b\x32\x19.otg.BgpExtendedCommunity\x1a@\n\x0bNextHopMode\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08local_ip\x10\x01\x12\n\n\x06manual\x10\x02\x1a\x41\n\x12NextHopAddressType\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x42\x10\n\x0e_next_hop_modeB\x18\n\x16_next_hop_address_typeB\x18\n\x16_next_hop_ipv4_addressB\x18\n\x16_next_hop_ipv6_addressB\x07\n\x05_name\".\n\nBgpAddPath\x12\x14\n\x07path_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\n\n\x08_path_id\"\xf3\x06\n\x14\x42gpExtendedCommunity\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.BgpExtendedCommunity.Choice.EnumH\x00\x88\x01\x01\x12R\n\x19transitive_2octet_as_type\x18\x02 \x01(\x0b\x32/.otg.BgpExtendedCommunityTransitive2OctetAsType\x12X\n\x1ctransitive_ipv4_address_type\x18\x03 \x01(\x0b\x32\x32.otg.BgpExtendedCommunityTransitiveIpv4AddressType\x12R\n\x19transitive_4octet_as_type\x18\x04 \x01(\x0b\x32/.otg.BgpExtendedCommunityTransitive4OctetAsType\x12M\n\x16transitive_opaque_type\x18\x05 \x01(\x0b\x32-.otg.BgpExtendedCommunityTransitiveOpaqueType\x12I\n\x14transitive_evpn_type\x18\x06 \x01(\x0b\x32+.otg.BgpExtendedCommunityTransitiveEvpnType\x12Y\n\x1dnon_transitive_2octet_as_type\x18\x07 \x01(\x0b\x32\x32.otg.BgpExtendedCommunityNonTransitive2OctetAsType\x12\x33\n\x06\x63ustom\x18\x08 \x01(\x0b\x32#.otg.BgpExtendedCommunityCustomType\x1a\xe7\x01\n\x06\x43hoice\"\xdc\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1d\n\x19transitive_2octet_as_type\x10\x01\x12 \n\x1ctransitive_ipv4_address_type\x10\x02\x12\x1d\n\x19transitive_4octet_as_type\x10\x03\x12\x1a\n\x16transitive_opaque_type\x10\x04\x12\x18\n\x14transitive_evpn_type\x10\x05\x12!\n\x1dnon_transitive_2octet_as_type\x10\x06\x12\n\n\x06\x63ustom\x10\x07\x42\t\n\x07_choice\"\x9f\x01\n5BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget\x12\x1c\n\x0fglobal_2byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_4byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_2byte_asB\x14\n\x12_local_4byte_admin\"\x9f\x01\n5BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin\x12\x1c\n\x0fglobal_2byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_4byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_2byte_asB\x14\n\x12_local_4byte_admin\"\x94\x03\n*BgpExtendedCommunityTransitive2OctetAsType\x12P\n\x06\x63hoice\x18\x01 \x01(\x0e\x32;.otg.BgpExtendedCommunityTransitive2OctetAsType.Choice.EnumH\x00\x88\x01\x01\x12X\n\x14route_target_subtype\x18\x02 \x01(\x0b\x32:.otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget\x12X\n\x14route_origin_subtype\x18\x03 \x01(\x0b\x32:.otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin\x1aU\n\x06\x43hoice\"K\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x18\n\x14route_target_subtype\x10\x01\x12\x18\n\x14route_origin_subtype\x10\x02\x42\t\n\x07_choice\"\xa6\x01\n8BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin\x12\x1e\n\x11global_ipv4_admin\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x14\n\x12_global_ipv4_adminB\x14\n\x12_local_2byte_admin\"\xa6\x01\n8BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget\x12\x1e\n\x11global_ipv4_admin\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x14\n\x12_global_ipv4_adminB\x14\n\x12_local_2byte_admin\"\xa0\x03\n-BgpExtendedCommunityTransitiveIpv4AddressType\x12S\n\x06\x63hoice\x18\x01 \x01(\x0e\x32>.otg.BgpExtendedCommunityTransitiveIpv4AddressType.Choice.EnumH\x00\x88\x01\x01\x12[\n\x14route_target_subtype\x18\x02 \x01(\x0b\x32=.otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget\x12[\n\x14route_origin_subtype\x18\x03 \x01(\x0b\x32=.otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin\x1aU\n\x06\x43hoice\"K\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x18\n\x14route_target_subtype\x10\x01\x12\x18\n\x14route_origin_subtype\x10\x02\x42\t\n\x07_choice\"\x9f\x01\n5BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget\x12\x1c\n\x0fglobal_4byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_4byte_asB\x14\n\x12_local_2byte_admin\"\x9f\x01\n5BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin\x12\x1c\n\x0fglobal_4byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_4byte_asB\x14\n\x12_local_2byte_admin\"\x94\x03\n*BgpExtendedCommunityTransitive4OctetAsType\x12P\n\x06\x63hoice\x18\x01 \x01(\x0e\x32;.otg.BgpExtendedCommunityTransitive4OctetAsType.Choice.EnumH\x00\x88\x01\x01\x12X\n\x14route_target_subtype\x18\x02 \x01(\x0b\x32:.otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget\x12X\n\x14route_origin_subtype\x18\x03 \x01(\x0b\x32:.otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin\x1aU\n\x06\x43hoice\"K\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x18\n\x14route_target_subtype\x10\x01\x12\x18\n\x14route_origin_subtype\x10\x02\x42\t\n\x07_choice\"k\n-BgpExtendedCommunityTransitiveOpaqueTypeColor\x12\x12\n\x05\x66lags\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x12\n\x05\x63olor\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x08\n\x06_flagsB\x08\n\x06_color\"\x85\x01\n5BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation\x12\x15\n\x08reserved\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x18\n\x0btunnel_type\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x0b\n\t_reservedB\x0e\n\x0c_tunnel_type\"\xfc\x02\n(BgpExtendedCommunityTransitiveOpaqueType\x12N\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x39.otg.BgpExtendedCommunityTransitiveOpaqueType.Choice.EnumH\x00\x88\x01\x01\x12I\n\rcolor_subtype\x18\x02 \x01(\x0b\x32\x32.otg.BgpExtendedCommunityTransitiveOpaqueTypeColor\x12Y\n\x15\x65ncapsulation_subtype\x18\x03 \x01(\x0b\x32:.otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation\x1aO\n\x06\x43hoice\"E\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rcolor_subtype\x10\x01\x12\x19\n\x15\x65ncapsulation_subtype\x10\x02\x42\t\n\x07_choice\"Y\n/BgpExtendedCommunityTransitiveEvpnTypeRouterMac\x12\x17\n\nrouter_mac\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\r\n\x0b_router_mac\"\x8e\x02\n&BgpExtendedCommunityTransitiveEvpnType\x12L\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x37.otg.BgpExtendedCommunityTransitiveEvpnType.Choice.EnumH\x00\x88\x01\x01\x12P\n\x12router_mac_subtype\x18\x02 \x01(\x0b\x32\x34.otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac\x1a\x39\n\x06\x43hoice\"/\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x16\n\x12router_mac_subtype\x10\x01\x42\t\n\x07_choice\"\x94\x01\n:BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth\x12\x1c\n\x0fglobal_2byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tbandwidth\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\x12\n\x10_global_2byte_asB\x0c\n\n_bandwidth\"\xaf\x02\n-BgpExtendedCommunityNonTransitive2OctetAsType\x12S\n\x06\x63hoice\x18\x01 \x01(\x0e\x32>.otg.BgpExtendedCommunityNonTransitive2OctetAsType.Choice.EnumH\x00\x88\x01\x01\x12_\n\x16link_bandwidth_subtype\x18\x02 \x01(\x0b\x32?.otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth\x1a=\n\x06\x43hoice\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1a\n\x16link_bandwidth_subtype\x10\x01\x42\t\n\x07_choice\"\xa4\x01\n\x1e\x42gpExtendedCommunityCustomType\x12\x1b\n\x0e\x63ommunity_type\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11\x63ommunity_subtype\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x11\n\x0f_community_typeB\x14\n\x12_community_subtypeB\x08\n\x06_value\"\x94\x06\n\x0f\x42gpV6RouteRange\x12&\n\taddresses\x18\x01 \x03(\x0b\x32\x13.otg.V6RouteAddress\x12\x41\n\rnext_hop_mode\x18\x02 \x01(\x0e\x32%.otg.BgpV6RouteRange.NextHopMode.EnumH\x00\x88\x01\x01\x12P\n\x15next_hop_address_type\x18\x03 \x01(\x0e\x32,.otg.BgpV6RouteRange.NextHopAddressType.EnumH\x01\x88\x01\x01\x12\"\n\x15next_hop_ipv4_address\x18\x04 \x01(\tH\x02\x88\x01\x01\x12\"\n\x15next_hop_ipv6_address\x18\x05 \x01(\tH\x03\x88\x01\x01\x12\'\n\x08\x61\x64vanced\x18\x06 \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12&\n\x0b\x63ommunities\x18\x07 \x03(\x0b\x32\x11.otg.BgpCommunity\x12\x1f\n\x07\x61s_path\x18\x08 \x01(\x0b\x32\x0e.otg.BgpAsPath\x12!\n\x08\x61\x64\x64_path\x18\t \x01(\x0b\x32\x0f.otg.BgpAddPath\x12\x11\n\x04name\x18\n \x01(\tH\x04\x88\x01\x01\x12-\n\x0f\x65xt_communities\x18\x0b \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12\x37\n\x14\x65xtended_communities\x18\x0c \x03(\x0b\x32\x19.otg.BgpExtendedCommunity\x1a@\n\x0bNextHopMode\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08local_ip\x10\x01\x12\n\n\x06manual\x10\x02\x1a\x41\n\x12NextHopAddressType\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x42\x10\n\x0e_next_hop_modeB\x18\n\x16_next_hop_address_typeB\x18\n\x16_next_hop_ipv4_addressB\x18\n\x16_next_hop_ipv6_addressB\x07\n\x05_name\"\xfb\x06\n\x0f\x42gpSrteV4Policy\x12\x1a\n\rdistinguisher\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x12\n\x05\x63olor\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1a\n\ripv4_endpoint\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x41\n\rnext_hop_mode\x18\x04 \x01(\x0e\x32%.otg.BgpSrteV4Policy.NextHopMode.EnumH\x03\x88\x01\x01\x12P\n\x15next_hop_address_type\x18\x05 \x01(\x0e\x32,.otg.BgpSrteV4Policy.NextHopAddressType.EnumH\x04\x88\x01\x01\x12\"\n\x15next_hop_ipv4_address\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\"\n\x15next_hop_ipv6_address\x18\x07 \x01(\tH\x06\x88\x01\x01\x12\'\n\x08\x61\x64vanced\x18\x08 \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12!\n\x08\x61\x64\x64_path\x18\t \x01(\x0b\x32\x0f.otg.BgpAddPath\x12\x1f\n\x07\x61s_path\x18\n \x01(\x0b\x32\x0e.otg.BgpAsPath\x12&\n\x0b\x63ommunities\x18\x0b \x03(\x0b\x32\x11.otg.BgpCommunity\x12-\n\x0f\x65xt_communities\x18\x0c \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12,\n\x0btunnel_tlvs\x18\r \x03(\x0b\x32\x17.otg.BgpSrteV4TunnelTlv\x12\x11\n\x04name\x18\x0e \x01(\tH\x07\x88\x01\x01\x12\x13\n\x06\x61\x63tive\x18\x0f \x01(\x08H\x08\x88\x01\x01\x1a@\n\x0bNextHopMode\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08local_ip\x10\x01\x12\n\n\x06manual\x10\x02\x1a\x41\n\x12NextHopAddressType\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x42\x10\n\x0e_distinguisherB\x08\n\x06_colorB\x10\n\x0e_ipv4_endpointB\x10\n\x0e_next_hop_modeB\x18\n\x16_next_hop_address_typeB\x18\n\x16_next_hop_ipv4_addressB\x18\n\x16_next_hop_ipv6_addressB\x07\n\x05_nameB\t\n\x07_active\"\xb6\x04\n\x12\x42gpSrteV4TunnelTlv\x12\x41\n\x17remote_endpoint_sub_tlv\x18\x01 \x01(\x0b\x32 .otg.BgpSrteRemoteEndpointSubTlv\x12.\n\rcolor_sub_tlv\x18\x02 \x01(\x0b\x32\x17.otg.BgpSrteColorSubTlv\x12\x32\n\x0f\x62inding_sub_tlv\x18\x03 \x01(\x0b\x32\x19.otg.BgpSrteBindingSubTlv\x12\x38\n\x12preference_sub_tlv\x18\x04 \x01(\x0b\x32\x1c.otg.BgpSrtePreferenceSubTlv\x12\x41\n\x17policy_priority_sub_tlv\x18\x05 \x01(\x0b\x32 .otg.BgpSrtePolicyPrioritySubTlv\x12\x39\n\x13policy_name_sub_tlv\x18\x06 \x01(\x0b\x32\x1c.otg.BgpSrtePolicyNameSubTlv\x12U\n\"explicit_null_label_policy_sub_tlv\x18\x07 \x01(\x0b\x32).otg.BgpSrteExplicitNullLabelPolicySubTlv\x12.\n\rsegment_lists\x18\x08 \x03(\x0b\x32\x17.otg.BgpSrteSegmentList\x12\x11\n\x04name\x18\t \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06\x61\x63tive\x18\n \x01(\x08H\x01\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_active\"\xbe\x02\n\x1b\x42gpSrteRemoteEndpointSubTlv\x12\x16\n\tas_number\x18\x01 \x01(\rH\x00\x88\x01\x01\x12P\n\x0e\x61\x64\x64ress_family\x18\x02 \x01(\x0e\x32\x33.otg.BgpSrteRemoteEndpointSubTlv.AddressFamily.EnumH\x01\x88\x01\x01\x12\x19\n\x0cipv4_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x19\n\x0cipv6_address\x18\x04 \x01(\tH\x03\x88\x01\x01\x1a<\n\rAddressFamily\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x42\x0c\n\n_as_numberB\x11\n\x0f_address_familyB\x0f\n\r_ipv4_addressB\x0f\n\r_ipv6_address\"2\n\x12\x42gpSrteColorSubTlv\x12\x12\n\x05\x63olor\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_color\"\xea\x02\n\x14\x42gpSrteBindingSubTlv\x12L\n\x10\x62inding_sid_type\x18\x01 \x01(\x0e\x32-.otg.BgpSrteBindingSubTlv.BindingSidType.EnumH\x00\x88\x01\x01\x12\x1b\n\x0e\x66our_octet_sid\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x15\n\x08ipv6_sid\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x13\n\x06s_flag\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x13\n\x06i_flag\x18\x05 \x01(\x08H\x04\x88\x01\x01\x1a[\n\x0e\x42indingSidType\"I\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0e\n\nno_binding\x10\x01\x12\x12\n\x0e\x66our_octet_sid\x10\x02\x12\x0c\n\x08ipv6_sid\x10\x03\x42\x13\n\x11_binding_sid_typeB\x11\n\x0f_four_octet_sidB\x0b\n\t_ipv6_sidB\t\n\x07_s_flagB\t\n\x07_i_flag\"A\n\x17\x42gpSrtePreferenceSubTlv\x12\x17\n\npreference\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\r\n\x0b_preference\"O\n\x1b\x42gpSrtePolicyPrioritySubTlv\x12\x1c\n\x0fpolicy_priority\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x12\n\x10_policy_priority\"C\n\x17\x42gpSrtePolicyNameSubTlv\x12\x18\n\x0bpolicy_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0e\n\x0c_policy_name\"\xd6\x02\n$BgpSrteExplicitNullLabelPolicySubTlv\x12o\n\x1a\x65xplicit_null_label_policy\x18\x01 \x01(\x0e\x32\x46.otg.BgpSrteExplicitNullLabelPolicySubTlv.ExplicitNullLabelPolicy.EnumH\x00\x88\x01\x01\x1a\x9d\x01\n\x17\x45xplicitNullLabelPolicy\"\x81\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rreserved_enlp\x10\x01\x12\x12\n\x0epush_ipv4_enlp\x10\x02\x12\x12\n\x0epush_ipv6_enlp\x10\x03\x12\x17\n\x13push_ipv4_ipv6_enlp\x10\x04\x12\x14\n\x10\x64o_not_push_enlp\x10\x05\x42\x1d\n\x1b_explicit_null_label_policy\"\x97\x01\n\x12\x42gpSrteSegmentList\x12\x13\n\x06weight\x18\x01 \x01(\rH\x00\x88\x01\x01\x12%\n\x08segments\x18\x02 \x03(\x0b\x32\x13.otg.BgpSrteSegment\x12\x11\n\x04name\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x13\n\x06\x61\x63tive\x18\x04 \x01(\x08H\x02\x88\x01\x01\x42\t\n\x07_weightB\x07\n\x05_nameB\t\n\x07_active\"\xdc\x06\n\x0e\x42gpSrteSegment\x12?\n\x0csegment_type\x18\x01 \x01(\x0e\x32$.otg.BgpSrteSegment.SegmentType.EnumH\x00\x88\x01\x01\x12.\n\x06type_a\x18\x02 \x01(\x0b\x32\x1e.otg.BgpSrteSegmentATypeSubTlv\x12.\n\x06type_b\x18\x03 \x01(\x0b\x32\x1e.otg.BgpSrteSegmentBTypeSubTlv\x12.\n\x06type_c\x18\x04 \x01(\x0b\x32\x1e.otg.BgpSrteSegmentCTypeSubTlv\x12.\n\x06type_d\x18\x05 \x01(\x0b\x32\x1e.otg.BgpSrteSegmentDTypeSubTlv\x12.\n\x06type_e\x18\x06 \x01(\x0b\x32\x1e.otg.BgpSrteSegmentETypeSubTlv\x12.\n\x06type_f\x18\x07 \x01(\x0b\x32\x1e.otg.BgpSrteSegmentFTypeSubTlv\x12.\n\x06type_g\x18\x08 \x01(\x0b\x32\x1e.otg.BgpSrteSegmentGTypeSubTlv\x12.\n\x06type_h\x18\t \x01(\x0b\x32\x1e.otg.BgpSrteSegmentHTypeSubTlv\x12.\n\x06type_i\x18\n \x01(\x0b\x32\x1e.otg.BgpSrteSegmentITypeSubTlv\x12.\n\x06type_j\x18\x0b \x01(\x0b\x32\x1e.otg.BgpSrteSegmentJTypeSubTlv\x12.\n\x06type_k\x18\x0c \x01(\x0b\x32\x1e.otg.BgpSrteSegmentKTypeSubTlv\x12\x11\n\x04name\x18\r \x01(\tH\x01\x88\x01\x01\x12\x13\n\x06\x61\x63tive\x18\x0e \x01(\x08H\x02\x88\x01\x01\x1a\xab\x01\n\x0bSegmentType\"\x9b\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06type_a\x10\x01\x12\n\n\x06type_b\x10\x02\x12\n\n\x06type_c\x10\x03\x12\n\n\x06type_d\x10\x04\x12\n\n\x06type_e\x10\x05\x12\n\n\x06type_f\x10\x06\x12\n\n\x06type_g\x10\x07\x12\n\n\x06type_h\x10\x08\x12\n\n\x06type_i\x10\t\x12\n\n\x06type_j\x10\n\x12\n\n\x06type_k\x10\x0b\x42\x0f\n\r_segment_typeB\x07\n\x05_nameB\t\n\x07_active\"\x80\x01\n\x10\x42gpSrteSrMplsSid\x12\x12\n\x05label\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x0f\n\x02tc\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05s_bit\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x10\n\x03ttl\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x08\n\x06_labelB\x05\n\x03_tcB\x08\n\x06_s_bitB\x06\n\x04_ttl\"\xca\x01\n*BgpSrteSRv6SIDEndpointBehaviorAndStructure\x12\x16\n\tlb_length\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tln_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x18\n\x0b\x66unc_length\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x17\n\narg_length\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x0c\n\n_lb_lengthB\x0c\n\n_ln_lengthB\x0e\n\x0c_func_lengthB\r\n\x0b_arg_length\"\xa7\x01\n\x19\x42gpSrteSegmentATypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x12\n\x05label\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0f\n\x02tc\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x12\n\x05s_bit\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x10\n\x03ttl\x18\x05 \x01(\rH\x04\x88\x01\x01\x42\x08\n\x06_flagsB\x08\n\x06_labelB\x05\n\x03_tcB\x08\n\x06_s_bitB\x06\n\x04_ttl\"\xb2\x01\n\x19\x42gpSrteSegmentBTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08srv6_sid\x18\x02 \x01(\tH\x01\x88\x01\x01\x12S\n\x1asrv6_sid_endpoint_behavior\x18\x03 \x01(\x0b\x32/.otg.BgpSrteSRv6SIDEndpointBehaviorAndStructureB\x08\n\x06_flagsB\x0b\n\t_srv6_sid\"\xc7\x01\n\x19\x42gpSrteSegmentCTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1e\n\x11ipv4_node_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12*\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x15.otg.BgpSrteSrMplsSidB\x08\n\x06_flagsB\x0f\n\r_sr_algorithmB\x14\n\x12_ipv4_node_address\"\xc7\x01\n\x19\x42gpSrteSegmentDTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1e\n\x11ipv6_node_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12*\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x15.otg.BgpSrteSrMplsSidB\x08\n\x06_flagsB\x0f\n\r_sr_algorithmB\x14\n\x12_ipv6_node_address\"\xd3\x01\n\x19\x42gpSrteSegmentETypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12local_interface_id\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1e\n\x11ipv4_node_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12*\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x15.otg.BgpSrteSrMplsSidB\x08\n\x06_flagsB\x15\n\x13_local_interface_idB\x14\n\x12_ipv4_node_address\"\xd7\x01\n\x19\x42gpSrteSegmentFTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12local_ipv4_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12 \n\x13remote_ipv4_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12*\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x15.otg.BgpSrteSrMplsSidB\x08\n\x06_flagsB\x15\n\x13_local_ipv4_addressB\x16\n\x14_remote_ipv4_address\"\xdd\x02\n\x19\x42gpSrteSegmentGTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12local_interface_id\x18\x02 \x01(\rH\x01\x88\x01\x01\x12$\n\x17local_ipv6_node_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12 \n\x13remote_interface_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x12%\n\x18remote_ipv6_node_address\x18\x05 \x01(\tH\x04\x88\x01\x01\x12*\n\x0bsr_mpls_sid\x18\x06 \x01(\x0b\x32\x15.otg.BgpSrteSrMplsSidB\x08\n\x06_flagsB\x15\n\x13_local_interface_idB\x1a\n\x18_local_ipv6_node_addressB\x16\n\x14_remote_interface_idB\x1b\n\x19_remote_ipv6_node_address\"\xd7\x01\n\x19\x42gpSrteSegmentHTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12local_ipv6_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12 \n\x13remote_ipv6_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12*\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x15.otg.BgpSrteSrMplsSidB\x08\n\x06_flagsB\x15\n\x13_local_ipv6_addressB\x16\n\x14_remote_ipv6_address\"\xe8\x01\n\x19\x42gpSrteSegmentITypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11ipv6_node_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08srv6_sid\x18\x03 \x01(\tH\x02\x88\x01\x01\x12S\n\x1asrv6_sid_endpoint_behavior\x18\x04 \x01(\x0b\x32/.otg.BgpSrteSRv6SIDEndpointBehaviorAndStructureB\x08\n\x06_flagsB\x14\n\x12_ipv6_node_addressB\x0b\n\t_srv6_sid\"\xd6\x03\n\x19\x42gpSrteSegmentJTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1f\n\x12local_interface_id\x18\x03 \x01(\rH\x02\x88\x01\x01\x12$\n\x17local_ipv6_node_address\x18\x04 \x01(\tH\x03\x88\x01\x01\x12 \n\x13remote_interface_id\x18\x05 \x01(\rH\x04\x88\x01\x01\x12%\n\x18remote_ipv6_node_address\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\x15\n\x08srv6_sid\x18\x07 \x01(\tH\x06\x88\x01\x01\x12S\n\x1asrv6_sid_endpoint_behavior\x18\x08 \x01(\x0b\x32/.otg.BgpSrteSRv6SIDEndpointBehaviorAndStructureB\x08\n\x06_flagsB\x0f\n\r_sr_algorithmB\x15\n\x13_local_interface_idB\x1a\n\x18_local_ipv6_node_addressB\x16\n\x14_remote_interface_idB\x1b\n\x19_remote_ipv6_node_addressB\x0b\n\t_srv6_sid\"\xd0\x02\n\x19\x42gpSrteSegmentKTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1f\n\x12local_ipv6_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12 \n\x13remote_ipv6_address\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x15\n\x08srv6_sid\x18\x05 \x01(\tH\x04\x88\x01\x01\x12S\n\x1asrv6_sid_endpoint_behavior\x18\x06 \x01(\x0b\x32/.otg.BgpSrteSRv6SIDEndpointBehaviorAndStructureB\x08\n\x06_flagsB\x0f\n\r_sr_algorithmB\x15\n\x13_local_ipv6_addressB\x16\n\x14_remote_ipv6_addressB\x0b\n\t_srv6_sid\"\xfa\x06\n\x0f\x42gpSrteV6Policy\x12\x1a\n\rdistinguisher\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x12\n\x05\x63olor\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1a\n\ripv6_endpoint\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x41\n\rnext_hop_mode\x18\x04 \x01(\x0e\x32%.otg.BgpSrteV6Policy.NextHopMode.EnumH\x03\x88\x01\x01\x12P\n\x15next_hop_address_type\x18\x05 \x01(\x0e\x32,.otg.BgpSrteV6Policy.NextHopAddressType.EnumH\x04\x88\x01\x01\x12\"\n\x15next_hop_ipv4_address\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\"\n\x15next_hop_ipv6_address\x18\x07 \x01(\tH\x06\x88\x01\x01\x12\'\n\x08\x61\x64vanced\x18\x08 \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12!\n\x08\x61\x64\x64_path\x18\t \x01(\x0b\x32\x0f.otg.BgpAddPath\x12\x1f\n\x07\x61s_path\x18\n \x01(\x0b\x32\x0e.otg.BgpAsPath\x12&\n\x0b\x63ommunities\x18\x0b \x03(\x0b\x32\x11.otg.BgpCommunity\x12,\n\x0e\x65xtcommunities\x18\x0c \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12,\n\x0btunnel_tlvs\x18\r \x03(\x0b\x32\x17.otg.BgpSrteV6TunnelTlv\x12\x11\n\x04name\x18\x0e \x01(\tH\x07\x88\x01\x01\x12\x13\n\x06\x61\x63tive\x18\x0f \x01(\x08H\x08\x88\x01\x01\x1a@\n\x0bNextHopMode\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08local_ip\x10\x01\x12\n\n\x06manual\x10\x02\x1a\x41\n\x12NextHopAddressType\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x42\x10\n\x0e_distinguisherB\x08\n\x06_colorB\x10\n\x0e_ipv6_endpointB\x10\n\x0e_next_hop_modeB\x18\n\x16_next_hop_address_typeB\x18\n\x16_next_hop_ipv4_addressB\x18\n\x16_next_hop_ipv6_addressB\x07\n\x05_nameB\t\n\x07_active\"\xb6\x04\n\x12\x42gpSrteV6TunnelTlv\x12\x41\n\x17remote_endpoint_sub_tlv\x18\x01 \x01(\x0b\x32 .otg.BgpSrteRemoteEndpointSubTlv\x12.\n\rcolor_sub_tlv\x18\x02 \x01(\x0b\x32\x17.otg.BgpSrteColorSubTlv\x12\x32\n\x0f\x62inding_sub_tlv\x18\x03 \x01(\x0b\x32\x19.otg.BgpSrteBindingSubTlv\x12\x38\n\x12preference_sub_tlv\x18\x04 \x01(\x0b\x32\x1c.otg.BgpSrtePreferenceSubTlv\x12\x41\n\x17policy_priority_sub_tlv\x18\x05 \x01(\x0b\x32 .otg.BgpSrtePolicyPrioritySubTlv\x12\x39\n\x13policy_name_sub_tlv\x18\x06 \x01(\x0b\x32\x1c.otg.BgpSrtePolicyNameSubTlv\x12U\n\"explicit_null_label_policy_sub_tlv\x18\x07 \x01(\x0b\x32).otg.BgpSrteExplicitNullLabelPolicySubTlv\x12.\n\rsegment_lists\x18\x08 \x03(\x0b\x32\x17.otg.BgpSrteSegmentList\x12\x11\n\x04name\x18\t \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06\x61\x63tive\x18\n \x01(\x08H\x01\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_active\"\xb8\x01\n\x12\x42gpGracefulRestart\x12\x16\n\tenable_gr\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x19\n\x0crestart_time\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x18\n\x0b\x65nable_llgr\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x17\n\nstale_time\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x0c\n\n_enable_grB\x0f\n\r_restart_timeB\x0e\n\x0c_enable_llgrB\r\n\x0b_stale_time\"\xf0\x01\n\x0f\x42gpUpdateReplay\x12\x35\n\x06\x63hoice\x18\x01 \x01(\x0e\x32 .otg.BgpUpdateReplay.Choice.EnumH\x00\x88\x01\x01\x12/\n\x0fstructured_pdus\x18\x02 \x01(\x0b\x32\x16.otg.BgpStructuredPdus\x12#\n\traw_bytes\x18\x03 \x01(\x0b\x32\x10.otg.BgpRawBytes\x1a\x45\n\x06\x43hoice\";\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x13\n\x0fstructured_pdus\x10\x01\x12\r\n\traw_bytes\x10\x02\x42\t\n\x07_choice\"7\n\x0b\x42gpRawBytes\x12(\n\x07updates\x18\x01 \x03(\x0b\x32\x17.otg.BgpOneUpdateReplay\"d\n\x12\x42gpOneUpdateReplay\x12\x15\n\x08time_gap\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x19\n\x0cupdate_bytes\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x0b\n\t_time_gapB\x0f\n\r_update_bytes\"G\n\x11\x42gpStructuredPdus\x12\x32\n\x07updates\x18\x01 \x03(\x0b\x32!.otg.BgpOneStructuredUpdateReplay\"\xf7\x01\n\x1c\x42gpOneStructuredUpdateReplay\x12\x15\n\x08time_gap\x18\x01 \x01(\rH\x00\x88\x01\x01\x12+\n\x0fpath_attributes\x18\x02 \x01(\x0b\x32\x12.otg.BgpAttributes\x12\x43\n\x19traditional_unreach_nlris\x18\x03 \x03(\x0b\x32 .otg.BgpOneTraditionalNlriPrefix\x12\x41\n\x17traditional_reach_nlris\x18\x04 \x03(\x0b\x32 .otg.BgpOneTraditionalNlriPrefixB\x0b\n\t_time_gap\"\x8a\x01\n\x1b\x42gpOneTraditionalNlriPrefix\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06prefix\x18\x02 \x01(\rH\x01\x88\x01\x01\x12)\n\x07path_id\x18\x03 \x01(\x0b\x32\x18.otg.BgpNLRIPrefixPathIdB\n\n\x08_addressB\t\n\x07_prefix\"\x83\x01\n\x14\x42gpOneIpv4NLRIPrefix\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06prefix\x18\x02 \x01(\rH\x01\x88\x01\x01\x12)\n\x07path_id\x18\x03 \x01(\x0b\x32\x18.otg.BgpNLRIPrefixPathIdB\n\n\x08_addressB\t\n\x07_prefix\"\x83\x01\n\x14\x42gpOneIpv6NLRIPrefix\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06prefix\x18\x02 \x01(\rH\x01\x88\x01\x01\x12)\n\x07path_id\x18\x03 \x01(\x0b\x32\x18.otg.BgpNLRIPrefixPathIdB\n\n\x08_addressB\t\n\x07_prefix\"3\n\x13\x42gpNLRIPrefixPathId\x12\x12\n\x05value\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_value\"\x8b\x01\n\x19\x42gpIpv4SrPolicyNLRIPrefix\x12\x1a\n\rdistinguisher\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x12\n\x05\x63olor\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x15\n\x08\x65ndpoint\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x10\n\x0e_distinguisherB\x08\n\x06_colorB\x0b\n\t_endpoint\"\x8b\x01\n\x19\x42gpIpv6SrPolicyNLRIPrefix\x12\x1a\n\rdistinguisher\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x12\n\x05\x63olor\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x15\n\x08\x65ndpoint\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x10\n\x0e_distinguisherB\x08\n\x06_colorB\x0b\n\t_endpoint\"\xef\x07\n\rBgpAttributes\x12:\n\x10other_attributes\x18\x01 \x03(\x0b\x32 .otg.BgpAttributesOtherAttribute\x12\x33\n\x06origin\x18\x02 \x01(\x0e\x32\x1e.otg.BgpAttributes.Origin.EnumH\x00\x88\x01\x01\x12)\n\x07\x61s_path\x18\x03 \x01(\x0b\x32\x18.otg.BgpAttributesAsPath\x12+\n\x08\x61s4_path\x18\x04 \x01(\x0b\x32\x19.otg.BgpAttributesAs4Path\x12+\n\x08next_hop\x18\x05 \x01(\x0b\x32\x19.otg.BgpAttributesNextHop\x12J\n\x18multi_exit_discriminator\x18\x06 \x01(\x0b\x32(.otg.BgpAttributesMultiExitDiscriminator\x12;\n\x10local_preference\x18\x07 \x01(\x0b\x32!.otg.BgpAttributesLocalPreference\x12&\n\x19include_atomic_aggregator\x18\x08 \x01(\x08H\x01\x88\x01\x01\x12\x30\n\naggregator\x18\t \x01(\x0b\x32\x1c.otg.BgpAttributesAggregator\x12\x37\n\x0e\x61s4_aggregator\x18\n \x01(\x0b\x32\x1f.otg.BgpAttributesAs4Aggregator\x12.\n\tcommunity\x18\x0b \x03(\x0b\x32\x1b.otg.BgpAttributesCommunity\x12\x35\n\roriginator_id\x18\x0c \x01(\x0b\x32\x1e.otg.BgpAttributesOriginatorId\x12\x13\n\x0b\x63luster_ids\x18\r \x03(\t\x12\x37\n\x14\x65xtended_communities\x18\x0e \x03(\x0b\x32\x19.otg.BgpExtendedCommunity\x12\x43\n\x14tunnel_encapsulation\x18\x0f \x01(\x0b\x32%.otg.BgpAttributesTunnelEncapsulation\x12/\n\x08mp_reach\x18\x10 \x01(\x0b\x32\x1d.otg.BgpAttributesMpReachNlri\x12\x33\n\nmp_unreach\x18\x11 \x01(\x0b\x32\x1f.otg.BgpAttributesMpUnreachNlri\x1a\x43\n\x06Origin\"9\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03igp\x10\x01\x12\x07\n\x03\x65gp\x10\x02\x12\x0e\n\nincomplete\x10\x03\x42\t\n\x07_originB\x1c\n\x1a_include_atomic_aggregator\"\xa7\x02\n\x1b\x42gpAttributesOtherAttribute\x12\x1a\n\rflag_optional\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x1c\n\x0f\x66lag_transitive\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x19\n\x0c\x66lag_partial\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12!\n\x14\x66lag_extended_length\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x11\n\x04type\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x16\n\traw_value\x18\x06 \x01(\tH\x05\x88\x01\x01\x42\x10\n\x0e_flag_optionalB\x12\n\x10_flag_transitiveB\x0f\n\r_flag_partialB\x17\n\x15_flag_extended_lengthB\x07\n\x05_typeB\x0c\n\n_raw_value\"\xaf\x02\n\x13\x42gpAttributesAsPath\x12\x39\n\x06\x63hoice\x18\x01 \x01(\x0e\x32$.otg.BgpAttributesAsPath.Choice.EnumH\x00\x88\x01\x01\x12\x41\n\x11\x66our_byte_as_path\x18\x02 \x01(\x0b\x32&.otg.BgpAttributesAsPathFourByteAsPath\x12?\n\x10two_byte_as_path\x18\x03 \x01(\x0b\x32%.otg.BgpAttributesAsPathTwoByteAsPath\x1aN\n\x06\x43hoice\"D\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x15\n\x11\x66our_byte_as_path\x10\x01\x12\x14\n\x10two_byte_as_path\x10\x02\x42\t\n\x07_choice\"^\n!BgpAttributesAsPathFourByteAsPath\x12\x39\n\x08segments\x18\x01 \x03(\x0b\x32\'.otg.BgpAttributesFourByteAsPathSegment\"\xe6\x01\n\"BgpAttributesFourByteAsPathSegment\x12\x44\n\x04type\x18\x01 \x01(\x0e\x32\x31.otg.BgpAttributesFourByteAsPathSegment.Type.EnumH\x00\x88\x01\x01\x12\x12\n\nas_numbers\x18\x02 \x03(\r\x1a]\n\x04Type\"U\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x61s_seq\x10\x01\x12\n\n\x06\x61s_set\x10\x02\x12\x11\n\ras_confed_seq\x10\x03\x12\x11\n\ras_confed_set\x10\x04\x42\x07\n\x05_type\"\\\n BgpAttributesAsPathTwoByteAsPath\x12\x38\n\x08segments\x18\x01 \x03(\x0b\x32&.otg.BgpAttributesTwoByteAsPathSegment\"\xe4\x01\n!BgpAttributesTwoByteAsPathSegment\x12\x43\n\x04type\x18\x01 \x01(\x0e\x32\x30.otg.BgpAttributesTwoByteAsPathSegment.Type.EnumH\x00\x88\x01\x01\x12\x12\n\nas_numbers\x18\x02 \x03(\r\x1a]\n\x04Type\"U\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x61s_seq\x10\x01\x12\n\n\x06\x61s_set\x10\x02\x12\x11\n\ras_confed_seq\x10\x03\x12\x11\n\ras_confed_set\x10\x04\x42\x07\n\x05_type\"Q\n\x14\x42gpAttributesAs4Path\x12\x39\n\x08segments\x18\x01 \x03(\x0b\x32\'.otg.BgpAttributesFourByteAsPathSegment\"\xab\x02\n\x17\x42gpAttributesAggregator\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.BgpAttributesAggregator.Choice.EnumH\x00\x88\x01\x01\x12\x19\n\x0c\x66our_byte_as\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x18\n\x0btwo_byte_as\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x19\n\x0cipv4_address\x18\x04 \x01(\tH\x03\x88\x01\x01\x1a\x44\n\x06\x43hoice\":\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0c\x66our_byte_as\x10\x01\x12\x0f\n\x0btwo_byte_as\x10\x02\x42\t\n\x07_choiceB\x0f\n\r_four_byte_asB\x0e\n\x0c_two_byte_asB\x0f\n\r_ipv4_address\"h\n\x1a\x42gpAttributesAs4Aggregator\x12\x13\n\x06\x61s_num\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x19\n\x0cipv4_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\t\n\x07_as_numB\x0f\n\r_ipv4_address\"\xb1\x02\n\x16\x42gpAttributesCommunity\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.BgpAttributesCommunity.Choice.EnumH\x00\x88\x01\x01\x12;\n\x10\x63ustom_community\x18\x02 \x01(\x0b\x32!.otg.BgpAttributesCustomCommunity\x1a\x90\x01\n\x06\x43hoice\"\x85\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x14\n\x10\x63ustom_community\x10\x01\x12\r\n\tno_export\x10\x02\x12\x11\n\rno_advertised\x10\x03\x12\x17\n\x13no_export_subconfed\x10\x04\x12\x0e\n\nllgr_stale\x10\x05\x12\x0b\n\x07no_llgr\x10\x06\x42\t\n\x07_choice\"d\n\x1c\x42gpAttributesCustomCommunity\x12\x16\n\tas_number\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x0c\n\n_as_numberB\t\n\x07_custom\"\xab\x02\n\x14\x42gpAttributesNextHop\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.BgpAttributesNextHop.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04ipv4\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x11\n\x04ipv6\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x45\n\x12ipv6_two_addresses\x18\x04 \x01(\x0b\x32).otg.BgpAttributesNextHopIpv6TwoAddresses\x1aM\n\x06\x43hoice\"C\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x12\x16\n\x12ipv6_two_addresses\x10\x03\x42\t\n\x07_choiceB\x07\n\x05_ipv4B\x07\n\x05_ipv6\"d\n$BgpAttributesNextHopIpv6TwoAddresses\x12\x12\n\x05\x66irst\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06second\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x08\n\x06_firstB\t\n\x07_second\"\xcf\x03\n\x18\x42gpAttributesMpReachNlri\x12+\n\x08next_hop\x18\x01 \x01(\x0b\x32\x19.otg.BgpAttributesNextHop\x12>\n\x06\x63hoice\x18\x02 \x01(\x0e\x32).otg.BgpAttributesMpReachNlri.Choice.EnumH\x00\x88\x01\x01\x12/\n\x0cipv4_unicast\x18\x03 \x03(\x0b\x32\x19.otg.BgpOneIpv4NLRIPrefix\x12/\n\x0cipv6_unicast\x18\x04 \x03(\x0b\x32\x19.otg.BgpOneIpv6NLRIPrefix\x12\x35\n\ripv4_srpolicy\x18\x05 \x01(\x0b\x32\x1e.otg.BgpIpv4SrPolicyNLRIPrefix\x12\x35\n\ripv6_srpolicy\x18\x06 \x01(\x0b\x32\x1e.otg.BgpIpv6SrPolicyNLRIPrefix\x1ak\n\x06\x43hoice\"a\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0cipv4_unicast\x10\x01\x12\x10\n\x0cipv6_unicast\x10\x02\x12\x11\n\ripv4_srpolicy\x10\x03\x12\x11\n\ripv6_srpolicy\x10\x04\x42\t\n\x07_choice\"\xa6\x03\n\x1a\x42gpAttributesMpUnreachNlri\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.BgpAttributesMpUnreachNlri.Choice.EnumH\x00\x88\x01\x01\x12/\n\x0cipv4_unicast\x18\x02 \x03(\x0b\x32\x19.otg.BgpOneIpv4NLRIPrefix\x12/\n\x0cipv6_unicast\x18\x03 \x03(\x0b\x32\x19.otg.BgpOneIpv6NLRIPrefix\x12\x35\n\ripv4_srpolicy\x18\x04 \x01(\x0b\x32\x1e.otg.BgpIpv4SrPolicyNLRIPrefix\x12\x35\n\ripv6_srpolicy\x18\x05 \x01(\x0b\x32\x1e.otg.BgpIpv6SrPolicyNLRIPrefix\x1ak\n\x06\x43hoice\"a\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0cipv4_unicast\x10\x01\x12\x10\n\x0cipv6_unicast\x10\x02\x12\x11\n\ripv4_srpolicy\x10\x03\x12\x11\n\ripv6_srpolicy\x10\x04\x42\t\n\x07_choice\"C\n#BgpAttributesMultiExitDiscriminator\x12\x12\n\x05value\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_value\"<\n\x1c\x42gpAttributesLocalPreference\x12\x12\n\x05value\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_value\"9\n\x19\x42gpAttributesOriginatorId\x12\x12\n\x05value\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_value\"\xe2\x01\n BgpAttributesTunnelEncapsulation\x12\x46\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x31.otg.BgpAttributesTunnelEncapsulation.Choice.EnumH\x00\x88\x01\x01\x12\x39\n\tsr_policy\x18\x02 \x01(\x0b\x32&.otg.BgpAttributesSegmentRoutingPolicy\x1a\x30\n\x06\x43hoice\"&\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tsr_policy\x10\x01\x42\t\n\x07_choice\"\xac\x04\n!BgpAttributesSegmentRoutingPolicy\x12:\n\x1a\x62inding_segment_identifier\x18\x01 \x01(\x0b\x32\x16.otg.BgpAttributesBsid\x12\x43\n\x1fsrv6_binding_segment_identifier\x18\x02 \x03(\x0b\x32\x1a.otg.BgpAttributesSrv6Bsid\x12\x38\n\npreference\x18\x03 \x01(\x0b\x32$.otg.BgpAttributesSrPolicyPreference\x12\x34\n\x08priority\x18\x04 \x01(\x0b\x32\".otg.BgpAttributesSrPolicyPriority\x12\x39\n\x0bpolicy_name\x18\x05 \x01(\x0b\x32$.otg.BgpAttributesSrPolicyPolicyName\x12L\n\x15policy_candidate_name\x18\x06 \x01(\x0b\x32-.otg.BgpAttributesSrPolicyPolicyCandidateName\x12P\n\x1a\x65xplicit_null_label_policy\x18\x07 \x01(\x0b\x32,.otg.BgpAttributesSrPolicyExplicitNullPolicy\x12;\n\x0csegment_list\x18\x08 \x03(\x0b\x32%.otg.BgpAttributesSrPolicySegmentList\"\xe2\x01\n\x11\x42gpAttributesBsid\x12\x37\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\".otg.BgpAttributesBsid.Choice.EnumH\x00\x88\x01\x01\x12(\n\x04mpls\x18\x02 \x01(\x0b\x32\x1a.otg.BgpAttributesBsidMpls\x12(\n\x04srv6\x18\x03 \x01(\x0b\x32\x1a.otg.BgpAttributesBsidSrv6\x1a\x35\n\x06\x43hoice\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04mpls\x10\x01\x12\x08\n\x04srv6\x10\x02\x42\t\n\x07_choice\"\xc8\x01\n\x15\x42gpAttributesBsidMpls\x12%\n\x18\x66lag_specified_bsid_only\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12#\n\x16\x66lag_drop_upon_invalid\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12+\n\x08mpls_sid\x18\x03 \x01(\x0b\x32\x19.otg.BgpAttributesSidMplsB\x1b\n\x19_flag_specified_bsid_onlyB\x19\n\x17_flag_drop_upon_invalid\"\xc1\x01\n\x15\x42gpAttributesBsidSrv6\x12%\n\x18\x66lag_specified_bsid_only\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12#\n\x16\x66lag_drop_upon_invalid\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x16\n\tipv6_addr\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x1b\n\x19_flag_specified_bsid_onlyB\x19\n\x17_flag_drop_upon_invalidB\x0c\n\n_ipv6_addr\"\xf6\x02\n\x15\x42gpAttributesSrv6Bsid\x12%\n\x18\x66lag_specified_bsid_only\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12#\n\x16\x66lag_drop_upon_invalid\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12(\n\x1b\x66lag_srv6_endpoint_behavior\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x16\n\tipv6_addr\x18\x04 \x01(\tH\x03\x88\x01\x01\x12i\n\x16srv6_endpoint_behavior\x18\x05 \x01(\x0b\x32I.otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructureB\x1b\n\x19_flag_specified_bsid_onlyB\x19\n\x17_flag_drop_upon_invalidB\x1e\n\x1c_flag_srv6_endpoint_behaviorB\x0c\n\n_ipv6_addr\"\xa0\x01\n\x14\x42gpAttributesSidMpls\x12\x12\n\x05label\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1a\n\rtraffic_class\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x15\n\x08\x66lag_bos\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x10\n\x03ttl\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x08\n\x06_labelB\x10\n\x0e_traffic_classB\x0b\n\t_flag_bosB\x06\n\x04_ttl\".\n\x14\x42gpAttributesSidSrv6\x12\x0f\n\x02ip\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x05\n\x03_ip\"?\n\x1f\x42gpAttributesSrPolicyPreference\x12\x12\n\x05value\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_value\"=\n\x1d\x42gpAttributesSrPolicyPriority\x12\x12\n\x05value\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_value\"H\n(BgpAttributesSrPolicyPolicyCandidateName\x12\x12\n\x05value\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_value\"?\n\x1f\x42gpAttributesSrPolicyPolicyName\x12\x12\n\x05value\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_value\"\xf9\x01\n\'BgpAttributesSrPolicyExplicitNullPolicy\x12M\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x38.otg.BgpAttributesSrPolicyExplicitNullPolicy.Choice.EnumH\x00\x88\x01\x01\x1at\n\x06\x43hoice\"j\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07unknown\x10\x01\x12\r\n\tpush_ipv4\x10\x02\x12\r\n\tpush_ipv6\x10\x03\x12\x16\n\x12push_ipv4_and_ipv6\x10\x04\x12\x0e\n\ndonot_push\x10\x05\x42\t\n\x07_choice\"\xb7\x01\n BgpAttributesSrPolicySegmentList\x12G\n\x06weight\x18\x01 \x01(\x0b\x32\x37.otg.BgpAttributesSegmentRoutingPolicySegmentListWeight\x12J\n\x08segments\x18\x02 \x03(\x0b\x32\x38.otg.BgpAttributesSegmentRoutingPolicySegmentListSegment\"R\n2BgpAttributesSegmentRoutingPolicySegmentListWeight\x12\x12\n\x05value\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_value\"\xe3\x07\n3BgpAttributesSegmentRoutingPolicySegmentListSegment\x12Y\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x44.otg.BgpAttributesSegmentRoutingPolicySegmentListSegment.Choice.EnumH\x00\x88\x01\x01\x12;\n\x06type_a\x18\x02 \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeA\x12;\n\x06type_b\x18\x03 \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeB\x12;\n\x06type_c\x18\x04 \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeC\x12;\n\x06type_d\x18\x05 \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeD\x12;\n\x06type_e\x18\x06 \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeE\x12;\n\x06type_f\x18\x07 \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeF\x12;\n\x06type_g\x18\x08 \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeG\x12;\n\x06type_h\x18\t \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeH\x12;\n\x06type_i\x18\n \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeI\x12;\n\x06type_j\x18\x0b \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeJ\x12;\n\x06type_k\x18\x0c \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeK\x1a\xa6\x01\n\x06\x43hoice\"\x9b\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06type_a\x10\x01\x12\n\n\x06type_b\x10\x02\x12\n\n\x06type_c\x10\x03\x12\n\n\x06type_d\x10\x04\x12\n\n\x06type_e\x10\x05\x12\n\n\x06type_f\x10\x06\x12\n\n\x06type_g\x10\x07\x12\n\n\x06type_h\x10\x08\x12\n\n\x06type_i\x10\t\x12\n\n\x06type_j\x10\n\x12\n\n\x06type_k\x10\x0b\x42\t\n\x07_choice\"\x95\x01\n&BgpAttributesSegmentRoutingPolicyTypeA\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12+\n\x08mpls_sid\x18\x02 \x01(\x0b\x32\x19.otg.BgpAttributesSidMpls\"\xf7\x01\n&BgpAttributesSegmentRoutingPolicyTypeB\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x15\n\x08srv6_sid\x18\x02 \x01(\tH\x00\x88\x01\x01\x12i\n\x16srv6_endpoint_behavior\x18\x03 \x01(\x0b\x32I.otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructureB\x0b\n\t_srv6_sid\"\xfa\x01\n&BgpAttributesSegmentRoutingPolicyTypeC\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11ipv4_node_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12.\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x19.otg.BgpAttributesSidMplsB\x0f\n\r_sr_algorithmB\x14\n\x12_ipv4_node_address\"\xfa\x01\n&BgpAttributesSegmentRoutingPolicyTypeD\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11ipv6_node_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12.\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x19.otg.BgpAttributesSidMplsB\x0f\n\r_sr_algorithmB\x14\n\x12_ipv6_node_address\"\x86\x02\n&BgpAttributesSegmentRoutingPolicyTypeE\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x1f\n\x12local_interface_id\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11ipv4_node_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12.\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x19.otg.BgpAttributesSidMplsB\x15\n\x13_local_interface_idB\x14\n\x12_ipv4_node_address\"\x8a\x02\n&BgpAttributesSegmentRoutingPolicyTypeF\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x1f\n\x12local_ipv4_address\x18\x02 \x01(\tH\x00\x88\x01\x01\x12 \n\x13remote_ipv4_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12.\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x19.otg.BgpAttributesSidMplsB\x15\n\x13_local_ipv4_addressB\x16\n\x14_remote_ipv4_address\"\x90\x03\n&BgpAttributesSegmentRoutingPolicyTypeG\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x1f\n\x12local_interface_id\x18\x02 \x01(\rH\x00\x88\x01\x01\x12$\n\x17local_ipv6_node_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12 \n\x13remote_interface_id\x18\x04 \x01(\rH\x02\x88\x01\x01\x12%\n\x18remote_ipv6_node_address\x18\x05 \x01(\tH\x03\x88\x01\x01\x12.\n\x0bsr_mpls_sid\x18\x06 \x01(\x0b\x32\x19.otg.BgpAttributesSidMplsB\x15\n\x13_local_interface_idB\x1a\n\x18_local_ipv6_node_addressB\x16\n\x14_remote_interface_idB\x1b\n\x19_remote_ipv6_node_address\"\x8a\x02\n&BgpAttributesSegmentRoutingPolicyTypeH\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x1f\n\x12local_ipv6_address\x18\x02 \x01(\tH\x00\x88\x01\x01\x12 \n\x13remote_ipv6_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12.\n\x0bsr_mpls_sid\x18\x06 \x01(\x0b\x32\x19.otg.BgpAttributesSidMplsB\x15\n\x13_local_ipv6_addressB\x16\n\x14_remote_ipv6_address\"\xe2\x02\n&BgpAttributesSegmentRoutingPolicyTypeI\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11ipv6_node_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12+\n\x08srv6_sid\x18\x04 \x01(\x0b\x32\x19.otg.BgpAttributesSidSrv6\x12i\n\x16srv6_endpoint_behavior\x18\x05 \x01(\x0b\x32I.otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructureB\x0f\n\r_sr_algorithmB\x14\n\x12_ipv6_node_address\"\xa4\x04\n&BgpAttributesSegmentRoutingPolicyTypeJ\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1f\n\x12local_interface_id\x18\x03 \x01(\rH\x01\x88\x01\x01\x12$\n\x17local_ipv6_node_address\x18\x04 \x01(\tH\x02\x88\x01\x01\x12 \n\x13remote_interface_id\x18\x05 \x01(\rH\x03\x88\x01\x01\x12%\n\x18remote_ipv6_node_address\x18\x06 \x01(\tH\x04\x88\x01\x01\x12+\n\x08srv6_sid\x18\x07 \x01(\x0b\x32\x19.otg.BgpAttributesSidSrv6\x12i\n\x16srv6_endpoint_behavior\x18\x08 \x01(\x0b\x32I.otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructureB\x0f\n\r_sr_algorithmB\x15\n\x13_local_interface_idB\x1a\n\x18_local_ipv6_node_addressB\x16\n\x14_remote_interface_idB\x1b\n\x19_remote_ipv6_node_address\"\x9e\x03\n&BgpAttributesSegmentRoutingPolicyTypeK\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1f\n\x12local_ipv6_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12 \n\x13remote_ipv6_address\x18\x04 \x01(\tH\x02\x88\x01\x01\x12+\n\x08srv6_sid\x18\x05 \x01(\x0b\x32\x19.otg.BgpAttributesSidSrv6\x12i\n\x16srv6_endpoint_behavior\x18\x06 \x01(\x0b\x32I.otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructureB\x0f\n\r_sr_algorithmB\x15\n\x13_local_ipv6_addressB\x16\n\x14_remote_ipv6_address\"\xac\x01\n*BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x13\n\x06v_flag\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x13\n\x06\x61_flag\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x13\n\x06s_flag\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x13\n\x06\x62_flag\x18\x04 \x01(\x08H\x03\x88\x01\x01\x42\t\n\x07_v_flagB\t\n\x07_a_flagB\t\n\x07_s_flagB\t\n\x07_b_flag\"\x9c\x02\nDBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure\x12\x1f\n\x12\x65ndpoint_behaviour\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x16\n\tlb_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\tln_length\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x18\n\x0b\x66unc_length\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x17\n\narg_length\x18\x05 \x01(\rH\x04\x88\x01\x01\x42\x15\n\x13_endpoint_behaviourB\x0c\n\n_lb_lengthB\x0c\n\n_ln_lengthB\x0e\n\x0c_func_lengthB\r\n\x0b_arg_length\"H\n(BgpNLRIPrefixSegmentRoutingDistinguisher\x12\x12\n\x05value\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_value\"\x93\x07\n\tBgpV6Peer\x12\x19\n\x0cpeer_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x31\n\x0fsegment_routing\x18\x02 \x01(\x0b\x32\x18.otg.BgpV6SegmentRouting\x12\x39\n\x16\x65vpn_ethernet_segments\x18\x03 \x03(\x0b\x32\x19.otg.BgpV6EthernetSegment\x12\x30\n\x07\x61s_type\x18\x04 \x01(\x0e\x32\x1a.otg.BgpV6Peer.AsType.EnumH\x01\x88\x01\x01\x12\x16\n\tas_number\x18\x05 \x01(\rH\x02\x88\x01\x01\x12?\n\x0f\x61s_number_width\x18\x06 \x01(\x0e\x32!.otg.BgpV6Peer.AsNumberWidth.EnumH\x03\x88\x01\x01\x12\"\n\x08\x61\x64vanced\x18\x07 \x01(\x0b\x32\x10.otg.BgpAdvanced\x12&\n\ncapability\x18\x08 \x01(\x0b\x32\x12.otg.BgpCapability\x12\x44\n\x1alearned_information_filter\x18\t \x01(\x0b\x32 .otg.BgpLearnedInformationFilter\x12\'\n\tv4_routes\x18\n \x03(\x0b\x32\x14.otg.BgpV4RouteRange\x12\'\n\tv6_routes\x18\x0b \x03(\x0b\x32\x14.otg.BgpV6RouteRange\x12.\n\x10v4_srte_policies\x18\x0c \x03(\x0b\x32\x14.otg.BgpSrteV4Policy\x12.\n\x10v6_srte_policies\x18\r \x03(\x0b\x32\x14.otg.BgpSrteV6Policy\x12\x11\n\x04name\x18\x0e \x01(\tH\x04\x88\x01\x01\x12\x31\n\x10graceful_restart\x18\x0f \x01(\x0b\x32\x17.otg.BgpGracefulRestart\x12,\n\x0ereplay_updates\x18\x10 \x01(\x0b\x32\x14.otg.BgpUpdateReplay\x1a\x35\n\x06\x41sType\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ibgp\x10\x01\x12\x08\n\x04\x65\x62gp\x10\x02\x1a;\n\rAsNumberWidth\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03two\x10\x01\x12\x08\n\x04\x66our\x10\x02\x42\x0f\n\r_peer_addressB\n\n\x08_as_typeB\x0c\n\n_as_numberB\x12\n\x10_as_number_widthB\x07\n\x05_name\"U\n\x0e\x42gpV6Interface\x12\x16\n\tipv6_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1d\n\x05peers\x18\x02 \x03(\x0b\x32\x0e.otg.BgpV6PeerB\x0c\n\n_ipv6_name\"\xf1\x03\n\x13\x42gpV6SegmentRouting\x12!\n\x14ingress_supports_vpn\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\"\n\x15reduced_encapsulation\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x1e\n\x11\x63opy_time_to_live\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x19\n\x0ctime_to_live\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1d\n\x10max_sids_per_srh\x18\x05 \x01(\rH\x04\x88\x01\x01\x12-\n auto_generate_segment_left_value\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x1f\n\x12segment_left_value\x18\x07 \x01(\rH\x06\x88\x01\x01\x12#\n\x16\x61\x64vertise_sr_te_policy\x18\x08 \x01(\x08H\x07\x88\x01\x01\x42\x17\n\x15_ingress_supports_vpnB\x18\n\x16_reduced_encapsulationB\x14\n\x12_copy_time_to_liveB\x0f\n\r_time_to_liveB\x13\n\x11_max_sids_per_srhB#\n!_auto_generate_segment_left_valueB\x15\n\x13_segment_left_valueB\x19\n\x17_advertise_sr_te_policy\"\xf0\x03\n\x14\x42gpV6EthernetSegment\x12\x36\n\x0b\x64\x66_election\x18\x01 \x01(\x0b\x32!.otg.BgpEthernetSegmentDfElection\x12 \n\x04\x65vis\x18\x02 \x03(\x0b\x32\x12.otg.BgpV6EvpnEvis\x12\x10\n\x03\x65si\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x43\n\x0b\x61\x63tive_mode\x18\x04 \x01(\x0e\x32).otg.BgpV6EthernetSegment.ActiveMode.EnumH\x01\x88\x01\x01\x12\x16\n\tesi_label\x18\x05 \x01(\rH\x02\x88\x01\x01\x12\'\n\x08\x61\x64vanced\x18\x06 \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12&\n\x0b\x63ommunities\x18\x07 \x03(\x0b\x32\x11.otg.BgpCommunity\x12-\n\x0f\x65xt_communities\x18\x08 \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12\x1f\n\x07\x61s_path\x18\t \x01(\x0b\x32\x0e.otg.BgpAsPath\x1aH\n\nActiveMode\":\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rsingle_active\x10\x01\x12\x0e\n\nall_active\x10\x02\x42\x06\n\x04_esiB\x0e\n\x0c_active_modeB\x0c\n\n_esi_label\"\xa8\x01\n\rBgpV6EvpnEvis\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.BgpV6EvpnEvis.Choice.EnumH\x00\x88\x01\x01\x12%\n\tevi_vxlan\x18\x02 \x01(\x0b\x32\x12.otg.BgpV6EviVxlan\x1a\x30\n\x06\x43hoice\"&\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tevi_vxlan\x10\x01\x42\t\n\x07_choice\"\xe3\x05\n\rBgpV6EviVxlan\x12<\n\x11\x62roadcast_domains\x18\x01 \x03(\x0b\x32!.otg.BgpV6EviVxlanBroadcastDomain\x12\x46\n\x10replication_type\x18\x02 \x01(\x0e\x32\'.otg.BgpV6EviVxlan.ReplicationType.EnumH\x00\x88\x01\x01\x12\x17\n\npmsi_label\x18\x03 \x01(\rH\x01\x88\x01\x01\x12\x15\n\x08\x61\x64_label\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x37\n\x13route_distinguisher\x18\x05 \x01(\x0b\x32\x1a.otg.BgpRouteDistinguisher\x12\x30\n\x13route_target_export\x18\x06 \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\x30\n\x13route_target_import\x18\x07 \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\x33\n\x16l3_route_target_export\x18\x08 \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\x33\n\x16l3_route_target_import\x18\t \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\'\n\x08\x61\x64vanced\x18\n \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12&\n\x0b\x63ommunities\x18\x0b \x03(\x0b\x32\x11.otg.BgpCommunity\x12-\n\x0f\x65xt_communities\x18\x0c \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12\x1f\n\x07\x61s_path\x18\r \x01(\x0b\x32\x0e.otg.BgpAsPath\x1a\x43\n\x0fReplicationType\"0\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x17\n\x13ingress_replication\x10\x01\x42\x13\n\x11_replication_typeB\r\n\x0b_pmsi_labelB\x0b\n\t_ad_label\"\xb4\x01\n\x1c\x42gpV6EviVxlanBroadcastDomain\x12*\n\rcmac_ip_range\x18\x01 \x03(\x0b\x32\x13.otg.BgpCMacIpRange\x12\x1c\n\x0f\x65thernet_tag_id\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1f\n\x12vlan_aware_service\x18\x03 \x01(\x08H\x01\x88\x01\x01\x42\x12\n\x10_ethernet_tag_idB\x15\n\x13_vlan_aware_service\"]\n\x0b\x44\x65viceVxlan\x12&\n\nv4_tunnels\x18\x01 \x03(\x0b\x32\x12.otg.VxlanV4Tunnel\x12&\n\nv6_tunnels\x18\x02 \x03(\x0b\x32\x12.otg.VxlanV6Tunnel\"\xbb\x01\n\rVxlanV4Tunnel\x12\x1d\n\x10source_interface\x18\x01 \x01(\tH\x00\x88\x01\x01\x12@\n\x13\x64\x65stination_ip_mode\x18\x02 \x01(\x0b\x32#.otg.VxlanV4TunnelDestinationIPMode\x12\x10\n\x03vni\x18\x03 \x01(\rH\x01\x88\x01\x01\x12\x11\n\x04name\x18\x04 \x01(\tH\x02\x88\x01\x01\x42\x13\n\x11_source_interfaceB\x06\n\x04_vniB\x07\n\x05_name\"\xbb\x01\n\rVxlanV6Tunnel\x12\x1d\n\x10source_interface\x18\x01 \x01(\tH\x00\x88\x01\x01\x12@\n\x13\x64\x65stination_ip_mode\x18\x02 \x01(\x0b\x32#.otg.VxlanV6TunnelDestinationIPMode\x12\x10\n\x03vni\x18\x03 \x01(\rH\x01\x88\x01\x01\x12\x11\n\x04name\x18\x04 \x01(\tH\x02\x88\x01\x01\x42\x13\n\x11_source_interfaceB\x06\n\x04_vniB\x07\n\x05_name\"\xae\x02\n\x1eVxlanV4TunnelDestinationIPMode\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.VxlanV4TunnelDestinationIPMode.Choice.EnumH\x00\x88\x01\x01\x12;\n\x07unicast\x18\x02 \x01(\x0b\x32*.otg.VxlanV4TunnelDestinationIPModeUnicast\x12?\n\tmulticast\x18\x03 \x01(\x0b\x32,.otg.VxlanV4TunnelDestinationIPModeMulticast\x1a=\n\x06\x43hoice\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07unicast\x10\x01\x12\r\n\tmulticast\x10\x02\x42\t\n\x07_choice\"\xae\x02\n\x1eVxlanV6TunnelDestinationIPMode\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.VxlanV6TunnelDestinationIPMode.Choice.EnumH\x00\x88\x01\x01\x12;\n\x07unicast\x18\x02 \x01(\x0b\x32*.otg.VxlanV6TunnelDestinationIPModeUnicast\x12?\n\tmulticast\x18\x03 \x01(\x0b\x32,.otg.VxlanV6TunnelDestinationIPModeMulticast\x1a=\n\x06\x43hoice\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07unicast\x10\x01\x12\r\n\tmulticast\x10\x02\x42\t\n\x07_choice\"f\n%VxlanV4TunnelDestinationIPModeUnicast\x12=\n\x05vteps\x18\x01 \x03(\x0b\x32..otg.VxlanV4TunnelDestinationIPModeUnicastVtep\"f\n%VxlanV6TunnelDestinationIPModeUnicast\x12=\n\x05vteps\x18\x01 \x03(\x0b\x32..otg.VxlanV6TunnelDestinationIPModeUnicastVtep\"\x96\x01\n6VxlanTunnelDestinationIPModeUnicastArpSuppressionCache\x12\x1a\n\rremote_vm_mac\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1b\n\x0eremote_vm_ipv4\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x10\n\x0e_remote_vm_macB\x11\n\x0f_remote_vm_ipv4\"\xc1\x01\n)VxlanV4TunnelDestinationIPModeUnicastVtep\x12 \n\x13remote_vtep_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12Z\n\x15\x61rp_suppression_cache\x18\x02 \x03(\x0b\x32;.otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCacheB\x16\n\x14_remote_vtep_address\"\xc1\x01\n)VxlanV6TunnelDestinationIPModeUnicastVtep\x12 \n\x13remote_vtep_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12Z\n\x15\x61rp_suppression_cache\x18\x02 \x03(\x0b\x32;.otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCacheB\x16\n\x14_remote_vtep_address\"K\n\'VxlanV4TunnelDestinationIPModeMulticast\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\n\n\x08_address\"K\n\'VxlanV6TunnelDestinationIPModeMulticast\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\n\n\x08_address\"\x91\x01\n\nDeviceRsvp\x12/\n\x0fipv4_interfaces\x18\x01 \x03(\x0b\x32\x16.otg.RsvpIpv4Interface\x12\x36\n\x13lsp_ipv4_interfaces\x18\x02 \x03(\x0b\x32\x19.otg.RsvpLspIpv4Interface\x12\x11\n\x04name\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\x07\n\x05_name\"\xc5\x04\n\x11RsvpIpv4Interface\x12\x16\n\tipv4_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0bneighbor_ip\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1e\n\x11label_space_start\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x1c\n\x0flabel_space_end\x18\x04 \x01(\rH\x03\x88\x01\x01\x12%\n\x18\x65nable_refresh_reduction\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12%\n\x18summary_refresh_interval\x18\x06 \x01(\rH\x05\x88\x01\x01\x12\x18\n\x0bsend_bundle\x18\x07 \x01(\x08H\x06\x88\x01\x01\x12\x1d\n\x10\x62undle_threshold\x18\x08 \x01(\rH\x07\x88\x01\x01\x12\x19\n\x0c\x65nable_hello\x18\t \x01(\x08H\x08\x88\x01\x01\x12\x1b\n\x0ehello_interval\x18\n \x01(\rH\t\x88\x01\x01\x12\x1f\n\x12timeout_multiplier\x18\x0b \x01(\rH\n\x88\x01\x01\x42\x0c\n\n_ipv4_nameB\x0e\n\x0c_neighbor_ipB\x14\n\x12_label_space_startB\x12\n\x10_label_space_endB\x1b\n\x19_enable_refresh_reductionB\x1b\n\x19_summary_refresh_intervalB\x0e\n\x0c_send_bundleB\x13\n\x11_bundle_thresholdB\x0f\n\r_enable_helloB\x11\n\x0f_hello_intervalB\x15\n\x13_timeout_multiplier\"\xd0\x01\n\x14RsvpLspIpv4Interface\x12\x16\n\tipv4_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12G\n\x14p2p_egress_ipv4_lsps\x18\x02 \x01(\x0b\x32).otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp\x12I\n\x15p2p_ingress_ipv4_lsps\x18\x03 \x03(\x0b\x32*.otg.RsvpLspIpv4InterfaceP2PIngressIpv4LspB\x0c\n\n_ipv4_name\"\xf1\x03\n$RsvpLspIpv4InterfaceP2PEgressIpv4Lsp\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1d\n\x10refresh_interval\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1f\n\x12timeout_multiplier\x18\x03 \x01(\rH\x02\x88\x01\x01\x12_\n\x11reservation_style\x18\x04 \x01(\x0e\x32?.otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp.ReservationStyle.EnumH\x03\x88\x01\x01\x12\x1f\n\x12\x65nable_fixed_label\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x1e\n\x11\x66ixed_label_value\x18\x06 \x01(\rH\x05\x88\x01\x01\x1a\\\n\x10ReservationStyle\"H\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x13\n\x0fshared_explicit\x10\x01\x12\x10\n\x0c\x66ixed_filter\x10\x02\x12\x08\n\x04\x61uto\x10\x03\x42\x07\n\x05_nameB\x13\n\x11_refresh_intervalB\x15\n\x13_timeout_multiplierB\x14\n\x12_reservation_styleB\x15\n\x13_enable_fixed_labelB\x14\n\x12_fixed_label_value\"\xab\x04\n%RsvpLspIpv4InterfaceP2PIngressIpv4Lsp\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1b\n\x0eremote_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x16\n\ttunnel_id\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x13\n\x06lsp_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1d\n\x10refresh_interval\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x1f\n\x12timeout_multiplier\x18\x06 \x01(\rH\x05\x88\x01\x01\x12\x1a\n\rbackup_lsp_id\x18\x07 \x01(\rH\x06\x88\x01\x01\x12!\n\x14lsp_switchover_delay\x18\x08 \x01(\rH\x07\x88\x01\x01\x12\x34\n\x11session_attribute\x18\t \x01(\x0b\x32\x19.otg.RsvpSessionAttribute\x12\x1d\n\x05tspec\x18\n \x01(\x0b\x32\x0e.otg.RsvpTspec\x12*\n\x0c\x66\x61st_reroute\x18\x0b \x01(\x0b\x32\x14.otg.RsvpFastReroute\x12\x19\n\x03\x65ro\x18\x0c \x01(\x0b\x32\x0c.otg.RsvpEroB\x07\n\x05_nameB\x11\n\x0f_remote_addressB\x0c\n\n_tunnel_idB\t\n\x07_lsp_idB\x13\n\x11_refresh_intervalB\x15\n\x13_timeout_multiplierB\x10\n\x0e_backup_lsp_idB\x17\n\x15_lsp_switchover_delay\"\xf0\x04\n\x14RsvpSessionAttribute\x12\'\n\x1a\x61uto_generate_session_name\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x19\n\x0csession_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1b\n\x0esetup_priority\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x1d\n\x10holding_priority\x18\x04 \x01(\rH\x03\x88\x01\x01\x12%\n\x18local_protection_desired\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12$\n\x17label_recording_desired\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x1d\n\x10se_style_desired\x18\x07 \x01(\x08H\x06\x88\x01\x01\x12)\n\x1c\x62\x61ndwidth_protection_desired\x18\x08 \x01(\x08H\x07\x88\x01\x01\x12$\n\x17node_protection_desired\x18\t \x01(\x08H\x08\x88\x01\x01\x12\x38\n\x13resource_affinities\x18\n \x01(\x0b\x32\x1b.otg.RsvpResourceAffinitiesB\x1d\n\x1b_auto_generate_session_nameB\x0f\n\r_session_nameB\x11\n\x0f_setup_priorityB\x13\n\x11_holding_priorityB\x1b\n\x19_local_protection_desiredB\x1a\n\x18_label_recording_desiredB\x13\n\x11_se_style_desiredB\x1f\n\x1d_bandwidth_protection_desiredB\x1a\n\x18_node_protection_desired\"\x96\x01\n\x16RsvpResourceAffinities\x12\x18\n\x0b\x65xclude_any\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0binclude_any\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0binclude_all\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x0e\n\x0c_exclude_anyB\x0e\n\x0c_include_anyB\x0e\n\x0c_include_all\"\x9f\x02\n\tRsvpTspec\x12\x1e\n\x11token_bucket_rate\x18\x01 \x01(\x02H\x00\x88\x01\x01\x12\x1e\n\x11token_bucket_size\x18\x02 \x01(\x02H\x01\x88\x01\x01\x12\x1b\n\x0epeak_data_rate\x18\x03 \x01(\x02H\x02\x88\x01\x01\x12!\n\x14minimum_policed_unit\x18\x04 \x01(\rH\x03\x88\x01\x01\x12!\n\x14maximum_policed_unit\x18\x05 \x01(\rH\x04\x88\x01\x01\x42\x14\n\x12_token_bucket_rateB\x14\n\x12_token_bucket_sizeB\x11\n\x0f_peak_data_rateB\x17\n\x15_minimum_policed_unitB\x17\n\x15_maximum_policed_unit\"\xc7\x03\n\x0fRsvpFastReroute\x12\x1b\n\x0esetup_priority\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1d\n\x10holding_priority\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\thop_limit\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x16\n\tbandwidth\x18\x04 \x01(\x02H\x03\x88\x01\x01\x12\x18\n\x0b\x65xclude_any\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x18\n\x0binclude_any\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\x18\n\x0binclude_all\x18\x07 \x01(\tH\x06\x88\x01\x01\x12&\n\x19one_to_one_backup_desired\x18\x08 \x01(\x08H\x07\x88\x01\x01\x12$\n\x17\x66\x61\x63ility_backup_desired\x18\t \x01(\x08H\x08\x88\x01\x01\x42\x11\n\x0f_setup_priorityB\x13\n\x11_holding_priorityB\x0c\n\n_hop_limitB\x0c\n\n_bandwidthB\x0e\n\x0c_exclude_anyB\x0e\n\x0c_include_anyB\x0e\n\x0c_include_allB\x1c\n\x1a_one_to_one_backup_desiredB\x1a\n\x18_facility_backup_desired\"\xa8\x02\n\x07RsvpEro\x12\x45\n\x13prepend_neighbor_ip\x18\x01 \x01(\x0e\x32#.otg.RsvpEro.PrependNeighborIp.EnumH\x00\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12)\n\nsubobjects\x18\x03 \x03(\x0b\x32\x15.otg.RsvpEroSubobject\x1a\x65\n\x11PrependNeighborIp\"P\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0c\x64ont_prepend\x10\x01\x12\x11\n\rprepend_loose\x10\x02\x12\x12\n\x0eprepend_strict\x10\x03\x42\x16\n\x14_prepend_neighbor_ipB\x10\n\x0e_prefix_length\"\x8c\x03\n\x10RsvpEroSubobject\x12\x32\n\x04type\x18\x01 \x01(\x0e\x32\x1f.otg.RsvpEroSubobject.Type.EnumH\x00\x88\x01\x01\x12\x19\n\x0cipv4_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x16\n\tas_number\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x39\n\x08hop_type\x18\x05 \x01(\x0e\x32\".otg.RsvpEroSubobject.HopType.EnumH\x04\x88\x01\x01\x1a\x38\n\x04Type\"0\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\r\n\tas_number\x10\x02\x1a\x39\n\x07HopType\".\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06strict\x10\x01\x12\t\n\x05loose\x10\x02\x42\x07\n\x05_typeB\x0f\n\r_ipv4_addressB\x10\n\x0e_prefix_lengthB\x0c\n\n_as_numberB\x0b\n\t_hop_type\">\n\x10\x44\x65viceDhcpServer\x12*\n\x0fipv4_interfaces\x18\x02 \x03(\x0b\x32\x11.otg.DhcpServerV4\"~\n\x0c\x44hcpServerV4\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x16\n\tipv4_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12,\n\raddress_pools\x18\x03 \x03(\x0b\x32\x15.otg.DhcpServerV4PoolB\x07\n\x05_nameB\x0c\n\n_ipv4_name\"\x9a\x02\n\x10\x44hcpServerV4Pool\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x17\n\nlease_time\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1a\n\rstart_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x11\n\x04step\x18\x06 \x01(\rH\x05\x88\x01\x01\x12,\n\x07options\x18\x07 \x01(\x0b\x32\x1b.otg.DhcpServerV4PoolOptionB\x07\n\x05_nameB\r\n\x0b_lease_timeB\x10\n\x0e_start_addressB\x10\n\x0e_prefix_lengthB\x08\n\x06_countB\x07\n\x05_step\"\xfc\x01\n\x16\x44hcpServerV4PoolOption\x12\x1b\n\x0erouter_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12primary_dns_server\x18\x02 \x01(\tH\x01\x88\x01\x01\x12!\n\x14secondary_dns_server\x18\x03 \x01(\tH\x02\x88\x01\x01\x12#\n\x16\x65\x63ho_relay_with_tlv_82\x18\x04 \x01(\x08H\x03\x88\x01\x01\x42\x11\n\x0f_router_addressB\x15\n\x13_primary_dns_serverB\x17\n\x15_secondary_dns_serverB\x19\n\x17_echo_relay_with_tlv_82\"\x8b\x02\n\x04\x46low\x12\x1c\n\x05tx_rx\x18\x01 \x01(\x0b\x32\r.otg.FlowTxRx\x12\x1f\n\x06packet\x18\x02 \x03(\x0b\x32\x0f.otg.FlowHeader\x12&\n\regress_packet\x18\t \x03(\x0b\x32\x0f.otg.FlowHeader\x12\x1b\n\x04size\x18\x03 \x01(\x0b\x32\r.otg.FlowSize\x12\x1b\n\x04rate\x18\x04 \x01(\x0b\x32\r.otg.FlowRate\x12#\n\x08\x64uration\x18\x05 \x01(\x0b\x32\x11.otg.FlowDuration\x12!\n\x07metrics\x18\x06 \x01(\x0b\x32\x10.otg.FlowMetrics\x12\x11\n\x04name\x18\x07 \x01(\tH\x00\x88\x01\x01\x42\x07\n\x05_name\"\xbc\x01\n\x08\x46lowTxRx\x12.\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x19.otg.FlowTxRx.Choice.EnumH\x00\x88\x01\x01\x12\x1b\n\x04port\x18\x02 \x01(\x0b\x32\r.otg.FlowPort\x12\x1f\n\x06\x64\x65vice\x18\x03 \x01(\x0b\x32\x0f.otg.FlowRouter\x1a\x37\n\x06\x43hoice\"-\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04port\x10\x01\x12\n\n\x06\x64\x65vice\x10\x02\x42\t\n\x07_choice\"`\n\x08\x46lowPort\x12\x14\n\x07tx_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x07rx_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x10\n\x08rx_names\x18\x03 \x03(\tB\n\n\x08_tx_nameB\n\n\x08_rx_name\"\xa2\x01\n\nFlowRouter\x12,\n\x04mode\x18\x01 \x01(\x0e\x32\x19.otg.FlowRouter.Mode.EnumH\x00\x88\x01\x01\x12\x10\n\x08tx_names\x18\x02 \x03(\t\x12\x10\n\x08rx_names\x18\x03 \x03(\t\x1a\x39\n\x04Mode\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04mesh\x10\x01\x12\x0e\n\none_to_one\x10\x02\x42\x07\n\x05_mode\"\xe9\x07\n\nFlowHeader\x12\x30\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1b.otg.FlowHeader.Choice.EnumH\x00\x88\x01\x01\x12\x1f\n\x06\x63ustom\x18\x02 \x01(\x0b\x32\x0f.otg.FlowCustom\x12#\n\x08\x65thernet\x18\x03 \x01(\x0b\x32\x11.otg.FlowEthernet\x12\x1b\n\x04vlan\x18\x04 \x01(\x0b\x32\r.otg.FlowVlan\x12\x1d\n\x05vxlan\x18\x05 \x01(\x0b\x32\x0e.otg.FlowVxlan\x12\x1b\n\x04ipv4\x18\x06 \x01(\x0b\x32\r.otg.FlowIpv4\x12\x1b\n\x04ipv6\x18\x07 \x01(\x0b\x32\r.otg.FlowIpv6\x12#\n\x08pfcpause\x18\x08 \x01(\x0b\x32\x11.otg.FlowPfcPause\x12-\n\rethernetpause\x18\t \x01(\x0b\x32\x16.otg.FlowEthernetPause\x12\x19\n\x03tcp\x18\n \x01(\x0b\x32\x0c.otg.FlowTcp\x12\x19\n\x03udp\x18\x0b \x01(\x0b\x32\x0c.otg.FlowUdp\x12\x19\n\x03gre\x18\x0c \x01(\x0b\x32\x0c.otg.FlowGre\x12\x1d\n\x05gtpv1\x18\r \x01(\x0b\x32\x0e.otg.FlowGtpv1\x12\x1d\n\x05gtpv2\x18\x0e \x01(\x0b\x32\x0e.otg.FlowGtpv2\x12\x19\n\x03\x61rp\x18\x0f \x01(\x0b\x32\x0c.otg.FlowArp\x12\x1b\n\x04icmp\x18\x10 \x01(\x0b\x32\r.otg.FlowIcmp\x12\x1f\n\x06icmpv6\x18\x11 \x01(\x0b\x32\x0f.otg.FlowIcmpv6\x12\x19\n\x03ppp\x18\x12 \x01(\x0b\x32\x0c.otg.FlowPpp\x12\x1f\n\x06igmpv1\x18\x13 \x01(\x0b\x32\x0f.otg.FlowIgmpv1\x12\x1b\n\x04mpls\x18\x14 \x01(\x0b\x32\r.otg.FlowMpls\x12!\n\x07snmpv2c\x18\x15 \x01(\x0b\x32\x10.otg.FlowSnmpv2c\x12\x1b\n\x04rsvp\x18\x16 \x01(\x0b\x32\r.otg.FlowRsvp\x1a\x8c\x02\n\x06\x43hoice\"\x81\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x63ustom\x10\x01\x12\x0c\n\x08\x65thernet\x10\x02\x12\x08\n\x04vlan\x10\x03\x12\t\n\x05vxlan\x10\x04\x12\x08\n\x04ipv4\x10\x05\x12\x08\n\x04ipv6\x10\x06\x12\x0c\n\x08pfcpause\x10\x07\x12\x11\n\rethernetpause\x10\x08\x12\x07\n\x03tcp\x10\t\x12\x07\n\x03udp\x10\n\x12\x07\n\x03gre\x10\x0b\x12\t\n\x05gtpv1\x10\x0c\x12\t\n\x05gtpv2\x10\r\x12\x07\n\x03\x61rp\x10\x0e\x12\x08\n\x04icmp\x10\x0f\x12\n\n\x06icmpv6\x10\x10\x12\x07\n\x03ppp\x10\x11\x12\n\n\x06igmpv1\x10\x12\x12\x08\n\x04mpls\x10\x13\x12\x0b\n\x07snmpv2c\x10\x14\x12\x08\n\x04rsvp\x10\x15\x42\t\n\x07_choice\"Y\n\nFlowCustom\x12\x12\n\x05\x62ytes\x18\x01 \x01(\tH\x00\x88\x01\x01\x12-\n\x0bmetric_tags\x18\x02 \x03(\x0b\x32\x18.otg.FlowCustomMetricTagB\x08\n\x06_bytes\"q\n\x13\x46lowCustomMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xce\x01\n\x0c\x46lowEthernet\x12(\n\x03\x64st\x18\x01 \x01(\x0b\x32\x1b.otg.PatternFlowEthernetDst\x12(\n\x03src\x18\x02 \x01(\x0b\x32\x1b.otg.PatternFlowEthernetSrc\x12\x35\n\nether_type\x18\x03 \x01(\x0b\x32!.otg.PatternFlowEthernetEtherType\x12\x33\n\tpfc_queue\x18\x04 \x01(\x0b\x32 .otg.PatternFlowEthernetPfcQueue\"\xac\x01\n\x08\x46lowVlan\x12.\n\x08priority\x18\x01 \x01(\x0b\x32\x1c.otg.PatternFlowVlanPriority\x12$\n\x03\x63\x66i\x18\x02 \x01(\x0b\x32\x17.otg.PatternFlowVlanCfi\x12\"\n\x02id\x18\x03 \x01(\x0b\x32\x16.otg.PatternFlowVlanId\x12&\n\x04tpid\x18\x04 \x01(\x0b\x32\x18.otg.PatternFlowVlanTpid\"\xc3\x01\n\tFlowVxlan\x12)\n\x05\x66lags\x18\x01 \x01(\x0b\x32\x1a.otg.PatternFlowVxlanFlags\x12\x31\n\treserved0\x18\x02 \x01(\x0b\x32\x1e.otg.PatternFlowVxlanReserved0\x12%\n\x03vni\x18\x03 \x01(\x0b\x32\x18.otg.PatternFlowVxlanVni\x12\x31\n\treserved1\x18\x04 \x01(\x0b\x32\x1e.otg.PatternFlowVxlanReserved1\"\x84\x06\n\x08\x46lowIpv4\x12,\n\x07version\x18\x01 \x01(\x0b\x32\x1b.otg.PatternFlowIpv4Version\x12\x37\n\rheader_length\x18\x02 \x01(\x0b\x32 .otg.PatternFlowIpv4HeaderLength\x12\'\n\x08priority\x18\x03 \x01(\x0b\x32\x15.otg.FlowIpv4Priority\x12\x35\n\x0ctotal_length\x18\x04 \x01(\x0b\x32\x1f.otg.PatternFlowIpv4TotalLength\x12:\n\x0eidentification\x18\x05 \x01(\x0b\x32\".otg.PatternFlowIpv4Identification\x12.\n\x08reserved\x18\x06 \x01(\x0b\x32\x1c.otg.PatternFlowIpv4Reserved\x12\x37\n\rdont_fragment\x18\x07 \x01(\x0b\x32 .otg.PatternFlowIpv4DontFragment\x12\x39\n\x0emore_fragments\x18\x08 \x01(\x0b\x32!.otg.PatternFlowIpv4MoreFragments\x12;\n\x0f\x66ragment_offset\x18\t \x01(\x0b\x32\".otg.PatternFlowIpv4FragmentOffset\x12\x34\n\x0ctime_to_live\x18\n \x01(\x0b\x32\x1e.otg.PatternFlowIpv4TimeToLive\x12.\n\x08protocol\x18\x0b \x01(\x0b\x32\x1c.otg.PatternFlowIpv4Protocol\x12;\n\x0fheader_checksum\x18\x0c \x01(\x0b\x32\".otg.PatternFlowIpv4HeaderChecksum\x12$\n\x03src\x18\r \x01(\x0b\x32\x17.otg.PatternFlowIpv4Src\x12$\n\x03\x64st\x18\x0e \x01(\x0b\x32\x17.otg.PatternFlowIpv4Dst\x12%\n\x07options\x18\x0f \x03(\x0b\x32\x14.otg.FlowIpv4Options\"\xc0\x01\n\x0f\x46lowIpv4Options\x12\x35\n\x06\x63hoice\x18\x01 \x01(\x0e\x32 .otg.FlowIpv4Options.Choice.EnumH\x00\x88\x01\x01\x12*\n\x06\x63ustom\x18\x02 \x01(\x0b\x32\x1a.otg.FlowIpv4OptionsCustom\x1a?\n\x06\x43hoice\"5\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0crouter_alert\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x42\t\n\x07_choice\"\x95\x01\n\x15\x46lowIpv4OptionsCustom\x12,\n\x04type\x18\x01 \x01(\x0b\x32\x1e.otg.FlowIpv4OptionsCustomType\x12\x30\n\x06length\x18\x02 \x01(\x0b\x32 .otg.FlowIpv4OptionsCustomLength\x12\x12\n\x05value\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_value\"\xf3\x01\n\x19\x46lowIpv4OptionsCustomType\x12\x44\n\x0b\x63opied_flag\x18\x01 \x01(\x0b\x32/.otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag\x12\x46\n\x0coption_class\x18\x02 \x01(\x0b\x32\x30.otg.PatternFlowIpv4OptionsCustomTypeOptionClass\x12H\n\roption_number\x18\x03 \x01(\x0b\x32\x31.otg.PatternFlowIpv4OptionsCustomTypeOptionNumber\"\xdd\x01\n\x1b\x46lowIpv4OptionsCustomLength\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.FlowIpv4OptionsCustomLength.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\x82\x02\n\x10\x46lowIpv4Priority\x12\x36\n\x06\x63hoice\x18\x01 \x01(\x0e\x32!.otg.FlowIpv4Priority.Choice.EnumH\x00\x88\x01\x01\x12,\n\x03raw\x18\x02 \x01(\x0b\x32\x1f.otg.PatternFlowIpv4PriorityRaw\x12\x1d\n\x03tos\x18\x03 \x01(\x0b\x32\x10.otg.FlowIpv4Tos\x12\x1f\n\x04\x64scp\x18\x04 \x01(\x0b\x32\x11.otg.FlowIpv4Dscp\x1a=\n\x06\x43hoice\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03raw\x10\x01\x12\x07\n\x03tos\x10\x02\x12\x08\n\x04\x64scp\x10\x03\x42\t\n\x07_choice\"b\n\x0c\x46lowIpv4Dscp\x12(\n\x03phb\x18\x01 \x01(\x0b\x32\x1b.otg.PatternFlowIpv4DscpPhb\x12(\n\x03\x65\x63n\x18\x02 \x01(\x0b\x32\x1b.otg.PatternFlowIpv4DscpEcn\"\xc3\x02\n\x0b\x46lowIpv4Tos\x12\x35\n\nprecedence\x18\x01 \x01(\x0b\x32!.otg.PatternFlowIpv4TosPrecedence\x12+\n\x05\x64\x65lay\x18\x02 \x01(\x0b\x32\x1c.otg.PatternFlowIpv4TosDelay\x12\x35\n\nthroughput\x18\x03 \x01(\x0b\x32!.otg.PatternFlowIpv4TosThroughput\x12\x37\n\x0breliability\x18\x04 \x01(\x0b\x32\".otg.PatternFlowIpv4TosReliability\x12\x31\n\x08monetary\x18\x05 \x01(\x0b\x32\x1f.otg.PatternFlowIpv4TosMonetary\x12-\n\x06unused\x18\x06 \x01(\x0b\x32\x1d.otg.PatternFlowIpv4TosUnused\"z\n\x0c\x46lowIpv4Auto\x12\x32\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1d.otg.FlowIpv4Auto.Choice.EnumH\x00\x88\x01\x01\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x64hcp\x10\x01\x42\t\n\x07_choice\"\x91\x03\n\x08\x46lowIpv6\x12,\n\x07version\x18\x01 \x01(\x0b\x32\x1b.otg.PatternFlowIpv6Version\x12\x37\n\rtraffic_class\x18\x02 \x01(\x0b\x32 .otg.PatternFlowIpv6TrafficClass\x12\x31\n\nflow_label\x18\x03 \x01(\x0b\x32\x1d.otg.PatternFlowIpv6FlowLabel\x12\x39\n\x0epayload_length\x18\x04 \x01(\x0b\x32!.otg.PatternFlowIpv6PayloadLength\x12\x33\n\x0bnext_header\x18\x05 \x01(\x0b\x32\x1e.otg.PatternFlowIpv6NextHeader\x12/\n\thop_limit\x18\x06 \x01(\x0b\x32\x1c.otg.PatternFlowIpv6HopLimit\x12$\n\x03src\x18\x07 \x01(\x0b\x32\x17.otg.PatternFlowIpv6Src\x12$\n\x03\x64st\x18\x08 \x01(\x0b\x32\x17.otg.PatternFlowIpv6Dst\"\x81\x06\n\x0c\x46lowPfcPause\x12(\n\x03\x64st\x18\x01 \x01(\x0b\x32\x1b.otg.PatternFlowPfcPauseDst\x12(\n\x03src\x18\x02 \x01(\x0b\x32\x1b.otg.PatternFlowPfcPauseSrc\x12\x35\n\nether_type\x18\x03 \x01(\x0b\x32!.otg.PatternFlowPfcPauseEtherType\x12>\n\x0f\x63ontrol_op_code\x18\x04 \x01(\x0b\x32%.otg.PatternFlowPfcPauseControlOpCode\x12\x46\n\x13\x63lass_enable_vector\x18\x05 \x01(\x0b\x32).otg.PatternFlowPfcPauseClassEnableVector\x12:\n\rpause_class_0\x18\x06 \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass0\x12:\n\rpause_class_1\x18\x07 \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass1\x12:\n\rpause_class_2\x18\x08 \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass2\x12:\n\rpause_class_3\x18\t \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass3\x12:\n\rpause_class_4\x18\n \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass4\x12:\n\rpause_class_5\x18\x0b \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass5\x12:\n\rpause_class_6\x18\x0c \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass6\x12:\n\rpause_class_7\x18\r \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass7\"\xa3\x02\n\x11\x46lowEthernetPause\x12-\n\x03\x64st\x18\x01 \x01(\x0b\x32 .otg.PatternFlowEthernetPauseDst\x12-\n\x03src\x18\x02 \x01(\x0b\x32 .otg.PatternFlowEthernetPauseSrc\x12:\n\nether_type\x18\x03 \x01(\x0b\x32&.otg.PatternFlowEthernetPauseEtherType\x12\x43\n\x0f\x63ontrol_op_code\x18\x04 \x01(\x0b\x32*.otg.PatternFlowEthernetPauseControlOpCode\x12/\n\x04time\x18\x05 \x01(\x0b\x32!.otg.PatternFlowEthernetPauseTime\"\xd7\x05\n\x07\x46lowTcp\x12,\n\x08src_port\x18\x01 \x01(\x0b\x32\x1a.otg.PatternFlowTcpSrcPort\x12,\n\x08\x64st_port\x18\x02 \x01(\x0b\x32\x1a.otg.PatternFlowTcpDstPort\x12*\n\x07seq_num\x18\x03 \x01(\x0b\x32\x19.otg.PatternFlowTcpSeqNum\x12*\n\x07\x61\x63k_num\x18\x04 \x01(\x0b\x32\x19.otg.PatternFlowTcpAckNum\x12\x32\n\x0b\x64\x61ta_offset\x18\x05 \x01(\x0b\x32\x1d.otg.PatternFlowTcpDataOffset\x12(\n\x06\x65\x63n_ns\x18\x06 \x01(\x0b\x32\x18.otg.PatternFlowTcpEcnNs\x12*\n\x07\x65\x63n_cwr\x18\x07 \x01(\x0b\x32\x19.otg.PatternFlowTcpEcnCwr\x12,\n\x08\x65\x63n_echo\x18\x08 \x01(\x0b\x32\x1a.otg.PatternFlowTcpEcnEcho\x12*\n\x07\x63tl_urg\x18\t \x01(\x0b\x32\x19.otg.PatternFlowTcpCtlUrg\x12*\n\x07\x63tl_ack\x18\n \x01(\x0b\x32\x19.otg.PatternFlowTcpCtlAck\x12*\n\x07\x63tl_psh\x18\x0b \x01(\x0b\x32\x19.otg.PatternFlowTcpCtlPsh\x12*\n\x07\x63tl_rst\x18\x0c \x01(\x0b\x32\x19.otg.PatternFlowTcpCtlRst\x12*\n\x07\x63tl_syn\x18\r \x01(\x0b\x32\x19.otg.PatternFlowTcpCtlSyn\x12*\n\x07\x63tl_fin\x18\x0e \x01(\x0b\x32\x19.otg.PatternFlowTcpCtlFin\x12)\n\x06window\x18\x0f \x01(\x0b\x32\x19.otg.PatternFlowTcpWindow\x12-\n\x08\x63hecksum\x18\x10 \x01(\x0b\x32\x1b.otg.PatternFlowTcpChecksum\"\xbf\x01\n\x07\x46lowUdp\x12,\n\x08src_port\x18\x01 \x01(\x0b\x32\x1a.otg.PatternFlowUdpSrcPort\x12,\n\x08\x64st_port\x18\x02 \x01(\x0b\x32\x1a.otg.PatternFlowUdpDstPort\x12)\n\x06length\x18\x03 \x01(\x0b\x32\x19.otg.PatternFlowUdpLength\x12-\n\x08\x63hecksum\x18\x04 \x01(\x0b\x32\x1b.otg.PatternFlowUdpChecksum\"\xb4\x02\n\x07\x46lowGre\x12<\n\x10\x63hecksum_present\x18\x01 \x01(\x0b\x32\".otg.PatternFlowGreChecksumPresent\x12/\n\treserved0\x18\x02 \x01(\x0b\x32\x1c.otg.PatternFlowGreReserved0\x12+\n\x07version\x18\x03 \x01(\x0b\x32\x1a.otg.PatternFlowGreVersion\x12-\n\x08protocol\x18\x04 \x01(\x0b\x32\x1b.otg.PatternFlowGreProtocol\x12-\n\x08\x63hecksum\x18\x05 \x01(\x0b\x32\x1b.otg.PatternFlowGreChecksum\x12/\n\treserved1\x18\x06 \x01(\x0b\x32\x1c.otg.PatternFlowGreReserved1\"\xbf\x05\n\tFlowGtpv1\x12-\n\x07version\x18\x01 \x01(\x0b\x32\x1c.otg.PatternFlowGtpv1Version\x12\x38\n\rprotocol_type\x18\x02 \x01(\x0b\x32!.otg.PatternFlowGtpv1ProtocolType\x12/\n\x08reserved\x18\x03 \x01(\x0b\x32\x1d.otg.PatternFlowGtpv1Reserved\x12*\n\x06\x65_flag\x18\x04 \x01(\x0b\x32\x1a.otg.PatternFlowGtpv1EFlag\x12*\n\x06s_flag\x18\x05 \x01(\x0b\x32\x1a.otg.PatternFlowGtpv1SFlag\x12,\n\x07pn_flag\x18\x06 \x01(\x0b\x32\x1b.otg.PatternFlowGtpv1PnFlag\x12\x36\n\x0cmessage_type\x18\x07 \x01(\x0b\x32 .otg.PatternFlowGtpv1MessageType\x12:\n\x0emessage_length\x18\x08 \x01(\x0b\x32\".otg.PatternFlowGtpv1MessageLength\x12\'\n\x04teid\x18\t \x01(\x0b\x32\x19.otg.PatternFlowGtpv1Teid\x12:\n\x0esquence_number\x18\n \x01(\x0b\x32\".otg.PatternFlowGtpv1SquenceNumber\x12\x35\n\x0cn_pdu_number\x18\x0b \x01(\x0b\x32\x1f.otg.PatternFlowGtpv1NPduNumber\x12P\n\x1anext_extension_header_type\x18\x0c \x01(\x0b\x32,.otg.PatternFlowGtpv1NextExtensionHeaderType\x12\x30\n\x11\x65xtension_headers\x18\r \x03(\x0b\x32\x15.otg.FlowGtpExtension\"\xe1\x01\n\x10\x46lowGtpExtension\x12\x45\n\x10\x65xtension_length\x18\x01 \x01(\x0b\x32+.otg.PatternFlowGtpExtensionExtensionLength\x12\x36\n\x08\x63ontents\x18\x02 \x01(\x0b\x32$.otg.PatternFlowGtpExtensionContents\x12N\n\x15next_extension_header\x18\x03 \x01(\x0b\x32/.otg.PatternFlowGtpExtensionNextExtensionHeader\"\xe3\x03\n\tFlowGtpv2\x12-\n\x07version\x18\x01 \x01(\x0b\x32\x1c.otg.PatternFlowGtpv2Version\x12@\n\x11piggybacking_flag\x18\x02 \x01(\x0b\x32%.otg.PatternFlowGtpv2PiggybackingFlag\x12\x30\n\tteid_flag\x18\x03 \x01(\x0b\x32\x1d.otg.PatternFlowGtpv2TeidFlag\x12+\n\x06spare1\x18\x04 \x01(\x0b\x32\x1b.otg.PatternFlowGtpv2Spare1\x12\x36\n\x0cmessage_type\x18\x05 \x01(\x0b\x32 .otg.PatternFlowGtpv2MessageType\x12:\n\x0emessage_length\x18\x06 \x01(\x0b\x32\".otg.PatternFlowGtpv2MessageLength\x12\'\n\x04teid\x18\x07 \x01(\x0b\x32\x19.otg.PatternFlowGtpv2Teid\x12<\n\x0fsequence_number\x18\x08 \x01(\x0b\x32#.otg.PatternFlowGtpv2SequenceNumber\x12+\n\x06spare2\x18\t \x01(\x0b\x32\x1b.otg.PatternFlowGtpv2Spare2\"\xb6\x04\n\x07\x46lowArp\x12\x36\n\rhardware_type\x18\x01 \x01(\x0b\x32\x1f.otg.PatternFlowArpHardwareType\x12\x36\n\rprotocol_type\x18\x02 \x01(\x0b\x32\x1f.otg.PatternFlowArpProtocolType\x12:\n\x0fhardware_length\x18\x03 \x01(\x0b\x32!.otg.PatternFlowArpHardwareLength\x12:\n\x0fprotocol_length\x18\x04 \x01(\x0b\x32!.otg.PatternFlowArpProtocolLength\x12/\n\toperation\x18\x05 \x01(\x0b\x32\x1c.otg.PatternFlowArpOperation\x12\x43\n\x14sender_hardware_addr\x18\x06 \x01(\x0b\x32%.otg.PatternFlowArpSenderHardwareAddr\x12\x43\n\x14sender_protocol_addr\x18\x07 \x01(\x0b\x32%.otg.PatternFlowArpSenderProtocolAddr\x12\x43\n\x14target_hardware_addr\x18\x08 \x01(\x0b\x32%.otg.PatternFlowArpTargetHardwareAddr\x12\x43\n\x14target_protocol_addr\x18\t \x01(\x0b\x32%.otg.PatternFlowArpTargetProtocolAddr\"\x93\x01\n\x08\x46lowIcmp\x12.\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x19.otg.FlowIcmp.Choice.EnumH\x00\x88\x01\x01\x12\x1f\n\x04\x65\x63ho\x18\x02 \x01(\x0b\x32\x11.otg.FlowIcmpEcho\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x65\x63ho\x10\x01\x42\t\n\x07_choice\"\x93\x02\n\x0c\x46lowIcmpEcho\x12*\n\x04type\x18\x01 \x01(\x0b\x32\x1c.otg.PatternFlowIcmpEchoType\x12*\n\x04\x63ode\x18\x02 \x01(\x0b\x32\x1c.otg.PatternFlowIcmpEchoCode\x12\x32\n\x08\x63hecksum\x18\x03 \x01(\x0b\x32 .otg.PatternFlowIcmpEchoChecksum\x12\x36\n\nidentifier\x18\x04 \x01(\x0b\x32\".otg.PatternFlowIcmpEchoIdentifier\x12?\n\x0fsequence_number\x18\x05 \x01(\x0b\x32&.otg.PatternFlowIcmpEchoSequenceNumber\"\x99\x01\n\nFlowIcmpv6\x12\x30\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1b.otg.FlowIcmpv6.Choice.EnumH\x00\x88\x01\x01\x12!\n\x04\x65\x63ho\x18\x02 \x01(\x0b\x32\x13.otg.FlowIcmpv6Echo\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x65\x63ho\x10\x01\x42\t\n\x07_choice\"\x9f\x02\n\x0e\x46lowIcmpv6Echo\x12,\n\x04type\x18\x01 \x01(\x0b\x32\x1e.otg.PatternFlowIcmpv6EchoType\x12,\n\x04\x63ode\x18\x02 \x01(\x0b\x32\x1e.otg.PatternFlowIcmpv6EchoCode\x12\x38\n\nidentifier\x18\x03 \x01(\x0b\x32$.otg.PatternFlowIcmpv6EchoIdentifier\x12\x41\n\x0fsequence_number\x18\x04 \x01(\x0b\x32(.otg.PatternFlowIcmpv6EchoSequenceNumber\x12\x34\n\x08\x63hecksum\x18\x05 \x01(\x0b\x32\".otg.PatternFlowIcmpv6EchoChecksum\"\x9b\x01\n\x07\x46lowPpp\x12+\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\x1a.otg.PatternFlowPppAddress\x12+\n\x07\x63ontrol\x18\x02 \x01(\x0b\x32\x1a.otg.PatternFlowPppControl\x12\x36\n\rprotocol_type\x18\x03 \x01(\x0b\x32\x1f.otg.PatternFlowPppProtocolType\"\x81\x02\n\nFlowIgmpv1\x12.\n\x07version\x18\x01 \x01(\x0b\x32\x1d.otg.PatternFlowIgmpv1Version\x12(\n\x04type\x18\x02 \x01(\x0b\x32\x1a.otg.PatternFlowIgmpv1Type\x12,\n\x06unused\x18\x03 \x01(\x0b\x32\x1c.otg.PatternFlowIgmpv1Unused\x12\x30\n\x08\x63hecksum\x18\x04 \x01(\x0b\x32\x1e.otg.PatternFlowIgmpv1Checksum\x12\x39\n\rgroup_address\x18\x05 \x01(\x0b\x32\".otg.PatternFlowIgmpv1GroupAddress\"\xdf\x01\n\x08\x46lowMpls\x12(\n\x05label\x18\x01 \x01(\x0b\x32\x19.otg.PatternFlowMplsLabel\x12\x37\n\rtraffic_class\x18\x02 \x01(\x0b\x32 .otg.PatternFlowMplsTrafficClass\x12:\n\x0f\x62ottom_of_stack\x18\x03 \x01(\x0b\x32!.otg.PatternFlowMplsBottomOfStack\x12\x34\n\x0ctime_to_live\x18\x04 \x01(\x0b\x32\x1e.otg.PatternFlowMplsTimeToLive\"\x88\x01\n\x0b\x46lowSnmpv2c\x12/\n\x07version\x18\x01 \x01(\x0b\x32\x1e.otg.PatternFlowSnmpv2cVersion\x12\x16\n\tcommunity\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\"\n\x04\x64\x61ta\x18\x03 \x01(\x0b\x32\x14.otg.FlowSnmpv2cDataB\x0c\n\n_community\"\xde\x04\n\x0f\x46lowSnmpv2cData\x12\x35\n\x06\x63hoice\x18\x01 \x01(\x0e\x32 .otg.FlowSnmpv2cData.Choice.EnumH\x00\x88\x01\x01\x12(\n\x0bget_request\x18\x02 \x01(\x0b\x32\x13.otg.FlowSnmpv2cPDU\x12-\n\x10get_next_request\x18\x03 \x01(\x0b\x32\x13.otg.FlowSnmpv2cPDU\x12%\n\x08response\x18\x04 \x01(\x0b\x32\x13.otg.FlowSnmpv2cPDU\x12(\n\x0bset_request\x18\x05 \x01(\x0b\x32\x13.otg.FlowSnmpv2cPDU\x12\x31\n\x10get_bulk_request\x18\x06 \x01(\x0b\x32\x17.otg.FlowSnmpv2cBulkPDU\x12+\n\x0einform_request\x18\x07 \x01(\x0b\x32\x13.otg.FlowSnmpv2cPDU\x12(\n\x0bsnmpv2_trap\x18\x08 \x01(\x0b\x32\x13.otg.FlowSnmpv2cPDU\x12#\n\x06report\x18\t \x01(\x0b\x32\x13.otg.FlowSnmpv2cPDU\x1a\xaf\x01\n\x06\x43hoice\"\xa4\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0f\n\x0bget_request\x10\x01\x12\x14\n\x10get_next_request\x10\x02\x12\x0c\n\x08response\x10\x03\x12\x0f\n\x0bset_request\x10\x04\x12\x14\n\x10get_bulk_request\x10\x05\x12\x12\n\x0einform_request\x10\x06\x12\x0f\n\x0bsnmpv2_trap\x10\x07\x12\n\n\x06report\x10\x08\x42\t\n\x07_choice\"\x93\x05\n\x0e\x46lowSnmpv2cPDU\x12\x37\n\nrequest_id\x18\x01 \x01(\x0b\x32#.otg.PatternFlowSnmpv2cPDURequestId\x12?\n\x0c\x65rror_status\x18\x02 \x01(\x0e\x32$.otg.FlowSnmpv2cPDU.ErrorStatus.EnumH\x00\x88\x01\x01\x12\x39\n\x0b\x65rror_index\x18\x03 \x01(\x0b\x32$.otg.PatternFlowSnmpv2cPDUErrorIndex\x12:\n\x11variable_bindings\x18\x04 \x03(\x0b\x32\x1f.otg.FlowSnmpv2cVariableBinding\x1a\xfe\x02\n\x0b\x45rrorStatus\"\xee\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08no_error\x10\x01\x12\x0b\n\x07too_big\x10\x02\x12\x10\n\x0cno_such_name\x10\x03\x12\r\n\tbad_value\x10\x04\x12\r\n\tread_only\x10\x05\x12\x0b\n\x07gen_err\x10\x06\x12\r\n\tno_access\x10\x07\x12\x0e\n\nwrong_type\x10\x08\x12\x10\n\x0cwrong_length\x10\t\x12\x12\n\x0ewrong_encoding\x10\n\x12\x0f\n\x0bwrong_value\x10\x0b\x12\x0f\n\x0bno_creation\x10\x0c\x12\x16\n\x12inconsistent_value\x10\r\x12\x18\n\x14resource_unavailable\x10\x0e\x12\x11\n\rcommit_failed\x10\x0f\x12\x0f\n\x0bundo_failed\x10\x10\x12\x17\n\x13\x61uthorization_error\x10\x11\x12\x10\n\x0cnot_writable\x10\x12\x12\x15\n\x11inconsistent_name\x10\x13\x42\x0f\n\r_error_status\"\x97\x02\n\x12\x46lowSnmpv2cBulkPDU\x12;\n\nrequest_id\x18\x01 \x01(\x0b\x32\'.otg.PatternFlowSnmpv2cBulkPDURequestId\x12\x41\n\rnon_repeaters\x18\x02 \x01(\x0b\x32*.otg.PatternFlowSnmpv2cBulkPDUNonRepeaters\x12\x45\n\x0fmax_repetitions\x18\x03 \x01(\x0b\x32,.otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions\x12:\n\x11variable_bindings\x18\x04 \x03(\x0b\x32\x1f.otg.FlowSnmpv2cVariableBinding\"\x87\x01\n\x1a\x46lowSnmpv2cVariableBinding\x12\x1e\n\x11object_identifier\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x33\n\x05value\x18\x02 \x01(\x0b\x32$.otg.FlowSnmpv2cVariableBindingValueB\x14\n\x12_object_identifier\"\xa5\x08\n\x1f\x46lowSnmpv2cVariableBindingValue\x12\x45\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x30.otg.FlowSnmpv2cVariableBindingValue.Choice.EnumH\x00\x88\x01\x01\x12N\n\rinteger_value\x18\x02 \x01(\x0b\x32\x37.otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue\x12@\n\x0cstring_value\x18\x03 \x01(\x0b\x32*.otg.FlowSnmpv2cVariableBindingStringValue\x12$\n\x17object_identifier_value\x18\x04 \x01(\tH\x01\x88\x01\x01\x12S\n\x10ip_address_value\x18\x05 \x01(\x0b\x32\x39.otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue\x12N\n\rcounter_value\x18\x06 \x01(\x0b\x32\x37.otg.PatternFlowSnmpv2cVariableBindingValueCounterValue\x12R\n\x0ftimeticks_value\x18\x07 \x01(\x0b\x32\x39.otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue\x12\x1c\n\x0f\x61rbitrary_value\x18\x08 \x01(\tH\x02\x88\x01\x01\x12U\n\x11\x62ig_counter_value\x18\t \x01(\x0b\x32:.otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue\x12_\n\x16unsigned_integer_value\x18\n \x01(\x0b\x32?.otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue\x1a\xf8\x01\n\x06\x43hoice\"\xed\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08no_value\x10\x01\x12\x11\n\rinteger_value\x10\x02\x12\x10\n\x0cstring_value\x10\x03\x12\x1b\n\x17object_identifier_value\x10\x04\x12\x14\n\x10ip_address_value\x10\x05\x12\x11\n\rcounter_value\x10\x06\x12\x13\n\x0ftimeticks_value\x10\x07\x12\x13\n\x0f\x61rbitrary_value\x10\x08\x12\x15\n\x11\x62ig_counter_value\x10\t\x12\x1a\n\x16unsigned_integer_value\x10\nB\t\n\x07_choiceB\x1a\n\x18_object_identifier_valueB\x12\n\x10_arbitrary_value\"\xee\x01\n%FlowSnmpv2cVariableBindingStringValue\x12K\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x36.otg.FlowSnmpv2cVariableBindingStringValue.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05\x61scii\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x10\n\x03raw\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\x35\n\x06\x43hoice\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05\x61scii\x10\x01\x12\x07\n\x03raw\x10\x02\x42\t\n\x07_choiceB\x08\n\x06_asciiB\x06\n\x04_raw\"\xb9\x03\n\x08\x46lowRsvp\x12\x14\n\x07version\x18\x01 \x01(\rH\x00\x88\x01\x01\x12*\n\x04\x66lag\x18\x02 \x01(\x0e\x32\x17.otg.FlowRsvp.Flag.EnumH\x01\x88\x01\x01\x12\x37\n\rrsvp_checksum\x18\x03 \x01(\x0b\x32 .otg.PatternFlowRsvpRsvpChecksum\x12\x34\n\x0ctime_to_live\x18\x04 \x01(\x0b\x32\x1e.otg.PatternFlowRsvpTimeToLive\x12.\n\x08reserved\x18\x05 \x01(\x0b\x32\x1c.otg.PatternFlowRsvpReserved\x12(\n\x0brsvp_length\x18\x06 \x01(\x0b\x32\x13.otg.FlowRSVPLength\x12*\n\x0cmessage_type\x18\x07 \x01(\x0b\x32\x14.otg.FlowRSVPMessage\x1a\x61\n\x04\x46lag\"Y\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12!\n\x1dnot_refresh_reduction_capable\x10\x01\x12\x1d\n\x19refresh_reduction_capable\x10\x02\x42\n\n\x08_versionB\x07\n\x05_flag\"\xc3\x01\n\x0e\x46lowRSVPLength\x12\x34\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1f.otg.FlowRSVPLength.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xa8\x01\n\x0f\x46lowRSVPMessage\x12\x35\n\x06\x63hoice\x18\x01 \x01(\x0e\x32 .otg.FlowRSVPMessage.Choice.EnumH\x00\x88\x01\x01\x12&\n\x04path\x18\x02 \x01(\x0b\x32\x18.otg.FlowRSVPPathMessage\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04path\x10\x01\x42\t\n\x07_choice\"@\n\x13\x46lowRSVPPathMessage\x12)\n\x07objects\x18\x01 \x03(\x0b\x32\x18.otg.FlowRSVPPathObjects\"G\n\x13\x46lowRSVPPathObjects\x12\x30\n\tclass_num\x18\x01 \x01(\x0b\x32\x1d.otg.FlowRSVPPathObjectsClass\"\xcf\x01\n\x14\x46lowRSVPObjectLength\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.FlowRSVPObjectLength.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xac\x07\n\x18\x46lowRSVPPathObjectsClass\x12>\n\x06\x63hoice\x18\x01 \x01(\x0e\x32).otg.FlowRSVPPathObjectsClass.Choice.EnumH\x00\x88\x01\x01\x12\x35\n\x07session\x18\x02 \x01(\x0b\x32$.otg.FlowRSVPPathObjectsClassSession\x12\x36\n\x08rsvp_hop\x18\x03 \x01(\x0b\x32$.otg.FlowRSVPPathObjectsClassRsvpHop\x12<\n\x0btime_values\x18\x04 \x01(\x0b\x32\'.otg.FlowRSVPPathObjectsClassTimeValues\x12\x42\n\x0e\x65xplicit_route\x18\x05 \x01(\x0b\x32*.otg.FlowRSVPPathObjectsClassExplicitRoute\x12@\n\rlabel_request\x18\x06 \x01(\x0b\x32).otg.FlowRSVPPathObjectsClassLabelRequest\x12H\n\x11session_attribute\x18\x07 \x01(\x0b\x32-.otg.FlowRSVPPathObjectsClassSessionAttribute\x12\x44\n\x0fsender_template\x18\x08 \x01(\x0b\x32+.otg.FlowRSVPPathObjectsClassSenderTemplate\x12>\n\x0csender_tspec\x18\t \x01(\x0b\x32(.otg.FlowRSVPPathObjectsClassSenderTspec\x12>\n\x0crecord_route\x18\n \x01(\x0b\x32(.otg.FlowRSVPPathObjectsClassRecordRoute\x12.\n\x06\x63ustom\x18\x0b \x01(\x0b\x32\x1e.otg.FlowRSVPPathObjectsCustom\x1a\xd1\x01\n\x06\x43hoice\"\xc6\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07session\x10\x01\x12\x0c\n\x08rsvp_hop\x10\x02\x12\x0f\n\x0btime_values\x10\x03\x12\x12\n\x0e\x65xplicit_route\x10\x04\x12\x11\n\rlabel_request\x10\x05\x12\x15\n\x11session_attribute\x10\x06\x12\x13\n\x0fsender_template\x10\x07\x12\x10\n\x0csender_tspec\x10\x08\x12\x10\n\x0crecord_route\x10\t\x12\n\n\x06\x63ustom\x10\nB\t\n\x07_choice\"\x82\x01\n\x1f\x46lowRSVPPathObjectsClassSession\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12\x34\n\x06\x63_type\x18\x02 \x01(\x0b\x32$.otg.FlowRSVPPathObjectsSessionCType\"\xeb\x01\n\x1f\x46lowRSVPPathObjectsSessionCType\x12\x45\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x30.otg.FlowRSVPPathObjectsSessionCType.Choice.EnumH\x00\x88\x01\x01\x12>\n\x0flsp_tunnel_ipv4\x18\x02 \x01(\x0b\x32%.otg.FlowRSVPPathSessionLspTunnelIpv4\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x13\n\x0flsp_tunnel_ipv4\x10\x01\x42\t\n\x07_choice\"\xe2\x02\n FlowRSVPPathSessionLspTunnelIpv4\x12l\n\x1dipv4_tunnel_end_point_address\x18\x01 \x01(\x0b\x32\x45.otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress\x12\x46\n\x08reserved\x18\x02 \x01(\x0b\x32\x34.otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved\x12G\n\ttunnel_id\x18\x03 \x01(\x0b\x32\x34.otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId\x12?\n\x12\x65xtended_tunnel_id\x18\x04 \x01(\x0b\x32#.otg.FlowRSVPPathSessionExtTunnelId\"\xbd\x02\n\x1e\x46lowRSVPPathSessionExtTunnelId\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.FlowRSVPPathSessionExtTunnelId.Choice.EnumH\x00\x88\x01\x01\x12G\n\nas_integer\x18\x02 \x01(\x0b\x32\x33.otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger\x12\x41\n\x07\x61s_ipv4\x18\x03 \x01(\x0b\x32\x30.otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4\x1a>\n\x06\x43hoice\"4\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0e\n\nas_integer\x10\x01\x12\x0b\n\x07\x61s_ipv4\x10\x02\x42\t\n\x07_choice\"\x82\x01\n\x1f\x46lowRSVPPathObjectsClassRsvpHop\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12\x34\n\x06\x63_type\x18\x02 \x01(\x0b\x32$.otg.FlowRSVPPathObjectsRsvpHopCType\"\xcc\x01\n\x1f\x46lowRSVPPathObjectsRsvpHopCType\x12\x45\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x30.otg.FlowRSVPPathObjectsRsvpHopCType.Choice.EnumH\x00\x88\x01\x01\x12*\n\x04ipv4\x18\x02 \x01(\x0b\x32\x1c.otg.FlowRSVPPathRsvpHopIpv4\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x42\t\n\x07_choice\"\xbc\x01\n\x17\x46lowRSVPPathRsvpHopIpv4\x12\x44\n\x0cipv4_address\x18\x01 \x01(\x0b\x32..otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address\x12[\n\x18logical_interface_handle\x18\x02 \x01(\x0b\x32\x39.otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle\"\x88\x01\n\"FlowRSVPPathObjectsClassTimeValues\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12\x37\n\x06\x63_type\x18\x02 \x01(\x0b\x32\'.otg.FlowRSVPPathObjectsTimeValuesCType\"\xda\x01\n\"FlowRSVPPathObjectsTimeValuesCType\x12H\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x33.otg.FlowRSVPPathObjectsTimeValuesCType.Choice.EnumH\x00\x88\x01\x01\x12\x30\n\x06type_1\x18\x02 \x01(\x0b\x32 .otg.FlowRSVPPathTimeValuesType1\x1a-\n\x06\x43hoice\"#\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06type_1\x10\x01\x42\t\n\x07_choice\"n\n\x1b\x46lowRSVPPathTimeValuesType1\x12O\n\x10refresh_period_r\x18\x01 \x01(\x0b\x32\x35.otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR\"\x93\x01\n%FlowRSVPPathObjectsClassExplicitRoute\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12?\n\x06\x63_type\x18\x02 \x01(\x0b\x32/.otg.FlowRSVPPathObjectsClassExplicitRouteCType\"\xed\x01\n*FlowRSVPPathObjectsClassExplicitRouteCType\x12P\n\x06\x63hoice\x18\x01 \x01(\x0e\x32;.otg.FlowRSVPPathObjectsClassExplicitRouteCType.Choice.EnumH\x00\x88\x01\x01\x12\x33\n\x06type_1\x18\x02 \x01(\x0b\x32#.otg.FlowRSVPPathExplicitRouteType1\x1a-\n\x06\x43hoice\"#\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06type_1\x10\x01\x42\t\n\x07_choice\"_\n\x1e\x46lowRSVPPathExplicitRouteType1\x12=\n\nsubobjects\x18\x01 \x03(\x0b\x32).otg.FlowRSVPType1ExplicitRouteSubobjects\"c\n$FlowRSVPType1ExplicitRouteSubobjects\x12;\n\x04type\x18\x01 \x01(\x0b\x32-.otg.FlowRSVPType1ExplicitRouteSubobjectsType\"\xcc\x02\n(FlowRSVPType1ExplicitRouteSubobjectsType\x12N\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x39.otg.FlowRSVPType1ExplicitRouteSubobjectsType.Choice.EnumH\x00\x88\x01\x01\x12\x42\n\x0bipv4_prefix\x18\x02 \x01(\x0b\x32-.otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix\x12>\n\tas_number\x18\x03 \x01(\x0b\x32+.otg.FlowRSVPPathExplicitRouteType1ASNumber\x1a\x41\n\x06\x43hoice\"7\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0f\n\x0bipv4_prefix\x10\x01\x12\r\n\tas_number\x10\x02\x42\t\n\x07_choice\"\x9c\x02\n(FlowRSVPPathExplicitRouteType1Ipv4Prefix\x12G\n\x05l_bit\x18\x01 \x01(\x0b\x32\x38.otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit\x12\x30\n\x06length\x18\x02 \x01(\x0b\x32 .otg.FlowRSVPExplicitRouteLength\x12U\n\x0cipv4_address\x18\x03 \x01(\x0b\x32?.otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address\x12\x13\n\x06prefix\x18\x04 \x01(\rH\x00\x88\x01\x01\x42\t\n\x07_prefix\"\xcf\x01\n&FlowRSVPPathExplicitRouteType1ASNumber\x12\x45\n\x05l_bit\x18\x01 \x01(\x0b\x32\x36.otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit\x12\x38\n\x06length\x18\x02 \x01(\x0b\x32(.otg.FlowRSVPExplicitRouteASNumberLength\x12\x16\n\tas_number\x18\x03 \x01(\rH\x00\x88\x01\x01\x42\x0c\n\n_as_number\"\xdd\x01\n\x1b\x46lowRSVPExplicitRouteLength\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.FlowRSVPExplicitRouteLength.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xed\x01\n#FlowRSVPExplicitRouteASNumberLength\x12I\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x34.otg.FlowRSVPExplicitRouteASNumberLength.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\x8c\x01\n$FlowRSVPPathObjectsClassLabelRequest\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12\x39\n\x06\x63_type\x18\x02 \x01(\x0b\x32).otg.FlowRSVPPathObjectsLabelRequestCType\"\x86\x02\n$FlowRSVPPathObjectsLabelRequestCType\x12J\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x35.otg.FlowRSVPPathObjectsLabelRequestCType.Choice.EnumH\x00\x88\x01\x01\x12K\n\x13without_label_range\x18\x02 \x01(\x0b\x32..otg.FlowRSVPPathLabelRequestWithoutLabelRange\x1a:\n\x06\x43hoice\"0\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x17\n\x13without_label_range\x10\x01\x42\t\n\x07_choice\"\xc7\x01\n)FlowRSVPPathLabelRequestWithoutLabelRange\x12O\n\x08reserved\x18\x01 \x01(\x0b\x32=.otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved\x12I\n\x05l3pid\x18\x02 \x01(\x0b\x32:.otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid\"\x94\x01\n(FlowRSVPPathObjectsClassSessionAttribute\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12=\n\x06\x63_type\x18\x02 \x01(\x0b\x32-.otg.FlowRSVPPathObjectsSessionAttributeCType\"\xd0\x02\n(FlowRSVPPathObjectsSessionAttributeCType\x12N\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x39.otg.FlowRSVPPathObjectsSessionAttributeCType.Choice.EnumH\x00\x88\x01\x01\x12>\n\nlsp_tunnel\x18\x02 \x01(\x0b\x32*.otg.FlowRSVPPathSessionAttributeLspTunnel\x12\x43\n\rlsp_tunnel_ra\x18\x03 \x01(\x0b\x32,.otg.FlowRSVPPathSessionAttributeLspTunnelRa\x1a\x44\n\x06\x43hoice\":\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0e\n\nlsp_tunnel\x10\x01\x12\x11\n\rlsp_tunnel_ra\x10\x02\x42\t\n\x07_choice\"\xa0\x02\n%FlowRSVPPathSessionAttributeLspTunnel\x12\x1b\n\x0esetup_priority\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1d\n\x10holding_priority\x18\x02 \x01(\rH\x01\x88\x01\x01\x12)\n\x05\x66lags\x18\x03 \x01(\x0b\x32\x1a.otg.FlowRSVPLspTunnelFlag\x12<\n\x0bname_length\x18\x04 \x01(\x0b\x32\'.otg.FlowRSVPSessionAttributeNameLength\x12\x19\n\x0csession_name\x18\x05 \x01(\tH\x02\x88\x01\x01\x42\x11\n\x0f_setup_priorityB\x13\n\x11_holding_priorityB\x0f\n\r_session_name\"\xa0\x03\n\'FlowRSVPPathSessionAttributeLspTunnelRa\x12\x18\n\x0b\x65xclude_any\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0binclude_any\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0binclude_all\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x1b\n\x0esetup_priority\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1d\n\x10holding_priority\x18\x05 \x01(\rH\x04\x88\x01\x01\x12)\n\x05\x66lags\x18\x06 \x01(\x0b\x32\x1a.otg.FlowRSVPLspTunnelFlag\x12<\n\x0bname_length\x18\x07 \x01(\x0b\x32\'.otg.FlowRSVPSessionAttributeNameLength\x12\x19\n\x0csession_name\x18\x08 \x01(\tH\x05\x88\x01\x01\x42\x0e\n\x0c_exclude_anyB\x0e\n\x0c_include_anyB\x0e\n\x0c_include_allB\x11\n\x0f_setup_priorityB\x13\n\x11_holding_priorityB\x0f\n\r_session_name\"\xd3\x01\n\x15\x46lowRSVPLspTunnelFlag\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.FlowRSVPLspTunnelFlag.Choice.EnumH\x00\x88\x01\x01\x1ar\n\x06\x43hoice\"h\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1c\n\x18local_protection_desired\x10\x01\x12\x1b\n\x17label_recording_desired\x10\x02\x12\x14\n\x10se_style_desired\x10\x03\x42\t\n\x07_choice\"\xeb\x01\n\"FlowRSVPSessionAttributeNameLength\x12H\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x33.otg.FlowRSVPSessionAttributeNameLength.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\x90\x01\n&FlowRSVPPathObjectsClassSenderTemplate\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12;\n\x06\x63_type\x18\x02 \x01(\x0b\x32+.otg.FlowRSVPPathObjectsSenderTemplateCType\"\x80\x02\n&FlowRSVPPathObjectsSenderTemplateCType\x12L\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x37.otg.FlowRSVPPathObjectsSenderTemplateCType.Choice.EnumH\x00\x88\x01\x01\x12\x45\n\x0flsp_tunnel_ipv4\x18\x02 \x01(\x0b\x32,.otg.FlowRSVPPathSenderTemplateLspTunnelIpv4\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x13\n\x0flsp_tunnel_ipv4\x10\x01\x42\t\n\x07_choice\"\xb2\x02\n\'FlowRSVPPathSenderTemplateLspTunnelIpv4\x12n\n\x1aipv4_tunnel_sender_address\x18\x01 \x01(\x0b\x32J.otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress\x12M\n\x08reserved\x18\x02 \x01(\x0b\x32;.otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved\x12H\n\x06lsp_id\x18\x03 \x01(\x0b\x32\x38.otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId\"\x8a\x01\n#FlowRSVPPathObjectsClassSenderTspec\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12\x38\n\x06\x63_type\x18\x02 \x01(\x0b\x32(.otg.FlowRSVPPathObjectsSenderTspecCType\"\xe3\x01\n#FlowRSVPPathObjectsSenderTspecCType\x12I\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x34.otg.FlowRSVPPathObjectsSenderTspecCType.Choice.EnumH\x00\x88\x01\x01\x12\x35\n\x08int_serv\x18\x02 \x01(\x0b\x32#.otg.FlowRSVPPathSenderTspecIntServ\x1a/\n\x06\x43hoice\"%\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08int_serv\x10\x01\x42\t\n\x07_choice\"\xb0\t\n\x1e\x46lowRSVPPathSenderTspecIntServ\x12\x42\n\x07version\x18\x01 \x01(\x0b\x32\x31.otg.PatternFlowRSVPPathSenderTspecIntServVersion\x12\x46\n\treserved1\x18\x02 \x01(\x0b\x32\x33.otg.PatternFlowRSVPPathSenderTspecIntServReserved1\x12O\n\x0eoverall_length\x18\x03 \x01(\x0b\x32\x37.otg.PatternFlowRSVPPathSenderTspecIntServOverallLength\x12O\n\x0eservice_header\x18\x04 \x01(\x0b\x32\x37.otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader\x12\x43\n\x08zero_bit\x18\x05 \x01(\x0b\x32\x31.otg.PatternFlowRSVPPathSenderTspecIntServZeroBit\x12\x46\n\treserved2\x18\x06 \x01(\x0b\x32\x33.otg.PatternFlowRSVPPathSenderTspecIntServReserved2\x12]\n\x16length_of_service_data\x18\x07 \x01(\x0b\x32=.otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData\x12n\n\x1fparameter_id_token_bucket_tspec\x18\x08 \x01(\x0b\x32\x45.otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec\x12V\n\x12parameter_127_flag\x18\t \x01(\x0b\x32:.otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag\x12Z\n\x14parameter_127_length\x18\n \x01(\x0b\x32<.otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length\x12\x1e\n\x11token_bucket_rate\x18\x0b \x01(\x02H\x00\x88\x01\x01\x12\x1e\n\x11token_bucket_size\x18\x0c \x01(\x02H\x01\x88\x01\x01\x12\x1b\n\x0epeak_data_rate\x18\r \x01(\x02H\x02\x88\x01\x01\x12Z\n\x14minimum_policed_unit\x18\x0e \x01(\x0b\x32<.otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit\x12X\n\x13maximum_packet_size\x18\x0f \x01(\x0b\x32;.otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeB\x14\n\x12_token_bucket_rateB\x14\n\x12_token_bucket_sizeB\x11\n\x0f_peak_data_rate\"\x8a\x01\n#FlowRSVPPathObjectsClassRecordRoute\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12\x38\n\x06\x63_type\x18\x02 \x01(\x0b\x32(.otg.FlowRSVPPathObjectsRecordRouteCType\"\xdd\x01\n#FlowRSVPPathObjectsRecordRouteCType\x12I\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x34.otg.FlowRSVPPathObjectsRecordRouteCType.Choice.EnumH\x00\x88\x01\x01\x12\x31\n\x06type_1\x18\x02 \x01(\x0b\x32!.otg.FlowRSVPPathRecordRouteType1\x1a-\n\x06\x43hoice\"#\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06type_1\x10\x01\x42\t\n\x07_choice\"[\n\x1c\x46lowRSVPPathRecordRouteType1\x12;\n\nsubobjects\x18\x01 \x03(\x0b\x32\'.otg.FlowRSVPType1RecordRouteSubobjects\"d\n\"FlowRSVPType1RecordRouteSubobjects\x12>\n\x04type\x18\x01 \x01(\x0b\x32\x30.otg.FlowRSVPPathObjectsRecordRouteSubObjectType\"\xc6\x02\n+FlowRSVPPathObjectsRecordRouteSubObjectType\x12Q\n\x06\x63hoice\x18\x01 \x01(\x0e\x32<.otg.FlowRSVPPathObjectsRecordRouteSubObjectType.Choice.EnumH\x00\x88\x01\x01\x12\x42\n\x0cipv4_address\x18\x02 \x01(\x0b\x32,.otg.FlowRSVPPathRecordRouteType1Ipv4Address\x12\x35\n\x05label\x18\x03 \x01(\x0b\x32&.otg.FlowRSVPPathRecordRouteType1Label\x1a>\n\x06\x43hoice\"4\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0cipv4_address\x10\x01\x12\t\n\x05label\x10\x02\x42\t\n\x07_choice\"\xb8\x02\n\'FlowRSVPPathRecordRouteType1Ipv4Address\x12.\n\x06length\x18\x01 \x01(\x0b\x32\x1e.otg.FlowRSVPRouteRecordLength\x12T\n\x0cipv4_address\x18\x02 \x01(\x0b\x32>.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address\x12V\n\rprefix_length\x18\x03 \x01(\x0b\x32?.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength\x12/\n\x05\x66lags\x18\x04 \x01(\x0b\x32 .otg.FlowRSVPRecordRouteIPv4Flag\"\xcb\x01\n\x1b\x46lowRSVPRecordRouteIPv4Flag\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.FlowRSVPRecordRouteIPv4Flag.Choice.EnumH\x00\x88\x01\x01\x1a^\n\x06\x43hoice\"T\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1e\n\x1alocal_protection_available\x10\x01\x12\x1b\n\x17local_protection_in_use\x10\x02\x42\t\n\x07_choice\"\x8c\x02\n!FlowRSVPPathRecordRouteType1Label\x12.\n\x06length\x18\x01 \x01(\x0b\x32\x1e.otg.FlowRSVPRouteRecordLength\x12\x41\n\x05\x66lags\x18\x02 \x01(\x0b\x32\x32.otg.PatternFlowRSVPPathRecordRouteType1LabelFlags\x12\x42\n\x06\x63_type\x18\x03 \x01(\x0b\x32\x32.otg.PatternFlowRSVPPathRecordRouteType1LabelCType\x12\x30\n\x05label\x18\x04 \x01(\x0b\x32!.otg.FlowRSVPPathRecordRouteLabel\"\xf4\x01\n\x1c\x46lowRSVPPathRecordRouteLabel\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.FlowRSVPPathRecordRouteLabel.Choice.EnumH\x00\x88\x01\x01\x12\x17\n\nas_integer\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06\x61s_hex\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a=\n\x06\x43hoice\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0e\n\nas_integer\x10\x01\x12\n\n\x06\x61s_hex\x10\x02\x42\t\n\x07_choiceB\r\n\x0b_as_integerB\t\n\x07_as_hex\"\xd9\x01\n\x19\x46lowRSVPRouteRecordLength\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.FlowRSVPRouteRecordLength.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\x9d\x01\n\x19\x46lowRSVPPathObjectsCustom\x12\x37\n\x04type\x18\x01 \x01(\x0b\x32).otg.PatternFlowRSVPPathObjectsCustomType\x12)\n\x06length\x18\x02 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12\x12\n\x05\x62ytes\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_bytes\"\xbe\x02\n\x08\x46lowSize\x12.\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x19.otg.FlowSize.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05\x66ixed\x18\x02 \x01(\rH\x01\x88\x01\x01\x12)\n\tincrement\x18\x03 \x01(\x0b\x32\x16.otg.FlowSizeIncrement\x12#\n\x06random\x18\x04 \x01(\x0b\x32\x13.otg.FlowSizeRandom\x12.\n\x0cweight_pairs\x18\x05 \x01(\x0b\x32\x18.otg.FlowSizeWeightPairs\x1aY\n\x06\x43hoice\"O\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05\x66ixed\x10\x01\x12\r\n\tincrement\x10\x02\x12\n\n\x06random\x10\x03\x12\x10\n\x0cweight_pairs\x10\x04\x42\t\n\x07_choiceB\x08\n\x06_fixed\"g\n\x11\x46lowSizeIncrement\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03\x65nd\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x11\n\x04step\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x06\n\x04_endB\x07\n\x05_step\"D\n\x0e\x46lowSizeRandom\x12\x10\n\x03min\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_max\"\x8d\x03\n\x13\x46lowSizeWeightPairs\x12\x39\n\x06\x63hoice\x18\x01 \x01(\x0e\x32$.otg.FlowSizeWeightPairs.Choice.EnumH\x00\x88\x01\x01\x12\x41\n\npredefined\x18\x02 \x01(\x0e\x32(.otg.FlowSizeWeightPairs.Predefined.EnumH\x01\x88\x01\x01\x12.\n\x06\x63ustom\x18\x03 \x03(\x0b\x32\x1e.otg.FlowSizeWeightPairsCustom\x1a=\n\x06\x43hoice\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0e\n\npredefined\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1ao\n\nPredefined\"a\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04imix\x10\x01\x12\x0e\n\nipsec_imix\x10\x02\x12\r\n\tipv6_imix\x10\x03\x12\x11\n\rstandard_imix\x10\x04\x12\x0c\n\x08tcp_imix\x10\x05\x42\t\n\x07_choiceB\r\n\x0b_predefined\"W\n\x19\x46lowSizeWeightPairsCustom\x12\x11\n\x04size\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x13\n\x06weight\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\x07\n\x05_sizeB\t\n\x07_weight\"\xd8\x02\n\x08\x46lowRate\x12.\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x19.otg.FlowRate.Choice.EnumH\x00\x88\x01\x01\x12\x10\n\x03pps\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x10\n\x03\x62ps\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12\x11\n\x04kbps\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x11\n\x04mbps\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x11\n\x04gbps\x18\x06 \x01(\rH\x05\x88\x01\x01\x12\x17\n\npercentage\x18\x07 \x01(\x02H\x06\x88\x01\x01\x1a\x61\n\x06\x43hoice\"W\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03pps\x10\x01\x12\x07\n\x03\x62ps\x10\x02\x12\x08\n\x04kbps\x10\x03\x12\x08\n\x04mbps\x10\x04\x12\x08\n\x04gbps\x10\x05\x12\x0e\n\npercentage\x10\x06\x42\t\n\x07_choiceB\x06\n\x04_ppsB\x06\n\x04_bpsB\x07\n\x05_kbpsB\x07\n\x05_mbpsB\x07\n\x05_gbpsB\r\n\x0b_percentage\"\xd5\x02\n\x0c\x46lowDuration\x12\x32\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1d.otg.FlowDuration.Choice.EnumH\x00\x88\x01\x01\x12,\n\rfixed_packets\x18\x02 \x01(\x0b\x32\x15.otg.FlowFixedPackets\x12,\n\rfixed_seconds\x18\x03 \x01(\x0b\x32\x15.otg.FlowFixedSeconds\x12\x1d\n\x05\x62urst\x18\x04 \x01(\x0b\x32\x0e.otg.FlowBurst\x12\'\n\ncontinuous\x18\x05 \x01(\x0b\x32\x13.otg.FlowContinuous\x1a\x62\n\x06\x43hoice\"X\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rfixed_packets\x10\x01\x12\x11\n\rfixed_seconds\x10\x02\x12\t\n\x05\x62urst\x10\x03\x12\x0e\n\ncontinuous\x10\x04\x42\t\n\x07_choice\"I\n\x0e\x46lowContinuous\x12\x10\n\x03gap\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1d\n\x05\x64\x65lay\x18\x02 \x01(\x0b\x32\x0e.otg.FlowDelayB\x06\n\x04_gap\"\x8c\x02\n\tFlowDelay\x12/\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1a.otg.FlowDelay.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05\x62ytes\x18\x02 \x01(\x02H\x01\x88\x01\x01\x12\x18\n\x0bnanoseconds\x18\x03 \x01(\x02H\x02\x88\x01\x01\x12\x19\n\x0cmicroseconds\x18\x04 \x01(\x02H\x03\x88\x01\x01\x1aO\n\x06\x43hoice\"E\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05\x62ytes\x10\x01\x12\x0f\n\x0bnanoseconds\x10\x02\x12\x10\n\x0cmicroseconds\x10\x03\x42\t\n\x07_choiceB\x08\n\x06_bytesB\x0e\n\x0c_nanosecondsB\x0f\n\r_microseconds\"m\n\x10\x46lowFixedPackets\x12\x14\n\x07packets\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03gap\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1d\n\x05\x64\x65lay\x18\x03 \x01(\x0b\x32\x0e.otg.FlowDelayB\n\n\x08_packetsB\x06\n\x04_gap\"m\n\x10\x46lowFixedSeconds\x12\x14\n\x07seconds\x18\x01 \x01(\x02H\x00\x88\x01\x01\x12\x10\n\x03gap\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1d\n\x05\x64\x65lay\x18\x03 \x01(\x0b\x32\x0e.otg.FlowDelayB\n\n\x08_secondsB\x06\n\x04_gap\"\xa0\x01\n\tFlowBurst\x12\x13\n\x06\x62ursts\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x14\n\x07packets\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x10\n\x03gap\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x37\n\x0finter_burst_gap\x18\x04 \x01(\x0b\x32\x1e.otg.FlowDurationInterBurstGapB\t\n\x07_burstsB\n\n\x08_packetsB\x06\n\x04_gap\"\xac\x02\n\x19\x46lowDurationInterBurstGap\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.FlowDurationInterBurstGap.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05\x62ytes\x18\x02 \x01(\x01H\x01\x88\x01\x01\x12\x18\n\x0bnanoseconds\x18\x03 \x01(\x01H\x02\x88\x01\x01\x12\x19\n\x0cmicroseconds\x18\x04 \x01(\x01H\x03\x88\x01\x01\x1aO\n\x06\x43hoice\"E\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05\x62ytes\x10\x01\x12\x0f\n\x0bnanoseconds\x10\x02\x12\x10\n\x0cmicroseconds\x10\x03\x42\t\n\x07_choiceB\x08\n\x06_bytesB\x0e\n\x0c_nanosecondsB\x0f\n\r_microseconds\"\xfd\x01\n\x0b\x46lowMetrics\x12\x13\n\x06\x65nable\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x11\n\x04loss\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\'\n\x0brx_tx_ratio\x18\x06 \x01(\x0b\x32\x12.otg.FlowRxTxRatio\x12\x17\n\ntimestamps\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12(\n\x07latency\x18\x04 \x01(\x0b\x32\x17.otg.FlowLatencyMetrics\x12\x37\n\x16predefined_metric_tags\x18\x05 \x01(\x0b\x32\x17.otg.FlowPredefinedTagsB\t\n\x07_enableB\x07\n\x05_lossB\r\n\x0b_timestamps\"\xb8\x01\n\x12\x46lowLatencyMetrics\x12\x13\n\x06\x65nable\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x34\n\x04mode\x18\x02 \x01(\x0e\x32!.otg.FlowLatencyMetrics.Mode.EnumH\x01\x88\x01\x01\x1a\x43\n\x04Mode\";\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rstore_forward\x10\x01\x12\x0f\n\x0b\x63ut_through\x10\x02\x42\t\n\x07_enableB\x07\n\x05_mode\"6\n\x12\x46lowPredefinedTags\x12\x14\n\x07rx_name\x18\x01 \x01(\x08H\x00\x88\x01\x01\x42\n\n\x08_rx_name\"\xd6\x01\n\rFlowRxTxRatio\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.FlowRxTxRatio.Choice.EnumH\x00\x88\x01\x01\x12+\n\x08rx_count\x18\x02 \x01(\x0b\x32\x19.otg.FlowRxTxRatioRxCount\x12\x12\n\x05value\x18\x03 \x01(\x02H\x01\x88\x01\x01\x1a:\n\x06\x43hoice\"0\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08rx_count\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x08\n\x06_value\"\x16\n\x14\x46lowRxTxRatioRxCount\"\xbf\x01\n\x05\x45vent\x12\x13\n\x06\x65nable\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x1c\n\x04link\x18\x02 \x01(\x0b\x32\x0e.otg.EventLink\x12\x34\n\x11rx_rate_threshold\x18\x03 \x01(\x0b\x32\x19.otg.EventRxRateThreshold\x12\x42\n\x18route_advertise_withdraw\x18\x04 \x01(\x0b\x32 .otg.EventRouteAdvertiseWithdrawB\t\n\x07_enable\"\\\n\x14\x45ventRxRateThreshold\x12\x13\n\x06\x65nable\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x16\n\tthreshold\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\t\n\x07_enableB\x0c\n\n_threshold\"+\n\tEventLink\x12\x13\n\x06\x65nable\x18\x01 \x01(\x08H\x00\x88\x01\x01\x42\t\n\x07_enable\"=\n\x1b\x45ventRouteAdvertiseWithdraw\x12\x13\n\x06\x65nable\x18\x01 \x01(\x08H\x00\x88\x01\x01\x42\t\n\x07_enable\"\xf5\x01\n\x0c\x45ventRequest\x12)\n\x04type\x18\x01 \x03(\x0e\x32\x1b.otg.EventRequest.Type.Enum\x12\x0e\n\x06source\x18\x02 \x03(\t\x1a\xa9\x01\n\x04Type\"\xa0\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tlink_down\x10\x01\x12\x0b\n\x07link_up\x10\x02\x12\x12\n\x0eroute_withdraw\x10\x03\x12\x13\n\x0froute_advertise\x10\x04\x12 \n\x1c\x66low_rx_rate_above_threshold\x10\x05\x12 \n\x1c\x66low_rx_rate_below_threshold\x10\x06\"b\n\x11\x45ventSubscription\x12!\n\x06\x65vents\x18\x01 \x01(\x0b\x32\x11.otg.EventRequest\x12\x19\n\x0c\x63\x61llback_url\x18\x02 \x01(\tH\x00\x88\x01\x01\x42\x0f\n\r_callback_url\"\xa5\x02\n\x04Lldp\x12\'\n\nconnection\x18\x01 \x01(\x0b\x32\x13.otg.LldpConnection\x12&\n\nchassis_id\x18\x02 \x01(\x0b\x32\x12.otg.LldpChassisId\x12 \n\x07port_id\x18\x03 \x01(\x0b\x32\x0f.otg.LldpPortId\x12(\n\x0bsystem_name\x18\x04 \x01(\x0b\x32\x13.otg.LldpSystemName\x12\x16\n\thold_time\x18\x05 \x01(\rH\x00\x88\x01\x01\x12#\n\x16\x61\x64vertisement_interval\x18\x06 \x01(\rH\x01\x88\x01\x01\x12\x11\n\x04name\x18\x07 \x01(\tH\x02\x88\x01\x01\x42\x0c\n\n_hold_timeB\x19\n\x17_advertisement_intervalB\x07\n\x05_name\"\xa9\x01\n\x0eLldpConnection\x12\x34\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1f.otg.LldpConnection.Choice.EnumH\x00\x88\x01\x01\x12\x16\n\tport_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x1a\x30\n\x06\x43hoice\"&\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tport_name\x10\x01\x42\t\n\x07_choiceB\x0c\n\n_port_name\"\xe1\x02\n\rLldpChassisId\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.LldpChassisId.Choice.EnumH\x00\x88\x01\x01\x12\x37\n\x13mac_address_subtype\x18\x02 \x01(\x0b\x32\x1a.otg.LldpChassisMacSubType\x12#\n\x16interface_name_subtype\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x1a\n\rlocal_subtype\x18\x04 \x01(\tH\x02\x88\x01\x01\x1ai\n\x06\x43hoice\"_\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x17\n\x13mac_address_subtype\x10\x01\x12\x1a\n\x16interface_name_subtype\x10\x02\x12\x11\n\rlocal_subtype\x10\x03\x42\t\n\x07_choiceB\x19\n\x17_interface_name_subtypeB\x10\n\x0e_local_subtype\"\xdf\x02\n\nLldpPortId\x12\x30\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1b.otg.LldpPortId.Choice.EnumH\x00\x88\x01\x01\x12 \n\x13mac_address_subtype\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x41\n\x16interface_name_subtype\x18\x03 \x01(\x0b\x32!.otg.LldpPortInterfaceNameSubType\x12\x1a\n\rlocal_subtype\x18\x04 \x01(\tH\x02\x88\x01\x01\x1ai\n\x06\x43hoice\"_\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x17\n\x13mac_address_subtype\x10\x01\x12\x1a\n\x16interface_name_subtype\x10\x02\x12\x11\n\rlocal_subtype\x10\x03\x42\t\n\x07_choiceB\x16\n\x14_mac_address_subtypeB\x10\n\x0e_local_subtype\"\xd1\x01\n\x15LldpChassisMacSubType\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.LldpChassisMacSubType.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xdf\x01\n\x1cLldpPortInterfaceNameSubType\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.LldpPortInterfaceNameSubType.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xc3\x01\n\x0eLldpSystemName\x12\x34\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1f.otg.LldpSystemName.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xa4\x01\n\x05\x45rror\x12\x11\n\x04\x63ode\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\'\n\x04kind\x18\x02 \x01(\x0e\x32\x14.otg.Error.Kind.EnumH\x01\x88\x01\x01\x12\x0e\n\x06\x65rrors\x18\x03 \x03(\t\x1a=\n\x04Kind\"5\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0e\n\nvalidation\x10\x01\x12\x0c\n\x08internal\x10\x02\x42\x07\n\x05_codeB\x07\n\x05_kind\"\x1b\n\x07Warning\x12\x10\n\x08warnings\x18\x01 \x03(\t\"\x9c\x01\n\x0c\x43onfigUpdate\x12\x32\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1d.otg.ConfigUpdate.Choice.EnumH\x00\x88\x01\x01\x12\x1f\n\x05\x66lows\x18\x02 \x01(\x0b\x32\x10.otg.FlowsUpdate\x1a,\n\x06\x43hoice\"\"\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05\x66lows\x10\x01\x42\t\n\x07_choice\"\xa2\x01\n\x0b\x46lowsUpdate\x12;\n\x0eproperty_names\x18\x01 \x03(\x0e\x32#.otg.FlowsUpdate.PropertyNames.Enum\x12\x18\n\x05\x66lows\x18\x02 \x03(\x0b\x32\t.otg.Flow\x1a<\n\rPropertyNames\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04rate\x10\x01\x12\x08\n\x04size\x10\x02\"\xfd\x01\n\x0c\x43ontrolState\x12\x32\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1d.otg.ControlState.Choice.EnumH\x00\x88\x01\x01\x12\x1c\n\x04port\x18\x02 \x01(\x0b\x32\x0e.otg.StatePort\x12$\n\x08protocol\x18\x03 \x01(\x0b\x32\x12.otg.StateProtocol\x12\"\n\x07traffic\x18\x04 \x01(\x0b\x32\x11.otg.StateTraffic\x1a\x46\n\x06\x43hoice\"<\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04port\x10\x01\x12\x0c\n\x08protocol\x10\x02\x12\x0b\n\x07traffic\x10\x03\x42\t\n\x07_choice\"\xcb\x01\n\tStatePort\x12/\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1a.otg.StatePort.Choice.EnumH\x00\x88\x01\x01\x12 \n\x04link\x18\x02 \x01(\x0b\x32\x12.otg.StatePortLink\x12&\n\x07\x63\x61pture\x18\x03 \x01(\x0b\x32\x15.otg.StatePortCapture\x1a\x38\n\x06\x43hoice\".\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04link\x10\x01\x12\x0b\n\x07\x63\x61pture\x10\x02\x42\t\n\x07_choice\"\xb9\x01\n\x0cStateTraffic\x12\x32\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1d.otg.StateTraffic.Choice.EnumH\x00\x88\x01\x01\x12\x34\n\rflow_transmit\x18\x02 \x01(\x0b\x32\x1d.otg.StateTrafficFlowTransmit\x1a\x34\n\x06\x43hoice\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rflow_transmit\x10\x01\x42\t\n\x07_choice\"\xdf\x02\n\rStateProtocol\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.StateProtocol.Choice.EnumH\x00\x88\x01\x01\x12\"\n\x03\x61ll\x18\x02 \x01(\x0b\x32\x15.otg.StateProtocolAll\x12&\n\x05route\x18\x03 \x01(\x0b\x32\x17.otg.StateProtocolRoute\x12$\n\x04lacp\x18\x04 \x01(\x0b\x32\x16.otg.StateProtocolLacp\x12\"\n\x03\x62gp\x18\x05 \x01(\x0b\x32\x15.otg.StateProtocolBgp\x12$\n\x04isis\x18\x06 \x01(\x0b\x32\x16.otg.StateProtocolIsis\x1aR\n\x06\x43hoice\"H\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03\x61ll\x10\x01\x12\t\n\x05route\x10\x02\x12\x08\n\x04lacp\x10\x03\x12\x07\n\x03\x62gp\x10\x04\x12\x08\n\x04isis\x10\x05\x42\t\n\x07_choice\"\x94\x01\n\rStatePortLink\x12\x12\n\nport_names\x18\x01 \x03(\t\x12\x31\n\x05state\x18\x02 \x01(\x0e\x32\x1d.otg.StatePortLink.State.EnumH\x00\x88\x01\x01\x1a\x32\n\x05State\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x08\n\x06_state\"\x9d\x01\n\x10StatePortCapture\x12\x12\n\nport_names\x18\x01 \x03(\t\x12\x34\n\x05state\x18\x02 \x01(\x0e\x32 .otg.StatePortCapture.State.EnumH\x00\x88\x01\x01\x1a\x35\n\x05State\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05start\x10\x01\x12\x08\n\x04stop\x10\x02\x42\x08\n\x06_state\"\xc4\x01\n\x18StateTrafficFlowTransmit\x12\x12\n\nflow_names\x18\x01 \x03(\t\x12<\n\x05state\x18\x02 \x01(\x0e\x32(.otg.StateTrafficFlowTransmit.State.EnumH\x00\x88\x01\x01\x1aL\n\x05State\"C\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05start\x10\x01\x12\x08\n\x04stop\x10\x02\x12\t\n\x05pause\x10\x03\x12\n\n\x06resume\x10\x04\x42\x08\n\x06_state\"\x89\x01\n\x10StateProtocolAll\x12\x34\n\x05state\x18\x01 \x01(\x0e\x32 .otg.StateProtocolAll.State.EnumH\x00\x88\x01\x01\x1a\x35\n\x05State\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05start\x10\x01\x12\x08\n\x04stop\x10\x02\x42\x08\n\x06_state\"\xa4\x01\n\x12StateProtocolRoute\x12\r\n\x05names\x18\x01 \x03(\t\x12\x36\n\x05state\x18\x02 \x01(\x0e\x32\".otg.StateProtocolRoute.State.EnumH\x00\x88\x01\x01\x1a=\n\x05State\"4\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08withdraw\x10\x01\x12\r\n\tadvertise\x10\x02\x42\x08\n\x06_state\"\xfc\x01\n\x11StateProtocolLacp\x12\x37\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\".otg.StateProtocolLacp.Choice.EnumH\x00\x88\x01\x01\x12*\n\x05\x61\x64min\x18\x02 \x01(\x0b\x32\x1b.otg.StateProtocolLacpAdmin\x12\x37\n\x0cmember_ports\x18\x03 \x01(\x0b\x32!.otg.StateProtocolLacpMemberPorts\x1a>\n\x06\x43hoice\"4\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05\x61\x64min\x10\x01\x12\x10\n\x0cmember_ports\x10\x02\x42\t\n\x07_choice\"\xac\x01\n\x16StateProtocolLacpAdmin\x12\x18\n\x10lag_member_names\x18\x01 \x03(\t\x12:\n\x05state\x18\x02 \x01(\x0e\x32&.otg.StateProtocolLacpAdmin.State.EnumH\x00\x88\x01\x01\x1a\x32\n\x05State\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x08\n\x06_state\"\xb8\x01\n\x1cStateProtocolLacpMemberPorts\x12\x18\n\x10lag_member_names\x18\x01 \x03(\t\x12@\n\x05state\x18\x02 \x01(\x0e\x32,.otg.StateProtocolLacpMemberPorts.State.EnumH\x00\x88\x01\x01\x1a\x32\n\x05State\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x08\n\x06_state\"\xae\x01\n\x10StateProtocolBgp\x12\x36\n\x06\x63hoice\x18\x01 \x01(\x0e\x32!.otg.StateProtocolBgp.Choice.EnumH\x00\x88\x01\x01\x12)\n\x05peers\x18\x02 \x01(\x0b\x32\x1a.otg.StateProtocolBgpPeers\x1a,\n\x06\x43hoice\"\"\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05peers\x10\x01\x42\t\n\x07_choice\"\xa4\x01\n\x15StateProtocolBgpPeers\x12\x12\n\npeer_names\x18\x01 \x03(\t\x12\x39\n\x05state\x18\x02 \x01(\x0e\x32%.otg.StateProtocolBgpPeers.State.EnumH\x00\x88\x01\x01\x1a\x32\n\x05State\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x08\n\x06_state\"\xb7\x01\n\x11StateProtocolIsis\x12\x37\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\".otg.StateProtocolIsis.Choice.EnumH\x00\x88\x01\x01\x12.\n\x07routers\x18\x02 \x01(\x0b\x32\x1d.otg.StateProtocolIsisRouters\x1a.\n\x06\x43hoice\"$\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07routers\x10\x01\x42\t\n\x07_choice\"\xac\x01\n\x18StateProtocolIsisRouters\x12\x14\n\x0crouter_names\x18\x01 \x03(\t\x12<\n\x05state\x18\x02 \x01(\x0e\x32(.otg.StateProtocolIsisRouters.State.EnumH\x00\x88\x01\x01\x1a\x32\n\x05State\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x08\n\x06_state\"\xa7\x01\n\rControlAction\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.ControlAction.Choice.EnumH\x00\x88\x01\x01\x12%\n\x08protocol\x18\x02 \x01(\x0b\x32\x13.otg.ActionProtocol\x1a/\n\x06\x43hoice\"%\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08protocol\x10\x01\x42\t\n\x07_choice\"P\n\x15\x43ontrolActionResponse\x12\x10\n\x08warnings\x18\x01 \x03(\t\x12%\n\x08response\x18\x02 \x01(\x0b\x32\x13.otg.ActionResponse\"\xb1\x01\n\x0e\x41\x63tionResponse\x12\x34\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1f.otg.ActionResponse.Choice.EnumH\x00\x88\x01\x01\x12-\n\x08protocol\x18\x02 \x01(\x0b\x32\x1b.otg.ActionResponseProtocol\x1a/\n\x06\x43hoice\"%\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08protocol\x10\x01\x42\t\n\x07_choice\"\x84\x02\n\x0e\x41\x63tionProtocol\x12\x34\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1f.otg.ActionProtocol.Choice.EnumH\x00\x88\x01\x01\x12%\n\x04ipv4\x18\x02 \x01(\x0b\x32\x17.otg.ActionProtocolIpv4\x12%\n\x04ipv6\x18\x03 \x01(\x0b\x32\x17.otg.ActionProtocolIpv6\x12#\n\x03\x62gp\x18\x04 \x01(\x0b\x32\x16.otg.ActionProtocolBgp\x1a>\n\x06\x43hoice\"4\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x12\x07\n\x03\x62gp\x10\x03\x42\t\n\x07_choice\"\xf6\x01\n\x16\x41\x63tionResponseProtocol\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.ActionResponseProtocol.Choice.EnumH\x00\x88\x01\x01\x12-\n\x04ipv4\x18\x02 \x01(\x0b\x32\x1f.otg.ActionResponseProtocolIpv4\x12-\n\x04ipv6\x18\x03 \x01(\x0b\x32\x1f.otg.ActionResponseProtocolIpv6\x1a\x35\n\x06\x43hoice\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x42\t\n\x07_choice\"\xb1\x01\n\x12\x41\x63tionProtocolIpv4\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.ActionProtocolIpv4.Choice.EnumH\x00\x88\x01\x01\x12)\n\x04ping\x18\x02 \x01(\x0b\x32\x1b.otg.ActionProtocolIpv4Ping\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ping\x10\x01\x42\t\n\x07_choice\"\xc9\x01\n\x1a\x41\x63tionResponseProtocolIpv4\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.ActionResponseProtocolIpv4.Choice.EnumH\x00\x88\x01\x01\x12\x31\n\x04ping\x18\x02 \x01(\x0b\x32#.otg.ActionResponseProtocolIpv4Ping\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ping\x10\x01\x42\t\n\x07_choice\"N\n\x16\x41\x63tionProtocolIpv4Ping\x12\x34\n\x08requests\x18\x01 \x03(\x0b\x32\".otg.ActionProtocolIpv4PingRequest\"c\n\x1d\x41\x63tionProtocolIpv4PingRequest\x12\x15\n\x08src_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06\x64st_ip\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x0b\n\t_src_nameB\t\n\x07_dst_ip\"`\n\x1e\x41\x63tionResponseProtocolIpv4Ping\x12>\n\tresponses\x18\x01 \x03(\x0b\x32+.otg.ActionResponseProtocolIpv4PingResponse\"\x83\x02\n&ActionResponseProtocolIpv4PingResponse\x12\x15\n\x08src_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06\x64st_ip\x18\x02 \x01(\tH\x01\x88\x01\x01\x12L\n\x06result\x18\x03 \x01(\x0e\x32\x37.otg.ActionResponseProtocolIpv4PingResponse.Result.EnumH\x02\x88\x01\x01\x1a<\n\x06Result\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tsucceeded\x10\x01\x12\n\n\x06\x66\x61iled\x10\x02\x42\x0b\n\t_src_nameB\t\n\x07_dst_ipB\t\n\x07_result\"\xb1\x01\n\x12\x41\x63tionProtocolIpv6\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.ActionProtocolIpv6.Choice.EnumH\x00\x88\x01\x01\x12)\n\x04ping\x18\x02 \x01(\x0b\x32\x1b.otg.ActionProtocolIpv6Ping\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ping\x10\x01\x42\t\n\x07_choice\"\xc9\x01\n\x1a\x41\x63tionResponseProtocolIpv6\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.ActionResponseProtocolIpv6.Choice.EnumH\x00\x88\x01\x01\x12\x31\n\x04ping\x18\x02 \x01(\x0b\x32#.otg.ActionResponseProtocolIpv6Ping\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ping\x10\x01\x42\t\n\x07_choice\"N\n\x16\x41\x63tionProtocolIpv6Ping\x12\x34\n\x08requests\x18\x01 \x03(\x0b\x32\".otg.ActionProtocolIpv6PingRequest\"c\n\x1d\x41\x63tionProtocolIpv6PingRequest\x12\x15\n\x08src_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06\x64st_ip\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x0b\n\t_src_nameB\t\n\x07_dst_ip\"`\n\x1e\x41\x63tionResponseProtocolIpv6Ping\x12>\n\tresponses\x18\x01 \x03(\x0b\x32+.otg.ActionResponseProtocolIpv6PingResponse\"\x83\x02\n&ActionResponseProtocolIpv6PingResponse\x12\x15\n\x08src_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06\x64st_ip\x18\x02 \x01(\tH\x01\x88\x01\x01\x12L\n\x06result\x18\x03 \x01(\x0e\x32\x37.otg.ActionResponseProtocolIpv6PingResponse.Result.EnumH\x02\x88\x01\x01\x1a<\n\x06Result\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tsucceeded\x10\x01\x12\n\n\x06\x66\x61iled\x10\x02\x42\x0b\n\t_src_nameB\t\n\x07_dst_ipB\t\n\x07_result\"\xb7\x02\n\x11\x41\x63tionProtocolBgp\x12\x37\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\".otg.ActionProtocolBgp.Choice.EnumH\x00\x88\x01\x01\x12\x38\n\x0cnotification\x18\x02 \x01(\x0b\x32\".otg.ActionProtocolBgpNotification\x12P\n\x19initiate_graceful_restart\x18\x03 \x01(\x0b\x32-.otg.ActionProtocolBgpInitiateGracefulRestart\x1aR\n\x06\x43hoice\"H\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0cnotification\x10\x01\x12\x1d\n\x19initiate_graceful_restart\x10\x02\x42\t\n\x07_choice\"\xd5\x05\n\x1d\x41\x63tionProtocolBgpNotification\x12\r\n\x05names\x18\x01 \x03(\t\x12\x43\n\x06\x63hoice\x18\x02 \x01(\x0e\x32..otg.ActionProtocolBgpNotification.Choice.EnumH\x00\x88\x01\x01\x12\'\n\x05\x63\x65\x61se\x18\x03 \x01(\x0b\x32\x18.otg.DeviceBgpCeaseError\x12>\n\x14message_header_error\x18\x04 \x01(\x0b\x32 .otg.DeviceBgpMessageHeaderError\x12:\n\x12open_message_error\x18\x05 \x01(\x0b\x32\x1e.otg.DeviceBgpOpenMessageError\x12>\n\x14update_message_error\x18\x06 \x01(\x0b\x32 .otg.DeviceBgpUpdateMessageError\x12:\n\x12hold_timer_expired\x18\x07 \x01(\x0b\x32\x1e.otg.DeviceBgpHoldTimerExpired\x12I\n\x1a\x66inite_state_machine_error\x18\x08 \x01(\x0b\x32%.otg.DeviceBgpFiniteStateMachineError\x12)\n\x06\x63ustom\x18\t \x01(\x0b\x32\x19.otg.DeviceBgpCustomError\x1a\xbd\x01\n\x06\x43hoice\"\xb2\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05\x63\x65\x61se\x10\x01\x12\x18\n\x14message_header_error\x10\x02\x12\x16\n\x12open_message_error\x10\x03\x12\x18\n\x14update_message_error\x10\x04\x12\x16\n\x12hold_timer_expired\x10\x05\x12\x1e\n\x1a\x66inite_state_machine_error\x10\x06\x12\n\n\x06\x63ustom\x10\x07\x42\t\n\x07_choice\"l\n(ActionProtocolBgpInitiateGracefulRestart\x12\x12\n\npeer_names\x18\x01 \x03(\t\x12\x1a\n\rrestart_delay\x18\x02 \x01(\rH\x00\x88\x01\x01\x42\x10\n\x0e_restart_delay\"\xc8\x05\n\x0eMetricsRequest\x12\x34\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1f.otg.MetricsRequest.Choice.EnumH\x00\x88\x01\x01\x12%\n\x04port\x18\x02 \x01(\x0b\x32\x17.otg.PortMetricsRequest\x12%\n\x04\x66low\x18\x03 \x01(\x0b\x32\x17.otg.FlowMetricsRequest\x12\'\n\x05\x62gpv4\x18\x04 \x01(\x0b\x32\x18.otg.Bgpv4MetricsRequest\x12\'\n\x05\x62gpv6\x18\x05 \x01(\x0b\x32\x18.otg.Bgpv6MetricsRequest\x12%\n\x04isis\x18\x06 \x01(\x0b\x32\x17.otg.IsisMetricsRequest\x12#\n\x03lag\x18\x07 \x01(\x0b\x32\x16.otg.LagMetricsRequest\x12%\n\x04lacp\x18\x08 \x01(\x0b\x32\x17.otg.LacpMetricsRequest\x12%\n\x04lldp\x18\t \x01(\x0b\x32\x17.otg.LldpMetricsRequest\x12%\n\x04rsvp\x18\n \x01(\x0b\x32\x17.otg.RsvpMetricsRequest\x12\x36\n\rdhcpv4_client\x18\x0b \x01(\x0b\x32\x1f.otg.Dhcpv4ClientMetricsRequest\x12\x36\n\rdhcpv4_server\x18\x0c \x01(\x0b\x32\x1f.otg.Dhcpv4ServerMetricsRequest\x1a\xa3\x01\n\x06\x43hoice\"\x98\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04port\x10\x01\x12\x08\n\x04\x66low\x10\x02\x12\t\n\x05\x62gpv4\x10\x03\x12\t\n\x05\x62gpv6\x10\x04\x12\x08\n\x04isis\x10\x05\x12\x07\n\x03lag\x10\x06\x12\x08\n\x04lacp\x10\x07\x12\x08\n\x04lldp\x10\x08\x12\x08\n\x04rsvp\x10\t\x12\x11\n\rdhcpv4_client\x10\n\x12\x11\n\rdhcpv4_server\x10\x0b\x42\t\n\x07_choice\"\x90\x06\n\x0fMetricsResponse\x12\x35\n\x06\x63hoice\x18\x01 \x01(\x0e\x32 .otg.MetricsResponse.Choice.EnumH\x00\x88\x01\x01\x12%\n\x0cport_metrics\x18\x02 \x03(\x0b\x32\x0f.otg.PortMetric\x12%\n\x0c\x66low_metrics\x18\x03 \x03(\x0b\x32\x0f.otg.FlowMetric\x12\'\n\rbgpv4_metrics\x18\x04 \x03(\x0b\x32\x10.otg.Bgpv4Metric\x12\'\n\rbgpv6_metrics\x18\x05 \x03(\x0b\x32\x10.otg.Bgpv6Metric\x12%\n\x0cisis_metrics\x18\x06 \x03(\x0b\x32\x0f.otg.IsisMetric\x12#\n\x0blag_metrics\x18\x07 \x03(\x0b\x32\x0e.otg.LagMetric\x12%\n\x0clacp_metrics\x18\x08 \x03(\x0b\x32\x0f.otg.LacpMetric\x12%\n\x0clldp_metrics\x18\t \x03(\x0b\x32\x0f.otg.LldpMetric\x12%\n\x0crsvp_metrics\x18\n \x03(\x0b\x32\x0f.otg.RsvpMetric\x12\x35\n\x14\x64hcpv4client_metrics\x18\x0b \x03(\x0b\x32\x17.otg.Dhcpv4ClientMetric\x12\x35\n\x14\x64hcpv4server_metrics\x18\x0c \x03(\x0b\x32\x17.otg.Dhcpv4ServerMetric\x1a\xeb\x01\n\x06\x43hoice\"\xe0\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0c\x66low_metrics\x10\x01\x12\x10\n\x0cport_metrics\x10\x02\x12\x11\n\rbgpv4_metrics\x10\x03\x12\x11\n\rbgpv6_metrics\x10\x04\x12\x10\n\x0cisis_metrics\x10\x05\x12\x0f\n\x0blag_metrics\x10\x06\x12\x10\n\x0clacp_metrics\x10\x07\x12\x10\n\x0clldp_metrics\x10\x08\x12\x10\n\x0crsvp_metrics\x10\t\x12\x11\n\rdhcpv4_client\x10\n\x12\x11\n\rdhcpv4_server\x10\x0b\x42\t\n\x07_choice\"\xcd\x02\n\x12PortMetricsRequest\x12\x12\n\nport_names\x18\x01 \x03(\t\x12>\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32(.otg.PortMetricsRequest.ColumnNames.Enum\x1a\xe2\x01\n\x0b\x43olumnNames\"\xd2\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08transmit\x10\x01\x12\x0c\n\x08location\x10\x02\x12\x08\n\x04link\x10\x03\x12\x0b\n\x07\x63\x61pture\x10\x04\x12\r\n\tframes_tx\x10\x05\x12\r\n\tframes_rx\x10\x06\x12\x0c\n\x08\x62ytes_tx\x10\x07\x12\x0c\n\x08\x62ytes_rx\x10\x08\x12\x12\n\x0e\x66rames_tx_rate\x10\t\x12\x12\n\x0e\x66rames_rx_rate\x10\n\x12\x11\n\rbytes_tx_rate\x10\x0b\x12\x11\n\rbytes_rx_rate\x10\x0c\"\x86\x06\n\nPortMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08location\x18\x02 \x01(\tH\x01\x88\x01\x01\x12,\n\x04link\x18\x03 \x01(\x0e\x32\x19.otg.PortMetric.Link.EnumH\x02\x88\x01\x01\x12\x32\n\x07\x63\x61pture\x18\x04 \x01(\x0e\x32\x1c.otg.PortMetric.Capture.EnumH\x03\x88\x01\x01\x12\x16\n\tframes_tx\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x16\n\tframes_rx\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12\x15\n\x08\x62ytes_tx\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x15\n\x08\x62ytes_rx\x18\x08 \x01(\x04H\x07\x88\x01\x01\x12\x1b\n\x0e\x66rames_tx_rate\x18\t \x01(\x02H\x08\x88\x01\x01\x12\x1b\n\x0e\x66rames_rx_rate\x18\n \x01(\x02H\t\x88\x01\x01\x12\x1a\n\rbytes_tx_rate\x18\x0b \x01(\x02H\n\x88\x01\x01\x12\x1a\n\rbytes_rx_rate\x18\x0c \x01(\x02H\x0b\x88\x01\x01\x12\x34\n\x08transmit\x18\r \x01(\x0e\x32\x1d.otg.PortMetric.Transmit.EnumH\x0c\x88\x01\x01\x1a\x31\n\x04Link\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x1a<\n\x07\x43\x61pture\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07started\x10\x01\x12\x0b\n\x07stopped\x10\x02\x1a=\n\x08Transmit\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07started\x10\x01\x12\x0b\n\x07stopped\x10\x02\x42\x07\n\x05_nameB\x0b\n\t_locationB\x07\n\x05_linkB\n\n\x08_captureB\x0c\n\n_frames_txB\x0c\n\n_frames_rxB\x0b\n\t_bytes_txB\x0b\n\t_bytes_rxB\x11\n\x0f_frames_tx_rateB\x11\n\x0f_frames_rx_rateB\x10\n\x0e_bytes_tx_rateB\x10\n\x0e_bytes_rx_rateB\x0b\n\t_transmit\"\xb8\x02\n\x12\x46lowMetricsRequest\x12\x12\n\nflow_names\x18\x01 \x03(\t\x12>\n\x0cmetric_names\x18\x03 \x03(\x0e\x32(.otg.FlowMetricsRequest.MetricNames.Enum\x12\x34\n\x0etagged_metrics\x18\x04 \x01(\x0b\x32\x1c.otg.FlowTaggedMetricsFilter\x1a\x97\x01\n\x0bMetricNames\"\x87\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08transmit\x10\x01\x12\r\n\tframes_tx\x10\x02\x12\r\n\tframes_rx\x10\x03\x12\x0c\n\x08\x62ytes_tx\x10\x04\x12\x0c\n\x08\x62ytes_rx\x10\x05\x12\x12\n\x0e\x66rames_tx_rate\x10\x06\x12\x12\n\x0e\x66rames_rx_rate\x10\x07\"\xf4\x02\n\x17\x46lowTaggedMetricsFilter\x12\x14\n\x07include\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\"\n\x15include_empty_metrics\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x43\n\x0cmetric_names\x18\x03 \x03(\x0e\x32-.otg.FlowTaggedMetricsFilter.MetricNames.Enum\x12)\n\x07\x66ilters\x18\x04 \x03(\x0b\x32\x18.otg.FlowMetricTagFilter\x1a\x88\x01\n\x0bMetricNames\"y\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tframes_tx\x10\x01\x12\r\n\tframes_rx\x10\x02\x12\x0c\n\x08\x62ytes_tx\x10\x03\x12\x0c\n\x08\x62ytes_rx\x10\x04\x12\x12\n\x0e\x66rames_tx_rate\x10\x05\x12\x12\n\x0e\x66rames_rx_rate\x10\x06\x42\n\n\x08_includeB\x18\n\x16_include_empty_metrics\"A\n\x13\x46lowMetricTagFilter\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x0e\n\x06values\x18\x02 \x03(\tB\x07\n\x05_name\"\x88\x05\n\nFlowMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x07port_tx\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x14\n\x07port_rx\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x34\n\x08transmit\x18\x05 \x01(\x0e\x32\x1d.otg.FlowMetric.Transmit.EnumH\x03\x88\x01\x01\x12\x16\n\tframes_tx\x18\x06 \x01(\x04H\x04\x88\x01\x01\x12\x16\n\tframes_rx\x18\x07 \x01(\x04H\x05\x88\x01\x01\x12\x15\n\x08\x62ytes_tx\x18\x08 \x01(\x04H\x06\x88\x01\x01\x12\x15\n\x08\x62ytes_rx\x18\t \x01(\x04H\x07\x88\x01\x01\x12\x1b\n\x0e\x66rames_tx_rate\x18\n \x01(\x02H\x08\x88\x01\x01\x12\x1b\n\x0e\x66rames_rx_rate\x18\x0b \x01(\x02H\t\x88\x01\x01\x12\x11\n\x04loss\x18\x0c \x01(\x02H\n\x88\x01\x01\x12(\n\ntimestamps\x18\r \x01(\x0b\x32\x14.otg.MetricTimestamp\x12#\n\x07latency\x18\x0e \x01(\x0b\x32\x12.otg.MetricLatency\x12-\n\x0etagged_metrics\x18\x0f \x03(\x0b\x32\x15.otg.FlowTaggedMetric\x1aI\n\x08Transmit\"=\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07started\x10\x01\x12\x0b\n\x07stopped\x10\x02\x12\n\n\x06paused\x10\x03\x42\x07\n\x05_nameB\n\n\x08_port_txB\n\n\x08_port_rxB\x0b\n\t_transmitB\x0c\n\n_frames_txB\x0c\n\n_frames_rxB\x0b\n\t_bytes_txB\x0b\n\t_bytes_rxB\x11\n\x0f_frames_tx_rateB\x11\n\x0f_frames_rx_rateB\x07\n\x05_loss\"\x93\x03\n\x10\x46lowTaggedMetric\x12 \n\x04tags\x18\x01 \x03(\x0b\x32\x12.otg.FlowMetricTag\x12\x16\n\tframes_tx\x18\x02 \x01(\x04H\x00\x88\x01\x01\x12\x16\n\tframes_rx\x18\x03 \x01(\x04H\x01\x88\x01\x01\x12\x15\n\x08\x62ytes_tx\x18\x04 \x01(\x04H\x02\x88\x01\x01\x12\x15\n\x08\x62ytes_rx\x18\x05 \x01(\x04H\x03\x88\x01\x01\x12\x1b\n\x0e\x66rames_tx_rate\x18\x06 \x01(\x02H\x04\x88\x01\x01\x12\x1b\n\x0e\x66rames_rx_rate\x18\x07 \x01(\x02H\x05\x88\x01\x01\x12\x11\n\x04loss\x18\x08 \x01(\x02H\x06\x88\x01\x01\x12(\n\ntimestamps\x18\t \x01(\x0b\x32\x14.otg.MetricTimestamp\x12#\n\x07latency\x18\n \x01(\x0b\x32\x12.otg.MetricLatencyB\x0c\n\n_frames_txB\x0c\n\n_frames_rxB\x0b\n\t_bytes_txB\x0b\n\t_bytes_rxB\x11\n\x0f_frames_tx_rateB\x11\n\x0f_frames_rx_rateB\x07\n\x05_loss\"S\n\rFlowMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.otg.FlowMetricTagValueB\x07\n\x05_name\"\xc2\x01\n\x12\x46lowMetricTagValue\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.FlowMetricTagValue.Choice.EnumH\x00\x88\x01\x01\x12\x10\n\x03hex\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x10\n\x03str\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\x33\n\x06\x43hoice\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03hex\x10\x01\x12\x07\n\x03str\x10\x02\x42\t\n\x07_choiceB\x06\n\x04_hexB\x06\n\x04_str\"\x7f\n\x0fMetricTimestamp\x12\x1f\n\x12\x66irst_timestamp_ns\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x1e\n\x11last_timestamp_ns\x18\x02 \x01(\x01H\x01\x88\x01\x01\x42\x15\n\x13_first_timestamp_nsB\x14\n\x12_last_timestamp_ns\"\x87\x01\n\rMetricLatency\x12\x17\n\nminimum_ns\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x17\n\nmaximum_ns\x18\x02 \x01(\x01H\x01\x88\x01\x01\x12\x17\n\naverage_ns\x18\x03 \x01(\x01H\x02\x88\x01\x01\x42\r\n\x0b_minimum_nsB\r\n\x0b_maximum_nsB\r\n\x0b_average_ns\"\xf9\x03\n\x13\x42gpv4MetricsRequest\x12\x12\n\npeer_names\x18\x01 \x03(\t\x12?\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32).otg.Bgpv4MetricsRequest.ColumnNames.Enum\x1a\x8c\x03\n\x0b\x43olumnNames\"\xfc\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rsession_state\x10\x01\x12\x16\n\x12session_flap_count\x10\x02\x12\x15\n\x11routes_advertised\x10\x03\x12\x13\n\x0froutes_received\x10\x04\x12\x18\n\x14route_withdraws_sent\x10\x05\x12\x1c\n\x18route_withdraws_received\x10\x06\x12\x10\n\x0cupdates_sent\x10\x07\x12\x14\n\x10updates_received\x10\x08\x12\x0e\n\nopens_sent\x10\t\x12\x12\n\x0eopens_received\x10\n\x12\x13\n\x0fkeepalives_sent\x10\x0b\x12\x17\n\x13keepalives_received\x10\x0c\x12\x16\n\x12notifications_sent\x10\r\x12\x1a\n\x16notifications_received\x10\x0e\x12\r\n\tfsm_state\x10\x0f\x12\x17\n\x13\x65nd_of_rib_received\x10\x10\"\xea\x08\n\x0b\x42gpv4Metric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12>\n\rsession_state\x18\x02 \x01(\x0e\x32\".otg.Bgpv4Metric.SessionState.EnumH\x01\x88\x01\x01\x12\x1f\n\x12session_flap_count\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12\x1e\n\x11routes_advertised\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x1c\n\x0froutes_received\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12!\n\x14route_withdraws_sent\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12%\n\x18route_withdraws_received\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x19\n\x0cupdates_sent\x18\x08 \x01(\x04H\x07\x88\x01\x01\x12\x1d\n\x10updates_received\x18\t \x01(\x04H\x08\x88\x01\x01\x12\x17\n\nopens_sent\x18\n \x01(\x04H\t\x88\x01\x01\x12\x1b\n\x0eopens_received\x18\x0b \x01(\x04H\n\x88\x01\x01\x12\x1c\n\x0fkeepalives_sent\x18\x0c \x01(\x04H\x0b\x88\x01\x01\x12 \n\x13keepalives_received\x18\r \x01(\x04H\x0c\x88\x01\x01\x12\x1f\n\x12notifications_sent\x18\x0e \x01(\x04H\r\x88\x01\x01\x12#\n\x16notifications_received\x18\x0f \x01(\x04H\x0e\x88\x01\x01\x12\x36\n\tfsm_state\x18\x10 \x01(\x0e\x32\x1e.otg.Bgpv4Metric.FsmState.EnumH\x0f\x88\x01\x01\x12 \n\x13\x65nd_of_rib_received\x18\x11 \x01(\x04H\x10\x88\x01\x01\x1a\x39\n\x0cSessionState\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x1av\n\x08\x46smState\"j\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04idle\x10\x01\x12\x0b\n\x07\x63onnect\x10\x02\x12\n\n\x06\x61\x63tive\x10\x03\x12\x0c\n\x08opensent\x10\x04\x12\x0f\n\x0bopenconfirm\x10\x05\x12\x0f\n\x0b\x65stablished\x10\x06\x42\x07\n\x05_nameB\x10\n\x0e_session_stateB\x15\n\x13_session_flap_countB\x14\n\x12_routes_advertisedB\x12\n\x10_routes_receivedB\x17\n\x15_route_withdraws_sentB\x1b\n\x19_route_withdraws_receivedB\x0f\n\r_updates_sentB\x13\n\x11_updates_receivedB\r\n\x0b_opens_sentB\x11\n\x0f_opens_receivedB\x12\n\x10_keepalives_sentB\x16\n\x14_keepalives_receivedB\x15\n\x13_notifications_sentB\x19\n\x17_notifications_receivedB\x0c\n\n_fsm_stateB\x16\n\x14_end_of_rib_received\"\xf9\x03\n\x13\x42gpv6MetricsRequest\x12\x12\n\npeer_names\x18\x01 \x03(\t\x12?\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32).otg.Bgpv6MetricsRequest.ColumnNames.Enum\x1a\x8c\x03\n\x0b\x43olumnNames\"\xfc\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rsession_state\x10\x01\x12\x16\n\x12session_flap_count\x10\x02\x12\x15\n\x11routes_advertised\x10\x03\x12\x13\n\x0froutes_received\x10\x04\x12\x18\n\x14route_withdraws_sent\x10\x05\x12\x1c\n\x18route_withdraws_received\x10\x06\x12\x10\n\x0cupdates_sent\x10\x07\x12\x14\n\x10updates_received\x10\x08\x12\x0e\n\nopens_sent\x10\t\x12\x12\n\x0eopens_received\x10\n\x12\x13\n\x0fkeepalives_sent\x10\x0b\x12\x17\n\x13keepalives_received\x10\x0c\x12\x16\n\x12notifications_sent\x10\r\x12\x1a\n\x16notifications_received\x10\x0e\x12\r\n\tfsm_state\x10\x0f\x12\x17\n\x13\x65nd_of_rib_received\x10\x10\"\xea\x08\n\x0b\x42gpv6Metric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12>\n\rsession_state\x18\x02 \x01(\x0e\x32\".otg.Bgpv6Metric.SessionState.EnumH\x01\x88\x01\x01\x12\x1f\n\x12session_flap_count\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12\x1e\n\x11routes_advertised\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x1c\n\x0froutes_received\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12!\n\x14route_withdraws_sent\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12%\n\x18route_withdraws_received\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x19\n\x0cupdates_sent\x18\x08 \x01(\x04H\x07\x88\x01\x01\x12\x1d\n\x10updates_received\x18\t \x01(\x04H\x08\x88\x01\x01\x12\x17\n\nopens_sent\x18\n \x01(\x04H\t\x88\x01\x01\x12\x1b\n\x0eopens_received\x18\x0b \x01(\x04H\n\x88\x01\x01\x12\x1c\n\x0fkeepalives_sent\x18\x0c \x01(\x04H\x0b\x88\x01\x01\x12 \n\x13keepalives_received\x18\r \x01(\x04H\x0c\x88\x01\x01\x12\x1f\n\x12notifications_sent\x18\x0e \x01(\x04H\r\x88\x01\x01\x12#\n\x16notifications_received\x18\x0f \x01(\x04H\x0e\x88\x01\x01\x12\x36\n\tfsm_state\x18\x10 \x01(\x0e\x32\x1e.otg.Bgpv6Metric.FsmState.EnumH\x0f\x88\x01\x01\x12 \n\x13\x65nd_of_rib_received\x18\x11 \x01(\x04H\x10\x88\x01\x01\x1a\x39\n\x0cSessionState\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x1av\n\x08\x46smState\"j\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04idle\x10\x01\x12\x0b\n\x07\x63onnect\x10\x02\x12\n\n\x06\x61\x63tive\x10\x03\x12\x0c\n\x08opensent\x10\x04\x12\x0f\n\x0bopenconfirm\x10\x05\x12\x0f\n\x0b\x65stablished\x10\x06\x42\x07\n\x05_nameB\x10\n\x0e_session_stateB\x15\n\x13_session_flap_countB\x14\n\x12_routes_advertisedB\x12\n\x10_routes_receivedB\x17\n\x15_route_withdraws_sentB\x1b\n\x19_route_withdraws_receivedB\x0f\n\r_updates_sentB\x13\n\x11_updates_receivedB\r\n\x0b_opens_sentB\x11\n\x0f_opens_receivedB\x12\n\x10_keepalives_sentB\x16\n\x14_keepalives_receivedB\x15\n\x13_notifications_sentB\x19\n\x17_notifications_receivedB\x0c\n\n_fsm_stateB\x16\n\x14_end_of_rib_received\"\x92\x06\n\x12IsisMetricsRequest\x12\x14\n\x0crouter_names\x18\x01 \x03(\t\x12>\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32(.otg.IsisMetricsRequest.ColumnNames.Enum\x1a\xa5\x05\n\x0b\x43olumnNames\"\x95\x05\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x12\n\x0el1_sessions_up\x10\x01\x12\x13\n\x0fl1_session_flap\x10\x02\x12\x14\n\x10l1_database_size\x10\x03\x12\x1c\n\x18l1_broadcast_hellos_sent\x10\x04\x12 \n\x1cl1_broadcast_hellos_received\x10\x05\x12!\n\x1dl1_point_to_point_hellos_sent\x10\x06\x12%\n!l1_point_to_point_hellos_received\x10\x07\x12\x10\n\x0cl1_psnp_sent\x10\x08\x12\x14\n\x10l1_psnp_received\x10\t\x12\x10\n\x0cl1_csnp_sent\x10\n\x12\x14\n\x10l1_csnp_received\x10\x0b\x12\x0f\n\x0bl1_lsp_sent\x10\x0c\x12\x13\n\x0fl1_lsp_received\x10\r\x12\x12\n\x0el2_sessions_up\x10\x0e\x12\x13\n\x0fl2_session_flap\x10\x0f\x12\x14\n\x10l2_database_size\x10\x10\x12\x1c\n\x18l2_broadcast_hellos_sent\x10\x11\x12 \n\x1cl2_broadcast_hellos_received\x10\x12\x12!\n\x1dl2_point_to_point_hellos_sent\x10\x13\x12%\n!l2_point_to_point_hellos_received\x10\x14\x12\x10\n\x0cl2_psnp_sent\x10\x15\x12\x14\n\x10l2_psnp_received\x10\x16\x12\x10\n\x0cl2_csnp_sent\x10\x17\x12\x14\n\x10l2_csnp_received\x10\x18\x12\x0f\n\x0bl2_lsp_sent\x10\x19\x12\x13\n\x0fl2_lsp_received\x10\x1a\"\xf4\x0b\n\nIsisMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1b\n\x0el1_sessions_up\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1c\n\x0fl1_session_flap\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12%\n\x18l1_broadcast_hellos_sent\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12)\n\x1cl1_broadcast_hellos_received\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12*\n\x1dl1_point_to_point_hellos_sent\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12.\n!l1_point_to_point_hellos_received\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x1d\n\x10l1_database_size\x18\x08 \x01(\x04H\x07\x88\x01\x01\x12\x19\n\x0cl1_psnp_sent\x18\t \x01(\x04H\x08\x88\x01\x01\x12\x1d\n\x10l1_psnp_received\x18\n \x01(\x04H\t\x88\x01\x01\x12\x19\n\x0cl1_csnp_sent\x18\x0b \x01(\x04H\n\x88\x01\x01\x12\x1d\n\x10l1_csnp_received\x18\x0c \x01(\x04H\x0b\x88\x01\x01\x12\x18\n\x0bl1_lsp_sent\x18\r \x01(\x04H\x0c\x88\x01\x01\x12\x1c\n\x0fl1_lsp_received\x18\x0e \x01(\x04H\r\x88\x01\x01\x12\x1b\n\x0el2_sessions_up\x18\x0f \x01(\rH\x0e\x88\x01\x01\x12\x1c\n\x0fl2_session_flap\x18\x10 \x01(\x04H\x0f\x88\x01\x01\x12%\n\x18l2_broadcast_hellos_sent\x18\x11 \x01(\x04H\x10\x88\x01\x01\x12)\n\x1cl2_broadcast_hellos_received\x18\x12 \x01(\x04H\x11\x88\x01\x01\x12*\n\x1dl2_point_to_point_hellos_sent\x18\x13 \x01(\x04H\x12\x88\x01\x01\x12.\n!l2_point_to_point_hellos_received\x18\x14 \x01(\x04H\x13\x88\x01\x01\x12\x1d\n\x10l2_database_size\x18\x15 \x01(\x04H\x14\x88\x01\x01\x12\x19\n\x0cl2_psnp_sent\x18\x16 \x01(\x04H\x15\x88\x01\x01\x12\x1d\n\x10l2_psnp_received\x18\x17 \x01(\x04H\x16\x88\x01\x01\x12\x19\n\x0cl2_csnp_sent\x18\x18 \x01(\x04H\x17\x88\x01\x01\x12\x1d\n\x10l2_csnp_received\x18\x19 \x01(\x04H\x18\x88\x01\x01\x12\x18\n\x0bl2_lsp_sent\x18\x1a \x01(\x04H\x19\x88\x01\x01\x12\x1c\n\x0fl2_lsp_received\x18\x1b \x01(\x04H\x1a\x88\x01\x01\x42\x07\n\x05_nameB\x11\n\x0f_l1_sessions_upB\x12\n\x10_l1_session_flapB\x1b\n\x19_l1_broadcast_hellos_sentB\x1f\n\x1d_l1_broadcast_hellos_receivedB \n\x1e_l1_point_to_point_hellos_sentB$\n\"_l1_point_to_point_hellos_receivedB\x13\n\x11_l1_database_sizeB\x0f\n\r_l1_psnp_sentB\x13\n\x11_l1_psnp_receivedB\x0f\n\r_l1_csnp_sentB\x13\n\x11_l1_csnp_receivedB\x0e\n\x0c_l1_lsp_sentB\x12\n\x10_l1_lsp_receivedB\x11\n\x0f_l2_sessions_upB\x12\n\x10_l2_session_flapB\x1b\n\x19_l2_broadcast_hellos_sentB\x1f\n\x1d_l2_broadcast_hellos_receivedB \n\x1e_l2_point_to_point_hellos_sentB$\n\"_l2_point_to_point_hellos_receivedB\x13\n\x11_l2_database_sizeB\x0f\n\r_l2_psnp_sentB\x13\n\x11_l2_psnp_receivedB\x0f\n\r_l2_csnp_sentB\x13\n\x11_l2_csnp_receivedB\x0e\n\x0c_l2_lsp_sentB\x12\n\x10_l2_lsp_received\"\xbd\x02\n\x11LagMetricsRequest\x12\x11\n\tlag_names\x18\x01 \x03(\t\x12=\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32\'.otg.LagMetricsRequest.ColumnNames.Enum\x1a\xd5\x01\n\x0b\x43olumnNames\"\xc5\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0f\n\x0boper_status\x10\x01\x12\x13\n\x0fmember_ports_up\x10\x02\x12\r\n\tframes_tx\x10\x03\x12\r\n\tframes_rx\x10\x04\x12\x0c\n\x08\x62ytes_tx\x10\x05\x12\x0c\n\x08\x62ytes_rx\x10\x06\x12\x12\n\x0e\x66rames_tx_rate\x10\x07\x12\x12\n\x0e\x66rames_rx_rate\x10\x08\x12\x11\n\rbytes_tx_rate\x10\t\x12\x11\n\rbytes_rx_rate\x10\n\"\xac\x04\n\tLagMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x38\n\x0boper_status\x18\x02 \x01(\x0e\x32\x1e.otg.LagMetric.OperStatus.EnumH\x01\x88\x01\x01\x12\x1c\n\x0fmember_ports_up\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x16\n\tframes_tx\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x16\n\tframes_rx\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x15\n\x08\x62ytes_tx\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12\x15\n\x08\x62ytes_rx\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x1b\n\x0e\x66rames_tx_rate\x18\x08 \x01(\x02H\x07\x88\x01\x01\x12\x1b\n\x0e\x66rames_rx_rate\x18\t \x01(\x02H\x08\x88\x01\x01\x12\x1a\n\rbytes_tx_rate\x18\n \x01(\x02H\t\x88\x01\x01\x12\x1a\n\rbytes_rx_rate\x18\x0b \x01(\x02H\n\x88\x01\x01\x1a\x37\n\nOperStatus\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x07\n\x05_nameB\x0e\n\x0c_oper_statusB\x12\n\x10_member_ports_upB\x0c\n\n_frames_txB\x0c\n\n_frames_rxB\x0b\n\t_bytes_txB\x0b\n\t_bytes_rxB\x11\n\x0f_frames_tx_rateB\x11\n\x0f_frames_rx_rateB\x10\n\x0e_bytes_tx_rateB\x10\n\x0e_bytes_rx_rate\"\xb4\x03\n\x12LacpMetricsRequest\x12\x11\n\tlag_names\x18\x01 \x03(\t\x12\x1d\n\x15lag_member_port_names\x18\x02 \x03(\t\x12>\n\x0c\x63olumn_names\x18\x03 \x03(\x0e\x32(.otg.LacpMetricsRequest.ColumnNames.Enum\x1a\xab\x02\n\x0b\x43olumnNames\"\x9b\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x13\n\x0flacp_packets_rx\x10\x01\x12\x13\n\x0flacp_packets_tx\x10\x02\x12\x12\n\x0elacp_rx_errors\x10\x03\x12\x0c\n\x08\x61\x63tivity\x10\x04\x12\x0b\n\x07timeout\x10\x05\x12\x13\n\x0fsynchronization\x10\x06\x12\x10\n\x0c\x61ggregatable\x10\x07\x12\x0e\n\ncollecting\x10\x08\x12\x10\n\x0c\x64istributing\x10\t\x12\r\n\tsystem_id\x10\n\x12\x0c\n\x08oper_key\x10\x0b\x12\x0e\n\npartner_id\x10\x0c\x12\x0f\n\x0bpartner_key\x10\r\x12\x0c\n\x08port_num\x10\x0e\x12\x14\n\x10partner_port_num\x10\x0f\"\x8d\x08\n\nLacpMetric\x12\x15\n\x08lag_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12!\n\x14lag_member_port_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1c\n\x0flacp_packets_rx\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12\x1c\n\x0flacp_packets_tx\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x1b\n\x0elacp_rx_errors\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x34\n\x08\x61\x63tivity\x18\x06 \x01(\x0e\x32\x1d.otg.LacpMetric.Activity.EnumH\x05\x88\x01\x01\x12\x32\n\x07timeout\x18\x07 \x01(\x0e\x32\x1c.otg.LacpMetric.Timeout.EnumH\x06\x88\x01\x01\x12\x42\n\x0fsynchronization\x18\x08 \x01(\x0e\x32$.otg.LacpMetric.Synchronization.EnumH\x07\x88\x01\x01\x12\x19\n\x0c\x61ggregatable\x18\t \x01(\x08H\x08\x88\x01\x01\x12\x17\n\ncollecting\x18\n \x01(\x08H\t\x88\x01\x01\x12\x19\n\x0c\x64istributing\x18\x0b \x01(\x08H\n\x88\x01\x01\x12\x16\n\tsystem_id\x18\x0c \x01(\tH\x0b\x88\x01\x01\x12\x15\n\x08oper_key\x18\r \x01(\rH\x0c\x88\x01\x01\x12\x17\n\npartner_id\x18\x0e \x01(\tH\r\x88\x01\x01\x12\x18\n\x0bpartner_key\x18\x0f \x01(\rH\x0e\x88\x01\x01\x12\x15\n\x08port_num\x18\x10 \x01(\rH\x0f\x88\x01\x01\x12\x1d\n\x10partner_port_num\x18\x11 \x01(\rH\x10\x88\x01\x01\x1a<\n\x08\x41\x63tivity\"0\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x61\x63tive\x10\x01\x12\x0b\n\x07passive\x10\x02\x1a\x37\n\x07Timeout\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05short\x10\x01\x12\x08\n\x04long\x10\x02\x1a\x45\n\x0fSynchronization\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07in_sync\x10\x01\x12\x0c\n\x08out_sync\x10\x02\x42\x0b\n\t_lag_nameB\x17\n\x15_lag_member_port_nameB\x12\n\x10_lacp_packets_rxB\x12\n\x10_lacp_packets_txB\x11\n\x0f_lacp_rx_errorsB\x0b\n\t_activityB\n\n\x08_timeoutB\x12\n\x10_synchronizationB\x0f\n\r_aggregatableB\r\n\x0b_collectingB\x0f\n\r_distributingB\x0c\n\n_system_idB\x0b\n\t_oper_keyB\r\n\x0b_partner_idB\x0e\n\x0c_partner_keyB\x0b\n\t_port_numB\x13\n\x11_partner_port_num\"\xfd\x01\n\x12LldpMetricsRequest\x12\x12\n\nlldp_names\x18\x01 \x03(\t\x12>\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32(.otg.LldpMetricsRequest.ColumnNames.Enum\x1a\x92\x01\n\x0b\x43olumnNames\"\x82\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tframes_rx\x10\x01\x12\r\n\tframes_tx\x10\x02\x12\x13\n\x0f\x66rames_error_rx\x10\x03\x12\x12\n\x0e\x66rames_discard\x10\x04\x12\x10\n\x0ctlvs_discard\x10\x05\x12\x10\n\x0ctlvs_unknown\x10\x06\"\xae\x02\n\nLldpMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x16\n\tframes_rx\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x16\n\tframes_tx\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12\x1c\n\x0f\x66rames_error_rx\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x1b\n\x0e\x66rames_discard\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x19\n\x0ctlvs_discard\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12\x19\n\x0ctlvs_unknown\x18\x07 \x01(\x04H\x06\x88\x01\x01\x42\x07\n\x05_nameB\x0c\n\n_frames_rxB\x0c\n\n_frames_txB\x12\n\x10_frames_error_rxB\x11\n\x0f_frames_discardB\x0f\n\r_tlvs_discardB\x0f\n\r_tlvs_unknown\"\xc2\x05\n\x12RsvpMetricsRequest\x12\x14\n\x0crouter_names\x18\x01 \x03(\t\x12>\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32(.otg.RsvpMetricsRequest.ColumnNames.Enum\x1a\xd5\x04\n\x0b\x43olumnNames\"\xc5\x04\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1f\n\x1bingress_p2p_lsps_configured\x10\x01\x12\x17\n\x13ingress_p2p_lsps_up\x10\x02\x12\x16\n\x12\x65gress_p2p_lsps_up\x10\x03\x12\x12\n\x0elsp_flap_count\x10\x04\x12\x0c\n\x08paths_tx\x10\x05\x12\x0c\n\x08paths_rx\x10\x06\x12\x0c\n\x08resvs_tx\x10\x07\x12\x0c\n\x08resvs_rx\x10\x08\x12\x11\n\rpath_tears_tx\x10\t\x12\x11\n\rpath_tears_rx\x10\n\x12\x11\n\rresv_tears_tx\x10\x0b\x12\x11\n\rresv_tears_rx\x10\x0c\x12\x12\n\x0epath_errors_tx\x10\r\x12\x12\n\x0epath_errors_rx\x10\x0e\x12\x12\n\x0eresv_errors_tx\x10\x0f\x12\x12\n\x0eresv_errors_rx\x10\x10\x12\x10\n\x0cresv_conf_tx\x10\x11\x12\x10\n\x0cresv_conf_rx\x10\x12\x12\r\n\thellos_tx\x10\x13\x12\r\n\thellos_rx\x10\x14\x12\x0b\n\x07\x61\x63ks_tx\x10\x15\x12\x0b\n\x07\x61\x63ks_rx\x10\x16\x12\x0c\n\x08nacks_tx\x10\x17\x12\x0c\n\x08nacks_rx\x10\x18\x12\x0f\n\x0bsrefresh_tx\x10\x19\x12\x0f\n\x0bsrefresh_rx\x10\x1a\x12\r\n\tbundle_tx\x10\x1b\x12\r\n\tbundle_rx\x10\x1c\x12 \n\x1cpath_reevaluation_request_tx\x10\x1d\x12\x18\n\x14path_reoptimizations\x10\x1e\"\xf4\n\n\nRsvpMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12(\n\x1bingress_p2p_lsps_configured\x18\x02 \x01(\rH\x01\x88\x01\x01\x12 \n\x13ingress_p2p_lsps_up\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x1f\n\x12\x65gress_p2p_lsps_up\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1b\n\x0elsp_flap_count\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x15\n\x08paths_tx\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12\x15\n\x08paths_rx\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x15\n\x08resvs_tx\x18\x08 \x01(\x04H\x07\x88\x01\x01\x12\x15\n\x08resvs_rx\x18\t \x01(\x04H\x08\x88\x01\x01\x12\x1a\n\rpath_tears_tx\x18\n \x01(\x04H\t\x88\x01\x01\x12\x1a\n\rpath_tears_rx\x18\x0b \x01(\x04H\n\x88\x01\x01\x12\x1a\n\rresv_tears_tx\x18\x0c \x01(\x04H\x0b\x88\x01\x01\x12\x1a\n\rresv_tears_rx\x18\r \x01(\x04H\x0c\x88\x01\x01\x12\x1b\n\x0epath_errors_tx\x18\x0e \x01(\x04H\r\x88\x01\x01\x12\x1b\n\x0epath_errors_rx\x18\x0f \x01(\x04H\x0e\x88\x01\x01\x12\x1b\n\x0eresv_errors_tx\x18\x10 \x01(\x04H\x0f\x88\x01\x01\x12\x1b\n\x0eresv_errors_rx\x18\x11 \x01(\x04H\x10\x88\x01\x01\x12\x19\n\x0cresv_conf_tx\x18\x12 \x01(\x04H\x11\x88\x01\x01\x12\x19\n\x0cresv_conf_rx\x18\x13 \x01(\x04H\x12\x88\x01\x01\x12\x16\n\thellos_tx\x18\x14 \x01(\x04H\x13\x88\x01\x01\x12\x16\n\thellos_rx\x18\x15 \x01(\x04H\x14\x88\x01\x01\x12\x14\n\x07\x61\x63ks_tx\x18\x16 \x01(\x04H\x15\x88\x01\x01\x12\x14\n\x07\x61\x63ks_rx\x18\x17 \x01(\x04H\x16\x88\x01\x01\x12\x15\n\x08nacks_tx\x18\x18 \x01(\x04H\x17\x88\x01\x01\x12\x15\n\x08nacks_rx\x18\x19 \x01(\x04H\x18\x88\x01\x01\x12\x18\n\x0bsrefresh_tx\x18\x1a \x01(\x04H\x19\x88\x01\x01\x12\x18\n\x0bsrefresh_rx\x18\x1b \x01(\x04H\x1a\x88\x01\x01\x12\x16\n\tbundle_tx\x18\x1c \x01(\x04H\x1b\x88\x01\x01\x12\x16\n\tbundle_rx\x18\x1d \x01(\x04H\x1c\x88\x01\x01\x12)\n\x1cpath_reevaluation_request_tx\x18\x1e \x01(\x04H\x1d\x88\x01\x01\x12!\n\x14path_reoptimizations\x18\x1f \x01(\x04H\x1e\x88\x01\x01\x42\x07\n\x05_nameB\x1e\n\x1c_ingress_p2p_lsps_configuredB\x16\n\x14_ingress_p2p_lsps_upB\x15\n\x13_egress_p2p_lsps_upB\x11\n\x0f_lsp_flap_countB\x0b\n\t_paths_txB\x0b\n\t_paths_rxB\x0b\n\t_resvs_txB\x0b\n\t_resvs_rxB\x10\n\x0e_path_tears_txB\x10\n\x0e_path_tears_rxB\x10\n\x0e_resv_tears_txB\x10\n\x0e_resv_tears_rxB\x11\n\x0f_path_errors_txB\x11\n\x0f_path_errors_rxB\x11\n\x0f_resv_errors_txB\x11\n\x0f_resv_errors_rxB\x0f\n\r_resv_conf_txB\x0f\n\r_resv_conf_rxB\x0c\n\n_hellos_txB\x0c\n\n_hellos_rxB\n\n\x08_acks_txB\n\n\x08_acks_rxB\x0b\n\t_nacks_txB\x0b\n\t_nacks_rxB\x0e\n\x0c_srefresh_txB\x0e\n\x0c_srefresh_rxB\x0c\n\n_bundle_txB\x0c\n\n_bundle_rxB\x1f\n\x1d_path_reevaluation_request_txB\x17\n\x15_path_reoptimizations\"\xad\x02\n\x1a\x44hcpv4ClientMetricsRequest\x12\x14\n\x0c\x63lient_names\x18\x01 \x03(\t\x12\x46\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32\x30.otg.Dhcpv4ClientMetricsRequest.ColumnNames.Enum\x1a\xb0\x01\n\x0b\x43olumnNames\"\xa0\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x12\n\x0e\x64iscovers_sent\x10\x01\x12\x13\n\x0foffers_received\x10\x02\x12\x11\n\rrequests_sent\x10\x03\x12\x11\n\racks_received\x10\x04\x12\x12\n\x0enacks_received\x10\x05\x12\x11\n\rreleases_sent\x10\x06\x12\x11\n\rdeclines_sent\x10\x07\"\xfa\x02\n\x12\x44hcpv4ClientMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1b\n\x0e\x64iscovers_sent\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x1c\n\x0foffers_received\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12\x1a\n\rrequests_sent\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x1a\n\racks_received\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x1b\n\x0enacks_received\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12\x1a\n\rreleases_sent\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x1a\n\rdeclines_sent\x18\x08 \x01(\x04H\x07\x88\x01\x01\x42\x07\n\x05_nameB\x11\n\x0f_discovers_sentB\x12\n\x10_offers_receivedB\x10\n\x0e_requests_sentB\x10\n\x0e_acks_receivedB\x11\n\x0f_nacks_receivedB\x10\n\x0e_releases_sentB\x10\n\x0e_declines_sent\"\xb1\x02\n\x1a\x44hcpv4ServerMetricsRequest\x12\x14\n\x0cserver_names\x18\x01 \x03(\t\x12\x46\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32\x30.otg.Dhcpv4ServerMetricsRequest.ColumnNames.Enum\x1a\xb4\x01\n\x0b\x43olumnNames\"\xa4\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x16\n\x12\x64iscovers_received\x10\x01\x12\x0f\n\x0boffers_sent\x10\x02\x12\x15\n\x11requests_received\x10\x03\x12\r\n\tacks_sent\x10\x04\x12\x0e\n\nnacks_sent\x10\x05\x12\x15\n\x11releases_received\x10\x06\x12\x15\n\x11\x64\x65\x63lines_received\x10\x07\"\x82\x03\n\x12\x44hcpv4ServerMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12\x64iscovers_received\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x18\n\x0boffers_sent\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12\x1e\n\x11requests_received\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x16\n\tacks_sent\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x17\n\nnacks_sent\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12\x1e\n\x11releases_received\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x1e\n\x11\x64\x65\x63lines_received\x18\x08 \x01(\x04H\x07\x88\x01\x01\x42\x07\n\x05_nameB\x15\n\x13_discovers_receivedB\x0e\n\x0c_offers_sentB\x14\n\x12_requests_receivedB\x0c\n\n_acks_sentB\r\n\x0b_nacks_sentB\x14\n\x12_releases_receivedB\x14\n\x12_declines_received\"\xb0\x05\n\rStatesRequest\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.StatesRequest.Choice.EnumH\x00\x88\x01\x01\x12\x35\n\x0eipv4_neighbors\x18\x02 \x01(\x0b\x32\x1d.otg.Neighborsv4StatesRequest\x12\x35\n\x0eipv6_neighbors\x18\x03 \x01(\x0b\x32\x1d.otg.Neighborsv6StatesRequest\x12\x30\n\x0c\x62gp_prefixes\x18\x04 \x01(\x0b\x32\x1a.otg.BgpPrefixStateRequest\x12,\n\tisis_lsps\x18\x05 \x01(\x0b\x32\x19.otg.IsisLspsStateRequest\x12\x36\n\x0elldp_neighbors\x18\x06 \x01(\x0b\x32\x1e.otg.LldpNeighborsStateRequest\x12,\n\trsvp_lsps\x18\x07 \x01(\x0b\x32\x19.otg.RsvpLspsStateRequest\x12;\n\x11\x64hcpv4_interfaces\x18\x08 \x01(\x0b\x32 .otg.Dhcpv4InterfaceStateRequest\x12\x33\n\rdhcpv4_leases\x18\t \x01(\x0b\x32\x1c.otg.Dhcpv4LeaseStateRequest\x1a\xb8\x01\n\x06\x43hoice\"\xad\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x12\n\x0eipv4_neighbors\x10\x01\x12\x12\n\x0eipv6_neighbors\x10\x02\x12\x10\n\x0c\x62gp_prefixes\x10\x03\x12\r\n\tisis_lsps\x10\x04\x12\x12\n\x0elldp_neighbors\x10\x05\x12\r\n\trsvp_lsps\x10\x06\x12\x15\n\x11\x64hcpv4_interfaces\x10\x07\x12\x11\n\rdhcpv4_leases\x10\x08\x42\t\n\x07_choice\"\xfb\x04\n\x0eStatesResponse\x12\x34\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1f.otg.StatesResponse.Choice.EnumH\x00\x88\x01\x01\x12-\n\x0eipv4_neighbors\x18\x02 \x03(\x0b\x32\x15.otg.Neighborsv4State\x12-\n\x0eipv6_neighbors\x18\x03 \x03(\x0b\x32\x15.otg.Neighborsv6State\x12+\n\x0c\x62gp_prefixes\x18\x04 \x03(\x0b\x32\x15.otg.BgpPrefixesState\x12%\n\tisis_lsps\x18\x05 \x03(\x0b\x32\x12.otg.IsisLspsState\x12/\n\x0elldp_neighbors\x18\x06 \x03(\x0b\x32\x17.otg.LldpNeighborsState\x12%\n\trsvp_lsps\x18\x07 \x03(\x0b\x32\x12.otg.RsvpLspsState\x12\x34\n\x11\x64hcpv4_interfaces\x18\x08 \x03(\x0b\x32\x19.otg.Dhcpv4InterfaceState\x12-\n\rdhcpv4_leases\x18\t \x03(\x0b\x32\x16.otg.Dhcpv4LeasesState\x1a\xb8\x01\n\x06\x43hoice\"\xad\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x12\n\x0eipv4_neighbors\x10\x01\x12\x12\n\x0eipv6_neighbors\x10\x02\x12\x10\n\x0c\x62gp_prefixes\x10\x03\x12\r\n\tisis_lsps\x10\x04\x12\x12\n\x0elldp_neighbors\x10\x05\x12\r\n\trsvp_lsps\x10\x06\x12\x15\n\x11\x64hcpv4_interfaces\x10\x07\x12\x11\n\rdhcpv4_leases\x10\x08\x42\t\n\x07_choice\"2\n\x18Neighborsv4StatesRequest\x12\x16\n\x0e\x65thernet_names\x18\x01 \x03(\t\"\xa4\x01\n\x10Neighborsv4State\x12\x1a\n\rethernet_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0cipv4_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1f\n\x12link_layer_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x10\n\x0e_ethernet_nameB\x0f\n\r_ipv4_addressB\x15\n\x13_link_layer_address\"2\n\x18Neighborsv6StatesRequest\x12\x16\n\x0e\x65thernet_names\x18\x01 \x03(\t\"\xa4\x01\n\x10Neighborsv6State\x12\x1a\n\rethernet_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0cipv6_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1f\n\x12link_layer_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x10\n\x0e_ethernet_nameB\x0f\n\r_ipv6_addressB\x15\n\x13_link_layer_address\"\xc2\x02\n\x15\x42gpPrefixStateRequest\x12\x16\n\x0e\x62gp_peer_names\x18\x01 \x03(\t\x12\x45\n\x0eprefix_filters\x18\x02 \x03(\x0e\x32-.otg.BgpPrefixStateRequest.PrefixFilters.Enum\x12=\n\x14ipv4_unicast_filters\x18\x03 \x03(\x0b\x32\x1f.otg.BgpPrefixIpv4UnicastFilter\x12=\n\x14ipv6_unicast_filters\x18\x04 \x03(\x0b\x32\x1f.otg.BgpPrefixIpv6UnicastFilter\x1aL\n\rPrefixFilters\";\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0cipv4_unicast\x10\x01\x12\x10\n\x0cipv6_unicast\x10\x02\"\x91\x02\n\x1a\x42gpPrefixIpv4UnicastFilter\x12\x11\n\taddresses\x18\x01 \x03(\t\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x00\x88\x01\x01\x12@\n\x06origin\x18\x03 \x01(\x0e\x32+.otg.BgpPrefixIpv4UnicastFilter.Origin.EnumH\x01\x88\x01\x01\x12\x14\n\x07path_id\x18\x04 \x01(\rH\x02\x88\x01\x01\x1a\x43\n\x06Origin\"9\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03igp\x10\x01\x12\x07\n\x03\x65gp\x10\x02\x12\x0e\n\nincomplete\x10\x03\x42\x10\n\x0e_prefix_lengthB\t\n\x07_originB\n\n\x08_path_id\"\x91\x02\n\x1a\x42gpPrefixIpv6UnicastFilter\x12\x11\n\taddresses\x18\x01 \x03(\t\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x00\x88\x01\x01\x12@\n\x06origin\x18\x03 \x01(\x0e\x32+.otg.BgpPrefixIpv6UnicastFilter.Origin.EnumH\x01\x88\x01\x01\x12\x14\n\x07path_id\x18\x04 \x01(\rH\x02\x88\x01\x01\x1a\x43\n\x06Origin\"9\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03igp\x10\x01\x12\x07\n\x03\x65gp\x10\x02\x12\x0e\n\nincomplete\x10\x03\x42\x10\n\x0e_prefix_lengthB\t\n\x07_originB\n\n\x08_path_id\"\xbe\x01\n\x10\x42gpPrefixesState\x12\x1a\n\rbgp_peer_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12=\n\x15ipv4_unicast_prefixes\x18\x02 \x03(\x0b\x32\x1e.otg.BgpPrefixIpv4UnicastState\x12=\n\x15ipv6_unicast_prefixes\x18\x03 \x03(\x0b\x32\x1e.otg.BgpPrefixIpv6UnicastStateB\x10\n\x0e_bgp_peer_name\"\x8d\x05\n\x19\x42gpPrefixIpv4UnicastState\x12\x19\n\x0cipv4_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12?\n\x06origin\x18\x03 \x01(\x0e\x32*.otg.BgpPrefixIpv4UnicastState.Origin.EnumH\x02\x88\x01\x01\x12\x14\n\x07path_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1a\n\ripv4_next_hop\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x1a\n\ripv6_next_hop\x18\x06 \x01(\tH\x05\x88\x01\x01\x12,\n\x0b\x63ommunities\x18\x07 \x03(\x0b\x32\x17.otg.ResultBgpCommunity\x12:\n\x14\x65xtended_communities\x18\x0b \x03(\x0b\x32\x1c.otg.ResultExtendedCommunity\x12%\n\x07\x61s_path\x18\x08 \x01(\x0b\x32\x14.otg.ResultBgpAsPath\x12\x1d\n\x10local_preference\x18\t \x01(\rH\x06\x88\x01\x01\x12%\n\x18multi_exit_discriminator\x18\n \x01(\rH\x07\x88\x01\x01\x1a\x43\n\x06Origin\"9\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03igp\x10\x01\x12\x07\n\x03\x65gp\x10\x02\x12\x0e\n\nincomplete\x10\x03\x42\x0f\n\r_ipv4_addressB\x10\n\x0e_prefix_lengthB\t\n\x07_originB\n\n\x08_path_idB\x10\n\x0e_ipv4_next_hopB\x10\n\x0e_ipv6_next_hopB\x13\n\x11_local_preferenceB\x1b\n\x19_multi_exit_discriminator\"\x8d\x05\n\x19\x42gpPrefixIpv6UnicastState\x12\x19\n\x0cipv6_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12?\n\x06origin\x18\x03 \x01(\x0e\x32*.otg.BgpPrefixIpv6UnicastState.Origin.EnumH\x02\x88\x01\x01\x12\x14\n\x07path_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1a\n\ripv4_next_hop\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x1a\n\ripv6_next_hop\x18\x06 \x01(\tH\x05\x88\x01\x01\x12,\n\x0b\x63ommunities\x18\x07 \x03(\x0b\x32\x17.otg.ResultBgpCommunity\x12:\n\x14\x65xtended_communities\x18\x0b \x03(\x0b\x32\x1c.otg.ResultExtendedCommunity\x12%\n\x07\x61s_path\x18\x08 \x01(\x0b\x32\x14.otg.ResultBgpAsPath\x12\x1d\n\x10local_preference\x18\t \x01(\rH\x06\x88\x01\x01\x12%\n\x18multi_exit_discriminator\x18\n \x01(\rH\x07\x88\x01\x01\x1a\x43\n\x06Origin\"9\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03igp\x10\x01\x12\x07\n\x03\x65gp\x10\x02\x12\x0e\n\nincomplete\x10\x03\x42\x0f\n\r_ipv6_addressB\x10\n\x0e_prefix_lengthB\t\n\x07_originB\n\n\x08_path_idB\x10\n\x0e_ipv4_next_hopB\x10\n\x0e_ipv6_next_hopB\x13\n\x11_local_preferenceB\x1b\n\x19_multi_exit_discriminator\"o\n\x17ResultExtendedCommunity\x12\x10\n\x03raw\x18\x01 \x01(\tH\x00\x88\x01\x01\x12:\n\nstructured\x18\x02 \x01(\x0b\x32&.otg.ResultExtendedCommunityStructuredB\x06\n\x04_raw\"\xf6\x05\n!ResultExtendedCommunityStructured\x12G\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x32.otg.ResultExtendedCommunityStructured.Choice.EnumH\x00\x88\x01\x01\x12U\n\x19transitive_2octet_as_type\x18\x02 \x01(\x0b\x32\x32.otg.ResultExtendedCommunityTransitive2OctetAsType\x12[\n\x1ctransitive_ipv4_address_type\x18\x03 \x01(\x0b\x32\x35.otg.ResultExtendedCommunityTransitiveIpv4AddressType\x12U\n\x19transitive_4octet_as_type\x18\x04 \x01(\x0b\x32\x32.otg.ResultExtendedCommunityTransitive4OctetAsType\x12P\n\x16transitive_opaque_type\x18\x05 \x01(\x0b\x32\x30.otg.ResultExtendedCommunityTransitiveOpaqueType\x12\\\n\x1dnon_transitive_2octet_as_type\x18\x06 \x01(\x0b\x32\x35.otg.ResultExtendedCommunityNonTransitive2OctetAsType\x1a\xc1\x01\n\x06\x43hoice\"\xb6\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1d\n\x19transitive_2octet_as_type\x10\x01\x12 \n\x1ctransitive_ipv4_address_type\x10\x02\x12\x1d\n\x19transitive_4octet_as_type\x10\x03\x12\x1a\n\x16transitive_opaque_type\x10\x04\x12!\n\x1dnon_transitive_2octet_as_type\x10\x05\x42\t\n\x07_choice\"\xa2\x01\n8ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget\x12\x1c\n\x0fglobal_2byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_4byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_2byte_asB\x14\n\x12_local_4byte_admin\"\xa2\x01\n8ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin\x12\x1c\n\x0fglobal_2byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_4byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_2byte_asB\x14\n\x12_local_4byte_admin\"\xa0\x03\n-ResultExtendedCommunityTransitive2OctetAsType\x12S\n\x06\x63hoice\x18\x01 \x01(\x0e\x32>.otg.ResultExtendedCommunityTransitive2OctetAsType.Choice.EnumH\x00\x88\x01\x01\x12[\n\x14route_target_subtype\x18\x02 \x01(\x0b\x32=.otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget\x12[\n\x14route_origin_subtype\x18\x03 \x01(\x0b\x32=.otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin\x1aU\n\x06\x43hoice\"K\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x18\n\x14route_target_subtype\x10\x01\x12\x18\n\x14route_origin_subtype\x10\x02\x42\t\n\x07_choice\"\xa9\x01\n;ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin\x12\x1e\n\x11global_ipv4_admin\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x14\n\x12_global_ipv4_adminB\x14\n\x12_local_2byte_admin\"\xa9\x01\n;ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget\x12\x1e\n\x11global_ipv4_admin\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x14\n\x12_global_ipv4_adminB\x14\n\x12_local_2byte_admin\"\xac\x03\n0ResultExtendedCommunityTransitiveIpv4AddressType\x12V\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x41.otg.ResultExtendedCommunityTransitiveIpv4AddressType.Choice.EnumH\x00\x88\x01\x01\x12^\n\x14route_target_subtype\x18\x02 \x01(\x0b\x32@.otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget\x12^\n\x14route_origin_subtype\x18\x03 \x01(\x0b\x32@.otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin\x1aU\n\x06\x43hoice\"K\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x18\n\x14route_target_subtype\x10\x01\x12\x18\n\x14route_origin_subtype\x10\x02\x42\t\n\x07_choice\"\xa2\x01\n8ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget\x12\x1c\n\x0fglobal_4byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_4byte_asB\x14\n\x12_local_2byte_admin\"\xa2\x01\n8ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin\x12\x1c\n\x0fglobal_4byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_4byte_asB\x14\n\x12_local_2byte_admin\"\xa0\x03\n-ResultExtendedCommunityTransitive4OctetAsType\x12S\n\x06\x63hoice\x18\x01 \x01(\x0e\x32>.otg.ResultExtendedCommunityTransitive4OctetAsType.Choice.EnumH\x00\x88\x01\x01\x12[\n\x14route_target_subtype\x18\x02 \x01(\x0b\x32=.otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget\x12[\n\x14route_origin_subtype\x18\x03 \x01(\x0b\x32=.otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin\x1aU\n\x06\x43hoice\"K\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x18\n\x14route_target_subtype\x10\x01\x12\x18\n\x14route_origin_subtype\x10\x02\x42\t\n\x07_choice\"n\n0ResultExtendedCommunityTransitiveOpaqueTypeColor\x12\x12\n\x05\x66lags\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x12\n\x05\x63olor\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x08\n\x06_flagsB\x08\n\x06_color\"\x88\x01\n8ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation\x12\x15\n\x08reserved\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x18\n\x0btunnel_type\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x0b\n\t_reservedB\x0e\n\x0c_tunnel_type\"\x88\x03\n+ResultExtendedCommunityTransitiveOpaqueType\x12Q\n\x06\x63hoice\x18\x01 \x01(\x0e\x32<.otg.ResultExtendedCommunityTransitiveOpaqueType.Choice.EnumH\x00\x88\x01\x01\x12L\n\rcolor_subtype\x18\x02 \x01(\x0b\x32\x35.otg.ResultExtendedCommunityTransitiveOpaqueTypeColor\x12\\\n\x15\x65ncapsulation_subtype\x18\x03 \x01(\x0b\x32=.otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation\x1aO\n\x06\x43hoice\"E\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rcolor_subtype\x10\x01\x12\x19\n\x15\x65ncapsulation_subtype\x10\x02\x42\t\n\x07_choice\"\x97\x01\n=ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth\x12\x1c\n\x0fglobal_2byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tbandwidth\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\x12\n\x10_global_2byte_asB\x0c\n\n_bandwidth\"\xb8\x02\n0ResultExtendedCommunityNonTransitive2OctetAsType\x12V\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x41.otg.ResultExtendedCommunityNonTransitive2OctetAsType.Choice.EnumH\x00\x88\x01\x01\x12\x62\n\x16link_bandwidth_subtype\x18\x02 \x01(\x0b\x32\x42.otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth\x1a=\n\x06\x43hoice\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1a\n\x16link_bandwidth_subtype\x10\x01\x42\t\n\x07_choice\"\xb0\x02\n\x12ResultBgpCommunity\x12\x34\n\x04type\x18\x01 \x01(\x0e\x32!.otg.ResultBgpCommunity.Type.EnumH\x00\x88\x01\x01\x12\x16\n\tas_number\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\tas_custom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x8e\x01\n\x04Type\"\x85\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x14\n\x10manual_as_number\x10\x01\x12\r\n\tno_export\x10\x02\x12\x11\n\rno_advertised\x10\x03\x12\x17\n\x13no_export_subconfed\x10\x04\x12\x0e\n\nllgr_stale\x10\x05\x12\x0b\n\x07no_llgr\x10\x06\x42\x07\n\x05_typeB\x0c\n\n_as_numberB\x0c\n\n_as_custom\"@\n\x0fResultBgpAsPath\x12-\n\x08segments\x18\x01 \x03(\x0b\x32\x1b.otg.ResultBgpAsPathSegment\"\xce\x01\n\x16ResultBgpAsPathSegment\x12\x38\n\x04type\x18\x01 \x01(\x0e\x32%.otg.ResultBgpAsPathSegment.Type.EnumH\x00\x88\x01\x01\x12\x12\n\nas_numbers\x18\x02 \x03(\r\x1a]\n\x04Type\"U\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x61s_seq\x10\x01\x12\n\n\x06\x61s_set\x10\x02\x12\x11\n\ras_confed_seq\x10\x03\x12\x11\n\ras_confed_set\x10\x04\x42\x07\n\x05_type\"1\n\x14IsisLspsStateRequest\x12\x19\n\x11isis_router_names\x18\x01 \x03(\t\"d\n\rIsisLspsState\x12\x1d\n\x10isis_router_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x04lsps\x18\x02 \x03(\x0b\x32\x11.otg.IsisLspStateB\x13\n\x11_isis_router_name\"\xa6\x03\n\x0cIsisLspState\x12\x13\n\x06lsp_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x35\n\x08pdu_type\x18\x02 \x01(\x0e\x32\x1e.otg.IsisLspState.PduType.EnumH\x01\x88\x01\x01\x12\x1f\n\x12remaining_lifetime\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x1c\n\x0fsequence_number\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x17\n\npdu_length\x18\x05 \x01(\rH\x04\x88\x01\x01\x12 \n\x05\x66lags\x18\x06 \x01(\x0b\x32\x11.otg.IsisLspFlags\x12\x14\n\x07is_type\x18\x07 \x01(\rH\x05\x88\x01\x01\x12\x1e\n\x04tlvs\x18\x08 \x01(\x0b\x32\x10.otg.IsisLspTlvs\x1a<\n\x07PduType\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07level_1\x10\x01\x12\x0b\n\x07level_2\x10\x02\x42\t\n\x07_lsp_idB\x0b\n\t_pdu_typeB\x15\n\x13_remaining_lifetimeB\x12\n\x10_sequence_numberB\r\n\x0b_pdu_lengthB\n\n\x08_is_type\"\xfc\x03\n\x0bIsisLspTlvs\x12+\n\rhostname_tlvs\x18\x01 \x03(\x0b\x32\x14.otg.IsisLspHostname\x12;\n\x14is_reachability_tlvs\x18\x02 \x03(\x0b\x32\x1d.otg.IsisLspIsReachabilityTlv\x12L\n\x1d\x65xtended_is_reachability_tlvs\x18\x03 \x03(\x0b\x32%.otg.IsisLspExtendedIsReachabilityTlv\x12P\n\x1fipv4_internal_reachability_tlvs\x18\x04 \x03(\x0b\x32\'.otg.IsisLspIpv4InternalReachabilityTlv\x12P\n\x1fipv4_external_reachability_tlvs\x18\x05 \x03(\x0b\x32\'.otg.IsisLspIpv4ExternalReachabilityTlv\x12P\n\x1f\x65xtended_ipv4_reachability_tlvs\x18\x06 \x03(\x0b\x32\'.otg.IsisLspExtendedIpv4ReachabilityTlv\x12?\n\x16ipv6_reachability_tlvs\x18\x07 \x03(\x0b\x32\x1f.otg.IsisLspIpv6ReachabilityTlv\"5\n\x0fIsisLspHostname\x12\x15\n\x08hostname\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0b\n\t_hostname\"\xae\x02\n\x0cIsisLspFlags\x12\x1d\n\x10partition_repair\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x1b\n\x0e\x61ttached_error\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x1d\n\x10\x61ttached_expense\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x1b\n\x0e\x61ttached_delay\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x1d\n\x10\x61ttached_default\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x15\n\x08overload\x18\x06 \x01(\x08H\x05\x88\x01\x01\x42\x13\n\x11_partition_repairB\x11\n\x0f_attached_errorB\x13\n\x11_attached_expenseB\x11\n\x0f_attached_delayB\x13\n\x11_attached_defaultB\x0b\n\t_overload\"C\n\x18IsisLspIsReachabilityTlv\x12\'\n\tneighbors\x18\x01 \x03(\x0b\x32\x14.otg.IsisLspneighbor\"K\n IsisLspExtendedIsReachabilityTlv\x12\'\n\tneighbors\x18\x01 \x03(\x0b\x32\x14.otg.IsisLspneighbor\"7\n\x0fIsisLspneighbor\x12\x16\n\tsystem_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0c\n\n_system_id\"L\n\"IsisLspIpv4InternalReachabilityTlv\x12&\n\x08prefixes\x18\x01 \x03(\x0b\x32\x14.otg.IsisLspV4Prefix\"L\n\"IsisLspIpv4ExternalReachabilityTlv\x12&\n\x08prefixes\x18\x01 \x03(\x0b\x32\x14.otg.IsisLspV4Prefix\"\xd7\x03\n\x0fIsisLspV4Prefix\x12\x19\n\x0cipv4_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12N\n\x13redistribution_type\x18\x03 \x01(\x0e\x32,.otg.IsisLspV4Prefix.RedistributionType.EnumH\x02\x88\x01\x01\x12\x1b\n\x0e\x64\x65\x66\x61ult_metric\x18\x04 \x01(\rH\x03\x88\x01\x01\x12>\n\x0borigin_type\x18\x05 \x01(\x0e\x32$.otg.IsisLspV4Prefix.OriginType.EnumH\x04\x88\x01\x01\x1a?\n\x12RedistributionType\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x1a\x41\n\nOriginType\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08internal\x10\x01\x12\x0c\n\x08\x65xternal\x10\x02\x42\x0f\n\r_ipv4_addressB\x10\n\x0e_prefix_lengthB\x16\n\x14_redistribution_typeB\x11\n\x0f_default_metricB\x0e\n\x0c_origin_type\"T\n\"IsisLspExtendedIpv4ReachabilityTlv\x12.\n\x08prefixes\x18\x01 \x03(\x0b\x32\x1c.otg.IsisLspExtendedV4Prefix\"\xfd\x02\n\x17IsisLspExtendedV4Prefix\x12\x19\n\x0cipv4_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06metric\x18\x03 \x01(\rH\x02\x88\x01\x01\x12V\n\x13redistribution_type\x18\x04 \x01(\x0e\x32\x34.otg.IsisLspExtendedV4Prefix.RedistributionType.EnumH\x03\x88\x01\x01\x12\x37\n\x11prefix_attributes\x18\x05 \x01(\x0b\x32\x1c.otg.IsisLspPrefixAttributes\x1a?\n\x12RedistributionType\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x0f\n\r_ipv4_addressB\x10\n\x0e_prefix_lengthB\t\n\x07_metricB\x16\n\x14_redistribution_type\"D\n\x1aIsisLspIpv6ReachabilityTlv\x12&\n\x08prefixes\x18\x01 \x03(\x0b\x32\x14.otg.IsisLspV6Prefix\"\x80\x04\n\x0fIsisLspV6Prefix\x12\x19\n\x0cipv6_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06metric\x18\x03 \x01(\rH\x02\x88\x01\x01\x12N\n\x13redistribution_type\x18\x04 \x01(\x0e\x32,.otg.IsisLspV6Prefix.RedistributionType.EnumH\x03\x88\x01\x01\x12>\n\x0borigin_type\x18\x05 \x01(\x0e\x32$.otg.IsisLspV6Prefix.OriginType.EnumH\x04\x88\x01\x01\x12\x37\n\x11prefix_attributes\x18\x06 \x01(\x0b\x32\x1c.otg.IsisLspPrefixAttributes\x1a?\n\x12RedistributionType\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x1a\x41\n\nOriginType\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08internal\x10\x01\x12\x0c\n\x08\x65xternal\x10\x02\x42\x0f\n\r_ipv6_addressB\x10\n\x0e_prefix_lengthB\t\n\x07_metricB\x16\n\x14_redistribution_typeB\x0e\n\x0c_origin_type\"y\n\x17IsisLspPrefixAttributes\x12\x13\n\x06x_flag\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x13\n\x06r_flag\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x13\n\x06n_flag\x18\x03 \x01(\x08H\x02\x88\x01\x01\x42\t\n\x07_x_flagB\t\n\x07_r_flagB\t\n\x07_n_flag\"L\n\x19LldpNeighborsStateRequest\x12\x12\n\nlldp_names\x18\x01 \x03(\t\x12\x1b\n\x13neighbor_id_filters\x18\x02 \x03(\t\"\x8b\t\n\x12LldpNeighborsState\x12\x16\n\tlldp_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0bsystem_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1f\n\x12system_description\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x17\n\nchassis_id\x18\x04 \x01(\tH\x03\x88\x01\x01\x12H\n\x0f\x63hassis_id_type\x18\x05 \x01(\x0e\x32*.otg.LldpNeighborsState.ChassisIdType.EnumH\x04\x88\x01\x01\x12\x18\n\x0bneighbor_id\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\x10\n\x03\x61ge\x18\x07 \x01(\rH\x06\x88\x01\x01\x12\x18\n\x0blast_update\x18\x08 \x01(\rH\x07\x88\x01\x01\x12\x10\n\x03ttl\x18\t \x01(\rH\x08\x88\x01\x01\x12\x14\n\x07port_id\x18\n \x01(\tH\t\x88\x01\x01\x12\x42\n\x0cport_id_type\x18\x0b \x01(\x0e\x32\'.otg.LldpNeighborsState.PortIdType.EnumH\n\x88\x01\x01\x12\x1d\n\x10port_description\x18\x0c \x01(\tH\x0b\x88\x01\x01\x12\x1f\n\x12management_address\x18\r \x01(\tH\x0c\x88\x01\x01\x12$\n\x17management_address_type\x18\x0e \x01(\tH\r\x88\x01\x01\x12,\n\x0b\x63ustom_tlvs\x18\x0f \x03(\x0b\x32\x17.otg.LldpCustomTLVState\x12.\n\x0c\x63\x61pabilities\x18\x10 \x03(\x0b\x32\x18.otg.LldpCapabilityState\x1a\xae\x01\n\rChassisIdType\"\x9c\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x12\n\x0eport_component\x10\x01\x12\x13\n\x0fnetwork_address\x10\x02\x12\x15\n\x11\x63hassis_component\x10\x03\x12\x0f\n\x0bmac_address\x10\x04\x12\x12\n\x0einterface_name\x10\x05\x12\t\n\x05local\x10\x06\x12\x13\n\x0finterface_alias\x10\x07\x1a\xaa\x01\n\nPortIdType\"\x9b\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x12\n\x0eport_component\x10\x01\x12\x13\n\x0fnetwork_address\x10\x02\x12\x14\n\x10\x61gent_circuit_id\x10\x03\x12\x0f\n\x0bmac_address\x10\x04\x12\x12\n\x0einterface_name\x10\x05\x12\t\n\x05local\x10\x06\x12\x13\n\x0finterface_alias\x10\x07\x42\x0c\n\n_lldp_nameB\x0e\n\x0c_system_nameB\x15\n\x13_system_descriptionB\r\n\x0b_chassis_idB\x12\n\x10_chassis_id_typeB\x0e\n\x0c_neighbor_idB\x06\n\x04_ageB\x0e\n\x0c_last_updateB\x06\n\x04_ttlB\n\n\x08_port_idB\x0f\n\r_port_id_typeB\x13\n\x11_port_descriptionB\x15\n\x13_management_addressB\x1a\n\x18_management_address_type\"\x82\x01\n\x12LldpCustomTLVState\x12\x18\n\x0b\x63ustom_type\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03oui\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0boui_subtype\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x0e\n\x0c_custom_typeB\x06\n\x04_ouiB\x0e\n\x0c_oui_subtype\"\x90\x03\n\x13LldpCapabilityState\x12J\n\x0f\x63\x61pability_name\x18\x01 \x01(\x0e\x32,.otg.LldpCapabilityState.CapabilityName.EnumH\x00\x88\x01\x01\x12\x1f\n\x12\x63\x61pability_enabled\x18\x02 \x01(\x08H\x01\x88\x01\x01\x1a\xe0\x01\n\x0e\x43\x61pabilityName\"\xcd\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0e\n\nmac_bridge\x10\x01\x12\x16\n\x12two_port_mac_relay\x10\x02\x12\x0c\n\x08repeater\x10\x03\x12\x17\n\x13\x64ocsis_cable_device\x10\x04\x12\n\n\x06s_vlan\x10\x05\x12\r\n\ttelephone\x10\x06\x12\t\n\x05other\x10\x07\x12\n\n\x06router\x10\x08\x12\n\n\x06\x63_vlan\x10\t\x12\x10\n\x0cstation_only\x10\n\x12\x15\n\x11wlan_access_point\x10\x0b\x42\x12\n\x10_capability_nameB\x15\n\x13_capability_enabled\"1\n\x14RsvpLspsStateRequest\x12\x19\n\x11rsvp_router_names\x18\x01 \x03(\t\"m\n\rRsvpLspsState\x12\x1d\n\x10rsvp_router_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12(\n\tipv4_lsps\x18\x02 \x03(\x0b\x32\x15.otg.RsvpIPv4LspStateB\x13\n\x11_rsvp_router_name\"\xe2\x01\n\x10RsvpIPv4LspState\x12\x1b\n\x0esource_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12 \n\x13\x64\x65stination_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1e\n\x03lsp\x18\x03 \x01(\x0b\x32\x11.otg.RsvpLspState\x12!\n\x04rros\x18\x04 \x03(\x0b\x32\x13.otg.RsvpLspIpv4Rro\x12!\n\x04\x65ros\x18\x05 \x03(\x0b\x32\x13.otg.RsvpLspIpv4EroB\x11\n\x0f_source_addressB\x16\n\x14_destination_address\"\xb4\x04\n\x0cRsvpLspState\x12\x16\n\ttunnel_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x13\n\x06lsp_id\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x19\n\x0csession_name\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x15\n\x08label_in\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x16\n\tlabel_out\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x41\n\x0esession_status\x18\x06 \x01(\x0e\x32$.otg.RsvpLspState.SessionStatus.EnumH\x05\x88\x01\x01\x12\x44\n\x10last_flap_reason\x18\x07 \x01(\x0e\x32%.otg.RsvpLspState.LastFlapReason.EnumH\x06\x88\x01\x01\x12\x14\n\x07up_time\x18\x08 \x01(\x04H\x07\x88\x01\x01\x1a:\n\rSessionStatus\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x1aY\n\x0eLastFlapReason\"G\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tresv_tear\x10\x01\x12\r\n\tpath_tear\x10\x02\x12\x10\n\x0cpath_timeout\x10\x03\x42\x0c\n\n_tunnel_idB\t\n\x07_lsp_idB\x0f\n\r_session_nameB\x0b\n\t_label_inB\x0c\n\n_label_outB\x11\n\x0f_session_statusB\x13\n\x11_last_flap_reasonB\n\n\x08_up_time\"b\n\x0eRsvpLspIpv4Rro\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1b\n\x0ereported_label\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\n\n\x08_addressB\x11\n\x0f_reported_label\"\xf2\x01\n\x0eRsvpLspIpv4Ero\x12\x13\n\x06prefix\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x10\n\x03\x61sn\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x30\n\x04type\x18\x03 \x01(\x0e\x32\x1d.otg.RsvpLspIpv4Ero.Type.EnumH\x02\x88\x01\x01\x1ak\n\x04Type\"c\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x12\x07\n\x03\x61sn\x10\x03\x12\x08\n\x04\x61sn4\x10\x04\x12\t\n\x05label\x10\x05\x12\x18\n\x14unnumbered_interface\x10\x06\x42\t\n\x07_prefixB\x06\n\x04_asnB\x07\n\x05_type\"8\n\x1b\x44hcpv4InterfaceStateRequest\x12\x19\n\x11\x64hcp_client_names\x18\x01 \x03(\t\"\xd0\x02\n\x14\x44hcpv4InterfaceState\x12\x1d\n\x10\x64hcp_client_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0cipv4_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x1c\n\x0fgateway_address\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x17\n\nlease_time\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x17\n\nrenew_time\x18\x06 \x01(\rH\x05\x88\x01\x01\x12\x18\n\x0brebind_time\x18\x07 \x01(\rH\x06\x88\x01\x01\x42\x13\n\x11_dhcp_client_nameB\x0f\n\r_ipv4_addressB\x10\n\x0e_prefix_lengthB\x12\n\x10_gateway_addressB\r\n\x0b_lease_timeB\r\n\x0b_renew_timeB\x0e\n\x0c_rebind_time\"4\n\x17\x44hcpv4LeaseStateRequest\x12\x19\n\x11\x64hcp_server_names\x18\x01 \x03(\t\"n\n\x11\x44hcpv4LeasesState\x12\x1d\n\x10\x64hcp_server_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12%\n\x06leases\x18\x02 \x03(\x0b\x32\x15.otg.Dhcpv4LeaseStateB\x13\n\x11_dhcp_server_name\"\xd2\x02\n\x10\x44hcpv4LeaseState\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x17\n\nvalid_time\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1b\n\x0epreferred_time\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x17\n\nrenew_time\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x18\n\x0brebind_time\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x16\n\tclient_id\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\x17\n\ncircuit_id\x18\x07 \x01(\tH\x06\x88\x01\x01\x12\x16\n\tremote_id\x18\x08 \x01(\tH\x07\x88\x01\x01\x42\n\n\x08_addressB\r\n\x0b_valid_timeB\x11\n\x0f_preferred_timeB\r\n\x0b_renew_timeB\x0e\n\x0c_rebind_timeB\x0c\n\n_client_idB\r\n\x0b_circuit_idB\x0c\n\n_remote_id\"6\n\x0e\x43\x61ptureRequest\x12\x16\n\tport_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0c\n\n_port_name\"w\n\x1dPatternFlowEthernetDstCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowEthernetDstMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb6\x03\n\x16PatternFlowEthernetDst\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowEthernetDst.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x11\n\x04\x61uto\x18\x04 \x01(\tH\x02\x88\x01\x01\x12\x35\n\tincrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowEthernetDstCounter\x12\x35\n\tdecrement\x18\x07 \x01(\x0b\x32\".otg.PatternFlowEthernetDstCounter\x12\x39\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32$.otg.PatternFlowEthernetDstMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"w\n\x1dPatternFlowEthernetSrcCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowEthernetSrcMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowEthernetSrc\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowEthernetSrc.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowEthernetSrcCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowEthernetSrcCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowEthernetSrcMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowEthernetEtherTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowEthernetEtherTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xd4\x03\n\x1cPatternFlowEthernetEtherType\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowEthernetEtherType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12;\n\tincrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowEthernetEtherTypeCounter\x12;\n\tdecrement\x18\x07 \x01(\x0b\x32(.otg.PatternFlowEthernetEtherTypeCounter\x12?\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32*.otg.PatternFlowEthernetEtherTypeMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"|\n\"PatternFlowEthernetPfcQueueCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowEthernetPfcQueueMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowEthernetPfcQueue\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowEthernetPfcQueue.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowEthernetPfcQueueCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowEthernetPfcQueueCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowEthernetPfcQueueMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowVlanPriorityCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowVlanPriorityMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowVlanPriority\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowVlanPriority.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowVlanPriorityCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowVlanPriorityCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowVlanPriorityMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"s\n\x19PatternFlowVlanCfiCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"y\n\x1bPatternFlowVlanCfiMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xfc\x02\n\x12PatternFlowVlanCfi\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.PatternFlowVlanCfi.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x31\n\tincrement\x18\x05 \x01(\x0b\x32\x1e.otg.PatternFlowVlanCfiCounter\x12\x31\n\tdecrement\x18\x06 \x01(\x0b\x32\x1e.otg.PatternFlowVlanCfiCounter\x12\x35\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32 .otg.PatternFlowVlanCfiMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"r\n\x18PatternFlowVlanIdCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"x\n\x1aPatternFlowVlanIdMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xf7\x02\n\x11PatternFlowVlanId\x12\x37\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\".otg.PatternFlowVlanId.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x30\n\tincrement\x18\x05 \x01(\x0b\x32\x1d.otg.PatternFlowVlanIdCounter\x12\x30\n\tdecrement\x18\x06 \x01(\x0b\x32\x1d.otg.PatternFlowVlanIdCounter\x12\x34\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x1f.otg.PatternFlowVlanIdMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"t\n\x1aPatternFlowVlanTpidCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"z\n\x1cPatternFlowVlanTpidMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x81\x03\n\x13PatternFlowVlanTpid\x12\x39\n\x06\x63hoice\x18\x01 \x01(\x0e\x32$.otg.PatternFlowVlanTpid.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x32\n\tincrement\x18\x05 \x01(\x0b\x32\x1f.otg.PatternFlowVlanTpidCounter\x12\x32\n\tdecrement\x18\x06 \x01(\x0b\x32\x1f.otg.PatternFlowVlanTpidCounter\x12\x36\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32!.otg.PatternFlowVlanTpidMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowVxlanFlagsCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowVxlanFlagsMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowVxlanFlags\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowVxlanFlags.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowVxlanFlagsCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowVxlanFlagsCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowVxlanFlagsMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"z\n PatternFlowVxlanReserved0Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x80\x01\n\"PatternFlowVxlanReserved0MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9f\x03\n\x19PatternFlowVxlanReserved0\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowVxlanReserved0.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x38\n\tincrement\x18\x05 \x01(\x0b\x32%.otg.PatternFlowVxlanReserved0Counter\x12\x38\n\tdecrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowVxlanReserved0Counter\x12<\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\'.otg.PatternFlowVxlanReserved0MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"t\n\x1aPatternFlowVxlanVniCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"z\n\x1cPatternFlowVxlanVniMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa7\x03\n\x13PatternFlowVxlanVni\x12\x39\n\x06\x63hoice\x18\x01 \x01(\x0e\x32$.otg.PatternFlowVxlanVni.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x32\n\tincrement\x18\x06 \x01(\x0b\x32\x1f.otg.PatternFlowVxlanVniCounter\x12\x32\n\tdecrement\x18\x07 \x01(\x0b\x32\x1f.otg.PatternFlowVxlanVniCounter\x12\x36\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32!.otg.PatternFlowVxlanVniMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"z\n PatternFlowVxlanReserved1Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x80\x01\n\"PatternFlowVxlanReserved1MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9f\x03\n\x19PatternFlowVxlanReserved1\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowVxlanReserved1.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x38\n\tincrement\x18\x05 \x01(\x0b\x32%.otg.PatternFlowVxlanReserved1Counter\x12\x38\n\tdecrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowVxlanReserved1Counter\x12<\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\'.otg.PatternFlowVxlanReserved1MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowIpv4VersionCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowIpv4VersionMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowIpv4Version\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowIpv4Version.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowIpv4VersionCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowIpv4VersionCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowIpv4VersionMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"|\n\"PatternFlowIpv4HeaderLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowIpv4HeaderLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xcf\x03\n\x1bPatternFlowIpv4HeaderLength\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowIpv4HeaderLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12:\n\tincrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowIpv4HeaderLengthCounter\x12:\n\tdecrement\x18\x07 \x01(\x0b\x32\'.otg.PatternFlowIpv4HeaderLengthCounter\x12>\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32).otg.PatternFlowIpv4HeaderLengthMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"{\n!PatternFlowIpv4TotalLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x81\x01\n#PatternFlowIpv4TotalLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xca\x03\n\x1aPatternFlowIpv4TotalLength\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.PatternFlowIpv4TotalLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x39\n\tincrement\x18\x06 \x01(\x0b\x32&.otg.PatternFlowIpv4TotalLengthCounter\x12\x39\n\tdecrement\x18\x07 \x01(\x0b\x32&.otg.PatternFlowIpv4TotalLengthCounter\x12=\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32(.otg.PatternFlowIpv4TotalLengthMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"~\n$PatternFlowIpv4IdentificationCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowIpv4IdentificationMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowIpv4Identification\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIpv4Identification.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowIpv4IdentificationCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowIpv4IdentificationCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowIpv4IdentificationMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowIpv4ReservedCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowIpv4ReservedMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowIpv4Reserved\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowIpv4Reserved.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowIpv4ReservedCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowIpv4ReservedCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowIpv4ReservedMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"|\n\"PatternFlowIpv4DontFragmentCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowIpv4DontFragmentMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowIpv4DontFragment\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowIpv4DontFragment.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowIpv4DontFragmentCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowIpv4DontFragmentCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowIpv4DontFragmentMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowIpv4MoreFragmentsCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowIpv4MoreFragmentsMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowIpv4MoreFragments\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowIpv4MoreFragments.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowIpv4MoreFragmentsCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowIpv4MoreFragmentsCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowIpv4MoreFragmentsMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"~\n$PatternFlowIpv4FragmentOffsetCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowIpv4FragmentOffsetMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowIpv4FragmentOffset\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIpv4FragmentOffset.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowIpv4FragmentOffsetCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowIpv4FragmentOffsetCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowIpv4FragmentOffsetMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"z\n PatternFlowIpv4TimeToLiveCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x80\x01\n\"PatternFlowIpv4TimeToLiveMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9f\x03\n\x19PatternFlowIpv4TimeToLive\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowIpv4TimeToLive.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x38\n\tincrement\x18\x05 \x01(\x0b\x32%.otg.PatternFlowIpv4TimeToLiveCounter\x12\x38\n\tdecrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowIpv4TimeToLiveCounter\x12<\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\'.otg.PatternFlowIpv4TimeToLiveMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowIpv4ProtocolCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowIpv4ProtocolMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xbb\x03\n\x17PatternFlowIpv4Protocol\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowIpv4Protocol.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x36\n\tincrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowIpv4ProtocolCounter\x12\x36\n\tdecrement\x18\x07 \x01(\x0b\x32#.otg.PatternFlowIpv4ProtocolCounter\x12:\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32%.otg.PatternFlowIpv4ProtocolMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"\xdf\x02\n\x1dPatternFlowIpv4HeaderChecksum\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIpv4HeaderChecksum.Choice.EnumH\x00\x88\x01\x01\x12I\n\tgenerated\x18\x02 \x01(\x0e\x32\x31.otg.PatternFlowIpv4HeaderChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"s\n\x19PatternFlowIpv4SrcCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"y\n\x1bPatternFlowIpv4SrcMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa7\x03\n\x12PatternFlowIpv4Src\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.PatternFlowIpv4Src.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x31\n\tincrement\x18\x05 \x01(\x0b\x32\x1e.otg.PatternFlowIpv4SrcCounter\x12\x31\n\tdecrement\x18\x06 \x01(\x0b\x32\x1e.otg.PatternFlowIpv4SrcCounter\x12\x35\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32 .otg.PatternFlowIpv4SrcMetricTag\x12\x1f\n\x04\x61uto\x18\x08 \x01(\x0b\x32\x11.otg.FlowIpv4Auto\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"s\n\x19PatternFlowIpv4DstCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"y\n\x1bPatternFlowIpv4DstMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa7\x03\n\x12PatternFlowIpv4Dst\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.PatternFlowIpv4Dst.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x31\n\tincrement\x18\x05 \x01(\x0b\x32\x1e.otg.PatternFlowIpv4DstCounter\x12\x31\n\tdecrement\x18\x06 \x01(\x0b\x32\x1e.otg.PatternFlowIpv4DstCounter\x12\x35\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32 .otg.PatternFlowIpv4DstMetricTag\x12\x1f\n\x04\x61uto\x18\x08 \x01(\x0b\x32\x11.otg.FlowIpv4Auto\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x8b\x01\n1PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xa5\x03\n*PatternFlowIpv4OptionsCustomTypeCopiedFlag\x12P\n\x06\x63hoice\x18\x01 \x01(\x0e\x32;.otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12I\n\tincrement\x18\x05 \x01(\x0b\x32\x36.otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter\x12I\n\tdecrement\x18\x06 \x01(\x0b\x32\x36.otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x8c\x01\n2PatternFlowIpv4OptionsCustomTypeOptionClassCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xa9\x03\n+PatternFlowIpv4OptionsCustomTypeOptionClass\x12Q\n\x06\x63hoice\x18\x01 \x01(\x0e\x32<.otg.PatternFlowIpv4OptionsCustomTypeOptionClass.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12J\n\tincrement\x18\x05 \x01(\x0b\x32\x37.otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter\x12J\n\tdecrement\x18\x06 \x01(\x0b\x32\x37.otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x8d\x01\n3PatternFlowIpv4OptionsCustomTypeOptionNumberCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xad\x03\n,PatternFlowIpv4OptionsCustomTypeOptionNumber\x12R\n\x06\x63hoice\x18\x01 \x01(\x0e\x32=.otg.PatternFlowIpv4OptionsCustomTypeOptionNumber.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12K\n\tincrement\x18\x05 \x01(\x0b\x32\x38.otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter\x12K\n\tdecrement\x18\x06 \x01(\x0b\x32\x38.otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"{\n!PatternFlowIpv4PriorityRawCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x81\x01\n#PatternFlowIpv4PriorityRawMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa4\x03\n\x1aPatternFlowIpv4PriorityRaw\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.PatternFlowIpv4PriorityRaw.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x39\n\tincrement\x18\x05 \x01(\x0b\x32&.otg.PatternFlowIpv4PriorityRawCounter\x12\x39\n\tdecrement\x18\x06 \x01(\x0b\x32&.otg.PatternFlowIpv4PriorityRawCounter\x12=\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32(.otg.PatternFlowIpv4PriorityRawMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowIpv4DscpPhbCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowIpv4DscpPhbMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowIpv4DscpPhb\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowIpv4DscpPhb.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowIpv4DscpPhbCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowIpv4DscpPhbCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowIpv4DscpPhbMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowIpv4DscpEcnCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowIpv4DscpEcnMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowIpv4DscpEcn\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowIpv4DscpEcn.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowIpv4DscpEcnCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowIpv4DscpEcnCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowIpv4DscpEcnMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowIpv4TosPrecedenceCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowIpv4TosPrecedenceMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowIpv4TosPrecedence\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowIpv4TosPrecedence.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowIpv4TosPrecedenceCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowIpv4TosPrecedenceCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowIpv4TosPrecedenceMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowIpv4TosDelayCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowIpv4TosDelayMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowIpv4TosDelay\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowIpv4TosDelay.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowIpv4TosDelayCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowIpv4TosDelayCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowIpv4TosDelayMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowIpv4TosThroughputCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowIpv4TosThroughputMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowIpv4TosThroughput\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowIpv4TosThroughput.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowIpv4TosThroughputCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowIpv4TosThroughputCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowIpv4TosThroughputMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"~\n$PatternFlowIpv4TosReliabilityCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowIpv4TosReliabilityMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowIpv4TosReliability\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIpv4TosReliability.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowIpv4TosReliabilityCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowIpv4TosReliabilityCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowIpv4TosReliabilityMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"{\n!PatternFlowIpv4TosMonetaryCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x81\x01\n#PatternFlowIpv4TosMonetaryMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa4\x03\n\x1aPatternFlowIpv4TosMonetary\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.PatternFlowIpv4TosMonetary.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x39\n\tincrement\x18\x05 \x01(\x0b\x32&.otg.PatternFlowIpv4TosMonetaryCounter\x12\x39\n\tdecrement\x18\x06 \x01(\x0b\x32&.otg.PatternFlowIpv4TosMonetaryCounter\x12=\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32(.otg.PatternFlowIpv4TosMonetaryMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"y\n\x1fPatternFlowIpv4TosUnusedCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x7f\n!PatternFlowIpv4TosUnusedMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9a\x03\n\x18PatternFlowIpv4TosUnused\x12>\n\x06\x63hoice\x18\x01 \x01(\x0e\x32).otg.PatternFlowIpv4TosUnused.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x37\n\tincrement\x18\x05 \x01(\x0b\x32$.otg.PatternFlowIpv4TosUnusedCounter\x12\x37\n\tdecrement\x18\x06 \x01(\x0b\x32$.otg.PatternFlowIpv4TosUnusedCounter\x12;\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32&.otg.PatternFlowIpv4TosUnusedMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowIpv6VersionCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowIpv6VersionMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowIpv6Version\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowIpv6Version.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowIpv6VersionCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowIpv6VersionCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowIpv6VersionMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"|\n\"PatternFlowIpv6TrafficClassCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowIpv6TrafficClassMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowIpv6TrafficClass\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowIpv6TrafficClass.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowIpv6TrafficClassCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowIpv6TrafficClassCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowIpv6TrafficClassMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"y\n\x1fPatternFlowIpv6FlowLabelCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x7f\n!PatternFlowIpv6FlowLabelMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9a\x03\n\x18PatternFlowIpv6FlowLabel\x12>\n\x06\x63hoice\x18\x01 \x01(\x0e\x32).otg.PatternFlowIpv6FlowLabel.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x37\n\tincrement\x18\x05 \x01(\x0b\x32$.otg.PatternFlowIpv6FlowLabelCounter\x12\x37\n\tdecrement\x18\x06 \x01(\x0b\x32$.otg.PatternFlowIpv6FlowLabelCounter\x12;\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32&.otg.PatternFlowIpv6FlowLabelMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowIpv6PayloadLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowIpv6PayloadLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xd4\x03\n\x1cPatternFlowIpv6PayloadLength\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowIpv6PayloadLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12;\n\tincrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowIpv6PayloadLengthCounter\x12;\n\tdecrement\x18\x07 \x01(\x0b\x32(.otg.PatternFlowIpv6PayloadLengthCounter\x12?\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32*.otg.PatternFlowIpv6PayloadLengthMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"z\n PatternFlowIpv6NextHeaderCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x80\x01\n\"PatternFlowIpv6NextHeaderMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc5\x03\n\x19PatternFlowIpv6NextHeader\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowIpv6NextHeader.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x38\n\tincrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowIpv6NextHeaderCounter\x12\x38\n\tdecrement\x18\x07 \x01(\x0b\x32%.otg.PatternFlowIpv6NextHeaderCounter\x12<\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32\'.otg.PatternFlowIpv6NextHeaderMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"x\n\x1ePatternFlowIpv6HopLimitCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowIpv6HopLimitMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowIpv6HopLimit\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowIpv6HopLimit.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowIpv6HopLimitCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowIpv6HopLimitCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowIpv6HopLimitMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"s\n\x19PatternFlowIpv6SrcCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"y\n\x1bPatternFlowIpv6SrcMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xfc\x02\n\x12PatternFlowIpv6Src\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.PatternFlowIpv6Src.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x31\n\tincrement\x18\x05 \x01(\x0b\x32\x1e.otg.PatternFlowIpv6SrcCounter\x12\x31\n\tdecrement\x18\x06 \x01(\x0b\x32\x1e.otg.PatternFlowIpv6SrcCounter\x12\x35\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32 .otg.PatternFlowIpv6SrcMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"s\n\x19PatternFlowIpv6DstCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"y\n\x1bPatternFlowIpv6DstMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xfc\x02\n\x12PatternFlowIpv6Dst\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.PatternFlowIpv6Dst.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x31\n\tincrement\x18\x05 \x01(\x0b\x32\x1e.otg.PatternFlowIpv6DstCounter\x12\x31\n\tdecrement\x18\x06 \x01(\x0b\x32\x1e.otg.PatternFlowIpv6DstCounter\x12\x35\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32 .otg.PatternFlowIpv6DstMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowPfcPauseDstCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowPfcPauseDstMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowPfcPauseDst\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowPfcPauseDst.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowPfcPauseDstCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowPfcPauseDstCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowPfcPauseDstMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowPfcPauseSrcCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowPfcPauseSrcMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowPfcPauseSrc\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowPfcPauseSrc.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowPfcPauseSrcCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowPfcPauseSrcCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowPfcPauseSrcMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowPfcPauseEtherTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowPfcPauseEtherTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowPfcPauseEtherType\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowPfcPauseEtherType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowPfcPauseEtherTypeCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowPfcPauseEtherTypeCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowPfcPauseEtherTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x81\x01\n\'PatternFlowPfcPauseControlOpCodeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x87\x01\n)PatternFlowPfcPauseControlOpCodeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc2\x03\n PatternFlowPfcPauseControlOpCode\x12\x46\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x31.otg.PatternFlowPfcPauseControlOpCode.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12?\n\tincrement\x18\x05 \x01(\x0b\x32,.otg.PatternFlowPfcPauseControlOpCodeCounter\x12?\n\tdecrement\x18\x06 \x01(\x0b\x32,.otg.PatternFlowPfcPauseControlOpCodeCounter\x12\x43\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32..otg.PatternFlowPfcPauseControlOpCodeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x85\x01\n+PatternFlowPfcPauseClassEnableVectorCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8b\x01\n-PatternFlowPfcPauseClassEnableVectorMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xd6\x03\n$PatternFlowPfcPauseClassEnableVector\x12J\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x35.otg.PatternFlowPfcPauseClassEnableVector.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x43\n\tincrement\x18\x05 \x01(\x0b\x32\x30.otg.PatternFlowPfcPauseClassEnableVectorCounter\x12\x43\n\tdecrement\x18\x06 \x01(\x0b\x32\x30.otg.PatternFlowPfcPauseClassEnableVectorCounter\x12G\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x32.otg.PatternFlowPfcPauseClassEnableVectorMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass0Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass0MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass0\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass0.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass0Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass0Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass0MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass1Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass1MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass1\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass1.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass1Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass1Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass1MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass2Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass2MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass2\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass2.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass2Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass2Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass2MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass3Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass3MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass3\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass3.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass3Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass3Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass3MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass4Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass4MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass4\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass4.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass4Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass4Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass4MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass5Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass5MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass5\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass5.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass5Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass5Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass5MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass6Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass6MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass6\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass6.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass6Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass6Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass6MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass7Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass7MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass7\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass7.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass7Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass7Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass7MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"|\n\"PatternFlowEthernetPauseDstCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowEthernetPauseDstMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowEthernetPauseDst\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowEthernetPauseDst.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowEthernetPauseDstCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowEthernetPauseDstCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowEthernetPauseDstMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"|\n\"PatternFlowEthernetPauseSrcCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowEthernetPauseSrcMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowEthernetPauseSrc\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowEthernetPauseSrc.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowEthernetPauseSrcCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowEthernetPauseSrcCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowEthernetPauseSrcMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x82\x01\n(PatternFlowEthernetPauseEtherTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x88\x01\n*PatternFlowEthernetPauseEtherTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc7\x03\n!PatternFlowEthernetPauseEtherType\x12G\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x32.otg.PatternFlowEthernetPauseEtherType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12@\n\tincrement\x18\x05 \x01(\x0b\x32-.otg.PatternFlowEthernetPauseEtherTypeCounter\x12@\n\tdecrement\x18\x06 \x01(\x0b\x32-.otg.PatternFlowEthernetPauseEtherTypeCounter\x12\x44\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32/.otg.PatternFlowEthernetPauseEtherTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x86\x01\n,PatternFlowEthernetPauseControlOpCodeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8c\x01\n.PatternFlowEthernetPauseControlOpCodeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xdb\x03\n%PatternFlowEthernetPauseControlOpCode\x12K\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x36.otg.PatternFlowEthernetPauseControlOpCode.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x44\n\tincrement\x18\x05 \x01(\x0b\x32\x31.otg.PatternFlowEthernetPauseControlOpCodeCounter\x12\x44\n\tdecrement\x18\x06 \x01(\x0b\x32\x31.otg.PatternFlowEthernetPauseControlOpCodeCounter\x12H\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x33.otg.PatternFlowEthernetPauseControlOpCodeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowEthernetPauseTimeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowEthernetPauseTimeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowEthernetPauseTime\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowEthernetPauseTime.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowEthernetPauseTimeCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowEthernetPauseTimeCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowEthernetPauseTimeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowTcpSrcPortCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowTcpSrcPortMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowTcpSrcPort\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowTcpSrcPort.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowTcpSrcPortCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowTcpSrcPortCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowTcpSrcPortMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowTcpDstPortCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowTcpDstPortMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowTcpDstPort\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowTcpDstPort.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowTcpDstPortCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowTcpDstPortCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowTcpDstPortMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpSeqNumCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpSeqNumMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpSeqNum\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpSeqNum.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpSeqNumCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpSeqNumCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpSeqNumMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpAckNumCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpAckNumMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpAckNum\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpAckNum.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpAckNumCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpAckNumCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpAckNumMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"y\n\x1fPatternFlowTcpDataOffsetCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x7f\n!PatternFlowTcpDataOffsetMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9a\x03\n\x18PatternFlowTcpDataOffset\x12>\n\x06\x63hoice\x18\x01 \x01(\x0e\x32).otg.PatternFlowTcpDataOffset.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x37\n\tincrement\x18\x05 \x01(\x0b\x32$.otg.PatternFlowTcpDataOffsetCounter\x12\x37\n\tdecrement\x18\x06 \x01(\x0b\x32$.otg.PatternFlowTcpDataOffsetCounter\x12;\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32&.otg.PatternFlowTcpDataOffsetMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"t\n\x1aPatternFlowTcpEcnNsCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"z\n\x1cPatternFlowTcpEcnNsMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x81\x03\n\x13PatternFlowTcpEcnNs\x12\x39\n\x06\x63hoice\x18\x01 \x01(\x0e\x32$.otg.PatternFlowTcpEcnNs.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x32\n\tincrement\x18\x05 \x01(\x0b\x32\x1f.otg.PatternFlowTcpEcnNsCounter\x12\x32\n\tdecrement\x18\x06 \x01(\x0b\x32\x1f.otg.PatternFlowTcpEcnNsCounter\x12\x36\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32!.otg.PatternFlowTcpEcnNsMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpEcnCwrCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpEcnCwrMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpEcnCwr\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpEcnCwr.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpEcnCwrCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpEcnCwrCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpEcnCwrMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowTcpEcnEchoCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowTcpEcnEchoMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowTcpEcnEcho\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowTcpEcnEcho.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowTcpEcnEchoCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowTcpEcnEchoCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowTcpEcnEchoMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpCtlUrgCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpCtlUrgMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpCtlUrg\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpCtlUrg.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpCtlUrgCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpCtlUrgCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpCtlUrgMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpCtlAckCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpCtlAckMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpCtlAck\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpCtlAck.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpCtlAckCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpCtlAckCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpCtlAckMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpCtlPshCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpCtlPshMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpCtlPsh\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpCtlPsh.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpCtlPshCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpCtlPshCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpCtlPshMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpCtlRstCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpCtlRstMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpCtlRst\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpCtlRst.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpCtlRstCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpCtlRstCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpCtlRstMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpCtlSynCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpCtlSynMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpCtlSyn\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpCtlSyn.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpCtlSynCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpCtlSynCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpCtlSynMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpCtlFinCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpCtlFinMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpCtlFin\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpCtlFin.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpCtlFinCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpCtlFinCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpCtlFinMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpWindowCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpWindowMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpWindow\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpWindow.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpWindowCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpWindowCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpWindowMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xca\x02\n\x16PatternFlowTcpChecksum\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowTcpChecksum.Choice.EnumH\x00\x88\x01\x01\x12\x42\n\tgenerated\x18\x02 \x01(\x0e\x32*.otg.PatternFlowTcpChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"v\n\x1cPatternFlowUdpSrcPortCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowUdpSrcPortMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowUdpSrcPort\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowUdpSrcPort.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowUdpSrcPortCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowUdpSrcPortCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowUdpSrcPortMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowUdpDstPortCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowUdpDstPortMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowUdpDstPort\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowUdpDstPort.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowUdpDstPortCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowUdpDstPortCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowUdpDstPortMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowUdpLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowUdpLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowUdpLength\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowUdpLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowUdpLengthCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowUdpLengthCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowUdpLengthMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xca\x02\n\x16PatternFlowUdpChecksum\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowUdpChecksum.Choice.EnumH\x00\x88\x01\x01\x12\x42\n\tgenerated\x18\x02 \x01(\x0e\x32*.otg.PatternFlowUdpChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"~\n$PatternFlowGreChecksumPresentCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowGreChecksumPresentMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowGreChecksumPresent\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowGreChecksumPresent.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowGreChecksumPresentCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowGreChecksumPresentCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowGreChecksumPresentMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowGreReserved0Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowGreReserved0MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowGreReserved0\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowGreReserved0.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowGreReserved0Counter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowGreReserved0Counter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowGreReserved0MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowGreVersionCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowGreVersionMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowGreVersion\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowGreVersion.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowGreVersionCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowGreVersionCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowGreVersionMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowGreProtocolCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowGreProtocolMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowGreProtocol\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowGreProtocol.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowGreProtocolCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowGreProtocolCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowGreProtocolMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xca\x02\n\x16PatternFlowGreChecksum\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowGreChecksum.Choice.EnumH\x00\x88\x01\x01\x12\x42\n\tgenerated\x18\x02 \x01(\x0e\x32*.otg.PatternFlowGreChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"x\n\x1ePatternFlowGreReserved1Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowGreReserved1MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowGreReserved1\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowGreReserved1.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowGreReserved1Counter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowGreReserved1Counter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowGreReserved1MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowGtpv1VersionCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowGtpv1VersionMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowGtpv1Version\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowGtpv1Version.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowGtpv1VersionCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowGtpv1VersionCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowGtpv1VersionMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowGtpv1ProtocolTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowGtpv1ProtocolTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowGtpv1ProtocolType\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowGtpv1ProtocolType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowGtpv1ProtocolTypeCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowGtpv1ProtocolTypeCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowGtpv1ProtocolTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"y\n\x1fPatternFlowGtpv1ReservedCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x7f\n!PatternFlowGtpv1ReservedMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9a\x03\n\x18PatternFlowGtpv1Reserved\x12>\n\x06\x63hoice\x18\x01 \x01(\x0e\x32).otg.PatternFlowGtpv1Reserved.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x37\n\tincrement\x18\x05 \x01(\x0b\x32$.otg.PatternFlowGtpv1ReservedCounter\x12\x37\n\tdecrement\x18\x06 \x01(\x0b\x32$.otg.PatternFlowGtpv1ReservedCounter\x12;\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32&.otg.PatternFlowGtpv1ReservedMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowGtpv1EFlagCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowGtpv1EFlagMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowGtpv1EFlag\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowGtpv1EFlag.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowGtpv1EFlagCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowGtpv1EFlagCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowGtpv1EFlagMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowGtpv1SFlagCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowGtpv1SFlagMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowGtpv1SFlag\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowGtpv1SFlag.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowGtpv1SFlagCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowGtpv1SFlagCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowGtpv1SFlagMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowGtpv1PnFlagCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowGtpv1PnFlagMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowGtpv1PnFlag\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowGtpv1PnFlag.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowGtpv1PnFlagCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowGtpv1PnFlagCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowGtpv1PnFlagMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"|\n\"PatternFlowGtpv1MessageTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowGtpv1MessageTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowGtpv1MessageType\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowGtpv1MessageType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowGtpv1MessageTypeCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowGtpv1MessageTypeCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowGtpv1MessageTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"~\n$PatternFlowGtpv1MessageLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowGtpv1MessageLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowGtpv1MessageLength\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowGtpv1MessageLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowGtpv1MessageLengthCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowGtpv1MessageLengthCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowGtpv1MessageLengthMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowGtpv1TeidCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowGtpv1TeidMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowGtpv1Teid\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowGtpv1Teid.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowGtpv1TeidCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowGtpv1TeidCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowGtpv1TeidMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"~\n$PatternFlowGtpv1SquenceNumberCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowGtpv1SquenceNumberMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowGtpv1SquenceNumber\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowGtpv1SquenceNumber.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowGtpv1SquenceNumberCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowGtpv1SquenceNumberCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowGtpv1SquenceNumberMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"{\n!PatternFlowGtpv1NPduNumberCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x81\x01\n#PatternFlowGtpv1NPduNumberMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa4\x03\n\x1aPatternFlowGtpv1NPduNumber\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.PatternFlowGtpv1NPduNumber.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x39\n\tincrement\x18\x05 \x01(\x0b\x32&.otg.PatternFlowGtpv1NPduNumberCounter\x12\x39\n\tdecrement\x18\x06 \x01(\x0b\x32&.otg.PatternFlowGtpv1NPduNumberCounter\x12=\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32(.otg.PatternFlowGtpv1NPduNumberMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x88\x01\n.PatternFlowGtpv1NextExtensionHeaderTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8e\x01\n0PatternFlowGtpv1NextExtensionHeaderTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xe5\x03\n\'PatternFlowGtpv1NextExtensionHeaderType\x12M\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x38.otg.PatternFlowGtpv1NextExtensionHeaderType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x46\n\tincrement\x18\x05 \x01(\x0b\x32\x33.otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter\x12\x46\n\tdecrement\x18\x06 \x01(\x0b\x32\x33.otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter\x12J\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x35.otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x87\x01\n-PatternFlowGtpExtensionExtensionLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8d\x01\n/PatternFlowGtpExtensionExtensionLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xe0\x03\n&PatternFlowGtpExtensionExtensionLength\x12L\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x37.otg.PatternFlowGtpExtensionExtensionLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x45\n\tincrement\x18\x05 \x01(\x0b\x32\x32.otg.PatternFlowGtpExtensionExtensionLengthCounter\x12\x45\n\tdecrement\x18\x06 \x01(\x0b\x32\x32.otg.PatternFlowGtpExtensionExtensionLengthCounter\x12I\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x34.otg.PatternFlowGtpExtensionExtensionLengthMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x80\x01\n&PatternFlowGtpExtensionContentsCounter\x12\x12\n\x05start\x18\x01 \x01(\x04H\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\x04H\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x86\x01\n(PatternFlowGtpExtensionContentsMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\x04H\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xbd\x03\n\x1fPatternFlowGtpExtensionContents\x12\x45\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x30.otg.PatternFlowGtpExtensionContents.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\x04\x12>\n\tincrement\x18\x05 \x01(\x0b\x32+.otg.PatternFlowGtpExtensionContentsCounter\x12>\n\tdecrement\x18\x06 \x01(\x0b\x32+.otg.PatternFlowGtpExtensionContentsCounter\x12\x42\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32-.otg.PatternFlowGtpExtensionContentsMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x8b\x01\n1PatternFlowGtpExtensionNextExtensionHeaderCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x91\x01\n3PatternFlowGtpExtensionNextExtensionHeaderMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xf4\x03\n*PatternFlowGtpExtensionNextExtensionHeader\x12P\n\x06\x63hoice\x18\x01 \x01(\x0e\x32;.otg.PatternFlowGtpExtensionNextExtensionHeader.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12I\n\tincrement\x18\x05 \x01(\x0b\x32\x36.otg.PatternFlowGtpExtensionNextExtensionHeaderCounter\x12I\n\tdecrement\x18\x06 \x01(\x0b\x32\x36.otg.PatternFlowGtpExtensionNextExtensionHeaderCounter\x12M\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x38.otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowGtpv2VersionCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowGtpv2VersionMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowGtpv2Version\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowGtpv2Version.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowGtpv2VersionCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowGtpv2VersionCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowGtpv2VersionMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x81\x01\n\'PatternFlowGtpv2PiggybackingFlagCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x87\x01\n)PatternFlowGtpv2PiggybackingFlagMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc2\x03\n PatternFlowGtpv2PiggybackingFlag\x12\x46\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x31.otg.PatternFlowGtpv2PiggybackingFlag.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12?\n\tincrement\x18\x05 \x01(\x0b\x32,.otg.PatternFlowGtpv2PiggybackingFlagCounter\x12?\n\tdecrement\x18\x06 \x01(\x0b\x32,.otg.PatternFlowGtpv2PiggybackingFlagCounter\x12\x43\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32..otg.PatternFlowGtpv2PiggybackingFlagMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"y\n\x1fPatternFlowGtpv2TeidFlagCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x7f\n!PatternFlowGtpv2TeidFlagMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9a\x03\n\x18PatternFlowGtpv2TeidFlag\x12>\n\x06\x63hoice\x18\x01 \x01(\x0e\x32).otg.PatternFlowGtpv2TeidFlag.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x37\n\tincrement\x18\x05 \x01(\x0b\x32$.otg.PatternFlowGtpv2TeidFlagCounter\x12\x37\n\tdecrement\x18\x06 \x01(\x0b\x32$.otg.PatternFlowGtpv2TeidFlagCounter\x12;\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32&.otg.PatternFlowGtpv2TeidFlagMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowGtpv2Spare1Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowGtpv2Spare1MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowGtpv2Spare1\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowGtpv2Spare1.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowGtpv2Spare1Counter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowGtpv2Spare1Counter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowGtpv2Spare1MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"|\n\"PatternFlowGtpv2MessageTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowGtpv2MessageTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowGtpv2MessageType\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowGtpv2MessageType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowGtpv2MessageTypeCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowGtpv2MessageTypeCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowGtpv2MessageTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"~\n$PatternFlowGtpv2MessageLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowGtpv2MessageLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowGtpv2MessageLength\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowGtpv2MessageLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowGtpv2MessageLengthCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowGtpv2MessageLengthCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowGtpv2MessageLengthMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowGtpv2TeidCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowGtpv2TeidMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowGtpv2Teid\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowGtpv2Teid.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowGtpv2TeidCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowGtpv2TeidCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowGtpv2TeidMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowGtpv2SequenceNumberCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowGtpv2SequenceNumberMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowGtpv2SequenceNumber\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowGtpv2SequenceNumber.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowGtpv2SequenceNumberCounter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowGtpv2SequenceNumberCounter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowGtpv2SequenceNumberMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowGtpv2Spare2Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowGtpv2Spare2MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowGtpv2Spare2\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowGtpv2Spare2.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowGtpv2Spare2Counter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowGtpv2Spare2Counter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowGtpv2Spare2MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"{\n!PatternFlowArpHardwareTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x81\x01\n#PatternFlowArpHardwareTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa4\x03\n\x1aPatternFlowArpHardwareType\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.PatternFlowArpHardwareType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x39\n\tincrement\x18\x05 \x01(\x0b\x32&.otg.PatternFlowArpHardwareTypeCounter\x12\x39\n\tdecrement\x18\x06 \x01(\x0b\x32&.otg.PatternFlowArpHardwareTypeCounter\x12=\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32(.otg.PatternFlowArpHardwareTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"{\n!PatternFlowArpProtocolTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x81\x01\n#PatternFlowArpProtocolTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa4\x03\n\x1aPatternFlowArpProtocolType\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.PatternFlowArpProtocolType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x39\n\tincrement\x18\x05 \x01(\x0b\x32&.otg.PatternFlowArpProtocolTypeCounter\x12\x39\n\tdecrement\x18\x06 \x01(\x0b\x32&.otg.PatternFlowArpProtocolTypeCounter\x12=\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32(.otg.PatternFlowArpProtocolTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowArpHardwareLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowArpHardwareLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowArpHardwareLength\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowArpHardwareLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowArpHardwareLengthCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowArpHardwareLengthCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowArpHardwareLengthMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowArpProtocolLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowArpProtocolLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowArpProtocolLength\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowArpProtocolLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowArpProtocolLengthCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowArpProtocolLengthCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowArpProtocolLengthMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowArpOperationCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowArpOperationMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowArpOperation\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowArpOperation.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowArpOperationCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowArpOperationCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowArpOperationMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x81\x01\n\'PatternFlowArpSenderHardwareAddrCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x87\x01\n)PatternFlowArpSenderHardwareAddrMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc2\x03\n PatternFlowArpSenderHardwareAddr\x12\x46\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x31.otg.PatternFlowArpSenderHardwareAddr.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12?\n\tincrement\x18\x05 \x01(\x0b\x32,.otg.PatternFlowArpSenderHardwareAddrCounter\x12?\n\tdecrement\x18\x06 \x01(\x0b\x32,.otg.PatternFlowArpSenderHardwareAddrCounter\x12\x43\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32..otg.PatternFlowArpSenderHardwareAddrMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x81\x01\n\'PatternFlowArpSenderProtocolAddrCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x87\x01\n)PatternFlowArpSenderProtocolAddrMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc2\x03\n PatternFlowArpSenderProtocolAddr\x12\x46\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x31.otg.PatternFlowArpSenderProtocolAddr.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12?\n\tincrement\x18\x05 \x01(\x0b\x32,.otg.PatternFlowArpSenderProtocolAddrCounter\x12?\n\tdecrement\x18\x06 \x01(\x0b\x32,.otg.PatternFlowArpSenderProtocolAddrCounter\x12\x43\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32..otg.PatternFlowArpSenderProtocolAddrMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x81\x01\n\'PatternFlowArpTargetHardwareAddrCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x87\x01\n)PatternFlowArpTargetHardwareAddrMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc2\x03\n PatternFlowArpTargetHardwareAddr\x12\x46\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x31.otg.PatternFlowArpTargetHardwareAddr.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12?\n\tincrement\x18\x05 \x01(\x0b\x32,.otg.PatternFlowArpTargetHardwareAddrCounter\x12?\n\tdecrement\x18\x06 \x01(\x0b\x32,.otg.PatternFlowArpTargetHardwareAddrCounter\x12\x43\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32..otg.PatternFlowArpTargetHardwareAddrMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x81\x01\n\'PatternFlowArpTargetProtocolAddrCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x87\x01\n)PatternFlowArpTargetProtocolAddrMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc2\x03\n PatternFlowArpTargetProtocolAddr\x12\x46\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x31.otg.PatternFlowArpTargetProtocolAddr.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12?\n\tincrement\x18\x05 \x01(\x0b\x32,.otg.PatternFlowArpTargetProtocolAddrCounter\x12?\n\tdecrement\x18\x06 \x01(\x0b\x32,.otg.PatternFlowArpTargetProtocolAddrCounter\x12\x43\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32..otg.PatternFlowArpTargetProtocolAddrMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowIcmpEchoTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowIcmpEchoTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowIcmpEchoType\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowIcmpEchoType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowIcmpEchoTypeCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowIcmpEchoTypeCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowIcmpEchoTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowIcmpEchoCodeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowIcmpEchoCodeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowIcmpEchoCode\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowIcmpEchoCode.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowIcmpEchoCodeCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowIcmpEchoCodeCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowIcmpEchoCodeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xd9\x02\n\x1bPatternFlowIcmpEchoChecksum\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowIcmpEchoChecksum.Choice.EnumH\x00\x88\x01\x01\x12G\n\tgenerated\x18\x02 \x01(\x0e\x32/.otg.PatternFlowIcmpEchoChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"~\n$PatternFlowIcmpEchoIdentifierCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowIcmpEchoIdentifierMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowIcmpEchoIdentifier\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIcmpEchoIdentifier.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowIcmpEchoIdentifierCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowIcmpEchoIdentifierCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowIcmpEchoIdentifierMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x82\x01\n(PatternFlowIcmpEchoSequenceNumberCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x88\x01\n*PatternFlowIcmpEchoSequenceNumberMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc7\x03\n!PatternFlowIcmpEchoSequenceNumber\x12G\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x32.otg.PatternFlowIcmpEchoSequenceNumber.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12@\n\tincrement\x18\x05 \x01(\x0b\x32-.otg.PatternFlowIcmpEchoSequenceNumberCounter\x12@\n\tdecrement\x18\x06 \x01(\x0b\x32-.otg.PatternFlowIcmpEchoSequenceNumberCounter\x12\x44\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32/.otg.PatternFlowIcmpEchoSequenceNumberMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xdf\x02\n\x1dPatternFlowIcmpCommonChecksum\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIcmpCommonChecksum.Choice.EnumH\x00\x88\x01\x01\x12I\n\tgenerated\x18\x02 \x01(\x0e\x32\x31.otg.PatternFlowIcmpCommonChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"\x84\x01\n*PatternFlowIcmpNextFieldsIdentifierCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8a\x01\n,PatternFlowIcmpNextFieldsIdentifierMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xd1\x03\n#PatternFlowIcmpNextFieldsIdentifier\x12I\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x34.otg.PatternFlowIcmpNextFieldsIdentifier.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x42\n\tincrement\x18\x05 \x01(\x0b\x32/.otg.PatternFlowIcmpNextFieldsIdentifierCounter\x12\x42\n\tdecrement\x18\x06 \x01(\x0b\x32/.otg.PatternFlowIcmpNextFieldsIdentifierCounter\x12\x46\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x31.otg.PatternFlowIcmpNextFieldsIdentifierMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x88\x01\n.PatternFlowIcmpNextFieldsSequenceNumberCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8e\x01\n0PatternFlowIcmpNextFieldsSequenceNumberMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xe5\x03\n\'PatternFlowIcmpNextFieldsSequenceNumber\x12M\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x38.otg.PatternFlowIcmpNextFieldsSequenceNumber.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x46\n\tincrement\x18\x05 \x01(\x0b\x32\x33.otg.PatternFlowIcmpNextFieldsSequenceNumberCounter\x12\x46\n\tdecrement\x18\x06 \x01(\x0b\x32\x33.otg.PatternFlowIcmpNextFieldsSequenceNumberCounter\x12J\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x35.otg.PatternFlowIcmpNextFieldsSequenceNumberMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"z\n PatternFlowIcmpv6EchoTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x80\x01\n\"PatternFlowIcmpv6EchoTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9f\x03\n\x19PatternFlowIcmpv6EchoType\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowIcmpv6EchoType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x38\n\tincrement\x18\x05 \x01(\x0b\x32%.otg.PatternFlowIcmpv6EchoTypeCounter\x12\x38\n\tdecrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowIcmpv6EchoTypeCounter\x12<\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\'.otg.PatternFlowIcmpv6EchoTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"z\n PatternFlowIcmpv6EchoCodeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x80\x01\n\"PatternFlowIcmpv6EchoCodeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9f\x03\n\x19PatternFlowIcmpv6EchoCode\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowIcmpv6EchoCode.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x38\n\tincrement\x18\x05 \x01(\x0b\x32%.otg.PatternFlowIcmpv6EchoCodeCounter\x12\x38\n\tdecrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowIcmpv6EchoCodeCounter\x12<\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\'.otg.PatternFlowIcmpv6EchoCodeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x80\x01\n&PatternFlowIcmpv6EchoIdentifierCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x86\x01\n(PatternFlowIcmpv6EchoIdentifierMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xbd\x03\n\x1fPatternFlowIcmpv6EchoIdentifier\x12\x45\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x30.otg.PatternFlowIcmpv6EchoIdentifier.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12>\n\tincrement\x18\x05 \x01(\x0b\x32+.otg.PatternFlowIcmpv6EchoIdentifierCounter\x12>\n\tdecrement\x18\x06 \x01(\x0b\x32+.otg.PatternFlowIcmpv6EchoIdentifierCounter\x12\x42\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32-.otg.PatternFlowIcmpv6EchoIdentifierMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x84\x01\n*PatternFlowIcmpv6EchoSequenceNumberCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8a\x01\n,PatternFlowIcmpv6EchoSequenceNumberMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xd1\x03\n#PatternFlowIcmpv6EchoSequenceNumber\x12I\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x34.otg.PatternFlowIcmpv6EchoSequenceNumber.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x42\n\tincrement\x18\x05 \x01(\x0b\x32/.otg.PatternFlowIcmpv6EchoSequenceNumberCounter\x12\x42\n\tdecrement\x18\x06 \x01(\x0b\x32/.otg.PatternFlowIcmpv6EchoSequenceNumberCounter\x12\x46\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x31.otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xdf\x02\n\x1dPatternFlowIcmpv6EchoChecksum\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIcmpv6EchoChecksum.Choice.EnumH\x00\x88\x01\x01\x12I\n\tgenerated\x18\x02 \x01(\x0e\x32\x31.otg.PatternFlowIcmpv6EchoChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"\xe5\x02\n\x1fPatternFlowIcmpv6CommonChecksum\x12\x45\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x30.otg.PatternFlowIcmpv6CommonChecksum.Choice.EnumH\x00\x88\x01\x01\x12K\n\tgenerated\x18\x02 \x01(\x0e\x32\x33.otg.PatternFlowIcmpv6CommonChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"v\n\x1cPatternFlowPppAddressCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowPppAddressMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowPppAddress\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowPppAddress.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowPppAddressCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowPppAddressCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowPppAddressMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowPppControlCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowPppControlMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowPppControl\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowPppControl.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowPppControlCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowPppControlCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowPppControlMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"{\n!PatternFlowPppProtocolTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x81\x01\n#PatternFlowPppProtocolTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xca\x03\n\x1aPatternFlowPppProtocolType\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.PatternFlowPppProtocolType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x39\n\tincrement\x18\x06 \x01(\x0b\x32&.otg.PatternFlowPppProtocolTypeCounter\x12\x39\n\tdecrement\x18\x07 \x01(\x0b\x32&.otg.PatternFlowPppProtocolTypeCounter\x12=\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32(.otg.PatternFlowPppProtocolTypeMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"y\n\x1fPatternFlowIgmpv1VersionCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x7f\n!PatternFlowIgmpv1VersionMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9a\x03\n\x18PatternFlowIgmpv1Version\x12>\n\x06\x63hoice\x18\x01 \x01(\x0e\x32).otg.PatternFlowIgmpv1Version.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x37\n\tincrement\x18\x05 \x01(\x0b\x32$.otg.PatternFlowIgmpv1VersionCounter\x12\x37\n\tdecrement\x18\x06 \x01(\x0b\x32$.otg.PatternFlowIgmpv1VersionCounter\x12;\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32&.otg.PatternFlowIgmpv1VersionMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowIgmpv1TypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowIgmpv1TypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowIgmpv1Type\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowIgmpv1Type.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowIgmpv1TypeCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowIgmpv1TypeCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowIgmpv1TypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowIgmpv1UnusedCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowIgmpv1UnusedMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowIgmpv1Unused\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowIgmpv1Unused.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowIgmpv1UnusedCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowIgmpv1UnusedCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowIgmpv1UnusedMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xd3\x02\n\x19PatternFlowIgmpv1Checksum\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowIgmpv1Checksum.Choice.EnumH\x00\x88\x01\x01\x12\x45\n\tgenerated\x18\x02 \x01(\x0e\x32-.otg.PatternFlowIgmpv1Checksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"~\n$PatternFlowIgmpv1GroupAddressCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowIgmpv1GroupAddressMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowIgmpv1GroupAddress\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIgmpv1GroupAddress.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowIgmpv1GroupAddressCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowIgmpv1GroupAddressCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowIgmpv1GroupAddressMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowMplsLabelCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowMplsLabelMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xac\x03\n\x14PatternFlowMplsLabel\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowMplsLabel.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x33\n\tincrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowMplsLabelCounter\x12\x33\n\tdecrement\x18\x07 \x01(\x0b\x32 .otg.PatternFlowMplsLabelCounter\x12\x37\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32\".otg.PatternFlowMplsLabelMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"|\n\"PatternFlowMplsTrafficClassCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowMplsTrafficClassMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowMplsTrafficClass\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowMplsTrafficClass.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowMplsTrafficClassCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowMplsTrafficClassCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowMplsTrafficClassMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowMplsBottomOfStackCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowMplsBottomOfStackMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xd4\x03\n\x1cPatternFlowMplsBottomOfStack\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowMplsBottomOfStack.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12;\n\tincrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowMplsBottomOfStackCounter\x12;\n\tdecrement\x18\x07 \x01(\x0b\x32(.otg.PatternFlowMplsBottomOfStackCounter\x12?\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32*.otg.PatternFlowMplsBottomOfStackMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"z\n PatternFlowMplsTimeToLiveCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x80\x01\n\"PatternFlowMplsTimeToLiveMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9f\x03\n\x19PatternFlowMplsTimeToLive\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowMplsTimeToLive.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x38\n\tincrement\x18\x05 \x01(\x0b\x32%.otg.PatternFlowMplsTimeToLiveCounter\x12\x38\n\tdecrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowMplsTimeToLiveCounter\x12<\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\'.otg.PatternFlowMplsTimeToLiveMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"z\n PatternFlowSnmpv2cVersionCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xe1\x02\n\x19PatternFlowSnmpv2cVersion\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowSnmpv2cVersion.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x38\n\tincrement\x18\x05 \x01(\x0b\x32%.otg.PatternFlowSnmpv2cVersionCounter\x12\x38\n\tdecrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowSnmpv2cVersionCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowSnmpv2cPDURequestIdCounter\x12\x12\n\x05start\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\x05H\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xf5\x02\n\x1ePatternFlowSnmpv2cPDURequestId\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowSnmpv2cPDURequestId.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\x05\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowSnmpv2cPDURequestIdCounter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowSnmpv2cPDURequestIdCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x80\x01\n&PatternFlowSnmpv2cPDUErrorIndexCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xf9\x02\n\x1fPatternFlowSnmpv2cPDUErrorIndex\x12\x45\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x30.otg.PatternFlowSnmpv2cPDUErrorIndex.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12>\n\tincrement\x18\x05 \x01(\x0b\x32+.otg.PatternFlowSnmpv2cPDUErrorIndexCounter\x12>\n\tdecrement\x18\x06 \x01(\x0b\x32+.otg.PatternFlowSnmpv2cPDUErrorIndexCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x83\x01\n)PatternFlowSnmpv2cBulkPDURequestIdCounter\x12\x12\n\x05start\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\x05H\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x03\n\"PatternFlowSnmpv2cBulkPDURequestId\x12H\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x33.otg.PatternFlowSnmpv2cBulkPDURequestId.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\x05\x12\x41\n\tincrement\x18\x05 \x01(\x0b\x32..otg.PatternFlowSnmpv2cBulkPDURequestIdCounter\x12\x41\n\tdecrement\x18\x06 \x01(\x0b\x32..otg.PatternFlowSnmpv2cBulkPDURequestIdCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xe7\x01\n%PatternFlowSnmpv2cBulkPDUNonRepeaters\x12K\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x36.otg.PatternFlowSnmpv2cBulkPDUNonRepeaters.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x1a\x38\n\x06\x43hoice\".\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x42\t\n\x07_choiceB\x08\n\x06_value\"\x88\x01\n.PatternFlowSnmpv2cBulkPDUMaxRepetitionsCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x99\x03\n\'PatternFlowSnmpv2cBulkPDUMaxRepetitions\x12M\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x38.otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x46\n\tincrement\x18\x05 \x01(\x0b\x32\x33.otg.PatternFlowSnmpv2cBulkPDUMaxRepetitionsCounter\x12\x46\n\tdecrement\x18\x06 \x01(\x0b\x32\x33.otg.PatternFlowSnmpv2cBulkPDUMaxRepetitionsCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x93\x01\n9PatternFlowSnmpv2cVariableBindingValueIntegerValueCounter\x12\x12\n\x05start\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\x05H\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xc5\x03\n2PatternFlowSnmpv2cVariableBindingValueIntegerValue\x12X\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x43.otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\x05\x12Q\n\tincrement\x18\x05 \x01(\x0b\x32>.otg.PatternFlowSnmpv2cVariableBindingValueIntegerValueCounter\x12Q\n\tdecrement\x18\x06 \x01(\x0b\x32>.otg.PatternFlowSnmpv2cVariableBindingValueIntegerValueCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x95\x01\n;PatternFlowSnmpv2cVariableBindingValueIpAddressValueCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xcd\x03\n4PatternFlowSnmpv2cVariableBindingValueIpAddressValue\x12Z\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x45.otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12S\n\tincrement\x18\x05 \x01(\x0b\x32@.otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValueCounter\x12S\n\tdecrement\x18\x06 \x01(\x0b\x32@.otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValueCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x93\x01\n9PatternFlowSnmpv2cVariableBindingValueCounterValueCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xc5\x03\n2PatternFlowSnmpv2cVariableBindingValueCounterValue\x12X\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x43.otg.PatternFlowSnmpv2cVariableBindingValueCounterValue.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12Q\n\tincrement\x18\x05 \x01(\x0b\x32>.otg.PatternFlowSnmpv2cVariableBindingValueCounterValueCounter\x12Q\n\tdecrement\x18\x06 \x01(\x0b\x32>.otg.PatternFlowSnmpv2cVariableBindingValueCounterValueCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x95\x01\n;PatternFlowSnmpv2cVariableBindingValueTimeticksValueCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xcd\x03\n4PatternFlowSnmpv2cVariableBindingValueTimeticksValue\x12Z\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x45.otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12S\n\tincrement\x18\x05 \x01(\x0b\x32@.otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValueCounter\x12S\n\tdecrement\x18\x06 \x01(\x0b\x32@.otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValueCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x96\x01\n.otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter\x12Q\n\tdecrement\x18\x06 \x01(\x0b\x32>.otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x93\x01\n9PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xc5\x03\n2PatternFlowRSVPPathSenderTspecIntServServiceHeader\x12X\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x43.otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12Q\n\tincrement\x18\x05 \x01(\x0b\x32>.otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter\x12Q\n\tdecrement\x18\x06 \x01(\x0b\x32>.otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x8d\x01\n3PatternFlowRSVPPathSenderTspecIntServZeroBitCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xad\x03\n,PatternFlowRSVPPathSenderTspecIntServZeroBit\x12R\n\x06\x63hoice\x18\x01 \x01(\x0e\x32=.otg.PatternFlowRSVPPathSenderTspecIntServZeroBit.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12K\n\tincrement\x18\x05 \x01(\x0b\x32\x38.otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter\x12K\n\tdecrement\x18\x06 \x01(\x0b\x32\x38.otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x8f\x01\n5PatternFlowRSVPPathSenderTspecIntServReserved2Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xb5\x03\n.PatternFlowRSVPPathSenderTspecIntServReserved2\x12T\n\x06\x63hoice\x18\x01 \x01(\x0e\x32?.otg.PatternFlowRSVPPathSenderTspecIntServReserved2.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12M\n\tincrement\x18\x05 \x01(\x0b\x32:.otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter\x12M\n\tdecrement\x18\x06 \x01(\x0b\x32:.otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x99\x01\n?PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xdd\x03\n8PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData\x12^\n\x06\x63hoice\x18\x01 \x01(\x0e\x32I.otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12W\n\tincrement\x18\x05 \x01(\x0b\x32\x44.otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter\x12W\n\tdecrement\x18\x06 \x01(\x0b\x32\x44.otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xa1\x01\nGPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xfd\x03\n@PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec\x12\x66\n\x06\x63hoice\x18\x01 \x01(\x0e\x32Q.otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12_\n\tincrement\x18\x05 \x01(\x0b\x32L.otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter\x12_\n\tdecrement\x18\x06 \x01(\x0b\x32L.otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x96\x01\nPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xd9\x03\n7PatternFlowRSVPPathSenderTspecIntServParameter127Length\x12]\n\x06\x63hoice\x18\x01 \x01(\x0e\x32H.otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12V\n\tincrement\x18\x05 \x01(\x0b\x32\x43.otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter\x12V\n\tdecrement\x18\x06 \x01(\x0b\x32\x43.otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x98\x01\n>PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xd9\x03\n7PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit\x12]\n\x06\x63hoice\x18\x01 \x01(\x0e\x32H.otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12V\n\tincrement\x18\x05 \x01(\x0b\x32\x43.otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter\x12V\n\tdecrement\x18\x06 \x01(\x0b\x32\x43.otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x97\x01\n=PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xd5\x03\n6PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize\x12\\\n\x06\x63hoice\x18\x01 \x01(\x0e\x32G.otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12U\n\tincrement\x18\x05 \x01(\x0b\x32\x42.otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter\x12U\n\tdecrement\x18\x06 \x01(\x0b\x32\x42.otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x9a\x01\n@PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xe1\x03\n9PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address\x12_\n\x06\x63hoice\x18\x01 \x01(\x0e\x32J.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12X\n\tincrement\x18\x05 \x01(\x0b\x32\x45.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter\x12X\n\tdecrement\x18\x06 \x01(\x0b\x32\x45.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x9b\x01\nAPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xe5\x03\n:PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength\x12`\n\x06\x63hoice\x18\x01 \x01(\x0e\x32K.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12Y\n\tincrement\x18\x05 \x01(\x0b\x32\x46.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter\x12Y\n\tdecrement\x18\x06 \x01(\x0b\x32\x46.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xf7\x01\n-PatternFlowRSVPPathRecordRouteType1LabelFlags\x12S\n\x06\x63hoice\x18\x01 \x01(\x0e\x32>.otg.PatternFlowRSVPPathRecordRouteType1LabelFlags.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x1a\x38\n\x06\x43hoice\".\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x42\t\n\x07_choiceB\x08\n\x06_value\"\xf7\x01\n-PatternFlowRSVPPathRecordRouteType1LabelCType\x12S\n\x06\x63hoice\x18\x01 \x01(\x0e\x32>.otg.PatternFlowRSVPPathRecordRouteType1LabelCType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x1a\x38\n\x06\x43hoice\".\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x42\t\n\x07_choiceB\x08\n\x06_value\"\x85\x01\n+PatternFlowRSVPPathObjectsCustomTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8d\x03\n$PatternFlowRSVPPathObjectsCustomType\x12J\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x35.otg.PatternFlowRSVPPathObjectsCustomType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x43\n\tincrement\x18\x05 \x01(\x0b\x32\x30.otg.PatternFlowRSVPPathObjectsCustomTypeCounter\x12\x43\n\tdecrement\x18\x06 \x01(\x0b\x32\x30.otg.PatternFlowRSVPPathObjectsCustomTypeCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x91\x01\n\x07Version\x12\x1d\n\x10\x61pi_spec_version\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0bsdk_version\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0b\x61pp_version\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x13\n\x11_api_spec_versionB\x0e\n\x0c_sdk_versionB\x0e\n\x0c_app_version\"(\n\x07Success\x12\x1d\n\x07warning\x18\x01 \x01(\x0b\x32\x0c.otg.Warning\"$\n\x07\x46\x61ilure\x12\x19\n\x05\x65rror\x18\x01 \x01(\x0b\x32\n.otg.Error\"/\n\x10SetConfigRequest\x12\x1b\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x0b.otg.Config\"?\n\x13UpdateConfigRequest\x12(\n\rconfig_update\x18\x01 \x01(\x0b\x32\x11.otg.ConfigUpdate\"2\n\x11SetConfigResponse\x12\x1d\n\x07warning\x18\x01 \x01(\x0b\x32\x0c.otg.Warning\"0\n\x11GetConfigResponse\x12\x1b\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x0b.otg.Config\"5\n\x14UpdateConfigResponse\x12\x1d\n\x07warning\x18\x01 \x01(\x0b\x32\x0c.otg.Warning\"B\n\x16SetControlStateRequest\x12(\n\rcontrol_state\x18\x01 \x01(\x0b\x32\x11.otg.ControlState\"8\n\x17SetControlStateResponse\x12\x1d\n\x07warning\x18\x01 \x01(\x0b\x32\x0c.otg.Warning\"E\n\x17SetControlActionRequest\x12*\n\x0e\x63ontrol_action\x18\x01 \x01(\x0b\x32\x12.otg.ControlAction\"W\n\x18SetControlActionResponse\x12;\n\x17\x63ontrol_action_response\x18\x01 \x01(\x0b\x32\x1a.otg.ControlActionResponse\"A\n\x11GetMetricsRequest\x12,\n\x0fmetrics_request\x18\x01 \x01(\x0b\x32\x13.otg.MetricsRequest\"D\n\x12GetMetricsResponse\x12.\n\x10metrics_response\x18\x01 \x01(\x0b\x32\x14.otg.MetricsResponse\">\n\x10GetStatesRequest\x12*\n\x0estates_request\x18\x01 \x01(\x0b\x32\x12.otg.StatesRequest\"A\n\x11GetStatesResponse\x12,\n\x0fstates_response\x18\x01 \x01(\x0b\x32\x13.otg.StatesResponse\"A\n\x11GetCaptureRequest\x12,\n\x0f\x63\x61pture_request\x18\x01 \x01(\x0b\x32\x13.otg.CaptureRequest\",\n\x12GetCaptureResponse\x12\x16\n\x0eresponse_bytes\x18\x01 \x01(\x0c\"3\n\x12GetVersionResponse\x12\x1d\n\x07version\x18\x01 \x01(\x0b\x32\x0c.otg.Version2\xdf\x04\n\x07Openapi\x12:\n\tSetConfig\x12\x15.otg.SetConfigRequest\x1a\x16.otg.SetConfigResponse\x12;\n\tGetConfig\x12\x16.google.protobuf.Empty\x1a\x16.otg.GetConfigResponse\x12\x43\n\x0cUpdateConfig\x12\x18.otg.UpdateConfigRequest\x1a\x19.otg.UpdateConfigResponse\x12L\n\x0fSetControlState\x12\x1b.otg.SetControlStateRequest\x1a\x1c.otg.SetControlStateResponse\x12O\n\x10SetControlAction\x12\x1c.otg.SetControlActionRequest\x1a\x1d.otg.SetControlActionResponse\x12=\n\nGetMetrics\x12\x16.otg.GetMetricsRequest\x1a\x17.otg.GetMetricsResponse\x12:\n\tGetStates\x12\x15.otg.GetStatesRequest\x1a\x16.otg.GetStatesResponse\x12=\n\nGetCapture\x12\x16.otg.GetCaptureRequest\x1a\x17.otg.GetCaptureResponse\x12=\n\nGetVersion\x12\x16.google.protobuf.Empty\x1a\x17.otg.GetVersionResponseB\x0bZ\t./otg;otgb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\totg.proto\x12\x03otg\x1a google/protobuf/descriptor.proto\x1a\x1bgoogle/protobuf/empty.proto\"\x89\x02\n\x06\x43onfig\x12\x18\n\x05ports\x18\x01 \x03(\x0b\x32\t.otg.Port\x12\x16\n\x04lags\x18\x02 \x03(\x0b\x32\x08.otg.Lag\x12\x1b\n\x06layer1\x18\x03 \x03(\x0b\x32\x0b.otg.Layer1\x12\x1e\n\x08\x63\x61ptures\x18\x04 \x03(\x0b\x32\x0c.otg.Capture\x12\x1c\n\x07\x64\x65vices\x18\x05 \x03(\x0b\x32\x0b.otg.Device\x12\x18\n\x05\x66lows\x18\x06 \x03(\x0b\x32\t.otg.Flow\x12\x1a\n\x06\x65vents\x18\x07 \x01(\x0b\x32\n.otg.Event\x12#\n\x07options\x18\x08 \x01(\x0b\x32\x12.otg.ConfigOptions\x12\x17\n\x04lldp\x18\t \x03(\x0b\x32\t.otg.Lldp\"g\n\rConfigOptions\x12&\n\x0cport_options\x18\x01 \x01(\x0b\x32\x10.otg.PortOptions\x12.\n\x10protocol_options\x18\x02 \x01(\x0b\x32\x14.otg.ProtocolOptions\"F\n\x04Port\x12\x15\n\x08location\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04name\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x0b\n\t_locationB\x07\n\x05_name\"G\n\x0bPortOptions\x12 \n\x13location_preemption\x18\x01 \x01(\x08H\x00\x88\x01\x01\x42\x16\n\x14_location_preemption\"\x88\x01\n\x03Lag\x12\x1b\n\x05ports\x18\x01 \x03(\x0b\x32\x0c.otg.LagPort\x12\"\n\x08protocol\x18\x02 \x01(\x0b\x32\x10.otg.LagProtocol\x12\x16\n\tmin_links\x18\x03 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04name\x18\x04 \x01(\tH\x01\x88\x01\x01\x42\x0c\n\n_min_linksB\x07\n\x05_name\"z\n\x07LagPort\x12\x16\n\tport_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x04lacp\x18\x02 \x01(\x0b\x32\x10.otg.LagPortLacp\x12)\n\x08\x65thernet\x18\x03 \x01(\x0b\x32\x17.otg.DeviceEthernetBaseB\x0c\n\n_port_name\"\xd0\x01\n\x0bLagProtocol\x12\x31\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1c.otg.LagProtocol.Choice.EnumH\x00\x88\x01\x01\x12\"\n\x04lacp\x18\x02 \x01(\x0b\x32\x14.otg.LagProtocolLacp\x12&\n\x06static\x18\x03 \x01(\x0b\x32\x16.otg.LagProtocolStatic\x1a\x37\n\x06\x43hoice\"-\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04lacp\x10\x01\x12\n\n\x06static\x10\x02\x42\t\n\x07_choice\"3\n\x11LagProtocolStatic\x12\x13\n\x06lag_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\t\n\x07_lag_id\"\xa7\x01\n\x0fLagProtocolLacp\x12\x1c\n\x0f\x61\x63tor_system_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\"\n\x15\x61\x63tor_system_priority\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\tactor_key\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x12\n\x10_actor_system_idB\x18\n\x16_actor_system_priorityB\x0c\n\n_actor_key\"\x93\x03\n\x0bLagPortLacp\x12\x1e\n\x11\x61\x63tor_port_number\x18\x01 \x01(\rH\x00\x88\x01\x01\x12 \n\x13\x61\x63tor_port_priority\x18\x02 \x01(\rH\x01\x88\x01\x01\x12@\n\x0e\x61\x63tor_activity\x18\x03 \x01(\x0e\x32#.otg.LagPortLacp.ActorActivity.EnumH\x02\x88\x01\x01\x12*\n\x1dlacpdu_periodic_time_interval\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1b\n\x0elacpdu_timeout\x18\x05 \x01(\rH\x04\x88\x01\x01\x1a\x41\n\rActorActivity\"0\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07passive\x10\x01\x12\n\n\x06\x61\x63tive\x10\x02\x42\x14\n\x12_actor_port_numberB\x16\n\x14_actor_port_priorityB\x11\n\x0f_actor_activityB \n\x1e_lacpdu_periodic_time_intervalB\x11\n\x0f_lacpdu_timeout\"\x84\x01\n\x12\x44\x65viceEthernetBase\x12\x10\n\x03mac\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x10\n\x03mtu\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1e\n\x05vlans\x18\x03 \x03(\x0b\x32\x0f.otg.DeviceVlan\x12\x11\n\x04name\x18\x04 \x01(\tH\x02\x88\x01\x01\x42\x06\n\x04_macB\x06\n\x04_mtuB\x07\n\x05_name\"\xb3\x02\n\x0e\x44\x65viceEthernet\x12+\n\nconnection\x18\x02 \x01(\x0b\x32\x17.otg.EthernetConnection\x12\'\n\x0eipv4_addresses\x18\x03 \x03(\x0b\x32\x0f.otg.DeviceIpv4\x12\'\n\x0eipv6_addresses\x18\x04 \x03(\x0b\x32\x0f.otg.DeviceIpv6\x12\x10\n\x03mac\x18\x05 \x01(\tH\x00\x88\x01\x01\x12\x10\n\x03mtu\x18\x06 \x01(\rH\x01\x88\x01\x01\x12\x1e\n\x05vlans\x18\x07 \x03(\x0b\x32\x0f.otg.DeviceVlan\x12\x11\n\x04name\x18\x08 \x01(\tH\x02\x88\x01\x01\x12\x32\n\x11\x64hcpv4_interfaces\x18\t \x03(\x0b\x32\x17.otg.DeviceDhcpv4clientB\x06\n\x04_macB\x06\n\x04_mtuB\x07\n\x05_name\"\x9b\x02\n\x12\x45thernetConnection\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.EthernetConnection.Choice.EnumH\x00\x88\x01\x01\x12\x16\n\tport_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08lag_name\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x17\n\nvxlan_name\x18\x04 \x01(\tH\x03\x88\x01\x01\x1aN\n\x06\x43hoice\"D\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tport_name\x10\x01\x12\x0c\n\x08lag_name\x10\x02\x12\x0e\n\nvxlan_name\x10\x03\x42\t\n\x07_choiceB\x0c\n\n_port_nameB\x0b\n\t_lag_nameB\r\n\x0b_vxlan_name\"\xf3\x01\n\nDeviceVlan\x12,\n\x04tpid\x18\x01 \x01(\x0e\x32\x19.otg.DeviceVlan.Tpid.EnumH\x00\x88\x01\x01\x12\x15\n\x08priority\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0f\n\x02id\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x11\n\x04name\x18\x04 \x01(\tH\x03\x88\x01\x01\x1aV\n\x04Tpid\"N\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05x8100\x10\x01\x12\t\n\x05x88A8\x10\x02\x12\t\n\x05x9100\x10\x03\x12\t\n\x05x9200\x10\x04\x12\t\n\x05x9300\x10\x05\x42\x07\n\x05_tpidB\x0b\n\t_priorityB\x05\n\x03_idB\x07\n\x05_name\"\xbc\x01\n\nDeviceIpv4\x12\x14\n\x07gateway\x18\x01 \x01(\tH\x00\x88\x01\x01\x12.\n\x0bgateway_mac\x18\x02 \x01(\x0b\x32\x19.otg.DeviceIpv4GatewayMAC\x12\x14\n\x07\x61\x64\x64ress\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x13\n\x06prefix\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x11\n\x04name\x18\x05 \x01(\tH\x03\x88\x01\x01\x42\n\n\x08_gatewayB\n\n\x08_addressB\t\n\x07_prefixB\x07\n\x05_name\"v\n\x12\x44\x65viceIpv4Loopback\x12\x15\n\x08\x65th_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x07\x61\x64\x64ress\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x11\n\x04name\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x0b\n\t_eth_nameB\n\n\x08_addressB\x07\n\x05_name\"\xcf\x01\n\x14\x44\x65viceIpv4GatewayMAC\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.DeviceIpv4GatewayMAC.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xbc\x01\n\nDeviceIpv6\x12\x14\n\x07gateway\x18\x01 \x01(\tH\x00\x88\x01\x01\x12.\n\x0bgateway_mac\x18\x02 \x01(\x0b\x32\x19.otg.DeviceIpv6GatewayMAC\x12\x14\n\x07\x61\x64\x64ress\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x13\n\x06prefix\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x11\n\x04name\x18\x05 \x01(\tH\x03\x88\x01\x01\x42\n\n\x08_gatewayB\n\n\x08_addressB\t\n\x07_prefixB\x07\n\x05_name\"v\n\x12\x44\x65viceIpv6Loopback\x12\x15\n\x08\x65th_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x07\x61\x64\x64ress\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x11\n\x04name\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x0b\n\t_eth_nameB\n\n\x08_addressB\x07\n\x05_name\"\xcf\x01\n\x14\x44\x65viceIpv6GatewayMAC\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.DeviceIpv6GatewayMAC.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xce\x02\n\x12\x44\x65viceDhcpv4client\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x38\n\x06\x63hoice\x18\x02 \x01(\x0e\x32#.otg.DeviceDhcpv4client.Choice.EnumH\x01\x88\x01\x01\x12\x1b\n\x0eserver_address\x18\x04 \x01(\tH\x02\x88\x01\x01\x12\x16\n\tbroadcast\x18\x05 \x01(\x08H\x03\x88\x01\x01\x12\x38\n\x17parameters_request_list\x18\x06 \x01(\x0b\x32\x17.otg.Dhcpv4ClientParams\x1aG\n\x06\x43hoice\"=\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0c\x66irst_server\x10\x01\x12\x12\n\x0eserver_address\x10\x02\x42\x07\n\x05_nameB\t\n\x07_choiceB\x11\n\x0f_server_addressB\x0c\n\n_broadcast\"\xbe\x01\n\x12\x44hcpv4ClientParams\x12\x18\n\x0bsubnet_mask\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x13\n\x06router\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x1a\n\rrenewal_timer\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x1c\n\x0frebinding_timer\x18\x04 \x01(\x08H\x03\x88\x01\x01\x42\x0e\n\x0c_subnet_maskB\t\n\x07_routerB\x10\n\x0e_renewal_timerB\x12\n\x10_rebinding_timer\"\xa6\x06\n\x06Layer1\x12\x12\n\nport_names\x18\x01 \x03(\t\x12*\n\x05speed\x18\x02 \x01(\x0e\x32\x16.otg.Layer1.Speed.EnumH\x00\x88\x01\x01\x12*\n\x05media\x18\x03 \x01(\x0e\x32\x16.otg.Layer1.Media.EnumH\x01\x88\x01\x01\x12\x18\n\x0bpromiscuous\x18\x04 \x01(\x08H\x02\x88\x01\x01\x12\x10\n\x03mtu\x18\x05 \x01(\rH\x03\x88\x01\x01\x12 \n\x13ieee_media_defaults\x18\x06 \x01(\x08H\x04\x88\x01\x01\x12\x1b\n\x0e\x61uto_negotiate\x18\x07 \x01(\x08H\x05\x88\x01\x01\x12\x34\n\x10\x61uto_negotiation\x18\x08 \x01(\x0b\x32\x1a.otg.Layer1AutoNegotiation\x12,\n\x0c\x66low_control\x18\t \x01(\x0b\x32\x16.otg.Layer1FlowControl\x12\x11\n\x04name\x18\n \x01(\tH\x06\x88\x01\x01\x1a\xa9\x02\n\x05Speed\"\x9f\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x14\n\x10speed_10_fd_mbps\x10\x01\x12\x14\n\x10speed_10_hd_mbps\x10\x02\x12\x15\n\x11speed_100_fd_mbps\x10\x03\x12\x15\n\x11speed_100_hd_mbps\x10\x04\x12\x10\n\x0cspeed_1_gbps\x10\x05\x12\x11\n\rspeed_10_gbps\x10\x06\x12\x11\n\rspeed_25_gbps\x10\x07\x12\x11\n\rspeed_40_gbps\x10\x08\x12\x11\n\rspeed_50_gbps\x10\t\x12\x12\n\x0espeed_100_gbps\x10\n\x12\x12\n\x0espeed_200_gbps\x10\x0b\x12\x12\n\x0espeed_400_gbps\x10\x0c\x12\x12\n\x0espeed_800_gbps\x10\r\x1a\x42\n\x05Media\"9\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x63opper\x10\x01\x12\t\n\x05\x66iber\x10\x02\x12\t\n\x05sgmii\x10\x03\x42\x08\n\x06_speedB\x08\n\x06_mediaB\x0e\n\x0c_promiscuousB\x06\n\x04_mtuB\x16\n\x14_ieee_media_defaultsB\x11\n\x0f_auto_negotiateB\x07\n\x05_name\"\x93\x03\n\x15Layer1AutoNegotiation\x12 \n\x13\x61\x64vertise_1000_mbps\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\"\n\x15\x61\x64vertise_100_fd_mbps\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\"\n\x15\x61\x64vertise_100_hd_mbps\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12!\n\x14\x61\x64vertise_10_fd_mbps\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12!\n\x14\x61\x64vertise_10_hd_mbps\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x1a\n\rlink_training\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x13\n\x06rs_fec\x18\x07 \x01(\x08H\x06\x88\x01\x01\x42\x16\n\x14_advertise_1000_mbpsB\x18\n\x16_advertise_100_fd_mbpsB\x18\n\x16_advertise_100_hd_mbpsB\x17\n\x15_advertise_10_fd_mbpsB\x17\n\x15_advertise_10_hd_mbpsB\x10\n\x0e_link_trainingB\t\n\x07_rs_fec\"\xac\x02\n\x11Layer1FlowControl\x12\x1d\n\x10\x64irected_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x37\n\x06\x63hoice\x18\x02 \x01(\x0e\x32\".otg.Layer1FlowControl.Choice.EnumH\x01\x88\x01\x01\x12-\n\rieee_802_1qbb\x18\x03 \x01(\x0b\x32\x16.otg.Layer1Ieee8021qbb\x12)\n\x0bieee_802_3x\x18\x04 \x01(\x0b\x32\x14.otg.Layer1Ieee8023x\x1a\x45\n\x06\x43hoice\";\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rieee_802_1qbb\x10\x01\x12\x0f\n\x0bieee_802_3x\x10\x02\x42\x13\n\x11_directed_addressB\t\n\x07_choice\"\x11\n\x0fLayer1Ieee8023x\"\x89\x03\n\x11Layer1Ieee8021qbb\x12\x16\n\tpfc_delay\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x18\n\x0bpfc_class_0\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x18\n\x0bpfc_class_1\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x18\n\x0bpfc_class_2\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x18\n\x0bpfc_class_3\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x18\n\x0bpfc_class_4\x18\x06 \x01(\rH\x05\x88\x01\x01\x12\x18\n\x0bpfc_class_5\x18\x07 \x01(\rH\x06\x88\x01\x01\x12\x18\n\x0bpfc_class_6\x18\x08 \x01(\rH\x07\x88\x01\x01\x12\x18\n\x0bpfc_class_7\x18\t \x01(\rH\x08\x88\x01\x01\x42\x0c\n\n_pfc_delayB\x0e\n\x0c_pfc_class_0B\x0e\n\x0c_pfc_class_1B\x0e\n\x0c_pfc_class_2B\x0e\n\x0c_pfc_class_3B\x0e\n\x0c_pfc_class_4B\x0e\n\x0c_pfc_class_5B\x0e\n\x0c_pfc_class_6B\x0e\n\x0c_pfc_class_7\"\xa1\x02\n\x07\x43\x61pture\x12\x12\n\nport_names\x18\x01 \x03(\t\x12#\n\x07\x66ilters\x18\x02 \x03(\x0b\x32\x12.otg.CaptureFilter\x12\x16\n\toverwrite\x18\x03 \x01(\x08H\x00\x88\x01\x01\x12\x18\n\x0bpacket_size\x18\x04 \x01(\rH\x01\x88\x01\x01\x12-\n\x06\x66ormat\x18\x05 \x01(\x0e\x32\x18.otg.Capture.Format.EnumH\x02\x88\x01\x01\x12\x11\n\x04name\x18\x06 \x01(\tH\x03\x88\x01\x01\x1a\x37\n\x06\x46ormat\"-\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04pcap\x10\x01\x12\n\n\x06pcapng\x10\x02\x42\x0c\n\n_overwriteB\x0e\n\x0c_packet_sizeB\t\n\x07_formatB\x07\n\x05_name\"\xd6\x02\n\rCaptureFilter\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.CaptureFilter.Choice.EnumH\x00\x88\x01\x01\x12\"\n\x06\x63ustom\x18\x02 \x01(\x0b\x32\x12.otg.CaptureCustom\x12&\n\x08\x65thernet\x18\x03 \x01(\x0b\x32\x14.otg.CaptureEthernet\x12\x1e\n\x04vlan\x18\x04 \x01(\x0b\x32\x10.otg.CaptureVlan\x12\x1e\n\x04ipv4\x18\x05 \x01(\x0b\x32\x10.otg.CaptureIpv4\x12\x1e\n\x04ipv6\x18\x06 \x01(\x0b\x32\x10.otg.CaptureIpv6\x1aY\n\x06\x43hoice\"O\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x63ustom\x10\x01\x12\x0c\n\x08\x65thernet\x10\x02\x12\x08\n\x04vlan\x10\x03\x12\x08\n\x04ipv4\x10\x04\x12\x08\n\x04ipv6\x10\x05\x42\t\n\x07_choice\"\xb1\x01\n\rCaptureCustom\x12\x13\n\x06offset\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x17\n\nbit_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x11\n\x04mask\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x13\n\x06negate\x18\x05 \x01(\x08H\x04\x88\x01\x01\x42\t\n\x07_offsetB\r\n\x0b_bit_lengthB\x08\n\x06_valueB\x07\n\x05_maskB\t\n\x07_negate\"h\n\x0c\x43\x61ptureField\x12\x12\n\x05value\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04mask\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x13\n\x06negate\x18\x03 \x01(\x08H\x02\x88\x01\x01\x42\x08\n\x06_valueB\x07\n\x05_maskB\t\n\x07_negate\"\x9e\x01\n\x0f\x43\x61ptureEthernet\x12\x1e\n\x03src\x18\x01 \x01(\x0b\x32\x11.otg.CaptureField\x12\x1e\n\x03\x64st\x18\x02 \x01(\x0b\x32\x11.otg.CaptureField\x12%\n\nether_type\x18\x03 \x01(\x0b\x32\x11.otg.CaptureField\x12$\n\tpfc_queue\x18\x04 \x01(\x0b\x32\x11.otg.CaptureField\"\x96\x01\n\x0b\x43\x61ptureVlan\x12#\n\x08priority\x18\x01 \x01(\x0b\x32\x11.otg.CaptureField\x12\x1e\n\x03\x63\x66i\x18\x02 \x01(\x0b\x32\x11.otg.CaptureField\x12\x1d\n\x02id\x18\x03 \x01(\x0b\x32\x11.otg.CaptureField\x12#\n\x08protocol\x18\x04 \x01(\x0b\x32\x11.otg.CaptureField\"\xb4\x04\n\x0b\x43\x61ptureIpv4\x12\"\n\x07version\x18\x01 \x01(\x0b\x32\x11.otg.CaptureField\x12(\n\rheader_length\x18\x02 \x01(\x0b\x32\x11.otg.CaptureField\x12#\n\x08priority\x18\x03 \x01(\x0b\x32\x11.otg.CaptureField\x12\'\n\x0ctotal_length\x18\x04 \x01(\x0b\x32\x11.otg.CaptureField\x12)\n\x0eidentification\x18\x05 \x01(\x0b\x32\x11.otg.CaptureField\x12#\n\x08reserved\x18\x06 \x01(\x0b\x32\x11.otg.CaptureField\x12(\n\rdont_fragment\x18\x07 \x01(\x0b\x32\x11.otg.CaptureField\x12)\n\x0emore_fragments\x18\x08 \x01(\x0b\x32\x11.otg.CaptureField\x12*\n\x0f\x66ragment_offset\x18\t \x01(\x0b\x32\x11.otg.CaptureField\x12\'\n\x0ctime_to_live\x18\n \x01(\x0b\x32\x11.otg.CaptureField\x12#\n\x08protocol\x18\x0b \x01(\x0b\x32\x11.otg.CaptureField\x12*\n\x0fheader_checksum\x18\x0c \x01(\x0b\x32\x11.otg.CaptureField\x12\x1e\n\x03src\x18\r \x01(\x0b\x32\x11.otg.CaptureField\x12\x1e\n\x03\x64st\x18\x0e \x01(\x0b\x32\x11.otg.CaptureField\"\xbb\x02\n\x0b\x43\x61ptureIpv6\x12\"\n\x07version\x18\x01 \x01(\x0b\x32\x11.otg.CaptureField\x12(\n\rtraffic_class\x18\x02 \x01(\x0b\x32\x11.otg.CaptureField\x12%\n\nflow_label\x18\x03 \x01(\x0b\x32\x11.otg.CaptureField\x12)\n\x0epayload_length\x18\x04 \x01(\x0b\x32\x11.otg.CaptureField\x12&\n\x0bnext_header\x18\x05 \x01(\x0b\x32\x11.otg.CaptureField\x12$\n\thop_limit\x18\x06 \x01(\x0b\x32\x11.otg.CaptureField\x12\x1e\n\x03src\x18\x07 \x01(\x0b\x32\x11.otg.CaptureField\x12\x1e\n\x03\x64st\x18\x08 \x01(\x0b\x32\x11.otg.CaptureField\"\xe2\x02\n\x06\x44\x65vice\x12&\n\tethernets\x18\x01 \x03(\x0b\x32\x13.otg.DeviceEthernet\x12/\n\x0eipv4_loopbacks\x18\x02 \x03(\x0b\x32\x17.otg.DeviceIpv4Loopback\x12/\n\x0eipv6_loopbacks\x18\x03 \x03(\x0b\x32\x17.otg.DeviceIpv6Loopback\x12#\n\x04isis\x18\x04 \x01(\x0b\x32\x15.otg.DeviceIsisRouter\x12!\n\x03\x62gp\x18\x05 \x01(\x0b\x32\x14.otg.DeviceBgpRouter\x12\x1f\n\x05vxlan\x18\x06 \x01(\x0b\x32\x10.otg.DeviceVxlan\x12\x11\n\x04name\x18\x07 \x01(\tH\x00\x88\x01\x01\x12\x1d\n\x04rsvp\x18\x08 \x01(\x0b\x32\x0f.otg.DeviceRsvp\x12*\n\x0b\x64hcp_server\x18\t \x01(\x0b\x32\x15.otg.DeviceDhcpServerB\x07\n\x05_name\"A\n\x0fProtocolOptions\x12\x1b\n\x0e\x61uto_start_all\x18\x01 \x01(\x08H\x00\x88\x01\x01\x42\x11\n\x0f_auto_start_all\"\xf2\x02\n\x10\x44\x65viceIsisRouter\x12.\n\x08instance\x18\x01 \x01(\x0b\x32\x1c.otg.DeviceIsisMultiInstance\x12\x16\n\tsystem_id\x18\x02 \x01(\tH\x00\x88\x01\x01\x12&\n\ninterfaces\x18\x03 \x03(\x0b\x32\x12.otg.IsisInterface\x12\x1d\n\x05\x62\x61sic\x18\x04 \x01(\x0b\x32\x0e.otg.IsisBasic\x12#\n\x08\x61\x64vanced\x18\x05 \x01(\x0b\x32\x11.otg.IsisAdvanced\x12,\n\x0brouter_auth\x18\x06 \x01(\x0b\x32\x17.otg.IsisAuthentication\x12(\n\tv4_routes\x18\x07 \x03(\x0b\x32\x15.otg.IsisV4RouteRange\x12(\n\tv6_routes\x18\x08 \x03(\x0b\x32\x15.otg.IsisV6RouteRange\x12\x11\n\x04name\x18\t \x01(\tH\x01\x88\x01\x01\x42\x0c\n\n_system_idB\x07\n\x05_name\"B\n\x17\x44\x65viceIsisMultiInstance\x12\x10\n\x03iid\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\r\n\x05itids\x18\x02 \x03(\rB\x06\n\x04_iid\"\x91\x06\n\rIsisInterface\x12\x15\n\x08\x65th_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06metric\x18\x02 \x01(\rH\x01\x88\x01\x01\x12>\n\x0cnetwork_type\x18\x03 \x01(\x0e\x32#.otg.IsisInterface.NetworkType.EnumH\x02\x88\x01\x01\x12:\n\nlevel_type\x18\x04 \x01(\x0e\x32!.otg.IsisInterface.LevelType.EnumH\x03\x88\x01\x01\x12,\n\x0bl1_settings\x18\x05 \x01(\x0b\x32\x17.otg.IsisInterfaceLevel\x12,\n\x0bl2_settings\x18\x06 \x01(\x0b\x32\x17.otg.IsisInterfaceLevel\x12\'\n\x12multi_topology_ids\x18\x07 \x03(\x0b\x32\x0b.otg.IsisMT\x12-\n\x13traffic_engineering\x18\x08 \x03(\x0b\x32\x10.otg.LinkStateTE\x12\x38\n\x0e\x61uthentication\x18\t \x01(\x0b\x32 .otg.IsisInterfaceAuthentication\x12,\n\x08\x61\x64vanced\x18\n \x01(\x0b\x32\x1a.otg.IsisInterfaceAdvanced\x12\x39\n\x0flink_protection\x18\x0b \x01(\x0b\x32 .otg.IsisInterfaceLinkProtection\x12\x13\n\x0bsrlg_values\x18\x0c \x03(\r\x12\x11\n\x04name\x18\r \x01(\tH\x04\x88\x01\x01\x1aI\n\x0bNetworkType\":\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tbroadcast\x10\x01\x12\x12\n\x0epoint_to_point\x10\x02\x1aM\n\tLevelType\"@\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07level_1\x10\x01\x12\x0b\n\x07level_2\x10\x02\x12\r\n\tlevel_1_2\x10\x03\x42\x0b\n\t_eth_nameB\t\n\x07_metricB\x0f\n\r_network_typeB\r\n\x0b_level_typeB\x07\n\x05_name\"\x96\x01\n\x12IsisInterfaceLevel\x12\x15\n\x08priority\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1b\n\x0ehello_interval\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1a\n\rdead_interval\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x0b\n\t_priorityB\x11\n\x0f_hello_intervalB\x10\n\x0e_dead_interval\"P\n\x06IsisMT\x12\x12\n\x05mt_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x18\n\x0blink_metric\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x08\n\x06_mt_idB\x0e\n\x0c_link_metric\"\xa4\x02\n\x0bLinkStateTE\x12!\n\x14\x61\x64ministrative_group\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0cmetric_level\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x19\n\x0cmax_bandwith\x18\x03 \x01(\rH\x02\x88\x01\x01\x12%\n\x18max_reservable_bandwidth\x18\x04 \x01(\rH\x03\x88\x01\x01\x12=\n\x13priority_bandwidths\x18\x05 \x01(\x0b\x32 .otg.LinkStatepriorityBandwidthsB\x17\n\x15_administrative_groupB\x0f\n\r_metric_levelB\x0f\n\r_max_bandwithB\x1b\n\x19_max_reservable_bandwidth\"\xed\x01\n\x1bLinkStatepriorityBandwidths\x12\x10\n\x03pb0\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03pb1\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x10\n\x03pb2\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x10\n\x03pb3\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x10\n\x03pb4\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x10\n\x03pb5\x18\x06 \x01(\rH\x05\x88\x01\x01\x12\x10\n\x03pb6\x18\x07 \x01(\rH\x06\x88\x01\x01\x12\x10\n\x03pb7\x18\x08 \x01(\rH\x07\x88\x01\x01\x42\x06\n\x04_pb0B\x06\n\x04_pb1B\x06\n\x04_pb2B\x06\n\x04_pb3B\x06\n\x04_pb4B\x06\n\x04_pb5B\x06\n\x04_pb6B\x06\n\x04_pb7\"\xed\x01\n\x1bIsisInterfaceAuthentication\x12\x46\n\tauth_type\x18\x01 \x01(\x0e\x32..otg.IsisInterfaceAuthentication.AuthType.EnumH\x00\x88\x01\x01\x12\x10\n\x03md5\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08password\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a:\n\x08\x41uthType\".\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03md5\x10\x01\x12\x0c\n\x08password\x10\x02\x42\x0c\n\n_auth_typeB\x06\n\x04_md5B\x0b\n\t_password\"\xd3\x02\n\x15IsisInterfaceAdvanced\x12\x1c\n\x0f\x61uto_adjust_mtu\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x1d\n\x10\x61uto_adjust_area\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12,\n\x1f\x61uto_adjust_supported_protocols\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\"\n\x15\x65nable_3way_handshake\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12&\n\x19p2p_hellos_to_unicast_mac\x18\x05 \x01(\x08H\x04\x88\x01\x01\x42\x12\n\x10_auto_adjust_mtuB\x13\n\x11_auto_adjust_areaB\"\n _auto_adjust_supported_protocolsB\x18\n\x16_enable_3way_handshakeB\x1c\n\x1a_p2p_hellos_to_unicast_mac\"\xf9\x02\n\x1bIsisInterfaceLinkProtection\x12\x1a\n\rextra_traffic\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x18\n\x0bunprotected\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x13\n\x06shared\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x1d\n\x10\x64\x65\x64icated_1_to_1\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x1f\n\x12\x64\x65\x64icated_1_plus_1\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x15\n\x08\x65nhanced\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x18\n\x0breserved_40\x18\x07 \x01(\x08H\x06\x88\x01\x01\x12\x18\n\x0breserved_80\x18\x08 \x01(\x08H\x07\x88\x01\x01\x42\x10\n\x0e_extra_trafficB\x0e\n\x0c_unprotectedB\t\n\x07_sharedB\x13\n\x11_dedicated_1_to_1B\x15\n\x13_dedicated_1_plus_1B\x0b\n\t_enhancedB\x0e\n\x0c_reserved_40B\x0e\n\x0c_reserved_80\"\xd5\x01\n\tIsisBasic\x12\x1e\n\x11ipv4_te_router_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08hostname\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1f\n\x12\x65nable_wide_metric\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x1f\n\x12learned_lsp_filter\x18\x04 \x01(\x08H\x03\x88\x01\x01\x42\x14\n\x12_ipv4_te_router_idB\x0b\n\t_hostnameB\x15\n\x13_enable_wide_metricB\x15\n\x13_learned_lsp_filter\"\x8a\x04\n\x0cIsisAdvanced\x12!\n\x14\x65nable_hello_padding\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x1f\n\x12max_area_addresses\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\x0e\x61rea_addresses\x18\x03 \x03(\t\x12\x1d\n\x10lsp_refresh_rate\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x19\n\x0clsp_lifetime\x18\x05 \x01(\rH\x03\x88\x01\x01\x12\x1a\n\rpsnp_interval\x18\x06 \x01(\rH\x04\x88\x01\x01\x12\x1a\n\rcsnp_interval\x18\x07 \x01(\rH\x05\x88\x01\x01\x12\x19\n\x0cmax_lsp_size\x18\x08 \x01(\rH\x06\x88\x01\x01\x12*\n\x1dlsp_mgroup_min_trans_interval\x18\t \x01(\rH\x07\x88\x01\x01\x12 \n\x13\x65nable_attached_bit\x18\n \x01(\x08H\x08\x88\x01\x01\x42\x17\n\x15_enable_hello_paddingB\x15\n\x13_max_area_addressesB\x13\n\x11_lsp_refresh_rateB\x0f\n\r_lsp_lifetimeB\x10\n\x0e_psnp_intervalB\x10\n\x0e_csnp_intervalB\x0f\n\r_max_lsp_sizeB \n\x1e_lsp_mgroup_min_trans_intervalB\x16\n\x14_enable_attached_bit\"\xae\x01\n\x12IsisAuthentication\x12\x1f\n\x12ignore_receive_md5\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12.\n\tarea_auth\x18\x02 \x01(\x0b\x32\x1b.otg.IsisAuthenticationBase\x12\x30\n\x0b\x64omain_auth\x18\x03 \x01(\x0b\x32\x1b.otg.IsisAuthenticationBaseB\x15\n\x13_ignore_receive_md5\"\xe3\x01\n\x16IsisAuthenticationBase\x12\x41\n\tauth_type\x18\x01 \x01(\x0e\x32).otg.IsisAuthenticationBase.AuthType.EnumH\x00\x88\x01\x01\x12\x10\n\x03md5\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08password\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a:\n\x08\x41uthType\".\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03md5\x10\x01\x12\x0c\n\x08password\x10\x02\x42\x0c\n\n_auth_typeB\x06\n\x04_md5B\x0b\n\t_password\"\xd8\x04\n\x10IsisV4RouteRange\x12&\n\taddresses\x18\x01 \x03(\x0b\x32\x13.otg.V4RouteAddress\x12\x18\n\x0blink_metric\x18\x02 \x01(\rH\x00\x88\x01\x01\x12?\n\x0borigin_type\x18\x03 \x01(\x0e\x32%.otg.IsisV4RouteRange.OriginType.EnumH\x01\x88\x01\x01\x12O\n\x13redistribution_type\x18\x04 \x01(\x0e\x32-.otg.IsisV4RouteRange.RedistributionType.EnumH\x02\x88\x01\x01\x12\x11\n\x04name\x18\x05 \x01(\tH\x03\x88\x01\x01\x12 \n\x13prefix_attr_enabled\x18\x06 \x01(\x08H\x04\x88\x01\x01\x12\x13\n\x06x_flag\x18\x07 \x01(\x08H\x05\x88\x01\x01\x12\x13\n\x06r_flag\x18\x08 \x01(\x08H\x06\x88\x01\x01\x12\x13\n\x06n_flag\x18\t \x01(\x08H\x07\x88\x01\x01\x1a\x41\n\nOriginType\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08internal\x10\x01\x12\x0c\n\x08\x65xternal\x10\x02\x1a?\n\x12RedistributionType\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x0e\n\x0c_link_metricB\x0e\n\x0c_origin_typeB\x16\n\x14_redistribution_typeB\x07\n\x05_nameB\x16\n\x14_prefix_attr_enabledB\t\n\x07_x_flagB\t\n\x07_r_flagB\t\n\x07_n_flag\"\x8c\x01\n\x0eV4RouteAddress\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06prefix\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x11\n\x04step\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\n\n\x08_addressB\t\n\x07_prefixB\x08\n\x06_countB\x07\n\x05_step\"\x8c\x01\n\x0eV6RouteAddress\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06prefix\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x11\n\x04step\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\n\n\x08_addressB\t\n\x07_prefixB\x08\n\x06_countB\x07\n\x05_step\"\x8d\x01\n\x0fMACRouteAddress\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06prefix\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x11\n\x04step\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\n\n\x08_addressB\t\n\x07_prefixB\x08\n\x06_countB\x07\n\x05_step\"\xd8\x04\n\x10IsisV6RouteRange\x12&\n\taddresses\x18\x01 \x03(\x0b\x32\x13.otg.V6RouteAddress\x12\x18\n\x0blink_metric\x18\x02 \x01(\rH\x00\x88\x01\x01\x12?\n\x0borigin_type\x18\x03 \x01(\x0e\x32%.otg.IsisV6RouteRange.OriginType.EnumH\x01\x88\x01\x01\x12O\n\x13redistribution_type\x18\x04 \x01(\x0e\x32-.otg.IsisV6RouteRange.RedistributionType.EnumH\x02\x88\x01\x01\x12\x11\n\x04name\x18\x05 \x01(\tH\x03\x88\x01\x01\x12 \n\x13prefix_attr_enabled\x18\x06 \x01(\x08H\x04\x88\x01\x01\x12\x13\n\x06x_flag\x18\x07 \x01(\x08H\x05\x88\x01\x01\x12\x13\n\x06r_flag\x18\x08 \x01(\x08H\x06\x88\x01\x01\x12\x13\n\x06n_flag\x18\t \x01(\x08H\x07\x88\x01\x01\x1a\x41\n\nOriginType\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08internal\x10\x01\x12\x0c\n\x08\x65xternal\x10\x02\x1a?\n\x12RedistributionType\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x0e\n\x0c_link_metricB\x0e\n\x0c_origin_typeB\x16\n\x14_redistribution_typeB\x07\n\x05_nameB\x16\n\x14_prefix_attr_enabledB\t\n\x07_x_flagB\t\n\x07_r_flagB\t\n\x07_n_flag\"\x93\x01\n\x0f\x44\x65viceBgpRouter\x12\x16\n\trouter_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12,\n\x0fipv4_interfaces\x18\x02 \x03(\x0b\x32\x13.otg.BgpV4Interface\x12,\n\x0fipv6_interfaces\x18\x03 \x03(\x0b\x32\x13.otg.BgpV6InterfaceB\x0c\n\n_router_id\"\x90\x02\n\x1b\x44\x65viceBgpMessageHeaderError\x12\x43\n\x07subcode\x18\x01 \x01(\x0e\x32-.otg.DeviceBgpMessageHeaderError.Subcode.EnumH\x00\x88\x01\x01\x1a\x9f\x01\n\x07Subcode\"\x93\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12.\n*connection_not_synchronized_code1_subcode1\x10\x01\x12%\n!bad_message_length_code1_subcode2\x10\x02\x12#\n\x1f\x62\x61\x64_message_type_code1_subcode3\x10\x03\x42\n\n\x08_subcode\"\xaa\x03\n\x19\x44\x65viceBgpOpenMessageError\x12\x41\n\x07subcode\x18\x01 \x01(\x0e\x32+.otg.DeviceBgpOpenMessageError.Subcode.EnumH\x00\x88\x01\x01\x1a\xbd\x02\n\x07Subcode\"\xb1\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12-\n)unsupported_version_number_code2_subcode1\x10\x01\x12 \n\x1c\x65rror_peer_as_code2_subcode2\x10\x02\x12\x1f\n\x1b\x65rror_bgp_id_code2_subcode3\x10\x03\x12\x31\n-unsupported_optional_parameter_code2_subcode4\x10\x04\x12\x1e\n\x1a\x61uth_failed_code2_subcode5\x10\x05\x12(\n$unsupported_hold_time_code2_subcode6\x10\x06\x12)\n%unsupported_capability_code2_subcode7\x10\x07\x42\n\n\x08_subcode\"\xdc\x04\n\x1b\x44\x65viceBgpUpdateMessageError\x12\x43\n\x07subcode\x18\x01 \x01(\x0e\x32-.otg.DeviceBgpUpdateMessageError.Subcode.EnumH\x00\x88\x01\x01\x1a\xeb\x03\n\x07Subcode\"\xdf\x03\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12(\n$malformed_attrib_list_code3_subcode1\x10\x01\x12\x30\n,unrecognized_wellknown_attrib_code3_subcode2\x10\x02\x12+\n\'wellknown_attrib_missing_code3_subcode3\x10\x03\x12%\n!attrib_flags_error_code3_subcode4\x10\x04\x12&\n\"attrib_length_error_code3_subcode5\x10\x05\x12(\n$invalid_origin_attrib_code3_subcode6\x10\x06\x12\"\n\x1e\x61s_routing_loop_code3_subcode7\x10\x07\x12&\n\"invalid_nhop_attrib_code3_subcode8\x10\x08\x12(\n$error_optional_attrib_code3_subcode9\x10\t\x12)\n%invalid_network_field_code3_subcode10\x10\n\x12#\n\x1f\x61\x62normal_aspath_code3_subcode11\x10\x0b\x42\n\n\x08_subcode\"\x1b\n\x19\x44\x65viceBgpHoldTimerExpired\"\"\n DeviceBgpFiniteStateMachineError\"\xe3\x03\n\x13\x44\x65viceBgpCeaseError\x12;\n\x07subcode\x18\x01 \x01(\x0e\x32%.otg.DeviceBgpCeaseError.Subcode.EnumH\x00\x88\x01\x01\x1a\x82\x03\n\x07Subcode\"\xf6\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12,\n(max_number_prefix_reached_code6_subcode1\x10\x01\x12!\n\x1d\x61\x64min_shutdown_code6_subcode2\x10\x02\x12\x1f\n\x1bpeer_deleted_code6_subcode3\x10\x03\x12\x1e\n\x1a\x61\x64min_reset_code6_subcode4\x10\x04\x12$\n connection_reject_code6_subcode5\x10\x05\x12\'\n#other_config_changes_code6_subcode6\x10\x06\x12\x32\n.connection_collision_resolution_code6_subcode7\x10\x07\x12#\n\x1fout_of_resources_code6_subcode8\x10\x08\x12#\n\x1f\x62\x66\x64_session_down_code6_subcode9\x10\tB\n\n\x08_subcode\"T\n\x14\x44\x65viceBgpCustomError\x12\x11\n\x04\x63ode\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x14\n\x07subcode\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x07\n\x05_codeB\n\n\x08_subcode\"\xe0\x06\n\tBgpV4Peer\x12\x19\n\x0cpeer_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x39\n\x16\x65vpn_ethernet_segments\x18\x02 \x03(\x0b\x32\x19.otg.BgpV4EthernetSegment\x12\x30\n\x07\x61s_type\x18\x03 \x01(\x0e\x32\x1a.otg.BgpV4Peer.AsType.EnumH\x01\x88\x01\x01\x12\x16\n\tas_number\x18\x04 \x01(\rH\x02\x88\x01\x01\x12?\n\x0f\x61s_number_width\x18\x05 \x01(\x0e\x32!.otg.BgpV4Peer.AsNumberWidth.EnumH\x03\x88\x01\x01\x12\"\n\x08\x61\x64vanced\x18\x06 \x01(\x0b\x32\x10.otg.BgpAdvanced\x12&\n\ncapability\x18\x07 \x01(\x0b\x32\x12.otg.BgpCapability\x12\x44\n\x1alearned_information_filter\x18\x08 \x01(\x0b\x32 .otg.BgpLearnedInformationFilter\x12\'\n\tv4_routes\x18\t \x03(\x0b\x32\x14.otg.BgpV4RouteRange\x12\'\n\tv6_routes\x18\n \x03(\x0b\x32\x14.otg.BgpV6RouteRange\x12.\n\x10v4_srte_policies\x18\x0b \x03(\x0b\x32\x14.otg.BgpSrteV4Policy\x12.\n\x10v6_srte_policies\x18\x0c \x03(\x0b\x32\x14.otg.BgpSrteV6Policy\x12\x11\n\x04name\x18\r \x01(\tH\x04\x88\x01\x01\x12\x31\n\x10graceful_restart\x18\x0e \x01(\x0b\x32\x17.otg.BgpGracefulRestart\x12,\n\x0ereplay_updates\x18\x0f \x01(\x0b\x32\x14.otg.BgpUpdateReplay\x1a\x35\n\x06\x41sType\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ibgp\x10\x01\x12\x08\n\x04\x65\x62gp\x10\x02\x1a;\n\rAsNumberWidth\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03two\x10\x01\x12\x08\n\x04\x66our\x10\x02\x42\x0f\n\r_peer_addressB\n\n\x08_as_typeB\x0c\n\n_as_numberB\x12\n\x10_as_number_widthB\x07\n\x05_name\"U\n\x0e\x42gpV4Interface\x12\x16\n\tipv4_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1d\n\x05peers\x18\x02 \x03(\x0b\x32\x0e.otg.BgpV4PeerB\x0c\n\n_ipv4_name\"\xf0\x03\n\x14\x42gpV4EthernetSegment\x12\x36\n\x0b\x64\x66_election\x18\x01 \x01(\x0b\x32!.otg.BgpEthernetSegmentDfElection\x12 \n\x04\x65vis\x18\x02 \x03(\x0b\x32\x12.otg.BgpV4EvpnEvis\x12\x10\n\x03\x65si\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x43\n\x0b\x61\x63tive_mode\x18\x04 \x01(\x0e\x32).otg.BgpV4EthernetSegment.ActiveMode.EnumH\x01\x88\x01\x01\x12\x16\n\tesi_label\x18\x05 \x01(\rH\x02\x88\x01\x01\x12\'\n\x08\x61\x64vanced\x18\x06 \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12&\n\x0b\x63ommunities\x18\x07 \x03(\x0b\x32\x11.otg.BgpCommunity\x12-\n\x0f\x65xt_communities\x18\x08 \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12\x1f\n\x07\x61s_path\x18\t \x01(\x0b\x32\x0e.otg.BgpAsPath\x1aH\n\nActiveMode\":\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rsingle_active\x10\x01\x12\x0e\n\nall_active\x10\x02\x42\x06\n\x04_esiB\x0e\n\x0c_active_modeB\x0c\n\n_esi_label\"N\n\x1c\x42gpEthernetSegmentDfElection\x12\x1b\n\x0e\x65lection_timer\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x11\n\x0f_election_timer\"\xda\x03\n\x10\x42gpRouteAdvanced\x12-\n include_multi_exit_discriminator\x18\x03 \x01(\x08H\x00\x88\x01\x01\x12%\n\x18multi_exit_discriminator\x18\x01 \x01(\rH\x01\x88\x01\x01\x12\x1b\n\x0einclude_origin\x18\x04 \x01(\x08H\x02\x88\x01\x01\x12\x36\n\x06origin\x18\x02 \x01(\x0e\x32!.otg.BgpRouteAdvanced.Origin.EnumH\x03\x88\x01\x01\x12%\n\x18include_local_preference\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x1d\n\x10local_preference\x18\x06 \x01(\rH\x05\x88\x01\x01\x1a\x43\n\x06Origin\"9\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03igp\x10\x01\x12\x07\n\x03\x65gp\x10\x02\x12\x0e\n\nincomplete\x10\x03\x42#\n!_include_multi_exit_discriminatorB\x1b\n\x19_multi_exit_discriminatorB\x11\n\x0f_include_originB\t\n\x07_originB\x1b\n\x19_include_local_preferenceB\x13\n\x11_local_preference\"\xa4\x02\n\x0c\x42gpCommunity\x12.\n\x04type\x18\x01 \x01(\x0e\x32\x1b.otg.BgpCommunity.Type.EnumH\x00\x88\x01\x01\x12\x16\n\tas_number\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\tas_custom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x8e\x01\n\x04Type\"\x85\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x14\n\x10manual_as_number\x10\x01\x12\r\n\tno_export\x10\x02\x12\x11\n\rno_advertised\x10\x03\x12\x17\n\x13no_export_subconfed\x10\x04\x12\x0e\n\nllgr_stale\x10\x05\x12\x0b\n\x07no_llgr\x10\x06\x42\x07\n\x05_typeB\x0c\n\n_as_numberB\x0c\n\n_as_custom\"\xf9\x03\n\x0f\x42gpExtCommunity\x12\x31\n\x04type\x18\x01 \x01(\x0e\x32\x1e.otg.BgpExtCommunity.Type.EnumH\x00\x88\x01\x01\x12\x37\n\x07subtype\x18\x02 \x01(\x0e\x32!.otg.BgpExtCommunity.Subtype.EnumH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\xbc\x01\n\x04Type\"\xb3\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1b\n\x17\x61\x64ministrator_as_2octet\x10\x01\x12\x1e\n\x1a\x61\x64ministrator_ipv4_address\x10\x02\x12\x1b\n\x17\x61\x64ministrator_as_4octet\x10\x03\x12\n\n\x06opaque\x10\x04\x12\x08\n\x04\x65vpn\x10\x05\x12*\n&administrator_as_2octet_link_bandwidth\x10\x06\x1a\x87\x01\n\x07Subtype\"|\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0croute_target\x10\x01\x12\n\n\x06origin\x10\x02\x12\x16\n\x12\x65xtended_bandwidth\x10\x03\x12\t\n\x05\x63olor\x10\x04\x12\x11\n\rencapsulation\x10\x05\x12\x0f\n\x0bmac_address\x10\x06\x42\x07\n\x05_typeB\n\n\x08_subtypeB\x08\n\x06_value\"\xbe\x02\n\tBgpAsPath\x12\x37\n\x0b\x61s_set_mode\x18\x01 \x01(\x0e\x32\x1d.otg.BgpAsPath.AsSetMode.EnumH\x00\x88\x01\x01\x12\'\n\x08segments\x18\x02 \x03(\x0b\x32\x15.otg.BgpAsPathSegment\x1a\xbe\x01\n\tAsSetMode\"\xb0\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1b\n\x17\x64o_not_include_local_as\x10\x01\x12\x12\n\x0einclude_as_seq\x10\x02\x12\x12\n\x0einclude_as_set\x10\x03\x12\x19\n\x15include_as_confed_seq\x10\x04\x12\x19\n\x15include_as_confed_set\x10\x05\x12\x1c\n\x18prepend_to_first_segment\x10\x06\x42\x0e\n\x0c_as_set_mode\"\xc2\x01\n\x10\x42gpAsPathSegment\x12\x32\n\x04type\x18\x01 \x01(\x0e\x32\x1f.otg.BgpAsPathSegment.Type.EnumH\x00\x88\x01\x01\x12\x12\n\nas_numbers\x18\x02 \x03(\r\x1a]\n\x04Type\"U\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x61s_seq\x10\x01\x12\n\n\x06\x61s_set\x10\x02\x12\x11\n\ras_confed_seq\x10\x03\x12\x11\n\ras_confed_set\x10\x04\x42\x07\n\x05_type\"\xa8\x01\n\rBgpV4EvpnEvis\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.BgpV4EvpnEvis.Choice.EnumH\x00\x88\x01\x01\x12%\n\tevi_vxlan\x18\x02 \x01(\x0b\x32\x12.otg.BgpV4EviVxlan\x1a\x30\n\x06\x43hoice\"&\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tevi_vxlan\x10\x01\x42\t\n\x07_choice\"\xe3\x05\n\rBgpV4EviVxlan\x12<\n\x11\x62roadcast_domains\x18\x01 \x03(\x0b\x32!.otg.BgpV4EviVxlanBroadcastDomain\x12\x46\n\x10replication_type\x18\x02 \x01(\x0e\x32\'.otg.BgpV4EviVxlan.ReplicationType.EnumH\x00\x88\x01\x01\x12\x17\n\npmsi_label\x18\x03 \x01(\rH\x01\x88\x01\x01\x12\x15\n\x08\x61\x64_label\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x37\n\x13route_distinguisher\x18\x05 \x01(\x0b\x32\x1a.otg.BgpRouteDistinguisher\x12\x30\n\x13route_target_export\x18\x06 \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\x30\n\x13route_target_import\x18\x07 \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\x33\n\x16l3_route_target_export\x18\x08 \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\x33\n\x16l3_route_target_import\x18\t \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\'\n\x08\x61\x64vanced\x18\n \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12&\n\x0b\x63ommunities\x18\x0b \x03(\x0b\x32\x11.otg.BgpCommunity\x12-\n\x0f\x65xt_communities\x18\x0c \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12\x1f\n\x07\x61s_path\x18\r \x01(\x0b\x32\x0e.otg.BgpAsPath\x1a\x43\n\x0fReplicationType\"0\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x17\n\x13ingress_replication\x10\x01\x42\x13\n\x11_replication_typeB\r\n\x0b_pmsi_labelB\x0b\n\t_ad_label\"\xb4\x01\n\x1c\x42gpV4EviVxlanBroadcastDomain\x12*\n\rcmac_ip_range\x18\x01 \x03(\x0b\x32\x13.otg.BgpCMacIpRange\x12\x1c\n\x0f\x65thernet_tag_id\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1f\n\x12vlan_aware_service\x18\x03 \x01(\x08H\x01\x88\x01\x01\x42\x12\n\x10_ethernet_tag_idB\x15\n\x13_vlan_aware_service\"\xd2\x03\n\x0e\x42gpCMacIpRange\x12+\n\rmac_addresses\x18\x01 \x01(\x0b\x32\x14.otg.MACRouteAddress\x12\x12\n\x05l2vni\x18\x02 \x01(\rH\x00\x88\x01\x01\x12+\n\x0eipv4_addresses\x18\x03 \x01(\x0b\x32\x13.otg.V4RouteAddress\x12+\n\x0eipv6_addresses\x18\x04 \x01(\x0b\x32\x13.otg.V6RouteAddress\x12\x12\n\x05l3vni\x18\x05 \x01(\rH\x01\x88\x01\x01\x12$\n\x17include_default_gateway\x18\x06 \x01(\x08H\x02\x88\x01\x01\x12\'\n\x08\x61\x64vanced\x18\x07 \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12&\n\x0b\x63ommunities\x18\x08 \x03(\x0b\x32\x11.otg.BgpCommunity\x12-\n\x0f\x65xt_communities\x18\t \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12\x1f\n\x07\x61s_path\x18\n \x01(\x0b\x32\x0e.otg.BgpAsPath\x12\x11\n\x04name\x18\x0b \x01(\tH\x03\x88\x01\x01\x42\x08\n\x06_l2vniB\x08\n\x06_l3vniB\x1a\n\x18_include_default_gatewayB\x07\n\x05_name\"\x98\x02\n\x15\x42gpRouteDistinguisher\x12<\n\x07rd_type\x18\x01 \x01(\x0e\x32&.otg.BgpRouteDistinguisher.RdType.EnumH\x00\x88\x01\x01\x12#\n\x16\x61uto_config_rd_ip_addr\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x15\n\x08rd_value\x18\x03 \x01(\tH\x02\x88\x01\x01\x1aQ\n\x06RdType\"G\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tas_2octet\x10\x01\x12\x10\n\x0cipv4_address\x10\x02\x12\r\n\tas_4octet\x10\x03\x42\n\n\x08_rd_typeB\x19\n\x17_auto_config_rd_ip_addrB\x0b\n\t_rd_value\"\xca\x01\n\x0e\x42gpRouteTarget\x12\x35\n\x07rt_type\x18\x01 \x01(\x0e\x32\x1f.otg.BgpRouteTarget.RtType.EnumH\x00\x88\x01\x01\x12\x15\n\x08rt_value\x18\x02 \x01(\tH\x01\x88\x01\x01\x1aQ\n\x06RtType\"G\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tas_2octet\x10\x01\x12\x10\n\x0cipv4_address\x10\x02\x12\r\n\tas_4octet\x10\x03\x42\n\n\x08_rt_typeB\x0b\n\t_rt_value\"\x83\x03\n\x0b\x42gpAdvanced\x12\x1f\n\x12hold_time_interval\x18\x01 \x01(\rH\x00\x88\x01\x01\x12 \n\x13keep_alive_interval\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1c\n\x0fupdate_interval\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x19\n\x0ctime_to_live\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x14\n\x07md5_key\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x19\n\x0cpassive_mode\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x18\n\x0blisten_port\x18\x07 \x01(\rH\x06\x88\x01\x01\x12\x1a\n\rneighbor_port\x18\x08 \x01(\rH\x07\x88\x01\x01\x42\x15\n\x13_hold_time_intervalB\x16\n\x14_keep_alive_intervalB\x12\n\x10_update_intervalB\x0f\n\r_time_to_liveB\n\n\x08_md5_keyB\x0f\n\r_passive_modeB\x0e\n\x0c_listen_portB\x10\n\x0e_neighbor_port\"\x91\n\n\rBgpCapability\x12\x19\n\x0cipv4_unicast\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x1b\n\x0eipv4_multicast\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x19\n\x0cipv6_unicast\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x1b\n\x0eipv6_multicast\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x11\n\x04vpls\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x1a\n\rroute_refresh\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x1d\n\x10route_constraint\x18\x07 \x01(\x08H\x06\x88\x01\x01\x12\x1f\n\x12link_state_non_vpn\x18\x08 \x01(\x08H\x07\x88\x01\x01\x12\x1b\n\x0elink_state_vpn\x18\t \x01(\x08H\x08\x88\x01\x01\x12\x11\n\x04\x65vpn\x18\n \x01(\x08H\t\x88\x01\x01\x12\'\n\x1a\x65xtended_next_hop_encoding\x18\x0b \x01(\x08H\n\x88\x01\x01\x12\x1f\n\x12ipv4_multicast_vpn\x18\x0c \x01(\x08H\x0b\x88\x01\x01\x12\x1a\n\ripv4_mpls_vpn\x18\r \x01(\x08H\x0c\x88\x01\x01\x12\x15\n\x08ipv4_mdt\x18\x0e \x01(\x08H\r\x88\x01\x01\x12$\n\x17ipv4_multicast_mpls_vpn\x18\x0f \x01(\x08H\x0e\x88\x01\x01\x12#\n\x16ipv4_unicast_flow_spec\x18\x10 \x01(\x08H\x0f\x88\x01\x01\x12\x1e\n\x11ipv4_sr_te_policy\x18\x11 \x01(\x08H\x10\x88\x01\x01\x12\"\n\x15ipv4_unicast_add_path\x18\x12 \x01(\x08H\x11\x88\x01\x01\x12\x1f\n\x12ipv6_multicast_vpn\x18\x13 \x01(\x08H\x12\x88\x01\x01\x12\x1a\n\ripv6_mpls_vpn\x18\x14 \x01(\x08H\x13\x88\x01\x01\x12\x15\n\x08ipv6_mdt\x18\x15 \x01(\x08H\x14\x88\x01\x01\x12$\n\x17ipv6_multicast_mpls_vpn\x18\x16 \x01(\x08H\x15\x88\x01\x01\x12#\n\x16ipv6_unicast_flow_spec\x18\x17 \x01(\x08H\x16\x88\x01\x01\x12\x1e\n\x11ipv6_sr_te_policy\x18\x18 \x01(\x08H\x17\x88\x01\x01\x12\"\n\x15ipv6_unicast_add_path\x18\x19 \x01(\x08H\x18\x88\x01\x01\x42\x0f\n\r_ipv4_unicastB\x11\n\x0f_ipv4_multicastB\x0f\n\r_ipv6_unicastB\x11\n\x0f_ipv6_multicastB\x07\n\x05_vplsB\x10\n\x0e_route_refreshB\x13\n\x11_route_constraintB\x15\n\x13_link_state_non_vpnB\x11\n\x0f_link_state_vpnB\x07\n\x05_evpnB\x1d\n\x1b_extended_next_hop_encodingB\x15\n\x13_ipv4_multicast_vpnB\x10\n\x0e_ipv4_mpls_vpnB\x0b\n\t_ipv4_mdtB\x1a\n\x18_ipv4_multicast_mpls_vpnB\x19\n\x17_ipv4_unicast_flow_specB\x14\n\x12_ipv4_sr_te_policyB\x18\n\x16_ipv4_unicast_add_pathB\x15\n\x13_ipv6_multicast_vpnB\x10\n\x0e_ipv6_mpls_vpnB\x0b\n\t_ipv6_mdtB\x1a\n\x18_ipv6_multicast_mpls_vpnB\x19\n\x17_ipv6_unicast_flow_specB\x14\n\x12_ipv6_sr_te_policyB\x18\n\x16_ipv6_unicast_add_path\"\x91\x01\n\x1b\x42gpLearnedInformationFilter\x12 \n\x13unicast_ipv4_prefix\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12 \n\x13unicast_ipv6_prefix\x18\x02 \x01(\x08H\x01\x88\x01\x01\x42\x16\n\x14_unicast_ipv4_prefixB\x16\n\x14_unicast_ipv6_prefix\"\x94\x06\n\x0f\x42gpV4RouteRange\x12&\n\taddresses\x18\x01 \x03(\x0b\x32\x13.otg.V4RouteAddress\x12\x41\n\rnext_hop_mode\x18\x02 \x01(\x0e\x32%.otg.BgpV4RouteRange.NextHopMode.EnumH\x00\x88\x01\x01\x12P\n\x15next_hop_address_type\x18\x03 \x01(\x0e\x32,.otg.BgpV4RouteRange.NextHopAddressType.EnumH\x01\x88\x01\x01\x12\"\n\x15next_hop_ipv4_address\x18\x04 \x01(\tH\x02\x88\x01\x01\x12\"\n\x15next_hop_ipv6_address\x18\x05 \x01(\tH\x03\x88\x01\x01\x12\'\n\x08\x61\x64vanced\x18\x06 \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12&\n\x0b\x63ommunities\x18\x07 \x03(\x0b\x32\x11.otg.BgpCommunity\x12\x1f\n\x07\x61s_path\x18\x08 \x01(\x0b\x32\x0e.otg.BgpAsPath\x12!\n\x08\x61\x64\x64_path\x18\t \x01(\x0b\x32\x0f.otg.BgpAddPath\x12\x11\n\x04name\x18\n \x01(\tH\x04\x88\x01\x01\x12-\n\x0f\x65xt_communities\x18\x0b \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12\x37\n\x14\x65xtended_communities\x18\x0c \x03(\x0b\x32\x19.otg.BgpExtendedCommunity\x1a@\n\x0bNextHopMode\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08local_ip\x10\x01\x12\n\n\x06manual\x10\x02\x1a\x41\n\x12NextHopAddressType\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x42\x10\n\x0e_next_hop_modeB\x18\n\x16_next_hop_address_typeB\x18\n\x16_next_hop_ipv4_addressB\x18\n\x16_next_hop_ipv6_addressB\x07\n\x05_name\".\n\nBgpAddPath\x12\x14\n\x07path_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\n\n\x08_path_id\"\xf3\x06\n\x14\x42gpExtendedCommunity\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.BgpExtendedCommunity.Choice.EnumH\x00\x88\x01\x01\x12R\n\x19transitive_2octet_as_type\x18\x02 \x01(\x0b\x32/.otg.BgpExtendedCommunityTransitive2OctetAsType\x12X\n\x1ctransitive_ipv4_address_type\x18\x03 \x01(\x0b\x32\x32.otg.BgpExtendedCommunityTransitiveIpv4AddressType\x12R\n\x19transitive_4octet_as_type\x18\x04 \x01(\x0b\x32/.otg.BgpExtendedCommunityTransitive4OctetAsType\x12M\n\x16transitive_opaque_type\x18\x05 \x01(\x0b\x32-.otg.BgpExtendedCommunityTransitiveOpaqueType\x12I\n\x14transitive_evpn_type\x18\x06 \x01(\x0b\x32+.otg.BgpExtendedCommunityTransitiveEvpnType\x12Y\n\x1dnon_transitive_2octet_as_type\x18\x07 \x01(\x0b\x32\x32.otg.BgpExtendedCommunityNonTransitive2OctetAsType\x12\x33\n\x06\x63ustom\x18\x08 \x01(\x0b\x32#.otg.BgpExtendedCommunityCustomType\x1a\xe7\x01\n\x06\x43hoice\"\xdc\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1d\n\x19transitive_2octet_as_type\x10\x01\x12 \n\x1ctransitive_ipv4_address_type\x10\x02\x12\x1d\n\x19transitive_4octet_as_type\x10\x03\x12\x1a\n\x16transitive_opaque_type\x10\x04\x12\x18\n\x14transitive_evpn_type\x10\x05\x12!\n\x1dnon_transitive_2octet_as_type\x10\x06\x12\n\n\x06\x63ustom\x10\x07\x42\t\n\x07_choice\"\x9f\x01\n5BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget\x12\x1c\n\x0fglobal_2byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_4byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_2byte_asB\x14\n\x12_local_4byte_admin\"\x9f\x01\n5BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin\x12\x1c\n\x0fglobal_2byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_4byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_2byte_asB\x14\n\x12_local_4byte_admin\"\x94\x03\n*BgpExtendedCommunityTransitive2OctetAsType\x12P\n\x06\x63hoice\x18\x01 \x01(\x0e\x32;.otg.BgpExtendedCommunityTransitive2OctetAsType.Choice.EnumH\x00\x88\x01\x01\x12X\n\x14route_target_subtype\x18\x02 \x01(\x0b\x32:.otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget\x12X\n\x14route_origin_subtype\x18\x03 \x01(\x0b\x32:.otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin\x1aU\n\x06\x43hoice\"K\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x18\n\x14route_target_subtype\x10\x01\x12\x18\n\x14route_origin_subtype\x10\x02\x42\t\n\x07_choice\"\xa6\x01\n8BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin\x12\x1e\n\x11global_ipv4_admin\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x14\n\x12_global_ipv4_adminB\x14\n\x12_local_2byte_admin\"\xa6\x01\n8BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget\x12\x1e\n\x11global_ipv4_admin\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x14\n\x12_global_ipv4_adminB\x14\n\x12_local_2byte_admin\"\xa0\x03\n-BgpExtendedCommunityTransitiveIpv4AddressType\x12S\n\x06\x63hoice\x18\x01 \x01(\x0e\x32>.otg.BgpExtendedCommunityTransitiveIpv4AddressType.Choice.EnumH\x00\x88\x01\x01\x12[\n\x14route_target_subtype\x18\x02 \x01(\x0b\x32=.otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget\x12[\n\x14route_origin_subtype\x18\x03 \x01(\x0b\x32=.otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin\x1aU\n\x06\x43hoice\"K\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x18\n\x14route_target_subtype\x10\x01\x12\x18\n\x14route_origin_subtype\x10\x02\x42\t\n\x07_choice\"\x9f\x01\n5BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget\x12\x1c\n\x0fglobal_4byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_4byte_asB\x14\n\x12_local_2byte_admin\"\x9f\x01\n5BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin\x12\x1c\n\x0fglobal_4byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_4byte_asB\x14\n\x12_local_2byte_admin\"\x94\x03\n*BgpExtendedCommunityTransitive4OctetAsType\x12P\n\x06\x63hoice\x18\x01 \x01(\x0e\x32;.otg.BgpExtendedCommunityTransitive4OctetAsType.Choice.EnumH\x00\x88\x01\x01\x12X\n\x14route_target_subtype\x18\x02 \x01(\x0b\x32:.otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget\x12X\n\x14route_origin_subtype\x18\x03 \x01(\x0b\x32:.otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin\x1aU\n\x06\x43hoice\"K\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x18\n\x14route_target_subtype\x10\x01\x12\x18\n\x14route_origin_subtype\x10\x02\x42\t\n\x07_choice\"k\n-BgpExtendedCommunityTransitiveOpaqueTypeColor\x12\x12\n\x05\x66lags\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x12\n\x05\x63olor\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x08\n\x06_flagsB\x08\n\x06_color\"\x85\x01\n5BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation\x12\x15\n\x08reserved\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x18\n\x0btunnel_type\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x0b\n\t_reservedB\x0e\n\x0c_tunnel_type\"\xfc\x02\n(BgpExtendedCommunityTransitiveOpaqueType\x12N\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x39.otg.BgpExtendedCommunityTransitiveOpaqueType.Choice.EnumH\x00\x88\x01\x01\x12I\n\rcolor_subtype\x18\x02 \x01(\x0b\x32\x32.otg.BgpExtendedCommunityTransitiveOpaqueTypeColor\x12Y\n\x15\x65ncapsulation_subtype\x18\x03 \x01(\x0b\x32:.otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation\x1aO\n\x06\x43hoice\"E\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rcolor_subtype\x10\x01\x12\x19\n\x15\x65ncapsulation_subtype\x10\x02\x42\t\n\x07_choice\"Y\n/BgpExtendedCommunityTransitiveEvpnTypeRouterMac\x12\x17\n\nrouter_mac\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\r\n\x0b_router_mac\"\x8e\x02\n&BgpExtendedCommunityTransitiveEvpnType\x12L\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x37.otg.BgpExtendedCommunityTransitiveEvpnType.Choice.EnumH\x00\x88\x01\x01\x12P\n\x12router_mac_subtype\x18\x02 \x01(\x0b\x32\x34.otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac\x1a\x39\n\x06\x43hoice\"/\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x16\n\x12router_mac_subtype\x10\x01\x42\t\n\x07_choice\"\x94\x01\n:BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth\x12\x1c\n\x0fglobal_2byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tbandwidth\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\x12\n\x10_global_2byte_asB\x0c\n\n_bandwidth\"\xaf\x02\n-BgpExtendedCommunityNonTransitive2OctetAsType\x12S\n\x06\x63hoice\x18\x01 \x01(\x0e\x32>.otg.BgpExtendedCommunityNonTransitive2OctetAsType.Choice.EnumH\x00\x88\x01\x01\x12_\n\x16link_bandwidth_subtype\x18\x02 \x01(\x0b\x32?.otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth\x1a=\n\x06\x43hoice\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1a\n\x16link_bandwidth_subtype\x10\x01\x42\t\n\x07_choice\"\xa4\x01\n\x1e\x42gpExtendedCommunityCustomType\x12\x1b\n\x0e\x63ommunity_type\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11\x63ommunity_subtype\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x11\n\x0f_community_typeB\x14\n\x12_community_subtypeB\x08\n\x06_value\"\x94\x06\n\x0f\x42gpV6RouteRange\x12&\n\taddresses\x18\x01 \x03(\x0b\x32\x13.otg.V6RouteAddress\x12\x41\n\rnext_hop_mode\x18\x02 \x01(\x0e\x32%.otg.BgpV6RouteRange.NextHopMode.EnumH\x00\x88\x01\x01\x12P\n\x15next_hop_address_type\x18\x03 \x01(\x0e\x32,.otg.BgpV6RouteRange.NextHopAddressType.EnumH\x01\x88\x01\x01\x12\"\n\x15next_hop_ipv4_address\x18\x04 \x01(\tH\x02\x88\x01\x01\x12\"\n\x15next_hop_ipv6_address\x18\x05 \x01(\tH\x03\x88\x01\x01\x12\'\n\x08\x61\x64vanced\x18\x06 \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12&\n\x0b\x63ommunities\x18\x07 \x03(\x0b\x32\x11.otg.BgpCommunity\x12\x1f\n\x07\x61s_path\x18\x08 \x01(\x0b\x32\x0e.otg.BgpAsPath\x12!\n\x08\x61\x64\x64_path\x18\t \x01(\x0b\x32\x0f.otg.BgpAddPath\x12\x11\n\x04name\x18\n \x01(\tH\x04\x88\x01\x01\x12-\n\x0f\x65xt_communities\x18\x0b \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12\x37\n\x14\x65xtended_communities\x18\x0c \x03(\x0b\x32\x19.otg.BgpExtendedCommunity\x1a@\n\x0bNextHopMode\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08local_ip\x10\x01\x12\n\n\x06manual\x10\x02\x1a\x41\n\x12NextHopAddressType\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x42\x10\n\x0e_next_hop_modeB\x18\n\x16_next_hop_address_typeB\x18\n\x16_next_hop_ipv4_addressB\x18\n\x16_next_hop_ipv6_addressB\x07\n\x05_name\"\xfb\x06\n\x0f\x42gpSrteV4Policy\x12\x1a\n\rdistinguisher\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x12\n\x05\x63olor\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1a\n\ripv4_endpoint\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x41\n\rnext_hop_mode\x18\x04 \x01(\x0e\x32%.otg.BgpSrteV4Policy.NextHopMode.EnumH\x03\x88\x01\x01\x12P\n\x15next_hop_address_type\x18\x05 \x01(\x0e\x32,.otg.BgpSrteV4Policy.NextHopAddressType.EnumH\x04\x88\x01\x01\x12\"\n\x15next_hop_ipv4_address\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\"\n\x15next_hop_ipv6_address\x18\x07 \x01(\tH\x06\x88\x01\x01\x12\'\n\x08\x61\x64vanced\x18\x08 \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12!\n\x08\x61\x64\x64_path\x18\t \x01(\x0b\x32\x0f.otg.BgpAddPath\x12\x1f\n\x07\x61s_path\x18\n \x01(\x0b\x32\x0e.otg.BgpAsPath\x12&\n\x0b\x63ommunities\x18\x0b \x03(\x0b\x32\x11.otg.BgpCommunity\x12-\n\x0f\x65xt_communities\x18\x0c \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12,\n\x0btunnel_tlvs\x18\r \x03(\x0b\x32\x17.otg.BgpSrteV4TunnelTlv\x12\x11\n\x04name\x18\x0e \x01(\tH\x07\x88\x01\x01\x12\x13\n\x06\x61\x63tive\x18\x0f \x01(\x08H\x08\x88\x01\x01\x1a@\n\x0bNextHopMode\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08local_ip\x10\x01\x12\n\n\x06manual\x10\x02\x1a\x41\n\x12NextHopAddressType\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x42\x10\n\x0e_distinguisherB\x08\n\x06_colorB\x10\n\x0e_ipv4_endpointB\x10\n\x0e_next_hop_modeB\x18\n\x16_next_hop_address_typeB\x18\n\x16_next_hop_ipv4_addressB\x18\n\x16_next_hop_ipv6_addressB\x07\n\x05_nameB\t\n\x07_active\"\xb6\x04\n\x12\x42gpSrteV4TunnelTlv\x12\x41\n\x17remote_endpoint_sub_tlv\x18\x01 \x01(\x0b\x32 .otg.BgpSrteRemoteEndpointSubTlv\x12.\n\rcolor_sub_tlv\x18\x02 \x01(\x0b\x32\x17.otg.BgpSrteColorSubTlv\x12\x32\n\x0f\x62inding_sub_tlv\x18\x03 \x01(\x0b\x32\x19.otg.BgpSrteBindingSubTlv\x12\x38\n\x12preference_sub_tlv\x18\x04 \x01(\x0b\x32\x1c.otg.BgpSrtePreferenceSubTlv\x12\x41\n\x17policy_priority_sub_tlv\x18\x05 \x01(\x0b\x32 .otg.BgpSrtePolicyPrioritySubTlv\x12\x39\n\x13policy_name_sub_tlv\x18\x06 \x01(\x0b\x32\x1c.otg.BgpSrtePolicyNameSubTlv\x12U\n\"explicit_null_label_policy_sub_tlv\x18\x07 \x01(\x0b\x32).otg.BgpSrteExplicitNullLabelPolicySubTlv\x12.\n\rsegment_lists\x18\x08 \x03(\x0b\x32\x17.otg.BgpSrteSegmentList\x12\x11\n\x04name\x18\t \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06\x61\x63tive\x18\n \x01(\x08H\x01\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_active\"\xbe\x02\n\x1b\x42gpSrteRemoteEndpointSubTlv\x12\x16\n\tas_number\x18\x01 \x01(\rH\x00\x88\x01\x01\x12P\n\x0e\x61\x64\x64ress_family\x18\x02 \x01(\x0e\x32\x33.otg.BgpSrteRemoteEndpointSubTlv.AddressFamily.EnumH\x01\x88\x01\x01\x12\x19\n\x0cipv4_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x19\n\x0cipv6_address\x18\x04 \x01(\tH\x03\x88\x01\x01\x1a<\n\rAddressFamily\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x42\x0c\n\n_as_numberB\x11\n\x0f_address_familyB\x0f\n\r_ipv4_addressB\x0f\n\r_ipv6_address\"2\n\x12\x42gpSrteColorSubTlv\x12\x12\n\x05\x63olor\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_color\"\xea\x02\n\x14\x42gpSrteBindingSubTlv\x12L\n\x10\x62inding_sid_type\x18\x01 \x01(\x0e\x32-.otg.BgpSrteBindingSubTlv.BindingSidType.EnumH\x00\x88\x01\x01\x12\x1b\n\x0e\x66our_octet_sid\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x15\n\x08ipv6_sid\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x13\n\x06s_flag\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x13\n\x06i_flag\x18\x05 \x01(\x08H\x04\x88\x01\x01\x1a[\n\x0e\x42indingSidType\"I\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0e\n\nno_binding\x10\x01\x12\x12\n\x0e\x66our_octet_sid\x10\x02\x12\x0c\n\x08ipv6_sid\x10\x03\x42\x13\n\x11_binding_sid_typeB\x11\n\x0f_four_octet_sidB\x0b\n\t_ipv6_sidB\t\n\x07_s_flagB\t\n\x07_i_flag\"A\n\x17\x42gpSrtePreferenceSubTlv\x12\x17\n\npreference\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\r\n\x0b_preference\"O\n\x1b\x42gpSrtePolicyPrioritySubTlv\x12\x1c\n\x0fpolicy_priority\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x12\n\x10_policy_priority\"C\n\x17\x42gpSrtePolicyNameSubTlv\x12\x18\n\x0bpolicy_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0e\n\x0c_policy_name\"\xd6\x02\n$BgpSrteExplicitNullLabelPolicySubTlv\x12o\n\x1a\x65xplicit_null_label_policy\x18\x01 \x01(\x0e\x32\x46.otg.BgpSrteExplicitNullLabelPolicySubTlv.ExplicitNullLabelPolicy.EnumH\x00\x88\x01\x01\x1a\x9d\x01\n\x17\x45xplicitNullLabelPolicy\"\x81\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rreserved_enlp\x10\x01\x12\x12\n\x0epush_ipv4_enlp\x10\x02\x12\x12\n\x0epush_ipv6_enlp\x10\x03\x12\x17\n\x13push_ipv4_ipv6_enlp\x10\x04\x12\x14\n\x10\x64o_not_push_enlp\x10\x05\x42\x1d\n\x1b_explicit_null_label_policy\"\x97\x01\n\x12\x42gpSrteSegmentList\x12\x13\n\x06weight\x18\x01 \x01(\rH\x00\x88\x01\x01\x12%\n\x08segments\x18\x02 \x03(\x0b\x32\x13.otg.BgpSrteSegment\x12\x11\n\x04name\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x13\n\x06\x61\x63tive\x18\x04 \x01(\x08H\x02\x88\x01\x01\x42\t\n\x07_weightB\x07\n\x05_nameB\t\n\x07_active\"\xdc\x06\n\x0e\x42gpSrteSegment\x12?\n\x0csegment_type\x18\x01 \x01(\x0e\x32$.otg.BgpSrteSegment.SegmentType.EnumH\x00\x88\x01\x01\x12.\n\x06type_a\x18\x02 \x01(\x0b\x32\x1e.otg.BgpSrteSegmentATypeSubTlv\x12.\n\x06type_b\x18\x03 \x01(\x0b\x32\x1e.otg.BgpSrteSegmentBTypeSubTlv\x12.\n\x06type_c\x18\x04 \x01(\x0b\x32\x1e.otg.BgpSrteSegmentCTypeSubTlv\x12.\n\x06type_d\x18\x05 \x01(\x0b\x32\x1e.otg.BgpSrteSegmentDTypeSubTlv\x12.\n\x06type_e\x18\x06 \x01(\x0b\x32\x1e.otg.BgpSrteSegmentETypeSubTlv\x12.\n\x06type_f\x18\x07 \x01(\x0b\x32\x1e.otg.BgpSrteSegmentFTypeSubTlv\x12.\n\x06type_g\x18\x08 \x01(\x0b\x32\x1e.otg.BgpSrteSegmentGTypeSubTlv\x12.\n\x06type_h\x18\t \x01(\x0b\x32\x1e.otg.BgpSrteSegmentHTypeSubTlv\x12.\n\x06type_i\x18\n \x01(\x0b\x32\x1e.otg.BgpSrteSegmentITypeSubTlv\x12.\n\x06type_j\x18\x0b \x01(\x0b\x32\x1e.otg.BgpSrteSegmentJTypeSubTlv\x12.\n\x06type_k\x18\x0c \x01(\x0b\x32\x1e.otg.BgpSrteSegmentKTypeSubTlv\x12\x11\n\x04name\x18\r \x01(\tH\x01\x88\x01\x01\x12\x13\n\x06\x61\x63tive\x18\x0e \x01(\x08H\x02\x88\x01\x01\x1a\xab\x01\n\x0bSegmentType\"\x9b\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06type_a\x10\x01\x12\n\n\x06type_b\x10\x02\x12\n\n\x06type_c\x10\x03\x12\n\n\x06type_d\x10\x04\x12\n\n\x06type_e\x10\x05\x12\n\n\x06type_f\x10\x06\x12\n\n\x06type_g\x10\x07\x12\n\n\x06type_h\x10\x08\x12\n\n\x06type_i\x10\t\x12\n\n\x06type_j\x10\n\x12\n\n\x06type_k\x10\x0b\x42\x0f\n\r_segment_typeB\x07\n\x05_nameB\t\n\x07_active\"\x80\x01\n\x10\x42gpSrteSrMplsSid\x12\x12\n\x05label\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x0f\n\x02tc\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05s_bit\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x10\n\x03ttl\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x08\n\x06_labelB\x05\n\x03_tcB\x08\n\x06_s_bitB\x06\n\x04_ttl\"\xca\x01\n*BgpSrteSRv6SIDEndpointBehaviorAndStructure\x12\x16\n\tlb_length\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tln_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x18\n\x0b\x66unc_length\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x17\n\narg_length\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x0c\n\n_lb_lengthB\x0c\n\n_ln_lengthB\x0e\n\x0c_func_lengthB\r\n\x0b_arg_length\"\xa7\x01\n\x19\x42gpSrteSegmentATypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x12\n\x05label\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0f\n\x02tc\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x12\n\x05s_bit\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x10\n\x03ttl\x18\x05 \x01(\rH\x04\x88\x01\x01\x42\x08\n\x06_flagsB\x08\n\x06_labelB\x05\n\x03_tcB\x08\n\x06_s_bitB\x06\n\x04_ttl\"\xb2\x01\n\x19\x42gpSrteSegmentBTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08srv6_sid\x18\x02 \x01(\tH\x01\x88\x01\x01\x12S\n\x1asrv6_sid_endpoint_behavior\x18\x03 \x01(\x0b\x32/.otg.BgpSrteSRv6SIDEndpointBehaviorAndStructureB\x08\n\x06_flagsB\x0b\n\t_srv6_sid\"\xc7\x01\n\x19\x42gpSrteSegmentCTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1e\n\x11ipv4_node_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12*\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x15.otg.BgpSrteSrMplsSidB\x08\n\x06_flagsB\x0f\n\r_sr_algorithmB\x14\n\x12_ipv4_node_address\"\xc7\x01\n\x19\x42gpSrteSegmentDTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1e\n\x11ipv6_node_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12*\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x15.otg.BgpSrteSrMplsSidB\x08\n\x06_flagsB\x0f\n\r_sr_algorithmB\x14\n\x12_ipv6_node_address\"\xd3\x01\n\x19\x42gpSrteSegmentETypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12local_interface_id\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1e\n\x11ipv4_node_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12*\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x15.otg.BgpSrteSrMplsSidB\x08\n\x06_flagsB\x15\n\x13_local_interface_idB\x14\n\x12_ipv4_node_address\"\xd7\x01\n\x19\x42gpSrteSegmentFTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12local_ipv4_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12 \n\x13remote_ipv4_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12*\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x15.otg.BgpSrteSrMplsSidB\x08\n\x06_flagsB\x15\n\x13_local_ipv4_addressB\x16\n\x14_remote_ipv4_address\"\xdd\x02\n\x19\x42gpSrteSegmentGTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12local_interface_id\x18\x02 \x01(\rH\x01\x88\x01\x01\x12$\n\x17local_ipv6_node_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12 \n\x13remote_interface_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x12%\n\x18remote_ipv6_node_address\x18\x05 \x01(\tH\x04\x88\x01\x01\x12*\n\x0bsr_mpls_sid\x18\x06 \x01(\x0b\x32\x15.otg.BgpSrteSrMplsSidB\x08\n\x06_flagsB\x15\n\x13_local_interface_idB\x1a\n\x18_local_ipv6_node_addressB\x16\n\x14_remote_interface_idB\x1b\n\x19_remote_ipv6_node_address\"\xd7\x01\n\x19\x42gpSrteSegmentHTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12local_ipv6_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12 \n\x13remote_ipv6_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12*\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x15.otg.BgpSrteSrMplsSidB\x08\n\x06_flagsB\x15\n\x13_local_ipv6_addressB\x16\n\x14_remote_ipv6_address\"\xe8\x01\n\x19\x42gpSrteSegmentITypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11ipv6_node_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x15\n\x08srv6_sid\x18\x03 \x01(\tH\x02\x88\x01\x01\x12S\n\x1asrv6_sid_endpoint_behavior\x18\x04 \x01(\x0b\x32/.otg.BgpSrteSRv6SIDEndpointBehaviorAndStructureB\x08\n\x06_flagsB\x14\n\x12_ipv6_node_addressB\x0b\n\t_srv6_sid\"\xd6\x03\n\x19\x42gpSrteSegmentJTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1f\n\x12local_interface_id\x18\x03 \x01(\rH\x02\x88\x01\x01\x12$\n\x17local_ipv6_node_address\x18\x04 \x01(\tH\x03\x88\x01\x01\x12 \n\x13remote_interface_id\x18\x05 \x01(\rH\x04\x88\x01\x01\x12%\n\x18remote_ipv6_node_address\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\x15\n\x08srv6_sid\x18\x07 \x01(\tH\x06\x88\x01\x01\x12S\n\x1asrv6_sid_endpoint_behavior\x18\x08 \x01(\x0b\x32/.otg.BgpSrteSRv6SIDEndpointBehaviorAndStructureB\x08\n\x06_flagsB\x0f\n\r_sr_algorithmB\x15\n\x13_local_interface_idB\x1a\n\x18_local_ipv6_node_addressB\x16\n\x14_remote_interface_idB\x1b\n\x19_remote_ipv6_node_addressB\x0b\n\t_srv6_sid\"\xd0\x02\n\x19\x42gpSrteSegmentKTypeSubTlv\x12\x12\n\x05\x66lags\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1f\n\x12local_ipv6_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12 \n\x13remote_ipv6_address\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x15\n\x08srv6_sid\x18\x05 \x01(\tH\x04\x88\x01\x01\x12S\n\x1asrv6_sid_endpoint_behavior\x18\x06 \x01(\x0b\x32/.otg.BgpSrteSRv6SIDEndpointBehaviorAndStructureB\x08\n\x06_flagsB\x0f\n\r_sr_algorithmB\x15\n\x13_local_ipv6_addressB\x16\n\x14_remote_ipv6_addressB\x0b\n\t_srv6_sid\"\xfa\x06\n\x0f\x42gpSrteV6Policy\x12\x1a\n\rdistinguisher\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x12\n\x05\x63olor\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1a\n\ripv6_endpoint\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x41\n\rnext_hop_mode\x18\x04 \x01(\x0e\x32%.otg.BgpSrteV6Policy.NextHopMode.EnumH\x03\x88\x01\x01\x12P\n\x15next_hop_address_type\x18\x05 \x01(\x0e\x32,.otg.BgpSrteV6Policy.NextHopAddressType.EnumH\x04\x88\x01\x01\x12\"\n\x15next_hop_ipv4_address\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\"\n\x15next_hop_ipv6_address\x18\x07 \x01(\tH\x06\x88\x01\x01\x12\'\n\x08\x61\x64vanced\x18\x08 \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12!\n\x08\x61\x64\x64_path\x18\t \x01(\x0b\x32\x0f.otg.BgpAddPath\x12\x1f\n\x07\x61s_path\x18\n \x01(\x0b\x32\x0e.otg.BgpAsPath\x12&\n\x0b\x63ommunities\x18\x0b \x03(\x0b\x32\x11.otg.BgpCommunity\x12,\n\x0e\x65xtcommunities\x18\x0c \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12,\n\x0btunnel_tlvs\x18\r \x03(\x0b\x32\x17.otg.BgpSrteV6TunnelTlv\x12\x11\n\x04name\x18\x0e \x01(\tH\x07\x88\x01\x01\x12\x13\n\x06\x61\x63tive\x18\x0f \x01(\x08H\x08\x88\x01\x01\x1a@\n\x0bNextHopMode\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08local_ip\x10\x01\x12\n\n\x06manual\x10\x02\x1a\x41\n\x12NextHopAddressType\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x42\x10\n\x0e_distinguisherB\x08\n\x06_colorB\x10\n\x0e_ipv6_endpointB\x10\n\x0e_next_hop_modeB\x18\n\x16_next_hop_address_typeB\x18\n\x16_next_hop_ipv4_addressB\x18\n\x16_next_hop_ipv6_addressB\x07\n\x05_nameB\t\n\x07_active\"\xb6\x04\n\x12\x42gpSrteV6TunnelTlv\x12\x41\n\x17remote_endpoint_sub_tlv\x18\x01 \x01(\x0b\x32 .otg.BgpSrteRemoteEndpointSubTlv\x12.\n\rcolor_sub_tlv\x18\x02 \x01(\x0b\x32\x17.otg.BgpSrteColorSubTlv\x12\x32\n\x0f\x62inding_sub_tlv\x18\x03 \x01(\x0b\x32\x19.otg.BgpSrteBindingSubTlv\x12\x38\n\x12preference_sub_tlv\x18\x04 \x01(\x0b\x32\x1c.otg.BgpSrtePreferenceSubTlv\x12\x41\n\x17policy_priority_sub_tlv\x18\x05 \x01(\x0b\x32 .otg.BgpSrtePolicyPrioritySubTlv\x12\x39\n\x13policy_name_sub_tlv\x18\x06 \x01(\x0b\x32\x1c.otg.BgpSrtePolicyNameSubTlv\x12U\n\"explicit_null_label_policy_sub_tlv\x18\x07 \x01(\x0b\x32).otg.BgpSrteExplicitNullLabelPolicySubTlv\x12.\n\rsegment_lists\x18\x08 \x03(\x0b\x32\x17.otg.BgpSrteSegmentList\x12\x11\n\x04name\x18\t \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06\x61\x63tive\x18\n \x01(\x08H\x01\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_active\"\xb8\x01\n\x12\x42gpGracefulRestart\x12\x16\n\tenable_gr\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x19\n\x0crestart_time\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x18\n\x0b\x65nable_llgr\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x17\n\nstale_time\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x0c\n\n_enable_grB\x0f\n\r_restart_timeB\x0e\n\x0c_enable_llgrB\r\n\x0b_stale_time\"\xf0\x01\n\x0f\x42gpUpdateReplay\x12\x35\n\x06\x63hoice\x18\x01 \x01(\x0e\x32 .otg.BgpUpdateReplay.Choice.EnumH\x00\x88\x01\x01\x12/\n\x0fstructured_pdus\x18\x02 \x01(\x0b\x32\x16.otg.BgpStructuredPdus\x12#\n\traw_bytes\x18\x03 \x01(\x0b\x32\x10.otg.BgpRawBytes\x1a\x45\n\x06\x43hoice\";\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x13\n\x0fstructured_pdus\x10\x01\x12\r\n\traw_bytes\x10\x02\x42\t\n\x07_choice\"7\n\x0b\x42gpRawBytes\x12(\n\x07updates\x18\x01 \x03(\x0b\x32\x17.otg.BgpOneUpdateReplay\"d\n\x12\x42gpOneUpdateReplay\x12\x15\n\x08time_gap\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x19\n\x0cupdate_bytes\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x0b\n\t_time_gapB\x0f\n\r_update_bytes\"G\n\x11\x42gpStructuredPdus\x12\x32\n\x07updates\x18\x01 \x03(\x0b\x32!.otg.BgpOneStructuredUpdateReplay\"\xf7\x01\n\x1c\x42gpOneStructuredUpdateReplay\x12\x15\n\x08time_gap\x18\x01 \x01(\rH\x00\x88\x01\x01\x12+\n\x0fpath_attributes\x18\x02 \x01(\x0b\x32\x12.otg.BgpAttributes\x12\x43\n\x19traditional_unreach_nlris\x18\x03 \x03(\x0b\x32 .otg.BgpOneTraditionalNlriPrefix\x12\x41\n\x17traditional_reach_nlris\x18\x04 \x03(\x0b\x32 .otg.BgpOneTraditionalNlriPrefixB\x0b\n\t_time_gap\"\x8a\x01\n\x1b\x42gpOneTraditionalNlriPrefix\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06prefix\x18\x02 \x01(\rH\x01\x88\x01\x01\x12)\n\x07path_id\x18\x03 \x01(\x0b\x32\x18.otg.BgpNLRIPrefixPathIdB\n\n\x08_addressB\t\n\x07_prefix\"\x83\x01\n\x14\x42gpOneIpv4NLRIPrefix\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06prefix\x18\x02 \x01(\rH\x01\x88\x01\x01\x12)\n\x07path_id\x18\x03 \x01(\x0b\x32\x18.otg.BgpNLRIPrefixPathIdB\n\n\x08_addressB\t\n\x07_prefix\"\x83\x01\n\x14\x42gpOneIpv6NLRIPrefix\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06prefix\x18\x02 \x01(\rH\x01\x88\x01\x01\x12)\n\x07path_id\x18\x03 \x01(\x0b\x32\x18.otg.BgpNLRIPrefixPathIdB\n\n\x08_addressB\t\n\x07_prefix\"3\n\x13\x42gpNLRIPrefixPathId\x12\x12\n\x05value\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_value\"\x8b\x01\n\x19\x42gpIpv4SrPolicyNLRIPrefix\x12\x1a\n\rdistinguisher\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x12\n\x05\x63olor\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x15\n\x08\x65ndpoint\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x10\n\x0e_distinguisherB\x08\n\x06_colorB\x0b\n\t_endpoint\"\x8b\x01\n\x19\x42gpIpv6SrPolicyNLRIPrefix\x12\x1a\n\rdistinguisher\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x12\n\x05\x63olor\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x15\n\x08\x65ndpoint\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x10\n\x0e_distinguisherB\x08\n\x06_colorB\x0b\n\t_endpoint\"\xef\x07\n\rBgpAttributes\x12:\n\x10other_attributes\x18\x01 \x03(\x0b\x32 .otg.BgpAttributesOtherAttribute\x12\x33\n\x06origin\x18\x02 \x01(\x0e\x32\x1e.otg.BgpAttributes.Origin.EnumH\x00\x88\x01\x01\x12)\n\x07\x61s_path\x18\x03 \x01(\x0b\x32\x18.otg.BgpAttributesAsPath\x12+\n\x08\x61s4_path\x18\x04 \x01(\x0b\x32\x19.otg.BgpAttributesAs4Path\x12+\n\x08next_hop\x18\x05 \x01(\x0b\x32\x19.otg.BgpAttributesNextHop\x12J\n\x18multi_exit_discriminator\x18\x06 \x01(\x0b\x32(.otg.BgpAttributesMultiExitDiscriminator\x12;\n\x10local_preference\x18\x07 \x01(\x0b\x32!.otg.BgpAttributesLocalPreference\x12&\n\x19include_atomic_aggregator\x18\x08 \x01(\x08H\x01\x88\x01\x01\x12\x30\n\naggregator\x18\t \x01(\x0b\x32\x1c.otg.BgpAttributesAggregator\x12\x37\n\x0e\x61s4_aggregator\x18\n \x01(\x0b\x32\x1f.otg.BgpAttributesAs4Aggregator\x12.\n\tcommunity\x18\x0b \x03(\x0b\x32\x1b.otg.BgpAttributesCommunity\x12\x35\n\roriginator_id\x18\x0c \x01(\x0b\x32\x1e.otg.BgpAttributesOriginatorId\x12\x13\n\x0b\x63luster_ids\x18\r \x03(\t\x12\x37\n\x14\x65xtended_communities\x18\x0e \x03(\x0b\x32\x19.otg.BgpExtendedCommunity\x12\x43\n\x14tunnel_encapsulation\x18\x0f \x01(\x0b\x32%.otg.BgpAttributesTunnelEncapsulation\x12/\n\x08mp_reach\x18\x10 \x01(\x0b\x32\x1d.otg.BgpAttributesMpReachNlri\x12\x33\n\nmp_unreach\x18\x11 \x01(\x0b\x32\x1f.otg.BgpAttributesMpUnreachNlri\x1a\x43\n\x06Origin\"9\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03igp\x10\x01\x12\x07\n\x03\x65gp\x10\x02\x12\x0e\n\nincomplete\x10\x03\x42\t\n\x07_originB\x1c\n\x1a_include_atomic_aggregator\"\xa7\x02\n\x1b\x42gpAttributesOtherAttribute\x12\x1a\n\rflag_optional\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x1c\n\x0f\x66lag_transitive\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x19\n\x0c\x66lag_partial\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12!\n\x14\x66lag_extended_length\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x11\n\x04type\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x16\n\traw_value\x18\x06 \x01(\tH\x05\x88\x01\x01\x42\x10\n\x0e_flag_optionalB\x12\n\x10_flag_transitiveB\x0f\n\r_flag_partialB\x17\n\x15_flag_extended_lengthB\x07\n\x05_typeB\x0c\n\n_raw_value\"\xaf\x02\n\x13\x42gpAttributesAsPath\x12\x39\n\x06\x63hoice\x18\x01 \x01(\x0e\x32$.otg.BgpAttributesAsPath.Choice.EnumH\x00\x88\x01\x01\x12\x41\n\x11\x66our_byte_as_path\x18\x02 \x01(\x0b\x32&.otg.BgpAttributesAsPathFourByteAsPath\x12?\n\x10two_byte_as_path\x18\x03 \x01(\x0b\x32%.otg.BgpAttributesAsPathTwoByteAsPath\x1aN\n\x06\x43hoice\"D\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x15\n\x11\x66our_byte_as_path\x10\x01\x12\x14\n\x10two_byte_as_path\x10\x02\x42\t\n\x07_choice\"^\n!BgpAttributesAsPathFourByteAsPath\x12\x39\n\x08segments\x18\x01 \x03(\x0b\x32\'.otg.BgpAttributesFourByteAsPathSegment\"\xe6\x01\n\"BgpAttributesFourByteAsPathSegment\x12\x44\n\x04type\x18\x01 \x01(\x0e\x32\x31.otg.BgpAttributesFourByteAsPathSegment.Type.EnumH\x00\x88\x01\x01\x12\x12\n\nas_numbers\x18\x02 \x03(\r\x1a]\n\x04Type\"U\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x61s_seq\x10\x01\x12\n\n\x06\x61s_set\x10\x02\x12\x11\n\ras_confed_seq\x10\x03\x12\x11\n\ras_confed_set\x10\x04\x42\x07\n\x05_type\"\\\n BgpAttributesAsPathTwoByteAsPath\x12\x38\n\x08segments\x18\x01 \x03(\x0b\x32&.otg.BgpAttributesTwoByteAsPathSegment\"\xe4\x01\n!BgpAttributesTwoByteAsPathSegment\x12\x43\n\x04type\x18\x01 \x01(\x0e\x32\x30.otg.BgpAttributesTwoByteAsPathSegment.Type.EnumH\x00\x88\x01\x01\x12\x12\n\nas_numbers\x18\x02 \x03(\r\x1a]\n\x04Type\"U\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x61s_seq\x10\x01\x12\n\n\x06\x61s_set\x10\x02\x12\x11\n\ras_confed_seq\x10\x03\x12\x11\n\ras_confed_set\x10\x04\x42\x07\n\x05_type\"Q\n\x14\x42gpAttributesAs4Path\x12\x39\n\x08segments\x18\x01 \x03(\x0b\x32\'.otg.BgpAttributesFourByteAsPathSegment\"\xab\x02\n\x17\x42gpAttributesAggregator\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.BgpAttributesAggregator.Choice.EnumH\x00\x88\x01\x01\x12\x19\n\x0c\x66our_byte_as\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x18\n\x0btwo_byte_as\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x19\n\x0cipv4_address\x18\x04 \x01(\tH\x03\x88\x01\x01\x1a\x44\n\x06\x43hoice\":\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0c\x66our_byte_as\x10\x01\x12\x0f\n\x0btwo_byte_as\x10\x02\x42\t\n\x07_choiceB\x0f\n\r_four_byte_asB\x0e\n\x0c_two_byte_asB\x0f\n\r_ipv4_address\"h\n\x1a\x42gpAttributesAs4Aggregator\x12\x13\n\x06\x61s_num\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x19\n\x0cipv4_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\t\n\x07_as_numB\x0f\n\r_ipv4_address\"\xb1\x02\n\x16\x42gpAttributesCommunity\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.BgpAttributesCommunity.Choice.EnumH\x00\x88\x01\x01\x12;\n\x10\x63ustom_community\x18\x02 \x01(\x0b\x32!.otg.BgpAttributesCustomCommunity\x1a\x90\x01\n\x06\x43hoice\"\x85\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x14\n\x10\x63ustom_community\x10\x01\x12\r\n\tno_export\x10\x02\x12\x11\n\rno_advertised\x10\x03\x12\x17\n\x13no_export_subconfed\x10\x04\x12\x0e\n\nllgr_stale\x10\x05\x12\x0b\n\x07no_llgr\x10\x06\x42\t\n\x07_choice\"d\n\x1c\x42gpAttributesCustomCommunity\x12\x16\n\tas_number\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x0c\n\n_as_numberB\t\n\x07_custom\"\xab\x02\n\x14\x42gpAttributesNextHop\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.BgpAttributesNextHop.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04ipv4\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x11\n\x04ipv6\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x45\n\x12ipv6_two_addresses\x18\x04 \x01(\x0b\x32).otg.BgpAttributesNextHopIpv6TwoAddresses\x1aM\n\x06\x43hoice\"C\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x12\x16\n\x12ipv6_two_addresses\x10\x03\x42\t\n\x07_choiceB\x07\n\x05_ipv4B\x07\n\x05_ipv6\"d\n$BgpAttributesNextHopIpv6TwoAddresses\x12\x12\n\x05\x66irst\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06second\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x08\n\x06_firstB\t\n\x07_second\"\xcf\x03\n\x18\x42gpAttributesMpReachNlri\x12+\n\x08next_hop\x18\x01 \x01(\x0b\x32\x19.otg.BgpAttributesNextHop\x12>\n\x06\x63hoice\x18\x02 \x01(\x0e\x32).otg.BgpAttributesMpReachNlri.Choice.EnumH\x00\x88\x01\x01\x12/\n\x0cipv4_unicast\x18\x03 \x03(\x0b\x32\x19.otg.BgpOneIpv4NLRIPrefix\x12/\n\x0cipv6_unicast\x18\x04 \x03(\x0b\x32\x19.otg.BgpOneIpv6NLRIPrefix\x12\x35\n\ripv4_srpolicy\x18\x05 \x01(\x0b\x32\x1e.otg.BgpIpv4SrPolicyNLRIPrefix\x12\x35\n\ripv6_srpolicy\x18\x06 \x01(\x0b\x32\x1e.otg.BgpIpv6SrPolicyNLRIPrefix\x1ak\n\x06\x43hoice\"a\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0cipv4_unicast\x10\x01\x12\x10\n\x0cipv6_unicast\x10\x02\x12\x11\n\ripv4_srpolicy\x10\x03\x12\x11\n\ripv6_srpolicy\x10\x04\x42\t\n\x07_choice\"\xa6\x03\n\x1a\x42gpAttributesMpUnreachNlri\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.BgpAttributesMpUnreachNlri.Choice.EnumH\x00\x88\x01\x01\x12/\n\x0cipv4_unicast\x18\x02 \x03(\x0b\x32\x19.otg.BgpOneIpv4NLRIPrefix\x12/\n\x0cipv6_unicast\x18\x03 \x03(\x0b\x32\x19.otg.BgpOneIpv6NLRIPrefix\x12\x35\n\ripv4_srpolicy\x18\x04 \x01(\x0b\x32\x1e.otg.BgpIpv4SrPolicyNLRIPrefix\x12\x35\n\ripv6_srpolicy\x18\x05 \x01(\x0b\x32\x1e.otg.BgpIpv6SrPolicyNLRIPrefix\x1ak\n\x06\x43hoice\"a\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0cipv4_unicast\x10\x01\x12\x10\n\x0cipv6_unicast\x10\x02\x12\x11\n\ripv4_srpolicy\x10\x03\x12\x11\n\ripv6_srpolicy\x10\x04\x42\t\n\x07_choice\"C\n#BgpAttributesMultiExitDiscriminator\x12\x12\n\x05value\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_value\"<\n\x1c\x42gpAttributesLocalPreference\x12\x12\n\x05value\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_value\"9\n\x19\x42gpAttributesOriginatorId\x12\x12\n\x05value\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_value\"\xe2\x01\n BgpAttributesTunnelEncapsulation\x12\x46\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x31.otg.BgpAttributesTunnelEncapsulation.Choice.EnumH\x00\x88\x01\x01\x12\x39\n\tsr_policy\x18\x02 \x01(\x0b\x32&.otg.BgpAttributesSegmentRoutingPolicy\x1a\x30\n\x06\x43hoice\"&\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tsr_policy\x10\x01\x42\t\n\x07_choice\"\xac\x04\n!BgpAttributesSegmentRoutingPolicy\x12:\n\x1a\x62inding_segment_identifier\x18\x01 \x01(\x0b\x32\x16.otg.BgpAttributesBsid\x12\x43\n\x1fsrv6_binding_segment_identifier\x18\x02 \x03(\x0b\x32\x1a.otg.BgpAttributesSrv6Bsid\x12\x38\n\npreference\x18\x03 \x01(\x0b\x32$.otg.BgpAttributesSrPolicyPreference\x12\x34\n\x08priority\x18\x04 \x01(\x0b\x32\".otg.BgpAttributesSrPolicyPriority\x12\x39\n\x0bpolicy_name\x18\x05 \x01(\x0b\x32$.otg.BgpAttributesSrPolicyPolicyName\x12L\n\x15policy_candidate_name\x18\x06 \x01(\x0b\x32-.otg.BgpAttributesSrPolicyPolicyCandidateName\x12P\n\x1a\x65xplicit_null_label_policy\x18\x07 \x01(\x0b\x32,.otg.BgpAttributesSrPolicyExplicitNullPolicy\x12;\n\x0csegment_list\x18\x08 \x03(\x0b\x32%.otg.BgpAttributesSrPolicySegmentList\"\xe2\x01\n\x11\x42gpAttributesBsid\x12\x37\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\".otg.BgpAttributesBsid.Choice.EnumH\x00\x88\x01\x01\x12(\n\x04mpls\x18\x02 \x01(\x0b\x32\x1a.otg.BgpAttributesBsidMpls\x12(\n\x04srv6\x18\x03 \x01(\x0b\x32\x1a.otg.BgpAttributesBsidSrv6\x1a\x35\n\x06\x43hoice\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04mpls\x10\x01\x12\x08\n\x04srv6\x10\x02\x42\t\n\x07_choice\"\xc8\x01\n\x15\x42gpAttributesBsidMpls\x12%\n\x18\x66lag_specified_bsid_only\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12#\n\x16\x66lag_drop_upon_invalid\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12+\n\x08mpls_sid\x18\x03 \x01(\x0b\x32\x19.otg.BgpAttributesSidMplsB\x1b\n\x19_flag_specified_bsid_onlyB\x19\n\x17_flag_drop_upon_invalid\"\xc1\x01\n\x15\x42gpAttributesBsidSrv6\x12%\n\x18\x66lag_specified_bsid_only\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12#\n\x16\x66lag_drop_upon_invalid\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x16\n\tipv6_addr\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x1b\n\x19_flag_specified_bsid_onlyB\x19\n\x17_flag_drop_upon_invalidB\x0c\n\n_ipv6_addr\"\xf6\x02\n\x15\x42gpAttributesSrv6Bsid\x12%\n\x18\x66lag_specified_bsid_only\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12#\n\x16\x66lag_drop_upon_invalid\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12(\n\x1b\x66lag_srv6_endpoint_behavior\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x16\n\tipv6_addr\x18\x04 \x01(\tH\x03\x88\x01\x01\x12i\n\x16srv6_endpoint_behavior\x18\x05 \x01(\x0b\x32I.otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructureB\x1b\n\x19_flag_specified_bsid_onlyB\x19\n\x17_flag_drop_upon_invalidB\x1e\n\x1c_flag_srv6_endpoint_behaviorB\x0c\n\n_ipv6_addr\"\xa0\x01\n\x14\x42gpAttributesSidMpls\x12\x12\n\x05label\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1a\n\rtraffic_class\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x15\n\x08\x66lag_bos\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x10\n\x03ttl\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x08\n\x06_labelB\x10\n\x0e_traffic_classB\x0b\n\t_flag_bosB\x06\n\x04_ttl\".\n\x14\x42gpAttributesSidSrv6\x12\x0f\n\x02ip\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x05\n\x03_ip\"?\n\x1f\x42gpAttributesSrPolicyPreference\x12\x12\n\x05value\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_value\"=\n\x1d\x42gpAttributesSrPolicyPriority\x12\x12\n\x05value\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_value\"H\n(BgpAttributesSrPolicyPolicyCandidateName\x12\x12\n\x05value\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_value\"?\n\x1f\x42gpAttributesSrPolicyPolicyName\x12\x12\n\x05value\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_value\"\xf9\x01\n\'BgpAttributesSrPolicyExplicitNullPolicy\x12M\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x38.otg.BgpAttributesSrPolicyExplicitNullPolicy.Choice.EnumH\x00\x88\x01\x01\x1at\n\x06\x43hoice\"j\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07unknown\x10\x01\x12\r\n\tpush_ipv4\x10\x02\x12\r\n\tpush_ipv6\x10\x03\x12\x16\n\x12push_ipv4_and_ipv6\x10\x04\x12\x0e\n\ndonot_push\x10\x05\x42\t\n\x07_choice\"\xb7\x01\n BgpAttributesSrPolicySegmentList\x12G\n\x06weight\x18\x01 \x01(\x0b\x32\x37.otg.BgpAttributesSegmentRoutingPolicySegmentListWeight\x12J\n\x08segments\x18\x02 \x03(\x0b\x32\x38.otg.BgpAttributesSegmentRoutingPolicySegmentListSegment\"R\n2BgpAttributesSegmentRoutingPolicySegmentListWeight\x12\x12\n\x05value\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_value\"\xe3\x07\n3BgpAttributesSegmentRoutingPolicySegmentListSegment\x12Y\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x44.otg.BgpAttributesSegmentRoutingPolicySegmentListSegment.Choice.EnumH\x00\x88\x01\x01\x12;\n\x06type_a\x18\x02 \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeA\x12;\n\x06type_b\x18\x03 \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeB\x12;\n\x06type_c\x18\x04 \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeC\x12;\n\x06type_d\x18\x05 \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeD\x12;\n\x06type_e\x18\x06 \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeE\x12;\n\x06type_f\x18\x07 \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeF\x12;\n\x06type_g\x18\x08 \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeG\x12;\n\x06type_h\x18\t \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeH\x12;\n\x06type_i\x18\n \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeI\x12;\n\x06type_j\x18\x0b \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeJ\x12;\n\x06type_k\x18\x0c \x01(\x0b\x32+.otg.BgpAttributesSegmentRoutingPolicyTypeK\x1a\xa6\x01\n\x06\x43hoice\"\x9b\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06type_a\x10\x01\x12\n\n\x06type_b\x10\x02\x12\n\n\x06type_c\x10\x03\x12\n\n\x06type_d\x10\x04\x12\n\n\x06type_e\x10\x05\x12\n\n\x06type_f\x10\x06\x12\n\n\x06type_g\x10\x07\x12\n\n\x06type_h\x10\x08\x12\n\n\x06type_i\x10\t\x12\n\n\x06type_j\x10\n\x12\n\n\x06type_k\x10\x0b\x42\t\n\x07_choice\"\x95\x01\n&BgpAttributesSegmentRoutingPolicyTypeA\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12+\n\x08mpls_sid\x18\x02 \x01(\x0b\x32\x19.otg.BgpAttributesSidMpls\"\xf7\x01\n&BgpAttributesSegmentRoutingPolicyTypeB\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x15\n\x08srv6_sid\x18\x02 \x01(\tH\x00\x88\x01\x01\x12i\n\x16srv6_endpoint_behavior\x18\x03 \x01(\x0b\x32I.otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructureB\x0b\n\t_srv6_sid\"\xfa\x01\n&BgpAttributesSegmentRoutingPolicyTypeC\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11ipv4_node_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12.\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x19.otg.BgpAttributesSidMplsB\x0f\n\r_sr_algorithmB\x14\n\x12_ipv4_node_address\"\xfa\x01\n&BgpAttributesSegmentRoutingPolicyTypeD\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11ipv6_node_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12.\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x19.otg.BgpAttributesSidMplsB\x0f\n\r_sr_algorithmB\x14\n\x12_ipv6_node_address\"\x86\x02\n&BgpAttributesSegmentRoutingPolicyTypeE\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x1f\n\x12local_interface_id\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11ipv4_node_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12.\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x19.otg.BgpAttributesSidMplsB\x15\n\x13_local_interface_idB\x14\n\x12_ipv4_node_address\"\x8a\x02\n&BgpAttributesSegmentRoutingPolicyTypeF\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x1f\n\x12local_ipv4_address\x18\x02 \x01(\tH\x00\x88\x01\x01\x12 \n\x13remote_ipv4_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12.\n\x0bsr_mpls_sid\x18\x04 \x01(\x0b\x32\x19.otg.BgpAttributesSidMplsB\x15\n\x13_local_ipv4_addressB\x16\n\x14_remote_ipv4_address\"\x90\x03\n&BgpAttributesSegmentRoutingPolicyTypeG\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x1f\n\x12local_interface_id\x18\x02 \x01(\rH\x00\x88\x01\x01\x12$\n\x17local_ipv6_node_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12 \n\x13remote_interface_id\x18\x04 \x01(\rH\x02\x88\x01\x01\x12%\n\x18remote_ipv6_node_address\x18\x05 \x01(\tH\x03\x88\x01\x01\x12.\n\x0bsr_mpls_sid\x18\x06 \x01(\x0b\x32\x19.otg.BgpAttributesSidMplsB\x15\n\x13_local_interface_idB\x1a\n\x18_local_ipv6_node_addressB\x16\n\x14_remote_interface_idB\x1b\n\x19_remote_ipv6_node_address\"\x8a\x02\n&BgpAttributesSegmentRoutingPolicyTypeH\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x1f\n\x12local_ipv6_address\x18\x02 \x01(\tH\x00\x88\x01\x01\x12 \n\x13remote_ipv6_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12.\n\x0bsr_mpls_sid\x18\x06 \x01(\x0b\x32\x19.otg.BgpAttributesSidMplsB\x15\n\x13_local_ipv6_addressB\x16\n\x14_remote_ipv6_address\"\xe2\x02\n&BgpAttributesSegmentRoutingPolicyTypeI\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11ipv6_node_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12+\n\x08srv6_sid\x18\x04 \x01(\x0b\x32\x19.otg.BgpAttributesSidSrv6\x12i\n\x16srv6_endpoint_behavior\x18\x05 \x01(\x0b\x32I.otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructureB\x0f\n\r_sr_algorithmB\x14\n\x12_ipv6_node_address\"\xa4\x04\n&BgpAttributesSegmentRoutingPolicyTypeJ\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1f\n\x12local_interface_id\x18\x03 \x01(\rH\x01\x88\x01\x01\x12$\n\x17local_ipv6_node_address\x18\x04 \x01(\tH\x02\x88\x01\x01\x12 \n\x13remote_interface_id\x18\x05 \x01(\rH\x03\x88\x01\x01\x12%\n\x18remote_ipv6_node_address\x18\x06 \x01(\tH\x04\x88\x01\x01\x12+\n\x08srv6_sid\x18\x07 \x01(\x0b\x32\x19.otg.BgpAttributesSidSrv6\x12i\n\x16srv6_endpoint_behavior\x18\x08 \x01(\x0b\x32I.otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructureB\x0f\n\r_sr_algorithmB\x15\n\x13_local_interface_idB\x1a\n\x18_local_ipv6_node_addressB\x16\n\x14_remote_interface_idB\x1b\n\x19_remote_ipv6_node_address\"\x9e\x03\n&BgpAttributesSegmentRoutingPolicyTypeK\x12>\n\x05\x66lags\x18\x01 \x01(\x0b\x32/.otg.BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x19\n\x0csr_algorithm\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1f\n\x12local_ipv6_address\x18\x03 \x01(\tH\x01\x88\x01\x01\x12 \n\x13remote_ipv6_address\x18\x04 \x01(\tH\x02\x88\x01\x01\x12+\n\x08srv6_sid\x18\x05 \x01(\x0b\x32\x19.otg.BgpAttributesSidSrv6\x12i\n\x16srv6_endpoint_behavior\x18\x06 \x01(\x0b\x32I.otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructureB\x0f\n\r_sr_algorithmB\x15\n\x13_local_ipv6_addressB\x16\n\x14_remote_ipv6_address\"\xac\x01\n*BgpAttributesSegmentRoutingPolicyTypeFlags\x12\x13\n\x06v_flag\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x13\n\x06\x61_flag\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x13\n\x06s_flag\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x13\n\x06\x62_flag\x18\x04 \x01(\x08H\x03\x88\x01\x01\x42\t\n\x07_v_flagB\t\n\x07_a_flagB\t\n\x07_s_flagB\t\n\x07_b_flag\"\x9c\x02\nDBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure\x12\x1f\n\x12\x65ndpoint_behaviour\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x16\n\tlb_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\tln_length\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x18\n\x0b\x66unc_length\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x17\n\narg_length\x18\x05 \x01(\rH\x04\x88\x01\x01\x42\x15\n\x13_endpoint_behaviourB\x0c\n\n_lb_lengthB\x0c\n\n_ln_lengthB\x0e\n\x0c_func_lengthB\r\n\x0b_arg_length\"H\n(BgpNLRIPrefixSegmentRoutingDistinguisher\x12\x12\n\x05value\x18\x01 \x01(\rH\x00\x88\x01\x01\x42\x08\n\x06_value\"\x93\x07\n\tBgpV6Peer\x12\x19\n\x0cpeer_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x31\n\x0fsegment_routing\x18\x02 \x01(\x0b\x32\x18.otg.BgpV6SegmentRouting\x12\x39\n\x16\x65vpn_ethernet_segments\x18\x03 \x03(\x0b\x32\x19.otg.BgpV6EthernetSegment\x12\x30\n\x07\x61s_type\x18\x04 \x01(\x0e\x32\x1a.otg.BgpV6Peer.AsType.EnumH\x01\x88\x01\x01\x12\x16\n\tas_number\x18\x05 \x01(\rH\x02\x88\x01\x01\x12?\n\x0f\x61s_number_width\x18\x06 \x01(\x0e\x32!.otg.BgpV6Peer.AsNumberWidth.EnumH\x03\x88\x01\x01\x12\"\n\x08\x61\x64vanced\x18\x07 \x01(\x0b\x32\x10.otg.BgpAdvanced\x12&\n\ncapability\x18\x08 \x01(\x0b\x32\x12.otg.BgpCapability\x12\x44\n\x1alearned_information_filter\x18\t \x01(\x0b\x32 .otg.BgpLearnedInformationFilter\x12\'\n\tv4_routes\x18\n \x03(\x0b\x32\x14.otg.BgpV4RouteRange\x12\'\n\tv6_routes\x18\x0b \x03(\x0b\x32\x14.otg.BgpV6RouteRange\x12.\n\x10v4_srte_policies\x18\x0c \x03(\x0b\x32\x14.otg.BgpSrteV4Policy\x12.\n\x10v6_srte_policies\x18\r \x03(\x0b\x32\x14.otg.BgpSrteV6Policy\x12\x11\n\x04name\x18\x0e \x01(\tH\x04\x88\x01\x01\x12\x31\n\x10graceful_restart\x18\x0f \x01(\x0b\x32\x17.otg.BgpGracefulRestart\x12,\n\x0ereplay_updates\x18\x10 \x01(\x0b\x32\x14.otg.BgpUpdateReplay\x1a\x35\n\x06\x41sType\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ibgp\x10\x01\x12\x08\n\x04\x65\x62gp\x10\x02\x1a;\n\rAsNumberWidth\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03two\x10\x01\x12\x08\n\x04\x66our\x10\x02\x42\x0f\n\r_peer_addressB\n\n\x08_as_typeB\x0c\n\n_as_numberB\x12\n\x10_as_number_widthB\x07\n\x05_name\"U\n\x0e\x42gpV6Interface\x12\x16\n\tipv6_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1d\n\x05peers\x18\x02 \x03(\x0b\x32\x0e.otg.BgpV6PeerB\x0c\n\n_ipv6_name\"\xf1\x03\n\x13\x42gpV6SegmentRouting\x12!\n\x14ingress_supports_vpn\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\"\n\x15reduced_encapsulation\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x1e\n\x11\x63opy_time_to_live\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x19\n\x0ctime_to_live\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1d\n\x10max_sids_per_srh\x18\x05 \x01(\rH\x04\x88\x01\x01\x12-\n auto_generate_segment_left_value\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x1f\n\x12segment_left_value\x18\x07 \x01(\rH\x06\x88\x01\x01\x12#\n\x16\x61\x64vertise_sr_te_policy\x18\x08 \x01(\x08H\x07\x88\x01\x01\x42\x17\n\x15_ingress_supports_vpnB\x18\n\x16_reduced_encapsulationB\x14\n\x12_copy_time_to_liveB\x0f\n\r_time_to_liveB\x13\n\x11_max_sids_per_srhB#\n!_auto_generate_segment_left_valueB\x15\n\x13_segment_left_valueB\x19\n\x17_advertise_sr_te_policy\"\xf0\x03\n\x14\x42gpV6EthernetSegment\x12\x36\n\x0b\x64\x66_election\x18\x01 \x01(\x0b\x32!.otg.BgpEthernetSegmentDfElection\x12 \n\x04\x65vis\x18\x02 \x03(\x0b\x32\x12.otg.BgpV6EvpnEvis\x12\x10\n\x03\x65si\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x43\n\x0b\x61\x63tive_mode\x18\x04 \x01(\x0e\x32).otg.BgpV6EthernetSegment.ActiveMode.EnumH\x01\x88\x01\x01\x12\x16\n\tesi_label\x18\x05 \x01(\rH\x02\x88\x01\x01\x12\'\n\x08\x61\x64vanced\x18\x06 \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12&\n\x0b\x63ommunities\x18\x07 \x03(\x0b\x32\x11.otg.BgpCommunity\x12-\n\x0f\x65xt_communities\x18\x08 \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12\x1f\n\x07\x61s_path\x18\t \x01(\x0b\x32\x0e.otg.BgpAsPath\x1aH\n\nActiveMode\":\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rsingle_active\x10\x01\x12\x0e\n\nall_active\x10\x02\x42\x06\n\x04_esiB\x0e\n\x0c_active_modeB\x0c\n\n_esi_label\"\xa8\x01\n\rBgpV6EvpnEvis\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.BgpV6EvpnEvis.Choice.EnumH\x00\x88\x01\x01\x12%\n\tevi_vxlan\x18\x02 \x01(\x0b\x32\x12.otg.BgpV6EviVxlan\x1a\x30\n\x06\x43hoice\"&\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tevi_vxlan\x10\x01\x42\t\n\x07_choice\"\xe3\x05\n\rBgpV6EviVxlan\x12<\n\x11\x62roadcast_domains\x18\x01 \x03(\x0b\x32!.otg.BgpV6EviVxlanBroadcastDomain\x12\x46\n\x10replication_type\x18\x02 \x01(\x0e\x32\'.otg.BgpV6EviVxlan.ReplicationType.EnumH\x00\x88\x01\x01\x12\x17\n\npmsi_label\x18\x03 \x01(\rH\x01\x88\x01\x01\x12\x15\n\x08\x61\x64_label\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x37\n\x13route_distinguisher\x18\x05 \x01(\x0b\x32\x1a.otg.BgpRouteDistinguisher\x12\x30\n\x13route_target_export\x18\x06 \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\x30\n\x13route_target_import\x18\x07 \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\x33\n\x16l3_route_target_export\x18\x08 \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\x33\n\x16l3_route_target_import\x18\t \x03(\x0b\x32\x13.otg.BgpRouteTarget\x12\'\n\x08\x61\x64vanced\x18\n \x01(\x0b\x32\x15.otg.BgpRouteAdvanced\x12&\n\x0b\x63ommunities\x18\x0b \x03(\x0b\x32\x11.otg.BgpCommunity\x12-\n\x0f\x65xt_communities\x18\x0c \x03(\x0b\x32\x14.otg.BgpExtCommunity\x12\x1f\n\x07\x61s_path\x18\r \x01(\x0b\x32\x0e.otg.BgpAsPath\x1a\x43\n\x0fReplicationType\"0\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x17\n\x13ingress_replication\x10\x01\x42\x13\n\x11_replication_typeB\r\n\x0b_pmsi_labelB\x0b\n\t_ad_label\"\xb4\x01\n\x1c\x42gpV6EviVxlanBroadcastDomain\x12*\n\rcmac_ip_range\x18\x01 \x03(\x0b\x32\x13.otg.BgpCMacIpRange\x12\x1c\n\x0f\x65thernet_tag_id\x18\x02 \x01(\rH\x00\x88\x01\x01\x12\x1f\n\x12vlan_aware_service\x18\x03 \x01(\x08H\x01\x88\x01\x01\x42\x12\n\x10_ethernet_tag_idB\x15\n\x13_vlan_aware_service\"]\n\x0b\x44\x65viceVxlan\x12&\n\nv4_tunnels\x18\x01 \x03(\x0b\x32\x12.otg.VxlanV4Tunnel\x12&\n\nv6_tunnels\x18\x02 \x03(\x0b\x32\x12.otg.VxlanV6Tunnel\"\xbb\x01\n\rVxlanV4Tunnel\x12\x1d\n\x10source_interface\x18\x01 \x01(\tH\x00\x88\x01\x01\x12@\n\x13\x64\x65stination_ip_mode\x18\x02 \x01(\x0b\x32#.otg.VxlanV4TunnelDestinationIPMode\x12\x10\n\x03vni\x18\x03 \x01(\rH\x01\x88\x01\x01\x12\x11\n\x04name\x18\x04 \x01(\tH\x02\x88\x01\x01\x42\x13\n\x11_source_interfaceB\x06\n\x04_vniB\x07\n\x05_name\"\xbb\x01\n\rVxlanV6Tunnel\x12\x1d\n\x10source_interface\x18\x01 \x01(\tH\x00\x88\x01\x01\x12@\n\x13\x64\x65stination_ip_mode\x18\x02 \x01(\x0b\x32#.otg.VxlanV6TunnelDestinationIPMode\x12\x10\n\x03vni\x18\x03 \x01(\rH\x01\x88\x01\x01\x12\x11\n\x04name\x18\x04 \x01(\tH\x02\x88\x01\x01\x42\x13\n\x11_source_interfaceB\x06\n\x04_vniB\x07\n\x05_name\"\xae\x02\n\x1eVxlanV4TunnelDestinationIPMode\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.VxlanV4TunnelDestinationIPMode.Choice.EnumH\x00\x88\x01\x01\x12;\n\x07unicast\x18\x02 \x01(\x0b\x32*.otg.VxlanV4TunnelDestinationIPModeUnicast\x12?\n\tmulticast\x18\x03 \x01(\x0b\x32,.otg.VxlanV4TunnelDestinationIPModeMulticast\x1a=\n\x06\x43hoice\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07unicast\x10\x01\x12\r\n\tmulticast\x10\x02\x42\t\n\x07_choice\"\xae\x02\n\x1eVxlanV6TunnelDestinationIPMode\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.VxlanV6TunnelDestinationIPMode.Choice.EnumH\x00\x88\x01\x01\x12;\n\x07unicast\x18\x02 \x01(\x0b\x32*.otg.VxlanV6TunnelDestinationIPModeUnicast\x12?\n\tmulticast\x18\x03 \x01(\x0b\x32,.otg.VxlanV6TunnelDestinationIPModeMulticast\x1a=\n\x06\x43hoice\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07unicast\x10\x01\x12\r\n\tmulticast\x10\x02\x42\t\n\x07_choice\"f\n%VxlanV4TunnelDestinationIPModeUnicast\x12=\n\x05vteps\x18\x01 \x03(\x0b\x32..otg.VxlanV4TunnelDestinationIPModeUnicastVtep\"f\n%VxlanV6TunnelDestinationIPModeUnicast\x12=\n\x05vteps\x18\x01 \x03(\x0b\x32..otg.VxlanV6TunnelDestinationIPModeUnicastVtep\"\x96\x01\n6VxlanTunnelDestinationIPModeUnicastArpSuppressionCache\x12\x1a\n\rremote_vm_mac\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1b\n\x0eremote_vm_ipv4\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x10\n\x0e_remote_vm_macB\x11\n\x0f_remote_vm_ipv4\"\xc1\x01\n)VxlanV4TunnelDestinationIPModeUnicastVtep\x12 \n\x13remote_vtep_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12Z\n\x15\x61rp_suppression_cache\x18\x02 \x03(\x0b\x32;.otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCacheB\x16\n\x14_remote_vtep_address\"\xc1\x01\n)VxlanV6TunnelDestinationIPModeUnicastVtep\x12 \n\x13remote_vtep_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12Z\n\x15\x61rp_suppression_cache\x18\x02 \x03(\x0b\x32;.otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCacheB\x16\n\x14_remote_vtep_address\"K\n\'VxlanV4TunnelDestinationIPModeMulticast\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\n\n\x08_address\"K\n\'VxlanV6TunnelDestinationIPModeMulticast\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\n\n\x08_address\"\x91\x01\n\nDeviceRsvp\x12/\n\x0fipv4_interfaces\x18\x01 \x03(\x0b\x32\x16.otg.RsvpIpv4Interface\x12\x36\n\x13lsp_ipv4_interfaces\x18\x02 \x03(\x0b\x32\x19.otg.RsvpLspIpv4Interface\x12\x11\n\x04name\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\x07\n\x05_name\"\xc5\x04\n\x11RsvpIpv4Interface\x12\x16\n\tipv4_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0bneighbor_ip\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1e\n\x11label_space_start\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x1c\n\x0flabel_space_end\x18\x04 \x01(\rH\x03\x88\x01\x01\x12%\n\x18\x65nable_refresh_reduction\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12%\n\x18summary_refresh_interval\x18\x06 \x01(\rH\x05\x88\x01\x01\x12\x18\n\x0bsend_bundle\x18\x07 \x01(\x08H\x06\x88\x01\x01\x12\x1d\n\x10\x62undle_threshold\x18\x08 \x01(\rH\x07\x88\x01\x01\x12\x19\n\x0c\x65nable_hello\x18\t \x01(\x08H\x08\x88\x01\x01\x12\x1b\n\x0ehello_interval\x18\n \x01(\rH\t\x88\x01\x01\x12\x1f\n\x12timeout_multiplier\x18\x0b \x01(\rH\n\x88\x01\x01\x42\x0c\n\n_ipv4_nameB\x0e\n\x0c_neighbor_ipB\x14\n\x12_label_space_startB\x12\n\x10_label_space_endB\x1b\n\x19_enable_refresh_reductionB\x1b\n\x19_summary_refresh_intervalB\x0e\n\x0c_send_bundleB\x13\n\x11_bundle_thresholdB\x0f\n\r_enable_helloB\x11\n\x0f_hello_intervalB\x15\n\x13_timeout_multiplier\"\xd0\x01\n\x14RsvpLspIpv4Interface\x12\x16\n\tipv4_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12G\n\x14p2p_egress_ipv4_lsps\x18\x02 \x01(\x0b\x32).otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp\x12I\n\x15p2p_ingress_ipv4_lsps\x18\x03 \x03(\x0b\x32*.otg.RsvpLspIpv4InterfaceP2PIngressIpv4LspB\x0c\n\n_ipv4_name\"\xf1\x03\n$RsvpLspIpv4InterfaceP2PEgressIpv4Lsp\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1d\n\x10refresh_interval\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1f\n\x12timeout_multiplier\x18\x03 \x01(\rH\x02\x88\x01\x01\x12_\n\x11reservation_style\x18\x04 \x01(\x0e\x32?.otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp.ReservationStyle.EnumH\x03\x88\x01\x01\x12\x1f\n\x12\x65nable_fixed_label\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x1e\n\x11\x66ixed_label_value\x18\x06 \x01(\rH\x05\x88\x01\x01\x1a\\\n\x10ReservationStyle\"H\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x13\n\x0fshared_explicit\x10\x01\x12\x10\n\x0c\x66ixed_filter\x10\x02\x12\x08\n\x04\x61uto\x10\x03\x42\x07\n\x05_nameB\x13\n\x11_refresh_intervalB\x15\n\x13_timeout_multiplierB\x14\n\x12_reservation_styleB\x15\n\x13_enable_fixed_labelB\x14\n\x12_fixed_label_value\"\xab\x04\n%RsvpLspIpv4InterfaceP2PIngressIpv4Lsp\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1b\n\x0eremote_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x16\n\ttunnel_id\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x13\n\x06lsp_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1d\n\x10refresh_interval\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x1f\n\x12timeout_multiplier\x18\x06 \x01(\rH\x05\x88\x01\x01\x12\x1a\n\rbackup_lsp_id\x18\x07 \x01(\rH\x06\x88\x01\x01\x12!\n\x14lsp_switchover_delay\x18\x08 \x01(\rH\x07\x88\x01\x01\x12\x34\n\x11session_attribute\x18\t \x01(\x0b\x32\x19.otg.RsvpSessionAttribute\x12\x1d\n\x05tspec\x18\n \x01(\x0b\x32\x0e.otg.RsvpTspec\x12*\n\x0c\x66\x61st_reroute\x18\x0b \x01(\x0b\x32\x14.otg.RsvpFastReroute\x12\x19\n\x03\x65ro\x18\x0c \x01(\x0b\x32\x0c.otg.RsvpEroB\x07\n\x05_nameB\x11\n\x0f_remote_addressB\x0c\n\n_tunnel_idB\t\n\x07_lsp_idB\x13\n\x11_refresh_intervalB\x15\n\x13_timeout_multiplierB\x10\n\x0e_backup_lsp_idB\x17\n\x15_lsp_switchover_delay\"\xf0\x04\n\x14RsvpSessionAttribute\x12\'\n\x1a\x61uto_generate_session_name\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x19\n\x0csession_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1b\n\x0esetup_priority\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x1d\n\x10holding_priority\x18\x04 \x01(\rH\x03\x88\x01\x01\x12%\n\x18local_protection_desired\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12$\n\x17label_recording_desired\x18\x06 \x01(\x08H\x05\x88\x01\x01\x12\x1d\n\x10se_style_desired\x18\x07 \x01(\x08H\x06\x88\x01\x01\x12)\n\x1c\x62\x61ndwidth_protection_desired\x18\x08 \x01(\x08H\x07\x88\x01\x01\x12$\n\x17node_protection_desired\x18\t \x01(\x08H\x08\x88\x01\x01\x12\x38\n\x13resource_affinities\x18\n \x01(\x0b\x32\x1b.otg.RsvpResourceAffinitiesB\x1d\n\x1b_auto_generate_session_nameB\x0f\n\r_session_nameB\x11\n\x0f_setup_priorityB\x13\n\x11_holding_priorityB\x1b\n\x19_local_protection_desiredB\x1a\n\x18_label_recording_desiredB\x13\n\x11_se_style_desiredB\x1f\n\x1d_bandwidth_protection_desiredB\x1a\n\x18_node_protection_desired\"\x96\x01\n\x16RsvpResourceAffinities\x12\x18\n\x0b\x65xclude_any\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0binclude_any\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0binclude_all\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x0e\n\x0c_exclude_anyB\x0e\n\x0c_include_anyB\x0e\n\x0c_include_all\"\x9f\x02\n\tRsvpTspec\x12\x1e\n\x11token_bucket_rate\x18\x01 \x01(\x02H\x00\x88\x01\x01\x12\x1e\n\x11token_bucket_size\x18\x02 \x01(\x02H\x01\x88\x01\x01\x12\x1b\n\x0epeak_data_rate\x18\x03 \x01(\x02H\x02\x88\x01\x01\x12!\n\x14minimum_policed_unit\x18\x04 \x01(\rH\x03\x88\x01\x01\x12!\n\x14maximum_policed_unit\x18\x05 \x01(\rH\x04\x88\x01\x01\x42\x14\n\x12_token_bucket_rateB\x14\n\x12_token_bucket_sizeB\x11\n\x0f_peak_data_rateB\x17\n\x15_minimum_policed_unitB\x17\n\x15_maximum_policed_unit\"\xc7\x03\n\x0fRsvpFastReroute\x12\x1b\n\x0esetup_priority\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1d\n\x10holding_priority\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\thop_limit\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x16\n\tbandwidth\x18\x04 \x01(\x02H\x03\x88\x01\x01\x12\x18\n\x0b\x65xclude_any\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x18\n\x0binclude_any\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\x18\n\x0binclude_all\x18\x07 \x01(\tH\x06\x88\x01\x01\x12&\n\x19one_to_one_backup_desired\x18\x08 \x01(\x08H\x07\x88\x01\x01\x12$\n\x17\x66\x61\x63ility_backup_desired\x18\t \x01(\x08H\x08\x88\x01\x01\x42\x11\n\x0f_setup_priorityB\x13\n\x11_holding_priorityB\x0c\n\n_hop_limitB\x0c\n\n_bandwidthB\x0e\n\x0c_exclude_anyB\x0e\n\x0c_include_anyB\x0e\n\x0c_include_allB\x1c\n\x1a_one_to_one_backup_desiredB\x1a\n\x18_facility_backup_desired\"\xa8\x02\n\x07RsvpEro\x12\x45\n\x13prepend_neighbor_ip\x18\x01 \x01(\x0e\x32#.otg.RsvpEro.PrependNeighborIp.EnumH\x00\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12)\n\nsubobjects\x18\x03 \x03(\x0b\x32\x15.otg.RsvpEroSubobject\x1a\x65\n\x11PrependNeighborIp\"P\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0c\x64ont_prepend\x10\x01\x12\x11\n\rprepend_loose\x10\x02\x12\x12\n\x0eprepend_strict\x10\x03\x42\x16\n\x14_prepend_neighbor_ipB\x10\n\x0e_prefix_length\"\x8c\x03\n\x10RsvpEroSubobject\x12\x32\n\x04type\x18\x01 \x01(\x0e\x32\x1f.otg.RsvpEroSubobject.Type.EnumH\x00\x88\x01\x01\x12\x19\n\x0cipv4_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x16\n\tas_number\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x39\n\x08hop_type\x18\x05 \x01(\x0e\x32\".otg.RsvpEroSubobject.HopType.EnumH\x04\x88\x01\x01\x1a\x38\n\x04Type\"0\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\r\n\tas_number\x10\x02\x1a\x39\n\x07HopType\".\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06strict\x10\x01\x12\t\n\x05loose\x10\x02\x42\x07\n\x05_typeB\x0f\n\r_ipv4_addressB\x10\n\x0e_prefix_lengthB\x0c\n\n_as_numberB\x0b\n\t_hop_type\">\n\x10\x44\x65viceDhcpServer\x12*\n\x0fipv4_interfaces\x18\x02 \x03(\x0b\x32\x11.otg.DhcpServerV4\"~\n\x0c\x44hcpServerV4\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x16\n\tipv4_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12,\n\raddress_pools\x18\x03 \x03(\x0b\x32\x15.otg.DhcpServerV4PoolB\x07\n\x05_nameB\x0c\n\n_ipv4_name\"\x9a\x02\n\x10\x44hcpServerV4Pool\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x17\n\nlease_time\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1a\n\rstart_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x11\n\x04step\x18\x06 \x01(\rH\x05\x88\x01\x01\x12,\n\x07options\x18\x07 \x01(\x0b\x32\x1b.otg.DhcpServerV4PoolOptionB\x07\n\x05_nameB\r\n\x0b_lease_timeB\x10\n\x0e_start_addressB\x10\n\x0e_prefix_lengthB\x08\n\x06_countB\x07\n\x05_step\"\xfc\x01\n\x16\x44hcpServerV4PoolOption\x12\x1b\n\x0erouter_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12primary_dns_server\x18\x02 \x01(\tH\x01\x88\x01\x01\x12!\n\x14secondary_dns_server\x18\x03 \x01(\tH\x02\x88\x01\x01\x12#\n\x16\x65\x63ho_relay_with_tlv_82\x18\x04 \x01(\x08H\x03\x88\x01\x01\x42\x11\n\x0f_router_addressB\x15\n\x13_primary_dns_serverB\x17\n\x15_secondary_dns_serverB\x19\n\x17_echo_relay_with_tlv_82\"\x8b\x02\n\x04\x46low\x12\x1c\n\x05tx_rx\x18\x01 \x01(\x0b\x32\r.otg.FlowTxRx\x12\x1f\n\x06packet\x18\x02 \x03(\x0b\x32\x0f.otg.FlowHeader\x12&\n\regress_packet\x18\t \x03(\x0b\x32\x0f.otg.FlowHeader\x12\x1b\n\x04size\x18\x03 \x01(\x0b\x32\r.otg.FlowSize\x12\x1b\n\x04rate\x18\x04 \x01(\x0b\x32\r.otg.FlowRate\x12#\n\x08\x64uration\x18\x05 \x01(\x0b\x32\x11.otg.FlowDuration\x12!\n\x07metrics\x18\x06 \x01(\x0b\x32\x10.otg.FlowMetrics\x12\x11\n\x04name\x18\x07 \x01(\tH\x00\x88\x01\x01\x42\x07\n\x05_name\"\xbc\x01\n\x08\x46lowTxRx\x12.\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x19.otg.FlowTxRx.Choice.EnumH\x00\x88\x01\x01\x12\x1b\n\x04port\x18\x02 \x01(\x0b\x32\r.otg.FlowPort\x12\x1f\n\x06\x64\x65vice\x18\x03 \x01(\x0b\x32\x0f.otg.FlowRouter\x1a\x37\n\x06\x43hoice\"-\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04port\x10\x01\x12\n\n\x06\x64\x65vice\x10\x02\x42\t\n\x07_choice\"`\n\x08\x46lowPort\x12\x14\n\x07tx_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x07rx_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x10\n\x08rx_names\x18\x03 \x03(\tB\n\n\x08_tx_nameB\n\n\x08_rx_name\"\xa2\x01\n\nFlowRouter\x12,\n\x04mode\x18\x01 \x01(\x0e\x32\x19.otg.FlowRouter.Mode.EnumH\x00\x88\x01\x01\x12\x10\n\x08tx_names\x18\x02 \x03(\t\x12\x10\n\x08rx_names\x18\x03 \x03(\t\x1a\x39\n\x04Mode\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04mesh\x10\x01\x12\x0e\n\none_to_one\x10\x02\x42\x07\n\x05_mode\"\xe9\x07\n\nFlowHeader\x12\x30\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1b.otg.FlowHeader.Choice.EnumH\x00\x88\x01\x01\x12\x1f\n\x06\x63ustom\x18\x02 \x01(\x0b\x32\x0f.otg.FlowCustom\x12#\n\x08\x65thernet\x18\x03 \x01(\x0b\x32\x11.otg.FlowEthernet\x12\x1b\n\x04vlan\x18\x04 \x01(\x0b\x32\r.otg.FlowVlan\x12\x1d\n\x05vxlan\x18\x05 \x01(\x0b\x32\x0e.otg.FlowVxlan\x12\x1b\n\x04ipv4\x18\x06 \x01(\x0b\x32\r.otg.FlowIpv4\x12\x1b\n\x04ipv6\x18\x07 \x01(\x0b\x32\r.otg.FlowIpv6\x12#\n\x08pfcpause\x18\x08 \x01(\x0b\x32\x11.otg.FlowPfcPause\x12-\n\rethernetpause\x18\t \x01(\x0b\x32\x16.otg.FlowEthernetPause\x12\x19\n\x03tcp\x18\n \x01(\x0b\x32\x0c.otg.FlowTcp\x12\x19\n\x03udp\x18\x0b \x01(\x0b\x32\x0c.otg.FlowUdp\x12\x19\n\x03gre\x18\x0c \x01(\x0b\x32\x0c.otg.FlowGre\x12\x1d\n\x05gtpv1\x18\r \x01(\x0b\x32\x0e.otg.FlowGtpv1\x12\x1d\n\x05gtpv2\x18\x0e \x01(\x0b\x32\x0e.otg.FlowGtpv2\x12\x19\n\x03\x61rp\x18\x0f \x01(\x0b\x32\x0c.otg.FlowArp\x12\x1b\n\x04icmp\x18\x10 \x01(\x0b\x32\r.otg.FlowIcmp\x12\x1f\n\x06icmpv6\x18\x11 \x01(\x0b\x32\x0f.otg.FlowIcmpv6\x12\x19\n\x03ppp\x18\x12 \x01(\x0b\x32\x0c.otg.FlowPpp\x12\x1f\n\x06igmpv1\x18\x13 \x01(\x0b\x32\x0f.otg.FlowIgmpv1\x12\x1b\n\x04mpls\x18\x14 \x01(\x0b\x32\r.otg.FlowMpls\x12!\n\x07snmpv2c\x18\x15 \x01(\x0b\x32\x10.otg.FlowSnmpv2c\x12\x1b\n\x04rsvp\x18\x16 \x01(\x0b\x32\r.otg.FlowRsvp\x1a\x8c\x02\n\x06\x43hoice\"\x81\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x63ustom\x10\x01\x12\x0c\n\x08\x65thernet\x10\x02\x12\x08\n\x04vlan\x10\x03\x12\t\n\x05vxlan\x10\x04\x12\x08\n\x04ipv4\x10\x05\x12\x08\n\x04ipv6\x10\x06\x12\x0c\n\x08pfcpause\x10\x07\x12\x11\n\rethernetpause\x10\x08\x12\x07\n\x03tcp\x10\t\x12\x07\n\x03udp\x10\n\x12\x07\n\x03gre\x10\x0b\x12\t\n\x05gtpv1\x10\x0c\x12\t\n\x05gtpv2\x10\r\x12\x07\n\x03\x61rp\x10\x0e\x12\x08\n\x04icmp\x10\x0f\x12\n\n\x06icmpv6\x10\x10\x12\x07\n\x03ppp\x10\x11\x12\n\n\x06igmpv1\x10\x12\x12\x08\n\x04mpls\x10\x13\x12\x0b\n\x07snmpv2c\x10\x14\x12\x08\n\x04rsvp\x10\x15\x42\t\n\x07_choice\"Y\n\nFlowCustom\x12\x12\n\x05\x62ytes\x18\x01 \x01(\tH\x00\x88\x01\x01\x12-\n\x0bmetric_tags\x18\x02 \x03(\x0b\x32\x18.otg.FlowCustomMetricTagB\x08\n\x06_bytes\"q\n\x13\x46lowCustomMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xce\x01\n\x0c\x46lowEthernet\x12(\n\x03\x64st\x18\x01 \x01(\x0b\x32\x1b.otg.PatternFlowEthernetDst\x12(\n\x03src\x18\x02 \x01(\x0b\x32\x1b.otg.PatternFlowEthernetSrc\x12\x35\n\nether_type\x18\x03 \x01(\x0b\x32!.otg.PatternFlowEthernetEtherType\x12\x33\n\tpfc_queue\x18\x04 \x01(\x0b\x32 .otg.PatternFlowEthernetPfcQueue\"\xac\x01\n\x08\x46lowVlan\x12.\n\x08priority\x18\x01 \x01(\x0b\x32\x1c.otg.PatternFlowVlanPriority\x12$\n\x03\x63\x66i\x18\x02 \x01(\x0b\x32\x17.otg.PatternFlowVlanCfi\x12\"\n\x02id\x18\x03 \x01(\x0b\x32\x16.otg.PatternFlowVlanId\x12&\n\x04tpid\x18\x04 \x01(\x0b\x32\x18.otg.PatternFlowVlanTpid\"\xc3\x01\n\tFlowVxlan\x12)\n\x05\x66lags\x18\x01 \x01(\x0b\x32\x1a.otg.PatternFlowVxlanFlags\x12\x31\n\treserved0\x18\x02 \x01(\x0b\x32\x1e.otg.PatternFlowVxlanReserved0\x12%\n\x03vni\x18\x03 \x01(\x0b\x32\x18.otg.PatternFlowVxlanVni\x12\x31\n\treserved1\x18\x04 \x01(\x0b\x32\x1e.otg.PatternFlowVxlanReserved1\"\x84\x06\n\x08\x46lowIpv4\x12,\n\x07version\x18\x01 \x01(\x0b\x32\x1b.otg.PatternFlowIpv4Version\x12\x37\n\rheader_length\x18\x02 \x01(\x0b\x32 .otg.PatternFlowIpv4HeaderLength\x12\'\n\x08priority\x18\x03 \x01(\x0b\x32\x15.otg.FlowIpv4Priority\x12\x35\n\x0ctotal_length\x18\x04 \x01(\x0b\x32\x1f.otg.PatternFlowIpv4TotalLength\x12:\n\x0eidentification\x18\x05 \x01(\x0b\x32\".otg.PatternFlowIpv4Identification\x12.\n\x08reserved\x18\x06 \x01(\x0b\x32\x1c.otg.PatternFlowIpv4Reserved\x12\x37\n\rdont_fragment\x18\x07 \x01(\x0b\x32 .otg.PatternFlowIpv4DontFragment\x12\x39\n\x0emore_fragments\x18\x08 \x01(\x0b\x32!.otg.PatternFlowIpv4MoreFragments\x12;\n\x0f\x66ragment_offset\x18\t \x01(\x0b\x32\".otg.PatternFlowIpv4FragmentOffset\x12\x34\n\x0ctime_to_live\x18\n \x01(\x0b\x32\x1e.otg.PatternFlowIpv4TimeToLive\x12.\n\x08protocol\x18\x0b \x01(\x0b\x32\x1c.otg.PatternFlowIpv4Protocol\x12;\n\x0fheader_checksum\x18\x0c \x01(\x0b\x32\".otg.PatternFlowIpv4HeaderChecksum\x12$\n\x03src\x18\r \x01(\x0b\x32\x17.otg.PatternFlowIpv4Src\x12$\n\x03\x64st\x18\x0e \x01(\x0b\x32\x17.otg.PatternFlowIpv4Dst\x12%\n\x07options\x18\x0f \x03(\x0b\x32\x14.otg.FlowIpv4Options\"\xc0\x01\n\x0f\x46lowIpv4Options\x12\x35\n\x06\x63hoice\x18\x01 \x01(\x0e\x32 .otg.FlowIpv4Options.Choice.EnumH\x00\x88\x01\x01\x12*\n\x06\x63ustom\x18\x02 \x01(\x0b\x32\x1a.otg.FlowIpv4OptionsCustom\x1a?\n\x06\x43hoice\"5\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0crouter_alert\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x42\t\n\x07_choice\"\x95\x01\n\x15\x46lowIpv4OptionsCustom\x12,\n\x04type\x18\x01 \x01(\x0b\x32\x1e.otg.FlowIpv4OptionsCustomType\x12\x30\n\x06length\x18\x02 \x01(\x0b\x32 .otg.FlowIpv4OptionsCustomLength\x12\x12\n\x05value\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_value\"\xf3\x01\n\x19\x46lowIpv4OptionsCustomType\x12\x44\n\x0b\x63opied_flag\x18\x01 \x01(\x0b\x32/.otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag\x12\x46\n\x0coption_class\x18\x02 \x01(\x0b\x32\x30.otg.PatternFlowIpv4OptionsCustomTypeOptionClass\x12H\n\roption_number\x18\x03 \x01(\x0b\x32\x31.otg.PatternFlowIpv4OptionsCustomTypeOptionNumber\"\xdd\x01\n\x1b\x46lowIpv4OptionsCustomLength\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.FlowIpv4OptionsCustomLength.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\x82\x02\n\x10\x46lowIpv4Priority\x12\x36\n\x06\x63hoice\x18\x01 \x01(\x0e\x32!.otg.FlowIpv4Priority.Choice.EnumH\x00\x88\x01\x01\x12,\n\x03raw\x18\x02 \x01(\x0b\x32\x1f.otg.PatternFlowIpv4PriorityRaw\x12\x1d\n\x03tos\x18\x03 \x01(\x0b\x32\x10.otg.FlowIpv4Tos\x12\x1f\n\x04\x64scp\x18\x04 \x01(\x0b\x32\x11.otg.FlowIpv4Dscp\x1a=\n\x06\x43hoice\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03raw\x10\x01\x12\x07\n\x03tos\x10\x02\x12\x08\n\x04\x64scp\x10\x03\x42\t\n\x07_choice\"b\n\x0c\x46lowIpv4Dscp\x12(\n\x03phb\x18\x01 \x01(\x0b\x32\x1b.otg.PatternFlowIpv4DscpPhb\x12(\n\x03\x65\x63n\x18\x02 \x01(\x0b\x32\x1b.otg.PatternFlowIpv4DscpEcn\"\xc3\x02\n\x0b\x46lowIpv4Tos\x12\x35\n\nprecedence\x18\x01 \x01(\x0b\x32!.otg.PatternFlowIpv4TosPrecedence\x12+\n\x05\x64\x65lay\x18\x02 \x01(\x0b\x32\x1c.otg.PatternFlowIpv4TosDelay\x12\x35\n\nthroughput\x18\x03 \x01(\x0b\x32!.otg.PatternFlowIpv4TosThroughput\x12\x37\n\x0breliability\x18\x04 \x01(\x0b\x32\".otg.PatternFlowIpv4TosReliability\x12\x31\n\x08monetary\x18\x05 \x01(\x0b\x32\x1f.otg.PatternFlowIpv4TosMonetary\x12-\n\x06unused\x18\x06 \x01(\x0b\x32\x1d.otg.PatternFlowIpv4TosUnused\"z\n\x0c\x46lowIpv4Auto\x12\x32\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1d.otg.FlowIpv4Auto.Choice.EnumH\x00\x88\x01\x01\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x64hcp\x10\x01\x42\t\n\x07_choice\"\x91\x03\n\x08\x46lowIpv6\x12,\n\x07version\x18\x01 \x01(\x0b\x32\x1b.otg.PatternFlowIpv6Version\x12\x37\n\rtraffic_class\x18\x02 \x01(\x0b\x32 .otg.PatternFlowIpv6TrafficClass\x12\x31\n\nflow_label\x18\x03 \x01(\x0b\x32\x1d.otg.PatternFlowIpv6FlowLabel\x12\x39\n\x0epayload_length\x18\x04 \x01(\x0b\x32!.otg.PatternFlowIpv6PayloadLength\x12\x33\n\x0bnext_header\x18\x05 \x01(\x0b\x32\x1e.otg.PatternFlowIpv6NextHeader\x12/\n\thop_limit\x18\x06 \x01(\x0b\x32\x1c.otg.PatternFlowIpv6HopLimit\x12$\n\x03src\x18\x07 \x01(\x0b\x32\x17.otg.PatternFlowIpv6Src\x12$\n\x03\x64st\x18\x08 \x01(\x0b\x32\x17.otg.PatternFlowIpv6Dst\"\x81\x06\n\x0c\x46lowPfcPause\x12(\n\x03\x64st\x18\x01 \x01(\x0b\x32\x1b.otg.PatternFlowPfcPauseDst\x12(\n\x03src\x18\x02 \x01(\x0b\x32\x1b.otg.PatternFlowPfcPauseSrc\x12\x35\n\nether_type\x18\x03 \x01(\x0b\x32!.otg.PatternFlowPfcPauseEtherType\x12>\n\x0f\x63ontrol_op_code\x18\x04 \x01(\x0b\x32%.otg.PatternFlowPfcPauseControlOpCode\x12\x46\n\x13\x63lass_enable_vector\x18\x05 \x01(\x0b\x32).otg.PatternFlowPfcPauseClassEnableVector\x12:\n\rpause_class_0\x18\x06 \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass0\x12:\n\rpause_class_1\x18\x07 \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass1\x12:\n\rpause_class_2\x18\x08 \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass2\x12:\n\rpause_class_3\x18\t \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass3\x12:\n\rpause_class_4\x18\n \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass4\x12:\n\rpause_class_5\x18\x0b \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass5\x12:\n\rpause_class_6\x18\x0c \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass6\x12:\n\rpause_class_7\x18\r \x01(\x0b\x32#.otg.PatternFlowPfcPausePauseClass7\"\xa3\x02\n\x11\x46lowEthernetPause\x12-\n\x03\x64st\x18\x01 \x01(\x0b\x32 .otg.PatternFlowEthernetPauseDst\x12-\n\x03src\x18\x02 \x01(\x0b\x32 .otg.PatternFlowEthernetPauseSrc\x12:\n\nether_type\x18\x03 \x01(\x0b\x32&.otg.PatternFlowEthernetPauseEtherType\x12\x43\n\x0f\x63ontrol_op_code\x18\x04 \x01(\x0b\x32*.otg.PatternFlowEthernetPauseControlOpCode\x12/\n\x04time\x18\x05 \x01(\x0b\x32!.otg.PatternFlowEthernetPauseTime\"\xd7\x05\n\x07\x46lowTcp\x12,\n\x08src_port\x18\x01 \x01(\x0b\x32\x1a.otg.PatternFlowTcpSrcPort\x12,\n\x08\x64st_port\x18\x02 \x01(\x0b\x32\x1a.otg.PatternFlowTcpDstPort\x12*\n\x07seq_num\x18\x03 \x01(\x0b\x32\x19.otg.PatternFlowTcpSeqNum\x12*\n\x07\x61\x63k_num\x18\x04 \x01(\x0b\x32\x19.otg.PatternFlowTcpAckNum\x12\x32\n\x0b\x64\x61ta_offset\x18\x05 \x01(\x0b\x32\x1d.otg.PatternFlowTcpDataOffset\x12(\n\x06\x65\x63n_ns\x18\x06 \x01(\x0b\x32\x18.otg.PatternFlowTcpEcnNs\x12*\n\x07\x65\x63n_cwr\x18\x07 \x01(\x0b\x32\x19.otg.PatternFlowTcpEcnCwr\x12,\n\x08\x65\x63n_echo\x18\x08 \x01(\x0b\x32\x1a.otg.PatternFlowTcpEcnEcho\x12*\n\x07\x63tl_urg\x18\t \x01(\x0b\x32\x19.otg.PatternFlowTcpCtlUrg\x12*\n\x07\x63tl_ack\x18\n \x01(\x0b\x32\x19.otg.PatternFlowTcpCtlAck\x12*\n\x07\x63tl_psh\x18\x0b \x01(\x0b\x32\x19.otg.PatternFlowTcpCtlPsh\x12*\n\x07\x63tl_rst\x18\x0c \x01(\x0b\x32\x19.otg.PatternFlowTcpCtlRst\x12*\n\x07\x63tl_syn\x18\r \x01(\x0b\x32\x19.otg.PatternFlowTcpCtlSyn\x12*\n\x07\x63tl_fin\x18\x0e \x01(\x0b\x32\x19.otg.PatternFlowTcpCtlFin\x12)\n\x06window\x18\x0f \x01(\x0b\x32\x19.otg.PatternFlowTcpWindow\x12-\n\x08\x63hecksum\x18\x10 \x01(\x0b\x32\x1b.otg.PatternFlowTcpChecksum\"\xbf\x01\n\x07\x46lowUdp\x12,\n\x08src_port\x18\x01 \x01(\x0b\x32\x1a.otg.PatternFlowUdpSrcPort\x12,\n\x08\x64st_port\x18\x02 \x01(\x0b\x32\x1a.otg.PatternFlowUdpDstPort\x12)\n\x06length\x18\x03 \x01(\x0b\x32\x19.otg.PatternFlowUdpLength\x12-\n\x08\x63hecksum\x18\x04 \x01(\x0b\x32\x1b.otg.PatternFlowUdpChecksum\"\xb4\x02\n\x07\x46lowGre\x12<\n\x10\x63hecksum_present\x18\x01 \x01(\x0b\x32\".otg.PatternFlowGreChecksumPresent\x12/\n\treserved0\x18\x02 \x01(\x0b\x32\x1c.otg.PatternFlowGreReserved0\x12+\n\x07version\x18\x03 \x01(\x0b\x32\x1a.otg.PatternFlowGreVersion\x12-\n\x08protocol\x18\x04 \x01(\x0b\x32\x1b.otg.PatternFlowGreProtocol\x12-\n\x08\x63hecksum\x18\x05 \x01(\x0b\x32\x1b.otg.PatternFlowGreChecksum\x12/\n\treserved1\x18\x06 \x01(\x0b\x32\x1c.otg.PatternFlowGreReserved1\"\xbf\x05\n\tFlowGtpv1\x12-\n\x07version\x18\x01 \x01(\x0b\x32\x1c.otg.PatternFlowGtpv1Version\x12\x38\n\rprotocol_type\x18\x02 \x01(\x0b\x32!.otg.PatternFlowGtpv1ProtocolType\x12/\n\x08reserved\x18\x03 \x01(\x0b\x32\x1d.otg.PatternFlowGtpv1Reserved\x12*\n\x06\x65_flag\x18\x04 \x01(\x0b\x32\x1a.otg.PatternFlowGtpv1EFlag\x12*\n\x06s_flag\x18\x05 \x01(\x0b\x32\x1a.otg.PatternFlowGtpv1SFlag\x12,\n\x07pn_flag\x18\x06 \x01(\x0b\x32\x1b.otg.PatternFlowGtpv1PnFlag\x12\x36\n\x0cmessage_type\x18\x07 \x01(\x0b\x32 .otg.PatternFlowGtpv1MessageType\x12:\n\x0emessage_length\x18\x08 \x01(\x0b\x32\".otg.PatternFlowGtpv1MessageLength\x12\'\n\x04teid\x18\t \x01(\x0b\x32\x19.otg.PatternFlowGtpv1Teid\x12:\n\x0esquence_number\x18\n \x01(\x0b\x32\".otg.PatternFlowGtpv1SquenceNumber\x12\x35\n\x0cn_pdu_number\x18\x0b \x01(\x0b\x32\x1f.otg.PatternFlowGtpv1NPduNumber\x12P\n\x1anext_extension_header_type\x18\x0c \x01(\x0b\x32,.otg.PatternFlowGtpv1NextExtensionHeaderType\x12\x30\n\x11\x65xtension_headers\x18\r \x03(\x0b\x32\x15.otg.FlowGtpExtension\"\xe1\x01\n\x10\x46lowGtpExtension\x12\x45\n\x10\x65xtension_length\x18\x01 \x01(\x0b\x32+.otg.PatternFlowGtpExtensionExtensionLength\x12\x36\n\x08\x63ontents\x18\x02 \x01(\x0b\x32$.otg.PatternFlowGtpExtensionContents\x12N\n\x15next_extension_header\x18\x03 \x01(\x0b\x32/.otg.PatternFlowGtpExtensionNextExtensionHeader\"\xe3\x03\n\tFlowGtpv2\x12-\n\x07version\x18\x01 \x01(\x0b\x32\x1c.otg.PatternFlowGtpv2Version\x12@\n\x11piggybacking_flag\x18\x02 \x01(\x0b\x32%.otg.PatternFlowGtpv2PiggybackingFlag\x12\x30\n\tteid_flag\x18\x03 \x01(\x0b\x32\x1d.otg.PatternFlowGtpv2TeidFlag\x12+\n\x06spare1\x18\x04 \x01(\x0b\x32\x1b.otg.PatternFlowGtpv2Spare1\x12\x36\n\x0cmessage_type\x18\x05 \x01(\x0b\x32 .otg.PatternFlowGtpv2MessageType\x12:\n\x0emessage_length\x18\x06 \x01(\x0b\x32\".otg.PatternFlowGtpv2MessageLength\x12\'\n\x04teid\x18\x07 \x01(\x0b\x32\x19.otg.PatternFlowGtpv2Teid\x12<\n\x0fsequence_number\x18\x08 \x01(\x0b\x32#.otg.PatternFlowGtpv2SequenceNumber\x12+\n\x06spare2\x18\t \x01(\x0b\x32\x1b.otg.PatternFlowGtpv2Spare2\"\xb6\x04\n\x07\x46lowArp\x12\x36\n\rhardware_type\x18\x01 \x01(\x0b\x32\x1f.otg.PatternFlowArpHardwareType\x12\x36\n\rprotocol_type\x18\x02 \x01(\x0b\x32\x1f.otg.PatternFlowArpProtocolType\x12:\n\x0fhardware_length\x18\x03 \x01(\x0b\x32!.otg.PatternFlowArpHardwareLength\x12:\n\x0fprotocol_length\x18\x04 \x01(\x0b\x32!.otg.PatternFlowArpProtocolLength\x12/\n\toperation\x18\x05 \x01(\x0b\x32\x1c.otg.PatternFlowArpOperation\x12\x43\n\x14sender_hardware_addr\x18\x06 \x01(\x0b\x32%.otg.PatternFlowArpSenderHardwareAddr\x12\x43\n\x14sender_protocol_addr\x18\x07 \x01(\x0b\x32%.otg.PatternFlowArpSenderProtocolAddr\x12\x43\n\x14target_hardware_addr\x18\x08 \x01(\x0b\x32%.otg.PatternFlowArpTargetHardwareAddr\x12\x43\n\x14target_protocol_addr\x18\t \x01(\x0b\x32%.otg.PatternFlowArpTargetProtocolAddr\"\x93\x01\n\x08\x46lowIcmp\x12.\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x19.otg.FlowIcmp.Choice.EnumH\x00\x88\x01\x01\x12\x1f\n\x04\x65\x63ho\x18\x02 \x01(\x0b\x32\x11.otg.FlowIcmpEcho\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x65\x63ho\x10\x01\x42\t\n\x07_choice\"\x93\x02\n\x0c\x46lowIcmpEcho\x12*\n\x04type\x18\x01 \x01(\x0b\x32\x1c.otg.PatternFlowIcmpEchoType\x12*\n\x04\x63ode\x18\x02 \x01(\x0b\x32\x1c.otg.PatternFlowIcmpEchoCode\x12\x32\n\x08\x63hecksum\x18\x03 \x01(\x0b\x32 .otg.PatternFlowIcmpEchoChecksum\x12\x36\n\nidentifier\x18\x04 \x01(\x0b\x32\".otg.PatternFlowIcmpEchoIdentifier\x12?\n\x0fsequence_number\x18\x05 \x01(\x0b\x32&.otg.PatternFlowIcmpEchoSequenceNumber\"\x99\x01\n\nFlowIcmpv6\x12\x30\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1b.otg.FlowIcmpv6.Choice.EnumH\x00\x88\x01\x01\x12!\n\x04\x65\x63ho\x18\x02 \x01(\x0b\x32\x13.otg.FlowIcmpv6Echo\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x65\x63ho\x10\x01\x42\t\n\x07_choice\"\x9f\x02\n\x0e\x46lowIcmpv6Echo\x12,\n\x04type\x18\x01 \x01(\x0b\x32\x1e.otg.PatternFlowIcmpv6EchoType\x12,\n\x04\x63ode\x18\x02 \x01(\x0b\x32\x1e.otg.PatternFlowIcmpv6EchoCode\x12\x38\n\nidentifier\x18\x03 \x01(\x0b\x32$.otg.PatternFlowIcmpv6EchoIdentifier\x12\x41\n\x0fsequence_number\x18\x04 \x01(\x0b\x32(.otg.PatternFlowIcmpv6EchoSequenceNumber\x12\x34\n\x08\x63hecksum\x18\x05 \x01(\x0b\x32\".otg.PatternFlowIcmpv6EchoChecksum\"\x9b\x01\n\x07\x46lowPpp\x12+\n\x07\x61\x64\x64ress\x18\x01 \x01(\x0b\x32\x1a.otg.PatternFlowPppAddress\x12+\n\x07\x63ontrol\x18\x02 \x01(\x0b\x32\x1a.otg.PatternFlowPppControl\x12\x36\n\rprotocol_type\x18\x03 \x01(\x0b\x32\x1f.otg.PatternFlowPppProtocolType\"\x81\x02\n\nFlowIgmpv1\x12.\n\x07version\x18\x01 \x01(\x0b\x32\x1d.otg.PatternFlowIgmpv1Version\x12(\n\x04type\x18\x02 \x01(\x0b\x32\x1a.otg.PatternFlowIgmpv1Type\x12,\n\x06unused\x18\x03 \x01(\x0b\x32\x1c.otg.PatternFlowIgmpv1Unused\x12\x30\n\x08\x63hecksum\x18\x04 \x01(\x0b\x32\x1e.otg.PatternFlowIgmpv1Checksum\x12\x39\n\rgroup_address\x18\x05 \x01(\x0b\x32\".otg.PatternFlowIgmpv1GroupAddress\"\xdf\x01\n\x08\x46lowMpls\x12(\n\x05label\x18\x01 \x01(\x0b\x32\x19.otg.PatternFlowMplsLabel\x12\x37\n\rtraffic_class\x18\x02 \x01(\x0b\x32 .otg.PatternFlowMplsTrafficClass\x12:\n\x0f\x62ottom_of_stack\x18\x03 \x01(\x0b\x32!.otg.PatternFlowMplsBottomOfStack\x12\x34\n\x0ctime_to_live\x18\x04 \x01(\x0b\x32\x1e.otg.PatternFlowMplsTimeToLive\"\x88\x01\n\x0b\x46lowSnmpv2c\x12/\n\x07version\x18\x01 \x01(\x0b\x32\x1e.otg.PatternFlowSnmpv2cVersion\x12\x16\n\tcommunity\x18\x02 \x01(\tH\x00\x88\x01\x01\x12\"\n\x04\x64\x61ta\x18\x03 \x01(\x0b\x32\x14.otg.FlowSnmpv2cDataB\x0c\n\n_community\"\xde\x04\n\x0f\x46lowSnmpv2cData\x12\x35\n\x06\x63hoice\x18\x01 \x01(\x0e\x32 .otg.FlowSnmpv2cData.Choice.EnumH\x00\x88\x01\x01\x12(\n\x0bget_request\x18\x02 \x01(\x0b\x32\x13.otg.FlowSnmpv2cPDU\x12-\n\x10get_next_request\x18\x03 \x01(\x0b\x32\x13.otg.FlowSnmpv2cPDU\x12%\n\x08response\x18\x04 \x01(\x0b\x32\x13.otg.FlowSnmpv2cPDU\x12(\n\x0bset_request\x18\x05 \x01(\x0b\x32\x13.otg.FlowSnmpv2cPDU\x12\x31\n\x10get_bulk_request\x18\x06 \x01(\x0b\x32\x17.otg.FlowSnmpv2cBulkPDU\x12+\n\x0einform_request\x18\x07 \x01(\x0b\x32\x13.otg.FlowSnmpv2cPDU\x12(\n\x0bsnmpv2_trap\x18\x08 \x01(\x0b\x32\x13.otg.FlowSnmpv2cPDU\x12#\n\x06report\x18\t \x01(\x0b\x32\x13.otg.FlowSnmpv2cPDU\x1a\xaf\x01\n\x06\x43hoice\"\xa4\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0f\n\x0bget_request\x10\x01\x12\x14\n\x10get_next_request\x10\x02\x12\x0c\n\x08response\x10\x03\x12\x0f\n\x0bset_request\x10\x04\x12\x14\n\x10get_bulk_request\x10\x05\x12\x12\n\x0einform_request\x10\x06\x12\x0f\n\x0bsnmpv2_trap\x10\x07\x12\n\n\x06report\x10\x08\x42\t\n\x07_choice\"\x93\x05\n\x0e\x46lowSnmpv2cPDU\x12\x37\n\nrequest_id\x18\x01 \x01(\x0b\x32#.otg.PatternFlowSnmpv2cPDURequestId\x12?\n\x0c\x65rror_status\x18\x02 \x01(\x0e\x32$.otg.FlowSnmpv2cPDU.ErrorStatus.EnumH\x00\x88\x01\x01\x12\x39\n\x0b\x65rror_index\x18\x03 \x01(\x0b\x32$.otg.PatternFlowSnmpv2cPDUErrorIndex\x12:\n\x11variable_bindings\x18\x04 \x03(\x0b\x32\x1f.otg.FlowSnmpv2cVariableBinding\x1a\xfe\x02\n\x0b\x45rrorStatus\"\xee\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08no_error\x10\x01\x12\x0b\n\x07too_big\x10\x02\x12\x10\n\x0cno_such_name\x10\x03\x12\r\n\tbad_value\x10\x04\x12\r\n\tread_only\x10\x05\x12\x0b\n\x07gen_err\x10\x06\x12\r\n\tno_access\x10\x07\x12\x0e\n\nwrong_type\x10\x08\x12\x10\n\x0cwrong_length\x10\t\x12\x12\n\x0ewrong_encoding\x10\n\x12\x0f\n\x0bwrong_value\x10\x0b\x12\x0f\n\x0bno_creation\x10\x0c\x12\x16\n\x12inconsistent_value\x10\r\x12\x18\n\x14resource_unavailable\x10\x0e\x12\x11\n\rcommit_failed\x10\x0f\x12\x0f\n\x0bundo_failed\x10\x10\x12\x17\n\x13\x61uthorization_error\x10\x11\x12\x10\n\x0cnot_writable\x10\x12\x12\x15\n\x11inconsistent_name\x10\x13\x42\x0f\n\r_error_status\"\x97\x02\n\x12\x46lowSnmpv2cBulkPDU\x12;\n\nrequest_id\x18\x01 \x01(\x0b\x32\'.otg.PatternFlowSnmpv2cBulkPDURequestId\x12\x41\n\rnon_repeaters\x18\x02 \x01(\x0b\x32*.otg.PatternFlowSnmpv2cBulkPDUNonRepeaters\x12\x45\n\x0fmax_repetitions\x18\x03 \x01(\x0b\x32,.otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions\x12:\n\x11variable_bindings\x18\x04 \x03(\x0b\x32\x1f.otg.FlowSnmpv2cVariableBinding\"\x87\x01\n\x1a\x46lowSnmpv2cVariableBinding\x12\x1e\n\x11object_identifier\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x33\n\x05value\x18\x02 \x01(\x0b\x32$.otg.FlowSnmpv2cVariableBindingValueB\x14\n\x12_object_identifier\"\xa5\x08\n\x1f\x46lowSnmpv2cVariableBindingValue\x12\x45\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x30.otg.FlowSnmpv2cVariableBindingValue.Choice.EnumH\x00\x88\x01\x01\x12N\n\rinteger_value\x18\x02 \x01(\x0b\x32\x37.otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue\x12@\n\x0cstring_value\x18\x03 \x01(\x0b\x32*.otg.FlowSnmpv2cVariableBindingStringValue\x12$\n\x17object_identifier_value\x18\x04 \x01(\tH\x01\x88\x01\x01\x12S\n\x10ip_address_value\x18\x05 \x01(\x0b\x32\x39.otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue\x12N\n\rcounter_value\x18\x06 \x01(\x0b\x32\x37.otg.PatternFlowSnmpv2cVariableBindingValueCounterValue\x12R\n\x0ftimeticks_value\x18\x07 \x01(\x0b\x32\x39.otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue\x12\x1c\n\x0f\x61rbitrary_value\x18\x08 \x01(\tH\x02\x88\x01\x01\x12U\n\x11\x62ig_counter_value\x18\t \x01(\x0b\x32:.otg.PatternFlowSnmpv2cVariableBindingValueBigCounterValue\x12_\n\x16unsigned_integer_value\x18\n \x01(\x0b\x32?.otg.PatternFlowSnmpv2cVariableBindingValueUnsignedIntegerValue\x1a\xf8\x01\n\x06\x43hoice\"\xed\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08no_value\x10\x01\x12\x11\n\rinteger_value\x10\x02\x12\x10\n\x0cstring_value\x10\x03\x12\x1b\n\x17object_identifier_value\x10\x04\x12\x14\n\x10ip_address_value\x10\x05\x12\x11\n\rcounter_value\x10\x06\x12\x13\n\x0ftimeticks_value\x10\x07\x12\x13\n\x0f\x61rbitrary_value\x10\x08\x12\x15\n\x11\x62ig_counter_value\x10\t\x12\x1a\n\x16unsigned_integer_value\x10\nB\t\n\x07_choiceB\x1a\n\x18_object_identifier_valueB\x12\n\x10_arbitrary_value\"\xee\x01\n%FlowSnmpv2cVariableBindingStringValue\x12K\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x36.otg.FlowSnmpv2cVariableBindingStringValue.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05\x61scii\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x10\n\x03raw\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\x35\n\x06\x43hoice\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05\x61scii\x10\x01\x12\x07\n\x03raw\x10\x02\x42\t\n\x07_choiceB\x08\n\x06_asciiB\x06\n\x04_raw\"\xb9\x03\n\x08\x46lowRsvp\x12\x14\n\x07version\x18\x01 \x01(\rH\x00\x88\x01\x01\x12*\n\x04\x66lag\x18\x02 \x01(\x0e\x32\x17.otg.FlowRsvp.Flag.EnumH\x01\x88\x01\x01\x12\x37\n\rrsvp_checksum\x18\x03 \x01(\x0b\x32 .otg.PatternFlowRsvpRsvpChecksum\x12\x34\n\x0ctime_to_live\x18\x04 \x01(\x0b\x32\x1e.otg.PatternFlowRsvpTimeToLive\x12.\n\x08reserved\x18\x05 \x01(\x0b\x32\x1c.otg.PatternFlowRsvpReserved\x12(\n\x0brsvp_length\x18\x06 \x01(\x0b\x32\x13.otg.FlowRSVPLength\x12*\n\x0cmessage_type\x18\x07 \x01(\x0b\x32\x14.otg.FlowRSVPMessage\x1a\x61\n\x04\x46lag\"Y\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12!\n\x1dnot_refresh_reduction_capable\x10\x01\x12\x1d\n\x19refresh_reduction_capable\x10\x02\x42\n\n\x08_versionB\x07\n\x05_flag\"\xc3\x01\n\x0e\x46lowRSVPLength\x12\x34\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1f.otg.FlowRSVPLength.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xa8\x01\n\x0f\x46lowRSVPMessage\x12\x35\n\x06\x63hoice\x18\x01 \x01(\x0e\x32 .otg.FlowRSVPMessage.Choice.EnumH\x00\x88\x01\x01\x12&\n\x04path\x18\x02 \x01(\x0b\x32\x18.otg.FlowRSVPPathMessage\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04path\x10\x01\x42\t\n\x07_choice\"@\n\x13\x46lowRSVPPathMessage\x12)\n\x07objects\x18\x01 \x03(\x0b\x32\x18.otg.FlowRSVPPathObjects\"G\n\x13\x46lowRSVPPathObjects\x12\x30\n\tclass_num\x18\x01 \x01(\x0b\x32\x1d.otg.FlowRSVPPathObjectsClass\"\xcf\x01\n\x14\x46lowRSVPObjectLength\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.FlowRSVPObjectLength.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xac\x07\n\x18\x46lowRSVPPathObjectsClass\x12>\n\x06\x63hoice\x18\x01 \x01(\x0e\x32).otg.FlowRSVPPathObjectsClass.Choice.EnumH\x00\x88\x01\x01\x12\x35\n\x07session\x18\x02 \x01(\x0b\x32$.otg.FlowRSVPPathObjectsClassSession\x12\x36\n\x08rsvp_hop\x18\x03 \x01(\x0b\x32$.otg.FlowRSVPPathObjectsClassRsvpHop\x12<\n\x0btime_values\x18\x04 \x01(\x0b\x32\'.otg.FlowRSVPPathObjectsClassTimeValues\x12\x42\n\x0e\x65xplicit_route\x18\x05 \x01(\x0b\x32*.otg.FlowRSVPPathObjectsClassExplicitRoute\x12@\n\rlabel_request\x18\x06 \x01(\x0b\x32).otg.FlowRSVPPathObjectsClassLabelRequest\x12H\n\x11session_attribute\x18\x07 \x01(\x0b\x32-.otg.FlowRSVPPathObjectsClassSessionAttribute\x12\x44\n\x0fsender_template\x18\x08 \x01(\x0b\x32+.otg.FlowRSVPPathObjectsClassSenderTemplate\x12>\n\x0csender_tspec\x18\t \x01(\x0b\x32(.otg.FlowRSVPPathObjectsClassSenderTspec\x12>\n\x0crecord_route\x18\n \x01(\x0b\x32(.otg.FlowRSVPPathObjectsClassRecordRoute\x12.\n\x06\x63ustom\x18\x0b \x01(\x0b\x32\x1e.otg.FlowRSVPPathObjectsCustom\x1a\xd1\x01\n\x06\x43hoice\"\xc6\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07session\x10\x01\x12\x0c\n\x08rsvp_hop\x10\x02\x12\x0f\n\x0btime_values\x10\x03\x12\x12\n\x0e\x65xplicit_route\x10\x04\x12\x11\n\rlabel_request\x10\x05\x12\x15\n\x11session_attribute\x10\x06\x12\x13\n\x0fsender_template\x10\x07\x12\x10\n\x0csender_tspec\x10\x08\x12\x10\n\x0crecord_route\x10\t\x12\n\n\x06\x63ustom\x10\nB\t\n\x07_choice\"\x82\x01\n\x1f\x46lowRSVPPathObjectsClassSession\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12\x34\n\x06\x63_type\x18\x02 \x01(\x0b\x32$.otg.FlowRSVPPathObjectsSessionCType\"\xeb\x01\n\x1f\x46lowRSVPPathObjectsSessionCType\x12\x45\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x30.otg.FlowRSVPPathObjectsSessionCType.Choice.EnumH\x00\x88\x01\x01\x12>\n\x0flsp_tunnel_ipv4\x18\x02 \x01(\x0b\x32%.otg.FlowRSVPPathSessionLspTunnelIpv4\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x13\n\x0flsp_tunnel_ipv4\x10\x01\x42\t\n\x07_choice\"\xe2\x02\n FlowRSVPPathSessionLspTunnelIpv4\x12l\n\x1dipv4_tunnel_end_point_address\x18\x01 \x01(\x0b\x32\x45.otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress\x12\x46\n\x08reserved\x18\x02 \x01(\x0b\x32\x34.otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved\x12G\n\ttunnel_id\x18\x03 \x01(\x0b\x32\x34.otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId\x12?\n\x12\x65xtended_tunnel_id\x18\x04 \x01(\x0b\x32#.otg.FlowRSVPPathSessionExtTunnelId\"\xbd\x02\n\x1e\x46lowRSVPPathSessionExtTunnelId\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.FlowRSVPPathSessionExtTunnelId.Choice.EnumH\x00\x88\x01\x01\x12G\n\nas_integer\x18\x02 \x01(\x0b\x32\x33.otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger\x12\x41\n\x07\x61s_ipv4\x18\x03 \x01(\x0b\x32\x30.otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4\x1a>\n\x06\x43hoice\"4\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0e\n\nas_integer\x10\x01\x12\x0b\n\x07\x61s_ipv4\x10\x02\x42\t\n\x07_choice\"\x82\x01\n\x1f\x46lowRSVPPathObjectsClassRsvpHop\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12\x34\n\x06\x63_type\x18\x02 \x01(\x0b\x32$.otg.FlowRSVPPathObjectsRsvpHopCType\"\xcc\x01\n\x1f\x46lowRSVPPathObjectsRsvpHopCType\x12\x45\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x30.otg.FlowRSVPPathObjectsRsvpHopCType.Choice.EnumH\x00\x88\x01\x01\x12*\n\x04ipv4\x18\x02 \x01(\x0b\x32\x1c.otg.FlowRSVPPathRsvpHopIpv4\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x42\t\n\x07_choice\"\xbc\x01\n\x17\x46lowRSVPPathRsvpHopIpv4\x12\x44\n\x0cipv4_address\x18\x01 \x01(\x0b\x32..otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address\x12[\n\x18logical_interface_handle\x18\x02 \x01(\x0b\x32\x39.otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle\"\x88\x01\n\"FlowRSVPPathObjectsClassTimeValues\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12\x37\n\x06\x63_type\x18\x02 \x01(\x0b\x32\'.otg.FlowRSVPPathObjectsTimeValuesCType\"\xda\x01\n\"FlowRSVPPathObjectsTimeValuesCType\x12H\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x33.otg.FlowRSVPPathObjectsTimeValuesCType.Choice.EnumH\x00\x88\x01\x01\x12\x30\n\x06type_1\x18\x02 \x01(\x0b\x32 .otg.FlowRSVPPathTimeValuesType1\x1a-\n\x06\x43hoice\"#\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06type_1\x10\x01\x42\t\n\x07_choice\"n\n\x1b\x46lowRSVPPathTimeValuesType1\x12O\n\x10refresh_period_r\x18\x01 \x01(\x0b\x32\x35.otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR\"\x93\x01\n%FlowRSVPPathObjectsClassExplicitRoute\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12?\n\x06\x63_type\x18\x02 \x01(\x0b\x32/.otg.FlowRSVPPathObjectsClassExplicitRouteCType\"\xed\x01\n*FlowRSVPPathObjectsClassExplicitRouteCType\x12P\n\x06\x63hoice\x18\x01 \x01(\x0e\x32;.otg.FlowRSVPPathObjectsClassExplicitRouteCType.Choice.EnumH\x00\x88\x01\x01\x12\x33\n\x06type_1\x18\x02 \x01(\x0b\x32#.otg.FlowRSVPPathExplicitRouteType1\x1a-\n\x06\x43hoice\"#\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06type_1\x10\x01\x42\t\n\x07_choice\"_\n\x1e\x46lowRSVPPathExplicitRouteType1\x12=\n\nsubobjects\x18\x01 \x03(\x0b\x32).otg.FlowRSVPType1ExplicitRouteSubobjects\"c\n$FlowRSVPType1ExplicitRouteSubobjects\x12;\n\x04type\x18\x01 \x01(\x0b\x32-.otg.FlowRSVPType1ExplicitRouteSubobjectsType\"\xcc\x02\n(FlowRSVPType1ExplicitRouteSubobjectsType\x12N\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x39.otg.FlowRSVPType1ExplicitRouteSubobjectsType.Choice.EnumH\x00\x88\x01\x01\x12\x42\n\x0bipv4_prefix\x18\x02 \x01(\x0b\x32-.otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix\x12>\n\tas_number\x18\x03 \x01(\x0b\x32+.otg.FlowRSVPPathExplicitRouteType1ASNumber\x1a\x41\n\x06\x43hoice\"7\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0f\n\x0bipv4_prefix\x10\x01\x12\r\n\tas_number\x10\x02\x42\t\n\x07_choice\"\x9c\x02\n(FlowRSVPPathExplicitRouteType1Ipv4Prefix\x12G\n\x05l_bit\x18\x01 \x01(\x0b\x32\x38.otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit\x12\x30\n\x06length\x18\x02 \x01(\x0b\x32 .otg.FlowRSVPExplicitRouteLength\x12U\n\x0cipv4_address\x18\x03 \x01(\x0b\x32?.otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address\x12\x13\n\x06prefix\x18\x04 \x01(\rH\x00\x88\x01\x01\x42\t\n\x07_prefix\"\xcf\x01\n&FlowRSVPPathExplicitRouteType1ASNumber\x12\x45\n\x05l_bit\x18\x01 \x01(\x0b\x32\x36.otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit\x12\x38\n\x06length\x18\x02 \x01(\x0b\x32(.otg.FlowRSVPExplicitRouteASNumberLength\x12\x16\n\tas_number\x18\x03 \x01(\rH\x00\x88\x01\x01\x42\x0c\n\n_as_number\"\xdd\x01\n\x1b\x46lowRSVPExplicitRouteLength\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.FlowRSVPExplicitRouteLength.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xed\x01\n#FlowRSVPExplicitRouteASNumberLength\x12I\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x34.otg.FlowRSVPExplicitRouteASNumberLength.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\x8c\x01\n$FlowRSVPPathObjectsClassLabelRequest\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12\x39\n\x06\x63_type\x18\x02 \x01(\x0b\x32).otg.FlowRSVPPathObjectsLabelRequestCType\"\x86\x02\n$FlowRSVPPathObjectsLabelRequestCType\x12J\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x35.otg.FlowRSVPPathObjectsLabelRequestCType.Choice.EnumH\x00\x88\x01\x01\x12K\n\x13without_label_range\x18\x02 \x01(\x0b\x32..otg.FlowRSVPPathLabelRequestWithoutLabelRange\x1a:\n\x06\x43hoice\"0\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x17\n\x13without_label_range\x10\x01\x42\t\n\x07_choice\"\xc7\x01\n)FlowRSVPPathLabelRequestWithoutLabelRange\x12O\n\x08reserved\x18\x01 \x01(\x0b\x32=.otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved\x12I\n\x05l3pid\x18\x02 \x01(\x0b\x32:.otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3pid\"\x94\x01\n(FlowRSVPPathObjectsClassSessionAttribute\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12=\n\x06\x63_type\x18\x02 \x01(\x0b\x32-.otg.FlowRSVPPathObjectsSessionAttributeCType\"\xd0\x02\n(FlowRSVPPathObjectsSessionAttributeCType\x12N\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x39.otg.FlowRSVPPathObjectsSessionAttributeCType.Choice.EnumH\x00\x88\x01\x01\x12>\n\nlsp_tunnel\x18\x02 \x01(\x0b\x32*.otg.FlowRSVPPathSessionAttributeLspTunnel\x12\x43\n\rlsp_tunnel_ra\x18\x03 \x01(\x0b\x32,.otg.FlowRSVPPathSessionAttributeLspTunnelRa\x1a\x44\n\x06\x43hoice\":\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0e\n\nlsp_tunnel\x10\x01\x12\x11\n\rlsp_tunnel_ra\x10\x02\x42\t\n\x07_choice\"\xa0\x02\n%FlowRSVPPathSessionAttributeLspTunnel\x12\x1b\n\x0esetup_priority\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1d\n\x10holding_priority\x18\x02 \x01(\rH\x01\x88\x01\x01\x12)\n\x05\x66lags\x18\x03 \x01(\x0b\x32\x1a.otg.FlowRSVPLspTunnelFlag\x12<\n\x0bname_length\x18\x04 \x01(\x0b\x32\'.otg.FlowRSVPSessionAttributeNameLength\x12\x19\n\x0csession_name\x18\x05 \x01(\tH\x02\x88\x01\x01\x42\x11\n\x0f_setup_priorityB\x13\n\x11_holding_priorityB\x0f\n\r_session_name\"\xa0\x03\n\'FlowRSVPPathSessionAttributeLspTunnelRa\x12\x18\n\x0b\x65xclude_any\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0binclude_any\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0binclude_all\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x1b\n\x0esetup_priority\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1d\n\x10holding_priority\x18\x05 \x01(\rH\x04\x88\x01\x01\x12)\n\x05\x66lags\x18\x06 \x01(\x0b\x32\x1a.otg.FlowRSVPLspTunnelFlag\x12<\n\x0bname_length\x18\x07 \x01(\x0b\x32\'.otg.FlowRSVPSessionAttributeNameLength\x12\x19\n\x0csession_name\x18\x08 \x01(\tH\x05\x88\x01\x01\x42\x0e\n\x0c_exclude_anyB\x0e\n\x0c_include_anyB\x0e\n\x0c_include_allB\x11\n\x0f_setup_priorityB\x13\n\x11_holding_priorityB\x0f\n\r_session_name\"\xd3\x01\n\x15\x46lowRSVPLspTunnelFlag\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.FlowRSVPLspTunnelFlag.Choice.EnumH\x00\x88\x01\x01\x1ar\n\x06\x43hoice\"h\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1c\n\x18local_protection_desired\x10\x01\x12\x1b\n\x17label_recording_desired\x10\x02\x12\x14\n\x10se_style_desired\x10\x03\x42\t\n\x07_choice\"\xeb\x01\n\"FlowRSVPSessionAttributeNameLength\x12H\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x33.otg.FlowRSVPSessionAttributeNameLength.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\x90\x01\n&FlowRSVPPathObjectsClassSenderTemplate\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12;\n\x06\x63_type\x18\x02 \x01(\x0b\x32+.otg.FlowRSVPPathObjectsSenderTemplateCType\"\x80\x02\n&FlowRSVPPathObjectsSenderTemplateCType\x12L\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x37.otg.FlowRSVPPathObjectsSenderTemplateCType.Choice.EnumH\x00\x88\x01\x01\x12\x45\n\x0flsp_tunnel_ipv4\x18\x02 \x01(\x0b\x32,.otg.FlowRSVPPathSenderTemplateLspTunnelIpv4\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x13\n\x0flsp_tunnel_ipv4\x10\x01\x42\t\n\x07_choice\"\xb2\x02\n\'FlowRSVPPathSenderTemplateLspTunnelIpv4\x12n\n\x1aipv4_tunnel_sender_address\x18\x01 \x01(\x0b\x32J.otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress\x12M\n\x08reserved\x18\x02 \x01(\x0b\x32;.otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved\x12H\n\x06lsp_id\x18\x03 \x01(\x0b\x32\x38.otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId\"\x8a\x01\n#FlowRSVPPathObjectsClassSenderTspec\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12\x38\n\x06\x63_type\x18\x02 \x01(\x0b\x32(.otg.FlowRSVPPathObjectsSenderTspecCType\"\xe3\x01\n#FlowRSVPPathObjectsSenderTspecCType\x12I\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x34.otg.FlowRSVPPathObjectsSenderTspecCType.Choice.EnumH\x00\x88\x01\x01\x12\x35\n\x08int_serv\x18\x02 \x01(\x0b\x32#.otg.FlowRSVPPathSenderTspecIntServ\x1a/\n\x06\x43hoice\"%\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08int_serv\x10\x01\x42\t\n\x07_choice\"\xb0\t\n\x1e\x46lowRSVPPathSenderTspecIntServ\x12\x42\n\x07version\x18\x01 \x01(\x0b\x32\x31.otg.PatternFlowRSVPPathSenderTspecIntServVersion\x12\x46\n\treserved1\x18\x02 \x01(\x0b\x32\x33.otg.PatternFlowRSVPPathSenderTspecIntServReserved1\x12O\n\x0eoverall_length\x18\x03 \x01(\x0b\x32\x37.otg.PatternFlowRSVPPathSenderTspecIntServOverallLength\x12O\n\x0eservice_header\x18\x04 \x01(\x0b\x32\x37.otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader\x12\x43\n\x08zero_bit\x18\x05 \x01(\x0b\x32\x31.otg.PatternFlowRSVPPathSenderTspecIntServZeroBit\x12\x46\n\treserved2\x18\x06 \x01(\x0b\x32\x33.otg.PatternFlowRSVPPathSenderTspecIntServReserved2\x12]\n\x16length_of_service_data\x18\x07 \x01(\x0b\x32=.otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData\x12n\n\x1fparameter_id_token_bucket_tspec\x18\x08 \x01(\x0b\x32\x45.otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec\x12V\n\x12parameter_127_flag\x18\t \x01(\x0b\x32:.otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag\x12Z\n\x14parameter_127_length\x18\n \x01(\x0b\x32<.otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length\x12\x1e\n\x11token_bucket_rate\x18\x0b \x01(\x02H\x00\x88\x01\x01\x12\x1e\n\x11token_bucket_size\x18\x0c \x01(\x02H\x01\x88\x01\x01\x12\x1b\n\x0epeak_data_rate\x18\r \x01(\x02H\x02\x88\x01\x01\x12Z\n\x14minimum_policed_unit\x18\x0e \x01(\x0b\x32<.otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit\x12X\n\x13maximum_packet_size\x18\x0f \x01(\x0b\x32;.otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeB\x14\n\x12_token_bucket_rateB\x14\n\x12_token_bucket_sizeB\x11\n\x0f_peak_data_rate\"\x8a\x01\n#FlowRSVPPathObjectsClassRecordRoute\x12)\n\x06length\x18\x01 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12\x38\n\x06\x63_type\x18\x02 \x01(\x0b\x32(.otg.FlowRSVPPathObjectsRecordRouteCType\"\xdd\x01\n#FlowRSVPPathObjectsRecordRouteCType\x12I\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x34.otg.FlowRSVPPathObjectsRecordRouteCType.Choice.EnumH\x00\x88\x01\x01\x12\x31\n\x06type_1\x18\x02 \x01(\x0b\x32!.otg.FlowRSVPPathRecordRouteType1\x1a-\n\x06\x43hoice\"#\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06type_1\x10\x01\x42\t\n\x07_choice\"[\n\x1c\x46lowRSVPPathRecordRouteType1\x12;\n\nsubobjects\x18\x01 \x03(\x0b\x32\'.otg.FlowRSVPType1RecordRouteSubobjects\"d\n\"FlowRSVPType1RecordRouteSubobjects\x12>\n\x04type\x18\x01 \x01(\x0b\x32\x30.otg.FlowRSVPPathObjectsRecordRouteSubObjectType\"\xc6\x02\n+FlowRSVPPathObjectsRecordRouteSubObjectType\x12Q\n\x06\x63hoice\x18\x01 \x01(\x0e\x32<.otg.FlowRSVPPathObjectsRecordRouteSubObjectType.Choice.EnumH\x00\x88\x01\x01\x12\x42\n\x0cipv4_address\x18\x02 \x01(\x0b\x32,.otg.FlowRSVPPathRecordRouteType1Ipv4Address\x12\x35\n\x05label\x18\x03 \x01(\x0b\x32&.otg.FlowRSVPPathRecordRouteType1Label\x1a>\n\x06\x43hoice\"4\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0cipv4_address\x10\x01\x12\t\n\x05label\x10\x02\x42\t\n\x07_choice\"\xb8\x02\n\'FlowRSVPPathRecordRouteType1Ipv4Address\x12.\n\x06length\x18\x01 \x01(\x0b\x32\x1e.otg.FlowRSVPRouteRecordLength\x12T\n\x0cipv4_address\x18\x02 \x01(\x0b\x32>.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address\x12V\n\rprefix_length\x18\x03 \x01(\x0b\x32?.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength\x12/\n\x05\x66lags\x18\x04 \x01(\x0b\x32 .otg.FlowRSVPRecordRouteIPv4Flag\"\xcb\x01\n\x1b\x46lowRSVPRecordRouteIPv4Flag\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.FlowRSVPRecordRouteIPv4Flag.Choice.EnumH\x00\x88\x01\x01\x1a^\n\x06\x43hoice\"T\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1e\n\x1alocal_protection_available\x10\x01\x12\x1b\n\x17local_protection_in_use\x10\x02\x42\t\n\x07_choice\"\x8c\x02\n!FlowRSVPPathRecordRouteType1Label\x12.\n\x06length\x18\x01 \x01(\x0b\x32\x1e.otg.FlowRSVPRouteRecordLength\x12\x41\n\x05\x66lags\x18\x02 \x01(\x0b\x32\x32.otg.PatternFlowRSVPPathRecordRouteType1LabelFlags\x12\x42\n\x06\x63_type\x18\x03 \x01(\x0b\x32\x32.otg.PatternFlowRSVPPathRecordRouteType1LabelCType\x12\x30\n\x05label\x18\x04 \x01(\x0b\x32!.otg.FlowRSVPPathRecordRouteLabel\"\xf4\x01\n\x1c\x46lowRSVPPathRecordRouteLabel\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.FlowRSVPPathRecordRouteLabel.Choice.EnumH\x00\x88\x01\x01\x12\x17\n\nas_integer\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06\x61s_hex\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a=\n\x06\x43hoice\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0e\n\nas_integer\x10\x01\x12\n\n\x06\x61s_hex\x10\x02\x42\t\n\x07_choiceB\r\n\x0b_as_integerB\t\n\x07_as_hex\"\xd9\x01\n\x19\x46lowRSVPRouteRecordLength\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.FlowRSVPRouteRecordLength.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\x9d\x01\n\x19\x46lowRSVPPathObjectsCustom\x12\x37\n\x04type\x18\x01 \x01(\x0b\x32).otg.PatternFlowRSVPPathObjectsCustomType\x12)\n\x06length\x18\x02 \x01(\x0b\x32\x19.otg.FlowRSVPObjectLength\x12\x12\n\x05\x62ytes\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\x08\n\x06_bytes\"\xbe\x02\n\x08\x46lowSize\x12.\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x19.otg.FlowSize.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05\x66ixed\x18\x02 \x01(\rH\x01\x88\x01\x01\x12)\n\tincrement\x18\x03 \x01(\x0b\x32\x16.otg.FlowSizeIncrement\x12#\n\x06random\x18\x04 \x01(\x0b\x32\x13.otg.FlowSizeRandom\x12.\n\x0cweight_pairs\x18\x05 \x01(\x0b\x32\x18.otg.FlowSizeWeightPairs\x1aY\n\x06\x43hoice\"O\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05\x66ixed\x10\x01\x12\r\n\tincrement\x10\x02\x12\n\n\x06random\x10\x03\x12\x10\n\x0cweight_pairs\x10\x04\x42\t\n\x07_choiceB\x08\n\x06_fixed\"g\n\x11\x46lowSizeIncrement\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03\x65nd\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x11\n\x04step\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x06\n\x04_endB\x07\n\x05_step\"D\n\x0e\x46lowSizeRandom\x12\x10\n\x03min\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_max\"\x8d\x03\n\x13\x46lowSizeWeightPairs\x12\x39\n\x06\x63hoice\x18\x01 \x01(\x0e\x32$.otg.FlowSizeWeightPairs.Choice.EnumH\x00\x88\x01\x01\x12\x41\n\npredefined\x18\x02 \x01(\x0e\x32(.otg.FlowSizeWeightPairs.Predefined.EnumH\x01\x88\x01\x01\x12.\n\x06\x63ustom\x18\x03 \x03(\x0b\x32\x1e.otg.FlowSizeWeightPairsCustom\x1a=\n\x06\x43hoice\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0e\n\npredefined\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1ao\n\nPredefined\"a\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04imix\x10\x01\x12\x0e\n\nipsec_imix\x10\x02\x12\r\n\tipv6_imix\x10\x03\x12\x11\n\rstandard_imix\x10\x04\x12\x0c\n\x08tcp_imix\x10\x05\x42\t\n\x07_choiceB\r\n\x0b_predefined\"W\n\x19\x46lowSizeWeightPairsCustom\x12\x11\n\x04size\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x13\n\x06weight\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\x07\n\x05_sizeB\t\n\x07_weight\"\xd8\x02\n\x08\x46lowRate\x12.\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x19.otg.FlowRate.Choice.EnumH\x00\x88\x01\x01\x12\x10\n\x03pps\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x10\n\x03\x62ps\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12\x11\n\x04kbps\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x11\n\x04mbps\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x11\n\x04gbps\x18\x06 \x01(\rH\x05\x88\x01\x01\x12\x17\n\npercentage\x18\x07 \x01(\x02H\x06\x88\x01\x01\x1a\x61\n\x06\x43hoice\"W\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03pps\x10\x01\x12\x07\n\x03\x62ps\x10\x02\x12\x08\n\x04kbps\x10\x03\x12\x08\n\x04mbps\x10\x04\x12\x08\n\x04gbps\x10\x05\x12\x0e\n\npercentage\x10\x06\x42\t\n\x07_choiceB\x06\n\x04_ppsB\x06\n\x04_bpsB\x07\n\x05_kbpsB\x07\n\x05_mbpsB\x07\n\x05_gbpsB\r\n\x0b_percentage\"\xd5\x02\n\x0c\x46lowDuration\x12\x32\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1d.otg.FlowDuration.Choice.EnumH\x00\x88\x01\x01\x12,\n\rfixed_packets\x18\x02 \x01(\x0b\x32\x15.otg.FlowFixedPackets\x12,\n\rfixed_seconds\x18\x03 \x01(\x0b\x32\x15.otg.FlowFixedSeconds\x12\x1d\n\x05\x62urst\x18\x04 \x01(\x0b\x32\x0e.otg.FlowBurst\x12\'\n\ncontinuous\x18\x05 \x01(\x0b\x32\x13.otg.FlowContinuous\x1a\x62\n\x06\x43hoice\"X\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rfixed_packets\x10\x01\x12\x11\n\rfixed_seconds\x10\x02\x12\t\n\x05\x62urst\x10\x03\x12\x0e\n\ncontinuous\x10\x04\x42\t\n\x07_choice\"I\n\x0e\x46lowContinuous\x12\x10\n\x03gap\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1d\n\x05\x64\x65lay\x18\x02 \x01(\x0b\x32\x0e.otg.FlowDelayB\x06\n\x04_gap\"\x8c\x02\n\tFlowDelay\x12/\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1a.otg.FlowDelay.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05\x62ytes\x18\x02 \x01(\x02H\x01\x88\x01\x01\x12\x18\n\x0bnanoseconds\x18\x03 \x01(\x02H\x02\x88\x01\x01\x12\x19\n\x0cmicroseconds\x18\x04 \x01(\x02H\x03\x88\x01\x01\x1aO\n\x06\x43hoice\"E\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05\x62ytes\x10\x01\x12\x0f\n\x0bnanoseconds\x10\x02\x12\x10\n\x0cmicroseconds\x10\x03\x42\t\n\x07_choiceB\x08\n\x06_bytesB\x0e\n\x0c_nanosecondsB\x0f\n\r_microseconds\"m\n\x10\x46lowFixedPackets\x12\x14\n\x07packets\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03gap\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1d\n\x05\x64\x65lay\x18\x03 \x01(\x0b\x32\x0e.otg.FlowDelayB\n\n\x08_packetsB\x06\n\x04_gap\"m\n\x10\x46lowFixedSeconds\x12\x14\n\x07seconds\x18\x01 \x01(\x02H\x00\x88\x01\x01\x12\x10\n\x03gap\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1d\n\x05\x64\x65lay\x18\x03 \x01(\x0b\x32\x0e.otg.FlowDelayB\n\n\x08_secondsB\x06\n\x04_gap\"\xa0\x01\n\tFlowBurst\x12\x13\n\x06\x62ursts\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x14\n\x07packets\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x10\n\x03gap\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x37\n\x0finter_burst_gap\x18\x04 \x01(\x0b\x32\x1e.otg.FlowDurationInterBurstGapB\t\n\x07_burstsB\n\n\x08_packetsB\x06\n\x04_gap\"\xac\x02\n\x19\x46lowDurationInterBurstGap\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.FlowDurationInterBurstGap.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05\x62ytes\x18\x02 \x01(\x01H\x01\x88\x01\x01\x12\x18\n\x0bnanoseconds\x18\x03 \x01(\x01H\x02\x88\x01\x01\x12\x19\n\x0cmicroseconds\x18\x04 \x01(\x01H\x03\x88\x01\x01\x1aO\n\x06\x43hoice\"E\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05\x62ytes\x10\x01\x12\x0f\n\x0bnanoseconds\x10\x02\x12\x10\n\x0cmicroseconds\x10\x03\x42\t\n\x07_choiceB\x08\n\x06_bytesB\x0e\n\x0c_nanosecondsB\x0f\n\r_microseconds\"\xfd\x01\n\x0b\x46lowMetrics\x12\x13\n\x06\x65nable\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x11\n\x04loss\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\'\n\x0brx_tx_ratio\x18\x06 \x01(\x0b\x32\x12.otg.FlowRxTxRatio\x12\x17\n\ntimestamps\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12(\n\x07latency\x18\x04 \x01(\x0b\x32\x17.otg.FlowLatencyMetrics\x12\x37\n\x16predefined_metric_tags\x18\x05 \x01(\x0b\x32\x17.otg.FlowPredefinedTagsB\t\n\x07_enableB\x07\n\x05_lossB\r\n\x0b_timestamps\"\xb8\x01\n\x12\x46lowLatencyMetrics\x12\x13\n\x06\x65nable\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x34\n\x04mode\x18\x02 \x01(\x0e\x32!.otg.FlowLatencyMetrics.Mode.EnumH\x01\x88\x01\x01\x1a\x43\n\x04Mode\";\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rstore_forward\x10\x01\x12\x0f\n\x0b\x63ut_through\x10\x02\x42\t\n\x07_enableB\x07\n\x05_mode\"6\n\x12\x46lowPredefinedTags\x12\x14\n\x07rx_name\x18\x01 \x01(\x08H\x00\x88\x01\x01\x42\n\n\x08_rx_name\"\xd6\x01\n\rFlowRxTxRatio\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.FlowRxTxRatio.Choice.EnumH\x00\x88\x01\x01\x12+\n\x08rx_count\x18\x02 \x01(\x0b\x32\x19.otg.FlowRxTxRatioRxCount\x12\x12\n\x05value\x18\x03 \x01(\x02H\x01\x88\x01\x01\x1a:\n\x06\x43hoice\"0\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08rx_count\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x08\n\x06_value\"\x16\n\x14\x46lowRxTxRatioRxCount\"\xbf\x01\n\x05\x45vent\x12\x13\n\x06\x65nable\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x1c\n\x04link\x18\x02 \x01(\x0b\x32\x0e.otg.EventLink\x12\x34\n\x11rx_rate_threshold\x18\x03 \x01(\x0b\x32\x19.otg.EventRxRateThreshold\x12\x42\n\x18route_advertise_withdraw\x18\x04 \x01(\x0b\x32 .otg.EventRouteAdvertiseWithdrawB\t\n\x07_enable\"\\\n\x14\x45ventRxRateThreshold\x12\x13\n\x06\x65nable\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x16\n\tthreshold\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\t\n\x07_enableB\x0c\n\n_threshold\"+\n\tEventLink\x12\x13\n\x06\x65nable\x18\x01 \x01(\x08H\x00\x88\x01\x01\x42\t\n\x07_enable\"=\n\x1b\x45ventRouteAdvertiseWithdraw\x12\x13\n\x06\x65nable\x18\x01 \x01(\x08H\x00\x88\x01\x01\x42\t\n\x07_enable\"\xf5\x01\n\x0c\x45ventRequest\x12)\n\x04type\x18\x01 \x03(\x0e\x32\x1b.otg.EventRequest.Type.Enum\x12\x0e\n\x06source\x18\x02 \x03(\t\x1a\xa9\x01\n\x04Type\"\xa0\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tlink_down\x10\x01\x12\x0b\n\x07link_up\x10\x02\x12\x12\n\x0eroute_withdraw\x10\x03\x12\x13\n\x0froute_advertise\x10\x04\x12 \n\x1c\x66low_rx_rate_above_threshold\x10\x05\x12 \n\x1c\x66low_rx_rate_below_threshold\x10\x06\"b\n\x11\x45ventSubscription\x12!\n\x06\x65vents\x18\x01 \x01(\x0b\x32\x11.otg.EventRequest\x12\x19\n\x0c\x63\x61llback_url\x18\x02 \x01(\tH\x00\x88\x01\x01\x42\x0f\n\r_callback_url\"\xa5\x02\n\x04Lldp\x12\'\n\nconnection\x18\x01 \x01(\x0b\x32\x13.otg.LldpConnection\x12&\n\nchassis_id\x18\x02 \x01(\x0b\x32\x12.otg.LldpChassisId\x12 \n\x07port_id\x18\x03 \x01(\x0b\x32\x0f.otg.LldpPortId\x12(\n\x0bsystem_name\x18\x04 \x01(\x0b\x32\x13.otg.LldpSystemName\x12\x16\n\thold_time\x18\x05 \x01(\rH\x00\x88\x01\x01\x12#\n\x16\x61\x64vertisement_interval\x18\x06 \x01(\rH\x01\x88\x01\x01\x12\x11\n\x04name\x18\x07 \x01(\tH\x02\x88\x01\x01\x42\x0c\n\n_hold_timeB\x19\n\x17_advertisement_intervalB\x07\n\x05_name\"\xa9\x01\n\x0eLldpConnection\x12\x34\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1f.otg.LldpConnection.Choice.EnumH\x00\x88\x01\x01\x12\x16\n\tport_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x1a\x30\n\x06\x43hoice\"&\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tport_name\x10\x01\x42\t\n\x07_choiceB\x0c\n\n_port_name\"\xe1\x02\n\rLldpChassisId\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.LldpChassisId.Choice.EnumH\x00\x88\x01\x01\x12\x37\n\x13mac_address_subtype\x18\x02 \x01(\x0b\x32\x1a.otg.LldpChassisMacSubType\x12#\n\x16interface_name_subtype\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x1a\n\rlocal_subtype\x18\x04 \x01(\tH\x02\x88\x01\x01\x1ai\n\x06\x43hoice\"_\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x17\n\x13mac_address_subtype\x10\x01\x12\x1a\n\x16interface_name_subtype\x10\x02\x12\x11\n\rlocal_subtype\x10\x03\x42\t\n\x07_choiceB\x19\n\x17_interface_name_subtypeB\x10\n\x0e_local_subtype\"\xdf\x02\n\nLldpPortId\x12\x30\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1b.otg.LldpPortId.Choice.EnumH\x00\x88\x01\x01\x12 \n\x13mac_address_subtype\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x41\n\x16interface_name_subtype\x18\x03 \x01(\x0b\x32!.otg.LldpPortInterfaceNameSubType\x12\x1a\n\rlocal_subtype\x18\x04 \x01(\tH\x02\x88\x01\x01\x1ai\n\x06\x43hoice\"_\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x17\n\x13mac_address_subtype\x10\x01\x12\x1a\n\x16interface_name_subtype\x10\x02\x12\x11\n\rlocal_subtype\x10\x03\x42\t\n\x07_choiceB\x16\n\x14_mac_address_subtypeB\x10\n\x0e_local_subtype\"\xd1\x01\n\x15LldpChassisMacSubType\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.LldpChassisMacSubType.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xdf\x01\n\x1cLldpPortInterfaceNameSubType\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.LldpPortInterfaceNameSubType.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xc3\x01\n\x0eLldpSystemName\x12\x34\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1f.otg.LldpSystemName.Choice.EnumH\x00\x88\x01\x01\x12\x11\n\x04\x61uto\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05value\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\x36\n\x06\x43hoice\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04\x61uto\x10\x01\x12\t\n\x05value\x10\x02\x42\t\n\x07_choiceB\x07\n\x05_autoB\x08\n\x06_value\"\xa4\x01\n\x05\x45rror\x12\x11\n\x04\x63ode\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\'\n\x04kind\x18\x02 \x01(\x0e\x32\x14.otg.Error.Kind.EnumH\x01\x88\x01\x01\x12\x0e\n\x06\x65rrors\x18\x03 \x03(\t\x1a=\n\x04Kind\"5\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0e\n\nvalidation\x10\x01\x12\x0c\n\x08internal\x10\x02\x42\x07\n\x05_codeB\x07\n\x05_kind\"\x1b\n\x07Warning\x12\x10\n\x08warnings\x18\x01 \x03(\t\"\x9c\x01\n\x0c\x43onfigUpdate\x12\x32\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1d.otg.ConfigUpdate.Choice.EnumH\x00\x88\x01\x01\x12\x1f\n\x05\x66lows\x18\x02 \x01(\x0b\x32\x10.otg.FlowsUpdate\x1a,\n\x06\x43hoice\"\"\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05\x66lows\x10\x01\x42\t\n\x07_choice\"\xa2\x01\n\x0b\x46lowsUpdate\x12;\n\x0eproperty_names\x18\x01 \x03(\x0e\x32#.otg.FlowsUpdate.PropertyNames.Enum\x12\x18\n\x05\x66lows\x18\x02 \x03(\x0b\x32\t.otg.Flow\x1a<\n\rPropertyNames\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04rate\x10\x01\x12\x08\n\x04size\x10\x02\"\xfd\x01\n\x0c\x43ontrolState\x12\x32\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1d.otg.ControlState.Choice.EnumH\x00\x88\x01\x01\x12\x1c\n\x04port\x18\x02 \x01(\x0b\x32\x0e.otg.StatePort\x12$\n\x08protocol\x18\x03 \x01(\x0b\x32\x12.otg.StateProtocol\x12\"\n\x07traffic\x18\x04 \x01(\x0b\x32\x11.otg.StateTraffic\x1a\x46\n\x06\x43hoice\"<\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04port\x10\x01\x12\x0c\n\x08protocol\x10\x02\x12\x0b\n\x07traffic\x10\x03\x42\t\n\x07_choice\"\xcb\x01\n\tStatePort\x12/\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1a.otg.StatePort.Choice.EnumH\x00\x88\x01\x01\x12 \n\x04link\x18\x02 \x01(\x0b\x32\x12.otg.StatePortLink\x12&\n\x07\x63\x61pture\x18\x03 \x01(\x0b\x32\x15.otg.StatePortCapture\x1a\x38\n\x06\x43hoice\".\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04link\x10\x01\x12\x0b\n\x07\x63\x61pture\x10\x02\x42\t\n\x07_choice\"\xb9\x01\n\x0cStateTraffic\x12\x32\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1d.otg.StateTraffic.Choice.EnumH\x00\x88\x01\x01\x12\x34\n\rflow_transmit\x18\x02 \x01(\x0b\x32\x1d.otg.StateTrafficFlowTransmit\x1a\x34\n\x06\x43hoice\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rflow_transmit\x10\x01\x42\t\n\x07_choice\"\xdf\x02\n\rStateProtocol\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.StateProtocol.Choice.EnumH\x00\x88\x01\x01\x12\"\n\x03\x61ll\x18\x02 \x01(\x0b\x32\x15.otg.StateProtocolAll\x12&\n\x05route\x18\x03 \x01(\x0b\x32\x17.otg.StateProtocolRoute\x12$\n\x04lacp\x18\x04 \x01(\x0b\x32\x16.otg.StateProtocolLacp\x12\"\n\x03\x62gp\x18\x05 \x01(\x0b\x32\x15.otg.StateProtocolBgp\x12$\n\x04isis\x18\x06 \x01(\x0b\x32\x16.otg.StateProtocolIsis\x1aR\n\x06\x43hoice\"H\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03\x61ll\x10\x01\x12\t\n\x05route\x10\x02\x12\x08\n\x04lacp\x10\x03\x12\x07\n\x03\x62gp\x10\x04\x12\x08\n\x04isis\x10\x05\x42\t\n\x07_choice\"\x94\x01\n\rStatePortLink\x12\x12\n\nport_names\x18\x01 \x03(\t\x12\x31\n\x05state\x18\x02 \x01(\x0e\x32\x1d.otg.StatePortLink.State.EnumH\x00\x88\x01\x01\x1a\x32\n\x05State\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x08\n\x06_state\"\x9d\x01\n\x10StatePortCapture\x12\x12\n\nport_names\x18\x01 \x03(\t\x12\x34\n\x05state\x18\x02 \x01(\x0e\x32 .otg.StatePortCapture.State.EnumH\x00\x88\x01\x01\x1a\x35\n\x05State\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05start\x10\x01\x12\x08\n\x04stop\x10\x02\x42\x08\n\x06_state\"\xc4\x01\n\x18StateTrafficFlowTransmit\x12\x12\n\nflow_names\x18\x01 \x03(\t\x12<\n\x05state\x18\x02 \x01(\x0e\x32(.otg.StateTrafficFlowTransmit.State.EnumH\x00\x88\x01\x01\x1aL\n\x05State\"C\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05start\x10\x01\x12\x08\n\x04stop\x10\x02\x12\t\n\x05pause\x10\x03\x12\n\n\x06resume\x10\x04\x42\x08\n\x06_state\"\x89\x01\n\x10StateProtocolAll\x12\x34\n\x05state\x18\x01 \x01(\x0e\x32 .otg.StateProtocolAll.State.EnumH\x00\x88\x01\x01\x1a\x35\n\x05State\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05start\x10\x01\x12\x08\n\x04stop\x10\x02\x42\x08\n\x06_state\"\xa4\x01\n\x12StateProtocolRoute\x12\r\n\x05names\x18\x01 \x03(\t\x12\x36\n\x05state\x18\x02 \x01(\x0e\x32\".otg.StateProtocolRoute.State.EnumH\x00\x88\x01\x01\x1a=\n\x05State\"4\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08withdraw\x10\x01\x12\r\n\tadvertise\x10\x02\x42\x08\n\x06_state\"\xfc\x01\n\x11StateProtocolLacp\x12\x37\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\".otg.StateProtocolLacp.Choice.EnumH\x00\x88\x01\x01\x12*\n\x05\x61\x64min\x18\x02 \x01(\x0b\x32\x1b.otg.StateProtocolLacpAdmin\x12\x37\n\x0cmember_ports\x18\x03 \x01(\x0b\x32!.otg.StateProtocolLacpMemberPorts\x1a>\n\x06\x43hoice\"4\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05\x61\x64min\x10\x01\x12\x10\n\x0cmember_ports\x10\x02\x42\t\n\x07_choice\"\xac\x01\n\x16StateProtocolLacpAdmin\x12\x18\n\x10lag_member_names\x18\x01 \x03(\t\x12:\n\x05state\x18\x02 \x01(\x0e\x32&.otg.StateProtocolLacpAdmin.State.EnumH\x00\x88\x01\x01\x1a\x32\n\x05State\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x08\n\x06_state\"\xb8\x01\n\x1cStateProtocolLacpMemberPorts\x12\x18\n\x10lag_member_names\x18\x01 \x03(\t\x12@\n\x05state\x18\x02 \x01(\x0e\x32,.otg.StateProtocolLacpMemberPorts.State.EnumH\x00\x88\x01\x01\x1a\x32\n\x05State\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x08\n\x06_state\"\xae\x01\n\x10StateProtocolBgp\x12\x36\n\x06\x63hoice\x18\x01 \x01(\x0e\x32!.otg.StateProtocolBgp.Choice.EnumH\x00\x88\x01\x01\x12)\n\x05peers\x18\x02 \x01(\x0b\x32\x1a.otg.StateProtocolBgpPeers\x1a,\n\x06\x43hoice\"\"\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05peers\x10\x01\x42\t\n\x07_choice\"\xa4\x01\n\x15StateProtocolBgpPeers\x12\x12\n\npeer_names\x18\x01 \x03(\t\x12\x39\n\x05state\x18\x02 \x01(\x0e\x32%.otg.StateProtocolBgpPeers.State.EnumH\x00\x88\x01\x01\x1a\x32\n\x05State\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x08\n\x06_state\"\xb7\x01\n\x11StateProtocolIsis\x12\x37\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\".otg.StateProtocolIsis.Choice.EnumH\x00\x88\x01\x01\x12.\n\x07routers\x18\x02 \x01(\x0b\x32\x1d.otg.StateProtocolIsisRouters\x1a.\n\x06\x43hoice\"$\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07routers\x10\x01\x42\t\n\x07_choice\"\xac\x01\n\x18StateProtocolIsisRouters\x12\x14\n\x0crouter_names\x18\x01 \x03(\t\x12<\n\x05state\x18\x02 \x01(\x0e\x32(.otg.StateProtocolIsisRouters.State.EnumH\x00\x88\x01\x01\x1a\x32\n\x05State\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x08\n\x06_state\"\xa7\x01\n\rControlAction\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.ControlAction.Choice.EnumH\x00\x88\x01\x01\x12%\n\x08protocol\x18\x02 \x01(\x0b\x32\x13.otg.ActionProtocol\x1a/\n\x06\x43hoice\"%\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08protocol\x10\x01\x42\t\n\x07_choice\"P\n\x15\x43ontrolActionResponse\x12\x10\n\x08warnings\x18\x01 \x03(\t\x12%\n\x08response\x18\x02 \x01(\x0b\x32\x13.otg.ActionResponse\"\xb1\x01\n\x0e\x41\x63tionResponse\x12\x34\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1f.otg.ActionResponse.Choice.EnumH\x00\x88\x01\x01\x12-\n\x08protocol\x18\x02 \x01(\x0b\x32\x1b.otg.ActionResponseProtocol\x1a/\n\x06\x43hoice\"%\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08protocol\x10\x01\x42\t\n\x07_choice\"\x84\x02\n\x0e\x41\x63tionProtocol\x12\x34\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1f.otg.ActionProtocol.Choice.EnumH\x00\x88\x01\x01\x12%\n\x04ipv4\x18\x02 \x01(\x0b\x32\x17.otg.ActionProtocolIpv4\x12%\n\x04ipv6\x18\x03 \x01(\x0b\x32\x17.otg.ActionProtocolIpv6\x12#\n\x03\x62gp\x18\x04 \x01(\x0b\x32\x16.otg.ActionProtocolBgp\x1a>\n\x06\x43hoice\"4\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x12\x07\n\x03\x62gp\x10\x03\x42\t\n\x07_choice\"\xf6\x01\n\x16\x41\x63tionResponseProtocol\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.ActionResponseProtocol.Choice.EnumH\x00\x88\x01\x01\x12-\n\x04ipv4\x18\x02 \x01(\x0b\x32\x1f.otg.ActionResponseProtocolIpv4\x12-\n\x04ipv6\x18\x03 \x01(\x0b\x32\x1f.otg.ActionResponseProtocolIpv6\x1a\x35\n\x06\x43hoice\"+\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x42\t\n\x07_choice\"\xb1\x01\n\x12\x41\x63tionProtocolIpv4\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.ActionProtocolIpv4.Choice.EnumH\x00\x88\x01\x01\x12)\n\x04ping\x18\x02 \x01(\x0b\x32\x1b.otg.ActionProtocolIpv4Ping\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ping\x10\x01\x42\t\n\x07_choice\"\xc9\x01\n\x1a\x41\x63tionResponseProtocolIpv4\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.ActionResponseProtocolIpv4.Choice.EnumH\x00\x88\x01\x01\x12\x31\n\x04ping\x18\x02 \x01(\x0b\x32#.otg.ActionResponseProtocolIpv4Ping\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ping\x10\x01\x42\t\n\x07_choice\"N\n\x16\x41\x63tionProtocolIpv4Ping\x12\x34\n\x08requests\x18\x01 \x03(\x0b\x32\".otg.ActionProtocolIpv4PingRequest\"c\n\x1d\x41\x63tionProtocolIpv4PingRequest\x12\x15\n\x08src_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06\x64st_ip\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x0b\n\t_src_nameB\t\n\x07_dst_ip\"`\n\x1e\x41\x63tionResponseProtocolIpv4Ping\x12>\n\tresponses\x18\x01 \x03(\x0b\x32+.otg.ActionResponseProtocolIpv4PingResponse\"\x83\x02\n&ActionResponseProtocolIpv4PingResponse\x12\x15\n\x08src_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06\x64st_ip\x18\x02 \x01(\tH\x01\x88\x01\x01\x12L\n\x06result\x18\x03 \x01(\x0e\x32\x37.otg.ActionResponseProtocolIpv4PingResponse.Result.EnumH\x02\x88\x01\x01\x1a<\n\x06Result\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tsucceeded\x10\x01\x12\n\n\x06\x66\x61iled\x10\x02\x42\x0b\n\t_src_nameB\t\n\x07_dst_ipB\t\n\x07_result\"\xb1\x01\n\x12\x41\x63tionProtocolIpv6\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.ActionProtocolIpv6.Choice.EnumH\x00\x88\x01\x01\x12)\n\x04ping\x18\x02 \x01(\x0b\x32\x1b.otg.ActionProtocolIpv6Ping\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ping\x10\x01\x42\t\n\x07_choice\"\xc9\x01\n\x1a\x41\x63tionResponseProtocolIpv6\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.ActionResponseProtocolIpv6.Choice.EnumH\x00\x88\x01\x01\x12\x31\n\x04ping\x18\x02 \x01(\x0b\x32#.otg.ActionResponseProtocolIpv6Ping\x1a+\n\x06\x43hoice\"!\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ping\x10\x01\x42\t\n\x07_choice\"N\n\x16\x41\x63tionProtocolIpv6Ping\x12\x34\n\x08requests\x18\x01 \x03(\x0b\x32\".otg.ActionProtocolIpv6PingRequest\"c\n\x1d\x41\x63tionProtocolIpv6PingRequest\x12\x15\n\x08src_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06\x64st_ip\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\x0b\n\t_src_nameB\t\n\x07_dst_ip\"`\n\x1e\x41\x63tionResponseProtocolIpv6Ping\x12>\n\tresponses\x18\x01 \x03(\x0b\x32+.otg.ActionResponseProtocolIpv6PingResponse\"\x83\x02\n&ActionResponseProtocolIpv6PingResponse\x12\x15\n\x08src_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06\x64st_ip\x18\x02 \x01(\tH\x01\x88\x01\x01\x12L\n\x06result\x18\x03 \x01(\x0e\x32\x37.otg.ActionResponseProtocolIpv6PingResponse.Result.EnumH\x02\x88\x01\x01\x1a<\n\x06Result\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tsucceeded\x10\x01\x12\n\n\x06\x66\x61iled\x10\x02\x42\x0b\n\t_src_nameB\t\n\x07_dst_ipB\t\n\x07_result\"\xb7\x02\n\x11\x41\x63tionProtocolBgp\x12\x37\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\".otg.ActionProtocolBgp.Choice.EnumH\x00\x88\x01\x01\x12\x38\n\x0cnotification\x18\x02 \x01(\x0b\x32\".otg.ActionProtocolBgpNotification\x12P\n\x19initiate_graceful_restart\x18\x03 \x01(\x0b\x32-.otg.ActionProtocolBgpInitiateGracefulRestart\x1aR\n\x06\x43hoice\"H\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0cnotification\x10\x01\x12\x1d\n\x19initiate_graceful_restart\x10\x02\x42\t\n\x07_choice\"\xd5\x05\n\x1d\x41\x63tionProtocolBgpNotification\x12\r\n\x05names\x18\x01 \x03(\t\x12\x43\n\x06\x63hoice\x18\x02 \x01(\x0e\x32..otg.ActionProtocolBgpNotification.Choice.EnumH\x00\x88\x01\x01\x12\'\n\x05\x63\x65\x61se\x18\x03 \x01(\x0b\x32\x18.otg.DeviceBgpCeaseError\x12>\n\x14message_header_error\x18\x04 \x01(\x0b\x32 .otg.DeviceBgpMessageHeaderError\x12:\n\x12open_message_error\x18\x05 \x01(\x0b\x32\x1e.otg.DeviceBgpOpenMessageError\x12>\n\x14update_message_error\x18\x06 \x01(\x0b\x32 .otg.DeviceBgpUpdateMessageError\x12:\n\x12hold_timer_expired\x18\x07 \x01(\x0b\x32\x1e.otg.DeviceBgpHoldTimerExpired\x12I\n\x1a\x66inite_state_machine_error\x18\x08 \x01(\x0b\x32%.otg.DeviceBgpFiniteStateMachineError\x12)\n\x06\x63ustom\x18\t \x01(\x0b\x32\x19.otg.DeviceBgpCustomError\x1a\xbd\x01\n\x06\x43hoice\"\xb2\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05\x63\x65\x61se\x10\x01\x12\x18\n\x14message_header_error\x10\x02\x12\x16\n\x12open_message_error\x10\x03\x12\x18\n\x14update_message_error\x10\x04\x12\x16\n\x12hold_timer_expired\x10\x05\x12\x1e\n\x1a\x66inite_state_machine_error\x10\x06\x12\n\n\x06\x63ustom\x10\x07\x42\t\n\x07_choice\"l\n(ActionProtocolBgpInitiateGracefulRestart\x12\x12\n\npeer_names\x18\x01 \x03(\t\x12\x1a\n\rrestart_delay\x18\x02 \x01(\rH\x00\x88\x01\x01\x42\x10\n\x0e_restart_delay\"\xc8\x05\n\x0eMetricsRequest\x12\x34\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1f.otg.MetricsRequest.Choice.EnumH\x00\x88\x01\x01\x12%\n\x04port\x18\x02 \x01(\x0b\x32\x17.otg.PortMetricsRequest\x12%\n\x04\x66low\x18\x03 \x01(\x0b\x32\x17.otg.FlowMetricsRequest\x12\'\n\x05\x62gpv4\x18\x04 \x01(\x0b\x32\x18.otg.Bgpv4MetricsRequest\x12\'\n\x05\x62gpv6\x18\x05 \x01(\x0b\x32\x18.otg.Bgpv6MetricsRequest\x12%\n\x04isis\x18\x06 \x01(\x0b\x32\x17.otg.IsisMetricsRequest\x12#\n\x03lag\x18\x07 \x01(\x0b\x32\x16.otg.LagMetricsRequest\x12%\n\x04lacp\x18\x08 \x01(\x0b\x32\x17.otg.LacpMetricsRequest\x12%\n\x04lldp\x18\t \x01(\x0b\x32\x17.otg.LldpMetricsRequest\x12%\n\x04rsvp\x18\n \x01(\x0b\x32\x17.otg.RsvpMetricsRequest\x12\x36\n\rdhcpv4_client\x18\x0b \x01(\x0b\x32\x1f.otg.Dhcpv4ClientMetricsRequest\x12\x36\n\rdhcpv4_server\x18\x0c \x01(\x0b\x32\x1f.otg.Dhcpv4ServerMetricsRequest\x1a\xa3\x01\n\x06\x43hoice\"\x98\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04port\x10\x01\x12\x08\n\x04\x66low\x10\x02\x12\t\n\x05\x62gpv4\x10\x03\x12\t\n\x05\x62gpv6\x10\x04\x12\x08\n\x04isis\x10\x05\x12\x07\n\x03lag\x10\x06\x12\x08\n\x04lacp\x10\x07\x12\x08\n\x04lldp\x10\x08\x12\x08\n\x04rsvp\x10\t\x12\x11\n\rdhcpv4_client\x10\n\x12\x11\n\rdhcpv4_server\x10\x0b\x42\t\n\x07_choice\"\x90\x06\n\x0fMetricsResponse\x12\x35\n\x06\x63hoice\x18\x01 \x01(\x0e\x32 .otg.MetricsResponse.Choice.EnumH\x00\x88\x01\x01\x12%\n\x0cport_metrics\x18\x02 \x03(\x0b\x32\x0f.otg.PortMetric\x12%\n\x0c\x66low_metrics\x18\x03 \x03(\x0b\x32\x0f.otg.FlowMetric\x12\'\n\rbgpv4_metrics\x18\x04 \x03(\x0b\x32\x10.otg.Bgpv4Metric\x12\'\n\rbgpv6_metrics\x18\x05 \x03(\x0b\x32\x10.otg.Bgpv6Metric\x12%\n\x0cisis_metrics\x18\x06 \x03(\x0b\x32\x0f.otg.IsisMetric\x12#\n\x0blag_metrics\x18\x07 \x03(\x0b\x32\x0e.otg.LagMetric\x12%\n\x0clacp_metrics\x18\x08 \x03(\x0b\x32\x0f.otg.LacpMetric\x12%\n\x0clldp_metrics\x18\t \x03(\x0b\x32\x0f.otg.LldpMetric\x12%\n\x0crsvp_metrics\x18\n \x03(\x0b\x32\x0f.otg.RsvpMetric\x12\x35\n\x14\x64hcpv4client_metrics\x18\x0b \x03(\x0b\x32\x17.otg.Dhcpv4ClientMetric\x12\x35\n\x14\x64hcpv4server_metrics\x18\x0c \x03(\x0b\x32\x17.otg.Dhcpv4ServerMetric\x1a\xeb\x01\n\x06\x43hoice\"\xe0\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0c\x66low_metrics\x10\x01\x12\x10\n\x0cport_metrics\x10\x02\x12\x11\n\rbgpv4_metrics\x10\x03\x12\x11\n\rbgpv6_metrics\x10\x04\x12\x10\n\x0cisis_metrics\x10\x05\x12\x0f\n\x0blag_metrics\x10\x06\x12\x10\n\x0clacp_metrics\x10\x07\x12\x10\n\x0clldp_metrics\x10\x08\x12\x10\n\x0crsvp_metrics\x10\t\x12\x11\n\rdhcpv4_client\x10\n\x12\x11\n\rdhcpv4_server\x10\x0b\x42\t\n\x07_choice\"\xcd\x02\n\x12PortMetricsRequest\x12\x12\n\nport_names\x18\x01 \x03(\t\x12>\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32(.otg.PortMetricsRequest.ColumnNames.Enum\x1a\xe2\x01\n\x0b\x43olumnNames\"\xd2\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08transmit\x10\x01\x12\x0c\n\x08location\x10\x02\x12\x08\n\x04link\x10\x03\x12\x0b\n\x07\x63\x61pture\x10\x04\x12\r\n\tframes_tx\x10\x05\x12\r\n\tframes_rx\x10\x06\x12\x0c\n\x08\x62ytes_tx\x10\x07\x12\x0c\n\x08\x62ytes_rx\x10\x08\x12\x12\n\x0e\x66rames_tx_rate\x10\t\x12\x12\n\x0e\x66rames_rx_rate\x10\n\x12\x11\n\rbytes_tx_rate\x10\x0b\x12\x11\n\rbytes_rx_rate\x10\x0c\"\x86\x06\n\nPortMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08location\x18\x02 \x01(\tH\x01\x88\x01\x01\x12,\n\x04link\x18\x03 \x01(\x0e\x32\x19.otg.PortMetric.Link.EnumH\x02\x88\x01\x01\x12\x32\n\x07\x63\x61pture\x18\x04 \x01(\x0e\x32\x1c.otg.PortMetric.Capture.EnumH\x03\x88\x01\x01\x12\x16\n\tframes_tx\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x16\n\tframes_rx\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12\x15\n\x08\x62ytes_tx\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x15\n\x08\x62ytes_rx\x18\x08 \x01(\x04H\x07\x88\x01\x01\x12\x1b\n\x0e\x66rames_tx_rate\x18\t \x01(\x02H\x08\x88\x01\x01\x12\x1b\n\x0e\x66rames_rx_rate\x18\n \x01(\x02H\t\x88\x01\x01\x12\x1a\n\rbytes_tx_rate\x18\x0b \x01(\x02H\n\x88\x01\x01\x12\x1a\n\rbytes_rx_rate\x18\x0c \x01(\x02H\x0b\x88\x01\x01\x12\x34\n\x08transmit\x18\r \x01(\x0e\x32\x1d.otg.PortMetric.Transmit.EnumH\x0c\x88\x01\x01\x1a\x31\n\x04Link\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x1a<\n\x07\x43\x61pture\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07started\x10\x01\x12\x0b\n\x07stopped\x10\x02\x1a=\n\x08Transmit\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07started\x10\x01\x12\x0b\n\x07stopped\x10\x02\x42\x07\n\x05_nameB\x0b\n\t_locationB\x07\n\x05_linkB\n\n\x08_captureB\x0c\n\n_frames_txB\x0c\n\n_frames_rxB\x0b\n\t_bytes_txB\x0b\n\t_bytes_rxB\x11\n\x0f_frames_tx_rateB\x11\n\x0f_frames_rx_rateB\x10\n\x0e_bytes_tx_rateB\x10\n\x0e_bytes_rx_rateB\x0b\n\t_transmit\"\xb8\x02\n\x12\x46lowMetricsRequest\x12\x12\n\nflow_names\x18\x01 \x03(\t\x12>\n\x0cmetric_names\x18\x03 \x03(\x0e\x32(.otg.FlowMetricsRequest.MetricNames.Enum\x12\x34\n\x0etagged_metrics\x18\x04 \x01(\x0b\x32\x1c.otg.FlowTaggedMetricsFilter\x1a\x97\x01\n\x0bMetricNames\"\x87\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08transmit\x10\x01\x12\r\n\tframes_tx\x10\x02\x12\r\n\tframes_rx\x10\x03\x12\x0c\n\x08\x62ytes_tx\x10\x04\x12\x0c\n\x08\x62ytes_rx\x10\x05\x12\x12\n\x0e\x66rames_tx_rate\x10\x06\x12\x12\n\x0e\x66rames_rx_rate\x10\x07\"\xf4\x02\n\x17\x46lowTaggedMetricsFilter\x12\x14\n\x07include\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\"\n\x15include_empty_metrics\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x43\n\x0cmetric_names\x18\x03 \x03(\x0e\x32-.otg.FlowTaggedMetricsFilter.MetricNames.Enum\x12)\n\x07\x66ilters\x18\x04 \x03(\x0b\x32\x18.otg.FlowMetricTagFilter\x1a\x88\x01\n\x0bMetricNames\"y\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tframes_tx\x10\x01\x12\r\n\tframes_rx\x10\x02\x12\x0c\n\x08\x62ytes_tx\x10\x03\x12\x0c\n\x08\x62ytes_rx\x10\x04\x12\x12\n\x0e\x66rames_tx_rate\x10\x05\x12\x12\n\x0e\x66rames_rx_rate\x10\x06\x42\n\n\x08_includeB\x18\n\x16_include_empty_metrics\"A\n\x13\x46lowMetricTagFilter\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x0e\n\x06values\x18\x02 \x03(\tB\x07\n\x05_name\"\x88\x05\n\nFlowMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x14\n\x07port_tx\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x14\n\x07port_rx\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x34\n\x08transmit\x18\x05 \x01(\x0e\x32\x1d.otg.FlowMetric.Transmit.EnumH\x03\x88\x01\x01\x12\x16\n\tframes_tx\x18\x06 \x01(\x04H\x04\x88\x01\x01\x12\x16\n\tframes_rx\x18\x07 \x01(\x04H\x05\x88\x01\x01\x12\x15\n\x08\x62ytes_tx\x18\x08 \x01(\x04H\x06\x88\x01\x01\x12\x15\n\x08\x62ytes_rx\x18\t \x01(\x04H\x07\x88\x01\x01\x12\x1b\n\x0e\x66rames_tx_rate\x18\n \x01(\x02H\x08\x88\x01\x01\x12\x1b\n\x0e\x66rames_rx_rate\x18\x0b \x01(\x02H\t\x88\x01\x01\x12\x11\n\x04loss\x18\x0c \x01(\x02H\n\x88\x01\x01\x12(\n\ntimestamps\x18\r \x01(\x0b\x32\x14.otg.MetricTimestamp\x12#\n\x07latency\x18\x0e \x01(\x0b\x32\x12.otg.MetricLatency\x12-\n\x0etagged_metrics\x18\x0f \x03(\x0b\x32\x15.otg.FlowTaggedMetric\x1aI\n\x08Transmit\"=\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07started\x10\x01\x12\x0b\n\x07stopped\x10\x02\x12\n\n\x06paused\x10\x03\x42\x07\n\x05_nameB\n\n\x08_port_txB\n\n\x08_port_rxB\x0b\n\t_transmitB\x0c\n\n_frames_txB\x0c\n\n_frames_rxB\x0b\n\t_bytes_txB\x0b\n\t_bytes_rxB\x11\n\x0f_frames_tx_rateB\x11\n\x0f_frames_rx_rateB\x07\n\x05_loss\"\x93\x03\n\x10\x46lowTaggedMetric\x12 \n\x04tags\x18\x01 \x03(\x0b\x32\x12.otg.FlowMetricTag\x12\x16\n\tframes_tx\x18\x02 \x01(\x04H\x00\x88\x01\x01\x12\x16\n\tframes_rx\x18\x03 \x01(\x04H\x01\x88\x01\x01\x12\x15\n\x08\x62ytes_tx\x18\x04 \x01(\x04H\x02\x88\x01\x01\x12\x15\n\x08\x62ytes_rx\x18\x05 \x01(\x04H\x03\x88\x01\x01\x12\x1b\n\x0e\x66rames_tx_rate\x18\x06 \x01(\x02H\x04\x88\x01\x01\x12\x1b\n\x0e\x66rames_rx_rate\x18\x07 \x01(\x02H\x05\x88\x01\x01\x12\x11\n\x04loss\x18\x08 \x01(\x02H\x06\x88\x01\x01\x12(\n\ntimestamps\x18\t \x01(\x0b\x32\x14.otg.MetricTimestamp\x12#\n\x07latency\x18\n \x01(\x0b\x32\x12.otg.MetricLatencyB\x0c\n\n_frames_txB\x0c\n\n_frames_rxB\x0b\n\t_bytes_txB\x0b\n\t_bytes_rxB\x11\n\x0f_frames_tx_rateB\x11\n\x0f_frames_rx_rateB\x07\n\x05_loss\"S\n\rFlowMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.otg.FlowMetricTagValueB\x07\n\x05_name\"\xc2\x01\n\x12\x46lowMetricTagValue\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.FlowMetricTagValue.Choice.EnumH\x00\x88\x01\x01\x12\x10\n\x03hex\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x10\n\x03str\x18\x03 \x01(\tH\x02\x88\x01\x01\x1a\x33\n\x06\x43hoice\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03hex\x10\x01\x12\x07\n\x03str\x10\x02\x42\t\n\x07_choiceB\x06\n\x04_hexB\x06\n\x04_str\"\x7f\n\x0fMetricTimestamp\x12\x1f\n\x12\x66irst_timestamp_ns\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x1e\n\x11last_timestamp_ns\x18\x02 \x01(\x01H\x01\x88\x01\x01\x42\x15\n\x13_first_timestamp_nsB\x14\n\x12_last_timestamp_ns\"\x87\x01\n\rMetricLatency\x12\x17\n\nminimum_ns\x18\x01 \x01(\x01H\x00\x88\x01\x01\x12\x17\n\nmaximum_ns\x18\x02 \x01(\x01H\x01\x88\x01\x01\x12\x17\n\naverage_ns\x18\x03 \x01(\x01H\x02\x88\x01\x01\x42\r\n\x0b_minimum_nsB\r\n\x0b_maximum_nsB\r\n\x0b_average_ns\"\xf9\x03\n\x13\x42gpv4MetricsRequest\x12\x12\n\npeer_names\x18\x01 \x03(\t\x12?\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32).otg.Bgpv4MetricsRequest.ColumnNames.Enum\x1a\x8c\x03\n\x0b\x43olumnNames\"\xfc\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rsession_state\x10\x01\x12\x16\n\x12session_flap_count\x10\x02\x12\x15\n\x11routes_advertised\x10\x03\x12\x13\n\x0froutes_received\x10\x04\x12\x18\n\x14route_withdraws_sent\x10\x05\x12\x1c\n\x18route_withdraws_received\x10\x06\x12\x10\n\x0cupdates_sent\x10\x07\x12\x14\n\x10updates_received\x10\x08\x12\x0e\n\nopens_sent\x10\t\x12\x12\n\x0eopens_received\x10\n\x12\x13\n\x0fkeepalives_sent\x10\x0b\x12\x17\n\x13keepalives_received\x10\x0c\x12\x16\n\x12notifications_sent\x10\r\x12\x1a\n\x16notifications_received\x10\x0e\x12\r\n\tfsm_state\x10\x0f\x12\x17\n\x13\x65nd_of_rib_received\x10\x10\"\xea\x08\n\x0b\x42gpv4Metric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12>\n\rsession_state\x18\x02 \x01(\x0e\x32\".otg.Bgpv4Metric.SessionState.EnumH\x01\x88\x01\x01\x12\x1f\n\x12session_flap_count\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12\x1e\n\x11routes_advertised\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x1c\n\x0froutes_received\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12!\n\x14route_withdraws_sent\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12%\n\x18route_withdraws_received\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x19\n\x0cupdates_sent\x18\x08 \x01(\x04H\x07\x88\x01\x01\x12\x1d\n\x10updates_received\x18\t \x01(\x04H\x08\x88\x01\x01\x12\x17\n\nopens_sent\x18\n \x01(\x04H\t\x88\x01\x01\x12\x1b\n\x0eopens_received\x18\x0b \x01(\x04H\n\x88\x01\x01\x12\x1c\n\x0fkeepalives_sent\x18\x0c \x01(\x04H\x0b\x88\x01\x01\x12 \n\x13keepalives_received\x18\r \x01(\x04H\x0c\x88\x01\x01\x12\x1f\n\x12notifications_sent\x18\x0e \x01(\x04H\r\x88\x01\x01\x12#\n\x16notifications_received\x18\x0f \x01(\x04H\x0e\x88\x01\x01\x12\x36\n\tfsm_state\x18\x10 \x01(\x0e\x32\x1e.otg.Bgpv4Metric.FsmState.EnumH\x0f\x88\x01\x01\x12 \n\x13\x65nd_of_rib_received\x18\x11 \x01(\x04H\x10\x88\x01\x01\x1a\x39\n\x0cSessionState\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x1av\n\x08\x46smState\"j\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04idle\x10\x01\x12\x0b\n\x07\x63onnect\x10\x02\x12\n\n\x06\x61\x63tive\x10\x03\x12\x0c\n\x08opensent\x10\x04\x12\x0f\n\x0bopenconfirm\x10\x05\x12\x0f\n\x0b\x65stablished\x10\x06\x42\x07\n\x05_nameB\x10\n\x0e_session_stateB\x15\n\x13_session_flap_countB\x14\n\x12_routes_advertisedB\x12\n\x10_routes_receivedB\x17\n\x15_route_withdraws_sentB\x1b\n\x19_route_withdraws_receivedB\x0f\n\r_updates_sentB\x13\n\x11_updates_receivedB\r\n\x0b_opens_sentB\x11\n\x0f_opens_receivedB\x12\n\x10_keepalives_sentB\x16\n\x14_keepalives_receivedB\x15\n\x13_notifications_sentB\x19\n\x17_notifications_receivedB\x0c\n\n_fsm_stateB\x16\n\x14_end_of_rib_received\"\xf9\x03\n\x13\x42gpv6MetricsRequest\x12\x12\n\npeer_names\x18\x01 \x03(\t\x12?\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32).otg.Bgpv6MetricsRequest.ColumnNames.Enum\x1a\x8c\x03\n\x0b\x43olumnNames\"\xfc\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rsession_state\x10\x01\x12\x16\n\x12session_flap_count\x10\x02\x12\x15\n\x11routes_advertised\x10\x03\x12\x13\n\x0froutes_received\x10\x04\x12\x18\n\x14route_withdraws_sent\x10\x05\x12\x1c\n\x18route_withdraws_received\x10\x06\x12\x10\n\x0cupdates_sent\x10\x07\x12\x14\n\x10updates_received\x10\x08\x12\x0e\n\nopens_sent\x10\t\x12\x12\n\x0eopens_received\x10\n\x12\x13\n\x0fkeepalives_sent\x10\x0b\x12\x17\n\x13keepalives_received\x10\x0c\x12\x16\n\x12notifications_sent\x10\r\x12\x1a\n\x16notifications_received\x10\x0e\x12\r\n\tfsm_state\x10\x0f\x12\x17\n\x13\x65nd_of_rib_received\x10\x10\"\xea\x08\n\x0b\x42gpv6Metric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12>\n\rsession_state\x18\x02 \x01(\x0e\x32\".otg.Bgpv6Metric.SessionState.EnumH\x01\x88\x01\x01\x12\x1f\n\x12session_flap_count\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12\x1e\n\x11routes_advertised\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x1c\n\x0froutes_received\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12!\n\x14route_withdraws_sent\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12%\n\x18route_withdraws_received\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x19\n\x0cupdates_sent\x18\x08 \x01(\x04H\x07\x88\x01\x01\x12\x1d\n\x10updates_received\x18\t \x01(\x04H\x08\x88\x01\x01\x12\x17\n\nopens_sent\x18\n \x01(\x04H\t\x88\x01\x01\x12\x1b\n\x0eopens_received\x18\x0b \x01(\x04H\n\x88\x01\x01\x12\x1c\n\x0fkeepalives_sent\x18\x0c \x01(\x04H\x0b\x88\x01\x01\x12 \n\x13keepalives_received\x18\r \x01(\x04H\x0c\x88\x01\x01\x12\x1f\n\x12notifications_sent\x18\x0e \x01(\x04H\r\x88\x01\x01\x12#\n\x16notifications_received\x18\x0f \x01(\x04H\x0e\x88\x01\x01\x12\x36\n\tfsm_state\x18\x10 \x01(\x0e\x32\x1e.otg.Bgpv6Metric.FsmState.EnumH\x0f\x88\x01\x01\x12 \n\x13\x65nd_of_rib_received\x18\x11 \x01(\x04H\x10\x88\x01\x01\x1a\x39\n\x0cSessionState\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x1av\n\x08\x46smState\"j\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04idle\x10\x01\x12\x0b\n\x07\x63onnect\x10\x02\x12\n\n\x06\x61\x63tive\x10\x03\x12\x0c\n\x08opensent\x10\x04\x12\x0f\n\x0bopenconfirm\x10\x05\x12\x0f\n\x0b\x65stablished\x10\x06\x42\x07\n\x05_nameB\x10\n\x0e_session_stateB\x15\n\x13_session_flap_countB\x14\n\x12_routes_advertisedB\x12\n\x10_routes_receivedB\x17\n\x15_route_withdraws_sentB\x1b\n\x19_route_withdraws_receivedB\x0f\n\r_updates_sentB\x13\n\x11_updates_receivedB\r\n\x0b_opens_sentB\x11\n\x0f_opens_receivedB\x12\n\x10_keepalives_sentB\x16\n\x14_keepalives_receivedB\x15\n\x13_notifications_sentB\x19\n\x17_notifications_receivedB\x0c\n\n_fsm_stateB\x16\n\x14_end_of_rib_received\"\x92\x06\n\x12IsisMetricsRequest\x12\x14\n\x0crouter_names\x18\x01 \x03(\t\x12>\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32(.otg.IsisMetricsRequest.ColumnNames.Enum\x1a\xa5\x05\n\x0b\x43olumnNames\"\x95\x05\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x12\n\x0el1_sessions_up\x10\x01\x12\x13\n\x0fl1_session_flap\x10\x02\x12\x14\n\x10l1_database_size\x10\x03\x12\x1c\n\x18l1_broadcast_hellos_sent\x10\x04\x12 \n\x1cl1_broadcast_hellos_received\x10\x05\x12!\n\x1dl1_point_to_point_hellos_sent\x10\x06\x12%\n!l1_point_to_point_hellos_received\x10\x07\x12\x10\n\x0cl1_psnp_sent\x10\x08\x12\x14\n\x10l1_psnp_received\x10\t\x12\x10\n\x0cl1_csnp_sent\x10\n\x12\x14\n\x10l1_csnp_received\x10\x0b\x12\x0f\n\x0bl1_lsp_sent\x10\x0c\x12\x13\n\x0fl1_lsp_received\x10\r\x12\x12\n\x0el2_sessions_up\x10\x0e\x12\x13\n\x0fl2_session_flap\x10\x0f\x12\x14\n\x10l2_database_size\x10\x10\x12\x1c\n\x18l2_broadcast_hellos_sent\x10\x11\x12 \n\x1cl2_broadcast_hellos_received\x10\x12\x12!\n\x1dl2_point_to_point_hellos_sent\x10\x13\x12%\n!l2_point_to_point_hellos_received\x10\x14\x12\x10\n\x0cl2_psnp_sent\x10\x15\x12\x14\n\x10l2_psnp_received\x10\x16\x12\x10\n\x0cl2_csnp_sent\x10\x17\x12\x14\n\x10l2_csnp_received\x10\x18\x12\x0f\n\x0bl2_lsp_sent\x10\x19\x12\x13\n\x0fl2_lsp_received\x10\x1a\"\xf4\x0b\n\nIsisMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1b\n\x0el1_sessions_up\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1c\n\x0fl1_session_flap\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12%\n\x18l1_broadcast_hellos_sent\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12)\n\x1cl1_broadcast_hellos_received\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12*\n\x1dl1_point_to_point_hellos_sent\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12.\n!l1_point_to_point_hellos_received\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x1d\n\x10l1_database_size\x18\x08 \x01(\x04H\x07\x88\x01\x01\x12\x19\n\x0cl1_psnp_sent\x18\t \x01(\x04H\x08\x88\x01\x01\x12\x1d\n\x10l1_psnp_received\x18\n \x01(\x04H\t\x88\x01\x01\x12\x19\n\x0cl1_csnp_sent\x18\x0b \x01(\x04H\n\x88\x01\x01\x12\x1d\n\x10l1_csnp_received\x18\x0c \x01(\x04H\x0b\x88\x01\x01\x12\x18\n\x0bl1_lsp_sent\x18\r \x01(\x04H\x0c\x88\x01\x01\x12\x1c\n\x0fl1_lsp_received\x18\x0e \x01(\x04H\r\x88\x01\x01\x12\x1b\n\x0el2_sessions_up\x18\x0f \x01(\rH\x0e\x88\x01\x01\x12\x1c\n\x0fl2_session_flap\x18\x10 \x01(\x04H\x0f\x88\x01\x01\x12%\n\x18l2_broadcast_hellos_sent\x18\x11 \x01(\x04H\x10\x88\x01\x01\x12)\n\x1cl2_broadcast_hellos_received\x18\x12 \x01(\x04H\x11\x88\x01\x01\x12*\n\x1dl2_point_to_point_hellos_sent\x18\x13 \x01(\x04H\x12\x88\x01\x01\x12.\n!l2_point_to_point_hellos_received\x18\x14 \x01(\x04H\x13\x88\x01\x01\x12\x1d\n\x10l2_database_size\x18\x15 \x01(\x04H\x14\x88\x01\x01\x12\x19\n\x0cl2_psnp_sent\x18\x16 \x01(\x04H\x15\x88\x01\x01\x12\x1d\n\x10l2_psnp_received\x18\x17 \x01(\x04H\x16\x88\x01\x01\x12\x19\n\x0cl2_csnp_sent\x18\x18 \x01(\x04H\x17\x88\x01\x01\x12\x1d\n\x10l2_csnp_received\x18\x19 \x01(\x04H\x18\x88\x01\x01\x12\x18\n\x0bl2_lsp_sent\x18\x1a \x01(\x04H\x19\x88\x01\x01\x12\x1c\n\x0fl2_lsp_received\x18\x1b \x01(\x04H\x1a\x88\x01\x01\x42\x07\n\x05_nameB\x11\n\x0f_l1_sessions_upB\x12\n\x10_l1_session_flapB\x1b\n\x19_l1_broadcast_hellos_sentB\x1f\n\x1d_l1_broadcast_hellos_receivedB \n\x1e_l1_point_to_point_hellos_sentB$\n\"_l1_point_to_point_hellos_receivedB\x13\n\x11_l1_database_sizeB\x0f\n\r_l1_psnp_sentB\x13\n\x11_l1_psnp_receivedB\x0f\n\r_l1_csnp_sentB\x13\n\x11_l1_csnp_receivedB\x0e\n\x0c_l1_lsp_sentB\x12\n\x10_l1_lsp_receivedB\x11\n\x0f_l2_sessions_upB\x12\n\x10_l2_session_flapB\x1b\n\x19_l2_broadcast_hellos_sentB\x1f\n\x1d_l2_broadcast_hellos_receivedB \n\x1e_l2_point_to_point_hellos_sentB$\n\"_l2_point_to_point_hellos_receivedB\x13\n\x11_l2_database_sizeB\x0f\n\r_l2_psnp_sentB\x13\n\x11_l2_psnp_receivedB\x0f\n\r_l2_csnp_sentB\x13\n\x11_l2_csnp_receivedB\x0e\n\x0c_l2_lsp_sentB\x12\n\x10_l2_lsp_received\"\xbd\x02\n\x11LagMetricsRequest\x12\x11\n\tlag_names\x18\x01 \x03(\t\x12=\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32\'.otg.LagMetricsRequest.ColumnNames.Enum\x1a\xd5\x01\n\x0b\x43olumnNames\"\xc5\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0f\n\x0boper_status\x10\x01\x12\x13\n\x0fmember_ports_up\x10\x02\x12\r\n\tframes_tx\x10\x03\x12\r\n\tframes_rx\x10\x04\x12\x0c\n\x08\x62ytes_tx\x10\x05\x12\x0c\n\x08\x62ytes_rx\x10\x06\x12\x12\n\x0e\x66rames_tx_rate\x10\x07\x12\x12\n\x0e\x66rames_rx_rate\x10\x08\x12\x11\n\rbytes_tx_rate\x10\t\x12\x11\n\rbytes_rx_rate\x10\n\"\xac\x04\n\tLagMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x38\n\x0boper_status\x18\x02 \x01(\x0e\x32\x1e.otg.LagMetric.OperStatus.EnumH\x01\x88\x01\x01\x12\x1c\n\x0fmember_ports_up\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x16\n\tframes_tx\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x16\n\tframes_rx\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x15\n\x08\x62ytes_tx\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12\x15\n\x08\x62ytes_rx\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x1b\n\x0e\x66rames_tx_rate\x18\x08 \x01(\x02H\x07\x88\x01\x01\x12\x1b\n\x0e\x66rames_rx_rate\x18\t \x01(\x02H\x08\x88\x01\x01\x12\x1a\n\rbytes_tx_rate\x18\n \x01(\x02H\t\x88\x01\x01\x12\x1a\n\rbytes_rx_rate\x18\x0b \x01(\x02H\n\x88\x01\x01\x1a\x37\n\nOperStatus\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x07\n\x05_nameB\x0e\n\x0c_oper_statusB\x12\n\x10_member_ports_upB\x0c\n\n_frames_txB\x0c\n\n_frames_rxB\x0b\n\t_bytes_txB\x0b\n\t_bytes_rxB\x11\n\x0f_frames_tx_rateB\x11\n\x0f_frames_rx_rateB\x10\n\x0e_bytes_tx_rateB\x10\n\x0e_bytes_rx_rate\"\xb4\x03\n\x12LacpMetricsRequest\x12\x11\n\tlag_names\x18\x01 \x03(\t\x12\x1d\n\x15lag_member_port_names\x18\x02 \x03(\t\x12>\n\x0c\x63olumn_names\x18\x03 \x03(\x0e\x32(.otg.LacpMetricsRequest.ColumnNames.Enum\x1a\xab\x02\n\x0b\x43olumnNames\"\x9b\x02\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x13\n\x0flacp_packets_rx\x10\x01\x12\x13\n\x0flacp_packets_tx\x10\x02\x12\x12\n\x0elacp_rx_errors\x10\x03\x12\x0c\n\x08\x61\x63tivity\x10\x04\x12\x0b\n\x07timeout\x10\x05\x12\x13\n\x0fsynchronization\x10\x06\x12\x10\n\x0c\x61ggregatable\x10\x07\x12\x0e\n\ncollecting\x10\x08\x12\x10\n\x0c\x64istributing\x10\t\x12\r\n\tsystem_id\x10\n\x12\x0c\n\x08oper_key\x10\x0b\x12\x0e\n\npartner_id\x10\x0c\x12\x0f\n\x0bpartner_key\x10\r\x12\x0c\n\x08port_num\x10\x0e\x12\x14\n\x10partner_port_num\x10\x0f\"\x8d\x08\n\nLacpMetric\x12\x15\n\x08lag_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12!\n\x14lag_member_port_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1c\n\x0flacp_packets_rx\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12\x1c\n\x0flacp_packets_tx\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x1b\n\x0elacp_rx_errors\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x34\n\x08\x61\x63tivity\x18\x06 \x01(\x0e\x32\x1d.otg.LacpMetric.Activity.EnumH\x05\x88\x01\x01\x12\x32\n\x07timeout\x18\x07 \x01(\x0e\x32\x1c.otg.LacpMetric.Timeout.EnumH\x06\x88\x01\x01\x12\x42\n\x0fsynchronization\x18\x08 \x01(\x0e\x32$.otg.LacpMetric.Synchronization.EnumH\x07\x88\x01\x01\x12\x19\n\x0c\x61ggregatable\x18\t \x01(\x08H\x08\x88\x01\x01\x12\x17\n\ncollecting\x18\n \x01(\x08H\t\x88\x01\x01\x12\x19\n\x0c\x64istributing\x18\x0b \x01(\x08H\n\x88\x01\x01\x12\x16\n\tsystem_id\x18\x0c \x01(\tH\x0b\x88\x01\x01\x12\x15\n\x08oper_key\x18\r \x01(\rH\x0c\x88\x01\x01\x12\x17\n\npartner_id\x18\x0e \x01(\tH\r\x88\x01\x01\x12\x18\n\x0bpartner_key\x18\x0f \x01(\rH\x0e\x88\x01\x01\x12\x15\n\x08port_num\x18\x10 \x01(\rH\x0f\x88\x01\x01\x12\x1d\n\x10partner_port_num\x18\x11 \x01(\rH\x10\x88\x01\x01\x1a<\n\x08\x41\x63tivity\"0\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x61\x63tive\x10\x01\x12\x0b\n\x07passive\x10\x02\x1a\x37\n\x07Timeout\",\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05short\x10\x01\x12\x08\n\x04long\x10\x02\x1a\x45\n\x0fSynchronization\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07in_sync\x10\x01\x12\x0c\n\x08out_sync\x10\x02\x42\x0b\n\t_lag_nameB\x17\n\x15_lag_member_port_nameB\x12\n\x10_lacp_packets_rxB\x12\n\x10_lacp_packets_txB\x11\n\x0f_lacp_rx_errorsB\x0b\n\t_activityB\n\n\x08_timeoutB\x12\n\x10_synchronizationB\x0f\n\r_aggregatableB\r\n\x0b_collectingB\x0f\n\r_distributingB\x0c\n\n_system_idB\x0b\n\t_oper_keyB\r\n\x0b_partner_idB\x0e\n\x0c_partner_keyB\x0b\n\t_port_numB\x13\n\x11_partner_port_num\"\xfd\x01\n\x12LldpMetricsRequest\x12\x12\n\nlldp_names\x18\x01 \x03(\t\x12>\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32(.otg.LldpMetricsRequest.ColumnNames.Enum\x1a\x92\x01\n\x0b\x43olumnNames\"\x82\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tframes_rx\x10\x01\x12\r\n\tframes_tx\x10\x02\x12\x13\n\x0f\x66rames_error_rx\x10\x03\x12\x12\n\x0e\x66rames_discard\x10\x04\x12\x10\n\x0ctlvs_discard\x10\x05\x12\x10\n\x0ctlvs_unknown\x10\x06\"\xae\x02\n\nLldpMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x16\n\tframes_rx\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x16\n\tframes_tx\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12\x1c\n\x0f\x66rames_error_rx\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x1b\n\x0e\x66rames_discard\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x19\n\x0ctlvs_discard\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12\x19\n\x0ctlvs_unknown\x18\x07 \x01(\x04H\x06\x88\x01\x01\x42\x07\n\x05_nameB\x0c\n\n_frames_rxB\x0c\n\n_frames_txB\x12\n\x10_frames_error_rxB\x11\n\x0f_frames_discardB\x0f\n\r_tlvs_discardB\x0f\n\r_tlvs_unknown\"\xc2\x05\n\x12RsvpMetricsRequest\x12\x14\n\x0crouter_names\x18\x01 \x03(\t\x12>\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32(.otg.RsvpMetricsRequest.ColumnNames.Enum\x1a\xd5\x04\n\x0b\x43olumnNames\"\xc5\x04\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1f\n\x1bingress_p2p_lsps_configured\x10\x01\x12\x17\n\x13ingress_p2p_lsps_up\x10\x02\x12\x16\n\x12\x65gress_p2p_lsps_up\x10\x03\x12\x12\n\x0elsp_flap_count\x10\x04\x12\x0c\n\x08paths_tx\x10\x05\x12\x0c\n\x08paths_rx\x10\x06\x12\x0c\n\x08resvs_tx\x10\x07\x12\x0c\n\x08resvs_rx\x10\x08\x12\x11\n\rpath_tears_tx\x10\t\x12\x11\n\rpath_tears_rx\x10\n\x12\x11\n\rresv_tears_tx\x10\x0b\x12\x11\n\rresv_tears_rx\x10\x0c\x12\x12\n\x0epath_errors_tx\x10\r\x12\x12\n\x0epath_errors_rx\x10\x0e\x12\x12\n\x0eresv_errors_tx\x10\x0f\x12\x12\n\x0eresv_errors_rx\x10\x10\x12\x10\n\x0cresv_conf_tx\x10\x11\x12\x10\n\x0cresv_conf_rx\x10\x12\x12\r\n\thellos_tx\x10\x13\x12\r\n\thellos_rx\x10\x14\x12\x0b\n\x07\x61\x63ks_tx\x10\x15\x12\x0b\n\x07\x61\x63ks_rx\x10\x16\x12\x0c\n\x08nacks_tx\x10\x17\x12\x0c\n\x08nacks_rx\x10\x18\x12\x0f\n\x0bsrefresh_tx\x10\x19\x12\x0f\n\x0bsrefresh_rx\x10\x1a\x12\r\n\tbundle_tx\x10\x1b\x12\r\n\tbundle_rx\x10\x1c\x12 \n\x1cpath_reevaluation_request_tx\x10\x1d\x12\x18\n\x14path_reoptimizations\x10\x1e\"\xf4\n\n\nRsvpMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12(\n\x1bingress_p2p_lsps_configured\x18\x02 \x01(\rH\x01\x88\x01\x01\x12 \n\x13ingress_p2p_lsps_up\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x1f\n\x12\x65gress_p2p_lsps_up\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1b\n\x0elsp_flap_count\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x15\n\x08paths_tx\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12\x15\n\x08paths_rx\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x15\n\x08resvs_tx\x18\x08 \x01(\x04H\x07\x88\x01\x01\x12\x15\n\x08resvs_rx\x18\t \x01(\x04H\x08\x88\x01\x01\x12\x1a\n\rpath_tears_tx\x18\n \x01(\x04H\t\x88\x01\x01\x12\x1a\n\rpath_tears_rx\x18\x0b \x01(\x04H\n\x88\x01\x01\x12\x1a\n\rresv_tears_tx\x18\x0c \x01(\x04H\x0b\x88\x01\x01\x12\x1a\n\rresv_tears_rx\x18\r \x01(\x04H\x0c\x88\x01\x01\x12\x1b\n\x0epath_errors_tx\x18\x0e \x01(\x04H\r\x88\x01\x01\x12\x1b\n\x0epath_errors_rx\x18\x0f \x01(\x04H\x0e\x88\x01\x01\x12\x1b\n\x0eresv_errors_tx\x18\x10 \x01(\x04H\x0f\x88\x01\x01\x12\x1b\n\x0eresv_errors_rx\x18\x11 \x01(\x04H\x10\x88\x01\x01\x12\x19\n\x0cresv_conf_tx\x18\x12 \x01(\x04H\x11\x88\x01\x01\x12\x19\n\x0cresv_conf_rx\x18\x13 \x01(\x04H\x12\x88\x01\x01\x12\x16\n\thellos_tx\x18\x14 \x01(\x04H\x13\x88\x01\x01\x12\x16\n\thellos_rx\x18\x15 \x01(\x04H\x14\x88\x01\x01\x12\x14\n\x07\x61\x63ks_tx\x18\x16 \x01(\x04H\x15\x88\x01\x01\x12\x14\n\x07\x61\x63ks_rx\x18\x17 \x01(\x04H\x16\x88\x01\x01\x12\x15\n\x08nacks_tx\x18\x18 \x01(\x04H\x17\x88\x01\x01\x12\x15\n\x08nacks_rx\x18\x19 \x01(\x04H\x18\x88\x01\x01\x12\x18\n\x0bsrefresh_tx\x18\x1a \x01(\x04H\x19\x88\x01\x01\x12\x18\n\x0bsrefresh_rx\x18\x1b \x01(\x04H\x1a\x88\x01\x01\x12\x16\n\tbundle_tx\x18\x1c \x01(\x04H\x1b\x88\x01\x01\x12\x16\n\tbundle_rx\x18\x1d \x01(\x04H\x1c\x88\x01\x01\x12)\n\x1cpath_reevaluation_request_tx\x18\x1e \x01(\x04H\x1d\x88\x01\x01\x12!\n\x14path_reoptimizations\x18\x1f \x01(\x04H\x1e\x88\x01\x01\x42\x07\n\x05_nameB\x1e\n\x1c_ingress_p2p_lsps_configuredB\x16\n\x14_ingress_p2p_lsps_upB\x15\n\x13_egress_p2p_lsps_upB\x11\n\x0f_lsp_flap_countB\x0b\n\t_paths_txB\x0b\n\t_paths_rxB\x0b\n\t_resvs_txB\x0b\n\t_resvs_rxB\x10\n\x0e_path_tears_txB\x10\n\x0e_path_tears_rxB\x10\n\x0e_resv_tears_txB\x10\n\x0e_resv_tears_rxB\x11\n\x0f_path_errors_txB\x11\n\x0f_path_errors_rxB\x11\n\x0f_resv_errors_txB\x11\n\x0f_resv_errors_rxB\x0f\n\r_resv_conf_txB\x0f\n\r_resv_conf_rxB\x0c\n\n_hellos_txB\x0c\n\n_hellos_rxB\n\n\x08_acks_txB\n\n\x08_acks_rxB\x0b\n\t_nacks_txB\x0b\n\t_nacks_rxB\x0e\n\x0c_srefresh_txB\x0e\n\x0c_srefresh_rxB\x0c\n\n_bundle_txB\x0c\n\n_bundle_rxB\x1f\n\x1d_path_reevaluation_request_txB\x17\n\x15_path_reoptimizations\"\xad\x02\n\x1a\x44hcpv4ClientMetricsRequest\x12\x14\n\x0c\x63lient_names\x18\x01 \x03(\t\x12\x46\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32\x30.otg.Dhcpv4ClientMetricsRequest.ColumnNames.Enum\x1a\xb0\x01\n\x0b\x43olumnNames\"\xa0\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x12\n\x0e\x64iscovers_sent\x10\x01\x12\x13\n\x0foffers_received\x10\x02\x12\x11\n\rrequests_sent\x10\x03\x12\x11\n\racks_received\x10\x04\x12\x12\n\x0enacks_received\x10\x05\x12\x11\n\rreleases_sent\x10\x06\x12\x11\n\rdeclines_sent\x10\x07\"\xfa\x02\n\x12\x44hcpv4ClientMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1b\n\x0e\x64iscovers_sent\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x1c\n\x0foffers_received\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12\x1a\n\rrequests_sent\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x1a\n\racks_received\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x1b\n\x0enacks_received\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12\x1a\n\rreleases_sent\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x1a\n\rdeclines_sent\x18\x08 \x01(\x04H\x07\x88\x01\x01\x42\x07\n\x05_nameB\x11\n\x0f_discovers_sentB\x12\n\x10_offers_receivedB\x10\n\x0e_requests_sentB\x10\n\x0e_acks_receivedB\x11\n\x0f_nacks_receivedB\x10\n\x0e_releases_sentB\x10\n\x0e_declines_sent\"\xb1\x02\n\x1a\x44hcpv4ServerMetricsRequest\x12\x14\n\x0cserver_names\x18\x01 \x03(\t\x12\x46\n\x0c\x63olumn_names\x18\x02 \x03(\x0e\x32\x30.otg.Dhcpv4ServerMetricsRequest.ColumnNames.Enum\x1a\xb4\x01\n\x0b\x43olumnNames\"\xa4\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x16\n\x12\x64iscovers_received\x10\x01\x12\x0f\n\x0boffers_sent\x10\x02\x12\x15\n\x11requests_received\x10\x03\x12\r\n\tacks_sent\x10\x04\x12\x0e\n\nnacks_sent\x10\x05\x12\x15\n\x11releases_received\x10\x06\x12\x15\n\x11\x64\x65\x63lines_received\x10\x07\"\x82\x03\n\x12\x44hcpv4ServerMetric\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12\x64iscovers_received\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x18\n\x0boffers_sent\x18\x03 \x01(\x04H\x02\x88\x01\x01\x12\x1e\n\x11requests_received\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x16\n\tacks_sent\x18\x05 \x01(\x04H\x04\x88\x01\x01\x12\x17\n\nnacks_sent\x18\x06 \x01(\x04H\x05\x88\x01\x01\x12\x1e\n\x11releases_received\x18\x07 \x01(\x04H\x06\x88\x01\x01\x12\x1e\n\x11\x64\x65\x63lines_received\x18\x08 \x01(\x04H\x07\x88\x01\x01\x42\x07\n\x05_nameB\x15\n\x13_discovers_receivedB\x0e\n\x0c_offers_sentB\x14\n\x12_requests_receivedB\x0c\n\n_acks_sentB\r\n\x0b_nacks_sentB\x14\n\x12_releases_receivedB\x14\n\x12_declines_received\"\xb0\x05\n\rStatesRequest\x12\x33\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1e.otg.StatesRequest.Choice.EnumH\x00\x88\x01\x01\x12\x35\n\x0eipv4_neighbors\x18\x02 \x01(\x0b\x32\x1d.otg.Neighborsv4StatesRequest\x12\x35\n\x0eipv6_neighbors\x18\x03 \x01(\x0b\x32\x1d.otg.Neighborsv6StatesRequest\x12\x30\n\x0c\x62gp_prefixes\x18\x04 \x01(\x0b\x32\x1a.otg.BgpPrefixStateRequest\x12,\n\tisis_lsps\x18\x05 \x01(\x0b\x32\x19.otg.IsisLspsStateRequest\x12\x36\n\x0elldp_neighbors\x18\x06 \x01(\x0b\x32\x1e.otg.LldpNeighborsStateRequest\x12,\n\trsvp_lsps\x18\x07 \x01(\x0b\x32\x19.otg.RsvpLspsStateRequest\x12;\n\x11\x64hcpv4_interfaces\x18\x08 \x01(\x0b\x32 .otg.Dhcpv4InterfaceStateRequest\x12\x33\n\rdhcpv4_leases\x18\t \x01(\x0b\x32\x1c.otg.Dhcpv4LeaseStateRequest\x1a\xb8\x01\n\x06\x43hoice\"\xad\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x12\n\x0eipv4_neighbors\x10\x01\x12\x12\n\x0eipv6_neighbors\x10\x02\x12\x10\n\x0c\x62gp_prefixes\x10\x03\x12\r\n\tisis_lsps\x10\x04\x12\x12\n\x0elldp_neighbors\x10\x05\x12\r\n\trsvp_lsps\x10\x06\x12\x15\n\x11\x64hcpv4_interfaces\x10\x07\x12\x11\n\rdhcpv4_leases\x10\x08\x42\t\n\x07_choice\"\xfb\x04\n\x0eStatesResponse\x12\x34\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x1f.otg.StatesResponse.Choice.EnumH\x00\x88\x01\x01\x12-\n\x0eipv4_neighbors\x18\x02 \x03(\x0b\x32\x15.otg.Neighborsv4State\x12-\n\x0eipv6_neighbors\x18\x03 \x03(\x0b\x32\x15.otg.Neighborsv6State\x12+\n\x0c\x62gp_prefixes\x18\x04 \x03(\x0b\x32\x15.otg.BgpPrefixesState\x12%\n\tisis_lsps\x18\x05 \x03(\x0b\x32\x12.otg.IsisLspsState\x12/\n\x0elldp_neighbors\x18\x06 \x03(\x0b\x32\x17.otg.LldpNeighborsState\x12%\n\trsvp_lsps\x18\x07 \x03(\x0b\x32\x12.otg.RsvpLspsState\x12\x34\n\x11\x64hcpv4_interfaces\x18\x08 \x03(\x0b\x32\x19.otg.Dhcpv4InterfaceState\x12-\n\rdhcpv4_leases\x18\t \x03(\x0b\x32\x16.otg.Dhcpv4LeasesState\x1a\xb8\x01\n\x06\x43hoice\"\xad\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x12\n\x0eipv4_neighbors\x10\x01\x12\x12\n\x0eipv6_neighbors\x10\x02\x12\x10\n\x0c\x62gp_prefixes\x10\x03\x12\r\n\tisis_lsps\x10\x04\x12\x12\n\x0elldp_neighbors\x10\x05\x12\r\n\trsvp_lsps\x10\x06\x12\x15\n\x11\x64hcpv4_interfaces\x10\x07\x12\x11\n\rdhcpv4_leases\x10\x08\x42\t\n\x07_choice\"2\n\x18Neighborsv4StatesRequest\x12\x16\n\x0e\x65thernet_names\x18\x01 \x03(\t\"\xa4\x01\n\x10Neighborsv4State\x12\x1a\n\rethernet_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0cipv4_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1f\n\x12link_layer_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x10\n\x0e_ethernet_nameB\x0f\n\r_ipv4_addressB\x15\n\x13_link_layer_address\"2\n\x18Neighborsv6StatesRequest\x12\x16\n\x0e\x65thernet_names\x18\x01 \x03(\t\"\xa4\x01\n\x10Neighborsv6State\x12\x1a\n\rethernet_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0cipv6_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1f\n\x12link_layer_address\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x10\n\x0e_ethernet_nameB\x0f\n\r_ipv6_addressB\x15\n\x13_link_layer_address\"\xc2\x02\n\x15\x42gpPrefixStateRequest\x12\x16\n\x0e\x62gp_peer_names\x18\x01 \x03(\t\x12\x45\n\x0eprefix_filters\x18\x02 \x03(\x0e\x32-.otg.BgpPrefixStateRequest.PrefixFilters.Enum\x12=\n\x14ipv4_unicast_filters\x18\x03 \x03(\x0b\x32\x1f.otg.BgpPrefixIpv4UnicastFilter\x12=\n\x14ipv6_unicast_filters\x18\x04 \x03(\x0b\x32\x1f.otg.BgpPrefixIpv6UnicastFilter\x1aL\n\rPrefixFilters\";\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x10\n\x0cipv4_unicast\x10\x01\x12\x10\n\x0cipv6_unicast\x10\x02\"\x91\x02\n\x1a\x42gpPrefixIpv4UnicastFilter\x12\x11\n\taddresses\x18\x01 \x03(\t\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x00\x88\x01\x01\x12@\n\x06origin\x18\x03 \x01(\x0e\x32+.otg.BgpPrefixIpv4UnicastFilter.Origin.EnumH\x01\x88\x01\x01\x12\x14\n\x07path_id\x18\x04 \x01(\rH\x02\x88\x01\x01\x1a\x43\n\x06Origin\"9\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03igp\x10\x01\x12\x07\n\x03\x65gp\x10\x02\x12\x0e\n\nincomplete\x10\x03\x42\x10\n\x0e_prefix_lengthB\t\n\x07_originB\n\n\x08_path_id\"\x91\x02\n\x1a\x42gpPrefixIpv6UnicastFilter\x12\x11\n\taddresses\x18\x01 \x03(\t\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x00\x88\x01\x01\x12@\n\x06origin\x18\x03 \x01(\x0e\x32+.otg.BgpPrefixIpv6UnicastFilter.Origin.EnumH\x01\x88\x01\x01\x12\x14\n\x07path_id\x18\x04 \x01(\rH\x02\x88\x01\x01\x1a\x43\n\x06Origin\"9\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03igp\x10\x01\x12\x07\n\x03\x65gp\x10\x02\x12\x0e\n\nincomplete\x10\x03\x42\x10\n\x0e_prefix_lengthB\t\n\x07_originB\n\n\x08_path_id\"\xbe\x01\n\x10\x42gpPrefixesState\x12\x1a\n\rbgp_peer_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12=\n\x15ipv4_unicast_prefixes\x18\x02 \x03(\x0b\x32\x1e.otg.BgpPrefixIpv4UnicastState\x12=\n\x15ipv6_unicast_prefixes\x18\x03 \x03(\x0b\x32\x1e.otg.BgpPrefixIpv6UnicastStateB\x10\n\x0e_bgp_peer_name\"\x8d\x05\n\x19\x42gpPrefixIpv4UnicastState\x12\x19\n\x0cipv4_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12?\n\x06origin\x18\x03 \x01(\x0e\x32*.otg.BgpPrefixIpv4UnicastState.Origin.EnumH\x02\x88\x01\x01\x12\x14\n\x07path_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1a\n\ripv4_next_hop\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x1a\n\ripv6_next_hop\x18\x06 \x01(\tH\x05\x88\x01\x01\x12,\n\x0b\x63ommunities\x18\x07 \x03(\x0b\x32\x17.otg.ResultBgpCommunity\x12:\n\x14\x65xtended_communities\x18\x0b \x03(\x0b\x32\x1c.otg.ResultExtendedCommunity\x12%\n\x07\x61s_path\x18\x08 \x01(\x0b\x32\x14.otg.ResultBgpAsPath\x12\x1d\n\x10local_preference\x18\t \x01(\rH\x06\x88\x01\x01\x12%\n\x18multi_exit_discriminator\x18\n \x01(\rH\x07\x88\x01\x01\x1a\x43\n\x06Origin\"9\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03igp\x10\x01\x12\x07\n\x03\x65gp\x10\x02\x12\x0e\n\nincomplete\x10\x03\x42\x0f\n\r_ipv4_addressB\x10\n\x0e_prefix_lengthB\t\n\x07_originB\n\n\x08_path_idB\x10\n\x0e_ipv4_next_hopB\x10\n\x0e_ipv6_next_hopB\x13\n\x11_local_preferenceB\x1b\n\x19_multi_exit_discriminator\"\x8d\x05\n\x19\x42gpPrefixIpv6UnicastState\x12\x19\n\x0cipv6_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12?\n\x06origin\x18\x03 \x01(\x0e\x32*.otg.BgpPrefixIpv6UnicastState.Origin.EnumH\x02\x88\x01\x01\x12\x14\n\x07path_id\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1a\n\ripv4_next_hop\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x1a\n\ripv6_next_hop\x18\x06 \x01(\tH\x05\x88\x01\x01\x12,\n\x0b\x63ommunities\x18\x07 \x03(\x0b\x32\x17.otg.ResultBgpCommunity\x12:\n\x14\x65xtended_communities\x18\x0b \x03(\x0b\x32\x1c.otg.ResultExtendedCommunity\x12%\n\x07\x61s_path\x18\x08 \x01(\x0b\x32\x14.otg.ResultBgpAsPath\x12\x1d\n\x10local_preference\x18\t \x01(\rH\x06\x88\x01\x01\x12%\n\x18multi_exit_discriminator\x18\n \x01(\rH\x07\x88\x01\x01\x1a\x43\n\x06Origin\"9\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x07\n\x03igp\x10\x01\x12\x07\n\x03\x65gp\x10\x02\x12\x0e\n\nincomplete\x10\x03\x42\x0f\n\r_ipv6_addressB\x10\n\x0e_prefix_lengthB\t\n\x07_originB\n\n\x08_path_idB\x10\n\x0e_ipv4_next_hopB\x10\n\x0e_ipv6_next_hopB\x13\n\x11_local_preferenceB\x1b\n\x19_multi_exit_discriminator\"o\n\x17ResultExtendedCommunity\x12\x10\n\x03raw\x18\x01 \x01(\tH\x00\x88\x01\x01\x12:\n\nstructured\x18\x02 \x01(\x0b\x32&.otg.ResultExtendedCommunityStructuredB\x06\n\x04_raw\"\xf6\x05\n!ResultExtendedCommunityStructured\x12G\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x32.otg.ResultExtendedCommunityStructured.Choice.EnumH\x00\x88\x01\x01\x12U\n\x19transitive_2octet_as_type\x18\x02 \x01(\x0b\x32\x32.otg.ResultExtendedCommunityTransitive2OctetAsType\x12[\n\x1ctransitive_ipv4_address_type\x18\x03 \x01(\x0b\x32\x35.otg.ResultExtendedCommunityTransitiveIpv4AddressType\x12U\n\x19transitive_4octet_as_type\x18\x04 \x01(\x0b\x32\x32.otg.ResultExtendedCommunityTransitive4OctetAsType\x12P\n\x16transitive_opaque_type\x18\x05 \x01(\x0b\x32\x30.otg.ResultExtendedCommunityTransitiveOpaqueType\x12\\\n\x1dnon_transitive_2octet_as_type\x18\x06 \x01(\x0b\x32\x35.otg.ResultExtendedCommunityNonTransitive2OctetAsType\x1a\xc1\x01\n\x06\x43hoice\"\xb6\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1d\n\x19transitive_2octet_as_type\x10\x01\x12 \n\x1ctransitive_ipv4_address_type\x10\x02\x12\x1d\n\x19transitive_4octet_as_type\x10\x03\x12\x1a\n\x16transitive_opaque_type\x10\x04\x12!\n\x1dnon_transitive_2octet_as_type\x10\x05\x42\t\n\x07_choice\"\xa2\x01\n8ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget\x12\x1c\n\x0fglobal_2byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_4byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_2byte_asB\x14\n\x12_local_4byte_admin\"\xa2\x01\n8ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin\x12\x1c\n\x0fglobal_2byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_4byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_2byte_asB\x14\n\x12_local_4byte_admin\"\xa0\x03\n-ResultExtendedCommunityTransitive2OctetAsType\x12S\n\x06\x63hoice\x18\x01 \x01(\x0e\x32>.otg.ResultExtendedCommunityTransitive2OctetAsType.Choice.EnumH\x00\x88\x01\x01\x12[\n\x14route_target_subtype\x18\x02 \x01(\x0b\x32=.otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget\x12[\n\x14route_origin_subtype\x18\x03 \x01(\x0b\x32=.otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin\x1aU\n\x06\x43hoice\"K\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x18\n\x14route_target_subtype\x10\x01\x12\x18\n\x14route_origin_subtype\x10\x02\x42\t\n\x07_choice\"\xa9\x01\n;ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin\x12\x1e\n\x11global_ipv4_admin\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x14\n\x12_global_ipv4_adminB\x14\n\x12_local_2byte_admin\"\xa9\x01\n;ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget\x12\x1e\n\x11global_ipv4_admin\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x14\n\x12_global_ipv4_adminB\x14\n\x12_local_2byte_admin\"\xac\x03\n0ResultExtendedCommunityTransitiveIpv4AddressType\x12V\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x41.otg.ResultExtendedCommunityTransitiveIpv4AddressType.Choice.EnumH\x00\x88\x01\x01\x12^\n\x14route_target_subtype\x18\x02 \x01(\x0b\x32@.otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget\x12^\n\x14route_origin_subtype\x18\x03 \x01(\x0b\x32@.otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin\x1aU\n\x06\x43hoice\"K\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x18\n\x14route_target_subtype\x10\x01\x12\x18\n\x14route_origin_subtype\x10\x02\x42\t\n\x07_choice\"\xa2\x01\n8ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget\x12\x1c\n\x0fglobal_4byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_4byte_asB\x14\n\x12_local_2byte_admin\"\xa2\x01\n8ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin\x12\x1c\n\x0fglobal_4byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x1e\n\x11local_2byte_admin\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x12\n\x10_global_4byte_asB\x14\n\x12_local_2byte_admin\"\xa0\x03\n-ResultExtendedCommunityTransitive4OctetAsType\x12S\n\x06\x63hoice\x18\x01 \x01(\x0e\x32>.otg.ResultExtendedCommunityTransitive4OctetAsType.Choice.EnumH\x00\x88\x01\x01\x12[\n\x14route_target_subtype\x18\x02 \x01(\x0b\x32=.otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget\x12[\n\x14route_origin_subtype\x18\x03 \x01(\x0b\x32=.otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin\x1aU\n\x06\x43hoice\"K\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x18\n\x14route_target_subtype\x10\x01\x12\x18\n\x14route_origin_subtype\x10\x02\x42\t\n\x07_choice\"n\n0ResultExtendedCommunityTransitiveOpaqueTypeColor\x12\x12\n\x05\x66lags\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x12\n\x05\x63olor\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x08\n\x06_flagsB\x08\n\x06_color\"\x88\x01\n8ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation\x12\x15\n\x08reserved\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x18\n\x0btunnel_type\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\x0b\n\t_reservedB\x0e\n\x0c_tunnel_type\"\x88\x03\n+ResultExtendedCommunityTransitiveOpaqueType\x12Q\n\x06\x63hoice\x18\x01 \x01(\x0e\x32<.otg.ResultExtendedCommunityTransitiveOpaqueType.Choice.EnumH\x00\x88\x01\x01\x12L\n\rcolor_subtype\x18\x02 \x01(\x0b\x32\x35.otg.ResultExtendedCommunityTransitiveOpaqueTypeColor\x12\\\n\x15\x65ncapsulation_subtype\x18\x03 \x01(\x0b\x32=.otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation\x1aO\n\x06\x43hoice\"E\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x11\n\rcolor_subtype\x10\x01\x12\x19\n\x15\x65ncapsulation_subtype\x10\x02\x42\t\n\x07_choice\"\x97\x01\n=ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth\x12\x1c\n\x0fglobal_2byte_as\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tbandwidth\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\x12\n\x10_global_2byte_asB\x0c\n\n_bandwidth\"\xb8\x02\n0ResultExtendedCommunityNonTransitive2OctetAsType\x12V\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x41.otg.ResultExtendedCommunityNonTransitive2OctetAsType.Choice.EnumH\x00\x88\x01\x01\x12\x62\n\x16link_bandwidth_subtype\x18\x02 \x01(\x0b\x32\x42.otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth\x1a=\n\x06\x43hoice\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x1a\n\x16link_bandwidth_subtype\x10\x01\x42\t\n\x07_choice\"\xb0\x02\n\x12ResultBgpCommunity\x12\x34\n\x04type\x18\x01 \x01(\x0e\x32!.otg.ResultBgpCommunity.Type.EnumH\x00\x88\x01\x01\x12\x16\n\tas_number\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x16\n\tas_custom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a\x8e\x01\n\x04Type\"\x85\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x14\n\x10manual_as_number\x10\x01\x12\r\n\tno_export\x10\x02\x12\x11\n\rno_advertised\x10\x03\x12\x17\n\x13no_export_subconfed\x10\x04\x12\x0e\n\nllgr_stale\x10\x05\x12\x0b\n\x07no_llgr\x10\x06\x42\x07\n\x05_typeB\x0c\n\n_as_numberB\x0c\n\n_as_custom\"@\n\x0fResultBgpAsPath\x12-\n\x08segments\x18\x01 \x03(\x0b\x32\x1b.otg.ResultBgpAsPathSegment\"\xce\x01\n\x16ResultBgpAsPathSegment\x12\x38\n\x04type\x18\x01 \x01(\x0e\x32%.otg.ResultBgpAsPathSegment.Type.EnumH\x00\x88\x01\x01\x12\x12\n\nas_numbers\x18\x02 \x03(\r\x1a]\n\x04Type\"U\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\n\n\x06\x61s_seq\x10\x01\x12\n\n\x06\x61s_set\x10\x02\x12\x11\n\ras_confed_seq\x10\x03\x12\x11\n\ras_confed_set\x10\x04\x42\x07\n\x05_type\"1\n\x14IsisLspsStateRequest\x12\x19\n\x11isis_router_names\x18\x01 \x03(\t\"d\n\rIsisLspsState\x12\x1d\n\x10isis_router_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x04lsps\x18\x02 \x03(\x0b\x32\x11.otg.IsisLspStateB\x13\n\x11_isis_router_name\"\xa6\x03\n\x0cIsisLspState\x12\x13\n\x06lsp_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x35\n\x08pdu_type\x18\x02 \x01(\x0e\x32\x1e.otg.IsisLspState.PduType.EnumH\x01\x88\x01\x01\x12\x1f\n\x12remaining_lifetime\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x1c\n\x0fsequence_number\x18\x04 \x01(\x04H\x03\x88\x01\x01\x12\x17\n\npdu_length\x18\x05 \x01(\rH\x04\x88\x01\x01\x12 \n\x05\x66lags\x18\x06 \x01(\x0b\x32\x11.otg.IsisLspFlags\x12\x14\n\x07is_type\x18\x07 \x01(\rH\x05\x88\x01\x01\x12\x1e\n\x04tlvs\x18\x08 \x01(\x0b\x32\x10.otg.IsisLspTlvs\x1a<\n\x07PduType\"1\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0b\n\x07level_1\x10\x01\x12\x0b\n\x07level_2\x10\x02\x42\t\n\x07_lsp_idB\x0b\n\t_pdu_typeB\x15\n\x13_remaining_lifetimeB\x12\n\x10_sequence_numberB\r\n\x0b_pdu_lengthB\n\n\x08_is_type\"\xfc\x03\n\x0bIsisLspTlvs\x12+\n\rhostname_tlvs\x18\x01 \x03(\x0b\x32\x14.otg.IsisLspHostname\x12;\n\x14is_reachability_tlvs\x18\x02 \x03(\x0b\x32\x1d.otg.IsisLspIsReachabilityTlv\x12L\n\x1d\x65xtended_is_reachability_tlvs\x18\x03 \x03(\x0b\x32%.otg.IsisLspExtendedIsReachabilityTlv\x12P\n\x1fipv4_internal_reachability_tlvs\x18\x04 \x03(\x0b\x32\'.otg.IsisLspIpv4InternalReachabilityTlv\x12P\n\x1fipv4_external_reachability_tlvs\x18\x05 \x03(\x0b\x32\'.otg.IsisLspIpv4ExternalReachabilityTlv\x12P\n\x1f\x65xtended_ipv4_reachability_tlvs\x18\x06 \x03(\x0b\x32\'.otg.IsisLspExtendedIpv4ReachabilityTlv\x12?\n\x16ipv6_reachability_tlvs\x18\x07 \x03(\x0b\x32\x1f.otg.IsisLspIpv6ReachabilityTlv\"5\n\x0fIsisLspHostname\x12\x15\n\x08hostname\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0b\n\t_hostname\"\xae\x02\n\x0cIsisLspFlags\x12\x1d\n\x10partition_repair\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x1b\n\x0e\x61ttached_error\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x1d\n\x10\x61ttached_expense\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x1b\n\x0e\x61ttached_delay\x18\x04 \x01(\x08H\x03\x88\x01\x01\x12\x1d\n\x10\x61ttached_default\x18\x05 \x01(\x08H\x04\x88\x01\x01\x12\x15\n\x08overload\x18\x06 \x01(\x08H\x05\x88\x01\x01\x42\x13\n\x11_partition_repairB\x11\n\x0f_attached_errorB\x13\n\x11_attached_expenseB\x11\n\x0f_attached_delayB\x13\n\x11_attached_defaultB\x0b\n\t_overload\"C\n\x18IsisLspIsReachabilityTlv\x12\'\n\tneighbors\x18\x01 \x03(\x0b\x32\x14.otg.IsisLspneighbor\"K\n IsisLspExtendedIsReachabilityTlv\x12\'\n\tneighbors\x18\x01 \x03(\x0b\x32\x14.otg.IsisLspneighbor\"7\n\x0fIsisLspneighbor\x12\x16\n\tsystem_id\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0c\n\n_system_id\"L\n\"IsisLspIpv4InternalReachabilityTlv\x12&\n\x08prefixes\x18\x01 \x03(\x0b\x32\x14.otg.IsisLspV4Prefix\"L\n\"IsisLspIpv4ExternalReachabilityTlv\x12&\n\x08prefixes\x18\x01 \x03(\x0b\x32\x14.otg.IsisLspV4Prefix\"\xd7\x03\n\x0fIsisLspV4Prefix\x12\x19\n\x0cipv4_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12N\n\x13redistribution_type\x18\x03 \x01(\x0e\x32,.otg.IsisLspV4Prefix.RedistributionType.EnumH\x02\x88\x01\x01\x12\x1b\n\x0e\x64\x65\x66\x61ult_metric\x18\x04 \x01(\rH\x03\x88\x01\x01\x12>\n\x0borigin_type\x18\x05 \x01(\x0e\x32$.otg.IsisLspV4Prefix.OriginType.EnumH\x04\x88\x01\x01\x1a?\n\x12RedistributionType\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x1a\x41\n\nOriginType\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08internal\x10\x01\x12\x0c\n\x08\x65xternal\x10\x02\x42\x0f\n\r_ipv4_addressB\x10\n\x0e_prefix_lengthB\x16\n\x14_redistribution_typeB\x11\n\x0f_default_metricB\x0e\n\x0c_origin_type\"T\n\"IsisLspExtendedIpv4ReachabilityTlv\x12.\n\x08prefixes\x18\x01 \x03(\x0b\x32\x1c.otg.IsisLspExtendedV4Prefix\"\xfd\x02\n\x17IsisLspExtendedV4Prefix\x12\x19\n\x0cipv4_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06metric\x18\x03 \x01(\rH\x02\x88\x01\x01\x12V\n\x13redistribution_type\x18\x04 \x01(\x0e\x32\x34.otg.IsisLspExtendedV4Prefix.RedistributionType.EnumH\x03\x88\x01\x01\x12\x37\n\x11prefix_attributes\x18\x05 \x01(\x0b\x32\x1c.otg.IsisLspPrefixAttributes\x1a?\n\x12RedistributionType\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x42\x0f\n\r_ipv4_addressB\x10\n\x0e_prefix_lengthB\t\n\x07_metricB\x16\n\x14_redistribution_type\"D\n\x1aIsisLspIpv6ReachabilityTlv\x12&\n\x08prefixes\x18\x01 \x03(\x0b\x32\x14.otg.IsisLspV6Prefix\"\x80\x04\n\x0fIsisLspV6Prefix\x12\x19\n\x0cipv6_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06metric\x18\x03 \x01(\rH\x02\x88\x01\x01\x12N\n\x13redistribution_type\x18\x04 \x01(\x0e\x32,.otg.IsisLspV6Prefix.RedistributionType.EnumH\x03\x88\x01\x01\x12>\n\x0borigin_type\x18\x05 \x01(\x0e\x32$.otg.IsisLspV6Prefix.OriginType.EnumH\x04\x88\x01\x01\x12\x37\n\x11prefix_attributes\x18\x06 \x01(\x0b\x32\x1c.otg.IsisLspPrefixAttributes\x1a?\n\x12RedistributionType\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x1a\x41\n\nOriginType\"3\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0c\n\x08internal\x10\x01\x12\x0c\n\x08\x65xternal\x10\x02\x42\x0f\n\r_ipv6_addressB\x10\n\x0e_prefix_lengthB\t\n\x07_metricB\x16\n\x14_redistribution_typeB\x0e\n\x0c_origin_type\"y\n\x17IsisLspPrefixAttributes\x12\x13\n\x06x_flag\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\x13\n\x06r_flag\x18\x02 \x01(\x08H\x01\x88\x01\x01\x12\x13\n\x06n_flag\x18\x03 \x01(\x08H\x02\x88\x01\x01\x42\t\n\x07_x_flagB\t\n\x07_r_flagB\t\n\x07_n_flag\"L\n\x19LldpNeighborsStateRequest\x12\x12\n\nlldp_names\x18\x01 \x03(\t\x12\x1b\n\x13neighbor_id_filters\x18\x02 \x03(\t\"\x8b\t\n\x12LldpNeighborsState\x12\x16\n\tlldp_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0bsystem_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1f\n\x12system_description\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x17\n\nchassis_id\x18\x04 \x01(\tH\x03\x88\x01\x01\x12H\n\x0f\x63hassis_id_type\x18\x05 \x01(\x0e\x32*.otg.LldpNeighborsState.ChassisIdType.EnumH\x04\x88\x01\x01\x12\x18\n\x0bneighbor_id\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\x10\n\x03\x61ge\x18\x07 \x01(\rH\x06\x88\x01\x01\x12\x18\n\x0blast_update\x18\x08 \x01(\rH\x07\x88\x01\x01\x12\x10\n\x03ttl\x18\t \x01(\rH\x08\x88\x01\x01\x12\x14\n\x07port_id\x18\n \x01(\tH\t\x88\x01\x01\x12\x42\n\x0cport_id_type\x18\x0b \x01(\x0e\x32\'.otg.LldpNeighborsState.PortIdType.EnumH\n\x88\x01\x01\x12\x1d\n\x10port_description\x18\x0c \x01(\tH\x0b\x88\x01\x01\x12\x1f\n\x12management_address\x18\r \x01(\tH\x0c\x88\x01\x01\x12$\n\x17management_address_type\x18\x0e \x01(\tH\r\x88\x01\x01\x12,\n\x0b\x63ustom_tlvs\x18\x0f \x03(\x0b\x32\x17.otg.LldpCustomTLVState\x12.\n\x0c\x63\x61pabilities\x18\x10 \x03(\x0b\x32\x18.otg.LldpCapabilityState\x1a\xae\x01\n\rChassisIdType\"\x9c\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x12\n\x0eport_component\x10\x01\x12\x13\n\x0fnetwork_address\x10\x02\x12\x15\n\x11\x63hassis_component\x10\x03\x12\x0f\n\x0bmac_address\x10\x04\x12\x12\n\x0einterface_name\x10\x05\x12\t\n\x05local\x10\x06\x12\x13\n\x0finterface_alias\x10\x07\x1a\xaa\x01\n\nPortIdType\"\x9b\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x12\n\x0eport_component\x10\x01\x12\x13\n\x0fnetwork_address\x10\x02\x12\x14\n\x10\x61gent_circuit_id\x10\x03\x12\x0f\n\x0bmac_address\x10\x04\x12\x12\n\x0einterface_name\x10\x05\x12\t\n\x05local\x10\x06\x12\x13\n\x0finterface_alias\x10\x07\x42\x0c\n\n_lldp_nameB\x0e\n\x0c_system_nameB\x15\n\x13_system_descriptionB\r\n\x0b_chassis_idB\x12\n\x10_chassis_id_typeB\x0e\n\x0c_neighbor_idB\x06\n\x04_ageB\x0e\n\x0c_last_updateB\x06\n\x04_ttlB\n\n\x08_port_idB\x0f\n\r_port_id_typeB\x13\n\x11_port_descriptionB\x15\n\x13_management_addressB\x1a\n\x18_management_address_type\"\x82\x01\n\x12LldpCustomTLVState\x12\x18\n\x0b\x63ustom_type\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03oui\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0boui_subtype\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x0e\n\x0c_custom_typeB\x06\n\x04_ouiB\x0e\n\x0c_oui_subtype\"\x90\x03\n\x13LldpCapabilityState\x12J\n\x0f\x63\x61pability_name\x18\x01 \x01(\x0e\x32,.otg.LldpCapabilityState.CapabilityName.EnumH\x00\x88\x01\x01\x12\x1f\n\x12\x63\x61pability_enabled\x18\x02 \x01(\x08H\x01\x88\x01\x01\x1a\xe0\x01\n\x0e\x43\x61pabilityName\"\xcd\x01\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x0e\n\nmac_bridge\x10\x01\x12\x16\n\x12two_port_mac_relay\x10\x02\x12\x0c\n\x08repeater\x10\x03\x12\x17\n\x13\x64ocsis_cable_device\x10\x04\x12\n\n\x06s_vlan\x10\x05\x12\r\n\ttelephone\x10\x06\x12\t\n\x05other\x10\x07\x12\n\n\x06router\x10\x08\x12\n\n\x06\x63_vlan\x10\t\x12\x10\n\x0cstation_only\x10\n\x12\x15\n\x11wlan_access_point\x10\x0b\x42\x12\n\x10_capability_nameB\x15\n\x13_capability_enabled\"1\n\x14RsvpLspsStateRequest\x12\x19\n\x11rsvp_router_names\x18\x01 \x03(\t\"m\n\rRsvpLspsState\x12\x1d\n\x10rsvp_router_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12(\n\tipv4_lsps\x18\x02 \x03(\x0b\x32\x15.otg.RsvpIPv4LspStateB\x13\n\x11_rsvp_router_name\"\xe2\x01\n\x10RsvpIPv4LspState\x12\x1b\n\x0esource_address\x18\x01 \x01(\tH\x00\x88\x01\x01\x12 \n\x13\x64\x65stination_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1e\n\x03lsp\x18\x03 \x01(\x0b\x32\x11.otg.RsvpLspState\x12!\n\x04rros\x18\x04 \x03(\x0b\x32\x13.otg.RsvpLspIpv4Rro\x12!\n\x04\x65ros\x18\x05 \x03(\x0b\x32\x13.otg.RsvpLspIpv4EroB\x11\n\x0f_source_addressB\x16\n\x14_destination_address\"\xb4\x04\n\x0cRsvpLspState\x12\x16\n\ttunnel_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x13\n\x06lsp_id\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x19\n\x0csession_name\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x15\n\x08label_in\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x16\n\tlabel_out\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x41\n\x0esession_status\x18\x06 \x01(\x0e\x32$.otg.RsvpLspState.SessionStatus.EnumH\x05\x88\x01\x01\x12\x44\n\x10last_flap_reason\x18\x07 \x01(\x0e\x32%.otg.RsvpLspState.LastFlapReason.EnumH\x06\x88\x01\x01\x12\x14\n\x07up_time\x18\x08 \x01(\x04H\x07\x88\x01\x01\x1a:\n\rSessionStatus\")\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x06\n\x02up\x10\x01\x12\x08\n\x04\x64own\x10\x02\x1aY\n\x0eLastFlapReason\"G\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tresv_tear\x10\x01\x12\r\n\tpath_tear\x10\x02\x12\x10\n\x0cpath_timeout\x10\x03\x42\x0c\n\n_tunnel_idB\t\n\x07_lsp_idB\x0f\n\r_session_nameB\x0b\n\t_label_inB\x0c\n\n_label_outB\x11\n\x0f_session_statusB\x13\n\x11_last_flap_reasonB\n\n\x08_up_time\"b\n\x0eRsvpLspIpv4Rro\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1b\n\x0ereported_label\x18\x02 \x01(\rH\x01\x88\x01\x01\x42\n\n\x08_addressB\x11\n\x0f_reported_label\"\xf2\x01\n\x0eRsvpLspIpv4Ero\x12\x13\n\x06prefix\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x10\n\x03\x61sn\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x30\n\x04type\x18\x03 \x01(\x0e\x32\x1d.otg.RsvpLspIpv4Ero.Type.EnumH\x02\x88\x01\x01\x1ak\n\x04Type\"c\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04ipv4\x10\x01\x12\x08\n\x04ipv6\x10\x02\x12\x07\n\x03\x61sn\x10\x03\x12\x08\n\x04\x61sn4\x10\x04\x12\t\n\x05label\x10\x05\x12\x18\n\x14unnumbered_interface\x10\x06\x42\t\n\x07_prefixB\x06\n\x04_asnB\x07\n\x05_type\"8\n\x1b\x44hcpv4InterfaceStateRequest\x12\x19\n\x11\x64hcp_client_names\x18\x01 \x03(\t\"\xd0\x02\n\x14\x44hcpv4InterfaceState\x12\x1d\n\x10\x64hcp_client_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x19\n\x0cipv4_address\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1a\n\rprefix_length\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x1c\n\x0fgateway_address\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x17\n\nlease_time\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x17\n\nrenew_time\x18\x06 \x01(\rH\x05\x88\x01\x01\x12\x18\n\x0brebind_time\x18\x07 \x01(\rH\x06\x88\x01\x01\x42\x13\n\x11_dhcp_client_nameB\x0f\n\r_ipv4_addressB\x10\n\x0e_prefix_lengthB\x12\n\x10_gateway_addressB\r\n\x0b_lease_timeB\r\n\x0b_renew_timeB\x0e\n\x0c_rebind_time\"4\n\x17\x44hcpv4LeaseStateRequest\x12\x19\n\x11\x64hcp_server_names\x18\x01 \x03(\t\"n\n\x11\x44hcpv4LeasesState\x12\x1d\n\x10\x64hcp_server_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12%\n\x06leases\x18\x02 \x03(\x0b\x32\x15.otg.Dhcpv4LeaseStateB\x13\n\x11_dhcp_server_name\"\xd2\x02\n\x10\x44hcpv4LeaseState\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x17\n\nvalid_time\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x1b\n\x0epreferred_time\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x17\n\nrenew_time\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x18\n\x0brebind_time\x18\x05 \x01(\rH\x04\x88\x01\x01\x12\x16\n\tclient_id\x18\x06 \x01(\tH\x05\x88\x01\x01\x12\x17\n\ncircuit_id\x18\x07 \x01(\tH\x06\x88\x01\x01\x12\x16\n\tremote_id\x18\x08 \x01(\tH\x07\x88\x01\x01\x42\n\n\x08_addressB\r\n\x0b_valid_timeB\x11\n\x0f_preferred_timeB\r\n\x0b_renew_timeB\x0e\n\x0c_rebind_timeB\x0c\n\n_client_idB\r\n\x0b_circuit_idB\x0c\n\n_remote_id\"6\n\x0e\x43\x61ptureRequest\x12\x16\n\tport_name\x18\x01 \x01(\tH\x00\x88\x01\x01\x42\x0c\n\n_port_name\"w\n\x1dPatternFlowEthernetDstCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowEthernetDstMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb6\x03\n\x16PatternFlowEthernetDst\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowEthernetDst.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x11\n\x04\x61uto\x18\x04 \x01(\tH\x02\x88\x01\x01\x12\x35\n\tincrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowEthernetDstCounter\x12\x35\n\tdecrement\x18\x07 \x01(\x0b\x32\".otg.PatternFlowEthernetDstCounter\x12\x39\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32$.otg.PatternFlowEthernetDstMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"w\n\x1dPatternFlowEthernetSrcCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowEthernetSrcMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowEthernetSrc\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowEthernetSrc.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowEthernetSrcCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowEthernetSrcCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowEthernetSrcMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowEthernetEtherTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowEthernetEtherTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xd4\x03\n\x1cPatternFlowEthernetEtherType\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowEthernetEtherType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12;\n\tincrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowEthernetEtherTypeCounter\x12;\n\tdecrement\x18\x07 \x01(\x0b\x32(.otg.PatternFlowEthernetEtherTypeCounter\x12?\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32*.otg.PatternFlowEthernetEtherTypeMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"|\n\"PatternFlowEthernetPfcQueueCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowEthernetPfcQueueMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowEthernetPfcQueue\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowEthernetPfcQueue.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowEthernetPfcQueueCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowEthernetPfcQueueCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowEthernetPfcQueueMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowVlanPriorityCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowVlanPriorityMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowVlanPriority\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowVlanPriority.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowVlanPriorityCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowVlanPriorityCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowVlanPriorityMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"s\n\x19PatternFlowVlanCfiCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"y\n\x1bPatternFlowVlanCfiMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xfc\x02\n\x12PatternFlowVlanCfi\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.PatternFlowVlanCfi.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x31\n\tincrement\x18\x05 \x01(\x0b\x32\x1e.otg.PatternFlowVlanCfiCounter\x12\x31\n\tdecrement\x18\x06 \x01(\x0b\x32\x1e.otg.PatternFlowVlanCfiCounter\x12\x35\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32 .otg.PatternFlowVlanCfiMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"r\n\x18PatternFlowVlanIdCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"x\n\x1aPatternFlowVlanIdMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xf7\x02\n\x11PatternFlowVlanId\x12\x37\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\".otg.PatternFlowVlanId.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x30\n\tincrement\x18\x05 \x01(\x0b\x32\x1d.otg.PatternFlowVlanIdCounter\x12\x30\n\tdecrement\x18\x06 \x01(\x0b\x32\x1d.otg.PatternFlowVlanIdCounter\x12\x34\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x1f.otg.PatternFlowVlanIdMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"t\n\x1aPatternFlowVlanTpidCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"z\n\x1cPatternFlowVlanTpidMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x81\x03\n\x13PatternFlowVlanTpid\x12\x39\n\x06\x63hoice\x18\x01 \x01(\x0e\x32$.otg.PatternFlowVlanTpid.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x32\n\tincrement\x18\x05 \x01(\x0b\x32\x1f.otg.PatternFlowVlanTpidCounter\x12\x32\n\tdecrement\x18\x06 \x01(\x0b\x32\x1f.otg.PatternFlowVlanTpidCounter\x12\x36\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32!.otg.PatternFlowVlanTpidMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowVxlanFlagsCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowVxlanFlagsMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowVxlanFlags\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowVxlanFlags.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowVxlanFlagsCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowVxlanFlagsCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowVxlanFlagsMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"z\n PatternFlowVxlanReserved0Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x80\x01\n\"PatternFlowVxlanReserved0MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9f\x03\n\x19PatternFlowVxlanReserved0\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowVxlanReserved0.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x38\n\tincrement\x18\x05 \x01(\x0b\x32%.otg.PatternFlowVxlanReserved0Counter\x12\x38\n\tdecrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowVxlanReserved0Counter\x12<\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\'.otg.PatternFlowVxlanReserved0MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"t\n\x1aPatternFlowVxlanVniCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"z\n\x1cPatternFlowVxlanVniMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa7\x03\n\x13PatternFlowVxlanVni\x12\x39\n\x06\x63hoice\x18\x01 \x01(\x0e\x32$.otg.PatternFlowVxlanVni.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x32\n\tincrement\x18\x06 \x01(\x0b\x32\x1f.otg.PatternFlowVxlanVniCounter\x12\x32\n\tdecrement\x18\x07 \x01(\x0b\x32\x1f.otg.PatternFlowVxlanVniCounter\x12\x36\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32!.otg.PatternFlowVxlanVniMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"z\n PatternFlowVxlanReserved1Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x80\x01\n\"PatternFlowVxlanReserved1MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9f\x03\n\x19PatternFlowVxlanReserved1\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowVxlanReserved1.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x38\n\tincrement\x18\x05 \x01(\x0b\x32%.otg.PatternFlowVxlanReserved1Counter\x12\x38\n\tdecrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowVxlanReserved1Counter\x12<\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\'.otg.PatternFlowVxlanReserved1MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowIpv4VersionCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowIpv4VersionMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowIpv4Version\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowIpv4Version.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowIpv4VersionCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowIpv4VersionCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowIpv4VersionMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"|\n\"PatternFlowIpv4HeaderLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowIpv4HeaderLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xcf\x03\n\x1bPatternFlowIpv4HeaderLength\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowIpv4HeaderLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12:\n\tincrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowIpv4HeaderLengthCounter\x12:\n\tdecrement\x18\x07 \x01(\x0b\x32\'.otg.PatternFlowIpv4HeaderLengthCounter\x12>\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32).otg.PatternFlowIpv4HeaderLengthMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"{\n!PatternFlowIpv4TotalLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x81\x01\n#PatternFlowIpv4TotalLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xca\x03\n\x1aPatternFlowIpv4TotalLength\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.PatternFlowIpv4TotalLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x39\n\tincrement\x18\x06 \x01(\x0b\x32&.otg.PatternFlowIpv4TotalLengthCounter\x12\x39\n\tdecrement\x18\x07 \x01(\x0b\x32&.otg.PatternFlowIpv4TotalLengthCounter\x12=\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32(.otg.PatternFlowIpv4TotalLengthMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"~\n$PatternFlowIpv4IdentificationCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowIpv4IdentificationMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowIpv4Identification\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIpv4Identification.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowIpv4IdentificationCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowIpv4IdentificationCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowIpv4IdentificationMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowIpv4ReservedCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowIpv4ReservedMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowIpv4Reserved\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowIpv4Reserved.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowIpv4ReservedCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowIpv4ReservedCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowIpv4ReservedMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"|\n\"PatternFlowIpv4DontFragmentCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowIpv4DontFragmentMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowIpv4DontFragment\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowIpv4DontFragment.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowIpv4DontFragmentCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowIpv4DontFragmentCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowIpv4DontFragmentMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowIpv4MoreFragmentsCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowIpv4MoreFragmentsMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowIpv4MoreFragments\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowIpv4MoreFragments.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowIpv4MoreFragmentsCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowIpv4MoreFragmentsCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowIpv4MoreFragmentsMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"~\n$PatternFlowIpv4FragmentOffsetCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowIpv4FragmentOffsetMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowIpv4FragmentOffset\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIpv4FragmentOffset.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowIpv4FragmentOffsetCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowIpv4FragmentOffsetCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowIpv4FragmentOffsetMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"z\n PatternFlowIpv4TimeToLiveCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x80\x01\n\"PatternFlowIpv4TimeToLiveMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9f\x03\n\x19PatternFlowIpv4TimeToLive\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowIpv4TimeToLive.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x38\n\tincrement\x18\x05 \x01(\x0b\x32%.otg.PatternFlowIpv4TimeToLiveCounter\x12\x38\n\tdecrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowIpv4TimeToLiveCounter\x12<\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\'.otg.PatternFlowIpv4TimeToLiveMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowIpv4ProtocolCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowIpv4ProtocolMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xbb\x03\n\x17PatternFlowIpv4Protocol\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowIpv4Protocol.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x36\n\tincrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowIpv4ProtocolCounter\x12\x36\n\tdecrement\x18\x07 \x01(\x0b\x32#.otg.PatternFlowIpv4ProtocolCounter\x12:\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32%.otg.PatternFlowIpv4ProtocolMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"\xdf\x02\n\x1dPatternFlowIpv4HeaderChecksum\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIpv4HeaderChecksum.Choice.EnumH\x00\x88\x01\x01\x12I\n\tgenerated\x18\x02 \x01(\x0e\x32\x31.otg.PatternFlowIpv4HeaderChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"s\n\x19PatternFlowIpv4SrcCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"y\n\x1bPatternFlowIpv4SrcMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x88\x01\n\x18PatternFlowIpv4SrcRandom\x12\x10\n\x03min\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x11\n\x04seed\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_maxB\x07\n\x05_seedB\x08\n\x06_count\"\xe2\x03\n\x12PatternFlowIpv4Src\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.PatternFlowIpv4Src.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x31\n\tincrement\x18\x05 \x01(\x0b\x32\x1e.otg.PatternFlowIpv4SrcCounter\x12\x31\n\tdecrement\x18\x06 \x01(\x0b\x32\x1e.otg.PatternFlowIpv4SrcCounter\x12\x35\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32 .otg.PatternFlowIpv4SrcMetricTag\x12\x1f\n\x04\x61uto\x18\x08 \x01(\x0b\x32\x11.otg.FlowIpv4Auto\x12-\n\x06random\x18\t \x01(\x0b\x32\x1d.otg.PatternFlowIpv4SrcRandom\x1al\n\x06\x43hoice\"b\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x12\x08\n\x04\x61uto\x10\x01\x12\n\n\x06random\x10\x06\x42\t\n\x07_choiceB\x08\n\x06_value\"s\n\x19PatternFlowIpv4DstCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"y\n\x1bPatternFlowIpv4DstMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x88\x01\n\x18PatternFlowIpv4DstRandom\x12\x10\n\x03min\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x11\n\x04seed\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_maxB\x07\n\x05_seedB\x08\n\x06_count\"\xe2\x03\n\x12PatternFlowIpv4Dst\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.PatternFlowIpv4Dst.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x31\n\tincrement\x18\x05 \x01(\x0b\x32\x1e.otg.PatternFlowIpv4DstCounter\x12\x31\n\tdecrement\x18\x06 \x01(\x0b\x32\x1e.otg.PatternFlowIpv4DstCounter\x12\x35\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32 .otg.PatternFlowIpv4DstMetricTag\x12\x1f\n\x04\x61uto\x18\x08 \x01(\x0b\x32\x11.otg.FlowIpv4Auto\x12-\n\x06random\x18\t \x01(\x0b\x32\x1d.otg.PatternFlowIpv4DstRandom\x1al\n\x06\x43hoice\"b\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x12\x08\n\x04\x61uto\x10\x01\x12\n\n\x06random\x10\x06\x42\t\n\x07_choiceB\x08\n\x06_value\"\x8b\x01\n1PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xa5\x03\n*PatternFlowIpv4OptionsCustomTypeCopiedFlag\x12P\n\x06\x63hoice\x18\x01 \x01(\x0e\x32;.otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12I\n\tincrement\x18\x05 \x01(\x0b\x32\x36.otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter\x12I\n\tdecrement\x18\x06 \x01(\x0b\x32\x36.otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x8c\x01\n2PatternFlowIpv4OptionsCustomTypeOptionClassCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xa9\x03\n+PatternFlowIpv4OptionsCustomTypeOptionClass\x12Q\n\x06\x63hoice\x18\x01 \x01(\x0e\x32<.otg.PatternFlowIpv4OptionsCustomTypeOptionClass.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12J\n\tincrement\x18\x05 \x01(\x0b\x32\x37.otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter\x12J\n\tdecrement\x18\x06 \x01(\x0b\x32\x37.otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x8d\x01\n3PatternFlowIpv4OptionsCustomTypeOptionNumberCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xad\x03\n,PatternFlowIpv4OptionsCustomTypeOptionNumber\x12R\n\x06\x63hoice\x18\x01 \x01(\x0e\x32=.otg.PatternFlowIpv4OptionsCustomTypeOptionNumber.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12K\n\tincrement\x18\x05 \x01(\x0b\x32\x38.otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter\x12K\n\tdecrement\x18\x06 \x01(\x0b\x32\x38.otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"{\n!PatternFlowIpv4PriorityRawCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x81\x01\n#PatternFlowIpv4PriorityRawMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa4\x03\n\x1aPatternFlowIpv4PriorityRaw\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.PatternFlowIpv4PriorityRaw.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x39\n\tincrement\x18\x05 \x01(\x0b\x32&.otg.PatternFlowIpv4PriorityRawCounter\x12\x39\n\tdecrement\x18\x06 \x01(\x0b\x32&.otg.PatternFlowIpv4PriorityRawCounter\x12=\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32(.otg.PatternFlowIpv4PriorityRawMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowIpv4DscpPhbCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowIpv4DscpPhbMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowIpv4DscpPhb\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowIpv4DscpPhb.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowIpv4DscpPhbCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowIpv4DscpPhbCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowIpv4DscpPhbMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowIpv4DscpEcnCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowIpv4DscpEcnMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowIpv4DscpEcn\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowIpv4DscpEcn.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowIpv4DscpEcnCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowIpv4DscpEcnCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowIpv4DscpEcnMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowIpv4TosPrecedenceCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowIpv4TosPrecedenceMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowIpv4TosPrecedence\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowIpv4TosPrecedence.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowIpv4TosPrecedenceCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowIpv4TosPrecedenceCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowIpv4TosPrecedenceMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowIpv4TosDelayCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowIpv4TosDelayMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowIpv4TosDelay\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowIpv4TosDelay.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowIpv4TosDelayCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowIpv4TosDelayCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowIpv4TosDelayMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowIpv4TosThroughputCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowIpv4TosThroughputMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowIpv4TosThroughput\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowIpv4TosThroughput.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowIpv4TosThroughputCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowIpv4TosThroughputCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowIpv4TosThroughputMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"~\n$PatternFlowIpv4TosReliabilityCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowIpv4TosReliabilityMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowIpv4TosReliability\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIpv4TosReliability.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowIpv4TosReliabilityCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowIpv4TosReliabilityCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowIpv4TosReliabilityMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"{\n!PatternFlowIpv4TosMonetaryCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x81\x01\n#PatternFlowIpv4TosMonetaryMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa4\x03\n\x1aPatternFlowIpv4TosMonetary\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.PatternFlowIpv4TosMonetary.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x39\n\tincrement\x18\x05 \x01(\x0b\x32&.otg.PatternFlowIpv4TosMonetaryCounter\x12\x39\n\tdecrement\x18\x06 \x01(\x0b\x32&.otg.PatternFlowIpv4TosMonetaryCounter\x12=\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32(.otg.PatternFlowIpv4TosMonetaryMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"y\n\x1fPatternFlowIpv4TosUnusedCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x7f\n!PatternFlowIpv4TosUnusedMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9a\x03\n\x18PatternFlowIpv4TosUnused\x12>\n\x06\x63hoice\x18\x01 \x01(\x0e\x32).otg.PatternFlowIpv4TosUnused.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x37\n\tincrement\x18\x05 \x01(\x0b\x32$.otg.PatternFlowIpv4TosUnusedCounter\x12\x37\n\tdecrement\x18\x06 \x01(\x0b\x32$.otg.PatternFlowIpv4TosUnusedCounter\x12;\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32&.otg.PatternFlowIpv4TosUnusedMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowIpv6VersionCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowIpv6VersionMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowIpv6Version\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowIpv6Version.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowIpv6VersionCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowIpv6VersionCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowIpv6VersionMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"|\n\"PatternFlowIpv6TrafficClassCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowIpv6TrafficClassMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowIpv6TrafficClass\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowIpv6TrafficClass.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowIpv6TrafficClassCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowIpv6TrafficClassCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowIpv6TrafficClassMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"y\n\x1fPatternFlowIpv6FlowLabelCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x7f\n!PatternFlowIpv6FlowLabelMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8e\x01\n\x1ePatternFlowIpv6FlowLabelRandom\x12\x10\n\x03min\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x11\n\x04seed\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_maxB\x07\n\x05_seedB\x08\n\x06_count\"\xdb\x03\n\x18PatternFlowIpv6FlowLabel\x12>\n\x06\x63hoice\x18\x01 \x01(\x0e\x32).otg.PatternFlowIpv6FlowLabel.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x37\n\tincrement\x18\x05 \x01(\x0b\x32$.otg.PatternFlowIpv6FlowLabelCounter\x12\x37\n\tdecrement\x18\x06 \x01(\x0b\x32$.otg.PatternFlowIpv6FlowLabelCounter\x12;\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32&.otg.PatternFlowIpv6FlowLabelMetricTag\x12\x33\n\x06random\x18\x08 \x01(\x0b\x32#.otg.PatternFlowIpv6FlowLabelRandom\x1a\x62\n\x06\x43hoice\"X\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x12\n\n\x06random\x10\x06\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowIpv6PayloadLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowIpv6PayloadLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xd4\x03\n\x1cPatternFlowIpv6PayloadLength\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowIpv6PayloadLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12;\n\tincrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowIpv6PayloadLengthCounter\x12;\n\tdecrement\x18\x07 \x01(\x0b\x32(.otg.PatternFlowIpv6PayloadLengthCounter\x12?\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32*.otg.PatternFlowIpv6PayloadLengthMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"z\n PatternFlowIpv6NextHeaderCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x80\x01\n\"PatternFlowIpv6NextHeaderMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc5\x03\n\x19PatternFlowIpv6NextHeader\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowIpv6NextHeader.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x38\n\tincrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowIpv6NextHeaderCounter\x12\x38\n\tdecrement\x18\x07 \x01(\x0b\x32%.otg.PatternFlowIpv6NextHeaderCounter\x12<\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32\'.otg.PatternFlowIpv6NextHeaderMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"x\n\x1ePatternFlowIpv6HopLimitCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowIpv6HopLimitMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowIpv6HopLimit\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowIpv6HopLimit.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowIpv6HopLimitCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowIpv6HopLimitCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowIpv6HopLimitMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"s\n\x19PatternFlowIpv6SrcCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"y\n\x1bPatternFlowIpv6SrcMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xfc\x02\n\x12PatternFlowIpv6Src\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.PatternFlowIpv6Src.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x31\n\tincrement\x18\x05 \x01(\x0b\x32\x1e.otg.PatternFlowIpv6SrcCounter\x12\x31\n\tdecrement\x18\x06 \x01(\x0b\x32\x1e.otg.PatternFlowIpv6SrcCounter\x12\x35\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32 .otg.PatternFlowIpv6SrcMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"s\n\x19PatternFlowIpv6DstCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"y\n\x1bPatternFlowIpv6DstMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xfc\x02\n\x12PatternFlowIpv6Dst\x12\x38\n\x06\x63hoice\x18\x01 \x01(\x0e\x32#.otg.PatternFlowIpv6Dst.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x31\n\tincrement\x18\x05 \x01(\x0b\x32\x1e.otg.PatternFlowIpv6DstCounter\x12\x31\n\tdecrement\x18\x06 \x01(\x0b\x32\x1e.otg.PatternFlowIpv6DstCounter\x12\x35\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32 .otg.PatternFlowIpv6DstMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowPfcPauseDstCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowPfcPauseDstMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowPfcPauseDst\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowPfcPauseDst.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowPfcPauseDstCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowPfcPauseDstCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowPfcPauseDstMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowPfcPauseSrcCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowPfcPauseSrcMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowPfcPauseSrc\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowPfcPauseSrc.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowPfcPauseSrcCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowPfcPauseSrcCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowPfcPauseSrcMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowPfcPauseEtherTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowPfcPauseEtherTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowPfcPauseEtherType\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowPfcPauseEtherType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowPfcPauseEtherTypeCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowPfcPauseEtherTypeCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowPfcPauseEtherTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x81\x01\n\'PatternFlowPfcPauseControlOpCodeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x87\x01\n)PatternFlowPfcPauseControlOpCodeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc2\x03\n PatternFlowPfcPauseControlOpCode\x12\x46\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x31.otg.PatternFlowPfcPauseControlOpCode.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12?\n\tincrement\x18\x05 \x01(\x0b\x32,.otg.PatternFlowPfcPauseControlOpCodeCounter\x12?\n\tdecrement\x18\x06 \x01(\x0b\x32,.otg.PatternFlowPfcPauseControlOpCodeCounter\x12\x43\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32..otg.PatternFlowPfcPauseControlOpCodeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x85\x01\n+PatternFlowPfcPauseClassEnableVectorCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8b\x01\n-PatternFlowPfcPauseClassEnableVectorMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xd6\x03\n$PatternFlowPfcPauseClassEnableVector\x12J\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x35.otg.PatternFlowPfcPauseClassEnableVector.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x43\n\tincrement\x18\x05 \x01(\x0b\x32\x30.otg.PatternFlowPfcPauseClassEnableVectorCounter\x12\x43\n\tdecrement\x18\x06 \x01(\x0b\x32\x30.otg.PatternFlowPfcPauseClassEnableVectorCounter\x12G\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x32.otg.PatternFlowPfcPauseClassEnableVectorMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass0Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass0MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass0\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass0.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass0Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass0Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass0MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass1Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass1MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass1\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass1.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass1Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass1Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass1MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass2Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass2MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass2\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass2.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass2Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass2Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass2MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass3Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass3MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass3\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass3.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass3Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass3Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass3MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass4Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass4MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass4\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass4.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass4Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass4Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass4MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass5Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass5MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass5\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass5.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass5Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass5Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass5MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass6Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass6MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass6\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass6.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass6Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass6Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass6MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowPfcPausePauseClass7Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowPfcPausePauseClass7MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowPfcPausePauseClass7\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowPfcPausePauseClass7.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass7Counter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowPfcPausePauseClass7Counter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowPfcPausePauseClass7MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"|\n\"PatternFlowEthernetPauseDstCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowEthernetPauseDstMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowEthernetPauseDst\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowEthernetPauseDst.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowEthernetPauseDstCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowEthernetPauseDstCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowEthernetPauseDstMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"|\n\"PatternFlowEthernetPauseSrcCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowEthernetPauseSrcMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowEthernetPauseSrc\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowEthernetPauseSrc.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowEthernetPauseSrcCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowEthernetPauseSrcCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowEthernetPauseSrcMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x82\x01\n(PatternFlowEthernetPauseEtherTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x88\x01\n*PatternFlowEthernetPauseEtherTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc7\x03\n!PatternFlowEthernetPauseEtherType\x12G\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x32.otg.PatternFlowEthernetPauseEtherType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12@\n\tincrement\x18\x05 \x01(\x0b\x32-.otg.PatternFlowEthernetPauseEtherTypeCounter\x12@\n\tdecrement\x18\x06 \x01(\x0b\x32-.otg.PatternFlowEthernetPauseEtherTypeCounter\x12\x44\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32/.otg.PatternFlowEthernetPauseEtherTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x86\x01\n,PatternFlowEthernetPauseControlOpCodeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8c\x01\n.PatternFlowEthernetPauseControlOpCodeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xdb\x03\n%PatternFlowEthernetPauseControlOpCode\x12K\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x36.otg.PatternFlowEthernetPauseControlOpCode.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x44\n\tincrement\x18\x05 \x01(\x0b\x32\x31.otg.PatternFlowEthernetPauseControlOpCodeCounter\x12\x44\n\tdecrement\x18\x06 \x01(\x0b\x32\x31.otg.PatternFlowEthernetPauseControlOpCodeCounter\x12H\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x33.otg.PatternFlowEthernetPauseControlOpCodeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowEthernetPauseTimeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowEthernetPauseTimeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowEthernetPauseTime\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowEthernetPauseTime.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowEthernetPauseTimeCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowEthernetPauseTimeCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowEthernetPauseTimeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowTcpSrcPortCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowTcpSrcPortMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x01\n\x1bPatternFlowTcpSrcPortRandom\x12\x10\n\x03min\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x11\n\x04seed\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_maxB\x07\n\x05_seedB\x08\n\x06_count\"\xc9\x03\n\x15PatternFlowTcpSrcPort\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowTcpSrcPort.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowTcpSrcPortCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowTcpSrcPortCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowTcpSrcPortMetricTag\x12\x30\n\x06random\x18\x08 \x01(\x0b\x32 .otg.PatternFlowTcpSrcPortRandom\x1a\x62\n\x06\x43hoice\"X\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x12\n\n\x06random\x10\x06\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowTcpDstPortCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowTcpDstPortMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x01\n\x1bPatternFlowTcpDstPortRandom\x12\x10\n\x03min\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x11\n\x04seed\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_maxB\x07\n\x05_seedB\x08\n\x06_count\"\xc9\x03\n\x15PatternFlowTcpDstPort\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowTcpDstPort.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowTcpDstPortCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowTcpDstPortCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowTcpDstPortMetricTag\x12\x30\n\x06random\x18\x08 \x01(\x0b\x32 .otg.PatternFlowTcpDstPortRandom\x1a\x62\n\x06\x43hoice\"X\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x12\n\n\x06random\x10\x06\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpSeqNumCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpSeqNumMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpSeqNum\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpSeqNum.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpSeqNumCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpSeqNumCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpSeqNumMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpAckNumCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpAckNumMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpAckNum\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpAckNum.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpAckNumCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpAckNumCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpAckNumMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"y\n\x1fPatternFlowTcpDataOffsetCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x7f\n!PatternFlowTcpDataOffsetMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9a\x03\n\x18PatternFlowTcpDataOffset\x12>\n\x06\x63hoice\x18\x01 \x01(\x0e\x32).otg.PatternFlowTcpDataOffset.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x37\n\tincrement\x18\x05 \x01(\x0b\x32$.otg.PatternFlowTcpDataOffsetCounter\x12\x37\n\tdecrement\x18\x06 \x01(\x0b\x32$.otg.PatternFlowTcpDataOffsetCounter\x12;\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32&.otg.PatternFlowTcpDataOffsetMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"t\n\x1aPatternFlowTcpEcnNsCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"z\n\x1cPatternFlowTcpEcnNsMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x81\x03\n\x13PatternFlowTcpEcnNs\x12\x39\n\x06\x63hoice\x18\x01 \x01(\x0e\x32$.otg.PatternFlowTcpEcnNs.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x32\n\tincrement\x18\x05 \x01(\x0b\x32\x1f.otg.PatternFlowTcpEcnNsCounter\x12\x32\n\tdecrement\x18\x06 \x01(\x0b\x32\x1f.otg.PatternFlowTcpEcnNsCounter\x12\x36\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32!.otg.PatternFlowTcpEcnNsMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpEcnCwrCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpEcnCwrMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpEcnCwr\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpEcnCwr.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpEcnCwrCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpEcnCwrCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpEcnCwrMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowTcpEcnEchoCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowTcpEcnEchoMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowTcpEcnEcho\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowTcpEcnEcho.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowTcpEcnEchoCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowTcpEcnEchoCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowTcpEcnEchoMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpCtlUrgCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpCtlUrgMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpCtlUrg\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpCtlUrg.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpCtlUrgCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpCtlUrgCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpCtlUrgMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpCtlAckCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpCtlAckMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpCtlAck\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpCtlAck.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpCtlAckCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpCtlAckCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpCtlAckMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpCtlPshCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpCtlPshMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpCtlPsh\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpCtlPsh.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpCtlPshCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpCtlPshCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpCtlPshMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpCtlRstCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpCtlRstMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpCtlRst\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpCtlRst.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpCtlRstCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpCtlRstCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpCtlRstMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpCtlSynCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpCtlSynMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpCtlSyn\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpCtlSyn.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpCtlSynCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpCtlSynCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpCtlSynMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpCtlFinCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpCtlFinMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpCtlFin\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpCtlFin.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpCtlFinCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpCtlFinCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpCtlFinMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowTcpWindowCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowTcpWindowMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowTcpWindow\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowTcpWindow.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowTcpWindowCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowTcpWindowCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowTcpWindowMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xca\x02\n\x16PatternFlowTcpChecksum\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowTcpChecksum.Choice.EnumH\x00\x88\x01\x01\x12\x42\n\tgenerated\x18\x02 \x01(\x0e\x32*.otg.PatternFlowTcpChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"v\n\x1cPatternFlowUdpSrcPortCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowUdpSrcPortMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x01\n\x1bPatternFlowUdpSrcPortRandom\x12\x10\n\x03min\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x11\n\x04seed\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_maxB\x07\n\x05_seedB\x08\n\x06_count\"\xc9\x03\n\x15PatternFlowUdpSrcPort\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowUdpSrcPort.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowUdpSrcPortCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowUdpSrcPortCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowUdpSrcPortMetricTag\x12\x30\n\x06random\x18\x08 \x01(\x0b\x32 .otg.PatternFlowUdpSrcPortRandom\x1a\x62\n\x06\x43hoice\"X\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x12\n\n\x06random\x10\x06\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowUdpDstPortCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowUdpDstPortMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x01\n\x1bPatternFlowUdpDstPortRandom\x12\x10\n\x03min\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x10\n\x03max\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x11\n\x04seed\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x04 \x01(\rH\x03\x88\x01\x01\x42\x06\n\x04_minB\x06\n\x04_maxB\x07\n\x05_seedB\x08\n\x06_count\"\xc9\x03\n\x15PatternFlowUdpDstPort\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowUdpDstPort.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowUdpDstPortCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowUdpDstPortCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowUdpDstPortMetricTag\x12\x30\n\x06random\x18\x08 \x01(\x0b\x32 .otg.PatternFlowUdpDstPortRandom\x1a\x62\n\x06\x43hoice\"X\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x12\n\n\x06random\x10\x06\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowUdpLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowUdpLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowUdpLength\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowUdpLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowUdpLengthCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowUdpLengthCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowUdpLengthMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xca\x02\n\x16PatternFlowUdpChecksum\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowUdpChecksum.Choice.EnumH\x00\x88\x01\x01\x12\x42\n\tgenerated\x18\x02 \x01(\x0e\x32*.otg.PatternFlowUdpChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"~\n$PatternFlowGreChecksumPresentCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowGreChecksumPresentMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowGreChecksumPresent\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowGreChecksumPresent.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowGreChecksumPresentCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowGreChecksumPresentCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowGreChecksumPresentMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowGreReserved0Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowGreReserved0MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowGreReserved0\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowGreReserved0.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowGreReserved0Counter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowGreReserved0Counter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowGreReserved0MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowGreVersionCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowGreVersionMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowGreVersion\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowGreVersion.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowGreVersionCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowGreVersionCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowGreVersionMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowGreProtocolCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowGreProtocolMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowGreProtocol\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowGreProtocol.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowGreProtocolCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowGreProtocolCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowGreProtocolMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xca\x02\n\x16PatternFlowGreChecksum\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowGreChecksum.Choice.EnumH\x00\x88\x01\x01\x12\x42\n\tgenerated\x18\x02 \x01(\x0e\x32*.otg.PatternFlowGreChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"x\n\x1ePatternFlowGreReserved1Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowGreReserved1MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowGreReserved1\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowGreReserved1.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowGreReserved1Counter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowGreReserved1Counter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowGreReserved1MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowGtpv1VersionCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowGtpv1VersionMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowGtpv1Version\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowGtpv1Version.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowGtpv1VersionCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowGtpv1VersionCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowGtpv1VersionMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowGtpv1ProtocolTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowGtpv1ProtocolTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowGtpv1ProtocolType\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowGtpv1ProtocolType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowGtpv1ProtocolTypeCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowGtpv1ProtocolTypeCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowGtpv1ProtocolTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"y\n\x1fPatternFlowGtpv1ReservedCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x7f\n!PatternFlowGtpv1ReservedMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9a\x03\n\x18PatternFlowGtpv1Reserved\x12>\n\x06\x63hoice\x18\x01 \x01(\x0e\x32).otg.PatternFlowGtpv1Reserved.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x37\n\tincrement\x18\x05 \x01(\x0b\x32$.otg.PatternFlowGtpv1ReservedCounter\x12\x37\n\tdecrement\x18\x06 \x01(\x0b\x32$.otg.PatternFlowGtpv1ReservedCounter\x12;\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32&.otg.PatternFlowGtpv1ReservedMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowGtpv1EFlagCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowGtpv1EFlagMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowGtpv1EFlag\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowGtpv1EFlag.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowGtpv1EFlagCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowGtpv1EFlagCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowGtpv1EFlagMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowGtpv1SFlagCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowGtpv1SFlagMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowGtpv1SFlag\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowGtpv1SFlag.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowGtpv1SFlagCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowGtpv1SFlagCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowGtpv1SFlagMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowGtpv1PnFlagCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowGtpv1PnFlagMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowGtpv1PnFlag\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowGtpv1PnFlag.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowGtpv1PnFlagCounter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowGtpv1PnFlagCounter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowGtpv1PnFlagMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"|\n\"PatternFlowGtpv1MessageTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowGtpv1MessageTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowGtpv1MessageType\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowGtpv1MessageType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowGtpv1MessageTypeCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowGtpv1MessageTypeCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowGtpv1MessageTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"~\n$PatternFlowGtpv1MessageLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowGtpv1MessageLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowGtpv1MessageLength\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowGtpv1MessageLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowGtpv1MessageLengthCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowGtpv1MessageLengthCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowGtpv1MessageLengthMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowGtpv1TeidCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowGtpv1TeidMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowGtpv1Teid\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowGtpv1Teid.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowGtpv1TeidCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowGtpv1TeidCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowGtpv1TeidMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"~\n$PatternFlowGtpv1SquenceNumberCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowGtpv1SquenceNumberMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowGtpv1SquenceNumber\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowGtpv1SquenceNumber.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowGtpv1SquenceNumberCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowGtpv1SquenceNumberCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowGtpv1SquenceNumberMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"{\n!PatternFlowGtpv1NPduNumberCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x81\x01\n#PatternFlowGtpv1NPduNumberMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa4\x03\n\x1aPatternFlowGtpv1NPduNumber\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.PatternFlowGtpv1NPduNumber.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x39\n\tincrement\x18\x05 \x01(\x0b\x32&.otg.PatternFlowGtpv1NPduNumberCounter\x12\x39\n\tdecrement\x18\x06 \x01(\x0b\x32&.otg.PatternFlowGtpv1NPduNumberCounter\x12=\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32(.otg.PatternFlowGtpv1NPduNumberMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x88\x01\n.PatternFlowGtpv1NextExtensionHeaderTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8e\x01\n0PatternFlowGtpv1NextExtensionHeaderTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xe5\x03\n\'PatternFlowGtpv1NextExtensionHeaderType\x12M\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x38.otg.PatternFlowGtpv1NextExtensionHeaderType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x46\n\tincrement\x18\x05 \x01(\x0b\x32\x33.otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter\x12\x46\n\tdecrement\x18\x06 \x01(\x0b\x32\x33.otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter\x12J\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x35.otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x87\x01\n-PatternFlowGtpExtensionExtensionLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8d\x01\n/PatternFlowGtpExtensionExtensionLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xe0\x03\n&PatternFlowGtpExtensionExtensionLength\x12L\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x37.otg.PatternFlowGtpExtensionExtensionLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x45\n\tincrement\x18\x05 \x01(\x0b\x32\x32.otg.PatternFlowGtpExtensionExtensionLengthCounter\x12\x45\n\tdecrement\x18\x06 \x01(\x0b\x32\x32.otg.PatternFlowGtpExtensionExtensionLengthCounter\x12I\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x34.otg.PatternFlowGtpExtensionExtensionLengthMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x80\x01\n&PatternFlowGtpExtensionContentsCounter\x12\x12\n\x05start\x18\x01 \x01(\x04H\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\x04H\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x86\x01\n(PatternFlowGtpExtensionContentsMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\x04H\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xbd\x03\n\x1fPatternFlowGtpExtensionContents\x12\x45\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x30.otg.PatternFlowGtpExtensionContents.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\x04H\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\x04\x12>\n\tincrement\x18\x05 \x01(\x0b\x32+.otg.PatternFlowGtpExtensionContentsCounter\x12>\n\tdecrement\x18\x06 \x01(\x0b\x32+.otg.PatternFlowGtpExtensionContentsCounter\x12\x42\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32-.otg.PatternFlowGtpExtensionContentsMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x8b\x01\n1PatternFlowGtpExtensionNextExtensionHeaderCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x91\x01\n3PatternFlowGtpExtensionNextExtensionHeaderMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xf4\x03\n*PatternFlowGtpExtensionNextExtensionHeader\x12P\n\x06\x63hoice\x18\x01 \x01(\x0e\x32;.otg.PatternFlowGtpExtensionNextExtensionHeader.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12I\n\tincrement\x18\x05 \x01(\x0b\x32\x36.otg.PatternFlowGtpExtensionNextExtensionHeaderCounter\x12I\n\tdecrement\x18\x06 \x01(\x0b\x32\x36.otg.PatternFlowGtpExtensionNextExtensionHeaderCounter\x12M\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x38.otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowGtpv2VersionCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowGtpv2VersionMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowGtpv2Version\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowGtpv2Version.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowGtpv2VersionCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowGtpv2VersionCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowGtpv2VersionMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x81\x01\n\'PatternFlowGtpv2PiggybackingFlagCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x87\x01\n)PatternFlowGtpv2PiggybackingFlagMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc2\x03\n PatternFlowGtpv2PiggybackingFlag\x12\x46\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x31.otg.PatternFlowGtpv2PiggybackingFlag.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12?\n\tincrement\x18\x05 \x01(\x0b\x32,.otg.PatternFlowGtpv2PiggybackingFlagCounter\x12?\n\tdecrement\x18\x06 \x01(\x0b\x32,.otg.PatternFlowGtpv2PiggybackingFlagCounter\x12\x43\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32..otg.PatternFlowGtpv2PiggybackingFlagMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"y\n\x1fPatternFlowGtpv2TeidFlagCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x7f\n!PatternFlowGtpv2TeidFlagMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9a\x03\n\x18PatternFlowGtpv2TeidFlag\x12>\n\x06\x63hoice\x18\x01 \x01(\x0e\x32).otg.PatternFlowGtpv2TeidFlag.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x37\n\tincrement\x18\x05 \x01(\x0b\x32$.otg.PatternFlowGtpv2TeidFlagCounter\x12\x37\n\tdecrement\x18\x06 \x01(\x0b\x32$.otg.PatternFlowGtpv2TeidFlagCounter\x12;\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32&.otg.PatternFlowGtpv2TeidFlagMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowGtpv2Spare1Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowGtpv2Spare1MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowGtpv2Spare1\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowGtpv2Spare1.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowGtpv2Spare1Counter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowGtpv2Spare1Counter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowGtpv2Spare1MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"|\n\"PatternFlowGtpv2MessageTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowGtpv2MessageTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowGtpv2MessageType\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowGtpv2MessageType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowGtpv2MessageTypeCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowGtpv2MessageTypeCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowGtpv2MessageTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"~\n$PatternFlowGtpv2MessageLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowGtpv2MessageLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowGtpv2MessageLength\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowGtpv2MessageLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowGtpv2MessageLengthCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowGtpv2MessageLengthCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowGtpv2MessageLengthMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowGtpv2TeidCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowGtpv2TeidMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x86\x03\n\x14PatternFlowGtpv2Teid\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowGtpv2Teid.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x33\n\tincrement\x18\x05 \x01(\x0b\x32 .otg.PatternFlowGtpv2TeidCounter\x12\x33\n\tdecrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowGtpv2TeidCounter\x12\x37\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\".otg.PatternFlowGtpv2TeidMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowGtpv2SequenceNumberCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x01\n\'PatternFlowGtpv2SequenceNumberMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb8\x03\n\x1ePatternFlowGtpv2SequenceNumber\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowGtpv2SequenceNumber.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowGtpv2SequenceNumberCounter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowGtpv2SequenceNumberCounter\x12\x41\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32,.otg.PatternFlowGtpv2SequenceNumberMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"w\n\x1dPatternFlowGtpv2Spare2Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"}\n\x1fPatternFlowGtpv2Spare2MetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x90\x03\n\x16PatternFlowGtpv2Spare2\x12<\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\'.otg.PatternFlowGtpv2Spare2.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x35\n\tincrement\x18\x05 \x01(\x0b\x32\".otg.PatternFlowGtpv2Spare2Counter\x12\x35\n\tdecrement\x18\x06 \x01(\x0b\x32\".otg.PatternFlowGtpv2Spare2Counter\x12\x39\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32$.otg.PatternFlowGtpv2Spare2MetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"{\n!PatternFlowArpHardwareTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x81\x01\n#PatternFlowArpHardwareTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa4\x03\n\x1aPatternFlowArpHardwareType\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.PatternFlowArpHardwareType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x39\n\tincrement\x18\x05 \x01(\x0b\x32&.otg.PatternFlowArpHardwareTypeCounter\x12\x39\n\tdecrement\x18\x06 \x01(\x0b\x32&.otg.PatternFlowArpHardwareTypeCounter\x12=\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32(.otg.PatternFlowArpHardwareTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"{\n!PatternFlowArpProtocolTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x81\x01\n#PatternFlowArpProtocolTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa4\x03\n\x1aPatternFlowArpProtocolType\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.PatternFlowArpProtocolType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x39\n\tincrement\x18\x05 \x01(\x0b\x32&.otg.PatternFlowArpProtocolTypeCounter\x12\x39\n\tdecrement\x18\x06 \x01(\x0b\x32&.otg.PatternFlowArpProtocolTypeCounter\x12=\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32(.otg.PatternFlowArpProtocolTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowArpHardwareLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowArpHardwareLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowArpHardwareLength\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowArpHardwareLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowArpHardwareLengthCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowArpHardwareLengthCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowArpHardwareLengthMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowArpProtocolLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowArpProtocolLengthMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xae\x03\n\x1cPatternFlowArpProtocolLength\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowArpProtocolLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12;\n\tincrement\x18\x05 \x01(\x0b\x32(.otg.PatternFlowArpProtocolLengthCounter\x12;\n\tdecrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowArpProtocolLengthCounter\x12?\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32*.otg.PatternFlowArpProtocolLengthMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowArpOperationCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowArpOperationMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowArpOperation\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowArpOperation.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowArpOperationCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowArpOperationCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowArpOperationMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x81\x01\n\'PatternFlowArpSenderHardwareAddrCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x87\x01\n)PatternFlowArpSenderHardwareAddrMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc2\x03\n PatternFlowArpSenderHardwareAddr\x12\x46\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x31.otg.PatternFlowArpSenderHardwareAddr.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12?\n\tincrement\x18\x05 \x01(\x0b\x32,.otg.PatternFlowArpSenderHardwareAddrCounter\x12?\n\tdecrement\x18\x06 \x01(\x0b\x32,.otg.PatternFlowArpSenderHardwareAddrCounter\x12\x43\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32..otg.PatternFlowArpSenderHardwareAddrMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x81\x01\n\'PatternFlowArpSenderProtocolAddrCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x87\x01\n)PatternFlowArpSenderProtocolAddrMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc2\x03\n PatternFlowArpSenderProtocolAddr\x12\x46\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x31.otg.PatternFlowArpSenderProtocolAddr.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12?\n\tincrement\x18\x05 \x01(\x0b\x32,.otg.PatternFlowArpSenderProtocolAddrCounter\x12?\n\tdecrement\x18\x06 \x01(\x0b\x32,.otg.PatternFlowArpSenderProtocolAddrCounter\x12\x43\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32..otg.PatternFlowArpSenderProtocolAddrMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x81\x01\n\'PatternFlowArpTargetHardwareAddrCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x87\x01\n)PatternFlowArpTargetHardwareAddrMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc2\x03\n PatternFlowArpTargetHardwareAddr\x12\x46\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x31.otg.PatternFlowArpTargetHardwareAddr.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12?\n\tincrement\x18\x05 \x01(\x0b\x32,.otg.PatternFlowArpTargetHardwareAddrCounter\x12?\n\tdecrement\x18\x06 \x01(\x0b\x32,.otg.PatternFlowArpTargetHardwareAddrCounter\x12\x43\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32..otg.PatternFlowArpTargetHardwareAddrMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x81\x01\n\'PatternFlowArpTargetProtocolAddrCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x87\x01\n)PatternFlowArpTargetProtocolAddrMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc2\x03\n PatternFlowArpTargetProtocolAddr\x12\x46\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x31.otg.PatternFlowArpTargetProtocolAddr.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12?\n\tincrement\x18\x05 \x01(\x0b\x32,.otg.PatternFlowArpTargetProtocolAddrCounter\x12?\n\tdecrement\x18\x06 \x01(\x0b\x32,.otg.PatternFlowArpTargetProtocolAddrCounter\x12\x43\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32..otg.PatternFlowArpTargetProtocolAddrMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowIcmpEchoTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowIcmpEchoTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowIcmpEchoType\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowIcmpEchoType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowIcmpEchoTypeCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowIcmpEchoTypeCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowIcmpEchoTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowIcmpEchoCodeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowIcmpEchoCodeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowIcmpEchoCode\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowIcmpEchoCode.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowIcmpEchoCodeCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowIcmpEchoCodeCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowIcmpEchoCodeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xd9\x02\n\x1bPatternFlowIcmpEchoChecksum\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowIcmpEchoChecksum.Choice.EnumH\x00\x88\x01\x01\x12G\n\tgenerated\x18\x02 \x01(\x0e\x32/.otg.PatternFlowIcmpEchoChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"~\n$PatternFlowIcmpEchoIdentifierCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowIcmpEchoIdentifierMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowIcmpEchoIdentifier\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIcmpEchoIdentifier.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowIcmpEchoIdentifierCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowIcmpEchoIdentifierCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowIcmpEchoIdentifierMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x82\x01\n(PatternFlowIcmpEchoSequenceNumberCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x88\x01\n*PatternFlowIcmpEchoSequenceNumberMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xc7\x03\n!PatternFlowIcmpEchoSequenceNumber\x12G\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x32.otg.PatternFlowIcmpEchoSequenceNumber.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12@\n\tincrement\x18\x05 \x01(\x0b\x32-.otg.PatternFlowIcmpEchoSequenceNumberCounter\x12@\n\tdecrement\x18\x06 \x01(\x0b\x32-.otg.PatternFlowIcmpEchoSequenceNumberCounter\x12\x44\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32/.otg.PatternFlowIcmpEchoSequenceNumberMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xdf\x02\n\x1dPatternFlowIcmpCommonChecksum\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIcmpCommonChecksum.Choice.EnumH\x00\x88\x01\x01\x12I\n\tgenerated\x18\x02 \x01(\x0e\x32\x31.otg.PatternFlowIcmpCommonChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"\x84\x01\n*PatternFlowIcmpNextFieldsIdentifierCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8a\x01\n,PatternFlowIcmpNextFieldsIdentifierMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xd1\x03\n#PatternFlowIcmpNextFieldsIdentifier\x12I\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x34.otg.PatternFlowIcmpNextFieldsIdentifier.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x42\n\tincrement\x18\x05 \x01(\x0b\x32/.otg.PatternFlowIcmpNextFieldsIdentifierCounter\x12\x42\n\tdecrement\x18\x06 \x01(\x0b\x32/.otg.PatternFlowIcmpNextFieldsIdentifierCounter\x12\x46\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x31.otg.PatternFlowIcmpNextFieldsIdentifierMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x88\x01\n.PatternFlowIcmpNextFieldsSequenceNumberCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8e\x01\n0PatternFlowIcmpNextFieldsSequenceNumberMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xe5\x03\n\'PatternFlowIcmpNextFieldsSequenceNumber\x12M\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x38.otg.PatternFlowIcmpNextFieldsSequenceNumber.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x46\n\tincrement\x18\x05 \x01(\x0b\x32\x33.otg.PatternFlowIcmpNextFieldsSequenceNumberCounter\x12\x46\n\tdecrement\x18\x06 \x01(\x0b\x32\x33.otg.PatternFlowIcmpNextFieldsSequenceNumberCounter\x12J\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x35.otg.PatternFlowIcmpNextFieldsSequenceNumberMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"z\n PatternFlowIcmpv6EchoTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x80\x01\n\"PatternFlowIcmpv6EchoTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9f\x03\n\x19PatternFlowIcmpv6EchoType\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowIcmpv6EchoType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x38\n\tincrement\x18\x05 \x01(\x0b\x32%.otg.PatternFlowIcmpv6EchoTypeCounter\x12\x38\n\tdecrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowIcmpv6EchoTypeCounter\x12<\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\'.otg.PatternFlowIcmpv6EchoTypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"z\n PatternFlowIcmpv6EchoCodeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x80\x01\n\"PatternFlowIcmpv6EchoCodeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9f\x03\n\x19PatternFlowIcmpv6EchoCode\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowIcmpv6EchoCode.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x38\n\tincrement\x18\x05 \x01(\x0b\x32%.otg.PatternFlowIcmpv6EchoCodeCounter\x12\x38\n\tdecrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowIcmpv6EchoCodeCounter\x12<\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\'.otg.PatternFlowIcmpv6EchoCodeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x80\x01\n&PatternFlowIcmpv6EchoIdentifierCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x86\x01\n(PatternFlowIcmpv6EchoIdentifierMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xbd\x03\n\x1fPatternFlowIcmpv6EchoIdentifier\x12\x45\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x30.otg.PatternFlowIcmpv6EchoIdentifier.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12>\n\tincrement\x18\x05 \x01(\x0b\x32+.otg.PatternFlowIcmpv6EchoIdentifierCounter\x12>\n\tdecrement\x18\x06 \x01(\x0b\x32+.otg.PatternFlowIcmpv6EchoIdentifierCounter\x12\x42\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32-.otg.PatternFlowIcmpv6EchoIdentifierMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x84\x01\n*PatternFlowIcmpv6EchoSequenceNumberCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8a\x01\n,PatternFlowIcmpv6EchoSequenceNumberMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xd1\x03\n#PatternFlowIcmpv6EchoSequenceNumber\x12I\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x34.otg.PatternFlowIcmpv6EchoSequenceNumber.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x42\n\tincrement\x18\x05 \x01(\x0b\x32/.otg.PatternFlowIcmpv6EchoSequenceNumberCounter\x12\x42\n\tdecrement\x18\x06 \x01(\x0b\x32/.otg.PatternFlowIcmpv6EchoSequenceNumberCounter\x12\x46\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\x31.otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xdf\x02\n\x1dPatternFlowIcmpv6EchoChecksum\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIcmpv6EchoChecksum.Choice.EnumH\x00\x88\x01\x01\x12I\n\tgenerated\x18\x02 \x01(\x0e\x32\x31.otg.PatternFlowIcmpv6EchoChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"\xe5\x02\n\x1fPatternFlowIcmpv6CommonChecksum\x12\x45\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x30.otg.PatternFlowIcmpv6CommonChecksum.Choice.EnumH\x00\x88\x01\x01\x12K\n\tgenerated\x18\x02 \x01(\x0e\x32\x33.otg.PatternFlowIcmpv6CommonChecksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"v\n\x1cPatternFlowPppAddressCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowPppAddressMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowPppAddress\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowPppAddress.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowPppAddressCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowPppAddressCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowPppAddressMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowPppControlCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowPppControlMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowPppControl\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowPppControl.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowPppControlCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowPppControlCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowPppControlMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"{\n!PatternFlowPppProtocolTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x81\x01\n#PatternFlowPppProtocolTypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xca\x03\n\x1aPatternFlowPppProtocolType\x12@\n\x06\x63hoice\x18\x01 \x01(\x0e\x32+.otg.PatternFlowPppProtocolType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x39\n\tincrement\x18\x06 \x01(\x0b\x32&.otg.PatternFlowPppProtocolTypeCounter\x12\x39\n\tdecrement\x18\x07 \x01(\x0b\x32&.otg.PatternFlowPppProtocolTypeCounter\x12=\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32(.otg.PatternFlowPppProtocolTypeMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"y\n\x1fPatternFlowIgmpv1VersionCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x7f\n!PatternFlowIgmpv1VersionMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9a\x03\n\x18PatternFlowIgmpv1Version\x12>\n\x06\x63hoice\x18\x01 \x01(\x0e\x32).otg.PatternFlowIgmpv1Version.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x37\n\tincrement\x18\x05 \x01(\x0b\x32$.otg.PatternFlowIgmpv1VersionCounter\x12\x37\n\tdecrement\x18\x06 \x01(\x0b\x32$.otg.PatternFlowIgmpv1VersionCounter\x12;\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32&.otg.PatternFlowIgmpv1VersionMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"v\n\x1cPatternFlowIgmpv1TypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"|\n\x1ePatternFlowIgmpv1TypeMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x8b\x03\n\x15PatternFlowIgmpv1Type\x12;\n\x06\x63hoice\x18\x01 \x01(\x0e\x32&.otg.PatternFlowIgmpv1Type.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x34\n\tincrement\x18\x05 \x01(\x0b\x32!.otg.PatternFlowIgmpv1TypeCounter\x12\x34\n\tdecrement\x18\x06 \x01(\x0b\x32!.otg.PatternFlowIgmpv1TypeCounter\x12\x38\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32#.otg.PatternFlowIgmpv1TypeMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"x\n\x1ePatternFlowIgmpv1UnusedCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"~\n PatternFlowIgmpv1UnusedMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x95\x03\n\x17PatternFlowIgmpv1Unused\x12=\n\x06\x63hoice\x18\x01 \x01(\x0e\x32(.otg.PatternFlowIgmpv1Unused.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x36\n\tincrement\x18\x05 \x01(\x0b\x32#.otg.PatternFlowIgmpv1UnusedCounter\x12\x36\n\tdecrement\x18\x06 \x01(\x0b\x32#.otg.PatternFlowIgmpv1UnusedCounter\x12:\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32%.otg.PatternFlowIgmpv1UnusedMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xd3\x02\n\x19PatternFlowIgmpv1Checksum\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowIgmpv1Checksum.Choice.EnumH\x00\x88\x01\x01\x12\x45\n\tgenerated\x18\x02 \x01(\x0e\x32-.otg.PatternFlowIgmpv1Checksum.Generated.EnumH\x01\x88\x01\x01\x12\x13\n\x06\x63ustom\x18\x03 \x01(\rH\x02\x88\x01\x01\x1a<\n\x06\x43hoice\"2\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\r\n\tgenerated\x10\x01\x12\n\n\x06\x63ustom\x10\x02\x1a\x37\n\tGenerated\"*\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\x08\n\x04good\x10\x01\x12\x07\n\x03\x62\x61\x64\x10\x02\x42\t\n\x07_choiceB\x0c\n\n_generatedB\t\n\x07_custom\"~\n$PatternFlowIgmpv1GroupAddressCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x84\x01\n&PatternFlowIgmpv1GroupAddressMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xb3\x03\n\x1dPatternFlowIgmpv1GroupAddress\x12\x43\n\x06\x63hoice\x18\x01 \x01(\x0e\x32..otg.PatternFlowIgmpv1GroupAddress.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12<\n\tincrement\x18\x05 \x01(\x0b\x32).otg.PatternFlowIgmpv1GroupAddressCounter\x12<\n\tdecrement\x18\x06 \x01(\x0b\x32).otg.PatternFlowIgmpv1GroupAddressCounter\x12@\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32+.otg.PatternFlowIgmpv1GroupAddressMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"u\n\x1bPatternFlowMplsLabelCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"{\n\x1dPatternFlowMplsLabelMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xac\x03\n\x14PatternFlowMplsLabel\x12:\n\x06\x63hoice\x18\x01 \x01(\x0e\x32%.otg.PatternFlowMplsLabel.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x33\n\tincrement\x18\x06 \x01(\x0b\x32 .otg.PatternFlowMplsLabelCounter\x12\x33\n\tdecrement\x18\x07 \x01(\x0b\x32 .otg.PatternFlowMplsLabelCounter\x12\x37\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32\".otg.PatternFlowMplsLabelMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"|\n\"PatternFlowMplsTrafficClassCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x82\x01\n$PatternFlowMplsTrafficClassMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xa9\x03\n\x1bPatternFlowMplsTrafficClass\x12\x41\n\x06\x63hoice\x18\x01 \x01(\x0e\x32,.otg.PatternFlowMplsTrafficClass.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12:\n\tincrement\x18\x05 \x01(\x0b\x32\'.otg.PatternFlowMplsTrafficClassCounter\x12:\n\tdecrement\x18\x06 \x01(\x0b\x32\'.otg.PatternFlowMplsTrafficClassCounter\x12>\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32).otg.PatternFlowMplsTrafficClassMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"}\n#PatternFlowMplsBottomOfStackCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x83\x01\n%PatternFlowMplsBottomOfStackMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\xd4\x03\n\x1cPatternFlowMplsBottomOfStack\x12\x42\n\x06\x63hoice\x18\x01 \x01(\x0e\x32-.otg.PatternFlowMplsBottomOfStack.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x11\n\x04\x61uto\x18\x04 \x01(\rH\x02\x88\x01\x01\x12;\n\tincrement\x18\x06 \x01(\x0b\x32(.otg.PatternFlowMplsBottomOfStackCounter\x12;\n\tdecrement\x18\x07 \x01(\x0b\x32(.otg.PatternFlowMplsBottomOfStackCounter\x12?\n\x0bmetric_tags\x18\x08 \x03(\x0b\x32*.otg.PatternFlowMplsBottomOfStackMetricTag\x1a`\n\x06\x43hoice\"V\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\x08\n\x04\x61uto\x10\x01\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_valueB\x07\n\x05_auto\"z\n PatternFlowMplsTimeToLiveCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x80\x01\n\"PatternFlowMplsTimeToLiveMetricTag\x12\x11\n\x04name\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06offset\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x13\n\x06length\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x07\n\x05_nameB\t\n\x07_offsetB\t\n\x07_length\"\x9f\x03\n\x19PatternFlowMplsTimeToLive\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowMplsTimeToLive.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x38\n\tincrement\x18\x05 \x01(\x0b\x32%.otg.PatternFlowMplsTimeToLiveCounter\x12\x38\n\tdecrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowMplsTimeToLiveCounter\x12<\n\x0bmetric_tags\x18\x07 \x03(\x0b\x32\'.otg.PatternFlowMplsTimeToLiveMetricTag\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"z\n PatternFlowSnmpv2cVersionCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xe1\x02\n\x19PatternFlowSnmpv2cVersion\x12?\n\x06\x63hoice\x18\x01 \x01(\x0e\x32*.otg.PatternFlowSnmpv2cVersion.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x38\n\tincrement\x18\x05 \x01(\x0b\x32%.otg.PatternFlowSnmpv2cVersionCounter\x12\x38\n\tdecrement\x18\x06 \x01(\x0b\x32%.otg.PatternFlowSnmpv2cVersionCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x7f\n%PatternFlowSnmpv2cPDURequestIdCounter\x12\x12\n\x05start\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\x05H\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xf5\x02\n\x1ePatternFlowSnmpv2cPDURequestId\x12\x44\n\x06\x63hoice\x18\x01 \x01(\x0e\x32/.otg.PatternFlowSnmpv2cPDURequestId.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\x05\x12=\n\tincrement\x18\x05 \x01(\x0b\x32*.otg.PatternFlowSnmpv2cPDURequestIdCounter\x12=\n\tdecrement\x18\x06 \x01(\x0b\x32*.otg.PatternFlowSnmpv2cPDURequestIdCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x80\x01\n&PatternFlowSnmpv2cPDUErrorIndexCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xf9\x02\n\x1fPatternFlowSnmpv2cPDUErrorIndex\x12\x45\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x30.otg.PatternFlowSnmpv2cPDUErrorIndex.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12>\n\tincrement\x18\x05 \x01(\x0b\x32+.otg.PatternFlowSnmpv2cPDUErrorIndexCounter\x12>\n\tdecrement\x18\x06 \x01(\x0b\x32+.otg.PatternFlowSnmpv2cPDUErrorIndexCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x83\x01\n)PatternFlowSnmpv2cBulkPDURequestIdCounter\x12\x12\n\x05start\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\x05H\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x85\x03\n\"PatternFlowSnmpv2cBulkPDURequestId\x12H\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x33.otg.PatternFlowSnmpv2cBulkPDURequestId.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\x05\x12\x41\n\tincrement\x18\x05 \x01(\x0b\x32..otg.PatternFlowSnmpv2cBulkPDURequestIdCounter\x12\x41\n\tdecrement\x18\x06 \x01(\x0b\x32..otg.PatternFlowSnmpv2cBulkPDURequestIdCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xe7\x01\n%PatternFlowSnmpv2cBulkPDUNonRepeaters\x12K\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x36.otg.PatternFlowSnmpv2cBulkPDUNonRepeaters.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x1a\x38\n\x06\x43hoice\".\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x42\t\n\x07_choiceB\x08\n\x06_value\"\x88\x01\n.PatternFlowSnmpv2cBulkPDUMaxRepetitionsCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x99\x03\n\'PatternFlowSnmpv2cBulkPDUMaxRepetitions\x12M\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x38.otg.PatternFlowSnmpv2cBulkPDUMaxRepetitions.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x46\n\tincrement\x18\x05 \x01(\x0b\x32\x33.otg.PatternFlowSnmpv2cBulkPDUMaxRepetitionsCounter\x12\x46\n\tdecrement\x18\x06 \x01(\x0b\x32\x33.otg.PatternFlowSnmpv2cBulkPDUMaxRepetitionsCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x93\x01\n9PatternFlowSnmpv2cVariableBindingValueIntegerValueCounter\x12\x12\n\x05start\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\x05H\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xc5\x03\n2PatternFlowSnmpv2cVariableBindingValueIntegerValue\x12X\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x43.otg.PatternFlowSnmpv2cVariableBindingValueIntegerValue.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\x05\x12Q\n\tincrement\x18\x05 \x01(\x0b\x32>.otg.PatternFlowSnmpv2cVariableBindingValueIntegerValueCounter\x12Q\n\tdecrement\x18\x06 \x01(\x0b\x32>.otg.PatternFlowSnmpv2cVariableBindingValueIntegerValueCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x95\x01\n;PatternFlowSnmpv2cVariableBindingValueIpAddressValueCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xcd\x03\n4PatternFlowSnmpv2cVariableBindingValueIpAddressValue\x12Z\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x45.otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValue.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12S\n\tincrement\x18\x05 \x01(\x0b\x32@.otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValueCounter\x12S\n\tdecrement\x18\x06 \x01(\x0b\x32@.otg.PatternFlowSnmpv2cVariableBindingValueIpAddressValueCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x93\x01\n9PatternFlowSnmpv2cVariableBindingValueCounterValueCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xc5\x03\n2PatternFlowSnmpv2cVariableBindingValueCounterValue\x12X\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x43.otg.PatternFlowSnmpv2cVariableBindingValueCounterValue.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12Q\n\tincrement\x18\x05 \x01(\x0b\x32>.otg.PatternFlowSnmpv2cVariableBindingValueCounterValueCounter\x12Q\n\tdecrement\x18\x06 \x01(\x0b\x32>.otg.PatternFlowSnmpv2cVariableBindingValueCounterValueCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x95\x01\n;PatternFlowSnmpv2cVariableBindingValueTimeticksValueCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xcd\x03\n4PatternFlowSnmpv2cVariableBindingValueTimeticksValue\x12Z\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x45.otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValue.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12S\n\tincrement\x18\x05 \x01(\x0b\x32@.otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValueCounter\x12S\n\tdecrement\x18\x06 \x01(\x0b\x32@.otg.PatternFlowSnmpv2cVariableBindingValueTimeticksValueCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x96\x01\n.otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter\x12Q\n\tdecrement\x18\x06 \x01(\x0b\x32>.otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x93\x01\n9PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xc5\x03\n2PatternFlowRSVPPathSenderTspecIntServServiceHeader\x12X\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x43.otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12Q\n\tincrement\x18\x05 \x01(\x0b\x32>.otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter\x12Q\n\tdecrement\x18\x06 \x01(\x0b\x32>.otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x8d\x01\n3PatternFlowRSVPPathSenderTspecIntServZeroBitCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xad\x03\n,PatternFlowRSVPPathSenderTspecIntServZeroBit\x12R\n\x06\x63hoice\x18\x01 \x01(\x0e\x32=.otg.PatternFlowRSVPPathSenderTspecIntServZeroBit.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12K\n\tincrement\x18\x05 \x01(\x0b\x32\x38.otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter\x12K\n\tdecrement\x18\x06 \x01(\x0b\x32\x38.otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x8f\x01\n5PatternFlowRSVPPathSenderTspecIntServReserved2Counter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xb5\x03\n.PatternFlowRSVPPathSenderTspecIntServReserved2\x12T\n\x06\x63hoice\x18\x01 \x01(\x0e\x32?.otg.PatternFlowRSVPPathSenderTspecIntServReserved2.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12M\n\tincrement\x18\x05 \x01(\x0b\x32:.otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter\x12M\n\tdecrement\x18\x06 \x01(\x0b\x32:.otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x99\x01\n?PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xdd\x03\n8PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData\x12^\n\x06\x63hoice\x18\x01 \x01(\x0e\x32I.otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12W\n\tincrement\x18\x05 \x01(\x0b\x32\x44.otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter\x12W\n\tdecrement\x18\x06 \x01(\x0b\x32\x44.otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xa1\x01\nGPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xfd\x03\n@PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec\x12\x66\n\x06\x63hoice\x18\x01 \x01(\x0e\x32Q.otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12_\n\tincrement\x18\x05 \x01(\x0b\x32L.otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter\x12_\n\tdecrement\x18\x06 \x01(\x0b\x32L.otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x96\x01\nPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xd9\x03\n7PatternFlowRSVPPathSenderTspecIntServParameter127Length\x12]\n\x06\x63hoice\x18\x01 \x01(\x0e\x32H.otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12V\n\tincrement\x18\x05 \x01(\x0b\x32\x43.otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter\x12V\n\tdecrement\x18\x06 \x01(\x0b\x32\x43.otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x98\x01\n>PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xd9\x03\n7PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit\x12]\n\x06\x63hoice\x18\x01 \x01(\x0e\x32H.otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12V\n\tincrement\x18\x05 \x01(\x0b\x32\x43.otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter\x12V\n\tdecrement\x18\x06 \x01(\x0b\x32\x43.otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x97\x01\n=PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xd5\x03\n6PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize\x12\\\n\x06\x63hoice\x18\x01 \x01(\x0e\x32G.otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12U\n\tincrement\x18\x05 \x01(\x0b\x32\x42.otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter\x12U\n\tdecrement\x18\x06 \x01(\x0b\x32\x42.otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x9a\x01\n@PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter\x12\x12\n\x05start\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xe1\x03\n9PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address\x12_\n\x06\x63hoice\x18\x01 \x01(\x0e\x32J.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\t\x12X\n\tincrement\x18\x05 \x01(\x0b\x32\x45.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter\x12X\n\tdecrement\x18\x06 \x01(\x0b\x32\x45.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x9b\x01\nAPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\xe5\x03\n:PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength\x12`\n\x06\x63hoice\x18\x01 \x01(\x0e\x32K.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12Y\n\tincrement\x18\x05 \x01(\x0b\x32\x46.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter\x12Y\n\tdecrement\x18\x06 \x01(\x0b\x32\x46.otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\xf7\x01\n-PatternFlowRSVPPathRecordRouteType1LabelFlags\x12S\n\x06\x63hoice\x18\x01 \x01(\x0e\x32>.otg.PatternFlowRSVPPathRecordRouteType1LabelFlags.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x1a\x38\n\x06\x43hoice\".\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x42\t\n\x07_choiceB\x08\n\x06_value\"\xf7\x01\n-PatternFlowRSVPPathRecordRouteType1LabelCType\x12S\n\x06\x63hoice\x18\x01 \x01(\x0e\x32>.otg.PatternFlowRSVPPathRecordRouteType1LabelCType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x1a\x38\n\x06\x43hoice\".\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x42\t\n\x07_choiceB\x08\n\x06_value\"\x85\x01\n+PatternFlowRSVPPathObjectsCustomTypeCounter\x12\x12\n\x05start\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04step\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x12\n\x05\x63ount\x18\x03 \x01(\rH\x02\x88\x01\x01\x42\x08\n\x06_startB\x07\n\x05_stepB\x08\n\x06_count\"\x8d\x03\n$PatternFlowRSVPPathObjectsCustomType\x12J\n\x06\x63hoice\x18\x01 \x01(\x0e\x32\x35.otg.PatternFlowRSVPPathObjectsCustomType.Choice.EnumH\x00\x88\x01\x01\x12\x12\n\x05value\x18\x02 \x01(\rH\x01\x88\x01\x01\x12\x0e\n\x06values\x18\x03 \x03(\r\x12\x43\n\tincrement\x18\x05 \x01(\x0b\x32\x30.otg.PatternFlowRSVPPathObjectsCustomTypeCounter\x12\x43\n\tdecrement\x18\x06 \x01(\x0b\x32\x30.otg.PatternFlowRSVPPathObjectsCustomTypeCounter\x1aV\n\x06\x43hoice\"L\n\x04\x45num\x12\x0f\n\x0bunspecified\x10\x00\x12\t\n\x05value\x10\x02\x12\n\n\x06values\x10\x03\x12\r\n\tincrement\x10\x04\x12\r\n\tdecrement\x10\x05\x42\t\n\x07_choiceB\x08\n\x06_value\"\x91\x01\n\x07Version\x12\x1d\n\x10\x61pi_spec_version\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x18\n\x0bsdk_version\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0b\x61pp_version\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x13\n\x11_api_spec_versionB\x0e\n\x0c_sdk_versionB\x0e\n\x0c_app_version\"(\n\x07Success\x12\x1d\n\x07warning\x18\x01 \x01(\x0b\x32\x0c.otg.Warning\"$\n\x07\x46\x61ilure\x12\x19\n\x05\x65rror\x18\x01 \x01(\x0b\x32\n.otg.Error\"/\n\x10SetConfigRequest\x12\x1b\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x0b.otg.Config\"?\n\x13UpdateConfigRequest\x12(\n\rconfig_update\x18\x01 \x01(\x0b\x32\x11.otg.ConfigUpdate\"2\n\x11SetConfigResponse\x12\x1d\n\x07warning\x18\x01 \x01(\x0b\x32\x0c.otg.Warning\"0\n\x11GetConfigResponse\x12\x1b\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x0b.otg.Config\"5\n\x14UpdateConfigResponse\x12\x1d\n\x07warning\x18\x01 \x01(\x0b\x32\x0c.otg.Warning\"B\n\x16SetControlStateRequest\x12(\n\rcontrol_state\x18\x01 \x01(\x0b\x32\x11.otg.ControlState\"8\n\x17SetControlStateResponse\x12\x1d\n\x07warning\x18\x01 \x01(\x0b\x32\x0c.otg.Warning\"E\n\x17SetControlActionRequest\x12*\n\x0e\x63ontrol_action\x18\x01 \x01(\x0b\x32\x12.otg.ControlAction\"W\n\x18SetControlActionResponse\x12;\n\x17\x63ontrol_action_response\x18\x01 \x01(\x0b\x32\x1a.otg.ControlActionResponse\"A\n\x11GetMetricsRequest\x12,\n\x0fmetrics_request\x18\x01 \x01(\x0b\x32\x13.otg.MetricsRequest\"D\n\x12GetMetricsResponse\x12.\n\x10metrics_response\x18\x01 \x01(\x0b\x32\x14.otg.MetricsResponse\">\n\x10GetStatesRequest\x12*\n\x0estates_request\x18\x01 \x01(\x0b\x32\x12.otg.StatesRequest\"A\n\x11GetStatesResponse\x12,\n\x0fstates_response\x18\x01 \x01(\x0b\x32\x13.otg.StatesResponse\"A\n\x11GetCaptureRequest\x12,\n\x0f\x63\x61pture_request\x18\x01 \x01(\x0b\x32\x13.otg.CaptureRequest\",\n\x12GetCaptureResponse\x12\x16\n\x0eresponse_bytes\x18\x01 \x01(\x0c\"3\n\x12GetVersionResponse\x12\x1d\n\x07version\x18\x01 \x01(\x0b\x32\x0c.otg.Version2\xdf\x04\n\x07Openapi\x12:\n\tSetConfig\x12\x15.otg.SetConfigRequest\x1a\x16.otg.SetConfigResponse\x12;\n\tGetConfig\x12\x16.google.protobuf.Empty\x1a\x16.otg.GetConfigResponse\x12\x43\n\x0cUpdateConfig\x12\x18.otg.UpdateConfigRequest\x1a\x19.otg.UpdateConfigResponse\x12L\n\x0fSetControlState\x12\x1b.otg.SetControlStateRequest\x1a\x1c.otg.SetControlStateResponse\x12O\n\x10SetControlAction\x12\x1c.otg.SetControlActionRequest\x1a\x1d.otg.SetControlActionResponse\x12=\n\nGetMetrics\x12\x16.otg.GetMetricsRequest\x1a\x17.otg.GetMetricsResponse\x12:\n\tGetStates\x12\x15.otg.GetStatesRequest\x1a\x16.otg.GetStatesResponse\x12=\n\nGetCapture\x12\x16.otg.GetCaptureRequest\x1a\x17.otg.GetCaptureResponse\x12=\n\nGetVersion\x12\x16.google.protobuf.Empty\x1a\x17.otg.GetVersionResponseB\x0bZ\t./otg;otgb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -2103,548 +2103,558 @@ _globals['_PATTERNFLOWIPV4SRCCOUNTER']._serialized_end=152237 _globals['_PATTERNFLOWIPV4SRCMETRICTAG']._serialized_start=152239 _globals['_PATTERNFLOWIPV4SRCMETRICTAG']._serialized_end=152360 - _globals['_PATTERNFLOWIPV4SRC']._serialized_start=152363 - _globals['_PATTERNFLOWIPV4SRC']._serialized_end=152786 - _globals['_PATTERNFLOWIPV4SRC_CHOICE']._serialized_start=137481 - _globals['_PATTERNFLOWIPV4SRC_CHOICE']._serialized_end=137577 - _globals['_PATTERNFLOWIPV4SRC_CHOICE_ENUM']._serialized_start=137491 - _globals['_PATTERNFLOWIPV4SRC_CHOICE_ENUM']._serialized_end=137577 - _globals['_PATTERNFLOWIPV4DSTCOUNTER']._serialized_start=152788 - _globals['_PATTERNFLOWIPV4DSTCOUNTER']._serialized_end=152903 - _globals['_PATTERNFLOWIPV4DSTMETRICTAG']._serialized_start=152905 - _globals['_PATTERNFLOWIPV4DSTMETRICTAG']._serialized_end=153026 - _globals['_PATTERNFLOWIPV4DST']._serialized_start=153029 - _globals['_PATTERNFLOWIPV4DST']._serialized_end=153452 - _globals['_PATTERNFLOWIPV4DST_CHOICE']._serialized_start=137481 - _globals['_PATTERNFLOWIPV4DST_CHOICE']._serialized_end=137577 - _globals['_PATTERNFLOWIPV4DST_CHOICE_ENUM']._serialized_start=137491 - _globals['_PATTERNFLOWIPV4DST_CHOICE_ENUM']._serialized_end=137577 - _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPECOPIEDFLAGCOUNTER']._serialized_start=153455 - _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPECOPIEDFLAGCOUNTER']._serialized_end=153594 - _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPECOPIEDFLAG']._serialized_start=153597 - _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPECOPIEDFLAG']._serialized_end=154018 + _globals['_PATTERNFLOWIPV4SRCRANDOM']._serialized_start=152363 + _globals['_PATTERNFLOWIPV4SRCRANDOM']._serialized_end=152499 + _globals['_PATTERNFLOWIPV4SRC']._serialized_start=152502 + _globals['_PATTERNFLOWIPV4SRC']._serialized_end=152984 + _globals['_PATTERNFLOWIPV4SRC_CHOICE']._serialized_start=152855 + _globals['_PATTERNFLOWIPV4SRC_CHOICE']._serialized_end=152963 + _globals['_PATTERNFLOWIPV4SRC_CHOICE_ENUM']._serialized_start=152865 + _globals['_PATTERNFLOWIPV4SRC_CHOICE_ENUM']._serialized_end=152963 + _globals['_PATTERNFLOWIPV4DSTCOUNTER']._serialized_start=152986 + _globals['_PATTERNFLOWIPV4DSTCOUNTER']._serialized_end=153101 + _globals['_PATTERNFLOWIPV4DSTMETRICTAG']._serialized_start=153103 + _globals['_PATTERNFLOWIPV4DSTMETRICTAG']._serialized_end=153224 + _globals['_PATTERNFLOWIPV4DSTRANDOM']._serialized_start=153227 + _globals['_PATTERNFLOWIPV4DSTRANDOM']._serialized_end=153363 + _globals['_PATTERNFLOWIPV4DST']._serialized_start=153366 + _globals['_PATTERNFLOWIPV4DST']._serialized_end=153848 + _globals['_PATTERNFLOWIPV4DST_CHOICE']._serialized_start=152855 + _globals['_PATTERNFLOWIPV4DST_CHOICE']._serialized_end=152963 + _globals['_PATTERNFLOWIPV4DST_CHOICE_ENUM']._serialized_start=152865 + _globals['_PATTERNFLOWIPV4DST_CHOICE_ENUM']._serialized_end=152963 + _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPECOPIEDFLAGCOUNTER']._serialized_start=153851 + _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPECOPIEDFLAGCOUNTER']._serialized_end=153990 + _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPECOPIEDFLAG']._serialized_start=153993 + _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPECOPIEDFLAG']._serialized_end=154414 _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPECOPIEDFLAG_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPECOPIEDFLAG_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPECOPIEDFLAG_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPECOPIEDFLAG_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONCLASSCOUNTER']._serialized_start=154021 - _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONCLASSCOUNTER']._serialized_end=154161 - _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONCLASS']._serialized_start=154164 - _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONCLASS']._serialized_end=154589 + _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONCLASSCOUNTER']._serialized_start=154417 + _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONCLASSCOUNTER']._serialized_end=154557 + _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONCLASS']._serialized_start=154560 + _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONCLASS']._serialized_end=154985 _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONCLASS_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONCLASS_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONCLASS_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONCLASS_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONNUMBERCOUNTER']._serialized_start=154592 - _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONNUMBERCOUNTER']._serialized_end=154733 - _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONNUMBER']._serialized_start=154736 - _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONNUMBER']._serialized_end=155165 + _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONNUMBERCOUNTER']._serialized_start=154988 + _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONNUMBERCOUNTER']._serialized_end=155129 + _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONNUMBER']._serialized_start=155132 + _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONNUMBER']._serialized_end=155561 _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONNUMBER_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONNUMBER_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONNUMBER_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV4OPTIONSCUSTOMTYPEOPTIONNUMBER_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV4PRIORITYRAWCOUNTER']._serialized_start=155167 - _globals['_PATTERNFLOWIPV4PRIORITYRAWCOUNTER']._serialized_end=155290 - _globals['_PATTERNFLOWIPV4PRIORITYRAWMETRICTAG']._serialized_start=155293 - _globals['_PATTERNFLOWIPV4PRIORITYRAWMETRICTAG']._serialized_end=155422 - _globals['_PATTERNFLOWIPV4PRIORITYRAW']._serialized_start=155425 - _globals['_PATTERNFLOWIPV4PRIORITYRAW']._serialized_end=155845 + _globals['_PATTERNFLOWIPV4PRIORITYRAWCOUNTER']._serialized_start=155563 + _globals['_PATTERNFLOWIPV4PRIORITYRAWCOUNTER']._serialized_end=155686 + _globals['_PATTERNFLOWIPV4PRIORITYRAWMETRICTAG']._serialized_start=155689 + _globals['_PATTERNFLOWIPV4PRIORITYRAWMETRICTAG']._serialized_end=155818 + _globals['_PATTERNFLOWIPV4PRIORITYRAW']._serialized_start=155821 + _globals['_PATTERNFLOWIPV4PRIORITYRAW']._serialized_end=156241 _globals['_PATTERNFLOWIPV4PRIORITYRAW_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV4PRIORITYRAW_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV4PRIORITYRAW_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV4PRIORITYRAW_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV4DSCPPHBCOUNTER']._serialized_start=155847 - _globals['_PATTERNFLOWIPV4DSCPPHBCOUNTER']._serialized_end=155966 - _globals['_PATTERNFLOWIPV4DSCPPHBMETRICTAG']._serialized_start=155968 - _globals['_PATTERNFLOWIPV4DSCPPHBMETRICTAG']._serialized_end=156093 - _globals['_PATTERNFLOWIPV4DSCPPHB']._serialized_start=156096 - _globals['_PATTERNFLOWIPV4DSCPPHB']._serialized_end=156496 + _globals['_PATTERNFLOWIPV4DSCPPHBCOUNTER']._serialized_start=156243 + _globals['_PATTERNFLOWIPV4DSCPPHBCOUNTER']._serialized_end=156362 + _globals['_PATTERNFLOWIPV4DSCPPHBMETRICTAG']._serialized_start=156364 + _globals['_PATTERNFLOWIPV4DSCPPHBMETRICTAG']._serialized_end=156489 + _globals['_PATTERNFLOWIPV4DSCPPHB']._serialized_start=156492 + _globals['_PATTERNFLOWIPV4DSCPPHB']._serialized_end=156892 _globals['_PATTERNFLOWIPV4DSCPPHB_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV4DSCPPHB_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV4DSCPPHB_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV4DSCPPHB_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV4DSCPECNCOUNTER']._serialized_start=156498 - _globals['_PATTERNFLOWIPV4DSCPECNCOUNTER']._serialized_end=156617 - _globals['_PATTERNFLOWIPV4DSCPECNMETRICTAG']._serialized_start=156619 - _globals['_PATTERNFLOWIPV4DSCPECNMETRICTAG']._serialized_end=156744 - _globals['_PATTERNFLOWIPV4DSCPECN']._serialized_start=156747 - _globals['_PATTERNFLOWIPV4DSCPECN']._serialized_end=157147 + _globals['_PATTERNFLOWIPV4DSCPECNCOUNTER']._serialized_start=156894 + _globals['_PATTERNFLOWIPV4DSCPECNCOUNTER']._serialized_end=157013 + _globals['_PATTERNFLOWIPV4DSCPECNMETRICTAG']._serialized_start=157015 + _globals['_PATTERNFLOWIPV4DSCPECNMETRICTAG']._serialized_end=157140 + _globals['_PATTERNFLOWIPV4DSCPECN']._serialized_start=157143 + _globals['_PATTERNFLOWIPV4DSCPECN']._serialized_end=157543 _globals['_PATTERNFLOWIPV4DSCPECN_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV4DSCPECN_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV4DSCPECN_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV4DSCPECN_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV4TOSPRECEDENCECOUNTER']._serialized_start=157149 - _globals['_PATTERNFLOWIPV4TOSPRECEDENCECOUNTER']._serialized_end=157274 - _globals['_PATTERNFLOWIPV4TOSPRECEDENCEMETRICTAG']._serialized_start=157277 - _globals['_PATTERNFLOWIPV4TOSPRECEDENCEMETRICTAG']._serialized_end=157408 - _globals['_PATTERNFLOWIPV4TOSPRECEDENCE']._serialized_start=157411 - _globals['_PATTERNFLOWIPV4TOSPRECEDENCE']._serialized_end=157841 + _globals['_PATTERNFLOWIPV4TOSPRECEDENCECOUNTER']._serialized_start=157545 + _globals['_PATTERNFLOWIPV4TOSPRECEDENCECOUNTER']._serialized_end=157670 + _globals['_PATTERNFLOWIPV4TOSPRECEDENCEMETRICTAG']._serialized_start=157673 + _globals['_PATTERNFLOWIPV4TOSPRECEDENCEMETRICTAG']._serialized_end=157804 + _globals['_PATTERNFLOWIPV4TOSPRECEDENCE']._serialized_start=157807 + _globals['_PATTERNFLOWIPV4TOSPRECEDENCE']._serialized_end=158237 _globals['_PATTERNFLOWIPV4TOSPRECEDENCE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV4TOSPRECEDENCE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV4TOSPRECEDENCE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV4TOSPRECEDENCE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV4TOSDELAYCOUNTER']._serialized_start=157843 - _globals['_PATTERNFLOWIPV4TOSDELAYCOUNTER']._serialized_end=157963 - _globals['_PATTERNFLOWIPV4TOSDELAYMETRICTAG']._serialized_start=157965 - _globals['_PATTERNFLOWIPV4TOSDELAYMETRICTAG']._serialized_end=158091 - _globals['_PATTERNFLOWIPV4TOSDELAY']._serialized_start=158094 - _globals['_PATTERNFLOWIPV4TOSDELAY']._serialized_end=158499 + _globals['_PATTERNFLOWIPV4TOSDELAYCOUNTER']._serialized_start=158239 + _globals['_PATTERNFLOWIPV4TOSDELAYCOUNTER']._serialized_end=158359 + _globals['_PATTERNFLOWIPV4TOSDELAYMETRICTAG']._serialized_start=158361 + _globals['_PATTERNFLOWIPV4TOSDELAYMETRICTAG']._serialized_end=158487 + _globals['_PATTERNFLOWIPV4TOSDELAY']._serialized_start=158490 + _globals['_PATTERNFLOWIPV4TOSDELAY']._serialized_end=158895 _globals['_PATTERNFLOWIPV4TOSDELAY_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV4TOSDELAY_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV4TOSDELAY_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV4TOSDELAY_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV4TOSTHROUGHPUTCOUNTER']._serialized_start=158501 - _globals['_PATTERNFLOWIPV4TOSTHROUGHPUTCOUNTER']._serialized_end=158626 - _globals['_PATTERNFLOWIPV4TOSTHROUGHPUTMETRICTAG']._serialized_start=158629 - _globals['_PATTERNFLOWIPV4TOSTHROUGHPUTMETRICTAG']._serialized_end=158760 - _globals['_PATTERNFLOWIPV4TOSTHROUGHPUT']._serialized_start=158763 - _globals['_PATTERNFLOWIPV4TOSTHROUGHPUT']._serialized_end=159193 + _globals['_PATTERNFLOWIPV4TOSTHROUGHPUTCOUNTER']._serialized_start=158897 + _globals['_PATTERNFLOWIPV4TOSTHROUGHPUTCOUNTER']._serialized_end=159022 + _globals['_PATTERNFLOWIPV4TOSTHROUGHPUTMETRICTAG']._serialized_start=159025 + _globals['_PATTERNFLOWIPV4TOSTHROUGHPUTMETRICTAG']._serialized_end=159156 + _globals['_PATTERNFLOWIPV4TOSTHROUGHPUT']._serialized_start=159159 + _globals['_PATTERNFLOWIPV4TOSTHROUGHPUT']._serialized_end=159589 _globals['_PATTERNFLOWIPV4TOSTHROUGHPUT_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV4TOSTHROUGHPUT_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV4TOSTHROUGHPUT_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV4TOSTHROUGHPUT_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV4TOSRELIABILITYCOUNTER']._serialized_start=159195 - _globals['_PATTERNFLOWIPV4TOSRELIABILITYCOUNTER']._serialized_end=159321 - _globals['_PATTERNFLOWIPV4TOSRELIABILITYMETRICTAG']._serialized_start=159324 - _globals['_PATTERNFLOWIPV4TOSRELIABILITYMETRICTAG']._serialized_end=159456 - _globals['_PATTERNFLOWIPV4TOSRELIABILITY']._serialized_start=159459 - _globals['_PATTERNFLOWIPV4TOSRELIABILITY']._serialized_end=159894 + _globals['_PATTERNFLOWIPV4TOSRELIABILITYCOUNTER']._serialized_start=159591 + _globals['_PATTERNFLOWIPV4TOSRELIABILITYCOUNTER']._serialized_end=159717 + _globals['_PATTERNFLOWIPV4TOSRELIABILITYMETRICTAG']._serialized_start=159720 + _globals['_PATTERNFLOWIPV4TOSRELIABILITYMETRICTAG']._serialized_end=159852 + _globals['_PATTERNFLOWIPV4TOSRELIABILITY']._serialized_start=159855 + _globals['_PATTERNFLOWIPV4TOSRELIABILITY']._serialized_end=160290 _globals['_PATTERNFLOWIPV4TOSRELIABILITY_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV4TOSRELIABILITY_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV4TOSRELIABILITY_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV4TOSRELIABILITY_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV4TOSMONETARYCOUNTER']._serialized_start=159896 - _globals['_PATTERNFLOWIPV4TOSMONETARYCOUNTER']._serialized_end=160019 - _globals['_PATTERNFLOWIPV4TOSMONETARYMETRICTAG']._serialized_start=160022 - _globals['_PATTERNFLOWIPV4TOSMONETARYMETRICTAG']._serialized_end=160151 - _globals['_PATTERNFLOWIPV4TOSMONETARY']._serialized_start=160154 - _globals['_PATTERNFLOWIPV4TOSMONETARY']._serialized_end=160574 + _globals['_PATTERNFLOWIPV4TOSMONETARYCOUNTER']._serialized_start=160292 + _globals['_PATTERNFLOWIPV4TOSMONETARYCOUNTER']._serialized_end=160415 + _globals['_PATTERNFLOWIPV4TOSMONETARYMETRICTAG']._serialized_start=160418 + _globals['_PATTERNFLOWIPV4TOSMONETARYMETRICTAG']._serialized_end=160547 + _globals['_PATTERNFLOWIPV4TOSMONETARY']._serialized_start=160550 + _globals['_PATTERNFLOWIPV4TOSMONETARY']._serialized_end=160970 _globals['_PATTERNFLOWIPV4TOSMONETARY_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV4TOSMONETARY_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV4TOSMONETARY_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV4TOSMONETARY_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV4TOSUNUSEDCOUNTER']._serialized_start=160576 - _globals['_PATTERNFLOWIPV4TOSUNUSEDCOUNTER']._serialized_end=160697 - _globals['_PATTERNFLOWIPV4TOSUNUSEDMETRICTAG']._serialized_start=160699 - _globals['_PATTERNFLOWIPV4TOSUNUSEDMETRICTAG']._serialized_end=160826 - _globals['_PATTERNFLOWIPV4TOSUNUSED']._serialized_start=160829 - _globals['_PATTERNFLOWIPV4TOSUNUSED']._serialized_end=161239 + _globals['_PATTERNFLOWIPV4TOSUNUSEDCOUNTER']._serialized_start=160972 + _globals['_PATTERNFLOWIPV4TOSUNUSEDCOUNTER']._serialized_end=161093 + _globals['_PATTERNFLOWIPV4TOSUNUSEDMETRICTAG']._serialized_start=161095 + _globals['_PATTERNFLOWIPV4TOSUNUSEDMETRICTAG']._serialized_end=161222 + _globals['_PATTERNFLOWIPV4TOSUNUSED']._serialized_start=161225 + _globals['_PATTERNFLOWIPV4TOSUNUSED']._serialized_end=161635 _globals['_PATTERNFLOWIPV4TOSUNUSED_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV4TOSUNUSED_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV4TOSUNUSED_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV4TOSUNUSED_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV6VERSIONCOUNTER']._serialized_start=161241 - _globals['_PATTERNFLOWIPV6VERSIONCOUNTER']._serialized_end=161360 - _globals['_PATTERNFLOWIPV6VERSIONMETRICTAG']._serialized_start=161362 - _globals['_PATTERNFLOWIPV6VERSIONMETRICTAG']._serialized_end=161487 - _globals['_PATTERNFLOWIPV6VERSION']._serialized_start=161490 - _globals['_PATTERNFLOWIPV6VERSION']._serialized_end=161890 + _globals['_PATTERNFLOWIPV6VERSIONCOUNTER']._serialized_start=161637 + _globals['_PATTERNFLOWIPV6VERSIONCOUNTER']._serialized_end=161756 + _globals['_PATTERNFLOWIPV6VERSIONMETRICTAG']._serialized_start=161758 + _globals['_PATTERNFLOWIPV6VERSIONMETRICTAG']._serialized_end=161883 + _globals['_PATTERNFLOWIPV6VERSION']._serialized_start=161886 + _globals['_PATTERNFLOWIPV6VERSION']._serialized_end=162286 _globals['_PATTERNFLOWIPV6VERSION_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV6VERSION_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV6VERSION_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV6VERSION_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV6TRAFFICCLASSCOUNTER']._serialized_start=161892 - _globals['_PATTERNFLOWIPV6TRAFFICCLASSCOUNTER']._serialized_end=162016 - _globals['_PATTERNFLOWIPV6TRAFFICCLASSMETRICTAG']._serialized_start=162019 - _globals['_PATTERNFLOWIPV6TRAFFICCLASSMETRICTAG']._serialized_end=162149 - _globals['_PATTERNFLOWIPV6TRAFFICCLASS']._serialized_start=162152 - _globals['_PATTERNFLOWIPV6TRAFFICCLASS']._serialized_end=162577 + _globals['_PATTERNFLOWIPV6TRAFFICCLASSCOUNTER']._serialized_start=162288 + _globals['_PATTERNFLOWIPV6TRAFFICCLASSCOUNTER']._serialized_end=162412 + _globals['_PATTERNFLOWIPV6TRAFFICCLASSMETRICTAG']._serialized_start=162415 + _globals['_PATTERNFLOWIPV6TRAFFICCLASSMETRICTAG']._serialized_end=162545 + _globals['_PATTERNFLOWIPV6TRAFFICCLASS']._serialized_start=162548 + _globals['_PATTERNFLOWIPV6TRAFFICCLASS']._serialized_end=162973 _globals['_PATTERNFLOWIPV6TRAFFICCLASS_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV6TRAFFICCLASS_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV6TRAFFICCLASS_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV6TRAFFICCLASS_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV6FLOWLABELCOUNTER']._serialized_start=162579 - _globals['_PATTERNFLOWIPV6FLOWLABELCOUNTER']._serialized_end=162700 - _globals['_PATTERNFLOWIPV6FLOWLABELMETRICTAG']._serialized_start=162702 - _globals['_PATTERNFLOWIPV6FLOWLABELMETRICTAG']._serialized_end=162829 - _globals['_PATTERNFLOWIPV6FLOWLABEL']._serialized_start=162832 - _globals['_PATTERNFLOWIPV6FLOWLABEL']._serialized_end=163242 - _globals['_PATTERNFLOWIPV6FLOWLABEL_CHOICE']._serialized_start=138151 - _globals['_PATTERNFLOWIPV6FLOWLABEL_CHOICE']._serialized_end=138237 - _globals['_PATTERNFLOWIPV6FLOWLABEL_CHOICE_ENUM']._serialized_start=138161 - _globals['_PATTERNFLOWIPV6FLOWLABEL_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV6PAYLOADLENGTHCOUNTER']._serialized_start=163244 - _globals['_PATTERNFLOWIPV6PAYLOADLENGTHCOUNTER']._serialized_end=163369 - _globals['_PATTERNFLOWIPV6PAYLOADLENGTHMETRICTAG']._serialized_start=163372 - _globals['_PATTERNFLOWIPV6PAYLOADLENGTHMETRICTAG']._serialized_end=163503 - _globals['_PATTERNFLOWIPV6PAYLOADLENGTH']._serialized_start=163506 - _globals['_PATTERNFLOWIPV6PAYLOADLENGTH']._serialized_end=163974 + _globals['_PATTERNFLOWIPV6FLOWLABELCOUNTER']._serialized_start=162975 + _globals['_PATTERNFLOWIPV6FLOWLABELCOUNTER']._serialized_end=163096 + _globals['_PATTERNFLOWIPV6FLOWLABELMETRICTAG']._serialized_start=163098 + _globals['_PATTERNFLOWIPV6FLOWLABELMETRICTAG']._serialized_end=163225 + _globals['_PATTERNFLOWIPV6FLOWLABELRANDOM']._serialized_start=163228 + _globals['_PATTERNFLOWIPV6FLOWLABELRANDOM']._serialized_end=163370 + _globals['_PATTERNFLOWIPV6FLOWLABEL']._serialized_start=163373 + _globals['_PATTERNFLOWIPV6FLOWLABEL']._serialized_end=163848 + _globals['_PATTERNFLOWIPV6FLOWLABEL_CHOICE']._serialized_start=163729 + _globals['_PATTERNFLOWIPV6FLOWLABEL_CHOICE']._serialized_end=163827 + _globals['_PATTERNFLOWIPV6FLOWLABEL_CHOICE_ENUM']._serialized_start=163739 + _globals['_PATTERNFLOWIPV6FLOWLABEL_CHOICE_ENUM']._serialized_end=163827 + _globals['_PATTERNFLOWIPV6PAYLOADLENGTHCOUNTER']._serialized_start=163850 + _globals['_PATTERNFLOWIPV6PAYLOADLENGTHCOUNTER']._serialized_end=163975 + _globals['_PATTERNFLOWIPV6PAYLOADLENGTHMETRICTAG']._serialized_start=163978 + _globals['_PATTERNFLOWIPV6PAYLOADLENGTHMETRICTAG']._serialized_end=164109 + _globals['_PATTERNFLOWIPV6PAYLOADLENGTH']._serialized_start=164112 + _globals['_PATTERNFLOWIPV6PAYLOADLENGTH']._serialized_end=164580 _globals['_PATTERNFLOWIPV6PAYLOADLENGTH_CHOICE']._serialized_start=137481 _globals['_PATTERNFLOWIPV6PAYLOADLENGTH_CHOICE']._serialized_end=137577 _globals['_PATTERNFLOWIPV6PAYLOADLENGTH_CHOICE_ENUM']._serialized_start=137491 _globals['_PATTERNFLOWIPV6PAYLOADLENGTH_CHOICE_ENUM']._serialized_end=137577 - _globals['_PATTERNFLOWIPV6NEXTHEADERCOUNTER']._serialized_start=163976 - _globals['_PATTERNFLOWIPV6NEXTHEADERCOUNTER']._serialized_end=164098 - _globals['_PATTERNFLOWIPV6NEXTHEADERMETRICTAG']._serialized_start=164101 - _globals['_PATTERNFLOWIPV6NEXTHEADERMETRICTAG']._serialized_end=164229 - _globals['_PATTERNFLOWIPV6NEXTHEADER']._serialized_start=164232 - _globals['_PATTERNFLOWIPV6NEXTHEADER']._serialized_end=164685 + _globals['_PATTERNFLOWIPV6NEXTHEADERCOUNTER']._serialized_start=164582 + _globals['_PATTERNFLOWIPV6NEXTHEADERCOUNTER']._serialized_end=164704 + _globals['_PATTERNFLOWIPV6NEXTHEADERMETRICTAG']._serialized_start=164707 + _globals['_PATTERNFLOWIPV6NEXTHEADERMETRICTAG']._serialized_end=164835 + _globals['_PATTERNFLOWIPV6NEXTHEADER']._serialized_start=164838 + _globals['_PATTERNFLOWIPV6NEXTHEADER']._serialized_end=165291 _globals['_PATTERNFLOWIPV6NEXTHEADER_CHOICE']._serialized_start=137481 _globals['_PATTERNFLOWIPV6NEXTHEADER_CHOICE']._serialized_end=137577 _globals['_PATTERNFLOWIPV6NEXTHEADER_CHOICE_ENUM']._serialized_start=137491 _globals['_PATTERNFLOWIPV6NEXTHEADER_CHOICE_ENUM']._serialized_end=137577 - _globals['_PATTERNFLOWIPV6HOPLIMITCOUNTER']._serialized_start=164687 - _globals['_PATTERNFLOWIPV6HOPLIMITCOUNTER']._serialized_end=164807 - _globals['_PATTERNFLOWIPV6HOPLIMITMETRICTAG']._serialized_start=164809 - _globals['_PATTERNFLOWIPV6HOPLIMITMETRICTAG']._serialized_end=164935 - _globals['_PATTERNFLOWIPV6HOPLIMIT']._serialized_start=164938 - _globals['_PATTERNFLOWIPV6HOPLIMIT']._serialized_end=165343 + _globals['_PATTERNFLOWIPV6HOPLIMITCOUNTER']._serialized_start=165293 + _globals['_PATTERNFLOWIPV6HOPLIMITCOUNTER']._serialized_end=165413 + _globals['_PATTERNFLOWIPV6HOPLIMITMETRICTAG']._serialized_start=165415 + _globals['_PATTERNFLOWIPV6HOPLIMITMETRICTAG']._serialized_end=165541 + _globals['_PATTERNFLOWIPV6HOPLIMIT']._serialized_start=165544 + _globals['_PATTERNFLOWIPV6HOPLIMIT']._serialized_end=165949 _globals['_PATTERNFLOWIPV6HOPLIMIT_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV6HOPLIMIT_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV6HOPLIMIT_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV6HOPLIMIT_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV6SRCCOUNTER']._serialized_start=165345 - _globals['_PATTERNFLOWIPV6SRCCOUNTER']._serialized_end=165460 - _globals['_PATTERNFLOWIPV6SRCMETRICTAG']._serialized_start=165462 - _globals['_PATTERNFLOWIPV6SRCMETRICTAG']._serialized_end=165583 - _globals['_PATTERNFLOWIPV6SRC']._serialized_start=165586 - _globals['_PATTERNFLOWIPV6SRC']._serialized_end=165966 + _globals['_PATTERNFLOWIPV6SRCCOUNTER']._serialized_start=165951 + _globals['_PATTERNFLOWIPV6SRCCOUNTER']._serialized_end=166066 + _globals['_PATTERNFLOWIPV6SRCMETRICTAG']._serialized_start=166068 + _globals['_PATTERNFLOWIPV6SRCMETRICTAG']._serialized_end=166189 + _globals['_PATTERNFLOWIPV6SRC']._serialized_start=166192 + _globals['_PATTERNFLOWIPV6SRC']._serialized_end=166572 _globals['_PATTERNFLOWIPV6SRC_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV6SRC_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV6SRC_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV6SRC_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIPV6DSTCOUNTER']._serialized_start=165968 - _globals['_PATTERNFLOWIPV6DSTCOUNTER']._serialized_end=166083 - _globals['_PATTERNFLOWIPV6DSTMETRICTAG']._serialized_start=166085 - _globals['_PATTERNFLOWIPV6DSTMETRICTAG']._serialized_end=166206 - _globals['_PATTERNFLOWIPV6DST']._serialized_start=166209 - _globals['_PATTERNFLOWIPV6DST']._serialized_end=166589 + _globals['_PATTERNFLOWIPV6DSTCOUNTER']._serialized_start=166574 + _globals['_PATTERNFLOWIPV6DSTCOUNTER']._serialized_end=166689 + _globals['_PATTERNFLOWIPV6DSTMETRICTAG']._serialized_start=166691 + _globals['_PATTERNFLOWIPV6DSTMETRICTAG']._serialized_end=166812 + _globals['_PATTERNFLOWIPV6DST']._serialized_start=166815 + _globals['_PATTERNFLOWIPV6DST']._serialized_end=167195 _globals['_PATTERNFLOWIPV6DST_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIPV6DST_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIPV6DST_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIPV6DST_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPFCPAUSEDSTCOUNTER']._serialized_start=166591 - _globals['_PATTERNFLOWPFCPAUSEDSTCOUNTER']._serialized_end=166710 - _globals['_PATTERNFLOWPFCPAUSEDSTMETRICTAG']._serialized_start=166712 - _globals['_PATTERNFLOWPFCPAUSEDSTMETRICTAG']._serialized_end=166837 - _globals['_PATTERNFLOWPFCPAUSEDST']._serialized_start=166840 - _globals['_PATTERNFLOWPFCPAUSEDST']._serialized_end=167240 + _globals['_PATTERNFLOWPFCPAUSEDSTCOUNTER']._serialized_start=167197 + _globals['_PATTERNFLOWPFCPAUSEDSTCOUNTER']._serialized_end=167316 + _globals['_PATTERNFLOWPFCPAUSEDSTMETRICTAG']._serialized_start=167318 + _globals['_PATTERNFLOWPFCPAUSEDSTMETRICTAG']._serialized_end=167443 + _globals['_PATTERNFLOWPFCPAUSEDST']._serialized_start=167446 + _globals['_PATTERNFLOWPFCPAUSEDST']._serialized_end=167846 _globals['_PATTERNFLOWPFCPAUSEDST_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPFCPAUSEDST_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPFCPAUSEDST_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPFCPAUSEDST_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPFCPAUSESRCCOUNTER']._serialized_start=167242 - _globals['_PATTERNFLOWPFCPAUSESRCCOUNTER']._serialized_end=167361 - _globals['_PATTERNFLOWPFCPAUSESRCMETRICTAG']._serialized_start=167363 - _globals['_PATTERNFLOWPFCPAUSESRCMETRICTAG']._serialized_end=167488 - _globals['_PATTERNFLOWPFCPAUSESRC']._serialized_start=167491 - _globals['_PATTERNFLOWPFCPAUSESRC']._serialized_end=167891 + _globals['_PATTERNFLOWPFCPAUSESRCCOUNTER']._serialized_start=167848 + _globals['_PATTERNFLOWPFCPAUSESRCCOUNTER']._serialized_end=167967 + _globals['_PATTERNFLOWPFCPAUSESRCMETRICTAG']._serialized_start=167969 + _globals['_PATTERNFLOWPFCPAUSESRCMETRICTAG']._serialized_end=168094 + _globals['_PATTERNFLOWPFCPAUSESRC']._serialized_start=168097 + _globals['_PATTERNFLOWPFCPAUSESRC']._serialized_end=168497 _globals['_PATTERNFLOWPFCPAUSESRC_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPFCPAUSESRC_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPFCPAUSESRC_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPFCPAUSESRC_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPFCPAUSEETHERTYPECOUNTER']._serialized_start=167893 - _globals['_PATTERNFLOWPFCPAUSEETHERTYPECOUNTER']._serialized_end=168018 - _globals['_PATTERNFLOWPFCPAUSEETHERTYPEMETRICTAG']._serialized_start=168021 - _globals['_PATTERNFLOWPFCPAUSEETHERTYPEMETRICTAG']._serialized_end=168152 - _globals['_PATTERNFLOWPFCPAUSEETHERTYPE']._serialized_start=168155 - _globals['_PATTERNFLOWPFCPAUSEETHERTYPE']._serialized_end=168585 + _globals['_PATTERNFLOWPFCPAUSEETHERTYPECOUNTER']._serialized_start=168499 + _globals['_PATTERNFLOWPFCPAUSEETHERTYPECOUNTER']._serialized_end=168624 + _globals['_PATTERNFLOWPFCPAUSEETHERTYPEMETRICTAG']._serialized_start=168627 + _globals['_PATTERNFLOWPFCPAUSEETHERTYPEMETRICTAG']._serialized_end=168758 + _globals['_PATTERNFLOWPFCPAUSEETHERTYPE']._serialized_start=168761 + _globals['_PATTERNFLOWPFCPAUSEETHERTYPE']._serialized_end=169191 _globals['_PATTERNFLOWPFCPAUSEETHERTYPE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPFCPAUSEETHERTYPE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPFCPAUSEETHERTYPE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPFCPAUSEETHERTYPE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODECOUNTER']._serialized_start=168588 - _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODECOUNTER']._serialized_end=168717 - _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODEMETRICTAG']._serialized_start=168720 - _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODEMETRICTAG']._serialized_end=168855 - _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODE']._serialized_start=168858 - _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODE']._serialized_end=169308 + _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODECOUNTER']._serialized_start=169194 + _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODECOUNTER']._serialized_end=169323 + _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODEMETRICTAG']._serialized_start=169326 + _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODEMETRICTAG']._serialized_end=169461 + _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODE']._serialized_start=169464 + _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODE']._serialized_end=169914 _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPFCPAUSECONTROLOPCODE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTORCOUNTER']._serialized_start=169311 - _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTORCOUNTER']._serialized_end=169444 - _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTORMETRICTAG']._serialized_start=169447 - _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTORMETRICTAG']._serialized_end=169586 - _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTOR']._serialized_start=169589 - _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTOR']._serialized_end=170059 + _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTORCOUNTER']._serialized_start=169917 + _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTORCOUNTER']._serialized_end=170050 + _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTORMETRICTAG']._serialized_start=170053 + _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTORMETRICTAG']._serialized_end=170192 + _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTOR']._serialized_start=170195 + _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTOR']._serialized_end=170665 _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTOR_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTOR_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTOR_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPFCPAUSECLASSENABLEVECTOR_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0COUNTER']._serialized_start=170061 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0COUNTER']._serialized_end=170188 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0METRICTAG']._serialized_start=170191 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0METRICTAG']._serialized_end=170324 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0']._serialized_start=170327 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0']._serialized_end=170767 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0COUNTER']._serialized_start=170667 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0COUNTER']._serialized_end=170794 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0METRICTAG']._serialized_start=170797 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0METRICTAG']._serialized_end=170930 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0']._serialized_start=170933 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0']._serialized_end=171373 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS0_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1COUNTER']._serialized_start=170769 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1COUNTER']._serialized_end=170896 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1METRICTAG']._serialized_start=170899 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1METRICTAG']._serialized_end=171032 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1']._serialized_start=171035 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1']._serialized_end=171475 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1COUNTER']._serialized_start=171375 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1COUNTER']._serialized_end=171502 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1METRICTAG']._serialized_start=171505 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1METRICTAG']._serialized_end=171638 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1']._serialized_start=171641 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1']._serialized_end=172081 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS1_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2COUNTER']._serialized_start=171477 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2COUNTER']._serialized_end=171604 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2METRICTAG']._serialized_start=171607 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2METRICTAG']._serialized_end=171740 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2']._serialized_start=171743 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2']._serialized_end=172183 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2COUNTER']._serialized_start=172083 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2COUNTER']._serialized_end=172210 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2METRICTAG']._serialized_start=172213 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2METRICTAG']._serialized_end=172346 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2']._serialized_start=172349 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2']._serialized_end=172789 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS2_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3COUNTER']._serialized_start=172185 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3COUNTER']._serialized_end=172312 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3METRICTAG']._serialized_start=172315 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3METRICTAG']._serialized_end=172448 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3']._serialized_start=172451 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3']._serialized_end=172891 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3COUNTER']._serialized_start=172791 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3COUNTER']._serialized_end=172918 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3METRICTAG']._serialized_start=172921 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3METRICTAG']._serialized_end=173054 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3']._serialized_start=173057 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3']._serialized_end=173497 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS3_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4COUNTER']._serialized_start=172893 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4COUNTER']._serialized_end=173020 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4METRICTAG']._serialized_start=173023 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4METRICTAG']._serialized_end=173156 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4']._serialized_start=173159 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4']._serialized_end=173599 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4COUNTER']._serialized_start=173499 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4COUNTER']._serialized_end=173626 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4METRICTAG']._serialized_start=173629 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4METRICTAG']._serialized_end=173762 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4']._serialized_start=173765 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4']._serialized_end=174205 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS4_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5COUNTER']._serialized_start=173601 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5COUNTER']._serialized_end=173728 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5METRICTAG']._serialized_start=173731 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5METRICTAG']._serialized_end=173864 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5']._serialized_start=173867 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5']._serialized_end=174307 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5COUNTER']._serialized_start=174207 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5COUNTER']._serialized_end=174334 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5METRICTAG']._serialized_start=174337 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5METRICTAG']._serialized_end=174470 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5']._serialized_start=174473 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5']._serialized_end=174913 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS5_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6COUNTER']._serialized_start=174309 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6COUNTER']._serialized_end=174436 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6METRICTAG']._serialized_start=174439 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6METRICTAG']._serialized_end=174572 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6']._serialized_start=174575 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6']._serialized_end=175015 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6COUNTER']._serialized_start=174915 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6COUNTER']._serialized_end=175042 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6METRICTAG']._serialized_start=175045 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6METRICTAG']._serialized_end=175178 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6']._serialized_start=175181 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6']._serialized_end=175621 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS6_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7COUNTER']._serialized_start=175017 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7COUNTER']._serialized_end=175144 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7METRICTAG']._serialized_start=175147 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7METRICTAG']._serialized_end=175280 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7']._serialized_start=175283 - _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7']._serialized_end=175723 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7COUNTER']._serialized_start=175623 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7COUNTER']._serialized_end=175750 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7METRICTAG']._serialized_start=175753 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7METRICTAG']._serialized_end=175886 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7']._serialized_start=175889 + _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7']._serialized_end=176329 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPFCPAUSEPAUSECLASS7_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWETHERNETPAUSEDSTCOUNTER']._serialized_start=175725 - _globals['_PATTERNFLOWETHERNETPAUSEDSTCOUNTER']._serialized_end=175849 - _globals['_PATTERNFLOWETHERNETPAUSEDSTMETRICTAG']._serialized_start=175852 - _globals['_PATTERNFLOWETHERNETPAUSEDSTMETRICTAG']._serialized_end=175982 - _globals['_PATTERNFLOWETHERNETPAUSEDST']._serialized_start=175985 - _globals['_PATTERNFLOWETHERNETPAUSEDST']._serialized_end=176410 + _globals['_PATTERNFLOWETHERNETPAUSEDSTCOUNTER']._serialized_start=176331 + _globals['_PATTERNFLOWETHERNETPAUSEDSTCOUNTER']._serialized_end=176455 + _globals['_PATTERNFLOWETHERNETPAUSEDSTMETRICTAG']._serialized_start=176458 + _globals['_PATTERNFLOWETHERNETPAUSEDSTMETRICTAG']._serialized_end=176588 + _globals['_PATTERNFLOWETHERNETPAUSEDST']._serialized_start=176591 + _globals['_PATTERNFLOWETHERNETPAUSEDST']._serialized_end=177016 _globals['_PATTERNFLOWETHERNETPAUSEDST_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWETHERNETPAUSEDST_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWETHERNETPAUSEDST_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWETHERNETPAUSEDST_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWETHERNETPAUSESRCCOUNTER']._serialized_start=176412 - _globals['_PATTERNFLOWETHERNETPAUSESRCCOUNTER']._serialized_end=176536 - _globals['_PATTERNFLOWETHERNETPAUSESRCMETRICTAG']._serialized_start=176539 - _globals['_PATTERNFLOWETHERNETPAUSESRCMETRICTAG']._serialized_end=176669 - _globals['_PATTERNFLOWETHERNETPAUSESRC']._serialized_start=176672 - _globals['_PATTERNFLOWETHERNETPAUSESRC']._serialized_end=177097 + _globals['_PATTERNFLOWETHERNETPAUSESRCCOUNTER']._serialized_start=177018 + _globals['_PATTERNFLOWETHERNETPAUSESRCCOUNTER']._serialized_end=177142 + _globals['_PATTERNFLOWETHERNETPAUSESRCMETRICTAG']._serialized_start=177145 + _globals['_PATTERNFLOWETHERNETPAUSESRCMETRICTAG']._serialized_end=177275 + _globals['_PATTERNFLOWETHERNETPAUSESRC']._serialized_start=177278 + _globals['_PATTERNFLOWETHERNETPAUSESRC']._serialized_end=177703 _globals['_PATTERNFLOWETHERNETPAUSESRC_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWETHERNETPAUSESRC_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWETHERNETPAUSESRC_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWETHERNETPAUSESRC_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPECOUNTER']._serialized_start=177100 - _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPECOUNTER']._serialized_end=177230 - _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPEMETRICTAG']._serialized_start=177233 - _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPEMETRICTAG']._serialized_end=177369 - _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPE']._serialized_start=177372 - _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPE']._serialized_end=177827 + _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPECOUNTER']._serialized_start=177706 + _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPECOUNTER']._serialized_end=177836 + _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPEMETRICTAG']._serialized_start=177839 + _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPEMETRICTAG']._serialized_end=177975 + _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPE']._serialized_start=177978 + _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPE']._serialized_end=178433 _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWETHERNETPAUSEETHERTYPE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODECOUNTER']._serialized_start=177830 - _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODECOUNTER']._serialized_end=177964 - _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODEMETRICTAG']._serialized_start=177967 - _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODEMETRICTAG']._serialized_end=178107 - _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODE']._serialized_start=178110 - _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODE']._serialized_end=178585 + _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODECOUNTER']._serialized_start=178436 + _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODECOUNTER']._serialized_end=178570 + _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODEMETRICTAG']._serialized_start=178573 + _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODEMETRICTAG']._serialized_end=178713 + _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODE']._serialized_start=178716 + _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODE']._serialized_end=179191 _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWETHERNETPAUSECONTROLOPCODE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWETHERNETPAUSETIMECOUNTER']._serialized_start=178587 - _globals['_PATTERNFLOWETHERNETPAUSETIMECOUNTER']._serialized_end=178712 - _globals['_PATTERNFLOWETHERNETPAUSETIMEMETRICTAG']._serialized_start=178715 - _globals['_PATTERNFLOWETHERNETPAUSETIMEMETRICTAG']._serialized_end=178846 - _globals['_PATTERNFLOWETHERNETPAUSETIME']._serialized_start=178849 - _globals['_PATTERNFLOWETHERNETPAUSETIME']._serialized_end=179279 + _globals['_PATTERNFLOWETHERNETPAUSETIMECOUNTER']._serialized_start=179193 + _globals['_PATTERNFLOWETHERNETPAUSETIMECOUNTER']._serialized_end=179318 + _globals['_PATTERNFLOWETHERNETPAUSETIMEMETRICTAG']._serialized_start=179321 + _globals['_PATTERNFLOWETHERNETPAUSETIMEMETRICTAG']._serialized_end=179452 + _globals['_PATTERNFLOWETHERNETPAUSETIME']._serialized_start=179455 + _globals['_PATTERNFLOWETHERNETPAUSETIME']._serialized_end=179885 _globals['_PATTERNFLOWETHERNETPAUSETIME_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWETHERNETPAUSETIME_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWETHERNETPAUSETIME_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWETHERNETPAUSETIME_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPSRCPORTCOUNTER']._serialized_start=179281 - _globals['_PATTERNFLOWTCPSRCPORTCOUNTER']._serialized_end=179399 - _globals['_PATTERNFLOWTCPSRCPORTMETRICTAG']._serialized_start=179401 - _globals['_PATTERNFLOWTCPSRCPORTMETRICTAG']._serialized_end=179525 - _globals['_PATTERNFLOWTCPSRCPORT']._serialized_start=179528 - _globals['_PATTERNFLOWTCPSRCPORT']._serialized_end=179923 - _globals['_PATTERNFLOWTCPSRCPORT_CHOICE']._serialized_start=138151 - _globals['_PATTERNFLOWTCPSRCPORT_CHOICE']._serialized_end=138237 - _globals['_PATTERNFLOWTCPSRCPORT_CHOICE_ENUM']._serialized_start=138161 - _globals['_PATTERNFLOWTCPSRCPORT_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPDSTPORTCOUNTER']._serialized_start=179925 - _globals['_PATTERNFLOWTCPDSTPORTCOUNTER']._serialized_end=180043 - _globals['_PATTERNFLOWTCPDSTPORTMETRICTAG']._serialized_start=180045 - _globals['_PATTERNFLOWTCPDSTPORTMETRICTAG']._serialized_end=180169 - _globals['_PATTERNFLOWTCPDSTPORT']._serialized_start=180172 - _globals['_PATTERNFLOWTCPDSTPORT']._serialized_end=180567 - _globals['_PATTERNFLOWTCPDSTPORT_CHOICE']._serialized_start=138151 - _globals['_PATTERNFLOWTCPDSTPORT_CHOICE']._serialized_end=138237 - _globals['_PATTERNFLOWTCPDSTPORT_CHOICE_ENUM']._serialized_start=138161 - _globals['_PATTERNFLOWTCPDSTPORT_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPSEQNUMCOUNTER']._serialized_start=180569 - _globals['_PATTERNFLOWTCPSEQNUMCOUNTER']._serialized_end=180686 - _globals['_PATTERNFLOWTCPSEQNUMMETRICTAG']._serialized_start=180688 - _globals['_PATTERNFLOWTCPSEQNUMMETRICTAG']._serialized_end=180811 - _globals['_PATTERNFLOWTCPSEQNUM']._serialized_start=180814 - _globals['_PATTERNFLOWTCPSEQNUM']._serialized_end=181204 + _globals['_PATTERNFLOWTCPSRCPORTCOUNTER']._serialized_start=179887 + _globals['_PATTERNFLOWTCPSRCPORTCOUNTER']._serialized_end=180005 + _globals['_PATTERNFLOWTCPSRCPORTMETRICTAG']._serialized_start=180007 + _globals['_PATTERNFLOWTCPSRCPORTMETRICTAG']._serialized_end=180131 + _globals['_PATTERNFLOWTCPSRCPORTRANDOM']._serialized_start=180134 + _globals['_PATTERNFLOWTCPSRCPORTRANDOM']._serialized_end=180273 + _globals['_PATTERNFLOWTCPSRCPORT']._serialized_start=180276 + _globals['_PATTERNFLOWTCPSRCPORT']._serialized_end=180733 + _globals['_PATTERNFLOWTCPSRCPORT_CHOICE']._serialized_start=163729 + _globals['_PATTERNFLOWTCPSRCPORT_CHOICE']._serialized_end=163827 + _globals['_PATTERNFLOWTCPSRCPORT_CHOICE_ENUM']._serialized_start=163739 + _globals['_PATTERNFLOWTCPSRCPORT_CHOICE_ENUM']._serialized_end=163827 + _globals['_PATTERNFLOWTCPDSTPORTCOUNTER']._serialized_start=180735 + _globals['_PATTERNFLOWTCPDSTPORTCOUNTER']._serialized_end=180853 + _globals['_PATTERNFLOWTCPDSTPORTMETRICTAG']._serialized_start=180855 + _globals['_PATTERNFLOWTCPDSTPORTMETRICTAG']._serialized_end=180979 + _globals['_PATTERNFLOWTCPDSTPORTRANDOM']._serialized_start=180982 + _globals['_PATTERNFLOWTCPDSTPORTRANDOM']._serialized_end=181121 + _globals['_PATTERNFLOWTCPDSTPORT']._serialized_start=181124 + _globals['_PATTERNFLOWTCPDSTPORT']._serialized_end=181581 + _globals['_PATTERNFLOWTCPDSTPORT_CHOICE']._serialized_start=163729 + _globals['_PATTERNFLOWTCPDSTPORT_CHOICE']._serialized_end=163827 + _globals['_PATTERNFLOWTCPDSTPORT_CHOICE_ENUM']._serialized_start=163739 + _globals['_PATTERNFLOWTCPDSTPORT_CHOICE_ENUM']._serialized_end=163827 + _globals['_PATTERNFLOWTCPSEQNUMCOUNTER']._serialized_start=181583 + _globals['_PATTERNFLOWTCPSEQNUMCOUNTER']._serialized_end=181700 + _globals['_PATTERNFLOWTCPSEQNUMMETRICTAG']._serialized_start=181702 + _globals['_PATTERNFLOWTCPSEQNUMMETRICTAG']._serialized_end=181825 + _globals['_PATTERNFLOWTCPSEQNUM']._serialized_start=181828 + _globals['_PATTERNFLOWTCPSEQNUM']._serialized_end=182218 _globals['_PATTERNFLOWTCPSEQNUM_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWTCPSEQNUM_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWTCPSEQNUM_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWTCPSEQNUM_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPACKNUMCOUNTER']._serialized_start=181206 - _globals['_PATTERNFLOWTCPACKNUMCOUNTER']._serialized_end=181323 - _globals['_PATTERNFLOWTCPACKNUMMETRICTAG']._serialized_start=181325 - _globals['_PATTERNFLOWTCPACKNUMMETRICTAG']._serialized_end=181448 - _globals['_PATTERNFLOWTCPACKNUM']._serialized_start=181451 - _globals['_PATTERNFLOWTCPACKNUM']._serialized_end=181841 + _globals['_PATTERNFLOWTCPACKNUMCOUNTER']._serialized_start=182220 + _globals['_PATTERNFLOWTCPACKNUMCOUNTER']._serialized_end=182337 + _globals['_PATTERNFLOWTCPACKNUMMETRICTAG']._serialized_start=182339 + _globals['_PATTERNFLOWTCPACKNUMMETRICTAG']._serialized_end=182462 + _globals['_PATTERNFLOWTCPACKNUM']._serialized_start=182465 + _globals['_PATTERNFLOWTCPACKNUM']._serialized_end=182855 _globals['_PATTERNFLOWTCPACKNUM_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWTCPACKNUM_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWTCPACKNUM_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWTCPACKNUM_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPDATAOFFSETCOUNTER']._serialized_start=181843 - _globals['_PATTERNFLOWTCPDATAOFFSETCOUNTER']._serialized_end=181964 - _globals['_PATTERNFLOWTCPDATAOFFSETMETRICTAG']._serialized_start=181966 - _globals['_PATTERNFLOWTCPDATAOFFSETMETRICTAG']._serialized_end=182093 - _globals['_PATTERNFLOWTCPDATAOFFSET']._serialized_start=182096 - _globals['_PATTERNFLOWTCPDATAOFFSET']._serialized_end=182506 + _globals['_PATTERNFLOWTCPDATAOFFSETCOUNTER']._serialized_start=182857 + _globals['_PATTERNFLOWTCPDATAOFFSETCOUNTER']._serialized_end=182978 + _globals['_PATTERNFLOWTCPDATAOFFSETMETRICTAG']._serialized_start=182980 + _globals['_PATTERNFLOWTCPDATAOFFSETMETRICTAG']._serialized_end=183107 + _globals['_PATTERNFLOWTCPDATAOFFSET']._serialized_start=183110 + _globals['_PATTERNFLOWTCPDATAOFFSET']._serialized_end=183520 _globals['_PATTERNFLOWTCPDATAOFFSET_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWTCPDATAOFFSET_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWTCPDATAOFFSET_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWTCPDATAOFFSET_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPECNNSCOUNTER']._serialized_start=182508 - _globals['_PATTERNFLOWTCPECNNSCOUNTER']._serialized_end=182624 - _globals['_PATTERNFLOWTCPECNNSMETRICTAG']._serialized_start=182626 - _globals['_PATTERNFLOWTCPECNNSMETRICTAG']._serialized_end=182748 - _globals['_PATTERNFLOWTCPECNNS']._serialized_start=182751 - _globals['_PATTERNFLOWTCPECNNS']._serialized_end=183136 + _globals['_PATTERNFLOWTCPECNNSCOUNTER']._serialized_start=183522 + _globals['_PATTERNFLOWTCPECNNSCOUNTER']._serialized_end=183638 + _globals['_PATTERNFLOWTCPECNNSMETRICTAG']._serialized_start=183640 + _globals['_PATTERNFLOWTCPECNNSMETRICTAG']._serialized_end=183762 + _globals['_PATTERNFLOWTCPECNNS']._serialized_start=183765 + _globals['_PATTERNFLOWTCPECNNS']._serialized_end=184150 _globals['_PATTERNFLOWTCPECNNS_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWTCPECNNS_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWTCPECNNS_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWTCPECNNS_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPECNCWRCOUNTER']._serialized_start=183138 - _globals['_PATTERNFLOWTCPECNCWRCOUNTER']._serialized_end=183255 - _globals['_PATTERNFLOWTCPECNCWRMETRICTAG']._serialized_start=183257 - _globals['_PATTERNFLOWTCPECNCWRMETRICTAG']._serialized_end=183380 - _globals['_PATTERNFLOWTCPECNCWR']._serialized_start=183383 - _globals['_PATTERNFLOWTCPECNCWR']._serialized_end=183773 + _globals['_PATTERNFLOWTCPECNCWRCOUNTER']._serialized_start=184152 + _globals['_PATTERNFLOWTCPECNCWRCOUNTER']._serialized_end=184269 + _globals['_PATTERNFLOWTCPECNCWRMETRICTAG']._serialized_start=184271 + _globals['_PATTERNFLOWTCPECNCWRMETRICTAG']._serialized_end=184394 + _globals['_PATTERNFLOWTCPECNCWR']._serialized_start=184397 + _globals['_PATTERNFLOWTCPECNCWR']._serialized_end=184787 _globals['_PATTERNFLOWTCPECNCWR_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWTCPECNCWR_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWTCPECNCWR_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWTCPECNCWR_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPECNECHOCOUNTER']._serialized_start=183775 - _globals['_PATTERNFLOWTCPECNECHOCOUNTER']._serialized_end=183893 - _globals['_PATTERNFLOWTCPECNECHOMETRICTAG']._serialized_start=183895 - _globals['_PATTERNFLOWTCPECNECHOMETRICTAG']._serialized_end=184019 - _globals['_PATTERNFLOWTCPECNECHO']._serialized_start=184022 - _globals['_PATTERNFLOWTCPECNECHO']._serialized_end=184417 + _globals['_PATTERNFLOWTCPECNECHOCOUNTER']._serialized_start=184789 + _globals['_PATTERNFLOWTCPECNECHOCOUNTER']._serialized_end=184907 + _globals['_PATTERNFLOWTCPECNECHOMETRICTAG']._serialized_start=184909 + _globals['_PATTERNFLOWTCPECNECHOMETRICTAG']._serialized_end=185033 + _globals['_PATTERNFLOWTCPECNECHO']._serialized_start=185036 + _globals['_PATTERNFLOWTCPECNECHO']._serialized_end=185431 _globals['_PATTERNFLOWTCPECNECHO_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWTCPECNECHO_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWTCPECNECHO_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWTCPECNECHO_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPCTLURGCOUNTER']._serialized_start=184419 - _globals['_PATTERNFLOWTCPCTLURGCOUNTER']._serialized_end=184536 - _globals['_PATTERNFLOWTCPCTLURGMETRICTAG']._serialized_start=184538 - _globals['_PATTERNFLOWTCPCTLURGMETRICTAG']._serialized_end=184661 - _globals['_PATTERNFLOWTCPCTLURG']._serialized_start=184664 - _globals['_PATTERNFLOWTCPCTLURG']._serialized_end=185054 + _globals['_PATTERNFLOWTCPCTLURGCOUNTER']._serialized_start=185433 + _globals['_PATTERNFLOWTCPCTLURGCOUNTER']._serialized_end=185550 + _globals['_PATTERNFLOWTCPCTLURGMETRICTAG']._serialized_start=185552 + _globals['_PATTERNFLOWTCPCTLURGMETRICTAG']._serialized_end=185675 + _globals['_PATTERNFLOWTCPCTLURG']._serialized_start=185678 + _globals['_PATTERNFLOWTCPCTLURG']._serialized_end=186068 _globals['_PATTERNFLOWTCPCTLURG_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWTCPCTLURG_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWTCPCTLURG_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWTCPCTLURG_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPCTLACKCOUNTER']._serialized_start=185056 - _globals['_PATTERNFLOWTCPCTLACKCOUNTER']._serialized_end=185173 - _globals['_PATTERNFLOWTCPCTLACKMETRICTAG']._serialized_start=185175 - _globals['_PATTERNFLOWTCPCTLACKMETRICTAG']._serialized_end=185298 - _globals['_PATTERNFLOWTCPCTLACK']._serialized_start=185301 - _globals['_PATTERNFLOWTCPCTLACK']._serialized_end=185691 + _globals['_PATTERNFLOWTCPCTLACKCOUNTER']._serialized_start=186070 + _globals['_PATTERNFLOWTCPCTLACKCOUNTER']._serialized_end=186187 + _globals['_PATTERNFLOWTCPCTLACKMETRICTAG']._serialized_start=186189 + _globals['_PATTERNFLOWTCPCTLACKMETRICTAG']._serialized_end=186312 + _globals['_PATTERNFLOWTCPCTLACK']._serialized_start=186315 + _globals['_PATTERNFLOWTCPCTLACK']._serialized_end=186705 _globals['_PATTERNFLOWTCPCTLACK_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWTCPCTLACK_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWTCPCTLACK_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWTCPCTLACK_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPCTLPSHCOUNTER']._serialized_start=185693 - _globals['_PATTERNFLOWTCPCTLPSHCOUNTER']._serialized_end=185810 - _globals['_PATTERNFLOWTCPCTLPSHMETRICTAG']._serialized_start=185812 - _globals['_PATTERNFLOWTCPCTLPSHMETRICTAG']._serialized_end=185935 - _globals['_PATTERNFLOWTCPCTLPSH']._serialized_start=185938 - _globals['_PATTERNFLOWTCPCTLPSH']._serialized_end=186328 + _globals['_PATTERNFLOWTCPCTLPSHCOUNTER']._serialized_start=186707 + _globals['_PATTERNFLOWTCPCTLPSHCOUNTER']._serialized_end=186824 + _globals['_PATTERNFLOWTCPCTLPSHMETRICTAG']._serialized_start=186826 + _globals['_PATTERNFLOWTCPCTLPSHMETRICTAG']._serialized_end=186949 + _globals['_PATTERNFLOWTCPCTLPSH']._serialized_start=186952 + _globals['_PATTERNFLOWTCPCTLPSH']._serialized_end=187342 _globals['_PATTERNFLOWTCPCTLPSH_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWTCPCTLPSH_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWTCPCTLPSH_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWTCPCTLPSH_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPCTLRSTCOUNTER']._serialized_start=186330 - _globals['_PATTERNFLOWTCPCTLRSTCOUNTER']._serialized_end=186447 - _globals['_PATTERNFLOWTCPCTLRSTMETRICTAG']._serialized_start=186449 - _globals['_PATTERNFLOWTCPCTLRSTMETRICTAG']._serialized_end=186572 - _globals['_PATTERNFLOWTCPCTLRST']._serialized_start=186575 - _globals['_PATTERNFLOWTCPCTLRST']._serialized_end=186965 + _globals['_PATTERNFLOWTCPCTLRSTCOUNTER']._serialized_start=187344 + _globals['_PATTERNFLOWTCPCTLRSTCOUNTER']._serialized_end=187461 + _globals['_PATTERNFLOWTCPCTLRSTMETRICTAG']._serialized_start=187463 + _globals['_PATTERNFLOWTCPCTLRSTMETRICTAG']._serialized_end=187586 + _globals['_PATTERNFLOWTCPCTLRST']._serialized_start=187589 + _globals['_PATTERNFLOWTCPCTLRST']._serialized_end=187979 _globals['_PATTERNFLOWTCPCTLRST_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWTCPCTLRST_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWTCPCTLRST_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWTCPCTLRST_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPCTLSYNCOUNTER']._serialized_start=186967 - _globals['_PATTERNFLOWTCPCTLSYNCOUNTER']._serialized_end=187084 - _globals['_PATTERNFLOWTCPCTLSYNMETRICTAG']._serialized_start=187086 - _globals['_PATTERNFLOWTCPCTLSYNMETRICTAG']._serialized_end=187209 - _globals['_PATTERNFLOWTCPCTLSYN']._serialized_start=187212 - _globals['_PATTERNFLOWTCPCTLSYN']._serialized_end=187602 + _globals['_PATTERNFLOWTCPCTLSYNCOUNTER']._serialized_start=187981 + _globals['_PATTERNFLOWTCPCTLSYNCOUNTER']._serialized_end=188098 + _globals['_PATTERNFLOWTCPCTLSYNMETRICTAG']._serialized_start=188100 + _globals['_PATTERNFLOWTCPCTLSYNMETRICTAG']._serialized_end=188223 + _globals['_PATTERNFLOWTCPCTLSYN']._serialized_start=188226 + _globals['_PATTERNFLOWTCPCTLSYN']._serialized_end=188616 _globals['_PATTERNFLOWTCPCTLSYN_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWTCPCTLSYN_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWTCPCTLSYN_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWTCPCTLSYN_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPCTLFINCOUNTER']._serialized_start=187604 - _globals['_PATTERNFLOWTCPCTLFINCOUNTER']._serialized_end=187721 - _globals['_PATTERNFLOWTCPCTLFINMETRICTAG']._serialized_start=187723 - _globals['_PATTERNFLOWTCPCTLFINMETRICTAG']._serialized_end=187846 - _globals['_PATTERNFLOWTCPCTLFIN']._serialized_start=187849 - _globals['_PATTERNFLOWTCPCTLFIN']._serialized_end=188239 + _globals['_PATTERNFLOWTCPCTLFINCOUNTER']._serialized_start=188618 + _globals['_PATTERNFLOWTCPCTLFINCOUNTER']._serialized_end=188735 + _globals['_PATTERNFLOWTCPCTLFINMETRICTAG']._serialized_start=188737 + _globals['_PATTERNFLOWTCPCTLFINMETRICTAG']._serialized_end=188860 + _globals['_PATTERNFLOWTCPCTLFIN']._serialized_start=188863 + _globals['_PATTERNFLOWTCPCTLFIN']._serialized_end=189253 _globals['_PATTERNFLOWTCPCTLFIN_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWTCPCTLFIN_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWTCPCTLFIN_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWTCPCTLFIN_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPWINDOWCOUNTER']._serialized_start=188241 - _globals['_PATTERNFLOWTCPWINDOWCOUNTER']._serialized_end=188358 - _globals['_PATTERNFLOWTCPWINDOWMETRICTAG']._serialized_start=188360 - _globals['_PATTERNFLOWTCPWINDOWMETRICTAG']._serialized_end=188483 - _globals['_PATTERNFLOWTCPWINDOW']._serialized_start=188486 - _globals['_PATTERNFLOWTCPWINDOW']._serialized_end=188876 + _globals['_PATTERNFLOWTCPWINDOWCOUNTER']._serialized_start=189255 + _globals['_PATTERNFLOWTCPWINDOWCOUNTER']._serialized_end=189372 + _globals['_PATTERNFLOWTCPWINDOWMETRICTAG']._serialized_start=189374 + _globals['_PATTERNFLOWTCPWINDOWMETRICTAG']._serialized_end=189497 + _globals['_PATTERNFLOWTCPWINDOW']._serialized_start=189500 + _globals['_PATTERNFLOWTCPWINDOW']._serialized_end=189890 _globals['_PATTERNFLOWTCPWINDOW_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWTCPWINDOW_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWTCPWINDOW_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWTCPWINDOW_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWTCPCHECKSUM']._serialized_start=188879 - _globals['_PATTERNFLOWTCPCHECKSUM']._serialized_end=189209 + _globals['_PATTERNFLOWTCPCHECKSUM']._serialized_start=189893 + _globals['_PATTERNFLOWTCPCHECKSUM']._serialized_end=190223 _globals['_PATTERNFLOWTCPCHECKSUM_CHOICE']._serialized_start=151967 _globals['_PATTERNFLOWTCPCHECKSUM_CHOICE']._serialized_end=152027 _globals['_PATTERNFLOWTCPCHECKSUM_CHOICE_ENUM']._serialized_start=151977 @@ -2653,38 +2663,42 @@ _globals['_PATTERNFLOWTCPCHECKSUM_GENERATED']._serialized_end=152084 _globals['_PATTERNFLOWTCPCHECKSUM_GENERATED_ENUM']._serialized_start=152042 _globals['_PATTERNFLOWTCPCHECKSUM_GENERATED_ENUM']._serialized_end=152084 - _globals['_PATTERNFLOWUDPSRCPORTCOUNTER']._serialized_start=189211 - _globals['_PATTERNFLOWUDPSRCPORTCOUNTER']._serialized_end=189329 - _globals['_PATTERNFLOWUDPSRCPORTMETRICTAG']._serialized_start=189331 - _globals['_PATTERNFLOWUDPSRCPORTMETRICTAG']._serialized_end=189455 - _globals['_PATTERNFLOWUDPSRCPORT']._serialized_start=189458 - _globals['_PATTERNFLOWUDPSRCPORT']._serialized_end=189853 - _globals['_PATTERNFLOWUDPSRCPORT_CHOICE']._serialized_start=138151 - _globals['_PATTERNFLOWUDPSRCPORT_CHOICE']._serialized_end=138237 - _globals['_PATTERNFLOWUDPSRCPORT_CHOICE_ENUM']._serialized_start=138161 - _globals['_PATTERNFLOWUDPSRCPORT_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWUDPDSTPORTCOUNTER']._serialized_start=189855 - _globals['_PATTERNFLOWUDPDSTPORTCOUNTER']._serialized_end=189973 - _globals['_PATTERNFLOWUDPDSTPORTMETRICTAG']._serialized_start=189975 - _globals['_PATTERNFLOWUDPDSTPORTMETRICTAG']._serialized_end=190099 - _globals['_PATTERNFLOWUDPDSTPORT']._serialized_start=190102 - _globals['_PATTERNFLOWUDPDSTPORT']._serialized_end=190497 - _globals['_PATTERNFLOWUDPDSTPORT_CHOICE']._serialized_start=138151 - _globals['_PATTERNFLOWUDPDSTPORT_CHOICE']._serialized_end=138237 - _globals['_PATTERNFLOWUDPDSTPORT_CHOICE_ENUM']._serialized_start=138161 - _globals['_PATTERNFLOWUDPDSTPORT_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWUDPLENGTHCOUNTER']._serialized_start=190499 - _globals['_PATTERNFLOWUDPLENGTHCOUNTER']._serialized_end=190616 - _globals['_PATTERNFLOWUDPLENGTHMETRICTAG']._serialized_start=190618 - _globals['_PATTERNFLOWUDPLENGTHMETRICTAG']._serialized_end=190741 - _globals['_PATTERNFLOWUDPLENGTH']._serialized_start=190744 - _globals['_PATTERNFLOWUDPLENGTH']._serialized_end=191134 + _globals['_PATTERNFLOWUDPSRCPORTCOUNTER']._serialized_start=190225 + _globals['_PATTERNFLOWUDPSRCPORTCOUNTER']._serialized_end=190343 + _globals['_PATTERNFLOWUDPSRCPORTMETRICTAG']._serialized_start=190345 + _globals['_PATTERNFLOWUDPSRCPORTMETRICTAG']._serialized_end=190469 + _globals['_PATTERNFLOWUDPSRCPORTRANDOM']._serialized_start=190472 + _globals['_PATTERNFLOWUDPSRCPORTRANDOM']._serialized_end=190611 + _globals['_PATTERNFLOWUDPSRCPORT']._serialized_start=190614 + _globals['_PATTERNFLOWUDPSRCPORT']._serialized_end=191071 + _globals['_PATTERNFLOWUDPSRCPORT_CHOICE']._serialized_start=163729 + _globals['_PATTERNFLOWUDPSRCPORT_CHOICE']._serialized_end=163827 + _globals['_PATTERNFLOWUDPSRCPORT_CHOICE_ENUM']._serialized_start=163739 + _globals['_PATTERNFLOWUDPSRCPORT_CHOICE_ENUM']._serialized_end=163827 + _globals['_PATTERNFLOWUDPDSTPORTCOUNTER']._serialized_start=191073 + _globals['_PATTERNFLOWUDPDSTPORTCOUNTER']._serialized_end=191191 + _globals['_PATTERNFLOWUDPDSTPORTMETRICTAG']._serialized_start=191193 + _globals['_PATTERNFLOWUDPDSTPORTMETRICTAG']._serialized_end=191317 + _globals['_PATTERNFLOWUDPDSTPORTRANDOM']._serialized_start=191320 + _globals['_PATTERNFLOWUDPDSTPORTRANDOM']._serialized_end=191459 + _globals['_PATTERNFLOWUDPDSTPORT']._serialized_start=191462 + _globals['_PATTERNFLOWUDPDSTPORT']._serialized_end=191919 + _globals['_PATTERNFLOWUDPDSTPORT_CHOICE']._serialized_start=163729 + _globals['_PATTERNFLOWUDPDSTPORT_CHOICE']._serialized_end=163827 + _globals['_PATTERNFLOWUDPDSTPORT_CHOICE_ENUM']._serialized_start=163739 + _globals['_PATTERNFLOWUDPDSTPORT_CHOICE_ENUM']._serialized_end=163827 + _globals['_PATTERNFLOWUDPLENGTHCOUNTER']._serialized_start=191921 + _globals['_PATTERNFLOWUDPLENGTHCOUNTER']._serialized_end=192038 + _globals['_PATTERNFLOWUDPLENGTHMETRICTAG']._serialized_start=192040 + _globals['_PATTERNFLOWUDPLENGTHMETRICTAG']._serialized_end=192163 + _globals['_PATTERNFLOWUDPLENGTH']._serialized_start=192166 + _globals['_PATTERNFLOWUDPLENGTH']._serialized_end=192556 _globals['_PATTERNFLOWUDPLENGTH_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWUDPLENGTH_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWUDPLENGTH_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWUDPLENGTH_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWUDPCHECKSUM']._serialized_start=191137 - _globals['_PATTERNFLOWUDPCHECKSUM']._serialized_end=191467 + _globals['_PATTERNFLOWUDPCHECKSUM']._serialized_start=192559 + _globals['_PATTERNFLOWUDPCHECKSUM']._serialized_end=192889 _globals['_PATTERNFLOWUDPCHECKSUM_CHOICE']._serialized_start=151967 _globals['_PATTERNFLOWUDPCHECKSUM_CHOICE']._serialized_end=152027 _globals['_PATTERNFLOWUDPCHECKSUM_CHOICE_ENUM']._serialized_start=151977 @@ -2693,48 +2707,48 @@ _globals['_PATTERNFLOWUDPCHECKSUM_GENERATED']._serialized_end=152084 _globals['_PATTERNFLOWUDPCHECKSUM_GENERATED_ENUM']._serialized_start=152042 _globals['_PATTERNFLOWUDPCHECKSUM_GENERATED_ENUM']._serialized_end=152084 - _globals['_PATTERNFLOWGRECHECKSUMPRESENTCOUNTER']._serialized_start=191469 - _globals['_PATTERNFLOWGRECHECKSUMPRESENTCOUNTER']._serialized_end=191595 - _globals['_PATTERNFLOWGRECHECKSUMPRESENTMETRICTAG']._serialized_start=191598 - _globals['_PATTERNFLOWGRECHECKSUMPRESENTMETRICTAG']._serialized_end=191730 - _globals['_PATTERNFLOWGRECHECKSUMPRESENT']._serialized_start=191733 - _globals['_PATTERNFLOWGRECHECKSUMPRESENT']._serialized_end=192168 + _globals['_PATTERNFLOWGRECHECKSUMPRESENTCOUNTER']._serialized_start=192891 + _globals['_PATTERNFLOWGRECHECKSUMPRESENTCOUNTER']._serialized_end=193017 + _globals['_PATTERNFLOWGRECHECKSUMPRESENTMETRICTAG']._serialized_start=193020 + _globals['_PATTERNFLOWGRECHECKSUMPRESENTMETRICTAG']._serialized_end=193152 + _globals['_PATTERNFLOWGRECHECKSUMPRESENT']._serialized_start=193155 + _globals['_PATTERNFLOWGRECHECKSUMPRESENT']._serialized_end=193590 _globals['_PATTERNFLOWGRECHECKSUMPRESENT_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGRECHECKSUMPRESENT_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGRECHECKSUMPRESENT_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGRECHECKSUMPRESENT_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGRERESERVED0COUNTER']._serialized_start=192170 - _globals['_PATTERNFLOWGRERESERVED0COUNTER']._serialized_end=192290 - _globals['_PATTERNFLOWGRERESERVED0METRICTAG']._serialized_start=192292 - _globals['_PATTERNFLOWGRERESERVED0METRICTAG']._serialized_end=192418 - _globals['_PATTERNFLOWGRERESERVED0']._serialized_start=192421 - _globals['_PATTERNFLOWGRERESERVED0']._serialized_end=192826 + _globals['_PATTERNFLOWGRERESERVED0COUNTER']._serialized_start=193592 + _globals['_PATTERNFLOWGRERESERVED0COUNTER']._serialized_end=193712 + _globals['_PATTERNFLOWGRERESERVED0METRICTAG']._serialized_start=193714 + _globals['_PATTERNFLOWGRERESERVED0METRICTAG']._serialized_end=193840 + _globals['_PATTERNFLOWGRERESERVED0']._serialized_start=193843 + _globals['_PATTERNFLOWGRERESERVED0']._serialized_end=194248 _globals['_PATTERNFLOWGRERESERVED0_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGRERESERVED0_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGRERESERVED0_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGRERESERVED0_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGREVERSIONCOUNTER']._serialized_start=192828 - _globals['_PATTERNFLOWGREVERSIONCOUNTER']._serialized_end=192946 - _globals['_PATTERNFLOWGREVERSIONMETRICTAG']._serialized_start=192948 - _globals['_PATTERNFLOWGREVERSIONMETRICTAG']._serialized_end=193072 - _globals['_PATTERNFLOWGREVERSION']._serialized_start=193075 - _globals['_PATTERNFLOWGREVERSION']._serialized_end=193470 + _globals['_PATTERNFLOWGREVERSIONCOUNTER']._serialized_start=194250 + _globals['_PATTERNFLOWGREVERSIONCOUNTER']._serialized_end=194368 + _globals['_PATTERNFLOWGREVERSIONMETRICTAG']._serialized_start=194370 + _globals['_PATTERNFLOWGREVERSIONMETRICTAG']._serialized_end=194494 + _globals['_PATTERNFLOWGREVERSION']._serialized_start=194497 + _globals['_PATTERNFLOWGREVERSION']._serialized_end=194892 _globals['_PATTERNFLOWGREVERSION_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGREVERSION_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGREVERSION_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGREVERSION_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGREPROTOCOLCOUNTER']._serialized_start=193472 - _globals['_PATTERNFLOWGREPROTOCOLCOUNTER']._serialized_end=193591 - _globals['_PATTERNFLOWGREPROTOCOLMETRICTAG']._serialized_start=193593 - _globals['_PATTERNFLOWGREPROTOCOLMETRICTAG']._serialized_end=193718 - _globals['_PATTERNFLOWGREPROTOCOL']._serialized_start=193721 - _globals['_PATTERNFLOWGREPROTOCOL']._serialized_end=194121 + _globals['_PATTERNFLOWGREPROTOCOLCOUNTER']._serialized_start=194894 + _globals['_PATTERNFLOWGREPROTOCOLCOUNTER']._serialized_end=195013 + _globals['_PATTERNFLOWGREPROTOCOLMETRICTAG']._serialized_start=195015 + _globals['_PATTERNFLOWGREPROTOCOLMETRICTAG']._serialized_end=195140 + _globals['_PATTERNFLOWGREPROTOCOL']._serialized_start=195143 + _globals['_PATTERNFLOWGREPROTOCOL']._serialized_end=195543 _globals['_PATTERNFLOWGREPROTOCOL_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGREPROTOCOL_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGREPROTOCOL_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGREPROTOCOL_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGRECHECKSUM']._serialized_start=194124 - _globals['_PATTERNFLOWGRECHECKSUM']._serialized_end=194454 + _globals['_PATTERNFLOWGRECHECKSUM']._serialized_start=195546 + _globals['_PATTERNFLOWGRECHECKSUM']._serialized_end=195876 _globals['_PATTERNFLOWGRECHECKSUM_CHOICE']._serialized_start=151967 _globals['_PATTERNFLOWGRECHECKSUM_CHOICE']._serialized_end=152027 _globals['_PATTERNFLOWGRECHECKSUM_CHOICE_ENUM']._serialized_start=151977 @@ -2743,368 +2757,368 @@ _globals['_PATTERNFLOWGRECHECKSUM_GENERATED']._serialized_end=152084 _globals['_PATTERNFLOWGRECHECKSUM_GENERATED_ENUM']._serialized_start=152042 _globals['_PATTERNFLOWGRECHECKSUM_GENERATED_ENUM']._serialized_end=152084 - _globals['_PATTERNFLOWGRERESERVED1COUNTER']._serialized_start=194456 - _globals['_PATTERNFLOWGRERESERVED1COUNTER']._serialized_end=194576 - _globals['_PATTERNFLOWGRERESERVED1METRICTAG']._serialized_start=194578 - _globals['_PATTERNFLOWGRERESERVED1METRICTAG']._serialized_end=194704 - _globals['_PATTERNFLOWGRERESERVED1']._serialized_start=194707 - _globals['_PATTERNFLOWGRERESERVED1']._serialized_end=195112 + _globals['_PATTERNFLOWGRERESERVED1COUNTER']._serialized_start=195878 + _globals['_PATTERNFLOWGRERESERVED1COUNTER']._serialized_end=195998 + _globals['_PATTERNFLOWGRERESERVED1METRICTAG']._serialized_start=196000 + _globals['_PATTERNFLOWGRERESERVED1METRICTAG']._serialized_end=196126 + _globals['_PATTERNFLOWGRERESERVED1']._serialized_start=196129 + _globals['_PATTERNFLOWGRERESERVED1']._serialized_end=196534 _globals['_PATTERNFLOWGRERESERVED1_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGRERESERVED1_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGRERESERVED1_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGRERESERVED1_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV1VERSIONCOUNTER']._serialized_start=195114 - _globals['_PATTERNFLOWGTPV1VERSIONCOUNTER']._serialized_end=195234 - _globals['_PATTERNFLOWGTPV1VERSIONMETRICTAG']._serialized_start=195236 - _globals['_PATTERNFLOWGTPV1VERSIONMETRICTAG']._serialized_end=195362 - _globals['_PATTERNFLOWGTPV1VERSION']._serialized_start=195365 - _globals['_PATTERNFLOWGTPV1VERSION']._serialized_end=195770 + _globals['_PATTERNFLOWGTPV1VERSIONCOUNTER']._serialized_start=196536 + _globals['_PATTERNFLOWGTPV1VERSIONCOUNTER']._serialized_end=196656 + _globals['_PATTERNFLOWGTPV1VERSIONMETRICTAG']._serialized_start=196658 + _globals['_PATTERNFLOWGTPV1VERSIONMETRICTAG']._serialized_end=196784 + _globals['_PATTERNFLOWGTPV1VERSION']._serialized_start=196787 + _globals['_PATTERNFLOWGTPV1VERSION']._serialized_end=197192 _globals['_PATTERNFLOWGTPV1VERSION_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV1VERSION_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV1VERSION_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV1VERSION_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV1PROTOCOLTYPECOUNTER']._serialized_start=195772 - _globals['_PATTERNFLOWGTPV1PROTOCOLTYPECOUNTER']._serialized_end=195897 - _globals['_PATTERNFLOWGTPV1PROTOCOLTYPEMETRICTAG']._serialized_start=195900 - _globals['_PATTERNFLOWGTPV1PROTOCOLTYPEMETRICTAG']._serialized_end=196031 - _globals['_PATTERNFLOWGTPV1PROTOCOLTYPE']._serialized_start=196034 - _globals['_PATTERNFLOWGTPV1PROTOCOLTYPE']._serialized_end=196464 + _globals['_PATTERNFLOWGTPV1PROTOCOLTYPECOUNTER']._serialized_start=197194 + _globals['_PATTERNFLOWGTPV1PROTOCOLTYPECOUNTER']._serialized_end=197319 + _globals['_PATTERNFLOWGTPV1PROTOCOLTYPEMETRICTAG']._serialized_start=197322 + _globals['_PATTERNFLOWGTPV1PROTOCOLTYPEMETRICTAG']._serialized_end=197453 + _globals['_PATTERNFLOWGTPV1PROTOCOLTYPE']._serialized_start=197456 + _globals['_PATTERNFLOWGTPV1PROTOCOLTYPE']._serialized_end=197886 _globals['_PATTERNFLOWGTPV1PROTOCOLTYPE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV1PROTOCOLTYPE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV1PROTOCOLTYPE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV1PROTOCOLTYPE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV1RESERVEDCOUNTER']._serialized_start=196466 - _globals['_PATTERNFLOWGTPV1RESERVEDCOUNTER']._serialized_end=196587 - _globals['_PATTERNFLOWGTPV1RESERVEDMETRICTAG']._serialized_start=196589 - _globals['_PATTERNFLOWGTPV1RESERVEDMETRICTAG']._serialized_end=196716 - _globals['_PATTERNFLOWGTPV1RESERVED']._serialized_start=196719 - _globals['_PATTERNFLOWGTPV1RESERVED']._serialized_end=197129 + _globals['_PATTERNFLOWGTPV1RESERVEDCOUNTER']._serialized_start=197888 + _globals['_PATTERNFLOWGTPV1RESERVEDCOUNTER']._serialized_end=198009 + _globals['_PATTERNFLOWGTPV1RESERVEDMETRICTAG']._serialized_start=198011 + _globals['_PATTERNFLOWGTPV1RESERVEDMETRICTAG']._serialized_end=198138 + _globals['_PATTERNFLOWGTPV1RESERVED']._serialized_start=198141 + _globals['_PATTERNFLOWGTPV1RESERVED']._serialized_end=198551 _globals['_PATTERNFLOWGTPV1RESERVED_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV1RESERVED_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV1RESERVED_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV1RESERVED_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV1EFLAGCOUNTER']._serialized_start=197131 - _globals['_PATTERNFLOWGTPV1EFLAGCOUNTER']._serialized_end=197249 - _globals['_PATTERNFLOWGTPV1EFLAGMETRICTAG']._serialized_start=197251 - _globals['_PATTERNFLOWGTPV1EFLAGMETRICTAG']._serialized_end=197375 - _globals['_PATTERNFLOWGTPV1EFLAG']._serialized_start=197378 - _globals['_PATTERNFLOWGTPV1EFLAG']._serialized_end=197773 + _globals['_PATTERNFLOWGTPV1EFLAGCOUNTER']._serialized_start=198553 + _globals['_PATTERNFLOWGTPV1EFLAGCOUNTER']._serialized_end=198671 + _globals['_PATTERNFLOWGTPV1EFLAGMETRICTAG']._serialized_start=198673 + _globals['_PATTERNFLOWGTPV1EFLAGMETRICTAG']._serialized_end=198797 + _globals['_PATTERNFLOWGTPV1EFLAG']._serialized_start=198800 + _globals['_PATTERNFLOWGTPV1EFLAG']._serialized_end=199195 _globals['_PATTERNFLOWGTPV1EFLAG_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV1EFLAG_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV1EFLAG_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV1EFLAG_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV1SFLAGCOUNTER']._serialized_start=197775 - _globals['_PATTERNFLOWGTPV1SFLAGCOUNTER']._serialized_end=197893 - _globals['_PATTERNFLOWGTPV1SFLAGMETRICTAG']._serialized_start=197895 - _globals['_PATTERNFLOWGTPV1SFLAGMETRICTAG']._serialized_end=198019 - _globals['_PATTERNFLOWGTPV1SFLAG']._serialized_start=198022 - _globals['_PATTERNFLOWGTPV1SFLAG']._serialized_end=198417 + _globals['_PATTERNFLOWGTPV1SFLAGCOUNTER']._serialized_start=199197 + _globals['_PATTERNFLOWGTPV1SFLAGCOUNTER']._serialized_end=199315 + _globals['_PATTERNFLOWGTPV1SFLAGMETRICTAG']._serialized_start=199317 + _globals['_PATTERNFLOWGTPV1SFLAGMETRICTAG']._serialized_end=199441 + _globals['_PATTERNFLOWGTPV1SFLAG']._serialized_start=199444 + _globals['_PATTERNFLOWGTPV1SFLAG']._serialized_end=199839 _globals['_PATTERNFLOWGTPV1SFLAG_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV1SFLAG_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV1SFLAG_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV1SFLAG_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV1PNFLAGCOUNTER']._serialized_start=198419 - _globals['_PATTERNFLOWGTPV1PNFLAGCOUNTER']._serialized_end=198538 - _globals['_PATTERNFLOWGTPV1PNFLAGMETRICTAG']._serialized_start=198540 - _globals['_PATTERNFLOWGTPV1PNFLAGMETRICTAG']._serialized_end=198665 - _globals['_PATTERNFLOWGTPV1PNFLAG']._serialized_start=198668 - _globals['_PATTERNFLOWGTPV1PNFLAG']._serialized_end=199068 + _globals['_PATTERNFLOWGTPV1PNFLAGCOUNTER']._serialized_start=199841 + _globals['_PATTERNFLOWGTPV1PNFLAGCOUNTER']._serialized_end=199960 + _globals['_PATTERNFLOWGTPV1PNFLAGMETRICTAG']._serialized_start=199962 + _globals['_PATTERNFLOWGTPV1PNFLAGMETRICTAG']._serialized_end=200087 + _globals['_PATTERNFLOWGTPV1PNFLAG']._serialized_start=200090 + _globals['_PATTERNFLOWGTPV1PNFLAG']._serialized_end=200490 _globals['_PATTERNFLOWGTPV1PNFLAG_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV1PNFLAG_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV1PNFLAG_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV1PNFLAG_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV1MESSAGETYPECOUNTER']._serialized_start=199070 - _globals['_PATTERNFLOWGTPV1MESSAGETYPECOUNTER']._serialized_end=199194 - _globals['_PATTERNFLOWGTPV1MESSAGETYPEMETRICTAG']._serialized_start=199197 - _globals['_PATTERNFLOWGTPV1MESSAGETYPEMETRICTAG']._serialized_end=199327 - _globals['_PATTERNFLOWGTPV1MESSAGETYPE']._serialized_start=199330 - _globals['_PATTERNFLOWGTPV1MESSAGETYPE']._serialized_end=199755 + _globals['_PATTERNFLOWGTPV1MESSAGETYPECOUNTER']._serialized_start=200492 + _globals['_PATTERNFLOWGTPV1MESSAGETYPECOUNTER']._serialized_end=200616 + _globals['_PATTERNFLOWGTPV1MESSAGETYPEMETRICTAG']._serialized_start=200619 + _globals['_PATTERNFLOWGTPV1MESSAGETYPEMETRICTAG']._serialized_end=200749 + _globals['_PATTERNFLOWGTPV1MESSAGETYPE']._serialized_start=200752 + _globals['_PATTERNFLOWGTPV1MESSAGETYPE']._serialized_end=201177 _globals['_PATTERNFLOWGTPV1MESSAGETYPE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV1MESSAGETYPE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV1MESSAGETYPE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV1MESSAGETYPE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV1MESSAGELENGTHCOUNTER']._serialized_start=199757 - _globals['_PATTERNFLOWGTPV1MESSAGELENGTHCOUNTER']._serialized_end=199883 - _globals['_PATTERNFLOWGTPV1MESSAGELENGTHMETRICTAG']._serialized_start=199886 - _globals['_PATTERNFLOWGTPV1MESSAGELENGTHMETRICTAG']._serialized_end=200018 - _globals['_PATTERNFLOWGTPV1MESSAGELENGTH']._serialized_start=200021 - _globals['_PATTERNFLOWGTPV1MESSAGELENGTH']._serialized_end=200456 + _globals['_PATTERNFLOWGTPV1MESSAGELENGTHCOUNTER']._serialized_start=201179 + _globals['_PATTERNFLOWGTPV1MESSAGELENGTHCOUNTER']._serialized_end=201305 + _globals['_PATTERNFLOWGTPV1MESSAGELENGTHMETRICTAG']._serialized_start=201308 + _globals['_PATTERNFLOWGTPV1MESSAGELENGTHMETRICTAG']._serialized_end=201440 + _globals['_PATTERNFLOWGTPV1MESSAGELENGTH']._serialized_start=201443 + _globals['_PATTERNFLOWGTPV1MESSAGELENGTH']._serialized_end=201878 _globals['_PATTERNFLOWGTPV1MESSAGELENGTH_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV1MESSAGELENGTH_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV1MESSAGELENGTH_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV1MESSAGELENGTH_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV1TEIDCOUNTER']._serialized_start=200458 - _globals['_PATTERNFLOWGTPV1TEIDCOUNTER']._serialized_end=200575 - _globals['_PATTERNFLOWGTPV1TEIDMETRICTAG']._serialized_start=200577 - _globals['_PATTERNFLOWGTPV1TEIDMETRICTAG']._serialized_end=200700 - _globals['_PATTERNFLOWGTPV1TEID']._serialized_start=200703 - _globals['_PATTERNFLOWGTPV1TEID']._serialized_end=201093 + _globals['_PATTERNFLOWGTPV1TEIDCOUNTER']._serialized_start=201880 + _globals['_PATTERNFLOWGTPV1TEIDCOUNTER']._serialized_end=201997 + _globals['_PATTERNFLOWGTPV1TEIDMETRICTAG']._serialized_start=201999 + _globals['_PATTERNFLOWGTPV1TEIDMETRICTAG']._serialized_end=202122 + _globals['_PATTERNFLOWGTPV1TEID']._serialized_start=202125 + _globals['_PATTERNFLOWGTPV1TEID']._serialized_end=202515 _globals['_PATTERNFLOWGTPV1TEID_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV1TEID_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV1TEID_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV1TEID_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV1SQUENCENUMBERCOUNTER']._serialized_start=201095 - _globals['_PATTERNFLOWGTPV1SQUENCENUMBERCOUNTER']._serialized_end=201221 - _globals['_PATTERNFLOWGTPV1SQUENCENUMBERMETRICTAG']._serialized_start=201224 - _globals['_PATTERNFLOWGTPV1SQUENCENUMBERMETRICTAG']._serialized_end=201356 - _globals['_PATTERNFLOWGTPV1SQUENCENUMBER']._serialized_start=201359 - _globals['_PATTERNFLOWGTPV1SQUENCENUMBER']._serialized_end=201794 + _globals['_PATTERNFLOWGTPV1SQUENCENUMBERCOUNTER']._serialized_start=202517 + _globals['_PATTERNFLOWGTPV1SQUENCENUMBERCOUNTER']._serialized_end=202643 + _globals['_PATTERNFLOWGTPV1SQUENCENUMBERMETRICTAG']._serialized_start=202646 + _globals['_PATTERNFLOWGTPV1SQUENCENUMBERMETRICTAG']._serialized_end=202778 + _globals['_PATTERNFLOWGTPV1SQUENCENUMBER']._serialized_start=202781 + _globals['_PATTERNFLOWGTPV1SQUENCENUMBER']._serialized_end=203216 _globals['_PATTERNFLOWGTPV1SQUENCENUMBER_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV1SQUENCENUMBER_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV1SQUENCENUMBER_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV1SQUENCENUMBER_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV1NPDUNUMBERCOUNTER']._serialized_start=201796 - _globals['_PATTERNFLOWGTPV1NPDUNUMBERCOUNTER']._serialized_end=201919 - _globals['_PATTERNFLOWGTPV1NPDUNUMBERMETRICTAG']._serialized_start=201922 - _globals['_PATTERNFLOWGTPV1NPDUNUMBERMETRICTAG']._serialized_end=202051 - _globals['_PATTERNFLOWGTPV1NPDUNUMBER']._serialized_start=202054 - _globals['_PATTERNFLOWGTPV1NPDUNUMBER']._serialized_end=202474 + _globals['_PATTERNFLOWGTPV1NPDUNUMBERCOUNTER']._serialized_start=203218 + _globals['_PATTERNFLOWGTPV1NPDUNUMBERCOUNTER']._serialized_end=203341 + _globals['_PATTERNFLOWGTPV1NPDUNUMBERMETRICTAG']._serialized_start=203344 + _globals['_PATTERNFLOWGTPV1NPDUNUMBERMETRICTAG']._serialized_end=203473 + _globals['_PATTERNFLOWGTPV1NPDUNUMBER']._serialized_start=203476 + _globals['_PATTERNFLOWGTPV1NPDUNUMBER']._serialized_end=203896 _globals['_PATTERNFLOWGTPV1NPDUNUMBER_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV1NPDUNUMBER_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV1NPDUNUMBER_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV1NPDUNUMBER_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPECOUNTER']._serialized_start=202477 - _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPECOUNTER']._serialized_end=202613 - _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPEMETRICTAG']._serialized_start=202616 - _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPEMETRICTAG']._serialized_end=202758 - _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPE']._serialized_start=202761 - _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPE']._serialized_end=203246 + _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPECOUNTER']._serialized_start=203899 + _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPECOUNTER']._serialized_end=204035 + _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPEMETRICTAG']._serialized_start=204038 + _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPEMETRICTAG']._serialized_end=204180 + _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPE']._serialized_start=204183 + _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPE']._serialized_end=204668 _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV1NEXTEXTENSIONHEADERTYPE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTHCOUNTER']._serialized_start=203249 - _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTHCOUNTER']._serialized_end=203384 - _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTHMETRICTAG']._serialized_start=203387 - _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTHMETRICTAG']._serialized_end=203528 - _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTH']._serialized_start=203531 - _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTH']._serialized_end=204011 + _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTHCOUNTER']._serialized_start=204671 + _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTHCOUNTER']._serialized_end=204806 + _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTHMETRICTAG']._serialized_start=204809 + _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTHMETRICTAG']._serialized_end=204950 + _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTH']._serialized_start=204953 + _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTH']._serialized_end=205433 _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTH_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTH_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTH_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPEXTENSIONEXTENSIONLENGTH_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPEXTENSIONCONTENTSCOUNTER']._serialized_start=204014 - _globals['_PATTERNFLOWGTPEXTENSIONCONTENTSCOUNTER']._serialized_end=204142 - _globals['_PATTERNFLOWGTPEXTENSIONCONTENTSMETRICTAG']._serialized_start=204145 - _globals['_PATTERNFLOWGTPEXTENSIONCONTENTSMETRICTAG']._serialized_end=204279 - _globals['_PATTERNFLOWGTPEXTENSIONCONTENTS']._serialized_start=204282 - _globals['_PATTERNFLOWGTPEXTENSIONCONTENTS']._serialized_end=204727 + _globals['_PATTERNFLOWGTPEXTENSIONCONTENTSCOUNTER']._serialized_start=205436 + _globals['_PATTERNFLOWGTPEXTENSIONCONTENTSCOUNTER']._serialized_end=205564 + _globals['_PATTERNFLOWGTPEXTENSIONCONTENTSMETRICTAG']._serialized_start=205567 + _globals['_PATTERNFLOWGTPEXTENSIONCONTENTSMETRICTAG']._serialized_end=205701 + _globals['_PATTERNFLOWGTPEXTENSIONCONTENTS']._serialized_start=205704 + _globals['_PATTERNFLOWGTPEXTENSIONCONTENTS']._serialized_end=206149 _globals['_PATTERNFLOWGTPEXTENSIONCONTENTS_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPEXTENSIONCONTENTS_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPEXTENSIONCONTENTS_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPEXTENSIONCONTENTS_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADERCOUNTER']._serialized_start=204730 - _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADERCOUNTER']._serialized_end=204869 - _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADERMETRICTAG']._serialized_start=204872 - _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADERMETRICTAG']._serialized_end=205017 - _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADER']._serialized_start=205020 - _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADER']._serialized_end=205520 + _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADERCOUNTER']._serialized_start=206152 + _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADERCOUNTER']._serialized_end=206291 + _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADERMETRICTAG']._serialized_start=206294 + _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADERMETRICTAG']._serialized_end=206439 + _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADER']._serialized_start=206442 + _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADER']._serialized_end=206942 _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADER_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADER_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADER_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPEXTENSIONNEXTEXTENSIONHEADER_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV2VERSIONCOUNTER']._serialized_start=205522 - _globals['_PATTERNFLOWGTPV2VERSIONCOUNTER']._serialized_end=205642 - _globals['_PATTERNFLOWGTPV2VERSIONMETRICTAG']._serialized_start=205644 - _globals['_PATTERNFLOWGTPV2VERSIONMETRICTAG']._serialized_end=205770 - _globals['_PATTERNFLOWGTPV2VERSION']._serialized_start=205773 - _globals['_PATTERNFLOWGTPV2VERSION']._serialized_end=206178 + _globals['_PATTERNFLOWGTPV2VERSIONCOUNTER']._serialized_start=206944 + _globals['_PATTERNFLOWGTPV2VERSIONCOUNTER']._serialized_end=207064 + _globals['_PATTERNFLOWGTPV2VERSIONMETRICTAG']._serialized_start=207066 + _globals['_PATTERNFLOWGTPV2VERSIONMETRICTAG']._serialized_end=207192 + _globals['_PATTERNFLOWGTPV2VERSION']._serialized_start=207195 + _globals['_PATTERNFLOWGTPV2VERSION']._serialized_end=207600 _globals['_PATTERNFLOWGTPV2VERSION_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV2VERSION_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV2VERSION_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV2VERSION_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAGCOUNTER']._serialized_start=206181 - _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAGCOUNTER']._serialized_end=206310 - _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAGMETRICTAG']._serialized_start=206313 - _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAGMETRICTAG']._serialized_end=206448 - _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAG']._serialized_start=206451 - _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAG']._serialized_end=206901 + _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAGCOUNTER']._serialized_start=207603 + _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAGCOUNTER']._serialized_end=207732 + _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAGMETRICTAG']._serialized_start=207735 + _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAGMETRICTAG']._serialized_end=207870 + _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAG']._serialized_start=207873 + _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAG']._serialized_end=208323 _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAG_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAG_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAG_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV2PIGGYBACKINGFLAG_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV2TEIDFLAGCOUNTER']._serialized_start=206903 - _globals['_PATTERNFLOWGTPV2TEIDFLAGCOUNTER']._serialized_end=207024 - _globals['_PATTERNFLOWGTPV2TEIDFLAGMETRICTAG']._serialized_start=207026 - _globals['_PATTERNFLOWGTPV2TEIDFLAGMETRICTAG']._serialized_end=207153 - _globals['_PATTERNFLOWGTPV2TEIDFLAG']._serialized_start=207156 - _globals['_PATTERNFLOWGTPV2TEIDFLAG']._serialized_end=207566 + _globals['_PATTERNFLOWGTPV2TEIDFLAGCOUNTER']._serialized_start=208325 + _globals['_PATTERNFLOWGTPV2TEIDFLAGCOUNTER']._serialized_end=208446 + _globals['_PATTERNFLOWGTPV2TEIDFLAGMETRICTAG']._serialized_start=208448 + _globals['_PATTERNFLOWGTPV2TEIDFLAGMETRICTAG']._serialized_end=208575 + _globals['_PATTERNFLOWGTPV2TEIDFLAG']._serialized_start=208578 + _globals['_PATTERNFLOWGTPV2TEIDFLAG']._serialized_end=208988 _globals['_PATTERNFLOWGTPV2TEIDFLAG_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV2TEIDFLAG_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV2TEIDFLAG_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV2TEIDFLAG_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV2SPARE1COUNTER']._serialized_start=207568 - _globals['_PATTERNFLOWGTPV2SPARE1COUNTER']._serialized_end=207687 - _globals['_PATTERNFLOWGTPV2SPARE1METRICTAG']._serialized_start=207689 - _globals['_PATTERNFLOWGTPV2SPARE1METRICTAG']._serialized_end=207814 - _globals['_PATTERNFLOWGTPV2SPARE1']._serialized_start=207817 - _globals['_PATTERNFLOWGTPV2SPARE1']._serialized_end=208217 + _globals['_PATTERNFLOWGTPV2SPARE1COUNTER']._serialized_start=208990 + _globals['_PATTERNFLOWGTPV2SPARE1COUNTER']._serialized_end=209109 + _globals['_PATTERNFLOWGTPV2SPARE1METRICTAG']._serialized_start=209111 + _globals['_PATTERNFLOWGTPV2SPARE1METRICTAG']._serialized_end=209236 + _globals['_PATTERNFLOWGTPV2SPARE1']._serialized_start=209239 + _globals['_PATTERNFLOWGTPV2SPARE1']._serialized_end=209639 _globals['_PATTERNFLOWGTPV2SPARE1_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV2SPARE1_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV2SPARE1_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV2SPARE1_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV2MESSAGETYPECOUNTER']._serialized_start=208219 - _globals['_PATTERNFLOWGTPV2MESSAGETYPECOUNTER']._serialized_end=208343 - _globals['_PATTERNFLOWGTPV2MESSAGETYPEMETRICTAG']._serialized_start=208346 - _globals['_PATTERNFLOWGTPV2MESSAGETYPEMETRICTAG']._serialized_end=208476 - _globals['_PATTERNFLOWGTPV2MESSAGETYPE']._serialized_start=208479 - _globals['_PATTERNFLOWGTPV2MESSAGETYPE']._serialized_end=208904 + _globals['_PATTERNFLOWGTPV2MESSAGETYPECOUNTER']._serialized_start=209641 + _globals['_PATTERNFLOWGTPV2MESSAGETYPECOUNTER']._serialized_end=209765 + _globals['_PATTERNFLOWGTPV2MESSAGETYPEMETRICTAG']._serialized_start=209768 + _globals['_PATTERNFLOWGTPV2MESSAGETYPEMETRICTAG']._serialized_end=209898 + _globals['_PATTERNFLOWGTPV2MESSAGETYPE']._serialized_start=209901 + _globals['_PATTERNFLOWGTPV2MESSAGETYPE']._serialized_end=210326 _globals['_PATTERNFLOWGTPV2MESSAGETYPE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV2MESSAGETYPE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV2MESSAGETYPE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV2MESSAGETYPE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV2MESSAGELENGTHCOUNTER']._serialized_start=208906 - _globals['_PATTERNFLOWGTPV2MESSAGELENGTHCOUNTER']._serialized_end=209032 - _globals['_PATTERNFLOWGTPV2MESSAGELENGTHMETRICTAG']._serialized_start=209035 - _globals['_PATTERNFLOWGTPV2MESSAGELENGTHMETRICTAG']._serialized_end=209167 - _globals['_PATTERNFLOWGTPV2MESSAGELENGTH']._serialized_start=209170 - _globals['_PATTERNFLOWGTPV2MESSAGELENGTH']._serialized_end=209605 + _globals['_PATTERNFLOWGTPV2MESSAGELENGTHCOUNTER']._serialized_start=210328 + _globals['_PATTERNFLOWGTPV2MESSAGELENGTHCOUNTER']._serialized_end=210454 + _globals['_PATTERNFLOWGTPV2MESSAGELENGTHMETRICTAG']._serialized_start=210457 + _globals['_PATTERNFLOWGTPV2MESSAGELENGTHMETRICTAG']._serialized_end=210589 + _globals['_PATTERNFLOWGTPV2MESSAGELENGTH']._serialized_start=210592 + _globals['_PATTERNFLOWGTPV2MESSAGELENGTH']._serialized_end=211027 _globals['_PATTERNFLOWGTPV2MESSAGELENGTH_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV2MESSAGELENGTH_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV2MESSAGELENGTH_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV2MESSAGELENGTH_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV2TEIDCOUNTER']._serialized_start=209607 - _globals['_PATTERNFLOWGTPV2TEIDCOUNTER']._serialized_end=209724 - _globals['_PATTERNFLOWGTPV2TEIDMETRICTAG']._serialized_start=209726 - _globals['_PATTERNFLOWGTPV2TEIDMETRICTAG']._serialized_end=209849 - _globals['_PATTERNFLOWGTPV2TEID']._serialized_start=209852 - _globals['_PATTERNFLOWGTPV2TEID']._serialized_end=210242 + _globals['_PATTERNFLOWGTPV2TEIDCOUNTER']._serialized_start=211029 + _globals['_PATTERNFLOWGTPV2TEIDCOUNTER']._serialized_end=211146 + _globals['_PATTERNFLOWGTPV2TEIDMETRICTAG']._serialized_start=211148 + _globals['_PATTERNFLOWGTPV2TEIDMETRICTAG']._serialized_end=211271 + _globals['_PATTERNFLOWGTPV2TEID']._serialized_start=211274 + _globals['_PATTERNFLOWGTPV2TEID']._serialized_end=211664 _globals['_PATTERNFLOWGTPV2TEID_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV2TEID_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV2TEID_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV2TEID_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV2SEQUENCENUMBERCOUNTER']._serialized_start=210244 - _globals['_PATTERNFLOWGTPV2SEQUENCENUMBERCOUNTER']._serialized_end=210371 - _globals['_PATTERNFLOWGTPV2SEQUENCENUMBERMETRICTAG']._serialized_start=210374 - _globals['_PATTERNFLOWGTPV2SEQUENCENUMBERMETRICTAG']._serialized_end=210507 - _globals['_PATTERNFLOWGTPV2SEQUENCENUMBER']._serialized_start=210510 - _globals['_PATTERNFLOWGTPV2SEQUENCENUMBER']._serialized_end=210950 + _globals['_PATTERNFLOWGTPV2SEQUENCENUMBERCOUNTER']._serialized_start=211666 + _globals['_PATTERNFLOWGTPV2SEQUENCENUMBERCOUNTER']._serialized_end=211793 + _globals['_PATTERNFLOWGTPV2SEQUENCENUMBERMETRICTAG']._serialized_start=211796 + _globals['_PATTERNFLOWGTPV2SEQUENCENUMBERMETRICTAG']._serialized_end=211929 + _globals['_PATTERNFLOWGTPV2SEQUENCENUMBER']._serialized_start=211932 + _globals['_PATTERNFLOWGTPV2SEQUENCENUMBER']._serialized_end=212372 _globals['_PATTERNFLOWGTPV2SEQUENCENUMBER_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV2SEQUENCENUMBER_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV2SEQUENCENUMBER_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV2SEQUENCENUMBER_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWGTPV2SPARE2COUNTER']._serialized_start=210952 - _globals['_PATTERNFLOWGTPV2SPARE2COUNTER']._serialized_end=211071 - _globals['_PATTERNFLOWGTPV2SPARE2METRICTAG']._serialized_start=211073 - _globals['_PATTERNFLOWGTPV2SPARE2METRICTAG']._serialized_end=211198 - _globals['_PATTERNFLOWGTPV2SPARE2']._serialized_start=211201 - _globals['_PATTERNFLOWGTPV2SPARE2']._serialized_end=211601 + _globals['_PATTERNFLOWGTPV2SPARE2COUNTER']._serialized_start=212374 + _globals['_PATTERNFLOWGTPV2SPARE2COUNTER']._serialized_end=212493 + _globals['_PATTERNFLOWGTPV2SPARE2METRICTAG']._serialized_start=212495 + _globals['_PATTERNFLOWGTPV2SPARE2METRICTAG']._serialized_end=212620 + _globals['_PATTERNFLOWGTPV2SPARE2']._serialized_start=212623 + _globals['_PATTERNFLOWGTPV2SPARE2']._serialized_end=213023 _globals['_PATTERNFLOWGTPV2SPARE2_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWGTPV2SPARE2_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWGTPV2SPARE2_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWGTPV2SPARE2_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWARPHARDWARETYPECOUNTER']._serialized_start=211603 - _globals['_PATTERNFLOWARPHARDWARETYPECOUNTER']._serialized_end=211726 - _globals['_PATTERNFLOWARPHARDWARETYPEMETRICTAG']._serialized_start=211729 - _globals['_PATTERNFLOWARPHARDWARETYPEMETRICTAG']._serialized_end=211858 - _globals['_PATTERNFLOWARPHARDWARETYPE']._serialized_start=211861 - _globals['_PATTERNFLOWARPHARDWARETYPE']._serialized_end=212281 + _globals['_PATTERNFLOWARPHARDWARETYPECOUNTER']._serialized_start=213025 + _globals['_PATTERNFLOWARPHARDWARETYPECOUNTER']._serialized_end=213148 + _globals['_PATTERNFLOWARPHARDWARETYPEMETRICTAG']._serialized_start=213151 + _globals['_PATTERNFLOWARPHARDWARETYPEMETRICTAG']._serialized_end=213280 + _globals['_PATTERNFLOWARPHARDWARETYPE']._serialized_start=213283 + _globals['_PATTERNFLOWARPHARDWARETYPE']._serialized_end=213703 _globals['_PATTERNFLOWARPHARDWARETYPE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWARPHARDWARETYPE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWARPHARDWARETYPE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWARPHARDWARETYPE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWARPPROTOCOLTYPECOUNTER']._serialized_start=212283 - _globals['_PATTERNFLOWARPPROTOCOLTYPECOUNTER']._serialized_end=212406 - _globals['_PATTERNFLOWARPPROTOCOLTYPEMETRICTAG']._serialized_start=212409 - _globals['_PATTERNFLOWARPPROTOCOLTYPEMETRICTAG']._serialized_end=212538 - _globals['_PATTERNFLOWARPPROTOCOLTYPE']._serialized_start=212541 - _globals['_PATTERNFLOWARPPROTOCOLTYPE']._serialized_end=212961 + _globals['_PATTERNFLOWARPPROTOCOLTYPECOUNTER']._serialized_start=213705 + _globals['_PATTERNFLOWARPPROTOCOLTYPECOUNTER']._serialized_end=213828 + _globals['_PATTERNFLOWARPPROTOCOLTYPEMETRICTAG']._serialized_start=213831 + _globals['_PATTERNFLOWARPPROTOCOLTYPEMETRICTAG']._serialized_end=213960 + _globals['_PATTERNFLOWARPPROTOCOLTYPE']._serialized_start=213963 + _globals['_PATTERNFLOWARPPROTOCOLTYPE']._serialized_end=214383 _globals['_PATTERNFLOWARPPROTOCOLTYPE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWARPPROTOCOLTYPE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWARPPROTOCOLTYPE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWARPPROTOCOLTYPE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWARPHARDWARELENGTHCOUNTER']._serialized_start=212963 - _globals['_PATTERNFLOWARPHARDWARELENGTHCOUNTER']._serialized_end=213088 - _globals['_PATTERNFLOWARPHARDWARELENGTHMETRICTAG']._serialized_start=213091 - _globals['_PATTERNFLOWARPHARDWARELENGTHMETRICTAG']._serialized_end=213222 - _globals['_PATTERNFLOWARPHARDWARELENGTH']._serialized_start=213225 - _globals['_PATTERNFLOWARPHARDWARELENGTH']._serialized_end=213655 + _globals['_PATTERNFLOWARPHARDWARELENGTHCOUNTER']._serialized_start=214385 + _globals['_PATTERNFLOWARPHARDWARELENGTHCOUNTER']._serialized_end=214510 + _globals['_PATTERNFLOWARPHARDWARELENGTHMETRICTAG']._serialized_start=214513 + _globals['_PATTERNFLOWARPHARDWARELENGTHMETRICTAG']._serialized_end=214644 + _globals['_PATTERNFLOWARPHARDWARELENGTH']._serialized_start=214647 + _globals['_PATTERNFLOWARPHARDWARELENGTH']._serialized_end=215077 _globals['_PATTERNFLOWARPHARDWARELENGTH_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWARPHARDWARELENGTH_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWARPHARDWARELENGTH_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWARPHARDWARELENGTH_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWARPPROTOCOLLENGTHCOUNTER']._serialized_start=213657 - _globals['_PATTERNFLOWARPPROTOCOLLENGTHCOUNTER']._serialized_end=213782 - _globals['_PATTERNFLOWARPPROTOCOLLENGTHMETRICTAG']._serialized_start=213785 - _globals['_PATTERNFLOWARPPROTOCOLLENGTHMETRICTAG']._serialized_end=213916 - _globals['_PATTERNFLOWARPPROTOCOLLENGTH']._serialized_start=213919 - _globals['_PATTERNFLOWARPPROTOCOLLENGTH']._serialized_end=214349 + _globals['_PATTERNFLOWARPPROTOCOLLENGTHCOUNTER']._serialized_start=215079 + _globals['_PATTERNFLOWARPPROTOCOLLENGTHCOUNTER']._serialized_end=215204 + _globals['_PATTERNFLOWARPPROTOCOLLENGTHMETRICTAG']._serialized_start=215207 + _globals['_PATTERNFLOWARPPROTOCOLLENGTHMETRICTAG']._serialized_end=215338 + _globals['_PATTERNFLOWARPPROTOCOLLENGTH']._serialized_start=215341 + _globals['_PATTERNFLOWARPPROTOCOLLENGTH']._serialized_end=215771 _globals['_PATTERNFLOWARPPROTOCOLLENGTH_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWARPPROTOCOLLENGTH_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWARPPROTOCOLLENGTH_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWARPPROTOCOLLENGTH_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWARPOPERATIONCOUNTER']._serialized_start=214351 - _globals['_PATTERNFLOWARPOPERATIONCOUNTER']._serialized_end=214471 - _globals['_PATTERNFLOWARPOPERATIONMETRICTAG']._serialized_start=214473 - _globals['_PATTERNFLOWARPOPERATIONMETRICTAG']._serialized_end=214599 - _globals['_PATTERNFLOWARPOPERATION']._serialized_start=214602 - _globals['_PATTERNFLOWARPOPERATION']._serialized_end=215007 + _globals['_PATTERNFLOWARPOPERATIONCOUNTER']._serialized_start=215773 + _globals['_PATTERNFLOWARPOPERATIONCOUNTER']._serialized_end=215893 + _globals['_PATTERNFLOWARPOPERATIONMETRICTAG']._serialized_start=215895 + _globals['_PATTERNFLOWARPOPERATIONMETRICTAG']._serialized_end=216021 + _globals['_PATTERNFLOWARPOPERATION']._serialized_start=216024 + _globals['_PATTERNFLOWARPOPERATION']._serialized_end=216429 _globals['_PATTERNFLOWARPOPERATION_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWARPOPERATION_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWARPOPERATION_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWARPOPERATION_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWARPSENDERHARDWAREADDRCOUNTER']._serialized_start=215010 - _globals['_PATTERNFLOWARPSENDERHARDWAREADDRCOUNTER']._serialized_end=215139 - _globals['_PATTERNFLOWARPSENDERHARDWAREADDRMETRICTAG']._serialized_start=215142 - _globals['_PATTERNFLOWARPSENDERHARDWAREADDRMETRICTAG']._serialized_end=215277 - _globals['_PATTERNFLOWARPSENDERHARDWAREADDR']._serialized_start=215280 - _globals['_PATTERNFLOWARPSENDERHARDWAREADDR']._serialized_end=215730 + _globals['_PATTERNFLOWARPSENDERHARDWAREADDRCOUNTER']._serialized_start=216432 + _globals['_PATTERNFLOWARPSENDERHARDWAREADDRCOUNTER']._serialized_end=216561 + _globals['_PATTERNFLOWARPSENDERHARDWAREADDRMETRICTAG']._serialized_start=216564 + _globals['_PATTERNFLOWARPSENDERHARDWAREADDRMETRICTAG']._serialized_end=216699 + _globals['_PATTERNFLOWARPSENDERHARDWAREADDR']._serialized_start=216702 + _globals['_PATTERNFLOWARPSENDERHARDWAREADDR']._serialized_end=217152 _globals['_PATTERNFLOWARPSENDERHARDWAREADDR_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWARPSENDERHARDWAREADDR_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWARPSENDERHARDWAREADDR_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWARPSENDERHARDWAREADDR_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWARPSENDERPROTOCOLADDRCOUNTER']._serialized_start=215733 - _globals['_PATTERNFLOWARPSENDERPROTOCOLADDRCOUNTER']._serialized_end=215862 - _globals['_PATTERNFLOWARPSENDERPROTOCOLADDRMETRICTAG']._serialized_start=215865 - _globals['_PATTERNFLOWARPSENDERPROTOCOLADDRMETRICTAG']._serialized_end=216000 - _globals['_PATTERNFLOWARPSENDERPROTOCOLADDR']._serialized_start=216003 - _globals['_PATTERNFLOWARPSENDERPROTOCOLADDR']._serialized_end=216453 + _globals['_PATTERNFLOWARPSENDERPROTOCOLADDRCOUNTER']._serialized_start=217155 + _globals['_PATTERNFLOWARPSENDERPROTOCOLADDRCOUNTER']._serialized_end=217284 + _globals['_PATTERNFLOWARPSENDERPROTOCOLADDRMETRICTAG']._serialized_start=217287 + _globals['_PATTERNFLOWARPSENDERPROTOCOLADDRMETRICTAG']._serialized_end=217422 + _globals['_PATTERNFLOWARPSENDERPROTOCOLADDR']._serialized_start=217425 + _globals['_PATTERNFLOWARPSENDERPROTOCOLADDR']._serialized_end=217875 _globals['_PATTERNFLOWARPSENDERPROTOCOLADDR_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWARPSENDERPROTOCOLADDR_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWARPSENDERPROTOCOLADDR_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWARPSENDERPROTOCOLADDR_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWARPTARGETHARDWAREADDRCOUNTER']._serialized_start=216456 - _globals['_PATTERNFLOWARPTARGETHARDWAREADDRCOUNTER']._serialized_end=216585 - _globals['_PATTERNFLOWARPTARGETHARDWAREADDRMETRICTAG']._serialized_start=216588 - _globals['_PATTERNFLOWARPTARGETHARDWAREADDRMETRICTAG']._serialized_end=216723 - _globals['_PATTERNFLOWARPTARGETHARDWAREADDR']._serialized_start=216726 - _globals['_PATTERNFLOWARPTARGETHARDWAREADDR']._serialized_end=217176 + _globals['_PATTERNFLOWARPTARGETHARDWAREADDRCOUNTER']._serialized_start=217878 + _globals['_PATTERNFLOWARPTARGETHARDWAREADDRCOUNTER']._serialized_end=218007 + _globals['_PATTERNFLOWARPTARGETHARDWAREADDRMETRICTAG']._serialized_start=218010 + _globals['_PATTERNFLOWARPTARGETHARDWAREADDRMETRICTAG']._serialized_end=218145 + _globals['_PATTERNFLOWARPTARGETHARDWAREADDR']._serialized_start=218148 + _globals['_PATTERNFLOWARPTARGETHARDWAREADDR']._serialized_end=218598 _globals['_PATTERNFLOWARPTARGETHARDWAREADDR_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWARPTARGETHARDWAREADDR_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWARPTARGETHARDWAREADDR_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWARPTARGETHARDWAREADDR_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWARPTARGETPROTOCOLADDRCOUNTER']._serialized_start=217179 - _globals['_PATTERNFLOWARPTARGETPROTOCOLADDRCOUNTER']._serialized_end=217308 - _globals['_PATTERNFLOWARPTARGETPROTOCOLADDRMETRICTAG']._serialized_start=217311 - _globals['_PATTERNFLOWARPTARGETPROTOCOLADDRMETRICTAG']._serialized_end=217446 - _globals['_PATTERNFLOWARPTARGETPROTOCOLADDR']._serialized_start=217449 - _globals['_PATTERNFLOWARPTARGETPROTOCOLADDR']._serialized_end=217899 + _globals['_PATTERNFLOWARPTARGETPROTOCOLADDRCOUNTER']._serialized_start=218601 + _globals['_PATTERNFLOWARPTARGETPROTOCOLADDRCOUNTER']._serialized_end=218730 + _globals['_PATTERNFLOWARPTARGETPROTOCOLADDRMETRICTAG']._serialized_start=218733 + _globals['_PATTERNFLOWARPTARGETPROTOCOLADDRMETRICTAG']._serialized_end=218868 + _globals['_PATTERNFLOWARPTARGETPROTOCOLADDR']._serialized_start=218871 + _globals['_PATTERNFLOWARPTARGETPROTOCOLADDR']._serialized_end=219321 _globals['_PATTERNFLOWARPTARGETPROTOCOLADDR_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWARPTARGETPROTOCOLADDR_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWARPTARGETPROTOCOLADDR_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWARPTARGETPROTOCOLADDR_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWICMPECHOTYPECOUNTER']._serialized_start=217901 - _globals['_PATTERNFLOWICMPECHOTYPECOUNTER']._serialized_end=218021 - _globals['_PATTERNFLOWICMPECHOTYPEMETRICTAG']._serialized_start=218023 - _globals['_PATTERNFLOWICMPECHOTYPEMETRICTAG']._serialized_end=218149 - _globals['_PATTERNFLOWICMPECHOTYPE']._serialized_start=218152 - _globals['_PATTERNFLOWICMPECHOTYPE']._serialized_end=218557 + _globals['_PATTERNFLOWICMPECHOTYPECOUNTER']._serialized_start=219323 + _globals['_PATTERNFLOWICMPECHOTYPECOUNTER']._serialized_end=219443 + _globals['_PATTERNFLOWICMPECHOTYPEMETRICTAG']._serialized_start=219445 + _globals['_PATTERNFLOWICMPECHOTYPEMETRICTAG']._serialized_end=219571 + _globals['_PATTERNFLOWICMPECHOTYPE']._serialized_start=219574 + _globals['_PATTERNFLOWICMPECHOTYPE']._serialized_end=219979 _globals['_PATTERNFLOWICMPECHOTYPE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWICMPECHOTYPE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWICMPECHOTYPE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWICMPECHOTYPE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWICMPECHOCODECOUNTER']._serialized_start=218559 - _globals['_PATTERNFLOWICMPECHOCODECOUNTER']._serialized_end=218679 - _globals['_PATTERNFLOWICMPECHOCODEMETRICTAG']._serialized_start=218681 - _globals['_PATTERNFLOWICMPECHOCODEMETRICTAG']._serialized_end=218807 - _globals['_PATTERNFLOWICMPECHOCODE']._serialized_start=218810 - _globals['_PATTERNFLOWICMPECHOCODE']._serialized_end=219215 + _globals['_PATTERNFLOWICMPECHOCODECOUNTER']._serialized_start=219981 + _globals['_PATTERNFLOWICMPECHOCODECOUNTER']._serialized_end=220101 + _globals['_PATTERNFLOWICMPECHOCODEMETRICTAG']._serialized_start=220103 + _globals['_PATTERNFLOWICMPECHOCODEMETRICTAG']._serialized_end=220229 + _globals['_PATTERNFLOWICMPECHOCODE']._serialized_start=220232 + _globals['_PATTERNFLOWICMPECHOCODE']._serialized_end=220637 _globals['_PATTERNFLOWICMPECHOCODE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWICMPECHOCODE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWICMPECHOCODE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWICMPECHOCODE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWICMPECHOCHECKSUM']._serialized_start=219218 - _globals['_PATTERNFLOWICMPECHOCHECKSUM']._serialized_end=219563 + _globals['_PATTERNFLOWICMPECHOCHECKSUM']._serialized_start=220640 + _globals['_PATTERNFLOWICMPECHOCHECKSUM']._serialized_end=220985 _globals['_PATTERNFLOWICMPECHOCHECKSUM_CHOICE']._serialized_start=151967 _globals['_PATTERNFLOWICMPECHOCHECKSUM_CHOICE']._serialized_end=152027 _globals['_PATTERNFLOWICMPECHOCHECKSUM_CHOICE_ENUM']._serialized_start=151977 @@ -3113,28 +3127,28 @@ _globals['_PATTERNFLOWICMPECHOCHECKSUM_GENERATED']._serialized_end=152084 _globals['_PATTERNFLOWICMPECHOCHECKSUM_GENERATED_ENUM']._serialized_start=152042 _globals['_PATTERNFLOWICMPECHOCHECKSUM_GENERATED_ENUM']._serialized_end=152084 - _globals['_PATTERNFLOWICMPECHOIDENTIFIERCOUNTER']._serialized_start=219565 - _globals['_PATTERNFLOWICMPECHOIDENTIFIERCOUNTER']._serialized_end=219691 - _globals['_PATTERNFLOWICMPECHOIDENTIFIERMETRICTAG']._serialized_start=219694 - _globals['_PATTERNFLOWICMPECHOIDENTIFIERMETRICTAG']._serialized_end=219826 - _globals['_PATTERNFLOWICMPECHOIDENTIFIER']._serialized_start=219829 - _globals['_PATTERNFLOWICMPECHOIDENTIFIER']._serialized_end=220264 + _globals['_PATTERNFLOWICMPECHOIDENTIFIERCOUNTER']._serialized_start=220987 + _globals['_PATTERNFLOWICMPECHOIDENTIFIERCOUNTER']._serialized_end=221113 + _globals['_PATTERNFLOWICMPECHOIDENTIFIERMETRICTAG']._serialized_start=221116 + _globals['_PATTERNFLOWICMPECHOIDENTIFIERMETRICTAG']._serialized_end=221248 + _globals['_PATTERNFLOWICMPECHOIDENTIFIER']._serialized_start=221251 + _globals['_PATTERNFLOWICMPECHOIDENTIFIER']._serialized_end=221686 _globals['_PATTERNFLOWICMPECHOIDENTIFIER_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWICMPECHOIDENTIFIER_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWICMPECHOIDENTIFIER_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWICMPECHOIDENTIFIER_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBERCOUNTER']._serialized_start=220267 - _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBERCOUNTER']._serialized_end=220397 - _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBERMETRICTAG']._serialized_start=220400 - _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBERMETRICTAG']._serialized_end=220536 - _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBER']._serialized_start=220539 - _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBER']._serialized_end=220994 + _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBERCOUNTER']._serialized_start=221689 + _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBERCOUNTER']._serialized_end=221819 + _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBERMETRICTAG']._serialized_start=221822 + _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBERMETRICTAG']._serialized_end=221958 + _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBER']._serialized_start=221961 + _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBER']._serialized_end=222416 _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBER_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBER_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBER_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWICMPECHOSEQUENCENUMBER_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWICMPCOMMONCHECKSUM']._serialized_start=220997 - _globals['_PATTERNFLOWICMPCOMMONCHECKSUM']._serialized_end=221348 + _globals['_PATTERNFLOWICMPCOMMONCHECKSUM']._serialized_start=222419 + _globals['_PATTERNFLOWICMPCOMMONCHECKSUM']._serialized_end=222770 _globals['_PATTERNFLOWICMPCOMMONCHECKSUM_CHOICE']._serialized_start=151967 _globals['_PATTERNFLOWICMPCOMMONCHECKSUM_CHOICE']._serialized_end=152027 _globals['_PATTERNFLOWICMPCOMMONCHECKSUM_CHOICE_ENUM']._serialized_start=151977 @@ -3143,68 +3157,68 @@ _globals['_PATTERNFLOWICMPCOMMONCHECKSUM_GENERATED']._serialized_end=152084 _globals['_PATTERNFLOWICMPCOMMONCHECKSUM_GENERATED_ENUM']._serialized_start=152042 _globals['_PATTERNFLOWICMPCOMMONCHECKSUM_GENERATED_ENUM']._serialized_end=152084 - _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIERCOUNTER']._serialized_start=221351 - _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIERCOUNTER']._serialized_end=221483 - _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIERMETRICTAG']._serialized_start=221486 - _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIERMETRICTAG']._serialized_end=221624 - _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIER']._serialized_start=221627 - _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIER']._serialized_end=222092 + _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIERCOUNTER']._serialized_start=222773 + _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIERCOUNTER']._serialized_end=222905 + _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIERMETRICTAG']._serialized_start=222908 + _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIERMETRICTAG']._serialized_end=223046 + _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIER']._serialized_start=223049 + _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIER']._serialized_end=223514 _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIER_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIER_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIER_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWICMPNEXTFIELDSIDENTIFIER_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBERCOUNTER']._serialized_start=222095 - _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBERCOUNTER']._serialized_end=222231 - _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBERMETRICTAG']._serialized_start=222234 - _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBERMETRICTAG']._serialized_end=222376 - _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBER']._serialized_start=222379 - _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBER']._serialized_end=222864 + _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBERCOUNTER']._serialized_start=223517 + _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBERCOUNTER']._serialized_end=223653 + _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBERMETRICTAG']._serialized_start=223656 + _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBERMETRICTAG']._serialized_end=223798 + _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBER']._serialized_start=223801 + _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBER']._serialized_end=224286 _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBER_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBER_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBER_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWICMPNEXTFIELDSSEQUENCENUMBER_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWICMPV6ECHOTYPECOUNTER']._serialized_start=222866 - _globals['_PATTERNFLOWICMPV6ECHOTYPECOUNTER']._serialized_end=222988 - _globals['_PATTERNFLOWICMPV6ECHOTYPEMETRICTAG']._serialized_start=222991 - _globals['_PATTERNFLOWICMPV6ECHOTYPEMETRICTAG']._serialized_end=223119 - _globals['_PATTERNFLOWICMPV6ECHOTYPE']._serialized_start=223122 - _globals['_PATTERNFLOWICMPV6ECHOTYPE']._serialized_end=223537 + _globals['_PATTERNFLOWICMPV6ECHOTYPECOUNTER']._serialized_start=224288 + _globals['_PATTERNFLOWICMPV6ECHOTYPECOUNTER']._serialized_end=224410 + _globals['_PATTERNFLOWICMPV6ECHOTYPEMETRICTAG']._serialized_start=224413 + _globals['_PATTERNFLOWICMPV6ECHOTYPEMETRICTAG']._serialized_end=224541 + _globals['_PATTERNFLOWICMPV6ECHOTYPE']._serialized_start=224544 + _globals['_PATTERNFLOWICMPV6ECHOTYPE']._serialized_end=224959 _globals['_PATTERNFLOWICMPV6ECHOTYPE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWICMPV6ECHOTYPE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWICMPV6ECHOTYPE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWICMPV6ECHOTYPE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWICMPV6ECHOCODECOUNTER']._serialized_start=223539 - _globals['_PATTERNFLOWICMPV6ECHOCODECOUNTER']._serialized_end=223661 - _globals['_PATTERNFLOWICMPV6ECHOCODEMETRICTAG']._serialized_start=223664 - _globals['_PATTERNFLOWICMPV6ECHOCODEMETRICTAG']._serialized_end=223792 - _globals['_PATTERNFLOWICMPV6ECHOCODE']._serialized_start=223795 - _globals['_PATTERNFLOWICMPV6ECHOCODE']._serialized_end=224210 + _globals['_PATTERNFLOWICMPV6ECHOCODECOUNTER']._serialized_start=224961 + _globals['_PATTERNFLOWICMPV6ECHOCODECOUNTER']._serialized_end=225083 + _globals['_PATTERNFLOWICMPV6ECHOCODEMETRICTAG']._serialized_start=225086 + _globals['_PATTERNFLOWICMPV6ECHOCODEMETRICTAG']._serialized_end=225214 + _globals['_PATTERNFLOWICMPV6ECHOCODE']._serialized_start=225217 + _globals['_PATTERNFLOWICMPV6ECHOCODE']._serialized_end=225632 _globals['_PATTERNFLOWICMPV6ECHOCODE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWICMPV6ECHOCODE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWICMPV6ECHOCODE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWICMPV6ECHOCODE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIERCOUNTER']._serialized_start=224213 - _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIERCOUNTER']._serialized_end=224341 - _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIERMETRICTAG']._serialized_start=224344 - _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIERMETRICTAG']._serialized_end=224478 - _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIER']._serialized_start=224481 - _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIER']._serialized_end=224926 + _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIERCOUNTER']._serialized_start=225635 + _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIERCOUNTER']._serialized_end=225763 + _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIERMETRICTAG']._serialized_start=225766 + _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIERMETRICTAG']._serialized_end=225900 + _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIER']._serialized_start=225903 + _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIER']._serialized_end=226348 _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIER_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIER_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIER_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWICMPV6ECHOIDENTIFIER_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBERCOUNTER']._serialized_start=224929 - _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBERCOUNTER']._serialized_end=225061 - _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBERMETRICTAG']._serialized_start=225064 - _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBERMETRICTAG']._serialized_end=225202 - _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBER']._serialized_start=225205 - _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBER']._serialized_end=225670 + _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBERCOUNTER']._serialized_start=226351 + _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBERCOUNTER']._serialized_end=226483 + _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBERMETRICTAG']._serialized_start=226486 + _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBERMETRICTAG']._serialized_end=226624 + _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBER']._serialized_start=226627 + _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBER']._serialized_end=227092 _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBER_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBER_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBER_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWICMPV6ECHOSEQUENCENUMBER_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWICMPV6ECHOCHECKSUM']._serialized_start=225673 - _globals['_PATTERNFLOWICMPV6ECHOCHECKSUM']._serialized_end=226024 + _globals['_PATTERNFLOWICMPV6ECHOCHECKSUM']._serialized_start=227095 + _globals['_PATTERNFLOWICMPV6ECHOCHECKSUM']._serialized_end=227446 _globals['_PATTERNFLOWICMPV6ECHOCHECKSUM_CHOICE']._serialized_start=151967 _globals['_PATTERNFLOWICMPV6ECHOCHECKSUM_CHOICE']._serialized_end=152027 _globals['_PATTERNFLOWICMPV6ECHOCHECKSUM_CHOICE_ENUM']._serialized_start=151977 @@ -3213,8 +3227,8 @@ _globals['_PATTERNFLOWICMPV6ECHOCHECKSUM_GENERATED']._serialized_end=152084 _globals['_PATTERNFLOWICMPV6ECHOCHECKSUM_GENERATED_ENUM']._serialized_start=152042 _globals['_PATTERNFLOWICMPV6ECHOCHECKSUM_GENERATED_ENUM']._serialized_end=152084 - _globals['_PATTERNFLOWICMPV6COMMONCHECKSUM']._serialized_start=226027 - _globals['_PATTERNFLOWICMPV6COMMONCHECKSUM']._serialized_end=226384 + _globals['_PATTERNFLOWICMPV6COMMONCHECKSUM']._serialized_start=227449 + _globals['_PATTERNFLOWICMPV6COMMONCHECKSUM']._serialized_end=227806 _globals['_PATTERNFLOWICMPV6COMMONCHECKSUM_CHOICE']._serialized_start=151967 _globals['_PATTERNFLOWICMPV6COMMONCHECKSUM_CHOICE']._serialized_end=152027 _globals['_PATTERNFLOWICMPV6COMMONCHECKSUM_CHOICE_ENUM']._serialized_start=151977 @@ -3223,68 +3237,68 @@ _globals['_PATTERNFLOWICMPV6COMMONCHECKSUM_GENERATED']._serialized_end=152084 _globals['_PATTERNFLOWICMPV6COMMONCHECKSUM_GENERATED_ENUM']._serialized_start=152042 _globals['_PATTERNFLOWICMPV6COMMONCHECKSUM_GENERATED_ENUM']._serialized_end=152084 - _globals['_PATTERNFLOWPPPADDRESSCOUNTER']._serialized_start=226386 - _globals['_PATTERNFLOWPPPADDRESSCOUNTER']._serialized_end=226504 - _globals['_PATTERNFLOWPPPADDRESSMETRICTAG']._serialized_start=226506 - _globals['_PATTERNFLOWPPPADDRESSMETRICTAG']._serialized_end=226630 - _globals['_PATTERNFLOWPPPADDRESS']._serialized_start=226633 - _globals['_PATTERNFLOWPPPADDRESS']._serialized_end=227028 + _globals['_PATTERNFLOWPPPADDRESSCOUNTER']._serialized_start=227808 + _globals['_PATTERNFLOWPPPADDRESSCOUNTER']._serialized_end=227926 + _globals['_PATTERNFLOWPPPADDRESSMETRICTAG']._serialized_start=227928 + _globals['_PATTERNFLOWPPPADDRESSMETRICTAG']._serialized_end=228052 + _globals['_PATTERNFLOWPPPADDRESS']._serialized_start=228055 + _globals['_PATTERNFLOWPPPADDRESS']._serialized_end=228450 _globals['_PATTERNFLOWPPPADDRESS_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPPPADDRESS_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPPPADDRESS_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPPPADDRESS_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPPPCONTROLCOUNTER']._serialized_start=227030 - _globals['_PATTERNFLOWPPPCONTROLCOUNTER']._serialized_end=227148 - _globals['_PATTERNFLOWPPPCONTROLMETRICTAG']._serialized_start=227150 - _globals['_PATTERNFLOWPPPCONTROLMETRICTAG']._serialized_end=227274 - _globals['_PATTERNFLOWPPPCONTROL']._serialized_start=227277 - _globals['_PATTERNFLOWPPPCONTROL']._serialized_end=227672 + _globals['_PATTERNFLOWPPPCONTROLCOUNTER']._serialized_start=228452 + _globals['_PATTERNFLOWPPPCONTROLCOUNTER']._serialized_end=228570 + _globals['_PATTERNFLOWPPPCONTROLMETRICTAG']._serialized_start=228572 + _globals['_PATTERNFLOWPPPCONTROLMETRICTAG']._serialized_end=228696 + _globals['_PATTERNFLOWPPPCONTROL']._serialized_start=228699 + _globals['_PATTERNFLOWPPPCONTROL']._serialized_end=229094 _globals['_PATTERNFLOWPPPCONTROL_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWPPPCONTROL_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWPPPCONTROL_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWPPPCONTROL_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWPPPPROTOCOLTYPECOUNTER']._serialized_start=227674 - _globals['_PATTERNFLOWPPPPROTOCOLTYPECOUNTER']._serialized_end=227797 - _globals['_PATTERNFLOWPPPPROTOCOLTYPEMETRICTAG']._serialized_start=227800 - _globals['_PATTERNFLOWPPPPROTOCOLTYPEMETRICTAG']._serialized_end=227929 - _globals['_PATTERNFLOWPPPPROTOCOLTYPE']._serialized_start=227932 - _globals['_PATTERNFLOWPPPPROTOCOLTYPE']._serialized_end=228390 + _globals['_PATTERNFLOWPPPPROTOCOLTYPECOUNTER']._serialized_start=229096 + _globals['_PATTERNFLOWPPPPROTOCOLTYPECOUNTER']._serialized_end=229219 + _globals['_PATTERNFLOWPPPPROTOCOLTYPEMETRICTAG']._serialized_start=229222 + _globals['_PATTERNFLOWPPPPROTOCOLTYPEMETRICTAG']._serialized_end=229351 + _globals['_PATTERNFLOWPPPPROTOCOLTYPE']._serialized_start=229354 + _globals['_PATTERNFLOWPPPPROTOCOLTYPE']._serialized_end=229812 _globals['_PATTERNFLOWPPPPROTOCOLTYPE_CHOICE']._serialized_start=137481 _globals['_PATTERNFLOWPPPPROTOCOLTYPE_CHOICE']._serialized_end=137577 _globals['_PATTERNFLOWPPPPROTOCOLTYPE_CHOICE_ENUM']._serialized_start=137491 _globals['_PATTERNFLOWPPPPROTOCOLTYPE_CHOICE_ENUM']._serialized_end=137577 - _globals['_PATTERNFLOWIGMPV1VERSIONCOUNTER']._serialized_start=228392 - _globals['_PATTERNFLOWIGMPV1VERSIONCOUNTER']._serialized_end=228513 - _globals['_PATTERNFLOWIGMPV1VERSIONMETRICTAG']._serialized_start=228515 - _globals['_PATTERNFLOWIGMPV1VERSIONMETRICTAG']._serialized_end=228642 - _globals['_PATTERNFLOWIGMPV1VERSION']._serialized_start=228645 - _globals['_PATTERNFLOWIGMPV1VERSION']._serialized_end=229055 + _globals['_PATTERNFLOWIGMPV1VERSIONCOUNTER']._serialized_start=229814 + _globals['_PATTERNFLOWIGMPV1VERSIONCOUNTER']._serialized_end=229935 + _globals['_PATTERNFLOWIGMPV1VERSIONMETRICTAG']._serialized_start=229937 + _globals['_PATTERNFLOWIGMPV1VERSIONMETRICTAG']._serialized_end=230064 + _globals['_PATTERNFLOWIGMPV1VERSION']._serialized_start=230067 + _globals['_PATTERNFLOWIGMPV1VERSION']._serialized_end=230477 _globals['_PATTERNFLOWIGMPV1VERSION_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIGMPV1VERSION_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIGMPV1VERSION_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIGMPV1VERSION_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIGMPV1TYPECOUNTER']._serialized_start=229057 - _globals['_PATTERNFLOWIGMPV1TYPECOUNTER']._serialized_end=229175 - _globals['_PATTERNFLOWIGMPV1TYPEMETRICTAG']._serialized_start=229177 - _globals['_PATTERNFLOWIGMPV1TYPEMETRICTAG']._serialized_end=229301 - _globals['_PATTERNFLOWIGMPV1TYPE']._serialized_start=229304 - _globals['_PATTERNFLOWIGMPV1TYPE']._serialized_end=229699 + _globals['_PATTERNFLOWIGMPV1TYPECOUNTER']._serialized_start=230479 + _globals['_PATTERNFLOWIGMPV1TYPECOUNTER']._serialized_end=230597 + _globals['_PATTERNFLOWIGMPV1TYPEMETRICTAG']._serialized_start=230599 + _globals['_PATTERNFLOWIGMPV1TYPEMETRICTAG']._serialized_end=230723 + _globals['_PATTERNFLOWIGMPV1TYPE']._serialized_start=230726 + _globals['_PATTERNFLOWIGMPV1TYPE']._serialized_end=231121 _globals['_PATTERNFLOWIGMPV1TYPE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIGMPV1TYPE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIGMPV1TYPE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIGMPV1TYPE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIGMPV1UNUSEDCOUNTER']._serialized_start=229701 - _globals['_PATTERNFLOWIGMPV1UNUSEDCOUNTER']._serialized_end=229821 - _globals['_PATTERNFLOWIGMPV1UNUSEDMETRICTAG']._serialized_start=229823 - _globals['_PATTERNFLOWIGMPV1UNUSEDMETRICTAG']._serialized_end=229949 - _globals['_PATTERNFLOWIGMPV1UNUSED']._serialized_start=229952 - _globals['_PATTERNFLOWIGMPV1UNUSED']._serialized_end=230357 + _globals['_PATTERNFLOWIGMPV1UNUSEDCOUNTER']._serialized_start=231123 + _globals['_PATTERNFLOWIGMPV1UNUSEDCOUNTER']._serialized_end=231243 + _globals['_PATTERNFLOWIGMPV1UNUSEDMETRICTAG']._serialized_start=231245 + _globals['_PATTERNFLOWIGMPV1UNUSEDMETRICTAG']._serialized_end=231371 + _globals['_PATTERNFLOWIGMPV1UNUSED']._serialized_start=231374 + _globals['_PATTERNFLOWIGMPV1UNUSED']._serialized_end=231779 _globals['_PATTERNFLOWIGMPV1UNUSED_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIGMPV1UNUSED_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIGMPV1UNUSED_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIGMPV1UNUSED_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWIGMPV1CHECKSUM']._serialized_start=230360 - _globals['_PATTERNFLOWIGMPV1CHECKSUM']._serialized_end=230699 + _globals['_PATTERNFLOWIGMPV1CHECKSUM']._serialized_start=231782 + _globals['_PATTERNFLOWIGMPV1CHECKSUM']._serialized_end=232121 _globals['_PATTERNFLOWIGMPV1CHECKSUM_CHOICE']._serialized_start=151967 _globals['_PATTERNFLOWIGMPV1CHECKSUM_CHOICE']._serialized_end=152027 _globals['_PATTERNFLOWIGMPV1CHECKSUM_CHOICE_ENUM']._serialized_start=151977 @@ -3293,160 +3307,160 @@ _globals['_PATTERNFLOWIGMPV1CHECKSUM_GENERATED']._serialized_end=152084 _globals['_PATTERNFLOWIGMPV1CHECKSUM_GENERATED_ENUM']._serialized_start=152042 _globals['_PATTERNFLOWIGMPV1CHECKSUM_GENERATED_ENUM']._serialized_end=152084 - _globals['_PATTERNFLOWIGMPV1GROUPADDRESSCOUNTER']._serialized_start=230701 - _globals['_PATTERNFLOWIGMPV1GROUPADDRESSCOUNTER']._serialized_end=230827 - _globals['_PATTERNFLOWIGMPV1GROUPADDRESSMETRICTAG']._serialized_start=230830 - _globals['_PATTERNFLOWIGMPV1GROUPADDRESSMETRICTAG']._serialized_end=230962 - _globals['_PATTERNFLOWIGMPV1GROUPADDRESS']._serialized_start=230965 - _globals['_PATTERNFLOWIGMPV1GROUPADDRESS']._serialized_end=231400 + _globals['_PATTERNFLOWIGMPV1GROUPADDRESSCOUNTER']._serialized_start=232123 + _globals['_PATTERNFLOWIGMPV1GROUPADDRESSCOUNTER']._serialized_end=232249 + _globals['_PATTERNFLOWIGMPV1GROUPADDRESSMETRICTAG']._serialized_start=232252 + _globals['_PATTERNFLOWIGMPV1GROUPADDRESSMETRICTAG']._serialized_end=232384 + _globals['_PATTERNFLOWIGMPV1GROUPADDRESS']._serialized_start=232387 + _globals['_PATTERNFLOWIGMPV1GROUPADDRESS']._serialized_end=232822 _globals['_PATTERNFLOWIGMPV1GROUPADDRESS_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWIGMPV1GROUPADDRESS_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWIGMPV1GROUPADDRESS_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWIGMPV1GROUPADDRESS_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWMPLSLABELCOUNTER']._serialized_start=231402 - _globals['_PATTERNFLOWMPLSLABELCOUNTER']._serialized_end=231519 - _globals['_PATTERNFLOWMPLSLABELMETRICTAG']._serialized_start=231521 - _globals['_PATTERNFLOWMPLSLABELMETRICTAG']._serialized_end=231644 - _globals['_PATTERNFLOWMPLSLABEL']._serialized_start=231647 - _globals['_PATTERNFLOWMPLSLABEL']._serialized_end=232075 + _globals['_PATTERNFLOWMPLSLABELCOUNTER']._serialized_start=232824 + _globals['_PATTERNFLOWMPLSLABELCOUNTER']._serialized_end=232941 + _globals['_PATTERNFLOWMPLSLABELMETRICTAG']._serialized_start=232943 + _globals['_PATTERNFLOWMPLSLABELMETRICTAG']._serialized_end=233066 + _globals['_PATTERNFLOWMPLSLABEL']._serialized_start=233069 + _globals['_PATTERNFLOWMPLSLABEL']._serialized_end=233497 _globals['_PATTERNFLOWMPLSLABEL_CHOICE']._serialized_start=137481 _globals['_PATTERNFLOWMPLSLABEL_CHOICE']._serialized_end=137577 _globals['_PATTERNFLOWMPLSLABEL_CHOICE_ENUM']._serialized_start=137491 _globals['_PATTERNFLOWMPLSLABEL_CHOICE_ENUM']._serialized_end=137577 - _globals['_PATTERNFLOWMPLSTRAFFICCLASSCOUNTER']._serialized_start=232077 - _globals['_PATTERNFLOWMPLSTRAFFICCLASSCOUNTER']._serialized_end=232201 - _globals['_PATTERNFLOWMPLSTRAFFICCLASSMETRICTAG']._serialized_start=232204 - _globals['_PATTERNFLOWMPLSTRAFFICCLASSMETRICTAG']._serialized_end=232334 - _globals['_PATTERNFLOWMPLSTRAFFICCLASS']._serialized_start=232337 - _globals['_PATTERNFLOWMPLSTRAFFICCLASS']._serialized_end=232762 + _globals['_PATTERNFLOWMPLSTRAFFICCLASSCOUNTER']._serialized_start=233499 + _globals['_PATTERNFLOWMPLSTRAFFICCLASSCOUNTER']._serialized_end=233623 + _globals['_PATTERNFLOWMPLSTRAFFICCLASSMETRICTAG']._serialized_start=233626 + _globals['_PATTERNFLOWMPLSTRAFFICCLASSMETRICTAG']._serialized_end=233756 + _globals['_PATTERNFLOWMPLSTRAFFICCLASS']._serialized_start=233759 + _globals['_PATTERNFLOWMPLSTRAFFICCLASS']._serialized_end=234184 _globals['_PATTERNFLOWMPLSTRAFFICCLASS_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWMPLSTRAFFICCLASS_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWMPLSTRAFFICCLASS_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWMPLSTRAFFICCLASS_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWMPLSBOTTOMOFSTACKCOUNTER']._serialized_start=232764 - _globals['_PATTERNFLOWMPLSBOTTOMOFSTACKCOUNTER']._serialized_end=232889 - _globals['_PATTERNFLOWMPLSBOTTOMOFSTACKMETRICTAG']._serialized_start=232892 - _globals['_PATTERNFLOWMPLSBOTTOMOFSTACKMETRICTAG']._serialized_end=233023 - _globals['_PATTERNFLOWMPLSBOTTOMOFSTACK']._serialized_start=233026 - _globals['_PATTERNFLOWMPLSBOTTOMOFSTACK']._serialized_end=233494 + _globals['_PATTERNFLOWMPLSBOTTOMOFSTACKCOUNTER']._serialized_start=234186 + _globals['_PATTERNFLOWMPLSBOTTOMOFSTACKCOUNTER']._serialized_end=234311 + _globals['_PATTERNFLOWMPLSBOTTOMOFSTACKMETRICTAG']._serialized_start=234314 + _globals['_PATTERNFLOWMPLSBOTTOMOFSTACKMETRICTAG']._serialized_end=234445 + _globals['_PATTERNFLOWMPLSBOTTOMOFSTACK']._serialized_start=234448 + _globals['_PATTERNFLOWMPLSBOTTOMOFSTACK']._serialized_end=234916 _globals['_PATTERNFLOWMPLSBOTTOMOFSTACK_CHOICE']._serialized_start=137481 _globals['_PATTERNFLOWMPLSBOTTOMOFSTACK_CHOICE']._serialized_end=137577 _globals['_PATTERNFLOWMPLSBOTTOMOFSTACK_CHOICE_ENUM']._serialized_start=137491 _globals['_PATTERNFLOWMPLSBOTTOMOFSTACK_CHOICE_ENUM']._serialized_end=137577 - _globals['_PATTERNFLOWMPLSTIMETOLIVECOUNTER']._serialized_start=233496 - _globals['_PATTERNFLOWMPLSTIMETOLIVECOUNTER']._serialized_end=233618 - _globals['_PATTERNFLOWMPLSTIMETOLIVEMETRICTAG']._serialized_start=233621 - _globals['_PATTERNFLOWMPLSTIMETOLIVEMETRICTAG']._serialized_end=233749 - _globals['_PATTERNFLOWMPLSTIMETOLIVE']._serialized_start=233752 - _globals['_PATTERNFLOWMPLSTIMETOLIVE']._serialized_end=234167 + _globals['_PATTERNFLOWMPLSTIMETOLIVECOUNTER']._serialized_start=234918 + _globals['_PATTERNFLOWMPLSTIMETOLIVECOUNTER']._serialized_end=235040 + _globals['_PATTERNFLOWMPLSTIMETOLIVEMETRICTAG']._serialized_start=235043 + _globals['_PATTERNFLOWMPLSTIMETOLIVEMETRICTAG']._serialized_end=235171 + _globals['_PATTERNFLOWMPLSTIMETOLIVE']._serialized_start=235174 + _globals['_PATTERNFLOWMPLSTIMETOLIVE']._serialized_end=235589 _globals['_PATTERNFLOWMPLSTIMETOLIVE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWMPLSTIMETOLIVE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWMPLSTIMETOLIVE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWMPLSTIMETOLIVE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWSNMPV2CVERSIONCOUNTER']._serialized_start=234169 - _globals['_PATTERNFLOWSNMPV2CVERSIONCOUNTER']._serialized_end=234291 - _globals['_PATTERNFLOWSNMPV2CVERSION']._serialized_start=234294 - _globals['_PATTERNFLOWSNMPV2CVERSION']._serialized_end=234647 + _globals['_PATTERNFLOWSNMPV2CVERSIONCOUNTER']._serialized_start=235591 + _globals['_PATTERNFLOWSNMPV2CVERSIONCOUNTER']._serialized_end=235713 + _globals['_PATTERNFLOWSNMPV2CVERSION']._serialized_start=235716 + _globals['_PATTERNFLOWSNMPV2CVERSION']._serialized_end=236069 _globals['_PATTERNFLOWSNMPV2CVERSION_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWSNMPV2CVERSION_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWSNMPV2CVERSION_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWSNMPV2CVERSION_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWSNMPV2CPDUREQUESTIDCOUNTER']._serialized_start=234649 - _globals['_PATTERNFLOWSNMPV2CPDUREQUESTIDCOUNTER']._serialized_end=234776 - _globals['_PATTERNFLOWSNMPV2CPDUREQUESTID']._serialized_start=234779 - _globals['_PATTERNFLOWSNMPV2CPDUREQUESTID']._serialized_end=235152 + _globals['_PATTERNFLOWSNMPV2CPDUREQUESTIDCOUNTER']._serialized_start=236071 + _globals['_PATTERNFLOWSNMPV2CPDUREQUESTIDCOUNTER']._serialized_end=236198 + _globals['_PATTERNFLOWSNMPV2CPDUREQUESTID']._serialized_start=236201 + _globals['_PATTERNFLOWSNMPV2CPDUREQUESTID']._serialized_end=236574 _globals['_PATTERNFLOWSNMPV2CPDUREQUESTID_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWSNMPV2CPDUREQUESTID_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWSNMPV2CPDUREQUESTID_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWSNMPV2CPDUREQUESTID_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWSNMPV2CPDUERRORINDEXCOUNTER']._serialized_start=235155 - _globals['_PATTERNFLOWSNMPV2CPDUERRORINDEXCOUNTER']._serialized_end=235283 - _globals['_PATTERNFLOWSNMPV2CPDUERRORINDEX']._serialized_start=235286 - _globals['_PATTERNFLOWSNMPV2CPDUERRORINDEX']._serialized_end=235663 + _globals['_PATTERNFLOWSNMPV2CPDUERRORINDEXCOUNTER']._serialized_start=236577 + _globals['_PATTERNFLOWSNMPV2CPDUERRORINDEXCOUNTER']._serialized_end=236705 + _globals['_PATTERNFLOWSNMPV2CPDUERRORINDEX']._serialized_start=236708 + _globals['_PATTERNFLOWSNMPV2CPDUERRORINDEX']._serialized_end=237085 _globals['_PATTERNFLOWSNMPV2CPDUERRORINDEX_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWSNMPV2CPDUERRORINDEX_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWSNMPV2CPDUERRORINDEX_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWSNMPV2CPDUERRORINDEX_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWSNMPV2CBULKPDUREQUESTIDCOUNTER']._serialized_start=235666 - _globals['_PATTERNFLOWSNMPV2CBULKPDUREQUESTIDCOUNTER']._serialized_end=235797 - _globals['_PATTERNFLOWSNMPV2CBULKPDUREQUESTID']._serialized_start=235800 - _globals['_PATTERNFLOWSNMPV2CBULKPDUREQUESTID']._serialized_end=236189 + _globals['_PATTERNFLOWSNMPV2CBULKPDUREQUESTIDCOUNTER']._serialized_start=237088 + _globals['_PATTERNFLOWSNMPV2CBULKPDUREQUESTIDCOUNTER']._serialized_end=237219 + _globals['_PATTERNFLOWSNMPV2CBULKPDUREQUESTID']._serialized_start=237222 + _globals['_PATTERNFLOWSNMPV2CBULKPDUREQUESTID']._serialized_end=237611 _globals['_PATTERNFLOWSNMPV2CBULKPDUREQUESTID_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWSNMPV2CBULKPDUREQUESTID_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWSNMPV2CBULKPDUREQUESTID_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWSNMPV2CBULKPDUREQUESTID_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWSNMPV2CBULKPDUNONREPEATERS']._serialized_start=236192 - _globals['_PATTERNFLOWSNMPV2CBULKPDUNONREPEATERS']._serialized_end=236423 - _globals['_PATTERNFLOWSNMPV2CBULKPDUNONREPEATERS_CHOICE']._serialized_start=236346 - _globals['_PATTERNFLOWSNMPV2CBULKPDUNONREPEATERS_CHOICE']._serialized_end=236402 + _globals['_PATTERNFLOWSNMPV2CBULKPDUNONREPEATERS']._serialized_start=237614 + _globals['_PATTERNFLOWSNMPV2CBULKPDUNONREPEATERS']._serialized_end=237845 + _globals['_PATTERNFLOWSNMPV2CBULKPDUNONREPEATERS_CHOICE']._serialized_start=237768 + _globals['_PATTERNFLOWSNMPV2CBULKPDUNONREPEATERS_CHOICE']._serialized_end=237824 _globals['_PATTERNFLOWSNMPV2CBULKPDUNONREPEATERS_CHOICE_ENUM']._serialized_start=137491 _globals['_PATTERNFLOWSNMPV2CBULKPDUNONREPEATERS_CHOICE_ENUM']._serialized_end=137537 - _globals['_PATTERNFLOWSNMPV2CBULKPDUMAXREPETITIONSCOUNTER']._serialized_start=236426 - _globals['_PATTERNFLOWSNMPV2CBULKPDUMAXREPETITIONSCOUNTER']._serialized_end=236562 - _globals['_PATTERNFLOWSNMPV2CBULKPDUMAXREPETITIONS']._serialized_start=236565 - _globals['_PATTERNFLOWSNMPV2CBULKPDUMAXREPETITIONS']._serialized_end=236974 + _globals['_PATTERNFLOWSNMPV2CBULKPDUMAXREPETITIONSCOUNTER']._serialized_start=237848 + _globals['_PATTERNFLOWSNMPV2CBULKPDUMAXREPETITIONSCOUNTER']._serialized_end=237984 + _globals['_PATTERNFLOWSNMPV2CBULKPDUMAXREPETITIONS']._serialized_start=237987 + _globals['_PATTERNFLOWSNMPV2CBULKPDUMAXREPETITIONS']._serialized_end=238396 _globals['_PATTERNFLOWSNMPV2CBULKPDUMAXREPETITIONS_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWSNMPV2CBULKPDUMAXREPETITIONS_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWSNMPV2CBULKPDUMAXREPETITIONS_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWSNMPV2CBULKPDUMAXREPETITIONS_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEINTEGERVALUECOUNTER']._serialized_start=236977 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEINTEGERVALUECOUNTER']._serialized_end=237124 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEINTEGERVALUE']._serialized_start=237127 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEINTEGERVALUE']._serialized_end=237580 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEINTEGERVALUECOUNTER']._serialized_start=238399 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEINTEGERVALUECOUNTER']._serialized_end=238546 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEINTEGERVALUE']._serialized_start=238549 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEINTEGERVALUE']._serialized_end=239002 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEINTEGERVALUE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEINTEGERVALUE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEINTEGERVALUE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEINTEGERVALUE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEIPADDRESSVALUECOUNTER']._serialized_start=237583 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEIPADDRESSVALUECOUNTER']._serialized_end=237732 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEIPADDRESSVALUE']._serialized_start=237735 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEIPADDRESSVALUE']._serialized_end=238196 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEIPADDRESSVALUECOUNTER']._serialized_start=239005 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEIPADDRESSVALUECOUNTER']._serialized_end=239154 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEIPADDRESSVALUE']._serialized_start=239157 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEIPADDRESSVALUE']._serialized_end=239618 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEIPADDRESSVALUE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEIPADDRESSVALUE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEIPADDRESSVALUE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEIPADDRESSVALUE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUECOUNTERVALUECOUNTER']._serialized_start=238199 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUECOUNTERVALUECOUNTER']._serialized_end=238346 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUECOUNTERVALUE']._serialized_start=238349 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUECOUNTERVALUE']._serialized_end=238802 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUECOUNTERVALUECOUNTER']._serialized_start=239621 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUECOUNTERVALUECOUNTER']._serialized_end=239768 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUECOUNTERVALUE']._serialized_start=239771 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUECOUNTERVALUE']._serialized_end=240224 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUECOUNTERVALUE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUECOUNTERVALUE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUECOUNTERVALUE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUECOUNTERVALUE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUETIMETICKSVALUECOUNTER']._serialized_start=238805 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUETIMETICKSVALUECOUNTER']._serialized_end=238954 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUETIMETICKSVALUE']._serialized_start=238957 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUETIMETICKSVALUE']._serialized_end=239418 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUETIMETICKSVALUECOUNTER']._serialized_start=240227 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUETIMETICKSVALUECOUNTER']._serialized_end=240376 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUETIMETICKSVALUE']._serialized_start=240379 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUETIMETICKSVALUE']._serialized_end=240840 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUETIMETICKSVALUE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUETIMETICKSVALUE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUETIMETICKSVALUE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUETIMETICKSVALUE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEBIGCOUNTERVALUECOUNTER']._serialized_start=239421 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEBIGCOUNTERVALUECOUNTER']._serialized_end=239571 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEBIGCOUNTERVALUE']._serialized_start=239574 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEBIGCOUNTERVALUE']._serialized_end=240039 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEBIGCOUNTERVALUECOUNTER']._serialized_start=240843 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEBIGCOUNTERVALUECOUNTER']._serialized_end=240993 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEBIGCOUNTERVALUE']._serialized_start=240996 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEBIGCOUNTERVALUE']._serialized_end=241461 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEBIGCOUNTERVALUE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEBIGCOUNTERVALUE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEBIGCOUNTERVALUE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEBIGCOUNTERVALUE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEUNSIGNEDINTEGERVALUECOUNTER']._serialized_start=240042 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEUNSIGNEDINTEGERVALUECOUNTER']._serialized_end=240197 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEUNSIGNEDINTEGERVALUE']._serialized_start=240200 - _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEUNSIGNEDINTEGERVALUE']._serialized_end=240685 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEUNSIGNEDINTEGERVALUECOUNTER']._serialized_start=241464 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEUNSIGNEDINTEGERVALUECOUNTER']._serialized_end=241619 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEUNSIGNEDINTEGERVALUE']._serialized_start=241622 + _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEUNSIGNEDINTEGERVALUE']._serialized_end=242107 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEUNSIGNEDINTEGERVALUE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEUNSIGNEDINTEGERVALUE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEUNSIGNEDINTEGERVALUE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWSNMPV2CVARIABLEBINDINGVALUEUNSIGNEDINTEGERVALUE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWSNMPV2CCOMMONREQUESTIDCOUNTER']._serialized_start=240688 - _globals['_PATTERNFLOWSNMPV2CCOMMONREQUESTIDCOUNTER']._serialized_end=240818 - _globals['_PATTERNFLOWSNMPV2CCOMMONREQUESTID']._serialized_start=240821 - _globals['_PATTERNFLOWSNMPV2CCOMMONREQUESTID']._serialized_end=241206 + _globals['_PATTERNFLOWSNMPV2CCOMMONREQUESTIDCOUNTER']._serialized_start=242110 + _globals['_PATTERNFLOWSNMPV2CCOMMONREQUESTIDCOUNTER']._serialized_end=242240 + _globals['_PATTERNFLOWSNMPV2CCOMMONREQUESTID']._serialized_start=242243 + _globals['_PATTERNFLOWSNMPV2CCOMMONREQUESTID']._serialized_end=242628 _globals['_PATTERNFLOWSNMPV2CCOMMONREQUESTID_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWSNMPV2CCOMMONREQUESTID_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWSNMPV2CCOMMONREQUESTID_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWSNMPV2CCOMMONREQUESTID_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPRSVPCHECKSUM']._serialized_start=241209 - _globals['_PATTERNFLOWRSVPRSVPCHECKSUM']._serialized_end=241554 + _globals['_PATTERNFLOWRSVPRSVPCHECKSUM']._serialized_start=242631 + _globals['_PATTERNFLOWRSVPRSVPCHECKSUM']._serialized_end=242976 _globals['_PATTERNFLOWRSVPRSVPCHECKSUM_CHOICE']._serialized_start=151967 _globals['_PATTERNFLOWRSVPRSVPCHECKSUM_CHOICE']._serialized_end=152027 _globals['_PATTERNFLOWRSVPRSVPCHECKSUM_CHOICE_ENUM']._serialized_start=151977 @@ -3455,320 +3469,320 @@ _globals['_PATTERNFLOWRSVPRSVPCHECKSUM_GENERATED']._serialized_end=152084 _globals['_PATTERNFLOWRSVPRSVPCHECKSUM_GENERATED_ENUM']._serialized_start=152042 _globals['_PATTERNFLOWRSVPRSVPCHECKSUM_GENERATED_ENUM']._serialized_end=152084 - _globals['_PATTERNFLOWRSVPTIMETOLIVECOUNTER']._serialized_start=241556 - _globals['_PATTERNFLOWRSVPTIMETOLIVECOUNTER']._serialized_end=241678 - _globals['_PATTERNFLOWRSVPTIMETOLIVE']._serialized_start=241681 - _globals['_PATTERNFLOWRSVPTIMETOLIVE']._serialized_end=242034 + _globals['_PATTERNFLOWRSVPTIMETOLIVECOUNTER']._serialized_start=242978 + _globals['_PATTERNFLOWRSVPTIMETOLIVECOUNTER']._serialized_end=243100 + _globals['_PATTERNFLOWRSVPTIMETOLIVE']._serialized_start=243103 + _globals['_PATTERNFLOWRSVPTIMETOLIVE']._serialized_end=243456 _globals['_PATTERNFLOWRSVPTIMETOLIVE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPTIMETOLIVE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPTIMETOLIVE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPTIMETOLIVE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPRESERVEDCOUNTER']._serialized_start=242036 - _globals['_PATTERNFLOWRSVPRESERVEDCOUNTER']._serialized_end=242156 - _globals['_PATTERNFLOWRSVPRESERVED']._serialized_start=242159 - _globals['_PATTERNFLOWRSVPRESERVED']._serialized_end=242504 + _globals['_PATTERNFLOWRSVPRESERVEDCOUNTER']._serialized_start=243458 + _globals['_PATTERNFLOWRSVPRESERVEDCOUNTER']._serialized_end=243578 + _globals['_PATTERNFLOWRSVPRESERVED']._serialized_start=243581 + _globals['_PATTERNFLOWRSVPRESERVED']._serialized_end=243926 _globals['_PATTERNFLOWRSVPRESERVED_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPRESERVED_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPRESERVED_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPRESERVED_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4IPV4TUNNELENDPOINTADDRESSCOUNTER']._serialized_start=242507 - _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4IPV4TUNNELENDPOINTADDRESSCOUNTER']._serialized_end=242668 - _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4IPV4TUNNELENDPOINTADDRESS']._serialized_start=242671 - _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4IPV4TUNNELENDPOINTADDRESS']._serialized_end=243180 + _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4IPV4TUNNELENDPOINTADDRESSCOUNTER']._serialized_start=243929 + _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4IPV4TUNNELENDPOINTADDRESSCOUNTER']._serialized_end=244090 + _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4IPV4TUNNELENDPOINTADDRESS']._serialized_start=244093 + _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4IPV4TUNNELENDPOINTADDRESS']._serialized_end=244602 _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4IPV4TUNNELENDPOINTADDRESS_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4IPV4TUNNELENDPOINTADDRESS_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4IPV4TUNNELENDPOINTADDRESS_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4IPV4TUNNELENDPOINTADDRESS_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4RESERVEDCOUNTER']._serialized_start=243183 - _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4RESERVEDCOUNTER']._serialized_end=243327 - _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4RESERVED']._serialized_start=243330 - _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4RESERVED']._serialized_end=243771 + _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4RESERVEDCOUNTER']._serialized_start=244605 + _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4RESERVEDCOUNTER']._serialized_end=244749 + _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4RESERVED']._serialized_start=244752 + _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4RESERVED']._serialized_end=245193 _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4RESERVED_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4RESERVED_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4RESERVED_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4RESERVED_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4TUNNELIDCOUNTER']._serialized_start=243774 - _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4TUNNELIDCOUNTER']._serialized_end=243918 - _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4TUNNELID']._serialized_start=243921 - _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4TUNNELID']._serialized_end=244362 + _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4TUNNELIDCOUNTER']._serialized_start=245196 + _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4TUNNELIDCOUNTER']._serialized_end=245340 + _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4TUNNELID']._serialized_start=245343 + _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4TUNNELID']._serialized_end=245784 _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4TUNNELID_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4TUNNELID_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4TUNNELID_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSESSIONLSPTUNNELIPV4TUNNELID_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASINTEGERCOUNTER']._serialized_start=244365 - _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASINTEGERCOUNTER']._serialized_end=244508 - _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASINTEGER']._serialized_start=244511 - _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASINTEGER']._serialized_end=244948 + _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASINTEGERCOUNTER']._serialized_start=245787 + _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASINTEGERCOUNTER']._serialized_end=245930 + _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASINTEGER']._serialized_start=245933 + _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASINTEGER']._serialized_end=246370 _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASINTEGER_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASINTEGER_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASINTEGER_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASINTEGER_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASIPV4COUNTER']._serialized_start=244951 - _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASIPV4COUNTER']._serialized_end=245091 - _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASIPV4']._serialized_start=245094 - _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASIPV4']._serialized_end=245519 + _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASIPV4COUNTER']._serialized_start=246373 + _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASIPV4COUNTER']._serialized_end=246513 + _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASIPV4']._serialized_start=246516 + _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASIPV4']._serialized_end=246941 _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASIPV4_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASIPV4_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASIPV4_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSESSIONEXTTUNNELIDASIPV4_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4IPV4ADDRESSCOUNTER']._serialized_start=245522 - _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4IPV4ADDRESSCOUNTER']._serialized_end=245660 - _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4IPV4ADDRESS']._serialized_start=245663 - _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4IPV4ADDRESS']._serialized_end=246080 + _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4IPV4ADDRESSCOUNTER']._serialized_start=246944 + _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4IPV4ADDRESSCOUNTER']._serialized_end=247082 + _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4IPV4ADDRESS']._serialized_start=247085 + _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4IPV4ADDRESS']._serialized_end=247502 _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4IPV4ADDRESS_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4IPV4ADDRESS_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4IPV4ADDRESS_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4IPV4ADDRESS_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4LOGICALINTERFACEHANDLECOUNTER']._serialized_start=246083 - _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4LOGICALINTERFACEHANDLECOUNTER']._serialized_end=246232 - _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4LOGICALINTERFACEHANDLE']._serialized_start=246235 - _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4LOGICALINTERFACEHANDLE']._serialized_end=246696 + _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4LOGICALINTERFACEHANDLECOUNTER']._serialized_start=247505 + _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4LOGICALINTERFACEHANDLECOUNTER']._serialized_end=247654 + _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4LOGICALINTERFACEHANDLE']._serialized_start=247657 + _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4LOGICALINTERFACEHANDLE']._serialized_end=248118 _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4LOGICALINTERFACEHANDLE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4LOGICALINTERFACEHANDLE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4LOGICALINTERFACEHANDLE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHRSVPHOPIPV4LOGICALINTERFACEHANDLE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHTIMEVALUESTYPE1REFRESHPERIODRCOUNTER']._serialized_start=246699 - _globals['_PATTERNFLOWRSVPPATHTIMEVALUESTYPE1REFRESHPERIODRCOUNTER']._serialized_end=246844 - _globals['_PATTERNFLOWRSVPPATHTIMEVALUESTYPE1REFRESHPERIODR']._serialized_start=246847 - _globals['_PATTERNFLOWRSVPPATHTIMEVALUESTYPE1REFRESHPERIODR']._serialized_end=247292 + _globals['_PATTERNFLOWRSVPPATHTIMEVALUESTYPE1REFRESHPERIODRCOUNTER']._serialized_start=248121 + _globals['_PATTERNFLOWRSVPPATHTIMEVALUESTYPE1REFRESHPERIODRCOUNTER']._serialized_end=248266 + _globals['_PATTERNFLOWRSVPPATHTIMEVALUESTYPE1REFRESHPERIODR']._serialized_start=248269 + _globals['_PATTERNFLOWRSVPPATHTIMEVALUESTYPE1REFRESHPERIODR']._serialized_end=248714 _globals['_PATTERNFLOWRSVPPATHTIMEVALUESTYPE1REFRESHPERIODR_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHTIMEVALUESTYPE1REFRESHPERIODR_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHTIMEVALUESTYPE1REFRESHPERIODR_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHTIMEVALUESTYPE1REFRESHPERIODR_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXLBITCOUNTER']._serialized_start=247295 - _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXLBITCOUNTER']._serialized_end=247443 - _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXLBIT']._serialized_start=247446 - _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXLBIT']._serialized_end=247903 + _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXLBITCOUNTER']._serialized_start=248717 + _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXLBITCOUNTER']._serialized_end=248865 + _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXLBIT']._serialized_start=248868 + _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXLBIT']._serialized_end=249325 _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXLBIT_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXLBIT_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXLBIT_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXLBIT_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXIPV4ADDRESSCOUNTER']._serialized_start=247906 - _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXIPV4ADDRESSCOUNTER']._serialized_end=248061 - _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXIPV4ADDRESS']._serialized_start=248064 - _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXIPV4ADDRESS']._serialized_end=248549 + _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXIPV4ADDRESSCOUNTER']._serialized_start=249328 + _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXIPV4ADDRESSCOUNTER']._serialized_end=249483 + _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXIPV4ADDRESS']._serialized_start=249486 + _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXIPV4ADDRESS']._serialized_end=249971 _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXIPV4ADDRESS_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXIPV4ADDRESS_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXIPV4ADDRESS_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1IPV4PREFIXIPV4ADDRESS_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1ASNUMBERLBITCOUNTER']._serialized_start=248552 - _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1ASNUMBERLBITCOUNTER']._serialized_end=248698 - _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1ASNUMBERLBIT']._serialized_start=248701 - _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1ASNUMBERLBIT']._serialized_end=249150 + _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1ASNUMBERLBITCOUNTER']._serialized_start=249974 + _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1ASNUMBERLBITCOUNTER']._serialized_end=250120 + _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1ASNUMBERLBIT']._serialized_start=250123 + _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1ASNUMBERLBIT']._serialized_end=250572 _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1ASNUMBERLBIT_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1ASNUMBERLBIT_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1ASNUMBERLBIT_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHEXPLICITROUTETYPE1ASNUMBERLBIT_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGERESERVEDCOUNTER']._serialized_start=249153 - _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGERESERVEDCOUNTER']._serialized_end=249306 - _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGERESERVED']._serialized_start=249309 - _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGERESERVED']._serialized_end=249786 + _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGERESERVEDCOUNTER']._serialized_start=250575 + _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGERESERVEDCOUNTER']._serialized_end=250728 + _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGERESERVED']._serialized_start=250731 + _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGERESERVED']._serialized_end=251208 _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGERESERVED_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGERESERVED_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGERESERVED_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGERESERVED_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGEL3PIDCOUNTER']._serialized_start=249789 - _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGEL3PIDCOUNTER']._serialized_end=249939 - _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGEL3PID']._serialized_start=249942 - _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGEL3PID']._serialized_end=250407 + _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGEL3PIDCOUNTER']._serialized_start=251211 + _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGEL3PIDCOUNTER']._serialized_end=251361 + _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGEL3PID']._serialized_start=251364 + _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGEL3PID']._serialized_end=251829 _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGEL3PID_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGEL3PID_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGEL3PID_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHLABELREQUESTWITHOUTLABELRANGEL3PID_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4IPV4TUNNELSENDERADDRESSCOUNTER']._serialized_start=250410 - _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4IPV4TUNNELSENDERADDRESSCOUNTER']._serialized_end=250576 - _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4IPV4TUNNELSENDERADDRESS']._serialized_start=250579 - _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4IPV4TUNNELSENDERADDRESS']._serialized_end=251108 + _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4IPV4TUNNELSENDERADDRESSCOUNTER']._serialized_start=251832 + _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4IPV4TUNNELSENDERADDRESSCOUNTER']._serialized_end=251998 + _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4IPV4TUNNELSENDERADDRESS']._serialized_start=252001 + _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4IPV4TUNNELSENDERADDRESS']._serialized_end=252530 _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4IPV4TUNNELSENDERADDRESS_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4IPV4TUNNELSENDERADDRESS_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4IPV4TUNNELSENDERADDRESS_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4IPV4TUNNELSENDERADDRESS_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4RESERVEDCOUNTER']._serialized_start=251111 - _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4RESERVEDCOUNTER']._serialized_end=251262 - _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4RESERVED']._serialized_start=251265 - _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4RESERVED']._serialized_end=251734 + _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4RESERVEDCOUNTER']._serialized_start=252533 + _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4RESERVEDCOUNTER']._serialized_end=252684 + _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4RESERVED']._serialized_start=252687 + _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4RESERVED']._serialized_end=253156 _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4RESERVED_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4RESERVED_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4RESERVED_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4RESERVED_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4LSPIDCOUNTER']._serialized_start=251737 - _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4LSPIDCOUNTER']._serialized_end=251885 - _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4LSPID']._serialized_start=251888 - _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4LSPID']._serialized_end=252345 + _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4LSPIDCOUNTER']._serialized_start=253159 + _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4LSPIDCOUNTER']._serialized_end=253307 + _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4LSPID']._serialized_start=253310 + _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4LSPID']._serialized_end=253767 _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4LSPID_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4LSPID_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4LSPID_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTEMPLATELSPTUNNELIPV4LSPID_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVVERSIONCOUNTER']._serialized_start=252348 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVVERSIONCOUNTER']._serialized_end=252489 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVVERSION']._serialized_start=252492 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVVERSION']._serialized_end=252921 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVVERSIONCOUNTER']._serialized_start=253770 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVVERSIONCOUNTER']._serialized_end=253911 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVVERSION']._serialized_start=253914 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVVERSION']._serialized_end=254343 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVVERSION_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVVERSION_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVVERSION_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVVERSION_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED1COUNTER']._serialized_start=252924 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED1COUNTER']._serialized_end=253067 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED1']._serialized_start=253070 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED1']._serialized_end=253507 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED1COUNTER']._serialized_start=254346 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED1COUNTER']._serialized_end=254489 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED1']._serialized_start=254492 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED1']._serialized_end=254929 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED1_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED1_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED1_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED1_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVOVERALLLENGTHCOUNTER']._serialized_start=253510 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVOVERALLLENGTHCOUNTER']._serialized_end=253657 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVOVERALLLENGTH']._serialized_start=253660 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVOVERALLLENGTH']._serialized_end=254113 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVOVERALLLENGTHCOUNTER']._serialized_start=254932 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVOVERALLLENGTHCOUNTER']._serialized_end=255079 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVOVERALLLENGTH']._serialized_start=255082 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVOVERALLLENGTH']._serialized_end=255535 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVOVERALLLENGTH_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVOVERALLLENGTH_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVOVERALLLENGTH_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVOVERALLLENGTH_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVSERVICEHEADERCOUNTER']._serialized_start=254116 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVSERVICEHEADERCOUNTER']._serialized_end=254263 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVSERVICEHEADER']._serialized_start=254266 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVSERVICEHEADER']._serialized_end=254719 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVSERVICEHEADERCOUNTER']._serialized_start=255538 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVSERVICEHEADERCOUNTER']._serialized_end=255685 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVSERVICEHEADER']._serialized_start=255688 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVSERVICEHEADER']._serialized_end=256141 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVSERVICEHEADER_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVSERVICEHEADER_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVSERVICEHEADER_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVSERVICEHEADER_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVZEROBITCOUNTER']._serialized_start=254722 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVZEROBITCOUNTER']._serialized_end=254863 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVZEROBIT']._serialized_start=254866 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVZEROBIT']._serialized_end=255295 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVZEROBITCOUNTER']._serialized_start=256144 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVZEROBITCOUNTER']._serialized_end=256285 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVZEROBIT']._serialized_start=256288 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVZEROBIT']._serialized_end=256717 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVZEROBIT_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVZEROBIT_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVZEROBIT_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVZEROBIT_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED2COUNTER']._serialized_start=255298 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED2COUNTER']._serialized_end=255441 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED2']._serialized_start=255444 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED2']._serialized_end=255881 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED2COUNTER']._serialized_start=256720 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED2COUNTER']._serialized_end=256863 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED2']._serialized_start=256866 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED2']._serialized_end=257303 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED2_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED2_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED2_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVRESERVED2_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVLENGTHOFSERVICEDATACOUNTER']._serialized_start=255884 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVLENGTHOFSERVICEDATACOUNTER']._serialized_end=256037 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVLENGTHOFSERVICEDATA']._serialized_start=256040 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVLENGTHOFSERVICEDATA']._serialized_end=256517 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVLENGTHOFSERVICEDATACOUNTER']._serialized_start=257306 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVLENGTHOFSERVICEDATACOUNTER']._serialized_end=257459 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVLENGTHOFSERVICEDATA']._serialized_start=257462 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVLENGTHOFSERVICEDATA']._serialized_end=257939 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVLENGTHOFSERVICEDATA_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVLENGTHOFSERVICEDATA_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVLENGTHOFSERVICEDATA_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVLENGTHOFSERVICEDATA_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETERIDTOKENBUCKETTSPECCOUNTER']._serialized_start=256520 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETERIDTOKENBUCKETTSPECCOUNTER']._serialized_end=256681 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETERIDTOKENBUCKETTSPEC']._serialized_start=256684 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETERIDTOKENBUCKETTSPEC']._serialized_end=257193 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETERIDTOKENBUCKETTSPECCOUNTER']._serialized_start=257942 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETERIDTOKENBUCKETTSPECCOUNTER']._serialized_end=258103 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETERIDTOKENBUCKETTSPEC']._serialized_start=258106 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETERIDTOKENBUCKETTSPEC']._serialized_end=258615 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETERIDTOKENBUCKETTSPEC_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETERIDTOKENBUCKETTSPEC_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETERIDTOKENBUCKETTSPEC_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETERIDTOKENBUCKETTSPEC_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127FLAGCOUNTER']._serialized_start=257196 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127FLAGCOUNTER']._serialized_end=257346 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127FLAG']._serialized_start=257349 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127FLAG']._serialized_end=257814 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127FLAGCOUNTER']._serialized_start=258618 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127FLAGCOUNTER']._serialized_end=258768 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127FLAG']._serialized_start=258771 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127FLAG']._serialized_end=259236 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127FLAG_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127FLAG_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127FLAG_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127FLAG_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127LENGTHCOUNTER']._serialized_start=257817 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127LENGTHCOUNTER']._serialized_end=257969 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127LENGTH']._serialized_start=257972 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127LENGTH']._serialized_end=258445 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127LENGTHCOUNTER']._serialized_start=259239 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127LENGTHCOUNTER']._serialized_end=259391 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127LENGTH']._serialized_start=259394 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127LENGTH']._serialized_end=259867 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127LENGTH_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127LENGTH_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127LENGTH_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVPARAMETER127LENGTH_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMINIMUMPOLICEDUNITCOUNTER']._serialized_start=258448 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMINIMUMPOLICEDUNITCOUNTER']._serialized_end=258600 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMINIMUMPOLICEDUNIT']._serialized_start=258603 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMINIMUMPOLICEDUNIT']._serialized_end=259076 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMINIMUMPOLICEDUNITCOUNTER']._serialized_start=259870 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMINIMUMPOLICEDUNITCOUNTER']._serialized_end=260022 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMINIMUMPOLICEDUNIT']._serialized_start=260025 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMINIMUMPOLICEDUNIT']._serialized_end=260498 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMINIMUMPOLICEDUNIT_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMINIMUMPOLICEDUNIT_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMINIMUMPOLICEDUNIT_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMINIMUMPOLICEDUNIT_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMAXIMUMPACKETSIZECOUNTER']._serialized_start=259079 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMAXIMUMPACKETSIZECOUNTER']._serialized_end=259230 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMAXIMUMPACKETSIZE']._serialized_start=259233 - _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMAXIMUMPACKETSIZE']._serialized_end=259702 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMAXIMUMPACKETSIZECOUNTER']._serialized_start=260501 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMAXIMUMPACKETSIZECOUNTER']._serialized_end=260652 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMAXIMUMPACKETSIZE']._serialized_start=260655 + _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMAXIMUMPACKETSIZE']._serialized_end=261124 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMAXIMUMPACKETSIZE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMAXIMUMPACKETSIZE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMAXIMUMPACKETSIZE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHSENDERTSPECINTSERVMAXIMUMPACKETSIZE_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSIPV4ADDRESSCOUNTER']._serialized_start=259705 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSIPV4ADDRESSCOUNTER']._serialized_end=259859 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSIPV4ADDRESS']._serialized_start=259862 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSIPV4ADDRESS']._serialized_end=260343 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSIPV4ADDRESSCOUNTER']._serialized_start=261127 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSIPV4ADDRESSCOUNTER']._serialized_end=261281 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSIPV4ADDRESS']._serialized_start=261284 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSIPV4ADDRESS']._serialized_end=261765 _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSIPV4ADDRESS_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSIPV4ADDRESS_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSIPV4ADDRESS_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSIPV4ADDRESS_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSPREFIXLENGTHCOUNTER']._serialized_start=260346 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSPREFIXLENGTHCOUNTER']._serialized_end=260501 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSPREFIXLENGTH']._serialized_start=260504 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSPREFIXLENGTH']._serialized_end=260989 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSPREFIXLENGTHCOUNTER']._serialized_start=261768 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSPREFIXLENGTHCOUNTER']._serialized_end=261923 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSPREFIXLENGTH']._serialized_start=261926 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSPREFIXLENGTH']._serialized_end=262411 _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSPREFIXLENGTH_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSPREFIXLENGTH_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSPREFIXLENGTH_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1IPV4ADDRESSPREFIXLENGTH_CHOICE_ENUM']._serialized_end=138237 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELFLAGS']._serialized_start=260992 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELFLAGS']._serialized_end=261239 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELFLAGS_CHOICE']._serialized_start=236346 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELFLAGS_CHOICE']._serialized_end=236402 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELFLAGS']._serialized_start=262414 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELFLAGS']._serialized_end=262661 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELFLAGS_CHOICE']._serialized_start=237768 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELFLAGS_CHOICE']._serialized_end=237824 _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELFLAGS_CHOICE_ENUM']._serialized_start=137491 _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELFLAGS_CHOICE_ENUM']._serialized_end=137537 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELCTYPE']._serialized_start=261242 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELCTYPE']._serialized_end=261489 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELCTYPE_CHOICE']._serialized_start=236346 - _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELCTYPE_CHOICE']._serialized_end=236402 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELCTYPE']._serialized_start=262664 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELCTYPE']._serialized_end=262911 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELCTYPE_CHOICE']._serialized_start=237768 + _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELCTYPE_CHOICE']._serialized_end=237824 _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELCTYPE_CHOICE_ENUM']._serialized_start=137491 _globals['_PATTERNFLOWRSVPPATHRECORDROUTETYPE1LABELCTYPE_CHOICE_ENUM']._serialized_end=137537 - _globals['_PATTERNFLOWRSVPPATHOBJECTSCUSTOMTYPECOUNTER']._serialized_start=261492 - _globals['_PATTERNFLOWRSVPPATHOBJECTSCUSTOMTYPECOUNTER']._serialized_end=261625 - _globals['_PATTERNFLOWRSVPPATHOBJECTSCUSTOMTYPE']._serialized_start=261628 - _globals['_PATTERNFLOWRSVPPATHOBJECTSCUSTOMTYPE']._serialized_end=262025 + _globals['_PATTERNFLOWRSVPPATHOBJECTSCUSTOMTYPECOUNTER']._serialized_start=262914 + _globals['_PATTERNFLOWRSVPPATHOBJECTSCUSTOMTYPECOUNTER']._serialized_end=263047 + _globals['_PATTERNFLOWRSVPPATHOBJECTSCUSTOMTYPE']._serialized_start=263050 + _globals['_PATTERNFLOWRSVPPATHOBJECTSCUSTOMTYPE']._serialized_end=263447 _globals['_PATTERNFLOWRSVPPATHOBJECTSCUSTOMTYPE_CHOICE']._serialized_start=138151 _globals['_PATTERNFLOWRSVPPATHOBJECTSCUSTOMTYPE_CHOICE']._serialized_end=138237 _globals['_PATTERNFLOWRSVPPATHOBJECTSCUSTOMTYPE_CHOICE_ENUM']._serialized_start=138161 _globals['_PATTERNFLOWRSVPPATHOBJECTSCUSTOMTYPE_CHOICE_ENUM']._serialized_end=138237 - _globals['_VERSION']._serialized_start=262028 - _globals['_VERSION']._serialized_end=262173 - _globals['_SUCCESS']._serialized_start=262175 - _globals['_SUCCESS']._serialized_end=262215 - _globals['_FAILURE']._serialized_start=262217 - _globals['_FAILURE']._serialized_end=262253 - _globals['_SETCONFIGREQUEST']._serialized_start=262255 - _globals['_SETCONFIGREQUEST']._serialized_end=262302 - _globals['_UPDATECONFIGREQUEST']._serialized_start=262304 - _globals['_UPDATECONFIGREQUEST']._serialized_end=262367 - _globals['_SETCONFIGRESPONSE']._serialized_start=262369 - _globals['_SETCONFIGRESPONSE']._serialized_end=262419 - _globals['_GETCONFIGRESPONSE']._serialized_start=262421 - _globals['_GETCONFIGRESPONSE']._serialized_end=262469 - _globals['_UPDATECONFIGRESPONSE']._serialized_start=262471 - _globals['_UPDATECONFIGRESPONSE']._serialized_end=262524 - _globals['_SETCONTROLSTATEREQUEST']._serialized_start=262526 - _globals['_SETCONTROLSTATEREQUEST']._serialized_end=262592 - _globals['_SETCONTROLSTATERESPONSE']._serialized_start=262594 - _globals['_SETCONTROLSTATERESPONSE']._serialized_end=262650 - _globals['_SETCONTROLACTIONREQUEST']._serialized_start=262652 - _globals['_SETCONTROLACTIONREQUEST']._serialized_end=262721 - _globals['_SETCONTROLACTIONRESPONSE']._serialized_start=262723 - _globals['_SETCONTROLACTIONRESPONSE']._serialized_end=262810 - _globals['_GETMETRICSREQUEST']._serialized_start=262812 - _globals['_GETMETRICSREQUEST']._serialized_end=262877 - _globals['_GETMETRICSRESPONSE']._serialized_start=262879 - _globals['_GETMETRICSRESPONSE']._serialized_end=262947 - _globals['_GETSTATESREQUEST']._serialized_start=262949 - _globals['_GETSTATESREQUEST']._serialized_end=263011 - _globals['_GETSTATESRESPONSE']._serialized_start=263013 - _globals['_GETSTATESRESPONSE']._serialized_end=263078 - _globals['_GETCAPTUREREQUEST']._serialized_start=263080 - _globals['_GETCAPTUREREQUEST']._serialized_end=263145 - _globals['_GETCAPTURERESPONSE']._serialized_start=263147 - _globals['_GETCAPTURERESPONSE']._serialized_end=263191 - _globals['_GETVERSIONRESPONSE']._serialized_start=263193 - _globals['_GETVERSIONRESPONSE']._serialized_end=263244 - _globals['_OPENAPI']._serialized_start=263247 - _globals['_OPENAPI']._serialized_end=263854 + _globals['_VERSION']._serialized_start=263450 + _globals['_VERSION']._serialized_end=263595 + _globals['_SUCCESS']._serialized_start=263597 + _globals['_SUCCESS']._serialized_end=263637 + _globals['_FAILURE']._serialized_start=263639 + _globals['_FAILURE']._serialized_end=263675 + _globals['_SETCONFIGREQUEST']._serialized_start=263677 + _globals['_SETCONFIGREQUEST']._serialized_end=263724 + _globals['_UPDATECONFIGREQUEST']._serialized_start=263726 + _globals['_UPDATECONFIGREQUEST']._serialized_end=263789 + _globals['_SETCONFIGRESPONSE']._serialized_start=263791 + _globals['_SETCONFIGRESPONSE']._serialized_end=263841 + _globals['_GETCONFIGRESPONSE']._serialized_start=263843 + _globals['_GETCONFIGRESPONSE']._serialized_end=263891 + _globals['_UPDATECONFIGRESPONSE']._serialized_start=263893 + _globals['_UPDATECONFIGRESPONSE']._serialized_end=263946 + _globals['_SETCONTROLSTATEREQUEST']._serialized_start=263948 + _globals['_SETCONTROLSTATEREQUEST']._serialized_end=264014 + _globals['_SETCONTROLSTATERESPONSE']._serialized_start=264016 + _globals['_SETCONTROLSTATERESPONSE']._serialized_end=264072 + _globals['_SETCONTROLACTIONREQUEST']._serialized_start=264074 + _globals['_SETCONTROLACTIONREQUEST']._serialized_end=264143 + _globals['_SETCONTROLACTIONRESPONSE']._serialized_start=264145 + _globals['_SETCONTROLACTIONRESPONSE']._serialized_end=264232 + _globals['_GETMETRICSREQUEST']._serialized_start=264234 + _globals['_GETMETRICSREQUEST']._serialized_end=264299 + _globals['_GETMETRICSRESPONSE']._serialized_start=264301 + _globals['_GETMETRICSRESPONSE']._serialized_end=264369 + _globals['_GETSTATESREQUEST']._serialized_start=264371 + _globals['_GETSTATESREQUEST']._serialized_end=264433 + _globals['_GETSTATESRESPONSE']._serialized_start=264435 + _globals['_GETSTATESRESPONSE']._serialized_end=264500 + _globals['_GETCAPTUREREQUEST']._serialized_start=264502 + _globals['_GETCAPTUREREQUEST']._serialized_end=264567 + _globals['_GETCAPTURERESPONSE']._serialized_start=264569 + _globals['_GETCAPTURERESPONSE']._serialized_end=264613 + _globals['_GETVERSIONRESPONSE']._serialized_start=264615 + _globals['_GETVERSIONRESPONSE']._serialized_end=264666 + _globals['_OPENAPI']._serialized_start=264669 + _globals['_OPENAPI']._serialized_end=265276 # @@protoc_insertion_point(module_scope) diff --git a/snappi/snappi.py b/snappi/snappi.py index bb81b0d0..a73c8160 100644 --- a/snappi/snappi.py +++ b/snappi/snappi.py @@ -1,4 +1,4 @@ -# Open Traffic Generator API 1.6.2 +# Open Traffic Generator API 1.7.0 # License: MIT import importlib @@ -49175,9 +49175,10 @@ class PatternFlowIpv4Src(OpenApiObject): "enum": [ "value", "values", - "auto", "increment", "decrement", + "auto", + "random", ], }, "value": { @@ -49193,6 +49194,7 @@ class PatternFlowIpv4Src(OpenApiObject): "decrement": {"type": "PatternFlowIpv4SrcCounter"}, "metric_tags": {"type": "PatternFlowIpv4SrcMetricTagIter"}, "auto": {"type": "FlowIpv4Auto"}, + "random": {"type": "PatternFlowIpv4SrcRandom"}, } # type: Dict[str, str] _REQUIRED = () # type: tuple(str) @@ -49205,9 +49207,10 @@ class PatternFlowIpv4Src(OpenApiObject): VALUE = "value" # type: str VALUES = "values" # type: str - AUTO = "auto" # type: str INCREMENT = "increment" # type: str DECREMENT = "decrement" # type: str + AUTO = "auto" # type: str + RANDOM = "random" # type: str _STATUS = {} # type: Dict[str, Union(type)] @@ -49230,17 +49233,6 @@ def set(self, value=None, values=None): if property_name != "self" and property_value is not None: self._set_property(property_name, property_value) - @property - def auto(self): - # type: () -> FlowIpv4Auto - """Factory property that returns an instance of the FlowIpv4Auto class - - The OTG implementation can provide system generated, value for this property. - - Returns: FlowIpv4Auto - """ - return self._get_property("auto", FlowIpv4Auto, self, "auto") - @property def increment(self): # type: () -> PatternFlowIpv4SrcCounter @@ -49267,14 +49259,36 @@ def decrement(self): "decrement", PatternFlowIpv4SrcCounter, self, "decrement" ) + @property + def auto(self): + # type: () -> FlowIpv4Auto + """Factory property that returns an instance of the FlowIpv4Auto class + + The OTG implementation can provide system generated, value for this property. + + Returns: FlowIpv4Auto + """ + return self._get_property("auto", FlowIpv4Auto, self, "auto") + + @property + def random(self): + # type: () -> PatternFlowIpv4SrcRandom + """Factory property that returns an instance of the PatternFlowIpv4SrcRandom class + + ipv4 random pattern + + Returns: PatternFlowIpv4SrcRandom + """ + return self._get_property("random", PatternFlowIpv4SrcRandom, self, "random") + @property def choice(self): - # type: () -> Union[Literal["auto"], Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + # type: () -> Union[Literal["auto"], Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """choice getter TBD - Returns: Union[Literal["auto"], Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + Returns: Union[Literal["auto"], Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """ return self._get_property("choice") @@ -49284,7 +49298,7 @@ def choice(self, value): TBD - value: Union[Literal["auto"], Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + value: Union[Literal["auto"], Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """ self._set_property("choice", value) @@ -49668,6 +49682,139 @@ def choice(self, value): self._set_property("choice", value) +class PatternFlowIpv4SrcRandom(OpenApiObject): + __slots__ = "_parent" + + _TYPES = { + "min": { + "type": str, + "format": "ipv4", + }, + "max": { + "type": str, + "format": "ipv4", + }, + "seed": { + "type": int, + "format": "uint32", + }, + "count": { + "type": int, + "format": "uint32", + }, + } # type: Dict[str, str] + + _REQUIRED = () # type: tuple(str) + + _DEFAULTS = { + "min": "0.0.0.0", + "max": "255.255.255.255", + "seed": 1, + "count": 1, + } # type: Dict[str, Union(type)] + + _STATUS = {} # type: Dict[str, Union(type)] + + def __init__( + self, parent=None, min="0.0.0.0", max="255.255.255.255", seed=1, count=1 + ): + super(PatternFlowIpv4SrcRandom, self).__init__() + self._parent = parent + self._set_property("min", min) + self._set_property("max", max) + self._set_property("seed", seed) + self._set_property("count", count) + + def set(self, min=None, max=None, seed=None, count=None): + for property_name, property_value in locals().items(): + if property_name != "self" and property_value is not None: + self._set_property(property_name, property_value) + + @property + def min(self): + # type: () -> str + """min getter + + The minimum possible value generated by the random value generator. + + Returns: str + """ + return self._get_property("min") + + @min.setter + def min(self, value): + """min setter + + The minimum possible value generated by the random value generator. + + value: str + """ + self._set_property("min", value) + + @property + def max(self): + # type: () -> str + """max getter + + The maximum possible value generated by the random value generator. + + Returns: str + """ + return self._get_property("max") + + @max.setter + def max(self, value): + """max setter + + The maximum possible value generated by the random value generator. + + value: str + """ + self._set_property("max", value) + + @property + def seed(self): + # type: () -> int + """seed getter + + The seed value is used to initialize the random number generator to deterministic state. If the user provides seed value of 0, the implementation will generate sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in deterministic manner (specific to the implementation). + + Returns: int + """ + return self._get_property("seed") + + @seed.setter + def seed(self, value): + """seed setter + + The seed value is used to initialize the random number generator to deterministic state. If the user provides seed value of 0, the implementation will generate sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in deterministic manner (specific to the implementation). + + value: int + """ + self._set_property("seed", value) + + @property + def count(self): + # type: () -> int + """count getter + + The total number of values to be generated by the random value generator. + + Returns: int + """ + return self._get_property("count") + + @count.setter + def count(self, value): + """count setter + + The total number of values to be generated by the random value generator. + + value: int + """ + self._set_property("count", value) + + class PatternFlowIpv4Dst(OpenApiObject): __slots__ = ("_parent", "_choice") @@ -49677,9 +49824,10 @@ class PatternFlowIpv4Dst(OpenApiObject): "enum": [ "value", "values", - "auto", "increment", "decrement", + "auto", + "random", ], }, "value": { @@ -49695,6 +49843,7 @@ class PatternFlowIpv4Dst(OpenApiObject): "decrement": {"type": "PatternFlowIpv4DstCounter"}, "metric_tags": {"type": "PatternFlowIpv4DstMetricTagIter"}, "auto": {"type": "FlowIpv4Auto"}, + "random": {"type": "PatternFlowIpv4DstRandom"}, } # type: Dict[str, str] _REQUIRED = () # type: tuple(str) @@ -49707,9 +49856,10 @@ class PatternFlowIpv4Dst(OpenApiObject): VALUE = "value" # type: str VALUES = "values" # type: str - AUTO = "auto" # type: str INCREMENT = "increment" # type: str DECREMENT = "decrement" # type: str + AUTO = "auto" # type: str + RANDOM = "random" # type: str _STATUS = {} # type: Dict[str, Union(type)] @@ -49732,17 +49882,6 @@ def set(self, value=None, values=None): if property_name != "self" and property_value is not None: self._set_property(property_name, property_value) - @property - def auto(self): - # type: () -> FlowIpv4Auto - """Factory property that returns an instance of the FlowIpv4Auto class - - The OTG implementation can provide system generated, value for this property. - - Returns: FlowIpv4Auto - """ - return self._get_property("auto", FlowIpv4Auto, self, "auto") - @property def increment(self): # type: () -> PatternFlowIpv4DstCounter @@ -49769,14 +49908,36 @@ def decrement(self): "decrement", PatternFlowIpv4DstCounter, self, "decrement" ) + @property + def auto(self): + # type: () -> FlowIpv4Auto + """Factory property that returns an instance of the FlowIpv4Auto class + + The OTG implementation can provide system generated, value for this property. + + Returns: FlowIpv4Auto + """ + return self._get_property("auto", FlowIpv4Auto, self, "auto") + + @property + def random(self): + # type: () -> PatternFlowIpv4DstRandom + """Factory property that returns an instance of the PatternFlowIpv4DstRandom class + + ipv4 random pattern + + Returns: PatternFlowIpv4DstRandom + """ + return self._get_property("random", PatternFlowIpv4DstRandom, self, "random") + @property def choice(self): - # type: () -> Union[Literal["auto"], Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + # type: () -> Union[Literal["auto"], Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """choice getter TBD - Returns: Union[Literal["auto"], Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + Returns: Union[Literal["auto"], Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """ return self._get_property("choice") @@ -49786,7 +49947,7 @@ def choice(self, value): TBD - value: Union[Literal["auto"], Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + value: Union[Literal["auto"], Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """ self._set_property("choice", value) @@ -50114,6 +50275,139 @@ def add(self, name=None, offset=0, length=32): return item +class PatternFlowIpv4DstRandom(OpenApiObject): + __slots__ = "_parent" + + _TYPES = { + "min": { + "type": str, + "format": "ipv4", + }, + "max": { + "type": str, + "format": "ipv4", + }, + "seed": { + "type": int, + "format": "uint32", + }, + "count": { + "type": int, + "format": "uint32", + }, + } # type: Dict[str, str] + + _REQUIRED = () # type: tuple(str) + + _DEFAULTS = { + "min": "0.0.0.0", + "max": "255.255.255.255", + "seed": 1, + "count": 1, + } # type: Dict[str, Union(type)] + + _STATUS = {} # type: Dict[str, Union(type)] + + def __init__( + self, parent=None, min="0.0.0.0", max="255.255.255.255", seed=1, count=1 + ): + super(PatternFlowIpv4DstRandom, self).__init__() + self._parent = parent + self._set_property("min", min) + self._set_property("max", max) + self._set_property("seed", seed) + self._set_property("count", count) + + def set(self, min=None, max=None, seed=None, count=None): + for property_name, property_value in locals().items(): + if property_name != "self" and property_value is not None: + self._set_property(property_name, property_value) + + @property + def min(self): + # type: () -> str + """min getter + + The minimum possible value generated by the random value generator. + + Returns: str + """ + return self._get_property("min") + + @min.setter + def min(self, value): + """min setter + + The minimum possible value generated by the random value generator. + + value: str + """ + self._set_property("min", value) + + @property + def max(self): + # type: () -> str + """max getter + + The maximum possible value generated by the random value generator. + + Returns: str + """ + return self._get_property("max") + + @max.setter + def max(self, value): + """max setter + + The maximum possible value generated by the random value generator. + + value: str + """ + self._set_property("max", value) + + @property + def seed(self): + # type: () -> int + """seed getter + + The seed value is used to initialize the random number generator to deterministic state. If the user provides seed value of 0, the implementation will generate sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in deterministic manner (specific to the implementation). + + Returns: int + """ + return self._get_property("seed") + + @seed.setter + def seed(self, value): + """seed setter + + The seed value is used to initialize the random number generator to deterministic state. If the user provides seed value of 0, the implementation will generate sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in deterministic manner (specific to the implementation). + + value: int + """ + self._set_property("seed", value) + + @property + def count(self): + # type: () -> int + """count getter + + The total number of values to be generated by the random value generator. + + Returns: int + """ + return self._get_property("count") + + @count.setter + def count(self, value): + """count setter + + The total number of values to be generated by the random value generator. + + value: int + """ + self._set_property("count", value) + + class FlowIpv4Options(OpenApiObject): __slots__ = ("_parent", "_choice") @@ -52312,6 +52606,7 @@ class PatternFlowIpv6FlowLabel(OpenApiObject): "values", "increment", "decrement", + "random", ], }, "value": { @@ -52328,6 +52623,7 @@ class PatternFlowIpv6FlowLabel(OpenApiObject): "increment": {"type": "PatternFlowIpv6FlowLabelCounter"}, "decrement": {"type": "PatternFlowIpv6FlowLabelCounter"}, "metric_tags": {"type": "PatternFlowIpv6FlowLabelMetricTagIter"}, + "random": {"type": "PatternFlowIpv6FlowLabelRandom"}, } # type: Dict[str, str] _REQUIRED = () # type: tuple(str) @@ -52342,6 +52638,7 @@ class PatternFlowIpv6FlowLabel(OpenApiObject): VALUES = "values" # type: str INCREMENT = "increment" # type: str DECREMENT = "decrement" # type: str + RANDOM = "random" # type: str _STATUS = {} # type: Dict[str, Union(type)] @@ -52390,14 +52687,27 @@ def decrement(self): "decrement", PatternFlowIpv6FlowLabelCounter, self, "decrement" ) + @property + def random(self): + # type: () -> PatternFlowIpv6FlowLabelRandom + """Factory property that returns an instance of the PatternFlowIpv6FlowLabelRandom class + + integer random pattern + + Returns: PatternFlowIpv6FlowLabelRandom + """ + return self._get_property( + "random", PatternFlowIpv6FlowLabelRandom, self, "random" + ) + @property def choice(self): - # type: () -> Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + # type: () -> Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """choice getter TBD - Returns: Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + Returns: Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """ return self._get_property("choice") @@ -52407,7 +52717,7 @@ def choice(self, value): TBD - value: Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + value: Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """ self._set_property("choice", value) @@ -52743,6 +53053,139 @@ def add(self, name=None, offset=0, length=20): return item +class PatternFlowIpv6FlowLabelRandom(OpenApiObject): + __slots__ = "_parent" + + _TYPES = { + "min": { + "type": int, + "format": "uint32", + "maximum": 1048575, + }, + "max": { + "type": int, + "format": "uint32", + "maximum": 1048575, + }, + "seed": { + "type": int, + "format": "uint32", + }, + "count": { + "type": int, + "format": "uint32", + }, + } # type: Dict[str, str] + + _REQUIRED = () # type: tuple(str) + + _DEFAULTS = { + "min": 0, + "max": 1048575, + "seed": 1, + "count": 1, + } # type: Dict[str, Union(type)] + + _STATUS = {} # type: Dict[str, Union(type)] + + def __init__(self, parent=None, min=0, max=1048575, seed=1, count=1): + super(PatternFlowIpv6FlowLabelRandom, self).__init__() + self._parent = parent + self._set_property("min", min) + self._set_property("max", max) + self._set_property("seed", seed) + self._set_property("count", count) + + def set(self, min=None, max=None, seed=None, count=None): + for property_name, property_value in locals().items(): + if property_name != "self" and property_value is not None: + self._set_property(property_name, property_value) + + @property + def min(self): + # type: () -> int + """min getter + + The minimum possible value generated by the random value generator. + + Returns: int + """ + return self._get_property("min") + + @min.setter + def min(self, value): + """min setter + + The minimum possible value generated by the random value generator. + + value: int + """ + self._set_property("min", value) + + @property + def max(self): + # type: () -> int + """max getter + + The maximum possible value generated by the random value generator. + + Returns: int + """ + return self._get_property("max") + + @max.setter + def max(self, value): + """max setter + + The maximum possible value generated by the random value generator. + + value: int + """ + self._set_property("max", value) + + @property + def seed(self): + # type: () -> int + """seed getter + + The seed value is used to initialize the random number generator to deterministic state. If the user provides seed value of 0, the implementation will generate sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in deterministic manner (specific to the implementation). + + Returns: int + """ + return self._get_property("seed") + + @seed.setter + def seed(self, value): + """seed setter + + The seed value is used to initialize the random number generator to deterministic state. If the user provides seed value of 0, the implementation will generate sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in deterministic manner (specific to the implementation). + + value: int + """ + self._set_property("seed", value) + + @property + def count(self): + # type: () -> int + """count getter + + The total number of values to be generated by the random value generator. + + Returns: int + """ + return self._get_property("count") + + @count.setter + def count(self, value): + """count setter + + The total number of values to be generated by the random value generator. + + value: int + """ + self._set_property("count", value) + + class PatternFlowIpv6PayloadLength(OpenApiObject): __slots__ = ("_parent", "_choice") @@ -63447,6 +63890,7 @@ class PatternFlowTcpSrcPort(OpenApiObject): "values", "increment", "decrement", + "random", ], }, "value": { @@ -63463,6 +63907,7 @@ class PatternFlowTcpSrcPort(OpenApiObject): "increment": {"type": "PatternFlowTcpSrcPortCounter"}, "decrement": {"type": "PatternFlowTcpSrcPortCounter"}, "metric_tags": {"type": "PatternFlowTcpSrcPortMetricTagIter"}, + "random": {"type": "PatternFlowTcpSrcPortRandom"}, } # type: Dict[str, str] _REQUIRED = () # type: tuple(str) @@ -63477,6 +63922,7 @@ class PatternFlowTcpSrcPort(OpenApiObject): VALUES = "values" # type: str INCREMENT = "increment" # type: str DECREMENT = "decrement" # type: str + RANDOM = "random" # type: str _STATUS = {} # type: Dict[str, Union(type)] @@ -63525,14 +63971,25 @@ def decrement(self): "decrement", PatternFlowTcpSrcPortCounter, self, "decrement" ) + @property + def random(self): + # type: () -> PatternFlowTcpSrcPortRandom + """Factory property that returns an instance of the PatternFlowTcpSrcPortRandom class + + integer random pattern + + Returns: PatternFlowTcpSrcPortRandom + """ + return self._get_property("random", PatternFlowTcpSrcPortRandom, self, "random") + @property def choice(self): - # type: () -> Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + # type: () -> Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """choice getter TBD - Returns: Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + Returns: Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """ return self._get_property("choice") @@ -63542,7 +63999,7 @@ def choice(self, value): TBD - value: Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + value: Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """ self._set_property("choice", value) @@ -63876,6 +64333,139 @@ def add(self, name=None, offset=0, length=16): return item +class PatternFlowTcpSrcPortRandom(OpenApiObject): + __slots__ = "_parent" + + _TYPES = { + "min": { + "type": int, + "format": "uint32", + "maximum": 65535, + }, + "max": { + "type": int, + "format": "uint32", + "maximum": 65535, + }, + "seed": { + "type": int, + "format": "uint32", + }, + "count": { + "type": int, + "format": "uint32", + }, + } # type: Dict[str, str] + + _REQUIRED = () # type: tuple(str) + + _DEFAULTS = { + "min": 0, + "max": 65535, + "seed": 1, + "count": 1, + } # type: Dict[str, Union(type)] + + _STATUS = {} # type: Dict[str, Union(type)] + + def __init__(self, parent=None, min=0, max=65535, seed=1, count=1): + super(PatternFlowTcpSrcPortRandom, self).__init__() + self._parent = parent + self._set_property("min", min) + self._set_property("max", max) + self._set_property("seed", seed) + self._set_property("count", count) + + def set(self, min=None, max=None, seed=None, count=None): + for property_name, property_value in locals().items(): + if property_name != "self" and property_value is not None: + self._set_property(property_name, property_value) + + @property + def min(self): + # type: () -> int + """min getter + + The minimum possible value generated by the random value generator. + + Returns: int + """ + return self._get_property("min") + + @min.setter + def min(self, value): + """min setter + + The minimum possible value generated by the random value generator. + + value: int + """ + self._set_property("min", value) + + @property + def max(self): + # type: () -> int + """max getter + + The maximum possible value generated by the random value generator. + + Returns: int + """ + return self._get_property("max") + + @max.setter + def max(self, value): + """max setter + + The maximum possible value generated by the random value generator. + + value: int + """ + self._set_property("max", value) + + @property + def seed(self): + # type: () -> int + """seed getter + + The seed value is used to initialize the random number generator to deterministic state. If the user provides seed value of 0, the implementation will generate sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in deterministic manner (specific to the implementation). + + Returns: int + """ + return self._get_property("seed") + + @seed.setter + def seed(self, value): + """seed setter + + The seed value is used to initialize the random number generator to deterministic state. If the user provides seed value of 0, the implementation will generate sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in deterministic manner (specific to the implementation). + + value: int + """ + self._set_property("seed", value) + + @property + def count(self): + # type: () -> int + """count getter + + The total number of values to be generated by the random value generator. + + Returns: int + """ + return self._get_property("count") + + @count.setter + def count(self, value): + """count setter + + The total number of values to be generated by the random value generator. + + value: int + """ + self._set_property("count", value) + + class PatternFlowTcpDstPort(OpenApiObject): __slots__ = ("_parent", "_choice") @@ -63887,6 +64477,7 @@ class PatternFlowTcpDstPort(OpenApiObject): "values", "increment", "decrement", + "random", ], }, "value": { @@ -63903,6 +64494,7 @@ class PatternFlowTcpDstPort(OpenApiObject): "increment": {"type": "PatternFlowTcpDstPortCounter"}, "decrement": {"type": "PatternFlowTcpDstPortCounter"}, "metric_tags": {"type": "PatternFlowTcpDstPortMetricTagIter"}, + "random": {"type": "PatternFlowTcpDstPortRandom"}, } # type: Dict[str, str] _REQUIRED = () # type: tuple(str) @@ -63917,6 +64509,7 @@ class PatternFlowTcpDstPort(OpenApiObject): VALUES = "values" # type: str INCREMENT = "increment" # type: str DECREMENT = "decrement" # type: str + RANDOM = "random" # type: str _STATUS = {} # type: Dict[str, Union(type)] @@ -63965,14 +64558,25 @@ def decrement(self): "decrement", PatternFlowTcpDstPortCounter, self, "decrement" ) + @property + def random(self): + # type: () -> PatternFlowTcpDstPortRandom + """Factory property that returns an instance of the PatternFlowTcpDstPortRandom class + + integer random pattern + + Returns: PatternFlowTcpDstPortRandom + """ + return self._get_property("random", PatternFlowTcpDstPortRandom, self, "random") + @property def choice(self): - # type: () -> Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + # type: () -> Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """choice getter TBD - Returns: Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + Returns: Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """ return self._get_property("choice") @@ -63982,7 +64586,7 @@ def choice(self, value): TBD - value: Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + value: Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """ self._set_property("choice", value) @@ -64316,6 +64920,139 @@ def add(self, name=None, offset=0, length=16): return item +class PatternFlowTcpDstPortRandom(OpenApiObject): + __slots__ = "_parent" + + _TYPES = { + "min": { + "type": int, + "format": "uint32", + "maximum": 65535, + }, + "max": { + "type": int, + "format": "uint32", + "maximum": 65535, + }, + "seed": { + "type": int, + "format": "uint32", + }, + "count": { + "type": int, + "format": "uint32", + }, + } # type: Dict[str, str] + + _REQUIRED = () # type: tuple(str) + + _DEFAULTS = { + "min": 0, + "max": 65535, + "seed": 1, + "count": 1, + } # type: Dict[str, Union(type)] + + _STATUS = {} # type: Dict[str, Union(type)] + + def __init__(self, parent=None, min=0, max=65535, seed=1, count=1): + super(PatternFlowTcpDstPortRandom, self).__init__() + self._parent = parent + self._set_property("min", min) + self._set_property("max", max) + self._set_property("seed", seed) + self._set_property("count", count) + + def set(self, min=None, max=None, seed=None, count=None): + for property_name, property_value in locals().items(): + if property_name != "self" and property_value is not None: + self._set_property(property_name, property_value) + + @property + def min(self): + # type: () -> int + """min getter + + The minimum possible value generated by the random value generator. + + Returns: int + """ + return self._get_property("min") + + @min.setter + def min(self, value): + """min setter + + The minimum possible value generated by the random value generator. + + value: int + """ + self._set_property("min", value) + + @property + def max(self): + # type: () -> int + """max getter + + The maximum possible value generated by the random value generator. + + Returns: int + """ + return self._get_property("max") + + @max.setter + def max(self, value): + """max setter + + The maximum possible value generated by the random value generator. + + value: int + """ + self._set_property("max", value) + + @property + def seed(self): + # type: () -> int + """seed getter + + The seed value is used to initialize the random number generator to deterministic state. If the user provides seed value of 0, the implementation will generate sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in deterministic manner (specific to the implementation). + + Returns: int + """ + return self._get_property("seed") + + @seed.setter + def seed(self, value): + """seed setter + + The seed value is used to initialize the random number generator to deterministic state. If the user provides seed value of 0, the implementation will generate sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in deterministic manner (specific to the implementation). + + value: int + """ + self._set_property("seed", value) + + @property + def count(self): + # type: () -> int + """count getter + + The total number of values to be generated by the random value generator. + + Returns: int + """ + return self._get_property("count") + + @count.setter + def count(self, value): + """count setter + + The total number of values to be generated by the random value generator. + + value: int + """ + self._set_property("count", value) + + class PatternFlowTcpSeqNum(OpenApiObject): __slots__ = ("_parent", "_choice") @@ -70194,6 +70931,7 @@ class PatternFlowUdpSrcPort(OpenApiObject): "values", "increment", "decrement", + "random", ], }, "value": { @@ -70210,6 +70948,7 @@ class PatternFlowUdpSrcPort(OpenApiObject): "increment": {"type": "PatternFlowUdpSrcPortCounter"}, "decrement": {"type": "PatternFlowUdpSrcPortCounter"}, "metric_tags": {"type": "PatternFlowUdpSrcPortMetricTagIter"}, + "random": {"type": "PatternFlowUdpSrcPortRandom"}, } # type: Dict[str, str] _REQUIRED = () # type: tuple(str) @@ -70224,6 +70963,7 @@ class PatternFlowUdpSrcPort(OpenApiObject): VALUES = "values" # type: str INCREMENT = "increment" # type: str DECREMENT = "decrement" # type: str + RANDOM = "random" # type: str _STATUS = {} # type: Dict[str, Union(type)] @@ -70272,14 +71012,25 @@ def decrement(self): "decrement", PatternFlowUdpSrcPortCounter, self, "decrement" ) + @property + def random(self): + # type: () -> PatternFlowUdpSrcPortRandom + """Factory property that returns an instance of the PatternFlowUdpSrcPortRandom class + + integer random pattern + + Returns: PatternFlowUdpSrcPortRandom + """ + return self._get_property("random", PatternFlowUdpSrcPortRandom, self, "random") + @property def choice(self): - # type: () -> Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + # type: () -> Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """choice getter TBD - Returns: Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + Returns: Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """ return self._get_property("choice") @@ -70289,7 +71040,7 @@ def choice(self, value): TBD - value: Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + value: Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """ self._set_property("choice", value) @@ -70623,6 +71374,139 @@ def add(self, name=None, offset=0, length=16): return item +class PatternFlowUdpSrcPortRandom(OpenApiObject): + __slots__ = "_parent" + + _TYPES = { + "min": { + "type": int, + "format": "uint32", + "maximum": 65535, + }, + "max": { + "type": int, + "format": "uint32", + "maximum": 65535, + }, + "seed": { + "type": int, + "format": "uint32", + }, + "count": { + "type": int, + "format": "uint32", + }, + } # type: Dict[str, str] + + _REQUIRED = () # type: tuple(str) + + _DEFAULTS = { + "min": 0, + "max": 65535, + "seed": 1, + "count": 1, + } # type: Dict[str, Union(type)] + + _STATUS = {} # type: Dict[str, Union(type)] + + def __init__(self, parent=None, min=0, max=65535, seed=1, count=1): + super(PatternFlowUdpSrcPortRandom, self).__init__() + self._parent = parent + self._set_property("min", min) + self._set_property("max", max) + self._set_property("seed", seed) + self._set_property("count", count) + + def set(self, min=None, max=None, seed=None, count=None): + for property_name, property_value in locals().items(): + if property_name != "self" and property_value is not None: + self._set_property(property_name, property_value) + + @property + def min(self): + # type: () -> int + """min getter + + The minimum possible value generated by the random value generator. + + Returns: int + """ + return self._get_property("min") + + @min.setter + def min(self, value): + """min setter + + The minimum possible value generated by the random value generator. + + value: int + """ + self._set_property("min", value) + + @property + def max(self): + # type: () -> int + """max getter + + The maximum possible value generated by the random value generator. + + Returns: int + """ + return self._get_property("max") + + @max.setter + def max(self, value): + """max setter + + The maximum possible value generated by the random value generator. + + value: int + """ + self._set_property("max", value) + + @property + def seed(self): + # type: () -> int + """seed getter + + The seed value is used to initialize the random number generator to deterministic state. If the user provides seed value of 0, the implementation will generate sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in deterministic manner (specific to the implementation). + + Returns: int + """ + return self._get_property("seed") + + @seed.setter + def seed(self, value): + """seed setter + + The seed value is used to initialize the random number generator to deterministic state. If the user provides seed value of 0, the implementation will generate sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in deterministic manner (specific to the implementation). + + value: int + """ + self._set_property("seed", value) + + @property + def count(self): + # type: () -> int + """count getter + + The total number of values to be generated by the random value generator. + + Returns: int + """ + return self._get_property("count") + + @count.setter + def count(self, value): + """count setter + + The total number of values to be generated by the random value generator. + + value: int + """ + self._set_property("count", value) + + class PatternFlowUdpDstPort(OpenApiObject): __slots__ = ("_parent", "_choice") @@ -70634,6 +71518,7 @@ class PatternFlowUdpDstPort(OpenApiObject): "values", "increment", "decrement", + "random", ], }, "value": { @@ -70650,6 +71535,7 @@ class PatternFlowUdpDstPort(OpenApiObject): "increment": {"type": "PatternFlowUdpDstPortCounter"}, "decrement": {"type": "PatternFlowUdpDstPortCounter"}, "metric_tags": {"type": "PatternFlowUdpDstPortMetricTagIter"}, + "random": {"type": "PatternFlowUdpDstPortRandom"}, } # type: Dict[str, str] _REQUIRED = () # type: tuple(str) @@ -70664,6 +71550,7 @@ class PatternFlowUdpDstPort(OpenApiObject): VALUES = "values" # type: str INCREMENT = "increment" # type: str DECREMENT = "decrement" # type: str + RANDOM = "random" # type: str _STATUS = {} # type: Dict[str, Union(type)] @@ -70712,14 +71599,25 @@ def decrement(self): "decrement", PatternFlowUdpDstPortCounter, self, "decrement" ) + @property + def random(self): + # type: () -> PatternFlowUdpDstPortRandom + """Factory property that returns an instance of the PatternFlowUdpDstPortRandom class + + integer random pattern + + Returns: PatternFlowUdpDstPortRandom + """ + return self._get_property("random", PatternFlowUdpDstPortRandom, self, "random") + @property def choice(self): - # type: () -> Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + # type: () -> Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """choice getter TBD - Returns: Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + Returns: Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """ return self._get_property("choice") @@ -70729,7 +71627,7 @@ def choice(self, value): TBD - value: Union[Literal["decrement"], Literal["increment"], Literal["value"], Literal["values"]] + value: Union[Literal["decrement"], Literal["increment"], Literal["random"], Literal["value"], Literal["values"]] """ self._set_property("choice", value) @@ -71063,6 +71961,139 @@ def add(self, name=None, offset=0, length=16): return item +class PatternFlowUdpDstPortRandom(OpenApiObject): + __slots__ = "_parent" + + _TYPES = { + "min": { + "type": int, + "format": "uint32", + "maximum": 65535, + }, + "max": { + "type": int, + "format": "uint32", + "maximum": 65535, + }, + "seed": { + "type": int, + "format": "uint32", + }, + "count": { + "type": int, + "format": "uint32", + }, + } # type: Dict[str, str] + + _REQUIRED = () # type: tuple(str) + + _DEFAULTS = { + "min": 0, + "max": 65535, + "seed": 1, + "count": 1, + } # type: Dict[str, Union(type)] + + _STATUS = {} # type: Dict[str, Union(type)] + + def __init__(self, parent=None, min=0, max=65535, seed=1, count=1): + super(PatternFlowUdpDstPortRandom, self).__init__() + self._parent = parent + self._set_property("min", min) + self._set_property("max", max) + self._set_property("seed", seed) + self._set_property("count", count) + + def set(self, min=None, max=None, seed=None, count=None): + for property_name, property_value in locals().items(): + if property_name != "self" and property_value is not None: + self._set_property(property_name, property_value) + + @property + def min(self): + # type: () -> int + """min getter + + The minimum possible value generated by the random value generator. + + Returns: int + """ + return self._get_property("min") + + @min.setter + def min(self, value): + """min setter + + The minimum possible value generated by the random value generator. + + value: int + """ + self._set_property("min", value) + + @property + def max(self): + # type: () -> int + """max getter + + The maximum possible value generated by the random value generator. + + Returns: int + """ + return self._get_property("max") + + @max.setter + def max(self, value): + """max setter + + The maximum possible value generated by the random value generator. + + value: int + """ + self._set_property("max", value) + + @property + def seed(self): + # type: () -> int + """seed getter + + The seed value is used to initialize the random number generator to deterministic state. If the user provides seed value of 0, the implementation will generate sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in deterministic manner (specific to the implementation). + + Returns: int + """ + return self._get_property("seed") + + @seed.setter + def seed(self, value): + """seed setter + + The seed value is used to initialize the random number generator to deterministic state. If the user provides seed value of 0, the implementation will generate sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in deterministic manner (specific to the implementation). + + value: int + """ + self._set_property("seed", value) + + @property + def count(self): + # type: () -> int + """count getter + + The total number of values to be generated by the random value generator. + + Returns: int + """ + return self._get_property("count") + + @count.setter + def count(self, value): + """count setter + + The total number of values to be generated by the random value generator. + + value: int + """ + self._set_property("count", value) + + class PatternFlowUdpLength(OpenApiObject): __slots__ = ("_parent", "_choice") @@ -141561,8 +142592,8 @@ class Api(object): def __init__(self, **kwargs): self._version_meta = self.version() - self._version_meta.api_spec_version = "1.6.2" - self._version_meta.sdk_version = "1.6.2" + self._version_meta.api_spec_version = "1.7.0" + self._version_meta.sdk_version = "1.7.0" self._version_check = kwargs.get("version_check") if self._version_check is None: self._version_check = False From 556a7458bae225c7aa8f776b70bdc36da5af3d68 Mon Sep 17 00:00:00 2001 From: Apratim Mukherjee <78898747+apratimmukherjee@users.noreply.github.com> Date: Wed, 24 Jul 2024 19:08:59 +0530 Subject: [PATCH 05/10] v1.7.1 1.7.0 actions failed in publish stage due to server error ( bad build not containing all the artifacts ) . Trying again with updated tag to overcome this. --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 5c1d80a5..2b0d6fc2 100644 --- a/version.py +++ b/version.py @@ -3,7 +3,7 @@ class Version: models_version = "1.7.0" - version = "1.7.0" + version = "1.7.1" package_name = "snappi" protobuf_name = "otg" go_package_name = "gosnappi" From 3f707674b67754dfaa029c2b6b98520edd81a107 Mon Sep 17 00:00:00 2001 From: Github Actions Bot Date: Wed, 24 Jul 2024 13:42:57 +0000 Subject: [PATCH 06/10] Update auto generated go snappi --- gosnappi/gosnappi.go | 84 ++++++++++++++++++++++---------------------- requirements.txt | 10 +++--- snappi/snappi.py | 2 +- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/gosnappi/gosnappi.go b/gosnappi/gosnappi.go index 6e422917..415a9a30 100644 --- a/gosnappi/gosnappi.go +++ b/gosnappi/gosnappi.go @@ -250,7 +250,7 @@ type Api interface { func (api *gosnappiApi) GetLocalVersion() Version { if api.versionMeta.localVersion == nil { - api.versionMeta.localVersion = NewVersion().SetApiSpecVersion("1.7.0").SetSdkVersion("1.7.0") + api.versionMeta.localVersion = NewVersion().SetApiSpecVersion("1.7.0").SetSdkVersion("1.7.1") } return api.versionMeta.localVersion @@ -23425,10 +23425,10 @@ type MetricsResponse interface { setChoice(value MetricsResponseChoiceEnum) MetricsResponse // HasChoice checks if Choice has been set in MetricsResponse HasChoice() bool - // getter for Dhcpv4Client to set choice. - Dhcpv4Client() // getter for Dhcpv4Server to set choice. Dhcpv4Server() + // getter for Dhcpv4Client to set choice. + Dhcpv4Client() // PortMetrics returns MetricsResponsePortMetricIterIter, set in MetricsResponse PortMetrics() MetricsResponsePortMetricIter // FlowMetrics returns MetricsResponseFlowMetricIterIter, set in MetricsResponse @@ -23487,16 +23487,16 @@ func (obj *metricsResponse) Choice() MetricsResponseChoiceEnum { return MetricsResponseChoiceEnum(obj.obj.Choice.Enum().String()) } -// 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) } +// getter for Dhcpv4Client to set choice +func (obj *metricsResponse) Dhcpv4Client() { + obj.setChoice(MetricsResponseChoice.DHCPV4_CLIENT) +} + // description is TBD // Choice returns a string func (obj *metricsResponse) HasChoice() bool { @@ -403900,16 +403900,16 @@ type BgpAttributesCommunity interface { Choice() BgpAttributesCommunityChoiceEnum // setChoice assigns BgpAttributesCommunityChoiceEnum provided by user to BgpAttributesCommunity setChoice(value BgpAttributesCommunityChoiceEnum) BgpAttributesCommunity - // getter for NoLlgr to set choice. - NoLlgr() // 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 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 @@ -403944,31 +403944,31 @@ func (obj *bgpAttributesCommunity) Choice() BgpAttributesCommunityChoiceEnum { return BgpAttributesCommunityChoiceEnum(obj.obj.Choice.Enum().String()) } -// 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 NoExportSubconfed to set choice +func (obj *bgpAttributesCommunity) NoExportSubconfed() { + obj.setChoice(BgpAttributesCommunityChoice.NO_EXPORT_SUBCONFED) +} + // getter for NoAdvertised to set choice func (obj *bgpAttributesCommunity) NoAdvertised() { obj.setChoice(BgpAttributesCommunityChoice.NO_ADVERTISED) } +// getter for NoLlgr to set choice +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 { intValue, ok := otg.BgpAttributesCommunity_Choice_Enum_value[string(value)] if !ok { @@ -426246,16 +426246,16 @@ type BgpAttributesSrPolicyExplicitNullPolicy interface { setChoice(value BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum) BgpAttributesSrPolicyExplicitNullPolicy // HasChoice checks if Choice has been set in BgpAttributesSrPolicyExplicitNullPolicy HasChoice() bool - // getter for PushIpv4 to set choice. - PushIpv4() - // getter for DonotPush to set choice. - DonotPush() - // getter for Unknown to set choice. - Unknown() - // getter for PushIpv4AndIpv6 to set choice. - PushIpv4AndIpv6() // getter for PushIpv6 to set choice. PushIpv6() + // getter for PushIpv4AndIpv6 to set choice. + PushIpv4AndIpv6() + // getter for Unknown to set choice. + Unknown() + // getter for DonotPush to set choice. + DonotPush() + // getter for PushIpv4 to set choice. + PushIpv4() } type BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum string @@ -426279,14 +426279,14 @@ func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Choice() BgpAttributesSrPoli return BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum(obj.obj.Choice.Enum().String()) } -// 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 @@ -426294,14 +426294,14 @@ func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Unknown() { obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.UNKNOWN) } -// getter for PushIpv4AndIpv6 to set choice -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) PushIpv4AndIpv6() { - obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV4_AND_IPV6) +// 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) +// getter for PushIpv4 to set choice +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) PushIpv4() { + obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV4) } // The Explicit NULL Label policy. diff --git a/requirements.txt b/requirements.txt index 384eded8..657af094 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,11 @@ --prefer-binary protobuf~=4.24.4 ; python_version > '3.6' protobuf~=3.15.0 ; python_version <= '3.6' -PyYAML -grpcio~=1.59.0 ; python_version > '3.6' -grpcio-tools~=1.59.0 ; python_version > '3.6' +requests 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' -requests -urllib3 +PyYAML semantic_version +urllib3 diff --git a/snappi/snappi.py b/snappi/snappi.py index a73c8160..6a9c8b44 100644 --- a/snappi/snappi.py +++ b/snappi/snappi.py @@ -142593,7 +142593,7 @@ class Api(object): def __init__(self, **kwargs): self._version_meta = self.version() self._version_meta.api_spec_version = "1.7.0" - self._version_meta.sdk_version = "1.7.0" + self._version_meta.sdk_version = "1.7.1" self._version_check = kwargs.get("version_check") if self._version_check is None: self._version_check = False From 1e241eb0f7a173ed048b079860d2b4ff48d012a2 Mon Sep 17 00:00:00 2001 From: Apratim Mukherjee <78898747+apratimmukherjee@users.noreply.github.com> Date: Fri, 26 Jul 2024 11:28:43 +0530 Subject: [PATCH 07/10] ope gosnappi split changes --- dev-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index e763b066..f8e9ab77 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,3 +1,3 @@ --prefer-binary requests -openapiart==0.3.16 +openapiart==0.3.17 From 759f172a9af215ca716dc773b72914923082f68d Mon Sep 17 00:00:00 2001 From: Github Actions Bot Date: Fri, 26 Jul 2024 06:11:32 +0000 Subject: [PATCH 08/10] Update auto generated go snappi --- gosnappi/action_protocol.go | 499 + gosnappi/action_protocol_bgp.go | 443 + ..._protocol_bgp_initiate_graceful_restart.go | 361 + gosnappi/action_protocol_bgp_notification.go | 771 + gosnappi/action_protocol_ipv4.go | 387 + gosnappi/action_protocol_ipv4_ping.go | 390 + gosnappi/action_protocol_ipv4_ping_request.go | 371 + gosnappi/action_protocol_ipv6.go | 387 + gosnappi/action_protocol_ipv6_ping.go | 390 + gosnappi/action_protocol_ipv6_ping_request.go | 371 + gosnappi/action_response.go | 387 + gosnappi/action_response_protocol.go | 443 + gosnappi/action_response_protocol_ipv4.go | 387 + .../action_response_protocol_ipv4_ping.go | 390 + ...on_response_protocol_ipv4_ping_response.go | 386 + gosnappi/action_response_protocol_ipv6.go | 387 + .../action_response_protocol_ipv6_ping.go | 390 + ...on_response_protocol_ipv6_ping_response.go | 386 + gosnappi/bgp_add_path.go | 309 + gosnappi/bgp_advanced.go | 559 + gosnappi/bgp_as_path.go | 442 + gosnappi/bgp_as_path_segment.go | 352 + gosnappi/bgp_attributes.go | 1276 + gosnappi/bgp_attributes_aggregator.go | 478 + gosnappi/bgp_attributes_as4_aggregator.go | 349 + gosnappi/bgp_attributes_as4_path.go | 400 + gosnappi/bgp_attributes_as_path.go | 465 + ...gp_attributes_as_path_four_byte_as_path.go | 390 + ...bgp_attributes_as_path_two_byte_as_path.go | 392 + gosnappi/bgp_attributes_bsid.go | 453 + gosnappi/bgp_attributes_bsid_mpls.go | 399 + gosnappi/bgp_attributes_bsid_srv6.go | 387 + gosnappi/bgp_attributes_community.go | 434 + gosnappi/bgp_attributes_custom_community.go | 362 + ...gp_attributes_four_byte_as_path_segment.go | 361 + gosnappi/bgp_attributes_local_preference.go | 312 + gosnappi/bgp_attributes_mp_reach_nlri.go | 727 + gosnappi/bgp_attributes_mp_unreach_nlri.go | 687 + ...bgp_attributes_multi_exit_discriminator.go | 309 + gosnappi/bgp_attributes_next_hop.go | 504 + ..._attributes_next_hop_ipv6_two_addresses.go | 359 + gosnappi/bgp_attributes_originator_id.go | 318 + gosnappi/bgp_attributes_other_attribute.go | 462 + .../bgp_attributes_segment_routing_policy.go | 786 + ...rv6_sid_endpoint_behavior_and_structure.go | 494 + ...ent_routing_policy_segment_list_segment.go | 972 + ...ment_routing_policy_segment_list_weight.go | 309 + ...ttributes_segment_routing_policy_type_a.go | 384 + ...ttributes_segment_routing_policy_type_b.go | 422 + ...ttributes_segment_routing_policy_type_c.go | 465 + ...ttributes_segment_routing_policy_type_d.go | 465 + ...ttributes_segment_routing_policy_type_e.go | 455 + ...ttributes_segment_routing_policy_type_f.go | 464 + ...butes_segment_routing_policy_type_flags.go | 410 + ...ttributes_segment_routing_policy_type_g.go | 526 + ...ttributes_segment_routing_policy_type_h.go | 464 + ...ttributes_segment_routing_policy_type_i.go | 506 + ...ttributes_segment_routing_policy_type_j.go | 608 + ...ttributes_segment_routing_policy_type_k.go | 546 + gosnappi/bgp_attributes_sid_mpls.go | 433 + gosnappi/bgp_attributes_sid_srv6.go | 318 + ...tributes_sr_policy_explicit_null_policy.go | 380 + ...ributes_sr_policy_policy_candidate_name.go | 318 + .../bgp_attributes_sr_policy_policy_name.go | 318 + .../bgp_attributes_sr_policy_preference.go | 311 + gosnappi/bgp_attributes_sr_policy_priority.go | 320 + .../bgp_attributes_sr_policy_segment_list.go | 437 + gosnappi/bgp_attributes_srv6_bsid.go | 474 + .../bgp_attributes_tunnel_encapsulation.go | 399 + ...bgp_attributes_two_byte_as_path_segment.go | 374 + gosnappi/bgp_c_mac_ip_range.go | 851 + gosnappi/bgp_capability.go | 1065 + gosnappi/bgp_community.go | 408 + gosnappi/bgp_ethernet_segment_df_election.go | 319 + gosnappi/bgp_ext_community.go | 423 + gosnappi/bgp_extended_community.go | 732 + .../bgp_extended_community_custom_type.go | 407 + ...community_non_transitive2_octet_as_type.go | 396 + ...ransitive2_octet_as_type_link_bandwidth.go | 350 + ...ded_community_transitive2_octet_as_type.go | 452 + ..._transitive2_octet_as_type_route_origin.go | 350 + ..._transitive2_octet_as_type_route_target.go | 350 + ...ded_community_transitive4_octet_as_type.go | 452 + ..._transitive4_octet_as_type_route_origin.go | 350 + ..._transitive4_octet_as_type_route_target.go | 350 + ...extended_community_transitive_evpn_type.go | 396 + ...mmunity_transitive_evpn_type_router_mac.go | 318 + ..._community_transitive_ipv4_address_type.go | 452 + ...ansitive_ipv4_address_type_route_origin.go | 359 + ...ansitive_ipv4_address_type_route_target.go | 359 + ...tended_community_transitive_opaque_type.go | 452 + ..._community_transitive_opaque_type_color.go | 350 + ...ty_transitive_opaque_type_encapsulation.go | 371 + gosnappi/bgp_graceful_restart.go | 437 + gosnappi/bgp_ipv4_sr_policy_nlri_prefix.go | 380 + gosnappi/bgp_ipv6_sr_policy_nlri_prefix.go | 380 + gosnappi/bgp_learned_information_filter.go | 340 + gosnappi/bgp_nlri_prefix_path_id.go | 309 + gosnappi/bgp_one_ipv4_nlri_prefix.go | 409 + gosnappi/bgp_one_ipv6_nlri_prefix.go | 409 + gosnappi/bgp_one_structured_update_replay.go | 494 + gosnappi/bgp_one_traditional_nlri_prefix.go | 410 + gosnappi/bgp_one_update_replay.go | 345 + gosnappi/bgp_prefix_ipv4_unicast_filter.go | 420 + gosnappi/bgp_prefix_ipv4_unicast_state.go | 804 + gosnappi/bgp_prefix_ipv6_unicast_filter.go | 420 + gosnappi/bgp_prefix_ipv6_unicast_state.go | 804 + gosnappi/bgp_prefix_state_request.go | 574 + gosnappi/bgp_prefixes_state.go | 523 + gosnappi/bgp_raw_bytes.go | 390 + gosnappi/bgp_route_advanced.go | 476 + gosnappi/bgp_route_distinguisher.go | 386 + gosnappi/bgp_route_target.go | 351 + gosnappi/bgp_srte_binding_sub_tlv.go | 451 + gosnappi/bgp_srte_color_sub_tlv.go | 315 + ...srte_explicit_null_label_policy_sub_tlv.go | 328 + gosnappi/bgp_srte_policy_name_sub_tlv.go | 318 + gosnappi/bgp_srte_policy_priority_sub_tlv.go | 316 + gosnappi/bgp_srte_preference_sub_tlv.go | 309 + gosnappi/bgp_srte_remote_endpoint_sub_tlv.go | 433 + ...rv6_sid_endpoint_behavior_and_structure.go | 442 + gosnappi/bgp_srte_segment.go | 868 + gosnappi/bgp_srte_segment_a_type_sub_tlv.go | 457 + gosnappi/bgp_srte_segment_b_type_sub_tlv.go | 398 + gosnappi/bgp_srte_segment_c_type_sub_tlv.go | 439 + gosnappi/bgp_srte_segment_d_type_sub_tlv.go | 439 + gosnappi/bgp_srte_segment_e_type_sub_tlv.go | 429 + gosnappi/bgp_srte_segment_f_type_sub_tlv.go | 431 + gosnappi/bgp_srte_segment_g_type_sub_tlv.go | 493 + gosnappi/bgp_srte_segment_h_type_sub_tlv.go | 431 + gosnappi/bgp_srte_segment_i_type_sub_tlv.go | 435 + gosnappi/bgp_srte_segment_j_type_sub_tlv.go | 561 + gosnappi/bgp_srte_segment_k_type_sub_tlv.go | 499 + gosnappi/bgp_srte_segment_list.go | 476 + gosnappi/bgp_srte_sr_mpls_sid.go | 420 + gosnappi/bgp_srte_v4_policy.go | 1043 + gosnappi/bgp_srte_v4_tunnel_tlv.go | 746 + gosnappi/bgp_srte_v6_policy.go | 1048 + gosnappi/bgp_srte_v6_tunnel_tlv.go | 746 + gosnappi/bgp_structured_pdus.go | 390 + gosnappi/bgp_update_replay.go | 452 + gosnappi/bgp_v4_ethernet_segment.go | 856 + gosnappi/bgp_v4_evi_vxlan.go | 1054 + gosnappi/bgp_v4_evi_vxlan_broadcast_domain.go | 455 + gosnappi/bgp_v4_evpn_evis.go | 410 + gosnappi/bgp_v4_interface.go | 437 + gosnappi/bgp_v4_peer.go | 1205 + gosnappi/bgp_v4_route_range.go | 1036 + gosnappi/bgp_v6_ethernet_segment.go | 856 + gosnappi/bgp_v6_evi_vxlan.go | 1054 + gosnappi/bgp_v6_evi_vxlan_broadcast_domain.go | 455 + gosnappi/bgp_v6_evpn_evis.go | 410 + gosnappi/bgp_v6_interface.go | 437 + gosnappi/bgp_v6_peer.go | 1248 + gosnappi/bgp_v6_route_range.go | 1036 + gosnappi/bgp_v6_segment_routing.go | 536 + gosnappi/bgpv4_metric.go | 786 + gosnappi/bgpv4_metrics_request.go | 381 + gosnappi/bgpv6_metric.go | 786 + gosnappi/bgpv6_metrics_request.go | 381 + gosnappi/capture.go | 573 + gosnappi/capture_custom.go | 448 + gosnappi/capture_ethernet.go | 457 + gosnappi/capture_field.go | 389 + gosnappi/capture_filter.go | 620 + gosnappi/capture_ipv4.go | 887 + gosnappi/capture_ipv6.go | 629 + gosnappi/capture_request.go | 316 + gosnappi/capture_vlan.go | 457 + gosnappi/config.go | 1110 + gosnappi/config_options.go | 371 + gosnappi/config_update.go | 390 + gosnappi/control_action.go | 387 + gosnappi/control_action_response.go | 353 + gosnappi/control_state.go | 499 + gosnappi/device.go | 840 + gosnappi/device_bgp_cease_error.go | 336 + gosnappi/device_bgp_custom_error.go | 334 + .../device_bgp_finite_state_machine_error.go | 278 + gosnappi/device_bgp_hold_timer_expired.go | 278 + gosnappi/device_bgp_message_header_error.go | 324 + gosnappi/device_bgp_open_message_error.go | 332 + gosnappi/device_bgp_router.go | 528 + gosnappi/device_bgp_update_message_error.go | 340 + gosnappi/device_dhcp_server.go | 390 + gosnappi/device_dhcpv4_client.go | 501 + gosnappi/device_ethernet.go | 848 + gosnappi/device_ethernet_base.go | 488 + gosnappi/device_ipv4.go | 463 + gosnappi/device_ipv4_gateway_mac.go | 433 + gosnappi/device_ipv4_loopback.go | 381 + gosnappi/device_ipv6.go | 463 + gosnappi/device_ipv6_gateway_mac.go | 433 + gosnappi/device_ipv6_loopback.go | 383 + gosnappi/device_isis_multi_instance.go | 357 + gosnappi/device_isis_router.go | 829 + gosnappi/device_rsvp.go | 523 + gosnappi/device_vlan.go | 434 + gosnappi/device_vxlan.go | 495 + gosnappi/dhcp_server_v4.go | 454 + gosnappi/dhcp_server_v4_pool.go | 553 + gosnappi/dhcp_server_v4_pool_option.go | 429 + gosnappi/dhcpv4_client_metric.go | 502 + gosnappi/dhcpv4_client_metrics_request.go | 363 + gosnappi/dhcpv4_client_params.go | 402 + gosnappi/dhcpv4_interface_state.go | 484 + gosnappi/dhcpv4_interface_state_request.go | 317 + gosnappi/dhcpv4_lease_state.go | 502 + gosnappi/dhcpv4_lease_state_request.go | 317 + gosnappi/dhcpv4_leases_state.go | 418 + gosnappi/dhcpv4_server_metric.go | 502 + gosnappi/dhcpv4_server_metrics_request.go | 363 + gosnappi/error.go | 386 + gosnappi/ethernet_connection.go | 515 + gosnappi/event.go | 451 + gosnappi/event_link.go | 309 + gosnappi/event_route_advertise_withdraw.go | 312 + gosnappi/event_rx_rate_threshold.go | 359 + gosnappi/flow.go | 679 + gosnappi/flow_arp.go | 672 + gosnappi/flow_burst.go | 436 + gosnappi/flow_continuous.go | 361 + gosnappi/flow_custom.go | 417 + gosnappi/flow_custom_metric_tag.go | 382 + gosnappi/flow_delay.go | 508 + gosnappi/flow_duration.go | 568 + gosnappi/flow_duration_inter_burst_gap.go | 507 + gosnappi/flow_ethernet.go | 457 + gosnappi/flow_ethernet_pause.go | 500 + gosnappi/flow_fixed_packets.go | 402 + gosnappi/flow_fixed_seconds.go | 402 + gosnappi/flow_gre.go | 543 + gosnappi/flow_gtp_extension.go | 414 + gosnappi/flow_gtpv1.go | 906 + gosnappi/flow_gtpv2.go | 672 + gosnappi/flow_header.go | 1515 + gosnappi/flow_icmp.go | 396 + gosnappi/flow_icmp_echo.go | 500 + gosnappi/flow_icmpv6.go | 396 + gosnappi/flow_icmpv6_echo.go | 500 + gosnappi/flow_igmpv1.go | 500 + gosnappi/flow_ipv4.go | 992 + gosnappi/flow_ipv4_auto.go | 332 + gosnappi/flow_ipv4_dscp.go | 371 + gosnappi/flow_ipv4_options.go | 405 + gosnappi/flow_ipv4_options_custom.go | 414 + gosnappi/flow_ipv4_options_custom_length.go | 413 + gosnappi/flow_ipv4_options_custom_type.go | 414 + gosnappi/flow_ipv4_priority.go | 508 + gosnappi/flow_ipv4_tos.go | 543 + gosnappi/flow_ipv6.go | 629 + gosnappi/flow_latency_metrics.go | 374 + gosnappi/flow_metric.go | 813 + gosnappi/flow_metric_tag.go | 356 + gosnappi/flow_metric_tag_filter.go | 337 + gosnappi/flow_metric_tag_value.go | 421 + gosnappi/flow_metrics.go | 519 + gosnappi/flow_metrics_request.go | 415 + gosnappi/flow_mpls.go | 457 + gosnappi/flow_pfc_pause.go | 844 + gosnappi/flow_port.go | 442 + gosnappi/flow_ppp.go | 414 + gosnappi/flow_predefined_tags.go | 312 + gosnappi/flow_rate.go | 663 + gosnappi/flow_router.go | 498 + gosnappi/flow_rsvp.go | 585 + ...ow_rsvp_explicit_route_as_number_length.go | 423 + gosnappi/flow_rsvp_explicit_route_length.go | 423 + gosnappi/flow_rsvp_length.go | 423 + gosnappi/flow_rsvp_lsp_tunnel_flag.go | 360 + gosnappi/flow_rsvp_message.go | 396 + gosnappi/flow_rsvp_object_length.go | 423 + .../flow_rsvp_path_explicit_route_type1.go | 390 + ...svp_path_explicit_route_type1_as_number.go | 412 + ...p_path_explicit_route_type1_ipv4_prefix.go | 455 + ..._path_label_request_without_label_range.go | 369 + gosnappi/flow_rsvp_path_message.go | 390 + gosnappi/flow_rsvp_path_objects.go | 328 + gosnappi/flow_rsvp_path_objects_class.go | 891 + ..._rsvp_path_objects_class_explicit_route.go | 371 + ...ath_objects_class_explicit_route_c_type.go | 396 + ...w_rsvp_path_objects_class_label_request.go | 371 + ...ow_rsvp_path_objects_class_record_route.go | 371 + .../flow_rsvp_path_objects_class_rsvp_hop.go | 371 + ...rsvp_path_objects_class_sender_template.go | 371 + ...ow_rsvp_path_objects_class_sender_tspec.go | 371 + .../flow_rsvp_path_objects_class_session.go | 371 + ...vp_path_objects_class_session_attribute.go | 371 + ...low_rsvp_path_objects_class_time_values.go | 371 + gosnappi/flow_rsvp_path_objects_custom.go | 414 + ..._rsvp_path_objects_label_request_c_type.go | 396 + ...w_rsvp_path_objects_record_route_c_type.go | 396 + ...th_objects_record_route_sub_object_type.go | 452 + .../flow_rsvp_path_objects_rsvp_hop_c_type.go | 396 + ...svp_path_objects_sender_template_c_type.go | 396 + ...w_rsvp_path_objects_sender_tspec_c_type.go | 396 + ...p_path_objects_session_attribute_c_type.go | 452 + .../flow_rsvp_path_objects_session_c_type.go | 396 + ...ow_rsvp_path_objects_time_values_c_type.go | 396 + gosnappi/flow_rsvp_path_record_route_label.go | 445 + gosnappi/flow_rsvp_path_record_route_type1.go | 390 + ...vp_path_record_route_type1_ipv4_address.go | 457 + ...flow_rsvp_path_record_route_type1_label.go | 457 + gosnappi/flow_rsvp_path_rsvp_hop_ipv4.go | 371 + ...vp_path_sender_template_lsp_tunnel_ipv4.go | 414 + .../flow_rsvp_path_sender_tspec_int_serv.go | 894 + ..._rsvp_path_session_attribute_lsp_tunnel.go | 496 + ...vp_path_session_attribute_lsp_tunnel_ra.go | 625 + .../flow_rsvp_path_session_ext_tunnel_id.go | 452 + .../flow_rsvp_path_session_lsp_tunnel_ipv4.go | 457 + gosnappi/flow_rsvp_path_time_values_type1.go | 328 + gosnappi/flow_rsvp_record_route_i_pv4_flag.go | 351 + gosnappi/flow_rsvp_route_record_length.go | 423 + ...flow_rsvp_session_attribute_name_length.go | 423 + ...ow_rsvp_type1_explicit_route_subobjects.go | 328 + ...vp_type1_explicit_route_subobjects_type.go | 452 + ...flow_rsvp_type1_record_route_subobjects.go | 328 + gosnappi/flow_rx_tx_ratio.go | 461 + gosnappi/flow_rx_tx_ratio_rx_count.go | 279 + gosnappi/flow_size.go | 563 + gosnappi/flow_size_increment.go | 392 + gosnappi/flow_size_random.go | 340 + gosnappi/flow_size_weight_pairs.go | 526 + gosnappi/flow_size_weight_pairs_custom.go | 353 + gosnappi/flow_snmpv2_c.go | 407 + gosnappi/flow_snmpv2_c_bulk_pdu.go | 513 + gosnappi/flow_snmpv2_c_data.go | 766 + gosnappi/flow_snmpv2_c_variable_binding.go | 405 + ..._snmpv2_c_variable_binding_string_value.go | 447 + .../flow_snmpv2_c_variable_binding_value.go | 877 + gosnappi/flow_snmpv2_cpdu.go | 550 + gosnappi/flow_tagged_metric.go | 686 + gosnappi/flow_tagged_metrics_filter.go | 496 + gosnappi/flow_tcp.go | 973 + gosnappi/flow_tx_rx.go | 465 + gosnappi/flow_udp.go | 457 + gosnappi/flow_vlan.go | 457 + gosnappi/flow_vxlan.go | 457 + gosnappi/flows_update.go | 426 + gosnappi/get_capture_response.go | 305 + gosnappi/get_config_response.go | 328 + gosnappi/get_metrics_response.go | 328 + gosnappi/get_states_response.go | 328 + gosnappi/get_version_response.go | 328 + gosnappi/gosnappi.go | 469831 --------------- gosnappi/isis_advanced.go | 661 + gosnappi/isis_authentication.go | 408 + gosnappi/isis_authentication_base.go | 395 + gosnappi/isis_basic.go | 405 + gosnappi/isis_interface.go | 943 + gosnappi/isis_interface_advanced.go | 451 + gosnappi/isis_interface_authentication.go | 395 + gosnappi/isis_interface_level.go | 371 + gosnappi/isis_interface_link_protection.go | 553 + ...isis_lsp_extended_ipv4_reachability_tlv.go | 391 + .../isis_lsp_extended_is_reachability_tlv.go | 390 + gosnappi/isis_lsp_extended_v4_prefix.go | 474 + gosnappi/isis_lsp_flags.go | 458 + gosnappi/isis_lsp_hostname.go | 306 + ...isis_lsp_ipv4_external_reachability_tlv.go | 391 + ...isis_lsp_ipv4_internal_reachability_tlv.go | 391 + gosnappi/isis_lsp_ipv6_reachability_tlv.go | 390 + gosnappi/isis_lsp_is_reachability_tlv.go | 390 + gosnappi/isis_lsp_prefix_attributes.go | 362 + gosnappi/isis_lsp_state.go | 577 + gosnappi/isis_lsp_tlvs.go | 1020 + gosnappi/isis_lsp_v4_prefix.go | 458 + gosnappi/isis_lsp_v6_prefix.go | 517 + gosnappi/isis_lspneighbor.go | 315 + gosnappi/isis_lsps_state.go | 418 + gosnappi/isis_lsps_state_request.go | 317 + gosnappi/isis_metric.go | 1034 + gosnappi/isis_metrics_request.go | 401 + gosnappi/isis_mt.go | 361 + gosnappi/isis_v4_route_range.go | 680 + gosnappi/isis_v6_route_range.go | 680 + gosnappi/lacp_metric.go | 808 + gosnappi/lacp_metrics_request.go | 418 + gosnappi/lag.go | 501 + gosnappi/lag_metric.go | 629 + gosnappi/lag_metrics_request.go | 369 + gosnappi/lag_port.go | 407 + gosnappi/lag_port_lacp.go | 488 + gosnappi/lag_protocol.go | 452 + gosnappi/lag_protocol_lacp.go | 400 + gosnappi/lag_protocol_static.go | 319 + gosnappi/layer1.go | 711 + gosnappi/layer1_auto_negotiation.go | 510 + gosnappi/layer1_flow_control.go | 494 + gosnappi/layer1_ieee8021_qbb.go | 678 + gosnappi/layer1_ieee8023_x.go | 278 + gosnappi/link_state_te.go | 486 + gosnappi/link_statepriority_bandwidths.go | 528 + gosnappi/lldp.go | 560 + gosnappi/lldp_capability_state.go | 364 + gosnappi/lldp_chassis_id.go | 476 + gosnappi/lldp_chassis_mac_sub_type.go | 420 + gosnappi/lldp_connection.go | 387 + gosnappi/lldp_custom_tlv_state.go | 362 + gosnappi/lldp_metric.go | 474 + gosnappi/lldp_metrics_request.go | 361 + gosnappi/lldp_neighbors_state.go | 931 + gosnappi/lldp_neighbors_state_request.go | 342 + gosnappi/lldp_port_id.go | 476 + gosnappi/lldp_port_interface_name_sub_type.go | 402 + gosnappi/lldp_system_name.go | 402 + gosnappi/mac_route_address.go | 434 + gosnappi/metric_latency.go | 366 + gosnappi/metric_timestamp.go | 336 + gosnappi/metrics_request.go | 956 + gosnappi/metrics_response.go | 1630 + gosnappi/neighborsv4_state.go | 373 + gosnappi/neighborsv4_states_request.go | 317 + gosnappi/neighborsv6_state.go | 373 + gosnappi/neighborsv6_states_request.go | 317 + gosnappi/pattern_flow_arp_hardware_length.go | 663 + ...attern_flow_arp_hardware_length_counter.go | 401 + ...ern_flow_arp_hardware_length_metric_tag.go | 385 + gosnappi/pattern_flow_arp_hardware_type.go | 663 + .../pattern_flow_arp_hardware_type_counter.go | 401 + ...ttern_flow_arp_hardware_type_metric_tag.go | 385 + gosnappi/pattern_flow_arp_operation.go | 663 + .../pattern_flow_arp_operation_counter.go | 401 + .../pattern_flow_arp_operation_metric_tag.go | 385 + gosnappi/pattern_flow_arp_protocol_length.go | 663 + ...attern_flow_arp_protocol_length_counter.go | 401 + ...ern_flow_arp_protocol_length_metric_tag.go | 385 + gosnappi/pattern_flow_arp_protocol_type.go | 663 + .../pattern_flow_arp_protocol_type_counter.go | 401 + ...ttern_flow_arp_protocol_type_metric_tag.go | 385 + .../pattern_flow_arp_sender_hardware_addr.go | 658 + ...n_flow_arp_sender_hardware_addr_counter.go | 389 + ...low_arp_sender_hardware_addr_metric_tag.go | 385 + .../pattern_flow_arp_sender_protocol_addr.go | 658 + ...n_flow_arp_sender_protocol_addr_counter.go | 389 + ...low_arp_sender_protocol_addr_metric_tag.go | 385 + .../pattern_flow_arp_target_hardware_addr.go | 658 + ...n_flow_arp_target_hardware_addr_counter.go | 389 + ...low_arp_target_hardware_addr_metric_tag.go | 385 + .../pattern_flow_arp_target_protocol_addr.go | 658 + ...n_flow_arp_target_protocol_addr_counter.go | 389 + ...low_arp_target_protocol_addr_metric_tag.go | 385 + gosnappi/pattern_flow_ethernet_dst.go | 706 + gosnappi/pattern_flow_ethernet_dst_counter.go | 389 + .../pattern_flow_ethernet_dst_metric_tag.go | 385 + gosnappi/pattern_flow_ethernet_ether_type.go | 712 + ...attern_flow_ethernet_ether_type_counter.go | 401 + ...ern_flow_ethernet_ether_type_metric_tag.go | 385 + ...ern_flow_ethernet_pause_control_op_code.go | 663 + ..._ethernet_pause_control_op_code_counter.go | 401 + ...hernet_pause_control_op_code_metric_tag.go | 385 + gosnappi/pattern_flow_ethernet_pause_dst.go | 658 + ...pattern_flow_ethernet_pause_dst_counter.go | 389 + ...tern_flow_ethernet_pause_dst_metric_tag.go | 385 + .../pattern_flow_ethernet_pause_ether_type.go | 663 + ..._flow_ethernet_pause_ether_type_counter.go | 401 + ...ow_ethernet_pause_ether_type_metric_tag.go | 385 + gosnappi/pattern_flow_ethernet_pause_src.go | 658 + ...pattern_flow_ethernet_pause_src_counter.go | 389 + ...tern_flow_ethernet_pause_src_metric_tag.go | 385 + gosnappi/pattern_flow_ethernet_pause_time.go | 663 + ...attern_flow_ethernet_pause_time_counter.go | 401 + ...ern_flow_ethernet_pause_time_metric_tag.go | 385 + gosnappi/pattern_flow_ethernet_pfc_queue.go | 663 + ...pattern_flow_ethernet_pfc_queue_counter.go | 401 + ...tern_flow_ethernet_pfc_queue_metric_tag.go | 385 + gosnappi/pattern_flow_ethernet_src.go | 658 + gosnappi/pattern_flow_ethernet_src_counter.go | 389 + .../pattern_flow_ethernet_src_metric_tag.go | 385 + gosnappi/pattern_flow_gre_checksum.go | 434 + gosnappi/pattern_flow_gre_checksum_present.go | 663 + ...ttern_flow_gre_checksum_present_counter.go | 401 + ...rn_flow_gre_checksum_present_metric_tag.go | 385 + gosnappi/pattern_flow_gre_protocol.go | 663 + gosnappi/pattern_flow_gre_protocol_counter.go | 401 + .../pattern_flow_gre_protocol_metric_tag.go | 385 + gosnappi/pattern_flow_gre_reserved0.go | 663 + .../pattern_flow_gre_reserved0_counter.go | 401 + .../pattern_flow_gre_reserved0_metric_tag.go | 385 + gosnappi/pattern_flow_gre_reserved1.go | 663 + .../pattern_flow_gre_reserved1_counter.go | 401 + .../pattern_flow_gre_reserved1_metric_tag.go | 385 + gosnappi/pattern_flow_gre_version.go | 663 + gosnappi/pattern_flow_gre_version_counter.go | 401 + .../pattern_flow_gre_version_metric_tag.go | 385 + .../pattern_flow_gtp_extension_contents.go | 663 + ...ern_flow_gtp_extension_contents_counter.go | 401 + ..._flow_gtp_extension_contents_metric_tag.go | 385 + ...ern_flow_gtp_extension_extension_length.go | 663 + ..._gtp_extension_extension_length_counter.go | 401 + ...p_extension_extension_length_metric_tag.go | 385 + ...low_gtp_extension_next_extension_header.go | 663 + ...extension_next_extension_header_counter.go | 401 + ...ension_next_extension_header_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv1_e_flag.go | 663 + gosnappi/pattern_flow_gtpv1_e_flag_counter.go | 401 + .../pattern_flow_gtpv1_e_flag_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv1_message_length.go | 663 + ...ttern_flow_gtpv1_message_length_counter.go | 401 + ...rn_flow_gtpv1_message_length_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv1_message_type.go | 663 + ...pattern_flow_gtpv1_message_type_counter.go | 401 + ...tern_flow_gtpv1_message_type_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv1_n_pdu_number.go | 663 + ...pattern_flow_gtpv1_n_pdu_number_counter.go | 401 + ...tern_flow_gtpv1_n_pdu_number_metric_tag.go | 385 + ...n_flow_gtpv1_next_extension_header_type.go | 663 + ...tpv1_next_extension_header_type_counter.go | 401 + ...1_next_extension_header_type_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv1_pn_flag.go | 663 + .../pattern_flow_gtpv1_pn_flag_counter.go | 401 + .../pattern_flow_gtpv1_pn_flag_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv1_protocol_type.go | 663 + ...attern_flow_gtpv1_protocol_type_counter.go | 401 + ...ern_flow_gtpv1_protocol_type_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv1_reserved.go | 663 + .../pattern_flow_gtpv1_reserved_counter.go | 401 + .../pattern_flow_gtpv1_reserved_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv1_s_flag.go | 663 + gosnappi/pattern_flow_gtpv1_s_flag_counter.go | 401 + .../pattern_flow_gtpv1_s_flag_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv1_squence_number.go | 663 + ...ttern_flow_gtpv1_squence_number_counter.go | 401 + ...rn_flow_gtpv1_squence_number_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv1_teid.go | 640 + gosnappi/pattern_flow_gtpv1_teid_counter.go | 371 + .../pattern_flow_gtpv1_teid_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv1_version.go | 663 + .../pattern_flow_gtpv1_version_counter.go | 401 + .../pattern_flow_gtpv1_version_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv2_message_length.go | 663 + ...ttern_flow_gtpv2_message_length_counter.go | 401 + ...rn_flow_gtpv2_message_length_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv2_message_type.go | 663 + ...pattern_flow_gtpv2_message_type_counter.go | 401 + ...tern_flow_gtpv2_message_type_metric_tag.go | 385 + .../pattern_flow_gtpv2_piggybacking_flag.go | 663 + ...rn_flow_gtpv2_piggybacking_flag_counter.go | 401 + ...flow_gtpv2_piggybacking_flag_metric_tag.go | 385 + .../pattern_flow_gtpv2_sequence_number.go | 663 + ...tern_flow_gtpv2_sequence_number_counter.go | 401 + ...n_flow_gtpv2_sequence_number_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv2_spare1.go | 663 + gosnappi/pattern_flow_gtpv2_spare1_counter.go | 401 + .../pattern_flow_gtpv2_spare1_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv2_spare2.go | 663 + gosnappi/pattern_flow_gtpv2_spare2_counter.go | 401 + .../pattern_flow_gtpv2_spare2_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv2_teid.go | 640 + gosnappi/pattern_flow_gtpv2_teid_counter.go | 371 + gosnappi/pattern_flow_gtpv2_teid_flag.go | 663 + .../pattern_flow_gtpv2_teid_flag_counter.go | 401 + ...pattern_flow_gtpv2_teid_flag_metric_tag.go | 385 + .../pattern_flow_gtpv2_teid_metric_tag.go | 385 + gosnappi/pattern_flow_gtpv2_version.go | 663 + .../pattern_flow_gtpv2_version_counter.go | 401 + .../pattern_flow_gtpv2_version_metric_tag.go | 385 + gosnappi/pattern_flow_icmp_echo_checksum.go | 434 + gosnappi/pattern_flow_icmp_echo_code.go | 663 + .../pattern_flow_icmp_echo_code_counter.go | 401 + .../pattern_flow_icmp_echo_code_metric_tag.go | 385 + gosnappi/pattern_flow_icmp_echo_identifier.go | 663 + ...ttern_flow_icmp_echo_identifier_counter.go | 401 + ...rn_flow_icmp_echo_identifier_metric_tag.go | 385 + .../pattern_flow_icmp_echo_sequence_number.go | 663 + ..._flow_icmp_echo_sequence_number_counter.go | 401 + ...ow_icmp_echo_sequence_number_metric_tag.go | 385 + gosnappi/pattern_flow_icmp_echo_type.go | 663 + .../pattern_flow_icmp_echo_type_counter.go | 401 + .../pattern_flow_icmp_echo_type_metric_tag.go | 385 + gosnappi/pattern_flow_icmpv6_echo_checksum.go | 434 + gosnappi/pattern_flow_icmpv6_echo_code.go | 663 + .../pattern_flow_icmpv6_echo_code_counter.go | 401 + ...attern_flow_icmpv6_echo_code_metric_tag.go | 385 + .../pattern_flow_icmpv6_echo_identifier.go | 663 + ...ern_flow_icmpv6_echo_identifier_counter.go | 401 + ..._flow_icmpv6_echo_identifier_metric_tag.go | 385 + ...attern_flow_icmpv6_echo_sequence_number.go | 663 + ...low_icmpv6_echo_sequence_number_counter.go | 401 + ..._icmpv6_echo_sequence_number_metric_tag.go | 385 + gosnappi/pattern_flow_icmpv6_echo_type.go | 663 + .../pattern_flow_icmpv6_echo_type_counter.go | 401 + ...attern_flow_icmpv6_echo_type_metric_tag.go | 385 + gosnappi/pattern_flow_igmpv1_checksum.go | 434 + gosnappi/pattern_flow_igmpv1_group_address.go | 658 + ...ttern_flow_igmpv1_group_address_counter.go | 389 + ...rn_flow_igmpv1_group_address_metric_tag.go | 385 + gosnappi/pattern_flow_igmpv1_type.go | 663 + gosnappi/pattern_flow_igmpv1_type_counter.go | 401 + .../pattern_flow_igmpv1_type_metric_tag.go | 385 + gosnappi/pattern_flow_igmpv1_unused.go | 663 + .../pattern_flow_igmpv1_unused_counter.go | 401 + .../pattern_flow_igmpv1_unused_metric_tag.go | 385 + gosnappi/pattern_flow_igmpv1_version.go | 663 + .../pattern_flow_igmpv1_version_counter.go | 401 + .../pattern_flow_igmpv1_version_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_dont_fragment.go | 663 + ...pattern_flow_ipv4_dont_fragment_counter.go | 401 + ...tern_flow_ipv4_dont_fragment_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_dscp_ecn.go | 663 + .../pattern_flow_ipv4_dscp_ecn_counter.go | 401 + .../pattern_flow_ipv4_dscp_ecn_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_dscp_phb.go | 663 + .../pattern_flow_ipv4_dscp_phb_counter.go | 401 + .../pattern_flow_ipv4_dscp_phb_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_dst.go | 757 + gosnappi/pattern_flow_ipv4_dst_counter.go | 389 + gosnappi/pattern_flow_ipv4_dst_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_dst_random.go | 420 + gosnappi/pattern_flow_ipv4_fragment_offset.go | 663 + ...ttern_flow_ipv4_fragment_offset_counter.go | 401 + ...rn_flow_ipv4_fragment_offset_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_header_checksum.go | 434 + gosnappi/pattern_flow_ipv4_header_length.go | 712 + ...pattern_flow_ipv4_header_length_counter.go | 401 + ...tern_flow_ipv4_header_length_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_identification.go | 663 + ...attern_flow_ipv4_identification_counter.go | 401 + ...ern_flow_ipv4_identification_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_more_fragments.go | 663 + ...attern_flow_ipv4_more_fragments_counter.go | 401 + ...ern_flow_ipv4_more_fragments_metric_tag.go | 385 + ...ow_ipv4_options_custom_type_copied_flag.go | 558 + ...options_custom_type_copied_flag_counter.go | 401 + ...w_ipv4_options_custom_type_option_class.go | 558 + ...ptions_custom_type_option_class_counter.go | 401 + ..._ipv4_options_custom_type_option_number.go | 558 + ...tions_custom_type_option_number_counter.go | 401 + gosnappi/pattern_flow_ipv4_priority_raw.go | 663 + .../pattern_flow_ipv4_priority_raw_counter.go | 401 + ...ttern_flow_ipv4_priority_raw_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_protocol.go | 712 + .../pattern_flow_ipv4_protocol_counter.go | 401 + .../pattern_flow_ipv4_protocol_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_reserved.go | 663 + .../pattern_flow_ipv4_reserved_counter.go | 401 + .../pattern_flow_ipv4_reserved_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_src.go | 757 + gosnappi/pattern_flow_ipv4_src_counter.go | 389 + gosnappi/pattern_flow_ipv4_src_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_src_random.go | 420 + gosnappi/pattern_flow_ipv4_time_to_live.go | 663 + .../pattern_flow_ipv4_time_to_live_counter.go | 401 + ...ttern_flow_ipv4_time_to_live_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_tos_delay.go | 663 + .../pattern_flow_ipv4_tos_delay_counter.go | 401 + .../pattern_flow_ipv4_tos_delay_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_tos_monetary.go | 663 + .../pattern_flow_ipv4_tos_monetary_counter.go | 401 + ...ttern_flow_ipv4_tos_monetary_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_tos_precedence.go | 663 + ...attern_flow_ipv4_tos_precedence_counter.go | 401 + ...ern_flow_ipv4_tos_precedence_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_tos_reliability.go | 663 + ...ttern_flow_ipv4_tos_reliability_counter.go | 401 + ...rn_flow_ipv4_tos_reliability_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_tos_throughput.go | 663 + ...attern_flow_ipv4_tos_throughput_counter.go | 401 + ...ern_flow_ipv4_tos_throughput_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_tos_unused.go | 663 + .../pattern_flow_ipv4_tos_unused_counter.go | 401 + ...pattern_flow_ipv4_tos_unused_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_total_length.go | 712 + .../pattern_flow_ipv4_total_length_counter.go | 401 + ...ttern_flow_ipv4_total_length_metric_tag.go | 385 + gosnappi/pattern_flow_ipv4_version.go | 663 + gosnappi/pattern_flow_ipv4_version_counter.go | 401 + .../pattern_flow_ipv4_version_metric_tag.go | 385 + gosnappi/pattern_flow_ipv6_dst.go | 658 + gosnappi/pattern_flow_ipv6_dst_counter.go | 389 + gosnappi/pattern_flow_ipv6_dst_metric_tag.go | 385 + gosnappi/pattern_flow_ipv6_flow_label.go | 719 + .../pattern_flow_ipv6_flow_label_counter.go | 401 + ...pattern_flow_ipv6_flow_label_metric_tag.go | 385 + .../pattern_flow_ipv6_flow_label_random.go | 422 + gosnappi/pattern_flow_ipv6_hop_limit.go | 663 + .../pattern_flow_ipv6_hop_limit_counter.go | 401 + .../pattern_flow_ipv6_hop_limit_metric_tag.go | 385 + gosnappi/pattern_flow_ipv6_next_header.go | 712 + .../pattern_flow_ipv6_next_header_counter.go | 401 + ...attern_flow_ipv6_next_header_metric_tag.go | 385 + gosnappi/pattern_flow_ipv6_payload_length.go | 712 + ...attern_flow_ipv6_payload_length_counter.go | 401 + ...ern_flow_ipv6_payload_length_metric_tag.go | 385 + gosnappi/pattern_flow_ipv6_src.go | 658 + gosnappi/pattern_flow_ipv6_src_counter.go | 389 + gosnappi/pattern_flow_ipv6_src_metric_tag.go | 385 + gosnappi/pattern_flow_ipv6_traffic_class.go | 663 + ...pattern_flow_ipv6_traffic_class_counter.go | 401 + ...tern_flow_ipv6_traffic_class_metric_tag.go | 385 + gosnappi/pattern_flow_ipv6_version.go | 663 + gosnappi/pattern_flow_ipv6_version_counter.go | 401 + .../pattern_flow_ipv6_version_metric_tag.go | 385 + gosnappi/pattern_flow_mpls_bottom_of_stack.go | 712 + ...ttern_flow_mpls_bottom_of_stack_counter.go | 401 + ...rn_flow_mpls_bottom_of_stack_metric_tag.go | 385 + gosnappi/pattern_flow_mpls_label.go | 712 + gosnappi/pattern_flow_mpls_label_counter.go | 401 + .../pattern_flow_mpls_label_metric_tag.go | 385 + gosnappi/pattern_flow_mpls_time_to_live.go | 663 + .../pattern_flow_mpls_time_to_live_counter.go | 401 + ...ttern_flow_mpls_time_to_live_metric_tag.go | 385 + gosnappi/pattern_flow_mpls_traffic_class.go | 663 + ...pattern_flow_mpls_traffic_class_counter.go | 401 + ...tern_flow_mpls_traffic_class_metric_tag.go | 385 + ...tern_flow_pfc_pause_class_enable_vector.go | 663 + ...w_pfc_pause_class_enable_vector_counter.go | 401 + ...fc_pause_class_enable_vector_metric_tag.go | 385 + .../pattern_flow_pfc_pause_control_op_code.go | 663 + ..._flow_pfc_pause_control_op_code_counter.go | 401 + ...ow_pfc_pause_control_op_code_metric_tag.go | 385 + gosnappi/pattern_flow_pfc_pause_dst.go | 658 + .../pattern_flow_pfc_pause_dst_counter.go | 389 + .../pattern_flow_pfc_pause_dst_metric_tag.go | 385 + gosnappi/pattern_flow_pfc_pause_ether_type.go | 663 + ...ttern_flow_pfc_pause_ether_type_counter.go | 401 + ...rn_flow_pfc_pause_ether_type_metric_tag.go | 385 + .../pattern_flow_pfc_pause_pause_class0.go | 663 + ...ern_flow_pfc_pause_pause_class0_counter.go | 401 + ..._flow_pfc_pause_pause_class0_metric_tag.go | 385 + .../pattern_flow_pfc_pause_pause_class1.go | 663 + ...ern_flow_pfc_pause_pause_class1_counter.go | 401 + ..._flow_pfc_pause_pause_class1_metric_tag.go | 385 + .../pattern_flow_pfc_pause_pause_class2.go | 663 + ...ern_flow_pfc_pause_pause_class2_counter.go | 401 + ..._flow_pfc_pause_pause_class2_metric_tag.go | 385 + .../pattern_flow_pfc_pause_pause_class3.go | 663 + ...ern_flow_pfc_pause_pause_class3_counter.go | 401 + ..._flow_pfc_pause_pause_class3_metric_tag.go | 385 + .../pattern_flow_pfc_pause_pause_class4.go | 663 + ...ern_flow_pfc_pause_pause_class4_counter.go | 401 + ..._flow_pfc_pause_pause_class4_metric_tag.go | 385 + .../pattern_flow_pfc_pause_pause_class5.go | 663 + ...ern_flow_pfc_pause_pause_class5_counter.go | 401 + ..._flow_pfc_pause_pause_class5_metric_tag.go | 385 + .../pattern_flow_pfc_pause_pause_class6.go | 663 + ...ern_flow_pfc_pause_pause_class6_counter.go | 401 + ..._flow_pfc_pause_pause_class6_metric_tag.go | 385 + .../pattern_flow_pfc_pause_pause_class7.go | 663 + ...ern_flow_pfc_pause_pause_class7_counter.go | 401 + ..._flow_pfc_pause_pause_class7_metric_tag.go | 385 + gosnappi/pattern_flow_pfc_pause_src.go | 658 + .../pattern_flow_pfc_pause_src_counter.go | 389 + .../pattern_flow_pfc_pause_src_metric_tag.go | 385 + gosnappi/pattern_flow_ppp_address.go | 663 + gosnappi/pattern_flow_ppp_address_counter.go | 401 + .../pattern_flow_ppp_address_metric_tag.go | 385 + gosnappi/pattern_flow_ppp_control.go | 663 + gosnappi/pattern_flow_ppp_control_counter.go | 401 + .../pattern_flow_ppp_control_metric_tag.go | 385 + gosnappi/pattern_flow_ppp_protocol_type.go | 712 + .../pattern_flow_ppp_protocol_type_counter.go | 401 + ...ttern_flow_ppp_protocol_type_metric_tag.go | 385 + ...th_explicit_route_type1_as_number_l_bit.go | 558 + ...cit_route_type1_as_number_l_bit_counter.go | 401 + ...it_route_type1_ipv4_prefix_ipv4_address.go | 553 + ..._type1_ipv4_prefix_ipv4_address_counter.go | 389 + ..._explicit_route_type1_ipv4_prefix_l_bit.go | 558 + ...t_route_type1_ipv4_prefix_l_bit_counter.go | 401 + ...abel_request_without_label_range_l3_pid.go | 554 + ...uest_without_label_range_l3_pid_counter.go | 401 + ...el_request_without_label_range_reserved.go | 558 + ...st_without_label_range_reserved_counter.go | 401 + ...tern_flow_rsvp_path_objects_custom_type.go | 558 + ...w_rsvp_path_objects_custom_type_counter.go | 401 + ...d_route_type1_ipv4_address_ipv4_address.go | 553 + ...type1_ipv4_address_ipv4_address_counter.go | 389 + ..._route_type1_ipv4_address_prefix_length.go | 558 + ...ype1_ipv4_address_prefix_length_counter.go | 401 + ...vp_path_record_route_type1_label_c_type.go | 439 + ...svp_path_record_route_type1_label_flags.go | 439 + ...ow_rsvp_path_rsvp_hop_ipv4_ipv4_address.go | 553 + ...path_rsvp_hop_ipv4_ipv4_address_counter.go | 389 + ..._rsvp_hop_ipv4_logical_interface_handle.go | 535 + ...p_ipv4_logical_interface_handle_counter.go | 371 + ..._tunnel_ipv4_ipv4_tunnel_sender_address.go | 553 + ...ipv4_ipv4_tunnel_sender_address_counter.go | 389 + ..._sender_template_lsp_tunnel_ipv4_lsp_id.go | 558 + ...template_lsp_tunnel_ipv4_lsp_id_counter.go | 401 + ...ender_template_lsp_tunnel_ipv4_reserved.go | 558 + ...mplate_lsp_tunnel_ipv4_reserved_counter.go | 401 + ...r_tspec_int_serv_length_of_service_data.go | 558 + ...int_serv_length_of_service_data_counter.go | 401 + ...nder_tspec_int_serv_maximum_packet_size.go | 535 + ...ec_int_serv_maximum_packet_size_counter.go | 371 + ...der_tspec_int_serv_minimum_policed_unit.go | 535 + ...c_int_serv_minimum_policed_unit_counter.go | 371 + ...th_sender_tspec_int_serv_overall_length.go | 558 + ...r_tspec_int_serv_overall_length_counter.go | 401 + ...sender_tspec_int_serv_parameter127_flag.go | 558 + ...spec_int_serv_parameter127_flag_counter.go | 401 + ...nder_tspec_int_serv_parameter127_length.go | 558 + ...ec_int_serv_parameter127_length_counter.go | 401 + ...nt_serv_parameter_id_token_bucket_tspec.go | 558 + ...parameter_id_token_bucket_tspec_counter.go | 401 + ...vp_path_sender_tspec_int_serv_reserved1.go | 558 + ...sender_tspec_int_serv_reserved1_counter.go | 401 + ...vp_path_sender_tspec_int_serv_reserved2.go | 558 + ...sender_tspec_int_serv_reserved2_counter.go | 401 + ...th_sender_tspec_int_serv_service_header.go | 558 + ...r_tspec_int_serv_service_header_counter.go | 401 + ...rsvp_path_sender_tspec_int_serv_version.go | 558 + ...h_sender_tspec_int_serv_version_counter.go | 401 + ...svp_path_sender_tspec_int_serv_zero_bit.go | 558 + ..._sender_tspec_int_serv_zero_bit_counter.go | 401 + ...p_path_session_ext_tunnel_id_as_integer.go | 535 + ...ession_ext_tunnel_id_as_integer_counter.go | 371 + ...rsvp_path_session_ext_tunnel_id_as_ipv4.go | 553 + ...h_session_ext_tunnel_id_as_ipv4_counter.go | 389 + ...nnel_ipv4_ipv4_tunnel_end_point_address.go | 553 + ...4_ipv4_tunnel_end_point_address_counter.go | 389 + ...p_path_session_lsp_tunnel_ipv4_reserved.go | 558 + ...ession_lsp_tunnel_ipv4_reserved_counter.go | 401 + ..._path_session_lsp_tunnel_ipv4_tunnel_id.go | 558 + ...ssion_lsp_tunnel_ipv4_tunnel_id_counter.go | 401 + ...path_time_values_type1_refresh_period_r.go | 535 + ...e_values_type1_refresh_period_r_counter.go | 371 + gosnappi/pattern_flow_rsvp_reserved.go | 558 + .../pattern_flow_rsvp_reserved_counter.go | 401 + gosnappi/pattern_flow_rsvp_rsvp_checksum.go | 434 + gosnappi/pattern_flow_rsvp_time_to_live.go | 558 + .../pattern_flow_rsvp_time_to_live_counter.go | 401 + ..._flow_snmpv2_c_bulk_pdu_max_repetitions.go | 531 + ...mpv2_c_bulk_pdu_max_repetitions_counter.go | 371 + ...rn_flow_snmpv2_c_bulk_pdu_non_repeaters.go | 416 + ...ttern_flow_snmpv2_c_bulk_pdu_request_id.go | 536 + ...ow_snmpv2_c_bulk_pdu_request_id_counter.go | 371 + ...ariable_binding_value_big_counter_value.go | 531 + ...binding_value_big_counter_value_counter.go | 371 + ..._c_variable_binding_value_counter_value.go | 531 + ...ble_binding_value_counter_value_counter.go | 371 + ..._c_variable_binding_value_integer_value.go | 531 + ...ble_binding_value_integer_value_counter.go | 371 + ...variable_binding_value_ip_address_value.go | 549 + ..._binding_value_ip_address_value_counter.go | 389 + ..._variable_binding_value_timeticks_value.go | 531 + ...e_binding_value_timeticks_value_counter.go | 371 + ...le_binding_value_unsigned_integer_value.go | 531 + ...ng_value_unsigned_integer_value_counter.go | 371 + gosnappi/pattern_flow_snmpv2_c_version.go | 554 + .../pattern_flow_snmpv2_c_version_counter.go | 401 + .../pattern_flow_snmpv2_cpdu_error_index.go | 531 + ...rn_flow_snmpv2_cpdu_error_index_counter.go | 371 + .../pattern_flow_snmpv2_cpdu_request_id.go | 536 + ...ern_flow_snmpv2_cpdu_request_id_counter.go | 371 + gosnappi/pattern_flow_tcp_ack_num.go | 640 + gosnappi/pattern_flow_tcp_ack_num_counter.go | 371 + .../pattern_flow_tcp_ack_num_metric_tag.go | 385 + gosnappi/pattern_flow_tcp_checksum.go | 434 + gosnappi/pattern_flow_tcp_ctl_ack.go | 663 + gosnappi/pattern_flow_tcp_ctl_ack_counter.go | 401 + .../pattern_flow_tcp_ctl_ack_metric_tag.go | 385 + gosnappi/pattern_flow_tcp_ctl_fin.go | 663 + gosnappi/pattern_flow_tcp_ctl_fin_counter.go | 401 + .../pattern_flow_tcp_ctl_fin_metric_tag.go | 385 + gosnappi/pattern_flow_tcp_ctl_psh.go | 663 + gosnappi/pattern_flow_tcp_ctl_psh_counter.go | 401 + .../pattern_flow_tcp_ctl_psh_metric_tag.go | 385 + gosnappi/pattern_flow_tcp_ctl_rst.go | 663 + gosnappi/pattern_flow_tcp_ctl_rst_counter.go | 401 + .../pattern_flow_tcp_ctl_rst_metric_tag.go | 385 + gosnappi/pattern_flow_tcp_ctl_syn.go | 663 + gosnappi/pattern_flow_tcp_ctl_syn_counter.go | 401 + .../pattern_flow_tcp_ctl_syn_metric_tag.go | 385 + gosnappi/pattern_flow_tcp_ctl_urg.go | 663 + gosnappi/pattern_flow_tcp_ctl_urg_counter.go | 401 + .../pattern_flow_tcp_ctl_urg_metric_tag.go | 385 + gosnappi/pattern_flow_tcp_data_offset.go | 663 + .../pattern_flow_tcp_data_offset_counter.go | 401 + ...pattern_flow_tcp_data_offset_metric_tag.go | 385 + gosnappi/pattern_flow_tcp_dst_port.go | 719 + gosnappi/pattern_flow_tcp_dst_port_counter.go | 401 + .../pattern_flow_tcp_dst_port_metric_tag.go | 385 + gosnappi/pattern_flow_tcp_dst_port_random.go | 422 + gosnappi/pattern_flow_tcp_ecn_cwr.go | 663 + gosnappi/pattern_flow_tcp_ecn_cwr_counter.go | 401 + .../pattern_flow_tcp_ecn_cwr_metric_tag.go | 385 + gosnappi/pattern_flow_tcp_ecn_echo.go | 663 + gosnappi/pattern_flow_tcp_ecn_echo_counter.go | 401 + .../pattern_flow_tcp_ecn_echo_metric_tag.go | 385 + gosnappi/pattern_flow_tcp_ecn_ns.go | 663 + gosnappi/pattern_flow_tcp_ecn_ns_counter.go | 401 + .../pattern_flow_tcp_ecn_ns_metric_tag.go | 385 + gosnappi/pattern_flow_tcp_seq_num.go | 640 + gosnappi/pattern_flow_tcp_seq_num_counter.go | 371 + .../pattern_flow_tcp_seq_num_metric_tag.go | 385 + gosnappi/pattern_flow_tcp_src_port.go | 719 + gosnappi/pattern_flow_tcp_src_port_counter.go | 401 + .../pattern_flow_tcp_src_port_metric_tag.go | 385 + gosnappi/pattern_flow_tcp_src_port_random.go | 422 + gosnappi/pattern_flow_tcp_window.go | 663 + gosnappi/pattern_flow_tcp_window_counter.go | 401 + .../pattern_flow_tcp_window_metric_tag.go | 385 + gosnappi/pattern_flow_udp_checksum.go | 434 + gosnappi/pattern_flow_udp_dst_port.go | 719 + gosnappi/pattern_flow_udp_dst_port_counter.go | 401 + .../pattern_flow_udp_dst_port_metric_tag.go | 385 + gosnappi/pattern_flow_udp_dst_port_random.go | 422 + gosnappi/pattern_flow_udp_length.go | 663 + gosnappi/pattern_flow_udp_length_counter.go | 401 + .../pattern_flow_udp_length_metric_tag.go | 385 + gosnappi/pattern_flow_udp_src_port.go | 719 + gosnappi/pattern_flow_udp_src_port_counter.go | 401 + .../pattern_flow_udp_src_port_metric_tag.go | 385 + gosnappi/pattern_flow_udp_src_port_random.go | 422 + gosnappi/pattern_flow_vlan_cfi.go | 663 + gosnappi/pattern_flow_vlan_cfi_counter.go | 401 + gosnappi/pattern_flow_vlan_cfi_metric_tag.go | 385 + gosnappi/pattern_flow_vlan_id.go | 663 + gosnappi/pattern_flow_vlan_id_counter.go | 401 + gosnappi/pattern_flow_vlan_id_metric_tag.go | 385 + gosnappi/pattern_flow_vlan_priority.go | 663 + .../pattern_flow_vlan_priority_counter.go | 401 + .../pattern_flow_vlan_priority_metric_tag.go | 385 + gosnappi/pattern_flow_vlan_tpid.go | 663 + gosnappi/pattern_flow_vlan_tpid_counter.go | 401 + gosnappi/pattern_flow_vlan_tpid_metric_tag.go | 385 + gosnappi/pattern_flow_vxlan_flags.go | 663 + gosnappi/pattern_flow_vxlan_flags_counter.go | 401 + .../pattern_flow_vxlan_flags_metric_tag.go | 385 + gosnappi/pattern_flow_vxlan_reserved0.go | 663 + .../pattern_flow_vxlan_reserved0_counter.go | 401 + ...pattern_flow_vxlan_reserved0_metric_tag.go | 385 + gosnappi/pattern_flow_vxlan_reserved1.go | 663 + .../pattern_flow_vxlan_reserved1_counter.go | 401 + ...pattern_flow_vxlan_reserved1_metric_tag.go | 385 + gosnappi/pattern_flow_vxlan_vni.go | 712 + gosnappi/pattern_flow_vxlan_vni_counter.go | 401 + gosnappi/pattern_flow_vxlan_vni_metric_tag.go | 385 + gosnappi/port.go | 354 + gosnappi/port_metric.go | 699 + gosnappi/port_metrics_request.go | 373 + gosnappi/port_options.go | 309 + gosnappi/protocol_options.go | 309 + gosnappi/result_bgp_as_path.go | 390 + gosnappi/result_bgp_as_path_segment.go | 348 + gosnappi/result_bgp_community.go | 402 + gosnappi/result_extended_community.go | 376 + ...community_non_transitive2_octet_as_type.go | 390 + ...ransitive2_octet_as_type_link_bandwidth.go | 344 + .../result_extended_community_structured.go | 618 + ...ded_community_transitive2_octet_as_type.go | 446 + ..._transitive2_octet_as_type_route_origin.go | 344 + ..._transitive2_octet_as_type_route_target.go | 344 + ...ded_community_transitive4_octet_as_type.go | 446 + ..._transitive4_octet_as_type_route_origin.go | 344 + ..._transitive4_octet_as_type_route_target.go | 344 + ..._community_transitive_ipv4_address_type.go | 446 + ...ansitive_ipv4_address_type_route_origin.go | 353 + ...ansitive_ipv4_address_type_route_target.go | 353 + ...tended_community_transitive_opaque_type.go | 446 + ..._community_transitive_opaque_type_color.go | 347 + ...ty_transitive_opaque_type_encapsulation.go | 371 + gosnappi/rsvp_ero.go | 477 + gosnappi/rsvp_ero_subobject.go | 488 + gosnappi/rsvp_fast_reroute.go | 623 + gosnappi/rsvp_i_pv4_lsp_state.go | 612 + gosnappi/rsvp_ipv4_interface.go | 689 + gosnappi/rsvp_lsp_ipv4_ero.go | 391 + gosnappi/rsvp_lsp_ipv4_interface.go | 476 + ..._lsp_ipv4_interface_p2p_egress_ipv4_lsp.go | 503 + ...lsp_ipv4_interface_p2p_ingress_ipv4_lsp.go | 767 + gosnappi/rsvp_lsp_ipv4_rro.go | 343 + gosnappi/rsvp_lsp_state.go | 528 + gosnappi/rsvp_lsps_state.go | 418 + gosnappi/rsvp_lsps_state_request.go | 317 + gosnappi/rsvp_metric.go | 1146 + gosnappi/rsvp_metrics_request.go | 409 + gosnappi/rsvp_resource_affinities.go | 409 + gosnappi/rsvp_session_attribute.go | 646 + gosnappi/rsvp_tspec.go | 453 + gosnappi/set_config_response.go | 328 + gosnappi/set_control_action_response.go | 328 + gosnappi/set_control_state_response.go | 328 + gosnappi/state_port.go | 443 + gosnappi/state_port_capture.go | 355 + gosnappi/state_port_link.go | 353 + gosnappi/state_protocol.go | 613 + gosnappi/state_protocol_all.go | 315 + gosnappi/state_protocol_bgp.go | 387 + gosnappi/state_protocol_bgp_peers.go | 357 + gosnappi/state_protocol_isis.go | 387 + gosnappi/state_protocol_isis_routers.go | 353 + gosnappi/state_protocol_lacp.go | 443 + gosnappi/state_protocol_lacp_admin.go | 353 + gosnappi/state_protocol_lacp_member_ports.go | 353 + gosnappi/state_protocol_route.go | 365 + gosnappi/state_traffic.go | 387 + gosnappi/state_traffic_flow_transmit.go | 359 + gosnappi/states_request.go | 788 + gosnappi/states_response.go | 1284 + gosnappi/update_config_response.go | 328 + gosnappi/v4_route_address.go | 434 + gosnappi/v6_route_address.go | 434 + gosnappi/version.go | 371 + ...n_ip_mode_unicast_arp_suppression_cache.go | 352 + gosnappi/vxlan_v4_tunnel.go | 431 + .../vxlan_v4_tunnel_destination_ip_mode.go | 452 + ...v4_tunnel_destination_ip_mode_multicast.go | 315 + ...n_v4_tunnel_destination_ip_mode_unicast.go | 390 + ...tunnel_destination_ip_mode_unicast_vtep.go | 427 + gosnappi/vxlan_v6_tunnel.go | 431 + .../vxlan_v6_tunnel_destination_ip_mode.go | 452 + ...v6_tunnel_destination_ip_mode_multicast.go | 315 + ...n_v6_tunnel_destination_ip_mode_unicast.go | 390 + ...tunnel_destination_ip_mode_unicast_vtep.go | 427 + gosnappi/warning.go | 305 + requirements.txt | 6 +- 1008 files changed, 480896 insertions(+), 469834 deletions(-) create mode 100644 gosnappi/action_protocol.go create mode 100644 gosnappi/action_protocol_bgp.go create mode 100644 gosnappi/action_protocol_bgp_initiate_graceful_restart.go create mode 100644 gosnappi/action_protocol_bgp_notification.go create mode 100644 gosnappi/action_protocol_ipv4.go create mode 100644 gosnappi/action_protocol_ipv4_ping.go create mode 100644 gosnappi/action_protocol_ipv4_ping_request.go create mode 100644 gosnappi/action_protocol_ipv6.go create mode 100644 gosnappi/action_protocol_ipv6_ping.go create mode 100644 gosnappi/action_protocol_ipv6_ping_request.go create mode 100644 gosnappi/action_response.go create mode 100644 gosnappi/action_response_protocol.go create mode 100644 gosnappi/action_response_protocol_ipv4.go create mode 100644 gosnappi/action_response_protocol_ipv4_ping.go create mode 100644 gosnappi/action_response_protocol_ipv4_ping_response.go create mode 100644 gosnappi/action_response_protocol_ipv6.go create mode 100644 gosnappi/action_response_protocol_ipv6_ping.go create mode 100644 gosnappi/action_response_protocol_ipv6_ping_response.go create mode 100644 gosnappi/bgp_add_path.go create mode 100644 gosnappi/bgp_advanced.go create mode 100644 gosnappi/bgp_as_path.go create mode 100644 gosnappi/bgp_as_path_segment.go create mode 100644 gosnappi/bgp_attributes.go create mode 100644 gosnappi/bgp_attributes_aggregator.go create mode 100644 gosnappi/bgp_attributes_as4_aggregator.go create mode 100644 gosnappi/bgp_attributes_as4_path.go create mode 100644 gosnappi/bgp_attributes_as_path.go create mode 100644 gosnappi/bgp_attributes_as_path_four_byte_as_path.go create mode 100644 gosnappi/bgp_attributes_as_path_two_byte_as_path.go create mode 100644 gosnappi/bgp_attributes_bsid.go create mode 100644 gosnappi/bgp_attributes_bsid_mpls.go create mode 100644 gosnappi/bgp_attributes_bsid_srv6.go create mode 100644 gosnappi/bgp_attributes_community.go create mode 100644 gosnappi/bgp_attributes_custom_community.go create mode 100644 gosnappi/bgp_attributes_four_byte_as_path_segment.go create mode 100644 gosnappi/bgp_attributes_local_preference.go create mode 100644 gosnappi/bgp_attributes_mp_reach_nlri.go create mode 100644 gosnappi/bgp_attributes_mp_unreach_nlri.go create mode 100644 gosnappi/bgp_attributes_multi_exit_discriminator.go create mode 100644 gosnappi/bgp_attributes_next_hop.go create mode 100644 gosnappi/bgp_attributes_next_hop_ipv6_two_addresses.go create mode 100644 gosnappi/bgp_attributes_originator_id.go create mode 100644 gosnappi/bgp_attributes_other_attribute.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_s_rv6_sid_endpoint_behavior_and_structure.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_segment_list_segment.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_segment_list_weight.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_type_a.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_type_b.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_type_c.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_type_d.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_type_e.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_type_f.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_type_flags.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_type_g.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_type_h.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_type_i.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_type_j.go create mode 100644 gosnappi/bgp_attributes_segment_routing_policy_type_k.go create mode 100644 gosnappi/bgp_attributes_sid_mpls.go create mode 100644 gosnappi/bgp_attributes_sid_srv6.go create mode 100644 gosnappi/bgp_attributes_sr_policy_explicit_null_policy.go create mode 100644 gosnappi/bgp_attributes_sr_policy_policy_candidate_name.go create mode 100644 gosnappi/bgp_attributes_sr_policy_policy_name.go create mode 100644 gosnappi/bgp_attributes_sr_policy_preference.go create mode 100644 gosnappi/bgp_attributes_sr_policy_priority.go create mode 100644 gosnappi/bgp_attributes_sr_policy_segment_list.go create mode 100644 gosnappi/bgp_attributes_srv6_bsid.go create mode 100644 gosnappi/bgp_attributes_tunnel_encapsulation.go create mode 100644 gosnappi/bgp_attributes_two_byte_as_path_segment.go create mode 100644 gosnappi/bgp_c_mac_ip_range.go create mode 100644 gosnappi/bgp_capability.go create mode 100644 gosnappi/bgp_community.go create mode 100644 gosnappi/bgp_ethernet_segment_df_election.go create mode 100644 gosnappi/bgp_ext_community.go create mode 100644 gosnappi/bgp_extended_community.go create mode 100644 gosnappi/bgp_extended_community_custom_type.go create mode 100644 gosnappi/bgp_extended_community_non_transitive2_octet_as_type.go create mode 100644 gosnappi/bgp_extended_community_non_transitive2_octet_as_type_link_bandwidth.go create mode 100644 gosnappi/bgp_extended_community_transitive2_octet_as_type.go create mode 100644 gosnappi/bgp_extended_community_transitive2_octet_as_type_route_origin.go create mode 100644 gosnappi/bgp_extended_community_transitive2_octet_as_type_route_target.go create mode 100644 gosnappi/bgp_extended_community_transitive4_octet_as_type.go create mode 100644 gosnappi/bgp_extended_community_transitive4_octet_as_type_route_origin.go create mode 100644 gosnappi/bgp_extended_community_transitive4_octet_as_type_route_target.go create mode 100644 gosnappi/bgp_extended_community_transitive_evpn_type.go create mode 100644 gosnappi/bgp_extended_community_transitive_evpn_type_router_mac.go create mode 100644 gosnappi/bgp_extended_community_transitive_ipv4_address_type.go create mode 100644 gosnappi/bgp_extended_community_transitive_ipv4_address_type_route_origin.go create mode 100644 gosnappi/bgp_extended_community_transitive_ipv4_address_type_route_target.go create mode 100644 gosnappi/bgp_extended_community_transitive_opaque_type.go create mode 100644 gosnappi/bgp_extended_community_transitive_opaque_type_color.go create mode 100644 gosnappi/bgp_extended_community_transitive_opaque_type_encapsulation.go create mode 100644 gosnappi/bgp_graceful_restart.go create mode 100644 gosnappi/bgp_ipv4_sr_policy_nlri_prefix.go create mode 100644 gosnappi/bgp_ipv6_sr_policy_nlri_prefix.go create mode 100644 gosnappi/bgp_learned_information_filter.go create mode 100644 gosnappi/bgp_nlri_prefix_path_id.go create mode 100644 gosnappi/bgp_one_ipv4_nlri_prefix.go create mode 100644 gosnappi/bgp_one_ipv6_nlri_prefix.go create mode 100644 gosnappi/bgp_one_structured_update_replay.go create mode 100644 gosnappi/bgp_one_traditional_nlri_prefix.go create mode 100644 gosnappi/bgp_one_update_replay.go create mode 100644 gosnappi/bgp_prefix_ipv4_unicast_filter.go create mode 100644 gosnappi/bgp_prefix_ipv4_unicast_state.go create mode 100644 gosnappi/bgp_prefix_ipv6_unicast_filter.go create mode 100644 gosnappi/bgp_prefix_ipv6_unicast_state.go create mode 100644 gosnappi/bgp_prefix_state_request.go create mode 100644 gosnappi/bgp_prefixes_state.go create mode 100644 gosnappi/bgp_raw_bytes.go create mode 100644 gosnappi/bgp_route_advanced.go create mode 100644 gosnappi/bgp_route_distinguisher.go create mode 100644 gosnappi/bgp_route_target.go create mode 100644 gosnappi/bgp_srte_binding_sub_tlv.go create mode 100644 gosnappi/bgp_srte_color_sub_tlv.go create mode 100644 gosnappi/bgp_srte_explicit_null_label_policy_sub_tlv.go create mode 100644 gosnappi/bgp_srte_policy_name_sub_tlv.go create mode 100644 gosnappi/bgp_srte_policy_priority_sub_tlv.go create mode 100644 gosnappi/bgp_srte_preference_sub_tlv.go create mode 100644 gosnappi/bgp_srte_remote_endpoint_sub_tlv.go create mode 100644 gosnappi/bgp_srte_s_rv6_sid_endpoint_behavior_and_structure.go create mode 100644 gosnappi/bgp_srte_segment.go create mode 100644 gosnappi/bgp_srte_segment_a_type_sub_tlv.go create mode 100644 gosnappi/bgp_srte_segment_b_type_sub_tlv.go create mode 100644 gosnappi/bgp_srte_segment_c_type_sub_tlv.go create mode 100644 gosnappi/bgp_srte_segment_d_type_sub_tlv.go create mode 100644 gosnappi/bgp_srte_segment_e_type_sub_tlv.go create mode 100644 gosnappi/bgp_srte_segment_f_type_sub_tlv.go create mode 100644 gosnappi/bgp_srte_segment_g_type_sub_tlv.go create mode 100644 gosnappi/bgp_srte_segment_h_type_sub_tlv.go create mode 100644 gosnappi/bgp_srte_segment_i_type_sub_tlv.go create mode 100644 gosnappi/bgp_srte_segment_j_type_sub_tlv.go create mode 100644 gosnappi/bgp_srte_segment_k_type_sub_tlv.go create mode 100644 gosnappi/bgp_srte_segment_list.go create mode 100644 gosnappi/bgp_srte_sr_mpls_sid.go create mode 100644 gosnappi/bgp_srte_v4_policy.go create mode 100644 gosnappi/bgp_srte_v4_tunnel_tlv.go create mode 100644 gosnappi/bgp_srte_v6_policy.go create mode 100644 gosnappi/bgp_srte_v6_tunnel_tlv.go create mode 100644 gosnappi/bgp_structured_pdus.go create mode 100644 gosnappi/bgp_update_replay.go create mode 100644 gosnappi/bgp_v4_ethernet_segment.go create mode 100644 gosnappi/bgp_v4_evi_vxlan.go create mode 100644 gosnappi/bgp_v4_evi_vxlan_broadcast_domain.go create mode 100644 gosnappi/bgp_v4_evpn_evis.go create mode 100644 gosnappi/bgp_v4_interface.go create mode 100644 gosnappi/bgp_v4_peer.go create mode 100644 gosnappi/bgp_v4_route_range.go create mode 100644 gosnappi/bgp_v6_ethernet_segment.go create mode 100644 gosnappi/bgp_v6_evi_vxlan.go create mode 100644 gosnappi/bgp_v6_evi_vxlan_broadcast_domain.go create mode 100644 gosnappi/bgp_v6_evpn_evis.go create mode 100644 gosnappi/bgp_v6_interface.go create mode 100644 gosnappi/bgp_v6_peer.go create mode 100644 gosnappi/bgp_v6_route_range.go create mode 100644 gosnappi/bgp_v6_segment_routing.go create mode 100644 gosnappi/bgpv4_metric.go create mode 100644 gosnappi/bgpv4_metrics_request.go create mode 100644 gosnappi/bgpv6_metric.go create mode 100644 gosnappi/bgpv6_metrics_request.go create mode 100644 gosnappi/capture.go create mode 100644 gosnappi/capture_custom.go create mode 100644 gosnappi/capture_ethernet.go create mode 100644 gosnappi/capture_field.go create mode 100644 gosnappi/capture_filter.go create mode 100644 gosnappi/capture_ipv4.go create mode 100644 gosnappi/capture_ipv6.go create mode 100644 gosnappi/capture_request.go create mode 100644 gosnappi/capture_vlan.go create mode 100644 gosnappi/config.go create mode 100644 gosnappi/config_options.go create mode 100644 gosnappi/config_update.go create mode 100644 gosnappi/control_action.go create mode 100644 gosnappi/control_action_response.go create mode 100644 gosnappi/control_state.go create mode 100644 gosnappi/device.go create mode 100644 gosnappi/device_bgp_cease_error.go create mode 100644 gosnappi/device_bgp_custom_error.go create mode 100644 gosnappi/device_bgp_finite_state_machine_error.go create mode 100644 gosnappi/device_bgp_hold_timer_expired.go create mode 100644 gosnappi/device_bgp_message_header_error.go create mode 100644 gosnappi/device_bgp_open_message_error.go create mode 100644 gosnappi/device_bgp_router.go create mode 100644 gosnappi/device_bgp_update_message_error.go create mode 100644 gosnappi/device_dhcp_server.go create mode 100644 gosnappi/device_dhcpv4_client.go create mode 100644 gosnappi/device_ethernet.go create mode 100644 gosnappi/device_ethernet_base.go create mode 100644 gosnappi/device_ipv4.go create mode 100644 gosnappi/device_ipv4_gateway_mac.go create mode 100644 gosnappi/device_ipv4_loopback.go create mode 100644 gosnappi/device_ipv6.go create mode 100644 gosnappi/device_ipv6_gateway_mac.go create mode 100644 gosnappi/device_ipv6_loopback.go create mode 100644 gosnappi/device_isis_multi_instance.go create mode 100644 gosnappi/device_isis_router.go create mode 100644 gosnappi/device_rsvp.go create mode 100644 gosnappi/device_vlan.go create mode 100644 gosnappi/device_vxlan.go create mode 100644 gosnappi/dhcp_server_v4.go create mode 100644 gosnappi/dhcp_server_v4_pool.go create mode 100644 gosnappi/dhcp_server_v4_pool_option.go create mode 100644 gosnappi/dhcpv4_client_metric.go create mode 100644 gosnappi/dhcpv4_client_metrics_request.go create mode 100644 gosnappi/dhcpv4_client_params.go create mode 100644 gosnappi/dhcpv4_interface_state.go create mode 100644 gosnappi/dhcpv4_interface_state_request.go create mode 100644 gosnappi/dhcpv4_lease_state.go create mode 100644 gosnappi/dhcpv4_lease_state_request.go create mode 100644 gosnappi/dhcpv4_leases_state.go create mode 100644 gosnappi/dhcpv4_server_metric.go create mode 100644 gosnappi/dhcpv4_server_metrics_request.go create mode 100644 gosnappi/error.go create mode 100644 gosnappi/ethernet_connection.go create mode 100644 gosnappi/event.go create mode 100644 gosnappi/event_link.go create mode 100644 gosnappi/event_route_advertise_withdraw.go create mode 100644 gosnappi/event_rx_rate_threshold.go create mode 100644 gosnappi/flow.go create mode 100644 gosnappi/flow_arp.go create mode 100644 gosnappi/flow_burst.go create mode 100644 gosnappi/flow_continuous.go create mode 100644 gosnappi/flow_custom.go create mode 100644 gosnappi/flow_custom_metric_tag.go create mode 100644 gosnappi/flow_delay.go create mode 100644 gosnappi/flow_duration.go create mode 100644 gosnappi/flow_duration_inter_burst_gap.go create mode 100644 gosnappi/flow_ethernet.go create mode 100644 gosnappi/flow_ethernet_pause.go create mode 100644 gosnappi/flow_fixed_packets.go create mode 100644 gosnappi/flow_fixed_seconds.go create mode 100644 gosnappi/flow_gre.go create mode 100644 gosnappi/flow_gtp_extension.go create mode 100644 gosnappi/flow_gtpv1.go create mode 100644 gosnappi/flow_gtpv2.go create mode 100644 gosnappi/flow_header.go create mode 100644 gosnappi/flow_icmp.go create mode 100644 gosnappi/flow_icmp_echo.go create mode 100644 gosnappi/flow_icmpv6.go create mode 100644 gosnappi/flow_icmpv6_echo.go create mode 100644 gosnappi/flow_igmpv1.go create mode 100644 gosnappi/flow_ipv4.go create mode 100644 gosnappi/flow_ipv4_auto.go create mode 100644 gosnappi/flow_ipv4_dscp.go create mode 100644 gosnappi/flow_ipv4_options.go create mode 100644 gosnappi/flow_ipv4_options_custom.go create mode 100644 gosnappi/flow_ipv4_options_custom_length.go create mode 100644 gosnappi/flow_ipv4_options_custom_type.go create mode 100644 gosnappi/flow_ipv4_priority.go create mode 100644 gosnappi/flow_ipv4_tos.go create mode 100644 gosnappi/flow_ipv6.go create mode 100644 gosnappi/flow_latency_metrics.go create mode 100644 gosnappi/flow_metric.go create mode 100644 gosnappi/flow_metric_tag.go create mode 100644 gosnappi/flow_metric_tag_filter.go create mode 100644 gosnappi/flow_metric_tag_value.go create mode 100644 gosnappi/flow_metrics.go create mode 100644 gosnappi/flow_metrics_request.go create mode 100644 gosnappi/flow_mpls.go create mode 100644 gosnappi/flow_pfc_pause.go create mode 100644 gosnappi/flow_port.go create mode 100644 gosnappi/flow_ppp.go create mode 100644 gosnappi/flow_predefined_tags.go create mode 100644 gosnappi/flow_rate.go create mode 100644 gosnappi/flow_router.go create mode 100644 gosnappi/flow_rsvp.go create mode 100644 gosnappi/flow_rsvp_explicit_route_as_number_length.go create mode 100644 gosnappi/flow_rsvp_explicit_route_length.go create mode 100644 gosnappi/flow_rsvp_length.go create mode 100644 gosnappi/flow_rsvp_lsp_tunnel_flag.go create mode 100644 gosnappi/flow_rsvp_message.go create mode 100644 gosnappi/flow_rsvp_object_length.go create mode 100644 gosnappi/flow_rsvp_path_explicit_route_type1.go create mode 100644 gosnappi/flow_rsvp_path_explicit_route_type1_as_number.go create mode 100644 gosnappi/flow_rsvp_path_explicit_route_type1_ipv4_prefix.go create mode 100644 gosnappi/flow_rsvp_path_label_request_without_label_range.go create mode 100644 gosnappi/flow_rsvp_path_message.go create mode 100644 gosnappi/flow_rsvp_path_objects.go create mode 100644 gosnappi/flow_rsvp_path_objects_class.go create mode 100644 gosnappi/flow_rsvp_path_objects_class_explicit_route.go create mode 100644 gosnappi/flow_rsvp_path_objects_class_explicit_route_c_type.go create mode 100644 gosnappi/flow_rsvp_path_objects_class_label_request.go create mode 100644 gosnappi/flow_rsvp_path_objects_class_record_route.go create mode 100644 gosnappi/flow_rsvp_path_objects_class_rsvp_hop.go create mode 100644 gosnappi/flow_rsvp_path_objects_class_sender_template.go create mode 100644 gosnappi/flow_rsvp_path_objects_class_sender_tspec.go create mode 100644 gosnappi/flow_rsvp_path_objects_class_session.go create mode 100644 gosnappi/flow_rsvp_path_objects_class_session_attribute.go create mode 100644 gosnappi/flow_rsvp_path_objects_class_time_values.go create mode 100644 gosnappi/flow_rsvp_path_objects_custom.go create mode 100644 gosnappi/flow_rsvp_path_objects_label_request_c_type.go create mode 100644 gosnappi/flow_rsvp_path_objects_record_route_c_type.go create mode 100644 gosnappi/flow_rsvp_path_objects_record_route_sub_object_type.go create mode 100644 gosnappi/flow_rsvp_path_objects_rsvp_hop_c_type.go create mode 100644 gosnappi/flow_rsvp_path_objects_sender_template_c_type.go create mode 100644 gosnappi/flow_rsvp_path_objects_sender_tspec_c_type.go create mode 100644 gosnappi/flow_rsvp_path_objects_session_attribute_c_type.go create mode 100644 gosnappi/flow_rsvp_path_objects_session_c_type.go create mode 100644 gosnappi/flow_rsvp_path_objects_time_values_c_type.go create mode 100644 gosnappi/flow_rsvp_path_record_route_label.go create mode 100644 gosnappi/flow_rsvp_path_record_route_type1.go create mode 100644 gosnappi/flow_rsvp_path_record_route_type1_ipv4_address.go create mode 100644 gosnappi/flow_rsvp_path_record_route_type1_label.go create mode 100644 gosnappi/flow_rsvp_path_rsvp_hop_ipv4.go create mode 100644 gosnappi/flow_rsvp_path_sender_template_lsp_tunnel_ipv4.go create mode 100644 gosnappi/flow_rsvp_path_sender_tspec_int_serv.go create mode 100644 gosnappi/flow_rsvp_path_session_attribute_lsp_tunnel.go create mode 100644 gosnappi/flow_rsvp_path_session_attribute_lsp_tunnel_ra.go create mode 100644 gosnappi/flow_rsvp_path_session_ext_tunnel_id.go create mode 100644 gosnappi/flow_rsvp_path_session_lsp_tunnel_ipv4.go create mode 100644 gosnappi/flow_rsvp_path_time_values_type1.go create mode 100644 gosnappi/flow_rsvp_record_route_i_pv4_flag.go create mode 100644 gosnappi/flow_rsvp_route_record_length.go create mode 100644 gosnappi/flow_rsvp_session_attribute_name_length.go create mode 100644 gosnappi/flow_rsvp_type1_explicit_route_subobjects.go create mode 100644 gosnappi/flow_rsvp_type1_explicit_route_subobjects_type.go create mode 100644 gosnappi/flow_rsvp_type1_record_route_subobjects.go create mode 100644 gosnappi/flow_rx_tx_ratio.go create mode 100644 gosnappi/flow_rx_tx_ratio_rx_count.go create mode 100644 gosnappi/flow_size.go create mode 100644 gosnappi/flow_size_increment.go create mode 100644 gosnappi/flow_size_random.go create mode 100644 gosnappi/flow_size_weight_pairs.go create mode 100644 gosnappi/flow_size_weight_pairs_custom.go create mode 100644 gosnappi/flow_snmpv2_c.go create mode 100644 gosnappi/flow_snmpv2_c_bulk_pdu.go create mode 100644 gosnappi/flow_snmpv2_c_data.go create mode 100644 gosnappi/flow_snmpv2_c_variable_binding.go create mode 100644 gosnappi/flow_snmpv2_c_variable_binding_string_value.go create mode 100644 gosnappi/flow_snmpv2_c_variable_binding_value.go create mode 100644 gosnappi/flow_snmpv2_cpdu.go create mode 100644 gosnappi/flow_tagged_metric.go create mode 100644 gosnappi/flow_tagged_metrics_filter.go create mode 100644 gosnappi/flow_tcp.go create mode 100644 gosnappi/flow_tx_rx.go create mode 100644 gosnappi/flow_udp.go create mode 100644 gosnappi/flow_vlan.go create mode 100644 gosnappi/flow_vxlan.go create mode 100644 gosnappi/flows_update.go create mode 100644 gosnappi/get_capture_response.go create mode 100644 gosnappi/get_config_response.go create mode 100644 gosnappi/get_metrics_response.go create mode 100644 gosnappi/get_states_response.go create mode 100644 gosnappi/get_version_response.go create mode 100644 gosnappi/isis_advanced.go create mode 100644 gosnappi/isis_authentication.go create mode 100644 gosnappi/isis_authentication_base.go create mode 100644 gosnappi/isis_basic.go create mode 100644 gosnappi/isis_interface.go create mode 100644 gosnappi/isis_interface_advanced.go create mode 100644 gosnappi/isis_interface_authentication.go create mode 100644 gosnappi/isis_interface_level.go create mode 100644 gosnappi/isis_interface_link_protection.go create mode 100644 gosnappi/isis_lsp_extended_ipv4_reachability_tlv.go create mode 100644 gosnappi/isis_lsp_extended_is_reachability_tlv.go create mode 100644 gosnappi/isis_lsp_extended_v4_prefix.go create mode 100644 gosnappi/isis_lsp_flags.go create mode 100644 gosnappi/isis_lsp_hostname.go create mode 100644 gosnappi/isis_lsp_ipv4_external_reachability_tlv.go create mode 100644 gosnappi/isis_lsp_ipv4_internal_reachability_tlv.go create mode 100644 gosnappi/isis_lsp_ipv6_reachability_tlv.go create mode 100644 gosnappi/isis_lsp_is_reachability_tlv.go create mode 100644 gosnappi/isis_lsp_prefix_attributes.go create mode 100644 gosnappi/isis_lsp_state.go create mode 100644 gosnappi/isis_lsp_tlvs.go create mode 100644 gosnappi/isis_lsp_v4_prefix.go create mode 100644 gosnappi/isis_lsp_v6_prefix.go create mode 100644 gosnappi/isis_lspneighbor.go create mode 100644 gosnappi/isis_lsps_state.go create mode 100644 gosnappi/isis_lsps_state_request.go create mode 100644 gosnappi/isis_metric.go create mode 100644 gosnappi/isis_metrics_request.go create mode 100644 gosnappi/isis_mt.go create mode 100644 gosnappi/isis_v4_route_range.go create mode 100644 gosnappi/isis_v6_route_range.go create mode 100644 gosnappi/lacp_metric.go create mode 100644 gosnappi/lacp_metrics_request.go create mode 100644 gosnappi/lag.go create mode 100644 gosnappi/lag_metric.go create mode 100644 gosnappi/lag_metrics_request.go create mode 100644 gosnappi/lag_port.go create mode 100644 gosnappi/lag_port_lacp.go create mode 100644 gosnappi/lag_protocol.go create mode 100644 gosnappi/lag_protocol_lacp.go create mode 100644 gosnappi/lag_protocol_static.go create mode 100644 gosnappi/layer1.go create mode 100644 gosnappi/layer1_auto_negotiation.go create mode 100644 gosnappi/layer1_flow_control.go create mode 100644 gosnappi/layer1_ieee8021_qbb.go create mode 100644 gosnappi/layer1_ieee8023_x.go create mode 100644 gosnappi/link_state_te.go create mode 100644 gosnappi/link_statepriority_bandwidths.go create mode 100644 gosnappi/lldp.go create mode 100644 gosnappi/lldp_capability_state.go create mode 100644 gosnappi/lldp_chassis_id.go create mode 100644 gosnappi/lldp_chassis_mac_sub_type.go create mode 100644 gosnappi/lldp_connection.go create mode 100644 gosnappi/lldp_custom_tlv_state.go create mode 100644 gosnappi/lldp_metric.go create mode 100644 gosnappi/lldp_metrics_request.go create mode 100644 gosnappi/lldp_neighbors_state.go create mode 100644 gosnappi/lldp_neighbors_state_request.go create mode 100644 gosnappi/lldp_port_id.go create mode 100644 gosnappi/lldp_port_interface_name_sub_type.go create mode 100644 gosnappi/lldp_system_name.go create mode 100644 gosnappi/mac_route_address.go create mode 100644 gosnappi/metric_latency.go create mode 100644 gosnappi/metric_timestamp.go create mode 100644 gosnappi/metrics_request.go create mode 100644 gosnappi/metrics_response.go create mode 100644 gosnappi/neighborsv4_state.go create mode 100644 gosnappi/neighborsv4_states_request.go create mode 100644 gosnappi/neighborsv6_state.go create mode 100644 gosnappi/neighborsv6_states_request.go create mode 100644 gosnappi/pattern_flow_arp_hardware_length.go create mode 100644 gosnappi/pattern_flow_arp_hardware_length_counter.go create mode 100644 gosnappi/pattern_flow_arp_hardware_length_metric_tag.go create mode 100644 gosnappi/pattern_flow_arp_hardware_type.go create mode 100644 gosnappi/pattern_flow_arp_hardware_type_counter.go create mode 100644 gosnappi/pattern_flow_arp_hardware_type_metric_tag.go create mode 100644 gosnappi/pattern_flow_arp_operation.go create mode 100644 gosnappi/pattern_flow_arp_operation_counter.go create mode 100644 gosnappi/pattern_flow_arp_operation_metric_tag.go create mode 100644 gosnappi/pattern_flow_arp_protocol_length.go create mode 100644 gosnappi/pattern_flow_arp_protocol_length_counter.go create mode 100644 gosnappi/pattern_flow_arp_protocol_length_metric_tag.go create mode 100644 gosnappi/pattern_flow_arp_protocol_type.go create mode 100644 gosnappi/pattern_flow_arp_protocol_type_counter.go create mode 100644 gosnappi/pattern_flow_arp_protocol_type_metric_tag.go create mode 100644 gosnappi/pattern_flow_arp_sender_hardware_addr.go create mode 100644 gosnappi/pattern_flow_arp_sender_hardware_addr_counter.go create mode 100644 gosnappi/pattern_flow_arp_sender_hardware_addr_metric_tag.go create mode 100644 gosnappi/pattern_flow_arp_sender_protocol_addr.go create mode 100644 gosnappi/pattern_flow_arp_sender_protocol_addr_counter.go create mode 100644 gosnappi/pattern_flow_arp_sender_protocol_addr_metric_tag.go create mode 100644 gosnappi/pattern_flow_arp_target_hardware_addr.go create mode 100644 gosnappi/pattern_flow_arp_target_hardware_addr_counter.go create mode 100644 gosnappi/pattern_flow_arp_target_hardware_addr_metric_tag.go create mode 100644 gosnappi/pattern_flow_arp_target_protocol_addr.go create mode 100644 gosnappi/pattern_flow_arp_target_protocol_addr_counter.go create mode 100644 gosnappi/pattern_flow_arp_target_protocol_addr_metric_tag.go create mode 100644 gosnappi/pattern_flow_ethernet_dst.go create mode 100644 gosnappi/pattern_flow_ethernet_dst_counter.go create mode 100644 gosnappi/pattern_flow_ethernet_dst_metric_tag.go create mode 100644 gosnappi/pattern_flow_ethernet_ether_type.go create mode 100644 gosnappi/pattern_flow_ethernet_ether_type_counter.go create mode 100644 gosnappi/pattern_flow_ethernet_ether_type_metric_tag.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_control_op_code.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_control_op_code_counter.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_control_op_code_metric_tag.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_dst.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_dst_counter.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_dst_metric_tag.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_ether_type.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_ether_type_counter.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_ether_type_metric_tag.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_src.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_src_counter.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_src_metric_tag.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_time.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_time_counter.go create mode 100644 gosnappi/pattern_flow_ethernet_pause_time_metric_tag.go create mode 100644 gosnappi/pattern_flow_ethernet_pfc_queue.go create mode 100644 gosnappi/pattern_flow_ethernet_pfc_queue_counter.go create mode 100644 gosnappi/pattern_flow_ethernet_pfc_queue_metric_tag.go create mode 100644 gosnappi/pattern_flow_ethernet_src.go create mode 100644 gosnappi/pattern_flow_ethernet_src_counter.go create mode 100644 gosnappi/pattern_flow_ethernet_src_metric_tag.go create mode 100644 gosnappi/pattern_flow_gre_checksum.go create mode 100644 gosnappi/pattern_flow_gre_checksum_present.go create mode 100644 gosnappi/pattern_flow_gre_checksum_present_counter.go create mode 100644 gosnappi/pattern_flow_gre_checksum_present_metric_tag.go create mode 100644 gosnappi/pattern_flow_gre_protocol.go create mode 100644 gosnappi/pattern_flow_gre_protocol_counter.go create mode 100644 gosnappi/pattern_flow_gre_protocol_metric_tag.go create mode 100644 gosnappi/pattern_flow_gre_reserved0.go create mode 100644 gosnappi/pattern_flow_gre_reserved0_counter.go create mode 100644 gosnappi/pattern_flow_gre_reserved0_metric_tag.go create mode 100644 gosnappi/pattern_flow_gre_reserved1.go create mode 100644 gosnappi/pattern_flow_gre_reserved1_counter.go create mode 100644 gosnappi/pattern_flow_gre_reserved1_metric_tag.go create mode 100644 gosnappi/pattern_flow_gre_version.go create mode 100644 gosnappi/pattern_flow_gre_version_counter.go create mode 100644 gosnappi/pattern_flow_gre_version_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtp_extension_contents.go create mode 100644 gosnappi/pattern_flow_gtp_extension_contents_counter.go create mode 100644 gosnappi/pattern_flow_gtp_extension_contents_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtp_extension_extension_length.go create mode 100644 gosnappi/pattern_flow_gtp_extension_extension_length_counter.go create mode 100644 gosnappi/pattern_flow_gtp_extension_extension_length_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtp_extension_next_extension_header.go create mode 100644 gosnappi/pattern_flow_gtp_extension_next_extension_header_counter.go create mode 100644 gosnappi/pattern_flow_gtp_extension_next_extension_header_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv1_e_flag.go create mode 100644 gosnappi/pattern_flow_gtpv1_e_flag_counter.go create mode 100644 gosnappi/pattern_flow_gtpv1_e_flag_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv1_message_length.go create mode 100644 gosnappi/pattern_flow_gtpv1_message_length_counter.go create mode 100644 gosnappi/pattern_flow_gtpv1_message_length_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv1_message_type.go create mode 100644 gosnappi/pattern_flow_gtpv1_message_type_counter.go create mode 100644 gosnappi/pattern_flow_gtpv1_message_type_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv1_n_pdu_number.go create mode 100644 gosnappi/pattern_flow_gtpv1_n_pdu_number_counter.go create mode 100644 gosnappi/pattern_flow_gtpv1_n_pdu_number_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv1_next_extension_header_type.go create mode 100644 gosnappi/pattern_flow_gtpv1_next_extension_header_type_counter.go create mode 100644 gosnappi/pattern_flow_gtpv1_next_extension_header_type_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv1_pn_flag.go create mode 100644 gosnappi/pattern_flow_gtpv1_pn_flag_counter.go create mode 100644 gosnappi/pattern_flow_gtpv1_pn_flag_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv1_protocol_type.go create mode 100644 gosnappi/pattern_flow_gtpv1_protocol_type_counter.go create mode 100644 gosnappi/pattern_flow_gtpv1_protocol_type_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv1_reserved.go create mode 100644 gosnappi/pattern_flow_gtpv1_reserved_counter.go create mode 100644 gosnappi/pattern_flow_gtpv1_reserved_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv1_s_flag.go create mode 100644 gosnappi/pattern_flow_gtpv1_s_flag_counter.go create mode 100644 gosnappi/pattern_flow_gtpv1_s_flag_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv1_squence_number.go create mode 100644 gosnappi/pattern_flow_gtpv1_squence_number_counter.go create mode 100644 gosnappi/pattern_flow_gtpv1_squence_number_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv1_teid.go create mode 100644 gosnappi/pattern_flow_gtpv1_teid_counter.go create mode 100644 gosnappi/pattern_flow_gtpv1_teid_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv1_version.go create mode 100644 gosnappi/pattern_flow_gtpv1_version_counter.go create mode 100644 gosnappi/pattern_flow_gtpv1_version_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv2_message_length.go create mode 100644 gosnappi/pattern_flow_gtpv2_message_length_counter.go create mode 100644 gosnappi/pattern_flow_gtpv2_message_length_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv2_message_type.go create mode 100644 gosnappi/pattern_flow_gtpv2_message_type_counter.go create mode 100644 gosnappi/pattern_flow_gtpv2_message_type_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv2_piggybacking_flag.go create mode 100644 gosnappi/pattern_flow_gtpv2_piggybacking_flag_counter.go create mode 100644 gosnappi/pattern_flow_gtpv2_piggybacking_flag_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv2_sequence_number.go create mode 100644 gosnappi/pattern_flow_gtpv2_sequence_number_counter.go create mode 100644 gosnappi/pattern_flow_gtpv2_sequence_number_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv2_spare1.go create mode 100644 gosnappi/pattern_flow_gtpv2_spare1_counter.go create mode 100644 gosnappi/pattern_flow_gtpv2_spare1_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv2_spare2.go create mode 100644 gosnappi/pattern_flow_gtpv2_spare2_counter.go create mode 100644 gosnappi/pattern_flow_gtpv2_spare2_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv2_teid.go create mode 100644 gosnappi/pattern_flow_gtpv2_teid_counter.go create mode 100644 gosnappi/pattern_flow_gtpv2_teid_flag.go create mode 100644 gosnappi/pattern_flow_gtpv2_teid_flag_counter.go create mode 100644 gosnappi/pattern_flow_gtpv2_teid_flag_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv2_teid_metric_tag.go create mode 100644 gosnappi/pattern_flow_gtpv2_version.go create mode 100644 gosnappi/pattern_flow_gtpv2_version_counter.go create mode 100644 gosnappi/pattern_flow_gtpv2_version_metric_tag.go create mode 100644 gosnappi/pattern_flow_icmp_echo_checksum.go create mode 100644 gosnappi/pattern_flow_icmp_echo_code.go create mode 100644 gosnappi/pattern_flow_icmp_echo_code_counter.go create mode 100644 gosnappi/pattern_flow_icmp_echo_code_metric_tag.go create mode 100644 gosnappi/pattern_flow_icmp_echo_identifier.go create mode 100644 gosnappi/pattern_flow_icmp_echo_identifier_counter.go create mode 100644 gosnappi/pattern_flow_icmp_echo_identifier_metric_tag.go create mode 100644 gosnappi/pattern_flow_icmp_echo_sequence_number.go create mode 100644 gosnappi/pattern_flow_icmp_echo_sequence_number_counter.go create mode 100644 gosnappi/pattern_flow_icmp_echo_sequence_number_metric_tag.go create mode 100644 gosnappi/pattern_flow_icmp_echo_type.go create mode 100644 gosnappi/pattern_flow_icmp_echo_type_counter.go create mode 100644 gosnappi/pattern_flow_icmp_echo_type_metric_tag.go create mode 100644 gosnappi/pattern_flow_icmpv6_echo_checksum.go create mode 100644 gosnappi/pattern_flow_icmpv6_echo_code.go create mode 100644 gosnappi/pattern_flow_icmpv6_echo_code_counter.go create mode 100644 gosnappi/pattern_flow_icmpv6_echo_code_metric_tag.go create mode 100644 gosnappi/pattern_flow_icmpv6_echo_identifier.go create mode 100644 gosnappi/pattern_flow_icmpv6_echo_identifier_counter.go create mode 100644 gosnappi/pattern_flow_icmpv6_echo_identifier_metric_tag.go create mode 100644 gosnappi/pattern_flow_icmpv6_echo_sequence_number.go create mode 100644 gosnappi/pattern_flow_icmpv6_echo_sequence_number_counter.go create mode 100644 gosnappi/pattern_flow_icmpv6_echo_sequence_number_metric_tag.go create mode 100644 gosnappi/pattern_flow_icmpv6_echo_type.go create mode 100644 gosnappi/pattern_flow_icmpv6_echo_type_counter.go create mode 100644 gosnappi/pattern_flow_icmpv6_echo_type_metric_tag.go create mode 100644 gosnappi/pattern_flow_igmpv1_checksum.go create mode 100644 gosnappi/pattern_flow_igmpv1_group_address.go create mode 100644 gosnappi/pattern_flow_igmpv1_group_address_counter.go create mode 100644 gosnappi/pattern_flow_igmpv1_group_address_metric_tag.go create mode 100644 gosnappi/pattern_flow_igmpv1_type.go create mode 100644 gosnappi/pattern_flow_igmpv1_type_counter.go create mode 100644 gosnappi/pattern_flow_igmpv1_type_metric_tag.go create mode 100644 gosnappi/pattern_flow_igmpv1_unused.go create mode 100644 gosnappi/pattern_flow_igmpv1_unused_counter.go create mode 100644 gosnappi/pattern_flow_igmpv1_unused_metric_tag.go create mode 100644 gosnappi/pattern_flow_igmpv1_version.go create mode 100644 gosnappi/pattern_flow_igmpv1_version_counter.go create mode 100644 gosnappi/pattern_flow_igmpv1_version_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_dont_fragment.go create mode 100644 gosnappi/pattern_flow_ipv4_dont_fragment_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_dont_fragment_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_dscp_ecn.go create mode 100644 gosnappi/pattern_flow_ipv4_dscp_ecn_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_dscp_ecn_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_dscp_phb.go create mode 100644 gosnappi/pattern_flow_ipv4_dscp_phb_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_dscp_phb_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_dst.go create mode 100644 gosnappi/pattern_flow_ipv4_dst_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_dst_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_dst_random.go create mode 100644 gosnappi/pattern_flow_ipv4_fragment_offset.go create mode 100644 gosnappi/pattern_flow_ipv4_fragment_offset_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_fragment_offset_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_header_checksum.go create mode 100644 gosnappi/pattern_flow_ipv4_header_length.go create mode 100644 gosnappi/pattern_flow_ipv4_header_length_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_header_length_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_identification.go create mode 100644 gosnappi/pattern_flow_ipv4_identification_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_identification_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_more_fragments.go create mode 100644 gosnappi/pattern_flow_ipv4_more_fragments_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_more_fragments_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_options_custom_type_copied_flag.go create mode 100644 gosnappi/pattern_flow_ipv4_options_custom_type_copied_flag_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_options_custom_type_option_class.go create mode 100644 gosnappi/pattern_flow_ipv4_options_custom_type_option_class_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_options_custom_type_option_number.go create mode 100644 gosnappi/pattern_flow_ipv4_options_custom_type_option_number_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_priority_raw.go create mode 100644 gosnappi/pattern_flow_ipv4_priority_raw_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_priority_raw_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_protocol.go create mode 100644 gosnappi/pattern_flow_ipv4_protocol_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_protocol_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_reserved.go create mode 100644 gosnappi/pattern_flow_ipv4_reserved_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_reserved_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_src.go create mode 100644 gosnappi/pattern_flow_ipv4_src_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_src_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_src_random.go create mode 100644 gosnappi/pattern_flow_ipv4_time_to_live.go create mode 100644 gosnappi/pattern_flow_ipv4_time_to_live_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_time_to_live_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_delay.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_delay_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_delay_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_monetary.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_monetary_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_monetary_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_precedence.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_precedence_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_precedence_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_reliability.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_reliability_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_reliability_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_throughput.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_throughput_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_throughput_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_unused.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_unused_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_tos_unused_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_total_length.go create mode 100644 gosnappi/pattern_flow_ipv4_total_length_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_total_length_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv4_version.go create mode 100644 gosnappi/pattern_flow_ipv4_version_counter.go create mode 100644 gosnappi/pattern_flow_ipv4_version_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv6_dst.go create mode 100644 gosnappi/pattern_flow_ipv6_dst_counter.go create mode 100644 gosnappi/pattern_flow_ipv6_dst_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv6_flow_label.go create mode 100644 gosnappi/pattern_flow_ipv6_flow_label_counter.go create mode 100644 gosnappi/pattern_flow_ipv6_flow_label_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv6_flow_label_random.go create mode 100644 gosnappi/pattern_flow_ipv6_hop_limit.go create mode 100644 gosnappi/pattern_flow_ipv6_hop_limit_counter.go create mode 100644 gosnappi/pattern_flow_ipv6_hop_limit_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv6_next_header.go create mode 100644 gosnappi/pattern_flow_ipv6_next_header_counter.go create mode 100644 gosnappi/pattern_flow_ipv6_next_header_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv6_payload_length.go create mode 100644 gosnappi/pattern_flow_ipv6_payload_length_counter.go create mode 100644 gosnappi/pattern_flow_ipv6_payload_length_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv6_src.go create mode 100644 gosnappi/pattern_flow_ipv6_src_counter.go create mode 100644 gosnappi/pattern_flow_ipv6_src_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv6_traffic_class.go create mode 100644 gosnappi/pattern_flow_ipv6_traffic_class_counter.go create mode 100644 gosnappi/pattern_flow_ipv6_traffic_class_metric_tag.go create mode 100644 gosnappi/pattern_flow_ipv6_version.go create mode 100644 gosnappi/pattern_flow_ipv6_version_counter.go create mode 100644 gosnappi/pattern_flow_ipv6_version_metric_tag.go create mode 100644 gosnappi/pattern_flow_mpls_bottom_of_stack.go create mode 100644 gosnappi/pattern_flow_mpls_bottom_of_stack_counter.go create mode 100644 gosnappi/pattern_flow_mpls_bottom_of_stack_metric_tag.go create mode 100644 gosnappi/pattern_flow_mpls_label.go create mode 100644 gosnappi/pattern_flow_mpls_label_counter.go create mode 100644 gosnappi/pattern_flow_mpls_label_metric_tag.go create mode 100644 gosnappi/pattern_flow_mpls_time_to_live.go create mode 100644 gosnappi/pattern_flow_mpls_time_to_live_counter.go create mode 100644 gosnappi/pattern_flow_mpls_time_to_live_metric_tag.go create mode 100644 gosnappi/pattern_flow_mpls_traffic_class.go create mode 100644 gosnappi/pattern_flow_mpls_traffic_class_counter.go create mode 100644 gosnappi/pattern_flow_mpls_traffic_class_metric_tag.go create mode 100644 gosnappi/pattern_flow_pfc_pause_class_enable_vector.go create mode 100644 gosnappi/pattern_flow_pfc_pause_class_enable_vector_counter.go create mode 100644 gosnappi/pattern_flow_pfc_pause_class_enable_vector_metric_tag.go create mode 100644 gosnappi/pattern_flow_pfc_pause_control_op_code.go create mode 100644 gosnappi/pattern_flow_pfc_pause_control_op_code_counter.go create mode 100644 gosnappi/pattern_flow_pfc_pause_control_op_code_metric_tag.go create mode 100644 gosnappi/pattern_flow_pfc_pause_dst.go create mode 100644 gosnappi/pattern_flow_pfc_pause_dst_counter.go create mode 100644 gosnappi/pattern_flow_pfc_pause_dst_metric_tag.go create mode 100644 gosnappi/pattern_flow_pfc_pause_ether_type.go create mode 100644 gosnappi/pattern_flow_pfc_pause_ether_type_counter.go create mode 100644 gosnappi/pattern_flow_pfc_pause_ether_type_metric_tag.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class0.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class0_counter.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class0_metric_tag.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class1.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class1_counter.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class1_metric_tag.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class2.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class2_counter.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class2_metric_tag.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class3.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class3_counter.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class3_metric_tag.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class4.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class4_counter.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class4_metric_tag.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class5.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class5_counter.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class5_metric_tag.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class6.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class6_counter.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class6_metric_tag.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class7.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class7_counter.go create mode 100644 gosnappi/pattern_flow_pfc_pause_pause_class7_metric_tag.go create mode 100644 gosnappi/pattern_flow_pfc_pause_src.go create mode 100644 gosnappi/pattern_flow_pfc_pause_src_counter.go create mode 100644 gosnappi/pattern_flow_pfc_pause_src_metric_tag.go create mode 100644 gosnappi/pattern_flow_ppp_address.go create mode 100644 gosnappi/pattern_flow_ppp_address_counter.go create mode 100644 gosnappi/pattern_flow_ppp_address_metric_tag.go create mode 100644 gosnappi/pattern_flow_ppp_control.go create mode 100644 gosnappi/pattern_flow_ppp_control_counter.go create mode 100644 gosnappi/pattern_flow_ppp_control_metric_tag.go create mode 100644 gosnappi/pattern_flow_ppp_protocol_type.go create mode 100644 gosnappi/pattern_flow_ppp_protocol_type_counter.go create mode 100644 gosnappi/pattern_flow_ppp_protocol_type_metric_tag.go create mode 100644 gosnappi/pattern_flow_rsvp_path_explicit_route_type1_as_number_l_bit.go create mode 100644 gosnappi/pattern_flow_rsvp_path_explicit_route_type1_as_number_l_bit_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_ipv4_address.go create mode 100644 gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_ipv4_address_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_l_bit.go create mode 100644 gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_l_bit_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_l3_pid.go create mode 100644 gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_l3_pid_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_reserved.go create mode 100644 gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_reserved_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_objects_custom_type.go create mode 100644 gosnappi/pattern_flow_rsvp_path_objects_custom_type_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_ipv4_address.go create mode 100644 gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_ipv4_address_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_prefix_length.go create mode 100644 gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_prefix_length_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_record_route_type1_label_c_type.go create mode 100644 gosnappi/pattern_flow_rsvp_path_record_route_type1_label_flags.go create mode 100644 gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_ipv4_address.go create mode 100644 gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_ipv4_address_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_logical_interface_handle.go create mode 100644 gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_logical_interface_handle_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_ipv4_tunnel_sender_address.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_ipv4_tunnel_sender_address_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_lsp_id.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_lsp_id_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_reserved.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_reserved_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_length_of_service_data.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_length_of_service_data_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_maximum_packet_size.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_maximum_packet_size_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_minimum_policed_unit.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_minimum_policed_unit_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_overall_length.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_overall_length_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_flag.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_flag_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_length.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_length_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter_id_token_bucket_tspec.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter_id_token_bucket_tspec_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved1.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved1_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved2.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved2_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_service_header.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_service_header_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_version.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_version_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_zero_bit.go create mode 100644 gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_zero_bit_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_integer.go create mode 100644 gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_integer_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_ipv4.go create mode 100644 gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_ipv4_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_ipv4_tunnel_end_point_address.go create mode 100644 gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_ipv4_tunnel_end_point_address_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_reserved.go create mode 100644 gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_reserved_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_tunnel_id.go create mode 100644 gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_tunnel_id_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_path_time_values_type1_refresh_period_r.go create mode 100644 gosnappi/pattern_flow_rsvp_path_time_values_type1_refresh_period_r_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_reserved.go create mode 100644 gosnappi/pattern_flow_rsvp_reserved_counter.go create mode 100644 gosnappi/pattern_flow_rsvp_rsvp_checksum.go create mode 100644 gosnappi/pattern_flow_rsvp_time_to_live.go create mode 100644 gosnappi/pattern_flow_rsvp_time_to_live_counter.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_bulk_pdu_max_repetitions.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_bulk_pdu_max_repetitions_counter.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_bulk_pdu_non_repeaters.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_bulk_pdu_request_id.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_bulk_pdu_request_id_counter.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_variable_binding_value_big_counter_value.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_variable_binding_value_big_counter_value_counter.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_variable_binding_value_counter_value.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_variable_binding_value_counter_value_counter.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_variable_binding_value_integer_value.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_variable_binding_value_integer_value_counter.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_variable_binding_value_ip_address_value.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_variable_binding_value_ip_address_value_counter.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_variable_binding_value_timeticks_value.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_variable_binding_value_timeticks_value_counter.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_variable_binding_value_unsigned_integer_value.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_variable_binding_value_unsigned_integer_value_counter.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_version.go create mode 100644 gosnappi/pattern_flow_snmpv2_c_version_counter.go create mode 100644 gosnappi/pattern_flow_snmpv2_cpdu_error_index.go create mode 100644 gosnappi/pattern_flow_snmpv2_cpdu_error_index_counter.go create mode 100644 gosnappi/pattern_flow_snmpv2_cpdu_request_id.go create mode 100644 gosnappi/pattern_flow_snmpv2_cpdu_request_id_counter.go create mode 100644 gosnappi/pattern_flow_tcp_ack_num.go create mode 100644 gosnappi/pattern_flow_tcp_ack_num_counter.go create mode 100644 gosnappi/pattern_flow_tcp_ack_num_metric_tag.go create mode 100644 gosnappi/pattern_flow_tcp_checksum.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_ack.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_ack_counter.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_ack_metric_tag.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_fin.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_fin_counter.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_fin_metric_tag.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_psh.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_psh_counter.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_psh_metric_tag.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_rst.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_rst_counter.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_rst_metric_tag.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_syn.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_syn_counter.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_syn_metric_tag.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_urg.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_urg_counter.go create mode 100644 gosnappi/pattern_flow_tcp_ctl_urg_metric_tag.go create mode 100644 gosnappi/pattern_flow_tcp_data_offset.go create mode 100644 gosnappi/pattern_flow_tcp_data_offset_counter.go create mode 100644 gosnappi/pattern_flow_tcp_data_offset_metric_tag.go create mode 100644 gosnappi/pattern_flow_tcp_dst_port.go create mode 100644 gosnappi/pattern_flow_tcp_dst_port_counter.go create mode 100644 gosnappi/pattern_flow_tcp_dst_port_metric_tag.go create mode 100644 gosnappi/pattern_flow_tcp_dst_port_random.go create mode 100644 gosnappi/pattern_flow_tcp_ecn_cwr.go create mode 100644 gosnappi/pattern_flow_tcp_ecn_cwr_counter.go create mode 100644 gosnappi/pattern_flow_tcp_ecn_cwr_metric_tag.go create mode 100644 gosnappi/pattern_flow_tcp_ecn_echo.go create mode 100644 gosnappi/pattern_flow_tcp_ecn_echo_counter.go create mode 100644 gosnappi/pattern_flow_tcp_ecn_echo_metric_tag.go create mode 100644 gosnappi/pattern_flow_tcp_ecn_ns.go create mode 100644 gosnappi/pattern_flow_tcp_ecn_ns_counter.go create mode 100644 gosnappi/pattern_flow_tcp_ecn_ns_metric_tag.go create mode 100644 gosnappi/pattern_flow_tcp_seq_num.go create mode 100644 gosnappi/pattern_flow_tcp_seq_num_counter.go create mode 100644 gosnappi/pattern_flow_tcp_seq_num_metric_tag.go create mode 100644 gosnappi/pattern_flow_tcp_src_port.go create mode 100644 gosnappi/pattern_flow_tcp_src_port_counter.go create mode 100644 gosnappi/pattern_flow_tcp_src_port_metric_tag.go create mode 100644 gosnappi/pattern_flow_tcp_src_port_random.go create mode 100644 gosnappi/pattern_flow_tcp_window.go create mode 100644 gosnappi/pattern_flow_tcp_window_counter.go create mode 100644 gosnappi/pattern_flow_tcp_window_metric_tag.go create mode 100644 gosnappi/pattern_flow_udp_checksum.go create mode 100644 gosnappi/pattern_flow_udp_dst_port.go create mode 100644 gosnappi/pattern_flow_udp_dst_port_counter.go create mode 100644 gosnappi/pattern_flow_udp_dst_port_metric_tag.go create mode 100644 gosnappi/pattern_flow_udp_dst_port_random.go create mode 100644 gosnappi/pattern_flow_udp_length.go create mode 100644 gosnappi/pattern_flow_udp_length_counter.go create mode 100644 gosnappi/pattern_flow_udp_length_metric_tag.go create mode 100644 gosnappi/pattern_flow_udp_src_port.go create mode 100644 gosnappi/pattern_flow_udp_src_port_counter.go create mode 100644 gosnappi/pattern_flow_udp_src_port_metric_tag.go create mode 100644 gosnappi/pattern_flow_udp_src_port_random.go create mode 100644 gosnappi/pattern_flow_vlan_cfi.go create mode 100644 gosnappi/pattern_flow_vlan_cfi_counter.go create mode 100644 gosnappi/pattern_flow_vlan_cfi_metric_tag.go create mode 100644 gosnappi/pattern_flow_vlan_id.go create mode 100644 gosnappi/pattern_flow_vlan_id_counter.go create mode 100644 gosnappi/pattern_flow_vlan_id_metric_tag.go create mode 100644 gosnappi/pattern_flow_vlan_priority.go create mode 100644 gosnappi/pattern_flow_vlan_priority_counter.go create mode 100644 gosnappi/pattern_flow_vlan_priority_metric_tag.go create mode 100644 gosnappi/pattern_flow_vlan_tpid.go create mode 100644 gosnappi/pattern_flow_vlan_tpid_counter.go create mode 100644 gosnappi/pattern_flow_vlan_tpid_metric_tag.go create mode 100644 gosnappi/pattern_flow_vxlan_flags.go create mode 100644 gosnappi/pattern_flow_vxlan_flags_counter.go create mode 100644 gosnappi/pattern_flow_vxlan_flags_metric_tag.go create mode 100644 gosnappi/pattern_flow_vxlan_reserved0.go create mode 100644 gosnappi/pattern_flow_vxlan_reserved0_counter.go create mode 100644 gosnappi/pattern_flow_vxlan_reserved0_metric_tag.go create mode 100644 gosnappi/pattern_flow_vxlan_reserved1.go create mode 100644 gosnappi/pattern_flow_vxlan_reserved1_counter.go create mode 100644 gosnappi/pattern_flow_vxlan_reserved1_metric_tag.go create mode 100644 gosnappi/pattern_flow_vxlan_vni.go create mode 100644 gosnappi/pattern_flow_vxlan_vni_counter.go create mode 100644 gosnappi/pattern_flow_vxlan_vni_metric_tag.go create mode 100644 gosnappi/port.go create mode 100644 gosnappi/port_metric.go create mode 100644 gosnappi/port_metrics_request.go create mode 100644 gosnappi/port_options.go create mode 100644 gosnappi/protocol_options.go create mode 100644 gosnappi/result_bgp_as_path.go create mode 100644 gosnappi/result_bgp_as_path_segment.go create mode 100644 gosnappi/result_bgp_community.go create mode 100644 gosnappi/result_extended_community.go create mode 100644 gosnappi/result_extended_community_non_transitive2_octet_as_type.go create mode 100644 gosnappi/result_extended_community_non_transitive2_octet_as_type_link_bandwidth.go create mode 100644 gosnappi/result_extended_community_structured.go create mode 100644 gosnappi/result_extended_community_transitive2_octet_as_type.go create mode 100644 gosnappi/result_extended_community_transitive2_octet_as_type_route_origin.go create mode 100644 gosnappi/result_extended_community_transitive2_octet_as_type_route_target.go create mode 100644 gosnappi/result_extended_community_transitive4_octet_as_type.go create mode 100644 gosnappi/result_extended_community_transitive4_octet_as_type_route_origin.go create mode 100644 gosnappi/result_extended_community_transitive4_octet_as_type_route_target.go create mode 100644 gosnappi/result_extended_community_transitive_ipv4_address_type.go create mode 100644 gosnappi/result_extended_community_transitive_ipv4_address_type_route_origin.go create mode 100644 gosnappi/result_extended_community_transitive_ipv4_address_type_route_target.go create mode 100644 gosnappi/result_extended_community_transitive_opaque_type.go create mode 100644 gosnappi/result_extended_community_transitive_opaque_type_color.go create mode 100644 gosnappi/result_extended_community_transitive_opaque_type_encapsulation.go create mode 100644 gosnappi/rsvp_ero.go create mode 100644 gosnappi/rsvp_ero_subobject.go create mode 100644 gosnappi/rsvp_fast_reroute.go create mode 100644 gosnappi/rsvp_i_pv4_lsp_state.go create mode 100644 gosnappi/rsvp_ipv4_interface.go create mode 100644 gosnappi/rsvp_lsp_ipv4_ero.go create mode 100644 gosnappi/rsvp_lsp_ipv4_interface.go create mode 100644 gosnappi/rsvp_lsp_ipv4_interface_p2p_egress_ipv4_lsp.go create mode 100644 gosnappi/rsvp_lsp_ipv4_interface_p2p_ingress_ipv4_lsp.go create mode 100644 gosnappi/rsvp_lsp_ipv4_rro.go create mode 100644 gosnappi/rsvp_lsp_state.go create mode 100644 gosnappi/rsvp_lsps_state.go create mode 100644 gosnappi/rsvp_lsps_state_request.go create mode 100644 gosnappi/rsvp_metric.go create mode 100644 gosnappi/rsvp_metrics_request.go create mode 100644 gosnappi/rsvp_resource_affinities.go create mode 100644 gosnappi/rsvp_session_attribute.go create mode 100644 gosnappi/rsvp_tspec.go create mode 100644 gosnappi/set_config_response.go create mode 100644 gosnappi/set_control_action_response.go create mode 100644 gosnappi/set_control_state_response.go create mode 100644 gosnappi/state_port.go create mode 100644 gosnappi/state_port_capture.go create mode 100644 gosnappi/state_port_link.go create mode 100644 gosnappi/state_protocol.go create mode 100644 gosnappi/state_protocol_all.go create mode 100644 gosnappi/state_protocol_bgp.go create mode 100644 gosnappi/state_protocol_bgp_peers.go create mode 100644 gosnappi/state_protocol_isis.go create mode 100644 gosnappi/state_protocol_isis_routers.go create mode 100644 gosnappi/state_protocol_lacp.go create mode 100644 gosnappi/state_protocol_lacp_admin.go create mode 100644 gosnappi/state_protocol_lacp_member_ports.go create mode 100644 gosnappi/state_protocol_route.go create mode 100644 gosnappi/state_traffic.go create mode 100644 gosnappi/state_traffic_flow_transmit.go create mode 100644 gosnappi/states_request.go create mode 100644 gosnappi/states_response.go create mode 100644 gosnappi/update_config_response.go create mode 100644 gosnappi/v4_route_address.go create mode 100644 gosnappi/v6_route_address.go create mode 100644 gosnappi/version.go create mode 100644 gosnappi/vxlan_tunnel_destination_ip_mode_unicast_arp_suppression_cache.go create mode 100644 gosnappi/vxlan_v4_tunnel.go create mode 100644 gosnappi/vxlan_v4_tunnel_destination_ip_mode.go create mode 100644 gosnappi/vxlan_v4_tunnel_destination_ip_mode_multicast.go create mode 100644 gosnappi/vxlan_v4_tunnel_destination_ip_mode_unicast.go create mode 100644 gosnappi/vxlan_v4_tunnel_destination_ip_mode_unicast_vtep.go create mode 100644 gosnappi/vxlan_v6_tunnel.go create mode 100644 gosnappi/vxlan_v6_tunnel_destination_ip_mode.go create mode 100644 gosnappi/vxlan_v6_tunnel_destination_ip_mode_multicast.go create mode 100644 gosnappi/vxlan_v6_tunnel_destination_ip_mode_unicast.go create mode 100644 gosnappi/vxlan_v6_tunnel_destination_ip_mode_unicast_vtep.go create mode 100644 gosnappi/warning.go diff --git a/gosnappi/action_protocol.go b/gosnappi/action_protocol.go new file mode 100644 index 00000000..76faab64 --- /dev/null +++ b/gosnappi/action_protocol.go @@ -0,0 +1,499 @@ +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" +) + +// ***** ActionProtocol ***** +type actionProtocol struct { + validation + obj *otg.ActionProtocol + marshaller marshalActionProtocol + unMarshaller unMarshalActionProtocol + ipv4Holder ActionProtocolIpv4 + ipv6Holder ActionProtocolIpv6 + bgpHolder ActionProtocolBgp +} + +func NewActionProtocol() ActionProtocol { + obj := actionProtocol{obj: &otg.ActionProtocol{}} + obj.setDefault() + return &obj +} + +func (obj *actionProtocol) msg() *otg.ActionProtocol { + return obj.obj +} + +func (obj *actionProtocol) setMsg(msg *otg.ActionProtocol) ActionProtocol { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionProtocol struct { + obj *actionProtocol +} + +type marshalActionProtocol interface { + // ToProto marshals ActionProtocol to protobuf object *otg.ActionProtocol + ToProto() (*otg.ActionProtocol, error) + // ToPbText marshals ActionProtocol to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionProtocol to YAML text + ToYaml() (string, error) + // ToJson marshals ActionProtocol to JSON text + ToJson() (string, error) +} + +type unMarshalactionProtocol struct { + obj *actionProtocol +} + +type unMarshalActionProtocol interface { + // FromProto unmarshals ActionProtocol from protobuf object *otg.ActionProtocol + FromProto(msg *otg.ActionProtocol) (ActionProtocol, error) + // FromPbText unmarshals ActionProtocol from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionProtocol from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionProtocol from JSON text + FromJson(value string) error +} + +func (obj *actionProtocol) Marshal() marshalActionProtocol { + if obj.marshaller == nil { + obj.marshaller = &marshalactionProtocol{obj: obj} + } + return obj.marshaller +} + +func (obj *actionProtocol) Unmarshal() unMarshalActionProtocol { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionProtocol{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionProtocol) ToProto() (*otg.ActionProtocol, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionProtocol) FromProto(msg *otg.ActionProtocol) (ActionProtocol, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionProtocol) 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 *unMarshalactionProtocol) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalactionProtocol) 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 *unMarshalactionProtocol) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalactionProtocol) 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 *unMarshalactionProtocol) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *actionProtocol) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionProtocol) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionProtocol) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionProtocol) Clone() (ActionProtocol, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionProtocol() + 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 +} + +func (obj *actionProtocol) setNil() { + obj.ipv4Holder = nil + obj.ipv6Holder = nil + obj.bgpHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ActionProtocol is actions associated with protocols on configured resources. +type ActionProtocol interface { + Validation + // msg marshals ActionProtocol to protobuf object *otg.ActionProtocol + // and doesn't set defaults + msg() *otg.ActionProtocol + // setMsg unmarshals ActionProtocol from protobuf object *otg.ActionProtocol + // and doesn't set defaults + setMsg(*otg.ActionProtocol) ActionProtocol + // provides marshal interface + Marshal() marshalActionProtocol + // provides unmarshal interface + Unmarshal() unMarshalActionProtocol + // validate validates ActionProtocol + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionProtocol, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ActionProtocolChoiceEnum, set in ActionProtocol + Choice() ActionProtocolChoiceEnum + // setChoice assigns ActionProtocolChoiceEnum provided by user to ActionProtocol + setChoice(value ActionProtocolChoiceEnum) ActionProtocol + // Ipv4 returns ActionProtocolIpv4, set in ActionProtocol. + // ActionProtocolIpv4 is actions associated with IPv4 on configured resources. + Ipv4() ActionProtocolIpv4 + // SetIpv4 assigns ActionProtocolIpv4 provided by user to ActionProtocol. + // ActionProtocolIpv4 is actions associated with IPv4 on configured resources. + SetIpv4(value ActionProtocolIpv4) ActionProtocol + // HasIpv4 checks if Ipv4 has been set in ActionProtocol + HasIpv4() bool + // Ipv6 returns ActionProtocolIpv6, set in ActionProtocol. + // ActionProtocolIpv6 is actions associated with IPv6 on configured resources. + Ipv6() ActionProtocolIpv6 + // SetIpv6 assigns ActionProtocolIpv6 provided by user to ActionProtocol. + // ActionProtocolIpv6 is actions associated with IPv6 on configured resources. + SetIpv6(value ActionProtocolIpv6) ActionProtocol + // HasIpv6 checks if Ipv6 has been set in ActionProtocol + HasIpv6() bool + // Bgp returns ActionProtocolBgp, set in ActionProtocol. + // ActionProtocolBgp is actions associated with BGP on configured resources. + Bgp() ActionProtocolBgp + // SetBgp assigns ActionProtocolBgp provided by user to ActionProtocol. + // ActionProtocolBgp is actions associated with BGP on configured resources. + SetBgp(value ActionProtocolBgp) ActionProtocol + // HasBgp checks if Bgp has been set in ActionProtocol + HasBgp() bool + setNil() +} + +type ActionProtocolChoiceEnum string + +// Enum of Choice on ActionProtocol +var ActionProtocolChoice = struct { + IPV4 ActionProtocolChoiceEnum + IPV6 ActionProtocolChoiceEnum + BGP ActionProtocolChoiceEnum +}{ + IPV4: ActionProtocolChoiceEnum("ipv4"), + IPV6: ActionProtocolChoiceEnum("ipv6"), + BGP: ActionProtocolChoiceEnum("bgp"), +} + +func (obj *actionProtocol) Choice() ActionProtocolChoiceEnum { + return ActionProtocolChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *actionProtocol) setChoice(value ActionProtocolChoiceEnum) ActionProtocol { + intValue, ok := otg.ActionProtocol_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ActionProtocolChoiceEnum", string(value))) + return obj + } + enumValue := otg.ActionProtocol_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Bgp = nil + obj.bgpHolder = nil + obj.obj.Ipv6 = nil + obj.ipv6Holder = nil + obj.obj.Ipv4 = nil + obj.ipv4Holder = nil + + if value == ActionProtocolChoice.IPV4 { + obj.obj.Ipv4 = NewActionProtocolIpv4().msg() + } + + if value == ActionProtocolChoice.IPV6 { + obj.obj.Ipv6 = NewActionProtocolIpv6().msg() + } + + if value == ActionProtocolChoice.BGP { + obj.obj.Bgp = NewActionProtocolBgp().msg() + } + + return obj +} + +// description is TBD +// Ipv4 returns a ActionProtocolIpv4 +func (obj *actionProtocol) Ipv4() ActionProtocolIpv4 { + if obj.obj.Ipv4 == nil { + obj.setChoice(ActionProtocolChoice.IPV4) + } + if obj.ipv4Holder == nil { + obj.ipv4Holder = &actionProtocolIpv4{obj: obj.obj.Ipv4} + } + return obj.ipv4Holder +} + +// description is TBD +// Ipv4 returns a ActionProtocolIpv4 +func (obj *actionProtocol) HasIpv4() bool { + return obj.obj.Ipv4 != nil +} + +// description is TBD +// SetIpv4 sets the ActionProtocolIpv4 value in the ActionProtocol object +func (obj *actionProtocol) SetIpv4(value ActionProtocolIpv4) ActionProtocol { + obj.setChoice(ActionProtocolChoice.IPV4) + obj.ipv4Holder = nil + obj.obj.Ipv4 = value.msg() + + return obj +} + +// description is TBD +// Ipv6 returns a ActionProtocolIpv6 +func (obj *actionProtocol) Ipv6() ActionProtocolIpv6 { + if obj.obj.Ipv6 == nil { + obj.setChoice(ActionProtocolChoice.IPV6) + } + if obj.ipv6Holder == nil { + obj.ipv6Holder = &actionProtocolIpv6{obj: obj.obj.Ipv6} + } + return obj.ipv6Holder +} + +// description is TBD +// Ipv6 returns a ActionProtocolIpv6 +func (obj *actionProtocol) HasIpv6() bool { + return obj.obj.Ipv6 != nil +} + +// description is TBD +// SetIpv6 sets the ActionProtocolIpv6 value in the ActionProtocol object +func (obj *actionProtocol) SetIpv6(value ActionProtocolIpv6) ActionProtocol { + obj.setChoice(ActionProtocolChoice.IPV6) + obj.ipv6Holder = nil + obj.obj.Ipv6 = value.msg() + + return obj +} + +// description is TBD +// Bgp returns a ActionProtocolBgp +func (obj *actionProtocol) Bgp() ActionProtocolBgp { + if obj.obj.Bgp == nil { + obj.setChoice(ActionProtocolChoice.BGP) + } + if obj.bgpHolder == nil { + obj.bgpHolder = &actionProtocolBgp{obj: obj.obj.Bgp} + } + return obj.bgpHolder +} + +// description is TBD +// Bgp returns a ActionProtocolBgp +func (obj *actionProtocol) HasBgp() bool { + return obj.obj.Bgp != nil +} + +// description is TBD +// SetBgp sets the ActionProtocolBgp value in the ActionProtocol object +func (obj *actionProtocol) SetBgp(value ActionProtocolBgp) ActionProtocol { + obj.setChoice(ActionProtocolChoice.BGP) + obj.bgpHolder = nil + obj.obj.Bgp = value.msg() + + return obj +} + +func (obj *actionProtocol) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionProtocol") + } + + if obj.obj.Ipv4 != nil { + + obj.Ipv4().validateObj(vObj, set_default) + } + + if obj.obj.Ipv6 != nil { + + obj.Ipv6().validateObj(vObj, set_default) + } + + if obj.obj.Bgp != nil { + + obj.Bgp().validateObj(vObj, set_default) + } + +} + +func (obj *actionProtocol) setDefault() { + var choices_set int = 0 + var choice ActionProtocolChoiceEnum + + if obj.obj.Ipv4 != nil { + choices_set += 1 + choice = ActionProtocolChoice.IPV4 + } + + if obj.obj.Ipv6 != nil { + choices_set += 1 + choice = ActionProtocolChoice.IPV6 + } + + if obj.obj.Bgp != nil { + choices_set += 1 + choice = ActionProtocolChoice.BGP + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionProtocol") + } + } else { + intVal := otg.ActionProtocol_Choice_Enum_value[string(choice)] + enumValue := otg.ActionProtocol_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/action_protocol_bgp.go b/gosnappi/action_protocol_bgp.go new file mode 100644 index 00000000..4d661d23 --- /dev/null +++ b/gosnappi/action_protocol_bgp.go @@ -0,0 +1,443 @@ +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" +) + +// ***** ActionProtocolBgp ***** +type actionProtocolBgp struct { + validation + obj *otg.ActionProtocolBgp + marshaller marshalActionProtocolBgp + unMarshaller unMarshalActionProtocolBgp + notificationHolder ActionProtocolBgpNotification + initiateGracefulRestartHolder ActionProtocolBgpInitiateGracefulRestart +} + +func NewActionProtocolBgp() ActionProtocolBgp { + obj := actionProtocolBgp{obj: &otg.ActionProtocolBgp{}} + obj.setDefault() + return &obj +} + +func (obj *actionProtocolBgp) msg() *otg.ActionProtocolBgp { + return obj.obj +} + +func (obj *actionProtocolBgp) setMsg(msg *otg.ActionProtocolBgp) ActionProtocolBgp { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionProtocolBgp struct { + obj *actionProtocolBgp +} + +type marshalActionProtocolBgp interface { + // ToProto marshals ActionProtocolBgp to protobuf object *otg.ActionProtocolBgp + ToProto() (*otg.ActionProtocolBgp, error) + // ToPbText marshals ActionProtocolBgp to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionProtocolBgp to YAML text + ToYaml() (string, error) + // ToJson marshals ActionProtocolBgp to JSON text + ToJson() (string, error) +} + +type unMarshalactionProtocolBgp struct { + obj *actionProtocolBgp +} + +type unMarshalActionProtocolBgp interface { + // FromProto unmarshals ActionProtocolBgp from protobuf object *otg.ActionProtocolBgp + FromProto(msg *otg.ActionProtocolBgp) (ActionProtocolBgp, error) + // FromPbText unmarshals ActionProtocolBgp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionProtocolBgp from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionProtocolBgp from JSON text + FromJson(value string) error +} + +func (obj *actionProtocolBgp) Marshal() marshalActionProtocolBgp { + if obj.marshaller == nil { + obj.marshaller = &marshalactionProtocolBgp{obj: obj} + } + return obj.marshaller +} + +func (obj *actionProtocolBgp) Unmarshal() unMarshalActionProtocolBgp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionProtocolBgp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionProtocolBgp) ToProto() (*otg.ActionProtocolBgp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionProtocolBgp) FromProto(msg *otg.ActionProtocolBgp) (ActionProtocolBgp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionProtocolBgp) 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 *unMarshalactionProtocolBgp) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalactionProtocolBgp) 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 *unMarshalactionProtocolBgp) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalactionProtocolBgp) 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 *unMarshalactionProtocolBgp) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *actionProtocolBgp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionProtocolBgp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionProtocolBgp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionProtocolBgp) Clone() (ActionProtocolBgp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionProtocolBgp() + 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 +} + +func (obj *actionProtocolBgp) setNil() { + obj.notificationHolder = nil + obj.initiateGracefulRestartHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ActionProtocolBgp is actions associated with BGP on configured resources. +type ActionProtocolBgp interface { + Validation + // msg marshals ActionProtocolBgp to protobuf object *otg.ActionProtocolBgp + // and doesn't set defaults + msg() *otg.ActionProtocolBgp + // setMsg unmarshals ActionProtocolBgp from protobuf object *otg.ActionProtocolBgp + // and doesn't set defaults + setMsg(*otg.ActionProtocolBgp) ActionProtocolBgp + // provides marshal interface + Marshal() marshalActionProtocolBgp + // provides unmarshal interface + Unmarshal() unMarshalActionProtocolBgp + // validate validates ActionProtocolBgp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionProtocolBgp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ActionProtocolBgpChoiceEnum, set in ActionProtocolBgp + Choice() ActionProtocolBgpChoiceEnum + // setChoice assigns ActionProtocolBgpChoiceEnum provided by user to ActionProtocolBgp + setChoice(value ActionProtocolBgpChoiceEnum) ActionProtocolBgp + // Notification returns ActionProtocolBgpNotification, set in ActionProtocolBgp. + // ActionProtocolBgpNotification is a NOTIFICATION message is sent when an error is detected with the BGP session, such as hold timer expiring, misconfigured AS number or a BGP session reset is requested. This causes the BGP connection to close. Send explicit NOTIFICATIONs for list of specified BGP peers. If a user wants to send custom Error Code and Error Subcode the custom object should be configured. A user can send IANA defined BGP NOTIFICATIONs according to https://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml. + Notification() ActionProtocolBgpNotification + // SetNotification assigns ActionProtocolBgpNotification provided by user to ActionProtocolBgp. + // ActionProtocolBgpNotification is a NOTIFICATION message is sent when an error is detected with the BGP session, such as hold timer expiring, misconfigured AS number or a BGP session reset is requested. This causes the BGP connection to close. Send explicit NOTIFICATIONs for list of specified BGP peers. If a user wants to send custom Error Code and Error Subcode the custom object should be configured. A user can send IANA defined BGP NOTIFICATIONs according to https://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml. + SetNotification(value ActionProtocolBgpNotification) ActionProtocolBgp + // HasNotification checks if Notification has been set in ActionProtocolBgp + HasNotification() bool + // InitiateGracefulRestart returns ActionProtocolBgpInitiateGracefulRestart, set in ActionProtocolBgp. + // ActionProtocolBgpInitiateGracefulRestart is initiates BGP Graceful Restart process for the selected BGP peers. If no name is specified then Graceful Restart will be sent to all configured BGP peers. + InitiateGracefulRestart() ActionProtocolBgpInitiateGracefulRestart + // SetInitiateGracefulRestart assigns ActionProtocolBgpInitiateGracefulRestart provided by user to ActionProtocolBgp. + // ActionProtocolBgpInitiateGracefulRestart is initiates BGP Graceful Restart process for the selected BGP peers. If no name is specified then Graceful Restart will be sent to all configured BGP peers. + SetInitiateGracefulRestart(value ActionProtocolBgpInitiateGracefulRestart) ActionProtocolBgp + // HasInitiateGracefulRestart checks if InitiateGracefulRestart has been set in ActionProtocolBgp + HasInitiateGracefulRestart() bool + setNil() +} + +type ActionProtocolBgpChoiceEnum string + +// Enum of Choice on ActionProtocolBgp +var ActionProtocolBgpChoice = struct { + NOTIFICATION ActionProtocolBgpChoiceEnum + INITIATE_GRACEFUL_RESTART ActionProtocolBgpChoiceEnum +}{ + NOTIFICATION: ActionProtocolBgpChoiceEnum("notification"), + INITIATE_GRACEFUL_RESTART: ActionProtocolBgpChoiceEnum("initiate_graceful_restart"), +} + +func (obj *actionProtocolBgp) Choice() ActionProtocolBgpChoiceEnum { + return ActionProtocolBgpChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *actionProtocolBgp) setChoice(value ActionProtocolBgpChoiceEnum) ActionProtocolBgp { + intValue, ok := otg.ActionProtocolBgp_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ActionProtocolBgpChoiceEnum", string(value))) + return obj + } + enumValue := otg.ActionProtocolBgp_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.InitiateGracefulRestart = nil + obj.initiateGracefulRestartHolder = nil + obj.obj.Notification = nil + obj.notificationHolder = nil + + if value == ActionProtocolBgpChoice.NOTIFICATION { + obj.obj.Notification = NewActionProtocolBgpNotification().msg() + } + + if value == ActionProtocolBgpChoice.INITIATE_GRACEFUL_RESTART { + obj.obj.InitiateGracefulRestart = NewActionProtocolBgpInitiateGracefulRestart().msg() + } + + return obj +} + +// description is TBD +// Notification returns a ActionProtocolBgpNotification +func (obj *actionProtocolBgp) Notification() ActionProtocolBgpNotification { + if obj.obj.Notification == nil { + obj.setChoice(ActionProtocolBgpChoice.NOTIFICATION) + } + if obj.notificationHolder == nil { + obj.notificationHolder = &actionProtocolBgpNotification{obj: obj.obj.Notification} + } + return obj.notificationHolder +} + +// description is TBD +// Notification returns a ActionProtocolBgpNotification +func (obj *actionProtocolBgp) HasNotification() bool { + return obj.obj.Notification != nil +} + +// description is TBD +// SetNotification sets the ActionProtocolBgpNotification value in the ActionProtocolBgp object +func (obj *actionProtocolBgp) SetNotification(value ActionProtocolBgpNotification) ActionProtocolBgp { + obj.setChoice(ActionProtocolBgpChoice.NOTIFICATION) + obj.notificationHolder = nil + obj.obj.Notification = value.msg() + + return obj +} + +// description is TBD +// InitiateGracefulRestart returns a ActionProtocolBgpInitiateGracefulRestart +func (obj *actionProtocolBgp) InitiateGracefulRestart() ActionProtocolBgpInitiateGracefulRestart { + if obj.obj.InitiateGracefulRestart == nil { + obj.setChoice(ActionProtocolBgpChoice.INITIATE_GRACEFUL_RESTART) + } + if obj.initiateGracefulRestartHolder == nil { + obj.initiateGracefulRestartHolder = &actionProtocolBgpInitiateGracefulRestart{obj: obj.obj.InitiateGracefulRestart} + } + return obj.initiateGracefulRestartHolder +} + +// description is TBD +// InitiateGracefulRestart returns a ActionProtocolBgpInitiateGracefulRestart +func (obj *actionProtocolBgp) HasInitiateGracefulRestart() bool { + return obj.obj.InitiateGracefulRestart != nil +} + +// description is TBD +// SetInitiateGracefulRestart sets the ActionProtocolBgpInitiateGracefulRestart value in the ActionProtocolBgp object +func (obj *actionProtocolBgp) SetInitiateGracefulRestart(value ActionProtocolBgpInitiateGracefulRestart) ActionProtocolBgp { + obj.setChoice(ActionProtocolBgpChoice.INITIATE_GRACEFUL_RESTART) + obj.initiateGracefulRestartHolder = nil + obj.obj.InitiateGracefulRestart = value.msg() + + return obj +} + +func (obj *actionProtocolBgp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionProtocolBgp") + } + + if obj.obj.Notification != nil { + + obj.Notification().validateObj(vObj, set_default) + } + + if obj.obj.InitiateGracefulRestart != nil { + + obj.InitiateGracefulRestart().validateObj(vObj, set_default) + } + +} + +func (obj *actionProtocolBgp) setDefault() { + var choices_set int = 0 + var choice ActionProtocolBgpChoiceEnum + + if obj.obj.Notification != nil { + choices_set += 1 + choice = ActionProtocolBgpChoice.NOTIFICATION + } + + if obj.obj.InitiateGracefulRestart != nil { + choices_set += 1 + choice = ActionProtocolBgpChoice.INITIATE_GRACEFUL_RESTART + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionProtocolBgp") + } + } else { + intVal := otg.ActionProtocolBgp_Choice_Enum_value[string(choice)] + enumValue := otg.ActionProtocolBgp_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/action_protocol_bgp_initiate_graceful_restart.go b/gosnappi/action_protocol_bgp_initiate_graceful_restart.go new file mode 100644 index 00000000..ea96d99e --- /dev/null +++ b/gosnappi/action_protocol_bgp_initiate_graceful_restart.go @@ -0,0 +1,361 @@ +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" +) + +// ***** ActionProtocolBgpInitiateGracefulRestart ***** +type actionProtocolBgpInitiateGracefulRestart struct { + validation + obj *otg.ActionProtocolBgpInitiateGracefulRestart + marshaller marshalActionProtocolBgpInitiateGracefulRestart + unMarshaller unMarshalActionProtocolBgpInitiateGracefulRestart +} + +func NewActionProtocolBgpInitiateGracefulRestart() ActionProtocolBgpInitiateGracefulRestart { + obj := actionProtocolBgpInitiateGracefulRestart{obj: &otg.ActionProtocolBgpInitiateGracefulRestart{}} + obj.setDefault() + return &obj +} + +func (obj *actionProtocolBgpInitiateGracefulRestart) msg() *otg.ActionProtocolBgpInitiateGracefulRestart { + return obj.obj +} + +func (obj *actionProtocolBgpInitiateGracefulRestart) setMsg(msg *otg.ActionProtocolBgpInitiateGracefulRestart) ActionProtocolBgpInitiateGracefulRestart { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionProtocolBgpInitiateGracefulRestart struct { + obj *actionProtocolBgpInitiateGracefulRestart +} + +type marshalActionProtocolBgpInitiateGracefulRestart interface { + // ToProto marshals ActionProtocolBgpInitiateGracefulRestart to protobuf object *otg.ActionProtocolBgpInitiateGracefulRestart + ToProto() (*otg.ActionProtocolBgpInitiateGracefulRestart, error) + // ToPbText marshals ActionProtocolBgpInitiateGracefulRestart to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionProtocolBgpInitiateGracefulRestart to YAML text + ToYaml() (string, error) + // ToJson marshals ActionProtocolBgpInitiateGracefulRestart to JSON text + ToJson() (string, error) +} + +type unMarshalactionProtocolBgpInitiateGracefulRestart struct { + obj *actionProtocolBgpInitiateGracefulRestart +} + +type unMarshalActionProtocolBgpInitiateGracefulRestart interface { + // FromProto unmarshals ActionProtocolBgpInitiateGracefulRestart from protobuf object *otg.ActionProtocolBgpInitiateGracefulRestart + FromProto(msg *otg.ActionProtocolBgpInitiateGracefulRestart) (ActionProtocolBgpInitiateGracefulRestart, error) + // FromPbText unmarshals ActionProtocolBgpInitiateGracefulRestart from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionProtocolBgpInitiateGracefulRestart from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionProtocolBgpInitiateGracefulRestart from JSON text + FromJson(value string) error +} + +func (obj *actionProtocolBgpInitiateGracefulRestart) Marshal() marshalActionProtocolBgpInitiateGracefulRestart { + if obj.marshaller == nil { + obj.marshaller = &marshalactionProtocolBgpInitiateGracefulRestart{obj: obj} + } + return obj.marshaller +} + +func (obj *actionProtocolBgpInitiateGracefulRestart) Unmarshal() unMarshalActionProtocolBgpInitiateGracefulRestart { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionProtocolBgpInitiateGracefulRestart{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionProtocolBgpInitiateGracefulRestart) ToProto() (*otg.ActionProtocolBgpInitiateGracefulRestart, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionProtocolBgpInitiateGracefulRestart) FromProto(msg *otg.ActionProtocolBgpInitiateGracefulRestart) (ActionProtocolBgpInitiateGracefulRestart, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionProtocolBgpInitiateGracefulRestart) 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 *unMarshalactionProtocolBgpInitiateGracefulRestart) 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 *marshalactionProtocolBgpInitiateGracefulRestart) 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 *unMarshalactionProtocolBgpInitiateGracefulRestart) 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 *marshalactionProtocolBgpInitiateGracefulRestart) 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 *unMarshalactionProtocolBgpInitiateGracefulRestart) 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 *actionProtocolBgpInitiateGracefulRestart) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionProtocolBgpInitiateGracefulRestart) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionProtocolBgpInitiateGracefulRestart) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionProtocolBgpInitiateGracefulRestart) Clone() (ActionProtocolBgpInitiateGracefulRestart, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionProtocolBgpInitiateGracefulRestart() + 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 +} + +// ActionProtocolBgpInitiateGracefulRestart is initiates BGP Graceful Restart process for the selected BGP peers. If no name is specified then Graceful Restart will be sent to all configured BGP peers. +type ActionProtocolBgpInitiateGracefulRestart interface { + Validation + // msg marshals ActionProtocolBgpInitiateGracefulRestart to protobuf object *otg.ActionProtocolBgpInitiateGracefulRestart + // and doesn't set defaults + msg() *otg.ActionProtocolBgpInitiateGracefulRestart + // setMsg unmarshals ActionProtocolBgpInitiateGracefulRestart from protobuf object *otg.ActionProtocolBgpInitiateGracefulRestart + // and doesn't set defaults + setMsg(*otg.ActionProtocolBgpInitiateGracefulRestart) ActionProtocolBgpInitiateGracefulRestart + // provides marshal interface + Marshal() marshalActionProtocolBgpInitiateGracefulRestart + // provides unmarshal interface + Unmarshal() unMarshalActionProtocolBgpInitiateGracefulRestart + // validate validates ActionProtocolBgpInitiateGracefulRestart + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionProtocolBgpInitiateGracefulRestart, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PeerNames returns []string, set in ActionProtocolBgpInitiateGracefulRestart. + PeerNames() []string + // SetPeerNames assigns []string provided by user to ActionProtocolBgpInitiateGracefulRestart + SetPeerNames(value []string) ActionProtocolBgpInitiateGracefulRestart + // RestartDelay returns uint32, set in ActionProtocolBgpInitiateGracefulRestart. + RestartDelay() uint32 + // SetRestartDelay assigns uint32 provided by user to ActionProtocolBgpInitiateGracefulRestart + SetRestartDelay(value uint32) ActionProtocolBgpInitiateGracefulRestart + // HasRestartDelay checks if RestartDelay has been set in ActionProtocolBgpInitiateGracefulRestart + HasRestartDelay() bool +} + +// The names of device BGP peers objects to control. +// +// x-constraint: +// - /components/schemas/Device.Bgp/properties/name +// +// x-constraint: +// - /components/schemas/Device.Bgp/properties/name +// +// PeerNames returns a []string +func (obj *actionProtocolBgpInitiateGracefulRestart) PeerNames() []string { + if obj.obj.PeerNames == nil { + obj.obj.PeerNames = make([]string, 0) + } + return obj.obj.PeerNames +} + +// The names of device BGP peers objects to control. +// +// x-constraint: +// - /components/schemas/Device.Bgp/properties/name +// +// x-constraint: +// - /components/schemas/Device.Bgp/properties/name +// +// SetPeerNames sets the []string value in the ActionProtocolBgpInitiateGracefulRestart object +func (obj *actionProtocolBgpInitiateGracefulRestart) SetPeerNames(value []string) ActionProtocolBgpInitiateGracefulRestart { + + if obj.obj.PeerNames == nil { + obj.obj.PeerNames = make([]string, 0) + } + obj.obj.PeerNames = value + + return obj +} + +// Duration (in seconds) after which selected BGP peers will initiate +// Graceful restart by sending the Open Message with Restart State bit set in the Graceful Restart capability. +// RestartDelay returns a uint32 +func (obj *actionProtocolBgpInitiateGracefulRestart) RestartDelay() uint32 { + + return *obj.obj.RestartDelay + +} + +// Duration (in seconds) after which selected BGP peers will initiate +// Graceful restart by sending the Open Message with Restart State bit set in the Graceful Restart capability. +// RestartDelay returns a uint32 +func (obj *actionProtocolBgpInitiateGracefulRestart) HasRestartDelay() bool { + return obj.obj.RestartDelay != nil +} + +// Duration (in seconds) after which selected BGP peers will initiate +// Graceful restart by sending the Open Message with Restart State bit set in the Graceful Restart capability. +// SetRestartDelay sets the uint32 value in the ActionProtocolBgpInitiateGracefulRestart object +func (obj *actionProtocolBgpInitiateGracefulRestart) SetRestartDelay(value uint32) ActionProtocolBgpInitiateGracefulRestart { + + obj.obj.RestartDelay = &value + return obj +} + +func (obj *actionProtocolBgpInitiateGracefulRestart) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RestartDelay != nil { + + if *obj.obj.RestartDelay > 3600 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= ActionProtocolBgpInitiateGracefulRestart.RestartDelay <= 3600 but Got %d", *obj.obj.RestartDelay)) + } + + } + +} + +func (obj *actionProtocolBgpInitiateGracefulRestart) setDefault() { + if obj.obj.RestartDelay == nil { + obj.SetRestartDelay(30) + } + +} diff --git a/gosnappi/action_protocol_bgp_notification.go b/gosnappi/action_protocol_bgp_notification.go new file mode 100644 index 00000000..be6a6eec --- /dev/null +++ b/gosnappi/action_protocol_bgp_notification.go @@ -0,0 +1,771 @@ +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" +) + +// ***** ActionProtocolBgpNotification ***** +type actionProtocolBgpNotification struct { + validation + obj *otg.ActionProtocolBgpNotification + marshaller marshalActionProtocolBgpNotification + unMarshaller unMarshalActionProtocolBgpNotification + ceaseHolder DeviceBgpCeaseError + messageHeaderErrorHolder DeviceBgpMessageHeaderError + openMessageErrorHolder DeviceBgpOpenMessageError + updateMessageErrorHolder DeviceBgpUpdateMessageError + holdTimerExpiredHolder DeviceBgpHoldTimerExpired + finiteStateMachineErrorHolder DeviceBgpFiniteStateMachineError + customHolder DeviceBgpCustomError +} + +func NewActionProtocolBgpNotification() ActionProtocolBgpNotification { + obj := actionProtocolBgpNotification{obj: &otg.ActionProtocolBgpNotification{}} + obj.setDefault() + return &obj +} + +func (obj *actionProtocolBgpNotification) msg() *otg.ActionProtocolBgpNotification { + return obj.obj +} + +func (obj *actionProtocolBgpNotification) setMsg(msg *otg.ActionProtocolBgpNotification) ActionProtocolBgpNotification { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionProtocolBgpNotification struct { + obj *actionProtocolBgpNotification +} + +type marshalActionProtocolBgpNotification interface { + // ToProto marshals ActionProtocolBgpNotification to protobuf object *otg.ActionProtocolBgpNotification + ToProto() (*otg.ActionProtocolBgpNotification, error) + // ToPbText marshals ActionProtocolBgpNotification to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionProtocolBgpNotification to YAML text + ToYaml() (string, error) + // ToJson marshals ActionProtocolBgpNotification to JSON text + ToJson() (string, error) +} + +type unMarshalactionProtocolBgpNotification struct { + obj *actionProtocolBgpNotification +} + +type unMarshalActionProtocolBgpNotification interface { + // FromProto unmarshals ActionProtocolBgpNotification from protobuf object *otg.ActionProtocolBgpNotification + FromProto(msg *otg.ActionProtocolBgpNotification) (ActionProtocolBgpNotification, error) + // FromPbText unmarshals ActionProtocolBgpNotification from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionProtocolBgpNotification from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionProtocolBgpNotification from JSON text + FromJson(value string) error +} + +func (obj *actionProtocolBgpNotification) Marshal() marshalActionProtocolBgpNotification { + if obj.marshaller == nil { + obj.marshaller = &marshalactionProtocolBgpNotification{obj: obj} + } + return obj.marshaller +} + +func (obj *actionProtocolBgpNotification) Unmarshal() unMarshalActionProtocolBgpNotification { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionProtocolBgpNotification{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionProtocolBgpNotification) ToProto() (*otg.ActionProtocolBgpNotification, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionProtocolBgpNotification) FromProto(msg *otg.ActionProtocolBgpNotification) (ActionProtocolBgpNotification, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionProtocolBgpNotification) 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 *unMarshalactionProtocolBgpNotification) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalactionProtocolBgpNotification) 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 *unMarshalactionProtocolBgpNotification) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalactionProtocolBgpNotification) 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 *unMarshalactionProtocolBgpNotification) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *actionProtocolBgpNotification) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionProtocolBgpNotification) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionProtocolBgpNotification) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionProtocolBgpNotification) Clone() (ActionProtocolBgpNotification, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionProtocolBgpNotification() + 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 +} + +func (obj *actionProtocolBgpNotification) setNil() { + obj.ceaseHolder = nil + obj.messageHeaderErrorHolder = nil + obj.openMessageErrorHolder = nil + obj.updateMessageErrorHolder = nil + obj.holdTimerExpiredHolder = nil + obj.finiteStateMachineErrorHolder = nil + obj.customHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ActionProtocolBgpNotification is a NOTIFICATION message is sent when an error is detected with the BGP session, such as hold timer expiring, misconfigured AS number or a BGP session reset is requested. This causes the BGP connection to close. Send explicit NOTIFICATIONs for list of specified BGP peers. If a user wants to send custom Error Code and Error Subcode the custom object should be configured. A user can send IANA defined BGP NOTIFICATIONs according to https://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml. +type ActionProtocolBgpNotification interface { + Validation + // msg marshals ActionProtocolBgpNotification to protobuf object *otg.ActionProtocolBgpNotification + // and doesn't set defaults + msg() *otg.ActionProtocolBgpNotification + // setMsg unmarshals ActionProtocolBgpNotification from protobuf object *otg.ActionProtocolBgpNotification + // and doesn't set defaults + setMsg(*otg.ActionProtocolBgpNotification) ActionProtocolBgpNotification + // provides marshal interface + Marshal() marshalActionProtocolBgpNotification + // provides unmarshal interface + Unmarshal() unMarshalActionProtocolBgpNotification + // validate validates ActionProtocolBgpNotification + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionProtocolBgpNotification, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Names returns []string, set in ActionProtocolBgpNotification. + Names() []string + // SetNames assigns []string provided by user to ActionProtocolBgpNotification + SetNames(value []string) ActionProtocolBgpNotification + // Choice returns ActionProtocolBgpNotificationChoiceEnum, set in ActionProtocolBgpNotification + Choice() ActionProtocolBgpNotificationChoiceEnum + // setChoice assigns ActionProtocolBgpNotificationChoiceEnum provided by user to ActionProtocolBgpNotification + setChoice(value ActionProtocolBgpNotificationChoiceEnum) ActionProtocolBgpNotification + // HasChoice checks if Choice has been set in ActionProtocolBgpNotification + HasChoice() bool + // Cease returns DeviceBgpCeaseError, set in ActionProtocolBgpNotification. + // DeviceBgpCeaseError is in the absence of any fatal errors, a BGP peer can close its BGP connection by sending the NOTIFICATION message with the Error Code Cease. + Cease() DeviceBgpCeaseError + // SetCease assigns DeviceBgpCeaseError provided by user to ActionProtocolBgpNotification. + // DeviceBgpCeaseError is in the absence of any fatal errors, a BGP peer can close its BGP connection by sending the NOTIFICATION message with the Error Code Cease. + SetCease(value DeviceBgpCeaseError) ActionProtocolBgpNotification + // HasCease checks if Cease has been set in ActionProtocolBgpNotification + HasCease() bool + // MessageHeaderError returns DeviceBgpMessageHeaderError, set in ActionProtocolBgpNotification. + // DeviceBgpMessageHeaderError is all errors detected while processing the Message Header are indicated by sending the NOTIFICATION message with the Error Code-Message Header Error. The Error Subcode elaborates on the specific nature of the error. + MessageHeaderError() DeviceBgpMessageHeaderError + // SetMessageHeaderError assigns DeviceBgpMessageHeaderError provided by user to ActionProtocolBgpNotification. + // DeviceBgpMessageHeaderError is all errors detected while processing the Message Header are indicated by sending the NOTIFICATION message with the Error Code-Message Header Error. The Error Subcode elaborates on the specific nature of the error. + SetMessageHeaderError(value DeviceBgpMessageHeaderError) ActionProtocolBgpNotification + // HasMessageHeaderError checks if MessageHeaderError has been set in ActionProtocolBgpNotification + HasMessageHeaderError() bool + // OpenMessageError returns DeviceBgpOpenMessageError, set in ActionProtocolBgpNotification. + // DeviceBgpOpenMessageError is all errors detected while processing the OPEN message are indicated by sending the NOTIFICATION message with the Error Code-Open Message Error. The Error Subcode elaborates on the specific nature of the error. + OpenMessageError() DeviceBgpOpenMessageError + // SetOpenMessageError assigns DeviceBgpOpenMessageError provided by user to ActionProtocolBgpNotification. + // DeviceBgpOpenMessageError is all errors detected while processing the OPEN message are indicated by sending the NOTIFICATION message with the Error Code-Open Message Error. The Error Subcode elaborates on the specific nature of the error. + SetOpenMessageError(value DeviceBgpOpenMessageError) ActionProtocolBgpNotification + // HasOpenMessageError checks if OpenMessageError has been set in ActionProtocolBgpNotification + HasOpenMessageError() bool + // UpdateMessageError returns DeviceBgpUpdateMessageError, set in ActionProtocolBgpNotification. + // DeviceBgpUpdateMessageError is all errors detected while processing the UPDATE message are indicated by sending the NOTIFICATION message with the Error Code-Update Message Error. The Error Subcode elaborates on the specific nature of the error. + UpdateMessageError() DeviceBgpUpdateMessageError + // SetUpdateMessageError assigns DeviceBgpUpdateMessageError provided by user to ActionProtocolBgpNotification. + // DeviceBgpUpdateMessageError is all errors detected while processing the UPDATE message are indicated by sending the NOTIFICATION message with the Error Code-Update Message Error. The Error Subcode elaborates on the specific nature of the error. + SetUpdateMessageError(value DeviceBgpUpdateMessageError) ActionProtocolBgpNotification + // HasUpdateMessageError checks if UpdateMessageError has been set in ActionProtocolBgpNotification + HasUpdateMessageError() bool + // HoldTimerExpired returns DeviceBgpHoldTimerExpired, set in ActionProtocolBgpNotification. + // DeviceBgpHoldTimerExpired is if a system does not receive successive KEEPALIVE, UPDATE, and/or NOTIFICATION messages within the period specified in the Hold Time field of the OPEN message, then the NOTIFICATION message with the Hold Timer Expired Error Code(Error Code 4) is sent and the BGP connection is closed. The Sub Code used is 0. If a user wants to use non zero Sub Code then CustomError can be used. + HoldTimerExpired() DeviceBgpHoldTimerExpired + // SetHoldTimerExpired assigns DeviceBgpHoldTimerExpired provided by user to ActionProtocolBgpNotification. + // DeviceBgpHoldTimerExpired is if a system does not receive successive KEEPALIVE, UPDATE, and/or NOTIFICATION messages within the period specified in the Hold Time field of the OPEN message, then the NOTIFICATION message with the Hold Timer Expired Error Code(Error Code 4) is sent and the BGP connection is closed. The Sub Code used is 0. If a user wants to use non zero Sub Code then CustomError can be used. + SetHoldTimerExpired(value DeviceBgpHoldTimerExpired) ActionProtocolBgpNotification + // HasHoldTimerExpired checks if HoldTimerExpired has been set in ActionProtocolBgpNotification + HasHoldTimerExpired() bool + // FiniteStateMachineError returns DeviceBgpFiniteStateMachineError, set in ActionProtocolBgpNotification. + // DeviceBgpFiniteStateMachineError is any error detected by the BGP Finite State Machine (e.g., receipt of an unexpected event) is indicated by sending the NOTIFICATION message with the Error Code-Finite State Machine Error(Error Code 5). The Sub Code used is 0. If a user wants to use non zero Sub Code then CustomError can be used. + FiniteStateMachineError() DeviceBgpFiniteStateMachineError + // SetFiniteStateMachineError assigns DeviceBgpFiniteStateMachineError provided by user to ActionProtocolBgpNotification. + // DeviceBgpFiniteStateMachineError is any error detected by the BGP Finite State Machine (e.g., receipt of an unexpected event) is indicated by sending the NOTIFICATION message with the Error Code-Finite State Machine Error(Error Code 5). The Sub Code used is 0. If a user wants to use non zero Sub Code then CustomError can be used. + SetFiniteStateMachineError(value DeviceBgpFiniteStateMachineError) ActionProtocolBgpNotification + // HasFiniteStateMachineError checks if FiniteStateMachineError has been set in ActionProtocolBgpNotification + HasFiniteStateMachineError() bool + // Custom returns DeviceBgpCustomError, set in ActionProtocolBgpNotification. + // DeviceBgpCustomError is a BGP peer can send NOTIFICATION message with user defined Error Code and Error Subcode. + Custom() DeviceBgpCustomError + // SetCustom assigns DeviceBgpCustomError provided by user to ActionProtocolBgpNotification. + // DeviceBgpCustomError is a BGP peer can send NOTIFICATION message with user defined Error Code and Error Subcode. + SetCustom(value DeviceBgpCustomError) ActionProtocolBgpNotification + // HasCustom checks if Custom has been set in ActionProtocolBgpNotification + HasCustom() bool + setNil() +} + +// The names of BGP Peers to send NOTIFICATION to. If no name is specified then NOTIFICATION will be sent to all configured BGP peers. +// +// x-constraint: +// - /components/schemas/Device.Bgp/properties/name +// +// x-constraint: +// - /components/schemas/Device.Bgp/properties/name +// +// Names returns a []string +func (obj *actionProtocolBgpNotification) Names() []string { + if obj.obj.Names == nil { + obj.obj.Names = make([]string, 0) + } + return obj.obj.Names +} + +// The names of BGP Peers to send NOTIFICATION to. If no name is specified then NOTIFICATION will be sent to all configured BGP peers. +// +// x-constraint: +// - /components/schemas/Device.Bgp/properties/name +// +// x-constraint: +// - /components/schemas/Device.Bgp/properties/name +// +// SetNames sets the []string value in the ActionProtocolBgpNotification object +func (obj *actionProtocolBgpNotification) SetNames(value []string) ActionProtocolBgpNotification { + + if obj.obj.Names == nil { + obj.obj.Names = make([]string, 0) + } + obj.obj.Names = value + + return obj +} + +type ActionProtocolBgpNotificationChoiceEnum string + +// Enum of Choice on ActionProtocolBgpNotification +var ActionProtocolBgpNotificationChoice = struct { + CEASE ActionProtocolBgpNotificationChoiceEnum + MESSAGE_HEADER_ERROR ActionProtocolBgpNotificationChoiceEnum + OPEN_MESSAGE_ERROR ActionProtocolBgpNotificationChoiceEnum + UPDATE_MESSAGE_ERROR ActionProtocolBgpNotificationChoiceEnum + HOLD_TIMER_EXPIRED ActionProtocolBgpNotificationChoiceEnum + FINITE_STATE_MACHINE_ERROR ActionProtocolBgpNotificationChoiceEnum + CUSTOM ActionProtocolBgpNotificationChoiceEnum +}{ + CEASE: ActionProtocolBgpNotificationChoiceEnum("cease"), + MESSAGE_HEADER_ERROR: ActionProtocolBgpNotificationChoiceEnum("message_header_error"), + OPEN_MESSAGE_ERROR: ActionProtocolBgpNotificationChoiceEnum("open_message_error"), + UPDATE_MESSAGE_ERROR: ActionProtocolBgpNotificationChoiceEnum("update_message_error"), + HOLD_TIMER_EXPIRED: ActionProtocolBgpNotificationChoiceEnum("hold_timer_expired"), + FINITE_STATE_MACHINE_ERROR: ActionProtocolBgpNotificationChoiceEnum("finite_state_machine_error"), + CUSTOM: ActionProtocolBgpNotificationChoiceEnum("custom"), +} + +func (obj *actionProtocolBgpNotification) Choice() ActionProtocolBgpNotificationChoiceEnum { + return ActionProtocolBgpNotificationChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// Each BGP NOTIFICATION message includes an Error Code field indicating what type of problem occurred. For certain Error Codes, an Error Subcode field provides additional details about the specific nature of the problem. The choice value will provide the Error Code used in NOTIFICATION message. The Subcode can be set for each of the corresponding errors except for Hold Timer Expired error and BGP Finite State Machine error. In both of these cases Subcode 0 will be sent. If a user wants to use non zero Sub Code then custom choice can be used. +// Choice returns a string +func (obj *actionProtocolBgpNotification) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *actionProtocolBgpNotification) setChoice(value ActionProtocolBgpNotificationChoiceEnum) ActionProtocolBgpNotification { + intValue, ok := otg.ActionProtocolBgpNotification_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ActionProtocolBgpNotificationChoiceEnum", string(value))) + return obj + } + enumValue := otg.ActionProtocolBgpNotification_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Custom = nil + obj.customHolder = nil + obj.obj.FiniteStateMachineError = nil + obj.finiteStateMachineErrorHolder = nil + obj.obj.HoldTimerExpired = nil + obj.holdTimerExpiredHolder = nil + obj.obj.UpdateMessageError = nil + obj.updateMessageErrorHolder = nil + obj.obj.OpenMessageError = nil + obj.openMessageErrorHolder = nil + obj.obj.MessageHeaderError = nil + obj.messageHeaderErrorHolder = nil + obj.obj.Cease = nil + obj.ceaseHolder = nil + + if value == ActionProtocolBgpNotificationChoice.CEASE { + obj.obj.Cease = NewDeviceBgpCeaseError().msg() + } + + if value == ActionProtocolBgpNotificationChoice.MESSAGE_HEADER_ERROR { + obj.obj.MessageHeaderError = NewDeviceBgpMessageHeaderError().msg() + } + + if value == ActionProtocolBgpNotificationChoice.OPEN_MESSAGE_ERROR { + obj.obj.OpenMessageError = NewDeviceBgpOpenMessageError().msg() + } + + if value == ActionProtocolBgpNotificationChoice.UPDATE_MESSAGE_ERROR { + obj.obj.UpdateMessageError = NewDeviceBgpUpdateMessageError().msg() + } + + if value == ActionProtocolBgpNotificationChoice.HOLD_TIMER_EXPIRED { + obj.obj.HoldTimerExpired = NewDeviceBgpHoldTimerExpired().msg() + } + + if value == ActionProtocolBgpNotificationChoice.FINITE_STATE_MACHINE_ERROR { + obj.obj.FiniteStateMachineError = NewDeviceBgpFiniteStateMachineError().msg() + } + + if value == ActionProtocolBgpNotificationChoice.CUSTOM { + obj.obj.Custom = NewDeviceBgpCustomError().msg() + } + + return obj +} + +// description is TBD +// Cease returns a DeviceBgpCeaseError +func (obj *actionProtocolBgpNotification) Cease() DeviceBgpCeaseError { + if obj.obj.Cease == nil { + obj.setChoice(ActionProtocolBgpNotificationChoice.CEASE) + } + if obj.ceaseHolder == nil { + obj.ceaseHolder = &deviceBgpCeaseError{obj: obj.obj.Cease} + } + return obj.ceaseHolder +} + +// description is TBD +// Cease returns a DeviceBgpCeaseError +func (obj *actionProtocolBgpNotification) HasCease() bool { + return obj.obj.Cease != nil +} + +// description is TBD +// SetCease sets the DeviceBgpCeaseError value in the ActionProtocolBgpNotification object +func (obj *actionProtocolBgpNotification) SetCease(value DeviceBgpCeaseError) ActionProtocolBgpNotification { + obj.setChoice(ActionProtocolBgpNotificationChoice.CEASE) + obj.ceaseHolder = nil + obj.obj.Cease = value.msg() + + return obj +} + +// description is TBD +// MessageHeaderError returns a DeviceBgpMessageHeaderError +func (obj *actionProtocolBgpNotification) MessageHeaderError() DeviceBgpMessageHeaderError { + if obj.obj.MessageHeaderError == nil { + obj.setChoice(ActionProtocolBgpNotificationChoice.MESSAGE_HEADER_ERROR) + } + if obj.messageHeaderErrorHolder == nil { + obj.messageHeaderErrorHolder = &deviceBgpMessageHeaderError{obj: obj.obj.MessageHeaderError} + } + return obj.messageHeaderErrorHolder +} + +// description is TBD +// MessageHeaderError returns a DeviceBgpMessageHeaderError +func (obj *actionProtocolBgpNotification) HasMessageHeaderError() bool { + return obj.obj.MessageHeaderError != nil +} + +// description is TBD +// SetMessageHeaderError sets the DeviceBgpMessageHeaderError value in the ActionProtocolBgpNotification object +func (obj *actionProtocolBgpNotification) SetMessageHeaderError(value DeviceBgpMessageHeaderError) ActionProtocolBgpNotification { + obj.setChoice(ActionProtocolBgpNotificationChoice.MESSAGE_HEADER_ERROR) + obj.messageHeaderErrorHolder = nil + obj.obj.MessageHeaderError = value.msg() + + return obj +} + +// description is TBD +// OpenMessageError returns a DeviceBgpOpenMessageError +func (obj *actionProtocolBgpNotification) OpenMessageError() DeviceBgpOpenMessageError { + if obj.obj.OpenMessageError == nil { + obj.setChoice(ActionProtocolBgpNotificationChoice.OPEN_MESSAGE_ERROR) + } + if obj.openMessageErrorHolder == nil { + obj.openMessageErrorHolder = &deviceBgpOpenMessageError{obj: obj.obj.OpenMessageError} + } + return obj.openMessageErrorHolder +} + +// description is TBD +// OpenMessageError returns a DeviceBgpOpenMessageError +func (obj *actionProtocolBgpNotification) HasOpenMessageError() bool { + return obj.obj.OpenMessageError != nil +} + +// description is TBD +// SetOpenMessageError sets the DeviceBgpOpenMessageError value in the ActionProtocolBgpNotification object +func (obj *actionProtocolBgpNotification) SetOpenMessageError(value DeviceBgpOpenMessageError) ActionProtocolBgpNotification { + obj.setChoice(ActionProtocolBgpNotificationChoice.OPEN_MESSAGE_ERROR) + obj.openMessageErrorHolder = nil + obj.obj.OpenMessageError = value.msg() + + return obj +} + +// description is TBD +// UpdateMessageError returns a DeviceBgpUpdateMessageError +func (obj *actionProtocolBgpNotification) UpdateMessageError() DeviceBgpUpdateMessageError { + if obj.obj.UpdateMessageError == nil { + obj.setChoice(ActionProtocolBgpNotificationChoice.UPDATE_MESSAGE_ERROR) + } + if obj.updateMessageErrorHolder == nil { + obj.updateMessageErrorHolder = &deviceBgpUpdateMessageError{obj: obj.obj.UpdateMessageError} + } + return obj.updateMessageErrorHolder +} + +// description is TBD +// UpdateMessageError returns a DeviceBgpUpdateMessageError +func (obj *actionProtocolBgpNotification) HasUpdateMessageError() bool { + return obj.obj.UpdateMessageError != nil +} + +// description is TBD +// SetUpdateMessageError sets the DeviceBgpUpdateMessageError value in the ActionProtocolBgpNotification object +func (obj *actionProtocolBgpNotification) SetUpdateMessageError(value DeviceBgpUpdateMessageError) ActionProtocolBgpNotification { + obj.setChoice(ActionProtocolBgpNotificationChoice.UPDATE_MESSAGE_ERROR) + obj.updateMessageErrorHolder = nil + obj.obj.UpdateMessageError = value.msg() + + return obj +} + +// description is TBD +// HoldTimerExpired returns a DeviceBgpHoldTimerExpired +func (obj *actionProtocolBgpNotification) HoldTimerExpired() DeviceBgpHoldTimerExpired { + if obj.obj.HoldTimerExpired == nil { + obj.setChoice(ActionProtocolBgpNotificationChoice.HOLD_TIMER_EXPIRED) + } + if obj.holdTimerExpiredHolder == nil { + obj.holdTimerExpiredHolder = &deviceBgpHoldTimerExpired{obj: obj.obj.HoldTimerExpired} + } + return obj.holdTimerExpiredHolder +} + +// description is TBD +// HoldTimerExpired returns a DeviceBgpHoldTimerExpired +func (obj *actionProtocolBgpNotification) HasHoldTimerExpired() bool { + return obj.obj.HoldTimerExpired != nil +} + +// description is TBD +// SetHoldTimerExpired sets the DeviceBgpHoldTimerExpired value in the ActionProtocolBgpNotification object +func (obj *actionProtocolBgpNotification) SetHoldTimerExpired(value DeviceBgpHoldTimerExpired) ActionProtocolBgpNotification { + obj.setChoice(ActionProtocolBgpNotificationChoice.HOLD_TIMER_EXPIRED) + obj.holdTimerExpiredHolder = nil + obj.obj.HoldTimerExpired = value.msg() + + return obj +} + +// description is TBD +// FiniteStateMachineError returns a DeviceBgpFiniteStateMachineError +func (obj *actionProtocolBgpNotification) FiniteStateMachineError() DeviceBgpFiniteStateMachineError { + if obj.obj.FiniteStateMachineError == nil { + obj.setChoice(ActionProtocolBgpNotificationChoice.FINITE_STATE_MACHINE_ERROR) + } + if obj.finiteStateMachineErrorHolder == nil { + obj.finiteStateMachineErrorHolder = &deviceBgpFiniteStateMachineError{obj: obj.obj.FiniteStateMachineError} + } + return obj.finiteStateMachineErrorHolder +} + +// description is TBD +// FiniteStateMachineError returns a DeviceBgpFiniteStateMachineError +func (obj *actionProtocolBgpNotification) HasFiniteStateMachineError() bool { + return obj.obj.FiniteStateMachineError != nil +} + +// description is TBD +// SetFiniteStateMachineError sets the DeviceBgpFiniteStateMachineError value in the ActionProtocolBgpNotification object +func (obj *actionProtocolBgpNotification) SetFiniteStateMachineError(value DeviceBgpFiniteStateMachineError) ActionProtocolBgpNotification { + obj.setChoice(ActionProtocolBgpNotificationChoice.FINITE_STATE_MACHINE_ERROR) + obj.finiteStateMachineErrorHolder = nil + obj.obj.FiniteStateMachineError = value.msg() + + return obj +} + +// description is TBD +// Custom returns a DeviceBgpCustomError +func (obj *actionProtocolBgpNotification) Custom() DeviceBgpCustomError { + if obj.obj.Custom == nil { + obj.setChoice(ActionProtocolBgpNotificationChoice.CUSTOM) + } + if obj.customHolder == nil { + obj.customHolder = &deviceBgpCustomError{obj: obj.obj.Custom} + } + return obj.customHolder +} + +// description is TBD +// Custom returns a DeviceBgpCustomError +func (obj *actionProtocolBgpNotification) HasCustom() bool { + return obj.obj.Custom != nil +} + +// description is TBD +// SetCustom sets the DeviceBgpCustomError value in the ActionProtocolBgpNotification object +func (obj *actionProtocolBgpNotification) SetCustom(value DeviceBgpCustomError) ActionProtocolBgpNotification { + obj.setChoice(ActionProtocolBgpNotificationChoice.CUSTOM) + obj.customHolder = nil + obj.obj.Custom = value.msg() + + return obj +} + +func (obj *actionProtocolBgpNotification) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Cease != nil { + + obj.Cease().validateObj(vObj, set_default) + } + + if obj.obj.MessageHeaderError != nil { + + obj.MessageHeaderError().validateObj(vObj, set_default) + } + + if obj.obj.OpenMessageError != nil { + + obj.OpenMessageError().validateObj(vObj, set_default) + } + + if obj.obj.UpdateMessageError != nil { + + obj.UpdateMessageError().validateObj(vObj, set_default) + } + + if obj.obj.HoldTimerExpired != nil { + + obj.HoldTimerExpired().validateObj(vObj, set_default) + } + + if obj.obj.FiniteStateMachineError != nil { + + obj.FiniteStateMachineError().validateObj(vObj, set_default) + } + + if obj.obj.Custom != nil { + + obj.Custom().validateObj(vObj, set_default) + } + +} + +func (obj *actionProtocolBgpNotification) setDefault() { + var choices_set int = 0 + var choice ActionProtocolBgpNotificationChoiceEnum + + if obj.obj.Cease != nil { + choices_set += 1 + choice = ActionProtocolBgpNotificationChoice.CEASE + } + + if obj.obj.MessageHeaderError != nil { + choices_set += 1 + choice = ActionProtocolBgpNotificationChoice.MESSAGE_HEADER_ERROR + } + + if obj.obj.OpenMessageError != nil { + choices_set += 1 + choice = ActionProtocolBgpNotificationChoice.OPEN_MESSAGE_ERROR + } + + if obj.obj.UpdateMessageError != nil { + choices_set += 1 + choice = ActionProtocolBgpNotificationChoice.UPDATE_MESSAGE_ERROR + } + + if obj.obj.HoldTimerExpired != nil { + choices_set += 1 + choice = ActionProtocolBgpNotificationChoice.HOLD_TIMER_EXPIRED + } + + if obj.obj.FiniteStateMachineError != nil { + choices_set += 1 + choice = ActionProtocolBgpNotificationChoice.FINITE_STATE_MACHINE_ERROR + } + + if obj.obj.Custom != nil { + choices_set += 1 + choice = ActionProtocolBgpNotificationChoice.CUSTOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(ActionProtocolBgpNotificationChoice.CEASE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionProtocolBgpNotification") + } + } else { + intVal := otg.ActionProtocolBgpNotification_Choice_Enum_value[string(choice)] + enumValue := otg.ActionProtocolBgpNotification_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/action_protocol_ipv4.go b/gosnappi/action_protocol_ipv4.go new file mode 100644 index 00000000..c9f1bf67 --- /dev/null +++ b/gosnappi/action_protocol_ipv4.go @@ -0,0 +1,387 @@ +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" +) + +// ***** ActionProtocolIpv4 ***** +type actionProtocolIpv4 struct { + validation + obj *otg.ActionProtocolIpv4 + marshaller marshalActionProtocolIpv4 + unMarshaller unMarshalActionProtocolIpv4 + pingHolder ActionProtocolIpv4Ping +} + +func NewActionProtocolIpv4() ActionProtocolIpv4 { + obj := actionProtocolIpv4{obj: &otg.ActionProtocolIpv4{}} + obj.setDefault() + return &obj +} + +func (obj *actionProtocolIpv4) msg() *otg.ActionProtocolIpv4 { + return obj.obj +} + +func (obj *actionProtocolIpv4) setMsg(msg *otg.ActionProtocolIpv4) ActionProtocolIpv4 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionProtocolIpv4 struct { + obj *actionProtocolIpv4 +} + +type marshalActionProtocolIpv4 interface { + // ToProto marshals ActionProtocolIpv4 to protobuf object *otg.ActionProtocolIpv4 + ToProto() (*otg.ActionProtocolIpv4, error) + // ToPbText marshals ActionProtocolIpv4 to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionProtocolIpv4 to YAML text + ToYaml() (string, error) + // ToJson marshals ActionProtocolIpv4 to JSON text + ToJson() (string, error) +} + +type unMarshalactionProtocolIpv4 struct { + obj *actionProtocolIpv4 +} + +type unMarshalActionProtocolIpv4 interface { + // FromProto unmarshals ActionProtocolIpv4 from protobuf object *otg.ActionProtocolIpv4 + FromProto(msg *otg.ActionProtocolIpv4) (ActionProtocolIpv4, error) + // FromPbText unmarshals ActionProtocolIpv4 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionProtocolIpv4 from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionProtocolIpv4 from JSON text + FromJson(value string) error +} + +func (obj *actionProtocolIpv4) Marshal() marshalActionProtocolIpv4 { + if obj.marshaller == nil { + obj.marshaller = &marshalactionProtocolIpv4{obj: obj} + } + return obj.marshaller +} + +func (obj *actionProtocolIpv4) Unmarshal() unMarshalActionProtocolIpv4 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionProtocolIpv4{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionProtocolIpv4) ToProto() (*otg.ActionProtocolIpv4, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionProtocolIpv4) FromProto(msg *otg.ActionProtocolIpv4) (ActionProtocolIpv4, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionProtocolIpv4) 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 *unMarshalactionProtocolIpv4) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalactionProtocolIpv4) 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 *unMarshalactionProtocolIpv4) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalactionProtocolIpv4) 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 *unMarshalactionProtocolIpv4) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *actionProtocolIpv4) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionProtocolIpv4) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionProtocolIpv4) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionProtocolIpv4) Clone() (ActionProtocolIpv4, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionProtocolIpv4() + 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 +} + +func (obj *actionProtocolIpv4) setNil() { + obj.pingHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ActionProtocolIpv4 is actions associated with IPv4 on configured resources. +type ActionProtocolIpv4 interface { + Validation + // msg marshals ActionProtocolIpv4 to protobuf object *otg.ActionProtocolIpv4 + // and doesn't set defaults + msg() *otg.ActionProtocolIpv4 + // setMsg unmarshals ActionProtocolIpv4 from protobuf object *otg.ActionProtocolIpv4 + // and doesn't set defaults + setMsg(*otg.ActionProtocolIpv4) ActionProtocolIpv4 + // provides marshal interface + Marshal() marshalActionProtocolIpv4 + // provides unmarshal interface + Unmarshal() unMarshalActionProtocolIpv4 + // validate validates ActionProtocolIpv4 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionProtocolIpv4, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ActionProtocolIpv4ChoiceEnum, set in ActionProtocolIpv4 + Choice() ActionProtocolIpv4ChoiceEnum + // setChoice assigns ActionProtocolIpv4ChoiceEnum provided by user to ActionProtocolIpv4 + setChoice(value ActionProtocolIpv4ChoiceEnum) ActionProtocolIpv4 + // Ping returns ActionProtocolIpv4Ping, set in ActionProtocolIpv4. + // ActionProtocolIpv4Ping is request for initiating ping between multiple source and destination pairs. + Ping() ActionProtocolIpv4Ping + // SetPing assigns ActionProtocolIpv4Ping provided by user to ActionProtocolIpv4. + // ActionProtocolIpv4Ping is request for initiating ping between multiple source and destination pairs. + SetPing(value ActionProtocolIpv4Ping) ActionProtocolIpv4 + // HasPing checks if Ping has been set in ActionProtocolIpv4 + HasPing() bool + setNil() +} + +type ActionProtocolIpv4ChoiceEnum string + +// Enum of Choice on ActionProtocolIpv4 +var ActionProtocolIpv4Choice = struct { + PING ActionProtocolIpv4ChoiceEnum +}{ + PING: ActionProtocolIpv4ChoiceEnum("ping"), +} + +func (obj *actionProtocolIpv4) Choice() ActionProtocolIpv4ChoiceEnum { + return ActionProtocolIpv4ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *actionProtocolIpv4) setChoice(value ActionProtocolIpv4ChoiceEnum) ActionProtocolIpv4 { + intValue, ok := otg.ActionProtocolIpv4_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ActionProtocolIpv4ChoiceEnum", string(value))) + return obj + } + enumValue := otg.ActionProtocolIpv4_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Ping = nil + obj.pingHolder = nil + + if value == ActionProtocolIpv4Choice.PING { + obj.obj.Ping = NewActionProtocolIpv4Ping().msg() + } + + return obj +} + +// description is TBD +// Ping returns a ActionProtocolIpv4Ping +func (obj *actionProtocolIpv4) Ping() ActionProtocolIpv4Ping { + if obj.obj.Ping == nil { + obj.setChoice(ActionProtocolIpv4Choice.PING) + } + if obj.pingHolder == nil { + obj.pingHolder = &actionProtocolIpv4Ping{obj: obj.obj.Ping} + } + return obj.pingHolder +} + +// description is TBD +// Ping returns a ActionProtocolIpv4Ping +func (obj *actionProtocolIpv4) HasPing() bool { + return obj.obj.Ping != nil +} + +// description is TBD +// SetPing sets the ActionProtocolIpv4Ping value in the ActionProtocolIpv4 object +func (obj *actionProtocolIpv4) SetPing(value ActionProtocolIpv4Ping) ActionProtocolIpv4 { + obj.setChoice(ActionProtocolIpv4Choice.PING) + obj.pingHolder = nil + obj.obj.Ping = value.msg() + + return obj +} + +func (obj *actionProtocolIpv4) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionProtocolIpv4") + } + + if obj.obj.Ping != nil { + + obj.Ping().validateObj(vObj, set_default) + } + +} + +func (obj *actionProtocolIpv4) setDefault() { + var choices_set int = 0 + var choice ActionProtocolIpv4ChoiceEnum + + if obj.obj.Ping != nil { + choices_set += 1 + choice = ActionProtocolIpv4Choice.PING + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionProtocolIpv4") + } + } else { + intVal := otg.ActionProtocolIpv4_Choice_Enum_value[string(choice)] + enumValue := otg.ActionProtocolIpv4_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/action_protocol_ipv4_ping.go b/gosnappi/action_protocol_ipv4_ping.go new file mode 100644 index 00000000..219cc249 --- /dev/null +++ b/gosnappi/action_protocol_ipv4_ping.go @@ -0,0 +1,390 @@ +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" +) + +// ***** ActionProtocolIpv4Ping ***** +type actionProtocolIpv4Ping struct { + validation + obj *otg.ActionProtocolIpv4Ping + marshaller marshalActionProtocolIpv4Ping + unMarshaller unMarshalActionProtocolIpv4Ping + requestsHolder ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter +} + +func NewActionProtocolIpv4Ping() ActionProtocolIpv4Ping { + obj := actionProtocolIpv4Ping{obj: &otg.ActionProtocolIpv4Ping{}} + obj.setDefault() + return &obj +} + +func (obj *actionProtocolIpv4Ping) msg() *otg.ActionProtocolIpv4Ping { + return obj.obj +} + +func (obj *actionProtocolIpv4Ping) setMsg(msg *otg.ActionProtocolIpv4Ping) ActionProtocolIpv4Ping { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionProtocolIpv4Ping struct { + obj *actionProtocolIpv4Ping +} + +type marshalActionProtocolIpv4Ping interface { + // ToProto marshals ActionProtocolIpv4Ping to protobuf object *otg.ActionProtocolIpv4Ping + ToProto() (*otg.ActionProtocolIpv4Ping, error) + // ToPbText marshals ActionProtocolIpv4Ping to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionProtocolIpv4Ping to YAML text + ToYaml() (string, error) + // ToJson marshals ActionProtocolIpv4Ping to JSON text + ToJson() (string, error) +} + +type unMarshalactionProtocolIpv4Ping struct { + obj *actionProtocolIpv4Ping +} + +type unMarshalActionProtocolIpv4Ping interface { + // FromProto unmarshals ActionProtocolIpv4Ping from protobuf object *otg.ActionProtocolIpv4Ping + FromProto(msg *otg.ActionProtocolIpv4Ping) (ActionProtocolIpv4Ping, error) + // FromPbText unmarshals ActionProtocolIpv4Ping from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionProtocolIpv4Ping from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionProtocolIpv4Ping from JSON text + FromJson(value string) error +} + +func (obj *actionProtocolIpv4Ping) Marshal() marshalActionProtocolIpv4Ping { + if obj.marshaller == nil { + obj.marshaller = &marshalactionProtocolIpv4Ping{obj: obj} + } + return obj.marshaller +} + +func (obj *actionProtocolIpv4Ping) Unmarshal() unMarshalActionProtocolIpv4Ping { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionProtocolIpv4Ping{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionProtocolIpv4Ping) ToProto() (*otg.ActionProtocolIpv4Ping, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionProtocolIpv4Ping) FromProto(msg *otg.ActionProtocolIpv4Ping) (ActionProtocolIpv4Ping, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionProtocolIpv4Ping) 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 *unMarshalactionProtocolIpv4Ping) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalactionProtocolIpv4Ping) 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 *unMarshalactionProtocolIpv4Ping) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalactionProtocolIpv4Ping) 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 *unMarshalactionProtocolIpv4Ping) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *actionProtocolIpv4Ping) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionProtocolIpv4Ping) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionProtocolIpv4Ping) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionProtocolIpv4Ping) Clone() (ActionProtocolIpv4Ping, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionProtocolIpv4Ping() + 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 +} + +func (obj *actionProtocolIpv4Ping) setNil() { + obj.requestsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ActionProtocolIpv4Ping is request for initiating ping between multiple source and destination pairs. +type ActionProtocolIpv4Ping interface { + Validation + // msg marshals ActionProtocolIpv4Ping to protobuf object *otg.ActionProtocolIpv4Ping + // and doesn't set defaults + msg() *otg.ActionProtocolIpv4Ping + // setMsg unmarshals ActionProtocolIpv4Ping from protobuf object *otg.ActionProtocolIpv4Ping + // and doesn't set defaults + setMsg(*otg.ActionProtocolIpv4Ping) ActionProtocolIpv4Ping + // provides marshal interface + Marshal() marshalActionProtocolIpv4Ping + // provides unmarshal interface + Unmarshal() unMarshalActionProtocolIpv4Ping + // validate validates ActionProtocolIpv4Ping + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionProtocolIpv4Ping, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Requests returns ActionProtocolIpv4PingActionProtocolIpv4PingRequestIterIter, set in ActionProtocolIpv4Ping + Requests() ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter + setNil() +} + +// List of IPv4 ping requests. +// Requests returns a []ActionProtocolIpv4PingRequest +func (obj *actionProtocolIpv4Ping) Requests() ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { + if len(obj.obj.Requests) == 0 { + obj.obj.Requests = []*otg.ActionProtocolIpv4PingRequest{} + } + if obj.requestsHolder == nil { + obj.requestsHolder = newActionProtocolIpv4PingActionProtocolIpv4PingRequestIter(&obj.obj.Requests).setMsg(obj) + } + return obj.requestsHolder +} + +type actionProtocolIpv4PingActionProtocolIpv4PingRequestIter struct { + obj *actionProtocolIpv4Ping + actionProtocolIpv4PingRequestSlice []ActionProtocolIpv4PingRequest + fieldPtr *[]*otg.ActionProtocolIpv4PingRequest +} + +func newActionProtocolIpv4PingActionProtocolIpv4PingRequestIter(ptr *[]*otg.ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { + return &actionProtocolIpv4PingActionProtocolIpv4PingRequestIter{fieldPtr: ptr} +} + +type ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter interface { + setMsg(*actionProtocolIpv4Ping) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter + Items() []ActionProtocolIpv4PingRequest + Add() ActionProtocolIpv4PingRequest + Append(items ...ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter + Set(index int, newObj ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter + Clear() ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter + clearHolderSlice() ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter + appendHolderSlice(item ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter +} + +func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) setMsg(msg *actionProtocolIpv4Ping) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&actionProtocolIpv4PingRequest{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) Items() []ActionProtocolIpv4PingRequest { + return obj.actionProtocolIpv4PingRequestSlice +} + +func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) Add() ActionProtocolIpv4PingRequest { + newObj := &otg.ActionProtocolIpv4PingRequest{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &actionProtocolIpv4PingRequest{obj: newObj} + newLibObj.setDefault() + obj.actionProtocolIpv4PingRequestSlice = append(obj.actionProtocolIpv4PingRequestSlice, newLibObj) + return newLibObj +} + +func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) Append(items ...ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.actionProtocolIpv4PingRequestSlice = append(obj.actionProtocolIpv4PingRequestSlice, item) + } + return obj +} + +func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) Set(index int, newObj ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.actionProtocolIpv4PingRequestSlice[index] = newObj + return obj +} +func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) Clear() ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.ActionProtocolIpv4PingRequest{} + obj.actionProtocolIpv4PingRequestSlice = []ActionProtocolIpv4PingRequest{} + } + return obj +} +func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) clearHolderSlice() ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { + if len(obj.actionProtocolIpv4PingRequestSlice) > 0 { + obj.actionProtocolIpv4PingRequestSlice = []ActionProtocolIpv4PingRequest{} + } + return obj +} +func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) appendHolderSlice(item ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { + obj.actionProtocolIpv4PingRequestSlice = append(obj.actionProtocolIpv4PingRequestSlice, item) + return obj +} + +func (obj *actionProtocolIpv4Ping) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Requests) != 0 { + + if set_default { + obj.Requests().clearHolderSlice() + for _, item := range obj.obj.Requests { + obj.Requests().appendHolderSlice(&actionProtocolIpv4PingRequest{obj: item}) + } + } + for _, item := range obj.Requests().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *actionProtocolIpv4Ping) setDefault() { + +} diff --git a/gosnappi/action_protocol_ipv4_ping_request.go b/gosnappi/action_protocol_ipv4_ping_request.go new file mode 100644 index 00000000..baf6c3f5 --- /dev/null +++ b/gosnappi/action_protocol_ipv4_ping_request.go @@ -0,0 +1,371 @@ +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" +) + +// ***** ActionProtocolIpv4PingRequest ***** +type actionProtocolIpv4PingRequest struct { + validation + obj *otg.ActionProtocolIpv4PingRequest + marshaller marshalActionProtocolIpv4PingRequest + unMarshaller unMarshalActionProtocolIpv4PingRequest +} + +func NewActionProtocolIpv4PingRequest() ActionProtocolIpv4PingRequest { + obj := actionProtocolIpv4PingRequest{obj: &otg.ActionProtocolIpv4PingRequest{}} + obj.setDefault() + return &obj +} + +func (obj *actionProtocolIpv4PingRequest) msg() *otg.ActionProtocolIpv4PingRequest { + return obj.obj +} + +func (obj *actionProtocolIpv4PingRequest) setMsg(msg *otg.ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionProtocolIpv4PingRequest struct { + obj *actionProtocolIpv4PingRequest +} + +type marshalActionProtocolIpv4PingRequest interface { + // ToProto marshals ActionProtocolIpv4PingRequest to protobuf object *otg.ActionProtocolIpv4PingRequest + ToProto() (*otg.ActionProtocolIpv4PingRequest, error) + // ToPbText marshals ActionProtocolIpv4PingRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionProtocolIpv4PingRequest to YAML text + ToYaml() (string, error) + // ToJson marshals ActionProtocolIpv4PingRequest to JSON text + ToJson() (string, error) +} + +type unMarshalactionProtocolIpv4PingRequest struct { + obj *actionProtocolIpv4PingRequest +} + +type unMarshalActionProtocolIpv4PingRequest interface { + // FromProto unmarshals ActionProtocolIpv4PingRequest from protobuf object *otg.ActionProtocolIpv4PingRequest + FromProto(msg *otg.ActionProtocolIpv4PingRequest) (ActionProtocolIpv4PingRequest, error) + // FromPbText unmarshals ActionProtocolIpv4PingRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionProtocolIpv4PingRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionProtocolIpv4PingRequest from JSON text + FromJson(value string) error +} + +func (obj *actionProtocolIpv4PingRequest) Marshal() marshalActionProtocolIpv4PingRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalactionProtocolIpv4PingRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *actionProtocolIpv4PingRequest) Unmarshal() unMarshalActionProtocolIpv4PingRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionProtocolIpv4PingRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionProtocolIpv4PingRequest) ToProto() (*otg.ActionProtocolIpv4PingRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionProtocolIpv4PingRequest) FromProto(msg *otg.ActionProtocolIpv4PingRequest) (ActionProtocolIpv4PingRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionProtocolIpv4PingRequest) 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 *unMarshalactionProtocolIpv4PingRequest) 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 *marshalactionProtocolIpv4PingRequest) 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 *unMarshalactionProtocolIpv4PingRequest) 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 *marshalactionProtocolIpv4PingRequest) 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 *unMarshalactionProtocolIpv4PingRequest) 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 *actionProtocolIpv4PingRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionProtocolIpv4PingRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionProtocolIpv4PingRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionProtocolIpv4PingRequest) Clone() (ActionProtocolIpv4PingRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionProtocolIpv4PingRequest() + 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 +} + +// ActionProtocolIpv4PingRequest is under Review: Most ping request parameters are still TBD. +// +// Under Review: Most ping request parameters are still TBD. +// +// Request for initiating ping between a single source and destination pair. +// For ping request, 1 IPv4 ICMP Echo Request shall be sent and wait for ping response to either succeed or time out. The API wait timeout for each request shall be 300ms. +type ActionProtocolIpv4PingRequest interface { + Validation + // msg marshals ActionProtocolIpv4PingRequest to protobuf object *otg.ActionProtocolIpv4PingRequest + // and doesn't set defaults + msg() *otg.ActionProtocolIpv4PingRequest + // setMsg unmarshals ActionProtocolIpv4PingRequest from protobuf object *otg.ActionProtocolIpv4PingRequest + // and doesn't set defaults + setMsg(*otg.ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingRequest + // provides marshal interface + Marshal() marshalActionProtocolIpv4PingRequest + // provides unmarshal interface + Unmarshal() unMarshalActionProtocolIpv4PingRequest + // validate validates ActionProtocolIpv4PingRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionProtocolIpv4PingRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // SrcName returns string, set in ActionProtocolIpv4PingRequest. + SrcName() string + // SetSrcName assigns string provided by user to ActionProtocolIpv4PingRequest + SetSrcName(value string) ActionProtocolIpv4PingRequest + // HasSrcName checks if SrcName has been set in ActionProtocolIpv4PingRequest + HasSrcName() bool + // DstIp returns string, set in ActionProtocolIpv4PingRequest. + DstIp() string + // SetDstIp assigns string provided by user to ActionProtocolIpv4PingRequest + SetDstIp(value string) ActionProtocolIpv4PingRequest + // HasDstIp checks if DstIp has been set in ActionProtocolIpv4PingRequest + HasDstIp() bool +} + +// Name of source IPv4 interface to be used. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// SrcName returns a string +func (obj *actionProtocolIpv4PingRequest) SrcName() string { + + return *obj.obj.SrcName + +} + +// Name of source IPv4 interface to be used. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// SrcName returns a string +func (obj *actionProtocolIpv4PingRequest) HasSrcName() bool { + return obj.obj.SrcName != nil +} + +// Name of source IPv4 interface to be used. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// SetSrcName sets the string value in the ActionProtocolIpv4PingRequest object +func (obj *actionProtocolIpv4PingRequest) SetSrcName(value string) ActionProtocolIpv4PingRequest { + + obj.obj.SrcName = &value + return obj +} + +// Destination IPv4 address to ping. +// DstIp returns a string +func (obj *actionProtocolIpv4PingRequest) DstIp() string { + + return *obj.obj.DstIp + +} + +// Destination IPv4 address to ping. +// DstIp returns a string +func (obj *actionProtocolIpv4PingRequest) HasDstIp() bool { + return obj.obj.DstIp != nil +} + +// Destination IPv4 address to ping. +// SetDstIp sets the string value in the ActionProtocolIpv4PingRequest object +func (obj *actionProtocolIpv4PingRequest) SetDstIp(value string) ActionProtocolIpv4PingRequest { + + obj.obj.DstIp = &value + return obj +} + +func (obj *actionProtocolIpv4PingRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + obj.addWarnings("ActionProtocolIpv4PingRequest is under review, Most ping request parameters are still TBD.") + + if obj.obj.DstIp != nil { + + err := obj.validateIpv4(obj.DstIp()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on ActionProtocolIpv4PingRequest.DstIp")) + } + + } + +} + +func (obj *actionProtocolIpv4PingRequest) setDefault() { + +} diff --git a/gosnappi/action_protocol_ipv6.go b/gosnappi/action_protocol_ipv6.go new file mode 100644 index 00000000..f6221161 --- /dev/null +++ b/gosnappi/action_protocol_ipv6.go @@ -0,0 +1,387 @@ +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" +) + +// ***** ActionProtocolIpv6 ***** +type actionProtocolIpv6 struct { + validation + obj *otg.ActionProtocolIpv6 + marshaller marshalActionProtocolIpv6 + unMarshaller unMarshalActionProtocolIpv6 + pingHolder ActionProtocolIpv6Ping +} + +func NewActionProtocolIpv6() ActionProtocolIpv6 { + obj := actionProtocolIpv6{obj: &otg.ActionProtocolIpv6{}} + obj.setDefault() + return &obj +} + +func (obj *actionProtocolIpv6) msg() *otg.ActionProtocolIpv6 { + return obj.obj +} + +func (obj *actionProtocolIpv6) setMsg(msg *otg.ActionProtocolIpv6) ActionProtocolIpv6 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionProtocolIpv6 struct { + obj *actionProtocolIpv6 +} + +type marshalActionProtocolIpv6 interface { + // ToProto marshals ActionProtocolIpv6 to protobuf object *otg.ActionProtocolIpv6 + ToProto() (*otg.ActionProtocolIpv6, error) + // ToPbText marshals ActionProtocolIpv6 to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionProtocolIpv6 to YAML text + ToYaml() (string, error) + // ToJson marshals ActionProtocolIpv6 to JSON text + ToJson() (string, error) +} + +type unMarshalactionProtocolIpv6 struct { + obj *actionProtocolIpv6 +} + +type unMarshalActionProtocolIpv6 interface { + // FromProto unmarshals ActionProtocolIpv6 from protobuf object *otg.ActionProtocolIpv6 + FromProto(msg *otg.ActionProtocolIpv6) (ActionProtocolIpv6, error) + // FromPbText unmarshals ActionProtocolIpv6 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionProtocolIpv6 from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionProtocolIpv6 from JSON text + FromJson(value string) error +} + +func (obj *actionProtocolIpv6) Marshal() marshalActionProtocolIpv6 { + if obj.marshaller == nil { + obj.marshaller = &marshalactionProtocolIpv6{obj: obj} + } + return obj.marshaller +} + +func (obj *actionProtocolIpv6) Unmarshal() unMarshalActionProtocolIpv6 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionProtocolIpv6{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionProtocolIpv6) ToProto() (*otg.ActionProtocolIpv6, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionProtocolIpv6) FromProto(msg *otg.ActionProtocolIpv6) (ActionProtocolIpv6, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionProtocolIpv6) 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 *unMarshalactionProtocolIpv6) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalactionProtocolIpv6) 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 *unMarshalactionProtocolIpv6) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalactionProtocolIpv6) 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 *unMarshalactionProtocolIpv6) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *actionProtocolIpv6) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionProtocolIpv6) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionProtocolIpv6) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionProtocolIpv6) Clone() (ActionProtocolIpv6, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionProtocolIpv6() + 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 +} + +func (obj *actionProtocolIpv6) setNil() { + obj.pingHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ActionProtocolIpv6 is actions associated with IPv6 on configured resources. +type ActionProtocolIpv6 interface { + Validation + // msg marshals ActionProtocolIpv6 to protobuf object *otg.ActionProtocolIpv6 + // and doesn't set defaults + msg() *otg.ActionProtocolIpv6 + // setMsg unmarshals ActionProtocolIpv6 from protobuf object *otg.ActionProtocolIpv6 + // and doesn't set defaults + setMsg(*otg.ActionProtocolIpv6) ActionProtocolIpv6 + // provides marshal interface + Marshal() marshalActionProtocolIpv6 + // provides unmarshal interface + Unmarshal() unMarshalActionProtocolIpv6 + // validate validates ActionProtocolIpv6 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionProtocolIpv6, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ActionProtocolIpv6ChoiceEnum, set in ActionProtocolIpv6 + Choice() ActionProtocolIpv6ChoiceEnum + // setChoice assigns ActionProtocolIpv6ChoiceEnum provided by user to ActionProtocolIpv6 + setChoice(value ActionProtocolIpv6ChoiceEnum) ActionProtocolIpv6 + // Ping returns ActionProtocolIpv6Ping, set in ActionProtocolIpv6. + // ActionProtocolIpv6Ping is request for initiating ping between multiple source and destination pairs. + Ping() ActionProtocolIpv6Ping + // SetPing assigns ActionProtocolIpv6Ping provided by user to ActionProtocolIpv6. + // ActionProtocolIpv6Ping is request for initiating ping between multiple source and destination pairs. + SetPing(value ActionProtocolIpv6Ping) ActionProtocolIpv6 + // HasPing checks if Ping has been set in ActionProtocolIpv6 + HasPing() bool + setNil() +} + +type ActionProtocolIpv6ChoiceEnum string + +// Enum of Choice on ActionProtocolIpv6 +var ActionProtocolIpv6Choice = struct { + PING ActionProtocolIpv6ChoiceEnum +}{ + PING: ActionProtocolIpv6ChoiceEnum("ping"), +} + +func (obj *actionProtocolIpv6) Choice() ActionProtocolIpv6ChoiceEnum { + return ActionProtocolIpv6ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *actionProtocolIpv6) setChoice(value ActionProtocolIpv6ChoiceEnum) ActionProtocolIpv6 { + intValue, ok := otg.ActionProtocolIpv6_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ActionProtocolIpv6ChoiceEnum", string(value))) + return obj + } + enumValue := otg.ActionProtocolIpv6_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Ping = nil + obj.pingHolder = nil + + if value == ActionProtocolIpv6Choice.PING { + obj.obj.Ping = NewActionProtocolIpv6Ping().msg() + } + + return obj +} + +// description is TBD +// Ping returns a ActionProtocolIpv6Ping +func (obj *actionProtocolIpv6) Ping() ActionProtocolIpv6Ping { + if obj.obj.Ping == nil { + obj.setChoice(ActionProtocolIpv6Choice.PING) + } + if obj.pingHolder == nil { + obj.pingHolder = &actionProtocolIpv6Ping{obj: obj.obj.Ping} + } + return obj.pingHolder +} + +// description is TBD +// Ping returns a ActionProtocolIpv6Ping +func (obj *actionProtocolIpv6) HasPing() bool { + return obj.obj.Ping != nil +} + +// description is TBD +// SetPing sets the ActionProtocolIpv6Ping value in the ActionProtocolIpv6 object +func (obj *actionProtocolIpv6) SetPing(value ActionProtocolIpv6Ping) ActionProtocolIpv6 { + obj.setChoice(ActionProtocolIpv6Choice.PING) + obj.pingHolder = nil + obj.obj.Ping = value.msg() + + return obj +} + +func (obj *actionProtocolIpv6) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionProtocolIpv6") + } + + if obj.obj.Ping != nil { + + obj.Ping().validateObj(vObj, set_default) + } + +} + +func (obj *actionProtocolIpv6) setDefault() { + var choices_set int = 0 + var choice ActionProtocolIpv6ChoiceEnum + + if obj.obj.Ping != nil { + choices_set += 1 + choice = ActionProtocolIpv6Choice.PING + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionProtocolIpv6") + } + } else { + intVal := otg.ActionProtocolIpv6_Choice_Enum_value[string(choice)] + enumValue := otg.ActionProtocolIpv6_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/action_protocol_ipv6_ping.go b/gosnappi/action_protocol_ipv6_ping.go new file mode 100644 index 00000000..7fd9cfcf --- /dev/null +++ b/gosnappi/action_protocol_ipv6_ping.go @@ -0,0 +1,390 @@ +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" +) + +// ***** ActionProtocolIpv6Ping ***** +type actionProtocolIpv6Ping struct { + validation + obj *otg.ActionProtocolIpv6Ping + marshaller marshalActionProtocolIpv6Ping + unMarshaller unMarshalActionProtocolIpv6Ping + requestsHolder ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter +} + +func NewActionProtocolIpv6Ping() ActionProtocolIpv6Ping { + obj := actionProtocolIpv6Ping{obj: &otg.ActionProtocolIpv6Ping{}} + obj.setDefault() + return &obj +} + +func (obj *actionProtocolIpv6Ping) msg() *otg.ActionProtocolIpv6Ping { + return obj.obj +} + +func (obj *actionProtocolIpv6Ping) setMsg(msg *otg.ActionProtocolIpv6Ping) ActionProtocolIpv6Ping { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionProtocolIpv6Ping struct { + obj *actionProtocolIpv6Ping +} + +type marshalActionProtocolIpv6Ping interface { + // ToProto marshals ActionProtocolIpv6Ping to protobuf object *otg.ActionProtocolIpv6Ping + ToProto() (*otg.ActionProtocolIpv6Ping, error) + // ToPbText marshals ActionProtocolIpv6Ping to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionProtocolIpv6Ping to YAML text + ToYaml() (string, error) + // ToJson marshals ActionProtocolIpv6Ping to JSON text + ToJson() (string, error) +} + +type unMarshalactionProtocolIpv6Ping struct { + obj *actionProtocolIpv6Ping +} + +type unMarshalActionProtocolIpv6Ping interface { + // FromProto unmarshals ActionProtocolIpv6Ping from protobuf object *otg.ActionProtocolIpv6Ping + FromProto(msg *otg.ActionProtocolIpv6Ping) (ActionProtocolIpv6Ping, error) + // FromPbText unmarshals ActionProtocolIpv6Ping from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionProtocolIpv6Ping from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionProtocolIpv6Ping from JSON text + FromJson(value string) error +} + +func (obj *actionProtocolIpv6Ping) Marshal() marshalActionProtocolIpv6Ping { + if obj.marshaller == nil { + obj.marshaller = &marshalactionProtocolIpv6Ping{obj: obj} + } + return obj.marshaller +} + +func (obj *actionProtocolIpv6Ping) Unmarshal() unMarshalActionProtocolIpv6Ping { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionProtocolIpv6Ping{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionProtocolIpv6Ping) ToProto() (*otg.ActionProtocolIpv6Ping, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionProtocolIpv6Ping) FromProto(msg *otg.ActionProtocolIpv6Ping) (ActionProtocolIpv6Ping, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionProtocolIpv6Ping) 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 *unMarshalactionProtocolIpv6Ping) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalactionProtocolIpv6Ping) 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 *unMarshalactionProtocolIpv6Ping) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalactionProtocolIpv6Ping) 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 *unMarshalactionProtocolIpv6Ping) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *actionProtocolIpv6Ping) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionProtocolIpv6Ping) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionProtocolIpv6Ping) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionProtocolIpv6Ping) Clone() (ActionProtocolIpv6Ping, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionProtocolIpv6Ping() + 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 +} + +func (obj *actionProtocolIpv6Ping) setNil() { + obj.requestsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ActionProtocolIpv6Ping is request for initiating ping between multiple source and destination pairs. +type ActionProtocolIpv6Ping interface { + Validation + // msg marshals ActionProtocolIpv6Ping to protobuf object *otg.ActionProtocolIpv6Ping + // and doesn't set defaults + msg() *otg.ActionProtocolIpv6Ping + // setMsg unmarshals ActionProtocolIpv6Ping from protobuf object *otg.ActionProtocolIpv6Ping + // and doesn't set defaults + setMsg(*otg.ActionProtocolIpv6Ping) ActionProtocolIpv6Ping + // provides marshal interface + Marshal() marshalActionProtocolIpv6Ping + // provides unmarshal interface + Unmarshal() unMarshalActionProtocolIpv6Ping + // validate validates ActionProtocolIpv6Ping + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionProtocolIpv6Ping, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Requests returns ActionProtocolIpv6PingActionProtocolIpv6PingRequestIterIter, set in ActionProtocolIpv6Ping + Requests() ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter + setNil() +} + +// List of IPv6 ping requests. +// Requests returns a []ActionProtocolIpv6PingRequest +func (obj *actionProtocolIpv6Ping) Requests() ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { + if len(obj.obj.Requests) == 0 { + obj.obj.Requests = []*otg.ActionProtocolIpv6PingRequest{} + } + if obj.requestsHolder == nil { + obj.requestsHolder = newActionProtocolIpv6PingActionProtocolIpv6PingRequestIter(&obj.obj.Requests).setMsg(obj) + } + return obj.requestsHolder +} + +type actionProtocolIpv6PingActionProtocolIpv6PingRequestIter struct { + obj *actionProtocolIpv6Ping + actionProtocolIpv6PingRequestSlice []ActionProtocolIpv6PingRequest + fieldPtr *[]*otg.ActionProtocolIpv6PingRequest +} + +func newActionProtocolIpv6PingActionProtocolIpv6PingRequestIter(ptr *[]*otg.ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { + return &actionProtocolIpv6PingActionProtocolIpv6PingRequestIter{fieldPtr: ptr} +} + +type ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter interface { + setMsg(*actionProtocolIpv6Ping) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter + Items() []ActionProtocolIpv6PingRequest + Add() ActionProtocolIpv6PingRequest + Append(items ...ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter + Set(index int, newObj ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter + Clear() ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter + clearHolderSlice() ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter + appendHolderSlice(item ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter +} + +func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) setMsg(msg *actionProtocolIpv6Ping) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&actionProtocolIpv6PingRequest{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) Items() []ActionProtocolIpv6PingRequest { + return obj.actionProtocolIpv6PingRequestSlice +} + +func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) Add() ActionProtocolIpv6PingRequest { + newObj := &otg.ActionProtocolIpv6PingRequest{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &actionProtocolIpv6PingRequest{obj: newObj} + newLibObj.setDefault() + obj.actionProtocolIpv6PingRequestSlice = append(obj.actionProtocolIpv6PingRequestSlice, newLibObj) + return newLibObj +} + +func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) Append(items ...ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.actionProtocolIpv6PingRequestSlice = append(obj.actionProtocolIpv6PingRequestSlice, item) + } + return obj +} + +func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) Set(index int, newObj ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.actionProtocolIpv6PingRequestSlice[index] = newObj + return obj +} +func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) Clear() ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.ActionProtocolIpv6PingRequest{} + obj.actionProtocolIpv6PingRequestSlice = []ActionProtocolIpv6PingRequest{} + } + return obj +} +func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) clearHolderSlice() ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { + if len(obj.actionProtocolIpv6PingRequestSlice) > 0 { + obj.actionProtocolIpv6PingRequestSlice = []ActionProtocolIpv6PingRequest{} + } + return obj +} +func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) appendHolderSlice(item ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { + obj.actionProtocolIpv6PingRequestSlice = append(obj.actionProtocolIpv6PingRequestSlice, item) + return obj +} + +func (obj *actionProtocolIpv6Ping) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Requests) != 0 { + + if set_default { + obj.Requests().clearHolderSlice() + for _, item := range obj.obj.Requests { + obj.Requests().appendHolderSlice(&actionProtocolIpv6PingRequest{obj: item}) + } + } + for _, item := range obj.Requests().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *actionProtocolIpv6Ping) setDefault() { + +} diff --git a/gosnappi/action_protocol_ipv6_ping_request.go b/gosnappi/action_protocol_ipv6_ping_request.go new file mode 100644 index 00000000..85cd5e8c --- /dev/null +++ b/gosnappi/action_protocol_ipv6_ping_request.go @@ -0,0 +1,371 @@ +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" +) + +// ***** ActionProtocolIpv6PingRequest ***** +type actionProtocolIpv6PingRequest struct { + validation + obj *otg.ActionProtocolIpv6PingRequest + marshaller marshalActionProtocolIpv6PingRequest + unMarshaller unMarshalActionProtocolIpv6PingRequest +} + +func NewActionProtocolIpv6PingRequest() ActionProtocolIpv6PingRequest { + obj := actionProtocolIpv6PingRequest{obj: &otg.ActionProtocolIpv6PingRequest{}} + obj.setDefault() + return &obj +} + +func (obj *actionProtocolIpv6PingRequest) msg() *otg.ActionProtocolIpv6PingRequest { + return obj.obj +} + +func (obj *actionProtocolIpv6PingRequest) setMsg(msg *otg.ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionProtocolIpv6PingRequest struct { + obj *actionProtocolIpv6PingRequest +} + +type marshalActionProtocolIpv6PingRequest interface { + // ToProto marshals ActionProtocolIpv6PingRequest to protobuf object *otg.ActionProtocolIpv6PingRequest + ToProto() (*otg.ActionProtocolIpv6PingRequest, error) + // ToPbText marshals ActionProtocolIpv6PingRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionProtocolIpv6PingRequest to YAML text + ToYaml() (string, error) + // ToJson marshals ActionProtocolIpv6PingRequest to JSON text + ToJson() (string, error) +} + +type unMarshalactionProtocolIpv6PingRequest struct { + obj *actionProtocolIpv6PingRequest +} + +type unMarshalActionProtocolIpv6PingRequest interface { + // FromProto unmarshals ActionProtocolIpv6PingRequest from protobuf object *otg.ActionProtocolIpv6PingRequest + FromProto(msg *otg.ActionProtocolIpv6PingRequest) (ActionProtocolIpv6PingRequest, error) + // FromPbText unmarshals ActionProtocolIpv6PingRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionProtocolIpv6PingRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionProtocolIpv6PingRequest from JSON text + FromJson(value string) error +} + +func (obj *actionProtocolIpv6PingRequest) Marshal() marshalActionProtocolIpv6PingRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalactionProtocolIpv6PingRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *actionProtocolIpv6PingRequest) Unmarshal() unMarshalActionProtocolIpv6PingRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionProtocolIpv6PingRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionProtocolIpv6PingRequest) ToProto() (*otg.ActionProtocolIpv6PingRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionProtocolIpv6PingRequest) FromProto(msg *otg.ActionProtocolIpv6PingRequest) (ActionProtocolIpv6PingRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionProtocolIpv6PingRequest) 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 *unMarshalactionProtocolIpv6PingRequest) 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 *marshalactionProtocolIpv6PingRequest) 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 *unMarshalactionProtocolIpv6PingRequest) 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 *marshalactionProtocolIpv6PingRequest) 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 *unMarshalactionProtocolIpv6PingRequest) 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 *actionProtocolIpv6PingRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionProtocolIpv6PingRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionProtocolIpv6PingRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionProtocolIpv6PingRequest) Clone() (ActionProtocolIpv6PingRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionProtocolIpv6PingRequest() + 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 +} + +// ActionProtocolIpv6PingRequest is under Review: Most ping request parameters are still TBD. +// +// Under Review: Most ping request parameters are still TBD. +// +// Request for initiating ping between a single source and destination pair. +// For ping request, 1 IPv6 ICMP Echo Request shall be sent and wait for ping response to either succeed or time out. The API wait timeout for each request shall be 300ms. +type ActionProtocolIpv6PingRequest interface { + Validation + // msg marshals ActionProtocolIpv6PingRequest to protobuf object *otg.ActionProtocolIpv6PingRequest + // and doesn't set defaults + msg() *otg.ActionProtocolIpv6PingRequest + // setMsg unmarshals ActionProtocolIpv6PingRequest from protobuf object *otg.ActionProtocolIpv6PingRequest + // and doesn't set defaults + setMsg(*otg.ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingRequest + // provides marshal interface + Marshal() marshalActionProtocolIpv6PingRequest + // provides unmarshal interface + Unmarshal() unMarshalActionProtocolIpv6PingRequest + // validate validates ActionProtocolIpv6PingRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionProtocolIpv6PingRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // SrcName returns string, set in ActionProtocolIpv6PingRequest. + SrcName() string + // SetSrcName assigns string provided by user to ActionProtocolIpv6PingRequest + SetSrcName(value string) ActionProtocolIpv6PingRequest + // HasSrcName checks if SrcName has been set in ActionProtocolIpv6PingRequest + HasSrcName() bool + // DstIp returns string, set in ActionProtocolIpv6PingRequest. + DstIp() string + // SetDstIp assigns string provided by user to ActionProtocolIpv6PingRequest + SetDstIp(value string) ActionProtocolIpv6PingRequest + // HasDstIp checks if DstIp has been set in ActionProtocolIpv6PingRequest + HasDstIp() bool +} + +// Name of source IPv6 interface to be used. +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// +// SrcName returns a string +func (obj *actionProtocolIpv6PingRequest) SrcName() string { + + return *obj.obj.SrcName + +} + +// Name of source IPv6 interface to be used. +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// +// SrcName returns a string +func (obj *actionProtocolIpv6PingRequest) HasSrcName() bool { + return obj.obj.SrcName != nil +} + +// Name of source IPv6 interface to be used. +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// +// SetSrcName sets the string value in the ActionProtocolIpv6PingRequest object +func (obj *actionProtocolIpv6PingRequest) SetSrcName(value string) ActionProtocolIpv6PingRequest { + + obj.obj.SrcName = &value + return obj +} + +// Destination IPv6 address to ping. +// DstIp returns a string +func (obj *actionProtocolIpv6PingRequest) DstIp() string { + + return *obj.obj.DstIp + +} + +// Destination IPv6 address to ping. +// DstIp returns a string +func (obj *actionProtocolIpv6PingRequest) HasDstIp() bool { + return obj.obj.DstIp != nil +} + +// Destination IPv6 address to ping. +// SetDstIp sets the string value in the ActionProtocolIpv6PingRequest object +func (obj *actionProtocolIpv6PingRequest) SetDstIp(value string) ActionProtocolIpv6PingRequest { + + obj.obj.DstIp = &value + return obj +} + +func (obj *actionProtocolIpv6PingRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + obj.addWarnings("ActionProtocolIpv6PingRequest is under review, Most ping request parameters are still TBD.") + + if obj.obj.DstIp != nil { + + err := obj.validateIpv6(obj.DstIp()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on ActionProtocolIpv6PingRequest.DstIp")) + } + + } + +} + +func (obj *actionProtocolIpv6PingRequest) setDefault() { + +} diff --git a/gosnappi/action_response.go b/gosnappi/action_response.go new file mode 100644 index 00000000..449dab76 --- /dev/null +++ b/gosnappi/action_response.go @@ -0,0 +1,387 @@ +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" +) + +// ***** ActionResponse ***** +type actionResponse struct { + validation + obj *otg.ActionResponse + marshaller marshalActionResponse + unMarshaller unMarshalActionResponse + protocolHolder ActionResponseProtocol +} + +func NewActionResponse() ActionResponse { + obj := actionResponse{obj: &otg.ActionResponse{}} + obj.setDefault() + return &obj +} + +func (obj *actionResponse) msg() *otg.ActionResponse { + return obj.obj +} + +func (obj *actionResponse) setMsg(msg *otg.ActionResponse) ActionResponse { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionResponse struct { + obj *actionResponse +} + +type marshalActionResponse interface { + // ToProto marshals ActionResponse to protobuf object *otg.ActionResponse + ToProto() (*otg.ActionResponse, error) + // ToPbText marshals ActionResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionResponse to YAML text + ToYaml() (string, error) + // ToJson marshals ActionResponse to JSON text + ToJson() (string, error) +} + +type unMarshalactionResponse struct { + obj *actionResponse +} + +type unMarshalActionResponse interface { + // FromProto unmarshals ActionResponse from protobuf object *otg.ActionResponse + FromProto(msg *otg.ActionResponse) (ActionResponse, error) + // FromPbText unmarshals ActionResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionResponse from JSON text + FromJson(value string) error +} + +func (obj *actionResponse) Marshal() marshalActionResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalactionResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *actionResponse) Unmarshal() unMarshalActionResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionResponse) ToProto() (*otg.ActionResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionResponse) FromProto(msg *otg.ActionResponse) (ActionResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionResponse) 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 *unMarshalactionResponse) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalactionResponse) 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 *unMarshalactionResponse) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalactionResponse) 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 *unMarshalactionResponse) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *actionResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionResponse) Clone() (ActionResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionResponse() + 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 +} + +func (obj *actionResponse) setNil() { + obj.protocolHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ActionResponse is response for action triggered against configured resources. +type ActionResponse interface { + Validation + // msg marshals ActionResponse to protobuf object *otg.ActionResponse + // and doesn't set defaults + msg() *otg.ActionResponse + // setMsg unmarshals ActionResponse from protobuf object *otg.ActionResponse + // and doesn't set defaults + setMsg(*otg.ActionResponse) ActionResponse + // provides marshal interface + Marshal() marshalActionResponse + // provides unmarshal interface + Unmarshal() unMarshalActionResponse + // validate validates ActionResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ActionResponseChoiceEnum, set in ActionResponse + Choice() ActionResponseChoiceEnum + // setChoice assigns ActionResponseChoiceEnum provided by user to ActionResponse + setChoice(value ActionResponseChoiceEnum) ActionResponse + // Protocol returns ActionResponseProtocol, set in ActionResponse. + // ActionResponseProtocol is response for actions associated with protocols on configured resources. + Protocol() ActionResponseProtocol + // SetProtocol assigns ActionResponseProtocol provided by user to ActionResponse. + // ActionResponseProtocol is response for actions associated with protocols on configured resources. + SetProtocol(value ActionResponseProtocol) ActionResponse + // HasProtocol checks if Protocol has been set in ActionResponse + HasProtocol() bool + setNil() +} + +type ActionResponseChoiceEnum string + +// Enum of Choice on ActionResponse +var ActionResponseChoice = struct { + PROTOCOL ActionResponseChoiceEnum +}{ + PROTOCOL: ActionResponseChoiceEnum("protocol"), +} + +func (obj *actionResponse) Choice() ActionResponseChoiceEnum { + return ActionResponseChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *actionResponse) setChoice(value ActionResponseChoiceEnum) ActionResponse { + intValue, ok := otg.ActionResponse_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ActionResponseChoiceEnum", string(value))) + return obj + } + enumValue := otg.ActionResponse_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Protocol = nil + obj.protocolHolder = nil + + if value == ActionResponseChoice.PROTOCOL { + obj.obj.Protocol = NewActionResponseProtocol().msg() + } + + return obj +} + +// description is TBD +// Protocol returns a ActionResponseProtocol +func (obj *actionResponse) Protocol() ActionResponseProtocol { + if obj.obj.Protocol == nil { + obj.setChoice(ActionResponseChoice.PROTOCOL) + } + if obj.protocolHolder == nil { + obj.protocolHolder = &actionResponseProtocol{obj: obj.obj.Protocol} + } + return obj.protocolHolder +} + +// description is TBD +// Protocol returns a ActionResponseProtocol +func (obj *actionResponse) HasProtocol() bool { + return obj.obj.Protocol != nil +} + +// description is TBD +// SetProtocol sets the ActionResponseProtocol value in the ActionResponse object +func (obj *actionResponse) SetProtocol(value ActionResponseProtocol) ActionResponse { + obj.setChoice(ActionResponseChoice.PROTOCOL) + obj.protocolHolder = nil + obj.obj.Protocol = value.msg() + + return obj +} + +func (obj *actionResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionResponse") + } + + if obj.obj.Protocol != nil { + + obj.Protocol().validateObj(vObj, set_default) + } + +} + +func (obj *actionResponse) setDefault() { + var choices_set int = 0 + var choice ActionResponseChoiceEnum + + if obj.obj.Protocol != nil { + choices_set += 1 + choice = ActionResponseChoice.PROTOCOL + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionResponse") + } + } else { + intVal := otg.ActionResponse_Choice_Enum_value[string(choice)] + enumValue := otg.ActionResponse_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/action_response_protocol.go b/gosnappi/action_response_protocol.go new file mode 100644 index 00000000..2140eaeb --- /dev/null +++ b/gosnappi/action_response_protocol.go @@ -0,0 +1,443 @@ +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" +) + +// ***** ActionResponseProtocol ***** +type actionResponseProtocol struct { + validation + obj *otg.ActionResponseProtocol + marshaller marshalActionResponseProtocol + unMarshaller unMarshalActionResponseProtocol + ipv4Holder ActionResponseProtocolIpv4 + ipv6Holder ActionResponseProtocolIpv6 +} + +func NewActionResponseProtocol() ActionResponseProtocol { + obj := actionResponseProtocol{obj: &otg.ActionResponseProtocol{}} + obj.setDefault() + return &obj +} + +func (obj *actionResponseProtocol) msg() *otg.ActionResponseProtocol { + return obj.obj +} + +func (obj *actionResponseProtocol) setMsg(msg *otg.ActionResponseProtocol) ActionResponseProtocol { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionResponseProtocol struct { + obj *actionResponseProtocol +} + +type marshalActionResponseProtocol interface { + // ToProto marshals ActionResponseProtocol to protobuf object *otg.ActionResponseProtocol + ToProto() (*otg.ActionResponseProtocol, error) + // ToPbText marshals ActionResponseProtocol to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionResponseProtocol to YAML text + ToYaml() (string, error) + // ToJson marshals ActionResponseProtocol to JSON text + ToJson() (string, error) +} + +type unMarshalactionResponseProtocol struct { + obj *actionResponseProtocol +} + +type unMarshalActionResponseProtocol interface { + // FromProto unmarshals ActionResponseProtocol from protobuf object *otg.ActionResponseProtocol + FromProto(msg *otg.ActionResponseProtocol) (ActionResponseProtocol, error) + // FromPbText unmarshals ActionResponseProtocol from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionResponseProtocol from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionResponseProtocol from JSON text + FromJson(value string) error +} + +func (obj *actionResponseProtocol) Marshal() marshalActionResponseProtocol { + if obj.marshaller == nil { + obj.marshaller = &marshalactionResponseProtocol{obj: obj} + } + return obj.marshaller +} + +func (obj *actionResponseProtocol) Unmarshal() unMarshalActionResponseProtocol { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionResponseProtocol{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionResponseProtocol) ToProto() (*otg.ActionResponseProtocol, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionResponseProtocol) FromProto(msg *otg.ActionResponseProtocol) (ActionResponseProtocol, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionResponseProtocol) 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 *unMarshalactionResponseProtocol) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalactionResponseProtocol) 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 *unMarshalactionResponseProtocol) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalactionResponseProtocol) 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 *unMarshalactionResponseProtocol) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *actionResponseProtocol) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionResponseProtocol) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionResponseProtocol) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionResponseProtocol) Clone() (ActionResponseProtocol, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionResponseProtocol() + 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 +} + +func (obj *actionResponseProtocol) setNil() { + obj.ipv4Holder = nil + obj.ipv6Holder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ActionResponseProtocol is response for actions associated with protocols on configured resources. +type ActionResponseProtocol interface { + Validation + // msg marshals ActionResponseProtocol to protobuf object *otg.ActionResponseProtocol + // and doesn't set defaults + msg() *otg.ActionResponseProtocol + // setMsg unmarshals ActionResponseProtocol from protobuf object *otg.ActionResponseProtocol + // and doesn't set defaults + setMsg(*otg.ActionResponseProtocol) ActionResponseProtocol + // provides marshal interface + Marshal() marshalActionResponseProtocol + // provides unmarshal interface + Unmarshal() unMarshalActionResponseProtocol + // validate validates ActionResponseProtocol + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionResponseProtocol, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ActionResponseProtocolChoiceEnum, set in ActionResponseProtocol + Choice() ActionResponseProtocolChoiceEnum + // setChoice assigns ActionResponseProtocolChoiceEnum provided by user to ActionResponseProtocol + setChoice(value ActionResponseProtocolChoiceEnum) ActionResponseProtocol + // Ipv4 returns ActionResponseProtocolIpv4, set in ActionResponseProtocol. + // ActionResponseProtocolIpv4 is response for actions associated with IPv4 on configured resources. + Ipv4() ActionResponseProtocolIpv4 + // SetIpv4 assigns ActionResponseProtocolIpv4 provided by user to ActionResponseProtocol. + // ActionResponseProtocolIpv4 is response for actions associated with IPv4 on configured resources. + SetIpv4(value ActionResponseProtocolIpv4) ActionResponseProtocol + // HasIpv4 checks if Ipv4 has been set in ActionResponseProtocol + HasIpv4() bool + // Ipv6 returns ActionResponseProtocolIpv6, set in ActionResponseProtocol. + // ActionResponseProtocolIpv6 is response for actions associated with IPv6 on configured resources. + Ipv6() ActionResponseProtocolIpv6 + // SetIpv6 assigns ActionResponseProtocolIpv6 provided by user to ActionResponseProtocol. + // ActionResponseProtocolIpv6 is response for actions associated with IPv6 on configured resources. + SetIpv6(value ActionResponseProtocolIpv6) ActionResponseProtocol + // HasIpv6 checks if Ipv6 has been set in ActionResponseProtocol + HasIpv6() bool + setNil() +} + +type ActionResponseProtocolChoiceEnum string + +// Enum of Choice on ActionResponseProtocol +var ActionResponseProtocolChoice = struct { + IPV4 ActionResponseProtocolChoiceEnum + IPV6 ActionResponseProtocolChoiceEnum +}{ + IPV4: ActionResponseProtocolChoiceEnum("ipv4"), + IPV6: ActionResponseProtocolChoiceEnum("ipv6"), +} + +func (obj *actionResponseProtocol) Choice() ActionResponseProtocolChoiceEnum { + return ActionResponseProtocolChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *actionResponseProtocol) setChoice(value ActionResponseProtocolChoiceEnum) ActionResponseProtocol { + intValue, ok := otg.ActionResponseProtocol_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ActionResponseProtocolChoiceEnum", string(value))) + return obj + } + enumValue := otg.ActionResponseProtocol_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Ipv6 = nil + obj.ipv6Holder = nil + obj.obj.Ipv4 = nil + obj.ipv4Holder = nil + + if value == ActionResponseProtocolChoice.IPV4 { + obj.obj.Ipv4 = NewActionResponseProtocolIpv4().msg() + } + + if value == ActionResponseProtocolChoice.IPV6 { + obj.obj.Ipv6 = NewActionResponseProtocolIpv6().msg() + } + + return obj +} + +// description is TBD +// Ipv4 returns a ActionResponseProtocolIpv4 +func (obj *actionResponseProtocol) Ipv4() ActionResponseProtocolIpv4 { + if obj.obj.Ipv4 == nil { + obj.setChoice(ActionResponseProtocolChoice.IPV4) + } + if obj.ipv4Holder == nil { + obj.ipv4Holder = &actionResponseProtocolIpv4{obj: obj.obj.Ipv4} + } + return obj.ipv4Holder +} + +// description is TBD +// Ipv4 returns a ActionResponseProtocolIpv4 +func (obj *actionResponseProtocol) HasIpv4() bool { + return obj.obj.Ipv4 != nil +} + +// description is TBD +// SetIpv4 sets the ActionResponseProtocolIpv4 value in the ActionResponseProtocol object +func (obj *actionResponseProtocol) SetIpv4(value ActionResponseProtocolIpv4) ActionResponseProtocol { + obj.setChoice(ActionResponseProtocolChoice.IPV4) + obj.ipv4Holder = nil + obj.obj.Ipv4 = value.msg() + + return obj +} + +// description is TBD +// Ipv6 returns a ActionResponseProtocolIpv6 +func (obj *actionResponseProtocol) Ipv6() ActionResponseProtocolIpv6 { + if obj.obj.Ipv6 == nil { + obj.setChoice(ActionResponseProtocolChoice.IPV6) + } + if obj.ipv6Holder == nil { + obj.ipv6Holder = &actionResponseProtocolIpv6{obj: obj.obj.Ipv6} + } + return obj.ipv6Holder +} + +// description is TBD +// Ipv6 returns a ActionResponseProtocolIpv6 +func (obj *actionResponseProtocol) HasIpv6() bool { + return obj.obj.Ipv6 != nil +} + +// description is TBD +// SetIpv6 sets the ActionResponseProtocolIpv6 value in the ActionResponseProtocol object +func (obj *actionResponseProtocol) SetIpv6(value ActionResponseProtocolIpv6) ActionResponseProtocol { + obj.setChoice(ActionResponseProtocolChoice.IPV6) + obj.ipv6Holder = nil + obj.obj.Ipv6 = value.msg() + + return obj +} + +func (obj *actionResponseProtocol) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionResponseProtocol") + } + + if obj.obj.Ipv4 != nil { + + obj.Ipv4().validateObj(vObj, set_default) + } + + if obj.obj.Ipv6 != nil { + + obj.Ipv6().validateObj(vObj, set_default) + } + +} + +func (obj *actionResponseProtocol) setDefault() { + var choices_set int = 0 + var choice ActionResponseProtocolChoiceEnum + + if obj.obj.Ipv4 != nil { + choices_set += 1 + choice = ActionResponseProtocolChoice.IPV4 + } + + if obj.obj.Ipv6 != nil { + choices_set += 1 + choice = ActionResponseProtocolChoice.IPV6 + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionResponseProtocol") + } + } else { + intVal := otg.ActionResponseProtocol_Choice_Enum_value[string(choice)] + enumValue := otg.ActionResponseProtocol_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/action_response_protocol_ipv4.go b/gosnappi/action_response_protocol_ipv4.go new file mode 100644 index 00000000..16d57b61 --- /dev/null +++ b/gosnappi/action_response_protocol_ipv4.go @@ -0,0 +1,387 @@ +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" +) + +// ***** ActionResponseProtocolIpv4 ***** +type actionResponseProtocolIpv4 struct { + validation + obj *otg.ActionResponseProtocolIpv4 + marshaller marshalActionResponseProtocolIpv4 + unMarshaller unMarshalActionResponseProtocolIpv4 + pingHolder ActionResponseProtocolIpv4Ping +} + +func NewActionResponseProtocolIpv4() ActionResponseProtocolIpv4 { + obj := actionResponseProtocolIpv4{obj: &otg.ActionResponseProtocolIpv4{}} + obj.setDefault() + return &obj +} + +func (obj *actionResponseProtocolIpv4) msg() *otg.ActionResponseProtocolIpv4 { + return obj.obj +} + +func (obj *actionResponseProtocolIpv4) setMsg(msg *otg.ActionResponseProtocolIpv4) ActionResponseProtocolIpv4 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionResponseProtocolIpv4 struct { + obj *actionResponseProtocolIpv4 +} + +type marshalActionResponseProtocolIpv4 interface { + // ToProto marshals ActionResponseProtocolIpv4 to protobuf object *otg.ActionResponseProtocolIpv4 + ToProto() (*otg.ActionResponseProtocolIpv4, error) + // ToPbText marshals ActionResponseProtocolIpv4 to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionResponseProtocolIpv4 to YAML text + ToYaml() (string, error) + // ToJson marshals ActionResponseProtocolIpv4 to JSON text + ToJson() (string, error) +} + +type unMarshalactionResponseProtocolIpv4 struct { + obj *actionResponseProtocolIpv4 +} + +type unMarshalActionResponseProtocolIpv4 interface { + // FromProto unmarshals ActionResponseProtocolIpv4 from protobuf object *otg.ActionResponseProtocolIpv4 + FromProto(msg *otg.ActionResponseProtocolIpv4) (ActionResponseProtocolIpv4, error) + // FromPbText unmarshals ActionResponseProtocolIpv4 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionResponseProtocolIpv4 from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionResponseProtocolIpv4 from JSON text + FromJson(value string) error +} + +func (obj *actionResponseProtocolIpv4) Marshal() marshalActionResponseProtocolIpv4 { + if obj.marshaller == nil { + obj.marshaller = &marshalactionResponseProtocolIpv4{obj: obj} + } + return obj.marshaller +} + +func (obj *actionResponseProtocolIpv4) Unmarshal() unMarshalActionResponseProtocolIpv4 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionResponseProtocolIpv4{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionResponseProtocolIpv4) ToProto() (*otg.ActionResponseProtocolIpv4, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionResponseProtocolIpv4) FromProto(msg *otg.ActionResponseProtocolIpv4) (ActionResponseProtocolIpv4, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionResponseProtocolIpv4) 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 *unMarshalactionResponseProtocolIpv4) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalactionResponseProtocolIpv4) 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 *unMarshalactionResponseProtocolIpv4) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalactionResponseProtocolIpv4) 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 *unMarshalactionResponseProtocolIpv4) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *actionResponseProtocolIpv4) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionResponseProtocolIpv4) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionResponseProtocolIpv4) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionResponseProtocolIpv4) Clone() (ActionResponseProtocolIpv4, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionResponseProtocolIpv4() + 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 +} + +func (obj *actionResponseProtocolIpv4) setNil() { + obj.pingHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ActionResponseProtocolIpv4 is response for actions associated with IPv4 on configured resources. +type ActionResponseProtocolIpv4 interface { + Validation + // msg marshals ActionResponseProtocolIpv4 to protobuf object *otg.ActionResponseProtocolIpv4 + // and doesn't set defaults + msg() *otg.ActionResponseProtocolIpv4 + // setMsg unmarshals ActionResponseProtocolIpv4 from protobuf object *otg.ActionResponseProtocolIpv4 + // and doesn't set defaults + setMsg(*otg.ActionResponseProtocolIpv4) ActionResponseProtocolIpv4 + // provides marshal interface + Marshal() marshalActionResponseProtocolIpv4 + // provides unmarshal interface + Unmarshal() unMarshalActionResponseProtocolIpv4 + // validate validates ActionResponseProtocolIpv4 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionResponseProtocolIpv4, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ActionResponseProtocolIpv4ChoiceEnum, set in ActionResponseProtocolIpv4 + Choice() ActionResponseProtocolIpv4ChoiceEnum + // setChoice assigns ActionResponseProtocolIpv4ChoiceEnum provided by user to ActionResponseProtocolIpv4 + setChoice(value ActionResponseProtocolIpv4ChoiceEnum) ActionResponseProtocolIpv4 + // Ping returns ActionResponseProtocolIpv4Ping, set in ActionResponseProtocolIpv4. + // ActionResponseProtocolIpv4Ping is response for ping initiated between multiple source and destination pairs. + Ping() ActionResponseProtocolIpv4Ping + // SetPing assigns ActionResponseProtocolIpv4Ping provided by user to ActionResponseProtocolIpv4. + // ActionResponseProtocolIpv4Ping is response for ping initiated between multiple source and destination pairs. + SetPing(value ActionResponseProtocolIpv4Ping) ActionResponseProtocolIpv4 + // HasPing checks if Ping has been set in ActionResponseProtocolIpv4 + HasPing() bool + setNil() +} + +type ActionResponseProtocolIpv4ChoiceEnum string + +// Enum of Choice on ActionResponseProtocolIpv4 +var ActionResponseProtocolIpv4Choice = struct { + PING ActionResponseProtocolIpv4ChoiceEnum +}{ + PING: ActionResponseProtocolIpv4ChoiceEnum("ping"), +} + +func (obj *actionResponseProtocolIpv4) Choice() ActionResponseProtocolIpv4ChoiceEnum { + return ActionResponseProtocolIpv4ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *actionResponseProtocolIpv4) setChoice(value ActionResponseProtocolIpv4ChoiceEnum) ActionResponseProtocolIpv4 { + intValue, ok := otg.ActionResponseProtocolIpv4_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ActionResponseProtocolIpv4ChoiceEnum", string(value))) + return obj + } + enumValue := otg.ActionResponseProtocolIpv4_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Ping = nil + obj.pingHolder = nil + + if value == ActionResponseProtocolIpv4Choice.PING { + obj.obj.Ping = NewActionResponseProtocolIpv4Ping().msg() + } + + return obj +} + +// description is TBD +// Ping returns a ActionResponseProtocolIpv4Ping +func (obj *actionResponseProtocolIpv4) Ping() ActionResponseProtocolIpv4Ping { + if obj.obj.Ping == nil { + obj.setChoice(ActionResponseProtocolIpv4Choice.PING) + } + if obj.pingHolder == nil { + obj.pingHolder = &actionResponseProtocolIpv4Ping{obj: obj.obj.Ping} + } + return obj.pingHolder +} + +// description is TBD +// Ping returns a ActionResponseProtocolIpv4Ping +func (obj *actionResponseProtocolIpv4) HasPing() bool { + return obj.obj.Ping != nil +} + +// description is TBD +// SetPing sets the ActionResponseProtocolIpv4Ping value in the ActionResponseProtocolIpv4 object +func (obj *actionResponseProtocolIpv4) SetPing(value ActionResponseProtocolIpv4Ping) ActionResponseProtocolIpv4 { + obj.setChoice(ActionResponseProtocolIpv4Choice.PING) + obj.pingHolder = nil + obj.obj.Ping = value.msg() + + return obj +} + +func (obj *actionResponseProtocolIpv4) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionResponseProtocolIpv4") + } + + if obj.obj.Ping != nil { + + obj.Ping().validateObj(vObj, set_default) + } + +} + +func (obj *actionResponseProtocolIpv4) setDefault() { + var choices_set int = 0 + var choice ActionResponseProtocolIpv4ChoiceEnum + + if obj.obj.Ping != nil { + choices_set += 1 + choice = ActionResponseProtocolIpv4Choice.PING + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionResponseProtocolIpv4") + } + } else { + intVal := otg.ActionResponseProtocolIpv4_Choice_Enum_value[string(choice)] + enumValue := otg.ActionResponseProtocolIpv4_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/action_response_protocol_ipv4_ping.go b/gosnappi/action_response_protocol_ipv4_ping.go new file mode 100644 index 00000000..49da2e08 --- /dev/null +++ b/gosnappi/action_response_protocol_ipv4_ping.go @@ -0,0 +1,390 @@ +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" +) + +// ***** ActionResponseProtocolIpv4Ping ***** +type actionResponseProtocolIpv4Ping struct { + validation + obj *otg.ActionResponseProtocolIpv4Ping + marshaller marshalActionResponseProtocolIpv4Ping + unMarshaller unMarshalActionResponseProtocolIpv4Ping + responsesHolder ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter +} + +func NewActionResponseProtocolIpv4Ping() ActionResponseProtocolIpv4Ping { + obj := actionResponseProtocolIpv4Ping{obj: &otg.ActionResponseProtocolIpv4Ping{}} + obj.setDefault() + return &obj +} + +func (obj *actionResponseProtocolIpv4Ping) msg() *otg.ActionResponseProtocolIpv4Ping { + return obj.obj +} + +func (obj *actionResponseProtocolIpv4Ping) setMsg(msg *otg.ActionResponseProtocolIpv4Ping) ActionResponseProtocolIpv4Ping { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionResponseProtocolIpv4Ping struct { + obj *actionResponseProtocolIpv4Ping +} + +type marshalActionResponseProtocolIpv4Ping interface { + // ToProto marshals ActionResponseProtocolIpv4Ping to protobuf object *otg.ActionResponseProtocolIpv4Ping + ToProto() (*otg.ActionResponseProtocolIpv4Ping, error) + // ToPbText marshals ActionResponseProtocolIpv4Ping to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionResponseProtocolIpv4Ping to YAML text + ToYaml() (string, error) + // ToJson marshals ActionResponseProtocolIpv4Ping to JSON text + ToJson() (string, error) +} + +type unMarshalactionResponseProtocolIpv4Ping struct { + obj *actionResponseProtocolIpv4Ping +} + +type unMarshalActionResponseProtocolIpv4Ping interface { + // FromProto unmarshals ActionResponseProtocolIpv4Ping from protobuf object *otg.ActionResponseProtocolIpv4Ping + FromProto(msg *otg.ActionResponseProtocolIpv4Ping) (ActionResponseProtocolIpv4Ping, error) + // FromPbText unmarshals ActionResponseProtocolIpv4Ping from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionResponseProtocolIpv4Ping from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionResponseProtocolIpv4Ping from JSON text + FromJson(value string) error +} + +func (obj *actionResponseProtocolIpv4Ping) Marshal() marshalActionResponseProtocolIpv4Ping { + if obj.marshaller == nil { + obj.marshaller = &marshalactionResponseProtocolIpv4Ping{obj: obj} + } + return obj.marshaller +} + +func (obj *actionResponseProtocolIpv4Ping) Unmarshal() unMarshalActionResponseProtocolIpv4Ping { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionResponseProtocolIpv4Ping{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionResponseProtocolIpv4Ping) ToProto() (*otg.ActionResponseProtocolIpv4Ping, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionResponseProtocolIpv4Ping) FromProto(msg *otg.ActionResponseProtocolIpv4Ping) (ActionResponseProtocolIpv4Ping, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionResponseProtocolIpv4Ping) 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 *unMarshalactionResponseProtocolIpv4Ping) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalactionResponseProtocolIpv4Ping) 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 *unMarshalactionResponseProtocolIpv4Ping) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalactionResponseProtocolIpv4Ping) 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 *unMarshalactionResponseProtocolIpv4Ping) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *actionResponseProtocolIpv4Ping) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionResponseProtocolIpv4Ping) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionResponseProtocolIpv4Ping) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionResponseProtocolIpv4Ping) Clone() (ActionResponseProtocolIpv4Ping, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionResponseProtocolIpv4Ping() + 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 +} + +func (obj *actionResponseProtocolIpv4Ping) setNil() { + obj.responsesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ActionResponseProtocolIpv4Ping is response for ping initiated between multiple source and destination pairs. +type ActionResponseProtocolIpv4Ping interface { + Validation + // msg marshals ActionResponseProtocolIpv4Ping to protobuf object *otg.ActionResponseProtocolIpv4Ping + // and doesn't set defaults + msg() *otg.ActionResponseProtocolIpv4Ping + // setMsg unmarshals ActionResponseProtocolIpv4Ping from protobuf object *otg.ActionResponseProtocolIpv4Ping + // and doesn't set defaults + setMsg(*otg.ActionResponseProtocolIpv4Ping) ActionResponseProtocolIpv4Ping + // provides marshal interface + Marshal() marshalActionResponseProtocolIpv4Ping + // provides unmarshal interface + Unmarshal() unMarshalActionResponseProtocolIpv4Ping + // validate validates ActionResponseProtocolIpv4Ping + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionResponseProtocolIpv4Ping, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Responses returns ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIterIter, set in ActionResponseProtocolIpv4Ping + Responses() ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter + setNil() +} + +// List of responses for IPv4 ping responses. +// Responses returns a []ActionResponseProtocolIpv4PingResponse +func (obj *actionResponseProtocolIpv4Ping) Responses() ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { + if len(obj.obj.Responses) == 0 { + obj.obj.Responses = []*otg.ActionResponseProtocolIpv4PingResponse{} + } + if obj.responsesHolder == nil { + obj.responsesHolder = newActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter(&obj.obj.Responses).setMsg(obj) + } + return obj.responsesHolder +} + +type actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter struct { + obj *actionResponseProtocolIpv4Ping + actionResponseProtocolIpv4PingResponseSlice []ActionResponseProtocolIpv4PingResponse + fieldPtr *[]*otg.ActionResponseProtocolIpv4PingResponse +} + +func newActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter(ptr *[]*otg.ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { + return &actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter{fieldPtr: ptr} +} + +type ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter interface { + setMsg(*actionResponseProtocolIpv4Ping) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter + Items() []ActionResponseProtocolIpv4PingResponse + Add() ActionResponseProtocolIpv4PingResponse + Append(items ...ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter + Set(index int, newObj ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter + Clear() ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter + clearHolderSlice() ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter + appendHolderSlice(item ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter +} + +func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) setMsg(msg *actionResponseProtocolIpv4Ping) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&actionResponseProtocolIpv4PingResponse{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) Items() []ActionResponseProtocolIpv4PingResponse { + return obj.actionResponseProtocolIpv4PingResponseSlice +} + +func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) Add() ActionResponseProtocolIpv4PingResponse { + newObj := &otg.ActionResponseProtocolIpv4PingResponse{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &actionResponseProtocolIpv4PingResponse{obj: newObj} + newLibObj.setDefault() + obj.actionResponseProtocolIpv4PingResponseSlice = append(obj.actionResponseProtocolIpv4PingResponseSlice, newLibObj) + return newLibObj +} + +func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) Append(items ...ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.actionResponseProtocolIpv4PingResponseSlice = append(obj.actionResponseProtocolIpv4PingResponseSlice, item) + } + return obj +} + +func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) Set(index int, newObj ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.actionResponseProtocolIpv4PingResponseSlice[index] = newObj + return obj +} +func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) Clear() ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.ActionResponseProtocolIpv4PingResponse{} + obj.actionResponseProtocolIpv4PingResponseSlice = []ActionResponseProtocolIpv4PingResponse{} + } + return obj +} +func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) clearHolderSlice() ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { + if len(obj.actionResponseProtocolIpv4PingResponseSlice) > 0 { + obj.actionResponseProtocolIpv4PingResponseSlice = []ActionResponseProtocolIpv4PingResponse{} + } + return obj +} +func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) appendHolderSlice(item ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { + obj.actionResponseProtocolIpv4PingResponseSlice = append(obj.actionResponseProtocolIpv4PingResponseSlice, item) + return obj +} + +func (obj *actionResponseProtocolIpv4Ping) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Responses) != 0 { + + if set_default { + obj.Responses().clearHolderSlice() + for _, item := range obj.obj.Responses { + obj.Responses().appendHolderSlice(&actionResponseProtocolIpv4PingResponse{obj: item}) + } + } + for _, item := range obj.Responses().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *actionResponseProtocolIpv4Ping) setDefault() { + +} diff --git a/gosnappi/action_response_protocol_ipv4_ping_response.go b/gosnappi/action_response_protocol_ipv4_ping_response.go new file mode 100644 index 00000000..bef3176b --- /dev/null +++ b/gosnappi/action_response_protocol_ipv4_ping_response.go @@ -0,0 +1,386 @@ +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" +) + +// ***** ActionResponseProtocolIpv4PingResponse ***** +type actionResponseProtocolIpv4PingResponse struct { + validation + obj *otg.ActionResponseProtocolIpv4PingResponse + marshaller marshalActionResponseProtocolIpv4PingResponse + unMarshaller unMarshalActionResponseProtocolIpv4PingResponse +} + +func NewActionResponseProtocolIpv4PingResponse() ActionResponseProtocolIpv4PingResponse { + obj := actionResponseProtocolIpv4PingResponse{obj: &otg.ActionResponseProtocolIpv4PingResponse{}} + obj.setDefault() + return &obj +} + +func (obj *actionResponseProtocolIpv4PingResponse) msg() *otg.ActionResponseProtocolIpv4PingResponse { + return obj.obj +} + +func (obj *actionResponseProtocolIpv4PingResponse) setMsg(msg *otg.ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingResponse { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionResponseProtocolIpv4PingResponse struct { + obj *actionResponseProtocolIpv4PingResponse +} + +type marshalActionResponseProtocolIpv4PingResponse interface { + // ToProto marshals ActionResponseProtocolIpv4PingResponse to protobuf object *otg.ActionResponseProtocolIpv4PingResponse + ToProto() (*otg.ActionResponseProtocolIpv4PingResponse, error) + // ToPbText marshals ActionResponseProtocolIpv4PingResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionResponseProtocolIpv4PingResponse to YAML text + ToYaml() (string, error) + // ToJson marshals ActionResponseProtocolIpv4PingResponse to JSON text + ToJson() (string, error) +} + +type unMarshalactionResponseProtocolIpv4PingResponse struct { + obj *actionResponseProtocolIpv4PingResponse +} + +type unMarshalActionResponseProtocolIpv4PingResponse interface { + // FromProto unmarshals ActionResponseProtocolIpv4PingResponse from protobuf object *otg.ActionResponseProtocolIpv4PingResponse + FromProto(msg *otg.ActionResponseProtocolIpv4PingResponse) (ActionResponseProtocolIpv4PingResponse, error) + // FromPbText unmarshals ActionResponseProtocolIpv4PingResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionResponseProtocolIpv4PingResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionResponseProtocolIpv4PingResponse from JSON text + FromJson(value string) error +} + +func (obj *actionResponseProtocolIpv4PingResponse) Marshal() marshalActionResponseProtocolIpv4PingResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalactionResponseProtocolIpv4PingResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *actionResponseProtocolIpv4PingResponse) Unmarshal() unMarshalActionResponseProtocolIpv4PingResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionResponseProtocolIpv4PingResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionResponseProtocolIpv4PingResponse) ToProto() (*otg.ActionResponseProtocolIpv4PingResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionResponseProtocolIpv4PingResponse) FromProto(msg *otg.ActionResponseProtocolIpv4PingResponse) (ActionResponseProtocolIpv4PingResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionResponseProtocolIpv4PingResponse) 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 *unMarshalactionResponseProtocolIpv4PingResponse) 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 *marshalactionResponseProtocolIpv4PingResponse) 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 *unMarshalactionResponseProtocolIpv4PingResponse) 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 *marshalactionResponseProtocolIpv4PingResponse) 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 *unMarshalactionResponseProtocolIpv4PingResponse) 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 *actionResponseProtocolIpv4PingResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionResponseProtocolIpv4PingResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionResponseProtocolIpv4PingResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionResponseProtocolIpv4PingResponse) Clone() (ActionResponseProtocolIpv4PingResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionResponseProtocolIpv4PingResponse() + 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 +} + +// ActionResponseProtocolIpv4PingResponse is response for ping initiated between a single source and destination pair. +type ActionResponseProtocolIpv4PingResponse interface { + Validation + // msg marshals ActionResponseProtocolIpv4PingResponse to protobuf object *otg.ActionResponseProtocolIpv4PingResponse + // and doesn't set defaults + msg() *otg.ActionResponseProtocolIpv4PingResponse + // setMsg unmarshals ActionResponseProtocolIpv4PingResponse from protobuf object *otg.ActionResponseProtocolIpv4PingResponse + // and doesn't set defaults + setMsg(*otg.ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingResponse + // provides marshal interface + Marshal() marshalActionResponseProtocolIpv4PingResponse + // provides unmarshal interface + Unmarshal() unMarshalActionResponseProtocolIpv4PingResponse + // validate validates ActionResponseProtocolIpv4PingResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionResponseProtocolIpv4PingResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // SrcName returns string, set in ActionResponseProtocolIpv4PingResponse. + SrcName() string + // SetSrcName assigns string provided by user to ActionResponseProtocolIpv4PingResponse + SetSrcName(value string) ActionResponseProtocolIpv4PingResponse + // DstIp returns string, set in ActionResponseProtocolIpv4PingResponse. + DstIp() string + // SetDstIp assigns string provided by user to ActionResponseProtocolIpv4PingResponse + SetDstIp(value string) ActionResponseProtocolIpv4PingResponse + // Result returns ActionResponseProtocolIpv4PingResponseResultEnum, set in ActionResponseProtocolIpv4PingResponse + Result() ActionResponseProtocolIpv4PingResponseResultEnum + // SetResult assigns ActionResponseProtocolIpv4PingResponseResultEnum provided by user to ActionResponseProtocolIpv4PingResponse + SetResult(value ActionResponseProtocolIpv4PingResponseResultEnum) ActionResponseProtocolIpv4PingResponse +} + +// Name of source IPv4 interface used for ping. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// SrcName returns a string +func (obj *actionResponseProtocolIpv4PingResponse) SrcName() string { + + return *obj.obj.SrcName + +} + +// Name of source IPv4 interface used for ping. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// SetSrcName sets the string value in the ActionResponseProtocolIpv4PingResponse object +func (obj *actionResponseProtocolIpv4PingResponse) SetSrcName(value string) ActionResponseProtocolIpv4PingResponse { + + obj.obj.SrcName = &value + return obj +} + +// Destination IPv4 address used for ping. +// DstIp returns a string +func (obj *actionResponseProtocolIpv4PingResponse) DstIp() string { + + return *obj.obj.DstIp + +} + +// Destination IPv4 address used for ping. +// SetDstIp sets the string value in the ActionResponseProtocolIpv4PingResponse object +func (obj *actionResponseProtocolIpv4PingResponse) SetDstIp(value string) ActionResponseProtocolIpv4PingResponse { + + obj.obj.DstIp = &value + return obj +} + +type ActionResponseProtocolIpv4PingResponseResultEnum string + +// Enum of Result on ActionResponseProtocolIpv4PingResponse +var ActionResponseProtocolIpv4PingResponseResult = struct { + SUCCEEDED ActionResponseProtocolIpv4PingResponseResultEnum + FAILED ActionResponseProtocolIpv4PingResponseResultEnum +}{ + SUCCEEDED: ActionResponseProtocolIpv4PingResponseResultEnum("succeeded"), + FAILED: ActionResponseProtocolIpv4PingResponseResultEnum("failed"), +} + +func (obj *actionResponseProtocolIpv4PingResponse) Result() ActionResponseProtocolIpv4PingResponseResultEnum { + return ActionResponseProtocolIpv4PingResponseResultEnum(obj.obj.Result.Enum().String()) +} + +func (obj *actionResponseProtocolIpv4PingResponse) SetResult(value ActionResponseProtocolIpv4PingResponseResultEnum) ActionResponseProtocolIpv4PingResponse { + intValue, ok := otg.ActionResponseProtocolIpv4PingResponse_Result_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ActionResponseProtocolIpv4PingResponseResultEnum", string(value))) + return obj + } + enumValue := otg.ActionResponseProtocolIpv4PingResponse_Result_Enum(intValue) + obj.obj.Result = &enumValue + + return obj +} + +func (obj *actionResponseProtocolIpv4PingResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // SrcName is required + if obj.obj.SrcName == nil { + vObj.validationErrors = append(vObj.validationErrors, "SrcName is required field on interface ActionResponseProtocolIpv4PingResponse") + } + + // DstIp is required + if obj.obj.DstIp == nil { + vObj.validationErrors = append(vObj.validationErrors, "DstIp is required field on interface ActionResponseProtocolIpv4PingResponse") + } + if obj.obj.DstIp != nil { + + err := obj.validateIpv4(obj.DstIp()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on ActionResponseProtocolIpv4PingResponse.DstIp")) + } + + } + + // Result is required + if obj.obj.Result == nil { + vObj.validationErrors = append(vObj.validationErrors, "Result is required field on interface ActionResponseProtocolIpv4PingResponse") + } +} + +func (obj *actionResponseProtocolIpv4PingResponse) setDefault() { + +} diff --git a/gosnappi/action_response_protocol_ipv6.go b/gosnappi/action_response_protocol_ipv6.go new file mode 100644 index 00000000..d6f484fc --- /dev/null +++ b/gosnappi/action_response_protocol_ipv6.go @@ -0,0 +1,387 @@ +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" +) + +// ***** ActionResponseProtocolIpv6 ***** +type actionResponseProtocolIpv6 struct { + validation + obj *otg.ActionResponseProtocolIpv6 + marshaller marshalActionResponseProtocolIpv6 + unMarshaller unMarshalActionResponseProtocolIpv6 + pingHolder ActionResponseProtocolIpv6Ping +} + +func NewActionResponseProtocolIpv6() ActionResponseProtocolIpv6 { + obj := actionResponseProtocolIpv6{obj: &otg.ActionResponseProtocolIpv6{}} + obj.setDefault() + return &obj +} + +func (obj *actionResponseProtocolIpv6) msg() *otg.ActionResponseProtocolIpv6 { + return obj.obj +} + +func (obj *actionResponseProtocolIpv6) setMsg(msg *otg.ActionResponseProtocolIpv6) ActionResponseProtocolIpv6 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionResponseProtocolIpv6 struct { + obj *actionResponseProtocolIpv6 +} + +type marshalActionResponseProtocolIpv6 interface { + // ToProto marshals ActionResponseProtocolIpv6 to protobuf object *otg.ActionResponseProtocolIpv6 + ToProto() (*otg.ActionResponseProtocolIpv6, error) + // ToPbText marshals ActionResponseProtocolIpv6 to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionResponseProtocolIpv6 to YAML text + ToYaml() (string, error) + // ToJson marshals ActionResponseProtocolIpv6 to JSON text + ToJson() (string, error) +} + +type unMarshalactionResponseProtocolIpv6 struct { + obj *actionResponseProtocolIpv6 +} + +type unMarshalActionResponseProtocolIpv6 interface { + // FromProto unmarshals ActionResponseProtocolIpv6 from protobuf object *otg.ActionResponseProtocolIpv6 + FromProto(msg *otg.ActionResponseProtocolIpv6) (ActionResponseProtocolIpv6, error) + // FromPbText unmarshals ActionResponseProtocolIpv6 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionResponseProtocolIpv6 from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionResponseProtocolIpv6 from JSON text + FromJson(value string) error +} + +func (obj *actionResponseProtocolIpv6) Marshal() marshalActionResponseProtocolIpv6 { + if obj.marshaller == nil { + obj.marshaller = &marshalactionResponseProtocolIpv6{obj: obj} + } + return obj.marshaller +} + +func (obj *actionResponseProtocolIpv6) Unmarshal() unMarshalActionResponseProtocolIpv6 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionResponseProtocolIpv6{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionResponseProtocolIpv6) ToProto() (*otg.ActionResponseProtocolIpv6, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionResponseProtocolIpv6) FromProto(msg *otg.ActionResponseProtocolIpv6) (ActionResponseProtocolIpv6, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionResponseProtocolIpv6) 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 *unMarshalactionResponseProtocolIpv6) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalactionResponseProtocolIpv6) 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 *unMarshalactionResponseProtocolIpv6) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalactionResponseProtocolIpv6) 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 *unMarshalactionResponseProtocolIpv6) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *actionResponseProtocolIpv6) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionResponseProtocolIpv6) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionResponseProtocolIpv6) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionResponseProtocolIpv6) Clone() (ActionResponseProtocolIpv6, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionResponseProtocolIpv6() + 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 +} + +func (obj *actionResponseProtocolIpv6) setNil() { + obj.pingHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ActionResponseProtocolIpv6 is response for actions associated with IPv6 on configured resources. +type ActionResponseProtocolIpv6 interface { + Validation + // msg marshals ActionResponseProtocolIpv6 to protobuf object *otg.ActionResponseProtocolIpv6 + // and doesn't set defaults + msg() *otg.ActionResponseProtocolIpv6 + // setMsg unmarshals ActionResponseProtocolIpv6 from protobuf object *otg.ActionResponseProtocolIpv6 + // and doesn't set defaults + setMsg(*otg.ActionResponseProtocolIpv6) ActionResponseProtocolIpv6 + // provides marshal interface + Marshal() marshalActionResponseProtocolIpv6 + // provides unmarshal interface + Unmarshal() unMarshalActionResponseProtocolIpv6 + // validate validates ActionResponseProtocolIpv6 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionResponseProtocolIpv6, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ActionResponseProtocolIpv6ChoiceEnum, set in ActionResponseProtocolIpv6 + Choice() ActionResponseProtocolIpv6ChoiceEnum + // setChoice assigns ActionResponseProtocolIpv6ChoiceEnum provided by user to ActionResponseProtocolIpv6 + setChoice(value ActionResponseProtocolIpv6ChoiceEnum) ActionResponseProtocolIpv6 + // Ping returns ActionResponseProtocolIpv6Ping, set in ActionResponseProtocolIpv6. + // ActionResponseProtocolIpv6Ping is response for ping initiated between multiple source and destination pairs. + Ping() ActionResponseProtocolIpv6Ping + // SetPing assigns ActionResponseProtocolIpv6Ping provided by user to ActionResponseProtocolIpv6. + // ActionResponseProtocolIpv6Ping is response for ping initiated between multiple source and destination pairs. + SetPing(value ActionResponseProtocolIpv6Ping) ActionResponseProtocolIpv6 + // HasPing checks if Ping has been set in ActionResponseProtocolIpv6 + HasPing() bool + setNil() +} + +type ActionResponseProtocolIpv6ChoiceEnum string + +// Enum of Choice on ActionResponseProtocolIpv6 +var ActionResponseProtocolIpv6Choice = struct { + PING ActionResponseProtocolIpv6ChoiceEnum +}{ + PING: ActionResponseProtocolIpv6ChoiceEnum("ping"), +} + +func (obj *actionResponseProtocolIpv6) Choice() ActionResponseProtocolIpv6ChoiceEnum { + return ActionResponseProtocolIpv6ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *actionResponseProtocolIpv6) setChoice(value ActionResponseProtocolIpv6ChoiceEnum) ActionResponseProtocolIpv6 { + intValue, ok := otg.ActionResponseProtocolIpv6_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ActionResponseProtocolIpv6ChoiceEnum", string(value))) + return obj + } + enumValue := otg.ActionResponseProtocolIpv6_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Ping = nil + obj.pingHolder = nil + + if value == ActionResponseProtocolIpv6Choice.PING { + obj.obj.Ping = NewActionResponseProtocolIpv6Ping().msg() + } + + return obj +} + +// description is TBD +// Ping returns a ActionResponseProtocolIpv6Ping +func (obj *actionResponseProtocolIpv6) Ping() ActionResponseProtocolIpv6Ping { + if obj.obj.Ping == nil { + obj.setChoice(ActionResponseProtocolIpv6Choice.PING) + } + if obj.pingHolder == nil { + obj.pingHolder = &actionResponseProtocolIpv6Ping{obj: obj.obj.Ping} + } + return obj.pingHolder +} + +// description is TBD +// Ping returns a ActionResponseProtocolIpv6Ping +func (obj *actionResponseProtocolIpv6) HasPing() bool { + return obj.obj.Ping != nil +} + +// description is TBD +// SetPing sets the ActionResponseProtocolIpv6Ping value in the ActionResponseProtocolIpv6 object +func (obj *actionResponseProtocolIpv6) SetPing(value ActionResponseProtocolIpv6Ping) ActionResponseProtocolIpv6 { + obj.setChoice(ActionResponseProtocolIpv6Choice.PING) + obj.pingHolder = nil + obj.obj.Ping = value.msg() + + return obj +} + +func (obj *actionResponseProtocolIpv6) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionResponseProtocolIpv6") + } + + if obj.obj.Ping != nil { + + obj.Ping().validateObj(vObj, set_default) + } + +} + +func (obj *actionResponseProtocolIpv6) setDefault() { + var choices_set int = 0 + var choice ActionResponseProtocolIpv6ChoiceEnum + + if obj.obj.Ping != nil { + choices_set += 1 + choice = ActionResponseProtocolIpv6Choice.PING + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionResponseProtocolIpv6") + } + } else { + intVal := otg.ActionResponseProtocolIpv6_Choice_Enum_value[string(choice)] + enumValue := otg.ActionResponseProtocolIpv6_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/action_response_protocol_ipv6_ping.go b/gosnappi/action_response_protocol_ipv6_ping.go new file mode 100644 index 00000000..06c7e86b --- /dev/null +++ b/gosnappi/action_response_protocol_ipv6_ping.go @@ -0,0 +1,390 @@ +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" +) + +// ***** ActionResponseProtocolIpv6Ping ***** +type actionResponseProtocolIpv6Ping struct { + validation + obj *otg.ActionResponseProtocolIpv6Ping + marshaller marshalActionResponseProtocolIpv6Ping + unMarshaller unMarshalActionResponseProtocolIpv6Ping + responsesHolder ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter +} + +func NewActionResponseProtocolIpv6Ping() ActionResponseProtocolIpv6Ping { + obj := actionResponseProtocolIpv6Ping{obj: &otg.ActionResponseProtocolIpv6Ping{}} + obj.setDefault() + return &obj +} + +func (obj *actionResponseProtocolIpv6Ping) msg() *otg.ActionResponseProtocolIpv6Ping { + return obj.obj +} + +func (obj *actionResponseProtocolIpv6Ping) setMsg(msg *otg.ActionResponseProtocolIpv6Ping) ActionResponseProtocolIpv6Ping { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionResponseProtocolIpv6Ping struct { + obj *actionResponseProtocolIpv6Ping +} + +type marshalActionResponseProtocolIpv6Ping interface { + // ToProto marshals ActionResponseProtocolIpv6Ping to protobuf object *otg.ActionResponseProtocolIpv6Ping + ToProto() (*otg.ActionResponseProtocolIpv6Ping, error) + // ToPbText marshals ActionResponseProtocolIpv6Ping to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionResponseProtocolIpv6Ping to YAML text + ToYaml() (string, error) + // ToJson marshals ActionResponseProtocolIpv6Ping to JSON text + ToJson() (string, error) +} + +type unMarshalactionResponseProtocolIpv6Ping struct { + obj *actionResponseProtocolIpv6Ping +} + +type unMarshalActionResponseProtocolIpv6Ping interface { + // FromProto unmarshals ActionResponseProtocolIpv6Ping from protobuf object *otg.ActionResponseProtocolIpv6Ping + FromProto(msg *otg.ActionResponseProtocolIpv6Ping) (ActionResponseProtocolIpv6Ping, error) + // FromPbText unmarshals ActionResponseProtocolIpv6Ping from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionResponseProtocolIpv6Ping from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionResponseProtocolIpv6Ping from JSON text + FromJson(value string) error +} + +func (obj *actionResponseProtocolIpv6Ping) Marshal() marshalActionResponseProtocolIpv6Ping { + if obj.marshaller == nil { + obj.marshaller = &marshalactionResponseProtocolIpv6Ping{obj: obj} + } + return obj.marshaller +} + +func (obj *actionResponseProtocolIpv6Ping) Unmarshal() unMarshalActionResponseProtocolIpv6Ping { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionResponseProtocolIpv6Ping{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionResponseProtocolIpv6Ping) ToProto() (*otg.ActionResponseProtocolIpv6Ping, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionResponseProtocolIpv6Ping) FromProto(msg *otg.ActionResponseProtocolIpv6Ping) (ActionResponseProtocolIpv6Ping, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionResponseProtocolIpv6Ping) 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 *unMarshalactionResponseProtocolIpv6Ping) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalactionResponseProtocolIpv6Ping) 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 *unMarshalactionResponseProtocolIpv6Ping) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalactionResponseProtocolIpv6Ping) 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 *unMarshalactionResponseProtocolIpv6Ping) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *actionResponseProtocolIpv6Ping) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionResponseProtocolIpv6Ping) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionResponseProtocolIpv6Ping) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionResponseProtocolIpv6Ping) Clone() (ActionResponseProtocolIpv6Ping, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionResponseProtocolIpv6Ping() + 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 +} + +func (obj *actionResponseProtocolIpv6Ping) setNil() { + obj.responsesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ActionResponseProtocolIpv6Ping is response for ping initiated between multiple source and destination pairs. +type ActionResponseProtocolIpv6Ping interface { + Validation + // msg marshals ActionResponseProtocolIpv6Ping to protobuf object *otg.ActionResponseProtocolIpv6Ping + // and doesn't set defaults + msg() *otg.ActionResponseProtocolIpv6Ping + // setMsg unmarshals ActionResponseProtocolIpv6Ping from protobuf object *otg.ActionResponseProtocolIpv6Ping + // and doesn't set defaults + setMsg(*otg.ActionResponseProtocolIpv6Ping) ActionResponseProtocolIpv6Ping + // provides marshal interface + Marshal() marshalActionResponseProtocolIpv6Ping + // provides unmarshal interface + Unmarshal() unMarshalActionResponseProtocolIpv6Ping + // validate validates ActionResponseProtocolIpv6Ping + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionResponseProtocolIpv6Ping, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Responses returns ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIterIter, set in ActionResponseProtocolIpv6Ping + Responses() ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter + setNil() +} + +// List of responses for IPv6 ping responses. +// Responses returns a []ActionResponseProtocolIpv6PingResponse +func (obj *actionResponseProtocolIpv6Ping) Responses() ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { + if len(obj.obj.Responses) == 0 { + obj.obj.Responses = []*otg.ActionResponseProtocolIpv6PingResponse{} + } + if obj.responsesHolder == nil { + obj.responsesHolder = newActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter(&obj.obj.Responses).setMsg(obj) + } + return obj.responsesHolder +} + +type actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter struct { + obj *actionResponseProtocolIpv6Ping + actionResponseProtocolIpv6PingResponseSlice []ActionResponseProtocolIpv6PingResponse + fieldPtr *[]*otg.ActionResponseProtocolIpv6PingResponse +} + +func newActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter(ptr *[]*otg.ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { + return &actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter{fieldPtr: ptr} +} + +type ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter interface { + setMsg(*actionResponseProtocolIpv6Ping) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter + Items() []ActionResponseProtocolIpv6PingResponse + Add() ActionResponseProtocolIpv6PingResponse + Append(items ...ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter + Set(index int, newObj ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter + Clear() ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter + clearHolderSlice() ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter + appendHolderSlice(item ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter +} + +func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) setMsg(msg *actionResponseProtocolIpv6Ping) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&actionResponseProtocolIpv6PingResponse{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) Items() []ActionResponseProtocolIpv6PingResponse { + return obj.actionResponseProtocolIpv6PingResponseSlice +} + +func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) Add() ActionResponseProtocolIpv6PingResponse { + newObj := &otg.ActionResponseProtocolIpv6PingResponse{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &actionResponseProtocolIpv6PingResponse{obj: newObj} + newLibObj.setDefault() + obj.actionResponseProtocolIpv6PingResponseSlice = append(obj.actionResponseProtocolIpv6PingResponseSlice, newLibObj) + return newLibObj +} + +func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) Append(items ...ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.actionResponseProtocolIpv6PingResponseSlice = append(obj.actionResponseProtocolIpv6PingResponseSlice, item) + } + return obj +} + +func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) Set(index int, newObj ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.actionResponseProtocolIpv6PingResponseSlice[index] = newObj + return obj +} +func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) Clear() ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.ActionResponseProtocolIpv6PingResponse{} + obj.actionResponseProtocolIpv6PingResponseSlice = []ActionResponseProtocolIpv6PingResponse{} + } + return obj +} +func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) clearHolderSlice() ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { + if len(obj.actionResponseProtocolIpv6PingResponseSlice) > 0 { + obj.actionResponseProtocolIpv6PingResponseSlice = []ActionResponseProtocolIpv6PingResponse{} + } + return obj +} +func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) appendHolderSlice(item ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { + obj.actionResponseProtocolIpv6PingResponseSlice = append(obj.actionResponseProtocolIpv6PingResponseSlice, item) + return obj +} + +func (obj *actionResponseProtocolIpv6Ping) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Responses) != 0 { + + if set_default { + obj.Responses().clearHolderSlice() + for _, item := range obj.obj.Responses { + obj.Responses().appendHolderSlice(&actionResponseProtocolIpv6PingResponse{obj: item}) + } + } + for _, item := range obj.Responses().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *actionResponseProtocolIpv6Ping) setDefault() { + +} diff --git a/gosnappi/action_response_protocol_ipv6_ping_response.go b/gosnappi/action_response_protocol_ipv6_ping_response.go new file mode 100644 index 00000000..86b9d92b --- /dev/null +++ b/gosnappi/action_response_protocol_ipv6_ping_response.go @@ -0,0 +1,386 @@ +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" +) + +// ***** ActionResponseProtocolIpv6PingResponse ***** +type actionResponseProtocolIpv6PingResponse struct { + validation + obj *otg.ActionResponseProtocolIpv6PingResponse + marshaller marshalActionResponseProtocolIpv6PingResponse + unMarshaller unMarshalActionResponseProtocolIpv6PingResponse +} + +func NewActionResponseProtocolIpv6PingResponse() ActionResponseProtocolIpv6PingResponse { + obj := actionResponseProtocolIpv6PingResponse{obj: &otg.ActionResponseProtocolIpv6PingResponse{}} + obj.setDefault() + return &obj +} + +func (obj *actionResponseProtocolIpv6PingResponse) msg() *otg.ActionResponseProtocolIpv6PingResponse { + return obj.obj +} + +func (obj *actionResponseProtocolIpv6PingResponse) setMsg(msg *otg.ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingResponse { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalactionResponseProtocolIpv6PingResponse struct { + obj *actionResponseProtocolIpv6PingResponse +} + +type marshalActionResponseProtocolIpv6PingResponse interface { + // ToProto marshals ActionResponseProtocolIpv6PingResponse to protobuf object *otg.ActionResponseProtocolIpv6PingResponse + ToProto() (*otg.ActionResponseProtocolIpv6PingResponse, error) + // ToPbText marshals ActionResponseProtocolIpv6PingResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals ActionResponseProtocolIpv6PingResponse to YAML text + ToYaml() (string, error) + // ToJson marshals ActionResponseProtocolIpv6PingResponse to JSON text + ToJson() (string, error) +} + +type unMarshalactionResponseProtocolIpv6PingResponse struct { + obj *actionResponseProtocolIpv6PingResponse +} + +type unMarshalActionResponseProtocolIpv6PingResponse interface { + // FromProto unmarshals ActionResponseProtocolIpv6PingResponse from protobuf object *otg.ActionResponseProtocolIpv6PingResponse + FromProto(msg *otg.ActionResponseProtocolIpv6PingResponse) (ActionResponseProtocolIpv6PingResponse, error) + // FromPbText unmarshals ActionResponseProtocolIpv6PingResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ActionResponseProtocolIpv6PingResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals ActionResponseProtocolIpv6PingResponse from JSON text + FromJson(value string) error +} + +func (obj *actionResponseProtocolIpv6PingResponse) Marshal() marshalActionResponseProtocolIpv6PingResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalactionResponseProtocolIpv6PingResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *actionResponseProtocolIpv6PingResponse) Unmarshal() unMarshalActionResponseProtocolIpv6PingResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalactionResponseProtocolIpv6PingResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalactionResponseProtocolIpv6PingResponse) ToProto() (*otg.ActionResponseProtocolIpv6PingResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalactionResponseProtocolIpv6PingResponse) FromProto(msg *otg.ActionResponseProtocolIpv6PingResponse) (ActionResponseProtocolIpv6PingResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalactionResponseProtocolIpv6PingResponse) 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 *unMarshalactionResponseProtocolIpv6PingResponse) 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 *marshalactionResponseProtocolIpv6PingResponse) 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 *unMarshalactionResponseProtocolIpv6PingResponse) 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 *marshalactionResponseProtocolIpv6PingResponse) 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 *unMarshalactionResponseProtocolIpv6PingResponse) 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 *actionResponseProtocolIpv6PingResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *actionResponseProtocolIpv6PingResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *actionResponseProtocolIpv6PingResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *actionResponseProtocolIpv6PingResponse) Clone() (ActionResponseProtocolIpv6PingResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewActionResponseProtocolIpv6PingResponse() + 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 +} + +// ActionResponseProtocolIpv6PingResponse is response for ping initiated between a single source and destination pair. +type ActionResponseProtocolIpv6PingResponse interface { + Validation + // msg marshals ActionResponseProtocolIpv6PingResponse to protobuf object *otg.ActionResponseProtocolIpv6PingResponse + // and doesn't set defaults + msg() *otg.ActionResponseProtocolIpv6PingResponse + // setMsg unmarshals ActionResponseProtocolIpv6PingResponse from protobuf object *otg.ActionResponseProtocolIpv6PingResponse + // and doesn't set defaults + setMsg(*otg.ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingResponse + // provides marshal interface + Marshal() marshalActionResponseProtocolIpv6PingResponse + // provides unmarshal interface + Unmarshal() unMarshalActionResponseProtocolIpv6PingResponse + // validate validates ActionResponseProtocolIpv6PingResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ActionResponseProtocolIpv6PingResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // SrcName returns string, set in ActionResponseProtocolIpv6PingResponse. + SrcName() string + // SetSrcName assigns string provided by user to ActionResponseProtocolIpv6PingResponse + SetSrcName(value string) ActionResponseProtocolIpv6PingResponse + // DstIp returns string, set in ActionResponseProtocolIpv6PingResponse. + DstIp() string + // SetDstIp assigns string provided by user to ActionResponseProtocolIpv6PingResponse + SetDstIp(value string) ActionResponseProtocolIpv6PingResponse + // Result returns ActionResponseProtocolIpv6PingResponseResultEnum, set in ActionResponseProtocolIpv6PingResponse + Result() ActionResponseProtocolIpv6PingResponseResultEnum + // SetResult assigns ActionResponseProtocolIpv6PingResponseResultEnum provided by user to ActionResponseProtocolIpv6PingResponse + SetResult(value ActionResponseProtocolIpv6PingResponseResultEnum) ActionResponseProtocolIpv6PingResponse +} + +// Name of source IPv6 interface used for ping. +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// +// SrcName returns a string +func (obj *actionResponseProtocolIpv6PingResponse) SrcName() string { + + return *obj.obj.SrcName + +} + +// Name of source IPv6 interface used for ping. +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// +// SetSrcName sets the string value in the ActionResponseProtocolIpv6PingResponse object +func (obj *actionResponseProtocolIpv6PingResponse) SetSrcName(value string) ActionResponseProtocolIpv6PingResponse { + + obj.obj.SrcName = &value + return obj +} + +// Destination IPv6 address used for ping. +// DstIp returns a string +func (obj *actionResponseProtocolIpv6PingResponse) DstIp() string { + + return *obj.obj.DstIp + +} + +// Destination IPv6 address used for ping. +// SetDstIp sets the string value in the ActionResponseProtocolIpv6PingResponse object +func (obj *actionResponseProtocolIpv6PingResponse) SetDstIp(value string) ActionResponseProtocolIpv6PingResponse { + + obj.obj.DstIp = &value + return obj +} + +type ActionResponseProtocolIpv6PingResponseResultEnum string + +// Enum of Result on ActionResponseProtocolIpv6PingResponse +var ActionResponseProtocolIpv6PingResponseResult = struct { + SUCCEEDED ActionResponseProtocolIpv6PingResponseResultEnum + FAILED ActionResponseProtocolIpv6PingResponseResultEnum +}{ + SUCCEEDED: ActionResponseProtocolIpv6PingResponseResultEnum("succeeded"), + FAILED: ActionResponseProtocolIpv6PingResponseResultEnum("failed"), +} + +func (obj *actionResponseProtocolIpv6PingResponse) Result() ActionResponseProtocolIpv6PingResponseResultEnum { + return ActionResponseProtocolIpv6PingResponseResultEnum(obj.obj.Result.Enum().String()) +} + +func (obj *actionResponseProtocolIpv6PingResponse) SetResult(value ActionResponseProtocolIpv6PingResponseResultEnum) ActionResponseProtocolIpv6PingResponse { + intValue, ok := otg.ActionResponseProtocolIpv6PingResponse_Result_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ActionResponseProtocolIpv6PingResponseResultEnum", string(value))) + return obj + } + enumValue := otg.ActionResponseProtocolIpv6PingResponse_Result_Enum(intValue) + obj.obj.Result = &enumValue + + return obj +} + +func (obj *actionResponseProtocolIpv6PingResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // SrcName is required + if obj.obj.SrcName == nil { + vObj.validationErrors = append(vObj.validationErrors, "SrcName is required field on interface ActionResponseProtocolIpv6PingResponse") + } + + // DstIp is required + if obj.obj.DstIp == nil { + vObj.validationErrors = append(vObj.validationErrors, "DstIp is required field on interface ActionResponseProtocolIpv6PingResponse") + } + if obj.obj.DstIp != nil { + + err := obj.validateIpv6(obj.DstIp()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on ActionResponseProtocolIpv6PingResponse.DstIp")) + } + + } + + // Result is required + if obj.obj.Result == nil { + vObj.validationErrors = append(vObj.validationErrors, "Result is required field on interface ActionResponseProtocolIpv6PingResponse") + } +} + +func (obj *actionResponseProtocolIpv6PingResponse) setDefault() { + +} diff --git a/gosnappi/bgp_add_path.go b/gosnappi/bgp_add_path.go new file mode 100644 index 00000000..1a68f30d --- /dev/null +++ b/gosnappi/bgp_add_path.go @@ -0,0 +1,309 @@ +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" +) + +// ***** BgpAddPath ***** +type bgpAddPath struct { + validation + obj *otg.BgpAddPath + marshaller marshalBgpAddPath + unMarshaller unMarshalBgpAddPath +} + +func NewBgpAddPath() BgpAddPath { + obj := bgpAddPath{obj: &otg.BgpAddPath{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAddPath) msg() *otg.BgpAddPath { + return obj.obj +} + +func (obj *bgpAddPath) setMsg(msg *otg.BgpAddPath) BgpAddPath { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAddPath struct { + obj *bgpAddPath +} + +type marshalBgpAddPath interface { + // ToProto marshals BgpAddPath to protobuf object *otg.BgpAddPath + ToProto() (*otg.BgpAddPath, error) + // ToPbText marshals BgpAddPath to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAddPath to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAddPath to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAddPath struct { + obj *bgpAddPath +} + +type unMarshalBgpAddPath interface { + // FromProto unmarshals BgpAddPath from protobuf object *otg.BgpAddPath + FromProto(msg *otg.BgpAddPath) (BgpAddPath, error) + // FromPbText unmarshals BgpAddPath from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAddPath from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAddPath from JSON text + FromJson(value string) error +} + +func (obj *bgpAddPath) Marshal() marshalBgpAddPath { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAddPath{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAddPath) Unmarshal() unMarshalBgpAddPath { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAddPath{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAddPath) ToProto() (*otg.BgpAddPath, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAddPath) FromProto(msg *otg.BgpAddPath) (BgpAddPath, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAddPath) 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 *unMarshalbgpAddPath) 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 *marshalbgpAddPath) 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 *unMarshalbgpAddPath) 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 *marshalbgpAddPath) 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 *unMarshalbgpAddPath) 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 *bgpAddPath) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAddPath) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAddPath) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAddPath) Clone() (BgpAddPath, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAddPath() + 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 +} + +// BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. +type BgpAddPath interface { + Validation + // msg marshals BgpAddPath to protobuf object *otg.BgpAddPath + // and doesn't set defaults + msg() *otg.BgpAddPath + // setMsg unmarshals BgpAddPath from protobuf object *otg.BgpAddPath + // and doesn't set defaults + setMsg(*otg.BgpAddPath) BgpAddPath + // provides marshal interface + Marshal() marshalBgpAddPath + // provides unmarshal interface + Unmarshal() unMarshalBgpAddPath + // validate validates BgpAddPath + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAddPath, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PathId returns uint32, set in BgpAddPath. + PathId() uint32 + // SetPathId assigns uint32 provided by user to BgpAddPath + SetPathId(value uint32) BgpAddPath + // HasPathId checks if PathId has been set in BgpAddPath + HasPathId() bool +} + +// The id of the additional path. +// PathId returns a uint32 +func (obj *bgpAddPath) PathId() uint32 { + + return *obj.obj.PathId + +} + +// The id of the additional path. +// PathId returns a uint32 +func (obj *bgpAddPath) HasPathId() bool { + return obj.obj.PathId != nil +} + +// The id of the additional path. +// SetPathId sets the uint32 value in the BgpAddPath object +func (obj *bgpAddPath) SetPathId(value uint32) BgpAddPath { + + obj.obj.PathId = &value + return obj +} + +func (obj *bgpAddPath) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpAddPath) setDefault() { + if obj.obj.PathId == nil { + obj.SetPathId(1) + } + +} diff --git a/gosnappi/bgp_advanced.go b/gosnappi/bgp_advanced.go new file mode 100644 index 00000000..fd3ba3ae --- /dev/null +++ b/gosnappi/bgp_advanced.go @@ -0,0 +1,559 @@ +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" +) + +// ***** BgpAdvanced ***** +type bgpAdvanced struct { + validation + obj *otg.BgpAdvanced + marshaller marshalBgpAdvanced + unMarshaller unMarshalBgpAdvanced +} + +func NewBgpAdvanced() BgpAdvanced { + obj := bgpAdvanced{obj: &otg.BgpAdvanced{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAdvanced) msg() *otg.BgpAdvanced { + return obj.obj +} + +func (obj *bgpAdvanced) setMsg(msg *otg.BgpAdvanced) BgpAdvanced { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAdvanced struct { + obj *bgpAdvanced +} + +type marshalBgpAdvanced interface { + // ToProto marshals BgpAdvanced to protobuf object *otg.BgpAdvanced + ToProto() (*otg.BgpAdvanced, error) + // ToPbText marshals BgpAdvanced to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAdvanced to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAdvanced to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAdvanced struct { + obj *bgpAdvanced +} + +type unMarshalBgpAdvanced interface { + // FromProto unmarshals BgpAdvanced from protobuf object *otg.BgpAdvanced + FromProto(msg *otg.BgpAdvanced) (BgpAdvanced, error) + // FromPbText unmarshals BgpAdvanced from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAdvanced from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAdvanced from JSON text + FromJson(value string) error +} + +func (obj *bgpAdvanced) Marshal() marshalBgpAdvanced { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAdvanced{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAdvanced) Unmarshal() unMarshalBgpAdvanced { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAdvanced{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAdvanced) ToProto() (*otg.BgpAdvanced, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAdvanced) FromProto(msg *otg.BgpAdvanced) (BgpAdvanced, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAdvanced) 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 *unMarshalbgpAdvanced) 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 *marshalbgpAdvanced) 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 *unMarshalbgpAdvanced) 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 *marshalbgpAdvanced) 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 *unMarshalbgpAdvanced) 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 *bgpAdvanced) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAdvanced) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAdvanced) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAdvanced) Clone() (BgpAdvanced, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAdvanced() + 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 +} + +// BgpAdvanced is configuration for BGP advanced settings. +type BgpAdvanced interface { + Validation + // msg marshals BgpAdvanced to protobuf object *otg.BgpAdvanced + // and doesn't set defaults + msg() *otg.BgpAdvanced + // setMsg unmarshals BgpAdvanced from protobuf object *otg.BgpAdvanced + // and doesn't set defaults + setMsg(*otg.BgpAdvanced) BgpAdvanced + // provides marshal interface + Marshal() marshalBgpAdvanced + // provides unmarshal interface + Unmarshal() unMarshalBgpAdvanced + // validate validates BgpAdvanced + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAdvanced, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // HoldTimeInterval returns uint32, set in BgpAdvanced. + HoldTimeInterval() uint32 + // SetHoldTimeInterval assigns uint32 provided by user to BgpAdvanced + SetHoldTimeInterval(value uint32) BgpAdvanced + // HasHoldTimeInterval checks if HoldTimeInterval has been set in BgpAdvanced + HasHoldTimeInterval() bool + // KeepAliveInterval returns uint32, set in BgpAdvanced. + KeepAliveInterval() uint32 + // SetKeepAliveInterval assigns uint32 provided by user to BgpAdvanced + SetKeepAliveInterval(value uint32) BgpAdvanced + // HasKeepAliveInterval checks if KeepAliveInterval has been set in BgpAdvanced + HasKeepAliveInterval() bool + // UpdateInterval returns uint32, set in BgpAdvanced. + UpdateInterval() uint32 + // SetUpdateInterval assigns uint32 provided by user to BgpAdvanced + SetUpdateInterval(value uint32) BgpAdvanced + // HasUpdateInterval checks if UpdateInterval has been set in BgpAdvanced + HasUpdateInterval() bool + // TimeToLive returns uint32, set in BgpAdvanced. + TimeToLive() uint32 + // SetTimeToLive assigns uint32 provided by user to BgpAdvanced + SetTimeToLive(value uint32) BgpAdvanced + // HasTimeToLive checks if TimeToLive has been set in BgpAdvanced + HasTimeToLive() bool + // Md5Key returns string, set in BgpAdvanced. + Md5Key() string + // SetMd5Key assigns string provided by user to BgpAdvanced + SetMd5Key(value string) BgpAdvanced + // HasMd5Key checks if Md5Key has been set in BgpAdvanced + HasMd5Key() bool + // PassiveMode returns bool, set in BgpAdvanced. + PassiveMode() bool + // SetPassiveMode assigns bool provided by user to BgpAdvanced + SetPassiveMode(value bool) BgpAdvanced + // HasPassiveMode checks if PassiveMode has been set in BgpAdvanced + HasPassiveMode() bool + // ListenPort returns uint32, set in BgpAdvanced. + ListenPort() uint32 + // SetListenPort assigns uint32 provided by user to BgpAdvanced + SetListenPort(value uint32) BgpAdvanced + // HasListenPort checks if ListenPort has been set in BgpAdvanced + HasListenPort() bool + // NeighborPort returns uint32, set in BgpAdvanced. + NeighborPort() uint32 + // SetNeighborPort assigns uint32 provided by user to BgpAdvanced + SetNeighborPort(value uint32) BgpAdvanced + // HasNeighborPort checks if NeighborPort has been set in BgpAdvanced + HasNeighborPort() bool +} + +// Number of seconds the sender proposes for the value of the Hold Timer. +// HoldTimeInterval returns a uint32 +func (obj *bgpAdvanced) HoldTimeInterval() uint32 { + + return *obj.obj.HoldTimeInterval + +} + +// Number of seconds the sender proposes for the value of the Hold Timer. +// HoldTimeInterval returns a uint32 +func (obj *bgpAdvanced) HasHoldTimeInterval() bool { + return obj.obj.HoldTimeInterval != nil +} + +// Number of seconds the sender proposes for the value of the Hold Timer. +// SetHoldTimeInterval sets the uint32 value in the BgpAdvanced object +func (obj *bgpAdvanced) SetHoldTimeInterval(value uint32) BgpAdvanced { + + obj.obj.HoldTimeInterval = &value + return obj +} + +// Number of seconds between transmissions of Keepalive messages by this peer. +// KeepAliveInterval returns a uint32 +func (obj *bgpAdvanced) KeepAliveInterval() uint32 { + + return *obj.obj.KeepAliveInterval + +} + +// Number of seconds between transmissions of Keepalive messages by this peer. +// KeepAliveInterval returns a uint32 +func (obj *bgpAdvanced) HasKeepAliveInterval() bool { + return obj.obj.KeepAliveInterval != nil +} + +// Number of seconds between transmissions of Keepalive messages by this peer. +// SetKeepAliveInterval sets the uint32 value in the BgpAdvanced object +func (obj *bgpAdvanced) SetKeepAliveInterval(value uint32) BgpAdvanced { + + obj.obj.KeepAliveInterval = &value + return obj +} + +// The time interval at which Update messages are sent to the DUT, expressed as the number of milliseconds between Update messages. The update interval 0 implies to send all the updates as fast as possible. +// UpdateInterval returns a uint32 +func (obj *bgpAdvanced) UpdateInterval() uint32 { + + return *obj.obj.UpdateInterval + +} + +// The time interval at which Update messages are sent to the DUT, expressed as the number of milliseconds between Update messages. The update interval 0 implies to send all the updates as fast as possible. +// UpdateInterval returns a uint32 +func (obj *bgpAdvanced) HasUpdateInterval() bool { + return obj.obj.UpdateInterval != nil +} + +// The time interval at which Update messages are sent to the DUT, expressed as the number of milliseconds between Update messages. The update interval 0 implies to send all the updates as fast as possible. +// SetUpdateInterval sets the uint32 value in the BgpAdvanced object +func (obj *bgpAdvanced) SetUpdateInterval(value uint32) BgpAdvanced { + + obj.obj.UpdateInterval = &value + return obj +} + +// The limited number of iterations that a unit of data can experience before the data is discarded. This is placed in the TTL field in the IP header of the transmitted packets. +// TimeToLive returns a uint32 +func (obj *bgpAdvanced) TimeToLive() uint32 { + + return *obj.obj.TimeToLive + +} + +// The limited number of iterations that a unit of data can experience before the data is discarded. This is placed in the TTL field in the IP header of the transmitted packets. +// TimeToLive returns a uint32 +func (obj *bgpAdvanced) HasTimeToLive() bool { + return obj.obj.TimeToLive != nil +} + +// The limited number of iterations that a unit of data can experience before the data is discarded. This is placed in the TTL field in the IP header of the transmitted packets. +// SetTimeToLive sets the uint32 value in the BgpAdvanced object +func (obj *bgpAdvanced) SetTimeToLive(value uint32) BgpAdvanced { + + obj.obj.TimeToLive = &value + return obj +} + +// The value to be used as a secret MD5 key for authentication. If not configured, MD5 authentication will not be enabled. +// Md5Key returns a string +func (obj *bgpAdvanced) Md5Key() string { + + return *obj.obj.Md5Key + +} + +// The value to be used as a secret MD5 key for authentication. If not configured, MD5 authentication will not be enabled. +// Md5Key returns a string +func (obj *bgpAdvanced) HasMd5Key() bool { + return obj.obj.Md5Key != nil +} + +// The value to be used as a secret MD5 key for authentication. If not configured, MD5 authentication will not be enabled. +// SetMd5Key sets the string value in the BgpAdvanced object +func (obj *bgpAdvanced) SetMd5Key(value string) BgpAdvanced { + + obj.obj.Md5Key = &value + return obj +} + +// If set to true, the local BGP peer will wait for the remote peer to initiate the BGP session +// by establishing the TCP connection, rather than initiating sessions from the local peer. +// PassiveMode returns a bool +func (obj *bgpAdvanced) PassiveMode() bool { + + return *obj.obj.PassiveMode + +} + +// If set to true, the local BGP peer will wait for the remote peer to initiate the BGP session +// by establishing the TCP connection, rather than initiating sessions from the local peer. +// PassiveMode returns a bool +func (obj *bgpAdvanced) HasPassiveMode() bool { + return obj.obj.PassiveMode != nil +} + +// If set to true, the local BGP peer will wait for the remote peer to initiate the BGP session +// by establishing the TCP connection, rather than initiating sessions from the local peer. +// SetPassiveMode sets the bool value in the BgpAdvanced object +func (obj *bgpAdvanced) SetPassiveMode(value bool) BgpAdvanced { + + obj.obj.PassiveMode = &value + return obj +} + +// The TCP port number on which to accept BGP connections from the remote peer. +// ListenPort returns a uint32 +func (obj *bgpAdvanced) ListenPort() uint32 { + + return *obj.obj.ListenPort + +} + +// The TCP port number on which to accept BGP connections from the remote peer. +// ListenPort returns a uint32 +func (obj *bgpAdvanced) HasListenPort() bool { + return obj.obj.ListenPort != nil +} + +// The TCP port number on which to accept BGP connections from the remote peer. +// SetListenPort sets the uint32 value in the BgpAdvanced object +func (obj *bgpAdvanced) SetListenPort(value uint32) BgpAdvanced { + + obj.obj.ListenPort = &value + return obj +} + +// Destination TCP port number of the BGP peer when initiating a +// session from the local BGP peer. +// NeighborPort returns a uint32 +func (obj *bgpAdvanced) NeighborPort() uint32 { + + return *obj.obj.NeighborPort + +} + +// Destination TCP port number of the BGP peer when initiating a +// session from the local BGP peer. +// NeighborPort returns a uint32 +func (obj *bgpAdvanced) HasNeighborPort() bool { + return obj.obj.NeighborPort != nil +} + +// Destination TCP port number of the BGP peer when initiating a +// session from the local BGP peer. +// SetNeighborPort sets the uint32 value in the BgpAdvanced object +func (obj *bgpAdvanced) SetNeighborPort(value uint32) BgpAdvanced { + + obj.obj.NeighborPort = &value + return obj +} + +func (obj *bgpAdvanced) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.TimeToLive != nil { + + if *obj.obj.TimeToLive > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAdvanced.TimeToLive <= 255 but Got %d", *obj.obj.TimeToLive)) + } + + } + + if obj.obj.ListenPort != nil { + + if *obj.obj.ListenPort > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAdvanced.ListenPort <= 65535 but Got %d", *obj.obj.ListenPort)) + } + + } + + if obj.obj.NeighborPort != nil { + + if *obj.obj.NeighborPort > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAdvanced.NeighborPort <= 65535 but Got %d", *obj.obj.NeighborPort)) + } + + } + +} + +func (obj *bgpAdvanced) setDefault() { + if obj.obj.HoldTimeInterval == nil { + obj.SetHoldTimeInterval(90) + } + if obj.obj.KeepAliveInterval == nil { + obj.SetKeepAliveInterval(30) + } + if obj.obj.UpdateInterval == nil { + obj.SetUpdateInterval(0) + } + if obj.obj.TimeToLive == nil { + obj.SetTimeToLive(64) + } + if obj.obj.PassiveMode == nil { + obj.SetPassiveMode(false) + } + if obj.obj.ListenPort == nil { + obj.SetListenPort(179) + } + if obj.obj.NeighborPort == nil { + obj.SetNeighborPort(179) + } + +} diff --git a/gosnappi/bgp_as_path.go b/gosnappi/bgp_as_path.go new file mode 100644 index 00000000..3ae92c56 --- /dev/null +++ b/gosnappi/bgp_as_path.go @@ -0,0 +1,442 @@ +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" +) + +// ***** BgpAsPath ***** +type bgpAsPath struct { + validation + obj *otg.BgpAsPath + marshaller marshalBgpAsPath + unMarshaller unMarshalBgpAsPath + segmentsHolder BgpAsPathBgpAsPathSegmentIter +} + +func NewBgpAsPath() BgpAsPath { + obj := bgpAsPath{obj: &otg.BgpAsPath{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAsPath) msg() *otg.BgpAsPath { + return obj.obj +} + +func (obj *bgpAsPath) setMsg(msg *otg.BgpAsPath) BgpAsPath { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAsPath struct { + obj *bgpAsPath +} + +type marshalBgpAsPath interface { + // ToProto marshals BgpAsPath to protobuf object *otg.BgpAsPath + ToProto() (*otg.BgpAsPath, error) + // ToPbText marshals BgpAsPath to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAsPath to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAsPath to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAsPath struct { + obj *bgpAsPath +} + +type unMarshalBgpAsPath interface { + // FromProto unmarshals BgpAsPath from protobuf object *otg.BgpAsPath + FromProto(msg *otg.BgpAsPath) (BgpAsPath, error) + // FromPbText unmarshals BgpAsPath from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAsPath from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAsPath from JSON text + FromJson(value string) error +} + +func (obj *bgpAsPath) Marshal() marshalBgpAsPath { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAsPath{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAsPath) Unmarshal() unMarshalBgpAsPath { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAsPath{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAsPath) ToProto() (*otg.BgpAsPath, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAsPath) FromProto(msg *otg.BgpAsPath) (BgpAsPath, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAsPath) 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 *unMarshalbgpAsPath) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAsPath) 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 *unMarshalbgpAsPath) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAsPath) 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 *unMarshalbgpAsPath) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAsPath) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAsPath) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAsPath) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAsPath) Clone() (BgpAsPath, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAsPath() + 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 +} + +func (obj *bgpAsPath) setNil() { + obj.segmentsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. +type BgpAsPath interface { + Validation + // msg marshals BgpAsPath to protobuf object *otg.BgpAsPath + // and doesn't set defaults + msg() *otg.BgpAsPath + // setMsg unmarshals BgpAsPath from protobuf object *otg.BgpAsPath + // and doesn't set defaults + setMsg(*otg.BgpAsPath) BgpAsPath + // provides marshal interface + Marshal() marshalBgpAsPath + // provides unmarshal interface + Unmarshal() unMarshalBgpAsPath + // validate validates BgpAsPath + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAsPath, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // AsSetMode returns BgpAsPathAsSetModeEnum, set in BgpAsPath + AsSetMode() BgpAsPathAsSetModeEnum + // SetAsSetMode assigns BgpAsPathAsSetModeEnum provided by user to BgpAsPath + SetAsSetMode(value BgpAsPathAsSetModeEnum) BgpAsPath + // HasAsSetMode checks if AsSetMode has been set in BgpAsPath + HasAsSetMode() bool + // Segments returns BgpAsPathBgpAsPathSegmentIterIter, set in BgpAsPath + Segments() BgpAsPathBgpAsPathSegmentIter + setNil() +} + +type BgpAsPathAsSetModeEnum string + +// Enum of AsSetMode on BgpAsPath +var BgpAsPathAsSetMode = struct { + DO_NOT_INCLUDE_LOCAL_AS BgpAsPathAsSetModeEnum + INCLUDE_AS_SEQ BgpAsPathAsSetModeEnum + INCLUDE_AS_SET BgpAsPathAsSetModeEnum + INCLUDE_AS_CONFED_SEQ BgpAsPathAsSetModeEnum + INCLUDE_AS_CONFED_SET BgpAsPathAsSetModeEnum + PREPEND_TO_FIRST_SEGMENT BgpAsPathAsSetModeEnum +}{ + DO_NOT_INCLUDE_LOCAL_AS: BgpAsPathAsSetModeEnum("do_not_include_local_as"), + INCLUDE_AS_SEQ: BgpAsPathAsSetModeEnum("include_as_seq"), + INCLUDE_AS_SET: BgpAsPathAsSetModeEnum("include_as_set"), + INCLUDE_AS_CONFED_SEQ: BgpAsPathAsSetModeEnum("include_as_confed_seq"), + INCLUDE_AS_CONFED_SET: BgpAsPathAsSetModeEnum("include_as_confed_set"), + PREPEND_TO_FIRST_SEGMENT: BgpAsPathAsSetModeEnum("prepend_to_first_segment"), +} + +func (obj *bgpAsPath) AsSetMode() BgpAsPathAsSetModeEnum { + return BgpAsPathAsSetModeEnum(obj.obj.AsSetMode.Enum().String()) +} + +// Defines how the Local AS should be included in the MP REACH NLRI. For iBGP sessions, "Do Not Include Local AS" must be chosen. For eBGP sessions, any choice other than "Do Not Include Local AS" can be chosen. +// AsSetMode returns a string +func (obj *bgpAsPath) HasAsSetMode() bool { + return obj.obj.AsSetMode != nil +} + +func (obj *bgpAsPath) SetAsSetMode(value BgpAsPathAsSetModeEnum) BgpAsPath { + intValue, ok := otg.BgpAsPath_AsSetMode_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAsPathAsSetModeEnum", string(value))) + return obj + } + enumValue := otg.BgpAsPath_AsSetMode_Enum(intValue) + obj.obj.AsSetMode = &enumValue + + return obj +} + +// The additional AS path segments to be added in the NLRI. By default, an empty AS path is always included and the local AS is added to it as per the value of 'as_set_mode' attribute. +// Segments returns a []BgpAsPathSegment +func (obj *bgpAsPath) Segments() BgpAsPathBgpAsPathSegmentIter { + if len(obj.obj.Segments) == 0 { + obj.obj.Segments = []*otg.BgpAsPathSegment{} + } + if obj.segmentsHolder == nil { + obj.segmentsHolder = newBgpAsPathBgpAsPathSegmentIter(&obj.obj.Segments).setMsg(obj) + } + return obj.segmentsHolder +} + +type bgpAsPathBgpAsPathSegmentIter struct { + obj *bgpAsPath + bgpAsPathSegmentSlice []BgpAsPathSegment + fieldPtr *[]*otg.BgpAsPathSegment +} + +func newBgpAsPathBgpAsPathSegmentIter(ptr *[]*otg.BgpAsPathSegment) BgpAsPathBgpAsPathSegmentIter { + return &bgpAsPathBgpAsPathSegmentIter{fieldPtr: ptr} +} + +type BgpAsPathBgpAsPathSegmentIter interface { + setMsg(*bgpAsPath) BgpAsPathBgpAsPathSegmentIter + Items() []BgpAsPathSegment + Add() BgpAsPathSegment + Append(items ...BgpAsPathSegment) BgpAsPathBgpAsPathSegmentIter + Set(index int, newObj BgpAsPathSegment) BgpAsPathBgpAsPathSegmentIter + Clear() BgpAsPathBgpAsPathSegmentIter + clearHolderSlice() BgpAsPathBgpAsPathSegmentIter + appendHolderSlice(item BgpAsPathSegment) BgpAsPathBgpAsPathSegmentIter +} + +func (obj *bgpAsPathBgpAsPathSegmentIter) setMsg(msg *bgpAsPath) BgpAsPathBgpAsPathSegmentIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpAsPathSegment{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpAsPathBgpAsPathSegmentIter) Items() []BgpAsPathSegment { + return obj.bgpAsPathSegmentSlice +} + +func (obj *bgpAsPathBgpAsPathSegmentIter) Add() BgpAsPathSegment { + newObj := &otg.BgpAsPathSegment{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpAsPathSegment{obj: newObj} + newLibObj.setDefault() + obj.bgpAsPathSegmentSlice = append(obj.bgpAsPathSegmentSlice, newLibObj) + return newLibObj +} + +func (obj *bgpAsPathBgpAsPathSegmentIter) Append(items ...BgpAsPathSegment) BgpAsPathBgpAsPathSegmentIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpAsPathSegmentSlice = append(obj.bgpAsPathSegmentSlice, item) + } + return obj +} + +func (obj *bgpAsPathBgpAsPathSegmentIter) Set(index int, newObj BgpAsPathSegment) BgpAsPathBgpAsPathSegmentIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpAsPathSegmentSlice[index] = newObj + return obj +} +func (obj *bgpAsPathBgpAsPathSegmentIter) Clear() BgpAsPathBgpAsPathSegmentIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpAsPathSegment{} + obj.bgpAsPathSegmentSlice = []BgpAsPathSegment{} + } + return obj +} +func (obj *bgpAsPathBgpAsPathSegmentIter) clearHolderSlice() BgpAsPathBgpAsPathSegmentIter { + if len(obj.bgpAsPathSegmentSlice) > 0 { + obj.bgpAsPathSegmentSlice = []BgpAsPathSegment{} + } + return obj +} +func (obj *bgpAsPathBgpAsPathSegmentIter) appendHolderSlice(item BgpAsPathSegment) BgpAsPathBgpAsPathSegmentIter { + obj.bgpAsPathSegmentSlice = append(obj.bgpAsPathSegmentSlice, item) + return obj +} + +func (obj *bgpAsPath) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Segments) != 0 { + + if set_default { + obj.Segments().clearHolderSlice() + for _, item := range obj.obj.Segments { + obj.Segments().appendHolderSlice(&bgpAsPathSegment{obj: item}) + } + } + for _, item := range obj.Segments().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpAsPath) setDefault() { + if obj.obj.AsSetMode == nil { + obj.SetAsSetMode(BgpAsPathAsSetMode.DO_NOT_INCLUDE_LOCAL_AS) + + } + +} diff --git a/gosnappi/bgp_as_path_segment.go b/gosnappi/bgp_as_path_segment.go new file mode 100644 index 00000000..501139da --- /dev/null +++ b/gosnappi/bgp_as_path_segment.go @@ -0,0 +1,352 @@ +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" +) + +// ***** BgpAsPathSegment ***** +type bgpAsPathSegment struct { + validation + obj *otg.BgpAsPathSegment + marshaller marshalBgpAsPathSegment + unMarshaller unMarshalBgpAsPathSegment +} + +func NewBgpAsPathSegment() BgpAsPathSegment { + obj := bgpAsPathSegment{obj: &otg.BgpAsPathSegment{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAsPathSegment) msg() *otg.BgpAsPathSegment { + return obj.obj +} + +func (obj *bgpAsPathSegment) setMsg(msg *otg.BgpAsPathSegment) BgpAsPathSegment { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAsPathSegment struct { + obj *bgpAsPathSegment +} + +type marshalBgpAsPathSegment interface { + // ToProto marshals BgpAsPathSegment to protobuf object *otg.BgpAsPathSegment + ToProto() (*otg.BgpAsPathSegment, error) + // ToPbText marshals BgpAsPathSegment to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAsPathSegment to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAsPathSegment to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAsPathSegment struct { + obj *bgpAsPathSegment +} + +type unMarshalBgpAsPathSegment interface { + // FromProto unmarshals BgpAsPathSegment from protobuf object *otg.BgpAsPathSegment + FromProto(msg *otg.BgpAsPathSegment) (BgpAsPathSegment, error) + // FromPbText unmarshals BgpAsPathSegment from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAsPathSegment from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAsPathSegment from JSON text + FromJson(value string) error +} + +func (obj *bgpAsPathSegment) Marshal() marshalBgpAsPathSegment { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAsPathSegment{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAsPathSegment) Unmarshal() unMarshalBgpAsPathSegment { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAsPathSegment{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAsPathSegment) ToProto() (*otg.BgpAsPathSegment, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAsPathSegment) FromProto(msg *otg.BgpAsPathSegment) (BgpAsPathSegment, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAsPathSegment) 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 *unMarshalbgpAsPathSegment) 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 *marshalbgpAsPathSegment) 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 *unMarshalbgpAsPathSegment) 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 *marshalbgpAsPathSegment) 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 *unMarshalbgpAsPathSegment) 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 *bgpAsPathSegment) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAsPathSegment) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAsPathSegment) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAsPathSegment) Clone() (BgpAsPathSegment, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAsPathSegment() + 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 +} + +// BgpAsPathSegment is configuration for a single BGP AS path segment +type BgpAsPathSegment interface { + Validation + // msg marshals BgpAsPathSegment to protobuf object *otg.BgpAsPathSegment + // and doesn't set defaults + msg() *otg.BgpAsPathSegment + // setMsg unmarshals BgpAsPathSegment from protobuf object *otg.BgpAsPathSegment + // and doesn't set defaults + setMsg(*otg.BgpAsPathSegment) BgpAsPathSegment + // provides marshal interface + Marshal() marshalBgpAsPathSegment + // provides unmarshal interface + Unmarshal() unMarshalBgpAsPathSegment + // validate validates BgpAsPathSegment + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAsPathSegment, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Type returns BgpAsPathSegmentTypeEnum, set in BgpAsPathSegment + Type() BgpAsPathSegmentTypeEnum + // SetType assigns BgpAsPathSegmentTypeEnum provided by user to BgpAsPathSegment + SetType(value BgpAsPathSegmentTypeEnum) BgpAsPathSegment + // HasType checks if Type has been set in BgpAsPathSegment + HasType() bool + // AsNumbers returns []uint32, set in BgpAsPathSegment. + AsNumbers() []uint32 + // SetAsNumbers assigns []uint32 provided by user to BgpAsPathSegment + SetAsNumbers(value []uint32) BgpAsPathSegment +} + +type BgpAsPathSegmentTypeEnum string + +// Enum of Type on BgpAsPathSegment +var BgpAsPathSegmentType = struct { + AS_SEQ BgpAsPathSegmentTypeEnum + AS_SET BgpAsPathSegmentTypeEnum + AS_CONFED_SEQ BgpAsPathSegmentTypeEnum + AS_CONFED_SET BgpAsPathSegmentTypeEnum +}{ + AS_SEQ: BgpAsPathSegmentTypeEnum("as_seq"), + AS_SET: BgpAsPathSegmentTypeEnum("as_set"), + AS_CONFED_SEQ: BgpAsPathSegmentTypeEnum("as_confed_seq"), + AS_CONFED_SET: BgpAsPathSegmentTypeEnum("as_confed_set"), +} + +func (obj *bgpAsPathSegment) Type() BgpAsPathSegmentTypeEnum { + return BgpAsPathSegmentTypeEnum(obj.obj.Type.Enum().String()) +} + +// AS sequence is the most common type of AS_PATH, it contains the list of ASNs starting with the most recent ASN being added read from left to right. +// The other three AS_PATH types are used for Confederations - AS_SET is the type of AS_PATH attribute that summarizes routes using using the aggregate-address command, allowing AS_PATHs to be summarized in the update as well. - AS_CONFED_SEQ gives the list of ASNs in the path starting with the most recent ASN to be added reading left to right - AS_CONFED_SET will allow summarization of multiple AS PATHs to be sent in BGP Updates. +// Type returns a string +func (obj *bgpAsPathSegment) HasType() bool { + return obj.obj.Type != nil +} + +func (obj *bgpAsPathSegment) SetType(value BgpAsPathSegmentTypeEnum) BgpAsPathSegment { + intValue, ok := otg.BgpAsPathSegment_Type_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAsPathSegmentTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpAsPathSegment_Type_Enum(intValue) + obj.obj.Type = &enumValue + + return obj +} + +// The AS numbers in this AS path segment. +// AsNumbers returns a []uint32 +func (obj *bgpAsPathSegment) AsNumbers() []uint32 { + if obj.obj.AsNumbers == nil { + obj.obj.AsNumbers = make([]uint32, 0) + } + return obj.obj.AsNumbers +} + +// The AS numbers in this AS path segment. +// SetAsNumbers sets the []uint32 value in the BgpAsPathSegment object +func (obj *bgpAsPathSegment) SetAsNumbers(value []uint32) BgpAsPathSegment { + + if obj.obj.AsNumbers == nil { + obj.obj.AsNumbers = make([]uint32, 0) + } + obj.obj.AsNumbers = value + + return obj +} + +func (obj *bgpAsPathSegment) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpAsPathSegment) setDefault() { + if obj.obj.Type == nil { + obj.SetType(BgpAsPathSegmentType.AS_SEQ) + + } + +} diff --git a/gosnappi/bgp_attributes.go b/gosnappi/bgp_attributes.go new file mode 100644 index 00000000..371446e7 --- /dev/null +++ b/gosnappi/bgp_attributes.go @@ -0,0 +1,1276 @@ +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" +) + +// ***** BgpAttributes ***** +type bgpAttributes struct { + validation + obj *otg.BgpAttributes + marshaller marshalBgpAttributes + unMarshaller unMarshalBgpAttributes + otherAttributesHolder BgpAttributesBgpAttributesOtherAttributeIter + asPathHolder BgpAttributesAsPath + as4PathHolder BgpAttributesAs4Path + nextHopHolder BgpAttributesNextHop + multiExitDiscriminatorHolder BgpAttributesMultiExitDiscriminator + localPreferenceHolder BgpAttributesLocalPreference + aggregatorHolder BgpAttributesAggregator + as4AggregatorHolder BgpAttributesAs4Aggregator + communityHolder BgpAttributesBgpAttributesCommunityIter + originatorIdHolder BgpAttributesOriginatorId + extendedCommunitiesHolder BgpAttributesBgpExtendedCommunityIter + tunnelEncapsulationHolder BgpAttributesTunnelEncapsulation + mpReachHolder BgpAttributesMpReachNlri + mpUnreachHolder BgpAttributesMpUnreachNlri +} + +func NewBgpAttributes() BgpAttributes { + obj := bgpAttributes{obj: &otg.BgpAttributes{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributes) msg() *otg.BgpAttributes { + return obj.obj +} + +func (obj *bgpAttributes) setMsg(msg *otg.BgpAttributes) BgpAttributes { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributes struct { + obj *bgpAttributes +} + +type marshalBgpAttributes interface { + // ToProto marshals BgpAttributes to protobuf object *otg.BgpAttributes + ToProto() (*otg.BgpAttributes, error) + // ToPbText marshals BgpAttributes to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributes to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributes to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributes struct { + obj *bgpAttributes +} + +type unMarshalBgpAttributes interface { + // FromProto unmarshals BgpAttributes from protobuf object *otg.BgpAttributes + FromProto(msg *otg.BgpAttributes) (BgpAttributes, error) + // FromPbText unmarshals BgpAttributes from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributes from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributes from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributes) Marshal() marshalBgpAttributes { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributes{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributes) Unmarshal() unMarshalBgpAttributes { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributes{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributes) ToProto() (*otg.BgpAttributes, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributes) FromProto(msg *otg.BgpAttributes) (BgpAttributes, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributes) 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 *unMarshalbgpAttributes) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributes) 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 *unMarshalbgpAttributes) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributes) 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 *unMarshalbgpAttributes) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributes) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributes) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributes) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributes) Clone() (BgpAttributes, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributes() + 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 +} + +func (obj *bgpAttributes) setNil() { + obj.otherAttributesHolder = nil + obj.asPathHolder = nil + obj.as4PathHolder = nil + obj.nextHopHolder = nil + obj.multiExitDiscriminatorHolder = nil + obj.localPreferenceHolder = nil + obj.aggregatorHolder = nil + obj.as4AggregatorHolder = nil + obj.communityHolder = nil + obj.originatorIdHolder = nil + obj.extendedCommunitiesHolder = nil + obj.tunnelEncapsulationHolder = nil + obj.mpReachHolder = nil + obj.mpUnreachHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributes is attributes carried in the Update packet alongwith the reach/unreach prefixes. +type BgpAttributes interface { + Validation + // msg marshals BgpAttributes to protobuf object *otg.BgpAttributes + // and doesn't set defaults + msg() *otg.BgpAttributes + // setMsg unmarshals BgpAttributes from protobuf object *otg.BgpAttributes + // and doesn't set defaults + setMsg(*otg.BgpAttributes) BgpAttributes + // provides marshal interface + Marshal() marshalBgpAttributes + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributes + // validate validates BgpAttributes + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributes, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // OtherAttributes returns BgpAttributesBgpAttributesOtherAttributeIterIter, set in BgpAttributes + OtherAttributes() BgpAttributesBgpAttributesOtherAttributeIter + // Origin returns BgpAttributesOriginEnum, set in BgpAttributes + Origin() BgpAttributesOriginEnum + // SetOrigin assigns BgpAttributesOriginEnum provided by user to BgpAttributes + SetOrigin(value BgpAttributesOriginEnum) BgpAttributes + // HasOrigin checks if Origin has been set in BgpAttributes + HasOrigin() bool + // AsPath returns BgpAttributesAsPath, set in BgpAttributes. + // BgpAttributesAsPath is the AS_PATH attribute identifies the autonomous systems through which routing information + // carried in this UPDATE message has passed. + // This contains the configuration of how to include the Local AS in the AS path + // attribute of the MP REACH NLRI. It also contains optional configuration of + // additional AS Path Segments that can be included in the AS Path attribute. + // The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that + // a routing information passes through to reach the destination. + // There are two modes in which AS numbers can be encoded in the AS Path Segments + // - When the AS Path is being exchanged between old and new BGP speakers or between two old BGP speakers , the AS numbers are encoded as 2 byte values. + // - When the AS Path is being exchanged between two new BGP speakers supporting 4 byte AS , the AS numbers are encoded as 4 byte values. + AsPath() BgpAttributesAsPath + // SetAsPath assigns BgpAttributesAsPath provided by user to BgpAttributes. + // BgpAttributesAsPath is the AS_PATH attribute identifies the autonomous systems through which routing information + // carried in this UPDATE message has passed. + // This contains the configuration of how to include the Local AS in the AS path + // attribute of the MP REACH NLRI. It also contains optional configuration of + // additional AS Path Segments that can be included in the AS Path attribute. + // The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that + // a routing information passes through to reach the destination. + // There are two modes in which AS numbers can be encoded in the AS Path Segments + // - When the AS Path is being exchanged between old and new BGP speakers or between two old BGP speakers , the AS numbers are encoded as 2 byte values. + // - When the AS Path is being exchanged between two new BGP speakers supporting 4 byte AS , the AS numbers are encoded as 4 byte values. + SetAsPath(value BgpAttributesAsPath) BgpAttributes + // HasAsPath checks if AsPath has been set in BgpAttributes + HasAsPath() bool + // As4Path returns BgpAttributesAs4Path, set in BgpAttributes. + // BgpAttributesAs4Path is the AS4_PATH attribute identifies the autonomous systems through which routing information + // carried in this UPDATE message has passed. + // This contains the configuration of how to include the Local AS in the AS path + // attribute of the MP REACH NLRI. It also contains optional configuration of + // additional AS Path Segments that can be included in the AS Path attribute. + // The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that + // a routing information passes through to reach the destination. + // AS4_PATH is only exchanged in two scenarios: + // - When an old BGP speaker has to forward a received AS4_PATH containing 4 byte AS numbers to new BGP speaker. + // - When a new BGP speaker is connected to an old BGP speaker and has to propagate 4 byte AS numbers via the old BGP speaker. + // Its usage is described in RFC4893. + As4Path() BgpAttributesAs4Path + // SetAs4Path assigns BgpAttributesAs4Path provided by user to BgpAttributes. + // BgpAttributesAs4Path is the AS4_PATH attribute identifies the autonomous systems through which routing information + // carried in this UPDATE message has passed. + // This contains the configuration of how to include the Local AS in the AS path + // attribute of the MP REACH NLRI. It also contains optional configuration of + // additional AS Path Segments that can be included in the AS Path attribute. + // The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that + // a routing information passes through to reach the destination. + // AS4_PATH is only exchanged in two scenarios: + // - When an old BGP speaker has to forward a received AS4_PATH containing 4 byte AS numbers to new BGP speaker. + // - When a new BGP speaker is connected to an old BGP speaker and has to propagate 4 byte AS numbers via the old BGP speaker. + // Its usage is described in RFC4893. + SetAs4Path(value BgpAttributesAs4Path) BgpAttributes + // HasAs4Path checks if As4Path has been set in BgpAttributes + HasAs4Path() bool + // NextHop returns BgpAttributesNextHop, set in BgpAttributes. + // BgpAttributesNextHop is next hop to be sent inside MP_REACH NLRI or as the NEXT_HOP attribute if advertised as traditional NLRI. + NextHop() BgpAttributesNextHop + // SetNextHop assigns BgpAttributesNextHop provided by user to BgpAttributes. + // BgpAttributesNextHop is next hop to be sent inside MP_REACH NLRI or as the NEXT_HOP attribute if advertised as traditional NLRI. + SetNextHop(value BgpAttributesNextHop) BgpAttributes + // HasNextHop checks if NextHop has been set in BgpAttributes + HasNextHop() bool + // MultiExitDiscriminator returns BgpAttributesMultiExitDiscriminator, set in BgpAttributes. + // BgpAttributesMultiExitDiscriminator is optional MULTI_EXIT_DISCRIMINATOR attribute sent to the peer to help in the route selection process. + MultiExitDiscriminator() BgpAttributesMultiExitDiscriminator + // SetMultiExitDiscriminator assigns BgpAttributesMultiExitDiscriminator provided by user to BgpAttributes. + // BgpAttributesMultiExitDiscriminator is optional MULTI_EXIT_DISCRIMINATOR attribute sent to the peer to help in the route selection process. + SetMultiExitDiscriminator(value BgpAttributesMultiExitDiscriminator) BgpAttributes + // HasMultiExitDiscriminator checks if MultiExitDiscriminator has been set in BgpAttributes + HasMultiExitDiscriminator() bool + // LocalPreference returns BgpAttributesLocalPreference, set in BgpAttributes. + // BgpAttributesLocalPreference is optional LOCAL_PREFERENCE attribute sent to the peer to indicate the degree of preference + // for externally learned routes.This should be included only for internal peers.It is + // used for the selection of the path for the traffic leaving the AS.The route with the + // highest local preference value is preferred. + LocalPreference() BgpAttributesLocalPreference + // SetLocalPreference assigns BgpAttributesLocalPreference provided by user to BgpAttributes. + // BgpAttributesLocalPreference is optional LOCAL_PREFERENCE attribute sent to the peer to indicate the degree of preference + // for externally learned routes.This should be included only for internal peers.It is + // used for the selection of the path for the traffic leaving the AS.The route with the + // highest local preference value is preferred. + SetLocalPreference(value BgpAttributesLocalPreference) BgpAttributes + // HasLocalPreference checks if LocalPreference has been set in BgpAttributes + HasLocalPreference() bool + // IncludeAtomicAggregator returns bool, set in BgpAttributes. + IncludeAtomicAggregator() bool + // SetIncludeAtomicAggregator assigns bool provided by user to BgpAttributes + SetIncludeAtomicAggregator(value bool) BgpAttributes + // HasIncludeAtomicAggregator checks if IncludeAtomicAggregator has been set in BgpAttributes + HasIncludeAtomicAggregator() bool + // Aggregator returns BgpAttributesAggregator, set in BgpAttributes. + // BgpAttributesAggregator is optional AGGREGATOR attribute which maybe be added by a BGP speaker which performs route aggregation. + // When AGGREGATOR attribute is being sent to a new BGP speaker , the AS number is encoded as a 4 byte value. + // When AGGREGATOR attribute is being exchanged between a new and an old BGP speaker or between two old BGP speakers, + // the AS number is encoded as a 2 byte value. + // It contain the AS number and IP address of the speaker performing the aggregation. + Aggregator() BgpAttributesAggregator + // SetAggregator assigns BgpAttributesAggregator provided by user to BgpAttributes. + // BgpAttributesAggregator is optional AGGREGATOR attribute which maybe be added by a BGP speaker which performs route aggregation. + // When AGGREGATOR attribute is being sent to a new BGP speaker , the AS number is encoded as a 4 byte value. + // When AGGREGATOR attribute is being exchanged between a new and an old BGP speaker or between two old BGP speakers, + // the AS number is encoded as a 2 byte value. + // It contain the AS number and IP address of the speaker performing the aggregation. + SetAggregator(value BgpAttributesAggregator) BgpAttributes + // HasAggregator checks if Aggregator has been set in BgpAttributes + HasAggregator() bool + // As4Aggregator returns BgpAttributesAs4Aggregator, set in BgpAttributes. + // BgpAttributesAs4Aggregator is optional AS4_AGGREGATOR attribute which maybe be added by a BGP speaker in one of two cases: + // - If it is a new BGP speaker speaking to an old BGP speaker and needs to send a 4 byte value for the AS number of the BGP route aggregator. + // - If it is a old BGP speaker speaking to a new BGP speaker and has to transparently forward a received AS4_AGGREGATOR from some other peer. + // Its usage is described in RFC4893. + As4Aggregator() BgpAttributesAs4Aggregator + // SetAs4Aggregator assigns BgpAttributesAs4Aggregator provided by user to BgpAttributes. + // BgpAttributesAs4Aggregator is optional AS4_AGGREGATOR attribute which maybe be added by a BGP speaker in one of two cases: + // - If it is a new BGP speaker speaking to an old BGP speaker and needs to send a 4 byte value for the AS number of the BGP route aggregator. + // - If it is a old BGP speaker speaking to a new BGP speaker and has to transparently forward a received AS4_AGGREGATOR from some other peer. + // Its usage is described in RFC4893. + SetAs4Aggregator(value BgpAttributesAs4Aggregator) BgpAttributes + // HasAs4Aggregator checks if As4Aggregator has been set in BgpAttributes + HasAs4Aggregator() bool + // Community returns BgpAttributesBgpAttributesCommunityIterIter, set in BgpAttributes + Community() BgpAttributesBgpAttributesCommunityIter + // OriginatorId returns BgpAttributesOriginatorId, set in BgpAttributes. + // BgpAttributesOriginatorId is optional ORIGINATOR_ID attribute (type code 9) carries the Router Id of the route's originator in the local AS. + OriginatorId() BgpAttributesOriginatorId + // SetOriginatorId assigns BgpAttributesOriginatorId provided by user to BgpAttributes. + // BgpAttributesOriginatorId is optional ORIGINATOR_ID attribute (type code 9) carries the Router Id of the route's originator in the local AS. + SetOriginatorId(value BgpAttributesOriginatorId) BgpAttributes + // HasOriginatorId checks if OriginatorId has been set in BgpAttributes + HasOriginatorId() bool + // ClusterIds returns []string, set in BgpAttributes. + ClusterIds() []string + // SetClusterIds assigns []string provided by user to BgpAttributes + SetClusterIds(value []string) BgpAttributes + // ExtendedCommunities returns BgpAttributesBgpExtendedCommunityIterIter, set in BgpAttributes + ExtendedCommunities() BgpAttributesBgpExtendedCommunityIter + // TunnelEncapsulation returns BgpAttributesTunnelEncapsulation, set in BgpAttributes. + // BgpAttributesTunnelEncapsulation is the TUNNEL_ENCAPSULATION attribute is used by a BGP speaker to inform other BGP speakers how to encapsulate packets that need to be sent to it. + // It is defined in RFC9012 and is assigned a Type code of 23. + TunnelEncapsulation() BgpAttributesTunnelEncapsulation + // SetTunnelEncapsulation assigns BgpAttributesTunnelEncapsulation provided by user to BgpAttributes. + // BgpAttributesTunnelEncapsulation is the TUNNEL_ENCAPSULATION attribute is used by a BGP speaker to inform other BGP speakers how to encapsulate packets that need to be sent to it. + // It is defined in RFC9012 and is assigned a Type code of 23. + SetTunnelEncapsulation(value BgpAttributesTunnelEncapsulation) BgpAttributes + // HasTunnelEncapsulation checks if TunnelEncapsulation has been set in BgpAttributes + HasTunnelEncapsulation() bool + // MpReach returns BgpAttributesMpReachNlri, set in BgpAttributes. + // BgpAttributesMpReachNlri is the MP_REACH attribute is an optional attribute which can be included in the attributes of a BGP Update message as defined in https://datatracker.ietf.org/doc/html/rfc4760#section-3. + // The following AFI / SAFI combinations are supported: + // - IPv4 Unicast with AFI as 1 and SAFI as 1 + // - IPv6 Unicast with AFI as 2 and SAFI as 1 + // - Segment Routing Policy for IPv4 Unicast with AFI as 1 and SAFI as 73 ( draft-ietf-idr-sr-policy-safi-02 Section 2.1 ) + // - Segment Routing Policy for IPv6 Unicast with AFI as 2 and SAFI as 73 + MpReach() BgpAttributesMpReachNlri + // SetMpReach assigns BgpAttributesMpReachNlri provided by user to BgpAttributes. + // BgpAttributesMpReachNlri is the MP_REACH attribute is an optional attribute which can be included in the attributes of a BGP Update message as defined in https://datatracker.ietf.org/doc/html/rfc4760#section-3. + // The following AFI / SAFI combinations are supported: + // - IPv4 Unicast with AFI as 1 and SAFI as 1 + // - IPv6 Unicast with AFI as 2 and SAFI as 1 + // - Segment Routing Policy for IPv4 Unicast with AFI as 1 and SAFI as 73 ( draft-ietf-idr-sr-policy-safi-02 Section 2.1 ) + // - Segment Routing Policy for IPv6 Unicast with AFI as 2 and SAFI as 73 + SetMpReach(value BgpAttributesMpReachNlri) BgpAttributes + // HasMpReach checks if MpReach has been set in BgpAttributes + HasMpReach() bool + // MpUnreach returns BgpAttributesMpUnreachNlri, set in BgpAttributes. + // BgpAttributesMpUnreachNlri is the MP_UNREACH attribute is an optional attribute which can be included in the attributes of a BGP Update message as defined in https://datatracker.ietf.org/doc/html/rfc4760#section-3. + // The following AFI / SAFI combinations are supported: + // - IPv4 Unicast with AFI as 1 and SAFI as 1 + // - IPv6 Unicast with AFI as 2 and SAFI as 1 + // - Segment Routing Policy for IPv4 Unicast with AFI as 1 and SAFI as 73 (draft-ietf-idr-sr-policy-safi-02 Section 2.1) + // - Segment Routing Policy for IPv6 Unicast with AFI as 2 and SAFI as 73 + MpUnreach() BgpAttributesMpUnreachNlri + // SetMpUnreach assigns BgpAttributesMpUnreachNlri provided by user to BgpAttributes. + // BgpAttributesMpUnreachNlri is the MP_UNREACH attribute is an optional attribute which can be included in the attributes of a BGP Update message as defined in https://datatracker.ietf.org/doc/html/rfc4760#section-3. + // The following AFI / SAFI combinations are supported: + // - IPv4 Unicast with AFI as 1 and SAFI as 1 + // - IPv6 Unicast with AFI as 2 and SAFI as 1 + // - Segment Routing Policy for IPv4 Unicast with AFI as 1 and SAFI as 73 (draft-ietf-idr-sr-policy-safi-02 Section 2.1) + // - Segment Routing Policy for IPv6 Unicast with AFI as 2 and SAFI as 73 + SetMpUnreach(value BgpAttributesMpUnreachNlri) BgpAttributes + // HasMpUnreach checks if MpUnreach has been set in BgpAttributes + HasMpUnreach() bool + setNil() +} + +// Any attributes not present in the list of configurable attributes should be added to the list of unknown attributes. +// OtherAttributes returns a []BgpAttributesOtherAttribute +func (obj *bgpAttributes) OtherAttributes() BgpAttributesBgpAttributesOtherAttributeIter { + if len(obj.obj.OtherAttributes) == 0 { + obj.obj.OtherAttributes = []*otg.BgpAttributesOtherAttribute{} + } + if obj.otherAttributesHolder == nil { + obj.otherAttributesHolder = newBgpAttributesBgpAttributesOtherAttributeIter(&obj.obj.OtherAttributes).setMsg(obj) + } + return obj.otherAttributesHolder +} + +type bgpAttributesBgpAttributesOtherAttributeIter struct { + obj *bgpAttributes + bgpAttributesOtherAttributeSlice []BgpAttributesOtherAttribute + fieldPtr *[]*otg.BgpAttributesOtherAttribute +} + +func newBgpAttributesBgpAttributesOtherAttributeIter(ptr *[]*otg.BgpAttributesOtherAttribute) BgpAttributesBgpAttributesOtherAttributeIter { + return &bgpAttributesBgpAttributesOtherAttributeIter{fieldPtr: ptr} +} + +type BgpAttributesBgpAttributesOtherAttributeIter interface { + setMsg(*bgpAttributes) BgpAttributesBgpAttributesOtherAttributeIter + Items() []BgpAttributesOtherAttribute + Add() BgpAttributesOtherAttribute + Append(items ...BgpAttributesOtherAttribute) BgpAttributesBgpAttributesOtherAttributeIter + Set(index int, newObj BgpAttributesOtherAttribute) BgpAttributesBgpAttributesOtherAttributeIter + Clear() BgpAttributesBgpAttributesOtherAttributeIter + clearHolderSlice() BgpAttributesBgpAttributesOtherAttributeIter + appendHolderSlice(item BgpAttributesOtherAttribute) BgpAttributesBgpAttributesOtherAttributeIter +} + +func (obj *bgpAttributesBgpAttributesOtherAttributeIter) setMsg(msg *bgpAttributes) BgpAttributesBgpAttributesOtherAttributeIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpAttributesOtherAttribute{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpAttributesBgpAttributesOtherAttributeIter) Items() []BgpAttributesOtherAttribute { + return obj.bgpAttributesOtherAttributeSlice +} + +func (obj *bgpAttributesBgpAttributesOtherAttributeIter) Add() BgpAttributesOtherAttribute { + newObj := &otg.BgpAttributesOtherAttribute{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpAttributesOtherAttribute{obj: newObj} + newLibObj.setDefault() + obj.bgpAttributesOtherAttributeSlice = append(obj.bgpAttributesOtherAttributeSlice, newLibObj) + return newLibObj +} + +func (obj *bgpAttributesBgpAttributesOtherAttributeIter) Append(items ...BgpAttributesOtherAttribute) BgpAttributesBgpAttributesOtherAttributeIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpAttributesOtherAttributeSlice = append(obj.bgpAttributesOtherAttributeSlice, item) + } + return obj +} + +func (obj *bgpAttributesBgpAttributesOtherAttributeIter) Set(index int, newObj BgpAttributesOtherAttribute) BgpAttributesBgpAttributesOtherAttributeIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpAttributesOtherAttributeSlice[index] = newObj + return obj +} +func (obj *bgpAttributesBgpAttributesOtherAttributeIter) Clear() BgpAttributesBgpAttributesOtherAttributeIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpAttributesOtherAttribute{} + obj.bgpAttributesOtherAttributeSlice = []BgpAttributesOtherAttribute{} + } + return obj +} +func (obj *bgpAttributesBgpAttributesOtherAttributeIter) clearHolderSlice() BgpAttributesBgpAttributesOtherAttributeIter { + if len(obj.bgpAttributesOtherAttributeSlice) > 0 { + obj.bgpAttributesOtherAttributeSlice = []BgpAttributesOtherAttribute{} + } + return obj +} +func (obj *bgpAttributesBgpAttributesOtherAttributeIter) appendHolderSlice(item BgpAttributesOtherAttribute) BgpAttributesBgpAttributesOtherAttributeIter { + obj.bgpAttributesOtherAttributeSlice = append(obj.bgpAttributesOtherAttributeSlice, item) + return obj +} + +type BgpAttributesOriginEnum string + +// Enum of Origin on BgpAttributes +var BgpAttributesOrigin = struct { + IGP BgpAttributesOriginEnum + EGP BgpAttributesOriginEnum + INCOMPLETE BgpAttributesOriginEnum +}{ + IGP: BgpAttributesOriginEnum("igp"), + EGP: BgpAttributesOriginEnum("egp"), + INCOMPLETE: BgpAttributesOriginEnum("incomplete"), +} + +func (obj *bgpAttributes) Origin() BgpAttributesOriginEnum { + return BgpAttributesOriginEnum(obj.obj.Origin.Enum().String()) +} + +// The ORIGIN attribute is a mandatory attribute which can take three values: +// the prefix originates from an interior routing protocol 'igp', it originates from 'egp' +// or the origin is 'incomplete',if the prefix is learned through other means. +// Origin returns a string +func (obj *bgpAttributes) HasOrigin() bool { + return obj.obj.Origin != nil +} + +func (obj *bgpAttributes) SetOrigin(value BgpAttributesOriginEnum) BgpAttributes { + intValue, ok := otg.BgpAttributes_Origin_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAttributesOriginEnum", string(value))) + return obj + } + enumValue := otg.BgpAttributes_Origin_Enum(intValue) + obj.obj.Origin = &enumValue + + return obj +} + +// AS_PATH attribute to be included in the Update. +// AsPath returns a BgpAttributesAsPath +func (obj *bgpAttributes) AsPath() BgpAttributesAsPath { + if obj.obj.AsPath == nil { + obj.obj.AsPath = NewBgpAttributesAsPath().msg() + } + if obj.asPathHolder == nil { + obj.asPathHolder = &bgpAttributesAsPath{obj: obj.obj.AsPath} + } + return obj.asPathHolder +} + +// AS_PATH attribute to be included in the Update. +// AsPath returns a BgpAttributesAsPath +func (obj *bgpAttributes) HasAsPath() bool { + return obj.obj.AsPath != nil +} + +// AS_PATH attribute to be included in the Update. +// SetAsPath sets the BgpAttributesAsPath value in the BgpAttributes object +func (obj *bgpAttributes) SetAsPath(value BgpAttributesAsPath) BgpAttributes { + + obj.asPathHolder = nil + obj.obj.AsPath = value.msg() + + return obj +} + +// AS4_PATH attribute to be included in the Update. +// As4Path returns a BgpAttributesAs4Path +func (obj *bgpAttributes) As4Path() BgpAttributesAs4Path { + if obj.obj.As4Path == nil { + obj.obj.As4Path = NewBgpAttributesAs4Path().msg() + } + if obj.as4PathHolder == nil { + obj.as4PathHolder = &bgpAttributesAs4Path{obj: obj.obj.As4Path} + } + return obj.as4PathHolder +} + +// AS4_PATH attribute to be included in the Update. +// As4Path returns a BgpAttributesAs4Path +func (obj *bgpAttributes) HasAs4Path() bool { + return obj.obj.As4Path != nil +} + +// AS4_PATH attribute to be included in the Update. +// SetAs4Path sets the BgpAttributesAs4Path value in the BgpAttributes object +func (obj *bgpAttributes) SetAs4Path(value BgpAttributesAs4Path) BgpAttributes { + + obj.as4PathHolder = nil + obj.obj.As4Path = value.msg() + + return obj +} + +// description is TBD +// NextHop returns a BgpAttributesNextHop +func (obj *bgpAttributes) NextHop() BgpAttributesNextHop { + if obj.obj.NextHop == nil { + obj.obj.NextHop = NewBgpAttributesNextHop().msg() + } + if obj.nextHopHolder == nil { + obj.nextHopHolder = &bgpAttributesNextHop{obj: obj.obj.NextHop} + } + return obj.nextHopHolder +} + +// description is TBD +// NextHop returns a BgpAttributesNextHop +func (obj *bgpAttributes) HasNextHop() bool { + return obj.obj.NextHop != nil +} + +// description is TBD +// SetNextHop sets the BgpAttributesNextHop value in the BgpAttributes object +func (obj *bgpAttributes) SetNextHop(value BgpAttributesNextHop) BgpAttributes { + + obj.nextHopHolder = nil + obj.obj.NextHop = value.msg() + + return obj +} + +// description is TBD +// MultiExitDiscriminator returns a BgpAttributesMultiExitDiscriminator +func (obj *bgpAttributes) MultiExitDiscriminator() BgpAttributesMultiExitDiscriminator { + if obj.obj.MultiExitDiscriminator == nil { + obj.obj.MultiExitDiscriminator = NewBgpAttributesMultiExitDiscriminator().msg() + } + if obj.multiExitDiscriminatorHolder == nil { + obj.multiExitDiscriminatorHolder = &bgpAttributesMultiExitDiscriminator{obj: obj.obj.MultiExitDiscriminator} + } + return obj.multiExitDiscriminatorHolder +} + +// description is TBD +// MultiExitDiscriminator returns a BgpAttributesMultiExitDiscriminator +func (obj *bgpAttributes) HasMultiExitDiscriminator() bool { + return obj.obj.MultiExitDiscriminator != nil +} + +// description is TBD +// SetMultiExitDiscriminator sets the BgpAttributesMultiExitDiscriminator value in the BgpAttributes object +func (obj *bgpAttributes) SetMultiExitDiscriminator(value BgpAttributesMultiExitDiscriminator) BgpAttributes { + + obj.multiExitDiscriminatorHolder = nil + obj.obj.MultiExitDiscriminator = value.msg() + + return obj +} + +// description is TBD +// LocalPreference returns a BgpAttributesLocalPreference +func (obj *bgpAttributes) LocalPreference() BgpAttributesLocalPreference { + if obj.obj.LocalPreference == nil { + obj.obj.LocalPreference = NewBgpAttributesLocalPreference().msg() + } + if obj.localPreferenceHolder == nil { + obj.localPreferenceHolder = &bgpAttributesLocalPreference{obj: obj.obj.LocalPreference} + } + return obj.localPreferenceHolder +} + +// description is TBD +// LocalPreference returns a BgpAttributesLocalPreference +func (obj *bgpAttributes) HasLocalPreference() bool { + return obj.obj.LocalPreference != nil +} + +// description is TBD +// SetLocalPreference sets the BgpAttributesLocalPreference value in the BgpAttributes object +func (obj *bgpAttributes) SetLocalPreference(value BgpAttributesLocalPreference) BgpAttributes { + + obj.localPreferenceHolder = nil + obj.obj.LocalPreference = value.msg() + + return obj +} + +// If enabled, it indicates that the ATOMIC_AGGREGATOR attribute should be included in the Update. +// Presence of this attribute Indicates that this route might not be getting sent on a fully optimized path +// since some intermediate BGP speaker has aggregated the route. +// IncludeAtomicAggregator returns a bool +func (obj *bgpAttributes) IncludeAtomicAggregator() bool { + + return *obj.obj.IncludeAtomicAggregator + +} + +// If enabled, it indicates that the ATOMIC_AGGREGATOR attribute should be included in the Update. +// Presence of this attribute Indicates that this route might not be getting sent on a fully optimized path +// since some intermediate BGP speaker has aggregated the route. +// IncludeAtomicAggregator returns a bool +func (obj *bgpAttributes) HasIncludeAtomicAggregator() bool { + return obj.obj.IncludeAtomicAggregator != nil +} + +// If enabled, it indicates that the ATOMIC_AGGREGATOR attribute should be included in the Update. +// Presence of this attribute Indicates that this route might not be getting sent on a fully optimized path +// since some intermediate BGP speaker has aggregated the route. +// SetIncludeAtomicAggregator sets the bool value in the BgpAttributes object +func (obj *bgpAttributes) SetIncludeAtomicAggregator(value bool) BgpAttributes { + + obj.obj.IncludeAtomicAggregator = &value + return obj +} + +// description is TBD +// Aggregator returns a BgpAttributesAggregator +func (obj *bgpAttributes) Aggregator() BgpAttributesAggregator { + if obj.obj.Aggregator == nil { + obj.obj.Aggregator = NewBgpAttributesAggregator().msg() + } + if obj.aggregatorHolder == nil { + obj.aggregatorHolder = &bgpAttributesAggregator{obj: obj.obj.Aggregator} + } + return obj.aggregatorHolder +} + +// description is TBD +// Aggregator returns a BgpAttributesAggregator +func (obj *bgpAttributes) HasAggregator() bool { + return obj.obj.Aggregator != nil +} + +// description is TBD +// SetAggregator sets the BgpAttributesAggregator value in the BgpAttributes object +func (obj *bgpAttributes) SetAggregator(value BgpAttributesAggregator) BgpAttributes { + + obj.aggregatorHolder = nil + obj.obj.Aggregator = value.msg() + + return obj +} + +// description is TBD +// As4Aggregator returns a BgpAttributesAs4Aggregator +func (obj *bgpAttributes) As4Aggregator() BgpAttributesAs4Aggregator { + if obj.obj.As4Aggregator == nil { + obj.obj.As4Aggregator = NewBgpAttributesAs4Aggregator().msg() + } + if obj.as4AggregatorHolder == nil { + obj.as4AggregatorHolder = &bgpAttributesAs4Aggregator{obj: obj.obj.As4Aggregator} + } + return obj.as4AggregatorHolder +} + +// description is TBD +// As4Aggregator returns a BgpAttributesAs4Aggregator +func (obj *bgpAttributes) HasAs4Aggregator() bool { + return obj.obj.As4Aggregator != nil +} + +// description is TBD +// SetAs4Aggregator sets the BgpAttributesAs4Aggregator value in the BgpAttributes object +func (obj *bgpAttributes) SetAs4Aggregator(value BgpAttributesAs4Aggregator) BgpAttributes { + + obj.as4AggregatorHolder = nil + obj.obj.As4Aggregator = value.msg() + + return obj +} + +// description is TBD +// Community returns a []BgpAttributesCommunity +func (obj *bgpAttributes) Community() BgpAttributesBgpAttributesCommunityIter { + if len(obj.obj.Community) == 0 { + obj.obj.Community = []*otg.BgpAttributesCommunity{} + } + if obj.communityHolder == nil { + obj.communityHolder = newBgpAttributesBgpAttributesCommunityIter(&obj.obj.Community).setMsg(obj) + } + return obj.communityHolder +} + +type bgpAttributesBgpAttributesCommunityIter struct { + obj *bgpAttributes + bgpAttributesCommunitySlice []BgpAttributesCommunity + fieldPtr *[]*otg.BgpAttributesCommunity +} + +func newBgpAttributesBgpAttributesCommunityIter(ptr *[]*otg.BgpAttributesCommunity) BgpAttributesBgpAttributesCommunityIter { + return &bgpAttributesBgpAttributesCommunityIter{fieldPtr: ptr} +} + +type BgpAttributesBgpAttributesCommunityIter interface { + setMsg(*bgpAttributes) BgpAttributesBgpAttributesCommunityIter + Items() []BgpAttributesCommunity + Add() BgpAttributesCommunity + Append(items ...BgpAttributesCommunity) BgpAttributesBgpAttributesCommunityIter + Set(index int, newObj BgpAttributesCommunity) BgpAttributesBgpAttributesCommunityIter + Clear() BgpAttributesBgpAttributesCommunityIter + clearHolderSlice() BgpAttributesBgpAttributesCommunityIter + appendHolderSlice(item BgpAttributesCommunity) BgpAttributesBgpAttributesCommunityIter +} + +func (obj *bgpAttributesBgpAttributesCommunityIter) setMsg(msg *bgpAttributes) BgpAttributesBgpAttributesCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpAttributesCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpAttributesBgpAttributesCommunityIter) Items() []BgpAttributesCommunity { + return obj.bgpAttributesCommunitySlice +} + +func (obj *bgpAttributesBgpAttributesCommunityIter) Add() BgpAttributesCommunity { + newObj := &otg.BgpAttributesCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpAttributesCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpAttributesCommunitySlice = append(obj.bgpAttributesCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpAttributesBgpAttributesCommunityIter) Append(items ...BgpAttributesCommunity) BgpAttributesBgpAttributesCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpAttributesCommunitySlice = append(obj.bgpAttributesCommunitySlice, item) + } + return obj +} + +func (obj *bgpAttributesBgpAttributesCommunityIter) Set(index int, newObj BgpAttributesCommunity) BgpAttributesBgpAttributesCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpAttributesCommunitySlice[index] = newObj + return obj +} +func (obj *bgpAttributesBgpAttributesCommunityIter) Clear() BgpAttributesBgpAttributesCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpAttributesCommunity{} + obj.bgpAttributesCommunitySlice = []BgpAttributesCommunity{} + } + return obj +} +func (obj *bgpAttributesBgpAttributesCommunityIter) clearHolderSlice() BgpAttributesBgpAttributesCommunityIter { + if len(obj.bgpAttributesCommunitySlice) > 0 { + obj.bgpAttributesCommunitySlice = []BgpAttributesCommunity{} + } + return obj +} +func (obj *bgpAttributesBgpAttributesCommunityIter) appendHolderSlice(item BgpAttributesCommunity) BgpAttributesBgpAttributesCommunityIter { + obj.bgpAttributesCommunitySlice = append(obj.bgpAttributesCommunitySlice, item) + return obj +} + +// description is TBD +// OriginatorId returns a BgpAttributesOriginatorId +func (obj *bgpAttributes) OriginatorId() BgpAttributesOriginatorId { + if obj.obj.OriginatorId == nil { + obj.obj.OriginatorId = NewBgpAttributesOriginatorId().msg() + } + if obj.originatorIdHolder == nil { + obj.originatorIdHolder = &bgpAttributesOriginatorId{obj: obj.obj.OriginatorId} + } + return obj.originatorIdHolder +} + +// description is TBD +// OriginatorId returns a BgpAttributesOriginatorId +func (obj *bgpAttributes) HasOriginatorId() bool { + return obj.obj.OriginatorId != nil +} + +// description is TBD +// SetOriginatorId sets the BgpAttributesOriginatorId value in the BgpAttributes object +func (obj *bgpAttributes) SetOriginatorId(value BgpAttributesOriginatorId) BgpAttributes { + + obj.originatorIdHolder = nil + obj.obj.OriginatorId = value.msg() + + return obj +} + +// When a Route Reflector reflects a route, it prepends the local CLUSTER_ID to the CLUSTER_LIST as defined in RFC4456. +// ClusterIds returns a []string +func (obj *bgpAttributes) ClusterIds() []string { + if obj.obj.ClusterIds == nil { + obj.obj.ClusterIds = make([]string, 0) + } + return obj.obj.ClusterIds +} + +// When a Route Reflector reflects a route, it prepends the local CLUSTER_ID to the CLUSTER_LIST as defined in RFC4456. +// SetClusterIds sets the []string value in the BgpAttributes object +func (obj *bgpAttributes) SetClusterIds(value []string) BgpAttributes { + + if obj.obj.ClusterIds == nil { + obj.obj.ClusterIds = make([]string, 0) + } + obj.obj.ClusterIds = value + + return obj +} + +// Optional EXTENDED_COMMUNITY attribute settings. +// The EXTENDED_COMMUNITY Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes +// are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an eight byte value. +// It is divided into two main parts. The first two bytes of the community encode a type and sub-type fields and the last six bytes carry a unique set +// of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. +// ExtendedCommunities returns a []BgpExtendedCommunity +func (obj *bgpAttributes) ExtendedCommunities() BgpAttributesBgpExtendedCommunityIter { + if len(obj.obj.ExtendedCommunities) == 0 { + obj.obj.ExtendedCommunities = []*otg.BgpExtendedCommunity{} + } + if obj.extendedCommunitiesHolder == nil { + obj.extendedCommunitiesHolder = newBgpAttributesBgpExtendedCommunityIter(&obj.obj.ExtendedCommunities).setMsg(obj) + } + return obj.extendedCommunitiesHolder +} + +type bgpAttributesBgpExtendedCommunityIter struct { + obj *bgpAttributes + bgpExtendedCommunitySlice []BgpExtendedCommunity + fieldPtr *[]*otg.BgpExtendedCommunity +} + +func newBgpAttributesBgpExtendedCommunityIter(ptr *[]*otg.BgpExtendedCommunity) BgpAttributesBgpExtendedCommunityIter { + return &bgpAttributesBgpExtendedCommunityIter{fieldPtr: ptr} +} + +type BgpAttributesBgpExtendedCommunityIter interface { + setMsg(*bgpAttributes) BgpAttributesBgpExtendedCommunityIter + Items() []BgpExtendedCommunity + Add() BgpExtendedCommunity + Append(items ...BgpExtendedCommunity) BgpAttributesBgpExtendedCommunityIter + Set(index int, newObj BgpExtendedCommunity) BgpAttributesBgpExtendedCommunityIter + Clear() BgpAttributesBgpExtendedCommunityIter + clearHolderSlice() BgpAttributesBgpExtendedCommunityIter + appendHolderSlice(item BgpExtendedCommunity) BgpAttributesBgpExtendedCommunityIter +} + +func (obj *bgpAttributesBgpExtendedCommunityIter) setMsg(msg *bgpAttributes) BgpAttributesBgpExtendedCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpExtendedCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpAttributesBgpExtendedCommunityIter) Items() []BgpExtendedCommunity { + return obj.bgpExtendedCommunitySlice +} + +func (obj *bgpAttributesBgpExtendedCommunityIter) Add() BgpExtendedCommunity { + newObj := &otg.BgpExtendedCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpExtendedCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpAttributesBgpExtendedCommunityIter) Append(items ...BgpExtendedCommunity) BgpAttributesBgpExtendedCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, item) + } + return obj +} + +func (obj *bgpAttributesBgpExtendedCommunityIter) Set(index int, newObj BgpExtendedCommunity) BgpAttributesBgpExtendedCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpExtendedCommunitySlice[index] = newObj + return obj +} +func (obj *bgpAttributesBgpExtendedCommunityIter) Clear() BgpAttributesBgpExtendedCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpExtendedCommunity{} + obj.bgpExtendedCommunitySlice = []BgpExtendedCommunity{} + } + return obj +} +func (obj *bgpAttributesBgpExtendedCommunityIter) clearHolderSlice() BgpAttributesBgpExtendedCommunityIter { + if len(obj.bgpExtendedCommunitySlice) > 0 { + obj.bgpExtendedCommunitySlice = []BgpExtendedCommunity{} + } + return obj +} +func (obj *bgpAttributesBgpExtendedCommunityIter) appendHolderSlice(item BgpExtendedCommunity) BgpAttributesBgpExtendedCommunityIter { + obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, item) + return obj +} + +// description is TBD +// TunnelEncapsulation returns a BgpAttributesTunnelEncapsulation +func (obj *bgpAttributes) TunnelEncapsulation() BgpAttributesTunnelEncapsulation { + if obj.obj.TunnelEncapsulation == nil { + obj.obj.TunnelEncapsulation = NewBgpAttributesTunnelEncapsulation().msg() + } + if obj.tunnelEncapsulationHolder == nil { + obj.tunnelEncapsulationHolder = &bgpAttributesTunnelEncapsulation{obj: obj.obj.TunnelEncapsulation} + } + return obj.tunnelEncapsulationHolder +} + +// description is TBD +// TunnelEncapsulation returns a BgpAttributesTunnelEncapsulation +func (obj *bgpAttributes) HasTunnelEncapsulation() bool { + return obj.obj.TunnelEncapsulation != nil +} + +// description is TBD +// SetTunnelEncapsulation sets the BgpAttributesTunnelEncapsulation value in the BgpAttributes object +func (obj *bgpAttributes) SetTunnelEncapsulation(value BgpAttributesTunnelEncapsulation) BgpAttributes { + + obj.tunnelEncapsulationHolder = nil + obj.obj.TunnelEncapsulation = value.msg() + + return obj +} + +// description is TBD +// MpReach returns a BgpAttributesMpReachNlri +func (obj *bgpAttributes) MpReach() BgpAttributesMpReachNlri { + if obj.obj.MpReach == nil { + obj.obj.MpReach = NewBgpAttributesMpReachNlri().msg() + } + if obj.mpReachHolder == nil { + obj.mpReachHolder = &bgpAttributesMpReachNlri{obj: obj.obj.MpReach} + } + return obj.mpReachHolder +} + +// description is TBD +// MpReach returns a BgpAttributesMpReachNlri +func (obj *bgpAttributes) HasMpReach() bool { + return obj.obj.MpReach != nil +} + +// description is TBD +// SetMpReach sets the BgpAttributesMpReachNlri value in the BgpAttributes object +func (obj *bgpAttributes) SetMpReach(value BgpAttributesMpReachNlri) BgpAttributes { + + obj.mpReachHolder = nil + obj.obj.MpReach = value.msg() + + return obj +} + +// description is TBD +// MpUnreach returns a BgpAttributesMpUnreachNlri +func (obj *bgpAttributes) MpUnreach() BgpAttributesMpUnreachNlri { + if obj.obj.MpUnreach == nil { + obj.obj.MpUnreach = NewBgpAttributesMpUnreachNlri().msg() + } + if obj.mpUnreachHolder == nil { + obj.mpUnreachHolder = &bgpAttributesMpUnreachNlri{obj: obj.obj.MpUnreach} + } + return obj.mpUnreachHolder +} + +// description is TBD +// MpUnreach returns a BgpAttributesMpUnreachNlri +func (obj *bgpAttributes) HasMpUnreach() bool { + return obj.obj.MpUnreach != nil +} + +// description is TBD +// SetMpUnreach sets the BgpAttributesMpUnreachNlri value in the BgpAttributes object +func (obj *bgpAttributes) SetMpUnreach(value BgpAttributesMpUnreachNlri) BgpAttributes { + + obj.mpUnreachHolder = nil + obj.obj.MpUnreach = value.msg() + + return obj +} + +func (obj *bgpAttributes) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.OtherAttributes) != 0 { + + if set_default { + obj.OtherAttributes().clearHolderSlice() + for _, item := range obj.obj.OtherAttributes { + obj.OtherAttributes().appendHolderSlice(&bgpAttributesOtherAttribute{obj: item}) + } + } + for _, item := range obj.OtherAttributes().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.AsPath != nil { + + obj.AsPath().validateObj(vObj, set_default) + } + + if obj.obj.As4Path != nil { + + obj.As4Path().validateObj(vObj, set_default) + } + + if obj.obj.NextHop != nil { + + obj.NextHop().validateObj(vObj, set_default) + } + + if obj.obj.MultiExitDiscriminator != nil { + + obj.MultiExitDiscriminator().validateObj(vObj, set_default) + } + + if obj.obj.LocalPreference != nil { + + obj.LocalPreference().validateObj(vObj, set_default) + } + + if obj.obj.Aggregator != nil { + + obj.Aggregator().validateObj(vObj, set_default) + } + + if obj.obj.As4Aggregator != nil { + + obj.As4Aggregator().validateObj(vObj, set_default) + } + + if len(obj.obj.Community) != 0 { + + if set_default { + obj.Community().clearHolderSlice() + for _, item := range obj.obj.Community { + obj.Community().appendHolderSlice(&bgpAttributesCommunity{obj: item}) + } + } + for _, item := range obj.Community().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.OriginatorId != nil { + + obj.OriginatorId().validateObj(vObj, set_default) + } + + if obj.obj.ClusterIds != nil { + + err := obj.validateIpv4Slice(obj.ClusterIds()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributes.ClusterIds")) + } + + } + + if len(obj.obj.ExtendedCommunities) != 0 { + + if set_default { + obj.ExtendedCommunities().clearHolderSlice() + for _, item := range obj.obj.ExtendedCommunities { + obj.ExtendedCommunities().appendHolderSlice(&bgpExtendedCommunity{obj: item}) + } + } + for _, item := range obj.ExtendedCommunities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.TunnelEncapsulation != nil { + + obj.TunnelEncapsulation().validateObj(vObj, set_default) + } + + if obj.obj.MpReach != nil { + + obj.MpReach().validateObj(vObj, set_default) + } + + if obj.obj.MpUnreach != nil { + + obj.MpUnreach().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributes) setDefault() { + if obj.obj.Origin == nil { + obj.SetOrigin(BgpAttributesOrigin.INCOMPLETE) + + } + if obj.obj.IncludeAtomicAggregator == nil { + obj.SetIncludeAtomicAggregator(false) + } + +} diff --git a/gosnappi/bgp_attributes_aggregator.go b/gosnappi/bgp_attributes_aggregator.go new file mode 100644 index 00000000..a1add1f7 --- /dev/null +++ b/gosnappi/bgp_attributes_aggregator.go @@ -0,0 +1,478 @@ +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" +) + +// ***** BgpAttributesAggregator ***** +type bgpAttributesAggregator struct { + validation + obj *otg.BgpAttributesAggregator + marshaller marshalBgpAttributesAggregator + unMarshaller unMarshalBgpAttributesAggregator +} + +func NewBgpAttributesAggregator() BgpAttributesAggregator { + obj := bgpAttributesAggregator{obj: &otg.BgpAttributesAggregator{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesAggregator) msg() *otg.BgpAttributesAggregator { + return obj.obj +} + +func (obj *bgpAttributesAggregator) setMsg(msg *otg.BgpAttributesAggregator) BgpAttributesAggregator { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesAggregator struct { + obj *bgpAttributesAggregator +} + +type marshalBgpAttributesAggregator interface { + // ToProto marshals BgpAttributesAggregator to protobuf object *otg.BgpAttributesAggregator + ToProto() (*otg.BgpAttributesAggregator, error) + // ToPbText marshals BgpAttributesAggregator to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesAggregator to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesAggregator to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesAggregator struct { + obj *bgpAttributesAggregator +} + +type unMarshalBgpAttributesAggregator interface { + // FromProto unmarshals BgpAttributesAggregator from protobuf object *otg.BgpAttributesAggregator + FromProto(msg *otg.BgpAttributesAggregator) (BgpAttributesAggregator, error) + // FromPbText unmarshals BgpAttributesAggregator from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesAggregator from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesAggregator from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesAggregator) Marshal() marshalBgpAttributesAggregator { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesAggregator{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesAggregator) Unmarshal() unMarshalBgpAttributesAggregator { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesAggregator{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesAggregator) ToProto() (*otg.BgpAttributesAggregator, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesAggregator) FromProto(msg *otg.BgpAttributesAggregator) (BgpAttributesAggregator, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesAggregator) 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 *unMarshalbgpAttributesAggregator) 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 *marshalbgpAttributesAggregator) 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 *unMarshalbgpAttributesAggregator) 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 *marshalbgpAttributesAggregator) 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 *unMarshalbgpAttributesAggregator) 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 *bgpAttributesAggregator) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesAggregator) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesAggregator) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesAggregator) Clone() (BgpAttributesAggregator, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesAggregator() + 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 +} + +// BgpAttributesAggregator is optional AGGREGATOR attribute which maybe be added by a BGP speaker which performs route aggregation. +// When AGGREGATOR attribute is being sent to a new BGP speaker , the AS number is encoded as a 4 byte value. +// When AGGREGATOR attribute is being exchanged between a new and an old BGP speaker or between two old BGP speakers, +// the AS number is encoded as a 2 byte value. +// It contain the AS number and IP address of the speaker performing the aggregation. +type BgpAttributesAggregator interface { + Validation + // msg marshals BgpAttributesAggregator to protobuf object *otg.BgpAttributesAggregator + // and doesn't set defaults + msg() *otg.BgpAttributesAggregator + // setMsg unmarshals BgpAttributesAggregator from protobuf object *otg.BgpAttributesAggregator + // and doesn't set defaults + setMsg(*otg.BgpAttributesAggregator) BgpAttributesAggregator + // provides marshal interface + Marshal() marshalBgpAttributesAggregator + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesAggregator + // validate validates BgpAttributesAggregator + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesAggregator, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpAttributesAggregatorChoiceEnum, set in BgpAttributesAggregator + Choice() BgpAttributesAggregatorChoiceEnum + // setChoice assigns BgpAttributesAggregatorChoiceEnum provided by user to BgpAttributesAggregator + setChoice(value BgpAttributesAggregatorChoiceEnum) BgpAttributesAggregator + // HasChoice checks if Choice has been set in BgpAttributesAggregator + HasChoice() bool + // FourByteAs returns uint32, set in BgpAttributesAggregator. + FourByteAs() uint32 + // SetFourByteAs assigns uint32 provided by user to BgpAttributesAggregator + SetFourByteAs(value uint32) BgpAttributesAggregator + // HasFourByteAs checks if FourByteAs has been set in BgpAttributesAggregator + HasFourByteAs() bool + // TwoByteAs returns uint32, set in BgpAttributesAggregator. + TwoByteAs() uint32 + // SetTwoByteAs assigns uint32 provided by user to BgpAttributesAggregator + SetTwoByteAs(value uint32) BgpAttributesAggregator + // HasTwoByteAs checks if TwoByteAs has been set in BgpAttributesAggregator + HasTwoByteAs() bool + // Ipv4Address returns string, set in BgpAttributesAggregator. + Ipv4Address() string + // SetIpv4Address assigns string provided by user to BgpAttributesAggregator + SetIpv4Address(value string) BgpAttributesAggregator + // HasIpv4Address checks if Ipv4Address has been set in BgpAttributesAggregator + HasIpv4Address() bool +} + +type BgpAttributesAggregatorChoiceEnum string + +// Enum of Choice on BgpAttributesAggregator +var BgpAttributesAggregatorChoice = struct { + FOUR_BYTE_AS BgpAttributesAggregatorChoiceEnum + TWO_BYTE_AS BgpAttributesAggregatorChoiceEnum +}{ + FOUR_BYTE_AS: BgpAttributesAggregatorChoiceEnum("four_byte_as"), + TWO_BYTE_AS: BgpAttributesAggregatorChoiceEnum("two_byte_as"), +} + +func (obj *bgpAttributesAggregator) Choice() BgpAttributesAggregatorChoiceEnum { + return BgpAttributesAggregatorChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *bgpAttributesAggregator) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpAttributesAggregator) setChoice(value BgpAttributesAggregatorChoiceEnum) BgpAttributesAggregator { + intValue, ok := otg.BgpAttributesAggregator_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAttributesAggregatorChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpAttributesAggregator_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.TwoByteAs = nil + obj.obj.FourByteAs = nil + + if value == BgpAttributesAggregatorChoice.FOUR_BYTE_AS { + defaultValue := uint32(65536) + obj.obj.FourByteAs = &defaultValue + } + + if value == BgpAttributesAggregatorChoice.TWO_BYTE_AS { + defaultValue := uint32(1) + obj.obj.TwoByteAs = &defaultValue + } + + return obj +} + +// The value of the 4 byte AS number of the BGP speaker which aggregated the route. If the value of the AS number is less than 2 octets ( 65535 or less), the AS4_AGGREGATOR object should not be sent. +// FourByteAs returns a uint32 +func (obj *bgpAttributesAggregator) FourByteAs() uint32 { + + if obj.obj.FourByteAs == nil { + obj.setChoice(BgpAttributesAggregatorChoice.FOUR_BYTE_AS) + } + + return *obj.obj.FourByteAs + +} + +// The value of the 4 byte AS number of the BGP speaker which aggregated the route. If the value of the AS number is less than 2 octets ( 65535 or less), the AS4_AGGREGATOR object should not be sent. +// FourByteAs returns a uint32 +func (obj *bgpAttributesAggregator) HasFourByteAs() bool { + return obj.obj.FourByteAs != nil +} + +// The value of the 4 byte AS number of the BGP speaker which aggregated the route. If the value of the AS number is less than 2 octets ( 65535 or less), the AS4_AGGREGATOR object should not be sent. +// SetFourByteAs sets the uint32 value in the BgpAttributesAggregator object +func (obj *bgpAttributesAggregator) SetFourByteAs(value uint32) BgpAttributesAggregator { + obj.setChoice(BgpAttributesAggregatorChoice.FOUR_BYTE_AS) + obj.obj.FourByteAs = &value + return obj +} + +// The value of the 2 byte AS number of the BGP speaker which aggregated the route. +// TwoByteAs returns a uint32 +func (obj *bgpAttributesAggregator) TwoByteAs() uint32 { + + if obj.obj.TwoByteAs == nil { + obj.setChoice(BgpAttributesAggregatorChoice.TWO_BYTE_AS) + } + + return *obj.obj.TwoByteAs + +} + +// The value of the 2 byte AS number of the BGP speaker which aggregated the route. +// TwoByteAs returns a uint32 +func (obj *bgpAttributesAggregator) HasTwoByteAs() bool { + return obj.obj.TwoByteAs != nil +} + +// The value of the 2 byte AS number of the BGP speaker which aggregated the route. +// SetTwoByteAs sets the uint32 value in the BgpAttributesAggregator object +func (obj *bgpAttributesAggregator) SetTwoByteAs(value uint32) BgpAttributesAggregator { + obj.setChoice(BgpAttributesAggregatorChoice.TWO_BYTE_AS) + obj.obj.TwoByteAs = &value + return obj +} + +// The IPv4 address of the BGP speaker which aggregated the route. +// Ipv4Address returns a string +func (obj *bgpAttributesAggregator) Ipv4Address() string { + + return *obj.obj.Ipv4Address + +} + +// The IPv4 address of the BGP speaker which aggregated the route. +// Ipv4Address returns a string +func (obj *bgpAttributesAggregator) HasIpv4Address() bool { + return obj.obj.Ipv4Address != nil +} + +// The IPv4 address of the BGP speaker which aggregated the route. +// SetIpv4Address sets the string value in the BgpAttributesAggregator object +func (obj *bgpAttributesAggregator) SetIpv4Address(value string) BgpAttributesAggregator { + + obj.obj.Ipv4Address = &value + return obj +} + +func (obj *bgpAttributesAggregator) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.TwoByteAs != nil { + + if *obj.obj.TwoByteAs > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesAggregator.TwoByteAs <= 65535 but Got %d", *obj.obj.TwoByteAs)) + } + + } + + if obj.obj.Ipv4Address != nil { + + err := obj.validateIpv4(obj.Ipv4Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesAggregator.Ipv4Address")) + } + + } + +} + +func (obj *bgpAttributesAggregator) setDefault() { + var choices_set int = 0 + var choice BgpAttributesAggregatorChoiceEnum + + if obj.obj.FourByteAs != nil { + choices_set += 1 + choice = BgpAttributesAggregatorChoice.FOUR_BYTE_AS + } + + if obj.obj.TwoByteAs != nil { + choices_set += 1 + choice = BgpAttributesAggregatorChoice.TWO_BYTE_AS + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(BgpAttributesAggregatorChoice.FOUR_BYTE_AS) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesAggregator") + } + } else { + intVal := otg.BgpAttributesAggregator_Choice_Enum_value[string(choice)] + enumValue := otg.BgpAttributesAggregator_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + + if obj.obj.Ipv4Address == nil { + obj.SetIpv4Address("0.0.0.0") + } + +} diff --git a/gosnappi/bgp_attributes_as4_aggregator.go b/gosnappi/bgp_attributes_as4_aggregator.go new file mode 100644 index 00000000..a9683c20 --- /dev/null +++ b/gosnappi/bgp_attributes_as4_aggregator.go @@ -0,0 +1,349 @@ +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" +) + +// ***** BgpAttributesAs4Aggregator ***** +type bgpAttributesAs4Aggregator struct { + validation + obj *otg.BgpAttributesAs4Aggregator + marshaller marshalBgpAttributesAs4Aggregator + unMarshaller unMarshalBgpAttributesAs4Aggregator +} + +func NewBgpAttributesAs4Aggregator() BgpAttributesAs4Aggregator { + obj := bgpAttributesAs4Aggregator{obj: &otg.BgpAttributesAs4Aggregator{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesAs4Aggregator) msg() *otg.BgpAttributesAs4Aggregator { + return obj.obj +} + +func (obj *bgpAttributesAs4Aggregator) setMsg(msg *otg.BgpAttributesAs4Aggregator) BgpAttributesAs4Aggregator { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesAs4Aggregator struct { + obj *bgpAttributesAs4Aggregator +} + +type marshalBgpAttributesAs4Aggregator interface { + // ToProto marshals BgpAttributesAs4Aggregator to protobuf object *otg.BgpAttributesAs4Aggregator + ToProto() (*otg.BgpAttributesAs4Aggregator, error) + // ToPbText marshals BgpAttributesAs4Aggregator to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesAs4Aggregator to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesAs4Aggregator to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesAs4Aggregator struct { + obj *bgpAttributesAs4Aggregator +} + +type unMarshalBgpAttributesAs4Aggregator interface { + // FromProto unmarshals BgpAttributesAs4Aggregator from protobuf object *otg.BgpAttributesAs4Aggregator + FromProto(msg *otg.BgpAttributesAs4Aggregator) (BgpAttributesAs4Aggregator, error) + // FromPbText unmarshals BgpAttributesAs4Aggregator from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesAs4Aggregator from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesAs4Aggregator from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesAs4Aggregator) Marshal() marshalBgpAttributesAs4Aggregator { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesAs4Aggregator{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesAs4Aggregator) Unmarshal() unMarshalBgpAttributesAs4Aggregator { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesAs4Aggregator{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesAs4Aggregator) ToProto() (*otg.BgpAttributesAs4Aggregator, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesAs4Aggregator) FromProto(msg *otg.BgpAttributesAs4Aggregator) (BgpAttributesAs4Aggregator, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesAs4Aggregator) 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 *unMarshalbgpAttributesAs4Aggregator) 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 *marshalbgpAttributesAs4Aggregator) 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 *unMarshalbgpAttributesAs4Aggregator) 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 *marshalbgpAttributesAs4Aggregator) 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 *unMarshalbgpAttributesAs4Aggregator) 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 *bgpAttributesAs4Aggregator) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesAs4Aggregator) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesAs4Aggregator) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesAs4Aggregator) Clone() (BgpAttributesAs4Aggregator, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesAs4Aggregator() + 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 +} + +// BgpAttributesAs4Aggregator is optional AS4_AGGREGATOR attribute which maybe be added by a BGP speaker in one of two cases: +// - If it is a new BGP speaker speaking to an old BGP speaker and needs to send a 4 byte value for the AS number of the BGP route aggregator. +// - If it is a old BGP speaker speaking to a new BGP speaker and has to transparently forward a received AS4_AGGREGATOR from some other peer. +// Its usage is described in RFC4893. +type BgpAttributesAs4Aggregator interface { + Validation + // msg marshals BgpAttributesAs4Aggregator to protobuf object *otg.BgpAttributesAs4Aggregator + // and doesn't set defaults + msg() *otg.BgpAttributesAs4Aggregator + // setMsg unmarshals BgpAttributesAs4Aggregator from protobuf object *otg.BgpAttributesAs4Aggregator + // and doesn't set defaults + setMsg(*otg.BgpAttributesAs4Aggregator) BgpAttributesAs4Aggregator + // provides marshal interface + Marshal() marshalBgpAttributesAs4Aggregator + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesAs4Aggregator + // validate validates BgpAttributesAs4Aggregator + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesAs4Aggregator, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // AsNum returns uint32, set in BgpAttributesAs4Aggregator. + AsNum() uint32 + // SetAsNum assigns uint32 provided by user to BgpAttributesAs4Aggregator + SetAsNum(value uint32) BgpAttributesAs4Aggregator + // HasAsNum checks if AsNum has been set in BgpAttributesAs4Aggregator + HasAsNum() bool + // Ipv4Address returns string, set in BgpAttributesAs4Aggregator. + Ipv4Address() string + // SetIpv4Address assigns string provided by user to BgpAttributesAs4Aggregator + SetIpv4Address(value string) BgpAttributesAs4Aggregator + // HasIpv4Address checks if Ipv4Address has been set in BgpAttributesAs4Aggregator + HasIpv4Address() bool +} + +// The value of the 4 byte AS number of the BGP speaker which aggregated the route. +// AsNum returns a uint32 +func (obj *bgpAttributesAs4Aggregator) AsNum() uint32 { + + return *obj.obj.AsNum + +} + +// The value of the 4 byte AS number of the BGP speaker which aggregated the route. +// AsNum returns a uint32 +func (obj *bgpAttributesAs4Aggregator) HasAsNum() bool { + return obj.obj.AsNum != nil +} + +// The value of the 4 byte AS number of the BGP speaker which aggregated the route. +// SetAsNum sets the uint32 value in the BgpAttributesAs4Aggregator object +func (obj *bgpAttributesAs4Aggregator) SetAsNum(value uint32) BgpAttributesAs4Aggregator { + + obj.obj.AsNum = &value + return obj +} + +// The IPv4 address of the BGP speaker which aggregated the route. +// Ipv4Address returns a string +func (obj *bgpAttributesAs4Aggregator) Ipv4Address() string { + + return *obj.obj.Ipv4Address + +} + +// The IPv4 address of the BGP speaker which aggregated the route. +// Ipv4Address returns a string +func (obj *bgpAttributesAs4Aggregator) HasIpv4Address() bool { + return obj.obj.Ipv4Address != nil +} + +// The IPv4 address of the BGP speaker which aggregated the route. +// SetIpv4Address sets the string value in the BgpAttributesAs4Aggregator object +func (obj *bgpAttributesAs4Aggregator) SetIpv4Address(value string) BgpAttributesAs4Aggregator { + + obj.obj.Ipv4Address = &value + return obj +} + +func (obj *bgpAttributesAs4Aggregator) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv4Address != nil { + + err := obj.validateIpv4(obj.Ipv4Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesAs4Aggregator.Ipv4Address")) + } + + } + +} + +func (obj *bgpAttributesAs4Aggregator) setDefault() { + if obj.obj.Ipv4Address == nil { + obj.SetIpv4Address("0.0.0.0") + } + +} diff --git a/gosnappi/bgp_attributes_as4_path.go b/gosnappi/bgp_attributes_as4_path.go new file mode 100644 index 00000000..637b2471 --- /dev/null +++ b/gosnappi/bgp_attributes_as4_path.go @@ -0,0 +1,400 @@ +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" +) + +// ***** BgpAttributesAs4Path ***** +type bgpAttributesAs4Path struct { + validation + obj *otg.BgpAttributesAs4Path + marshaller marshalBgpAttributesAs4Path + unMarshaller unMarshalBgpAttributesAs4Path + segmentsHolder BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter +} + +func NewBgpAttributesAs4Path() BgpAttributesAs4Path { + obj := bgpAttributesAs4Path{obj: &otg.BgpAttributesAs4Path{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesAs4Path) msg() *otg.BgpAttributesAs4Path { + return obj.obj +} + +func (obj *bgpAttributesAs4Path) setMsg(msg *otg.BgpAttributesAs4Path) BgpAttributesAs4Path { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesAs4Path struct { + obj *bgpAttributesAs4Path +} + +type marshalBgpAttributesAs4Path interface { + // ToProto marshals BgpAttributesAs4Path to protobuf object *otg.BgpAttributesAs4Path + ToProto() (*otg.BgpAttributesAs4Path, error) + // ToPbText marshals BgpAttributesAs4Path to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesAs4Path to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesAs4Path to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesAs4Path struct { + obj *bgpAttributesAs4Path +} + +type unMarshalBgpAttributesAs4Path interface { + // FromProto unmarshals BgpAttributesAs4Path from protobuf object *otg.BgpAttributesAs4Path + FromProto(msg *otg.BgpAttributesAs4Path) (BgpAttributesAs4Path, error) + // FromPbText unmarshals BgpAttributesAs4Path from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesAs4Path from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesAs4Path from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesAs4Path) Marshal() marshalBgpAttributesAs4Path { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesAs4Path{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesAs4Path) Unmarshal() unMarshalBgpAttributesAs4Path { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesAs4Path{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesAs4Path) ToProto() (*otg.BgpAttributesAs4Path, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesAs4Path) FromProto(msg *otg.BgpAttributesAs4Path) (BgpAttributesAs4Path, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesAs4Path) 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 *unMarshalbgpAttributesAs4Path) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesAs4Path) 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 *unMarshalbgpAttributesAs4Path) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesAs4Path) 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 *unMarshalbgpAttributesAs4Path) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesAs4Path) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesAs4Path) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesAs4Path) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesAs4Path) Clone() (BgpAttributesAs4Path, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesAs4Path() + 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 +} + +func (obj *bgpAttributesAs4Path) setNil() { + obj.segmentsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesAs4Path is the AS4_PATH attribute identifies the autonomous systems through which routing information +// carried in this UPDATE message has passed. +// This contains the configuration of how to include the Local AS in the AS path +// attribute of the MP REACH NLRI. It also contains optional configuration of +// additional AS Path Segments that can be included in the AS Path attribute. +// The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that +// a routing information passes through to reach the destination. +// AS4_PATH is only exchanged in two scenarios: +// - When an old BGP speaker has to forward a received AS4_PATH containing 4 byte AS numbers to new BGP speaker. +// - When a new BGP speaker is connected to an old BGP speaker and has to propagate 4 byte AS numbers via the old BGP speaker. +// Its usage is described in RFC4893. +type BgpAttributesAs4Path interface { + Validation + // msg marshals BgpAttributesAs4Path to protobuf object *otg.BgpAttributesAs4Path + // and doesn't set defaults + msg() *otg.BgpAttributesAs4Path + // setMsg unmarshals BgpAttributesAs4Path from protobuf object *otg.BgpAttributesAs4Path + // and doesn't set defaults + setMsg(*otg.BgpAttributesAs4Path) BgpAttributesAs4Path + // provides marshal interface + Marshal() marshalBgpAttributesAs4Path + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesAs4Path + // validate validates BgpAttributesAs4Path + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesAs4Path, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Segments returns BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIterIter, set in BgpAttributesAs4Path + Segments() BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter + setNil() +} + +// The AS path segments containing 4 byte AS numbers to be added in the AS4_PATH attribute. +// Segments returns a []BgpAttributesFourByteAsPathSegment +func (obj *bgpAttributesAs4Path) Segments() BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { + if len(obj.obj.Segments) == 0 { + obj.obj.Segments = []*otg.BgpAttributesFourByteAsPathSegment{} + } + if obj.segmentsHolder == nil { + obj.segmentsHolder = newBgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter(&obj.obj.Segments).setMsg(obj) + } + return obj.segmentsHolder +} + +type bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter struct { + obj *bgpAttributesAs4Path + bgpAttributesFourByteAsPathSegmentSlice []BgpAttributesFourByteAsPathSegment + fieldPtr *[]*otg.BgpAttributesFourByteAsPathSegment +} + +func newBgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter(ptr *[]*otg.BgpAttributesFourByteAsPathSegment) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { + return &bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter{fieldPtr: ptr} +} + +type BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter interface { + setMsg(*bgpAttributesAs4Path) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter + Items() []BgpAttributesFourByteAsPathSegment + Add() BgpAttributesFourByteAsPathSegment + Append(items ...BgpAttributesFourByteAsPathSegment) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter + Set(index int, newObj BgpAttributesFourByteAsPathSegment) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter + Clear() BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter + clearHolderSlice() BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter + appendHolderSlice(item BgpAttributesFourByteAsPathSegment) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter +} + +func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) setMsg(msg *bgpAttributesAs4Path) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpAttributesFourByteAsPathSegment{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) Items() []BgpAttributesFourByteAsPathSegment { + return obj.bgpAttributesFourByteAsPathSegmentSlice +} + +func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) Add() BgpAttributesFourByteAsPathSegment { + newObj := &otg.BgpAttributesFourByteAsPathSegment{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpAttributesFourByteAsPathSegment{obj: newObj} + newLibObj.setDefault() + obj.bgpAttributesFourByteAsPathSegmentSlice = append(obj.bgpAttributesFourByteAsPathSegmentSlice, newLibObj) + return newLibObj +} + +func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) Append(items ...BgpAttributesFourByteAsPathSegment) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpAttributesFourByteAsPathSegmentSlice = append(obj.bgpAttributesFourByteAsPathSegmentSlice, item) + } + return obj +} + +func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) Set(index int, newObj BgpAttributesFourByteAsPathSegment) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpAttributesFourByteAsPathSegmentSlice[index] = newObj + return obj +} +func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) Clear() BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpAttributesFourByteAsPathSegment{} + obj.bgpAttributesFourByteAsPathSegmentSlice = []BgpAttributesFourByteAsPathSegment{} + } + return obj +} +func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) clearHolderSlice() BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { + if len(obj.bgpAttributesFourByteAsPathSegmentSlice) > 0 { + obj.bgpAttributesFourByteAsPathSegmentSlice = []BgpAttributesFourByteAsPathSegment{} + } + return obj +} +func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) appendHolderSlice(item BgpAttributesFourByteAsPathSegment) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { + obj.bgpAttributesFourByteAsPathSegmentSlice = append(obj.bgpAttributesFourByteAsPathSegmentSlice, item) + return obj +} + +func (obj *bgpAttributesAs4Path) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Segments) != 0 { + + if set_default { + obj.Segments().clearHolderSlice() + for _, item := range obj.obj.Segments { + obj.Segments().appendHolderSlice(&bgpAttributesFourByteAsPathSegment{obj: item}) + } + } + for _, item := range obj.Segments().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpAttributesAs4Path) setDefault() { + +} diff --git a/gosnappi/bgp_attributes_as_path.go b/gosnappi/bgp_attributes_as_path.go new file mode 100644 index 00000000..6c68e583 --- /dev/null +++ b/gosnappi/bgp_attributes_as_path.go @@ -0,0 +1,465 @@ +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" +) + +// ***** BgpAttributesAsPath ***** +type bgpAttributesAsPath struct { + validation + obj *otg.BgpAttributesAsPath + marshaller marshalBgpAttributesAsPath + unMarshaller unMarshalBgpAttributesAsPath + fourByteAsPathHolder BgpAttributesAsPathFourByteAsPath + twoByteAsPathHolder BgpAttributesAsPathTwoByteAsPath +} + +func NewBgpAttributesAsPath() BgpAttributesAsPath { + obj := bgpAttributesAsPath{obj: &otg.BgpAttributesAsPath{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesAsPath) msg() *otg.BgpAttributesAsPath { + return obj.obj +} + +func (obj *bgpAttributesAsPath) setMsg(msg *otg.BgpAttributesAsPath) BgpAttributesAsPath { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesAsPath struct { + obj *bgpAttributesAsPath +} + +type marshalBgpAttributesAsPath interface { + // ToProto marshals BgpAttributesAsPath to protobuf object *otg.BgpAttributesAsPath + ToProto() (*otg.BgpAttributesAsPath, error) + // ToPbText marshals BgpAttributesAsPath to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesAsPath to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesAsPath to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesAsPath struct { + obj *bgpAttributesAsPath +} + +type unMarshalBgpAttributesAsPath interface { + // FromProto unmarshals BgpAttributesAsPath from protobuf object *otg.BgpAttributesAsPath + FromProto(msg *otg.BgpAttributesAsPath) (BgpAttributesAsPath, error) + // FromPbText unmarshals BgpAttributesAsPath from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesAsPath from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesAsPath from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesAsPath) Marshal() marshalBgpAttributesAsPath { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesAsPath{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesAsPath) Unmarshal() unMarshalBgpAttributesAsPath { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesAsPath{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesAsPath) ToProto() (*otg.BgpAttributesAsPath, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesAsPath) FromProto(msg *otg.BgpAttributesAsPath) (BgpAttributesAsPath, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesAsPath) 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 *unMarshalbgpAttributesAsPath) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesAsPath) 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 *unMarshalbgpAttributesAsPath) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesAsPath) 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 *unMarshalbgpAttributesAsPath) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesAsPath) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesAsPath) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesAsPath) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesAsPath) Clone() (BgpAttributesAsPath, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesAsPath() + 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 +} + +func (obj *bgpAttributesAsPath) setNil() { + obj.fourByteAsPathHolder = nil + obj.twoByteAsPathHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesAsPath is the AS_PATH attribute identifies the autonomous systems through which routing information +// carried in this UPDATE message has passed. +// This contains the configuration of how to include the Local AS in the AS path +// attribute of the MP REACH NLRI. It also contains optional configuration of +// additional AS Path Segments that can be included in the AS Path attribute. +// The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that +// a routing information passes through to reach the destination. +// There are two modes in which AS numbers can be encoded in the AS Path Segments +// - When the AS Path is being exchanged between old and new BGP speakers or between two old BGP speakers , the AS numbers are encoded as 2 byte values. +// - When the AS Path is being exchanged between two new BGP speakers supporting 4 byte AS , the AS numbers are encoded as 4 byte values. +type BgpAttributesAsPath interface { + Validation + // msg marshals BgpAttributesAsPath to protobuf object *otg.BgpAttributesAsPath + // and doesn't set defaults + msg() *otg.BgpAttributesAsPath + // setMsg unmarshals BgpAttributesAsPath from protobuf object *otg.BgpAttributesAsPath + // and doesn't set defaults + setMsg(*otg.BgpAttributesAsPath) BgpAttributesAsPath + // provides marshal interface + Marshal() marshalBgpAttributesAsPath + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesAsPath + // validate validates BgpAttributesAsPath + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesAsPath, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpAttributesAsPathChoiceEnum, set in BgpAttributesAsPath + Choice() BgpAttributesAsPathChoiceEnum + // setChoice assigns BgpAttributesAsPathChoiceEnum provided by user to BgpAttributesAsPath + setChoice(value BgpAttributesAsPathChoiceEnum) BgpAttributesAsPath + // HasChoice checks if Choice has been set in BgpAttributesAsPath + HasChoice() bool + // FourByteAsPath returns BgpAttributesAsPathFourByteAsPath, set in BgpAttributesAsPath. + // BgpAttributesAsPathFourByteAsPath is aS Paths with 4 byte AS numbers can be exchanged only if both BGP speakers support 4 byte AS number extensions. + FourByteAsPath() BgpAttributesAsPathFourByteAsPath + // SetFourByteAsPath assigns BgpAttributesAsPathFourByteAsPath provided by user to BgpAttributesAsPath. + // BgpAttributesAsPathFourByteAsPath is aS Paths with 4 byte AS numbers can be exchanged only if both BGP speakers support 4 byte AS number extensions. + SetFourByteAsPath(value BgpAttributesAsPathFourByteAsPath) BgpAttributesAsPath + // HasFourByteAsPath checks if FourByteAsPath has been set in BgpAttributesAsPath + HasFourByteAsPath() bool + // TwoByteAsPath returns BgpAttributesAsPathTwoByteAsPath, set in BgpAttributesAsPath. + // BgpAttributesAsPathTwoByteAsPath is aS Paths with 2 byte AS numbers is used when any of the two scenarios occur : + // - An old BGP speaker and new BGP speaker are sending BGP Updates to one another. + // - Two old BGP speakers are sending BGP Updates to one another. + TwoByteAsPath() BgpAttributesAsPathTwoByteAsPath + // SetTwoByteAsPath assigns BgpAttributesAsPathTwoByteAsPath provided by user to BgpAttributesAsPath. + // BgpAttributesAsPathTwoByteAsPath is aS Paths with 2 byte AS numbers is used when any of the two scenarios occur : + // - An old BGP speaker and new BGP speaker are sending BGP Updates to one another. + // - Two old BGP speakers are sending BGP Updates to one another. + SetTwoByteAsPath(value BgpAttributesAsPathTwoByteAsPath) BgpAttributesAsPath + // HasTwoByteAsPath checks if TwoByteAsPath has been set in BgpAttributesAsPath + HasTwoByteAsPath() bool + setNil() +} + +type BgpAttributesAsPathChoiceEnum string + +// Enum of Choice on BgpAttributesAsPath +var BgpAttributesAsPathChoice = struct { + FOUR_BYTE_AS_PATH BgpAttributesAsPathChoiceEnum + TWO_BYTE_AS_PATH BgpAttributesAsPathChoiceEnum +}{ + FOUR_BYTE_AS_PATH: BgpAttributesAsPathChoiceEnum("four_byte_as_path"), + TWO_BYTE_AS_PATH: BgpAttributesAsPathChoiceEnum("two_byte_as_path"), +} + +func (obj *bgpAttributesAsPath) Choice() BgpAttributesAsPathChoiceEnum { + return BgpAttributesAsPathChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *bgpAttributesAsPath) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpAttributesAsPath) setChoice(value BgpAttributesAsPathChoiceEnum) BgpAttributesAsPath { + intValue, ok := otg.BgpAttributesAsPath_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAttributesAsPathChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpAttributesAsPath_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.TwoByteAsPath = nil + obj.twoByteAsPathHolder = nil + obj.obj.FourByteAsPath = nil + obj.fourByteAsPathHolder = nil + + if value == BgpAttributesAsPathChoice.FOUR_BYTE_AS_PATH { + obj.obj.FourByteAsPath = NewBgpAttributesAsPathFourByteAsPath().msg() + } + + if value == BgpAttributesAsPathChoice.TWO_BYTE_AS_PATH { + obj.obj.TwoByteAsPath = NewBgpAttributesAsPathTwoByteAsPath().msg() + } + + return obj +} + +// description is TBD +// FourByteAsPath returns a BgpAttributesAsPathFourByteAsPath +func (obj *bgpAttributesAsPath) FourByteAsPath() BgpAttributesAsPathFourByteAsPath { + if obj.obj.FourByteAsPath == nil { + obj.setChoice(BgpAttributesAsPathChoice.FOUR_BYTE_AS_PATH) + } + if obj.fourByteAsPathHolder == nil { + obj.fourByteAsPathHolder = &bgpAttributesAsPathFourByteAsPath{obj: obj.obj.FourByteAsPath} + } + return obj.fourByteAsPathHolder +} + +// description is TBD +// FourByteAsPath returns a BgpAttributesAsPathFourByteAsPath +func (obj *bgpAttributesAsPath) HasFourByteAsPath() bool { + return obj.obj.FourByteAsPath != nil +} + +// description is TBD +// SetFourByteAsPath sets the BgpAttributesAsPathFourByteAsPath value in the BgpAttributesAsPath object +func (obj *bgpAttributesAsPath) SetFourByteAsPath(value BgpAttributesAsPathFourByteAsPath) BgpAttributesAsPath { + obj.setChoice(BgpAttributesAsPathChoice.FOUR_BYTE_AS_PATH) + obj.fourByteAsPathHolder = nil + obj.obj.FourByteAsPath = value.msg() + + return obj +} + +// description is TBD +// TwoByteAsPath returns a BgpAttributesAsPathTwoByteAsPath +func (obj *bgpAttributesAsPath) TwoByteAsPath() BgpAttributesAsPathTwoByteAsPath { + if obj.obj.TwoByteAsPath == nil { + obj.setChoice(BgpAttributesAsPathChoice.TWO_BYTE_AS_PATH) + } + if obj.twoByteAsPathHolder == nil { + obj.twoByteAsPathHolder = &bgpAttributesAsPathTwoByteAsPath{obj: obj.obj.TwoByteAsPath} + } + return obj.twoByteAsPathHolder +} + +// description is TBD +// TwoByteAsPath returns a BgpAttributesAsPathTwoByteAsPath +func (obj *bgpAttributesAsPath) HasTwoByteAsPath() bool { + return obj.obj.TwoByteAsPath != nil +} + +// description is TBD +// SetTwoByteAsPath sets the BgpAttributesAsPathTwoByteAsPath value in the BgpAttributesAsPath object +func (obj *bgpAttributesAsPath) SetTwoByteAsPath(value BgpAttributesAsPathTwoByteAsPath) BgpAttributesAsPath { + obj.setChoice(BgpAttributesAsPathChoice.TWO_BYTE_AS_PATH) + obj.twoByteAsPathHolder = nil + obj.obj.TwoByteAsPath = value.msg() + + return obj +} + +func (obj *bgpAttributesAsPath) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.FourByteAsPath != nil { + + obj.FourByteAsPath().validateObj(vObj, set_default) + } + + if obj.obj.TwoByteAsPath != nil { + + obj.TwoByteAsPath().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesAsPath) setDefault() { + var choices_set int = 0 + var choice BgpAttributesAsPathChoiceEnum + + if obj.obj.FourByteAsPath != nil { + choices_set += 1 + choice = BgpAttributesAsPathChoice.FOUR_BYTE_AS_PATH + } + + if obj.obj.TwoByteAsPath != nil { + choices_set += 1 + choice = BgpAttributesAsPathChoice.TWO_BYTE_AS_PATH + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(BgpAttributesAsPathChoice.FOUR_BYTE_AS_PATH) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesAsPath") + } + } else { + intVal := otg.BgpAttributesAsPath_Choice_Enum_value[string(choice)] + enumValue := otg.BgpAttributesAsPath_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_attributes_as_path_four_byte_as_path.go b/gosnappi/bgp_attributes_as_path_four_byte_as_path.go new file mode 100644 index 00000000..1ef8a65e --- /dev/null +++ b/gosnappi/bgp_attributes_as_path_four_byte_as_path.go @@ -0,0 +1,390 @@ +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" +) + +// ***** BgpAttributesAsPathFourByteAsPath ***** +type bgpAttributesAsPathFourByteAsPath struct { + validation + obj *otg.BgpAttributesAsPathFourByteAsPath + marshaller marshalBgpAttributesAsPathFourByteAsPath + unMarshaller unMarshalBgpAttributesAsPathFourByteAsPath + segmentsHolder BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter +} + +func NewBgpAttributesAsPathFourByteAsPath() BgpAttributesAsPathFourByteAsPath { + obj := bgpAttributesAsPathFourByteAsPath{obj: &otg.BgpAttributesAsPathFourByteAsPath{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesAsPathFourByteAsPath) msg() *otg.BgpAttributesAsPathFourByteAsPath { + return obj.obj +} + +func (obj *bgpAttributesAsPathFourByteAsPath) setMsg(msg *otg.BgpAttributesAsPathFourByteAsPath) BgpAttributesAsPathFourByteAsPath { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesAsPathFourByteAsPath struct { + obj *bgpAttributesAsPathFourByteAsPath +} + +type marshalBgpAttributesAsPathFourByteAsPath interface { + // ToProto marshals BgpAttributesAsPathFourByteAsPath to protobuf object *otg.BgpAttributesAsPathFourByteAsPath + ToProto() (*otg.BgpAttributesAsPathFourByteAsPath, error) + // ToPbText marshals BgpAttributesAsPathFourByteAsPath to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesAsPathFourByteAsPath to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesAsPathFourByteAsPath to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesAsPathFourByteAsPath struct { + obj *bgpAttributesAsPathFourByteAsPath +} + +type unMarshalBgpAttributesAsPathFourByteAsPath interface { + // FromProto unmarshals BgpAttributesAsPathFourByteAsPath from protobuf object *otg.BgpAttributesAsPathFourByteAsPath + FromProto(msg *otg.BgpAttributesAsPathFourByteAsPath) (BgpAttributesAsPathFourByteAsPath, error) + // FromPbText unmarshals BgpAttributesAsPathFourByteAsPath from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesAsPathFourByteAsPath from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesAsPathFourByteAsPath from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesAsPathFourByteAsPath) Marshal() marshalBgpAttributesAsPathFourByteAsPath { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesAsPathFourByteAsPath{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesAsPathFourByteAsPath) Unmarshal() unMarshalBgpAttributesAsPathFourByteAsPath { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesAsPathFourByteAsPath{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesAsPathFourByteAsPath) ToProto() (*otg.BgpAttributesAsPathFourByteAsPath, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesAsPathFourByteAsPath) FromProto(msg *otg.BgpAttributesAsPathFourByteAsPath) (BgpAttributesAsPathFourByteAsPath, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesAsPathFourByteAsPath) 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 *unMarshalbgpAttributesAsPathFourByteAsPath) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesAsPathFourByteAsPath) 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 *unMarshalbgpAttributesAsPathFourByteAsPath) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesAsPathFourByteAsPath) 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 *unMarshalbgpAttributesAsPathFourByteAsPath) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesAsPathFourByteAsPath) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesAsPathFourByteAsPath) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesAsPathFourByteAsPath) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesAsPathFourByteAsPath) Clone() (BgpAttributesAsPathFourByteAsPath, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesAsPathFourByteAsPath() + 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 +} + +func (obj *bgpAttributesAsPathFourByteAsPath) setNil() { + obj.segmentsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesAsPathFourByteAsPath is aS Paths with 4 byte AS numbers can be exchanged only if both BGP speakers support 4 byte AS number extensions. +type BgpAttributesAsPathFourByteAsPath interface { + Validation + // msg marshals BgpAttributesAsPathFourByteAsPath to protobuf object *otg.BgpAttributesAsPathFourByteAsPath + // and doesn't set defaults + msg() *otg.BgpAttributesAsPathFourByteAsPath + // setMsg unmarshals BgpAttributesAsPathFourByteAsPath from protobuf object *otg.BgpAttributesAsPathFourByteAsPath + // and doesn't set defaults + setMsg(*otg.BgpAttributesAsPathFourByteAsPath) BgpAttributesAsPathFourByteAsPath + // provides marshal interface + Marshal() marshalBgpAttributesAsPathFourByteAsPath + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesAsPathFourByteAsPath + // validate validates BgpAttributesAsPathFourByteAsPath + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesAsPathFourByteAsPath, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Segments returns BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIterIter, set in BgpAttributesAsPathFourByteAsPath + Segments() BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter + setNil() +} + +// The AS path segments containing 4 byte AS numbers to be added in the AS Path attribute. By default, an empty AS path should always be included and for EBGP at minimum the local AS number should be present in the AS Path. +// Segments returns a []BgpAttributesFourByteAsPathSegment +func (obj *bgpAttributesAsPathFourByteAsPath) Segments() BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { + if len(obj.obj.Segments) == 0 { + obj.obj.Segments = []*otg.BgpAttributesFourByteAsPathSegment{} + } + if obj.segmentsHolder == nil { + obj.segmentsHolder = newBgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter(&obj.obj.Segments).setMsg(obj) + } + return obj.segmentsHolder +} + +type bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter struct { + obj *bgpAttributesAsPathFourByteAsPath + bgpAttributesFourByteAsPathSegmentSlice []BgpAttributesFourByteAsPathSegment + fieldPtr *[]*otg.BgpAttributesFourByteAsPathSegment +} + +func newBgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter(ptr *[]*otg.BgpAttributesFourByteAsPathSegment) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { + return &bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter{fieldPtr: ptr} +} + +type BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter interface { + setMsg(*bgpAttributesAsPathFourByteAsPath) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter + Items() []BgpAttributesFourByteAsPathSegment + Add() BgpAttributesFourByteAsPathSegment + Append(items ...BgpAttributesFourByteAsPathSegment) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter + Set(index int, newObj BgpAttributesFourByteAsPathSegment) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter + Clear() BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter + clearHolderSlice() BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter + appendHolderSlice(item BgpAttributesFourByteAsPathSegment) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter +} + +func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) setMsg(msg *bgpAttributesAsPathFourByteAsPath) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpAttributesFourByteAsPathSegment{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) Items() []BgpAttributesFourByteAsPathSegment { + return obj.bgpAttributesFourByteAsPathSegmentSlice +} + +func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) Add() BgpAttributesFourByteAsPathSegment { + newObj := &otg.BgpAttributesFourByteAsPathSegment{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpAttributesFourByteAsPathSegment{obj: newObj} + newLibObj.setDefault() + obj.bgpAttributesFourByteAsPathSegmentSlice = append(obj.bgpAttributesFourByteAsPathSegmentSlice, newLibObj) + return newLibObj +} + +func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) Append(items ...BgpAttributesFourByteAsPathSegment) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpAttributesFourByteAsPathSegmentSlice = append(obj.bgpAttributesFourByteAsPathSegmentSlice, item) + } + return obj +} + +func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) Set(index int, newObj BgpAttributesFourByteAsPathSegment) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpAttributesFourByteAsPathSegmentSlice[index] = newObj + return obj +} +func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) Clear() BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpAttributesFourByteAsPathSegment{} + obj.bgpAttributesFourByteAsPathSegmentSlice = []BgpAttributesFourByteAsPathSegment{} + } + return obj +} +func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) clearHolderSlice() BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { + if len(obj.bgpAttributesFourByteAsPathSegmentSlice) > 0 { + obj.bgpAttributesFourByteAsPathSegmentSlice = []BgpAttributesFourByteAsPathSegment{} + } + return obj +} +func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) appendHolderSlice(item BgpAttributesFourByteAsPathSegment) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { + obj.bgpAttributesFourByteAsPathSegmentSlice = append(obj.bgpAttributesFourByteAsPathSegmentSlice, item) + return obj +} + +func (obj *bgpAttributesAsPathFourByteAsPath) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Segments) != 0 { + + if set_default { + obj.Segments().clearHolderSlice() + for _, item := range obj.obj.Segments { + obj.Segments().appendHolderSlice(&bgpAttributesFourByteAsPathSegment{obj: item}) + } + } + for _, item := range obj.Segments().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpAttributesAsPathFourByteAsPath) setDefault() { + +} diff --git a/gosnappi/bgp_attributes_as_path_two_byte_as_path.go b/gosnappi/bgp_attributes_as_path_two_byte_as_path.go new file mode 100644 index 00000000..f9147669 --- /dev/null +++ b/gosnappi/bgp_attributes_as_path_two_byte_as_path.go @@ -0,0 +1,392 @@ +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" +) + +// ***** BgpAttributesAsPathTwoByteAsPath ***** +type bgpAttributesAsPathTwoByteAsPath struct { + validation + obj *otg.BgpAttributesAsPathTwoByteAsPath + marshaller marshalBgpAttributesAsPathTwoByteAsPath + unMarshaller unMarshalBgpAttributesAsPathTwoByteAsPath + segmentsHolder BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter +} + +func NewBgpAttributesAsPathTwoByteAsPath() BgpAttributesAsPathTwoByteAsPath { + obj := bgpAttributesAsPathTwoByteAsPath{obj: &otg.BgpAttributesAsPathTwoByteAsPath{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesAsPathTwoByteAsPath) msg() *otg.BgpAttributesAsPathTwoByteAsPath { + return obj.obj +} + +func (obj *bgpAttributesAsPathTwoByteAsPath) setMsg(msg *otg.BgpAttributesAsPathTwoByteAsPath) BgpAttributesAsPathTwoByteAsPath { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesAsPathTwoByteAsPath struct { + obj *bgpAttributesAsPathTwoByteAsPath +} + +type marshalBgpAttributesAsPathTwoByteAsPath interface { + // ToProto marshals BgpAttributesAsPathTwoByteAsPath to protobuf object *otg.BgpAttributesAsPathTwoByteAsPath + ToProto() (*otg.BgpAttributesAsPathTwoByteAsPath, error) + // ToPbText marshals BgpAttributesAsPathTwoByteAsPath to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesAsPathTwoByteAsPath to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesAsPathTwoByteAsPath to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesAsPathTwoByteAsPath struct { + obj *bgpAttributesAsPathTwoByteAsPath +} + +type unMarshalBgpAttributesAsPathTwoByteAsPath interface { + // FromProto unmarshals BgpAttributesAsPathTwoByteAsPath from protobuf object *otg.BgpAttributesAsPathTwoByteAsPath + FromProto(msg *otg.BgpAttributesAsPathTwoByteAsPath) (BgpAttributesAsPathTwoByteAsPath, error) + // FromPbText unmarshals BgpAttributesAsPathTwoByteAsPath from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesAsPathTwoByteAsPath from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesAsPathTwoByteAsPath from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesAsPathTwoByteAsPath) Marshal() marshalBgpAttributesAsPathTwoByteAsPath { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesAsPathTwoByteAsPath{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesAsPathTwoByteAsPath) Unmarshal() unMarshalBgpAttributesAsPathTwoByteAsPath { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesAsPathTwoByteAsPath{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesAsPathTwoByteAsPath) ToProto() (*otg.BgpAttributesAsPathTwoByteAsPath, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesAsPathTwoByteAsPath) FromProto(msg *otg.BgpAttributesAsPathTwoByteAsPath) (BgpAttributesAsPathTwoByteAsPath, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesAsPathTwoByteAsPath) 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 *unMarshalbgpAttributesAsPathTwoByteAsPath) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesAsPathTwoByteAsPath) 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 *unMarshalbgpAttributesAsPathTwoByteAsPath) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesAsPathTwoByteAsPath) 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 *unMarshalbgpAttributesAsPathTwoByteAsPath) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesAsPathTwoByteAsPath) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesAsPathTwoByteAsPath) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesAsPathTwoByteAsPath) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesAsPathTwoByteAsPath) Clone() (BgpAttributesAsPathTwoByteAsPath, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesAsPathTwoByteAsPath() + 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 +} + +func (obj *bgpAttributesAsPathTwoByteAsPath) setNil() { + obj.segmentsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesAsPathTwoByteAsPath is aS Paths with 2 byte AS numbers is used when any of the two scenarios occur : +// - An old BGP speaker and new BGP speaker are sending BGP Updates to one another. +// - Two old BGP speakers are sending BGP Updates to one another. +type BgpAttributesAsPathTwoByteAsPath interface { + Validation + // msg marshals BgpAttributesAsPathTwoByteAsPath to protobuf object *otg.BgpAttributesAsPathTwoByteAsPath + // and doesn't set defaults + msg() *otg.BgpAttributesAsPathTwoByteAsPath + // setMsg unmarshals BgpAttributesAsPathTwoByteAsPath from protobuf object *otg.BgpAttributesAsPathTwoByteAsPath + // and doesn't set defaults + setMsg(*otg.BgpAttributesAsPathTwoByteAsPath) BgpAttributesAsPathTwoByteAsPath + // provides marshal interface + Marshal() marshalBgpAttributesAsPathTwoByteAsPath + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesAsPathTwoByteAsPath + // validate validates BgpAttributesAsPathTwoByteAsPath + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesAsPathTwoByteAsPath, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Segments returns BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIterIter, set in BgpAttributesAsPathTwoByteAsPath + Segments() BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter + setNil() +} + +// The AS path segments containing 2 byte AS numbers to be added in the AS Path attribute. By default, an empty AS path should always be included and for EBGP the sender's AS number should be prepended to the AS Path. +// Segments returns a []BgpAttributesTwoByteAsPathSegment +func (obj *bgpAttributesAsPathTwoByteAsPath) Segments() BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { + if len(obj.obj.Segments) == 0 { + obj.obj.Segments = []*otg.BgpAttributesTwoByteAsPathSegment{} + } + if obj.segmentsHolder == nil { + obj.segmentsHolder = newBgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter(&obj.obj.Segments).setMsg(obj) + } + return obj.segmentsHolder +} + +type bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter struct { + obj *bgpAttributesAsPathTwoByteAsPath + bgpAttributesTwoByteAsPathSegmentSlice []BgpAttributesTwoByteAsPathSegment + fieldPtr *[]*otg.BgpAttributesTwoByteAsPathSegment +} + +func newBgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter(ptr *[]*otg.BgpAttributesTwoByteAsPathSegment) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { + return &bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter{fieldPtr: ptr} +} + +type BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter interface { + setMsg(*bgpAttributesAsPathTwoByteAsPath) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter + Items() []BgpAttributesTwoByteAsPathSegment + Add() BgpAttributesTwoByteAsPathSegment + Append(items ...BgpAttributesTwoByteAsPathSegment) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter + Set(index int, newObj BgpAttributesTwoByteAsPathSegment) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter + Clear() BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter + clearHolderSlice() BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter + appendHolderSlice(item BgpAttributesTwoByteAsPathSegment) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter +} + +func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) setMsg(msg *bgpAttributesAsPathTwoByteAsPath) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpAttributesTwoByteAsPathSegment{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) Items() []BgpAttributesTwoByteAsPathSegment { + return obj.bgpAttributesTwoByteAsPathSegmentSlice +} + +func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) Add() BgpAttributesTwoByteAsPathSegment { + newObj := &otg.BgpAttributesTwoByteAsPathSegment{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpAttributesTwoByteAsPathSegment{obj: newObj} + newLibObj.setDefault() + obj.bgpAttributesTwoByteAsPathSegmentSlice = append(obj.bgpAttributesTwoByteAsPathSegmentSlice, newLibObj) + return newLibObj +} + +func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) Append(items ...BgpAttributesTwoByteAsPathSegment) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpAttributesTwoByteAsPathSegmentSlice = append(obj.bgpAttributesTwoByteAsPathSegmentSlice, item) + } + return obj +} + +func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) Set(index int, newObj BgpAttributesTwoByteAsPathSegment) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpAttributesTwoByteAsPathSegmentSlice[index] = newObj + return obj +} +func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) Clear() BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpAttributesTwoByteAsPathSegment{} + obj.bgpAttributesTwoByteAsPathSegmentSlice = []BgpAttributesTwoByteAsPathSegment{} + } + return obj +} +func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) clearHolderSlice() BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { + if len(obj.bgpAttributesTwoByteAsPathSegmentSlice) > 0 { + obj.bgpAttributesTwoByteAsPathSegmentSlice = []BgpAttributesTwoByteAsPathSegment{} + } + return obj +} +func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) appendHolderSlice(item BgpAttributesTwoByteAsPathSegment) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { + obj.bgpAttributesTwoByteAsPathSegmentSlice = append(obj.bgpAttributesTwoByteAsPathSegmentSlice, item) + return obj +} + +func (obj *bgpAttributesAsPathTwoByteAsPath) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Segments) != 0 { + + if set_default { + obj.Segments().clearHolderSlice() + for _, item := range obj.obj.Segments { + obj.Segments().appendHolderSlice(&bgpAttributesTwoByteAsPathSegment{obj: item}) + } + } + for _, item := range obj.Segments().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpAttributesAsPathTwoByteAsPath) setDefault() { + +} diff --git a/gosnappi/bgp_attributes_bsid.go b/gosnappi/bgp_attributes_bsid.go new file mode 100644 index 00000000..5f53d996 --- /dev/null +++ b/gosnappi/bgp_attributes_bsid.go @@ -0,0 +1,453 @@ +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" +) + +// ***** BgpAttributesBsid ***** +type bgpAttributesBsid struct { + validation + obj *otg.BgpAttributesBsid + marshaller marshalBgpAttributesBsid + unMarshaller unMarshalBgpAttributesBsid + mplsHolder BgpAttributesBsidMpls + srv6Holder BgpAttributesBsidSrv6 +} + +func NewBgpAttributesBsid() BgpAttributesBsid { + obj := bgpAttributesBsid{obj: &otg.BgpAttributesBsid{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesBsid) msg() *otg.BgpAttributesBsid { + return obj.obj +} + +func (obj *bgpAttributesBsid) setMsg(msg *otg.BgpAttributesBsid) BgpAttributesBsid { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesBsid struct { + obj *bgpAttributesBsid +} + +type marshalBgpAttributesBsid interface { + // ToProto marshals BgpAttributesBsid to protobuf object *otg.BgpAttributesBsid + ToProto() (*otg.BgpAttributesBsid, error) + // ToPbText marshals BgpAttributesBsid to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesBsid to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesBsid to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesBsid struct { + obj *bgpAttributesBsid +} + +type unMarshalBgpAttributesBsid interface { + // FromProto unmarshals BgpAttributesBsid from protobuf object *otg.BgpAttributesBsid + FromProto(msg *otg.BgpAttributesBsid) (BgpAttributesBsid, error) + // FromPbText unmarshals BgpAttributesBsid from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesBsid from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesBsid from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesBsid) Marshal() marshalBgpAttributesBsid { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesBsid{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesBsid) Unmarshal() unMarshalBgpAttributesBsid { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesBsid{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesBsid) ToProto() (*otg.BgpAttributesBsid, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesBsid) FromProto(msg *otg.BgpAttributesBsid) (BgpAttributesBsid, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesBsid) 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 *unMarshalbgpAttributesBsid) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesBsid) 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 *unMarshalbgpAttributesBsid) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesBsid) 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 *unMarshalbgpAttributesBsid) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesBsid) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesBsid) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesBsid) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesBsid) Clone() (BgpAttributesBsid, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesBsid() + 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 +} + +func (obj *bgpAttributesBsid) setNil() { + obj.mplsHolder = nil + obj.srv6Holder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesBsid is the Binding Segment Identifier is an optional sub-tlv of type 13 that can be sent with a SR Policy +// Tunnel Encapsulation attribute. +// When the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that +// BSID if this value (label in MPLS, IPv6 address in SRv6) is available. +// - The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . +// - It is recommended that if SRv6 Binding SID is desired to be signalled, the SRv6 Binding SID sub-TLV that enables +// the specification of the SRv6 Endpoint Behavior should be used. +type BgpAttributesBsid interface { + Validation + // msg marshals BgpAttributesBsid to protobuf object *otg.BgpAttributesBsid + // and doesn't set defaults + msg() *otg.BgpAttributesBsid + // setMsg unmarshals BgpAttributesBsid from protobuf object *otg.BgpAttributesBsid + // and doesn't set defaults + setMsg(*otg.BgpAttributesBsid) BgpAttributesBsid + // provides marshal interface + Marshal() marshalBgpAttributesBsid + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesBsid + // validate validates BgpAttributesBsid + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesBsid, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpAttributesBsidChoiceEnum, set in BgpAttributesBsid + Choice() BgpAttributesBsidChoiceEnum + // setChoice assigns BgpAttributesBsidChoiceEnum provided by user to BgpAttributesBsid + setChoice(value BgpAttributesBsidChoiceEnum) BgpAttributesBsid + // Mpls returns BgpAttributesBsidMpls, set in BgpAttributesBsid. + // BgpAttributesBsidMpls is when the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that BSID defined + // as a MPLS label.The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . + Mpls() BgpAttributesBsidMpls + // SetMpls assigns BgpAttributesBsidMpls provided by user to BgpAttributesBsid. + // BgpAttributesBsidMpls is when the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that BSID defined + // as a MPLS label.The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . + SetMpls(value BgpAttributesBsidMpls) BgpAttributesBsid + // HasMpls checks if Mpls has been set in BgpAttributesBsid + HasMpls() bool + // Srv6 returns BgpAttributesBsidSrv6, set in BgpAttributesBsid. + // BgpAttributesBsidSrv6 is when the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that BSID defined + // as an IPv6 Address.The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . + Srv6() BgpAttributesBsidSrv6 + // SetSrv6 assigns BgpAttributesBsidSrv6 provided by user to BgpAttributesBsid. + // BgpAttributesBsidSrv6 is when the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that BSID defined + // as an IPv6 Address.The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . + SetSrv6(value BgpAttributesBsidSrv6) BgpAttributesBsid + // HasSrv6 checks if Srv6 has been set in BgpAttributesBsid + HasSrv6() bool + setNil() +} + +type BgpAttributesBsidChoiceEnum string + +// Enum of Choice on BgpAttributesBsid +var BgpAttributesBsidChoice = struct { + MPLS BgpAttributesBsidChoiceEnum + SRV6 BgpAttributesBsidChoiceEnum +}{ + MPLS: BgpAttributesBsidChoiceEnum("mpls"), + SRV6: BgpAttributesBsidChoiceEnum("srv6"), +} + +func (obj *bgpAttributesBsid) Choice() BgpAttributesBsidChoiceEnum { + return BgpAttributesBsidChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *bgpAttributesBsid) setChoice(value BgpAttributesBsidChoiceEnum) BgpAttributesBsid { + intValue, ok := otg.BgpAttributesBsid_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAttributesBsidChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpAttributesBsid_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Srv6 = nil + obj.srv6Holder = nil + obj.obj.Mpls = nil + obj.mplsHolder = nil + + if value == BgpAttributesBsidChoice.MPLS { + obj.obj.Mpls = NewBgpAttributesBsidMpls().msg() + } + + if value == BgpAttributesBsidChoice.SRV6 { + obj.obj.Srv6 = NewBgpAttributesBsidSrv6().msg() + } + + return obj +} + +// description is TBD +// Mpls returns a BgpAttributesBsidMpls +func (obj *bgpAttributesBsid) Mpls() BgpAttributesBsidMpls { + if obj.obj.Mpls == nil { + obj.setChoice(BgpAttributesBsidChoice.MPLS) + } + if obj.mplsHolder == nil { + obj.mplsHolder = &bgpAttributesBsidMpls{obj: obj.obj.Mpls} + } + return obj.mplsHolder +} + +// description is TBD +// Mpls returns a BgpAttributesBsidMpls +func (obj *bgpAttributesBsid) HasMpls() bool { + return obj.obj.Mpls != nil +} + +// description is TBD +// SetMpls sets the BgpAttributesBsidMpls value in the BgpAttributesBsid object +func (obj *bgpAttributesBsid) SetMpls(value BgpAttributesBsidMpls) BgpAttributesBsid { + obj.setChoice(BgpAttributesBsidChoice.MPLS) + obj.mplsHolder = nil + obj.obj.Mpls = value.msg() + + return obj +} + +// description is TBD +// Srv6 returns a BgpAttributesBsidSrv6 +func (obj *bgpAttributesBsid) Srv6() BgpAttributesBsidSrv6 { + if obj.obj.Srv6 == nil { + obj.setChoice(BgpAttributesBsidChoice.SRV6) + } + if obj.srv6Holder == nil { + obj.srv6Holder = &bgpAttributesBsidSrv6{obj: obj.obj.Srv6} + } + return obj.srv6Holder +} + +// description is TBD +// Srv6 returns a BgpAttributesBsidSrv6 +func (obj *bgpAttributesBsid) HasSrv6() bool { + return obj.obj.Srv6 != nil +} + +// description is TBD +// SetSrv6 sets the BgpAttributesBsidSrv6 value in the BgpAttributesBsid object +func (obj *bgpAttributesBsid) SetSrv6(value BgpAttributesBsidSrv6) BgpAttributesBsid { + obj.setChoice(BgpAttributesBsidChoice.SRV6) + obj.srv6Holder = nil + obj.obj.Srv6 = value.msg() + + return obj +} + +func (obj *bgpAttributesBsid) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface BgpAttributesBsid") + } + + if obj.obj.Mpls != nil { + + obj.Mpls().validateObj(vObj, set_default) + } + + if obj.obj.Srv6 != nil { + + obj.Srv6().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesBsid) setDefault() { + var choices_set int = 0 + var choice BgpAttributesBsidChoiceEnum + + if obj.obj.Mpls != nil { + choices_set += 1 + choice = BgpAttributesBsidChoice.MPLS + } + + if obj.obj.Srv6 != nil { + choices_set += 1 + choice = BgpAttributesBsidChoice.SRV6 + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesBsid") + } + } else { + intVal := otg.BgpAttributesBsid_Choice_Enum_value[string(choice)] + enumValue := otg.BgpAttributesBsid_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_attributes_bsid_mpls.go b/gosnappi/bgp_attributes_bsid_mpls.go new file mode 100644 index 00000000..d79ed82c --- /dev/null +++ b/gosnappi/bgp_attributes_bsid_mpls.go @@ -0,0 +1,399 @@ +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" +) + +// ***** BgpAttributesBsidMpls ***** +type bgpAttributesBsidMpls struct { + validation + obj *otg.BgpAttributesBsidMpls + marshaller marshalBgpAttributesBsidMpls + unMarshaller unMarshalBgpAttributesBsidMpls + mplsSidHolder BgpAttributesSidMpls +} + +func NewBgpAttributesBsidMpls() BgpAttributesBsidMpls { + obj := bgpAttributesBsidMpls{obj: &otg.BgpAttributesBsidMpls{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesBsidMpls) msg() *otg.BgpAttributesBsidMpls { + return obj.obj +} + +func (obj *bgpAttributesBsidMpls) setMsg(msg *otg.BgpAttributesBsidMpls) BgpAttributesBsidMpls { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesBsidMpls struct { + obj *bgpAttributesBsidMpls +} + +type marshalBgpAttributesBsidMpls interface { + // ToProto marshals BgpAttributesBsidMpls to protobuf object *otg.BgpAttributesBsidMpls + ToProto() (*otg.BgpAttributesBsidMpls, error) + // ToPbText marshals BgpAttributesBsidMpls to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesBsidMpls to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesBsidMpls to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesBsidMpls struct { + obj *bgpAttributesBsidMpls +} + +type unMarshalBgpAttributesBsidMpls interface { + // FromProto unmarshals BgpAttributesBsidMpls from protobuf object *otg.BgpAttributesBsidMpls + FromProto(msg *otg.BgpAttributesBsidMpls) (BgpAttributesBsidMpls, error) + // FromPbText unmarshals BgpAttributesBsidMpls from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesBsidMpls from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesBsidMpls from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesBsidMpls) Marshal() marshalBgpAttributesBsidMpls { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesBsidMpls{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesBsidMpls) Unmarshal() unMarshalBgpAttributesBsidMpls { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesBsidMpls{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesBsidMpls) ToProto() (*otg.BgpAttributesBsidMpls, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesBsidMpls) FromProto(msg *otg.BgpAttributesBsidMpls) (BgpAttributesBsidMpls, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesBsidMpls) 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 *unMarshalbgpAttributesBsidMpls) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesBsidMpls) 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 *unMarshalbgpAttributesBsidMpls) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesBsidMpls) 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 *unMarshalbgpAttributesBsidMpls) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesBsidMpls) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesBsidMpls) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesBsidMpls) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesBsidMpls) Clone() (BgpAttributesBsidMpls, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesBsidMpls() + 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 +} + +func (obj *bgpAttributesBsidMpls) setNil() { + obj.mplsSidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesBsidMpls is when the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that BSID defined +// as a MPLS label.The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . +type BgpAttributesBsidMpls interface { + Validation + // msg marshals BgpAttributesBsidMpls to protobuf object *otg.BgpAttributesBsidMpls + // and doesn't set defaults + msg() *otg.BgpAttributesBsidMpls + // setMsg unmarshals BgpAttributesBsidMpls from protobuf object *otg.BgpAttributesBsidMpls + // and doesn't set defaults + setMsg(*otg.BgpAttributesBsidMpls) BgpAttributesBsidMpls + // provides marshal interface + Marshal() marshalBgpAttributesBsidMpls + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesBsidMpls + // validate validates BgpAttributesBsidMpls + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesBsidMpls, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // FlagSpecifiedBsidOnly returns bool, set in BgpAttributesBsidMpls. + FlagSpecifiedBsidOnly() bool + // SetFlagSpecifiedBsidOnly assigns bool provided by user to BgpAttributesBsidMpls + SetFlagSpecifiedBsidOnly(value bool) BgpAttributesBsidMpls + // HasFlagSpecifiedBsidOnly checks if FlagSpecifiedBsidOnly has been set in BgpAttributesBsidMpls + HasFlagSpecifiedBsidOnly() bool + // FlagDropUponInvalid returns bool, set in BgpAttributesBsidMpls. + FlagDropUponInvalid() bool + // SetFlagDropUponInvalid assigns bool provided by user to BgpAttributesBsidMpls + SetFlagDropUponInvalid(value bool) BgpAttributesBsidMpls + // HasFlagDropUponInvalid checks if FlagDropUponInvalid has been set in BgpAttributesBsidMpls + HasFlagDropUponInvalid() bool + // MplsSid returns BgpAttributesSidMpls, set in BgpAttributesBsidMpls. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + MplsSid() BgpAttributesSidMpls + // SetMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesBsidMpls. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + SetMplsSid(value BgpAttributesSidMpls) BgpAttributesBsidMpls + // HasMplsSid checks if MplsSid has been set in BgpAttributesBsidMpls + HasMplsSid() bool + setNil() +} + +// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is +// described in section 6.2.3 in [RFC9256]. +// FlagSpecifiedBsidOnly returns a bool +func (obj *bgpAttributesBsidMpls) FlagSpecifiedBsidOnly() bool { + + return *obj.obj.FlagSpecifiedBsidOnly + +} + +// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is +// described in section 6.2.3 in [RFC9256]. +// FlagSpecifiedBsidOnly returns a bool +func (obj *bgpAttributesBsidMpls) HasFlagSpecifiedBsidOnly() bool { + return obj.obj.FlagSpecifiedBsidOnly != nil +} + +// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is +// described in section 6.2.3 in [RFC9256]. +// SetFlagSpecifiedBsidOnly sets the bool value in the BgpAttributesBsidMpls object +func (obj *bgpAttributesBsidMpls) SetFlagSpecifiedBsidOnly(value bool) BgpAttributesBsidMpls { + + obj.obj.FlagSpecifiedBsidOnly = &value + return obj +} + +// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. +// It's usage is described in section 8.2 in [RFC9256]. +// FlagDropUponInvalid returns a bool +func (obj *bgpAttributesBsidMpls) FlagDropUponInvalid() bool { + + return *obj.obj.FlagDropUponInvalid + +} + +// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. +// It's usage is described in section 8.2 in [RFC9256]. +// FlagDropUponInvalid returns a bool +func (obj *bgpAttributesBsidMpls) HasFlagDropUponInvalid() bool { + return obj.obj.FlagDropUponInvalid != nil +} + +// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. +// It's usage is described in section 8.2 in [RFC9256]. +// SetFlagDropUponInvalid sets the bool value in the BgpAttributesBsidMpls object +func (obj *bgpAttributesBsidMpls) SetFlagDropUponInvalid(value bool) BgpAttributesBsidMpls { + + obj.obj.FlagDropUponInvalid = &value + return obj +} + +// description is TBD +// MplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesBsidMpls) MplsSid() BgpAttributesSidMpls { + if obj.obj.MplsSid == nil { + obj.obj.MplsSid = NewBgpAttributesSidMpls().msg() + } + if obj.mplsSidHolder == nil { + obj.mplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.MplsSid} + } + return obj.mplsSidHolder +} + +// description is TBD +// MplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesBsidMpls) HasMplsSid() bool { + return obj.obj.MplsSid != nil +} + +// description is TBD +// SetMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesBsidMpls object +func (obj *bgpAttributesBsidMpls) SetMplsSid(value BgpAttributesSidMpls) BgpAttributesBsidMpls { + + obj.mplsSidHolder = nil + obj.obj.MplsSid = value.msg() + + return obj +} + +func (obj *bgpAttributesBsidMpls) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.MplsSid != nil { + + obj.MplsSid().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesBsidMpls) setDefault() { + if obj.obj.FlagSpecifiedBsidOnly == nil { + obj.SetFlagSpecifiedBsidOnly(false) + } + if obj.obj.FlagDropUponInvalid == nil { + obj.SetFlagDropUponInvalid(false) + } + +} diff --git a/gosnappi/bgp_attributes_bsid_srv6.go b/gosnappi/bgp_attributes_bsid_srv6.go new file mode 100644 index 00000000..21f2af5d --- /dev/null +++ b/gosnappi/bgp_attributes_bsid_srv6.go @@ -0,0 +1,387 @@ +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" +) + +// ***** BgpAttributesBsidSrv6 ***** +type bgpAttributesBsidSrv6 struct { + validation + obj *otg.BgpAttributesBsidSrv6 + marshaller marshalBgpAttributesBsidSrv6 + unMarshaller unMarshalBgpAttributesBsidSrv6 +} + +func NewBgpAttributesBsidSrv6() BgpAttributesBsidSrv6 { + obj := bgpAttributesBsidSrv6{obj: &otg.BgpAttributesBsidSrv6{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesBsidSrv6) msg() *otg.BgpAttributesBsidSrv6 { + return obj.obj +} + +func (obj *bgpAttributesBsidSrv6) setMsg(msg *otg.BgpAttributesBsidSrv6) BgpAttributesBsidSrv6 { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesBsidSrv6 struct { + obj *bgpAttributesBsidSrv6 +} + +type marshalBgpAttributesBsidSrv6 interface { + // ToProto marshals BgpAttributesBsidSrv6 to protobuf object *otg.BgpAttributesBsidSrv6 + ToProto() (*otg.BgpAttributesBsidSrv6, error) + // ToPbText marshals BgpAttributesBsidSrv6 to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesBsidSrv6 to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesBsidSrv6 to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesBsidSrv6 struct { + obj *bgpAttributesBsidSrv6 +} + +type unMarshalBgpAttributesBsidSrv6 interface { + // FromProto unmarshals BgpAttributesBsidSrv6 from protobuf object *otg.BgpAttributesBsidSrv6 + FromProto(msg *otg.BgpAttributesBsidSrv6) (BgpAttributesBsidSrv6, error) + // FromPbText unmarshals BgpAttributesBsidSrv6 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesBsidSrv6 from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesBsidSrv6 from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesBsidSrv6) Marshal() marshalBgpAttributesBsidSrv6 { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesBsidSrv6{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesBsidSrv6) Unmarshal() unMarshalBgpAttributesBsidSrv6 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesBsidSrv6{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesBsidSrv6) ToProto() (*otg.BgpAttributesBsidSrv6, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesBsidSrv6) FromProto(msg *otg.BgpAttributesBsidSrv6) (BgpAttributesBsidSrv6, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesBsidSrv6) 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 *unMarshalbgpAttributesBsidSrv6) 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 *marshalbgpAttributesBsidSrv6) 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 *unMarshalbgpAttributesBsidSrv6) 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 *marshalbgpAttributesBsidSrv6) 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 *unMarshalbgpAttributesBsidSrv6) 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 *bgpAttributesBsidSrv6) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesBsidSrv6) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesBsidSrv6) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesBsidSrv6) Clone() (BgpAttributesBsidSrv6, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesBsidSrv6() + 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 +} + +// BgpAttributesBsidSrv6 is when the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that BSID defined +// as an IPv6 Address.The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . +type BgpAttributesBsidSrv6 interface { + Validation + // msg marshals BgpAttributesBsidSrv6 to protobuf object *otg.BgpAttributesBsidSrv6 + // and doesn't set defaults + msg() *otg.BgpAttributesBsidSrv6 + // setMsg unmarshals BgpAttributesBsidSrv6 from protobuf object *otg.BgpAttributesBsidSrv6 + // and doesn't set defaults + setMsg(*otg.BgpAttributesBsidSrv6) BgpAttributesBsidSrv6 + // provides marshal interface + Marshal() marshalBgpAttributesBsidSrv6 + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesBsidSrv6 + // validate validates BgpAttributesBsidSrv6 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesBsidSrv6, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // FlagSpecifiedBsidOnly returns bool, set in BgpAttributesBsidSrv6. + FlagSpecifiedBsidOnly() bool + // SetFlagSpecifiedBsidOnly assigns bool provided by user to BgpAttributesBsidSrv6 + SetFlagSpecifiedBsidOnly(value bool) BgpAttributesBsidSrv6 + // HasFlagSpecifiedBsidOnly checks if FlagSpecifiedBsidOnly has been set in BgpAttributesBsidSrv6 + HasFlagSpecifiedBsidOnly() bool + // FlagDropUponInvalid returns bool, set in BgpAttributesBsidSrv6. + FlagDropUponInvalid() bool + // SetFlagDropUponInvalid assigns bool provided by user to BgpAttributesBsidSrv6 + SetFlagDropUponInvalid(value bool) BgpAttributesBsidSrv6 + // HasFlagDropUponInvalid checks if FlagDropUponInvalid has been set in BgpAttributesBsidSrv6 + HasFlagDropUponInvalid() bool + // Ipv6Addr returns string, set in BgpAttributesBsidSrv6. + Ipv6Addr() string + // SetIpv6Addr assigns string provided by user to BgpAttributesBsidSrv6 + SetIpv6Addr(value string) BgpAttributesBsidSrv6 + // HasIpv6Addr checks if Ipv6Addr has been set in BgpAttributesBsidSrv6 + HasIpv6Addr() bool +} + +// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is +// described in section 6.2.3 in [RFC9256]. +// FlagSpecifiedBsidOnly returns a bool +func (obj *bgpAttributesBsidSrv6) FlagSpecifiedBsidOnly() bool { + + return *obj.obj.FlagSpecifiedBsidOnly + +} + +// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is +// described in section 6.2.3 in [RFC9256]. +// FlagSpecifiedBsidOnly returns a bool +func (obj *bgpAttributesBsidSrv6) HasFlagSpecifiedBsidOnly() bool { + return obj.obj.FlagSpecifiedBsidOnly != nil +} + +// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is +// described in section 6.2.3 in [RFC9256]. +// SetFlagSpecifiedBsidOnly sets the bool value in the BgpAttributesBsidSrv6 object +func (obj *bgpAttributesBsidSrv6) SetFlagSpecifiedBsidOnly(value bool) BgpAttributesBsidSrv6 { + + obj.obj.FlagSpecifiedBsidOnly = &value + return obj +} + +// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. +// It's usage is described in section 8.2 in [RFC9256]. +// FlagDropUponInvalid returns a bool +func (obj *bgpAttributesBsidSrv6) FlagDropUponInvalid() bool { + + return *obj.obj.FlagDropUponInvalid + +} + +// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. +// It's usage is described in section 8.2 in [RFC9256]. +// FlagDropUponInvalid returns a bool +func (obj *bgpAttributesBsidSrv6) HasFlagDropUponInvalid() bool { + return obj.obj.FlagDropUponInvalid != nil +} + +// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. +// It's usage is described in section 8.2 in [RFC9256]. +// SetFlagDropUponInvalid sets the bool value in the BgpAttributesBsidSrv6 object +func (obj *bgpAttributesBsidSrv6) SetFlagDropUponInvalid(value bool) BgpAttributesBsidSrv6 { + + obj.obj.FlagDropUponInvalid = &value + return obj +} + +// IPv6 address denoting the SRv6 SID. +// Ipv6Addr returns a string +func (obj *bgpAttributesBsidSrv6) Ipv6Addr() string { + + return *obj.obj.Ipv6Addr + +} + +// IPv6 address denoting the SRv6 SID. +// Ipv6Addr returns a string +func (obj *bgpAttributesBsidSrv6) HasIpv6Addr() bool { + return obj.obj.Ipv6Addr != nil +} + +// IPv6 address denoting the SRv6 SID. +// SetIpv6Addr sets the string value in the BgpAttributesBsidSrv6 object +func (obj *bgpAttributesBsidSrv6) SetIpv6Addr(value string) BgpAttributesBsidSrv6 { + + obj.obj.Ipv6Addr = &value + return obj +} + +func (obj *bgpAttributesBsidSrv6) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv6Addr != nil { + + err := obj.validateIpv6(obj.Ipv6Addr()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesBsidSrv6.Ipv6Addr")) + } + + } + +} + +func (obj *bgpAttributesBsidSrv6) setDefault() { + if obj.obj.FlagSpecifiedBsidOnly == nil { + obj.SetFlagSpecifiedBsidOnly(false) + } + if obj.obj.FlagDropUponInvalid == nil { + obj.SetFlagDropUponInvalid(false) + } + if obj.obj.Ipv6Addr == nil { + obj.SetIpv6Addr("0::0") + } + +} diff --git a/gosnappi/bgp_attributes_community.go b/gosnappi/bgp_attributes_community.go new file mode 100644 index 00000000..bb405dd5 --- /dev/null +++ b/gosnappi/bgp_attributes_community.go @@ -0,0 +1,434 @@ +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" +) + +// ***** BgpAttributesCommunity ***** +type bgpAttributesCommunity struct { + validation + obj *otg.BgpAttributesCommunity + marshaller marshalBgpAttributesCommunity + unMarshaller unMarshalBgpAttributesCommunity + customCommunityHolder BgpAttributesCustomCommunity +} + +func NewBgpAttributesCommunity() BgpAttributesCommunity { + obj := bgpAttributesCommunity{obj: &otg.BgpAttributesCommunity{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesCommunity) msg() *otg.BgpAttributesCommunity { + return obj.obj +} + +func (obj *bgpAttributesCommunity) setMsg(msg *otg.BgpAttributesCommunity) BgpAttributesCommunity { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesCommunity struct { + obj *bgpAttributesCommunity +} + +type marshalBgpAttributesCommunity interface { + // ToProto marshals BgpAttributesCommunity to protobuf object *otg.BgpAttributesCommunity + ToProto() (*otg.BgpAttributesCommunity, error) + // ToPbText marshals BgpAttributesCommunity to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesCommunity to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesCommunity to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesCommunity struct { + obj *bgpAttributesCommunity +} + +type unMarshalBgpAttributesCommunity interface { + // FromProto unmarshals BgpAttributesCommunity from protobuf object *otg.BgpAttributesCommunity + FromProto(msg *otg.BgpAttributesCommunity) (BgpAttributesCommunity, error) + // FromPbText unmarshals BgpAttributesCommunity from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesCommunity from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesCommunity from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesCommunity) Marshal() marshalBgpAttributesCommunity { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesCommunity{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesCommunity) Unmarshal() unMarshalBgpAttributesCommunity { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesCommunity{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesCommunity) ToProto() (*otg.BgpAttributesCommunity, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesCommunity) FromProto(msg *otg.BgpAttributesCommunity) (BgpAttributesCommunity, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesCommunity) 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 *unMarshalbgpAttributesCommunity) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesCommunity) 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 *unMarshalbgpAttributesCommunity) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesCommunity) 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 *unMarshalbgpAttributesCommunity) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesCommunity) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesCommunity) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesCommunity) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesCommunity) Clone() (BgpAttributesCommunity, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesCommunity() + 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 +} + +func (obj *bgpAttributesCommunity) setNil() { + obj.customCommunityHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesCommunity is the COMMUNITY attribute provide additional capability for tagging routes and for modifying BGP routing policy on +// upstream and downstream routers. BGP community is a 32-bit number which is broken into 16-bit AS number and a +// 16-bit custom value or it contains some pre-defined well known values. +type BgpAttributesCommunity interface { + Validation + // msg marshals BgpAttributesCommunity to protobuf object *otg.BgpAttributesCommunity + // and doesn't set defaults + msg() *otg.BgpAttributesCommunity + // setMsg unmarshals BgpAttributesCommunity from protobuf object *otg.BgpAttributesCommunity + // and doesn't set defaults + setMsg(*otg.BgpAttributesCommunity) BgpAttributesCommunity + // provides marshal interface + Marshal() marshalBgpAttributesCommunity + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesCommunity + // validate validates BgpAttributesCommunity + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesCommunity, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpAttributesCommunityChoiceEnum, set in BgpAttributesCommunity + Choice() BgpAttributesCommunityChoiceEnum + // setChoice assigns BgpAttributesCommunityChoiceEnum provided by user to BgpAttributesCommunity + setChoice(value BgpAttributesCommunityChoiceEnum) BgpAttributesCommunity + // getter for NoAdvertised to set choice. + NoAdvertised() + // getter for NoExportSubconfed to set choice. + NoExportSubconfed() + // getter for LlgrStale to set choice. + LlgrStale() + // getter for NoLlgr to set choice. + NoLlgr() + // 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 + // SetCustomCommunity assigns BgpAttributesCustomCommunity provided by user to BgpAttributesCommunity. + // BgpAttributesCustomCommunity is user defined COMMUNITY attribute containing 2 byte AS and custom 2 byte value defined by the administrator of the domain. + SetCustomCommunity(value BgpAttributesCustomCommunity) BgpAttributesCommunity + // HasCustomCommunity checks if CustomCommunity has been set in BgpAttributesCommunity + HasCustomCommunity() bool + setNil() +} + +type BgpAttributesCommunityChoiceEnum string + +// Enum of Choice on BgpAttributesCommunity +var BgpAttributesCommunityChoice = struct { + CUSTOM_COMMUNITY BgpAttributesCommunityChoiceEnum + NO_EXPORT BgpAttributesCommunityChoiceEnum + NO_ADVERTISED BgpAttributesCommunityChoiceEnum + NO_EXPORT_SUBCONFED BgpAttributesCommunityChoiceEnum + LLGR_STALE BgpAttributesCommunityChoiceEnum + NO_LLGR BgpAttributesCommunityChoiceEnum +}{ + CUSTOM_COMMUNITY: BgpAttributesCommunityChoiceEnum("custom_community"), + NO_EXPORT: BgpAttributesCommunityChoiceEnum("no_export"), + NO_ADVERTISED: BgpAttributesCommunityChoiceEnum("no_advertised"), + NO_EXPORT_SUBCONFED: BgpAttributesCommunityChoiceEnum("no_export_subconfed"), + LLGR_STALE: BgpAttributesCommunityChoiceEnum("llgr_stale"), + NO_LLGR: BgpAttributesCommunityChoiceEnum("no_llgr"), +} + +func (obj *bgpAttributesCommunity) Choice() BgpAttributesCommunityChoiceEnum { + return BgpAttributesCommunityChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// 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 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 NoExport to set choice +func (obj *bgpAttributesCommunity) NoExport() { + obj.setChoice(BgpAttributesCommunityChoice.NO_EXPORT) +} + +func (obj *bgpAttributesCommunity) setChoice(value BgpAttributesCommunityChoiceEnum) BgpAttributesCommunity { + intValue, ok := otg.BgpAttributesCommunity_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAttributesCommunityChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpAttributesCommunity_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.CustomCommunity = nil + obj.customCommunityHolder = nil + + if value == BgpAttributesCommunityChoice.CUSTOM_COMMUNITY { + obj.obj.CustomCommunity = NewBgpAttributesCustomCommunity().msg() + } + + return obj +} + +// description is TBD +// CustomCommunity returns a BgpAttributesCustomCommunity +func (obj *bgpAttributesCommunity) CustomCommunity() BgpAttributesCustomCommunity { + if obj.obj.CustomCommunity == nil { + obj.setChoice(BgpAttributesCommunityChoice.CUSTOM_COMMUNITY) + } + if obj.customCommunityHolder == nil { + obj.customCommunityHolder = &bgpAttributesCustomCommunity{obj: obj.obj.CustomCommunity} + } + return obj.customCommunityHolder +} + +// description is TBD +// CustomCommunity returns a BgpAttributesCustomCommunity +func (obj *bgpAttributesCommunity) HasCustomCommunity() bool { + return obj.obj.CustomCommunity != nil +} + +// description is TBD +// SetCustomCommunity sets the BgpAttributesCustomCommunity value in the BgpAttributesCommunity object +func (obj *bgpAttributesCommunity) SetCustomCommunity(value BgpAttributesCustomCommunity) BgpAttributesCommunity { + obj.setChoice(BgpAttributesCommunityChoice.CUSTOM_COMMUNITY) + obj.customCommunityHolder = nil + obj.obj.CustomCommunity = value.msg() + + return obj +} + +func (obj *bgpAttributesCommunity) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface BgpAttributesCommunity") + } + + if obj.obj.CustomCommunity != nil { + + obj.CustomCommunity().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesCommunity) setDefault() { + var choices_set int = 0 + var choice BgpAttributesCommunityChoiceEnum + + if obj.obj.CustomCommunity != nil { + choices_set += 1 + choice = BgpAttributesCommunityChoice.CUSTOM_COMMUNITY + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesCommunity") + } + } else { + intVal := otg.BgpAttributesCommunity_Choice_Enum_value[string(choice)] + enumValue := otg.BgpAttributesCommunity_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_attributes_custom_community.go b/gosnappi/bgp_attributes_custom_community.go new file mode 100644 index 00000000..e9d149be --- /dev/null +++ b/gosnappi/bgp_attributes_custom_community.go @@ -0,0 +1,362 @@ +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" +) + +// ***** BgpAttributesCustomCommunity ***** +type bgpAttributesCustomCommunity struct { + validation + obj *otg.BgpAttributesCustomCommunity + marshaller marshalBgpAttributesCustomCommunity + unMarshaller unMarshalBgpAttributesCustomCommunity +} + +func NewBgpAttributesCustomCommunity() BgpAttributesCustomCommunity { + obj := bgpAttributesCustomCommunity{obj: &otg.BgpAttributesCustomCommunity{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesCustomCommunity) msg() *otg.BgpAttributesCustomCommunity { + return obj.obj +} + +func (obj *bgpAttributesCustomCommunity) setMsg(msg *otg.BgpAttributesCustomCommunity) BgpAttributesCustomCommunity { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesCustomCommunity struct { + obj *bgpAttributesCustomCommunity +} + +type marshalBgpAttributesCustomCommunity interface { + // ToProto marshals BgpAttributesCustomCommunity to protobuf object *otg.BgpAttributesCustomCommunity + ToProto() (*otg.BgpAttributesCustomCommunity, error) + // ToPbText marshals BgpAttributesCustomCommunity to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesCustomCommunity to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesCustomCommunity to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesCustomCommunity struct { + obj *bgpAttributesCustomCommunity +} + +type unMarshalBgpAttributesCustomCommunity interface { + // FromProto unmarshals BgpAttributesCustomCommunity from protobuf object *otg.BgpAttributesCustomCommunity + FromProto(msg *otg.BgpAttributesCustomCommunity) (BgpAttributesCustomCommunity, error) + // FromPbText unmarshals BgpAttributesCustomCommunity from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesCustomCommunity from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesCustomCommunity from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesCustomCommunity) Marshal() marshalBgpAttributesCustomCommunity { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesCustomCommunity{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesCustomCommunity) Unmarshal() unMarshalBgpAttributesCustomCommunity { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesCustomCommunity{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesCustomCommunity) ToProto() (*otg.BgpAttributesCustomCommunity, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesCustomCommunity) FromProto(msg *otg.BgpAttributesCustomCommunity) (BgpAttributesCustomCommunity, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesCustomCommunity) 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 *unMarshalbgpAttributesCustomCommunity) 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 *marshalbgpAttributesCustomCommunity) 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 *unMarshalbgpAttributesCustomCommunity) 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 *marshalbgpAttributesCustomCommunity) 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 *unMarshalbgpAttributesCustomCommunity) 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 *bgpAttributesCustomCommunity) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesCustomCommunity) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesCustomCommunity) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesCustomCommunity) Clone() (BgpAttributesCustomCommunity, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesCustomCommunity() + 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 +} + +// BgpAttributesCustomCommunity is user defined COMMUNITY attribute containing 2 byte AS and custom 2 byte value defined by the administrator of the domain. +type BgpAttributesCustomCommunity interface { + Validation + // msg marshals BgpAttributesCustomCommunity to protobuf object *otg.BgpAttributesCustomCommunity + // and doesn't set defaults + msg() *otg.BgpAttributesCustomCommunity + // setMsg unmarshals BgpAttributesCustomCommunity from protobuf object *otg.BgpAttributesCustomCommunity + // and doesn't set defaults + setMsg(*otg.BgpAttributesCustomCommunity) BgpAttributesCustomCommunity + // provides marshal interface + Marshal() marshalBgpAttributesCustomCommunity + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesCustomCommunity + // validate validates BgpAttributesCustomCommunity + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesCustomCommunity, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // AsNumber returns uint32, set in BgpAttributesCustomCommunity. + AsNumber() uint32 + // SetAsNumber assigns uint32 provided by user to BgpAttributesCustomCommunity + SetAsNumber(value uint32) BgpAttributesCustomCommunity + // HasAsNumber checks if AsNumber has been set in BgpAttributesCustomCommunity + HasAsNumber() bool + // Custom returns string, set in BgpAttributesCustomCommunity. + Custom() string + // SetCustom assigns string provided by user to BgpAttributesCustomCommunity + SetCustom(value string) BgpAttributesCustomCommunity + // HasCustom checks if Custom has been set in BgpAttributesCustomCommunity + HasCustom() bool +} + +// First two octets of the community value containing a 2 byte AS number. +// AsNumber returns a uint32 +func (obj *bgpAttributesCustomCommunity) AsNumber() uint32 { + + return *obj.obj.AsNumber + +} + +// First two octets of the community value containing a 2 byte AS number. +// AsNumber returns a uint32 +func (obj *bgpAttributesCustomCommunity) HasAsNumber() bool { + return obj.obj.AsNumber != nil +} + +// First two octets of the community value containing a 2 byte AS number. +// SetAsNumber sets the uint32 value in the BgpAttributesCustomCommunity object +func (obj *bgpAttributesCustomCommunity) SetAsNumber(value uint32) BgpAttributesCustomCommunity { + + obj.obj.AsNumber = &value + return obj +} + +// Last two octets of the community value in hex. If user provides less than 4 hex bytes, it should be left-padded with 0s. +// Custom returns a string +func (obj *bgpAttributesCustomCommunity) Custom() string { + + return *obj.obj.Custom + +} + +// Last two octets of the community value in hex. If user provides less than 4 hex bytes, it should be left-padded with 0s. +// Custom returns a string +func (obj *bgpAttributesCustomCommunity) HasCustom() bool { + return obj.obj.Custom != nil +} + +// Last two octets of the community value in hex. If user provides less than 4 hex bytes, it should be left-padded with 0s. +// SetCustom sets the string value in the BgpAttributesCustomCommunity object +func (obj *bgpAttributesCustomCommunity) SetCustom(value string) BgpAttributesCustomCommunity { + + obj.obj.Custom = &value + return obj +} + +func (obj *bgpAttributesCustomCommunity) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.AsNumber != nil { + + if *obj.obj.AsNumber > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesCustomCommunity.AsNumber <= 65535 but Got %d", *obj.obj.AsNumber)) + } + + } + + if obj.obj.Custom != nil { + + if len(*obj.obj.Custom) > 4 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "None <= length of BgpAttributesCustomCommunity.Custom <= 4 but Got %d", + len(*obj.obj.Custom))) + } + + } + +} + +func (obj *bgpAttributesCustomCommunity) setDefault() { + if obj.obj.AsNumber == nil { + obj.SetAsNumber(0) + } + if obj.obj.Custom == nil { + obj.SetCustom("0000") + } + +} diff --git a/gosnappi/bgp_attributes_four_byte_as_path_segment.go b/gosnappi/bgp_attributes_four_byte_as_path_segment.go new file mode 100644 index 00000000..36e5c6f3 --- /dev/null +++ b/gosnappi/bgp_attributes_four_byte_as_path_segment.go @@ -0,0 +1,361 @@ +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" +) + +// ***** BgpAttributesFourByteAsPathSegment ***** +type bgpAttributesFourByteAsPathSegment struct { + validation + obj *otg.BgpAttributesFourByteAsPathSegment + marshaller marshalBgpAttributesFourByteAsPathSegment + unMarshaller unMarshalBgpAttributesFourByteAsPathSegment +} + +func NewBgpAttributesFourByteAsPathSegment() BgpAttributesFourByteAsPathSegment { + obj := bgpAttributesFourByteAsPathSegment{obj: &otg.BgpAttributesFourByteAsPathSegment{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesFourByteAsPathSegment) msg() *otg.BgpAttributesFourByteAsPathSegment { + return obj.obj +} + +func (obj *bgpAttributesFourByteAsPathSegment) setMsg(msg *otg.BgpAttributesFourByteAsPathSegment) BgpAttributesFourByteAsPathSegment { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesFourByteAsPathSegment struct { + obj *bgpAttributesFourByteAsPathSegment +} + +type marshalBgpAttributesFourByteAsPathSegment interface { + // ToProto marshals BgpAttributesFourByteAsPathSegment to protobuf object *otg.BgpAttributesFourByteAsPathSegment + ToProto() (*otg.BgpAttributesFourByteAsPathSegment, error) + // ToPbText marshals BgpAttributesFourByteAsPathSegment to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesFourByteAsPathSegment to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesFourByteAsPathSegment to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesFourByteAsPathSegment struct { + obj *bgpAttributesFourByteAsPathSegment +} + +type unMarshalBgpAttributesFourByteAsPathSegment interface { + // FromProto unmarshals BgpAttributesFourByteAsPathSegment from protobuf object *otg.BgpAttributesFourByteAsPathSegment + FromProto(msg *otg.BgpAttributesFourByteAsPathSegment) (BgpAttributesFourByteAsPathSegment, error) + // FromPbText unmarshals BgpAttributesFourByteAsPathSegment from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesFourByteAsPathSegment from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesFourByteAsPathSegment from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesFourByteAsPathSegment) Marshal() marshalBgpAttributesFourByteAsPathSegment { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesFourByteAsPathSegment{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesFourByteAsPathSegment) Unmarshal() unMarshalBgpAttributesFourByteAsPathSegment { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesFourByteAsPathSegment{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesFourByteAsPathSegment) ToProto() (*otg.BgpAttributesFourByteAsPathSegment, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesFourByteAsPathSegment) FromProto(msg *otg.BgpAttributesFourByteAsPathSegment) (BgpAttributesFourByteAsPathSegment, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesFourByteAsPathSegment) 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 *unMarshalbgpAttributesFourByteAsPathSegment) 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 *marshalbgpAttributesFourByteAsPathSegment) 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 *unMarshalbgpAttributesFourByteAsPathSegment) 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 *marshalbgpAttributesFourByteAsPathSegment) 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 *unMarshalbgpAttributesFourByteAsPathSegment) 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 *bgpAttributesFourByteAsPathSegment) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesFourByteAsPathSegment) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesFourByteAsPathSegment) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesFourByteAsPathSegment) Clone() (BgpAttributesFourByteAsPathSegment, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesFourByteAsPathSegment() + 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 +} + +// BgpAttributesFourByteAsPathSegment is configuration for a single BGP AS path segment containing 4 byte AS numbers. +type BgpAttributesFourByteAsPathSegment interface { + Validation + // msg marshals BgpAttributesFourByteAsPathSegment to protobuf object *otg.BgpAttributesFourByteAsPathSegment + // and doesn't set defaults + msg() *otg.BgpAttributesFourByteAsPathSegment + // setMsg unmarshals BgpAttributesFourByteAsPathSegment from protobuf object *otg.BgpAttributesFourByteAsPathSegment + // and doesn't set defaults + setMsg(*otg.BgpAttributesFourByteAsPathSegment) BgpAttributesFourByteAsPathSegment + // provides marshal interface + Marshal() marshalBgpAttributesFourByteAsPathSegment + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesFourByteAsPathSegment + // validate validates BgpAttributesFourByteAsPathSegment + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesFourByteAsPathSegment, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Type returns BgpAttributesFourByteAsPathSegmentTypeEnum, set in BgpAttributesFourByteAsPathSegment + Type() BgpAttributesFourByteAsPathSegmentTypeEnum + // SetType assigns BgpAttributesFourByteAsPathSegmentTypeEnum provided by user to BgpAttributesFourByteAsPathSegment + SetType(value BgpAttributesFourByteAsPathSegmentTypeEnum) BgpAttributesFourByteAsPathSegment + // HasType checks if Type has been set in BgpAttributesFourByteAsPathSegment + HasType() bool + // AsNumbers returns []uint32, set in BgpAttributesFourByteAsPathSegment. + AsNumbers() []uint32 + // SetAsNumbers assigns []uint32 provided by user to BgpAttributesFourByteAsPathSegment + SetAsNumbers(value []uint32) BgpAttributesFourByteAsPathSegment +} + +type BgpAttributesFourByteAsPathSegmentTypeEnum string + +// Enum of Type on BgpAttributesFourByteAsPathSegment +var BgpAttributesFourByteAsPathSegmentType = struct { + AS_SEQ BgpAttributesFourByteAsPathSegmentTypeEnum + AS_SET BgpAttributesFourByteAsPathSegmentTypeEnum + AS_CONFED_SEQ BgpAttributesFourByteAsPathSegmentTypeEnum + AS_CONFED_SET BgpAttributesFourByteAsPathSegmentTypeEnum +}{ + AS_SEQ: BgpAttributesFourByteAsPathSegmentTypeEnum("as_seq"), + AS_SET: BgpAttributesFourByteAsPathSegmentTypeEnum("as_set"), + AS_CONFED_SEQ: BgpAttributesFourByteAsPathSegmentTypeEnum("as_confed_seq"), + AS_CONFED_SET: BgpAttributesFourByteAsPathSegmentTypeEnum("as_confed_set"), +} + +func (obj *bgpAttributesFourByteAsPathSegment) Type() BgpAttributesFourByteAsPathSegmentTypeEnum { + return BgpAttributesFourByteAsPathSegmentTypeEnum(obj.obj.Type.Enum().String()) +} + +// AS sequence is the most common type of AS_PATH, it contains the list +// of ASNs starting with the most recent ASN being added read from left +// to right. +// The other three AS_PATH types are used for Confederations +// - AS_SET is the type of AS_PATH attribute that summarizes routes using +// using the aggregate-address command, allowing AS_PATHs to be summarized +// in the update as well. +// - AS_CONFED_SEQ gives the list of ASNs in the path starting with the most +// recent ASN to be added reading left to right +// - AS_CONFED_SET will allow summarization of multiple AS PATHs to be sent +// in BGP Updates. +// Type returns a string +func (obj *bgpAttributesFourByteAsPathSegment) HasType() bool { + return obj.obj.Type != nil +} + +func (obj *bgpAttributesFourByteAsPathSegment) SetType(value BgpAttributesFourByteAsPathSegmentTypeEnum) BgpAttributesFourByteAsPathSegment { + intValue, ok := otg.BgpAttributesFourByteAsPathSegment_Type_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAttributesFourByteAsPathSegmentTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpAttributesFourByteAsPathSegment_Type_Enum(intValue) + obj.obj.Type = &enumValue + + return obj +} + +// The 4 byte AS numbers in this AS path segment. +// AsNumbers returns a []uint32 +func (obj *bgpAttributesFourByteAsPathSegment) AsNumbers() []uint32 { + if obj.obj.AsNumbers == nil { + obj.obj.AsNumbers = make([]uint32, 0) + } + return obj.obj.AsNumbers +} + +// The 4 byte AS numbers in this AS path segment. +// SetAsNumbers sets the []uint32 value in the BgpAttributesFourByteAsPathSegment object +func (obj *bgpAttributesFourByteAsPathSegment) SetAsNumbers(value []uint32) BgpAttributesFourByteAsPathSegment { + + if obj.obj.AsNumbers == nil { + obj.obj.AsNumbers = make([]uint32, 0) + } + obj.obj.AsNumbers = value + + return obj +} + +func (obj *bgpAttributesFourByteAsPathSegment) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpAttributesFourByteAsPathSegment) setDefault() { + if obj.obj.Type == nil { + obj.SetType(BgpAttributesFourByteAsPathSegmentType.AS_SEQ) + + } + +} diff --git a/gosnappi/bgp_attributes_local_preference.go b/gosnappi/bgp_attributes_local_preference.go new file mode 100644 index 00000000..a88f465c --- /dev/null +++ b/gosnappi/bgp_attributes_local_preference.go @@ -0,0 +1,312 @@ +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" +) + +// ***** BgpAttributesLocalPreference ***** +type bgpAttributesLocalPreference struct { + validation + obj *otg.BgpAttributesLocalPreference + marshaller marshalBgpAttributesLocalPreference + unMarshaller unMarshalBgpAttributesLocalPreference +} + +func NewBgpAttributesLocalPreference() BgpAttributesLocalPreference { + obj := bgpAttributesLocalPreference{obj: &otg.BgpAttributesLocalPreference{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesLocalPreference) msg() *otg.BgpAttributesLocalPreference { + return obj.obj +} + +func (obj *bgpAttributesLocalPreference) setMsg(msg *otg.BgpAttributesLocalPreference) BgpAttributesLocalPreference { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesLocalPreference struct { + obj *bgpAttributesLocalPreference +} + +type marshalBgpAttributesLocalPreference interface { + // ToProto marshals BgpAttributesLocalPreference to protobuf object *otg.BgpAttributesLocalPreference + ToProto() (*otg.BgpAttributesLocalPreference, error) + // ToPbText marshals BgpAttributesLocalPreference to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesLocalPreference to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesLocalPreference to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesLocalPreference struct { + obj *bgpAttributesLocalPreference +} + +type unMarshalBgpAttributesLocalPreference interface { + // FromProto unmarshals BgpAttributesLocalPreference from protobuf object *otg.BgpAttributesLocalPreference + FromProto(msg *otg.BgpAttributesLocalPreference) (BgpAttributesLocalPreference, error) + // FromPbText unmarshals BgpAttributesLocalPreference from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesLocalPreference from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesLocalPreference from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesLocalPreference) Marshal() marshalBgpAttributesLocalPreference { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesLocalPreference{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesLocalPreference) Unmarshal() unMarshalBgpAttributesLocalPreference { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesLocalPreference{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesLocalPreference) ToProto() (*otg.BgpAttributesLocalPreference, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesLocalPreference) FromProto(msg *otg.BgpAttributesLocalPreference) (BgpAttributesLocalPreference, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesLocalPreference) 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 *unMarshalbgpAttributesLocalPreference) 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 *marshalbgpAttributesLocalPreference) 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 *unMarshalbgpAttributesLocalPreference) 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 *marshalbgpAttributesLocalPreference) 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 *unMarshalbgpAttributesLocalPreference) 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 *bgpAttributesLocalPreference) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesLocalPreference) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesLocalPreference) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesLocalPreference) Clone() (BgpAttributesLocalPreference, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesLocalPreference() + 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 +} + +// BgpAttributesLocalPreference is optional LOCAL_PREFERENCE attribute sent to the peer to indicate the degree of preference +// for externally learned routes.This should be included only for internal peers.It is +// used for the selection of the path for the traffic leaving the AS.The route with the +// highest local preference value is preferred. +type BgpAttributesLocalPreference interface { + Validation + // msg marshals BgpAttributesLocalPreference to protobuf object *otg.BgpAttributesLocalPreference + // and doesn't set defaults + msg() *otg.BgpAttributesLocalPreference + // setMsg unmarshals BgpAttributesLocalPreference from protobuf object *otg.BgpAttributesLocalPreference + // and doesn't set defaults + setMsg(*otg.BgpAttributesLocalPreference) BgpAttributesLocalPreference + // provides marshal interface + Marshal() marshalBgpAttributesLocalPreference + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesLocalPreference + // validate validates BgpAttributesLocalPreference + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesLocalPreference, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Value returns uint32, set in BgpAttributesLocalPreference. + Value() uint32 + // SetValue assigns uint32 provided by user to BgpAttributesLocalPreference + SetValue(value uint32) BgpAttributesLocalPreference + // HasValue checks if Value has been set in BgpAttributesLocalPreference + HasValue() bool +} + +// Value to be set in the LOCAL_PREFERENCE attribute The multi exit discriminator (MED) value used for route selection sent to the peer. +// Value returns a uint32 +func (obj *bgpAttributesLocalPreference) Value() uint32 { + + return *obj.obj.Value + +} + +// Value to be set in the LOCAL_PREFERENCE attribute The multi exit discriminator (MED) value used for route selection sent to the peer. +// Value returns a uint32 +func (obj *bgpAttributesLocalPreference) HasValue() bool { + return obj.obj.Value != nil +} + +// Value to be set in the LOCAL_PREFERENCE attribute The multi exit discriminator (MED) value used for route selection sent to the peer. +// SetValue sets the uint32 value in the BgpAttributesLocalPreference object +func (obj *bgpAttributesLocalPreference) SetValue(value uint32) BgpAttributesLocalPreference { + + obj.obj.Value = &value + return obj +} + +func (obj *bgpAttributesLocalPreference) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpAttributesLocalPreference) setDefault() { + if obj.obj.Value == nil { + obj.SetValue(100) + } + +} diff --git a/gosnappi/bgp_attributes_mp_reach_nlri.go b/gosnappi/bgp_attributes_mp_reach_nlri.go new file mode 100644 index 00000000..61c82272 --- /dev/null +++ b/gosnappi/bgp_attributes_mp_reach_nlri.go @@ -0,0 +1,727 @@ +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" +) + +// ***** BgpAttributesMpReachNlri ***** +type bgpAttributesMpReachNlri struct { + validation + obj *otg.BgpAttributesMpReachNlri + marshaller marshalBgpAttributesMpReachNlri + unMarshaller unMarshalBgpAttributesMpReachNlri + nextHopHolder BgpAttributesNextHop + ipv4UnicastHolder BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter + ipv6UnicastHolder BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter + ipv4SrpolicyHolder BgpIpv4SrPolicyNLRIPrefix + ipv6SrpolicyHolder BgpIpv6SrPolicyNLRIPrefix +} + +func NewBgpAttributesMpReachNlri() BgpAttributesMpReachNlri { + obj := bgpAttributesMpReachNlri{obj: &otg.BgpAttributesMpReachNlri{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesMpReachNlri) msg() *otg.BgpAttributesMpReachNlri { + return obj.obj +} + +func (obj *bgpAttributesMpReachNlri) setMsg(msg *otg.BgpAttributesMpReachNlri) BgpAttributesMpReachNlri { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesMpReachNlri struct { + obj *bgpAttributesMpReachNlri +} + +type marshalBgpAttributesMpReachNlri interface { + // ToProto marshals BgpAttributesMpReachNlri to protobuf object *otg.BgpAttributesMpReachNlri + ToProto() (*otg.BgpAttributesMpReachNlri, error) + // ToPbText marshals BgpAttributesMpReachNlri to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesMpReachNlri to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesMpReachNlri to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesMpReachNlri struct { + obj *bgpAttributesMpReachNlri +} + +type unMarshalBgpAttributesMpReachNlri interface { + // FromProto unmarshals BgpAttributesMpReachNlri from protobuf object *otg.BgpAttributesMpReachNlri + FromProto(msg *otg.BgpAttributesMpReachNlri) (BgpAttributesMpReachNlri, error) + // FromPbText unmarshals BgpAttributesMpReachNlri from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesMpReachNlri from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesMpReachNlri from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesMpReachNlri) Marshal() marshalBgpAttributesMpReachNlri { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesMpReachNlri{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesMpReachNlri) Unmarshal() unMarshalBgpAttributesMpReachNlri { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesMpReachNlri{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesMpReachNlri) ToProto() (*otg.BgpAttributesMpReachNlri, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesMpReachNlri) FromProto(msg *otg.BgpAttributesMpReachNlri) (BgpAttributesMpReachNlri, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesMpReachNlri) 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 *unMarshalbgpAttributesMpReachNlri) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesMpReachNlri) 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 *unMarshalbgpAttributesMpReachNlri) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesMpReachNlri) 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 *unMarshalbgpAttributesMpReachNlri) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesMpReachNlri) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesMpReachNlri) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesMpReachNlri) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesMpReachNlri) Clone() (BgpAttributesMpReachNlri, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesMpReachNlri() + 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 +} + +func (obj *bgpAttributesMpReachNlri) setNil() { + obj.nextHopHolder = nil + obj.ipv4UnicastHolder = nil + obj.ipv6UnicastHolder = nil + obj.ipv4SrpolicyHolder = nil + obj.ipv6SrpolicyHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesMpReachNlri is the MP_REACH attribute is an optional attribute which can be included in the attributes of a BGP Update message as defined in https://datatracker.ietf.org/doc/html/rfc4760#section-3. +// The following AFI / SAFI combinations are supported: +// - IPv4 Unicast with AFI as 1 and SAFI as 1 +// - IPv6 Unicast with AFI as 2 and SAFI as 1 +// - Segment Routing Policy for IPv4 Unicast with AFI as 1 and SAFI as 73 ( draft-ietf-idr-sr-policy-safi-02 Section 2.1 ) +// - Segment Routing Policy for IPv6 Unicast with AFI as 2 and SAFI as 73 +type BgpAttributesMpReachNlri interface { + Validation + // msg marshals BgpAttributesMpReachNlri to protobuf object *otg.BgpAttributesMpReachNlri + // and doesn't set defaults + msg() *otg.BgpAttributesMpReachNlri + // setMsg unmarshals BgpAttributesMpReachNlri from protobuf object *otg.BgpAttributesMpReachNlri + // and doesn't set defaults + setMsg(*otg.BgpAttributesMpReachNlri) BgpAttributesMpReachNlri + // provides marshal interface + Marshal() marshalBgpAttributesMpReachNlri + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesMpReachNlri + // validate validates BgpAttributesMpReachNlri + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesMpReachNlri, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // NextHop returns BgpAttributesNextHop, set in BgpAttributesMpReachNlri. + // BgpAttributesNextHop is next hop to be sent inside MP_REACH NLRI or as the NEXT_HOP attribute if advertised as traditional NLRI. + NextHop() BgpAttributesNextHop + // SetNextHop assigns BgpAttributesNextHop provided by user to BgpAttributesMpReachNlri. + // BgpAttributesNextHop is next hop to be sent inside MP_REACH NLRI or as the NEXT_HOP attribute if advertised as traditional NLRI. + SetNextHop(value BgpAttributesNextHop) BgpAttributesMpReachNlri + // HasNextHop checks if NextHop has been set in BgpAttributesMpReachNlri + HasNextHop() bool + // Choice returns BgpAttributesMpReachNlriChoiceEnum, set in BgpAttributesMpReachNlri + Choice() BgpAttributesMpReachNlriChoiceEnum + // setChoice assigns BgpAttributesMpReachNlriChoiceEnum provided by user to BgpAttributesMpReachNlri + setChoice(value BgpAttributesMpReachNlriChoiceEnum) BgpAttributesMpReachNlri + // Ipv4Unicast returns BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIterIter, set in BgpAttributesMpReachNlri + Ipv4Unicast() BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter + // Ipv6Unicast returns BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIterIter, set in BgpAttributesMpReachNlri + Ipv6Unicast() BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter + // Ipv4Srpolicy returns BgpIpv4SrPolicyNLRIPrefix, set in BgpAttributesMpReachNlri. + // BgpIpv4SrPolicyNLRIPrefix is iPv4 Segment Routing Policy NLRI Prefix. + Ipv4Srpolicy() BgpIpv4SrPolicyNLRIPrefix + // SetIpv4Srpolicy assigns BgpIpv4SrPolicyNLRIPrefix provided by user to BgpAttributesMpReachNlri. + // BgpIpv4SrPolicyNLRIPrefix is iPv4 Segment Routing Policy NLRI Prefix. + SetIpv4Srpolicy(value BgpIpv4SrPolicyNLRIPrefix) BgpAttributesMpReachNlri + // HasIpv4Srpolicy checks if Ipv4Srpolicy has been set in BgpAttributesMpReachNlri + HasIpv4Srpolicy() bool + // Ipv6Srpolicy returns BgpIpv6SrPolicyNLRIPrefix, set in BgpAttributesMpReachNlri. + // BgpIpv6SrPolicyNLRIPrefix is one IPv6 Segment Routing Policy NLRI Prefix. + Ipv6Srpolicy() BgpIpv6SrPolicyNLRIPrefix + // SetIpv6Srpolicy assigns BgpIpv6SrPolicyNLRIPrefix provided by user to BgpAttributesMpReachNlri. + // BgpIpv6SrPolicyNLRIPrefix is one IPv6 Segment Routing Policy NLRI Prefix. + SetIpv6Srpolicy(value BgpIpv6SrPolicyNLRIPrefix) BgpAttributesMpReachNlri + // HasIpv6Srpolicy checks if Ipv6Srpolicy has been set in BgpAttributesMpReachNlri + HasIpv6Srpolicy() bool + setNil() +} + +// description is TBD +// NextHop returns a BgpAttributesNextHop +func (obj *bgpAttributesMpReachNlri) NextHop() BgpAttributesNextHop { + if obj.obj.NextHop == nil { + obj.obj.NextHop = NewBgpAttributesNextHop().msg() + } + if obj.nextHopHolder == nil { + obj.nextHopHolder = &bgpAttributesNextHop{obj: obj.obj.NextHop} + } + return obj.nextHopHolder +} + +// description is TBD +// NextHop returns a BgpAttributesNextHop +func (obj *bgpAttributesMpReachNlri) HasNextHop() bool { + return obj.obj.NextHop != nil +} + +// description is TBD +// SetNextHop sets the BgpAttributesNextHop value in the BgpAttributesMpReachNlri object +func (obj *bgpAttributesMpReachNlri) SetNextHop(value BgpAttributesNextHop) BgpAttributesMpReachNlri { + + obj.nextHopHolder = nil + obj.obj.NextHop = value.msg() + + return obj +} + +type BgpAttributesMpReachNlriChoiceEnum string + +// Enum of Choice on BgpAttributesMpReachNlri +var BgpAttributesMpReachNlriChoice = struct { + IPV4_UNICAST BgpAttributesMpReachNlriChoiceEnum + IPV6_UNICAST BgpAttributesMpReachNlriChoiceEnum + IPV4_SRPOLICY BgpAttributesMpReachNlriChoiceEnum + IPV6_SRPOLICY BgpAttributesMpReachNlriChoiceEnum +}{ + IPV4_UNICAST: BgpAttributesMpReachNlriChoiceEnum("ipv4_unicast"), + IPV6_UNICAST: BgpAttributesMpReachNlriChoiceEnum("ipv6_unicast"), + IPV4_SRPOLICY: BgpAttributesMpReachNlriChoiceEnum("ipv4_srpolicy"), + IPV6_SRPOLICY: BgpAttributesMpReachNlriChoiceEnum("ipv6_srpolicy"), +} + +func (obj *bgpAttributesMpReachNlri) Choice() BgpAttributesMpReachNlriChoiceEnum { + return BgpAttributesMpReachNlriChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *bgpAttributesMpReachNlri) setChoice(value BgpAttributesMpReachNlriChoiceEnum) BgpAttributesMpReachNlri { + intValue, ok := otg.BgpAttributesMpReachNlri_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAttributesMpReachNlriChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpAttributesMpReachNlri_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Ipv6Srpolicy = nil + obj.ipv6SrpolicyHolder = nil + obj.obj.Ipv4Srpolicy = nil + obj.ipv4SrpolicyHolder = nil + obj.obj.Ipv6Unicast = nil + obj.ipv6UnicastHolder = nil + obj.obj.Ipv4Unicast = nil + obj.ipv4UnicastHolder = nil + + if value == BgpAttributesMpReachNlriChoice.IPV4_UNICAST { + obj.obj.Ipv4Unicast = []*otg.BgpOneIpv4NLRIPrefix{} + } + + if value == BgpAttributesMpReachNlriChoice.IPV6_UNICAST { + obj.obj.Ipv6Unicast = []*otg.BgpOneIpv6NLRIPrefix{} + } + + if value == BgpAttributesMpReachNlriChoice.IPV4_SRPOLICY { + obj.obj.Ipv4Srpolicy = NewBgpIpv4SrPolicyNLRIPrefix().msg() + } + + if value == BgpAttributesMpReachNlriChoice.IPV6_SRPOLICY { + obj.obj.Ipv6Srpolicy = NewBgpIpv6SrPolicyNLRIPrefix().msg() + } + + return obj +} + +// List of IPv4 prefixes being sent in the IPv4 Unicast MPREACH_NLRI . +// Ipv4Unicast returns a []BgpOneIpv4NLRIPrefix +func (obj *bgpAttributesMpReachNlri) Ipv4Unicast() BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { + if len(obj.obj.Ipv4Unicast) == 0 { + obj.setChoice(BgpAttributesMpReachNlriChoice.IPV4_UNICAST) + } + if obj.ipv4UnicastHolder == nil { + obj.ipv4UnicastHolder = newBgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter(&obj.obj.Ipv4Unicast).setMsg(obj) + } + return obj.ipv4UnicastHolder +} + +type bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter struct { + obj *bgpAttributesMpReachNlri + bgpOneIpv4NLRIPrefixSlice []BgpOneIpv4NLRIPrefix + fieldPtr *[]*otg.BgpOneIpv4NLRIPrefix +} + +func newBgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter(ptr *[]*otg.BgpOneIpv4NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { + return &bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter{fieldPtr: ptr} +} + +type BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter interface { + setMsg(*bgpAttributesMpReachNlri) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter + Items() []BgpOneIpv4NLRIPrefix + Add() BgpOneIpv4NLRIPrefix + Append(items ...BgpOneIpv4NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter + Set(index int, newObj BgpOneIpv4NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter + Clear() BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter + clearHolderSlice() BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter + appendHolderSlice(item BgpOneIpv4NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter +} + +func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) setMsg(msg *bgpAttributesMpReachNlri) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpOneIpv4NLRIPrefix{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) Items() []BgpOneIpv4NLRIPrefix { + return obj.bgpOneIpv4NLRIPrefixSlice +} + +func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) Add() BgpOneIpv4NLRIPrefix { + newObj := &otg.BgpOneIpv4NLRIPrefix{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpOneIpv4NLRIPrefix{obj: newObj} + newLibObj.setDefault() + obj.bgpOneIpv4NLRIPrefixSlice = append(obj.bgpOneIpv4NLRIPrefixSlice, newLibObj) + return newLibObj +} + +func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) Append(items ...BgpOneIpv4NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpOneIpv4NLRIPrefixSlice = append(obj.bgpOneIpv4NLRIPrefixSlice, item) + } + return obj +} + +func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) Set(index int, newObj BgpOneIpv4NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpOneIpv4NLRIPrefixSlice[index] = newObj + return obj +} +func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) Clear() BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpOneIpv4NLRIPrefix{} + obj.bgpOneIpv4NLRIPrefixSlice = []BgpOneIpv4NLRIPrefix{} + } + return obj +} +func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) clearHolderSlice() BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { + if len(obj.bgpOneIpv4NLRIPrefixSlice) > 0 { + obj.bgpOneIpv4NLRIPrefixSlice = []BgpOneIpv4NLRIPrefix{} + } + return obj +} +func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) appendHolderSlice(item BgpOneIpv4NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { + obj.bgpOneIpv4NLRIPrefixSlice = append(obj.bgpOneIpv4NLRIPrefixSlice, item) + return obj +} + +// List of IPv6 prefixes being sent in the IPv6 Unicast MPREACH_NLRI . +// Ipv6Unicast returns a []BgpOneIpv6NLRIPrefix +func (obj *bgpAttributesMpReachNlri) Ipv6Unicast() BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { + if len(obj.obj.Ipv6Unicast) == 0 { + obj.setChoice(BgpAttributesMpReachNlriChoice.IPV6_UNICAST) + } + if obj.ipv6UnicastHolder == nil { + obj.ipv6UnicastHolder = newBgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter(&obj.obj.Ipv6Unicast).setMsg(obj) + } + return obj.ipv6UnicastHolder +} + +type bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter struct { + obj *bgpAttributesMpReachNlri + bgpOneIpv6NLRIPrefixSlice []BgpOneIpv6NLRIPrefix + fieldPtr *[]*otg.BgpOneIpv6NLRIPrefix +} + +func newBgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter(ptr *[]*otg.BgpOneIpv6NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { + return &bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter{fieldPtr: ptr} +} + +type BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter interface { + setMsg(*bgpAttributesMpReachNlri) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter + Items() []BgpOneIpv6NLRIPrefix + Add() BgpOneIpv6NLRIPrefix + Append(items ...BgpOneIpv6NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter + Set(index int, newObj BgpOneIpv6NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter + Clear() BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter + clearHolderSlice() BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter + appendHolderSlice(item BgpOneIpv6NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter +} + +func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) setMsg(msg *bgpAttributesMpReachNlri) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpOneIpv6NLRIPrefix{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) Items() []BgpOneIpv6NLRIPrefix { + return obj.bgpOneIpv6NLRIPrefixSlice +} + +func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) Add() BgpOneIpv6NLRIPrefix { + newObj := &otg.BgpOneIpv6NLRIPrefix{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpOneIpv6NLRIPrefix{obj: newObj} + newLibObj.setDefault() + obj.bgpOneIpv6NLRIPrefixSlice = append(obj.bgpOneIpv6NLRIPrefixSlice, newLibObj) + return newLibObj +} + +func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) Append(items ...BgpOneIpv6NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpOneIpv6NLRIPrefixSlice = append(obj.bgpOneIpv6NLRIPrefixSlice, item) + } + return obj +} + +func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) Set(index int, newObj BgpOneIpv6NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpOneIpv6NLRIPrefixSlice[index] = newObj + return obj +} +func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) Clear() BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpOneIpv6NLRIPrefix{} + obj.bgpOneIpv6NLRIPrefixSlice = []BgpOneIpv6NLRIPrefix{} + } + return obj +} +func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) clearHolderSlice() BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { + if len(obj.bgpOneIpv6NLRIPrefixSlice) > 0 { + obj.bgpOneIpv6NLRIPrefixSlice = []BgpOneIpv6NLRIPrefix{} + } + return obj +} +func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) appendHolderSlice(item BgpOneIpv6NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { + obj.bgpOneIpv6NLRIPrefixSlice = append(obj.bgpOneIpv6NLRIPrefixSlice, item) + return obj +} + +// IPv4 endpoint with Segment Routing Policy being sent in the IPv4 MPREACH_NLRI . +// Ipv4Srpolicy returns a BgpIpv4SrPolicyNLRIPrefix +func (obj *bgpAttributesMpReachNlri) Ipv4Srpolicy() BgpIpv4SrPolicyNLRIPrefix { + if obj.obj.Ipv4Srpolicy == nil { + obj.setChoice(BgpAttributesMpReachNlriChoice.IPV4_SRPOLICY) + } + if obj.ipv4SrpolicyHolder == nil { + obj.ipv4SrpolicyHolder = &bgpIpv4SrPolicyNLRIPrefix{obj: obj.obj.Ipv4Srpolicy} + } + return obj.ipv4SrpolicyHolder +} + +// IPv4 endpoint with Segment Routing Policy being sent in the IPv4 MPREACH_NLRI . +// Ipv4Srpolicy returns a BgpIpv4SrPolicyNLRIPrefix +func (obj *bgpAttributesMpReachNlri) HasIpv4Srpolicy() bool { + return obj.obj.Ipv4Srpolicy != nil +} + +// IPv4 endpoint with Segment Routing Policy being sent in the IPv4 MPREACH_NLRI . +// SetIpv4Srpolicy sets the BgpIpv4SrPolicyNLRIPrefix value in the BgpAttributesMpReachNlri object +func (obj *bgpAttributesMpReachNlri) SetIpv4Srpolicy(value BgpIpv4SrPolicyNLRIPrefix) BgpAttributesMpReachNlri { + obj.setChoice(BgpAttributesMpReachNlriChoice.IPV4_SRPOLICY) + obj.ipv4SrpolicyHolder = nil + obj.obj.Ipv4Srpolicy = value.msg() + + return obj +} + +// IPv6 endpoint with Segment Routing Policy being sent in the IPv6 MPREACH_NLRI . +// Ipv6Srpolicy returns a BgpIpv6SrPolicyNLRIPrefix +func (obj *bgpAttributesMpReachNlri) Ipv6Srpolicy() BgpIpv6SrPolicyNLRIPrefix { + if obj.obj.Ipv6Srpolicy == nil { + obj.setChoice(BgpAttributesMpReachNlriChoice.IPV6_SRPOLICY) + } + if obj.ipv6SrpolicyHolder == nil { + obj.ipv6SrpolicyHolder = &bgpIpv6SrPolicyNLRIPrefix{obj: obj.obj.Ipv6Srpolicy} + } + return obj.ipv6SrpolicyHolder +} + +// IPv6 endpoint with Segment Routing Policy being sent in the IPv6 MPREACH_NLRI . +// Ipv6Srpolicy returns a BgpIpv6SrPolicyNLRIPrefix +func (obj *bgpAttributesMpReachNlri) HasIpv6Srpolicy() bool { + return obj.obj.Ipv6Srpolicy != nil +} + +// IPv6 endpoint with Segment Routing Policy being sent in the IPv6 MPREACH_NLRI . +// SetIpv6Srpolicy sets the BgpIpv6SrPolicyNLRIPrefix value in the BgpAttributesMpReachNlri object +func (obj *bgpAttributesMpReachNlri) SetIpv6Srpolicy(value BgpIpv6SrPolicyNLRIPrefix) BgpAttributesMpReachNlri { + obj.setChoice(BgpAttributesMpReachNlriChoice.IPV6_SRPOLICY) + obj.ipv6SrpolicyHolder = nil + obj.obj.Ipv6Srpolicy = value.msg() + + return obj +} + +func (obj *bgpAttributesMpReachNlri) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.NextHop != nil { + + obj.NextHop().validateObj(vObj, set_default) + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface BgpAttributesMpReachNlri") + } + + if len(obj.obj.Ipv4Unicast) != 0 { + + if set_default { + obj.Ipv4Unicast().clearHolderSlice() + for _, item := range obj.obj.Ipv4Unicast { + obj.Ipv4Unicast().appendHolderSlice(&bgpOneIpv4NLRIPrefix{obj: item}) + } + } + for _, item := range obj.Ipv4Unicast().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Ipv6Unicast) != 0 { + + if set_default { + obj.Ipv6Unicast().clearHolderSlice() + for _, item := range obj.obj.Ipv6Unicast { + obj.Ipv6Unicast().appendHolderSlice(&bgpOneIpv6NLRIPrefix{obj: item}) + } + } + for _, item := range obj.Ipv6Unicast().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Ipv4Srpolicy != nil { + + obj.Ipv4Srpolicy().validateObj(vObj, set_default) + } + + if obj.obj.Ipv6Srpolicy != nil { + + obj.Ipv6Srpolicy().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesMpReachNlri) setDefault() { + var choices_set int = 0 + var choice BgpAttributesMpReachNlriChoiceEnum + + if len(obj.obj.Ipv4Unicast) > 0 { + choices_set += 1 + choice = BgpAttributesMpReachNlriChoice.IPV4_UNICAST + } + + if len(obj.obj.Ipv6Unicast) > 0 { + choices_set += 1 + choice = BgpAttributesMpReachNlriChoice.IPV6_UNICAST + } + + if obj.obj.Ipv4Srpolicy != nil { + choices_set += 1 + choice = BgpAttributesMpReachNlriChoice.IPV4_SRPOLICY + } + + if obj.obj.Ipv6Srpolicy != nil { + choices_set += 1 + choice = BgpAttributesMpReachNlriChoice.IPV6_SRPOLICY + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesMpReachNlri") + } + } else { + intVal := otg.BgpAttributesMpReachNlri_Choice_Enum_value[string(choice)] + enumValue := otg.BgpAttributesMpReachNlri_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_attributes_mp_unreach_nlri.go b/gosnappi/bgp_attributes_mp_unreach_nlri.go new file mode 100644 index 00000000..f3f209d4 --- /dev/null +++ b/gosnappi/bgp_attributes_mp_unreach_nlri.go @@ -0,0 +1,687 @@ +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" +) + +// ***** BgpAttributesMpUnreachNlri ***** +type bgpAttributesMpUnreachNlri struct { + validation + obj *otg.BgpAttributesMpUnreachNlri + marshaller marshalBgpAttributesMpUnreachNlri + unMarshaller unMarshalBgpAttributesMpUnreachNlri + ipv4UnicastHolder BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter + ipv6UnicastHolder BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter + ipv4SrpolicyHolder BgpIpv4SrPolicyNLRIPrefix + ipv6SrpolicyHolder BgpIpv6SrPolicyNLRIPrefix +} + +func NewBgpAttributesMpUnreachNlri() BgpAttributesMpUnreachNlri { + obj := bgpAttributesMpUnreachNlri{obj: &otg.BgpAttributesMpUnreachNlri{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesMpUnreachNlri) msg() *otg.BgpAttributesMpUnreachNlri { + return obj.obj +} + +func (obj *bgpAttributesMpUnreachNlri) setMsg(msg *otg.BgpAttributesMpUnreachNlri) BgpAttributesMpUnreachNlri { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesMpUnreachNlri struct { + obj *bgpAttributesMpUnreachNlri +} + +type marshalBgpAttributesMpUnreachNlri interface { + // ToProto marshals BgpAttributesMpUnreachNlri to protobuf object *otg.BgpAttributesMpUnreachNlri + ToProto() (*otg.BgpAttributesMpUnreachNlri, error) + // ToPbText marshals BgpAttributesMpUnreachNlri to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesMpUnreachNlri to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesMpUnreachNlri to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesMpUnreachNlri struct { + obj *bgpAttributesMpUnreachNlri +} + +type unMarshalBgpAttributesMpUnreachNlri interface { + // FromProto unmarshals BgpAttributesMpUnreachNlri from protobuf object *otg.BgpAttributesMpUnreachNlri + FromProto(msg *otg.BgpAttributesMpUnreachNlri) (BgpAttributesMpUnreachNlri, error) + // FromPbText unmarshals BgpAttributesMpUnreachNlri from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesMpUnreachNlri from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesMpUnreachNlri from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesMpUnreachNlri) Marshal() marshalBgpAttributesMpUnreachNlri { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesMpUnreachNlri{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesMpUnreachNlri) Unmarshal() unMarshalBgpAttributesMpUnreachNlri { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesMpUnreachNlri{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesMpUnreachNlri) ToProto() (*otg.BgpAttributesMpUnreachNlri, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesMpUnreachNlri) FromProto(msg *otg.BgpAttributesMpUnreachNlri) (BgpAttributesMpUnreachNlri, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesMpUnreachNlri) 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 *unMarshalbgpAttributesMpUnreachNlri) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesMpUnreachNlri) 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 *unMarshalbgpAttributesMpUnreachNlri) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesMpUnreachNlri) 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 *unMarshalbgpAttributesMpUnreachNlri) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesMpUnreachNlri) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesMpUnreachNlri) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesMpUnreachNlri) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesMpUnreachNlri) Clone() (BgpAttributesMpUnreachNlri, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesMpUnreachNlri() + 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 +} + +func (obj *bgpAttributesMpUnreachNlri) setNil() { + obj.ipv4UnicastHolder = nil + obj.ipv6UnicastHolder = nil + obj.ipv4SrpolicyHolder = nil + obj.ipv6SrpolicyHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesMpUnreachNlri is the MP_UNREACH attribute is an optional attribute which can be included in the attributes of a BGP Update message as defined in https://datatracker.ietf.org/doc/html/rfc4760#section-3. +// The following AFI / SAFI combinations are supported: +// - IPv4 Unicast with AFI as 1 and SAFI as 1 +// - IPv6 Unicast with AFI as 2 and SAFI as 1 +// - Segment Routing Policy for IPv4 Unicast with AFI as 1 and SAFI as 73 (draft-ietf-idr-sr-policy-safi-02 Section 2.1) +// - Segment Routing Policy for IPv6 Unicast with AFI as 2 and SAFI as 73 +type BgpAttributesMpUnreachNlri interface { + Validation + // msg marshals BgpAttributesMpUnreachNlri to protobuf object *otg.BgpAttributesMpUnreachNlri + // and doesn't set defaults + msg() *otg.BgpAttributesMpUnreachNlri + // setMsg unmarshals BgpAttributesMpUnreachNlri from protobuf object *otg.BgpAttributesMpUnreachNlri + // and doesn't set defaults + setMsg(*otg.BgpAttributesMpUnreachNlri) BgpAttributesMpUnreachNlri + // provides marshal interface + Marshal() marshalBgpAttributesMpUnreachNlri + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesMpUnreachNlri + // validate validates BgpAttributesMpUnreachNlri + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesMpUnreachNlri, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpAttributesMpUnreachNlriChoiceEnum, set in BgpAttributesMpUnreachNlri + Choice() BgpAttributesMpUnreachNlriChoiceEnum + // setChoice assigns BgpAttributesMpUnreachNlriChoiceEnum provided by user to BgpAttributesMpUnreachNlri + setChoice(value BgpAttributesMpUnreachNlriChoiceEnum) BgpAttributesMpUnreachNlri + // HasChoice checks if Choice has been set in BgpAttributesMpUnreachNlri + HasChoice() bool + // Ipv4Unicast returns BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIterIter, set in BgpAttributesMpUnreachNlri + Ipv4Unicast() BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter + // Ipv6Unicast returns BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIterIter, set in BgpAttributesMpUnreachNlri + Ipv6Unicast() BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter + // Ipv4Srpolicy returns BgpIpv4SrPolicyNLRIPrefix, set in BgpAttributesMpUnreachNlri. + // BgpIpv4SrPolicyNLRIPrefix is iPv4 Segment Routing Policy NLRI Prefix. + Ipv4Srpolicy() BgpIpv4SrPolicyNLRIPrefix + // SetIpv4Srpolicy assigns BgpIpv4SrPolicyNLRIPrefix provided by user to BgpAttributesMpUnreachNlri. + // BgpIpv4SrPolicyNLRIPrefix is iPv4 Segment Routing Policy NLRI Prefix. + SetIpv4Srpolicy(value BgpIpv4SrPolicyNLRIPrefix) BgpAttributesMpUnreachNlri + // HasIpv4Srpolicy checks if Ipv4Srpolicy has been set in BgpAttributesMpUnreachNlri + HasIpv4Srpolicy() bool + // Ipv6Srpolicy returns BgpIpv6SrPolicyNLRIPrefix, set in BgpAttributesMpUnreachNlri. + // BgpIpv6SrPolicyNLRIPrefix is one IPv6 Segment Routing Policy NLRI Prefix. + Ipv6Srpolicy() BgpIpv6SrPolicyNLRIPrefix + // SetIpv6Srpolicy assigns BgpIpv6SrPolicyNLRIPrefix provided by user to BgpAttributesMpUnreachNlri. + // BgpIpv6SrPolicyNLRIPrefix is one IPv6 Segment Routing Policy NLRI Prefix. + SetIpv6Srpolicy(value BgpIpv6SrPolicyNLRIPrefix) BgpAttributesMpUnreachNlri + // HasIpv6Srpolicy checks if Ipv6Srpolicy has been set in BgpAttributesMpUnreachNlri + HasIpv6Srpolicy() bool + setNil() +} + +type BgpAttributesMpUnreachNlriChoiceEnum string + +// Enum of Choice on BgpAttributesMpUnreachNlri +var BgpAttributesMpUnreachNlriChoice = struct { + IPV4_UNICAST BgpAttributesMpUnreachNlriChoiceEnum + IPV6_UNICAST BgpAttributesMpUnreachNlriChoiceEnum + IPV4_SRPOLICY BgpAttributesMpUnreachNlriChoiceEnum + IPV6_SRPOLICY BgpAttributesMpUnreachNlriChoiceEnum +}{ + IPV4_UNICAST: BgpAttributesMpUnreachNlriChoiceEnum("ipv4_unicast"), + IPV6_UNICAST: BgpAttributesMpUnreachNlriChoiceEnum("ipv6_unicast"), + IPV4_SRPOLICY: BgpAttributesMpUnreachNlriChoiceEnum("ipv4_srpolicy"), + IPV6_SRPOLICY: BgpAttributesMpUnreachNlriChoiceEnum("ipv6_srpolicy"), +} + +func (obj *bgpAttributesMpUnreachNlri) Choice() BgpAttributesMpUnreachNlriChoiceEnum { + return BgpAttributesMpUnreachNlriChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The AFI and SAFI to be sent in the MPUNREACH_NLRI in the Update. +// Choice returns a string +func (obj *bgpAttributesMpUnreachNlri) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpAttributesMpUnreachNlri) setChoice(value BgpAttributesMpUnreachNlriChoiceEnum) BgpAttributesMpUnreachNlri { + intValue, ok := otg.BgpAttributesMpUnreachNlri_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAttributesMpUnreachNlriChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpAttributesMpUnreachNlri_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Ipv6Srpolicy = nil + obj.ipv6SrpolicyHolder = nil + obj.obj.Ipv4Srpolicy = nil + obj.ipv4SrpolicyHolder = nil + obj.obj.Ipv6Unicast = nil + obj.ipv6UnicastHolder = nil + obj.obj.Ipv4Unicast = nil + obj.ipv4UnicastHolder = nil + + if value == BgpAttributesMpUnreachNlriChoice.IPV4_UNICAST { + obj.obj.Ipv4Unicast = []*otg.BgpOneIpv4NLRIPrefix{} + } + + if value == BgpAttributesMpUnreachNlriChoice.IPV6_UNICAST { + obj.obj.Ipv6Unicast = []*otg.BgpOneIpv6NLRIPrefix{} + } + + if value == BgpAttributesMpUnreachNlriChoice.IPV4_SRPOLICY { + obj.obj.Ipv4Srpolicy = NewBgpIpv4SrPolicyNLRIPrefix().msg() + } + + if value == BgpAttributesMpUnreachNlriChoice.IPV6_SRPOLICY { + obj.obj.Ipv6Srpolicy = NewBgpIpv6SrPolicyNLRIPrefix().msg() + } + + return obj +} + +// List of IPv4 prefixes being sent in the IPv4 Unicast MPUNREACH_NLRI . +// Ipv4Unicast returns a []BgpOneIpv4NLRIPrefix +func (obj *bgpAttributesMpUnreachNlri) Ipv4Unicast() BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { + if len(obj.obj.Ipv4Unicast) == 0 { + obj.setChoice(BgpAttributesMpUnreachNlriChoice.IPV4_UNICAST) + } + if obj.ipv4UnicastHolder == nil { + obj.ipv4UnicastHolder = newBgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter(&obj.obj.Ipv4Unicast).setMsg(obj) + } + return obj.ipv4UnicastHolder +} + +type bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter struct { + obj *bgpAttributesMpUnreachNlri + bgpOneIpv4NLRIPrefixSlice []BgpOneIpv4NLRIPrefix + fieldPtr *[]*otg.BgpOneIpv4NLRIPrefix +} + +func newBgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter(ptr *[]*otg.BgpOneIpv4NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { + return &bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter{fieldPtr: ptr} +} + +type BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter interface { + setMsg(*bgpAttributesMpUnreachNlri) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter + Items() []BgpOneIpv4NLRIPrefix + Add() BgpOneIpv4NLRIPrefix + Append(items ...BgpOneIpv4NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter + Set(index int, newObj BgpOneIpv4NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter + Clear() BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter + clearHolderSlice() BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter + appendHolderSlice(item BgpOneIpv4NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter +} + +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) setMsg(msg *bgpAttributesMpUnreachNlri) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpOneIpv4NLRIPrefix{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) Items() []BgpOneIpv4NLRIPrefix { + return obj.bgpOneIpv4NLRIPrefixSlice +} + +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) Add() BgpOneIpv4NLRIPrefix { + newObj := &otg.BgpOneIpv4NLRIPrefix{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpOneIpv4NLRIPrefix{obj: newObj} + newLibObj.setDefault() + obj.bgpOneIpv4NLRIPrefixSlice = append(obj.bgpOneIpv4NLRIPrefixSlice, newLibObj) + return newLibObj +} + +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) Append(items ...BgpOneIpv4NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpOneIpv4NLRIPrefixSlice = append(obj.bgpOneIpv4NLRIPrefixSlice, item) + } + return obj +} + +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) Set(index int, newObj BgpOneIpv4NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpOneIpv4NLRIPrefixSlice[index] = newObj + return obj +} +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) Clear() BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpOneIpv4NLRIPrefix{} + obj.bgpOneIpv4NLRIPrefixSlice = []BgpOneIpv4NLRIPrefix{} + } + return obj +} +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) clearHolderSlice() BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { + if len(obj.bgpOneIpv4NLRIPrefixSlice) > 0 { + obj.bgpOneIpv4NLRIPrefixSlice = []BgpOneIpv4NLRIPrefix{} + } + return obj +} +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) appendHolderSlice(item BgpOneIpv4NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { + obj.bgpOneIpv4NLRIPrefixSlice = append(obj.bgpOneIpv4NLRIPrefixSlice, item) + return obj +} + +// List of IPv6 prefixes being sent in the IPv6 Unicast MPUNREACH_NLRI . +// Ipv6Unicast returns a []BgpOneIpv6NLRIPrefix +func (obj *bgpAttributesMpUnreachNlri) Ipv6Unicast() BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { + if len(obj.obj.Ipv6Unicast) == 0 { + obj.setChoice(BgpAttributesMpUnreachNlriChoice.IPV6_UNICAST) + } + if obj.ipv6UnicastHolder == nil { + obj.ipv6UnicastHolder = newBgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter(&obj.obj.Ipv6Unicast).setMsg(obj) + } + return obj.ipv6UnicastHolder +} + +type bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter struct { + obj *bgpAttributesMpUnreachNlri + bgpOneIpv6NLRIPrefixSlice []BgpOneIpv6NLRIPrefix + fieldPtr *[]*otg.BgpOneIpv6NLRIPrefix +} + +func newBgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter(ptr *[]*otg.BgpOneIpv6NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { + return &bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter{fieldPtr: ptr} +} + +type BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter interface { + setMsg(*bgpAttributesMpUnreachNlri) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter + Items() []BgpOneIpv6NLRIPrefix + Add() BgpOneIpv6NLRIPrefix + Append(items ...BgpOneIpv6NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter + Set(index int, newObj BgpOneIpv6NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter + Clear() BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter + clearHolderSlice() BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter + appendHolderSlice(item BgpOneIpv6NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter +} + +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) setMsg(msg *bgpAttributesMpUnreachNlri) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpOneIpv6NLRIPrefix{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) Items() []BgpOneIpv6NLRIPrefix { + return obj.bgpOneIpv6NLRIPrefixSlice +} + +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) Add() BgpOneIpv6NLRIPrefix { + newObj := &otg.BgpOneIpv6NLRIPrefix{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpOneIpv6NLRIPrefix{obj: newObj} + newLibObj.setDefault() + obj.bgpOneIpv6NLRIPrefixSlice = append(obj.bgpOneIpv6NLRIPrefixSlice, newLibObj) + return newLibObj +} + +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) Append(items ...BgpOneIpv6NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpOneIpv6NLRIPrefixSlice = append(obj.bgpOneIpv6NLRIPrefixSlice, item) + } + return obj +} + +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) Set(index int, newObj BgpOneIpv6NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpOneIpv6NLRIPrefixSlice[index] = newObj + return obj +} +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) Clear() BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpOneIpv6NLRIPrefix{} + obj.bgpOneIpv6NLRIPrefixSlice = []BgpOneIpv6NLRIPrefix{} + } + return obj +} +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) clearHolderSlice() BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { + if len(obj.bgpOneIpv6NLRIPrefixSlice) > 0 { + obj.bgpOneIpv6NLRIPrefixSlice = []BgpOneIpv6NLRIPrefix{} + } + return obj +} +func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) appendHolderSlice(item BgpOneIpv6NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { + obj.bgpOneIpv6NLRIPrefixSlice = append(obj.bgpOneIpv6NLRIPrefixSlice, item) + return obj +} + +// IPv4 endpoint with Segment Routing Policy being sent in the IPv4 MPUNREACH_NLRI . +// Ipv4Srpolicy returns a BgpIpv4SrPolicyNLRIPrefix +func (obj *bgpAttributesMpUnreachNlri) Ipv4Srpolicy() BgpIpv4SrPolicyNLRIPrefix { + if obj.obj.Ipv4Srpolicy == nil { + obj.setChoice(BgpAttributesMpUnreachNlriChoice.IPV4_SRPOLICY) + } + if obj.ipv4SrpolicyHolder == nil { + obj.ipv4SrpolicyHolder = &bgpIpv4SrPolicyNLRIPrefix{obj: obj.obj.Ipv4Srpolicy} + } + return obj.ipv4SrpolicyHolder +} + +// IPv4 endpoint with Segment Routing Policy being sent in the IPv4 MPUNREACH_NLRI . +// Ipv4Srpolicy returns a BgpIpv4SrPolicyNLRIPrefix +func (obj *bgpAttributesMpUnreachNlri) HasIpv4Srpolicy() bool { + return obj.obj.Ipv4Srpolicy != nil +} + +// IPv4 endpoint with Segment Routing Policy being sent in the IPv4 MPUNREACH_NLRI . +// SetIpv4Srpolicy sets the BgpIpv4SrPolicyNLRIPrefix value in the BgpAttributesMpUnreachNlri object +func (obj *bgpAttributesMpUnreachNlri) SetIpv4Srpolicy(value BgpIpv4SrPolicyNLRIPrefix) BgpAttributesMpUnreachNlri { + obj.setChoice(BgpAttributesMpUnreachNlriChoice.IPV4_SRPOLICY) + obj.ipv4SrpolicyHolder = nil + obj.obj.Ipv4Srpolicy = value.msg() + + return obj +} + +// IPv6 endpoint with Segment Routing Policy being sent in the IPv4 MPUNREACH_NLRI . +// Ipv6Srpolicy returns a BgpIpv6SrPolicyNLRIPrefix +func (obj *bgpAttributesMpUnreachNlri) Ipv6Srpolicy() BgpIpv6SrPolicyNLRIPrefix { + if obj.obj.Ipv6Srpolicy == nil { + obj.setChoice(BgpAttributesMpUnreachNlriChoice.IPV6_SRPOLICY) + } + if obj.ipv6SrpolicyHolder == nil { + obj.ipv6SrpolicyHolder = &bgpIpv6SrPolicyNLRIPrefix{obj: obj.obj.Ipv6Srpolicy} + } + return obj.ipv6SrpolicyHolder +} + +// IPv6 endpoint with Segment Routing Policy being sent in the IPv4 MPUNREACH_NLRI . +// Ipv6Srpolicy returns a BgpIpv6SrPolicyNLRIPrefix +func (obj *bgpAttributesMpUnreachNlri) HasIpv6Srpolicy() bool { + return obj.obj.Ipv6Srpolicy != nil +} + +// IPv6 endpoint with Segment Routing Policy being sent in the IPv4 MPUNREACH_NLRI . +// SetIpv6Srpolicy sets the BgpIpv6SrPolicyNLRIPrefix value in the BgpAttributesMpUnreachNlri object +func (obj *bgpAttributesMpUnreachNlri) SetIpv6Srpolicy(value BgpIpv6SrPolicyNLRIPrefix) BgpAttributesMpUnreachNlri { + obj.setChoice(BgpAttributesMpUnreachNlriChoice.IPV6_SRPOLICY) + obj.ipv6SrpolicyHolder = nil + obj.obj.Ipv6Srpolicy = value.msg() + + return obj +} + +func (obj *bgpAttributesMpUnreachNlri) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Ipv4Unicast) != 0 { + + if set_default { + obj.Ipv4Unicast().clearHolderSlice() + for _, item := range obj.obj.Ipv4Unicast { + obj.Ipv4Unicast().appendHolderSlice(&bgpOneIpv4NLRIPrefix{obj: item}) + } + } + for _, item := range obj.Ipv4Unicast().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Ipv6Unicast) != 0 { + + if set_default { + obj.Ipv6Unicast().clearHolderSlice() + for _, item := range obj.obj.Ipv6Unicast { + obj.Ipv6Unicast().appendHolderSlice(&bgpOneIpv6NLRIPrefix{obj: item}) + } + } + for _, item := range obj.Ipv6Unicast().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Ipv4Srpolicy != nil { + + obj.Ipv4Srpolicy().validateObj(vObj, set_default) + } + + if obj.obj.Ipv6Srpolicy != nil { + + obj.Ipv6Srpolicy().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesMpUnreachNlri) setDefault() { + var choices_set int = 0 + var choice BgpAttributesMpUnreachNlriChoiceEnum + + if len(obj.obj.Ipv4Unicast) > 0 { + choices_set += 1 + choice = BgpAttributesMpUnreachNlriChoice.IPV4_UNICAST + } + + if len(obj.obj.Ipv6Unicast) > 0 { + choices_set += 1 + choice = BgpAttributesMpUnreachNlriChoice.IPV6_UNICAST + } + + if obj.obj.Ipv4Srpolicy != nil { + choices_set += 1 + choice = BgpAttributesMpUnreachNlriChoice.IPV4_SRPOLICY + } + + if obj.obj.Ipv6Srpolicy != nil { + choices_set += 1 + choice = BgpAttributesMpUnreachNlriChoice.IPV6_SRPOLICY + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesMpUnreachNlri") + } + } else { + intVal := otg.BgpAttributesMpUnreachNlri_Choice_Enum_value[string(choice)] + enumValue := otg.BgpAttributesMpUnreachNlri_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_attributes_multi_exit_discriminator.go b/gosnappi/bgp_attributes_multi_exit_discriminator.go new file mode 100644 index 00000000..1ae656e7 --- /dev/null +++ b/gosnappi/bgp_attributes_multi_exit_discriminator.go @@ -0,0 +1,309 @@ +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" +) + +// ***** BgpAttributesMultiExitDiscriminator ***** +type bgpAttributesMultiExitDiscriminator struct { + validation + obj *otg.BgpAttributesMultiExitDiscriminator + marshaller marshalBgpAttributesMultiExitDiscriminator + unMarshaller unMarshalBgpAttributesMultiExitDiscriminator +} + +func NewBgpAttributesMultiExitDiscriminator() BgpAttributesMultiExitDiscriminator { + obj := bgpAttributesMultiExitDiscriminator{obj: &otg.BgpAttributesMultiExitDiscriminator{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesMultiExitDiscriminator) msg() *otg.BgpAttributesMultiExitDiscriminator { + return obj.obj +} + +func (obj *bgpAttributesMultiExitDiscriminator) setMsg(msg *otg.BgpAttributesMultiExitDiscriminator) BgpAttributesMultiExitDiscriminator { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesMultiExitDiscriminator struct { + obj *bgpAttributesMultiExitDiscriminator +} + +type marshalBgpAttributesMultiExitDiscriminator interface { + // ToProto marshals BgpAttributesMultiExitDiscriminator to protobuf object *otg.BgpAttributesMultiExitDiscriminator + ToProto() (*otg.BgpAttributesMultiExitDiscriminator, error) + // ToPbText marshals BgpAttributesMultiExitDiscriminator to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesMultiExitDiscriminator to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesMultiExitDiscriminator to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesMultiExitDiscriminator struct { + obj *bgpAttributesMultiExitDiscriminator +} + +type unMarshalBgpAttributesMultiExitDiscriminator interface { + // FromProto unmarshals BgpAttributesMultiExitDiscriminator from protobuf object *otg.BgpAttributesMultiExitDiscriminator + FromProto(msg *otg.BgpAttributesMultiExitDiscriminator) (BgpAttributesMultiExitDiscriminator, error) + // FromPbText unmarshals BgpAttributesMultiExitDiscriminator from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesMultiExitDiscriminator from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesMultiExitDiscriminator from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesMultiExitDiscriminator) Marshal() marshalBgpAttributesMultiExitDiscriminator { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesMultiExitDiscriminator{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesMultiExitDiscriminator) Unmarshal() unMarshalBgpAttributesMultiExitDiscriminator { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesMultiExitDiscriminator{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesMultiExitDiscriminator) ToProto() (*otg.BgpAttributesMultiExitDiscriminator, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesMultiExitDiscriminator) FromProto(msg *otg.BgpAttributesMultiExitDiscriminator) (BgpAttributesMultiExitDiscriminator, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesMultiExitDiscriminator) 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 *unMarshalbgpAttributesMultiExitDiscriminator) 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 *marshalbgpAttributesMultiExitDiscriminator) 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 *unMarshalbgpAttributesMultiExitDiscriminator) 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 *marshalbgpAttributesMultiExitDiscriminator) 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 *unMarshalbgpAttributesMultiExitDiscriminator) 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 *bgpAttributesMultiExitDiscriminator) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesMultiExitDiscriminator) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesMultiExitDiscriminator) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesMultiExitDiscriminator) Clone() (BgpAttributesMultiExitDiscriminator, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesMultiExitDiscriminator() + 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 +} + +// BgpAttributesMultiExitDiscriminator is optional MULTI_EXIT_DISCRIMINATOR attribute sent to the peer to help in the route selection process. +type BgpAttributesMultiExitDiscriminator interface { + Validation + // msg marshals BgpAttributesMultiExitDiscriminator to protobuf object *otg.BgpAttributesMultiExitDiscriminator + // and doesn't set defaults + msg() *otg.BgpAttributesMultiExitDiscriminator + // setMsg unmarshals BgpAttributesMultiExitDiscriminator from protobuf object *otg.BgpAttributesMultiExitDiscriminator + // and doesn't set defaults + setMsg(*otg.BgpAttributesMultiExitDiscriminator) BgpAttributesMultiExitDiscriminator + // provides marshal interface + Marshal() marshalBgpAttributesMultiExitDiscriminator + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesMultiExitDiscriminator + // validate validates BgpAttributesMultiExitDiscriminator + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesMultiExitDiscriminator, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Value returns uint32, set in BgpAttributesMultiExitDiscriminator. + Value() uint32 + // SetValue assigns uint32 provided by user to BgpAttributesMultiExitDiscriminator + SetValue(value uint32) BgpAttributesMultiExitDiscriminator + // HasValue checks if Value has been set in BgpAttributesMultiExitDiscriminator + HasValue() bool +} + +// The multi exit discriminator (MED) value used for route selection sent to the peer. +// Value returns a uint32 +func (obj *bgpAttributesMultiExitDiscriminator) Value() uint32 { + + return *obj.obj.Value + +} + +// The multi exit discriminator (MED) value used for route selection sent to the peer. +// Value returns a uint32 +func (obj *bgpAttributesMultiExitDiscriminator) HasValue() bool { + return obj.obj.Value != nil +} + +// The multi exit discriminator (MED) value used for route selection sent to the peer. +// SetValue sets the uint32 value in the BgpAttributesMultiExitDiscriminator object +func (obj *bgpAttributesMultiExitDiscriminator) SetValue(value uint32) BgpAttributesMultiExitDiscriminator { + + obj.obj.Value = &value + return obj +} + +func (obj *bgpAttributesMultiExitDiscriminator) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpAttributesMultiExitDiscriminator) setDefault() { + if obj.obj.Value == nil { + obj.SetValue(0) + } + +} diff --git a/gosnappi/bgp_attributes_next_hop.go b/gosnappi/bgp_attributes_next_hop.go new file mode 100644 index 00000000..480ca861 --- /dev/null +++ b/gosnappi/bgp_attributes_next_hop.go @@ -0,0 +1,504 @@ +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" +) + +// ***** BgpAttributesNextHop ***** +type bgpAttributesNextHop struct { + validation + obj *otg.BgpAttributesNextHop + marshaller marshalBgpAttributesNextHop + unMarshaller unMarshalBgpAttributesNextHop + ipv6TwoAddressesHolder BgpAttributesNextHopIpv6TwoAddresses +} + +func NewBgpAttributesNextHop() BgpAttributesNextHop { + obj := bgpAttributesNextHop{obj: &otg.BgpAttributesNextHop{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesNextHop) msg() *otg.BgpAttributesNextHop { + return obj.obj +} + +func (obj *bgpAttributesNextHop) setMsg(msg *otg.BgpAttributesNextHop) BgpAttributesNextHop { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesNextHop struct { + obj *bgpAttributesNextHop +} + +type marshalBgpAttributesNextHop interface { + // ToProto marshals BgpAttributesNextHop to protobuf object *otg.BgpAttributesNextHop + ToProto() (*otg.BgpAttributesNextHop, error) + // ToPbText marshals BgpAttributesNextHop to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesNextHop to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesNextHop to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesNextHop struct { + obj *bgpAttributesNextHop +} + +type unMarshalBgpAttributesNextHop interface { + // FromProto unmarshals BgpAttributesNextHop from protobuf object *otg.BgpAttributesNextHop + FromProto(msg *otg.BgpAttributesNextHop) (BgpAttributesNextHop, error) + // FromPbText unmarshals BgpAttributesNextHop from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesNextHop from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesNextHop from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesNextHop) Marshal() marshalBgpAttributesNextHop { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesNextHop{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesNextHop) Unmarshal() unMarshalBgpAttributesNextHop { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesNextHop{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesNextHop) ToProto() (*otg.BgpAttributesNextHop, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesNextHop) FromProto(msg *otg.BgpAttributesNextHop) (BgpAttributesNextHop, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesNextHop) 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 *unMarshalbgpAttributesNextHop) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesNextHop) 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 *unMarshalbgpAttributesNextHop) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesNextHop) 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 *unMarshalbgpAttributesNextHop) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesNextHop) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesNextHop) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesNextHop) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesNextHop) Clone() (BgpAttributesNextHop, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesNextHop() + 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 +} + +func (obj *bgpAttributesNextHop) setNil() { + obj.ipv6TwoAddressesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesNextHop is next hop to be sent inside MP_REACH NLRI or as the NEXT_HOP attribute if advertised as traditional NLRI. +type BgpAttributesNextHop interface { + Validation + // msg marshals BgpAttributesNextHop to protobuf object *otg.BgpAttributesNextHop + // and doesn't set defaults + msg() *otg.BgpAttributesNextHop + // setMsg unmarshals BgpAttributesNextHop from protobuf object *otg.BgpAttributesNextHop + // and doesn't set defaults + setMsg(*otg.BgpAttributesNextHop) BgpAttributesNextHop + // provides marshal interface + Marshal() marshalBgpAttributesNextHop + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesNextHop + // validate validates BgpAttributesNextHop + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesNextHop, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpAttributesNextHopChoiceEnum, set in BgpAttributesNextHop + Choice() BgpAttributesNextHopChoiceEnum + // setChoice assigns BgpAttributesNextHopChoiceEnum provided by user to BgpAttributesNextHop + setChoice(value BgpAttributesNextHopChoiceEnum) BgpAttributesNextHop + // Ipv4 returns string, set in BgpAttributesNextHop. + Ipv4() string + // SetIpv4 assigns string provided by user to BgpAttributesNextHop + SetIpv4(value string) BgpAttributesNextHop + // HasIpv4 checks if Ipv4 has been set in BgpAttributesNextHop + HasIpv4() bool + // Ipv6 returns string, set in BgpAttributesNextHop. + Ipv6() string + // SetIpv6 assigns string provided by user to BgpAttributesNextHop + SetIpv6(value string) BgpAttributesNextHop + // HasIpv6 checks if Ipv6 has been set in BgpAttributesNextHop + HasIpv6() bool + // Ipv6TwoAddresses returns BgpAttributesNextHopIpv6TwoAddresses, set in BgpAttributesNextHop. + // BgpAttributesNextHopIpv6TwoAddresses is there is a specific scenario in which it is possible to receive a Global and Link Local address in the Next Hop + // field in a MP_REACH attribute or in the NEXT_HOP attribute(RFC2545: Section 3). + Ipv6TwoAddresses() BgpAttributesNextHopIpv6TwoAddresses + // SetIpv6TwoAddresses assigns BgpAttributesNextHopIpv6TwoAddresses provided by user to BgpAttributesNextHop. + // BgpAttributesNextHopIpv6TwoAddresses is there is a specific scenario in which it is possible to receive a Global and Link Local address in the Next Hop + // field in a MP_REACH attribute or in the NEXT_HOP attribute(RFC2545: Section 3). + SetIpv6TwoAddresses(value BgpAttributesNextHopIpv6TwoAddresses) BgpAttributesNextHop + // HasIpv6TwoAddresses checks if Ipv6TwoAddresses has been set in BgpAttributesNextHop + HasIpv6TwoAddresses() bool + setNil() +} + +type BgpAttributesNextHopChoiceEnum string + +// Enum of Choice on BgpAttributesNextHop +var BgpAttributesNextHopChoice = struct { + IPV4 BgpAttributesNextHopChoiceEnum + IPV6 BgpAttributesNextHopChoiceEnum + IPV6_TWO_ADDRESSES BgpAttributesNextHopChoiceEnum +}{ + IPV4: BgpAttributesNextHopChoiceEnum("ipv4"), + IPV6: BgpAttributesNextHopChoiceEnum("ipv6"), + IPV6_TWO_ADDRESSES: BgpAttributesNextHopChoiceEnum("ipv6_two_addresses"), +} + +func (obj *bgpAttributesNextHop) Choice() BgpAttributesNextHopChoiceEnum { + return BgpAttributesNextHopChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *bgpAttributesNextHop) setChoice(value BgpAttributesNextHopChoiceEnum) BgpAttributesNextHop { + intValue, ok := otg.BgpAttributesNextHop_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAttributesNextHopChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpAttributesNextHop_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Ipv6TwoAddresses = nil + obj.ipv6TwoAddressesHolder = nil + obj.obj.Ipv6 = nil + obj.obj.Ipv4 = nil + + if value == BgpAttributesNextHopChoice.IPV4 { + defaultValue := "0.0.0.0" + obj.obj.Ipv4 = &defaultValue + } + + if value == BgpAttributesNextHopChoice.IPV6 { + defaultValue := "0::0" + obj.obj.Ipv6 = &defaultValue + } + + if value == BgpAttributesNextHopChoice.IPV6_TWO_ADDRESSES { + obj.obj.Ipv6TwoAddresses = NewBgpAttributesNextHopIpv6TwoAddresses().msg() + } + + return obj +} + +// The 4 byte IPv4 address of the next-hop from which the route was received. +// Ipv4 returns a string +func (obj *bgpAttributesNextHop) Ipv4() string { + + if obj.obj.Ipv4 == nil { + obj.setChoice(BgpAttributesNextHopChoice.IPV4) + } + + return *obj.obj.Ipv4 + +} + +// The 4 byte IPv4 address of the next-hop from which the route was received. +// Ipv4 returns a string +func (obj *bgpAttributesNextHop) HasIpv4() bool { + return obj.obj.Ipv4 != nil +} + +// The 4 byte IPv4 address of the next-hop from which the route was received. +// SetIpv4 sets the string value in the BgpAttributesNextHop object +func (obj *bgpAttributesNextHop) SetIpv4(value string) BgpAttributesNextHop { + obj.setChoice(BgpAttributesNextHopChoice.IPV4) + obj.obj.Ipv4 = &value + return obj +} + +// The 16 byte IPv6 address of the next-hop from which the route was received. +// Ipv6 returns a string +func (obj *bgpAttributesNextHop) Ipv6() string { + + if obj.obj.Ipv6 == nil { + obj.setChoice(BgpAttributesNextHopChoice.IPV6) + } + + return *obj.obj.Ipv6 + +} + +// The 16 byte IPv6 address of the next-hop from which the route was received. +// Ipv6 returns a string +func (obj *bgpAttributesNextHop) HasIpv6() bool { + return obj.obj.Ipv6 != nil +} + +// The 16 byte IPv6 address of the next-hop from which the route was received. +// SetIpv6 sets the string value in the BgpAttributesNextHop object +func (obj *bgpAttributesNextHop) SetIpv6(value string) BgpAttributesNextHop { + obj.setChoice(BgpAttributesNextHopChoice.IPV6) + obj.obj.Ipv6 = &value + return obj +} + +// description is TBD +// Ipv6TwoAddresses returns a BgpAttributesNextHopIpv6TwoAddresses +func (obj *bgpAttributesNextHop) Ipv6TwoAddresses() BgpAttributesNextHopIpv6TwoAddresses { + if obj.obj.Ipv6TwoAddresses == nil { + obj.setChoice(BgpAttributesNextHopChoice.IPV6_TWO_ADDRESSES) + } + if obj.ipv6TwoAddressesHolder == nil { + obj.ipv6TwoAddressesHolder = &bgpAttributesNextHopIpv6TwoAddresses{obj: obj.obj.Ipv6TwoAddresses} + } + return obj.ipv6TwoAddressesHolder +} + +// description is TBD +// Ipv6TwoAddresses returns a BgpAttributesNextHopIpv6TwoAddresses +func (obj *bgpAttributesNextHop) HasIpv6TwoAddresses() bool { + return obj.obj.Ipv6TwoAddresses != nil +} + +// description is TBD +// SetIpv6TwoAddresses sets the BgpAttributesNextHopIpv6TwoAddresses value in the BgpAttributesNextHop object +func (obj *bgpAttributesNextHop) SetIpv6TwoAddresses(value BgpAttributesNextHopIpv6TwoAddresses) BgpAttributesNextHop { + obj.setChoice(BgpAttributesNextHopChoice.IPV6_TWO_ADDRESSES) + obj.ipv6TwoAddressesHolder = nil + obj.obj.Ipv6TwoAddresses = value.msg() + + return obj +} + +func (obj *bgpAttributesNextHop) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface BgpAttributesNextHop") + } + + if obj.obj.Ipv4 != nil { + + err := obj.validateIpv4(obj.Ipv4()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesNextHop.Ipv4")) + } + + } + + if obj.obj.Ipv6 != nil { + + err := obj.validateIpv6(obj.Ipv6()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesNextHop.Ipv6")) + } + + } + + if obj.obj.Ipv6TwoAddresses != nil { + + obj.Ipv6TwoAddresses().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesNextHop) setDefault() { + var choices_set int = 0 + var choice BgpAttributesNextHopChoiceEnum + + if obj.obj.Ipv4 != nil { + choices_set += 1 + choice = BgpAttributesNextHopChoice.IPV4 + } + + if obj.obj.Ipv6 != nil { + choices_set += 1 + choice = BgpAttributesNextHopChoice.IPV6 + } + + if obj.obj.Ipv6TwoAddresses != nil { + choices_set += 1 + choice = BgpAttributesNextHopChoice.IPV6_TWO_ADDRESSES + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesNextHop") + } + } else { + intVal := otg.BgpAttributesNextHop_Choice_Enum_value[string(choice)] + enumValue := otg.BgpAttributesNextHop_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + + if obj.obj.Ipv4 == nil && choice == BgpAttributesNextHopChoice.IPV4 { + obj.SetIpv4("0.0.0.0") + } + if obj.obj.Ipv6 == nil && choice == BgpAttributesNextHopChoice.IPV6 { + obj.SetIpv6("0::0") + } + +} diff --git a/gosnappi/bgp_attributes_next_hop_ipv6_two_addresses.go b/gosnappi/bgp_attributes_next_hop_ipv6_two_addresses.go new file mode 100644 index 00000000..f63bcc86 --- /dev/null +++ b/gosnappi/bgp_attributes_next_hop_ipv6_two_addresses.go @@ -0,0 +1,359 @@ +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" +) + +// ***** BgpAttributesNextHopIpv6TwoAddresses ***** +type bgpAttributesNextHopIpv6TwoAddresses struct { + validation + obj *otg.BgpAttributesNextHopIpv6TwoAddresses + marshaller marshalBgpAttributesNextHopIpv6TwoAddresses + unMarshaller unMarshalBgpAttributesNextHopIpv6TwoAddresses +} + +func NewBgpAttributesNextHopIpv6TwoAddresses() BgpAttributesNextHopIpv6TwoAddresses { + obj := bgpAttributesNextHopIpv6TwoAddresses{obj: &otg.BgpAttributesNextHopIpv6TwoAddresses{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesNextHopIpv6TwoAddresses) msg() *otg.BgpAttributesNextHopIpv6TwoAddresses { + return obj.obj +} + +func (obj *bgpAttributesNextHopIpv6TwoAddresses) setMsg(msg *otg.BgpAttributesNextHopIpv6TwoAddresses) BgpAttributesNextHopIpv6TwoAddresses { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesNextHopIpv6TwoAddresses struct { + obj *bgpAttributesNextHopIpv6TwoAddresses +} + +type marshalBgpAttributesNextHopIpv6TwoAddresses interface { + // ToProto marshals BgpAttributesNextHopIpv6TwoAddresses to protobuf object *otg.BgpAttributesNextHopIpv6TwoAddresses + ToProto() (*otg.BgpAttributesNextHopIpv6TwoAddresses, error) + // ToPbText marshals BgpAttributesNextHopIpv6TwoAddresses to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesNextHopIpv6TwoAddresses to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesNextHopIpv6TwoAddresses to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesNextHopIpv6TwoAddresses struct { + obj *bgpAttributesNextHopIpv6TwoAddresses +} + +type unMarshalBgpAttributesNextHopIpv6TwoAddresses interface { + // FromProto unmarshals BgpAttributesNextHopIpv6TwoAddresses from protobuf object *otg.BgpAttributesNextHopIpv6TwoAddresses + FromProto(msg *otg.BgpAttributesNextHopIpv6TwoAddresses) (BgpAttributesNextHopIpv6TwoAddresses, error) + // FromPbText unmarshals BgpAttributesNextHopIpv6TwoAddresses from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesNextHopIpv6TwoAddresses from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesNextHopIpv6TwoAddresses from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesNextHopIpv6TwoAddresses) Marshal() marshalBgpAttributesNextHopIpv6TwoAddresses { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesNextHopIpv6TwoAddresses{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesNextHopIpv6TwoAddresses) Unmarshal() unMarshalBgpAttributesNextHopIpv6TwoAddresses { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesNextHopIpv6TwoAddresses{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesNextHopIpv6TwoAddresses) ToProto() (*otg.BgpAttributesNextHopIpv6TwoAddresses, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesNextHopIpv6TwoAddresses) FromProto(msg *otg.BgpAttributesNextHopIpv6TwoAddresses) (BgpAttributesNextHopIpv6TwoAddresses, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesNextHopIpv6TwoAddresses) 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 *unMarshalbgpAttributesNextHopIpv6TwoAddresses) 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 *marshalbgpAttributesNextHopIpv6TwoAddresses) 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 *unMarshalbgpAttributesNextHopIpv6TwoAddresses) 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 *marshalbgpAttributesNextHopIpv6TwoAddresses) 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 *unMarshalbgpAttributesNextHopIpv6TwoAddresses) 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 *bgpAttributesNextHopIpv6TwoAddresses) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesNextHopIpv6TwoAddresses) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesNextHopIpv6TwoAddresses) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesNextHopIpv6TwoAddresses) Clone() (BgpAttributesNextHopIpv6TwoAddresses, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesNextHopIpv6TwoAddresses() + 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 +} + +// BgpAttributesNextHopIpv6TwoAddresses is there is a specific scenario in which it is possible to receive a Global and Link Local address in the Next Hop +// field in a MP_REACH attribute or in the NEXT_HOP attribute(RFC2545: Section 3). +type BgpAttributesNextHopIpv6TwoAddresses interface { + Validation + // msg marshals BgpAttributesNextHopIpv6TwoAddresses to protobuf object *otg.BgpAttributesNextHopIpv6TwoAddresses + // and doesn't set defaults + msg() *otg.BgpAttributesNextHopIpv6TwoAddresses + // setMsg unmarshals BgpAttributesNextHopIpv6TwoAddresses from protobuf object *otg.BgpAttributesNextHopIpv6TwoAddresses + // and doesn't set defaults + setMsg(*otg.BgpAttributesNextHopIpv6TwoAddresses) BgpAttributesNextHopIpv6TwoAddresses + // provides marshal interface + Marshal() marshalBgpAttributesNextHopIpv6TwoAddresses + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesNextHopIpv6TwoAddresses + // validate validates BgpAttributesNextHopIpv6TwoAddresses + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesNextHopIpv6TwoAddresses, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // First returns string, set in BgpAttributesNextHopIpv6TwoAddresses. + First() string + // SetFirst assigns string provided by user to BgpAttributesNextHopIpv6TwoAddresses + SetFirst(value string) BgpAttributesNextHopIpv6TwoAddresses + // HasFirst checks if First has been set in BgpAttributesNextHopIpv6TwoAddresses + HasFirst() bool + // Second returns string, set in BgpAttributesNextHopIpv6TwoAddresses. + Second() string + // SetSecond assigns string provided by user to BgpAttributesNextHopIpv6TwoAddresses + SetSecond(value string) BgpAttributesNextHopIpv6TwoAddresses + // HasSecond checks if Second has been set in BgpAttributesNextHopIpv6TwoAddresses + HasSecond() bool +} + +// The first IPv6 next hop in the 32 byte IPv6 Next Hop. +// First returns a string +func (obj *bgpAttributesNextHopIpv6TwoAddresses) First() string { + + return *obj.obj.First + +} + +// The first IPv6 next hop in the 32 byte IPv6 Next Hop. +// First returns a string +func (obj *bgpAttributesNextHopIpv6TwoAddresses) HasFirst() bool { + return obj.obj.First != nil +} + +// The first IPv6 next hop in the 32 byte IPv6 Next Hop. +// SetFirst sets the string value in the BgpAttributesNextHopIpv6TwoAddresses object +func (obj *bgpAttributesNextHopIpv6TwoAddresses) SetFirst(value string) BgpAttributesNextHopIpv6TwoAddresses { + + obj.obj.First = &value + return obj +} + +// The second IPv6 next hop in the 32 byte IPv6 Next Hop. +// Second returns a string +func (obj *bgpAttributesNextHopIpv6TwoAddresses) Second() string { + + return *obj.obj.Second + +} + +// The second IPv6 next hop in the 32 byte IPv6 Next Hop. +// Second returns a string +func (obj *bgpAttributesNextHopIpv6TwoAddresses) HasSecond() bool { + return obj.obj.Second != nil +} + +// The second IPv6 next hop in the 32 byte IPv6 Next Hop. +// SetSecond sets the string value in the BgpAttributesNextHopIpv6TwoAddresses object +func (obj *bgpAttributesNextHopIpv6TwoAddresses) SetSecond(value string) BgpAttributesNextHopIpv6TwoAddresses { + + obj.obj.Second = &value + return obj +} + +func (obj *bgpAttributesNextHopIpv6TwoAddresses) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.First != nil { + + err := obj.validateIpv6(obj.First()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesNextHopIpv6TwoAddresses.First")) + } + + } + + if obj.obj.Second != nil { + + err := obj.validateIpv6(obj.Second()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesNextHopIpv6TwoAddresses.Second")) + } + + } + +} + +func (obj *bgpAttributesNextHopIpv6TwoAddresses) setDefault() { + if obj.obj.First == nil { + obj.SetFirst("0::0") + } + if obj.obj.Second == nil { + obj.SetSecond("0::0") + } + +} diff --git a/gosnappi/bgp_attributes_originator_id.go b/gosnappi/bgp_attributes_originator_id.go new file mode 100644 index 00000000..3032b093 --- /dev/null +++ b/gosnappi/bgp_attributes_originator_id.go @@ -0,0 +1,318 @@ +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" +) + +// ***** BgpAttributesOriginatorId ***** +type bgpAttributesOriginatorId struct { + validation + obj *otg.BgpAttributesOriginatorId + marshaller marshalBgpAttributesOriginatorId + unMarshaller unMarshalBgpAttributesOriginatorId +} + +func NewBgpAttributesOriginatorId() BgpAttributesOriginatorId { + obj := bgpAttributesOriginatorId{obj: &otg.BgpAttributesOriginatorId{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesOriginatorId) msg() *otg.BgpAttributesOriginatorId { + return obj.obj +} + +func (obj *bgpAttributesOriginatorId) setMsg(msg *otg.BgpAttributesOriginatorId) BgpAttributesOriginatorId { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesOriginatorId struct { + obj *bgpAttributesOriginatorId +} + +type marshalBgpAttributesOriginatorId interface { + // ToProto marshals BgpAttributesOriginatorId to protobuf object *otg.BgpAttributesOriginatorId + ToProto() (*otg.BgpAttributesOriginatorId, error) + // ToPbText marshals BgpAttributesOriginatorId to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesOriginatorId to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesOriginatorId to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesOriginatorId struct { + obj *bgpAttributesOriginatorId +} + +type unMarshalBgpAttributesOriginatorId interface { + // FromProto unmarshals BgpAttributesOriginatorId from protobuf object *otg.BgpAttributesOriginatorId + FromProto(msg *otg.BgpAttributesOriginatorId) (BgpAttributesOriginatorId, error) + // FromPbText unmarshals BgpAttributesOriginatorId from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesOriginatorId from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesOriginatorId from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesOriginatorId) Marshal() marshalBgpAttributesOriginatorId { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesOriginatorId{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesOriginatorId) Unmarshal() unMarshalBgpAttributesOriginatorId { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesOriginatorId{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesOriginatorId) ToProto() (*otg.BgpAttributesOriginatorId, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesOriginatorId) FromProto(msg *otg.BgpAttributesOriginatorId) (BgpAttributesOriginatorId, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesOriginatorId) 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 *unMarshalbgpAttributesOriginatorId) 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 *marshalbgpAttributesOriginatorId) 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 *unMarshalbgpAttributesOriginatorId) 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 *marshalbgpAttributesOriginatorId) 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 *unMarshalbgpAttributesOriginatorId) 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 *bgpAttributesOriginatorId) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesOriginatorId) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesOriginatorId) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesOriginatorId) Clone() (BgpAttributesOriginatorId, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesOriginatorId() + 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 +} + +// BgpAttributesOriginatorId is optional ORIGINATOR_ID attribute (type code 9) carries the Router Id of the route's originator in the local AS. +type BgpAttributesOriginatorId interface { + Validation + // msg marshals BgpAttributesOriginatorId to protobuf object *otg.BgpAttributesOriginatorId + // and doesn't set defaults + msg() *otg.BgpAttributesOriginatorId + // setMsg unmarshals BgpAttributesOriginatorId from protobuf object *otg.BgpAttributesOriginatorId + // and doesn't set defaults + setMsg(*otg.BgpAttributesOriginatorId) BgpAttributesOriginatorId + // provides marshal interface + Marshal() marshalBgpAttributesOriginatorId + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesOriginatorId + // validate validates BgpAttributesOriginatorId + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesOriginatorId, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Value returns string, set in BgpAttributesOriginatorId. + Value() string + // SetValue assigns string provided by user to BgpAttributesOriginatorId + SetValue(value string) BgpAttributesOriginatorId + // HasValue checks if Value has been set in BgpAttributesOriginatorId + HasValue() bool +} + +// The value of the originator's Router Id. +// Value returns a string +func (obj *bgpAttributesOriginatorId) Value() string { + + return *obj.obj.Value + +} + +// The value of the originator's Router Id. +// Value returns a string +func (obj *bgpAttributesOriginatorId) HasValue() bool { + return obj.obj.Value != nil +} + +// The value of the originator's Router Id. +// SetValue sets the string value in the BgpAttributesOriginatorId object +func (obj *bgpAttributesOriginatorId) SetValue(value string) BgpAttributesOriginatorId { + + obj.obj.Value = &value + return obj +} + +func (obj *bgpAttributesOriginatorId) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv4(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesOriginatorId.Value")) + } + + } + +} + +func (obj *bgpAttributesOriginatorId) setDefault() { + if obj.obj.Value == nil { + obj.SetValue("0.0.0.0") + } + +} diff --git a/gosnappi/bgp_attributes_other_attribute.go b/gosnappi/bgp_attributes_other_attribute.go new file mode 100644 index 00000000..37cf5364 --- /dev/null +++ b/gosnappi/bgp_attributes_other_attribute.go @@ -0,0 +1,462 @@ +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" +) + +// ***** BgpAttributesOtherAttribute ***** +type bgpAttributesOtherAttribute struct { + validation + obj *otg.BgpAttributesOtherAttribute + marshaller marshalBgpAttributesOtherAttribute + unMarshaller unMarshalBgpAttributesOtherAttribute +} + +func NewBgpAttributesOtherAttribute() BgpAttributesOtherAttribute { + obj := bgpAttributesOtherAttribute{obj: &otg.BgpAttributesOtherAttribute{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesOtherAttribute) msg() *otg.BgpAttributesOtherAttribute { + return obj.obj +} + +func (obj *bgpAttributesOtherAttribute) setMsg(msg *otg.BgpAttributesOtherAttribute) BgpAttributesOtherAttribute { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesOtherAttribute struct { + obj *bgpAttributesOtherAttribute +} + +type marshalBgpAttributesOtherAttribute interface { + // ToProto marshals BgpAttributesOtherAttribute to protobuf object *otg.BgpAttributesOtherAttribute + ToProto() (*otg.BgpAttributesOtherAttribute, error) + // ToPbText marshals BgpAttributesOtherAttribute to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesOtherAttribute to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesOtherAttribute to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesOtherAttribute struct { + obj *bgpAttributesOtherAttribute +} + +type unMarshalBgpAttributesOtherAttribute interface { + // FromProto unmarshals BgpAttributesOtherAttribute from protobuf object *otg.BgpAttributesOtherAttribute + FromProto(msg *otg.BgpAttributesOtherAttribute) (BgpAttributesOtherAttribute, error) + // FromPbText unmarshals BgpAttributesOtherAttribute from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesOtherAttribute from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesOtherAttribute from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesOtherAttribute) Marshal() marshalBgpAttributesOtherAttribute { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesOtherAttribute{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesOtherAttribute) Unmarshal() unMarshalBgpAttributesOtherAttribute { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesOtherAttribute{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesOtherAttribute) ToProto() (*otg.BgpAttributesOtherAttribute, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesOtherAttribute) FromProto(msg *otg.BgpAttributesOtherAttribute) (BgpAttributesOtherAttribute, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesOtherAttribute) 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 *unMarshalbgpAttributesOtherAttribute) 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 *marshalbgpAttributesOtherAttribute) 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 *unMarshalbgpAttributesOtherAttribute) 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 *marshalbgpAttributesOtherAttribute) 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 *unMarshalbgpAttributesOtherAttribute) 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 *bgpAttributesOtherAttribute) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesOtherAttribute) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesOtherAttribute) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesOtherAttribute) Clone() (BgpAttributesOtherAttribute, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesOtherAttribute() + 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 +} + +// BgpAttributesOtherAttribute is one unknown attribute stored as hex bytes. +type BgpAttributesOtherAttribute interface { + Validation + // msg marshals BgpAttributesOtherAttribute to protobuf object *otg.BgpAttributesOtherAttribute + // and doesn't set defaults + msg() *otg.BgpAttributesOtherAttribute + // setMsg unmarshals BgpAttributesOtherAttribute from protobuf object *otg.BgpAttributesOtherAttribute + // and doesn't set defaults + setMsg(*otg.BgpAttributesOtherAttribute) BgpAttributesOtherAttribute + // provides marshal interface + Marshal() marshalBgpAttributesOtherAttribute + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesOtherAttribute + // validate validates BgpAttributesOtherAttribute + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesOtherAttribute, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // FlagOptional returns bool, set in BgpAttributesOtherAttribute. + FlagOptional() bool + // SetFlagOptional assigns bool provided by user to BgpAttributesOtherAttribute + SetFlagOptional(value bool) BgpAttributesOtherAttribute + // HasFlagOptional checks if FlagOptional has been set in BgpAttributesOtherAttribute + HasFlagOptional() bool + // FlagTransitive returns bool, set in BgpAttributesOtherAttribute. + FlagTransitive() bool + // SetFlagTransitive assigns bool provided by user to BgpAttributesOtherAttribute + SetFlagTransitive(value bool) BgpAttributesOtherAttribute + // HasFlagTransitive checks if FlagTransitive has been set in BgpAttributesOtherAttribute + HasFlagTransitive() bool + // FlagPartial returns bool, set in BgpAttributesOtherAttribute. + FlagPartial() bool + // SetFlagPartial assigns bool provided by user to BgpAttributesOtherAttribute + SetFlagPartial(value bool) BgpAttributesOtherAttribute + // HasFlagPartial checks if FlagPartial has been set in BgpAttributesOtherAttribute + HasFlagPartial() bool + // FlagExtendedLength returns bool, set in BgpAttributesOtherAttribute. + FlagExtendedLength() bool + // SetFlagExtendedLength assigns bool provided by user to BgpAttributesOtherAttribute + SetFlagExtendedLength(value bool) BgpAttributesOtherAttribute + // HasFlagExtendedLength checks if FlagExtendedLength has been set in BgpAttributesOtherAttribute + HasFlagExtendedLength() bool + // Type returns uint32, set in BgpAttributesOtherAttribute. + Type() uint32 + // SetType assigns uint32 provided by user to BgpAttributesOtherAttribute + SetType(value uint32) BgpAttributesOtherAttribute + // RawValue returns string, set in BgpAttributesOtherAttribute. + RawValue() string + // SetRawValue assigns string provided by user to BgpAttributesOtherAttribute + SetRawValue(value string) BgpAttributesOtherAttribute +} + +// Optional flag in the BGP attribute. +// FlagOptional returns a bool +func (obj *bgpAttributesOtherAttribute) FlagOptional() bool { + + return *obj.obj.FlagOptional + +} + +// Optional flag in the BGP attribute. +// FlagOptional returns a bool +func (obj *bgpAttributesOtherAttribute) HasFlagOptional() bool { + return obj.obj.FlagOptional != nil +} + +// Optional flag in the BGP attribute. +// SetFlagOptional sets the bool value in the BgpAttributesOtherAttribute object +func (obj *bgpAttributesOtherAttribute) SetFlagOptional(value bool) BgpAttributesOtherAttribute { + + obj.obj.FlagOptional = &value + return obj +} + +// Transitive flag in the BGP attribute. +// FlagTransitive returns a bool +func (obj *bgpAttributesOtherAttribute) FlagTransitive() bool { + + return *obj.obj.FlagTransitive + +} + +// Transitive flag in the BGP attribute. +// FlagTransitive returns a bool +func (obj *bgpAttributesOtherAttribute) HasFlagTransitive() bool { + return obj.obj.FlagTransitive != nil +} + +// Transitive flag in the BGP attribute. +// SetFlagTransitive sets the bool value in the BgpAttributesOtherAttribute object +func (obj *bgpAttributesOtherAttribute) SetFlagTransitive(value bool) BgpAttributesOtherAttribute { + + obj.obj.FlagTransitive = &value + return obj +} + +// Partial flag in the BGP attribute. +// FlagPartial returns a bool +func (obj *bgpAttributesOtherAttribute) FlagPartial() bool { + + return *obj.obj.FlagPartial + +} + +// Partial flag in the BGP attribute. +// FlagPartial returns a bool +func (obj *bgpAttributesOtherAttribute) HasFlagPartial() bool { + return obj.obj.FlagPartial != nil +} + +// Partial flag in the BGP attribute. +// SetFlagPartial sets the bool value in the BgpAttributesOtherAttribute object +func (obj *bgpAttributesOtherAttribute) SetFlagPartial(value bool) BgpAttributesOtherAttribute { + + obj.obj.FlagPartial = &value + return obj +} + +// Extended length flag in the BGP attribute. +// FlagExtendedLength returns a bool +func (obj *bgpAttributesOtherAttribute) FlagExtendedLength() bool { + + return *obj.obj.FlagExtendedLength + +} + +// Extended length flag in the BGP attribute. +// FlagExtendedLength returns a bool +func (obj *bgpAttributesOtherAttribute) HasFlagExtendedLength() bool { + return obj.obj.FlagExtendedLength != nil +} + +// Extended length flag in the BGP attribute. +// SetFlagExtendedLength sets the bool value in the BgpAttributesOtherAttribute object +func (obj *bgpAttributesOtherAttribute) SetFlagExtendedLength(value bool) BgpAttributesOtherAttribute { + + obj.obj.FlagExtendedLength = &value + return obj +} + +// The value of the Type field in the attribute. +// Type returns a uint32 +func (obj *bgpAttributesOtherAttribute) Type() uint32 { + + return *obj.obj.Type + +} + +// The value of the Type field in the attribute. +// SetType sets the uint32 value in the BgpAttributesOtherAttribute object +func (obj *bgpAttributesOtherAttribute) SetType(value uint32) BgpAttributesOtherAttribute { + + obj.obj.Type = &value + return obj +} + +// Contents of the value field ( the contents after the initial two bytes containing the Flags and Type field ) of the attribute in hex bytes. +// It includes the contents of length of the extended length field if included. +// RawValue returns a string +func (obj *bgpAttributesOtherAttribute) RawValue() string { + + return *obj.obj.RawValue + +} + +// Contents of the value field ( the contents after the initial two bytes containing the Flags and Type field ) of the attribute in hex bytes. +// It includes the contents of length of the extended length field if included. +// SetRawValue sets the string value in the BgpAttributesOtherAttribute object +func (obj *bgpAttributesOtherAttribute) SetRawValue(value string) BgpAttributesOtherAttribute { + + obj.obj.RawValue = &value + return obj +} + +func (obj *bgpAttributesOtherAttribute) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Type is required + if obj.obj.Type == nil { + vObj.validationErrors = append(vObj.validationErrors, "Type is required field on interface BgpAttributesOtherAttribute") + } + + // RawValue is required + if obj.obj.RawValue == nil { + vObj.validationErrors = append(vObj.validationErrors, "RawValue is required field on interface BgpAttributesOtherAttribute") + } + if obj.obj.RawValue != nil { + + err := obj.validateHex(obj.RawValue()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesOtherAttribute.RawValue")) + } + + } + +} + +func (obj *bgpAttributesOtherAttribute) setDefault() { + if obj.obj.FlagOptional == nil { + obj.SetFlagOptional(false) + } + if obj.obj.FlagTransitive == nil { + obj.SetFlagTransitive(false) + } + if obj.obj.FlagPartial == nil { + obj.SetFlagPartial(false) + } + if obj.obj.FlagExtendedLength == nil { + obj.SetFlagExtendedLength(false) + } + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy.go b/gosnappi/bgp_attributes_segment_routing_policy.go new file mode 100644 index 00000000..fcad1d37 --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy.go @@ -0,0 +1,786 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicy ***** +type bgpAttributesSegmentRoutingPolicy struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicy + marshaller marshalBgpAttributesSegmentRoutingPolicy + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicy + bindingSegmentIdentifierHolder BgpAttributesBsid + srv6BindingSegmentIdentifierHolder BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter + preferenceHolder BgpAttributesSrPolicyPreference + priorityHolder BgpAttributesSrPolicyPriority + policyNameHolder BgpAttributesSrPolicyPolicyName + policyCandidateNameHolder BgpAttributesSrPolicyPolicyCandidateName + explicitNullLabelPolicyHolder BgpAttributesSrPolicyExplicitNullPolicy + segmentListHolder BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter +} + +func NewBgpAttributesSegmentRoutingPolicy() BgpAttributesSegmentRoutingPolicy { + obj := bgpAttributesSegmentRoutingPolicy{obj: &otg.BgpAttributesSegmentRoutingPolicy{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicy) msg() *otg.BgpAttributesSegmentRoutingPolicy { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicy) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicy) BgpAttributesSegmentRoutingPolicy { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicy struct { + obj *bgpAttributesSegmentRoutingPolicy +} + +type marshalBgpAttributesSegmentRoutingPolicy interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicy to protobuf object *otg.BgpAttributesSegmentRoutingPolicy + ToProto() (*otg.BgpAttributesSegmentRoutingPolicy, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicy to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicy to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicy to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicy struct { + obj *bgpAttributesSegmentRoutingPolicy +} + +type unMarshalBgpAttributesSegmentRoutingPolicy interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicy from protobuf object *otg.BgpAttributesSegmentRoutingPolicy + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicy) (BgpAttributesSegmentRoutingPolicy, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicy from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicy from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicy from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicy) Marshal() marshalBgpAttributesSegmentRoutingPolicy { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicy{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicy) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicy { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicy{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicy) ToProto() (*otg.BgpAttributesSegmentRoutingPolicy, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicy) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicy) (BgpAttributesSegmentRoutingPolicy, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicy) 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 *unMarshalbgpAttributesSegmentRoutingPolicy) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSegmentRoutingPolicy) 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 *unMarshalbgpAttributesSegmentRoutingPolicy) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicy) 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 *unMarshalbgpAttributesSegmentRoutingPolicy) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSegmentRoutingPolicy) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicy) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicy) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicy) Clone() (BgpAttributesSegmentRoutingPolicy, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicy() + 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 +} + +func (obj *bgpAttributesSegmentRoutingPolicy) setNil() { + obj.bindingSegmentIdentifierHolder = nil + obj.srv6BindingSegmentIdentifierHolder = nil + obj.preferenceHolder = nil + obj.priorityHolder = nil + obj.policyNameHolder = nil + obj.policyCandidateNameHolder = nil + obj.explicitNullLabelPolicyHolder = nil + obj.segmentListHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSegmentRoutingPolicy is optional Segment Routing Policy information as defined in draft-ietf-idr-sr-policy-safi-02. +// This information is carried in TUNNEL_ENCAPSULATION attribute with type set to SR Policy (15). +type BgpAttributesSegmentRoutingPolicy interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicy to protobuf object *otg.BgpAttributesSegmentRoutingPolicy + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicy + // setMsg unmarshals BgpAttributesSegmentRoutingPolicy from protobuf object *otg.BgpAttributesSegmentRoutingPolicy + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicy) BgpAttributesSegmentRoutingPolicy + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicy + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicy + // validate validates BgpAttributesSegmentRoutingPolicy + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicy, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // BindingSegmentIdentifier returns BgpAttributesBsid, set in BgpAttributesSegmentRoutingPolicy. + // BgpAttributesBsid is the Binding Segment Identifier is an optional sub-tlv of type 13 that can be sent with a SR Policy + // Tunnel Encapsulation attribute. + // When the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that + // BSID if this value (label in MPLS, IPv6 address in SRv6) is available. + // - The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . + // - It is recommended that if SRv6 Binding SID is desired to be signalled, the SRv6 Binding SID sub-TLV that enables + // the specification of the SRv6 Endpoint Behavior should be used. + BindingSegmentIdentifier() BgpAttributesBsid + // SetBindingSegmentIdentifier assigns BgpAttributesBsid provided by user to BgpAttributesSegmentRoutingPolicy. + // BgpAttributesBsid is the Binding Segment Identifier is an optional sub-tlv of type 13 that can be sent with a SR Policy + // Tunnel Encapsulation attribute. + // When the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that + // BSID if this value (label in MPLS, IPv6 address in SRv6) is available. + // - The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . + // - It is recommended that if SRv6 Binding SID is desired to be signalled, the SRv6 Binding SID sub-TLV that enables + // the specification of the SRv6 Endpoint Behavior should be used. + SetBindingSegmentIdentifier(value BgpAttributesBsid) BgpAttributesSegmentRoutingPolicy + // HasBindingSegmentIdentifier checks if BindingSegmentIdentifier has been set in BgpAttributesSegmentRoutingPolicy + HasBindingSegmentIdentifier() bool + // Srv6BindingSegmentIdentifier returns BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIterIter, set in BgpAttributesSegmentRoutingPolicy + Srv6BindingSegmentIdentifier() BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter + // Preference returns BgpAttributesSrPolicyPreference, set in BgpAttributesSegmentRoutingPolicy. + // BgpAttributesSrPolicyPreference is optional Preference sub-tlv (Type 12) is used to select the best candidate path for an SR Policy. + // It is defined in Section 2.4.1 of draft-ietf-idr-sr-policy-safi-02 . + Preference() BgpAttributesSrPolicyPreference + // SetPreference assigns BgpAttributesSrPolicyPreference provided by user to BgpAttributesSegmentRoutingPolicy. + // BgpAttributesSrPolicyPreference is optional Preference sub-tlv (Type 12) is used to select the best candidate path for an SR Policy. + // It is defined in Section 2.4.1 of draft-ietf-idr-sr-policy-safi-02 . + SetPreference(value BgpAttributesSrPolicyPreference) BgpAttributesSegmentRoutingPolicy + // HasPreference checks if Preference has been set in BgpAttributesSegmentRoutingPolicy + HasPreference() bool + // Priority returns BgpAttributesSrPolicyPriority, set in BgpAttributesSegmentRoutingPolicy. + // BgpAttributesSrPolicyPriority is optional Priority sub-tlv (Type 15) used to select the order in which policies should be re-computed. + // - It is defined in Section 2.4.6 of draft-ietf-idr-sr-policy-safi-02 . + Priority() BgpAttributesSrPolicyPriority + // SetPriority assigns BgpAttributesSrPolicyPriority provided by user to BgpAttributesSegmentRoutingPolicy. + // BgpAttributesSrPolicyPriority is optional Priority sub-tlv (Type 15) used to select the order in which policies should be re-computed. + // - It is defined in Section 2.4.6 of draft-ietf-idr-sr-policy-safi-02 . + SetPriority(value BgpAttributesSrPolicyPriority) BgpAttributesSegmentRoutingPolicy + // HasPriority checks if Priority has been set in BgpAttributesSegmentRoutingPolicy + HasPriority() bool + // PolicyName returns BgpAttributesSrPolicyPolicyName, set in BgpAttributesSegmentRoutingPolicy. + // BgpAttributesSrPolicyPolicyName is optional Policy Name sub-tlv (Type 130) which carries the symbolic name for the SR Policy for which the + // candidate path is being advertised for debugging. + // - It is defined in Section 2.4.8 of draft-ietf-idr-sr-policy-safi-02 . + PolicyName() BgpAttributesSrPolicyPolicyName + // SetPolicyName assigns BgpAttributesSrPolicyPolicyName provided by user to BgpAttributesSegmentRoutingPolicy. + // BgpAttributesSrPolicyPolicyName is optional Policy Name sub-tlv (Type 130) which carries the symbolic name for the SR Policy for which the + // candidate path is being advertised for debugging. + // - It is defined in Section 2.4.8 of draft-ietf-idr-sr-policy-safi-02 . + SetPolicyName(value BgpAttributesSrPolicyPolicyName) BgpAttributesSegmentRoutingPolicy + // HasPolicyName checks if PolicyName has been set in BgpAttributesSegmentRoutingPolicy + HasPolicyName() bool + // PolicyCandidateName returns BgpAttributesSrPolicyPolicyCandidateName, set in BgpAttributesSegmentRoutingPolicy. + // BgpAttributesSrPolicyPolicyCandidateName is optional Policy Candidate Path Name sub-tlv (Type 129) which carries the symbolic name for the SR Policy candidate path + // for debugging. + // - It is defined in Section 2.4.7 of draft-ietf-idr-sr-policy-safi-02 . + PolicyCandidateName() BgpAttributesSrPolicyPolicyCandidateName + // SetPolicyCandidateName assigns BgpAttributesSrPolicyPolicyCandidateName provided by user to BgpAttributesSegmentRoutingPolicy. + // BgpAttributesSrPolicyPolicyCandidateName is optional Policy Candidate Path Name sub-tlv (Type 129) which carries the symbolic name for the SR Policy candidate path + // for debugging. + // - It is defined in Section 2.4.7 of draft-ietf-idr-sr-policy-safi-02 . + SetPolicyCandidateName(value BgpAttributesSrPolicyPolicyCandidateName) BgpAttributesSegmentRoutingPolicy + // HasPolicyCandidateName checks if PolicyCandidateName has been set in BgpAttributesSegmentRoutingPolicy + HasPolicyCandidateName() bool + // ExplicitNullLabelPolicy returns BgpAttributesSrPolicyExplicitNullPolicy, set in BgpAttributesSegmentRoutingPolicy. + // BgpAttributesSrPolicyExplicitNullPolicy is this is an optional sub-tlv (Type 14) which indicates whether an Explicit NULL Label must be pushed on an unlabeled IP + // packet before other labels for IPv4 or IPv6 flows. + // - It is defined in Section 2.4.5 of draft-ietf-idr-sr-policy-safi-02. + ExplicitNullLabelPolicy() BgpAttributesSrPolicyExplicitNullPolicy + // SetExplicitNullLabelPolicy assigns BgpAttributesSrPolicyExplicitNullPolicy provided by user to BgpAttributesSegmentRoutingPolicy. + // BgpAttributesSrPolicyExplicitNullPolicy is this is an optional sub-tlv (Type 14) which indicates whether an Explicit NULL Label must be pushed on an unlabeled IP + // packet before other labels for IPv4 or IPv6 flows. + // - It is defined in Section 2.4.5 of draft-ietf-idr-sr-policy-safi-02. + SetExplicitNullLabelPolicy(value BgpAttributesSrPolicyExplicitNullPolicy) BgpAttributesSegmentRoutingPolicy + // HasExplicitNullLabelPolicy checks if ExplicitNullLabelPolicy has been set in BgpAttributesSegmentRoutingPolicy + HasExplicitNullLabelPolicy() bool + // SegmentList returns BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIterIter, set in BgpAttributesSegmentRoutingPolicy + SegmentList() BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter + setNil() +} + +// description is TBD +// BindingSegmentIdentifier returns a BgpAttributesBsid +func (obj *bgpAttributesSegmentRoutingPolicy) BindingSegmentIdentifier() BgpAttributesBsid { + if obj.obj.BindingSegmentIdentifier == nil { + obj.obj.BindingSegmentIdentifier = NewBgpAttributesBsid().msg() + } + if obj.bindingSegmentIdentifierHolder == nil { + obj.bindingSegmentIdentifierHolder = &bgpAttributesBsid{obj: obj.obj.BindingSegmentIdentifier} + } + return obj.bindingSegmentIdentifierHolder +} + +// description is TBD +// BindingSegmentIdentifier returns a BgpAttributesBsid +func (obj *bgpAttributesSegmentRoutingPolicy) HasBindingSegmentIdentifier() bool { + return obj.obj.BindingSegmentIdentifier != nil +} + +// description is TBD +// SetBindingSegmentIdentifier sets the BgpAttributesBsid value in the BgpAttributesSegmentRoutingPolicy object +func (obj *bgpAttributesSegmentRoutingPolicy) SetBindingSegmentIdentifier(value BgpAttributesBsid) BgpAttributesSegmentRoutingPolicy { + + obj.bindingSegmentIdentifierHolder = nil + obj.obj.BindingSegmentIdentifier = value.msg() + + return obj +} + +// The SRv6 Binding SID sub-TLV is an optional sub-TLV of type 20 that is used to signal the SRv6 Binding SID +// related information of an SR Policy candidate path. +// - More than one SRv6 Binding SID sub-TLVs MAY be signaled in the same SR Policy encoding to indicate one +// or more SRv6 SIDs, each with potentially different SRv6 Endpoint Behaviors to be instantiated. +// - The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.3 . +// Srv6BindingSegmentIdentifier returns a []BgpAttributesSrv6Bsid +func (obj *bgpAttributesSegmentRoutingPolicy) Srv6BindingSegmentIdentifier() BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { + if len(obj.obj.Srv6BindingSegmentIdentifier) == 0 { + obj.obj.Srv6BindingSegmentIdentifier = []*otg.BgpAttributesSrv6Bsid{} + } + if obj.srv6BindingSegmentIdentifierHolder == nil { + obj.srv6BindingSegmentIdentifierHolder = newBgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter(&obj.obj.Srv6BindingSegmentIdentifier).setMsg(obj) + } + return obj.srv6BindingSegmentIdentifierHolder +} + +type bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter struct { + obj *bgpAttributesSegmentRoutingPolicy + bgpAttributesSrv6BsidSlice []BgpAttributesSrv6Bsid + fieldPtr *[]*otg.BgpAttributesSrv6Bsid +} + +func newBgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter(ptr *[]*otg.BgpAttributesSrv6Bsid) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { + return &bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter{fieldPtr: ptr} +} + +type BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter interface { + setMsg(*bgpAttributesSegmentRoutingPolicy) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter + Items() []BgpAttributesSrv6Bsid + Add() BgpAttributesSrv6Bsid + Append(items ...BgpAttributesSrv6Bsid) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter + Set(index int, newObj BgpAttributesSrv6Bsid) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter + Clear() BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter + clearHolderSlice() BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter + appendHolderSlice(item BgpAttributesSrv6Bsid) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter +} + +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) setMsg(msg *bgpAttributesSegmentRoutingPolicy) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpAttributesSrv6Bsid{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) Items() []BgpAttributesSrv6Bsid { + return obj.bgpAttributesSrv6BsidSlice +} + +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) Add() BgpAttributesSrv6Bsid { + newObj := &otg.BgpAttributesSrv6Bsid{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpAttributesSrv6Bsid{obj: newObj} + newLibObj.setDefault() + obj.bgpAttributesSrv6BsidSlice = append(obj.bgpAttributesSrv6BsidSlice, newLibObj) + return newLibObj +} + +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) Append(items ...BgpAttributesSrv6Bsid) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpAttributesSrv6BsidSlice = append(obj.bgpAttributesSrv6BsidSlice, item) + } + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) Set(index int, newObj BgpAttributesSrv6Bsid) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpAttributesSrv6BsidSlice[index] = newObj + return obj +} +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) Clear() BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpAttributesSrv6Bsid{} + obj.bgpAttributesSrv6BsidSlice = []BgpAttributesSrv6Bsid{} + } + return obj +} +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) clearHolderSlice() BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { + if len(obj.bgpAttributesSrv6BsidSlice) > 0 { + obj.bgpAttributesSrv6BsidSlice = []BgpAttributesSrv6Bsid{} + } + return obj +} +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) appendHolderSlice(item BgpAttributesSrv6Bsid) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { + obj.bgpAttributesSrv6BsidSlice = append(obj.bgpAttributesSrv6BsidSlice, item) + return obj +} + +// description is TBD +// Preference returns a BgpAttributesSrPolicyPreference +func (obj *bgpAttributesSegmentRoutingPolicy) Preference() BgpAttributesSrPolicyPreference { + if obj.obj.Preference == nil { + obj.obj.Preference = NewBgpAttributesSrPolicyPreference().msg() + } + if obj.preferenceHolder == nil { + obj.preferenceHolder = &bgpAttributesSrPolicyPreference{obj: obj.obj.Preference} + } + return obj.preferenceHolder +} + +// description is TBD +// Preference returns a BgpAttributesSrPolicyPreference +func (obj *bgpAttributesSegmentRoutingPolicy) HasPreference() bool { + return obj.obj.Preference != nil +} + +// description is TBD +// SetPreference sets the BgpAttributesSrPolicyPreference value in the BgpAttributesSegmentRoutingPolicy object +func (obj *bgpAttributesSegmentRoutingPolicy) SetPreference(value BgpAttributesSrPolicyPreference) BgpAttributesSegmentRoutingPolicy { + + obj.preferenceHolder = nil + obj.obj.Preference = value.msg() + + return obj +} + +// description is TBD +// Priority returns a BgpAttributesSrPolicyPriority +func (obj *bgpAttributesSegmentRoutingPolicy) Priority() BgpAttributesSrPolicyPriority { + if obj.obj.Priority == nil { + obj.obj.Priority = NewBgpAttributesSrPolicyPriority().msg() + } + if obj.priorityHolder == nil { + obj.priorityHolder = &bgpAttributesSrPolicyPriority{obj: obj.obj.Priority} + } + return obj.priorityHolder +} + +// description is TBD +// Priority returns a BgpAttributesSrPolicyPriority +func (obj *bgpAttributesSegmentRoutingPolicy) HasPriority() bool { + return obj.obj.Priority != nil +} + +// description is TBD +// SetPriority sets the BgpAttributesSrPolicyPriority value in the BgpAttributesSegmentRoutingPolicy object +func (obj *bgpAttributesSegmentRoutingPolicy) SetPriority(value BgpAttributesSrPolicyPriority) BgpAttributesSegmentRoutingPolicy { + + obj.priorityHolder = nil + obj.obj.Priority = value.msg() + + return obj +} + +// description is TBD +// PolicyName returns a BgpAttributesSrPolicyPolicyName +func (obj *bgpAttributesSegmentRoutingPolicy) PolicyName() BgpAttributesSrPolicyPolicyName { + if obj.obj.PolicyName == nil { + obj.obj.PolicyName = NewBgpAttributesSrPolicyPolicyName().msg() + } + if obj.policyNameHolder == nil { + obj.policyNameHolder = &bgpAttributesSrPolicyPolicyName{obj: obj.obj.PolicyName} + } + return obj.policyNameHolder +} + +// description is TBD +// PolicyName returns a BgpAttributesSrPolicyPolicyName +func (obj *bgpAttributesSegmentRoutingPolicy) HasPolicyName() bool { + return obj.obj.PolicyName != nil +} + +// description is TBD +// SetPolicyName sets the BgpAttributesSrPolicyPolicyName value in the BgpAttributesSegmentRoutingPolicy object +func (obj *bgpAttributesSegmentRoutingPolicy) SetPolicyName(value BgpAttributesSrPolicyPolicyName) BgpAttributesSegmentRoutingPolicy { + + obj.policyNameHolder = nil + obj.obj.PolicyName = value.msg() + + return obj +} + +// description is TBD +// PolicyCandidateName returns a BgpAttributesSrPolicyPolicyCandidateName +func (obj *bgpAttributesSegmentRoutingPolicy) PolicyCandidateName() BgpAttributesSrPolicyPolicyCandidateName { + if obj.obj.PolicyCandidateName == nil { + obj.obj.PolicyCandidateName = NewBgpAttributesSrPolicyPolicyCandidateName().msg() + } + if obj.policyCandidateNameHolder == nil { + obj.policyCandidateNameHolder = &bgpAttributesSrPolicyPolicyCandidateName{obj: obj.obj.PolicyCandidateName} + } + return obj.policyCandidateNameHolder +} + +// description is TBD +// PolicyCandidateName returns a BgpAttributesSrPolicyPolicyCandidateName +func (obj *bgpAttributesSegmentRoutingPolicy) HasPolicyCandidateName() bool { + return obj.obj.PolicyCandidateName != nil +} + +// description is TBD +// SetPolicyCandidateName sets the BgpAttributesSrPolicyPolicyCandidateName value in the BgpAttributesSegmentRoutingPolicy object +func (obj *bgpAttributesSegmentRoutingPolicy) SetPolicyCandidateName(value BgpAttributesSrPolicyPolicyCandidateName) BgpAttributesSegmentRoutingPolicy { + + obj.policyCandidateNameHolder = nil + obj.obj.PolicyCandidateName = value.msg() + + return obj +} + +// description is TBD +// ExplicitNullLabelPolicy returns a BgpAttributesSrPolicyExplicitNullPolicy +func (obj *bgpAttributesSegmentRoutingPolicy) ExplicitNullLabelPolicy() BgpAttributesSrPolicyExplicitNullPolicy { + if obj.obj.ExplicitNullLabelPolicy == nil { + obj.obj.ExplicitNullLabelPolicy = NewBgpAttributesSrPolicyExplicitNullPolicy().msg() + } + if obj.explicitNullLabelPolicyHolder == nil { + obj.explicitNullLabelPolicyHolder = &bgpAttributesSrPolicyExplicitNullPolicy{obj: obj.obj.ExplicitNullLabelPolicy} + } + return obj.explicitNullLabelPolicyHolder +} + +// description is TBD +// ExplicitNullLabelPolicy returns a BgpAttributesSrPolicyExplicitNullPolicy +func (obj *bgpAttributesSegmentRoutingPolicy) HasExplicitNullLabelPolicy() bool { + return obj.obj.ExplicitNullLabelPolicy != nil +} + +// description is TBD +// SetExplicitNullLabelPolicy sets the BgpAttributesSrPolicyExplicitNullPolicy value in the BgpAttributesSegmentRoutingPolicy object +func (obj *bgpAttributesSegmentRoutingPolicy) SetExplicitNullLabelPolicy(value BgpAttributesSrPolicyExplicitNullPolicy) BgpAttributesSegmentRoutingPolicy { + + obj.explicitNullLabelPolicyHolder = nil + obj.obj.ExplicitNullLabelPolicy = value.msg() + + return obj +} + +// description is TBD +// SegmentList returns a []BgpAttributesSrPolicySegmentList +func (obj *bgpAttributesSegmentRoutingPolicy) SegmentList() BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { + if len(obj.obj.SegmentList) == 0 { + obj.obj.SegmentList = []*otg.BgpAttributesSrPolicySegmentList{} + } + if obj.segmentListHolder == nil { + obj.segmentListHolder = newBgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter(&obj.obj.SegmentList).setMsg(obj) + } + return obj.segmentListHolder +} + +type bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter struct { + obj *bgpAttributesSegmentRoutingPolicy + bgpAttributesSrPolicySegmentListSlice []BgpAttributesSrPolicySegmentList + fieldPtr *[]*otg.BgpAttributesSrPolicySegmentList +} + +func newBgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter(ptr *[]*otg.BgpAttributesSrPolicySegmentList) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { + return &bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter{fieldPtr: ptr} +} + +type BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter interface { + setMsg(*bgpAttributesSegmentRoutingPolicy) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter + Items() []BgpAttributesSrPolicySegmentList + Add() BgpAttributesSrPolicySegmentList + Append(items ...BgpAttributesSrPolicySegmentList) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter + Set(index int, newObj BgpAttributesSrPolicySegmentList) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter + Clear() BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter + clearHolderSlice() BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter + appendHolderSlice(item BgpAttributesSrPolicySegmentList) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter +} + +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) setMsg(msg *bgpAttributesSegmentRoutingPolicy) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpAttributesSrPolicySegmentList{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) Items() []BgpAttributesSrPolicySegmentList { + return obj.bgpAttributesSrPolicySegmentListSlice +} + +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) Add() BgpAttributesSrPolicySegmentList { + newObj := &otg.BgpAttributesSrPolicySegmentList{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpAttributesSrPolicySegmentList{obj: newObj} + newLibObj.setDefault() + obj.bgpAttributesSrPolicySegmentListSlice = append(obj.bgpAttributesSrPolicySegmentListSlice, newLibObj) + return newLibObj +} + +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) Append(items ...BgpAttributesSrPolicySegmentList) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpAttributesSrPolicySegmentListSlice = append(obj.bgpAttributesSrPolicySegmentListSlice, item) + } + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) Set(index int, newObj BgpAttributesSrPolicySegmentList) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpAttributesSrPolicySegmentListSlice[index] = newObj + return obj +} +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) Clear() BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpAttributesSrPolicySegmentList{} + obj.bgpAttributesSrPolicySegmentListSlice = []BgpAttributesSrPolicySegmentList{} + } + return obj +} +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) clearHolderSlice() BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { + if len(obj.bgpAttributesSrPolicySegmentListSlice) > 0 { + obj.bgpAttributesSrPolicySegmentListSlice = []BgpAttributesSrPolicySegmentList{} + } + return obj +} +func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) appendHolderSlice(item BgpAttributesSrPolicySegmentList) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { + obj.bgpAttributesSrPolicySegmentListSlice = append(obj.bgpAttributesSrPolicySegmentListSlice, item) + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicy) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.BindingSegmentIdentifier != nil { + + obj.BindingSegmentIdentifier().validateObj(vObj, set_default) + } + + if len(obj.obj.Srv6BindingSegmentIdentifier) != 0 { + + if set_default { + obj.Srv6BindingSegmentIdentifier().clearHolderSlice() + for _, item := range obj.obj.Srv6BindingSegmentIdentifier { + obj.Srv6BindingSegmentIdentifier().appendHolderSlice(&bgpAttributesSrv6Bsid{obj: item}) + } + } + for _, item := range obj.Srv6BindingSegmentIdentifier().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Preference != nil { + + obj.Preference().validateObj(vObj, set_default) + } + + if obj.obj.Priority != nil { + + obj.Priority().validateObj(vObj, set_default) + } + + if obj.obj.PolicyName != nil { + + obj.PolicyName().validateObj(vObj, set_default) + } + + if obj.obj.PolicyCandidateName != nil { + + obj.PolicyCandidateName().validateObj(vObj, set_default) + } + + if obj.obj.ExplicitNullLabelPolicy != nil { + + obj.ExplicitNullLabelPolicy().validateObj(vObj, set_default) + } + + if len(obj.obj.SegmentList) != 0 { + + if set_default { + obj.SegmentList().clearHolderSlice() + for _, item := range obj.obj.SegmentList { + obj.SegmentList().appendHolderSlice(&bgpAttributesSrPolicySegmentList{obj: item}) + } + } + for _, item := range obj.SegmentList().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicy) setDefault() { + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_s_rv6_sid_endpoint_behavior_and_structure.go b/gosnappi/bgp_attributes_segment_routing_policy_s_rv6_sid_endpoint_behavior_and_structure.go new file mode 100644 index 00000000..54241fd5 --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_s_rv6_sid_endpoint_behavior_and_structure.go @@ -0,0 +1,494 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure ***** +type bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + marshaller marshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +} + +func NewBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + obj := bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: &otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) msg() *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure struct { + obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +} + +type marshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure to protobuf object *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + ToProto() (*otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure struct { + obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +} + +type unMarshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure from protobuf object *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) (BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) Marshal() marshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) ToProto() (*otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) (BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) 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 *unMarshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) 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 *marshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) 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 *unMarshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) 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 *marshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) 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 *unMarshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) 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 *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) Clone() (BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure() + 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 +} + +// BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 +type BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure to protobuf object *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // setMsg unmarshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure from protobuf object *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // validate validates BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // EndpointBehaviour returns string, set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure. + EndpointBehaviour() string + // SetEndpointBehaviour assigns string provided by user to BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + SetEndpointBehaviour(value string) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // HasEndpointBehaviour checks if EndpointBehaviour has been set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + HasEndpointBehaviour() bool + // LbLength returns uint32, set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure. + LbLength() uint32 + // SetLbLength assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + SetLbLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // HasLbLength checks if LbLength has been set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + HasLbLength() bool + // LnLength returns uint32, set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure. + LnLength() uint32 + // SetLnLength assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + SetLnLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // HasLnLength checks if LnLength has been set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + HasLnLength() bool + // FuncLength returns uint32, set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure. + FuncLength() uint32 + // SetFuncLength assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + SetFuncLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // HasFuncLength checks if FuncLength has been set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + HasFuncLength() bool + // ArgLength returns uint32, set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure. + ArgLength() uint32 + // SetArgLength assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + SetArgLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // HasArgLength checks if ArgLength has been set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + HasArgLength() bool +} + +// This is a 2-octet field that is used to specify the SRv6 Endpoint Behavior code point for the SRv6 SID as defined +// in section 9.2 of [RFC8986]. When set with the value 0xFFFF (i.e., Opaque), the choice of SRv6 Endpoint Behavior is +// left to the headend. Well known 16-bit values for this field are available at +// https://www.iana.org/assignments/segment-routing/segment-routing.xhtml . +// EndpointBehaviour returns a string +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) EndpointBehaviour() string { + + return *obj.obj.EndpointBehaviour + +} + +// This is a 2-octet field that is used to specify the SRv6 Endpoint Behavior code point for the SRv6 SID as defined +// in section 9.2 of [RFC8986]. When set with the value 0xFFFF (i.e., Opaque), the choice of SRv6 Endpoint Behavior is +// left to the headend. Well known 16-bit values for this field are available at +// https://www.iana.org/assignments/segment-routing/segment-routing.xhtml . +// EndpointBehaviour returns a string +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) HasEndpointBehaviour() bool { + return obj.obj.EndpointBehaviour != nil +} + +// This is a 2-octet field that is used to specify the SRv6 Endpoint Behavior code point for the SRv6 SID as defined +// in section 9.2 of [RFC8986]. When set with the value 0xFFFF (i.e., Opaque), the choice of SRv6 Endpoint Behavior is +// left to the headend. Well known 16-bit values for this field are available at +// https://www.iana.org/assignments/segment-routing/segment-routing.xhtml . +// SetEndpointBehaviour sets the string value in the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure object +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) SetEndpointBehaviour(value string) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + + obj.obj.EndpointBehaviour = &value + return obj +} + +// SRv6 SID Locator Block length in bits. +// LbLength returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) LbLength() uint32 { + + return *obj.obj.LbLength + +} + +// SRv6 SID Locator Block length in bits. +// LbLength returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) HasLbLength() bool { + return obj.obj.LbLength != nil +} + +// SRv6 SID Locator Block length in bits. +// SetLbLength sets the uint32 value in the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure object +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) SetLbLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + + obj.obj.LbLength = &value + return obj +} + +// SRv6 SID Locator Node length in bits. +// LnLength returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) LnLength() uint32 { + + return *obj.obj.LnLength + +} + +// SRv6 SID Locator Node length in bits. +// LnLength returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) HasLnLength() bool { + return obj.obj.LnLength != nil +} + +// SRv6 SID Locator Node length in bits. +// SetLnLength sets the uint32 value in the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure object +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) SetLnLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + + obj.obj.LnLength = &value + return obj +} + +// SRv6 SID Function length in bits. +// FuncLength returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) FuncLength() uint32 { + + return *obj.obj.FuncLength + +} + +// SRv6 SID Function length in bits. +// FuncLength returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) HasFuncLength() bool { + return obj.obj.FuncLength != nil +} + +// SRv6 SID Function length in bits. +// SetFuncLength sets the uint32 value in the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure object +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) SetFuncLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + + obj.obj.FuncLength = &value + return obj +} + +// SRv6 SID Arguments length in bits. +// ArgLength returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) ArgLength() uint32 { + + return *obj.obj.ArgLength + +} + +// SRv6 SID Arguments length in bits. +// ArgLength returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) HasArgLength() bool { + return obj.obj.ArgLength != nil +} + +// SRv6 SID Arguments length in bits. +// SetArgLength sets the uint32 value in the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure object +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) SetArgLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + + obj.obj.ArgLength = &value + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.EndpointBehaviour != nil { + + if len(*obj.obj.EndpointBehaviour) > 4 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "None <= length of BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure.EndpointBehaviour <= 4 but Got %d", + len(*obj.obj.EndpointBehaviour))) + } + + } + + if obj.obj.LbLength != nil { + + if *obj.obj.LbLength > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure.LbLength <= 128 but Got %d", *obj.obj.LbLength)) + } + + } + + if obj.obj.LnLength != nil { + + if *obj.obj.LnLength > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure.LnLength <= 128 but Got %d", *obj.obj.LnLength)) + } + + } + + if obj.obj.FuncLength != nil { + + if *obj.obj.FuncLength > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure.FuncLength <= 128 but Got %d", *obj.obj.FuncLength)) + } + + } + + if obj.obj.ArgLength != nil { + + if *obj.obj.ArgLength > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure.ArgLength <= 128 but Got %d", *obj.obj.ArgLength)) + } + + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) setDefault() { + if obj.obj.EndpointBehaviour == nil { + obj.SetEndpointBehaviour("ffff") + } + if obj.obj.LbLength == nil { + obj.SetLbLength(0) + } + if obj.obj.LnLength == nil { + obj.SetLnLength(0) + } + if obj.obj.FuncLength == nil { + obj.SetFuncLength(0) + } + if obj.obj.ArgLength == nil { + obj.SetArgLength(0) + } + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_segment_list_segment.go b/gosnappi/bgp_attributes_segment_routing_policy_segment_list_segment.go new file mode 100644 index 00000000..d05892b9 --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_segment_list_segment.go @@ -0,0 +1,972 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicySegmentListSegment ***** +type bgpAttributesSegmentRoutingPolicySegmentListSegment struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment + marshaller marshalBgpAttributesSegmentRoutingPolicySegmentListSegment + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicySegmentListSegment + typeAHolder BgpAttributesSegmentRoutingPolicyTypeA + typeBHolder BgpAttributesSegmentRoutingPolicyTypeB + typeCHolder BgpAttributesSegmentRoutingPolicyTypeC + typeDHolder BgpAttributesSegmentRoutingPolicyTypeD + typeEHolder BgpAttributesSegmentRoutingPolicyTypeE + typeFHolder BgpAttributesSegmentRoutingPolicyTypeF + typeGHolder BgpAttributesSegmentRoutingPolicyTypeG + typeHHolder BgpAttributesSegmentRoutingPolicyTypeH + typeIHolder BgpAttributesSegmentRoutingPolicyTypeI + typeJHolder BgpAttributesSegmentRoutingPolicyTypeJ + typeKHolder BgpAttributesSegmentRoutingPolicyTypeK +} + +func NewBgpAttributesSegmentRoutingPolicySegmentListSegment() BgpAttributesSegmentRoutingPolicySegmentListSegment { + obj := bgpAttributesSegmentRoutingPolicySegmentListSegment{obj: &otg.BgpAttributesSegmentRoutingPolicySegmentListSegment{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) msg() *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSegmentRoutingPolicySegmentListSegment { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicySegmentListSegment struct { + obj *bgpAttributesSegmentRoutingPolicySegmentListSegment +} + +type marshalBgpAttributesSegmentRoutingPolicySegmentListSegment interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicySegmentListSegment to protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment + ToProto() (*otg.BgpAttributesSegmentRoutingPolicySegmentListSegment, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicySegmentListSegment to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicySegmentListSegment to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicySegmentListSegment to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicySegmentListSegment struct { + obj *bgpAttributesSegmentRoutingPolicySegmentListSegment +} + +type unMarshalBgpAttributesSegmentRoutingPolicySegmentListSegment interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicySegmentListSegment from protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment) (BgpAttributesSegmentRoutingPolicySegmentListSegment, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicySegmentListSegment from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicySegmentListSegment from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicySegmentListSegment from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) Marshal() marshalBgpAttributesSegmentRoutingPolicySegmentListSegment { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicySegmentListSegment{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicySegmentListSegment { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicySegmentListSegment{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicySegmentListSegment) ToProto() (*otg.BgpAttributesSegmentRoutingPolicySegmentListSegment, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicySegmentListSegment) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment) (BgpAttributesSegmentRoutingPolicySegmentListSegment, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicySegmentListSegment) 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 *unMarshalbgpAttributesSegmentRoutingPolicySegmentListSegment) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSegmentRoutingPolicySegmentListSegment) 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 *unMarshalbgpAttributesSegmentRoutingPolicySegmentListSegment) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicySegmentListSegment) 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 *unMarshalbgpAttributesSegmentRoutingPolicySegmentListSegment) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) Clone() (BgpAttributesSegmentRoutingPolicySegmentListSegment, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicySegmentListSegment() + 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 +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) setNil() { + obj.typeAHolder = nil + obj.typeBHolder = nil + obj.typeCHolder = nil + obj.typeDHolder = nil + obj.typeEHolder = nil + obj.typeFHolder = nil + obj.typeGHolder = nil + obj.typeHHolder = nil + obj.typeIHolder = nil + obj.typeJHolder = nil + obj.typeKHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSegmentRoutingPolicySegmentListSegment is a Segment sub-TLV describes a single segment in a segment list i.e., a single +// element of the explicit path. The Segment sub-TLVs are optional. +// Segment Types A and B are defined as described in 2.4.4.2. +// Segment Types C upto K are defined as described in in draft-ietf-idr-bgp-sr-segtypes-ext-03 . +type BgpAttributesSegmentRoutingPolicySegmentListSegment interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicySegmentListSegment to protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment + // setMsg unmarshals BgpAttributesSegmentRoutingPolicySegmentListSegment from protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSegmentRoutingPolicySegmentListSegment + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicySegmentListSegment + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicySegmentListSegment + // validate validates BgpAttributesSegmentRoutingPolicySegmentListSegment + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicySegmentListSegment, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum, set in BgpAttributesSegmentRoutingPolicySegmentListSegment + Choice() BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum + // setChoice assigns BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment + setChoice(value BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum) BgpAttributesSegmentRoutingPolicySegmentListSegment + // TypeA returns BgpAttributesSegmentRoutingPolicyTypeA, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeA is type A: SID only, in the form of MPLS Label. + // It is encoded as a Segment of Type 1 in the SEGMENT_LIST sub-tlv. + TypeA() BgpAttributesSegmentRoutingPolicyTypeA + // SetTypeA assigns BgpAttributesSegmentRoutingPolicyTypeA provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeA is type A: SID only, in the form of MPLS Label. + // It is encoded as a Segment of Type 1 in the SEGMENT_LIST sub-tlv. + SetTypeA(value BgpAttributesSegmentRoutingPolicyTypeA) BgpAttributesSegmentRoutingPolicySegmentListSegment + // HasTypeA checks if TypeA has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment + HasTypeA() bool + // TypeB returns BgpAttributesSegmentRoutingPolicyTypeB, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeB is type B: SID only, in the form of IPv6 address. + // It is encoded as a Segment of Type 13 in the SEGMENT_LIST sub-tlv. + TypeB() BgpAttributesSegmentRoutingPolicyTypeB + // SetTypeB assigns BgpAttributesSegmentRoutingPolicyTypeB provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeB is type B: SID only, in the form of IPv6 address. + // It is encoded as a Segment of Type 13 in the SEGMENT_LIST sub-tlv. + SetTypeB(value BgpAttributesSegmentRoutingPolicyTypeB) BgpAttributesSegmentRoutingPolicySegmentListSegment + // HasTypeB checks if TypeB has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment + HasTypeB() bool + // TypeC returns BgpAttributesSegmentRoutingPolicyTypeC, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeC is type C: IPv4 Node Address with optional SID. + // It is encoded as a Segment of Type 3 in the SEGMENT_LIST sub-tlv. + TypeC() BgpAttributesSegmentRoutingPolicyTypeC + // SetTypeC assigns BgpAttributesSegmentRoutingPolicyTypeC provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeC is type C: IPv4 Node Address with optional SID. + // It is encoded as a Segment of Type 3 in the SEGMENT_LIST sub-tlv. + SetTypeC(value BgpAttributesSegmentRoutingPolicyTypeC) BgpAttributesSegmentRoutingPolicySegmentListSegment + // HasTypeC checks if TypeC has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment + HasTypeC() bool + // TypeD returns BgpAttributesSegmentRoutingPolicyTypeD, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeD is type D: IPv6 Node Address with optional SID for SR MPLS. + // It is encoded as a Segment of Type 4 in the SEGMENT_LIST sub-tlv. + TypeD() BgpAttributesSegmentRoutingPolicyTypeD + // SetTypeD assigns BgpAttributesSegmentRoutingPolicyTypeD provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeD is type D: IPv6 Node Address with optional SID for SR MPLS. + // It is encoded as a Segment of Type 4 in the SEGMENT_LIST sub-tlv. + SetTypeD(value BgpAttributesSegmentRoutingPolicyTypeD) BgpAttributesSegmentRoutingPolicySegmentListSegment + // HasTypeD checks if TypeD has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment + HasTypeD() bool + // TypeE returns BgpAttributesSegmentRoutingPolicyTypeE, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeE is type E: IPv4 Address and Local Interface ID with optional SID + // It is encoded as a Segment of Type 5 in the SEGMENT_LIST sub-tlv. + TypeE() BgpAttributesSegmentRoutingPolicyTypeE + // SetTypeE assigns BgpAttributesSegmentRoutingPolicyTypeE provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeE is type E: IPv4 Address and Local Interface ID with optional SID + // It is encoded as a Segment of Type 5 in the SEGMENT_LIST sub-tlv. + SetTypeE(value BgpAttributesSegmentRoutingPolicyTypeE) BgpAttributesSegmentRoutingPolicySegmentListSegment + // HasTypeE checks if TypeE has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment + HasTypeE() bool + // TypeF returns BgpAttributesSegmentRoutingPolicyTypeF, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeF is type F: IPv4 Local and Remote addresses with optional SR-MPLS SID. + // It is encoded as a Segment of Type 6 in the SEGMENT_LIST sub-tlv. + TypeF() BgpAttributesSegmentRoutingPolicyTypeF + // SetTypeF assigns BgpAttributesSegmentRoutingPolicyTypeF provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeF is type F: IPv4 Local and Remote addresses with optional SR-MPLS SID. + // It is encoded as a Segment of Type 6 in the SEGMENT_LIST sub-tlv. + SetTypeF(value BgpAttributesSegmentRoutingPolicyTypeF) BgpAttributesSegmentRoutingPolicySegmentListSegment + // HasTypeF checks if TypeF has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment + HasTypeF() bool + // TypeG returns BgpAttributesSegmentRoutingPolicyTypeG, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeG is type G: IPv6 Address, Interface ID for local and remote pair with optional SID for SR MPLS. + // It is encoded as a Segment of Type 7 in the SEGMENT_LIST sub-tlv. + TypeG() BgpAttributesSegmentRoutingPolicyTypeG + // SetTypeG assigns BgpAttributesSegmentRoutingPolicyTypeG provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeG is type G: IPv6 Address, Interface ID for local and remote pair with optional SID for SR MPLS. + // It is encoded as a Segment of Type 7 in the SEGMENT_LIST sub-tlv. + SetTypeG(value BgpAttributesSegmentRoutingPolicyTypeG) BgpAttributesSegmentRoutingPolicySegmentListSegment + // HasTypeG checks if TypeG has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment + HasTypeG() bool + // TypeH returns BgpAttributesSegmentRoutingPolicyTypeH, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeH is type H: IPv6 Local and Remote addresses with optional SID for SR MPLS. + // It is encoded as a Segment of Type 8 in the SEGMENT_LIST sub-tlv. + TypeH() BgpAttributesSegmentRoutingPolicyTypeH + // SetTypeH assigns BgpAttributesSegmentRoutingPolicyTypeH provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeH is type H: IPv6 Local and Remote addresses with optional SID for SR MPLS. + // It is encoded as a Segment of Type 8 in the SEGMENT_LIST sub-tlv. + SetTypeH(value BgpAttributesSegmentRoutingPolicyTypeH) BgpAttributesSegmentRoutingPolicySegmentListSegment + // HasTypeH checks if TypeH has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment + HasTypeH() bool + // TypeI returns BgpAttributesSegmentRoutingPolicyTypeI, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeI is type I: IPv6 Node Address with optional SR Algorithm and optional SRv6 SID. + // It is encoded as a Segment of Type 14 in the SEGMENT_LIST sub-tlv. + TypeI() BgpAttributesSegmentRoutingPolicyTypeI + // SetTypeI assigns BgpAttributesSegmentRoutingPolicyTypeI provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeI is type I: IPv6 Node Address with optional SR Algorithm and optional SRv6 SID. + // It is encoded as a Segment of Type 14 in the SEGMENT_LIST sub-tlv. + SetTypeI(value BgpAttributesSegmentRoutingPolicyTypeI) BgpAttributesSegmentRoutingPolicySegmentListSegment + // HasTypeI checks if TypeI has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment + HasTypeI() bool + // TypeJ returns BgpAttributesSegmentRoutingPolicyTypeJ, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeJ is type J: IPv6 Address, Interface ID for local and remote pair for SRv6 with optional SID. + // It is encoded as a Segment of Type 15 in the SEGMENT_LIST sub-tlv. + TypeJ() BgpAttributesSegmentRoutingPolicyTypeJ + // SetTypeJ assigns BgpAttributesSegmentRoutingPolicyTypeJ provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeJ is type J: IPv6 Address, Interface ID for local and remote pair for SRv6 with optional SID. + // It is encoded as a Segment of Type 15 in the SEGMENT_LIST sub-tlv. + SetTypeJ(value BgpAttributesSegmentRoutingPolicyTypeJ) BgpAttributesSegmentRoutingPolicySegmentListSegment + // HasTypeJ checks if TypeJ has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment + HasTypeJ() bool + // TypeK returns BgpAttributesSegmentRoutingPolicyTypeK, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeK is type K: IPv6 Local and Remote addresses for SRv6 with optional SID. + // It is encoded as a Segment of Type 16 in the SEGMENT_LIST sub-tlv. + TypeK() BgpAttributesSegmentRoutingPolicyTypeK + // SetTypeK assigns BgpAttributesSegmentRoutingPolicyTypeK provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. + // BgpAttributesSegmentRoutingPolicyTypeK is type K: IPv6 Local and Remote addresses for SRv6 with optional SID. + // It is encoded as a Segment of Type 16 in the SEGMENT_LIST sub-tlv. + SetTypeK(value BgpAttributesSegmentRoutingPolicyTypeK) BgpAttributesSegmentRoutingPolicySegmentListSegment + // HasTypeK checks if TypeK has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment + HasTypeK() bool + setNil() +} + +type BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum string + +// Enum of Choice on BgpAttributesSegmentRoutingPolicySegmentListSegment +var BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice = struct { + TYPE_A BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum + TYPE_B BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum + TYPE_C BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum + TYPE_D BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum + TYPE_E BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum + TYPE_F BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum + TYPE_G BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum + TYPE_H BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum + TYPE_I BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum + TYPE_J BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum + TYPE_K BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum +}{ + TYPE_A: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_a"), + TYPE_B: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_b"), + TYPE_C: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_c"), + TYPE_D: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_d"), + TYPE_E: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_e"), + TYPE_F: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_f"), + TYPE_G: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_g"), + TYPE_H: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_h"), + TYPE_I: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_i"), + TYPE_J: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_j"), + TYPE_K: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_k"), +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) Choice() BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum { + return BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) setChoice(value BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum) BgpAttributesSegmentRoutingPolicySegmentListSegment { + intValue, ok := otg.BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.TypeK = nil + obj.typeKHolder = nil + obj.obj.TypeJ = nil + obj.typeJHolder = nil + obj.obj.TypeI = nil + obj.typeIHolder = nil + obj.obj.TypeH = nil + obj.typeHHolder = nil + obj.obj.TypeG = nil + obj.typeGHolder = nil + obj.obj.TypeF = nil + obj.typeFHolder = nil + obj.obj.TypeE = nil + obj.typeEHolder = nil + obj.obj.TypeD = nil + obj.typeDHolder = nil + obj.obj.TypeC = nil + obj.typeCHolder = nil + obj.obj.TypeB = nil + obj.typeBHolder = nil + obj.obj.TypeA = nil + obj.typeAHolder = nil + + if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_A { + obj.obj.TypeA = NewBgpAttributesSegmentRoutingPolicyTypeA().msg() + } + + if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_B { + obj.obj.TypeB = NewBgpAttributesSegmentRoutingPolicyTypeB().msg() + } + + if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_C { + obj.obj.TypeC = NewBgpAttributesSegmentRoutingPolicyTypeC().msg() + } + + if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_D { + obj.obj.TypeD = NewBgpAttributesSegmentRoutingPolicyTypeD().msg() + } + + if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_E { + obj.obj.TypeE = NewBgpAttributesSegmentRoutingPolicyTypeE().msg() + } + + if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_F { + obj.obj.TypeF = NewBgpAttributesSegmentRoutingPolicyTypeF().msg() + } + + if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_G { + obj.obj.TypeG = NewBgpAttributesSegmentRoutingPolicyTypeG().msg() + } + + if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_H { + obj.obj.TypeH = NewBgpAttributesSegmentRoutingPolicyTypeH().msg() + } + + if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_I { + obj.obj.TypeI = NewBgpAttributesSegmentRoutingPolicyTypeI().msg() + } + + if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_J { + obj.obj.TypeJ = NewBgpAttributesSegmentRoutingPolicyTypeJ().msg() + } + + if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_K { + obj.obj.TypeK = NewBgpAttributesSegmentRoutingPolicyTypeK().msg() + } + + return obj +} + +// description is TBD +// TypeA returns a BgpAttributesSegmentRoutingPolicyTypeA +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeA() BgpAttributesSegmentRoutingPolicyTypeA { + if obj.obj.TypeA == nil { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_A) + } + if obj.typeAHolder == nil { + obj.typeAHolder = &bgpAttributesSegmentRoutingPolicyTypeA{obj: obj.obj.TypeA} + } + return obj.typeAHolder +} + +// description is TBD +// TypeA returns a BgpAttributesSegmentRoutingPolicyTypeA +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeA() bool { + return obj.obj.TypeA != nil +} + +// description is TBD +// SetTypeA sets the BgpAttributesSegmentRoutingPolicyTypeA value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeA(value BgpAttributesSegmentRoutingPolicyTypeA) BgpAttributesSegmentRoutingPolicySegmentListSegment { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_A) + obj.typeAHolder = nil + obj.obj.TypeA = value.msg() + + return obj +} + +// description is TBD +// TypeB returns a BgpAttributesSegmentRoutingPolicyTypeB +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeB() BgpAttributesSegmentRoutingPolicyTypeB { + if obj.obj.TypeB == nil { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_B) + } + if obj.typeBHolder == nil { + obj.typeBHolder = &bgpAttributesSegmentRoutingPolicyTypeB{obj: obj.obj.TypeB} + } + return obj.typeBHolder +} + +// description is TBD +// TypeB returns a BgpAttributesSegmentRoutingPolicyTypeB +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeB() bool { + return obj.obj.TypeB != nil +} + +// description is TBD +// SetTypeB sets the BgpAttributesSegmentRoutingPolicyTypeB value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeB(value BgpAttributesSegmentRoutingPolicyTypeB) BgpAttributesSegmentRoutingPolicySegmentListSegment { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_B) + obj.typeBHolder = nil + obj.obj.TypeB = value.msg() + + return obj +} + +// description is TBD +// TypeC returns a BgpAttributesSegmentRoutingPolicyTypeC +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeC() BgpAttributesSegmentRoutingPolicyTypeC { + if obj.obj.TypeC == nil { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_C) + } + if obj.typeCHolder == nil { + obj.typeCHolder = &bgpAttributesSegmentRoutingPolicyTypeC{obj: obj.obj.TypeC} + } + return obj.typeCHolder +} + +// description is TBD +// TypeC returns a BgpAttributesSegmentRoutingPolicyTypeC +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeC() bool { + return obj.obj.TypeC != nil +} + +// description is TBD +// SetTypeC sets the BgpAttributesSegmentRoutingPolicyTypeC value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeC(value BgpAttributesSegmentRoutingPolicyTypeC) BgpAttributesSegmentRoutingPolicySegmentListSegment { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_C) + obj.typeCHolder = nil + obj.obj.TypeC = value.msg() + + return obj +} + +// description is TBD +// TypeD returns a BgpAttributesSegmentRoutingPolicyTypeD +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeD() BgpAttributesSegmentRoutingPolicyTypeD { + if obj.obj.TypeD == nil { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_D) + } + if obj.typeDHolder == nil { + obj.typeDHolder = &bgpAttributesSegmentRoutingPolicyTypeD{obj: obj.obj.TypeD} + } + return obj.typeDHolder +} + +// description is TBD +// TypeD returns a BgpAttributesSegmentRoutingPolicyTypeD +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeD() bool { + return obj.obj.TypeD != nil +} + +// description is TBD +// SetTypeD sets the BgpAttributesSegmentRoutingPolicyTypeD value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeD(value BgpAttributesSegmentRoutingPolicyTypeD) BgpAttributesSegmentRoutingPolicySegmentListSegment { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_D) + obj.typeDHolder = nil + obj.obj.TypeD = value.msg() + + return obj +} + +// description is TBD +// TypeE returns a BgpAttributesSegmentRoutingPolicyTypeE +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeE() BgpAttributesSegmentRoutingPolicyTypeE { + if obj.obj.TypeE == nil { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_E) + } + if obj.typeEHolder == nil { + obj.typeEHolder = &bgpAttributesSegmentRoutingPolicyTypeE{obj: obj.obj.TypeE} + } + return obj.typeEHolder +} + +// description is TBD +// TypeE returns a BgpAttributesSegmentRoutingPolicyTypeE +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeE() bool { + return obj.obj.TypeE != nil +} + +// description is TBD +// SetTypeE sets the BgpAttributesSegmentRoutingPolicyTypeE value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeE(value BgpAttributesSegmentRoutingPolicyTypeE) BgpAttributesSegmentRoutingPolicySegmentListSegment { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_E) + obj.typeEHolder = nil + obj.obj.TypeE = value.msg() + + return obj +} + +// description is TBD +// TypeF returns a BgpAttributesSegmentRoutingPolicyTypeF +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeF() BgpAttributesSegmentRoutingPolicyTypeF { + if obj.obj.TypeF == nil { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_F) + } + if obj.typeFHolder == nil { + obj.typeFHolder = &bgpAttributesSegmentRoutingPolicyTypeF{obj: obj.obj.TypeF} + } + return obj.typeFHolder +} + +// description is TBD +// TypeF returns a BgpAttributesSegmentRoutingPolicyTypeF +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeF() bool { + return obj.obj.TypeF != nil +} + +// description is TBD +// SetTypeF sets the BgpAttributesSegmentRoutingPolicyTypeF value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeF(value BgpAttributesSegmentRoutingPolicyTypeF) BgpAttributesSegmentRoutingPolicySegmentListSegment { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_F) + obj.typeFHolder = nil + obj.obj.TypeF = value.msg() + + return obj +} + +// description is TBD +// TypeG returns a BgpAttributesSegmentRoutingPolicyTypeG +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeG() BgpAttributesSegmentRoutingPolicyTypeG { + if obj.obj.TypeG == nil { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_G) + } + if obj.typeGHolder == nil { + obj.typeGHolder = &bgpAttributesSegmentRoutingPolicyTypeG{obj: obj.obj.TypeG} + } + return obj.typeGHolder +} + +// description is TBD +// TypeG returns a BgpAttributesSegmentRoutingPolicyTypeG +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeG() bool { + return obj.obj.TypeG != nil +} + +// description is TBD +// SetTypeG sets the BgpAttributesSegmentRoutingPolicyTypeG value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeG(value BgpAttributesSegmentRoutingPolicyTypeG) BgpAttributesSegmentRoutingPolicySegmentListSegment { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_G) + obj.typeGHolder = nil + obj.obj.TypeG = value.msg() + + return obj +} + +// description is TBD +// TypeH returns a BgpAttributesSegmentRoutingPolicyTypeH +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeH() BgpAttributesSegmentRoutingPolicyTypeH { + if obj.obj.TypeH == nil { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_H) + } + if obj.typeHHolder == nil { + obj.typeHHolder = &bgpAttributesSegmentRoutingPolicyTypeH{obj: obj.obj.TypeH} + } + return obj.typeHHolder +} + +// description is TBD +// TypeH returns a BgpAttributesSegmentRoutingPolicyTypeH +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeH() bool { + return obj.obj.TypeH != nil +} + +// description is TBD +// SetTypeH sets the BgpAttributesSegmentRoutingPolicyTypeH value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeH(value BgpAttributesSegmentRoutingPolicyTypeH) BgpAttributesSegmentRoutingPolicySegmentListSegment { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_H) + obj.typeHHolder = nil + obj.obj.TypeH = value.msg() + + return obj +} + +// description is TBD +// TypeI returns a BgpAttributesSegmentRoutingPolicyTypeI +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeI() BgpAttributesSegmentRoutingPolicyTypeI { + if obj.obj.TypeI == nil { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_I) + } + if obj.typeIHolder == nil { + obj.typeIHolder = &bgpAttributesSegmentRoutingPolicyTypeI{obj: obj.obj.TypeI} + } + return obj.typeIHolder +} + +// description is TBD +// TypeI returns a BgpAttributesSegmentRoutingPolicyTypeI +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeI() bool { + return obj.obj.TypeI != nil +} + +// description is TBD +// SetTypeI sets the BgpAttributesSegmentRoutingPolicyTypeI value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeI(value BgpAttributesSegmentRoutingPolicyTypeI) BgpAttributesSegmentRoutingPolicySegmentListSegment { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_I) + obj.typeIHolder = nil + obj.obj.TypeI = value.msg() + + return obj +} + +// description is TBD +// TypeJ returns a BgpAttributesSegmentRoutingPolicyTypeJ +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeJ() BgpAttributesSegmentRoutingPolicyTypeJ { + if obj.obj.TypeJ == nil { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_J) + } + if obj.typeJHolder == nil { + obj.typeJHolder = &bgpAttributesSegmentRoutingPolicyTypeJ{obj: obj.obj.TypeJ} + } + return obj.typeJHolder +} + +// description is TBD +// TypeJ returns a BgpAttributesSegmentRoutingPolicyTypeJ +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeJ() bool { + return obj.obj.TypeJ != nil +} + +// description is TBD +// SetTypeJ sets the BgpAttributesSegmentRoutingPolicyTypeJ value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeJ(value BgpAttributesSegmentRoutingPolicyTypeJ) BgpAttributesSegmentRoutingPolicySegmentListSegment { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_J) + obj.typeJHolder = nil + obj.obj.TypeJ = value.msg() + + return obj +} + +// description is TBD +// TypeK returns a BgpAttributesSegmentRoutingPolicyTypeK +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeK() BgpAttributesSegmentRoutingPolicyTypeK { + if obj.obj.TypeK == nil { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_K) + } + if obj.typeKHolder == nil { + obj.typeKHolder = &bgpAttributesSegmentRoutingPolicyTypeK{obj: obj.obj.TypeK} + } + return obj.typeKHolder +} + +// description is TBD +// TypeK returns a BgpAttributesSegmentRoutingPolicyTypeK +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeK() bool { + return obj.obj.TypeK != nil +} + +// description is TBD +// SetTypeK sets the BgpAttributesSegmentRoutingPolicyTypeK value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeK(value BgpAttributesSegmentRoutingPolicyTypeK) BgpAttributesSegmentRoutingPolicySegmentListSegment { + obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_K) + obj.typeKHolder = nil + obj.obj.TypeK = value.msg() + + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface BgpAttributesSegmentRoutingPolicySegmentListSegment") + } + + if obj.obj.TypeA != nil { + + obj.TypeA().validateObj(vObj, set_default) + } + + if obj.obj.TypeB != nil { + + obj.TypeB().validateObj(vObj, set_default) + } + + if obj.obj.TypeC != nil { + + obj.TypeC().validateObj(vObj, set_default) + } + + if obj.obj.TypeD != nil { + + obj.TypeD().validateObj(vObj, set_default) + } + + if obj.obj.TypeE != nil { + + obj.TypeE().validateObj(vObj, set_default) + } + + if obj.obj.TypeF != nil { + + obj.TypeF().validateObj(vObj, set_default) + } + + if obj.obj.TypeG != nil { + + obj.TypeG().validateObj(vObj, set_default) + } + + if obj.obj.TypeH != nil { + + obj.TypeH().validateObj(vObj, set_default) + } + + if obj.obj.TypeI != nil { + + obj.TypeI().validateObj(vObj, set_default) + } + + if obj.obj.TypeJ != nil { + + obj.TypeJ().validateObj(vObj, set_default) + } + + if obj.obj.TypeK != nil { + + obj.TypeK().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) setDefault() { + var choices_set int = 0 + var choice BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum + + if obj.obj.TypeA != nil { + choices_set += 1 + choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_A + } + + if obj.obj.TypeB != nil { + choices_set += 1 + choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_B + } + + if obj.obj.TypeC != nil { + choices_set += 1 + choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_C + } + + if obj.obj.TypeD != nil { + choices_set += 1 + choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_D + } + + if obj.obj.TypeE != nil { + choices_set += 1 + choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_E + } + + if obj.obj.TypeF != nil { + choices_set += 1 + choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_F + } + + if obj.obj.TypeG != nil { + choices_set += 1 + choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_G + } + + if obj.obj.TypeH != nil { + choices_set += 1 + choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_H + } + + if obj.obj.TypeI != nil { + choices_set += 1 + choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_I + } + + if obj.obj.TypeJ != nil { + choices_set += 1 + choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_J + } + + if obj.obj.TypeK != nil { + choices_set += 1 + choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_K + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesSegmentRoutingPolicySegmentListSegment") + } + } else { + intVal := otg.BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice_Enum_value[string(choice)] + enumValue := otg.BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_segment_list_weight.go b/gosnappi/bgp_attributes_segment_routing_policy_segment_list_weight.go new file mode 100644 index 00000000..e691ad33 --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_segment_list_weight.go @@ -0,0 +1,309 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicySegmentListWeight ***** +type bgpAttributesSegmentRoutingPolicySegmentListWeight struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight + marshaller marshalBgpAttributesSegmentRoutingPolicySegmentListWeight + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicySegmentListWeight +} + +func NewBgpAttributesSegmentRoutingPolicySegmentListWeight() BgpAttributesSegmentRoutingPolicySegmentListWeight { + obj := bgpAttributesSegmentRoutingPolicySegmentListWeight{obj: &otg.BgpAttributesSegmentRoutingPolicySegmentListWeight{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) msg() *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight) BgpAttributesSegmentRoutingPolicySegmentListWeight { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicySegmentListWeight struct { + obj *bgpAttributesSegmentRoutingPolicySegmentListWeight +} + +type marshalBgpAttributesSegmentRoutingPolicySegmentListWeight interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicySegmentListWeight to protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight + ToProto() (*otg.BgpAttributesSegmentRoutingPolicySegmentListWeight, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicySegmentListWeight to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicySegmentListWeight to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicySegmentListWeight to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicySegmentListWeight struct { + obj *bgpAttributesSegmentRoutingPolicySegmentListWeight +} + +type unMarshalBgpAttributesSegmentRoutingPolicySegmentListWeight interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicySegmentListWeight from protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight) (BgpAttributesSegmentRoutingPolicySegmentListWeight, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicySegmentListWeight from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicySegmentListWeight from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicySegmentListWeight from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) Marshal() marshalBgpAttributesSegmentRoutingPolicySegmentListWeight { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicySegmentListWeight{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicySegmentListWeight { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicySegmentListWeight{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicySegmentListWeight) ToProto() (*otg.BgpAttributesSegmentRoutingPolicySegmentListWeight, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicySegmentListWeight) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight) (BgpAttributesSegmentRoutingPolicySegmentListWeight, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicySegmentListWeight) 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 *unMarshalbgpAttributesSegmentRoutingPolicySegmentListWeight) 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 *marshalbgpAttributesSegmentRoutingPolicySegmentListWeight) 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 *unMarshalbgpAttributesSegmentRoutingPolicySegmentListWeight) 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 *marshalbgpAttributesSegmentRoutingPolicySegmentListWeight) 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 *unMarshalbgpAttributesSegmentRoutingPolicySegmentListWeight) 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 *bgpAttributesSegmentRoutingPolicySegmentListWeight) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) Clone() (BgpAttributesSegmentRoutingPolicySegmentListWeight, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicySegmentListWeight() + 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 +} + +// BgpAttributesSegmentRoutingPolicySegmentListWeight is the optional Weight sub-TLV (Type 9) specifies the weight associated with a given segment list. The weight is used for weighted multipath. +type BgpAttributesSegmentRoutingPolicySegmentListWeight interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicySegmentListWeight to protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight + // setMsg unmarshals BgpAttributesSegmentRoutingPolicySegmentListWeight from protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicySegmentListWeight) BgpAttributesSegmentRoutingPolicySegmentListWeight + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicySegmentListWeight + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicySegmentListWeight + // validate validates BgpAttributesSegmentRoutingPolicySegmentListWeight + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicySegmentListWeight, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Value returns uint32, set in BgpAttributesSegmentRoutingPolicySegmentListWeight. + Value() uint32 + // SetValue assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicySegmentListWeight + SetValue(value uint32) BgpAttributesSegmentRoutingPolicySegmentListWeight + // HasValue checks if Value has been set in BgpAttributesSegmentRoutingPolicySegmentListWeight + HasValue() bool +} + +// Value of the weight. +// Value returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) Value() uint32 { + + return *obj.obj.Value + +} + +// Value of the weight. +// Value returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) HasValue() bool { + return obj.obj.Value != nil +} + +// Value of the weight. +// SetValue sets the uint32 value in the BgpAttributesSegmentRoutingPolicySegmentListWeight object +func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) SetValue(value uint32) BgpAttributesSegmentRoutingPolicySegmentListWeight { + + obj.obj.Value = &value + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) setDefault() { + if obj.obj.Value == nil { + obj.SetValue(0) + } + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_type_a.go b/gosnappi/bgp_attributes_segment_routing_policy_type_a.go new file mode 100644 index 00000000..aa11df66 --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_type_a.go @@ -0,0 +1,384 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicyTypeA ***** +type bgpAttributesSegmentRoutingPolicyTypeA struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicyTypeA + marshaller marshalBgpAttributesSegmentRoutingPolicyTypeA + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeA + flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags + mplsSidHolder BgpAttributesSidMpls +} + +func NewBgpAttributesSegmentRoutingPolicyTypeA() BgpAttributesSegmentRoutingPolicyTypeA { + obj := bgpAttributesSegmentRoutingPolicyTypeA{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeA{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeA { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeA) BgpAttributesSegmentRoutingPolicyTypeA { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicyTypeA struct { + obj *bgpAttributesSegmentRoutingPolicyTypeA +} + +type marshalBgpAttributesSegmentRoutingPolicyTypeA interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeA to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeA + ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeA, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeA to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeA to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeA to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicyTypeA struct { + obj *bgpAttributesSegmentRoutingPolicyTypeA +} + +type unMarshalBgpAttributesSegmentRoutingPolicyTypeA interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeA from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeA + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeA) (BgpAttributesSegmentRoutingPolicyTypeA, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeA from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeA from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeA from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeA { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeA{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeA { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeA{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeA) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeA, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeA) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeA) (BgpAttributesSegmentRoutingPolicyTypeA, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeA) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeA) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeA) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeA) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeA) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeA) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) Clone() (BgpAttributesSegmentRoutingPolicyTypeA, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicyTypeA() + 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 +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) setNil() { + obj.flagsHolder = nil + obj.mplsSidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSegmentRoutingPolicyTypeA is type A: SID only, in the form of MPLS Label. +// It is encoded as a Segment of Type 1 in the SEGMENT_LIST sub-tlv. +type BgpAttributesSegmentRoutingPolicyTypeA interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicyTypeA to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeA + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicyTypeA + // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeA from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeA + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeA) BgpAttributesSegmentRoutingPolicyTypeA + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeA + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeA + // validate validates BgpAttributesSegmentRoutingPolicyTypeA + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicyTypeA, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeA. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + Flags() BgpAttributesSegmentRoutingPolicyTypeFlags + // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeA. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeA + // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeA + HasFlags() bool + // MplsSid returns BgpAttributesSidMpls, set in BgpAttributesSegmentRoutingPolicyTypeA. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + MplsSid() BgpAttributesSidMpls + // SetMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesSegmentRoutingPolicyTypeA. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + SetMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeA + // HasMplsSid checks if MplsSid has been set in BgpAttributesSegmentRoutingPolicyTypeA + HasMplsSid() bool + setNil() +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { + if obj.obj.Flags == nil { + obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) HasFlags() bool { + return obj.obj.Flags != nil +} + +// description is TBD +// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeA object +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeA { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// description is TBD +// MplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) MplsSid() BgpAttributesSidMpls { + if obj.obj.MplsSid == nil { + obj.obj.MplsSid = NewBgpAttributesSidMpls().msg() + } + if obj.mplsSidHolder == nil { + obj.mplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.MplsSid} + } + return obj.mplsSidHolder +} + +// description is TBD +// MplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) HasMplsSid() bool { + return obj.obj.MplsSid != nil +} + +// description is TBD +// SetMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesSegmentRoutingPolicyTypeA object +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) SetMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeA { + + obj.mplsSidHolder = nil + obj.obj.MplsSid = value.msg() + + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.MplsSid != nil { + + obj.MplsSid().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeA) setDefault() { + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_type_b.go b/gosnappi/bgp_attributes_segment_routing_policy_type_b.go new file mode 100644 index 00000000..c8bb3aec --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_type_b.go @@ -0,0 +1,422 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicyTypeB ***** +type bgpAttributesSegmentRoutingPolicyTypeB struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicyTypeB + marshaller marshalBgpAttributesSegmentRoutingPolicyTypeB + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeB + flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags + srv6EndpointBehaviorHolder BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +} + +func NewBgpAttributesSegmentRoutingPolicyTypeB() BgpAttributesSegmentRoutingPolicyTypeB { + obj := bgpAttributesSegmentRoutingPolicyTypeB{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeB{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeB { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeB) BgpAttributesSegmentRoutingPolicyTypeB { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicyTypeB struct { + obj *bgpAttributesSegmentRoutingPolicyTypeB +} + +type marshalBgpAttributesSegmentRoutingPolicyTypeB interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeB to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeB + ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeB, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeB to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeB to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeB to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicyTypeB struct { + obj *bgpAttributesSegmentRoutingPolicyTypeB +} + +type unMarshalBgpAttributesSegmentRoutingPolicyTypeB interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeB from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeB + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeB) (BgpAttributesSegmentRoutingPolicyTypeB, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeB from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeB from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeB from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeB { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeB{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeB { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeB{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeB) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeB, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeB) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeB) (BgpAttributesSegmentRoutingPolicyTypeB, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeB) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeB) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeB) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeB) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeB) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeB) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) Clone() (BgpAttributesSegmentRoutingPolicyTypeB, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicyTypeB() + 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 +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) setNil() { + obj.flagsHolder = nil + obj.srv6EndpointBehaviorHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSegmentRoutingPolicyTypeB is type B: SID only, in the form of IPv6 address. +// It is encoded as a Segment of Type 13 in the SEGMENT_LIST sub-tlv. +type BgpAttributesSegmentRoutingPolicyTypeB interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicyTypeB to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeB + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicyTypeB + // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeB from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeB + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeB) BgpAttributesSegmentRoutingPolicyTypeB + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeB + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeB + // validate validates BgpAttributesSegmentRoutingPolicyTypeB + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicyTypeB, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeB. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + Flags() BgpAttributesSegmentRoutingPolicyTypeFlags + // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeB. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeB + // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeB + HasFlags() bool + // Srv6Sid returns string, set in BgpAttributesSegmentRoutingPolicyTypeB. + Srv6Sid() string + // SetSrv6Sid assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeB + SetSrv6Sid(value string) BgpAttributesSegmentRoutingPolicyTypeB + // HasSrv6Sid checks if Srv6Sid has been set in BgpAttributesSegmentRoutingPolicyTypeB + HasSrv6Sid() bool + // Srv6EndpointBehavior returns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, set in BgpAttributesSegmentRoutingPolicyTypeB. + // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 + Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // SetSrv6EndpointBehavior assigns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure provided by user to BgpAttributesSegmentRoutingPolicyTypeB. + // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 + SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeB + // HasSrv6EndpointBehavior checks if Srv6EndpointBehavior has been set in BgpAttributesSegmentRoutingPolicyTypeB + HasSrv6EndpointBehavior() bool + setNil() +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { + if obj.obj.Flags == nil { + obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) HasFlags() bool { + return obj.obj.Flags != nil +} + +// description is TBD +// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeB object +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeB { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// SRv6 SID. +// Srv6Sid returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) Srv6Sid() string { + + return *obj.obj.Srv6Sid + +} + +// SRv6 SID. +// Srv6Sid returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) HasSrv6Sid() bool { + return obj.obj.Srv6Sid != nil +} + +// SRv6 SID. +// SetSrv6Sid sets the string value in the BgpAttributesSegmentRoutingPolicyTypeB object +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) SetSrv6Sid(value string) BgpAttributesSegmentRoutingPolicyTypeB { + + obj.obj.Srv6Sid = &value + return obj +} + +// description is TBD +// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + if obj.obj.Srv6EndpointBehavior == nil { + obj.obj.Srv6EndpointBehavior = NewBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure().msg() + } + if obj.srv6EndpointBehaviorHolder == nil { + obj.srv6EndpointBehaviorHolder = &bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6EndpointBehavior} + } + return obj.srv6EndpointBehaviorHolder +} + +// description is TBD +// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) HasSrv6EndpointBehavior() bool { + return obj.obj.Srv6EndpointBehavior != nil +} + +// description is TBD +// SetSrv6EndpointBehavior sets the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure value in the BgpAttributesSegmentRoutingPolicyTypeB object +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeB { + + obj.srv6EndpointBehaviorHolder = nil + obj.obj.Srv6EndpointBehavior = value.msg() + + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.Srv6Sid != nil { + + err := obj.validateIpv6(obj.Srv6Sid()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeB.Srv6Sid")) + } + + } + + if obj.obj.Srv6EndpointBehavior != nil { + + obj.Srv6EndpointBehavior().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeB) setDefault() { + if obj.obj.Srv6Sid == nil { + obj.SetSrv6Sid("0::0") + } + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_type_c.go b/gosnappi/bgp_attributes_segment_routing_policy_type_c.go new file mode 100644 index 00000000..9c14d983 --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_type_c.go @@ -0,0 +1,465 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicyTypeC ***** +type bgpAttributesSegmentRoutingPolicyTypeC struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicyTypeC + marshaller marshalBgpAttributesSegmentRoutingPolicyTypeC + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeC + flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags + srMplsSidHolder BgpAttributesSidMpls +} + +func NewBgpAttributesSegmentRoutingPolicyTypeC() BgpAttributesSegmentRoutingPolicyTypeC { + obj := bgpAttributesSegmentRoutingPolicyTypeC{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeC{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeC { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeC) BgpAttributesSegmentRoutingPolicyTypeC { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicyTypeC struct { + obj *bgpAttributesSegmentRoutingPolicyTypeC +} + +type marshalBgpAttributesSegmentRoutingPolicyTypeC interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeC to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeC + ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeC, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeC to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeC to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeC to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicyTypeC struct { + obj *bgpAttributesSegmentRoutingPolicyTypeC +} + +type unMarshalBgpAttributesSegmentRoutingPolicyTypeC interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeC from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeC + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeC) (BgpAttributesSegmentRoutingPolicyTypeC, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeC from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeC from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeC from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeC { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeC{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeC { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeC{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeC) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeC, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeC) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeC) (BgpAttributesSegmentRoutingPolicyTypeC, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeC) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeC) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeC) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeC) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeC) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeC) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) Clone() (BgpAttributesSegmentRoutingPolicyTypeC, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicyTypeC() + 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 +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) setNil() { + obj.flagsHolder = nil + obj.srMplsSidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSegmentRoutingPolicyTypeC is type C: IPv4 Node Address with optional SID. +// It is encoded as a Segment of Type 3 in the SEGMENT_LIST sub-tlv. +type BgpAttributesSegmentRoutingPolicyTypeC interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicyTypeC to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeC + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicyTypeC + // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeC from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeC + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeC) BgpAttributesSegmentRoutingPolicyTypeC + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeC + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeC + // validate validates BgpAttributesSegmentRoutingPolicyTypeC + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicyTypeC, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeC. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + Flags() BgpAttributesSegmentRoutingPolicyTypeFlags + // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeC. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeC + // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeC + HasFlags() bool + // SrAlgorithm returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeC. + SrAlgorithm() uint32 + // SetSrAlgorithm assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeC + SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeC + // HasSrAlgorithm checks if SrAlgorithm has been set in BgpAttributesSegmentRoutingPolicyTypeC + HasSrAlgorithm() bool + // Ipv4NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeC. + Ipv4NodeAddress() string + // SetIpv4NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeC + SetIpv4NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeC + // HasIpv4NodeAddress checks if Ipv4NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeC + HasIpv4NodeAddress() bool + // SrMplsSid returns BgpAttributesSidMpls, set in BgpAttributesSegmentRoutingPolicyTypeC. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + SrMplsSid() BgpAttributesSidMpls + // SetSrMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesSegmentRoutingPolicyTypeC. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeC + // HasSrMplsSid checks if SrMplsSid has been set in BgpAttributesSegmentRoutingPolicyTypeC + HasSrMplsSid() bool + setNil() +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { + if obj.obj.Flags == nil { + obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) HasFlags() bool { + return obj.obj.Flags != nil +} + +// description is TBD +// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeC object +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeC { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SrAlgorithm returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) SrAlgorithm() uint32 { + + return *obj.obj.SrAlgorithm + +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SrAlgorithm returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) HasSrAlgorithm() bool { + return obj.obj.SrAlgorithm != nil +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SetSrAlgorithm sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeC object +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeC { + + obj.obj.SrAlgorithm = &value + return obj +} + +// IPv4 address representing a node. +// Ipv4NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) Ipv4NodeAddress() string { + + return *obj.obj.Ipv4NodeAddress + +} + +// IPv4 address representing a node. +// Ipv4NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) HasIpv4NodeAddress() bool { + return obj.obj.Ipv4NodeAddress != nil +} + +// IPv4 address representing a node. +// SetIpv4NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeC object +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) SetIpv4NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeC { + + obj.obj.Ipv4NodeAddress = &value + return obj +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) SrMplsSid() BgpAttributesSidMpls { + if obj.obj.SrMplsSid == nil { + obj.obj.SrMplsSid = NewBgpAttributesSidMpls().msg() + } + if obj.srMplsSidHolder == nil { + obj.srMplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.SrMplsSid} + } + return obj.srMplsSidHolder +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) HasSrMplsSid() bool { + return obj.obj.SrMplsSid != nil +} + +// Optional SR-MPLS SID. +// SetSrMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesSegmentRoutingPolicyTypeC object +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeC { + + obj.srMplsSidHolder = nil + obj.obj.SrMplsSid = value.msg() + + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.SrAlgorithm != nil { + + if *obj.obj.SrAlgorithm > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicyTypeC.SrAlgorithm <= 255 but Got %d", *obj.obj.SrAlgorithm)) + } + + } + + if obj.obj.Ipv4NodeAddress != nil { + + err := obj.validateIpv4(obj.Ipv4NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeC.Ipv4NodeAddress")) + } + + } + + if obj.obj.SrMplsSid != nil { + + obj.SrMplsSid().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeC) setDefault() { + if obj.obj.SrAlgorithm == nil { + obj.SetSrAlgorithm(0) + } + if obj.obj.Ipv4NodeAddress == nil { + obj.SetIpv4NodeAddress("0.0.0.0") + } + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_type_d.go b/gosnappi/bgp_attributes_segment_routing_policy_type_d.go new file mode 100644 index 00000000..4adb6ed4 --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_type_d.go @@ -0,0 +1,465 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicyTypeD ***** +type bgpAttributesSegmentRoutingPolicyTypeD struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicyTypeD + marshaller marshalBgpAttributesSegmentRoutingPolicyTypeD + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeD + flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags + srMplsSidHolder BgpAttributesSidMpls +} + +func NewBgpAttributesSegmentRoutingPolicyTypeD() BgpAttributesSegmentRoutingPolicyTypeD { + obj := bgpAttributesSegmentRoutingPolicyTypeD{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeD{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeD { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeD) BgpAttributesSegmentRoutingPolicyTypeD { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicyTypeD struct { + obj *bgpAttributesSegmentRoutingPolicyTypeD +} + +type marshalBgpAttributesSegmentRoutingPolicyTypeD interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeD to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeD + ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeD, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeD to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeD to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeD to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicyTypeD struct { + obj *bgpAttributesSegmentRoutingPolicyTypeD +} + +type unMarshalBgpAttributesSegmentRoutingPolicyTypeD interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeD from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeD + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeD) (BgpAttributesSegmentRoutingPolicyTypeD, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeD from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeD from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeD from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeD { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeD{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeD { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeD{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeD) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeD, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeD) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeD) (BgpAttributesSegmentRoutingPolicyTypeD, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeD) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeD) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeD) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeD) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeD) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeD) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) Clone() (BgpAttributesSegmentRoutingPolicyTypeD, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicyTypeD() + 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 +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) setNil() { + obj.flagsHolder = nil + obj.srMplsSidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSegmentRoutingPolicyTypeD is type D: IPv6 Node Address with optional SID for SR MPLS. +// It is encoded as a Segment of Type 4 in the SEGMENT_LIST sub-tlv. +type BgpAttributesSegmentRoutingPolicyTypeD interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicyTypeD to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeD + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicyTypeD + // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeD from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeD + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeD) BgpAttributesSegmentRoutingPolicyTypeD + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeD + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeD + // validate validates BgpAttributesSegmentRoutingPolicyTypeD + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicyTypeD, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeD. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + Flags() BgpAttributesSegmentRoutingPolicyTypeFlags + // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeD. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeD + // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeD + HasFlags() bool + // SrAlgorithm returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeD. + SrAlgorithm() uint32 + // SetSrAlgorithm assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeD + SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeD + // HasSrAlgorithm checks if SrAlgorithm has been set in BgpAttributesSegmentRoutingPolicyTypeD + HasSrAlgorithm() bool + // Ipv6NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeD. + Ipv6NodeAddress() string + // SetIpv6NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeD + SetIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeD + // HasIpv6NodeAddress checks if Ipv6NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeD + HasIpv6NodeAddress() bool + // SrMplsSid returns BgpAttributesSidMpls, set in BgpAttributesSegmentRoutingPolicyTypeD. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + SrMplsSid() BgpAttributesSidMpls + // SetSrMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesSegmentRoutingPolicyTypeD. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeD + // HasSrMplsSid checks if SrMplsSid has been set in BgpAttributesSegmentRoutingPolicyTypeD + HasSrMplsSid() bool + setNil() +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { + if obj.obj.Flags == nil { + obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) HasFlags() bool { + return obj.obj.Flags != nil +} + +// description is TBD +// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeD object +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeD { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SrAlgorithm returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) SrAlgorithm() uint32 { + + return *obj.obj.SrAlgorithm + +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SrAlgorithm returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) HasSrAlgorithm() bool { + return obj.obj.SrAlgorithm != nil +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SetSrAlgorithm sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeD object +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeD { + + obj.obj.SrAlgorithm = &value + return obj +} + +// IPv6 address representing a node. +// Ipv6NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) Ipv6NodeAddress() string { + + return *obj.obj.Ipv6NodeAddress + +} + +// IPv6 address representing a node. +// Ipv6NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) HasIpv6NodeAddress() bool { + return obj.obj.Ipv6NodeAddress != nil +} + +// IPv6 address representing a node. +// SetIpv6NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeD object +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) SetIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeD { + + obj.obj.Ipv6NodeAddress = &value + return obj +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) SrMplsSid() BgpAttributesSidMpls { + if obj.obj.SrMplsSid == nil { + obj.obj.SrMplsSid = NewBgpAttributesSidMpls().msg() + } + if obj.srMplsSidHolder == nil { + obj.srMplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.SrMplsSid} + } + return obj.srMplsSidHolder +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) HasSrMplsSid() bool { + return obj.obj.SrMplsSid != nil +} + +// Optional SR-MPLS SID. +// SetSrMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesSegmentRoutingPolicyTypeD object +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeD { + + obj.srMplsSidHolder = nil + obj.obj.SrMplsSid = value.msg() + + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.SrAlgorithm != nil { + + if *obj.obj.SrAlgorithm > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicyTypeD.SrAlgorithm <= 255 but Got %d", *obj.obj.SrAlgorithm)) + } + + } + + if obj.obj.Ipv6NodeAddress != nil { + + err := obj.validateIpv6(obj.Ipv6NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeD.Ipv6NodeAddress")) + } + + } + + if obj.obj.SrMplsSid != nil { + + obj.SrMplsSid().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeD) setDefault() { + if obj.obj.SrAlgorithm == nil { + obj.SetSrAlgorithm(0) + } + if obj.obj.Ipv6NodeAddress == nil { + obj.SetIpv6NodeAddress("0::0") + } + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_type_e.go b/gosnappi/bgp_attributes_segment_routing_policy_type_e.go new file mode 100644 index 00000000..a4c39155 --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_type_e.go @@ -0,0 +1,455 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicyTypeE ***** +type bgpAttributesSegmentRoutingPolicyTypeE struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicyTypeE + marshaller marshalBgpAttributesSegmentRoutingPolicyTypeE + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeE + flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags + srMplsSidHolder BgpAttributesSidMpls +} + +func NewBgpAttributesSegmentRoutingPolicyTypeE() BgpAttributesSegmentRoutingPolicyTypeE { + obj := bgpAttributesSegmentRoutingPolicyTypeE{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeE{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeE { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeE) BgpAttributesSegmentRoutingPolicyTypeE { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicyTypeE struct { + obj *bgpAttributesSegmentRoutingPolicyTypeE +} + +type marshalBgpAttributesSegmentRoutingPolicyTypeE interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeE to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeE + ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeE, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeE to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeE to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeE to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicyTypeE struct { + obj *bgpAttributesSegmentRoutingPolicyTypeE +} + +type unMarshalBgpAttributesSegmentRoutingPolicyTypeE interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeE from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeE + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeE) (BgpAttributesSegmentRoutingPolicyTypeE, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeE from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeE from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeE from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeE { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeE{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeE { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeE{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeE) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeE, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeE) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeE) (BgpAttributesSegmentRoutingPolicyTypeE, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeE) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeE) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeE) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeE) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeE) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeE) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) Clone() (BgpAttributesSegmentRoutingPolicyTypeE, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicyTypeE() + 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 +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) setNil() { + obj.flagsHolder = nil + obj.srMplsSidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSegmentRoutingPolicyTypeE is type E: IPv4 Address and Local Interface ID with optional SID +// It is encoded as a Segment of Type 5 in the SEGMENT_LIST sub-tlv. +type BgpAttributesSegmentRoutingPolicyTypeE interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicyTypeE to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeE + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicyTypeE + // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeE from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeE + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeE) BgpAttributesSegmentRoutingPolicyTypeE + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeE + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeE + // validate validates BgpAttributesSegmentRoutingPolicyTypeE + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicyTypeE, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeE. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + Flags() BgpAttributesSegmentRoutingPolicyTypeFlags + // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeE. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeE + // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeE + HasFlags() bool + // LocalInterfaceId returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeE. + LocalInterfaceId() uint32 + // SetLocalInterfaceId assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeE + SetLocalInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeE + // HasLocalInterfaceId checks if LocalInterfaceId has been set in BgpAttributesSegmentRoutingPolicyTypeE + HasLocalInterfaceId() bool + // Ipv4NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeE. + Ipv4NodeAddress() string + // SetIpv4NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeE + SetIpv4NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeE + // HasIpv4NodeAddress checks if Ipv4NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeE + HasIpv4NodeAddress() bool + // SrMplsSid returns BgpAttributesSidMpls, set in BgpAttributesSegmentRoutingPolicyTypeE. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + SrMplsSid() BgpAttributesSidMpls + // SetSrMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesSegmentRoutingPolicyTypeE. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeE + // HasSrMplsSid checks if SrMplsSid has been set in BgpAttributesSegmentRoutingPolicyTypeE + HasSrMplsSid() bool + setNil() +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { + if obj.obj.Flags == nil { + obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) HasFlags() bool { + return obj.obj.Flags != nil +} + +// description is TBD +// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeE object +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeE { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// The Interface Index as defined in [RFC8664]. +// LocalInterfaceId returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) LocalInterfaceId() uint32 { + + return *obj.obj.LocalInterfaceId + +} + +// The Interface Index as defined in [RFC8664]. +// LocalInterfaceId returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) HasLocalInterfaceId() bool { + return obj.obj.LocalInterfaceId != nil +} + +// The Interface Index as defined in [RFC8664]. +// SetLocalInterfaceId sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeE object +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) SetLocalInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeE { + + obj.obj.LocalInterfaceId = &value + return obj +} + +// IPv4 address representing a node. +// Ipv4NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) Ipv4NodeAddress() string { + + return *obj.obj.Ipv4NodeAddress + +} + +// IPv4 address representing a node. +// Ipv4NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) HasIpv4NodeAddress() bool { + return obj.obj.Ipv4NodeAddress != nil +} + +// IPv4 address representing a node. +// SetIpv4NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeE object +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) SetIpv4NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeE { + + obj.obj.Ipv4NodeAddress = &value + return obj +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) SrMplsSid() BgpAttributesSidMpls { + if obj.obj.SrMplsSid == nil { + obj.obj.SrMplsSid = NewBgpAttributesSidMpls().msg() + } + if obj.srMplsSidHolder == nil { + obj.srMplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.SrMplsSid} + } + return obj.srMplsSidHolder +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) HasSrMplsSid() bool { + return obj.obj.SrMplsSid != nil +} + +// Optional SR-MPLS SID. +// SetSrMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesSegmentRoutingPolicyTypeE object +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeE { + + obj.srMplsSidHolder = nil + obj.obj.SrMplsSid = value.msg() + + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.Ipv4NodeAddress != nil { + + err := obj.validateIpv4(obj.Ipv4NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeE.Ipv4NodeAddress")) + } + + } + + if obj.obj.SrMplsSid != nil { + + obj.SrMplsSid().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeE) setDefault() { + if obj.obj.LocalInterfaceId == nil { + obj.SetLocalInterfaceId(0) + } + if obj.obj.Ipv4NodeAddress == nil { + obj.SetIpv4NodeAddress("0.0.0.0") + } + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_type_f.go b/gosnappi/bgp_attributes_segment_routing_policy_type_f.go new file mode 100644 index 00000000..54bc2f02 --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_type_f.go @@ -0,0 +1,464 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicyTypeF ***** +type bgpAttributesSegmentRoutingPolicyTypeF struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicyTypeF + marshaller marshalBgpAttributesSegmentRoutingPolicyTypeF + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeF + flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags + srMplsSidHolder BgpAttributesSidMpls +} + +func NewBgpAttributesSegmentRoutingPolicyTypeF() BgpAttributesSegmentRoutingPolicyTypeF { + obj := bgpAttributesSegmentRoutingPolicyTypeF{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeF{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeF { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeF) BgpAttributesSegmentRoutingPolicyTypeF { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicyTypeF struct { + obj *bgpAttributesSegmentRoutingPolicyTypeF +} + +type marshalBgpAttributesSegmentRoutingPolicyTypeF interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeF to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeF + ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeF, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeF to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeF to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeF to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicyTypeF struct { + obj *bgpAttributesSegmentRoutingPolicyTypeF +} + +type unMarshalBgpAttributesSegmentRoutingPolicyTypeF interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeF from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeF + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeF) (BgpAttributesSegmentRoutingPolicyTypeF, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeF from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeF from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeF from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeF { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeF{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeF { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeF{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeF) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeF, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeF) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeF) (BgpAttributesSegmentRoutingPolicyTypeF, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeF) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeF) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeF) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeF) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeF) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeF) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) Clone() (BgpAttributesSegmentRoutingPolicyTypeF, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicyTypeF() + 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 +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) setNil() { + obj.flagsHolder = nil + obj.srMplsSidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSegmentRoutingPolicyTypeF is type F: IPv4 Local and Remote addresses with optional SR-MPLS SID. +// It is encoded as a Segment of Type 6 in the SEGMENT_LIST sub-tlv. +type BgpAttributesSegmentRoutingPolicyTypeF interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicyTypeF to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeF + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicyTypeF + // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeF from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeF + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeF) BgpAttributesSegmentRoutingPolicyTypeF + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeF + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeF + // validate validates BgpAttributesSegmentRoutingPolicyTypeF + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicyTypeF, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeF. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + Flags() BgpAttributesSegmentRoutingPolicyTypeFlags + // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeF. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeF + // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeF + HasFlags() bool + // LocalIpv4Address returns string, set in BgpAttributesSegmentRoutingPolicyTypeF. + LocalIpv4Address() string + // SetLocalIpv4Address assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeF + SetLocalIpv4Address(value string) BgpAttributesSegmentRoutingPolicyTypeF + // HasLocalIpv4Address checks if LocalIpv4Address has been set in BgpAttributesSegmentRoutingPolicyTypeF + HasLocalIpv4Address() bool + // RemoteIpv4Address returns string, set in BgpAttributesSegmentRoutingPolicyTypeF. + RemoteIpv4Address() string + // SetRemoteIpv4Address assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeF + SetRemoteIpv4Address(value string) BgpAttributesSegmentRoutingPolicyTypeF + // HasRemoteIpv4Address checks if RemoteIpv4Address has been set in BgpAttributesSegmentRoutingPolicyTypeF + HasRemoteIpv4Address() bool + // SrMplsSid returns BgpAttributesSidMpls, set in BgpAttributesSegmentRoutingPolicyTypeF. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + SrMplsSid() BgpAttributesSidMpls + // SetSrMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesSegmentRoutingPolicyTypeF. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeF + // HasSrMplsSid checks if SrMplsSid has been set in BgpAttributesSegmentRoutingPolicyTypeF + HasSrMplsSid() bool + setNil() +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { + if obj.obj.Flags == nil { + obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) HasFlags() bool { + return obj.obj.Flags != nil +} + +// description is TBD +// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeF object +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeF { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// Local IPv4 Address. +// LocalIpv4Address returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) LocalIpv4Address() string { + + return *obj.obj.LocalIpv4Address + +} + +// Local IPv4 Address. +// LocalIpv4Address returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) HasLocalIpv4Address() bool { + return obj.obj.LocalIpv4Address != nil +} + +// Local IPv4 Address. +// SetLocalIpv4Address sets the string value in the BgpAttributesSegmentRoutingPolicyTypeF object +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) SetLocalIpv4Address(value string) BgpAttributesSegmentRoutingPolicyTypeF { + + obj.obj.LocalIpv4Address = &value + return obj +} + +// Remote IPv4 Address. +// RemoteIpv4Address returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) RemoteIpv4Address() string { + + return *obj.obj.RemoteIpv4Address + +} + +// Remote IPv4 Address. +// RemoteIpv4Address returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) HasRemoteIpv4Address() bool { + return obj.obj.RemoteIpv4Address != nil +} + +// Remote IPv4 Address. +// SetRemoteIpv4Address sets the string value in the BgpAttributesSegmentRoutingPolicyTypeF object +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) SetRemoteIpv4Address(value string) BgpAttributesSegmentRoutingPolicyTypeF { + + obj.obj.RemoteIpv4Address = &value + return obj +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) SrMplsSid() BgpAttributesSidMpls { + if obj.obj.SrMplsSid == nil { + obj.obj.SrMplsSid = NewBgpAttributesSidMpls().msg() + } + if obj.srMplsSidHolder == nil { + obj.srMplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.SrMplsSid} + } + return obj.srMplsSidHolder +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) HasSrMplsSid() bool { + return obj.obj.SrMplsSid != nil +} + +// Optional SR-MPLS SID. +// SetSrMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesSegmentRoutingPolicyTypeF object +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeF { + + obj.srMplsSidHolder = nil + obj.obj.SrMplsSid = value.msg() + + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.LocalIpv4Address != nil { + + err := obj.validateIpv4(obj.LocalIpv4Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeF.LocalIpv4Address")) + } + + } + + if obj.obj.RemoteIpv4Address != nil { + + err := obj.validateIpv4(obj.RemoteIpv4Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeF.RemoteIpv4Address")) + } + + } + + if obj.obj.SrMplsSid != nil { + + obj.SrMplsSid().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeF) setDefault() { + if obj.obj.LocalIpv4Address == nil { + obj.SetLocalIpv4Address("0.0.0.0") + } + if obj.obj.RemoteIpv4Address == nil { + obj.SetRemoteIpv4Address("0.0.0.0") + } + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_type_flags.go b/gosnappi/bgp_attributes_segment_routing_policy_type_flags.go new file mode 100644 index 00000000..af43cd1e --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_type_flags.go @@ -0,0 +1,410 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicyTypeFlags ***** +type bgpAttributesSegmentRoutingPolicyTypeFlags struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicyTypeFlags + marshaller marshalBgpAttributesSegmentRoutingPolicyTypeFlags + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeFlags +} + +func NewBgpAttributesSegmentRoutingPolicyTypeFlags() BgpAttributesSegmentRoutingPolicyTypeFlags { + obj := bgpAttributesSegmentRoutingPolicyTypeFlags{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeFlags{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeFlags { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeFlags { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicyTypeFlags struct { + obj *bgpAttributesSegmentRoutingPolicyTypeFlags +} + +type marshalBgpAttributesSegmentRoutingPolicyTypeFlags interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeFlags to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeFlags + ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeFlags, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeFlags to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeFlags to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeFlags to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicyTypeFlags struct { + obj *bgpAttributesSegmentRoutingPolicyTypeFlags +} + +type unMarshalBgpAttributesSegmentRoutingPolicyTypeFlags interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeFlags from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeFlags + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeFlags) (BgpAttributesSegmentRoutingPolicyTypeFlags, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeFlags from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeFlags from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeFlags from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeFlags { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeFlags { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeFlags) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeFlags, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeFlags) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeFlags) (BgpAttributesSegmentRoutingPolicyTypeFlags, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeFlags) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeFlags) 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 *marshalbgpAttributesSegmentRoutingPolicyTypeFlags) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeFlags) 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 *marshalbgpAttributesSegmentRoutingPolicyTypeFlags) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeFlags) 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 *bgpAttributesSegmentRoutingPolicyTypeFlags) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) Clone() (BgpAttributesSegmentRoutingPolicyTypeFlags, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicyTypeFlags() + 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 +} + +// BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. +// - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 +// - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . +// - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . +// - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). +// This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. +type BgpAttributesSegmentRoutingPolicyTypeFlags interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicyTypeFlags to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeFlags + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicyTypeFlags + // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeFlags from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeFlags + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeFlags + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeFlags + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeFlags + // validate validates BgpAttributesSegmentRoutingPolicyTypeFlags + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicyTypeFlags, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // VFlag returns bool, set in BgpAttributesSegmentRoutingPolicyTypeFlags. + VFlag() bool + // SetVFlag assigns bool provided by user to BgpAttributesSegmentRoutingPolicyTypeFlags + SetVFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags + // HasVFlag checks if VFlag has been set in BgpAttributesSegmentRoutingPolicyTypeFlags + HasVFlag() bool + // AFlag returns bool, set in BgpAttributesSegmentRoutingPolicyTypeFlags. + AFlag() bool + // SetAFlag assigns bool provided by user to BgpAttributesSegmentRoutingPolicyTypeFlags + SetAFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags + // HasAFlag checks if AFlag has been set in BgpAttributesSegmentRoutingPolicyTypeFlags + HasAFlag() bool + // SFlag returns bool, set in BgpAttributesSegmentRoutingPolicyTypeFlags. + SFlag() bool + // SetSFlag assigns bool provided by user to BgpAttributesSegmentRoutingPolicyTypeFlags + SetSFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags + // HasSFlag checks if SFlag has been set in BgpAttributesSegmentRoutingPolicyTypeFlags + HasSFlag() bool + // BFlag returns bool, set in BgpAttributesSegmentRoutingPolicyTypeFlags. + BFlag() bool + // SetBFlag assigns bool provided by user to BgpAttributesSegmentRoutingPolicyTypeFlags + SetBFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags + // HasBFlag checks if BFlag has been set in BgpAttributesSegmentRoutingPolicyTypeFlags + HasBFlag() bool +} + +// Indicates verification of segment data in is enabled. +// VFlag returns a bool +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) VFlag() bool { + + return *obj.obj.VFlag + +} + +// Indicates verification of segment data in is enabled. +// VFlag returns a bool +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) HasVFlag() bool { + return obj.obj.VFlag != nil +} + +// Indicates verification of segment data in is enabled. +// SetVFlag sets the bool value in the BgpAttributesSegmentRoutingPolicyTypeFlags object +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) SetVFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags { + + obj.obj.VFlag = &value + return obj +} + +// Indicates presence of SR Algorithm field applicable to Segment Types 3, 4, and 9. +// AFlag returns a bool +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) AFlag() bool { + + return *obj.obj.AFlag + +} + +// Indicates presence of SR Algorithm field applicable to Segment Types 3, 4, and 9. +// AFlag returns a bool +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) HasAFlag() bool { + return obj.obj.AFlag != nil +} + +// Indicates presence of SR Algorithm field applicable to Segment Types 3, 4, and 9. +// SetAFlag sets the bool value in the BgpAttributesSegmentRoutingPolicyTypeFlags object +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) SetAFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags { + + obj.obj.AFlag = &value + return obj +} + +// This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. +// SFlag returns a bool +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) SFlag() bool { + + return *obj.obj.SFlag + +} + +// This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. +// SFlag returns a bool +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) HasSFlag() bool { + return obj.obj.SFlag != nil +} + +// This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. +// SetSFlag sets the bool value in the BgpAttributesSegmentRoutingPolicyTypeFlags object +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) SetSFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags { + + obj.obj.SFlag = &value + return obj +} + +// Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding specified in Section 2.4.4.2.4 +// of draft-ietf-idr-sr-policy-safi-02. +// BFlag returns a bool +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) BFlag() bool { + + return *obj.obj.BFlag + +} + +// Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding specified in Section 2.4.4.2.4 +// of draft-ietf-idr-sr-policy-safi-02. +// BFlag returns a bool +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) HasBFlag() bool { + return obj.obj.BFlag != nil +} + +// Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding specified in Section 2.4.4.2.4 +// of draft-ietf-idr-sr-policy-safi-02. +// SetBFlag sets the bool value in the BgpAttributesSegmentRoutingPolicyTypeFlags object +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) SetBFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags { + + obj.obj.BFlag = &value + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) setDefault() { + if obj.obj.VFlag == nil { + obj.SetVFlag(false) + } + if obj.obj.AFlag == nil { + obj.SetAFlag(false) + } + if obj.obj.SFlag == nil { + obj.SetSFlag(false) + } + if obj.obj.BFlag == nil { + obj.SetBFlag(false) + } + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_type_g.go b/gosnappi/bgp_attributes_segment_routing_policy_type_g.go new file mode 100644 index 00000000..0b135d85 --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_type_g.go @@ -0,0 +1,526 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicyTypeG ***** +type bgpAttributesSegmentRoutingPolicyTypeG struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicyTypeG + marshaller marshalBgpAttributesSegmentRoutingPolicyTypeG + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeG + flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags + srMplsSidHolder BgpAttributesSidMpls +} + +func NewBgpAttributesSegmentRoutingPolicyTypeG() BgpAttributesSegmentRoutingPolicyTypeG { + obj := bgpAttributesSegmentRoutingPolicyTypeG{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeG{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeG { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeG) BgpAttributesSegmentRoutingPolicyTypeG { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicyTypeG struct { + obj *bgpAttributesSegmentRoutingPolicyTypeG +} + +type marshalBgpAttributesSegmentRoutingPolicyTypeG interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeG to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeG + ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeG, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeG to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeG to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeG to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicyTypeG struct { + obj *bgpAttributesSegmentRoutingPolicyTypeG +} + +type unMarshalBgpAttributesSegmentRoutingPolicyTypeG interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeG from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeG + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeG) (BgpAttributesSegmentRoutingPolicyTypeG, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeG from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeG from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeG from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeG { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeG{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeG { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeG{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeG) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeG, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeG) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeG) (BgpAttributesSegmentRoutingPolicyTypeG, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeG) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeG) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeG) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeG) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeG) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeG) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) Clone() (BgpAttributesSegmentRoutingPolicyTypeG, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicyTypeG() + 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 +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) setNil() { + obj.flagsHolder = nil + obj.srMplsSidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSegmentRoutingPolicyTypeG is type G: IPv6 Address, Interface ID for local and remote pair with optional SID for SR MPLS. +// It is encoded as a Segment of Type 7 in the SEGMENT_LIST sub-tlv. +type BgpAttributesSegmentRoutingPolicyTypeG interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicyTypeG to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeG + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicyTypeG + // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeG from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeG + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeG) BgpAttributesSegmentRoutingPolicyTypeG + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeG + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeG + // validate validates BgpAttributesSegmentRoutingPolicyTypeG + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicyTypeG, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeG. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + Flags() BgpAttributesSegmentRoutingPolicyTypeFlags + // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeG. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeG + // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeG + HasFlags() bool + // LocalInterfaceId returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeG. + LocalInterfaceId() uint32 + // SetLocalInterfaceId assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeG + SetLocalInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeG + // HasLocalInterfaceId checks if LocalInterfaceId has been set in BgpAttributesSegmentRoutingPolicyTypeG + HasLocalInterfaceId() bool + // LocalIpv6NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeG. + LocalIpv6NodeAddress() string + // SetLocalIpv6NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeG + SetLocalIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeG + // HasLocalIpv6NodeAddress checks if LocalIpv6NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeG + HasLocalIpv6NodeAddress() bool + // RemoteInterfaceId returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeG. + RemoteInterfaceId() uint32 + // SetRemoteInterfaceId assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeG + SetRemoteInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeG + // HasRemoteInterfaceId checks if RemoteInterfaceId has been set in BgpAttributesSegmentRoutingPolicyTypeG + HasRemoteInterfaceId() bool + // RemoteIpv6NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeG. + RemoteIpv6NodeAddress() string + // SetRemoteIpv6NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeG + SetRemoteIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeG + // HasRemoteIpv6NodeAddress checks if RemoteIpv6NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeG + HasRemoteIpv6NodeAddress() bool + // SrMplsSid returns BgpAttributesSidMpls, set in BgpAttributesSegmentRoutingPolicyTypeG. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + SrMplsSid() BgpAttributesSidMpls + // SetSrMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesSegmentRoutingPolicyTypeG. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeG + // HasSrMplsSid checks if SrMplsSid has been set in BgpAttributesSegmentRoutingPolicyTypeG + HasSrMplsSid() bool + setNil() +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { + if obj.obj.Flags == nil { + obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) HasFlags() bool { + return obj.obj.Flags != nil +} + +// description is TBD +// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeG object +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeG { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// The local Interface Index as defined in [RFC8664]. +// LocalInterfaceId returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) LocalInterfaceId() uint32 { + + return *obj.obj.LocalInterfaceId + +} + +// The local Interface Index as defined in [RFC8664]. +// LocalInterfaceId returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) HasLocalInterfaceId() bool { + return obj.obj.LocalInterfaceId != nil +} + +// The local Interface Index as defined in [RFC8664]. +// SetLocalInterfaceId sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeG object +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) SetLocalInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeG { + + obj.obj.LocalInterfaceId = &value + return obj +} + +// The IPv6 address representing the local node. +// LocalIpv6NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) LocalIpv6NodeAddress() string { + + return *obj.obj.LocalIpv6NodeAddress + +} + +// The IPv6 address representing the local node. +// LocalIpv6NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) HasLocalIpv6NodeAddress() bool { + return obj.obj.LocalIpv6NodeAddress != nil +} + +// The IPv6 address representing the local node. +// SetLocalIpv6NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeG object +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) SetLocalIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeG { + + obj.obj.LocalIpv6NodeAddress = &value + return obj +} + +// The remote Interface Index as defined in [RFC8664]. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. +// RemoteInterfaceId returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) RemoteInterfaceId() uint32 { + + return *obj.obj.RemoteInterfaceId + +} + +// The remote Interface Index as defined in [RFC8664]. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. +// RemoteInterfaceId returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) HasRemoteInterfaceId() bool { + return obj.obj.RemoteInterfaceId != nil +} + +// The remote Interface Index as defined in [RFC8664]. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. +// SetRemoteInterfaceId sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeG object +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) SetRemoteInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeG { + + obj.obj.RemoteInterfaceId = &value + return obj +} + +// IPv6 address representing the remote node. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. +// RemoteIpv6NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) RemoteIpv6NodeAddress() string { + + return *obj.obj.RemoteIpv6NodeAddress + +} + +// IPv6 address representing the remote node. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. +// RemoteIpv6NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) HasRemoteIpv6NodeAddress() bool { + return obj.obj.RemoteIpv6NodeAddress != nil +} + +// IPv6 address representing the remote node. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. +// SetRemoteIpv6NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeG object +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) SetRemoteIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeG { + + obj.obj.RemoteIpv6NodeAddress = &value + return obj +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) SrMplsSid() BgpAttributesSidMpls { + if obj.obj.SrMplsSid == nil { + obj.obj.SrMplsSid = NewBgpAttributesSidMpls().msg() + } + if obj.srMplsSidHolder == nil { + obj.srMplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.SrMplsSid} + } + return obj.srMplsSidHolder +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) HasSrMplsSid() bool { + return obj.obj.SrMplsSid != nil +} + +// Optional SR-MPLS SID. +// SetSrMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesSegmentRoutingPolicyTypeG object +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeG { + + obj.srMplsSidHolder = nil + obj.obj.SrMplsSid = value.msg() + + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.LocalIpv6NodeAddress != nil { + + err := obj.validateIpv6(obj.LocalIpv6NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeG.LocalIpv6NodeAddress")) + } + + } + + if obj.obj.RemoteIpv6NodeAddress != nil { + + err := obj.validateIpv6(obj.RemoteIpv6NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeG.RemoteIpv6NodeAddress")) + } + + } + + if obj.obj.SrMplsSid != nil { + + obj.SrMplsSid().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeG) setDefault() { + if obj.obj.LocalInterfaceId == nil { + obj.SetLocalInterfaceId(0) + } + if obj.obj.LocalIpv6NodeAddress == nil { + obj.SetLocalIpv6NodeAddress("0::0") + } + if obj.obj.RemoteInterfaceId == nil { + obj.SetRemoteInterfaceId(0) + } + if obj.obj.RemoteIpv6NodeAddress == nil { + obj.SetRemoteIpv6NodeAddress("0::0") + } + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_type_h.go b/gosnappi/bgp_attributes_segment_routing_policy_type_h.go new file mode 100644 index 00000000..a7ac1de4 --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_type_h.go @@ -0,0 +1,464 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicyTypeH ***** +type bgpAttributesSegmentRoutingPolicyTypeH struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicyTypeH + marshaller marshalBgpAttributesSegmentRoutingPolicyTypeH + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeH + flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags + srMplsSidHolder BgpAttributesSidMpls +} + +func NewBgpAttributesSegmentRoutingPolicyTypeH() BgpAttributesSegmentRoutingPolicyTypeH { + obj := bgpAttributesSegmentRoutingPolicyTypeH{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeH{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeH { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeH) BgpAttributesSegmentRoutingPolicyTypeH { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicyTypeH struct { + obj *bgpAttributesSegmentRoutingPolicyTypeH +} + +type marshalBgpAttributesSegmentRoutingPolicyTypeH interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeH to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeH + ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeH, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeH to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeH to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeH to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicyTypeH struct { + obj *bgpAttributesSegmentRoutingPolicyTypeH +} + +type unMarshalBgpAttributesSegmentRoutingPolicyTypeH interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeH from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeH + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeH) (BgpAttributesSegmentRoutingPolicyTypeH, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeH from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeH from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeH from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeH { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeH{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeH { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeH{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeH) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeH, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeH) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeH) (BgpAttributesSegmentRoutingPolicyTypeH, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeH) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeH) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeH) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeH) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeH) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeH) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) Clone() (BgpAttributesSegmentRoutingPolicyTypeH, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicyTypeH() + 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 +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) setNil() { + obj.flagsHolder = nil + obj.srMplsSidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSegmentRoutingPolicyTypeH is type H: IPv6 Local and Remote addresses with optional SID for SR MPLS. +// It is encoded as a Segment of Type 8 in the SEGMENT_LIST sub-tlv. +type BgpAttributesSegmentRoutingPolicyTypeH interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicyTypeH to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeH + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicyTypeH + // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeH from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeH + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeH) BgpAttributesSegmentRoutingPolicyTypeH + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeH + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeH + // validate validates BgpAttributesSegmentRoutingPolicyTypeH + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicyTypeH, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeH. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + Flags() BgpAttributesSegmentRoutingPolicyTypeFlags + // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeH. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeH + // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeH + HasFlags() bool + // LocalIpv6Address returns string, set in BgpAttributesSegmentRoutingPolicyTypeH. + LocalIpv6Address() string + // SetLocalIpv6Address assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeH + SetLocalIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeH + // HasLocalIpv6Address checks if LocalIpv6Address has been set in BgpAttributesSegmentRoutingPolicyTypeH + HasLocalIpv6Address() bool + // RemoteIpv6Address returns string, set in BgpAttributesSegmentRoutingPolicyTypeH. + RemoteIpv6Address() string + // SetRemoteIpv6Address assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeH + SetRemoteIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeH + // HasRemoteIpv6Address checks if RemoteIpv6Address has been set in BgpAttributesSegmentRoutingPolicyTypeH + HasRemoteIpv6Address() bool + // SrMplsSid returns BgpAttributesSidMpls, set in BgpAttributesSegmentRoutingPolicyTypeH. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + SrMplsSid() BgpAttributesSidMpls + // SetSrMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesSegmentRoutingPolicyTypeH. + // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence + // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. + SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeH + // HasSrMplsSid checks if SrMplsSid has been set in BgpAttributesSegmentRoutingPolicyTypeH + HasSrMplsSid() bool + setNil() +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { + if obj.obj.Flags == nil { + obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) HasFlags() bool { + return obj.obj.Flags != nil +} + +// description is TBD +// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeH object +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeH { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// Local IPv6 Address. +// LocalIpv6Address returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) LocalIpv6Address() string { + + return *obj.obj.LocalIpv6Address + +} + +// Local IPv6 Address. +// LocalIpv6Address returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) HasLocalIpv6Address() bool { + return obj.obj.LocalIpv6Address != nil +} + +// Local IPv6 Address. +// SetLocalIpv6Address sets the string value in the BgpAttributesSegmentRoutingPolicyTypeH object +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) SetLocalIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeH { + + obj.obj.LocalIpv6Address = &value + return obj +} + +// Remote IPv6 Address. +// RemoteIpv6Address returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) RemoteIpv6Address() string { + + return *obj.obj.RemoteIpv6Address + +} + +// Remote IPv6 Address. +// RemoteIpv6Address returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) HasRemoteIpv6Address() bool { + return obj.obj.RemoteIpv6Address != nil +} + +// Remote IPv6 Address. +// SetRemoteIpv6Address sets the string value in the BgpAttributesSegmentRoutingPolicyTypeH object +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) SetRemoteIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeH { + + obj.obj.RemoteIpv6Address = &value + return obj +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) SrMplsSid() BgpAttributesSidMpls { + if obj.obj.SrMplsSid == nil { + obj.obj.SrMplsSid = NewBgpAttributesSidMpls().msg() + } + if obj.srMplsSidHolder == nil { + obj.srMplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.SrMplsSid} + } + return obj.srMplsSidHolder +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpAttributesSidMpls +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) HasSrMplsSid() bool { + return obj.obj.SrMplsSid != nil +} + +// Optional SR-MPLS SID. +// SetSrMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesSegmentRoutingPolicyTypeH object +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeH { + + obj.srMplsSidHolder = nil + obj.obj.SrMplsSid = value.msg() + + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.LocalIpv6Address != nil { + + err := obj.validateIpv6(obj.LocalIpv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeH.LocalIpv6Address")) + } + + } + + if obj.obj.RemoteIpv6Address != nil { + + err := obj.validateIpv6(obj.RemoteIpv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeH.RemoteIpv6Address")) + } + + } + + if obj.obj.SrMplsSid != nil { + + obj.SrMplsSid().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeH) setDefault() { + if obj.obj.LocalIpv6Address == nil { + obj.SetLocalIpv6Address("0::0") + } + if obj.obj.RemoteIpv6Address == nil { + obj.SetRemoteIpv6Address("0::0") + } + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_type_i.go b/gosnappi/bgp_attributes_segment_routing_policy_type_i.go new file mode 100644 index 00000000..f13cc9eb --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_type_i.go @@ -0,0 +1,506 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicyTypeI ***** +type bgpAttributesSegmentRoutingPolicyTypeI struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicyTypeI + marshaller marshalBgpAttributesSegmentRoutingPolicyTypeI + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeI + flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags + srv6SidHolder BgpAttributesSidSrv6 + srv6EndpointBehaviorHolder BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +} + +func NewBgpAttributesSegmentRoutingPolicyTypeI() BgpAttributesSegmentRoutingPolicyTypeI { + obj := bgpAttributesSegmentRoutingPolicyTypeI{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeI{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeI { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeI) BgpAttributesSegmentRoutingPolicyTypeI { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicyTypeI struct { + obj *bgpAttributesSegmentRoutingPolicyTypeI +} + +type marshalBgpAttributesSegmentRoutingPolicyTypeI interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeI to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeI + ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeI, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeI to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeI to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeI to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicyTypeI struct { + obj *bgpAttributesSegmentRoutingPolicyTypeI +} + +type unMarshalBgpAttributesSegmentRoutingPolicyTypeI interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeI from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeI + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeI) (BgpAttributesSegmentRoutingPolicyTypeI, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeI from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeI from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeI from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeI { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeI{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeI { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeI{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeI) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeI, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeI) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeI) (BgpAttributesSegmentRoutingPolicyTypeI, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeI) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeI) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeI) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeI) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeI) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeI) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) Clone() (BgpAttributesSegmentRoutingPolicyTypeI, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicyTypeI() + 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 +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) setNil() { + obj.flagsHolder = nil + obj.srv6SidHolder = nil + obj.srv6EndpointBehaviorHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSegmentRoutingPolicyTypeI is type I: IPv6 Node Address with optional SR Algorithm and optional SRv6 SID. +// It is encoded as a Segment of Type 14 in the SEGMENT_LIST sub-tlv. +type BgpAttributesSegmentRoutingPolicyTypeI interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicyTypeI to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeI + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicyTypeI + // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeI from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeI + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeI) BgpAttributesSegmentRoutingPolicyTypeI + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeI + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeI + // validate validates BgpAttributesSegmentRoutingPolicyTypeI + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicyTypeI, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeI. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + Flags() BgpAttributesSegmentRoutingPolicyTypeFlags + // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeI. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeI + // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeI + HasFlags() bool + // SrAlgorithm returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeI. + SrAlgorithm() uint32 + // SetSrAlgorithm assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeI + SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeI + // HasSrAlgorithm checks if SrAlgorithm has been set in BgpAttributesSegmentRoutingPolicyTypeI + HasSrAlgorithm() bool + // Ipv6NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeI. + Ipv6NodeAddress() string + // SetIpv6NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeI + SetIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeI + // HasIpv6NodeAddress checks if Ipv6NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeI + HasIpv6NodeAddress() bool + // Srv6Sid returns BgpAttributesSidSrv6, set in BgpAttributesSegmentRoutingPolicyTypeI. + // BgpAttributesSidSrv6 is an IPv6 address denoting a SRv6 SID. + Srv6Sid() BgpAttributesSidSrv6 + // SetSrv6Sid assigns BgpAttributesSidSrv6 provided by user to BgpAttributesSegmentRoutingPolicyTypeI. + // BgpAttributesSidSrv6 is an IPv6 address denoting a SRv6 SID. + SetSrv6Sid(value BgpAttributesSidSrv6) BgpAttributesSegmentRoutingPolicyTypeI + // HasSrv6Sid checks if Srv6Sid has been set in BgpAttributesSegmentRoutingPolicyTypeI + HasSrv6Sid() bool + // Srv6EndpointBehavior returns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, set in BgpAttributesSegmentRoutingPolicyTypeI. + // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 + Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // SetSrv6EndpointBehavior assigns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure provided by user to BgpAttributesSegmentRoutingPolicyTypeI. + // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 + SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeI + // HasSrv6EndpointBehavior checks if Srv6EndpointBehavior has been set in BgpAttributesSegmentRoutingPolicyTypeI + HasSrv6EndpointBehavior() bool + setNil() +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { + if obj.obj.Flags == nil { + obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) HasFlags() bool { + return obj.obj.Flags != nil +} + +// description is TBD +// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeI object +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeI { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SrAlgorithm returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) SrAlgorithm() uint32 { + + return *obj.obj.SrAlgorithm + +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SrAlgorithm returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) HasSrAlgorithm() bool { + return obj.obj.SrAlgorithm != nil +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SetSrAlgorithm sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeI object +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeI { + + obj.obj.SrAlgorithm = &value + return obj +} + +// IPv6 address representing a node. +// Ipv6NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) Ipv6NodeAddress() string { + + return *obj.obj.Ipv6NodeAddress + +} + +// IPv6 address representing a node. +// Ipv6NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) HasIpv6NodeAddress() bool { + return obj.obj.Ipv6NodeAddress != nil +} + +// IPv6 address representing a node. +// SetIpv6NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeI object +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) SetIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeI { + + obj.obj.Ipv6NodeAddress = &value + return obj +} + +// description is TBD +// Srv6Sid returns a BgpAttributesSidSrv6 +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) Srv6Sid() BgpAttributesSidSrv6 { + if obj.obj.Srv6Sid == nil { + obj.obj.Srv6Sid = NewBgpAttributesSidSrv6().msg() + } + if obj.srv6SidHolder == nil { + obj.srv6SidHolder = &bgpAttributesSidSrv6{obj: obj.obj.Srv6Sid} + } + return obj.srv6SidHolder +} + +// description is TBD +// Srv6Sid returns a BgpAttributesSidSrv6 +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) HasSrv6Sid() bool { + return obj.obj.Srv6Sid != nil +} + +// description is TBD +// SetSrv6Sid sets the BgpAttributesSidSrv6 value in the BgpAttributesSegmentRoutingPolicyTypeI object +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) SetSrv6Sid(value BgpAttributesSidSrv6) BgpAttributesSegmentRoutingPolicyTypeI { + + obj.srv6SidHolder = nil + obj.obj.Srv6Sid = value.msg() + + return obj +} + +// description is TBD +// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + if obj.obj.Srv6EndpointBehavior == nil { + obj.obj.Srv6EndpointBehavior = NewBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure().msg() + } + if obj.srv6EndpointBehaviorHolder == nil { + obj.srv6EndpointBehaviorHolder = &bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6EndpointBehavior} + } + return obj.srv6EndpointBehaviorHolder +} + +// description is TBD +// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) HasSrv6EndpointBehavior() bool { + return obj.obj.Srv6EndpointBehavior != nil +} + +// description is TBD +// SetSrv6EndpointBehavior sets the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure value in the BgpAttributesSegmentRoutingPolicyTypeI object +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeI { + + obj.srv6EndpointBehaviorHolder = nil + obj.obj.Srv6EndpointBehavior = value.msg() + + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.SrAlgorithm != nil { + + if *obj.obj.SrAlgorithm > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicyTypeI.SrAlgorithm <= 255 but Got %d", *obj.obj.SrAlgorithm)) + } + + } + + if obj.obj.Ipv6NodeAddress != nil { + + err := obj.validateIpv6(obj.Ipv6NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeI.Ipv6NodeAddress")) + } + + } + + if obj.obj.Srv6Sid != nil { + + obj.Srv6Sid().validateObj(vObj, set_default) + } + + if obj.obj.Srv6EndpointBehavior != nil { + + obj.Srv6EndpointBehavior().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeI) setDefault() { + if obj.obj.SrAlgorithm == nil { + obj.SetSrAlgorithm(0) + } + if obj.obj.Ipv6NodeAddress == nil { + obj.SetIpv6NodeAddress("0::0") + } + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_type_j.go b/gosnappi/bgp_attributes_segment_routing_policy_type_j.go new file mode 100644 index 00000000..f2721b11 --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_type_j.go @@ -0,0 +1,608 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicyTypeJ ***** +type bgpAttributesSegmentRoutingPolicyTypeJ struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicyTypeJ + marshaller marshalBgpAttributesSegmentRoutingPolicyTypeJ + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeJ + flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags + srv6SidHolder BgpAttributesSidSrv6 + srv6EndpointBehaviorHolder BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +} + +func NewBgpAttributesSegmentRoutingPolicyTypeJ() BgpAttributesSegmentRoutingPolicyTypeJ { + obj := bgpAttributesSegmentRoutingPolicyTypeJ{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeJ{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeJ { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeJ) BgpAttributesSegmentRoutingPolicyTypeJ { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicyTypeJ struct { + obj *bgpAttributesSegmentRoutingPolicyTypeJ +} + +type marshalBgpAttributesSegmentRoutingPolicyTypeJ interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeJ to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeJ + ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeJ, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeJ to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeJ to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeJ to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicyTypeJ struct { + obj *bgpAttributesSegmentRoutingPolicyTypeJ +} + +type unMarshalBgpAttributesSegmentRoutingPolicyTypeJ interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeJ from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeJ + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeJ) (BgpAttributesSegmentRoutingPolicyTypeJ, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeJ from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeJ from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeJ from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeJ { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeJ{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeJ { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeJ{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeJ) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeJ, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeJ) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeJ) (BgpAttributesSegmentRoutingPolicyTypeJ, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeJ) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeJ) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeJ) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeJ) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeJ) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeJ) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) Clone() (BgpAttributesSegmentRoutingPolicyTypeJ, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicyTypeJ() + 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 +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) setNil() { + obj.flagsHolder = nil + obj.srv6SidHolder = nil + obj.srv6EndpointBehaviorHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSegmentRoutingPolicyTypeJ is type J: IPv6 Address, Interface ID for local and remote pair for SRv6 with optional SID. +// It is encoded as a Segment of Type 15 in the SEGMENT_LIST sub-tlv. +type BgpAttributesSegmentRoutingPolicyTypeJ interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicyTypeJ to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeJ + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicyTypeJ + // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeJ from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeJ + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeJ) BgpAttributesSegmentRoutingPolicyTypeJ + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeJ + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeJ + // validate validates BgpAttributesSegmentRoutingPolicyTypeJ + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicyTypeJ, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeJ. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + Flags() BgpAttributesSegmentRoutingPolicyTypeFlags + // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeJ. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeJ + // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeJ + HasFlags() bool + // SrAlgorithm returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeJ. + SrAlgorithm() uint32 + // SetSrAlgorithm assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeJ + SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeJ + // HasSrAlgorithm checks if SrAlgorithm has been set in BgpAttributesSegmentRoutingPolicyTypeJ + HasSrAlgorithm() bool + // LocalInterfaceId returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeJ. + LocalInterfaceId() uint32 + // SetLocalInterfaceId assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeJ + SetLocalInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeJ + // HasLocalInterfaceId checks if LocalInterfaceId has been set in BgpAttributesSegmentRoutingPolicyTypeJ + HasLocalInterfaceId() bool + // LocalIpv6NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeJ. + LocalIpv6NodeAddress() string + // SetLocalIpv6NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeJ + SetLocalIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeJ + // HasLocalIpv6NodeAddress checks if LocalIpv6NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeJ + HasLocalIpv6NodeAddress() bool + // RemoteInterfaceId returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeJ. + RemoteInterfaceId() uint32 + // SetRemoteInterfaceId assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeJ + SetRemoteInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeJ + // HasRemoteInterfaceId checks if RemoteInterfaceId has been set in BgpAttributesSegmentRoutingPolicyTypeJ + HasRemoteInterfaceId() bool + // RemoteIpv6NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeJ. + RemoteIpv6NodeAddress() string + // SetRemoteIpv6NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeJ + SetRemoteIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeJ + // HasRemoteIpv6NodeAddress checks if RemoteIpv6NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeJ + HasRemoteIpv6NodeAddress() bool + // Srv6Sid returns BgpAttributesSidSrv6, set in BgpAttributesSegmentRoutingPolicyTypeJ. + // BgpAttributesSidSrv6 is an IPv6 address denoting a SRv6 SID. + Srv6Sid() BgpAttributesSidSrv6 + // SetSrv6Sid assigns BgpAttributesSidSrv6 provided by user to BgpAttributesSegmentRoutingPolicyTypeJ. + // BgpAttributesSidSrv6 is an IPv6 address denoting a SRv6 SID. + SetSrv6Sid(value BgpAttributesSidSrv6) BgpAttributesSegmentRoutingPolicyTypeJ + // HasSrv6Sid checks if Srv6Sid has been set in BgpAttributesSegmentRoutingPolicyTypeJ + HasSrv6Sid() bool + // Srv6EndpointBehavior returns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, set in BgpAttributesSegmentRoutingPolicyTypeJ. + // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 + Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // SetSrv6EndpointBehavior assigns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure provided by user to BgpAttributesSegmentRoutingPolicyTypeJ. + // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 + SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeJ + // HasSrv6EndpointBehavior checks if Srv6EndpointBehavior has been set in BgpAttributesSegmentRoutingPolicyTypeJ + HasSrv6EndpointBehavior() bool + setNil() +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { + if obj.obj.Flags == nil { + obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasFlags() bool { + return obj.obj.Flags != nil +} + +// description is TBD +// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeJ object +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeJ { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SrAlgorithm returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SrAlgorithm() uint32 { + + return *obj.obj.SrAlgorithm + +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SrAlgorithm returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasSrAlgorithm() bool { + return obj.obj.SrAlgorithm != nil +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SetSrAlgorithm sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeJ object +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeJ { + + obj.obj.SrAlgorithm = &value + return obj +} + +// The local Interface Index as defined in [RFC8664]. +// LocalInterfaceId returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) LocalInterfaceId() uint32 { + + return *obj.obj.LocalInterfaceId + +} + +// The local Interface Index as defined in [RFC8664]. +// LocalInterfaceId returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasLocalInterfaceId() bool { + return obj.obj.LocalInterfaceId != nil +} + +// The local Interface Index as defined in [RFC8664]. +// SetLocalInterfaceId sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeJ object +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetLocalInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeJ { + + obj.obj.LocalInterfaceId = &value + return obj +} + +// The IPv6 address representing the local node. +// LocalIpv6NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) LocalIpv6NodeAddress() string { + + return *obj.obj.LocalIpv6NodeAddress + +} + +// The IPv6 address representing the local node. +// LocalIpv6NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasLocalIpv6NodeAddress() bool { + return obj.obj.LocalIpv6NodeAddress != nil +} + +// The IPv6 address representing the local node. +// SetLocalIpv6NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeJ object +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetLocalIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeJ { + + obj.obj.LocalIpv6NodeAddress = &value + return obj +} + +// The remote Interface Index as defined in [RFC8664]. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. +// RemoteInterfaceId returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) RemoteInterfaceId() uint32 { + + return *obj.obj.RemoteInterfaceId + +} + +// The remote Interface Index as defined in [RFC8664]. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. +// RemoteInterfaceId returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasRemoteInterfaceId() bool { + return obj.obj.RemoteInterfaceId != nil +} + +// The remote Interface Index as defined in [RFC8664]. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. +// SetRemoteInterfaceId sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeJ object +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetRemoteInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeJ { + + obj.obj.RemoteInterfaceId = &value + return obj +} + +// IPv6 address representing the remote node. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. +// RemoteIpv6NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) RemoteIpv6NodeAddress() string { + + return *obj.obj.RemoteIpv6NodeAddress + +} + +// IPv6 address representing the remote node. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. +// RemoteIpv6NodeAddress returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasRemoteIpv6NodeAddress() bool { + return obj.obj.RemoteIpv6NodeAddress != nil +} + +// IPv6 address representing the remote node. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. +// SetRemoteIpv6NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeJ object +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetRemoteIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeJ { + + obj.obj.RemoteIpv6NodeAddress = &value + return obj +} + +// description is TBD +// Srv6Sid returns a BgpAttributesSidSrv6 +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) Srv6Sid() BgpAttributesSidSrv6 { + if obj.obj.Srv6Sid == nil { + obj.obj.Srv6Sid = NewBgpAttributesSidSrv6().msg() + } + if obj.srv6SidHolder == nil { + obj.srv6SidHolder = &bgpAttributesSidSrv6{obj: obj.obj.Srv6Sid} + } + return obj.srv6SidHolder +} + +// description is TBD +// Srv6Sid returns a BgpAttributesSidSrv6 +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasSrv6Sid() bool { + return obj.obj.Srv6Sid != nil +} + +// description is TBD +// SetSrv6Sid sets the BgpAttributesSidSrv6 value in the BgpAttributesSegmentRoutingPolicyTypeJ object +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetSrv6Sid(value BgpAttributesSidSrv6) BgpAttributesSegmentRoutingPolicyTypeJ { + + obj.srv6SidHolder = nil + obj.obj.Srv6Sid = value.msg() + + return obj +} + +// description is TBD +// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + if obj.obj.Srv6EndpointBehavior == nil { + obj.obj.Srv6EndpointBehavior = NewBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure().msg() + } + if obj.srv6EndpointBehaviorHolder == nil { + obj.srv6EndpointBehaviorHolder = &bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6EndpointBehavior} + } + return obj.srv6EndpointBehaviorHolder +} + +// description is TBD +// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasSrv6EndpointBehavior() bool { + return obj.obj.Srv6EndpointBehavior != nil +} + +// description is TBD +// SetSrv6EndpointBehavior sets the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure value in the BgpAttributesSegmentRoutingPolicyTypeJ object +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeJ { + + obj.srv6EndpointBehaviorHolder = nil + obj.obj.Srv6EndpointBehavior = value.msg() + + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.SrAlgorithm != nil { + + if *obj.obj.SrAlgorithm > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicyTypeJ.SrAlgorithm <= 255 but Got %d", *obj.obj.SrAlgorithm)) + } + + } + + if obj.obj.LocalIpv6NodeAddress != nil { + + err := obj.validateIpv6(obj.LocalIpv6NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeJ.LocalIpv6NodeAddress")) + } + + } + + if obj.obj.RemoteIpv6NodeAddress != nil { + + err := obj.validateIpv6(obj.RemoteIpv6NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeJ.RemoteIpv6NodeAddress")) + } + + } + + if obj.obj.Srv6Sid != nil { + + obj.Srv6Sid().validateObj(vObj, set_default) + } + + if obj.obj.Srv6EndpointBehavior != nil { + + obj.Srv6EndpointBehavior().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) setDefault() { + if obj.obj.SrAlgorithm == nil { + obj.SetSrAlgorithm(0) + } + if obj.obj.LocalInterfaceId == nil { + obj.SetLocalInterfaceId(0) + } + if obj.obj.LocalIpv6NodeAddress == nil { + obj.SetLocalIpv6NodeAddress("0::0") + } + if obj.obj.RemoteInterfaceId == nil { + obj.SetRemoteInterfaceId(0) + } + if obj.obj.RemoteIpv6NodeAddress == nil { + obj.SetRemoteIpv6NodeAddress("0::0") + } + +} diff --git a/gosnappi/bgp_attributes_segment_routing_policy_type_k.go b/gosnappi/bgp_attributes_segment_routing_policy_type_k.go new file mode 100644 index 00000000..ced3dc62 --- /dev/null +++ b/gosnappi/bgp_attributes_segment_routing_policy_type_k.go @@ -0,0 +1,546 @@ +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" +) + +// ***** BgpAttributesSegmentRoutingPolicyTypeK ***** +type bgpAttributesSegmentRoutingPolicyTypeK struct { + validation + obj *otg.BgpAttributesSegmentRoutingPolicyTypeK + marshaller marshalBgpAttributesSegmentRoutingPolicyTypeK + unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeK + flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags + srv6SidHolder BgpAttributesSidSrv6 + srv6EndpointBehaviorHolder BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +} + +func NewBgpAttributesSegmentRoutingPolicyTypeK() BgpAttributesSegmentRoutingPolicyTypeK { + obj := bgpAttributesSegmentRoutingPolicyTypeK{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeK{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeK { + return obj.obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeK) BgpAttributesSegmentRoutingPolicyTypeK { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSegmentRoutingPolicyTypeK struct { + obj *bgpAttributesSegmentRoutingPolicyTypeK +} + +type marshalBgpAttributesSegmentRoutingPolicyTypeK interface { + // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeK to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeK + ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeK, error) + // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeK to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeK to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeK to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSegmentRoutingPolicyTypeK struct { + obj *bgpAttributesSegmentRoutingPolicyTypeK +} + +type unMarshalBgpAttributesSegmentRoutingPolicyTypeK interface { + // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeK from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeK + FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeK) (BgpAttributesSegmentRoutingPolicyTypeK, error) + // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeK from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeK from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeK from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeK { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeK{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeK { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeK{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeK) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeK, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeK) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeK) (BgpAttributesSegmentRoutingPolicyTypeK, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeK) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeK) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeK) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeK) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSegmentRoutingPolicyTypeK) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeK) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) Clone() (BgpAttributesSegmentRoutingPolicyTypeK, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSegmentRoutingPolicyTypeK() + 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 +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) setNil() { + obj.flagsHolder = nil + obj.srv6SidHolder = nil + obj.srv6EndpointBehaviorHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSegmentRoutingPolicyTypeK is type K: IPv6 Local and Remote addresses for SRv6 with optional SID. +// It is encoded as a Segment of Type 16 in the SEGMENT_LIST sub-tlv. +type BgpAttributesSegmentRoutingPolicyTypeK interface { + Validation + // msg marshals BgpAttributesSegmentRoutingPolicyTypeK to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeK + // and doesn't set defaults + msg() *otg.BgpAttributesSegmentRoutingPolicyTypeK + // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeK from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeK + // and doesn't set defaults + setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeK) BgpAttributesSegmentRoutingPolicyTypeK + // provides marshal interface + Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeK + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeK + // validate validates BgpAttributesSegmentRoutingPolicyTypeK + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSegmentRoutingPolicyTypeK, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeK. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + Flags() BgpAttributesSegmentRoutingPolicyTypeFlags + // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeK. + // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. + // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 + // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . + // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . + // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). + // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. + SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeK + // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeK + HasFlags() bool + // SrAlgorithm returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeK. + SrAlgorithm() uint32 + // SetSrAlgorithm assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeK + SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeK + // HasSrAlgorithm checks if SrAlgorithm has been set in BgpAttributesSegmentRoutingPolicyTypeK + HasSrAlgorithm() bool + // LocalIpv6Address returns string, set in BgpAttributesSegmentRoutingPolicyTypeK. + LocalIpv6Address() string + // SetLocalIpv6Address assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeK + SetLocalIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeK + // HasLocalIpv6Address checks if LocalIpv6Address has been set in BgpAttributesSegmentRoutingPolicyTypeK + HasLocalIpv6Address() bool + // RemoteIpv6Address returns string, set in BgpAttributesSegmentRoutingPolicyTypeK. + RemoteIpv6Address() string + // SetRemoteIpv6Address assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeK + SetRemoteIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeK + // HasRemoteIpv6Address checks if RemoteIpv6Address has been set in BgpAttributesSegmentRoutingPolicyTypeK + HasRemoteIpv6Address() bool + // Srv6Sid returns BgpAttributesSidSrv6, set in BgpAttributesSegmentRoutingPolicyTypeK. + // BgpAttributesSidSrv6 is an IPv6 address denoting a SRv6 SID. + Srv6Sid() BgpAttributesSidSrv6 + // SetSrv6Sid assigns BgpAttributesSidSrv6 provided by user to BgpAttributesSegmentRoutingPolicyTypeK. + // BgpAttributesSidSrv6 is an IPv6 address denoting a SRv6 SID. + SetSrv6Sid(value BgpAttributesSidSrv6) BgpAttributesSegmentRoutingPolicyTypeK + // HasSrv6Sid checks if Srv6Sid has been set in BgpAttributesSegmentRoutingPolicyTypeK + HasSrv6Sid() bool + // Srv6EndpointBehavior returns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, set in BgpAttributesSegmentRoutingPolicyTypeK. + // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 + Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // SetSrv6EndpointBehavior assigns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure provided by user to BgpAttributesSegmentRoutingPolicyTypeK. + // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 + SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeK + // HasSrv6EndpointBehavior checks if Srv6EndpointBehavior has been set in BgpAttributesSegmentRoutingPolicyTypeK + HasSrv6EndpointBehavior() bool + setNil() +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { + if obj.obj.Flags == nil { + obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// description is TBD +// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) HasFlags() bool { + return obj.obj.Flags != nil +} + +// description is TBD +// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeK object +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeK { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SrAlgorithm returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) SrAlgorithm() uint32 { + + return *obj.obj.SrAlgorithm + +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SrAlgorithm returns a uint32 +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) HasSrAlgorithm() bool { + return obj.obj.SrAlgorithm != nil +} + +// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. +// SetSrAlgorithm sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeK object +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeK { + + obj.obj.SrAlgorithm = &value + return obj +} + +// Local IPv6 Address. +// LocalIpv6Address returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) LocalIpv6Address() string { + + return *obj.obj.LocalIpv6Address + +} + +// Local IPv6 Address. +// LocalIpv6Address returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) HasLocalIpv6Address() bool { + return obj.obj.LocalIpv6Address != nil +} + +// Local IPv6 Address. +// SetLocalIpv6Address sets the string value in the BgpAttributesSegmentRoutingPolicyTypeK object +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) SetLocalIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeK { + + obj.obj.LocalIpv6Address = &value + return obj +} + +// Remote IPv6 Address. +// RemoteIpv6Address returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) RemoteIpv6Address() string { + + return *obj.obj.RemoteIpv6Address + +} + +// Remote IPv6 Address. +// RemoteIpv6Address returns a string +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) HasRemoteIpv6Address() bool { + return obj.obj.RemoteIpv6Address != nil +} + +// Remote IPv6 Address. +// SetRemoteIpv6Address sets the string value in the BgpAttributesSegmentRoutingPolicyTypeK object +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) SetRemoteIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeK { + + obj.obj.RemoteIpv6Address = &value + return obj +} + +// description is TBD +// Srv6Sid returns a BgpAttributesSidSrv6 +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) Srv6Sid() BgpAttributesSidSrv6 { + if obj.obj.Srv6Sid == nil { + obj.obj.Srv6Sid = NewBgpAttributesSidSrv6().msg() + } + if obj.srv6SidHolder == nil { + obj.srv6SidHolder = &bgpAttributesSidSrv6{obj: obj.obj.Srv6Sid} + } + return obj.srv6SidHolder +} + +// description is TBD +// Srv6Sid returns a BgpAttributesSidSrv6 +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) HasSrv6Sid() bool { + return obj.obj.Srv6Sid != nil +} + +// description is TBD +// SetSrv6Sid sets the BgpAttributesSidSrv6 value in the BgpAttributesSegmentRoutingPolicyTypeK object +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) SetSrv6Sid(value BgpAttributesSidSrv6) BgpAttributesSegmentRoutingPolicyTypeK { + + obj.srv6SidHolder = nil + obj.obj.Srv6Sid = value.msg() + + return obj +} + +// description is TBD +// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + if obj.obj.Srv6EndpointBehavior == nil { + obj.obj.Srv6EndpointBehavior = NewBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure().msg() + } + if obj.srv6EndpointBehaviorHolder == nil { + obj.srv6EndpointBehaviorHolder = &bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6EndpointBehavior} + } + return obj.srv6EndpointBehaviorHolder +} + +// description is TBD +// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) HasSrv6EndpointBehavior() bool { + return obj.obj.Srv6EndpointBehavior != nil +} + +// description is TBD +// SetSrv6EndpointBehavior sets the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure value in the BgpAttributesSegmentRoutingPolicyTypeK object +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeK { + + obj.srv6EndpointBehaviorHolder = nil + obj.obj.Srv6EndpointBehavior = value.msg() + + return obj +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.SrAlgorithm != nil { + + if *obj.obj.SrAlgorithm > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicyTypeK.SrAlgorithm <= 255 but Got %d", *obj.obj.SrAlgorithm)) + } + + } + + if obj.obj.LocalIpv6Address != nil { + + err := obj.validateIpv6(obj.LocalIpv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeK.LocalIpv6Address")) + } + + } + + if obj.obj.RemoteIpv6Address != nil { + + err := obj.validateIpv6(obj.RemoteIpv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeK.RemoteIpv6Address")) + } + + } + + if obj.obj.Srv6Sid != nil { + + obj.Srv6Sid().validateObj(vObj, set_default) + } + + if obj.obj.Srv6EndpointBehavior != nil { + + obj.Srv6EndpointBehavior().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesSegmentRoutingPolicyTypeK) setDefault() { + if obj.obj.SrAlgorithm == nil { + obj.SetSrAlgorithm(0) + } + if obj.obj.LocalIpv6Address == nil { + obj.SetLocalIpv6Address("0::0") + } + if obj.obj.RemoteIpv6Address == nil { + obj.SetRemoteIpv6Address("0::0") + } + +} diff --git a/gosnappi/bgp_attributes_sid_mpls.go b/gosnappi/bgp_attributes_sid_mpls.go new file mode 100644 index 00000000..4d4b9d95 --- /dev/null +++ b/gosnappi/bgp_attributes_sid_mpls.go @@ -0,0 +1,433 @@ +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" +) + +// ***** BgpAttributesSidMpls ***** +type bgpAttributesSidMpls struct { + validation + obj *otg.BgpAttributesSidMpls + marshaller marshalBgpAttributesSidMpls + unMarshaller unMarshalBgpAttributesSidMpls +} + +func NewBgpAttributesSidMpls() BgpAttributesSidMpls { + obj := bgpAttributesSidMpls{obj: &otg.BgpAttributesSidMpls{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSidMpls) msg() *otg.BgpAttributesSidMpls { + return obj.obj +} + +func (obj *bgpAttributesSidMpls) setMsg(msg *otg.BgpAttributesSidMpls) BgpAttributesSidMpls { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSidMpls struct { + obj *bgpAttributesSidMpls +} + +type marshalBgpAttributesSidMpls interface { + // ToProto marshals BgpAttributesSidMpls to protobuf object *otg.BgpAttributesSidMpls + ToProto() (*otg.BgpAttributesSidMpls, error) + // ToPbText marshals BgpAttributesSidMpls to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSidMpls to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSidMpls to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSidMpls struct { + obj *bgpAttributesSidMpls +} + +type unMarshalBgpAttributesSidMpls interface { + // FromProto unmarshals BgpAttributesSidMpls from protobuf object *otg.BgpAttributesSidMpls + FromProto(msg *otg.BgpAttributesSidMpls) (BgpAttributesSidMpls, error) + // FromPbText unmarshals BgpAttributesSidMpls from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSidMpls from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSidMpls from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSidMpls) Marshal() marshalBgpAttributesSidMpls { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSidMpls{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSidMpls) Unmarshal() unMarshalBgpAttributesSidMpls { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSidMpls{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSidMpls) ToProto() (*otg.BgpAttributesSidMpls, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSidMpls) FromProto(msg *otg.BgpAttributesSidMpls) (BgpAttributesSidMpls, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSidMpls) 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 *unMarshalbgpAttributesSidMpls) 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 *marshalbgpAttributesSidMpls) 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 *unMarshalbgpAttributesSidMpls) 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 *marshalbgpAttributesSidMpls) 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 *unMarshalbgpAttributesSidMpls) 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 *bgpAttributesSidMpls) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSidMpls) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSidMpls) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSidMpls) Clone() (BgpAttributesSidMpls, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSidMpls() + 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 +} + +// BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence +// or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. +type BgpAttributesSidMpls interface { + Validation + // msg marshals BgpAttributesSidMpls to protobuf object *otg.BgpAttributesSidMpls + // and doesn't set defaults + msg() *otg.BgpAttributesSidMpls + // setMsg unmarshals BgpAttributesSidMpls from protobuf object *otg.BgpAttributesSidMpls + // and doesn't set defaults + setMsg(*otg.BgpAttributesSidMpls) BgpAttributesSidMpls + // provides marshal interface + Marshal() marshalBgpAttributesSidMpls + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSidMpls + // validate validates BgpAttributesSidMpls + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSidMpls, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Label returns uint32, set in BgpAttributesSidMpls. + Label() uint32 + // SetLabel assigns uint32 provided by user to BgpAttributesSidMpls + SetLabel(value uint32) BgpAttributesSidMpls + // HasLabel checks if Label has been set in BgpAttributesSidMpls + HasLabel() bool + // TrafficClass returns uint32, set in BgpAttributesSidMpls. + TrafficClass() uint32 + // SetTrafficClass assigns uint32 provided by user to BgpAttributesSidMpls + SetTrafficClass(value uint32) BgpAttributesSidMpls + // HasTrafficClass checks if TrafficClass has been set in BgpAttributesSidMpls + HasTrafficClass() bool + // FlagBos returns bool, set in BgpAttributesSidMpls. + FlagBos() bool + // SetFlagBos assigns bool provided by user to BgpAttributesSidMpls + SetFlagBos(value bool) BgpAttributesSidMpls + // HasFlagBos checks if FlagBos has been set in BgpAttributesSidMpls + HasFlagBos() bool + // Ttl returns uint32, set in BgpAttributesSidMpls. + Ttl() uint32 + // SetTtl assigns uint32 provided by user to BgpAttributesSidMpls + SetTtl(value uint32) BgpAttributesSidMpls + // HasTtl checks if Ttl has been set in BgpAttributesSidMpls + HasTtl() bool +} + +// 20 bit MPLS Label value. +// Label returns a uint32 +func (obj *bgpAttributesSidMpls) Label() uint32 { + + return *obj.obj.Label + +} + +// 20 bit MPLS Label value. +// Label returns a uint32 +func (obj *bgpAttributesSidMpls) HasLabel() bool { + return obj.obj.Label != nil +} + +// 20 bit MPLS Label value. +// SetLabel sets the uint32 value in the BgpAttributesSidMpls object +func (obj *bgpAttributesSidMpls) SetLabel(value uint32) BgpAttributesSidMpls { + + obj.obj.Label = &value + return obj +} + +// 3 bits of Traffic Class. +// TrafficClass returns a uint32 +func (obj *bgpAttributesSidMpls) TrafficClass() uint32 { + + return *obj.obj.TrafficClass + +} + +// 3 bits of Traffic Class. +// TrafficClass returns a uint32 +func (obj *bgpAttributesSidMpls) HasTrafficClass() bool { + return obj.obj.TrafficClass != nil +} + +// 3 bits of Traffic Class. +// SetTrafficClass sets the uint32 value in the BgpAttributesSidMpls object +func (obj *bgpAttributesSidMpls) SetTrafficClass(value uint32) BgpAttributesSidMpls { + + obj.obj.TrafficClass = &value + return obj +} + +// Bottom of Stack +// FlagBos returns a bool +func (obj *bgpAttributesSidMpls) FlagBos() bool { + + return *obj.obj.FlagBos + +} + +// Bottom of Stack +// FlagBos returns a bool +func (obj *bgpAttributesSidMpls) HasFlagBos() bool { + return obj.obj.FlagBos != nil +} + +// Bottom of Stack +// SetFlagBos sets the bool value in the BgpAttributesSidMpls object +func (obj *bgpAttributesSidMpls) SetFlagBos(value bool) BgpAttributesSidMpls { + + obj.obj.FlagBos = &value + return obj +} + +// 8 bits Time to Live +// Ttl returns a uint32 +func (obj *bgpAttributesSidMpls) Ttl() uint32 { + + return *obj.obj.Ttl + +} + +// 8 bits Time to Live +// Ttl returns a uint32 +func (obj *bgpAttributesSidMpls) HasTtl() bool { + return obj.obj.Ttl != nil +} + +// 8 bits Time to Live +// SetTtl sets the uint32 value in the BgpAttributesSidMpls object +func (obj *bgpAttributesSidMpls) SetTtl(value uint32) BgpAttributesSidMpls { + + obj.obj.Ttl = &value + return obj +} + +func (obj *bgpAttributesSidMpls) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Label != nil { + + if *obj.obj.Label > 1048576 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesSidMpls.Label <= 1048576 but Got %d", *obj.obj.Label)) + } + + } + + if obj.obj.TrafficClass != nil { + + if *obj.obj.TrafficClass > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesSidMpls.TrafficClass <= 7 but Got %d", *obj.obj.TrafficClass)) + } + + } + + if obj.obj.Ttl != nil { + + if *obj.obj.Ttl > 63 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesSidMpls.Ttl <= 63 but Got %d", *obj.obj.Ttl)) + } + + } + +} + +func (obj *bgpAttributesSidMpls) setDefault() { + if obj.obj.Label == nil { + obj.SetLabel(16) + } + if obj.obj.TrafficClass == nil { + obj.SetTrafficClass(0) + } + if obj.obj.FlagBos == nil { + obj.SetFlagBos(true) + } + if obj.obj.Ttl == nil { + obj.SetTtl(63) + } + +} diff --git a/gosnappi/bgp_attributes_sid_srv6.go b/gosnappi/bgp_attributes_sid_srv6.go new file mode 100644 index 00000000..7541cb4f --- /dev/null +++ b/gosnappi/bgp_attributes_sid_srv6.go @@ -0,0 +1,318 @@ +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" +) + +// ***** BgpAttributesSidSrv6 ***** +type bgpAttributesSidSrv6 struct { + validation + obj *otg.BgpAttributesSidSrv6 + marshaller marshalBgpAttributesSidSrv6 + unMarshaller unMarshalBgpAttributesSidSrv6 +} + +func NewBgpAttributesSidSrv6() BgpAttributesSidSrv6 { + obj := bgpAttributesSidSrv6{obj: &otg.BgpAttributesSidSrv6{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSidSrv6) msg() *otg.BgpAttributesSidSrv6 { + return obj.obj +} + +func (obj *bgpAttributesSidSrv6) setMsg(msg *otg.BgpAttributesSidSrv6) BgpAttributesSidSrv6 { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSidSrv6 struct { + obj *bgpAttributesSidSrv6 +} + +type marshalBgpAttributesSidSrv6 interface { + // ToProto marshals BgpAttributesSidSrv6 to protobuf object *otg.BgpAttributesSidSrv6 + ToProto() (*otg.BgpAttributesSidSrv6, error) + // ToPbText marshals BgpAttributesSidSrv6 to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSidSrv6 to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSidSrv6 to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSidSrv6 struct { + obj *bgpAttributesSidSrv6 +} + +type unMarshalBgpAttributesSidSrv6 interface { + // FromProto unmarshals BgpAttributesSidSrv6 from protobuf object *otg.BgpAttributesSidSrv6 + FromProto(msg *otg.BgpAttributesSidSrv6) (BgpAttributesSidSrv6, error) + // FromPbText unmarshals BgpAttributesSidSrv6 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSidSrv6 from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSidSrv6 from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSidSrv6) Marshal() marshalBgpAttributesSidSrv6 { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSidSrv6{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSidSrv6) Unmarshal() unMarshalBgpAttributesSidSrv6 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSidSrv6{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSidSrv6) ToProto() (*otg.BgpAttributesSidSrv6, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSidSrv6) FromProto(msg *otg.BgpAttributesSidSrv6) (BgpAttributesSidSrv6, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSidSrv6) 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 *unMarshalbgpAttributesSidSrv6) 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 *marshalbgpAttributesSidSrv6) 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 *unMarshalbgpAttributesSidSrv6) 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 *marshalbgpAttributesSidSrv6) 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 *unMarshalbgpAttributesSidSrv6) 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 *bgpAttributesSidSrv6) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSidSrv6) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSidSrv6) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSidSrv6) Clone() (BgpAttributesSidSrv6, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSidSrv6() + 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 +} + +// BgpAttributesSidSrv6 is an IPv6 address denoting a SRv6 SID. +type BgpAttributesSidSrv6 interface { + Validation + // msg marshals BgpAttributesSidSrv6 to protobuf object *otg.BgpAttributesSidSrv6 + // and doesn't set defaults + msg() *otg.BgpAttributesSidSrv6 + // setMsg unmarshals BgpAttributesSidSrv6 from protobuf object *otg.BgpAttributesSidSrv6 + // and doesn't set defaults + setMsg(*otg.BgpAttributesSidSrv6) BgpAttributesSidSrv6 + // provides marshal interface + Marshal() marshalBgpAttributesSidSrv6 + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSidSrv6 + // validate validates BgpAttributesSidSrv6 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSidSrv6, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ip returns string, set in BgpAttributesSidSrv6. + Ip() string + // SetIp assigns string provided by user to BgpAttributesSidSrv6 + SetIp(value string) BgpAttributesSidSrv6 + // HasIp checks if Ip has been set in BgpAttributesSidSrv6 + HasIp() bool +} + +// description is TBD +// Ip returns a string +func (obj *bgpAttributesSidSrv6) Ip() string { + + return *obj.obj.Ip + +} + +// description is TBD +// Ip returns a string +func (obj *bgpAttributesSidSrv6) HasIp() bool { + return obj.obj.Ip != nil +} + +// description is TBD +// SetIp sets the string value in the BgpAttributesSidSrv6 object +func (obj *bgpAttributesSidSrv6) SetIp(value string) BgpAttributesSidSrv6 { + + obj.obj.Ip = &value + return obj +} + +func (obj *bgpAttributesSidSrv6) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ip != nil { + + err := obj.validateIpv6(obj.Ip()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSidSrv6.Ip")) + } + + } + +} + +func (obj *bgpAttributesSidSrv6) setDefault() { + if obj.obj.Ip == nil { + obj.SetIp("0::0") + } + +} diff --git a/gosnappi/bgp_attributes_sr_policy_explicit_null_policy.go b/gosnappi/bgp_attributes_sr_policy_explicit_null_policy.go new file mode 100644 index 00000000..72b89a14 --- /dev/null +++ b/gosnappi/bgp_attributes_sr_policy_explicit_null_policy.go @@ -0,0 +1,380 @@ +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" +) + +// ***** BgpAttributesSrPolicyExplicitNullPolicy ***** +type bgpAttributesSrPolicyExplicitNullPolicy struct { + validation + obj *otg.BgpAttributesSrPolicyExplicitNullPolicy + marshaller marshalBgpAttributesSrPolicyExplicitNullPolicy + unMarshaller unMarshalBgpAttributesSrPolicyExplicitNullPolicy +} + +func NewBgpAttributesSrPolicyExplicitNullPolicy() BgpAttributesSrPolicyExplicitNullPolicy { + obj := bgpAttributesSrPolicyExplicitNullPolicy{obj: &otg.BgpAttributesSrPolicyExplicitNullPolicy{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) msg() *otg.BgpAttributesSrPolicyExplicitNullPolicy { + return obj.obj +} + +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) setMsg(msg *otg.BgpAttributesSrPolicyExplicitNullPolicy) BgpAttributesSrPolicyExplicitNullPolicy { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSrPolicyExplicitNullPolicy struct { + obj *bgpAttributesSrPolicyExplicitNullPolicy +} + +type marshalBgpAttributesSrPolicyExplicitNullPolicy interface { + // ToProto marshals BgpAttributesSrPolicyExplicitNullPolicy to protobuf object *otg.BgpAttributesSrPolicyExplicitNullPolicy + ToProto() (*otg.BgpAttributesSrPolicyExplicitNullPolicy, error) + // ToPbText marshals BgpAttributesSrPolicyExplicitNullPolicy to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSrPolicyExplicitNullPolicy to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSrPolicyExplicitNullPolicy to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSrPolicyExplicitNullPolicy struct { + obj *bgpAttributesSrPolicyExplicitNullPolicy +} + +type unMarshalBgpAttributesSrPolicyExplicitNullPolicy interface { + // FromProto unmarshals BgpAttributesSrPolicyExplicitNullPolicy from protobuf object *otg.BgpAttributesSrPolicyExplicitNullPolicy + FromProto(msg *otg.BgpAttributesSrPolicyExplicitNullPolicy) (BgpAttributesSrPolicyExplicitNullPolicy, error) + // FromPbText unmarshals BgpAttributesSrPolicyExplicitNullPolicy from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSrPolicyExplicitNullPolicy from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSrPolicyExplicitNullPolicy from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Marshal() marshalBgpAttributesSrPolicyExplicitNullPolicy { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSrPolicyExplicitNullPolicy{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Unmarshal() unMarshalBgpAttributesSrPolicyExplicitNullPolicy { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSrPolicyExplicitNullPolicy{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSrPolicyExplicitNullPolicy) ToProto() (*otg.BgpAttributesSrPolicyExplicitNullPolicy, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSrPolicyExplicitNullPolicy) FromProto(msg *otg.BgpAttributesSrPolicyExplicitNullPolicy) (BgpAttributesSrPolicyExplicitNullPolicy, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSrPolicyExplicitNullPolicy) 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 *unMarshalbgpAttributesSrPolicyExplicitNullPolicy) 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 *marshalbgpAttributesSrPolicyExplicitNullPolicy) 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 *unMarshalbgpAttributesSrPolicyExplicitNullPolicy) 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 *marshalbgpAttributesSrPolicyExplicitNullPolicy) 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 *unMarshalbgpAttributesSrPolicyExplicitNullPolicy) 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 *bgpAttributesSrPolicyExplicitNullPolicy) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Clone() (BgpAttributesSrPolicyExplicitNullPolicy, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSrPolicyExplicitNullPolicy() + 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 +} + +// BgpAttributesSrPolicyExplicitNullPolicy is this is an optional sub-tlv (Type 14) which indicates whether an Explicit NULL Label must be pushed on an unlabeled IP +// packet before other labels for IPv4 or IPv6 flows. +// - It is defined in Section 2.4.5 of draft-ietf-idr-sr-policy-safi-02. +type BgpAttributesSrPolicyExplicitNullPolicy interface { + Validation + // msg marshals BgpAttributesSrPolicyExplicitNullPolicy to protobuf object *otg.BgpAttributesSrPolicyExplicitNullPolicy + // and doesn't set defaults + msg() *otg.BgpAttributesSrPolicyExplicitNullPolicy + // setMsg unmarshals BgpAttributesSrPolicyExplicitNullPolicy from protobuf object *otg.BgpAttributesSrPolicyExplicitNullPolicy + // and doesn't set defaults + setMsg(*otg.BgpAttributesSrPolicyExplicitNullPolicy) BgpAttributesSrPolicyExplicitNullPolicy + // provides marshal interface + Marshal() marshalBgpAttributesSrPolicyExplicitNullPolicy + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSrPolicyExplicitNullPolicy + // validate validates BgpAttributesSrPolicyExplicitNullPolicy + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSrPolicyExplicitNullPolicy, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum, set in BgpAttributesSrPolicyExplicitNullPolicy + Choice() BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum + // setChoice assigns BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum provided by user to BgpAttributesSrPolicyExplicitNullPolicy + setChoice(value BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum) BgpAttributesSrPolicyExplicitNullPolicy + // HasChoice checks if Choice has been set in BgpAttributesSrPolicyExplicitNullPolicy + HasChoice() bool + // getter for DonotPush to set choice. + DonotPush() + // getter for PushIpv4AndIpv6 to set choice. + PushIpv4AndIpv6() + // getter for Unknown to set choice. + Unknown() + // getter for PushIpv4 to set choice. + PushIpv4() + // getter for PushIpv6 to set choice. + PushIpv6() +} + +type BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum string + +// Enum of Choice on BgpAttributesSrPolicyExplicitNullPolicy +var BgpAttributesSrPolicyExplicitNullPolicyChoice = struct { + UNKNOWN BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum + PUSH_IPV4 BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum + PUSH_IPV6 BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum + PUSH_IPV4_AND_IPV6 BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum + DONOT_PUSH BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum +}{ + UNKNOWN: BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum("unknown"), + PUSH_IPV4: BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum("push_ipv4"), + PUSH_IPV6: BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum("push_ipv6"), + PUSH_IPV4_AND_IPV6: BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum("push_ipv4_and_ipv6"), + DONOT_PUSH: BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum("donot_push"), +} + +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Choice() BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum { + return BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// 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 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) +} + +// The Explicit NULL Label policy. +// Choice returns a string +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) setChoice(value BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum) BgpAttributesSrPolicyExplicitNullPolicy { + intValue, ok := otg.BgpAttributesSrPolicyExplicitNullPolicy_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpAttributesSrPolicyExplicitNullPolicy_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + + return obj +} + +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpAttributesSrPolicyExplicitNullPolicy) setDefault() { + var choices_set int = 0 + var choice BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV4_AND_IPV6) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesSrPolicyExplicitNullPolicy") + } + } else { + intVal := otg.BgpAttributesSrPolicyExplicitNullPolicy_Choice_Enum_value[string(choice)] + enumValue := otg.BgpAttributesSrPolicyExplicitNullPolicy_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_attributes_sr_policy_policy_candidate_name.go b/gosnappi/bgp_attributes_sr_policy_policy_candidate_name.go new file mode 100644 index 00000000..baa7d940 --- /dev/null +++ b/gosnappi/bgp_attributes_sr_policy_policy_candidate_name.go @@ -0,0 +1,318 @@ +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" +) + +// ***** BgpAttributesSrPolicyPolicyCandidateName ***** +type bgpAttributesSrPolicyPolicyCandidateName struct { + validation + obj *otg.BgpAttributesSrPolicyPolicyCandidateName + marshaller marshalBgpAttributesSrPolicyPolicyCandidateName + unMarshaller unMarshalBgpAttributesSrPolicyPolicyCandidateName +} + +func NewBgpAttributesSrPolicyPolicyCandidateName() BgpAttributesSrPolicyPolicyCandidateName { + obj := bgpAttributesSrPolicyPolicyCandidateName{obj: &otg.BgpAttributesSrPolicyPolicyCandidateName{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSrPolicyPolicyCandidateName) msg() *otg.BgpAttributesSrPolicyPolicyCandidateName { + return obj.obj +} + +func (obj *bgpAttributesSrPolicyPolicyCandidateName) setMsg(msg *otg.BgpAttributesSrPolicyPolicyCandidateName) BgpAttributesSrPolicyPolicyCandidateName { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSrPolicyPolicyCandidateName struct { + obj *bgpAttributesSrPolicyPolicyCandidateName +} + +type marshalBgpAttributesSrPolicyPolicyCandidateName interface { + // ToProto marshals BgpAttributesSrPolicyPolicyCandidateName to protobuf object *otg.BgpAttributesSrPolicyPolicyCandidateName + ToProto() (*otg.BgpAttributesSrPolicyPolicyCandidateName, error) + // ToPbText marshals BgpAttributesSrPolicyPolicyCandidateName to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSrPolicyPolicyCandidateName to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSrPolicyPolicyCandidateName to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSrPolicyPolicyCandidateName struct { + obj *bgpAttributesSrPolicyPolicyCandidateName +} + +type unMarshalBgpAttributesSrPolicyPolicyCandidateName interface { + // FromProto unmarshals BgpAttributesSrPolicyPolicyCandidateName from protobuf object *otg.BgpAttributesSrPolicyPolicyCandidateName + FromProto(msg *otg.BgpAttributesSrPolicyPolicyCandidateName) (BgpAttributesSrPolicyPolicyCandidateName, error) + // FromPbText unmarshals BgpAttributesSrPolicyPolicyCandidateName from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSrPolicyPolicyCandidateName from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSrPolicyPolicyCandidateName from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSrPolicyPolicyCandidateName) Marshal() marshalBgpAttributesSrPolicyPolicyCandidateName { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSrPolicyPolicyCandidateName{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSrPolicyPolicyCandidateName) Unmarshal() unMarshalBgpAttributesSrPolicyPolicyCandidateName { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSrPolicyPolicyCandidateName{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSrPolicyPolicyCandidateName) ToProto() (*otg.BgpAttributesSrPolicyPolicyCandidateName, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSrPolicyPolicyCandidateName) FromProto(msg *otg.BgpAttributesSrPolicyPolicyCandidateName) (BgpAttributesSrPolicyPolicyCandidateName, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSrPolicyPolicyCandidateName) 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 *unMarshalbgpAttributesSrPolicyPolicyCandidateName) 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 *marshalbgpAttributesSrPolicyPolicyCandidateName) 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 *unMarshalbgpAttributesSrPolicyPolicyCandidateName) 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 *marshalbgpAttributesSrPolicyPolicyCandidateName) 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 *unMarshalbgpAttributesSrPolicyPolicyCandidateName) 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 *bgpAttributesSrPolicyPolicyCandidateName) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSrPolicyPolicyCandidateName) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSrPolicyPolicyCandidateName) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSrPolicyPolicyCandidateName) Clone() (BgpAttributesSrPolicyPolicyCandidateName, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSrPolicyPolicyCandidateName() + 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 +} + +// BgpAttributesSrPolicyPolicyCandidateName is optional Policy Candidate Path Name sub-tlv (Type 129) which carries the symbolic name for the SR Policy candidate path +// for debugging. +// - It is defined in Section 2.4.7 of draft-ietf-idr-sr-policy-safi-02 . +type BgpAttributesSrPolicyPolicyCandidateName interface { + Validation + // msg marshals BgpAttributesSrPolicyPolicyCandidateName to protobuf object *otg.BgpAttributesSrPolicyPolicyCandidateName + // and doesn't set defaults + msg() *otg.BgpAttributesSrPolicyPolicyCandidateName + // setMsg unmarshals BgpAttributesSrPolicyPolicyCandidateName from protobuf object *otg.BgpAttributesSrPolicyPolicyCandidateName + // and doesn't set defaults + setMsg(*otg.BgpAttributesSrPolicyPolicyCandidateName) BgpAttributesSrPolicyPolicyCandidateName + // provides marshal interface + Marshal() marshalBgpAttributesSrPolicyPolicyCandidateName + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSrPolicyPolicyCandidateName + // validate validates BgpAttributesSrPolicyPolicyCandidateName + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSrPolicyPolicyCandidateName, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Value returns string, set in BgpAttributesSrPolicyPolicyCandidateName. + Value() string + // SetValue assigns string provided by user to BgpAttributesSrPolicyPolicyCandidateName + SetValue(value string) BgpAttributesSrPolicyPolicyCandidateName +} + +// Value of the symbolic Policy Candidate Path Name carried in the Policy Candidate Path Name sub-tlv. +// It is recommended that the size of the name is limited to 255 bytes. +// Value returns a string +func (obj *bgpAttributesSrPolicyPolicyCandidateName) Value() string { + + return *obj.obj.Value + +} + +// Value of the symbolic Policy Candidate Path Name carried in the Policy Candidate Path Name sub-tlv. +// It is recommended that the size of the name is limited to 255 bytes. +// SetValue sets the string value in the BgpAttributesSrPolicyPolicyCandidateName object +func (obj *bgpAttributesSrPolicyPolicyCandidateName) SetValue(value string) BgpAttributesSrPolicyPolicyCandidateName { + + obj.obj.Value = &value + return obj +} + +func (obj *bgpAttributesSrPolicyPolicyCandidateName) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Value is required + if obj.obj.Value == nil { + vObj.validationErrors = append(vObj.validationErrors, "Value is required field on interface BgpAttributesSrPolicyPolicyCandidateName") + } + if obj.obj.Value != nil { + + if len(*obj.obj.Value) > 500 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "None <= length of BgpAttributesSrPolicyPolicyCandidateName.Value <= 500 but Got %d", + len(*obj.obj.Value))) + } + + } + +} + +func (obj *bgpAttributesSrPolicyPolicyCandidateName) setDefault() { + +} diff --git a/gosnappi/bgp_attributes_sr_policy_policy_name.go b/gosnappi/bgp_attributes_sr_policy_policy_name.go new file mode 100644 index 00000000..63a0a3e2 --- /dev/null +++ b/gosnappi/bgp_attributes_sr_policy_policy_name.go @@ -0,0 +1,318 @@ +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" +) + +// ***** BgpAttributesSrPolicyPolicyName ***** +type bgpAttributesSrPolicyPolicyName struct { + validation + obj *otg.BgpAttributesSrPolicyPolicyName + marshaller marshalBgpAttributesSrPolicyPolicyName + unMarshaller unMarshalBgpAttributesSrPolicyPolicyName +} + +func NewBgpAttributesSrPolicyPolicyName() BgpAttributesSrPolicyPolicyName { + obj := bgpAttributesSrPolicyPolicyName{obj: &otg.BgpAttributesSrPolicyPolicyName{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSrPolicyPolicyName) msg() *otg.BgpAttributesSrPolicyPolicyName { + return obj.obj +} + +func (obj *bgpAttributesSrPolicyPolicyName) setMsg(msg *otg.BgpAttributesSrPolicyPolicyName) BgpAttributesSrPolicyPolicyName { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSrPolicyPolicyName struct { + obj *bgpAttributesSrPolicyPolicyName +} + +type marshalBgpAttributesSrPolicyPolicyName interface { + // ToProto marshals BgpAttributesSrPolicyPolicyName to protobuf object *otg.BgpAttributesSrPolicyPolicyName + ToProto() (*otg.BgpAttributesSrPolicyPolicyName, error) + // ToPbText marshals BgpAttributesSrPolicyPolicyName to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSrPolicyPolicyName to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSrPolicyPolicyName to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSrPolicyPolicyName struct { + obj *bgpAttributesSrPolicyPolicyName +} + +type unMarshalBgpAttributesSrPolicyPolicyName interface { + // FromProto unmarshals BgpAttributesSrPolicyPolicyName from protobuf object *otg.BgpAttributesSrPolicyPolicyName + FromProto(msg *otg.BgpAttributesSrPolicyPolicyName) (BgpAttributesSrPolicyPolicyName, error) + // FromPbText unmarshals BgpAttributesSrPolicyPolicyName from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSrPolicyPolicyName from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSrPolicyPolicyName from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSrPolicyPolicyName) Marshal() marshalBgpAttributesSrPolicyPolicyName { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSrPolicyPolicyName{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSrPolicyPolicyName) Unmarshal() unMarshalBgpAttributesSrPolicyPolicyName { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSrPolicyPolicyName{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSrPolicyPolicyName) ToProto() (*otg.BgpAttributesSrPolicyPolicyName, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSrPolicyPolicyName) FromProto(msg *otg.BgpAttributesSrPolicyPolicyName) (BgpAttributesSrPolicyPolicyName, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSrPolicyPolicyName) 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 *unMarshalbgpAttributesSrPolicyPolicyName) 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 *marshalbgpAttributesSrPolicyPolicyName) 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 *unMarshalbgpAttributesSrPolicyPolicyName) 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 *marshalbgpAttributesSrPolicyPolicyName) 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 *unMarshalbgpAttributesSrPolicyPolicyName) 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 *bgpAttributesSrPolicyPolicyName) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSrPolicyPolicyName) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSrPolicyPolicyName) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSrPolicyPolicyName) Clone() (BgpAttributesSrPolicyPolicyName, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSrPolicyPolicyName() + 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 +} + +// BgpAttributesSrPolicyPolicyName is optional Policy Name sub-tlv (Type 130) which carries the symbolic name for the SR Policy for which the +// candidate path is being advertised for debugging. +// - It is defined in Section 2.4.8 of draft-ietf-idr-sr-policy-safi-02 . +type BgpAttributesSrPolicyPolicyName interface { + Validation + // msg marshals BgpAttributesSrPolicyPolicyName to protobuf object *otg.BgpAttributesSrPolicyPolicyName + // and doesn't set defaults + msg() *otg.BgpAttributesSrPolicyPolicyName + // setMsg unmarshals BgpAttributesSrPolicyPolicyName from protobuf object *otg.BgpAttributesSrPolicyPolicyName + // and doesn't set defaults + setMsg(*otg.BgpAttributesSrPolicyPolicyName) BgpAttributesSrPolicyPolicyName + // provides marshal interface + Marshal() marshalBgpAttributesSrPolicyPolicyName + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSrPolicyPolicyName + // validate validates BgpAttributesSrPolicyPolicyName + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSrPolicyPolicyName, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Value returns string, set in BgpAttributesSrPolicyPolicyName. + Value() string + // SetValue assigns string provided by user to BgpAttributesSrPolicyPolicyName + SetValue(value string) BgpAttributesSrPolicyPolicyName +} + +// Value of the symbolic policy name carried in the Policy Name sub-tlv. +// It is recommended that the size of the name is limited to 255 bytes. +// Value returns a string +func (obj *bgpAttributesSrPolicyPolicyName) Value() string { + + return *obj.obj.Value + +} + +// Value of the symbolic policy name carried in the Policy Name sub-tlv. +// It is recommended that the size of the name is limited to 255 bytes. +// SetValue sets the string value in the BgpAttributesSrPolicyPolicyName object +func (obj *bgpAttributesSrPolicyPolicyName) SetValue(value string) BgpAttributesSrPolicyPolicyName { + + obj.obj.Value = &value + return obj +} + +func (obj *bgpAttributesSrPolicyPolicyName) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Value is required + if obj.obj.Value == nil { + vObj.validationErrors = append(vObj.validationErrors, "Value is required field on interface BgpAttributesSrPolicyPolicyName") + } + if obj.obj.Value != nil { + + if len(*obj.obj.Value) > 500 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "None <= length of BgpAttributesSrPolicyPolicyName.Value <= 500 but Got %d", + len(*obj.obj.Value))) + } + + } + +} + +func (obj *bgpAttributesSrPolicyPolicyName) setDefault() { + +} diff --git a/gosnappi/bgp_attributes_sr_policy_preference.go b/gosnappi/bgp_attributes_sr_policy_preference.go new file mode 100644 index 00000000..92b6e8fe --- /dev/null +++ b/gosnappi/bgp_attributes_sr_policy_preference.go @@ -0,0 +1,311 @@ +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" +) + +// ***** BgpAttributesSrPolicyPreference ***** +type bgpAttributesSrPolicyPreference struct { + validation + obj *otg.BgpAttributesSrPolicyPreference + marshaller marshalBgpAttributesSrPolicyPreference + unMarshaller unMarshalBgpAttributesSrPolicyPreference +} + +func NewBgpAttributesSrPolicyPreference() BgpAttributesSrPolicyPreference { + obj := bgpAttributesSrPolicyPreference{obj: &otg.BgpAttributesSrPolicyPreference{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSrPolicyPreference) msg() *otg.BgpAttributesSrPolicyPreference { + return obj.obj +} + +func (obj *bgpAttributesSrPolicyPreference) setMsg(msg *otg.BgpAttributesSrPolicyPreference) BgpAttributesSrPolicyPreference { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSrPolicyPreference struct { + obj *bgpAttributesSrPolicyPreference +} + +type marshalBgpAttributesSrPolicyPreference interface { + // ToProto marshals BgpAttributesSrPolicyPreference to protobuf object *otg.BgpAttributesSrPolicyPreference + ToProto() (*otg.BgpAttributesSrPolicyPreference, error) + // ToPbText marshals BgpAttributesSrPolicyPreference to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSrPolicyPreference to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSrPolicyPreference to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSrPolicyPreference struct { + obj *bgpAttributesSrPolicyPreference +} + +type unMarshalBgpAttributesSrPolicyPreference interface { + // FromProto unmarshals BgpAttributesSrPolicyPreference from protobuf object *otg.BgpAttributesSrPolicyPreference + FromProto(msg *otg.BgpAttributesSrPolicyPreference) (BgpAttributesSrPolicyPreference, error) + // FromPbText unmarshals BgpAttributesSrPolicyPreference from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSrPolicyPreference from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSrPolicyPreference from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSrPolicyPreference) Marshal() marshalBgpAttributesSrPolicyPreference { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSrPolicyPreference{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSrPolicyPreference) Unmarshal() unMarshalBgpAttributesSrPolicyPreference { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSrPolicyPreference{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSrPolicyPreference) ToProto() (*otg.BgpAttributesSrPolicyPreference, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSrPolicyPreference) FromProto(msg *otg.BgpAttributesSrPolicyPreference) (BgpAttributesSrPolicyPreference, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSrPolicyPreference) 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 *unMarshalbgpAttributesSrPolicyPreference) 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 *marshalbgpAttributesSrPolicyPreference) 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 *unMarshalbgpAttributesSrPolicyPreference) 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 *marshalbgpAttributesSrPolicyPreference) 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 *unMarshalbgpAttributesSrPolicyPreference) 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 *bgpAttributesSrPolicyPreference) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSrPolicyPreference) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSrPolicyPreference) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSrPolicyPreference) Clone() (BgpAttributesSrPolicyPreference, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSrPolicyPreference() + 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 +} + +// BgpAttributesSrPolicyPreference is optional Preference sub-tlv (Type 12) is used to select the best candidate path for an SR Policy. +// It is defined in Section 2.4.1 of draft-ietf-idr-sr-policy-safi-02 . + +type BgpAttributesSrPolicyPreference interface { + Validation + // msg marshals BgpAttributesSrPolicyPreference to protobuf object *otg.BgpAttributesSrPolicyPreference + // and doesn't set defaults + msg() *otg.BgpAttributesSrPolicyPreference + // setMsg unmarshals BgpAttributesSrPolicyPreference from protobuf object *otg.BgpAttributesSrPolicyPreference + // and doesn't set defaults + setMsg(*otg.BgpAttributesSrPolicyPreference) BgpAttributesSrPolicyPreference + // provides marshal interface + Marshal() marshalBgpAttributesSrPolicyPreference + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSrPolicyPreference + // validate validates BgpAttributesSrPolicyPreference + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSrPolicyPreference, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Value returns uint32, set in BgpAttributesSrPolicyPreference. + Value() uint32 + // SetValue assigns uint32 provided by user to BgpAttributesSrPolicyPreference + SetValue(value uint32) BgpAttributesSrPolicyPreference + // HasValue checks if Value has been set in BgpAttributesSrPolicyPreference + HasValue() bool +} + +// Value to be carried in the Preference sub-tlv. +// Value returns a uint32 +func (obj *bgpAttributesSrPolicyPreference) Value() uint32 { + + return *obj.obj.Value + +} + +// Value to be carried in the Preference sub-tlv. +// Value returns a uint32 +func (obj *bgpAttributesSrPolicyPreference) HasValue() bool { + return obj.obj.Value != nil +} + +// Value to be carried in the Preference sub-tlv. +// SetValue sets the uint32 value in the BgpAttributesSrPolicyPreference object +func (obj *bgpAttributesSrPolicyPreference) SetValue(value uint32) BgpAttributesSrPolicyPreference { + + obj.obj.Value = &value + return obj +} + +func (obj *bgpAttributesSrPolicyPreference) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpAttributesSrPolicyPreference) setDefault() { + if obj.obj.Value == nil { + obj.SetValue(0) + } + +} diff --git a/gosnappi/bgp_attributes_sr_policy_priority.go b/gosnappi/bgp_attributes_sr_policy_priority.go new file mode 100644 index 00000000..6678fd8d --- /dev/null +++ b/gosnappi/bgp_attributes_sr_policy_priority.go @@ -0,0 +1,320 @@ +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" +) + +// ***** BgpAttributesSrPolicyPriority ***** +type bgpAttributesSrPolicyPriority struct { + validation + obj *otg.BgpAttributesSrPolicyPriority + marshaller marshalBgpAttributesSrPolicyPriority + unMarshaller unMarshalBgpAttributesSrPolicyPriority +} + +func NewBgpAttributesSrPolicyPriority() BgpAttributesSrPolicyPriority { + obj := bgpAttributesSrPolicyPriority{obj: &otg.BgpAttributesSrPolicyPriority{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSrPolicyPriority) msg() *otg.BgpAttributesSrPolicyPriority { + return obj.obj +} + +func (obj *bgpAttributesSrPolicyPriority) setMsg(msg *otg.BgpAttributesSrPolicyPriority) BgpAttributesSrPolicyPriority { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSrPolicyPriority struct { + obj *bgpAttributesSrPolicyPriority +} + +type marshalBgpAttributesSrPolicyPriority interface { + // ToProto marshals BgpAttributesSrPolicyPriority to protobuf object *otg.BgpAttributesSrPolicyPriority + ToProto() (*otg.BgpAttributesSrPolicyPriority, error) + // ToPbText marshals BgpAttributesSrPolicyPriority to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSrPolicyPriority to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSrPolicyPriority to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSrPolicyPriority struct { + obj *bgpAttributesSrPolicyPriority +} + +type unMarshalBgpAttributesSrPolicyPriority interface { + // FromProto unmarshals BgpAttributesSrPolicyPriority from protobuf object *otg.BgpAttributesSrPolicyPriority + FromProto(msg *otg.BgpAttributesSrPolicyPriority) (BgpAttributesSrPolicyPriority, error) + // FromPbText unmarshals BgpAttributesSrPolicyPriority from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSrPolicyPriority from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSrPolicyPriority from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSrPolicyPriority) Marshal() marshalBgpAttributesSrPolicyPriority { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSrPolicyPriority{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSrPolicyPriority) Unmarshal() unMarshalBgpAttributesSrPolicyPriority { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSrPolicyPriority{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSrPolicyPriority) ToProto() (*otg.BgpAttributesSrPolicyPriority, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSrPolicyPriority) FromProto(msg *otg.BgpAttributesSrPolicyPriority) (BgpAttributesSrPolicyPriority, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSrPolicyPriority) 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 *unMarshalbgpAttributesSrPolicyPriority) 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 *marshalbgpAttributesSrPolicyPriority) 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 *unMarshalbgpAttributesSrPolicyPriority) 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 *marshalbgpAttributesSrPolicyPriority) 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 *unMarshalbgpAttributesSrPolicyPriority) 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 *bgpAttributesSrPolicyPriority) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSrPolicyPriority) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSrPolicyPriority) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSrPolicyPriority) Clone() (BgpAttributesSrPolicyPriority, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSrPolicyPriority() + 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 +} + +// BgpAttributesSrPolicyPriority is optional Priority sub-tlv (Type 15) used to select the order in which policies should be re-computed. +// - It is defined in Section 2.4.6 of draft-ietf-idr-sr-policy-safi-02 . +type BgpAttributesSrPolicyPriority interface { + Validation + // msg marshals BgpAttributesSrPolicyPriority to protobuf object *otg.BgpAttributesSrPolicyPriority + // and doesn't set defaults + msg() *otg.BgpAttributesSrPolicyPriority + // setMsg unmarshals BgpAttributesSrPolicyPriority from protobuf object *otg.BgpAttributesSrPolicyPriority + // and doesn't set defaults + setMsg(*otg.BgpAttributesSrPolicyPriority) BgpAttributesSrPolicyPriority + // provides marshal interface + Marshal() marshalBgpAttributesSrPolicyPriority + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSrPolicyPriority + // validate validates BgpAttributesSrPolicyPriority + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSrPolicyPriority, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Value returns uint32, set in BgpAttributesSrPolicyPriority. + Value() uint32 + // SetValue assigns uint32 provided by user to BgpAttributesSrPolicyPriority + SetValue(value uint32) BgpAttributesSrPolicyPriority + // HasValue checks if Value has been set in BgpAttributesSrPolicyPriority + HasValue() bool +} + +// Value to be carried in the Priority sub-tlv. +// Value returns a uint32 +func (obj *bgpAttributesSrPolicyPriority) Value() uint32 { + + return *obj.obj.Value + +} + +// Value to be carried in the Priority sub-tlv. +// Value returns a uint32 +func (obj *bgpAttributesSrPolicyPriority) HasValue() bool { + return obj.obj.Value != nil +} + +// Value to be carried in the Priority sub-tlv. +// SetValue sets the uint32 value in the BgpAttributesSrPolicyPriority object +func (obj *bgpAttributesSrPolicyPriority) SetValue(value uint32) BgpAttributesSrPolicyPriority { + + obj.obj.Value = &value + return obj +} + +func (obj *bgpAttributesSrPolicyPriority) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpAttributesSrPolicyPriority.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + +} + +func (obj *bgpAttributesSrPolicyPriority) setDefault() { + if obj.obj.Value == nil { + obj.SetValue(0) + } + +} diff --git a/gosnappi/bgp_attributes_sr_policy_segment_list.go b/gosnappi/bgp_attributes_sr_policy_segment_list.go new file mode 100644 index 00000000..65fddced --- /dev/null +++ b/gosnappi/bgp_attributes_sr_policy_segment_list.go @@ -0,0 +1,437 @@ +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" +) + +// ***** BgpAttributesSrPolicySegmentList ***** +type bgpAttributesSrPolicySegmentList struct { + validation + obj *otg.BgpAttributesSrPolicySegmentList + marshaller marshalBgpAttributesSrPolicySegmentList + unMarshaller unMarshalBgpAttributesSrPolicySegmentList + weightHolder BgpAttributesSegmentRoutingPolicySegmentListWeight + segmentsHolder BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter +} + +func NewBgpAttributesSrPolicySegmentList() BgpAttributesSrPolicySegmentList { + obj := bgpAttributesSrPolicySegmentList{obj: &otg.BgpAttributesSrPolicySegmentList{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSrPolicySegmentList) msg() *otg.BgpAttributesSrPolicySegmentList { + return obj.obj +} + +func (obj *bgpAttributesSrPolicySegmentList) setMsg(msg *otg.BgpAttributesSrPolicySegmentList) BgpAttributesSrPolicySegmentList { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSrPolicySegmentList struct { + obj *bgpAttributesSrPolicySegmentList +} + +type marshalBgpAttributesSrPolicySegmentList interface { + // ToProto marshals BgpAttributesSrPolicySegmentList to protobuf object *otg.BgpAttributesSrPolicySegmentList + ToProto() (*otg.BgpAttributesSrPolicySegmentList, error) + // ToPbText marshals BgpAttributesSrPolicySegmentList to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSrPolicySegmentList to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSrPolicySegmentList to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSrPolicySegmentList struct { + obj *bgpAttributesSrPolicySegmentList +} + +type unMarshalBgpAttributesSrPolicySegmentList interface { + // FromProto unmarshals BgpAttributesSrPolicySegmentList from protobuf object *otg.BgpAttributesSrPolicySegmentList + FromProto(msg *otg.BgpAttributesSrPolicySegmentList) (BgpAttributesSrPolicySegmentList, error) + // FromPbText unmarshals BgpAttributesSrPolicySegmentList from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSrPolicySegmentList from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSrPolicySegmentList from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSrPolicySegmentList) Marshal() marshalBgpAttributesSrPolicySegmentList { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSrPolicySegmentList{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSrPolicySegmentList) Unmarshal() unMarshalBgpAttributesSrPolicySegmentList { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSrPolicySegmentList{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSrPolicySegmentList) ToProto() (*otg.BgpAttributesSrPolicySegmentList, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSrPolicySegmentList) FromProto(msg *otg.BgpAttributesSrPolicySegmentList) (BgpAttributesSrPolicySegmentList, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSrPolicySegmentList) 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 *unMarshalbgpAttributesSrPolicySegmentList) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSrPolicySegmentList) 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 *unMarshalbgpAttributesSrPolicySegmentList) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSrPolicySegmentList) 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 *unMarshalbgpAttributesSrPolicySegmentList) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSrPolicySegmentList) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSrPolicySegmentList) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSrPolicySegmentList) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSrPolicySegmentList) Clone() (BgpAttributesSrPolicySegmentList, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSrPolicySegmentList() + 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 +} + +func (obj *bgpAttributesSrPolicySegmentList) setNil() { + obj.weightHolder = nil + obj.segmentsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSrPolicySegmentList is one optional SEGMENT_LIST sub-tlv encoded with type of 128. +// One sub-tlv (Type 128) encodes a single explicit path towards the endpoint as described in +// section 5.1 of [RFC9256]. +// The Segment List sub-TLV includes the elements of the paths (i.e., segments) as well +// as an optional Weight sub-TLV. +type BgpAttributesSrPolicySegmentList interface { + Validation + // msg marshals BgpAttributesSrPolicySegmentList to protobuf object *otg.BgpAttributesSrPolicySegmentList + // and doesn't set defaults + msg() *otg.BgpAttributesSrPolicySegmentList + // setMsg unmarshals BgpAttributesSrPolicySegmentList from protobuf object *otg.BgpAttributesSrPolicySegmentList + // and doesn't set defaults + setMsg(*otg.BgpAttributesSrPolicySegmentList) BgpAttributesSrPolicySegmentList + // provides marshal interface + Marshal() marshalBgpAttributesSrPolicySegmentList + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSrPolicySegmentList + // validate validates BgpAttributesSrPolicySegmentList + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSrPolicySegmentList, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Weight returns BgpAttributesSegmentRoutingPolicySegmentListWeight, set in BgpAttributesSrPolicySegmentList. + // BgpAttributesSegmentRoutingPolicySegmentListWeight is the optional Weight sub-TLV (Type 9) specifies the weight associated with a given segment list. The weight is used for weighted multipath. + Weight() BgpAttributesSegmentRoutingPolicySegmentListWeight + // SetWeight assigns BgpAttributesSegmentRoutingPolicySegmentListWeight provided by user to BgpAttributesSrPolicySegmentList. + // BgpAttributesSegmentRoutingPolicySegmentListWeight is the optional Weight sub-TLV (Type 9) specifies the weight associated with a given segment list. The weight is used for weighted multipath. + SetWeight(value BgpAttributesSegmentRoutingPolicySegmentListWeight) BgpAttributesSrPolicySegmentList + // HasWeight checks if Weight has been set in BgpAttributesSrPolicySegmentList + HasWeight() bool + // Segments returns BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIterIter, set in BgpAttributesSrPolicySegmentList + Segments() BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter + setNil() +} + +// description is TBD +// Weight returns a BgpAttributesSegmentRoutingPolicySegmentListWeight +func (obj *bgpAttributesSrPolicySegmentList) Weight() BgpAttributesSegmentRoutingPolicySegmentListWeight { + if obj.obj.Weight == nil { + obj.obj.Weight = NewBgpAttributesSegmentRoutingPolicySegmentListWeight().msg() + } + if obj.weightHolder == nil { + obj.weightHolder = &bgpAttributesSegmentRoutingPolicySegmentListWeight{obj: obj.obj.Weight} + } + return obj.weightHolder +} + +// description is TBD +// Weight returns a BgpAttributesSegmentRoutingPolicySegmentListWeight +func (obj *bgpAttributesSrPolicySegmentList) HasWeight() bool { + return obj.obj.Weight != nil +} + +// description is TBD +// SetWeight sets the BgpAttributesSegmentRoutingPolicySegmentListWeight value in the BgpAttributesSrPolicySegmentList object +func (obj *bgpAttributesSrPolicySegmentList) SetWeight(value BgpAttributesSegmentRoutingPolicySegmentListWeight) BgpAttributesSrPolicySegmentList { + + obj.weightHolder = nil + obj.obj.Weight = value.msg() + + return obj +} + +// description is TBD +// Segments returns a []BgpAttributesSegmentRoutingPolicySegmentListSegment +func (obj *bgpAttributesSrPolicySegmentList) Segments() BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { + if len(obj.obj.Segments) == 0 { + obj.obj.Segments = []*otg.BgpAttributesSegmentRoutingPolicySegmentListSegment{} + } + if obj.segmentsHolder == nil { + obj.segmentsHolder = newBgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter(&obj.obj.Segments).setMsg(obj) + } + return obj.segmentsHolder +} + +type bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter struct { + obj *bgpAttributesSrPolicySegmentList + bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice []BgpAttributesSegmentRoutingPolicySegmentListSegment + fieldPtr *[]*otg.BgpAttributesSegmentRoutingPolicySegmentListSegment +} + +func newBgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter(ptr *[]*otg.BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { + return &bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter{fieldPtr: ptr} +} + +type BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter interface { + setMsg(*bgpAttributesSrPolicySegmentList) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter + Items() []BgpAttributesSegmentRoutingPolicySegmentListSegment + Add() BgpAttributesSegmentRoutingPolicySegmentListSegment + Append(items ...BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter + Set(index int, newObj BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter + Clear() BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter + clearHolderSlice() BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter + appendHolderSlice(item BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter +} + +func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) setMsg(msg *bgpAttributesSrPolicySegmentList) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpAttributesSegmentRoutingPolicySegmentListSegment{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) Items() []BgpAttributesSegmentRoutingPolicySegmentListSegment { + return obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice +} + +func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) Add() BgpAttributesSegmentRoutingPolicySegmentListSegment { + newObj := &otg.BgpAttributesSegmentRoutingPolicySegmentListSegment{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpAttributesSegmentRoutingPolicySegmentListSegment{obj: newObj} + newLibObj.setDefault() + obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice = append(obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice, newLibObj) + return newLibObj +} + +func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) Append(items ...BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice = append(obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice, item) + } + return obj +} + +func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) Set(index int, newObj BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice[index] = newObj + return obj +} +func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) Clear() BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpAttributesSegmentRoutingPolicySegmentListSegment{} + obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice = []BgpAttributesSegmentRoutingPolicySegmentListSegment{} + } + return obj +} +func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) clearHolderSlice() BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { + if len(obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice) > 0 { + obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice = []BgpAttributesSegmentRoutingPolicySegmentListSegment{} + } + return obj +} +func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) appendHolderSlice(item BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { + obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice = append(obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice, item) + return obj +} + +func (obj *bgpAttributesSrPolicySegmentList) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Weight != nil { + + obj.Weight().validateObj(vObj, set_default) + } + + if len(obj.obj.Segments) != 0 { + + if set_default { + obj.Segments().clearHolderSlice() + for _, item := range obj.obj.Segments { + obj.Segments().appendHolderSlice(&bgpAttributesSegmentRoutingPolicySegmentListSegment{obj: item}) + } + } + for _, item := range obj.Segments().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpAttributesSrPolicySegmentList) setDefault() { + +} diff --git a/gosnappi/bgp_attributes_srv6_bsid.go b/gosnappi/bgp_attributes_srv6_bsid.go new file mode 100644 index 00000000..36b6c74d --- /dev/null +++ b/gosnappi/bgp_attributes_srv6_bsid.go @@ -0,0 +1,474 @@ +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" +) + +// ***** BgpAttributesSrv6Bsid ***** +type bgpAttributesSrv6Bsid struct { + validation + obj *otg.BgpAttributesSrv6Bsid + marshaller marshalBgpAttributesSrv6Bsid + unMarshaller unMarshalBgpAttributesSrv6Bsid + srv6EndpointBehaviorHolder BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +} + +func NewBgpAttributesSrv6Bsid() BgpAttributesSrv6Bsid { + obj := bgpAttributesSrv6Bsid{obj: &otg.BgpAttributesSrv6Bsid{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesSrv6Bsid) msg() *otg.BgpAttributesSrv6Bsid { + return obj.obj +} + +func (obj *bgpAttributesSrv6Bsid) setMsg(msg *otg.BgpAttributesSrv6Bsid) BgpAttributesSrv6Bsid { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesSrv6Bsid struct { + obj *bgpAttributesSrv6Bsid +} + +type marshalBgpAttributesSrv6Bsid interface { + // ToProto marshals BgpAttributesSrv6Bsid to protobuf object *otg.BgpAttributesSrv6Bsid + ToProto() (*otg.BgpAttributesSrv6Bsid, error) + // ToPbText marshals BgpAttributesSrv6Bsid to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesSrv6Bsid to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesSrv6Bsid to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesSrv6Bsid struct { + obj *bgpAttributesSrv6Bsid +} + +type unMarshalBgpAttributesSrv6Bsid interface { + // FromProto unmarshals BgpAttributesSrv6Bsid from protobuf object *otg.BgpAttributesSrv6Bsid + FromProto(msg *otg.BgpAttributesSrv6Bsid) (BgpAttributesSrv6Bsid, error) + // FromPbText unmarshals BgpAttributesSrv6Bsid from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesSrv6Bsid from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesSrv6Bsid from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesSrv6Bsid) Marshal() marshalBgpAttributesSrv6Bsid { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesSrv6Bsid{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesSrv6Bsid) Unmarshal() unMarshalBgpAttributesSrv6Bsid { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesSrv6Bsid{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesSrv6Bsid) ToProto() (*otg.BgpAttributesSrv6Bsid, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesSrv6Bsid) FromProto(msg *otg.BgpAttributesSrv6Bsid) (BgpAttributesSrv6Bsid, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesSrv6Bsid) 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 *unMarshalbgpAttributesSrv6Bsid) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesSrv6Bsid) 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 *unMarshalbgpAttributesSrv6Bsid) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesSrv6Bsid) 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 *unMarshalbgpAttributesSrv6Bsid) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesSrv6Bsid) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesSrv6Bsid) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesSrv6Bsid) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesSrv6Bsid) Clone() (BgpAttributesSrv6Bsid, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesSrv6Bsid() + 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 +} + +func (obj *bgpAttributesSrv6Bsid) setNil() { + obj.srv6EndpointBehaviorHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesSrv6Bsid is the SRv6 Binding SID sub-TLV is an optional sub-TLV of type 20 that is used to signal the SRv6 Binding SID +// related information of an SR Policy candidate path. +// - More than one SRv6 Binding SID sub-TLVs MAY be signaled in the same SR Policy encoding to indicate one or +// more SRv6 SIDs, each with potentially different SRv6 Endpoint Behaviors to be instantiated. +// - The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.3 . +type BgpAttributesSrv6Bsid interface { + Validation + // msg marshals BgpAttributesSrv6Bsid to protobuf object *otg.BgpAttributesSrv6Bsid + // and doesn't set defaults + msg() *otg.BgpAttributesSrv6Bsid + // setMsg unmarshals BgpAttributesSrv6Bsid from protobuf object *otg.BgpAttributesSrv6Bsid + // and doesn't set defaults + setMsg(*otg.BgpAttributesSrv6Bsid) BgpAttributesSrv6Bsid + // provides marshal interface + Marshal() marshalBgpAttributesSrv6Bsid + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesSrv6Bsid + // validate validates BgpAttributesSrv6Bsid + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesSrv6Bsid, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // FlagSpecifiedBsidOnly returns bool, set in BgpAttributesSrv6Bsid. + FlagSpecifiedBsidOnly() bool + // SetFlagSpecifiedBsidOnly assigns bool provided by user to BgpAttributesSrv6Bsid + SetFlagSpecifiedBsidOnly(value bool) BgpAttributesSrv6Bsid + // HasFlagSpecifiedBsidOnly checks if FlagSpecifiedBsidOnly has been set in BgpAttributesSrv6Bsid + HasFlagSpecifiedBsidOnly() bool + // FlagDropUponInvalid returns bool, set in BgpAttributesSrv6Bsid. + FlagDropUponInvalid() bool + // SetFlagDropUponInvalid assigns bool provided by user to BgpAttributesSrv6Bsid + SetFlagDropUponInvalid(value bool) BgpAttributesSrv6Bsid + // HasFlagDropUponInvalid checks if FlagDropUponInvalid has been set in BgpAttributesSrv6Bsid + HasFlagDropUponInvalid() bool + // FlagSrv6EndpointBehavior returns bool, set in BgpAttributesSrv6Bsid. + FlagSrv6EndpointBehavior() bool + // SetFlagSrv6EndpointBehavior assigns bool provided by user to BgpAttributesSrv6Bsid + SetFlagSrv6EndpointBehavior(value bool) BgpAttributesSrv6Bsid + // HasFlagSrv6EndpointBehavior checks if FlagSrv6EndpointBehavior has been set in BgpAttributesSrv6Bsid + HasFlagSrv6EndpointBehavior() bool + // Ipv6Addr returns string, set in BgpAttributesSrv6Bsid. + Ipv6Addr() string + // SetIpv6Addr assigns string provided by user to BgpAttributesSrv6Bsid + SetIpv6Addr(value string) BgpAttributesSrv6Bsid + // HasIpv6Addr checks if Ipv6Addr has been set in BgpAttributesSrv6Bsid + HasIpv6Addr() bool + // Srv6EndpointBehavior returns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, set in BgpAttributesSrv6Bsid. + // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 + Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure + // SetSrv6EndpointBehavior assigns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure provided by user to BgpAttributesSrv6Bsid. + // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 + SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSrv6Bsid + // HasSrv6EndpointBehavior checks if Srv6EndpointBehavior has been set in BgpAttributesSrv6Bsid + HasSrv6EndpointBehavior() bool + setNil() +} + +// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is +// described in section 6.2.3 in [RFC9256]. +// FlagSpecifiedBsidOnly returns a bool +func (obj *bgpAttributesSrv6Bsid) FlagSpecifiedBsidOnly() bool { + + return *obj.obj.FlagSpecifiedBsidOnly + +} + +// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is +// described in section 6.2.3 in [RFC9256]. +// FlagSpecifiedBsidOnly returns a bool +func (obj *bgpAttributesSrv6Bsid) HasFlagSpecifiedBsidOnly() bool { + return obj.obj.FlagSpecifiedBsidOnly != nil +} + +// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is +// described in section 6.2.3 in [RFC9256]. +// SetFlagSpecifiedBsidOnly sets the bool value in the BgpAttributesSrv6Bsid object +func (obj *bgpAttributesSrv6Bsid) SetFlagSpecifiedBsidOnly(value bool) BgpAttributesSrv6Bsid { + + obj.obj.FlagSpecifiedBsidOnly = &value + return obj +} + +// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. +// It's usage is described in section 8.2 in [RFC9256]. +// FlagDropUponInvalid returns a bool +func (obj *bgpAttributesSrv6Bsid) FlagDropUponInvalid() bool { + + return *obj.obj.FlagDropUponInvalid + +} + +// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. +// It's usage is described in section 8.2 in [RFC9256]. +// FlagDropUponInvalid returns a bool +func (obj *bgpAttributesSrv6Bsid) HasFlagDropUponInvalid() bool { + return obj.obj.FlagDropUponInvalid != nil +} + +// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. +// It's usage is described in section 8.2 in [RFC9256]. +// SetFlagDropUponInvalid sets the bool value in the BgpAttributesSrv6Bsid object +func (obj *bgpAttributesSrv6Bsid) SetFlagDropUponInvalid(value bool) BgpAttributesSrv6Bsid { + + obj.obj.FlagDropUponInvalid = &value + return obj +} + +// B-Flag: This flag, when set, indicates the presence of the SRv6 Endpoint Behavior +// and SID Structure encoding specified in Section 2.4.4.2.4 of draft-ietf-idr-sr-policy-safi-02. +// FlagSrv6EndpointBehavior returns a bool +func (obj *bgpAttributesSrv6Bsid) FlagSrv6EndpointBehavior() bool { + + return *obj.obj.FlagSrv6EndpointBehavior + +} + +// B-Flag: This flag, when set, indicates the presence of the SRv6 Endpoint Behavior +// and SID Structure encoding specified in Section 2.4.4.2.4 of draft-ietf-idr-sr-policy-safi-02. +// FlagSrv6EndpointBehavior returns a bool +func (obj *bgpAttributesSrv6Bsid) HasFlagSrv6EndpointBehavior() bool { + return obj.obj.FlagSrv6EndpointBehavior != nil +} + +// B-Flag: This flag, when set, indicates the presence of the SRv6 Endpoint Behavior +// and SID Structure encoding specified in Section 2.4.4.2.4 of draft-ietf-idr-sr-policy-safi-02. +// SetFlagSrv6EndpointBehavior sets the bool value in the BgpAttributesSrv6Bsid object +func (obj *bgpAttributesSrv6Bsid) SetFlagSrv6EndpointBehavior(value bool) BgpAttributesSrv6Bsid { + + obj.obj.FlagSrv6EndpointBehavior = &value + return obj +} + +// IPv6 address denoting the SRv6 SID. +// Ipv6Addr returns a string +func (obj *bgpAttributesSrv6Bsid) Ipv6Addr() string { + + return *obj.obj.Ipv6Addr + +} + +// IPv6 address denoting the SRv6 SID. +// Ipv6Addr returns a string +func (obj *bgpAttributesSrv6Bsid) HasIpv6Addr() bool { + return obj.obj.Ipv6Addr != nil +} + +// IPv6 address denoting the SRv6 SID. +// SetIpv6Addr sets the string value in the BgpAttributesSrv6Bsid object +func (obj *bgpAttributesSrv6Bsid) SetIpv6Addr(value string) BgpAttributesSrv6Bsid { + + obj.obj.Ipv6Addr = &value + return obj +} + +// description is TBD +// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +func (obj *bgpAttributesSrv6Bsid) Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { + if obj.obj.Srv6EndpointBehavior == nil { + obj.obj.Srv6EndpointBehavior = NewBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure().msg() + } + if obj.srv6EndpointBehaviorHolder == nil { + obj.srv6EndpointBehaviorHolder = &bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6EndpointBehavior} + } + return obj.srv6EndpointBehaviorHolder +} + +// description is TBD +// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure +func (obj *bgpAttributesSrv6Bsid) HasSrv6EndpointBehavior() bool { + return obj.obj.Srv6EndpointBehavior != nil +} + +// description is TBD +// SetSrv6EndpointBehavior sets the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure value in the BgpAttributesSrv6Bsid object +func (obj *bgpAttributesSrv6Bsid) SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSrv6Bsid { + + obj.srv6EndpointBehaviorHolder = nil + obj.obj.Srv6EndpointBehavior = value.msg() + + return obj +} + +func (obj *bgpAttributesSrv6Bsid) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv6Addr != nil { + + err := obj.validateIpv6(obj.Ipv6Addr()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSrv6Bsid.Ipv6Addr")) + } + + } + + if obj.obj.Srv6EndpointBehavior != nil { + + obj.Srv6EndpointBehavior().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesSrv6Bsid) setDefault() { + if obj.obj.FlagSpecifiedBsidOnly == nil { + obj.SetFlagSpecifiedBsidOnly(false) + } + if obj.obj.FlagDropUponInvalid == nil { + obj.SetFlagDropUponInvalid(false) + } + if obj.obj.FlagSrv6EndpointBehavior == nil { + obj.SetFlagSrv6EndpointBehavior(false) + } + if obj.obj.Ipv6Addr == nil { + obj.SetIpv6Addr("0::0") + } + +} diff --git a/gosnappi/bgp_attributes_tunnel_encapsulation.go b/gosnappi/bgp_attributes_tunnel_encapsulation.go new file mode 100644 index 00000000..9d27732f --- /dev/null +++ b/gosnappi/bgp_attributes_tunnel_encapsulation.go @@ -0,0 +1,399 @@ +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" +) + +// ***** BgpAttributesTunnelEncapsulation ***** +type bgpAttributesTunnelEncapsulation struct { + validation + obj *otg.BgpAttributesTunnelEncapsulation + marshaller marshalBgpAttributesTunnelEncapsulation + unMarshaller unMarshalBgpAttributesTunnelEncapsulation + srPolicyHolder BgpAttributesSegmentRoutingPolicy +} + +func NewBgpAttributesTunnelEncapsulation() BgpAttributesTunnelEncapsulation { + obj := bgpAttributesTunnelEncapsulation{obj: &otg.BgpAttributesTunnelEncapsulation{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesTunnelEncapsulation) msg() *otg.BgpAttributesTunnelEncapsulation { + return obj.obj +} + +func (obj *bgpAttributesTunnelEncapsulation) setMsg(msg *otg.BgpAttributesTunnelEncapsulation) BgpAttributesTunnelEncapsulation { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesTunnelEncapsulation struct { + obj *bgpAttributesTunnelEncapsulation +} + +type marshalBgpAttributesTunnelEncapsulation interface { + // ToProto marshals BgpAttributesTunnelEncapsulation to protobuf object *otg.BgpAttributesTunnelEncapsulation + ToProto() (*otg.BgpAttributesTunnelEncapsulation, error) + // ToPbText marshals BgpAttributesTunnelEncapsulation to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesTunnelEncapsulation to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesTunnelEncapsulation to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesTunnelEncapsulation struct { + obj *bgpAttributesTunnelEncapsulation +} + +type unMarshalBgpAttributesTunnelEncapsulation interface { + // FromProto unmarshals BgpAttributesTunnelEncapsulation from protobuf object *otg.BgpAttributesTunnelEncapsulation + FromProto(msg *otg.BgpAttributesTunnelEncapsulation) (BgpAttributesTunnelEncapsulation, error) + // FromPbText unmarshals BgpAttributesTunnelEncapsulation from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesTunnelEncapsulation from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesTunnelEncapsulation from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesTunnelEncapsulation) Marshal() marshalBgpAttributesTunnelEncapsulation { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesTunnelEncapsulation{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesTunnelEncapsulation) Unmarshal() unMarshalBgpAttributesTunnelEncapsulation { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesTunnelEncapsulation{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesTunnelEncapsulation) ToProto() (*otg.BgpAttributesTunnelEncapsulation, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesTunnelEncapsulation) FromProto(msg *otg.BgpAttributesTunnelEncapsulation) (BgpAttributesTunnelEncapsulation, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesTunnelEncapsulation) 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 *unMarshalbgpAttributesTunnelEncapsulation) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpAttributesTunnelEncapsulation) 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 *unMarshalbgpAttributesTunnelEncapsulation) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpAttributesTunnelEncapsulation) 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 *unMarshalbgpAttributesTunnelEncapsulation) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpAttributesTunnelEncapsulation) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesTunnelEncapsulation) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesTunnelEncapsulation) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesTunnelEncapsulation) Clone() (BgpAttributesTunnelEncapsulation, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesTunnelEncapsulation() + 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 +} + +func (obj *bgpAttributesTunnelEncapsulation) setNil() { + obj.srPolicyHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpAttributesTunnelEncapsulation is the TUNNEL_ENCAPSULATION attribute is used by a BGP speaker to inform other BGP speakers how to encapsulate packets that need to be sent to it. +// It is defined in RFC9012 and is assigned a Type code of 23. +type BgpAttributesTunnelEncapsulation interface { + Validation + // msg marshals BgpAttributesTunnelEncapsulation to protobuf object *otg.BgpAttributesTunnelEncapsulation + // and doesn't set defaults + msg() *otg.BgpAttributesTunnelEncapsulation + // setMsg unmarshals BgpAttributesTunnelEncapsulation from protobuf object *otg.BgpAttributesTunnelEncapsulation + // and doesn't set defaults + setMsg(*otg.BgpAttributesTunnelEncapsulation) BgpAttributesTunnelEncapsulation + // provides marshal interface + Marshal() marshalBgpAttributesTunnelEncapsulation + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesTunnelEncapsulation + // validate validates BgpAttributesTunnelEncapsulation + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesTunnelEncapsulation, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpAttributesTunnelEncapsulationChoiceEnum, set in BgpAttributesTunnelEncapsulation + Choice() BgpAttributesTunnelEncapsulationChoiceEnum + // setChoice assigns BgpAttributesTunnelEncapsulationChoiceEnum provided by user to BgpAttributesTunnelEncapsulation + setChoice(value BgpAttributesTunnelEncapsulationChoiceEnum) BgpAttributesTunnelEncapsulation + // HasChoice checks if Choice has been set in BgpAttributesTunnelEncapsulation + HasChoice() bool + // SrPolicy returns BgpAttributesSegmentRoutingPolicy, set in BgpAttributesTunnelEncapsulation. + // BgpAttributesSegmentRoutingPolicy is optional Segment Routing Policy information as defined in draft-ietf-idr-sr-policy-safi-02. + // This information is carried in TUNNEL_ENCAPSULATION attribute with type set to SR Policy (15). + SrPolicy() BgpAttributesSegmentRoutingPolicy + // SetSrPolicy assigns BgpAttributesSegmentRoutingPolicy provided by user to BgpAttributesTunnelEncapsulation. + // BgpAttributesSegmentRoutingPolicy is optional Segment Routing Policy information as defined in draft-ietf-idr-sr-policy-safi-02. + // This information is carried in TUNNEL_ENCAPSULATION attribute with type set to SR Policy (15). + SetSrPolicy(value BgpAttributesSegmentRoutingPolicy) BgpAttributesTunnelEncapsulation + // HasSrPolicy checks if SrPolicy has been set in BgpAttributesTunnelEncapsulation + HasSrPolicy() bool + setNil() +} + +type BgpAttributesTunnelEncapsulationChoiceEnum string + +// Enum of Choice on BgpAttributesTunnelEncapsulation +var BgpAttributesTunnelEncapsulationChoice = struct { + SR_POLICY BgpAttributesTunnelEncapsulationChoiceEnum +}{ + SR_POLICY: BgpAttributesTunnelEncapsulationChoiceEnum("sr_policy"), +} + +func (obj *bgpAttributesTunnelEncapsulation) Choice() BgpAttributesTunnelEncapsulationChoiceEnum { + return BgpAttributesTunnelEncapsulationChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// Identifies a type of tunnel. The field contains values from the IANA registry "BGP Tunnel Encapsulation Attribute Tunnel Types". +// Choice returns a string +func (obj *bgpAttributesTunnelEncapsulation) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpAttributesTunnelEncapsulation) setChoice(value BgpAttributesTunnelEncapsulationChoiceEnum) BgpAttributesTunnelEncapsulation { + intValue, ok := otg.BgpAttributesTunnelEncapsulation_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAttributesTunnelEncapsulationChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpAttributesTunnelEncapsulation_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.SrPolicy = nil + obj.srPolicyHolder = nil + + if value == BgpAttributesTunnelEncapsulationChoice.SR_POLICY { + obj.obj.SrPolicy = NewBgpAttributesSegmentRoutingPolicy().msg() + } + + return obj +} + +// description is TBD +// SrPolicy returns a BgpAttributesSegmentRoutingPolicy +func (obj *bgpAttributesTunnelEncapsulation) SrPolicy() BgpAttributesSegmentRoutingPolicy { + if obj.obj.SrPolicy == nil { + obj.setChoice(BgpAttributesTunnelEncapsulationChoice.SR_POLICY) + } + if obj.srPolicyHolder == nil { + obj.srPolicyHolder = &bgpAttributesSegmentRoutingPolicy{obj: obj.obj.SrPolicy} + } + return obj.srPolicyHolder +} + +// description is TBD +// SrPolicy returns a BgpAttributesSegmentRoutingPolicy +func (obj *bgpAttributesTunnelEncapsulation) HasSrPolicy() bool { + return obj.obj.SrPolicy != nil +} + +// description is TBD +// SetSrPolicy sets the BgpAttributesSegmentRoutingPolicy value in the BgpAttributesTunnelEncapsulation object +func (obj *bgpAttributesTunnelEncapsulation) SetSrPolicy(value BgpAttributesSegmentRoutingPolicy) BgpAttributesTunnelEncapsulation { + obj.setChoice(BgpAttributesTunnelEncapsulationChoice.SR_POLICY) + obj.srPolicyHolder = nil + obj.obj.SrPolicy = value.msg() + + return obj +} + +func (obj *bgpAttributesTunnelEncapsulation) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.SrPolicy != nil { + + obj.SrPolicy().validateObj(vObj, set_default) + } + +} + +func (obj *bgpAttributesTunnelEncapsulation) setDefault() { + var choices_set int = 0 + var choice BgpAttributesTunnelEncapsulationChoiceEnum + + if obj.obj.SrPolicy != nil { + choices_set += 1 + choice = BgpAttributesTunnelEncapsulationChoice.SR_POLICY + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(BgpAttributesTunnelEncapsulationChoice.SR_POLICY) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesTunnelEncapsulation") + } + } else { + intVal := otg.BgpAttributesTunnelEncapsulation_Choice_Enum_value[string(choice)] + enumValue := otg.BgpAttributesTunnelEncapsulation_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_attributes_two_byte_as_path_segment.go b/gosnappi/bgp_attributes_two_byte_as_path_segment.go new file mode 100644 index 00000000..524b9f33 --- /dev/null +++ b/gosnappi/bgp_attributes_two_byte_as_path_segment.go @@ -0,0 +1,374 @@ +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" +) + +// ***** BgpAttributesTwoByteAsPathSegment ***** +type bgpAttributesTwoByteAsPathSegment struct { + validation + obj *otg.BgpAttributesTwoByteAsPathSegment + marshaller marshalBgpAttributesTwoByteAsPathSegment + unMarshaller unMarshalBgpAttributesTwoByteAsPathSegment +} + +func NewBgpAttributesTwoByteAsPathSegment() BgpAttributesTwoByteAsPathSegment { + obj := bgpAttributesTwoByteAsPathSegment{obj: &otg.BgpAttributesTwoByteAsPathSegment{}} + obj.setDefault() + return &obj +} + +func (obj *bgpAttributesTwoByteAsPathSegment) msg() *otg.BgpAttributesTwoByteAsPathSegment { + return obj.obj +} + +func (obj *bgpAttributesTwoByteAsPathSegment) setMsg(msg *otg.BgpAttributesTwoByteAsPathSegment) BgpAttributesTwoByteAsPathSegment { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpAttributesTwoByteAsPathSegment struct { + obj *bgpAttributesTwoByteAsPathSegment +} + +type marshalBgpAttributesTwoByteAsPathSegment interface { + // ToProto marshals BgpAttributesTwoByteAsPathSegment to protobuf object *otg.BgpAttributesTwoByteAsPathSegment + ToProto() (*otg.BgpAttributesTwoByteAsPathSegment, error) + // ToPbText marshals BgpAttributesTwoByteAsPathSegment to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpAttributesTwoByteAsPathSegment to YAML text + ToYaml() (string, error) + // ToJson marshals BgpAttributesTwoByteAsPathSegment to JSON text + ToJson() (string, error) +} + +type unMarshalbgpAttributesTwoByteAsPathSegment struct { + obj *bgpAttributesTwoByteAsPathSegment +} + +type unMarshalBgpAttributesTwoByteAsPathSegment interface { + // FromProto unmarshals BgpAttributesTwoByteAsPathSegment from protobuf object *otg.BgpAttributesTwoByteAsPathSegment + FromProto(msg *otg.BgpAttributesTwoByteAsPathSegment) (BgpAttributesTwoByteAsPathSegment, error) + // FromPbText unmarshals BgpAttributesTwoByteAsPathSegment from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpAttributesTwoByteAsPathSegment from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpAttributesTwoByteAsPathSegment from JSON text + FromJson(value string) error +} + +func (obj *bgpAttributesTwoByteAsPathSegment) Marshal() marshalBgpAttributesTwoByteAsPathSegment { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpAttributesTwoByteAsPathSegment{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpAttributesTwoByteAsPathSegment) Unmarshal() unMarshalBgpAttributesTwoByteAsPathSegment { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpAttributesTwoByteAsPathSegment{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpAttributesTwoByteAsPathSegment) ToProto() (*otg.BgpAttributesTwoByteAsPathSegment, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpAttributesTwoByteAsPathSegment) FromProto(msg *otg.BgpAttributesTwoByteAsPathSegment) (BgpAttributesTwoByteAsPathSegment, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpAttributesTwoByteAsPathSegment) 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 *unMarshalbgpAttributesTwoByteAsPathSegment) 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 *marshalbgpAttributesTwoByteAsPathSegment) 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 *unMarshalbgpAttributesTwoByteAsPathSegment) 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 *marshalbgpAttributesTwoByteAsPathSegment) 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 *unMarshalbgpAttributesTwoByteAsPathSegment) 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 *bgpAttributesTwoByteAsPathSegment) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpAttributesTwoByteAsPathSegment) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpAttributesTwoByteAsPathSegment) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpAttributesTwoByteAsPathSegment) Clone() (BgpAttributesTwoByteAsPathSegment, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpAttributesTwoByteAsPathSegment() + 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 +} + +// BgpAttributesTwoByteAsPathSegment is configuration for a single BGP AS path segment containing 2 byte AS numbers. +type BgpAttributesTwoByteAsPathSegment interface { + Validation + // msg marshals BgpAttributesTwoByteAsPathSegment to protobuf object *otg.BgpAttributesTwoByteAsPathSegment + // and doesn't set defaults + msg() *otg.BgpAttributesTwoByteAsPathSegment + // setMsg unmarshals BgpAttributesTwoByteAsPathSegment from protobuf object *otg.BgpAttributesTwoByteAsPathSegment + // and doesn't set defaults + setMsg(*otg.BgpAttributesTwoByteAsPathSegment) BgpAttributesTwoByteAsPathSegment + // provides marshal interface + Marshal() marshalBgpAttributesTwoByteAsPathSegment + // provides unmarshal interface + Unmarshal() unMarshalBgpAttributesTwoByteAsPathSegment + // validate validates BgpAttributesTwoByteAsPathSegment + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpAttributesTwoByteAsPathSegment, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Type returns BgpAttributesTwoByteAsPathSegmentTypeEnum, set in BgpAttributesTwoByteAsPathSegment + Type() BgpAttributesTwoByteAsPathSegmentTypeEnum + // SetType assigns BgpAttributesTwoByteAsPathSegmentTypeEnum provided by user to BgpAttributesTwoByteAsPathSegment + SetType(value BgpAttributesTwoByteAsPathSegmentTypeEnum) BgpAttributesTwoByteAsPathSegment + // HasType checks if Type has been set in BgpAttributesTwoByteAsPathSegment + HasType() bool + // AsNumbers returns []uint32, set in BgpAttributesTwoByteAsPathSegment. + AsNumbers() []uint32 + // SetAsNumbers assigns []uint32 provided by user to BgpAttributesTwoByteAsPathSegment + SetAsNumbers(value []uint32) BgpAttributesTwoByteAsPathSegment +} + +type BgpAttributesTwoByteAsPathSegmentTypeEnum string + +// Enum of Type on BgpAttributesTwoByteAsPathSegment +var BgpAttributesTwoByteAsPathSegmentType = struct { + AS_SEQ BgpAttributesTwoByteAsPathSegmentTypeEnum + AS_SET BgpAttributesTwoByteAsPathSegmentTypeEnum + AS_CONFED_SEQ BgpAttributesTwoByteAsPathSegmentTypeEnum + AS_CONFED_SET BgpAttributesTwoByteAsPathSegmentTypeEnum +}{ + AS_SEQ: BgpAttributesTwoByteAsPathSegmentTypeEnum("as_seq"), + AS_SET: BgpAttributesTwoByteAsPathSegmentTypeEnum("as_set"), + AS_CONFED_SEQ: BgpAttributesTwoByteAsPathSegmentTypeEnum("as_confed_seq"), + AS_CONFED_SET: BgpAttributesTwoByteAsPathSegmentTypeEnum("as_confed_set"), +} + +func (obj *bgpAttributesTwoByteAsPathSegment) Type() BgpAttributesTwoByteAsPathSegmentTypeEnum { + return BgpAttributesTwoByteAsPathSegmentTypeEnum(obj.obj.Type.Enum().String()) +} + +// AS sequence is the most common type of AS_PATH, it contains the list +// of ASNs starting with the most recent ASN being added read from left +// to right. +// The other three AS_PATH types are used for Confederations +// - AS_SET is the type of AS_PATH attribute that summarizes routes using +// using the aggregate-address command, allowing AS_PATHs to be summarized +// in the update as well. +// - AS_CONFED_SEQ gives the list of ASNs in the path starting with the most +// recent ASN to be added reading left to right +// - AS_CONFED_SET will allow summarization of multiple AS PATHs to be sent +// in BGP Updates. +// Type returns a string +func (obj *bgpAttributesTwoByteAsPathSegment) HasType() bool { + return obj.obj.Type != nil +} + +func (obj *bgpAttributesTwoByteAsPathSegment) SetType(value BgpAttributesTwoByteAsPathSegmentTypeEnum) BgpAttributesTwoByteAsPathSegment { + intValue, ok := otg.BgpAttributesTwoByteAsPathSegment_Type_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpAttributesTwoByteAsPathSegmentTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpAttributesTwoByteAsPathSegment_Type_Enum(intValue) + obj.obj.Type = &enumValue + + return obj +} + +// The 2 byte AS numbers in this AS path segment. +// AsNumbers returns a []uint32 +func (obj *bgpAttributesTwoByteAsPathSegment) AsNumbers() []uint32 { + if obj.obj.AsNumbers == nil { + obj.obj.AsNumbers = make([]uint32, 0) + } + return obj.obj.AsNumbers +} + +// The 2 byte AS numbers in this AS path segment. +// SetAsNumbers sets the []uint32 value in the BgpAttributesTwoByteAsPathSegment object +func (obj *bgpAttributesTwoByteAsPathSegment) SetAsNumbers(value []uint32) BgpAttributesTwoByteAsPathSegment { + + if obj.obj.AsNumbers == nil { + obj.obj.AsNumbers = make([]uint32, 0) + } + obj.obj.AsNumbers = value + + return obj +} + +func (obj *bgpAttributesTwoByteAsPathSegment) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.AsNumbers != nil { + + for _, item := range obj.obj.AsNumbers { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= BgpAttributesTwoByteAsPathSegment.AsNumbers <= 65535 but Got %d", item)) + } + + } + + } + +} + +func (obj *bgpAttributesTwoByteAsPathSegment) setDefault() { + if obj.obj.Type == nil { + obj.SetType(BgpAttributesTwoByteAsPathSegmentType.AS_SEQ) + + } + +} diff --git a/gosnappi/bgp_c_mac_ip_range.go b/gosnappi/bgp_c_mac_ip_range.go new file mode 100644 index 00000000..b2cc2c04 --- /dev/null +++ b/gosnappi/bgp_c_mac_ip_range.go @@ -0,0 +1,851 @@ +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" +) + +// ***** BgpCMacIpRange ***** +type bgpCMacIpRange struct { + validation + obj *otg.BgpCMacIpRange + marshaller marshalBgpCMacIpRange + unMarshaller unMarshalBgpCMacIpRange + macAddressesHolder MACRouteAddress + ipv4AddressesHolder V4RouteAddress + ipv6AddressesHolder V6RouteAddress + advancedHolder BgpRouteAdvanced + communitiesHolder BgpCMacIpRangeBgpCommunityIter + extCommunitiesHolder BgpCMacIpRangeBgpExtCommunityIter + asPathHolder BgpAsPath +} + +func NewBgpCMacIpRange() BgpCMacIpRange { + obj := bgpCMacIpRange{obj: &otg.BgpCMacIpRange{}} + obj.setDefault() + return &obj +} + +func (obj *bgpCMacIpRange) msg() *otg.BgpCMacIpRange { + return obj.obj +} + +func (obj *bgpCMacIpRange) setMsg(msg *otg.BgpCMacIpRange) BgpCMacIpRange { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpCMacIpRange struct { + obj *bgpCMacIpRange +} + +type marshalBgpCMacIpRange interface { + // ToProto marshals BgpCMacIpRange to protobuf object *otg.BgpCMacIpRange + ToProto() (*otg.BgpCMacIpRange, error) + // ToPbText marshals BgpCMacIpRange to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpCMacIpRange to YAML text + ToYaml() (string, error) + // ToJson marshals BgpCMacIpRange to JSON text + ToJson() (string, error) +} + +type unMarshalbgpCMacIpRange struct { + obj *bgpCMacIpRange +} + +type unMarshalBgpCMacIpRange interface { + // FromProto unmarshals BgpCMacIpRange from protobuf object *otg.BgpCMacIpRange + FromProto(msg *otg.BgpCMacIpRange) (BgpCMacIpRange, error) + // FromPbText unmarshals BgpCMacIpRange from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpCMacIpRange from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpCMacIpRange from JSON text + FromJson(value string) error +} + +func (obj *bgpCMacIpRange) Marshal() marshalBgpCMacIpRange { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpCMacIpRange{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpCMacIpRange) Unmarshal() unMarshalBgpCMacIpRange { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpCMacIpRange{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpCMacIpRange) ToProto() (*otg.BgpCMacIpRange, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpCMacIpRange) FromProto(msg *otg.BgpCMacIpRange) (BgpCMacIpRange, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpCMacIpRange) 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 *unMarshalbgpCMacIpRange) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpCMacIpRange) 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 *unMarshalbgpCMacIpRange) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpCMacIpRange) 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 *unMarshalbgpCMacIpRange) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpCMacIpRange) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpCMacIpRange) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpCMacIpRange) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpCMacIpRange) Clone() (BgpCMacIpRange, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpCMacIpRange() + 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 +} + +func (obj *bgpCMacIpRange) setNil() { + obj.macAddressesHolder = nil + obj.ipv4AddressesHolder = nil + obj.ipv6AddressesHolder = nil + obj.advancedHolder = nil + obj.communitiesHolder = nil + obj.extCommunitiesHolder = nil + obj.asPathHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpCMacIpRange is configuration for MAC/IP Ranges per Broadcast Domain. +// +// Advertises following route - +// +// Type 2 - MAC/IP Advertisement Route. +type BgpCMacIpRange interface { + Validation + // msg marshals BgpCMacIpRange to protobuf object *otg.BgpCMacIpRange + // and doesn't set defaults + msg() *otg.BgpCMacIpRange + // setMsg unmarshals BgpCMacIpRange from protobuf object *otg.BgpCMacIpRange + // and doesn't set defaults + setMsg(*otg.BgpCMacIpRange) BgpCMacIpRange + // provides marshal interface + Marshal() marshalBgpCMacIpRange + // provides unmarshal interface + Unmarshal() unMarshalBgpCMacIpRange + // validate validates BgpCMacIpRange + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpCMacIpRange, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // MacAddresses returns MACRouteAddress, set in BgpCMacIpRange. + // MACRouteAddress is a container for MAC route addresses. + MacAddresses() MACRouteAddress + // SetMacAddresses assigns MACRouteAddress provided by user to BgpCMacIpRange. + // MACRouteAddress is a container for MAC route addresses. + SetMacAddresses(value MACRouteAddress) BgpCMacIpRange + // HasMacAddresses checks if MacAddresses has been set in BgpCMacIpRange + HasMacAddresses() bool + // L2Vni returns uint32, set in BgpCMacIpRange. + L2Vni() uint32 + // SetL2Vni assigns uint32 provided by user to BgpCMacIpRange + SetL2Vni(value uint32) BgpCMacIpRange + // HasL2Vni checks if L2Vni has been set in BgpCMacIpRange + HasL2Vni() bool + // Ipv4Addresses returns V4RouteAddress, set in BgpCMacIpRange. + // V4RouteAddress is a container for IPv4 route addresses. + Ipv4Addresses() V4RouteAddress + // SetIpv4Addresses assigns V4RouteAddress provided by user to BgpCMacIpRange. + // V4RouteAddress is a container for IPv4 route addresses. + SetIpv4Addresses(value V4RouteAddress) BgpCMacIpRange + // HasIpv4Addresses checks if Ipv4Addresses has been set in BgpCMacIpRange + HasIpv4Addresses() bool + // Ipv6Addresses returns V6RouteAddress, set in BgpCMacIpRange. + // V6RouteAddress is a container for IPv6 route addresses. + Ipv6Addresses() V6RouteAddress + // SetIpv6Addresses assigns V6RouteAddress provided by user to BgpCMacIpRange. + // V6RouteAddress is a container for IPv6 route addresses. + SetIpv6Addresses(value V6RouteAddress) BgpCMacIpRange + // HasIpv6Addresses checks if Ipv6Addresses has been set in BgpCMacIpRange + HasIpv6Addresses() bool + // L3Vni returns uint32, set in BgpCMacIpRange. + L3Vni() uint32 + // SetL3Vni assigns uint32 provided by user to BgpCMacIpRange + SetL3Vni(value uint32) BgpCMacIpRange + // HasL3Vni checks if L3Vni has been set in BgpCMacIpRange + HasL3Vni() bool + // IncludeDefaultGateway returns bool, set in BgpCMacIpRange. + IncludeDefaultGateway() bool + // SetIncludeDefaultGateway assigns bool provided by user to BgpCMacIpRange + SetIncludeDefaultGateway(value bool) BgpCMacIpRange + // HasIncludeDefaultGateway checks if IncludeDefaultGateway has been set in BgpCMacIpRange + HasIncludeDefaultGateway() bool + // Advanced returns BgpRouteAdvanced, set in BgpCMacIpRange. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + Advanced() BgpRouteAdvanced + // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpCMacIpRange. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + SetAdvanced(value BgpRouteAdvanced) BgpCMacIpRange + // HasAdvanced checks if Advanced has been set in BgpCMacIpRange + HasAdvanced() bool + // Communities returns BgpCMacIpRangeBgpCommunityIterIter, set in BgpCMacIpRange + Communities() BgpCMacIpRangeBgpCommunityIter + // ExtCommunities returns BgpCMacIpRangeBgpExtCommunityIterIter, set in BgpCMacIpRange + ExtCommunities() BgpCMacIpRangeBgpExtCommunityIter + // AsPath returns BgpAsPath, set in BgpCMacIpRange. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + AsPath() BgpAsPath + // SetAsPath assigns BgpAsPath provided by user to BgpCMacIpRange. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + SetAsPath(value BgpAsPath) BgpCMacIpRange + // HasAsPath checks if AsPath has been set in BgpCMacIpRange + HasAsPath() bool + // Name returns string, set in BgpCMacIpRange. + Name() string + // SetName assigns string provided by user to BgpCMacIpRange + SetName(value string) BgpCMacIpRange + setNil() +} + +// Host MAC address range per Broadcast Domain. +// MacAddresses returns a MACRouteAddress +func (obj *bgpCMacIpRange) MacAddresses() MACRouteAddress { + if obj.obj.MacAddresses == nil { + obj.obj.MacAddresses = NewMACRouteAddress().msg() + } + if obj.macAddressesHolder == nil { + obj.macAddressesHolder = &mACRouteAddress{obj: obj.obj.MacAddresses} + } + return obj.macAddressesHolder +} + +// Host MAC address range per Broadcast Domain. +// MacAddresses returns a MACRouteAddress +func (obj *bgpCMacIpRange) HasMacAddresses() bool { + return obj.obj.MacAddresses != nil +} + +// Host MAC address range per Broadcast Domain. +// SetMacAddresses sets the MACRouteAddress value in the BgpCMacIpRange object +func (obj *bgpCMacIpRange) SetMacAddresses(value MACRouteAddress) BgpCMacIpRange { + + obj.macAddressesHolder = nil + obj.obj.MacAddresses = value.msg() + + return obj +} + +// Layer 2 Virtual Network Identifier (L2VNI) to be advertised with MAC/IP Advertisement Route (Type 2) +// L2Vni returns a uint32 +func (obj *bgpCMacIpRange) L2Vni() uint32 { + + return *obj.obj.L2Vni + +} + +// Layer 2 Virtual Network Identifier (L2VNI) to be advertised with MAC/IP Advertisement Route (Type 2) +// L2Vni returns a uint32 +func (obj *bgpCMacIpRange) HasL2Vni() bool { + return obj.obj.L2Vni != nil +} + +// Layer 2 Virtual Network Identifier (L2VNI) to be advertised with MAC/IP Advertisement Route (Type 2) +// SetL2Vni sets the uint32 value in the BgpCMacIpRange object +func (obj *bgpCMacIpRange) SetL2Vni(value uint32) BgpCMacIpRange { + + obj.obj.L2Vni = &value + return obj +} + +// Host IPv4 address range per Broadcast Domain. +// Ipv4Addresses returns a V4RouteAddress +func (obj *bgpCMacIpRange) Ipv4Addresses() V4RouteAddress { + if obj.obj.Ipv4Addresses == nil { + obj.obj.Ipv4Addresses = NewV4RouteAddress().msg() + } + if obj.ipv4AddressesHolder == nil { + obj.ipv4AddressesHolder = &v4RouteAddress{obj: obj.obj.Ipv4Addresses} + } + return obj.ipv4AddressesHolder +} + +// Host IPv4 address range per Broadcast Domain. +// Ipv4Addresses returns a V4RouteAddress +func (obj *bgpCMacIpRange) HasIpv4Addresses() bool { + return obj.obj.Ipv4Addresses != nil +} + +// Host IPv4 address range per Broadcast Domain. +// SetIpv4Addresses sets the V4RouteAddress value in the BgpCMacIpRange object +func (obj *bgpCMacIpRange) SetIpv4Addresses(value V4RouteAddress) BgpCMacIpRange { + + obj.ipv4AddressesHolder = nil + obj.obj.Ipv4Addresses = value.msg() + + return obj +} + +// Host IPv6 address range per Broadcast Domain. +// Ipv6Addresses returns a V6RouteAddress +func (obj *bgpCMacIpRange) Ipv6Addresses() V6RouteAddress { + if obj.obj.Ipv6Addresses == nil { + obj.obj.Ipv6Addresses = NewV6RouteAddress().msg() + } + if obj.ipv6AddressesHolder == nil { + obj.ipv6AddressesHolder = &v6RouteAddress{obj: obj.obj.Ipv6Addresses} + } + return obj.ipv6AddressesHolder +} + +// Host IPv6 address range per Broadcast Domain. +// Ipv6Addresses returns a V6RouteAddress +func (obj *bgpCMacIpRange) HasIpv6Addresses() bool { + return obj.obj.Ipv6Addresses != nil +} + +// Host IPv6 address range per Broadcast Domain. +// SetIpv6Addresses sets the V6RouteAddress value in the BgpCMacIpRange object +func (obj *bgpCMacIpRange) SetIpv6Addresses(value V6RouteAddress) BgpCMacIpRange { + + obj.ipv6AddressesHolder = nil + obj.obj.Ipv6Addresses = value.msg() + + return obj +} + +// Layer 3 Virtual Network Identifier (L3VNI) to be advertised with MAC/IP Advertisement Route (Type 2). +// L3Vni returns a uint32 +func (obj *bgpCMacIpRange) L3Vni() uint32 { + + return *obj.obj.L3Vni + +} + +// Layer 3 Virtual Network Identifier (L3VNI) to be advertised with MAC/IP Advertisement Route (Type 2). +// L3Vni returns a uint32 +func (obj *bgpCMacIpRange) HasL3Vni() bool { + return obj.obj.L3Vni != nil +} + +// Layer 3 Virtual Network Identifier (L3VNI) to be advertised with MAC/IP Advertisement Route (Type 2). +// SetL3Vni sets the uint32 value in the BgpCMacIpRange object +func (obj *bgpCMacIpRange) SetL3Vni(value uint32) BgpCMacIpRange { + + obj.obj.L3Vni = &value + return obj +} + +// Include default Gateway Extended Community in MAC/IP Advertisement Route (Type 2). +// IncludeDefaultGateway returns a bool +func (obj *bgpCMacIpRange) IncludeDefaultGateway() bool { + + return *obj.obj.IncludeDefaultGateway + +} + +// Include default Gateway Extended Community in MAC/IP Advertisement Route (Type 2). +// IncludeDefaultGateway returns a bool +func (obj *bgpCMacIpRange) HasIncludeDefaultGateway() bool { + return obj.obj.IncludeDefaultGateway != nil +} + +// Include default Gateway Extended Community in MAC/IP Advertisement Route (Type 2). +// SetIncludeDefaultGateway sets the bool value in the BgpCMacIpRange object +func (obj *bgpCMacIpRange) SetIncludeDefaultGateway(value bool) BgpCMacIpRange { + + obj.obj.IncludeDefaultGateway = &value + return obj +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpCMacIpRange) Advanced() BgpRouteAdvanced { + if obj.obj.Advanced == nil { + obj.obj.Advanced = NewBgpRouteAdvanced().msg() + } + if obj.advancedHolder == nil { + obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} + } + return obj.advancedHolder +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpCMacIpRange) HasAdvanced() bool { + return obj.obj.Advanced != nil +} + +// description is TBD +// SetAdvanced sets the BgpRouteAdvanced value in the BgpCMacIpRange object +func (obj *bgpCMacIpRange) SetAdvanced(value BgpRouteAdvanced) BgpCMacIpRange { + + obj.advancedHolder = nil + obj.obj.Advanced = value.msg() + + return obj +} + +// Optional community settings. +// Communities returns a []BgpCommunity +func (obj *bgpCMacIpRange) Communities() BgpCMacIpRangeBgpCommunityIter { + if len(obj.obj.Communities) == 0 { + obj.obj.Communities = []*otg.BgpCommunity{} + } + if obj.communitiesHolder == nil { + obj.communitiesHolder = newBgpCMacIpRangeBgpCommunityIter(&obj.obj.Communities).setMsg(obj) + } + return obj.communitiesHolder +} + +type bgpCMacIpRangeBgpCommunityIter struct { + obj *bgpCMacIpRange + bgpCommunitySlice []BgpCommunity + fieldPtr *[]*otg.BgpCommunity +} + +func newBgpCMacIpRangeBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpCMacIpRangeBgpCommunityIter { + return &bgpCMacIpRangeBgpCommunityIter{fieldPtr: ptr} +} + +type BgpCMacIpRangeBgpCommunityIter interface { + setMsg(*bgpCMacIpRange) BgpCMacIpRangeBgpCommunityIter + Items() []BgpCommunity + Add() BgpCommunity + Append(items ...BgpCommunity) BgpCMacIpRangeBgpCommunityIter + Set(index int, newObj BgpCommunity) BgpCMacIpRangeBgpCommunityIter + Clear() BgpCMacIpRangeBgpCommunityIter + clearHolderSlice() BgpCMacIpRangeBgpCommunityIter + appendHolderSlice(item BgpCommunity) BgpCMacIpRangeBgpCommunityIter +} + +func (obj *bgpCMacIpRangeBgpCommunityIter) setMsg(msg *bgpCMacIpRange) BgpCMacIpRangeBgpCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpCMacIpRangeBgpCommunityIter) Items() []BgpCommunity { + return obj.bgpCommunitySlice +} + +func (obj *bgpCMacIpRangeBgpCommunityIter) Add() BgpCommunity { + newObj := &otg.BgpCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpCMacIpRangeBgpCommunityIter) Append(items ...BgpCommunity) BgpCMacIpRangeBgpCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + } + return obj +} + +func (obj *bgpCMacIpRangeBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpCMacIpRangeBgpCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpCommunitySlice[index] = newObj + return obj +} +func (obj *bgpCMacIpRangeBgpCommunityIter) Clear() BgpCMacIpRangeBgpCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpCommunity{} + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpCMacIpRangeBgpCommunityIter) clearHolderSlice() BgpCMacIpRangeBgpCommunityIter { + if len(obj.bgpCommunitySlice) > 0 { + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpCMacIpRangeBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpCMacIpRangeBgpCommunityIter { + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + return obj +} + +// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. +// ExtCommunities returns a []BgpExtCommunity +func (obj *bgpCMacIpRange) ExtCommunities() BgpCMacIpRangeBgpExtCommunityIter { + if len(obj.obj.ExtCommunities) == 0 { + obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} + } + if obj.extCommunitiesHolder == nil { + obj.extCommunitiesHolder = newBgpCMacIpRangeBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) + } + return obj.extCommunitiesHolder +} + +type bgpCMacIpRangeBgpExtCommunityIter struct { + obj *bgpCMacIpRange + bgpExtCommunitySlice []BgpExtCommunity + fieldPtr *[]*otg.BgpExtCommunity +} + +func newBgpCMacIpRangeBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpCMacIpRangeBgpExtCommunityIter { + return &bgpCMacIpRangeBgpExtCommunityIter{fieldPtr: ptr} +} + +type BgpCMacIpRangeBgpExtCommunityIter interface { + setMsg(*bgpCMacIpRange) BgpCMacIpRangeBgpExtCommunityIter + Items() []BgpExtCommunity + Add() BgpExtCommunity + Append(items ...BgpExtCommunity) BgpCMacIpRangeBgpExtCommunityIter + Set(index int, newObj BgpExtCommunity) BgpCMacIpRangeBgpExtCommunityIter + Clear() BgpCMacIpRangeBgpExtCommunityIter + clearHolderSlice() BgpCMacIpRangeBgpExtCommunityIter + appendHolderSlice(item BgpExtCommunity) BgpCMacIpRangeBgpExtCommunityIter +} + +func (obj *bgpCMacIpRangeBgpExtCommunityIter) setMsg(msg *bgpCMacIpRange) BgpCMacIpRangeBgpExtCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpExtCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpCMacIpRangeBgpExtCommunityIter) Items() []BgpExtCommunity { + return obj.bgpExtCommunitySlice +} + +func (obj *bgpCMacIpRangeBgpExtCommunityIter) Add() BgpExtCommunity { + newObj := &otg.BgpExtCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpExtCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpCMacIpRangeBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpCMacIpRangeBgpExtCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + } + return obj +} + +func (obj *bgpCMacIpRangeBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpCMacIpRangeBgpExtCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpExtCommunitySlice[index] = newObj + return obj +} +func (obj *bgpCMacIpRangeBgpExtCommunityIter) Clear() BgpCMacIpRangeBgpExtCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpExtCommunity{} + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpCMacIpRangeBgpExtCommunityIter) clearHolderSlice() BgpCMacIpRangeBgpExtCommunityIter { + if len(obj.bgpExtCommunitySlice) > 0 { + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpCMacIpRangeBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpCMacIpRangeBgpExtCommunityIter { + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + return obj +} + +// Optional AS PATH settings. +// AsPath returns a BgpAsPath +func (obj *bgpCMacIpRange) AsPath() BgpAsPath { + if obj.obj.AsPath == nil { + obj.obj.AsPath = NewBgpAsPath().msg() + } + if obj.asPathHolder == nil { + obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} + } + return obj.asPathHolder +} + +// Optional AS PATH settings. +// AsPath returns a BgpAsPath +func (obj *bgpCMacIpRange) HasAsPath() bool { + return obj.obj.AsPath != nil +} + +// Optional AS PATH settings. +// SetAsPath sets the BgpAsPath value in the BgpCMacIpRange object +func (obj *bgpCMacIpRange) SetAsPath(value BgpAsPath) BgpCMacIpRange { + + obj.asPathHolder = nil + obj.obj.AsPath = value.msg() + + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *bgpCMacIpRange) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the BgpCMacIpRange object +func (obj *bgpCMacIpRange) SetName(value string) BgpCMacIpRange { + + obj.obj.Name = &value + return obj +} + +func (obj *bgpCMacIpRange) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.MacAddresses != nil { + + obj.MacAddresses().validateObj(vObj, set_default) + } + + if obj.obj.L2Vni != nil { + + if *obj.obj.L2Vni > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpCMacIpRange.L2Vni <= 16777215 but Got %d", *obj.obj.L2Vni)) + } + + } + + if obj.obj.Ipv4Addresses != nil { + + obj.Ipv4Addresses().validateObj(vObj, set_default) + } + + if obj.obj.Ipv6Addresses != nil { + + obj.Ipv6Addresses().validateObj(vObj, set_default) + } + + if obj.obj.L3Vni != nil { + + if *obj.obj.L3Vni > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpCMacIpRange.L3Vni <= 16777215 but Got %d", *obj.obj.L3Vni)) + } + + } + + if obj.obj.Advanced != nil { + + obj.Advanced().validateObj(vObj, set_default) + } + + if len(obj.obj.Communities) != 0 { + + if set_default { + obj.Communities().clearHolderSlice() + for _, item := range obj.obj.Communities { + obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) + } + } + for _, item := range obj.Communities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.ExtCommunities) != 0 { + + if set_default { + obj.ExtCommunities().clearHolderSlice() + for _, item := range obj.obj.ExtCommunities { + obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) + } + } + for _, item := range obj.ExtCommunities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.AsPath != nil { + + obj.AsPath().validateObj(vObj, set_default) + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpCMacIpRange") + } +} + +func (obj *bgpCMacIpRange) setDefault() { + if obj.obj.L2Vni == nil { + obj.SetL2Vni(0) + } + if obj.obj.L3Vni == nil { + obj.SetL3Vni(0) + } + if obj.obj.IncludeDefaultGateway == nil { + obj.SetIncludeDefaultGateway(false) + } + +} diff --git a/gosnappi/bgp_capability.go b/gosnappi/bgp_capability.go new file mode 100644 index 00000000..f8b1e4dd --- /dev/null +++ b/gosnappi/bgp_capability.go @@ -0,0 +1,1065 @@ +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" +) + +// ***** BgpCapability ***** +type bgpCapability struct { + validation + obj *otg.BgpCapability + marshaller marshalBgpCapability + unMarshaller unMarshalBgpCapability +} + +func NewBgpCapability() BgpCapability { + obj := bgpCapability{obj: &otg.BgpCapability{}} + obj.setDefault() + return &obj +} + +func (obj *bgpCapability) msg() *otg.BgpCapability { + return obj.obj +} + +func (obj *bgpCapability) setMsg(msg *otg.BgpCapability) BgpCapability { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpCapability struct { + obj *bgpCapability +} + +type marshalBgpCapability interface { + // ToProto marshals BgpCapability to protobuf object *otg.BgpCapability + ToProto() (*otg.BgpCapability, error) + // ToPbText marshals BgpCapability to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpCapability to YAML text + ToYaml() (string, error) + // ToJson marshals BgpCapability to JSON text + ToJson() (string, error) +} + +type unMarshalbgpCapability struct { + obj *bgpCapability +} + +type unMarshalBgpCapability interface { + // FromProto unmarshals BgpCapability from protobuf object *otg.BgpCapability + FromProto(msg *otg.BgpCapability) (BgpCapability, error) + // FromPbText unmarshals BgpCapability from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpCapability from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpCapability from JSON text + FromJson(value string) error +} + +func (obj *bgpCapability) Marshal() marshalBgpCapability { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpCapability{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpCapability) Unmarshal() unMarshalBgpCapability { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpCapability{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpCapability) ToProto() (*otg.BgpCapability, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpCapability) FromProto(msg *otg.BgpCapability) (BgpCapability, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpCapability) 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 *unMarshalbgpCapability) 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 *marshalbgpCapability) 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 *unMarshalbgpCapability) 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 *marshalbgpCapability) 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 *unMarshalbgpCapability) 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 *bgpCapability) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpCapability) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpCapability) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpCapability) Clone() (BgpCapability, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpCapability() + 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 +} + +// BgpCapability is configuration for BGP capability settings. +type BgpCapability interface { + Validation + // msg marshals BgpCapability to protobuf object *otg.BgpCapability + // and doesn't set defaults + msg() *otg.BgpCapability + // setMsg unmarshals BgpCapability from protobuf object *otg.BgpCapability + // and doesn't set defaults + setMsg(*otg.BgpCapability) BgpCapability + // provides marshal interface + Marshal() marshalBgpCapability + // provides unmarshal interface + Unmarshal() unMarshalBgpCapability + // validate validates BgpCapability + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpCapability, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv4Unicast returns bool, set in BgpCapability. + Ipv4Unicast() bool + // SetIpv4Unicast assigns bool provided by user to BgpCapability + SetIpv4Unicast(value bool) BgpCapability + // HasIpv4Unicast checks if Ipv4Unicast has been set in BgpCapability + HasIpv4Unicast() bool + // Ipv4Multicast returns bool, set in BgpCapability. + Ipv4Multicast() bool + // SetIpv4Multicast assigns bool provided by user to BgpCapability + SetIpv4Multicast(value bool) BgpCapability + // HasIpv4Multicast checks if Ipv4Multicast has been set in BgpCapability + HasIpv4Multicast() bool + // Ipv6Unicast returns bool, set in BgpCapability. + Ipv6Unicast() bool + // SetIpv6Unicast assigns bool provided by user to BgpCapability + SetIpv6Unicast(value bool) BgpCapability + // HasIpv6Unicast checks if Ipv6Unicast has been set in BgpCapability + HasIpv6Unicast() bool + // Ipv6Multicast returns bool, set in BgpCapability. + Ipv6Multicast() bool + // SetIpv6Multicast assigns bool provided by user to BgpCapability + SetIpv6Multicast(value bool) BgpCapability + // HasIpv6Multicast checks if Ipv6Multicast has been set in BgpCapability + HasIpv6Multicast() bool + // Vpls returns bool, set in BgpCapability. + Vpls() bool + // SetVpls assigns bool provided by user to BgpCapability + SetVpls(value bool) BgpCapability + // HasVpls checks if Vpls has been set in BgpCapability + HasVpls() bool + // RouteRefresh returns bool, set in BgpCapability. + RouteRefresh() bool + // SetRouteRefresh assigns bool provided by user to BgpCapability + SetRouteRefresh(value bool) BgpCapability + // HasRouteRefresh checks if RouteRefresh has been set in BgpCapability + HasRouteRefresh() bool + // RouteConstraint returns bool, set in BgpCapability. + RouteConstraint() bool + // SetRouteConstraint assigns bool provided by user to BgpCapability + SetRouteConstraint(value bool) BgpCapability + // HasRouteConstraint checks if RouteConstraint has been set in BgpCapability + HasRouteConstraint() bool + // LinkStateNonVpn returns bool, set in BgpCapability. + LinkStateNonVpn() bool + // SetLinkStateNonVpn assigns bool provided by user to BgpCapability + SetLinkStateNonVpn(value bool) BgpCapability + // HasLinkStateNonVpn checks if LinkStateNonVpn has been set in BgpCapability + HasLinkStateNonVpn() bool + // LinkStateVpn returns bool, set in BgpCapability. + LinkStateVpn() bool + // SetLinkStateVpn assigns bool provided by user to BgpCapability + SetLinkStateVpn(value bool) BgpCapability + // HasLinkStateVpn checks if LinkStateVpn has been set in BgpCapability + HasLinkStateVpn() bool + // Evpn returns bool, set in BgpCapability. + Evpn() bool + // SetEvpn assigns bool provided by user to BgpCapability + SetEvpn(value bool) BgpCapability + // HasEvpn checks if Evpn has been set in BgpCapability + HasEvpn() bool + // ExtendedNextHopEncoding returns bool, set in BgpCapability. + ExtendedNextHopEncoding() bool + // SetExtendedNextHopEncoding assigns bool provided by user to BgpCapability + SetExtendedNextHopEncoding(value bool) BgpCapability + // HasExtendedNextHopEncoding checks if ExtendedNextHopEncoding has been set in BgpCapability + HasExtendedNextHopEncoding() bool + // Ipv4MulticastVpn returns bool, set in BgpCapability. + Ipv4MulticastVpn() bool + // SetIpv4MulticastVpn assigns bool provided by user to BgpCapability + SetIpv4MulticastVpn(value bool) BgpCapability + // HasIpv4MulticastVpn checks if Ipv4MulticastVpn has been set in BgpCapability + HasIpv4MulticastVpn() bool + // Ipv4MplsVpn returns bool, set in BgpCapability. + Ipv4MplsVpn() bool + // SetIpv4MplsVpn assigns bool provided by user to BgpCapability + SetIpv4MplsVpn(value bool) BgpCapability + // HasIpv4MplsVpn checks if Ipv4MplsVpn has been set in BgpCapability + HasIpv4MplsVpn() bool + // Ipv4Mdt returns bool, set in BgpCapability. + Ipv4Mdt() bool + // SetIpv4Mdt assigns bool provided by user to BgpCapability + SetIpv4Mdt(value bool) BgpCapability + // HasIpv4Mdt checks if Ipv4Mdt has been set in BgpCapability + HasIpv4Mdt() bool + // Ipv4MulticastMplsVpn returns bool, set in BgpCapability. + Ipv4MulticastMplsVpn() bool + // SetIpv4MulticastMplsVpn assigns bool provided by user to BgpCapability + SetIpv4MulticastMplsVpn(value bool) BgpCapability + // HasIpv4MulticastMplsVpn checks if Ipv4MulticastMplsVpn has been set in BgpCapability + HasIpv4MulticastMplsVpn() bool + // Ipv4UnicastFlowSpec returns bool, set in BgpCapability. + Ipv4UnicastFlowSpec() bool + // SetIpv4UnicastFlowSpec assigns bool provided by user to BgpCapability + SetIpv4UnicastFlowSpec(value bool) BgpCapability + // HasIpv4UnicastFlowSpec checks if Ipv4UnicastFlowSpec has been set in BgpCapability + HasIpv4UnicastFlowSpec() bool + // Ipv4SrTePolicy returns bool, set in BgpCapability. + Ipv4SrTePolicy() bool + // SetIpv4SrTePolicy assigns bool provided by user to BgpCapability + SetIpv4SrTePolicy(value bool) BgpCapability + // HasIpv4SrTePolicy checks if Ipv4SrTePolicy has been set in BgpCapability + HasIpv4SrTePolicy() bool + // Ipv4UnicastAddPath returns bool, set in BgpCapability. + Ipv4UnicastAddPath() bool + // SetIpv4UnicastAddPath assigns bool provided by user to BgpCapability + SetIpv4UnicastAddPath(value bool) BgpCapability + // HasIpv4UnicastAddPath checks if Ipv4UnicastAddPath has been set in BgpCapability + HasIpv4UnicastAddPath() bool + // Ipv6MulticastVpn returns bool, set in BgpCapability. + Ipv6MulticastVpn() bool + // SetIpv6MulticastVpn assigns bool provided by user to BgpCapability + SetIpv6MulticastVpn(value bool) BgpCapability + // HasIpv6MulticastVpn checks if Ipv6MulticastVpn has been set in BgpCapability + HasIpv6MulticastVpn() bool + // Ipv6MplsVpn returns bool, set in BgpCapability. + Ipv6MplsVpn() bool + // SetIpv6MplsVpn assigns bool provided by user to BgpCapability + SetIpv6MplsVpn(value bool) BgpCapability + // HasIpv6MplsVpn checks if Ipv6MplsVpn has been set in BgpCapability + HasIpv6MplsVpn() bool + // Ipv6Mdt returns bool, set in BgpCapability. + Ipv6Mdt() bool + // SetIpv6Mdt assigns bool provided by user to BgpCapability + SetIpv6Mdt(value bool) BgpCapability + // HasIpv6Mdt checks if Ipv6Mdt has been set in BgpCapability + HasIpv6Mdt() bool + // Ipv6MulticastMplsVpn returns bool, set in BgpCapability. + Ipv6MulticastMplsVpn() bool + // SetIpv6MulticastMplsVpn assigns bool provided by user to BgpCapability + SetIpv6MulticastMplsVpn(value bool) BgpCapability + // HasIpv6MulticastMplsVpn checks if Ipv6MulticastMplsVpn has been set in BgpCapability + HasIpv6MulticastMplsVpn() bool + // Ipv6UnicastFlowSpec returns bool, set in BgpCapability. + Ipv6UnicastFlowSpec() bool + // SetIpv6UnicastFlowSpec assigns bool provided by user to BgpCapability + SetIpv6UnicastFlowSpec(value bool) BgpCapability + // HasIpv6UnicastFlowSpec checks if Ipv6UnicastFlowSpec has been set in BgpCapability + HasIpv6UnicastFlowSpec() bool + // Ipv6SrTePolicy returns bool, set in BgpCapability. + Ipv6SrTePolicy() bool + // SetIpv6SrTePolicy assigns bool provided by user to BgpCapability + SetIpv6SrTePolicy(value bool) BgpCapability + // HasIpv6SrTePolicy checks if Ipv6SrTePolicy has been set in BgpCapability + HasIpv6SrTePolicy() bool + // Ipv6UnicastAddPath returns bool, set in BgpCapability. + Ipv6UnicastAddPath() bool + // SetIpv6UnicastAddPath assigns bool provided by user to BgpCapability + SetIpv6UnicastAddPath(value bool) BgpCapability + // HasIpv6UnicastAddPath checks if Ipv6UnicastAddPath has been set in BgpCapability + HasIpv6UnicastAddPath() bool +} + +// Support for the IPv4 Unicast address family. +// Ipv4Unicast returns a bool +func (obj *bgpCapability) Ipv4Unicast() bool { + + return *obj.obj.Ipv4Unicast + +} + +// Support for the IPv4 Unicast address family. +// Ipv4Unicast returns a bool +func (obj *bgpCapability) HasIpv4Unicast() bool { + return obj.obj.Ipv4Unicast != nil +} + +// Support for the IPv4 Unicast address family. +// SetIpv4Unicast sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv4Unicast(value bool) BgpCapability { + + obj.obj.Ipv4Unicast = &value + return obj +} + +// Support for the IPv4 Multicast address family. +// Ipv4Multicast returns a bool +func (obj *bgpCapability) Ipv4Multicast() bool { + + return *obj.obj.Ipv4Multicast + +} + +// Support for the IPv4 Multicast address family. +// Ipv4Multicast returns a bool +func (obj *bgpCapability) HasIpv4Multicast() bool { + return obj.obj.Ipv4Multicast != nil +} + +// Support for the IPv4 Multicast address family. +// SetIpv4Multicast sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv4Multicast(value bool) BgpCapability { + + obj.obj.Ipv4Multicast = &value + return obj +} + +// Support for the IPv4 Unicast address family. +// Ipv6Unicast returns a bool +func (obj *bgpCapability) Ipv6Unicast() bool { + + return *obj.obj.Ipv6Unicast + +} + +// Support for the IPv4 Unicast address family. +// Ipv6Unicast returns a bool +func (obj *bgpCapability) HasIpv6Unicast() bool { + return obj.obj.Ipv6Unicast != nil +} + +// Support for the IPv4 Unicast address family. +// SetIpv6Unicast sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv6Unicast(value bool) BgpCapability { + + obj.obj.Ipv6Unicast = &value + return obj +} + +// Support for the IPv6 Multicast address family. +// Ipv6Multicast returns a bool +func (obj *bgpCapability) Ipv6Multicast() bool { + + return *obj.obj.Ipv6Multicast + +} + +// Support for the IPv6 Multicast address family. +// Ipv6Multicast returns a bool +func (obj *bgpCapability) HasIpv6Multicast() bool { + return obj.obj.Ipv6Multicast != nil +} + +// Support for the IPv6 Multicast address family. +// SetIpv6Multicast sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv6Multicast(value bool) BgpCapability { + + obj.obj.Ipv6Multicast = &value + return obj +} + +// Support for VPLS as below. +// RFC4761 - Virtual Private LAN Service (VPLS) using BGP for Auto-Discovery +// and Signaling. +// RFC6624 - Layer 2 Virtual Private Networks using BGP for Auto-Discovery +// and Signaling. +// Vpls returns a bool +func (obj *bgpCapability) Vpls() bool { + + return *obj.obj.Vpls + +} + +// Support for VPLS as below. +// RFC4761 - Virtual Private LAN Service (VPLS) using BGP for Auto-Discovery +// and Signaling. +// RFC6624 - Layer 2 Virtual Private Networks using BGP for Auto-Discovery +// and Signaling. +// Vpls returns a bool +func (obj *bgpCapability) HasVpls() bool { + return obj.obj.Vpls != nil +} + +// Support for VPLS as below. +// RFC4761 - Virtual Private LAN Service (VPLS) using BGP for Auto-Discovery +// and Signaling. +// RFC6624 - Layer 2 Virtual Private Networks using BGP for Auto-Discovery +// and Signaling. +// SetVpls sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetVpls(value bool) BgpCapability { + + obj.obj.Vpls = &value + return obj +} + +// Support for the route refresh capabilities. Route Refresh allows the dynamic exchange of route refresh requests and routing information between BGP peers and the subsequent re-advertisement of the outbound or inbound routing table. +// RouteRefresh returns a bool +func (obj *bgpCapability) RouteRefresh() bool { + + return *obj.obj.RouteRefresh + +} + +// Support for the route refresh capabilities. Route Refresh allows the dynamic exchange of route refresh requests and routing information between BGP peers and the subsequent re-advertisement of the outbound or inbound routing table. +// RouteRefresh returns a bool +func (obj *bgpCapability) HasRouteRefresh() bool { + return obj.obj.RouteRefresh != nil +} + +// Support for the route refresh capabilities. Route Refresh allows the dynamic exchange of route refresh requests and routing information between BGP peers and the subsequent re-advertisement of the outbound or inbound routing table. +// SetRouteRefresh sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetRouteRefresh(value bool) BgpCapability { + + obj.obj.RouteRefresh = &value + return obj +} + +// Supports for the route constraint capabilities. Route Constraint allows the advertisement of Route Target Membership information. The BGP peers exchange Route Target Reachability Information, which is used to build a route distribution graph. This limits the propagation of VPN Network Layer Reachability Information (NLRI) between different autonomous systems or distinct clusters of the same autonomous system. This is supported for Layer 3 Virtual Private Network scenario. +// RouteConstraint returns a bool +func (obj *bgpCapability) RouteConstraint() bool { + + return *obj.obj.RouteConstraint + +} + +// Supports for the route constraint capabilities. Route Constraint allows the advertisement of Route Target Membership information. The BGP peers exchange Route Target Reachability Information, which is used to build a route distribution graph. This limits the propagation of VPN Network Layer Reachability Information (NLRI) between different autonomous systems or distinct clusters of the same autonomous system. This is supported for Layer 3 Virtual Private Network scenario. +// RouteConstraint returns a bool +func (obj *bgpCapability) HasRouteConstraint() bool { + return obj.obj.RouteConstraint != nil +} + +// Supports for the route constraint capabilities. Route Constraint allows the advertisement of Route Target Membership information. The BGP peers exchange Route Target Reachability Information, which is used to build a route distribution graph. This limits the propagation of VPN Network Layer Reachability Information (NLRI) between different autonomous systems or distinct clusters of the same autonomous system. This is supported for Layer 3 Virtual Private Network scenario. +// SetRouteConstraint sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetRouteConstraint(value bool) BgpCapability { + + obj.obj.RouteConstraint = &value + return obj +} + +// Support for BGP Link State for ISIS and OSPF. +// LinkStateNonVpn returns a bool +func (obj *bgpCapability) LinkStateNonVpn() bool { + + return *obj.obj.LinkStateNonVpn + +} + +// Support for BGP Link State for ISIS and OSPF. +// LinkStateNonVpn returns a bool +func (obj *bgpCapability) HasLinkStateNonVpn() bool { + return obj.obj.LinkStateNonVpn != nil +} + +// Support for BGP Link State for ISIS and OSPF. +// SetLinkStateNonVpn sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetLinkStateNonVpn(value bool) BgpCapability { + + obj.obj.LinkStateNonVpn = &value + return obj +} + +// Capability advertisement of BGP Link State for VPNs. +// LinkStateVpn returns a bool +func (obj *bgpCapability) LinkStateVpn() bool { + + return *obj.obj.LinkStateVpn + +} + +// Capability advertisement of BGP Link State for VPNs. +// LinkStateVpn returns a bool +func (obj *bgpCapability) HasLinkStateVpn() bool { + return obj.obj.LinkStateVpn != nil +} + +// Capability advertisement of BGP Link State for VPNs. +// SetLinkStateVpn sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetLinkStateVpn(value bool) BgpCapability { + + obj.obj.LinkStateVpn = &value + return obj +} + +// Support for the EVPN address family. +// Evpn returns a bool +func (obj *bgpCapability) Evpn() bool { + + return *obj.obj.Evpn + +} + +// Support for the EVPN address family. +// Evpn returns a bool +func (obj *bgpCapability) HasEvpn() bool { + return obj.obj.Evpn != nil +} + +// Support for the EVPN address family. +// SetEvpn sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetEvpn(value bool) BgpCapability { + + obj.obj.Evpn = &value + return obj +} + +// Support for extended Next Hop Encoding for Nexthop field in IPv4 routes advertisement. This allows IPv4 routes being advertised by IPv6 peers to include an IPv6 Nexthop. +// ExtendedNextHopEncoding returns a bool +func (obj *bgpCapability) ExtendedNextHopEncoding() bool { + + return *obj.obj.ExtendedNextHopEncoding + +} + +// Support for extended Next Hop Encoding for Nexthop field in IPv4 routes advertisement. This allows IPv4 routes being advertised by IPv6 peers to include an IPv6 Nexthop. +// ExtendedNextHopEncoding returns a bool +func (obj *bgpCapability) HasExtendedNextHopEncoding() bool { + return obj.obj.ExtendedNextHopEncoding != nil +} + +// Support for extended Next Hop Encoding for Nexthop field in IPv4 routes advertisement. This allows IPv4 routes being advertised by IPv6 peers to include an IPv6 Nexthop. +// SetExtendedNextHopEncoding sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetExtendedNextHopEncoding(value bool) BgpCapability { + + obj.obj.ExtendedNextHopEncoding = &value + return obj +} + +// Support for the IPv4 Multicast VPN address family. +// Ipv4MulticastVpn returns a bool +func (obj *bgpCapability) Ipv4MulticastVpn() bool { + + return *obj.obj.Ipv4MulticastVpn + +} + +// Support for the IPv4 Multicast VPN address family. +// Ipv4MulticastVpn returns a bool +func (obj *bgpCapability) HasIpv4MulticastVpn() bool { + return obj.obj.Ipv4MulticastVpn != nil +} + +// Support for the IPv4 Multicast VPN address family. +// SetIpv4MulticastVpn sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv4MulticastVpn(value bool) BgpCapability { + + obj.obj.Ipv4MulticastVpn = &value + return obj +} + +// Support for the IPv4 MPLS L3VPN address family. +// Ipv4MplsVpn returns a bool +func (obj *bgpCapability) Ipv4MplsVpn() bool { + + return *obj.obj.Ipv4MplsVpn + +} + +// Support for the IPv4 MPLS L3VPN address family. +// Ipv4MplsVpn returns a bool +func (obj *bgpCapability) HasIpv4MplsVpn() bool { + return obj.obj.Ipv4MplsVpn != nil +} + +// Support for the IPv4 MPLS L3VPN address family. +// SetIpv4MplsVpn sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv4MplsVpn(value bool) BgpCapability { + + obj.obj.Ipv4MplsVpn = &value + return obj +} + +// Supports for IPv4 MDT address family messages. +// Ipv4Mdt returns a bool +func (obj *bgpCapability) Ipv4Mdt() bool { + + return *obj.obj.Ipv4Mdt + +} + +// Supports for IPv4 MDT address family messages. +// Ipv4Mdt returns a bool +func (obj *bgpCapability) HasIpv4Mdt() bool { + return obj.obj.Ipv4Mdt != nil +} + +// Supports for IPv4 MDT address family messages. +// SetIpv4Mdt sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv4Mdt(value bool) BgpCapability { + + obj.obj.Ipv4Mdt = &value + return obj +} + +// Support for the IPv4 Multicast VPN address family. +// Ipv4MulticastMplsVpn returns a bool +func (obj *bgpCapability) Ipv4MulticastMplsVpn() bool { + + return *obj.obj.Ipv4MulticastMplsVpn + +} + +// Support for the IPv4 Multicast VPN address family. +// Ipv4MulticastMplsVpn returns a bool +func (obj *bgpCapability) HasIpv4MulticastMplsVpn() bool { + return obj.obj.Ipv4MulticastMplsVpn != nil +} + +// Support for the IPv4 Multicast VPN address family. +// SetIpv4MulticastMplsVpn sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv4MulticastMplsVpn(value bool) BgpCapability { + + obj.obj.Ipv4MulticastMplsVpn = &value + return obj +} + +// Support for propagation of IPv4 unicast flow specification rules. +// Ipv4UnicastFlowSpec returns a bool +func (obj *bgpCapability) Ipv4UnicastFlowSpec() bool { + + return *obj.obj.Ipv4UnicastFlowSpec + +} + +// Support for propagation of IPv4 unicast flow specification rules. +// Ipv4UnicastFlowSpec returns a bool +func (obj *bgpCapability) HasIpv4UnicastFlowSpec() bool { + return obj.obj.Ipv4UnicastFlowSpec != nil +} + +// Support for propagation of IPv4 unicast flow specification rules. +// SetIpv4UnicastFlowSpec sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv4UnicastFlowSpec(value bool) BgpCapability { + + obj.obj.Ipv4UnicastFlowSpec = &value + return obj +} + +// Support for IPv4 SRTE policy. +// Ipv4SrTePolicy returns a bool +func (obj *bgpCapability) Ipv4SrTePolicy() bool { + + return *obj.obj.Ipv4SrTePolicy + +} + +// Support for IPv4 SRTE policy. +// Ipv4SrTePolicy returns a bool +func (obj *bgpCapability) HasIpv4SrTePolicy() bool { + return obj.obj.Ipv4SrTePolicy != nil +} + +// Support for IPv4 SRTE policy. +// SetIpv4SrTePolicy sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv4SrTePolicy(value bool) BgpCapability { + + obj.obj.Ipv4SrTePolicy = &value + return obj +} + +// Support for IPv4 Unicast Add Path Capability. +// Ipv4UnicastAddPath returns a bool +func (obj *bgpCapability) Ipv4UnicastAddPath() bool { + + return *obj.obj.Ipv4UnicastAddPath + +} + +// Support for IPv4 Unicast Add Path Capability. +// Ipv4UnicastAddPath returns a bool +func (obj *bgpCapability) HasIpv4UnicastAddPath() bool { + return obj.obj.Ipv4UnicastAddPath != nil +} + +// Support for IPv4 Unicast Add Path Capability. +// SetIpv4UnicastAddPath sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv4UnicastAddPath(value bool) BgpCapability { + + obj.obj.Ipv4UnicastAddPath = &value + return obj +} + +// Support for the IPv6 Multicast VPN address family. +// Ipv6MulticastVpn returns a bool +func (obj *bgpCapability) Ipv6MulticastVpn() bool { + + return *obj.obj.Ipv6MulticastVpn + +} + +// Support for the IPv6 Multicast VPN address family. +// Ipv6MulticastVpn returns a bool +func (obj *bgpCapability) HasIpv6MulticastVpn() bool { + return obj.obj.Ipv6MulticastVpn != nil +} + +// Support for the IPv6 Multicast VPN address family. +// SetIpv6MulticastVpn sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv6MulticastVpn(value bool) BgpCapability { + + obj.obj.Ipv6MulticastVpn = &value + return obj +} + +// Support for the IPv6 MPLS L3VPN address family. +// Ipv6MplsVpn returns a bool +func (obj *bgpCapability) Ipv6MplsVpn() bool { + + return *obj.obj.Ipv6MplsVpn + +} + +// Support for the IPv6 MPLS L3VPN address family. +// Ipv6MplsVpn returns a bool +func (obj *bgpCapability) HasIpv6MplsVpn() bool { + return obj.obj.Ipv6MplsVpn != nil +} + +// Support for the IPv6 MPLS L3VPN address family. +// SetIpv6MplsVpn sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv6MplsVpn(value bool) BgpCapability { + + obj.obj.Ipv6MplsVpn = &value + return obj +} + +// Support for IPv6 MDT address family messages. +// Ipv6Mdt returns a bool +func (obj *bgpCapability) Ipv6Mdt() bool { + + return *obj.obj.Ipv6Mdt + +} + +// Support for IPv6 MDT address family messages. +// Ipv6Mdt returns a bool +func (obj *bgpCapability) HasIpv6Mdt() bool { + return obj.obj.Ipv6Mdt != nil +} + +// Support for IPv6 MDT address family messages. +// SetIpv6Mdt sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv6Mdt(value bool) BgpCapability { + + obj.obj.Ipv6Mdt = &value + return obj +} + +// Support for the IPv6 Multicast VPN address family. +// Ipv6MulticastMplsVpn returns a bool +func (obj *bgpCapability) Ipv6MulticastMplsVpn() bool { + + return *obj.obj.Ipv6MulticastMplsVpn + +} + +// Support for the IPv6 Multicast VPN address family. +// Ipv6MulticastMplsVpn returns a bool +func (obj *bgpCapability) HasIpv6MulticastMplsVpn() bool { + return obj.obj.Ipv6MulticastMplsVpn != nil +} + +// Support for the IPv6 Multicast VPN address family. +// SetIpv6MulticastMplsVpn sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv6MulticastMplsVpn(value bool) BgpCapability { + + obj.obj.Ipv6MulticastMplsVpn = &value + return obj +} + +// Support for propagation of IPv6 unicast flow specification rules. +// Ipv6UnicastFlowSpec returns a bool +func (obj *bgpCapability) Ipv6UnicastFlowSpec() bool { + + return *obj.obj.Ipv6UnicastFlowSpec + +} + +// Support for propagation of IPv6 unicast flow specification rules. +// Ipv6UnicastFlowSpec returns a bool +func (obj *bgpCapability) HasIpv6UnicastFlowSpec() bool { + return obj.obj.Ipv6UnicastFlowSpec != nil +} + +// Support for propagation of IPv6 unicast flow specification rules. +// SetIpv6UnicastFlowSpec sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv6UnicastFlowSpec(value bool) BgpCapability { + + obj.obj.Ipv6UnicastFlowSpec = &value + return obj +} + +// Support for IPv6 SRTE policy. +// Ipv6SrTePolicy returns a bool +func (obj *bgpCapability) Ipv6SrTePolicy() bool { + + return *obj.obj.Ipv6SrTePolicy + +} + +// Support for IPv6 SRTE policy. +// Ipv6SrTePolicy returns a bool +func (obj *bgpCapability) HasIpv6SrTePolicy() bool { + return obj.obj.Ipv6SrTePolicy != nil +} + +// Support for IPv6 SRTE policy. +// SetIpv6SrTePolicy sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv6SrTePolicy(value bool) BgpCapability { + + obj.obj.Ipv6SrTePolicy = &value + return obj +} + +// Support for IPv6 Unicast Add Path Capability. +// Ipv6UnicastAddPath returns a bool +func (obj *bgpCapability) Ipv6UnicastAddPath() bool { + + return *obj.obj.Ipv6UnicastAddPath + +} + +// Support for IPv6 Unicast Add Path Capability. +// Ipv6UnicastAddPath returns a bool +func (obj *bgpCapability) HasIpv6UnicastAddPath() bool { + return obj.obj.Ipv6UnicastAddPath != nil +} + +// Support for IPv6 Unicast Add Path Capability. +// SetIpv6UnicastAddPath sets the bool value in the BgpCapability object +func (obj *bgpCapability) SetIpv6UnicastAddPath(value bool) BgpCapability { + + obj.obj.Ipv6UnicastAddPath = &value + return obj +} + +func (obj *bgpCapability) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpCapability) setDefault() { + if obj.obj.Ipv4Unicast == nil { + obj.SetIpv4Unicast(true) + } + if obj.obj.Ipv4Multicast == nil { + obj.SetIpv4Multicast(false) + } + if obj.obj.Ipv6Unicast == nil { + obj.SetIpv6Unicast(true) + } + if obj.obj.Ipv6Multicast == nil { + obj.SetIpv6Multicast(false) + } + if obj.obj.Vpls == nil { + obj.SetVpls(false) + } + if obj.obj.RouteRefresh == nil { + obj.SetRouteRefresh(true) + } + if obj.obj.RouteConstraint == nil { + obj.SetRouteConstraint(false) + } + if obj.obj.LinkStateNonVpn == nil { + obj.SetLinkStateNonVpn(false) + } + if obj.obj.LinkStateVpn == nil { + obj.SetLinkStateVpn(false) + } + if obj.obj.Evpn == nil { + obj.SetEvpn(false) + } + if obj.obj.ExtendedNextHopEncoding == nil { + obj.SetExtendedNextHopEncoding(false) + } + if obj.obj.Ipv4MulticastVpn == nil { + obj.SetIpv4MulticastVpn(false) + } + if obj.obj.Ipv4MplsVpn == nil { + obj.SetIpv4MplsVpn(false) + } + if obj.obj.Ipv4Mdt == nil { + obj.SetIpv4Mdt(false) + } + if obj.obj.Ipv4MulticastMplsVpn == nil { + obj.SetIpv4MulticastMplsVpn(false) + } + if obj.obj.Ipv4UnicastFlowSpec == nil { + obj.SetIpv4UnicastFlowSpec(false) + } + if obj.obj.Ipv4SrTePolicy == nil { + obj.SetIpv4SrTePolicy(false) + } + if obj.obj.Ipv4UnicastAddPath == nil { + obj.SetIpv4UnicastAddPath(false) + } + if obj.obj.Ipv6MulticastVpn == nil { + obj.SetIpv6MulticastVpn(false) + } + if obj.obj.Ipv6MplsVpn == nil { + obj.SetIpv6MplsVpn(false) + } + if obj.obj.Ipv6Mdt == nil { + obj.SetIpv6Mdt(false) + } + if obj.obj.Ipv6MulticastMplsVpn == nil { + obj.SetIpv6MulticastMplsVpn(false) + } + if obj.obj.Ipv6UnicastFlowSpec == nil { + obj.SetIpv6UnicastFlowSpec(false) + } + if obj.obj.Ipv6SrTePolicy == nil { + obj.SetIpv6SrTePolicy(false) + } + if obj.obj.Ipv6UnicastAddPath == nil { + obj.SetIpv6UnicastAddPath(false) + } + +} diff --git a/gosnappi/bgp_community.go b/gosnappi/bgp_community.go new file mode 100644 index 00000000..b85c0a6f --- /dev/null +++ b/gosnappi/bgp_community.go @@ -0,0 +1,408 @@ +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" +) + +// ***** BgpCommunity ***** +type bgpCommunity struct { + validation + obj *otg.BgpCommunity + marshaller marshalBgpCommunity + unMarshaller unMarshalBgpCommunity +} + +func NewBgpCommunity() BgpCommunity { + obj := bgpCommunity{obj: &otg.BgpCommunity{}} + obj.setDefault() + return &obj +} + +func (obj *bgpCommunity) msg() *otg.BgpCommunity { + return obj.obj +} + +func (obj *bgpCommunity) setMsg(msg *otg.BgpCommunity) BgpCommunity { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpCommunity struct { + obj *bgpCommunity +} + +type marshalBgpCommunity interface { + // ToProto marshals BgpCommunity to protobuf object *otg.BgpCommunity + ToProto() (*otg.BgpCommunity, error) + // ToPbText marshals BgpCommunity to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpCommunity to YAML text + ToYaml() (string, error) + // ToJson marshals BgpCommunity to JSON text + ToJson() (string, error) +} + +type unMarshalbgpCommunity struct { + obj *bgpCommunity +} + +type unMarshalBgpCommunity interface { + // FromProto unmarshals BgpCommunity from protobuf object *otg.BgpCommunity + FromProto(msg *otg.BgpCommunity) (BgpCommunity, error) + // FromPbText unmarshals BgpCommunity from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpCommunity from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpCommunity from JSON text + FromJson(value string) error +} + +func (obj *bgpCommunity) Marshal() marshalBgpCommunity { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpCommunity{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpCommunity) Unmarshal() unMarshalBgpCommunity { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpCommunity{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpCommunity) ToProto() (*otg.BgpCommunity, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpCommunity) FromProto(msg *otg.BgpCommunity) (BgpCommunity, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpCommunity) 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 *unMarshalbgpCommunity) 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 *marshalbgpCommunity) 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 *unMarshalbgpCommunity) 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 *marshalbgpCommunity) 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 *unMarshalbgpCommunity) 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 *bgpCommunity) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpCommunity) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpCommunity) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpCommunity) Clone() (BgpCommunity, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpCommunity() + 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 +} + +// BgpCommunity is bGP communities provide additional capability for tagging routes and for modifying BGP routing policy on upstream and downstream routers. BGP community is a 32-bit number which is broken into 16-bit AS number and a 16-bit custom value. +type BgpCommunity interface { + Validation + // msg marshals BgpCommunity to protobuf object *otg.BgpCommunity + // and doesn't set defaults + msg() *otg.BgpCommunity + // setMsg unmarshals BgpCommunity from protobuf object *otg.BgpCommunity + // and doesn't set defaults + setMsg(*otg.BgpCommunity) BgpCommunity + // provides marshal interface + Marshal() marshalBgpCommunity + // provides unmarshal interface + Unmarshal() unMarshalBgpCommunity + // validate validates BgpCommunity + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpCommunity, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Type returns BgpCommunityTypeEnum, set in BgpCommunity + Type() BgpCommunityTypeEnum + // SetType assigns BgpCommunityTypeEnum provided by user to BgpCommunity + SetType(value BgpCommunityTypeEnum) BgpCommunity + // HasType checks if Type has been set in BgpCommunity + HasType() bool + // AsNumber returns uint32, set in BgpCommunity. + AsNumber() uint32 + // SetAsNumber assigns uint32 provided by user to BgpCommunity + SetAsNumber(value uint32) BgpCommunity + // HasAsNumber checks if AsNumber has been set in BgpCommunity + HasAsNumber() bool + // AsCustom returns uint32, set in BgpCommunity. + AsCustom() uint32 + // SetAsCustom assigns uint32 provided by user to BgpCommunity + SetAsCustom(value uint32) BgpCommunity + // HasAsCustom checks if AsCustom has been set in BgpCommunity + HasAsCustom() bool +} + +type BgpCommunityTypeEnum string + +// Enum of Type on BgpCommunity +var BgpCommunityType = struct { + MANUAL_AS_NUMBER BgpCommunityTypeEnum + NO_EXPORT BgpCommunityTypeEnum + NO_ADVERTISED BgpCommunityTypeEnum + NO_EXPORT_SUBCONFED BgpCommunityTypeEnum + LLGR_STALE BgpCommunityTypeEnum + NO_LLGR BgpCommunityTypeEnum +}{ + MANUAL_AS_NUMBER: BgpCommunityTypeEnum("manual_as_number"), + NO_EXPORT: BgpCommunityTypeEnum("no_export"), + NO_ADVERTISED: BgpCommunityTypeEnum("no_advertised"), + NO_EXPORT_SUBCONFED: BgpCommunityTypeEnum("no_export_subconfed"), + LLGR_STALE: BgpCommunityTypeEnum("llgr_stale"), + NO_LLGR: BgpCommunityTypeEnum("no_llgr"), +} + +func (obj *bgpCommunity) Type() BgpCommunityTypeEnum { + return BgpCommunityTypeEnum(obj.obj.Type.Enum().String()) +} + +// The type of community AS number. +// Type returns a string +func (obj *bgpCommunity) HasType() bool { + return obj.obj.Type != nil +} + +func (obj *bgpCommunity) SetType(value BgpCommunityTypeEnum) BgpCommunity { + intValue, ok := otg.BgpCommunity_Type_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpCommunityTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpCommunity_Type_Enum(intValue) + obj.obj.Type = &enumValue + + return obj +} + +// First two octets of 32 bit community AS number. +// AsNumber returns a uint32 +func (obj *bgpCommunity) AsNumber() uint32 { + + return *obj.obj.AsNumber + +} + +// First two octets of 32 bit community AS number. +// AsNumber returns a uint32 +func (obj *bgpCommunity) HasAsNumber() bool { + return obj.obj.AsNumber != nil +} + +// First two octets of 32 bit community AS number. +// SetAsNumber sets the uint32 value in the BgpCommunity object +func (obj *bgpCommunity) SetAsNumber(value uint32) BgpCommunity { + + obj.obj.AsNumber = &value + return obj +} + +// Last two octets of the community value. +// AsCustom returns a uint32 +func (obj *bgpCommunity) AsCustom() uint32 { + + return *obj.obj.AsCustom + +} + +// Last two octets of the community value. +// AsCustom returns a uint32 +func (obj *bgpCommunity) HasAsCustom() bool { + return obj.obj.AsCustom != nil +} + +// Last two octets of the community value. +// SetAsCustom sets the uint32 value in the BgpCommunity object +func (obj *bgpCommunity) SetAsCustom(value uint32) BgpCommunity { + + obj.obj.AsCustom = &value + return obj +} + +func (obj *bgpCommunity) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.AsNumber != nil { + + if *obj.obj.AsNumber > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpCommunity.AsNumber <= 65535 but Got %d", *obj.obj.AsNumber)) + } + + } + + if obj.obj.AsCustom != nil { + + if *obj.obj.AsCustom > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpCommunity.AsCustom <= 65535 but Got %d", *obj.obj.AsCustom)) + } + + } + +} + +func (obj *bgpCommunity) setDefault() { + if obj.obj.AsNumber == nil { + obj.SetAsNumber(0) + } + if obj.obj.AsCustom == nil { + obj.SetAsCustom(0) + } + +} diff --git a/gosnappi/bgp_ethernet_segment_df_election.go b/gosnappi/bgp_ethernet_segment_df_election.go new file mode 100644 index 00000000..1cc1541f --- /dev/null +++ b/gosnappi/bgp_ethernet_segment_df_election.go @@ -0,0 +1,319 @@ +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" +) + +// ***** BgpEthernetSegmentDfElection ***** +type bgpEthernetSegmentDfElection struct { + validation + obj *otg.BgpEthernetSegmentDfElection + marshaller marshalBgpEthernetSegmentDfElection + unMarshaller unMarshalBgpEthernetSegmentDfElection +} + +func NewBgpEthernetSegmentDfElection() BgpEthernetSegmentDfElection { + obj := bgpEthernetSegmentDfElection{obj: &otg.BgpEthernetSegmentDfElection{}} + obj.setDefault() + return &obj +} + +func (obj *bgpEthernetSegmentDfElection) msg() *otg.BgpEthernetSegmentDfElection { + return obj.obj +} + +func (obj *bgpEthernetSegmentDfElection) setMsg(msg *otg.BgpEthernetSegmentDfElection) BgpEthernetSegmentDfElection { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpEthernetSegmentDfElection struct { + obj *bgpEthernetSegmentDfElection +} + +type marshalBgpEthernetSegmentDfElection interface { + // ToProto marshals BgpEthernetSegmentDfElection to protobuf object *otg.BgpEthernetSegmentDfElection + ToProto() (*otg.BgpEthernetSegmentDfElection, error) + // ToPbText marshals BgpEthernetSegmentDfElection to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpEthernetSegmentDfElection to YAML text + ToYaml() (string, error) + // ToJson marshals BgpEthernetSegmentDfElection to JSON text + ToJson() (string, error) +} + +type unMarshalbgpEthernetSegmentDfElection struct { + obj *bgpEthernetSegmentDfElection +} + +type unMarshalBgpEthernetSegmentDfElection interface { + // FromProto unmarshals BgpEthernetSegmentDfElection from protobuf object *otg.BgpEthernetSegmentDfElection + FromProto(msg *otg.BgpEthernetSegmentDfElection) (BgpEthernetSegmentDfElection, error) + // FromPbText unmarshals BgpEthernetSegmentDfElection from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpEthernetSegmentDfElection from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpEthernetSegmentDfElection from JSON text + FromJson(value string) error +} + +func (obj *bgpEthernetSegmentDfElection) Marshal() marshalBgpEthernetSegmentDfElection { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpEthernetSegmentDfElection{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpEthernetSegmentDfElection) Unmarshal() unMarshalBgpEthernetSegmentDfElection { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpEthernetSegmentDfElection{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpEthernetSegmentDfElection) ToProto() (*otg.BgpEthernetSegmentDfElection, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpEthernetSegmentDfElection) FromProto(msg *otg.BgpEthernetSegmentDfElection) (BgpEthernetSegmentDfElection, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpEthernetSegmentDfElection) 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 *unMarshalbgpEthernetSegmentDfElection) 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 *marshalbgpEthernetSegmentDfElection) 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 *unMarshalbgpEthernetSegmentDfElection) 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 *marshalbgpEthernetSegmentDfElection) 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 *unMarshalbgpEthernetSegmentDfElection) 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 *bgpEthernetSegmentDfElection) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpEthernetSegmentDfElection) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpEthernetSegmentDfElection) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpEthernetSegmentDfElection) Clone() (BgpEthernetSegmentDfElection, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpEthernetSegmentDfElection() + 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 +} + +// BgpEthernetSegmentDfElection is configuration for Designated Forwarder (DF) election among the Provider Edge (PE) routers on the same Ethernet Segment. +type BgpEthernetSegmentDfElection interface { + Validation + // msg marshals BgpEthernetSegmentDfElection to protobuf object *otg.BgpEthernetSegmentDfElection + // and doesn't set defaults + msg() *otg.BgpEthernetSegmentDfElection + // setMsg unmarshals BgpEthernetSegmentDfElection from protobuf object *otg.BgpEthernetSegmentDfElection + // and doesn't set defaults + setMsg(*otg.BgpEthernetSegmentDfElection) BgpEthernetSegmentDfElection + // provides marshal interface + Marshal() marshalBgpEthernetSegmentDfElection + // provides unmarshal interface + Unmarshal() unMarshalBgpEthernetSegmentDfElection + // validate validates BgpEthernetSegmentDfElection + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpEthernetSegmentDfElection, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ElectionTimer returns uint32, set in BgpEthernetSegmentDfElection. + ElectionTimer() uint32 + // SetElectionTimer assigns uint32 provided by user to BgpEthernetSegmentDfElection + SetElectionTimer(value uint32) BgpEthernetSegmentDfElection + // HasElectionTimer checks if ElectionTimer has been set in BgpEthernetSegmentDfElection + HasElectionTimer() bool +} + +// The DF election timer in seconds. +// ElectionTimer returns a uint32 +func (obj *bgpEthernetSegmentDfElection) ElectionTimer() uint32 { + + return *obj.obj.ElectionTimer + +} + +// The DF election timer in seconds. +// ElectionTimer returns a uint32 +func (obj *bgpEthernetSegmentDfElection) HasElectionTimer() bool { + return obj.obj.ElectionTimer != nil +} + +// The DF election timer in seconds. +// SetElectionTimer sets the uint32 value in the BgpEthernetSegmentDfElection object +func (obj *bgpEthernetSegmentDfElection) SetElectionTimer(value uint32) BgpEthernetSegmentDfElection { + + obj.obj.ElectionTimer = &value + return obj +} + +func (obj *bgpEthernetSegmentDfElection) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.ElectionTimer != nil { + + if *obj.obj.ElectionTimer > 300 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpEthernetSegmentDfElection.ElectionTimer <= 300 but Got %d", *obj.obj.ElectionTimer)) + } + + } + +} + +func (obj *bgpEthernetSegmentDfElection) setDefault() { + if obj.obj.ElectionTimer == nil { + obj.SetElectionTimer(3) + } + +} diff --git a/gosnappi/bgp_ext_community.go b/gosnappi/bgp_ext_community.go new file mode 100644 index 00000000..c0d29c6a --- /dev/null +++ b/gosnappi/bgp_ext_community.go @@ -0,0 +1,423 @@ +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" +) + +// ***** BgpExtCommunity ***** +type bgpExtCommunity struct { + validation + obj *otg.BgpExtCommunity + marshaller marshalBgpExtCommunity + unMarshaller unMarshalBgpExtCommunity +} + +func NewBgpExtCommunity() BgpExtCommunity { + obj := bgpExtCommunity{obj: &otg.BgpExtCommunity{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtCommunity) msg() *otg.BgpExtCommunity { + return obj.obj +} + +func (obj *bgpExtCommunity) setMsg(msg *otg.BgpExtCommunity) BgpExtCommunity { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtCommunity struct { + obj *bgpExtCommunity +} + +type marshalBgpExtCommunity interface { + // ToProto marshals BgpExtCommunity to protobuf object *otg.BgpExtCommunity + ToProto() (*otg.BgpExtCommunity, error) + // ToPbText marshals BgpExtCommunity to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtCommunity to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtCommunity to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtCommunity struct { + obj *bgpExtCommunity +} + +type unMarshalBgpExtCommunity interface { + // FromProto unmarshals BgpExtCommunity from protobuf object *otg.BgpExtCommunity + FromProto(msg *otg.BgpExtCommunity) (BgpExtCommunity, error) + // FromPbText unmarshals BgpExtCommunity from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtCommunity from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtCommunity from JSON text + FromJson(value string) error +} + +func (obj *bgpExtCommunity) Marshal() marshalBgpExtCommunity { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtCommunity{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtCommunity) Unmarshal() unMarshalBgpExtCommunity { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtCommunity{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtCommunity) ToProto() (*otg.BgpExtCommunity, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtCommunity) FromProto(msg *otg.BgpExtCommunity) (BgpExtCommunity, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtCommunity) 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 *unMarshalbgpExtCommunity) 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 *marshalbgpExtCommunity) 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 *unMarshalbgpExtCommunity) 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 *marshalbgpExtCommunity) 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 *unMarshalbgpExtCommunity) 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 *bgpExtCommunity) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtCommunity) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtCommunity) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtCommunity) Clone() (BgpExtCommunity, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtCommunity() + 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 +} + +// BgpExtCommunity is the Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. +type BgpExtCommunity interface { + Validation + // msg marshals BgpExtCommunity to protobuf object *otg.BgpExtCommunity + // and doesn't set defaults + msg() *otg.BgpExtCommunity + // setMsg unmarshals BgpExtCommunity from protobuf object *otg.BgpExtCommunity + // and doesn't set defaults + setMsg(*otg.BgpExtCommunity) BgpExtCommunity + // provides marshal interface + Marshal() marshalBgpExtCommunity + // provides unmarshal interface + Unmarshal() unMarshalBgpExtCommunity + // validate validates BgpExtCommunity + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtCommunity, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Type returns BgpExtCommunityTypeEnum, set in BgpExtCommunity + Type() BgpExtCommunityTypeEnum + // SetType assigns BgpExtCommunityTypeEnum provided by user to BgpExtCommunity + SetType(value BgpExtCommunityTypeEnum) BgpExtCommunity + // HasType checks if Type has been set in BgpExtCommunity + HasType() bool + // Subtype returns BgpExtCommunitySubtypeEnum, set in BgpExtCommunity + Subtype() BgpExtCommunitySubtypeEnum + // SetSubtype assigns BgpExtCommunitySubtypeEnum provided by user to BgpExtCommunity + SetSubtype(value BgpExtCommunitySubtypeEnum) BgpExtCommunity + // HasSubtype checks if Subtype has been set in BgpExtCommunity + HasSubtype() bool + // Value returns string, set in BgpExtCommunity. + Value() string + // SetValue assigns string provided by user to BgpExtCommunity + SetValue(value string) BgpExtCommunity + // HasValue checks if Value has been set in BgpExtCommunity + HasValue() bool +} + +type BgpExtCommunityTypeEnum string + +// Enum of Type on BgpExtCommunity +var BgpExtCommunityType = struct { + ADMINISTRATOR_AS_2OCTET BgpExtCommunityTypeEnum + ADMINISTRATOR_IPV4_ADDRESS BgpExtCommunityTypeEnum + ADMINISTRATOR_AS_4OCTET BgpExtCommunityTypeEnum + OPAQUE BgpExtCommunityTypeEnum + EVPN BgpExtCommunityTypeEnum + ADMINISTRATOR_AS_2OCTET_LINK_BANDWIDTH BgpExtCommunityTypeEnum +}{ + ADMINISTRATOR_AS_2OCTET: BgpExtCommunityTypeEnum("administrator_as_2octet"), + ADMINISTRATOR_IPV4_ADDRESS: BgpExtCommunityTypeEnum("administrator_ipv4_address"), + ADMINISTRATOR_AS_4OCTET: BgpExtCommunityTypeEnum("administrator_as_4octet"), + OPAQUE: BgpExtCommunityTypeEnum("opaque"), + EVPN: BgpExtCommunityTypeEnum("evpn"), + ADMINISTRATOR_AS_2OCTET_LINK_BANDWIDTH: BgpExtCommunityTypeEnum("administrator_as_2octet_link_bandwidth"), +} + +func (obj *bgpExtCommunity) Type() BgpExtCommunityTypeEnum { + return BgpExtCommunityTypeEnum(obj.obj.Type.Enum().String()) +} + +// Extended Community Type field of 1 Byte. +// - administrator_as_2octet: Two-Octet AS Specific Extended Community (RFC 4360). +// - administrator_ipv4_address: IPv4 Address Specific Extended Community (RFC 4360). +// - administrator_as_4octet: 4-Octet AS Specific Extended Community (RFC 5668). +// - opaque: Opaque Extended Community (RFC 7432). +// - evpn: EVPN Extended Community (RFC 7153). +// - administrator_as_2octet_link_bandwidth : Link Bandwidth Extended Community (RFC 7153). +// Type returns a string +func (obj *bgpExtCommunity) HasType() bool { + return obj.obj.Type != nil +} + +func (obj *bgpExtCommunity) SetType(value BgpExtCommunityTypeEnum) BgpExtCommunity { + intValue, ok := otg.BgpExtCommunity_Type_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpExtCommunityTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpExtCommunity_Type_Enum(intValue) + obj.obj.Type = &enumValue + + return obj +} + +type BgpExtCommunitySubtypeEnum string + +// Enum of Subtype on BgpExtCommunity +var BgpExtCommunitySubtype = struct { + ROUTE_TARGET BgpExtCommunitySubtypeEnum + ORIGIN BgpExtCommunitySubtypeEnum + EXTENDED_BANDWIDTH BgpExtCommunitySubtypeEnum + COLOR BgpExtCommunitySubtypeEnum + ENCAPSULATION BgpExtCommunitySubtypeEnum + MAC_ADDRESS BgpExtCommunitySubtypeEnum +}{ + ROUTE_TARGET: BgpExtCommunitySubtypeEnum("route_target"), + ORIGIN: BgpExtCommunitySubtypeEnum("origin"), + EXTENDED_BANDWIDTH: BgpExtCommunitySubtypeEnum("extended_bandwidth"), + COLOR: BgpExtCommunitySubtypeEnum("color"), + ENCAPSULATION: BgpExtCommunitySubtypeEnum("encapsulation"), + MAC_ADDRESS: BgpExtCommunitySubtypeEnum("mac_address"), +} + +func (obj *bgpExtCommunity) Subtype() BgpExtCommunitySubtypeEnum { + return BgpExtCommunitySubtypeEnum(obj.obj.Subtype.Enum().String()) +} + +// Extended Community Sub Type field of 1 Byte. +// - route_target: Route Target. +// - origin: Origin. +// - extended_bandwidth: Specifies the link bandwidth. +// - color: Specifies the color value. +// - encapsulation: Specifies the Encapsulation Extended Community. +// - mac_address: Specifies the Extended community MAC address. +// Subtype returns a string +func (obj *bgpExtCommunity) HasSubtype() bool { + return obj.obj.Subtype != nil +} + +func (obj *bgpExtCommunity) SetSubtype(value BgpExtCommunitySubtypeEnum) BgpExtCommunity { + intValue, ok := otg.BgpExtCommunity_Subtype_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpExtCommunitySubtypeEnum", string(value))) + return obj + } + enumValue := otg.BgpExtCommunity_Subtype_Enum(intValue) + obj.obj.Subtype = &enumValue + + return obj +} + +// Extended Community value of 6 Bytes. Example - for the Opaque type and Color subtype value can be '0000000000c8' for the color value 200. +// Value returns a string +func (obj *bgpExtCommunity) Value() string { + + return *obj.obj.Value + +} + +// Extended Community value of 6 Bytes. Example - for the Opaque type and Color subtype value can be '0000000000c8' for the color value 200. +// Value returns a string +func (obj *bgpExtCommunity) HasValue() bool { + return obj.obj.Value != nil +} + +// Extended Community value of 6 Bytes. Example - for the Opaque type and Color subtype value can be '0000000000c8' for the color value 200. +// SetValue sets the string value in the BgpExtCommunity object +func (obj *bgpExtCommunity) SetValue(value string) BgpExtCommunity { + + obj.obj.Value = &value + return obj +} + +func (obj *bgpExtCommunity) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateHex(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpExtCommunity.Value")) + } + + } + +} + +func (obj *bgpExtCommunity) setDefault() { + +} diff --git a/gosnappi/bgp_extended_community.go b/gosnappi/bgp_extended_community.go new file mode 100644 index 00000000..d4b522cb --- /dev/null +++ b/gosnappi/bgp_extended_community.go @@ -0,0 +1,732 @@ +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" +) + +// ***** BgpExtendedCommunity ***** +type bgpExtendedCommunity struct { + validation + obj *otg.BgpExtendedCommunity + marshaller marshalBgpExtendedCommunity + unMarshaller unMarshalBgpExtendedCommunity + transitive_2OctetAsTypeHolder BgpExtendedCommunityTransitive2OctetAsType + transitiveIpv4AddressTypeHolder BgpExtendedCommunityTransitiveIpv4AddressType + transitive_4OctetAsTypeHolder BgpExtendedCommunityTransitive4OctetAsType + transitiveOpaqueTypeHolder BgpExtendedCommunityTransitiveOpaqueType + transitiveEvpnTypeHolder BgpExtendedCommunityTransitiveEvpnType + nonTransitive_2OctetAsTypeHolder BgpExtendedCommunityNonTransitive2OctetAsType + customHolder BgpExtendedCommunityCustomType +} + +func NewBgpExtendedCommunity() BgpExtendedCommunity { + obj := bgpExtendedCommunity{obj: &otg.BgpExtendedCommunity{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunity) msg() *otg.BgpExtendedCommunity { + return obj.obj +} + +func (obj *bgpExtendedCommunity) setMsg(msg *otg.BgpExtendedCommunity) BgpExtendedCommunity { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunity struct { + obj *bgpExtendedCommunity +} + +type marshalBgpExtendedCommunity interface { + // ToProto marshals BgpExtendedCommunity to protobuf object *otg.BgpExtendedCommunity + ToProto() (*otg.BgpExtendedCommunity, error) + // ToPbText marshals BgpExtendedCommunity to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunity to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunity to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunity struct { + obj *bgpExtendedCommunity +} + +type unMarshalBgpExtendedCommunity interface { + // FromProto unmarshals BgpExtendedCommunity from protobuf object *otg.BgpExtendedCommunity + FromProto(msg *otg.BgpExtendedCommunity) (BgpExtendedCommunity, error) + // FromPbText unmarshals BgpExtendedCommunity from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunity from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunity from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunity) Marshal() marshalBgpExtendedCommunity { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunity{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunity) Unmarshal() unMarshalBgpExtendedCommunity { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunity{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunity) ToProto() (*otg.BgpExtendedCommunity, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunity) FromProto(msg *otg.BgpExtendedCommunity) (BgpExtendedCommunity, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunity) 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 *unMarshalbgpExtendedCommunity) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpExtendedCommunity) 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 *unMarshalbgpExtendedCommunity) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpExtendedCommunity) 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 *unMarshalbgpExtendedCommunity) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpExtendedCommunity) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunity) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunity) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunity) Clone() (BgpExtendedCommunity, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunity() + 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 +} + +func (obj *bgpExtendedCommunity) setNil() { + obj.transitive_2OctetAsTypeHolder = nil + obj.transitiveIpv4AddressTypeHolder = nil + obj.transitive_4OctetAsTypeHolder = nil + obj.transitiveOpaqueTypeHolder = nil + obj.transitiveEvpnTypeHolder = nil + obj.nonTransitive_2OctetAsTypeHolder = nil + obj.customHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpExtendedCommunity is the Extended Communities Attribute is a optional BGP attribute,defined in RFC4360 with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value.It is divided into two main parts. The first 2 Bytes of the community encode a type and optonal sub-type field. The last 6 bytes (or 7 bytes for types without a sub-type) carry a unique set of data in a format defined by the type and optional sub-type field. Extended communities provide a larger range for grouping or categorizing communities. +type BgpExtendedCommunity interface { + Validation + // msg marshals BgpExtendedCommunity to protobuf object *otg.BgpExtendedCommunity + // and doesn't set defaults + msg() *otg.BgpExtendedCommunity + // setMsg unmarshals BgpExtendedCommunity from protobuf object *otg.BgpExtendedCommunity + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunity) BgpExtendedCommunity + // provides marshal interface + Marshal() marshalBgpExtendedCommunity + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunity + // validate validates BgpExtendedCommunity + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunity, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpExtendedCommunityChoiceEnum, set in BgpExtendedCommunity + Choice() BgpExtendedCommunityChoiceEnum + // setChoice assigns BgpExtendedCommunityChoiceEnum provided by user to BgpExtendedCommunity + setChoice(value BgpExtendedCommunityChoiceEnum) BgpExtendedCommunity + // HasChoice checks if Choice has been set in BgpExtendedCommunity + HasChoice() bool + // Transitive2OctetAsType returns BgpExtendedCommunityTransitive2OctetAsType, set in BgpExtendedCommunity. + // BgpExtendedCommunityTransitive2OctetAsType is the Transitive Two-Octet AS-Specific Extended Community is sent as type 0x00 . + Transitive2OctetAsType() BgpExtendedCommunityTransitive2OctetAsType + // SetTransitive2OctetAsType assigns BgpExtendedCommunityTransitive2OctetAsType provided by user to BgpExtendedCommunity. + // BgpExtendedCommunityTransitive2OctetAsType is the Transitive Two-Octet AS-Specific Extended Community is sent as type 0x00 . + SetTransitive2OctetAsType(value BgpExtendedCommunityTransitive2OctetAsType) BgpExtendedCommunity + // HasTransitive2OctetAsType checks if Transitive2OctetAsType has been set in BgpExtendedCommunity + HasTransitive2OctetAsType() bool + // TransitiveIpv4AddressType returns BgpExtendedCommunityTransitiveIpv4AddressType, set in BgpExtendedCommunity. + // BgpExtendedCommunityTransitiveIpv4AddressType is the Transitive IPv4 Address Specific Extended Community is sent as type 0x01. + TransitiveIpv4AddressType() BgpExtendedCommunityTransitiveIpv4AddressType + // SetTransitiveIpv4AddressType assigns BgpExtendedCommunityTransitiveIpv4AddressType provided by user to BgpExtendedCommunity. + // BgpExtendedCommunityTransitiveIpv4AddressType is the Transitive IPv4 Address Specific Extended Community is sent as type 0x01. + SetTransitiveIpv4AddressType(value BgpExtendedCommunityTransitiveIpv4AddressType) BgpExtendedCommunity + // HasTransitiveIpv4AddressType checks if TransitiveIpv4AddressType has been set in BgpExtendedCommunity + HasTransitiveIpv4AddressType() bool + // Transitive4OctetAsType returns BgpExtendedCommunityTransitive4OctetAsType, set in BgpExtendedCommunity. + // BgpExtendedCommunityTransitive4OctetAsType is the Transitive Four-Octet AS-Specific Extended Community is sent as type 0x02. It is defined in RFC 5668. + Transitive4OctetAsType() BgpExtendedCommunityTransitive4OctetAsType + // SetTransitive4OctetAsType assigns BgpExtendedCommunityTransitive4OctetAsType provided by user to BgpExtendedCommunity. + // BgpExtendedCommunityTransitive4OctetAsType is the Transitive Four-Octet AS-Specific Extended Community is sent as type 0x02. It is defined in RFC 5668. + SetTransitive4OctetAsType(value BgpExtendedCommunityTransitive4OctetAsType) BgpExtendedCommunity + // HasTransitive4OctetAsType checks if Transitive4OctetAsType has been set in BgpExtendedCommunity + HasTransitive4OctetAsType() bool + // TransitiveOpaqueType returns BgpExtendedCommunityTransitiveOpaqueType, set in BgpExtendedCommunity. + // BgpExtendedCommunityTransitiveOpaqueType is the Transitive Opaque Extended Community is sent as type 0x03. + TransitiveOpaqueType() BgpExtendedCommunityTransitiveOpaqueType + // SetTransitiveOpaqueType assigns BgpExtendedCommunityTransitiveOpaqueType provided by user to BgpExtendedCommunity. + // BgpExtendedCommunityTransitiveOpaqueType is the Transitive Opaque Extended Community is sent as type 0x03. + SetTransitiveOpaqueType(value BgpExtendedCommunityTransitiveOpaqueType) BgpExtendedCommunity + // HasTransitiveOpaqueType checks if TransitiveOpaqueType has been set in BgpExtendedCommunity + HasTransitiveOpaqueType() bool + // TransitiveEvpnType returns BgpExtendedCommunityTransitiveEvpnType, set in BgpExtendedCommunity. + // BgpExtendedCommunityTransitiveEvpnType is the Transitive EVPN Extended Community is sent as type 0x06 . + TransitiveEvpnType() BgpExtendedCommunityTransitiveEvpnType + // SetTransitiveEvpnType assigns BgpExtendedCommunityTransitiveEvpnType provided by user to BgpExtendedCommunity. + // BgpExtendedCommunityTransitiveEvpnType is the Transitive EVPN Extended Community is sent as type 0x06 . + SetTransitiveEvpnType(value BgpExtendedCommunityTransitiveEvpnType) BgpExtendedCommunity + // HasTransitiveEvpnType checks if TransitiveEvpnType has been set in BgpExtendedCommunity + HasTransitiveEvpnType() bool + // NonTransitive2OctetAsType returns BgpExtendedCommunityNonTransitive2OctetAsType, set in BgpExtendedCommunity. + // BgpExtendedCommunityNonTransitive2OctetAsType is the Non-Transitive Two-Octet AS-Specific Extended Community is sent as type 0x40. + NonTransitive2OctetAsType() BgpExtendedCommunityNonTransitive2OctetAsType + // SetNonTransitive2OctetAsType assigns BgpExtendedCommunityNonTransitive2OctetAsType provided by user to BgpExtendedCommunity. + // BgpExtendedCommunityNonTransitive2OctetAsType is the Non-Transitive Two-Octet AS-Specific Extended Community is sent as type 0x40. + SetNonTransitive2OctetAsType(value BgpExtendedCommunityNonTransitive2OctetAsType) BgpExtendedCommunity + // HasNonTransitive2OctetAsType checks if NonTransitive2OctetAsType has been set in BgpExtendedCommunity + HasNonTransitive2OctetAsType() bool + // Custom returns BgpExtendedCommunityCustomType, set in BgpExtendedCommunity. + // BgpExtendedCommunityCustomType is add a custom Extended Community with a combination of types , sub-types and values not explicitly specified above or not defined yet. + Custom() BgpExtendedCommunityCustomType + // SetCustom assigns BgpExtendedCommunityCustomType provided by user to BgpExtendedCommunity. + // BgpExtendedCommunityCustomType is add a custom Extended Community with a combination of types , sub-types and values not explicitly specified above or not defined yet. + SetCustom(value BgpExtendedCommunityCustomType) BgpExtendedCommunity + // HasCustom checks if Custom has been set in BgpExtendedCommunity + HasCustom() bool + setNil() +} + +type BgpExtendedCommunityChoiceEnum string + +// Enum of Choice on BgpExtendedCommunity +var BgpExtendedCommunityChoice = struct { + TRANSITIVE_2OCTET_AS_TYPE BgpExtendedCommunityChoiceEnum + TRANSITIVE_IPV4_ADDRESS_TYPE BgpExtendedCommunityChoiceEnum + TRANSITIVE_4OCTET_AS_TYPE BgpExtendedCommunityChoiceEnum + TRANSITIVE_OPAQUE_TYPE BgpExtendedCommunityChoiceEnum + TRANSITIVE_EVPN_TYPE BgpExtendedCommunityChoiceEnum + NON_TRANSITIVE_2OCTET_AS_TYPE BgpExtendedCommunityChoiceEnum + CUSTOM BgpExtendedCommunityChoiceEnum +}{ + TRANSITIVE_2OCTET_AS_TYPE: BgpExtendedCommunityChoiceEnum("transitive_2octet_as_type"), + TRANSITIVE_IPV4_ADDRESS_TYPE: BgpExtendedCommunityChoiceEnum("transitive_ipv4_address_type"), + TRANSITIVE_4OCTET_AS_TYPE: BgpExtendedCommunityChoiceEnum("transitive_4octet_as_type"), + TRANSITIVE_OPAQUE_TYPE: BgpExtendedCommunityChoiceEnum("transitive_opaque_type"), + TRANSITIVE_EVPN_TYPE: BgpExtendedCommunityChoiceEnum("transitive_evpn_type"), + NON_TRANSITIVE_2OCTET_AS_TYPE: BgpExtendedCommunityChoiceEnum("non_transitive_2octet_as_type"), + CUSTOM: BgpExtendedCommunityChoiceEnum("custom"), +} + +func (obj *bgpExtendedCommunity) Choice() BgpExtendedCommunityChoiceEnum { + return BgpExtendedCommunityChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *bgpExtendedCommunity) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpExtendedCommunity) setChoice(value BgpExtendedCommunityChoiceEnum) BgpExtendedCommunity { + intValue, ok := otg.BgpExtendedCommunity_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpExtendedCommunityChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpExtendedCommunity_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Custom = nil + obj.customHolder = nil + obj.obj.NonTransitive_2OctetAsType = nil + obj.nonTransitive_2OctetAsTypeHolder = nil + obj.obj.TransitiveEvpnType = nil + obj.transitiveEvpnTypeHolder = nil + obj.obj.TransitiveOpaqueType = nil + obj.transitiveOpaqueTypeHolder = nil + obj.obj.Transitive_4OctetAsType = nil + obj.transitive_4OctetAsTypeHolder = nil + obj.obj.TransitiveIpv4AddressType = nil + obj.transitiveIpv4AddressTypeHolder = nil + obj.obj.Transitive_2OctetAsType = nil + obj.transitive_2OctetAsTypeHolder = nil + + if value == BgpExtendedCommunityChoice.TRANSITIVE_2OCTET_AS_TYPE { + obj.obj.Transitive_2OctetAsType = NewBgpExtendedCommunityTransitive2OctetAsType().msg() + } + + if value == BgpExtendedCommunityChoice.TRANSITIVE_IPV4_ADDRESS_TYPE { + obj.obj.TransitiveIpv4AddressType = NewBgpExtendedCommunityTransitiveIpv4AddressType().msg() + } + + if value == BgpExtendedCommunityChoice.TRANSITIVE_4OCTET_AS_TYPE { + obj.obj.Transitive_4OctetAsType = NewBgpExtendedCommunityTransitive4OctetAsType().msg() + } + + if value == BgpExtendedCommunityChoice.TRANSITIVE_OPAQUE_TYPE { + obj.obj.TransitiveOpaqueType = NewBgpExtendedCommunityTransitiveOpaqueType().msg() + } + + if value == BgpExtendedCommunityChoice.TRANSITIVE_EVPN_TYPE { + obj.obj.TransitiveEvpnType = NewBgpExtendedCommunityTransitiveEvpnType().msg() + } + + if value == BgpExtendedCommunityChoice.NON_TRANSITIVE_2OCTET_AS_TYPE { + obj.obj.NonTransitive_2OctetAsType = NewBgpExtendedCommunityNonTransitive2OctetAsType().msg() + } + + if value == BgpExtendedCommunityChoice.CUSTOM { + obj.obj.Custom = NewBgpExtendedCommunityCustomType().msg() + } + + return obj +} + +// description is TBD +// Transitive2OctetAsType returns a BgpExtendedCommunityTransitive2OctetAsType +func (obj *bgpExtendedCommunity) Transitive2OctetAsType() BgpExtendedCommunityTransitive2OctetAsType { + if obj.obj.Transitive_2OctetAsType == nil { + obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_2OCTET_AS_TYPE) + } + if obj.transitive_2OctetAsTypeHolder == nil { + obj.transitive_2OctetAsTypeHolder = &bgpExtendedCommunityTransitive2OctetAsType{obj: obj.obj.Transitive_2OctetAsType} + } + return obj.transitive_2OctetAsTypeHolder +} + +// description is TBD +// Transitive2OctetAsType returns a BgpExtendedCommunityTransitive2OctetAsType +func (obj *bgpExtendedCommunity) HasTransitive2OctetAsType() bool { + return obj.obj.Transitive_2OctetAsType != nil +} + +// description is TBD +// SetTransitive2OctetAsType sets the BgpExtendedCommunityTransitive2OctetAsType value in the BgpExtendedCommunity object +func (obj *bgpExtendedCommunity) SetTransitive2OctetAsType(value BgpExtendedCommunityTransitive2OctetAsType) BgpExtendedCommunity { + obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_2OCTET_AS_TYPE) + obj.transitive_2OctetAsTypeHolder = nil + obj.obj.Transitive_2OctetAsType = value.msg() + + return obj +} + +// description is TBD +// TransitiveIpv4AddressType returns a BgpExtendedCommunityTransitiveIpv4AddressType +func (obj *bgpExtendedCommunity) TransitiveIpv4AddressType() BgpExtendedCommunityTransitiveIpv4AddressType { + if obj.obj.TransitiveIpv4AddressType == nil { + obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_IPV4_ADDRESS_TYPE) + } + if obj.transitiveIpv4AddressTypeHolder == nil { + obj.transitiveIpv4AddressTypeHolder = &bgpExtendedCommunityTransitiveIpv4AddressType{obj: obj.obj.TransitiveIpv4AddressType} + } + return obj.transitiveIpv4AddressTypeHolder +} + +// description is TBD +// TransitiveIpv4AddressType returns a BgpExtendedCommunityTransitiveIpv4AddressType +func (obj *bgpExtendedCommunity) HasTransitiveIpv4AddressType() bool { + return obj.obj.TransitiveIpv4AddressType != nil +} + +// description is TBD +// SetTransitiveIpv4AddressType sets the BgpExtendedCommunityTransitiveIpv4AddressType value in the BgpExtendedCommunity object +func (obj *bgpExtendedCommunity) SetTransitiveIpv4AddressType(value BgpExtendedCommunityTransitiveIpv4AddressType) BgpExtendedCommunity { + obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_IPV4_ADDRESS_TYPE) + obj.transitiveIpv4AddressTypeHolder = nil + obj.obj.TransitiveIpv4AddressType = value.msg() + + return obj +} + +// description is TBD +// Transitive4OctetAsType returns a BgpExtendedCommunityTransitive4OctetAsType +func (obj *bgpExtendedCommunity) Transitive4OctetAsType() BgpExtendedCommunityTransitive4OctetAsType { + if obj.obj.Transitive_4OctetAsType == nil { + obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_4OCTET_AS_TYPE) + } + if obj.transitive_4OctetAsTypeHolder == nil { + obj.transitive_4OctetAsTypeHolder = &bgpExtendedCommunityTransitive4OctetAsType{obj: obj.obj.Transitive_4OctetAsType} + } + return obj.transitive_4OctetAsTypeHolder +} + +// description is TBD +// Transitive4OctetAsType returns a BgpExtendedCommunityTransitive4OctetAsType +func (obj *bgpExtendedCommunity) HasTransitive4OctetAsType() bool { + return obj.obj.Transitive_4OctetAsType != nil +} + +// description is TBD +// SetTransitive4OctetAsType sets the BgpExtendedCommunityTransitive4OctetAsType value in the BgpExtendedCommunity object +func (obj *bgpExtendedCommunity) SetTransitive4OctetAsType(value BgpExtendedCommunityTransitive4OctetAsType) BgpExtendedCommunity { + obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_4OCTET_AS_TYPE) + obj.transitive_4OctetAsTypeHolder = nil + obj.obj.Transitive_4OctetAsType = value.msg() + + return obj +} + +// description is TBD +// TransitiveOpaqueType returns a BgpExtendedCommunityTransitiveOpaqueType +func (obj *bgpExtendedCommunity) TransitiveOpaqueType() BgpExtendedCommunityTransitiveOpaqueType { + if obj.obj.TransitiveOpaqueType == nil { + obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_OPAQUE_TYPE) + } + if obj.transitiveOpaqueTypeHolder == nil { + obj.transitiveOpaqueTypeHolder = &bgpExtendedCommunityTransitiveOpaqueType{obj: obj.obj.TransitiveOpaqueType} + } + return obj.transitiveOpaqueTypeHolder +} + +// description is TBD +// TransitiveOpaqueType returns a BgpExtendedCommunityTransitiveOpaqueType +func (obj *bgpExtendedCommunity) HasTransitiveOpaqueType() bool { + return obj.obj.TransitiveOpaqueType != nil +} + +// description is TBD +// SetTransitiveOpaqueType sets the BgpExtendedCommunityTransitiveOpaqueType value in the BgpExtendedCommunity object +func (obj *bgpExtendedCommunity) SetTransitiveOpaqueType(value BgpExtendedCommunityTransitiveOpaqueType) BgpExtendedCommunity { + obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_OPAQUE_TYPE) + obj.transitiveOpaqueTypeHolder = nil + obj.obj.TransitiveOpaqueType = value.msg() + + return obj +} + +// description is TBD +// TransitiveEvpnType returns a BgpExtendedCommunityTransitiveEvpnType +func (obj *bgpExtendedCommunity) TransitiveEvpnType() BgpExtendedCommunityTransitiveEvpnType { + if obj.obj.TransitiveEvpnType == nil { + obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_EVPN_TYPE) + } + if obj.transitiveEvpnTypeHolder == nil { + obj.transitiveEvpnTypeHolder = &bgpExtendedCommunityTransitiveEvpnType{obj: obj.obj.TransitiveEvpnType} + } + return obj.transitiveEvpnTypeHolder +} + +// description is TBD +// TransitiveEvpnType returns a BgpExtendedCommunityTransitiveEvpnType +func (obj *bgpExtendedCommunity) HasTransitiveEvpnType() bool { + return obj.obj.TransitiveEvpnType != nil +} + +// description is TBD +// SetTransitiveEvpnType sets the BgpExtendedCommunityTransitiveEvpnType value in the BgpExtendedCommunity object +func (obj *bgpExtendedCommunity) SetTransitiveEvpnType(value BgpExtendedCommunityTransitiveEvpnType) BgpExtendedCommunity { + obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_EVPN_TYPE) + obj.transitiveEvpnTypeHolder = nil + obj.obj.TransitiveEvpnType = value.msg() + + return obj +} + +// description is TBD +// NonTransitive2OctetAsType returns a BgpExtendedCommunityNonTransitive2OctetAsType +func (obj *bgpExtendedCommunity) NonTransitive2OctetAsType() BgpExtendedCommunityNonTransitive2OctetAsType { + if obj.obj.NonTransitive_2OctetAsType == nil { + obj.setChoice(BgpExtendedCommunityChoice.NON_TRANSITIVE_2OCTET_AS_TYPE) + } + if obj.nonTransitive_2OctetAsTypeHolder == nil { + obj.nonTransitive_2OctetAsTypeHolder = &bgpExtendedCommunityNonTransitive2OctetAsType{obj: obj.obj.NonTransitive_2OctetAsType} + } + return obj.nonTransitive_2OctetAsTypeHolder +} + +// description is TBD +// NonTransitive2OctetAsType returns a BgpExtendedCommunityNonTransitive2OctetAsType +func (obj *bgpExtendedCommunity) HasNonTransitive2OctetAsType() bool { + return obj.obj.NonTransitive_2OctetAsType != nil +} + +// description is TBD +// SetNonTransitive2OctetAsType sets the BgpExtendedCommunityNonTransitive2OctetAsType value in the BgpExtendedCommunity object +func (obj *bgpExtendedCommunity) SetNonTransitive2OctetAsType(value BgpExtendedCommunityNonTransitive2OctetAsType) BgpExtendedCommunity { + obj.setChoice(BgpExtendedCommunityChoice.NON_TRANSITIVE_2OCTET_AS_TYPE) + obj.nonTransitive_2OctetAsTypeHolder = nil + obj.obj.NonTransitive_2OctetAsType = value.msg() + + return obj +} + +// description is TBD +// Custom returns a BgpExtendedCommunityCustomType +func (obj *bgpExtendedCommunity) Custom() BgpExtendedCommunityCustomType { + if obj.obj.Custom == nil { + obj.setChoice(BgpExtendedCommunityChoice.CUSTOM) + } + if obj.customHolder == nil { + obj.customHolder = &bgpExtendedCommunityCustomType{obj: obj.obj.Custom} + } + return obj.customHolder +} + +// description is TBD +// Custom returns a BgpExtendedCommunityCustomType +func (obj *bgpExtendedCommunity) HasCustom() bool { + return obj.obj.Custom != nil +} + +// description is TBD +// SetCustom sets the BgpExtendedCommunityCustomType value in the BgpExtendedCommunity object +func (obj *bgpExtendedCommunity) SetCustom(value BgpExtendedCommunityCustomType) BgpExtendedCommunity { + obj.setChoice(BgpExtendedCommunityChoice.CUSTOM) + obj.customHolder = nil + obj.obj.Custom = value.msg() + + return obj +} + +func (obj *bgpExtendedCommunity) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Transitive_2OctetAsType != nil { + + obj.Transitive2OctetAsType().validateObj(vObj, set_default) + } + + if obj.obj.TransitiveIpv4AddressType != nil { + + obj.TransitiveIpv4AddressType().validateObj(vObj, set_default) + } + + if obj.obj.Transitive_4OctetAsType != nil { + + obj.Transitive4OctetAsType().validateObj(vObj, set_default) + } + + if obj.obj.TransitiveOpaqueType != nil { + + obj.TransitiveOpaqueType().validateObj(vObj, set_default) + } + + if obj.obj.TransitiveEvpnType != nil { + + obj.TransitiveEvpnType().validateObj(vObj, set_default) + } + + if obj.obj.NonTransitive_2OctetAsType != nil { + + obj.NonTransitive2OctetAsType().validateObj(vObj, set_default) + } + + if obj.obj.Custom != nil { + + obj.Custom().validateObj(vObj, set_default) + } + +} + +func (obj *bgpExtendedCommunity) setDefault() { + var choices_set int = 0 + var choice BgpExtendedCommunityChoiceEnum + + if obj.obj.TransitiveIpv4AddressType != nil { + choices_set += 1 + choice = BgpExtendedCommunityChoice.TRANSITIVE_IPV4_ADDRESS_TYPE + } + + if obj.obj.TransitiveOpaqueType != nil { + choices_set += 1 + choice = BgpExtendedCommunityChoice.TRANSITIVE_OPAQUE_TYPE + } + + if obj.obj.TransitiveEvpnType != nil { + choices_set += 1 + choice = BgpExtendedCommunityChoice.TRANSITIVE_EVPN_TYPE + } + + if obj.obj.Custom != nil { + choices_set += 1 + choice = BgpExtendedCommunityChoice.CUSTOM + } + + if obj.obj.Transitive_2OctetAsType != nil { + choices_set += 1 + choice = BgpExtendedCommunityChoice.TRANSITIVE_2OCTET_AS_TYPE + } + + if obj.obj.Transitive_4OctetAsType != nil { + choices_set += 1 + choice = BgpExtendedCommunityChoice.TRANSITIVE_4OCTET_AS_TYPE + } + + if obj.obj.NonTransitive_2OctetAsType != nil { + choices_set += 1 + choice = BgpExtendedCommunityChoice.NON_TRANSITIVE_2OCTET_AS_TYPE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_2OCTET_AS_TYPE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpExtendedCommunity") + } + } else { + intVal := otg.BgpExtendedCommunity_Choice_Enum_value[string(choice)] + enumValue := otg.BgpExtendedCommunity_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_extended_community_custom_type.go b/gosnappi/bgp_extended_community_custom_type.go new file mode 100644 index 00000000..066b9b2a --- /dev/null +++ b/gosnappi/bgp_extended_community_custom_type.go @@ -0,0 +1,407 @@ +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" +) + +// ***** BgpExtendedCommunityCustomType ***** +type bgpExtendedCommunityCustomType struct { + validation + obj *otg.BgpExtendedCommunityCustomType + marshaller marshalBgpExtendedCommunityCustomType + unMarshaller unMarshalBgpExtendedCommunityCustomType +} + +func NewBgpExtendedCommunityCustomType() BgpExtendedCommunityCustomType { + obj := bgpExtendedCommunityCustomType{obj: &otg.BgpExtendedCommunityCustomType{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityCustomType) msg() *otg.BgpExtendedCommunityCustomType { + return obj.obj +} + +func (obj *bgpExtendedCommunityCustomType) setMsg(msg *otg.BgpExtendedCommunityCustomType) BgpExtendedCommunityCustomType { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityCustomType struct { + obj *bgpExtendedCommunityCustomType +} + +type marshalBgpExtendedCommunityCustomType interface { + // ToProto marshals BgpExtendedCommunityCustomType to protobuf object *otg.BgpExtendedCommunityCustomType + ToProto() (*otg.BgpExtendedCommunityCustomType, error) + // ToPbText marshals BgpExtendedCommunityCustomType to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityCustomType to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityCustomType to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityCustomType struct { + obj *bgpExtendedCommunityCustomType +} + +type unMarshalBgpExtendedCommunityCustomType interface { + // FromProto unmarshals BgpExtendedCommunityCustomType from protobuf object *otg.BgpExtendedCommunityCustomType + FromProto(msg *otg.BgpExtendedCommunityCustomType) (BgpExtendedCommunityCustomType, error) + // FromPbText unmarshals BgpExtendedCommunityCustomType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityCustomType from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityCustomType from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityCustomType) Marshal() marshalBgpExtendedCommunityCustomType { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityCustomType{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityCustomType) Unmarshal() unMarshalBgpExtendedCommunityCustomType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityCustomType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityCustomType) ToProto() (*otg.BgpExtendedCommunityCustomType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityCustomType) FromProto(msg *otg.BgpExtendedCommunityCustomType) (BgpExtendedCommunityCustomType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityCustomType) 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 *unMarshalbgpExtendedCommunityCustomType) 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 *marshalbgpExtendedCommunityCustomType) 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 *unMarshalbgpExtendedCommunityCustomType) 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 *marshalbgpExtendedCommunityCustomType) 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 *unMarshalbgpExtendedCommunityCustomType) 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 *bgpExtendedCommunityCustomType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityCustomType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityCustomType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityCustomType) Clone() (BgpExtendedCommunityCustomType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityCustomType() + 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 +} + +// BgpExtendedCommunityCustomType is add a custom Extended Community with a combination of types , sub-types and values not explicitly specified above or not defined yet. +type BgpExtendedCommunityCustomType interface { + Validation + // msg marshals BgpExtendedCommunityCustomType to protobuf object *otg.BgpExtendedCommunityCustomType + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityCustomType + // setMsg unmarshals BgpExtendedCommunityCustomType from protobuf object *otg.BgpExtendedCommunityCustomType + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityCustomType) BgpExtendedCommunityCustomType + // provides marshal interface + Marshal() marshalBgpExtendedCommunityCustomType + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityCustomType + // validate validates BgpExtendedCommunityCustomType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityCustomType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // CommunityType returns string, set in BgpExtendedCommunityCustomType. + CommunityType() string + // SetCommunityType assigns string provided by user to BgpExtendedCommunityCustomType + SetCommunityType(value string) BgpExtendedCommunityCustomType + // HasCommunityType checks if CommunityType has been set in BgpExtendedCommunityCustomType + HasCommunityType() bool + // CommunitySubtype returns string, set in BgpExtendedCommunityCustomType. + CommunitySubtype() string + // SetCommunitySubtype assigns string provided by user to BgpExtendedCommunityCustomType + SetCommunitySubtype(value string) BgpExtendedCommunityCustomType + // HasCommunitySubtype checks if CommunitySubtype has been set in BgpExtendedCommunityCustomType + HasCommunitySubtype() bool + // Value returns string, set in BgpExtendedCommunityCustomType. + Value() string + // SetValue assigns string provided by user to BgpExtendedCommunityCustomType + SetValue(value string) BgpExtendedCommunityCustomType + // HasValue checks if Value has been set in BgpExtendedCommunityCustomType + HasValue() bool +} + +// The type to be set in the Extended Community attribute. Accepts hexadecimal input upto ff . +// CommunityType returns a string +func (obj *bgpExtendedCommunityCustomType) CommunityType() string { + + return *obj.obj.CommunityType + +} + +// The type to be set in the Extended Community attribute. Accepts hexadecimal input upto ff . +// CommunityType returns a string +func (obj *bgpExtendedCommunityCustomType) HasCommunityType() bool { + return obj.obj.CommunityType != nil +} + +// The type to be set in the Extended Community attribute. Accepts hexadecimal input upto ff . +// SetCommunityType sets the string value in the BgpExtendedCommunityCustomType object +func (obj *bgpExtendedCommunityCustomType) SetCommunityType(value string) BgpExtendedCommunityCustomType { + + obj.obj.CommunityType = &value + return obj +} + +// The sub-type to be set in the Extended Community attribute. For certain types with no sub-type this byte can also be used as part of an extended value field. Accepts hexadecimal input upto ff. +// CommunitySubtype returns a string +func (obj *bgpExtendedCommunityCustomType) CommunitySubtype() string { + + return *obj.obj.CommunitySubtype + +} + +// The sub-type to be set in the Extended Community attribute. For certain types with no sub-type this byte can also be used as part of an extended value field. Accepts hexadecimal input upto ff. +// CommunitySubtype returns a string +func (obj *bgpExtendedCommunityCustomType) HasCommunitySubtype() bool { + return obj.obj.CommunitySubtype != nil +} + +// The sub-type to be set in the Extended Community attribute. For certain types with no sub-type this byte can also be used as part of an extended value field. Accepts hexadecimal input upto ff. +// SetCommunitySubtype sets the string value in the BgpExtendedCommunityCustomType object +func (obj *bgpExtendedCommunityCustomType) SetCommunitySubtype(value string) BgpExtendedCommunityCustomType { + + obj.obj.CommunitySubtype = &value + return obj +} + +// 6 byte hex value to be carried in the last 6 bytes of the Extended Community. Accepts hexadecimal input upto ffffffffffff. +// Value returns a string +func (obj *bgpExtendedCommunityCustomType) Value() string { + + return *obj.obj.Value + +} + +// 6 byte hex value to be carried in the last 6 bytes of the Extended Community. Accepts hexadecimal input upto ffffffffffff. +// Value returns a string +func (obj *bgpExtendedCommunityCustomType) HasValue() bool { + return obj.obj.Value != nil +} + +// 6 byte hex value to be carried in the last 6 bytes of the Extended Community. Accepts hexadecimal input upto ffffffffffff. +// SetValue sets the string value in the BgpExtendedCommunityCustomType object +func (obj *bgpExtendedCommunityCustomType) SetValue(value string) BgpExtendedCommunityCustomType { + + obj.obj.Value = &value + return obj +} + +func (obj *bgpExtendedCommunityCustomType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.CommunityType != nil { + + if len(*obj.obj.CommunityType) > 2 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "None <= length of BgpExtendedCommunityCustomType.CommunityType <= 2 but Got %d", + len(*obj.obj.CommunityType))) + } + + } + + if obj.obj.CommunitySubtype != nil { + + if len(*obj.obj.CommunitySubtype) > 2 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "None <= length of BgpExtendedCommunityCustomType.CommunitySubtype <= 2 but Got %d", + len(*obj.obj.CommunitySubtype))) + } + + } + + if obj.obj.Value != nil { + + if len(*obj.obj.Value) > 12 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "None <= length of BgpExtendedCommunityCustomType.Value <= 12 but Got %d", + len(*obj.obj.Value))) + } + + } + +} + +func (obj *bgpExtendedCommunityCustomType) setDefault() { + if obj.obj.CommunityType == nil { + obj.SetCommunityType("00") + } + if obj.obj.CommunitySubtype == nil { + obj.SetCommunitySubtype("00") + } + if obj.obj.Value == nil { + obj.SetValue("000000000000") + } + +} diff --git a/gosnappi/bgp_extended_community_non_transitive2_octet_as_type.go b/gosnappi/bgp_extended_community_non_transitive2_octet_as_type.go new file mode 100644 index 00000000..60ca714b --- /dev/null +++ b/gosnappi/bgp_extended_community_non_transitive2_octet_as_type.go @@ -0,0 +1,396 @@ +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" +) + +// ***** BgpExtendedCommunityNonTransitive2OctetAsType ***** +type bgpExtendedCommunityNonTransitive2OctetAsType struct { + validation + obj *otg.BgpExtendedCommunityNonTransitive2OctetAsType + marshaller marshalBgpExtendedCommunityNonTransitive2OctetAsType + unMarshaller unMarshalBgpExtendedCommunityNonTransitive2OctetAsType + linkBandwidthSubtypeHolder BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth +} + +func NewBgpExtendedCommunityNonTransitive2OctetAsType() BgpExtendedCommunityNonTransitive2OctetAsType { + obj := bgpExtendedCommunityNonTransitive2OctetAsType{obj: &otg.BgpExtendedCommunityNonTransitive2OctetAsType{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) msg() *otg.BgpExtendedCommunityNonTransitive2OctetAsType { + return obj.obj +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) setMsg(msg *otg.BgpExtendedCommunityNonTransitive2OctetAsType) BgpExtendedCommunityNonTransitive2OctetAsType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityNonTransitive2OctetAsType struct { + obj *bgpExtendedCommunityNonTransitive2OctetAsType +} + +type marshalBgpExtendedCommunityNonTransitive2OctetAsType interface { + // ToProto marshals BgpExtendedCommunityNonTransitive2OctetAsType to protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsType + ToProto() (*otg.BgpExtendedCommunityNonTransitive2OctetAsType, error) + // ToPbText marshals BgpExtendedCommunityNonTransitive2OctetAsType to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityNonTransitive2OctetAsType to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityNonTransitive2OctetAsType to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityNonTransitive2OctetAsType struct { + obj *bgpExtendedCommunityNonTransitive2OctetAsType +} + +type unMarshalBgpExtendedCommunityNonTransitive2OctetAsType interface { + // FromProto unmarshals BgpExtendedCommunityNonTransitive2OctetAsType from protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsType + FromProto(msg *otg.BgpExtendedCommunityNonTransitive2OctetAsType) (BgpExtendedCommunityNonTransitive2OctetAsType, error) + // FromPbText unmarshals BgpExtendedCommunityNonTransitive2OctetAsType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityNonTransitive2OctetAsType from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityNonTransitive2OctetAsType from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) Marshal() marshalBgpExtendedCommunityNonTransitive2OctetAsType { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityNonTransitive2OctetAsType{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) Unmarshal() unMarshalBgpExtendedCommunityNonTransitive2OctetAsType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityNonTransitive2OctetAsType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityNonTransitive2OctetAsType) ToProto() (*otg.BgpExtendedCommunityNonTransitive2OctetAsType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityNonTransitive2OctetAsType) FromProto(msg *otg.BgpExtendedCommunityNonTransitive2OctetAsType) (BgpExtendedCommunityNonTransitive2OctetAsType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityNonTransitive2OctetAsType) 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 *unMarshalbgpExtendedCommunityNonTransitive2OctetAsType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpExtendedCommunityNonTransitive2OctetAsType) 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 *unMarshalbgpExtendedCommunityNonTransitive2OctetAsType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpExtendedCommunityNonTransitive2OctetAsType) 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 *unMarshalbgpExtendedCommunityNonTransitive2OctetAsType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) Clone() (BgpExtendedCommunityNonTransitive2OctetAsType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityNonTransitive2OctetAsType() + 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 +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) setNil() { + obj.linkBandwidthSubtypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpExtendedCommunityNonTransitive2OctetAsType is the Non-Transitive Two-Octet AS-Specific Extended Community is sent as type 0x40. +type BgpExtendedCommunityNonTransitive2OctetAsType interface { + Validation + // msg marshals BgpExtendedCommunityNonTransitive2OctetAsType to protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsType + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityNonTransitive2OctetAsType + // setMsg unmarshals BgpExtendedCommunityNonTransitive2OctetAsType from protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsType + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityNonTransitive2OctetAsType) BgpExtendedCommunityNonTransitive2OctetAsType + // provides marshal interface + Marshal() marshalBgpExtendedCommunityNonTransitive2OctetAsType + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityNonTransitive2OctetAsType + // validate validates BgpExtendedCommunityNonTransitive2OctetAsType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityNonTransitive2OctetAsType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum, set in BgpExtendedCommunityNonTransitive2OctetAsType + Choice() BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum + // setChoice assigns BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum provided by user to BgpExtendedCommunityNonTransitive2OctetAsType + setChoice(value BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum) BgpExtendedCommunityNonTransitive2OctetAsType + // HasChoice checks if Choice has been set in BgpExtendedCommunityNonTransitive2OctetAsType + HasChoice() bool + // LinkBandwidthSubtype returns BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, set in BgpExtendedCommunityNonTransitive2OctetAsType. + // BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth is the Link Bandwidth Extended Community attribute is defined in draft-ietf-idr-link-bandwidth. It is sent with sub-type as 0x04. + LinkBandwidthSubtype() BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // SetLinkBandwidthSubtype assigns BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth provided by user to BgpExtendedCommunityNonTransitive2OctetAsType. + // BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth is the Link Bandwidth Extended Community attribute is defined in draft-ietf-idr-link-bandwidth. It is sent with sub-type as 0x04. + SetLinkBandwidthSubtype(value BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) BgpExtendedCommunityNonTransitive2OctetAsType + // HasLinkBandwidthSubtype checks if LinkBandwidthSubtype has been set in BgpExtendedCommunityNonTransitive2OctetAsType + HasLinkBandwidthSubtype() bool + setNil() +} + +type BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum string + +// Enum of Choice on BgpExtendedCommunityNonTransitive2OctetAsType +var BgpExtendedCommunityNonTransitive2OctetAsTypeChoice = struct { + LINK_BANDWIDTH_SUBTYPE BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum +}{ + LINK_BANDWIDTH_SUBTYPE: BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum("link_bandwidth_subtype"), +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) Choice() BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum { + return BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) setChoice(value BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum) BgpExtendedCommunityNonTransitive2OctetAsType { + intValue, ok := otg.BgpExtendedCommunityNonTransitive2OctetAsType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpExtendedCommunityNonTransitive2OctetAsType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.LinkBandwidthSubtype = nil + obj.linkBandwidthSubtypeHolder = nil + + if value == BgpExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE { + obj.obj.LinkBandwidthSubtype = NewBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth().msg() + } + + return obj +} + +// description is TBD +// LinkBandwidthSubtype returns a BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) LinkBandwidthSubtype() BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + if obj.obj.LinkBandwidthSubtype == nil { + obj.setChoice(BgpExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE) + } + if obj.linkBandwidthSubtypeHolder == nil { + obj.linkBandwidthSubtypeHolder = &bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: obj.obj.LinkBandwidthSubtype} + } + return obj.linkBandwidthSubtypeHolder +} + +// description is TBD +// LinkBandwidthSubtype returns a BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) HasLinkBandwidthSubtype() bool { + return obj.obj.LinkBandwidthSubtype != nil +} + +// description is TBD +// SetLinkBandwidthSubtype sets the BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth value in the BgpExtendedCommunityNonTransitive2OctetAsType object +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) SetLinkBandwidthSubtype(value BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) BgpExtendedCommunityNonTransitive2OctetAsType { + obj.setChoice(BgpExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE) + obj.linkBandwidthSubtypeHolder = nil + obj.obj.LinkBandwidthSubtype = value.msg() + + return obj +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.LinkBandwidthSubtype != nil { + + obj.LinkBandwidthSubtype().validateObj(vObj, set_default) + } + +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) setDefault() { + var choices_set int = 0 + var choice BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum + + if obj.obj.LinkBandwidthSubtype != nil { + choices_set += 1 + choice = BgpExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(BgpExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpExtendedCommunityNonTransitive2OctetAsType") + } + } else { + intVal := otg.BgpExtendedCommunityNonTransitive2OctetAsType_Choice_Enum_value[string(choice)] + enumValue := otg.BgpExtendedCommunityNonTransitive2OctetAsType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_extended_community_non_transitive2_octet_as_type_link_bandwidth.go b/gosnappi/bgp_extended_community_non_transitive2_octet_as_type_link_bandwidth.go new file mode 100644 index 00000000..1f7c9085 --- /dev/null +++ b/gosnappi/bgp_extended_community_non_transitive2_octet_as_type_link_bandwidth.go @@ -0,0 +1,350 @@ +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" +) + +// ***** BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth ***** +type bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth struct { + validation + obj *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + marshaller marshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + unMarshaller unMarshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth +} + +func NewBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth() BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + obj := bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: &otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) msg() *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + return obj.obj +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) setMsg(msg *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth struct { + obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth +} + +type marshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth interface { + // ToProto marshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + ToProto() (*otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) + // ToPbText marshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth struct { + obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth +} + +type unMarshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth interface { + // FromProto unmarshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + FromProto(msg *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) (BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) + // FromPbText unmarshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Marshal() marshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Unmarshal() unMarshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) ToProto() (*otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) FromProto(msg *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) (BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *unMarshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *marshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *unMarshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *marshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *unMarshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Clone() (BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth() + 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 +} + +// BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth is the Link Bandwidth Extended Community attribute is defined in draft-ietf-idr-link-bandwidth. It is sent with sub-type as 0x04. +type BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth interface { + Validation + // msg marshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // setMsg unmarshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // provides marshal interface + Marshal() marshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // validate validates BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Global2ByteAs returns uint32, set in BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth. + Global2ByteAs() uint32 + // SetGlobal2ByteAs assigns uint32 provided by user to BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + SetGlobal2ByteAs(value uint32) BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // HasGlobal2ByteAs checks if Global2ByteAs has been set in BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + HasGlobal2ByteAs() bool + // Bandwidth returns float32, set in BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth. + Bandwidth() float32 + // SetBandwidth assigns float32 provided by user to BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + SetBandwidth(value float32) BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // HasBandwidth checks if Bandwidth has been set in BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + HasBandwidth() bool +} + +// The value of the Global Administrator subfield should represent the Autonomous System of the router that attaches the Link Bandwidth Community. If four octet AS numbering scheme is used, AS_TRANS (23456) should be used. +// Global2ByteAs returns a uint32 +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Global2ByteAs() uint32 { + + return *obj.obj.Global_2ByteAs + +} + +// The value of the Global Administrator subfield should represent the Autonomous System of the router that attaches the Link Bandwidth Community. If four octet AS numbering scheme is used, AS_TRANS (23456) should be used. +// Global2ByteAs returns a uint32 +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) HasGlobal2ByteAs() bool { + return obj.obj.Global_2ByteAs != nil +} + +// The value of the Global Administrator subfield should represent the Autonomous System of the router that attaches the Link Bandwidth Community. If four octet AS numbering scheme is used, AS_TRANS (23456) should be used. +// SetGlobal2ByteAs sets the uint32 value in the BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth object +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) SetGlobal2ByteAs(value uint32) BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + + obj.obj.Global_2ByteAs = &value + return obj +} + +// Bandwidth of the link in bytes per second. ( 1 Kbps is 1000 bytes per second and 1 Mbps is 1000 Kbps per second ) +// Bandwidth returns a float32 +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Bandwidth() float32 { + + return *obj.obj.Bandwidth + +} + +// Bandwidth of the link in bytes per second. ( 1 Kbps is 1000 bytes per second and 1 Mbps is 1000 Kbps per second ) +// Bandwidth returns a float32 +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) HasBandwidth() bool { + return obj.obj.Bandwidth != nil +} + +// Bandwidth of the link in bytes per second. ( 1 Kbps is 1000 bytes per second and 1 Mbps is 1000 Kbps per second ) +// SetBandwidth sets the float32 value in the BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth object +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) SetBandwidth(value float32) BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + + obj.obj.Bandwidth = &value + return obj +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Global_2ByteAs != nil { + + if *obj.obj.Global_2ByteAs > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth.Global_2ByteAs <= 65535 but Got %d", *obj.obj.Global_2ByteAs)) + } + + } + +} + +func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) setDefault() { + if obj.obj.Global_2ByteAs == nil { + obj.SetGlobal2ByteAs(100) + } + if obj.obj.Bandwidth == nil { + obj.SetBandwidth(0) + } + +} diff --git a/gosnappi/bgp_extended_community_transitive2_octet_as_type.go b/gosnappi/bgp_extended_community_transitive2_octet_as_type.go new file mode 100644 index 00000000..f8b40d1d --- /dev/null +++ b/gosnappi/bgp_extended_community_transitive2_octet_as_type.go @@ -0,0 +1,452 @@ +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" +) + +// ***** BgpExtendedCommunityTransitive2OctetAsType ***** +type bgpExtendedCommunityTransitive2OctetAsType struct { + validation + obj *otg.BgpExtendedCommunityTransitive2OctetAsType + marshaller marshalBgpExtendedCommunityTransitive2OctetAsType + unMarshaller unMarshalBgpExtendedCommunityTransitive2OctetAsType + routeTargetSubtypeHolder BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + routeOriginSubtypeHolder BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin +} + +func NewBgpExtendedCommunityTransitive2OctetAsType() BgpExtendedCommunityTransitive2OctetAsType { + obj := bgpExtendedCommunityTransitive2OctetAsType{obj: &otg.BgpExtendedCommunityTransitive2OctetAsType{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsType) msg() *otg.BgpExtendedCommunityTransitive2OctetAsType { + return obj.obj +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsType) setMsg(msg *otg.BgpExtendedCommunityTransitive2OctetAsType) BgpExtendedCommunityTransitive2OctetAsType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityTransitive2OctetAsType struct { + obj *bgpExtendedCommunityTransitive2OctetAsType +} + +type marshalBgpExtendedCommunityTransitive2OctetAsType interface { + // ToProto marshals BgpExtendedCommunityTransitive2OctetAsType to protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsType + ToProto() (*otg.BgpExtendedCommunityTransitive2OctetAsType, error) + // ToPbText marshals BgpExtendedCommunityTransitive2OctetAsType to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityTransitive2OctetAsType to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityTransitive2OctetAsType to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityTransitive2OctetAsType struct { + obj *bgpExtendedCommunityTransitive2OctetAsType +} + +type unMarshalBgpExtendedCommunityTransitive2OctetAsType interface { + // FromProto unmarshals BgpExtendedCommunityTransitive2OctetAsType from protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsType + FromProto(msg *otg.BgpExtendedCommunityTransitive2OctetAsType) (BgpExtendedCommunityTransitive2OctetAsType, error) + // FromPbText unmarshals BgpExtendedCommunityTransitive2OctetAsType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityTransitive2OctetAsType from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityTransitive2OctetAsType from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsType) Marshal() marshalBgpExtendedCommunityTransitive2OctetAsType { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityTransitive2OctetAsType{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsType) Unmarshal() unMarshalBgpExtendedCommunityTransitive2OctetAsType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitive2OctetAsType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityTransitive2OctetAsType) ToProto() (*otg.BgpExtendedCommunityTransitive2OctetAsType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityTransitive2OctetAsType) FromProto(msg *otg.BgpExtendedCommunityTransitive2OctetAsType) (BgpExtendedCommunityTransitive2OctetAsType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityTransitive2OctetAsType) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpExtendedCommunityTransitive2OctetAsType) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpExtendedCommunityTransitive2OctetAsType) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsType) Clone() (BgpExtendedCommunityTransitive2OctetAsType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityTransitive2OctetAsType() + 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 +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsType) setNil() { + obj.routeTargetSubtypeHolder = nil + obj.routeOriginSubtypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpExtendedCommunityTransitive2OctetAsType is the Transitive Two-Octet AS-Specific Extended Community is sent as type 0x00 . +type BgpExtendedCommunityTransitive2OctetAsType interface { + Validation + // msg marshals BgpExtendedCommunityTransitive2OctetAsType to protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsType + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityTransitive2OctetAsType + // setMsg unmarshals BgpExtendedCommunityTransitive2OctetAsType from protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsType + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityTransitive2OctetAsType) BgpExtendedCommunityTransitive2OctetAsType + // provides marshal interface + Marshal() marshalBgpExtendedCommunityTransitive2OctetAsType + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityTransitive2OctetAsType + // validate validates BgpExtendedCommunityTransitive2OctetAsType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityTransitive2OctetAsType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum, set in BgpExtendedCommunityTransitive2OctetAsType + Choice() BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum + // setChoice assigns BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum provided by user to BgpExtendedCommunityTransitive2OctetAsType + setChoice(value BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum) BgpExtendedCommunityTransitive2OctetAsType + // HasChoice checks if Choice has been set in BgpExtendedCommunityTransitive2OctetAsType + HasChoice() bool + // RouteTargetSubtype returns BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget, set in BgpExtendedCommunityTransitive2OctetAsType. + // BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. + RouteTargetSubtype() BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + // SetRouteTargetSubtype assigns BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget provided by user to BgpExtendedCommunityTransitive2OctetAsType. + // BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. + SetRouteTargetSubtype(value BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive2OctetAsType + // HasRouteTargetSubtype checks if RouteTargetSubtype has been set in BgpExtendedCommunityTransitive2OctetAsType + HasRouteTargetSubtype() bool + // RouteOriginSubtype returns BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin, set in BgpExtendedCommunityTransitive2OctetAsType. + // BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03 . + RouteOriginSubtype() BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // SetRouteOriginSubtype assigns BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin provided by user to BgpExtendedCommunityTransitive2OctetAsType. + // BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03 . + SetRouteOriginSubtype(value BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive2OctetAsType + // HasRouteOriginSubtype checks if RouteOriginSubtype has been set in BgpExtendedCommunityTransitive2OctetAsType + HasRouteOriginSubtype() bool + setNil() +} + +type BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum string + +// Enum of Choice on BgpExtendedCommunityTransitive2OctetAsType +var BgpExtendedCommunityTransitive2OctetAsTypeChoice = struct { + ROUTE_TARGET_SUBTYPE BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum + ROUTE_ORIGIN_SUBTYPE BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum +}{ + ROUTE_TARGET_SUBTYPE: BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum("route_target_subtype"), + ROUTE_ORIGIN_SUBTYPE: BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum("route_origin_subtype"), +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsType) Choice() BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum { + return BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *bgpExtendedCommunityTransitive2OctetAsType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsType) setChoice(value BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum) BgpExtendedCommunityTransitive2OctetAsType { + intValue, ok := otg.BgpExtendedCommunityTransitive2OctetAsType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpExtendedCommunityTransitive2OctetAsType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.RouteOriginSubtype = nil + obj.routeOriginSubtypeHolder = nil + obj.obj.RouteTargetSubtype = nil + obj.routeTargetSubtypeHolder = nil + + if value == BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE { + obj.obj.RouteTargetSubtype = NewBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget().msg() + } + + if value == BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE { + obj.obj.RouteOriginSubtype = NewBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin().msg() + } + + return obj +} + +// description is TBD +// RouteTargetSubtype returns a BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget +func (obj *bgpExtendedCommunityTransitive2OctetAsType) RouteTargetSubtype() BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { + if obj.obj.RouteTargetSubtype == nil { + obj.setChoice(BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) + } + if obj.routeTargetSubtypeHolder == nil { + obj.routeTargetSubtypeHolder = &bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: obj.obj.RouteTargetSubtype} + } + return obj.routeTargetSubtypeHolder +} + +// description is TBD +// RouteTargetSubtype returns a BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget +func (obj *bgpExtendedCommunityTransitive2OctetAsType) HasRouteTargetSubtype() bool { + return obj.obj.RouteTargetSubtype != nil +} + +// description is TBD +// SetRouteTargetSubtype sets the BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget value in the BgpExtendedCommunityTransitive2OctetAsType object +func (obj *bgpExtendedCommunityTransitive2OctetAsType) SetRouteTargetSubtype(value BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive2OctetAsType { + obj.setChoice(BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) + obj.routeTargetSubtypeHolder = nil + obj.obj.RouteTargetSubtype = value.msg() + + return obj +} + +// description is TBD +// RouteOriginSubtype returns a BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin +func (obj *bgpExtendedCommunityTransitive2OctetAsType) RouteOriginSubtype() BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + if obj.obj.RouteOriginSubtype == nil { + obj.setChoice(BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) + } + if obj.routeOriginSubtypeHolder == nil { + obj.routeOriginSubtypeHolder = &bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: obj.obj.RouteOriginSubtype} + } + return obj.routeOriginSubtypeHolder +} + +// description is TBD +// RouteOriginSubtype returns a BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin +func (obj *bgpExtendedCommunityTransitive2OctetAsType) HasRouteOriginSubtype() bool { + return obj.obj.RouteOriginSubtype != nil +} + +// description is TBD +// SetRouteOriginSubtype sets the BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin value in the BgpExtendedCommunityTransitive2OctetAsType object +func (obj *bgpExtendedCommunityTransitive2OctetAsType) SetRouteOriginSubtype(value BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive2OctetAsType { + obj.setChoice(BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) + obj.routeOriginSubtypeHolder = nil + obj.obj.RouteOriginSubtype = value.msg() + + return obj +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RouteTargetSubtype != nil { + + obj.RouteTargetSubtype().validateObj(vObj, set_default) + } + + if obj.obj.RouteOriginSubtype != nil { + + obj.RouteOriginSubtype().validateObj(vObj, set_default) + } + +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsType) setDefault() { + var choices_set int = 0 + var choice BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum + + if obj.obj.RouteTargetSubtype != nil { + choices_set += 1 + choice = BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE + } + + if obj.obj.RouteOriginSubtype != nil { + choices_set += 1 + choice = BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpExtendedCommunityTransitive2OctetAsType") + } + } else { + intVal := otg.BgpExtendedCommunityTransitive2OctetAsType_Choice_Enum_value[string(choice)] + enumValue := otg.BgpExtendedCommunityTransitive2OctetAsType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_extended_community_transitive2_octet_as_type_route_origin.go b/gosnappi/bgp_extended_community_transitive2_octet_as_type_route_origin.go new file mode 100644 index 00000000..50714b68 --- /dev/null +++ b/gosnappi/bgp_extended_community_transitive2_octet_as_type_route_origin.go @@ -0,0 +1,350 @@ +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" +) + +// ***** BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin ***** +type bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin struct { + validation + obj *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + marshaller marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + unMarshaller unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin +} + +func NewBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin() BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + obj := bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: &otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) msg() *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + return obj.obj +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) setMsg(msg *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin struct { + obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin +} + +type marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin interface { + // ToProto marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin to protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + ToProto() (*otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) + // ToPbText marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin struct { + obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin +} + +type unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin interface { + // FromProto unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin from protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + FromProto(msg *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) (BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) + // FromPbText unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Marshal() marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Unmarshal() unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) ToProto() (*otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) FromProto(msg *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) (BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Clone() (BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin() + 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 +} + +// BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03 . +type BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin interface { + Validation + // msg marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin to protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // setMsg unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin from protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // provides marshal interface + Marshal() marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // validate validates BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Global2ByteAs returns uint32, set in BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin. + Global2ByteAs() uint32 + // SetGlobal2ByteAs assigns uint32 provided by user to BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + SetGlobal2ByteAs(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // HasGlobal2ByteAs checks if Global2ByteAs has been set in BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + HasGlobal2ByteAs() bool + // Local4ByteAdmin returns uint32, set in BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin. + Local4ByteAdmin() uint32 + // SetLocal4ByteAdmin assigns uint32 provided by user to BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + SetLocal4ByteAdmin(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // HasLocal4ByteAdmin checks if Local4ByteAdmin has been set in BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin + HasLocal4ByteAdmin() bool +} + +// The two octet IANA assigned AS value assigned to the Autonomous System. +// Global2ByteAs returns a uint32 +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Global2ByteAs() uint32 { + + return *obj.obj.Global_2ByteAs + +} + +// The two octet IANA assigned AS value assigned to the Autonomous System. +// Global2ByteAs returns a uint32 +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) HasGlobal2ByteAs() bool { + return obj.obj.Global_2ByteAs != nil +} + +// The two octet IANA assigned AS value assigned to the Autonomous System. +// SetGlobal2ByteAs sets the uint32 value in the BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin object +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) SetGlobal2ByteAs(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + + obj.obj.Global_2ByteAs = &value + return obj +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local4ByteAdmin returns a uint32 +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Local4ByteAdmin() uint32 { + + return *obj.obj.Local_4ByteAdmin + +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local4ByteAdmin returns a uint32 +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) HasLocal4ByteAdmin() bool { + return obj.obj.Local_4ByteAdmin != nil +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// SetLocal4ByteAdmin sets the uint32 value in the BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin object +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) SetLocal4ByteAdmin(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + + obj.obj.Local_4ByteAdmin = &value + return obj +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Global_2ByteAs != nil { + + if *obj.obj.Global_2ByteAs > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin.Global_2ByteAs <= 65535 but Got %d", *obj.obj.Global_2ByteAs)) + } + + } + +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) setDefault() { + if obj.obj.Global_2ByteAs == nil { + obj.SetGlobal2ByteAs(100) + } + if obj.obj.Local_4ByteAdmin == nil { + obj.SetLocal4ByteAdmin(1) + } + +} diff --git a/gosnappi/bgp_extended_community_transitive2_octet_as_type_route_target.go b/gosnappi/bgp_extended_community_transitive2_octet_as_type_route_target.go new file mode 100644 index 00000000..ef6226ce --- /dev/null +++ b/gosnappi/bgp_extended_community_transitive2_octet_as_type_route_target.go @@ -0,0 +1,350 @@ +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" +) + +// ***** BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget ***** +type bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget struct { + validation + obj *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + marshaller marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + unMarshaller unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget +} + +func NewBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget() BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { + obj := bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: &otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) msg() *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { + return obj.obj +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) setMsg(msg *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget struct { + obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget +} + +type marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget interface { + // ToProto marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget to protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + ToProto() (*otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) + // ToPbText marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget struct { + obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget +} + +type unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget interface { + // FromProto unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget from protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + FromProto(msg *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) (BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) + // FromPbText unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) Marshal() marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) Unmarshal() unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) ToProto() (*otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) FromProto(msg *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) (BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) Clone() (BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget() + 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 +} + +// BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. +type BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget interface { + Validation + // msg marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget to protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + // setMsg unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget from protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + // provides marshal interface + Marshal() marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + // validate validates BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Global2ByteAs returns uint32, set in BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget. + Global2ByteAs() uint32 + // SetGlobal2ByteAs assigns uint32 provided by user to BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + SetGlobal2ByteAs(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + // HasGlobal2ByteAs checks if Global2ByteAs has been set in BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + HasGlobal2ByteAs() bool + // Local4ByteAdmin returns uint32, set in BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget. + Local4ByteAdmin() uint32 + // SetLocal4ByteAdmin assigns uint32 provided by user to BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + SetLocal4ByteAdmin(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + // HasLocal4ByteAdmin checks if Local4ByteAdmin has been set in BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget + HasLocal4ByteAdmin() bool +} + +// The two octet IANA assigned AS value assigned to the Autonomous System. +// Global2ByteAs returns a uint32 +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) Global2ByteAs() uint32 { + + return *obj.obj.Global_2ByteAs + +} + +// The two octet IANA assigned AS value assigned to the Autonomous System. +// Global2ByteAs returns a uint32 +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) HasGlobal2ByteAs() bool { + return obj.obj.Global_2ByteAs != nil +} + +// The two octet IANA assigned AS value assigned to the Autonomous System. +// SetGlobal2ByteAs sets the uint32 value in the BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget object +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) SetGlobal2ByteAs(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { + + obj.obj.Global_2ByteAs = &value + return obj +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local4ByteAdmin returns a uint32 +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) Local4ByteAdmin() uint32 { + + return *obj.obj.Local_4ByteAdmin + +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local4ByteAdmin returns a uint32 +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) HasLocal4ByteAdmin() bool { + return obj.obj.Local_4ByteAdmin != nil +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// SetLocal4ByteAdmin sets the uint32 value in the BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget object +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) SetLocal4ByteAdmin(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { + + obj.obj.Local_4ByteAdmin = &value + return obj +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Global_2ByteAs != nil { + + if *obj.obj.Global_2ByteAs > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget.Global_2ByteAs <= 65535 but Got %d", *obj.obj.Global_2ByteAs)) + } + + } + +} + +func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) setDefault() { + if obj.obj.Global_2ByteAs == nil { + obj.SetGlobal2ByteAs(100) + } + if obj.obj.Local_4ByteAdmin == nil { + obj.SetLocal4ByteAdmin(1) + } + +} diff --git a/gosnappi/bgp_extended_community_transitive4_octet_as_type.go b/gosnappi/bgp_extended_community_transitive4_octet_as_type.go new file mode 100644 index 00000000..2a5ef10c --- /dev/null +++ b/gosnappi/bgp_extended_community_transitive4_octet_as_type.go @@ -0,0 +1,452 @@ +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" +) + +// ***** BgpExtendedCommunityTransitive4OctetAsType ***** +type bgpExtendedCommunityTransitive4OctetAsType struct { + validation + obj *otg.BgpExtendedCommunityTransitive4OctetAsType + marshaller marshalBgpExtendedCommunityTransitive4OctetAsType + unMarshaller unMarshalBgpExtendedCommunityTransitive4OctetAsType + routeTargetSubtypeHolder BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + routeOriginSubtypeHolder BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin +} + +func NewBgpExtendedCommunityTransitive4OctetAsType() BgpExtendedCommunityTransitive4OctetAsType { + obj := bgpExtendedCommunityTransitive4OctetAsType{obj: &otg.BgpExtendedCommunityTransitive4OctetAsType{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsType) msg() *otg.BgpExtendedCommunityTransitive4OctetAsType { + return obj.obj +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsType) setMsg(msg *otg.BgpExtendedCommunityTransitive4OctetAsType) BgpExtendedCommunityTransitive4OctetAsType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityTransitive4OctetAsType struct { + obj *bgpExtendedCommunityTransitive4OctetAsType +} + +type marshalBgpExtendedCommunityTransitive4OctetAsType interface { + // ToProto marshals BgpExtendedCommunityTransitive4OctetAsType to protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsType + ToProto() (*otg.BgpExtendedCommunityTransitive4OctetAsType, error) + // ToPbText marshals BgpExtendedCommunityTransitive4OctetAsType to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityTransitive4OctetAsType to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityTransitive4OctetAsType to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityTransitive4OctetAsType struct { + obj *bgpExtendedCommunityTransitive4OctetAsType +} + +type unMarshalBgpExtendedCommunityTransitive4OctetAsType interface { + // FromProto unmarshals BgpExtendedCommunityTransitive4OctetAsType from protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsType + FromProto(msg *otg.BgpExtendedCommunityTransitive4OctetAsType) (BgpExtendedCommunityTransitive4OctetAsType, error) + // FromPbText unmarshals BgpExtendedCommunityTransitive4OctetAsType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityTransitive4OctetAsType from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityTransitive4OctetAsType from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsType) Marshal() marshalBgpExtendedCommunityTransitive4OctetAsType { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityTransitive4OctetAsType{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsType) Unmarshal() unMarshalBgpExtendedCommunityTransitive4OctetAsType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitive4OctetAsType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityTransitive4OctetAsType) ToProto() (*otg.BgpExtendedCommunityTransitive4OctetAsType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityTransitive4OctetAsType) FromProto(msg *otg.BgpExtendedCommunityTransitive4OctetAsType) (BgpExtendedCommunityTransitive4OctetAsType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityTransitive4OctetAsType) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpExtendedCommunityTransitive4OctetAsType) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpExtendedCommunityTransitive4OctetAsType) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsType) Clone() (BgpExtendedCommunityTransitive4OctetAsType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityTransitive4OctetAsType() + 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 +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsType) setNil() { + obj.routeTargetSubtypeHolder = nil + obj.routeOriginSubtypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpExtendedCommunityTransitive4OctetAsType is the Transitive Four-Octet AS-Specific Extended Community is sent as type 0x02. It is defined in RFC 5668. +type BgpExtendedCommunityTransitive4OctetAsType interface { + Validation + // msg marshals BgpExtendedCommunityTransitive4OctetAsType to protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsType + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityTransitive4OctetAsType + // setMsg unmarshals BgpExtendedCommunityTransitive4OctetAsType from protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsType + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityTransitive4OctetAsType) BgpExtendedCommunityTransitive4OctetAsType + // provides marshal interface + Marshal() marshalBgpExtendedCommunityTransitive4OctetAsType + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityTransitive4OctetAsType + // validate validates BgpExtendedCommunityTransitive4OctetAsType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityTransitive4OctetAsType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum, set in BgpExtendedCommunityTransitive4OctetAsType + Choice() BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum + // setChoice assigns BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum provided by user to BgpExtendedCommunityTransitive4OctetAsType + setChoice(value BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum) BgpExtendedCommunityTransitive4OctetAsType + // HasChoice checks if Choice has been set in BgpExtendedCommunityTransitive4OctetAsType + HasChoice() bool + // RouteTargetSubtype returns BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget, set in BgpExtendedCommunityTransitive4OctetAsType. + // BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02 + RouteTargetSubtype() BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + // SetRouteTargetSubtype assigns BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget provided by user to BgpExtendedCommunityTransitive4OctetAsType. + // BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02 + SetRouteTargetSubtype(value BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive4OctetAsType + // HasRouteTargetSubtype checks if RouteTargetSubtype has been set in BgpExtendedCommunityTransitive4OctetAsType + HasRouteTargetSubtype() bool + // RouteOriginSubtype returns BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin, set in BgpExtendedCommunityTransitive4OctetAsType. + // BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03. + RouteOriginSubtype() BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // SetRouteOriginSubtype assigns BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin provided by user to BgpExtendedCommunityTransitive4OctetAsType. + // BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03. + SetRouteOriginSubtype(value BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive4OctetAsType + // HasRouteOriginSubtype checks if RouteOriginSubtype has been set in BgpExtendedCommunityTransitive4OctetAsType + HasRouteOriginSubtype() bool + setNil() +} + +type BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum string + +// Enum of Choice on BgpExtendedCommunityTransitive4OctetAsType +var BgpExtendedCommunityTransitive4OctetAsTypeChoice = struct { + ROUTE_TARGET_SUBTYPE BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum + ROUTE_ORIGIN_SUBTYPE BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum +}{ + ROUTE_TARGET_SUBTYPE: BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum("route_target_subtype"), + ROUTE_ORIGIN_SUBTYPE: BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum("route_origin_subtype"), +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsType) Choice() BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum { + return BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *bgpExtendedCommunityTransitive4OctetAsType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsType) setChoice(value BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum) BgpExtendedCommunityTransitive4OctetAsType { + intValue, ok := otg.BgpExtendedCommunityTransitive4OctetAsType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpExtendedCommunityTransitive4OctetAsType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.RouteOriginSubtype = nil + obj.routeOriginSubtypeHolder = nil + obj.obj.RouteTargetSubtype = nil + obj.routeTargetSubtypeHolder = nil + + if value == BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE { + obj.obj.RouteTargetSubtype = NewBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget().msg() + } + + if value == BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE { + obj.obj.RouteOriginSubtype = NewBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin().msg() + } + + return obj +} + +// description is TBD +// RouteTargetSubtype returns a BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget +func (obj *bgpExtendedCommunityTransitive4OctetAsType) RouteTargetSubtype() BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { + if obj.obj.RouteTargetSubtype == nil { + obj.setChoice(BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) + } + if obj.routeTargetSubtypeHolder == nil { + obj.routeTargetSubtypeHolder = &bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: obj.obj.RouteTargetSubtype} + } + return obj.routeTargetSubtypeHolder +} + +// description is TBD +// RouteTargetSubtype returns a BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget +func (obj *bgpExtendedCommunityTransitive4OctetAsType) HasRouteTargetSubtype() bool { + return obj.obj.RouteTargetSubtype != nil +} + +// description is TBD +// SetRouteTargetSubtype sets the BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget value in the BgpExtendedCommunityTransitive4OctetAsType object +func (obj *bgpExtendedCommunityTransitive4OctetAsType) SetRouteTargetSubtype(value BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive4OctetAsType { + obj.setChoice(BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) + obj.routeTargetSubtypeHolder = nil + obj.obj.RouteTargetSubtype = value.msg() + + return obj +} + +// description is TBD +// RouteOriginSubtype returns a BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin +func (obj *bgpExtendedCommunityTransitive4OctetAsType) RouteOriginSubtype() BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + if obj.obj.RouteOriginSubtype == nil { + obj.setChoice(BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) + } + if obj.routeOriginSubtypeHolder == nil { + obj.routeOriginSubtypeHolder = &bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: obj.obj.RouteOriginSubtype} + } + return obj.routeOriginSubtypeHolder +} + +// description is TBD +// RouteOriginSubtype returns a BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin +func (obj *bgpExtendedCommunityTransitive4OctetAsType) HasRouteOriginSubtype() bool { + return obj.obj.RouteOriginSubtype != nil +} + +// description is TBD +// SetRouteOriginSubtype sets the BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin value in the BgpExtendedCommunityTransitive4OctetAsType object +func (obj *bgpExtendedCommunityTransitive4OctetAsType) SetRouteOriginSubtype(value BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive4OctetAsType { + obj.setChoice(BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) + obj.routeOriginSubtypeHolder = nil + obj.obj.RouteOriginSubtype = value.msg() + + return obj +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RouteTargetSubtype != nil { + + obj.RouteTargetSubtype().validateObj(vObj, set_default) + } + + if obj.obj.RouteOriginSubtype != nil { + + obj.RouteOriginSubtype().validateObj(vObj, set_default) + } + +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsType) setDefault() { + var choices_set int = 0 + var choice BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum + + if obj.obj.RouteTargetSubtype != nil { + choices_set += 1 + choice = BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE + } + + if obj.obj.RouteOriginSubtype != nil { + choices_set += 1 + choice = BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpExtendedCommunityTransitive4OctetAsType") + } + } else { + intVal := otg.BgpExtendedCommunityTransitive4OctetAsType_Choice_Enum_value[string(choice)] + enumValue := otg.BgpExtendedCommunityTransitive4OctetAsType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_extended_community_transitive4_octet_as_type_route_origin.go b/gosnappi/bgp_extended_community_transitive4_octet_as_type_route_origin.go new file mode 100644 index 00000000..94ba5f15 --- /dev/null +++ b/gosnappi/bgp_extended_community_transitive4_octet_as_type_route_origin.go @@ -0,0 +1,350 @@ +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" +) + +// ***** BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin ***** +type bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin struct { + validation + obj *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + marshaller marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + unMarshaller unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin +} + +func NewBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin() BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + obj := bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: &otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) msg() *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + return obj.obj +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) setMsg(msg *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin struct { + obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin +} + +type marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin interface { + // ToProto marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin to protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + ToProto() (*otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) + // ToPbText marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin struct { + obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin +} + +type unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin interface { + // FromProto unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin from protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + FromProto(msg *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) (BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) + // FromPbText unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Marshal() marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Unmarshal() unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) ToProto() (*otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) FromProto(msg *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) (BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Clone() (BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin() + 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 +} + +// BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03. +type BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin interface { + Validation + // msg marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin to protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // setMsg unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin from protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // provides marshal interface + Marshal() marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // validate validates BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Global4ByteAs returns uint32, set in BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin. + Global4ByteAs() uint32 + // SetGlobal4ByteAs assigns uint32 provided by user to BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + SetGlobal4ByteAs(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // HasGlobal4ByteAs checks if Global4ByteAs has been set in BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + HasGlobal4ByteAs() bool + // Local2ByteAdmin returns uint32, set in BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin. + Local2ByteAdmin() uint32 + // SetLocal2ByteAdmin assigns uint32 provided by user to BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin + HasLocal2ByteAdmin() bool +} + +// The four octet IANA assigned AS value assigned to the Autonomous System. +// Global4ByteAs returns a uint32 +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Global4ByteAs() uint32 { + + return *obj.obj.Global_4ByteAs + +} + +// The four octet IANA assigned AS value assigned to the Autonomous System. +// Global4ByteAs returns a uint32 +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) HasGlobal4ByteAs() bool { + return obj.obj.Global_4ByteAs != nil +} + +// The four octet IANA assigned AS value assigned to the Autonomous System. +// SetGlobal4ByteAs sets the uint32 value in the BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin object +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) SetGlobal4ByteAs(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + + obj.obj.Global_4ByteAs = &value + return obj +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Local2ByteAdmin() uint32 { + + return *obj.obj.Local_2ByteAdmin + +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) HasLocal2ByteAdmin() bool { + return obj.obj.Local_2ByteAdmin != nil +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// SetLocal2ByteAdmin sets the uint32 value in the BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin object +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + + obj.obj.Local_2ByteAdmin = &value + return obj +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Local_2ByteAdmin != nil { + + if *obj.obj.Local_2ByteAdmin > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) + } + + } + +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) setDefault() { + if obj.obj.Global_4ByteAs == nil { + obj.SetGlobal4ByteAs(100) + } + if obj.obj.Local_2ByteAdmin == nil { + obj.SetLocal2ByteAdmin(1) + } + +} diff --git a/gosnappi/bgp_extended_community_transitive4_octet_as_type_route_target.go b/gosnappi/bgp_extended_community_transitive4_octet_as_type_route_target.go new file mode 100644 index 00000000..5cc846d3 --- /dev/null +++ b/gosnappi/bgp_extended_community_transitive4_octet_as_type_route_target.go @@ -0,0 +1,350 @@ +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" +) + +// ***** BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget ***** +type bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget struct { + validation + obj *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + marshaller marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + unMarshaller unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget +} + +func NewBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget() BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { + obj := bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: &otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) msg() *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { + return obj.obj +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) setMsg(msg *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget struct { + obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget +} + +type marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget interface { + // ToProto marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget to protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + ToProto() (*otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) + // ToPbText marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget struct { + obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget +} + +type unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget interface { + // FromProto unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget from protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + FromProto(msg *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) (BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) + // FromPbText unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) Marshal() marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) Unmarshal() unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) ToProto() (*otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) FromProto(msg *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) (BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) Clone() (BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget() + 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 +} + +// BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02 +type BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget interface { + Validation + // msg marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget to protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + // setMsg unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget from protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + // provides marshal interface + Marshal() marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + // validate validates BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Global4ByteAs returns uint32, set in BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget. + Global4ByteAs() uint32 + // SetGlobal4ByteAs assigns uint32 provided by user to BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + SetGlobal4ByteAs(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + // HasGlobal4ByteAs checks if Global4ByteAs has been set in BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + HasGlobal4ByteAs() bool + // Local2ByteAdmin returns uint32, set in BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget. + Local2ByteAdmin() uint32 + // SetLocal2ByteAdmin assigns uint32 provided by user to BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget + HasLocal2ByteAdmin() bool +} + +// The four octet IANA assigned AS value assigned to the Autonomous System. +// Global4ByteAs returns a uint32 +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) Global4ByteAs() uint32 { + + return *obj.obj.Global_4ByteAs + +} + +// The four octet IANA assigned AS value assigned to the Autonomous System. +// Global4ByteAs returns a uint32 +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) HasGlobal4ByteAs() bool { + return obj.obj.Global_4ByteAs != nil +} + +// The four octet IANA assigned AS value assigned to the Autonomous System. +// SetGlobal4ByteAs sets the uint32 value in the BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget object +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) SetGlobal4ByteAs(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { + + obj.obj.Global_4ByteAs = &value + return obj +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) Local2ByteAdmin() uint32 { + + return *obj.obj.Local_2ByteAdmin + +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) HasLocal2ByteAdmin() bool { + return obj.obj.Local_2ByteAdmin != nil +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// SetLocal2ByteAdmin sets the uint32 value in the BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget object +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { + + obj.obj.Local_2ByteAdmin = &value + return obj +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Local_2ByteAdmin != nil { + + if *obj.obj.Local_2ByteAdmin > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) + } + + } + +} + +func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) setDefault() { + if obj.obj.Global_4ByteAs == nil { + obj.SetGlobal4ByteAs(100) + } + if obj.obj.Local_2ByteAdmin == nil { + obj.SetLocal2ByteAdmin(1) + } + +} diff --git a/gosnappi/bgp_extended_community_transitive_evpn_type.go b/gosnappi/bgp_extended_community_transitive_evpn_type.go new file mode 100644 index 00000000..532d0571 --- /dev/null +++ b/gosnappi/bgp_extended_community_transitive_evpn_type.go @@ -0,0 +1,396 @@ +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" +) + +// ***** BgpExtendedCommunityTransitiveEvpnType ***** +type bgpExtendedCommunityTransitiveEvpnType struct { + validation + obj *otg.BgpExtendedCommunityTransitiveEvpnType + marshaller marshalBgpExtendedCommunityTransitiveEvpnType + unMarshaller unMarshalBgpExtendedCommunityTransitiveEvpnType + routerMacSubtypeHolder BgpExtendedCommunityTransitiveEvpnTypeRouterMac +} + +func NewBgpExtendedCommunityTransitiveEvpnType() BgpExtendedCommunityTransitiveEvpnType { + obj := bgpExtendedCommunityTransitiveEvpnType{obj: &otg.BgpExtendedCommunityTransitiveEvpnType{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityTransitiveEvpnType) msg() *otg.BgpExtendedCommunityTransitiveEvpnType { + return obj.obj +} + +func (obj *bgpExtendedCommunityTransitiveEvpnType) setMsg(msg *otg.BgpExtendedCommunityTransitiveEvpnType) BgpExtendedCommunityTransitiveEvpnType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityTransitiveEvpnType struct { + obj *bgpExtendedCommunityTransitiveEvpnType +} + +type marshalBgpExtendedCommunityTransitiveEvpnType interface { + // ToProto marshals BgpExtendedCommunityTransitiveEvpnType to protobuf object *otg.BgpExtendedCommunityTransitiveEvpnType + ToProto() (*otg.BgpExtendedCommunityTransitiveEvpnType, error) + // ToPbText marshals BgpExtendedCommunityTransitiveEvpnType to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityTransitiveEvpnType to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityTransitiveEvpnType to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityTransitiveEvpnType struct { + obj *bgpExtendedCommunityTransitiveEvpnType +} + +type unMarshalBgpExtendedCommunityTransitiveEvpnType interface { + // FromProto unmarshals BgpExtendedCommunityTransitiveEvpnType from protobuf object *otg.BgpExtendedCommunityTransitiveEvpnType + FromProto(msg *otg.BgpExtendedCommunityTransitiveEvpnType) (BgpExtendedCommunityTransitiveEvpnType, error) + // FromPbText unmarshals BgpExtendedCommunityTransitiveEvpnType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityTransitiveEvpnType from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityTransitiveEvpnType from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityTransitiveEvpnType) Marshal() marshalBgpExtendedCommunityTransitiveEvpnType { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityTransitiveEvpnType{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityTransitiveEvpnType) Unmarshal() unMarshalBgpExtendedCommunityTransitiveEvpnType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveEvpnType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityTransitiveEvpnType) ToProto() (*otg.BgpExtendedCommunityTransitiveEvpnType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityTransitiveEvpnType) FromProto(msg *otg.BgpExtendedCommunityTransitiveEvpnType) (BgpExtendedCommunityTransitiveEvpnType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityTransitiveEvpnType) 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 *unMarshalbgpExtendedCommunityTransitiveEvpnType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpExtendedCommunityTransitiveEvpnType) 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 *unMarshalbgpExtendedCommunityTransitiveEvpnType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpExtendedCommunityTransitiveEvpnType) 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 *unMarshalbgpExtendedCommunityTransitiveEvpnType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpExtendedCommunityTransitiveEvpnType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveEvpnType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveEvpnType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityTransitiveEvpnType) Clone() (BgpExtendedCommunityTransitiveEvpnType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityTransitiveEvpnType() + 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 +} + +func (obj *bgpExtendedCommunityTransitiveEvpnType) setNil() { + obj.routerMacSubtypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpExtendedCommunityTransitiveEvpnType is the Transitive EVPN Extended Community is sent as type 0x06 . +type BgpExtendedCommunityTransitiveEvpnType interface { + Validation + // msg marshals BgpExtendedCommunityTransitiveEvpnType to protobuf object *otg.BgpExtendedCommunityTransitiveEvpnType + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityTransitiveEvpnType + // setMsg unmarshals BgpExtendedCommunityTransitiveEvpnType from protobuf object *otg.BgpExtendedCommunityTransitiveEvpnType + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityTransitiveEvpnType) BgpExtendedCommunityTransitiveEvpnType + // provides marshal interface + Marshal() marshalBgpExtendedCommunityTransitiveEvpnType + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityTransitiveEvpnType + // validate validates BgpExtendedCommunityTransitiveEvpnType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityTransitiveEvpnType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum, set in BgpExtendedCommunityTransitiveEvpnType + Choice() BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum + // setChoice assigns BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum provided by user to BgpExtendedCommunityTransitiveEvpnType + setChoice(value BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum) BgpExtendedCommunityTransitiveEvpnType + // HasChoice checks if Choice has been set in BgpExtendedCommunityTransitiveEvpnType + HasChoice() bool + // RouterMacSubtype returns BgpExtendedCommunityTransitiveEvpnTypeRouterMac, set in BgpExtendedCommunityTransitiveEvpnType. + // BgpExtendedCommunityTransitiveEvpnTypeRouterMac is the Router MAC EVPN Community is defined in RFC9135 and normally sent only for EVPN Type-2 Routes . It is sent with sub-type 0x03. + RouterMacSubtype() BgpExtendedCommunityTransitiveEvpnTypeRouterMac + // SetRouterMacSubtype assigns BgpExtendedCommunityTransitiveEvpnTypeRouterMac provided by user to BgpExtendedCommunityTransitiveEvpnType. + // BgpExtendedCommunityTransitiveEvpnTypeRouterMac is the Router MAC EVPN Community is defined in RFC9135 and normally sent only for EVPN Type-2 Routes . It is sent with sub-type 0x03. + SetRouterMacSubtype(value BgpExtendedCommunityTransitiveEvpnTypeRouterMac) BgpExtendedCommunityTransitiveEvpnType + // HasRouterMacSubtype checks if RouterMacSubtype has been set in BgpExtendedCommunityTransitiveEvpnType + HasRouterMacSubtype() bool + setNil() +} + +type BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum string + +// Enum of Choice on BgpExtendedCommunityTransitiveEvpnType +var BgpExtendedCommunityTransitiveEvpnTypeChoice = struct { + ROUTER_MAC_SUBTYPE BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum +}{ + ROUTER_MAC_SUBTYPE: BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum("router_mac_subtype"), +} + +func (obj *bgpExtendedCommunityTransitiveEvpnType) Choice() BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum { + return BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *bgpExtendedCommunityTransitiveEvpnType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpExtendedCommunityTransitiveEvpnType) setChoice(value BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum) BgpExtendedCommunityTransitiveEvpnType { + intValue, ok := otg.BgpExtendedCommunityTransitiveEvpnType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpExtendedCommunityTransitiveEvpnType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.RouterMacSubtype = nil + obj.routerMacSubtypeHolder = nil + + if value == BgpExtendedCommunityTransitiveEvpnTypeChoice.ROUTER_MAC_SUBTYPE { + obj.obj.RouterMacSubtype = NewBgpExtendedCommunityTransitiveEvpnTypeRouterMac().msg() + } + + return obj +} + +// description is TBD +// RouterMacSubtype returns a BgpExtendedCommunityTransitiveEvpnTypeRouterMac +func (obj *bgpExtendedCommunityTransitiveEvpnType) RouterMacSubtype() BgpExtendedCommunityTransitiveEvpnTypeRouterMac { + if obj.obj.RouterMacSubtype == nil { + obj.setChoice(BgpExtendedCommunityTransitiveEvpnTypeChoice.ROUTER_MAC_SUBTYPE) + } + if obj.routerMacSubtypeHolder == nil { + obj.routerMacSubtypeHolder = &bgpExtendedCommunityTransitiveEvpnTypeRouterMac{obj: obj.obj.RouterMacSubtype} + } + return obj.routerMacSubtypeHolder +} + +// description is TBD +// RouterMacSubtype returns a BgpExtendedCommunityTransitiveEvpnTypeRouterMac +func (obj *bgpExtendedCommunityTransitiveEvpnType) HasRouterMacSubtype() bool { + return obj.obj.RouterMacSubtype != nil +} + +// description is TBD +// SetRouterMacSubtype sets the BgpExtendedCommunityTransitiveEvpnTypeRouterMac value in the BgpExtendedCommunityTransitiveEvpnType object +func (obj *bgpExtendedCommunityTransitiveEvpnType) SetRouterMacSubtype(value BgpExtendedCommunityTransitiveEvpnTypeRouterMac) BgpExtendedCommunityTransitiveEvpnType { + obj.setChoice(BgpExtendedCommunityTransitiveEvpnTypeChoice.ROUTER_MAC_SUBTYPE) + obj.routerMacSubtypeHolder = nil + obj.obj.RouterMacSubtype = value.msg() + + return obj +} + +func (obj *bgpExtendedCommunityTransitiveEvpnType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RouterMacSubtype != nil { + + obj.RouterMacSubtype().validateObj(vObj, set_default) + } + +} + +func (obj *bgpExtendedCommunityTransitiveEvpnType) setDefault() { + var choices_set int = 0 + var choice BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum + + if obj.obj.RouterMacSubtype != nil { + choices_set += 1 + choice = BgpExtendedCommunityTransitiveEvpnTypeChoice.ROUTER_MAC_SUBTYPE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(BgpExtendedCommunityTransitiveEvpnTypeChoice.ROUTER_MAC_SUBTYPE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpExtendedCommunityTransitiveEvpnType") + } + } else { + intVal := otg.BgpExtendedCommunityTransitiveEvpnType_Choice_Enum_value[string(choice)] + enumValue := otg.BgpExtendedCommunityTransitiveEvpnType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_extended_community_transitive_evpn_type_router_mac.go b/gosnappi/bgp_extended_community_transitive_evpn_type_router_mac.go new file mode 100644 index 00000000..6dfdd757 --- /dev/null +++ b/gosnappi/bgp_extended_community_transitive_evpn_type_router_mac.go @@ -0,0 +1,318 @@ +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" +) + +// ***** BgpExtendedCommunityTransitiveEvpnTypeRouterMac ***** +type bgpExtendedCommunityTransitiveEvpnTypeRouterMac struct { + validation + obj *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac + marshaller marshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac + unMarshaller unMarshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac +} + +func NewBgpExtendedCommunityTransitiveEvpnTypeRouterMac() BgpExtendedCommunityTransitiveEvpnTypeRouterMac { + obj := bgpExtendedCommunityTransitiveEvpnTypeRouterMac{obj: &otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) msg() *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac { + return obj.obj +} + +func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) setMsg(msg *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac) BgpExtendedCommunityTransitiveEvpnTypeRouterMac { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac struct { + obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac +} + +type marshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac interface { + // ToProto marshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac to protobuf object *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac + ToProto() (*otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac, error) + // ToPbText marshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac struct { + obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac +} + +type unMarshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac interface { + // FromProto unmarshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac from protobuf object *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac + FromProto(msg *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac) (BgpExtendedCommunityTransitiveEvpnTypeRouterMac, error) + // FromPbText unmarshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) Marshal() marshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) Unmarshal() unMarshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) ToProto() (*otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) FromProto(msg *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac) (BgpExtendedCommunityTransitiveEvpnTypeRouterMac, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) 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 *unMarshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) 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 *marshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) 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 *unMarshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) 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 *marshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) 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 *unMarshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) 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 *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) Clone() (BgpExtendedCommunityTransitiveEvpnTypeRouterMac, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityTransitiveEvpnTypeRouterMac() + 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 +} + +// BgpExtendedCommunityTransitiveEvpnTypeRouterMac is the Router MAC EVPN Community is defined in RFC9135 and normally sent only for EVPN Type-2 Routes . It is sent with sub-type 0x03. +type BgpExtendedCommunityTransitiveEvpnTypeRouterMac interface { + Validation + // msg marshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac to protobuf object *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac + // setMsg unmarshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac from protobuf object *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac) BgpExtendedCommunityTransitiveEvpnTypeRouterMac + // provides marshal interface + Marshal() marshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac + // validate validates BgpExtendedCommunityTransitiveEvpnTypeRouterMac + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityTransitiveEvpnTypeRouterMac, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RouterMac returns string, set in BgpExtendedCommunityTransitiveEvpnTypeRouterMac. + RouterMac() string + // SetRouterMac assigns string provided by user to BgpExtendedCommunityTransitiveEvpnTypeRouterMac + SetRouterMac(value string) BgpExtendedCommunityTransitiveEvpnTypeRouterMac + // HasRouterMac checks if RouterMac has been set in BgpExtendedCommunityTransitiveEvpnTypeRouterMac + HasRouterMac() bool +} + +// MAC Address of the PE Router. +// RouterMac returns a string +func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) RouterMac() string { + + return *obj.obj.RouterMac + +} + +// MAC Address of the PE Router. +// RouterMac returns a string +func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) HasRouterMac() bool { + return obj.obj.RouterMac != nil +} + +// MAC Address of the PE Router. +// SetRouterMac sets the string value in the BgpExtendedCommunityTransitiveEvpnTypeRouterMac object +func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) SetRouterMac(value string) BgpExtendedCommunityTransitiveEvpnTypeRouterMac { + + obj.obj.RouterMac = &value + return obj +} + +func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RouterMac != nil { + + err := obj.validateMac(obj.RouterMac()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpExtendedCommunityTransitiveEvpnTypeRouterMac.RouterMac")) + } + + } + +} + +func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) setDefault() { + if obj.obj.RouterMac == nil { + obj.SetRouterMac("0:0:0:0:0:0") + } + +} diff --git a/gosnappi/bgp_extended_community_transitive_ipv4_address_type.go b/gosnappi/bgp_extended_community_transitive_ipv4_address_type.go new file mode 100644 index 00000000..b76fd6d1 --- /dev/null +++ b/gosnappi/bgp_extended_community_transitive_ipv4_address_type.go @@ -0,0 +1,452 @@ +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" +) + +// ***** BgpExtendedCommunityTransitiveIpv4AddressType ***** +type bgpExtendedCommunityTransitiveIpv4AddressType struct { + validation + obj *otg.BgpExtendedCommunityTransitiveIpv4AddressType + marshaller marshalBgpExtendedCommunityTransitiveIpv4AddressType + unMarshaller unMarshalBgpExtendedCommunityTransitiveIpv4AddressType + routeTargetSubtypeHolder BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + routeOriginSubtypeHolder BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin +} + +func NewBgpExtendedCommunityTransitiveIpv4AddressType() BgpExtendedCommunityTransitiveIpv4AddressType { + obj := bgpExtendedCommunityTransitiveIpv4AddressType{obj: &otg.BgpExtendedCommunityTransitiveIpv4AddressType{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) msg() *otg.BgpExtendedCommunityTransitiveIpv4AddressType { + return obj.obj +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) setMsg(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressType) BgpExtendedCommunityTransitiveIpv4AddressType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityTransitiveIpv4AddressType struct { + obj *bgpExtendedCommunityTransitiveIpv4AddressType +} + +type marshalBgpExtendedCommunityTransitiveIpv4AddressType interface { + // ToProto marshals BgpExtendedCommunityTransitiveIpv4AddressType to protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressType + ToProto() (*otg.BgpExtendedCommunityTransitiveIpv4AddressType, error) + // ToPbText marshals BgpExtendedCommunityTransitiveIpv4AddressType to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityTransitiveIpv4AddressType to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityTransitiveIpv4AddressType to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityTransitiveIpv4AddressType struct { + obj *bgpExtendedCommunityTransitiveIpv4AddressType +} + +type unMarshalBgpExtendedCommunityTransitiveIpv4AddressType interface { + // FromProto unmarshals BgpExtendedCommunityTransitiveIpv4AddressType from protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressType + FromProto(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressType) (BgpExtendedCommunityTransitiveIpv4AddressType, error) + // FromPbText unmarshals BgpExtendedCommunityTransitiveIpv4AddressType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityTransitiveIpv4AddressType from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityTransitiveIpv4AddressType from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) Marshal() marshalBgpExtendedCommunityTransitiveIpv4AddressType { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityTransitiveIpv4AddressType{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) Unmarshal() unMarshalBgpExtendedCommunityTransitiveIpv4AddressType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveIpv4AddressType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressType) ToProto() (*otg.BgpExtendedCommunityTransitiveIpv4AddressType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityTransitiveIpv4AddressType) FromProto(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressType) (BgpExtendedCommunityTransitiveIpv4AddressType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressType) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressType) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressType) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) Clone() (BgpExtendedCommunityTransitiveIpv4AddressType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityTransitiveIpv4AddressType() + 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 +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) setNil() { + obj.routeTargetSubtypeHolder = nil + obj.routeOriginSubtypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpExtendedCommunityTransitiveIpv4AddressType is the Transitive IPv4 Address Specific Extended Community is sent as type 0x01. +type BgpExtendedCommunityTransitiveIpv4AddressType interface { + Validation + // msg marshals BgpExtendedCommunityTransitiveIpv4AddressType to protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressType + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityTransitiveIpv4AddressType + // setMsg unmarshals BgpExtendedCommunityTransitiveIpv4AddressType from protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressType + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityTransitiveIpv4AddressType) BgpExtendedCommunityTransitiveIpv4AddressType + // provides marshal interface + Marshal() marshalBgpExtendedCommunityTransitiveIpv4AddressType + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityTransitiveIpv4AddressType + // validate validates BgpExtendedCommunityTransitiveIpv4AddressType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityTransitiveIpv4AddressType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum, set in BgpExtendedCommunityTransitiveIpv4AddressType + Choice() BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum + // setChoice assigns BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum provided by user to BgpExtendedCommunityTransitiveIpv4AddressType + setChoice(value BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum) BgpExtendedCommunityTransitiveIpv4AddressType + // HasChoice checks if Choice has been set in BgpExtendedCommunityTransitiveIpv4AddressType + HasChoice() bool + // RouteTargetSubtype returns BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, set in BgpExtendedCommunityTransitiveIpv4AddressType. + // BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. + RouteTargetSubtype() BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // SetRouteTargetSubtype assigns BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget provided by user to BgpExtendedCommunityTransitiveIpv4AddressType. + // BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. + SetRouteTargetSubtype(value BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) BgpExtendedCommunityTransitiveIpv4AddressType + // HasRouteTargetSubtype checks if RouteTargetSubtype has been set in BgpExtendedCommunityTransitiveIpv4AddressType + HasRouteTargetSubtype() bool + // RouteOriginSubtype returns BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, set in BgpExtendedCommunityTransitiveIpv4AddressType. + // BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP It is sent with sub-type as 0x03. + RouteOriginSubtype() BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // SetRouteOriginSubtype assigns BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin provided by user to BgpExtendedCommunityTransitiveIpv4AddressType. + // BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP It is sent with sub-type as 0x03. + SetRouteOriginSubtype(value BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) BgpExtendedCommunityTransitiveIpv4AddressType + // HasRouteOriginSubtype checks if RouteOriginSubtype has been set in BgpExtendedCommunityTransitiveIpv4AddressType + HasRouteOriginSubtype() bool + setNil() +} + +type BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum string + +// Enum of Choice on BgpExtendedCommunityTransitiveIpv4AddressType +var BgpExtendedCommunityTransitiveIpv4AddressTypeChoice = struct { + ROUTE_TARGET_SUBTYPE BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum + ROUTE_ORIGIN_SUBTYPE BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum +}{ + ROUTE_TARGET_SUBTYPE: BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum("route_target_subtype"), + ROUTE_ORIGIN_SUBTYPE: BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum("route_origin_subtype"), +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) Choice() BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum { + return BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) setChoice(value BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum) BgpExtendedCommunityTransitiveIpv4AddressType { + intValue, ok := otg.BgpExtendedCommunityTransitiveIpv4AddressType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpExtendedCommunityTransitiveIpv4AddressType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.RouteOriginSubtype = nil + obj.routeOriginSubtypeHolder = nil + obj.obj.RouteTargetSubtype = nil + obj.routeTargetSubtypeHolder = nil + + if value == BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE { + obj.obj.RouteTargetSubtype = NewBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget().msg() + } + + if value == BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE { + obj.obj.RouteOriginSubtype = NewBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin().msg() + } + + return obj +} + +// description is TBD +// RouteTargetSubtype returns a BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) RouteTargetSubtype() BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + if obj.obj.RouteTargetSubtype == nil { + obj.setChoice(BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE) + } + if obj.routeTargetSubtypeHolder == nil { + obj.routeTargetSubtypeHolder = &bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: obj.obj.RouteTargetSubtype} + } + return obj.routeTargetSubtypeHolder +} + +// description is TBD +// RouteTargetSubtype returns a BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) HasRouteTargetSubtype() bool { + return obj.obj.RouteTargetSubtype != nil +} + +// description is TBD +// SetRouteTargetSubtype sets the BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget value in the BgpExtendedCommunityTransitiveIpv4AddressType object +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) SetRouteTargetSubtype(value BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) BgpExtendedCommunityTransitiveIpv4AddressType { + obj.setChoice(BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE) + obj.routeTargetSubtypeHolder = nil + obj.obj.RouteTargetSubtype = value.msg() + + return obj +} + +// description is TBD +// RouteOriginSubtype returns a BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) RouteOriginSubtype() BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + if obj.obj.RouteOriginSubtype == nil { + obj.setChoice(BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE) + } + if obj.routeOriginSubtypeHolder == nil { + obj.routeOriginSubtypeHolder = &bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: obj.obj.RouteOriginSubtype} + } + return obj.routeOriginSubtypeHolder +} + +// description is TBD +// RouteOriginSubtype returns a BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) HasRouteOriginSubtype() bool { + return obj.obj.RouteOriginSubtype != nil +} + +// description is TBD +// SetRouteOriginSubtype sets the BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin value in the BgpExtendedCommunityTransitiveIpv4AddressType object +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) SetRouteOriginSubtype(value BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) BgpExtendedCommunityTransitiveIpv4AddressType { + obj.setChoice(BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE) + obj.routeOriginSubtypeHolder = nil + obj.obj.RouteOriginSubtype = value.msg() + + return obj +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RouteTargetSubtype != nil { + + obj.RouteTargetSubtype().validateObj(vObj, set_default) + } + + if obj.obj.RouteOriginSubtype != nil { + + obj.RouteOriginSubtype().validateObj(vObj, set_default) + } + +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) setDefault() { + var choices_set int = 0 + var choice BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum + + if obj.obj.RouteTargetSubtype != nil { + choices_set += 1 + choice = BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE + } + + if obj.obj.RouteOriginSubtype != nil { + choices_set += 1 + choice = BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpExtendedCommunityTransitiveIpv4AddressType") + } + } else { + intVal := otg.BgpExtendedCommunityTransitiveIpv4AddressType_Choice_Enum_value[string(choice)] + enumValue := otg.BgpExtendedCommunityTransitiveIpv4AddressType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_extended_community_transitive_ipv4_address_type_route_origin.go b/gosnappi/bgp_extended_community_transitive_ipv4_address_type_route_origin.go new file mode 100644 index 00000000..16276f3d --- /dev/null +++ b/gosnappi/bgp_extended_community_transitive_ipv4_address_type_route_origin.go @@ -0,0 +1,359 @@ +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" +) + +// ***** BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin ***** +type bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin struct { + validation + obj *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + marshaller marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + unMarshaller unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin +} + +func NewBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin() BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + obj := bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: &otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) msg() *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + return obj.obj +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) setMsg(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin struct { + obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin +} + +type marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin interface { + // ToProto marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + ToProto() (*otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) + // ToPbText marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin struct { + obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin +} + +type unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin interface { + // FromProto unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + FromProto(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) + // FromPbText unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Marshal() marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Unmarshal() unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) ToProto() (*otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) FromProto(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Clone() (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin() + 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 +} + +// BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP It is sent with sub-type as 0x03. +type BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin interface { + Validation + // msg marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // setMsg unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // provides marshal interface + Marshal() marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // validate validates BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // GlobalIpv4Admin returns string, set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin. + GlobalIpv4Admin() string + // SetGlobalIpv4Admin assigns string provided by user to BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + SetGlobalIpv4Admin(value string) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // HasGlobalIpv4Admin checks if GlobalIpv4Admin has been set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + HasGlobalIpv4Admin() bool + // Local2ByteAdmin returns uint32, set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin. + Local2ByteAdmin() uint32 + // SetLocal2ByteAdmin assigns uint32 provided by user to BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + HasLocal2ByteAdmin() bool +} + +// An IPv4 unicast address assigned by one of the Internet registries. +// GlobalIpv4Admin returns a string +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) GlobalIpv4Admin() string { + + return *obj.obj.GlobalIpv4Admin + +} + +// An IPv4 unicast address assigned by one of the Internet registries. +// GlobalIpv4Admin returns a string +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) HasGlobalIpv4Admin() bool { + return obj.obj.GlobalIpv4Admin != nil +} + +// An IPv4 unicast address assigned by one of the Internet registries. +// SetGlobalIpv4Admin sets the string value in the BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin object +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) SetGlobalIpv4Admin(value string) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + + obj.obj.GlobalIpv4Admin = &value + return obj +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Local2ByteAdmin() uint32 { + + return *obj.obj.Local_2ByteAdmin + +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) HasLocal2ByteAdmin() bool { + return obj.obj.Local_2ByteAdmin != nil +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// SetLocal2ByteAdmin sets the uint32 value in the BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin object +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + + obj.obj.Local_2ByteAdmin = &value + return obj +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.GlobalIpv4Admin != nil { + + err := obj.validateIpv4(obj.GlobalIpv4Admin()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin.GlobalIpv4Admin")) + } + + } + + if obj.obj.Local_2ByteAdmin != nil { + + if *obj.obj.Local_2ByteAdmin > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) + } + + } + +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) setDefault() { + if obj.obj.GlobalIpv4Admin == nil { + obj.SetGlobalIpv4Admin("0.0.0.0") + } + if obj.obj.Local_2ByteAdmin == nil { + obj.SetLocal2ByteAdmin(1) + } + +} diff --git a/gosnappi/bgp_extended_community_transitive_ipv4_address_type_route_target.go b/gosnappi/bgp_extended_community_transitive_ipv4_address_type_route_target.go new file mode 100644 index 00000000..46ca3b1c --- /dev/null +++ b/gosnappi/bgp_extended_community_transitive_ipv4_address_type_route_target.go @@ -0,0 +1,359 @@ +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" +) + +// ***** BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget ***** +type bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget struct { + validation + obj *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + marshaller marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + unMarshaller unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget +} + +func NewBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget() BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + obj := bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: &otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) msg() *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + return obj.obj +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) setMsg(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget struct { + obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget +} + +type marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget interface { + // ToProto marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + ToProto() (*otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) + // ToPbText marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget struct { + obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget +} + +type unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget interface { + // FromProto unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + FromProto(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) + // FromPbText unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Marshal() marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Unmarshal() unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) ToProto() (*otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) FromProto(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Clone() (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget() + 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 +} + +// BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. +type BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget interface { + Validation + // msg marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // setMsg unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // provides marshal interface + Marshal() marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // validate validates BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // GlobalIpv4Admin returns string, set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget. + GlobalIpv4Admin() string + // SetGlobalIpv4Admin assigns string provided by user to BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + SetGlobalIpv4Admin(value string) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // HasGlobalIpv4Admin checks if GlobalIpv4Admin has been set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + HasGlobalIpv4Admin() bool + // Local2ByteAdmin returns uint32, set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget. + Local2ByteAdmin() uint32 + // SetLocal2ByteAdmin assigns uint32 provided by user to BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + HasLocal2ByteAdmin() bool +} + +// An IPv4 unicast address assigned by one of the Internet registries. +// GlobalIpv4Admin returns a string +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) GlobalIpv4Admin() string { + + return *obj.obj.GlobalIpv4Admin + +} + +// An IPv4 unicast address assigned by one of the Internet registries. +// GlobalIpv4Admin returns a string +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) HasGlobalIpv4Admin() bool { + return obj.obj.GlobalIpv4Admin != nil +} + +// An IPv4 unicast address assigned by one of the Internet registries. +// SetGlobalIpv4Admin sets the string value in the BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget object +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) SetGlobalIpv4Admin(value string) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + + obj.obj.GlobalIpv4Admin = &value + return obj +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Local2ByteAdmin() uint32 { + + return *obj.obj.Local_2ByteAdmin + +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) HasLocal2ByteAdmin() bool { + return obj.obj.Local_2ByteAdmin != nil +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// SetLocal2ByteAdmin sets the uint32 value in the BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget object +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + + obj.obj.Local_2ByteAdmin = &value + return obj +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.GlobalIpv4Admin != nil { + + err := obj.validateIpv4(obj.GlobalIpv4Admin()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget.GlobalIpv4Admin")) + } + + } + + if obj.obj.Local_2ByteAdmin != nil { + + if *obj.obj.Local_2ByteAdmin > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) + } + + } + +} + +func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) setDefault() { + if obj.obj.GlobalIpv4Admin == nil { + obj.SetGlobalIpv4Admin("0.0.0.0") + } + if obj.obj.Local_2ByteAdmin == nil { + obj.SetLocal2ByteAdmin(1) + } + +} diff --git a/gosnappi/bgp_extended_community_transitive_opaque_type.go b/gosnappi/bgp_extended_community_transitive_opaque_type.go new file mode 100644 index 00000000..ff619570 --- /dev/null +++ b/gosnappi/bgp_extended_community_transitive_opaque_type.go @@ -0,0 +1,452 @@ +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" +) + +// ***** BgpExtendedCommunityTransitiveOpaqueType ***** +type bgpExtendedCommunityTransitiveOpaqueType struct { + validation + obj *otg.BgpExtendedCommunityTransitiveOpaqueType + marshaller marshalBgpExtendedCommunityTransitiveOpaqueType + unMarshaller unMarshalBgpExtendedCommunityTransitiveOpaqueType + colorSubtypeHolder BgpExtendedCommunityTransitiveOpaqueTypeColor + encapsulationSubtypeHolder BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation +} + +func NewBgpExtendedCommunityTransitiveOpaqueType() BgpExtendedCommunityTransitiveOpaqueType { + obj := bgpExtendedCommunityTransitiveOpaqueType{obj: &otg.BgpExtendedCommunityTransitiveOpaqueType{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueType) msg() *otg.BgpExtendedCommunityTransitiveOpaqueType { + return obj.obj +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueType) setMsg(msg *otg.BgpExtendedCommunityTransitiveOpaqueType) BgpExtendedCommunityTransitiveOpaqueType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityTransitiveOpaqueType struct { + obj *bgpExtendedCommunityTransitiveOpaqueType +} + +type marshalBgpExtendedCommunityTransitiveOpaqueType interface { + // ToProto marshals BgpExtendedCommunityTransitiveOpaqueType to protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueType + ToProto() (*otg.BgpExtendedCommunityTransitiveOpaqueType, error) + // ToPbText marshals BgpExtendedCommunityTransitiveOpaqueType to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityTransitiveOpaqueType to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityTransitiveOpaqueType to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityTransitiveOpaqueType struct { + obj *bgpExtendedCommunityTransitiveOpaqueType +} + +type unMarshalBgpExtendedCommunityTransitiveOpaqueType interface { + // FromProto unmarshals BgpExtendedCommunityTransitiveOpaqueType from protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueType + FromProto(msg *otg.BgpExtendedCommunityTransitiveOpaqueType) (BgpExtendedCommunityTransitiveOpaqueType, error) + // FromPbText unmarshals BgpExtendedCommunityTransitiveOpaqueType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityTransitiveOpaqueType from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityTransitiveOpaqueType from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueType) Marshal() marshalBgpExtendedCommunityTransitiveOpaqueType { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityTransitiveOpaqueType{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueType) Unmarshal() unMarshalBgpExtendedCommunityTransitiveOpaqueType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveOpaqueType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityTransitiveOpaqueType) ToProto() (*otg.BgpExtendedCommunityTransitiveOpaqueType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityTransitiveOpaqueType) FromProto(msg *otg.BgpExtendedCommunityTransitiveOpaqueType) (BgpExtendedCommunityTransitiveOpaqueType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityTransitiveOpaqueType) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpExtendedCommunityTransitiveOpaqueType) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpExtendedCommunityTransitiveOpaqueType) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueType) Clone() (BgpExtendedCommunityTransitiveOpaqueType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityTransitiveOpaqueType() + 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 +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueType) setNil() { + obj.colorSubtypeHolder = nil + obj.encapsulationSubtypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpExtendedCommunityTransitiveOpaqueType is the Transitive Opaque Extended Community is sent as type 0x03. +type BgpExtendedCommunityTransitiveOpaqueType interface { + Validation + // msg marshals BgpExtendedCommunityTransitiveOpaqueType to protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueType + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityTransitiveOpaqueType + // setMsg unmarshals BgpExtendedCommunityTransitiveOpaqueType from protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueType + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityTransitiveOpaqueType) BgpExtendedCommunityTransitiveOpaqueType + // provides marshal interface + Marshal() marshalBgpExtendedCommunityTransitiveOpaqueType + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityTransitiveOpaqueType + // validate validates BgpExtendedCommunityTransitiveOpaqueType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityTransitiveOpaqueType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum, set in BgpExtendedCommunityTransitiveOpaqueType + Choice() BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum + // setChoice assigns BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum provided by user to BgpExtendedCommunityTransitiveOpaqueType + setChoice(value BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum) BgpExtendedCommunityTransitiveOpaqueType + // HasChoice checks if Choice has been set in BgpExtendedCommunityTransitiveOpaqueType + HasChoice() bool + // ColorSubtype returns BgpExtendedCommunityTransitiveOpaqueTypeColor, set in BgpExtendedCommunityTransitiveOpaqueType. + // BgpExtendedCommunityTransitiveOpaqueTypeColor is the Color Community contains locally administrator defined 'color' value which is used in conjunction with Encapsulation attribute to decide whether a data packet can be transmitted on a certain tunnel or not. It is defined in RFC9012 and sent with sub-type as 0x0b. + ColorSubtype() BgpExtendedCommunityTransitiveOpaqueTypeColor + // SetColorSubtype assigns BgpExtendedCommunityTransitiveOpaqueTypeColor provided by user to BgpExtendedCommunityTransitiveOpaqueType. + // BgpExtendedCommunityTransitiveOpaqueTypeColor is the Color Community contains locally administrator defined 'color' value which is used in conjunction with Encapsulation attribute to decide whether a data packet can be transmitted on a certain tunnel or not. It is defined in RFC9012 and sent with sub-type as 0x0b. + SetColorSubtype(value BgpExtendedCommunityTransitiveOpaqueTypeColor) BgpExtendedCommunityTransitiveOpaqueType + // HasColorSubtype checks if ColorSubtype has been set in BgpExtendedCommunityTransitiveOpaqueType + HasColorSubtype() bool + // EncapsulationSubtype returns BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation, set in BgpExtendedCommunityTransitiveOpaqueType. + // BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation is this identifies the type of tunneling technology being signalled. It is defined in RFC9012 and sent with sub-type as 0x0c. + EncapsulationSubtype() BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + // SetEncapsulationSubtype assigns BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation provided by user to BgpExtendedCommunityTransitiveOpaqueType. + // BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation is this identifies the type of tunneling technology being signalled. It is defined in RFC9012 and sent with sub-type as 0x0c. + SetEncapsulationSubtype(value BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) BgpExtendedCommunityTransitiveOpaqueType + // HasEncapsulationSubtype checks if EncapsulationSubtype has been set in BgpExtendedCommunityTransitiveOpaqueType + HasEncapsulationSubtype() bool + setNil() +} + +type BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum string + +// Enum of Choice on BgpExtendedCommunityTransitiveOpaqueType +var BgpExtendedCommunityTransitiveOpaqueTypeChoice = struct { + COLOR_SUBTYPE BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum + ENCAPSULATION_SUBTYPE BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum +}{ + COLOR_SUBTYPE: BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum("color_subtype"), + ENCAPSULATION_SUBTYPE: BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum("encapsulation_subtype"), +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueType) Choice() BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum { + return BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *bgpExtendedCommunityTransitiveOpaqueType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueType) setChoice(value BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum) BgpExtendedCommunityTransitiveOpaqueType { + intValue, ok := otg.BgpExtendedCommunityTransitiveOpaqueType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpExtendedCommunityTransitiveOpaqueType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.EncapsulationSubtype = nil + obj.encapsulationSubtypeHolder = nil + obj.obj.ColorSubtype = nil + obj.colorSubtypeHolder = nil + + if value == BgpExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE { + obj.obj.ColorSubtype = NewBgpExtendedCommunityTransitiveOpaqueTypeColor().msg() + } + + if value == BgpExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE { + obj.obj.EncapsulationSubtype = NewBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation().msg() + } + + return obj +} + +// description is TBD +// ColorSubtype returns a BgpExtendedCommunityTransitiveOpaqueTypeColor +func (obj *bgpExtendedCommunityTransitiveOpaqueType) ColorSubtype() BgpExtendedCommunityTransitiveOpaqueTypeColor { + if obj.obj.ColorSubtype == nil { + obj.setChoice(BgpExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE) + } + if obj.colorSubtypeHolder == nil { + obj.colorSubtypeHolder = &bgpExtendedCommunityTransitiveOpaqueTypeColor{obj: obj.obj.ColorSubtype} + } + return obj.colorSubtypeHolder +} + +// description is TBD +// ColorSubtype returns a BgpExtendedCommunityTransitiveOpaqueTypeColor +func (obj *bgpExtendedCommunityTransitiveOpaqueType) HasColorSubtype() bool { + return obj.obj.ColorSubtype != nil +} + +// description is TBD +// SetColorSubtype sets the BgpExtendedCommunityTransitiveOpaqueTypeColor value in the BgpExtendedCommunityTransitiveOpaqueType object +func (obj *bgpExtendedCommunityTransitiveOpaqueType) SetColorSubtype(value BgpExtendedCommunityTransitiveOpaqueTypeColor) BgpExtendedCommunityTransitiveOpaqueType { + obj.setChoice(BgpExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE) + obj.colorSubtypeHolder = nil + obj.obj.ColorSubtype = value.msg() + + return obj +} + +// description is TBD +// EncapsulationSubtype returns a BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation +func (obj *bgpExtendedCommunityTransitiveOpaqueType) EncapsulationSubtype() BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { + if obj.obj.EncapsulationSubtype == nil { + obj.setChoice(BgpExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE) + } + if obj.encapsulationSubtypeHolder == nil { + obj.encapsulationSubtypeHolder = &bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: obj.obj.EncapsulationSubtype} + } + return obj.encapsulationSubtypeHolder +} + +// description is TBD +// EncapsulationSubtype returns a BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation +func (obj *bgpExtendedCommunityTransitiveOpaqueType) HasEncapsulationSubtype() bool { + return obj.obj.EncapsulationSubtype != nil +} + +// description is TBD +// SetEncapsulationSubtype sets the BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation value in the BgpExtendedCommunityTransitiveOpaqueType object +func (obj *bgpExtendedCommunityTransitiveOpaqueType) SetEncapsulationSubtype(value BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) BgpExtendedCommunityTransitiveOpaqueType { + obj.setChoice(BgpExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE) + obj.encapsulationSubtypeHolder = nil + obj.obj.EncapsulationSubtype = value.msg() + + return obj +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.ColorSubtype != nil { + + obj.ColorSubtype().validateObj(vObj, set_default) + } + + if obj.obj.EncapsulationSubtype != nil { + + obj.EncapsulationSubtype().validateObj(vObj, set_default) + } + +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueType) setDefault() { + var choices_set int = 0 + var choice BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum + + if obj.obj.ColorSubtype != nil { + choices_set += 1 + choice = BgpExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE + } + + if obj.obj.EncapsulationSubtype != nil { + choices_set += 1 + choice = BgpExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(BgpExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpExtendedCommunityTransitiveOpaqueType") + } + } else { + intVal := otg.BgpExtendedCommunityTransitiveOpaqueType_Choice_Enum_value[string(choice)] + enumValue := otg.BgpExtendedCommunityTransitiveOpaqueType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_extended_community_transitive_opaque_type_color.go b/gosnappi/bgp_extended_community_transitive_opaque_type_color.go new file mode 100644 index 00000000..4cba0bed --- /dev/null +++ b/gosnappi/bgp_extended_community_transitive_opaque_type_color.go @@ -0,0 +1,350 @@ +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" +) + +// ***** BgpExtendedCommunityTransitiveOpaqueTypeColor ***** +type bgpExtendedCommunityTransitiveOpaqueTypeColor struct { + validation + obj *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor + marshaller marshalBgpExtendedCommunityTransitiveOpaqueTypeColor + unMarshaller unMarshalBgpExtendedCommunityTransitiveOpaqueTypeColor +} + +func NewBgpExtendedCommunityTransitiveOpaqueTypeColor() BgpExtendedCommunityTransitiveOpaqueTypeColor { + obj := bgpExtendedCommunityTransitiveOpaqueTypeColor{obj: &otg.BgpExtendedCommunityTransitiveOpaqueTypeColor{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) msg() *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor { + return obj.obj +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) setMsg(msg *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor) BgpExtendedCommunityTransitiveOpaqueTypeColor { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityTransitiveOpaqueTypeColor struct { + obj *bgpExtendedCommunityTransitiveOpaqueTypeColor +} + +type marshalBgpExtendedCommunityTransitiveOpaqueTypeColor interface { + // ToProto marshals BgpExtendedCommunityTransitiveOpaqueTypeColor to protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor + ToProto() (*otg.BgpExtendedCommunityTransitiveOpaqueTypeColor, error) + // ToPbText marshals BgpExtendedCommunityTransitiveOpaqueTypeColor to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityTransitiveOpaqueTypeColor to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityTransitiveOpaqueTypeColor to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityTransitiveOpaqueTypeColor struct { + obj *bgpExtendedCommunityTransitiveOpaqueTypeColor +} + +type unMarshalBgpExtendedCommunityTransitiveOpaqueTypeColor interface { + // FromProto unmarshals BgpExtendedCommunityTransitiveOpaqueTypeColor from protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor + FromProto(msg *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor) (BgpExtendedCommunityTransitiveOpaqueTypeColor, error) + // FromPbText unmarshals BgpExtendedCommunityTransitiveOpaqueTypeColor from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityTransitiveOpaqueTypeColor from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityTransitiveOpaqueTypeColor from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) Marshal() marshalBgpExtendedCommunityTransitiveOpaqueTypeColor { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityTransitiveOpaqueTypeColor{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) Unmarshal() unMarshalBgpExtendedCommunityTransitiveOpaqueTypeColor { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveOpaqueTypeColor{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityTransitiveOpaqueTypeColor) ToProto() (*otg.BgpExtendedCommunityTransitiveOpaqueTypeColor, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeColor) FromProto(msg *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor) (BgpExtendedCommunityTransitiveOpaqueTypeColor, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityTransitiveOpaqueTypeColor) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeColor) 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 *marshalbgpExtendedCommunityTransitiveOpaqueTypeColor) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeColor) 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 *marshalbgpExtendedCommunityTransitiveOpaqueTypeColor) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeColor) 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 *bgpExtendedCommunityTransitiveOpaqueTypeColor) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) Clone() (BgpExtendedCommunityTransitiveOpaqueTypeColor, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityTransitiveOpaqueTypeColor() + 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 +} + +// BgpExtendedCommunityTransitiveOpaqueTypeColor is the Color Community contains locally administrator defined 'color' value which is used in conjunction with Encapsulation attribute to decide whether a data packet can be transmitted on a certain tunnel or not. It is defined in RFC9012 and sent with sub-type as 0x0b. +type BgpExtendedCommunityTransitiveOpaqueTypeColor interface { + Validation + // msg marshals BgpExtendedCommunityTransitiveOpaqueTypeColor to protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor + // setMsg unmarshals BgpExtendedCommunityTransitiveOpaqueTypeColor from protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityTransitiveOpaqueTypeColor) BgpExtendedCommunityTransitiveOpaqueTypeColor + // provides marshal interface + Marshal() marshalBgpExtendedCommunityTransitiveOpaqueTypeColor + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityTransitiveOpaqueTypeColor + // validate validates BgpExtendedCommunityTransitiveOpaqueTypeColor + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityTransitiveOpaqueTypeColor, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns uint32, set in BgpExtendedCommunityTransitiveOpaqueTypeColor. + Flags() uint32 + // SetFlags assigns uint32 provided by user to BgpExtendedCommunityTransitiveOpaqueTypeColor + SetFlags(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeColor + // HasFlags checks if Flags has been set in BgpExtendedCommunityTransitiveOpaqueTypeColor + HasFlags() bool + // Color returns uint32, set in BgpExtendedCommunityTransitiveOpaqueTypeColor. + Color() uint32 + // SetColor assigns uint32 provided by user to BgpExtendedCommunityTransitiveOpaqueTypeColor + SetColor(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeColor + // HasColor checks if Color has been set in BgpExtendedCommunityTransitiveOpaqueTypeColor + HasColor() bool +} + +// Two octet flag values. +// Flags returns a uint32 +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) Flags() uint32 { + + return *obj.obj.Flags + +} + +// Two octet flag values. +// Flags returns a uint32 +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) HasFlags() bool { + return obj.obj.Flags != nil +} + +// Two octet flag values. +// SetFlags sets the uint32 value in the BgpExtendedCommunityTransitiveOpaqueTypeColor object +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) SetFlags(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeColor { + + obj.obj.Flags = &value + return obj +} + +// The color value is user defined and configured locally and used to determine whether a data packet can be transmitted on a certain tunnel or not in conjunction with the Encapsulation attribute. It is defined in RFC9012. +// Color returns a uint32 +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) Color() uint32 { + + return *obj.obj.Color + +} + +// The color value is user defined and configured locally and used to determine whether a data packet can be transmitted on a certain tunnel or not in conjunction with the Encapsulation attribute. It is defined in RFC9012. +// Color returns a uint32 +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) HasColor() bool { + return obj.obj.Color != nil +} + +// The color value is user defined and configured locally and used to determine whether a data packet can be transmitted on a certain tunnel or not in conjunction with the Encapsulation attribute. It is defined in RFC9012. +// SetColor sets the uint32 value in the BgpExtendedCommunityTransitiveOpaqueTypeColor object +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) SetColor(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeColor { + + obj.obj.Color = &value + return obj +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + if *obj.obj.Flags > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpExtendedCommunityTransitiveOpaqueTypeColor.Flags <= 65535 but Got %d", *obj.obj.Flags)) + } + + } + +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) setDefault() { + if obj.obj.Flags == nil { + obj.SetFlags(0) + } + if obj.obj.Color == nil { + obj.SetColor(0) + } + +} diff --git a/gosnappi/bgp_extended_community_transitive_opaque_type_encapsulation.go b/gosnappi/bgp_extended_community_transitive_opaque_type_encapsulation.go new file mode 100644 index 00000000..469b2e55 --- /dev/null +++ b/gosnappi/bgp_extended_community_transitive_opaque_type_encapsulation.go @@ -0,0 +1,371 @@ +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" +) + +// ***** BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation ***** +type bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation struct { + validation + obj *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + marshaller marshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + unMarshaller unMarshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation +} + +func NewBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation() BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { + obj := bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: &otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation{}} + obj.setDefault() + return &obj +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) msg() *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { + return obj.obj +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) setMsg(msg *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation struct { + obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation +} + +type marshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation interface { + // ToProto marshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation to protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + ToProto() (*otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) + // ToPbText marshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation to YAML text + ToYaml() (string, error) + // ToJson marshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation to JSON text + ToJson() (string, error) +} + +type unMarshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation struct { + obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation +} + +type unMarshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation interface { + // FromProto unmarshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation from protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + FromProto(msg *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) (BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) + // FromPbText unmarshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation from JSON text + FromJson(value string) error +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) Marshal() marshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) Unmarshal() unMarshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) ToProto() (*otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) FromProto(msg *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) (BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *marshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *marshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) Clone() (BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation() + 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 +} + +// BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation is this identifies the type of tunneling technology being signalled. It is defined in RFC9012 and sent with sub-type as 0x0c. +type BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation interface { + Validation + // msg marshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation to protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + // and doesn't set defaults + msg() *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + // setMsg unmarshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation from protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + // and doesn't set defaults + setMsg(*otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + // provides marshal interface + Marshal() marshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + // provides unmarshal interface + Unmarshal() unMarshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + // validate validates BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Reserved returns uint32, set in BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation. + Reserved() uint32 + // SetReserved assigns uint32 provided by user to BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + SetReserved(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + // HasReserved checks if Reserved has been set in BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + HasReserved() bool + // TunnelType returns uint32, set in BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation. + TunnelType() uint32 + // SetTunnelType assigns uint32 provided by user to BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + SetTunnelType(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + // HasTunnelType checks if TunnelType has been set in BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation + HasTunnelType() bool +} + +// Four bytes of reserved values. Normally set to 0 on transmit and ignored on receive. +// Reserved returns a uint32 +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) Reserved() uint32 { + + return *obj.obj.Reserved + +} + +// Four bytes of reserved values. Normally set to 0 on transmit and ignored on receive. +// Reserved returns a uint32 +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) HasReserved() bool { + return obj.obj.Reserved != nil +} + +// Four bytes of reserved values. Normally set to 0 on transmit and ignored on receive. +// SetReserved sets the uint32 value in the BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation object +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) SetReserved(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { + + obj.obj.Reserved = &value + return obj +} + +// Identifies the type of tunneling technology being signalled. Initially defined in RFC5512 and extended in RFC9012. Some of the important tunnel types include 1 L2TPv3 over IP [RFC9012], +// 2 GRE [RFC9012] +// 7 IP in IP [RFC9012] +// 8 VXLAN Encapsulation [RFC8365] +// 9 NVGRE Encapsulation [RFC8365] +// 10 MPLS Encapsulation [RFC8365] +// 15 SR TE Policy Type [draft-ietf-idr-segment-routing-te-policy] +// 19 Geneve Encapsulation [RFC8926] +// TunnelType returns a uint32 +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) TunnelType() uint32 { + + return *obj.obj.TunnelType + +} + +// Identifies the type of tunneling technology being signalled. Initially defined in RFC5512 and extended in RFC9012. Some of the important tunnel types include 1 L2TPv3 over IP [RFC9012], +// 2 GRE [RFC9012] +// 7 IP in IP [RFC9012] +// 8 VXLAN Encapsulation [RFC8365] +// 9 NVGRE Encapsulation [RFC8365] +// 10 MPLS Encapsulation [RFC8365] +// 15 SR TE Policy Type [draft-ietf-idr-segment-routing-te-policy] +// 19 Geneve Encapsulation [RFC8926] +// TunnelType returns a uint32 +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) HasTunnelType() bool { + return obj.obj.TunnelType != nil +} + +// Identifies the type of tunneling technology being signalled. Initially defined in RFC5512 and extended in RFC9012. Some of the important tunnel types include 1 L2TPv3 over IP [RFC9012], +// 2 GRE [RFC9012] +// 7 IP in IP [RFC9012] +// 8 VXLAN Encapsulation [RFC8365] +// 9 NVGRE Encapsulation [RFC8365] +// 10 MPLS Encapsulation [RFC8365] +// 15 SR TE Policy Type [draft-ietf-idr-segment-routing-te-policy] +// 19 Geneve Encapsulation [RFC8926] +// SetTunnelType sets the uint32 value in the BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation object +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) SetTunnelType(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { + + obj.obj.TunnelType = &value + return obj +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.TunnelType != nil { + + if *obj.obj.TunnelType > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation.TunnelType <= 65535 but Got %d", *obj.obj.TunnelType)) + } + + } + +} + +func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) setDefault() { + if obj.obj.Reserved == nil { + obj.SetReserved(0) + } + if obj.obj.TunnelType == nil { + obj.SetTunnelType(1) + } + +} diff --git a/gosnappi/bgp_graceful_restart.go b/gosnappi/bgp_graceful_restart.go new file mode 100644 index 00000000..6afef5ab --- /dev/null +++ b/gosnappi/bgp_graceful_restart.go @@ -0,0 +1,437 @@ +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" +) + +// ***** BgpGracefulRestart ***** +type bgpGracefulRestart struct { + validation + obj *otg.BgpGracefulRestart + marshaller marshalBgpGracefulRestart + unMarshaller unMarshalBgpGracefulRestart +} + +func NewBgpGracefulRestart() BgpGracefulRestart { + obj := bgpGracefulRestart{obj: &otg.BgpGracefulRestart{}} + obj.setDefault() + return &obj +} + +func (obj *bgpGracefulRestart) msg() *otg.BgpGracefulRestart { + return obj.obj +} + +func (obj *bgpGracefulRestart) setMsg(msg *otg.BgpGracefulRestart) BgpGracefulRestart { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpGracefulRestart struct { + obj *bgpGracefulRestart +} + +type marshalBgpGracefulRestart interface { + // ToProto marshals BgpGracefulRestart to protobuf object *otg.BgpGracefulRestart + ToProto() (*otg.BgpGracefulRestart, error) + // ToPbText marshals BgpGracefulRestart to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpGracefulRestart to YAML text + ToYaml() (string, error) + // ToJson marshals BgpGracefulRestart to JSON text + ToJson() (string, error) +} + +type unMarshalbgpGracefulRestart struct { + obj *bgpGracefulRestart +} + +type unMarshalBgpGracefulRestart interface { + // FromProto unmarshals BgpGracefulRestart from protobuf object *otg.BgpGracefulRestart + FromProto(msg *otg.BgpGracefulRestart) (BgpGracefulRestart, error) + // FromPbText unmarshals BgpGracefulRestart from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpGracefulRestart from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpGracefulRestart from JSON text + FromJson(value string) error +} + +func (obj *bgpGracefulRestart) Marshal() marshalBgpGracefulRestart { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpGracefulRestart{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpGracefulRestart) Unmarshal() unMarshalBgpGracefulRestart { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpGracefulRestart{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpGracefulRestart) ToProto() (*otg.BgpGracefulRestart, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpGracefulRestart) FromProto(msg *otg.BgpGracefulRestart) (BgpGracefulRestart, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpGracefulRestart) 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 *unMarshalbgpGracefulRestart) 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 *marshalbgpGracefulRestart) 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 *unMarshalbgpGracefulRestart) 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 *marshalbgpGracefulRestart) 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 *unMarshalbgpGracefulRestart) 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 *bgpGracefulRestart) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpGracefulRestart) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpGracefulRestart) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpGracefulRestart) Clone() (BgpGracefulRestart, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpGracefulRestart() + 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 +} + +// BgpGracefulRestart is the Graceful Restart Capability (RFC 4724) is a BGP capability that can be used by a BGP speaker to indicate its ability to preserve its forwarding state during BGP restart. The Graceful Restart (GR) capability is advertised in OPEN messages sent between BGP peers. After a BGP session has been established, and the initial routing update has been completed, an End-of-RIB (Routing Information Base) marker is sent in an UPDATE message to convey information about routing convergence. +type BgpGracefulRestart interface { + Validation + // msg marshals BgpGracefulRestart to protobuf object *otg.BgpGracefulRestart + // and doesn't set defaults + msg() *otg.BgpGracefulRestart + // setMsg unmarshals BgpGracefulRestart from protobuf object *otg.BgpGracefulRestart + // and doesn't set defaults + setMsg(*otg.BgpGracefulRestart) BgpGracefulRestart + // provides marshal interface + Marshal() marshalBgpGracefulRestart + // provides unmarshal interface + Unmarshal() unMarshalBgpGracefulRestart + // validate validates BgpGracefulRestart + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpGracefulRestart, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // EnableGr returns bool, set in BgpGracefulRestart. + EnableGr() bool + // SetEnableGr assigns bool provided by user to BgpGracefulRestart + SetEnableGr(value bool) BgpGracefulRestart + // HasEnableGr checks if EnableGr has been set in BgpGracefulRestart + HasEnableGr() bool + // RestartTime returns uint32, set in BgpGracefulRestart. + RestartTime() uint32 + // SetRestartTime assigns uint32 provided by user to BgpGracefulRestart + SetRestartTime(value uint32) BgpGracefulRestart + // HasRestartTime checks if RestartTime has been set in BgpGracefulRestart + HasRestartTime() bool + // EnableLlgr returns bool, set in BgpGracefulRestart. + EnableLlgr() bool + // SetEnableLlgr assigns bool provided by user to BgpGracefulRestart + SetEnableLlgr(value bool) BgpGracefulRestart + // HasEnableLlgr checks if EnableLlgr has been set in BgpGracefulRestart + HasEnableLlgr() bool + // StaleTime returns uint32, set in BgpGracefulRestart. + StaleTime() uint32 + // SetStaleTime assigns uint32 provided by user to BgpGracefulRestart + SetStaleTime(value uint32) BgpGracefulRestart + // HasStaleTime checks if StaleTime has been set in BgpGracefulRestart + HasStaleTime() bool +} + +// If enabled, Graceful Restart capability is advertised in BGP OPEN messages. +// EnableGr returns a bool +func (obj *bgpGracefulRestart) EnableGr() bool { + + return *obj.obj.EnableGr + +} + +// If enabled, Graceful Restart capability is advertised in BGP OPEN messages. +// EnableGr returns a bool +func (obj *bgpGracefulRestart) HasEnableGr() bool { + return obj.obj.EnableGr != nil +} + +// If enabled, Graceful Restart capability is advertised in BGP OPEN messages. +// SetEnableGr sets the bool value in the BgpGracefulRestart object +func (obj *bgpGracefulRestart) SetEnableGr(value bool) BgpGracefulRestart { + + obj.obj.EnableGr = &value + return obj +} + +// This is the estimated duration (in seconds) it will take for the BGP session to be re-established after a restart. This can be used to speed up routing convergence by its peer in case the BGP speaker does not come back after a restart. +// RestartTime returns a uint32 +func (obj *bgpGracefulRestart) RestartTime() uint32 { + + return *obj.obj.RestartTime + +} + +// This is the estimated duration (in seconds) it will take for the BGP session to be re-established after a restart. This can be used to speed up routing convergence by its peer in case the BGP speaker does not come back after a restart. +// RestartTime returns a uint32 +func (obj *bgpGracefulRestart) HasRestartTime() bool { + return obj.obj.RestartTime != nil +} + +// This is the estimated duration (in seconds) it will take for the BGP session to be re-established after a restart. This can be used to speed up routing convergence by its peer in case the BGP speaker does not come back after a restart. +// SetRestartTime sets the uint32 value in the BgpGracefulRestart object +func (obj *bgpGracefulRestart) SetRestartTime(value uint32) BgpGracefulRestart { + + obj.obj.RestartTime = &value + return obj +} + +// If enabled, the "Long-lived Graceful Restart Capability", or "LLGR Capability" +// will be advertised. +// This capability MUST be advertised in conjunction with the Graceful Restart +// capability. +// EnableLlgr returns a bool +func (obj *bgpGracefulRestart) EnableLlgr() bool { + + return *obj.obj.EnableLlgr + +} + +// If enabled, the "Long-lived Graceful Restart Capability", or "LLGR Capability" +// will be advertised. +// This capability MUST be advertised in conjunction with the Graceful Restart +// capability. +// EnableLlgr returns a bool +func (obj *bgpGracefulRestart) HasEnableLlgr() bool { + return obj.obj.EnableLlgr != nil +} + +// If enabled, the "Long-lived Graceful Restart Capability", or "LLGR Capability" +// will be advertised. +// This capability MUST be advertised in conjunction with the Graceful Restart +// capability. +// SetEnableLlgr sets the bool value in the BgpGracefulRestart object +func (obj *bgpGracefulRestart) SetEnableLlgr(value bool) BgpGracefulRestart { + + obj.obj.EnableLlgr = &value + return obj +} + +// Duration (in seconds) specifying how long stale information (for the AFI/SAFI) +// may be retained. This is a three byte field and is applicable +// only if 'enable_llgr' is set to 'true'. +// StaleTime returns a uint32 +func (obj *bgpGracefulRestart) StaleTime() uint32 { + + return *obj.obj.StaleTime + +} + +// Duration (in seconds) specifying how long stale information (for the AFI/SAFI) +// may be retained. This is a three byte field and is applicable +// only if 'enable_llgr' is set to 'true'. +// StaleTime returns a uint32 +func (obj *bgpGracefulRestart) HasStaleTime() bool { + return obj.obj.StaleTime != nil +} + +// Duration (in seconds) specifying how long stale information (for the AFI/SAFI) +// may be retained. This is a three byte field and is applicable +// only if 'enable_llgr' is set to 'true'. +// SetStaleTime sets the uint32 value in the BgpGracefulRestart object +func (obj *bgpGracefulRestart) SetStaleTime(value uint32) BgpGracefulRestart { + + obj.obj.StaleTime = &value + return obj +} + +func (obj *bgpGracefulRestart) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RestartTime != nil { + + if *obj.obj.RestartTime > 4096 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpGracefulRestart.RestartTime <= 4096 but Got %d", *obj.obj.RestartTime)) + } + + } + + if obj.obj.StaleTime != nil { + + if *obj.obj.StaleTime > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpGracefulRestart.StaleTime <= 16777215 but Got %d", *obj.obj.StaleTime)) + } + + } + +} + +func (obj *bgpGracefulRestart) setDefault() { + if obj.obj.EnableGr == nil { + obj.SetEnableGr(false) + } + if obj.obj.RestartTime == nil { + obj.SetRestartTime(45) + } + if obj.obj.EnableLlgr == nil { + obj.SetEnableLlgr(false) + } + if obj.obj.StaleTime == nil { + obj.SetStaleTime(10) + } + +} diff --git a/gosnappi/bgp_ipv4_sr_policy_nlri_prefix.go b/gosnappi/bgp_ipv4_sr_policy_nlri_prefix.go new file mode 100644 index 00000000..134dd57a --- /dev/null +++ b/gosnappi/bgp_ipv4_sr_policy_nlri_prefix.go @@ -0,0 +1,380 @@ +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" +) + +// ***** BgpIpv4SrPolicyNLRIPrefix ***** +type bgpIpv4SrPolicyNLRIPrefix struct { + validation + obj *otg.BgpIpv4SrPolicyNLRIPrefix + marshaller marshalBgpIpv4SrPolicyNLRIPrefix + unMarshaller unMarshalBgpIpv4SrPolicyNLRIPrefix +} + +func NewBgpIpv4SrPolicyNLRIPrefix() BgpIpv4SrPolicyNLRIPrefix { + obj := bgpIpv4SrPolicyNLRIPrefix{obj: &otg.BgpIpv4SrPolicyNLRIPrefix{}} + obj.setDefault() + return &obj +} + +func (obj *bgpIpv4SrPolicyNLRIPrefix) msg() *otg.BgpIpv4SrPolicyNLRIPrefix { + return obj.obj +} + +func (obj *bgpIpv4SrPolicyNLRIPrefix) setMsg(msg *otg.BgpIpv4SrPolicyNLRIPrefix) BgpIpv4SrPolicyNLRIPrefix { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpIpv4SrPolicyNLRIPrefix struct { + obj *bgpIpv4SrPolicyNLRIPrefix +} + +type marshalBgpIpv4SrPolicyNLRIPrefix interface { + // ToProto marshals BgpIpv4SrPolicyNLRIPrefix to protobuf object *otg.BgpIpv4SrPolicyNLRIPrefix + ToProto() (*otg.BgpIpv4SrPolicyNLRIPrefix, error) + // ToPbText marshals BgpIpv4SrPolicyNLRIPrefix to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpIpv4SrPolicyNLRIPrefix to YAML text + ToYaml() (string, error) + // ToJson marshals BgpIpv4SrPolicyNLRIPrefix to JSON text + ToJson() (string, error) +} + +type unMarshalbgpIpv4SrPolicyNLRIPrefix struct { + obj *bgpIpv4SrPolicyNLRIPrefix +} + +type unMarshalBgpIpv4SrPolicyNLRIPrefix interface { + // FromProto unmarshals BgpIpv4SrPolicyNLRIPrefix from protobuf object *otg.BgpIpv4SrPolicyNLRIPrefix + FromProto(msg *otg.BgpIpv4SrPolicyNLRIPrefix) (BgpIpv4SrPolicyNLRIPrefix, error) + // FromPbText unmarshals BgpIpv4SrPolicyNLRIPrefix from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpIpv4SrPolicyNLRIPrefix from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpIpv4SrPolicyNLRIPrefix from JSON text + FromJson(value string) error +} + +func (obj *bgpIpv4SrPolicyNLRIPrefix) Marshal() marshalBgpIpv4SrPolicyNLRIPrefix { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpIpv4SrPolicyNLRIPrefix{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpIpv4SrPolicyNLRIPrefix) Unmarshal() unMarshalBgpIpv4SrPolicyNLRIPrefix { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpIpv4SrPolicyNLRIPrefix{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpIpv4SrPolicyNLRIPrefix) ToProto() (*otg.BgpIpv4SrPolicyNLRIPrefix, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpIpv4SrPolicyNLRIPrefix) FromProto(msg *otg.BgpIpv4SrPolicyNLRIPrefix) (BgpIpv4SrPolicyNLRIPrefix, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpIpv4SrPolicyNLRIPrefix) 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 *unMarshalbgpIpv4SrPolicyNLRIPrefix) 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 *marshalbgpIpv4SrPolicyNLRIPrefix) 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 *unMarshalbgpIpv4SrPolicyNLRIPrefix) 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 *marshalbgpIpv4SrPolicyNLRIPrefix) 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 *unMarshalbgpIpv4SrPolicyNLRIPrefix) 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 *bgpIpv4SrPolicyNLRIPrefix) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpIpv4SrPolicyNLRIPrefix) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpIpv4SrPolicyNLRIPrefix) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpIpv4SrPolicyNLRIPrefix) Clone() (BgpIpv4SrPolicyNLRIPrefix, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpIpv4SrPolicyNLRIPrefix() + 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 +} + +// BgpIpv4SrPolicyNLRIPrefix is iPv4 Segment Routing Policy NLRI Prefix. +type BgpIpv4SrPolicyNLRIPrefix interface { + Validation + // msg marshals BgpIpv4SrPolicyNLRIPrefix to protobuf object *otg.BgpIpv4SrPolicyNLRIPrefix + // and doesn't set defaults + msg() *otg.BgpIpv4SrPolicyNLRIPrefix + // setMsg unmarshals BgpIpv4SrPolicyNLRIPrefix from protobuf object *otg.BgpIpv4SrPolicyNLRIPrefix + // and doesn't set defaults + setMsg(*otg.BgpIpv4SrPolicyNLRIPrefix) BgpIpv4SrPolicyNLRIPrefix + // provides marshal interface + Marshal() marshalBgpIpv4SrPolicyNLRIPrefix + // provides unmarshal interface + Unmarshal() unMarshalBgpIpv4SrPolicyNLRIPrefix + // validate validates BgpIpv4SrPolicyNLRIPrefix + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpIpv4SrPolicyNLRIPrefix, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Distinguisher returns uint32, set in BgpIpv4SrPolicyNLRIPrefix. + Distinguisher() uint32 + // SetDistinguisher assigns uint32 provided by user to BgpIpv4SrPolicyNLRIPrefix + SetDistinguisher(value uint32) BgpIpv4SrPolicyNLRIPrefix + // HasDistinguisher checks if Distinguisher has been set in BgpIpv4SrPolicyNLRIPrefix + HasDistinguisher() bool + // Color returns uint32, set in BgpIpv4SrPolicyNLRIPrefix. + Color() uint32 + // SetColor assigns uint32 provided by user to BgpIpv4SrPolicyNLRIPrefix + SetColor(value uint32) BgpIpv4SrPolicyNLRIPrefix + // HasColor checks if Color has been set in BgpIpv4SrPolicyNLRIPrefix + HasColor() bool + // Endpoint returns string, set in BgpIpv4SrPolicyNLRIPrefix. + Endpoint() string + // SetEndpoint assigns string provided by user to BgpIpv4SrPolicyNLRIPrefix + SetEndpoint(value string) BgpIpv4SrPolicyNLRIPrefix + // HasEndpoint checks if Endpoint has been set in BgpIpv4SrPolicyNLRIPrefix + HasEndpoint() bool +} + +// The 4-octet value uniquely identifying the policy in the context of tuple. The distinguisher has no semantic value and is solely used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment lists) with the same Color and Endpoint but meant for different headends. +// Distinguisher returns a uint32 +func (obj *bgpIpv4SrPolicyNLRIPrefix) Distinguisher() uint32 { + + return *obj.obj.Distinguisher + +} + +// The 4-octet value uniquely identifying the policy in the context of tuple. The distinguisher has no semantic value and is solely used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment lists) with the same Color and Endpoint but meant for different headends. +// Distinguisher returns a uint32 +func (obj *bgpIpv4SrPolicyNLRIPrefix) HasDistinguisher() bool { + return obj.obj.Distinguisher != nil +} + +// The 4-octet value uniquely identifying the policy in the context of tuple. The distinguisher has no semantic value and is solely used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment lists) with the same Color and Endpoint but meant for different headends. +// SetDistinguisher sets the uint32 value in the BgpIpv4SrPolicyNLRIPrefix object +func (obj *bgpIpv4SrPolicyNLRIPrefix) SetDistinguisher(value uint32) BgpIpv4SrPolicyNLRIPrefix { + + obj.obj.Distinguisher = &value + return obj +} + +// 4-octet value identifying (with the endpoint) the policy. The color is used to match the color of the destination prefixes to steer traffic into the SR Policy as specified in section 8 of RFC9256. +// Color returns a uint32 +func (obj *bgpIpv4SrPolicyNLRIPrefix) Color() uint32 { + + return *obj.obj.Color + +} + +// 4-octet value identifying (with the endpoint) the policy. The color is used to match the color of the destination prefixes to steer traffic into the SR Policy as specified in section 8 of RFC9256. +// Color returns a uint32 +func (obj *bgpIpv4SrPolicyNLRIPrefix) HasColor() bool { + return obj.obj.Color != nil +} + +// 4-octet value identifying (with the endpoint) the policy. The color is used to match the color of the destination prefixes to steer traffic into the SR Policy as specified in section 8 of RFC9256. +// SetColor sets the uint32 value in the BgpIpv4SrPolicyNLRIPrefix object +func (obj *bgpIpv4SrPolicyNLRIPrefix) SetColor(value uint32) BgpIpv4SrPolicyNLRIPrefix { + + obj.obj.Color = &value + return obj +} + +// Identifies the endpoint of a policy. The Endpoint is an IPv4 address and can be either a unicast or an unspecified address (0.0.0.0) as specified in section 2.1 of RFC9256. +// Endpoint returns a string +func (obj *bgpIpv4SrPolicyNLRIPrefix) Endpoint() string { + + return *obj.obj.Endpoint + +} + +// Identifies the endpoint of a policy. The Endpoint is an IPv4 address and can be either a unicast or an unspecified address (0.0.0.0) as specified in section 2.1 of RFC9256. +// Endpoint returns a string +func (obj *bgpIpv4SrPolicyNLRIPrefix) HasEndpoint() bool { + return obj.obj.Endpoint != nil +} + +// Identifies the endpoint of a policy. The Endpoint is an IPv4 address and can be either a unicast or an unspecified address (0.0.0.0) as specified in section 2.1 of RFC9256. +// SetEndpoint sets the string value in the BgpIpv4SrPolicyNLRIPrefix object +func (obj *bgpIpv4SrPolicyNLRIPrefix) SetEndpoint(value string) BgpIpv4SrPolicyNLRIPrefix { + + obj.obj.Endpoint = &value + return obj +} + +func (obj *bgpIpv4SrPolicyNLRIPrefix) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Endpoint != nil { + + err := obj.validateIpv4(obj.Endpoint()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpIpv4SrPolicyNLRIPrefix.Endpoint")) + } + + } + +} + +func (obj *bgpIpv4SrPolicyNLRIPrefix) setDefault() { + if obj.obj.Distinguisher == nil { + obj.SetDistinguisher(1) + } + if obj.obj.Color == nil { + obj.SetColor(1) + } + if obj.obj.Endpoint == nil { + obj.SetEndpoint("0.0.0.0") + } + +} diff --git a/gosnappi/bgp_ipv6_sr_policy_nlri_prefix.go b/gosnappi/bgp_ipv6_sr_policy_nlri_prefix.go new file mode 100644 index 00000000..4e59c41c --- /dev/null +++ b/gosnappi/bgp_ipv6_sr_policy_nlri_prefix.go @@ -0,0 +1,380 @@ +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" +) + +// ***** BgpIpv6SrPolicyNLRIPrefix ***** +type bgpIpv6SrPolicyNLRIPrefix struct { + validation + obj *otg.BgpIpv6SrPolicyNLRIPrefix + marshaller marshalBgpIpv6SrPolicyNLRIPrefix + unMarshaller unMarshalBgpIpv6SrPolicyNLRIPrefix +} + +func NewBgpIpv6SrPolicyNLRIPrefix() BgpIpv6SrPolicyNLRIPrefix { + obj := bgpIpv6SrPolicyNLRIPrefix{obj: &otg.BgpIpv6SrPolicyNLRIPrefix{}} + obj.setDefault() + return &obj +} + +func (obj *bgpIpv6SrPolicyNLRIPrefix) msg() *otg.BgpIpv6SrPolicyNLRIPrefix { + return obj.obj +} + +func (obj *bgpIpv6SrPolicyNLRIPrefix) setMsg(msg *otg.BgpIpv6SrPolicyNLRIPrefix) BgpIpv6SrPolicyNLRIPrefix { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpIpv6SrPolicyNLRIPrefix struct { + obj *bgpIpv6SrPolicyNLRIPrefix +} + +type marshalBgpIpv6SrPolicyNLRIPrefix interface { + // ToProto marshals BgpIpv6SrPolicyNLRIPrefix to protobuf object *otg.BgpIpv6SrPolicyNLRIPrefix + ToProto() (*otg.BgpIpv6SrPolicyNLRIPrefix, error) + // ToPbText marshals BgpIpv6SrPolicyNLRIPrefix to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpIpv6SrPolicyNLRIPrefix to YAML text + ToYaml() (string, error) + // ToJson marshals BgpIpv6SrPolicyNLRIPrefix to JSON text + ToJson() (string, error) +} + +type unMarshalbgpIpv6SrPolicyNLRIPrefix struct { + obj *bgpIpv6SrPolicyNLRIPrefix +} + +type unMarshalBgpIpv6SrPolicyNLRIPrefix interface { + // FromProto unmarshals BgpIpv6SrPolicyNLRIPrefix from protobuf object *otg.BgpIpv6SrPolicyNLRIPrefix + FromProto(msg *otg.BgpIpv6SrPolicyNLRIPrefix) (BgpIpv6SrPolicyNLRIPrefix, error) + // FromPbText unmarshals BgpIpv6SrPolicyNLRIPrefix from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpIpv6SrPolicyNLRIPrefix from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpIpv6SrPolicyNLRIPrefix from JSON text + FromJson(value string) error +} + +func (obj *bgpIpv6SrPolicyNLRIPrefix) Marshal() marshalBgpIpv6SrPolicyNLRIPrefix { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpIpv6SrPolicyNLRIPrefix{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpIpv6SrPolicyNLRIPrefix) Unmarshal() unMarshalBgpIpv6SrPolicyNLRIPrefix { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpIpv6SrPolicyNLRIPrefix{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpIpv6SrPolicyNLRIPrefix) ToProto() (*otg.BgpIpv6SrPolicyNLRIPrefix, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpIpv6SrPolicyNLRIPrefix) FromProto(msg *otg.BgpIpv6SrPolicyNLRIPrefix) (BgpIpv6SrPolicyNLRIPrefix, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpIpv6SrPolicyNLRIPrefix) 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 *unMarshalbgpIpv6SrPolicyNLRIPrefix) 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 *marshalbgpIpv6SrPolicyNLRIPrefix) 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 *unMarshalbgpIpv6SrPolicyNLRIPrefix) 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 *marshalbgpIpv6SrPolicyNLRIPrefix) 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 *unMarshalbgpIpv6SrPolicyNLRIPrefix) 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 *bgpIpv6SrPolicyNLRIPrefix) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpIpv6SrPolicyNLRIPrefix) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpIpv6SrPolicyNLRIPrefix) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpIpv6SrPolicyNLRIPrefix) Clone() (BgpIpv6SrPolicyNLRIPrefix, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpIpv6SrPolicyNLRIPrefix() + 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 +} + +// BgpIpv6SrPolicyNLRIPrefix is one IPv6 Segment Routing Policy NLRI Prefix. +type BgpIpv6SrPolicyNLRIPrefix interface { + Validation + // msg marshals BgpIpv6SrPolicyNLRIPrefix to protobuf object *otg.BgpIpv6SrPolicyNLRIPrefix + // and doesn't set defaults + msg() *otg.BgpIpv6SrPolicyNLRIPrefix + // setMsg unmarshals BgpIpv6SrPolicyNLRIPrefix from protobuf object *otg.BgpIpv6SrPolicyNLRIPrefix + // and doesn't set defaults + setMsg(*otg.BgpIpv6SrPolicyNLRIPrefix) BgpIpv6SrPolicyNLRIPrefix + // provides marshal interface + Marshal() marshalBgpIpv6SrPolicyNLRIPrefix + // provides unmarshal interface + Unmarshal() unMarshalBgpIpv6SrPolicyNLRIPrefix + // validate validates BgpIpv6SrPolicyNLRIPrefix + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpIpv6SrPolicyNLRIPrefix, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Distinguisher returns uint32, set in BgpIpv6SrPolicyNLRIPrefix. + Distinguisher() uint32 + // SetDistinguisher assigns uint32 provided by user to BgpIpv6SrPolicyNLRIPrefix + SetDistinguisher(value uint32) BgpIpv6SrPolicyNLRIPrefix + // HasDistinguisher checks if Distinguisher has been set in BgpIpv6SrPolicyNLRIPrefix + HasDistinguisher() bool + // Color returns uint32, set in BgpIpv6SrPolicyNLRIPrefix. + Color() uint32 + // SetColor assigns uint32 provided by user to BgpIpv6SrPolicyNLRIPrefix + SetColor(value uint32) BgpIpv6SrPolicyNLRIPrefix + // HasColor checks if Color has been set in BgpIpv6SrPolicyNLRIPrefix + HasColor() bool + // Endpoint returns string, set in BgpIpv6SrPolicyNLRIPrefix. + Endpoint() string + // SetEndpoint assigns string provided by user to BgpIpv6SrPolicyNLRIPrefix + SetEndpoint(value string) BgpIpv6SrPolicyNLRIPrefix + // HasEndpoint checks if Endpoint has been set in BgpIpv6SrPolicyNLRIPrefix + HasEndpoint() bool +} + +// The 4-octet value uniquely identifying the policy in the context of tuple. The distinguisher has no semantic value and is solely used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment lists) with the same Color and Endpoint but meant for different headends. +// Distinguisher returns a uint32 +func (obj *bgpIpv6SrPolicyNLRIPrefix) Distinguisher() uint32 { + + return *obj.obj.Distinguisher + +} + +// The 4-octet value uniquely identifying the policy in the context of tuple. The distinguisher has no semantic value and is solely used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment lists) with the same Color and Endpoint but meant for different headends. +// Distinguisher returns a uint32 +func (obj *bgpIpv6SrPolicyNLRIPrefix) HasDistinguisher() bool { + return obj.obj.Distinguisher != nil +} + +// The 4-octet value uniquely identifying the policy in the context of tuple. The distinguisher has no semantic value and is solely used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment lists) with the same Color and Endpoint but meant for different headends. +// SetDistinguisher sets the uint32 value in the BgpIpv6SrPolicyNLRIPrefix object +func (obj *bgpIpv6SrPolicyNLRIPrefix) SetDistinguisher(value uint32) BgpIpv6SrPolicyNLRIPrefix { + + obj.obj.Distinguisher = &value + return obj +} + +// 4-octet value identifying (with the endpoint) the policy. The color is used to match the color of the destination prefixes to steer traffic into the SR Policy as specified in section 8 of RFC9256. +// Color returns a uint32 +func (obj *bgpIpv6SrPolicyNLRIPrefix) Color() uint32 { + + return *obj.obj.Color + +} + +// 4-octet value identifying (with the endpoint) the policy. The color is used to match the color of the destination prefixes to steer traffic into the SR Policy as specified in section 8 of RFC9256. +// Color returns a uint32 +func (obj *bgpIpv6SrPolicyNLRIPrefix) HasColor() bool { + return obj.obj.Color != nil +} + +// 4-octet value identifying (with the endpoint) the policy. The color is used to match the color of the destination prefixes to steer traffic into the SR Policy as specified in section 8 of RFC9256. +// SetColor sets the uint32 value in the BgpIpv6SrPolicyNLRIPrefix object +func (obj *bgpIpv6SrPolicyNLRIPrefix) SetColor(value uint32) BgpIpv6SrPolicyNLRIPrefix { + + obj.obj.Color = &value + return obj +} + +// Identifies the endpoint of a policy. The Endpoint may represent a single node or a set of nodes (e.g., an anycast address). The Endpoint is an IPv6 address and can be either a unicast or an unspecified address (0::0) as specified in section 2.1 of RFC9256. +// Endpoint returns a string +func (obj *bgpIpv6SrPolicyNLRIPrefix) Endpoint() string { + + return *obj.obj.Endpoint + +} + +// Identifies the endpoint of a policy. The Endpoint may represent a single node or a set of nodes (e.g., an anycast address). The Endpoint is an IPv6 address and can be either a unicast or an unspecified address (0::0) as specified in section 2.1 of RFC9256. +// Endpoint returns a string +func (obj *bgpIpv6SrPolicyNLRIPrefix) HasEndpoint() bool { + return obj.obj.Endpoint != nil +} + +// Identifies the endpoint of a policy. The Endpoint may represent a single node or a set of nodes (e.g., an anycast address). The Endpoint is an IPv6 address and can be either a unicast or an unspecified address (0::0) as specified in section 2.1 of RFC9256. +// SetEndpoint sets the string value in the BgpIpv6SrPolicyNLRIPrefix object +func (obj *bgpIpv6SrPolicyNLRIPrefix) SetEndpoint(value string) BgpIpv6SrPolicyNLRIPrefix { + + obj.obj.Endpoint = &value + return obj +} + +func (obj *bgpIpv6SrPolicyNLRIPrefix) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Endpoint != nil { + + err := obj.validateIpv6(obj.Endpoint()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpIpv6SrPolicyNLRIPrefix.Endpoint")) + } + + } + +} + +func (obj *bgpIpv6SrPolicyNLRIPrefix) setDefault() { + if obj.obj.Distinguisher == nil { + obj.SetDistinguisher(1) + } + if obj.obj.Color == nil { + obj.SetColor(1) + } + if obj.obj.Endpoint == nil { + obj.SetEndpoint("0::0") + } + +} diff --git a/gosnappi/bgp_learned_information_filter.go b/gosnappi/bgp_learned_information_filter.go new file mode 100644 index 00000000..c487e2dd --- /dev/null +++ b/gosnappi/bgp_learned_information_filter.go @@ -0,0 +1,340 @@ +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" +) + +// ***** BgpLearnedInformationFilter ***** +type bgpLearnedInformationFilter struct { + validation + obj *otg.BgpLearnedInformationFilter + marshaller marshalBgpLearnedInformationFilter + unMarshaller unMarshalBgpLearnedInformationFilter +} + +func NewBgpLearnedInformationFilter() BgpLearnedInformationFilter { + obj := bgpLearnedInformationFilter{obj: &otg.BgpLearnedInformationFilter{}} + obj.setDefault() + return &obj +} + +func (obj *bgpLearnedInformationFilter) msg() *otg.BgpLearnedInformationFilter { + return obj.obj +} + +func (obj *bgpLearnedInformationFilter) setMsg(msg *otg.BgpLearnedInformationFilter) BgpLearnedInformationFilter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpLearnedInformationFilter struct { + obj *bgpLearnedInformationFilter +} + +type marshalBgpLearnedInformationFilter interface { + // ToProto marshals BgpLearnedInformationFilter to protobuf object *otg.BgpLearnedInformationFilter + ToProto() (*otg.BgpLearnedInformationFilter, error) + // ToPbText marshals BgpLearnedInformationFilter to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpLearnedInformationFilter to YAML text + ToYaml() (string, error) + // ToJson marshals BgpLearnedInformationFilter to JSON text + ToJson() (string, error) +} + +type unMarshalbgpLearnedInformationFilter struct { + obj *bgpLearnedInformationFilter +} + +type unMarshalBgpLearnedInformationFilter interface { + // FromProto unmarshals BgpLearnedInformationFilter from protobuf object *otg.BgpLearnedInformationFilter + FromProto(msg *otg.BgpLearnedInformationFilter) (BgpLearnedInformationFilter, error) + // FromPbText unmarshals BgpLearnedInformationFilter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpLearnedInformationFilter from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpLearnedInformationFilter from JSON text + FromJson(value string) error +} + +func (obj *bgpLearnedInformationFilter) Marshal() marshalBgpLearnedInformationFilter { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpLearnedInformationFilter{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpLearnedInformationFilter) Unmarshal() unMarshalBgpLearnedInformationFilter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpLearnedInformationFilter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpLearnedInformationFilter) ToProto() (*otg.BgpLearnedInformationFilter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpLearnedInformationFilter) FromProto(msg *otg.BgpLearnedInformationFilter) (BgpLearnedInformationFilter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpLearnedInformationFilter) 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 *unMarshalbgpLearnedInformationFilter) 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 *marshalbgpLearnedInformationFilter) 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 *unMarshalbgpLearnedInformationFilter) 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 *marshalbgpLearnedInformationFilter) 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 *unMarshalbgpLearnedInformationFilter) 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 *bgpLearnedInformationFilter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpLearnedInformationFilter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpLearnedInformationFilter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpLearnedInformationFilter) Clone() (BgpLearnedInformationFilter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpLearnedInformationFilter() + 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 +} + +// BgpLearnedInformationFilter is configuration for controlling storage of BGP learned information recieved from the peer. +type BgpLearnedInformationFilter interface { + Validation + // msg marshals BgpLearnedInformationFilter to protobuf object *otg.BgpLearnedInformationFilter + // and doesn't set defaults + msg() *otg.BgpLearnedInformationFilter + // setMsg unmarshals BgpLearnedInformationFilter from protobuf object *otg.BgpLearnedInformationFilter + // and doesn't set defaults + setMsg(*otg.BgpLearnedInformationFilter) BgpLearnedInformationFilter + // provides marshal interface + Marshal() marshalBgpLearnedInformationFilter + // provides unmarshal interface + Unmarshal() unMarshalBgpLearnedInformationFilter + // validate validates BgpLearnedInformationFilter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpLearnedInformationFilter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // UnicastIpv4Prefix returns bool, set in BgpLearnedInformationFilter. + UnicastIpv4Prefix() bool + // SetUnicastIpv4Prefix assigns bool provided by user to BgpLearnedInformationFilter + SetUnicastIpv4Prefix(value bool) BgpLearnedInformationFilter + // HasUnicastIpv4Prefix checks if UnicastIpv4Prefix has been set in BgpLearnedInformationFilter + HasUnicastIpv4Prefix() bool + // UnicastIpv6Prefix returns bool, set in BgpLearnedInformationFilter. + UnicastIpv6Prefix() bool + // SetUnicastIpv6Prefix assigns bool provided by user to BgpLearnedInformationFilter + SetUnicastIpv6Prefix(value bool) BgpLearnedInformationFilter + // HasUnicastIpv6Prefix checks if UnicastIpv6Prefix has been set in BgpLearnedInformationFilter + HasUnicastIpv6Prefix() bool +} + +// If enabled, will store the information related to Unicast IPv4 Prefixes recieved from the peer. +// UnicastIpv4Prefix returns a bool +func (obj *bgpLearnedInformationFilter) UnicastIpv4Prefix() bool { + + return *obj.obj.UnicastIpv4Prefix + +} + +// If enabled, will store the information related to Unicast IPv4 Prefixes recieved from the peer. +// UnicastIpv4Prefix returns a bool +func (obj *bgpLearnedInformationFilter) HasUnicastIpv4Prefix() bool { + return obj.obj.UnicastIpv4Prefix != nil +} + +// If enabled, will store the information related to Unicast IPv4 Prefixes recieved from the peer. +// SetUnicastIpv4Prefix sets the bool value in the BgpLearnedInformationFilter object +func (obj *bgpLearnedInformationFilter) SetUnicastIpv4Prefix(value bool) BgpLearnedInformationFilter { + + obj.obj.UnicastIpv4Prefix = &value + return obj +} + +// If enabled, will store the information related to Unicast IPv6 Prefixes recieved from the peer. +// UnicastIpv6Prefix returns a bool +func (obj *bgpLearnedInformationFilter) UnicastIpv6Prefix() bool { + + return *obj.obj.UnicastIpv6Prefix + +} + +// If enabled, will store the information related to Unicast IPv6 Prefixes recieved from the peer. +// UnicastIpv6Prefix returns a bool +func (obj *bgpLearnedInformationFilter) HasUnicastIpv6Prefix() bool { + return obj.obj.UnicastIpv6Prefix != nil +} + +// If enabled, will store the information related to Unicast IPv6 Prefixes recieved from the peer. +// SetUnicastIpv6Prefix sets the bool value in the BgpLearnedInformationFilter object +func (obj *bgpLearnedInformationFilter) SetUnicastIpv6Prefix(value bool) BgpLearnedInformationFilter { + + obj.obj.UnicastIpv6Prefix = &value + return obj +} + +func (obj *bgpLearnedInformationFilter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpLearnedInformationFilter) setDefault() { + if obj.obj.UnicastIpv4Prefix == nil { + obj.SetUnicastIpv4Prefix(false) + } + if obj.obj.UnicastIpv6Prefix == nil { + obj.SetUnicastIpv6Prefix(false) + } + +} diff --git a/gosnappi/bgp_nlri_prefix_path_id.go b/gosnappi/bgp_nlri_prefix_path_id.go new file mode 100644 index 00000000..4e11cf71 --- /dev/null +++ b/gosnappi/bgp_nlri_prefix_path_id.go @@ -0,0 +1,309 @@ +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" +) + +// ***** BgpNLRIPrefixPathId ***** +type bgpNLRIPrefixPathId struct { + validation + obj *otg.BgpNLRIPrefixPathId + marshaller marshalBgpNLRIPrefixPathId + unMarshaller unMarshalBgpNLRIPrefixPathId +} + +func NewBgpNLRIPrefixPathId() BgpNLRIPrefixPathId { + obj := bgpNLRIPrefixPathId{obj: &otg.BgpNLRIPrefixPathId{}} + obj.setDefault() + return &obj +} + +func (obj *bgpNLRIPrefixPathId) msg() *otg.BgpNLRIPrefixPathId { + return obj.obj +} + +func (obj *bgpNLRIPrefixPathId) setMsg(msg *otg.BgpNLRIPrefixPathId) BgpNLRIPrefixPathId { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpNLRIPrefixPathId struct { + obj *bgpNLRIPrefixPathId +} + +type marshalBgpNLRIPrefixPathId interface { + // ToProto marshals BgpNLRIPrefixPathId to protobuf object *otg.BgpNLRIPrefixPathId + ToProto() (*otg.BgpNLRIPrefixPathId, error) + // ToPbText marshals BgpNLRIPrefixPathId to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpNLRIPrefixPathId to YAML text + ToYaml() (string, error) + // ToJson marshals BgpNLRIPrefixPathId to JSON text + ToJson() (string, error) +} + +type unMarshalbgpNLRIPrefixPathId struct { + obj *bgpNLRIPrefixPathId +} + +type unMarshalBgpNLRIPrefixPathId interface { + // FromProto unmarshals BgpNLRIPrefixPathId from protobuf object *otg.BgpNLRIPrefixPathId + FromProto(msg *otg.BgpNLRIPrefixPathId) (BgpNLRIPrefixPathId, error) + // FromPbText unmarshals BgpNLRIPrefixPathId from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpNLRIPrefixPathId from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpNLRIPrefixPathId from JSON text + FromJson(value string) error +} + +func (obj *bgpNLRIPrefixPathId) Marshal() marshalBgpNLRIPrefixPathId { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpNLRIPrefixPathId{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpNLRIPrefixPathId) Unmarshal() unMarshalBgpNLRIPrefixPathId { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpNLRIPrefixPathId{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpNLRIPrefixPathId) ToProto() (*otg.BgpNLRIPrefixPathId, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpNLRIPrefixPathId) FromProto(msg *otg.BgpNLRIPrefixPathId) (BgpNLRIPrefixPathId, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpNLRIPrefixPathId) 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 *unMarshalbgpNLRIPrefixPathId) 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 *marshalbgpNLRIPrefixPathId) 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 *unMarshalbgpNLRIPrefixPathId) 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 *marshalbgpNLRIPrefixPathId) 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 *unMarshalbgpNLRIPrefixPathId) 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 *bgpNLRIPrefixPathId) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpNLRIPrefixPathId) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpNLRIPrefixPathId) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpNLRIPrefixPathId) Clone() (BgpNLRIPrefixPathId, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpNLRIPrefixPathId() + 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 +} + +// BgpNLRIPrefixPathId is optional field in the NLRI carrying Path Id of the prefix. +type BgpNLRIPrefixPathId interface { + Validation + // msg marshals BgpNLRIPrefixPathId to protobuf object *otg.BgpNLRIPrefixPathId + // and doesn't set defaults + msg() *otg.BgpNLRIPrefixPathId + // setMsg unmarshals BgpNLRIPrefixPathId from protobuf object *otg.BgpNLRIPrefixPathId + // and doesn't set defaults + setMsg(*otg.BgpNLRIPrefixPathId) BgpNLRIPrefixPathId + // provides marshal interface + Marshal() marshalBgpNLRIPrefixPathId + // provides unmarshal interface + Unmarshal() unMarshalBgpNLRIPrefixPathId + // validate validates BgpNLRIPrefixPathId + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpNLRIPrefixPathId, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Value returns uint32, set in BgpNLRIPrefixPathId. + Value() uint32 + // SetValue assigns uint32 provided by user to BgpNLRIPrefixPathId + SetValue(value uint32) BgpNLRIPrefixPathId + // HasValue checks if Value has been set in BgpNLRIPrefixPathId + HasValue() bool +} + +// The value of the optional Path ID of the prefix. +// Value returns a uint32 +func (obj *bgpNLRIPrefixPathId) Value() uint32 { + + return *obj.obj.Value + +} + +// The value of the optional Path ID of the prefix. +// Value returns a uint32 +func (obj *bgpNLRIPrefixPathId) HasValue() bool { + return obj.obj.Value != nil +} + +// The value of the optional Path ID of the prefix. +// SetValue sets the uint32 value in the BgpNLRIPrefixPathId object +func (obj *bgpNLRIPrefixPathId) SetValue(value uint32) BgpNLRIPrefixPathId { + + obj.obj.Value = &value + return obj +} + +func (obj *bgpNLRIPrefixPathId) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpNLRIPrefixPathId) setDefault() { + if obj.obj.Value == nil { + obj.SetValue(1) + } + +} diff --git a/gosnappi/bgp_one_ipv4_nlri_prefix.go b/gosnappi/bgp_one_ipv4_nlri_prefix.go new file mode 100644 index 00000000..2331ac30 --- /dev/null +++ b/gosnappi/bgp_one_ipv4_nlri_prefix.go @@ -0,0 +1,409 @@ +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" +) + +// ***** BgpOneIpv4NLRIPrefix ***** +type bgpOneIpv4NLRIPrefix struct { + validation + obj *otg.BgpOneIpv4NLRIPrefix + marshaller marshalBgpOneIpv4NLRIPrefix + unMarshaller unMarshalBgpOneIpv4NLRIPrefix + pathIdHolder BgpNLRIPrefixPathId +} + +func NewBgpOneIpv4NLRIPrefix() BgpOneIpv4NLRIPrefix { + obj := bgpOneIpv4NLRIPrefix{obj: &otg.BgpOneIpv4NLRIPrefix{}} + obj.setDefault() + return &obj +} + +func (obj *bgpOneIpv4NLRIPrefix) msg() *otg.BgpOneIpv4NLRIPrefix { + return obj.obj +} + +func (obj *bgpOneIpv4NLRIPrefix) setMsg(msg *otg.BgpOneIpv4NLRIPrefix) BgpOneIpv4NLRIPrefix { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpOneIpv4NLRIPrefix struct { + obj *bgpOneIpv4NLRIPrefix +} + +type marshalBgpOneIpv4NLRIPrefix interface { + // ToProto marshals BgpOneIpv4NLRIPrefix to protobuf object *otg.BgpOneIpv4NLRIPrefix + ToProto() (*otg.BgpOneIpv4NLRIPrefix, error) + // ToPbText marshals BgpOneIpv4NLRIPrefix to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpOneIpv4NLRIPrefix to YAML text + ToYaml() (string, error) + // ToJson marshals BgpOneIpv4NLRIPrefix to JSON text + ToJson() (string, error) +} + +type unMarshalbgpOneIpv4NLRIPrefix struct { + obj *bgpOneIpv4NLRIPrefix +} + +type unMarshalBgpOneIpv4NLRIPrefix interface { + // FromProto unmarshals BgpOneIpv4NLRIPrefix from protobuf object *otg.BgpOneIpv4NLRIPrefix + FromProto(msg *otg.BgpOneIpv4NLRIPrefix) (BgpOneIpv4NLRIPrefix, error) + // FromPbText unmarshals BgpOneIpv4NLRIPrefix from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpOneIpv4NLRIPrefix from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpOneIpv4NLRIPrefix from JSON text + FromJson(value string) error +} + +func (obj *bgpOneIpv4NLRIPrefix) Marshal() marshalBgpOneIpv4NLRIPrefix { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpOneIpv4NLRIPrefix{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpOneIpv4NLRIPrefix) Unmarshal() unMarshalBgpOneIpv4NLRIPrefix { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpOneIpv4NLRIPrefix{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpOneIpv4NLRIPrefix) ToProto() (*otg.BgpOneIpv4NLRIPrefix, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpOneIpv4NLRIPrefix) FromProto(msg *otg.BgpOneIpv4NLRIPrefix) (BgpOneIpv4NLRIPrefix, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpOneIpv4NLRIPrefix) 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 *unMarshalbgpOneIpv4NLRIPrefix) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpOneIpv4NLRIPrefix) 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 *unMarshalbgpOneIpv4NLRIPrefix) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpOneIpv4NLRIPrefix) 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 *unMarshalbgpOneIpv4NLRIPrefix) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpOneIpv4NLRIPrefix) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpOneIpv4NLRIPrefix) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpOneIpv4NLRIPrefix) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpOneIpv4NLRIPrefix) Clone() (BgpOneIpv4NLRIPrefix, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpOneIpv4NLRIPrefix() + 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 +} + +func (obj *bgpOneIpv4NLRIPrefix) setNil() { + obj.pathIdHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpOneIpv4NLRIPrefix is one IPv4 NLRI Prefix. +type BgpOneIpv4NLRIPrefix interface { + Validation + // msg marshals BgpOneIpv4NLRIPrefix to protobuf object *otg.BgpOneIpv4NLRIPrefix + // and doesn't set defaults + msg() *otg.BgpOneIpv4NLRIPrefix + // setMsg unmarshals BgpOneIpv4NLRIPrefix from protobuf object *otg.BgpOneIpv4NLRIPrefix + // and doesn't set defaults + setMsg(*otg.BgpOneIpv4NLRIPrefix) BgpOneIpv4NLRIPrefix + // provides marshal interface + Marshal() marshalBgpOneIpv4NLRIPrefix + // provides unmarshal interface + Unmarshal() unMarshalBgpOneIpv4NLRIPrefix + // validate validates BgpOneIpv4NLRIPrefix + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpOneIpv4NLRIPrefix, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Address returns string, set in BgpOneIpv4NLRIPrefix. + Address() string + // SetAddress assigns string provided by user to BgpOneIpv4NLRIPrefix + SetAddress(value string) BgpOneIpv4NLRIPrefix + // HasAddress checks if Address has been set in BgpOneIpv4NLRIPrefix + HasAddress() bool + // Prefix returns uint32, set in BgpOneIpv4NLRIPrefix. + Prefix() uint32 + // SetPrefix assigns uint32 provided by user to BgpOneIpv4NLRIPrefix + SetPrefix(value uint32) BgpOneIpv4NLRIPrefix + // HasPrefix checks if Prefix has been set in BgpOneIpv4NLRIPrefix + HasPrefix() bool + // PathId returns BgpNLRIPrefixPathId, set in BgpOneIpv4NLRIPrefix. + // BgpNLRIPrefixPathId is optional field in the NLRI carrying Path Id of the prefix. + PathId() BgpNLRIPrefixPathId + // SetPathId assigns BgpNLRIPrefixPathId provided by user to BgpOneIpv4NLRIPrefix. + // BgpNLRIPrefixPathId is optional field in the NLRI carrying Path Id of the prefix. + SetPathId(value BgpNLRIPrefixPathId) BgpOneIpv4NLRIPrefix + // HasPathId checks if PathId has been set in BgpOneIpv4NLRIPrefix + HasPathId() bool + setNil() +} + +// The IPv4 address of the network. +// Address returns a string +func (obj *bgpOneIpv4NLRIPrefix) Address() string { + + return *obj.obj.Address + +} + +// The IPv4 address of the network. +// Address returns a string +func (obj *bgpOneIpv4NLRIPrefix) HasAddress() bool { + return obj.obj.Address != nil +} + +// The IPv4 address of the network. +// SetAddress sets the string value in the BgpOneIpv4NLRIPrefix object +func (obj *bgpOneIpv4NLRIPrefix) SetAddress(value string) BgpOneIpv4NLRIPrefix { + + obj.obj.Address = &value + return obj +} + +// The IPv4 network prefix length to be applied to the address. +// Prefix returns a uint32 +func (obj *bgpOneIpv4NLRIPrefix) Prefix() uint32 { + + return *obj.obj.Prefix + +} + +// The IPv4 network prefix length to be applied to the address. +// Prefix returns a uint32 +func (obj *bgpOneIpv4NLRIPrefix) HasPrefix() bool { + return obj.obj.Prefix != nil +} + +// The IPv4 network prefix length to be applied to the address. +// SetPrefix sets the uint32 value in the BgpOneIpv4NLRIPrefix object +func (obj *bgpOneIpv4NLRIPrefix) SetPrefix(value uint32) BgpOneIpv4NLRIPrefix { + + obj.obj.Prefix = &value + return obj +} + +// description is TBD +// PathId returns a BgpNLRIPrefixPathId +func (obj *bgpOneIpv4NLRIPrefix) PathId() BgpNLRIPrefixPathId { + if obj.obj.PathId == nil { + obj.obj.PathId = NewBgpNLRIPrefixPathId().msg() + } + if obj.pathIdHolder == nil { + obj.pathIdHolder = &bgpNLRIPrefixPathId{obj: obj.obj.PathId} + } + return obj.pathIdHolder +} + +// description is TBD +// PathId returns a BgpNLRIPrefixPathId +func (obj *bgpOneIpv4NLRIPrefix) HasPathId() bool { + return obj.obj.PathId != nil +} + +// description is TBD +// SetPathId sets the BgpNLRIPrefixPathId value in the BgpOneIpv4NLRIPrefix object +func (obj *bgpOneIpv4NLRIPrefix) SetPathId(value BgpNLRIPrefixPathId) BgpOneIpv4NLRIPrefix { + + obj.pathIdHolder = nil + obj.obj.PathId = value.msg() + + return obj +} + +func (obj *bgpOneIpv4NLRIPrefix) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Address != nil { + + err := obj.validateIpv4(obj.Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpOneIpv4NLRIPrefix.Address")) + } + + } + + if obj.obj.Prefix != nil { + + if *obj.obj.Prefix > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpOneIpv4NLRIPrefix.Prefix <= 32 but Got %d", *obj.obj.Prefix)) + } + + } + + if obj.obj.PathId != nil { + + obj.PathId().validateObj(vObj, set_default) + } + +} + +func (obj *bgpOneIpv4NLRIPrefix) setDefault() { + if obj.obj.Address == nil { + obj.SetAddress("0.0.0.0") + } + if obj.obj.Prefix == nil { + obj.SetPrefix(24) + } + +} diff --git a/gosnappi/bgp_one_ipv6_nlri_prefix.go b/gosnappi/bgp_one_ipv6_nlri_prefix.go new file mode 100644 index 00000000..fb848344 --- /dev/null +++ b/gosnappi/bgp_one_ipv6_nlri_prefix.go @@ -0,0 +1,409 @@ +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" +) + +// ***** BgpOneIpv6NLRIPrefix ***** +type bgpOneIpv6NLRIPrefix struct { + validation + obj *otg.BgpOneIpv6NLRIPrefix + marshaller marshalBgpOneIpv6NLRIPrefix + unMarshaller unMarshalBgpOneIpv6NLRIPrefix + pathIdHolder BgpNLRIPrefixPathId +} + +func NewBgpOneIpv6NLRIPrefix() BgpOneIpv6NLRIPrefix { + obj := bgpOneIpv6NLRIPrefix{obj: &otg.BgpOneIpv6NLRIPrefix{}} + obj.setDefault() + return &obj +} + +func (obj *bgpOneIpv6NLRIPrefix) msg() *otg.BgpOneIpv6NLRIPrefix { + return obj.obj +} + +func (obj *bgpOneIpv6NLRIPrefix) setMsg(msg *otg.BgpOneIpv6NLRIPrefix) BgpOneIpv6NLRIPrefix { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpOneIpv6NLRIPrefix struct { + obj *bgpOneIpv6NLRIPrefix +} + +type marshalBgpOneIpv6NLRIPrefix interface { + // ToProto marshals BgpOneIpv6NLRIPrefix to protobuf object *otg.BgpOneIpv6NLRIPrefix + ToProto() (*otg.BgpOneIpv6NLRIPrefix, error) + // ToPbText marshals BgpOneIpv6NLRIPrefix to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpOneIpv6NLRIPrefix to YAML text + ToYaml() (string, error) + // ToJson marshals BgpOneIpv6NLRIPrefix to JSON text + ToJson() (string, error) +} + +type unMarshalbgpOneIpv6NLRIPrefix struct { + obj *bgpOneIpv6NLRIPrefix +} + +type unMarshalBgpOneIpv6NLRIPrefix interface { + // FromProto unmarshals BgpOneIpv6NLRIPrefix from protobuf object *otg.BgpOneIpv6NLRIPrefix + FromProto(msg *otg.BgpOneIpv6NLRIPrefix) (BgpOneIpv6NLRIPrefix, error) + // FromPbText unmarshals BgpOneIpv6NLRIPrefix from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpOneIpv6NLRIPrefix from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpOneIpv6NLRIPrefix from JSON text + FromJson(value string) error +} + +func (obj *bgpOneIpv6NLRIPrefix) Marshal() marshalBgpOneIpv6NLRIPrefix { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpOneIpv6NLRIPrefix{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpOneIpv6NLRIPrefix) Unmarshal() unMarshalBgpOneIpv6NLRIPrefix { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpOneIpv6NLRIPrefix{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpOneIpv6NLRIPrefix) ToProto() (*otg.BgpOneIpv6NLRIPrefix, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpOneIpv6NLRIPrefix) FromProto(msg *otg.BgpOneIpv6NLRIPrefix) (BgpOneIpv6NLRIPrefix, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpOneIpv6NLRIPrefix) 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 *unMarshalbgpOneIpv6NLRIPrefix) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpOneIpv6NLRIPrefix) 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 *unMarshalbgpOneIpv6NLRIPrefix) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpOneIpv6NLRIPrefix) 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 *unMarshalbgpOneIpv6NLRIPrefix) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpOneIpv6NLRIPrefix) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpOneIpv6NLRIPrefix) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpOneIpv6NLRIPrefix) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpOneIpv6NLRIPrefix) Clone() (BgpOneIpv6NLRIPrefix, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpOneIpv6NLRIPrefix() + 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 +} + +func (obj *bgpOneIpv6NLRIPrefix) setNil() { + obj.pathIdHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpOneIpv6NLRIPrefix is one IPv6 NLRI Prefix. +type BgpOneIpv6NLRIPrefix interface { + Validation + // msg marshals BgpOneIpv6NLRIPrefix to protobuf object *otg.BgpOneIpv6NLRIPrefix + // and doesn't set defaults + msg() *otg.BgpOneIpv6NLRIPrefix + // setMsg unmarshals BgpOneIpv6NLRIPrefix from protobuf object *otg.BgpOneIpv6NLRIPrefix + // and doesn't set defaults + setMsg(*otg.BgpOneIpv6NLRIPrefix) BgpOneIpv6NLRIPrefix + // provides marshal interface + Marshal() marshalBgpOneIpv6NLRIPrefix + // provides unmarshal interface + Unmarshal() unMarshalBgpOneIpv6NLRIPrefix + // validate validates BgpOneIpv6NLRIPrefix + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpOneIpv6NLRIPrefix, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Address returns string, set in BgpOneIpv6NLRIPrefix. + Address() string + // SetAddress assigns string provided by user to BgpOneIpv6NLRIPrefix + SetAddress(value string) BgpOneIpv6NLRIPrefix + // HasAddress checks if Address has been set in BgpOneIpv6NLRIPrefix + HasAddress() bool + // Prefix returns uint32, set in BgpOneIpv6NLRIPrefix. + Prefix() uint32 + // SetPrefix assigns uint32 provided by user to BgpOneIpv6NLRIPrefix + SetPrefix(value uint32) BgpOneIpv6NLRIPrefix + // HasPrefix checks if Prefix has been set in BgpOneIpv6NLRIPrefix + HasPrefix() bool + // PathId returns BgpNLRIPrefixPathId, set in BgpOneIpv6NLRIPrefix. + // BgpNLRIPrefixPathId is optional field in the NLRI carrying Path Id of the prefix. + PathId() BgpNLRIPrefixPathId + // SetPathId assigns BgpNLRIPrefixPathId provided by user to BgpOneIpv6NLRIPrefix. + // BgpNLRIPrefixPathId is optional field in the NLRI carrying Path Id of the prefix. + SetPathId(value BgpNLRIPrefixPathId) BgpOneIpv6NLRIPrefix + // HasPathId checks if PathId has been set in BgpOneIpv6NLRIPrefix + HasPathId() bool + setNil() +} + +// The IPv6 address of the network. +// Address returns a string +func (obj *bgpOneIpv6NLRIPrefix) Address() string { + + return *obj.obj.Address + +} + +// The IPv6 address of the network. +// Address returns a string +func (obj *bgpOneIpv6NLRIPrefix) HasAddress() bool { + return obj.obj.Address != nil +} + +// The IPv6 address of the network. +// SetAddress sets the string value in the BgpOneIpv6NLRIPrefix object +func (obj *bgpOneIpv6NLRIPrefix) SetAddress(value string) BgpOneIpv6NLRIPrefix { + + obj.obj.Address = &value + return obj +} + +// The IPv6 network prefix length to be applied to the address. +// Prefix returns a uint32 +func (obj *bgpOneIpv6NLRIPrefix) Prefix() uint32 { + + return *obj.obj.Prefix + +} + +// The IPv6 network prefix length to be applied to the address. +// Prefix returns a uint32 +func (obj *bgpOneIpv6NLRIPrefix) HasPrefix() bool { + return obj.obj.Prefix != nil +} + +// The IPv6 network prefix length to be applied to the address. +// SetPrefix sets the uint32 value in the BgpOneIpv6NLRIPrefix object +func (obj *bgpOneIpv6NLRIPrefix) SetPrefix(value uint32) BgpOneIpv6NLRIPrefix { + + obj.obj.Prefix = &value + return obj +} + +// description is TBD +// PathId returns a BgpNLRIPrefixPathId +func (obj *bgpOneIpv6NLRIPrefix) PathId() BgpNLRIPrefixPathId { + if obj.obj.PathId == nil { + obj.obj.PathId = NewBgpNLRIPrefixPathId().msg() + } + if obj.pathIdHolder == nil { + obj.pathIdHolder = &bgpNLRIPrefixPathId{obj: obj.obj.PathId} + } + return obj.pathIdHolder +} + +// description is TBD +// PathId returns a BgpNLRIPrefixPathId +func (obj *bgpOneIpv6NLRIPrefix) HasPathId() bool { + return obj.obj.PathId != nil +} + +// description is TBD +// SetPathId sets the BgpNLRIPrefixPathId value in the BgpOneIpv6NLRIPrefix object +func (obj *bgpOneIpv6NLRIPrefix) SetPathId(value BgpNLRIPrefixPathId) BgpOneIpv6NLRIPrefix { + + obj.pathIdHolder = nil + obj.obj.PathId = value.msg() + + return obj +} + +func (obj *bgpOneIpv6NLRIPrefix) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Address != nil { + + err := obj.validateIpv6(obj.Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpOneIpv6NLRIPrefix.Address")) + } + + } + + if obj.obj.Prefix != nil { + + if *obj.obj.Prefix > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpOneIpv6NLRIPrefix.Prefix <= 128 but Got %d", *obj.obj.Prefix)) + } + + } + + if obj.obj.PathId != nil { + + obj.PathId().validateObj(vObj, set_default) + } + +} + +func (obj *bgpOneIpv6NLRIPrefix) setDefault() { + if obj.obj.Address == nil { + obj.SetAddress("0::0") + } + if obj.obj.Prefix == nil { + obj.SetPrefix(64) + } + +} diff --git a/gosnappi/bgp_one_structured_update_replay.go b/gosnappi/bgp_one_structured_update_replay.go new file mode 100644 index 00000000..07a8fb01 --- /dev/null +++ b/gosnappi/bgp_one_structured_update_replay.go @@ -0,0 +1,494 @@ +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" +) + +// ***** BgpOneStructuredUpdateReplay ***** +type bgpOneStructuredUpdateReplay struct { + validation + obj *otg.BgpOneStructuredUpdateReplay + marshaller marshalBgpOneStructuredUpdateReplay + unMarshaller unMarshalBgpOneStructuredUpdateReplay + pathAttributesHolder BgpAttributes + traditionalUnreachNlrisHolder BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter + traditionalReachNlrisHolder BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter +} + +func NewBgpOneStructuredUpdateReplay() BgpOneStructuredUpdateReplay { + obj := bgpOneStructuredUpdateReplay{obj: &otg.BgpOneStructuredUpdateReplay{}} + obj.setDefault() + return &obj +} + +func (obj *bgpOneStructuredUpdateReplay) msg() *otg.BgpOneStructuredUpdateReplay { + return obj.obj +} + +func (obj *bgpOneStructuredUpdateReplay) setMsg(msg *otg.BgpOneStructuredUpdateReplay) BgpOneStructuredUpdateReplay { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpOneStructuredUpdateReplay struct { + obj *bgpOneStructuredUpdateReplay +} + +type marshalBgpOneStructuredUpdateReplay interface { + // ToProto marshals BgpOneStructuredUpdateReplay to protobuf object *otg.BgpOneStructuredUpdateReplay + ToProto() (*otg.BgpOneStructuredUpdateReplay, error) + // ToPbText marshals BgpOneStructuredUpdateReplay to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpOneStructuredUpdateReplay to YAML text + ToYaml() (string, error) + // ToJson marshals BgpOneStructuredUpdateReplay to JSON text + ToJson() (string, error) +} + +type unMarshalbgpOneStructuredUpdateReplay struct { + obj *bgpOneStructuredUpdateReplay +} + +type unMarshalBgpOneStructuredUpdateReplay interface { + // FromProto unmarshals BgpOneStructuredUpdateReplay from protobuf object *otg.BgpOneStructuredUpdateReplay + FromProto(msg *otg.BgpOneStructuredUpdateReplay) (BgpOneStructuredUpdateReplay, error) + // FromPbText unmarshals BgpOneStructuredUpdateReplay from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpOneStructuredUpdateReplay from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpOneStructuredUpdateReplay from JSON text + FromJson(value string) error +} + +func (obj *bgpOneStructuredUpdateReplay) Marshal() marshalBgpOneStructuredUpdateReplay { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpOneStructuredUpdateReplay{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpOneStructuredUpdateReplay) Unmarshal() unMarshalBgpOneStructuredUpdateReplay { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpOneStructuredUpdateReplay{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpOneStructuredUpdateReplay) ToProto() (*otg.BgpOneStructuredUpdateReplay, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpOneStructuredUpdateReplay) FromProto(msg *otg.BgpOneStructuredUpdateReplay) (BgpOneStructuredUpdateReplay, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpOneStructuredUpdateReplay) 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 *unMarshalbgpOneStructuredUpdateReplay) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpOneStructuredUpdateReplay) 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 *unMarshalbgpOneStructuredUpdateReplay) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpOneStructuredUpdateReplay) 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 *unMarshalbgpOneStructuredUpdateReplay) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpOneStructuredUpdateReplay) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpOneStructuredUpdateReplay) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpOneStructuredUpdateReplay) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpOneStructuredUpdateReplay) Clone() (BgpOneStructuredUpdateReplay, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpOneStructuredUpdateReplay() + 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 +} + +func (obj *bgpOneStructuredUpdateReplay) setNil() { + obj.pathAttributesHolder = nil + obj.traditionalUnreachNlrisHolder = nil + obj.traditionalReachNlrisHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpOneStructuredUpdateReplay is one structured BGP Update. +type BgpOneStructuredUpdateReplay interface { + Validation + // msg marshals BgpOneStructuredUpdateReplay to protobuf object *otg.BgpOneStructuredUpdateReplay + // and doesn't set defaults + msg() *otg.BgpOneStructuredUpdateReplay + // setMsg unmarshals BgpOneStructuredUpdateReplay from protobuf object *otg.BgpOneStructuredUpdateReplay + // and doesn't set defaults + setMsg(*otg.BgpOneStructuredUpdateReplay) BgpOneStructuredUpdateReplay + // provides marshal interface + Marshal() marshalBgpOneStructuredUpdateReplay + // provides unmarshal interface + Unmarshal() unMarshalBgpOneStructuredUpdateReplay + // validate validates BgpOneStructuredUpdateReplay + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpOneStructuredUpdateReplay, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // TimeGap returns uint32, set in BgpOneStructuredUpdateReplay. + TimeGap() uint32 + // SetTimeGap assigns uint32 provided by user to BgpOneStructuredUpdateReplay + SetTimeGap(value uint32) BgpOneStructuredUpdateReplay + // HasTimeGap checks if TimeGap has been set in BgpOneStructuredUpdateReplay + HasTimeGap() bool + // PathAttributes returns BgpAttributes, set in BgpOneStructuredUpdateReplay. + // BgpAttributes is attributes carried in the Update packet alongwith the reach/unreach prefixes. + PathAttributes() BgpAttributes + // SetPathAttributes assigns BgpAttributes provided by user to BgpOneStructuredUpdateReplay. + // BgpAttributes is attributes carried in the Update packet alongwith the reach/unreach prefixes. + SetPathAttributes(value BgpAttributes) BgpOneStructuredUpdateReplay + // HasPathAttributes checks if PathAttributes has been set in BgpOneStructuredUpdateReplay + HasPathAttributes() bool + // TraditionalUnreachNlris returns BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIterIter, set in BgpOneStructuredUpdateReplay + TraditionalUnreachNlris() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter + // TraditionalReachNlris returns BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIterIter, set in BgpOneStructuredUpdateReplay + TraditionalReachNlris() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter + setNil() +} + +// Minimum time interval in milliseconds from previous Update from the sequence of BGP Updates to be replayed. +// TimeGap returns a uint32 +func (obj *bgpOneStructuredUpdateReplay) TimeGap() uint32 { + + return *obj.obj.TimeGap + +} + +// Minimum time interval in milliseconds from previous Update from the sequence of BGP Updates to be replayed. +// TimeGap returns a uint32 +func (obj *bgpOneStructuredUpdateReplay) HasTimeGap() bool { + return obj.obj.TimeGap != nil +} + +// Minimum time interval in milliseconds from previous Update from the sequence of BGP Updates to be replayed. +// SetTimeGap sets the uint32 value in the BgpOneStructuredUpdateReplay object +func (obj *bgpOneStructuredUpdateReplay) SetTimeGap(value uint32) BgpOneStructuredUpdateReplay { + + obj.obj.TimeGap = &value + return obj +} + +// Attributes carried in the Update packet alongwith the reach/unreach prefixes. +// PathAttributes returns a BgpAttributes +func (obj *bgpOneStructuredUpdateReplay) PathAttributes() BgpAttributes { + if obj.obj.PathAttributes == nil { + obj.obj.PathAttributes = NewBgpAttributes().msg() + } + if obj.pathAttributesHolder == nil { + obj.pathAttributesHolder = &bgpAttributes{obj: obj.obj.PathAttributes} + } + return obj.pathAttributesHolder +} + +// Attributes carried in the Update packet alongwith the reach/unreach prefixes. +// PathAttributes returns a BgpAttributes +func (obj *bgpOneStructuredUpdateReplay) HasPathAttributes() bool { + return obj.obj.PathAttributes != nil +} + +// Attributes carried in the Update packet alongwith the reach/unreach prefixes. +// SetPathAttributes sets the BgpAttributes value in the BgpOneStructuredUpdateReplay object +func (obj *bgpOneStructuredUpdateReplay) SetPathAttributes(value BgpAttributes) BgpOneStructuredUpdateReplay { + + obj.pathAttributesHolder = nil + obj.obj.PathAttributes = value.msg() + + return obj +} + +// The IPv4 prefixes to be included in the traditional UNREACH_NLRI. +// TraditionalUnreachNlris returns a []BgpOneTraditionalNlriPrefix +func (obj *bgpOneStructuredUpdateReplay) TraditionalUnreachNlris() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { + if len(obj.obj.TraditionalUnreachNlris) == 0 { + obj.obj.TraditionalUnreachNlris = []*otg.BgpOneTraditionalNlriPrefix{} + } + if obj.traditionalUnreachNlrisHolder == nil { + obj.traditionalUnreachNlrisHolder = newBgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter(&obj.obj.TraditionalUnreachNlris).setMsg(obj) + } + return obj.traditionalUnreachNlrisHolder +} + +type bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter struct { + obj *bgpOneStructuredUpdateReplay + bgpOneTraditionalNlriPrefixSlice []BgpOneTraditionalNlriPrefix + fieldPtr *[]*otg.BgpOneTraditionalNlriPrefix +} + +func newBgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter(ptr *[]*otg.BgpOneTraditionalNlriPrefix) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { + return &bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter{fieldPtr: ptr} +} + +type BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter interface { + setMsg(*bgpOneStructuredUpdateReplay) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter + Items() []BgpOneTraditionalNlriPrefix + Add() BgpOneTraditionalNlriPrefix + Append(items ...BgpOneTraditionalNlriPrefix) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter + Set(index int, newObj BgpOneTraditionalNlriPrefix) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter + Clear() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter + clearHolderSlice() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter + appendHolderSlice(item BgpOneTraditionalNlriPrefix) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter +} + +func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) setMsg(msg *bgpOneStructuredUpdateReplay) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpOneTraditionalNlriPrefix{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) Items() []BgpOneTraditionalNlriPrefix { + return obj.bgpOneTraditionalNlriPrefixSlice +} + +func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) Add() BgpOneTraditionalNlriPrefix { + newObj := &otg.BgpOneTraditionalNlriPrefix{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpOneTraditionalNlriPrefix{obj: newObj} + newLibObj.setDefault() + obj.bgpOneTraditionalNlriPrefixSlice = append(obj.bgpOneTraditionalNlriPrefixSlice, newLibObj) + return newLibObj +} + +func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) Append(items ...BgpOneTraditionalNlriPrefix) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpOneTraditionalNlriPrefixSlice = append(obj.bgpOneTraditionalNlriPrefixSlice, item) + } + return obj +} + +func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) Set(index int, newObj BgpOneTraditionalNlriPrefix) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpOneTraditionalNlriPrefixSlice[index] = newObj + return obj +} +func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) Clear() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpOneTraditionalNlriPrefix{} + obj.bgpOneTraditionalNlriPrefixSlice = []BgpOneTraditionalNlriPrefix{} + } + return obj +} +func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) clearHolderSlice() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { + if len(obj.bgpOneTraditionalNlriPrefixSlice) > 0 { + obj.bgpOneTraditionalNlriPrefixSlice = []BgpOneTraditionalNlriPrefix{} + } + return obj +} +func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) appendHolderSlice(item BgpOneTraditionalNlriPrefix) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { + obj.bgpOneTraditionalNlriPrefixSlice = append(obj.bgpOneTraditionalNlriPrefixSlice, item) + return obj +} + +// The IPv4 prefixes to be included in the traditional REACH_NLRI. +// TraditionalReachNlris returns a []BgpOneTraditionalNlriPrefix +func (obj *bgpOneStructuredUpdateReplay) TraditionalReachNlris() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { + if len(obj.obj.TraditionalReachNlris) == 0 { + obj.obj.TraditionalReachNlris = []*otg.BgpOneTraditionalNlriPrefix{} + } + if obj.traditionalReachNlrisHolder == nil { + obj.traditionalReachNlrisHolder = newBgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter(&obj.obj.TraditionalReachNlris).setMsg(obj) + } + return obj.traditionalReachNlrisHolder +} + +func (obj *bgpOneStructuredUpdateReplay) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.PathAttributes != nil { + + obj.PathAttributes().validateObj(vObj, set_default) + } + + if len(obj.obj.TraditionalUnreachNlris) != 0 { + + if set_default { + obj.TraditionalUnreachNlris().clearHolderSlice() + for _, item := range obj.obj.TraditionalUnreachNlris { + obj.TraditionalUnreachNlris().appendHolderSlice(&bgpOneTraditionalNlriPrefix{obj: item}) + } + } + for _, item := range obj.TraditionalUnreachNlris().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.TraditionalReachNlris) != 0 { + + if set_default { + obj.TraditionalReachNlris().clearHolderSlice() + for _, item := range obj.obj.TraditionalReachNlris { + obj.TraditionalReachNlris().appendHolderSlice(&bgpOneTraditionalNlriPrefix{obj: item}) + } + } + for _, item := range obj.TraditionalReachNlris().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpOneStructuredUpdateReplay) setDefault() { + if obj.obj.TimeGap == nil { + obj.SetTimeGap(0) + } + +} diff --git a/gosnappi/bgp_one_traditional_nlri_prefix.go b/gosnappi/bgp_one_traditional_nlri_prefix.go new file mode 100644 index 00000000..cb3760df --- /dev/null +++ b/gosnappi/bgp_one_traditional_nlri_prefix.go @@ -0,0 +1,410 @@ +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" +) + +// ***** BgpOneTraditionalNlriPrefix ***** +type bgpOneTraditionalNlriPrefix struct { + validation + obj *otg.BgpOneTraditionalNlriPrefix + marshaller marshalBgpOneTraditionalNlriPrefix + unMarshaller unMarshalBgpOneTraditionalNlriPrefix + pathIdHolder BgpNLRIPrefixPathId +} + +func NewBgpOneTraditionalNlriPrefix() BgpOneTraditionalNlriPrefix { + obj := bgpOneTraditionalNlriPrefix{obj: &otg.BgpOneTraditionalNlriPrefix{}} + obj.setDefault() + return &obj +} + +func (obj *bgpOneTraditionalNlriPrefix) msg() *otg.BgpOneTraditionalNlriPrefix { + return obj.obj +} + +func (obj *bgpOneTraditionalNlriPrefix) setMsg(msg *otg.BgpOneTraditionalNlriPrefix) BgpOneTraditionalNlriPrefix { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpOneTraditionalNlriPrefix struct { + obj *bgpOneTraditionalNlriPrefix +} + +type marshalBgpOneTraditionalNlriPrefix interface { + // ToProto marshals BgpOneTraditionalNlriPrefix to protobuf object *otg.BgpOneTraditionalNlriPrefix + ToProto() (*otg.BgpOneTraditionalNlriPrefix, error) + // ToPbText marshals BgpOneTraditionalNlriPrefix to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpOneTraditionalNlriPrefix to YAML text + ToYaml() (string, error) + // ToJson marshals BgpOneTraditionalNlriPrefix to JSON text + ToJson() (string, error) +} + +type unMarshalbgpOneTraditionalNlriPrefix struct { + obj *bgpOneTraditionalNlriPrefix +} + +type unMarshalBgpOneTraditionalNlriPrefix interface { + // FromProto unmarshals BgpOneTraditionalNlriPrefix from protobuf object *otg.BgpOneTraditionalNlriPrefix + FromProto(msg *otg.BgpOneTraditionalNlriPrefix) (BgpOneTraditionalNlriPrefix, error) + // FromPbText unmarshals BgpOneTraditionalNlriPrefix from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpOneTraditionalNlriPrefix from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpOneTraditionalNlriPrefix from JSON text + FromJson(value string) error +} + +func (obj *bgpOneTraditionalNlriPrefix) Marshal() marshalBgpOneTraditionalNlriPrefix { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpOneTraditionalNlriPrefix{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpOneTraditionalNlriPrefix) Unmarshal() unMarshalBgpOneTraditionalNlriPrefix { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpOneTraditionalNlriPrefix{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpOneTraditionalNlriPrefix) ToProto() (*otg.BgpOneTraditionalNlriPrefix, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpOneTraditionalNlriPrefix) FromProto(msg *otg.BgpOneTraditionalNlriPrefix) (BgpOneTraditionalNlriPrefix, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpOneTraditionalNlriPrefix) 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 *unMarshalbgpOneTraditionalNlriPrefix) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpOneTraditionalNlriPrefix) 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 *unMarshalbgpOneTraditionalNlriPrefix) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpOneTraditionalNlriPrefix) 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 *unMarshalbgpOneTraditionalNlriPrefix) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpOneTraditionalNlriPrefix) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpOneTraditionalNlriPrefix) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpOneTraditionalNlriPrefix) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpOneTraditionalNlriPrefix) Clone() (BgpOneTraditionalNlriPrefix, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpOneTraditionalNlriPrefix() + 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 +} + +func (obj *bgpOneTraditionalNlriPrefix) setNil() { + obj.pathIdHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpOneTraditionalNlriPrefix is tRADITIONAL_NLRI is an optional part of the the BGP Update which can carry only IPv4 prefix information as defined in https://www.rfc-editor.org/rfc/rfc4271.html#section-4.3 +// and extended by https://datatracker.ietf.org/doc/html/rfc7911#section-3 to carry additional Path Id information per prefix. +type BgpOneTraditionalNlriPrefix interface { + Validation + // msg marshals BgpOneTraditionalNlriPrefix to protobuf object *otg.BgpOneTraditionalNlriPrefix + // and doesn't set defaults + msg() *otg.BgpOneTraditionalNlriPrefix + // setMsg unmarshals BgpOneTraditionalNlriPrefix from protobuf object *otg.BgpOneTraditionalNlriPrefix + // and doesn't set defaults + setMsg(*otg.BgpOneTraditionalNlriPrefix) BgpOneTraditionalNlriPrefix + // provides marshal interface + Marshal() marshalBgpOneTraditionalNlriPrefix + // provides unmarshal interface + Unmarshal() unMarshalBgpOneTraditionalNlriPrefix + // validate validates BgpOneTraditionalNlriPrefix + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpOneTraditionalNlriPrefix, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Address returns string, set in BgpOneTraditionalNlriPrefix. + Address() string + // SetAddress assigns string provided by user to BgpOneTraditionalNlriPrefix + SetAddress(value string) BgpOneTraditionalNlriPrefix + // HasAddress checks if Address has been set in BgpOneTraditionalNlriPrefix + HasAddress() bool + // Prefix returns uint32, set in BgpOneTraditionalNlriPrefix. + Prefix() uint32 + // SetPrefix assigns uint32 provided by user to BgpOneTraditionalNlriPrefix + SetPrefix(value uint32) BgpOneTraditionalNlriPrefix + // HasPrefix checks if Prefix has been set in BgpOneTraditionalNlriPrefix + HasPrefix() bool + // PathId returns BgpNLRIPrefixPathId, set in BgpOneTraditionalNlriPrefix. + // BgpNLRIPrefixPathId is optional field in the NLRI carrying Path Id of the prefix. + PathId() BgpNLRIPrefixPathId + // SetPathId assigns BgpNLRIPrefixPathId provided by user to BgpOneTraditionalNlriPrefix. + // BgpNLRIPrefixPathId is optional field in the NLRI carrying Path Id of the prefix. + SetPathId(value BgpNLRIPrefixPathId) BgpOneTraditionalNlriPrefix + // HasPathId checks if PathId has been set in BgpOneTraditionalNlriPrefix + HasPathId() bool + setNil() +} + +// The IPv4 address of the network. +// Address returns a string +func (obj *bgpOneTraditionalNlriPrefix) Address() string { + + return *obj.obj.Address + +} + +// The IPv4 address of the network. +// Address returns a string +func (obj *bgpOneTraditionalNlriPrefix) HasAddress() bool { + return obj.obj.Address != nil +} + +// The IPv4 address of the network. +// SetAddress sets the string value in the BgpOneTraditionalNlriPrefix object +func (obj *bgpOneTraditionalNlriPrefix) SetAddress(value string) BgpOneTraditionalNlriPrefix { + + obj.obj.Address = &value + return obj +} + +// The IPv4 network prefix length to be applied to the address. +// Prefix returns a uint32 +func (obj *bgpOneTraditionalNlriPrefix) Prefix() uint32 { + + return *obj.obj.Prefix + +} + +// The IPv4 network prefix length to be applied to the address. +// Prefix returns a uint32 +func (obj *bgpOneTraditionalNlriPrefix) HasPrefix() bool { + return obj.obj.Prefix != nil +} + +// The IPv4 network prefix length to be applied to the address. +// SetPrefix sets the uint32 value in the BgpOneTraditionalNlriPrefix object +func (obj *bgpOneTraditionalNlriPrefix) SetPrefix(value uint32) BgpOneTraditionalNlriPrefix { + + obj.obj.Prefix = &value + return obj +} + +// description is TBD +// PathId returns a BgpNLRIPrefixPathId +func (obj *bgpOneTraditionalNlriPrefix) PathId() BgpNLRIPrefixPathId { + if obj.obj.PathId == nil { + obj.obj.PathId = NewBgpNLRIPrefixPathId().msg() + } + if obj.pathIdHolder == nil { + obj.pathIdHolder = &bgpNLRIPrefixPathId{obj: obj.obj.PathId} + } + return obj.pathIdHolder +} + +// description is TBD +// PathId returns a BgpNLRIPrefixPathId +func (obj *bgpOneTraditionalNlriPrefix) HasPathId() bool { + return obj.obj.PathId != nil +} + +// description is TBD +// SetPathId sets the BgpNLRIPrefixPathId value in the BgpOneTraditionalNlriPrefix object +func (obj *bgpOneTraditionalNlriPrefix) SetPathId(value BgpNLRIPrefixPathId) BgpOneTraditionalNlriPrefix { + + obj.pathIdHolder = nil + obj.obj.PathId = value.msg() + + return obj +} + +func (obj *bgpOneTraditionalNlriPrefix) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Address != nil { + + err := obj.validateIpv4(obj.Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpOneTraditionalNlriPrefix.Address")) + } + + } + + if obj.obj.Prefix != nil { + + if *obj.obj.Prefix > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpOneTraditionalNlriPrefix.Prefix <= 32 but Got %d", *obj.obj.Prefix)) + } + + } + + if obj.obj.PathId != nil { + + obj.PathId().validateObj(vObj, set_default) + } + +} + +func (obj *bgpOneTraditionalNlriPrefix) setDefault() { + if obj.obj.Address == nil { + obj.SetAddress("0.0.0.0") + } + if obj.obj.Prefix == nil { + obj.SetPrefix(24) + } + +} diff --git a/gosnappi/bgp_one_update_replay.go b/gosnappi/bgp_one_update_replay.go new file mode 100644 index 00000000..0998a268 --- /dev/null +++ b/gosnappi/bgp_one_update_replay.go @@ -0,0 +1,345 @@ +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" +) + +// ***** BgpOneUpdateReplay ***** +type bgpOneUpdateReplay struct { + validation + obj *otg.BgpOneUpdateReplay + marshaller marshalBgpOneUpdateReplay + unMarshaller unMarshalBgpOneUpdateReplay +} + +func NewBgpOneUpdateReplay() BgpOneUpdateReplay { + obj := bgpOneUpdateReplay{obj: &otg.BgpOneUpdateReplay{}} + obj.setDefault() + return &obj +} + +func (obj *bgpOneUpdateReplay) msg() *otg.BgpOneUpdateReplay { + return obj.obj +} + +func (obj *bgpOneUpdateReplay) setMsg(msg *otg.BgpOneUpdateReplay) BgpOneUpdateReplay { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpOneUpdateReplay struct { + obj *bgpOneUpdateReplay +} + +type marshalBgpOneUpdateReplay interface { + // ToProto marshals BgpOneUpdateReplay to protobuf object *otg.BgpOneUpdateReplay + ToProto() (*otg.BgpOneUpdateReplay, error) + // ToPbText marshals BgpOneUpdateReplay to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpOneUpdateReplay to YAML text + ToYaml() (string, error) + // ToJson marshals BgpOneUpdateReplay to JSON text + ToJson() (string, error) +} + +type unMarshalbgpOneUpdateReplay struct { + obj *bgpOneUpdateReplay +} + +type unMarshalBgpOneUpdateReplay interface { + // FromProto unmarshals BgpOneUpdateReplay from protobuf object *otg.BgpOneUpdateReplay + FromProto(msg *otg.BgpOneUpdateReplay) (BgpOneUpdateReplay, error) + // FromPbText unmarshals BgpOneUpdateReplay from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpOneUpdateReplay from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpOneUpdateReplay from JSON text + FromJson(value string) error +} + +func (obj *bgpOneUpdateReplay) Marshal() marshalBgpOneUpdateReplay { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpOneUpdateReplay{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpOneUpdateReplay) Unmarshal() unMarshalBgpOneUpdateReplay { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpOneUpdateReplay{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpOneUpdateReplay) ToProto() (*otg.BgpOneUpdateReplay, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpOneUpdateReplay) FromProto(msg *otg.BgpOneUpdateReplay) (BgpOneUpdateReplay, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpOneUpdateReplay) 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 *unMarshalbgpOneUpdateReplay) 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 *marshalbgpOneUpdateReplay) 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 *unMarshalbgpOneUpdateReplay) 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 *marshalbgpOneUpdateReplay) 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 *unMarshalbgpOneUpdateReplay) 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 *bgpOneUpdateReplay) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpOneUpdateReplay) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpOneUpdateReplay) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpOneUpdateReplay) Clone() (BgpOneUpdateReplay, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpOneUpdateReplay() + 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 +} + +// BgpOneUpdateReplay is specification of one BGP Update to be sent to the BGP peer. +type BgpOneUpdateReplay interface { + Validation + // msg marshals BgpOneUpdateReplay to protobuf object *otg.BgpOneUpdateReplay + // and doesn't set defaults + msg() *otg.BgpOneUpdateReplay + // setMsg unmarshals BgpOneUpdateReplay from protobuf object *otg.BgpOneUpdateReplay + // and doesn't set defaults + setMsg(*otg.BgpOneUpdateReplay) BgpOneUpdateReplay + // provides marshal interface + Marshal() marshalBgpOneUpdateReplay + // provides unmarshal interface + Unmarshal() unMarshalBgpOneUpdateReplay + // validate validates BgpOneUpdateReplay + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpOneUpdateReplay, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // TimeGap returns uint32, set in BgpOneUpdateReplay. + TimeGap() uint32 + // SetTimeGap assigns uint32 provided by user to BgpOneUpdateReplay + SetTimeGap(value uint32) BgpOneUpdateReplay + // HasTimeGap checks if TimeGap has been set in BgpOneUpdateReplay + HasTimeGap() bool + // UpdateBytes returns string, set in BgpOneUpdateReplay. + UpdateBytes() string + // SetUpdateBytes assigns string provided by user to BgpOneUpdateReplay + SetUpdateBytes(value string) BgpOneUpdateReplay +} + +// Minimum time interval in milliseconds from previous Update from the sequence of BGP Updates to be replayed. +// TimeGap returns a uint32 +func (obj *bgpOneUpdateReplay) TimeGap() uint32 { + + return *obj.obj.TimeGap + +} + +// Minimum time interval in milliseconds from previous Update from the sequence of BGP Updates to be replayed. +// TimeGap returns a uint32 +func (obj *bgpOneUpdateReplay) HasTimeGap() bool { + return obj.obj.TimeGap != nil +} + +// Minimum time interval in milliseconds from previous Update from the sequence of BGP Updates to be replayed. +// SetTimeGap sets the uint32 value in the BgpOneUpdateReplay object +func (obj *bgpOneUpdateReplay) SetTimeGap(value uint32) BgpOneUpdateReplay { + + obj.obj.TimeGap = &value + return obj +} + +// Bytes specified in hex format to be sent to peer after the BGP Update Header. The Update Header will always have the initial 16 bytes containing Marker bytes, 2 bytes containing the Length and 1 byte containing the Type.The string MUST contain sequence of valid hex bytes. The bytes specified in hex format should be appended to the Update message to be sent to the peer after the fixed 19 bytes described above. This byte stream can be of any length from 1 to 4077 bytes.The value 4077 is derived from the maximum length allowed for a BGP message in RFC4271 which is 4096 minus mandatory 19 bytes described above. In the imported byte stream, one byte is represented as string of 2 characters, for example 2 character string (0x)AB represents value of a single byte. So the maximum length of this attribute is 8154 (4077 * 2 hex characters per byte). +// UpdateBytes returns a string +func (obj *bgpOneUpdateReplay) UpdateBytes() string { + + return *obj.obj.UpdateBytes + +} + +// Bytes specified in hex format to be sent to peer after the BGP Update Header. The Update Header will always have the initial 16 bytes containing Marker bytes, 2 bytes containing the Length and 1 byte containing the Type.The string MUST contain sequence of valid hex bytes. The bytes specified in hex format should be appended to the Update message to be sent to the peer after the fixed 19 bytes described above. This byte stream can be of any length from 1 to 4077 bytes.The value 4077 is derived from the maximum length allowed for a BGP message in RFC4271 which is 4096 minus mandatory 19 bytes described above. In the imported byte stream, one byte is represented as string of 2 characters, for example 2 character string (0x)AB represents value of a single byte. So the maximum length of this attribute is 8154 (4077 * 2 hex characters per byte). +// SetUpdateBytes sets the string value in the BgpOneUpdateReplay object +func (obj *bgpOneUpdateReplay) SetUpdateBytes(value string) BgpOneUpdateReplay { + + obj.obj.UpdateBytes = &value + return obj +} + +func (obj *bgpOneUpdateReplay) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // UpdateBytes is required + if obj.obj.UpdateBytes == nil { + vObj.validationErrors = append(vObj.validationErrors, "UpdateBytes is required field on interface BgpOneUpdateReplay") + } + if obj.obj.UpdateBytes != nil { + + if len(*obj.obj.UpdateBytes) < 1 || len(*obj.obj.UpdateBytes) > 8154 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "1 <= length of BgpOneUpdateReplay.UpdateBytes <= 8154 but Got %d", + len(*obj.obj.UpdateBytes))) + } + + } + +} + +func (obj *bgpOneUpdateReplay) setDefault() { + if obj.obj.TimeGap == nil { + obj.SetTimeGap(0) + } + +} diff --git a/gosnappi/bgp_prefix_ipv4_unicast_filter.go b/gosnappi/bgp_prefix_ipv4_unicast_filter.go new file mode 100644 index 00000000..54e035f0 --- /dev/null +++ b/gosnappi/bgp_prefix_ipv4_unicast_filter.go @@ -0,0 +1,420 @@ +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" +) + +// ***** BgpPrefixIpv4UnicastFilter ***** +type bgpPrefixIpv4UnicastFilter struct { + validation + obj *otg.BgpPrefixIpv4UnicastFilter + marshaller marshalBgpPrefixIpv4UnicastFilter + unMarshaller unMarshalBgpPrefixIpv4UnicastFilter +} + +func NewBgpPrefixIpv4UnicastFilter() BgpPrefixIpv4UnicastFilter { + obj := bgpPrefixIpv4UnicastFilter{obj: &otg.BgpPrefixIpv4UnicastFilter{}} + obj.setDefault() + return &obj +} + +func (obj *bgpPrefixIpv4UnicastFilter) msg() *otg.BgpPrefixIpv4UnicastFilter { + return obj.obj +} + +func (obj *bgpPrefixIpv4UnicastFilter) setMsg(msg *otg.BgpPrefixIpv4UnicastFilter) BgpPrefixIpv4UnicastFilter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpPrefixIpv4UnicastFilter struct { + obj *bgpPrefixIpv4UnicastFilter +} + +type marshalBgpPrefixIpv4UnicastFilter interface { + // ToProto marshals BgpPrefixIpv4UnicastFilter to protobuf object *otg.BgpPrefixIpv4UnicastFilter + ToProto() (*otg.BgpPrefixIpv4UnicastFilter, error) + // ToPbText marshals BgpPrefixIpv4UnicastFilter to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpPrefixIpv4UnicastFilter to YAML text + ToYaml() (string, error) + // ToJson marshals BgpPrefixIpv4UnicastFilter to JSON text + ToJson() (string, error) +} + +type unMarshalbgpPrefixIpv4UnicastFilter struct { + obj *bgpPrefixIpv4UnicastFilter +} + +type unMarshalBgpPrefixIpv4UnicastFilter interface { + // FromProto unmarshals BgpPrefixIpv4UnicastFilter from protobuf object *otg.BgpPrefixIpv4UnicastFilter + FromProto(msg *otg.BgpPrefixIpv4UnicastFilter) (BgpPrefixIpv4UnicastFilter, error) + // FromPbText unmarshals BgpPrefixIpv4UnicastFilter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpPrefixIpv4UnicastFilter from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpPrefixIpv4UnicastFilter from JSON text + FromJson(value string) error +} + +func (obj *bgpPrefixIpv4UnicastFilter) Marshal() marshalBgpPrefixIpv4UnicastFilter { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpPrefixIpv4UnicastFilter{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpPrefixIpv4UnicastFilter) Unmarshal() unMarshalBgpPrefixIpv4UnicastFilter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpPrefixIpv4UnicastFilter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpPrefixIpv4UnicastFilter) ToProto() (*otg.BgpPrefixIpv4UnicastFilter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpPrefixIpv4UnicastFilter) FromProto(msg *otg.BgpPrefixIpv4UnicastFilter) (BgpPrefixIpv4UnicastFilter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpPrefixIpv4UnicastFilter) 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 *unMarshalbgpPrefixIpv4UnicastFilter) 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 *marshalbgpPrefixIpv4UnicastFilter) 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 *unMarshalbgpPrefixIpv4UnicastFilter) 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 *marshalbgpPrefixIpv4UnicastFilter) 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 *unMarshalbgpPrefixIpv4UnicastFilter) 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 *bgpPrefixIpv4UnicastFilter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpPrefixIpv4UnicastFilter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpPrefixIpv4UnicastFilter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpPrefixIpv4UnicastFilter) Clone() (BgpPrefixIpv4UnicastFilter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpPrefixIpv4UnicastFilter() + 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 +} + +// BgpPrefixIpv4UnicastFilter is description is TBD +type BgpPrefixIpv4UnicastFilter interface { + Validation + // msg marshals BgpPrefixIpv4UnicastFilter to protobuf object *otg.BgpPrefixIpv4UnicastFilter + // and doesn't set defaults + msg() *otg.BgpPrefixIpv4UnicastFilter + // setMsg unmarshals BgpPrefixIpv4UnicastFilter from protobuf object *otg.BgpPrefixIpv4UnicastFilter + // and doesn't set defaults + setMsg(*otg.BgpPrefixIpv4UnicastFilter) BgpPrefixIpv4UnicastFilter + // provides marshal interface + Marshal() marshalBgpPrefixIpv4UnicastFilter + // provides unmarshal interface + Unmarshal() unMarshalBgpPrefixIpv4UnicastFilter + // validate validates BgpPrefixIpv4UnicastFilter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpPrefixIpv4UnicastFilter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Addresses returns []string, set in BgpPrefixIpv4UnicastFilter. + Addresses() []string + // SetAddresses assigns []string provided by user to BgpPrefixIpv4UnicastFilter + SetAddresses(value []string) BgpPrefixIpv4UnicastFilter + // PrefixLength returns uint32, set in BgpPrefixIpv4UnicastFilter. + PrefixLength() uint32 + // SetPrefixLength assigns uint32 provided by user to BgpPrefixIpv4UnicastFilter + SetPrefixLength(value uint32) BgpPrefixIpv4UnicastFilter + // HasPrefixLength checks if PrefixLength has been set in BgpPrefixIpv4UnicastFilter + HasPrefixLength() bool + // Origin returns BgpPrefixIpv4UnicastFilterOriginEnum, set in BgpPrefixIpv4UnicastFilter + Origin() BgpPrefixIpv4UnicastFilterOriginEnum + // SetOrigin assigns BgpPrefixIpv4UnicastFilterOriginEnum provided by user to BgpPrefixIpv4UnicastFilter + SetOrigin(value BgpPrefixIpv4UnicastFilterOriginEnum) BgpPrefixIpv4UnicastFilter + // HasOrigin checks if Origin has been set in BgpPrefixIpv4UnicastFilter + HasOrigin() bool + // PathId returns uint32, set in BgpPrefixIpv4UnicastFilter. + PathId() uint32 + // SetPathId assigns uint32 provided by user to BgpPrefixIpv4UnicastFilter + SetPathId(value uint32) BgpPrefixIpv4UnicastFilter + // HasPathId checks if PathId has been set in BgpPrefixIpv4UnicastFilter + HasPathId() bool +} + +// The addresses to match. If the addresses property is missing or empty then all addresses will match. +// Addresses returns a []string +func (obj *bgpPrefixIpv4UnicastFilter) Addresses() []string { + if obj.obj.Addresses == nil { + obj.obj.Addresses = make([]string, 0) + } + return obj.obj.Addresses +} + +// The addresses to match. If the addresses property is missing or empty then all addresses will match. +// SetAddresses sets the []string value in the BgpPrefixIpv4UnicastFilter object +func (obj *bgpPrefixIpv4UnicastFilter) SetAddresses(value []string) BgpPrefixIpv4UnicastFilter { + + if obj.obj.Addresses == nil { + obj.obj.Addresses = make([]string, 0) + } + obj.obj.Addresses = value + + return obj +} + +// The prefix length to match. If the prefix length is missing then all prefix lengths will match. +// PrefixLength returns a uint32 +func (obj *bgpPrefixIpv4UnicastFilter) PrefixLength() uint32 { + + return *obj.obj.PrefixLength + +} + +// The prefix length to match. If the prefix length is missing then all prefix lengths will match. +// PrefixLength returns a uint32 +func (obj *bgpPrefixIpv4UnicastFilter) HasPrefixLength() bool { + return obj.obj.PrefixLength != nil +} + +// The prefix length to match. If the prefix length is missing then all prefix lengths will match. +// SetPrefixLength sets the uint32 value in the BgpPrefixIpv4UnicastFilter object +func (obj *bgpPrefixIpv4UnicastFilter) SetPrefixLength(value uint32) BgpPrefixIpv4UnicastFilter { + + obj.obj.PrefixLength = &value + return obj +} + +type BgpPrefixIpv4UnicastFilterOriginEnum string + +// Enum of Origin on BgpPrefixIpv4UnicastFilter +var BgpPrefixIpv4UnicastFilterOrigin = struct { + IGP BgpPrefixIpv4UnicastFilterOriginEnum + EGP BgpPrefixIpv4UnicastFilterOriginEnum + INCOMPLETE BgpPrefixIpv4UnicastFilterOriginEnum +}{ + IGP: BgpPrefixIpv4UnicastFilterOriginEnum("igp"), + EGP: BgpPrefixIpv4UnicastFilterOriginEnum("egp"), + INCOMPLETE: BgpPrefixIpv4UnicastFilterOriginEnum("incomplete"), +} + +func (obj *bgpPrefixIpv4UnicastFilter) Origin() BgpPrefixIpv4UnicastFilterOriginEnum { + return BgpPrefixIpv4UnicastFilterOriginEnum(obj.obj.Origin.Enum().String()) +} + +// The origin to match. If the origin is missing then all origins will match. +// Origin returns a string +func (obj *bgpPrefixIpv4UnicastFilter) HasOrigin() bool { + return obj.obj.Origin != nil +} + +func (obj *bgpPrefixIpv4UnicastFilter) SetOrigin(value BgpPrefixIpv4UnicastFilterOriginEnum) BgpPrefixIpv4UnicastFilter { + intValue, ok := otg.BgpPrefixIpv4UnicastFilter_Origin_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpPrefixIpv4UnicastFilterOriginEnum", string(value))) + return obj + } + enumValue := otg.BgpPrefixIpv4UnicastFilter_Origin_Enum(intValue) + obj.obj.Origin = &enumValue + + return obj +} + +// The path id to match. If the path id is missing then all path ids will match. +// PathId returns a uint32 +func (obj *bgpPrefixIpv4UnicastFilter) PathId() uint32 { + + return *obj.obj.PathId + +} + +// The path id to match. If the path id is missing then all path ids will match. +// PathId returns a uint32 +func (obj *bgpPrefixIpv4UnicastFilter) HasPathId() bool { + return obj.obj.PathId != nil +} + +// The path id to match. If the path id is missing then all path ids will match. +// SetPathId sets the uint32 value in the BgpPrefixIpv4UnicastFilter object +func (obj *bgpPrefixIpv4UnicastFilter) SetPathId(value uint32) BgpPrefixIpv4UnicastFilter { + + obj.obj.PathId = &value + return obj +} + +func (obj *bgpPrefixIpv4UnicastFilter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Addresses != nil { + + err := obj.validateIpv4Slice(obj.Addresses()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpPrefixIpv4UnicastFilter.Addresses")) + } + + } + + if obj.obj.PrefixLength != nil { + + if *obj.obj.PrefixLength > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpPrefixIpv4UnicastFilter.PrefixLength <= 128 but Got %d", *obj.obj.PrefixLength)) + } + + } + +} + +func (obj *bgpPrefixIpv4UnicastFilter) setDefault() { + +} diff --git a/gosnappi/bgp_prefix_ipv4_unicast_state.go b/gosnappi/bgp_prefix_ipv4_unicast_state.go new file mode 100644 index 00000000..5fb8fe97 --- /dev/null +++ b/gosnappi/bgp_prefix_ipv4_unicast_state.go @@ -0,0 +1,804 @@ +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" +) + +// ***** BgpPrefixIpv4UnicastState ***** +type bgpPrefixIpv4UnicastState struct { + validation + obj *otg.BgpPrefixIpv4UnicastState + marshaller marshalBgpPrefixIpv4UnicastState + unMarshaller unMarshalBgpPrefixIpv4UnicastState + communitiesHolder BgpPrefixIpv4UnicastStateResultBgpCommunityIter + extendedCommunitiesHolder BgpPrefixIpv4UnicastStateResultExtendedCommunityIter + asPathHolder ResultBgpAsPath +} + +func NewBgpPrefixIpv4UnicastState() BgpPrefixIpv4UnicastState { + obj := bgpPrefixIpv4UnicastState{obj: &otg.BgpPrefixIpv4UnicastState{}} + obj.setDefault() + return &obj +} + +func (obj *bgpPrefixIpv4UnicastState) msg() *otg.BgpPrefixIpv4UnicastState { + return obj.obj +} + +func (obj *bgpPrefixIpv4UnicastState) setMsg(msg *otg.BgpPrefixIpv4UnicastState) BgpPrefixIpv4UnicastState { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpPrefixIpv4UnicastState struct { + obj *bgpPrefixIpv4UnicastState +} + +type marshalBgpPrefixIpv4UnicastState interface { + // ToProto marshals BgpPrefixIpv4UnicastState to protobuf object *otg.BgpPrefixIpv4UnicastState + ToProto() (*otg.BgpPrefixIpv4UnicastState, error) + // ToPbText marshals BgpPrefixIpv4UnicastState to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpPrefixIpv4UnicastState to YAML text + ToYaml() (string, error) + // ToJson marshals BgpPrefixIpv4UnicastState to JSON text + ToJson() (string, error) +} + +type unMarshalbgpPrefixIpv4UnicastState struct { + obj *bgpPrefixIpv4UnicastState +} + +type unMarshalBgpPrefixIpv4UnicastState interface { + // FromProto unmarshals BgpPrefixIpv4UnicastState from protobuf object *otg.BgpPrefixIpv4UnicastState + FromProto(msg *otg.BgpPrefixIpv4UnicastState) (BgpPrefixIpv4UnicastState, error) + // FromPbText unmarshals BgpPrefixIpv4UnicastState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpPrefixIpv4UnicastState from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpPrefixIpv4UnicastState from JSON text + FromJson(value string) error +} + +func (obj *bgpPrefixIpv4UnicastState) Marshal() marshalBgpPrefixIpv4UnicastState { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpPrefixIpv4UnicastState{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpPrefixIpv4UnicastState) Unmarshal() unMarshalBgpPrefixIpv4UnicastState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpPrefixIpv4UnicastState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpPrefixIpv4UnicastState) ToProto() (*otg.BgpPrefixIpv4UnicastState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpPrefixIpv4UnicastState) FromProto(msg *otg.BgpPrefixIpv4UnicastState) (BgpPrefixIpv4UnicastState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpPrefixIpv4UnicastState) 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 *unMarshalbgpPrefixIpv4UnicastState) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpPrefixIpv4UnicastState) 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 *unMarshalbgpPrefixIpv4UnicastState) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpPrefixIpv4UnicastState) 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 *unMarshalbgpPrefixIpv4UnicastState) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpPrefixIpv4UnicastState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpPrefixIpv4UnicastState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpPrefixIpv4UnicastState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpPrefixIpv4UnicastState) Clone() (BgpPrefixIpv4UnicastState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpPrefixIpv4UnicastState() + 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 +} + +func (obj *bgpPrefixIpv4UnicastState) setNil() { + obj.communitiesHolder = nil + obj.extendedCommunitiesHolder = nil + obj.asPathHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpPrefixIpv4UnicastState is iPv4 unicast prefix. +type BgpPrefixIpv4UnicastState interface { + Validation + // msg marshals BgpPrefixIpv4UnicastState to protobuf object *otg.BgpPrefixIpv4UnicastState + // and doesn't set defaults + msg() *otg.BgpPrefixIpv4UnicastState + // setMsg unmarshals BgpPrefixIpv4UnicastState from protobuf object *otg.BgpPrefixIpv4UnicastState + // and doesn't set defaults + setMsg(*otg.BgpPrefixIpv4UnicastState) BgpPrefixIpv4UnicastState + // provides marshal interface + Marshal() marshalBgpPrefixIpv4UnicastState + // provides unmarshal interface + Unmarshal() unMarshalBgpPrefixIpv4UnicastState + // validate validates BgpPrefixIpv4UnicastState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpPrefixIpv4UnicastState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv4Address returns string, set in BgpPrefixIpv4UnicastState. + Ipv4Address() string + // SetIpv4Address assigns string provided by user to BgpPrefixIpv4UnicastState + SetIpv4Address(value string) BgpPrefixIpv4UnicastState + // HasIpv4Address checks if Ipv4Address has been set in BgpPrefixIpv4UnicastState + HasIpv4Address() bool + // PrefixLength returns uint32, set in BgpPrefixIpv4UnicastState. + PrefixLength() uint32 + // SetPrefixLength assigns uint32 provided by user to BgpPrefixIpv4UnicastState + SetPrefixLength(value uint32) BgpPrefixIpv4UnicastState + // HasPrefixLength checks if PrefixLength has been set in BgpPrefixIpv4UnicastState + HasPrefixLength() bool + // Origin returns BgpPrefixIpv4UnicastStateOriginEnum, set in BgpPrefixIpv4UnicastState + Origin() BgpPrefixIpv4UnicastStateOriginEnum + // SetOrigin assigns BgpPrefixIpv4UnicastStateOriginEnum provided by user to BgpPrefixIpv4UnicastState + SetOrigin(value BgpPrefixIpv4UnicastStateOriginEnum) BgpPrefixIpv4UnicastState + // HasOrigin checks if Origin has been set in BgpPrefixIpv4UnicastState + HasOrigin() bool + // PathId returns uint32, set in BgpPrefixIpv4UnicastState. + PathId() uint32 + // SetPathId assigns uint32 provided by user to BgpPrefixIpv4UnicastState + SetPathId(value uint32) BgpPrefixIpv4UnicastState + // HasPathId checks if PathId has been set in BgpPrefixIpv4UnicastState + HasPathId() bool + // Ipv4NextHop returns string, set in BgpPrefixIpv4UnicastState. + Ipv4NextHop() string + // SetIpv4NextHop assigns string provided by user to BgpPrefixIpv4UnicastState + SetIpv4NextHop(value string) BgpPrefixIpv4UnicastState + // HasIpv4NextHop checks if Ipv4NextHop has been set in BgpPrefixIpv4UnicastState + HasIpv4NextHop() bool + // Ipv6NextHop returns string, set in BgpPrefixIpv4UnicastState. + Ipv6NextHop() string + // SetIpv6NextHop assigns string provided by user to BgpPrefixIpv4UnicastState + SetIpv6NextHop(value string) BgpPrefixIpv4UnicastState + // HasIpv6NextHop checks if Ipv6NextHop has been set in BgpPrefixIpv4UnicastState + HasIpv6NextHop() bool + // Communities returns BgpPrefixIpv4UnicastStateResultBgpCommunityIterIter, set in BgpPrefixIpv4UnicastState + Communities() BgpPrefixIpv4UnicastStateResultBgpCommunityIter + // ExtendedCommunities returns BgpPrefixIpv4UnicastStateResultExtendedCommunityIterIter, set in BgpPrefixIpv4UnicastState + ExtendedCommunities() BgpPrefixIpv4UnicastStateResultExtendedCommunityIter + // AsPath returns ResultBgpAsPath, set in BgpPrefixIpv4UnicastState. + // ResultBgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. + AsPath() ResultBgpAsPath + // SetAsPath assigns ResultBgpAsPath provided by user to BgpPrefixIpv4UnicastState. + // ResultBgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. + SetAsPath(value ResultBgpAsPath) BgpPrefixIpv4UnicastState + // HasAsPath checks if AsPath has been set in BgpPrefixIpv4UnicastState + HasAsPath() bool + // LocalPreference returns uint32, set in BgpPrefixIpv4UnicastState. + LocalPreference() uint32 + // SetLocalPreference assigns uint32 provided by user to BgpPrefixIpv4UnicastState + SetLocalPreference(value uint32) BgpPrefixIpv4UnicastState + // HasLocalPreference checks if LocalPreference has been set in BgpPrefixIpv4UnicastState + HasLocalPreference() bool + // MultiExitDiscriminator returns uint32, set in BgpPrefixIpv4UnicastState. + MultiExitDiscriminator() uint32 + // SetMultiExitDiscriminator assigns uint32 provided by user to BgpPrefixIpv4UnicastState + SetMultiExitDiscriminator(value uint32) BgpPrefixIpv4UnicastState + // HasMultiExitDiscriminator checks if MultiExitDiscriminator has been set in BgpPrefixIpv4UnicastState + HasMultiExitDiscriminator() bool + setNil() +} + +// An IPv4 unicast address +// Ipv4Address returns a string +func (obj *bgpPrefixIpv4UnicastState) Ipv4Address() string { + + return *obj.obj.Ipv4Address + +} + +// An IPv4 unicast address +// Ipv4Address returns a string +func (obj *bgpPrefixIpv4UnicastState) HasIpv4Address() bool { + return obj.obj.Ipv4Address != nil +} + +// An IPv4 unicast address +// SetIpv4Address sets the string value in the BgpPrefixIpv4UnicastState object +func (obj *bgpPrefixIpv4UnicastState) SetIpv4Address(value string) BgpPrefixIpv4UnicastState { + + obj.obj.Ipv4Address = &value + return obj +} + +// The length of the prefix. +// PrefixLength returns a uint32 +func (obj *bgpPrefixIpv4UnicastState) PrefixLength() uint32 { + + return *obj.obj.PrefixLength + +} + +// The length of the prefix. +// PrefixLength returns a uint32 +func (obj *bgpPrefixIpv4UnicastState) HasPrefixLength() bool { + return obj.obj.PrefixLength != nil +} + +// The length of the prefix. +// SetPrefixLength sets the uint32 value in the BgpPrefixIpv4UnicastState object +func (obj *bgpPrefixIpv4UnicastState) SetPrefixLength(value uint32) BgpPrefixIpv4UnicastState { + + obj.obj.PrefixLength = &value + return obj +} + +type BgpPrefixIpv4UnicastStateOriginEnum string + +// Enum of Origin on BgpPrefixIpv4UnicastState +var BgpPrefixIpv4UnicastStateOrigin = struct { + IGP BgpPrefixIpv4UnicastStateOriginEnum + EGP BgpPrefixIpv4UnicastStateOriginEnum + INCOMPLETE BgpPrefixIpv4UnicastStateOriginEnum +}{ + IGP: BgpPrefixIpv4UnicastStateOriginEnum("igp"), + EGP: BgpPrefixIpv4UnicastStateOriginEnum("egp"), + INCOMPLETE: BgpPrefixIpv4UnicastStateOriginEnum("incomplete"), +} + +func (obj *bgpPrefixIpv4UnicastState) Origin() BgpPrefixIpv4UnicastStateOriginEnum { + return BgpPrefixIpv4UnicastStateOriginEnum(obj.obj.Origin.Enum().String()) +} + +// The origin of the prefix. +// Origin returns a string +func (obj *bgpPrefixIpv4UnicastState) HasOrigin() bool { + return obj.obj.Origin != nil +} + +func (obj *bgpPrefixIpv4UnicastState) SetOrigin(value BgpPrefixIpv4UnicastStateOriginEnum) BgpPrefixIpv4UnicastState { + intValue, ok := otg.BgpPrefixIpv4UnicastState_Origin_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpPrefixIpv4UnicastStateOriginEnum", string(value))) + return obj + } + enumValue := otg.BgpPrefixIpv4UnicastState_Origin_Enum(intValue) + obj.obj.Origin = &enumValue + + return obj +} + +// The path id. +// PathId returns a uint32 +func (obj *bgpPrefixIpv4UnicastState) PathId() uint32 { + + return *obj.obj.PathId + +} + +// The path id. +// PathId returns a uint32 +func (obj *bgpPrefixIpv4UnicastState) HasPathId() bool { + return obj.obj.PathId != nil +} + +// The path id. +// SetPathId sets the uint32 value in the BgpPrefixIpv4UnicastState object +func (obj *bgpPrefixIpv4UnicastState) SetPathId(value uint32) BgpPrefixIpv4UnicastState { + + obj.obj.PathId = &value + return obj +} + +// The IPv4 address of the egress interface. +// Ipv4NextHop returns a string +func (obj *bgpPrefixIpv4UnicastState) Ipv4NextHop() string { + + return *obj.obj.Ipv4NextHop + +} + +// The IPv4 address of the egress interface. +// Ipv4NextHop returns a string +func (obj *bgpPrefixIpv4UnicastState) HasIpv4NextHop() bool { + return obj.obj.Ipv4NextHop != nil +} + +// The IPv4 address of the egress interface. +// SetIpv4NextHop sets the string value in the BgpPrefixIpv4UnicastState object +func (obj *bgpPrefixIpv4UnicastState) SetIpv4NextHop(value string) BgpPrefixIpv4UnicastState { + + obj.obj.Ipv4NextHop = &value + return obj +} + +// The IPv6 address of the egress interface. +// Ipv6NextHop returns a string +func (obj *bgpPrefixIpv4UnicastState) Ipv6NextHop() string { + + return *obj.obj.Ipv6NextHop + +} + +// The IPv6 address of the egress interface. +// Ipv6NextHop returns a string +func (obj *bgpPrefixIpv4UnicastState) HasIpv6NextHop() bool { + return obj.obj.Ipv6NextHop != nil +} + +// The IPv6 address of the egress interface. +// SetIpv6NextHop sets the string value in the BgpPrefixIpv4UnicastState object +func (obj *bgpPrefixIpv4UnicastState) SetIpv6NextHop(value string) BgpPrefixIpv4UnicastState { + + obj.obj.Ipv6NextHop = &value + return obj +} + +// Optional community attributes. +// Communities returns a []ResultBgpCommunity +func (obj *bgpPrefixIpv4UnicastState) Communities() BgpPrefixIpv4UnicastStateResultBgpCommunityIter { + if len(obj.obj.Communities) == 0 { + obj.obj.Communities = []*otg.ResultBgpCommunity{} + } + if obj.communitiesHolder == nil { + obj.communitiesHolder = newBgpPrefixIpv4UnicastStateResultBgpCommunityIter(&obj.obj.Communities).setMsg(obj) + } + return obj.communitiesHolder +} + +type bgpPrefixIpv4UnicastStateResultBgpCommunityIter struct { + obj *bgpPrefixIpv4UnicastState + resultBgpCommunitySlice []ResultBgpCommunity + fieldPtr *[]*otg.ResultBgpCommunity +} + +func newBgpPrefixIpv4UnicastStateResultBgpCommunityIter(ptr *[]*otg.ResultBgpCommunity) BgpPrefixIpv4UnicastStateResultBgpCommunityIter { + return &bgpPrefixIpv4UnicastStateResultBgpCommunityIter{fieldPtr: ptr} +} + +type BgpPrefixIpv4UnicastStateResultBgpCommunityIter interface { + setMsg(*bgpPrefixIpv4UnicastState) BgpPrefixIpv4UnicastStateResultBgpCommunityIter + Items() []ResultBgpCommunity + Add() ResultBgpCommunity + Append(items ...ResultBgpCommunity) BgpPrefixIpv4UnicastStateResultBgpCommunityIter + Set(index int, newObj ResultBgpCommunity) BgpPrefixIpv4UnicastStateResultBgpCommunityIter + Clear() BgpPrefixIpv4UnicastStateResultBgpCommunityIter + clearHolderSlice() BgpPrefixIpv4UnicastStateResultBgpCommunityIter + appendHolderSlice(item ResultBgpCommunity) BgpPrefixIpv4UnicastStateResultBgpCommunityIter +} + +func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) setMsg(msg *bgpPrefixIpv4UnicastState) BgpPrefixIpv4UnicastStateResultBgpCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&resultBgpCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) Items() []ResultBgpCommunity { + return obj.resultBgpCommunitySlice +} + +func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) Add() ResultBgpCommunity { + newObj := &otg.ResultBgpCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &resultBgpCommunity{obj: newObj} + newLibObj.setDefault() + obj.resultBgpCommunitySlice = append(obj.resultBgpCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) Append(items ...ResultBgpCommunity) BgpPrefixIpv4UnicastStateResultBgpCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.resultBgpCommunitySlice = append(obj.resultBgpCommunitySlice, item) + } + return obj +} + +func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) Set(index int, newObj ResultBgpCommunity) BgpPrefixIpv4UnicastStateResultBgpCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.resultBgpCommunitySlice[index] = newObj + return obj +} +func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) Clear() BgpPrefixIpv4UnicastStateResultBgpCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.ResultBgpCommunity{} + obj.resultBgpCommunitySlice = []ResultBgpCommunity{} + } + return obj +} +func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) clearHolderSlice() BgpPrefixIpv4UnicastStateResultBgpCommunityIter { + if len(obj.resultBgpCommunitySlice) > 0 { + obj.resultBgpCommunitySlice = []ResultBgpCommunity{} + } + return obj +} +func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) appendHolderSlice(item ResultBgpCommunity) BgpPrefixIpv4UnicastStateResultBgpCommunityIter { + obj.resultBgpCommunitySlice = append(obj.resultBgpCommunitySlice, item) + return obj +} + +// Optional received Extended Community attributes. Each received Extended Community attribute is available for retrieval in two forms. Support of the 'raw' format in which all 8 bytes (16 hex characters) is always present and available for use. In addition, if supported by the implementation, the Extended Community attribute may also be retrieved in the 'structured' format which is an optional field. +// ExtendedCommunities returns a []ResultExtendedCommunity +func (obj *bgpPrefixIpv4UnicastState) ExtendedCommunities() BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { + if len(obj.obj.ExtendedCommunities) == 0 { + obj.obj.ExtendedCommunities = []*otg.ResultExtendedCommunity{} + } + if obj.extendedCommunitiesHolder == nil { + obj.extendedCommunitiesHolder = newBgpPrefixIpv4UnicastStateResultExtendedCommunityIter(&obj.obj.ExtendedCommunities).setMsg(obj) + } + return obj.extendedCommunitiesHolder +} + +type bgpPrefixIpv4UnicastStateResultExtendedCommunityIter struct { + obj *bgpPrefixIpv4UnicastState + resultExtendedCommunitySlice []ResultExtendedCommunity + fieldPtr *[]*otg.ResultExtendedCommunity +} + +func newBgpPrefixIpv4UnicastStateResultExtendedCommunityIter(ptr *[]*otg.ResultExtendedCommunity) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { + return &bgpPrefixIpv4UnicastStateResultExtendedCommunityIter{fieldPtr: ptr} +} + +type BgpPrefixIpv4UnicastStateResultExtendedCommunityIter interface { + setMsg(*bgpPrefixIpv4UnicastState) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter + Items() []ResultExtendedCommunity + Add() ResultExtendedCommunity + Append(items ...ResultExtendedCommunity) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter + Set(index int, newObj ResultExtendedCommunity) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter + Clear() BgpPrefixIpv4UnicastStateResultExtendedCommunityIter + clearHolderSlice() BgpPrefixIpv4UnicastStateResultExtendedCommunityIter + appendHolderSlice(item ResultExtendedCommunity) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter +} + +func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) setMsg(msg *bgpPrefixIpv4UnicastState) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&resultExtendedCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) Items() []ResultExtendedCommunity { + return obj.resultExtendedCommunitySlice +} + +func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) Add() ResultExtendedCommunity { + newObj := &otg.ResultExtendedCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &resultExtendedCommunity{obj: newObj} + newLibObj.setDefault() + obj.resultExtendedCommunitySlice = append(obj.resultExtendedCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) Append(items ...ResultExtendedCommunity) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.resultExtendedCommunitySlice = append(obj.resultExtendedCommunitySlice, item) + } + return obj +} + +func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) Set(index int, newObj ResultExtendedCommunity) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.resultExtendedCommunitySlice[index] = newObj + return obj +} +func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) Clear() BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.ResultExtendedCommunity{} + obj.resultExtendedCommunitySlice = []ResultExtendedCommunity{} + } + return obj +} +func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) clearHolderSlice() BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { + if len(obj.resultExtendedCommunitySlice) > 0 { + obj.resultExtendedCommunitySlice = []ResultExtendedCommunity{} + } + return obj +} +func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) appendHolderSlice(item ResultExtendedCommunity) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { + obj.resultExtendedCommunitySlice = append(obj.resultExtendedCommunitySlice, item) + return obj +} + +// description is TBD +// AsPath returns a ResultBgpAsPath +func (obj *bgpPrefixIpv4UnicastState) AsPath() ResultBgpAsPath { + if obj.obj.AsPath == nil { + obj.obj.AsPath = NewResultBgpAsPath().msg() + } + if obj.asPathHolder == nil { + obj.asPathHolder = &resultBgpAsPath{obj: obj.obj.AsPath} + } + return obj.asPathHolder +} + +// description is TBD +// AsPath returns a ResultBgpAsPath +func (obj *bgpPrefixIpv4UnicastState) HasAsPath() bool { + return obj.obj.AsPath != nil +} + +// description is TBD +// SetAsPath sets the ResultBgpAsPath value in the BgpPrefixIpv4UnicastState object +func (obj *bgpPrefixIpv4UnicastState) SetAsPath(value ResultBgpAsPath) BgpPrefixIpv4UnicastState { + + obj.asPathHolder = nil + obj.obj.AsPath = value.msg() + + return obj +} + +// The local preference is a well-known attribute and the value is used for route selection. The route with the highest local preference value is preferred. +// LocalPreference returns a uint32 +func (obj *bgpPrefixIpv4UnicastState) LocalPreference() uint32 { + + return *obj.obj.LocalPreference + +} + +// The local preference is a well-known attribute and the value is used for route selection. The route with the highest local preference value is preferred. +// LocalPreference returns a uint32 +func (obj *bgpPrefixIpv4UnicastState) HasLocalPreference() bool { + return obj.obj.LocalPreference != nil +} + +// The local preference is a well-known attribute and the value is used for route selection. The route with the highest local preference value is preferred. +// SetLocalPreference sets the uint32 value in the BgpPrefixIpv4UnicastState object +func (obj *bgpPrefixIpv4UnicastState) SetLocalPreference(value uint32) BgpPrefixIpv4UnicastState { + + obj.obj.LocalPreference = &value + return obj +} + +// The multi exit discriminator (MED) is an optional non-transitive attribute and the value is used for route selection. The route with the lowest MED value is preferred. +// MultiExitDiscriminator returns a uint32 +func (obj *bgpPrefixIpv4UnicastState) MultiExitDiscriminator() uint32 { + + return *obj.obj.MultiExitDiscriminator + +} + +// The multi exit discriminator (MED) is an optional non-transitive attribute and the value is used for route selection. The route with the lowest MED value is preferred. +// MultiExitDiscriminator returns a uint32 +func (obj *bgpPrefixIpv4UnicastState) HasMultiExitDiscriminator() bool { + return obj.obj.MultiExitDiscriminator != nil +} + +// The multi exit discriminator (MED) is an optional non-transitive attribute and the value is used for route selection. The route with the lowest MED value is preferred. +// SetMultiExitDiscriminator sets the uint32 value in the BgpPrefixIpv4UnicastState object +func (obj *bgpPrefixIpv4UnicastState) SetMultiExitDiscriminator(value uint32) BgpPrefixIpv4UnicastState { + + obj.obj.MultiExitDiscriminator = &value + return obj +} + +func (obj *bgpPrefixIpv4UnicastState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.PrefixLength != nil { + + if *obj.obj.PrefixLength > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpPrefixIpv4UnicastState.PrefixLength <= 128 but Got %d", *obj.obj.PrefixLength)) + } + + } + + if obj.obj.Ipv4NextHop != nil { + + err := obj.validateIpv4(obj.Ipv4NextHop()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpPrefixIpv4UnicastState.Ipv4NextHop")) + } + + } + + if obj.obj.Ipv6NextHop != nil { + + err := obj.validateIpv6(obj.Ipv6NextHop()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpPrefixIpv4UnicastState.Ipv6NextHop")) + } + + } + + if len(obj.obj.Communities) != 0 { + + if set_default { + obj.Communities().clearHolderSlice() + for _, item := range obj.obj.Communities { + obj.Communities().appendHolderSlice(&resultBgpCommunity{obj: item}) + } + } + for _, item := range obj.Communities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.ExtendedCommunities) != 0 { + + if set_default { + obj.ExtendedCommunities().clearHolderSlice() + for _, item := range obj.obj.ExtendedCommunities { + obj.ExtendedCommunities().appendHolderSlice(&resultExtendedCommunity{obj: item}) + } + } + for _, item := range obj.ExtendedCommunities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.AsPath != nil { + + obj.AsPath().validateObj(vObj, set_default) + } + +} + +func (obj *bgpPrefixIpv4UnicastState) setDefault() { + +} diff --git a/gosnappi/bgp_prefix_ipv6_unicast_filter.go b/gosnappi/bgp_prefix_ipv6_unicast_filter.go new file mode 100644 index 00000000..29fc227e --- /dev/null +++ b/gosnappi/bgp_prefix_ipv6_unicast_filter.go @@ -0,0 +1,420 @@ +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" +) + +// ***** BgpPrefixIpv6UnicastFilter ***** +type bgpPrefixIpv6UnicastFilter struct { + validation + obj *otg.BgpPrefixIpv6UnicastFilter + marshaller marshalBgpPrefixIpv6UnicastFilter + unMarshaller unMarshalBgpPrefixIpv6UnicastFilter +} + +func NewBgpPrefixIpv6UnicastFilter() BgpPrefixIpv6UnicastFilter { + obj := bgpPrefixIpv6UnicastFilter{obj: &otg.BgpPrefixIpv6UnicastFilter{}} + obj.setDefault() + return &obj +} + +func (obj *bgpPrefixIpv6UnicastFilter) msg() *otg.BgpPrefixIpv6UnicastFilter { + return obj.obj +} + +func (obj *bgpPrefixIpv6UnicastFilter) setMsg(msg *otg.BgpPrefixIpv6UnicastFilter) BgpPrefixIpv6UnicastFilter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpPrefixIpv6UnicastFilter struct { + obj *bgpPrefixIpv6UnicastFilter +} + +type marshalBgpPrefixIpv6UnicastFilter interface { + // ToProto marshals BgpPrefixIpv6UnicastFilter to protobuf object *otg.BgpPrefixIpv6UnicastFilter + ToProto() (*otg.BgpPrefixIpv6UnicastFilter, error) + // ToPbText marshals BgpPrefixIpv6UnicastFilter to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpPrefixIpv6UnicastFilter to YAML text + ToYaml() (string, error) + // ToJson marshals BgpPrefixIpv6UnicastFilter to JSON text + ToJson() (string, error) +} + +type unMarshalbgpPrefixIpv6UnicastFilter struct { + obj *bgpPrefixIpv6UnicastFilter +} + +type unMarshalBgpPrefixIpv6UnicastFilter interface { + // FromProto unmarshals BgpPrefixIpv6UnicastFilter from protobuf object *otg.BgpPrefixIpv6UnicastFilter + FromProto(msg *otg.BgpPrefixIpv6UnicastFilter) (BgpPrefixIpv6UnicastFilter, error) + // FromPbText unmarshals BgpPrefixIpv6UnicastFilter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpPrefixIpv6UnicastFilter from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpPrefixIpv6UnicastFilter from JSON text + FromJson(value string) error +} + +func (obj *bgpPrefixIpv6UnicastFilter) Marshal() marshalBgpPrefixIpv6UnicastFilter { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpPrefixIpv6UnicastFilter{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpPrefixIpv6UnicastFilter) Unmarshal() unMarshalBgpPrefixIpv6UnicastFilter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpPrefixIpv6UnicastFilter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpPrefixIpv6UnicastFilter) ToProto() (*otg.BgpPrefixIpv6UnicastFilter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpPrefixIpv6UnicastFilter) FromProto(msg *otg.BgpPrefixIpv6UnicastFilter) (BgpPrefixIpv6UnicastFilter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpPrefixIpv6UnicastFilter) 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 *unMarshalbgpPrefixIpv6UnicastFilter) 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 *marshalbgpPrefixIpv6UnicastFilter) 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 *unMarshalbgpPrefixIpv6UnicastFilter) 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 *marshalbgpPrefixIpv6UnicastFilter) 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 *unMarshalbgpPrefixIpv6UnicastFilter) 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 *bgpPrefixIpv6UnicastFilter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpPrefixIpv6UnicastFilter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpPrefixIpv6UnicastFilter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpPrefixIpv6UnicastFilter) Clone() (BgpPrefixIpv6UnicastFilter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpPrefixIpv6UnicastFilter() + 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 +} + +// BgpPrefixIpv6UnicastFilter is description is TBD +type BgpPrefixIpv6UnicastFilter interface { + Validation + // msg marshals BgpPrefixIpv6UnicastFilter to protobuf object *otg.BgpPrefixIpv6UnicastFilter + // and doesn't set defaults + msg() *otg.BgpPrefixIpv6UnicastFilter + // setMsg unmarshals BgpPrefixIpv6UnicastFilter from protobuf object *otg.BgpPrefixIpv6UnicastFilter + // and doesn't set defaults + setMsg(*otg.BgpPrefixIpv6UnicastFilter) BgpPrefixIpv6UnicastFilter + // provides marshal interface + Marshal() marshalBgpPrefixIpv6UnicastFilter + // provides unmarshal interface + Unmarshal() unMarshalBgpPrefixIpv6UnicastFilter + // validate validates BgpPrefixIpv6UnicastFilter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpPrefixIpv6UnicastFilter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Addresses returns []string, set in BgpPrefixIpv6UnicastFilter. + Addresses() []string + // SetAddresses assigns []string provided by user to BgpPrefixIpv6UnicastFilter + SetAddresses(value []string) BgpPrefixIpv6UnicastFilter + // PrefixLength returns uint32, set in BgpPrefixIpv6UnicastFilter. + PrefixLength() uint32 + // SetPrefixLength assigns uint32 provided by user to BgpPrefixIpv6UnicastFilter + SetPrefixLength(value uint32) BgpPrefixIpv6UnicastFilter + // HasPrefixLength checks if PrefixLength has been set in BgpPrefixIpv6UnicastFilter + HasPrefixLength() bool + // Origin returns BgpPrefixIpv6UnicastFilterOriginEnum, set in BgpPrefixIpv6UnicastFilter + Origin() BgpPrefixIpv6UnicastFilterOriginEnum + // SetOrigin assigns BgpPrefixIpv6UnicastFilterOriginEnum provided by user to BgpPrefixIpv6UnicastFilter + SetOrigin(value BgpPrefixIpv6UnicastFilterOriginEnum) BgpPrefixIpv6UnicastFilter + // HasOrigin checks if Origin has been set in BgpPrefixIpv6UnicastFilter + HasOrigin() bool + // PathId returns uint32, set in BgpPrefixIpv6UnicastFilter. + PathId() uint32 + // SetPathId assigns uint32 provided by user to BgpPrefixIpv6UnicastFilter + SetPathId(value uint32) BgpPrefixIpv6UnicastFilter + // HasPathId checks if PathId has been set in BgpPrefixIpv6UnicastFilter + HasPathId() bool +} + +// The addresses to match. If the addresses property is missing or empty then all addresses will match. +// Addresses returns a []string +func (obj *bgpPrefixIpv6UnicastFilter) Addresses() []string { + if obj.obj.Addresses == nil { + obj.obj.Addresses = make([]string, 0) + } + return obj.obj.Addresses +} + +// The addresses to match. If the addresses property is missing or empty then all addresses will match. +// SetAddresses sets the []string value in the BgpPrefixIpv6UnicastFilter object +func (obj *bgpPrefixIpv6UnicastFilter) SetAddresses(value []string) BgpPrefixIpv6UnicastFilter { + + if obj.obj.Addresses == nil { + obj.obj.Addresses = make([]string, 0) + } + obj.obj.Addresses = value + + return obj +} + +// The prefix length to match. If the prefix length is missing then all prefix lengths will match. +// PrefixLength returns a uint32 +func (obj *bgpPrefixIpv6UnicastFilter) PrefixLength() uint32 { + + return *obj.obj.PrefixLength + +} + +// The prefix length to match. If the prefix length is missing then all prefix lengths will match. +// PrefixLength returns a uint32 +func (obj *bgpPrefixIpv6UnicastFilter) HasPrefixLength() bool { + return obj.obj.PrefixLength != nil +} + +// The prefix length to match. If the prefix length is missing then all prefix lengths will match. +// SetPrefixLength sets the uint32 value in the BgpPrefixIpv6UnicastFilter object +func (obj *bgpPrefixIpv6UnicastFilter) SetPrefixLength(value uint32) BgpPrefixIpv6UnicastFilter { + + obj.obj.PrefixLength = &value + return obj +} + +type BgpPrefixIpv6UnicastFilterOriginEnum string + +// Enum of Origin on BgpPrefixIpv6UnicastFilter +var BgpPrefixIpv6UnicastFilterOrigin = struct { + IGP BgpPrefixIpv6UnicastFilterOriginEnum + EGP BgpPrefixIpv6UnicastFilterOriginEnum + INCOMPLETE BgpPrefixIpv6UnicastFilterOriginEnum +}{ + IGP: BgpPrefixIpv6UnicastFilterOriginEnum("igp"), + EGP: BgpPrefixIpv6UnicastFilterOriginEnum("egp"), + INCOMPLETE: BgpPrefixIpv6UnicastFilterOriginEnum("incomplete"), +} + +func (obj *bgpPrefixIpv6UnicastFilter) Origin() BgpPrefixIpv6UnicastFilterOriginEnum { + return BgpPrefixIpv6UnicastFilterOriginEnum(obj.obj.Origin.Enum().String()) +} + +// The origin to match. If the origin is missing then all origins will match. +// Origin returns a string +func (obj *bgpPrefixIpv6UnicastFilter) HasOrigin() bool { + return obj.obj.Origin != nil +} + +func (obj *bgpPrefixIpv6UnicastFilter) SetOrigin(value BgpPrefixIpv6UnicastFilterOriginEnum) BgpPrefixIpv6UnicastFilter { + intValue, ok := otg.BgpPrefixIpv6UnicastFilter_Origin_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpPrefixIpv6UnicastFilterOriginEnum", string(value))) + return obj + } + enumValue := otg.BgpPrefixIpv6UnicastFilter_Origin_Enum(intValue) + obj.obj.Origin = &enumValue + + return obj +} + +// The path id to match. If the path id is missing then all path ids will match. +// PathId returns a uint32 +func (obj *bgpPrefixIpv6UnicastFilter) PathId() uint32 { + + return *obj.obj.PathId + +} + +// The path id to match. If the path id is missing then all path ids will match. +// PathId returns a uint32 +func (obj *bgpPrefixIpv6UnicastFilter) HasPathId() bool { + return obj.obj.PathId != nil +} + +// The path id to match. If the path id is missing then all path ids will match. +// SetPathId sets the uint32 value in the BgpPrefixIpv6UnicastFilter object +func (obj *bgpPrefixIpv6UnicastFilter) SetPathId(value uint32) BgpPrefixIpv6UnicastFilter { + + obj.obj.PathId = &value + return obj +} + +func (obj *bgpPrefixIpv6UnicastFilter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Addresses != nil { + + err := obj.validateIpv6Slice(obj.Addresses()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpPrefixIpv6UnicastFilter.Addresses")) + } + + } + + if obj.obj.PrefixLength != nil { + + if *obj.obj.PrefixLength > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpPrefixIpv6UnicastFilter.PrefixLength <= 128 but Got %d", *obj.obj.PrefixLength)) + } + + } + +} + +func (obj *bgpPrefixIpv6UnicastFilter) setDefault() { + +} diff --git a/gosnappi/bgp_prefix_ipv6_unicast_state.go b/gosnappi/bgp_prefix_ipv6_unicast_state.go new file mode 100644 index 00000000..d8163ea7 --- /dev/null +++ b/gosnappi/bgp_prefix_ipv6_unicast_state.go @@ -0,0 +1,804 @@ +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" +) + +// ***** BgpPrefixIpv6UnicastState ***** +type bgpPrefixIpv6UnicastState struct { + validation + obj *otg.BgpPrefixIpv6UnicastState + marshaller marshalBgpPrefixIpv6UnicastState + unMarshaller unMarshalBgpPrefixIpv6UnicastState + communitiesHolder BgpPrefixIpv6UnicastStateResultBgpCommunityIter + extendedCommunitiesHolder BgpPrefixIpv6UnicastStateResultExtendedCommunityIter + asPathHolder ResultBgpAsPath +} + +func NewBgpPrefixIpv6UnicastState() BgpPrefixIpv6UnicastState { + obj := bgpPrefixIpv6UnicastState{obj: &otg.BgpPrefixIpv6UnicastState{}} + obj.setDefault() + return &obj +} + +func (obj *bgpPrefixIpv6UnicastState) msg() *otg.BgpPrefixIpv6UnicastState { + return obj.obj +} + +func (obj *bgpPrefixIpv6UnicastState) setMsg(msg *otg.BgpPrefixIpv6UnicastState) BgpPrefixIpv6UnicastState { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpPrefixIpv6UnicastState struct { + obj *bgpPrefixIpv6UnicastState +} + +type marshalBgpPrefixIpv6UnicastState interface { + // ToProto marshals BgpPrefixIpv6UnicastState to protobuf object *otg.BgpPrefixIpv6UnicastState + ToProto() (*otg.BgpPrefixIpv6UnicastState, error) + // ToPbText marshals BgpPrefixIpv6UnicastState to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpPrefixIpv6UnicastState to YAML text + ToYaml() (string, error) + // ToJson marshals BgpPrefixIpv6UnicastState to JSON text + ToJson() (string, error) +} + +type unMarshalbgpPrefixIpv6UnicastState struct { + obj *bgpPrefixIpv6UnicastState +} + +type unMarshalBgpPrefixIpv6UnicastState interface { + // FromProto unmarshals BgpPrefixIpv6UnicastState from protobuf object *otg.BgpPrefixIpv6UnicastState + FromProto(msg *otg.BgpPrefixIpv6UnicastState) (BgpPrefixIpv6UnicastState, error) + // FromPbText unmarshals BgpPrefixIpv6UnicastState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpPrefixIpv6UnicastState from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpPrefixIpv6UnicastState from JSON text + FromJson(value string) error +} + +func (obj *bgpPrefixIpv6UnicastState) Marshal() marshalBgpPrefixIpv6UnicastState { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpPrefixIpv6UnicastState{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpPrefixIpv6UnicastState) Unmarshal() unMarshalBgpPrefixIpv6UnicastState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpPrefixIpv6UnicastState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpPrefixIpv6UnicastState) ToProto() (*otg.BgpPrefixIpv6UnicastState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpPrefixIpv6UnicastState) FromProto(msg *otg.BgpPrefixIpv6UnicastState) (BgpPrefixIpv6UnicastState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpPrefixIpv6UnicastState) 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 *unMarshalbgpPrefixIpv6UnicastState) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpPrefixIpv6UnicastState) 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 *unMarshalbgpPrefixIpv6UnicastState) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpPrefixIpv6UnicastState) 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 *unMarshalbgpPrefixIpv6UnicastState) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpPrefixIpv6UnicastState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpPrefixIpv6UnicastState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpPrefixIpv6UnicastState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpPrefixIpv6UnicastState) Clone() (BgpPrefixIpv6UnicastState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpPrefixIpv6UnicastState() + 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 +} + +func (obj *bgpPrefixIpv6UnicastState) setNil() { + obj.communitiesHolder = nil + obj.extendedCommunitiesHolder = nil + obj.asPathHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpPrefixIpv6UnicastState is iPv6 unicast prefix. +type BgpPrefixIpv6UnicastState interface { + Validation + // msg marshals BgpPrefixIpv6UnicastState to protobuf object *otg.BgpPrefixIpv6UnicastState + // and doesn't set defaults + msg() *otg.BgpPrefixIpv6UnicastState + // setMsg unmarshals BgpPrefixIpv6UnicastState from protobuf object *otg.BgpPrefixIpv6UnicastState + // and doesn't set defaults + setMsg(*otg.BgpPrefixIpv6UnicastState) BgpPrefixIpv6UnicastState + // provides marshal interface + Marshal() marshalBgpPrefixIpv6UnicastState + // provides unmarshal interface + Unmarshal() unMarshalBgpPrefixIpv6UnicastState + // validate validates BgpPrefixIpv6UnicastState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpPrefixIpv6UnicastState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv6Address returns string, set in BgpPrefixIpv6UnicastState. + Ipv6Address() string + // SetIpv6Address assigns string provided by user to BgpPrefixIpv6UnicastState + SetIpv6Address(value string) BgpPrefixIpv6UnicastState + // HasIpv6Address checks if Ipv6Address has been set in BgpPrefixIpv6UnicastState + HasIpv6Address() bool + // PrefixLength returns uint32, set in BgpPrefixIpv6UnicastState. + PrefixLength() uint32 + // SetPrefixLength assigns uint32 provided by user to BgpPrefixIpv6UnicastState + SetPrefixLength(value uint32) BgpPrefixIpv6UnicastState + // HasPrefixLength checks if PrefixLength has been set in BgpPrefixIpv6UnicastState + HasPrefixLength() bool + // Origin returns BgpPrefixIpv6UnicastStateOriginEnum, set in BgpPrefixIpv6UnicastState + Origin() BgpPrefixIpv6UnicastStateOriginEnum + // SetOrigin assigns BgpPrefixIpv6UnicastStateOriginEnum provided by user to BgpPrefixIpv6UnicastState + SetOrigin(value BgpPrefixIpv6UnicastStateOriginEnum) BgpPrefixIpv6UnicastState + // HasOrigin checks if Origin has been set in BgpPrefixIpv6UnicastState + HasOrigin() bool + // PathId returns uint32, set in BgpPrefixIpv6UnicastState. + PathId() uint32 + // SetPathId assigns uint32 provided by user to BgpPrefixIpv6UnicastState + SetPathId(value uint32) BgpPrefixIpv6UnicastState + // HasPathId checks if PathId has been set in BgpPrefixIpv6UnicastState + HasPathId() bool + // Ipv4NextHop returns string, set in BgpPrefixIpv6UnicastState. + Ipv4NextHop() string + // SetIpv4NextHop assigns string provided by user to BgpPrefixIpv6UnicastState + SetIpv4NextHop(value string) BgpPrefixIpv6UnicastState + // HasIpv4NextHop checks if Ipv4NextHop has been set in BgpPrefixIpv6UnicastState + HasIpv4NextHop() bool + // Ipv6NextHop returns string, set in BgpPrefixIpv6UnicastState. + Ipv6NextHop() string + // SetIpv6NextHop assigns string provided by user to BgpPrefixIpv6UnicastState + SetIpv6NextHop(value string) BgpPrefixIpv6UnicastState + // HasIpv6NextHop checks if Ipv6NextHop has been set in BgpPrefixIpv6UnicastState + HasIpv6NextHop() bool + // Communities returns BgpPrefixIpv6UnicastStateResultBgpCommunityIterIter, set in BgpPrefixIpv6UnicastState + Communities() BgpPrefixIpv6UnicastStateResultBgpCommunityIter + // ExtendedCommunities returns BgpPrefixIpv6UnicastStateResultExtendedCommunityIterIter, set in BgpPrefixIpv6UnicastState + ExtendedCommunities() BgpPrefixIpv6UnicastStateResultExtendedCommunityIter + // AsPath returns ResultBgpAsPath, set in BgpPrefixIpv6UnicastState. + // ResultBgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. + AsPath() ResultBgpAsPath + // SetAsPath assigns ResultBgpAsPath provided by user to BgpPrefixIpv6UnicastState. + // ResultBgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. + SetAsPath(value ResultBgpAsPath) BgpPrefixIpv6UnicastState + // HasAsPath checks if AsPath has been set in BgpPrefixIpv6UnicastState + HasAsPath() bool + // LocalPreference returns uint32, set in BgpPrefixIpv6UnicastState. + LocalPreference() uint32 + // SetLocalPreference assigns uint32 provided by user to BgpPrefixIpv6UnicastState + SetLocalPreference(value uint32) BgpPrefixIpv6UnicastState + // HasLocalPreference checks if LocalPreference has been set in BgpPrefixIpv6UnicastState + HasLocalPreference() bool + // MultiExitDiscriminator returns uint32, set in BgpPrefixIpv6UnicastState. + MultiExitDiscriminator() uint32 + // SetMultiExitDiscriminator assigns uint32 provided by user to BgpPrefixIpv6UnicastState + SetMultiExitDiscriminator(value uint32) BgpPrefixIpv6UnicastState + // HasMultiExitDiscriminator checks if MultiExitDiscriminator has been set in BgpPrefixIpv6UnicastState + HasMultiExitDiscriminator() bool + setNil() +} + +// An IPv6 unicast address +// Ipv6Address returns a string +func (obj *bgpPrefixIpv6UnicastState) Ipv6Address() string { + + return *obj.obj.Ipv6Address + +} + +// An IPv6 unicast address +// Ipv6Address returns a string +func (obj *bgpPrefixIpv6UnicastState) HasIpv6Address() bool { + return obj.obj.Ipv6Address != nil +} + +// An IPv6 unicast address +// SetIpv6Address sets the string value in the BgpPrefixIpv6UnicastState object +func (obj *bgpPrefixIpv6UnicastState) SetIpv6Address(value string) BgpPrefixIpv6UnicastState { + + obj.obj.Ipv6Address = &value + return obj +} + +// The length of the prefix. +// PrefixLength returns a uint32 +func (obj *bgpPrefixIpv6UnicastState) PrefixLength() uint32 { + + return *obj.obj.PrefixLength + +} + +// The length of the prefix. +// PrefixLength returns a uint32 +func (obj *bgpPrefixIpv6UnicastState) HasPrefixLength() bool { + return obj.obj.PrefixLength != nil +} + +// The length of the prefix. +// SetPrefixLength sets the uint32 value in the BgpPrefixIpv6UnicastState object +func (obj *bgpPrefixIpv6UnicastState) SetPrefixLength(value uint32) BgpPrefixIpv6UnicastState { + + obj.obj.PrefixLength = &value + return obj +} + +type BgpPrefixIpv6UnicastStateOriginEnum string + +// Enum of Origin on BgpPrefixIpv6UnicastState +var BgpPrefixIpv6UnicastStateOrigin = struct { + IGP BgpPrefixIpv6UnicastStateOriginEnum + EGP BgpPrefixIpv6UnicastStateOriginEnum + INCOMPLETE BgpPrefixIpv6UnicastStateOriginEnum +}{ + IGP: BgpPrefixIpv6UnicastStateOriginEnum("igp"), + EGP: BgpPrefixIpv6UnicastStateOriginEnum("egp"), + INCOMPLETE: BgpPrefixIpv6UnicastStateOriginEnum("incomplete"), +} + +func (obj *bgpPrefixIpv6UnicastState) Origin() BgpPrefixIpv6UnicastStateOriginEnum { + return BgpPrefixIpv6UnicastStateOriginEnum(obj.obj.Origin.Enum().String()) +} + +// The origin of the prefix. +// Origin returns a string +func (obj *bgpPrefixIpv6UnicastState) HasOrigin() bool { + return obj.obj.Origin != nil +} + +func (obj *bgpPrefixIpv6UnicastState) SetOrigin(value BgpPrefixIpv6UnicastStateOriginEnum) BgpPrefixIpv6UnicastState { + intValue, ok := otg.BgpPrefixIpv6UnicastState_Origin_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpPrefixIpv6UnicastStateOriginEnum", string(value))) + return obj + } + enumValue := otg.BgpPrefixIpv6UnicastState_Origin_Enum(intValue) + obj.obj.Origin = &enumValue + + return obj +} + +// The path id. +// PathId returns a uint32 +func (obj *bgpPrefixIpv6UnicastState) PathId() uint32 { + + return *obj.obj.PathId + +} + +// The path id. +// PathId returns a uint32 +func (obj *bgpPrefixIpv6UnicastState) HasPathId() bool { + return obj.obj.PathId != nil +} + +// The path id. +// SetPathId sets the uint32 value in the BgpPrefixIpv6UnicastState object +func (obj *bgpPrefixIpv6UnicastState) SetPathId(value uint32) BgpPrefixIpv6UnicastState { + + obj.obj.PathId = &value + return obj +} + +// The IPv4 address of the egress interface. +// Ipv4NextHop returns a string +func (obj *bgpPrefixIpv6UnicastState) Ipv4NextHop() string { + + return *obj.obj.Ipv4NextHop + +} + +// The IPv4 address of the egress interface. +// Ipv4NextHop returns a string +func (obj *bgpPrefixIpv6UnicastState) HasIpv4NextHop() bool { + return obj.obj.Ipv4NextHop != nil +} + +// The IPv4 address of the egress interface. +// SetIpv4NextHop sets the string value in the BgpPrefixIpv6UnicastState object +func (obj *bgpPrefixIpv6UnicastState) SetIpv4NextHop(value string) BgpPrefixIpv6UnicastState { + + obj.obj.Ipv4NextHop = &value + return obj +} + +// The IPv6 address of the egress interface. +// Ipv6NextHop returns a string +func (obj *bgpPrefixIpv6UnicastState) Ipv6NextHop() string { + + return *obj.obj.Ipv6NextHop + +} + +// The IPv6 address of the egress interface. +// Ipv6NextHop returns a string +func (obj *bgpPrefixIpv6UnicastState) HasIpv6NextHop() bool { + return obj.obj.Ipv6NextHop != nil +} + +// The IPv6 address of the egress interface. +// SetIpv6NextHop sets the string value in the BgpPrefixIpv6UnicastState object +func (obj *bgpPrefixIpv6UnicastState) SetIpv6NextHop(value string) BgpPrefixIpv6UnicastState { + + obj.obj.Ipv6NextHop = &value + return obj +} + +// Optional community attributes. +// Communities returns a []ResultBgpCommunity +func (obj *bgpPrefixIpv6UnicastState) Communities() BgpPrefixIpv6UnicastStateResultBgpCommunityIter { + if len(obj.obj.Communities) == 0 { + obj.obj.Communities = []*otg.ResultBgpCommunity{} + } + if obj.communitiesHolder == nil { + obj.communitiesHolder = newBgpPrefixIpv6UnicastStateResultBgpCommunityIter(&obj.obj.Communities).setMsg(obj) + } + return obj.communitiesHolder +} + +type bgpPrefixIpv6UnicastStateResultBgpCommunityIter struct { + obj *bgpPrefixIpv6UnicastState + resultBgpCommunitySlice []ResultBgpCommunity + fieldPtr *[]*otg.ResultBgpCommunity +} + +func newBgpPrefixIpv6UnicastStateResultBgpCommunityIter(ptr *[]*otg.ResultBgpCommunity) BgpPrefixIpv6UnicastStateResultBgpCommunityIter { + return &bgpPrefixIpv6UnicastStateResultBgpCommunityIter{fieldPtr: ptr} +} + +type BgpPrefixIpv6UnicastStateResultBgpCommunityIter interface { + setMsg(*bgpPrefixIpv6UnicastState) BgpPrefixIpv6UnicastStateResultBgpCommunityIter + Items() []ResultBgpCommunity + Add() ResultBgpCommunity + Append(items ...ResultBgpCommunity) BgpPrefixIpv6UnicastStateResultBgpCommunityIter + Set(index int, newObj ResultBgpCommunity) BgpPrefixIpv6UnicastStateResultBgpCommunityIter + Clear() BgpPrefixIpv6UnicastStateResultBgpCommunityIter + clearHolderSlice() BgpPrefixIpv6UnicastStateResultBgpCommunityIter + appendHolderSlice(item ResultBgpCommunity) BgpPrefixIpv6UnicastStateResultBgpCommunityIter +} + +func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) setMsg(msg *bgpPrefixIpv6UnicastState) BgpPrefixIpv6UnicastStateResultBgpCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&resultBgpCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) Items() []ResultBgpCommunity { + return obj.resultBgpCommunitySlice +} + +func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) Add() ResultBgpCommunity { + newObj := &otg.ResultBgpCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &resultBgpCommunity{obj: newObj} + newLibObj.setDefault() + obj.resultBgpCommunitySlice = append(obj.resultBgpCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) Append(items ...ResultBgpCommunity) BgpPrefixIpv6UnicastStateResultBgpCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.resultBgpCommunitySlice = append(obj.resultBgpCommunitySlice, item) + } + return obj +} + +func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) Set(index int, newObj ResultBgpCommunity) BgpPrefixIpv6UnicastStateResultBgpCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.resultBgpCommunitySlice[index] = newObj + return obj +} +func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) Clear() BgpPrefixIpv6UnicastStateResultBgpCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.ResultBgpCommunity{} + obj.resultBgpCommunitySlice = []ResultBgpCommunity{} + } + return obj +} +func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) clearHolderSlice() BgpPrefixIpv6UnicastStateResultBgpCommunityIter { + if len(obj.resultBgpCommunitySlice) > 0 { + obj.resultBgpCommunitySlice = []ResultBgpCommunity{} + } + return obj +} +func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) appendHolderSlice(item ResultBgpCommunity) BgpPrefixIpv6UnicastStateResultBgpCommunityIter { + obj.resultBgpCommunitySlice = append(obj.resultBgpCommunitySlice, item) + return obj +} + +// Optional received Extended Community attributes. Each received Extended Community attribute is available for retrieval in two forms. Support of the 'raw' format in which all 8 bytes (16 hex characters) is always present and available for use. In addition, if supported by the implementation, the Extended Community attribute may also be retrieved in the 'structured' format which is an optional field. +// ExtendedCommunities returns a []ResultExtendedCommunity +func (obj *bgpPrefixIpv6UnicastState) ExtendedCommunities() BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { + if len(obj.obj.ExtendedCommunities) == 0 { + obj.obj.ExtendedCommunities = []*otg.ResultExtendedCommunity{} + } + if obj.extendedCommunitiesHolder == nil { + obj.extendedCommunitiesHolder = newBgpPrefixIpv6UnicastStateResultExtendedCommunityIter(&obj.obj.ExtendedCommunities).setMsg(obj) + } + return obj.extendedCommunitiesHolder +} + +type bgpPrefixIpv6UnicastStateResultExtendedCommunityIter struct { + obj *bgpPrefixIpv6UnicastState + resultExtendedCommunitySlice []ResultExtendedCommunity + fieldPtr *[]*otg.ResultExtendedCommunity +} + +func newBgpPrefixIpv6UnicastStateResultExtendedCommunityIter(ptr *[]*otg.ResultExtendedCommunity) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { + return &bgpPrefixIpv6UnicastStateResultExtendedCommunityIter{fieldPtr: ptr} +} + +type BgpPrefixIpv6UnicastStateResultExtendedCommunityIter interface { + setMsg(*bgpPrefixIpv6UnicastState) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter + Items() []ResultExtendedCommunity + Add() ResultExtendedCommunity + Append(items ...ResultExtendedCommunity) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter + Set(index int, newObj ResultExtendedCommunity) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter + Clear() BgpPrefixIpv6UnicastStateResultExtendedCommunityIter + clearHolderSlice() BgpPrefixIpv6UnicastStateResultExtendedCommunityIter + appendHolderSlice(item ResultExtendedCommunity) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter +} + +func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) setMsg(msg *bgpPrefixIpv6UnicastState) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&resultExtendedCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) Items() []ResultExtendedCommunity { + return obj.resultExtendedCommunitySlice +} + +func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) Add() ResultExtendedCommunity { + newObj := &otg.ResultExtendedCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &resultExtendedCommunity{obj: newObj} + newLibObj.setDefault() + obj.resultExtendedCommunitySlice = append(obj.resultExtendedCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) Append(items ...ResultExtendedCommunity) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.resultExtendedCommunitySlice = append(obj.resultExtendedCommunitySlice, item) + } + return obj +} + +func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) Set(index int, newObj ResultExtendedCommunity) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.resultExtendedCommunitySlice[index] = newObj + return obj +} +func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) Clear() BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.ResultExtendedCommunity{} + obj.resultExtendedCommunitySlice = []ResultExtendedCommunity{} + } + return obj +} +func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) clearHolderSlice() BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { + if len(obj.resultExtendedCommunitySlice) > 0 { + obj.resultExtendedCommunitySlice = []ResultExtendedCommunity{} + } + return obj +} +func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) appendHolderSlice(item ResultExtendedCommunity) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { + obj.resultExtendedCommunitySlice = append(obj.resultExtendedCommunitySlice, item) + return obj +} + +// description is TBD +// AsPath returns a ResultBgpAsPath +func (obj *bgpPrefixIpv6UnicastState) AsPath() ResultBgpAsPath { + if obj.obj.AsPath == nil { + obj.obj.AsPath = NewResultBgpAsPath().msg() + } + if obj.asPathHolder == nil { + obj.asPathHolder = &resultBgpAsPath{obj: obj.obj.AsPath} + } + return obj.asPathHolder +} + +// description is TBD +// AsPath returns a ResultBgpAsPath +func (obj *bgpPrefixIpv6UnicastState) HasAsPath() bool { + return obj.obj.AsPath != nil +} + +// description is TBD +// SetAsPath sets the ResultBgpAsPath value in the BgpPrefixIpv6UnicastState object +func (obj *bgpPrefixIpv6UnicastState) SetAsPath(value ResultBgpAsPath) BgpPrefixIpv6UnicastState { + + obj.asPathHolder = nil + obj.obj.AsPath = value.msg() + + return obj +} + +// The local preference is a well-known attribute and the value is used for route selection. The route with the highest local preference value is preferred. +// LocalPreference returns a uint32 +func (obj *bgpPrefixIpv6UnicastState) LocalPreference() uint32 { + + return *obj.obj.LocalPreference + +} + +// The local preference is a well-known attribute and the value is used for route selection. The route with the highest local preference value is preferred. +// LocalPreference returns a uint32 +func (obj *bgpPrefixIpv6UnicastState) HasLocalPreference() bool { + return obj.obj.LocalPreference != nil +} + +// The local preference is a well-known attribute and the value is used for route selection. The route with the highest local preference value is preferred. +// SetLocalPreference sets the uint32 value in the BgpPrefixIpv6UnicastState object +func (obj *bgpPrefixIpv6UnicastState) SetLocalPreference(value uint32) BgpPrefixIpv6UnicastState { + + obj.obj.LocalPreference = &value + return obj +} + +// The multi exit discriminator (MED) is an optional non-transitive attribute and the value is used for route selection. The route with the lowest MED value is preferred. +// MultiExitDiscriminator returns a uint32 +func (obj *bgpPrefixIpv6UnicastState) MultiExitDiscriminator() uint32 { + + return *obj.obj.MultiExitDiscriminator + +} + +// The multi exit discriminator (MED) is an optional non-transitive attribute and the value is used for route selection. The route with the lowest MED value is preferred. +// MultiExitDiscriminator returns a uint32 +func (obj *bgpPrefixIpv6UnicastState) HasMultiExitDiscriminator() bool { + return obj.obj.MultiExitDiscriminator != nil +} + +// The multi exit discriminator (MED) is an optional non-transitive attribute and the value is used for route selection. The route with the lowest MED value is preferred. +// SetMultiExitDiscriminator sets the uint32 value in the BgpPrefixIpv6UnicastState object +func (obj *bgpPrefixIpv6UnicastState) SetMultiExitDiscriminator(value uint32) BgpPrefixIpv6UnicastState { + + obj.obj.MultiExitDiscriminator = &value + return obj +} + +func (obj *bgpPrefixIpv6UnicastState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.PrefixLength != nil { + + if *obj.obj.PrefixLength > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpPrefixIpv6UnicastState.PrefixLength <= 128 but Got %d", *obj.obj.PrefixLength)) + } + + } + + if obj.obj.Ipv4NextHop != nil { + + err := obj.validateIpv4(obj.Ipv4NextHop()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpPrefixIpv6UnicastState.Ipv4NextHop")) + } + + } + + if obj.obj.Ipv6NextHop != nil { + + err := obj.validateIpv6(obj.Ipv6NextHop()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpPrefixIpv6UnicastState.Ipv6NextHop")) + } + + } + + if len(obj.obj.Communities) != 0 { + + if set_default { + obj.Communities().clearHolderSlice() + for _, item := range obj.obj.Communities { + obj.Communities().appendHolderSlice(&resultBgpCommunity{obj: item}) + } + } + for _, item := range obj.Communities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.ExtendedCommunities) != 0 { + + if set_default { + obj.ExtendedCommunities().clearHolderSlice() + for _, item := range obj.obj.ExtendedCommunities { + obj.ExtendedCommunities().appendHolderSlice(&resultExtendedCommunity{obj: item}) + } + } + for _, item := range obj.ExtendedCommunities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.AsPath != nil { + + obj.AsPath().validateObj(vObj, set_default) + } + +} + +func (obj *bgpPrefixIpv6UnicastState) setDefault() { + +} diff --git a/gosnappi/bgp_prefix_state_request.go b/gosnappi/bgp_prefix_state_request.go new file mode 100644 index 00000000..b18357ca --- /dev/null +++ b/gosnappi/bgp_prefix_state_request.go @@ -0,0 +1,574 @@ +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" +) + +// ***** BgpPrefixStateRequest ***** +type bgpPrefixStateRequest struct { + validation + obj *otg.BgpPrefixStateRequest + marshaller marshalBgpPrefixStateRequest + unMarshaller unMarshalBgpPrefixStateRequest + ipv4UnicastFiltersHolder BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter + ipv6UnicastFiltersHolder BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter +} + +func NewBgpPrefixStateRequest() BgpPrefixStateRequest { + obj := bgpPrefixStateRequest{obj: &otg.BgpPrefixStateRequest{}} + obj.setDefault() + return &obj +} + +func (obj *bgpPrefixStateRequest) msg() *otg.BgpPrefixStateRequest { + return obj.obj +} + +func (obj *bgpPrefixStateRequest) setMsg(msg *otg.BgpPrefixStateRequest) BgpPrefixStateRequest { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpPrefixStateRequest struct { + obj *bgpPrefixStateRequest +} + +type marshalBgpPrefixStateRequest interface { + // ToProto marshals BgpPrefixStateRequest to protobuf object *otg.BgpPrefixStateRequest + ToProto() (*otg.BgpPrefixStateRequest, error) + // ToPbText marshals BgpPrefixStateRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpPrefixStateRequest to YAML text + ToYaml() (string, error) + // ToJson marshals BgpPrefixStateRequest to JSON text + ToJson() (string, error) +} + +type unMarshalbgpPrefixStateRequest struct { + obj *bgpPrefixStateRequest +} + +type unMarshalBgpPrefixStateRequest interface { + // FromProto unmarshals BgpPrefixStateRequest from protobuf object *otg.BgpPrefixStateRequest + FromProto(msg *otg.BgpPrefixStateRequest) (BgpPrefixStateRequest, error) + // FromPbText unmarshals BgpPrefixStateRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpPrefixStateRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpPrefixStateRequest from JSON text + FromJson(value string) error +} + +func (obj *bgpPrefixStateRequest) Marshal() marshalBgpPrefixStateRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpPrefixStateRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpPrefixStateRequest) Unmarshal() unMarshalBgpPrefixStateRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpPrefixStateRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpPrefixStateRequest) ToProto() (*otg.BgpPrefixStateRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpPrefixStateRequest) FromProto(msg *otg.BgpPrefixStateRequest) (BgpPrefixStateRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpPrefixStateRequest) 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 *unMarshalbgpPrefixStateRequest) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpPrefixStateRequest) 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 *unMarshalbgpPrefixStateRequest) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpPrefixStateRequest) 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 *unMarshalbgpPrefixStateRequest) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpPrefixStateRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpPrefixStateRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpPrefixStateRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpPrefixStateRequest) Clone() (BgpPrefixStateRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpPrefixStateRequest() + 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 +} + +func (obj *bgpPrefixStateRequest) setNil() { + obj.ipv4UnicastFiltersHolder = nil + obj.ipv6UnicastFiltersHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpPrefixStateRequest is the request to retrieve BGP peer prefix information. +type BgpPrefixStateRequest interface { + Validation + // msg marshals BgpPrefixStateRequest to protobuf object *otg.BgpPrefixStateRequest + // and doesn't set defaults + msg() *otg.BgpPrefixStateRequest + // setMsg unmarshals BgpPrefixStateRequest from protobuf object *otg.BgpPrefixStateRequest + // and doesn't set defaults + setMsg(*otg.BgpPrefixStateRequest) BgpPrefixStateRequest + // provides marshal interface + Marshal() marshalBgpPrefixStateRequest + // provides unmarshal interface + Unmarshal() unMarshalBgpPrefixStateRequest + // validate validates BgpPrefixStateRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpPrefixStateRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // BgpPeerNames returns []string, set in BgpPrefixStateRequest. + BgpPeerNames() []string + // SetBgpPeerNames assigns []string provided by user to BgpPrefixStateRequest + SetBgpPeerNames(value []string) BgpPrefixStateRequest + // PrefixFilters returns []BgpPrefixStateRequestPrefixFiltersEnum, set in BgpPrefixStateRequest + PrefixFilters() []BgpPrefixStateRequestPrefixFiltersEnum + // SetPrefixFilters assigns []BgpPrefixStateRequestPrefixFiltersEnum provided by user to BgpPrefixStateRequest + SetPrefixFilters(value []BgpPrefixStateRequestPrefixFiltersEnum) BgpPrefixStateRequest + // Ipv4UnicastFilters returns BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIterIter, set in BgpPrefixStateRequest + Ipv4UnicastFilters() BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter + // Ipv6UnicastFilters returns BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIterIter, set in BgpPrefixStateRequest + Ipv6UnicastFilters() BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter + setNil() +} + +// The names of BGP peers for which prefix information will be retrieved. If no names are specified then the results will contain prefix information for all configured BGP peers. +// +// x-constraint: +// - /components/schemas/Bgp.V4Peer/properties/name +// - /components/schemas/Bgp.V6Peer/properties/name +// +// x-constraint: +// - /components/schemas/Bgp.V4Peer/properties/name +// - /components/schemas/Bgp.V6Peer/properties/name +// +// BgpPeerNames returns a []string +func (obj *bgpPrefixStateRequest) BgpPeerNames() []string { + if obj.obj.BgpPeerNames == nil { + obj.obj.BgpPeerNames = make([]string, 0) + } + return obj.obj.BgpPeerNames +} + +// The names of BGP peers for which prefix information will be retrieved. If no names are specified then the results will contain prefix information for all configured BGP peers. +// +// x-constraint: +// - /components/schemas/Bgp.V4Peer/properties/name +// - /components/schemas/Bgp.V6Peer/properties/name +// +// x-constraint: +// - /components/schemas/Bgp.V4Peer/properties/name +// - /components/schemas/Bgp.V6Peer/properties/name +// +// SetBgpPeerNames sets the []string value in the BgpPrefixStateRequest object +func (obj *bgpPrefixStateRequest) SetBgpPeerNames(value []string) BgpPrefixStateRequest { + + if obj.obj.BgpPeerNames == nil { + obj.obj.BgpPeerNames = make([]string, 0) + } + obj.obj.BgpPeerNames = value + + return obj +} + +type BgpPrefixStateRequestPrefixFiltersEnum string + +// Enum of PrefixFilters on BgpPrefixStateRequest +var BgpPrefixStateRequestPrefixFilters = struct { + IPV4_UNICAST BgpPrefixStateRequestPrefixFiltersEnum + IPV6_UNICAST BgpPrefixStateRequestPrefixFiltersEnum +}{ + IPV4_UNICAST: BgpPrefixStateRequestPrefixFiltersEnum("ipv4_unicast"), + IPV6_UNICAST: BgpPrefixStateRequestPrefixFiltersEnum("ipv6_unicast"), +} + +func (obj *bgpPrefixStateRequest) PrefixFilters() []BgpPrefixStateRequestPrefixFiltersEnum { + items := []BgpPrefixStateRequestPrefixFiltersEnum{} + for _, item := range obj.obj.PrefixFilters { + items = append(items, BgpPrefixStateRequestPrefixFiltersEnum(item.String())) + } + return items +} + +// Specify which prefixes to return. If the list is empty or missing then all prefixes will be returned. +// SetPrefixFilters sets the []string value in the BgpPrefixStateRequest object +func (obj *bgpPrefixStateRequest) SetPrefixFilters(value []BgpPrefixStateRequestPrefixFiltersEnum) BgpPrefixStateRequest { + + items := []otg.BgpPrefixStateRequest_PrefixFilters_Enum{} + for _, item := range value { + intValue := otg.BgpPrefixStateRequest_PrefixFilters_Enum_value[string(item)] + items = append(items, otg.BgpPrefixStateRequest_PrefixFilters_Enum(intValue)) + } + obj.obj.PrefixFilters = items + return obj +} + +// The IPv4 unicast results can be filtered by specifying additional prefix search criteria. If the ipv4_unicast_filters property is missing or empty then all IPv4 prefixes will be returned. +// Ipv4UnicastFilters returns a []BgpPrefixIpv4UnicastFilter +func (obj *bgpPrefixStateRequest) Ipv4UnicastFilters() BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { + if len(obj.obj.Ipv4UnicastFilters) == 0 { + obj.obj.Ipv4UnicastFilters = []*otg.BgpPrefixIpv4UnicastFilter{} + } + if obj.ipv4UnicastFiltersHolder == nil { + obj.ipv4UnicastFiltersHolder = newBgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter(&obj.obj.Ipv4UnicastFilters).setMsg(obj) + } + return obj.ipv4UnicastFiltersHolder +} + +type bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter struct { + obj *bgpPrefixStateRequest + bgpPrefixIpv4UnicastFilterSlice []BgpPrefixIpv4UnicastFilter + fieldPtr *[]*otg.BgpPrefixIpv4UnicastFilter +} + +func newBgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter(ptr *[]*otg.BgpPrefixIpv4UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { + return &bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter{fieldPtr: ptr} +} + +type BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter interface { + setMsg(*bgpPrefixStateRequest) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter + Items() []BgpPrefixIpv4UnicastFilter + Add() BgpPrefixIpv4UnicastFilter + Append(items ...BgpPrefixIpv4UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter + Set(index int, newObj BgpPrefixIpv4UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter + Clear() BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter + clearHolderSlice() BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter + appendHolderSlice(item BgpPrefixIpv4UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter +} + +func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) setMsg(msg *bgpPrefixStateRequest) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpPrefixIpv4UnicastFilter{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) Items() []BgpPrefixIpv4UnicastFilter { + return obj.bgpPrefixIpv4UnicastFilterSlice +} + +func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) Add() BgpPrefixIpv4UnicastFilter { + newObj := &otg.BgpPrefixIpv4UnicastFilter{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpPrefixIpv4UnicastFilter{obj: newObj} + newLibObj.setDefault() + obj.bgpPrefixIpv4UnicastFilterSlice = append(obj.bgpPrefixIpv4UnicastFilterSlice, newLibObj) + return newLibObj +} + +func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) Append(items ...BgpPrefixIpv4UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpPrefixIpv4UnicastFilterSlice = append(obj.bgpPrefixIpv4UnicastFilterSlice, item) + } + return obj +} + +func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) Set(index int, newObj BgpPrefixIpv4UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpPrefixIpv4UnicastFilterSlice[index] = newObj + return obj +} +func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) Clear() BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpPrefixIpv4UnicastFilter{} + obj.bgpPrefixIpv4UnicastFilterSlice = []BgpPrefixIpv4UnicastFilter{} + } + return obj +} +func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) clearHolderSlice() BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { + if len(obj.bgpPrefixIpv4UnicastFilterSlice) > 0 { + obj.bgpPrefixIpv4UnicastFilterSlice = []BgpPrefixIpv4UnicastFilter{} + } + return obj +} +func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) appendHolderSlice(item BgpPrefixIpv4UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { + obj.bgpPrefixIpv4UnicastFilterSlice = append(obj.bgpPrefixIpv4UnicastFilterSlice, item) + return obj +} + +// The IPv6 unicast results can be filtered by specifying additional prefix search criteria. If the ipv6_unicast_filters property is missing or empty then all IPv6 prefixes will be returned. +// Ipv6UnicastFilters returns a []BgpPrefixIpv6UnicastFilter +func (obj *bgpPrefixStateRequest) Ipv6UnicastFilters() BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { + if len(obj.obj.Ipv6UnicastFilters) == 0 { + obj.obj.Ipv6UnicastFilters = []*otg.BgpPrefixIpv6UnicastFilter{} + } + if obj.ipv6UnicastFiltersHolder == nil { + obj.ipv6UnicastFiltersHolder = newBgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter(&obj.obj.Ipv6UnicastFilters).setMsg(obj) + } + return obj.ipv6UnicastFiltersHolder +} + +type bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter struct { + obj *bgpPrefixStateRequest + bgpPrefixIpv6UnicastFilterSlice []BgpPrefixIpv6UnicastFilter + fieldPtr *[]*otg.BgpPrefixIpv6UnicastFilter +} + +func newBgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter(ptr *[]*otg.BgpPrefixIpv6UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { + return &bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter{fieldPtr: ptr} +} + +type BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter interface { + setMsg(*bgpPrefixStateRequest) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter + Items() []BgpPrefixIpv6UnicastFilter + Add() BgpPrefixIpv6UnicastFilter + Append(items ...BgpPrefixIpv6UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter + Set(index int, newObj BgpPrefixIpv6UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter + Clear() BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter + clearHolderSlice() BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter + appendHolderSlice(item BgpPrefixIpv6UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter +} + +func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) setMsg(msg *bgpPrefixStateRequest) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpPrefixIpv6UnicastFilter{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) Items() []BgpPrefixIpv6UnicastFilter { + return obj.bgpPrefixIpv6UnicastFilterSlice +} + +func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) Add() BgpPrefixIpv6UnicastFilter { + newObj := &otg.BgpPrefixIpv6UnicastFilter{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpPrefixIpv6UnicastFilter{obj: newObj} + newLibObj.setDefault() + obj.bgpPrefixIpv6UnicastFilterSlice = append(obj.bgpPrefixIpv6UnicastFilterSlice, newLibObj) + return newLibObj +} + +func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) Append(items ...BgpPrefixIpv6UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpPrefixIpv6UnicastFilterSlice = append(obj.bgpPrefixIpv6UnicastFilterSlice, item) + } + return obj +} + +func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) Set(index int, newObj BgpPrefixIpv6UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpPrefixIpv6UnicastFilterSlice[index] = newObj + return obj +} +func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) Clear() BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpPrefixIpv6UnicastFilter{} + obj.bgpPrefixIpv6UnicastFilterSlice = []BgpPrefixIpv6UnicastFilter{} + } + return obj +} +func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) clearHolderSlice() BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { + if len(obj.bgpPrefixIpv6UnicastFilterSlice) > 0 { + obj.bgpPrefixIpv6UnicastFilterSlice = []BgpPrefixIpv6UnicastFilter{} + } + return obj +} +func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) appendHolderSlice(item BgpPrefixIpv6UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { + obj.bgpPrefixIpv6UnicastFilterSlice = append(obj.bgpPrefixIpv6UnicastFilterSlice, item) + return obj +} + +func (obj *bgpPrefixStateRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Ipv4UnicastFilters) != 0 { + + if set_default { + obj.Ipv4UnicastFilters().clearHolderSlice() + for _, item := range obj.obj.Ipv4UnicastFilters { + obj.Ipv4UnicastFilters().appendHolderSlice(&bgpPrefixIpv4UnicastFilter{obj: item}) + } + } + for _, item := range obj.Ipv4UnicastFilters().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Ipv6UnicastFilters) != 0 { + + if set_default { + obj.Ipv6UnicastFilters().clearHolderSlice() + for _, item := range obj.obj.Ipv6UnicastFilters { + obj.Ipv6UnicastFilters().appendHolderSlice(&bgpPrefixIpv6UnicastFilter{obj: item}) + } + } + for _, item := range obj.Ipv6UnicastFilters().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpPrefixStateRequest) setDefault() { + +} diff --git a/gosnappi/bgp_prefixes_state.go b/gosnappi/bgp_prefixes_state.go new file mode 100644 index 00000000..f1258d70 --- /dev/null +++ b/gosnappi/bgp_prefixes_state.go @@ -0,0 +1,523 @@ +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" +) + +// ***** BgpPrefixesState ***** +type bgpPrefixesState struct { + validation + obj *otg.BgpPrefixesState + marshaller marshalBgpPrefixesState + unMarshaller unMarshalBgpPrefixesState + ipv4UnicastPrefixesHolder BgpPrefixesStateBgpPrefixIpv4UnicastStateIter + ipv6UnicastPrefixesHolder BgpPrefixesStateBgpPrefixIpv6UnicastStateIter +} + +func NewBgpPrefixesState() BgpPrefixesState { + obj := bgpPrefixesState{obj: &otg.BgpPrefixesState{}} + obj.setDefault() + return &obj +} + +func (obj *bgpPrefixesState) msg() *otg.BgpPrefixesState { + return obj.obj +} + +func (obj *bgpPrefixesState) setMsg(msg *otg.BgpPrefixesState) BgpPrefixesState { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpPrefixesState struct { + obj *bgpPrefixesState +} + +type marshalBgpPrefixesState interface { + // ToProto marshals BgpPrefixesState to protobuf object *otg.BgpPrefixesState + ToProto() (*otg.BgpPrefixesState, error) + // ToPbText marshals BgpPrefixesState to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpPrefixesState to YAML text + ToYaml() (string, error) + // ToJson marshals BgpPrefixesState to JSON text + ToJson() (string, error) +} + +type unMarshalbgpPrefixesState struct { + obj *bgpPrefixesState +} + +type unMarshalBgpPrefixesState interface { + // FromProto unmarshals BgpPrefixesState from protobuf object *otg.BgpPrefixesState + FromProto(msg *otg.BgpPrefixesState) (BgpPrefixesState, error) + // FromPbText unmarshals BgpPrefixesState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpPrefixesState from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpPrefixesState from JSON text + FromJson(value string) error +} + +func (obj *bgpPrefixesState) Marshal() marshalBgpPrefixesState { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpPrefixesState{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpPrefixesState) Unmarshal() unMarshalBgpPrefixesState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpPrefixesState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpPrefixesState) ToProto() (*otg.BgpPrefixesState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpPrefixesState) FromProto(msg *otg.BgpPrefixesState) (BgpPrefixesState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpPrefixesState) 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 *unMarshalbgpPrefixesState) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpPrefixesState) 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 *unMarshalbgpPrefixesState) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpPrefixesState) 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 *unMarshalbgpPrefixesState) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpPrefixesState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpPrefixesState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpPrefixesState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpPrefixesState) Clone() (BgpPrefixesState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpPrefixesState() + 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 +} + +func (obj *bgpPrefixesState) setNil() { + obj.ipv4UnicastPrefixesHolder = nil + obj.ipv6UnicastPrefixesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpPrefixesState is bGP peer prefixes. +type BgpPrefixesState interface { + Validation + // msg marshals BgpPrefixesState to protobuf object *otg.BgpPrefixesState + // and doesn't set defaults + msg() *otg.BgpPrefixesState + // setMsg unmarshals BgpPrefixesState from protobuf object *otg.BgpPrefixesState + // and doesn't set defaults + setMsg(*otg.BgpPrefixesState) BgpPrefixesState + // provides marshal interface + Marshal() marshalBgpPrefixesState + // provides unmarshal interface + Unmarshal() unMarshalBgpPrefixesState + // validate validates BgpPrefixesState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpPrefixesState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // BgpPeerName returns string, set in BgpPrefixesState. + BgpPeerName() string + // SetBgpPeerName assigns string provided by user to BgpPrefixesState + SetBgpPeerName(value string) BgpPrefixesState + // HasBgpPeerName checks if BgpPeerName has been set in BgpPrefixesState + HasBgpPeerName() bool + // Ipv4UnicastPrefixes returns BgpPrefixesStateBgpPrefixIpv4UnicastStateIterIter, set in BgpPrefixesState + Ipv4UnicastPrefixes() BgpPrefixesStateBgpPrefixIpv4UnicastStateIter + // Ipv6UnicastPrefixes returns BgpPrefixesStateBgpPrefixIpv6UnicastStateIterIter, set in BgpPrefixesState + Ipv6UnicastPrefixes() BgpPrefixesStateBgpPrefixIpv6UnicastStateIter + setNil() +} + +// The name of a BGP peer. +// BgpPeerName returns a string +func (obj *bgpPrefixesState) BgpPeerName() string { + + return *obj.obj.BgpPeerName + +} + +// The name of a BGP peer. +// BgpPeerName returns a string +func (obj *bgpPrefixesState) HasBgpPeerName() bool { + return obj.obj.BgpPeerName != nil +} + +// The name of a BGP peer. +// SetBgpPeerName sets the string value in the BgpPrefixesState object +func (obj *bgpPrefixesState) SetBgpPeerName(value string) BgpPrefixesState { + + obj.obj.BgpPeerName = &value + return obj +} + +// description is TBD +// Ipv4UnicastPrefixes returns a []BgpPrefixIpv4UnicastState +func (obj *bgpPrefixesState) Ipv4UnicastPrefixes() BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { + if len(obj.obj.Ipv4UnicastPrefixes) == 0 { + obj.obj.Ipv4UnicastPrefixes = []*otg.BgpPrefixIpv4UnicastState{} + } + if obj.ipv4UnicastPrefixesHolder == nil { + obj.ipv4UnicastPrefixesHolder = newBgpPrefixesStateBgpPrefixIpv4UnicastStateIter(&obj.obj.Ipv4UnicastPrefixes).setMsg(obj) + } + return obj.ipv4UnicastPrefixesHolder +} + +type bgpPrefixesStateBgpPrefixIpv4UnicastStateIter struct { + obj *bgpPrefixesState + bgpPrefixIpv4UnicastStateSlice []BgpPrefixIpv4UnicastState + fieldPtr *[]*otg.BgpPrefixIpv4UnicastState +} + +func newBgpPrefixesStateBgpPrefixIpv4UnicastStateIter(ptr *[]*otg.BgpPrefixIpv4UnicastState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { + return &bgpPrefixesStateBgpPrefixIpv4UnicastStateIter{fieldPtr: ptr} +} + +type BgpPrefixesStateBgpPrefixIpv4UnicastStateIter interface { + setMsg(*bgpPrefixesState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter + Items() []BgpPrefixIpv4UnicastState + Add() BgpPrefixIpv4UnicastState + Append(items ...BgpPrefixIpv4UnicastState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter + Set(index int, newObj BgpPrefixIpv4UnicastState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter + Clear() BgpPrefixesStateBgpPrefixIpv4UnicastStateIter + clearHolderSlice() BgpPrefixesStateBgpPrefixIpv4UnicastStateIter + appendHolderSlice(item BgpPrefixIpv4UnicastState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter +} + +func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) setMsg(msg *bgpPrefixesState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpPrefixIpv4UnicastState{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) Items() []BgpPrefixIpv4UnicastState { + return obj.bgpPrefixIpv4UnicastStateSlice +} + +func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) Add() BgpPrefixIpv4UnicastState { + newObj := &otg.BgpPrefixIpv4UnicastState{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpPrefixIpv4UnicastState{obj: newObj} + newLibObj.setDefault() + obj.bgpPrefixIpv4UnicastStateSlice = append(obj.bgpPrefixIpv4UnicastStateSlice, newLibObj) + return newLibObj +} + +func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) Append(items ...BgpPrefixIpv4UnicastState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpPrefixIpv4UnicastStateSlice = append(obj.bgpPrefixIpv4UnicastStateSlice, item) + } + return obj +} + +func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) Set(index int, newObj BgpPrefixIpv4UnicastState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpPrefixIpv4UnicastStateSlice[index] = newObj + return obj +} +func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) Clear() BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpPrefixIpv4UnicastState{} + obj.bgpPrefixIpv4UnicastStateSlice = []BgpPrefixIpv4UnicastState{} + } + return obj +} +func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) clearHolderSlice() BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { + if len(obj.bgpPrefixIpv4UnicastStateSlice) > 0 { + obj.bgpPrefixIpv4UnicastStateSlice = []BgpPrefixIpv4UnicastState{} + } + return obj +} +func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) appendHolderSlice(item BgpPrefixIpv4UnicastState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { + obj.bgpPrefixIpv4UnicastStateSlice = append(obj.bgpPrefixIpv4UnicastStateSlice, item) + return obj +} + +// description is TBD +// Ipv6UnicastPrefixes returns a []BgpPrefixIpv6UnicastState +func (obj *bgpPrefixesState) Ipv6UnicastPrefixes() BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { + if len(obj.obj.Ipv6UnicastPrefixes) == 0 { + obj.obj.Ipv6UnicastPrefixes = []*otg.BgpPrefixIpv6UnicastState{} + } + if obj.ipv6UnicastPrefixesHolder == nil { + obj.ipv6UnicastPrefixesHolder = newBgpPrefixesStateBgpPrefixIpv6UnicastStateIter(&obj.obj.Ipv6UnicastPrefixes).setMsg(obj) + } + return obj.ipv6UnicastPrefixesHolder +} + +type bgpPrefixesStateBgpPrefixIpv6UnicastStateIter struct { + obj *bgpPrefixesState + bgpPrefixIpv6UnicastStateSlice []BgpPrefixIpv6UnicastState + fieldPtr *[]*otg.BgpPrefixIpv6UnicastState +} + +func newBgpPrefixesStateBgpPrefixIpv6UnicastStateIter(ptr *[]*otg.BgpPrefixIpv6UnicastState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { + return &bgpPrefixesStateBgpPrefixIpv6UnicastStateIter{fieldPtr: ptr} +} + +type BgpPrefixesStateBgpPrefixIpv6UnicastStateIter interface { + setMsg(*bgpPrefixesState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter + Items() []BgpPrefixIpv6UnicastState + Add() BgpPrefixIpv6UnicastState + Append(items ...BgpPrefixIpv6UnicastState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter + Set(index int, newObj BgpPrefixIpv6UnicastState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter + Clear() BgpPrefixesStateBgpPrefixIpv6UnicastStateIter + clearHolderSlice() BgpPrefixesStateBgpPrefixIpv6UnicastStateIter + appendHolderSlice(item BgpPrefixIpv6UnicastState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter +} + +func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) setMsg(msg *bgpPrefixesState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpPrefixIpv6UnicastState{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) Items() []BgpPrefixIpv6UnicastState { + return obj.bgpPrefixIpv6UnicastStateSlice +} + +func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) Add() BgpPrefixIpv6UnicastState { + newObj := &otg.BgpPrefixIpv6UnicastState{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpPrefixIpv6UnicastState{obj: newObj} + newLibObj.setDefault() + obj.bgpPrefixIpv6UnicastStateSlice = append(obj.bgpPrefixIpv6UnicastStateSlice, newLibObj) + return newLibObj +} + +func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) Append(items ...BgpPrefixIpv6UnicastState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpPrefixIpv6UnicastStateSlice = append(obj.bgpPrefixIpv6UnicastStateSlice, item) + } + return obj +} + +func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) Set(index int, newObj BgpPrefixIpv6UnicastState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpPrefixIpv6UnicastStateSlice[index] = newObj + return obj +} +func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) Clear() BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpPrefixIpv6UnicastState{} + obj.bgpPrefixIpv6UnicastStateSlice = []BgpPrefixIpv6UnicastState{} + } + return obj +} +func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) clearHolderSlice() BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { + if len(obj.bgpPrefixIpv6UnicastStateSlice) > 0 { + obj.bgpPrefixIpv6UnicastStateSlice = []BgpPrefixIpv6UnicastState{} + } + return obj +} +func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) appendHolderSlice(item BgpPrefixIpv6UnicastState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { + obj.bgpPrefixIpv6UnicastStateSlice = append(obj.bgpPrefixIpv6UnicastStateSlice, item) + return obj +} + +func (obj *bgpPrefixesState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Ipv4UnicastPrefixes) != 0 { + + if set_default { + obj.Ipv4UnicastPrefixes().clearHolderSlice() + for _, item := range obj.obj.Ipv4UnicastPrefixes { + obj.Ipv4UnicastPrefixes().appendHolderSlice(&bgpPrefixIpv4UnicastState{obj: item}) + } + } + for _, item := range obj.Ipv4UnicastPrefixes().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Ipv6UnicastPrefixes) != 0 { + + if set_default { + obj.Ipv6UnicastPrefixes().clearHolderSlice() + for _, item := range obj.obj.Ipv6UnicastPrefixes { + obj.Ipv6UnicastPrefixes().appendHolderSlice(&bgpPrefixIpv6UnicastState{obj: item}) + } + } + for _, item := range obj.Ipv6UnicastPrefixes().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpPrefixesState) setDefault() { + +} diff --git a/gosnappi/bgp_raw_bytes.go b/gosnappi/bgp_raw_bytes.go new file mode 100644 index 00000000..29be2fdb --- /dev/null +++ b/gosnappi/bgp_raw_bytes.go @@ -0,0 +1,390 @@ +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" +) + +// ***** BgpRawBytes ***** +type bgpRawBytes struct { + validation + obj *otg.BgpRawBytes + marshaller marshalBgpRawBytes + unMarshaller unMarshalBgpRawBytes + updatesHolder BgpRawBytesBgpOneUpdateReplayIter +} + +func NewBgpRawBytes() BgpRawBytes { + obj := bgpRawBytes{obj: &otg.BgpRawBytes{}} + obj.setDefault() + return &obj +} + +func (obj *bgpRawBytes) msg() *otg.BgpRawBytes { + return obj.obj +} + +func (obj *bgpRawBytes) setMsg(msg *otg.BgpRawBytes) BgpRawBytes { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpRawBytes struct { + obj *bgpRawBytes +} + +type marshalBgpRawBytes interface { + // ToProto marshals BgpRawBytes to protobuf object *otg.BgpRawBytes + ToProto() (*otg.BgpRawBytes, error) + // ToPbText marshals BgpRawBytes to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpRawBytes to YAML text + ToYaml() (string, error) + // ToJson marshals BgpRawBytes to JSON text + ToJson() (string, error) +} + +type unMarshalbgpRawBytes struct { + obj *bgpRawBytes +} + +type unMarshalBgpRawBytes interface { + // FromProto unmarshals BgpRawBytes from protobuf object *otg.BgpRawBytes + FromProto(msg *otg.BgpRawBytes) (BgpRawBytes, error) + // FromPbText unmarshals BgpRawBytes from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpRawBytes from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpRawBytes from JSON text + FromJson(value string) error +} + +func (obj *bgpRawBytes) Marshal() marshalBgpRawBytes { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpRawBytes{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpRawBytes) Unmarshal() unMarshalBgpRawBytes { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpRawBytes{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpRawBytes) ToProto() (*otg.BgpRawBytes, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpRawBytes) FromProto(msg *otg.BgpRawBytes) (BgpRawBytes, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpRawBytes) 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 *unMarshalbgpRawBytes) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpRawBytes) 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 *unMarshalbgpRawBytes) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpRawBytes) 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 *unMarshalbgpRawBytes) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpRawBytes) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpRawBytes) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpRawBytes) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpRawBytes) Clone() (BgpRawBytes, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpRawBytes() + 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 +} + +func (obj *bgpRawBytes) setNil() { + obj.updatesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpRawBytes is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. +type BgpRawBytes interface { + Validation + // msg marshals BgpRawBytes to protobuf object *otg.BgpRawBytes + // and doesn't set defaults + msg() *otg.BgpRawBytes + // setMsg unmarshals BgpRawBytes from protobuf object *otg.BgpRawBytes + // and doesn't set defaults + setMsg(*otg.BgpRawBytes) BgpRawBytes + // provides marshal interface + Marshal() marshalBgpRawBytes + // provides unmarshal interface + Unmarshal() unMarshalBgpRawBytes + // validate validates BgpRawBytes + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpRawBytes, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Updates returns BgpRawBytesBgpOneUpdateReplayIterIter, set in BgpRawBytes + Updates() BgpRawBytesBgpOneUpdateReplayIter + setNil() +} + +// Array of ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. +// Updates returns a []BgpOneUpdateReplay +func (obj *bgpRawBytes) Updates() BgpRawBytesBgpOneUpdateReplayIter { + if len(obj.obj.Updates) == 0 { + obj.obj.Updates = []*otg.BgpOneUpdateReplay{} + } + if obj.updatesHolder == nil { + obj.updatesHolder = newBgpRawBytesBgpOneUpdateReplayIter(&obj.obj.Updates).setMsg(obj) + } + return obj.updatesHolder +} + +type bgpRawBytesBgpOneUpdateReplayIter struct { + obj *bgpRawBytes + bgpOneUpdateReplaySlice []BgpOneUpdateReplay + fieldPtr *[]*otg.BgpOneUpdateReplay +} + +func newBgpRawBytesBgpOneUpdateReplayIter(ptr *[]*otg.BgpOneUpdateReplay) BgpRawBytesBgpOneUpdateReplayIter { + return &bgpRawBytesBgpOneUpdateReplayIter{fieldPtr: ptr} +} + +type BgpRawBytesBgpOneUpdateReplayIter interface { + setMsg(*bgpRawBytes) BgpRawBytesBgpOneUpdateReplayIter + Items() []BgpOneUpdateReplay + Add() BgpOneUpdateReplay + Append(items ...BgpOneUpdateReplay) BgpRawBytesBgpOneUpdateReplayIter + Set(index int, newObj BgpOneUpdateReplay) BgpRawBytesBgpOneUpdateReplayIter + Clear() BgpRawBytesBgpOneUpdateReplayIter + clearHolderSlice() BgpRawBytesBgpOneUpdateReplayIter + appendHolderSlice(item BgpOneUpdateReplay) BgpRawBytesBgpOneUpdateReplayIter +} + +func (obj *bgpRawBytesBgpOneUpdateReplayIter) setMsg(msg *bgpRawBytes) BgpRawBytesBgpOneUpdateReplayIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpOneUpdateReplay{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpRawBytesBgpOneUpdateReplayIter) Items() []BgpOneUpdateReplay { + return obj.bgpOneUpdateReplaySlice +} + +func (obj *bgpRawBytesBgpOneUpdateReplayIter) Add() BgpOneUpdateReplay { + newObj := &otg.BgpOneUpdateReplay{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpOneUpdateReplay{obj: newObj} + newLibObj.setDefault() + obj.bgpOneUpdateReplaySlice = append(obj.bgpOneUpdateReplaySlice, newLibObj) + return newLibObj +} + +func (obj *bgpRawBytesBgpOneUpdateReplayIter) Append(items ...BgpOneUpdateReplay) BgpRawBytesBgpOneUpdateReplayIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpOneUpdateReplaySlice = append(obj.bgpOneUpdateReplaySlice, item) + } + return obj +} + +func (obj *bgpRawBytesBgpOneUpdateReplayIter) Set(index int, newObj BgpOneUpdateReplay) BgpRawBytesBgpOneUpdateReplayIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpOneUpdateReplaySlice[index] = newObj + return obj +} +func (obj *bgpRawBytesBgpOneUpdateReplayIter) Clear() BgpRawBytesBgpOneUpdateReplayIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpOneUpdateReplay{} + obj.bgpOneUpdateReplaySlice = []BgpOneUpdateReplay{} + } + return obj +} +func (obj *bgpRawBytesBgpOneUpdateReplayIter) clearHolderSlice() BgpRawBytesBgpOneUpdateReplayIter { + if len(obj.bgpOneUpdateReplaySlice) > 0 { + obj.bgpOneUpdateReplaySlice = []BgpOneUpdateReplay{} + } + return obj +} +func (obj *bgpRawBytesBgpOneUpdateReplayIter) appendHolderSlice(item BgpOneUpdateReplay) BgpRawBytesBgpOneUpdateReplayIter { + obj.bgpOneUpdateReplaySlice = append(obj.bgpOneUpdateReplaySlice, item) + return obj +} + +func (obj *bgpRawBytes) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Updates) != 0 { + + if set_default { + obj.Updates().clearHolderSlice() + for _, item := range obj.obj.Updates { + obj.Updates().appendHolderSlice(&bgpOneUpdateReplay{obj: item}) + } + } + for _, item := range obj.Updates().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpRawBytes) setDefault() { + +} diff --git a/gosnappi/bgp_route_advanced.go b/gosnappi/bgp_route_advanced.go new file mode 100644 index 00000000..74c6e4cb --- /dev/null +++ b/gosnappi/bgp_route_advanced.go @@ -0,0 +1,476 @@ +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" +) + +// ***** BgpRouteAdvanced ***** +type bgpRouteAdvanced struct { + validation + obj *otg.BgpRouteAdvanced + marshaller marshalBgpRouteAdvanced + unMarshaller unMarshalBgpRouteAdvanced +} + +func NewBgpRouteAdvanced() BgpRouteAdvanced { + obj := bgpRouteAdvanced{obj: &otg.BgpRouteAdvanced{}} + obj.setDefault() + return &obj +} + +func (obj *bgpRouteAdvanced) msg() *otg.BgpRouteAdvanced { + return obj.obj +} + +func (obj *bgpRouteAdvanced) setMsg(msg *otg.BgpRouteAdvanced) BgpRouteAdvanced { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpRouteAdvanced struct { + obj *bgpRouteAdvanced +} + +type marshalBgpRouteAdvanced interface { + // ToProto marshals BgpRouteAdvanced to protobuf object *otg.BgpRouteAdvanced + ToProto() (*otg.BgpRouteAdvanced, error) + // ToPbText marshals BgpRouteAdvanced to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpRouteAdvanced to YAML text + ToYaml() (string, error) + // ToJson marshals BgpRouteAdvanced to JSON text + ToJson() (string, error) +} + +type unMarshalbgpRouteAdvanced struct { + obj *bgpRouteAdvanced +} + +type unMarshalBgpRouteAdvanced interface { + // FromProto unmarshals BgpRouteAdvanced from protobuf object *otg.BgpRouteAdvanced + FromProto(msg *otg.BgpRouteAdvanced) (BgpRouteAdvanced, error) + // FromPbText unmarshals BgpRouteAdvanced from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpRouteAdvanced from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpRouteAdvanced from JSON text + FromJson(value string) error +} + +func (obj *bgpRouteAdvanced) Marshal() marshalBgpRouteAdvanced { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpRouteAdvanced{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpRouteAdvanced) Unmarshal() unMarshalBgpRouteAdvanced { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpRouteAdvanced{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpRouteAdvanced) ToProto() (*otg.BgpRouteAdvanced, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpRouteAdvanced) FromProto(msg *otg.BgpRouteAdvanced) (BgpRouteAdvanced, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpRouteAdvanced) 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 *unMarshalbgpRouteAdvanced) 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 *marshalbgpRouteAdvanced) 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 *unMarshalbgpRouteAdvanced) 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 *marshalbgpRouteAdvanced) 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 *unMarshalbgpRouteAdvanced) 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 *bgpRouteAdvanced) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpRouteAdvanced) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpRouteAdvanced) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpRouteAdvanced) Clone() (BgpRouteAdvanced, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpRouteAdvanced() + 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 +} + +// BgpRouteAdvanced is configuration for advanced BGP route range settings. +type BgpRouteAdvanced interface { + Validation + // msg marshals BgpRouteAdvanced to protobuf object *otg.BgpRouteAdvanced + // and doesn't set defaults + msg() *otg.BgpRouteAdvanced + // setMsg unmarshals BgpRouteAdvanced from protobuf object *otg.BgpRouteAdvanced + // and doesn't set defaults + setMsg(*otg.BgpRouteAdvanced) BgpRouteAdvanced + // provides marshal interface + Marshal() marshalBgpRouteAdvanced + // provides unmarshal interface + Unmarshal() unMarshalBgpRouteAdvanced + // validate validates BgpRouteAdvanced + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpRouteAdvanced, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // IncludeMultiExitDiscriminator returns bool, set in BgpRouteAdvanced. + IncludeMultiExitDiscriminator() bool + // SetIncludeMultiExitDiscriminator assigns bool provided by user to BgpRouteAdvanced + SetIncludeMultiExitDiscriminator(value bool) BgpRouteAdvanced + // HasIncludeMultiExitDiscriminator checks if IncludeMultiExitDiscriminator has been set in BgpRouteAdvanced + HasIncludeMultiExitDiscriminator() bool + // MultiExitDiscriminator returns uint32, set in BgpRouteAdvanced. + MultiExitDiscriminator() uint32 + // SetMultiExitDiscriminator assigns uint32 provided by user to BgpRouteAdvanced + SetMultiExitDiscriminator(value uint32) BgpRouteAdvanced + // HasMultiExitDiscriminator checks if MultiExitDiscriminator has been set in BgpRouteAdvanced + HasMultiExitDiscriminator() bool + // IncludeOrigin returns bool, set in BgpRouteAdvanced. + IncludeOrigin() bool + // SetIncludeOrigin assigns bool provided by user to BgpRouteAdvanced + SetIncludeOrigin(value bool) BgpRouteAdvanced + // HasIncludeOrigin checks if IncludeOrigin has been set in BgpRouteAdvanced + HasIncludeOrigin() bool + // Origin returns BgpRouteAdvancedOriginEnum, set in BgpRouteAdvanced + Origin() BgpRouteAdvancedOriginEnum + // SetOrigin assigns BgpRouteAdvancedOriginEnum provided by user to BgpRouteAdvanced + SetOrigin(value BgpRouteAdvancedOriginEnum) BgpRouteAdvanced + // HasOrigin checks if Origin has been set in BgpRouteAdvanced + HasOrigin() bool + // IncludeLocalPreference returns bool, set in BgpRouteAdvanced. + IncludeLocalPreference() bool + // SetIncludeLocalPreference assigns bool provided by user to BgpRouteAdvanced + SetIncludeLocalPreference(value bool) BgpRouteAdvanced + // HasIncludeLocalPreference checks if IncludeLocalPreference has been set in BgpRouteAdvanced + HasIncludeLocalPreference() bool + // LocalPreference returns uint32, set in BgpRouteAdvanced. + LocalPreference() uint32 + // SetLocalPreference assigns uint32 provided by user to BgpRouteAdvanced + SetLocalPreference(value uint32) BgpRouteAdvanced + // HasLocalPreference checks if LocalPreference has been set in BgpRouteAdvanced + HasLocalPreference() bool +} + +// BGP Multi Exit Discriminator attribute sent to the peer to help in the route selection process. If set to true, the Multi Exit Discriminator attribute will be included in the route advertisement. +// IncludeMultiExitDiscriminator returns a bool +func (obj *bgpRouteAdvanced) IncludeMultiExitDiscriminator() bool { + + return *obj.obj.IncludeMultiExitDiscriminator + +} + +// BGP Multi Exit Discriminator attribute sent to the peer to help in the route selection process. If set to true, the Multi Exit Discriminator attribute will be included in the route advertisement. +// IncludeMultiExitDiscriminator returns a bool +func (obj *bgpRouteAdvanced) HasIncludeMultiExitDiscriminator() bool { + return obj.obj.IncludeMultiExitDiscriminator != nil +} + +// BGP Multi Exit Discriminator attribute sent to the peer to help in the route selection process. If set to true, the Multi Exit Discriminator attribute will be included in the route advertisement. +// SetIncludeMultiExitDiscriminator sets the bool value in the BgpRouteAdvanced object +func (obj *bgpRouteAdvanced) SetIncludeMultiExitDiscriminator(value bool) BgpRouteAdvanced { + + obj.obj.IncludeMultiExitDiscriminator = &value + return obj +} + +// The multi exit discriminator (MED) value used for route selection sent to the peer. +// MultiExitDiscriminator returns a uint32 +func (obj *bgpRouteAdvanced) MultiExitDiscriminator() uint32 { + + return *obj.obj.MultiExitDiscriminator + +} + +// The multi exit discriminator (MED) value used for route selection sent to the peer. +// MultiExitDiscriminator returns a uint32 +func (obj *bgpRouteAdvanced) HasMultiExitDiscriminator() bool { + return obj.obj.MultiExitDiscriminator != nil +} + +// The multi exit discriminator (MED) value used for route selection sent to the peer. +// SetMultiExitDiscriminator sets the uint32 value in the BgpRouteAdvanced object +func (obj *bgpRouteAdvanced) SetMultiExitDiscriminator(value uint32) BgpRouteAdvanced { + + obj.obj.MultiExitDiscriminator = &value + return obj +} + +// If set to true, the Origin attribute will be included in the route advertisement. +// IncludeOrigin returns a bool +func (obj *bgpRouteAdvanced) IncludeOrigin() bool { + + return *obj.obj.IncludeOrigin + +} + +// If set to true, the Origin attribute will be included in the route advertisement. +// IncludeOrigin returns a bool +func (obj *bgpRouteAdvanced) HasIncludeOrigin() bool { + return obj.obj.IncludeOrigin != nil +} + +// If set to true, the Origin attribute will be included in the route advertisement. +// SetIncludeOrigin sets the bool value in the BgpRouteAdvanced object +func (obj *bgpRouteAdvanced) SetIncludeOrigin(value bool) BgpRouteAdvanced { + + obj.obj.IncludeOrigin = &value + return obj +} + +type BgpRouteAdvancedOriginEnum string + +// Enum of Origin on BgpRouteAdvanced +var BgpRouteAdvancedOrigin = struct { + IGP BgpRouteAdvancedOriginEnum + EGP BgpRouteAdvancedOriginEnum + INCOMPLETE BgpRouteAdvancedOriginEnum +}{ + IGP: BgpRouteAdvancedOriginEnum("igp"), + EGP: BgpRouteAdvancedOriginEnum("egp"), + INCOMPLETE: BgpRouteAdvancedOriginEnum("incomplete"), +} + +func (obj *bgpRouteAdvanced) Origin() BgpRouteAdvancedOriginEnum { + return BgpRouteAdvancedOriginEnum(obj.obj.Origin.Enum().String()) +} + +// The origin attribute of a prefix can take three values: the prefix originates from an interior routing protocol 'igp', it originates from 'egp' or the origin is 'incomplete', if the prefix is learned through other means. +// Origin returns a string +func (obj *bgpRouteAdvanced) HasOrigin() bool { + return obj.obj.Origin != nil +} + +func (obj *bgpRouteAdvanced) SetOrigin(value BgpRouteAdvancedOriginEnum) BgpRouteAdvanced { + intValue, ok := otg.BgpRouteAdvanced_Origin_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpRouteAdvancedOriginEnum", string(value))) + return obj + } + enumValue := otg.BgpRouteAdvanced_Origin_Enum(intValue) + obj.obj.Origin = &enumValue + + return obj +} + +// BGP Local Preference attribute sent to the peer to indicate the degree of preference for externally learned routes. If set to true, the Local Preference attribute will be included in the route advertisement. This should be included only for internal peers. +// IncludeLocalPreference returns a bool +func (obj *bgpRouteAdvanced) IncludeLocalPreference() bool { + + return *obj.obj.IncludeLocalPreference + +} + +// BGP Local Preference attribute sent to the peer to indicate the degree of preference for externally learned routes. If set to true, the Local Preference attribute will be included in the route advertisement. This should be included only for internal peers. +// IncludeLocalPreference returns a bool +func (obj *bgpRouteAdvanced) HasIncludeLocalPreference() bool { + return obj.obj.IncludeLocalPreference != nil +} + +// BGP Local Preference attribute sent to the peer to indicate the degree of preference for externally learned routes. If set to true, the Local Preference attribute will be included in the route advertisement. This should be included only for internal peers. +// SetIncludeLocalPreference sets the bool value in the BgpRouteAdvanced object +func (obj *bgpRouteAdvanced) SetIncludeLocalPreference(value bool) BgpRouteAdvanced { + + obj.obj.IncludeLocalPreference = &value + return obj +} + +// Value to be set in Local Preference attribute if include_local_preference is set to true. It is used for the selection of the path for the traffic leaving the AS. The route with the highest local preference value is preferred. +// LocalPreference returns a uint32 +func (obj *bgpRouteAdvanced) LocalPreference() uint32 { + + return *obj.obj.LocalPreference + +} + +// Value to be set in Local Preference attribute if include_local_preference is set to true. It is used for the selection of the path for the traffic leaving the AS. The route with the highest local preference value is preferred. +// LocalPreference returns a uint32 +func (obj *bgpRouteAdvanced) HasLocalPreference() bool { + return obj.obj.LocalPreference != nil +} + +// Value to be set in Local Preference attribute if include_local_preference is set to true. It is used for the selection of the path for the traffic leaving the AS. The route with the highest local preference value is preferred. +// SetLocalPreference sets the uint32 value in the BgpRouteAdvanced object +func (obj *bgpRouteAdvanced) SetLocalPreference(value uint32) BgpRouteAdvanced { + + obj.obj.LocalPreference = &value + return obj +} + +func (obj *bgpRouteAdvanced) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpRouteAdvanced) setDefault() { + if obj.obj.IncludeMultiExitDiscriminator == nil { + obj.SetIncludeMultiExitDiscriminator(true) + } + if obj.obj.IncludeOrigin == nil { + obj.SetIncludeOrigin(true) + } + if obj.obj.Origin == nil { + obj.SetOrigin(BgpRouteAdvancedOrigin.IGP) + + } + if obj.obj.IncludeLocalPreference == nil { + obj.SetIncludeLocalPreference(true) + } + if obj.obj.LocalPreference == nil { + obj.SetLocalPreference(100) + } + +} diff --git a/gosnappi/bgp_route_distinguisher.go b/gosnappi/bgp_route_distinguisher.go new file mode 100644 index 00000000..da39c483 --- /dev/null +++ b/gosnappi/bgp_route_distinguisher.go @@ -0,0 +1,386 @@ +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" +) + +// ***** BgpRouteDistinguisher ***** +type bgpRouteDistinguisher struct { + validation + obj *otg.BgpRouteDistinguisher + marshaller marshalBgpRouteDistinguisher + unMarshaller unMarshalBgpRouteDistinguisher +} + +func NewBgpRouteDistinguisher() BgpRouteDistinguisher { + obj := bgpRouteDistinguisher{obj: &otg.BgpRouteDistinguisher{}} + obj.setDefault() + return &obj +} + +func (obj *bgpRouteDistinguisher) msg() *otg.BgpRouteDistinguisher { + return obj.obj +} + +func (obj *bgpRouteDistinguisher) setMsg(msg *otg.BgpRouteDistinguisher) BgpRouteDistinguisher { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpRouteDistinguisher struct { + obj *bgpRouteDistinguisher +} + +type marshalBgpRouteDistinguisher interface { + // ToProto marshals BgpRouteDistinguisher to protobuf object *otg.BgpRouteDistinguisher + ToProto() (*otg.BgpRouteDistinguisher, error) + // ToPbText marshals BgpRouteDistinguisher to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpRouteDistinguisher to YAML text + ToYaml() (string, error) + // ToJson marshals BgpRouteDistinguisher to JSON text + ToJson() (string, error) +} + +type unMarshalbgpRouteDistinguisher struct { + obj *bgpRouteDistinguisher +} + +type unMarshalBgpRouteDistinguisher interface { + // FromProto unmarshals BgpRouteDistinguisher from protobuf object *otg.BgpRouteDistinguisher + FromProto(msg *otg.BgpRouteDistinguisher) (BgpRouteDistinguisher, error) + // FromPbText unmarshals BgpRouteDistinguisher from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpRouteDistinguisher from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpRouteDistinguisher from JSON text + FromJson(value string) error +} + +func (obj *bgpRouteDistinguisher) Marshal() marshalBgpRouteDistinguisher { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpRouteDistinguisher{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpRouteDistinguisher) Unmarshal() unMarshalBgpRouteDistinguisher { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpRouteDistinguisher{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpRouteDistinguisher) ToProto() (*otg.BgpRouteDistinguisher, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpRouteDistinguisher) FromProto(msg *otg.BgpRouteDistinguisher) (BgpRouteDistinguisher, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpRouteDistinguisher) 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 *unMarshalbgpRouteDistinguisher) 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 *marshalbgpRouteDistinguisher) 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 *unMarshalbgpRouteDistinguisher) 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 *marshalbgpRouteDistinguisher) 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 *unMarshalbgpRouteDistinguisher) 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 *bgpRouteDistinguisher) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpRouteDistinguisher) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpRouteDistinguisher) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpRouteDistinguisher) Clone() (BgpRouteDistinguisher, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpRouteDistinguisher() + 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 +} + +// BgpRouteDistinguisher is bGP Route Distinguisher. +type BgpRouteDistinguisher interface { + Validation + // msg marshals BgpRouteDistinguisher to protobuf object *otg.BgpRouteDistinguisher + // and doesn't set defaults + msg() *otg.BgpRouteDistinguisher + // setMsg unmarshals BgpRouteDistinguisher from protobuf object *otg.BgpRouteDistinguisher + // and doesn't set defaults + setMsg(*otg.BgpRouteDistinguisher) BgpRouteDistinguisher + // provides marshal interface + Marshal() marshalBgpRouteDistinguisher + // provides unmarshal interface + Unmarshal() unMarshalBgpRouteDistinguisher + // validate validates BgpRouteDistinguisher + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpRouteDistinguisher, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RdType returns BgpRouteDistinguisherRdTypeEnum, set in BgpRouteDistinguisher + RdType() BgpRouteDistinguisherRdTypeEnum + // SetRdType assigns BgpRouteDistinguisherRdTypeEnum provided by user to BgpRouteDistinguisher + SetRdType(value BgpRouteDistinguisherRdTypeEnum) BgpRouteDistinguisher + // HasRdType checks if RdType has been set in BgpRouteDistinguisher + HasRdType() bool + // AutoConfigRdIpAddr returns bool, set in BgpRouteDistinguisher. + AutoConfigRdIpAddr() bool + // SetAutoConfigRdIpAddr assigns bool provided by user to BgpRouteDistinguisher + SetAutoConfigRdIpAddr(value bool) BgpRouteDistinguisher + // HasAutoConfigRdIpAddr checks if AutoConfigRdIpAddr has been set in BgpRouteDistinguisher + HasAutoConfigRdIpAddr() bool + // RdValue returns string, set in BgpRouteDistinguisher. + RdValue() string + // SetRdValue assigns string provided by user to BgpRouteDistinguisher + SetRdValue(value string) BgpRouteDistinguisher + // HasRdValue checks if RdValue has been set in BgpRouteDistinguisher + HasRdValue() bool +} + +type BgpRouteDistinguisherRdTypeEnum string + +// Enum of RdType on BgpRouteDistinguisher +var BgpRouteDistinguisherRdType = struct { + AS_2OCTET BgpRouteDistinguisherRdTypeEnum + IPV4_ADDRESS BgpRouteDistinguisherRdTypeEnum + AS_4OCTET BgpRouteDistinguisherRdTypeEnum +}{ + AS_2OCTET: BgpRouteDistinguisherRdTypeEnum("as_2octet"), + IPV4_ADDRESS: BgpRouteDistinguisherRdTypeEnum("ipv4_address"), + AS_4OCTET: BgpRouteDistinguisherRdTypeEnum("as_4octet"), +} + +func (obj *bgpRouteDistinguisher) RdType() BgpRouteDistinguisherRdTypeEnum { + return BgpRouteDistinguisherRdTypeEnum(obj.obj.RdType.Enum().String()) +} + +// Route Distinguisher Type field of 2 Byte. +// - as_2octet: Two-Octet AS Specific Extended Community (RFC 4360). +// - ipv4_address: IPv4 Address Specific Extended Community (RFC 4360). +// - as_4octet: 4-Octet AS Specific Extended Community (RFC 5668). +// RdType returns a string +func (obj *bgpRouteDistinguisher) HasRdType() bool { + return obj.obj.RdType != nil +} + +func (obj *bgpRouteDistinguisher) SetRdType(value BgpRouteDistinguisherRdTypeEnum) BgpRouteDistinguisher { + intValue, ok := otg.BgpRouteDistinguisher_RdType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpRouteDistinguisherRdTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpRouteDistinguisher_RdType_Enum(intValue) + obj.obj.RdType = &enumValue + + return obj +} + +// Allow to automatically configure RD IP address from local ip. +// AutoConfigRdIpAddr returns a bool +func (obj *bgpRouteDistinguisher) AutoConfigRdIpAddr() bool { + + return *obj.obj.AutoConfigRdIpAddr + +} + +// Allow to automatically configure RD IP address from local ip. +// AutoConfigRdIpAddr returns a bool +func (obj *bgpRouteDistinguisher) HasAutoConfigRdIpAddr() bool { + return obj.obj.AutoConfigRdIpAddr != nil +} + +// Allow to automatically configure RD IP address from local ip. +// SetAutoConfigRdIpAddr sets the bool value in the BgpRouteDistinguisher object +func (obj *bgpRouteDistinguisher) SetAutoConfigRdIpAddr(value bool) BgpRouteDistinguisher { + + obj.obj.AutoConfigRdIpAddr = &value + return obj +} + +// Colon separated Extended Community value of 6 Bytes - "AS number: Value". Example - for the as_2octet or as_4octet "60005:100", for ipv4_address "1.1.1.1:100" +// RdValue returns a string +func (obj *bgpRouteDistinguisher) RdValue() string { + + return *obj.obj.RdValue + +} + +// Colon separated Extended Community value of 6 Bytes - "AS number: Value". Example - for the as_2octet or as_4octet "60005:100", for ipv4_address "1.1.1.1:100" +// RdValue returns a string +func (obj *bgpRouteDistinguisher) HasRdValue() bool { + return obj.obj.RdValue != nil +} + +// Colon separated Extended Community value of 6 Bytes - "AS number: Value". Example - for the as_2octet or as_4octet "60005:100", for ipv4_address "1.1.1.1:100" +// SetRdValue sets the string value in the BgpRouteDistinguisher object +func (obj *bgpRouteDistinguisher) SetRdValue(value string) BgpRouteDistinguisher { + + obj.obj.RdValue = &value + return obj +} + +func (obj *bgpRouteDistinguisher) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpRouteDistinguisher) setDefault() { + if obj.obj.RdType == nil { + obj.SetRdType(BgpRouteDistinguisherRdType.AS_2OCTET) + + } + if obj.obj.AutoConfigRdIpAddr == nil { + obj.SetAutoConfigRdIpAddr(false) + } + +} diff --git a/gosnappi/bgp_route_target.go b/gosnappi/bgp_route_target.go new file mode 100644 index 00000000..6f9b576a --- /dev/null +++ b/gosnappi/bgp_route_target.go @@ -0,0 +1,351 @@ +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" +) + +// ***** BgpRouteTarget ***** +type bgpRouteTarget struct { + validation + obj *otg.BgpRouteTarget + marshaller marshalBgpRouteTarget + unMarshaller unMarshalBgpRouteTarget +} + +func NewBgpRouteTarget() BgpRouteTarget { + obj := bgpRouteTarget{obj: &otg.BgpRouteTarget{}} + obj.setDefault() + return &obj +} + +func (obj *bgpRouteTarget) msg() *otg.BgpRouteTarget { + return obj.obj +} + +func (obj *bgpRouteTarget) setMsg(msg *otg.BgpRouteTarget) BgpRouteTarget { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpRouteTarget struct { + obj *bgpRouteTarget +} + +type marshalBgpRouteTarget interface { + // ToProto marshals BgpRouteTarget to protobuf object *otg.BgpRouteTarget + ToProto() (*otg.BgpRouteTarget, error) + // ToPbText marshals BgpRouteTarget to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpRouteTarget to YAML text + ToYaml() (string, error) + // ToJson marshals BgpRouteTarget to JSON text + ToJson() (string, error) +} + +type unMarshalbgpRouteTarget struct { + obj *bgpRouteTarget +} + +type unMarshalBgpRouteTarget interface { + // FromProto unmarshals BgpRouteTarget from protobuf object *otg.BgpRouteTarget + FromProto(msg *otg.BgpRouteTarget) (BgpRouteTarget, error) + // FromPbText unmarshals BgpRouteTarget from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpRouteTarget from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpRouteTarget from JSON text + FromJson(value string) error +} + +func (obj *bgpRouteTarget) Marshal() marshalBgpRouteTarget { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpRouteTarget{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpRouteTarget) Unmarshal() unMarshalBgpRouteTarget { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpRouteTarget{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpRouteTarget) ToProto() (*otg.BgpRouteTarget, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpRouteTarget) FromProto(msg *otg.BgpRouteTarget) (BgpRouteTarget, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpRouteTarget) 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 *unMarshalbgpRouteTarget) 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 *marshalbgpRouteTarget) 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 *unMarshalbgpRouteTarget) 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 *marshalbgpRouteTarget) 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 *unMarshalbgpRouteTarget) 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 *bgpRouteTarget) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpRouteTarget) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpRouteTarget) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpRouteTarget) Clone() (BgpRouteTarget, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpRouteTarget() + 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 +} + +// BgpRouteTarget is bGP Route Target. +type BgpRouteTarget interface { + Validation + // msg marshals BgpRouteTarget to protobuf object *otg.BgpRouteTarget + // and doesn't set defaults + msg() *otg.BgpRouteTarget + // setMsg unmarshals BgpRouteTarget from protobuf object *otg.BgpRouteTarget + // and doesn't set defaults + setMsg(*otg.BgpRouteTarget) BgpRouteTarget + // provides marshal interface + Marshal() marshalBgpRouteTarget + // provides unmarshal interface + Unmarshal() unMarshalBgpRouteTarget + // validate validates BgpRouteTarget + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpRouteTarget, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RtType returns BgpRouteTargetRtTypeEnum, set in BgpRouteTarget + RtType() BgpRouteTargetRtTypeEnum + // SetRtType assigns BgpRouteTargetRtTypeEnum provided by user to BgpRouteTarget + SetRtType(value BgpRouteTargetRtTypeEnum) BgpRouteTarget + // HasRtType checks if RtType has been set in BgpRouteTarget + HasRtType() bool + // RtValue returns string, set in BgpRouteTarget. + RtValue() string + // SetRtValue assigns string provided by user to BgpRouteTarget + SetRtValue(value string) BgpRouteTarget + // HasRtValue checks if RtValue has been set in BgpRouteTarget + HasRtValue() bool +} + +type BgpRouteTargetRtTypeEnum string + +// Enum of RtType on BgpRouteTarget +var BgpRouteTargetRtType = struct { + AS_2OCTET BgpRouteTargetRtTypeEnum + IPV4_ADDRESS BgpRouteTargetRtTypeEnum + AS_4OCTET BgpRouteTargetRtTypeEnum +}{ + AS_2OCTET: BgpRouteTargetRtTypeEnum("as_2octet"), + IPV4_ADDRESS: BgpRouteTargetRtTypeEnum("ipv4_address"), + AS_4OCTET: BgpRouteTargetRtTypeEnum("as_4octet"), +} + +func (obj *bgpRouteTarget) RtType() BgpRouteTargetRtTypeEnum { + return BgpRouteTargetRtTypeEnum(obj.obj.RtType.Enum().String()) +} + +// Extended Community Type field of 2 Byte. +// - as_2octet: Two-Octet AS Specific Extended Community (RFC 4360). +// - ipv4_address: IPv4 Address Specific Extended Community (RFC 4360). +// - as_4octet: 4-Octet AS Specific Extended Community (RFC 5668). +// RtType returns a string +func (obj *bgpRouteTarget) HasRtType() bool { + return obj.obj.RtType != nil +} + +func (obj *bgpRouteTarget) SetRtType(value BgpRouteTargetRtTypeEnum) BgpRouteTarget { + intValue, ok := otg.BgpRouteTarget_RtType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpRouteTargetRtTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpRouteTarget_RtType_Enum(intValue) + obj.obj.RtType = &enumValue + + return obj +} + +// Colon separated Extended Community value of 6 Bytes - AS number: Assigned Number. Example - for the as_2octet or as_4octet "60005:100", for ipv4_address "1.1.1.1:100" +// RtValue returns a string +func (obj *bgpRouteTarget) RtValue() string { + + return *obj.obj.RtValue + +} + +// Colon separated Extended Community value of 6 Bytes - AS number: Assigned Number. Example - for the as_2octet or as_4octet "60005:100", for ipv4_address "1.1.1.1:100" +// RtValue returns a string +func (obj *bgpRouteTarget) HasRtValue() bool { + return obj.obj.RtValue != nil +} + +// Colon separated Extended Community value of 6 Bytes - AS number: Assigned Number. Example - for the as_2octet or as_4octet "60005:100", for ipv4_address "1.1.1.1:100" +// SetRtValue sets the string value in the BgpRouteTarget object +func (obj *bgpRouteTarget) SetRtValue(value string) BgpRouteTarget { + + obj.obj.RtValue = &value + return obj +} + +func (obj *bgpRouteTarget) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpRouteTarget) setDefault() { + +} diff --git a/gosnappi/bgp_srte_binding_sub_tlv.go b/gosnappi/bgp_srte_binding_sub_tlv.go new file mode 100644 index 00000000..b72f0e26 --- /dev/null +++ b/gosnappi/bgp_srte_binding_sub_tlv.go @@ -0,0 +1,451 @@ +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" +) + +// ***** BgpSrteBindingSubTlv ***** +type bgpSrteBindingSubTlv struct { + validation + obj *otg.BgpSrteBindingSubTlv + marshaller marshalBgpSrteBindingSubTlv + unMarshaller unMarshalBgpSrteBindingSubTlv +} + +func NewBgpSrteBindingSubTlv() BgpSrteBindingSubTlv { + obj := bgpSrteBindingSubTlv{obj: &otg.BgpSrteBindingSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteBindingSubTlv) msg() *otg.BgpSrteBindingSubTlv { + return obj.obj +} + +func (obj *bgpSrteBindingSubTlv) setMsg(msg *otg.BgpSrteBindingSubTlv) BgpSrteBindingSubTlv { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteBindingSubTlv struct { + obj *bgpSrteBindingSubTlv +} + +type marshalBgpSrteBindingSubTlv interface { + // ToProto marshals BgpSrteBindingSubTlv to protobuf object *otg.BgpSrteBindingSubTlv + ToProto() (*otg.BgpSrteBindingSubTlv, error) + // ToPbText marshals BgpSrteBindingSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteBindingSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteBindingSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteBindingSubTlv struct { + obj *bgpSrteBindingSubTlv +} + +type unMarshalBgpSrteBindingSubTlv interface { + // FromProto unmarshals BgpSrteBindingSubTlv from protobuf object *otg.BgpSrteBindingSubTlv + FromProto(msg *otg.BgpSrteBindingSubTlv) (BgpSrteBindingSubTlv, error) + // FromPbText unmarshals BgpSrteBindingSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteBindingSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteBindingSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteBindingSubTlv) Marshal() marshalBgpSrteBindingSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteBindingSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteBindingSubTlv) Unmarshal() unMarshalBgpSrteBindingSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteBindingSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteBindingSubTlv) ToProto() (*otg.BgpSrteBindingSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteBindingSubTlv) FromProto(msg *otg.BgpSrteBindingSubTlv) (BgpSrteBindingSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteBindingSubTlv) 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 *unMarshalbgpSrteBindingSubTlv) 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 *marshalbgpSrteBindingSubTlv) 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 *unMarshalbgpSrteBindingSubTlv) 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 *marshalbgpSrteBindingSubTlv) 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 *unMarshalbgpSrteBindingSubTlv) 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 *bgpSrteBindingSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteBindingSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteBindingSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteBindingSubTlv) Clone() (BgpSrteBindingSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteBindingSubTlv() + 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 +} + +// BgpSrteBindingSubTlv is configuration for the binding SID sub-TLV. This is used to signal the binding SID related information of the SR Policy candidate path. +type BgpSrteBindingSubTlv interface { + Validation + // msg marshals BgpSrteBindingSubTlv to protobuf object *otg.BgpSrteBindingSubTlv + // and doesn't set defaults + msg() *otg.BgpSrteBindingSubTlv + // setMsg unmarshals BgpSrteBindingSubTlv from protobuf object *otg.BgpSrteBindingSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteBindingSubTlv) BgpSrteBindingSubTlv + // provides marshal interface + Marshal() marshalBgpSrteBindingSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteBindingSubTlv + // validate validates BgpSrteBindingSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteBindingSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // BindingSidType returns BgpSrteBindingSubTlvBindingSidTypeEnum, set in BgpSrteBindingSubTlv + BindingSidType() BgpSrteBindingSubTlvBindingSidTypeEnum + // SetBindingSidType assigns BgpSrteBindingSubTlvBindingSidTypeEnum provided by user to BgpSrteBindingSubTlv + SetBindingSidType(value BgpSrteBindingSubTlvBindingSidTypeEnum) BgpSrteBindingSubTlv + // HasBindingSidType checks if BindingSidType has been set in BgpSrteBindingSubTlv + HasBindingSidType() bool + // FourOctetSid returns uint32, set in BgpSrteBindingSubTlv. + FourOctetSid() uint32 + // SetFourOctetSid assigns uint32 provided by user to BgpSrteBindingSubTlv + SetFourOctetSid(value uint32) BgpSrteBindingSubTlv + // HasFourOctetSid checks if FourOctetSid has been set in BgpSrteBindingSubTlv + HasFourOctetSid() bool + // Ipv6Sid returns string, set in BgpSrteBindingSubTlv. + Ipv6Sid() string + // SetIpv6Sid assigns string provided by user to BgpSrteBindingSubTlv + SetIpv6Sid(value string) BgpSrteBindingSubTlv + // HasIpv6Sid checks if Ipv6Sid has been set in BgpSrteBindingSubTlv + HasIpv6Sid() bool + // SFlag returns bool, set in BgpSrteBindingSubTlv. + SFlag() bool + // SetSFlag assigns bool provided by user to BgpSrteBindingSubTlv + SetSFlag(value bool) BgpSrteBindingSubTlv + // HasSFlag checks if SFlag has been set in BgpSrteBindingSubTlv + HasSFlag() bool + // IFlag returns bool, set in BgpSrteBindingSubTlv. + IFlag() bool + // SetIFlag assigns bool provided by user to BgpSrteBindingSubTlv + SetIFlag(value bool) BgpSrteBindingSubTlv + // HasIFlag checks if IFlag has been set in BgpSrteBindingSubTlv + HasIFlag() bool +} + +type BgpSrteBindingSubTlvBindingSidTypeEnum string + +// Enum of BindingSidType on BgpSrteBindingSubTlv +var BgpSrteBindingSubTlvBindingSidType = struct { + NO_BINDING BgpSrteBindingSubTlvBindingSidTypeEnum + FOUR_OCTET_SID BgpSrteBindingSubTlvBindingSidTypeEnum + IPV6_SID BgpSrteBindingSubTlvBindingSidTypeEnum +}{ + NO_BINDING: BgpSrteBindingSubTlvBindingSidTypeEnum("no_binding"), + FOUR_OCTET_SID: BgpSrteBindingSubTlvBindingSidTypeEnum("four_octet_sid"), + IPV6_SID: BgpSrteBindingSubTlvBindingSidTypeEnum("ipv6_sid"), +} + +func (obj *bgpSrteBindingSubTlv) BindingSidType() BgpSrteBindingSubTlvBindingSidTypeEnum { + return BgpSrteBindingSubTlvBindingSidTypeEnum(obj.obj.BindingSidType.Enum().String()) +} + +// Type of the binding SID. Supported types are "No Binding SID" or "Four Octets Sid" or "IPv6 SID". +// BindingSidType returns a string +func (obj *bgpSrteBindingSubTlv) HasBindingSidType() bool { + return obj.obj.BindingSidType != nil +} + +func (obj *bgpSrteBindingSubTlv) SetBindingSidType(value BgpSrteBindingSubTlvBindingSidTypeEnum) BgpSrteBindingSubTlv { + intValue, ok := otg.BgpSrteBindingSubTlv_BindingSidType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpSrteBindingSubTlvBindingSidTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpSrteBindingSubTlv_BindingSidType_Enum(intValue) + obj.obj.BindingSidType = &enumValue + + return obj +} + +// Binding SID is encoded in 4 octets. +// FourOctetSid returns a uint32 +func (obj *bgpSrteBindingSubTlv) FourOctetSid() uint32 { + + return *obj.obj.FourOctetSid + +} + +// Binding SID is encoded in 4 octets. +// FourOctetSid returns a uint32 +func (obj *bgpSrteBindingSubTlv) HasFourOctetSid() bool { + return obj.obj.FourOctetSid != nil +} + +// Binding SID is encoded in 4 octets. +// SetFourOctetSid sets the uint32 value in the BgpSrteBindingSubTlv object +func (obj *bgpSrteBindingSubTlv) SetFourOctetSid(value uint32) BgpSrteBindingSubTlv { + + obj.obj.FourOctetSid = &value + return obj +} + +// IPv6 SID value. +// Ipv6Sid returns a string +func (obj *bgpSrteBindingSubTlv) Ipv6Sid() string { + + return *obj.obj.Ipv6Sid + +} + +// IPv6 SID value. +// Ipv6Sid returns a string +func (obj *bgpSrteBindingSubTlv) HasIpv6Sid() bool { + return obj.obj.Ipv6Sid != nil +} + +// IPv6 SID value. +// SetIpv6Sid sets the string value in the BgpSrteBindingSubTlv object +func (obj *bgpSrteBindingSubTlv) SetIpv6Sid(value string) BgpSrteBindingSubTlv { + + obj.obj.Ipv6Sid = &value + return obj +} + +// S-Flag encodes the "Specified-BSID-only" behavior. +// SFlag returns a bool +func (obj *bgpSrteBindingSubTlv) SFlag() bool { + + return *obj.obj.SFlag + +} + +// S-Flag encodes the "Specified-BSID-only" behavior. +// SFlag returns a bool +func (obj *bgpSrteBindingSubTlv) HasSFlag() bool { + return obj.obj.SFlag != nil +} + +// S-Flag encodes the "Specified-BSID-only" behavior. +// SetSFlag sets the bool value in the BgpSrteBindingSubTlv object +func (obj *bgpSrteBindingSubTlv) SetSFlag(value bool) BgpSrteBindingSubTlv { + + obj.obj.SFlag = &value + return obj +} + +// I-Flag encodes the "Drop Upon Invalid" behavior. +// IFlag returns a bool +func (obj *bgpSrteBindingSubTlv) IFlag() bool { + + return *obj.obj.IFlag + +} + +// I-Flag encodes the "Drop Upon Invalid" behavior. +// IFlag returns a bool +func (obj *bgpSrteBindingSubTlv) HasIFlag() bool { + return obj.obj.IFlag != nil +} + +// I-Flag encodes the "Drop Upon Invalid" behavior. +// SetIFlag sets the bool value in the BgpSrteBindingSubTlv object +func (obj *bgpSrteBindingSubTlv) SetIFlag(value bool) BgpSrteBindingSubTlv { + + obj.obj.IFlag = &value + return obj +} + +func (obj *bgpSrteBindingSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv6Sid != nil { + + err := obj.validateIpv6(obj.Ipv6Sid()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteBindingSubTlv.Ipv6Sid")) + } + + } + +} + +func (obj *bgpSrteBindingSubTlv) setDefault() { + if obj.obj.BindingSidType == nil { + obj.SetBindingSidType(BgpSrteBindingSubTlvBindingSidType.NO_BINDING) + + } + if obj.obj.SFlag == nil { + obj.SetSFlag(false) + } + if obj.obj.IFlag == nil { + obj.SetIFlag(false) + } + +} diff --git a/gosnappi/bgp_srte_color_sub_tlv.go b/gosnappi/bgp_srte_color_sub_tlv.go new file mode 100644 index 00000000..da3d2e40 --- /dev/null +++ b/gosnappi/bgp_srte_color_sub_tlv.go @@ -0,0 +1,315 @@ +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" +) + +// ***** BgpSrteColorSubTlv ***** +type bgpSrteColorSubTlv struct { + validation + obj *otg.BgpSrteColorSubTlv + marshaller marshalBgpSrteColorSubTlv + unMarshaller unMarshalBgpSrteColorSubTlv +} + +func NewBgpSrteColorSubTlv() BgpSrteColorSubTlv { + obj := bgpSrteColorSubTlv{obj: &otg.BgpSrteColorSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteColorSubTlv) msg() *otg.BgpSrteColorSubTlv { + return obj.obj +} + +func (obj *bgpSrteColorSubTlv) setMsg(msg *otg.BgpSrteColorSubTlv) BgpSrteColorSubTlv { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteColorSubTlv struct { + obj *bgpSrteColorSubTlv +} + +type marshalBgpSrteColorSubTlv interface { + // ToProto marshals BgpSrteColorSubTlv to protobuf object *otg.BgpSrteColorSubTlv + ToProto() (*otg.BgpSrteColorSubTlv, error) + // ToPbText marshals BgpSrteColorSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteColorSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteColorSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteColorSubTlv struct { + obj *bgpSrteColorSubTlv +} + +type unMarshalBgpSrteColorSubTlv interface { + // FromProto unmarshals BgpSrteColorSubTlv from protobuf object *otg.BgpSrteColorSubTlv + FromProto(msg *otg.BgpSrteColorSubTlv) (BgpSrteColorSubTlv, error) + // FromPbText unmarshals BgpSrteColorSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteColorSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteColorSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteColorSubTlv) Marshal() marshalBgpSrteColorSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteColorSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteColorSubTlv) Unmarshal() unMarshalBgpSrteColorSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteColorSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteColorSubTlv) ToProto() (*otg.BgpSrteColorSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteColorSubTlv) FromProto(msg *otg.BgpSrteColorSubTlv) (BgpSrteColorSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteColorSubTlv) 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 *unMarshalbgpSrteColorSubTlv) 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 *marshalbgpSrteColorSubTlv) 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 *unMarshalbgpSrteColorSubTlv) 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 *marshalbgpSrteColorSubTlv) 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 *unMarshalbgpSrteColorSubTlv) 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 *bgpSrteColorSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteColorSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteColorSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteColorSubTlv) Clone() (BgpSrteColorSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteColorSubTlv() + 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 +} + +// BgpSrteColorSubTlv is configuration for the Policy Color attribute sub-TLV. The Color sub-TLV MAY be used as a way to "color" the corresponding Tunnel TLV. The Value field of the sub-TLV is eight octets long and consists of a Color Extended Community. First two octets of its Value field are 0x030b as type and subtype of extended community. Remaining six octets are are exposed to configure. +type BgpSrteColorSubTlv interface { + Validation + // msg marshals BgpSrteColorSubTlv to protobuf object *otg.BgpSrteColorSubTlv + // and doesn't set defaults + msg() *otg.BgpSrteColorSubTlv + // setMsg unmarshals BgpSrteColorSubTlv from protobuf object *otg.BgpSrteColorSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteColorSubTlv) BgpSrteColorSubTlv + // provides marshal interface + Marshal() marshalBgpSrteColorSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteColorSubTlv + // validate validates BgpSrteColorSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteColorSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Color returns string, set in BgpSrteColorSubTlv. + Color() string + // SetColor assigns string provided by user to BgpSrteColorSubTlv + SetColor(value string) BgpSrteColorSubTlv + // HasColor checks if Color has been set in BgpSrteColorSubTlv + HasColor() bool +} + +// Six octet values. Example: 000000000064 for color value 100. +// Color returns a string +func (obj *bgpSrteColorSubTlv) Color() string { + + return *obj.obj.Color + +} + +// Six octet values. Example: 000000000064 for color value 100. +// Color returns a string +func (obj *bgpSrteColorSubTlv) HasColor() bool { + return obj.obj.Color != nil +} + +// Six octet values. Example: 000000000064 for color value 100. +// SetColor sets the string value in the BgpSrteColorSubTlv object +func (obj *bgpSrteColorSubTlv) SetColor(value string) BgpSrteColorSubTlv { + + obj.obj.Color = &value + return obj +} + +func (obj *bgpSrteColorSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Color != nil { + + err := obj.validateHex(obj.Color()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteColorSubTlv.Color")) + } + + } + +} + +func (obj *bgpSrteColorSubTlv) setDefault() { + +} diff --git a/gosnappi/bgp_srte_explicit_null_label_policy_sub_tlv.go b/gosnappi/bgp_srte_explicit_null_label_policy_sub_tlv.go new file mode 100644 index 00000000..8beaef76 --- /dev/null +++ b/gosnappi/bgp_srte_explicit_null_label_policy_sub_tlv.go @@ -0,0 +1,328 @@ +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" +) + +// ***** BgpSrteExplicitNullLabelPolicySubTlv ***** +type bgpSrteExplicitNullLabelPolicySubTlv struct { + validation + obj *otg.BgpSrteExplicitNullLabelPolicySubTlv + marshaller marshalBgpSrteExplicitNullLabelPolicySubTlv + unMarshaller unMarshalBgpSrteExplicitNullLabelPolicySubTlv +} + +func NewBgpSrteExplicitNullLabelPolicySubTlv() BgpSrteExplicitNullLabelPolicySubTlv { + obj := bgpSrteExplicitNullLabelPolicySubTlv{obj: &otg.BgpSrteExplicitNullLabelPolicySubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteExplicitNullLabelPolicySubTlv) msg() *otg.BgpSrteExplicitNullLabelPolicySubTlv { + return obj.obj +} + +func (obj *bgpSrteExplicitNullLabelPolicySubTlv) setMsg(msg *otg.BgpSrteExplicitNullLabelPolicySubTlv) BgpSrteExplicitNullLabelPolicySubTlv { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteExplicitNullLabelPolicySubTlv struct { + obj *bgpSrteExplicitNullLabelPolicySubTlv +} + +type marshalBgpSrteExplicitNullLabelPolicySubTlv interface { + // ToProto marshals BgpSrteExplicitNullLabelPolicySubTlv to protobuf object *otg.BgpSrteExplicitNullLabelPolicySubTlv + ToProto() (*otg.BgpSrteExplicitNullLabelPolicySubTlv, error) + // ToPbText marshals BgpSrteExplicitNullLabelPolicySubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteExplicitNullLabelPolicySubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteExplicitNullLabelPolicySubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteExplicitNullLabelPolicySubTlv struct { + obj *bgpSrteExplicitNullLabelPolicySubTlv +} + +type unMarshalBgpSrteExplicitNullLabelPolicySubTlv interface { + // FromProto unmarshals BgpSrteExplicitNullLabelPolicySubTlv from protobuf object *otg.BgpSrteExplicitNullLabelPolicySubTlv + FromProto(msg *otg.BgpSrteExplicitNullLabelPolicySubTlv) (BgpSrteExplicitNullLabelPolicySubTlv, error) + // FromPbText unmarshals BgpSrteExplicitNullLabelPolicySubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteExplicitNullLabelPolicySubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteExplicitNullLabelPolicySubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteExplicitNullLabelPolicySubTlv) Marshal() marshalBgpSrteExplicitNullLabelPolicySubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteExplicitNullLabelPolicySubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteExplicitNullLabelPolicySubTlv) Unmarshal() unMarshalBgpSrteExplicitNullLabelPolicySubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteExplicitNullLabelPolicySubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteExplicitNullLabelPolicySubTlv) ToProto() (*otg.BgpSrteExplicitNullLabelPolicySubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteExplicitNullLabelPolicySubTlv) FromProto(msg *otg.BgpSrteExplicitNullLabelPolicySubTlv) (BgpSrteExplicitNullLabelPolicySubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteExplicitNullLabelPolicySubTlv) 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 *unMarshalbgpSrteExplicitNullLabelPolicySubTlv) 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 *marshalbgpSrteExplicitNullLabelPolicySubTlv) 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 *unMarshalbgpSrteExplicitNullLabelPolicySubTlv) 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 *marshalbgpSrteExplicitNullLabelPolicySubTlv) 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 *unMarshalbgpSrteExplicitNullLabelPolicySubTlv) 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 *bgpSrteExplicitNullLabelPolicySubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteExplicitNullLabelPolicySubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteExplicitNullLabelPolicySubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteExplicitNullLabelPolicySubTlv) Clone() (BgpSrteExplicitNullLabelPolicySubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteExplicitNullLabelPolicySubTlv() + 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 +} + +// BgpSrteExplicitNullLabelPolicySubTlv is configuration for BGP explicit null label policy sub TLV settings. +type BgpSrteExplicitNullLabelPolicySubTlv interface { + Validation + // msg marshals BgpSrteExplicitNullLabelPolicySubTlv to protobuf object *otg.BgpSrteExplicitNullLabelPolicySubTlv + // and doesn't set defaults + msg() *otg.BgpSrteExplicitNullLabelPolicySubTlv + // setMsg unmarshals BgpSrteExplicitNullLabelPolicySubTlv from protobuf object *otg.BgpSrteExplicitNullLabelPolicySubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteExplicitNullLabelPolicySubTlv) BgpSrteExplicitNullLabelPolicySubTlv + // provides marshal interface + Marshal() marshalBgpSrteExplicitNullLabelPolicySubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteExplicitNullLabelPolicySubTlv + // validate validates BgpSrteExplicitNullLabelPolicySubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteExplicitNullLabelPolicySubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ExplicitNullLabelPolicy returns BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum, set in BgpSrteExplicitNullLabelPolicySubTlv + ExplicitNullLabelPolicy() BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum + // SetExplicitNullLabelPolicy assigns BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum provided by user to BgpSrteExplicitNullLabelPolicySubTlv + SetExplicitNullLabelPolicy(value BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum) BgpSrteExplicitNullLabelPolicySubTlv + // HasExplicitNullLabelPolicy checks if ExplicitNullLabelPolicy has been set in BgpSrteExplicitNullLabelPolicySubTlv + HasExplicitNullLabelPolicy() bool +} + +type BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum string + +// Enum of ExplicitNullLabelPolicy on BgpSrteExplicitNullLabelPolicySubTlv +var BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicy = struct { + RESERVED_ENLP BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum + PUSH_IPV4_ENLP BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum + PUSH_IPV6_ENLP BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum + PUSH_IPV4_IPV6_ENLP BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum + DO_NOT_PUSH_ENLP BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum +}{ + RESERVED_ENLP: BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum("reserved_enlp"), + PUSH_IPV4_ENLP: BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum("push_ipv4_enlp"), + PUSH_IPV6_ENLP: BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum("push_ipv6_enlp"), + PUSH_IPV4_IPV6_ENLP: BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum("push_ipv4_ipv6_enlp"), + DO_NOT_PUSH_ENLP: BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum("do_not_push_enlp"), +} + +func (obj *bgpSrteExplicitNullLabelPolicySubTlv) ExplicitNullLabelPolicy() BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum { + return BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum(obj.obj.ExplicitNullLabelPolicy.Enum().String()) +} + +// The value of the explicit null label policy +// ExplicitNullLabelPolicy returns a string +func (obj *bgpSrteExplicitNullLabelPolicySubTlv) HasExplicitNullLabelPolicy() bool { + return obj.obj.ExplicitNullLabelPolicy != nil +} + +func (obj *bgpSrteExplicitNullLabelPolicySubTlv) SetExplicitNullLabelPolicy(value BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum) BgpSrteExplicitNullLabelPolicySubTlv { + intValue, ok := otg.BgpSrteExplicitNullLabelPolicySubTlv_ExplicitNullLabelPolicy_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum", string(value))) + return obj + } + enumValue := otg.BgpSrteExplicitNullLabelPolicySubTlv_ExplicitNullLabelPolicy_Enum(intValue) + obj.obj.ExplicitNullLabelPolicy = &enumValue + + return obj +} + +func (obj *bgpSrteExplicitNullLabelPolicySubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpSrteExplicitNullLabelPolicySubTlv) setDefault() { + if obj.obj.ExplicitNullLabelPolicy == nil { + obj.SetExplicitNullLabelPolicy(BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicy.DO_NOT_PUSH_ENLP) + + } + +} diff --git a/gosnappi/bgp_srte_policy_name_sub_tlv.go b/gosnappi/bgp_srte_policy_name_sub_tlv.go new file mode 100644 index 00000000..2646b90c --- /dev/null +++ b/gosnappi/bgp_srte_policy_name_sub_tlv.go @@ -0,0 +1,318 @@ +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" +) + +// ***** BgpSrtePolicyNameSubTlv ***** +type bgpSrtePolicyNameSubTlv struct { + validation + obj *otg.BgpSrtePolicyNameSubTlv + marshaller marshalBgpSrtePolicyNameSubTlv + unMarshaller unMarshalBgpSrtePolicyNameSubTlv +} + +func NewBgpSrtePolicyNameSubTlv() BgpSrtePolicyNameSubTlv { + obj := bgpSrtePolicyNameSubTlv{obj: &otg.BgpSrtePolicyNameSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrtePolicyNameSubTlv) msg() *otg.BgpSrtePolicyNameSubTlv { + return obj.obj +} + +func (obj *bgpSrtePolicyNameSubTlv) setMsg(msg *otg.BgpSrtePolicyNameSubTlv) BgpSrtePolicyNameSubTlv { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrtePolicyNameSubTlv struct { + obj *bgpSrtePolicyNameSubTlv +} + +type marshalBgpSrtePolicyNameSubTlv interface { + // ToProto marshals BgpSrtePolicyNameSubTlv to protobuf object *otg.BgpSrtePolicyNameSubTlv + ToProto() (*otg.BgpSrtePolicyNameSubTlv, error) + // ToPbText marshals BgpSrtePolicyNameSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrtePolicyNameSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrtePolicyNameSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrtePolicyNameSubTlv struct { + obj *bgpSrtePolicyNameSubTlv +} + +type unMarshalBgpSrtePolicyNameSubTlv interface { + // FromProto unmarshals BgpSrtePolicyNameSubTlv from protobuf object *otg.BgpSrtePolicyNameSubTlv + FromProto(msg *otg.BgpSrtePolicyNameSubTlv) (BgpSrtePolicyNameSubTlv, error) + // FromPbText unmarshals BgpSrtePolicyNameSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrtePolicyNameSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrtePolicyNameSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrtePolicyNameSubTlv) Marshal() marshalBgpSrtePolicyNameSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrtePolicyNameSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrtePolicyNameSubTlv) Unmarshal() unMarshalBgpSrtePolicyNameSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrtePolicyNameSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrtePolicyNameSubTlv) ToProto() (*otg.BgpSrtePolicyNameSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrtePolicyNameSubTlv) FromProto(msg *otg.BgpSrtePolicyNameSubTlv) (BgpSrtePolicyNameSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrtePolicyNameSubTlv) 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 *unMarshalbgpSrtePolicyNameSubTlv) 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 *marshalbgpSrtePolicyNameSubTlv) 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 *unMarshalbgpSrtePolicyNameSubTlv) 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 *marshalbgpSrtePolicyNameSubTlv) 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 *unMarshalbgpSrtePolicyNameSubTlv) 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 *bgpSrtePolicyNameSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrtePolicyNameSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrtePolicyNameSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrtePolicyNameSubTlv) Clone() (BgpSrtePolicyNameSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrtePolicyNameSubTlv() + 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 +} + +// BgpSrtePolicyNameSubTlv is configuration for the Policy Name sub-TLV. The Policy Name sub-TLV is used to attach a symbolic name to the SR Policy candidate path. +type BgpSrtePolicyNameSubTlv interface { + Validation + // msg marshals BgpSrtePolicyNameSubTlv to protobuf object *otg.BgpSrtePolicyNameSubTlv + // and doesn't set defaults + msg() *otg.BgpSrtePolicyNameSubTlv + // setMsg unmarshals BgpSrtePolicyNameSubTlv from protobuf object *otg.BgpSrtePolicyNameSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrtePolicyNameSubTlv) BgpSrtePolicyNameSubTlv + // provides marshal interface + Marshal() marshalBgpSrtePolicyNameSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrtePolicyNameSubTlv + // validate validates BgpSrtePolicyNameSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrtePolicyNameSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PolicyName returns string, set in BgpSrtePolicyNameSubTlv. + PolicyName() string + // SetPolicyName assigns string provided by user to BgpSrtePolicyNameSubTlv + SetPolicyName(value string) BgpSrtePolicyNameSubTlv + // HasPolicyName checks if PolicyName has been set in BgpSrtePolicyNameSubTlv + HasPolicyName() bool +} + +// Symbolic name for the policy that should be a string of printable ASCII characters, without a NULL terminator. +// PolicyName returns a string +func (obj *bgpSrtePolicyNameSubTlv) PolicyName() string { + + return *obj.obj.PolicyName + +} + +// Symbolic name for the policy that should be a string of printable ASCII characters, without a NULL terminator. +// PolicyName returns a string +func (obj *bgpSrtePolicyNameSubTlv) HasPolicyName() bool { + return obj.obj.PolicyName != nil +} + +// Symbolic name for the policy that should be a string of printable ASCII characters, without a NULL terminator. +// SetPolicyName sets the string value in the BgpSrtePolicyNameSubTlv object +func (obj *bgpSrtePolicyNameSubTlv) SetPolicyName(value string) BgpSrtePolicyNameSubTlv { + + obj.obj.PolicyName = &value + return obj +} + +func (obj *bgpSrtePolicyNameSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.PolicyName != nil { + + if len(*obj.obj.PolicyName) < 1 || len(*obj.obj.PolicyName) > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "1 <= length of BgpSrtePolicyNameSubTlv.PolicyName <= 32 but Got %d", + len(*obj.obj.PolicyName))) + } + + } + +} + +func (obj *bgpSrtePolicyNameSubTlv) setDefault() { + +} diff --git a/gosnappi/bgp_srte_policy_priority_sub_tlv.go b/gosnappi/bgp_srte_policy_priority_sub_tlv.go new file mode 100644 index 00000000..c6b34c7d --- /dev/null +++ b/gosnappi/bgp_srte_policy_priority_sub_tlv.go @@ -0,0 +1,316 @@ +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" +) + +// ***** BgpSrtePolicyPrioritySubTlv ***** +type bgpSrtePolicyPrioritySubTlv struct { + validation + obj *otg.BgpSrtePolicyPrioritySubTlv + marshaller marshalBgpSrtePolicyPrioritySubTlv + unMarshaller unMarshalBgpSrtePolicyPrioritySubTlv +} + +func NewBgpSrtePolicyPrioritySubTlv() BgpSrtePolicyPrioritySubTlv { + obj := bgpSrtePolicyPrioritySubTlv{obj: &otg.BgpSrtePolicyPrioritySubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrtePolicyPrioritySubTlv) msg() *otg.BgpSrtePolicyPrioritySubTlv { + return obj.obj +} + +func (obj *bgpSrtePolicyPrioritySubTlv) setMsg(msg *otg.BgpSrtePolicyPrioritySubTlv) BgpSrtePolicyPrioritySubTlv { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrtePolicyPrioritySubTlv struct { + obj *bgpSrtePolicyPrioritySubTlv +} + +type marshalBgpSrtePolicyPrioritySubTlv interface { + // ToProto marshals BgpSrtePolicyPrioritySubTlv to protobuf object *otg.BgpSrtePolicyPrioritySubTlv + ToProto() (*otg.BgpSrtePolicyPrioritySubTlv, error) + // ToPbText marshals BgpSrtePolicyPrioritySubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrtePolicyPrioritySubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrtePolicyPrioritySubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrtePolicyPrioritySubTlv struct { + obj *bgpSrtePolicyPrioritySubTlv +} + +type unMarshalBgpSrtePolicyPrioritySubTlv interface { + // FromProto unmarshals BgpSrtePolicyPrioritySubTlv from protobuf object *otg.BgpSrtePolicyPrioritySubTlv + FromProto(msg *otg.BgpSrtePolicyPrioritySubTlv) (BgpSrtePolicyPrioritySubTlv, error) + // FromPbText unmarshals BgpSrtePolicyPrioritySubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrtePolicyPrioritySubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrtePolicyPrioritySubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrtePolicyPrioritySubTlv) Marshal() marshalBgpSrtePolicyPrioritySubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrtePolicyPrioritySubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrtePolicyPrioritySubTlv) Unmarshal() unMarshalBgpSrtePolicyPrioritySubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrtePolicyPrioritySubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrtePolicyPrioritySubTlv) ToProto() (*otg.BgpSrtePolicyPrioritySubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrtePolicyPrioritySubTlv) FromProto(msg *otg.BgpSrtePolicyPrioritySubTlv) (BgpSrtePolicyPrioritySubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrtePolicyPrioritySubTlv) 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 *unMarshalbgpSrtePolicyPrioritySubTlv) 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 *marshalbgpSrtePolicyPrioritySubTlv) 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 *unMarshalbgpSrtePolicyPrioritySubTlv) 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 *marshalbgpSrtePolicyPrioritySubTlv) 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 *unMarshalbgpSrtePolicyPrioritySubTlv) 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 *bgpSrtePolicyPrioritySubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrtePolicyPrioritySubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrtePolicyPrioritySubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrtePolicyPrioritySubTlv) Clone() (BgpSrtePolicyPrioritySubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrtePolicyPrioritySubTlv() + 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 +} + +// BgpSrtePolicyPrioritySubTlv is configuration for the Policy Priority sub-TLV. The Policy Priority to indicate the order in which the SR policies are re-computed upon topological change. +type BgpSrtePolicyPrioritySubTlv interface { + Validation + // msg marshals BgpSrtePolicyPrioritySubTlv to protobuf object *otg.BgpSrtePolicyPrioritySubTlv + // and doesn't set defaults + msg() *otg.BgpSrtePolicyPrioritySubTlv + // setMsg unmarshals BgpSrtePolicyPrioritySubTlv from protobuf object *otg.BgpSrtePolicyPrioritySubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrtePolicyPrioritySubTlv) BgpSrtePolicyPrioritySubTlv + // provides marshal interface + Marshal() marshalBgpSrtePolicyPrioritySubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrtePolicyPrioritySubTlv + // validate validates BgpSrtePolicyPrioritySubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrtePolicyPrioritySubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PolicyPriority returns uint32, set in BgpSrtePolicyPrioritySubTlv. + PolicyPriority() uint32 + // SetPolicyPriority assigns uint32 provided by user to BgpSrtePolicyPrioritySubTlv + SetPolicyPriority(value uint32) BgpSrtePolicyPrioritySubTlv + // HasPolicyPriority checks if PolicyPriority has been set in BgpSrtePolicyPrioritySubTlv + HasPolicyPriority() bool +} + +// One-octet Priority value. +// PolicyPriority returns a uint32 +func (obj *bgpSrtePolicyPrioritySubTlv) PolicyPriority() uint32 { + + return *obj.obj.PolicyPriority + +} + +// One-octet Priority value. +// PolicyPriority returns a uint32 +func (obj *bgpSrtePolicyPrioritySubTlv) HasPolicyPriority() bool { + return obj.obj.PolicyPriority != nil +} + +// One-octet Priority value. +// SetPolicyPriority sets the uint32 value in the BgpSrtePolicyPrioritySubTlv object +func (obj *bgpSrtePolicyPrioritySubTlv) SetPolicyPriority(value uint32) BgpSrtePolicyPrioritySubTlv { + + obj.obj.PolicyPriority = &value + return obj +} + +func (obj *bgpSrtePolicyPrioritySubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.PolicyPriority != nil { + + if *obj.obj.PolicyPriority > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpSrtePolicyPrioritySubTlv.PolicyPriority <= 255 but Got %d", *obj.obj.PolicyPriority)) + } + + } + +} + +func (obj *bgpSrtePolicyPrioritySubTlv) setDefault() { + +} diff --git a/gosnappi/bgp_srte_preference_sub_tlv.go b/gosnappi/bgp_srte_preference_sub_tlv.go new file mode 100644 index 00000000..aca3410a --- /dev/null +++ b/gosnappi/bgp_srte_preference_sub_tlv.go @@ -0,0 +1,309 @@ +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" +) + +// ***** BgpSrtePreferenceSubTlv ***** +type bgpSrtePreferenceSubTlv struct { + validation + obj *otg.BgpSrtePreferenceSubTlv + marshaller marshalBgpSrtePreferenceSubTlv + unMarshaller unMarshalBgpSrtePreferenceSubTlv +} + +func NewBgpSrtePreferenceSubTlv() BgpSrtePreferenceSubTlv { + obj := bgpSrtePreferenceSubTlv{obj: &otg.BgpSrtePreferenceSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrtePreferenceSubTlv) msg() *otg.BgpSrtePreferenceSubTlv { + return obj.obj +} + +func (obj *bgpSrtePreferenceSubTlv) setMsg(msg *otg.BgpSrtePreferenceSubTlv) BgpSrtePreferenceSubTlv { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrtePreferenceSubTlv struct { + obj *bgpSrtePreferenceSubTlv +} + +type marshalBgpSrtePreferenceSubTlv interface { + // ToProto marshals BgpSrtePreferenceSubTlv to protobuf object *otg.BgpSrtePreferenceSubTlv + ToProto() (*otg.BgpSrtePreferenceSubTlv, error) + // ToPbText marshals BgpSrtePreferenceSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrtePreferenceSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrtePreferenceSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrtePreferenceSubTlv struct { + obj *bgpSrtePreferenceSubTlv +} + +type unMarshalBgpSrtePreferenceSubTlv interface { + // FromProto unmarshals BgpSrtePreferenceSubTlv from protobuf object *otg.BgpSrtePreferenceSubTlv + FromProto(msg *otg.BgpSrtePreferenceSubTlv) (BgpSrtePreferenceSubTlv, error) + // FromPbText unmarshals BgpSrtePreferenceSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrtePreferenceSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrtePreferenceSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrtePreferenceSubTlv) Marshal() marshalBgpSrtePreferenceSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrtePreferenceSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrtePreferenceSubTlv) Unmarshal() unMarshalBgpSrtePreferenceSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrtePreferenceSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrtePreferenceSubTlv) ToProto() (*otg.BgpSrtePreferenceSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrtePreferenceSubTlv) FromProto(msg *otg.BgpSrtePreferenceSubTlv) (BgpSrtePreferenceSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrtePreferenceSubTlv) 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 *unMarshalbgpSrtePreferenceSubTlv) 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 *marshalbgpSrtePreferenceSubTlv) 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 *unMarshalbgpSrtePreferenceSubTlv) 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 *marshalbgpSrtePreferenceSubTlv) 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 *unMarshalbgpSrtePreferenceSubTlv) 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 *bgpSrtePreferenceSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrtePreferenceSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrtePreferenceSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrtePreferenceSubTlv) Clone() (BgpSrtePreferenceSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrtePreferenceSubTlv() + 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 +} + +// BgpSrtePreferenceSubTlv is configuration for BGP preference sub TLV of the SR Policy candidate path. +type BgpSrtePreferenceSubTlv interface { + Validation + // msg marshals BgpSrtePreferenceSubTlv to protobuf object *otg.BgpSrtePreferenceSubTlv + // and doesn't set defaults + msg() *otg.BgpSrtePreferenceSubTlv + // setMsg unmarshals BgpSrtePreferenceSubTlv from protobuf object *otg.BgpSrtePreferenceSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrtePreferenceSubTlv) BgpSrtePreferenceSubTlv + // provides marshal interface + Marshal() marshalBgpSrtePreferenceSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrtePreferenceSubTlv + // validate validates BgpSrtePreferenceSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrtePreferenceSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Preference returns uint32, set in BgpSrtePreferenceSubTlv. + Preference() uint32 + // SetPreference assigns uint32 provided by user to BgpSrtePreferenceSubTlv + SetPreference(value uint32) BgpSrtePreferenceSubTlv + // HasPreference checks if Preference has been set in BgpSrtePreferenceSubTlv + HasPreference() bool +} + +// The preference value of the SR Policy candidate path. +// Preference returns a uint32 +func (obj *bgpSrtePreferenceSubTlv) Preference() uint32 { + + return *obj.obj.Preference + +} + +// The preference value of the SR Policy candidate path. +// Preference returns a uint32 +func (obj *bgpSrtePreferenceSubTlv) HasPreference() bool { + return obj.obj.Preference != nil +} + +// The preference value of the SR Policy candidate path. +// SetPreference sets the uint32 value in the BgpSrtePreferenceSubTlv object +func (obj *bgpSrtePreferenceSubTlv) SetPreference(value uint32) BgpSrtePreferenceSubTlv { + + obj.obj.Preference = &value + return obj +} + +func (obj *bgpSrtePreferenceSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpSrtePreferenceSubTlv) setDefault() { + if obj.obj.Preference == nil { + obj.SetPreference(0) + } + +} diff --git a/gosnappi/bgp_srte_remote_endpoint_sub_tlv.go b/gosnappi/bgp_srte_remote_endpoint_sub_tlv.go new file mode 100644 index 00000000..779f5255 --- /dev/null +++ b/gosnappi/bgp_srte_remote_endpoint_sub_tlv.go @@ -0,0 +1,433 @@ +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" +) + +// ***** BgpSrteRemoteEndpointSubTlv ***** +type bgpSrteRemoteEndpointSubTlv struct { + validation + obj *otg.BgpSrteRemoteEndpointSubTlv + marshaller marshalBgpSrteRemoteEndpointSubTlv + unMarshaller unMarshalBgpSrteRemoteEndpointSubTlv +} + +func NewBgpSrteRemoteEndpointSubTlv() BgpSrteRemoteEndpointSubTlv { + obj := bgpSrteRemoteEndpointSubTlv{obj: &otg.BgpSrteRemoteEndpointSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteRemoteEndpointSubTlv) msg() *otg.BgpSrteRemoteEndpointSubTlv { + return obj.obj +} + +func (obj *bgpSrteRemoteEndpointSubTlv) setMsg(msg *otg.BgpSrteRemoteEndpointSubTlv) BgpSrteRemoteEndpointSubTlv { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteRemoteEndpointSubTlv struct { + obj *bgpSrteRemoteEndpointSubTlv +} + +type marshalBgpSrteRemoteEndpointSubTlv interface { + // ToProto marshals BgpSrteRemoteEndpointSubTlv to protobuf object *otg.BgpSrteRemoteEndpointSubTlv + ToProto() (*otg.BgpSrteRemoteEndpointSubTlv, error) + // ToPbText marshals BgpSrteRemoteEndpointSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteRemoteEndpointSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteRemoteEndpointSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteRemoteEndpointSubTlv struct { + obj *bgpSrteRemoteEndpointSubTlv +} + +type unMarshalBgpSrteRemoteEndpointSubTlv interface { + // FromProto unmarshals BgpSrteRemoteEndpointSubTlv from protobuf object *otg.BgpSrteRemoteEndpointSubTlv + FromProto(msg *otg.BgpSrteRemoteEndpointSubTlv) (BgpSrteRemoteEndpointSubTlv, error) + // FromPbText unmarshals BgpSrteRemoteEndpointSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteRemoteEndpointSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteRemoteEndpointSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteRemoteEndpointSubTlv) Marshal() marshalBgpSrteRemoteEndpointSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteRemoteEndpointSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteRemoteEndpointSubTlv) Unmarshal() unMarshalBgpSrteRemoteEndpointSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteRemoteEndpointSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteRemoteEndpointSubTlv) ToProto() (*otg.BgpSrteRemoteEndpointSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteRemoteEndpointSubTlv) FromProto(msg *otg.BgpSrteRemoteEndpointSubTlv) (BgpSrteRemoteEndpointSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteRemoteEndpointSubTlv) 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 *unMarshalbgpSrteRemoteEndpointSubTlv) 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 *marshalbgpSrteRemoteEndpointSubTlv) 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 *unMarshalbgpSrteRemoteEndpointSubTlv) 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 *marshalbgpSrteRemoteEndpointSubTlv) 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 *unMarshalbgpSrteRemoteEndpointSubTlv) 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 *bgpSrteRemoteEndpointSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteRemoteEndpointSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteRemoteEndpointSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteRemoteEndpointSubTlv) Clone() (BgpSrteRemoteEndpointSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteRemoteEndpointSubTlv() + 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 +} + +// BgpSrteRemoteEndpointSubTlv is configuration for the BGP remote endpoint sub TLV. +type BgpSrteRemoteEndpointSubTlv interface { + Validation + // msg marshals BgpSrteRemoteEndpointSubTlv to protobuf object *otg.BgpSrteRemoteEndpointSubTlv + // and doesn't set defaults + msg() *otg.BgpSrteRemoteEndpointSubTlv + // setMsg unmarshals BgpSrteRemoteEndpointSubTlv from protobuf object *otg.BgpSrteRemoteEndpointSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteRemoteEndpointSubTlv) BgpSrteRemoteEndpointSubTlv + // provides marshal interface + Marshal() marshalBgpSrteRemoteEndpointSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteRemoteEndpointSubTlv + // validate validates BgpSrteRemoteEndpointSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteRemoteEndpointSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // AsNumber returns uint32, set in BgpSrteRemoteEndpointSubTlv. + AsNumber() uint32 + // SetAsNumber assigns uint32 provided by user to BgpSrteRemoteEndpointSubTlv + SetAsNumber(value uint32) BgpSrteRemoteEndpointSubTlv + // HasAsNumber checks if AsNumber has been set in BgpSrteRemoteEndpointSubTlv + HasAsNumber() bool + // AddressFamily returns BgpSrteRemoteEndpointSubTlvAddressFamilyEnum, set in BgpSrteRemoteEndpointSubTlv + AddressFamily() BgpSrteRemoteEndpointSubTlvAddressFamilyEnum + // SetAddressFamily assigns BgpSrteRemoteEndpointSubTlvAddressFamilyEnum provided by user to BgpSrteRemoteEndpointSubTlv + SetAddressFamily(value BgpSrteRemoteEndpointSubTlvAddressFamilyEnum) BgpSrteRemoteEndpointSubTlv + // HasAddressFamily checks if AddressFamily has been set in BgpSrteRemoteEndpointSubTlv + HasAddressFamily() bool + // Ipv4Address returns string, set in BgpSrteRemoteEndpointSubTlv. + Ipv4Address() string + // SetIpv4Address assigns string provided by user to BgpSrteRemoteEndpointSubTlv + SetIpv4Address(value string) BgpSrteRemoteEndpointSubTlv + // HasIpv4Address checks if Ipv4Address has been set in BgpSrteRemoteEndpointSubTlv + HasIpv4Address() bool + // Ipv6Address returns string, set in BgpSrteRemoteEndpointSubTlv. + Ipv6Address() string + // SetIpv6Address assigns string provided by user to BgpSrteRemoteEndpointSubTlv + SetIpv6Address(value string) BgpSrteRemoteEndpointSubTlv + // HasIpv6Address checks if Ipv6Address has been set in BgpSrteRemoteEndpointSubTlv + HasIpv6Address() bool +} + +// Autonomous system (AS) number +// AsNumber returns a uint32 +func (obj *bgpSrteRemoteEndpointSubTlv) AsNumber() uint32 { + + return *obj.obj.AsNumber + +} + +// Autonomous system (AS) number +// AsNumber returns a uint32 +func (obj *bgpSrteRemoteEndpointSubTlv) HasAsNumber() bool { + return obj.obj.AsNumber != nil +} + +// Autonomous system (AS) number +// SetAsNumber sets the uint32 value in the BgpSrteRemoteEndpointSubTlv object +func (obj *bgpSrteRemoteEndpointSubTlv) SetAsNumber(value uint32) BgpSrteRemoteEndpointSubTlv { + + obj.obj.AsNumber = &value + return obj +} + +type BgpSrteRemoteEndpointSubTlvAddressFamilyEnum string + +// Enum of AddressFamily on BgpSrteRemoteEndpointSubTlv +var BgpSrteRemoteEndpointSubTlvAddressFamily = struct { + IPV4 BgpSrteRemoteEndpointSubTlvAddressFamilyEnum + IPV6 BgpSrteRemoteEndpointSubTlvAddressFamilyEnum +}{ + IPV4: BgpSrteRemoteEndpointSubTlvAddressFamilyEnum("ipv4"), + IPV6: BgpSrteRemoteEndpointSubTlvAddressFamilyEnum("ipv6"), +} + +func (obj *bgpSrteRemoteEndpointSubTlv) AddressFamily() BgpSrteRemoteEndpointSubTlvAddressFamilyEnum { + return BgpSrteRemoteEndpointSubTlvAddressFamilyEnum(obj.obj.AddressFamily.Enum().String()) +} + +// Determines the address type +// AddressFamily returns a string +func (obj *bgpSrteRemoteEndpointSubTlv) HasAddressFamily() bool { + return obj.obj.AddressFamily != nil +} + +func (obj *bgpSrteRemoteEndpointSubTlv) SetAddressFamily(value BgpSrteRemoteEndpointSubTlvAddressFamilyEnum) BgpSrteRemoteEndpointSubTlv { + intValue, ok := otg.BgpSrteRemoteEndpointSubTlv_AddressFamily_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpSrteRemoteEndpointSubTlvAddressFamilyEnum", string(value))) + return obj + } + enumValue := otg.BgpSrteRemoteEndpointSubTlv_AddressFamily_Enum(intValue) + obj.obj.AddressFamily = &enumValue + + return obj +} + +// The IPv4 address of the Remote Endpoint. +// Ipv4Address returns a string +func (obj *bgpSrteRemoteEndpointSubTlv) Ipv4Address() string { + + return *obj.obj.Ipv4Address + +} + +// The IPv4 address of the Remote Endpoint. +// Ipv4Address returns a string +func (obj *bgpSrteRemoteEndpointSubTlv) HasIpv4Address() bool { + return obj.obj.Ipv4Address != nil +} + +// The IPv4 address of the Remote Endpoint. +// SetIpv4Address sets the string value in the BgpSrteRemoteEndpointSubTlv object +func (obj *bgpSrteRemoteEndpointSubTlv) SetIpv4Address(value string) BgpSrteRemoteEndpointSubTlv { + + obj.obj.Ipv4Address = &value + return obj +} + +// The IPv6 address of the Remote Endpoint. +// Ipv6Address returns a string +func (obj *bgpSrteRemoteEndpointSubTlv) Ipv6Address() string { + + return *obj.obj.Ipv6Address + +} + +// The IPv6 address of the Remote Endpoint. +// Ipv6Address returns a string +func (obj *bgpSrteRemoteEndpointSubTlv) HasIpv6Address() bool { + return obj.obj.Ipv6Address != nil +} + +// The IPv6 address of the Remote Endpoint. +// SetIpv6Address sets the string value in the BgpSrteRemoteEndpointSubTlv object +func (obj *bgpSrteRemoteEndpointSubTlv) SetIpv6Address(value string) BgpSrteRemoteEndpointSubTlv { + + obj.obj.Ipv6Address = &value + return obj +} + +func (obj *bgpSrteRemoteEndpointSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv4Address != nil { + + err := obj.validateIpv4(obj.Ipv4Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteRemoteEndpointSubTlv.Ipv4Address")) + } + + } + + if obj.obj.Ipv6Address != nil { + + err := obj.validateIpv6(obj.Ipv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteRemoteEndpointSubTlv.Ipv6Address")) + } + + } + +} + +func (obj *bgpSrteRemoteEndpointSubTlv) setDefault() { + if obj.obj.AsNumber == nil { + obj.SetAsNumber(0) + } + if obj.obj.AddressFamily == nil { + obj.SetAddressFamily(BgpSrteRemoteEndpointSubTlvAddressFamily.IPV4) + + } + if obj.obj.Ipv4Address == nil { + obj.SetIpv4Address("0.0.0.0") + } + if obj.obj.Ipv6Address == nil { + obj.SetIpv6Address("::0") + } + +} diff --git a/gosnappi/bgp_srte_s_rv6_sid_endpoint_behavior_and_structure.go b/gosnappi/bgp_srte_s_rv6_sid_endpoint_behavior_and_structure.go new file mode 100644 index 00000000..ca40bf27 --- /dev/null +++ b/gosnappi/bgp_srte_s_rv6_sid_endpoint_behavior_and_structure.go @@ -0,0 +1,442 @@ +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" +) + +// ***** BgpSrteSRv6SIDEndpointBehaviorAndStructure ***** +type bgpSrteSRv6SIDEndpointBehaviorAndStructure struct { + validation + obj *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure + marshaller marshalBgpSrteSRv6SIDEndpointBehaviorAndStructure + unMarshaller unMarshalBgpSrteSRv6SIDEndpointBehaviorAndStructure +} + +func NewBgpSrteSRv6SIDEndpointBehaviorAndStructure() BgpSrteSRv6SIDEndpointBehaviorAndStructure { + obj := bgpSrteSRv6SIDEndpointBehaviorAndStructure{obj: &otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) msg() *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure { + return obj.obj +} + +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) setMsg(msg *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSRv6SIDEndpointBehaviorAndStructure { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSRv6SIDEndpointBehaviorAndStructure struct { + obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure +} + +type marshalBgpSrteSRv6SIDEndpointBehaviorAndStructure interface { + // ToProto marshals BgpSrteSRv6SIDEndpointBehaviorAndStructure to protobuf object *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure + ToProto() (*otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure, error) + // ToPbText marshals BgpSrteSRv6SIDEndpointBehaviorAndStructure to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSRv6SIDEndpointBehaviorAndStructure to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSRv6SIDEndpointBehaviorAndStructure to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSRv6SIDEndpointBehaviorAndStructure struct { + obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure +} + +type unMarshalBgpSrteSRv6SIDEndpointBehaviorAndStructure interface { + // FromProto unmarshals BgpSrteSRv6SIDEndpointBehaviorAndStructure from protobuf object *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure + FromProto(msg *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure) (BgpSrteSRv6SIDEndpointBehaviorAndStructure, error) + // FromPbText unmarshals BgpSrteSRv6SIDEndpointBehaviorAndStructure from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSRv6SIDEndpointBehaviorAndStructure from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSRv6SIDEndpointBehaviorAndStructure from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) Marshal() marshalBgpSrteSRv6SIDEndpointBehaviorAndStructure { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSRv6SIDEndpointBehaviorAndStructure{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) Unmarshal() unMarshalBgpSrteSRv6SIDEndpointBehaviorAndStructure { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSRv6SIDEndpointBehaviorAndStructure{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) ToProto() (*otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) FromProto(msg *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure) (BgpSrteSRv6SIDEndpointBehaviorAndStructure, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) 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 *unMarshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) 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 *marshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) 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 *unMarshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) 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 *marshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) 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 *unMarshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) 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 *bgpSrteSRv6SIDEndpointBehaviorAndStructure) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) Clone() (BgpSrteSRv6SIDEndpointBehaviorAndStructure, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSRv6SIDEndpointBehaviorAndStructure() + 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 +} + +// BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. +type BgpSrteSRv6SIDEndpointBehaviorAndStructure interface { + Validation + // msg marshals BgpSrteSRv6SIDEndpointBehaviorAndStructure to protobuf object *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure + // and doesn't set defaults + msg() *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure + // setMsg unmarshals BgpSrteSRv6SIDEndpointBehaviorAndStructure from protobuf object *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure + // and doesn't set defaults + setMsg(*otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSRv6SIDEndpointBehaviorAndStructure + // provides marshal interface + Marshal() marshalBgpSrteSRv6SIDEndpointBehaviorAndStructure + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSRv6SIDEndpointBehaviorAndStructure + // validate validates BgpSrteSRv6SIDEndpointBehaviorAndStructure + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSRv6SIDEndpointBehaviorAndStructure, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // LbLength returns uint32, set in BgpSrteSRv6SIDEndpointBehaviorAndStructure. + LbLength() uint32 + // SetLbLength assigns uint32 provided by user to BgpSrteSRv6SIDEndpointBehaviorAndStructure + SetLbLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure + // HasLbLength checks if LbLength has been set in BgpSrteSRv6SIDEndpointBehaviorAndStructure + HasLbLength() bool + // LnLength returns uint32, set in BgpSrteSRv6SIDEndpointBehaviorAndStructure. + LnLength() uint32 + // SetLnLength assigns uint32 provided by user to BgpSrteSRv6SIDEndpointBehaviorAndStructure + SetLnLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure + // HasLnLength checks if LnLength has been set in BgpSrteSRv6SIDEndpointBehaviorAndStructure + HasLnLength() bool + // FuncLength returns uint32, set in BgpSrteSRv6SIDEndpointBehaviorAndStructure. + FuncLength() uint32 + // SetFuncLength assigns uint32 provided by user to BgpSrteSRv6SIDEndpointBehaviorAndStructure + SetFuncLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure + // HasFuncLength checks if FuncLength has been set in BgpSrteSRv6SIDEndpointBehaviorAndStructure + HasFuncLength() bool + // ArgLength returns uint32, set in BgpSrteSRv6SIDEndpointBehaviorAndStructure. + ArgLength() uint32 + // SetArgLength assigns uint32 provided by user to BgpSrteSRv6SIDEndpointBehaviorAndStructure + SetArgLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure + // HasArgLength checks if ArgLength has been set in BgpSrteSRv6SIDEndpointBehaviorAndStructure + HasArgLength() bool +} + +// SRv6 SID Locator Block length in bits. +// LbLength returns a uint32 +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) LbLength() uint32 { + + return *obj.obj.LbLength + +} + +// SRv6 SID Locator Block length in bits. +// LbLength returns a uint32 +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) HasLbLength() bool { + return obj.obj.LbLength != nil +} + +// SRv6 SID Locator Block length in bits. +// SetLbLength sets the uint32 value in the BgpSrteSRv6SIDEndpointBehaviorAndStructure object +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) SetLbLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure { + + obj.obj.LbLength = &value + return obj +} + +// SRv6 SID Locator Node length in bits. +// LnLength returns a uint32 +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) LnLength() uint32 { + + return *obj.obj.LnLength + +} + +// SRv6 SID Locator Node length in bits. +// LnLength returns a uint32 +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) HasLnLength() bool { + return obj.obj.LnLength != nil +} + +// SRv6 SID Locator Node length in bits. +// SetLnLength sets the uint32 value in the BgpSrteSRv6SIDEndpointBehaviorAndStructure object +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) SetLnLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure { + + obj.obj.LnLength = &value + return obj +} + +// SRv6 SID Function length in bits. +// FuncLength returns a uint32 +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) FuncLength() uint32 { + + return *obj.obj.FuncLength + +} + +// SRv6 SID Function length in bits. +// FuncLength returns a uint32 +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) HasFuncLength() bool { + return obj.obj.FuncLength != nil +} + +// SRv6 SID Function length in bits. +// SetFuncLength sets the uint32 value in the BgpSrteSRv6SIDEndpointBehaviorAndStructure object +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) SetFuncLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure { + + obj.obj.FuncLength = &value + return obj +} + +// SRv6 SID Arguments length in bits. +// ArgLength returns a uint32 +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) ArgLength() uint32 { + + return *obj.obj.ArgLength + +} + +// SRv6 SID Arguments length in bits. +// ArgLength returns a uint32 +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) HasArgLength() bool { + return obj.obj.ArgLength != nil +} + +// SRv6 SID Arguments length in bits. +// SetArgLength sets the uint32 value in the BgpSrteSRv6SIDEndpointBehaviorAndStructure object +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) SetArgLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure { + + obj.obj.ArgLength = &value + return obj +} + +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.LbLength != nil { + + if *obj.obj.LbLength > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpSrteSRv6SIDEndpointBehaviorAndStructure.LbLength <= 128 but Got %d", *obj.obj.LbLength)) + } + + } + + if obj.obj.LnLength != nil { + + if *obj.obj.LnLength > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpSrteSRv6SIDEndpointBehaviorAndStructure.LnLength <= 128 but Got %d", *obj.obj.LnLength)) + } + + } + + if obj.obj.FuncLength != nil { + + if *obj.obj.FuncLength > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpSrteSRv6SIDEndpointBehaviorAndStructure.FuncLength <= 128 but Got %d", *obj.obj.FuncLength)) + } + + } + + if obj.obj.ArgLength != nil { + + if *obj.obj.ArgLength > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpSrteSRv6SIDEndpointBehaviorAndStructure.ArgLength <= 128 but Got %d", *obj.obj.ArgLength)) + } + + } + +} + +func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) setDefault() { + if obj.obj.LbLength == nil { + obj.SetLbLength(0) + } + if obj.obj.LnLength == nil { + obj.SetLnLength(0) + } + if obj.obj.FuncLength == nil { + obj.SetFuncLength(0) + } + if obj.obj.ArgLength == nil { + obj.SetArgLength(0) + } + +} diff --git a/gosnappi/bgp_srte_segment.go b/gosnappi/bgp_srte_segment.go new file mode 100644 index 00000000..5fdd0f07 --- /dev/null +++ b/gosnappi/bgp_srte_segment.go @@ -0,0 +1,868 @@ +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" +) + +// ***** BgpSrteSegment ***** +type bgpSrteSegment struct { + validation + obj *otg.BgpSrteSegment + marshaller marshalBgpSrteSegment + unMarshaller unMarshalBgpSrteSegment + typeAHolder BgpSrteSegmentATypeSubTlv + typeBHolder BgpSrteSegmentBTypeSubTlv + typeCHolder BgpSrteSegmentCTypeSubTlv + typeDHolder BgpSrteSegmentDTypeSubTlv + typeEHolder BgpSrteSegmentETypeSubTlv + typeFHolder BgpSrteSegmentFTypeSubTlv + typeGHolder BgpSrteSegmentGTypeSubTlv + typeHHolder BgpSrteSegmentHTypeSubTlv + typeIHolder BgpSrteSegmentITypeSubTlv + typeJHolder BgpSrteSegmentJTypeSubTlv + typeKHolder BgpSrteSegmentKTypeSubTlv +} + +func NewBgpSrteSegment() BgpSrteSegment { + obj := bgpSrteSegment{obj: &otg.BgpSrteSegment{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSegment) msg() *otg.BgpSrteSegment { + return obj.obj +} + +func (obj *bgpSrteSegment) setMsg(msg *otg.BgpSrteSegment) BgpSrteSegment { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSegment struct { + obj *bgpSrteSegment +} + +type marshalBgpSrteSegment interface { + // ToProto marshals BgpSrteSegment to protobuf object *otg.BgpSrteSegment + ToProto() (*otg.BgpSrteSegment, error) + // ToPbText marshals BgpSrteSegment to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSegment to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSegment to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSegment struct { + obj *bgpSrteSegment +} + +type unMarshalBgpSrteSegment interface { + // FromProto unmarshals BgpSrteSegment from protobuf object *otg.BgpSrteSegment + FromProto(msg *otg.BgpSrteSegment) (BgpSrteSegment, error) + // FromPbText unmarshals BgpSrteSegment from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSegment from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSegment from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSegment) Marshal() marshalBgpSrteSegment { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSegment{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSegment) Unmarshal() unMarshalBgpSrteSegment { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSegment{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSegment) ToProto() (*otg.BgpSrteSegment, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSegment) FromProto(msg *otg.BgpSrteSegment) (BgpSrteSegment, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSegment) 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 *unMarshalbgpSrteSegment) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteSegment) 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 *unMarshalbgpSrteSegment) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteSegment) 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 *unMarshalbgpSrteSegment) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteSegment) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSegment) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSegment) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSegment) Clone() (BgpSrteSegment, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSegment() + 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 +} + +func (obj *bgpSrteSegment) setNil() { + obj.typeAHolder = nil + obj.typeBHolder = nil + obj.typeCHolder = nil + obj.typeDHolder = nil + obj.typeEHolder = nil + obj.typeFHolder = nil + obj.typeGHolder = nil + obj.typeHHolder = nil + obj.typeIHolder = nil + obj.typeJHolder = nil + obj.typeKHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteSegment is a Segment sub-TLV describes a single segment in a segment list i.e., a single element of the explicit path. The Segment sub-TLVs are optional. +type BgpSrteSegment interface { + Validation + // msg marshals BgpSrteSegment to protobuf object *otg.BgpSrteSegment + // and doesn't set defaults + msg() *otg.BgpSrteSegment + // setMsg unmarshals BgpSrteSegment from protobuf object *otg.BgpSrteSegment + // and doesn't set defaults + setMsg(*otg.BgpSrteSegment) BgpSrteSegment + // provides marshal interface + Marshal() marshalBgpSrteSegment + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSegment + // validate validates BgpSrteSegment + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSegment, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // SegmentType returns BgpSrteSegmentSegmentTypeEnum, set in BgpSrteSegment + SegmentType() BgpSrteSegmentSegmentTypeEnum + // SetSegmentType assigns BgpSrteSegmentSegmentTypeEnum provided by user to BgpSrteSegment + SetSegmentType(value BgpSrteSegmentSegmentTypeEnum) BgpSrteSegment + // TypeA returns BgpSrteSegmentATypeSubTlv, set in BgpSrteSegment. + // BgpSrteSegmentATypeSubTlv is type A: SID only, in the form of MPLS Label. + TypeA() BgpSrteSegmentATypeSubTlv + // SetTypeA assigns BgpSrteSegmentATypeSubTlv provided by user to BgpSrteSegment. + // BgpSrteSegmentATypeSubTlv is type A: SID only, in the form of MPLS Label. + SetTypeA(value BgpSrteSegmentATypeSubTlv) BgpSrteSegment + // HasTypeA checks if TypeA has been set in BgpSrteSegment + HasTypeA() bool + // TypeB returns BgpSrteSegmentBTypeSubTlv, set in BgpSrteSegment. + // BgpSrteSegmentBTypeSubTlv is type B: SID only, in the form of IPv6 address. + TypeB() BgpSrteSegmentBTypeSubTlv + // SetTypeB assigns BgpSrteSegmentBTypeSubTlv provided by user to BgpSrteSegment. + // BgpSrteSegmentBTypeSubTlv is type B: SID only, in the form of IPv6 address. + SetTypeB(value BgpSrteSegmentBTypeSubTlv) BgpSrteSegment + // HasTypeB checks if TypeB has been set in BgpSrteSegment + HasTypeB() bool + // TypeC returns BgpSrteSegmentCTypeSubTlv, set in BgpSrteSegment. + // BgpSrteSegmentCTypeSubTlv is type C: IPv4 Node Address with optional SID. + TypeC() BgpSrteSegmentCTypeSubTlv + // SetTypeC assigns BgpSrteSegmentCTypeSubTlv provided by user to BgpSrteSegment. + // BgpSrteSegmentCTypeSubTlv is type C: IPv4 Node Address with optional SID. + SetTypeC(value BgpSrteSegmentCTypeSubTlv) BgpSrteSegment + // HasTypeC checks if TypeC has been set in BgpSrteSegment + HasTypeC() bool + // TypeD returns BgpSrteSegmentDTypeSubTlv, set in BgpSrteSegment. + // BgpSrteSegmentDTypeSubTlv is type D: IPv6 Node Address with optional SID for SR MPLS. + TypeD() BgpSrteSegmentDTypeSubTlv + // SetTypeD assigns BgpSrteSegmentDTypeSubTlv provided by user to BgpSrteSegment. + // BgpSrteSegmentDTypeSubTlv is type D: IPv6 Node Address with optional SID for SR MPLS. + SetTypeD(value BgpSrteSegmentDTypeSubTlv) BgpSrteSegment + // HasTypeD checks if TypeD has been set in BgpSrteSegment + HasTypeD() bool + // TypeE returns BgpSrteSegmentETypeSubTlv, set in BgpSrteSegment. + // BgpSrteSegmentETypeSubTlv is type E: IPv4 Address and Local Interface ID with optional SID + TypeE() BgpSrteSegmentETypeSubTlv + // SetTypeE assigns BgpSrteSegmentETypeSubTlv provided by user to BgpSrteSegment. + // BgpSrteSegmentETypeSubTlv is type E: IPv4 Address and Local Interface ID with optional SID + SetTypeE(value BgpSrteSegmentETypeSubTlv) BgpSrteSegment + // HasTypeE checks if TypeE has been set in BgpSrteSegment + HasTypeE() bool + // TypeF returns BgpSrteSegmentFTypeSubTlv, set in BgpSrteSegment. + // BgpSrteSegmentFTypeSubTlv is type F: IPv4 Local and Remote addresses with optional SID. + TypeF() BgpSrteSegmentFTypeSubTlv + // SetTypeF assigns BgpSrteSegmentFTypeSubTlv provided by user to BgpSrteSegment. + // BgpSrteSegmentFTypeSubTlv is type F: IPv4 Local and Remote addresses with optional SID. + SetTypeF(value BgpSrteSegmentFTypeSubTlv) BgpSrteSegment + // HasTypeF checks if TypeF has been set in BgpSrteSegment + HasTypeF() bool + // TypeG returns BgpSrteSegmentGTypeSubTlv, set in BgpSrteSegment. + // BgpSrteSegmentGTypeSubTlv is type G: IPv6 Address, Interface ID for local and remote pair with optional SID for SR MPLS. + TypeG() BgpSrteSegmentGTypeSubTlv + // SetTypeG assigns BgpSrteSegmentGTypeSubTlv provided by user to BgpSrteSegment. + // BgpSrteSegmentGTypeSubTlv is type G: IPv6 Address, Interface ID for local and remote pair with optional SID for SR MPLS. + SetTypeG(value BgpSrteSegmentGTypeSubTlv) BgpSrteSegment + // HasTypeG checks if TypeG has been set in BgpSrteSegment + HasTypeG() bool + // TypeH returns BgpSrteSegmentHTypeSubTlv, set in BgpSrteSegment. + // BgpSrteSegmentHTypeSubTlv is type H: IPv6 Local and Remote addresses with optional SID for SR MPLS. + TypeH() BgpSrteSegmentHTypeSubTlv + // SetTypeH assigns BgpSrteSegmentHTypeSubTlv provided by user to BgpSrteSegment. + // BgpSrteSegmentHTypeSubTlv is type H: IPv6 Local and Remote addresses with optional SID for SR MPLS. + SetTypeH(value BgpSrteSegmentHTypeSubTlv) BgpSrteSegment + // HasTypeH checks if TypeH has been set in BgpSrteSegment + HasTypeH() bool + // TypeI returns BgpSrteSegmentITypeSubTlv, set in BgpSrteSegment. + // BgpSrteSegmentITypeSubTlv is type I: IPv6 Node Address with optional SRv6 SID. + TypeI() BgpSrteSegmentITypeSubTlv + // SetTypeI assigns BgpSrteSegmentITypeSubTlv provided by user to BgpSrteSegment. + // BgpSrteSegmentITypeSubTlv is type I: IPv6 Node Address with optional SRv6 SID. + SetTypeI(value BgpSrteSegmentITypeSubTlv) BgpSrteSegment + // HasTypeI checks if TypeI has been set in BgpSrteSegment + HasTypeI() bool + // TypeJ returns BgpSrteSegmentJTypeSubTlv, set in BgpSrteSegment. + // BgpSrteSegmentJTypeSubTlv is type J: IPv6 Address, Interface ID for local and remote pair for SRv6 with optional SID. + TypeJ() BgpSrteSegmentJTypeSubTlv + // SetTypeJ assigns BgpSrteSegmentJTypeSubTlv provided by user to BgpSrteSegment. + // BgpSrteSegmentJTypeSubTlv is type J: IPv6 Address, Interface ID for local and remote pair for SRv6 with optional SID. + SetTypeJ(value BgpSrteSegmentJTypeSubTlv) BgpSrteSegment + // HasTypeJ checks if TypeJ has been set in BgpSrteSegment + HasTypeJ() bool + // TypeK returns BgpSrteSegmentKTypeSubTlv, set in BgpSrteSegment. + // BgpSrteSegmentKTypeSubTlv is type K: IPv6 Local and Remote addresses for SRv6 with optional SID. + TypeK() BgpSrteSegmentKTypeSubTlv + // SetTypeK assigns BgpSrteSegmentKTypeSubTlv provided by user to BgpSrteSegment. + // BgpSrteSegmentKTypeSubTlv is type K: IPv6 Local and Remote addresses for SRv6 with optional SID. + SetTypeK(value BgpSrteSegmentKTypeSubTlv) BgpSrteSegment + // HasTypeK checks if TypeK has been set in BgpSrteSegment + HasTypeK() bool + // Name returns string, set in BgpSrteSegment. + Name() string + // SetName assigns string provided by user to BgpSrteSegment + SetName(value string) BgpSrteSegment + // Active returns bool, set in BgpSrteSegment. + Active() bool + // SetActive assigns bool provided by user to BgpSrteSegment + SetActive(value bool) BgpSrteSegment + // HasActive checks if Active has been set in BgpSrteSegment + HasActive() bool + setNil() +} + +type BgpSrteSegmentSegmentTypeEnum string + +// Enum of SegmentType on BgpSrteSegment +var BgpSrteSegmentSegmentType = struct { + TYPE_A BgpSrteSegmentSegmentTypeEnum + TYPE_B BgpSrteSegmentSegmentTypeEnum + TYPE_C BgpSrteSegmentSegmentTypeEnum + TYPE_D BgpSrteSegmentSegmentTypeEnum + TYPE_E BgpSrteSegmentSegmentTypeEnum + TYPE_F BgpSrteSegmentSegmentTypeEnum + TYPE_G BgpSrteSegmentSegmentTypeEnum + TYPE_H BgpSrteSegmentSegmentTypeEnum + TYPE_I BgpSrteSegmentSegmentTypeEnum + TYPE_J BgpSrteSegmentSegmentTypeEnum + TYPE_K BgpSrteSegmentSegmentTypeEnum +}{ + TYPE_A: BgpSrteSegmentSegmentTypeEnum("type_a"), + TYPE_B: BgpSrteSegmentSegmentTypeEnum("type_b"), + TYPE_C: BgpSrteSegmentSegmentTypeEnum("type_c"), + TYPE_D: BgpSrteSegmentSegmentTypeEnum("type_d"), + TYPE_E: BgpSrteSegmentSegmentTypeEnum("type_e"), + TYPE_F: BgpSrteSegmentSegmentTypeEnum("type_f"), + TYPE_G: BgpSrteSegmentSegmentTypeEnum("type_g"), + TYPE_H: BgpSrteSegmentSegmentTypeEnum("type_h"), + TYPE_I: BgpSrteSegmentSegmentTypeEnum("type_i"), + TYPE_J: BgpSrteSegmentSegmentTypeEnum("type_j"), + TYPE_K: BgpSrteSegmentSegmentTypeEnum("type_k"), +} + +func (obj *bgpSrteSegment) SegmentType() BgpSrteSegmentSegmentTypeEnum { + return BgpSrteSegmentSegmentTypeEnum(obj.obj.SegmentType.Enum().String()) +} + +func (obj *bgpSrteSegment) SetSegmentType(value BgpSrteSegmentSegmentTypeEnum) BgpSrteSegment { + intValue, ok := otg.BgpSrteSegment_SegmentType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpSrteSegmentSegmentTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpSrteSegment_SegmentType_Enum(intValue) + obj.obj.SegmentType = &enumValue + + return obj +} + +// description is TBD +// TypeA returns a BgpSrteSegmentATypeSubTlv +func (obj *bgpSrteSegment) TypeA() BgpSrteSegmentATypeSubTlv { + if obj.obj.TypeA == nil { + obj.obj.TypeA = NewBgpSrteSegmentATypeSubTlv().msg() + } + if obj.typeAHolder == nil { + obj.typeAHolder = &bgpSrteSegmentATypeSubTlv{obj: obj.obj.TypeA} + } + return obj.typeAHolder +} + +// description is TBD +// TypeA returns a BgpSrteSegmentATypeSubTlv +func (obj *bgpSrteSegment) HasTypeA() bool { + return obj.obj.TypeA != nil +} + +// description is TBD +// SetTypeA sets the BgpSrteSegmentATypeSubTlv value in the BgpSrteSegment object +func (obj *bgpSrteSegment) SetTypeA(value BgpSrteSegmentATypeSubTlv) BgpSrteSegment { + + obj.typeAHolder = nil + obj.obj.TypeA = value.msg() + + return obj +} + +// description is TBD +// TypeB returns a BgpSrteSegmentBTypeSubTlv +func (obj *bgpSrteSegment) TypeB() BgpSrteSegmentBTypeSubTlv { + if obj.obj.TypeB == nil { + obj.obj.TypeB = NewBgpSrteSegmentBTypeSubTlv().msg() + } + if obj.typeBHolder == nil { + obj.typeBHolder = &bgpSrteSegmentBTypeSubTlv{obj: obj.obj.TypeB} + } + return obj.typeBHolder +} + +// description is TBD +// TypeB returns a BgpSrteSegmentBTypeSubTlv +func (obj *bgpSrteSegment) HasTypeB() bool { + return obj.obj.TypeB != nil +} + +// description is TBD +// SetTypeB sets the BgpSrteSegmentBTypeSubTlv value in the BgpSrteSegment object +func (obj *bgpSrteSegment) SetTypeB(value BgpSrteSegmentBTypeSubTlv) BgpSrteSegment { + + obj.typeBHolder = nil + obj.obj.TypeB = value.msg() + + return obj +} + +// description is TBD +// TypeC returns a BgpSrteSegmentCTypeSubTlv +func (obj *bgpSrteSegment) TypeC() BgpSrteSegmentCTypeSubTlv { + if obj.obj.TypeC == nil { + obj.obj.TypeC = NewBgpSrteSegmentCTypeSubTlv().msg() + } + if obj.typeCHolder == nil { + obj.typeCHolder = &bgpSrteSegmentCTypeSubTlv{obj: obj.obj.TypeC} + } + return obj.typeCHolder +} + +// description is TBD +// TypeC returns a BgpSrteSegmentCTypeSubTlv +func (obj *bgpSrteSegment) HasTypeC() bool { + return obj.obj.TypeC != nil +} + +// description is TBD +// SetTypeC sets the BgpSrteSegmentCTypeSubTlv value in the BgpSrteSegment object +func (obj *bgpSrteSegment) SetTypeC(value BgpSrteSegmentCTypeSubTlv) BgpSrteSegment { + + obj.typeCHolder = nil + obj.obj.TypeC = value.msg() + + return obj +} + +// description is TBD +// TypeD returns a BgpSrteSegmentDTypeSubTlv +func (obj *bgpSrteSegment) TypeD() BgpSrteSegmentDTypeSubTlv { + if obj.obj.TypeD == nil { + obj.obj.TypeD = NewBgpSrteSegmentDTypeSubTlv().msg() + } + if obj.typeDHolder == nil { + obj.typeDHolder = &bgpSrteSegmentDTypeSubTlv{obj: obj.obj.TypeD} + } + return obj.typeDHolder +} + +// description is TBD +// TypeD returns a BgpSrteSegmentDTypeSubTlv +func (obj *bgpSrteSegment) HasTypeD() bool { + return obj.obj.TypeD != nil +} + +// description is TBD +// SetTypeD sets the BgpSrteSegmentDTypeSubTlv value in the BgpSrteSegment object +func (obj *bgpSrteSegment) SetTypeD(value BgpSrteSegmentDTypeSubTlv) BgpSrteSegment { + + obj.typeDHolder = nil + obj.obj.TypeD = value.msg() + + return obj +} + +// description is TBD +// TypeE returns a BgpSrteSegmentETypeSubTlv +func (obj *bgpSrteSegment) TypeE() BgpSrteSegmentETypeSubTlv { + if obj.obj.TypeE == nil { + obj.obj.TypeE = NewBgpSrteSegmentETypeSubTlv().msg() + } + if obj.typeEHolder == nil { + obj.typeEHolder = &bgpSrteSegmentETypeSubTlv{obj: obj.obj.TypeE} + } + return obj.typeEHolder +} + +// description is TBD +// TypeE returns a BgpSrteSegmentETypeSubTlv +func (obj *bgpSrteSegment) HasTypeE() bool { + return obj.obj.TypeE != nil +} + +// description is TBD +// SetTypeE sets the BgpSrteSegmentETypeSubTlv value in the BgpSrteSegment object +func (obj *bgpSrteSegment) SetTypeE(value BgpSrteSegmentETypeSubTlv) BgpSrteSegment { + + obj.typeEHolder = nil + obj.obj.TypeE = value.msg() + + return obj +} + +// description is TBD +// TypeF returns a BgpSrteSegmentFTypeSubTlv +func (obj *bgpSrteSegment) TypeF() BgpSrteSegmentFTypeSubTlv { + if obj.obj.TypeF == nil { + obj.obj.TypeF = NewBgpSrteSegmentFTypeSubTlv().msg() + } + if obj.typeFHolder == nil { + obj.typeFHolder = &bgpSrteSegmentFTypeSubTlv{obj: obj.obj.TypeF} + } + return obj.typeFHolder +} + +// description is TBD +// TypeF returns a BgpSrteSegmentFTypeSubTlv +func (obj *bgpSrteSegment) HasTypeF() bool { + return obj.obj.TypeF != nil +} + +// description is TBD +// SetTypeF sets the BgpSrteSegmentFTypeSubTlv value in the BgpSrteSegment object +func (obj *bgpSrteSegment) SetTypeF(value BgpSrteSegmentFTypeSubTlv) BgpSrteSegment { + + obj.typeFHolder = nil + obj.obj.TypeF = value.msg() + + return obj +} + +// description is TBD +// TypeG returns a BgpSrteSegmentGTypeSubTlv +func (obj *bgpSrteSegment) TypeG() BgpSrteSegmentGTypeSubTlv { + if obj.obj.TypeG == nil { + obj.obj.TypeG = NewBgpSrteSegmentGTypeSubTlv().msg() + } + if obj.typeGHolder == nil { + obj.typeGHolder = &bgpSrteSegmentGTypeSubTlv{obj: obj.obj.TypeG} + } + return obj.typeGHolder +} + +// description is TBD +// TypeG returns a BgpSrteSegmentGTypeSubTlv +func (obj *bgpSrteSegment) HasTypeG() bool { + return obj.obj.TypeG != nil +} + +// description is TBD +// SetTypeG sets the BgpSrteSegmentGTypeSubTlv value in the BgpSrteSegment object +func (obj *bgpSrteSegment) SetTypeG(value BgpSrteSegmentGTypeSubTlv) BgpSrteSegment { + + obj.typeGHolder = nil + obj.obj.TypeG = value.msg() + + return obj +} + +// description is TBD +// TypeH returns a BgpSrteSegmentHTypeSubTlv +func (obj *bgpSrteSegment) TypeH() BgpSrteSegmentHTypeSubTlv { + if obj.obj.TypeH == nil { + obj.obj.TypeH = NewBgpSrteSegmentHTypeSubTlv().msg() + } + if obj.typeHHolder == nil { + obj.typeHHolder = &bgpSrteSegmentHTypeSubTlv{obj: obj.obj.TypeH} + } + return obj.typeHHolder +} + +// description is TBD +// TypeH returns a BgpSrteSegmentHTypeSubTlv +func (obj *bgpSrteSegment) HasTypeH() bool { + return obj.obj.TypeH != nil +} + +// description is TBD +// SetTypeH sets the BgpSrteSegmentHTypeSubTlv value in the BgpSrteSegment object +func (obj *bgpSrteSegment) SetTypeH(value BgpSrteSegmentHTypeSubTlv) BgpSrteSegment { + + obj.typeHHolder = nil + obj.obj.TypeH = value.msg() + + return obj +} + +// description is TBD +// TypeI returns a BgpSrteSegmentITypeSubTlv +func (obj *bgpSrteSegment) TypeI() BgpSrteSegmentITypeSubTlv { + if obj.obj.TypeI == nil { + obj.obj.TypeI = NewBgpSrteSegmentITypeSubTlv().msg() + } + if obj.typeIHolder == nil { + obj.typeIHolder = &bgpSrteSegmentITypeSubTlv{obj: obj.obj.TypeI} + } + return obj.typeIHolder +} + +// description is TBD +// TypeI returns a BgpSrteSegmentITypeSubTlv +func (obj *bgpSrteSegment) HasTypeI() bool { + return obj.obj.TypeI != nil +} + +// description is TBD +// SetTypeI sets the BgpSrteSegmentITypeSubTlv value in the BgpSrteSegment object +func (obj *bgpSrteSegment) SetTypeI(value BgpSrteSegmentITypeSubTlv) BgpSrteSegment { + + obj.typeIHolder = nil + obj.obj.TypeI = value.msg() + + return obj +} + +// description is TBD +// TypeJ returns a BgpSrteSegmentJTypeSubTlv +func (obj *bgpSrteSegment) TypeJ() BgpSrteSegmentJTypeSubTlv { + if obj.obj.TypeJ == nil { + obj.obj.TypeJ = NewBgpSrteSegmentJTypeSubTlv().msg() + } + if obj.typeJHolder == nil { + obj.typeJHolder = &bgpSrteSegmentJTypeSubTlv{obj: obj.obj.TypeJ} + } + return obj.typeJHolder +} + +// description is TBD +// TypeJ returns a BgpSrteSegmentJTypeSubTlv +func (obj *bgpSrteSegment) HasTypeJ() bool { + return obj.obj.TypeJ != nil +} + +// description is TBD +// SetTypeJ sets the BgpSrteSegmentJTypeSubTlv value in the BgpSrteSegment object +func (obj *bgpSrteSegment) SetTypeJ(value BgpSrteSegmentJTypeSubTlv) BgpSrteSegment { + + obj.typeJHolder = nil + obj.obj.TypeJ = value.msg() + + return obj +} + +// description is TBD +// TypeK returns a BgpSrteSegmentKTypeSubTlv +func (obj *bgpSrteSegment) TypeK() BgpSrteSegmentKTypeSubTlv { + if obj.obj.TypeK == nil { + obj.obj.TypeK = NewBgpSrteSegmentKTypeSubTlv().msg() + } + if obj.typeKHolder == nil { + obj.typeKHolder = &bgpSrteSegmentKTypeSubTlv{obj: obj.obj.TypeK} + } + return obj.typeKHolder +} + +// description is TBD +// TypeK returns a BgpSrteSegmentKTypeSubTlv +func (obj *bgpSrteSegment) HasTypeK() bool { + return obj.obj.TypeK != nil +} + +// description is TBD +// SetTypeK sets the BgpSrteSegmentKTypeSubTlv value in the BgpSrteSegment object +func (obj *bgpSrteSegment) SetTypeK(value BgpSrteSegmentKTypeSubTlv) BgpSrteSegment { + + obj.typeKHolder = nil + obj.obj.TypeK = value.msg() + + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *bgpSrteSegment) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the BgpSrteSegment object +func (obj *bgpSrteSegment) SetName(value string) BgpSrteSegment { + + obj.obj.Name = &value + return obj +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// Active returns a bool +func (obj *bgpSrteSegment) Active() bool { + + return *obj.obj.Active + +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// Active returns a bool +func (obj *bgpSrteSegment) HasActive() bool { + return obj.obj.Active != nil +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// SetActive sets the bool value in the BgpSrteSegment object +func (obj *bgpSrteSegment) SetActive(value bool) BgpSrteSegment { + + obj.obj.Active = &value + return obj +} + +func (obj *bgpSrteSegment) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // SegmentType is required + if obj.obj.SegmentType == nil { + vObj.validationErrors = append(vObj.validationErrors, "SegmentType is required field on interface BgpSrteSegment") + } + + if obj.obj.TypeA != nil { + + obj.TypeA().validateObj(vObj, set_default) + } + + if obj.obj.TypeB != nil { + + obj.TypeB().validateObj(vObj, set_default) + } + + if obj.obj.TypeC != nil { + + obj.TypeC().validateObj(vObj, set_default) + } + + if obj.obj.TypeD != nil { + + obj.TypeD().validateObj(vObj, set_default) + } + + if obj.obj.TypeE != nil { + + obj.TypeE().validateObj(vObj, set_default) + } + + if obj.obj.TypeF != nil { + + obj.TypeF().validateObj(vObj, set_default) + } + + if obj.obj.TypeG != nil { + + obj.TypeG().validateObj(vObj, set_default) + } + + if obj.obj.TypeH != nil { + + obj.TypeH().validateObj(vObj, set_default) + } + + if obj.obj.TypeI != nil { + + obj.TypeI().validateObj(vObj, set_default) + } + + if obj.obj.TypeJ != nil { + + obj.TypeJ().validateObj(vObj, set_default) + } + + if obj.obj.TypeK != nil { + + obj.TypeK().validateObj(vObj, set_default) + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpSrteSegment") + } +} + +func (obj *bgpSrteSegment) setDefault() { + if obj.obj.Active == nil { + obj.SetActive(true) + } + +} diff --git a/gosnappi/bgp_srte_segment_a_type_sub_tlv.go b/gosnappi/bgp_srte_segment_a_type_sub_tlv.go new file mode 100644 index 00000000..490e8608 --- /dev/null +++ b/gosnappi/bgp_srte_segment_a_type_sub_tlv.go @@ -0,0 +1,457 @@ +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" +) + +// ***** BgpSrteSegmentATypeSubTlv ***** +type bgpSrteSegmentATypeSubTlv struct { + validation + obj *otg.BgpSrteSegmentATypeSubTlv + marshaller marshalBgpSrteSegmentATypeSubTlv + unMarshaller unMarshalBgpSrteSegmentATypeSubTlv +} + +func NewBgpSrteSegmentATypeSubTlv() BgpSrteSegmentATypeSubTlv { + obj := bgpSrteSegmentATypeSubTlv{obj: &otg.BgpSrteSegmentATypeSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSegmentATypeSubTlv) msg() *otg.BgpSrteSegmentATypeSubTlv { + return obj.obj +} + +func (obj *bgpSrteSegmentATypeSubTlv) setMsg(msg *otg.BgpSrteSegmentATypeSubTlv) BgpSrteSegmentATypeSubTlv { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSegmentATypeSubTlv struct { + obj *bgpSrteSegmentATypeSubTlv +} + +type marshalBgpSrteSegmentATypeSubTlv interface { + // ToProto marshals BgpSrteSegmentATypeSubTlv to protobuf object *otg.BgpSrteSegmentATypeSubTlv + ToProto() (*otg.BgpSrteSegmentATypeSubTlv, error) + // ToPbText marshals BgpSrteSegmentATypeSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSegmentATypeSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSegmentATypeSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSegmentATypeSubTlv struct { + obj *bgpSrteSegmentATypeSubTlv +} + +type unMarshalBgpSrteSegmentATypeSubTlv interface { + // FromProto unmarshals BgpSrteSegmentATypeSubTlv from protobuf object *otg.BgpSrteSegmentATypeSubTlv + FromProto(msg *otg.BgpSrteSegmentATypeSubTlv) (BgpSrteSegmentATypeSubTlv, error) + // FromPbText unmarshals BgpSrteSegmentATypeSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSegmentATypeSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSegmentATypeSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSegmentATypeSubTlv) Marshal() marshalBgpSrteSegmentATypeSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSegmentATypeSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSegmentATypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentATypeSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSegmentATypeSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSegmentATypeSubTlv) ToProto() (*otg.BgpSrteSegmentATypeSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSegmentATypeSubTlv) FromProto(msg *otg.BgpSrteSegmentATypeSubTlv) (BgpSrteSegmentATypeSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSegmentATypeSubTlv) 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 *unMarshalbgpSrteSegmentATypeSubTlv) 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 *marshalbgpSrteSegmentATypeSubTlv) 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 *unMarshalbgpSrteSegmentATypeSubTlv) 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 *marshalbgpSrteSegmentATypeSubTlv) 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 *unMarshalbgpSrteSegmentATypeSubTlv) 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 *bgpSrteSegmentATypeSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentATypeSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentATypeSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSegmentATypeSubTlv) Clone() (BgpSrteSegmentATypeSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSegmentATypeSubTlv() + 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 +} + +// BgpSrteSegmentATypeSubTlv is type A: SID only, in the form of MPLS Label. +type BgpSrteSegmentATypeSubTlv interface { + Validation + // msg marshals BgpSrteSegmentATypeSubTlv to protobuf object *otg.BgpSrteSegmentATypeSubTlv + // and doesn't set defaults + msg() *otg.BgpSrteSegmentATypeSubTlv + // setMsg unmarshals BgpSrteSegmentATypeSubTlv from protobuf object *otg.BgpSrteSegmentATypeSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteSegmentATypeSubTlv) BgpSrteSegmentATypeSubTlv + // provides marshal interface + Marshal() marshalBgpSrteSegmentATypeSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSegmentATypeSubTlv + // validate validates BgpSrteSegmentATypeSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSegmentATypeSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns string, set in BgpSrteSegmentATypeSubTlv. + Flags() string + // SetFlags assigns string provided by user to BgpSrteSegmentATypeSubTlv + SetFlags(value string) BgpSrteSegmentATypeSubTlv + // HasFlags checks if Flags has been set in BgpSrteSegmentATypeSubTlv + HasFlags() bool + // Label returns uint32, set in BgpSrteSegmentATypeSubTlv. + Label() uint32 + // SetLabel assigns uint32 provided by user to BgpSrteSegmentATypeSubTlv + SetLabel(value uint32) BgpSrteSegmentATypeSubTlv + // HasLabel checks if Label has been set in BgpSrteSegmentATypeSubTlv + HasLabel() bool + // Tc returns uint32, set in BgpSrteSegmentATypeSubTlv. + Tc() uint32 + // SetTc assigns uint32 provided by user to BgpSrteSegmentATypeSubTlv + SetTc(value uint32) BgpSrteSegmentATypeSubTlv + // HasTc checks if Tc has been set in BgpSrteSegmentATypeSubTlv + HasTc() bool + // SBit returns bool, set in BgpSrteSegmentATypeSubTlv. + SBit() bool + // SetSBit assigns bool provided by user to BgpSrteSegmentATypeSubTlv + SetSBit(value bool) BgpSrteSegmentATypeSubTlv + // HasSBit checks if SBit has been set in BgpSrteSegmentATypeSubTlv + HasSBit() bool + // Ttl returns uint32, set in BgpSrteSegmentATypeSubTlv. + Ttl() uint32 + // SetTtl assigns uint32 provided by user to BgpSrteSegmentATypeSubTlv + SetTtl(value uint32) BgpSrteSegmentATypeSubTlv + // HasTtl checks if Ttl has been set in BgpSrteSegmentATypeSubTlv + HasTtl() bool +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentATypeSubTlv) Flags() string { + + return *obj.obj.Flags + +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentATypeSubTlv) HasFlags() bool { + return obj.obj.Flags != nil +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// SetFlags sets the string value in the BgpSrteSegmentATypeSubTlv object +func (obj *bgpSrteSegmentATypeSubTlv) SetFlags(value string) BgpSrteSegmentATypeSubTlv { + + obj.obj.Flags = &value + return obj +} + +// Label value in [0, 2^20 -1]. +// Label returns a uint32 +func (obj *bgpSrteSegmentATypeSubTlv) Label() uint32 { + + return *obj.obj.Label + +} + +// Label value in [0, 2^20 -1]. +// Label returns a uint32 +func (obj *bgpSrteSegmentATypeSubTlv) HasLabel() bool { + return obj.obj.Label != nil +} + +// Label value in [0, 2^20 -1]. +// SetLabel sets the uint32 value in the BgpSrteSegmentATypeSubTlv object +func (obj *bgpSrteSegmentATypeSubTlv) SetLabel(value uint32) BgpSrteSegmentATypeSubTlv { + + obj.obj.Label = &value + return obj +} + +// Traffic class in bits. +// Tc returns a uint32 +func (obj *bgpSrteSegmentATypeSubTlv) Tc() uint32 { + + return *obj.obj.Tc + +} + +// Traffic class in bits. +// Tc returns a uint32 +func (obj *bgpSrteSegmentATypeSubTlv) HasTc() bool { + return obj.obj.Tc != nil +} + +// Traffic class in bits. +// SetTc sets the uint32 value in the BgpSrteSegmentATypeSubTlv object +func (obj *bgpSrteSegmentATypeSubTlv) SetTc(value uint32) BgpSrteSegmentATypeSubTlv { + + obj.obj.Tc = &value + return obj +} + +// Bottom-of-Stack bit. +// SBit returns a bool +func (obj *bgpSrteSegmentATypeSubTlv) SBit() bool { + + return *obj.obj.SBit + +} + +// Bottom-of-Stack bit. +// SBit returns a bool +func (obj *bgpSrteSegmentATypeSubTlv) HasSBit() bool { + return obj.obj.SBit != nil +} + +// Bottom-of-Stack bit. +// SetSBit sets the bool value in the BgpSrteSegmentATypeSubTlv object +func (obj *bgpSrteSegmentATypeSubTlv) SetSBit(value bool) BgpSrteSegmentATypeSubTlv { + + obj.obj.SBit = &value + return obj +} + +// Time To Live. +// Ttl returns a uint32 +func (obj *bgpSrteSegmentATypeSubTlv) Ttl() uint32 { + + return *obj.obj.Ttl + +} + +// Time To Live. +// Ttl returns a uint32 +func (obj *bgpSrteSegmentATypeSubTlv) HasTtl() bool { + return obj.obj.Ttl != nil +} + +// Time To Live. +// SetTtl sets the uint32 value in the BgpSrteSegmentATypeSubTlv object +func (obj *bgpSrteSegmentATypeSubTlv) SetTtl(value uint32) BgpSrteSegmentATypeSubTlv { + + obj.obj.Ttl = &value + return obj +} + +func (obj *bgpSrteSegmentATypeSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + err := obj.validateHex(obj.Flags()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentATypeSubTlv.Flags")) + } + + } + + if obj.obj.Label != nil { + + if *obj.obj.Label > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpSrteSegmentATypeSubTlv.Label <= 1048575 but Got %d", *obj.obj.Label)) + } + + } + + if obj.obj.Tc != nil { + + if *obj.obj.Tc > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpSrteSegmentATypeSubTlv.Tc <= 7 but Got %d", *obj.obj.Tc)) + } + + } + + if obj.obj.Ttl != nil { + + if *obj.obj.Ttl > 225 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpSrteSegmentATypeSubTlv.Ttl <= 225 but Got %d", *obj.obj.Ttl)) + } + + } + +} + +func (obj *bgpSrteSegmentATypeSubTlv) setDefault() { + +} diff --git a/gosnappi/bgp_srte_segment_b_type_sub_tlv.go b/gosnappi/bgp_srte_segment_b_type_sub_tlv.go new file mode 100644 index 00000000..1593be5f --- /dev/null +++ b/gosnappi/bgp_srte_segment_b_type_sub_tlv.go @@ -0,0 +1,398 @@ +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" +) + +// ***** BgpSrteSegmentBTypeSubTlv ***** +type bgpSrteSegmentBTypeSubTlv struct { + validation + obj *otg.BgpSrteSegmentBTypeSubTlv + marshaller marshalBgpSrteSegmentBTypeSubTlv + unMarshaller unMarshalBgpSrteSegmentBTypeSubTlv + srv6SidEndpointBehaviorHolder BgpSrteSRv6SIDEndpointBehaviorAndStructure +} + +func NewBgpSrteSegmentBTypeSubTlv() BgpSrteSegmentBTypeSubTlv { + obj := bgpSrteSegmentBTypeSubTlv{obj: &otg.BgpSrteSegmentBTypeSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSegmentBTypeSubTlv) msg() *otg.BgpSrteSegmentBTypeSubTlv { + return obj.obj +} + +func (obj *bgpSrteSegmentBTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentBTypeSubTlv) BgpSrteSegmentBTypeSubTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSegmentBTypeSubTlv struct { + obj *bgpSrteSegmentBTypeSubTlv +} + +type marshalBgpSrteSegmentBTypeSubTlv interface { + // ToProto marshals BgpSrteSegmentBTypeSubTlv to protobuf object *otg.BgpSrteSegmentBTypeSubTlv + ToProto() (*otg.BgpSrteSegmentBTypeSubTlv, error) + // ToPbText marshals BgpSrteSegmentBTypeSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSegmentBTypeSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSegmentBTypeSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSegmentBTypeSubTlv struct { + obj *bgpSrteSegmentBTypeSubTlv +} + +type unMarshalBgpSrteSegmentBTypeSubTlv interface { + // FromProto unmarshals BgpSrteSegmentBTypeSubTlv from protobuf object *otg.BgpSrteSegmentBTypeSubTlv + FromProto(msg *otg.BgpSrteSegmentBTypeSubTlv) (BgpSrteSegmentBTypeSubTlv, error) + // FromPbText unmarshals BgpSrteSegmentBTypeSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSegmentBTypeSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSegmentBTypeSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSegmentBTypeSubTlv) Marshal() marshalBgpSrteSegmentBTypeSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSegmentBTypeSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSegmentBTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentBTypeSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSegmentBTypeSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSegmentBTypeSubTlv) ToProto() (*otg.BgpSrteSegmentBTypeSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSegmentBTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentBTypeSubTlv) (BgpSrteSegmentBTypeSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSegmentBTypeSubTlv) 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 *unMarshalbgpSrteSegmentBTypeSubTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteSegmentBTypeSubTlv) 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 *unMarshalbgpSrteSegmentBTypeSubTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteSegmentBTypeSubTlv) 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 *unMarshalbgpSrteSegmentBTypeSubTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteSegmentBTypeSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentBTypeSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentBTypeSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSegmentBTypeSubTlv) Clone() (BgpSrteSegmentBTypeSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSegmentBTypeSubTlv() + 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 +} + +func (obj *bgpSrteSegmentBTypeSubTlv) setNil() { + obj.srv6SidEndpointBehaviorHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteSegmentBTypeSubTlv is type B: SID only, in the form of IPv6 address. +type BgpSrteSegmentBTypeSubTlv interface { + Validation + // msg marshals BgpSrteSegmentBTypeSubTlv to protobuf object *otg.BgpSrteSegmentBTypeSubTlv + // and doesn't set defaults + msg() *otg.BgpSrteSegmentBTypeSubTlv + // setMsg unmarshals BgpSrteSegmentBTypeSubTlv from protobuf object *otg.BgpSrteSegmentBTypeSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteSegmentBTypeSubTlv) BgpSrteSegmentBTypeSubTlv + // provides marshal interface + Marshal() marshalBgpSrteSegmentBTypeSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSegmentBTypeSubTlv + // validate validates BgpSrteSegmentBTypeSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSegmentBTypeSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns string, set in BgpSrteSegmentBTypeSubTlv. + Flags() string + // SetFlags assigns string provided by user to BgpSrteSegmentBTypeSubTlv + SetFlags(value string) BgpSrteSegmentBTypeSubTlv + // HasFlags checks if Flags has been set in BgpSrteSegmentBTypeSubTlv + HasFlags() bool + // Srv6Sid returns string, set in BgpSrteSegmentBTypeSubTlv. + Srv6Sid() string + // SetSrv6Sid assigns string provided by user to BgpSrteSegmentBTypeSubTlv + SetSrv6Sid(value string) BgpSrteSegmentBTypeSubTlv + // Srv6SidEndpointBehavior returns BgpSrteSRv6SIDEndpointBehaviorAndStructure, set in BgpSrteSegmentBTypeSubTlv. + // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. + Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure + // SetSrv6SidEndpointBehavior assigns BgpSrteSRv6SIDEndpointBehaviorAndStructure provided by user to BgpSrteSegmentBTypeSubTlv. + // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. + SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentBTypeSubTlv + // HasSrv6SidEndpointBehavior checks if Srv6SidEndpointBehavior has been set in BgpSrteSegmentBTypeSubTlv + HasSrv6SidEndpointBehavior() bool + setNil() +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentBTypeSubTlv) Flags() string { + + return *obj.obj.Flags + +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentBTypeSubTlv) HasFlags() bool { + return obj.obj.Flags != nil +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// SetFlags sets the string value in the BgpSrteSegmentBTypeSubTlv object +func (obj *bgpSrteSegmentBTypeSubTlv) SetFlags(value string) BgpSrteSegmentBTypeSubTlv { + + obj.obj.Flags = &value + return obj +} + +// SRv6 SID. +// Srv6Sid returns a string +func (obj *bgpSrteSegmentBTypeSubTlv) Srv6Sid() string { + + return *obj.obj.Srv6Sid + +} + +// SRv6 SID. +// SetSrv6Sid sets the string value in the BgpSrteSegmentBTypeSubTlv object +func (obj *bgpSrteSegmentBTypeSubTlv) SetSrv6Sid(value string) BgpSrteSegmentBTypeSubTlv { + + obj.obj.Srv6Sid = &value + return obj +} + +// Optional SRv6 Endpoint Behavior and SID Structure. +// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure +func (obj *bgpSrteSegmentBTypeSubTlv) Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure { + if obj.obj.Srv6SidEndpointBehavior == nil { + obj.obj.Srv6SidEndpointBehavior = NewBgpSrteSRv6SIDEndpointBehaviorAndStructure().msg() + } + if obj.srv6SidEndpointBehaviorHolder == nil { + obj.srv6SidEndpointBehaviorHolder = &bgpSrteSRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6SidEndpointBehavior} + } + return obj.srv6SidEndpointBehaviorHolder +} + +// Optional SRv6 Endpoint Behavior and SID Structure. +// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure +func (obj *bgpSrteSegmentBTypeSubTlv) HasSrv6SidEndpointBehavior() bool { + return obj.obj.Srv6SidEndpointBehavior != nil +} + +// Optional SRv6 Endpoint Behavior and SID Structure. +// SetSrv6SidEndpointBehavior sets the BgpSrteSRv6SIDEndpointBehaviorAndStructure value in the BgpSrteSegmentBTypeSubTlv object +func (obj *bgpSrteSegmentBTypeSubTlv) SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentBTypeSubTlv { + + obj.srv6SidEndpointBehaviorHolder = nil + obj.obj.Srv6SidEndpointBehavior = value.msg() + + return obj +} + +func (obj *bgpSrteSegmentBTypeSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + err := obj.validateHex(obj.Flags()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentBTypeSubTlv.Flags")) + } + + } + + // Srv6Sid is required + if obj.obj.Srv6Sid == nil { + vObj.validationErrors = append(vObj.validationErrors, "Srv6Sid is required field on interface BgpSrteSegmentBTypeSubTlv") + } + if obj.obj.Srv6Sid != nil { + + err := obj.validateIpv6(obj.Srv6Sid()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentBTypeSubTlv.Srv6Sid")) + } + + } + + if obj.obj.Srv6SidEndpointBehavior != nil { + + obj.Srv6SidEndpointBehavior().validateObj(vObj, set_default) + } + +} + +func (obj *bgpSrteSegmentBTypeSubTlv) setDefault() { + +} diff --git a/gosnappi/bgp_srte_segment_c_type_sub_tlv.go b/gosnappi/bgp_srte_segment_c_type_sub_tlv.go new file mode 100644 index 00000000..c835f178 --- /dev/null +++ b/gosnappi/bgp_srte_segment_c_type_sub_tlv.go @@ -0,0 +1,439 @@ +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" +) + +// ***** BgpSrteSegmentCTypeSubTlv ***** +type bgpSrteSegmentCTypeSubTlv struct { + validation + obj *otg.BgpSrteSegmentCTypeSubTlv + marshaller marshalBgpSrteSegmentCTypeSubTlv + unMarshaller unMarshalBgpSrteSegmentCTypeSubTlv + srMplsSidHolder BgpSrteSrMplsSid +} + +func NewBgpSrteSegmentCTypeSubTlv() BgpSrteSegmentCTypeSubTlv { + obj := bgpSrteSegmentCTypeSubTlv{obj: &otg.BgpSrteSegmentCTypeSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSegmentCTypeSubTlv) msg() *otg.BgpSrteSegmentCTypeSubTlv { + return obj.obj +} + +func (obj *bgpSrteSegmentCTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentCTypeSubTlv) BgpSrteSegmentCTypeSubTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSegmentCTypeSubTlv struct { + obj *bgpSrteSegmentCTypeSubTlv +} + +type marshalBgpSrteSegmentCTypeSubTlv interface { + // ToProto marshals BgpSrteSegmentCTypeSubTlv to protobuf object *otg.BgpSrteSegmentCTypeSubTlv + ToProto() (*otg.BgpSrteSegmentCTypeSubTlv, error) + // ToPbText marshals BgpSrteSegmentCTypeSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSegmentCTypeSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSegmentCTypeSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSegmentCTypeSubTlv struct { + obj *bgpSrteSegmentCTypeSubTlv +} + +type unMarshalBgpSrteSegmentCTypeSubTlv interface { + // FromProto unmarshals BgpSrteSegmentCTypeSubTlv from protobuf object *otg.BgpSrteSegmentCTypeSubTlv + FromProto(msg *otg.BgpSrteSegmentCTypeSubTlv) (BgpSrteSegmentCTypeSubTlv, error) + // FromPbText unmarshals BgpSrteSegmentCTypeSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSegmentCTypeSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSegmentCTypeSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSegmentCTypeSubTlv) Marshal() marshalBgpSrteSegmentCTypeSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSegmentCTypeSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSegmentCTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentCTypeSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSegmentCTypeSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSegmentCTypeSubTlv) ToProto() (*otg.BgpSrteSegmentCTypeSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSegmentCTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentCTypeSubTlv) (BgpSrteSegmentCTypeSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSegmentCTypeSubTlv) 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 *unMarshalbgpSrteSegmentCTypeSubTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteSegmentCTypeSubTlv) 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 *unMarshalbgpSrteSegmentCTypeSubTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteSegmentCTypeSubTlv) 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 *unMarshalbgpSrteSegmentCTypeSubTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteSegmentCTypeSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentCTypeSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentCTypeSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSegmentCTypeSubTlv) Clone() (BgpSrteSegmentCTypeSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSegmentCTypeSubTlv() + 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 +} + +func (obj *bgpSrteSegmentCTypeSubTlv) setNil() { + obj.srMplsSidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteSegmentCTypeSubTlv is type C: IPv4 Node Address with optional SID. +type BgpSrteSegmentCTypeSubTlv interface { + Validation + // msg marshals BgpSrteSegmentCTypeSubTlv to protobuf object *otg.BgpSrteSegmentCTypeSubTlv + // and doesn't set defaults + msg() *otg.BgpSrteSegmentCTypeSubTlv + // setMsg unmarshals BgpSrteSegmentCTypeSubTlv from protobuf object *otg.BgpSrteSegmentCTypeSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteSegmentCTypeSubTlv) BgpSrteSegmentCTypeSubTlv + // provides marshal interface + Marshal() marshalBgpSrteSegmentCTypeSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSegmentCTypeSubTlv + // validate validates BgpSrteSegmentCTypeSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSegmentCTypeSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns string, set in BgpSrteSegmentCTypeSubTlv. + Flags() string + // SetFlags assigns string provided by user to BgpSrteSegmentCTypeSubTlv + SetFlags(value string) BgpSrteSegmentCTypeSubTlv + // HasFlags checks if Flags has been set in BgpSrteSegmentCTypeSubTlv + HasFlags() bool + // SrAlgorithm returns uint32, set in BgpSrteSegmentCTypeSubTlv. + SrAlgorithm() uint32 + // SetSrAlgorithm assigns uint32 provided by user to BgpSrteSegmentCTypeSubTlv + SetSrAlgorithm(value uint32) BgpSrteSegmentCTypeSubTlv + // HasSrAlgorithm checks if SrAlgorithm has been set in BgpSrteSegmentCTypeSubTlv + HasSrAlgorithm() bool + // Ipv4NodeAddress returns string, set in BgpSrteSegmentCTypeSubTlv. + Ipv4NodeAddress() string + // SetIpv4NodeAddress assigns string provided by user to BgpSrteSegmentCTypeSubTlv + SetIpv4NodeAddress(value string) BgpSrteSegmentCTypeSubTlv + // SrMplsSid returns BgpSrteSrMplsSid, set in BgpSrteSegmentCTypeSubTlv. + // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. + SrMplsSid() BgpSrteSrMplsSid + // SetSrMplsSid assigns BgpSrteSrMplsSid provided by user to BgpSrteSegmentCTypeSubTlv. + // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. + SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentCTypeSubTlv + // HasSrMplsSid checks if SrMplsSid has been set in BgpSrteSegmentCTypeSubTlv + HasSrMplsSid() bool + setNil() +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentCTypeSubTlv) Flags() string { + + return *obj.obj.Flags + +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentCTypeSubTlv) HasFlags() bool { + return obj.obj.Flags != nil +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// SetFlags sets the string value in the BgpSrteSegmentCTypeSubTlv object +func (obj *bgpSrteSegmentCTypeSubTlv) SetFlags(value string) BgpSrteSegmentCTypeSubTlv { + + obj.obj.Flags = &value + return obj +} + +// SR Algorithm identifier when A-Flag in on. +// SrAlgorithm returns a uint32 +func (obj *bgpSrteSegmentCTypeSubTlv) SrAlgorithm() uint32 { + + return *obj.obj.SrAlgorithm + +} + +// SR Algorithm identifier when A-Flag in on. +// SrAlgorithm returns a uint32 +func (obj *bgpSrteSegmentCTypeSubTlv) HasSrAlgorithm() bool { + return obj.obj.SrAlgorithm != nil +} + +// SR Algorithm identifier when A-Flag in on. +// SetSrAlgorithm sets the uint32 value in the BgpSrteSegmentCTypeSubTlv object +func (obj *bgpSrteSegmentCTypeSubTlv) SetSrAlgorithm(value uint32) BgpSrteSegmentCTypeSubTlv { + + obj.obj.SrAlgorithm = &value + return obj +} + +// IPv4 address representing a node. +// Ipv4NodeAddress returns a string +func (obj *bgpSrteSegmentCTypeSubTlv) Ipv4NodeAddress() string { + + return *obj.obj.Ipv4NodeAddress + +} + +// IPv4 address representing a node. +// SetIpv4NodeAddress sets the string value in the BgpSrteSegmentCTypeSubTlv object +func (obj *bgpSrteSegmentCTypeSubTlv) SetIpv4NodeAddress(value string) BgpSrteSegmentCTypeSubTlv { + + obj.obj.Ipv4NodeAddress = &value + return obj +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpSrteSrMplsSid +func (obj *bgpSrteSegmentCTypeSubTlv) SrMplsSid() BgpSrteSrMplsSid { + if obj.obj.SrMplsSid == nil { + obj.obj.SrMplsSid = NewBgpSrteSrMplsSid().msg() + } + if obj.srMplsSidHolder == nil { + obj.srMplsSidHolder = &bgpSrteSrMplsSid{obj: obj.obj.SrMplsSid} + } + return obj.srMplsSidHolder +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpSrteSrMplsSid +func (obj *bgpSrteSegmentCTypeSubTlv) HasSrMplsSid() bool { + return obj.obj.SrMplsSid != nil +} + +// Optional SR-MPLS SID. +// SetSrMplsSid sets the BgpSrteSrMplsSid value in the BgpSrteSegmentCTypeSubTlv object +func (obj *bgpSrteSegmentCTypeSubTlv) SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentCTypeSubTlv { + + obj.srMplsSidHolder = nil + obj.obj.SrMplsSid = value.msg() + + return obj +} + +func (obj *bgpSrteSegmentCTypeSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + err := obj.validateHex(obj.Flags()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentCTypeSubTlv.Flags")) + } + + } + + if obj.obj.SrAlgorithm != nil { + + if *obj.obj.SrAlgorithm > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpSrteSegmentCTypeSubTlv.SrAlgorithm <= 255 but Got %d", *obj.obj.SrAlgorithm)) + } + + } + + // Ipv4NodeAddress is required + if obj.obj.Ipv4NodeAddress == nil { + vObj.validationErrors = append(vObj.validationErrors, "Ipv4NodeAddress is required field on interface BgpSrteSegmentCTypeSubTlv") + } + if obj.obj.Ipv4NodeAddress != nil { + + err := obj.validateIpv4(obj.Ipv4NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentCTypeSubTlv.Ipv4NodeAddress")) + } + + } + + if obj.obj.SrMplsSid != nil { + + obj.SrMplsSid().validateObj(vObj, set_default) + } + +} + +func (obj *bgpSrteSegmentCTypeSubTlv) setDefault() { + if obj.obj.SrAlgorithm == nil { + obj.SetSrAlgorithm(0) + } + +} diff --git a/gosnappi/bgp_srte_segment_d_type_sub_tlv.go b/gosnappi/bgp_srte_segment_d_type_sub_tlv.go new file mode 100644 index 00000000..1ba2a1dc --- /dev/null +++ b/gosnappi/bgp_srte_segment_d_type_sub_tlv.go @@ -0,0 +1,439 @@ +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" +) + +// ***** BgpSrteSegmentDTypeSubTlv ***** +type bgpSrteSegmentDTypeSubTlv struct { + validation + obj *otg.BgpSrteSegmentDTypeSubTlv + marshaller marshalBgpSrteSegmentDTypeSubTlv + unMarshaller unMarshalBgpSrteSegmentDTypeSubTlv + srMplsSidHolder BgpSrteSrMplsSid +} + +func NewBgpSrteSegmentDTypeSubTlv() BgpSrteSegmentDTypeSubTlv { + obj := bgpSrteSegmentDTypeSubTlv{obj: &otg.BgpSrteSegmentDTypeSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSegmentDTypeSubTlv) msg() *otg.BgpSrteSegmentDTypeSubTlv { + return obj.obj +} + +func (obj *bgpSrteSegmentDTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentDTypeSubTlv) BgpSrteSegmentDTypeSubTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSegmentDTypeSubTlv struct { + obj *bgpSrteSegmentDTypeSubTlv +} + +type marshalBgpSrteSegmentDTypeSubTlv interface { + // ToProto marshals BgpSrteSegmentDTypeSubTlv to protobuf object *otg.BgpSrteSegmentDTypeSubTlv + ToProto() (*otg.BgpSrteSegmentDTypeSubTlv, error) + // ToPbText marshals BgpSrteSegmentDTypeSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSegmentDTypeSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSegmentDTypeSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSegmentDTypeSubTlv struct { + obj *bgpSrteSegmentDTypeSubTlv +} + +type unMarshalBgpSrteSegmentDTypeSubTlv interface { + // FromProto unmarshals BgpSrteSegmentDTypeSubTlv from protobuf object *otg.BgpSrteSegmentDTypeSubTlv + FromProto(msg *otg.BgpSrteSegmentDTypeSubTlv) (BgpSrteSegmentDTypeSubTlv, error) + // FromPbText unmarshals BgpSrteSegmentDTypeSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSegmentDTypeSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSegmentDTypeSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSegmentDTypeSubTlv) Marshal() marshalBgpSrteSegmentDTypeSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSegmentDTypeSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSegmentDTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentDTypeSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSegmentDTypeSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSegmentDTypeSubTlv) ToProto() (*otg.BgpSrteSegmentDTypeSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSegmentDTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentDTypeSubTlv) (BgpSrteSegmentDTypeSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSegmentDTypeSubTlv) 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 *unMarshalbgpSrteSegmentDTypeSubTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteSegmentDTypeSubTlv) 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 *unMarshalbgpSrteSegmentDTypeSubTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteSegmentDTypeSubTlv) 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 *unMarshalbgpSrteSegmentDTypeSubTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteSegmentDTypeSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentDTypeSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentDTypeSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSegmentDTypeSubTlv) Clone() (BgpSrteSegmentDTypeSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSegmentDTypeSubTlv() + 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 +} + +func (obj *bgpSrteSegmentDTypeSubTlv) setNil() { + obj.srMplsSidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteSegmentDTypeSubTlv is type D: IPv6 Node Address with optional SID for SR MPLS. +type BgpSrteSegmentDTypeSubTlv interface { + Validation + // msg marshals BgpSrteSegmentDTypeSubTlv to protobuf object *otg.BgpSrteSegmentDTypeSubTlv + // and doesn't set defaults + msg() *otg.BgpSrteSegmentDTypeSubTlv + // setMsg unmarshals BgpSrteSegmentDTypeSubTlv from protobuf object *otg.BgpSrteSegmentDTypeSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteSegmentDTypeSubTlv) BgpSrteSegmentDTypeSubTlv + // provides marshal interface + Marshal() marshalBgpSrteSegmentDTypeSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSegmentDTypeSubTlv + // validate validates BgpSrteSegmentDTypeSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSegmentDTypeSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns string, set in BgpSrteSegmentDTypeSubTlv. + Flags() string + // SetFlags assigns string provided by user to BgpSrteSegmentDTypeSubTlv + SetFlags(value string) BgpSrteSegmentDTypeSubTlv + // HasFlags checks if Flags has been set in BgpSrteSegmentDTypeSubTlv + HasFlags() bool + // SrAlgorithm returns uint32, set in BgpSrteSegmentDTypeSubTlv. + SrAlgorithm() uint32 + // SetSrAlgorithm assigns uint32 provided by user to BgpSrteSegmentDTypeSubTlv + SetSrAlgorithm(value uint32) BgpSrteSegmentDTypeSubTlv + // HasSrAlgorithm checks if SrAlgorithm has been set in BgpSrteSegmentDTypeSubTlv + HasSrAlgorithm() bool + // Ipv6NodeAddress returns string, set in BgpSrteSegmentDTypeSubTlv. + Ipv6NodeAddress() string + // SetIpv6NodeAddress assigns string provided by user to BgpSrteSegmentDTypeSubTlv + SetIpv6NodeAddress(value string) BgpSrteSegmentDTypeSubTlv + // SrMplsSid returns BgpSrteSrMplsSid, set in BgpSrteSegmentDTypeSubTlv. + // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. + SrMplsSid() BgpSrteSrMplsSid + // SetSrMplsSid assigns BgpSrteSrMplsSid provided by user to BgpSrteSegmentDTypeSubTlv. + // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. + SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentDTypeSubTlv + // HasSrMplsSid checks if SrMplsSid has been set in BgpSrteSegmentDTypeSubTlv + HasSrMplsSid() bool + setNil() +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentDTypeSubTlv) Flags() string { + + return *obj.obj.Flags + +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentDTypeSubTlv) HasFlags() bool { + return obj.obj.Flags != nil +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// SetFlags sets the string value in the BgpSrteSegmentDTypeSubTlv object +func (obj *bgpSrteSegmentDTypeSubTlv) SetFlags(value string) BgpSrteSegmentDTypeSubTlv { + + obj.obj.Flags = &value + return obj +} + +// specifying SR Algorithm when when A-Flag as defined in above flags. +// SrAlgorithm returns a uint32 +func (obj *bgpSrteSegmentDTypeSubTlv) SrAlgorithm() uint32 { + + return *obj.obj.SrAlgorithm + +} + +// specifying SR Algorithm when when A-Flag as defined in above flags. +// SrAlgorithm returns a uint32 +func (obj *bgpSrteSegmentDTypeSubTlv) HasSrAlgorithm() bool { + return obj.obj.SrAlgorithm != nil +} + +// specifying SR Algorithm when when A-Flag as defined in above flags. +// SetSrAlgorithm sets the uint32 value in the BgpSrteSegmentDTypeSubTlv object +func (obj *bgpSrteSegmentDTypeSubTlv) SetSrAlgorithm(value uint32) BgpSrteSegmentDTypeSubTlv { + + obj.obj.SrAlgorithm = &value + return obj +} + +// IPv6 address representing a node. +// Ipv6NodeAddress returns a string +func (obj *bgpSrteSegmentDTypeSubTlv) Ipv6NodeAddress() string { + + return *obj.obj.Ipv6NodeAddress + +} + +// IPv6 address representing a node. +// SetIpv6NodeAddress sets the string value in the BgpSrteSegmentDTypeSubTlv object +func (obj *bgpSrteSegmentDTypeSubTlv) SetIpv6NodeAddress(value string) BgpSrteSegmentDTypeSubTlv { + + obj.obj.Ipv6NodeAddress = &value + return obj +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpSrteSrMplsSid +func (obj *bgpSrteSegmentDTypeSubTlv) SrMplsSid() BgpSrteSrMplsSid { + if obj.obj.SrMplsSid == nil { + obj.obj.SrMplsSid = NewBgpSrteSrMplsSid().msg() + } + if obj.srMplsSidHolder == nil { + obj.srMplsSidHolder = &bgpSrteSrMplsSid{obj: obj.obj.SrMplsSid} + } + return obj.srMplsSidHolder +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpSrteSrMplsSid +func (obj *bgpSrteSegmentDTypeSubTlv) HasSrMplsSid() bool { + return obj.obj.SrMplsSid != nil +} + +// Optional SR-MPLS SID. +// SetSrMplsSid sets the BgpSrteSrMplsSid value in the BgpSrteSegmentDTypeSubTlv object +func (obj *bgpSrteSegmentDTypeSubTlv) SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentDTypeSubTlv { + + obj.srMplsSidHolder = nil + obj.obj.SrMplsSid = value.msg() + + return obj +} + +func (obj *bgpSrteSegmentDTypeSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + err := obj.validateHex(obj.Flags()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentDTypeSubTlv.Flags")) + } + + } + + if obj.obj.SrAlgorithm != nil { + + if *obj.obj.SrAlgorithm > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpSrteSegmentDTypeSubTlv.SrAlgorithm <= 255 but Got %d", *obj.obj.SrAlgorithm)) + } + + } + + // Ipv6NodeAddress is required + if obj.obj.Ipv6NodeAddress == nil { + vObj.validationErrors = append(vObj.validationErrors, "Ipv6NodeAddress is required field on interface BgpSrteSegmentDTypeSubTlv") + } + if obj.obj.Ipv6NodeAddress != nil { + + err := obj.validateIpv6(obj.Ipv6NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentDTypeSubTlv.Ipv6NodeAddress")) + } + + } + + if obj.obj.SrMplsSid != nil { + + obj.SrMplsSid().validateObj(vObj, set_default) + } + +} + +func (obj *bgpSrteSegmentDTypeSubTlv) setDefault() { + if obj.obj.SrAlgorithm == nil { + obj.SetSrAlgorithm(0) + } + +} diff --git a/gosnappi/bgp_srte_segment_e_type_sub_tlv.go b/gosnappi/bgp_srte_segment_e_type_sub_tlv.go new file mode 100644 index 00000000..1df8cd54 --- /dev/null +++ b/gosnappi/bgp_srte_segment_e_type_sub_tlv.go @@ -0,0 +1,429 @@ +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" +) + +// ***** BgpSrteSegmentETypeSubTlv ***** +type bgpSrteSegmentETypeSubTlv struct { + validation + obj *otg.BgpSrteSegmentETypeSubTlv + marshaller marshalBgpSrteSegmentETypeSubTlv + unMarshaller unMarshalBgpSrteSegmentETypeSubTlv + srMplsSidHolder BgpSrteSrMplsSid +} + +func NewBgpSrteSegmentETypeSubTlv() BgpSrteSegmentETypeSubTlv { + obj := bgpSrteSegmentETypeSubTlv{obj: &otg.BgpSrteSegmentETypeSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSegmentETypeSubTlv) msg() *otg.BgpSrteSegmentETypeSubTlv { + return obj.obj +} + +func (obj *bgpSrteSegmentETypeSubTlv) setMsg(msg *otg.BgpSrteSegmentETypeSubTlv) BgpSrteSegmentETypeSubTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSegmentETypeSubTlv struct { + obj *bgpSrteSegmentETypeSubTlv +} + +type marshalBgpSrteSegmentETypeSubTlv interface { + // ToProto marshals BgpSrteSegmentETypeSubTlv to protobuf object *otg.BgpSrteSegmentETypeSubTlv + ToProto() (*otg.BgpSrteSegmentETypeSubTlv, error) + // ToPbText marshals BgpSrteSegmentETypeSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSegmentETypeSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSegmentETypeSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSegmentETypeSubTlv struct { + obj *bgpSrteSegmentETypeSubTlv +} + +type unMarshalBgpSrteSegmentETypeSubTlv interface { + // FromProto unmarshals BgpSrteSegmentETypeSubTlv from protobuf object *otg.BgpSrteSegmentETypeSubTlv + FromProto(msg *otg.BgpSrteSegmentETypeSubTlv) (BgpSrteSegmentETypeSubTlv, error) + // FromPbText unmarshals BgpSrteSegmentETypeSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSegmentETypeSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSegmentETypeSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSegmentETypeSubTlv) Marshal() marshalBgpSrteSegmentETypeSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSegmentETypeSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSegmentETypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentETypeSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSegmentETypeSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSegmentETypeSubTlv) ToProto() (*otg.BgpSrteSegmentETypeSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSegmentETypeSubTlv) FromProto(msg *otg.BgpSrteSegmentETypeSubTlv) (BgpSrteSegmentETypeSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSegmentETypeSubTlv) 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 *unMarshalbgpSrteSegmentETypeSubTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteSegmentETypeSubTlv) 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 *unMarshalbgpSrteSegmentETypeSubTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteSegmentETypeSubTlv) 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 *unMarshalbgpSrteSegmentETypeSubTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteSegmentETypeSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentETypeSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentETypeSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSegmentETypeSubTlv) Clone() (BgpSrteSegmentETypeSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSegmentETypeSubTlv() + 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 +} + +func (obj *bgpSrteSegmentETypeSubTlv) setNil() { + obj.srMplsSidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteSegmentETypeSubTlv is type E: IPv4 Address and Local Interface ID with optional SID +type BgpSrteSegmentETypeSubTlv interface { + Validation + // msg marshals BgpSrteSegmentETypeSubTlv to protobuf object *otg.BgpSrteSegmentETypeSubTlv + // and doesn't set defaults + msg() *otg.BgpSrteSegmentETypeSubTlv + // setMsg unmarshals BgpSrteSegmentETypeSubTlv from protobuf object *otg.BgpSrteSegmentETypeSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteSegmentETypeSubTlv) BgpSrteSegmentETypeSubTlv + // provides marshal interface + Marshal() marshalBgpSrteSegmentETypeSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSegmentETypeSubTlv + // validate validates BgpSrteSegmentETypeSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSegmentETypeSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns string, set in BgpSrteSegmentETypeSubTlv. + Flags() string + // SetFlags assigns string provided by user to BgpSrteSegmentETypeSubTlv + SetFlags(value string) BgpSrteSegmentETypeSubTlv + // HasFlags checks if Flags has been set in BgpSrteSegmentETypeSubTlv + HasFlags() bool + // LocalInterfaceId returns uint32, set in BgpSrteSegmentETypeSubTlv. + LocalInterfaceId() uint32 + // SetLocalInterfaceId assigns uint32 provided by user to BgpSrteSegmentETypeSubTlv + SetLocalInterfaceId(value uint32) BgpSrteSegmentETypeSubTlv + // HasLocalInterfaceId checks if LocalInterfaceId has been set in BgpSrteSegmentETypeSubTlv + HasLocalInterfaceId() bool + // Ipv4NodeAddress returns string, set in BgpSrteSegmentETypeSubTlv. + Ipv4NodeAddress() string + // SetIpv4NodeAddress assigns string provided by user to BgpSrteSegmentETypeSubTlv + SetIpv4NodeAddress(value string) BgpSrteSegmentETypeSubTlv + // SrMplsSid returns BgpSrteSrMplsSid, set in BgpSrteSegmentETypeSubTlv. + // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. + SrMplsSid() BgpSrteSrMplsSid + // SetSrMplsSid assigns BgpSrteSrMplsSid provided by user to BgpSrteSegmentETypeSubTlv. + // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. + SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentETypeSubTlv + // HasSrMplsSid checks if SrMplsSid has been set in BgpSrteSegmentETypeSubTlv + HasSrMplsSid() bool + setNil() +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentETypeSubTlv) Flags() string { + + return *obj.obj.Flags + +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentETypeSubTlv) HasFlags() bool { + return obj.obj.Flags != nil +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// SetFlags sets the string value in the BgpSrteSegmentETypeSubTlv object +func (obj *bgpSrteSegmentETypeSubTlv) SetFlags(value string) BgpSrteSegmentETypeSubTlv { + + obj.obj.Flags = &value + return obj +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// LocalInterfaceId returns a uint32 +func (obj *bgpSrteSegmentETypeSubTlv) LocalInterfaceId() uint32 { + + return *obj.obj.LocalInterfaceId + +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// LocalInterfaceId returns a uint32 +func (obj *bgpSrteSegmentETypeSubTlv) HasLocalInterfaceId() bool { + return obj.obj.LocalInterfaceId != nil +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// SetLocalInterfaceId sets the uint32 value in the BgpSrteSegmentETypeSubTlv object +func (obj *bgpSrteSegmentETypeSubTlv) SetLocalInterfaceId(value uint32) BgpSrteSegmentETypeSubTlv { + + obj.obj.LocalInterfaceId = &value + return obj +} + +// IPv4 address representing a node. +// Ipv4NodeAddress returns a string +func (obj *bgpSrteSegmentETypeSubTlv) Ipv4NodeAddress() string { + + return *obj.obj.Ipv4NodeAddress + +} + +// IPv4 address representing a node. +// SetIpv4NodeAddress sets the string value in the BgpSrteSegmentETypeSubTlv object +func (obj *bgpSrteSegmentETypeSubTlv) SetIpv4NodeAddress(value string) BgpSrteSegmentETypeSubTlv { + + obj.obj.Ipv4NodeAddress = &value + return obj +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpSrteSrMplsSid +func (obj *bgpSrteSegmentETypeSubTlv) SrMplsSid() BgpSrteSrMplsSid { + if obj.obj.SrMplsSid == nil { + obj.obj.SrMplsSid = NewBgpSrteSrMplsSid().msg() + } + if obj.srMplsSidHolder == nil { + obj.srMplsSidHolder = &bgpSrteSrMplsSid{obj: obj.obj.SrMplsSid} + } + return obj.srMplsSidHolder +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpSrteSrMplsSid +func (obj *bgpSrteSegmentETypeSubTlv) HasSrMplsSid() bool { + return obj.obj.SrMplsSid != nil +} + +// Optional SR-MPLS SID. +// SetSrMplsSid sets the BgpSrteSrMplsSid value in the BgpSrteSegmentETypeSubTlv object +func (obj *bgpSrteSegmentETypeSubTlv) SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentETypeSubTlv { + + obj.srMplsSidHolder = nil + obj.obj.SrMplsSid = value.msg() + + return obj +} + +func (obj *bgpSrteSegmentETypeSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + err := obj.validateHex(obj.Flags()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentETypeSubTlv.Flags")) + } + + } + + // Ipv4NodeAddress is required + if obj.obj.Ipv4NodeAddress == nil { + vObj.validationErrors = append(vObj.validationErrors, "Ipv4NodeAddress is required field on interface BgpSrteSegmentETypeSubTlv") + } + if obj.obj.Ipv4NodeAddress != nil { + + err := obj.validateIpv4(obj.Ipv4NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentETypeSubTlv.Ipv4NodeAddress")) + } + + } + + if obj.obj.SrMplsSid != nil { + + obj.SrMplsSid().validateObj(vObj, set_default) + } + +} + +func (obj *bgpSrteSegmentETypeSubTlv) setDefault() { + if obj.obj.LocalInterfaceId == nil { + obj.SetLocalInterfaceId(0) + } + +} diff --git a/gosnappi/bgp_srte_segment_f_type_sub_tlv.go b/gosnappi/bgp_srte_segment_f_type_sub_tlv.go new file mode 100644 index 00000000..1fd83030 --- /dev/null +++ b/gosnappi/bgp_srte_segment_f_type_sub_tlv.go @@ -0,0 +1,431 @@ +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" +) + +// ***** BgpSrteSegmentFTypeSubTlv ***** +type bgpSrteSegmentFTypeSubTlv struct { + validation + obj *otg.BgpSrteSegmentFTypeSubTlv + marshaller marshalBgpSrteSegmentFTypeSubTlv + unMarshaller unMarshalBgpSrteSegmentFTypeSubTlv + srMplsSidHolder BgpSrteSrMplsSid +} + +func NewBgpSrteSegmentFTypeSubTlv() BgpSrteSegmentFTypeSubTlv { + obj := bgpSrteSegmentFTypeSubTlv{obj: &otg.BgpSrteSegmentFTypeSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSegmentFTypeSubTlv) msg() *otg.BgpSrteSegmentFTypeSubTlv { + return obj.obj +} + +func (obj *bgpSrteSegmentFTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentFTypeSubTlv) BgpSrteSegmentFTypeSubTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSegmentFTypeSubTlv struct { + obj *bgpSrteSegmentFTypeSubTlv +} + +type marshalBgpSrteSegmentFTypeSubTlv interface { + // ToProto marshals BgpSrteSegmentFTypeSubTlv to protobuf object *otg.BgpSrteSegmentFTypeSubTlv + ToProto() (*otg.BgpSrteSegmentFTypeSubTlv, error) + // ToPbText marshals BgpSrteSegmentFTypeSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSegmentFTypeSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSegmentFTypeSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSegmentFTypeSubTlv struct { + obj *bgpSrteSegmentFTypeSubTlv +} + +type unMarshalBgpSrteSegmentFTypeSubTlv interface { + // FromProto unmarshals BgpSrteSegmentFTypeSubTlv from protobuf object *otg.BgpSrteSegmentFTypeSubTlv + FromProto(msg *otg.BgpSrteSegmentFTypeSubTlv) (BgpSrteSegmentFTypeSubTlv, error) + // FromPbText unmarshals BgpSrteSegmentFTypeSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSegmentFTypeSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSegmentFTypeSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSegmentFTypeSubTlv) Marshal() marshalBgpSrteSegmentFTypeSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSegmentFTypeSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSegmentFTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentFTypeSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSegmentFTypeSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSegmentFTypeSubTlv) ToProto() (*otg.BgpSrteSegmentFTypeSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSegmentFTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentFTypeSubTlv) (BgpSrteSegmentFTypeSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSegmentFTypeSubTlv) 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 *unMarshalbgpSrteSegmentFTypeSubTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteSegmentFTypeSubTlv) 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 *unMarshalbgpSrteSegmentFTypeSubTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteSegmentFTypeSubTlv) 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 *unMarshalbgpSrteSegmentFTypeSubTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteSegmentFTypeSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentFTypeSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentFTypeSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSegmentFTypeSubTlv) Clone() (BgpSrteSegmentFTypeSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSegmentFTypeSubTlv() + 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 +} + +func (obj *bgpSrteSegmentFTypeSubTlv) setNil() { + obj.srMplsSidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteSegmentFTypeSubTlv is type F: IPv4 Local and Remote addresses with optional SID. +type BgpSrteSegmentFTypeSubTlv interface { + Validation + // msg marshals BgpSrteSegmentFTypeSubTlv to protobuf object *otg.BgpSrteSegmentFTypeSubTlv + // and doesn't set defaults + msg() *otg.BgpSrteSegmentFTypeSubTlv + // setMsg unmarshals BgpSrteSegmentFTypeSubTlv from protobuf object *otg.BgpSrteSegmentFTypeSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteSegmentFTypeSubTlv) BgpSrteSegmentFTypeSubTlv + // provides marshal interface + Marshal() marshalBgpSrteSegmentFTypeSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSegmentFTypeSubTlv + // validate validates BgpSrteSegmentFTypeSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSegmentFTypeSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns string, set in BgpSrteSegmentFTypeSubTlv. + Flags() string + // SetFlags assigns string provided by user to BgpSrteSegmentFTypeSubTlv + SetFlags(value string) BgpSrteSegmentFTypeSubTlv + // HasFlags checks if Flags has been set in BgpSrteSegmentFTypeSubTlv + HasFlags() bool + // LocalIpv4Address returns string, set in BgpSrteSegmentFTypeSubTlv. + LocalIpv4Address() string + // SetLocalIpv4Address assigns string provided by user to BgpSrteSegmentFTypeSubTlv + SetLocalIpv4Address(value string) BgpSrteSegmentFTypeSubTlv + // RemoteIpv4Address returns string, set in BgpSrteSegmentFTypeSubTlv. + RemoteIpv4Address() string + // SetRemoteIpv4Address assigns string provided by user to BgpSrteSegmentFTypeSubTlv + SetRemoteIpv4Address(value string) BgpSrteSegmentFTypeSubTlv + // SrMplsSid returns BgpSrteSrMplsSid, set in BgpSrteSegmentFTypeSubTlv. + // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. + SrMplsSid() BgpSrteSrMplsSid + // SetSrMplsSid assigns BgpSrteSrMplsSid provided by user to BgpSrteSegmentFTypeSubTlv. + // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. + SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentFTypeSubTlv + // HasSrMplsSid checks if SrMplsSid has been set in BgpSrteSegmentFTypeSubTlv + HasSrMplsSid() bool + setNil() +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentFTypeSubTlv) Flags() string { + + return *obj.obj.Flags + +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentFTypeSubTlv) HasFlags() bool { + return obj.obj.Flags != nil +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// SetFlags sets the string value in the BgpSrteSegmentFTypeSubTlv object +func (obj *bgpSrteSegmentFTypeSubTlv) SetFlags(value string) BgpSrteSegmentFTypeSubTlv { + + obj.obj.Flags = &value + return obj +} + +// Local IPv4 Address. +// LocalIpv4Address returns a string +func (obj *bgpSrteSegmentFTypeSubTlv) LocalIpv4Address() string { + + return *obj.obj.LocalIpv4Address + +} + +// Local IPv4 Address. +// SetLocalIpv4Address sets the string value in the BgpSrteSegmentFTypeSubTlv object +func (obj *bgpSrteSegmentFTypeSubTlv) SetLocalIpv4Address(value string) BgpSrteSegmentFTypeSubTlv { + + obj.obj.LocalIpv4Address = &value + return obj +} + +// Remote IPv4 Address. +// RemoteIpv4Address returns a string +func (obj *bgpSrteSegmentFTypeSubTlv) RemoteIpv4Address() string { + + return *obj.obj.RemoteIpv4Address + +} + +// Remote IPv4 Address. +// SetRemoteIpv4Address sets the string value in the BgpSrteSegmentFTypeSubTlv object +func (obj *bgpSrteSegmentFTypeSubTlv) SetRemoteIpv4Address(value string) BgpSrteSegmentFTypeSubTlv { + + obj.obj.RemoteIpv4Address = &value + return obj +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpSrteSrMplsSid +func (obj *bgpSrteSegmentFTypeSubTlv) SrMplsSid() BgpSrteSrMplsSid { + if obj.obj.SrMplsSid == nil { + obj.obj.SrMplsSid = NewBgpSrteSrMplsSid().msg() + } + if obj.srMplsSidHolder == nil { + obj.srMplsSidHolder = &bgpSrteSrMplsSid{obj: obj.obj.SrMplsSid} + } + return obj.srMplsSidHolder +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpSrteSrMplsSid +func (obj *bgpSrteSegmentFTypeSubTlv) HasSrMplsSid() bool { + return obj.obj.SrMplsSid != nil +} + +// Optional SR-MPLS SID. +// SetSrMplsSid sets the BgpSrteSrMplsSid value in the BgpSrteSegmentFTypeSubTlv object +func (obj *bgpSrteSegmentFTypeSubTlv) SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentFTypeSubTlv { + + obj.srMplsSidHolder = nil + obj.obj.SrMplsSid = value.msg() + + return obj +} + +func (obj *bgpSrteSegmentFTypeSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + err := obj.validateHex(obj.Flags()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentFTypeSubTlv.Flags")) + } + + } + + // LocalIpv4Address is required + if obj.obj.LocalIpv4Address == nil { + vObj.validationErrors = append(vObj.validationErrors, "LocalIpv4Address is required field on interface BgpSrteSegmentFTypeSubTlv") + } + if obj.obj.LocalIpv4Address != nil { + + err := obj.validateIpv4(obj.LocalIpv4Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentFTypeSubTlv.LocalIpv4Address")) + } + + } + + // RemoteIpv4Address is required + if obj.obj.RemoteIpv4Address == nil { + vObj.validationErrors = append(vObj.validationErrors, "RemoteIpv4Address is required field on interface BgpSrteSegmentFTypeSubTlv") + } + if obj.obj.RemoteIpv4Address != nil { + + err := obj.validateIpv4(obj.RemoteIpv4Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentFTypeSubTlv.RemoteIpv4Address")) + } + + } + + if obj.obj.SrMplsSid != nil { + + obj.SrMplsSid().validateObj(vObj, set_default) + } + +} + +func (obj *bgpSrteSegmentFTypeSubTlv) setDefault() { + +} diff --git a/gosnappi/bgp_srte_segment_g_type_sub_tlv.go b/gosnappi/bgp_srte_segment_g_type_sub_tlv.go new file mode 100644 index 00000000..d7f6d3c5 --- /dev/null +++ b/gosnappi/bgp_srte_segment_g_type_sub_tlv.go @@ -0,0 +1,493 @@ +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" +) + +// ***** BgpSrteSegmentGTypeSubTlv ***** +type bgpSrteSegmentGTypeSubTlv struct { + validation + obj *otg.BgpSrteSegmentGTypeSubTlv + marshaller marshalBgpSrteSegmentGTypeSubTlv + unMarshaller unMarshalBgpSrteSegmentGTypeSubTlv + srMplsSidHolder BgpSrteSrMplsSid +} + +func NewBgpSrteSegmentGTypeSubTlv() BgpSrteSegmentGTypeSubTlv { + obj := bgpSrteSegmentGTypeSubTlv{obj: &otg.BgpSrteSegmentGTypeSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSegmentGTypeSubTlv) msg() *otg.BgpSrteSegmentGTypeSubTlv { + return obj.obj +} + +func (obj *bgpSrteSegmentGTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentGTypeSubTlv) BgpSrteSegmentGTypeSubTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSegmentGTypeSubTlv struct { + obj *bgpSrteSegmentGTypeSubTlv +} + +type marshalBgpSrteSegmentGTypeSubTlv interface { + // ToProto marshals BgpSrteSegmentGTypeSubTlv to protobuf object *otg.BgpSrteSegmentGTypeSubTlv + ToProto() (*otg.BgpSrteSegmentGTypeSubTlv, error) + // ToPbText marshals BgpSrteSegmentGTypeSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSegmentGTypeSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSegmentGTypeSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSegmentGTypeSubTlv struct { + obj *bgpSrteSegmentGTypeSubTlv +} + +type unMarshalBgpSrteSegmentGTypeSubTlv interface { + // FromProto unmarshals BgpSrteSegmentGTypeSubTlv from protobuf object *otg.BgpSrteSegmentGTypeSubTlv + FromProto(msg *otg.BgpSrteSegmentGTypeSubTlv) (BgpSrteSegmentGTypeSubTlv, error) + // FromPbText unmarshals BgpSrteSegmentGTypeSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSegmentGTypeSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSegmentGTypeSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSegmentGTypeSubTlv) Marshal() marshalBgpSrteSegmentGTypeSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSegmentGTypeSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSegmentGTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentGTypeSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSegmentGTypeSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSegmentGTypeSubTlv) ToProto() (*otg.BgpSrteSegmentGTypeSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSegmentGTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentGTypeSubTlv) (BgpSrteSegmentGTypeSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSegmentGTypeSubTlv) 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 *unMarshalbgpSrteSegmentGTypeSubTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteSegmentGTypeSubTlv) 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 *unMarshalbgpSrteSegmentGTypeSubTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteSegmentGTypeSubTlv) 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 *unMarshalbgpSrteSegmentGTypeSubTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteSegmentGTypeSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentGTypeSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentGTypeSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSegmentGTypeSubTlv) Clone() (BgpSrteSegmentGTypeSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSegmentGTypeSubTlv() + 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 +} + +func (obj *bgpSrteSegmentGTypeSubTlv) setNil() { + obj.srMplsSidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteSegmentGTypeSubTlv is type G: IPv6 Address, Interface ID for local and remote pair with optional SID for SR MPLS. +type BgpSrteSegmentGTypeSubTlv interface { + Validation + // msg marshals BgpSrteSegmentGTypeSubTlv to protobuf object *otg.BgpSrteSegmentGTypeSubTlv + // and doesn't set defaults + msg() *otg.BgpSrteSegmentGTypeSubTlv + // setMsg unmarshals BgpSrteSegmentGTypeSubTlv from protobuf object *otg.BgpSrteSegmentGTypeSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteSegmentGTypeSubTlv) BgpSrteSegmentGTypeSubTlv + // provides marshal interface + Marshal() marshalBgpSrteSegmentGTypeSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSegmentGTypeSubTlv + // validate validates BgpSrteSegmentGTypeSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSegmentGTypeSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns string, set in BgpSrteSegmentGTypeSubTlv. + Flags() string + // SetFlags assigns string provided by user to BgpSrteSegmentGTypeSubTlv + SetFlags(value string) BgpSrteSegmentGTypeSubTlv + // HasFlags checks if Flags has been set in BgpSrteSegmentGTypeSubTlv + HasFlags() bool + // LocalInterfaceId returns uint32, set in BgpSrteSegmentGTypeSubTlv. + LocalInterfaceId() uint32 + // SetLocalInterfaceId assigns uint32 provided by user to BgpSrteSegmentGTypeSubTlv + SetLocalInterfaceId(value uint32) BgpSrteSegmentGTypeSubTlv + // HasLocalInterfaceId checks if LocalInterfaceId has been set in BgpSrteSegmentGTypeSubTlv + HasLocalInterfaceId() bool + // LocalIpv6NodeAddress returns string, set in BgpSrteSegmentGTypeSubTlv. + LocalIpv6NodeAddress() string + // SetLocalIpv6NodeAddress assigns string provided by user to BgpSrteSegmentGTypeSubTlv + SetLocalIpv6NodeAddress(value string) BgpSrteSegmentGTypeSubTlv + // RemoteInterfaceId returns uint32, set in BgpSrteSegmentGTypeSubTlv. + RemoteInterfaceId() uint32 + // SetRemoteInterfaceId assigns uint32 provided by user to BgpSrteSegmentGTypeSubTlv + SetRemoteInterfaceId(value uint32) BgpSrteSegmentGTypeSubTlv + // HasRemoteInterfaceId checks if RemoteInterfaceId has been set in BgpSrteSegmentGTypeSubTlv + HasRemoteInterfaceId() bool + // RemoteIpv6NodeAddress returns string, set in BgpSrteSegmentGTypeSubTlv. + RemoteIpv6NodeAddress() string + // SetRemoteIpv6NodeAddress assigns string provided by user to BgpSrteSegmentGTypeSubTlv + SetRemoteIpv6NodeAddress(value string) BgpSrteSegmentGTypeSubTlv + // SrMplsSid returns BgpSrteSrMplsSid, set in BgpSrteSegmentGTypeSubTlv. + // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. + SrMplsSid() BgpSrteSrMplsSid + // SetSrMplsSid assigns BgpSrteSrMplsSid provided by user to BgpSrteSegmentGTypeSubTlv. + // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. + SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentGTypeSubTlv + // HasSrMplsSid checks if SrMplsSid has been set in BgpSrteSegmentGTypeSubTlv + HasSrMplsSid() bool + setNil() +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentGTypeSubTlv) Flags() string { + + return *obj.obj.Flags + +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentGTypeSubTlv) HasFlags() bool { + return obj.obj.Flags != nil +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// SetFlags sets the string value in the BgpSrteSegmentGTypeSubTlv object +func (obj *bgpSrteSegmentGTypeSubTlv) SetFlags(value string) BgpSrteSegmentGTypeSubTlv { + + obj.obj.Flags = &value + return obj +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// LocalInterfaceId returns a uint32 +func (obj *bgpSrteSegmentGTypeSubTlv) LocalInterfaceId() uint32 { + + return *obj.obj.LocalInterfaceId + +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// LocalInterfaceId returns a uint32 +func (obj *bgpSrteSegmentGTypeSubTlv) HasLocalInterfaceId() bool { + return obj.obj.LocalInterfaceId != nil +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// SetLocalInterfaceId sets the uint32 value in the BgpSrteSegmentGTypeSubTlv object +func (obj *bgpSrteSegmentGTypeSubTlv) SetLocalInterfaceId(value uint32) BgpSrteSegmentGTypeSubTlv { + + obj.obj.LocalInterfaceId = &value + return obj +} + +// IPv6 address representing a node. +// LocalIpv6NodeAddress returns a string +func (obj *bgpSrteSegmentGTypeSubTlv) LocalIpv6NodeAddress() string { + + return *obj.obj.LocalIpv6NodeAddress + +} + +// IPv6 address representing a node. +// SetLocalIpv6NodeAddress sets the string value in the BgpSrteSegmentGTypeSubTlv object +func (obj *bgpSrteSegmentGTypeSubTlv) SetLocalIpv6NodeAddress(value string) BgpSrteSegmentGTypeSubTlv { + + obj.obj.LocalIpv6NodeAddress = &value + return obj +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// RemoteInterfaceId returns a uint32 +func (obj *bgpSrteSegmentGTypeSubTlv) RemoteInterfaceId() uint32 { + + return *obj.obj.RemoteInterfaceId + +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// RemoteInterfaceId returns a uint32 +func (obj *bgpSrteSegmentGTypeSubTlv) HasRemoteInterfaceId() bool { + return obj.obj.RemoteInterfaceId != nil +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// SetRemoteInterfaceId sets the uint32 value in the BgpSrteSegmentGTypeSubTlv object +func (obj *bgpSrteSegmentGTypeSubTlv) SetRemoteInterfaceId(value uint32) BgpSrteSegmentGTypeSubTlv { + + obj.obj.RemoteInterfaceId = &value + return obj +} + +// IPv6 address representing a node. +// RemoteIpv6NodeAddress returns a string +func (obj *bgpSrteSegmentGTypeSubTlv) RemoteIpv6NodeAddress() string { + + return *obj.obj.RemoteIpv6NodeAddress + +} + +// IPv6 address representing a node. +// SetRemoteIpv6NodeAddress sets the string value in the BgpSrteSegmentGTypeSubTlv object +func (obj *bgpSrteSegmentGTypeSubTlv) SetRemoteIpv6NodeAddress(value string) BgpSrteSegmentGTypeSubTlv { + + obj.obj.RemoteIpv6NodeAddress = &value + return obj +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpSrteSrMplsSid +func (obj *bgpSrteSegmentGTypeSubTlv) SrMplsSid() BgpSrteSrMplsSid { + if obj.obj.SrMplsSid == nil { + obj.obj.SrMplsSid = NewBgpSrteSrMplsSid().msg() + } + if obj.srMplsSidHolder == nil { + obj.srMplsSidHolder = &bgpSrteSrMplsSid{obj: obj.obj.SrMplsSid} + } + return obj.srMplsSidHolder +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpSrteSrMplsSid +func (obj *bgpSrteSegmentGTypeSubTlv) HasSrMplsSid() bool { + return obj.obj.SrMplsSid != nil +} + +// Optional SR-MPLS SID. +// SetSrMplsSid sets the BgpSrteSrMplsSid value in the BgpSrteSegmentGTypeSubTlv object +func (obj *bgpSrteSegmentGTypeSubTlv) SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentGTypeSubTlv { + + obj.srMplsSidHolder = nil + obj.obj.SrMplsSid = value.msg() + + return obj +} + +func (obj *bgpSrteSegmentGTypeSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + err := obj.validateHex(obj.Flags()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentGTypeSubTlv.Flags")) + } + + } + + // LocalIpv6NodeAddress is required + if obj.obj.LocalIpv6NodeAddress == nil { + vObj.validationErrors = append(vObj.validationErrors, "LocalIpv6NodeAddress is required field on interface BgpSrteSegmentGTypeSubTlv") + } + if obj.obj.LocalIpv6NodeAddress != nil { + + err := obj.validateIpv6(obj.LocalIpv6NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentGTypeSubTlv.LocalIpv6NodeAddress")) + } + + } + + // RemoteIpv6NodeAddress is required + if obj.obj.RemoteIpv6NodeAddress == nil { + vObj.validationErrors = append(vObj.validationErrors, "RemoteIpv6NodeAddress is required field on interface BgpSrteSegmentGTypeSubTlv") + } + if obj.obj.RemoteIpv6NodeAddress != nil { + + err := obj.validateIpv6(obj.RemoteIpv6NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentGTypeSubTlv.RemoteIpv6NodeAddress")) + } + + } + + if obj.obj.SrMplsSid != nil { + + obj.SrMplsSid().validateObj(vObj, set_default) + } + +} + +func (obj *bgpSrteSegmentGTypeSubTlv) setDefault() { + if obj.obj.LocalInterfaceId == nil { + obj.SetLocalInterfaceId(0) + } + if obj.obj.RemoteInterfaceId == nil { + obj.SetRemoteInterfaceId(0) + } + +} diff --git a/gosnappi/bgp_srte_segment_h_type_sub_tlv.go b/gosnappi/bgp_srte_segment_h_type_sub_tlv.go new file mode 100644 index 00000000..1e5b6c1a --- /dev/null +++ b/gosnappi/bgp_srte_segment_h_type_sub_tlv.go @@ -0,0 +1,431 @@ +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" +) + +// ***** BgpSrteSegmentHTypeSubTlv ***** +type bgpSrteSegmentHTypeSubTlv struct { + validation + obj *otg.BgpSrteSegmentHTypeSubTlv + marshaller marshalBgpSrteSegmentHTypeSubTlv + unMarshaller unMarshalBgpSrteSegmentHTypeSubTlv + srMplsSidHolder BgpSrteSrMplsSid +} + +func NewBgpSrteSegmentHTypeSubTlv() BgpSrteSegmentHTypeSubTlv { + obj := bgpSrteSegmentHTypeSubTlv{obj: &otg.BgpSrteSegmentHTypeSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSegmentHTypeSubTlv) msg() *otg.BgpSrteSegmentHTypeSubTlv { + return obj.obj +} + +func (obj *bgpSrteSegmentHTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentHTypeSubTlv) BgpSrteSegmentHTypeSubTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSegmentHTypeSubTlv struct { + obj *bgpSrteSegmentHTypeSubTlv +} + +type marshalBgpSrteSegmentHTypeSubTlv interface { + // ToProto marshals BgpSrteSegmentHTypeSubTlv to protobuf object *otg.BgpSrteSegmentHTypeSubTlv + ToProto() (*otg.BgpSrteSegmentHTypeSubTlv, error) + // ToPbText marshals BgpSrteSegmentHTypeSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSegmentHTypeSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSegmentHTypeSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSegmentHTypeSubTlv struct { + obj *bgpSrteSegmentHTypeSubTlv +} + +type unMarshalBgpSrteSegmentHTypeSubTlv interface { + // FromProto unmarshals BgpSrteSegmentHTypeSubTlv from protobuf object *otg.BgpSrteSegmentHTypeSubTlv + FromProto(msg *otg.BgpSrteSegmentHTypeSubTlv) (BgpSrteSegmentHTypeSubTlv, error) + // FromPbText unmarshals BgpSrteSegmentHTypeSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSegmentHTypeSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSegmentHTypeSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSegmentHTypeSubTlv) Marshal() marshalBgpSrteSegmentHTypeSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSegmentHTypeSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSegmentHTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentHTypeSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSegmentHTypeSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSegmentHTypeSubTlv) ToProto() (*otg.BgpSrteSegmentHTypeSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSegmentHTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentHTypeSubTlv) (BgpSrteSegmentHTypeSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSegmentHTypeSubTlv) 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 *unMarshalbgpSrteSegmentHTypeSubTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteSegmentHTypeSubTlv) 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 *unMarshalbgpSrteSegmentHTypeSubTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteSegmentHTypeSubTlv) 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 *unMarshalbgpSrteSegmentHTypeSubTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteSegmentHTypeSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentHTypeSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentHTypeSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSegmentHTypeSubTlv) Clone() (BgpSrteSegmentHTypeSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSegmentHTypeSubTlv() + 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 +} + +func (obj *bgpSrteSegmentHTypeSubTlv) setNil() { + obj.srMplsSidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteSegmentHTypeSubTlv is type H: IPv6 Local and Remote addresses with optional SID for SR MPLS. +type BgpSrteSegmentHTypeSubTlv interface { + Validation + // msg marshals BgpSrteSegmentHTypeSubTlv to protobuf object *otg.BgpSrteSegmentHTypeSubTlv + // and doesn't set defaults + msg() *otg.BgpSrteSegmentHTypeSubTlv + // setMsg unmarshals BgpSrteSegmentHTypeSubTlv from protobuf object *otg.BgpSrteSegmentHTypeSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteSegmentHTypeSubTlv) BgpSrteSegmentHTypeSubTlv + // provides marshal interface + Marshal() marshalBgpSrteSegmentHTypeSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSegmentHTypeSubTlv + // validate validates BgpSrteSegmentHTypeSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSegmentHTypeSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns string, set in BgpSrteSegmentHTypeSubTlv. + Flags() string + // SetFlags assigns string provided by user to BgpSrteSegmentHTypeSubTlv + SetFlags(value string) BgpSrteSegmentHTypeSubTlv + // HasFlags checks if Flags has been set in BgpSrteSegmentHTypeSubTlv + HasFlags() bool + // LocalIpv6Address returns string, set in BgpSrteSegmentHTypeSubTlv. + LocalIpv6Address() string + // SetLocalIpv6Address assigns string provided by user to BgpSrteSegmentHTypeSubTlv + SetLocalIpv6Address(value string) BgpSrteSegmentHTypeSubTlv + // RemoteIpv6Address returns string, set in BgpSrteSegmentHTypeSubTlv. + RemoteIpv6Address() string + // SetRemoteIpv6Address assigns string provided by user to BgpSrteSegmentHTypeSubTlv + SetRemoteIpv6Address(value string) BgpSrteSegmentHTypeSubTlv + // SrMplsSid returns BgpSrteSrMplsSid, set in BgpSrteSegmentHTypeSubTlv. + // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. + SrMplsSid() BgpSrteSrMplsSid + // SetSrMplsSid assigns BgpSrteSrMplsSid provided by user to BgpSrteSegmentHTypeSubTlv. + // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. + SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentHTypeSubTlv + // HasSrMplsSid checks if SrMplsSid has been set in BgpSrteSegmentHTypeSubTlv + HasSrMplsSid() bool + setNil() +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentHTypeSubTlv) Flags() string { + + return *obj.obj.Flags + +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentHTypeSubTlv) HasFlags() bool { + return obj.obj.Flags != nil +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// SetFlags sets the string value in the BgpSrteSegmentHTypeSubTlv object +func (obj *bgpSrteSegmentHTypeSubTlv) SetFlags(value string) BgpSrteSegmentHTypeSubTlv { + + obj.obj.Flags = &value + return obj +} + +// Local IPv6 Address. +// LocalIpv6Address returns a string +func (obj *bgpSrteSegmentHTypeSubTlv) LocalIpv6Address() string { + + return *obj.obj.LocalIpv6Address + +} + +// Local IPv6 Address. +// SetLocalIpv6Address sets the string value in the BgpSrteSegmentHTypeSubTlv object +func (obj *bgpSrteSegmentHTypeSubTlv) SetLocalIpv6Address(value string) BgpSrteSegmentHTypeSubTlv { + + obj.obj.LocalIpv6Address = &value + return obj +} + +// Remote IPv6 Address. +// RemoteIpv6Address returns a string +func (obj *bgpSrteSegmentHTypeSubTlv) RemoteIpv6Address() string { + + return *obj.obj.RemoteIpv6Address + +} + +// Remote IPv6 Address. +// SetRemoteIpv6Address sets the string value in the BgpSrteSegmentHTypeSubTlv object +func (obj *bgpSrteSegmentHTypeSubTlv) SetRemoteIpv6Address(value string) BgpSrteSegmentHTypeSubTlv { + + obj.obj.RemoteIpv6Address = &value + return obj +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpSrteSrMplsSid +func (obj *bgpSrteSegmentHTypeSubTlv) SrMplsSid() BgpSrteSrMplsSid { + if obj.obj.SrMplsSid == nil { + obj.obj.SrMplsSid = NewBgpSrteSrMplsSid().msg() + } + if obj.srMplsSidHolder == nil { + obj.srMplsSidHolder = &bgpSrteSrMplsSid{obj: obj.obj.SrMplsSid} + } + return obj.srMplsSidHolder +} + +// Optional SR-MPLS SID. +// SrMplsSid returns a BgpSrteSrMplsSid +func (obj *bgpSrteSegmentHTypeSubTlv) HasSrMplsSid() bool { + return obj.obj.SrMplsSid != nil +} + +// Optional SR-MPLS SID. +// SetSrMplsSid sets the BgpSrteSrMplsSid value in the BgpSrteSegmentHTypeSubTlv object +func (obj *bgpSrteSegmentHTypeSubTlv) SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentHTypeSubTlv { + + obj.srMplsSidHolder = nil + obj.obj.SrMplsSid = value.msg() + + return obj +} + +func (obj *bgpSrteSegmentHTypeSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + err := obj.validateHex(obj.Flags()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentHTypeSubTlv.Flags")) + } + + } + + // LocalIpv6Address is required + if obj.obj.LocalIpv6Address == nil { + vObj.validationErrors = append(vObj.validationErrors, "LocalIpv6Address is required field on interface BgpSrteSegmentHTypeSubTlv") + } + if obj.obj.LocalIpv6Address != nil { + + err := obj.validateIpv6(obj.LocalIpv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentHTypeSubTlv.LocalIpv6Address")) + } + + } + + // RemoteIpv6Address is required + if obj.obj.RemoteIpv6Address == nil { + vObj.validationErrors = append(vObj.validationErrors, "RemoteIpv6Address is required field on interface BgpSrteSegmentHTypeSubTlv") + } + if obj.obj.RemoteIpv6Address != nil { + + err := obj.validateIpv6(obj.RemoteIpv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentHTypeSubTlv.RemoteIpv6Address")) + } + + } + + if obj.obj.SrMplsSid != nil { + + obj.SrMplsSid().validateObj(vObj, set_default) + } + +} + +func (obj *bgpSrteSegmentHTypeSubTlv) setDefault() { + +} diff --git a/gosnappi/bgp_srte_segment_i_type_sub_tlv.go b/gosnappi/bgp_srte_segment_i_type_sub_tlv.go new file mode 100644 index 00000000..31458235 --- /dev/null +++ b/gosnappi/bgp_srte_segment_i_type_sub_tlv.go @@ -0,0 +1,435 @@ +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" +) + +// ***** BgpSrteSegmentITypeSubTlv ***** +type bgpSrteSegmentITypeSubTlv struct { + validation + obj *otg.BgpSrteSegmentITypeSubTlv + marshaller marshalBgpSrteSegmentITypeSubTlv + unMarshaller unMarshalBgpSrteSegmentITypeSubTlv + srv6SidEndpointBehaviorHolder BgpSrteSRv6SIDEndpointBehaviorAndStructure +} + +func NewBgpSrteSegmentITypeSubTlv() BgpSrteSegmentITypeSubTlv { + obj := bgpSrteSegmentITypeSubTlv{obj: &otg.BgpSrteSegmentITypeSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSegmentITypeSubTlv) msg() *otg.BgpSrteSegmentITypeSubTlv { + return obj.obj +} + +func (obj *bgpSrteSegmentITypeSubTlv) setMsg(msg *otg.BgpSrteSegmentITypeSubTlv) BgpSrteSegmentITypeSubTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSegmentITypeSubTlv struct { + obj *bgpSrteSegmentITypeSubTlv +} + +type marshalBgpSrteSegmentITypeSubTlv interface { + // ToProto marshals BgpSrteSegmentITypeSubTlv to protobuf object *otg.BgpSrteSegmentITypeSubTlv + ToProto() (*otg.BgpSrteSegmentITypeSubTlv, error) + // ToPbText marshals BgpSrteSegmentITypeSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSegmentITypeSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSegmentITypeSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSegmentITypeSubTlv struct { + obj *bgpSrteSegmentITypeSubTlv +} + +type unMarshalBgpSrteSegmentITypeSubTlv interface { + // FromProto unmarshals BgpSrteSegmentITypeSubTlv from protobuf object *otg.BgpSrteSegmentITypeSubTlv + FromProto(msg *otg.BgpSrteSegmentITypeSubTlv) (BgpSrteSegmentITypeSubTlv, error) + // FromPbText unmarshals BgpSrteSegmentITypeSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSegmentITypeSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSegmentITypeSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSegmentITypeSubTlv) Marshal() marshalBgpSrteSegmentITypeSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSegmentITypeSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSegmentITypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentITypeSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSegmentITypeSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSegmentITypeSubTlv) ToProto() (*otg.BgpSrteSegmentITypeSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSegmentITypeSubTlv) FromProto(msg *otg.BgpSrteSegmentITypeSubTlv) (BgpSrteSegmentITypeSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSegmentITypeSubTlv) 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 *unMarshalbgpSrteSegmentITypeSubTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteSegmentITypeSubTlv) 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 *unMarshalbgpSrteSegmentITypeSubTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteSegmentITypeSubTlv) 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 *unMarshalbgpSrteSegmentITypeSubTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteSegmentITypeSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentITypeSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentITypeSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSegmentITypeSubTlv) Clone() (BgpSrteSegmentITypeSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSegmentITypeSubTlv() + 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 +} + +func (obj *bgpSrteSegmentITypeSubTlv) setNil() { + obj.srv6SidEndpointBehaviorHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteSegmentITypeSubTlv is type I: IPv6 Node Address with optional SRv6 SID. +type BgpSrteSegmentITypeSubTlv interface { + Validation + // msg marshals BgpSrteSegmentITypeSubTlv to protobuf object *otg.BgpSrteSegmentITypeSubTlv + // and doesn't set defaults + msg() *otg.BgpSrteSegmentITypeSubTlv + // setMsg unmarshals BgpSrteSegmentITypeSubTlv from protobuf object *otg.BgpSrteSegmentITypeSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteSegmentITypeSubTlv) BgpSrteSegmentITypeSubTlv + // provides marshal interface + Marshal() marshalBgpSrteSegmentITypeSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSegmentITypeSubTlv + // validate validates BgpSrteSegmentITypeSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSegmentITypeSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns string, set in BgpSrteSegmentITypeSubTlv. + Flags() string + // SetFlags assigns string provided by user to BgpSrteSegmentITypeSubTlv + SetFlags(value string) BgpSrteSegmentITypeSubTlv + // HasFlags checks if Flags has been set in BgpSrteSegmentITypeSubTlv + HasFlags() bool + // Ipv6NodeAddress returns string, set in BgpSrteSegmentITypeSubTlv. + Ipv6NodeAddress() string + // SetIpv6NodeAddress assigns string provided by user to BgpSrteSegmentITypeSubTlv + SetIpv6NodeAddress(value string) BgpSrteSegmentITypeSubTlv + // Srv6Sid returns string, set in BgpSrteSegmentITypeSubTlv. + Srv6Sid() string + // SetSrv6Sid assigns string provided by user to BgpSrteSegmentITypeSubTlv + SetSrv6Sid(value string) BgpSrteSegmentITypeSubTlv + // HasSrv6Sid checks if Srv6Sid has been set in BgpSrteSegmentITypeSubTlv + HasSrv6Sid() bool + // Srv6SidEndpointBehavior returns BgpSrteSRv6SIDEndpointBehaviorAndStructure, set in BgpSrteSegmentITypeSubTlv. + // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. + Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure + // SetSrv6SidEndpointBehavior assigns BgpSrteSRv6SIDEndpointBehaviorAndStructure provided by user to BgpSrteSegmentITypeSubTlv. + // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. + SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentITypeSubTlv + // HasSrv6SidEndpointBehavior checks if Srv6SidEndpointBehavior has been set in BgpSrteSegmentITypeSubTlv + HasSrv6SidEndpointBehavior() bool + setNil() +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentITypeSubTlv) Flags() string { + + return *obj.obj.Flags + +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentITypeSubTlv) HasFlags() bool { + return obj.obj.Flags != nil +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// SetFlags sets the string value in the BgpSrteSegmentITypeSubTlv object +func (obj *bgpSrteSegmentITypeSubTlv) SetFlags(value string) BgpSrteSegmentITypeSubTlv { + + obj.obj.Flags = &value + return obj +} + +// IPv6 address representing a node. +// Ipv6NodeAddress returns a string +func (obj *bgpSrteSegmentITypeSubTlv) Ipv6NodeAddress() string { + + return *obj.obj.Ipv6NodeAddress + +} + +// IPv6 address representing a node. +// SetIpv6NodeAddress sets the string value in the BgpSrteSegmentITypeSubTlv object +func (obj *bgpSrteSegmentITypeSubTlv) SetIpv6NodeAddress(value string) BgpSrteSegmentITypeSubTlv { + + obj.obj.Ipv6NodeAddress = &value + return obj +} + +// Optional SRv6 SID. +// Srv6Sid returns a string +func (obj *bgpSrteSegmentITypeSubTlv) Srv6Sid() string { + + return *obj.obj.Srv6Sid + +} + +// Optional SRv6 SID. +// Srv6Sid returns a string +func (obj *bgpSrteSegmentITypeSubTlv) HasSrv6Sid() bool { + return obj.obj.Srv6Sid != nil +} + +// Optional SRv6 SID. +// SetSrv6Sid sets the string value in the BgpSrteSegmentITypeSubTlv object +func (obj *bgpSrteSegmentITypeSubTlv) SetSrv6Sid(value string) BgpSrteSegmentITypeSubTlv { + + obj.obj.Srv6Sid = &value + return obj +} + +// Optional SRv6 Endpoint Behavior and SID Structure. +// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure +func (obj *bgpSrteSegmentITypeSubTlv) Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure { + if obj.obj.Srv6SidEndpointBehavior == nil { + obj.obj.Srv6SidEndpointBehavior = NewBgpSrteSRv6SIDEndpointBehaviorAndStructure().msg() + } + if obj.srv6SidEndpointBehaviorHolder == nil { + obj.srv6SidEndpointBehaviorHolder = &bgpSrteSRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6SidEndpointBehavior} + } + return obj.srv6SidEndpointBehaviorHolder +} + +// Optional SRv6 Endpoint Behavior and SID Structure. +// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure +func (obj *bgpSrteSegmentITypeSubTlv) HasSrv6SidEndpointBehavior() bool { + return obj.obj.Srv6SidEndpointBehavior != nil +} + +// Optional SRv6 Endpoint Behavior and SID Structure. +// SetSrv6SidEndpointBehavior sets the BgpSrteSRv6SIDEndpointBehaviorAndStructure value in the BgpSrteSegmentITypeSubTlv object +func (obj *bgpSrteSegmentITypeSubTlv) SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentITypeSubTlv { + + obj.srv6SidEndpointBehaviorHolder = nil + obj.obj.Srv6SidEndpointBehavior = value.msg() + + return obj +} + +func (obj *bgpSrteSegmentITypeSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + err := obj.validateHex(obj.Flags()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentITypeSubTlv.Flags")) + } + + } + + // Ipv6NodeAddress is required + if obj.obj.Ipv6NodeAddress == nil { + vObj.validationErrors = append(vObj.validationErrors, "Ipv6NodeAddress is required field on interface BgpSrteSegmentITypeSubTlv") + } + if obj.obj.Ipv6NodeAddress != nil { + + err := obj.validateIpv6(obj.Ipv6NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentITypeSubTlv.Ipv6NodeAddress")) + } + + } + + if obj.obj.Srv6Sid != nil { + + err := obj.validateIpv6(obj.Srv6Sid()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentITypeSubTlv.Srv6Sid")) + } + + } + + if obj.obj.Srv6SidEndpointBehavior != nil { + + obj.Srv6SidEndpointBehavior().validateObj(vObj, set_default) + } + +} + +func (obj *bgpSrteSegmentITypeSubTlv) setDefault() { + +} diff --git a/gosnappi/bgp_srte_segment_j_type_sub_tlv.go b/gosnappi/bgp_srte_segment_j_type_sub_tlv.go new file mode 100644 index 00000000..9b35966b --- /dev/null +++ b/gosnappi/bgp_srte_segment_j_type_sub_tlv.go @@ -0,0 +1,561 @@ +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" +) + +// ***** BgpSrteSegmentJTypeSubTlv ***** +type bgpSrteSegmentJTypeSubTlv struct { + validation + obj *otg.BgpSrteSegmentJTypeSubTlv + marshaller marshalBgpSrteSegmentJTypeSubTlv + unMarshaller unMarshalBgpSrteSegmentJTypeSubTlv + srv6SidEndpointBehaviorHolder BgpSrteSRv6SIDEndpointBehaviorAndStructure +} + +func NewBgpSrteSegmentJTypeSubTlv() BgpSrteSegmentJTypeSubTlv { + obj := bgpSrteSegmentJTypeSubTlv{obj: &otg.BgpSrteSegmentJTypeSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSegmentJTypeSubTlv) msg() *otg.BgpSrteSegmentJTypeSubTlv { + return obj.obj +} + +func (obj *bgpSrteSegmentJTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentJTypeSubTlv) BgpSrteSegmentJTypeSubTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSegmentJTypeSubTlv struct { + obj *bgpSrteSegmentJTypeSubTlv +} + +type marshalBgpSrteSegmentJTypeSubTlv interface { + // ToProto marshals BgpSrteSegmentJTypeSubTlv to protobuf object *otg.BgpSrteSegmentJTypeSubTlv + ToProto() (*otg.BgpSrteSegmentJTypeSubTlv, error) + // ToPbText marshals BgpSrteSegmentJTypeSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSegmentJTypeSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSegmentJTypeSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSegmentJTypeSubTlv struct { + obj *bgpSrteSegmentJTypeSubTlv +} + +type unMarshalBgpSrteSegmentJTypeSubTlv interface { + // FromProto unmarshals BgpSrteSegmentJTypeSubTlv from protobuf object *otg.BgpSrteSegmentJTypeSubTlv + FromProto(msg *otg.BgpSrteSegmentJTypeSubTlv) (BgpSrteSegmentJTypeSubTlv, error) + // FromPbText unmarshals BgpSrteSegmentJTypeSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSegmentJTypeSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSegmentJTypeSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSegmentJTypeSubTlv) Marshal() marshalBgpSrteSegmentJTypeSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSegmentJTypeSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSegmentJTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentJTypeSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSegmentJTypeSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSegmentJTypeSubTlv) ToProto() (*otg.BgpSrteSegmentJTypeSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSegmentJTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentJTypeSubTlv) (BgpSrteSegmentJTypeSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSegmentJTypeSubTlv) 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 *unMarshalbgpSrteSegmentJTypeSubTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteSegmentJTypeSubTlv) 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 *unMarshalbgpSrteSegmentJTypeSubTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteSegmentJTypeSubTlv) 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 *unMarshalbgpSrteSegmentJTypeSubTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteSegmentJTypeSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentJTypeSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentJTypeSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSegmentJTypeSubTlv) Clone() (BgpSrteSegmentJTypeSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSegmentJTypeSubTlv() + 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 +} + +func (obj *bgpSrteSegmentJTypeSubTlv) setNil() { + obj.srv6SidEndpointBehaviorHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteSegmentJTypeSubTlv is type J: IPv6 Address, Interface ID for local and remote pair for SRv6 with optional SID. +type BgpSrteSegmentJTypeSubTlv interface { + Validation + // msg marshals BgpSrteSegmentJTypeSubTlv to protobuf object *otg.BgpSrteSegmentJTypeSubTlv + // and doesn't set defaults + msg() *otg.BgpSrteSegmentJTypeSubTlv + // setMsg unmarshals BgpSrteSegmentJTypeSubTlv from protobuf object *otg.BgpSrteSegmentJTypeSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteSegmentJTypeSubTlv) BgpSrteSegmentJTypeSubTlv + // provides marshal interface + Marshal() marshalBgpSrteSegmentJTypeSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSegmentJTypeSubTlv + // validate validates BgpSrteSegmentJTypeSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSegmentJTypeSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns string, set in BgpSrteSegmentJTypeSubTlv. + Flags() string + // SetFlags assigns string provided by user to BgpSrteSegmentJTypeSubTlv + SetFlags(value string) BgpSrteSegmentJTypeSubTlv + // HasFlags checks if Flags has been set in BgpSrteSegmentJTypeSubTlv + HasFlags() bool + // SrAlgorithm returns uint32, set in BgpSrteSegmentJTypeSubTlv. + SrAlgorithm() uint32 + // SetSrAlgorithm assigns uint32 provided by user to BgpSrteSegmentJTypeSubTlv + SetSrAlgorithm(value uint32) BgpSrteSegmentJTypeSubTlv + // HasSrAlgorithm checks if SrAlgorithm has been set in BgpSrteSegmentJTypeSubTlv + HasSrAlgorithm() bool + // LocalInterfaceId returns uint32, set in BgpSrteSegmentJTypeSubTlv. + LocalInterfaceId() uint32 + // SetLocalInterfaceId assigns uint32 provided by user to BgpSrteSegmentJTypeSubTlv + SetLocalInterfaceId(value uint32) BgpSrteSegmentJTypeSubTlv + // HasLocalInterfaceId checks if LocalInterfaceId has been set in BgpSrteSegmentJTypeSubTlv + HasLocalInterfaceId() bool + // LocalIpv6NodeAddress returns string, set in BgpSrteSegmentJTypeSubTlv. + LocalIpv6NodeAddress() string + // SetLocalIpv6NodeAddress assigns string provided by user to BgpSrteSegmentJTypeSubTlv + SetLocalIpv6NodeAddress(value string) BgpSrteSegmentJTypeSubTlv + // RemoteInterfaceId returns uint32, set in BgpSrteSegmentJTypeSubTlv. + RemoteInterfaceId() uint32 + // SetRemoteInterfaceId assigns uint32 provided by user to BgpSrteSegmentJTypeSubTlv + SetRemoteInterfaceId(value uint32) BgpSrteSegmentJTypeSubTlv + // HasRemoteInterfaceId checks if RemoteInterfaceId has been set in BgpSrteSegmentJTypeSubTlv + HasRemoteInterfaceId() bool + // RemoteIpv6NodeAddress returns string, set in BgpSrteSegmentJTypeSubTlv. + RemoteIpv6NodeAddress() string + // SetRemoteIpv6NodeAddress assigns string provided by user to BgpSrteSegmentJTypeSubTlv + SetRemoteIpv6NodeAddress(value string) BgpSrteSegmentJTypeSubTlv + // Srv6Sid returns string, set in BgpSrteSegmentJTypeSubTlv. + Srv6Sid() string + // SetSrv6Sid assigns string provided by user to BgpSrteSegmentJTypeSubTlv + SetSrv6Sid(value string) BgpSrteSegmentJTypeSubTlv + // HasSrv6Sid checks if Srv6Sid has been set in BgpSrteSegmentJTypeSubTlv + HasSrv6Sid() bool + // Srv6SidEndpointBehavior returns BgpSrteSRv6SIDEndpointBehaviorAndStructure, set in BgpSrteSegmentJTypeSubTlv. + // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. + Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure + // SetSrv6SidEndpointBehavior assigns BgpSrteSRv6SIDEndpointBehaviorAndStructure provided by user to BgpSrteSegmentJTypeSubTlv. + // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. + SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentJTypeSubTlv + // HasSrv6SidEndpointBehavior checks if Srv6SidEndpointBehavior has been set in BgpSrteSegmentJTypeSubTlv + HasSrv6SidEndpointBehavior() bool + setNil() +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentJTypeSubTlv) Flags() string { + + return *obj.obj.Flags + +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentJTypeSubTlv) HasFlags() bool { + return obj.obj.Flags != nil +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// SetFlags sets the string value in the BgpSrteSegmentJTypeSubTlv object +func (obj *bgpSrteSegmentJTypeSubTlv) SetFlags(value string) BgpSrteSegmentJTypeSubTlv { + + obj.obj.Flags = &value + return obj +} + +// SR Algorithm identifier when A-Flag in on. +// SrAlgorithm returns a uint32 +func (obj *bgpSrteSegmentJTypeSubTlv) SrAlgorithm() uint32 { + + return *obj.obj.SrAlgorithm + +} + +// SR Algorithm identifier when A-Flag in on. +// SrAlgorithm returns a uint32 +func (obj *bgpSrteSegmentJTypeSubTlv) HasSrAlgorithm() bool { + return obj.obj.SrAlgorithm != nil +} + +// SR Algorithm identifier when A-Flag in on. +// SetSrAlgorithm sets the uint32 value in the BgpSrteSegmentJTypeSubTlv object +func (obj *bgpSrteSegmentJTypeSubTlv) SetSrAlgorithm(value uint32) BgpSrteSegmentJTypeSubTlv { + + obj.obj.SrAlgorithm = &value + return obj +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// LocalInterfaceId returns a uint32 +func (obj *bgpSrteSegmentJTypeSubTlv) LocalInterfaceId() uint32 { + + return *obj.obj.LocalInterfaceId + +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// LocalInterfaceId returns a uint32 +func (obj *bgpSrteSegmentJTypeSubTlv) HasLocalInterfaceId() bool { + return obj.obj.LocalInterfaceId != nil +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// SetLocalInterfaceId sets the uint32 value in the BgpSrteSegmentJTypeSubTlv object +func (obj *bgpSrteSegmentJTypeSubTlv) SetLocalInterfaceId(value uint32) BgpSrteSegmentJTypeSubTlv { + + obj.obj.LocalInterfaceId = &value + return obj +} + +// IPv6 address representing a node. +// LocalIpv6NodeAddress returns a string +func (obj *bgpSrteSegmentJTypeSubTlv) LocalIpv6NodeAddress() string { + + return *obj.obj.LocalIpv6NodeAddress + +} + +// IPv6 address representing a node. +// SetLocalIpv6NodeAddress sets the string value in the BgpSrteSegmentJTypeSubTlv object +func (obj *bgpSrteSegmentJTypeSubTlv) SetLocalIpv6NodeAddress(value string) BgpSrteSegmentJTypeSubTlv { + + obj.obj.LocalIpv6NodeAddress = &value + return obj +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// RemoteInterfaceId returns a uint32 +func (obj *bgpSrteSegmentJTypeSubTlv) RemoteInterfaceId() uint32 { + + return *obj.obj.RemoteInterfaceId + +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// RemoteInterfaceId returns a uint32 +func (obj *bgpSrteSegmentJTypeSubTlv) HasRemoteInterfaceId() bool { + return obj.obj.RemoteInterfaceId != nil +} + +// Local Interface ID: The Interface Index as defined in [RFC8664]. +// SetRemoteInterfaceId sets the uint32 value in the BgpSrteSegmentJTypeSubTlv object +func (obj *bgpSrteSegmentJTypeSubTlv) SetRemoteInterfaceId(value uint32) BgpSrteSegmentJTypeSubTlv { + + obj.obj.RemoteInterfaceId = &value + return obj +} + +// IPv6 address representing a node. +// RemoteIpv6NodeAddress returns a string +func (obj *bgpSrteSegmentJTypeSubTlv) RemoteIpv6NodeAddress() string { + + return *obj.obj.RemoteIpv6NodeAddress + +} + +// IPv6 address representing a node. +// SetRemoteIpv6NodeAddress sets the string value in the BgpSrteSegmentJTypeSubTlv object +func (obj *bgpSrteSegmentJTypeSubTlv) SetRemoteIpv6NodeAddress(value string) BgpSrteSegmentJTypeSubTlv { + + obj.obj.RemoteIpv6NodeAddress = &value + return obj +} + +// Optional SRv6 SID. +// Srv6Sid returns a string +func (obj *bgpSrteSegmentJTypeSubTlv) Srv6Sid() string { + + return *obj.obj.Srv6Sid + +} + +// Optional SRv6 SID. +// Srv6Sid returns a string +func (obj *bgpSrteSegmentJTypeSubTlv) HasSrv6Sid() bool { + return obj.obj.Srv6Sid != nil +} + +// Optional SRv6 SID. +// SetSrv6Sid sets the string value in the BgpSrteSegmentJTypeSubTlv object +func (obj *bgpSrteSegmentJTypeSubTlv) SetSrv6Sid(value string) BgpSrteSegmentJTypeSubTlv { + + obj.obj.Srv6Sid = &value + return obj +} + +// Optional SRv6 Endpoint Behavior and SID Structure. +// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure +func (obj *bgpSrteSegmentJTypeSubTlv) Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure { + if obj.obj.Srv6SidEndpointBehavior == nil { + obj.obj.Srv6SidEndpointBehavior = NewBgpSrteSRv6SIDEndpointBehaviorAndStructure().msg() + } + if obj.srv6SidEndpointBehaviorHolder == nil { + obj.srv6SidEndpointBehaviorHolder = &bgpSrteSRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6SidEndpointBehavior} + } + return obj.srv6SidEndpointBehaviorHolder +} + +// Optional SRv6 Endpoint Behavior and SID Structure. +// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure +func (obj *bgpSrteSegmentJTypeSubTlv) HasSrv6SidEndpointBehavior() bool { + return obj.obj.Srv6SidEndpointBehavior != nil +} + +// Optional SRv6 Endpoint Behavior and SID Structure. +// SetSrv6SidEndpointBehavior sets the BgpSrteSRv6SIDEndpointBehaviorAndStructure value in the BgpSrteSegmentJTypeSubTlv object +func (obj *bgpSrteSegmentJTypeSubTlv) SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentJTypeSubTlv { + + obj.srv6SidEndpointBehaviorHolder = nil + obj.obj.Srv6SidEndpointBehavior = value.msg() + + return obj +} + +func (obj *bgpSrteSegmentJTypeSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + err := obj.validateHex(obj.Flags()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentJTypeSubTlv.Flags")) + } + + } + + // LocalIpv6NodeAddress is required + if obj.obj.LocalIpv6NodeAddress == nil { + vObj.validationErrors = append(vObj.validationErrors, "LocalIpv6NodeAddress is required field on interface BgpSrteSegmentJTypeSubTlv") + } + if obj.obj.LocalIpv6NodeAddress != nil { + + err := obj.validateIpv6(obj.LocalIpv6NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentJTypeSubTlv.LocalIpv6NodeAddress")) + } + + } + + // RemoteIpv6NodeAddress is required + if obj.obj.RemoteIpv6NodeAddress == nil { + vObj.validationErrors = append(vObj.validationErrors, "RemoteIpv6NodeAddress is required field on interface BgpSrteSegmentJTypeSubTlv") + } + if obj.obj.RemoteIpv6NodeAddress != nil { + + err := obj.validateIpv6(obj.RemoteIpv6NodeAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentJTypeSubTlv.RemoteIpv6NodeAddress")) + } + + } + + if obj.obj.Srv6Sid != nil { + + err := obj.validateIpv6(obj.Srv6Sid()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentJTypeSubTlv.Srv6Sid")) + } + + } + + if obj.obj.Srv6SidEndpointBehavior != nil { + + obj.Srv6SidEndpointBehavior().validateObj(vObj, set_default) + } + +} + +func (obj *bgpSrteSegmentJTypeSubTlv) setDefault() { + if obj.obj.SrAlgorithm == nil { + obj.SetSrAlgorithm(0) + } + if obj.obj.LocalInterfaceId == nil { + obj.SetLocalInterfaceId(0) + } + if obj.obj.RemoteInterfaceId == nil { + obj.SetRemoteInterfaceId(0) + } + +} diff --git a/gosnappi/bgp_srte_segment_k_type_sub_tlv.go b/gosnappi/bgp_srte_segment_k_type_sub_tlv.go new file mode 100644 index 00000000..b59fb0b9 --- /dev/null +++ b/gosnappi/bgp_srte_segment_k_type_sub_tlv.go @@ -0,0 +1,499 @@ +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" +) + +// ***** BgpSrteSegmentKTypeSubTlv ***** +type bgpSrteSegmentKTypeSubTlv struct { + validation + obj *otg.BgpSrteSegmentKTypeSubTlv + marshaller marshalBgpSrteSegmentKTypeSubTlv + unMarshaller unMarshalBgpSrteSegmentKTypeSubTlv + srv6SidEndpointBehaviorHolder BgpSrteSRv6SIDEndpointBehaviorAndStructure +} + +func NewBgpSrteSegmentKTypeSubTlv() BgpSrteSegmentKTypeSubTlv { + obj := bgpSrteSegmentKTypeSubTlv{obj: &otg.BgpSrteSegmentKTypeSubTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSegmentKTypeSubTlv) msg() *otg.BgpSrteSegmentKTypeSubTlv { + return obj.obj +} + +func (obj *bgpSrteSegmentKTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentKTypeSubTlv) BgpSrteSegmentKTypeSubTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSegmentKTypeSubTlv struct { + obj *bgpSrteSegmentKTypeSubTlv +} + +type marshalBgpSrteSegmentKTypeSubTlv interface { + // ToProto marshals BgpSrteSegmentKTypeSubTlv to protobuf object *otg.BgpSrteSegmentKTypeSubTlv + ToProto() (*otg.BgpSrteSegmentKTypeSubTlv, error) + // ToPbText marshals BgpSrteSegmentKTypeSubTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSegmentKTypeSubTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSegmentKTypeSubTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSegmentKTypeSubTlv struct { + obj *bgpSrteSegmentKTypeSubTlv +} + +type unMarshalBgpSrteSegmentKTypeSubTlv interface { + // FromProto unmarshals BgpSrteSegmentKTypeSubTlv from protobuf object *otg.BgpSrteSegmentKTypeSubTlv + FromProto(msg *otg.BgpSrteSegmentKTypeSubTlv) (BgpSrteSegmentKTypeSubTlv, error) + // FromPbText unmarshals BgpSrteSegmentKTypeSubTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSegmentKTypeSubTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSegmentKTypeSubTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSegmentKTypeSubTlv) Marshal() marshalBgpSrteSegmentKTypeSubTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSegmentKTypeSubTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSegmentKTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentKTypeSubTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSegmentKTypeSubTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSegmentKTypeSubTlv) ToProto() (*otg.BgpSrteSegmentKTypeSubTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSegmentKTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentKTypeSubTlv) (BgpSrteSegmentKTypeSubTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSegmentKTypeSubTlv) 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 *unMarshalbgpSrteSegmentKTypeSubTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteSegmentKTypeSubTlv) 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 *unMarshalbgpSrteSegmentKTypeSubTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteSegmentKTypeSubTlv) 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 *unMarshalbgpSrteSegmentKTypeSubTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteSegmentKTypeSubTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentKTypeSubTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentKTypeSubTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSegmentKTypeSubTlv) Clone() (BgpSrteSegmentKTypeSubTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSegmentKTypeSubTlv() + 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 +} + +func (obj *bgpSrteSegmentKTypeSubTlv) setNil() { + obj.srv6SidEndpointBehaviorHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteSegmentKTypeSubTlv is type K: IPv6 Local and Remote addresses for SRv6 with optional SID. +type BgpSrteSegmentKTypeSubTlv interface { + Validation + // msg marshals BgpSrteSegmentKTypeSubTlv to protobuf object *otg.BgpSrteSegmentKTypeSubTlv + // and doesn't set defaults + msg() *otg.BgpSrteSegmentKTypeSubTlv + // setMsg unmarshals BgpSrteSegmentKTypeSubTlv from protobuf object *otg.BgpSrteSegmentKTypeSubTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteSegmentKTypeSubTlv) BgpSrteSegmentKTypeSubTlv + // provides marshal interface + Marshal() marshalBgpSrteSegmentKTypeSubTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSegmentKTypeSubTlv + // validate validates BgpSrteSegmentKTypeSubTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSegmentKTypeSubTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns string, set in BgpSrteSegmentKTypeSubTlv. + Flags() string + // SetFlags assigns string provided by user to BgpSrteSegmentKTypeSubTlv + SetFlags(value string) BgpSrteSegmentKTypeSubTlv + // HasFlags checks if Flags has been set in BgpSrteSegmentKTypeSubTlv + HasFlags() bool + // SrAlgorithm returns uint32, set in BgpSrteSegmentKTypeSubTlv. + SrAlgorithm() uint32 + // SetSrAlgorithm assigns uint32 provided by user to BgpSrteSegmentKTypeSubTlv + SetSrAlgorithm(value uint32) BgpSrteSegmentKTypeSubTlv + // HasSrAlgorithm checks if SrAlgorithm has been set in BgpSrteSegmentKTypeSubTlv + HasSrAlgorithm() bool + // LocalIpv6Address returns string, set in BgpSrteSegmentKTypeSubTlv. + LocalIpv6Address() string + // SetLocalIpv6Address assigns string provided by user to BgpSrteSegmentKTypeSubTlv + SetLocalIpv6Address(value string) BgpSrteSegmentKTypeSubTlv + // RemoteIpv6Address returns string, set in BgpSrteSegmentKTypeSubTlv. + RemoteIpv6Address() string + // SetRemoteIpv6Address assigns string provided by user to BgpSrteSegmentKTypeSubTlv + SetRemoteIpv6Address(value string) BgpSrteSegmentKTypeSubTlv + // Srv6Sid returns string, set in BgpSrteSegmentKTypeSubTlv. + Srv6Sid() string + // SetSrv6Sid assigns string provided by user to BgpSrteSegmentKTypeSubTlv + SetSrv6Sid(value string) BgpSrteSegmentKTypeSubTlv + // HasSrv6Sid checks if Srv6Sid has been set in BgpSrteSegmentKTypeSubTlv + HasSrv6Sid() bool + // Srv6SidEndpointBehavior returns BgpSrteSRv6SIDEndpointBehaviorAndStructure, set in BgpSrteSegmentKTypeSubTlv. + // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. + Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure + // SetSrv6SidEndpointBehavior assigns BgpSrteSRv6SIDEndpointBehaviorAndStructure provided by user to BgpSrteSegmentKTypeSubTlv. + // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. + SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentKTypeSubTlv + // HasSrv6SidEndpointBehavior checks if Srv6SidEndpointBehavior has been set in BgpSrteSegmentKTypeSubTlv + HasSrv6SidEndpointBehavior() bool + setNil() +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentKTypeSubTlv) Flags() string { + + return *obj.obj.Flags + +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// Flags returns a string +func (obj *bgpSrteSegmentKTypeSubTlv) HasFlags() bool { + return obj.obj.Flags != nil +} + +// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 +// SetFlags sets the string value in the BgpSrteSegmentKTypeSubTlv object +func (obj *bgpSrteSegmentKTypeSubTlv) SetFlags(value string) BgpSrteSegmentKTypeSubTlv { + + obj.obj.Flags = &value + return obj +} + +// SR Algorithm identifier when A-Flag in on. +// SrAlgorithm returns a uint32 +func (obj *bgpSrteSegmentKTypeSubTlv) SrAlgorithm() uint32 { + + return *obj.obj.SrAlgorithm + +} + +// SR Algorithm identifier when A-Flag in on. +// SrAlgorithm returns a uint32 +func (obj *bgpSrteSegmentKTypeSubTlv) HasSrAlgorithm() bool { + return obj.obj.SrAlgorithm != nil +} + +// SR Algorithm identifier when A-Flag in on. +// SetSrAlgorithm sets the uint32 value in the BgpSrteSegmentKTypeSubTlv object +func (obj *bgpSrteSegmentKTypeSubTlv) SetSrAlgorithm(value uint32) BgpSrteSegmentKTypeSubTlv { + + obj.obj.SrAlgorithm = &value + return obj +} + +// IPv6 address representing a node. +// LocalIpv6Address returns a string +func (obj *bgpSrteSegmentKTypeSubTlv) LocalIpv6Address() string { + + return *obj.obj.LocalIpv6Address + +} + +// IPv6 address representing a node. +// SetLocalIpv6Address sets the string value in the BgpSrteSegmentKTypeSubTlv object +func (obj *bgpSrteSegmentKTypeSubTlv) SetLocalIpv6Address(value string) BgpSrteSegmentKTypeSubTlv { + + obj.obj.LocalIpv6Address = &value + return obj +} + +// IPv6 address representing a node. +// RemoteIpv6Address returns a string +func (obj *bgpSrteSegmentKTypeSubTlv) RemoteIpv6Address() string { + + return *obj.obj.RemoteIpv6Address + +} + +// IPv6 address representing a node. +// SetRemoteIpv6Address sets the string value in the BgpSrteSegmentKTypeSubTlv object +func (obj *bgpSrteSegmentKTypeSubTlv) SetRemoteIpv6Address(value string) BgpSrteSegmentKTypeSubTlv { + + obj.obj.RemoteIpv6Address = &value + return obj +} + +// Optional SRv6 SID. +// Srv6Sid returns a string +func (obj *bgpSrteSegmentKTypeSubTlv) Srv6Sid() string { + + return *obj.obj.Srv6Sid + +} + +// Optional SRv6 SID. +// Srv6Sid returns a string +func (obj *bgpSrteSegmentKTypeSubTlv) HasSrv6Sid() bool { + return obj.obj.Srv6Sid != nil +} + +// Optional SRv6 SID. +// SetSrv6Sid sets the string value in the BgpSrteSegmentKTypeSubTlv object +func (obj *bgpSrteSegmentKTypeSubTlv) SetSrv6Sid(value string) BgpSrteSegmentKTypeSubTlv { + + obj.obj.Srv6Sid = &value + return obj +} + +// Optional SRv6 Endpoint Behavior and SID Structure. +// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure +func (obj *bgpSrteSegmentKTypeSubTlv) Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure { + if obj.obj.Srv6SidEndpointBehavior == nil { + obj.obj.Srv6SidEndpointBehavior = NewBgpSrteSRv6SIDEndpointBehaviorAndStructure().msg() + } + if obj.srv6SidEndpointBehaviorHolder == nil { + obj.srv6SidEndpointBehaviorHolder = &bgpSrteSRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6SidEndpointBehavior} + } + return obj.srv6SidEndpointBehaviorHolder +} + +// Optional SRv6 Endpoint Behavior and SID Structure. +// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure +func (obj *bgpSrteSegmentKTypeSubTlv) HasSrv6SidEndpointBehavior() bool { + return obj.obj.Srv6SidEndpointBehavior != nil +} + +// Optional SRv6 Endpoint Behavior and SID Structure. +// SetSrv6SidEndpointBehavior sets the BgpSrteSRv6SIDEndpointBehaviorAndStructure value in the BgpSrteSegmentKTypeSubTlv object +func (obj *bgpSrteSegmentKTypeSubTlv) SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentKTypeSubTlv { + + obj.srv6SidEndpointBehaviorHolder = nil + obj.obj.Srv6SidEndpointBehavior = value.msg() + + return obj +} + +func (obj *bgpSrteSegmentKTypeSubTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + err := obj.validateHex(obj.Flags()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentKTypeSubTlv.Flags")) + } + + } + + // LocalIpv6Address is required + if obj.obj.LocalIpv6Address == nil { + vObj.validationErrors = append(vObj.validationErrors, "LocalIpv6Address is required field on interface BgpSrteSegmentKTypeSubTlv") + } + if obj.obj.LocalIpv6Address != nil { + + err := obj.validateIpv6(obj.LocalIpv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentKTypeSubTlv.LocalIpv6Address")) + } + + } + + // RemoteIpv6Address is required + if obj.obj.RemoteIpv6Address == nil { + vObj.validationErrors = append(vObj.validationErrors, "RemoteIpv6Address is required field on interface BgpSrteSegmentKTypeSubTlv") + } + if obj.obj.RemoteIpv6Address != nil { + + err := obj.validateIpv6(obj.RemoteIpv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentKTypeSubTlv.RemoteIpv6Address")) + } + + } + + if obj.obj.Srv6Sid != nil { + + err := obj.validateIpv6(obj.Srv6Sid()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentKTypeSubTlv.Srv6Sid")) + } + + } + + if obj.obj.Srv6SidEndpointBehavior != nil { + + obj.Srv6SidEndpointBehavior().validateObj(vObj, set_default) + } + +} + +func (obj *bgpSrteSegmentKTypeSubTlv) setDefault() { + if obj.obj.SrAlgorithm == nil { + obj.SetSrAlgorithm(0) + } + +} diff --git a/gosnappi/bgp_srte_segment_list.go b/gosnappi/bgp_srte_segment_list.go new file mode 100644 index 00000000..8c259711 --- /dev/null +++ b/gosnappi/bgp_srte_segment_list.go @@ -0,0 +1,476 @@ +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" +) + +// ***** BgpSrteSegmentList ***** +type bgpSrteSegmentList struct { + validation + obj *otg.BgpSrteSegmentList + marshaller marshalBgpSrteSegmentList + unMarshaller unMarshalBgpSrteSegmentList + segmentsHolder BgpSrteSegmentListBgpSrteSegmentIter +} + +func NewBgpSrteSegmentList() BgpSrteSegmentList { + obj := bgpSrteSegmentList{obj: &otg.BgpSrteSegmentList{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSegmentList) msg() *otg.BgpSrteSegmentList { + return obj.obj +} + +func (obj *bgpSrteSegmentList) setMsg(msg *otg.BgpSrteSegmentList) BgpSrteSegmentList { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSegmentList struct { + obj *bgpSrteSegmentList +} + +type marshalBgpSrteSegmentList interface { + // ToProto marshals BgpSrteSegmentList to protobuf object *otg.BgpSrteSegmentList + ToProto() (*otg.BgpSrteSegmentList, error) + // ToPbText marshals BgpSrteSegmentList to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSegmentList to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSegmentList to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSegmentList struct { + obj *bgpSrteSegmentList +} + +type unMarshalBgpSrteSegmentList interface { + // FromProto unmarshals BgpSrteSegmentList from protobuf object *otg.BgpSrteSegmentList + FromProto(msg *otg.BgpSrteSegmentList) (BgpSrteSegmentList, error) + // FromPbText unmarshals BgpSrteSegmentList from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSegmentList from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSegmentList from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSegmentList) Marshal() marshalBgpSrteSegmentList { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSegmentList{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSegmentList) Unmarshal() unMarshalBgpSrteSegmentList { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSegmentList{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSegmentList) ToProto() (*otg.BgpSrteSegmentList, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSegmentList) FromProto(msg *otg.BgpSrteSegmentList) (BgpSrteSegmentList, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSegmentList) 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 *unMarshalbgpSrteSegmentList) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteSegmentList) 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 *unMarshalbgpSrteSegmentList) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteSegmentList) 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 *unMarshalbgpSrteSegmentList) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteSegmentList) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentList) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSegmentList) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSegmentList) Clone() (BgpSrteSegmentList, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSegmentList() + 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 +} + +func (obj *bgpSrteSegmentList) setNil() { + obj.segmentsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteSegmentList is optional configuration for BGP SR TE Policy segment list. The Segment List sub-TLV encodes a single explicit path towards the Endpoint. +type BgpSrteSegmentList interface { + Validation + // msg marshals BgpSrteSegmentList to protobuf object *otg.BgpSrteSegmentList + // and doesn't set defaults + msg() *otg.BgpSrteSegmentList + // setMsg unmarshals BgpSrteSegmentList from protobuf object *otg.BgpSrteSegmentList + // and doesn't set defaults + setMsg(*otg.BgpSrteSegmentList) BgpSrteSegmentList + // provides marshal interface + Marshal() marshalBgpSrteSegmentList + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSegmentList + // validate validates BgpSrteSegmentList + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSegmentList, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Weight returns uint32, set in BgpSrteSegmentList. + Weight() uint32 + // SetWeight assigns uint32 provided by user to BgpSrteSegmentList + SetWeight(value uint32) BgpSrteSegmentList + // HasWeight checks if Weight has been set in BgpSrteSegmentList + HasWeight() bool + // Segments returns BgpSrteSegmentListBgpSrteSegmentIterIter, set in BgpSrteSegmentList + Segments() BgpSrteSegmentListBgpSrteSegmentIter + // Name returns string, set in BgpSrteSegmentList. + Name() string + // SetName assigns string provided by user to BgpSrteSegmentList + SetName(value string) BgpSrteSegmentList + // Active returns bool, set in BgpSrteSegmentList. + Active() bool + // SetActive assigns bool provided by user to BgpSrteSegmentList + SetActive(value bool) BgpSrteSegmentList + // HasActive checks if Active has been set in BgpSrteSegmentList + HasActive() bool + setNil() +} + +// The Weight associated with a given path and the sub-TLV is optional. +// Weight returns a uint32 +func (obj *bgpSrteSegmentList) Weight() uint32 { + + return *obj.obj.Weight + +} + +// The Weight associated with a given path and the sub-TLV is optional. +// Weight returns a uint32 +func (obj *bgpSrteSegmentList) HasWeight() bool { + return obj.obj.Weight != nil +} + +// The Weight associated with a given path and the sub-TLV is optional. +// SetWeight sets the uint32 value in the BgpSrteSegmentList object +func (obj *bgpSrteSegmentList) SetWeight(value uint32) BgpSrteSegmentList { + + obj.obj.Weight = &value + return obj +} + +// description is TBD +// Segments returns a []BgpSrteSegment +func (obj *bgpSrteSegmentList) Segments() BgpSrteSegmentListBgpSrteSegmentIter { + if len(obj.obj.Segments) == 0 { + obj.obj.Segments = []*otg.BgpSrteSegment{} + } + if obj.segmentsHolder == nil { + obj.segmentsHolder = newBgpSrteSegmentListBgpSrteSegmentIter(&obj.obj.Segments).setMsg(obj) + } + return obj.segmentsHolder +} + +type bgpSrteSegmentListBgpSrteSegmentIter struct { + obj *bgpSrteSegmentList + bgpSrteSegmentSlice []BgpSrteSegment + fieldPtr *[]*otg.BgpSrteSegment +} + +func newBgpSrteSegmentListBgpSrteSegmentIter(ptr *[]*otg.BgpSrteSegment) BgpSrteSegmentListBgpSrteSegmentIter { + return &bgpSrteSegmentListBgpSrteSegmentIter{fieldPtr: ptr} +} + +type BgpSrteSegmentListBgpSrteSegmentIter interface { + setMsg(*bgpSrteSegmentList) BgpSrteSegmentListBgpSrteSegmentIter + Items() []BgpSrteSegment + Add() BgpSrteSegment + Append(items ...BgpSrteSegment) BgpSrteSegmentListBgpSrteSegmentIter + Set(index int, newObj BgpSrteSegment) BgpSrteSegmentListBgpSrteSegmentIter + Clear() BgpSrteSegmentListBgpSrteSegmentIter + clearHolderSlice() BgpSrteSegmentListBgpSrteSegmentIter + appendHolderSlice(item BgpSrteSegment) BgpSrteSegmentListBgpSrteSegmentIter +} + +func (obj *bgpSrteSegmentListBgpSrteSegmentIter) setMsg(msg *bgpSrteSegmentList) BgpSrteSegmentListBgpSrteSegmentIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpSrteSegment{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpSrteSegmentListBgpSrteSegmentIter) Items() []BgpSrteSegment { + return obj.bgpSrteSegmentSlice +} + +func (obj *bgpSrteSegmentListBgpSrteSegmentIter) Add() BgpSrteSegment { + newObj := &otg.BgpSrteSegment{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpSrteSegment{obj: newObj} + newLibObj.setDefault() + obj.bgpSrteSegmentSlice = append(obj.bgpSrteSegmentSlice, newLibObj) + return newLibObj +} + +func (obj *bgpSrteSegmentListBgpSrteSegmentIter) Append(items ...BgpSrteSegment) BgpSrteSegmentListBgpSrteSegmentIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpSrteSegmentSlice = append(obj.bgpSrteSegmentSlice, item) + } + return obj +} + +func (obj *bgpSrteSegmentListBgpSrteSegmentIter) Set(index int, newObj BgpSrteSegment) BgpSrteSegmentListBgpSrteSegmentIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpSrteSegmentSlice[index] = newObj + return obj +} +func (obj *bgpSrteSegmentListBgpSrteSegmentIter) Clear() BgpSrteSegmentListBgpSrteSegmentIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpSrteSegment{} + obj.bgpSrteSegmentSlice = []BgpSrteSegment{} + } + return obj +} +func (obj *bgpSrteSegmentListBgpSrteSegmentIter) clearHolderSlice() BgpSrteSegmentListBgpSrteSegmentIter { + if len(obj.bgpSrteSegmentSlice) > 0 { + obj.bgpSrteSegmentSlice = []BgpSrteSegment{} + } + return obj +} +func (obj *bgpSrteSegmentListBgpSrteSegmentIter) appendHolderSlice(item BgpSrteSegment) BgpSrteSegmentListBgpSrteSegmentIter { + obj.bgpSrteSegmentSlice = append(obj.bgpSrteSegmentSlice, item) + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *bgpSrteSegmentList) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the BgpSrteSegmentList object +func (obj *bgpSrteSegmentList) SetName(value string) BgpSrteSegmentList { + + obj.obj.Name = &value + return obj +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// Active returns a bool +func (obj *bgpSrteSegmentList) Active() bool { + + return *obj.obj.Active + +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// Active returns a bool +func (obj *bgpSrteSegmentList) HasActive() bool { + return obj.obj.Active != nil +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// SetActive sets the bool value in the BgpSrteSegmentList object +func (obj *bgpSrteSegmentList) SetActive(value bool) BgpSrteSegmentList { + + obj.obj.Active = &value + return obj +} + +func (obj *bgpSrteSegmentList) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Segments) != 0 { + + if set_default { + obj.Segments().clearHolderSlice() + for _, item := range obj.obj.Segments { + obj.Segments().appendHolderSlice(&bgpSrteSegment{obj: item}) + } + } + for _, item := range obj.Segments().Items() { + item.validateObj(vObj, set_default) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpSrteSegmentList") + } +} + +func (obj *bgpSrteSegmentList) setDefault() { + if obj.obj.Weight == nil { + obj.SetWeight(0) + } + if obj.obj.Active == nil { + obj.SetActive(true) + } + +} diff --git a/gosnappi/bgp_srte_sr_mpls_sid.go b/gosnappi/bgp_srte_sr_mpls_sid.go new file mode 100644 index 00000000..5f73bd2e --- /dev/null +++ b/gosnappi/bgp_srte_sr_mpls_sid.go @@ -0,0 +1,420 @@ +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" +) + +// ***** BgpSrteSrMplsSid ***** +type bgpSrteSrMplsSid struct { + validation + obj *otg.BgpSrteSrMplsSid + marshaller marshalBgpSrteSrMplsSid + unMarshaller unMarshalBgpSrteSrMplsSid +} + +func NewBgpSrteSrMplsSid() BgpSrteSrMplsSid { + obj := bgpSrteSrMplsSid{obj: &otg.BgpSrteSrMplsSid{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteSrMplsSid) msg() *otg.BgpSrteSrMplsSid { + return obj.obj +} + +func (obj *bgpSrteSrMplsSid) setMsg(msg *otg.BgpSrteSrMplsSid) BgpSrteSrMplsSid { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteSrMplsSid struct { + obj *bgpSrteSrMplsSid +} + +type marshalBgpSrteSrMplsSid interface { + // ToProto marshals BgpSrteSrMplsSid to protobuf object *otg.BgpSrteSrMplsSid + ToProto() (*otg.BgpSrteSrMplsSid, error) + // ToPbText marshals BgpSrteSrMplsSid to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteSrMplsSid to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteSrMplsSid to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteSrMplsSid struct { + obj *bgpSrteSrMplsSid +} + +type unMarshalBgpSrteSrMplsSid interface { + // FromProto unmarshals BgpSrteSrMplsSid from protobuf object *otg.BgpSrteSrMplsSid + FromProto(msg *otg.BgpSrteSrMplsSid) (BgpSrteSrMplsSid, error) + // FromPbText unmarshals BgpSrteSrMplsSid from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteSrMplsSid from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteSrMplsSid from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteSrMplsSid) Marshal() marshalBgpSrteSrMplsSid { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteSrMplsSid{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteSrMplsSid) Unmarshal() unMarshalBgpSrteSrMplsSid { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteSrMplsSid{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteSrMplsSid) ToProto() (*otg.BgpSrteSrMplsSid, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteSrMplsSid) FromProto(msg *otg.BgpSrteSrMplsSid) (BgpSrteSrMplsSid, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteSrMplsSid) 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 *unMarshalbgpSrteSrMplsSid) 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 *marshalbgpSrteSrMplsSid) 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 *unMarshalbgpSrteSrMplsSid) 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 *marshalbgpSrteSrMplsSid) 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 *unMarshalbgpSrteSrMplsSid) 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 *bgpSrteSrMplsSid) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteSrMplsSid) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteSrMplsSid) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteSrMplsSid) Clone() (BgpSrteSrMplsSid, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteSrMplsSid() + 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 +} + +// BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. +type BgpSrteSrMplsSid interface { + Validation + // msg marshals BgpSrteSrMplsSid to protobuf object *otg.BgpSrteSrMplsSid + // and doesn't set defaults + msg() *otg.BgpSrteSrMplsSid + // setMsg unmarshals BgpSrteSrMplsSid from protobuf object *otg.BgpSrteSrMplsSid + // and doesn't set defaults + setMsg(*otg.BgpSrteSrMplsSid) BgpSrteSrMplsSid + // provides marshal interface + Marshal() marshalBgpSrteSrMplsSid + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteSrMplsSid + // validate validates BgpSrteSrMplsSid + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteSrMplsSid, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Label returns uint32, set in BgpSrteSrMplsSid. + Label() uint32 + // SetLabel assigns uint32 provided by user to BgpSrteSrMplsSid + SetLabel(value uint32) BgpSrteSrMplsSid + // HasLabel checks if Label has been set in BgpSrteSrMplsSid + HasLabel() bool + // Tc returns uint32, set in BgpSrteSrMplsSid. + Tc() uint32 + // SetTc assigns uint32 provided by user to BgpSrteSrMplsSid + SetTc(value uint32) BgpSrteSrMplsSid + // HasTc checks if Tc has been set in BgpSrteSrMplsSid + HasTc() bool + // SBit returns bool, set in BgpSrteSrMplsSid. + SBit() bool + // SetSBit assigns bool provided by user to BgpSrteSrMplsSid + SetSBit(value bool) BgpSrteSrMplsSid + // HasSBit checks if SBit has been set in BgpSrteSrMplsSid + HasSBit() bool + // Ttl returns uint32, set in BgpSrteSrMplsSid. + Ttl() uint32 + // SetTtl assigns uint32 provided by user to BgpSrteSrMplsSid + SetTtl(value uint32) BgpSrteSrMplsSid + // HasTtl checks if Ttl has been set in BgpSrteSrMplsSid + HasTtl() bool +} + +// Label value in [0, 2^20 -1]. +// Label returns a uint32 +func (obj *bgpSrteSrMplsSid) Label() uint32 { + + return *obj.obj.Label + +} + +// Label value in [0, 2^20 -1]. +// Label returns a uint32 +func (obj *bgpSrteSrMplsSid) HasLabel() bool { + return obj.obj.Label != nil +} + +// Label value in [0, 2^20 -1]. +// SetLabel sets the uint32 value in the BgpSrteSrMplsSid object +func (obj *bgpSrteSrMplsSid) SetLabel(value uint32) BgpSrteSrMplsSid { + + obj.obj.Label = &value + return obj +} + +// Traffic class in bits. +// Tc returns a uint32 +func (obj *bgpSrteSrMplsSid) Tc() uint32 { + + return *obj.obj.Tc + +} + +// Traffic class in bits. +// Tc returns a uint32 +func (obj *bgpSrteSrMplsSid) HasTc() bool { + return obj.obj.Tc != nil +} + +// Traffic class in bits. +// SetTc sets the uint32 value in the BgpSrteSrMplsSid object +func (obj *bgpSrteSrMplsSid) SetTc(value uint32) BgpSrteSrMplsSid { + + obj.obj.Tc = &value + return obj +} + +// Bottom-of-Stack bit. +// SBit returns a bool +func (obj *bgpSrteSrMplsSid) SBit() bool { + + return *obj.obj.SBit + +} + +// Bottom-of-Stack bit. +// SBit returns a bool +func (obj *bgpSrteSrMplsSid) HasSBit() bool { + return obj.obj.SBit != nil +} + +// Bottom-of-Stack bit. +// SetSBit sets the bool value in the BgpSrteSrMplsSid object +func (obj *bgpSrteSrMplsSid) SetSBit(value bool) BgpSrteSrMplsSid { + + obj.obj.SBit = &value + return obj +} + +// Time To Live. +// Ttl returns a uint32 +func (obj *bgpSrteSrMplsSid) Ttl() uint32 { + + return *obj.obj.Ttl + +} + +// Time To Live. +// Ttl returns a uint32 +func (obj *bgpSrteSrMplsSid) HasTtl() bool { + return obj.obj.Ttl != nil +} + +// Time To Live. +// SetTtl sets the uint32 value in the BgpSrteSrMplsSid object +func (obj *bgpSrteSrMplsSid) SetTtl(value uint32) BgpSrteSrMplsSid { + + obj.obj.Ttl = &value + return obj +} + +func (obj *bgpSrteSrMplsSid) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Label != nil { + + if *obj.obj.Label > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpSrteSrMplsSid.Label <= 1048575 but Got %d", *obj.obj.Label)) + } + + } + + if obj.obj.Tc != nil { + + if *obj.obj.Tc > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpSrteSrMplsSid.Tc <= 7 but Got %d", *obj.obj.Tc)) + } + + } + + if obj.obj.Ttl != nil { + + if *obj.obj.Ttl > 225 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpSrteSrMplsSid.Ttl <= 225 but Got %d", *obj.obj.Ttl)) + } + + } + +} + +func (obj *bgpSrteSrMplsSid) setDefault() { + +} diff --git a/gosnappi/bgp_srte_v4_policy.go b/gosnappi/bgp_srte_v4_policy.go new file mode 100644 index 00000000..5189e9ff --- /dev/null +++ b/gosnappi/bgp_srte_v4_policy.go @@ -0,0 +1,1043 @@ +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" +) + +// ***** BgpSrteV4Policy ***** +type bgpSrteV4Policy struct { + validation + obj *otg.BgpSrteV4Policy + marshaller marshalBgpSrteV4Policy + unMarshaller unMarshalBgpSrteV4Policy + advancedHolder BgpRouteAdvanced + addPathHolder BgpAddPath + asPathHolder BgpAsPath + communitiesHolder BgpSrteV4PolicyBgpCommunityIter + extCommunitiesHolder BgpSrteV4PolicyBgpExtCommunityIter + tunnelTlvsHolder BgpSrteV4PolicyBgpSrteV4TunnelTlvIter +} + +func NewBgpSrteV4Policy() BgpSrteV4Policy { + obj := bgpSrteV4Policy{obj: &otg.BgpSrteV4Policy{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteV4Policy) msg() *otg.BgpSrteV4Policy { + return obj.obj +} + +func (obj *bgpSrteV4Policy) setMsg(msg *otg.BgpSrteV4Policy) BgpSrteV4Policy { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteV4Policy struct { + obj *bgpSrteV4Policy +} + +type marshalBgpSrteV4Policy interface { + // ToProto marshals BgpSrteV4Policy to protobuf object *otg.BgpSrteV4Policy + ToProto() (*otg.BgpSrteV4Policy, error) + // ToPbText marshals BgpSrteV4Policy to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteV4Policy to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteV4Policy to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteV4Policy struct { + obj *bgpSrteV4Policy +} + +type unMarshalBgpSrteV4Policy interface { + // FromProto unmarshals BgpSrteV4Policy from protobuf object *otg.BgpSrteV4Policy + FromProto(msg *otg.BgpSrteV4Policy) (BgpSrteV4Policy, error) + // FromPbText unmarshals BgpSrteV4Policy from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteV4Policy from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteV4Policy from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteV4Policy) Marshal() marshalBgpSrteV4Policy { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteV4Policy{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteV4Policy) Unmarshal() unMarshalBgpSrteV4Policy { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteV4Policy{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteV4Policy) ToProto() (*otg.BgpSrteV4Policy, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteV4Policy) FromProto(msg *otg.BgpSrteV4Policy) (BgpSrteV4Policy, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteV4Policy) 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 *unMarshalbgpSrteV4Policy) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteV4Policy) 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 *unMarshalbgpSrteV4Policy) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteV4Policy) 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 *unMarshalbgpSrteV4Policy) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteV4Policy) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteV4Policy) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteV4Policy) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteV4Policy) Clone() (BgpSrteV4Policy, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteV4Policy() + 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 +} + +func (obj *bgpSrteV4Policy) setNil() { + obj.advancedHolder = nil + obj.addPathHolder = nil + obj.asPathHolder = nil + obj.communitiesHolder = nil + obj.extCommunitiesHolder = nil + obj.tunnelTlvsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteV4Policy is configuration for BGP Segment Routing Traffic Engineering(SRTE) +// policy. + +type BgpSrteV4Policy interface { + Validation + // msg marshals BgpSrteV4Policy to protobuf object *otg.BgpSrteV4Policy + // and doesn't set defaults + msg() *otg.BgpSrteV4Policy + // setMsg unmarshals BgpSrteV4Policy from protobuf object *otg.BgpSrteV4Policy + // and doesn't set defaults + setMsg(*otg.BgpSrteV4Policy) BgpSrteV4Policy + // provides marshal interface + Marshal() marshalBgpSrteV4Policy + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteV4Policy + // validate validates BgpSrteV4Policy + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteV4Policy, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Distinguisher returns uint32, set in BgpSrteV4Policy. + Distinguisher() uint32 + // SetDistinguisher assigns uint32 provided by user to BgpSrteV4Policy + SetDistinguisher(value uint32) BgpSrteV4Policy + // HasDistinguisher checks if Distinguisher has been set in BgpSrteV4Policy + HasDistinguisher() bool + // Color returns uint32, set in BgpSrteV4Policy. + Color() uint32 + // SetColor assigns uint32 provided by user to BgpSrteV4Policy + SetColor(value uint32) BgpSrteV4Policy + // HasColor checks if Color has been set in BgpSrteV4Policy + HasColor() bool + // Ipv4Endpoint returns string, set in BgpSrteV4Policy. + Ipv4Endpoint() string + // SetIpv4Endpoint assigns string provided by user to BgpSrteV4Policy + SetIpv4Endpoint(value string) BgpSrteV4Policy + // NextHopMode returns BgpSrteV4PolicyNextHopModeEnum, set in BgpSrteV4Policy + NextHopMode() BgpSrteV4PolicyNextHopModeEnum + // SetNextHopMode assigns BgpSrteV4PolicyNextHopModeEnum provided by user to BgpSrteV4Policy + SetNextHopMode(value BgpSrteV4PolicyNextHopModeEnum) BgpSrteV4Policy + // HasNextHopMode checks if NextHopMode has been set in BgpSrteV4Policy + HasNextHopMode() bool + // NextHopAddressType returns BgpSrteV4PolicyNextHopAddressTypeEnum, set in BgpSrteV4Policy + NextHopAddressType() BgpSrteV4PolicyNextHopAddressTypeEnum + // SetNextHopAddressType assigns BgpSrteV4PolicyNextHopAddressTypeEnum provided by user to BgpSrteV4Policy + SetNextHopAddressType(value BgpSrteV4PolicyNextHopAddressTypeEnum) BgpSrteV4Policy + // HasNextHopAddressType checks if NextHopAddressType has been set in BgpSrteV4Policy + HasNextHopAddressType() bool + // NextHopIpv4Address returns string, set in BgpSrteV4Policy. + NextHopIpv4Address() string + // SetNextHopIpv4Address assigns string provided by user to BgpSrteV4Policy + SetNextHopIpv4Address(value string) BgpSrteV4Policy + // HasNextHopIpv4Address checks if NextHopIpv4Address has been set in BgpSrteV4Policy + HasNextHopIpv4Address() bool + // NextHopIpv6Address returns string, set in BgpSrteV4Policy. + NextHopIpv6Address() string + // SetNextHopIpv6Address assigns string provided by user to BgpSrteV4Policy + SetNextHopIpv6Address(value string) BgpSrteV4Policy + // HasNextHopIpv6Address checks if NextHopIpv6Address has been set in BgpSrteV4Policy + HasNextHopIpv6Address() bool + // Advanced returns BgpRouteAdvanced, set in BgpSrteV4Policy. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + Advanced() BgpRouteAdvanced + // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpSrteV4Policy. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + SetAdvanced(value BgpRouteAdvanced) BgpSrteV4Policy + // HasAdvanced checks if Advanced has been set in BgpSrteV4Policy + HasAdvanced() bool + // AddPath returns BgpAddPath, set in BgpSrteV4Policy. + // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. + AddPath() BgpAddPath + // SetAddPath assigns BgpAddPath provided by user to BgpSrteV4Policy. + // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. + SetAddPath(value BgpAddPath) BgpSrteV4Policy + // HasAddPath checks if AddPath has been set in BgpSrteV4Policy + HasAddPath() bool + // AsPath returns BgpAsPath, set in BgpSrteV4Policy. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + AsPath() BgpAsPath + // SetAsPath assigns BgpAsPath provided by user to BgpSrteV4Policy. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + SetAsPath(value BgpAsPath) BgpSrteV4Policy + // HasAsPath checks if AsPath has been set in BgpSrteV4Policy + HasAsPath() bool + // Communities returns BgpSrteV4PolicyBgpCommunityIterIter, set in BgpSrteV4Policy + Communities() BgpSrteV4PolicyBgpCommunityIter + // ExtCommunities returns BgpSrteV4PolicyBgpExtCommunityIterIter, set in BgpSrteV4Policy + ExtCommunities() BgpSrteV4PolicyBgpExtCommunityIter + // TunnelTlvs returns BgpSrteV4PolicyBgpSrteV4TunnelTlvIterIter, set in BgpSrteV4Policy + TunnelTlvs() BgpSrteV4PolicyBgpSrteV4TunnelTlvIter + // Name returns string, set in BgpSrteV4Policy. + Name() string + // SetName assigns string provided by user to BgpSrteV4Policy + SetName(value string) BgpSrteV4Policy + // Active returns bool, set in BgpSrteV4Policy. + Active() bool + // SetActive assigns bool provided by user to BgpSrteV4Policy + SetActive(value bool) BgpSrteV4Policy + // HasActive checks if Active has been set in BgpSrteV4Policy + HasActive() bool + setNil() +} + +// 4-octet value uniquely identifying the policy in the context of (color, endpoint) tuple. It is used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment list) with the same Color and Endpoint but meant for different head-ends. +// Distinguisher returns a uint32 +func (obj *bgpSrteV4Policy) Distinguisher() uint32 { + + return *obj.obj.Distinguisher + +} + +// 4-octet value uniquely identifying the policy in the context of (color, endpoint) tuple. It is used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment list) with the same Color and Endpoint but meant for different head-ends. +// Distinguisher returns a uint32 +func (obj *bgpSrteV4Policy) HasDistinguisher() bool { + return obj.obj.Distinguisher != nil +} + +// 4-octet value uniquely identifying the policy in the context of (color, endpoint) tuple. It is used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment list) with the same Color and Endpoint but meant for different head-ends. +// SetDistinguisher sets the uint32 value in the BgpSrteV4Policy object +func (obj *bgpSrteV4Policy) SetDistinguisher(value uint32) BgpSrteV4Policy { + + obj.obj.Distinguisher = &value + return obj +} + +// Policy color is used to match the color of the destination prefixes to steer traffic into the SR Policy. +// Color returns a uint32 +func (obj *bgpSrteV4Policy) Color() uint32 { + + return *obj.obj.Color + +} + +// Policy color is used to match the color of the destination prefixes to steer traffic into the SR Policy. +// Color returns a uint32 +func (obj *bgpSrteV4Policy) HasColor() bool { + return obj.obj.Color != nil +} + +// Policy color is used to match the color of the destination prefixes to steer traffic into the SR Policy. +// SetColor sets the uint32 value in the BgpSrteV4Policy object +func (obj *bgpSrteV4Policy) SetColor(value uint32) BgpSrteV4Policy { + + obj.obj.Color = &value + return obj +} + +// Specifies a single node or a set of nodes (e.g. an anycast address). It is selected on the basis of the SR Policy type (AFI). +// Ipv4Endpoint returns a string +func (obj *bgpSrteV4Policy) Ipv4Endpoint() string { + + return *obj.obj.Ipv4Endpoint + +} + +// Specifies a single node or a set of nodes (e.g. an anycast address). It is selected on the basis of the SR Policy type (AFI). +// SetIpv4Endpoint sets the string value in the BgpSrteV4Policy object +func (obj *bgpSrteV4Policy) SetIpv4Endpoint(value string) BgpSrteV4Policy { + + obj.obj.Ipv4Endpoint = &value + return obj +} + +type BgpSrteV4PolicyNextHopModeEnum string + +// Enum of NextHopMode on BgpSrteV4Policy +var BgpSrteV4PolicyNextHopMode = struct { + LOCAL_IP BgpSrteV4PolicyNextHopModeEnum + MANUAL BgpSrteV4PolicyNextHopModeEnum +}{ + LOCAL_IP: BgpSrteV4PolicyNextHopModeEnum("local_ip"), + MANUAL: BgpSrteV4PolicyNextHopModeEnum("manual"), +} + +func (obj *bgpSrteV4Policy) NextHopMode() BgpSrteV4PolicyNextHopModeEnum { + return BgpSrteV4PolicyNextHopModeEnum(obj.obj.NextHopMode.Enum().String()) +} + +// Mode for choosing the NextHop in MP REACH NLRI. Available modes are : Local IP: Automatically fills the Nexthop with the Local IP of the BGP peer. For IPv6 BGP peer the Nexthop Encoding capability should be enabled. Manual: Override the Nexthop with any arbitrary IPv4/IPv6 address. +// NextHopMode returns a string +func (obj *bgpSrteV4Policy) HasNextHopMode() bool { + return obj.obj.NextHopMode != nil +} + +func (obj *bgpSrteV4Policy) SetNextHopMode(value BgpSrteV4PolicyNextHopModeEnum) BgpSrteV4Policy { + intValue, ok := otg.BgpSrteV4Policy_NextHopMode_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpSrteV4PolicyNextHopModeEnum", string(value))) + return obj + } + enumValue := otg.BgpSrteV4Policy_NextHopMode_Enum(intValue) + obj.obj.NextHopMode = &enumValue + + return obj +} + +type BgpSrteV4PolicyNextHopAddressTypeEnum string + +// Enum of NextHopAddressType on BgpSrteV4Policy +var BgpSrteV4PolicyNextHopAddressType = struct { + IPV4 BgpSrteV4PolicyNextHopAddressTypeEnum + IPV6 BgpSrteV4PolicyNextHopAddressTypeEnum +}{ + IPV4: BgpSrteV4PolicyNextHopAddressTypeEnum("ipv4"), + IPV6: BgpSrteV4PolicyNextHopAddressTypeEnum("ipv6"), +} + +func (obj *bgpSrteV4Policy) NextHopAddressType() BgpSrteV4PolicyNextHopAddressTypeEnum { + return BgpSrteV4PolicyNextHopAddressTypeEnum(obj.obj.NextHopAddressType.Enum().String()) +} + +// Type of next hop IP address to be used when 'next_hop_mode' is set to 'manual'. +// NextHopAddressType returns a string +func (obj *bgpSrteV4Policy) HasNextHopAddressType() bool { + return obj.obj.NextHopAddressType != nil +} + +func (obj *bgpSrteV4Policy) SetNextHopAddressType(value BgpSrteV4PolicyNextHopAddressTypeEnum) BgpSrteV4Policy { + intValue, ok := otg.BgpSrteV4Policy_NextHopAddressType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpSrteV4PolicyNextHopAddressTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpSrteV4Policy_NextHopAddressType_Enum(intValue) + obj.obj.NextHopAddressType = &enumValue + + return obj +} + +// The IPv4 address of the next hop if the Nexthop type 'next_hop_mode' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability extended_next_hop_encoding should be enabled. +// NextHopIpv4Address returns a string +func (obj *bgpSrteV4Policy) NextHopIpv4Address() string { + + return *obj.obj.NextHopIpv4Address + +} + +// The IPv4 address of the next hop if the Nexthop type 'next_hop_mode' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability extended_next_hop_encoding should be enabled. +// NextHopIpv4Address returns a string +func (obj *bgpSrteV4Policy) HasNextHopIpv4Address() bool { + return obj.obj.NextHopIpv4Address != nil +} + +// The IPv4 address of the next hop if the Nexthop type 'next_hop_mode' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability extended_next_hop_encoding should be enabled. +// SetNextHopIpv4Address sets the string value in the BgpSrteV4Policy object +func (obj *bgpSrteV4Policy) SetNextHopIpv4Address(value string) BgpSrteV4Policy { + + obj.obj.NextHopIpv4Address = &value + return obj +} + +// The IPv6 address of the next hop if the Nexthop Mode 'next_hop_address_type' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv6. +// NextHopIpv6Address returns a string +func (obj *bgpSrteV4Policy) NextHopIpv6Address() string { + + return *obj.obj.NextHopIpv6Address + +} + +// The IPv6 address of the next hop if the Nexthop Mode 'next_hop_address_type' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv6. +// NextHopIpv6Address returns a string +func (obj *bgpSrteV4Policy) HasNextHopIpv6Address() bool { + return obj.obj.NextHopIpv6Address != nil +} + +// The IPv6 address of the next hop if the Nexthop Mode 'next_hop_address_type' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv6. +// SetNextHopIpv6Address sets the string value in the BgpSrteV4Policy object +func (obj *bgpSrteV4Policy) SetNextHopIpv6Address(value string) BgpSrteV4Policy { + + obj.obj.NextHopIpv6Address = &value + return obj +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpSrteV4Policy) Advanced() BgpRouteAdvanced { + if obj.obj.Advanced == nil { + obj.obj.Advanced = NewBgpRouteAdvanced().msg() + } + if obj.advancedHolder == nil { + obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} + } + return obj.advancedHolder +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpSrteV4Policy) HasAdvanced() bool { + return obj.obj.Advanced != nil +} + +// description is TBD +// SetAdvanced sets the BgpRouteAdvanced value in the BgpSrteV4Policy object +func (obj *bgpSrteV4Policy) SetAdvanced(value BgpRouteAdvanced) BgpSrteV4Policy { + + obj.advancedHolder = nil + obj.obj.Advanced = value.msg() + + return obj +} + +// description is TBD +// AddPath returns a BgpAddPath +func (obj *bgpSrteV4Policy) AddPath() BgpAddPath { + if obj.obj.AddPath == nil { + obj.obj.AddPath = NewBgpAddPath().msg() + } + if obj.addPathHolder == nil { + obj.addPathHolder = &bgpAddPath{obj: obj.obj.AddPath} + } + return obj.addPathHolder +} + +// description is TBD +// AddPath returns a BgpAddPath +func (obj *bgpSrteV4Policy) HasAddPath() bool { + return obj.obj.AddPath != nil +} + +// description is TBD +// SetAddPath sets the BgpAddPath value in the BgpSrteV4Policy object +func (obj *bgpSrteV4Policy) SetAddPath(value BgpAddPath) BgpSrteV4Policy { + + obj.addPathHolder = nil + obj.obj.AddPath = value.msg() + + return obj +} + +// description is TBD +// AsPath returns a BgpAsPath +func (obj *bgpSrteV4Policy) AsPath() BgpAsPath { + if obj.obj.AsPath == nil { + obj.obj.AsPath = NewBgpAsPath().msg() + } + if obj.asPathHolder == nil { + obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} + } + return obj.asPathHolder +} + +// description is TBD +// AsPath returns a BgpAsPath +func (obj *bgpSrteV4Policy) HasAsPath() bool { + return obj.obj.AsPath != nil +} + +// description is TBD +// SetAsPath sets the BgpAsPath value in the BgpSrteV4Policy object +func (obj *bgpSrteV4Policy) SetAsPath(value BgpAsPath) BgpSrteV4Policy { + + obj.asPathHolder = nil + obj.obj.AsPath = value.msg() + + return obj +} + +// Optional Community settings. +// Communities returns a []BgpCommunity +func (obj *bgpSrteV4Policy) Communities() BgpSrteV4PolicyBgpCommunityIter { + if len(obj.obj.Communities) == 0 { + obj.obj.Communities = []*otg.BgpCommunity{} + } + if obj.communitiesHolder == nil { + obj.communitiesHolder = newBgpSrteV4PolicyBgpCommunityIter(&obj.obj.Communities).setMsg(obj) + } + return obj.communitiesHolder +} + +type bgpSrteV4PolicyBgpCommunityIter struct { + obj *bgpSrteV4Policy + bgpCommunitySlice []BgpCommunity + fieldPtr *[]*otg.BgpCommunity +} + +func newBgpSrteV4PolicyBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpSrteV4PolicyBgpCommunityIter { + return &bgpSrteV4PolicyBgpCommunityIter{fieldPtr: ptr} +} + +type BgpSrteV4PolicyBgpCommunityIter interface { + setMsg(*bgpSrteV4Policy) BgpSrteV4PolicyBgpCommunityIter + Items() []BgpCommunity + Add() BgpCommunity + Append(items ...BgpCommunity) BgpSrteV4PolicyBgpCommunityIter + Set(index int, newObj BgpCommunity) BgpSrteV4PolicyBgpCommunityIter + Clear() BgpSrteV4PolicyBgpCommunityIter + clearHolderSlice() BgpSrteV4PolicyBgpCommunityIter + appendHolderSlice(item BgpCommunity) BgpSrteV4PolicyBgpCommunityIter +} + +func (obj *bgpSrteV4PolicyBgpCommunityIter) setMsg(msg *bgpSrteV4Policy) BgpSrteV4PolicyBgpCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpSrteV4PolicyBgpCommunityIter) Items() []BgpCommunity { + return obj.bgpCommunitySlice +} + +func (obj *bgpSrteV4PolicyBgpCommunityIter) Add() BgpCommunity { + newObj := &otg.BgpCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpSrteV4PolicyBgpCommunityIter) Append(items ...BgpCommunity) BgpSrteV4PolicyBgpCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + } + return obj +} + +func (obj *bgpSrteV4PolicyBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpSrteV4PolicyBgpCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpCommunitySlice[index] = newObj + return obj +} +func (obj *bgpSrteV4PolicyBgpCommunityIter) Clear() BgpSrteV4PolicyBgpCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpCommunity{} + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpSrteV4PolicyBgpCommunityIter) clearHolderSlice() BgpSrteV4PolicyBgpCommunityIter { + if len(obj.bgpCommunitySlice) > 0 { + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpSrteV4PolicyBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpSrteV4PolicyBgpCommunityIter { + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + return obj +} + +// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. +// ExtCommunities returns a []BgpExtCommunity +func (obj *bgpSrteV4Policy) ExtCommunities() BgpSrteV4PolicyBgpExtCommunityIter { + if len(obj.obj.ExtCommunities) == 0 { + obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} + } + if obj.extCommunitiesHolder == nil { + obj.extCommunitiesHolder = newBgpSrteV4PolicyBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) + } + return obj.extCommunitiesHolder +} + +type bgpSrteV4PolicyBgpExtCommunityIter struct { + obj *bgpSrteV4Policy + bgpExtCommunitySlice []BgpExtCommunity + fieldPtr *[]*otg.BgpExtCommunity +} + +func newBgpSrteV4PolicyBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpSrteV4PolicyBgpExtCommunityIter { + return &bgpSrteV4PolicyBgpExtCommunityIter{fieldPtr: ptr} +} + +type BgpSrteV4PolicyBgpExtCommunityIter interface { + setMsg(*bgpSrteV4Policy) BgpSrteV4PolicyBgpExtCommunityIter + Items() []BgpExtCommunity + Add() BgpExtCommunity + Append(items ...BgpExtCommunity) BgpSrteV4PolicyBgpExtCommunityIter + Set(index int, newObj BgpExtCommunity) BgpSrteV4PolicyBgpExtCommunityIter + Clear() BgpSrteV4PolicyBgpExtCommunityIter + clearHolderSlice() BgpSrteV4PolicyBgpExtCommunityIter + appendHolderSlice(item BgpExtCommunity) BgpSrteV4PolicyBgpExtCommunityIter +} + +func (obj *bgpSrteV4PolicyBgpExtCommunityIter) setMsg(msg *bgpSrteV4Policy) BgpSrteV4PolicyBgpExtCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpExtCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpSrteV4PolicyBgpExtCommunityIter) Items() []BgpExtCommunity { + return obj.bgpExtCommunitySlice +} + +func (obj *bgpSrteV4PolicyBgpExtCommunityIter) Add() BgpExtCommunity { + newObj := &otg.BgpExtCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpExtCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpSrteV4PolicyBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpSrteV4PolicyBgpExtCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + } + return obj +} + +func (obj *bgpSrteV4PolicyBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpSrteV4PolicyBgpExtCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpExtCommunitySlice[index] = newObj + return obj +} +func (obj *bgpSrteV4PolicyBgpExtCommunityIter) Clear() BgpSrteV4PolicyBgpExtCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpExtCommunity{} + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpSrteV4PolicyBgpExtCommunityIter) clearHolderSlice() BgpSrteV4PolicyBgpExtCommunityIter { + if len(obj.bgpExtCommunitySlice) > 0 { + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpSrteV4PolicyBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpSrteV4PolicyBgpExtCommunityIter { + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + return obj +} + +// List Tunnel Encapsulation Attributes. +// TunnelTlvs returns a []BgpSrteV4TunnelTlv +func (obj *bgpSrteV4Policy) TunnelTlvs() BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { + if len(obj.obj.TunnelTlvs) == 0 { + obj.obj.TunnelTlvs = []*otg.BgpSrteV4TunnelTlv{} + } + if obj.tunnelTlvsHolder == nil { + obj.tunnelTlvsHolder = newBgpSrteV4PolicyBgpSrteV4TunnelTlvIter(&obj.obj.TunnelTlvs).setMsg(obj) + } + return obj.tunnelTlvsHolder +} + +type bgpSrteV4PolicyBgpSrteV4TunnelTlvIter struct { + obj *bgpSrteV4Policy + bgpSrteV4TunnelTlvSlice []BgpSrteV4TunnelTlv + fieldPtr *[]*otg.BgpSrteV4TunnelTlv +} + +func newBgpSrteV4PolicyBgpSrteV4TunnelTlvIter(ptr *[]*otg.BgpSrteV4TunnelTlv) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { + return &bgpSrteV4PolicyBgpSrteV4TunnelTlvIter{fieldPtr: ptr} +} + +type BgpSrteV4PolicyBgpSrteV4TunnelTlvIter interface { + setMsg(*bgpSrteV4Policy) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter + Items() []BgpSrteV4TunnelTlv + Add() BgpSrteV4TunnelTlv + Append(items ...BgpSrteV4TunnelTlv) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter + Set(index int, newObj BgpSrteV4TunnelTlv) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter + Clear() BgpSrteV4PolicyBgpSrteV4TunnelTlvIter + clearHolderSlice() BgpSrteV4PolicyBgpSrteV4TunnelTlvIter + appendHolderSlice(item BgpSrteV4TunnelTlv) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter +} + +func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) setMsg(msg *bgpSrteV4Policy) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpSrteV4TunnelTlv{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) Items() []BgpSrteV4TunnelTlv { + return obj.bgpSrteV4TunnelTlvSlice +} + +func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) Add() BgpSrteV4TunnelTlv { + newObj := &otg.BgpSrteV4TunnelTlv{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpSrteV4TunnelTlv{obj: newObj} + newLibObj.setDefault() + obj.bgpSrteV4TunnelTlvSlice = append(obj.bgpSrteV4TunnelTlvSlice, newLibObj) + return newLibObj +} + +func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) Append(items ...BgpSrteV4TunnelTlv) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpSrteV4TunnelTlvSlice = append(obj.bgpSrteV4TunnelTlvSlice, item) + } + return obj +} + +func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) Set(index int, newObj BgpSrteV4TunnelTlv) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpSrteV4TunnelTlvSlice[index] = newObj + return obj +} +func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) Clear() BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpSrteV4TunnelTlv{} + obj.bgpSrteV4TunnelTlvSlice = []BgpSrteV4TunnelTlv{} + } + return obj +} +func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) clearHolderSlice() BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { + if len(obj.bgpSrteV4TunnelTlvSlice) > 0 { + obj.bgpSrteV4TunnelTlvSlice = []BgpSrteV4TunnelTlv{} + } + return obj +} +func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) appendHolderSlice(item BgpSrteV4TunnelTlv) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { + obj.bgpSrteV4TunnelTlvSlice = append(obj.bgpSrteV4TunnelTlvSlice, item) + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *bgpSrteV4Policy) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the BgpSrteV4Policy object +func (obj *bgpSrteV4Policy) SetName(value string) BgpSrteV4Policy { + + obj.obj.Name = &value + return obj +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// Active returns a bool +func (obj *bgpSrteV4Policy) Active() bool { + + return *obj.obj.Active + +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// Active returns a bool +func (obj *bgpSrteV4Policy) HasActive() bool { + return obj.obj.Active != nil +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// SetActive sets the bool value in the BgpSrteV4Policy object +func (obj *bgpSrteV4Policy) SetActive(value bool) BgpSrteV4Policy { + + obj.obj.Active = &value + return obj +} + +func (obj *bgpSrteV4Policy) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Ipv4Endpoint is required + if obj.obj.Ipv4Endpoint == nil { + vObj.validationErrors = append(vObj.validationErrors, "Ipv4Endpoint is required field on interface BgpSrteV4Policy") + } + if obj.obj.Ipv4Endpoint != nil { + + err := obj.validateIpv4(obj.Ipv4Endpoint()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteV4Policy.Ipv4Endpoint")) + } + + } + + if obj.obj.NextHopIpv4Address != nil { + + err := obj.validateIpv4(obj.NextHopIpv4Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteV4Policy.NextHopIpv4Address")) + } + + } + + if obj.obj.NextHopIpv6Address != nil { + + err := obj.validateIpv6(obj.NextHopIpv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteV4Policy.NextHopIpv6Address")) + } + + } + + if obj.obj.Advanced != nil { + + obj.Advanced().validateObj(vObj, set_default) + } + + if obj.obj.AddPath != nil { + + obj.AddPath().validateObj(vObj, set_default) + } + + if obj.obj.AsPath != nil { + + obj.AsPath().validateObj(vObj, set_default) + } + + if len(obj.obj.Communities) != 0 { + + if set_default { + obj.Communities().clearHolderSlice() + for _, item := range obj.obj.Communities { + obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) + } + } + for _, item := range obj.Communities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.ExtCommunities) != 0 { + + if set_default { + obj.ExtCommunities().clearHolderSlice() + for _, item := range obj.obj.ExtCommunities { + obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) + } + } + for _, item := range obj.ExtCommunities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.TunnelTlvs) != 0 { + + if set_default { + obj.TunnelTlvs().clearHolderSlice() + for _, item := range obj.obj.TunnelTlvs { + obj.TunnelTlvs().appendHolderSlice(&bgpSrteV4TunnelTlv{obj: item}) + } + } + for _, item := range obj.TunnelTlvs().Items() { + item.validateObj(vObj, set_default) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpSrteV4Policy") + } +} + +func (obj *bgpSrteV4Policy) setDefault() { + if obj.obj.Distinguisher == nil { + obj.SetDistinguisher(1) + } + if obj.obj.Color == nil { + obj.SetColor(100) + } + if obj.obj.NextHopMode == nil { + obj.SetNextHopMode(BgpSrteV4PolicyNextHopMode.LOCAL_IP) + + } + if obj.obj.NextHopAddressType == nil { + obj.SetNextHopAddressType(BgpSrteV4PolicyNextHopAddressType.IPV4) + + } + if obj.obj.Active == nil { + obj.SetActive(true) + } + +} diff --git a/gosnappi/bgp_srte_v4_tunnel_tlv.go b/gosnappi/bgp_srte_v4_tunnel_tlv.go new file mode 100644 index 00000000..09071848 --- /dev/null +++ b/gosnappi/bgp_srte_v4_tunnel_tlv.go @@ -0,0 +1,746 @@ +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" +) + +// ***** BgpSrteV4TunnelTlv ***** +type bgpSrteV4TunnelTlv struct { + validation + obj *otg.BgpSrteV4TunnelTlv + marshaller marshalBgpSrteV4TunnelTlv + unMarshaller unMarshalBgpSrteV4TunnelTlv + remoteEndpointSubTlvHolder BgpSrteRemoteEndpointSubTlv + colorSubTlvHolder BgpSrteColorSubTlv + bindingSubTlvHolder BgpSrteBindingSubTlv + preferenceSubTlvHolder BgpSrtePreferenceSubTlv + policyPrioritySubTlvHolder BgpSrtePolicyPrioritySubTlv + policyNameSubTlvHolder BgpSrtePolicyNameSubTlv + explicitNullLabelPolicySubTlvHolder BgpSrteExplicitNullLabelPolicySubTlv + segmentListsHolder BgpSrteV4TunnelTlvBgpSrteSegmentListIter +} + +func NewBgpSrteV4TunnelTlv() BgpSrteV4TunnelTlv { + obj := bgpSrteV4TunnelTlv{obj: &otg.BgpSrteV4TunnelTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteV4TunnelTlv) msg() *otg.BgpSrteV4TunnelTlv { + return obj.obj +} + +func (obj *bgpSrteV4TunnelTlv) setMsg(msg *otg.BgpSrteV4TunnelTlv) BgpSrteV4TunnelTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteV4TunnelTlv struct { + obj *bgpSrteV4TunnelTlv +} + +type marshalBgpSrteV4TunnelTlv interface { + // ToProto marshals BgpSrteV4TunnelTlv to protobuf object *otg.BgpSrteV4TunnelTlv + ToProto() (*otg.BgpSrteV4TunnelTlv, error) + // ToPbText marshals BgpSrteV4TunnelTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteV4TunnelTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteV4TunnelTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteV4TunnelTlv struct { + obj *bgpSrteV4TunnelTlv +} + +type unMarshalBgpSrteV4TunnelTlv interface { + // FromProto unmarshals BgpSrteV4TunnelTlv from protobuf object *otg.BgpSrteV4TunnelTlv + FromProto(msg *otg.BgpSrteV4TunnelTlv) (BgpSrteV4TunnelTlv, error) + // FromPbText unmarshals BgpSrteV4TunnelTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteV4TunnelTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteV4TunnelTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteV4TunnelTlv) Marshal() marshalBgpSrteV4TunnelTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteV4TunnelTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteV4TunnelTlv) Unmarshal() unMarshalBgpSrteV4TunnelTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteV4TunnelTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteV4TunnelTlv) ToProto() (*otg.BgpSrteV4TunnelTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteV4TunnelTlv) FromProto(msg *otg.BgpSrteV4TunnelTlv) (BgpSrteV4TunnelTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteV4TunnelTlv) 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 *unMarshalbgpSrteV4TunnelTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteV4TunnelTlv) 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 *unMarshalbgpSrteV4TunnelTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteV4TunnelTlv) 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 *unMarshalbgpSrteV4TunnelTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteV4TunnelTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteV4TunnelTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteV4TunnelTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteV4TunnelTlv) Clone() (BgpSrteV4TunnelTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteV4TunnelTlv() + 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 +} + +func (obj *bgpSrteV4TunnelTlv) setNil() { + obj.remoteEndpointSubTlvHolder = nil + obj.colorSubTlvHolder = nil + obj.bindingSubTlvHolder = nil + obj.preferenceSubTlvHolder = nil + obj.policyPrioritySubTlvHolder = nil + obj.policyNameSubTlvHolder = nil + obj.explicitNullLabelPolicySubTlvHolder = nil + obj.segmentListsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteV4TunnelTlv is configuration for BGP SRTE Tunnel TLV. +type BgpSrteV4TunnelTlv interface { + Validation + // msg marshals BgpSrteV4TunnelTlv to protobuf object *otg.BgpSrteV4TunnelTlv + // and doesn't set defaults + msg() *otg.BgpSrteV4TunnelTlv + // setMsg unmarshals BgpSrteV4TunnelTlv from protobuf object *otg.BgpSrteV4TunnelTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteV4TunnelTlv) BgpSrteV4TunnelTlv + // provides marshal interface + Marshal() marshalBgpSrteV4TunnelTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteV4TunnelTlv + // validate validates BgpSrteV4TunnelTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteV4TunnelTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RemoteEndpointSubTlv returns BgpSrteRemoteEndpointSubTlv, set in BgpSrteV4TunnelTlv. + // BgpSrteRemoteEndpointSubTlv is configuration for the BGP remote endpoint sub TLV. + RemoteEndpointSubTlv() BgpSrteRemoteEndpointSubTlv + // SetRemoteEndpointSubTlv assigns BgpSrteRemoteEndpointSubTlv provided by user to BgpSrteV4TunnelTlv. + // BgpSrteRemoteEndpointSubTlv is configuration for the BGP remote endpoint sub TLV. + SetRemoteEndpointSubTlv(value BgpSrteRemoteEndpointSubTlv) BgpSrteV4TunnelTlv + // HasRemoteEndpointSubTlv checks if RemoteEndpointSubTlv has been set in BgpSrteV4TunnelTlv + HasRemoteEndpointSubTlv() bool + // ColorSubTlv returns BgpSrteColorSubTlv, set in BgpSrteV4TunnelTlv. + // BgpSrteColorSubTlv is configuration for the Policy Color attribute sub-TLV. The Color sub-TLV MAY be used as a way to "color" the corresponding Tunnel TLV. The Value field of the sub-TLV is eight octets long and consists of a Color Extended Community. First two octets of its Value field are 0x030b as type and subtype of extended community. Remaining six octets are are exposed to configure. + ColorSubTlv() BgpSrteColorSubTlv + // SetColorSubTlv assigns BgpSrteColorSubTlv provided by user to BgpSrteV4TunnelTlv. + // BgpSrteColorSubTlv is configuration for the Policy Color attribute sub-TLV. The Color sub-TLV MAY be used as a way to "color" the corresponding Tunnel TLV. The Value field of the sub-TLV is eight octets long and consists of a Color Extended Community. First two octets of its Value field are 0x030b as type and subtype of extended community. Remaining six octets are are exposed to configure. + SetColorSubTlv(value BgpSrteColorSubTlv) BgpSrteV4TunnelTlv + // HasColorSubTlv checks if ColorSubTlv has been set in BgpSrteV4TunnelTlv + HasColorSubTlv() bool + // BindingSubTlv returns BgpSrteBindingSubTlv, set in BgpSrteV4TunnelTlv. + // BgpSrteBindingSubTlv is configuration for the binding SID sub-TLV. This is used to signal the binding SID related information of the SR Policy candidate path. + BindingSubTlv() BgpSrteBindingSubTlv + // SetBindingSubTlv assigns BgpSrteBindingSubTlv provided by user to BgpSrteV4TunnelTlv. + // BgpSrteBindingSubTlv is configuration for the binding SID sub-TLV. This is used to signal the binding SID related information of the SR Policy candidate path. + SetBindingSubTlv(value BgpSrteBindingSubTlv) BgpSrteV4TunnelTlv + // HasBindingSubTlv checks if BindingSubTlv has been set in BgpSrteV4TunnelTlv + HasBindingSubTlv() bool + // PreferenceSubTlv returns BgpSrtePreferenceSubTlv, set in BgpSrteV4TunnelTlv. + // BgpSrtePreferenceSubTlv is configuration for BGP preference sub TLV of the SR Policy candidate path. + PreferenceSubTlv() BgpSrtePreferenceSubTlv + // SetPreferenceSubTlv assigns BgpSrtePreferenceSubTlv provided by user to BgpSrteV4TunnelTlv. + // BgpSrtePreferenceSubTlv is configuration for BGP preference sub TLV of the SR Policy candidate path. + SetPreferenceSubTlv(value BgpSrtePreferenceSubTlv) BgpSrteV4TunnelTlv + // HasPreferenceSubTlv checks if PreferenceSubTlv has been set in BgpSrteV4TunnelTlv + HasPreferenceSubTlv() bool + // PolicyPrioritySubTlv returns BgpSrtePolicyPrioritySubTlv, set in BgpSrteV4TunnelTlv. + // BgpSrtePolicyPrioritySubTlv is configuration for the Policy Priority sub-TLV. The Policy Priority to indicate the order in which the SR policies are re-computed upon topological change. + PolicyPrioritySubTlv() BgpSrtePolicyPrioritySubTlv + // SetPolicyPrioritySubTlv assigns BgpSrtePolicyPrioritySubTlv provided by user to BgpSrteV4TunnelTlv. + // BgpSrtePolicyPrioritySubTlv is configuration for the Policy Priority sub-TLV. The Policy Priority to indicate the order in which the SR policies are re-computed upon topological change. + SetPolicyPrioritySubTlv(value BgpSrtePolicyPrioritySubTlv) BgpSrteV4TunnelTlv + // HasPolicyPrioritySubTlv checks if PolicyPrioritySubTlv has been set in BgpSrteV4TunnelTlv + HasPolicyPrioritySubTlv() bool + // PolicyNameSubTlv returns BgpSrtePolicyNameSubTlv, set in BgpSrteV4TunnelTlv. + // BgpSrtePolicyNameSubTlv is configuration for the Policy Name sub-TLV. The Policy Name sub-TLV is used to attach a symbolic name to the SR Policy candidate path. + PolicyNameSubTlv() BgpSrtePolicyNameSubTlv + // SetPolicyNameSubTlv assigns BgpSrtePolicyNameSubTlv provided by user to BgpSrteV4TunnelTlv. + // BgpSrtePolicyNameSubTlv is configuration for the Policy Name sub-TLV. The Policy Name sub-TLV is used to attach a symbolic name to the SR Policy candidate path. + SetPolicyNameSubTlv(value BgpSrtePolicyNameSubTlv) BgpSrteV4TunnelTlv + // HasPolicyNameSubTlv checks if PolicyNameSubTlv has been set in BgpSrteV4TunnelTlv + HasPolicyNameSubTlv() bool + // ExplicitNullLabelPolicySubTlv returns BgpSrteExplicitNullLabelPolicySubTlv, set in BgpSrteV4TunnelTlv. + // BgpSrteExplicitNullLabelPolicySubTlv is configuration for BGP explicit null label policy sub TLV settings. + ExplicitNullLabelPolicySubTlv() BgpSrteExplicitNullLabelPolicySubTlv + // SetExplicitNullLabelPolicySubTlv assigns BgpSrteExplicitNullLabelPolicySubTlv provided by user to BgpSrteV4TunnelTlv. + // BgpSrteExplicitNullLabelPolicySubTlv is configuration for BGP explicit null label policy sub TLV settings. + SetExplicitNullLabelPolicySubTlv(value BgpSrteExplicitNullLabelPolicySubTlv) BgpSrteV4TunnelTlv + // HasExplicitNullLabelPolicySubTlv checks if ExplicitNullLabelPolicySubTlv has been set in BgpSrteV4TunnelTlv + HasExplicitNullLabelPolicySubTlv() bool + // SegmentLists returns BgpSrteV4TunnelTlvBgpSrteSegmentListIterIter, set in BgpSrteV4TunnelTlv + SegmentLists() BgpSrteV4TunnelTlvBgpSrteSegmentListIter + // Name returns string, set in BgpSrteV4TunnelTlv. + Name() string + // SetName assigns string provided by user to BgpSrteV4TunnelTlv + SetName(value string) BgpSrteV4TunnelTlv + // Active returns bool, set in BgpSrteV4TunnelTlv. + Active() bool + // SetActive assigns bool provided by user to BgpSrteV4TunnelTlv + SetActive(value bool) BgpSrteV4TunnelTlv + // HasActive checks if Active has been set in BgpSrteV4TunnelTlv + HasActive() bool + setNil() +} + +// description is TBD +// RemoteEndpointSubTlv returns a BgpSrteRemoteEndpointSubTlv +func (obj *bgpSrteV4TunnelTlv) RemoteEndpointSubTlv() BgpSrteRemoteEndpointSubTlv { + if obj.obj.RemoteEndpointSubTlv == nil { + obj.obj.RemoteEndpointSubTlv = NewBgpSrteRemoteEndpointSubTlv().msg() + } + if obj.remoteEndpointSubTlvHolder == nil { + obj.remoteEndpointSubTlvHolder = &bgpSrteRemoteEndpointSubTlv{obj: obj.obj.RemoteEndpointSubTlv} + } + return obj.remoteEndpointSubTlvHolder +} + +// description is TBD +// RemoteEndpointSubTlv returns a BgpSrteRemoteEndpointSubTlv +func (obj *bgpSrteV4TunnelTlv) HasRemoteEndpointSubTlv() bool { + return obj.obj.RemoteEndpointSubTlv != nil +} + +// description is TBD +// SetRemoteEndpointSubTlv sets the BgpSrteRemoteEndpointSubTlv value in the BgpSrteV4TunnelTlv object +func (obj *bgpSrteV4TunnelTlv) SetRemoteEndpointSubTlv(value BgpSrteRemoteEndpointSubTlv) BgpSrteV4TunnelTlv { + + obj.remoteEndpointSubTlvHolder = nil + obj.obj.RemoteEndpointSubTlv = value.msg() + + return obj +} + +// description is TBD +// ColorSubTlv returns a BgpSrteColorSubTlv +func (obj *bgpSrteV4TunnelTlv) ColorSubTlv() BgpSrteColorSubTlv { + if obj.obj.ColorSubTlv == nil { + obj.obj.ColorSubTlv = NewBgpSrteColorSubTlv().msg() + } + if obj.colorSubTlvHolder == nil { + obj.colorSubTlvHolder = &bgpSrteColorSubTlv{obj: obj.obj.ColorSubTlv} + } + return obj.colorSubTlvHolder +} + +// description is TBD +// ColorSubTlv returns a BgpSrteColorSubTlv +func (obj *bgpSrteV4TunnelTlv) HasColorSubTlv() bool { + return obj.obj.ColorSubTlv != nil +} + +// description is TBD +// SetColorSubTlv sets the BgpSrteColorSubTlv value in the BgpSrteV4TunnelTlv object +func (obj *bgpSrteV4TunnelTlv) SetColorSubTlv(value BgpSrteColorSubTlv) BgpSrteV4TunnelTlv { + + obj.colorSubTlvHolder = nil + obj.obj.ColorSubTlv = value.msg() + + return obj +} + +// description is TBD +// BindingSubTlv returns a BgpSrteBindingSubTlv +func (obj *bgpSrteV4TunnelTlv) BindingSubTlv() BgpSrteBindingSubTlv { + if obj.obj.BindingSubTlv == nil { + obj.obj.BindingSubTlv = NewBgpSrteBindingSubTlv().msg() + } + if obj.bindingSubTlvHolder == nil { + obj.bindingSubTlvHolder = &bgpSrteBindingSubTlv{obj: obj.obj.BindingSubTlv} + } + return obj.bindingSubTlvHolder +} + +// description is TBD +// BindingSubTlv returns a BgpSrteBindingSubTlv +func (obj *bgpSrteV4TunnelTlv) HasBindingSubTlv() bool { + return obj.obj.BindingSubTlv != nil +} + +// description is TBD +// SetBindingSubTlv sets the BgpSrteBindingSubTlv value in the BgpSrteV4TunnelTlv object +func (obj *bgpSrteV4TunnelTlv) SetBindingSubTlv(value BgpSrteBindingSubTlv) BgpSrteV4TunnelTlv { + + obj.bindingSubTlvHolder = nil + obj.obj.BindingSubTlv = value.msg() + + return obj +} + +// description is TBD +// PreferenceSubTlv returns a BgpSrtePreferenceSubTlv +func (obj *bgpSrteV4TunnelTlv) PreferenceSubTlv() BgpSrtePreferenceSubTlv { + if obj.obj.PreferenceSubTlv == nil { + obj.obj.PreferenceSubTlv = NewBgpSrtePreferenceSubTlv().msg() + } + if obj.preferenceSubTlvHolder == nil { + obj.preferenceSubTlvHolder = &bgpSrtePreferenceSubTlv{obj: obj.obj.PreferenceSubTlv} + } + return obj.preferenceSubTlvHolder +} + +// description is TBD +// PreferenceSubTlv returns a BgpSrtePreferenceSubTlv +func (obj *bgpSrteV4TunnelTlv) HasPreferenceSubTlv() bool { + return obj.obj.PreferenceSubTlv != nil +} + +// description is TBD +// SetPreferenceSubTlv sets the BgpSrtePreferenceSubTlv value in the BgpSrteV4TunnelTlv object +func (obj *bgpSrteV4TunnelTlv) SetPreferenceSubTlv(value BgpSrtePreferenceSubTlv) BgpSrteV4TunnelTlv { + + obj.preferenceSubTlvHolder = nil + obj.obj.PreferenceSubTlv = value.msg() + + return obj +} + +// description is TBD +// PolicyPrioritySubTlv returns a BgpSrtePolicyPrioritySubTlv +func (obj *bgpSrteV4TunnelTlv) PolicyPrioritySubTlv() BgpSrtePolicyPrioritySubTlv { + if obj.obj.PolicyPrioritySubTlv == nil { + obj.obj.PolicyPrioritySubTlv = NewBgpSrtePolicyPrioritySubTlv().msg() + } + if obj.policyPrioritySubTlvHolder == nil { + obj.policyPrioritySubTlvHolder = &bgpSrtePolicyPrioritySubTlv{obj: obj.obj.PolicyPrioritySubTlv} + } + return obj.policyPrioritySubTlvHolder +} + +// description is TBD +// PolicyPrioritySubTlv returns a BgpSrtePolicyPrioritySubTlv +func (obj *bgpSrteV4TunnelTlv) HasPolicyPrioritySubTlv() bool { + return obj.obj.PolicyPrioritySubTlv != nil +} + +// description is TBD +// SetPolicyPrioritySubTlv sets the BgpSrtePolicyPrioritySubTlv value in the BgpSrteV4TunnelTlv object +func (obj *bgpSrteV4TunnelTlv) SetPolicyPrioritySubTlv(value BgpSrtePolicyPrioritySubTlv) BgpSrteV4TunnelTlv { + + obj.policyPrioritySubTlvHolder = nil + obj.obj.PolicyPrioritySubTlv = value.msg() + + return obj +} + +// description is TBD +// PolicyNameSubTlv returns a BgpSrtePolicyNameSubTlv +func (obj *bgpSrteV4TunnelTlv) PolicyNameSubTlv() BgpSrtePolicyNameSubTlv { + if obj.obj.PolicyNameSubTlv == nil { + obj.obj.PolicyNameSubTlv = NewBgpSrtePolicyNameSubTlv().msg() + } + if obj.policyNameSubTlvHolder == nil { + obj.policyNameSubTlvHolder = &bgpSrtePolicyNameSubTlv{obj: obj.obj.PolicyNameSubTlv} + } + return obj.policyNameSubTlvHolder +} + +// description is TBD +// PolicyNameSubTlv returns a BgpSrtePolicyNameSubTlv +func (obj *bgpSrteV4TunnelTlv) HasPolicyNameSubTlv() bool { + return obj.obj.PolicyNameSubTlv != nil +} + +// description is TBD +// SetPolicyNameSubTlv sets the BgpSrtePolicyNameSubTlv value in the BgpSrteV4TunnelTlv object +func (obj *bgpSrteV4TunnelTlv) SetPolicyNameSubTlv(value BgpSrtePolicyNameSubTlv) BgpSrteV4TunnelTlv { + + obj.policyNameSubTlvHolder = nil + obj.obj.PolicyNameSubTlv = value.msg() + + return obj +} + +// description is TBD +// ExplicitNullLabelPolicySubTlv returns a BgpSrteExplicitNullLabelPolicySubTlv +func (obj *bgpSrteV4TunnelTlv) ExplicitNullLabelPolicySubTlv() BgpSrteExplicitNullLabelPolicySubTlv { + if obj.obj.ExplicitNullLabelPolicySubTlv == nil { + obj.obj.ExplicitNullLabelPolicySubTlv = NewBgpSrteExplicitNullLabelPolicySubTlv().msg() + } + if obj.explicitNullLabelPolicySubTlvHolder == nil { + obj.explicitNullLabelPolicySubTlvHolder = &bgpSrteExplicitNullLabelPolicySubTlv{obj: obj.obj.ExplicitNullLabelPolicySubTlv} + } + return obj.explicitNullLabelPolicySubTlvHolder +} + +// description is TBD +// ExplicitNullLabelPolicySubTlv returns a BgpSrteExplicitNullLabelPolicySubTlv +func (obj *bgpSrteV4TunnelTlv) HasExplicitNullLabelPolicySubTlv() bool { + return obj.obj.ExplicitNullLabelPolicySubTlv != nil +} + +// description is TBD +// SetExplicitNullLabelPolicySubTlv sets the BgpSrteExplicitNullLabelPolicySubTlv value in the BgpSrteV4TunnelTlv object +func (obj *bgpSrteV4TunnelTlv) SetExplicitNullLabelPolicySubTlv(value BgpSrteExplicitNullLabelPolicySubTlv) BgpSrteV4TunnelTlv { + + obj.explicitNullLabelPolicySubTlvHolder = nil + obj.obj.ExplicitNullLabelPolicySubTlv = value.msg() + + return obj +} + +// description is TBD +// SegmentLists returns a []BgpSrteSegmentList +func (obj *bgpSrteV4TunnelTlv) SegmentLists() BgpSrteV4TunnelTlvBgpSrteSegmentListIter { + if len(obj.obj.SegmentLists) == 0 { + obj.obj.SegmentLists = []*otg.BgpSrteSegmentList{} + } + if obj.segmentListsHolder == nil { + obj.segmentListsHolder = newBgpSrteV4TunnelTlvBgpSrteSegmentListIter(&obj.obj.SegmentLists).setMsg(obj) + } + return obj.segmentListsHolder +} + +type bgpSrteV4TunnelTlvBgpSrteSegmentListIter struct { + obj *bgpSrteV4TunnelTlv + bgpSrteSegmentListSlice []BgpSrteSegmentList + fieldPtr *[]*otg.BgpSrteSegmentList +} + +func newBgpSrteV4TunnelTlvBgpSrteSegmentListIter(ptr *[]*otg.BgpSrteSegmentList) BgpSrteV4TunnelTlvBgpSrteSegmentListIter { + return &bgpSrteV4TunnelTlvBgpSrteSegmentListIter{fieldPtr: ptr} +} + +type BgpSrteV4TunnelTlvBgpSrteSegmentListIter interface { + setMsg(*bgpSrteV4TunnelTlv) BgpSrteV4TunnelTlvBgpSrteSegmentListIter + Items() []BgpSrteSegmentList + Add() BgpSrteSegmentList + Append(items ...BgpSrteSegmentList) BgpSrteV4TunnelTlvBgpSrteSegmentListIter + Set(index int, newObj BgpSrteSegmentList) BgpSrteV4TunnelTlvBgpSrteSegmentListIter + Clear() BgpSrteV4TunnelTlvBgpSrteSegmentListIter + clearHolderSlice() BgpSrteV4TunnelTlvBgpSrteSegmentListIter + appendHolderSlice(item BgpSrteSegmentList) BgpSrteV4TunnelTlvBgpSrteSegmentListIter +} + +func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) setMsg(msg *bgpSrteV4TunnelTlv) BgpSrteV4TunnelTlvBgpSrteSegmentListIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpSrteSegmentList{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) Items() []BgpSrteSegmentList { + return obj.bgpSrteSegmentListSlice +} + +func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) Add() BgpSrteSegmentList { + newObj := &otg.BgpSrteSegmentList{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpSrteSegmentList{obj: newObj} + newLibObj.setDefault() + obj.bgpSrteSegmentListSlice = append(obj.bgpSrteSegmentListSlice, newLibObj) + return newLibObj +} + +func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) Append(items ...BgpSrteSegmentList) BgpSrteV4TunnelTlvBgpSrteSegmentListIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpSrteSegmentListSlice = append(obj.bgpSrteSegmentListSlice, item) + } + return obj +} + +func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) Set(index int, newObj BgpSrteSegmentList) BgpSrteV4TunnelTlvBgpSrteSegmentListIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpSrteSegmentListSlice[index] = newObj + return obj +} +func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) Clear() BgpSrteV4TunnelTlvBgpSrteSegmentListIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpSrteSegmentList{} + obj.bgpSrteSegmentListSlice = []BgpSrteSegmentList{} + } + return obj +} +func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) clearHolderSlice() BgpSrteV4TunnelTlvBgpSrteSegmentListIter { + if len(obj.bgpSrteSegmentListSlice) > 0 { + obj.bgpSrteSegmentListSlice = []BgpSrteSegmentList{} + } + return obj +} +func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) appendHolderSlice(item BgpSrteSegmentList) BgpSrteV4TunnelTlvBgpSrteSegmentListIter { + obj.bgpSrteSegmentListSlice = append(obj.bgpSrteSegmentListSlice, item) + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *bgpSrteV4TunnelTlv) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the BgpSrteV4TunnelTlv object +func (obj *bgpSrteV4TunnelTlv) SetName(value string) BgpSrteV4TunnelTlv { + + obj.obj.Name = &value + return obj +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// Active returns a bool +func (obj *bgpSrteV4TunnelTlv) Active() bool { + + return *obj.obj.Active + +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// Active returns a bool +func (obj *bgpSrteV4TunnelTlv) HasActive() bool { + return obj.obj.Active != nil +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// SetActive sets the bool value in the BgpSrteV4TunnelTlv object +func (obj *bgpSrteV4TunnelTlv) SetActive(value bool) BgpSrteV4TunnelTlv { + + obj.obj.Active = &value + return obj +} + +func (obj *bgpSrteV4TunnelTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RemoteEndpointSubTlv != nil { + + obj.RemoteEndpointSubTlv().validateObj(vObj, set_default) + } + + if obj.obj.ColorSubTlv != nil { + + obj.ColorSubTlv().validateObj(vObj, set_default) + } + + if obj.obj.BindingSubTlv != nil { + + obj.BindingSubTlv().validateObj(vObj, set_default) + } + + if obj.obj.PreferenceSubTlv != nil { + + obj.PreferenceSubTlv().validateObj(vObj, set_default) + } + + if obj.obj.PolicyPrioritySubTlv != nil { + + obj.PolicyPrioritySubTlv().validateObj(vObj, set_default) + } + + if obj.obj.PolicyNameSubTlv != nil { + + obj.PolicyNameSubTlv().validateObj(vObj, set_default) + } + + if obj.obj.ExplicitNullLabelPolicySubTlv != nil { + + obj.ExplicitNullLabelPolicySubTlv().validateObj(vObj, set_default) + } + + if len(obj.obj.SegmentLists) != 0 { + + if set_default { + obj.SegmentLists().clearHolderSlice() + for _, item := range obj.obj.SegmentLists { + obj.SegmentLists().appendHolderSlice(&bgpSrteSegmentList{obj: item}) + } + } + for _, item := range obj.SegmentLists().Items() { + item.validateObj(vObj, set_default) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpSrteV4TunnelTlv") + } +} + +func (obj *bgpSrteV4TunnelTlv) setDefault() { + if obj.obj.Active == nil { + obj.SetActive(true) + } + +} diff --git a/gosnappi/bgp_srte_v6_policy.go b/gosnappi/bgp_srte_v6_policy.go new file mode 100644 index 00000000..f5dd6311 --- /dev/null +++ b/gosnappi/bgp_srte_v6_policy.go @@ -0,0 +1,1048 @@ +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" +) + +// ***** BgpSrteV6Policy ***** +type bgpSrteV6Policy struct { + validation + obj *otg.BgpSrteV6Policy + marshaller marshalBgpSrteV6Policy + unMarshaller unMarshalBgpSrteV6Policy + advancedHolder BgpRouteAdvanced + addPathHolder BgpAddPath + asPathHolder BgpAsPath + communitiesHolder BgpSrteV6PolicyBgpCommunityIter + extcommunitiesHolder BgpSrteV6PolicyBgpExtCommunityIter + tunnelTlvsHolder BgpSrteV6PolicyBgpSrteV6TunnelTlvIter +} + +func NewBgpSrteV6Policy() BgpSrteV6Policy { + obj := bgpSrteV6Policy{obj: &otg.BgpSrteV6Policy{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteV6Policy) msg() *otg.BgpSrteV6Policy { + return obj.obj +} + +func (obj *bgpSrteV6Policy) setMsg(msg *otg.BgpSrteV6Policy) BgpSrteV6Policy { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteV6Policy struct { + obj *bgpSrteV6Policy +} + +type marshalBgpSrteV6Policy interface { + // ToProto marshals BgpSrteV6Policy to protobuf object *otg.BgpSrteV6Policy + ToProto() (*otg.BgpSrteV6Policy, error) + // ToPbText marshals BgpSrteV6Policy to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteV6Policy to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteV6Policy to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteV6Policy struct { + obj *bgpSrteV6Policy +} + +type unMarshalBgpSrteV6Policy interface { + // FromProto unmarshals BgpSrteV6Policy from protobuf object *otg.BgpSrteV6Policy + FromProto(msg *otg.BgpSrteV6Policy) (BgpSrteV6Policy, error) + // FromPbText unmarshals BgpSrteV6Policy from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteV6Policy from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteV6Policy from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteV6Policy) Marshal() marshalBgpSrteV6Policy { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteV6Policy{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteV6Policy) Unmarshal() unMarshalBgpSrteV6Policy { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteV6Policy{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteV6Policy) ToProto() (*otg.BgpSrteV6Policy, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteV6Policy) FromProto(msg *otg.BgpSrteV6Policy) (BgpSrteV6Policy, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteV6Policy) 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 *unMarshalbgpSrteV6Policy) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteV6Policy) 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 *unMarshalbgpSrteV6Policy) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteV6Policy) 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 *unMarshalbgpSrteV6Policy) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteV6Policy) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteV6Policy) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteV6Policy) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteV6Policy) Clone() (BgpSrteV6Policy, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteV6Policy() + 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 +} + +func (obj *bgpSrteV6Policy) setNil() { + obj.advancedHolder = nil + obj.addPathHolder = nil + obj.asPathHolder = nil + obj.communitiesHolder = nil + obj.extcommunitiesHolder = nil + obj.tunnelTlvsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteV6Policy is configuration for BGP Segment Routing Traffic Engineering policy. + +type BgpSrteV6Policy interface { + Validation + // msg marshals BgpSrteV6Policy to protobuf object *otg.BgpSrteV6Policy + // and doesn't set defaults + msg() *otg.BgpSrteV6Policy + // setMsg unmarshals BgpSrteV6Policy from protobuf object *otg.BgpSrteV6Policy + // and doesn't set defaults + setMsg(*otg.BgpSrteV6Policy) BgpSrteV6Policy + // provides marshal interface + Marshal() marshalBgpSrteV6Policy + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteV6Policy + // validate validates BgpSrteV6Policy + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteV6Policy, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Distinguisher returns uint32, set in BgpSrteV6Policy. + Distinguisher() uint32 + // SetDistinguisher assigns uint32 provided by user to BgpSrteV6Policy + SetDistinguisher(value uint32) BgpSrteV6Policy + // HasDistinguisher checks if Distinguisher has been set in BgpSrteV6Policy + HasDistinguisher() bool + // Color returns uint32, set in BgpSrteV6Policy. + Color() uint32 + // SetColor assigns uint32 provided by user to BgpSrteV6Policy + SetColor(value uint32) BgpSrteV6Policy + // HasColor checks if Color has been set in BgpSrteV6Policy + HasColor() bool + // Ipv6Endpoint returns string, set in BgpSrteV6Policy. + Ipv6Endpoint() string + // SetIpv6Endpoint assigns string provided by user to BgpSrteV6Policy + SetIpv6Endpoint(value string) BgpSrteV6Policy + // NextHopMode returns BgpSrteV6PolicyNextHopModeEnum, set in BgpSrteV6Policy + NextHopMode() BgpSrteV6PolicyNextHopModeEnum + // SetNextHopMode assigns BgpSrteV6PolicyNextHopModeEnum provided by user to BgpSrteV6Policy + SetNextHopMode(value BgpSrteV6PolicyNextHopModeEnum) BgpSrteV6Policy + // HasNextHopMode checks if NextHopMode has been set in BgpSrteV6Policy + HasNextHopMode() bool + // NextHopAddressType returns BgpSrteV6PolicyNextHopAddressTypeEnum, set in BgpSrteV6Policy + NextHopAddressType() BgpSrteV6PolicyNextHopAddressTypeEnum + // SetNextHopAddressType assigns BgpSrteV6PolicyNextHopAddressTypeEnum provided by user to BgpSrteV6Policy + SetNextHopAddressType(value BgpSrteV6PolicyNextHopAddressTypeEnum) BgpSrteV6Policy + // HasNextHopAddressType checks if NextHopAddressType has been set in BgpSrteV6Policy + HasNextHopAddressType() bool + // NextHopIpv4Address returns string, set in BgpSrteV6Policy. + NextHopIpv4Address() string + // SetNextHopIpv4Address assigns string provided by user to BgpSrteV6Policy + SetNextHopIpv4Address(value string) BgpSrteV6Policy + // HasNextHopIpv4Address checks if NextHopIpv4Address has been set in BgpSrteV6Policy + HasNextHopIpv4Address() bool + // NextHopIpv6Address returns string, set in BgpSrteV6Policy. + NextHopIpv6Address() string + // SetNextHopIpv6Address assigns string provided by user to BgpSrteV6Policy + SetNextHopIpv6Address(value string) BgpSrteV6Policy + // HasNextHopIpv6Address checks if NextHopIpv6Address has been set in BgpSrteV6Policy + HasNextHopIpv6Address() bool + // Advanced returns BgpRouteAdvanced, set in BgpSrteV6Policy. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + Advanced() BgpRouteAdvanced + // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpSrteV6Policy. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + SetAdvanced(value BgpRouteAdvanced) BgpSrteV6Policy + // HasAdvanced checks if Advanced has been set in BgpSrteV6Policy + HasAdvanced() bool + // AddPath returns BgpAddPath, set in BgpSrteV6Policy. + // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. + AddPath() BgpAddPath + // SetAddPath assigns BgpAddPath provided by user to BgpSrteV6Policy. + // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. + SetAddPath(value BgpAddPath) BgpSrteV6Policy + // HasAddPath checks if AddPath has been set in BgpSrteV6Policy + HasAddPath() bool + // AsPath returns BgpAsPath, set in BgpSrteV6Policy. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + AsPath() BgpAsPath + // SetAsPath assigns BgpAsPath provided by user to BgpSrteV6Policy. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + SetAsPath(value BgpAsPath) BgpSrteV6Policy + // HasAsPath checks if AsPath has been set in BgpSrteV6Policy + HasAsPath() bool + // Communities returns BgpSrteV6PolicyBgpCommunityIterIter, set in BgpSrteV6Policy + Communities() BgpSrteV6PolicyBgpCommunityIter + // Extcommunities returns BgpSrteV6PolicyBgpExtCommunityIterIter, set in BgpSrteV6Policy + Extcommunities() BgpSrteV6PolicyBgpExtCommunityIter + // TunnelTlvs returns BgpSrteV6PolicyBgpSrteV6TunnelTlvIterIter, set in BgpSrteV6Policy + TunnelTlvs() BgpSrteV6PolicyBgpSrteV6TunnelTlvIter + // Name returns string, set in BgpSrteV6Policy. + Name() string + // SetName assigns string provided by user to BgpSrteV6Policy + SetName(value string) BgpSrteV6Policy + // Active returns bool, set in BgpSrteV6Policy. + Active() bool + // SetActive assigns bool provided by user to BgpSrteV6Policy + SetActive(value bool) BgpSrteV6Policy + // HasActive checks if Active has been set in BgpSrteV6Policy + HasActive() bool + setNil() +} + +// Identifies the policy in the context of (color and endpoint) tuple. It is used by the SR Policy originator to make unique multiple occurrences of the same SR Policy. +// Distinguisher returns a uint32 +func (obj *bgpSrteV6Policy) Distinguisher() uint32 { + + return *obj.obj.Distinguisher + +} + +// Identifies the policy in the context of (color and endpoint) tuple. It is used by the SR Policy originator to make unique multiple occurrences of the same SR Policy. +// Distinguisher returns a uint32 +func (obj *bgpSrteV6Policy) HasDistinguisher() bool { + return obj.obj.Distinguisher != nil +} + +// Identifies the policy in the context of (color and endpoint) tuple. It is used by the SR Policy originator to make unique multiple occurrences of the same SR Policy. +// SetDistinguisher sets the uint32 value in the BgpSrteV6Policy object +func (obj *bgpSrteV6Policy) SetDistinguisher(value uint32) BgpSrteV6Policy { + + obj.obj.Distinguisher = &value + return obj +} + +// Identifies the policy. It is used to match the color of the destination prefixes to steer traffic into the SR Policy. +// Color returns a uint32 +func (obj *bgpSrteV6Policy) Color() uint32 { + + return *obj.obj.Color + +} + +// Identifies the policy. It is used to match the color of the destination prefixes to steer traffic into the SR Policy. +// Color returns a uint32 +func (obj *bgpSrteV6Policy) HasColor() bool { + return obj.obj.Color != nil +} + +// Identifies the policy. It is used to match the color of the destination prefixes to steer traffic into the SR Policy. +// SetColor sets the uint32 value in the BgpSrteV6Policy object +func (obj *bgpSrteV6Policy) SetColor(value uint32) BgpSrteV6Policy { + + obj.obj.Color = &value + return obj +} + +// Specifies a single node or a set of nodes (e.g., an anycast address). It is selected on the basis of the SR Policy type (AFI). +// Ipv6Endpoint returns a string +func (obj *bgpSrteV6Policy) Ipv6Endpoint() string { + + return *obj.obj.Ipv6Endpoint + +} + +// Specifies a single node or a set of nodes (e.g., an anycast address). It is selected on the basis of the SR Policy type (AFI). +// SetIpv6Endpoint sets the string value in the BgpSrteV6Policy object +func (obj *bgpSrteV6Policy) SetIpv6Endpoint(value string) BgpSrteV6Policy { + + obj.obj.Ipv6Endpoint = &value + return obj +} + +type BgpSrteV6PolicyNextHopModeEnum string + +// Enum of NextHopMode on BgpSrteV6Policy +var BgpSrteV6PolicyNextHopMode = struct { + LOCAL_IP BgpSrteV6PolicyNextHopModeEnum + MANUAL BgpSrteV6PolicyNextHopModeEnum +}{ + LOCAL_IP: BgpSrteV6PolicyNextHopModeEnum("local_ip"), + MANUAL: BgpSrteV6PolicyNextHopModeEnum("manual"), +} + +func (obj *bgpSrteV6Policy) NextHopMode() BgpSrteV6PolicyNextHopModeEnum { + return BgpSrteV6PolicyNextHopModeEnum(obj.obj.NextHopMode.Enum().String()) +} + +// Mode for choosing the NextHop in MP REACH NLRI. Available modes are : Local IP: Automatically fills the Nexthop with the Local IP of the BGP peer. For IPv6 BGP peer the Nexthop Encoding capability should be enabled. Manual: Override the Nexthop with any arbitrary IPv4/IPv6 address. +// NextHopMode returns a string +func (obj *bgpSrteV6Policy) HasNextHopMode() bool { + return obj.obj.NextHopMode != nil +} + +func (obj *bgpSrteV6Policy) SetNextHopMode(value BgpSrteV6PolicyNextHopModeEnum) BgpSrteV6Policy { + intValue, ok := otg.BgpSrteV6Policy_NextHopMode_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpSrteV6PolicyNextHopModeEnum", string(value))) + return obj + } + enumValue := otg.BgpSrteV6Policy_NextHopMode_Enum(intValue) + obj.obj.NextHopMode = &enumValue + + return obj +} + +type BgpSrteV6PolicyNextHopAddressTypeEnum string + +// Enum of NextHopAddressType on BgpSrteV6Policy +var BgpSrteV6PolicyNextHopAddressType = struct { + IPV4 BgpSrteV6PolicyNextHopAddressTypeEnum + IPV6 BgpSrteV6PolicyNextHopAddressTypeEnum +}{ + IPV4: BgpSrteV6PolicyNextHopAddressTypeEnum("ipv4"), + IPV6: BgpSrteV6PolicyNextHopAddressTypeEnum("ipv6"), +} + +func (obj *bgpSrteV6Policy) NextHopAddressType() BgpSrteV6PolicyNextHopAddressTypeEnum { + return BgpSrteV6PolicyNextHopAddressTypeEnum(obj.obj.NextHopAddressType.Enum().String()) +} + +// Type of next hop IP address to be used when 'next_hop_mode' is set to 'manual'. +// NextHopAddressType returns a string +func (obj *bgpSrteV6Policy) HasNextHopAddressType() bool { + return obj.obj.NextHopAddressType != nil +} + +func (obj *bgpSrteV6Policy) SetNextHopAddressType(value BgpSrteV6PolicyNextHopAddressTypeEnum) BgpSrteV6Policy { + intValue, ok := otg.BgpSrteV6Policy_NextHopAddressType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpSrteV6PolicyNextHopAddressTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpSrteV6Policy_NextHopAddressType_Enum(intValue) + obj.obj.NextHopAddressType = &enumValue + + return obj +} + +// The IPv4 address of the Nexthop if the 'next_hop_mode' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability extended_next_hop_encoding should be enabled. +// NextHopIpv4Address returns a string +func (obj *bgpSrteV6Policy) NextHopIpv4Address() string { + + return *obj.obj.NextHopIpv4Address + +} + +// The IPv4 address of the Nexthop if the 'next_hop_mode' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability extended_next_hop_encoding should be enabled. +// NextHopIpv4Address returns a string +func (obj *bgpSrteV6Policy) HasNextHopIpv4Address() bool { + return obj.obj.NextHopIpv4Address != nil +} + +// The IPv4 address of the Nexthop if the 'next_hop_mode' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability extended_next_hop_encoding should be enabled. +// SetNextHopIpv4Address sets the string value in the BgpSrteV6Policy object +func (obj *bgpSrteV6Policy) SetNextHopIpv4Address(value string) BgpSrteV6Policy { + + obj.obj.NextHopIpv4Address = &value + return obj +} + +// The IPv6 address of the next hop if the Nexthop Mode 'next_hop_address_type' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv6. +// NextHopIpv6Address returns a string +func (obj *bgpSrteV6Policy) NextHopIpv6Address() string { + + return *obj.obj.NextHopIpv6Address + +} + +// The IPv6 address of the next hop if the Nexthop Mode 'next_hop_address_type' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv6. +// NextHopIpv6Address returns a string +func (obj *bgpSrteV6Policy) HasNextHopIpv6Address() bool { + return obj.obj.NextHopIpv6Address != nil +} + +// The IPv6 address of the next hop if the Nexthop Mode 'next_hop_address_type' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv6. +// SetNextHopIpv6Address sets the string value in the BgpSrteV6Policy object +func (obj *bgpSrteV6Policy) SetNextHopIpv6Address(value string) BgpSrteV6Policy { + + obj.obj.NextHopIpv6Address = &value + return obj +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpSrteV6Policy) Advanced() BgpRouteAdvanced { + if obj.obj.Advanced == nil { + obj.obj.Advanced = NewBgpRouteAdvanced().msg() + } + if obj.advancedHolder == nil { + obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} + } + return obj.advancedHolder +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpSrteV6Policy) HasAdvanced() bool { + return obj.obj.Advanced != nil +} + +// description is TBD +// SetAdvanced sets the BgpRouteAdvanced value in the BgpSrteV6Policy object +func (obj *bgpSrteV6Policy) SetAdvanced(value BgpRouteAdvanced) BgpSrteV6Policy { + + obj.advancedHolder = nil + obj.obj.Advanced = value.msg() + + return obj +} + +// description is TBD +// AddPath returns a BgpAddPath +func (obj *bgpSrteV6Policy) AddPath() BgpAddPath { + if obj.obj.AddPath == nil { + obj.obj.AddPath = NewBgpAddPath().msg() + } + if obj.addPathHolder == nil { + obj.addPathHolder = &bgpAddPath{obj: obj.obj.AddPath} + } + return obj.addPathHolder +} + +// description is TBD +// AddPath returns a BgpAddPath +func (obj *bgpSrteV6Policy) HasAddPath() bool { + return obj.obj.AddPath != nil +} + +// description is TBD +// SetAddPath sets the BgpAddPath value in the BgpSrteV6Policy object +func (obj *bgpSrteV6Policy) SetAddPath(value BgpAddPath) BgpSrteV6Policy { + + obj.addPathHolder = nil + obj.obj.AddPath = value.msg() + + return obj +} + +// description is TBD +// AsPath returns a BgpAsPath +func (obj *bgpSrteV6Policy) AsPath() BgpAsPath { + if obj.obj.AsPath == nil { + obj.obj.AsPath = NewBgpAsPath().msg() + } + if obj.asPathHolder == nil { + obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} + } + return obj.asPathHolder +} + +// description is TBD +// AsPath returns a BgpAsPath +func (obj *bgpSrteV6Policy) HasAsPath() bool { + return obj.obj.AsPath != nil +} + +// description is TBD +// SetAsPath sets the BgpAsPath value in the BgpSrteV6Policy object +func (obj *bgpSrteV6Policy) SetAsPath(value BgpAsPath) BgpSrteV6Policy { + + obj.asPathHolder = nil + obj.obj.AsPath = value.msg() + + return obj +} + +// Optional community settings. +// Communities returns a []BgpCommunity +func (obj *bgpSrteV6Policy) Communities() BgpSrteV6PolicyBgpCommunityIter { + if len(obj.obj.Communities) == 0 { + obj.obj.Communities = []*otg.BgpCommunity{} + } + if obj.communitiesHolder == nil { + obj.communitiesHolder = newBgpSrteV6PolicyBgpCommunityIter(&obj.obj.Communities).setMsg(obj) + } + return obj.communitiesHolder +} + +type bgpSrteV6PolicyBgpCommunityIter struct { + obj *bgpSrteV6Policy + bgpCommunitySlice []BgpCommunity + fieldPtr *[]*otg.BgpCommunity +} + +func newBgpSrteV6PolicyBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpSrteV6PolicyBgpCommunityIter { + return &bgpSrteV6PolicyBgpCommunityIter{fieldPtr: ptr} +} + +type BgpSrteV6PolicyBgpCommunityIter interface { + setMsg(*bgpSrteV6Policy) BgpSrteV6PolicyBgpCommunityIter + Items() []BgpCommunity + Add() BgpCommunity + Append(items ...BgpCommunity) BgpSrteV6PolicyBgpCommunityIter + Set(index int, newObj BgpCommunity) BgpSrteV6PolicyBgpCommunityIter + Clear() BgpSrteV6PolicyBgpCommunityIter + clearHolderSlice() BgpSrteV6PolicyBgpCommunityIter + appendHolderSlice(item BgpCommunity) BgpSrteV6PolicyBgpCommunityIter +} + +func (obj *bgpSrteV6PolicyBgpCommunityIter) setMsg(msg *bgpSrteV6Policy) BgpSrteV6PolicyBgpCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpSrteV6PolicyBgpCommunityIter) Items() []BgpCommunity { + return obj.bgpCommunitySlice +} + +func (obj *bgpSrteV6PolicyBgpCommunityIter) Add() BgpCommunity { + newObj := &otg.BgpCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpSrteV6PolicyBgpCommunityIter) Append(items ...BgpCommunity) BgpSrteV6PolicyBgpCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + } + return obj +} + +func (obj *bgpSrteV6PolicyBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpSrteV6PolicyBgpCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpCommunitySlice[index] = newObj + return obj +} +func (obj *bgpSrteV6PolicyBgpCommunityIter) Clear() BgpSrteV6PolicyBgpCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpCommunity{} + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpSrteV6PolicyBgpCommunityIter) clearHolderSlice() BgpSrteV6PolicyBgpCommunityIter { + if len(obj.bgpCommunitySlice) > 0 { + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpSrteV6PolicyBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpSrteV6PolicyBgpCommunityIter { + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + return obj +} + +// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. +// Extcommunities returns a []BgpExtCommunity +func (obj *bgpSrteV6Policy) Extcommunities() BgpSrteV6PolicyBgpExtCommunityIter { + if len(obj.obj.Extcommunities) == 0 { + obj.obj.Extcommunities = []*otg.BgpExtCommunity{} + } + if obj.extcommunitiesHolder == nil { + obj.extcommunitiesHolder = newBgpSrteV6PolicyBgpExtCommunityIter(&obj.obj.Extcommunities).setMsg(obj) + } + return obj.extcommunitiesHolder +} + +type bgpSrteV6PolicyBgpExtCommunityIter struct { + obj *bgpSrteV6Policy + bgpExtCommunitySlice []BgpExtCommunity + fieldPtr *[]*otg.BgpExtCommunity +} + +func newBgpSrteV6PolicyBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpSrteV6PolicyBgpExtCommunityIter { + return &bgpSrteV6PolicyBgpExtCommunityIter{fieldPtr: ptr} +} + +type BgpSrteV6PolicyBgpExtCommunityIter interface { + setMsg(*bgpSrteV6Policy) BgpSrteV6PolicyBgpExtCommunityIter + Items() []BgpExtCommunity + Add() BgpExtCommunity + Append(items ...BgpExtCommunity) BgpSrteV6PolicyBgpExtCommunityIter + Set(index int, newObj BgpExtCommunity) BgpSrteV6PolicyBgpExtCommunityIter + Clear() BgpSrteV6PolicyBgpExtCommunityIter + clearHolderSlice() BgpSrteV6PolicyBgpExtCommunityIter + appendHolderSlice(item BgpExtCommunity) BgpSrteV6PolicyBgpExtCommunityIter +} + +func (obj *bgpSrteV6PolicyBgpExtCommunityIter) setMsg(msg *bgpSrteV6Policy) BgpSrteV6PolicyBgpExtCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpExtCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpSrteV6PolicyBgpExtCommunityIter) Items() []BgpExtCommunity { + return obj.bgpExtCommunitySlice +} + +func (obj *bgpSrteV6PolicyBgpExtCommunityIter) Add() BgpExtCommunity { + newObj := &otg.BgpExtCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpExtCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpSrteV6PolicyBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpSrteV6PolicyBgpExtCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + } + return obj +} + +func (obj *bgpSrteV6PolicyBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpSrteV6PolicyBgpExtCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpExtCommunitySlice[index] = newObj + return obj +} +func (obj *bgpSrteV6PolicyBgpExtCommunityIter) Clear() BgpSrteV6PolicyBgpExtCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpExtCommunity{} + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpSrteV6PolicyBgpExtCommunityIter) clearHolderSlice() BgpSrteV6PolicyBgpExtCommunityIter { + if len(obj.bgpExtCommunitySlice) > 0 { + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpSrteV6PolicyBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpSrteV6PolicyBgpExtCommunityIter { + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + return obj +} + +// List of optional tunnel TLV settings. +// TunnelTlvs returns a []BgpSrteV6TunnelTlv +func (obj *bgpSrteV6Policy) TunnelTlvs() BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { + if len(obj.obj.TunnelTlvs) == 0 { + obj.obj.TunnelTlvs = []*otg.BgpSrteV6TunnelTlv{} + } + if obj.tunnelTlvsHolder == nil { + obj.tunnelTlvsHolder = newBgpSrteV6PolicyBgpSrteV6TunnelTlvIter(&obj.obj.TunnelTlvs).setMsg(obj) + } + return obj.tunnelTlvsHolder +} + +type bgpSrteV6PolicyBgpSrteV6TunnelTlvIter struct { + obj *bgpSrteV6Policy + bgpSrteV6TunnelTlvSlice []BgpSrteV6TunnelTlv + fieldPtr *[]*otg.BgpSrteV6TunnelTlv +} + +func newBgpSrteV6PolicyBgpSrteV6TunnelTlvIter(ptr *[]*otg.BgpSrteV6TunnelTlv) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { + return &bgpSrteV6PolicyBgpSrteV6TunnelTlvIter{fieldPtr: ptr} +} + +type BgpSrteV6PolicyBgpSrteV6TunnelTlvIter interface { + setMsg(*bgpSrteV6Policy) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter + Items() []BgpSrteV6TunnelTlv + Add() BgpSrteV6TunnelTlv + Append(items ...BgpSrteV6TunnelTlv) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter + Set(index int, newObj BgpSrteV6TunnelTlv) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter + Clear() BgpSrteV6PolicyBgpSrteV6TunnelTlvIter + clearHolderSlice() BgpSrteV6PolicyBgpSrteV6TunnelTlvIter + appendHolderSlice(item BgpSrteV6TunnelTlv) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter +} + +func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) setMsg(msg *bgpSrteV6Policy) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpSrteV6TunnelTlv{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) Items() []BgpSrteV6TunnelTlv { + return obj.bgpSrteV6TunnelTlvSlice +} + +func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) Add() BgpSrteV6TunnelTlv { + newObj := &otg.BgpSrteV6TunnelTlv{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpSrteV6TunnelTlv{obj: newObj} + newLibObj.setDefault() + obj.bgpSrteV6TunnelTlvSlice = append(obj.bgpSrteV6TunnelTlvSlice, newLibObj) + return newLibObj +} + +func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) Append(items ...BgpSrteV6TunnelTlv) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpSrteV6TunnelTlvSlice = append(obj.bgpSrteV6TunnelTlvSlice, item) + } + return obj +} + +func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) Set(index int, newObj BgpSrteV6TunnelTlv) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpSrteV6TunnelTlvSlice[index] = newObj + return obj +} +func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) Clear() BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpSrteV6TunnelTlv{} + obj.bgpSrteV6TunnelTlvSlice = []BgpSrteV6TunnelTlv{} + } + return obj +} +func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) clearHolderSlice() BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { + if len(obj.bgpSrteV6TunnelTlvSlice) > 0 { + obj.bgpSrteV6TunnelTlvSlice = []BgpSrteV6TunnelTlv{} + } + return obj +} +func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) appendHolderSlice(item BgpSrteV6TunnelTlv) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { + obj.bgpSrteV6TunnelTlvSlice = append(obj.bgpSrteV6TunnelTlvSlice, item) + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *bgpSrteV6Policy) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the BgpSrteV6Policy object +func (obj *bgpSrteV6Policy) SetName(value string) BgpSrteV6Policy { + + obj.obj.Name = &value + return obj +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// Active returns a bool +func (obj *bgpSrteV6Policy) Active() bool { + + return *obj.obj.Active + +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// Active returns a bool +func (obj *bgpSrteV6Policy) HasActive() bool { + return obj.obj.Active != nil +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// SetActive sets the bool value in the BgpSrteV6Policy object +func (obj *bgpSrteV6Policy) SetActive(value bool) BgpSrteV6Policy { + + obj.obj.Active = &value + return obj +} + +func (obj *bgpSrteV6Policy) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Ipv6Endpoint is required + if obj.obj.Ipv6Endpoint == nil { + vObj.validationErrors = append(vObj.validationErrors, "Ipv6Endpoint is required field on interface BgpSrteV6Policy") + } + if obj.obj.Ipv6Endpoint != nil { + + err := obj.validateIpv6(obj.Ipv6Endpoint()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteV6Policy.Ipv6Endpoint")) + } + + } + + if obj.obj.NextHopIpv4Address != nil { + + err := obj.validateIpv4(obj.NextHopIpv4Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteV6Policy.NextHopIpv4Address")) + } + + } + + if obj.obj.NextHopIpv6Address != nil { + + err := obj.validateIpv6(obj.NextHopIpv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteV6Policy.NextHopIpv6Address")) + } + + } + + if obj.obj.Advanced != nil { + + obj.Advanced().validateObj(vObj, set_default) + } + + if obj.obj.AddPath != nil { + + obj.AddPath().validateObj(vObj, set_default) + } + + if obj.obj.AsPath != nil { + + obj.AsPath().validateObj(vObj, set_default) + } + + if len(obj.obj.Communities) != 0 { + + if set_default { + obj.Communities().clearHolderSlice() + for _, item := range obj.obj.Communities { + obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) + } + } + for _, item := range obj.Communities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Extcommunities) != 0 { + + if set_default { + obj.Extcommunities().clearHolderSlice() + for _, item := range obj.obj.Extcommunities { + obj.Extcommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) + } + } + for _, item := range obj.Extcommunities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.TunnelTlvs) != 0 { + + if set_default { + obj.TunnelTlvs().clearHolderSlice() + for _, item := range obj.obj.TunnelTlvs { + obj.TunnelTlvs().appendHolderSlice(&bgpSrteV6TunnelTlv{obj: item}) + } + } + for _, item := range obj.TunnelTlvs().Items() { + item.validateObj(vObj, set_default) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpSrteV6Policy") + } +} + +func (obj *bgpSrteV6Policy) setDefault() { + if obj.obj.Distinguisher == nil { + obj.SetDistinguisher(1) + } + if obj.obj.Color == nil { + obj.SetColor(100) + } + if obj.obj.NextHopMode == nil { + obj.SetNextHopMode(BgpSrteV6PolicyNextHopMode.LOCAL_IP) + + } + if obj.obj.NextHopAddressType == nil { + obj.SetNextHopAddressType(BgpSrteV6PolicyNextHopAddressType.IPV6) + + } + if obj.obj.NextHopIpv4Address == nil { + obj.SetNextHopIpv4Address("0.0.0.0") + } + if obj.obj.NextHopIpv6Address == nil { + obj.SetNextHopIpv6Address("::0") + } + if obj.obj.Active == nil { + obj.SetActive(true) + } + +} diff --git a/gosnappi/bgp_srte_v6_tunnel_tlv.go b/gosnappi/bgp_srte_v6_tunnel_tlv.go new file mode 100644 index 00000000..11a7ed8c --- /dev/null +++ b/gosnappi/bgp_srte_v6_tunnel_tlv.go @@ -0,0 +1,746 @@ +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" +) + +// ***** BgpSrteV6TunnelTlv ***** +type bgpSrteV6TunnelTlv struct { + validation + obj *otg.BgpSrteV6TunnelTlv + marshaller marshalBgpSrteV6TunnelTlv + unMarshaller unMarshalBgpSrteV6TunnelTlv + remoteEndpointSubTlvHolder BgpSrteRemoteEndpointSubTlv + colorSubTlvHolder BgpSrteColorSubTlv + bindingSubTlvHolder BgpSrteBindingSubTlv + preferenceSubTlvHolder BgpSrtePreferenceSubTlv + policyPrioritySubTlvHolder BgpSrtePolicyPrioritySubTlv + policyNameSubTlvHolder BgpSrtePolicyNameSubTlv + explicitNullLabelPolicySubTlvHolder BgpSrteExplicitNullLabelPolicySubTlv + segmentListsHolder BgpSrteV6TunnelTlvBgpSrteSegmentListIter +} + +func NewBgpSrteV6TunnelTlv() BgpSrteV6TunnelTlv { + obj := bgpSrteV6TunnelTlv{obj: &otg.BgpSrteV6TunnelTlv{}} + obj.setDefault() + return &obj +} + +func (obj *bgpSrteV6TunnelTlv) msg() *otg.BgpSrteV6TunnelTlv { + return obj.obj +} + +func (obj *bgpSrteV6TunnelTlv) setMsg(msg *otg.BgpSrteV6TunnelTlv) BgpSrteV6TunnelTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpSrteV6TunnelTlv struct { + obj *bgpSrteV6TunnelTlv +} + +type marshalBgpSrteV6TunnelTlv interface { + // ToProto marshals BgpSrteV6TunnelTlv to protobuf object *otg.BgpSrteV6TunnelTlv + ToProto() (*otg.BgpSrteV6TunnelTlv, error) + // ToPbText marshals BgpSrteV6TunnelTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpSrteV6TunnelTlv to YAML text + ToYaml() (string, error) + // ToJson marshals BgpSrteV6TunnelTlv to JSON text + ToJson() (string, error) +} + +type unMarshalbgpSrteV6TunnelTlv struct { + obj *bgpSrteV6TunnelTlv +} + +type unMarshalBgpSrteV6TunnelTlv interface { + // FromProto unmarshals BgpSrteV6TunnelTlv from protobuf object *otg.BgpSrteV6TunnelTlv + FromProto(msg *otg.BgpSrteV6TunnelTlv) (BgpSrteV6TunnelTlv, error) + // FromPbText unmarshals BgpSrteV6TunnelTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpSrteV6TunnelTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpSrteV6TunnelTlv from JSON text + FromJson(value string) error +} + +func (obj *bgpSrteV6TunnelTlv) Marshal() marshalBgpSrteV6TunnelTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpSrteV6TunnelTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpSrteV6TunnelTlv) Unmarshal() unMarshalBgpSrteV6TunnelTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpSrteV6TunnelTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpSrteV6TunnelTlv) ToProto() (*otg.BgpSrteV6TunnelTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpSrteV6TunnelTlv) FromProto(msg *otg.BgpSrteV6TunnelTlv) (BgpSrteV6TunnelTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpSrteV6TunnelTlv) 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 *unMarshalbgpSrteV6TunnelTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpSrteV6TunnelTlv) 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 *unMarshalbgpSrteV6TunnelTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpSrteV6TunnelTlv) 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 *unMarshalbgpSrteV6TunnelTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpSrteV6TunnelTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpSrteV6TunnelTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpSrteV6TunnelTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpSrteV6TunnelTlv) Clone() (BgpSrteV6TunnelTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpSrteV6TunnelTlv() + 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 +} + +func (obj *bgpSrteV6TunnelTlv) setNil() { + obj.remoteEndpointSubTlvHolder = nil + obj.colorSubTlvHolder = nil + obj.bindingSubTlvHolder = nil + obj.preferenceSubTlvHolder = nil + obj.policyPrioritySubTlvHolder = nil + obj.policyNameSubTlvHolder = nil + obj.explicitNullLabelPolicySubTlvHolder = nil + obj.segmentListsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpSrteV6TunnelTlv is configuration for BGP SRTE Tunnel TLV. +type BgpSrteV6TunnelTlv interface { + Validation + // msg marshals BgpSrteV6TunnelTlv to protobuf object *otg.BgpSrteV6TunnelTlv + // and doesn't set defaults + msg() *otg.BgpSrteV6TunnelTlv + // setMsg unmarshals BgpSrteV6TunnelTlv from protobuf object *otg.BgpSrteV6TunnelTlv + // and doesn't set defaults + setMsg(*otg.BgpSrteV6TunnelTlv) BgpSrteV6TunnelTlv + // provides marshal interface + Marshal() marshalBgpSrteV6TunnelTlv + // provides unmarshal interface + Unmarshal() unMarshalBgpSrteV6TunnelTlv + // validate validates BgpSrteV6TunnelTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpSrteV6TunnelTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RemoteEndpointSubTlv returns BgpSrteRemoteEndpointSubTlv, set in BgpSrteV6TunnelTlv. + // BgpSrteRemoteEndpointSubTlv is configuration for the BGP remote endpoint sub TLV. + RemoteEndpointSubTlv() BgpSrteRemoteEndpointSubTlv + // SetRemoteEndpointSubTlv assigns BgpSrteRemoteEndpointSubTlv provided by user to BgpSrteV6TunnelTlv. + // BgpSrteRemoteEndpointSubTlv is configuration for the BGP remote endpoint sub TLV. + SetRemoteEndpointSubTlv(value BgpSrteRemoteEndpointSubTlv) BgpSrteV6TunnelTlv + // HasRemoteEndpointSubTlv checks if RemoteEndpointSubTlv has been set in BgpSrteV6TunnelTlv + HasRemoteEndpointSubTlv() bool + // ColorSubTlv returns BgpSrteColorSubTlv, set in BgpSrteV6TunnelTlv. + // BgpSrteColorSubTlv is configuration for the Policy Color attribute sub-TLV. The Color sub-TLV MAY be used as a way to "color" the corresponding Tunnel TLV. The Value field of the sub-TLV is eight octets long and consists of a Color Extended Community. First two octets of its Value field are 0x030b as type and subtype of extended community. Remaining six octets are are exposed to configure. + ColorSubTlv() BgpSrteColorSubTlv + // SetColorSubTlv assigns BgpSrteColorSubTlv provided by user to BgpSrteV6TunnelTlv. + // BgpSrteColorSubTlv is configuration for the Policy Color attribute sub-TLV. The Color sub-TLV MAY be used as a way to "color" the corresponding Tunnel TLV. The Value field of the sub-TLV is eight octets long and consists of a Color Extended Community. First two octets of its Value field are 0x030b as type and subtype of extended community. Remaining six octets are are exposed to configure. + SetColorSubTlv(value BgpSrteColorSubTlv) BgpSrteV6TunnelTlv + // HasColorSubTlv checks if ColorSubTlv has been set in BgpSrteV6TunnelTlv + HasColorSubTlv() bool + // BindingSubTlv returns BgpSrteBindingSubTlv, set in BgpSrteV6TunnelTlv. + // BgpSrteBindingSubTlv is configuration for the binding SID sub-TLV. This is used to signal the binding SID related information of the SR Policy candidate path. + BindingSubTlv() BgpSrteBindingSubTlv + // SetBindingSubTlv assigns BgpSrteBindingSubTlv provided by user to BgpSrteV6TunnelTlv. + // BgpSrteBindingSubTlv is configuration for the binding SID sub-TLV. This is used to signal the binding SID related information of the SR Policy candidate path. + SetBindingSubTlv(value BgpSrteBindingSubTlv) BgpSrteV6TunnelTlv + // HasBindingSubTlv checks if BindingSubTlv has been set in BgpSrteV6TunnelTlv + HasBindingSubTlv() bool + // PreferenceSubTlv returns BgpSrtePreferenceSubTlv, set in BgpSrteV6TunnelTlv. + // BgpSrtePreferenceSubTlv is configuration for BGP preference sub TLV of the SR Policy candidate path. + PreferenceSubTlv() BgpSrtePreferenceSubTlv + // SetPreferenceSubTlv assigns BgpSrtePreferenceSubTlv provided by user to BgpSrteV6TunnelTlv. + // BgpSrtePreferenceSubTlv is configuration for BGP preference sub TLV of the SR Policy candidate path. + SetPreferenceSubTlv(value BgpSrtePreferenceSubTlv) BgpSrteV6TunnelTlv + // HasPreferenceSubTlv checks if PreferenceSubTlv has been set in BgpSrteV6TunnelTlv + HasPreferenceSubTlv() bool + // PolicyPrioritySubTlv returns BgpSrtePolicyPrioritySubTlv, set in BgpSrteV6TunnelTlv. + // BgpSrtePolicyPrioritySubTlv is configuration for the Policy Priority sub-TLV. The Policy Priority to indicate the order in which the SR policies are re-computed upon topological change. + PolicyPrioritySubTlv() BgpSrtePolicyPrioritySubTlv + // SetPolicyPrioritySubTlv assigns BgpSrtePolicyPrioritySubTlv provided by user to BgpSrteV6TunnelTlv. + // BgpSrtePolicyPrioritySubTlv is configuration for the Policy Priority sub-TLV. The Policy Priority to indicate the order in which the SR policies are re-computed upon topological change. + SetPolicyPrioritySubTlv(value BgpSrtePolicyPrioritySubTlv) BgpSrteV6TunnelTlv + // HasPolicyPrioritySubTlv checks if PolicyPrioritySubTlv has been set in BgpSrteV6TunnelTlv + HasPolicyPrioritySubTlv() bool + // PolicyNameSubTlv returns BgpSrtePolicyNameSubTlv, set in BgpSrteV6TunnelTlv. + // BgpSrtePolicyNameSubTlv is configuration for the Policy Name sub-TLV. The Policy Name sub-TLV is used to attach a symbolic name to the SR Policy candidate path. + PolicyNameSubTlv() BgpSrtePolicyNameSubTlv + // SetPolicyNameSubTlv assigns BgpSrtePolicyNameSubTlv provided by user to BgpSrteV6TunnelTlv. + // BgpSrtePolicyNameSubTlv is configuration for the Policy Name sub-TLV. The Policy Name sub-TLV is used to attach a symbolic name to the SR Policy candidate path. + SetPolicyNameSubTlv(value BgpSrtePolicyNameSubTlv) BgpSrteV6TunnelTlv + // HasPolicyNameSubTlv checks if PolicyNameSubTlv has been set in BgpSrteV6TunnelTlv + HasPolicyNameSubTlv() bool + // ExplicitNullLabelPolicySubTlv returns BgpSrteExplicitNullLabelPolicySubTlv, set in BgpSrteV6TunnelTlv. + // BgpSrteExplicitNullLabelPolicySubTlv is configuration for BGP explicit null label policy sub TLV settings. + ExplicitNullLabelPolicySubTlv() BgpSrteExplicitNullLabelPolicySubTlv + // SetExplicitNullLabelPolicySubTlv assigns BgpSrteExplicitNullLabelPolicySubTlv provided by user to BgpSrteV6TunnelTlv. + // BgpSrteExplicitNullLabelPolicySubTlv is configuration for BGP explicit null label policy sub TLV settings. + SetExplicitNullLabelPolicySubTlv(value BgpSrteExplicitNullLabelPolicySubTlv) BgpSrteV6TunnelTlv + // HasExplicitNullLabelPolicySubTlv checks if ExplicitNullLabelPolicySubTlv has been set in BgpSrteV6TunnelTlv + HasExplicitNullLabelPolicySubTlv() bool + // SegmentLists returns BgpSrteV6TunnelTlvBgpSrteSegmentListIterIter, set in BgpSrteV6TunnelTlv + SegmentLists() BgpSrteV6TunnelTlvBgpSrteSegmentListIter + // Name returns string, set in BgpSrteV6TunnelTlv. + Name() string + // SetName assigns string provided by user to BgpSrteV6TunnelTlv + SetName(value string) BgpSrteV6TunnelTlv + // Active returns bool, set in BgpSrteV6TunnelTlv. + Active() bool + // SetActive assigns bool provided by user to BgpSrteV6TunnelTlv + SetActive(value bool) BgpSrteV6TunnelTlv + // HasActive checks if Active has been set in BgpSrteV6TunnelTlv + HasActive() bool + setNil() +} + +// description is TBD +// RemoteEndpointSubTlv returns a BgpSrteRemoteEndpointSubTlv +func (obj *bgpSrteV6TunnelTlv) RemoteEndpointSubTlv() BgpSrteRemoteEndpointSubTlv { + if obj.obj.RemoteEndpointSubTlv == nil { + obj.obj.RemoteEndpointSubTlv = NewBgpSrteRemoteEndpointSubTlv().msg() + } + if obj.remoteEndpointSubTlvHolder == nil { + obj.remoteEndpointSubTlvHolder = &bgpSrteRemoteEndpointSubTlv{obj: obj.obj.RemoteEndpointSubTlv} + } + return obj.remoteEndpointSubTlvHolder +} + +// description is TBD +// RemoteEndpointSubTlv returns a BgpSrteRemoteEndpointSubTlv +func (obj *bgpSrteV6TunnelTlv) HasRemoteEndpointSubTlv() bool { + return obj.obj.RemoteEndpointSubTlv != nil +} + +// description is TBD +// SetRemoteEndpointSubTlv sets the BgpSrteRemoteEndpointSubTlv value in the BgpSrteV6TunnelTlv object +func (obj *bgpSrteV6TunnelTlv) SetRemoteEndpointSubTlv(value BgpSrteRemoteEndpointSubTlv) BgpSrteV6TunnelTlv { + + obj.remoteEndpointSubTlvHolder = nil + obj.obj.RemoteEndpointSubTlv = value.msg() + + return obj +} + +// description is TBD +// ColorSubTlv returns a BgpSrteColorSubTlv +func (obj *bgpSrteV6TunnelTlv) ColorSubTlv() BgpSrteColorSubTlv { + if obj.obj.ColorSubTlv == nil { + obj.obj.ColorSubTlv = NewBgpSrteColorSubTlv().msg() + } + if obj.colorSubTlvHolder == nil { + obj.colorSubTlvHolder = &bgpSrteColorSubTlv{obj: obj.obj.ColorSubTlv} + } + return obj.colorSubTlvHolder +} + +// description is TBD +// ColorSubTlv returns a BgpSrteColorSubTlv +func (obj *bgpSrteV6TunnelTlv) HasColorSubTlv() bool { + return obj.obj.ColorSubTlv != nil +} + +// description is TBD +// SetColorSubTlv sets the BgpSrteColorSubTlv value in the BgpSrteV6TunnelTlv object +func (obj *bgpSrteV6TunnelTlv) SetColorSubTlv(value BgpSrteColorSubTlv) BgpSrteV6TunnelTlv { + + obj.colorSubTlvHolder = nil + obj.obj.ColorSubTlv = value.msg() + + return obj +} + +// description is TBD +// BindingSubTlv returns a BgpSrteBindingSubTlv +func (obj *bgpSrteV6TunnelTlv) BindingSubTlv() BgpSrteBindingSubTlv { + if obj.obj.BindingSubTlv == nil { + obj.obj.BindingSubTlv = NewBgpSrteBindingSubTlv().msg() + } + if obj.bindingSubTlvHolder == nil { + obj.bindingSubTlvHolder = &bgpSrteBindingSubTlv{obj: obj.obj.BindingSubTlv} + } + return obj.bindingSubTlvHolder +} + +// description is TBD +// BindingSubTlv returns a BgpSrteBindingSubTlv +func (obj *bgpSrteV6TunnelTlv) HasBindingSubTlv() bool { + return obj.obj.BindingSubTlv != nil +} + +// description is TBD +// SetBindingSubTlv sets the BgpSrteBindingSubTlv value in the BgpSrteV6TunnelTlv object +func (obj *bgpSrteV6TunnelTlv) SetBindingSubTlv(value BgpSrteBindingSubTlv) BgpSrteV6TunnelTlv { + + obj.bindingSubTlvHolder = nil + obj.obj.BindingSubTlv = value.msg() + + return obj +} + +// description is TBD +// PreferenceSubTlv returns a BgpSrtePreferenceSubTlv +func (obj *bgpSrteV6TunnelTlv) PreferenceSubTlv() BgpSrtePreferenceSubTlv { + if obj.obj.PreferenceSubTlv == nil { + obj.obj.PreferenceSubTlv = NewBgpSrtePreferenceSubTlv().msg() + } + if obj.preferenceSubTlvHolder == nil { + obj.preferenceSubTlvHolder = &bgpSrtePreferenceSubTlv{obj: obj.obj.PreferenceSubTlv} + } + return obj.preferenceSubTlvHolder +} + +// description is TBD +// PreferenceSubTlv returns a BgpSrtePreferenceSubTlv +func (obj *bgpSrteV6TunnelTlv) HasPreferenceSubTlv() bool { + return obj.obj.PreferenceSubTlv != nil +} + +// description is TBD +// SetPreferenceSubTlv sets the BgpSrtePreferenceSubTlv value in the BgpSrteV6TunnelTlv object +func (obj *bgpSrteV6TunnelTlv) SetPreferenceSubTlv(value BgpSrtePreferenceSubTlv) BgpSrteV6TunnelTlv { + + obj.preferenceSubTlvHolder = nil + obj.obj.PreferenceSubTlv = value.msg() + + return obj +} + +// description is TBD +// PolicyPrioritySubTlv returns a BgpSrtePolicyPrioritySubTlv +func (obj *bgpSrteV6TunnelTlv) PolicyPrioritySubTlv() BgpSrtePolicyPrioritySubTlv { + if obj.obj.PolicyPrioritySubTlv == nil { + obj.obj.PolicyPrioritySubTlv = NewBgpSrtePolicyPrioritySubTlv().msg() + } + if obj.policyPrioritySubTlvHolder == nil { + obj.policyPrioritySubTlvHolder = &bgpSrtePolicyPrioritySubTlv{obj: obj.obj.PolicyPrioritySubTlv} + } + return obj.policyPrioritySubTlvHolder +} + +// description is TBD +// PolicyPrioritySubTlv returns a BgpSrtePolicyPrioritySubTlv +func (obj *bgpSrteV6TunnelTlv) HasPolicyPrioritySubTlv() bool { + return obj.obj.PolicyPrioritySubTlv != nil +} + +// description is TBD +// SetPolicyPrioritySubTlv sets the BgpSrtePolicyPrioritySubTlv value in the BgpSrteV6TunnelTlv object +func (obj *bgpSrteV6TunnelTlv) SetPolicyPrioritySubTlv(value BgpSrtePolicyPrioritySubTlv) BgpSrteV6TunnelTlv { + + obj.policyPrioritySubTlvHolder = nil + obj.obj.PolicyPrioritySubTlv = value.msg() + + return obj +} + +// description is TBD +// PolicyNameSubTlv returns a BgpSrtePolicyNameSubTlv +func (obj *bgpSrteV6TunnelTlv) PolicyNameSubTlv() BgpSrtePolicyNameSubTlv { + if obj.obj.PolicyNameSubTlv == nil { + obj.obj.PolicyNameSubTlv = NewBgpSrtePolicyNameSubTlv().msg() + } + if obj.policyNameSubTlvHolder == nil { + obj.policyNameSubTlvHolder = &bgpSrtePolicyNameSubTlv{obj: obj.obj.PolicyNameSubTlv} + } + return obj.policyNameSubTlvHolder +} + +// description is TBD +// PolicyNameSubTlv returns a BgpSrtePolicyNameSubTlv +func (obj *bgpSrteV6TunnelTlv) HasPolicyNameSubTlv() bool { + return obj.obj.PolicyNameSubTlv != nil +} + +// description is TBD +// SetPolicyNameSubTlv sets the BgpSrtePolicyNameSubTlv value in the BgpSrteV6TunnelTlv object +func (obj *bgpSrteV6TunnelTlv) SetPolicyNameSubTlv(value BgpSrtePolicyNameSubTlv) BgpSrteV6TunnelTlv { + + obj.policyNameSubTlvHolder = nil + obj.obj.PolicyNameSubTlv = value.msg() + + return obj +} + +// description is TBD +// ExplicitNullLabelPolicySubTlv returns a BgpSrteExplicitNullLabelPolicySubTlv +func (obj *bgpSrteV6TunnelTlv) ExplicitNullLabelPolicySubTlv() BgpSrteExplicitNullLabelPolicySubTlv { + if obj.obj.ExplicitNullLabelPolicySubTlv == nil { + obj.obj.ExplicitNullLabelPolicySubTlv = NewBgpSrteExplicitNullLabelPolicySubTlv().msg() + } + if obj.explicitNullLabelPolicySubTlvHolder == nil { + obj.explicitNullLabelPolicySubTlvHolder = &bgpSrteExplicitNullLabelPolicySubTlv{obj: obj.obj.ExplicitNullLabelPolicySubTlv} + } + return obj.explicitNullLabelPolicySubTlvHolder +} + +// description is TBD +// ExplicitNullLabelPolicySubTlv returns a BgpSrteExplicitNullLabelPolicySubTlv +func (obj *bgpSrteV6TunnelTlv) HasExplicitNullLabelPolicySubTlv() bool { + return obj.obj.ExplicitNullLabelPolicySubTlv != nil +} + +// description is TBD +// SetExplicitNullLabelPolicySubTlv sets the BgpSrteExplicitNullLabelPolicySubTlv value in the BgpSrteV6TunnelTlv object +func (obj *bgpSrteV6TunnelTlv) SetExplicitNullLabelPolicySubTlv(value BgpSrteExplicitNullLabelPolicySubTlv) BgpSrteV6TunnelTlv { + + obj.explicitNullLabelPolicySubTlvHolder = nil + obj.obj.ExplicitNullLabelPolicySubTlv = value.msg() + + return obj +} + +// description is TBD +// SegmentLists returns a []BgpSrteSegmentList +func (obj *bgpSrteV6TunnelTlv) SegmentLists() BgpSrteV6TunnelTlvBgpSrteSegmentListIter { + if len(obj.obj.SegmentLists) == 0 { + obj.obj.SegmentLists = []*otg.BgpSrteSegmentList{} + } + if obj.segmentListsHolder == nil { + obj.segmentListsHolder = newBgpSrteV6TunnelTlvBgpSrteSegmentListIter(&obj.obj.SegmentLists).setMsg(obj) + } + return obj.segmentListsHolder +} + +type bgpSrteV6TunnelTlvBgpSrteSegmentListIter struct { + obj *bgpSrteV6TunnelTlv + bgpSrteSegmentListSlice []BgpSrteSegmentList + fieldPtr *[]*otg.BgpSrteSegmentList +} + +func newBgpSrteV6TunnelTlvBgpSrteSegmentListIter(ptr *[]*otg.BgpSrteSegmentList) BgpSrteV6TunnelTlvBgpSrteSegmentListIter { + return &bgpSrteV6TunnelTlvBgpSrteSegmentListIter{fieldPtr: ptr} +} + +type BgpSrteV6TunnelTlvBgpSrteSegmentListIter interface { + setMsg(*bgpSrteV6TunnelTlv) BgpSrteV6TunnelTlvBgpSrteSegmentListIter + Items() []BgpSrteSegmentList + Add() BgpSrteSegmentList + Append(items ...BgpSrteSegmentList) BgpSrteV6TunnelTlvBgpSrteSegmentListIter + Set(index int, newObj BgpSrteSegmentList) BgpSrteV6TunnelTlvBgpSrteSegmentListIter + Clear() BgpSrteV6TunnelTlvBgpSrteSegmentListIter + clearHolderSlice() BgpSrteV6TunnelTlvBgpSrteSegmentListIter + appendHolderSlice(item BgpSrteSegmentList) BgpSrteV6TunnelTlvBgpSrteSegmentListIter +} + +func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) setMsg(msg *bgpSrteV6TunnelTlv) BgpSrteV6TunnelTlvBgpSrteSegmentListIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpSrteSegmentList{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) Items() []BgpSrteSegmentList { + return obj.bgpSrteSegmentListSlice +} + +func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) Add() BgpSrteSegmentList { + newObj := &otg.BgpSrteSegmentList{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpSrteSegmentList{obj: newObj} + newLibObj.setDefault() + obj.bgpSrteSegmentListSlice = append(obj.bgpSrteSegmentListSlice, newLibObj) + return newLibObj +} + +func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) Append(items ...BgpSrteSegmentList) BgpSrteV6TunnelTlvBgpSrteSegmentListIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpSrteSegmentListSlice = append(obj.bgpSrteSegmentListSlice, item) + } + return obj +} + +func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) Set(index int, newObj BgpSrteSegmentList) BgpSrteV6TunnelTlvBgpSrteSegmentListIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpSrteSegmentListSlice[index] = newObj + return obj +} +func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) Clear() BgpSrteV6TunnelTlvBgpSrteSegmentListIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpSrteSegmentList{} + obj.bgpSrteSegmentListSlice = []BgpSrteSegmentList{} + } + return obj +} +func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) clearHolderSlice() BgpSrteV6TunnelTlvBgpSrteSegmentListIter { + if len(obj.bgpSrteSegmentListSlice) > 0 { + obj.bgpSrteSegmentListSlice = []BgpSrteSegmentList{} + } + return obj +} +func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) appendHolderSlice(item BgpSrteSegmentList) BgpSrteV6TunnelTlvBgpSrteSegmentListIter { + obj.bgpSrteSegmentListSlice = append(obj.bgpSrteSegmentListSlice, item) + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *bgpSrteV6TunnelTlv) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the BgpSrteV6TunnelTlv object +func (obj *bgpSrteV6TunnelTlv) SetName(value string) BgpSrteV6TunnelTlv { + + obj.obj.Name = &value + return obj +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// Active returns a bool +func (obj *bgpSrteV6TunnelTlv) Active() bool { + + return *obj.obj.Active + +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// Active returns a bool +func (obj *bgpSrteV6TunnelTlv) HasActive() bool { + return obj.obj.Active != nil +} + +// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. +// SetActive sets the bool value in the BgpSrteV6TunnelTlv object +func (obj *bgpSrteV6TunnelTlv) SetActive(value bool) BgpSrteV6TunnelTlv { + + obj.obj.Active = &value + return obj +} + +func (obj *bgpSrteV6TunnelTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RemoteEndpointSubTlv != nil { + + obj.RemoteEndpointSubTlv().validateObj(vObj, set_default) + } + + if obj.obj.ColorSubTlv != nil { + + obj.ColorSubTlv().validateObj(vObj, set_default) + } + + if obj.obj.BindingSubTlv != nil { + + obj.BindingSubTlv().validateObj(vObj, set_default) + } + + if obj.obj.PreferenceSubTlv != nil { + + obj.PreferenceSubTlv().validateObj(vObj, set_default) + } + + if obj.obj.PolicyPrioritySubTlv != nil { + + obj.PolicyPrioritySubTlv().validateObj(vObj, set_default) + } + + if obj.obj.PolicyNameSubTlv != nil { + + obj.PolicyNameSubTlv().validateObj(vObj, set_default) + } + + if obj.obj.ExplicitNullLabelPolicySubTlv != nil { + + obj.ExplicitNullLabelPolicySubTlv().validateObj(vObj, set_default) + } + + if len(obj.obj.SegmentLists) != 0 { + + if set_default { + obj.SegmentLists().clearHolderSlice() + for _, item := range obj.obj.SegmentLists { + obj.SegmentLists().appendHolderSlice(&bgpSrteSegmentList{obj: item}) + } + } + for _, item := range obj.SegmentLists().Items() { + item.validateObj(vObj, set_default) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpSrteV6TunnelTlv") + } +} + +func (obj *bgpSrteV6TunnelTlv) setDefault() { + if obj.obj.Active == nil { + obj.SetActive(true) + } + +} diff --git a/gosnappi/bgp_structured_pdus.go b/gosnappi/bgp_structured_pdus.go new file mode 100644 index 00000000..85996700 --- /dev/null +++ b/gosnappi/bgp_structured_pdus.go @@ -0,0 +1,390 @@ +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" +) + +// ***** BgpStructuredPdus ***** +type bgpStructuredPdus struct { + validation + obj *otg.BgpStructuredPdus + marshaller marshalBgpStructuredPdus + unMarshaller unMarshalBgpStructuredPdus + updatesHolder BgpStructuredPdusBgpOneStructuredUpdateReplayIter +} + +func NewBgpStructuredPdus() BgpStructuredPdus { + obj := bgpStructuredPdus{obj: &otg.BgpStructuredPdus{}} + obj.setDefault() + return &obj +} + +func (obj *bgpStructuredPdus) msg() *otg.BgpStructuredPdus { + return obj.obj +} + +func (obj *bgpStructuredPdus) setMsg(msg *otg.BgpStructuredPdus) BgpStructuredPdus { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpStructuredPdus struct { + obj *bgpStructuredPdus +} + +type marshalBgpStructuredPdus interface { + // ToProto marshals BgpStructuredPdus to protobuf object *otg.BgpStructuredPdus + ToProto() (*otg.BgpStructuredPdus, error) + // ToPbText marshals BgpStructuredPdus to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpStructuredPdus to YAML text + ToYaml() (string, error) + // ToJson marshals BgpStructuredPdus to JSON text + ToJson() (string, error) +} + +type unMarshalbgpStructuredPdus struct { + obj *bgpStructuredPdus +} + +type unMarshalBgpStructuredPdus interface { + // FromProto unmarshals BgpStructuredPdus from protobuf object *otg.BgpStructuredPdus + FromProto(msg *otg.BgpStructuredPdus) (BgpStructuredPdus, error) + // FromPbText unmarshals BgpStructuredPdus from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpStructuredPdus from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpStructuredPdus from JSON text + FromJson(value string) error +} + +func (obj *bgpStructuredPdus) Marshal() marshalBgpStructuredPdus { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpStructuredPdus{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpStructuredPdus) Unmarshal() unMarshalBgpStructuredPdus { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpStructuredPdus{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpStructuredPdus) ToProto() (*otg.BgpStructuredPdus, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpStructuredPdus) FromProto(msg *otg.BgpStructuredPdus) (BgpStructuredPdus, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpStructuredPdus) 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 *unMarshalbgpStructuredPdus) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpStructuredPdus) 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 *unMarshalbgpStructuredPdus) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpStructuredPdus) 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 *unMarshalbgpStructuredPdus) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpStructuredPdus) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpStructuredPdus) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpStructuredPdus) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpStructuredPdus) Clone() (BgpStructuredPdus, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpStructuredPdus() + 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 +} + +func (obj *bgpStructuredPdus) setNil() { + obj.updatesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpStructuredPdus is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. +type BgpStructuredPdus interface { + Validation + // msg marshals BgpStructuredPdus to protobuf object *otg.BgpStructuredPdus + // and doesn't set defaults + msg() *otg.BgpStructuredPdus + // setMsg unmarshals BgpStructuredPdus from protobuf object *otg.BgpStructuredPdus + // and doesn't set defaults + setMsg(*otg.BgpStructuredPdus) BgpStructuredPdus + // provides marshal interface + Marshal() marshalBgpStructuredPdus + // provides unmarshal interface + Unmarshal() unMarshalBgpStructuredPdus + // validate validates BgpStructuredPdus + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpStructuredPdus, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Updates returns BgpStructuredPdusBgpOneStructuredUpdateReplayIterIter, set in BgpStructuredPdus + Updates() BgpStructuredPdusBgpOneStructuredUpdateReplayIter + setNil() +} + +// Array of ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. +// Updates returns a []BgpOneStructuredUpdateReplay +func (obj *bgpStructuredPdus) Updates() BgpStructuredPdusBgpOneStructuredUpdateReplayIter { + if len(obj.obj.Updates) == 0 { + obj.obj.Updates = []*otg.BgpOneStructuredUpdateReplay{} + } + if obj.updatesHolder == nil { + obj.updatesHolder = newBgpStructuredPdusBgpOneStructuredUpdateReplayIter(&obj.obj.Updates).setMsg(obj) + } + return obj.updatesHolder +} + +type bgpStructuredPdusBgpOneStructuredUpdateReplayIter struct { + obj *bgpStructuredPdus + bgpOneStructuredUpdateReplaySlice []BgpOneStructuredUpdateReplay + fieldPtr *[]*otg.BgpOneStructuredUpdateReplay +} + +func newBgpStructuredPdusBgpOneStructuredUpdateReplayIter(ptr *[]*otg.BgpOneStructuredUpdateReplay) BgpStructuredPdusBgpOneStructuredUpdateReplayIter { + return &bgpStructuredPdusBgpOneStructuredUpdateReplayIter{fieldPtr: ptr} +} + +type BgpStructuredPdusBgpOneStructuredUpdateReplayIter interface { + setMsg(*bgpStructuredPdus) BgpStructuredPdusBgpOneStructuredUpdateReplayIter + Items() []BgpOneStructuredUpdateReplay + Add() BgpOneStructuredUpdateReplay + Append(items ...BgpOneStructuredUpdateReplay) BgpStructuredPdusBgpOneStructuredUpdateReplayIter + Set(index int, newObj BgpOneStructuredUpdateReplay) BgpStructuredPdusBgpOneStructuredUpdateReplayIter + Clear() BgpStructuredPdusBgpOneStructuredUpdateReplayIter + clearHolderSlice() BgpStructuredPdusBgpOneStructuredUpdateReplayIter + appendHolderSlice(item BgpOneStructuredUpdateReplay) BgpStructuredPdusBgpOneStructuredUpdateReplayIter +} + +func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) setMsg(msg *bgpStructuredPdus) BgpStructuredPdusBgpOneStructuredUpdateReplayIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpOneStructuredUpdateReplay{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) Items() []BgpOneStructuredUpdateReplay { + return obj.bgpOneStructuredUpdateReplaySlice +} + +func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) Add() BgpOneStructuredUpdateReplay { + newObj := &otg.BgpOneStructuredUpdateReplay{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpOneStructuredUpdateReplay{obj: newObj} + newLibObj.setDefault() + obj.bgpOneStructuredUpdateReplaySlice = append(obj.bgpOneStructuredUpdateReplaySlice, newLibObj) + return newLibObj +} + +func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) Append(items ...BgpOneStructuredUpdateReplay) BgpStructuredPdusBgpOneStructuredUpdateReplayIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpOneStructuredUpdateReplaySlice = append(obj.bgpOneStructuredUpdateReplaySlice, item) + } + return obj +} + +func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) Set(index int, newObj BgpOneStructuredUpdateReplay) BgpStructuredPdusBgpOneStructuredUpdateReplayIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpOneStructuredUpdateReplaySlice[index] = newObj + return obj +} +func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) Clear() BgpStructuredPdusBgpOneStructuredUpdateReplayIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpOneStructuredUpdateReplay{} + obj.bgpOneStructuredUpdateReplaySlice = []BgpOneStructuredUpdateReplay{} + } + return obj +} +func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) clearHolderSlice() BgpStructuredPdusBgpOneStructuredUpdateReplayIter { + if len(obj.bgpOneStructuredUpdateReplaySlice) > 0 { + obj.bgpOneStructuredUpdateReplaySlice = []BgpOneStructuredUpdateReplay{} + } + return obj +} +func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) appendHolderSlice(item BgpOneStructuredUpdateReplay) BgpStructuredPdusBgpOneStructuredUpdateReplayIter { + obj.bgpOneStructuredUpdateReplaySlice = append(obj.bgpOneStructuredUpdateReplaySlice, item) + return obj +} + +func (obj *bgpStructuredPdus) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Updates) != 0 { + + if set_default { + obj.Updates().clearHolderSlice() + for _, item := range obj.obj.Updates { + obj.Updates().appendHolderSlice(&bgpOneStructuredUpdateReplay{obj: item}) + } + } + for _, item := range obj.Updates().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpStructuredPdus) setDefault() { + +} diff --git a/gosnappi/bgp_update_replay.go b/gosnappi/bgp_update_replay.go new file mode 100644 index 00000000..38c930ca --- /dev/null +++ b/gosnappi/bgp_update_replay.go @@ -0,0 +1,452 @@ +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" +) + +// ***** BgpUpdateReplay ***** +type bgpUpdateReplay struct { + validation + obj *otg.BgpUpdateReplay + marshaller marshalBgpUpdateReplay + unMarshaller unMarshalBgpUpdateReplay + structuredPdusHolder BgpStructuredPdus + rawBytesHolder BgpRawBytes +} + +func NewBgpUpdateReplay() BgpUpdateReplay { + obj := bgpUpdateReplay{obj: &otg.BgpUpdateReplay{}} + obj.setDefault() + return &obj +} + +func (obj *bgpUpdateReplay) msg() *otg.BgpUpdateReplay { + return obj.obj +} + +func (obj *bgpUpdateReplay) setMsg(msg *otg.BgpUpdateReplay) BgpUpdateReplay { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpUpdateReplay struct { + obj *bgpUpdateReplay +} + +type marshalBgpUpdateReplay interface { + // ToProto marshals BgpUpdateReplay to protobuf object *otg.BgpUpdateReplay + ToProto() (*otg.BgpUpdateReplay, error) + // ToPbText marshals BgpUpdateReplay to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpUpdateReplay to YAML text + ToYaml() (string, error) + // ToJson marshals BgpUpdateReplay to JSON text + ToJson() (string, error) +} + +type unMarshalbgpUpdateReplay struct { + obj *bgpUpdateReplay +} + +type unMarshalBgpUpdateReplay interface { + // FromProto unmarshals BgpUpdateReplay from protobuf object *otg.BgpUpdateReplay + FromProto(msg *otg.BgpUpdateReplay) (BgpUpdateReplay, error) + // FromPbText unmarshals BgpUpdateReplay from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpUpdateReplay from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpUpdateReplay from JSON text + FromJson(value string) error +} + +func (obj *bgpUpdateReplay) Marshal() marshalBgpUpdateReplay { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpUpdateReplay{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpUpdateReplay) Unmarshal() unMarshalBgpUpdateReplay { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpUpdateReplay{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpUpdateReplay) ToProto() (*otg.BgpUpdateReplay, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpUpdateReplay) FromProto(msg *otg.BgpUpdateReplay) (BgpUpdateReplay, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpUpdateReplay) 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 *unMarshalbgpUpdateReplay) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpUpdateReplay) 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 *unMarshalbgpUpdateReplay) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpUpdateReplay) 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 *unMarshalbgpUpdateReplay) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpUpdateReplay) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpUpdateReplay) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpUpdateReplay) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpUpdateReplay) Clone() (BgpUpdateReplay, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpUpdateReplay() + 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 +} + +func (obj *bgpUpdateReplay) setNil() { + obj.structuredPdusHolder = nil + obj.rawBytesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpUpdateReplay is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. +type BgpUpdateReplay interface { + Validation + // msg marshals BgpUpdateReplay to protobuf object *otg.BgpUpdateReplay + // and doesn't set defaults + msg() *otg.BgpUpdateReplay + // setMsg unmarshals BgpUpdateReplay from protobuf object *otg.BgpUpdateReplay + // and doesn't set defaults + setMsg(*otg.BgpUpdateReplay) BgpUpdateReplay + // provides marshal interface + Marshal() marshalBgpUpdateReplay + // provides unmarshal interface + Unmarshal() unMarshalBgpUpdateReplay + // validate validates BgpUpdateReplay + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpUpdateReplay, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpUpdateReplayChoiceEnum, set in BgpUpdateReplay + Choice() BgpUpdateReplayChoiceEnum + // setChoice assigns BgpUpdateReplayChoiceEnum provided by user to BgpUpdateReplay + setChoice(value BgpUpdateReplayChoiceEnum) BgpUpdateReplay + // HasChoice checks if Choice has been set in BgpUpdateReplay + HasChoice() bool + // StructuredPdus returns BgpStructuredPdus, set in BgpUpdateReplay. + // BgpStructuredPdus is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. + StructuredPdus() BgpStructuredPdus + // SetStructuredPdus assigns BgpStructuredPdus provided by user to BgpUpdateReplay. + // BgpStructuredPdus is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. + SetStructuredPdus(value BgpStructuredPdus) BgpUpdateReplay + // HasStructuredPdus checks if StructuredPdus has been set in BgpUpdateReplay + HasStructuredPdus() bool + // RawBytes returns BgpRawBytes, set in BgpUpdateReplay. + // BgpRawBytes is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. + RawBytes() BgpRawBytes + // SetRawBytes assigns BgpRawBytes provided by user to BgpUpdateReplay. + // BgpRawBytes is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. + SetRawBytes(value BgpRawBytes) BgpUpdateReplay + // HasRawBytes checks if RawBytes has been set in BgpUpdateReplay + HasRawBytes() bool + setNil() +} + +type BgpUpdateReplayChoiceEnum string + +// Enum of Choice on BgpUpdateReplay +var BgpUpdateReplayChoice = struct { + STRUCTURED_PDUS BgpUpdateReplayChoiceEnum + RAW_BYTES BgpUpdateReplayChoiceEnum +}{ + STRUCTURED_PDUS: BgpUpdateReplayChoiceEnum("structured_pdus"), + RAW_BYTES: BgpUpdateReplayChoiceEnum("raw_bytes"), +} + +func (obj *bgpUpdateReplay) Choice() BgpUpdateReplayChoiceEnum { + return BgpUpdateReplayChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *bgpUpdateReplay) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpUpdateReplay) setChoice(value BgpUpdateReplayChoiceEnum) BgpUpdateReplay { + intValue, ok := otg.BgpUpdateReplay_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpUpdateReplayChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpUpdateReplay_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.RawBytes = nil + obj.rawBytesHolder = nil + obj.obj.StructuredPdus = nil + obj.structuredPdusHolder = nil + + if value == BgpUpdateReplayChoice.STRUCTURED_PDUS { + obj.obj.StructuredPdus = NewBgpStructuredPdus().msg() + } + + if value == BgpUpdateReplayChoice.RAW_BYTES { + obj.obj.RawBytes = NewBgpRawBytes().msg() + } + + return obj +} + +// description is TBD +// StructuredPdus returns a BgpStructuredPdus +func (obj *bgpUpdateReplay) StructuredPdus() BgpStructuredPdus { + if obj.obj.StructuredPdus == nil { + obj.setChoice(BgpUpdateReplayChoice.STRUCTURED_PDUS) + } + if obj.structuredPdusHolder == nil { + obj.structuredPdusHolder = &bgpStructuredPdus{obj: obj.obj.StructuredPdus} + } + return obj.structuredPdusHolder +} + +// description is TBD +// StructuredPdus returns a BgpStructuredPdus +func (obj *bgpUpdateReplay) HasStructuredPdus() bool { + return obj.obj.StructuredPdus != nil +} + +// description is TBD +// SetStructuredPdus sets the BgpStructuredPdus value in the BgpUpdateReplay object +func (obj *bgpUpdateReplay) SetStructuredPdus(value BgpStructuredPdus) BgpUpdateReplay { + obj.setChoice(BgpUpdateReplayChoice.STRUCTURED_PDUS) + obj.structuredPdusHolder = nil + obj.obj.StructuredPdus = value.msg() + + return obj +} + +// description is TBD +// RawBytes returns a BgpRawBytes +func (obj *bgpUpdateReplay) RawBytes() BgpRawBytes { + if obj.obj.RawBytes == nil { + obj.setChoice(BgpUpdateReplayChoice.RAW_BYTES) + } + if obj.rawBytesHolder == nil { + obj.rawBytesHolder = &bgpRawBytes{obj: obj.obj.RawBytes} + } + return obj.rawBytesHolder +} + +// description is TBD +// RawBytes returns a BgpRawBytes +func (obj *bgpUpdateReplay) HasRawBytes() bool { + return obj.obj.RawBytes != nil +} + +// description is TBD +// SetRawBytes sets the BgpRawBytes value in the BgpUpdateReplay object +func (obj *bgpUpdateReplay) SetRawBytes(value BgpRawBytes) BgpUpdateReplay { + obj.setChoice(BgpUpdateReplayChoice.RAW_BYTES) + obj.rawBytesHolder = nil + obj.obj.RawBytes = value.msg() + + return obj +} + +func (obj *bgpUpdateReplay) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.StructuredPdus != nil { + + obj.StructuredPdus().validateObj(vObj, set_default) + } + + if obj.obj.RawBytes != nil { + + obj.RawBytes().validateObj(vObj, set_default) + } + +} + +func (obj *bgpUpdateReplay) setDefault() { + var choices_set int = 0 + var choice BgpUpdateReplayChoiceEnum + + if obj.obj.StructuredPdus != nil { + choices_set += 1 + choice = BgpUpdateReplayChoice.STRUCTURED_PDUS + } + + if obj.obj.RawBytes != nil { + choices_set += 1 + choice = BgpUpdateReplayChoice.RAW_BYTES + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(BgpUpdateReplayChoice.STRUCTURED_PDUS) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpUpdateReplay") + } + } else { + intVal := otg.BgpUpdateReplay_Choice_Enum_value[string(choice)] + enumValue := otg.BgpUpdateReplay_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_v4_ethernet_segment.go b/gosnappi/bgp_v4_ethernet_segment.go new file mode 100644 index 00000000..87bed70b --- /dev/null +++ b/gosnappi/bgp_v4_ethernet_segment.go @@ -0,0 +1,856 @@ +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" +) + +// ***** BgpV4EthernetSegment ***** +type bgpV4EthernetSegment struct { + validation + obj *otg.BgpV4EthernetSegment + marshaller marshalBgpV4EthernetSegment + unMarshaller unMarshalBgpV4EthernetSegment + dfElectionHolder BgpEthernetSegmentDfElection + evisHolder BgpV4EthernetSegmentBgpV4EvpnEvisIter + advancedHolder BgpRouteAdvanced + communitiesHolder BgpV4EthernetSegmentBgpCommunityIter + extCommunitiesHolder BgpV4EthernetSegmentBgpExtCommunityIter + asPathHolder BgpAsPath +} + +func NewBgpV4EthernetSegment() BgpV4EthernetSegment { + obj := bgpV4EthernetSegment{obj: &otg.BgpV4EthernetSegment{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV4EthernetSegment) msg() *otg.BgpV4EthernetSegment { + return obj.obj +} + +func (obj *bgpV4EthernetSegment) setMsg(msg *otg.BgpV4EthernetSegment) BgpV4EthernetSegment { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV4EthernetSegment struct { + obj *bgpV4EthernetSegment +} + +type marshalBgpV4EthernetSegment interface { + // ToProto marshals BgpV4EthernetSegment to protobuf object *otg.BgpV4EthernetSegment + ToProto() (*otg.BgpV4EthernetSegment, error) + // ToPbText marshals BgpV4EthernetSegment to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV4EthernetSegment to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV4EthernetSegment to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV4EthernetSegment struct { + obj *bgpV4EthernetSegment +} + +type unMarshalBgpV4EthernetSegment interface { + // FromProto unmarshals BgpV4EthernetSegment from protobuf object *otg.BgpV4EthernetSegment + FromProto(msg *otg.BgpV4EthernetSegment) (BgpV4EthernetSegment, error) + // FromPbText unmarshals BgpV4EthernetSegment from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV4EthernetSegment from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV4EthernetSegment from JSON text + FromJson(value string) error +} + +func (obj *bgpV4EthernetSegment) Marshal() marshalBgpV4EthernetSegment { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV4EthernetSegment{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV4EthernetSegment) Unmarshal() unMarshalBgpV4EthernetSegment { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV4EthernetSegment{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV4EthernetSegment) ToProto() (*otg.BgpV4EthernetSegment, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV4EthernetSegment) FromProto(msg *otg.BgpV4EthernetSegment) (BgpV4EthernetSegment, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV4EthernetSegment) 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 *unMarshalbgpV4EthernetSegment) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpV4EthernetSegment) 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 *unMarshalbgpV4EthernetSegment) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpV4EthernetSegment) 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 *unMarshalbgpV4EthernetSegment) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpV4EthernetSegment) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV4EthernetSegment) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV4EthernetSegment) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV4EthernetSegment) Clone() (BgpV4EthernetSegment, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV4EthernetSegment() + 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 +} + +func (obj *bgpV4EthernetSegment) setNil() { + obj.dfElectionHolder = nil + obj.evisHolder = nil + obj.advancedHolder = nil + obj.communitiesHolder = nil + obj.extCommunitiesHolder = nil + obj.asPathHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpV4EthernetSegment is configuration for BGP Ethernet Segment ranges. Advertises following routes - +// +// Type 4 - Ethernet Segment Route +type BgpV4EthernetSegment interface { + Validation + // msg marshals BgpV4EthernetSegment to protobuf object *otg.BgpV4EthernetSegment + // and doesn't set defaults + msg() *otg.BgpV4EthernetSegment + // setMsg unmarshals BgpV4EthernetSegment from protobuf object *otg.BgpV4EthernetSegment + // and doesn't set defaults + setMsg(*otg.BgpV4EthernetSegment) BgpV4EthernetSegment + // provides marshal interface + Marshal() marshalBgpV4EthernetSegment + // provides unmarshal interface + Unmarshal() unMarshalBgpV4EthernetSegment + // validate validates BgpV4EthernetSegment + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV4EthernetSegment, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // DfElection returns BgpEthernetSegmentDfElection, set in BgpV4EthernetSegment. + // BgpEthernetSegmentDfElection is configuration for Designated Forwarder (DF) election among the Provider Edge (PE) routers on the same Ethernet Segment. + DfElection() BgpEthernetSegmentDfElection + // SetDfElection assigns BgpEthernetSegmentDfElection provided by user to BgpV4EthernetSegment. + // BgpEthernetSegmentDfElection is configuration for Designated Forwarder (DF) election among the Provider Edge (PE) routers on the same Ethernet Segment. + SetDfElection(value BgpEthernetSegmentDfElection) BgpV4EthernetSegment + // HasDfElection checks if DfElection has been set in BgpV4EthernetSegment + HasDfElection() bool + // Evis returns BgpV4EthernetSegmentBgpV4EvpnEvisIterIter, set in BgpV4EthernetSegment + Evis() BgpV4EthernetSegmentBgpV4EvpnEvisIter + // Esi returns string, set in BgpV4EthernetSegment. + Esi() string + // SetEsi assigns string provided by user to BgpV4EthernetSegment + SetEsi(value string) BgpV4EthernetSegment + // HasEsi checks if Esi has been set in BgpV4EthernetSegment + HasEsi() bool + // ActiveMode returns BgpV4EthernetSegmentActiveModeEnum, set in BgpV4EthernetSegment + ActiveMode() BgpV4EthernetSegmentActiveModeEnum + // SetActiveMode assigns BgpV4EthernetSegmentActiveModeEnum provided by user to BgpV4EthernetSegment + SetActiveMode(value BgpV4EthernetSegmentActiveModeEnum) BgpV4EthernetSegment + // HasActiveMode checks if ActiveMode has been set in BgpV4EthernetSegment + HasActiveMode() bool + // EsiLabel returns uint32, set in BgpV4EthernetSegment. + EsiLabel() uint32 + // SetEsiLabel assigns uint32 provided by user to BgpV4EthernetSegment + SetEsiLabel(value uint32) BgpV4EthernetSegment + // HasEsiLabel checks if EsiLabel has been set in BgpV4EthernetSegment + HasEsiLabel() bool + // Advanced returns BgpRouteAdvanced, set in BgpV4EthernetSegment. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + Advanced() BgpRouteAdvanced + // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpV4EthernetSegment. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + SetAdvanced(value BgpRouteAdvanced) BgpV4EthernetSegment + // HasAdvanced checks if Advanced has been set in BgpV4EthernetSegment + HasAdvanced() bool + // Communities returns BgpV4EthernetSegmentBgpCommunityIterIter, set in BgpV4EthernetSegment + Communities() BgpV4EthernetSegmentBgpCommunityIter + // ExtCommunities returns BgpV4EthernetSegmentBgpExtCommunityIterIter, set in BgpV4EthernetSegment + ExtCommunities() BgpV4EthernetSegmentBgpExtCommunityIter + // AsPath returns BgpAsPath, set in BgpV4EthernetSegment. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + AsPath() BgpAsPath + // SetAsPath assigns BgpAsPath provided by user to BgpV4EthernetSegment. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + SetAsPath(value BgpAsPath) BgpV4EthernetSegment + // HasAsPath checks if AsPath has been set in BgpV4EthernetSegment + HasAsPath() bool + setNil() +} + +// Designated Forwarder (DF) election configuration. +// DfElection returns a BgpEthernetSegmentDfElection +func (obj *bgpV4EthernetSegment) DfElection() BgpEthernetSegmentDfElection { + if obj.obj.DfElection == nil { + obj.obj.DfElection = NewBgpEthernetSegmentDfElection().msg() + } + if obj.dfElectionHolder == nil { + obj.dfElectionHolder = &bgpEthernetSegmentDfElection{obj: obj.obj.DfElection} + } + return obj.dfElectionHolder +} + +// Designated Forwarder (DF) election configuration. +// DfElection returns a BgpEthernetSegmentDfElection +func (obj *bgpV4EthernetSegment) HasDfElection() bool { + return obj.obj.DfElection != nil +} + +// Designated Forwarder (DF) election configuration. +// SetDfElection sets the BgpEthernetSegmentDfElection value in the BgpV4EthernetSegment object +func (obj *bgpV4EthernetSegment) SetDfElection(value BgpEthernetSegmentDfElection) BgpV4EthernetSegment { + + obj.dfElectionHolder = nil + obj.obj.DfElection = value.msg() + + return obj +} + +// This contains the list of EVIs. +// Evis returns a []BgpV4EvpnEvis +func (obj *bgpV4EthernetSegment) Evis() BgpV4EthernetSegmentBgpV4EvpnEvisIter { + if len(obj.obj.Evis) == 0 { + obj.obj.Evis = []*otg.BgpV4EvpnEvis{} + } + if obj.evisHolder == nil { + obj.evisHolder = newBgpV4EthernetSegmentBgpV4EvpnEvisIter(&obj.obj.Evis).setMsg(obj) + } + return obj.evisHolder +} + +type bgpV4EthernetSegmentBgpV4EvpnEvisIter struct { + obj *bgpV4EthernetSegment + bgpV4EvpnEvisSlice []BgpV4EvpnEvis + fieldPtr *[]*otg.BgpV4EvpnEvis +} + +func newBgpV4EthernetSegmentBgpV4EvpnEvisIter(ptr *[]*otg.BgpV4EvpnEvis) BgpV4EthernetSegmentBgpV4EvpnEvisIter { + return &bgpV4EthernetSegmentBgpV4EvpnEvisIter{fieldPtr: ptr} +} + +type BgpV4EthernetSegmentBgpV4EvpnEvisIter interface { + setMsg(*bgpV4EthernetSegment) BgpV4EthernetSegmentBgpV4EvpnEvisIter + Items() []BgpV4EvpnEvis + Add() BgpV4EvpnEvis + Append(items ...BgpV4EvpnEvis) BgpV4EthernetSegmentBgpV4EvpnEvisIter + Set(index int, newObj BgpV4EvpnEvis) BgpV4EthernetSegmentBgpV4EvpnEvisIter + Clear() BgpV4EthernetSegmentBgpV4EvpnEvisIter + clearHolderSlice() BgpV4EthernetSegmentBgpV4EvpnEvisIter + appendHolderSlice(item BgpV4EvpnEvis) BgpV4EthernetSegmentBgpV4EvpnEvisIter +} + +func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) setMsg(msg *bgpV4EthernetSegment) BgpV4EthernetSegmentBgpV4EvpnEvisIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpV4EvpnEvis{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) Items() []BgpV4EvpnEvis { + return obj.bgpV4EvpnEvisSlice +} + +func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) Add() BgpV4EvpnEvis { + newObj := &otg.BgpV4EvpnEvis{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpV4EvpnEvis{obj: newObj} + newLibObj.setDefault() + obj.bgpV4EvpnEvisSlice = append(obj.bgpV4EvpnEvisSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) Append(items ...BgpV4EvpnEvis) BgpV4EthernetSegmentBgpV4EvpnEvisIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpV4EvpnEvisSlice = append(obj.bgpV4EvpnEvisSlice, item) + } + return obj +} + +func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) Set(index int, newObj BgpV4EvpnEvis) BgpV4EthernetSegmentBgpV4EvpnEvisIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpV4EvpnEvisSlice[index] = newObj + return obj +} +func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) Clear() BgpV4EthernetSegmentBgpV4EvpnEvisIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpV4EvpnEvis{} + obj.bgpV4EvpnEvisSlice = []BgpV4EvpnEvis{} + } + return obj +} +func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) clearHolderSlice() BgpV4EthernetSegmentBgpV4EvpnEvisIter { + if len(obj.bgpV4EvpnEvisSlice) > 0 { + obj.bgpV4EvpnEvisSlice = []BgpV4EvpnEvis{} + } + return obj +} +func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) appendHolderSlice(item BgpV4EvpnEvis) BgpV4EthernetSegmentBgpV4EvpnEvisIter { + obj.bgpV4EvpnEvisSlice = append(obj.bgpV4EvpnEvisSlice, item) + return obj +} + +// 10-octet Ethernet Segment Identifier (ESI) Example - For multi-home scenario nonZero ESI is '10000000000000000000' . +// Esi returns a string +func (obj *bgpV4EthernetSegment) Esi() string { + + return *obj.obj.Esi + +} + +// 10-octet Ethernet Segment Identifier (ESI) Example - For multi-home scenario nonZero ESI is '10000000000000000000' . +// Esi returns a string +func (obj *bgpV4EthernetSegment) HasEsi() bool { + return obj.obj.Esi != nil +} + +// 10-octet Ethernet Segment Identifier (ESI) Example - For multi-home scenario nonZero ESI is '10000000000000000000' . +// SetEsi sets the string value in the BgpV4EthernetSegment object +func (obj *bgpV4EthernetSegment) SetEsi(value string) BgpV4EthernetSegment { + + obj.obj.Esi = &value + return obj +} + +type BgpV4EthernetSegmentActiveModeEnum string + +// Enum of ActiveMode on BgpV4EthernetSegment +var BgpV4EthernetSegmentActiveMode = struct { + SINGLE_ACTIVE BgpV4EthernetSegmentActiveModeEnum + ALL_ACTIVE BgpV4EthernetSegmentActiveModeEnum +}{ + SINGLE_ACTIVE: BgpV4EthernetSegmentActiveModeEnum("single_active"), + ALL_ACTIVE: BgpV4EthernetSegmentActiveModeEnum("all_active"), +} + +func (obj *bgpV4EthernetSegment) ActiveMode() BgpV4EthernetSegmentActiveModeEnum { + return BgpV4EthernetSegmentActiveModeEnum(obj.obj.ActiveMode.Enum().String()) +} + +// Single Active or All Active mode Redundancy mode selection for Multi-home. +// ActiveMode returns a string +func (obj *bgpV4EthernetSegment) HasActiveMode() bool { + return obj.obj.ActiveMode != nil +} + +func (obj *bgpV4EthernetSegment) SetActiveMode(value BgpV4EthernetSegmentActiveModeEnum) BgpV4EthernetSegment { + intValue, ok := otg.BgpV4EthernetSegment_ActiveMode_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpV4EthernetSegmentActiveModeEnum", string(value))) + return obj + } + enumValue := otg.BgpV4EthernetSegment_ActiveMode_Enum(intValue) + obj.obj.ActiveMode = &enumValue + + return obj +} + +// The label value to be advertised as ESI Label in ESI Label Extended Community. This is included in Ethernet Auto-discovery per ES Routes advertised by a router. +// EsiLabel returns a uint32 +func (obj *bgpV4EthernetSegment) EsiLabel() uint32 { + + return *obj.obj.EsiLabel + +} + +// The label value to be advertised as ESI Label in ESI Label Extended Community. This is included in Ethernet Auto-discovery per ES Routes advertised by a router. +// EsiLabel returns a uint32 +func (obj *bgpV4EthernetSegment) HasEsiLabel() bool { + return obj.obj.EsiLabel != nil +} + +// The label value to be advertised as ESI Label in ESI Label Extended Community. This is included in Ethernet Auto-discovery per ES Routes advertised by a router. +// SetEsiLabel sets the uint32 value in the BgpV4EthernetSegment object +func (obj *bgpV4EthernetSegment) SetEsiLabel(value uint32) BgpV4EthernetSegment { + + obj.obj.EsiLabel = &value + return obj +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpV4EthernetSegment) Advanced() BgpRouteAdvanced { + if obj.obj.Advanced == nil { + obj.obj.Advanced = NewBgpRouteAdvanced().msg() + } + if obj.advancedHolder == nil { + obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} + } + return obj.advancedHolder +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpV4EthernetSegment) HasAdvanced() bool { + return obj.obj.Advanced != nil +} + +// description is TBD +// SetAdvanced sets the BgpRouteAdvanced value in the BgpV4EthernetSegment object +func (obj *bgpV4EthernetSegment) SetAdvanced(value BgpRouteAdvanced) BgpV4EthernetSegment { + + obj.advancedHolder = nil + obj.obj.Advanced = value.msg() + + return obj +} + +// Optional community settings. +// Communities returns a []BgpCommunity +func (obj *bgpV4EthernetSegment) Communities() BgpV4EthernetSegmentBgpCommunityIter { + if len(obj.obj.Communities) == 0 { + obj.obj.Communities = []*otg.BgpCommunity{} + } + if obj.communitiesHolder == nil { + obj.communitiesHolder = newBgpV4EthernetSegmentBgpCommunityIter(&obj.obj.Communities).setMsg(obj) + } + return obj.communitiesHolder +} + +type bgpV4EthernetSegmentBgpCommunityIter struct { + obj *bgpV4EthernetSegment + bgpCommunitySlice []BgpCommunity + fieldPtr *[]*otg.BgpCommunity +} + +func newBgpV4EthernetSegmentBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpV4EthernetSegmentBgpCommunityIter { + return &bgpV4EthernetSegmentBgpCommunityIter{fieldPtr: ptr} +} + +type BgpV4EthernetSegmentBgpCommunityIter interface { + setMsg(*bgpV4EthernetSegment) BgpV4EthernetSegmentBgpCommunityIter + Items() []BgpCommunity + Add() BgpCommunity + Append(items ...BgpCommunity) BgpV4EthernetSegmentBgpCommunityIter + Set(index int, newObj BgpCommunity) BgpV4EthernetSegmentBgpCommunityIter + Clear() BgpV4EthernetSegmentBgpCommunityIter + clearHolderSlice() BgpV4EthernetSegmentBgpCommunityIter + appendHolderSlice(item BgpCommunity) BgpV4EthernetSegmentBgpCommunityIter +} + +func (obj *bgpV4EthernetSegmentBgpCommunityIter) setMsg(msg *bgpV4EthernetSegment) BgpV4EthernetSegmentBgpCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4EthernetSegmentBgpCommunityIter) Items() []BgpCommunity { + return obj.bgpCommunitySlice +} + +func (obj *bgpV4EthernetSegmentBgpCommunityIter) Add() BgpCommunity { + newObj := &otg.BgpCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4EthernetSegmentBgpCommunityIter) Append(items ...BgpCommunity) BgpV4EthernetSegmentBgpCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + } + return obj +} + +func (obj *bgpV4EthernetSegmentBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpV4EthernetSegmentBgpCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpCommunitySlice[index] = newObj + return obj +} +func (obj *bgpV4EthernetSegmentBgpCommunityIter) Clear() BgpV4EthernetSegmentBgpCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpCommunity{} + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpV4EthernetSegmentBgpCommunityIter) clearHolderSlice() BgpV4EthernetSegmentBgpCommunityIter { + if len(obj.bgpCommunitySlice) > 0 { + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpV4EthernetSegmentBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpV4EthernetSegmentBgpCommunityIter { + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + return obj +} + +// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. +// ExtCommunities returns a []BgpExtCommunity +func (obj *bgpV4EthernetSegment) ExtCommunities() BgpV4EthernetSegmentBgpExtCommunityIter { + if len(obj.obj.ExtCommunities) == 0 { + obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} + } + if obj.extCommunitiesHolder == nil { + obj.extCommunitiesHolder = newBgpV4EthernetSegmentBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) + } + return obj.extCommunitiesHolder +} + +type bgpV4EthernetSegmentBgpExtCommunityIter struct { + obj *bgpV4EthernetSegment + bgpExtCommunitySlice []BgpExtCommunity + fieldPtr *[]*otg.BgpExtCommunity +} + +func newBgpV4EthernetSegmentBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpV4EthernetSegmentBgpExtCommunityIter { + return &bgpV4EthernetSegmentBgpExtCommunityIter{fieldPtr: ptr} +} + +type BgpV4EthernetSegmentBgpExtCommunityIter interface { + setMsg(*bgpV4EthernetSegment) BgpV4EthernetSegmentBgpExtCommunityIter + Items() []BgpExtCommunity + Add() BgpExtCommunity + Append(items ...BgpExtCommunity) BgpV4EthernetSegmentBgpExtCommunityIter + Set(index int, newObj BgpExtCommunity) BgpV4EthernetSegmentBgpExtCommunityIter + Clear() BgpV4EthernetSegmentBgpExtCommunityIter + clearHolderSlice() BgpV4EthernetSegmentBgpExtCommunityIter + appendHolderSlice(item BgpExtCommunity) BgpV4EthernetSegmentBgpExtCommunityIter +} + +func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) setMsg(msg *bgpV4EthernetSegment) BgpV4EthernetSegmentBgpExtCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpExtCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) Items() []BgpExtCommunity { + return obj.bgpExtCommunitySlice +} + +func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) Add() BgpExtCommunity { + newObj := &otg.BgpExtCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpExtCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpV4EthernetSegmentBgpExtCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + } + return obj +} + +func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpV4EthernetSegmentBgpExtCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpExtCommunitySlice[index] = newObj + return obj +} +func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) Clear() BgpV4EthernetSegmentBgpExtCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpExtCommunity{} + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) clearHolderSlice() BgpV4EthernetSegmentBgpExtCommunityIter { + if len(obj.bgpExtCommunitySlice) > 0 { + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpV4EthernetSegmentBgpExtCommunityIter { + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + return obj +} + +// Optional AS PATH settings. +// AsPath returns a BgpAsPath +func (obj *bgpV4EthernetSegment) AsPath() BgpAsPath { + if obj.obj.AsPath == nil { + obj.obj.AsPath = NewBgpAsPath().msg() + } + if obj.asPathHolder == nil { + obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} + } + return obj.asPathHolder +} + +// Optional AS PATH settings. +// AsPath returns a BgpAsPath +func (obj *bgpV4EthernetSegment) HasAsPath() bool { + return obj.obj.AsPath != nil +} + +// Optional AS PATH settings. +// SetAsPath sets the BgpAsPath value in the BgpV4EthernetSegment object +func (obj *bgpV4EthernetSegment) SetAsPath(value BgpAsPath) BgpV4EthernetSegment { + + obj.asPathHolder = nil + obj.obj.AsPath = value.msg() + + return obj +} + +func (obj *bgpV4EthernetSegment) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.DfElection != nil { + + obj.DfElection().validateObj(vObj, set_default) + } + + if len(obj.obj.Evis) != 0 { + + if set_default { + obj.Evis().clearHolderSlice() + for _, item := range obj.obj.Evis { + obj.Evis().appendHolderSlice(&bgpV4EvpnEvis{obj: item}) + } + } + for _, item := range obj.Evis().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Esi != nil { + + err := obj.validateHex(obj.Esi()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV4EthernetSegment.Esi")) + } + + } + + if obj.obj.EsiLabel != nil { + + if *obj.obj.EsiLabel > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpV4EthernetSegment.EsiLabel <= 16777215 but Got %d", *obj.obj.EsiLabel)) + } + + } + + if obj.obj.Advanced != nil { + + obj.Advanced().validateObj(vObj, set_default) + } + + if len(obj.obj.Communities) != 0 { + + if set_default { + obj.Communities().clearHolderSlice() + for _, item := range obj.obj.Communities { + obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) + } + } + for _, item := range obj.Communities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.ExtCommunities) != 0 { + + if set_default { + obj.ExtCommunities().clearHolderSlice() + for _, item := range obj.obj.ExtCommunities { + obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) + } + } + for _, item := range obj.ExtCommunities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.AsPath != nil { + + obj.AsPath().validateObj(vObj, set_default) + } + +} + +func (obj *bgpV4EthernetSegment) setDefault() { + if obj.obj.Esi == nil { + obj.SetEsi("00000000000000000000") + } + if obj.obj.ActiveMode == nil { + obj.SetActiveMode(BgpV4EthernetSegmentActiveMode.ALL_ACTIVE) + + } + if obj.obj.EsiLabel == nil { + obj.SetEsiLabel(0) + } + +} diff --git a/gosnappi/bgp_v4_evi_vxlan.go b/gosnappi/bgp_v4_evi_vxlan.go new file mode 100644 index 00000000..26a00dca --- /dev/null +++ b/gosnappi/bgp_v4_evi_vxlan.go @@ -0,0 +1,1054 @@ +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" +) + +// ***** BgpV4EviVxlan ***** +type bgpV4EviVxlan struct { + validation + obj *otg.BgpV4EviVxlan + marshaller marshalBgpV4EviVxlan + unMarshaller unMarshalBgpV4EviVxlan + broadcastDomainsHolder BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter + routeDistinguisherHolder BgpRouteDistinguisher + routeTargetExportHolder BgpV4EviVxlanBgpRouteTargetIter + routeTargetImportHolder BgpV4EviVxlanBgpRouteTargetIter + l3RouteTargetExportHolder BgpV4EviVxlanBgpRouteTargetIter + l3RouteTargetImportHolder BgpV4EviVxlanBgpRouteTargetIter + advancedHolder BgpRouteAdvanced + communitiesHolder BgpV4EviVxlanBgpCommunityIter + extCommunitiesHolder BgpV4EviVxlanBgpExtCommunityIter + asPathHolder BgpAsPath +} + +func NewBgpV4EviVxlan() BgpV4EviVxlan { + obj := bgpV4EviVxlan{obj: &otg.BgpV4EviVxlan{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV4EviVxlan) msg() *otg.BgpV4EviVxlan { + return obj.obj +} + +func (obj *bgpV4EviVxlan) setMsg(msg *otg.BgpV4EviVxlan) BgpV4EviVxlan { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV4EviVxlan struct { + obj *bgpV4EviVxlan +} + +type marshalBgpV4EviVxlan interface { + // ToProto marshals BgpV4EviVxlan to protobuf object *otg.BgpV4EviVxlan + ToProto() (*otg.BgpV4EviVxlan, error) + // ToPbText marshals BgpV4EviVxlan to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV4EviVxlan to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV4EviVxlan to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV4EviVxlan struct { + obj *bgpV4EviVxlan +} + +type unMarshalBgpV4EviVxlan interface { + // FromProto unmarshals BgpV4EviVxlan from protobuf object *otg.BgpV4EviVxlan + FromProto(msg *otg.BgpV4EviVxlan) (BgpV4EviVxlan, error) + // FromPbText unmarshals BgpV4EviVxlan from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV4EviVxlan from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV4EviVxlan from JSON text + FromJson(value string) error +} + +func (obj *bgpV4EviVxlan) Marshal() marshalBgpV4EviVxlan { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV4EviVxlan{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV4EviVxlan) Unmarshal() unMarshalBgpV4EviVxlan { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV4EviVxlan{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV4EviVxlan) ToProto() (*otg.BgpV4EviVxlan, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV4EviVxlan) FromProto(msg *otg.BgpV4EviVxlan) (BgpV4EviVxlan, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV4EviVxlan) 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 *unMarshalbgpV4EviVxlan) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpV4EviVxlan) 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 *unMarshalbgpV4EviVxlan) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpV4EviVxlan) 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 *unMarshalbgpV4EviVxlan) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpV4EviVxlan) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV4EviVxlan) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV4EviVxlan) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV4EviVxlan) Clone() (BgpV4EviVxlan, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV4EviVxlan() + 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 +} + +func (obj *bgpV4EviVxlan) setNil() { + obj.broadcastDomainsHolder = nil + obj.routeDistinguisherHolder = nil + obj.routeTargetExportHolder = nil + obj.routeTargetImportHolder = nil + obj.l3RouteTargetExportHolder = nil + obj.l3RouteTargetImportHolder = nil + obj.advancedHolder = nil + obj.communitiesHolder = nil + obj.extCommunitiesHolder = nil + obj.asPathHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpV4EviVxlan is configuration for BGP EVPN EVI. Advertises following routes - +// +// # Type 3 - Inclusive Multicast Ethernet Tag Route +// +// Type 1 - Ethernet Auto-discovery Route (Per EVI) +// +// Type 1 - Ethernet Auto-discovery Route (Per ES) +type BgpV4EviVxlan interface { + Validation + // msg marshals BgpV4EviVxlan to protobuf object *otg.BgpV4EviVxlan + // and doesn't set defaults + msg() *otg.BgpV4EviVxlan + // setMsg unmarshals BgpV4EviVxlan from protobuf object *otg.BgpV4EviVxlan + // and doesn't set defaults + setMsg(*otg.BgpV4EviVxlan) BgpV4EviVxlan + // provides marshal interface + Marshal() marshalBgpV4EviVxlan + // provides unmarshal interface + Unmarshal() unMarshalBgpV4EviVxlan + // validate validates BgpV4EviVxlan + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV4EviVxlan, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // BroadcastDomains returns BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIterIter, set in BgpV4EviVxlan + BroadcastDomains() BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter + // ReplicationType returns BgpV4EviVxlanReplicationTypeEnum, set in BgpV4EviVxlan + ReplicationType() BgpV4EviVxlanReplicationTypeEnum + // SetReplicationType assigns BgpV4EviVxlanReplicationTypeEnum provided by user to BgpV4EviVxlan + SetReplicationType(value BgpV4EviVxlanReplicationTypeEnum) BgpV4EviVxlan + // HasReplicationType checks if ReplicationType has been set in BgpV4EviVxlan + HasReplicationType() bool + // PmsiLabel returns uint32, set in BgpV4EviVxlan. + PmsiLabel() uint32 + // SetPmsiLabel assigns uint32 provided by user to BgpV4EviVxlan + SetPmsiLabel(value uint32) BgpV4EviVxlan + // HasPmsiLabel checks if PmsiLabel has been set in BgpV4EviVxlan + HasPmsiLabel() bool + // AdLabel returns uint32, set in BgpV4EviVxlan. + AdLabel() uint32 + // SetAdLabel assigns uint32 provided by user to BgpV4EviVxlan + SetAdLabel(value uint32) BgpV4EviVxlan + // HasAdLabel checks if AdLabel has been set in BgpV4EviVxlan + HasAdLabel() bool + // RouteDistinguisher returns BgpRouteDistinguisher, set in BgpV4EviVxlan. + // BgpRouteDistinguisher is bGP Route Distinguisher. + RouteDistinguisher() BgpRouteDistinguisher + // SetRouteDistinguisher assigns BgpRouteDistinguisher provided by user to BgpV4EviVxlan. + // BgpRouteDistinguisher is bGP Route Distinguisher. + SetRouteDistinguisher(value BgpRouteDistinguisher) BgpV4EviVxlan + // HasRouteDistinguisher checks if RouteDistinguisher has been set in BgpV4EviVxlan + HasRouteDistinguisher() bool + // RouteTargetExport returns BgpV4EviVxlanBgpRouteTargetIterIter, set in BgpV4EviVxlan + RouteTargetExport() BgpV4EviVxlanBgpRouteTargetIter + // RouteTargetImport returns BgpV4EviVxlanBgpRouteTargetIterIter, set in BgpV4EviVxlan + RouteTargetImport() BgpV4EviVxlanBgpRouteTargetIter + // L3RouteTargetExport returns BgpV4EviVxlanBgpRouteTargetIterIter, set in BgpV4EviVxlan + L3RouteTargetExport() BgpV4EviVxlanBgpRouteTargetIter + // L3RouteTargetImport returns BgpV4EviVxlanBgpRouteTargetIterIter, set in BgpV4EviVxlan + L3RouteTargetImport() BgpV4EviVxlanBgpRouteTargetIter + // Advanced returns BgpRouteAdvanced, set in BgpV4EviVxlan. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + Advanced() BgpRouteAdvanced + // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpV4EviVxlan. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + SetAdvanced(value BgpRouteAdvanced) BgpV4EviVxlan + // HasAdvanced checks if Advanced has been set in BgpV4EviVxlan + HasAdvanced() bool + // Communities returns BgpV4EviVxlanBgpCommunityIterIter, set in BgpV4EviVxlan + Communities() BgpV4EviVxlanBgpCommunityIter + // ExtCommunities returns BgpV4EviVxlanBgpExtCommunityIterIter, set in BgpV4EviVxlan + ExtCommunities() BgpV4EviVxlanBgpExtCommunityIter + // AsPath returns BgpAsPath, set in BgpV4EviVxlan. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + AsPath() BgpAsPath + // SetAsPath assigns BgpAsPath provided by user to BgpV4EviVxlan. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + SetAsPath(value BgpAsPath) BgpV4EviVxlan + // HasAsPath checks if AsPath has been set in BgpV4EviVxlan + HasAsPath() bool + setNil() +} + +// This contains the list of Broadcast Domains to be configured per EVI. +// BroadcastDomains returns a []BgpV4EviVxlanBroadcastDomain +func (obj *bgpV4EviVxlan) BroadcastDomains() BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { + if len(obj.obj.BroadcastDomains) == 0 { + obj.obj.BroadcastDomains = []*otg.BgpV4EviVxlanBroadcastDomain{} + } + if obj.broadcastDomainsHolder == nil { + obj.broadcastDomainsHolder = newBgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter(&obj.obj.BroadcastDomains).setMsg(obj) + } + return obj.broadcastDomainsHolder +} + +type bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter struct { + obj *bgpV4EviVxlan + bgpV4EviVxlanBroadcastDomainSlice []BgpV4EviVxlanBroadcastDomain + fieldPtr *[]*otg.BgpV4EviVxlanBroadcastDomain +} + +func newBgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter(ptr *[]*otg.BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { + return &bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter{fieldPtr: ptr} +} + +type BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter interface { + setMsg(*bgpV4EviVxlan) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter + Items() []BgpV4EviVxlanBroadcastDomain + Add() BgpV4EviVxlanBroadcastDomain + Append(items ...BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter + Set(index int, newObj BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter + Clear() BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter + clearHolderSlice() BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter + appendHolderSlice(item BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter +} + +func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) setMsg(msg *bgpV4EviVxlan) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpV4EviVxlanBroadcastDomain{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) Items() []BgpV4EviVxlanBroadcastDomain { + return obj.bgpV4EviVxlanBroadcastDomainSlice +} + +func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) Add() BgpV4EviVxlanBroadcastDomain { + newObj := &otg.BgpV4EviVxlanBroadcastDomain{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpV4EviVxlanBroadcastDomain{obj: newObj} + newLibObj.setDefault() + obj.bgpV4EviVxlanBroadcastDomainSlice = append(obj.bgpV4EviVxlanBroadcastDomainSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) Append(items ...BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpV4EviVxlanBroadcastDomainSlice = append(obj.bgpV4EviVxlanBroadcastDomainSlice, item) + } + return obj +} + +func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) Set(index int, newObj BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpV4EviVxlanBroadcastDomainSlice[index] = newObj + return obj +} +func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) Clear() BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpV4EviVxlanBroadcastDomain{} + obj.bgpV4EviVxlanBroadcastDomainSlice = []BgpV4EviVxlanBroadcastDomain{} + } + return obj +} +func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) clearHolderSlice() BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { + if len(obj.bgpV4EviVxlanBroadcastDomainSlice) > 0 { + obj.bgpV4EviVxlanBroadcastDomainSlice = []BgpV4EviVxlanBroadcastDomain{} + } + return obj +} +func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) appendHolderSlice(item BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { + obj.bgpV4EviVxlanBroadcastDomainSlice = append(obj.bgpV4EviVxlanBroadcastDomainSlice, item) + return obj +} + +type BgpV4EviVxlanReplicationTypeEnum string + +// Enum of ReplicationType on BgpV4EviVxlan +var BgpV4EviVxlanReplicationType = struct { + INGRESS_REPLICATION BgpV4EviVxlanReplicationTypeEnum +}{ + INGRESS_REPLICATION: BgpV4EviVxlanReplicationTypeEnum("ingress_replication"), +} + +func (obj *bgpV4EviVxlan) ReplicationType() BgpV4EviVxlanReplicationTypeEnum { + return BgpV4EviVxlanReplicationTypeEnum(obj.obj.ReplicationType.Enum().String()) +} + +// This model only supports Ingress Replication +// ReplicationType returns a string +func (obj *bgpV4EviVxlan) HasReplicationType() bool { + return obj.obj.ReplicationType != nil +} + +func (obj *bgpV4EviVxlan) SetReplicationType(value BgpV4EviVxlanReplicationTypeEnum) BgpV4EviVxlan { + intValue, ok := otg.BgpV4EviVxlan_ReplicationType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpV4EviVxlanReplicationTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpV4EviVxlan_ReplicationType_Enum(intValue) + obj.obj.ReplicationType = &enumValue + + return obj +} + +// Downstream assigned VNI to be carried as Part of P-Multicast Service Interface Tunnel attribute (PMSI Tunnel Attribute) in Type 3 Inclusive Multicast Ethernet Tag Route. +// PmsiLabel returns a uint32 +func (obj *bgpV4EviVxlan) PmsiLabel() uint32 { + + return *obj.obj.PmsiLabel + +} + +// Downstream assigned VNI to be carried as Part of P-Multicast Service Interface Tunnel attribute (PMSI Tunnel Attribute) in Type 3 Inclusive Multicast Ethernet Tag Route. +// PmsiLabel returns a uint32 +func (obj *bgpV4EviVxlan) HasPmsiLabel() bool { + return obj.obj.PmsiLabel != nil +} + +// Downstream assigned VNI to be carried as Part of P-Multicast Service Interface Tunnel attribute (PMSI Tunnel Attribute) in Type 3 Inclusive Multicast Ethernet Tag Route. +// SetPmsiLabel sets the uint32 value in the BgpV4EviVxlan object +func (obj *bgpV4EviVxlan) SetPmsiLabel(value uint32) BgpV4EviVxlan { + + obj.obj.PmsiLabel = &value + return obj +} + +// The Auto-discovery Route label (AD label) value, which gets advertised in the Ethernet Auto-discovery Route per +// AdLabel returns a uint32 +func (obj *bgpV4EviVxlan) AdLabel() uint32 { + + return *obj.obj.AdLabel + +} + +// The Auto-discovery Route label (AD label) value, which gets advertised in the Ethernet Auto-discovery Route per +// AdLabel returns a uint32 +func (obj *bgpV4EviVxlan) HasAdLabel() bool { + return obj.obj.AdLabel != nil +} + +// The Auto-discovery Route label (AD label) value, which gets advertised in the Ethernet Auto-discovery Route per +// SetAdLabel sets the uint32 value in the BgpV4EviVxlan object +func (obj *bgpV4EviVxlan) SetAdLabel(value uint32) BgpV4EviVxlan { + + obj.obj.AdLabel = &value + return obj +} + +// Colon separated Extended Community value of 6 Bytes - "AS number: Value" identifying an EVI. Example - for the as_2octet "60005:100". +// RouteDistinguisher returns a BgpRouteDistinguisher +func (obj *bgpV4EviVxlan) RouteDistinguisher() BgpRouteDistinguisher { + if obj.obj.RouteDistinguisher == nil { + obj.obj.RouteDistinguisher = NewBgpRouteDistinguisher().msg() + } + if obj.routeDistinguisherHolder == nil { + obj.routeDistinguisherHolder = &bgpRouteDistinguisher{obj: obj.obj.RouteDistinguisher} + } + return obj.routeDistinguisherHolder +} + +// Colon separated Extended Community value of 6 Bytes - "AS number: Value" identifying an EVI. Example - for the as_2octet "60005:100". +// RouteDistinguisher returns a BgpRouteDistinguisher +func (obj *bgpV4EviVxlan) HasRouteDistinguisher() bool { + return obj.obj.RouteDistinguisher != nil +} + +// Colon separated Extended Community value of 6 Bytes - "AS number: Value" identifying an EVI. Example - for the as_2octet "60005:100". +// SetRouteDistinguisher sets the BgpRouteDistinguisher value in the BgpV4EviVxlan object +func (obj *bgpV4EviVxlan) SetRouteDistinguisher(value BgpRouteDistinguisher) BgpV4EviVxlan { + + obj.routeDistinguisherHolder = nil + obj.obj.RouteDistinguisher = value.msg() + + return obj +} + +// List of Layer 2 Virtual Network Identifier (L2VNI) export targets associated with this EVI. +// RouteTargetExport returns a []BgpRouteTarget +func (obj *bgpV4EviVxlan) RouteTargetExport() BgpV4EviVxlanBgpRouteTargetIter { + if len(obj.obj.RouteTargetExport) == 0 { + obj.obj.RouteTargetExport = []*otg.BgpRouteTarget{} + } + if obj.routeTargetExportHolder == nil { + obj.routeTargetExportHolder = newBgpV4EviVxlanBgpRouteTargetIter(&obj.obj.RouteTargetExport).setMsg(obj) + } + return obj.routeTargetExportHolder +} + +type bgpV4EviVxlanBgpRouteTargetIter struct { + obj *bgpV4EviVxlan + bgpRouteTargetSlice []BgpRouteTarget + fieldPtr *[]*otg.BgpRouteTarget +} + +func newBgpV4EviVxlanBgpRouteTargetIter(ptr *[]*otg.BgpRouteTarget) BgpV4EviVxlanBgpRouteTargetIter { + return &bgpV4EviVxlanBgpRouteTargetIter{fieldPtr: ptr} +} + +type BgpV4EviVxlanBgpRouteTargetIter interface { + setMsg(*bgpV4EviVxlan) BgpV4EviVxlanBgpRouteTargetIter + Items() []BgpRouteTarget + Add() BgpRouteTarget + Append(items ...BgpRouteTarget) BgpV4EviVxlanBgpRouteTargetIter + Set(index int, newObj BgpRouteTarget) BgpV4EviVxlanBgpRouteTargetIter + Clear() BgpV4EviVxlanBgpRouteTargetIter + clearHolderSlice() BgpV4EviVxlanBgpRouteTargetIter + appendHolderSlice(item BgpRouteTarget) BgpV4EviVxlanBgpRouteTargetIter +} + +func (obj *bgpV4EviVxlanBgpRouteTargetIter) setMsg(msg *bgpV4EviVxlan) BgpV4EviVxlanBgpRouteTargetIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpRouteTarget{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4EviVxlanBgpRouteTargetIter) Items() []BgpRouteTarget { + return obj.bgpRouteTargetSlice +} + +func (obj *bgpV4EviVxlanBgpRouteTargetIter) Add() BgpRouteTarget { + newObj := &otg.BgpRouteTarget{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpRouteTarget{obj: newObj} + newLibObj.setDefault() + obj.bgpRouteTargetSlice = append(obj.bgpRouteTargetSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4EviVxlanBgpRouteTargetIter) Append(items ...BgpRouteTarget) BgpV4EviVxlanBgpRouteTargetIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpRouteTargetSlice = append(obj.bgpRouteTargetSlice, item) + } + return obj +} + +func (obj *bgpV4EviVxlanBgpRouteTargetIter) Set(index int, newObj BgpRouteTarget) BgpV4EviVxlanBgpRouteTargetIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpRouteTargetSlice[index] = newObj + return obj +} +func (obj *bgpV4EviVxlanBgpRouteTargetIter) Clear() BgpV4EviVxlanBgpRouteTargetIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpRouteTarget{} + obj.bgpRouteTargetSlice = []BgpRouteTarget{} + } + return obj +} +func (obj *bgpV4EviVxlanBgpRouteTargetIter) clearHolderSlice() BgpV4EviVxlanBgpRouteTargetIter { + if len(obj.bgpRouteTargetSlice) > 0 { + obj.bgpRouteTargetSlice = []BgpRouteTarget{} + } + return obj +} +func (obj *bgpV4EviVxlanBgpRouteTargetIter) appendHolderSlice(item BgpRouteTarget) BgpV4EviVxlanBgpRouteTargetIter { + obj.bgpRouteTargetSlice = append(obj.bgpRouteTargetSlice, item) + return obj +} + +// List of L2VNI import targets associated with this EVI. +// RouteTargetImport returns a []BgpRouteTarget +func (obj *bgpV4EviVxlan) RouteTargetImport() BgpV4EviVxlanBgpRouteTargetIter { + if len(obj.obj.RouteTargetImport) == 0 { + obj.obj.RouteTargetImport = []*otg.BgpRouteTarget{} + } + if obj.routeTargetImportHolder == nil { + obj.routeTargetImportHolder = newBgpV4EviVxlanBgpRouteTargetIter(&obj.obj.RouteTargetImport).setMsg(obj) + } + return obj.routeTargetImportHolder +} + +// List of Layer 3 Virtual Network Identifier (L3VNI) Export Route Targets. +// L3RouteTargetExport returns a []BgpRouteTarget +func (obj *bgpV4EviVxlan) L3RouteTargetExport() BgpV4EviVxlanBgpRouteTargetIter { + if len(obj.obj.L3RouteTargetExport) == 0 { + obj.obj.L3RouteTargetExport = []*otg.BgpRouteTarget{} + } + if obj.l3RouteTargetExportHolder == nil { + obj.l3RouteTargetExportHolder = newBgpV4EviVxlanBgpRouteTargetIter(&obj.obj.L3RouteTargetExport).setMsg(obj) + } + return obj.l3RouteTargetExportHolder +} + +// List of L3VNI Import Route Targets. +// L3RouteTargetImport returns a []BgpRouteTarget +func (obj *bgpV4EviVxlan) L3RouteTargetImport() BgpV4EviVxlanBgpRouteTargetIter { + if len(obj.obj.L3RouteTargetImport) == 0 { + obj.obj.L3RouteTargetImport = []*otg.BgpRouteTarget{} + } + if obj.l3RouteTargetImportHolder == nil { + obj.l3RouteTargetImportHolder = newBgpV4EviVxlanBgpRouteTargetIter(&obj.obj.L3RouteTargetImport).setMsg(obj) + } + return obj.l3RouteTargetImportHolder +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpV4EviVxlan) Advanced() BgpRouteAdvanced { + if obj.obj.Advanced == nil { + obj.obj.Advanced = NewBgpRouteAdvanced().msg() + } + if obj.advancedHolder == nil { + obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} + } + return obj.advancedHolder +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpV4EviVxlan) HasAdvanced() bool { + return obj.obj.Advanced != nil +} + +// description is TBD +// SetAdvanced sets the BgpRouteAdvanced value in the BgpV4EviVxlan object +func (obj *bgpV4EviVxlan) SetAdvanced(value BgpRouteAdvanced) BgpV4EviVxlan { + + obj.advancedHolder = nil + obj.obj.Advanced = value.msg() + + return obj +} + +// Optional community settings. +// Communities returns a []BgpCommunity +func (obj *bgpV4EviVxlan) Communities() BgpV4EviVxlanBgpCommunityIter { + if len(obj.obj.Communities) == 0 { + obj.obj.Communities = []*otg.BgpCommunity{} + } + if obj.communitiesHolder == nil { + obj.communitiesHolder = newBgpV4EviVxlanBgpCommunityIter(&obj.obj.Communities).setMsg(obj) + } + return obj.communitiesHolder +} + +type bgpV4EviVxlanBgpCommunityIter struct { + obj *bgpV4EviVxlan + bgpCommunitySlice []BgpCommunity + fieldPtr *[]*otg.BgpCommunity +} + +func newBgpV4EviVxlanBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpV4EviVxlanBgpCommunityIter { + return &bgpV4EviVxlanBgpCommunityIter{fieldPtr: ptr} +} + +type BgpV4EviVxlanBgpCommunityIter interface { + setMsg(*bgpV4EviVxlan) BgpV4EviVxlanBgpCommunityIter + Items() []BgpCommunity + Add() BgpCommunity + Append(items ...BgpCommunity) BgpV4EviVxlanBgpCommunityIter + Set(index int, newObj BgpCommunity) BgpV4EviVxlanBgpCommunityIter + Clear() BgpV4EviVxlanBgpCommunityIter + clearHolderSlice() BgpV4EviVxlanBgpCommunityIter + appendHolderSlice(item BgpCommunity) BgpV4EviVxlanBgpCommunityIter +} + +func (obj *bgpV4EviVxlanBgpCommunityIter) setMsg(msg *bgpV4EviVxlan) BgpV4EviVxlanBgpCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4EviVxlanBgpCommunityIter) Items() []BgpCommunity { + return obj.bgpCommunitySlice +} + +func (obj *bgpV4EviVxlanBgpCommunityIter) Add() BgpCommunity { + newObj := &otg.BgpCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4EviVxlanBgpCommunityIter) Append(items ...BgpCommunity) BgpV4EviVxlanBgpCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + } + return obj +} + +func (obj *bgpV4EviVxlanBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpV4EviVxlanBgpCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpCommunitySlice[index] = newObj + return obj +} +func (obj *bgpV4EviVxlanBgpCommunityIter) Clear() BgpV4EviVxlanBgpCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpCommunity{} + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpV4EviVxlanBgpCommunityIter) clearHolderSlice() BgpV4EviVxlanBgpCommunityIter { + if len(obj.bgpCommunitySlice) > 0 { + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpV4EviVxlanBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpV4EviVxlanBgpCommunityIter { + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + return obj +} + +// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. +// ExtCommunities returns a []BgpExtCommunity +func (obj *bgpV4EviVxlan) ExtCommunities() BgpV4EviVxlanBgpExtCommunityIter { + if len(obj.obj.ExtCommunities) == 0 { + obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} + } + if obj.extCommunitiesHolder == nil { + obj.extCommunitiesHolder = newBgpV4EviVxlanBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) + } + return obj.extCommunitiesHolder +} + +type bgpV4EviVxlanBgpExtCommunityIter struct { + obj *bgpV4EviVxlan + bgpExtCommunitySlice []BgpExtCommunity + fieldPtr *[]*otg.BgpExtCommunity +} + +func newBgpV4EviVxlanBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpV4EviVxlanBgpExtCommunityIter { + return &bgpV4EviVxlanBgpExtCommunityIter{fieldPtr: ptr} +} + +type BgpV4EviVxlanBgpExtCommunityIter interface { + setMsg(*bgpV4EviVxlan) BgpV4EviVxlanBgpExtCommunityIter + Items() []BgpExtCommunity + Add() BgpExtCommunity + Append(items ...BgpExtCommunity) BgpV4EviVxlanBgpExtCommunityIter + Set(index int, newObj BgpExtCommunity) BgpV4EviVxlanBgpExtCommunityIter + Clear() BgpV4EviVxlanBgpExtCommunityIter + clearHolderSlice() BgpV4EviVxlanBgpExtCommunityIter + appendHolderSlice(item BgpExtCommunity) BgpV4EviVxlanBgpExtCommunityIter +} + +func (obj *bgpV4EviVxlanBgpExtCommunityIter) setMsg(msg *bgpV4EviVxlan) BgpV4EviVxlanBgpExtCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpExtCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4EviVxlanBgpExtCommunityIter) Items() []BgpExtCommunity { + return obj.bgpExtCommunitySlice +} + +func (obj *bgpV4EviVxlanBgpExtCommunityIter) Add() BgpExtCommunity { + newObj := &otg.BgpExtCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpExtCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4EviVxlanBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpV4EviVxlanBgpExtCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + } + return obj +} + +func (obj *bgpV4EviVxlanBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpV4EviVxlanBgpExtCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpExtCommunitySlice[index] = newObj + return obj +} +func (obj *bgpV4EviVxlanBgpExtCommunityIter) Clear() BgpV4EviVxlanBgpExtCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpExtCommunity{} + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpV4EviVxlanBgpExtCommunityIter) clearHolderSlice() BgpV4EviVxlanBgpExtCommunityIter { + if len(obj.bgpExtCommunitySlice) > 0 { + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpV4EviVxlanBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpV4EviVxlanBgpExtCommunityIter { + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + return obj +} + +// Optional AS PATH settings. +// AsPath returns a BgpAsPath +func (obj *bgpV4EviVxlan) AsPath() BgpAsPath { + if obj.obj.AsPath == nil { + obj.obj.AsPath = NewBgpAsPath().msg() + } + if obj.asPathHolder == nil { + obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} + } + return obj.asPathHolder +} + +// Optional AS PATH settings. +// AsPath returns a BgpAsPath +func (obj *bgpV4EviVxlan) HasAsPath() bool { + return obj.obj.AsPath != nil +} + +// Optional AS PATH settings. +// SetAsPath sets the BgpAsPath value in the BgpV4EviVxlan object +func (obj *bgpV4EviVxlan) SetAsPath(value BgpAsPath) BgpV4EviVxlan { + + obj.asPathHolder = nil + obj.obj.AsPath = value.msg() + + return obj +} + +func (obj *bgpV4EviVxlan) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.BroadcastDomains) != 0 { + + if set_default { + obj.BroadcastDomains().clearHolderSlice() + for _, item := range obj.obj.BroadcastDomains { + obj.BroadcastDomains().appendHolderSlice(&bgpV4EviVxlanBroadcastDomain{obj: item}) + } + } + for _, item := range obj.BroadcastDomains().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.PmsiLabel != nil { + + if *obj.obj.PmsiLabel > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpV4EviVxlan.PmsiLabel <= 16777215 but Got %d", *obj.obj.PmsiLabel)) + } + + } + + if obj.obj.AdLabel != nil { + + if *obj.obj.AdLabel > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpV4EviVxlan.AdLabel <= 16777215 but Got %d", *obj.obj.AdLabel)) + } + + } + + if obj.obj.RouteDistinguisher != nil { + + obj.RouteDistinguisher().validateObj(vObj, set_default) + } + + if len(obj.obj.RouteTargetExport) != 0 { + + if set_default { + obj.RouteTargetExport().clearHolderSlice() + for _, item := range obj.obj.RouteTargetExport { + obj.RouteTargetExport().appendHolderSlice(&bgpRouteTarget{obj: item}) + } + } + for _, item := range obj.RouteTargetExport().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.RouteTargetImport) != 0 { + + if set_default { + obj.RouteTargetImport().clearHolderSlice() + for _, item := range obj.obj.RouteTargetImport { + obj.RouteTargetImport().appendHolderSlice(&bgpRouteTarget{obj: item}) + } + } + for _, item := range obj.RouteTargetImport().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.L3RouteTargetExport) != 0 { + + if set_default { + obj.L3RouteTargetExport().clearHolderSlice() + for _, item := range obj.obj.L3RouteTargetExport { + obj.L3RouteTargetExport().appendHolderSlice(&bgpRouteTarget{obj: item}) + } + } + for _, item := range obj.L3RouteTargetExport().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.L3RouteTargetImport) != 0 { + + if set_default { + obj.L3RouteTargetImport().clearHolderSlice() + for _, item := range obj.obj.L3RouteTargetImport { + obj.L3RouteTargetImport().appendHolderSlice(&bgpRouteTarget{obj: item}) + } + } + for _, item := range obj.L3RouteTargetImport().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Advanced != nil { + + obj.Advanced().validateObj(vObj, set_default) + } + + if len(obj.obj.Communities) != 0 { + + if set_default { + obj.Communities().clearHolderSlice() + for _, item := range obj.obj.Communities { + obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) + } + } + for _, item := range obj.Communities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.ExtCommunities) != 0 { + + if set_default { + obj.ExtCommunities().clearHolderSlice() + for _, item := range obj.obj.ExtCommunities { + obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) + } + } + for _, item := range obj.ExtCommunities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.AsPath != nil { + + obj.AsPath().validateObj(vObj, set_default) + } + +} + +func (obj *bgpV4EviVxlan) setDefault() { + if obj.obj.ReplicationType == nil { + obj.SetReplicationType(BgpV4EviVxlanReplicationType.INGRESS_REPLICATION) + + } + if obj.obj.PmsiLabel == nil { + obj.SetPmsiLabel(16) + } + if obj.obj.AdLabel == nil { + obj.SetAdLabel(0) + } + +} diff --git a/gosnappi/bgp_v4_evi_vxlan_broadcast_domain.go b/gosnappi/bgp_v4_evi_vxlan_broadcast_domain.go new file mode 100644 index 00000000..5fa2fb30 --- /dev/null +++ b/gosnappi/bgp_v4_evi_vxlan_broadcast_domain.go @@ -0,0 +1,455 @@ +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" +) + +// ***** BgpV4EviVxlanBroadcastDomain ***** +type bgpV4EviVxlanBroadcastDomain struct { + validation + obj *otg.BgpV4EviVxlanBroadcastDomain + marshaller marshalBgpV4EviVxlanBroadcastDomain + unMarshaller unMarshalBgpV4EviVxlanBroadcastDomain + cmacIpRangeHolder BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter +} + +func NewBgpV4EviVxlanBroadcastDomain() BgpV4EviVxlanBroadcastDomain { + obj := bgpV4EviVxlanBroadcastDomain{obj: &otg.BgpV4EviVxlanBroadcastDomain{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV4EviVxlanBroadcastDomain) msg() *otg.BgpV4EviVxlanBroadcastDomain { + return obj.obj +} + +func (obj *bgpV4EviVxlanBroadcastDomain) setMsg(msg *otg.BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBroadcastDomain { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV4EviVxlanBroadcastDomain struct { + obj *bgpV4EviVxlanBroadcastDomain +} + +type marshalBgpV4EviVxlanBroadcastDomain interface { + // ToProto marshals BgpV4EviVxlanBroadcastDomain to protobuf object *otg.BgpV4EviVxlanBroadcastDomain + ToProto() (*otg.BgpV4EviVxlanBroadcastDomain, error) + // ToPbText marshals BgpV4EviVxlanBroadcastDomain to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV4EviVxlanBroadcastDomain to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV4EviVxlanBroadcastDomain to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV4EviVxlanBroadcastDomain struct { + obj *bgpV4EviVxlanBroadcastDomain +} + +type unMarshalBgpV4EviVxlanBroadcastDomain interface { + // FromProto unmarshals BgpV4EviVxlanBroadcastDomain from protobuf object *otg.BgpV4EviVxlanBroadcastDomain + FromProto(msg *otg.BgpV4EviVxlanBroadcastDomain) (BgpV4EviVxlanBroadcastDomain, error) + // FromPbText unmarshals BgpV4EviVxlanBroadcastDomain from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV4EviVxlanBroadcastDomain from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV4EviVxlanBroadcastDomain from JSON text + FromJson(value string) error +} + +func (obj *bgpV4EviVxlanBroadcastDomain) Marshal() marshalBgpV4EviVxlanBroadcastDomain { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV4EviVxlanBroadcastDomain{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV4EviVxlanBroadcastDomain) Unmarshal() unMarshalBgpV4EviVxlanBroadcastDomain { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV4EviVxlanBroadcastDomain{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV4EviVxlanBroadcastDomain) ToProto() (*otg.BgpV4EviVxlanBroadcastDomain, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV4EviVxlanBroadcastDomain) FromProto(msg *otg.BgpV4EviVxlanBroadcastDomain) (BgpV4EviVxlanBroadcastDomain, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV4EviVxlanBroadcastDomain) 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 *unMarshalbgpV4EviVxlanBroadcastDomain) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpV4EviVxlanBroadcastDomain) 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 *unMarshalbgpV4EviVxlanBroadcastDomain) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpV4EviVxlanBroadcastDomain) 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 *unMarshalbgpV4EviVxlanBroadcastDomain) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpV4EviVxlanBroadcastDomain) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV4EviVxlanBroadcastDomain) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV4EviVxlanBroadcastDomain) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV4EviVxlanBroadcastDomain) Clone() (BgpV4EviVxlanBroadcastDomain, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV4EviVxlanBroadcastDomain() + 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 +} + +func (obj *bgpV4EviVxlanBroadcastDomain) setNil() { + obj.cmacIpRangeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpV4EviVxlanBroadcastDomain is configuration for Broadcast Domains per EVI. +type BgpV4EviVxlanBroadcastDomain interface { + Validation + // msg marshals BgpV4EviVxlanBroadcastDomain to protobuf object *otg.BgpV4EviVxlanBroadcastDomain + // and doesn't set defaults + msg() *otg.BgpV4EviVxlanBroadcastDomain + // setMsg unmarshals BgpV4EviVxlanBroadcastDomain from protobuf object *otg.BgpV4EviVxlanBroadcastDomain + // and doesn't set defaults + setMsg(*otg.BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBroadcastDomain + // provides marshal interface + Marshal() marshalBgpV4EviVxlanBroadcastDomain + // provides unmarshal interface + Unmarshal() unMarshalBgpV4EviVxlanBroadcastDomain + // validate validates BgpV4EviVxlanBroadcastDomain + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV4EviVxlanBroadcastDomain, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // CmacIpRange returns BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIterIter, set in BgpV4EviVxlanBroadcastDomain + CmacIpRange() BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter + // EthernetTagId returns uint32, set in BgpV4EviVxlanBroadcastDomain. + EthernetTagId() uint32 + // SetEthernetTagId assigns uint32 provided by user to BgpV4EviVxlanBroadcastDomain + SetEthernetTagId(value uint32) BgpV4EviVxlanBroadcastDomain + // HasEthernetTagId checks if EthernetTagId has been set in BgpV4EviVxlanBroadcastDomain + HasEthernetTagId() bool + // VlanAwareService returns bool, set in BgpV4EviVxlanBroadcastDomain. + VlanAwareService() bool + // SetVlanAwareService assigns bool provided by user to BgpV4EviVxlanBroadcastDomain + SetVlanAwareService(value bool) BgpV4EviVxlanBroadcastDomain + // HasVlanAwareService checks if VlanAwareService has been set in BgpV4EviVxlanBroadcastDomain + HasVlanAwareService() bool + setNil() +} + +// This contains the list of Customer MAC/IP Ranges to be configured per Broadcast Domain. +// +// Advertises following route - +// Type 2 - MAC/IP Advertisement Route. +// CmacIpRange returns a []BgpCMacIpRange +func (obj *bgpV4EviVxlanBroadcastDomain) CmacIpRange() BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { + if len(obj.obj.CmacIpRange) == 0 { + obj.obj.CmacIpRange = []*otg.BgpCMacIpRange{} + } + if obj.cmacIpRangeHolder == nil { + obj.cmacIpRangeHolder = newBgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter(&obj.obj.CmacIpRange).setMsg(obj) + } + return obj.cmacIpRangeHolder +} + +type bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter struct { + obj *bgpV4EviVxlanBroadcastDomain + bgpCMacIpRangeSlice []BgpCMacIpRange + fieldPtr *[]*otg.BgpCMacIpRange +} + +func newBgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter(ptr *[]*otg.BgpCMacIpRange) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { + return &bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter{fieldPtr: ptr} +} + +type BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter interface { + setMsg(*bgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter + Items() []BgpCMacIpRange + Add() BgpCMacIpRange + Append(items ...BgpCMacIpRange) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter + Set(index int, newObj BgpCMacIpRange) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter + Clear() BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter + clearHolderSlice() BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter + appendHolderSlice(item BgpCMacIpRange) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter +} + +func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) setMsg(msg *bgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpCMacIpRange{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) Items() []BgpCMacIpRange { + return obj.bgpCMacIpRangeSlice +} + +func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) Add() BgpCMacIpRange { + newObj := &otg.BgpCMacIpRange{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpCMacIpRange{obj: newObj} + newLibObj.setDefault() + obj.bgpCMacIpRangeSlice = append(obj.bgpCMacIpRangeSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) Append(items ...BgpCMacIpRange) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpCMacIpRangeSlice = append(obj.bgpCMacIpRangeSlice, item) + } + return obj +} + +func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) Set(index int, newObj BgpCMacIpRange) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpCMacIpRangeSlice[index] = newObj + return obj +} +func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) Clear() BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpCMacIpRange{} + obj.bgpCMacIpRangeSlice = []BgpCMacIpRange{} + } + return obj +} +func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) clearHolderSlice() BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { + if len(obj.bgpCMacIpRangeSlice) > 0 { + obj.bgpCMacIpRangeSlice = []BgpCMacIpRange{} + } + return obj +} +func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) appendHolderSlice(item BgpCMacIpRange) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { + obj.bgpCMacIpRangeSlice = append(obj.bgpCMacIpRangeSlice, item) + return obj +} + +// The Ethernet Tag ID of the Broadcast Domain. +// EthernetTagId returns a uint32 +func (obj *bgpV4EviVxlanBroadcastDomain) EthernetTagId() uint32 { + + return *obj.obj.EthernetTagId + +} + +// The Ethernet Tag ID of the Broadcast Domain. +// EthernetTagId returns a uint32 +func (obj *bgpV4EviVxlanBroadcastDomain) HasEthernetTagId() bool { + return obj.obj.EthernetTagId != nil +} + +// The Ethernet Tag ID of the Broadcast Domain. +// SetEthernetTagId sets the uint32 value in the BgpV4EviVxlanBroadcastDomain object +func (obj *bgpV4EviVxlanBroadcastDomain) SetEthernetTagId(value uint32) BgpV4EviVxlanBroadcastDomain { + + obj.obj.EthernetTagId = &value + return obj +} + +// VLAN-Aware service to be enabled or disabled. +// VlanAwareService returns a bool +func (obj *bgpV4EviVxlanBroadcastDomain) VlanAwareService() bool { + + return *obj.obj.VlanAwareService + +} + +// VLAN-Aware service to be enabled or disabled. +// VlanAwareService returns a bool +func (obj *bgpV4EviVxlanBroadcastDomain) HasVlanAwareService() bool { + return obj.obj.VlanAwareService != nil +} + +// VLAN-Aware service to be enabled or disabled. +// SetVlanAwareService sets the bool value in the BgpV4EviVxlanBroadcastDomain object +func (obj *bgpV4EviVxlanBroadcastDomain) SetVlanAwareService(value bool) BgpV4EviVxlanBroadcastDomain { + + obj.obj.VlanAwareService = &value + return obj +} + +func (obj *bgpV4EviVxlanBroadcastDomain) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.CmacIpRange) != 0 { + + if set_default { + obj.CmacIpRange().clearHolderSlice() + for _, item := range obj.obj.CmacIpRange { + obj.CmacIpRange().appendHolderSlice(&bgpCMacIpRange{obj: item}) + } + } + for _, item := range obj.CmacIpRange().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpV4EviVxlanBroadcastDomain) setDefault() { + if obj.obj.EthernetTagId == nil { + obj.SetEthernetTagId(0) + } + if obj.obj.VlanAwareService == nil { + obj.SetVlanAwareService(false) + } + +} diff --git a/gosnappi/bgp_v4_evpn_evis.go b/gosnappi/bgp_v4_evpn_evis.go new file mode 100644 index 00000000..ec970af7 --- /dev/null +++ b/gosnappi/bgp_v4_evpn_evis.go @@ -0,0 +1,410 @@ +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" +) + +// ***** BgpV4EvpnEvis ***** +type bgpV4EvpnEvis struct { + validation + obj *otg.BgpV4EvpnEvis + marshaller marshalBgpV4EvpnEvis + unMarshaller unMarshalBgpV4EvpnEvis + eviVxlanHolder BgpV4EviVxlan +} + +func NewBgpV4EvpnEvis() BgpV4EvpnEvis { + obj := bgpV4EvpnEvis{obj: &otg.BgpV4EvpnEvis{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV4EvpnEvis) msg() *otg.BgpV4EvpnEvis { + return obj.obj +} + +func (obj *bgpV4EvpnEvis) setMsg(msg *otg.BgpV4EvpnEvis) BgpV4EvpnEvis { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV4EvpnEvis struct { + obj *bgpV4EvpnEvis +} + +type marshalBgpV4EvpnEvis interface { + // ToProto marshals BgpV4EvpnEvis to protobuf object *otg.BgpV4EvpnEvis + ToProto() (*otg.BgpV4EvpnEvis, error) + // ToPbText marshals BgpV4EvpnEvis to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV4EvpnEvis to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV4EvpnEvis to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV4EvpnEvis struct { + obj *bgpV4EvpnEvis +} + +type unMarshalBgpV4EvpnEvis interface { + // FromProto unmarshals BgpV4EvpnEvis from protobuf object *otg.BgpV4EvpnEvis + FromProto(msg *otg.BgpV4EvpnEvis) (BgpV4EvpnEvis, error) + // FromPbText unmarshals BgpV4EvpnEvis from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV4EvpnEvis from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV4EvpnEvis from JSON text + FromJson(value string) error +} + +func (obj *bgpV4EvpnEvis) Marshal() marshalBgpV4EvpnEvis { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV4EvpnEvis{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV4EvpnEvis) Unmarshal() unMarshalBgpV4EvpnEvis { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV4EvpnEvis{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV4EvpnEvis) ToProto() (*otg.BgpV4EvpnEvis, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV4EvpnEvis) FromProto(msg *otg.BgpV4EvpnEvis) (BgpV4EvpnEvis, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV4EvpnEvis) 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 *unMarshalbgpV4EvpnEvis) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpV4EvpnEvis) 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 *unMarshalbgpV4EvpnEvis) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpV4EvpnEvis) 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 *unMarshalbgpV4EvpnEvis) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpV4EvpnEvis) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV4EvpnEvis) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV4EvpnEvis) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV4EvpnEvis) Clone() (BgpV4EvpnEvis, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV4EvpnEvis() + 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 +} + +func (obj *bgpV4EvpnEvis) setNil() { + obj.eviVxlanHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpV4EvpnEvis is this contains a list of different flavors of EVPN. +// For example EVPN over VXLAN or EVPN over MPLS etc to be configured per Ethernet segment. +// Need to instantiate correct type of EVPN instance as per requirement. +type BgpV4EvpnEvis interface { + Validation + // msg marshals BgpV4EvpnEvis to protobuf object *otg.BgpV4EvpnEvis + // and doesn't set defaults + msg() *otg.BgpV4EvpnEvis + // setMsg unmarshals BgpV4EvpnEvis from protobuf object *otg.BgpV4EvpnEvis + // and doesn't set defaults + setMsg(*otg.BgpV4EvpnEvis) BgpV4EvpnEvis + // provides marshal interface + Marshal() marshalBgpV4EvpnEvis + // provides unmarshal interface + Unmarshal() unMarshalBgpV4EvpnEvis + // validate validates BgpV4EvpnEvis + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV4EvpnEvis, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpV4EvpnEvisChoiceEnum, set in BgpV4EvpnEvis + Choice() BgpV4EvpnEvisChoiceEnum + // setChoice assigns BgpV4EvpnEvisChoiceEnum provided by user to BgpV4EvpnEvis + setChoice(value BgpV4EvpnEvisChoiceEnum) BgpV4EvpnEvis + // HasChoice checks if Choice has been set in BgpV4EvpnEvis + HasChoice() bool + // EviVxlan returns BgpV4EviVxlan, set in BgpV4EvpnEvis. + // BgpV4EviVxlan is configuration for BGP EVPN EVI. Advertises following routes - + // + // # Type 3 - Inclusive Multicast Ethernet Tag Route + // + // Type 1 - Ethernet Auto-discovery Route (Per EVI) + // + // Type 1 - Ethernet Auto-discovery Route (Per ES) + EviVxlan() BgpV4EviVxlan + // SetEviVxlan assigns BgpV4EviVxlan provided by user to BgpV4EvpnEvis. + // BgpV4EviVxlan is configuration for BGP EVPN EVI. Advertises following routes - + // + // # Type 3 - Inclusive Multicast Ethernet Tag Route + // + // Type 1 - Ethernet Auto-discovery Route (Per EVI) + // + // Type 1 - Ethernet Auto-discovery Route (Per ES) + SetEviVxlan(value BgpV4EviVxlan) BgpV4EvpnEvis + // HasEviVxlan checks if EviVxlan has been set in BgpV4EvpnEvis + HasEviVxlan() bool + setNil() +} + +type BgpV4EvpnEvisChoiceEnum string + +// Enum of Choice on BgpV4EvpnEvis +var BgpV4EvpnEvisChoice = struct { + EVI_VXLAN BgpV4EvpnEvisChoiceEnum +}{ + EVI_VXLAN: BgpV4EvpnEvisChoiceEnum("evi_vxlan"), +} + +func (obj *bgpV4EvpnEvis) Choice() BgpV4EvpnEvisChoiceEnum { + return BgpV4EvpnEvisChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *bgpV4EvpnEvis) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpV4EvpnEvis) setChoice(value BgpV4EvpnEvisChoiceEnum) BgpV4EvpnEvis { + intValue, ok := otg.BgpV4EvpnEvis_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpV4EvpnEvisChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpV4EvpnEvis_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.EviVxlan = nil + obj.eviVxlanHolder = nil + + if value == BgpV4EvpnEvisChoice.EVI_VXLAN { + obj.obj.EviVxlan = NewBgpV4EviVxlan().msg() + } + + return obj +} + +// EVPN VXLAN instance to be configured per Ethernet Segment. +// EviVxlan returns a BgpV4EviVxlan +func (obj *bgpV4EvpnEvis) EviVxlan() BgpV4EviVxlan { + if obj.obj.EviVxlan == nil { + obj.setChoice(BgpV4EvpnEvisChoice.EVI_VXLAN) + } + if obj.eviVxlanHolder == nil { + obj.eviVxlanHolder = &bgpV4EviVxlan{obj: obj.obj.EviVxlan} + } + return obj.eviVxlanHolder +} + +// EVPN VXLAN instance to be configured per Ethernet Segment. +// EviVxlan returns a BgpV4EviVxlan +func (obj *bgpV4EvpnEvis) HasEviVxlan() bool { + return obj.obj.EviVxlan != nil +} + +// EVPN VXLAN instance to be configured per Ethernet Segment. +// SetEviVxlan sets the BgpV4EviVxlan value in the BgpV4EvpnEvis object +func (obj *bgpV4EvpnEvis) SetEviVxlan(value BgpV4EviVxlan) BgpV4EvpnEvis { + obj.setChoice(BgpV4EvpnEvisChoice.EVI_VXLAN) + obj.eviVxlanHolder = nil + obj.obj.EviVxlan = value.msg() + + return obj +} + +func (obj *bgpV4EvpnEvis) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.EviVxlan != nil { + + obj.EviVxlan().validateObj(vObj, set_default) + } + +} + +func (obj *bgpV4EvpnEvis) setDefault() { + var choices_set int = 0 + var choice BgpV4EvpnEvisChoiceEnum + + if obj.obj.EviVxlan != nil { + choices_set += 1 + choice = BgpV4EvpnEvisChoice.EVI_VXLAN + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(BgpV4EvpnEvisChoice.EVI_VXLAN) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpV4EvpnEvis") + } + } else { + intVal := otg.BgpV4EvpnEvis_Choice_Enum_value[string(choice)] + enumValue := otg.BgpV4EvpnEvis_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_v4_interface.go b/gosnappi/bgp_v4_interface.go new file mode 100644 index 00000000..341c0495 --- /dev/null +++ b/gosnappi/bgp_v4_interface.go @@ -0,0 +1,437 @@ +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" +) + +// ***** BgpV4Interface ***** +type bgpV4Interface struct { + validation + obj *otg.BgpV4Interface + marshaller marshalBgpV4Interface + unMarshaller unMarshalBgpV4Interface + peersHolder BgpV4InterfaceBgpV4PeerIter +} + +func NewBgpV4Interface() BgpV4Interface { + obj := bgpV4Interface{obj: &otg.BgpV4Interface{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV4Interface) msg() *otg.BgpV4Interface { + return obj.obj +} + +func (obj *bgpV4Interface) setMsg(msg *otg.BgpV4Interface) BgpV4Interface { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV4Interface struct { + obj *bgpV4Interface +} + +type marshalBgpV4Interface interface { + // ToProto marshals BgpV4Interface to protobuf object *otg.BgpV4Interface + ToProto() (*otg.BgpV4Interface, error) + // ToPbText marshals BgpV4Interface to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV4Interface to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV4Interface to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV4Interface struct { + obj *bgpV4Interface +} + +type unMarshalBgpV4Interface interface { + // FromProto unmarshals BgpV4Interface from protobuf object *otg.BgpV4Interface + FromProto(msg *otg.BgpV4Interface) (BgpV4Interface, error) + // FromPbText unmarshals BgpV4Interface from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV4Interface from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV4Interface from JSON text + FromJson(value string) error +} + +func (obj *bgpV4Interface) Marshal() marshalBgpV4Interface { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV4Interface{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV4Interface) Unmarshal() unMarshalBgpV4Interface { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV4Interface{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV4Interface) ToProto() (*otg.BgpV4Interface, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV4Interface) FromProto(msg *otg.BgpV4Interface) (BgpV4Interface, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV4Interface) 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 *unMarshalbgpV4Interface) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpV4Interface) 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 *unMarshalbgpV4Interface) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpV4Interface) 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 *unMarshalbgpV4Interface) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpV4Interface) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV4Interface) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV4Interface) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV4Interface) Clone() (BgpV4Interface, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV4Interface() + 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 +} + +func (obj *bgpV4Interface) setNil() { + obj.peersHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpV4Interface is configuration for emulated BGPv4 peers and routes on a single IPv4 interface. +type BgpV4Interface interface { + Validation + // msg marshals BgpV4Interface to protobuf object *otg.BgpV4Interface + // and doesn't set defaults + msg() *otg.BgpV4Interface + // setMsg unmarshals BgpV4Interface from protobuf object *otg.BgpV4Interface + // and doesn't set defaults + setMsg(*otg.BgpV4Interface) BgpV4Interface + // provides marshal interface + Marshal() marshalBgpV4Interface + // provides unmarshal interface + Unmarshal() unMarshalBgpV4Interface + // validate validates BgpV4Interface + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV4Interface, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv4Name returns string, set in BgpV4Interface. + Ipv4Name() string + // SetIpv4Name assigns string provided by user to BgpV4Interface + SetIpv4Name(value string) BgpV4Interface + // Peers returns BgpV4InterfaceBgpV4PeerIterIter, set in BgpV4Interface + Peers() BgpV4InterfaceBgpV4PeerIter + setNil() +} + +// The unique name of the IPv4, Loopback IPv4 interface or DHCPv4 client used as the source IP for this list of BGP peers. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv4Loopback/properties/name +// - /components/schemas/DhcpClient.V4/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv4Loopback/properties/name +// - /components/schemas/DhcpClient.V4/properties/name +// +// Ipv4Name returns a string +func (obj *bgpV4Interface) Ipv4Name() string { + + return *obj.obj.Ipv4Name + +} + +// The unique name of the IPv4, Loopback IPv4 interface or DHCPv4 client used as the source IP for this list of BGP peers. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv4Loopback/properties/name +// - /components/schemas/DhcpClient.V4/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv4Loopback/properties/name +// - /components/schemas/DhcpClient.V4/properties/name +// +// SetIpv4Name sets the string value in the BgpV4Interface object +func (obj *bgpV4Interface) SetIpv4Name(value string) BgpV4Interface { + + obj.obj.Ipv4Name = &value + return obj +} + +// This contains the list of BGPv4 peers configured on this interface. +// Peers returns a []BgpV4Peer +func (obj *bgpV4Interface) Peers() BgpV4InterfaceBgpV4PeerIter { + if len(obj.obj.Peers) == 0 { + obj.obj.Peers = []*otg.BgpV4Peer{} + } + if obj.peersHolder == nil { + obj.peersHolder = newBgpV4InterfaceBgpV4PeerIter(&obj.obj.Peers).setMsg(obj) + } + return obj.peersHolder +} + +type bgpV4InterfaceBgpV4PeerIter struct { + obj *bgpV4Interface + bgpV4PeerSlice []BgpV4Peer + fieldPtr *[]*otg.BgpV4Peer +} + +func newBgpV4InterfaceBgpV4PeerIter(ptr *[]*otg.BgpV4Peer) BgpV4InterfaceBgpV4PeerIter { + return &bgpV4InterfaceBgpV4PeerIter{fieldPtr: ptr} +} + +type BgpV4InterfaceBgpV4PeerIter interface { + setMsg(*bgpV4Interface) BgpV4InterfaceBgpV4PeerIter + Items() []BgpV4Peer + Add() BgpV4Peer + Append(items ...BgpV4Peer) BgpV4InterfaceBgpV4PeerIter + Set(index int, newObj BgpV4Peer) BgpV4InterfaceBgpV4PeerIter + Clear() BgpV4InterfaceBgpV4PeerIter + clearHolderSlice() BgpV4InterfaceBgpV4PeerIter + appendHolderSlice(item BgpV4Peer) BgpV4InterfaceBgpV4PeerIter +} + +func (obj *bgpV4InterfaceBgpV4PeerIter) setMsg(msg *bgpV4Interface) BgpV4InterfaceBgpV4PeerIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpV4Peer{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4InterfaceBgpV4PeerIter) Items() []BgpV4Peer { + return obj.bgpV4PeerSlice +} + +func (obj *bgpV4InterfaceBgpV4PeerIter) Add() BgpV4Peer { + newObj := &otg.BgpV4Peer{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpV4Peer{obj: newObj} + newLibObj.setDefault() + obj.bgpV4PeerSlice = append(obj.bgpV4PeerSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4InterfaceBgpV4PeerIter) Append(items ...BgpV4Peer) BgpV4InterfaceBgpV4PeerIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpV4PeerSlice = append(obj.bgpV4PeerSlice, item) + } + return obj +} + +func (obj *bgpV4InterfaceBgpV4PeerIter) Set(index int, newObj BgpV4Peer) BgpV4InterfaceBgpV4PeerIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpV4PeerSlice[index] = newObj + return obj +} +func (obj *bgpV4InterfaceBgpV4PeerIter) Clear() BgpV4InterfaceBgpV4PeerIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpV4Peer{} + obj.bgpV4PeerSlice = []BgpV4Peer{} + } + return obj +} +func (obj *bgpV4InterfaceBgpV4PeerIter) clearHolderSlice() BgpV4InterfaceBgpV4PeerIter { + if len(obj.bgpV4PeerSlice) > 0 { + obj.bgpV4PeerSlice = []BgpV4Peer{} + } + return obj +} +func (obj *bgpV4InterfaceBgpV4PeerIter) appendHolderSlice(item BgpV4Peer) BgpV4InterfaceBgpV4PeerIter { + obj.bgpV4PeerSlice = append(obj.bgpV4PeerSlice, item) + return obj +} + +func (obj *bgpV4Interface) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Ipv4Name is required + if obj.obj.Ipv4Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Ipv4Name is required field on interface BgpV4Interface") + } + + if len(obj.obj.Peers) != 0 { + + if set_default { + obj.Peers().clearHolderSlice() + for _, item := range obj.obj.Peers { + obj.Peers().appendHolderSlice(&bgpV4Peer{obj: item}) + } + } + for _, item := range obj.Peers().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpV4Interface) setDefault() { + +} diff --git a/gosnappi/bgp_v4_peer.go b/gosnappi/bgp_v4_peer.go new file mode 100644 index 00000000..ba8c3835 --- /dev/null +++ b/gosnappi/bgp_v4_peer.go @@ -0,0 +1,1205 @@ +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" +) + +// ***** BgpV4Peer ***** +type bgpV4Peer struct { + validation + obj *otg.BgpV4Peer + marshaller marshalBgpV4Peer + unMarshaller unMarshalBgpV4Peer + evpnEthernetSegmentsHolder BgpV4PeerBgpV4EthernetSegmentIter + advancedHolder BgpAdvanced + capabilityHolder BgpCapability + learnedInformationFilterHolder BgpLearnedInformationFilter + v4RoutesHolder BgpV4PeerBgpV4RouteRangeIter + v6RoutesHolder BgpV4PeerBgpV6RouteRangeIter + v4SrtePoliciesHolder BgpV4PeerBgpSrteV4PolicyIter + v6SrtePoliciesHolder BgpV4PeerBgpSrteV6PolicyIter + gracefulRestartHolder BgpGracefulRestart + replayUpdatesHolder BgpUpdateReplay +} + +func NewBgpV4Peer() BgpV4Peer { + obj := bgpV4Peer{obj: &otg.BgpV4Peer{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV4Peer) msg() *otg.BgpV4Peer { + return obj.obj +} + +func (obj *bgpV4Peer) setMsg(msg *otg.BgpV4Peer) BgpV4Peer { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV4Peer struct { + obj *bgpV4Peer +} + +type marshalBgpV4Peer interface { + // ToProto marshals BgpV4Peer to protobuf object *otg.BgpV4Peer + ToProto() (*otg.BgpV4Peer, error) + // ToPbText marshals BgpV4Peer to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV4Peer to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV4Peer to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV4Peer struct { + obj *bgpV4Peer +} + +type unMarshalBgpV4Peer interface { + // FromProto unmarshals BgpV4Peer from protobuf object *otg.BgpV4Peer + FromProto(msg *otg.BgpV4Peer) (BgpV4Peer, error) + // FromPbText unmarshals BgpV4Peer from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV4Peer from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV4Peer from JSON text + FromJson(value string) error +} + +func (obj *bgpV4Peer) Marshal() marshalBgpV4Peer { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV4Peer{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV4Peer) Unmarshal() unMarshalBgpV4Peer { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV4Peer{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV4Peer) ToProto() (*otg.BgpV4Peer, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV4Peer) FromProto(msg *otg.BgpV4Peer) (BgpV4Peer, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV4Peer) 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 *unMarshalbgpV4Peer) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpV4Peer) 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 *unMarshalbgpV4Peer) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpV4Peer) 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 *unMarshalbgpV4Peer) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpV4Peer) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV4Peer) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV4Peer) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV4Peer) Clone() (BgpV4Peer, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV4Peer() + 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 +} + +func (obj *bgpV4Peer) setNil() { + obj.evpnEthernetSegmentsHolder = nil + obj.advancedHolder = nil + obj.capabilityHolder = nil + obj.learnedInformationFilterHolder = nil + obj.v4RoutesHolder = nil + obj.v6RoutesHolder = nil + obj.v4SrtePoliciesHolder = nil + obj.v6SrtePoliciesHolder = nil + obj.gracefulRestartHolder = nil + obj.replayUpdatesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpV4Peer is configuration for emulated BGPv4 peers and routes. +type BgpV4Peer interface { + Validation + // msg marshals BgpV4Peer to protobuf object *otg.BgpV4Peer + // and doesn't set defaults + msg() *otg.BgpV4Peer + // setMsg unmarshals BgpV4Peer from protobuf object *otg.BgpV4Peer + // and doesn't set defaults + setMsg(*otg.BgpV4Peer) BgpV4Peer + // provides marshal interface + Marshal() marshalBgpV4Peer + // provides unmarshal interface + Unmarshal() unMarshalBgpV4Peer + // validate validates BgpV4Peer + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV4Peer, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PeerAddress returns string, set in BgpV4Peer. + PeerAddress() string + // SetPeerAddress assigns string provided by user to BgpV4Peer + SetPeerAddress(value string) BgpV4Peer + // EvpnEthernetSegments returns BgpV4PeerBgpV4EthernetSegmentIterIter, set in BgpV4Peer + EvpnEthernetSegments() BgpV4PeerBgpV4EthernetSegmentIter + // AsType returns BgpV4PeerAsTypeEnum, set in BgpV4Peer + AsType() BgpV4PeerAsTypeEnum + // SetAsType assigns BgpV4PeerAsTypeEnum provided by user to BgpV4Peer + SetAsType(value BgpV4PeerAsTypeEnum) BgpV4Peer + // AsNumber returns uint32, set in BgpV4Peer. + AsNumber() uint32 + // SetAsNumber assigns uint32 provided by user to BgpV4Peer + SetAsNumber(value uint32) BgpV4Peer + // AsNumberWidth returns BgpV4PeerAsNumberWidthEnum, set in BgpV4Peer + AsNumberWidth() BgpV4PeerAsNumberWidthEnum + // SetAsNumberWidth assigns BgpV4PeerAsNumberWidthEnum provided by user to BgpV4Peer + SetAsNumberWidth(value BgpV4PeerAsNumberWidthEnum) BgpV4Peer + // HasAsNumberWidth checks if AsNumberWidth has been set in BgpV4Peer + HasAsNumberWidth() bool + // Advanced returns BgpAdvanced, set in BgpV4Peer. + // BgpAdvanced is configuration for BGP advanced settings. + Advanced() BgpAdvanced + // SetAdvanced assigns BgpAdvanced provided by user to BgpV4Peer. + // BgpAdvanced is configuration for BGP advanced settings. + SetAdvanced(value BgpAdvanced) BgpV4Peer + // HasAdvanced checks if Advanced has been set in BgpV4Peer + HasAdvanced() bool + // Capability returns BgpCapability, set in BgpV4Peer. + // BgpCapability is configuration for BGP capability settings. + Capability() BgpCapability + // SetCapability assigns BgpCapability provided by user to BgpV4Peer. + // BgpCapability is configuration for BGP capability settings. + SetCapability(value BgpCapability) BgpV4Peer + // HasCapability checks if Capability has been set in BgpV4Peer + HasCapability() bool + // LearnedInformationFilter returns BgpLearnedInformationFilter, set in BgpV4Peer. + // BgpLearnedInformationFilter is configuration for controlling storage of BGP learned information recieved from the peer. + LearnedInformationFilter() BgpLearnedInformationFilter + // SetLearnedInformationFilter assigns BgpLearnedInformationFilter provided by user to BgpV4Peer. + // BgpLearnedInformationFilter is configuration for controlling storage of BGP learned information recieved from the peer. + SetLearnedInformationFilter(value BgpLearnedInformationFilter) BgpV4Peer + // HasLearnedInformationFilter checks if LearnedInformationFilter has been set in BgpV4Peer + HasLearnedInformationFilter() bool + // V4Routes returns BgpV4PeerBgpV4RouteRangeIterIter, set in BgpV4Peer + V4Routes() BgpV4PeerBgpV4RouteRangeIter + // V6Routes returns BgpV4PeerBgpV6RouteRangeIterIter, set in BgpV4Peer + V6Routes() BgpV4PeerBgpV6RouteRangeIter + // V4SrtePolicies returns BgpV4PeerBgpSrteV4PolicyIterIter, set in BgpV4Peer + V4SrtePolicies() BgpV4PeerBgpSrteV4PolicyIter + // V6SrtePolicies returns BgpV4PeerBgpSrteV6PolicyIterIter, set in BgpV4Peer + V6SrtePolicies() BgpV4PeerBgpSrteV6PolicyIter + // Name returns string, set in BgpV4Peer. + Name() string + // SetName assigns string provided by user to BgpV4Peer + SetName(value string) BgpV4Peer + // GracefulRestart returns BgpGracefulRestart, set in BgpV4Peer. + // BgpGracefulRestart is the Graceful Restart Capability (RFC 4724) is a BGP capability that can be used by a BGP speaker to indicate its ability to preserve its forwarding state during BGP restart. The Graceful Restart (GR) capability is advertised in OPEN messages sent between BGP peers. After a BGP session has been established, and the initial routing update has been completed, an End-of-RIB (Routing Information Base) marker is sent in an UPDATE message to convey information about routing convergence. + GracefulRestart() BgpGracefulRestart + // SetGracefulRestart assigns BgpGracefulRestart provided by user to BgpV4Peer. + // BgpGracefulRestart is the Graceful Restart Capability (RFC 4724) is a BGP capability that can be used by a BGP speaker to indicate its ability to preserve its forwarding state during BGP restart. The Graceful Restart (GR) capability is advertised in OPEN messages sent between BGP peers. After a BGP session has been established, and the initial routing update has been completed, an End-of-RIB (Routing Information Base) marker is sent in an UPDATE message to convey information about routing convergence. + SetGracefulRestart(value BgpGracefulRestart) BgpV4Peer + // HasGracefulRestart checks if GracefulRestart has been set in BgpV4Peer + HasGracefulRestart() bool + // ReplayUpdates returns BgpUpdateReplay, set in BgpV4Peer. + // BgpUpdateReplay is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. + ReplayUpdates() BgpUpdateReplay + // SetReplayUpdates assigns BgpUpdateReplay provided by user to BgpV4Peer. + // BgpUpdateReplay is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. + SetReplayUpdates(value BgpUpdateReplay) BgpV4Peer + // HasReplayUpdates checks if ReplayUpdates has been set in BgpV4Peer + HasReplayUpdates() bool + setNil() +} + +// IPv4 address of the BGP peer for the session. +// PeerAddress returns a string +func (obj *bgpV4Peer) PeerAddress() string { + + return *obj.obj.PeerAddress + +} + +// IPv4 address of the BGP peer for the session. +// SetPeerAddress sets the string value in the BgpV4Peer object +func (obj *bgpV4Peer) SetPeerAddress(value string) BgpV4Peer { + + obj.obj.PeerAddress = &value + return obj +} + +// This contains the list of Ethernet Virtual Private Network (EVPN) Ethernet Segments (ES) Per BGP Peer for IPv4 Address Family Identifier (AFI). +// +// Each Ethernet Segment contains a list of EVPN Instances (EVIs) . +// Each EVI contains a list of Broadcast Domains. +// Each Broadcast Domain contains a list of MAC/IP Ranges. +// +// is responsible for advertising Ethernet Auto-discovery Route Per EVI (Type 1). +// +// is responsible for advertising Ethernet Auto-discovery Route Per Ethernet Segment (Type 1). +// +// is responsible for advertising MAC/IP Advertisement Route (Type 2). +// +// is responsible for advertising Inclusive Multicast Ethernet Tag Route (Type 3). +// +// Ethernet Segment is responsible for advertising Ethernet Segment Route (Type 4). +// EvpnEthernetSegments returns a []BgpV4EthernetSegment +func (obj *bgpV4Peer) EvpnEthernetSegments() BgpV4PeerBgpV4EthernetSegmentIter { + if len(obj.obj.EvpnEthernetSegments) == 0 { + obj.obj.EvpnEthernetSegments = []*otg.BgpV4EthernetSegment{} + } + if obj.evpnEthernetSegmentsHolder == nil { + obj.evpnEthernetSegmentsHolder = newBgpV4PeerBgpV4EthernetSegmentIter(&obj.obj.EvpnEthernetSegments).setMsg(obj) + } + return obj.evpnEthernetSegmentsHolder +} + +type bgpV4PeerBgpV4EthernetSegmentIter struct { + obj *bgpV4Peer + bgpV4EthernetSegmentSlice []BgpV4EthernetSegment + fieldPtr *[]*otg.BgpV4EthernetSegment +} + +func newBgpV4PeerBgpV4EthernetSegmentIter(ptr *[]*otg.BgpV4EthernetSegment) BgpV4PeerBgpV4EthernetSegmentIter { + return &bgpV4PeerBgpV4EthernetSegmentIter{fieldPtr: ptr} +} + +type BgpV4PeerBgpV4EthernetSegmentIter interface { + setMsg(*bgpV4Peer) BgpV4PeerBgpV4EthernetSegmentIter + Items() []BgpV4EthernetSegment + Add() BgpV4EthernetSegment + Append(items ...BgpV4EthernetSegment) BgpV4PeerBgpV4EthernetSegmentIter + Set(index int, newObj BgpV4EthernetSegment) BgpV4PeerBgpV4EthernetSegmentIter + Clear() BgpV4PeerBgpV4EthernetSegmentIter + clearHolderSlice() BgpV4PeerBgpV4EthernetSegmentIter + appendHolderSlice(item BgpV4EthernetSegment) BgpV4PeerBgpV4EthernetSegmentIter +} + +func (obj *bgpV4PeerBgpV4EthernetSegmentIter) setMsg(msg *bgpV4Peer) BgpV4PeerBgpV4EthernetSegmentIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpV4EthernetSegment{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4PeerBgpV4EthernetSegmentIter) Items() []BgpV4EthernetSegment { + return obj.bgpV4EthernetSegmentSlice +} + +func (obj *bgpV4PeerBgpV4EthernetSegmentIter) Add() BgpV4EthernetSegment { + newObj := &otg.BgpV4EthernetSegment{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpV4EthernetSegment{obj: newObj} + newLibObj.setDefault() + obj.bgpV4EthernetSegmentSlice = append(obj.bgpV4EthernetSegmentSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4PeerBgpV4EthernetSegmentIter) Append(items ...BgpV4EthernetSegment) BgpV4PeerBgpV4EthernetSegmentIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpV4EthernetSegmentSlice = append(obj.bgpV4EthernetSegmentSlice, item) + } + return obj +} + +func (obj *bgpV4PeerBgpV4EthernetSegmentIter) Set(index int, newObj BgpV4EthernetSegment) BgpV4PeerBgpV4EthernetSegmentIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpV4EthernetSegmentSlice[index] = newObj + return obj +} +func (obj *bgpV4PeerBgpV4EthernetSegmentIter) Clear() BgpV4PeerBgpV4EthernetSegmentIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpV4EthernetSegment{} + obj.bgpV4EthernetSegmentSlice = []BgpV4EthernetSegment{} + } + return obj +} +func (obj *bgpV4PeerBgpV4EthernetSegmentIter) clearHolderSlice() BgpV4PeerBgpV4EthernetSegmentIter { + if len(obj.bgpV4EthernetSegmentSlice) > 0 { + obj.bgpV4EthernetSegmentSlice = []BgpV4EthernetSegment{} + } + return obj +} +func (obj *bgpV4PeerBgpV4EthernetSegmentIter) appendHolderSlice(item BgpV4EthernetSegment) BgpV4PeerBgpV4EthernetSegmentIter { + obj.bgpV4EthernetSegmentSlice = append(obj.bgpV4EthernetSegmentSlice, item) + return obj +} + +type BgpV4PeerAsTypeEnum string + +// Enum of AsType on BgpV4Peer +var BgpV4PeerAsType = struct { + IBGP BgpV4PeerAsTypeEnum + EBGP BgpV4PeerAsTypeEnum +}{ + IBGP: BgpV4PeerAsTypeEnum("ibgp"), + EBGP: BgpV4PeerAsTypeEnum("ebgp"), +} + +func (obj *bgpV4Peer) AsType() BgpV4PeerAsTypeEnum { + return BgpV4PeerAsTypeEnum(obj.obj.AsType.Enum().String()) +} + +func (obj *bgpV4Peer) SetAsType(value BgpV4PeerAsTypeEnum) BgpV4Peer { + intValue, ok := otg.BgpV4Peer_AsType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpV4PeerAsTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpV4Peer_AsType_Enum(intValue) + obj.obj.AsType = &enumValue + + return obj +} + +// Autonomous System Number (AS number or ASN) +// AsNumber returns a uint32 +func (obj *bgpV4Peer) AsNumber() uint32 { + + return *obj.obj.AsNumber + +} + +// Autonomous System Number (AS number or ASN) +// SetAsNumber sets the uint32 value in the BgpV4Peer object +func (obj *bgpV4Peer) SetAsNumber(value uint32) BgpV4Peer { + + obj.obj.AsNumber = &value + return obj +} + +type BgpV4PeerAsNumberWidthEnum string + +// Enum of AsNumberWidth on BgpV4Peer +var BgpV4PeerAsNumberWidth = struct { + TWO BgpV4PeerAsNumberWidthEnum + FOUR BgpV4PeerAsNumberWidthEnum +}{ + TWO: BgpV4PeerAsNumberWidthEnum("two"), + FOUR: BgpV4PeerAsNumberWidthEnum("four"), +} + +func (obj *bgpV4Peer) AsNumberWidth() BgpV4PeerAsNumberWidthEnum { + return BgpV4PeerAsNumberWidthEnum(obj.obj.AsNumberWidth.Enum().String()) +} + +// The width in bytes of the as_number values. Any as_number values that exceeds the width MUST result in an error. +// AsNumberWidth returns a string +func (obj *bgpV4Peer) HasAsNumberWidth() bool { + return obj.obj.AsNumberWidth != nil +} + +func (obj *bgpV4Peer) SetAsNumberWidth(value BgpV4PeerAsNumberWidthEnum) BgpV4Peer { + intValue, ok := otg.BgpV4Peer_AsNumberWidth_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpV4PeerAsNumberWidthEnum", string(value))) + return obj + } + enumValue := otg.BgpV4Peer_AsNumberWidth_Enum(intValue) + obj.obj.AsNumberWidth = &enumValue + + return obj +} + +// description is TBD +// Advanced returns a BgpAdvanced +func (obj *bgpV4Peer) Advanced() BgpAdvanced { + if obj.obj.Advanced == nil { + obj.obj.Advanced = NewBgpAdvanced().msg() + } + if obj.advancedHolder == nil { + obj.advancedHolder = &bgpAdvanced{obj: obj.obj.Advanced} + } + return obj.advancedHolder +} + +// description is TBD +// Advanced returns a BgpAdvanced +func (obj *bgpV4Peer) HasAdvanced() bool { + return obj.obj.Advanced != nil +} + +// description is TBD +// SetAdvanced sets the BgpAdvanced value in the BgpV4Peer object +func (obj *bgpV4Peer) SetAdvanced(value BgpAdvanced) BgpV4Peer { + + obj.advancedHolder = nil + obj.obj.Advanced = value.msg() + + return obj +} + +// description is TBD +// Capability returns a BgpCapability +func (obj *bgpV4Peer) Capability() BgpCapability { + if obj.obj.Capability == nil { + obj.obj.Capability = NewBgpCapability().msg() + } + if obj.capabilityHolder == nil { + obj.capabilityHolder = &bgpCapability{obj: obj.obj.Capability} + } + return obj.capabilityHolder +} + +// description is TBD +// Capability returns a BgpCapability +func (obj *bgpV4Peer) HasCapability() bool { + return obj.obj.Capability != nil +} + +// description is TBD +// SetCapability sets the BgpCapability value in the BgpV4Peer object +func (obj *bgpV4Peer) SetCapability(value BgpCapability) BgpV4Peer { + + obj.capabilityHolder = nil + obj.obj.Capability = value.msg() + + return obj +} + +// description is TBD +// LearnedInformationFilter returns a BgpLearnedInformationFilter +func (obj *bgpV4Peer) LearnedInformationFilter() BgpLearnedInformationFilter { + if obj.obj.LearnedInformationFilter == nil { + obj.obj.LearnedInformationFilter = NewBgpLearnedInformationFilter().msg() + } + if obj.learnedInformationFilterHolder == nil { + obj.learnedInformationFilterHolder = &bgpLearnedInformationFilter{obj: obj.obj.LearnedInformationFilter} + } + return obj.learnedInformationFilterHolder +} + +// description is TBD +// LearnedInformationFilter returns a BgpLearnedInformationFilter +func (obj *bgpV4Peer) HasLearnedInformationFilter() bool { + return obj.obj.LearnedInformationFilter != nil +} + +// description is TBD +// SetLearnedInformationFilter sets the BgpLearnedInformationFilter value in the BgpV4Peer object +func (obj *bgpV4Peer) SetLearnedInformationFilter(value BgpLearnedInformationFilter) BgpV4Peer { + + obj.learnedInformationFilterHolder = nil + obj.obj.LearnedInformationFilter = value.msg() + + return obj +} + +// Emulated BGPv4 route ranges. +// V4Routes returns a []BgpV4RouteRange +func (obj *bgpV4Peer) V4Routes() BgpV4PeerBgpV4RouteRangeIter { + if len(obj.obj.V4Routes) == 0 { + obj.obj.V4Routes = []*otg.BgpV4RouteRange{} + } + if obj.v4RoutesHolder == nil { + obj.v4RoutesHolder = newBgpV4PeerBgpV4RouteRangeIter(&obj.obj.V4Routes).setMsg(obj) + } + return obj.v4RoutesHolder +} + +type bgpV4PeerBgpV4RouteRangeIter struct { + obj *bgpV4Peer + bgpV4RouteRangeSlice []BgpV4RouteRange + fieldPtr *[]*otg.BgpV4RouteRange +} + +func newBgpV4PeerBgpV4RouteRangeIter(ptr *[]*otg.BgpV4RouteRange) BgpV4PeerBgpV4RouteRangeIter { + return &bgpV4PeerBgpV4RouteRangeIter{fieldPtr: ptr} +} + +type BgpV4PeerBgpV4RouteRangeIter interface { + setMsg(*bgpV4Peer) BgpV4PeerBgpV4RouteRangeIter + Items() []BgpV4RouteRange + Add() BgpV4RouteRange + Append(items ...BgpV4RouteRange) BgpV4PeerBgpV4RouteRangeIter + Set(index int, newObj BgpV4RouteRange) BgpV4PeerBgpV4RouteRangeIter + Clear() BgpV4PeerBgpV4RouteRangeIter + clearHolderSlice() BgpV4PeerBgpV4RouteRangeIter + appendHolderSlice(item BgpV4RouteRange) BgpV4PeerBgpV4RouteRangeIter +} + +func (obj *bgpV4PeerBgpV4RouteRangeIter) setMsg(msg *bgpV4Peer) BgpV4PeerBgpV4RouteRangeIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpV4RouteRange{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4PeerBgpV4RouteRangeIter) Items() []BgpV4RouteRange { + return obj.bgpV4RouteRangeSlice +} + +func (obj *bgpV4PeerBgpV4RouteRangeIter) Add() BgpV4RouteRange { + newObj := &otg.BgpV4RouteRange{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpV4RouteRange{obj: newObj} + newLibObj.setDefault() + obj.bgpV4RouteRangeSlice = append(obj.bgpV4RouteRangeSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4PeerBgpV4RouteRangeIter) Append(items ...BgpV4RouteRange) BgpV4PeerBgpV4RouteRangeIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpV4RouteRangeSlice = append(obj.bgpV4RouteRangeSlice, item) + } + return obj +} + +func (obj *bgpV4PeerBgpV4RouteRangeIter) Set(index int, newObj BgpV4RouteRange) BgpV4PeerBgpV4RouteRangeIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpV4RouteRangeSlice[index] = newObj + return obj +} +func (obj *bgpV4PeerBgpV4RouteRangeIter) Clear() BgpV4PeerBgpV4RouteRangeIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpV4RouteRange{} + obj.bgpV4RouteRangeSlice = []BgpV4RouteRange{} + } + return obj +} +func (obj *bgpV4PeerBgpV4RouteRangeIter) clearHolderSlice() BgpV4PeerBgpV4RouteRangeIter { + if len(obj.bgpV4RouteRangeSlice) > 0 { + obj.bgpV4RouteRangeSlice = []BgpV4RouteRange{} + } + return obj +} +func (obj *bgpV4PeerBgpV4RouteRangeIter) appendHolderSlice(item BgpV4RouteRange) BgpV4PeerBgpV4RouteRangeIter { + obj.bgpV4RouteRangeSlice = append(obj.bgpV4RouteRangeSlice, item) + return obj +} + +// Emulated BGPv6 route ranges. +// V6Routes returns a []BgpV6RouteRange +func (obj *bgpV4Peer) V6Routes() BgpV4PeerBgpV6RouteRangeIter { + if len(obj.obj.V6Routes) == 0 { + obj.obj.V6Routes = []*otg.BgpV6RouteRange{} + } + if obj.v6RoutesHolder == nil { + obj.v6RoutesHolder = newBgpV4PeerBgpV6RouteRangeIter(&obj.obj.V6Routes).setMsg(obj) + } + return obj.v6RoutesHolder +} + +type bgpV4PeerBgpV6RouteRangeIter struct { + obj *bgpV4Peer + bgpV6RouteRangeSlice []BgpV6RouteRange + fieldPtr *[]*otg.BgpV6RouteRange +} + +func newBgpV4PeerBgpV6RouteRangeIter(ptr *[]*otg.BgpV6RouteRange) BgpV4PeerBgpV6RouteRangeIter { + return &bgpV4PeerBgpV6RouteRangeIter{fieldPtr: ptr} +} + +type BgpV4PeerBgpV6RouteRangeIter interface { + setMsg(*bgpV4Peer) BgpV4PeerBgpV6RouteRangeIter + Items() []BgpV6RouteRange + Add() BgpV6RouteRange + Append(items ...BgpV6RouteRange) BgpV4PeerBgpV6RouteRangeIter + Set(index int, newObj BgpV6RouteRange) BgpV4PeerBgpV6RouteRangeIter + Clear() BgpV4PeerBgpV6RouteRangeIter + clearHolderSlice() BgpV4PeerBgpV6RouteRangeIter + appendHolderSlice(item BgpV6RouteRange) BgpV4PeerBgpV6RouteRangeIter +} + +func (obj *bgpV4PeerBgpV6RouteRangeIter) setMsg(msg *bgpV4Peer) BgpV4PeerBgpV6RouteRangeIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpV6RouteRange{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4PeerBgpV6RouteRangeIter) Items() []BgpV6RouteRange { + return obj.bgpV6RouteRangeSlice +} + +func (obj *bgpV4PeerBgpV6RouteRangeIter) Add() BgpV6RouteRange { + newObj := &otg.BgpV6RouteRange{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpV6RouteRange{obj: newObj} + newLibObj.setDefault() + obj.bgpV6RouteRangeSlice = append(obj.bgpV6RouteRangeSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4PeerBgpV6RouteRangeIter) Append(items ...BgpV6RouteRange) BgpV4PeerBgpV6RouteRangeIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpV6RouteRangeSlice = append(obj.bgpV6RouteRangeSlice, item) + } + return obj +} + +func (obj *bgpV4PeerBgpV6RouteRangeIter) Set(index int, newObj BgpV6RouteRange) BgpV4PeerBgpV6RouteRangeIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpV6RouteRangeSlice[index] = newObj + return obj +} +func (obj *bgpV4PeerBgpV6RouteRangeIter) Clear() BgpV4PeerBgpV6RouteRangeIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpV6RouteRange{} + obj.bgpV6RouteRangeSlice = []BgpV6RouteRange{} + } + return obj +} +func (obj *bgpV4PeerBgpV6RouteRangeIter) clearHolderSlice() BgpV4PeerBgpV6RouteRangeIter { + if len(obj.bgpV6RouteRangeSlice) > 0 { + obj.bgpV6RouteRangeSlice = []BgpV6RouteRange{} + } + return obj +} +func (obj *bgpV4PeerBgpV6RouteRangeIter) appendHolderSlice(item BgpV6RouteRange) BgpV4PeerBgpV6RouteRangeIter { + obj.bgpV6RouteRangeSlice = append(obj.bgpV6RouteRangeSlice, item) + return obj +} + +// Segment Routing Traffic Engineering (SR TE) Policies for IPv4 Address Family Identifier (AFI). +// V4SrtePolicies returns a []BgpSrteV4Policy +func (obj *bgpV4Peer) V4SrtePolicies() BgpV4PeerBgpSrteV4PolicyIter { + if len(obj.obj.V4SrtePolicies) == 0 { + obj.obj.V4SrtePolicies = []*otg.BgpSrteV4Policy{} + } + if obj.v4SrtePoliciesHolder == nil { + obj.v4SrtePoliciesHolder = newBgpV4PeerBgpSrteV4PolicyIter(&obj.obj.V4SrtePolicies).setMsg(obj) + } + return obj.v4SrtePoliciesHolder +} + +type bgpV4PeerBgpSrteV4PolicyIter struct { + obj *bgpV4Peer + bgpSrteV4PolicySlice []BgpSrteV4Policy + fieldPtr *[]*otg.BgpSrteV4Policy +} + +func newBgpV4PeerBgpSrteV4PolicyIter(ptr *[]*otg.BgpSrteV4Policy) BgpV4PeerBgpSrteV4PolicyIter { + return &bgpV4PeerBgpSrteV4PolicyIter{fieldPtr: ptr} +} + +type BgpV4PeerBgpSrteV4PolicyIter interface { + setMsg(*bgpV4Peer) BgpV4PeerBgpSrteV4PolicyIter + Items() []BgpSrteV4Policy + Add() BgpSrteV4Policy + Append(items ...BgpSrteV4Policy) BgpV4PeerBgpSrteV4PolicyIter + Set(index int, newObj BgpSrteV4Policy) BgpV4PeerBgpSrteV4PolicyIter + Clear() BgpV4PeerBgpSrteV4PolicyIter + clearHolderSlice() BgpV4PeerBgpSrteV4PolicyIter + appendHolderSlice(item BgpSrteV4Policy) BgpV4PeerBgpSrteV4PolicyIter +} + +func (obj *bgpV4PeerBgpSrteV4PolicyIter) setMsg(msg *bgpV4Peer) BgpV4PeerBgpSrteV4PolicyIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpSrteV4Policy{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4PeerBgpSrteV4PolicyIter) Items() []BgpSrteV4Policy { + return obj.bgpSrteV4PolicySlice +} + +func (obj *bgpV4PeerBgpSrteV4PolicyIter) Add() BgpSrteV4Policy { + newObj := &otg.BgpSrteV4Policy{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpSrteV4Policy{obj: newObj} + newLibObj.setDefault() + obj.bgpSrteV4PolicySlice = append(obj.bgpSrteV4PolicySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4PeerBgpSrteV4PolicyIter) Append(items ...BgpSrteV4Policy) BgpV4PeerBgpSrteV4PolicyIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpSrteV4PolicySlice = append(obj.bgpSrteV4PolicySlice, item) + } + return obj +} + +func (obj *bgpV4PeerBgpSrteV4PolicyIter) Set(index int, newObj BgpSrteV4Policy) BgpV4PeerBgpSrteV4PolicyIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpSrteV4PolicySlice[index] = newObj + return obj +} +func (obj *bgpV4PeerBgpSrteV4PolicyIter) Clear() BgpV4PeerBgpSrteV4PolicyIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpSrteV4Policy{} + obj.bgpSrteV4PolicySlice = []BgpSrteV4Policy{} + } + return obj +} +func (obj *bgpV4PeerBgpSrteV4PolicyIter) clearHolderSlice() BgpV4PeerBgpSrteV4PolicyIter { + if len(obj.bgpSrteV4PolicySlice) > 0 { + obj.bgpSrteV4PolicySlice = []BgpSrteV4Policy{} + } + return obj +} +func (obj *bgpV4PeerBgpSrteV4PolicyIter) appendHolderSlice(item BgpSrteV4Policy) BgpV4PeerBgpSrteV4PolicyIter { + obj.bgpSrteV4PolicySlice = append(obj.bgpSrteV4PolicySlice, item) + return obj +} + +// Segment Routing Traffic Engineering (SR TE) Policies for IPv6 Address Family Identifier (AFI). +// V6SrtePolicies returns a []BgpSrteV6Policy +func (obj *bgpV4Peer) V6SrtePolicies() BgpV4PeerBgpSrteV6PolicyIter { + if len(obj.obj.V6SrtePolicies) == 0 { + obj.obj.V6SrtePolicies = []*otg.BgpSrteV6Policy{} + } + if obj.v6SrtePoliciesHolder == nil { + obj.v6SrtePoliciesHolder = newBgpV4PeerBgpSrteV6PolicyIter(&obj.obj.V6SrtePolicies).setMsg(obj) + } + return obj.v6SrtePoliciesHolder +} + +type bgpV4PeerBgpSrteV6PolicyIter struct { + obj *bgpV4Peer + bgpSrteV6PolicySlice []BgpSrteV6Policy + fieldPtr *[]*otg.BgpSrteV6Policy +} + +func newBgpV4PeerBgpSrteV6PolicyIter(ptr *[]*otg.BgpSrteV6Policy) BgpV4PeerBgpSrteV6PolicyIter { + return &bgpV4PeerBgpSrteV6PolicyIter{fieldPtr: ptr} +} + +type BgpV4PeerBgpSrteV6PolicyIter interface { + setMsg(*bgpV4Peer) BgpV4PeerBgpSrteV6PolicyIter + Items() []BgpSrteV6Policy + Add() BgpSrteV6Policy + Append(items ...BgpSrteV6Policy) BgpV4PeerBgpSrteV6PolicyIter + Set(index int, newObj BgpSrteV6Policy) BgpV4PeerBgpSrteV6PolicyIter + Clear() BgpV4PeerBgpSrteV6PolicyIter + clearHolderSlice() BgpV4PeerBgpSrteV6PolicyIter + appendHolderSlice(item BgpSrteV6Policy) BgpV4PeerBgpSrteV6PolicyIter +} + +func (obj *bgpV4PeerBgpSrteV6PolicyIter) setMsg(msg *bgpV4Peer) BgpV4PeerBgpSrteV6PolicyIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpSrteV6Policy{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4PeerBgpSrteV6PolicyIter) Items() []BgpSrteV6Policy { + return obj.bgpSrteV6PolicySlice +} + +func (obj *bgpV4PeerBgpSrteV6PolicyIter) Add() BgpSrteV6Policy { + newObj := &otg.BgpSrteV6Policy{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpSrteV6Policy{obj: newObj} + newLibObj.setDefault() + obj.bgpSrteV6PolicySlice = append(obj.bgpSrteV6PolicySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4PeerBgpSrteV6PolicyIter) Append(items ...BgpSrteV6Policy) BgpV4PeerBgpSrteV6PolicyIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpSrteV6PolicySlice = append(obj.bgpSrteV6PolicySlice, item) + } + return obj +} + +func (obj *bgpV4PeerBgpSrteV6PolicyIter) Set(index int, newObj BgpSrteV6Policy) BgpV4PeerBgpSrteV6PolicyIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpSrteV6PolicySlice[index] = newObj + return obj +} +func (obj *bgpV4PeerBgpSrteV6PolicyIter) Clear() BgpV4PeerBgpSrteV6PolicyIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpSrteV6Policy{} + obj.bgpSrteV6PolicySlice = []BgpSrteV6Policy{} + } + return obj +} +func (obj *bgpV4PeerBgpSrteV6PolicyIter) clearHolderSlice() BgpV4PeerBgpSrteV6PolicyIter { + if len(obj.bgpSrteV6PolicySlice) > 0 { + obj.bgpSrteV6PolicySlice = []BgpSrteV6Policy{} + } + return obj +} +func (obj *bgpV4PeerBgpSrteV6PolicyIter) appendHolderSlice(item BgpSrteV6Policy) BgpV4PeerBgpSrteV6PolicyIter { + obj.bgpSrteV6PolicySlice = append(obj.bgpSrteV6PolicySlice, item) + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *bgpV4Peer) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the BgpV4Peer object +func (obj *bgpV4Peer) SetName(value string) BgpV4Peer { + + obj.obj.Name = &value + return obj +} + +// description is TBD +// GracefulRestart returns a BgpGracefulRestart +func (obj *bgpV4Peer) GracefulRestart() BgpGracefulRestart { + if obj.obj.GracefulRestart == nil { + obj.obj.GracefulRestart = NewBgpGracefulRestart().msg() + } + if obj.gracefulRestartHolder == nil { + obj.gracefulRestartHolder = &bgpGracefulRestart{obj: obj.obj.GracefulRestart} + } + return obj.gracefulRestartHolder +} + +// description is TBD +// GracefulRestart returns a BgpGracefulRestart +func (obj *bgpV4Peer) HasGracefulRestart() bool { + return obj.obj.GracefulRestart != nil +} + +// description is TBD +// SetGracefulRestart sets the BgpGracefulRestart value in the BgpV4Peer object +func (obj *bgpV4Peer) SetGracefulRestart(value BgpGracefulRestart) BgpV4Peer { + + obj.gracefulRestartHolder = nil + obj.obj.GracefulRestart = value.msg() + + return obj +} + +// BGP Updates to be sent to the peer as specified after the session is established. +// ReplayUpdates returns a BgpUpdateReplay +func (obj *bgpV4Peer) ReplayUpdates() BgpUpdateReplay { + if obj.obj.ReplayUpdates == nil { + obj.obj.ReplayUpdates = NewBgpUpdateReplay().msg() + } + if obj.replayUpdatesHolder == nil { + obj.replayUpdatesHolder = &bgpUpdateReplay{obj: obj.obj.ReplayUpdates} + } + return obj.replayUpdatesHolder +} + +// BGP Updates to be sent to the peer as specified after the session is established. +// ReplayUpdates returns a BgpUpdateReplay +func (obj *bgpV4Peer) HasReplayUpdates() bool { + return obj.obj.ReplayUpdates != nil +} + +// BGP Updates to be sent to the peer as specified after the session is established. +// SetReplayUpdates sets the BgpUpdateReplay value in the BgpV4Peer object +func (obj *bgpV4Peer) SetReplayUpdates(value BgpUpdateReplay) BgpV4Peer { + + obj.replayUpdatesHolder = nil + obj.obj.ReplayUpdates = value.msg() + + return obj +} + +func (obj *bgpV4Peer) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // PeerAddress is required + if obj.obj.PeerAddress == nil { + vObj.validationErrors = append(vObj.validationErrors, "PeerAddress is required field on interface BgpV4Peer") + } + if obj.obj.PeerAddress != nil { + + err := obj.validateIpv4(obj.PeerAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV4Peer.PeerAddress")) + } + + } + + if len(obj.obj.EvpnEthernetSegments) != 0 { + + if set_default { + obj.EvpnEthernetSegments().clearHolderSlice() + for _, item := range obj.obj.EvpnEthernetSegments { + obj.EvpnEthernetSegments().appendHolderSlice(&bgpV4EthernetSegment{obj: item}) + } + } + for _, item := range obj.EvpnEthernetSegments().Items() { + item.validateObj(vObj, set_default) + } + + } + + // AsType is required + if obj.obj.AsType == nil { + vObj.validationErrors = append(vObj.validationErrors, "AsType is required field on interface BgpV4Peer") + } + + // AsNumber is required + if obj.obj.AsNumber == nil { + vObj.validationErrors = append(vObj.validationErrors, "AsNumber is required field on interface BgpV4Peer") + } + + if obj.obj.Advanced != nil { + + obj.Advanced().validateObj(vObj, set_default) + } + + if obj.obj.Capability != nil { + + obj.Capability().validateObj(vObj, set_default) + } + + if obj.obj.LearnedInformationFilter != nil { + + obj.LearnedInformationFilter().validateObj(vObj, set_default) + } + + if len(obj.obj.V4Routes) != 0 { + + if set_default { + obj.V4Routes().clearHolderSlice() + for _, item := range obj.obj.V4Routes { + obj.V4Routes().appendHolderSlice(&bgpV4RouteRange{obj: item}) + } + } + for _, item := range obj.V4Routes().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.V6Routes) != 0 { + + if set_default { + obj.V6Routes().clearHolderSlice() + for _, item := range obj.obj.V6Routes { + obj.V6Routes().appendHolderSlice(&bgpV6RouteRange{obj: item}) + } + } + for _, item := range obj.V6Routes().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.V4SrtePolicies) != 0 { + + if set_default { + obj.V4SrtePolicies().clearHolderSlice() + for _, item := range obj.obj.V4SrtePolicies { + obj.V4SrtePolicies().appendHolderSlice(&bgpSrteV4Policy{obj: item}) + } + } + for _, item := range obj.V4SrtePolicies().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.V6SrtePolicies) != 0 { + + if set_default { + obj.V6SrtePolicies().clearHolderSlice() + for _, item := range obj.obj.V6SrtePolicies { + obj.V6SrtePolicies().appendHolderSlice(&bgpSrteV6Policy{obj: item}) + } + } + for _, item := range obj.V6SrtePolicies().Items() { + item.validateObj(vObj, set_default) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpV4Peer") + } + + if obj.obj.GracefulRestart != nil { + + obj.GracefulRestart().validateObj(vObj, set_default) + } + + if obj.obj.ReplayUpdates != nil { + + obj.ReplayUpdates().validateObj(vObj, set_default) + } + +} + +func (obj *bgpV4Peer) setDefault() { + if obj.obj.AsNumberWidth == nil { + obj.SetAsNumberWidth(BgpV4PeerAsNumberWidth.FOUR) + + } + +} diff --git a/gosnappi/bgp_v4_route_range.go b/gosnappi/bgp_v4_route_range.go new file mode 100644 index 00000000..d536784c --- /dev/null +++ b/gosnappi/bgp_v4_route_range.go @@ -0,0 +1,1036 @@ +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" +) + +// ***** BgpV4RouteRange ***** +type bgpV4RouteRange struct { + validation + obj *otg.BgpV4RouteRange + marshaller marshalBgpV4RouteRange + unMarshaller unMarshalBgpV4RouteRange + addressesHolder BgpV4RouteRangeV4RouteAddressIter + advancedHolder BgpRouteAdvanced + communitiesHolder BgpV4RouteRangeBgpCommunityIter + asPathHolder BgpAsPath + addPathHolder BgpAddPath + extCommunitiesHolder BgpV4RouteRangeBgpExtCommunityIter + extendedCommunitiesHolder BgpV4RouteRangeBgpExtendedCommunityIter +} + +func NewBgpV4RouteRange() BgpV4RouteRange { + obj := bgpV4RouteRange{obj: &otg.BgpV4RouteRange{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV4RouteRange) msg() *otg.BgpV4RouteRange { + return obj.obj +} + +func (obj *bgpV4RouteRange) setMsg(msg *otg.BgpV4RouteRange) BgpV4RouteRange { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV4RouteRange struct { + obj *bgpV4RouteRange +} + +type marshalBgpV4RouteRange interface { + // ToProto marshals BgpV4RouteRange to protobuf object *otg.BgpV4RouteRange + ToProto() (*otg.BgpV4RouteRange, error) + // ToPbText marshals BgpV4RouteRange to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV4RouteRange to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV4RouteRange to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV4RouteRange struct { + obj *bgpV4RouteRange +} + +type unMarshalBgpV4RouteRange interface { + // FromProto unmarshals BgpV4RouteRange from protobuf object *otg.BgpV4RouteRange + FromProto(msg *otg.BgpV4RouteRange) (BgpV4RouteRange, error) + // FromPbText unmarshals BgpV4RouteRange from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV4RouteRange from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV4RouteRange from JSON text + FromJson(value string) error +} + +func (obj *bgpV4RouteRange) Marshal() marshalBgpV4RouteRange { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV4RouteRange{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV4RouteRange) Unmarshal() unMarshalBgpV4RouteRange { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV4RouteRange{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV4RouteRange) ToProto() (*otg.BgpV4RouteRange, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV4RouteRange) FromProto(msg *otg.BgpV4RouteRange) (BgpV4RouteRange, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV4RouteRange) 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 *unMarshalbgpV4RouteRange) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpV4RouteRange) 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 *unMarshalbgpV4RouteRange) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpV4RouteRange) 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 *unMarshalbgpV4RouteRange) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpV4RouteRange) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV4RouteRange) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV4RouteRange) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV4RouteRange) Clone() (BgpV4RouteRange, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV4RouteRange() + 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 +} + +func (obj *bgpV4RouteRange) setNil() { + obj.addressesHolder = nil + obj.advancedHolder = nil + obj.communitiesHolder = nil + obj.asPathHolder = nil + obj.addPathHolder = nil + obj.extCommunitiesHolder = nil + obj.extendedCommunitiesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpV4RouteRange is emulated BGPv4 route range. +type BgpV4RouteRange interface { + Validation + // msg marshals BgpV4RouteRange to protobuf object *otg.BgpV4RouteRange + // and doesn't set defaults + msg() *otg.BgpV4RouteRange + // setMsg unmarshals BgpV4RouteRange from protobuf object *otg.BgpV4RouteRange + // and doesn't set defaults + setMsg(*otg.BgpV4RouteRange) BgpV4RouteRange + // provides marshal interface + Marshal() marshalBgpV4RouteRange + // provides unmarshal interface + Unmarshal() unMarshalBgpV4RouteRange + // validate validates BgpV4RouteRange + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV4RouteRange, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Addresses returns BgpV4RouteRangeV4RouteAddressIterIter, set in BgpV4RouteRange + Addresses() BgpV4RouteRangeV4RouteAddressIter + // NextHopMode returns BgpV4RouteRangeNextHopModeEnum, set in BgpV4RouteRange + NextHopMode() BgpV4RouteRangeNextHopModeEnum + // SetNextHopMode assigns BgpV4RouteRangeNextHopModeEnum provided by user to BgpV4RouteRange + SetNextHopMode(value BgpV4RouteRangeNextHopModeEnum) BgpV4RouteRange + // HasNextHopMode checks if NextHopMode has been set in BgpV4RouteRange + HasNextHopMode() bool + // NextHopAddressType returns BgpV4RouteRangeNextHopAddressTypeEnum, set in BgpV4RouteRange + NextHopAddressType() BgpV4RouteRangeNextHopAddressTypeEnum + // SetNextHopAddressType assigns BgpV4RouteRangeNextHopAddressTypeEnum provided by user to BgpV4RouteRange + SetNextHopAddressType(value BgpV4RouteRangeNextHopAddressTypeEnum) BgpV4RouteRange + // HasNextHopAddressType checks if NextHopAddressType has been set in BgpV4RouteRange + HasNextHopAddressType() bool + // NextHopIpv4Address returns string, set in BgpV4RouteRange. + NextHopIpv4Address() string + // SetNextHopIpv4Address assigns string provided by user to BgpV4RouteRange + SetNextHopIpv4Address(value string) BgpV4RouteRange + // HasNextHopIpv4Address checks if NextHopIpv4Address has been set in BgpV4RouteRange + HasNextHopIpv4Address() bool + // NextHopIpv6Address returns string, set in BgpV4RouteRange. + NextHopIpv6Address() string + // SetNextHopIpv6Address assigns string provided by user to BgpV4RouteRange + SetNextHopIpv6Address(value string) BgpV4RouteRange + // HasNextHopIpv6Address checks if NextHopIpv6Address has been set in BgpV4RouteRange + HasNextHopIpv6Address() bool + // Advanced returns BgpRouteAdvanced, set in BgpV4RouteRange. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + Advanced() BgpRouteAdvanced + // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpV4RouteRange. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + SetAdvanced(value BgpRouteAdvanced) BgpV4RouteRange + // HasAdvanced checks if Advanced has been set in BgpV4RouteRange + HasAdvanced() bool + // Communities returns BgpV4RouteRangeBgpCommunityIterIter, set in BgpV4RouteRange + Communities() BgpV4RouteRangeBgpCommunityIter + // AsPath returns BgpAsPath, set in BgpV4RouteRange. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + AsPath() BgpAsPath + // SetAsPath assigns BgpAsPath provided by user to BgpV4RouteRange. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + SetAsPath(value BgpAsPath) BgpV4RouteRange + // HasAsPath checks if AsPath has been set in BgpV4RouteRange + HasAsPath() bool + // AddPath returns BgpAddPath, set in BgpV4RouteRange. + // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. + AddPath() BgpAddPath + // SetAddPath assigns BgpAddPath provided by user to BgpV4RouteRange. + // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. + SetAddPath(value BgpAddPath) BgpV4RouteRange + // HasAddPath checks if AddPath has been set in BgpV4RouteRange + HasAddPath() bool + // Name returns string, set in BgpV4RouteRange. + Name() string + // SetName assigns string provided by user to BgpV4RouteRange + SetName(value string) BgpV4RouteRange + // ExtCommunities returns BgpV4RouteRangeBgpExtCommunityIterIter, set in BgpV4RouteRange + ExtCommunities() BgpV4RouteRangeBgpExtCommunityIter + // ExtendedCommunities returns BgpV4RouteRangeBgpExtendedCommunityIterIter, set in BgpV4RouteRange + ExtendedCommunities() BgpV4RouteRangeBgpExtendedCommunityIter + setNil() +} + +// A list of group of IPv4 route addresses. +// Addresses returns a []V4RouteAddress +func (obj *bgpV4RouteRange) Addresses() BgpV4RouteRangeV4RouteAddressIter { + if len(obj.obj.Addresses) == 0 { + obj.obj.Addresses = []*otg.V4RouteAddress{} + } + if obj.addressesHolder == nil { + obj.addressesHolder = newBgpV4RouteRangeV4RouteAddressIter(&obj.obj.Addresses).setMsg(obj) + } + return obj.addressesHolder +} + +type bgpV4RouteRangeV4RouteAddressIter struct { + obj *bgpV4RouteRange + v4RouteAddressSlice []V4RouteAddress + fieldPtr *[]*otg.V4RouteAddress +} + +func newBgpV4RouteRangeV4RouteAddressIter(ptr *[]*otg.V4RouteAddress) BgpV4RouteRangeV4RouteAddressIter { + return &bgpV4RouteRangeV4RouteAddressIter{fieldPtr: ptr} +} + +type BgpV4RouteRangeV4RouteAddressIter interface { + setMsg(*bgpV4RouteRange) BgpV4RouteRangeV4RouteAddressIter + Items() []V4RouteAddress + Add() V4RouteAddress + Append(items ...V4RouteAddress) BgpV4RouteRangeV4RouteAddressIter + Set(index int, newObj V4RouteAddress) BgpV4RouteRangeV4RouteAddressIter + Clear() BgpV4RouteRangeV4RouteAddressIter + clearHolderSlice() BgpV4RouteRangeV4RouteAddressIter + appendHolderSlice(item V4RouteAddress) BgpV4RouteRangeV4RouteAddressIter +} + +func (obj *bgpV4RouteRangeV4RouteAddressIter) setMsg(msg *bgpV4RouteRange) BgpV4RouteRangeV4RouteAddressIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&v4RouteAddress{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4RouteRangeV4RouteAddressIter) Items() []V4RouteAddress { + return obj.v4RouteAddressSlice +} + +func (obj *bgpV4RouteRangeV4RouteAddressIter) Add() V4RouteAddress { + newObj := &otg.V4RouteAddress{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &v4RouteAddress{obj: newObj} + newLibObj.setDefault() + obj.v4RouteAddressSlice = append(obj.v4RouteAddressSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4RouteRangeV4RouteAddressIter) Append(items ...V4RouteAddress) BgpV4RouteRangeV4RouteAddressIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.v4RouteAddressSlice = append(obj.v4RouteAddressSlice, item) + } + return obj +} + +func (obj *bgpV4RouteRangeV4RouteAddressIter) Set(index int, newObj V4RouteAddress) BgpV4RouteRangeV4RouteAddressIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.v4RouteAddressSlice[index] = newObj + return obj +} +func (obj *bgpV4RouteRangeV4RouteAddressIter) Clear() BgpV4RouteRangeV4RouteAddressIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.V4RouteAddress{} + obj.v4RouteAddressSlice = []V4RouteAddress{} + } + return obj +} +func (obj *bgpV4RouteRangeV4RouteAddressIter) clearHolderSlice() BgpV4RouteRangeV4RouteAddressIter { + if len(obj.v4RouteAddressSlice) > 0 { + obj.v4RouteAddressSlice = []V4RouteAddress{} + } + return obj +} +func (obj *bgpV4RouteRangeV4RouteAddressIter) appendHolderSlice(item V4RouteAddress) BgpV4RouteRangeV4RouteAddressIter { + obj.v4RouteAddressSlice = append(obj.v4RouteAddressSlice, item) + return obj +} + +type BgpV4RouteRangeNextHopModeEnum string + +// Enum of NextHopMode on BgpV4RouteRange +var BgpV4RouteRangeNextHopMode = struct { + LOCAL_IP BgpV4RouteRangeNextHopModeEnum + MANUAL BgpV4RouteRangeNextHopModeEnum +}{ + LOCAL_IP: BgpV4RouteRangeNextHopModeEnum("local_ip"), + MANUAL: BgpV4RouteRangeNextHopModeEnum("manual"), +} + +func (obj *bgpV4RouteRange) NextHopMode() BgpV4RouteRangeNextHopModeEnum { + return BgpV4RouteRangeNextHopModeEnum(obj.obj.NextHopMode.Enum().String()) +} + +// Specify the NextHop in MP REACH NLRI. The mode for setting the IP address of the NextHop in the MP REACH NLRI can be one of the following: +// Local IP: Automatically fills the Nexthop with the Local IP of the BGP +// peer. +// If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. +// Manual: Override the Nexthop with any arbitrary IPv4/IPv6 address. +// NextHopMode returns a string +func (obj *bgpV4RouteRange) HasNextHopMode() bool { + return obj.obj.NextHopMode != nil +} + +func (obj *bgpV4RouteRange) SetNextHopMode(value BgpV4RouteRangeNextHopModeEnum) BgpV4RouteRange { + intValue, ok := otg.BgpV4RouteRange_NextHopMode_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpV4RouteRangeNextHopModeEnum", string(value))) + return obj + } + enumValue := otg.BgpV4RouteRange_NextHopMode_Enum(intValue) + obj.obj.NextHopMode = &enumValue + + return obj +} + +type BgpV4RouteRangeNextHopAddressTypeEnum string + +// Enum of NextHopAddressType on BgpV4RouteRange +var BgpV4RouteRangeNextHopAddressType = struct { + IPV4 BgpV4RouteRangeNextHopAddressTypeEnum + IPV6 BgpV4RouteRangeNextHopAddressTypeEnum +}{ + IPV4: BgpV4RouteRangeNextHopAddressTypeEnum("ipv4"), + IPV6: BgpV4RouteRangeNextHopAddressTypeEnum("ipv6"), +} + +func (obj *bgpV4RouteRange) NextHopAddressType() BgpV4RouteRangeNextHopAddressTypeEnum { + return BgpV4RouteRangeNextHopAddressTypeEnum(obj.obj.NextHopAddressType.Enum().String()) +} + +// If the Nexthop Mode is Manual, it sets the type of the NextHop IP address. +// NextHopAddressType returns a string +func (obj *bgpV4RouteRange) HasNextHopAddressType() bool { + return obj.obj.NextHopAddressType != nil +} + +func (obj *bgpV4RouteRange) SetNextHopAddressType(value BgpV4RouteRangeNextHopAddressTypeEnum) BgpV4RouteRange { + intValue, ok := otg.BgpV4RouteRange_NextHopAddressType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpV4RouteRangeNextHopAddressTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpV4RouteRange_NextHopAddressType_Enum(intValue) + obj.obj.NextHopAddressType = &enumValue + + return obj +} + +// The IPv4 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. +// NextHopIpv4Address returns a string +func (obj *bgpV4RouteRange) NextHopIpv4Address() string { + + return *obj.obj.NextHopIpv4Address + +} + +// The IPv4 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. +// NextHopIpv4Address returns a string +func (obj *bgpV4RouteRange) HasNextHopIpv4Address() bool { + return obj.obj.NextHopIpv4Address != nil +} + +// The IPv4 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. +// SetNextHopIpv4Address sets the string value in the BgpV4RouteRange object +func (obj *bgpV4RouteRange) SetNextHopIpv4Address(value string) BgpV4RouteRange { + + obj.obj.NextHopIpv4Address = &value + return obj +} + +// The IPv6 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv6. +// NextHopIpv6Address returns a string +func (obj *bgpV4RouteRange) NextHopIpv6Address() string { + + return *obj.obj.NextHopIpv6Address + +} + +// The IPv6 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv6. +// NextHopIpv6Address returns a string +func (obj *bgpV4RouteRange) HasNextHopIpv6Address() bool { + return obj.obj.NextHopIpv6Address != nil +} + +// The IPv6 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv6. +// SetNextHopIpv6Address sets the string value in the BgpV4RouteRange object +func (obj *bgpV4RouteRange) SetNextHopIpv6Address(value string) BgpV4RouteRange { + + obj.obj.NextHopIpv6Address = &value + return obj +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpV4RouteRange) Advanced() BgpRouteAdvanced { + if obj.obj.Advanced == nil { + obj.obj.Advanced = NewBgpRouteAdvanced().msg() + } + if obj.advancedHolder == nil { + obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} + } + return obj.advancedHolder +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpV4RouteRange) HasAdvanced() bool { + return obj.obj.Advanced != nil +} + +// description is TBD +// SetAdvanced sets the BgpRouteAdvanced value in the BgpV4RouteRange object +func (obj *bgpV4RouteRange) SetAdvanced(value BgpRouteAdvanced) BgpV4RouteRange { + + obj.advancedHolder = nil + obj.obj.Advanced = value.msg() + + return obj +} + +// Optional community settings. +// Communities returns a []BgpCommunity +func (obj *bgpV4RouteRange) Communities() BgpV4RouteRangeBgpCommunityIter { + if len(obj.obj.Communities) == 0 { + obj.obj.Communities = []*otg.BgpCommunity{} + } + if obj.communitiesHolder == nil { + obj.communitiesHolder = newBgpV4RouteRangeBgpCommunityIter(&obj.obj.Communities).setMsg(obj) + } + return obj.communitiesHolder +} + +type bgpV4RouteRangeBgpCommunityIter struct { + obj *bgpV4RouteRange + bgpCommunitySlice []BgpCommunity + fieldPtr *[]*otg.BgpCommunity +} + +func newBgpV4RouteRangeBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpV4RouteRangeBgpCommunityIter { + return &bgpV4RouteRangeBgpCommunityIter{fieldPtr: ptr} +} + +type BgpV4RouteRangeBgpCommunityIter interface { + setMsg(*bgpV4RouteRange) BgpV4RouteRangeBgpCommunityIter + Items() []BgpCommunity + Add() BgpCommunity + Append(items ...BgpCommunity) BgpV4RouteRangeBgpCommunityIter + Set(index int, newObj BgpCommunity) BgpV4RouteRangeBgpCommunityIter + Clear() BgpV4RouteRangeBgpCommunityIter + clearHolderSlice() BgpV4RouteRangeBgpCommunityIter + appendHolderSlice(item BgpCommunity) BgpV4RouteRangeBgpCommunityIter +} + +func (obj *bgpV4RouteRangeBgpCommunityIter) setMsg(msg *bgpV4RouteRange) BgpV4RouteRangeBgpCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4RouteRangeBgpCommunityIter) Items() []BgpCommunity { + return obj.bgpCommunitySlice +} + +func (obj *bgpV4RouteRangeBgpCommunityIter) Add() BgpCommunity { + newObj := &otg.BgpCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4RouteRangeBgpCommunityIter) Append(items ...BgpCommunity) BgpV4RouteRangeBgpCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + } + return obj +} + +func (obj *bgpV4RouteRangeBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpV4RouteRangeBgpCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpCommunitySlice[index] = newObj + return obj +} +func (obj *bgpV4RouteRangeBgpCommunityIter) Clear() BgpV4RouteRangeBgpCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpCommunity{} + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpV4RouteRangeBgpCommunityIter) clearHolderSlice() BgpV4RouteRangeBgpCommunityIter { + if len(obj.bgpCommunitySlice) > 0 { + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpV4RouteRangeBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpV4RouteRangeBgpCommunityIter { + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + return obj +} + +// description is TBD +// AsPath returns a BgpAsPath +func (obj *bgpV4RouteRange) AsPath() BgpAsPath { + if obj.obj.AsPath == nil { + obj.obj.AsPath = NewBgpAsPath().msg() + } + if obj.asPathHolder == nil { + obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} + } + return obj.asPathHolder +} + +// description is TBD +// AsPath returns a BgpAsPath +func (obj *bgpV4RouteRange) HasAsPath() bool { + return obj.obj.AsPath != nil +} + +// description is TBD +// SetAsPath sets the BgpAsPath value in the BgpV4RouteRange object +func (obj *bgpV4RouteRange) SetAsPath(value BgpAsPath) BgpV4RouteRange { + + obj.asPathHolder = nil + obj.obj.AsPath = value.msg() + + return obj +} + +// description is TBD +// AddPath returns a BgpAddPath +func (obj *bgpV4RouteRange) AddPath() BgpAddPath { + if obj.obj.AddPath == nil { + obj.obj.AddPath = NewBgpAddPath().msg() + } + if obj.addPathHolder == nil { + obj.addPathHolder = &bgpAddPath{obj: obj.obj.AddPath} + } + return obj.addPathHolder +} + +// description is TBD +// AddPath returns a BgpAddPath +func (obj *bgpV4RouteRange) HasAddPath() bool { + return obj.obj.AddPath != nil +} + +// description is TBD +// SetAddPath sets the BgpAddPath value in the BgpV4RouteRange object +func (obj *bgpV4RouteRange) SetAddPath(value BgpAddPath) BgpV4RouteRange { + + obj.addPathHolder = nil + obj.obj.AddPath = value.msg() + + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *bgpV4RouteRange) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the BgpV4RouteRange object +func (obj *bgpV4RouteRange) SetName(value string) BgpV4RouteRange { + + obj.obj.Name = &value + return obj +} + +// Deprecated: This property is deprecated in favor of property extended_communities +// +// Deprecated: This property is deprecated in favor of property extended_communities +// +// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. Note evpn type is defined mainly for use with evpn route updates and not for IPv4 and IPv6 route updates. +// ExtCommunities returns a []BgpExtCommunity +func (obj *bgpV4RouteRange) ExtCommunities() BgpV4RouteRangeBgpExtCommunityIter { + if len(obj.obj.ExtCommunities) == 0 { + obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} + } + if obj.extCommunitiesHolder == nil { + obj.extCommunitiesHolder = newBgpV4RouteRangeBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) + } + return obj.extCommunitiesHolder +} + +type bgpV4RouteRangeBgpExtCommunityIter struct { + obj *bgpV4RouteRange + bgpExtCommunitySlice []BgpExtCommunity + fieldPtr *[]*otg.BgpExtCommunity +} + +func newBgpV4RouteRangeBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpV4RouteRangeBgpExtCommunityIter { + return &bgpV4RouteRangeBgpExtCommunityIter{fieldPtr: ptr} +} + +type BgpV4RouteRangeBgpExtCommunityIter interface { + setMsg(*bgpV4RouteRange) BgpV4RouteRangeBgpExtCommunityIter + Items() []BgpExtCommunity + Add() BgpExtCommunity + Append(items ...BgpExtCommunity) BgpV4RouteRangeBgpExtCommunityIter + Set(index int, newObj BgpExtCommunity) BgpV4RouteRangeBgpExtCommunityIter + Clear() BgpV4RouteRangeBgpExtCommunityIter + clearHolderSlice() BgpV4RouteRangeBgpExtCommunityIter + appendHolderSlice(item BgpExtCommunity) BgpV4RouteRangeBgpExtCommunityIter +} + +func (obj *bgpV4RouteRangeBgpExtCommunityIter) setMsg(msg *bgpV4RouteRange) BgpV4RouteRangeBgpExtCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpExtCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4RouteRangeBgpExtCommunityIter) Items() []BgpExtCommunity { + return obj.bgpExtCommunitySlice +} + +func (obj *bgpV4RouteRangeBgpExtCommunityIter) Add() BgpExtCommunity { + newObj := &otg.BgpExtCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpExtCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4RouteRangeBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpV4RouteRangeBgpExtCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + } + return obj +} + +func (obj *bgpV4RouteRangeBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpV4RouteRangeBgpExtCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpExtCommunitySlice[index] = newObj + return obj +} +func (obj *bgpV4RouteRangeBgpExtCommunityIter) Clear() BgpV4RouteRangeBgpExtCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpExtCommunity{} + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpV4RouteRangeBgpExtCommunityIter) clearHolderSlice() BgpV4RouteRangeBgpExtCommunityIter { + if len(obj.bgpExtCommunitySlice) > 0 { + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpV4RouteRangeBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpV4RouteRangeBgpExtCommunityIter { + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + return obj +} + +// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an eight byte value. It is divided into two main parts. The first two bytes of the community encode a type and sub-type fields and the last six bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. +// ExtendedCommunities returns a []BgpExtendedCommunity +func (obj *bgpV4RouteRange) ExtendedCommunities() BgpV4RouteRangeBgpExtendedCommunityIter { + if len(obj.obj.ExtendedCommunities) == 0 { + obj.obj.ExtendedCommunities = []*otg.BgpExtendedCommunity{} + } + if obj.extendedCommunitiesHolder == nil { + obj.extendedCommunitiesHolder = newBgpV4RouteRangeBgpExtendedCommunityIter(&obj.obj.ExtendedCommunities).setMsg(obj) + } + return obj.extendedCommunitiesHolder +} + +type bgpV4RouteRangeBgpExtendedCommunityIter struct { + obj *bgpV4RouteRange + bgpExtendedCommunitySlice []BgpExtendedCommunity + fieldPtr *[]*otg.BgpExtendedCommunity +} + +func newBgpV4RouteRangeBgpExtendedCommunityIter(ptr *[]*otg.BgpExtendedCommunity) BgpV4RouteRangeBgpExtendedCommunityIter { + return &bgpV4RouteRangeBgpExtendedCommunityIter{fieldPtr: ptr} +} + +type BgpV4RouteRangeBgpExtendedCommunityIter interface { + setMsg(*bgpV4RouteRange) BgpV4RouteRangeBgpExtendedCommunityIter + Items() []BgpExtendedCommunity + Add() BgpExtendedCommunity + Append(items ...BgpExtendedCommunity) BgpV4RouteRangeBgpExtendedCommunityIter + Set(index int, newObj BgpExtendedCommunity) BgpV4RouteRangeBgpExtendedCommunityIter + Clear() BgpV4RouteRangeBgpExtendedCommunityIter + clearHolderSlice() BgpV4RouteRangeBgpExtendedCommunityIter + appendHolderSlice(item BgpExtendedCommunity) BgpV4RouteRangeBgpExtendedCommunityIter +} + +func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) setMsg(msg *bgpV4RouteRange) BgpV4RouteRangeBgpExtendedCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpExtendedCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) Items() []BgpExtendedCommunity { + return obj.bgpExtendedCommunitySlice +} + +func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) Add() BgpExtendedCommunity { + newObj := &otg.BgpExtendedCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpExtendedCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) Append(items ...BgpExtendedCommunity) BgpV4RouteRangeBgpExtendedCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, item) + } + return obj +} + +func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) Set(index int, newObj BgpExtendedCommunity) BgpV4RouteRangeBgpExtendedCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpExtendedCommunitySlice[index] = newObj + return obj +} +func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) Clear() BgpV4RouteRangeBgpExtendedCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpExtendedCommunity{} + obj.bgpExtendedCommunitySlice = []BgpExtendedCommunity{} + } + return obj +} +func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) clearHolderSlice() BgpV4RouteRangeBgpExtendedCommunityIter { + if len(obj.bgpExtendedCommunitySlice) > 0 { + obj.bgpExtendedCommunitySlice = []BgpExtendedCommunity{} + } + return obj +} +func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) appendHolderSlice(item BgpExtendedCommunity) BgpV4RouteRangeBgpExtendedCommunityIter { + obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, item) + return obj +} + +func (obj *bgpV4RouteRange) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Addresses) != 0 { + + if set_default { + obj.Addresses().clearHolderSlice() + for _, item := range obj.obj.Addresses { + obj.Addresses().appendHolderSlice(&v4RouteAddress{obj: item}) + } + } + for _, item := range obj.Addresses().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.NextHopIpv4Address != nil { + + err := obj.validateIpv4(obj.NextHopIpv4Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV4RouteRange.NextHopIpv4Address")) + } + + } + + if obj.obj.NextHopIpv6Address != nil { + + err := obj.validateIpv6(obj.NextHopIpv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV4RouteRange.NextHopIpv6Address")) + } + + } + + if obj.obj.Advanced != nil { + + obj.Advanced().validateObj(vObj, set_default) + } + + if len(obj.obj.Communities) != 0 { + + if set_default { + obj.Communities().clearHolderSlice() + for _, item := range obj.obj.Communities { + obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) + } + } + for _, item := range obj.Communities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.AsPath != nil { + + obj.AsPath().validateObj(vObj, set_default) + } + + if obj.obj.AddPath != nil { + + obj.AddPath().validateObj(vObj, set_default) + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpV4RouteRange") + } + + if len(obj.obj.ExtCommunities) != 0 { + obj.addWarnings("ExtCommunities property in schema BgpV4RouteRange is deprecated, This property is deprecated in favor of property extended_communities") + + if set_default { + obj.ExtCommunities().clearHolderSlice() + for _, item := range obj.obj.ExtCommunities { + obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) + } + } + for _, item := range obj.ExtCommunities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.ExtendedCommunities) != 0 { + + if set_default { + obj.ExtendedCommunities().clearHolderSlice() + for _, item := range obj.obj.ExtendedCommunities { + obj.ExtendedCommunities().appendHolderSlice(&bgpExtendedCommunity{obj: item}) + } + } + for _, item := range obj.ExtendedCommunities().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpV4RouteRange) setDefault() { + if obj.obj.NextHopMode == nil { + obj.SetNextHopMode(BgpV4RouteRangeNextHopMode.LOCAL_IP) + + } + if obj.obj.NextHopAddressType == nil { + obj.SetNextHopAddressType(BgpV4RouteRangeNextHopAddressType.IPV4) + + } + if obj.obj.NextHopIpv4Address == nil { + obj.SetNextHopIpv4Address("0.0.0.0") + } + if obj.obj.NextHopIpv6Address == nil { + obj.SetNextHopIpv6Address("::0") + } + +} diff --git a/gosnappi/bgp_v6_ethernet_segment.go b/gosnappi/bgp_v6_ethernet_segment.go new file mode 100644 index 00000000..ad6f3942 --- /dev/null +++ b/gosnappi/bgp_v6_ethernet_segment.go @@ -0,0 +1,856 @@ +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" +) + +// ***** BgpV6EthernetSegment ***** +type bgpV6EthernetSegment struct { + validation + obj *otg.BgpV6EthernetSegment + marshaller marshalBgpV6EthernetSegment + unMarshaller unMarshalBgpV6EthernetSegment + dfElectionHolder BgpEthernetSegmentDfElection + evisHolder BgpV6EthernetSegmentBgpV6EvpnEvisIter + advancedHolder BgpRouteAdvanced + communitiesHolder BgpV6EthernetSegmentBgpCommunityIter + extCommunitiesHolder BgpV6EthernetSegmentBgpExtCommunityIter + asPathHolder BgpAsPath +} + +func NewBgpV6EthernetSegment() BgpV6EthernetSegment { + obj := bgpV6EthernetSegment{obj: &otg.BgpV6EthernetSegment{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV6EthernetSegment) msg() *otg.BgpV6EthernetSegment { + return obj.obj +} + +func (obj *bgpV6EthernetSegment) setMsg(msg *otg.BgpV6EthernetSegment) BgpV6EthernetSegment { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV6EthernetSegment struct { + obj *bgpV6EthernetSegment +} + +type marshalBgpV6EthernetSegment interface { + // ToProto marshals BgpV6EthernetSegment to protobuf object *otg.BgpV6EthernetSegment + ToProto() (*otg.BgpV6EthernetSegment, error) + // ToPbText marshals BgpV6EthernetSegment to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV6EthernetSegment to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV6EthernetSegment to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV6EthernetSegment struct { + obj *bgpV6EthernetSegment +} + +type unMarshalBgpV6EthernetSegment interface { + // FromProto unmarshals BgpV6EthernetSegment from protobuf object *otg.BgpV6EthernetSegment + FromProto(msg *otg.BgpV6EthernetSegment) (BgpV6EthernetSegment, error) + // FromPbText unmarshals BgpV6EthernetSegment from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV6EthernetSegment from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV6EthernetSegment from JSON text + FromJson(value string) error +} + +func (obj *bgpV6EthernetSegment) Marshal() marshalBgpV6EthernetSegment { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV6EthernetSegment{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV6EthernetSegment) Unmarshal() unMarshalBgpV6EthernetSegment { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV6EthernetSegment{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV6EthernetSegment) ToProto() (*otg.BgpV6EthernetSegment, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV6EthernetSegment) FromProto(msg *otg.BgpV6EthernetSegment) (BgpV6EthernetSegment, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV6EthernetSegment) 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 *unMarshalbgpV6EthernetSegment) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpV6EthernetSegment) 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 *unMarshalbgpV6EthernetSegment) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpV6EthernetSegment) 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 *unMarshalbgpV6EthernetSegment) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpV6EthernetSegment) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV6EthernetSegment) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV6EthernetSegment) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV6EthernetSegment) Clone() (BgpV6EthernetSegment, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV6EthernetSegment() + 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 +} + +func (obj *bgpV6EthernetSegment) setNil() { + obj.dfElectionHolder = nil + obj.evisHolder = nil + obj.advancedHolder = nil + obj.communitiesHolder = nil + obj.extCommunitiesHolder = nil + obj.asPathHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpV6EthernetSegment is configuration for BGP Ethernet Segment ranges. Advertises following routes - +// +// Type 4 - Ethernet Segment Route +type BgpV6EthernetSegment interface { + Validation + // msg marshals BgpV6EthernetSegment to protobuf object *otg.BgpV6EthernetSegment + // and doesn't set defaults + msg() *otg.BgpV6EthernetSegment + // setMsg unmarshals BgpV6EthernetSegment from protobuf object *otg.BgpV6EthernetSegment + // and doesn't set defaults + setMsg(*otg.BgpV6EthernetSegment) BgpV6EthernetSegment + // provides marshal interface + Marshal() marshalBgpV6EthernetSegment + // provides unmarshal interface + Unmarshal() unMarshalBgpV6EthernetSegment + // validate validates BgpV6EthernetSegment + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV6EthernetSegment, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // DfElection returns BgpEthernetSegmentDfElection, set in BgpV6EthernetSegment. + // BgpEthernetSegmentDfElection is configuration for Designated Forwarder (DF) election among the Provider Edge (PE) routers on the same Ethernet Segment. + DfElection() BgpEthernetSegmentDfElection + // SetDfElection assigns BgpEthernetSegmentDfElection provided by user to BgpV6EthernetSegment. + // BgpEthernetSegmentDfElection is configuration for Designated Forwarder (DF) election among the Provider Edge (PE) routers on the same Ethernet Segment. + SetDfElection(value BgpEthernetSegmentDfElection) BgpV6EthernetSegment + // HasDfElection checks if DfElection has been set in BgpV6EthernetSegment + HasDfElection() bool + // Evis returns BgpV6EthernetSegmentBgpV6EvpnEvisIterIter, set in BgpV6EthernetSegment + Evis() BgpV6EthernetSegmentBgpV6EvpnEvisIter + // Esi returns string, set in BgpV6EthernetSegment. + Esi() string + // SetEsi assigns string provided by user to BgpV6EthernetSegment + SetEsi(value string) BgpV6EthernetSegment + // HasEsi checks if Esi has been set in BgpV6EthernetSegment + HasEsi() bool + // ActiveMode returns BgpV6EthernetSegmentActiveModeEnum, set in BgpV6EthernetSegment + ActiveMode() BgpV6EthernetSegmentActiveModeEnum + // SetActiveMode assigns BgpV6EthernetSegmentActiveModeEnum provided by user to BgpV6EthernetSegment + SetActiveMode(value BgpV6EthernetSegmentActiveModeEnum) BgpV6EthernetSegment + // HasActiveMode checks if ActiveMode has been set in BgpV6EthernetSegment + HasActiveMode() bool + // EsiLabel returns uint32, set in BgpV6EthernetSegment. + EsiLabel() uint32 + // SetEsiLabel assigns uint32 provided by user to BgpV6EthernetSegment + SetEsiLabel(value uint32) BgpV6EthernetSegment + // HasEsiLabel checks if EsiLabel has been set in BgpV6EthernetSegment + HasEsiLabel() bool + // Advanced returns BgpRouteAdvanced, set in BgpV6EthernetSegment. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + Advanced() BgpRouteAdvanced + // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpV6EthernetSegment. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + SetAdvanced(value BgpRouteAdvanced) BgpV6EthernetSegment + // HasAdvanced checks if Advanced has been set in BgpV6EthernetSegment + HasAdvanced() bool + // Communities returns BgpV6EthernetSegmentBgpCommunityIterIter, set in BgpV6EthernetSegment + Communities() BgpV6EthernetSegmentBgpCommunityIter + // ExtCommunities returns BgpV6EthernetSegmentBgpExtCommunityIterIter, set in BgpV6EthernetSegment + ExtCommunities() BgpV6EthernetSegmentBgpExtCommunityIter + // AsPath returns BgpAsPath, set in BgpV6EthernetSegment. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + AsPath() BgpAsPath + // SetAsPath assigns BgpAsPath provided by user to BgpV6EthernetSegment. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + SetAsPath(value BgpAsPath) BgpV6EthernetSegment + // HasAsPath checks if AsPath has been set in BgpV6EthernetSegment + HasAsPath() bool + setNil() +} + +// Designated Forwarder (DF) election configuration. +// DfElection returns a BgpEthernetSegmentDfElection +func (obj *bgpV6EthernetSegment) DfElection() BgpEthernetSegmentDfElection { + if obj.obj.DfElection == nil { + obj.obj.DfElection = NewBgpEthernetSegmentDfElection().msg() + } + if obj.dfElectionHolder == nil { + obj.dfElectionHolder = &bgpEthernetSegmentDfElection{obj: obj.obj.DfElection} + } + return obj.dfElectionHolder +} + +// Designated Forwarder (DF) election configuration. +// DfElection returns a BgpEthernetSegmentDfElection +func (obj *bgpV6EthernetSegment) HasDfElection() bool { + return obj.obj.DfElection != nil +} + +// Designated Forwarder (DF) election configuration. +// SetDfElection sets the BgpEthernetSegmentDfElection value in the BgpV6EthernetSegment object +func (obj *bgpV6EthernetSegment) SetDfElection(value BgpEthernetSegmentDfElection) BgpV6EthernetSegment { + + obj.dfElectionHolder = nil + obj.obj.DfElection = value.msg() + + return obj +} + +// This contains the list of EVIs. +// Evis returns a []BgpV6EvpnEvis +func (obj *bgpV6EthernetSegment) Evis() BgpV6EthernetSegmentBgpV6EvpnEvisIter { + if len(obj.obj.Evis) == 0 { + obj.obj.Evis = []*otg.BgpV6EvpnEvis{} + } + if obj.evisHolder == nil { + obj.evisHolder = newBgpV6EthernetSegmentBgpV6EvpnEvisIter(&obj.obj.Evis).setMsg(obj) + } + return obj.evisHolder +} + +type bgpV6EthernetSegmentBgpV6EvpnEvisIter struct { + obj *bgpV6EthernetSegment + bgpV6EvpnEvisSlice []BgpV6EvpnEvis + fieldPtr *[]*otg.BgpV6EvpnEvis +} + +func newBgpV6EthernetSegmentBgpV6EvpnEvisIter(ptr *[]*otg.BgpV6EvpnEvis) BgpV6EthernetSegmentBgpV6EvpnEvisIter { + return &bgpV6EthernetSegmentBgpV6EvpnEvisIter{fieldPtr: ptr} +} + +type BgpV6EthernetSegmentBgpV6EvpnEvisIter interface { + setMsg(*bgpV6EthernetSegment) BgpV6EthernetSegmentBgpV6EvpnEvisIter + Items() []BgpV6EvpnEvis + Add() BgpV6EvpnEvis + Append(items ...BgpV6EvpnEvis) BgpV6EthernetSegmentBgpV6EvpnEvisIter + Set(index int, newObj BgpV6EvpnEvis) BgpV6EthernetSegmentBgpV6EvpnEvisIter + Clear() BgpV6EthernetSegmentBgpV6EvpnEvisIter + clearHolderSlice() BgpV6EthernetSegmentBgpV6EvpnEvisIter + appendHolderSlice(item BgpV6EvpnEvis) BgpV6EthernetSegmentBgpV6EvpnEvisIter +} + +func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) setMsg(msg *bgpV6EthernetSegment) BgpV6EthernetSegmentBgpV6EvpnEvisIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpV6EvpnEvis{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) Items() []BgpV6EvpnEvis { + return obj.bgpV6EvpnEvisSlice +} + +func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) Add() BgpV6EvpnEvis { + newObj := &otg.BgpV6EvpnEvis{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpV6EvpnEvis{obj: newObj} + newLibObj.setDefault() + obj.bgpV6EvpnEvisSlice = append(obj.bgpV6EvpnEvisSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) Append(items ...BgpV6EvpnEvis) BgpV6EthernetSegmentBgpV6EvpnEvisIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpV6EvpnEvisSlice = append(obj.bgpV6EvpnEvisSlice, item) + } + return obj +} + +func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) Set(index int, newObj BgpV6EvpnEvis) BgpV6EthernetSegmentBgpV6EvpnEvisIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpV6EvpnEvisSlice[index] = newObj + return obj +} +func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) Clear() BgpV6EthernetSegmentBgpV6EvpnEvisIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpV6EvpnEvis{} + obj.bgpV6EvpnEvisSlice = []BgpV6EvpnEvis{} + } + return obj +} +func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) clearHolderSlice() BgpV6EthernetSegmentBgpV6EvpnEvisIter { + if len(obj.bgpV6EvpnEvisSlice) > 0 { + obj.bgpV6EvpnEvisSlice = []BgpV6EvpnEvis{} + } + return obj +} +func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) appendHolderSlice(item BgpV6EvpnEvis) BgpV6EthernetSegmentBgpV6EvpnEvisIter { + obj.bgpV6EvpnEvisSlice = append(obj.bgpV6EvpnEvisSlice, item) + return obj +} + +// 10-octet Ethernet Segment Identifier (ESI) Example - For multi-home scenario nonZero ESI is '10000000000000000000' . +// Esi returns a string +func (obj *bgpV6EthernetSegment) Esi() string { + + return *obj.obj.Esi + +} + +// 10-octet Ethernet Segment Identifier (ESI) Example - For multi-home scenario nonZero ESI is '10000000000000000000' . +// Esi returns a string +func (obj *bgpV6EthernetSegment) HasEsi() bool { + return obj.obj.Esi != nil +} + +// 10-octet Ethernet Segment Identifier (ESI) Example - For multi-home scenario nonZero ESI is '10000000000000000000' . +// SetEsi sets the string value in the BgpV6EthernetSegment object +func (obj *bgpV6EthernetSegment) SetEsi(value string) BgpV6EthernetSegment { + + obj.obj.Esi = &value + return obj +} + +type BgpV6EthernetSegmentActiveModeEnum string + +// Enum of ActiveMode on BgpV6EthernetSegment +var BgpV6EthernetSegmentActiveMode = struct { + SINGLE_ACTIVE BgpV6EthernetSegmentActiveModeEnum + ALL_ACTIVE BgpV6EthernetSegmentActiveModeEnum +}{ + SINGLE_ACTIVE: BgpV6EthernetSegmentActiveModeEnum("single_active"), + ALL_ACTIVE: BgpV6EthernetSegmentActiveModeEnum("all_active"), +} + +func (obj *bgpV6EthernetSegment) ActiveMode() BgpV6EthernetSegmentActiveModeEnum { + return BgpV6EthernetSegmentActiveModeEnum(obj.obj.ActiveMode.Enum().String()) +} + +// Single Active or All Active mode Redundancy mode selection for Multi-home. +// ActiveMode returns a string +func (obj *bgpV6EthernetSegment) HasActiveMode() bool { + return obj.obj.ActiveMode != nil +} + +func (obj *bgpV6EthernetSegment) SetActiveMode(value BgpV6EthernetSegmentActiveModeEnum) BgpV6EthernetSegment { + intValue, ok := otg.BgpV6EthernetSegment_ActiveMode_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpV6EthernetSegmentActiveModeEnum", string(value))) + return obj + } + enumValue := otg.BgpV6EthernetSegment_ActiveMode_Enum(intValue) + obj.obj.ActiveMode = &enumValue + + return obj +} + +// The label value to be advertised as ESI Label in ESI Label Extended Community. This is included in Ethernet Auto-discovery per ES Routes advertised by a router. +// EsiLabel returns a uint32 +func (obj *bgpV6EthernetSegment) EsiLabel() uint32 { + + return *obj.obj.EsiLabel + +} + +// The label value to be advertised as ESI Label in ESI Label Extended Community. This is included in Ethernet Auto-discovery per ES Routes advertised by a router. +// EsiLabel returns a uint32 +func (obj *bgpV6EthernetSegment) HasEsiLabel() bool { + return obj.obj.EsiLabel != nil +} + +// The label value to be advertised as ESI Label in ESI Label Extended Community. This is included in Ethernet Auto-discovery per ES Routes advertised by a router. +// SetEsiLabel sets the uint32 value in the BgpV6EthernetSegment object +func (obj *bgpV6EthernetSegment) SetEsiLabel(value uint32) BgpV6EthernetSegment { + + obj.obj.EsiLabel = &value + return obj +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpV6EthernetSegment) Advanced() BgpRouteAdvanced { + if obj.obj.Advanced == nil { + obj.obj.Advanced = NewBgpRouteAdvanced().msg() + } + if obj.advancedHolder == nil { + obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} + } + return obj.advancedHolder +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpV6EthernetSegment) HasAdvanced() bool { + return obj.obj.Advanced != nil +} + +// description is TBD +// SetAdvanced sets the BgpRouteAdvanced value in the BgpV6EthernetSegment object +func (obj *bgpV6EthernetSegment) SetAdvanced(value BgpRouteAdvanced) BgpV6EthernetSegment { + + obj.advancedHolder = nil + obj.obj.Advanced = value.msg() + + return obj +} + +// Optional community settings. +// Communities returns a []BgpCommunity +func (obj *bgpV6EthernetSegment) Communities() BgpV6EthernetSegmentBgpCommunityIter { + if len(obj.obj.Communities) == 0 { + obj.obj.Communities = []*otg.BgpCommunity{} + } + if obj.communitiesHolder == nil { + obj.communitiesHolder = newBgpV6EthernetSegmentBgpCommunityIter(&obj.obj.Communities).setMsg(obj) + } + return obj.communitiesHolder +} + +type bgpV6EthernetSegmentBgpCommunityIter struct { + obj *bgpV6EthernetSegment + bgpCommunitySlice []BgpCommunity + fieldPtr *[]*otg.BgpCommunity +} + +func newBgpV6EthernetSegmentBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpV6EthernetSegmentBgpCommunityIter { + return &bgpV6EthernetSegmentBgpCommunityIter{fieldPtr: ptr} +} + +type BgpV6EthernetSegmentBgpCommunityIter interface { + setMsg(*bgpV6EthernetSegment) BgpV6EthernetSegmentBgpCommunityIter + Items() []BgpCommunity + Add() BgpCommunity + Append(items ...BgpCommunity) BgpV6EthernetSegmentBgpCommunityIter + Set(index int, newObj BgpCommunity) BgpV6EthernetSegmentBgpCommunityIter + Clear() BgpV6EthernetSegmentBgpCommunityIter + clearHolderSlice() BgpV6EthernetSegmentBgpCommunityIter + appendHolderSlice(item BgpCommunity) BgpV6EthernetSegmentBgpCommunityIter +} + +func (obj *bgpV6EthernetSegmentBgpCommunityIter) setMsg(msg *bgpV6EthernetSegment) BgpV6EthernetSegmentBgpCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6EthernetSegmentBgpCommunityIter) Items() []BgpCommunity { + return obj.bgpCommunitySlice +} + +func (obj *bgpV6EthernetSegmentBgpCommunityIter) Add() BgpCommunity { + newObj := &otg.BgpCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6EthernetSegmentBgpCommunityIter) Append(items ...BgpCommunity) BgpV6EthernetSegmentBgpCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + } + return obj +} + +func (obj *bgpV6EthernetSegmentBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpV6EthernetSegmentBgpCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpCommunitySlice[index] = newObj + return obj +} +func (obj *bgpV6EthernetSegmentBgpCommunityIter) Clear() BgpV6EthernetSegmentBgpCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpCommunity{} + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpV6EthernetSegmentBgpCommunityIter) clearHolderSlice() BgpV6EthernetSegmentBgpCommunityIter { + if len(obj.bgpCommunitySlice) > 0 { + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpV6EthernetSegmentBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpV6EthernetSegmentBgpCommunityIter { + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + return obj +} + +// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. +// ExtCommunities returns a []BgpExtCommunity +func (obj *bgpV6EthernetSegment) ExtCommunities() BgpV6EthernetSegmentBgpExtCommunityIter { + if len(obj.obj.ExtCommunities) == 0 { + obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} + } + if obj.extCommunitiesHolder == nil { + obj.extCommunitiesHolder = newBgpV6EthernetSegmentBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) + } + return obj.extCommunitiesHolder +} + +type bgpV6EthernetSegmentBgpExtCommunityIter struct { + obj *bgpV6EthernetSegment + bgpExtCommunitySlice []BgpExtCommunity + fieldPtr *[]*otg.BgpExtCommunity +} + +func newBgpV6EthernetSegmentBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpV6EthernetSegmentBgpExtCommunityIter { + return &bgpV6EthernetSegmentBgpExtCommunityIter{fieldPtr: ptr} +} + +type BgpV6EthernetSegmentBgpExtCommunityIter interface { + setMsg(*bgpV6EthernetSegment) BgpV6EthernetSegmentBgpExtCommunityIter + Items() []BgpExtCommunity + Add() BgpExtCommunity + Append(items ...BgpExtCommunity) BgpV6EthernetSegmentBgpExtCommunityIter + Set(index int, newObj BgpExtCommunity) BgpV6EthernetSegmentBgpExtCommunityIter + Clear() BgpV6EthernetSegmentBgpExtCommunityIter + clearHolderSlice() BgpV6EthernetSegmentBgpExtCommunityIter + appendHolderSlice(item BgpExtCommunity) BgpV6EthernetSegmentBgpExtCommunityIter +} + +func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) setMsg(msg *bgpV6EthernetSegment) BgpV6EthernetSegmentBgpExtCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpExtCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) Items() []BgpExtCommunity { + return obj.bgpExtCommunitySlice +} + +func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) Add() BgpExtCommunity { + newObj := &otg.BgpExtCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpExtCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpV6EthernetSegmentBgpExtCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + } + return obj +} + +func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpV6EthernetSegmentBgpExtCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpExtCommunitySlice[index] = newObj + return obj +} +func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) Clear() BgpV6EthernetSegmentBgpExtCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpExtCommunity{} + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) clearHolderSlice() BgpV6EthernetSegmentBgpExtCommunityIter { + if len(obj.bgpExtCommunitySlice) > 0 { + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpV6EthernetSegmentBgpExtCommunityIter { + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + return obj +} + +// Optional AS PATH settings. +// AsPath returns a BgpAsPath +func (obj *bgpV6EthernetSegment) AsPath() BgpAsPath { + if obj.obj.AsPath == nil { + obj.obj.AsPath = NewBgpAsPath().msg() + } + if obj.asPathHolder == nil { + obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} + } + return obj.asPathHolder +} + +// Optional AS PATH settings. +// AsPath returns a BgpAsPath +func (obj *bgpV6EthernetSegment) HasAsPath() bool { + return obj.obj.AsPath != nil +} + +// Optional AS PATH settings. +// SetAsPath sets the BgpAsPath value in the BgpV6EthernetSegment object +func (obj *bgpV6EthernetSegment) SetAsPath(value BgpAsPath) BgpV6EthernetSegment { + + obj.asPathHolder = nil + obj.obj.AsPath = value.msg() + + return obj +} + +func (obj *bgpV6EthernetSegment) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.DfElection != nil { + + obj.DfElection().validateObj(vObj, set_default) + } + + if len(obj.obj.Evis) != 0 { + + if set_default { + obj.Evis().clearHolderSlice() + for _, item := range obj.obj.Evis { + obj.Evis().appendHolderSlice(&bgpV6EvpnEvis{obj: item}) + } + } + for _, item := range obj.Evis().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Esi != nil { + + err := obj.validateHex(obj.Esi()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV6EthernetSegment.Esi")) + } + + } + + if obj.obj.EsiLabel != nil { + + if *obj.obj.EsiLabel > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpV6EthernetSegment.EsiLabel <= 16777215 but Got %d", *obj.obj.EsiLabel)) + } + + } + + if obj.obj.Advanced != nil { + + obj.Advanced().validateObj(vObj, set_default) + } + + if len(obj.obj.Communities) != 0 { + + if set_default { + obj.Communities().clearHolderSlice() + for _, item := range obj.obj.Communities { + obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) + } + } + for _, item := range obj.Communities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.ExtCommunities) != 0 { + + if set_default { + obj.ExtCommunities().clearHolderSlice() + for _, item := range obj.obj.ExtCommunities { + obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) + } + } + for _, item := range obj.ExtCommunities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.AsPath != nil { + + obj.AsPath().validateObj(vObj, set_default) + } + +} + +func (obj *bgpV6EthernetSegment) setDefault() { + if obj.obj.Esi == nil { + obj.SetEsi("00000000000000000000") + } + if obj.obj.ActiveMode == nil { + obj.SetActiveMode(BgpV6EthernetSegmentActiveMode.ALL_ACTIVE) + + } + if obj.obj.EsiLabel == nil { + obj.SetEsiLabel(0) + } + +} diff --git a/gosnappi/bgp_v6_evi_vxlan.go b/gosnappi/bgp_v6_evi_vxlan.go new file mode 100644 index 00000000..ab89b601 --- /dev/null +++ b/gosnappi/bgp_v6_evi_vxlan.go @@ -0,0 +1,1054 @@ +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" +) + +// ***** BgpV6EviVxlan ***** +type bgpV6EviVxlan struct { + validation + obj *otg.BgpV6EviVxlan + marshaller marshalBgpV6EviVxlan + unMarshaller unMarshalBgpV6EviVxlan + broadcastDomainsHolder BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter + routeDistinguisherHolder BgpRouteDistinguisher + routeTargetExportHolder BgpV6EviVxlanBgpRouteTargetIter + routeTargetImportHolder BgpV6EviVxlanBgpRouteTargetIter + l3RouteTargetExportHolder BgpV6EviVxlanBgpRouteTargetIter + l3RouteTargetImportHolder BgpV6EviVxlanBgpRouteTargetIter + advancedHolder BgpRouteAdvanced + communitiesHolder BgpV6EviVxlanBgpCommunityIter + extCommunitiesHolder BgpV6EviVxlanBgpExtCommunityIter + asPathHolder BgpAsPath +} + +func NewBgpV6EviVxlan() BgpV6EviVxlan { + obj := bgpV6EviVxlan{obj: &otg.BgpV6EviVxlan{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV6EviVxlan) msg() *otg.BgpV6EviVxlan { + return obj.obj +} + +func (obj *bgpV6EviVxlan) setMsg(msg *otg.BgpV6EviVxlan) BgpV6EviVxlan { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV6EviVxlan struct { + obj *bgpV6EviVxlan +} + +type marshalBgpV6EviVxlan interface { + // ToProto marshals BgpV6EviVxlan to protobuf object *otg.BgpV6EviVxlan + ToProto() (*otg.BgpV6EviVxlan, error) + // ToPbText marshals BgpV6EviVxlan to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV6EviVxlan to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV6EviVxlan to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV6EviVxlan struct { + obj *bgpV6EviVxlan +} + +type unMarshalBgpV6EviVxlan interface { + // FromProto unmarshals BgpV6EviVxlan from protobuf object *otg.BgpV6EviVxlan + FromProto(msg *otg.BgpV6EviVxlan) (BgpV6EviVxlan, error) + // FromPbText unmarshals BgpV6EviVxlan from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV6EviVxlan from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV6EviVxlan from JSON text + FromJson(value string) error +} + +func (obj *bgpV6EviVxlan) Marshal() marshalBgpV6EviVxlan { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV6EviVxlan{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV6EviVxlan) Unmarshal() unMarshalBgpV6EviVxlan { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV6EviVxlan{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV6EviVxlan) ToProto() (*otg.BgpV6EviVxlan, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV6EviVxlan) FromProto(msg *otg.BgpV6EviVxlan) (BgpV6EviVxlan, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV6EviVxlan) 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 *unMarshalbgpV6EviVxlan) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpV6EviVxlan) 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 *unMarshalbgpV6EviVxlan) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpV6EviVxlan) 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 *unMarshalbgpV6EviVxlan) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpV6EviVxlan) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV6EviVxlan) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV6EviVxlan) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV6EviVxlan) Clone() (BgpV6EviVxlan, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV6EviVxlan() + 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 +} + +func (obj *bgpV6EviVxlan) setNil() { + obj.broadcastDomainsHolder = nil + obj.routeDistinguisherHolder = nil + obj.routeTargetExportHolder = nil + obj.routeTargetImportHolder = nil + obj.l3RouteTargetExportHolder = nil + obj.l3RouteTargetImportHolder = nil + obj.advancedHolder = nil + obj.communitiesHolder = nil + obj.extCommunitiesHolder = nil + obj.asPathHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpV6EviVxlan is configuration for BGP EVPN EVI. Advertises following routes - +// +// # Type 3 - Inclusive Multicast Ethernet Tag Route +// +// Type 1 - Ethernet Auto-discovery Route (Per EVI) +// +// Type 1 - Ethernet Auto-discovery Route (Per ES) +type BgpV6EviVxlan interface { + Validation + // msg marshals BgpV6EviVxlan to protobuf object *otg.BgpV6EviVxlan + // and doesn't set defaults + msg() *otg.BgpV6EviVxlan + // setMsg unmarshals BgpV6EviVxlan from protobuf object *otg.BgpV6EviVxlan + // and doesn't set defaults + setMsg(*otg.BgpV6EviVxlan) BgpV6EviVxlan + // provides marshal interface + Marshal() marshalBgpV6EviVxlan + // provides unmarshal interface + Unmarshal() unMarshalBgpV6EviVxlan + // validate validates BgpV6EviVxlan + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV6EviVxlan, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // BroadcastDomains returns BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIterIter, set in BgpV6EviVxlan + BroadcastDomains() BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter + // ReplicationType returns BgpV6EviVxlanReplicationTypeEnum, set in BgpV6EviVxlan + ReplicationType() BgpV6EviVxlanReplicationTypeEnum + // SetReplicationType assigns BgpV6EviVxlanReplicationTypeEnum provided by user to BgpV6EviVxlan + SetReplicationType(value BgpV6EviVxlanReplicationTypeEnum) BgpV6EviVxlan + // HasReplicationType checks if ReplicationType has been set in BgpV6EviVxlan + HasReplicationType() bool + // PmsiLabel returns uint32, set in BgpV6EviVxlan. + PmsiLabel() uint32 + // SetPmsiLabel assigns uint32 provided by user to BgpV6EviVxlan + SetPmsiLabel(value uint32) BgpV6EviVxlan + // HasPmsiLabel checks if PmsiLabel has been set in BgpV6EviVxlan + HasPmsiLabel() bool + // AdLabel returns uint32, set in BgpV6EviVxlan. + AdLabel() uint32 + // SetAdLabel assigns uint32 provided by user to BgpV6EviVxlan + SetAdLabel(value uint32) BgpV6EviVxlan + // HasAdLabel checks if AdLabel has been set in BgpV6EviVxlan + HasAdLabel() bool + // RouteDistinguisher returns BgpRouteDistinguisher, set in BgpV6EviVxlan. + // BgpRouteDistinguisher is bGP Route Distinguisher. + RouteDistinguisher() BgpRouteDistinguisher + // SetRouteDistinguisher assigns BgpRouteDistinguisher provided by user to BgpV6EviVxlan. + // BgpRouteDistinguisher is bGP Route Distinguisher. + SetRouteDistinguisher(value BgpRouteDistinguisher) BgpV6EviVxlan + // HasRouteDistinguisher checks if RouteDistinguisher has been set in BgpV6EviVxlan + HasRouteDistinguisher() bool + // RouteTargetExport returns BgpV6EviVxlanBgpRouteTargetIterIter, set in BgpV6EviVxlan + RouteTargetExport() BgpV6EviVxlanBgpRouteTargetIter + // RouteTargetImport returns BgpV6EviVxlanBgpRouteTargetIterIter, set in BgpV6EviVxlan + RouteTargetImport() BgpV6EviVxlanBgpRouteTargetIter + // L3RouteTargetExport returns BgpV6EviVxlanBgpRouteTargetIterIter, set in BgpV6EviVxlan + L3RouteTargetExport() BgpV6EviVxlanBgpRouteTargetIter + // L3RouteTargetImport returns BgpV6EviVxlanBgpRouteTargetIterIter, set in BgpV6EviVxlan + L3RouteTargetImport() BgpV6EviVxlanBgpRouteTargetIter + // Advanced returns BgpRouteAdvanced, set in BgpV6EviVxlan. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + Advanced() BgpRouteAdvanced + // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpV6EviVxlan. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + SetAdvanced(value BgpRouteAdvanced) BgpV6EviVxlan + // HasAdvanced checks if Advanced has been set in BgpV6EviVxlan + HasAdvanced() bool + // Communities returns BgpV6EviVxlanBgpCommunityIterIter, set in BgpV6EviVxlan + Communities() BgpV6EviVxlanBgpCommunityIter + // ExtCommunities returns BgpV6EviVxlanBgpExtCommunityIterIter, set in BgpV6EviVxlan + ExtCommunities() BgpV6EviVxlanBgpExtCommunityIter + // AsPath returns BgpAsPath, set in BgpV6EviVxlan. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + AsPath() BgpAsPath + // SetAsPath assigns BgpAsPath provided by user to BgpV6EviVxlan. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + SetAsPath(value BgpAsPath) BgpV6EviVxlan + // HasAsPath checks if AsPath has been set in BgpV6EviVxlan + HasAsPath() bool + setNil() +} + +// This contains the list of Broadcast Domains to be configured per EVI. +// BroadcastDomains returns a []BgpV6EviVxlanBroadcastDomain +func (obj *bgpV6EviVxlan) BroadcastDomains() BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { + if len(obj.obj.BroadcastDomains) == 0 { + obj.obj.BroadcastDomains = []*otg.BgpV6EviVxlanBroadcastDomain{} + } + if obj.broadcastDomainsHolder == nil { + obj.broadcastDomainsHolder = newBgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter(&obj.obj.BroadcastDomains).setMsg(obj) + } + return obj.broadcastDomainsHolder +} + +type bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter struct { + obj *bgpV6EviVxlan + bgpV6EviVxlanBroadcastDomainSlice []BgpV6EviVxlanBroadcastDomain + fieldPtr *[]*otg.BgpV6EviVxlanBroadcastDomain +} + +func newBgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter(ptr *[]*otg.BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { + return &bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter{fieldPtr: ptr} +} + +type BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter interface { + setMsg(*bgpV6EviVxlan) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter + Items() []BgpV6EviVxlanBroadcastDomain + Add() BgpV6EviVxlanBroadcastDomain + Append(items ...BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter + Set(index int, newObj BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter + Clear() BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter + clearHolderSlice() BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter + appendHolderSlice(item BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter +} + +func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) setMsg(msg *bgpV6EviVxlan) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpV6EviVxlanBroadcastDomain{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) Items() []BgpV6EviVxlanBroadcastDomain { + return obj.bgpV6EviVxlanBroadcastDomainSlice +} + +func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) Add() BgpV6EviVxlanBroadcastDomain { + newObj := &otg.BgpV6EviVxlanBroadcastDomain{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpV6EviVxlanBroadcastDomain{obj: newObj} + newLibObj.setDefault() + obj.bgpV6EviVxlanBroadcastDomainSlice = append(obj.bgpV6EviVxlanBroadcastDomainSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) Append(items ...BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpV6EviVxlanBroadcastDomainSlice = append(obj.bgpV6EviVxlanBroadcastDomainSlice, item) + } + return obj +} + +func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) Set(index int, newObj BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpV6EviVxlanBroadcastDomainSlice[index] = newObj + return obj +} +func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) Clear() BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpV6EviVxlanBroadcastDomain{} + obj.bgpV6EviVxlanBroadcastDomainSlice = []BgpV6EviVxlanBroadcastDomain{} + } + return obj +} +func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) clearHolderSlice() BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { + if len(obj.bgpV6EviVxlanBroadcastDomainSlice) > 0 { + obj.bgpV6EviVxlanBroadcastDomainSlice = []BgpV6EviVxlanBroadcastDomain{} + } + return obj +} +func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) appendHolderSlice(item BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { + obj.bgpV6EviVxlanBroadcastDomainSlice = append(obj.bgpV6EviVxlanBroadcastDomainSlice, item) + return obj +} + +type BgpV6EviVxlanReplicationTypeEnum string + +// Enum of ReplicationType on BgpV6EviVxlan +var BgpV6EviVxlanReplicationType = struct { + INGRESS_REPLICATION BgpV6EviVxlanReplicationTypeEnum +}{ + INGRESS_REPLICATION: BgpV6EviVxlanReplicationTypeEnum("ingress_replication"), +} + +func (obj *bgpV6EviVxlan) ReplicationType() BgpV6EviVxlanReplicationTypeEnum { + return BgpV6EviVxlanReplicationTypeEnum(obj.obj.ReplicationType.Enum().String()) +} + +// This model only supports Ingress Replication +// ReplicationType returns a string +func (obj *bgpV6EviVxlan) HasReplicationType() bool { + return obj.obj.ReplicationType != nil +} + +func (obj *bgpV6EviVxlan) SetReplicationType(value BgpV6EviVxlanReplicationTypeEnum) BgpV6EviVxlan { + intValue, ok := otg.BgpV6EviVxlan_ReplicationType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpV6EviVxlanReplicationTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpV6EviVxlan_ReplicationType_Enum(intValue) + obj.obj.ReplicationType = &enumValue + + return obj +} + +// Downstream assigned VNI to be carried as Part of P-Multicast Service Interface Tunnel attribute (PMSI Tunnel Attribute) in Type 3 Inclusive Multicast Ethernet Tag Route. +// PmsiLabel returns a uint32 +func (obj *bgpV6EviVxlan) PmsiLabel() uint32 { + + return *obj.obj.PmsiLabel + +} + +// Downstream assigned VNI to be carried as Part of P-Multicast Service Interface Tunnel attribute (PMSI Tunnel Attribute) in Type 3 Inclusive Multicast Ethernet Tag Route. +// PmsiLabel returns a uint32 +func (obj *bgpV6EviVxlan) HasPmsiLabel() bool { + return obj.obj.PmsiLabel != nil +} + +// Downstream assigned VNI to be carried as Part of P-Multicast Service Interface Tunnel attribute (PMSI Tunnel Attribute) in Type 3 Inclusive Multicast Ethernet Tag Route. +// SetPmsiLabel sets the uint32 value in the BgpV6EviVxlan object +func (obj *bgpV6EviVxlan) SetPmsiLabel(value uint32) BgpV6EviVxlan { + + obj.obj.PmsiLabel = &value + return obj +} + +// The Auto-discovery Route label (AD label) value, which gets advertised in the Ethernet Auto-discovery Route per +// AdLabel returns a uint32 +func (obj *bgpV6EviVxlan) AdLabel() uint32 { + + return *obj.obj.AdLabel + +} + +// The Auto-discovery Route label (AD label) value, which gets advertised in the Ethernet Auto-discovery Route per +// AdLabel returns a uint32 +func (obj *bgpV6EviVxlan) HasAdLabel() bool { + return obj.obj.AdLabel != nil +} + +// The Auto-discovery Route label (AD label) value, which gets advertised in the Ethernet Auto-discovery Route per +// SetAdLabel sets the uint32 value in the BgpV6EviVxlan object +func (obj *bgpV6EviVxlan) SetAdLabel(value uint32) BgpV6EviVxlan { + + obj.obj.AdLabel = &value + return obj +} + +// Colon separated Extended Community value of 6 Bytes - "AS number: Value" identifying an EVI. Example - for the as_2octet "60005:100". +// RouteDistinguisher returns a BgpRouteDistinguisher +func (obj *bgpV6EviVxlan) RouteDistinguisher() BgpRouteDistinguisher { + if obj.obj.RouteDistinguisher == nil { + obj.obj.RouteDistinguisher = NewBgpRouteDistinguisher().msg() + } + if obj.routeDistinguisherHolder == nil { + obj.routeDistinguisherHolder = &bgpRouteDistinguisher{obj: obj.obj.RouteDistinguisher} + } + return obj.routeDistinguisherHolder +} + +// Colon separated Extended Community value of 6 Bytes - "AS number: Value" identifying an EVI. Example - for the as_2octet "60005:100". +// RouteDistinguisher returns a BgpRouteDistinguisher +func (obj *bgpV6EviVxlan) HasRouteDistinguisher() bool { + return obj.obj.RouteDistinguisher != nil +} + +// Colon separated Extended Community value of 6 Bytes - "AS number: Value" identifying an EVI. Example - for the as_2octet "60005:100". +// SetRouteDistinguisher sets the BgpRouteDistinguisher value in the BgpV6EviVxlan object +func (obj *bgpV6EviVxlan) SetRouteDistinguisher(value BgpRouteDistinguisher) BgpV6EviVxlan { + + obj.routeDistinguisherHolder = nil + obj.obj.RouteDistinguisher = value.msg() + + return obj +} + +// List of Layer 2 Virtual Network Identifier (L2VNI) export targets associated with this EVI. +// RouteTargetExport returns a []BgpRouteTarget +func (obj *bgpV6EviVxlan) RouteTargetExport() BgpV6EviVxlanBgpRouteTargetIter { + if len(obj.obj.RouteTargetExport) == 0 { + obj.obj.RouteTargetExport = []*otg.BgpRouteTarget{} + } + if obj.routeTargetExportHolder == nil { + obj.routeTargetExportHolder = newBgpV6EviVxlanBgpRouteTargetIter(&obj.obj.RouteTargetExport).setMsg(obj) + } + return obj.routeTargetExportHolder +} + +type bgpV6EviVxlanBgpRouteTargetIter struct { + obj *bgpV6EviVxlan + bgpRouteTargetSlice []BgpRouteTarget + fieldPtr *[]*otg.BgpRouteTarget +} + +func newBgpV6EviVxlanBgpRouteTargetIter(ptr *[]*otg.BgpRouteTarget) BgpV6EviVxlanBgpRouteTargetIter { + return &bgpV6EviVxlanBgpRouteTargetIter{fieldPtr: ptr} +} + +type BgpV6EviVxlanBgpRouteTargetIter interface { + setMsg(*bgpV6EviVxlan) BgpV6EviVxlanBgpRouteTargetIter + Items() []BgpRouteTarget + Add() BgpRouteTarget + Append(items ...BgpRouteTarget) BgpV6EviVxlanBgpRouteTargetIter + Set(index int, newObj BgpRouteTarget) BgpV6EviVxlanBgpRouteTargetIter + Clear() BgpV6EviVxlanBgpRouteTargetIter + clearHolderSlice() BgpV6EviVxlanBgpRouteTargetIter + appendHolderSlice(item BgpRouteTarget) BgpV6EviVxlanBgpRouteTargetIter +} + +func (obj *bgpV6EviVxlanBgpRouteTargetIter) setMsg(msg *bgpV6EviVxlan) BgpV6EviVxlanBgpRouteTargetIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpRouteTarget{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6EviVxlanBgpRouteTargetIter) Items() []BgpRouteTarget { + return obj.bgpRouteTargetSlice +} + +func (obj *bgpV6EviVxlanBgpRouteTargetIter) Add() BgpRouteTarget { + newObj := &otg.BgpRouteTarget{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpRouteTarget{obj: newObj} + newLibObj.setDefault() + obj.bgpRouteTargetSlice = append(obj.bgpRouteTargetSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6EviVxlanBgpRouteTargetIter) Append(items ...BgpRouteTarget) BgpV6EviVxlanBgpRouteTargetIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpRouteTargetSlice = append(obj.bgpRouteTargetSlice, item) + } + return obj +} + +func (obj *bgpV6EviVxlanBgpRouteTargetIter) Set(index int, newObj BgpRouteTarget) BgpV6EviVxlanBgpRouteTargetIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpRouteTargetSlice[index] = newObj + return obj +} +func (obj *bgpV6EviVxlanBgpRouteTargetIter) Clear() BgpV6EviVxlanBgpRouteTargetIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpRouteTarget{} + obj.bgpRouteTargetSlice = []BgpRouteTarget{} + } + return obj +} +func (obj *bgpV6EviVxlanBgpRouteTargetIter) clearHolderSlice() BgpV6EviVxlanBgpRouteTargetIter { + if len(obj.bgpRouteTargetSlice) > 0 { + obj.bgpRouteTargetSlice = []BgpRouteTarget{} + } + return obj +} +func (obj *bgpV6EviVxlanBgpRouteTargetIter) appendHolderSlice(item BgpRouteTarget) BgpV6EviVxlanBgpRouteTargetIter { + obj.bgpRouteTargetSlice = append(obj.bgpRouteTargetSlice, item) + return obj +} + +// List of L2VNI import targets associated with this EVI. +// RouteTargetImport returns a []BgpRouteTarget +func (obj *bgpV6EviVxlan) RouteTargetImport() BgpV6EviVxlanBgpRouteTargetIter { + if len(obj.obj.RouteTargetImport) == 0 { + obj.obj.RouteTargetImport = []*otg.BgpRouteTarget{} + } + if obj.routeTargetImportHolder == nil { + obj.routeTargetImportHolder = newBgpV6EviVxlanBgpRouteTargetIter(&obj.obj.RouteTargetImport).setMsg(obj) + } + return obj.routeTargetImportHolder +} + +// List of Layer 3 Virtual Network Identifier (L3VNI) Export Route Targets. +// L3RouteTargetExport returns a []BgpRouteTarget +func (obj *bgpV6EviVxlan) L3RouteTargetExport() BgpV6EviVxlanBgpRouteTargetIter { + if len(obj.obj.L3RouteTargetExport) == 0 { + obj.obj.L3RouteTargetExport = []*otg.BgpRouteTarget{} + } + if obj.l3RouteTargetExportHolder == nil { + obj.l3RouteTargetExportHolder = newBgpV6EviVxlanBgpRouteTargetIter(&obj.obj.L3RouteTargetExport).setMsg(obj) + } + return obj.l3RouteTargetExportHolder +} + +// List of L3VNI Import Route Targets. +// L3RouteTargetImport returns a []BgpRouteTarget +func (obj *bgpV6EviVxlan) L3RouteTargetImport() BgpV6EviVxlanBgpRouteTargetIter { + if len(obj.obj.L3RouteTargetImport) == 0 { + obj.obj.L3RouteTargetImport = []*otg.BgpRouteTarget{} + } + if obj.l3RouteTargetImportHolder == nil { + obj.l3RouteTargetImportHolder = newBgpV6EviVxlanBgpRouteTargetIter(&obj.obj.L3RouteTargetImport).setMsg(obj) + } + return obj.l3RouteTargetImportHolder +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpV6EviVxlan) Advanced() BgpRouteAdvanced { + if obj.obj.Advanced == nil { + obj.obj.Advanced = NewBgpRouteAdvanced().msg() + } + if obj.advancedHolder == nil { + obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} + } + return obj.advancedHolder +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpV6EviVxlan) HasAdvanced() bool { + return obj.obj.Advanced != nil +} + +// description is TBD +// SetAdvanced sets the BgpRouteAdvanced value in the BgpV6EviVxlan object +func (obj *bgpV6EviVxlan) SetAdvanced(value BgpRouteAdvanced) BgpV6EviVxlan { + + obj.advancedHolder = nil + obj.obj.Advanced = value.msg() + + return obj +} + +// Optional community settings. +// Communities returns a []BgpCommunity +func (obj *bgpV6EviVxlan) Communities() BgpV6EviVxlanBgpCommunityIter { + if len(obj.obj.Communities) == 0 { + obj.obj.Communities = []*otg.BgpCommunity{} + } + if obj.communitiesHolder == nil { + obj.communitiesHolder = newBgpV6EviVxlanBgpCommunityIter(&obj.obj.Communities).setMsg(obj) + } + return obj.communitiesHolder +} + +type bgpV6EviVxlanBgpCommunityIter struct { + obj *bgpV6EviVxlan + bgpCommunitySlice []BgpCommunity + fieldPtr *[]*otg.BgpCommunity +} + +func newBgpV6EviVxlanBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpV6EviVxlanBgpCommunityIter { + return &bgpV6EviVxlanBgpCommunityIter{fieldPtr: ptr} +} + +type BgpV6EviVxlanBgpCommunityIter interface { + setMsg(*bgpV6EviVxlan) BgpV6EviVxlanBgpCommunityIter + Items() []BgpCommunity + Add() BgpCommunity + Append(items ...BgpCommunity) BgpV6EviVxlanBgpCommunityIter + Set(index int, newObj BgpCommunity) BgpV6EviVxlanBgpCommunityIter + Clear() BgpV6EviVxlanBgpCommunityIter + clearHolderSlice() BgpV6EviVxlanBgpCommunityIter + appendHolderSlice(item BgpCommunity) BgpV6EviVxlanBgpCommunityIter +} + +func (obj *bgpV6EviVxlanBgpCommunityIter) setMsg(msg *bgpV6EviVxlan) BgpV6EviVxlanBgpCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6EviVxlanBgpCommunityIter) Items() []BgpCommunity { + return obj.bgpCommunitySlice +} + +func (obj *bgpV6EviVxlanBgpCommunityIter) Add() BgpCommunity { + newObj := &otg.BgpCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6EviVxlanBgpCommunityIter) Append(items ...BgpCommunity) BgpV6EviVxlanBgpCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + } + return obj +} + +func (obj *bgpV6EviVxlanBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpV6EviVxlanBgpCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpCommunitySlice[index] = newObj + return obj +} +func (obj *bgpV6EviVxlanBgpCommunityIter) Clear() BgpV6EviVxlanBgpCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpCommunity{} + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpV6EviVxlanBgpCommunityIter) clearHolderSlice() BgpV6EviVxlanBgpCommunityIter { + if len(obj.bgpCommunitySlice) > 0 { + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpV6EviVxlanBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpV6EviVxlanBgpCommunityIter { + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + return obj +} + +// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. +// ExtCommunities returns a []BgpExtCommunity +func (obj *bgpV6EviVxlan) ExtCommunities() BgpV6EviVxlanBgpExtCommunityIter { + if len(obj.obj.ExtCommunities) == 0 { + obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} + } + if obj.extCommunitiesHolder == nil { + obj.extCommunitiesHolder = newBgpV6EviVxlanBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) + } + return obj.extCommunitiesHolder +} + +type bgpV6EviVxlanBgpExtCommunityIter struct { + obj *bgpV6EviVxlan + bgpExtCommunitySlice []BgpExtCommunity + fieldPtr *[]*otg.BgpExtCommunity +} + +func newBgpV6EviVxlanBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpV6EviVxlanBgpExtCommunityIter { + return &bgpV6EviVxlanBgpExtCommunityIter{fieldPtr: ptr} +} + +type BgpV6EviVxlanBgpExtCommunityIter interface { + setMsg(*bgpV6EviVxlan) BgpV6EviVxlanBgpExtCommunityIter + Items() []BgpExtCommunity + Add() BgpExtCommunity + Append(items ...BgpExtCommunity) BgpV6EviVxlanBgpExtCommunityIter + Set(index int, newObj BgpExtCommunity) BgpV6EviVxlanBgpExtCommunityIter + Clear() BgpV6EviVxlanBgpExtCommunityIter + clearHolderSlice() BgpV6EviVxlanBgpExtCommunityIter + appendHolderSlice(item BgpExtCommunity) BgpV6EviVxlanBgpExtCommunityIter +} + +func (obj *bgpV6EviVxlanBgpExtCommunityIter) setMsg(msg *bgpV6EviVxlan) BgpV6EviVxlanBgpExtCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpExtCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6EviVxlanBgpExtCommunityIter) Items() []BgpExtCommunity { + return obj.bgpExtCommunitySlice +} + +func (obj *bgpV6EviVxlanBgpExtCommunityIter) Add() BgpExtCommunity { + newObj := &otg.BgpExtCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpExtCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6EviVxlanBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpV6EviVxlanBgpExtCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + } + return obj +} + +func (obj *bgpV6EviVxlanBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpV6EviVxlanBgpExtCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpExtCommunitySlice[index] = newObj + return obj +} +func (obj *bgpV6EviVxlanBgpExtCommunityIter) Clear() BgpV6EviVxlanBgpExtCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpExtCommunity{} + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpV6EviVxlanBgpExtCommunityIter) clearHolderSlice() BgpV6EviVxlanBgpExtCommunityIter { + if len(obj.bgpExtCommunitySlice) > 0 { + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpV6EviVxlanBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpV6EviVxlanBgpExtCommunityIter { + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + return obj +} + +// Optional AS PATH settings. +// AsPath returns a BgpAsPath +func (obj *bgpV6EviVxlan) AsPath() BgpAsPath { + if obj.obj.AsPath == nil { + obj.obj.AsPath = NewBgpAsPath().msg() + } + if obj.asPathHolder == nil { + obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} + } + return obj.asPathHolder +} + +// Optional AS PATH settings. +// AsPath returns a BgpAsPath +func (obj *bgpV6EviVxlan) HasAsPath() bool { + return obj.obj.AsPath != nil +} + +// Optional AS PATH settings. +// SetAsPath sets the BgpAsPath value in the BgpV6EviVxlan object +func (obj *bgpV6EviVxlan) SetAsPath(value BgpAsPath) BgpV6EviVxlan { + + obj.asPathHolder = nil + obj.obj.AsPath = value.msg() + + return obj +} + +func (obj *bgpV6EviVxlan) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.BroadcastDomains) != 0 { + + if set_default { + obj.BroadcastDomains().clearHolderSlice() + for _, item := range obj.obj.BroadcastDomains { + obj.BroadcastDomains().appendHolderSlice(&bgpV6EviVxlanBroadcastDomain{obj: item}) + } + } + for _, item := range obj.BroadcastDomains().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.PmsiLabel != nil { + + if *obj.obj.PmsiLabel > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpV6EviVxlan.PmsiLabel <= 16777215 but Got %d", *obj.obj.PmsiLabel)) + } + + } + + if obj.obj.AdLabel != nil { + + if *obj.obj.AdLabel > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpV6EviVxlan.AdLabel <= 16777215 but Got %d", *obj.obj.AdLabel)) + } + + } + + if obj.obj.RouteDistinguisher != nil { + + obj.RouteDistinguisher().validateObj(vObj, set_default) + } + + if len(obj.obj.RouteTargetExport) != 0 { + + if set_default { + obj.RouteTargetExport().clearHolderSlice() + for _, item := range obj.obj.RouteTargetExport { + obj.RouteTargetExport().appendHolderSlice(&bgpRouteTarget{obj: item}) + } + } + for _, item := range obj.RouteTargetExport().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.RouteTargetImport) != 0 { + + if set_default { + obj.RouteTargetImport().clearHolderSlice() + for _, item := range obj.obj.RouteTargetImport { + obj.RouteTargetImport().appendHolderSlice(&bgpRouteTarget{obj: item}) + } + } + for _, item := range obj.RouteTargetImport().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.L3RouteTargetExport) != 0 { + + if set_default { + obj.L3RouteTargetExport().clearHolderSlice() + for _, item := range obj.obj.L3RouteTargetExport { + obj.L3RouteTargetExport().appendHolderSlice(&bgpRouteTarget{obj: item}) + } + } + for _, item := range obj.L3RouteTargetExport().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.L3RouteTargetImport) != 0 { + + if set_default { + obj.L3RouteTargetImport().clearHolderSlice() + for _, item := range obj.obj.L3RouteTargetImport { + obj.L3RouteTargetImport().appendHolderSlice(&bgpRouteTarget{obj: item}) + } + } + for _, item := range obj.L3RouteTargetImport().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Advanced != nil { + + obj.Advanced().validateObj(vObj, set_default) + } + + if len(obj.obj.Communities) != 0 { + + if set_default { + obj.Communities().clearHolderSlice() + for _, item := range obj.obj.Communities { + obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) + } + } + for _, item := range obj.Communities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.ExtCommunities) != 0 { + + if set_default { + obj.ExtCommunities().clearHolderSlice() + for _, item := range obj.obj.ExtCommunities { + obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) + } + } + for _, item := range obj.ExtCommunities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.AsPath != nil { + + obj.AsPath().validateObj(vObj, set_default) + } + +} + +func (obj *bgpV6EviVxlan) setDefault() { + if obj.obj.ReplicationType == nil { + obj.SetReplicationType(BgpV6EviVxlanReplicationType.INGRESS_REPLICATION) + + } + if obj.obj.PmsiLabel == nil { + obj.SetPmsiLabel(16) + } + if obj.obj.AdLabel == nil { + obj.SetAdLabel(0) + } + +} diff --git a/gosnappi/bgp_v6_evi_vxlan_broadcast_domain.go b/gosnappi/bgp_v6_evi_vxlan_broadcast_domain.go new file mode 100644 index 00000000..e6155356 --- /dev/null +++ b/gosnappi/bgp_v6_evi_vxlan_broadcast_domain.go @@ -0,0 +1,455 @@ +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" +) + +// ***** BgpV6EviVxlanBroadcastDomain ***** +type bgpV6EviVxlanBroadcastDomain struct { + validation + obj *otg.BgpV6EviVxlanBroadcastDomain + marshaller marshalBgpV6EviVxlanBroadcastDomain + unMarshaller unMarshalBgpV6EviVxlanBroadcastDomain + cmacIpRangeHolder BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter +} + +func NewBgpV6EviVxlanBroadcastDomain() BgpV6EviVxlanBroadcastDomain { + obj := bgpV6EviVxlanBroadcastDomain{obj: &otg.BgpV6EviVxlanBroadcastDomain{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV6EviVxlanBroadcastDomain) msg() *otg.BgpV6EviVxlanBroadcastDomain { + return obj.obj +} + +func (obj *bgpV6EviVxlanBroadcastDomain) setMsg(msg *otg.BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBroadcastDomain { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV6EviVxlanBroadcastDomain struct { + obj *bgpV6EviVxlanBroadcastDomain +} + +type marshalBgpV6EviVxlanBroadcastDomain interface { + // ToProto marshals BgpV6EviVxlanBroadcastDomain to protobuf object *otg.BgpV6EviVxlanBroadcastDomain + ToProto() (*otg.BgpV6EviVxlanBroadcastDomain, error) + // ToPbText marshals BgpV6EviVxlanBroadcastDomain to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV6EviVxlanBroadcastDomain to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV6EviVxlanBroadcastDomain to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV6EviVxlanBroadcastDomain struct { + obj *bgpV6EviVxlanBroadcastDomain +} + +type unMarshalBgpV6EviVxlanBroadcastDomain interface { + // FromProto unmarshals BgpV6EviVxlanBroadcastDomain from protobuf object *otg.BgpV6EviVxlanBroadcastDomain + FromProto(msg *otg.BgpV6EviVxlanBroadcastDomain) (BgpV6EviVxlanBroadcastDomain, error) + // FromPbText unmarshals BgpV6EviVxlanBroadcastDomain from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV6EviVxlanBroadcastDomain from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV6EviVxlanBroadcastDomain from JSON text + FromJson(value string) error +} + +func (obj *bgpV6EviVxlanBroadcastDomain) Marshal() marshalBgpV6EviVxlanBroadcastDomain { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV6EviVxlanBroadcastDomain{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV6EviVxlanBroadcastDomain) Unmarshal() unMarshalBgpV6EviVxlanBroadcastDomain { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV6EviVxlanBroadcastDomain{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV6EviVxlanBroadcastDomain) ToProto() (*otg.BgpV6EviVxlanBroadcastDomain, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV6EviVxlanBroadcastDomain) FromProto(msg *otg.BgpV6EviVxlanBroadcastDomain) (BgpV6EviVxlanBroadcastDomain, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV6EviVxlanBroadcastDomain) 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 *unMarshalbgpV6EviVxlanBroadcastDomain) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpV6EviVxlanBroadcastDomain) 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 *unMarshalbgpV6EviVxlanBroadcastDomain) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpV6EviVxlanBroadcastDomain) 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 *unMarshalbgpV6EviVxlanBroadcastDomain) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpV6EviVxlanBroadcastDomain) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV6EviVxlanBroadcastDomain) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV6EviVxlanBroadcastDomain) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV6EviVxlanBroadcastDomain) Clone() (BgpV6EviVxlanBroadcastDomain, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV6EviVxlanBroadcastDomain() + 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 +} + +func (obj *bgpV6EviVxlanBroadcastDomain) setNil() { + obj.cmacIpRangeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpV6EviVxlanBroadcastDomain is configuration for Broadcast Domains per EVI. +type BgpV6EviVxlanBroadcastDomain interface { + Validation + // msg marshals BgpV6EviVxlanBroadcastDomain to protobuf object *otg.BgpV6EviVxlanBroadcastDomain + // and doesn't set defaults + msg() *otg.BgpV6EviVxlanBroadcastDomain + // setMsg unmarshals BgpV6EviVxlanBroadcastDomain from protobuf object *otg.BgpV6EviVxlanBroadcastDomain + // and doesn't set defaults + setMsg(*otg.BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBroadcastDomain + // provides marshal interface + Marshal() marshalBgpV6EviVxlanBroadcastDomain + // provides unmarshal interface + Unmarshal() unMarshalBgpV6EviVxlanBroadcastDomain + // validate validates BgpV6EviVxlanBroadcastDomain + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV6EviVxlanBroadcastDomain, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // CmacIpRange returns BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIterIter, set in BgpV6EviVxlanBroadcastDomain + CmacIpRange() BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter + // EthernetTagId returns uint32, set in BgpV6EviVxlanBroadcastDomain. + EthernetTagId() uint32 + // SetEthernetTagId assigns uint32 provided by user to BgpV6EviVxlanBroadcastDomain + SetEthernetTagId(value uint32) BgpV6EviVxlanBroadcastDomain + // HasEthernetTagId checks if EthernetTagId has been set in BgpV6EviVxlanBroadcastDomain + HasEthernetTagId() bool + // VlanAwareService returns bool, set in BgpV6EviVxlanBroadcastDomain. + VlanAwareService() bool + // SetVlanAwareService assigns bool provided by user to BgpV6EviVxlanBroadcastDomain + SetVlanAwareService(value bool) BgpV6EviVxlanBroadcastDomain + // HasVlanAwareService checks if VlanAwareService has been set in BgpV6EviVxlanBroadcastDomain + HasVlanAwareService() bool + setNil() +} + +// This contains the list of Customer MAC/IP Ranges to be configured per Broadcast Domain. +// +// Advertises following route - +// Type 2 - MAC/IP Advertisement Route. +// CmacIpRange returns a []BgpCMacIpRange +func (obj *bgpV6EviVxlanBroadcastDomain) CmacIpRange() BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { + if len(obj.obj.CmacIpRange) == 0 { + obj.obj.CmacIpRange = []*otg.BgpCMacIpRange{} + } + if obj.cmacIpRangeHolder == nil { + obj.cmacIpRangeHolder = newBgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter(&obj.obj.CmacIpRange).setMsg(obj) + } + return obj.cmacIpRangeHolder +} + +type bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter struct { + obj *bgpV6EviVxlanBroadcastDomain + bgpCMacIpRangeSlice []BgpCMacIpRange + fieldPtr *[]*otg.BgpCMacIpRange +} + +func newBgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter(ptr *[]*otg.BgpCMacIpRange) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { + return &bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter{fieldPtr: ptr} +} + +type BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter interface { + setMsg(*bgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter + Items() []BgpCMacIpRange + Add() BgpCMacIpRange + Append(items ...BgpCMacIpRange) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter + Set(index int, newObj BgpCMacIpRange) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter + Clear() BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter + clearHolderSlice() BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter + appendHolderSlice(item BgpCMacIpRange) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter +} + +func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) setMsg(msg *bgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpCMacIpRange{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) Items() []BgpCMacIpRange { + return obj.bgpCMacIpRangeSlice +} + +func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) Add() BgpCMacIpRange { + newObj := &otg.BgpCMacIpRange{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpCMacIpRange{obj: newObj} + newLibObj.setDefault() + obj.bgpCMacIpRangeSlice = append(obj.bgpCMacIpRangeSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) Append(items ...BgpCMacIpRange) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpCMacIpRangeSlice = append(obj.bgpCMacIpRangeSlice, item) + } + return obj +} + +func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) Set(index int, newObj BgpCMacIpRange) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpCMacIpRangeSlice[index] = newObj + return obj +} +func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) Clear() BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpCMacIpRange{} + obj.bgpCMacIpRangeSlice = []BgpCMacIpRange{} + } + return obj +} +func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) clearHolderSlice() BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { + if len(obj.bgpCMacIpRangeSlice) > 0 { + obj.bgpCMacIpRangeSlice = []BgpCMacIpRange{} + } + return obj +} +func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) appendHolderSlice(item BgpCMacIpRange) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { + obj.bgpCMacIpRangeSlice = append(obj.bgpCMacIpRangeSlice, item) + return obj +} + +// The Ethernet Tag ID of the Broadcast Domain. +// EthernetTagId returns a uint32 +func (obj *bgpV6EviVxlanBroadcastDomain) EthernetTagId() uint32 { + + return *obj.obj.EthernetTagId + +} + +// The Ethernet Tag ID of the Broadcast Domain. +// EthernetTagId returns a uint32 +func (obj *bgpV6EviVxlanBroadcastDomain) HasEthernetTagId() bool { + return obj.obj.EthernetTagId != nil +} + +// The Ethernet Tag ID of the Broadcast Domain. +// SetEthernetTagId sets the uint32 value in the BgpV6EviVxlanBroadcastDomain object +func (obj *bgpV6EviVxlanBroadcastDomain) SetEthernetTagId(value uint32) BgpV6EviVxlanBroadcastDomain { + + obj.obj.EthernetTagId = &value + return obj +} + +// VLAN-Aware service to be enabled or disabled. +// VlanAwareService returns a bool +func (obj *bgpV6EviVxlanBroadcastDomain) VlanAwareService() bool { + + return *obj.obj.VlanAwareService + +} + +// VLAN-Aware service to be enabled or disabled. +// VlanAwareService returns a bool +func (obj *bgpV6EviVxlanBroadcastDomain) HasVlanAwareService() bool { + return obj.obj.VlanAwareService != nil +} + +// VLAN-Aware service to be enabled or disabled. +// SetVlanAwareService sets the bool value in the BgpV6EviVxlanBroadcastDomain object +func (obj *bgpV6EviVxlanBroadcastDomain) SetVlanAwareService(value bool) BgpV6EviVxlanBroadcastDomain { + + obj.obj.VlanAwareService = &value + return obj +} + +func (obj *bgpV6EviVxlanBroadcastDomain) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.CmacIpRange) != 0 { + + if set_default { + obj.CmacIpRange().clearHolderSlice() + for _, item := range obj.obj.CmacIpRange { + obj.CmacIpRange().appendHolderSlice(&bgpCMacIpRange{obj: item}) + } + } + for _, item := range obj.CmacIpRange().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpV6EviVxlanBroadcastDomain) setDefault() { + if obj.obj.EthernetTagId == nil { + obj.SetEthernetTagId(0) + } + if obj.obj.VlanAwareService == nil { + obj.SetVlanAwareService(false) + } + +} diff --git a/gosnappi/bgp_v6_evpn_evis.go b/gosnappi/bgp_v6_evpn_evis.go new file mode 100644 index 00000000..08d50cfd --- /dev/null +++ b/gosnappi/bgp_v6_evpn_evis.go @@ -0,0 +1,410 @@ +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" +) + +// ***** BgpV6EvpnEvis ***** +type bgpV6EvpnEvis struct { + validation + obj *otg.BgpV6EvpnEvis + marshaller marshalBgpV6EvpnEvis + unMarshaller unMarshalBgpV6EvpnEvis + eviVxlanHolder BgpV6EviVxlan +} + +func NewBgpV6EvpnEvis() BgpV6EvpnEvis { + obj := bgpV6EvpnEvis{obj: &otg.BgpV6EvpnEvis{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV6EvpnEvis) msg() *otg.BgpV6EvpnEvis { + return obj.obj +} + +func (obj *bgpV6EvpnEvis) setMsg(msg *otg.BgpV6EvpnEvis) BgpV6EvpnEvis { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV6EvpnEvis struct { + obj *bgpV6EvpnEvis +} + +type marshalBgpV6EvpnEvis interface { + // ToProto marshals BgpV6EvpnEvis to protobuf object *otg.BgpV6EvpnEvis + ToProto() (*otg.BgpV6EvpnEvis, error) + // ToPbText marshals BgpV6EvpnEvis to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV6EvpnEvis to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV6EvpnEvis to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV6EvpnEvis struct { + obj *bgpV6EvpnEvis +} + +type unMarshalBgpV6EvpnEvis interface { + // FromProto unmarshals BgpV6EvpnEvis from protobuf object *otg.BgpV6EvpnEvis + FromProto(msg *otg.BgpV6EvpnEvis) (BgpV6EvpnEvis, error) + // FromPbText unmarshals BgpV6EvpnEvis from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV6EvpnEvis from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV6EvpnEvis from JSON text + FromJson(value string) error +} + +func (obj *bgpV6EvpnEvis) Marshal() marshalBgpV6EvpnEvis { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV6EvpnEvis{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV6EvpnEvis) Unmarshal() unMarshalBgpV6EvpnEvis { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV6EvpnEvis{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV6EvpnEvis) ToProto() (*otg.BgpV6EvpnEvis, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV6EvpnEvis) FromProto(msg *otg.BgpV6EvpnEvis) (BgpV6EvpnEvis, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV6EvpnEvis) 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 *unMarshalbgpV6EvpnEvis) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpV6EvpnEvis) 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 *unMarshalbgpV6EvpnEvis) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpV6EvpnEvis) 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 *unMarshalbgpV6EvpnEvis) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpV6EvpnEvis) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV6EvpnEvis) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV6EvpnEvis) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV6EvpnEvis) Clone() (BgpV6EvpnEvis, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV6EvpnEvis() + 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 +} + +func (obj *bgpV6EvpnEvis) setNil() { + obj.eviVxlanHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpV6EvpnEvis is this contains a list of different flavors of EVPN. +// For example EVPN over VXLAN or EVPN over MPLS etc to be configured per Ethernet segment. +// Need to instantiate correct type of EVPN instance as per requirement. +type BgpV6EvpnEvis interface { + Validation + // msg marshals BgpV6EvpnEvis to protobuf object *otg.BgpV6EvpnEvis + // and doesn't set defaults + msg() *otg.BgpV6EvpnEvis + // setMsg unmarshals BgpV6EvpnEvis from protobuf object *otg.BgpV6EvpnEvis + // and doesn't set defaults + setMsg(*otg.BgpV6EvpnEvis) BgpV6EvpnEvis + // provides marshal interface + Marshal() marshalBgpV6EvpnEvis + // provides unmarshal interface + Unmarshal() unMarshalBgpV6EvpnEvis + // validate validates BgpV6EvpnEvis + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV6EvpnEvis, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns BgpV6EvpnEvisChoiceEnum, set in BgpV6EvpnEvis + Choice() BgpV6EvpnEvisChoiceEnum + // setChoice assigns BgpV6EvpnEvisChoiceEnum provided by user to BgpV6EvpnEvis + setChoice(value BgpV6EvpnEvisChoiceEnum) BgpV6EvpnEvis + // HasChoice checks if Choice has been set in BgpV6EvpnEvis + HasChoice() bool + // EviVxlan returns BgpV6EviVxlan, set in BgpV6EvpnEvis. + // BgpV6EviVxlan is configuration for BGP EVPN EVI. Advertises following routes - + // + // # Type 3 - Inclusive Multicast Ethernet Tag Route + // + // Type 1 - Ethernet Auto-discovery Route (Per EVI) + // + // Type 1 - Ethernet Auto-discovery Route (Per ES) + EviVxlan() BgpV6EviVxlan + // SetEviVxlan assigns BgpV6EviVxlan provided by user to BgpV6EvpnEvis. + // BgpV6EviVxlan is configuration for BGP EVPN EVI. Advertises following routes - + // + // # Type 3 - Inclusive Multicast Ethernet Tag Route + // + // Type 1 - Ethernet Auto-discovery Route (Per EVI) + // + // Type 1 - Ethernet Auto-discovery Route (Per ES) + SetEviVxlan(value BgpV6EviVxlan) BgpV6EvpnEvis + // HasEviVxlan checks if EviVxlan has been set in BgpV6EvpnEvis + HasEviVxlan() bool + setNil() +} + +type BgpV6EvpnEvisChoiceEnum string + +// Enum of Choice on BgpV6EvpnEvis +var BgpV6EvpnEvisChoice = struct { + EVI_VXLAN BgpV6EvpnEvisChoiceEnum +}{ + EVI_VXLAN: BgpV6EvpnEvisChoiceEnum("evi_vxlan"), +} + +func (obj *bgpV6EvpnEvis) Choice() BgpV6EvpnEvisChoiceEnum { + return BgpV6EvpnEvisChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *bgpV6EvpnEvis) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *bgpV6EvpnEvis) setChoice(value BgpV6EvpnEvisChoiceEnum) BgpV6EvpnEvis { + intValue, ok := otg.BgpV6EvpnEvis_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpV6EvpnEvisChoiceEnum", string(value))) + return obj + } + enumValue := otg.BgpV6EvpnEvis_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.EviVxlan = nil + obj.eviVxlanHolder = nil + + if value == BgpV6EvpnEvisChoice.EVI_VXLAN { + obj.obj.EviVxlan = NewBgpV6EviVxlan().msg() + } + + return obj +} + +// EVPN VXLAN instance to be configured per Ethernet Segment. +// EviVxlan returns a BgpV6EviVxlan +func (obj *bgpV6EvpnEvis) EviVxlan() BgpV6EviVxlan { + if obj.obj.EviVxlan == nil { + obj.setChoice(BgpV6EvpnEvisChoice.EVI_VXLAN) + } + if obj.eviVxlanHolder == nil { + obj.eviVxlanHolder = &bgpV6EviVxlan{obj: obj.obj.EviVxlan} + } + return obj.eviVxlanHolder +} + +// EVPN VXLAN instance to be configured per Ethernet Segment. +// EviVxlan returns a BgpV6EviVxlan +func (obj *bgpV6EvpnEvis) HasEviVxlan() bool { + return obj.obj.EviVxlan != nil +} + +// EVPN VXLAN instance to be configured per Ethernet Segment. +// SetEviVxlan sets the BgpV6EviVxlan value in the BgpV6EvpnEvis object +func (obj *bgpV6EvpnEvis) SetEviVxlan(value BgpV6EviVxlan) BgpV6EvpnEvis { + obj.setChoice(BgpV6EvpnEvisChoice.EVI_VXLAN) + obj.eviVxlanHolder = nil + obj.obj.EviVxlan = value.msg() + + return obj +} + +func (obj *bgpV6EvpnEvis) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.EviVxlan != nil { + + obj.EviVxlan().validateObj(vObj, set_default) + } + +} + +func (obj *bgpV6EvpnEvis) setDefault() { + var choices_set int = 0 + var choice BgpV6EvpnEvisChoiceEnum + + if obj.obj.EviVxlan != nil { + choices_set += 1 + choice = BgpV6EvpnEvisChoice.EVI_VXLAN + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(BgpV6EvpnEvisChoice.EVI_VXLAN) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpV6EvpnEvis") + } + } else { + intVal := otg.BgpV6EvpnEvis_Choice_Enum_value[string(choice)] + enumValue := otg.BgpV6EvpnEvis_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/bgp_v6_interface.go b/gosnappi/bgp_v6_interface.go new file mode 100644 index 00000000..788e092c --- /dev/null +++ b/gosnappi/bgp_v6_interface.go @@ -0,0 +1,437 @@ +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" +) + +// ***** BgpV6Interface ***** +type bgpV6Interface struct { + validation + obj *otg.BgpV6Interface + marshaller marshalBgpV6Interface + unMarshaller unMarshalBgpV6Interface + peersHolder BgpV6InterfaceBgpV6PeerIter +} + +func NewBgpV6Interface() BgpV6Interface { + obj := bgpV6Interface{obj: &otg.BgpV6Interface{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV6Interface) msg() *otg.BgpV6Interface { + return obj.obj +} + +func (obj *bgpV6Interface) setMsg(msg *otg.BgpV6Interface) BgpV6Interface { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV6Interface struct { + obj *bgpV6Interface +} + +type marshalBgpV6Interface interface { + // ToProto marshals BgpV6Interface to protobuf object *otg.BgpV6Interface + ToProto() (*otg.BgpV6Interface, error) + // ToPbText marshals BgpV6Interface to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV6Interface to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV6Interface to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV6Interface struct { + obj *bgpV6Interface +} + +type unMarshalBgpV6Interface interface { + // FromProto unmarshals BgpV6Interface from protobuf object *otg.BgpV6Interface + FromProto(msg *otg.BgpV6Interface) (BgpV6Interface, error) + // FromPbText unmarshals BgpV6Interface from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV6Interface from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV6Interface from JSON text + FromJson(value string) error +} + +func (obj *bgpV6Interface) Marshal() marshalBgpV6Interface { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV6Interface{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV6Interface) Unmarshal() unMarshalBgpV6Interface { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV6Interface{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV6Interface) ToProto() (*otg.BgpV6Interface, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV6Interface) FromProto(msg *otg.BgpV6Interface) (BgpV6Interface, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV6Interface) 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 *unMarshalbgpV6Interface) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpV6Interface) 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 *unMarshalbgpV6Interface) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpV6Interface) 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 *unMarshalbgpV6Interface) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpV6Interface) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV6Interface) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV6Interface) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV6Interface) Clone() (BgpV6Interface, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV6Interface() + 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 +} + +func (obj *bgpV6Interface) setNil() { + obj.peersHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpV6Interface is configuration for emulated BGPv6 peers and routes on a single IPv6 interface. +type BgpV6Interface interface { + Validation + // msg marshals BgpV6Interface to protobuf object *otg.BgpV6Interface + // and doesn't set defaults + msg() *otg.BgpV6Interface + // setMsg unmarshals BgpV6Interface from protobuf object *otg.BgpV6Interface + // and doesn't set defaults + setMsg(*otg.BgpV6Interface) BgpV6Interface + // provides marshal interface + Marshal() marshalBgpV6Interface + // provides unmarshal interface + Unmarshal() unMarshalBgpV6Interface + // validate validates BgpV6Interface + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV6Interface, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv6Name returns string, set in BgpV6Interface. + Ipv6Name() string + // SetIpv6Name assigns string provided by user to BgpV6Interface + SetIpv6Name(value string) BgpV6Interface + // Peers returns BgpV6InterfaceBgpV6PeerIterIter, set in BgpV6Interface + Peers() BgpV6InterfaceBgpV6PeerIter + setNil() +} + +// The unique name of IPv6 Loopback IPv6 interface or DHCPv4 client used as the source IP for this list of BGP peers. +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Device.Ipv6Loopback/properties/name +// - /components/schemas/DhcpClient.V6/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Device.Ipv6Loopback/properties/name +// - /components/schemas/DhcpClient.V6/properties/name +// +// Ipv6Name returns a string +func (obj *bgpV6Interface) Ipv6Name() string { + + return *obj.obj.Ipv6Name + +} + +// The unique name of IPv6 Loopback IPv6 interface or DHCPv4 client used as the source IP for this list of BGP peers. +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Device.Ipv6Loopback/properties/name +// - /components/schemas/DhcpClient.V6/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Device.Ipv6Loopback/properties/name +// - /components/schemas/DhcpClient.V6/properties/name +// +// SetIpv6Name sets the string value in the BgpV6Interface object +func (obj *bgpV6Interface) SetIpv6Name(value string) BgpV6Interface { + + obj.obj.Ipv6Name = &value + return obj +} + +// This contains the list of BGPv6 peers configured on this interface. +// Peers returns a []BgpV6Peer +func (obj *bgpV6Interface) Peers() BgpV6InterfaceBgpV6PeerIter { + if len(obj.obj.Peers) == 0 { + obj.obj.Peers = []*otg.BgpV6Peer{} + } + if obj.peersHolder == nil { + obj.peersHolder = newBgpV6InterfaceBgpV6PeerIter(&obj.obj.Peers).setMsg(obj) + } + return obj.peersHolder +} + +type bgpV6InterfaceBgpV6PeerIter struct { + obj *bgpV6Interface + bgpV6PeerSlice []BgpV6Peer + fieldPtr *[]*otg.BgpV6Peer +} + +func newBgpV6InterfaceBgpV6PeerIter(ptr *[]*otg.BgpV6Peer) BgpV6InterfaceBgpV6PeerIter { + return &bgpV6InterfaceBgpV6PeerIter{fieldPtr: ptr} +} + +type BgpV6InterfaceBgpV6PeerIter interface { + setMsg(*bgpV6Interface) BgpV6InterfaceBgpV6PeerIter + Items() []BgpV6Peer + Add() BgpV6Peer + Append(items ...BgpV6Peer) BgpV6InterfaceBgpV6PeerIter + Set(index int, newObj BgpV6Peer) BgpV6InterfaceBgpV6PeerIter + Clear() BgpV6InterfaceBgpV6PeerIter + clearHolderSlice() BgpV6InterfaceBgpV6PeerIter + appendHolderSlice(item BgpV6Peer) BgpV6InterfaceBgpV6PeerIter +} + +func (obj *bgpV6InterfaceBgpV6PeerIter) setMsg(msg *bgpV6Interface) BgpV6InterfaceBgpV6PeerIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpV6Peer{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6InterfaceBgpV6PeerIter) Items() []BgpV6Peer { + return obj.bgpV6PeerSlice +} + +func (obj *bgpV6InterfaceBgpV6PeerIter) Add() BgpV6Peer { + newObj := &otg.BgpV6Peer{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpV6Peer{obj: newObj} + newLibObj.setDefault() + obj.bgpV6PeerSlice = append(obj.bgpV6PeerSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6InterfaceBgpV6PeerIter) Append(items ...BgpV6Peer) BgpV6InterfaceBgpV6PeerIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpV6PeerSlice = append(obj.bgpV6PeerSlice, item) + } + return obj +} + +func (obj *bgpV6InterfaceBgpV6PeerIter) Set(index int, newObj BgpV6Peer) BgpV6InterfaceBgpV6PeerIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpV6PeerSlice[index] = newObj + return obj +} +func (obj *bgpV6InterfaceBgpV6PeerIter) Clear() BgpV6InterfaceBgpV6PeerIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpV6Peer{} + obj.bgpV6PeerSlice = []BgpV6Peer{} + } + return obj +} +func (obj *bgpV6InterfaceBgpV6PeerIter) clearHolderSlice() BgpV6InterfaceBgpV6PeerIter { + if len(obj.bgpV6PeerSlice) > 0 { + obj.bgpV6PeerSlice = []BgpV6Peer{} + } + return obj +} +func (obj *bgpV6InterfaceBgpV6PeerIter) appendHolderSlice(item BgpV6Peer) BgpV6InterfaceBgpV6PeerIter { + obj.bgpV6PeerSlice = append(obj.bgpV6PeerSlice, item) + return obj +} + +func (obj *bgpV6Interface) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Ipv6Name is required + if obj.obj.Ipv6Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Ipv6Name is required field on interface BgpV6Interface") + } + + if len(obj.obj.Peers) != 0 { + + if set_default { + obj.Peers().clearHolderSlice() + for _, item := range obj.obj.Peers { + obj.Peers().appendHolderSlice(&bgpV6Peer{obj: item}) + } + } + for _, item := range obj.Peers().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpV6Interface) setDefault() { + +} diff --git a/gosnappi/bgp_v6_peer.go b/gosnappi/bgp_v6_peer.go new file mode 100644 index 00000000..40bad667 --- /dev/null +++ b/gosnappi/bgp_v6_peer.go @@ -0,0 +1,1248 @@ +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" +) + +// ***** BgpV6Peer ***** +type bgpV6Peer struct { + validation + obj *otg.BgpV6Peer + marshaller marshalBgpV6Peer + unMarshaller unMarshalBgpV6Peer + segmentRoutingHolder BgpV6SegmentRouting + evpnEthernetSegmentsHolder BgpV6PeerBgpV6EthernetSegmentIter + advancedHolder BgpAdvanced + capabilityHolder BgpCapability + learnedInformationFilterHolder BgpLearnedInformationFilter + v4RoutesHolder BgpV6PeerBgpV4RouteRangeIter + v6RoutesHolder BgpV6PeerBgpV6RouteRangeIter + v4SrtePoliciesHolder BgpV6PeerBgpSrteV4PolicyIter + v6SrtePoliciesHolder BgpV6PeerBgpSrteV6PolicyIter + gracefulRestartHolder BgpGracefulRestart + replayUpdatesHolder BgpUpdateReplay +} + +func NewBgpV6Peer() BgpV6Peer { + obj := bgpV6Peer{obj: &otg.BgpV6Peer{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV6Peer) msg() *otg.BgpV6Peer { + return obj.obj +} + +func (obj *bgpV6Peer) setMsg(msg *otg.BgpV6Peer) BgpV6Peer { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV6Peer struct { + obj *bgpV6Peer +} + +type marshalBgpV6Peer interface { + // ToProto marshals BgpV6Peer to protobuf object *otg.BgpV6Peer + ToProto() (*otg.BgpV6Peer, error) + // ToPbText marshals BgpV6Peer to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV6Peer to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV6Peer to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV6Peer struct { + obj *bgpV6Peer +} + +type unMarshalBgpV6Peer interface { + // FromProto unmarshals BgpV6Peer from protobuf object *otg.BgpV6Peer + FromProto(msg *otg.BgpV6Peer) (BgpV6Peer, error) + // FromPbText unmarshals BgpV6Peer from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV6Peer from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV6Peer from JSON text + FromJson(value string) error +} + +func (obj *bgpV6Peer) Marshal() marshalBgpV6Peer { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV6Peer{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV6Peer) Unmarshal() unMarshalBgpV6Peer { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV6Peer{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV6Peer) ToProto() (*otg.BgpV6Peer, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV6Peer) FromProto(msg *otg.BgpV6Peer) (BgpV6Peer, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV6Peer) 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 *unMarshalbgpV6Peer) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpV6Peer) 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 *unMarshalbgpV6Peer) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpV6Peer) 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 *unMarshalbgpV6Peer) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpV6Peer) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV6Peer) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV6Peer) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV6Peer) Clone() (BgpV6Peer, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV6Peer() + 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 +} + +func (obj *bgpV6Peer) setNil() { + obj.segmentRoutingHolder = nil + obj.evpnEthernetSegmentsHolder = nil + obj.advancedHolder = nil + obj.capabilityHolder = nil + obj.learnedInformationFilterHolder = nil + obj.v4RoutesHolder = nil + obj.v6RoutesHolder = nil + obj.v4SrtePoliciesHolder = nil + obj.v6SrtePoliciesHolder = nil + obj.gracefulRestartHolder = nil + obj.replayUpdatesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpV6Peer is configuration for BGPv6 peer settings and routes. +type BgpV6Peer interface { + Validation + // msg marshals BgpV6Peer to protobuf object *otg.BgpV6Peer + // and doesn't set defaults + msg() *otg.BgpV6Peer + // setMsg unmarshals BgpV6Peer from protobuf object *otg.BgpV6Peer + // and doesn't set defaults + setMsg(*otg.BgpV6Peer) BgpV6Peer + // provides marshal interface + Marshal() marshalBgpV6Peer + // provides unmarshal interface + Unmarshal() unMarshalBgpV6Peer + // validate validates BgpV6Peer + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV6Peer, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PeerAddress returns string, set in BgpV6Peer. + PeerAddress() string + // SetPeerAddress assigns string provided by user to BgpV6Peer + SetPeerAddress(value string) BgpV6Peer + // SegmentRouting returns BgpV6SegmentRouting, set in BgpV6Peer. + // BgpV6SegmentRouting is configuration for BGPv6 segment routing settings. + SegmentRouting() BgpV6SegmentRouting + // SetSegmentRouting assigns BgpV6SegmentRouting provided by user to BgpV6Peer. + // BgpV6SegmentRouting is configuration for BGPv6 segment routing settings. + SetSegmentRouting(value BgpV6SegmentRouting) BgpV6Peer + // HasSegmentRouting checks if SegmentRouting has been set in BgpV6Peer + HasSegmentRouting() bool + // EvpnEthernetSegments returns BgpV6PeerBgpV6EthernetSegmentIterIter, set in BgpV6Peer + EvpnEthernetSegments() BgpV6PeerBgpV6EthernetSegmentIter + // AsType returns BgpV6PeerAsTypeEnum, set in BgpV6Peer + AsType() BgpV6PeerAsTypeEnum + // SetAsType assigns BgpV6PeerAsTypeEnum provided by user to BgpV6Peer + SetAsType(value BgpV6PeerAsTypeEnum) BgpV6Peer + // AsNumber returns uint32, set in BgpV6Peer. + AsNumber() uint32 + // SetAsNumber assigns uint32 provided by user to BgpV6Peer + SetAsNumber(value uint32) BgpV6Peer + // AsNumberWidth returns BgpV6PeerAsNumberWidthEnum, set in BgpV6Peer + AsNumberWidth() BgpV6PeerAsNumberWidthEnum + // SetAsNumberWidth assigns BgpV6PeerAsNumberWidthEnum provided by user to BgpV6Peer + SetAsNumberWidth(value BgpV6PeerAsNumberWidthEnum) BgpV6Peer + // HasAsNumberWidth checks if AsNumberWidth has been set in BgpV6Peer + HasAsNumberWidth() bool + // Advanced returns BgpAdvanced, set in BgpV6Peer. + // BgpAdvanced is configuration for BGP advanced settings. + Advanced() BgpAdvanced + // SetAdvanced assigns BgpAdvanced provided by user to BgpV6Peer. + // BgpAdvanced is configuration for BGP advanced settings. + SetAdvanced(value BgpAdvanced) BgpV6Peer + // HasAdvanced checks if Advanced has been set in BgpV6Peer + HasAdvanced() bool + // Capability returns BgpCapability, set in BgpV6Peer. + // BgpCapability is configuration for BGP capability settings. + Capability() BgpCapability + // SetCapability assigns BgpCapability provided by user to BgpV6Peer. + // BgpCapability is configuration for BGP capability settings. + SetCapability(value BgpCapability) BgpV6Peer + // HasCapability checks if Capability has been set in BgpV6Peer + HasCapability() bool + // LearnedInformationFilter returns BgpLearnedInformationFilter, set in BgpV6Peer. + // BgpLearnedInformationFilter is configuration for controlling storage of BGP learned information recieved from the peer. + LearnedInformationFilter() BgpLearnedInformationFilter + // SetLearnedInformationFilter assigns BgpLearnedInformationFilter provided by user to BgpV6Peer. + // BgpLearnedInformationFilter is configuration for controlling storage of BGP learned information recieved from the peer. + SetLearnedInformationFilter(value BgpLearnedInformationFilter) BgpV6Peer + // HasLearnedInformationFilter checks if LearnedInformationFilter has been set in BgpV6Peer + HasLearnedInformationFilter() bool + // V4Routes returns BgpV6PeerBgpV4RouteRangeIterIter, set in BgpV6Peer + V4Routes() BgpV6PeerBgpV4RouteRangeIter + // V6Routes returns BgpV6PeerBgpV6RouteRangeIterIter, set in BgpV6Peer + V6Routes() BgpV6PeerBgpV6RouteRangeIter + // V4SrtePolicies returns BgpV6PeerBgpSrteV4PolicyIterIter, set in BgpV6Peer + V4SrtePolicies() BgpV6PeerBgpSrteV4PolicyIter + // V6SrtePolicies returns BgpV6PeerBgpSrteV6PolicyIterIter, set in BgpV6Peer + V6SrtePolicies() BgpV6PeerBgpSrteV6PolicyIter + // Name returns string, set in BgpV6Peer. + Name() string + // SetName assigns string provided by user to BgpV6Peer + SetName(value string) BgpV6Peer + // GracefulRestart returns BgpGracefulRestart, set in BgpV6Peer. + // BgpGracefulRestart is the Graceful Restart Capability (RFC 4724) is a BGP capability that can be used by a BGP speaker to indicate its ability to preserve its forwarding state during BGP restart. The Graceful Restart (GR) capability is advertised in OPEN messages sent between BGP peers. After a BGP session has been established, and the initial routing update has been completed, an End-of-RIB (Routing Information Base) marker is sent in an UPDATE message to convey information about routing convergence. + GracefulRestart() BgpGracefulRestart + // SetGracefulRestart assigns BgpGracefulRestart provided by user to BgpV6Peer. + // BgpGracefulRestart is the Graceful Restart Capability (RFC 4724) is a BGP capability that can be used by a BGP speaker to indicate its ability to preserve its forwarding state during BGP restart. The Graceful Restart (GR) capability is advertised in OPEN messages sent between BGP peers. After a BGP session has been established, and the initial routing update has been completed, an End-of-RIB (Routing Information Base) marker is sent in an UPDATE message to convey information about routing convergence. + SetGracefulRestart(value BgpGracefulRestart) BgpV6Peer + // HasGracefulRestart checks if GracefulRestart has been set in BgpV6Peer + HasGracefulRestart() bool + // ReplayUpdates returns BgpUpdateReplay, set in BgpV6Peer. + // BgpUpdateReplay is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. + ReplayUpdates() BgpUpdateReplay + // SetReplayUpdates assigns BgpUpdateReplay provided by user to BgpV6Peer. + // BgpUpdateReplay is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. + SetReplayUpdates(value BgpUpdateReplay) BgpV6Peer + // HasReplayUpdates checks if ReplayUpdates has been set in BgpV6Peer + HasReplayUpdates() bool + setNil() +} + +// IPv6 address of the BGP peer for the session +// PeerAddress returns a string +func (obj *bgpV6Peer) PeerAddress() string { + + return *obj.obj.PeerAddress + +} + +// IPv6 address of the BGP peer for the session +// SetPeerAddress sets the string value in the BgpV6Peer object +func (obj *bgpV6Peer) SetPeerAddress(value string) BgpV6Peer { + + obj.obj.PeerAddress = &value + return obj +} + +// description is TBD +// SegmentRouting returns a BgpV6SegmentRouting +func (obj *bgpV6Peer) SegmentRouting() BgpV6SegmentRouting { + if obj.obj.SegmentRouting == nil { + obj.obj.SegmentRouting = NewBgpV6SegmentRouting().msg() + } + if obj.segmentRoutingHolder == nil { + obj.segmentRoutingHolder = &bgpV6SegmentRouting{obj: obj.obj.SegmentRouting} + } + return obj.segmentRoutingHolder +} + +// description is TBD +// SegmentRouting returns a BgpV6SegmentRouting +func (obj *bgpV6Peer) HasSegmentRouting() bool { + return obj.obj.SegmentRouting != nil +} + +// description is TBD +// SetSegmentRouting sets the BgpV6SegmentRouting value in the BgpV6Peer object +func (obj *bgpV6Peer) SetSegmentRouting(value BgpV6SegmentRouting) BgpV6Peer { + + obj.segmentRoutingHolder = nil + obj.obj.SegmentRouting = value.msg() + + return obj +} + +// This contains the list of Ethernet Virtual Private Network (EVPN) Ethernet Segments (ES) Per BGP Peer for IPv6 Address Family Identifier (AFI). +// +// Each Ethernet Segment contains a list of EVPN Instances (EVIs) . +// Each EVI contains a list of Broadcast Domains. +// Each Broadcast Domain contains a list of MAC/IP Ranges. +// +// is responsible for advertising Ethernet Auto-discovery Route Per EVI (Type 1). +// +// is responsible for advertising Ethernet Auto-discovery Route Per Ethernet Segment (Type 1). +// +// is responsible for advertising MAC/IP Advertisement Route (Type 2). +// +// is responsible for advertising Inclusive Multicast Ethernet Tag Route (Type 3). +// +// Ethernet Segment is responsible for advertising Ethernet Segment Route (Type 4). +// EvpnEthernetSegments returns a []BgpV6EthernetSegment +func (obj *bgpV6Peer) EvpnEthernetSegments() BgpV6PeerBgpV6EthernetSegmentIter { + if len(obj.obj.EvpnEthernetSegments) == 0 { + obj.obj.EvpnEthernetSegments = []*otg.BgpV6EthernetSegment{} + } + if obj.evpnEthernetSegmentsHolder == nil { + obj.evpnEthernetSegmentsHolder = newBgpV6PeerBgpV6EthernetSegmentIter(&obj.obj.EvpnEthernetSegments).setMsg(obj) + } + return obj.evpnEthernetSegmentsHolder +} + +type bgpV6PeerBgpV6EthernetSegmentIter struct { + obj *bgpV6Peer + bgpV6EthernetSegmentSlice []BgpV6EthernetSegment + fieldPtr *[]*otg.BgpV6EthernetSegment +} + +func newBgpV6PeerBgpV6EthernetSegmentIter(ptr *[]*otg.BgpV6EthernetSegment) BgpV6PeerBgpV6EthernetSegmentIter { + return &bgpV6PeerBgpV6EthernetSegmentIter{fieldPtr: ptr} +} + +type BgpV6PeerBgpV6EthernetSegmentIter interface { + setMsg(*bgpV6Peer) BgpV6PeerBgpV6EthernetSegmentIter + Items() []BgpV6EthernetSegment + Add() BgpV6EthernetSegment + Append(items ...BgpV6EthernetSegment) BgpV6PeerBgpV6EthernetSegmentIter + Set(index int, newObj BgpV6EthernetSegment) BgpV6PeerBgpV6EthernetSegmentIter + Clear() BgpV6PeerBgpV6EthernetSegmentIter + clearHolderSlice() BgpV6PeerBgpV6EthernetSegmentIter + appendHolderSlice(item BgpV6EthernetSegment) BgpV6PeerBgpV6EthernetSegmentIter +} + +func (obj *bgpV6PeerBgpV6EthernetSegmentIter) setMsg(msg *bgpV6Peer) BgpV6PeerBgpV6EthernetSegmentIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpV6EthernetSegment{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6PeerBgpV6EthernetSegmentIter) Items() []BgpV6EthernetSegment { + return obj.bgpV6EthernetSegmentSlice +} + +func (obj *bgpV6PeerBgpV6EthernetSegmentIter) Add() BgpV6EthernetSegment { + newObj := &otg.BgpV6EthernetSegment{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpV6EthernetSegment{obj: newObj} + newLibObj.setDefault() + obj.bgpV6EthernetSegmentSlice = append(obj.bgpV6EthernetSegmentSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6PeerBgpV6EthernetSegmentIter) Append(items ...BgpV6EthernetSegment) BgpV6PeerBgpV6EthernetSegmentIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpV6EthernetSegmentSlice = append(obj.bgpV6EthernetSegmentSlice, item) + } + return obj +} + +func (obj *bgpV6PeerBgpV6EthernetSegmentIter) Set(index int, newObj BgpV6EthernetSegment) BgpV6PeerBgpV6EthernetSegmentIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpV6EthernetSegmentSlice[index] = newObj + return obj +} +func (obj *bgpV6PeerBgpV6EthernetSegmentIter) Clear() BgpV6PeerBgpV6EthernetSegmentIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpV6EthernetSegment{} + obj.bgpV6EthernetSegmentSlice = []BgpV6EthernetSegment{} + } + return obj +} +func (obj *bgpV6PeerBgpV6EthernetSegmentIter) clearHolderSlice() BgpV6PeerBgpV6EthernetSegmentIter { + if len(obj.bgpV6EthernetSegmentSlice) > 0 { + obj.bgpV6EthernetSegmentSlice = []BgpV6EthernetSegment{} + } + return obj +} +func (obj *bgpV6PeerBgpV6EthernetSegmentIter) appendHolderSlice(item BgpV6EthernetSegment) BgpV6PeerBgpV6EthernetSegmentIter { + obj.bgpV6EthernetSegmentSlice = append(obj.bgpV6EthernetSegmentSlice, item) + return obj +} + +type BgpV6PeerAsTypeEnum string + +// Enum of AsType on BgpV6Peer +var BgpV6PeerAsType = struct { + IBGP BgpV6PeerAsTypeEnum + EBGP BgpV6PeerAsTypeEnum +}{ + IBGP: BgpV6PeerAsTypeEnum("ibgp"), + EBGP: BgpV6PeerAsTypeEnum("ebgp"), +} + +func (obj *bgpV6Peer) AsType() BgpV6PeerAsTypeEnum { + return BgpV6PeerAsTypeEnum(obj.obj.AsType.Enum().String()) +} + +func (obj *bgpV6Peer) SetAsType(value BgpV6PeerAsTypeEnum) BgpV6Peer { + intValue, ok := otg.BgpV6Peer_AsType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpV6PeerAsTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpV6Peer_AsType_Enum(intValue) + obj.obj.AsType = &enumValue + + return obj +} + +// Autonomous System Number (AS number or ASN) +// AsNumber returns a uint32 +func (obj *bgpV6Peer) AsNumber() uint32 { + + return *obj.obj.AsNumber + +} + +// Autonomous System Number (AS number or ASN) +// SetAsNumber sets the uint32 value in the BgpV6Peer object +func (obj *bgpV6Peer) SetAsNumber(value uint32) BgpV6Peer { + + obj.obj.AsNumber = &value + return obj +} + +type BgpV6PeerAsNumberWidthEnum string + +// Enum of AsNumberWidth on BgpV6Peer +var BgpV6PeerAsNumberWidth = struct { + TWO BgpV6PeerAsNumberWidthEnum + FOUR BgpV6PeerAsNumberWidthEnum +}{ + TWO: BgpV6PeerAsNumberWidthEnum("two"), + FOUR: BgpV6PeerAsNumberWidthEnum("four"), +} + +func (obj *bgpV6Peer) AsNumberWidth() BgpV6PeerAsNumberWidthEnum { + return BgpV6PeerAsNumberWidthEnum(obj.obj.AsNumberWidth.Enum().String()) +} + +// The width in bytes of the as_number values. Any as_number values that exceeds the width MUST result in an error. +// AsNumberWidth returns a string +func (obj *bgpV6Peer) HasAsNumberWidth() bool { + return obj.obj.AsNumberWidth != nil +} + +func (obj *bgpV6Peer) SetAsNumberWidth(value BgpV6PeerAsNumberWidthEnum) BgpV6Peer { + intValue, ok := otg.BgpV6Peer_AsNumberWidth_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpV6PeerAsNumberWidthEnum", string(value))) + return obj + } + enumValue := otg.BgpV6Peer_AsNumberWidth_Enum(intValue) + obj.obj.AsNumberWidth = &enumValue + + return obj +} + +// description is TBD +// Advanced returns a BgpAdvanced +func (obj *bgpV6Peer) Advanced() BgpAdvanced { + if obj.obj.Advanced == nil { + obj.obj.Advanced = NewBgpAdvanced().msg() + } + if obj.advancedHolder == nil { + obj.advancedHolder = &bgpAdvanced{obj: obj.obj.Advanced} + } + return obj.advancedHolder +} + +// description is TBD +// Advanced returns a BgpAdvanced +func (obj *bgpV6Peer) HasAdvanced() bool { + return obj.obj.Advanced != nil +} + +// description is TBD +// SetAdvanced sets the BgpAdvanced value in the BgpV6Peer object +func (obj *bgpV6Peer) SetAdvanced(value BgpAdvanced) BgpV6Peer { + + obj.advancedHolder = nil + obj.obj.Advanced = value.msg() + + return obj +} + +// description is TBD +// Capability returns a BgpCapability +func (obj *bgpV6Peer) Capability() BgpCapability { + if obj.obj.Capability == nil { + obj.obj.Capability = NewBgpCapability().msg() + } + if obj.capabilityHolder == nil { + obj.capabilityHolder = &bgpCapability{obj: obj.obj.Capability} + } + return obj.capabilityHolder +} + +// description is TBD +// Capability returns a BgpCapability +func (obj *bgpV6Peer) HasCapability() bool { + return obj.obj.Capability != nil +} + +// description is TBD +// SetCapability sets the BgpCapability value in the BgpV6Peer object +func (obj *bgpV6Peer) SetCapability(value BgpCapability) BgpV6Peer { + + obj.capabilityHolder = nil + obj.obj.Capability = value.msg() + + return obj +} + +// description is TBD +// LearnedInformationFilter returns a BgpLearnedInformationFilter +func (obj *bgpV6Peer) LearnedInformationFilter() BgpLearnedInformationFilter { + if obj.obj.LearnedInformationFilter == nil { + obj.obj.LearnedInformationFilter = NewBgpLearnedInformationFilter().msg() + } + if obj.learnedInformationFilterHolder == nil { + obj.learnedInformationFilterHolder = &bgpLearnedInformationFilter{obj: obj.obj.LearnedInformationFilter} + } + return obj.learnedInformationFilterHolder +} + +// description is TBD +// LearnedInformationFilter returns a BgpLearnedInformationFilter +func (obj *bgpV6Peer) HasLearnedInformationFilter() bool { + return obj.obj.LearnedInformationFilter != nil +} + +// description is TBD +// SetLearnedInformationFilter sets the BgpLearnedInformationFilter value in the BgpV6Peer object +func (obj *bgpV6Peer) SetLearnedInformationFilter(value BgpLearnedInformationFilter) BgpV6Peer { + + obj.learnedInformationFilterHolder = nil + obj.obj.LearnedInformationFilter = value.msg() + + return obj +} + +// Emulated BGPv4 route ranges. +// V4Routes returns a []BgpV4RouteRange +func (obj *bgpV6Peer) V4Routes() BgpV6PeerBgpV4RouteRangeIter { + if len(obj.obj.V4Routes) == 0 { + obj.obj.V4Routes = []*otg.BgpV4RouteRange{} + } + if obj.v4RoutesHolder == nil { + obj.v4RoutesHolder = newBgpV6PeerBgpV4RouteRangeIter(&obj.obj.V4Routes).setMsg(obj) + } + return obj.v4RoutesHolder +} + +type bgpV6PeerBgpV4RouteRangeIter struct { + obj *bgpV6Peer + bgpV4RouteRangeSlice []BgpV4RouteRange + fieldPtr *[]*otg.BgpV4RouteRange +} + +func newBgpV6PeerBgpV4RouteRangeIter(ptr *[]*otg.BgpV4RouteRange) BgpV6PeerBgpV4RouteRangeIter { + return &bgpV6PeerBgpV4RouteRangeIter{fieldPtr: ptr} +} + +type BgpV6PeerBgpV4RouteRangeIter interface { + setMsg(*bgpV6Peer) BgpV6PeerBgpV4RouteRangeIter + Items() []BgpV4RouteRange + Add() BgpV4RouteRange + Append(items ...BgpV4RouteRange) BgpV6PeerBgpV4RouteRangeIter + Set(index int, newObj BgpV4RouteRange) BgpV6PeerBgpV4RouteRangeIter + Clear() BgpV6PeerBgpV4RouteRangeIter + clearHolderSlice() BgpV6PeerBgpV4RouteRangeIter + appendHolderSlice(item BgpV4RouteRange) BgpV6PeerBgpV4RouteRangeIter +} + +func (obj *bgpV6PeerBgpV4RouteRangeIter) setMsg(msg *bgpV6Peer) BgpV6PeerBgpV4RouteRangeIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpV4RouteRange{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6PeerBgpV4RouteRangeIter) Items() []BgpV4RouteRange { + return obj.bgpV4RouteRangeSlice +} + +func (obj *bgpV6PeerBgpV4RouteRangeIter) Add() BgpV4RouteRange { + newObj := &otg.BgpV4RouteRange{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpV4RouteRange{obj: newObj} + newLibObj.setDefault() + obj.bgpV4RouteRangeSlice = append(obj.bgpV4RouteRangeSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6PeerBgpV4RouteRangeIter) Append(items ...BgpV4RouteRange) BgpV6PeerBgpV4RouteRangeIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpV4RouteRangeSlice = append(obj.bgpV4RouteRangeSlice, item) + } + return obj +} + +func (obj *bgpV6PeerBgpV4RouteRangeIter) Set(index int, newObj BgpV4RouteRange) BgpV6PeerBgpV4RouteRangeIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpV4RouteRangeSlice[index] = newObj + return obj +} +func (obj *bgpV6PeerBgpV4RouteRangeIter) Clear() BgpV6PeerBgpV4RouteRangeIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpV4RouteRange{} + obj.bgpV4RouteRangeSlice = []BgpV4RouteRange{} + } + return obj +} +func (obj *bgpV6PeerBgpV4RouteRangeIter) clearHolderSlice() BgpV6PeerBgpV4RouteRangeIter { + if len(obj.bgpV4RouteRangeSlice) > 0 { + obj.bgpV4RouteRangeSlice = []BgpV4RouteRange{} + } + return obj +} +func (obj *bgpV6PeerBgpV4RouteRangeIter) appendHolderSlice(item BgpV4RouteRange) BgpV6PeerBgpV4RouteRangeIter { + obj.bgpV4RouteRangeSlice = append(obj.bgpV4RouteRangeSlice, item) + return obj +} + +// Emulated BGPv6 route ranges. +// V6Routes returns a []BgpV6RouteRange +func (obj *bgpV6Peer) V6Routes() BgpV6PeerBgpV6RouteRangeIter { + if len(obj.obj.V6Routes) == 0 { + obj.obj.V6Routes = []*otg.BgpV6RouteRange{} + } + if obj.v6RoutesHolder == nil { + obj.v6RoutesHolder = newBgpV6PeerBgpV6RouteRangeIter(&obj.obj.V6Routes).setMsg(obj) + } + return obj.v6RoutesHolder +} + +type bgpV6PeerBgpV6RouteRangeIter struct { + obj *bgpV6Peer + bgpV6RouteRangeSlice []BgpV6RouteRange + fieldPtr *[]*otg.BgpV6RouteRange +} + +func newBgpV6PeerBgpV6RouteRangeIter(ptr *[]*otg.BgpV6RouteRange) BgpV6PeerBgpV6RouteRangeIter { + return &bgpV6PeerBgpV6RouteRangeIter{fieldPtr: ptr} +} + +type BgpV6PeerBgpV6RouteRangeIter interface { + setMsg(*bgpV6Peer) BgpV6PeerBgpV6RouteRangeIter + Items() []BgpV6RouteRange + Add() BgpV6RouteRange + Append(items ...BgpV6RouteRange) BgpV6PeerBgpV6RouteRangeIter + Set(index int, newObj BgpV6RouteRange) BgpV6PeerBgpV6RouteRangeIter + Clear() BgpV6PeerBgpV6RouteRangeIter + clearHolderSlice() BgpV6PeerBgpV6RouteRangeIter + appendHolderSlice(item BgpV6RouteRange) BgpV6PeerBgpV6RouteRangeIter +} + +func (obj *bgpV6PeerBgpV6RouteRangeIter) setMsg(msg *bgpV6Peer) BgpV6PeerBgpV6RouteRangeIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpV6RouteRange{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6PeerBgpV6RouteRangeIter) Items() []BgpV6RouteRange { + return obj.bgpV6RouteRangeSlice +} + +func (obj *bgpV6PeerBgpV6RouteRangeIter) Add() BgpV6RouteRange { + newObj := &otg.BgpV6RouteRange{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpV6RouteRange{obj: newObj} + newLibObj.setDefault() + obj.bgpV6RouteRangeSlice = append(obj.bgpV6RouteRangeSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6PeerBgpV6RouteRangeIter) Append(items ...BgpV6RouteRange) BgpV6PeerBgpV6RouteRangeIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpV6RouteRangeSlice = append(obj.bgpV6RouteRangeSlice, item) + } + return obj +} + +func (obj *bgpV6PeerBgpV6RouteRangeIter) Set(index int, newObj BgpV6RouteRange) BgpV6PeerBgpV6RouteRangeIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpV6RouteRangeSlice[index] = newObj + return obj +} +func (obj *bgpV6PeerBgpV6RouteRangeIter) Clear() BgpV6PeerBgpV6RouteRangeIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpV6RouteRange{} + obj.bgpV6RouteRangeSlice = []BgpV6RouteRange{} + } + return obj +} +func (obj *bgpV6PeerBgpV6RouteRangeIter) clearHolderSlice() BgpV6PeerBgpV6RouteRangeIter { + if len(obj.bgpV6RouteRangeSlice) > 0 { + obj.bgpV6RouteRangeSlice = []BgpV6RouteRange{} + } + return obj +} +func (obj *bgpV6PeerBgpV6RouteRangeIter) appendHolderSlice(item BgpV6RouteRange) BgpV6PeerBgpV6RouteRangeIter { + obj.bgpV6RouteRangeSlice = append(obj.bgpV6RouteRangeSlice, item) + return obj +} + +// Segment Routing Traffic Engineering (SR TE) Policies for IPv4 Address Family Identifier (AFI). +// V4SrtePolicies returns a []BgpSrteV4Policy +func (obj *bgpV6Peer) V4SrtePolicies() BgpV6PeerBgpSrteV4PolicyIter { + if len(obj.obj.V4SrtePolicies) == 0 { + obj.obj.V4SrtePolicies = []*otg.BgpSrteV4Policy{} + } + if obj.v4SrtePoliciesHolder == nil { + obj.v4SrtePoliciesHolder = newBgpV6PeerBgpSrteV4PolicyIter(&obj.obj.V4SrtePolicies).setMsg(obj) + } + return obj.v4SrtePoliciesHolder +} + +type bgpV6PeerBgpSrteV4PolicyIter struct { + obj *bgpV6Peer + bgpSrteV4PolicySlice []BgpSrteV4Policy + fieldPtr *[]*otg.BgpSrteV4Policy +} + +func newBgpV6PeerBgpSrteV4PolicyIter(ptr *[]*otg.BgpSrteV4Policy) BgpV6PeerBgpSrteV4PolicyIter { + return &bgpV6PeerBgpSrteV4PolicyIter{fieldPtr: ptr} +} + +type BgpV6PeerBgpSrteV4PolicyIter interface { + setMsg(*bgpV6Peer) BgpV6PeerBgpSrteV4PolicyIter + Items() []BgpSrteV4Policy + Add() BgpSrteV4Policy + Append(items ...BgpSrteV4Policy) BgpV6PeerBgpSrteV4PolicyIter + Set(index int, newObj BgpSrteV4Policy) BgpV6PeerBgpSrteV4PolicyIter + Clear() BgpV6PeerBgpSrteV4PolicyIter + clearHolderSlice() BgpV6PeerBgpSrteV4PolicyIter + appendHolderSlice(item BgpSrteV4Policy) BgpV6PeerBgpSrteV4PolicyIter +} + +func (obj *bgpV6PeerBgpSrteV4PolicyIter) setMsg(msg *bgpV6Peer) BgpV6PeerBgpSrteV4PolicyIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpSrteV4Policy{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6PeerBgpSrteV4PolicyIter) Items() []BgpSrteV4Policy { + return obj.bgpSrteV4PolicySlice +} + +func (obj *bgpV6PeerBgpSrteV4PolicyIter) Add() BgpSrteV4Policy { + newObj := &otg.BgpSrteV4Policy{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpSrteV4Policy{obj: newObj} + newLibObj.setDefault() + obj.bgpSrteV4PolicySlice = append(obj.bgpSrteV4PolicySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6PeerBgpSrteV4PolicyIter) Append(items ...BgpSrteV4Policy) BgpV6PeerBgpSrteV4PolicyIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpSrteV4PolicySlice = append(obj.bgpSrteV4PolicySlice, item) + } + return obj +} + +func (obj *bgpV6PeerBgpSrteV4PolicyIter) Set(index int, newObj BgpSrteV4Policy) BgpV6PeerBgpSrteV4PolicyIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpSrteV4PolicySlice[index] = newObj + return obj +} +func (obj *bgpV6PeerBgpSrteV4PolicyIter) Clear() BgpV6PeerBgpSrteV4PolicyIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpSrteV4Policy{} + obj.bgpSrteV4PolicySlice = []BgpSrteV4Policy{} + } + return obj +} +func (obj *bgpV6PeerBgpSrteV4PolicyIter) clearHolderSlice() BgpV6PeerBgpSrteV4PolicyIter { + if len(obj.bgpSrteV4PolicySlice) > 0 { + obj.bgpSrteV4PolicySlice = []BgpSrteV4Policy{} + } + return obj +} +func (obj *bgpV6PeerBgpSrteV4PolicyIter) appendHolderSlice(item BgpSrteV4Policy) BgpV6PeerBgpSrteV4PolicyIter { + obj.bgpSrteV4PolicySlice = append(obj.bgpSrteV4PolicySlice, item) + return obj +} + +// Segment Routing Traffic Engineering (SR TE) Policies for IPv6 Address Family Identifier (AFI). +// V6SrtePolicies returns a []BgpSrteV6Policy +func (obj *bgpV6Peer) V6SrtePolicies() BgpV6PeerBgpSrteV6PolicyIter { + if len(obj.obj.V6SrtePolicies) == 0 { + obj.obj.V6SrtePolicies = []*otg.BgpSrteV6Policy{} + } + if obj.v6SrtePoliciesHolder == nil { + obj.v6SrtePoliciesHolder = newBgpV6PeerBgpSrteV6PolicyIter(&obj.obj.V6SrtePolicies).setMsg(obj) + } + return obj.v6SrtePoliciesHolder +} + +type bgpV6PeerBgpSrteV6PolicyIter struct { + obj *bgpV6Peer + bgpSrteV6PolicySlice []BgpSrteV6Policy + fieldPtr *[]*otg.BgpSrteV6Policy +} + +func newBgpV6PeerBgpSrteV6PolicyIter(ptr *[]*otg.BgpSrteV6Policy) BgpV6PeerBgpSrteV6PolicyIter { + return &bgpV6PeerBgpSrteV6PolicyIter{fieldPtr: ptr} +} + +type BgpV6PeerBgpSrteV6PolicyIter interface { + setMsg(*bgpV6Peer) BgpV6PeerBgpSrteV6PolicyIter + Items() []BgpSrteV6Policy + Add() BgpSrteV6Policy + Append(items ...BgpSrteV6Policy) BgpV6PeerBgpSrteV6PolicyIter + Set(index int, newObj BgpSrteV6Policy) BgpV6PeerBgpSrteV6PolicyIter + Clear() BgpV6PeerBgpSrteV6PolicyIter + clearHolderSlice() BgpV6PeerBgpSrteV6PolicyIter + appendHolderSlice(item BgpSrteV6Policy) BgpV6PeerBgpSrteV6PolicyIter +} + +func (obj *bgpV6PeerBgpSrteV6PolicyIter) setMsg(msg *bgpV6Peer) BgpV6PeerBgpSrteV6PolicyIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpSrteV6Policy{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6PeerBgpSrteV6PolicyIter) Items() []BgpSrteV6Policy { + return obj.bgpSrteV6PolicySlice +} + +func (obj *bgpV6PeerBgpSrteV6PolicyIter) Add() BgpSrteV6Policy { + newObj := &otg.BgpSrteV6Policy{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpSrteV6Policy{obj: newObj} + newLibObj.setDefault() + obj.bgpSrteV6PolicySlice = append(obj.bgpSrteV6PolicySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6PeerBgpSrteV6PolicyIter) Append(items ...BgpSrteV6Policy) BgpV6PeerBgpSrteV6PolicyIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpSrteV6PolicySlice = append(obj.bgpSrteV6PolicySlice, item) + } + return obj +} + +func (obj *bgpV6PeerBgpSrteV6PolicyIter) Set(index int, newObj BgpSrteV6Policy) BgpV6PeerBgpSrteV6PolicyIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpSrteV6PolicySlice[index] = newObj + return obj +} +func (obj *bgpV6PeerBgpSrteV6PolicyIter) Clear() BgpV6PeerBgpSrteV6PolicyIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpSrteV6Policy{} + obj.bgpSrteV6PolicySlice = []BgpSrteV6Policy{} + } + return obj +} +func (obj *bgpV6PeerBgpSrteV6PolicyIter) clearHolderSlice() BgpV6PeerBgpSrteV6PolicyIter { + if len(obj.bgpSrteV6PolicySlice) > 0 { + obj.bgpSrteV6PolicySlice = []BgpSrteV6Policy{} + } + return obj +} +func (obj *bgpV6PeerBgpSrteV6PolicyIter) appendHolderSlice(item BgpSrteV6Policy) BgpV6PeerBgpSrteV6PolicyIter { + obj.bgpSrteV6PolicySlice = append(obj.bgpSrteV6PolicySlice, item) + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *bgpV6Peer) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the BgpV6Peer object +func (obj *bgpV6Peer) SetName(value string) BgpV6Peer { + + obj.obj.Name = &value + return obj +} + +// description is TBD +// GracefulRestart returns a BgpGracefulRestart +func (obj *bgpV6Peer) GracefulRestart() BgpGracefulRestart { + if obj.obj.GracefulRestart == nil { + obj.obj.GracefulRestart = NewBgpGracefulRestart().msg() + } + if obj.gracefulRestartHolder == nil { + obj.gracefulRestartHolder = &bgpGracefulRestart{obj: obj.obj.GracefulRestart} + } + return obj.gracefulRestartHolder +} + +// description is TBD +// GracefulRestart returns a BgpGracefulRestart +func (obj *bgpV6Peer) HasGracefulRestart() bool { + return obj.obj.GracefulRestart != nil +} + +// description is TBD +// SetGracefulRestart sets the BgpGracefulRestart value in the BgpV6Peer object +func (obj *bgpV6Peer) SetGracefulRestart(value BgpGracefulRestart) BgpV6Peer { + + obj.gracefulRestartHolder = nil + obj.obj.GracefulRestart = value.msg() + + return obj +} + +// BGP Updates to be sent to the peer as specified after the session is established. +// ReplayUpdates returns a BgpUpdateReplay +func (obj *bgpV6Peer) ReplayUpdates() BgpUpdateReplay { + if obj.obj.ReplayUpdates == nil { + obj.obj.ReplayUpdates = NewBgpUpdateReplay().msg() + } + if obj.replayUpdatesHolder == nil { + obj.replayUpdatesHolder = &bgpUpdateReplay{obj: obj.obj.ReplayUpdates} + } + return obj.replayUpdatesHolder +} + +// BGP Updates to be sent to the peer as specified after the session is established. +// ReplayUpdates returns a BgpUpdateReplay +func (obj *bgpV6Peer) HasReplayUpdates() bool { + return obj.obj.ReplayUpdates != nil +} + +// BGP Updates to be sent to the peer as specified after the session is established. +// SetReplayUpdates sets the BgpUpdateReplay value in the BgpV6Peer object +func (obj *bgpV6Peer) SetReplayUpdates(value BgpUpdateReplay) BgpV6Peer { + + obj.replayUpdatesHolder = nil + obj.obj.ReplayUpdates = value.msg() + + return obj +} + +func (obj *bgpV6Peer) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // PeerAddress is required + if obj.obj.PeerAddress == nil { + vObj.validationErrors = append(vObj.validationErrors, "PeerAddress is required field on interface BgpV6Peer") + } + if obj.obj.PeerAddress != nil { + + err := obj.validateIpv6(obj.PeerAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV6Peer.PeerAddress")) + } + + } + + if obj.obj.SegmentRouting != nil { + + obj.SegmentRouting().validateObj(vObj, set_default) + } + + if len(obj.obj.EvpnEthernetSegments) != 0 { + + if set_default { + obj.EvpnEthernetSegments().clearHolderSlice() + for _, item := range obj.obj.EvpnEthernetSegments { + obj.EvpnEthernetSegments().appendHolderSlice(&bgpV6EthernetSegment{obj: item}) + } + } + for _, item := range obj.EvpnEthernetSegments().Items() { + item.validateObj(vObj, set_default) + } + + } + + // AsType is required + if obj.obj.AsType == nil { + vObj.validationErrors = append(vObj.validationErrors, "AsType is required field on interface BgpV6Peer") + } + + // AsNumber is required + if obj.obj.AsNumber == nil { + vObj.validationErrors = append(vObj.validationErrors, "AsNumber is required field on interface BgpV6Peer") + } + + if obj.obj.Advanced != nil { + + obj.Advanced().validateObj(vObj, set_default) + } + + if obj.obj.Capability != nil { + + obj.Capability().validateObj(vObj, set_default) + } + + if obj.obj.LearnedInformationFilter != nil { + + obj.LearnedInformationFilter().validateObj(vObj, set_default) + } + + if len(obj.obj.V4Routes) != 0 { + + if set_default { + obj.V4Routes().clearHolderSlice() + for _, item := range obj.obj.V4Routes { + obj.V4Routes().appendHolderSlice(&bgpV4RouteRange{obj: item}) + } + } + for _, item := range obj.V4Routes().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.V6Routes) != 0 { + + if set_default { + obj.V6Routes().clearHolderSlice() + for _, item := range obj.obj.V6Routes { + obj.V6Routes().appendHolderSlice(&bgpV6RouteRange{obj: item}) + } + } + for _, item := range obj.V6Routes().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.V4SrtePolicies) != 0 { + + if set_default { + obj.V4SrtePolicies().clearHolderSlice() + for _, item := range obj.obj.V4SrtePolicies { + obj.V4SrtePolicies().appendHolderSlice(&bgpSrteV4Policy{obj: item}) + } + } + for _, item := range obj.V4SrtePolicies().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.V6SrtePolicies) != 0 { + + if set_default { + obj.V6SrtePolicies().clearHolderSlice() + for _, item := range obj.obj.V6SrtePolicies { + obj.V6SrtePolicies().appendHolderSlice(&bgpSrteV6Policy{obj: item}) + } + } + for _, item := range obj.V6SrtePolicies().Items() { + item.validateObj(vObj, set_default) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpV6Peer") + } + + if obj.obj.GracefulRestart != nil { + + obj.GracefulRestart().validateObj(vObj, set_default) + } + + if obj.obj.ReplayUpdates != nil { + + obj.ReplayUpdates().validateObj(vObj, set_default) + } + +} + +func (obj *bgpV6Peer) setDefault() { + if obj.obj.AsNumberWidth == nil { + obj.SetAsNumberWidth(BgpV6PeerAsNumberWidth.FOUR) + + } + +} diff --git a/gosnappi/bgp_v6_route_range.go b/gosnappi/bgp_v6_route_range.go new file mode 100644 index 00000000..a8c0cd9c --- /dev/null +++ b/gosnappi/bgp_v6_route_range.go @@ -0,0 +1,1036 @@ +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" +) + +// ***** BgpV6RouteRange ***** +type bgpV6RouteRange struct { + validation + obj *otg.BgpV6RouteRange + marshaller marshalBgpV6RouteRange + unMarshaller unMarshalBgpV6RouteRange + addressesHolder BgpV6RouteRangeV6RouteAddressIter + advancedHolder BgpRouteAdvanced + communitiesHolder BgpV6RouteRangeBgpCommunityIter + asPathHolder BgpAsPath + addPathHolder BgpAddPath + extCommunitiesHolder BgpV6RouteRangeBgpExtCommunityIter + extendedCommunitiesHolder BgpV6RouteRangeBgpExtendedCommunityIter +} + +func NewBgpV6RouteRange() BgpV6RouteRange { + obj := bgpV6RouteRange{obj: &otg.BgpV6RouteRange{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV6RouteRange) msg() *otg.BgpV6RouteRange { + return obj.obj +} + +func (obj *bgpV6RouteRange) setMsg(msg *otg.BgpV6RouteRange) BgpV6RouteRange { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV6RouteRange struct { + obj *bgpV6RouteRange +} + +type marshalBgpV6RouteRange interface { + // ToProto marshals BgpV6RouteRange to protobuf object *otg.BgpV6RouteRange + ToProto() (*otg.BgpV6RouteRange, error) + // ToPbText marshals BgpV6RouteRange to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV6RouteRange to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV6RouteRange to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV6RouteRange struct { + obj *bgpV6RouteRange +} + +type unMarshalBgpV6RouteRange interface { + // FromProto unmarshals BgpV6RouteRange from protobuf object *otg.BgpV6RouteRange + FromProto(msg *otg.BgpV6RouteRange) (BgpV6RouteRange, error) + // FromPbText unmarshals BgpV6RouteRange from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV6RouteRange from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV6RouteRange from JSON text + FromJson(value string) error +} + +func (obj *bgpV6RouteRange) Marshal() marshalBgpV6RouteRange { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV6RouteRange{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV6RouteRange) Unmarshal() unMarshalBgpV6RouteRange { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV6RouteRange{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV6RouteRange) ToProto() (*otg.BgpV6RouteRange, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV6RouteRange) FromProto(msg *otg.BgpV6RouteRange) (BgpV6RouteRange, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV6RouteRange) 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 *unMarshalbgpV6RouteRange) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalbgpV6RouteRange) 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 *unMarshalbgpV6RouteRange) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalbgpV6RouteRange) 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 *unMarshalbgpV6RouteRange) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *bgpV6RouteRange) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV6RouteRange) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV6RouteRange) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV6RouteRange) Clone() (BgpV6RouteRange, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV6RouteRange() + 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 +} + +func (obj *bgpV6RouteRange) setNil() { + obj.addressesHolder = nil + obj.advancedHolder = nil + obj.communitiesHolder = nil + obj.asPathHolder = nil + obj.addPathHolder = nil + obj.extCommunitiesHolder = nil + obj.extendedCommunitiesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// BgpV6RouteRange is emulated BGPv6 route range. +type BgpV6RouteRange interface { + Validation + // msg marshals BgpV6RouteRange to protobuf object *otg.BgpV6RouteRange + // and doesn't set defaults + msg() *otg.BgpV6RouteRange + // setMsg unmarshals BgpV6RouteRange from protobuf object *otg.BgpV6RouteRange + // and doesn't set defaults + setMsg(*otg.BgpV6RouteRange) BgpV6RouteRange + // provides marshal interface + Marshal() marshalBgpV6RouteRange + // provides unmarshal interface + Unmarshal() unMarshalBgpV6RouteRange + // validate validates BgpV6RouteRange + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV6RouteRange, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Addresses returns BgpV6RouteRangeV6RouteAddressIterIter, set in BgpV6RouteRange + Addresses() BgpV6RouteRangeV6RouteAddressIter + // NextHopMode returns BgpV6RouteRangeNextHopModeEnum, set in BgpV6RouteRange + NextHopMode() BgpV6RouteRangeNextHopModeEnum + // SetNextHopMode assigns BgpV6RouteRangeNextHopModeEnum provided by user to BgpV6RouteRange + SetNextHopMode(value BgpV6RouteRangeNextHopModeEnum) BgpV6RouteRange + // HasNextHopMode checks if NextHopMode has been set in BgpV6RouteRange + HasNextHopMode() bool + // NextHopAddressType returns BgpV6RouteRangeNextHopAddressTypeEnum, set in BgpV6RouteRange + NextHopAddressType() BgpV6RouteRangeNextHopAddressTypeEnum + // SetNextHopAddressType assigns BgpV6RouteRangeNextHopAddressTypeEnum provided by user to BgpV6RouteRange + SetNextHopAddressType(value BgpV6RouteRangeNextHopAddressTypeEnum) BgpV6RouteRange + // HasNextHopAddressType checks if NextHopAddressType has been set in BgpV6RouteRange + HasNextHopAddressType() bool + // NextHopIpv4Address returns string, set in BgpV6RouteRange. + NextHopIpv4Address() string + // SetNextHopIpv4Address assigns string provided by user to BgpV6RouteRange + SetNextHopIpv4Address(value string) BgpV6RouteRange + // HasNextHopIpv4Address checks if NextHopIpv4Address has been set in BgpV6RouteRange + HasNextHopIpv4Address() bool + // NextHopIpv6Address returns string, set in BgpV6RouteRange. + NextHopIpv6Address() string + // SetNextHopIpv6Address assigns string provided by user to BgpV6RouteRange + SetNextHopIpv6Address(value string) BgpV6RouteRange + // HasNextHopIpv6Address checks if NextHopIpv6Address has been set in BgpV6RouteRange + HasNextHopIpv6Address() bool + // Advanced returns BgpRouteAdvanced, set in BgpV6RouteRange. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + Advanced() BgpRouteAdvanced + // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpV6RouteRange. + // BgpRouteAdvanced is configuration for advanced BGP route range settings. + SetAdvanced(value BgpRouteAdvanced) BgpV6RouteRange + // HasAdvanced checks if Advanced has been set in BgpV6RouteRange + HasAdvanced() bool + // Communities returns BgpV6RouteRangeBgpCommunityIterIter, set in BgpV6RouteRange + Communities() BgpV6RouteRangeBgpCommunityIter + // AsPath returns BgpAsPath, set in BgpV6RouteRange. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + AsPath() BgpAsPath + // SetAsPath assigns BgpAsPath provided by user to BgpV6RouteRange. + // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. + SetAsPath(value BgpAsPath) BgpV6RouteRange + // HasAsPath checks if AsPath has been set in BgpV6RouteRange + HasAsPath() bool + // AddPath returns BgpAddPath, set in BgpV6RouteRange. + // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. + AddPath() BgpAddPath + // SetAddPath assigns BgpAddPath provided by user to BgpV6RouteRange. + // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. + SetAddPath(value BgpAddPath) BgpV6RouteRange + // HasAddPath checks if AddPath has been set in BgpV6RouteRange + HasAddPath() bool + // Name returns string, set in BgpV6RouteRange. + Name() string + // SetName assigns string provided by user to BgpV6RouteRange + SetName(value string) BgpV6RouteRange + // ExtCommunities returns BgpV6RouteRangeBgpExtCommunityIterIter, set in BgpV6RouteRange + ExtCommunities() BgpV6RouteRangeBgpExtCommunityIter + // ExtendedCommunities returns BgpV6RouteRangeBgpExtendedCommunityIterIter, set in BgpV6RouteRange + ExtendedCommunities() BgpV6RouteRangeBgpExtendedCommunityIter + setNil() +} + +// A list of group of IPv6 route addresses. +// Addresses returns a []V6RouteAddress +func (obj *bgpV6RouteRange) Addresses() BgpV6RouteRangeV6RouteAddressIter { + if len(obj.obj.Addresses) == 0 { + obj.obj.Addresses = []*otg.V6RouteAddress{} + } + if obj.addressesHolder == nil { + obj.addressesHolder = newBgpV6RouteRangeV6RouteAddressIter(&obj.obj.Addresses).setMsg(obj) + } + return obj.addressesHolder +} + +type bgpV6RouteRangeV6RouteAddressIter struct { + obj *bgpV6RouteRange + v6RouteAddressSlice []V6RouteAddress + fieldPtr *[]*otg.V6RouteAddress +} + +func newBgpV6RouteRangeV6RouteAddressIter(ptr *[]*otg.V6RouteAddress) BgpV6RouteRangeV6RouteAddressIter { + return &bgpV6RouteRangeV6RouteAddressIter{fieldPtr: ptr} +} + +type BgpV6RouteRangeV6RouteAddressIter interface { + setMsg(*bgpV6RouteRange) BgpV6RouteRangeV6RouteAddressIter + Items() []V6RouteAddress + Add() V6RouteAddress + Append(items ...V6RouteAddress) BgpV6RouteRangeV6RouteAddressIter + Set(index int, newObj V6RouteAddress) BgpV6RouteRangeV6RouteAddressIter + Clear() BgpV6RouteRangeV6RouteAddressIter + clearHolderSlice() BgpV6RouteRangeV6RouteAddressIter + appendHolderSlice(item V6RouteAddress) BgpV6RouteRangeV6RouteAddressIter +} + +func (obj *bgpV6RouteRangeV6RouteAddressIter) setMsg(msg *bgpV6RouteRange) BgpV6RouteRangeV6RouteAddressIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&v6RouteAddress{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6RouteRangeV6RouteAddressIter) Items() []V6RouteAddress { + return obj.v6RouteAddressSlice +} + +func (obj *bgpV6RouteRangeV6RouteAddressIter) Add() V6RouteAddress { + newObj := &otg.V6RouteAddress{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &v6RouteAddress{obj: newObj} + newLibObj.setDefault() + obj.v6RouteAddressSlice = append(obj.v6RouteAddressSlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6RouteRangeV6RouteAddressIter) Append(items ...V6RouteAddress) BgpV6RouteRangeV6RouteAddressIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.v6RouteAddressSlice = append(obj.v6RouteAddressSlice, item) + } + return obj +} + +func (obj *bgpV6RouteRangeV6RouteAddressIter) Set(index int, newObj V6RouteAddress) BgpV6RouteRangeV6RouteAddressIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.v6RouteAddressSlice[index] = newObj + return obj +} +func (obj *bgpV6RouteRangeV6RouteAddressIter) Clear() BgpV6RouteRangeV6RouteAddressIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.V6RouteAddress{} + obj.v6RouteAddressSlice = []V6RouteAddress{} + } + return obj +} +func (obj *bgpV6RouteRangeV6RouteAddressIter) clearHolderSlice() BgpV6RouteRangeV6RouteAddressIter { + if len(obj.v6RouteAddressSlice) > 0 { + obj.v6RouteAddressSlice = []V6RouteAddress{} + } + return obj +} +func (obj *bgpV6RouteRangeV6RouteAddressIter) appendHolderSlice(item V6RouteAddress) BgpV6RouteRangeV6RouteAddressIter { + obj.v6RouteAddressSlice = append(obj.v6RouteAddressSlice, item) + return obj +} + +type BgpV6RouteRangeNextHopModeEnum string + +// Enum of NextHopMode on BgpV6RouteRange +var BgpV6RouteRangeNextHopMode = struct { + LOCAL_IP BgpV6RouteRangeNextHopModeEnum + MANUAL BgpV6RouteRangeNextHopModeEnum +}{ + LOCAL_IP: BgpV6RouteRangeNextHopModeEnum("local_ip"), + MANUAL: BgpV6RouteRangeNextHopModeEnum("manual"), +} + +func (obj *bgpV6RouteRange) NextHopMode() BgpV6RouteRangeNextHopModeEnum { + return BgpV6RouteRangeNextHopModeEnum(obj.obj.NextHopMode.Enum().String()) +} + +// Specify the NextHop in MP REACH NLRI. The mode for setting the IP address of the NextHop in the MP REACH NLRI can be one of the following: +// Local IP: Automatically fills the Nexthop with the Local IP of the BGP +// peer. +// If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. +// Manual: Override the Nexthop with any arbitrary IPv4/IPv6 address. +// NextHopMode returns a string +func (obj *bgpV6RouteRange) HasNextHopMode() bool { + return obj.obj.NextHopMode != nil +} + +func (obj *bgpV6RouteRange) SetNextHopMode(value BgpV6RouteRangeNextHopModeEnum) BgpV6RouteRange { + intValue, ok := otg.BgpV6RouteRange_NextHopMode_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpV6RouteRangeNextHopModeEnum", string(value))) + return obj + } + enumValue := otg.BgpV6RouteRange_NextHopMode_Enum(intValue) + obj.obj.NextHopMode = &enumValue + + return obj +} + +type BgpV6RouteRangeNextHopAddressTypeEnum string + +// Enum of NextHopAddressType on BgpV6RouteRange +var BgpV6RouteRangeNextHopAddressType = struct { + IPV4 BgpV6RouteRangeNextHopAddressTypeEnum + IPV6 BgpV6RouteRangeNextHopAddressTypeEnum +}{ + IPV4: BgpV6RouteRangeNextHopAddressTypeEnum("ipv4"), + IPV6: BgpV6RouteRangeNextHopAddressTypeEnum("ipv6"), +} + +func (obj *bgpV6RouteRange) NextHopAddressType() BgpV6RouteRangeNextHopAddressTypeEnum { + return BgpV6RouteRangeNextHopAddressTypeEnum(obj.obj.NextHopAddressType.Enum().String()) +} + +// If the Nexthop Mode is Manual, it sets the type of the NextHop IP address. +// NextHopAddressType returns a string +func (obj *bgpV6RouteRange) HasNextHopAddressType() bool { + return obj.obj.NextHopAddressType != nil +} + +func (obj *bgpV6RouteRange) SetNextHopAddressType(value BgpV6RouteRangeNextHopAddressTypeEnum) BgpV6RouteRange { + intValue, ok := otg.BgpV6RouteRange_NextHopAddressType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on BgpV6RouteRangeNextHopAddressTypeEnum", string(value))) + return obj + } + enumValue := otg.BgpV6RouteRange_NextHopAddressType_Enum(intValue) + obj.obj.NextHopAddressType = &enumValue + + return obj +} + +// The IPv4 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. +// NextHopIpv4Address returns a string +func (obj *bgpV6RouteRange) NextHopIpv4Address() string { + + return *obj.obj.NextHopIpv4Address + +} + +// The IPv4 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. +// NextHopIpv4Address returns a string +func (obj *bgpV6RouteRange) HasNextHopIpv4Address() bool { + return obj.obj.NextHopIpv4Address != nil +} + +// The IPv4 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. +// SetNextHopIpv4Address sets the string value in the BgpV6RouteRange object +func (obj *bgpV6RouteRange) SetNextHopIpv4Address(value string) BgpV6RouteRange { + + obj.obj.NextHopIpv4Address = &value + return obj +} + +// The IPv6 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv6. +// NextHopIpv6Address returns a string +func (obj *bgpV6RouteRange) NextHopIpv6Address() string { + + return *obj.obj.NextHopIpv6Address + +} + +// The IPv6 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv6. +// NextHopIpv6Address returns a string +func (obj *bgpV6RouteRange) HasNextHopIpv6Address() bool { + return obj.obj.NextHopIpv6Address != nil +} + +// The IPv6 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv6. +// SetNextHopIpv6Address sets the string value in the BgpV6RouteRange object +func (obj *bgpV6RouteRange) SetNextHopIpv6Address(value string) BgpV6RouteRange { + + obj.obj.NextHopIpv6Address = &value + return obj +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpV6RouteRange) Advanced() BgpRouteAdvanced { + if obj.obj.Advanced == nil { + obj.obj.Advanced = NewBgpRouteAdvanced().msg() + } + if obj.advancedHolder == nil { + obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} + } + return obj.advancedHolder +} + +// description is TBD +// Advanced returns a BgpRouteAdvanced +func (obj *bgpV6RouteRange) HasAdvanced() bool { + return obj.obj.Advanced != nil +} + +// description is TBD +// SetAdvanced sets the BgpRouteAdvanced value in the BgpV6RouteRange object +func (obj *bgpV6RouteRange) SetAdvanced(value BgpRouteAdvanced) BgpV6RouteRange { + + obj.advancedHolder = nil + obj.obj.Advanced = value.msg() + + return obj +} + +// Optional community settings. +// Communities returns a []BgpCommunity +func (obj *bgpV6RouteRange) Communities() BgpV6RouteRangeBgpCommunityIter { + if len(obj.obj.Communities) == 0 { + obj.obj.Communities = []*otg.BgpCommunity{} + } + if obj.communitiesHolder == nil { + obj.communitiesHolder = newBgpV6RouteRangeBgpCommunityIter(&obj.obj.Communities).setMsg(obj) + } + return obj.communitiesHolder +} + +type bgpV6RouteRangeBgpCommunityIter struct { + obj *bgpV6RouteRange + bgpCommunitySlice []BgpCommunity + fieldPtr *[]*otg.BgpCommunity +} + +func newBgpV6RouteRangeBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpV6RouteRangeBgpCommunityIter { + return &bgpV6RouteRangeBgpCommunityIter{fieldPtr: ptr} +} + +type BgpV6RouteRangeBgpCommunityIter interface { + setMsg(*bgpV6RouteRange) BgpV6RouteRangeBgpCommunityIter + Items() []BgpCommunity + Add() BgpCommunity + Append(items ...BgpCommunity) BgpV6RouteRangeBgpCommunityIter + Set(index int, newObj BgpCommunity) BgpV6RouteRangeBgpCommunityIter + Clear() BgpV6RouteRangeBgpCommunityIter + clearHolderSlice() BgpV6RouteRangeBgpCommunityIter + appendHolderSlice(item BgpCommunity) BgpV6RouteRangeBgpCommunityIter +} + +func (obj *bgpV6RouteRangeBgpCommunityIter) setMsg(msg *bgpV6RouteRange) BgpV6RouteRangeBgpCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6RouteRangeBgpCommunityIter) Items() []BgpCommunity { + return obj.bgpCommunitySlice +} + +func (obj *bgpV6RouteRangeBgpCommunityIter) Add() BgpCommunity { + newObj := &otg.BgpCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6RouteRangeBgpCommunityIter) Append(items ...BgpCommunity) BgpV6RouteRangeBgpCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + } + return obj +} + +func (obj *bgpV6RouteRangeBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpV6RouteRangeBgpCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpCommunitySlice[index] = newObj + return obj +} +func (obj *bgpV6RouteRangeBgpCommunityIter) Clear() BgpV6RouteRangeBgpCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpCommunity{} + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpV6RouteRangeBgpCommunityIter) clearHolderSlice() BgpV6RouteRangeBgpCommunityIter { + if len(obj.bgpCommunitySlice) > 0 { + obj.bgpCommunitySlice = []BgpCommunity{} + } + return obj +} +func (obj *bgpV6RouteRangeBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpV6RouteRangeBgpCommunityIter { + obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) + return obj +} + +// description is TBD +// AsPath returns a BgpAsPath +func (obj *bgpV6RouteRange) AsPath() BgpAsPath { + if obj.obj.AsPath == nil { + obj.obj.AsPath = NewBgpAsPath().msg() + } + if obj.asPathHolder == nil { + obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} + } + return obj.asPathHolder +} + +// description is TBD +// AsPath returns a BgpAsPath +func (obj *bgpV6RouteRange) HasAsPath() bool { + return obj.obj.AsPath != nil +} + +// description is TBD +// SetAsPath sets the BgpAsPath value in the BgpV6RouteRange object +func (obj *bgpV6RouteRange) SetAsPath(value BgpAsPath) BgpV6RouteRange { + + obj.asPathHolder = nil + obj.obj.AsPath = value.msg() + + return obj +} + +// description is TBD +// AddPath returns a BgpAddPath +func (obj *bgpV6RouteRange) AddPath() BgpAddPath { + if obj.obj.AddPath == nil { + obj.obj.AddPath = NewBgpAddPath().msg() + } + if obj.addPathHolder == nil { + obj.addPathHolder = &bgpAddPath{obj: obj.obj.AddPath} + } + return obj.addPathHolder +} + +// description is TBD +// AddPath returns a BgpAddPath +func (obj *bgpV6RouteRange) HasAddPath() bool { + return obj.obj.AddPath != nil +} + +// description is TBD +// SetAddPath sets the BgpAddPath value in the BgpV6RouteRange object +func (obj *bgpV6RouteRange) SetAddPath(value BgpAddPath) BgpV6RouteRange { + + obj.addPathHolder = nil + obj.obj.AddPath = value.msg() + + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *bgpV6RouteRange) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the BgpV6RouteRange object +func (obj *bgpV6RouteRange) SetName(value string) BgpV6RouteRange { + + obj.obj.Name = &value + return obj +} + +// Deprecated: This property is deprecated in favor of property extended_communities +// +// Deprecated: This property is deprecated in favor of property extended_communities +// +// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. Note evpn type is defined mainly for use with evpn route updates and not for IPv4 and IPv6 route updates. +// ExtCommunities returns a []BgpExtCommunity +func (obj *bgpV6RouteRange) ExtCommunities() BgpV6RouteRangeBgpExtCommunityIter { + if len(obj.obj.ExtCommunities) == 0 { + obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} + } + if obj.extCommunitiesHolder == nil { + obj.extCommunitiesHolder = newBgpV6RouteRangeBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) + } + return obj.extCommunitiesHolder +} + +type bgpV6RouteRangeBgpExtCommunityIter struct { + obj *bgpV6RouteRange + bgpExtCommunitySlice []BgpExtCommunity + fieldPtr *[]*otg.BgpExtCommunity +} + +func newBgpV6RouteRangeBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpV6RouteRangeBgpExtCommunityIter { + return &bgpV6RouteRangeBgpExtCommunityIter{fieldPtr: ptr} +} + +type BgpV6RouteRangeBgpExtCommunityIter interface { + setMsg(*bgpV6RouteRange) BgpV6RouteRangeBgpExtCommunityIter + Items() []BgpExtCommunity + Add() BgpExtCommunity + Append(items ...BgpExtCommunity) BgpV6RouteRangeBgpExtCommunityIter + Set(index int, newObj BgpExtCommunity) BgpV6RouteRangeBgpExtCommunityIter + Clear() BgpV6RouteRangeBgpExtCommunityIter + clearHolderSlice() BgpV6RouteRangeBgpExtCommunityIter + appendHolderSlice(item BgpExtCommunity) BgpV6RouteRangeBgpExtCommunityIter +} + +func (obj *bgpV6RouteRangeBgpExtCommunityIter) setMsg(msg *bgpV6RouteRange) BgpV6RouteRangeBgpExtCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpExtCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6RouteRangeBgpExtCommunityIter) Items() []BgpExtCommunity { + return obj.bgpExtCommunitySlice +} + +func (obj *bgpV6RouteRangeBgpExtCommunityIter) Add() BgpExtCommunity { + newObj := &otg.BgpExtCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpExtCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6RouteRangeBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpV6RouteRangeBgpExtCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + } + return obj +} + +func (obj *bgpV6RouteRangeBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpV6RouteRangeBgpExtCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpExtCommunitySlice[index] = newObj + return obj +} +func (obj *bgpV6RouteRangeBgpExtCommunityIter) Clear() BgpV6RouteRangeBgpExtCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpExtCommunity{} + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpV6RouteRangeBgpExtCommunityIter) clearHolderSlice() BgpV6RouteRangeBgpExtCommunityIter { + if len(obj.bgpExtCommunitySlice) > 0 { + obj.bgpExtCommunitySlice = []BgpExtCommunity{} + } + return obj +} +func (obj *bgpV6RouteRangeBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpV6RouteRangeBgpExtCommunityIter { + obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) + return obj +} + +// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an eight byte value. It is divided into two main parts. The first two bytes of the community encode a type and sub-type fields and the last six bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. +// ExtendedCommunities returns a []BgpExtendedCommunity +func (obj *bgpV6RouteRange) ExtendedCommunities() BgpV6RouteRangeBgpExtendedCommunityIter { + if len(obj.obj.ExtendedCommunities) == 0 { + obj.obj.ExtendedCommunities = []*otg.BgpExtendedCommunity{} + } + if obj.extendedCommunitiesHolder == nil { + obj.extendedCommunitiesHolder = newBgpV6RouteRangeBgpExtendedCommunityIter(&obj.obj.ExtendedCommunities).setMsg(obj) + } + return obj.extendedCommunitiesHolder +} + +type bgpV6RouteRangeBgpExtendedCommunityIter struct { + obj *bgpV6RouteRange + bgpExtendedCommunitySlice []BgpExtendedCommunity + fieldPtr *[]*otg.BgpExtendedCommunity +} + +func newBgpV6RouteRangeBgpExtendedCommunityIter(ptr *[]*otg.BgpExtendedCommunity) BgpV6RouteRangeBgpExtendedCommunityIter { + return &bgpV6RouteRangeBgpExtendedCommunityIter{fieldPtr: ptr} +} + +type BgpV6RouteRangeBgpExtendedCommunityIter interface { + setMsg(*bgpV6RouteRange) BgpV6RouteRangeBgpExtendedCommunityIter + Items() []BgpExtendedCommunity + Add() BgpExtendedCommunity + Append(items ...BgpExtendedCommunity) BgpV6RouteRangeBgpExtendedCommunityIter + Set(index int, newObj BgpExtendedCommunity) BgpV6RouteRangeBgpExtendedCommunityIter + Clear() BgpV6RouteRangeBgpExtendedCommunityIter + clearHolderSlice() BgpV6RouteRangeBgpExtendedCommunityIter + appendHolderSlice(item BgpExtendedCommunity) BgpV6RouteRangeBgpExtendedCommunityIter +} + +func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) setMsg(msg *bgpV6RouteRange) BgpV6RouteRangeBgpExtendedCommunityIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpExtendedCommunity{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) Items() []BgpExtendedCommunity { + return obj.bgpExtendedCommunitySlice +} + +func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) Add() BgpExtendedCommunity { + newObj := &otg.BgpExtendedCommunity{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpExtendedCommunity{obj: newObj} + newLibObj.setDefault() + obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, newLibObj) + return newLibObj +} + +func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) Append(items ...BgpExtendedCommunity) BgpV6RouteRangeBgpExtendedCommunityIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, item) + } + return obj +} + +func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) Set(index int, newObj BgpExtendedCommunity) BgpV6RouteRangeBgpExtendedCommunityIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpExtendedCommunitySlice[index] = newObj + return obj +} +func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) Clear() BgpV6RouteRangeBgpExtendedCommunityIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpExtendedCommunity{} + obj.bgpExtendedCommunitySlice = []BgpExtendedCommunity{} + } + return obj +} +func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) clearHolderSlice() BgpV6RouteRangeBgpExtendedCommunityIter { + if len(obj.bgpExtendedCommunitySlice) > 0 { + obj.bgpExtendedCommunitySlice = []BgpExtendedCommunity{} + } + return obj +} +func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) appendHolderSlice(item BgpExtendedCommunity) BgpV6RouteRangeBgpExtendedCommunityIter { + obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, item) + return obj +} + +func (obj *bgpV6RouteRange) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Addresses) != 0 { + + if set_default { + obj.Addresses().clearHolderSlice() + for _, item := range obj.obj.Addresses { + obj.Addresses().appendHolderSlice(&v6RouteAddress{obj: item}) + } + } + for _, item := range obj.Addresses().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.NextHopIpv4Address != nil { + + err := obj.validateIpv4(obj.NextHopIpv4Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV6RouteRange.NextHopIpv4Address")) + } + + } + + if obj.obj.NextHopIpv6Address != nil { + + err := obj.validateIpv6(obj.NextHopIpv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV6RouteRange.NextHopIpv6Address")) + } + + } + + if obj.obj.Advanced != nil { + + obj.Advanced().validateObj(vObj, set_default) + } + + if len(obj.obj.Communities) != 0 { + + if set_default { + obj.Communities().clearHolderSlice() + for _, item := range obj.obj.Communities { + obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) + } + } + for _, item := range obj.Communities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.AsPath != nil { + + obj.AsPath().validateObj(vObj, set_default) + } + + if obj.obj.AddPath != nil { + + obj.AddPath().validateObj(vObj, set_default) + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpV6RouteRange") + } + + if len(obj.obj.ExtCommunities) != 0 { + obj.addWarnings("ExtCommunities property in schema BgpV6RouteRange is deprecated, This property is deprecated in favor of property extended_communities") + + if set_default { + obj.ExtCommunities().clearHolderSlice() + for _, item := range obj.obj.ExtCommunities { + obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) + } + } + for _, item := range obj.ExtCommunities().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.ExtendedCommunities) != 0 { + + if set_default { + obj.ExtendedCommunities().clearHolderSlice() + for _, item := range obj.obj.ExtendedCommunities { + obj.ExtendedCommunities().appendHolderSlice(&bgpExtendedCommunity{obj: item}) + } + } + for _, item := range obj.ExtendedCommunities().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *bgpV6RouteRange) setDefault() { + if obj.obj.NextHopMode == nil { + obj.SetNextHopMode(BgpV6RouteRangeNextHopMode.LOCAL_IP) + + } + if obj.obj.NextHopAddressType == nil { + obj.SetNextHopAddressType(BgpV6RouteRangeNextHopAddressType.IPV6) + + } + if obj.obj.NextHopIpv4Address == nil { + obj.SetNextHopIpv4Address("0.0.0.0") + } + if obj.obj.NextHopIpv6Address == nil { + obj.SetNextHopIpv6Address("::0") + } + +} diff --git a/gosnappi/bgp_v6_segment_routing.go b/gosnappi/bgp_v6_segment_routing.go new file mode 100644 index 00000000..3a6e32c9 --- /dev/null +++ b/gosnappi/bgp_v6_segment_routing.go @@ -0,0 +1,536 @@ +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" +) + +// ***** BgpV6SegmentRouting ***** +type bgpV6SegmentRouting struct { + validation + obj *otg.BgpV6SegmentRouting + marshaller marshalBgpV6SegmentRouting + unMarshaller unMarshalBgpV6SegmentRouting +} + +func NewBgpV6SegmentRouting() BgpV6SegmentRouting { + obj := bgpV6SegmentRouting{obj: &otg.BgpV6SegmentRouting{}} + obj.setDefault() + return &obj +} + +func (obj *bgpV6SegmentRouting) msg() *otg.BgpV6SegmentRouting { + return obj.obj +} + +func (obj *bgpV6SegmentRouting) setMsg(msg *otg.BgpV6SegmentRouting) BgpV6SegmentRouting { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpV6SegmentRouting struct { + obj *bgpV6SegmentRouting +} + +type marshalBgpV6SegmentRouting interface { + // ToProto marshals BgpV6SegmentRouting to protobuf object *otg.BgpV6SegmentRouting + ToProto() (*otg.BgpV6SegmentRouting, error) + // ToPbText marshals BgpV6SegmentRouting to protobuf text + ToPbText() (string, error) + // ToYaml marshals BgpV6SegmentRouting to YAML text + ToYaml() (string, error) + // ToJson marshals BgpV6SegmentRouting to JSON text + ToJson() (string, error) +} + +type unMarshalbgpV6SegmentRouting struct { + obj *bgpV6SegmentRouting +} + +type unMarshalBgpV6SegmentRouting interface { + // FromProto unmarshals BgpV6SegmentRouting from protobuf object *otg.BgpV6SegmentRouting + FromProto(msg *otg.BgpV6SegmentRouting) (BgpV6SegmentRouting, error) + // FromPbText unmarshals BgpV6SegmentRouting from protobuf text + FromPbText(value string) error + // FromYaml unmarshals BgpV6SegmentRouting from YAML text + FromYaml(value string) error + // FromJson unmarshals BgpV6SegmentRouting from JSON text + FromJson(value string) error +} + +func (obj *bgpV6SegmentRouting) Marshal() marshalBgpV6SegmentRouting { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpV6SegmentRouting{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpV6SegmentRouting) Unmarshal() unMarshalBgpV6SegmentRouting { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpV6SegmentRouting{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpV6SegmentRouting) ToProto() (*otg.BgpV6SegmentRouting, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpV6SegmentRouting) FromProto(msg *otg.BgpV6SegmentRouting) (BgpV6SegmentRouting, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpV6SegmentRouting) 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 *unMarshalbgpV6SegmentRouting) 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 *marshalbgpV6SegmentRouting) 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 *unMarshalbgpV6SegmentRouting) 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 *marshalbgpV6SegmentRouting) 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 *unMarshalbgpV6SegmentRouting) 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 *bgpV6SegmentRouting) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpV6SegmentRouting) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpV6SegmentRouting) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpV6SegmentRouting) Clone() (BgpV6SegmentRouting, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpV6SegmentRouting() + 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 +} + +// BgpV6SegmentRouting is configuration for BGPv6 segment routing settings. +type BgpV6SegmentRouting interface { + Validation + // msg marshals BgpV6SegmentRouting to protobuf object *otg.BgpV6SegmentRouting + // and doesn't set defaults + msg() *otg.BgpV6SegmentRouting + // setMsg unmarshals BgpV6SegmentRouting from protobuf object *otg.BgpV6SegmentRouting + // and doesn't set defaults + setMsg(*otg.BgpV6SegmentRouting) BgpV6SegmentRouting + // provides marshal interface + Marshal() marshalBgpV6SegmentRouting + // provides unmarshal interface + Unmarshal() unMarshalBgpV6SegmentRouting + // validate validates BgpV6SegmentRouting + validate() error + // A stringer function + String() string + // Clones the object + Clone() (BgpV6SegmentRouting, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // IngressSupportsVpn returns bool, set in BgpV6SegmentRouting. + IngressSupportsVpn() bool + // SetIngressSupportsVpn assigns bool provided by user to BgpV6SegmentRouting + SetIngressSupportsVpn(value bool) BgpV6SegmentRouting + // HasIngressSupportsVpn checks if IngressSupportsVpn has been set in BgpV6SegmentRouting + HasIngressSupportsVpn() bool + // ReducedEncapsulation returns bool, set in BgpV6SegmentRouting. + ReducedEncapsulation() bool + // SetReducedEncapsulation assigns bool provided by user to BgpV6SegmentRouting + SetReducedEncapsulation(value bool) BgpV6SegmentRouting + // HasReducedEncapsulation checks if ReducedEncapsulation has been set in BgpV6SegmentRouting + HasReducedEncapsulation() bool + // CopyTimeToLive returns bool, set in BgpV6SegmentRouting. + CopyTimeToLive() bool + // SetCopyTimeToLive assigns bool provided by user to BgpV6SegmentRouting + SetCopyTimeToLive(value bool) BgpV6SegmentRouting + // HasCopyTimeToLive checks if CopyTimeToLive has been set in BgpV6SegmentRouting + HasCopyTimeToLive() bool + // TimeToLive returns uint32, set in BgpV6SegmentRouting. + TimeToLive() uint32 + // SetTimeToLive assigns uint32 provided by user to BgpV6SegmentRouting + SetTimeToLive(value uint32) BgpV6SegmentRouting + // HasTimeToLive checks if TimeToLive has been set in BgpV6SegmentRouting + HasTimeToLive() bool + // MaxSidsPerSrh returns uint32, set in BgpV6SegmentRouting. + MaxSidsPerSrh() uint32 + // SetMaxSidsPerSrh assigns uint32 provided by user to BgpV6SegmentRouting + SetMaxSidsPerSrh(value uint32) BgpV6SegmentRouting + // HasMaxSidsPerSrh checks if MaxSidsPerSrh has been set in BgpV6SegmentRouting + HasMaxSidsPerSrh() bool + // AutoGenerateSegmentLeftValue returns bool, set in BgpV6SegmentRouting. + AutoGenerateSegmentLeftValue() bool + // SetAutoGenerateSegmentLeftValue assigns bool provided by user to BgpV6SegmentRouting + SetAutoGenerateSegmentLeftValue(value bool) BgpV6SegmentRouting + // HasAutoGenerateSegmentLeftValue checks if AutoGenerateSegmentLeftValue has been set in BgpV6SegmentRouting + HasAutoGenerateSegmentLeftValue() bool + // SegmentLeftValue returns uint32, set in BgpV6SegmentRouting. + SegmentLeftValue() uint32 + // SetSegmentLeftValue assigns uint32 provided by user to BgpV6SegmentRouting + SetSegmentLeftValue(value uint32) BgpV6SegmentRouting + // HasSegmentLeftValue checks if SegmentLeftValue has been set in BgpV6SegmentRouting + HasSegmentLeftValue() bool + // AdvertiseSrTePolicy returns bool, set in BgpV6SegmentRouting. + AdvertiseSrTePolicy() bool + // SetAdvertiseSrTePolicy assigns bool provided by user to BgpV6SegmentRouting + SetAdvertiseSrTePolicy(value bool) BgpV6SegmentRouting + // HasAdvertiseSrTePolicy checks if AdvertiseSrTePolicy has been set in BgpV6SegmentRouting + HasAdvertiseSrTePolicy() bool +} + +// TBD +// IngressSupportsVpn returns a bool +func (obj *bgpV6SegmentRouting) IngressSupportsVpn() bool { + + return *obj.obj.IngressSupportsVpn + +} + +// TBD +// IngressSupportsVpn returns a bool +func (obj *bgpV6SegmentRouting) HasIngressSupportsVpn() bool { + return obj.obj.IngressSupportsVpn != nil +} + +// TBD +// SetIngressSupportsVpn sets the bool value in the BgpV6SegmentRouting object +func (obj *bgpV6SegmentRouting) SetIngressSupportsVpn(value bool) BgpV6SegmentRouting { + + obj.obj.IngressSupportsVpn = &value + return obj +} + +// TBD +// ReducedEncapsulation returns a bool +func (obj *bgpV6SegmentRouting) ReducedEncapsulation() bool { + + return *obj.obj.ReducedEncapsulation + +} + +// TBD +// ReducedEncapsulation returns a bool +func (obj *bgpV6SegmentRouting) HasReducedEncapsulation() bool { + return obj.obj.ReducedEncapsulation != nil +} + +// TBD +// SetReducedEncapsulation sets the bool value in the BgpV6SegmentRouting object +func (obj *bgpV6SegmentRouting) SetReducedEncapsulation(value bool) BgpV6SegmentRouting { + + obj.obj.ReducedEncapsulation = &value + return obj +} + +// TBD +// CopyTimeToLive returns a bool +func (obj *bgpV6SegmentRouting) CopyTimeToLive() bool { + + return *obj.obj.CopyTimeToLive + +} + +// TBD +// CopyTimeToLive returns a bool +func (obj *bgpV6SegmentRouting) HasCopyTimeToLive() bool { + return obj.obj.CopyTimeToLive != nil +} + +// TBD +// SetCopyTimeToLive sets the bool value in the BgpV6SegmentRouting object +func (obj *bgpV6SegmentRouting) SetCopyTimeToLive(value bool) BgpV6SegmentRouting { + + obj.obj.CopyTimeToLive = &value + return obj +} + +// TBD +// TimeToLive returns a uint32 +func (obj *bgpV6SegmentRouting) TimeToLive() uint32 { + + return *obj.obj.TimeToLive + +} + +// TBD +// TimeToLive returns a uint32 +func (obj *bgpV6SegmentRouting) HasTimeToLive() bool { + return obj.obj.TimeToLive != nil +} + +// TBD +// SetTimeToLive sets the uint32 value in the BgpV6SegmentRouting object +func (obj *bgpV6SegmentRouting) SetTimeToLive(value uint32) BgpV6SegmentRouting { + + obj.obj.TimeToLive = &value + return obj +} + +// TBD +// MaxSidsPerSrh returns a uint32 +func (obj *bgpV6SegmentRouting) MaxSidsPerSrh() uint32 { + + return *obj.obj.MaxSidsPerSrh + +} + +// TBD +// MaxSidsPerSrh returns a uint32 +func (obj *bgpV6SegmentRouting) HasMaxSidsPerSrh() bool { + return obj.obj.MaxSidsPerSrh != nil +} + +// TBD +// SetMaxSidsPerSrh sets the uint32 value in the BgpV6SegmentRouting object +func (obj *bgpV6SegmentRouting) SetMaxSidsPerSrh(value uint32) BgpV6SegmentRouting { + + obj.obj.MaxSidsPerSrh = &value + return obj +} + +// TBD +// AutoGenerateSegmentLeftValue returns a bool +func (obj *bgpV6SegmentRouting) AutoGenerateSegmentLeftValue() bool { + + return *obj.obj.AutoGenerateSegmentLeftValue + +} + +// TBD +// AutoGenerateSegmentLeftValue returns a bool +func (obj *bgpV6SegmentRouting) HasAutoGenerateSegmentLeftValue() bool { + return obj.obj.AutoGenerateSegmentLeftValue != nil +} + +// TBD +// SetAutoGenerateSegmentLeftValue sets the bool value in the BgpV6SegmentRouting object +func (obj *bgpV6SegmentRouting) SetAutoGenerateSegmentLeftValue(value bool) BgpV6SegmentRouting { + + obj.obj.AutoGenerateSegmentLeftValue = &value + return obj +} + +// TBD +// SegmentLeftValue returns a uint32 +func (obj *bgpV6SegmentRouting) SegmentLeftValue() uint32 { + + return *obj.obj.SegmentLeftValue + +} + +// TBD +// SegmentLeftValue returns a uint32 +func (obj *bgpV6SegmentRouting) HasSegmentLeftValue() bool { + return obj.obj.SegmentLeftValue != nil +} + +// TBD +// SetSegmentLeftValue sets the uint32 value in the BgpV6SegmentRouting object +func (obj *bgpV6SegmentRouting) SetSegmentLeftValue(value uint32) BgpV6SegmentRouting { + + obj.obj.SegmentLeftValue = &value + return obj +} + +// TBD +// AdvertiseSrTePolicy returns a bool +func (obj *bgpV6SegmentRouting) AdvertiseSrTePolicy() bool { + + return *obj.obj.AdvertiseSrTePolicy + +} + +// TBD +// AdvertiseSrTePolicy returns a bool +func (obj *bgpV6SegmentRouting) HasAdvertiseSrTePolicy() bool { + return obj.obj.AdvertiseSrTePolicy != nil +} + +// TBD +// SetAdvertiseSrTePolicy sets the bool value in the BgpV6SegmentRouting object +func (obj *bgpV6SegmentRouting) SetAdvertiseSrTePolicy(value bool) BgpV6SegmentRouting { + + obj.obj.AdvertiseSrTePolicy = &value + return obj +} + +func (obj *bgpV6SegmentRouting) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.MaxSidsPerSrh != nil { + + if *obj.obj.MaxSidsPerSrh > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= BgpV6SegmentRouting.MaxSidsPerSrh <= 255 but Got %d", *obj.obj.MaxSidsPerSrh)) + } + + } + +} + +func (obj *bgpV6SegmentRouting) setDefault() { + if obj.obj.IngressSupportsVpn == nil { + obj.SetIngressSupportsVpn(false) + } + if obj.obj.ReducedEncapsulation == nil { + obj.SetReducedEncapsulation(false) + } + if obj.obj.CopyTimeToLive == nil { + obj.SetCopyTimeToLive(false) + } + if obj.obj.TimeToLive == nil { + obj.SetTimeToLive(0) + } + if obj.obj.MaxSidsPerSrh == nil { + obj.SetMaxSidsPerSrh(0) + } + if obj.obj.AutoGenerateSegmentLeftValue == nil { + obj.SetAutoGenerateSegmentLeftValue(false) + } + if obj.obj.SegmentLeftValue == nil { + obj.SetSegmentLeftValue(0) + } + if obj.obj.AdvertiseSrTePolicy == nil { + obj.SetAdvertiseSrTePolicy(false) + } + +} diff --git a/gosnappi/bgpv4_metric.go b/gosnappi/bgpv4_metric.go new file mode 100644 index 00000000..5ec4cf70 --- /dev/null +++ b/gosnappi/bgpv4_metric.go @@ -0,0 +1,786 @@ +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" +) + +// ***** Bgpv4Metric ***** +type bgpv4Metric struct { + validation + obj *otg.Bgpv4Metric + marshaller marshalBgpv4Metric + unMarshaller unMarshalBgpv4Metric +} + +func NewBgpv4Metric() Bgpv4Metric { + obj := bgpv4Metric{obj: &otg.Bgpv4Metric{}} + obj.setDefault() + return &obj +} + +func (obj *bgpv4Metric) msg() *otg.Bgpv4Metric { + return obj.obj +} + +func (obj *bgpv4Metric) setMsg(msg *otg.Bgpv4Metric) Bgpv4Metric { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpv4Metric struct { + obj *bgpv4Metric +} + +type marshalBgpv4Metric interface { + // ToProto marshals Bgpv4Metric to protobuf object *otg.Bgpv4Metric + ToProto() (*otg.Bgpv4Metric, error) + // ToPbText marshals Bgpv4Metric to protobuf text + ToPbText() (string, error) + // ToYaml marshals Bgpv4Metric to YAML text + ToYaml() (string, error) + // ToJson marshals Bgpv4Metric to JSON text + ToJson() (string, error) +} + +type unMarshalbgpv4Metric struct { + obj *bgpv4Metric +} + +type unMarshalBgpv4Metric interface { + // FromProto unmarshals Bgpv4Metric from protobuf object *otg.Bgpv4Metric + FromProto(msg *otg.Bgpv4Metric) (Bgpv4Metric, error) + // FromPbText unmarshals Bgpv4Metric from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Bgpv4Metric from YAML text + FromYaml(value string) error + // FromJson unmarshals Bgpv4Metric from JSON text + FromJson(value string) error +} + +func (obj *bgpv4Metric) Marshal() marshalBgpv4Metric { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpv4Metric{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpv4Metric) Unmarshal() unMarshalBgpv4Metric { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpv4Metric{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpv4Metric) ToProto() (*otg.Bgpv4Metric, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpv4Metric) FromProto(msg *otg.Bgpv4Metric) (Bgpv4Metric, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpv4Metric) 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 *unMarshalbgpv4Metric) 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 *marshalbgpv4Metric) 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 *unMarshalbgpv4Metric) 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 *marshalbgpv4Metric) 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 *unMarshalbgpv4Metric) 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 *bgpv4Metric) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpv4Metric) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpv4Metric) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpv4Metric) Clone() (Bgpv4Metric, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpv4Metric() + 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 +} + +// Bgpv4Metric is bGPv4 per peer statistics information. +type Bgpv4Metric interface { + Validation + // msg marshals Bgpv4Metric to protobuf object *otg.Bgpv4Metric + // and doesn't set defaults + msg() *otg.Bgpv4Metric + // setMsg unmarshals Bgpv4Metric from protobuf object *otg.Bgpv4Metric + // and doesn't set defaults + setMsg(*otg.Bgpv4Metric) Bgpv4Metric + // provides marshal interface + Marshal() marshalBgpv4Metric + // provides unmarshal interface + Unmarshal() unMarshalBgpv4Metric + // validate validates Bgpv4Metric + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Bgpv4Metric, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in Bgpv4Metric. + Name() string + // SetName assigns string provided by user to Bgpv4Metric + SetName(value string) Bgpv4Metric + // HasName checks if Name has been set in Bgpv4Metric + HasName() bool + // SessionState returns Bgpv4MetricSessionStateEnum, set in Bgpv4Metric + SessionState() Bgpv4MetricSessionStateEnum + // SetSessionState assigns Bgpv4MetricSessionStateEnum provided by user to Bgpv4Metric + SetSessionState(value Bgpv4MetricSessionStateEnum) Bgpv4Metric + // HasSessionState checks if SessionState has been set in Bgpv4Metric + HasSessionState() bool + // SessionFlapCount returns uint64, set in Bgpv4Metric. + SessionFlapCount() uint64 + // SetSessionFlapCount assigns uint64 provided by user to Bgpv4Metric + SetSessionFlapCount(value uint64) Bgpv4Metric + // HasSessionFlapCount checks if SessionFlapCount has been set in Bgpv4Metric + HasSessionFlapCount() bool + // RoutesAdvertised returns uint64, set in Bgpv4Metric. + RoutesAdvertised() uint64 + // SetRoutesAdvertised assigns uint64 provided by user to Bgpv4Metric + SetRoutesAdvertised(value uint64) Bgpv4Metric + // HasRoutesAdvertised checks if RoutesAdvertised has been set in Bgpv4Metric + HasRoutesAdvertised() bool + // RoutesReceived returns uint64, set in Bgpv4Metric. + RoutesReceived() uint64 + // SetRoutesReceived assigns uint64 provided by user to Bgpv4Metric + SetRoutesReceived(value uint64) Bgpv4Metric + // HasRoutesReceived checks if RoutesReceived has been set in Bgpv4Metric + HasRoutesReceived() bool + // RouteWithdrawsSent returns uint64, set in Bgpv4Metric. + RouteWithdrawsSent() uint64 + // SetRouteWithdrawsSent assigns uint64 provided by user to Bgpv4Metric + SetRouteWithdrawsSent(value uint64) Bgpv4Metric + // HasRouteWithdrawsSent checks if RouteWithdrawsSent has been set in Bgpv4Metric + HasRouteWithdrawsSent() bool + // RouteWithdrawsReceived returns uint64, set in Bgpv4Metric. + RouteWithdrawsReceived() uint64 + // SetRouteWithdrawsReceived assigns uint64 provided by user to Bgpv4Metric + SetRouteWithdrawsReceived(value uint64) Bgpv4Metric + // HasRouteWithdrawsReceived checks if RouteWithdrawsReceived has been set in Bgpv4Metric + HasRouteWithdrawsReceived() bool + // UpdatesSent returns uint64, set in Bgpv4Metric. + UpdatesSent() uint64 + // SetUpdatesSent assigns uint64 provided by user to Bgpv4Metric + SetUpdatesSent(value uint64) Bgpv4Metric + // HasUpdatesSent checks if UpdatesSent has been set in Bgpv4Metric + HasUpdatesSent() bool + // UpdatesReceived returns uint64, set in Bgpv4Metric. + UpdatesReceived() uint64 + // SetUpdatesReceived assigns uint64 provided by user to Bgpv4Metric + SetUpdatesReceived(value uint64) Bgpv4Metric + // HasUpdatesReceived checks if UpdatesReceived has been set in Bgpv4Metric + HasUpdatesReceived() bool + // OpensSent returns uint64, set in Bgpv4Metric. + OpensSent() uint64 + // SetOpensSent assigns uint64 provided by user to Bgpv4Metric + SetOpensSent(value uint64) Bgpv4Metric + // HasOpensSent checks if OpensSent has been set in Bgpv4Metric + HasOpensSent() bool + // OpensReceived returns uint64, set in Bgpv4Metric. + OpensReceived() uint64 + // SetOpensReceived assigns uint64 provided by user to Bgpv4Metric + SetOpensReceived(value uint64) Bgpv4Metric + // HasOpensReceived checks if OpensReceived has been set in Bgpv4Metric + HasOpensReceived() bool + // KeepalivesSent returns uint64, set in Bgpv4Metric. + KeepalivesSent() uint64 + // SetKeepalivesSent assigns uint64 provided by user to Bgpv4Metric + SetKeepalivesSent(value uint64) Bgpv4Metric + // HasKeepalivesSent checks if KeepalivesSent has been set in Bgpv4Metric + HasKeepalivesSent() bool + // KeepalivesReceived returns uint64, set in Bgpv4Metric. + KeepalivesReceived() uint64 + // SetKeepalivesReceived assigns uint64 provided by user to Bgpv4Metric + SetKeepalivesReceived(value uint64) Bgpv4Metric + // HasKeepalivesReceived checks if KeepalivesReceived has been set in Bgpv4Metric + HasKeepalivesReceived() bool + // NotificationsSent returns uint64, set in Bgpv4Metric. + NotificationsSent() uint64 + // SetNotificationsSent assigns uint64 provided by user to Bgpv4Metric + SetNotificationsSent(value uint64) Bgpv4Metric + // HasNotificationsSent checks if NotificationsSent has been set in Bgpv4Metric + HasNotificationsSent() bool + // NotificationsReceived returns uint64, set in Bgpv4Metric. + NotificationsReceived() uint64 + // SetNotificationsReceived assigns uint64 provided by user to Bgpv4Metric + SetNotificationsReceived(value uint64) Bgpv4Metric + // HasNotificationsReceived checks if NotificationsReceived has been set in Bgpv4Metric + HasNotificationsReceived() bool + // FsmState returns Bgpv4MetricFsmStateEnum, set in Bgpv4Metric + FsmState() Bgpv4MetricFsmStateEnum + // SetFsmState assigns Bgpv4MetricFsmStateEnum provided by user to Bgpv4Metric + SetFsmState(value Bgpv4MetricFsmStateEnum) Bgpv4Metric + // HasFsmState checks if FsmState has been set in Bgpv4Metric + HasFsmState() bool + // EndOfRibReceived returns uint64, set in Bgpv4Metric. + EndOfRibReceived() uint64 + // SetEndOfRibReceived assigns uint64 provided by user to Bgpv4Metric + SetEndOfRibReceived(value uint64) Bgpv4Metric + // HasEndOfRibReceived checks if EndOfRibReceived has been set in Bgpv4Metric + HasEndOfRibReceived() bool +} + +// The name of a configured BGPv4 peer. +// Name returns a string +func (obj *bgpv4Metric) Name() string { + + return *obj.obj.Name + +} + +// The name of a configured BGPv4 peer. +// Name returns a string +func (obj *bgpv4Metric) HasName() bool { + return obj.obj.Name != nil +} + +// The name of a configured BGPv4 peer. +// SetName sets the string value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetName(value string) Bgpv4Metric { + + obj.obj.Name = &value + return obj +} + +type Bgpv4MetricSessionStateEnum string + +// Enum of SessionState on Bgpv4Metric +var Bgpv4MetricSessionState = struct { + UP Bgpv4MetricSessionStateEnum + DOWN Bgpv4MetricSessionStateEnum +}{ + UP: Bgpv4MetricSessionStateEnum("up"), + DOWN: Bgpv4MetricSessionStateEnum("down"), +} + +func (obj *bgpv4Metric) SessionState() Bgpv4MetricSessionStateEnum { + return Bgpv4MetricSessionStateEnum(obj.obj.SessionState.Enum().String()) +} + +// Session state as up or down. Up refers to an Established state and Down refers to any other state. +// SessionState returns a string +func (obj *bgpv4Metric) HasSessionState() bool { + return obj.obj.SessionState != nil +} + +func (obj *bgpv4Metric) SetSessionState(value Bgpv4MetricSessionStateEnum) Bgpv4Metric { + intValue, ok := otg.Bgpv4Metric_SessionState_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on Bgpv4MetricSessionStateEnum", string(value))) + return obj + } + enumValue := otg.Bgpv4Metric_SessionState_Enum(intValue) + obj.obj.SessionState = &enumValue + + return obj +} + +// Number of times the session went from Up to Down state. +// SessionFlapCount returns a uint64 +func (obj *bgpv4Metric) SessionFlapCount() uint64 { + + return *obj.obj.SessionFlapCount + +} + +// Number of times the session went from Up to Down state. +// SessionFlapCount returns a uint64 +func (obj *bgpv4Metric) HasSessionFlapCount() bool { + return obj.obj.SessionFlapCount != nil +} + +// Number of times the session went from Up to Down state. +// SetSessionFlapCount sets the uint64 value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetSessionFlapCount(value uint64) Bgpv4Metric { + + obj.obj.SessionFlapCount = &value + return obj +} + +// Number of routes advertised. +// RoutesAdvertised returns a uint64 +func (obj *bgpv4Metric) RoutesAdvertised() uint64 { + + return *obj.obj.RoutesAdvertised + +} + +// Number of routes advertised. +// RoutesAdvertised returns a uint64 +func (obj *bgpv4Metric) HasRoutesAdvertised() bool { + return obj.obj.RoutesAdvertised != nil +} + +// Number of routes advertised. +// SetRoutesAdvertised sets the uint64 value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetRoutesAdvertised(value uint64) Bgpv4Metric { + + obj.obj.RoutesAdvertised = &value + return obj +} + +// Number of routes received. +// RoutesReceived returns a uint64 +func (obj *bgpv4Metric) RoutesReceived() uint64 { + + return *obj.obj.RoutesReceived + +} + +// Number of routes received. +// RoutesReceived returns a uint64 +func (obj *bgpv4Metric) HasRoutesReceived() bool { + return obj.obj.RoutesReceived != nil +} + +// Number of routes received. +// SetRoutesReceived sets the uint64 value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetRoutesReceived(value uint64) Bgpv4Metric { + + obj.obj.RoutesReceived = &value + return obj +} + +// Number of route withdraws sent. +// RouteWithdrawsSent returns a uint64 +func (obj *bgpv4Metric) RouteWithdrawsSent() uint64 { + + return *obj.obj.RouteWithdrawsSent + +} + +// Number of route withdraws sent. +// RouteWithdrawsSent returns a uint64 +func (obj *bgpv4Metric) HasRouteWithdrawsSent() bool { + return obj.obj.RouteWithdrawsSent != nil +} + +// Number of route withdraws sent. +// SetRouteWithdrawsSent sets the uint64 value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetRouteWithdrawsSent(value uint64) Bgpv4Metric { + + obj.obj.RouteWithdrawsSent = &value + return obj +} + +// Number of route withdraws received. +// RouteWithdrawsReceived returns a uint64 +func (obj *bgpv4Metric) RouteWithdrawsReceived() uint64 { + + return *obj.obj.RouteWithdrawsReceived + +} + +// Number of route withdraws received. +// RouteWithdrawsReceived returns a uint64 +func (obj *bgpv4Metric) HasRouteWithdrawsReceived() bool { + return obj.obj.RouteWithdrawsReceived != nil +} + +// Number of route withdraws received. +// SetRouteWithdrawsReceived sets the uint64 value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetRouteWithdrawsReceived(value uint64) Bgpv4Metric { + + obj.obj.RouteWithdrawsReceived = &value + return obj +} + +// Number of Update messages sent. +// UpdatesSent returns a uint64 +func (obj *bgpv4Metric) UpdatesSent() uint64 { + + return *obj.obj.UpdatesSent + +} + +// Number of Update messages sent. +// UpdatesSent returns a uint64 +func (obj *bgpv4Metric) HasUpdatesSent() bool { + return obj.obj.UpdatesSent != nil +} + +// Number of Update messages sent. +// SetUpdatesSent sets the uint64 value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetUpdatesSent(value uint64) Bgpv4Metric { + + obj.obj.UpdatesSent = &value + return obj +} + +// Number of Update messages received. +// UpdatesReceived returns a uint64 +func (obj *bgpv4Metric) UpdatesReceived() uint64 { + + return *obj.obj.UpdatesReceived + +} + +// Number of Update messages received. +// UpdatesReceived returns a uint64 +func (obj *bgpv4Metric) HasUpdatesReceived() bool { + return obj.obj.UpdatesReceived != nil +} + +// Number of Update messages received. +// SetUpdatesReceived sets the uint64 value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetUpdatesReceived(value uint64) Bgpv4Metric { + + obj.obj.UpdatesReceived = &value + return obj +} + +// Number of Open messages sent. +// OpensSent returns a uint64 +func (obj *bgpv4Metric) OpensSent() uint64 { + + return *obj.obj.OpensSent + +} + +// Number of Open messages sent. +// OpensSent returns a uint64 +func (obj *bgpv4Metric) HasOpensSent() bool { + return obj.obj.OpensSent != nil +} + +// Number of Open messages sent. +// SetOpensSent sets the uint64 value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetOpensSent(value uint64) Bgpv4Metric { + + obj.obj.OpensSent = &value + return obj +} + +// Number of Open messages received. +// OpensReceived returns a uint64 +func (obj *bgpv4Metric) OpensReceived() uint64 { + + return *obj.obj.OpensReceived + +} + +// Number of Open messages received. +// OpensReceived returns a uint64 +func (obj *bgpv4Metric) HasOpensReceived() bool { + return obj.obj.OpensReceived != nil +} + +// Number of Open messages received. +// SetOpensReceived sets the uint64 value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetOpensReceived(value uint64) Bgpv4Metric { + + obj.obj.OpensReceived = &value + return obj +} + +// Number of Keepalive messages sent. +// KeepalivesSent returns a uint64 +func (obj *bgpv4Metric) KeepalivesSent() uint64 { + + return *obj.obj.KeepalivesSent + +} + +// Number of Keepalive messages sent. +// KeepalivesSent returns a uint64 +func (obj *bgpv4Metric) HasKeepalivesSent() bool { + return obj.obj.KeepalivesSent != nil +} + +// Number of Keepalive messages sent. +// SetKeepalivesSent sets the uint64 value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetKeepalivesSent(value uint64) Bgpv4Metric { + + obj.obj.KeepalivesSent = &value + return obj +} + +// Number of Keepalive messages received. +// KeepalivesReceived returns a uint64 +func (obj *bgpv4Metric) KeepalivesReceived() uint64 { + + return *obj.obj.KeepalivesReceived + +} + +// Number of Keepalive messages received. +// KeepalivesReceived returns a uint64 +func (obj *bgpv4Metric) HasKeepalivesReceived() bool { + return obj.obj.KeepalivesReceived != nil +} + +// Number of Keepalive messages received. +// SetKeepalivesReceived sets the uint64 value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetKeepalivesReceived(value uint64) Bgpv4Metric { + + obj.obj.KeepalivesReceived = &value + return obj +} + +// Number of Notification messages sent. +// NotificationsSent returns a uint64 +func (obj *bgpv4Metric) NotificationsSent() uint64 { + + return *obj.obj.NotificationsSent + +} + +// Number of Notification messages sent. +// NotificationsSent returns a uint64 +func (obj *bgpv4Metric) HasNotificationsSent() bool { + return obj.obj.NotificationsSent != nil +} + +// Number of Notification messages sent. +// SetNotificationsSent sets the uint64 value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetNotificationsSent(value uint64) Bgpv4Metric { + + obj.obj.NotificationsSent = &value + return obj +} + +// Number of Notification messages received. +// NotificationsReceived returns a uint64 +func (obj *bgpv4Metric) NotificationsReceived() uint64 { + + return *obj.obj.NotificationsReceived + +} + +// Number of Notification messages received. +// NotificationsReceived returns a uint64 +func (obj *bgpv4Metric) HasNotificationsReceived() bool { + return obj.obj.NotificationsReceived != nil +} + +// Number of Notification messages received. +// SetNotificationsReceived sets the uint64 value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetNotificationsReceived(value uint64) Bgpv4Metric { + + obj.obj.NotificationsReceived = &value + return obj +} + +type Bgpv4MetricFsmStateEnum string + +// Enum of FsmState on Bgpv4Metric +var Bgpv4MetricFsmState = struct { + IDLE Bgpv4MetricFsmStateEnum + CONNECT Bgpv4MetricFsmStateEnum + ACTIVE Bgpv4MetricFsmStateEnum + OPENSENT Bgpv4MetricFsmStateEnum + OPENCONFIRM Bgpv4MetricFsmStateEnum + ESTABLISHED Bgpv4MetricFsmStateEnum +}{ + IDLE: Bgpv4MetricFsmStateEnum("idle"), + CONNECT: Bgpv4MetricFsmStateEnum("connect"), + ACTIVE: Bgpv4MetricFsmStateEnum("active"), + OPENSENT: Bgpv4MetricFsmStateEnum("opensent"), + OPENCONFIRM: Bgpv4MetricFsmStateEnum("openconfirm"), + ESTABLISHED: Bgpv4MetricFsmStateEnum("established"), +} + +func (obj *bgpv4Metric) FsmState() Bgpv4MetricFsmStateEnum { + return Bgpv4MetricFsmStateEnum(obj.obj.FsmState.Enum().String()) +} + +// BGP peer FSM (Finite State Machine) state as Idle, Connect, Active, OpenSent, OpenConfirm and Established. In all the states except Established the BGP session is down. Idle refers to the Idle state of the FSM. Connect refers to the state where the session is waiting for the underlying transport session to be established. Active refers to the state where the session is awaiting for a connection from the remote peer. OpenSent refers to the state where the session is in the process of being established. The local system has sent an OPEN message. OpenConfirm refers to the state where the session is in the process of being established. The local system has sent and received an OPEN message and is awaiting a NOTIFICATION or KEEPALIVE message from remote peer. Established refers to the state where the BGP session with the peer is established. +// FsmState returns a string +func (obj *bgpv4Metric) HasFsmState() bool { + return obj.obj.FsmState != nil +} + +func (obj *bgpv4Metric) SetFsmState(value Bgpv4MetricFsmStateEnum) Bgpv4Metric { + intValue, ok := otg.Bgpv4Metric_FsmState_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on Bgpv4MetricFsmStateEnum", string(value))) + return obj + } + enumValue := otg.Bgpv4Metric_FsmState_Enum(intValue) + obj.obj.FsmState = &enumValue + + return obj +} + +// Number of End-of-RIB markers received indicating the completion of the initial routing update for a particular address family after the session is established. For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message with the minimum length. For any other address family, it is an UPDATE message that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for that . +// EndOfRibReceived returns a uint64 +func (obj *bgpv4Metric) EndOfRibReceived() uint64 { + + return *obj.obj.EndOfRibReceived + +} + +// Number of End-of-RIB markers received indicating the completion of the initial routing update for a particular address family after the session is established. For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message with the minimum length. For any other address family, it is an UPDATE message that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for that . +// EndOfRibReceived returns a uint64 +func (obj *bgpv4Metric) HasEndOfRibReceived() bool { + return obj.obj.EndOfRibReceived != nil +} + +// Number of End-of-RIB markers received indicating the completion of the initial routing update for a particular address family after the session is established. For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message with the minimum length. For any other address family, it is an UPDATE message that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for that . +// SetEndOfRibReceived sets the uint64 value in the Bgpv4Metric object +func (obj *bgpv4Metric) SetEndOfRibReceived(value uint64) Bgpv4Metric { + + obj.obj.EndOfRibReceived = &value + return obj +} + +func (obj *bgpv4Metric) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpv4Metric) setDefault() { + +} diff --git a/gosnappi/bgpv4_metrics_request.go b/gosnappi/bgpv4_metrics_request.go new file mode 100644 index 00000000..6908a10b --- /dev/null +++ b/gosnappi/bgpv4_metrics_request.go @@ -0,0 +1,381 @@ +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" +) + +// ***** Bgpv4MetricsRequest ***** +type bgpv4MetricsRequest struct { + validation + obj *otg.Bgpv4MetricsRequest + marshaller marshalBgpv4MetricsRequest + unMarshaller unMarshalBgpv4MetricsRequest +} + +func NewBgpv4MetricsRequest() Bgpv4MetricsRequest { + obj := bgpv4MetricsRequest{obj: &otg.Bgpv4MetricsRequest{}} + obj.setDefault() + return &obj +} + +func (obj *bgpv4MetricsRequest) msg() *otg.Bgpv4MetricsRequest { + return obj.obj +} + +func (obj *bgpv4MetricsRequest) setMsg(msg *otg.Bgpv4MetricsRequest) Bgpv4MetricsRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpv4MetricsRequest struct { + obj *bgpv4MetricsRequest +} + +type marshalBgpv4MetricsRequest interface { + // ToProto marshals Bgpv4MetricsRequest to protobuf object *otg.Bgpv4MetricsRequest + ToProto() (*otg.Bgpv4MetricsRequest, error) + // ToPbText marshals Bgpv4MetricsRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals Bgpv4MetricsRequest to YAML text + ToYaml() (string, error) + // ToJson marshals Bgpv4MetricsRequest to JSON text + ToJson() (string, error) +} + +type unMarshalbgpv4MetricsRequest struct { + obj *bgpv4MetricsRequest +} + +type unMarshalBgpv4MetricsRequest interface { + // FromProto unmarshals Bgpv4MetricsRequest from protobuf object *otg.Bgpv4MetricsRequest + FromProto(msg *otg.Bgpv4MetricsRequest) (Bgpv4MetricsRequest, error) + // FromPbText unmarshals Bgpv4MetricsRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Bgpv4MetricsRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals Bgpv4MetricsRequest from JSON text + FromJson(value string) error +} + +func (obj *bgpv4MetricsRequest) Marshal() marshalBgpv4MetricsRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpv4MetricsRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpv4MetricsRequest) Unmarshal() unMarshalBgpv4MetricsRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpv4MetricsRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpv4MetricsRequest) ToProto() (*otg.Bgpv4MetricsRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpv4MetricsRequest) FromProto(msg *otg.Bgpv4MetricsRequest) (Bgpv4MetricsRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpv4MetricsRequest) 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 *unMarshalbgpv4MetricsRequest) 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 *marshalbgpv4MetricsRequest) 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 *unMarshalbgpv4MetricsRequest) 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 *marshalbgpv4MetricsRequest) 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 *unMarshalbgpv4MetricsRequest) 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 *bgpv4MetricsRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpv4MetricsRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpv4MetricsRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpv4MetricsRequest) Clone() (Bgpv4MetricsRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpv4MetricsRequest() + 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 +} + +// Bgpv4MetricsRequest is the request to retrieve BGPv4 per peer metrics/statistics. +type Bgpv4MetricsRequest interface { + Validation + // msg marshals Bgpv4MetricsRequest to protobuf object *otg.Bgpv4MetricsRequest + // and doesn't set defaults + msg() *otg.Bgpv4MetricsRequest + // setMsg unmarshals Bgpv4MetricsRequest from protobuf object *otg.Bgpv4MetricsRequest + // and doesn't set defaults + setMsg(*otg.Bgpv4MetricsRequest) Bgpv4MetricsRequest + // provides marshal interface + Marshal() marshalBgpv4MetricsRequest + // provides unmarshal interface + Unmarshal() unMarshalBgpv4MetricsRequest + // validate validates Bgpv4MetricsRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Bgpv4MetricsRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PeerNames returns []string, set in Bgpv4MetricsRequest. + PeerNames() []string + // SetPeerNames assigns []string provided by user to Bgpv4MetricsRequest + SetPeerNames(value []string) Bgpv4MetricsRequest + // ColumnNames returns []Bgpv4MetricsRequestColumnNamesEnum, set in Bgpv4MetricsRequest + ColumnNames() []Bgpv4MetricsRequestColumnNamesEnum + // SetColumnNames assigns []Bgpv4MetricsRequestColumnNamesEnum provided by user to Bgpv4MetricsRequest + SetColumnNames(value []Bgpv4MetricsRequestColumnNamesEnum) Bgpv4MetricsRequest +} + +// The names of BGPv4 peers to return results for. An empty list will return results for all BGPv4 peers. +// +// x-constraint: +// - /components/schemas/Bgp.V4peer/properties/name +// +// x-constraint: +// - /components/schemas/Bgp.V4peer/properties/name +// +// PeerNames returns a []string +func (obj *bgpv4MetricsRequest) PeerNames() []string { + if obj.obj.PeerNames == nil { + obj.obj.PeerNames = make([]string, 0) + } + return obj.obj.PeerNames +} + +// The names of BGPv4 peers to return results for. An empty list will return results for all BGPv4 peers. +// +// x-constraint: +// - /components/schemas/Bgp.V4peer/properties/name +// +// x-constraint: +// - /components/schemas/Bgp.V4peer/properties/name +// +// SetPeerNames sets the []string value in the Bgpv4MetricsRequest object +func (obj *bgpv4MetricsRequest) SetPeerNames(value []string) Bgpv4MetricsRequest { + + if obj.obj.PeerNames == nil { + obj.obj.PeerNames = make([]string, 0) + } + obj.obj.PeerNames = value + + return obj +} + +type Bgpv4MetricsRequestColumnNamesEnum string + +// Enum of ColumnNames on Bgpv4MetricsRequest +var Bgpv4MetricsRequestColumnNames = struct { + SESSION_STATE Bgpv4MetricsRequestColumnNamesEnum + SESSION_FLAP_COUNT Bgpv4MetricsRequestColumnNamesEnum + ROUTES_ADVERTISED Bgpv4MetricsRequestColumnNamesEnum + ROUTES_RECEIVED Bgpv4MetricsRequestColumnNamesEnum + ROUTE_WITHDRAWS_SENT Bgpv4MetricsRequestColumnNamesEnum + ROUTE_WITHDRAWS_RECEIVED Bgpv4MetricsRequestColumnNamesEnum + UPDATES_SENT Bgpv4MetricsRequestColumnNamesEnum + UPDATES_RECEIVED Bgpv4MetricsRequestColumnNamesEnum + OPENS_SENT Bgpv4MetricsRequestColumnNamesEnum + OPENS_RECEIVED Bgpv4MetricsRequestColumnNamesEnum + KEEPALIVES_SENT Bgpv4MetricsRequestColumnNamesEnum + KEEPALIVES_RECEIVED Bgpv4MetricsRequestColumnNamesEnum + NOTIFICATIONS_SENT Bgpv4MetricsRequestColumnNamesEnum + NOTIFICATIONS_RECEIVED Bgpv4MetricsRequestColumnNamesEnum + FSM_STATE Bgpv4MetricsRequestColumnNamesEnum + END_OF_RIB_RECEIVED Bgpv4MetricsRequestColumnNamesEnum +}{ + SESSION_STATE: Bgpv4MetricsRequestColumnNamesEnum("session_state"), + SESSION_FLAP_COUNT: Bgpv4MetricsRequestColumnNamesEnum("session_flap_count"), + ROUTES_ADVERTISED: Bgpv4MetricsRequestColumnNamesEnum("routes_advertised"), + ROUTES_RECEIVED: Bgpv4MetricsRequestColumnNamesEnum("routes_received"), + ROUTE_WITHDRAWS_SENT: Bgpv4MetricsRequestColumnNamesEnum("route_withdraws_sent"), + ROUTE_WITHDRAWS_RECEIVED: Bgpv4MetricsRequestColumnNamesEnum("route_withdraws_received"), + UPDATES_SENT: Bgpv4MetricsRequestColumnNamesEnum("updates_sent"), + UPDATES_RECEIVED: Bgpv4MetricsRequestColumnNamesEnum("updates_received"), + OPENS_SENT: Bgpv4MetricsRequestColumnNamesEnum("opens_sent"), + OPENS_RECEIVED: Bgpv4MetricsRequestColumnNamesEnum("opens_received"), + KEEPALIVES_SENT: Bgpv4MetricsRequestColumnNamesEnum("keepalives_sent"), + KEEPALIVES_RECEIVED: Bgpv4MetricsRequestColumnNamesEnum("keepalives_received"), + NOTIFICATIONS_SENT: Bgpv4MetricsRequestColumnNamesEnum("notifications_sent"), + NOTIFICATIONS_RECEIVED: Bgpv4MetricsRequestColumnNamesEnum("notifications_received"), + FSM_STATE: Bgpv4MetricsRequestColumnNamesEnum("fsm_state"), + END_OF_RIB_RECEIVED: Bgpv4MetricsRequestColumnNamesEnum("end_of_rib_received"), +} + +func (obj *bgpv4MetricsRequest) ColumnNames() []Bgpv4MetricsRequestColumnNamesEnum { + items := []Bgpv4MetricsRequestColumnNamesEnum{} + for _, item := range obj.obj.ColumnNames { + items = append(items, Bgpv4MetricsRequestColumnNamesEnum(item.String())) + } + return items +} + +// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned except for any result_groups. The name of the BGPv4 peer cannot be excluded. +// SetColumnNames sets the []string value in the Bgpv4MetricsRequest object +func (obj *bgpv4MetricsRequest) SetColumnNames(value []Bgpv4MetricsRequestColumnNamesEnum) Bgpv4MetricsRequest { + + items := []otg.Bgpv4MetricsRequest_ColumnNames_Enum{} + for _, item := range value { + intValue := otg.Bgpv4MetricsRequest_ColumnNames_Enum_value[string(item)] + items = append(items, otg.Bgpv4MetricsRequest_ColumnNames_Enum(intValue)) + } + obj.obj.ColumnNames = items + return obj +} + +func (obj *bgpv4MetricsRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpv4MetricsRequest) setDefault() { + +} diff --git a/gosnappi/bgpv6_metric.go b/gosnappi/bgpv6_metric.go new file mode 100644 index 00000000..f9d84d17 --- /dev/null +++ b/gosnappi/bgpv6_metric.go @@ -0,0 +1,786 @@ +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" +) + +// ***** Bgpv6Metric ***** +type bgpv6Metric struct { + validation + obj *otg.Bgpv6Metric + marshaller marshalBgpv6Metric + unMarshaller unMarshalBgpv6Metric +} + +func NewBgpv6Metric() Bgpv6Metric { + obj := bgpv6Metric{obj: &otg.Bgpv6Metric{}} + obj.setDefault() + return &obj +} + +func (obj *bgpv6Metric) msg() *otg.Bgpv6Metric { + return obj.obj +} + +func (obj *bgpv6Metric) setMsg(msg *otg.Bgpv6Metric) Bgpv6Metric { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpv6Metric struct { + obj *bgpv6Metric +} + +type marshalBgpv6Metric interface { + // ToProto marshals Bgpv6Metric to protobuf object *otg.Bgpv6Metric + ToProto() (*otg.Bgpv6Metric, error) + // ToPbText marshals Bgpv6Metric to protobuf text + ToPbText() (string, error) + // ToYaml marshals Bgpv6Metric to YAML text + ToYaml() (string, error) + // ToJson marshals Bgpv6Metric to JSON text + ToJson() (string, error) +} + +type unMarshalbgpv6Metric struct { + obj *bgpv6Metric +} + +type unMarshalBgpv6Metric interface { + // FromProto unmarshals Bgpv6Metric from protobuf object *otg.Bgpv6Metric + FromProto(msg *otg.Bgpv6Metric) (Bgpv6Metric, error) + // FromPbText unmarshals Bgpv6Metric from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Bgpv6Metric from YAML text + FromYaml(value string) error + // FromJson unmarshals Bgpv6Metric from JSON text + FromJson(value string) error +} + +func (obj *bgpv6Metric) Marshal() marshalBgpv6Metric { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpv6Metric{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpv6Metric) Unmarshal() unMarshalBgpv6Metric { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpv6Metric{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpv6Metric) ToProto() (*otg.Bgpv6Metric, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpv6Metric) FromProto(msg *otg.Bgpv6Metric) (Bgpv6Metric, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpv6Metric) 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 *unMarshalbgpv6Metric) 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 *marshalbgpv6Metric) 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 *unMarshalbgpv6Metric) 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 *marshalbgpv6Metric) 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 *unMarshalbgpv6Metric) 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 *bgpv6Metric) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpv6Metric) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpv6Metric) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpv6Metric) Clone() (Bgpv6Metric, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpv6Metric() + 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 +} + +// Bgpv6Metric is bGPv6 per peer statistics information. +type Bgpv6Metric interface { + Validation + // msg marshals Bgpv6Metric to protobuf object *otg.Bgpv6Metric + // and doesn't set defaults + msg() *otg.Bgpv6Metric + // setMsg unmarshals Bgpv6Metric from protobuf object *otg.Bgpv6Metric + // and doesn't set defaults + setMsg(*otg.Bgpv6Metric) Bgpv6Metric + // provides marshal interface + Marshal() marshalBgpv6Metric + // provides unmarshal interface + Unmarshal() unMarshalBgpv6Metric + // validate validates Bgpv6Metric + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Bgpv6Metric, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in Bgpv6Metric. + Name() string + // SetName assigns string provided by user to Bgpv6Metric + SetName(value string) Bgpv6Metric + // HasName checks if Name has been set in Bgpv6Metric + HasName() bool + // SessionState returns Bgpv6MetricSessionStateEnum, set in Bgpv6Metric + SessionState() Bgpv6MetricSessionStateEnum + // SetSessionState assigns Bgpv6MetricSessionStateEnum provided by user to Bgpv6Metric + SetSessionState(value Bgpv6MetricSessionStateEnum) Bgpv6Metric + // HasSessionState checks if SessionState has been set in Bgpv6Metric + HasSessionState() bool + // SessionFlapCount returns uint64, set in Bgpv6Metric. + SessionFlapCount() uint64 + // SetSessionFlapCount assigns uint64 provided by user to Bgpv6Metric + SetSessionFlapCount(value uint64) Bgpv6Metric + // HasSessionFlapCount checks if SessionFlapCount has been set in Bgpv6Metric + HasSessionFlapCount() bool + // RoutesAdvertised returns uint64, set in Bgpv6Metric. + RoutesAdvertised() uint64 + // SetRoutesAdvertised assigns uint64 provided by user to Bgpv6Metric + SetRoutesAdvertised(value uint64) Bgpv6Metric + // HasRoutesAdvertised checks if RoutesAdvertised has been set in Bgpv6Metric + HasRoutesAdvertised() bool + // RoutesReceived returns uint64, set in Bgpv6Metric. + RoutesReceived() uint64 + // SetRoutesReceived assigns uint64 provided by user to Bgpv6Metric + SetRoutesReceived(value uint64) Bgpv6Metric + // HasRoutesReceived checks if RoutesReceived has been set in Bgpv6Metric + HasRoutesReceived() bool + // RouteWithdrawsSent returns uint64, set in Bgpv6Metric. + RouteWithdrawsSent() uint64 + // SetRouteWithdrawsSent assigns uint64 provided by user to Bgpv6Metric + SetRouteWithdrawsSent(value uint64) Bgpv6Metric + // HasRouteWithdrawsSent checks if RouteWithdrawsSent has been set in Bgpv6Metric + HasRouteWithdrawsSent() bool + // RouteWithdrawsReceived returns uint64, set in Bgpv6Metric. + RouteWithdrawsReceived() uint64 + // SetRouteWithdrawsReceived assigns uint64 provided by user to Bgpv6Metric + SetRouteWithdrawsReceived(value uint64) Bgpv6Metric + // HasRouteWithdrawsReceived checks if RouteWithdrawsReceived has been set in Bgpv6Metric + HasRouteWithdrawsReceived() bool + // UpdatesSent returns uint64, set in Bgpv6Metric. + UpdatesSent() uint64 + // SetUpdatesSent assigns uint64 provided by user to Bgpv6Metric + SetUpdatesSent(value uint64) Bgpv6Metric + // HasUpdatesSent checks if UpdatesSent has been set in Bgpv6Metric + HasUpdatesSent() bool + // UpdatesReceived returns uint64, set in Bgpv6Metric. + UpdatesReceived() uint64 + // SetUpdatesReceived assigns uint64 provided by user to Bgpv6Metric + SetUpdatesReceived(value uint64) Bgpv6Metric + // HasUpdatesReceived checks if UpdatesReceived has been set in Bgpv6Metric + HasUpdatesReceived() bool + // OpensSent returns uint64, set in Bgpv6Metric. + OpensSent() uint64 + // SetOpensSent assigns uint64 provided by user to Bgpv6Metric + SetOpensSent(value uint64) Bgpv6Metric + // HasOpensSent checks if OpensSent has been set in Bgpv6Metric + HasOpensSent() bool + // OpensReceived returns uint64, set in Bgpv6Metric. + OpensReceived() uint64 + // SetOpensReceived assigns uint64 provided by user to Bgpv6Metric + SetOpensReceived(value uint64) Bgpv6Metric + // HasOpensReceived checks if OpensReceived has been set in Bgpv6Metric + HasOpensReceived() bool + // KeepalivesSent returns uint64, set in Bgpv6Metric. + KeepalivesSent() uint64 + // SetKeepalivesSent assigns uint64 provided by user to Bgpv6Metric + SetKeepalivesSent(value uint64) Bgpv6Metric + // HasKeepalivesSent checks if KeepalivesSent has been set in Bgpv6Metric + HasKeepalivesSent() bool + // KeepalivesReceived returns uint64, set in Bgpv6Metric. + KeepalivesReceived() uint64 + // SetKeepalivesReceived assigns uint64 provided by user to Bgpv6Metric + SetKeepalivesReceived(value uint64) Bgpv6Metric + // HasKeepalivesReceived checks if KeepalivesReceived has been set in Bgpv6Metric + HasKeepalivesReceived() bool + // NotificationsSent returns uint64, set in Bgpv6Metric. + NotificationsSent() uint64 + // SetNotificationsSent assigns uint64 provided by user to Bgpv6Metric + SetNotificationsSent(value uint64) Bgpv6Metric + // HasNotificationsSent checks if NotificationsSent has been set in Bgpv6Metric + HasNotificationsSent() bool + // NotificationsReceived returns uint64, set in Bgpv6Metric. + NotificationsReceived() uint64 + // SetNotificationsReceived assigns uint64 provided by user to Bgpv6Metric + SetNotificationsReceived(value uint64) Bgpv6Metric + // HasNotificationsReceived checks if NotificationsReceived has been set in Bgpv6Metric + HasNotificationsReceived() bool + // FsmState returns Bgpv6MetricFsmStateEnum, set in Bgpv6Metric + FsmState() Bgpv6MetricFsmStateEnum + // SetFsmState assigns Bgpv6MetricFsmStateEnum provided by user to Bgpv6Metric + SetFsmState(value Bgpv6MetricFsmStateEnum) Bgpv6Metric + // HasFsmState checks if FsmState has been set in Bgpv6Metric + HasFsmState() bool + // EndOfRibReceived returns uint64, set in Bgpv6Metric. + EndOfRibReceived() uint64 + // SetEndOfRibReceived assigns uint64 provided by user to Bgpv6Metric + SetEndOfRibReceived(value uint64) Bgpv6Metric + // HasEndOfRibReceived checks if EndOfRibReceived has been set in Bgpv6Metric + HasEndOfRibReceived() bool +} + +// The name of a configured BGPv6 peer. +// Name returns a string +func (obj *bgpv6Metric) Name() string { + + return *obj.obj.Name + +} + +// The name of a configured BGPv6 peer. +// Name returns a string +func (obj *bgpv6Metric) HasName() bool { + return obj.obj.Name != nil +} + +// The name of a configured BGPv6 peer. +// SetName sets the string value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetName(value string) Bgpv6Metric { + + obj.obj.Name = &value + return obj +} + +type Bgpv6MetricSessionStateEnum string + +// Enum of SessionState on Bgpv6Metric +var Bgpv6MetricSessionState = struct { + UP Bgpv6MetricSessionStateEnum + DOWN Bgpv6MetricSessionStateEnum +}{ + UP: Bgpv6MetricSessionStateEnum("up"), + DOWN: Bgpv6MetricSessionStateEnum("down"), +} + +func (obj *bgpv6Metric) SessionState() Bgpv6MetricSessionStateEnum { + return Bgpv6MetricSessionStateEnum(obj.obj.SessionState.Enum().String()) +} + +// Session state as up or down. Up refers to an Established state and Down refers to any other state. +// SessionState returns a string +func (obj *bgpv6Metric) HasSessionState() bool { + return obj.obj.SessionState != nil +} + +func (obj *bgpv6Metric) SetSessionState(value Bgpv6MetricSessionStateEnum) Bgpv6Metric { + intValue, ok := otg.Bgpv6Metric_SessionState_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on Bgpv6MetricSessionStateEnum", string(value))) + return obj + } + enumValue := otg.Bgpv6Metric_SessionState_Enum(intValue) + obj.obj.SessionState = &enumValue + + return obj +} + +// Number of times the session went from Up to Down state. +// SessionFlapCount returns a uint64 +func (obj *bgpv6Metric) SessionFlapCount() uint64 { + + return *obj.obj.SessionFlapCount + +} + +// Number of times the session went from Up to Down state. +// SessionFlapCount returns a uint64 +func (obj *bgpv6Metric) HasSessionFlapCount() bool { + return obj.obj.SessionFlapCount != nil +} + +// Number of times the session went from Up to Down state. +// SetSessionFlapCount sets the uint64 value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetSessionFlapCount(value uint64) Bgpv6Metric { + + obj.obj.SessionFlapCount = &value + return obj +} + +// Number of routes advertised. +// RoutesAdvertised returns a uint64 +func (obj *bgpv6Metric) RoutesAdvertised() uint64 { + + return *obj.obj.RoutesAdvertised + +} + +// Number of routes advertised. +// RoutesAdvertised returns a uint64 +func (obj *bgpv6Metric) HasRoutesAdvertised() bool { + return obj.obj.RoutesAdvertised != nil +} + +// Number of routes advertised. +// SetRoutesAdvertised sets the uint64 value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetRoutesAdvertised(value uint64) Bgpv6Metric { + + obj.obj.RoutesAdvertised = &value + return obj +} + +// Number of routes received. +// RoutesReceived returns a uint64 +func (obj *bgpv6Metric) RoutesReceived() uint64 { + + return *obj.obj.RoutesReceived + +} + +// Number of routes received. +// RoutesReceived returns a uint64 +func (obj *bgpv6Metric) HasRoutesReceived() bool { + return obj.obj.RoutesReceived != nil +} + +// Number of routes received. +// SetRoutesReceived sets the uint64 value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetRoutesReceived(value uint64) Bgpv6Metric { + + obj.obj.RoutesReceived = &value + return obj +} + +// Number of route withdraws sent. +// RouteWithdrawsSent returns a uint64 +func (obj *bgpv6Metric) RouteWithdrawsSent() uint64 { + + return *obj.obj.RouteWithdrawsSent + +} + +// Number of route withdraws sent. +// RouteWithdrawsSent returns a uint64 +func (obj *bgpv6Metric) HasRouteWithdrawsSent() bool { + return obj.obj.RouteWithdrawsSent != nil +} + +// Number of route withdraws sent. +// SetRouteWithdrawsSent sets the uint64 value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetRouteWithdrawsSent(value uint64) Bgpv6Metric { + + obj.obj.RouteWithdrawsSent = &value + return obj +} + +// Number of route withdraws received. +// RouteWithdrawsReceived returns a uint64 +func (obj *bgpv6Metric) RouteWithdrawsReceived() uint64 { + + return *obj.obj.RouteWithdrawsReceived + +} + +// Number of route withdraws received. +// RouteWithdrawsReceived returns a uint64 +func (obj *bgpv6Metric) HasRouteWithdrawsReceived() bool { + return obj.obj.RouteWithdrawsReceived != nil +} + +// Number of route withdraws received. +// SetRouteWithdrawsReceived sets the uint64 value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetRouteWithdrawsReceived(value uint64) Bgpv6Metric { + + obj.obj.RouteWithdrawsReceived = &value + return obj +} + +// Number of Update messages sent. +// UpdatesSent returns a uint64 +func (obj *bgpv6Metric) UpdatesSent() uint64 { + + return *obj.obj.UpdatesSent + +} + +// Number of Update messages sent. +// UpdatesSent returns a uint64 +func (obj *bgpv6Metric) HasUpdatesSent() bool { + return obj.obj.UpdatesSent != nil +} + +// Number of Update messages sent. +// SetUpdatesSent sets the uint64 value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetUpdatesSent(value uint64) Bgpv6Metric { + + obj.obj.UpdatesSent = &value + return obj +} + +// Number of Update messages received. +// UpdatesReceived returns a uint64 +func (obj *bgpv6Metric) UpdatesReceived() uint64 { + + return *obj.obj.UpdatesReceived + +} + +// Number of Update messages received. +// UpdatesReceived returns a uint64 +func (obj *bgpv6Metric) HasUpdatesReceived() bool { + return obj.obj.UpdatesReceived != nil +} + +// Number of Update messages received. +// SetUpdatesReceived sets the uint64 value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetUpdatesReceived(value uint64) Bgpv6Metric { + + obj.obj.UpdatesReceived = &value + return obj +} + +// Number of Open messages sent. +// OpensSent returns a uint64 +func (obj *bgpv6Metric) OpensSent() uint64 { + + return *obj.obj.OpensSent + +} + +// Number of Open messages sent. +// OpensSent returns a uint64 +func (obj *bgpv6Metric) HasOpensSent() bool { + return obj.obj.OpensSent != nil +} + +// Number of Open messages sent. +// SetOpensSent sets the uint64 value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetOpensSent(value uint64) Bgpv6Metric { + + obj.obj.OpensSent = &value + return obj +} + +// Number of Open messages received. +// OpensReceived returns a uint64 +func (obj *bgpv6Metric) OpensReceived() uint64 { + + return *obj.obj.OpensReceived + +} + +// Number of Open messages received. +// OpensReceived returns a uint64 +func (obj *bgpv6Metric) HasOpensReceived() bool { + return obj.obj.OpensReceived != nil +} + +// Number of Open messages received. +// SetOpensReceived sets the uint64 value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetOpensReceived(value uint64) Bgpv6Metric { + + obj.obj.OpensReceived = &value + return obj +} + +// Number of Keepalive messages sent. +// KeepalivesSent returns a uint64 +func (obj *bgpv6Metric) KeepalivesSent() uint64 { + + return *obj.obj.KeepalivesSent + +} + +// Number of Keepalive messages sent. +// KeepalivesSent returns a uint64 +func (obj *bgpv6Metric) HasKeepalivesSent() bool { + return obj.obj.KeepalivesSent != nil +} + +// Number of Keepalive messages sent. +// SetKeepalivesSent sets the uint64 value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetKeepalivesSent(value uint64) Bgpv6Metric { + + obj.obj.KeepalivesSent = &value + return obj +} + +// Number of Keepalive messages received. +// KeepalivesReceived returns a uint64 +func (obj *bgpv6Metric) KeepalivesReceived() uint64 { + + return *obj.obj.KeepalivesReceived + +} + +// Number of Keepalive messages received. +// KeepalivesReceived returns a uint64 +func (obj *bgpv6Metric) HasKeepalivesReceived() bool { + return obj.obj.KeepalivesReceived != nil +} + +// Number of Keepalive messages received. +// SetKeepalivesReceived sets the uint64 value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetKeepalivesReceived(value uint64) Bgpv6Metric { + + obj.obj.KeepalivesReceived = &value + return obj +} + +// Number of Notification messages sent. +// NotificationsSent returns a uint64 +func (obj *bgpv6Metric) NotificationsSent() uint64 { + + return *obj.obj.NotificationsSent + +} + +// Number of Notification messages sent. +// NotificationsSent returns a uint64 +func (obj *bgpv6Metric) HasNotificationsSent() bool { + return obj.obj.NotificationsSent != nil +} + +// Number of Notification messages sent. +// SetNotificationsSent sets the uint64 value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetNotificationsSent(value uint64) Bgpv6Metric { + + obj.obj.NotificationsSent = &value + return obj +} + +// Number of Notification messages received. +// NotificationsReceived returns a uint64 +func (obj *bgpv6Metric) NotificationsReceived() uint64 { + + return *obj.obj.NotificationsReceived + +} + +// Number of Notification messages received. +// NotificationsReceived returns a uint64 +func (obj *bgpv6Metric) HasNotificationsReceived() bool { + return obj.obj.NotificationsReceived != nil +} + +// Number of Notification messages received. +// SetNotificationsReceived sets the uint64 value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetNotificationsReceived(value uint64) Bgpv6Metric { + + obj.obj.NotificationsReceived = &value + return obj +} + +type Bgpv6MetricFsmStateEnum string + +// Enum of FsmState on Bgpv6Metric +var Bgpv6MetricFsmState = struct { + IDLE Bgpv6MetricFsmStateEnum + CONNECT Bgpv6MetricFsmStateEnum + ACTIVE Bgpv6MetricFsmStateEnum + OPENSENT Bgpv6MetricFsmStateEnum + OPENCONFIRM Bgpv6MetricFsmStateEnum + ESTABLISHED Bgpv6MetricFsmStateEnum +}{ + IDLE: Bgpv6MetricFsmStateEnum("idle"), + CONNECT: Bgpv6MetricFsmStateEnum("connect"), + ACTIVE: Bgpv6MetricFsmStateEnum("active"), + OPENSENT: Bgpv6MetricFsmStateEnum("opensent"), + OPENCONFIRM: Bgpv6MetricFsmStateEnum("openconfirm"), + ESTABLISHED: Bgpv6MetricFsmStateEnum("established"), +} + +func (obj *bgpv6Metric) FsmState() Bgpv6MetricFsmStateEnum { + return Bgpv6MetricFsmStateEnum(obj.obj.FsmState.Enum().String()) +} + +// BGP peer FSM (Finite State Machine) state as Idle, Connect, Active, OpenSent, OpenConfirm and Established. In all the states except Established the BGP session is down. Idle refers to the Idle state of the FSM. Connect refers to the state where the session is waiting for the underlying transport session to be established. Active refers to the state where the session is awaiting for a connection from the remote peer. OpenSent refers to the state where the session is in the process of being established. The local system has sent an OPEN message. OpenConfirm refers to the state where the session is in the process of being established. The local system has sent and received an OPEN message and is awaiting a NOTIFICATION or KEEPALIVE message from remote peer. Established refers to the state where the BGP session with the peer is established. +// FsmState returns a string +func (obj *bgpv6Metric) HasFsmState() bool { + return obj.obj.FsmState != nil +} + +func (obj *bgpv6Metric) SetFsmState(value Bgpv6MetricFsmStateEnum) Bgpv6Metric { + intValue, ok := otg.Bgpv6Metric_FsmState_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on Bgpv6MetricFsmStateEnum", string(value))) + return obj + } + enumValue := otg.Bgpv6Metric_FsmState_Enum(intValue) + obj.obj.FsmState = &enumValue + + return obj +} + +// Number of End-of-RIB markers received indicating the completion of the initial routing update for a particular address family after the session is established. For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message with the minimum length. For any other address family, it is an UPDATE message that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for that . +// EndOfRibReceived returns a uint64 +func (obj *bgpv6Metric) EndOfRibReceived() uint64 { + + return *obj.obj.EndOfRibReceived + +} + +// Number of End-of-RIB markers received indicating the completion of the initial routing update for a particular address family after the session is established. For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message with the minimum length. For any other address family, it is an UPDATE message that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for that . +// EndOfRibReceived returns a uint64 +func (obj *bgpv6Metric) HasEndOfRibReceived() bool { + return obj.obj.EndOfRibReceived != nil +} + +// Number of End-of-RIB markers received indicating the completion of the initial routing update for a particular address family after the session is established. For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message with the minimum length. For any other address family, it is an UPDATE message that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for that . +// SetEndOfRibReceived sets the uint64 value in the Bgpv6Metric object +func (obj *bgpv6Metric) SetEndOfRibReceived(value uint64) Bgpv6Metric { + + obj.obj.EndOfRibReceived = &value + return obj +} + +func (obj *bgpv6Metric) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpv6Metric) setDefault() { + +} diff --git a/gosnappi/bgpv6_metrics_request.go b/gosnappi/bgpv6_metrics_request.go new file mode 100644 index 00000000..7d8f89e2 --- /dev/null +++ b/gosnappi/bgpv6_metrics_request.go @@ -0,0 +1,381 @@ +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" +) + +// ***** Bgpv6MetricsRequest ***** +type bgpv6MetricsRequest struct { + validation + obj *otg.Bgpv6MetricsRequest + marshaller marshalBgpv6MetricsRequest + unMarshaller unMarshalBgpv6MetricsRequest +} + +func NewBgpv6MetricsRequest() Bgpv6MetricsRequest { + obj := bgpv6MetricsRequest{obj: &otg.Bgpv6MetricsRequest{}} + obj.setDefault() + return &obj +} + +func (obj *bgpv6MetricsRequest) msg() *otg.Bgpv6MetricsRequest { + return obj.obj +} + +func (obj *bgpv6MetricsRequest) setMsg(msg *otg.Bgpv6MetricsRequest) Bgpv6MetricsRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalbgpv6MetricsRequest struct { + obj *bgpv6MetricsRequest +} + +type marshalBgpv6MetricsRequest interface { + // ToProto marshals Bgpv6MetricsRequest to protobuf object *otg.Bgpv6MetricsRequest + ToProto() (*otg.Bgpv6MetricsRequest, error) + // ToPbText marshals Bgpv6MetricsRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals Bgpv6MetricsRequest to YAML text + ToYaml() (string, error) + // ToJson marshals Bgpv6MetricsRequest to JSON text + ToJson() (string, error) +} + +type unMarshalbgpv6MetricsRequest struct { + obj *bgpv6MetricsRequest +} + +type unMarshalBgpv6MetricsRequest interface { + // FromProto unmarshals Bgpv6MetricsRequest from protobuf object *otg.Bgpv6MetricsRequest + FromProto(msg *otg.Bgpv6MetricsRequest) (Bgpv6MetricsRequest, error) + // FromPbText unmarshals Bgpv6MetricsRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Bgpv6MetricsRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals Bgpv6MetricsRequest from JSON text + FromJson(value string) error +} + +func (obj *bgpv6MetricsRequest) Marshal() marshalBgpv6MetricsRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalbgpv6MetricsRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *bgpv6MetricsRequest) Unmarshal() unMarshalBgpv6MetricsRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalbgpv6MetricsRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalbgpv6MetricsRequest) ToProto() (*otg.Bgpv6MetricsRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalbgpv6MetricsRequest) FromProto(msg *otg.Bgpv6MetricsRequest) (Bgpv6MetricsRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalbgpv6MetricsRequest) 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 *unMarshalbgpv6MetricsRequest) 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 *marshalbgpv6MetricsRequest) 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 *unMarshalbgpv6MetricsRequest) 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 *marshalbgpv6MetricsRequest) 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 *unMarshalbgpv6MetricsRequest) 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 *bgpv6MetricsRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *bgpv6MetricsRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *bgpv6MetricsRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *bgpv6MetricsRequest) Clone() (Bgpv6MetricsRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewBgpv6MetricsRequest() + 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 +} + +// Bgpv6MetricsRequest is the request to retrieve BGPv6 per peer metrics/statistics. +type Bgpv6MetricsRequest interface { + Validation + // msg marshals Bgpv6MetricsRequest to protobuf object *otg.Bgpv6MetricsRequest + // and doesn't set defaults + msg() *otg.Bgpv6MetricsRequest + // setMsg unmarshals Bgpv6MetricsRequest from protobuf object *otg.Bgpv6MetricsRequest + // and doesn't set defaults + setMsg(*otg.Bgpv6MetricsRequest) Bgpv6MetricsRequest + // provides marshal interface + Marshal() marshalBgpv6MetricsRequest + // provides unmarshal interface + Unmarshal() unMarshalBgpv6MetricsRequest + // validate validates Bgpv6MetricsRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Bgpv6MetricsRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PeerNames returns []string, set in Bgpv6MetricsRequest. + PeerNames() []string + // SetPeerNames assigns []string provided by user to Bgpv6MetricsRequest + SetPeerNames(value []string) Bgpv6MetricsRequest + // ColumnNames returns []Bgpv6MetricsRequestColumnNamesEnum, set in Bgpv6MetricsRequest + ColumnNames() []Bgpv6MetricsRequestColumnNamesEnum + // SetColumnNames assigns []Bgpv6MetricsRequestColumnNamesEnum provided by user to Bgpv6MetricsRequest + SetColumnNames(value []Bgpv6MetricsRequestColumnNamesEnum) Bgpv6MetricsRequest +} + +// The names of BGPv6 peers to return results for. An empty list will return results for all BGPv6 peers. +// +// x-constraint: +// - /components/schemas/Bgp.V6peer/properties/name +// +// x-constraint: +// - /components/schemas/Bgp.V6peer/properties/name +// +// PeerNames returns a []string +func (obj *bgpv6MetricsRequest) PeerNames() []string { + if obj.obj.PeerNames == nil { + obj.obj.PeerNames = make([]string, 0) + } + return obj.obj.PeerNames +} + +// The names of BGPv6 peers to return results for. An empty list will return results for all BGPv6 peers. +// +// x-constraint: +// - /components/schemas/Bgp.V6peer/properties/name +// +// x-constraint: +// - /components/schemas/Bgp.V6peer/properties/name +// +// SetPeerNames sets the []string value in the Bgpv6MetricsRequest object +func (obj *bgpv6MetricsRequest) SetPeerNames(value []string) Bgpv6MetricsRequest { + + if obj.obj.PeerNames == nil { + obj.obj.PeerNames = make([]string, 0) + } + obj.obj.PeerNames = value + + return obj +} + +type Bgpv6MetricsRequestColumnNamesEnum string + +// Enum of ColumnNames on Bgpv6MetricsRequest +var Bgpv6MetricsRequestColumnNames = struct { + SESSION_STATE Bgpv6MetricsRequestColumnNamesEnum + SESSION_FLAP_COUNT Bgpv6MetricsRequestColumnNamesEnum + ROUTES_ADVERTISED Bgpv6MetricsRequestColumnNamesEnum + ROUTES_RECEIVED Bgpv6MetricsRequestColumnNamesEnum + ROUTE_WITHDRAWS_SENT Bgpv6MetricsRequestColumnNamesEnum + ROUTE_WITHDRAWS_RECEIVED Bgpv6MetricsRequestColumnNamesEnum + UPDATES_SENT Bgpv6MetricsRequestColumnNamesEnum + UPDATES_RECEIVED Bgpv6MetricsRequestColumnNamesEnum + OPENS_SENT Bgpv6MetricsRequestColumnNamesEnum + OPENS_RECEIVED Bgpv6MetricsRequestColumnNamesEnum + KEEPALIVES_SENT Bgpv6MetricsRequestColumnNamesEnum + KEEPALIVES_RECEIVED Bgpv6MetricsRequestColumnNamesEnum + NOTIFICATIONS_SENT Bgpv6MetricsRequestColumnNamesEnum + NOTIFICATIONS_RECEIVED Bgpv6MetricsRequestColumnNamesEnum + FSM_STATE Bgpv6MetricsRequestColumnNamesEnum + END_OF_RIB_RECEIVED Bgpv6MetricsRequestColumnNamesEnum +}{ + SESSION_STATE: Bgpv6MetricsRequestColumnNamesEnum("session_state"), + SESSION_FLAP_COUNT: Bgpv6MetricsRequestColumnNamesEnum("session_flap_count"), + ROUTES_ADVERTISED: Bgpv6MetricsRequestColumnNamesEnum("routes_advertised"), + ROUTES_RECEIVED: Bgpv6MetricsRequestColumnNamesEnum("routes_received"), + ROUTE_WITHDRAWS_SENT: Bgpv6MetricsRequestColumnNamesEnum("route_withdraws_sent"), + ROUTE_WITHDRAWS_RECEIVED: Bgpv6MetricsRequestColumnNamesEnum("route_withdraws_received"), + UPDATES_SENT: Bgpv6MetricsRequestColumnNamesEnum("updates_sent"), + UPDATES_RECEIVED: Bgpv6MetricsRequestColumnNamesEnum("updates_received"), + OPENS_SENT: Bgpv6MetricsRequestColumnNamesEnum("opens_sent"), + OPENS_RECEIVED: Bgpv6MetricsRequestColumnNamesEnum("opens_received"), + KEEPALIVES_SENT: Bgpv6MetricsRequestColumnNamesEnum("keepalives_sent"), + KEEPALIVES_RECEIVED: Bgpv6MetricsRequestColumnNamesEnum("keepalives_received"), + NOTIFICATIONS_SENT: Bgpv6MetricsRequestColumnNamesEnum("notifications_sent"), + NOTIFICATIONS_RECEIVED: Bgpv6MetricsRequestColumnNamesEnum("notifications_received"), + FSM_STATE: Bgpv6MetricsRequestColumnNamesEnum("fsm_state"), + END_OF_RIB_RECEIVED: Bgpv6MetricsRequestColumnNamesEnum("end_of_rib_received"), +} + +func (obj *bgpv6MetricsRequest) ColumnNames() []Bgpv6MetricsRequestColumnNamesEnum { + items := []Bgpv6MetricsRequestColumnNamesEnum{} + for _, item := range obj.obj.ColumnNames { + items = append(items, Bgpv6MetricsRequestColumnNamesEnum(item.String())) + } + return items +} + +// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned except for any result_groups. The name of the BGPv6 peer cannot be excluded. +// SetColumnNames sets the []string value in the Bgpv6MetricsRequest object +func (obj *bgpv6MetricsRequest) SetColumnNames(value []Bgpv6MetricsRequestColumnNamesEnum) Bgpv6MetricsRequest { + + items := []otg.Bgpv6MetricsRequest_ColumnNames_Enum{} + for _, item := range value { + intValue := otg.Bgpv6MetricsRequest_ColumnNames_Enum_value[string(item)] + items = append(items, otg.Bgpv6MetricsRequest_ColumnNames_Enum(intValue)) + } + obj.obj.ColumnNames = items + return obj +} + +func (obj *bgpv6MetricsRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *bgpv6MetricsRequest) setDefault() { + +} diff --git a/gosnappi/capture.go b/gosnappi/capture.go new file mode 100644 index 00000000..b3254ee4 --- /dev/null +++ b/gosnappi/capture.go @@ -0,0 +1,573 @@ +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" +) + +// ***** Capture ***** +type capture struct { + validation + obj *otg.Capture + marshaller marshalCapture + unMarshaller unMarshalCapture + filtersHolder CaptureCaptureFilterIter +} + +func NewCapture() Capture { + obj := capture{obj: &otg.Capture{}} + obj.setDefault() + return &obj +} + +func (obj *capture) msg() *otg.Capture { + return obj.obj +} + +func (obj *capture) setMsg(msg *otg.Capture) Capture { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalcapture struct { + obj *capture +} + +type marshalCapture interface { + // ToProto marshals Capture to protobuf object *otg.Capture + ToProto() (*otg.Capture, error) + // ToPbText marshals Capture to protobuf text + ToPbText() (string, error) + // ToYaml marshals Capture to YAML text + ToYaml() (string, error) + // ToJson marshals Capture to JSON text + ToJson() (string, error) +} + +type unMarshalcapture struct { + obj *capture +} + +type unMarshalCapture interface { + // FromProto unmarshals Capture from protobuf object *otg.Capture + FromProto(msg *otg.Capture) (Capture, error) + // FromPbText unmarshals Capture from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Capture from YAML text + FromYaml(value string) error + // FromJson unmarshals Capture from JSON text + FromJson(value string) error +} + +func (obj *capture) Marshal() marshalCapture { + if obj.marshaller == nil { + obj.marshaller = &marshalcapture{obj: obj} + } + return obj.marshaller +} + +func (obj *capture) Unmarshal() unMarshalCapture { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalcapture{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalcapture) ToProto() (*otg.Capture, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalcapture) FromProto(msg *otg.Capture) (Capture, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalcapture) 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 *unMarshalcapture) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalcapture) 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 *unMarshalcapture) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalcapture) 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 *unMarshalcapture) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *capture) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *capture) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *capture) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *capture) Clone() (Capture, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewCapture() + 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 +} + +func (obj *capture) setNil() { + obj.filtersHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// Capture is under Review: There may be changes in filter configuration +// +// Under Review: There may be changes in filter configuration +// +// Configuration for capture settings. +type Capture interface { + Validation + // msg marshals Capture to protobuf object *otg.Capture + // and doesn't set defaults + msg() *otg.Capture + // setMsg unmarshals Capture from protobuf object *otg.Capture + // and doesn't set defaults + setMsg(*otg.Capture) Capture + // provides marshal interface + Marshal() marshalCapture + // provides unmarshal interface + Unmarshal() unMarshalCapture + // validate validates Capture + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Capture, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PortNames returns []string, set in Capture. + PortNames() []string + // SetPortNames assigns []string provided by user to Capture + SetPortNames(value []string) Capture + // Filters returns CaptureCaptureFilterIterIter, set in Capture + Filters() CaptureCaptureFilterIter + // Overwrite returns bool, set in Capture. + Overwrite() bool + // SetOverwrite assigns bool provided by user to Capture + SetOverwrite(value bool) Capture + // HasOverwrite checks if Overwrite has been set in Capture + HasOverwrite() bool + // PacketSize returns uint32, set in Capture. + PacketSize() uint32 + // SetPacketSize assigns uint32 provided by user to Capture + SetPacketSize(value uint32) Capture + // HasPacketSize checks if PacketSize has been set in Capture + HasPacketSize() bool + // Format returns CaptureFormatEnum, set in Capture + Format() CaptureFormatEnum + // SetFormat assigns CaptureFormatEnum provided by user to Capture + SetFormat(value CaptureFormatEnum) Capture + // HasFormat checks if Format has been set in Capture + HasFormat() bool + // Name returns string, set in Capture. + Name() string + // SetName assigns string provided by user to Capture + SetName(value string) Capture + setNil() +} + +// The unique names of ports that the capture settings will apply to. Port_names cannot be duplicated between capture objects. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// PortNames returns a []string +func (obj *capture) PortNames() []string { + if obj.obj.PortNames == nil { + obj.obj.PortNames = make([]string, 0) + } + return obj.obj.PortNames +} + +// The unique names of ports that the capture settings will apply to. Port_names cannot be duplicated between capture objects. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// SetPortNames sets the []string value in the Capture object +func (obj *capture) SetPortNames(value []string) Capture { + + if obj.obj.PortNames == nil { + obj.obj.PortNames = make([]string, 0) + } + obj.obj.PortNames = value + + return obj +} + +// A list of filters to apply to the capturing ports. If no filters are specified then all packets will be captured. A capture can have multiple filters. The number of filters supported is determined by the implementation which can be retrieved using the capabilities API. +// When multiple filters are specified the capture implementation must && (and) all the filters. +// Filters returns a []CaptureFilter +func (obj *capture) Filters() CaptureCaptureFilterIter { + if len(obj.obj.Filters) == 0 { + obj.obj.Filters = []*otg.CaptureFilter{} + } + if obj.filtersHolder == nil { + obj.filtersHolder = newCaptureCaptureFilterIter(&obj.obj.Filters).setMsg(obj) + } + return obj.filtersHolder +} + +type captureCaptureFilterIter struct { + obj *capture + captureFilterSlice []CaptureFilter + fieldPtr *[]*otg.CaptureFilter +} + +func newCaptureCaptureFilterIter(ptr *[]*otg.CaptureFilter) CaptureCaptureFilterIter { + return &captureCaptureFilterIter{fieldPtr: ptr} +} + +type CaptureCaptureFilterIter interface { + setMsg(*capture) CaptureCaptureFilterIter + Items() []CaptureFilter + Add() CaptureFilter + Append(items ...CaptureFilter) CaptureCaptureFilterIter + Set(index int, newObj CaptureFilter) CaptureCaptureFilterIter + Clear() CaptureCaptureFilterIter + clearHolderSlice() CaptureCaptureFilterIter + appendHolderSlice(item CaptureFilter) CaptureCaptureFilterIter +} + +func (obj *captureCaptureFilterIter) setMsg(msg *capture) CaptureCaptureFilterIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&captureFilter{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *captureCaptureFilterIter) Items() []CaptureFilter { + return obj.captureFilterSlice +} + +func (obj *captureCaptureFilterIter) Add() CaptureFilter { + newObj := &otg.CaptureFilter{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &captureFilter{obj: newObj} + newLibObj.setDefault() + obj.captureFilterSlice = append(obj.captureFilterSlice, newLibObj) + return newLibObj +} + +func (obj *captureCaptureFilterIter) Append(items ...CaptureFilter) CaptureCaptureFilterIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.captureFilterSlice = append(obj.captureFilterSlice, item) + } + return obj +} + +func (obj *captureCaptureFilterIter) Set(index int, newObj CaptureFilter) CaptureCaptureFilterIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.captureFilterSlice[index] = newObj + return obj +} +func (obj *captureCaptureFilterIter) Clear() CaptureCaptureFilterIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.CaptureFilter{} + obj.captureFilterSlice = []CaptureFilter{} + } + return obj +} +func (obj *captureCaptureFilterIter) clearHolderSlice() CaptureCaptureFilterIter { + if len(obj.captureFilterSlice) > 0 { + obj.captureFilterSlice = []CaptureFilter{} + } + return obj +} +func (obj *captureCaptureFilterIter) appendHolderSlice(item CaptureFilter) CaptureCaptureFilterIter { + obj.captureFilterSlice = append(obj.captureFilterSlice, item) + return obj +} + +// Overwrite the capture buffer. +// Overwrite returns a bool +func (obj *capture) Overwrite() bool { + + return *obj.obj.Overwrite + +} + +// Overwrite the capture buffer. +// Overwrite returns a bool +func (obj *capture) HasOverwrite() bool { + return obj.obj.Overwrite != nil +} + +// Overwrite the capture buffer. +// SetOverwrite sets the bool value in the Capture object +func (obj *capture) SetOverwrite(value bool) Capture { + + obj.obj.Overwrite = &value + return obj +} + +// The maximum size of each captured packet. If no value is specified or it is null then the entire packet will be captured. +// PacketSize returns a uint32 +func (obj *capture) PacketSize() uint32 { + + return *obj.obj.PacketSize + +} + +// The maximum size of each captured packet. If no value is specified or it is null then the entire packet will be captured. +// PacketSize returns a uint32 +func (obj *capture) HasPacketSize() bool { + return obj.obj.PacketSize != nil +} + +// The maximum size of each captured packet. If no value is specified or it is null then the entire packet will be captured. +// SetPacketSize sets the uint32 value in the Capture object +func (obj *capture) SetPacketSize(value uint32) Capture { + + obj.obj.PacketSize = &value + return obj +} + +type CaptureFormatEnum string + +// Enum of Format on Capture +var CaptureFormat = struct { + PCAP CaptureFormatEnum + PCAPNG CaptureFormatEnum +}{ + PCAP: CaptureFormatEnum("pcap"), + PCAPNG: CaptureFormatEnum("pcapng"), +} + +func (obj *capture) Format() CaptureFormatEnum { + return CaptureFormatEnum(obj.obj.Format.Enum().String()) +} + +// The format of the capture file. +// Format returns a string +func (obj *capture) HasFormat() bool { + return obj.obj.Format != nil +} + +func (obj *capture) SetFormat(value CaptureFormatEnum) Capture { + intValue, ok := otg.Capture_Format_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on CaptureFormatEnum", string(value))) + return obj + } + enumValue := otg.Capture_Format_Enum(intValue) + obj.obj.Format = &enumValue + + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *capture) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the Capture object +func (obj *capture) SetName(value string) Capture { + + obj.obj.Name = &value + return obj +} + +func (obj *capture) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + obj.addWarnings("Capture is under review, There may be changes in filter configuration") + + if len(obj.obj.Filters) != 0 { + + if set_default { + obj.Filters().clearHolderSlice() + for _, item := range obj.obj.Filters { + obj.Filters().appendHolderSlice(&captureFilter{obj: item}) + } + } + for _, item := range obj.Filters().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.PacketSize != nil { + + if *obj.obj.PacketSize > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= Capture.PacketSize <= 65535 but Got %d", *obj.obj.PacketSize)) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface Capture") + } +} + +func (obj *capture) setDefault() { + if obj.obj.Overwrite == nil { + obj.SetOverwrite(true) + } + if obj.obj.Format == nil { + obj.SetFormat(CaptureFormat.PCAP) + + } + +} diff --git a/gosnappi/capture_custom.go b/gosnappi/capture_custom.go new file mode 100644 index 00000000..c9929f65 --- /dev/null +++ b/gosnappi/capture_custom.go @@ -0,0 +1,448 @@ +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" +) + +// ***** CaptureCustom ***** +type captureCustom struct { + validation + obj *otg.CaptureCustom + marshaller marshalCaptureCustom + unMarshaller unMarshalCaptureCustom +} + +func NewCaptureCustom() CaptureCustom { + obj := captureCustom{obj: &otg.CaptureCustom{}} + obj.setDefault() + return &obj +} + +func (obj *captureCustom) msg() *otg.CaptureCustom { + return obj.obj +} + +func (obj *captureCustom) setMsg(msg *otg.CaptureCustom) CaptureCustom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalcaptureCustom struct { + obj *captureCustom +} + +type marshalCaptureCustom interface { + // ToProto marshals CaptureCustom to protobuf object *otg.CaptureCustom + ToProto() (*otg.CaptureCustom, error) + // ToPbText marshals CaptureCustom to protobuf text + ToPbText() (string, error) + // ToYaml marshals CaptureCustom to YAML text + ToYaml() (string, error) + // ToJson marshals CaptureCustom to JSON text + ToJson() (string, error) +} + +type unMarshalcaptureCustom struct { + obj *captureCustom +} + +type unMarshalCaptureCustom interface { + // FromProto unmarshals CaptureCustom from protobuf object *otg.CaptureCustom + FromProto(msg *otg.CaptureCustom) (CaptureCustom, error) + // FromPbText unmarshals CaptureCustom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals CaptureCustom from YAML text + FromYaml(value string) error + // FromJson unmarshals CaptureCustom from JSON text + FromJson(value string) error +} + +func (obj *captureCustom) Marshal() marshalCaptureCustom { + if obj.marshaller == nil { + obj.marshaller = &marshalcaptureCustom{obj: obj} + } + return obj.marshaller +} + +func (obj *captureCustom) Unmarshal() unMarshalCaptureCustom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalcaptureCustom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalcaptureCustom) ToProto() (*otg.CaptureCustom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalcaptureCustom) FromProto(msg *otg.CaptureCustom) (CaptureCustom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalcaptureCustom) 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 *unMarshalcaptureCustom) 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 *marshalcaptureCustom) 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 *unMarshalcaptureCustom) 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 *marshalcaptureCustom) 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 *unMarshalcaptureCustom) 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 *captureCustom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *captureCustom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *captureCustom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *captureCustom) Clone() (CaptureCustom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewCaptureCustom() + 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 +} + +// CaptureCustom is description is TBD +type CaptureCustom interface { + Validation + // msg marshals CaptureCustom to protobuf object *otg.CaptureCustom + // and doesn't set defaults + msg() *otg.CaptureCustom + // setMsg unmarshals CaptureCustom from protobuf object *otg.CaptureCustom + // and doesn't set defaults + setMsg(*otg.CaptureCustom) CaptureCustom + // provides marshal interface + Marshal() marshalCaptureCustom + // provides unmarshal interface + Unmarshal() unMarshalCaptureCustom + // validate validates CaptureCustom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (CaptureCustom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Offset returns uint32, set in CaptureCustom. + Offset() uint32 + // SetOffset assigns uint32 provided by user to CaptureCustom + SetOffset(value uint32) CaptureCustom + // HasOffset checks if Offset has been set in CaptureCustom + HasOffset() bool + // BitLength returns uint32, set in CaptureCustom. + BitLength() uint32 + // SetBitLength assigns uint32 provided by user to CaptureCustom + SetBitLength(value uint32) CaptureCustom + // HasBitLength checks if BitLength has been set in CaptureCustom + HasBitLength() bool + // Value returns string, set in CaptureCustom. + Value() string + // SetValue assigns string provided by user to CaptureCustom + SetValue(value string) CaptureCustom + // HasValue checks if Value has been set in CaptureCustom + HasValue() bool + // Mask returns string, set in CaptureCustom. + Mask() string + // SetMask assigns string provided by user to CaptureCustom + SetMask(value string) CaptureCustom + // HasMask checks if Mask has been set in CaptureCustom + HasMask() bool + // Negate returns bool, set in CaptureCustom. + Negate() bool + // SetNegate assigns bool provided by user to CaptureCustom + SetNegate(value bool) CaptureCustom + // HasNegate checks if Negate has been set in CaptureCustom + HasNegate() bool +} + +// The bit offset of field to filter on +// Offset returns a uint32 +func (obj *captureCustom) Offset() uint32 { + + return *obj.obj.Offset + +} + +// The bit offset of field to filter on +// Offset returns a uint32 +func (obj *captureCustom) HasOffset() bool { + return obj.obj.Offset != nil +} + +// The bit offset of field to filter on +// SetOffset sets the uint32 value in the CaptureCustom object +func (obj *captureCustom) SetOffset(value uint32) CaptureCustom { + + obj.obj.Offset = &value + return obj +} + +// The bit length of field to filter on +// BitLength returns a uint32 +func (obj *captureCustom) BitLength() uint32 { + + return *obj.obj.BitLength + +} + +// The bit length of field to filter on +// BitLength returns a uint32 +func (obj *captureCustom) HasBitLength() bool { + return obj.obj.BitLength != nil +} + +// The bit length of field to filter on +// SetBitLength sets the uint32 value in the CaptureCustom object +func (obj *captureCustom) SetBitLength(value uint32) CaptureCustom { + + obj.obj.BitLength = &value + return obj +} + +// description is TBD +// Value returns a string +func (obj *captureCustom) Value() string { + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *captureCustom) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the CaptureCustom object +func (obj *captureCustom) SetValue(value string) CaptureCustom { + + obj.obj.Value = &value + return obj +} + +// description is TBD +// Mask returns a string +func (obj *captureCustom) Mask() string { + + return *obj.obj.Mask + +} + +// description is TBD +// Mask returns a string +func (obj *captureCustom) HasMask() bool { + return obj.obj.Mask != nil +} + +// description is TBD +// SetMask sets the string value in the CaptureCustom object +func (obj *captureCustom) SetMask(value string) CaptureCustom { + + obj.obj.Mask = &value + return obj +} + +// description is TBD +// Negate returns a bool +func (obj *captureCustom) Negate() bool { + + return *obj.obj.Negate + +} + +// description is TBD +// Negate returns a bool +func (obj *captureCustom) HasNegate() bool { + return obj.obj.Negate != nil +} + +// description is TBD +// SetNegate sets the bool value in the CaptureCustom object +func (obj *captureCustom) SetNegate(value bool) CaptureCustom { + + obj.obj.Negate = &value + return obj +} + +func (obj *captureCustom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateHex(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on CaptureCustom.Value")) + } + + } + + if obj.obj.Mask != nil { + + err := obj.validateHex(obj.Mask()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on CaptureCustom.Mask")) + } + + } + +} + +func (obj *captureCustom) setDefault() { + if obj.obj.BitLength == nil { + obj.SetBitLength(8) + } + if obj.obj.Value == nil { + obj.SetValue("00") + } + if obj.obj.Mask == nil { + obj.SetMask("00") + } + if obj.obj.Negate == nil { + obj.SetNegate(false) + } + +} diff --git a/gosnappi/capture_ethernet.go b/gosnappi/capture_ethernet.go new file mode 100644 index 00000000..811737d2 --- /dev/null +++ b/gosnappi/capture_ethernet.go @@ -0,0 +1,457 @@ +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" +) + +// ***** CaptureEthernet ***** +type captureEthernet struct { + validation + obj *otg.CaptureEthernet + marshaller marshalCaptureEthernet + unMarshaller unMarshalCaptureEthernet + srcHolder CaptureField + dstHolder CaptureField + etherTypeHolder CaptureField + pfcQueueHolder CaptureField +} + +func NewCaptureEthernet() CaptureEthernet { + obj := captureEthernet{obj: &otg.CaptureEthernet{}} + obj.setDefault() + return &obj +} + +func (obj *captureEthernet) msg() *otg.CaptureEthernet { + return obj.obj +} + +func (obj *captureEthernet) setMsg(msg *otg.CaptureEthernet) CaptureEthernet { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalcaptureEthernet struct { + obj *captureEthernet +} + +type marshalCaptureEthernet interface { + // ToProto marshals CaptureEthernet to protobuf object *otg.CaptureEthernet + ToProto() (*otg.CaptureEthernet, error) + // ToPbText marshals CaptureEthernet to protobuf text + ToPbText() (string, error) + // ToYaml marshals CaptureEthernet to YAML text + ToYaml() (string, error) + // ToJson marshals CaptureEthernet to JSON text + ToJson() (string, error) +} + +type unMarshalcaptureEthernet struct { + obj *captureEthernet +} + +type unMarshalCaptureEthernet interface { + // FromProto unmarshals CaptureEthernet from protobuf object *otg.CaptureEthernet + FromProto(msg *otg.CaptureEthernet) (CaptureEthernet, error) + // FromPbText unmarshals CaptureEthernet from protobuf text + FromPbText(value string) error + // FromYaml unmarshals CaptureEthernet from YAML text + FromYaml(value string) error + // FromJson unmarshals CaptureEthernet from JSON text + FromJson(value string) error +} + +func (obj *captureEthernet) Marshal() marshalCaptureEthernet { + if obj.marshaller == nil { + obj.marshaller = &marshalcaptureEthernet{obj: obj} + } + return obj.marshaller +} + +func (obj *captureEthernet) Unmarshal() unMarshalCaptureEthernet { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalcaptureEthernet{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalcaptureEthernet) ToProto() (*otg.CaptureEthernet, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalcaptureEthernet) FromProto(msg *otg.CaptureEthernet) (CaptureEthernet, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalcaptureEthernet) 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 *unMarshalcaptureEthernet) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalcaptureEthernet) 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 *unMarshalcaptureEthernet) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalcaptureEthernet) 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 *unMarshalcaptureEthernet) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *captureEthernet) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *captureEthernet) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *captureEthernet) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *captureEthernet) Clone() (CaptureEthernet, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewCaptureEthernet() + 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 +} + +func (obj *captureEthernet) setNil() { + obj.srcHolder = nil + obj.dstHolder = nil + obj.etherTypeHolder = nil + obj.pfcQueueHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// CaptureEthernet is description is TBD +type CaptureEthernet interface { + Validation + // msg marshals CaptureEthernet to protobuf object *otg.CaptureEthernet + // and doesn't set defaults + msg() *otg.CaptureEthernet + // setMsg unmarshals CaptureEthernet from protobuf object *otg.CaptureEthernet + // and doesn't set defaults + setMsg(*otg.CaptureEthernet) CaptureEthernet + // provides marshal interface + Marshal() marshalCaptureEthernet + // provides unmarshal interface + Unmarshal() unMarshalCaptureEthernet + // validate validates CaptureEthernet + validate() error + // A stringer function + String() string + // Clones the object + Clone() (CaptureEthernet, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Src returns CaptureField, set in CaptureEthernet. + // CaptureField is description is TBD + Src() CaptureField + // SetSrc assigns CaptureField provided by user to CaptureEthernet. + // CaptureField is description is TBD + SetSrc(value CaptureField) CaptureEthernet + // HasSrc checks if Src has been set in CaptureEthernet + HasSrc() bool + // Dst returns CaptureField, set in CaptureEthernet. + // CaptureField is description is TBD + Dst() CaptureField + // SetDst assigns CaptureField provided by user to CaptureEthernet. + // CaptureField is description is TBD + SetDst(value CaptureField) CaptureEthernet + // HasDst checks if Dst has been set in CaptureEthernet + HasDst() bool + // EtherType returns CaptureField, set in CaptureEthernet. + // CaptureField is description is TBD + EtherType() CaptureField + // SetEtherType assigns CaptureField provided by user to CaptureEthernet. + // CaptureField is description is TBD + SetEtherType(value CaptureField) CaptureEthernet + // HasEtherType checks if EtherType has been set in CaptureEthernet + HasEtherType() bool + // PfcQueue returns CaptureField, set in CaptureEthernet. + // CaptureField is description is TBD + PfcQueue() CaptureField + // SetPfcQueue assigns CaptureField provided by user to CaptureEthernet. + // CaptureField is description is TBD + SetPfcQueue(value CaptureField) CaptureEthernet + // HasPfcQueue checks if PfcQueue has been set in CaptureEthernet + HasPfcQueue() bool + setNil() +} + +// description is TBD +// Src returns a CaptureField +func (obj *captureEthernet) Src() CaptureField { + if obj.obj.Src == nil { + obj.obj.Src = NewCaptureField().msg() + } + if obj.srcHolder == nil { + obj.srcHolder = &captureField{obj: obj.obj.Src} + } + return obj.srcHolder +} + +// description is TBD +// Src returns a CaptureField +func (obj *captureEthernet) HasSrc() bool { + return obj.obj.Src != nil +} + +// description is TBD +// SetSrc sets the CaptureField value in the CaptureEthernet object +func (obj *captureEthernet) SetSrc(value CaptureField) CaptureEthernet { + + obj.srcHolder = nil + obj.obj.Src = value.msg() + + return obj +} + +// description is TBD +// Dst returns a CaptureField +func (obj *captureEthernet) Dst() CaptureField { + if obj.obj.Dst == nil { + obj.obj.Dst = NewCaptureField().msg() + } + if obj.dstHolder == nil { + obj.dstHolder = &captureField{obj: obj.obj.Dst} + } + return obj.dstHolder +} + +// description is TBD +// Dst returns a CaptureField +func (obj *captureEthernet) HasDst() bool { + return obj.obj.Dst != nil +} + +// description is TBD +// SetDst sets the CaptureField value in the CaptureEthernet object +func (obj *captureEthernet) SetDst(value CaptureField) CaptureEthernet { + + obj.dstHolder = nil + obj.obj.Dst = value.msg() + + return obj +} + +// description is TBD +// EtherType returns a CaptureField +func (obj *captureEthernet) EtherType() CaptureField { + if obj.obj.EtherType == nil { + obj.obj.EtherType = NewCaptureField().msg() + } + if obj.etherTypeHolder == nil { + obj.etherTypeHolder = &captureField{obj: obj.obj.EtherType} + } + return obj.etherTypeHolder +} + +// description is TBD +// EtherType returns a CaptureField +func (obj *captureEthernet) HasEtherType() bool { + return obj.obj.EtherType != nil +} + +// description is TBD +// SetEtherType sets the CaptureField value in the CaptureEthernet object +func (obj *captureEthernet) SetEtherType(value CaptureField) CaptureEthernet { + + obj.etherTypeHolder = nil + obj.obj.EtherType = value.msg() + + return obj +} + +// description is TBD +// PfcQueue returns a CaptureField +func (obj *captureEthernet) PfcQueue() CaptureField { + if obj.obj.PfcQueue == nil { + obj.obj.PfcQueue = NewCaptureField().msg() + } + if obj.pfcQueueHolder == nil { + obj.pfcQueueHolder = &captureField{obj: obj.obj.PfcQueue} + } + return obj.pfcQueueHolder +} + +// description is TBD +// PfcQueue returns a CaptureField +func (obj *captureEthernet) HasPfcQueue() bool { + return obj.obj.PfcQueue != nil +} + +// description is TBD +// SetPfcQueue sets the CaptureField value in the CaptureEthernet object +func (obj *captureEthernet) SetPfcQueue(value CaptureField) CaptureEthernet { + + obj.pfcQueueHolder = nil + obj.obj.PfcQueue = value.msg() + + return obj +} + +func (obj *captureEthernet) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Src != nil { + + obj.Src().validateObj(vObj, set_default) + } + + if obj.obj.Dst != nil { + + obj.Dst().validateObj(vObj, set_default) + } + + if obj.obj.EtherType != nil { + + obj.EtherType().validateObj(vObj, set_default) + } + + if obj.obj.PfcQueue != nil { + + obj.PfcQueue().validateObj(vObj, set_default) + } + +} + +func (obj *captureEthernet) setDefault() { + +} diff --git a/gosnappi/capture_field.go b/gosnappi/capture_field.go new file mode 100644 index 00000000..ee21cc84 --- /dev/null +++ b/gosnappi/capture_field.go @@ -0,0 +1,389 @@ +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" +) + +// ***** CaptureField ***** +type captureField struct { + validation + obj *otg.CaptureField + marshaller marshalCaptureField + unMarshaller unMarshalCaptureField +} + +func NewCaptureField() CaptureField { + obj := captureField{obj: &otg.CaptureField{}} + obj.setDefault() + return &obj +} + +func (obj *captureField) msg() *otg.CaptureField { + return obj.obj +} + +func (obj *captureField) setMsg(msg *otg.CaptureField) CaptureField { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalcaptureField struct { + obj *captureField +} + +type marshalCaptureField interface { + // ToProto marshals CaptureField to protobuf object *otg.CaptureField + ToProto() (*otg.CaptureField, error) + // ToPbText marshals CaptureField to protobuf text + ToPbText() (string, error) + // ToYaml marshals CaptureField to YAML text + ToYaml() (string, error) + // ToJson marshals CaptureField to JSON text + ToJson() (string, error) +} + +type unMarshalcaptureField struct { + obj *captureField +} + +type unMarshalCaptureField interface { + // FromProto unmarshals CaptureField from protobuf object *otg.CaptureField + FromProto(msg *otg.CaptureField) (CaptureField, error) + // FromPbText unmarshals CaptureField from protobuf text + FromPbText(value string) error + // FromYaml unmarshals CaptureField from YAML text + FromYaml(value string) error + // FromJson unmarshals CaptureField from JSON text + FromJson(value string) error +} + +func (obj *captureField) Marshal() marshalCaptureField { + if obj.marshaller == nil { + obj.marshaller = &marshalcaptureField{obj: obj} + } + return obj.marshaller +} + +func (obj *captureField) Unmarshal() unMarshalCaptureField { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalcaptureField{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalcaptureField) ToProto() (*otg.CaptureField, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalcaptureField) FromProto(msg *otg.CaptureField) (CaptureField, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalcaptureField) 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 *unMarshalcaptureField) 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 *marshalcaptureField) 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 *unMarshalcaptureField) 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 *marshalcaptureField) 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 *unMarshalcaptureField) 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 *captureField) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *captureField) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *captureField) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *captureField) Clone() (CaptureField, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewCaptureField() + 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 +} + +// CaptureField is description is TBD +type CaptureField interface { + Validation + // msg marshals CaptureField to protobuf object *otg.CaptureField + // and doesn't set defaults + msg() *otg.CaptureField + // setMsg unmarshals CaptureField from protobuf object *otg.CaptureField + // and doesn't set defaults + setMsg(*otg.CaptureField) CaptureField + // provides marshal interface + Marshal() marshalCaptureField + // provides unmarshal interface + Unmarshal() unMarshalCaptureField + // validate validates CaptureField + validate() error + // A stringer function + String() string + // Clones the object + Clone() (CaptureField, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Value returns string, set in CaptureField. + Value() string + // SetValue assigns string provided by user to CaptureField + SetValue(value string) CaptureField + // HasValue checks if Value has been set in CaptureField + HasValue() bool + // Mask returns string, set in CaptureField. + Mask() string + // SetMask assigns string provided by user to CaptureField + SetMask(value string) CaptureField + // HasMask checks if Mask has been set in CaptureField + HasMask() bool + // Negate returns bool, set in CaptureField. + Negate() bool + // SetNegate assigns bool provided by user to CaptureField + SetNegate(value bool) CaptureField + // HasNegate checks if Negate has been set in CaptureField + HasNegate() bool +} + +// description is TBD +// Value returns a string +func (obj *captureField) Value() string { + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *captureField) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the CaptureField object +func (obj *captureField) SetValue(value string) CaptureField { + + obj.obj.Value = &value + return obj +} + +// description is TBD +// Mask returns a string +func (obj *captureField) Mask() string { + + return *obj.obj.Mask + +} + +// description is TBD +// Mask returns a string +func (obj *captureField) HasMask() bool { + return obj.obj.Mask != nil +} + +// description is TBD +// SetMask sets the string value in the CaptureField object +func (obj *captureField) SetMask(value string) CaptureField { + + obj.obj.Mask = &value + return obj +} + +// description is TBD +// Negate returns a bool +func (obj *captureField) Negate() bool { + + return *obj.obj.Negate + +} + +// description is TBD +// Negate returns a bool +func (obj *captureField) HasNegate() bool { + return obj.obj.Negate != nil +} + +// description is TBD +// SetNegate sets the bool value in the CaptureField object +func (obj *captureField) SetNegate(value bool) CaptureField { + + obj.obj.Negate = &value + return obj +} + +func (obj *captureField) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateHex(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on CaptureField.Value")) + } + + } + + if obj.obj.Mask != nil { + + err := obj.validateHex(obj.Mask()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on CaptureField.Mask")) + } + + } + +} + +func (obj *captureField) setDefault() { + if obj.obj.Value == nil { + obj.SetValue("00") + } + if obj.obj.Mask == nil { + obj.SetMask("00") + } + if obj.obj.Negate == nil { + obj.SetNegate(false) + } + +} diff --git a/gosnappi/capture_filter.go b/gosnappi/capture_filter.go new file mode 100644 index 00000000..15884477 --- /dev/null +++ b/gosnappi/capture_filter.go @@ -0,0 +1,620 @@ +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" +) + +// ***** CaptureFilter ***** +type captureFilter struct { + validation + obj *otg.CaptureFilter + marshaller marshalCaptureFilter + unMarshaller unMarshalCaptureFilter + customHolder CaptureCustom + ethernetHolder CaptureEthernet + vlanHolder CaptureVlan + ipv4Holder CaptureIpv4 + ipv6Holder CaptureIpv6 +} + +func NewCaptureFilter() CaptureFilter { + obj := captureFilter{obj: &otg.CaptureFilter{}} + obj.setDefault() + return &obj +} + +func (obj *captureFilter) msg() *otg.CaptureFilter { + return obj.obj +} + +func (obj *captureFilter) setMsg(msg *otg.CaptureFilter) CaptureFilter { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalcaptureFilter struct { + obj *captureFilter +} + +type marshalCaptureFilter interface { + // ToProto marshals CaptureFilter to protobuf object *otg.CaptureFilter + ToProto() (*otg.CaptureFilter, error) + // ToPbText marshals CaptureFilter to protobuf text + ToPbText() (string, error) + // ToYaml marshals CaptureFilter to YAML text + ToYaml() (string, error) + // ToJson marshals CaptureFilter to JSON text + ToJson() (string, error) +} + +type unMarshalcaptureFilter struct { + obj *captureFilter +} + +type unMarshalCaptureFilter interface { + // FromProto unmarshals CaptureFilter from protobuf object *otg.CaptureFilter + FromProto(msg *otg.CaptureFilter) (CaptureFilter, error) + // FromPbText unmarshals CaptureFilter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals CaptureFilter from YAML text + FromYaml(value string) error + // FromJson unmarshals CaptureFilter from JSON text + FromJson(value string) error +} + +func (obj *captureFilter) Marshal() marshalCaptureFilter { + if obj.marshaller == nil { + obj.marshaller = &marshalcaptureFilter{obj: obj} + } + return obj.marshaller +} + +func (obj *captureFilter) Unmarshal() unMarshalCaptureFilter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalcaptureFilter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalcaptureFilter) ToProto() (*otg.CaptureFilter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalcaptureFilter) FromProto(msg *otg.CaptureFilter) (CaptureFilter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalcaptureFilter) 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 *unMarshalcaptureFilter) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalcaptureFilter) 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 *unMarshalcaptureFilter) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalcaptureFilter) 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 *unMarshalcaptureFilter) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *captureFilter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *captureFilter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *captureFilter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *captureFilter) Clone() (CaptureFilter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewCaptureFilter() + 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 +} + +func (obj *captureFilter) setNil() { + obj.customHolder = nil + obj.ethernetHolder = nil + obj.vlanHolder = nil + obj.ipv4Holder = nil + obj.ipv6Holder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// CaptureFilter is configuration for capture filters +type CaptureFilter interface { + Validation + // msg marshals CaptureFilter to protobuf object *otg.CaptureFilter + // and doesn't set defaults + msg() *otg.CaptureFilter + // setMsg unmarshals CaptureFilter from protobuf object *otg.CaptureFilter + // and doesn't set defaults + setMsg(*otg.CaptureFilter) CaptureFilter + // provides marshal interface + Marshal() marshalCaptureFilter + // provides unmarshal interface + Unmarshal() unMarshalCaptureFilter + // validate validates CaptureFilter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (CaptureFilter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns CaptureFilterChoiceEnum, set in CaptureFilter + Choice() CaptureFilterChoiceEnum + // setChoice assigns CaptureFilterChoiceEnum provided by user to CaptureFilter + setChoice(value CaptureFilterChoiceEnum) CaptureFilter + // HasChoice checks if Choice has been set in CaptureFilter + HasChoice() bool + // Custom returns CaptureCustom, set in CaptureFilter. + // CaptureCustom is description is TBD + Custom() CaptureCustom + // SetCustom assigns CaptureCustom provided by user to CaptureFilter. + // CaptureCustom is description is TBD + SetCustom(value CaptureCustom) CaptureFilter + // HasCustom checks if Custom has been set in CaptureFilter + HasCustom() bool + // Ethernet returns CaptureEthernet, set in CaptureFilter. + // CaptureEthernet is description is TBD + Ethernet() CaptureEthernet + // SetEthernet assigns CaptureEthernet provided by user to CaptureFilter. + // CaptureEthernet is description is TBD + SetEthernet(value CaptureEthernet) CaptureFilter + // HasEthernet checks if Ethernet has been set in CaptureFilter + HasEthernet() bool + // Vlan returns CaptureVlan, set in CaptureFilter. + // CaptureVlan is description is TBD + Vlan() CaptureVlan + // SetVlan assigns CaptureVlan provided by user to CaptureFilter. + // CaptureVlan is description is TBD + SetVlan(value CaptureVlan) CaptureFilter + // HasVlan checks if Vlan has been set in CaptureFilter + HasVlan() bool + // Ipv4 returns CaptureIpv4, set in CaptureFilter. + // CaptureIpv4 is description is TBD + Ipv4() CaptureIpv4 + // SetIpv4 assigns CaptureIpv4 provided by user to CaptureFilter. + // CaptureIpv4 is description is TBD + SetIpv4(value CaptureIpv4) CaptureFilter + // HasIpv4 checks if Ipv4 has been set in CaptureFilter + HasIpv4() bool + // Ipv6 returns CaptureIpv6, set in CaptureFilter. + // CaptureIpv6 is description is TBD + Ipv6() CaptureIpv6 + // SetIpv6 assigns CaptureIpv6 provided by user to CaptureFilter. + // CaptureIpv6 is description is TBD + SetIpv6(value CaptureIpv6) CaptureFilter + // HasIpv6 checks if Ipv6 has been set in CaptureFilter + HasIpv6() bool + setNil() +} + +type CaptureFilterChoiceEnum string + +// Enum of Choice on CaptureFilter +var CaptureFilterChoice = struct { + CUSTOM CaptureFilterChoiceEnum + ETHERNET CaptureFilterChoiceEnum + VLAN CaptureFilterChoiceEnum + IPV4 CaptureFilterChoiceEnum + IPV6 CaptureFilterChoiceEnum +}{ + CUSTOM: CaptureFilterChoiceEnum("custom"), + ETHERNET: CaptureFilterChoiceEnum("ethernet"), + VLAN: CaptureFilterChoiceEnum("vlan"), + IPV4: CaptureFilterChoiceEnum("ipv4"), + IPV6: CaptureFilterChoiceEnum("ipv6"), +} + +func (obj *captureFilter) Choice() CaptureFilterChoiceEnum { + return CaptureFilterChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The type of capture filter. +// Choice returns a string +func (obj *captureFilter) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *captureFilter) setChoice(value CaptureFilterChoiceEnum) CaptureFilter { + intValue, ok := otg.CaptureFilter_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on CaptureFilterChoiceEnum", string(value))) + return obj + } + enumValue := otg.CaptureFilter_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Ipv6 = nil + obj.ipv6Holder = nil + obj.obj.Ipv4 = nil + obj.ipv4Holder = nil + obj.obj.Vlan = nil + obj.vlanHolder = nil + obj.obj.Ethernet = nil + obj.ethernetHolder = nil + obj.obj.Custom = nil + obj.customHolder = nil + + if value == CaptureFilterChoice.CUSTOM { + obj.obj.Custom = NewCaptureCustom().msg() + } + + if value == CaptureFilterChoice.ETHERNET { + obj.obj.Ethernet = NewCaptureEthernet().msg() + } + + if value == CaptureFilterChoice.VLAN { + obj.obj.Vlan = NewCaptureVlan().msg() + } + + if value == CaptureFilterChoice.IPV4 { + obj.obj.Ipv4 = NewCaptureIpv4().msg() + } + + if value == CaptureFilterChoice.IPV6 { + obj.obj.Ipv6 = NewCaptureIpv6().msg() + } + + return obj +} + +// Offset from last filter in the list. If no filters are present it is offset from position 0. Multiple custom filters can be present, the length of each custom filter is the length of the value being filtered. +// Custom returns a CaptureCustom +func (obj *captureFilter) Custom() CaptureCustom { + if obj.obj.Custom == nil { + obj.setChoice(CaptureFilterChoice.CUSTOM) + } + if obj.customHolder == nil { + obj.customHolder = &captureCustom{obj: obj.obj.Custom} + } + return obj.customHolder +} + +// Offset from last filter in the list. If no filters are present it is offset from position 0. Multiple custom filters can be present, the length of each custom filter is the length of the value being filtered. +// Custom returns a CaptureCustom +func (obj *captureFilter) HasCustom() bool { + return obj.obj.Custom != nil +} + +// Offset from last filter in the list. If no filters are present it is offset from position 0. Multiple custom filters can be present, the length of each custom filter is the length of the value being filtered. +// SetCustom sets the CaptureCustom value in the CaptureFilter object +func (obj *captureFilter) SetCustom(value CaptureCustom) CaptureFilter { + obj.setChoice(CaptureFilterChoice.CUSTOM) + obj.customHolder = nil + obj.obj.Custom = value.msg() + + return obj +} + +// description is TBD +// Ethernet returns a CaptureEthernet +func (obj *captureFilter) Ethernet() CaptureEthernet { + if obj.obj.Ethernet == nil { + obj.setChoice(CaptureFilterChoice.ETHERNET) + } + if obj.ethernetHolder == nil { + obj.ethernetHolder = &captureEthernet{obj: obj.obj.Ethernet} + } + return obj.ethernetHolder +} + +// description is TBD +// Ethernet returns a CaptureEthernet +func (obj *captureFilter) HasEthernet() bool { + return obj.obj.Ethernet != nil +} + +// description is TBD +// SetEthernet sets the CaptureEthernet value in the CaptureFilter object +func (obj *captureFilter) SetEthernet(value CaptureEthernet) CaptureFilter { + obj.setChoice(CaptureFilterChoice.ETHERNET) + obj.ethernetHolder = nil + obj.obj.Ethernet = value.msg() + + return obj +} + +// description is TBD +// Vlan returns a CaptureVlan +func (obj *captureFilter) Vlan() CaptureVlan { + if obj.obj.Vlan == nil { + obj.setChoice(CaptureFilterChoice.VLAN) + } + if obj.vlanHolder == nil { + obj.vlanHolder = &captureVlan{obj: obj.obj.Vlan} + } + return obj.vlanHolder +} + +// description is TBD +// Vlan returns a CaptureVlan +func (obj *captureFilter) HasVlan() bool { + return obj.obj.Vlan != nil +} + +// description is TBD +// SetVlan sets the CaptureVlan value in the CaptureFilter object +func (obj *captureFilter) SetVlan(value CaptureVlan) CaptureFilter { + obj.setChoice(CaptureFilterChoice.VLAN) + obj.vlanHolder = nil + obj.obj.Vlan = value.msg() + + return obj +} + +// description is TBD +// Ipv4 returns a CaptureIpv4 +func (obj *captureFilter) Ipv4() CaptureIpv4 { + if obj.obj.Ipv4 == nil { + obj.setChoice(CaptureFilterChoice.IPV4) + } + if obj.ipv4Holder == nil { + obj.ipv4Holder = &captureIpv4{obj: obj.obj.Ipv4} + } + return obj.ipv4Holder +} + +// description is TBD +// Ipv4 returns a CaptureIpv4 +func (obj *captureFilter) HasIpv4() bool { + return obj.obj.Ipv4 != nil +} + +// description is TBD +// SetIpv4 sets the CaptureIpv4 value in the CaptureFilter object +func (obj *captureFilter) SetIpv4(value CaptureIpv4) CaptureFilter { + obj.setChoice(CaptureFilterChoice.IPV4) + obj.ipv4Holder = nil + obj.obj.Ipv4 = value.msg() + + return obj +} + +// description is TBD +// Ipv6 returns a CaptureIpv6 +func (obj *captureFilter) Ipv6() CaptureIpv6 { + if obj.obj.Ipv6 == nil { + obj.setChoice(CaptureFilterChoice.IPV6) + } + if obj.ipv6Holder == nil { + obj.ipv6Holder = &captureIpv6{obj: obj.obj.Ipv6} + } + return obj.ipv6Holder +} + +// description is TBD +// Ipv6 returns a CaptureIpv6 +func (obj *captureFilter) HasIpv6() bool { + return obj.obj.Ipv6 != nil +} + +// description is TBD +// SetIpv6 sets the CaptureIpv6 value in the CaptureFilter object +func (obj *captureFilter) SetIpv6(value CaptureIpv6) CaptureFilter { + obj.setChoice(CaptureFilterChoice.IPV6) + obj.ipv6Holder = nil + obj.obj.Ipv6 = value.msg() + + return obj +} + +func (obj *captureFilter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Custom != nil { + + obj.Custom().validateObj(vObj, set_default) + } + + if obj.obj.Ethernet != nil { + + obj.Ethernet().validateObj(vObj, set_default) + } + + if obj.obj.Vlan != nil { + + obj.Vlan().validateObj(vObj, set_default) + } + + if obj.obj.Ipv4 != nil { + + obj.Ipv4().validateObj(vObj, set_default) + } + + if obj.obj.Ipv6 != nil { + + obj.Ipv6().validateObj(vObj, set_default) + } + +} + +func (obj *captureFilter) setDefault() { + var choices_set int = 0 + var choice CaptureFilterChoiceEnum + + if obj.obj.Custom != nil { + choices_set += 1 + choice = CaptureFilterChoice.CUSTOM + } + + if obj.obj.Ethernet != nil { + choices_set += 1 + choice = CaptureFilterChoice.ETHERNET + } + + if obj.obj.Vlan != nil { + choices_set += 1 + choice = CaptureFilterChoice.VLAN + } + + if obj.obj.Ipv4 != nil { + choices_set += 1 + choice = CaptureFilterChoice.IPV4 + } + + if obj.obj.Ipv6 != nil { + choices_set += 1 + choice = CaptureFilterChoice.IPV6 + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(CaptureFilterChoice.CUSTOM) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in CaptureFilter") + } + } else { + intVal := otg.CaptureFilter_Choice_Enum_value[string(choice)] + enumValue := otg.CaptureFilter_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/capture_ipv4.go b/gosnappi/capture_ipv4.go new file mode 100644 index 00000000..ddb14d31 --- /dev/null +++ b/gosnappi/capture_ipv4.go @@ -0,0 +1,887 @@ +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" +) + +// ***** CaptureIpv4 ***** +type captureIpv4 struct { + validation + obj *otg.CaptureIpv4 + marshaller marshalCaptureIpv4 + unMarshaller unMarshalCaptureIpv4 + versionHolder CaptureField + headerLengthHolder CaptureField + priorityHolder CaptureField + totalLengthHolder CaptureField + identificationHolder CaptureField + reservedHolder CaptureField + dontFragmentHolder CaptureField + moreFragmentsHolder CaptureField + fragmentOffsetHolder CaptureField + timeToLiveHolder CaptureField + protocolHolder CaptureField + headerChecksumHolder CaptureField + srcHolder CaptureField + dstHolder CaptureField +} + +func NewCaptureIpv4() CaptureIpv4 { + obj := captureIpv4{obj: &otg.CaptureIpv4{}} + obj.setDefault() + return &obj +} + +func (obj *captureIpv4) msg() *otg.CaptureIpv4 { + return obj.obj +} + +func (obj *captureIpv4) setMsg(msg *otg.CaptureIpv4) CaptureIpv4 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalcaptureIpv4 struct { + obj *captureIpv4 +} + +type marshalCaptureIpv4 interface { + // ToProto marshals CaptureIpv4 to protobuf object *otg.CaptureIpv4 + ToProto() (*otg.CaptureIpv4, error) + // ToPbText marshals CaptureIpv4 to protobuf text + ToPbText() (string, error) + // ToYaml marshals CaptureIpv4 to YAML text + ToYaml() (string, error) + // ToJson marshals CaptureIpv4 to JSON text + ToJson() (string, error) +} + +type unMarshalcaptureIpv4 struct { + obj *captureIpv4 +} + +type unMarshalCaptureIpv4 interface { + // FromProto unmarshals CaptureIpv4 from protobuf object *otg.CaptureIpv4 + FromProto(msg *otg.CaptureIpv4) (CaptureIpv4, error) + // FromPbText unmarshals CaptureIpv4 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals CaptureIpv4 from YAML text + FromYaml(value string) error + // FromJson unmarshals CaptureIpv4 from JSON text + FromJson(value string) error +} + +func (obj *captureIpv4) Marshal() marshalCaptureIpv4 { + if obj.marshaller == nil { + obj.marshaller = &marshalcaptureIpv4{obj: obj} + } + return obj.marshaller +} + +func (obj *captureIpv4) Unmarshal() unMarshalCaptureIpv4 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalcaptureIpv4{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalcaptureIpv4) ToProto() (*otg.CaptureIpv4, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalcaptureIpv4) FromProto(msg *otg.CaptureIpv4) (CaptureIpv4, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalcaptureIpv4) 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 *unMarshalcaptureIpv4) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalcaptureIpv4) 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 *unMarshalcaptureIpv4) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalcaptureIpv4) 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 *unMarshalcaptureIpv4) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *captureIpv4) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *captureIpv4) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *captureIpv4) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *captureIpv4) Clone() (CaptureIpv4, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewCaptureIpv4() + 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 +} + +func (obj *captureIpv4) setNil() { + obj.versionHolder = nil + obj.headerLengthHolder = nil + obj.priorityHolder = nil + obj.totalLengthHolder = nil + obj.identificationHolder = nil + obj.reservedHolder = nil + obj.dontFragmentHolder = nil + obj.moreFragmentsHolder = nil + obj.fragmentOffsetHolder = nil + obj.timeToLiveHolder = nil + obj.protocolHolder = nil + obj.headerChecksumHolder = nil + obj.srcHolder = nil + obj.dstHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// CaptureIpv4 is description is TBD +type CaptureIpv4 interface { + Validation + // msg marshals CaptureIpv4 to protobuf object *otg.CaptureIpv4 + // and doesn't set defaults + msg() *otg.CaptureIpv4 + // setMsg unmarshals CaptureIpv4 from protobuf object *otg.CaptureIpv4 + // and doesn't set defaults + setMsg(*otg.CaptureIpv4) CaptureIpv4 + // provides marshal interface + Marshal() marshalCaptureIpv4 + // provides unmarshal interface + Unmarshal() unMarshalCaptureIpv4 + // validate validates CaptureIpv4 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (CaptureIpv4, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Version returns CaptureField, set in CaptureIpv4. + // CaptureField is description is TBD + Version() CaptureField + // SetVersion assigns CaptureField provided by user to CaptureIpv4. + // CaptureField is description is TBD + SetVersion(value CaptureField) CaptureIpv4 + // HasVersion checks if Version has been set in CaptureIpv4 + HasVersion() bool + // HeaderLength returns CaptureField, set in CaptureIpv4. + // CaptureField is description is TBD + HeaderLength() CaptureField + // SetHeaderLength assigns CaptureField provided by user to CaptureIpv4. + // CaptureField is description is TBD + SetHeaderLength(value CaptureField) CaptureIpv4 + // HasHeaderLength checks if HeaderLength has been set in CaptureIpv4 + HasHeaderLength() bool + // Priority returns CaptureField, set in CaptureIpv4. + // CaptureField is description is TBD + Priority() CaptureField + // SetPriority assigns CaptureField provided by user to CaptureIpv4. + // CaptureField is description is TBD + SetPriority(value CaptureField) CaptureIpv4 + // HasPriority checks if Priority has been set in CaptureIpv4 + HasPriority() bool + // TotalLength returns CaptureField, set in CaptureIpv4. + // CaptureField is description is TBD + TotalLength() CaptureField + // SetTotalLength assigns CaptureField provided by user to CaptureIpv4. + // CaptureField is description is TBD + SetTotalLength(value CaptureField) CaptureIpv4 + // HasTotalLength checks if TotalLength has been set in CaptureIpv4 + HasTotalLength() bool + // Identification returns CaptureField, set in CaptureIpv4. + // CaptureField is description is TBD + Identification() CaptureField + // SetIdentification assigns CaptureField provided by user to CaptureIpv4. + // CaptureField is description is TBD + SetIdentification(value CaptureField) CaptureIpv4 + // HasIdentification checks if Identification has been set in CaptureIpv4 + HasIdentification() bool + // Reserved returns CaptureField, set in CaptureIpv4. + // CaptureField is description is TBD + Reserved() CaptureField + // SetReserved assigns CaptureField provided by user to CaptureIpv4. + // CaptureField is description is TBD + SetReserved(value CaptureField) CaptureIpv4 + // HasReserved checks if Reserved has been set in CaptureIpv4 + HasReserved() bool + // DontFragment returns CaptureField, set in CaptureIpv4. + // CaptureField is description is TBD + DontFragment() CaptureField + // SetDontFragment assigns CaptureField provided by user to CaptureIpv4. + // CaptureField is description is TBD + SetDontFragment(value CaptureField) CaptureIpv4 + // HasDontFragment checks if DontFragment has been set in CaptureIpv4 + HasDontFragment() bool + // MoreFragments returns CaptureField, set in CaptureIpv4. + // CaptureField is description is TBD + MoreFragments() CaptureField + // SetMoreFragments assigns CaptureField provided by user to CaptureIpv4. + // CaptureField is description is TBD + SetMoreFragments(value CaptureField) CaptureIpv4 + // HasMoreFragments checks if MoreFragments has been set in CaptureIpv4 + HasMoreFragments() bool + // FragmentOffset returns CaptureField, set in CaptureIpv4. + // CaptureField is description is TBD + FragmentOffset() CaptureField + // SetFragmentOffset assigns CaptureField provided by user to CaptureIpv4. + // CaptureField is description is TBD + SetFragmentOffset(value CaptureField) CaptureIpv4 + // HasFragmentOffset checks if FragmentOffset has been set in CaptureIpv4 + HasFragmentOffset() bool + // TimeToLive returns CaptureField, set in CaptureIpv4. + // CaptureField is description is TBD + TimeToLive() CaptureField + // SetTimeToLive assigns CaptureField provided by user to CaptureIpv4. + // CaptureField is description is TBD + SetTimeToLive(value CaptureField) CaptureIpv4 + // HasTimeToLive checks if TimeToLive has been set in CaptureIpv4 + HasTimeToLive() bool + // Protocol returns CaptureField, set in CaptureIpv4. + // CaptureField is description is TBD + Protocol() CaptureField + // SetProtocol assigns CaptureField provided by user to CaptureIpv4. + // CaptureField is description is TBD + SetProtocol(value CaptureField) CaptureIpv4 + // HasProtocol checks if Protocol has been set in CaptureIpv4 + HasProtocol() bool + // HeaderChecksum returns CaptureField, set in CaptureIpv4. + // CaptureField is description is TBD + HeaderChecksum() CaptureField + // SetHeaderChecksum assigns CaptureField provided by user to CaptureIpv4. + // CaptureField is description is TBD + SetHeaderChecksum(value CaptureField) CaptureIpv4 + // HasHeaderChecksum checks if HeaderChecksum has been set in CaptureIpv4 + HasHeaderChecksum() bool + // Src returns CaptureField, set in CaptureIpv4. + // CaptureField is description is TBD + Src() CaptureField + // SetSrc assigns CaptureField provided by user to CaptureIpv4. + // CaptureField is description is TBD + SetSrc(value CaptureField) CaptureIpv4 + // HasSrc checks if Src has been set in CaptureIpv4 + HasSrc() bool + // Dst returns CaptureField, set in CaptureIpv4. + // CaptureField is description is TBD + Dst() CaptureField + // SetDst assigns CaptureField provided by user to CaptureIpv4. + // CaptureField is description is TBD + SetDst(value CaptureField) CaptureIpv4 + // HasDst checks if Dst has been set in CaptureIpv4 + HasDst() bool + setNil() +} + +// description is TBD +// Version returns a CaptureField +func (obj *captureIpv4) Version() CaptureField { + if obj.obj.Version == nil { + obj.obj.Version = NewCaptureField().msg() + } + if obj.versionHolder == nil { + obj.versionHolder = &captureField{obj: obj.obj.Version} + } + return obj.versionHolder +} + +// description is TBD +// Version returns a CaptureField +func (obj *captureIpv4) HasVersion() bool { + return obj.obj.Version != nil +} + +// description is TBD +// SetVersion sets the CaptureField value in the CaptureIpv4 object +func (obj *captureIpv4) SetVersion(value CaptureField) CaptureIpv4 { + + obj.versionHolder = nil + obj.obj.Version = value.msg() + + return obj +} + +// description is TBD +// HeaderLength returns a CaptureField +func (obj *captureIpv4) HeaderLength() CaptureField { + if obj.obj.HeaderLength == nil { + obj.obj.HeaderLength = NewCaptureField().msg() + } + if obj.headerLengthHolder == nil { + obj.headerLengthHolder = &captureField{obj: obj.obj.HeaderLength} + } + return obj.headerLengthHolder +} + +// description is TBD +// HeaderLength returns a CaptureField +func (obj *captureIpv4) HasHeaderLength() bool { + return obj.obj.HeaderLength != nil +} + +// description is TBD +// SetHeaderLength sets the CaptureField value in the CaptureIpv4 object +func (obj *captureIpv4) SetHeaderLength(value CaptureField) CaptureIpv4 { + + obj.headerLengthHolder = nil + obj.obj.HeaderLength = value.msg() + + return obj +} + +// description is TBD +// Priority returns a CaptureField +func (obj *captureIpv4) Priority() CaptureField { + if obj.obj.Priority == nil { + obj.obj.Priority = NewCaptureField().msg() + } + if obj.priorityHolder == nil { + obj.priorityHolder = &captureField{obj: obj.obj.Priority} + } + return obj.priorityHolder +} + +// description is TBD +// Priority returns a CaptureField +func (obj *captureIpv4) HasPriority() bool { + return obj.obj.Priority != nil +} + +// description is TBD +// SetPriority sets the CaptureField value in the CaptureIpv4 object +func (obj *captureIpv4) SetPriority(value CaptureField) CaptureIpv4 { + + obj.priorityHolder = nil + obj.obj.Priority = value.msg() + + return obj +} + +// description is TBD +// TotalLength returns a CaptureField +func (obj *captureIpv4) TotalLength() CaptureField { + if obj.obj.TotalLength == nil { + obj.obj.TotalLength = NewCaptureField().msg() + } + if obj.totalLengthHolder == nil { + obj.totalLengthHolder = &captureField{obj: obj.obj.TotalLength} + } + return obj.totalLengthHolder +} + +// description is TBD +// TotalLength returns a CaptureField +func (obj *captureIpv4) HasTotalLength() bool { + return obj.obj.TotalLength != nil +} + +// description is TBD +// SetTotalLength sets the CaptureField value in the CaptureIpv4 object +func (obj *captureIpv4) SetTotalLength(value CaptureField) CaptureIpv4 { + + obj.totalLengthHolder = nil + obj.obj.TotalLength = value.msg() + + return obj +} + +// description is TBD +// Identification returns a CaptureField +func (obj *captureIpv4) Identification() CaptureField { + if obj.obj.Identification == nil { + obj.obj.Identification = NewCaptureField().msg() + } + if obj.identificationHolder == nil { + obj.identificationHolder = &captureField{obj: obj.obj.Identification} + } + return obj.identificationHolder +} + +// description is TBD +// Identification returns a CaptureField +func (obj *captureIpv4) HasIdentification() bool { + return obj.obj.Identification != nil +} + +// description is TBD +// SetIdentification sets the CaptureField value in the CaptureIpv4 object +func (obj *captureIpv4) SetIdentification(value CaptureField) CaptureIpv4 { + + obj.identificationHolder = nil + obj.obj.Identification = value.msg() + + return obj +} + +// description is TBD +// Reserved returns a CaptureField +func (obj *captureIpv4) Reserved() CaptureField { + if obj.obj.Reserved == nil { + obj.obj.Reserved = NewCaptureField().msg() + } + if obj.reservedHolder == nil { + obj.reservedHolder = &captureField{obj: obj.obj.Reserved} + } + return obj.reservedHolder +} + +// description is TBD +// Reserved returns a CaptureField +func (obj *captureIpv4) HasReserved() bool { + return obj.obj.Reserved != nil +} + +// description is TBD +// SetReserved sets the CaptureField value in the CaptureIpv4 object +func (obj *captureIpv4) SetReserved(value CaptureField) CaptureIpv4 { + + obj.reservedHolder = nil + obj.obj.Reserved = value.msg() + + return obj +} + +// description is TBD +// DontFragment returns a CaptureField +func (obj *captureIpv4) DontFragment() CaptureField { + if obj.obj.DontFragment == nil { + obj.obj.DontFragment = NewCaptureField().msg() + } + if obj.dontFragmentHolder == nil { + obj.dontFragmentHolder = &captureField{obj: obj.obj.DontFragment} + } + return obj.dontFragmentHolder +} + +// description is TBD +// DontFragment returns a CaptureField +func (obj *captureIpv4) HasDontFragment() bool { + return obj.obj.DontFragment != nil +} + +// description is TBD +// SetDontFragment sets the CaptureField value in the CaptureIpv4 object +func (obj *captureIpv4) SetDontFragment(value CaptureField) CaptureIpv4 { + + obj.dontFragmentHolder = nil + obj.obj.DontFragment = value.msg() + + return obj +} + +// description is TBD +// MoreFragments returns a CaptureField +func (obj *captureIpv4) MoreFragments() CaptureField { + if obj.obj.MoreFragments == nil { + obj.obj.MoreFragments = NewCaptureField().msg() + } + if obj.moreFragmentsHolder == nil { + obj.moreFragmentsHolder = &captureField{obj: obj.obj.MoreFragments} + } + return obj.moreFragmentsHolder +} + +// description is TBD +// MoreFragments returns a CaptureField +func (obj *captureIpv4) HasMoreFragments() bool { + return obj.obj.MoreFragments != nil +} + +// description is TBD +// SetMoreFragments sets the CaptureField value in the CaptureIpv4 object +func (obj *captureIpv4) SetMoreFragments(value CaptureField) CaptureIpv4 { + + obj.moreFragmentsHolder = nil + obj.obj.MoreFragments = value.msg() + + return obj +} + +// description is TBD +// FragmentOffset returns a CaptureField +func (obj *captureIpv4) FragmentOffset() CaptureField { + if obj.obj.FragmentOffset == nil { + obj.obj.FragmentOffset = NewCaptureField().msg() + } + if obj.fragmentOffsetHolder == nil { + obj.fragmentOffsetHolder = &captureField{obj: obj.obj.FragmentOffset} + } + return obj.fragmentOffsetHolder +} + +// description is TBD +// FragmentOffset returns a CaptureField +func (obj *captureIpv4) HasFragmentOffset() bool { + return obj.obj.FragmentOffset != nil +} + +// description is TBD +// SetFragmentOffset sets the CaptureField value in the CaptureIpv4 object +func (obj *captureIpv4) SetFragmentOffset(value CaptureField) CaptureIpv4 { + + obj.fragmentOffsetHolder = nil + obj.obj.FragmentOffset = value.msg() + + return obj +} + +// description is TBD +// TimeToLive returns a CaptureField +func (obj *captureIpv4) TimeToLive() CaptureField { + if obj.obj.TimeToLive == nil { + obj.obj.TimeToLive = NewCaptureField().msg() + } + if obj.timeToLiveHolder == nil { + obj.timeToLiveHolder = &captureField{obj: obj.obj.TimeToLive} + } + return obj.timeToLiveHolder +} + +// description is TBD +// TimeToLive returns a CaptureField +func (obj *captureIpv4) HasTimeToLive() bool { + return obj.obj.TimeToLive != nil +} + +// description is TBD +// SetTimeToLive sets the CaptureField value in the CaptureIpv4 object +func (obj *captureIpv4) SetTimeToLive(value CaptureField) CaptureIpv4 { + + obj.timeToLiveHolder = nil + obj.obj.TimeToLive = value.msg() + + return obj +} + +// description is TBD +// Protocol returns a CaptureField +func (obj *captureIpv4) Protocol() CaptureField { + if obj.obj.Protocol == nil { + obj.obj.Protocol = NewCaptureField().msg() + } + if obj.protocolHolder == nil { + obj.protocolHolder = &captureField{obj: obj.obj.Protocol} + } + return obj.protocolHolder +} + +// description is TBD +// Protocol returns a CaptureField +func (obj *captureIpv4) HasProtocol() bool { + return obj.obj.Protocol != nil +} + +// description is TBD +// SetProtocol sets the CaptureField value in the CaptureIpv4 object +func (obj *captureIpv4) SetProtocol(value CaptureField) CaptureIpv4 { + + obj.protocolHolder = nil + obj.obj.Protocol = value.msg() + + return obj +} + +// description is TBD +// HeaderChecksum returns a CaptureField +func (obj *captureIpv4) HeaderChecksum() CaptureField { + if obj.obj.HeaderChecksum == nil { + obj.obj.HeaderChecksum = NewCaptureField().msg() + } + if obj.headerChecksumHolder == nil { + obj.headerChecksumHolder = &captureField{obj: obj.obj.HeaderChecksum} + } + return obj.headerChecksumHolder +} + +// description is TBD +// HeaderChecksum returns a CaptureField +func (obj *captureIpv4) HasHeaderChecksum() bool { + return obj.obj.HeaderChecksum != nil +} + +// description is TBD +// SetHeaderChecksum sets the CaptureField value in the CaptureIpv4 object +func (obj *captureIpv4) SetHeaderChecksum(value CaptureField) CaptureIpv4 { + + obj.headerChecksumHolder = nil + obj.obj.HeaderChecksum = value.msg() + + return obj +} + +// description is TBD +// Src returns a CaptureField +func (obj *captureIpv4) Src() CaptureField { + if obj.obj.Src == nil { + obj.obj.Src = NewCaptureField().msg() + } + if obj.srcHolder == nil { + obj.srcHolder = &captureField{obj: obj.obj.Src} + } + return obj.srcHolder +} + +// description is TBD +// Src returns a CaptureField +func (obj *captureIpv4) HasSrc() bool { + return obj.obj.Src != nil +} + +// description is TBD +// SetSrc sets the CaptureField value in the CaptureIpv4 object +func (obj *captureIpv4) SetSrc(value CaptureField) CaptureIpv4 { + + obj.srcHolder = nil + obj.obj.Src = value.msg() + + return obj +} + +// description is TBD +// Dst returns a CaptureField +func (obj *captureIpv4) Dst() CaptureField { + if obj.obj.Dst == nil { + obj.obj.Dst = NewCaptureField().msg() + } + if obj.dstHolder == nil { + obj.dstHolder = &captureField{obj: obj.obj.Dst} + } + return obj.dstHolder +} + +// description is TBD +// Dst returns a CaptureField +func (obj *captureIpv4) HasDst() bool { + return obj.obj.Dst != nil +} + +// description is TBD +// SetDst sets the CaptureField value in the CaptureIpv4 object +func (obj *captureIpv4) SetDst(value CaptureField) CaptureIpv4 { + + obj.dstHolder = nil + obj.obj.Dst = value.msg() + + return obj +} + +func (obj *captureIpv4) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Version != nil { + + obj.Version().validateObj(vObj, set_default) + } + + if obj.obj.HeaderLength != nil { + + obj.HeaderLength().validateObj(vObj, set_default) + } + + if obj.obj.Priority != nil { + + obj.Priority().validateObj(vObj, set_default) + } + + if obj.obj.TotalLength != nil { + + obj.TotalLength().validateObj(vObj, set_default) + } + + if obj.obj.Identification != nil { + + obj.Identification().validateObj(vObj, set_default) + } + + if obj.obj.Reserved != nil { + + obj.Reserved().validateObj(vObj, set_default) + } + + if obj.obj.DontFragment != nil { + + obj.DontFragment().validateObj(vObj, set_default) + } + + if obj.obj.MoreFragments != nil { + + obj.MoreFragments().validateObj(vObj, set_default) + } + + if obj.obj.FragmentOffset != nil { + + obj.FragmentOffset().validateObj(vObj, set_default) + } + + if obj.obj.TimeToLive != nil { + + obj.TimeToLive().validateObj(vObj, set_default) + } + + if obj.obj.Protocol != nil { + + obj.Protocol().validateObj(vObj, set_default) + } + + if obj.obj.HeaderChecksum != nil { + + obj.HeaderChecksum().validateObj(vObj, set_default) + } + + if obj.obj.Src != nil { + + obj.Src().validateObj(vObj, set_default) + } + + if obj.obj.Dst != nil { + + obj.Dst().validateObj(vObj, set_default) + } + +} + +func (obj *captureIpv4) setDefault() { + +} diff --git a/gosnappi/capture_ipv6.go b/gosnappi/capture_ipv6.go new file mode 100644 index 00000000..b2ebd59c --- /dev/null +++ b/gosnappi/capture_ipv6.go @@ -0,0 +1,629 @@ +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" +) + +// ***** CaptureIpv6 ***** +type captureIpv6 struct { + validation + obj *otg.CaptureIpv6 + marshaller marshalCaptureIpv6 + unMarshaller unMarshalCaptureIpv6 + versionHolder CaptureField + trafficClassHolder CaptureField + flowLabelHolder CaptureField + payloadLengthHolder CaptureField + nextHeaderHolder CaptureField + hopLimitHolder CaptureField + srcHolder CaptureField + dstHolder CaptureField +} + +func NewCaptureIpv6() CaptureIpv6 { + obj := captureIpv6{obj: &otg.CaptureIpv6{}} + obj.setDefault() + return &obj +} + +func (obj *captureIpv6) msg() *otg.CaptureIpv6 { + return obj.obj +} + +func (obj *captureIpv6) setMsg(msg *otg.CaptureIpv6) CaptureIpv6 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalcaptureIpv6 struct { + obj *captureIpv6 +} + +type marshalCaptureIpv6 interface { + // ToProto marshals CaptureIpv6 to protobuf object *otg.CaptureIpv6 + ToProto() (*otg.CaptureIpv6, error) + // ToPbText marshals CaptureIpv6 to protobuf text + ToPbText() (string, error) + // ToYaml marshals CaptureIpv6 to YAML text + ToYaml() (string, error) + // ToJson marshals CaptureIpv6 to JSON text + ToJson() (string, error) +} + +type unMarshalcaptureIpv6 struct { + obj *captureIpv6 +} + +type unMarshalCaptureIpv6 interface { + // FromProto unmarshals CaptureIpv6 from protobuf object *otg.CaptureIpv6 + FromProto(msg *otg.CaptureIpv6) (CaptureIpv6, error) + // FromPbText unmarshals CaptureIpv6 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals CaptureIpv6 from YAML text + FromYaml(value string) error + // FromJson unmarshals CaptureIpv6 from JSON text + FromJson(value string) error +} + +func (obj *captureIpv6) Marshal() marshalCaptureIpv6 { + if obj.marshaller == nil { + obj.marshaller = &marshalcaptureIpv6{obj: obj} + } + return obj.marshaller +} + +func (obj *captureIpv6) Unmarshal() unMarshalCaptureIpv6 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalcaptureIpv6{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalcaptureIpv6) ToProto() (*otg.CaptureIpv6, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalcaptureIpv6) FromProto(msg *otg.CaptureIpv6) (CaptureIpv6, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalcaptureIpv6) 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 *unMarshalcaptureIpv6) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalcaptureIpv6) 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 *unMarshalcaptureIpv6) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalcaptureIpv6) 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 *unMarshalcaptureIpv6) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *captureIpv6) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *captureIpv6) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *captureIpv6) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *captureIpv6) Clone() (CaptureIpv6, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewCaptureIpv6() + 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 +} + +func (obj *captureIpv6) setNil() { + obj.versionHolder = nil + obj.trafficClassHolder = nil + obj.flowLabelHolder = nil + obj.payloadLengthHolder = nil + obj.nextHeaderHolder = nil + obj.hopLimitHolder = nil + obj.srcHolder = nil + obj.dstHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// CaptureIpv6 is description is TBD +type CaptureIpv6 interface { + Validation + // msg marshals CaptureIpv6 to protobuf object *otg.CaptureIpv6 + // and doesn't set defaults + msg() *otg.CaptureIpv6 + // setMsg unmarshals CaptureIpv6 from protobuf object *otg.CaptureIpv6 + // and doesn't set defaults + setMsg(*otg.CaptureIpv6) CaptureIpv6 + // provides marshal interface + Marshal() marshalCaptureIpv6 + // provides unmarshal interface + Unmarshal() unMarshalCaptureIpv6 + // validate validates CaptureIpv6 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (CaptureIpv6, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Version returns CaptureField, set in CaptureIpv6. + // CaptureField is description is TBD + Version() CaptureField + // SetVersion assigns CaptureField provided by user to CaptureIpv6. + // CaptureField is description is TBD + SetVersion(value CaptureField) CaptureIpv6 + // HasVersion checks if Version has been set in CaptureIpv6 + HasVersion() bool + // TrafficClass returns CaptureField, set in CaptureIpv6. + // CaptureField is description is TBD + TrafficClass() CaptureField + // SetTrafficClass assigns CaptureField provided by user to CaptureIpv6. + // CaptureField is description is TBD + SetTrafficClass(value CaptureField) CaptureIpv6 + // HasTrafficClass checks if TrafficClass has been set in CaptureIpv6 + HasTrafficClass() bool + // FlowLabel returns CaptureField, set in CaptureIpv6. + // CaptureField is description is TBD + FlowLabel() CaptureField + // SetFlowLabel assigns CaptureField provided by user to CaptureIpv6. + // CaptureField is description is TBD + SetFlowLabel(value CaptureField) CaptureIpv6 + // HasFlowLabel checks if FlowLabel has been set in CaptureIpv6 + HasFlowLabel() bool + // PayloadLength returns CaptureField, set in CaptureIpv6. + // CaptureField is description is TBD + PayloadLength() CaptureField + // SetPayloadLength assigns CaptureField provided by user to CaptureIpv6. + // CaptureField is description is TBD + SetPayloadLength(value CaptureField) CaptureIpv6 + // HasPayloadLength checks if PayloadLength has been set in CaptureIpv6 + HasPayloadLength() bool + // NextHeader returns CaptureField, set in CaptureIpv6. + // CaptureField is description is TBD + NextHeader() CaptureField + // SetNextHeader assigns CaptureField provided by user to CaptureIpv6. + // CaptureField is description is TBD + SetNextHeader(value CaptureField) CaptureIpv6 + // HasNextHeader checks if NextHeader has been set in CaptureIpv6 + HasNextHeader() bool + // HopLimit returns CaptureField, set in CaptureIpv6. + // CaptureField is description is TBD + HopLimit() CaptureField + // SetHopLimit assigns CaptureField provided by user to CaptureIpv6. + // CaptureField is description is TBD + SetHopLimit(value CaptureField) CaptureIpv6 + // HasHopLimit checks if HopLimit has been set in CaptureIpv6 + HasHopLimit() bool + // Src returns CaptureField, set in CaptureIpv6. + // CaptureField is description is TBD + Src() CaptureField + // SetSrc assigns CaptureField provided by user to CaptureIpv6. + // CaptureField is description is TBD + SetSrc(value CaptureField) CaptureIpv6 + // HasSrc checks if Src has been set in CaptureIpv6 + HasSrc() bool + // Dst returns CaptureField, set in CaptureIpv6. + // CaptureField is description is TBD + Dst() CaptureField + // SetDst assigns CaptureField provided by user to CaptureIpv6. + // CaptureField is description is TBD + SetDst(value CaptureField) CaptureIpv6 + // HasDst checks if Dst has been set in CaptureIpv6 + HasDst() bool + setNil() +} + +// description is TBD +// Version returns a CaptureField +func (obj *captureIpv6) Version() CaptureField { + if obj.obj.Version == nil { + obj.obj.Version = NewCaptureField().msg() + } + if obj.versionHolder == nil { + obj.versionHolder = &captureField{obj: obj.obj.Version} + } + return obj.versionHolder +} + +// description is TBD +// Version returns a CaptureField +func (obj *captureIpv6) HasVersion() bool { + return obj.obj.Version != nil +} + +// description is TBD +// SetVersion sets the CaptureField value in the CaptureIpv6 object +func (obj *captureIpv6) SetVersion(value CaptureField) CaptureIpv6 { + + obj.versionHolder = nil + obj.obj.Version = value.msg() + + return obj +} + +// description is TBD +// TrafficClass returns a CaptureField +func (obj *captureIpv6) TrafficClass() CaptureField { + if obj.obj.TrafficClass == nil { + obj.obj.TrafficClass = NewCaptureField().msg() + } + if obj.trafficClassHolder == nil { + obj.trafficClassHolder = &captureField{obj: obj.obj.TrafficClass} + } + return obj.trafficClassHolder +} + +// description is TBD +// TrafficClass returns a CaptureField +func (obj *captureIpv6) HasTrafficClass() bool { + return obj.obj.TrafficClass != nil +} + +// description is TBD +// SetTrafficClass sets the CaptureField value in the CaptureIpv6 object +func (obj *captureIpv6) SetTrafficClass(value CaptureField) CaptureIpv6 { + + obj.trafficClassHolder = nil + obj.obj.TrafficClass = value.msg() + + return obj +} + +// description is TBD +// FlowLabel returns a CaptureField +func (obj *captureIpv6) FlowLabel() CaptureField { + if obj.obj.FlowLabel == nil { + obj.obj.FlowLabel = NewCaptureField().msg() + } + if obj.flowLabelHolder == nil { + obj.flowLabelHolder = &captureField{obj: obj.obj.FlowLabel} + } + return obj.flowLabelHolder +} + +// description is TBD +// FlowLabel returns a CaptureField +func (obj *captureIpv6) HasFlowLabel() bool { + return obj.obj.FlowLabel != nil +} + +// description is TBD +// SetFlowLabel sets the CaptureField value in the CaptureIpv6 object +func (obj *captureIpv6) SetFlowLabel(value CaptureField) CaptureIpv6 { + + obj.flowLabelHolder = nil + obj.obj.FlowLabel = value.msg() + + return obj +} + +// description is TBD +// PayloadLength returns a CaptureField +func (obj *captureIpv6) PayloadLength() CaptureField { + if obj.obj.PayloadLength == nil { + obj.obj.PayloadLength = NewCaptureField().msg() + } + if obj.payloadLengthHolder == nil { + obj.payloadLengthHolder = &captureField{obj: obj.obj.PayloadLength} + } + return obj.payloadLengthHolder +} + +// description is TBD +// PayloadLength returns a CaptureField +func (obj *captureIpv6) HasPayloadLength() bool { + return obj.obj.PayloadLength != nil +} + +// description is TBD +// SetPayloadLength sets the CaptureField value in the CaptureIpv6 object +func (obj *captureIpv6) SetPayloadLength(value CaptureField) CaptureIpv6 { + + obj.payloadLengthHolder = nil + obj.obj.PayloadLength = value.msg() + + return obj +} + +// description is TBD +// NextHeader returns a CaptureField +func (obj *captureIpv6) NextHeader() CaptureField { + if obj.obj.NextHeader == nil { + obj.obj.NextHeader = NewCaptureField().msg() + } + if obj.nextHeaderHolder == nil { + obj.nextHeaderHolder = &captureField{obj: obj.obj.NextHeader} + } + return obj.nextHeaderHolder +} + +// description is TBD +// NextHeader returns a CaptureField +func (obj *captureIpv6) HasNextHeader() bool { + return obj.obj.NextHeader != nil +} + +// description is TBD +// SetNextHeader sets the CaptureField value in the CaptureIpv6 object +func (obj *captureIpv6) SetNextHeader(value CaptureField) CaptureIpv6 { + + obj.nextHeaderHolder = nil + obj.obj.NextHeader = value.msg() + + return obj +} + +// description is TBD +// HopLimit returns a CaptureField +func (obj *captureIpv6) HopLimit() CaptureField { + if obj.obj.HopLimit == nil { + obj.obj.HopLimit = NewCaptureField().msg() + } + if obj.hopLimitHolder == nil { + obj.hopLimitHolder = &captureField{obj: obj.obj.HopLimit} + } + return obj.hopLimitHolder +} + +// description is TBD +// HopLimit returns a CaptureField +func (obj *captureIpv6) HasHopLimit() bool { + return obj.obj.HopLimit != nil +} + +// description is TBD +// SetHopLimit sets the CaptureField value in the CaptureIpv6 object +func (obj *captureIpv6) SetHopLimit(value CaptureField) CaptureIpv6 { + + obj.hopLimitHolder = nil + obj.obj.HopLimit = value.msg() + + return obj +} + +// description is TBD +// Src returns a CaptureField +func (obj *captureIpv6) Src() CaptureField { + if obj.obj.Src == nil { + obj.obj.Src = NewCaptureField().msg() + } + if obj.srcHolder == nil { + obj.srcHolder = &captureField{obj: obj.obj.Src} + } + return obj.srcHolder +} + +// description is TBD +// Src returns a CaptureField +func (obj *captureIpv6) HasSrc() bool { + return obj.obj.Src != nil +} + +// description is TBD +// SetSrc sets the CaptureField value in the CaptureIpv6 object +func (obj *captureIpv6) SetSrc(value CaptureField) CaptureIpv6 { + + obj.srcHolder = nil + obj.obj.Src = value.msg() + + return obj +} + +// description is TBD +// Dst returns a CaptureField +func (obj *captureIpv6) Dst() CaptureField { + if obj.obj.Dst == nil { + obj.obj.Dst = NewCaptureField().msg() + } + if obj.dstHolder == nil { + obj.dstHolder = &captureField{obj: obj.obj.Dst} + } + return obj.dstHolder +} + +// description is TBD +// Dst returns a CaptureField +func (obj *captureIpv6) HasDst() bool { + return obj.obj.Dst != nil +} + +// description is TBD +// SetDst sets the CaptureField value in the CaptureIpv6 object +func (obj *captureIpv6) SetDst(value CaptureField) CaptureIpv6 { + + obj.dstHolder = nil + obj.obj.Dst = value.msg() + + return obj +} + +func (obj *captureIpv6) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Version != nil { + + obj.Version().validateObj(vObj, set_default) + } + + if obj.obj.TrafficClass != nil { + + obj.TrafficClass().validateObj(vObj, set_default) + } + + if obj.obj.FlowLabel != nil { + + obj.FlowLabel().validateObj(vObj, set_default) + } + + if obj.obj.PayloadLength != nil { + + obj.PayloadLength().validateObj(vObj, set_default) + } + + if obj.obj.NextHeader != nil { + + obj.NextHeader().validateObj(vObj, set_default) + } + + if obj.obj.HopLimit != nil { + + obj.HopLimit().validateObj(vObj, set_default) + } + + if obj.obj.Src != nil { + + obj.Src().validateObj(vObj, set_default) + } + + if obj.obj.Dst != nil { + + obj.Dst().validateObj(vObj, set_default) + } + +} + +func (obj *captureIpv6) setDefault() { + +} diff --git a/gosnappi/capture_request.go b/gosnappi/capture_request.go new file mode 100644 index 00000000..5cb38475 --- /dev/null +++ b/gosnappi/capture_request.go @@ -0,0 +1,316 @@ +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" +) + +// ***** CaptureRequest ***** +type captureRequest struct { + validation + obj *otg.CaptureRequest + marshaller marshalCaptureRequest + unMarshaller unMarshalCaptureRequest +} + +func NewCaptureRequest() CaptureRequest { + obj := captureRequest{obj: &otg.CaptureRequest{}} + obj.setDefault() + return &obj +} + +func (obj *captureRequest) msg() *otg.CaptureRequest { + return obj.obj +} + +func (obj *captureRequest) setMsg(msg *otg.CaptureRequest) CaptureRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalcaptureRequest struct { + obj *captureRequest +} + +type marshalCaptureRequest interface { + // ToProto marshals CaptureRequest to protobuf object *otg.CaptureRequest + ToProto() (*otg.CaptureRequest, error) + // ToPbText marshals CaptureRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals CaptureRequest to YAML text + ToYaml() (string, error) + // ToJson marshals CaptureRequest to JSON text + ToJson() (string, error) +} + +type unMarshalcaptureRequest struct { + obj *captureRequest +} + +type unMarshalCaptureRequest interface { + // FromProto unmarshals CaptureRequest from protobuf object *otg.CaptureRequest + FromProto(msg *otg.CaptureRequest) (CaptureRequest, error) + // FromPbText unmarshals CaptureRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals CaptureRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals CaptureRequest from JSON text + FromJson(value string) error +} + +func (obj *captureRequest) Marshal() marshalCaptureRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalcaptureRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *captureRequest) Unmarshal() unMarshalCaptureRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalcaptureRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalcaptureRequest) ToProto() (*otg.CaptureRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalcaptureRequest) FromProto(msg *otg.CaptureRequest) (CaptureRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalcaptureRequest) 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 *unMarshalcaptureRequest) 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 *marshalcaptureRequest) 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 *unMarshalcaptureRequest) 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 *marshalcaptureRequest) 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 *unMarshalcaptureRequest) 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 *captureRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *captureRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *captureRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *captureRequest) Clone() (CaptureRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewCaptureRequest() + 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 +} + +// CaptureRequest is the capture result request to the traffic generator. Stops the port capture on the port_name and returns the capture. +type CaptureRequest interface { + Validation + // msg marshals CaptureRequest to protobuf object *otg.CaptureRequest + // and doesn't set defaults + msg() *otg.CaptureRequest + // setMsg unmarshals CaptureRequest from protobuf object *otg.CaptureRequest + // and doesn't set defaults + setMsg(*otg.CaptureRequest) CaptureRequest + // provides marshal interface + Marshal() marshalCaptureRequest + // provides unmarshal interface + Unmarshal() unMarshalCaptureRequest + // validate validates CaptureRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (CaptureRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PortName returns string, set in CaptureRequest. + PortName() string + // SetPortName assigns string provided by user to CaptureRequest + SetPortName(value string) CaptureRequest +} + +// The name of a port a capture is started on. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// PortName returns a string +func (obj *captureRequest) PortName() string { + + return *obj.obj.PortName + +} + +// The name of a port a capture is started on. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// SetPortName sets the string value in the CaptureRequest object +func (obj *captureRequest) SetPortName(value string) CaptureRequest { + + obj.obj.PortName = &value + return obj +} + +func (obj *captureRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // PortName is required + if obj.obj.PortName == nil { + vObj.validationErrors = append(vObj.validationErrors, "PortName is required field on interface CaptureRequest") + } +} + +func (obj *captureRequest) setDefault() { + +} diff --git a/gosnappi/capture_vlan.go b/gosnappi/capture_vlan.go new file mode 100644 index 00000000..43976d9b --- /dev/null +++ b/gosnappi/capture_vlan.go @@ -0,0 +1,457 @@ +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" +) + +// ***** CaptureVlan ***** +type captureVlan struct { + validation + obj *otg.CaptureVlan + marshaller marshalCaptureVlan + unMarshaller unMarshalCaptureVlan + priorityHolder CaptureField + cfiHolder CaptureField + idHolder CaptureField + protocolHolder CaptureField +} + +func NewCaptureVlan() CaptureVlan { + obj := captureVlan{obj: &otg.CaptureVlan{}} + obj.setDefault() + return &obj +} + +func (obj *captureVlan) msg() *otg.CaptureVlan { + return obj.obj +} + +func (obj *captureVlan) setMsg(msg *otg.CaptureVlan) CaptureVlan { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalcaptureVlan struct { + obj *captureVlan +} + +type marshalCaptureVlan interface { + // ToProto marshals CaptureVlan to protobuf object *otg.CaptureVlan + ToProto() (*otg.CaptureVlan, error) + // ToPbText marshals CaptureVlan to protobuf text + ToPbText() (string, error) + // ToYaml marshals CaptureVlan to YAML text + ToYaml() (string, error) + // ToJson marshals CaptureVlan to JSON text + ToJson() (string, error) +} + +type unMarshalcaptureVlan struct { + obj *captureVlan +} + +type unMarshalCaptureVlan interface { + // FromProto unmarshals CaptureVlan from protobuf object *otg.CaptureVlan + FromProto(msg *otg.CaptureVlan) (CaptureVlan, error) + // FromPbText unmarshals CaptureVlan from protobuf text + FromPbText(value string) error + // FromYaml unmarshals CaptureVlan from YAML text + FromYaml(value string) error + // FromJson unmarshals CaptureVlan from JSON text + FromJson(value string) error +} + +func (obj *captureVlan) Marshal() marshalCaptureVlan { + if obj.marshaller == nil { + obj.marshaller = &marshalcaptureVlan{obj: obj} + } + return obj.marshaller +} + +func (obj *captureVlan) Unmarshal() unMarshalCaptureVlan { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalcaptureVlan{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalcaptureVlan) ToProto() (*otg.CaptureVlan, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalcaptureVlan) FromProto(msg *otg.CaptureVlan) (CaptureVlan, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalcaptureVlan) 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 *unMarshalcaptureVlan) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalcaptureVlan) 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 *unMarshalcaptureVlan) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalcaptureVlan) 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 *unMarshalcaptureVlan) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *captureVlan) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *captureVlan) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *captureVlan) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *captureVlan) Clone() (CaptureVlan, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewCaptureVlan() + 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 +} + +func (obj *captureVlan) setNil() { + obj.priorityHolder = nil + obj.cfiHolder = nil + obj.idHolder = nil + obj.protocolHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// CaptureVlan is description is TBD +type CaptureVlan interface { + Validation + // msg marshals CaptureVlan to protobuf object *otg.CaptureVlan + // and doesn't set defaults + msg() *otg.CaptureVlan + // setMsg unmarshals CaptureVlan from protobuf object *otg.CaptureVlan + // and doesn't set defaults + setMsg(*otg.CaptureVlan) CaptureVlan + // provides marshal interface + Marshal() marshalCaptureVlan + // provides unmarshal interface + Unmarshal() unMarshalCaptureVlan + // validate validates CaptureVlan + validate() error + // A stringer function + String() string + // Clones the object + Clone() (CaptureVlan, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Priority returns CaptureField, set in CaptureVlan. + // CaptureField is description is TBD + Priority() CaptureField + // SetPriority assigns CaptureField provided by user to CaptureVlan. + // CaptureField is description is TBD + SetPriority(value CaptureField) CaptureVlan + // HasPriority checks if Priority has been set in CaptureVlan + HasPriority() bool + // Cfi returns CaptureField, set in CaptureVlan. + // CaptureField is description is TBD + Cfi() CaptureField + // SetCfi assigns CaptureField provided by user to CaptureVlan. + // CaptureField is description is TBD + SetCfi(value CaptureField) CaptureVlan + // HasCfi checks if Cfi has been set in CaptureVlan + HasCfi() bool + // Id returns CaptureField, set in CaptureVlan. + // CaptureField is description is TBD + Id() CaptureField + // SetId assigns CaptureField provided by user to CaptureVlan. + // CaptureField is description is TBD + SetId(value CaptureField) CaptureVlan + // HasId checks if Id has been set in CaptureVlan + HasId() bool + // Protocol returns CaptureField, set in CaptureVlan. + // CaptureField is description is TBD + Protocol() CaptureField + // SetProtocol assigns CaptureField provided by user to CaptureVlan. + // CaptureField is description is TBD + SetProtocol(value CaptureField) CaptureVlan + // HasProtocol checks if Protocol has been set in CaptureVlan + HasProtocol() bool + setNil() +} + +// description is TBD +// Priority returns a CaptureField +func (obj *captureVlan) Priority() CaptureField { + if obj.obj.Priority == nil { + obj.obj.Priority = NewCaptureField().msg() + } + if obj.priorityHolder == nil { + obj.priorityHolder = &captureField{obj: obj.obj.Priority} + } + return obj.priorityHolder +} + +// description is TBD +// Priority returns a CaptureField +func (obj *captureVlan) HasPriority() bool { + return obj.obj.Priority != nil +} + +// description is TBD +// SetPriority sets the CaptureField value in the CaptureVlan object +func (obj *captureVlan) SetPriority(value CaptureField) CaptureVlan { + + obj.priorityHolder = nil + obj.obj.Priority = value.msg() + + return obj +} + +// description is TBD +// Cfi returns a CaptureField +func (obj *captureVlan) Cfi() CaptureField { + if obj.obj.Cfi == nil { + obj.obj.Cfi = NewCaptureField().msg() + } + if obj.cfiHolder == nil { + obj.cfiHolder = &captureField{obj: obj.obj.Cfi} + } + return obj.cfiHolder +} + +// description is TBD +// Cfi returns a CaptureField +func (obj *captureVlan) HasCfi() bool { + return obj.obj.Cfi != nil +} + +// description is TBD +// SetCfi sets the CaptureField value in the CaptureVlan object +func (obj *captureVlan) SetCfi(value CaptureField) CaptureVlan { + + obj.cfiHolder = nil + obj.obj.Cfi = value.msg() + + return obj +} + +// description is TBD +// Id returns a CaptureField +func (obj *captureVlan) Id() CaptureField { + if obj.obj.Id == nil { + obj.obj.Id = NewCaptureField().msg() + } + if obj.idHolder == nil { + obj.idHolder = &captureField{obj: obj.obj.Id} + } + return obj.idHolder +} + +// description is TBD +// Id returns a CaptureField +func (obj *captureVlan) HasId() bool { + return obj.obj.Id != nil +} + +// description is TBD +// SetId sets the CaptureField value in the CaptureVlan object +func (obj *captureVlan) SetId(value CaptureField) CaptureVlan { + + obj.idHolder = nil + obj.obj.Id = value.msg() + + return obj +} + +// description is TBD +// Protocol returns a CaptureField +func (obj *captureVlan) Protocol() CaptureField { + if obj.obj.Protocol == nil { + obj.obj.Protocol = NewCaptureField().msg() + } + if obj.protocolHolder == nil { + obj.protocolHolder = &captureField{obj: obj.obj.Protocol} + } + return obj.protocolHolder +} + +// description is TBD +// Protocol returns a CaptureField +func (obj *captureVlan) HasProtocol() bool { + return obj.obj.Protocol != nil +} + +// description is TBD +// SetProtocol sets the CaptureField value in the CaptureVlan object +func (obj *captureVlan) SetProtocol(value CaptureField) CaptureVlan { + + obj.protocolHolder = nil + obj.obj.Protocol = value.msg() + + return obj +} + +func (obj *captureVlan) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Priority != nil { + + obj.Priority().validateObj(vObj, set_default) + } + + if obj.obj.Cfi != nil { + + obj.Cfi().validateObj(vObj, set_default) + } + + if obj.obj.Id != nil { + + obj.Id().validateObj(vObj, set_default) + } + + if obj.obj.Protocol != nil { + + obj.Protocol().validateObj(vObj, set_default) + } + +} + +func (obj *captureVlan) setDefault() { + +} diff --git a/gosnappi/config.go b/gosnappi/config.go new file mode 100644 index 00000000..0a2d4a96 --- /dev/null +++ b/gosnappi/config.go @@ -0,0 +1,1110 @@ +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" +) + +// ***** Config ***** +type config struct { + validation + obj *otg.Config + marshaller marshalConfig + unMarshaller unMarshalConfig + portsHolder ConfigPortIter + lagsHolder ConfigLagIter + layer1Holder ConfigLayer1Iter + capturesHolder ConfigCaptureIter + devicesHolder ConfigDeviceIter + flowsHolder ConfigFlowIter + eventsHolder Event + optionsHolder ConfigOptions + lldpHolder ConfigLldpIter +} + +func NewConfig() Config { + obj := config{obj: &otg.Config{}} + obj.setDefault() + return &obj +} + +func (obj *config) msg() *otg.Config { + return obj.obj +} + +func (obj *config) setMsg(msg *otg.Config) Config { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalconfig struct { + obj *config +} + +type marshalConfig interface { + // ToProto marshals Config to protobuf object *otg.Config + ToProto() (*otg.Config, error) + // ToPbText marshals Config to protobuf text + ToPbText() (string, error) + // ToYaml marshals Config to YAML text + ToYaml() (string, error) + // ToJson marshals Config to JSON text + ToJson() (string, error) +} + +type unMarshalconfig struct { + obj *config +} + +type unMarshalConfig interface { + // FromProto unmarshals Config from protobuf object *otg.Config + FromProto(msg *otg.Config) (Config, error) + // FromPbText unmarshals Config from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Config from YAML text + FromYaml(value string) error + // FromJson unmarshals Config from JSON text + FromJson(value string) error +} + +func (obj *config) Marshal() marshalConfig { + if obj.marshaller == nil { + obj.marshaller = &marshalconfig{obj: obj} + } + return obj.marshaller +} + +func (obj *config) Unmarshal() unMarshalConfig { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalconfig{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalconfig) ToProto() (*otg.Config, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalconfig) FromProto(msg *otg.Config) (Config, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalconfig) 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 *unMarshalconfig) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalconfig) 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 *unMarshalconfig) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalconfig) 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 *unMarshalconfig) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *config) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *config) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *config) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *config) Clone() (Config, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewConfig() + 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 +} + +func (obj *config) setNil() { + obj.portsHolder = nil + obj.lagsHolder = nil + obj.layer1Holder = nil + obj.capturesHolder = nil + obj.devicesHolder = nil + obj.flowsHolder = nil + obj.eventsHolder = nil + obj.optionsHolder = nil + obj.lldpHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// Config is a container for all models that are part of the configuration. +type Config interface { + Validation + // msg marshals Config to protobuf object *otg.Config + // and doesn't set defaults + msg() *otg.Config + // setMsg unmarshals Config from protobuf object *otg.Config + // and doesn't set defaults + setMsg(*otg.Config) Config + // provides marshal interface + Marshal() marshalConfig + // provides unmarshal interface + Unmarshal() unMarshalConfig + // validate validates Config + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Config, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ports returns ConfigPortIterIter, set in Config + Ports() ConfigPortIter + // Lags returns ConfigLagIterIter, set in Config + Lags() ConfigLagIter + // Layer1 returns ConfigLayer1IterIter, set in Config + Layer1() ConfigLayer1Iter + // Captures returns ConfigCaptureIterIter, set in Config + Captures() ConfigCaptureIter + // Devices returns ConfigDeviceIterIter, set in Config + Devices() ConfigDeviceIter + // Flows returns ConfigFlowIterIter, set in Config + Flows() ConfigFlowIter + // Events returns Event, set in Config. + // Event is the optional container for event configuration. + Events() Event + // SetEvents assigns Event provided by user to Config. + // Event is the optional container for event configuration. + SetEvents(value Event) Config + // HasEvents checks if Events has been set in Config + HasEvents() bool + // Options returns ConfigOptions, set in Config. + // ConfigOptions is global configuration options. + Options() ConfigOptions + // SetOptions assigns ConfigOptions provided by user to Config. + // ConfigOptions is global configuration options. + SetOptions(value ConfigOptions) Config + // HasOptions checks if Options has been set in Config + HasOptions() bool + // Lldp returns ConfigLldpIterIter, set in Config + Lldp() ConfigLldpIter + setNil() +} + +// The ports that will be configured on the traffic generator. +// Ports returns a []Port +func (obj *config) Ports() ConfigPortIter { + if len(obj.obj.Ports) == 0 { + obj.obj.Ports = []*otg.Port{} + } + if obj.portsHolder == nil { + obj.portsHolder = newConfigPortIter(&obj.obj.Ports).setMsg(obj) + } + return obj.portsHolder +} + +type configPortIter struct { + obj *config + portSlice []Port + fieldPtr *[]*otg.Port +} + +func newConfigPortIter(ptr *[]*otg.Port) ConfigPortIter { + return &configPortIter{fieldPtr: ptr} +} + +type ConfigPortIter interface { + setMsg(*config) ConfigPortIter + Items() []Port + Add() Port + Append(items ...Port) ConfigPortIter + Set(index int, newObj Port) ConfigPortIter + Clear() ConfigPortIter + clearHolderSlice() ConfigPortIter + appendHolderSlice(item Port) ConfigPortIter +} + +func (obj *configPortIter) setMsg(msg *config) ConfigPortIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&port{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *configPortIter) Items() []Port { + return obj.portSlice +} + +func (obj *configPortIter) Add() Port { + newObj := &otg.Port{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &port{obj: newObj} + newLibObj.setDefault() + obj.portSlice = append(obj.portSlice, newLibObj) + return newLibObj +} + +func (obj *configPortIter) Append(items ...Port) ConfigPortIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.portSlice = append(obj.portSlice, item) + } + return obj +} + +func (obj *configPortIter) Set(index int, newObj Port) ConfigPortIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.portSlice[index] = newObj + return obj +} +func (obj *configPortIter) Clear() ConfigPortIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Port{} + obj.portSlice = []Port{} + } + return obj +} +func (obj *configPortIter) clearHolderSlice() ConfigPortIter { + if len(obj.portSlice) > 0 { + obj.portSlice = []Port{} + } + return obj +} +func (obj *configPortIter) appendHolderSlice(item Port) ConfigPortIter { + obj.portSlice = append(obj.portSlice, item) + return obj +} + +// The LAGs that will be configured on the traffic generator. +// Lags returns a []Lag +func (obj *config) Lags() ConfigLagIter { + if len(obj.obj.Lags) == 0 { + obj.obj.Lags = []*otg.Lag{} + } + if obj.lagsHolder == nil { + obj.lagsHolder = newConfigLagIter(&obj.obj.Lags).setMsg(obj) + } + return obj.lagsHolder +} + +type configLagIter struct { + obj *config + lagSlice []Lag + fieldPtr *[]*otg.Lag +} + +func newConfigLagIter(ptr *[]*otg.Lag) ConfigLagIter { + return &configLagIter{fieldPtr: ptr} +} + +type ConfigLagIter interface { + setMsg(*config) ConfigLagIter + Items() []Lag + Add() Lag + Append(items ...Lag) ConfigLagIter + Set(index int, newObj Lag) ConfigLagIter + Clear() ConfigLagIter + clearHolderSlice() ConfigLagIter + appendHolderSlice(item Lag) ConfigLagIter +} + +func (obj *configLagIter) setMsg(msg *config) ConfigLagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&lag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *configLagIter) Items() []Lag { + return obj.lagSlice +} + +func (obj *configLagIter) Add() Lag { + newObj := &otg.Lag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &lag{obj: newObj} + newLibObj.setDefault() + obj.lagSlice = append(obj.lagSlice, newLibObj) + return newLibObj +} + +func (obj *configLagIter) Append(items ...Lag) ConfigLagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.lagSlice = append(obj.lagSlice, item) + } + return obj +} + +func (obj *configLagIter) Set(index int, newObj Lag) ConfigLagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.lagSlice[index] = newObj + return obj +} +func (obj *configLagIter) Clear() ConfigLagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Lag{} + obj.lagSlice = []Lag{} + } + return obj +} +func (obj *configLagIter) clearHolderSlice() ConfigLagIter { + if len(obj.lagSlice) > 0 { + obj.lagSlice = []Lag{} + } + return obj +} +func (obj *configLagIter) appendHolderSlice(item Lag) ConfigLagIter { + obj.lagSlice = append(obj.lagSlice, item) + return obj +} + +// The layer1 settings that will be configured on the traffic generator. +// Since layer1 settings usually vary across variety of test ports, these +// most likely won't be portable. +// Layer1 returns a []Layer1 +func (obj *config) Layer1() ConfigLayer1Iter { + if len(obj.obj.Layer1) == 0 { + obj.obj.Layer1 = []*otg.Layer1{} + } + if obj.layer1Holder == nil { + obj.layer1Holder = newConfigLayer1Iter(&obj.obj.Layer1).setMsg(obj) + } + return obj.layer1Holder +} + +type configLayer1Iter struct { + obj *config + layer1Slice []Layer1 + fieldPtr *[]*otg.Layer1 +} + +func newConfigLayer1Iter(ptr *[]*otg.Layer1) ConfigLayer1Iter { + return &configLayer1Iter{fieldPtr: ptr} +} + +type ConfigLayer1Iter interface { + setMsg(*config) ConfigLayer1Iter + Items() []Layer1 + Add() Layer1 + Append(items ...Layer1) ConfigLayer1Iter + Set(index int, newObj Layer1) ConfigLayer1Iter + Clear() ConfigLayer1Iter + clearHolderSlice() ConfigLayer1Iter + appendHolderSlice(item Layer1) ConfigLayer1Iter +} + +func (obj *configLayer1Iter) setMsg(msg *config) ConfigLayer1Iter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&layer1{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *configLayer1Iter) Items() []Layer1 { + return obj.layer1Slice +} + +func (obj *configLayer1Iter) Add() Layer1 { + newObj := &otg.Layer1{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &layer1{obj: newObj} + newLibObj.setDefault() + obj.layer1Slice = append(obj.layer1Slice, newLibObj) + return newLibObj +} + +func (obj *configLayer1Iter) Append(items ...Layer1) ConfigLayer1Iter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.layer1Slice = append(obj.layer1Slice, item) + } + return obj +} + +func (obj *configLayer1Iter) Set(index int, newObj Layer1) ConfigLayer1Iter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.layer1Slice[index] = newObj + return obj +} +func (obj *configLayer1Iter) Clear() ConfigLayer1Iter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Layer1{} + obj.layer1Slice = []Layer1{} + } + return obj +} +func (obj *configLayer1Iter) clearHolderSlice() ConfigLayer1Iter { + if len(obj.layer1Slice) > 0 { + obj.layer1Slice = []Layer1{} + } + return obj +} +func (obj *configLayer1Iter) appendHolderSlice(item Layer1) ConfigLayer1Iter { + obj.layer1Slice = append(obj.layer1Slice, item) + return obj +} + +// The capture settings that will be configured on the traffic generator. +// Captures returns a []Capture +func (obj *config) Captures() ConfigCaptureIter { + if len(obj.obj.Captures) == 0 { + obj.obj.Captures = []*otg.Capture{} + } + if obj.capturesHolder == nil { + obj.capturesHolder = newConfigCaptureIter(&obj.obj.Captures).setMsg(obj) + } + return obj.capturesHolder +} + +type configCaptureIter struct { + obj *config + captureSlice []Capture + fieldPtr *[]*otg.Capture +} + +func newConfigCaptureIter(ptr *[]*otg.Capture) ConfigCaptureIter { + return &configCaptureIter{fieldPtr: ptr} +} + +type ConfigCaptureIter interface { + setMsg(*config) ConfigCaptureIter + Items() []Capture + Add() Capture + Append(items ...Capture) ConfigCaptureIter + Set(index int, newObj Capture) ConfigCaptureIter + Clear() ConfigCaptureIter + clearHolderSlice() ConfigCaptureIter + appendHolderSlice(item Capture) ConfigCaptureIter +} + +func (obj *configCaptureIter) setMsg(msg *config) ConfigCaptureIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&capture{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *configCaptureIter) Items() []Capture { + return obj.captureSlice +} + +func (obj *configCaptureIter) Add() Capture { + newObj := &otg.Capture{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &capture{obj: newObj} + newLibObj.setDefault() + obj.captureSlice = append(obj.captureSlice, newLibObj) + return newLibObj +} + +func (obj *configCaptureIter) Append(items ...Capture) ConfigCaptureIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.captureSlice = append(obj.captureSlice, item) + } + return obj +} + +func (obj *configCaptureIter) Set(index int, newObj Capture) ConfigCaptureIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.captureSlice[index] = newObj + return obj +} +func (obj *configCaptureIter) Clear() ConfigCaptureIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Capture{} + obj.captureSlice = []Capture{} + } + return obj +} +func (obj *configCaptureIter) clearHolderSlice() ConfigCaptureIter { + if len(obj.captureSlice) > 0 { + obj.captureSlice = []Capture{} + } + return obj +} +func (obj *configCaptureIter) appendHolderSlice(item Capture) ConfigCaptureIter { + obj.captureSlice = append(obj.captureSlice, item) + return obj +} + +// The emulated devices that will be configured on the traffic generator. +// Each device contains configurations for network interfaces and +// protocols running on top of those interfaces. +// Devices returns a []Device +func (obj *config) Devices() ConfigDeviceIter { + if len(obj.obj.Devices) == 0 { + obj.obj.Devices = []*otg.Device{} + } + if obj.devicesHolder == nil { + obj.devicesHolder = newConfigDeviceIter(&obj.obj.Devices).setMsg(obj) + } + return obj.devicesHolder +} + +type configDeviceIter struct { + obj *config + deviceSlice []Device + fieldPtr *[]*otg.Device +} + +func newConfigDeviceIter(ptr *[]*otg.Device) ConfigDeviceIter { + return &configDeviceIter{fieldPtr: ptr} +} + +type ConfigDeviceIter interface { + setMsg(*config) ConfigDeviceIter + Items() []Device + Add() Device + Append(items ...Device) ConfigDeviceIter + Set(index int, newObj Device) ConfigDeviceIter + Clear() ConfigDeviceIter + clearHolderSlice() ConfigDeviceIter + appendHolderSlice(item Device) ConfigDeviceIter +} + +func (obj *configDeviceIter) setMsg(msg *config) ConfigDeviceIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&device{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *configDeviceIter) Items() []Device { + return obj.deviceSlice +} + +func (obj *configDeviceIter) Add() Device { + newObj := &otg.Device{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &device{obj: newObj} + newLibObj.setDefault() + obj.deviceSlice = append(obj.deviceSlice, newLibObj) + return newLibObj +} + +func (obj *configDeviceIter) Append(items ...Device) ConfigDeviceIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.deviceSlice = append(obj.deviceSlice, item) + } + return obj +} + +func (obj *configDeviceIter) Set(index int, newObj Device) ConfigDeviceIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.deviceSlice[index] = newObj + return obj +} +func (obj *configDeviceIter) Clear() ConfigDeviceIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Device{} + obj.deviceSlice = []Device{} + } + return obj +} +func (obj *configDeviceIter) clearHolderSlice() ConfigDeviceIter { + if len(obj.deviceSlice) > 0 { + obj.deviceSlice = []Device{} + } + return obj +} +func (obj *configDeviceIter) appendHolderSlice(item Device) ConfigDeviceIter { + obj.deviceSlice = append(obj.deviceSlice, item) + return obj +} + +// The flows that will be configured on the traffic generator. +// Flows returns a []Flow +func (obj *config) Flows() ConfigFlowIter { + if len(obj.obj.Flows) == 0 { + obj.obj.Flows = []*otg.Flow{} + } + if obj.flowsHolder == nil { + obj.flowsHolder = newConfigFlowIter(&obj.obj.Flows).setMsg(obj) + } + return obj.flowsHolder +} + +type configFlowIter struct { + obj *config + flowSlice []Flow + fieldPtr *[]*otg.Flow +} + +func newConfigFlowIter(ptr *[]*otg.Flow) ConfigFlowIter { + return &configFlowIter{fieldPtr: ptr} +} + +type ConfigFlowIter interface { + setMsg(*config) ConfigFlowIter + Items() []Flow + Add() Flow + Append(items ...Flow) ConfigFlowIter + Set(index int, newObj Flow) ConfigFlowIter + Clear() ConfigFlowIter + clearHolderSlice() ConfigFlowIter + appendHolderSlice(item Flow) ConfigFlowIter +} + +func (obj *configFlowIter) setMsg(msg *config) ConfigFlowIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flow{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *configFlowIter) Items() []Flow { + return obj.flowSlice +} + +func (obj *configFlowIter) Add() Flow { + newObj := &otg.Flow{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flow{obj: newObj} + newLibObj.setDefault() + obj.flowSlice = append(obj.flowSlice, newLibObj) + return newLibObj +} + +func (obj *configFlowIter) Append(items ...Flow) ConfigFlowIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowSlice = append(obj.flowSlice, item) + } + return obj +} + +func (obj *configFlowIter) Set(index int, newObj Flow) ConfigFlowIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowSlice[index] = newObj + return obj +} +func (obj *configFlowIter) Clear() ConfigFlowIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Flow{} + obj.flowSlice = []Flow{} + } + return obj +} +func (obj *configFlowIter) clearHolderSlice() ConfigFlowIter { + if len(obj.flowSlice) > 0 { + obj.flowSlice = []Flow{} + } + return obj +} +func (obj *configFlowIter) appendHolderSlice(item Flow) ConfigFlowIter { + obj.flowSlice = append(obj.flowSlice, item) + return obj +} + +// description is TBD +// Events returns a Event +func (obj *config) Events() Event { + if obj.obj.Events == nil { + obj.obj.Events = NewEvent().msg() + } + if obj.eventsHolder == nil { + obj.eventsHolder = &event{obj: obj.obj.Events} + } + return obj.eventsHolder +} + +// description is TBD +// Events returns a Event +func (obj *config) HasEvents() bool { + return obj.obj.Events != nil +} + +// description is TBD +// SetEvents sets the Event value in the Config object +func (obj *config) SetEvents(value Event) Config { + + obj.eventsHolder = nil + obj.obj.Events = value.msg() + + return obj +} + +// description is TBD +// Options returns a ConfigOptions +func (obj *config) Options() ConfigOptions { + if obj.obj.Options == nil { + obj.obj.Options = NewConfigOptions().msg() + } + if obj.optionsHolder == nil { + obj.optionsHolder = &configOptions{obj: obj.obj.Options} + } + return obj.optionsHolder +} + +// description is TBD +// Options returns a ConfigOptions +func (obj *config) HasOptions() bool { + return obj.obj.Options != nil +} + +// description is TBD +// SetOptions sets the ConfigOptions value in the Config object +func (obj *config) SetOptions(value ConfigOptions) Config { + + obj.optionsHolder = nil + obj.obj.Options = value.msg() + + return obj +} + +// LLDP protocol that will be configured on traffic generator. +// Lldp returns a []Lldp +func (obj *config) Lldp() ConfigLldpIter { + if len(obj.obj.Lldp) == 0 { + obj.obj.Lldp = []*otg.Lldp{} + } + if obj.lldpHolder == nil { + obj.lldpHolder = newConfigLldpIter(&obj.obj.Lldp).setMsg(obj) + } + return obj.lldpHolder +} + +type configLldpIter struct { + obj *config + lldpSlice []Lldp + fieldPtr *[]*otg.Lldp +} + +func newConfigLldpIter(ptr *[]*otg.Lldp) ConfigLldpIter { + return &configLldpIter{fieldPtr: ptr} +} + +type ConfigLldpIter interface { + setMsg(*config) ConfigLldpIter + Items() []Lldp + Add() Lldp + Append(items ...Lldp) ConfigLldpIter + Set(index int, newObj Lldp) ConfigLldpIter + Clear() ConfigLldpIter + clearHolderSlice() ConfigLldpIter + appendHolderSlice(item Lldp) ConfigLldpIter +} + +func (obj *configLldpIter) setMsg(msg *config) ConfigLldpIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&lldp{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *configLldpIter) Items() []Lldp { + return obj.lldpSlice +} + +func (obj *configLldpIter) Add() Lldp { + newObj := &otg.Lldp{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &lldp{obj: newObj} + newLibObj.setDefault() + obj.lldpSlice = append(obj.lldpSlice, newLibObj) + return newLibObj +} + +func (obj *configLldpIter) Append(items ...Lldp) ConfigLldpIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.lldpSlice = append(obj.lldpSlice, item) + } + return obj +} + +func (obj *configLldpIter) Set(index int, newObj Lldp) ConfigLldpIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.lldpSlice[index] = newObj + return obj +} +func (obj *configLldpIter) Clear() ConfigLldpIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Lldp{} + obj.lldpSlice = []Lldp{} + } + return obj +} +func (obj *configLldpIter) clearHolderSlice() ConfigLldpIter { + if len(obj.lldpSlice) > 0 { + obj.lldpSlice = []Lldp{} + } + return obj +} +func (obj *configLldpIter) appendHolderSlice(item Lldp) ConfigLldpIter { + obj.lldpSlice = append(obj.lldpSlice, item) + return obj +} + +func (obj *config) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Ports) != 0 { + + if set_default { + obj.Ports().clearHolderSlice() + for _, item := range obj.obj.Ports { + obj.Ports().appendHolderSlice(&port{obj: item}) + } + } + for _, item := range obj.Ports().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Lags) != 0 { + + if set_default { + obj.Lags().clearHolderSlice() + for _, item := range obj.obj.Lags { + obj.Lags().appendHolderSlice(&lag{obj: item}) + } + } + for _, item := range obj.Lags().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Layer1) != 0 { + + if set_default { + obj.Layer1().clearHolderSlice() + for _, item := range obj.obj.Layer1 { + obj.Layer1().appendHolderSlice(&layer1{obj: item}) + } + } + for _, item := range obj.Layer1().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Captures) != 0 { + + if set_default { + obj.Captures().clearHolderSlice() + for _, item := range obj.obj.Captures { + obj.Captures().appendHolderSlice(&capture{obj: item}) + } + } + for _, item := range obj.Captures().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Devices) != 0 { + + if set_default { + obj.Devices().clearHolderSlice() + for _, item := range obj.obj.Devices { + obj.Devices().appendHolderSlice(&device{obj: item}) + } + } + for _, item := range obj.Devices().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Flows) != 0 { + + if set_default { + obj.Flows().clearHolderSlice() + for _, item := range obj.obj.Flows { + obj.Flows().appendHolderSlice(&flow{obj: item}) + } + } + for _, item := range obj.Flows().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Events != nil { + + obj.Events().validateObj(vObj, set_default) + } + + if obj.obj.Options != nil { + + obj.Options().validateObj(vObj, set_default) + } + + if len(obj.obj.Lldp) != 0 { + + if set_default { + obj.Lldp().clearHolderSlice() + for _, item := range obj.obj.Lldp { + obj.Lldp().appendHolderSlice(&lldp{obj: item}) + } + } + for _, item := range obj.Lldp().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *config) setDefault() { + +} diff --git a/gosnappi/config_options.go b/gosnappi/config_options.go new file mode 100644 index 00000000..39d31718 --- /dev/null +++ b/gosnappi/config_options.go @@ -0,0 +1,371 @@ +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" +) + +// ***** ConfigOptions ***** +type configOptions struct { + validation + obj *otg.ConfigOptions + marshaller marshalConfigOptions + unMarshaller unMarshalConfigOptions + portOptionsHolder PortOptions + protocolOptionsHolder ProtocolOptions +} + +func NewConfigOptions() ConfigOptions { + obj := configOptions{obj: &otg.ConfigOptions{}} + obj.setDefault() + return &obj +} + +func (obj *configOptions) msg() *otg.ConfigOptions { + return obj.obj +} + +func (obj *configOptions) setMsg(msg *otg.ConfigOptions) ConfigOptions { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalconfigOptions struct { + obj *configOptions +} + +type marshalConfigOptions interface { + // ToProto marshals ConfigOptions to protobuf object *otg.ConfigOptions + ToProto() (*otg.ConfigOptions, error) + // ToPbText marshals ConfigOptions to protobuf text + ToPbText() (string, error) + // ToYaml marshals ConfigOptions to YAML text + ToYaml() (string, error) + // ToJson marshals ConfigOptions to JSON text + ToJson() (string, error) +} + +type unMarshalconfigOptions struct { + obj *configOptions +} + +type unMarshalConfigOptions interface { + // FromProto unmarshals ConfigOptions from protobuf object *otg.ConfigOptions + FromProto(msg *otg.ConfigOptions) (ConfigOptions, error) + // FromPbText unmarshals ConfigOptions from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ConfigOptions from YAML text + FromYaml(value string) error + // FromJson unmarshals ConfigOptions from JSON text + FromJson(value string) error +} + +func (obj *configOptions) Marshal() marshalConfigOptions { + if obj.marshaller == nil { + obj.marshaller = &marshalconfigOptions{obj: obj} + } + return obj.marshaller +} + +func (obj *configOptions) Unmarshal() unMarshalConfigOptions { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalconfigOptions{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalconfigOptions) ToProto() (*otg.ConfigOptions, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalconfigOptions) FromProto(msg *otg.ConfigOptions) (ConfigOptions, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalconfigOptions) 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 *unMarshalconfigOptions) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalconfigOptions) 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 *unMarshalconfigOptions) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalconfigOptions) 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 *unMarshalconfigOptions) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *configOptions) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *configOptions) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *configOptions) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *configOptions) Clone() (ConfigOptions, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewConfigOptions() + 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 +} + +func (obj *configOptions) setNil() { + obj.portOptionsHolder = nil + obj.protocolOptionsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ConfigOptions is global configuration options. +type ConfigOptions interface { + Validation + // msg marshals ConfigOptions to protobuf object *otg.ConfigOptions + // and doesn't set defaults + msg() *otg.ConfigOptions + // setMsg unmarshals ConfigOptions from protobuf object *otg.ConfigOptions + // and doesn't set defaults + setMsg(*otg.ConfigOptions) ConfigOptions + // provides marshal interface + Marshal() marshalConfigOptions + // provides unmarshal interface + Unmarshal() unMarshalConfigOptions + // validate validates ConfigOptions + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ConfigOptions, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PortOptions returns PortOptions, set in ConfigOptions. + // PortOptions is common port options that apply to all configured Port objects. + PortOptions() PortOptions + // SetPortOptions assigns PortOptions provided by user to ConfigOptions. + // PortOptions is common port options that apply to all configured Port objects. + SetPortOptions(value PortOptions) ConfigOptions + // HasPortOptions checks if PortOptions has been set in ConfigOptions + HasPortOptions() bool + // ProtocolOptions returns ProtocolOptions, set in ConfigOptions. + // ProtocolOptions is common options that apply to all configured protocols and interfaces. + ProtocolOptions() ProtocolOptions + // SetProtocolOptions assigns ProtocolOptions provided by user to ConfigOptions. + // ProtocolOptions is common options that apply to all configured protocols and interfaces. + SetProtocolOptions(value ProtocolOptions) ConfigOptions + // HasProtocolOptions checks if ProtocolOptions has been set in ConfigOptions + HasProtocolOptions() bool + setNil() +} + +// description is TBD +// PortOptions returns a PortOptions +func (obj *configOptions) PortOptions() PortOptions { + if obj.obj.PortOptions == nil { + obj.obj.PortOptions = NewPortOptions().msg() + } + if obj.portOptionsHolder == nil { + obj.portOptionsHolder = &portOptions{obj: obj.obj.PortOptions} + } + return obj.portOptionsHolder +} + +// description is TBD +// PortOptions returns a PortOptions +func (obj *configOptions) HasPortOptions() bool { + return obj.obj.PortOptions != nil +} + +// description is TBD +// SetPortOptions sets the PortOptions value in the ConfigOptions object +func (obj *configOptions) SetPortOptions(value PortOptions) ConfigOptions { + + obj.portOptionsHolder = nil + obj.obj.PortOptions = value.msg() + + return obj +} + +// description is TBD +// ProtocolOptions returns a ProtocolOptions +func (obj *configOptions) ProtocolOptions() ProtocolOptions { + if obj.obj.ProtocolOptions == nil { + obj.obj.ProtocolOptions = NewProtocolOptions().msg() + } + if obj.protocolOptionsHolder == nil { + obj.protocolOptionsHolder = &protocolOptions{obj: obj.obj.ProtocolOptions} + } + return obj.protocolOptionsHolder +} + +// description is TBD +// ProtocolOptions returns a ProtocolOptions +func (obj *configOptions) HasProtocolOptions() bool { + return obj.obj.ProtocolOptions != nil +} + +// description is TBD +// SetProtocolOptions sets the ProtocolOptions value in the ConfigOptions object +func (obj *configOptions) SetProtocolOptions(value ProtocolOptions) ConfigOptions { + + obj.protocolOptionsHolder = nil + obj.obj.ProtocolOptions = value.msg() + + return obj +} + +func (obj *configOptions) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.PortOptions != nil { + + obj.PortOptions().validateObj(vObj, set_default) + } + + if obj.obj.ProtocolOptions != nil { + + obj.ProtocolOptions().validateObj(vObj, set_default) + } + +} + +func (obj *configOptions) setDefault() { + +} diff --git a/gosnappi/config_update.go b/gosnappi/config_update.go new file mode 100644 index 00000000..a37709b5 --- /dev/null +++ b/gosnappi/config_update.go @@ -0,0 +1,390 @@ +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" +) + +// ***** ConfigUpdate ***** +type configUpdate struct { + validation + obj *otg.ConfigUpdate + marshaller marshalConfigUpdate + unMarshaller unMarshalConfigUpdate + flowsHolder FlowsUpdate +} + +func NewConfigUpdate() ConfigUpdate { + obj := configUpdate{obj: &otg.ConfigUpdate{}} + obj.setDefault() + return &obj +} + +func (obj *configUpdate) msg() *otg.ConfigUpdate { + return obj.obj +} + +func (obj *configUpdate) setMsg(msg *otg.ConfigUpdate) ConfigUpdate { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalconfigUpdate struct { + obj *configUpdate +} + +type marshalConfigUpdate interface { + // ToProto marshals ConfigUpdate to protobuf object *otg.ConfigUpdate + ToProto() (*otg.ConfigUpdate, error) + // ToPbText marshals ConfigUpdate to protobuf text + ToPbText() (string, error) + // ToYaml marshals ConfigUpdate to YAML text + ToYaml() (string, error) + // ToJson marshals ConfigUpdate to JSON text + ToJson() (string, error) +} + +type unMarshalconfigUpdate struct { + obj *configUpdate +} + +type unMarshalConfigUpdate interface { + // FromProto unmarshals ConfigUpdate from protobuf object *otg.ConfigUpdate + FromProto(msg *otg.ConfigUpdate) (ConfigUpdate, error) + // FromPbText unmarshals ConfigUpdate from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ConfigUpdate from YAML text + FromYaml(value string) error + // FromJson unmarshals ConfigUpdate from JSON text + FromJson(value string) error +} + +func (obj *configUpdate) Marshal() marshalConfigUpdate { + if obj.marshaller == nil { + obj.marshaller = &marshalconfigUpdate{obj: obj} + } + return obj.marshaller +} + +func (obj *configUpdate) Unmarshal() unMarshalConfigUpdate { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalconfigUpdate{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalconfigUpdate) ToProto() (*otg.ConfigUpdate, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalconfigUpdate) FromProto(msg *otg.ConfigUpdate) (ConfigUpdate, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalconfigUpdate) 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 *unMarshalconfigUpdate) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalconfigUpdate) 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 *unMarshalconfigUpdate) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalconfigUpdate) 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 *unMarshalconfigUpdate) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *configUpdate) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *configUpdate) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *configUpdate) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *configUpdate) Clone() (ConfigUpdate, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewConfigUpdate() + 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 +} + +func (obj *configUpdate) setNil() { + obj.flowsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ConfigUpdate is request for updating specific attributes of resources in traffic generator +type ConfigUpdate interface { + Validation + // msg marshals ConfigUpdate to protobuf object *otg.ConfigUpdate + // and doesn't set defaults + msg() *otg.ConfigUpdate + // setMsg unmarshals ConfigUpdate from protobuf object *otg.ConfigUpdate + // and doesn't set defaults + setMsg(*otg.ConfigUpdate) ConfigUpdate + // provides marshal interface + Marshal() marshalConfigUpdate + // provides unmarshal interface + Unmarshal() unMarshalConfigUpdate + // validate validates ConfigUpdate + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ConfigUpdate, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ConfigUpdateChoiceEnum, set in ConfigUpdate + Choice() ConfigUpdateChoiceEnum + // setChoice assigns ConfigUpdateChoiceEnum provided by user to ConfigUpdate + setChoice(value ConfigUpdateChoiceEnum) ConfigUpdate + // HasChoice checks if Choice has been set in ConfigUpdate + HasChoice() bool + // Flows returns FlowsUpdate, set in ConfigUpdate. + // FlowsUpdate is a container of flows with associated properties to be updated without affecting the flows current transmit state. + Flows() FlowsUpdate + // SetFlows assigns FlowsUpdate provided by user to ConfigUpdate. + // FlowsUpdate is a container of flows with associated properties to be updated without affecting the flows current transmit state. + SetFlows(value FlowsUpdate) ConfigUpdate + // HasFlows checks if Flows has been set in ConfigUpdate + HasFlows() bool + setNil() +} + +type ConfigUpdateChoiceEnum string + +// Enum of Choice on ConfigUpdate +var ConfigUpdateChoice = struct { + FLOWS ConfigUpdateChoiceEnum +}{ + FLOWS: ConfigUpdateChoiceEnum("flows"), +} + +func (obj *configUpdate) Choice() ConfigUpdateChoiceEnum { + return ConfigUpdateChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *configUpdate) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *configUpdate) setChoice(value ConfigUpdateChoiceEnum) ConfigUpdate { + intValue, ok := otg.ConfigUpdate_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ConfigUpdateChoiceEnum", string(value))) + return obj + } + enumValue := otg.ConfigUpdate_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Flows = nil + obj.flowsHolder = nil + + if value == ConfigUpdateChoice.FLOWS { + obj.obj.Flows = NewFlowsUpdate().msg() + } + + return obj +} + +// description is TBD +// Flows returns a FlowsUpdate +func (obj *configUpdate) Flows() FlowsUpdate { + if obj.obj.Flows == nil { + obj.setChoice(ConfigUpdateChoice.FLOWS) + } + if obj.flowsHolder == nil { + obj.flowsHolder = &flowsUpdate{obj: obj.obj.Flows} + } + return obj.flowsHolder +} + +// description is TBD +// Flows returns a FlowsUpdate +func (obj *configUpdate) HasFlows() bool { + return obj.obj.Flows != nil +} + +// description is TBD +// SetFlows sets the FlowsUpdate value in the ConfigUpdate object +func (obj *configUpdate) SetFlows(value FlowsUpdate) ConfigUpdate { + obj.setChoice(ConfigUpdateChoice.FLOWS) + obj.flowsHolder = nil + obj.obj.Flows = value.msg() + + return obj +} + +func (obj *configUpdate) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flows != nil { + + obj.Flows().validateObj(vObj, set_default) + } + +} + +func (obj *configUpdate) setDefault() { + var choices_set int = 0 + var choice ConfigUpdateChoiceEnum + + if obj.obj.Flows != nil { + choices_set += 1 + choice = ConfigUpdateChoice.FLOWS + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ConfigUpdate") + } + } else { + intVal := otg.ConfigUpdate_Choice_Enum_value[string(choice)] + enumValue := otg.ConfigUpdate_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/control_action.go b/gosnappi/control_action.go new file mode 100644 index 00000000..31700e43 --- /dev/null +++ b/gosnappi/control_action.go @@ -0,0 +1,387 @@ +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" +) + +// ***** ControlAction ***** +type controlAction struct { + validation + obj *otg.ControlAction + marshaller marshalControlAction + unMarshaller unMarshalControlAction + protocolHolder ActionProtocol +} + +func NewControlAction() ControlAction { + obj := controlAction{obj: &otg.ControlAction{}} + obj.setDefault() + return &obj +} + +func (obj *controlAction) msg() *otg.ControlAction { + return obj.obj +} + +func (obj *controlAction) setMsg(msg *otg.ControlAction) ControlAction { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalcontrolAction struct { + obj *controlAction +} + +type marshalControlAction interface { + // ToProto marshals ControlAction to protobuf object *otg.ControlAction + ToProto() (*otg.ControlAction, error) + // ToPbText marshals ControlAction to protobuf text + ToPbText() (string, error) + // ToYaml marshals ControlAction to YAML text + ToYaml() (string, error) + // ToJson marshals ControlAction to JSON text + ToJson() (string, error) +} + +type unMarshalcontrolAction struct { + obj *controlAction +} + +type unMarshalControlAction interface { + // FromProto unmarshals ControlAction from protobuf object *otg.ControlAction + FromProto(msg *otg.ControlAction) (ControlAction, error) + // FromPbText unmarshals ControlAction from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ControlAction from YAML text + FromYaml(value string) error + // FromJson unmarshals ControlAction from JSON text + FromJson(value string) error +} + +func (obj *controlAction) Marshal() marshalControlAction { + if obj.marshaller == nil { + obj.marshaller = &marshalcontrolAction{obj: obj} + } + return obj.marshaller +} + +func (obj *controlAction) Unmarshal() unMarshalControlAction { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalcontrolAction{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalcontrolAction) ToProto() (*otg.ControlAction, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalcontrolAction) FromProto(msg *otg.ControlAction) (ControlAction, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalcontrolAction) 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 *unMarshalcontrolAction) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalcontrolAction) 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 *unMarshalcontrolAction) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalcontrolAction) 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 *unMarshalcontrolAction) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *controlAction) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *controlAction) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *controlAction) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *controlAction) Clone() (ControlAction, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewControlAction() + 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 +} + +func (obj *controlAction) setNil() { + obj.protocolHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ControlAction is request for triggering action against configured resources. +type ControlAction interface { + Validation + // msg marshals ControlAction to protobuf object *otg.ControlAction + // and doesn't set defaults + msg() *otg.ControlAction + // setMsg unmarshals ControlAction from protobuf object *otg.ControlAction + // and doesn't set defaults + setMsg(*otg.ControlAction) ControlAction + // provides marshal interface + Marshal() marshalControlAction + // provides unmarshal interface + Unmarshal() unMarshalControlAction + // validate validates ControlAction + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ControlAction, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ControlActionChoiceEnum, set in ControlAction + Choice() ControlActionChoiceEnum + // setChoice assigns ControlActionChoiceEnum provided by user to ControlAction + setChoice(value ControlActionChoiceEnum) ControlAction + // Protocol returns ActionProtocol, set in ControlAction. + // ActionProtocol is actions associated with protocols on configured resources. + Protocol() ActionProtocol + // SetProtocol assigns ActionProtocol provided by user to ControlAction. + // ActionProtocol is actions associated with protocols on configured resources. + SetProtocol(value ActionProtocol) ControlAction + // HasProtocol checks if Protocol has been set in ControlAction + HasProtocol() bool + setNil() +} + +type ControlActionChoiceEnum string + +// Enum of Choice on ControlAction +var ControlActionChoice = struct { + PROTOCOL ControlActionChoiceEnum +}{ + PROTOCOL: ControlActionChoiceEnum("protocol"), +} + +func (obj *controlAction) Choice() ControlActionChoiceEnum { + return ControlActionChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *controlAction) setChoice(value ControlActionChoiceEnum) ControlAction { + intValue, ok := otg.ControlAction_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ControlActionChoiceEnum", string(value))) + return obj + } + enumValue := otg.ControlAction_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Protocol = nil + obj.protocolHolder = nil + + if value == ControlActionChoice.PROTOCOL { + obj.obj.Protocol = NewActionProtocol().msg() + } + + return obj +} + +// description is TBD +// Protocol returns a ActionProtocol +func (obj *controlAction) Protocol() ActionProtocol { + if obj.obj.Protocol == nil { + obj.setChoice(ControlActionChoice.PROTOCOL) + } + if obj.protocolHolder == nil { + obj.protocolHolder = &actionProtocol{obj: obj.obj.Protocol} + } + return obj.protocolHolder +} + +// description is TBD +// Protocol returns a ActionProtocol +func (obj *controlAction) HasProtocol() bool { + return obj.obj.Protocol != nil +} + +// description is TBD +// SetProtocol sets the ActionProtocol value in the ControlAction object +func (obj *controlAction) SetProtocol(value ActionProtocol) ControlAction { + obj.setChoice(ControlActionChoice.PROTOCOL) + obj.protocolHolder = nil + obj.obj.Protocol = value.msg() + + return obj +} + +func (obj *controlAction) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ControlAction") + } + + if obj.obj.Protocol != nil { + + obj.Protocol().validateObj(vObj, set_default) + } + +} + +func (obj *controlAction) setDefault() { + var choices_set int = 0 + var choice ControlActionChoiceEnum + + if obj.obj.Protocol != nil { + choices_set += 1 + choice = ControlActionChoice.PROTOCOL + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ControlAction") + } + } else { + intVal := otg.ControlAction_Choice_Enum_value[string(choice)] + enumValue := otg.ControlAction_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/control_action_response.go b/gosnappi/control_action_response.go new file mode 100644 index 00000000..1a8630b0 --- /dev/null +++ b/gosnappi/control_action_response.go @@ -0,0 +1,353 @@ +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" +) + +// ***** ControlActionResponse ***** +type controlActionResponse struct { + validation + obj *otg.ControlActionResponse + marshaller marshalControlActionResponse + unMarshaller unMarshalControlActionResponse + responseHolder ActionResponse +} + +func NewControlActionResponse() ControlActionResponse { + obj := controlActionResponse{obj: &otg.ControlActionResponse{}} + obj.setDefault() + return &obj +} + +func (obj *controlActionResponse) msg() *otg.ControlActionResponse { + return obj.obj +} + +func (obj *controlActionResponse) setMsg(msg *otg.ControlActionResponse) ControlActionResponse { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalcontrolActionResponse struct { + obj *controlActionResponse +} + +type marshalControlActionResponse interface { + // ToProto marshals ControlActionResponse to protobuf object *otg.ControlActionResponse + ToProto() (*otg.ControlActionResponse, error) + // ToPbText marshals ControlActionResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals ControlActionResponse to YAML text + ToYaml() (string, error) + // ToJson marshals ControlActionResponse to JSON text + ToJson() (string, error) +} + +type unMarshalcontrolActionResponse struct { + obj *controlActionResponse +} + +type unMarshalControlActionResponse interface { + // FromProto unmarshals ControlActionResponse from protobuf object *otg.ControlActionResponse + FromProto(msg *otg.ControlActionResponse) (ControlActionResponse, error) + // FromPbText unmarshals ControlActionResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ControlActionResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals ControlActionResponse from JSON text + FromJson(value string) error +} + +func (obj *controlActionResponse) Marshal() marshalControlActionResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalcontrolActionResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *controlActionResponse) Unmarshal() unMarshalControlActionResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalcontrolActionResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalcontrolActionResponse) ToProto() (*otg.ControlActionResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalcontrolActionResponse) FromProto(msg *otg.ControlActionResponse) (ControlActionResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalcontrolActionResponse) 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 *unMarshalcontrolActionResponse) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalcontrolActionResponse) 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 *unMarshalcontrolActionResponse) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalcontrolActionResponse) 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 *unMarshalcontrolActionResponse) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *controlActionResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *controlActionResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *controlActionResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *controlActionResponse) Clone() (ControlActionResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewControlActionResponse() + 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 +} + +func (obj *controlActionResponse) setNil() { + obj.responseHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ControlActionResponse is response for action triggered against configured resources along with warnings. +type ControlActionResponse interface { + Validation + // msg marshals ControlActionResponse to protobuf object *otg.ControlActionResponse + // and doesn't set defaults + msg() *otg.ControlActionResponse + // setMsg unmarshals ControlActionResponse from protobuf object *otg.ControlActionResponse + // and doesn't set defaults + setMsg(*otg.ControlActionResponse) ControlActionResponse + // provides marshal interface + Marshal() marshalControlActionResponse + // provides unmarshal interface + Unmarshal() unMarshalControlActionResponse + // validate validates ControlActionResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ControlActionResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Warnings returns []string, set in ControlActionResponse. + Warnings() []string + // SetWarnings assigns []string provided by user to ControlActionResponse + SetWarnings(value []string) ControlActionResponse + // Response returns ActionResponse, set in ControlActionResponse. + // ActionResponse is response for action triggered against configured resources. + Response() ActionResponse + // SetResponse assigns ActionResponse provided by user to ControlActionResponse. + // ActionResponse is response for action triggered against configured resources. + SetResponse(value ActionResponse) ControlActionResponse + // HasResponse checks if Response has been set in ControlActionResponse + HasResponse() bool + setNil() +} + +// List of warnings generated while triggering specified action +// Warnings returns a []string +func (obj *controlActionResponse) Warnings() []string { + if obj.obj.Warnings == nil { + obj.obj.Warnings = make([]string, 0) + } + return obj.obj.Warnings +} + +// List of warnings generated while triggering specified action +// SetWarnings sets the []string value in the ControlActionResponse object +func (obj *controlActionResponse) SetWarnings(value []string) ControlActionResponse { + + if obj.obj.Warnings == nil { + obj.obj.Warnings = make([]string, 0) + } + obj.obj.Warnings = value + + return obj +} + +// description is TBD +// Response returns a ActionResponse +func (obj *controlActionResponse) Response() ActionResponse { + if obj.obj.Response == nil { + obj.obj.Response = NewActionResponse().msg() + } + if obj.responseHolder == nil { + obj.responseHolder = &actionResponse{obj: obj.obj.Response} + } + return obj.responseHolder +} + +// description is TBD +// Response returns a ActionResponse +func (obj *controlActionResponse) HasResponse() bool { + return obj.obj.Response != nil +} + +// description is TBD +// SetResponse sets the ActionResponse value in the ControlActionResponse object +func (obj *controlActionResponse) SetResponse(value ActionResponse) ControlActionResponse { + + obj.responseHolder = nil + obj.obj.Response = value.msg() + + return obj +} + +func (obj *controlActionResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Response != nil { + + obj.Response().validateObj(vObj, set_default) + } + +} + +func (obj *controlActionResponse) setDefault() { + +} diff --git a/gosnappi/control_state.go b/gosnappi/control_state.go new file mode 100644 index 00000000..f308eae2 --- /dev/null +++ b/gosnappi/control_state.go @@ -0,0 +1,499 @@ +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" +) + +// ***** ControlState ***** +type controlState struct { + validation + obj *otg.ControlState + marshaller marshalControlState + unMarshaller unMarshalControlState + portHolder StatePort + protocolHolder StateProtocol + trafficHolder StateTraffic +} + +func NewControlState() ControlState { + obj := controlState{obj: &otg.ControlState{}} + obj.setDefault() + return &obj +} + +func (obj *controlState) msg() *otg.ControlState { + return obj.obj +} + +func (obj *controlState) setMsg(msg *otg.ControlState) ControlState { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalcontrolState struct { + obj *controlState +} + +type marshalControlState interface { + // ToProto marshals ControlState to protobuf object *otg.ControlState + ToProto() (*otg.ControlState, error) + // ToPbText marshals ControlState to protobuf text + ToPbText() (string, error) + // ToYaml marshals ControlState to YAML text + ToYaml() (string, error) + // ToJson marshals ControlState to JSON text + ToJson() (string, error) +} + +type unMarshalcontrolState struct { + obj *controlState +} + +type unMarshalControlState interface { + // FromProto unmarshals ControlState from protobuf object *otg.ControlState + FromProto(msg *otg.ControlState) (ControlState, error) + // FromPbText unmarshals ControlState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ControlState from YAML text + FromYaml(value string) error + // FromJson unmarshals ControlState from JSON text + FromJson(value string) error +} + +func (obj *controlState) Marshal() marshalControlState { + if obj.marshaller == nil { + obj.marshaller = &marshalcontrolState{obj: obj} + } + return obj.marshaller +} + +func (obj *controlState) Unmarshal() unMarshalControlState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalcontrolState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalcontrolState) ToProto() (*otg.ControlState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalcontrolState) FromProto(msg *otg.ControlState) (ControlState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalcontrolState) 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 *unMarshalcontrolState) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalcontrolState) 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 *unMarshalcontrolState) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalcontrolState) 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 *unMarshalcontrolState) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *controlState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *controlState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *controlState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *controlState) Clone() (ControlState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewControlState() + 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 +} + +func (obj *controlState) setNil() { + obj.portHolder = nil + obj.protocolHolder = nil + obj.trafficHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ControlState is request for setting operational state of configured resources. +type ControlState interface { + Validation + // msg marshals ControlState to protobuf object *otg.ControlState + // and doesn't set defaults + msg() *otg.ControlState + // setMsg unmarshals ControlState from protobuf object *otg.ControlState + // and doesn't set defaults + setMsg(*otg.ControlState) ControlState + // provides marshal interface + Marshal() marshalControlState + // provides unmarshal interface + Unmarshal() unMarshalControlState + // validate validates ControlState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ControlState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ControlStateChoiceEnum, set in ControlState + Choice() ControlStateChoiceEnum + // setChoice assigns ControlStateChoiceEnum provided by user to ControlState + setChoice(value ControlStateChoiceEnum) ControlState + // Port returns StatePort, set in ControlState. + // StatePort is states associated with configured ports. + Port() StatePort + // SetPort assigns StatePort provided by user to ControlState. + // StatePort is states associated with configured ports. + SetPort(value StatePort) ControlState + // HasPort checks if Port has been set in ControlState + HasPort() bool + // Protocol returns StateProtocol, set in ControlState. + // StateProtocol is states associated with protocols on configured resources. + Protocol() StateProtocol + // SetProtocol assigns StateProtocol provided by user to ControlState. + // StateProtocol is states associated with protocols on configured resources. + SetProtocol(value StateProtocol) ControlState + // HasProtocol checks if Protocol has been set in ControlState + HasProtocol() bool + // Traffic returns StateTraffic, set in ControlState. + // StateTraffic is states associated with configured flows + Traffic() StateTraffic + // SetTraffic assigns StateTraffic provided by user to ControlState. + // StateTraffic is states associated with configured flows + SetTraffic(value StateTraffic) ControlState + // HasTraffic checks if Traffic has been set in ControlState + HasTraffic() bool + setNil() +} + +type ControlStateChoiceEnum string + +// Enum of Choice on ControlState +var ControlStateChoice = struct { + PORT ControlStateChoiceEnum + PROTOCOL ControlStateChoiceEnum + TRAFFIC ControlStateChoiceEnum +}{ + PORT: ControlStateChoiceEnum("port"), + PROTOCOL: ControlStateChoiceEnum("protocol"), + TRAFFIC: ControlStateChoiceEnum("traffic"), +} + +func (obj *controlState) Choice() ControlStateChoiceEnum { + return ControlStateChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *controlState) setChoice(value ControlStateChoiceEnum) ControlState { + intValue, ok := otg.ControlState_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ControlStateChoiceEnum", string(value))) + return obj + } + enumValue := otg.ControlState_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Traffic = nil + obj.trafficHolder = nil + obj.obj.Protocol = nil + obj.protocolHolder = nil + obj.obj.Port = nil + obj.portHolder = nil + + if value == ControlStateChoice.PORT { + obj.obj.Port = NewStatePort().msg() + } + + if value == ControlStateChoice.PROTOCOL { + obj.obj.Protocol = NewStateProtocol().msg() + } + + if value == ControlStateChoice.TRAFFIC { + obj.obj.Traffic = NewStateTraffic().msg() + } + + return obj +} + +// description is TBD +// Port returns a StatePort +func (obj *controlState) Port() StatePort { + if obj.obj.Port == nil { + obj.setChoice(ControlStateChoice.PORT) + } + if obj.portHolder == nil { + obj.portHolder = &statePort{obj: obj.obj.Port} + } + return obj.portHolder +} + +// description is TBD +// Port returns a StatePort +func (obj *controlState) HasPort() bool { + return obj.obj.Port != nil +} + +// description is TBD +// SetPort sets the StatePort value in the ControlState object +func (obj *controlState) SetPort(value StatePort) ControlState { + obj.setChoice(ControlStateChoice.PORT) + obj.portHolder = nil + obj.obj.Port = value.msg() + + return obj +} + +// description is TBD +// Protocol returns a StateProtocol +func (obj *controlState) Protocol() StateProtocol { + if obj.obj.Protocol == nil { + obj.setChoice(ControlStateChoice.PROTOCOL) + } + if obj.protocolHolder == nil { + obj.protocolHolder = &stateProtocol{obj: obj.obj.Protocol} + } + return obj.protocolHolder +} + +// description is TBD +// Protocol returns a StateProtocol +func (obj *controlState) HasProtocol() bool { + return obj.obj.Protocol != nil +} + +// description is TBD +// SetProtocol sets the StateProtocol value in the ControlState object +func (obj *controlState) SetProtocol(value StateProtocol) ControlState { + obj.setChoice(ControlStateChoice.PROTOCOL) + obj.protocolHolder = nil + obj.obj.Protocol = value.msg() + + return obj +} + +// description is TBD +// Traffic returns a StateTraffic +func (obj *controlState) Traffic() StateTraffic { + if obj.obj.Traffic == nil { + obj.setChoice(ControlStateChoice.TRAFFIC) + } + if obj.trafficHolder == nil { + obj.trafficHolder = &stateTraffic{obj: obj.obj.Traffic} + } + return obj.trafficHolder +} + +// description is TBD +// Traffic returns a StateTraffic +func (obj *controlState) HasTraffic() bool { + return obj.obj.Traffic != nil +} + +// description is TBD +// SetTraffic sets the StateTraffic value in the ControlState object +func (obj *controlState) SetTraffic(value StateTraffic) ControlState { + obj.setChoice(ControlStateChoice.TRAFFIC) + obj.trafficHolder = nil + obj.obj.Traffic = value.msg() + + return obj +} + +func (obj *controlState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ControlState") + } + + if obj.obj.Port != nil { + + obj.Port().validateObj(vObj, set_default) + } + + if obj.obj.Protocol != nil { + + obj.Protocol().validateObj(vObj, set_default) + } + + if obj.obj.Traffic != nil { + + obj.Traffic().validateObj(vObj, set_default) + } + +} + +func (obj *controlState) setDefault() { + var choices_set int = 0 + var choice ControlStateChoiceEnum + + if obj.obj.Port != nil { + choices_set += 1 + choice = ControlStateChoice.PORT + } + + if obj.obj.Protocol != nil { + choices_set += 1 + choice = ControlStateChoice.PROTOCOL + } + + if obj.obj.Traffic != nil { + choices_set += 1 + choice = ControlStateChoice.TRAFFIC + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ControlState") + } + } else { + intVal := otg.ControlState_Choice_Enum_value[string(choice)] + enumValue := otg.ControlState_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/device.go b/gosnappi/device.go new file mode 100644 index 00000000..72507621 --- /dev/null +++ b/gosnappi/device.go @@ -0,0 +1,840 @@ +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" +) + +// ***** Device ***** +type device struct { + validation + obj *otg.Device + marshaller marshalDevice + unMarshaller unMarshalDevice + ethernetsHolder DeviceDeviceEthernetIter + ipv4LoopbacksHolder DeviceDeviceIpv4LoopbackIter + ipv6LoopbacksHolder DeviceDeviceIpv6LoopbackIter + isisHolder DeviceIsisRouter + bgpHolder DeviceBgpRouter + vxlanHolder DeviceVxlan + rsvpHolder DeviceRsvp + dhcpServerHolder DeviceDhcpServer +} + +func NewDevice() Device { + obj := device{obj: &otg.Device{}} + obj.setDefault() + return &obj +} + +func (obj *device) msg() *otg.Device { + return obj.obj +} + +func (obj *device) setMsg(msg *otg.Device) Device { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldevice struct { + obj *device +} + +type marshalDevice interface { + // ToProto marshals Device to protobuf object *otg.Device + ToProto() (*otg.Device, error) + // ToPbText marshals Device to protobuf text + ToPbText() (string, error) + // ToYaml marshals Device to YAML text + ToYaml() (string, error) + // ToJson marshals Device to JSON text + ToJson() (string, error) +} + +type unMarshaldevice struct { + obj *device +} + +type unMarshalDevice interface { + // FromProto unmarshals Device from protobuf object *otg.Device + FromProto(msg *otg.Device) (Device, error) + // FromPbText unmarshals Device from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Device from YAML text + FromYaml(value string) error + // FromJson unmarshals Device from JSON text + FromJson(value string) error +} + +func (obj *device) Marshal() marshalDevice { + if obj.marshaller == nil { + obj.marshaller = &marshaldevice{obj: obj} + } + return obj.marshaller +} + +func (obj *device) Unmarshal() unMarshalDevice { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldevice{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldevice) ToProto() (*otg.Device, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldevice) FromProto(msg *otg.Device) (Device, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldevice) 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 *unMarshaldevice) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshaldevice) 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 *unMarshaldevice) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshaldevice) 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 *unMarshaldevice) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *device) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *device) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *device) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *device) Clone() (Device, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDevice() + 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 +} + +func (obj *device) setNil() { + obj.ethernetsHolder = nil + obj.ipv4LoopbacksHolder = nil + obj.ipv6LoopbacksHolder = nil + obj.isisHolder = nil + obj.bgpHolder = nil + obj.vxlanHolder = nil + obj.rsvpHolder = nil + obj.dhcpServerHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// Device is a container for emulated interfaces, loopback interfaces and protocol configurations. +type Device interface { + Validation + // msg marshals Device to protobuf object *otg.Device + // and doesn't set defaults + msg() *otg.Device + // setMsg unmarshals Device from protobuf object *otg.Device + // and doesn't set defaults + setMsg(*otg.Device) Device + // provides marshal interface + Marshal() marshalDevice + // provides unmarshal interface + Unmarshal() unMarshalDevice + // validate validates Device + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Device, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ethernets returns DeviceDeviceEthernetIterIter, set in Device + Ethernets() DeviceDeviceEthernetIter + // Ipv4Loopbacks returns DeviceDeviceIpv4LoopbackIterIter, set in Device + Ipv4Loopbacks() DeviceDeviceIpv4LoopbackIter + // Ipv6Loopbacks returns DeviceDeviceIpv6LoopbackIterIter, set in Device + Ipv6Loopbacks() DeviceDeviceIpv6LoopbackIter + // Isis returns DeviceIsisRouter, set in Device. + // DeviceIsisRouter is a container of properties for an ISIS router and its interfaces. + Isis() DeviceIsisRouter + // SetIsis assigns DeviceIsisRouter provided by user to Device. + // DeviceIsisRouter is a container of properties for an ISIS router and its interfaces. + SetIsis(value DeviceIsisRouter) Device + // HasIsis checks if Isis has been set in Device + HasIsis() bool + // Bgp returns DeviceBgpRouter, set in Device. + // DeviceBgpRouter is configuration for one or more IPv4 or IPv6 BGP peers. + Bgp() DeviceBgpRouter + // SetBgp assigns DeviceBgpRouter provided by user to Device. + // DeviceBgpRouter is configuration for one or more IPv4 or IPv6 BGP peers. + SetBgp(value DeviceBgpRouter) Device + // HasBgp checks if Bgp has been set in Device + HasBgp() bool + // Vxlan returns DeviceVxlan, set in Device. + // DeviceVxlan is description is TBD + Vxlan() DeviceVxlan + // SetVxlan assigns DeviceVxlan provided by user to Device. + // DeviceVxlan is description is TBD + SetVxlan(value DeviceVxlan) Device + // HasVxlan checks if Vxlan has been set in Device + HasVxlan() bool + // Name returns string, set in Device. + Name() string + // SetName assigns string provided by user to Device + SetName(value string) Device + // Rsvp returns DeviceRsvp, set in Device. + // DeviceRsvp is configuration for one or more RSVP interfaces, ingress and egress LSPs. In this model, currently IPv4 RSVP and point-to-point LSPs are supported as per RFC3209 and related specifications. + Rsvp() DeviceRsvp + // SetRsvp assigns DeviceRsvp provided by user to Device. + // DeviceRsvp is configuration for one or more RSVP interfaces, ingress and egress LSPs. In this model, currently IPv4 RSVP and point-to-point LSPs are supported as per RFC3209 and related specifications. + SetRsvp(value DeviceRsvp) Device + // HasRsvp checks if Rsvp has been set in Device + HasRsvp() bool + // DhcpServer returns DeviceDhcpServer, set in Device. + // DeviceDhcpServer is configuration for one or more IPv4 or IPv6 DHCP servers. + DhcpServer() DeviceDhcpServer + // SetDhcpServer assigns DeviceDhcpServer provided by user to Device. + // DeviceDhcpServer is configuration for one or more IPv4 or IPv6 DHCP servers. + SetDhcpServer(value DeviceDhcpServer) Device + // HasDhcpServer checks if DhcpServer has been set in Device + HasDhcpServer() bool + setNil() +} + +// Ethernet configuration for one or more emulated network interfaces. +// Ethernets returns a []DeviceEthernet +func (obj *device) Ethernets() DeviceDeviceEthernetIter { + if len(obj.obj.Ethernets) == 0 { + obj.obj.Ethernets = []*otg.DeviceEthernet{} + } + if obj.ethernetsHolder == nil { + obj.ethernetsHolder = newDeviceDeviceEthernetIter(&obj.obj.Ethernets).setMsg(obj) + } + return obj.ethernetsHolder +} + +type deviceDeviceEthernetIter struct { + obj *device + deviceEthernetSlice []DeviceEthernet + fieldPtr *[]*otg.DeviceEthernet +} + +func newDeviceDeviceEthernetIter(ptr *[]*otg.DeviceEthernet) DeviceDeviceEthernetIter { + return &deviceDeviceEthernetIter{fieldPtr: ptr} +} + +type DeviceDeviceEthernetIter interface { + setMsg(*device) DeviceDeviceEthernetIter + Items() []DeviceEthernet + Add() DeviceEthernet + Append(items ...DeviceEthernet) DeviceDeviceEthernetIter + Set(index int, newObj DeviceEthernet) DeviceDeviceEthernetIter + Clear() DeviceDeviceEthernetIter + clearHolderSlice() DeviceDeviceEthernetIter + appendHolderSlice(item DeviceEthernet) DeviceDeviceEthernetIter +} + +func (obj *deviceDeviceEthernetIter) setMsg(msg *device) DeviceDeviceEthernetIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&deviceEthernet{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceDeviceEthernetIter) Items() []DeviceEthernet { + return obj.deviceEthernetSlice +} + +func (obj *deviceDeviceEthernetIter) Add() DeviceEthernet { + newObj := &otg.DeviceEthernet{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &deviceEthernet{obj: newObj} + newLibObj.setDefault() + obj.deviceEthernetSlice = append(obj.deviceEthernetSlice, newLibObj) + return newLibObj +} + +func (obj *deviceDeviceEthernetIter) Append(items ...DeviceEthernet) DeviceDeviceEthernetIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.deviceEthernetSlice = append(obj.deviceEthernetSlice, item) + } + return obj +} + +func (obj *deviceDeviceEthernetIter) Set(index int, newObj DeviceEthernet) DeviceDeviceEthernetIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.deviceEthernetSlice[index] = newObj + return obj +} +func (obj *deviceDeviceEthernetIter) Clear() DeviceDeviceEthernetIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.DeviceEthernet{} + obj.deviceEthernetSlice = []DeviceEthernet{} + } + return obj +} +func (obj *deviceDeviceEthernetIter) clearHolderSlice() DeviceDeviceEthernetIter { + if len(obj.deviceEthernetSlice) > 0 { + obj.deviceEthernetSlice = []DeviceEthernet{} + } + return obj +} +func (obj *deviceDeviceEthernetIter) appendHolderSlice(item DeviceEthernet) DeviceDeviceEthernetIter { + obj.deviceEthernetSlice = append(obj.deviceEthernetSlice, item) + return obj +} + +// IPv4 Loopback interface that can be attached to an Ethernet in the same device or to an Ethernet in another device. +// Ipv4Loopbacks returns a []DeviceIpv4Loopback +func (obj *device) Ipv4Loopbacks() DeviceDeviceIpv4LoopbackIter { + if len(obj.obj.Ipv4Loopbacks) == 0 { + obj.obj.Ipv4Loopbacks = []*otg.DeviceIpv4Loopback{} + } + if obj.ipv4LoopbacksHolder == nil { + obj.ipv4LoopbacksHolder = newDeviceDeviceIpv4LoopbackIter(&obj.obj.Ipv4Loopbacks).setMsg(obj) + } + return obj.ipv4LoopbacksHolder +} + +type deviceDeviceIpv4LoopbackIter struct { + obj *device + deviceIpv4LoopbackSlice []DeviceIpv4Loopback + fieldPtr *[]*otg.DeviceIpv4Loopback +} + +func newDeviceDeviceIpv4LoopbackIter(ptr *[]*otg.DeviceIpv4Loopback) DeviceDeviceIpv4LoopbackIter { + return &deviceDeviceIpv4LoopbackIter{fieldPtr: ptr} +} + +type DeviceDeviceIpv4LoopbackIter interface { + setMsg(*device) DeviceDeviceIpv4LoopbackIter + Items() []DeviceIpv4Loopback + Add() DeviceIpv4Loopback + Append(items ...DeviceIpv4Loopback) DeviceDeviceIpv4LoopbackIter + Set(index int, newObj DeviceIpv4Loopback) DeviceDeviceIpv4LoopbackIter + Clear() DeviceDeviceIpv4LoopbackIter + clearHolderSlice() DeviceDeviceIpv4LoopbackIter + appendHolderSlice(item DeviceIpv4Loopback) DeviceDeviceIpv4LoopbackIter +} + +func (obj *deviceDeviceIpv4LoopbackIter) setMsg(msg *device) DeviceDeviceIpv4LoopbackIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&deviceIpv4Loopback{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceDeviceIpv4LoopbackIter) Items() []DeviceIpv4Loopback { + return obj.deviceIpv4LoopbackSlice +} + +func (obj *deviceDeviceIpv4LoopbackIter) Add() DeviceIpv4Loopback { + newObj := &otg.DeviceIpv4Loopback{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &deviceIpv4Loopback{obj: newObj} + newLibObj.setDefault() + obj.deviceIpv4LoopbackSlice = append(obj.deviceIpv4LoopbackSlice, newLibObj) + return newLibObj +} + +func (obj *deviceDeviceIpv4LoopbackIter) Append(items ...DeviceIpv4Loopback) DeviceDeviceIpv4LoopbackIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.deviceIpv4LoopbackSlice = append(obj.deviceIpv4LoopbackSlice, item) + } + return obj +} + +func (obj *deviceDeviceIpv4LoopbackIter) Set(index int, newObj DeviceIpv4Loopback) DeviceDeviceIpv4LoopbackIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.deviceIpv4LoopbackSlice[index] = newObj + return obj +} +func (obj *deviceDeviceIpv4LoopbackIter) Clear() DeviceDeviceIpv4LoopbackIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.DeviceIpv4Loopback{} + obj.deviceIpv4LoopbackSlice = []DeviceIpv4Loopback{} + } + return obj +} +func (obj *deviceDeviceIpv4LoopbackIter) clearHolderSlice() DeviceDeviceIpv4LoopbackIter { + if len(obj.deviceIpv4LoopbackSlice) > 0 { + obj.deviceIpv4LoopbackSlice = []DeviceIpv4Loopback{} + } + return obj +} +func (obj *deviceDeviceIpv4LoopbackIter) appendHolderSlice(item DeviceIpv4Loopback) DeviceDeviceIpv4LoopbackIter { + obj.deviceIpv4LoopbackSlice = append(obj.deviceIpv4LoopbackSlice, item) + return obj +} + +// IPv6 Loopback interface that can be attached to an Ethernet in the same device or to an Ethernet in another device. +// Ipv6Loopbacks returns a []DeviceIpv6Loopback +func (obj *device) Ipv6Loopbacks() DeviceDeviceIpv6LoopbackIter { + if len(obj.obj.Ipv6Loopbacks) == 0 { + obj.obj.Ipv6Loopbacks = []*otg.DeviceIpv6Loopback{} + } + if obj.ipv6LoopbacksHolder == nil { + obj.ipv6LoopbacksHolder = newDeviceDeviceIpv6LoopbackIter(&obj.obj.Ipv6Loopbacks).setMsg(obj) + } + return obj.ipv6LoopbacksHolder +} + +type deviceDeviceIpv6LoopbackIter struct { + obj *device + deviceIpv6LoopbackSlice []DeviceIpv6Loopback + fieldPtr *[]*otg.DeviceIpv6Loopback +} + +func newDeviceDeviceIpv6LoopbackIter(ptr *[]*otg.DeviceIpv6Loopback) DeviceDeviceIpv6LoopbackIter { + return &deviceDeviceIpv6LoopbackIter{fieldPtr: ptr} +} + +type DeviceDeviceIpv6LoopbackIter interface { + setMsg(*device) DeviceDeviceIpv6LoopbackIter + Items() []DeviceIpv6Loopback + Add() DeviceIpv6Loopback + Append(items ...DeviceIpv6Loopback) DeviceDeviceIpv6LoopbackIter + Set(index int, newObj DeviceIpv6Loopback) DeviceDeviceIpv6LoopbackIter + Clear() DeviceDeviceIpv6LoopbackIter + clearHolderSlice() DeviceDeviceIpv6LoopbackIter + appendHolderSlice(item DeviceIpv6Loopback) DeviceDeviceIpv6LoopbackIter +} + +func (obj *deviceDeviceIpv6LoopbackIter) setMsg(msg *device) DeviceDeviceIpv6LoopbackIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&deviceIpv6Loopback{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceDeviceIpv6LoopbackIter) Items() []DeviceIpv6Loopback { + return obj.deviceIpv6LoopbackSlice +} + +func (obj *deviceDeviceIpv6LoopbackIter) Add() DeviceIpv6Loopback { + newObj := &otg.DeviceIpv6Loopback{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &deviceIpv6Loopback{obj: newObj} + newLibObj.setDefault() + obj.deviceIpv6LoopbackSlice = append(obj.deviceIpv6LoopbackSlice, newLibObj) + return newLibObj +} + +func (obj *deviceDeviceIpv6LoopbackIter) Append(items ...DeviceIpv6Loopback) DeviceDeviceIpv6LoopbackIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.deviceIpv6LoopbackSlice = append(obj.deviceIpv6LoopbackSlice, item) + } + return obj +} + +func (obj *deviceDeviceIpv6LoopbackIter) Set(index int, newObj DeviceIpv6Loopback) DeviceDeviceIpv6LoopbackIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.deviceIpv6LoopbackSlice[index] = newObj + return obj +} +func (obj *deviceDeviceIpv6LoopbackIter) Clear() DeviceDeviceIpv6LoopbackIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.DeviceIpv6Loopback{} + obj.deviceIpv6LoopbackSlice = []DeviceIpv6Loopback{} + } + return obj +} +func (obj *deviceDeviceIpv6LoopbackIter) clearHolderSlice() DeviceDeviceIpv6LoopbackIter { + if len(obj.deviceIpv6LoopbackSlice) > 0 { + obj.deviceIpv6LoopbackSlice = []DeviceIpv6Loopback{} + } + return obj +} +func (obj *deviceDeviceIpv6LoopbackIter) appendHolderSlice(item DeviceIpv6Loopback) DeviceDeviceIpv6LoopbackIter { + obj.deviceIpv6LoopbackSlice = append(obj.deviceIpv6LoopbackSlice, item) + return obj +} + +// The properties of an IS-IS router and its children, such as IS-IS interfaces and route ranges. +// Isis returns a DeviceIsisRouter +func (obj *device) Isis() DeviceIsisRouter { + if obj.obj.Isis == nil { + obj.obj.Isis = NewDeviceIsisRouter().msg() + } + if obj.isisHolder == nil { + obj.isisHolder = &deviceIsisRouter{obj: obj.obj.Isis} + } + return obj.isisHolder +} + +// The properties of an IS-IS router and its children, such as IS-IS interfaces and route ranges. +// Isis returns a DeviceIsisRouter +func (obj *device) HasIsis() bool { + return obj.obj.Isis != nil +} + +// The properties of an IS-IS router and its children, such as IS-IS interfaces and route ranges. +// SetIsis sets the DeviceIsisRouter value in the Device object +func (obj *device) SetIsis(value DeviceIsisRouter) Device { + + obj.isisHolder = nil + obj.obj.Isis = value.msg() + + return obj +} + +// The properties of BGP router and its children, such as BGPv4, BGPv6 peers and their route ranges. +// Bgp returns a DeviceBgpRouter +func (obj *device) Bgp() DeviceBgpRouter { + if obj.obj.Bgp == nil { + obj.obj.Bgp = NewDeviceBgpRouter().msg() + } + if obj.bgpHolder == nil { + obj.bgpHolder = &deviceBgpRouter{obj: obj.obj.Bgp} + } + return obj.bgpHolder +} + +// The properties of BGP router and its children, such as BGPv4, BGPv6 peers and their route ranges. +// Bgp returns a DeviceBgpRouter +func (obj *device) HasBgp() bool { + return obj.obj.Bgp != nil +} + +// The properties of BGP router and its children, such as BGPv4, BGPv6 peers and their route ranges. +// SetBgp sets the DeviceBgpRouter value in the Device object +func (obj *device) SetBgp(value DeviceBgpRouter) Device { + + obj.bgpHolder = nil + obj.obj.Bgp = value.msg() + + return obj +} + +// Configuration of VXLAN tunnel interfaces RFC Ref: https://datatracker.ietf.org/doc/html/rfc7348 +// Vxlan returns a DeviceVxlan +func (obj *device) Vxlan() DeviceVxlan { + if obj.obj.Vxlan == nil { + obj.obj.Vxlan = NewDeviceVxlan().msg() + } + if obj.vxlanHolder == nil { + obj.vxlanHolder = &deviceVxlan{obj: obj.obj.Vxlan} + } + return obj.vxlanHolder +} + +// Configuration of VXLAN tunnel interfaces RFC Ref: https://datatracker.ietf.org/doc/html/rfc7348 +// Vxlan returns a DeviceVxlan +func (obj *device) HasVxlan() bool { + return obj.obj.Vxlan != nil +} + +// Configuration of VXLAN tunnel interfaces RFC Ref: https://datatracker.ietf.org/doc/html/rfc7348 +// SetVxlan sets the DeviceVxlan value in the Device object +func (obj *device) SetVxlan(value DeviceVxlan) Device { + + obj.vxlanHolder = nil + obj.obj.Vxlan = value.msg() + + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *device) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the Device object +func (obj *device) SetName(value string) Device { + + obj.obj.Name = &value + return obj +} + +// The properties of an RSVP router and its children. +// Rsvp returns a DeviceRsvp +func (obj *device) Rsvp() DeviceRsvp { + if obj.obj.Rsvp == nil { + obj.obj.Rsvp = NewDeviceRsvp().msg() + } + if obj.rsvpHolder == nil { + obj.rsvpHolder = &deviceRsvp{obj: obj.obj.Rsvp} + } + return obj.rsvpHolder +} + +// The properties of an RSVP router and its children. +// Rsvp returns a DeviceRsvp +func (obj *device) HasRsvp() bool { + return obj.obj.Rsvp != nil +} + +// The properties of an RSVP router and its children. +// SetRsvp sets the DeviceRsvp value in the Device object +func (obj *device) SetRsvp(value DeviceRsvp) Device { + + obj.rsvpHolder = nil + obj.obj.Rsvp = value.msg() + + return obj +} + +// The properties of DHCP Server and its children, such as DHCPv4, DHCPv6 servers. +// DhcpServer returns a DeviceDhcpServer +func (obj *device) DhcpServer() DeviceDhcpServer { + if obj.obj.DhcpServer == nil { + obj.obj.DhcpServer = NewDeviceDhcpServer().msg() + } + if obj.dhcpServerHolder == nil { + obj.dhcpServerHolder = &deviceDhcpServer{obj: obj.obj.DhcpServer} + } + return obj.dhcpServerHolder +} + +// The properties of DHCP Server and its children, such as DHCPv4, DHCPv6 servers. +// DhcpServer returns a DeviceDhcpServer +func (obj *device) HasDhcpServer() bool { + return obj.obj.DhcpServer != nil +} + +// The properties of DHCP Server and its children, such as DHCPv4, DHCPv6 servers. +// SetDhcpServer sets the DeviceDhcpServer value in the Device object +func (obj *device) SetDhcpServer(value DeviceDhcpServer) Device { + + obj.dhcpServerHolder = nil + obj.obj.DhcpServer = value.msg() + + return obj +} + +func (obj *device) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Ethernets) != 0 { + + if set_default { + obj.Ethernets().clearHolderSlice() + for _, item := range obj.obj.Ethernets { + obj.Ethernets().appendHolderSlice(&deviceEthernet{obj: item}) + } + } + for _, item := range obj.Ethernets().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Ipv4Loopbacks) != 0 { + + if set_default { + obj.Ipv4Loopbacks().clearHolderSlice() + for _, item := range obj.obj.Ipv4Loopbacks { + obj.Ipv4Loopbacks().appendHolderSlice(&deviceIpv4Loopback{obj: item}) + } + } + for _, item := range obj.Ipv4Loopbacks().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Ipv6Loopbacks) != 0 { + + if set_default { + obj.Ipv6Loopbacks().clearHolderSlice() + for _, item := range obj.obj.Ipv6Loopbacks { + obj.Ipv6Loopbacks().appendHolderSlice(&deviceIpv6Loopback{obj: item}) + } + } + for _, item := range obj.Ipv6Loopbacks().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Isis != nil { + + obj.Isis().validateObj(vObj, set_default) + } + + if obj.obj.Bgp != nil { + + obj.Bgp().validateObj(vObj, set_default) + } + + if obj.obj.Vxlan != nil { + + obj.Vxlan().validateObj(vObj, set_default) + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface Device") + } + + if obj.obj.Rsvp != nil { + + obj.Rsvp().validateObj(vObj, set_default) + } + + if obj.obj.DhcpServer != nil { + + obj.DhcpServer().validateObj(vObj, set_default) + } + +} + +func (obj *device) setDefault() { + +} diff --git a/gosnappi/device_bgp_cease_error.go b/gosnappi/device_bgp_cease_error.go new file mode 100644 index 00000000..d95d9713 --- /dev/null +++ b/gosnappi/device_bgp_cease_error.go @@ -0,0 +1,336 @@ +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" +) + +// ***** DeviceBgpCeaseError ***** +type deviceBgpCeaseError struct { + validation + obj *otg.DeviceBgpCeaseError + marshaller marshalDeviceBgpCeaseError + unMarshaller unMarshalDeviceBgpCeaseError +} + +func NewDeviceBgpCeaseError() DeviceBgpCeaseError { + obj := deviceBgpCeaseError{obj: &otg.DeviceBgpCeaseError{}} + obj.setDefault() + return &obj +} + +func (obj *deviceBgpCeaseError) msg() *otg.DeviceBgpCeaseError { + return obj.obj +} + +func (obj *deviceBgpCeaseError) setMsg(msg *otg.DeviceBgpCeaseError) DeviceBgpCeaseError { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceBgpCeaseError struct { + obj *deviceBgpCeaseError +} + +type marshalDeviceBgpCeaseError interface { + // ToProto marshals DeviceBgpCeaseError to protobuf object *otg.DeviceBgpCeaseError + ToProto() (*otg.DeviceBgpCeaseError, error) + // ToPbText marshals DeviceBgpCeaseError to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceBgpCeaseError to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceBgpCeaseError to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceBgpCeaseError struct { + obj *deviceBgpCeaseError +} + +type unMarshalDeviceBgpCeaseError interface { + // FromProto unmarshals DeviceBgpCeaseError from protobuf object *otg.DeviceBgpCeaseError + FromProto(msg *otg.DeviceBgpCeaseError) (DeviceBgpCeaseError, error) + // FromPbText unmarshals DeviceBgpCeaseError from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceBgpCeaseError from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceBgpCeaseError from JSON text + FromJson(value string) error +} + +func (obj *deviceBgpCeaseError) Marshal() marshalDeviceBgpCeaseError { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceBgpCeaseError{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceBgpCeaseError) Unmarshal() unMarshalDeviceBgpCeaseError { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceBgpCeaseError{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceBgpCeaseError) ToProto() (*otg.DeviceBgpCeaseError, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceBgpCeaseError) FromProto(msg *otg.DeviceBgpCeaseError) (DeviceBgpCeaseError, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceBgpCeaseError) 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 *unMarshaldeviceBgpCeaseError) 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 *marshaldeviceBgpCeaseError) 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 *unMarshaldeviceBgpCeaseError) 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 *marshaldeviceBgpCeaseError) 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 *unMarshaldeviceBgpCeaseError) 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 *deviceBgpCeaseError) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceBgpCeaseError) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceBgpCeaseError) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceBgpCeaseError) Clone() (DeviceBgpCeaseError, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceBgpCeaseError() + 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 +} + +// DeviceBgpCeaseError is in the absence of any fatal errors, a BGP peer can close its BGP connection by sending the NOTIFICATION message with the Error Code Cease. +type DeviceBgpCeaseError interface { + Validation + // msg marshals DeviceBgpCeaseError to protobuf object *otg.DeviceBgpCeaseError + // and doesn't set defaults + msg() *otg.DeviceBgpCeaseError + // setMsg unmarshals DeviceBgpCeaseError from protobuf object *otg.DeviceBgpCeaseError + // and doesn't set defaults + setMsg(*otg.DeviceBgpCeaseError) DeviceBgpCeaseError + // provides marshal interface + Marshal() marshalDeviceBgpCeaseError + // provides unmarshal interface + Unmarshal() unMarshalDeviceBgpCeaseError + // validate validates DeviceBgpCeaseError + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceBgpCeaseError, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Subcode returns DeviceBgpCeaseErrorSubcodeEnum, set in DeviceBgpCeaseError + Subcode() DeviceBgpCeaseErrorSubcodeEnum + // SetSubcode assigns DeviceBgpCeaseErrorSubcodeEnum provided by user to DeviceBgpCeaseError + SetSubcode(value DeviceBgpCeaseErrorSubcodeEnum) DeviceBgpCeaseError + // HasSubcode checks if Subcode has been set in DeviceBgpCeaseError + HasSubcode() bool +} + +type DeviceBgpCeaseErrorSubcodeEnum string + +// Enum of Subcode on DeviceBgpCeaseError +var DeviceBgpCeaseErrorSubcode = struct { + MAX_NUMBER_PREFIX_REACHED_CODE6_SUBCODE1 DeviceBgpCeaseErrorSubcodeEnum + ADMIN_SHUTDOWN_CODE6_SUBCODE2 DeviceBgpCeaseErrorSubcodeEnum + PEER_DELETED_CODE6_SUBCODE3 DeviceBgpCeaseErrorSubcodeEnum + ADMIN_RESET_CODE6_SUBCODE4 DeviceBgpCeaseErrorSubcodeEnum + CONNECTION_REJECT_CODE6_SUBCODE5 DeviceBgpCeaseErrorSubcodeEnum + OTHER_CONFIG_CHANGES_CODE6_SUBCODE6 DeviceBgpCeaseErrorSubcodeEnum + CONNECTION_COLLISION_RESOLUTION_CODE6_SUBCODE7 DeviceBgpCeaseErrorSubcodeEnum + OUT_OF_RESOURCES_CODE6_SUBCODE8 DeviceBgpCeaseErrorSubcodeEnum + BFD_SESSION_DOWN_CODE6_SUBCODE9 DeviceBgpCeaseErrorSubcodeEnum +}{ + MAX_NUMBER_PREFIX_REACHED_CODE6_SUBCODE1: DeviceBgpCeaseErrorSubcodeEnum("max_number_prefix_reached_code6_subcode1"), + ADMIN_SHUTDOWN_CODE6_SUBCODE2: DeviceBgpCeaseErrorSubcodeEnum("admin_shutdown_code6_subcode2"), + PEER_DELETED_CODE6_SUBCODE3: DeviceBgpCeaseErrorSubcodeEnum("peer_deleted_code6_subcode3"), + ADMIN_RESET_CODE6_SUBCODE4: DeviceBgpCeaseErrorSubcodeEnum("admin_reset_code6_subcode4"), + CONNECTION_REJECT_CODE6_SUBCODE5: DeviceBgpCeaseErrorSubcodeEnum("connection_reject_code6_subcode5"), + OTHER_CONFIG_CHANGES_CODE6_SUBCODE6: DeviceBgpCeaseErrorSubcodeEnum("other_config_changes_code6_subcode6"), + CONNECTION_COLLISION_RESOLUTION_CODE6_SUBCODE7: DeviceBgpCeaseErrorSubcodeEnum("connection_collision_resolution_code6_subcode7"), + OUT_OF_RESOURCES_CODE6_SUBCODE8: DeviceBgpCeaseErrorSubcodeEnum("out_of_resources_code6_subcode8"), + BFD_SESSION_DOWN_CODE6_SUBCODE9: DeviceBgpCeaseErrorSubcodeEnum("bfd_session_down_code6_subcode9"), +} + +func (obj *deviceBgpCeaseError) Subcode() DeviceBgpCeaseErrorSubcodeEnum { + return DeviceBgpCeaseErrorSubcodeEnum(obj.obj.Subcode.Enum().String()) +} + +// The Error Subcode to be sent to the peer in the Cease NOTIFICATION. +// Subcode returns a string +func (obj *deviceBgpCeaseError) HasSubcode() bool { + return obj.obj.Subcode != nil +} + +func (obj *deviceBgpCeaseError) SetSubcode(value DeviceBgpCeaseErrorSubcodeEnum) DeviceBgpCeaseError { + intValue, ok := otg.DeviceBgpCeaseError_Subcode_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on DeviceBgpCeaseErrorSubcodeEnum", string(value))) + return obj + } + enumValue := otg.DeviceBgpCeaseError_Subcode_Enum(intValue) + obj.obj.Subcode = &enumValue + + return obj +} + +func (obj *deviceBgpCeaseError) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *deviceBgpCeaseError) setDefault() { + if obj.obj.Subcode == nil { + obj.SetSubcode(DeviceBgpCeaseErrorSubcode.ADMIN_SHUTDOWN_CODE6_SUBCODE2) + + } + +} diff --git a/gosnappi/device_bgp_custom_error.go b/gosnappi/device_bgp_custom_error.go new file mode 100644 index 00000000..a7051e57 --- /dev/null +++ b/gosnappi/device_bgp_custom_error.go @@ -0,0 +1,334 @@ +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" +) + +// ***** DeviceBgpCustomError ***** +type deviceBgpCustomError struct { + validation + obj *otg.DeviceBgpCustomError + marshaller marshalDeviceBgpCustomError + unMarshaller unMarshalDeviceBgpCustomError +} + +func NewDeviceBgpCustomError() DeviceBgpCustomError { + obj := deviceBgpCustomError{obj: &otg.DeviceBgpCustomError{}} + obj.setDefault() + return &obj +} + +func (obj *deviceBgpCustomError) msg() *otg.DeviceBgpCustomError { + return obj.obj +} + +func (obj *deviceBgpCustomError) setMsg(msg *otg.DeviceBgpCustomError) DeviceBgpCustomError { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceBgpCustomError struct { + obj *deviceBgpCustomError +} + +type marshalDeviceBgpCustomError interface { + // ToProto marshals DeviceBgpCustomError to protobuf object *otg.DeviceBgpCustomError + ToProto() (*otg.DeviceBgpCustomError, error) + // ToPbText marshals DeviceBgpCustomError to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceBgpCustomError to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceBgpCustomError to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceBgpCustomError struct { + obj *deviceBgpCustomError +} + +type unMarshalDeviceBgpCustomError interface { + // FromProto unmarshals DeviceBgpCustomError from protobuf object *otg.DeviceBgpCustomError + FromProto(msg *otg.DeviceBgpCustomError) (DeviceBgpCustomError, error) + // FromPbText unmarshals DeviceBgpCustomError from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceBgpCustomError from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceBgpCustomError from JSON text + FromJson(value string) error +} + +func (obj *deviceBgpCustomError) Marshal() marshalDeviceBgpCustomError { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceBgpCustomError{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceBgpCustomError) Unmarshal() unMarshalDeviceBgpCustomError { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceBgpCustomError{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceBgpCustomError) ToProto() (*otg.DeviceBgpCustomError, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceBgpCustomError) FromProto(msg *otg.DeviceBgpCustomError) (DeviceBgpCustomError, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceBgpCustomError) 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 *unMarshaldeviceBgpCustomError) 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 *marshaldeviceBgpCustomError) 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 *unMarshaldeviceBgpCustomError) 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 *marshaldeviceBgpCustomError) 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 *unMarshaldeviceBgpCustomError) 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 *deviceBgpCustomError) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceBgpCustomError) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceBgpCustomError) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceBgpCustomError) Clone() (DeviceBgpCustomError, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceBgpCustomError() + 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 +} + +// DeviceBgpCustomError is a BGP peer can send NOTIFICATION message with user defined Error Code and Error Subcode. +type DeviceBgpCustomError interface { + Validation + // msg marshals DeviceBgpCustomError to protobuf object *otg.DeviceBgpCustomError + // and doesn't set defaults + msg() *otg.DeviceBgpCustomError + // setMsg unmarshals DeviceBgpCustomError from protobuf object *otg.DeviceBgpCustomError + // and doesn't set defaults + setMsg(*otg.DeviceBgpCustomError) DeviceBgpCustomError + // provides marshal interface + Marshal() marshalDeviceBgpCustomError + // provides unmarshal interface + Unmarshal() unMarshalDeviceBgpCustomError + // validate validates DeviceBgpCustomError + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceBgpCustomError, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Code returns uint32, set in DeviceBgpCustomError. + Code() uint32 + // SetCode assigns uint32 provided by user to DeviceBgpCustomError + SetCode(value uint32) DeviceBgpCustomError + // HasCode checks if Code has been set in DeviceBgpCustomError + HasCode() bool + // Subcode returns uint32, set in DeviceBgpCustomError. + Subcode() uint32 + // SetSubcode assigns uint32 provided by user to DeviceBgpCustomError + SetSubcode(value uint32) DeviceBgpCustomError + // HasSubcode checks if Subcode has been set in DeviceBgpCustomError + HasSubcode() bool +} + +// The Error code to be sent in the NOTIFICATION message to peer. +// Code returns a uint32 +func (obj *deviceBgpCustomError) Code() uint32 { + + return *obj.obj.Code + +} + +// The Error code to be sent in the NOTIFICATION message to peer. +// Code returns a uint32 +func (obj *deviceBgpCustomError) HasCode() bool { + return obj.obj.Code != nil +} + +// The Error code to be sent in the NOTIFICATION message to peer. +// SetCode sets the uint32 value in the DeviceBgpCustomError object +func (obj *deviceBgpCustomError) SetCode(value uint32) DeviceBgpCustomError { + + obj.obj.Code = &value + return obj +} + +// The Error Subcode to be sent in the NOTIFICATION message to peer. +// Subcode returns a uint32 +func (obj *deviceBgpCustomError) Subcode() uint32 { + + return *obj.obj.Subcode + +} + +// The Error Subcode to be sent in the NOTIFICATION message to peer. +// Subcode returns a uint32 +func (obj *deviceBgpCustomError) HasSubcode() bool { + return obj.obj.Subcode != nil +} + +// The Error Subcode to be sent in the NOTIFICATION message to peer. +// SetSubcode sets the uint32 value in the DeviceBgpCustomError object +func (obj *deviceBgpCustomError) SetSubcode(value uint32) DeviceBgpCustomError { + + obj.obj.Subcode = &value + return obj +} + +func (obj *deviceBgpCustomError) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *deviceBgpCustomError) setDefault() { + +} diff --git a/gosnappi/device_bgp_finite_state_machine_error.go b/gosnappi/device_bgp_finite_state_machine_error.go new file mode 100644 index 00000000..a099c955 --- /dev/null +++ b/gosnappi/device_bgp_finite_state_machine_error.go @@ -0,0 +1,278 @@ +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" +) + +// ***** DeviceBgpFiniteStateMachineError ***** +type deviceBgpFiniteStateMachineError struct { + validation + obj *otg.DeviceBgpFiniteStateMachineError + marshaller marshalDeviceBgpFiniteStateMachineError + unMarshaller unMarshalDeviceBgpFiniteStateMachineError +} + +func NewDeviceBgpFiniteStateMachineError() DeviceBgpFiniteStateMachineError { + obj := deviceBgpFiniteStateMachineError{obj: &otg.DeviceBgpFiniteStateMachineError{}} + obj.setDefault() + return &obj +} + +func (obj *deviceBgpFiniteStateMachineError) msg() *otg.DeviceBgpFiniteStateMachineError { + return obj.obj +} + +func (obj *deviceBgpFiniteStateMachineError) setMsg(msg *otg.DeviceBgpFiniteStateMachineError) DeviceBgpFiniteStateMachineError { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceBgpFiniteStateMachineError struct { + obj *deviceBgpFiniteStateMachineError +} + +type marshalDeviceBgpFiniteStateMachineError interface { + // ToProto marshals DeviceBgpFiniteStateMachineError to protobuf object *otg.DeviceBgpFiniteStateMachineError + ToProto() (*otg.DeviceBgpFiniteStateMachineError, error) + // ToPbText marshals DeviceBgpFiniteStateMachineError to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceBgpFiniteStateMachineError to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceBgpFiniteStateMachineError to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceBgpFiniteStateMachineError struct { + obj *deviceBgpFiniteStateMachineError +} + +type unMarshalDeviceBgpFiniteStateMachineError interface { + // FromProto unmarshals DeviceBgpFiniteStateMachineError from protobuf object *otg.DeviceBgpFiniteStateMachineError + FromProto(msg *otg.DeviceBgpFiniteStateMachineError) (DeviceBgpFiniteStateMachineError, error) + // FromPbText unmarshals DeviceBgpFiniteStateMachineError from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceBgpFiniteStateMachineError from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceBgpFiniteStateMachineError from JSON text + FromJson(value string) error +} + +func (obj *deviceBgpFiniteStateMachineError) Marshal() marshalDeviceBgpFiniteStateMachineError { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceBgpFiniteStateMachineError{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceBgpFiniteStateMachineError) Unmarshal() unMarshalDeviceBgpFiniteStateMachineError { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceBgpFiniteStateMachineError{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceBgpFiniteStateMachineError) ToProto() (*otg.DeviceBgpFiniteStateMachineError, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceBgpFiniteStateMachineError) FromProto(msg *otg.DeviceBgpFiniteStateMachineError) (DeviceBgpFiniteStateMachineError, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceBgpFiniteStateMachineError) 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 *unMarshaldeviceBgpFiniteStateMachineError) 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 *marshaldeviceBgpFiniteStateMachineError) 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 *unMarshaldeviceBgpFiniteStateMachineError) 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 *marshaldeviceBgpFiniteStateMachineError) 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 *unMarshaldeviceBgpFiniteStateMachineError) 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 *deviceBgpFiniteStateMachineError) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceBgpFiniteStateMachineError) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceBgpFiniteStateMachineError) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceBgpFiniteStateMachineError) Clone() (DeviceBgpFiniteStateMachineError, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceBgpFiniteStateMachineError() + 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 +} + +// DeviceBgpFiniteStateMachineError is any error detected by the BGP Finite State Machine (e.g., receipt of an unexpected event) is indicated by sending the NOTIFICATION message with the Error Code-Finite State Machine Error(Error Code 5). The Sub Code used is 0. If a user wants to use non zero Sub Code then CustomError can be used. +type DeviceBgpFiniteStateMachineError interface { + Validation + // msg marshals DeviceBgpFiniteStateMachineError to protobuf object *otg.DeviceBgpFiniteStateMachineError + // and doesn't set defaults + msg() *otg.DeviceBgpFiniteStateMachineError + // setMsg unmarshals DeviceBgpFiniteStateMachineError from protobuf object *otg.DeviceBgpFiniteStateMachineError + // and doesn't set defaults + setMsg(*otg.DeviceBgpFiniteStateMachineError) DeviceBgpFiniteStateMachineError + // provides marshal interface + Marshal() marshalDeviceBgpFiniteStateMachineError + // provides unmarshal interface + Unmarshal() unMarshalDeviceBgpFiniteStateMachineError + // validate validates DeviceBgpFiniteStateMachineError + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceBgpFiniteStateMachineError, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() +} + +func (obj *deviceBgpFiniteStateMachineError) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *deviceBgpFiniteStateMachineError) setDefault() { + +} diff --git a/gosnappi/device_bgp_hold_timer_expired.go b/gosnappi/device_bgp_hold_timer_expired.go new file mode 100644 index 00000000..9517e2b2 --- /dev/null +++ b/gosnappi/device_bgp_hold_timer_expired.go @@ -0,0 +1,278 @@ +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" +) + +// ***** DeviceBgpHoldTimerExpired ***** +type deviceBgpHoldTimerExpired struct { + validation + obj *otg.DeviceBgpHoldTimerExpired + marshaller marshalDeviceBgpHoldTimerExpired + unMarshaller unMarshalDeviceBgpHoldTimerExpired +} + +func NewDeviceBgpHoldTimerExpired() DeviceBgpHoldTimerExpired { + obj := deviceBgpHoldTimerExpired{obj: &otg.DeviceBgpHoldTimerExpired{}} + obj.setDefault() + return &obj +} + +func (obj *deviceBgpHoldTimerExpired) msg() *otg.DeviceBgpHoldTimerExpired { + return obj.obj +} + +func (obj *deviceBgpHoldTimerExpired) setMsg(msg *otg.DeviceBgpHoldTimerExpired) DeviceBgpHoldTimerExpired { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceBgpHoldTimerExpired struct { + obj *deviceBgpHoldTimerExpired +} + +type marshalDeviceBgpHoldTimerExpired interface { + // ToProto marshals DeviceBgpHoldTimerExpired to protobuf object *otg.DeviceBgpHoldTimerExpired + ToProto() (*otg.DeviceBgpHoldTimerExpired, error) + // ToPbText marshals DeviceBgpHoldTimerExpired to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceBgpHoldTimerExpired to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceBgpHoldTimerExpired to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceBgpHoldTimerExpired struct { + obj *deviceBgpHoldTimerExpired +} + +type unMarshalDeviceBgpHoldTimerExpired interface { + // FromProto unmarshals DeviceBgpHoldTimerExpired from protobuf object *otg.DeviceBgpHoldTimerExpired + FromProto(msg *otg.DeviceBgpHoldTimerExpired) (DeviceBgpHoldTimerExpired, error) + // FromPbText unmarshals DeviceBgpHoldTimerExpired from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceBgpHoldTimerExpired from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceBgpHoldTimerExpired from JSON text + FromJson(value string) error +} + +func (obj *deviceBgpHoldTimerExpired) Marshal() marshalDeviceBgpHoldTimerExpired { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceBgpHoldTimerExpired{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceBgpHoldTimerExpired) Unmarshal() unMarshalDeviceBgpHoldTimerExpired { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceBgpHoldTimerExpired{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceBgpHoldTimerExpired) ToProto() (*otg.DeviceBgpHoldTimerExpired, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceBgpHoldTimerExpired) FromProto(msg *otg.DeviceBgpHoldTimerExpired) (DeviceBgpHoldTimerExpired, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceBgpHoldTimerExpired) 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 *unMarshaldeviceBgpHoldTimerExpired) 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 *marshaldeviceBgpHoldTimerExpired) 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 *unMarshaldeviceBgpHoldTimerExpired) 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 *marshaldeviceBgpHoldTimerExpired) 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 *unMarshaldeviceBgpHoldTimerExpired) 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 *deviceBgpHoldTimerExpired) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceBgpHoldTimerExpired) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceBgpHoldTimerExpired) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceBgpHoldTimerExpired) Clone() (DeviceBgpHoldTimerExpired, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceBgpHoldTimerExpired() + 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 +} + +// DeviceBgpHoldTimerExpired is if a system does not receive successive KEEPALIVE, UPDATE, and/or NOTIFICATION messages within the period specified in the Hold Time field of the OPEN message, then the NOTIFICATION message with the Hold Timer Expired Error Code(Error Code 4) is sent and the BGP connection is closed. The Sub Code used is 0. If a user wants to use non zero Sub Code then CustomError can be used. +type DeviceBgpHoldTimerExpired interface { + Validation + // msg marshals DeviceBgpHoldTimerExpired to protobuf object *otg.DeviceBgpHoldTimerExpired + // and doesn't set defaults + msg() *otg.DeviceBgpHoldTimerExpired + // setMsg unmarshals DeviceBgpHoldTimerExpired from protobuf object *otg.DeviceBgpHoldTimerExpired + // and doesn't set defaults + setMsg(*otg.DeviceBgpHoldTimerExpired) DeviceBgpHoldTimerExpired + // provides marshal interface + Marshal() marshalDeviceBgpHoldTimerExpired + // provides unmarshal interface + Unmarshal() unMarshalDeviceBgpHoldTimerExpired + // validate validates DeviceBgpHoldTimerExpired + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceBgpHoldTimerExpired, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() +} + +func (obj *deviceBgpHoldTimerExpired) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *deviceBgpHoldTimerExpired) setDefault() { + +} diff --git a/gosnappi/device_bgp_message_header_error.go b/gosnappi/device_bgp_message_header_error.go new file mode 100644 index 00000000..f9fd9b6f --- /dev/null +++ b/gosnappi/device_bgp_message_header_error.go @@ -0,0 +1,324 @@ +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" +) + +// ***** DeviceBgpMessageHeaderError ***** +type deviceBgpMessageHeaderError struct { + validation + obj *otg.DeviceBgpMessageHeaderError + marshaller marshalDeviceBgpMessageHeaderError + unMarshaller unMarshalDeviceBgpMessageHeaderError +} + +func NewDeviceBgpMessageHeaderError() DeviceBgpMessageHeaderError { + obj := deviceBgpMessageHeaderError{obj: &otg.DeviceBgpMessageHeaderError{}} + obj.setDefault() + return &obj +} + +func (obj *deviceBgpMessageHeaderError) msg() *otg.DeviceBgpMessageHeaderError { + return obj.obj +} + +func (obj *deviceBgpMessageHeaderError) setMsg(msg *otg.DeviceBgpMessageHeaderError) DeviceBgpMessageHeaderError { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceBgpMessageHeaderError struct { + obj *deviceBgpMessageHeaderError +} + +type marshalDeviceBgpMessageHeaderError interface { + // ToProto marshals DeviceBgpMessageHeaderError to protobuf object *otg.DeviceBgpMessageHeaderError + ToProto() (*otg.DeviceBgpMessageHeaderError, error) + // ToPbText marshals DeviceBgpMessageHeaderError to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceBgpMessageHeaderError to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceBgpMessageHeaderError to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceBgpMessageHeaderError struct { + obj *deviceBgpMessageHeaderError +} + +type unMarshalDeviceBgpMessageHeaderError interface { + // FromProto unmarshals DeviceBgpMessageHeaderError from protobuf object *otg.DeviceBgpMessageHeaderError + FromProto(msg *otg.DeviceBgpMessageHeaderError) (DeviceBgpMessageHeaderError, error) + // FromPbText unmarshals DeviceBgpMessageHeaderError from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceBgpMessageHeaderError from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceBgpMessageHeaderError from JSON text + FromJson(value string) error +} + +func (obj *deviceBgpMessageHeaderError) Marshal() marshalDeviceBgpMessageHeaderError { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceBgpMessageHeaderError{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceBgpMessageHeaderError) Unmarshal() unMarshalDeviceBgpMessageHeaderError { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceBgpMessageHeaderError{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceBgpMessageHeaderError) ToProto() (*otg.DeviceBgpMessageHeaderError, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceBgpMessageHeaderError) FromProto(msg *otg.DeviceBgpMessageHeaderError) (DeviceBgpMessageHeaderError, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceBgpMessageHeaderError) 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 *unMarshaldeviceBgpMessageHeaderError) 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 *marshaldeviceBgpMessageHeaderError) 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 *unMarshaldeviceBgpMessageHeaderError) 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 *marshaldeviceBgpMessageHeaderError) 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 *unMarshaldeviceBgpMessageHeaderError) 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 *deviceBgpMessageHeaderError) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceBgpMessageHeaderError) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceBgpMessageHeaderError) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceBgpMessageHeaderError) Clone() (DeviceBgpMessageHeaderError, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceBgpMessageHeaderError() + 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 +} + +// DeviceBgpMessageHeaderError is all errors detected while processing the Message Header are indicated by sending the NOTIFICATION message with the Error Code-Message Header Error. The Error Subcode elaborates on the specific nature of the error. +type DeviceBgpMessageHeaderError interface { + Validation + // msg marshals DeviceBgpMessageHeaderError to protobuf object *otg.DeviceBgpMessageHeaderError + // and doesn't set defaults + msg() *otg.DeviceBgpMessageHeaderError + // setMsg unmarshals DeviceBgpMessageHeaderError from protobuf object *otg.DeviceBgpMessageHeaderError + // and doesn't set defaults + setMsg(*otg.DeviceBgpMessageHeaderError) DeviceBgpMessageHeaderError + // provides marshal interface + Marshal() marshalDeviceBgpMessageHeaderError + // provides unmarshal interface + Unmarshal() unMarshalDeviceBgpMessageHeaderError + // validate validates DeviceBgpMessageHeaderError + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceBgpMessageHeaderError, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Subcode returns DeviceBgpMessageHeaderErrorSubcodeEnum, set in DeviceBgpMessageHeaderError + Subcode() DeviceBgpMessageHeaderErrorSubcodeEnum + // SetSubcode assigns DeviceBgpMessageHeaderErrorSubcodeEnum provided by user to DeviceBgpMessageHeaderError + SetSubcode(value DeviceBgpMessageHeaderErrorSubcodeEnum) DeviceBgpMessageHeaderError + // HasSubcode checks if Subcode has been set in DeviceBgpMessageHeaderError + HasSubcode() bool +} + +type DeviceBgpMessageHeaderErrorSubcodeEnum string + +// Enum of Subcode on DeviceBgpMessageHeaderError +var DeviceBgpMessageHeaderErrorSubcode = struct { + CONNECTION_NOT_SYNCHRONIZED_CODE1_SUBCODE1 DeviceBgpMessageHeaderErrorSubcodeEnum + BAD_MESSAGE_LENGTH_CODE1_SUBCODE2 DeviceBgpMessageHeaderErrorSubcodeEnum + BAD_MESSAGE_TYPE_CODE1_SUBCODE3 DeviceBgpMessageHeaderErrorSubcodeEnum +}{ + CONNECTION_NOT_SYNCHRONIZED_CODE1_SUBCODE1: DeviceBgpMessageHeaderErrorSubcodeEnum("connection_not_synchronized_code1_subcode1"), + BAD_MESSAGE_LENGTH_CODE1_SUBCODE2: DeviceBgpMessageHeaderErrorSubcodeEnum("bad_message_length_code1_subcode2"), + BAD_MESSAGE_TYPE_CODE1_SUBCODE3: DeviceBgpMessageHeaderErrorSubcodeEnum("bad_message_type_code1_subcode3"), +} + +func (obj *deviceBgpMessageHeaderError) Subcode() DeviceBgpMessageHeaderErrorSubcodeEnum { + return DeviceBgpMessageHeaderErrorSubcodeEnum(obj.obj.Subcode.Enum().String()) +} + +// The Error Subcode indicates the specific type of error encountered during Message Header processing. +// Subcode returns a string +func (obj *deviceBgpMessageHeaderError) HasSubcode() bool { + return obj.obj.Subcode != nil +} + +func (obj *deviceBgpMessageHeaderError) SetSubcode(value DeviceBgpMessageHeaderErrorSubcodeEnum) DeviceBgpMessageHeaderError { + intValue, ok := otg.DeviceBgpMessageHeaderError_Subcode_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on DeviceBgpMessageHeaderErrorSubcodeEnum", string(value))) + return obj + } + enumValue := otg.DeviceBgpMessageHeaderError_Subcode_Enum(intValue) + obj.obj.Subcode = &enumValue + + return obj +} + +func (obj *deviceBgpMessageHeaderError) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *deviceBgpMessageHeaderError) setDefault() { + if obj.obj.Subcode == nil { + obj.SetSubcode(DeviceBgpMessageHeaderErrorSubcode.CONNECTION_NOT_SYNCHRONIZED_CODE1_SUBCODE1) + + } + +} diff --git a/gosnappi/device_bgp_open_message_error.go b/gosnappi/device_bgp_open_message_error.go new file mode 100644 index 00000000..b4cb9c9a --- /dev/null +++ b/gosnappi/device_bgp_open_message_error.go @@ -0,0 +1,332 @@ +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" +) + +// ***** DeviceBgpOpenMessageError ***** +type deviceBgpOpenMessageError struct { + validation + obj *otg.DeviceBgpOpenMessageError + marshaller marshalDeviceBgpOpenMessageError + unMarshaller unMarshalDeviceBgpOpenMessageError +} + +func NewDeviceBgpOpenMessageError() DeviceBgpOpenMessageError { + obj := deviceBgpOpenMessageError{obj: &otg.DeviceBgpOpenMessageError{}} + obj.setDefault() + return &obj +} + +func (obj *deviceBgpOpenMessageError) msg() *otg.DeviceBgpOpenMessageError { + return obj.obj +} + +func (obj *deviceBgpOpenMessageError) setMsg(msg *otg.DeviceBgpOpenMessageError) DeviceBgpOpenMessageError { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceBgpOpenMessageError struct { + obj *deviceBgpOpenMessageError +} + +type marshalDeviceBgpOpenMessageError interface { + // ToProto marshals DeviceBgpOpenMessageError to protobuf object *otg.DeviceBgpOpenMessageError + ToProto() (*otg.DeviceBgpOpenMessageError, error) + // ToPbText marshals DeviceBgpOpenMessageError to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceBgpOpenMessageError to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceBgpOpenMessageError to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceBgpOpenMessageError struct { + obj *deviceBgpOpenMessageError +} + +type unMarshalDeviceBgpOpenMessageError interface { + // FromProto unmarshals DeviceBgpOpenMessageError from protobuf object *otg.DeviceBgpOpenMessageError + FromProto(msg *otg.DeviceBgpOpenMessageError) (DeviceBgpOpenMessageError, error) + // FromPbText unmarshals DeviceBgpOpenMessageError from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceBgpOpenMessageError from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceBgpOpenMessageError from JSON text + FromJson(value string) error +} + +func (obj *deviceBgpOpenMessageError) Marshal() marshalDeviceBgpOpenMessageError { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceBgpOpenMessageError{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceBgpOpenMessageError) Unmarshal() unMarshalDeviceBgpOpenMessageError { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceBgpOpenMessageError{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceBgpOpenMessageError) ToProto() (*otg.DeviceBgpOpenMessageError, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceBgpOpenMessageError) FromProto(msg *otg.DeviceBgpOpenMessageError) (DeviceBgpOpenMessageError, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceBgpOpenMessageError) 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 *unMarshaldeviceBgpOpenMessageError) 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 *marshaldeviceBgpOpenMessageError) 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 *unMarshaldeviceBgpOpenMessageError) 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 *marshaldeviceBgpOpenMessageError) 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 *unMarshaldeviceBgpOpenMessageError) 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 *deviceBgpOpenMessageError) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceBgpOpenMessageError) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceBgpOpenMessageError) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceBgpOpenMessageError) Clone() (DeviceBgpOpenMessageError, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceBgpOpenMessageError() + 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 +} + +// DeviceBgpOpenMessageError is all errors detected while processing the OPEN message are indicated by sending the NOTIFICATION message with the Error Code-Open Message Error. The Error Subcode elaborates on the specific nature of the error. +type DeviceBgpOpenMessageError interface { + Validation + // msg marshals DeviceBgpOpenMessageError to protobuf object *otg.DeviceBgpOpenMessageError + // and doesn't set defaults + msg() *otg.DeviceBgpOpenMessageError + // setMsg unmarshals DeviceBgpOpenMessageError from protobuf object *otg.DeviceBgpOpenMessageError + // and doesn't set defaults + setMsg(*otg.DeviceBgpOpenMessageError) DeviceBgpOpenMessageError + // provides marshal interface + Marshal() marshalDeviceBgpOpenMessageError + // provides unmarshal interface + Unmarshal() unMarshalDeviceBgpOpenMessageError + // validate validates DeviceBgpOpenMessageError + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceBgpOpenMessageError, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Subcode returns DeviceBgpOpenMessageErrorSubcodeEnum, set in DeviceBgpOpenMessageError + Subcode() DeviceBgpOpenMessageErrorSubcodeEnum + // SetSubcode assigns DeviceBgpOpenMessageErrorSubcodeEnum provided by user to DeviceBgpOpenMessageError + SetSubcode(value DeviceBgpOpenMessageErrorSubcodeEnum) DeviceBgpOpenMessageError + // HasSubcode checks if Subcode has been set in DeviceBgpOpenMessageError + HasSubcode() bool +} + +type DeviceBgpOpenMessageErrorSubcodeEnum string + +// Enum of Subcode on DeviceBgpOpenMessageError +var DeviceBgpOpenMessageErrorSubcode = struct { + UNSUPPORTED_VERSION_NUMBER_CODE2_SUBCODE1 DeviceBgpOpenMessageErrorSubcodeEnum + ERROR_PEER_AS_CODE2_SUBCODE2 DeviceBgpOpenMessageErrorSubcodeEnum + ERROR_BGP_ID_CODE2_SUBCODE3 DeviceBgpOpenMessageErrorSubcodeEnum + UNSUPPORTED_OPTIONAL_PARAMETER_CODE2_SUBCODE4 DeviceBgpOpenMessageErrorSubcodeEnum + AUTH_FAILED_CODE2_SUBCODE5 DeviceBgpOpenMessageErrorSubcodeEnum + UNSUPPORTED_HOLD_TIME_CODE2_SUBCODE6 DeviceBgpOpenMessageErrorSubcodeEnum + UNSUPPORTED_CAPABILITY_CODE2_SUBCODE7 DeviceBgpOpenMessageErrorSubcodeEnum +}{ + UNSUPPORTED_VERSION_NUMBER_CODE2_SUBCODE1: DeviceBgpOpenMessageErrorSubcodeEnum("unsupported_version_number_code2_subcode1"), + ERROR_PEER_AS_CODE2_SUBCODE2: DeviceBgpOpenMessageErrorSubcodeEnum("error_peer_as_code2_subcode2"), + ERROR_BGP_ID_CODE2_SUBCODE3: DeviceBgpOpenMessageErrorSubcodeEnum("error_bgp_id_code2_subcode3"), + UNSUPPORTED_OPTIONAL_PARAMETER_CODE2_SUBCODE4: DeviceBgpOpenMessageErrorSubcodeEnum("unsupported_optional_parameter_code2_subcode4"), + AUTH_FAILED_CODE2_SUBCODE5: DeviceBgpOpenMessageErrorSubcodeEnum("auth_failed_code2_subcode5"), + UNSUPPORTED_HOLD_TIME_CODE2_SUBCODE6: DeviceBgpOpenMessageErrorSubcodeEnum("unsupported_hold_time_code2_subcode6"), + UNSUPPORTED_CAPABILITY_CODE2_SUBCODE7: DeviceBgpOpenMessageErrorSubcodeEnum("unsupported_capability_code2_subcode7"), +} + +func (obj *deviceBgpOpenMessageError) Subcode() DeviceBgpOpenMessageErrorSubcodeEnum { + return DeviceBgpOpenMessageErrorSubcodeEnum(obj.obj.Subcode.Enum().String()) +} + +// The Error Subcode indicates the specific type of error encountered during OPEN message processing. +// Subcode returns a string +func (obj *deviceBgpOpenMessageError) HasSubcode() bool { + return obj.obj.Subcode != nil +} + +func (obj *deviceBgpOpenMessageError) SetSubcode(value DeviceBgpOpenMessageErrorSubcodeEnum) DeviceBgpOpenMessageError { + intValue, ok := otg.DeviceBgpOpenMessageError_Subcode_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on DeviceBgpOpenMessageErrorSubcodeEnum", string(value))) + return obj + } + enumValue := otg.DeviceBgpOpenMessageError_Subcode_Enum(intValue) + obj.obj.Subcode = &enumValue + + return obj +} + +func (obj *deviceBgpOpenMessageError) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *deviceBgpOpenMessageError) setDefault() { + if obj.obj.Subcode == nil { + obj.SetSubcode(DeviceBgpOpenMessageErrorSubcode.UNSUPPORTED_VERSION_NUMBER_CODE2_SUBCODE1) + + } + +} diff --git a/gosnappi/device_bgp_router.go b/gosnappi/device_bgp_router.go new file mode 100644 index 00000000..0b574eab --- /dev/null +++ b/gosnappi/device_bgp_router.go @@ -0,0 +1,528 @@ +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" +) + +// ***** DeviceBgpRouter ***** +type deviceBgpRouter struct { + validation + obj *otg.DeviceBgpRouter + marshaller marshalDeviceBgpRouter + unMarshaller unMarshalDeviceBgpRouter + ipv4InterfacesHolder DeviceBgpRouterBgpV4InterfaceIter + ipv6InterfacesHolder DeviceBgpRouterBgpV6InterfaceIter +} + +func NewDeviceBgpRouter() DeviceBgpRouter { + obj := deviceBgpRouter{obj: &otg.DeviceBgpRouter{}} + obj.setDefault() + return &obj +} + +func (obj *deviceBgpRouter) msg() *otg.DeviceBgpRouter { + return obj.obj +} + +func (obj *deviceBgpRouter) setMsg(msg *otg.DeviceBgpRouter) DeviceBgpRouter { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceBgpRouter struct { + obj *deviceBgpRouter +} + +type marshalDeviceBgpRouter interface { + // ToProto marshals DeviceBgpRouter to protobuf object *otg.DeviceBgpRouter + ToProto() (*otg.DeviceBgpRouter, error) + // ToPbText marshals DeviceBgpRouter to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceBgpRouter to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceBgpRouter to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceBgpRouter struct { + obj *deviceBgpRouter +} + +type unMarshalDeviceBgpRouter interface { + // FromProto unmarshals DeviceBgpRouter from protobuf object *otg.DeviceBgpRouter + FromProto(msg *otg.DeviceBgpRouter) (DeviceBgpRouter, error) + // FromPbText unmarshals DeviceBgpRouter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceBgpRouter from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceBgpRouter from JSON text + FromJson(value string) error +} + +func (obj *deviceBgpRouter) Marshal() marshalDeviceBgpRouter { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceBgpRouter{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceBgpRouter) Unmarshal() unMarshalDeviceBgpRouter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceBgpRouter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceBgpRouter) ToProto() (*otg.DeviceBgpRouter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceBgpRouter) FromProto(msg *otg.DeviceBgpRouter) (DeviceBgpRouter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceBgpRouter) 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 *unMarshaldeviceBgpRouter) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshaldeviceBgpRouter) 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 *unMarshaldeviceBgpRouter) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshaldeviceBgpRouter) 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 *unMarshaldeviceBgpRouter) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *deviceBgpRouter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceBgpRouter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceBgpRouter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceBgpRouter) Clone() (DeviceBgpRouter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceBgpRouter() + 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 +} + +func (obj *deviceBgpRouter) setNil() { + obj.ipv4InterfacesHolder = nil + obj.ipv6InterfacesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// DeviceBgpRouter is configuration for one or more IPv4 or IPv6 BGP peers. +type DeviceBgpRouter interface { + Validation + // msg marshals DeviceBgpRouter to protobuf object *otg.DeviceBgpRouter + // and doesn't set defaults + msg() *otg.DeviceBgpRouter + // setMsg unmarshals DeviceBgpRouter from protobuf object *otg.DeviceBgpRouter + // and doesn't set defaults + setMsg(*otg.DeviceBgpRouter) DeviceBgpRouter + // provides marshal interface + Marshal() marshalDeviceBgpRouter + // provides unmarshal interface + Unmarshal() unMarshalDeviceBgpRouter + // validate validates DeviceBgpRouter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceBgpRouter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RouterId returns string, set in DeviceBgpRouter. + RouterId() string + // SetRouterId assigns string provided by user to DeviceBgpRouter + SetRouterId(value string) DeviceBgpRouter + // Ipv4Interfaces returns DeviceBgpRouterBgpV4InterfaceIterIter, set in DeviceBgpRouter + Ipv4Interfaces() DeviceBgpRouterBgpV4InterfaceIter + // Ipv6Interfaces returns DeviceBgpRouterBgpV6InterfaceIterIter, set in DeviceBgpRouter + Ipv6Interfaces() DeviceBgpRouterBgpV6InterfaceIter + setNil() +} + +// The BGP router ID is a unique identifier used by BGP. It is a 32-bit value that is often represented by an IPv4 address. +// RouterId returns a string +func (obj *deviceBgpRouter) RouterId() string { + + return *obj.obj.RouterId + +} + +// The BGP router ID is a unique identifier used by BGP. It is a 32-bit value that is often represented by an IPv4 address. +// SetRouterId sets the string value in the DeviceBgpRouter object +func (obj *deviceBgpRouter) SetRouterId(value string) DeviceBgpRouter { + + obj.obj.RouterId = &value + return obj +} + +// This contains an array of references to IPv4 interfaces, each of which will have list of peers to different destinations. +// Ipv4Interfaces returns a []BgpV4Interface +func (obj *deviceBgpRouter) Ipv4Interfaces() DeviceBgpRouterBgpV4InterfaceIter { + if len(obj.obj.Ipv4Interfaces) == 0 { + obj.obj.Ipv4Interfaces = []*otg.BgpV4Interface{} + } + if obj.ipv4InterfacesHolder == nil { + obj.ipv4InterfacesHolder = newDeviceBgpRouterBgpV4InterfaceIter(&obj.obj.Ipv4Interfaces).setMsg(obj) + } + return obj.ipv4InterfacesHolder +} + +type deviceBgpRouterBgpV4InterfaceIter struct { + obj *deviceBgpRouter + bgpV4InterfaceSlice []BgpV4Interface + fieldPtr *[]*otg.BgpV4Interface +} + +func newDeviceBgpRouterBgpV4InterfaceIter(ptr *[]*otg.BgpV4Interface) DeviceBgpRouterBgpV4InterfaceIter { + return &deviceBgpRouterBgpV4InterfaceIter{fieldPtr: ptr} +} + +type DeviceBgpRouterBgpV4InterfaceIter interface { + setMsg(*deviceBgpRouter) DeviceBgpRouterBgpV4InterfaceIter + Items() []BgpV4Interface + Add() BgpV4Interface + Append(items ...BgpV4Interface) DeviceBgpRouterBgpV4InterfaceIter + Set(index int, newObj BgpV4Interface) DeviceBgpRouterBgpV4InterfaceIter + Clear() DeviceBgpRouterBgpV4InterfaceIter + clearHolderSlice() DeviceBgpRouterBgpV4InterfaceIter + appendHolderSlice(item BgpV4Interface) DeviceBgpRouterBgpV4InterfaceIter +} + +func (obj *deviceBgpRouterBgpV4InterfaceIter) setMsg(msg *deviceBgpRouter) DeviceBgpRouterBgpV4InterfaceIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpV4Interface{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceBgpRouterBgpV4InterfaceIter) Items() []BgpV4Interface { + return obj.bgpV4InterfaceSlice +} + +func (obj *deviceBgpRouterBgpV4InterfaceIter) Add() BgpV4Interface { + newObj := &otg.BgpV4Interface{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpV4Interface{obj: newObj} + newLibObj.setDefault() + obj.bgpV4InterfaceSlice = append(obj.bgpV4InterfaceSlice, newLibObj) + return newLibObj +} + +func (obj *deviceBgpRouterBgpV4InterfaceIter) Append(items ...BgpV4Interface) DeviceBgpRouterBgpV4InterfaceIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpV4InterfaceSlice = append(obj.bgpV4InterfaceSlice, item) + } + return obj +} + +func (obj *deviceBgpRouterBgpV4InterfaceIter) Set(index int, newObj BgpV4Interface) DeviceBgpRouterBgpV4InterfaceIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpV4InterfaceSlice[index] = newObj + return obj +} +func (obj *deviceBgpRouterBgpV4InterfaceIter) Clear() DeviceBgpRouterBgpV4InterfaceIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpV4Interface{} + obj.bgpV4InterfaceSlice = []BgpV4Interface{} + } + return obj +} +func (obj *deviceBgpRouterBgpV4InterfaceIter) clearHolderSlice() DeviceBgpRouterBgpV4InterfaceIter { + if len(obj.bgpV4InterfaceSlice) > 0 { + obj.bgpV4InterfaceSlice = []BgpV4Interface{} + } + return obj +} +func (obj *deviceBgpRouterBgpV4InterfaceIter) appendHolderSlice(item BgpV4Interface) DeviceBgpRouterBgpV4InterfaceIter { + obj.bgpV4InterfaceSlice = append(obj.bgpV4InterfaceSlice, item) + return obj +} + +// This contains an array of references to IPv6 interfaces, each of which will have list of peers to different destinations. +// Ipv6Interfaces returns a []BgpV6Interface +func (obj *deviceBgpRouter) Ipv6Interfaces() DeviceBgpRouterBgpV6InterfaceIter { + if len(obj.obj.Ipv6Interfaces) == 0 { + obj.obj.Ipv6Interfaces = []*otg.BgpV6Interface{} + } + if obj.ipv6InterfacesHolder == nil { + obj.ipv6InterfacesHolder = newDeviceBgpRouterBgpV6InterfaceIter(&obj.obj.Ipv6Interfaces).setMsg(obj) + } + return obj.ipv6InterfacesHolder +} + +type deviceBgpRouterBgpV6InterfaceIter struct { + obj *deviceBgpRouter + bgpV6InterfaceSlice []BgpV6Interface + fieldPtr *[]*otg.BgpV6Interface +} + +func newDeviceBgpRouterBgpV6InterfaceIter(ptr *[]*otg.BgpV6Interface) DeviceBgpRouterBgpV6InterfaceIter { + return &deviceBgpRouterBgpV6InterfaceIter{fieldPtr: ptr} +} + +type DeviceBgpRouterBgpV6InterfaceIter interface { + setMsg(*deviceBgpRouter) DeviceBgpRouterBgpV6InterfaceIter + Items() []BgpV6Interface + Add() BgpV6Interface + Append(items ...BgpV6Interface) DeviceBgpRouterBgpV6InterfaceIter + Set(index int, newObj BgpV6Interface) DeviceBgpRouterBgpV6InterfaceIter + Clear() DeviceBgpRouterBgpV6InterfaceIter + clearHolderSlice() DeviceBgpRouterBgpV6InterfaceIter + appendHolderSlice(item BgpV6Interface) DeviceBgpRouterBgpV6InterfaceIter +} + +func (obj *deviceBgpRouterBgpV6InterfaceIter) setMsg(msg *deviceBgpRouter) DeviceBgpRouterBgpV6InterfaceIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpV6Interface{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceBgpRouterBgpV6InterfaceIter) Items() []BgpV6Interface { + return obj.bgpV6InterfaceSlice +} + +func (obj *deviceBgpRouterBgpV6InterfaceIter) Add() BgpV6Interface { + newObj := &otg.BgpV6Interface{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpV6Interface{obj: newObj} + newLibObj.setDefault() + obj.bgpV6InterfaceSlice = append(obj.bgpV6InterfaceSlice, newLibObj) + return newLibObj +} + +func (obj *deviceBgpRouterBgpV6InterfaceIter) Append(items ...BgpV6Interface) DeviceBgpRouterBgpV6InterfaceIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpV6InterfaceSlice = append(obj.bgpV6InterfaceSlice, item) + } + return obj +} + +func (obj *deviceBgpRouterBgpV6InterfaceIter) Set(index int, newObj BgpV6Interface) DeviceBgpRouterBgpV6InterfaceIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpV6InterfaceSlice[index] = newObj + return obj +} +func (obj *deviceBgpRouterBgpV6InterfaceIter) Clear() DeviceBgpRouterBgpV6InterfaceIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpV6Interface{} + obj.bgpV6InterfaceSlice = []BgpV6Interface{} + } + return obj +} +func (obj *deviceBgpRouterBgpV6InterfaceIter) clearHolderSlice() DeviceBgpRouterBgpV6InterfaceIter { + if len(obj.bgpV6InterfaceSlice) > 0 { + obj.bgpV6InterfaceSlice = []BgpV6Interface{} + } + return obj +} +func (obj *deviceBgpRouterBgpV6InterfaceIter) appendHolderSlice(item BgpV6Interface) DeviceBgpRouterBgpV6InterfaceIter { + obj.bgpV6InterfaceSlice = append(obj.bgpV6InterfaceSlice, item) + return obj +} + +func (obj *deviceBgpRouter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // RouterId is required + if obj.obj.RouterId == nil { + vObj.validationErrors = append(vObj.validationErrors, "RouterId is required field on interface DeviceBgpRouter") + } + if obj.obj.RouterId != nil { + + err := obj.validateIpv4(obj.RouterId()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceBgpRouter.RouterId")) + } + + } + + if len(obj.obj.Ipv4Interfaces) != 0 { + + if set_default { + obj.Ipv4Interfaces().clearHolderSlice() + for _, item := range obj.obj.Ipv4Interfaces { + obj.Ipv4Interfaces().appendHolderSlice(&bgpV4Interface{obj: item}) + } + } + for _, item := range obj.Ipv4Interfaces().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Ipv6Interfaces) != 0 { + + if set_default { + obj.Ipv6Interfaces().clearHolderSlice() + for _, item := range obj.obj.Ipv6Interfaces { + obj.Ipv6Interfaces().appendHolderSlice(&bgpV6Interface{obj: item}) + } + } + for _, item := range obj.Ipv6Interfaces().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *deviceBgpRouter) setDefault() { + +} diff --git a/gosnappi/device_bgp_update_message_error.go b/gosnappi/device_bgp_update_message_error.go new file mode 100644 index 00000000..8181df51 --- /dev/null +++ b/gosnappi/device_bgp_update_message_error.go @@ -0,0 +1,340 @@ +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" +) + +// ***** DeviceBgpUpdateMessageError ***** +type deviceBgpUpdateMessageError struct { + validation + obj *otg.DeviceBgpUpdateMessageError + marshaller marshalDeviceBgpUpdateMessageError + unMarshaller unMarshalDeviceBgpUpdateMessageError +} + +func NewDeviceBgpUpdateMessageError() DeviceBgpUpdateMessageError { + obj := deviceBgpUpdateMessageError{obj: &otg.DeviceBgpUpdateMessageError{}} + obj.setDefault() + return &obj +} + +func (obj *deviceBgpUpdateMessageError) msg() *otg.DeviceBgpUpdateMessageError { + return obj.obj +} + +func (obj *deviceBgpUpdateMessageError) setMsg(msg *otg.DeviceBgpUpdateMessageError) DeviceBgpUpdateMessageError { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceBgpUpdateMessageError struct { + obj *deviceBgpUpdateMessageError +} + +type marshalDeviceBgpUpdateMessageError interface { + // ToProto marshals DeviceBgpUpdateMessageError to protobuf object *otg.DeviceBgpUpdateMessageError + ToProto() (*otg.DeviceBgpUpdateMessageError, error) + // ToPbText marshals DeviceBgpUpdateMessageError to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceBgpUpdateMessageError to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceBgpUpdateMessageError to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceBgpUpdateMessageError struct { + obj *deviceBgpUpdateMessageError +} + +type unMarshalDeviceBgpUpdateMessageError interface { + // FromProto unmarshals DeviceBgpUpdateMessageError from protobuf object *otg.DeviceBgpUpdateMessageError + FromProto(msg *otg.DeviceBgpUpdateMessageError) (DeviceBgpUpdateMessageError, error) + // FromPbText unmarshals DeviceBgpUpdateMessageError from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceBgpUpdateMessageError from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceBgpUpdateMessageError from JSON text + FromJson(value string) error +} + +func (obj *deviceBgpUpdateMessageError) Marshal() marshalDeviceBgpUpdateMessageError { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceBgpUpdateMessageError{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceBgpUpdateMessageError) Unmarshal() unMarshalDeviceBgpUpdateMessageError { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceBgpUpdateMessageError{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceBgpUpdateMessageError) ToProto() (*otg.DeviceBgpUpdateMessageError, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceBgpUpdateMessageError) FromProto(msg *otg.DeviceBgpUpdateMessageError) (DeviceBgpUpdateMessageError, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceBgpUpdateMessageError) 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 *unMarshaldeviceBgpUpdateMessageError) 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 *marshaldeviceBgpUpdateMessageError) 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 *unMarshaldeviceBgpUpdateMessageError) 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 *marshaldeviceBgpUpdateMessageError) 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 *unMarshaldeviceBgpUpdateMessageError) 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 *deviceBgpUpdateMessageError) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceBgpUpdateMessageError) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceBgpUpdateMessageError) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceBgpUpdateMessageError) Clone() (DeviceBgpUpdateMessageError, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceBgpUpdateMessageError() + 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 +} + +// DeviceBgpUpdateMessageError is all errors detected while processing the UPDATE message are indicated by sending the NOTIFICATION message with the Error Code-Update Message Error. The Error Subcode elaborates on the specific nature of the error. +type DeviceBgpUpdateMessageError interface { + Validation + // msg marshals DeviceBgpUpdateMessageError to protobuf object *otg.DeviceBgpUpdateMessageError + // and doesn't set defaults + msg() *otg.DeviceBgpUpdateMessageError + // setMsg unmarshals DeviceBgpUpdateMessageError from protobuf object *otg.DeviceBgpUpdateMessageError + // and doesn't set defaults + setMsg(*otg.DeviceBgpUpdateMessageError) DeviceBgpUpdateMessageError + // provides marshal interface + Marshal() marshalDeviceBgpUpdateMessageError + // provides unmarshal interface + Unmarshal() unMarshalDeviceBgpUpdateMessageError + // validate validates DeviceBgpUpdateMessageError + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceBgpUpdateMessageError, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Subcode returns DeviceBgpUpdateMessageErrorSubcodeEnum, set in DeviceBgpUpdateMessageError + Subcode() DeviceBgpUpdateMessageErrorSubcodeEnum + // SetSubcode assigns DeviceBgpUpdateMessageErrorSubcodeEnum provided by user to DeviceBgpUpdateMessageError + SetSubcode(value DeviceBgpUpdateMessageErrorSubcodeEnum) DeviceBgpUpdateMessageError + // HasSubcode checks if Subcode has been set in DeviceBgpUpdateMessageError + HasSubcode() bool +} + +type DeviceBgpUpdateMessageErrorSubcodeEnum string + +// Enum of Subcode on DeviceBgpUpdateMessageError +var DeviceBgpUpdateMessageErrorSubcode = struct { + MALFORMED_ATTRIB_LIST_CODE3_SUBCODE1 DeviceBgpUpdateMessageErrorSubcodeEnum + UNRECOGNIZED_WELLKNOWN_ATTRIB_CODE3_SUBCODE2 DeviceBgpUpdateMessageErrorSubcodeEnum + WELLKNOWN_ATTRIB_MISSING_CODE3_SUBCODE3 DeviceBgpUpdateMessageErrorSubcodeEnum + ATTRIB_FLAGS_ERROR_CODE3_SUBCODE4 DeviceBgpUpdateMessageErrorSubcodeEnum + ATTRIB_LENGTH_ERROR_CODE3_SUBCODE5 DeviceBgpUpdateMessageErrorSubcodeEnum + INVALID_ORIGIN_ATTRIB_CODE3_SUBCODE6 DeviceBgpUpdateMessageErrorSubcodeEnum + AS_ROUTING_LOOP_CODE3_SUBCODE7 DeviceBgpUpdateMessageErrorSubcodeEnum + INVALID_NHOP_ATTRIB_CODE3_SUBCODE8 DeviceBgpUpdateMessageErrorSubcodeEnum + ERROR_OPTIONAL_ATTRIB_CODE3_SUBCODE9 DeviceBgpUpdateMessageErrorSubcodeEnum + INVALID_NETWORK_FIELD_CODE3_SUBCODE10 DeviceBgpUpdateMessageErrorSubcodeEnum + ABNORMAL_ASPATH_CODE3_SUBCODE11 DeviceBgpUpdateMessageErrorSubcodeEnum +}{ + MALFORMED_ATTRIB_LIST_CODE3_SUBCODE1: DeviceBgpUpdateMessageErrorSubcodeEnum("malformed_attrib_list_code3_subcode1"), + UNRECOGNIZED_WELLKNOWN_ATTRIB_CODE3_SUBCODE2: DeviceBgpUpdateMessageErrorSubcodeEnum("unrecognized_wellknown_attrib_code3_subcode2"), + WELLKNOWN_ATTRIB_MISSING_CODE3_SUBCODE3: DeviceBgpUpdateMessageErrorSubcodeEnum("wellknown_attrib_missing_code3_subcode3"), + ATTRIB_FLAGS_ERROR_CODE3_SUBCODE4: DeviceBgpUpdateMessageErrorSubcodeEnum("attrib_flags_error_code3_subcode4"), + ATTRIB_LENGTH_ERROR_CODE3_SUBCODE5: DeviceBgpUpdateMessageErrorSubcodeEnum("attrib_length_error_code3_subcode5"), + INVALID_ORIGIN_ATTRIB_CODE3_SUBCODE6: DeviceBgpUpdateMessageErrorSubcodeEnum("invalid_origin_attrib_code3_subcode6"), + AS_ROUTING_LOOP_CODE3_SUBCODE7: DeviceBgpUpdateMessageErrorSubcodeEnum("as_routing_loop_code3_subcode7"), + INVALID_NHOP_ATTRIB_CODE3_SUBCODE8: DeviceBgpUpdateMessageErrorSubcodeEnum("invalid_nhop_attrib_code3_subcode8"), + ERROR_OPTIONAL_ATTRIB_CODE3_SUBCODE9: DeviceBgpUpdateMessageErrorSubcodeEnum("error_optional_attrib_code3_subcode9"), + INVALID_NETWORK_FIELD_CODE3_SUBCODE10: DeviceBgpUpdateMessageErrorSubcodeEnum("invalid_network_field_code3_subcode10"), + ABNORMAL_ASPATH_CODE3_SUBCODE11: DeviceBgpUpdateMessageErrorSubcodeEnum("abnormal_aspath_code3_subcode11"), +} + +func (obj *deviceBgpUpdateMessageError) Subcode() DeviceBgpUpdateMessageErrorSubcodeEnum { + return DeviceBgpUpdateMessageErrorSubcodeEnum(obj.obj.Subcode.Enum().String()) +} + +// The Error Subcode, the specific type of error encountered during UPDATE processing. +// Subcode returns a string +func (obj *deviceBgpUpdateMessageError) HasSubcode() bool { + return obj.obj.Subcode != nil +} + +func (obj *deviceBgpUpdateMessageError) SetSubcode(value DeviceBgpUpdateMessageErrorSubcodeEnum) DeviceBgpUpdateMessageError { + intValue, ok := otg.DeviceBgpUpdateMessageError_Subcode_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on DeviceBgpUpdateMessageErrorSubcodeEnum", string(value))) + return obj + } + enumValue := otg.DeviceBgpUpdateMessageError_Subcode_Enum(intValue) + obj.obj.Subcode = &enumValue + + return obj +} + +func (obj *deviceBgpUpdateMessageError) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *deviceBgpUpdateMessageError) setDefault() { + if obj.obj.Subcode == nil { + obj.SetSubcode(DeviceBgpUpdateMessageErrorSubcode.MALFORMED_ATTRIB_LIST_CODE3_SUBCODE1) + + } + +} diff --git a/gosnappi/device_dhcp_server.go b/gosnappi/device_dhcp_server.go new file mode 100644 index 00000000..a80b5290 --- /dev/null +++ b/gosnappi/device_dhcp_server.go @@ -0,0 +1,390 @@ +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" +) + +// ***** DeviceDhcpServer ***** +type deviceDhcpServer struct { + validation + obj *otg.DeviceDhcpServer + marshaller marshalDeviceDhcpServer + unMarshaller unMarshalDeviceDhcpServer + ipv4InterfacesHolder DeviceDhcpServerDhcpServerV4Iter +} + +func NewDeviceDhcpServer() DeviceDhcpServer { + obj := deviceDhcpServer{obj: &otg.DeviceDhcpServer{}} + obj.setDefault() + return &obj +} + +func (obj *deviceDhcpServer) msg() *otg.DeviceDhcpServer { + return obj.obj +} + +func (obj *deviceDhcpServer) setMsg(msg *otg.DeviceDhcpServer) DeviceDhcpServer { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceDhcpServer struct { + obj *deviceDhcpServer +} + +type marshalDeviceDhcpServer interface { + // ToProto marshals DeviceDhcpServer to protobuf object *otg.DeviceDhcpServer + ToProto() (*otg.DeviceDhcpServer, error) + // ToPbText marshals DeviceDhcpServer to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceDhcpServer to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceDhcpServer to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceDhcpServer struct { + obj *deviceDhcpServer +} + +type unMarshalDeviceDhcpServer interface { + // FromProto unmarshals DeviceDhcpServer from protobuf object *otg.DeviceDhcpServer + FromProto(msg *otg.DeviceDhcpServer) (DeviceDhcpServer, error) + // FromPbText unmarshals DeviceDhcpServer from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceDhcpServer from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceDhcpServer from JSON text + FromJson(value string) error +} + +func (obj *deviceDhcpServer) Marshal() marshalDeviceDhcpServer { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceDhcpServer{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceDhcpServer) Unmarshal() unMarshalDeviceDhcpServer { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceDhcpServer{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceDhcpServer) ToProto() (*otg.DeviceDhcpServer, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceDhcpServer) FromProto(msg *otg.DeviceDhcpServer) (DeviceDhcpServer, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceDhcpServer) 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 *unMarshaldeviceDhcpServer) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshaldeviceDhcpServer) 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 *unMarshaldeviceDhcpServer) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshaldeviceDhcpServer) 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 *unMarshaldeviceDhcpServer) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *deviceDhcpServer) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceDhcpServer) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceDhcpServer) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceDhcpServer) Clone() (DeviceDhcpServer, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceDhcpServer() + 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 +} + +func (obj *deviceDhcpServer) setNil() { + obj.ipv4InterfacesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// DeviceDhcpServer is configuration for one or more IPv4 or IPv6 DHCP servers. +type DeviceDhcpServer interface { + Validation + // msg marshals DeviceDhcpServer to protobuf object *otg.DeviceDhcpServer + // and doesn't set defaults + msg() *otg.DeviceDhcpServer + // setMsg unmarshals DeviceDhcpServer from protobuf object *otg.DeviceDhcpServer + // and doesn't set defaults + setMsg(*otg.DeviceDhcpServer) DeviceDhcpServer + // provides marshal interface + Marshal() marshalDeviceDhcpServer + // provides unmarshal interface + Unmarshal() unMarshalDeviceDhcpServer + // validate validates DeviceDhcpServer + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceDhcpServer, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv4Interfaces returns DeviceDhcpServerDhcpServerV4IterIter, set in DeviceDhcpServer + Ipv4Interfaces() DeviceDhcpServerDhcpServerV4Iter + setNil() +} + +// This contains an array of references to IPv4 interfaces, each of which will contain one DHCPv4 server. +// Ipv4Interfaces returns a []DhcpServerV4 +func (obj *deviceDhcpServer) Ipv4Interfaces() DeviceDhcpServerDhcpServerV4Iter { + if len(obj.obj.Ipv4Interfaces) == 0 { + obj.obj.Ipv4Interfaces = []*otg.DhcpServerV4{} + } + if obj.ipv4InterfacesHolder == nil { + obj.ipv4InterfacesHolder = newDeviceDhcpServerDhcpServerV4Iter(&obj.obj.Ipv4Interfaces).setMsg(obj) + } + return obj.ipv4InterfacesHolder +} + +type deviceDhcpServerDhcpServerV4Iter struct { + obj *deviceDhcpServer + dhcpServerV4Slice []DhcpServerV4 + fieldPtr *[]*otg.DhcpServerV4 +} + +func newDeviceDhcpServerDhcpServerV4Iter(ptr *[]*otg.DhcpServerV4) DeviceDhcpServerDhcpServerV4Iter { + return &deviceDhcpServerDhcpServerV4Iter{fieldPtr: ptr} +} + +type DeviceDhcpServerDhcpServerV4Iter interface { + setMsg(*deviceDhcpServer) DeviceDhcpServerDhcpServerV4Iter + Items() []DhcpServerV4 + Add() DhcpServerV4 + Append(items ...DhcpServerV4) DeviceDhcpServerDhcpServerV4Iter + Set(index int, newObj DhcpServerV4) DeviceDhcpServerDhcpServerV4Iter + Clear() DeviceDhcpServerDhcpServerV4Iter + clearHolderSlice() DeviceDhcpServerDhcpServerV4Iter + appendHolderSlice(item DhcpServerV4) DeviceDhcpServerDhcpServerV4Iter +} + +func (obj *deviceDhcpServerDhcpServerV4Iter) setMsg(msg *deviceDhcpServer) DeviceDhcpServerDhcpServerV4Iter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&dhcpServerV4{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceDhcpServerDhcpServerV4Iter) Items() []DhcpServerV4 { + return obj.dhcpServerV4Slice +} + +func (obj *deviceDhcpServerDhcpServerV4Iter) Add() DhcpServerV4 { + newObj := &otg.DhcpServerV4{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &dhcpServerV4{obj: newObj} + newLibObj.setDefault() + obj.dhcpServerV4Slice = append(obj.dhcpServerV4Slice, newLibObj) + return newLibObj +} + +func (obj *deviceDhcpServerDhcpServerV4Iter) Append(items ...DhcpServerV4) DeviceDhcpServerDhcpServerV4Iter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.dhcpServerV4Slice = append(obj.dhcpServerV4Slice, item) + } + return obj +} + +func (obj *deviceDhcpServerDhcpServerV4Iter) Set(index int, newObj DhcpServerV4) DeviceDhcpServerDhcpServerV4Iter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.dhcpServerV4Slice[index] = newObj + return obj +} +func (obj *deviceDhcpServerDhcpServerV4Iter) Clear() DeviceDhcpServerDhcpServerV4Iter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.DhcpServerV4{} + obj.dhcpServerV4Slice = []DhcpServerV4{} + } + return obj +} +func (obj *deviceDhcpServerDhcpServerV4Iter) clearHolderSlice() DeviceDhcpServerDhcpServerV4Iter { + if len(obj.dhcpServerV4Slice) > 0 { + obj.dhcpServerV4Slice = []DhcpServerV4{} + } + return obj +} +func (obj *deviceDhcpServerDhcpServerV4Iter) appendHolderSlice(item DhcpServerV4) DeviceDhcpServerDhcpServerV4Iter { + obj.dhcpServerV4Slice = append(obj.dhcpServerV4Slice, item) + return obj +} + +func (obj *deviceDhcpServer) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Ipv4Interfaces) != 0 { + + if set_default { + obj.Ipv4Interfaces().clearHolderSlice() + for _, item := range obj.obj.Ipv4Interfaces { + obj.Ipv4Interfaces().appendHolderSlice(&dhcpServerV4{obj: item}) + } + } + for _, item := range obj.Ipv4Interfaces().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *deviceDhcpServer) setDefault() { + +} diff --git a/gosnappi/device_dhcpv4_client.go b/gosnappi/device_dhcpv4_client.go new file mode 100644 index 00000000..abbd0e75 --- /dev/null +++ b/gosnappi/device_dhcpv4_client.go @@ -0,0 +1,501 @@ +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" +) + +// ***** DeviceDhcpv4Client ***** +type deviceDhcpv4Client struct { + validation + obj *otg.DeviceDhcpv4Client + marshaller marshalDeviceDhcpv4Client + unMarshaller unMarshalDeviceDhcpv4Client + parametersRequestListHolder Dhcpv4ClientParams +} + +func NewDeviceDhcpv4Client() DeviceDhcpv4Client { + obj := deviceDhcpv4Client{obj: &otg.DeviceDhcpv4Client{}} + obj.setDefault() + return &obj +} + +func (obj *deviceDhcpv4Client) msg() *otg.DeviceDhcpv4Client { + return obj.obj +} + +func (obj *deviceDhcpv4Client) setMsg(msg *otg.DeviceDhcpv4Client) DeviceDhcpv4Client { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceDhcpv4Client struct { + obj *deviceDhcpv4Client +} + +type marshalDeviceDhcpv4Client interface { + // ToProto marshals DeviceDhcpv4Client to protobuf object *otg.DeviceDhcpv4Client + ToProto() (*otg.DeviceDhcpv4Client, error) + // ToPbText marshals DeviceDhcpv4Client to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceDhcpv4Client to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceDhcpv4Client to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceDhcpv4Client struct { + obj *deviceDhcpv4Client +} + +type unMarshalDeviceDhcpv4Client interface { + // FromProto unmarshals DeviceDhcpv4Client from protobuf object *otg.DeviceDhcpv4Client + FromProto(msg *otg.DeviceDhcpv4Client) (DeviceDhcpv4Client, error) + // FromPbText unmarshals DeviceDhcpv4Client from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceDhcpv4Client from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceDhcpv4Client from JSON text + FromJson(value string) error +} + +func (obj *deviceDhcpv4Client) Marshal() marshalDeviceDhcpv4Client { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceDhcpv4Client{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceDhcpv4Client) Unmarshal() unMarshalDeviceDhcpv4Client { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceDhcpv4Client{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceDhcpv4Client) ToProto() (*otg.DeviceDhcpv4Client, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceDhcpv4Client) FromProto(msg *otg.DeviceDhcpv4Client) (DeviceDhcpv4Client, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceDhcpv4Client) 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 *unMarshaldeviceDhcpv4Client) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshaldeviceDhcpv4Client) 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 *unMarshaldeviceDhcpv4Client) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshaldeviceDhcpv4Client) 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 *unMarshaldeviceDhcpv4Client) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *deviceDhcpv4Client) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceDhcpv4Client) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceDhcpv4Client) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceDhcpv4Client) Clone() (DeviceDhcpv4Client, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceDhcpv4Client() + 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 +} + +func (obj *deviceDhcpv4Client) setNil() { + obj.parametersRequestListHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// DeviceDhcpv4Client is configuration for emulated DHCPv4 Client on a single Interface. https://www.rfc-editor.org/rfc/rfc2131.html +type DeviceDhcpv4Client interface { + Validation + // msg marshals DeviceDhcpv4Client to protobuf object *otg.DeviceDhcpv4Client + // and doesn't set defaults + msg() *otg.DeviceDhcpv4Client + // setMsg unmarshals DeviceDhcpv4Client from protobuf object *otg.DeviceDhcpv4Client + // and doesn't set defaults + setMsg(*otg.DeviceDhcpv4Client) DeviceDhcpv4Client + // provides marshal interface + Marshal() marshalDeviceDhcpv4Client + // provides unmarshal interface + Unmarshal() unMarshalDeviceDhcpv4Client + // validate validates DeviceDhcpv4Client + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceDhcpv4Client, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in DeviceDhcpv4Client. + Name() string + // SetName assigns string provided by user to DeviceDhcpv4Client + SetName(value string) DeviceDhcpv4Client + // Choice returns DeviceDhcpv4ClientChoiceEnum, set in DeviceDhcpv4Client + Choice() DeviceDhcpv4ClientChoiceEnum + // setChoice assigns DeviceDhcpv4ClientChoiceEnum provided by user to DeviceDhcpv4Client + setChoice(value DeviceDhcpv4ClientChoiceEnum) DeviceDhcpv4Client + // HasChoice checks if Choice has been set in DeviceDhcpv4Client + HasChoice() bool + // getter for FirstServer to set choice. + FirstServer() + // ServerAddress returns string, set in DeviceDhcpv4Client. + ServerAddress() string + // SetServerAddress assigns string provided by user to DeviceDhcpv4Client + SetServerAddress(value string) DeviceDhcpv4Client + // HasServerAddress checks if ServerAddress has been set in DeviceDhcpv4Client + HasServerAddress() bool + // Broadcast returns bool, set in DeviceDhcpv4Client. + Broadcast() bool + // SetBroadcast assigns bool provided by user to DeviceDhcpv4Client + SetBroadcast(value bool) DeviceDhcpv4Client + // HasBroadcast checks if Broadcast has been set in DeviceDhcpv4Client + HasBroadcast() bool + // ParametersRequestList returns Dhcpv4ClientParams, set in DeviceDhcpv4Client. + // Dhcpv4ClientParams is configuration Parameter request list by emulated DHCPv4 Client. + ParametersRequestList() Dhcpv4ClientParams + // SetParametersRequestList assigns Dhcpv4ClientParams provided by user to DeviceDhcpv4Client. + // Dhcpv4ClientParams is configuration Parameter request list by emulated DHCPv4 Client. + SetParametersRequestList(value Dhcpv4ClientParams) DeviceDhcpv4Client + // HasParametersRequestList checks if ParametersRequestList has been set in DeviceDhcpv4Client + HasParametersRequestList() bool + setNil() +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *deviceDhcpv4Client) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the DeviceDhcpv4Client object +func (obj *deviceDhcpv4Client) SetName(value string) DeviceDhcpv4Client { + + obj.obj.Name = &value + return obj +} + +type DeviceDhcpv4ClientChoiceEnum string + +// Enum of Choice on DeviceDhcpv4Client +var DeviceDhcpv4ClientChoice = struct { + FIRST_SERVER DeviceDhcpv4ClientChoiceEnum + SERVER_ADDRESS DeviceDhcpv4ClientChoiceEnum +}{ + FIRST_SERVER: DeviceDhcpv4ClientChoiceEnum("first_server"), + SERVER_ADDRESS: DeviceDhcpv4ClientChoiceEnum("server_address"), +} + +func (obj *deviceDhcpv4Client) Choice() DeviceDhcpv4ClientChoiceEnum { + return DeviceDhcpv4ClientChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// getter for FirstServer to set choice +func (obj *deviceDhcpv4Client) FirstServer() { + obj.setChoice(DeviceDhcpv4ClientChoice.FIRST_SERVER) +} + +// The client receives one or more DHCPOFFER messages from one or more servers and client may choose to wait for multiple responses. +// The client chooses one server from which to request configuration +// parameters, based on the configuration parameters offered in the DHCPOFFER messages. +// - first_server: if selected, the subnet accepts the IP addresses offered by the first server to respond with an offer of IP addresses. +// - server_address: The address of the DHCP server from which the subnet will accept IP addresses. +// Choice returns a string +func (obj *deviceDhcpv4Client) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *deviceDhcpv4Client) setChoice(value DeviceDhcpv4ClientChoiceEnum) DeviceDhcpv4Client { + intValue, ok := otg.DeviceDhcpv4Client_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on DeviceDhcpv4ClientChoiceEnum", string(value))) + return obj + } + enumValue := otg.DeviceDhcpv4Client_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.ServerAddress = nil + return obj +} + +// The address of the DHCP server. +// ServerAddress returns a string +func (obj *deviceDhcpv4Client) ServerAddress() string { + + if obj.obj.ServerAddress == nil { + obj.setChoice(DeviceDhcpv4ClientChoice.SERVER_ADDRESS) + } + + return *obj.obj.ServerAddress + +} + +// The address of the DHCP server. +// ServerAddress returns a string +func (obj *deviceDhcpv4Client) HasServerAddress() bool { + return obj.obj.ServerAddress != nil +} + +// The address of the DHCP server. +// SetServerAddress sets the string value in the DeviceDhcpv4Client object +func (obj *deviceDhcpv4Client) SetServerAddress(value string) DeviceDhcpv4Client { + obj.setChoice(DeviceDhcpv4ClientChoice.SERVER_ADDRESS) + obj.obj.ServerAddress = &value + return obj +} + +// If the broadcast bit is set, then the server and relay agent broadcast DHCPOFFER and DHCPACK messages. +// Broadcast returns a bool +func (obj *deviceDhcpv4Client) Broadcast() bool { + + return *obj.obj.Broadcast + +} + +// If the broadcast bit is set, then the server and relay agent broadcast DHCPOFFER and DHCPACK messages. +// Broadcast returns a bool +func (obj *deviceDhcpv4Client) HasBroadcast() bool { + return obj.obj.Broadcast != nil +} + +// If the broadcast bit is set, then the server and relay agent broadcast DHCPOFFER and DHCPACK messages. +// SetBroadcast sets the bool value in the DeviceDhcpv4Client object +func (obj *deviceDhcpv4Client) SetBroadcast(value bool) DeviceDhcpv4Client { + + obj.obj.Broadcast = &value + return obj +} + +// Optional parameters field request list of DHCPv4 Client. +// ParametersRequestList returns a Dhcpv4ClientParams +func (obj *deviceDhcpv4Client) ParametersRequestList() Dhcpv4ClientParams { + if obj.obj.ParametersRequestList == nil { + obj.obj.ParametersRequestList = NewDhcpv4ClientParams().msg() + } + if obj.parametersRequestListHolder == nil { + obj.parametersRequestListHolder = &dhcpv4ClientParams{obj: obj.obj.ParametersRequestList} + } + return obj.parametersRequestListHolder +} + +// Optional parameters field request list of DHCPv4 Client. +// ParametersRequestList returns a Dhcpv4ClientParams +func (obj *deviceDhcpv4Client) HasParametersRequestList() bool { + return obj.obj.ParametersRequestList != nil +} + +// Optional parameters field request list of DHCPv4 Client. +// SetParametersRequestList sets the Dhcpv4ClientParams value in the DeviceDhcpv4Client object +func (obj *deviceDhcpv4Client) SetParametersRequestList(value Dhcpv4ClientParams) DeviceDhcpv4Client { + + obj.parametersRequestListHolder = nil + obj.obj.ParametersRequestList = value.msg() + + return obj +} + +func (obj *deviceDhcpv4Client) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceDhcpv4Client") + } + + if obj.obj.ServerAddress != nil { + + err := obj.validateIpv4(obj.ServerAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceDhcpv4Client.ServerAddress")) + } + + } + + if obj.obj.ParametersRequestList != nil { + + obj.ParametersRequestList().validateObj(vObj, set_default) + } + +} + +func (obj *deviceDhcpv4Client) setDefault() { + var choices_set int = 0 + var choice DeviceDhcpv4ClientChoiceEnum + + if obj.obj.ServerAddress != nil { + choices_set += 1 + choice = DeviceDhcpv4ClientChoice.SERVER_ADDRESS + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(DeviceDhcpv4ClientChoice.FIRST_SERVER) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in DeviceDhcpv4Client") + } + } else { + intVal := otg.DeviceDhcpv4Client_Choice_Enum_value[string(choice)] + enumValue := otg.DeviceDhcpv4Client_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + + if obj.obj.Broadcast == nil { + obj.SetBroadcast(false) + } + +} diff --git a/gosnappi/device_ethernet.go b/gosnappi/device_ethernet.go new file mode 100644 index 00000000..85380055 --- /dev/null +++ b/gosnappi/device_ethernet.go @@ -0,0 +1,848 @@ +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" +) + +// ***** DeviceEthernet ***** +type deviceEthernet struct { + validation + obj *otg.DeviceEthernet + marshaller marshalDeviceEthernet + unMarshaller unMarshalDeviceEthernet + connectionHolder EthernetConnection + ipv4AddressesHolder DeviceEthernetDeviceIpv4Iter + ipv6AddressesHolder DeviceEthernetDeviceIpv6Iter + vlansHolder DeviceEthernetDeviceVlanIter + dhcpv4InterfacesHolder DeviceEthernetDeviceDhcpv4ClientIter +} + +func NewDeviceEthernet() DeviceEthernet { + obj := deviceEthernet{obj: &otg.DeviceEthernet{}} + obj.setDefault() + return &obj +} + +func (obj *deviceEthernet) msg() *otg.DeviceEthernet { + return obj.obj +} + +func (obj *deviceEthernet) setMsg(msg *otg.DeviceEthernet) DeviceEthernet { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceEthernet struct { + obj *deviceEthernet +} + +type marshalDeviceEthernet interface { + // ToProto marshals DeviceEthernet to protobuf object *otg.DeviceEthernet + ToProto() (*otg.DeviceEthernet, error) + // ToPbText marshals DeviceEthernet to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceEthernet to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceEthernet to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceEthernet struct { + obj *deviceEthernet +} + +type unMarshalDeviceEthernet interface { + // FromProto unmarshals DeviceEthernet from protobuf object *otg.DeviceEthernet + FromProto(msg *otg.DeviceEthernet) (DeviceEthernet, error) + // FromPbText unmarshals DeviceEthernet from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceEthernet from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceEthernet from JSON text + FromJson(value string) error +} + +func (obj *deviceEthernet) Marshal() marshalDeviceEthernet { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceEthernet{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceEthernet) Unmarshal() unMarshalDeviceEthernet { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceEthernet{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceEthernet) ToProto() (*otg.DeviceEthernet, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceEthernet) FromProto(msg *otg.DeviceEthernet) (DeviceEthernet, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceEthernet) 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 *unMarshaldeviceEthernet) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshaldeviceEthernet) 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 *unMarshaldeviceEthernet) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshaldeviceEthernet) 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 *unMarshaldeviceEthernet) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *deviceEthernet) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceEthernet) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceEthernet) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceEthernet) Clone() (DeviceEthernet, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceEthernet() + 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 +} + +func (obj *deviceEthernet) setNil() { + obj.connectionHolder = nil + obj.ipv4AddressesHolder = nil + obj.ipv6AddressesHolder = nil + obj.vlansHolder = nil + obj.dhcpv4InterfacesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// DeviceEthernet is an Ethernet interface with IPv4 and IPv6 addresses. +type DeviceEthernet interface { + Validation + // msg marshals DeviceEthernet to protobuf object *otg.DeviceEthernet + // and doesn't set defaults + msg() *otg.DeviceEthernet + // setMsg unmarshals DeviceEthernet from protobuf object *otg.DeviceEthernet + // and doesn't set defaults + setMsg(*otg.DeviceEthernet) DeviceEthernet + // provides marshal interface + Marshal() marshalDeviceEthernet + // provides unmarshal interface + Unmarshal() unMarshalDeviceEthernet + // validate validates DeviceEthernet + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceEthernet, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Connection returns EthernetConnection, set in DeviceEthernet. + // EthernetConnection is ethernet interface connection to a port, LAG or VXLAN tunnel. + Connection() EthernetConnection + // SetConnection assigns EthernetConnection provided by user to DeviceEthernet. + // EthernetConnection is ethernet interface connection to a port, LAG or VXLAN tunnel. + SetConnection(value EthernetConnection) DeviceEthernet + // HasConnection checks if Connection has been set in DeviceEthernet + HasConnection() bool + // Ipv4Addresses returns DeviceEthernetDeviceIpv4IterIter, set in DeviceEthernet + Ipv4Addresses() DeviceEthernetDeviceIpv4Iter + // Ipv6Addresses returns DeviceEthernetDeviceIpv6IterIter, set in DeviceEthernet + Ipv6Addresses() DeviceEthernetDeviceIpv6Iter + // Mac returns string, set in DeviceEthernet. + Mac() string + // SetMac assigns string provided by user to DeviceEthernet + SetMac(value string) DeviceEthernet + // Mtu returns uint32, set in DeviceEthernet. + Mtu() uint32 + // SetMtu assigns uint32 provided by user to DeviceEthernet + SetMtu(value uint32) DeviceEthernet + // HasMtu checks if Mtu has been set in DeviceEthernet + HasMtu() bool + // Vlans returns DeviceEthernetDeviceVlanIterIter, set in DeviceEthernet + Vlans() DeviceEthernetDeviceVlanIter + // Name returns string, set in DeviceEthernet. + Name() string + // SetName assigns string provided by user to DeviceEthernet + SetName(value string) DeviceEthernet + // Dhcpv4Interfaces returns DeviceEthernetDeviceDhcpv4ClientIterIter, set in DeviceEthernet + Dhcpv4Interfaces() DeviceEthernetDeviceDhcpv4ClientIter + setNil() +} + +// Device connection to physical, LAG or another device. +// Connection returns a EthernetConnection +func (obj *deviceEthernet) Connection() EthernetConnection { + if obj.obj.Connection == nil { + obj.obj.Connection = NewEthernetConnection().msg() + } + if obj.connectionHolder == nil { + obj.connectionHolder = ðernetConnection{obj: obj.obj.Connection} + } + return obj.connectionHolder +} + +// Device connection to physical, LAG or another device. +// Connection returns a EthernetConnection +func (obj *deviceEthernet) HasConnection() bool { + return obj.obj.Connection != nil +} + +// Device connection to physical, LAG or another device. +// SetConnection sets the EthernetConnection value in the DeviceEthernet object +func (obj *deviceEthernet) SetConnection(value EthernetConnection) DeviceEthernet { + + obj.connectionHolder = nil + obj.obj.Connection = value.msg() + + return obj +} + +// List of IPv4 addresses and their gateways. +// Ipv4Addresses returns a []DeviceIpv4 +func (obj *deviceEthernet) Ipv4Addresses() DeviceEthernetDeviceIpv4Iter { + if len(obj.obj.Ipv4Addresses) == 0 { + obj.obj.Ipv4Addresses = []*otg.DeviceIpv4{} + } + if obj.ipv4AddressesHolder == nil { + obj.ipv4AddressesHolder = newDeviceEthernetDeviceIpv4Iter(&obj.obj.Ipv4Addresses).setMsg(obj) + } + return obj.ipv4AddressesHolder +} + +type deviceEthernetDeviceIpv4Iter struct { + obj *deviceEthernet + deviceIpv4Slice []DeviceIpv4 + fieldPtr *[]*otg.DeviceIpv4 +} + +func newDeviceEthernetDeviceIpv4Iter(ptr *[]*otg.DeviceIpv4) DeviceEthernetDeviceIpv4Iter { + return &deviceEthernetDeviceIpv4Iter{fieldPtr: ptr} +} + +type DeviceEthernetDeviceIpv4Iter interface { + setMsg(*deviceEthernet) DeviceEthernetDeviceIpv4Iter + Items() []DeviceIpv4 + Add() DeviceIpv4 + Append(items ...DeviceIpv4) DeviceEthernetDeviceIpv4Iter + Set(index int, newObj DeviceIpv4) DeviceEthernetDeviceIpv4Iter + Clear() DeviceEthernetDeviceIpv4Iter + clearHolderSlice() DeviceEthernetDeviceIpv4Iter + appendHolderSlice(item DeviceIpv4) DeviceEthernetDeviceIpv4Iter +} + +func (obj *deviceEthernetDeviceIpv4Iter) setMsg(msg *deviceEthernet) DeviceEthernetDeviceIpv4Iter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&deviceIpv4{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceEthernetDeviceIpv4Iter) Items() []DeviceIpv4 { + return obj.deviceIpv4Slice +} + +func (obj *deviceEthernetDeviceIpv4Iter) Add() DeviceIpv4 { + newObj := &otg.DeviceIpv4{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &deviceIpv4{obj: newObj} + newLibObj.setDefault() + obj.deviceIpv4Slice = append(obj.deviceIpv4Slice, newLibObj) + return newLibObj +} + +func (obj *deviceEthernetDeviceIpv4Iter) Append(items ...DeviceIpv4) DeviceEthernetDeviceIpv4Iter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.deviceIpv4Slice = append(obj.deviceIpv4Slice, item) + } + return obj +} + +func (obj *deviceEthernetDeviceIpv4Iter) Set(index int, newObj DeviceIpv4) DeviceEthernetDeviceIpv4Iter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.deviceIpv4Slice[index] = newObj + return obj +} +func (obj *deviceEthernetDeviceIpv4Iter) Clear() DeviceEthernetDeviceIpv4Iter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.DeviceIpv4{} + obj.deviceIpv4Slice = []DeviceIpv4{} + } + return obj +} +func (obj *deviceEthernetDeviceIpv4Iter) clearHolderSlice() DeviceEthernetDeviceIpv4Iter { + if len(obj.deviceIpv4Slice) > 0 { + obj.deviceIpv4Slice = []DeviceIpv4{} + } + return obj +} +func (obj *deviceEthernetDeviceIpv4Iter) appendHolderSlice(item DeviceIpv4) DeviceEthernetDeviceIpv4Iter { + obj.deviceIpv4Slice = append(obj.deviceIpv4Slice, item) + return obj +} + +// List of global IPv6 addresses and their gateways. +// The Link Local IPv6 address will be automatically generated. +// Ipv6Addresses returns a []DeviceIpv6 +func (obj *deviceEthernet) Ipv6Addresses() DeviceEthernetDeviceIpv6Iter { + if len(obj.obj.Ipv6Addresses) == 0 { + obj.obj.Ipv6Addresses = []*otg.DeviceIpv6{} + } + if obj.ipv6AddressesHolder == nil { + obj.ipv6AddressesHolder = newDeviceEthernetDeviceIpv6Iter(&obj.obj.Ipv6Addresses).setMsg(obj) + } + return obj.ipv6AddressesHolder +} + +type deviceEthernetDeviceIpv6Iter struct { + obj *deviceEthernet + deviceIpv6Slice []DeviceIpv6 + fieldPtr *[]*otg.DeviceIpv6 +} + +func newDeviceEthernetDeviceIpv6Iter(ptr *[]*otg.DeviceIpv6) DeviceEthernetDeviceIpv6Iter { + return &deviceEthernetDeviceIpv6Iter{fieldPtr: ptr} +} + +type DeviceEthernetDeviceIpv6Iter interface { + setMsg(*deviceEthernet) DeviceEthernetDeviceIpv6Iter + Items() []DeviceIpv6 + Add() DeviceIpv6 + Append(items ...DeviceIpv6) DeviceEthernetDeviceIpv6Iter + Set(index int, newObj DeviceIpv6) DeviceEthernetDeviceIpv6Iter + Clear() DeviceEthernetDeviceIpv6Iter + clearHolderSlice() DeviceEthernetDeviceIpv6Iter + appendHolderSlice(item DeviceIpv6) DeviceEthernetDeviceIpv6Iter +} + +func (obj *deviceEthernetDeviceIpv6Iter) setMsg(msg *deviceEthernet) DeviceEthernetDeviceIpv6Iter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&deviceIpv6{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceEthernetDeviceIpv6Iter) Items() []DeviceIpv6 { + return obj.deviceIpv6Slice +} + +func (obj *deviceEthernetDeviceIpv6Iter) Add() DeviceIpv6 { + newObj := &otg.DeviceIpv6{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &deviceIpv6{obj: newObj} + newLibObj.setDefault() + obj.deviceIpv6Slice = append(obj.deviceIpv6Slice, newLibObj) + return newLibObj +} + +func (obj *deviceEthernetDeviceIpv6Iter) Append(items ...DeviceIpv6) DeviceEthernetDeviceIpv6Iter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.deviceIpv6Slice = append(obj.deviceIpv6Slice, item) + } + return obj +} + +func (obj *deviceEthernetDeviceIpv6Iter) Set(index int, newObj DeviceIpv6) DeviceEthernetDeviceIpv6Iter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.deviceIpv6Slice[index] = newObj + return obj +} +func (obj *deviceEthernetDeviceIpv6Iter) Clear() DeviceEthernetDeviceIpv6Iter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.DeviceIpv6{} + obj.deviceIpv6Slice = []DeviceIpv6{} + } + return obj +} +func (obj *deviceEthernetDeviceIpv6Iter) clearHolderSlice() DeviceEthernetDeviceIpv6Iter { + if len(obj.deviceIpv6Slice) > 0 { + obj.deviceIpv6Slice = []DeviceIpv6{} + } + return obj +} +func (obj *deviceEthernetDeviceIpv6Iter) appendHolderSlice(item DeviceIpv6) DeviceEthernetDeviceIpv6Iter { + obj.deviceIpv6Slice = append(obj.deviceIpv6Slice, item) + return obj +} + +// Media Access Control address. +// Mac returns a string +func (obj *deviceEthernet) Mac() string { + + return *obj.obj.Mac + +} + +// Media Access Control address. +// SetMac sets the string value in the DeviceEthernet object +func (obj *deviceEthernet) SetMac(value string) DeviceEthernet { + + obj.obj.Mac = &value + return obj +} + +// Maximum Transmission Unit. +// Mtu returns a uint32 +func (obj *deviceEthernet) Mtu() uint32 { + + return *obj.obj.Mtu + +} + +// Maximum Transmission Unit. +// Mtu returns a uint32 +func (obj *deviceEthernet) HasMtu() bool { + return obj.obj.Mtu != nil +} + +// Maximum Transmission Unit. +// SetMtu sets the uint32 value in the DeviceEthernet object +func (obj *deviceEthernet) SetMtu(value uint32) DeviceEthernet { + + obj.obj.Mtu = &value + return obj +} + +// List of VLANs +// Vlans returns a []DeviceVlan +func (obj *deviceEthernet) Vlans() DeviceEthernetDeviceVlanIter { + if len(obj.obj.Vlans) == 0 { + obj.obj.Vlans = []*otg.DeviceVlan{} + } + if obj.vlansHolder == nil { + obj.vlansHolder = newDeviceEthernetDeviceVlanIter(&obj.obj.Vlans).setMsg(obj) + } + return obj.vlansHolder +} + +type deviceEthernetDeviceVlanIter struct { + obj *deviceEthernet + deviceVlanSlice []DeviceVlan + fieldPtr *[]*otg.DeviceVlan +} + +func newDeviceEthernetDeviceVlanIter(ptr *[]*otg.DeviceVlan) DeviceEthernetDeviceVlanIter { + return &deviceEthernetDeviceVlanIter{fieldPtr: ptr} +} + +type DeviceEthernetDeviceVlanIter interface { + setMsg(*deviceEthernet) DeviceEthernetDeviceVlanIter + Items() []DeviceVlan + Add() DeviceVlan + Append(items ...DeviceVlan) DeviceEthernetDeviceVlanIter + Set(index int, newObj DeviceVlan) DeviceEthernetDeviceVlanIter + Clear() DeviceEthernetDeviceVlanIter + clearHolderSlice() DeviceEthernetDeviceVlanIter + appendHolderSlice(item DeviceVlan) DeviceEthernetDeviceVlanIter +} + +func (obj *deviceEthernetDeviceVlanIter) setMsg(msg *deviceEthernet) DeviceEthernetDeviceVlanIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&deviceVlan{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceEthernetDeviceVlanIter) Items() []DeviceVlan { + return obj.deviceVlanSlice +} + +func (obj *deviceEthernetDeviceVlanIter) Add() DeviceVlan { + newObj := &otg.DeviceVlan{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &deviceVlan{obj: newObj} + newLibObj.setDefault() + obj.deviceVlanSlice = append(obj.deviceVlanSlice, newLibObj) + return newLibObj +} + +func (obj *deviceEthernetDeviceVlanIter) Append(items ...DeviceVlan) DeviceEthernetDeviceVlanIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.deviceVlanSlice = append(obj.deviceVlanSlice, item) + } + return obj +} + +func (obj *deviceEthernetDeviceVlanIter) Set(index int, newObj DeviceVlan) DeviceEthernetDeviceVlanIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.deviceVlanSlice[index] = newObj + return obj +} +func (obj *deviceEthernetDeviceVlanIter) Clear() DeviceEthernetDeviceVlanIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.DeviceVlan{} + obj.deviceVlanSlice = []DeviceVlan{} + } + return obj +} +func (obj *deviceEthernetDeviceVlanIter) clearHolderSlice() DeviceEthernetDeviceVlanIter { + if len(obj.deviceVlanSlice) > 0 { + obj.deviceVlanSlice = []DeviceVlan{} + } + return obj +} +func (obj *deviceEthernetDeviceVlanIter) appendHolderSlice(item DeviceVlan) DeviceEthernetDeviceVlanIter { + obj.deviceVlanSlice = append(obj.deviceVlanSlice, item) + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *deviceEthernet) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the DeviceEthernet object +func (obj *deviceEthernet) SetName(value string) DeviceEthernet { + + obj.obj.Name = &value + return obj +} + +// List of DHCPv4 Clients Configuration. +// Dhcpv4Interfaces returns a []DeviceDhcpv4Client +func (obj *deviceEthernet) Dhcpv4Interfaces() DeviceEthernetDeviceDhcpv4ClientIter { + if len(obj.obj.Dhcpv4Interfaces) == 0 { + obj.obj.Dhcpv4Interfaces = []*otg.DeviceDhcpv4Client{} + } + if obj.dhcpv4InterfacesHolder == nil { + obj.dhcpv4InterfacesHolder = newDeviceEthernetDeviceDhcpv4ClientIter(&obj.obj.Dhcpv4Interfaces).setMsg(obj) + } + return obj.dhcpv4InterfacesHolder +} + +type deviceEthernetDeviceDhcpv4ClientIter struct { + obj *deviceEthernet + deviceDhcpv4ClientSlice []DeviceDhcpv4Client + fieldPtr *[]*otg.DeviceDhcpv4Client +} + +func newDeviceEthernetDeviceDhcpv4ClientIter(ptr *[]*otg.DeviceDhcpv4Client) DeviceEthernetDeviceDhcpv4ClientIter { + return &deviceEthernetDeviceDhcpv4ClientIter{fieldPtr: ptr} +} + +type DeviceEthernetDeviceDhcpv4ClientIter interface { + setMsg(*deviceEthernet) DeviceEthernetDeviceDhcpv4ClientIter + Items() []DeviceDhcpv4Client + Add() DeviceDhcpv4Client + Append(items ...DeviceDhcpv4Client) DeviceEthernetDeviceDhcpv4ClientIter + Set(index int, newObj DeviceDhcpv4Client) DeviceEthernetDeviceDhcpv4ClientIter + Clear() DeviceEthernetDeviceDhcpv4ClientIter + clearHolderSlice() DeviceEthernetDeviceDhcpv4ClientIter + appendHolderSlice(item DeviceDhcpv4Client) DeviceEthernetDeviceDhcpv4ClientIter +} + +func (obj *deviceEthernetDeviceDhcpv4ClientIter) setMsg(msg *deviceEthernet) DeviceEthernetDeviceDhcpv4ClientIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&deviceDhcpv4Client{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceEthernetDeviceDhcpv4ClientIter) Items() []DeviceDhcpv4Client { + return obj.deviceDhcpv4ClientSlice +} + +func (obj *deviceEthernetDeviceDhcpv4ClientIter) Add() DeviceDhcpv4Client { + newObj := &otg.DeviceDhcpv4Client{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &deviceDhcpv4Client{obj: newObj} + newLibObj.setDefault() + obj.deviceDhcpv4ClientSlice = append(obj.deviceDhcpv4ClientSlice, newLibObj) + return newLibObj +} + +func (obj *deviceEthernetDeviceDhcpv4ClientIter) Append(items ...DeviceDhcpv4Client) DeviceEthernetDeviceDhcpv4ClientIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.deviceDhcpv4ClientSlice = append(obj.deviceDhcpv4ClientSlice, item) + } + return obj +} + +func (obj *deviceEthernetDeviceDhcpv4ClientIter) Set(index int, newObj DeviceDhcpv4Client) DeviceEthernetDeviceDhcpv4ClientIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.deviceDhcpv4ClientSlice[index] = newObj + return obj +} +func (obj *deviceEthernetDeviceDhcpv4ClientIter) Clear() DeviceEthernetDeviceDhcpv4ClientIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.DeviceDhcpv4Client{} + obj.deviceDhcpv4ClientSlice = []DeviceDhcpv4Client{} + } + return obj +} +func (obj *deviceEthernetDeviceDhcpv4ClientIter) clearHolderSlice() DeviceEthernetDeviceDhcpv4ClientIter { + if len(obj.deviceDhcpv4ClientSlice) > 0 { + obj.deviceDhcpv4ClientSlice = []DeviceDhcpv4Client{} + } + return obj +} +func (obj *deviceEthernetDeviceDhcpv4ClientIter) appendHolderSlice(item DeviceDhcpv4Client) DeviceEthernetDeviceDhcpv4ClientIter { + obj.deviceDhcpv4ClientSlice = append(obj.deviceDhcpv4ClientSlice, item) + return obj +} + +func (obj *deviceEthernet) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Connection != nil { + + obj.Connection().validateObj(vObj, set_default) + } + + if len(obj.obj.Ipv4Addresses) != 0 { + + if set_default { + obj.Ipv4Addresses().clearHolderSlice() + for _, item := range obj.obj.Ipv4Addresses { + obj.Ipv4Addresses().appendHolderSlice(&deviceIpv4{obj: item}) + } + } + for _, item := range obj.Ipv4Addresses().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Ipv6Addresses) != 0 { + + if set_default { + obj.Ipv6Addresses().clearHolderSlice() + for _, item := range obj.obj.Ipv6Addresses { + obj.Ipv6Addresses().appendHolderSlice(&deviceIpv6{obj: item}) + } + } + for _, item := range obj.Ipv6Addresses().Items() { + item.validateObj(vObj, set_default) + } + + } + + // Mac is required + if obj.obj.Mac == nil { + vObj.validationErrors = append(vObj.validationErrors, "Mac is required field on interface DeviceEthernet") + } + if obj.obj.Mac != nil { + + err := obj.validateMac(obj.Mac()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceEthernet.Mac")) + } + + } + + if obj.obj.Mtu != nil { + + if *obj.obj.Mtu > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= DeviceEthernet.Mtu <= 65535 but Got %d", *obj.obj.Mtu)) + } + + } + + if len(obj.obj.Vlans) != 0 { + + if set_default { + obj.Vlans().clearHolderSlice() + for _, item := range obj.obj.Vlans { + obj.Vlans().appendHolderSlice(&deviceVlan{obj: item}) + } + } + for _, item := range obj.Vlans().Items() { + item.validateObj(vObj, set_default) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceEthernet") + } + + if len(obj.obj.Dhcpv4Interfaces) != 0 { + + if set_default { + obj.Dhcpv4Interfaces().clearHolderSlice() + for _, item := range obj.obj.Dhcpv4Interfaces { + obj.Dhcpv4Interfaces().appendHolderSlice(&deviceDhcpv4Client{obj: item}) + } + } + for _, item := range obj.Dhcpv4Interfaces().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *deviceEthernet) setDefault() { + if obj.obj.Mtu == nil { + obj.SetMtu(1500) + } + +} diff --git a/gosnappi/device_ethernet_base.go b/gosnappi/device_ethernet_base.go new file mode 100644 index 00000000..8541e010 --- /dev/null +++ b/gosnappi/device_ethernet_base.go @@ -0,0 +1,488 @@ +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" +) + +// ***** DeviceEthernetBase ***** +type deviceEthernetBase struct { + validation + obj *otg.DeviceEthernetBase + marshaller marshalDeviceEthernetBase + unMarshaller unMarshalDeviceEthernetBase + vlansHolder DeviceEthernetBaseDeviceVlanIter +} + +func NewDeviceEthernetBase() DeviceEthernetBase { + obj := deviceEthernetBase{obj: &otg.DeviceEthernetBase{}} + obj.setDefault() + return &obj +} + +func (obj *deviceEthernetBase) msg() *otg.DeviceEthernetBase { + return obj.obj +} + +func (obj *deviceEthernetBase) setMsg(msg *otg.DeviceEthernetBase) DeviceEthernetBase { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceEthernetBase struct { + obj *deviceEthernetBase +} + +type marshalDeviceEthernetBase interface { + // ToProto marshals DeviceEthernetBase to protobuf object *otg.DeviceEthernetBase + ToProto() (*otg.DeviceEthernetBase, error) + // ToPbText marshals DeviceEthernetBase to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceEthernetBase to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceEthernetBase to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceEthernetBase struct { + obj *deviceEthernetBase +} + +type unMarshalDeviceEthernetBase interface { + // FromProto unmarshals DeviceEthernetBase from protobuf object *otg.DeviceEthernetBase + FromProto(msg *otg.DeviceEthernetBase) (DeviceEthernetBase, error) + // FromPbText unmarshals DeviceEthernetBase from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceEthernetBase from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceEthernetBase from JSON text + FromJson(value string) error +} + +func (obj *deviceEthernetBase) Marshal() marshalDeviceEthernetBase { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceEthernetBase{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceEthernetBase) Unmarshal() unMarshalDeviceEthernetBase { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceEthernetBase{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceEthernetBase) ToProto() (*otg.DeviceEthernetBase, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceEthernetBase) FromProto(msg *otg.DeviceEthernetBase) (DeviceEthernetBase, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceEthernetBase) 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 *unMarshaldeviceEthernetBase) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshaldeviceEthernetBase) 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 *unMarshaldeviceEthernetBase) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshaldeviceEthernetBase) 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 *unMarshaldeviceEthernetBase) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *deviceEthernetBase) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceEthernetBase) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceEthernetBase) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceEthernetBase) Clone() (DeviceEthernetBase, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceEthernetBase() + 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 +} + +func (obj *deviceEthernetBase) setNil() { + obj.vlansHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// DeviceEthernetBase is base Ethernet interface. +type DeviceEthernetBase interface { + Validation + // msg marshals DeviceEthernetBase to protobuf object *otg.DeviceEthernetBase + // and doesn't set defaults + msg() *otg.DeviceEthernetBase + // setMsg unmarshals DeviceEthernetBase from protobuf object *otg.DeviceEthernetBase + // and doesn't set defaults + setMsg(*otg.DeviceEthernetBase) DeviceEthernetBase + // provides marshal interface + Marshal() marshalDeviceEthernetBase + // provides unmarshal interface + Unmarshal() unMarshalDeviceEthernetBase + // validate validates DeviceEthernetBase + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceEthernetBase, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Mac returns string, set in DeviceEthernetBase. + Mac() string + // SetMac assigns string provided by user to DeviceEthernetBase + SetMac(value string) DeviceEthernetBase + // Mtu returns uint32, set in DeviceEthernetBase. + Mtu() uint32 + // SetMtu assigns uint32 provided by user to DeviceEthernetBase + SetMtu(value uint32) DeviceEthernetBase + // HasMtu checks if Mtu has been set in DeviceEthernetBase + HasMtu() bool + // Vlans returns DeviceEthernetBaseDeviceVlanIterIter, set in DeviceEthernetBase + Vlans() DeviceEthernetBaseDeviceVlanIter + // Name returns string, set in DeviceEthernetBase. + Name() string + // SetName assigns string provided by user to DeviceEthernetBase + SetName(value string) DeviceEthernetBase + setNil() +} + +// Media Access Control address. +// Mac returns a string +func (obj *deviceEthernetBase) Mac() string { + + return *obj.obj.Mac + +} + +// Media Access Control address. +// SetMac sets the string value in the DeviceEthernetBase object +func (obj *deviceEthernetBase) SetMac(value string) DeviceEthernetBase { + + obj.obj.Mac = &value + return obj +} + +// Maximum Transmission Unit. +// Mtu returns a uint32 +func (obj *deviceEthernetBase) Mtu() uint32 { + + return *obj.obj.Mtu + +} + +// Maximum Transmission Unit. +// Mtu returns a uint32 +func (obj *deviceEthernetBase) HasMtu() bool { + return obj.obj.Mtu != nil +} + +// Maximum Transmission Unit. +// SetMtu sets the uint32 value in the DeviceEthernetBase object +func (obj *deviceEthernetBase) SetMtu(value uint32) DeviceEthernetBase { + + obj.obj.Mtu = &value + return obj +} + +// List of VLANs +// Vlans returns a []DeviceVlan +func (obj *deviceEthernetBase) Vlans() DeviceEthernetBaseDeviceVlanIter { + if len(obj.obj.Vlans) == 0 { + obj.obj.Vlans = []*otg.DeviceVlan{} + } + if obj.vlansHolder == nil { + obj.vlansHolder = newDeviceEthernetBaseDeviceVlanIter(&obj.obj.Vlans).setMsg(obj) + } + return obj.vlansHolder +} + +type deviceEthernetBaseDeviceVlanIter struct { + obj *deviceEthernetBase + deviceVlanSlice []DeviceVlan + fieldPtr *[]*otg.DeviceVlan +} + +func newDeviceEthernetBaseDeviceVlanIter(ptr *[]*otg.DeviceVlan) DeviceEthernetBaseDeviceVlanIter { + return &deviceEthernetBaseDeviceVlanIter{fieldPtr: ptr} +} + +type DeviceEthernetBaseDeviceVlanIter interface { + setMsg(*deviceEthernetBase) DeviceEthernetBaseDeviceVlanIter + Items() []DeviceVlan + Add() DeviceVlan + Append(items ...DeviceVlan) DeviceEthernetBaseDeviceVlanIter + Set(index int, newObj DeviceVlan) DeviceEthernetBaseDeviceVlanIter + Clear() DeviceEthernetBaseDeviceVlanIter + clearHolderSlice() DeviceEthernetBaseDeviceVlanIter + appendHolderSlice(item DeviceVlan) DeviceEthernetBaseDeviceVlanIter +} + +func (obj *deviceEthernetBaseDeviceVlanIter) setMsg(msg *deviceEthernetBase) DeviceEthernetBaseDeviceVlanIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&deviceVlan{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceEthernetBaseDeviceVlanIter) Items() []DeviceVlan { + return obj.deviceVlanSlice +} + +func (obj *deviceEthernetBaseDeviceVlanIter) Add() DeviceVlan { + newObj := &otg.DeviceVlan{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &deviceVlan{obj: newObj} + newLibObj.setDefault() + obj.deviceVlanSlice = append(obj.deviceVlanSlice, newLibObj) + return newLibObj +} + +func (obj *deviceEthernetBaseDeviceVlanIter) Append(items ...DeviceVlan) DeviceEthernetBaseDeviceVlanIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.deviceVlanSlice = append(obj.deviceVlanSlice, item) + } + return obj +} + +func (obj *deviceEthernetBaseDeviceVlanIter) Set(index int, newObj DeviceVlan) DeviceEthernetBaseDeviceVlanIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.deviceVlanSlice[index] = newObj + return obj +} +func (obj *deviceEthernetBaseDeviceVlanIter) Clear() DeviceEthernetBaseDeviceVlanIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.DeviceVlan{} + obj.deviceVlanSlice = []DeviceVlan{} + } + return obj +} +func (obj *deviceEthernetBaseDeviceVlanIter) clearHolderSlice() DeviceEthernetBaseDeviceVlanIter { + if len(obj.deviceVlanSlice) > 0 { + obj.deviceVlanSlice = []DeviceVlan{} + } + return obj +} +func (obj *deviceEthernetBaseDeviceVlanIter) appendHolderSlice(item DeviceVlan) DeviceEthernetBaseDeviceVlanIter { + obj.deviceVlanSlice = append(obj.deviceVlanSlice, item) + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *deviceEthernetBase) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the DeviceEthernetBase object +func (obj *deviceEthernetBase) SetName(value string) DeviceEthernetBase { + + obj.obj.Name = &value + return obj +} + +func (obj *deviceEthernetBase) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Mac is required + if obj.obj.Mac == nil { + vObj.validationErrors = append(vObj.validationErrors, "Mac is required field on interface DeviceEthernetBase") + } + if obj.obj.Mac != nil { + + err := obj.validateMac(obj.Mac()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceEthernetBase.Mac")) + } + + } + + if obj.obj.Mtu != nil { + + if *obj.obj.Mtu > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= DeviceEthernetBase.Mtu <= 65535 but Got %d", *obj.obj.Mtu)) + } + + } + + if len(obj.obj.Vlans) != 0 { + + if set_default { + obj.Vlans().clearHolderSlice() + for _, item := range obj.obj.Vlans { + obj.Vlans().appendHolderSlice(&deviceVlan{obj: item}) + } + } + for _, item := range obj.Vlans().Items() { + item.validateObj(vObj, set_default) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceEthernetBase") + } +} + +func (obj *deviceEthernetBase) setDefault() { + if obj.obj.Mtu == nil { + obj.SetMtu(1500) + } + +} diff --git a/gosnappi/device_ipv4.go b/gosnappi/device_ipv4.go new file mode 100644 index 00000000..8759c3c5 --- /dev/null +++ b/gosnappi/device_ipv4.go @@ -0,0 +1,463 @@ +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" +) + +// ***** DeviceIpv4 ***** +type deviceIpv4 struct { + validation + obj *otg.DeviceIpv4 + marshaller marshalDeviceIpv4 + unMarshaller unMarshalDeviceIpv4 + gatewayMacHolder DeviceIpv4GatewayMAC +} + +func NewDeviceIpv4() DeviceIpv4 { + obj := deviceIpv4{obj: &otg.DeviceIpv4{}} + obj.setDefault() + return &obj +} + +func (obj *deviceIpv4) msg() *otg.DeviceIpv4 { + return obj.obj +} + +func (obj *deviceIpv4) setMsg(msg *otg.DeviceIpv4) DeviceIpv4 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceIpv4 struct { + obj *deviceIpv4 +} + +type marshalDeviceIpv4 interface { + // ToProto marshals DeviceIpv4 to protobuf object *otg.DeviceIpv4 + ToProto() (*otg.DeviceIpv4, error) + // ToPbText marshals DeviceIpv4 to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceIpv4 to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceIpv4 to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceIpv4 struct { + obj *deviceIpv4 +} + +type unMarshalDeviceIpv4 interface { + // FromProto unmarshals DeviceIpv4 from protobuf object *otg.DeviceIpv4 + FromProto(msg *otg.DeviceIpv4) (DeviceIpv4, error) + // FromPbText unmarshals DeviceIpv4 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceIpv4 from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceIpv4 from JSON text + FromJson(value string) error +} + +func (obj *deviceIpv4) Marshal() marshalDeviceIpv4 { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceIpv4{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceIpv4) Unmarshal() unMarshalDeviceIpv4 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceIpv4{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceIpv4) ToProto() (*otg.DeviceIpv4, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceIpv4) FromProto(msg *otg.DeviceIpv4) (DeviceIpv4, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceIpv4) 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 *unMarshaldeviceIpv4) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshaldeviceIpv4) 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 *unMarshaldeviceIpv4) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshaldeviceIpv4) 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 *unMarshaldeviceIpv4) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *deviceIpv4) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceIpv4) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceIpv4) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceIpv4) Clone() (DeviceIpv4, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceIpv4() + 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 +} + +func (obj *deviceIpv4) setNil() { + obj.gatewayMacHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// DeviceIpv4 is an IPv4 interface with gateway +type DeviceIpv4 interface { + Validation + // msg marshals DeviceIpv4 to protobuf object *otg.DeviceIpv4 + // and doesn't set defaults + msg() *otg.DeviceIpv4 + // setMsg unmarshals DeviceIpv4 from protobuf object *otg.DeviceIpv4 + // and doesn't set defaults + setMsg(*otg.DeviceIpv4) DeviceIpv4 + // provides marshal interface + Marshal() marshalDeviceIpv4 + // provides unmarshal interface + Unmarshal() unMarshalDeviceIpv4 + // validate validates DeviceIpv4 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceIpv4, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Gateway returns string, set in DeviceIpv4. + Gateway() string + // SetGateway assigns string provided by user to DeviceIpv4 + SetGateway(value string) DeviceIpv4 + // GatewayMac returns DeviceIpv4GatewayMAC, set in DeviceIpv4. + // DeviceIpv4GatewayMAC is by default auto(resolved gateway mac) is set. Setting a value would mean that ARP will not be used for learning MAC of connected device. The user-configured MAC address will be used for auto-filling the destination + // MAC address in the control and data packets sent from this IPv4 endpoint + // whenever applicable. + GatewayMac() DeviceIpv4GatewayMAC + // SetGatewayMac assigns DeviceIpv4GatewayMAC provided by user to DeviceIpv4. + // DeviceIpv4GatewayMAC is by default auto(resolved gateway mac) is set. Setting a value would mean that ARP will not be used for learning MAC of connected device. The user-configured MAC address will be used for auto-filling the destination + // MAC address in the control and data packets sent from this IPv4 endpoint + // whenever applicable. + SetGatewayMac(value DeviceIpv4GatewayMAC) DeviceIpv4 + // HasGatewayMac checks if GatewayMac has been set in DeviceIpv4 + HasGatewayMac() bool + // Address returns string, set in DeviceIpv4. + Address() string + // SetAddress assigns string provided by user to DeviceIpv4 + SetAddress(value string) DeviceIpv4 + // Prefix returns uint32, set in DeviceIpv4. + Prefix() uint32 + // SetPrefix assigns uint32 provided by user to DeviceIpv4 + SetPrefix(value uint32) DeviceIpv4 + // HasPrefix checks if Prefix has been set in DeviceIpv4 + HasPrefix() bool + // Name returns string, set in DeviceIpv4. + Name() string + // SetName assigns string provided by user to DeviceIpv4 + SetName(value string) DeviceIpv4 + setNil() +} + +// The IPv4 address of the gateway +// Gateway returns a string +func (obj *deviceIpv4) Gateway() string { + + return *obj.obj.Gateway + +} + +// The IPv4 address of the gateway +// SetGateway sets the string value in the DeviceIpv4 object +func (obj *deviceIpv4) SetGateway(value string) DeviceIpv4 { + + obj.obj.Gateway = &value + return obj +} + +// description is TBD +// GatewayMac returns a DeviceIpv4GatewayMAC +func (obj *deviceIpv4) GatewayMac() DeviceIpv4GatewayMAC { + if obj.obj.GatewayMac == nil { + obj.obj.GatewayMac = NewDeviceIpv4GatewayMAC().msg() + } + if obj.gatewayMacHolder == nil { + obj.gatewayMacHolder = &deviceIpv4GatewayMAC{obj: obj.obj.GatewayMac} + } + return obj.gatewayMacHolder +} + +// description is TBD +// GatewayMac returns a DeviceIpv4GatewayMAC +func (obj *deviceIpv4) HasGatewayMac() bool { + return obj.obj.GatewayMac != nil +} + +// description is TBD +// SetGatewayMac sets the DeviceIpv4GatewayMAC value in the DeviceIpv4 object +func (obj *deviceIpv4) SetGatewayMac(value DeviceIpv4GatewayMAC) DeviceIpv4 { + + obj.gatewayMacHolder = nil + obj.obj.GatewayMac = value.msg() + + return obj +} + +// The IPv4 address +// Address returns a string +func (obj *deviceIpv4) Address() string { + + return *obj.obj.Address + +} + +// The IPv4 address +// SetAddress sets the string value in the DeviceIpv4 object +func (obj *deviceIpv4) SetAddress(value string) DeviceIpv4 { + + obj.obj.Address = &value + return obj +} + +// The prefix of the IPv4 address. +// Prefix returns a uint32 +func (obj *deviceIpv4) Prefix() uint32 { + + return *obj.obj.Prefix + +} + +// The prefix of the IPv4 address. +// Prefix returns a uint32 +func (obj *deviceIpv4) HasPrefix() bool { + return obj.obj.Prefix != nil +} + +// The prefix of the IPv4 address. +// SetPrefix sets the uint32 value in the DeviceIpv4 object +func (obj *deviceIpv4) SetPrefix(value uint32) DeviceIpv4 { + + obj.obj.Prefix = &value + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *deviceIpv4) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the DeviceIpv4 object +func (obj *deviceIpv4) SetName(value string) DeviceIpv4 { + + obj.obj.Name = &value + return obj +} + +func (obj *deviceIpv4) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Gateway is required + if obj.obj.Gateway == nil { + vObj.validationErrors = append(vObj.validationErrors, "Gateway is required field on interface DeviceIpv4") + } + if obj.obj.Gateway != nil { + + err := obj.validateIpv4(obj.Gateway()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv4.Gateway")) + } + + } + + if obj.obj.GatewayMac != nil { + + obj.GatewayMac().validateObj(vObj, set_default) + } + + // Address is required + if obj.obj.Address == nil { + vObj.validationErrors = append(vObj.validationErrors, "Address is required field on interface DeviceIpv4") + } + if obj.obj.Address != nil { + + err := obj.validateIpv4(obj.Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv4.Address")) + } + + } + + if obj.obj.Prefix != nil { + + if *obj.obj.Prefix < 1 || *obj.obj.Prefix > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= DeviceIpv4.Prefix <= 32 but Got %d", *obj.obj.Prefix)) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceIpv4") + } +} + +func (obj *deviceIpv4) setDefault() { + if obj.obj.Prefix == nil { + obj.SetPrefix(24) + } + +} diff --git a/gosnappi/device_ipv4_gateway_mac.go b/gosnappi/device_ipv4_gateway_mac.go new file mode 100644 index 00000000..92772688 --- /dev/null +++ b/gosnappi/device_ipv4_gateway_mac.go @@ -0,0 +1,433 @@ +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" +) + +// ***** DeviceIpv4GatewayMAC ***** +type deviceIpv4GatewayMAC struct { + validation + obj *otg.DeviceIpv4GatewayMAC + marshaller marshalDeviceIpv4GatewayMAC + unMarshaller unMarshalDeviceIpv4GatewayMAC +} + +func NewDeviceIpv4GatewayMAC() DeviceIpv4GatewayMAC { + obj := deviceIpv4GatewayMAC{obj: &otg.DeviceIpv4GatewayMAC{}} + obj.setDefault() + return &obj +} + +func (obj *deviceIpv4GatewayMAC) msg() *otg.DeviceIpv4GatewayMAC { + return obj.obj +} + +func (obj *deviceIpv4GatewayMAC) setMsg(msg *otg.DeviceIpv4GatewayMAC) DeviceIpv4GatewayMAC { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceIpv4GatewayMAC struct { + obj *deviceIpv4GatewayMAC +} + +type marshalDeviceIpv4GatewayMAC interface { + // ToProto marshals DeviceIpv4GatewayMAC to protobuf object *otg.DeviceIpv4GatewayMAC + ToProto() (*otg.DeviceIpv4GatewayMAC, error) + // ToPbText marshals DeviceIpv4GatewayMAC to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceIpv4GatewayMAC to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceIpv4GatewayMAC to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceIpv4GatewayMAC struct { + obj *deviceIpv4GatewayMAC +} + +type unMarshalDeviceIpv4GatewayMAC interface { + // FromProto unmarshals DeviceIpv4GatewayMAC from protobuf object *otg.DeviceIpv4GatewayMAC + FromProto(msg *otg.DeviceIpv4GatewayMAC) (DeviceIpv4GatewayMAC, error) + // FromPbText unmarshals DeviceIpv4GatewayMAC from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceIpv4GatewayMAC from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceIpv4GatewayMAC from JSON text + FromJson(value string) error +} + +func (obj *deviceIpv4GatewayMAC) Marshal() marshalDeviceIpv4GatewayMAC { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceIpv4GatewayMAC{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceIpv4GatewayMAC) Unmarshal() unMarshalDeviceIpv4GatewayMAC { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceIpv4GatewayMAC{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceIpv4GatewayMAC) ToProto() (*otg.DeviceIpv4GatewayMAC, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceIpv4GatewayMAC) FromProto(msg *otg.DeviceIpv4GatewayMAC) (DeviceIpv4GatewayMAC, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceIpv4GatewayMAC) 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 *unMarshaldeviceIpv4GatewayMAC) 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 *marshaldeviceIpv4GatewayMAC) 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 *unMarshaldeviceIpv4GatewayMAC) 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 *marshaldeviceIpv4GatewayMAC) 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 *unMarshaldeviceIpv4GatewayMAC) 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 *deviceIpv4GatewayMAC) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceIpv4GatewayMAC) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceIpv4GatewayMAC) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceIpv4GatewayMAC) Clone() (DeviceIpv4GatewayMAC, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceIpv4GatewayMAC() + 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 +} + +// DeviceIpv4GatewayMAC is by default auto(resolved gateway mac) is set. Setting a value would mean that ARP will not be used for learning MAC of connected device. The user-configured MAC address will be used for auto-filling the destination +// MAC address in the control and data packets sent from this IPv4 endpoint +// whenever applicable. +type DeviceIpv4GatewayMAC interface { + Validation + // msg marshals DeviceIpv4GatewayMAC to protobuf object *otg.DeviceIpv4GatewayMAC + // and doesn't set defaults + msg() *otg.DeviceIpv4GatewayMAC + // setMsg unmarshals DeviceIpv4GatewayMAC from protobuf object *otg.DeviceIpv4GatewayMAC + // and doesn't set defaults + setMsg(*otg.DeviceIpv4GatewayMAC) DeviceIpv4GatewayMAC + // provides marshal interface + Marshal() marshalDeviceIpv4GatewayMAC + // provides unmarshal interface + Unmarshal() unMarshalDeviceIpv4GatewayMAC + // validate validates DeviceIpv4GatewayMAC + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceIpv4GatewayMAC, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns DeviceIpv4GatewayMACChoiceEnum, set in DeviceIpv4GatewayMAC + Choice() DeviceIpv4GatewayMACChoiceEnum + // setChoice assigns DeviceIpv4GatewayMACChoiceEnum provided by user to DeviceIpv4GatewayMAC + setChoice(value DeviceIpv4GatewayMACChoiceEnum) DeviceIpv4GatewayMAC + // HasChoice checks if Choice has been set in DeviceIpv4GatewayMAC + HasChoice() bool + // Auto returns string, set in DeviceIpv4GatewayMAC. + Auto() string + // HasAuto checks if Auto has been set in DeviceIpv4GatewayMAC + HasAuto() bool + // Value returns string, set in DeviceIpv4GatewayMAC. + Value() string + // SetValue assigns string provided by user to DeviceIpv4GatewayMAC + SetValue(value string) DeviceIpv4GatewayMAC + // HasValue checks if Value has been set in DeviceIpv4GatewayMAC + HasValue() bool +} + +type DeviceIpv4GatewayMACChoiceEnum string + +// Enum of Choice on DeviceIpv4GatewayMAC +var DeviceIpv4GatewayMACChoice = struct { + AUTO DeviceIpv4GatewayMACChoiceEnum + VALUE DeviceIpv4GatewayMACChoiceEnum +}{ + AUTO: DeviceIpv4GatewayMACChoiceEnum("auto"), + VALUE: DeviceIpv4GatewayMACChoiceEnum("value"), +} + +func (obj *deviceIpv4GatewayMAC) Choice() DeviceIpv4GatewayMACChoiceEnum { + return DeviceIpv4GatewayMACChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// auto or configured value. +// Choice returns a string +func (obj *deviceIpv4GatewayMAC) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *deviceIpv4GatewayMAC) setChoice(value DeviceIpv4GatewayMACChoiceEnum) DeviceIpv4GatewayMAC { + intValue, ok := otg.DeviceIpv4GatewayMAC_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on DeviceIpv4GatewayMACChoiceEnum", string(value))) + return obj + } + enumValue := otg.DeviceIpv4GatewayMAC_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Value = nil + obj.obj.Auto = nil + + if value == DeviceIpv4GatewayMACChoice.AUTO { + defaultValue := "00:00:00:00:00:00" + obj.obj.Auto = &defaultValue + } + + if value == DeviceIpv4GatewayMACChoice.VALUE { + defaultValue := "00:00:00:00:00:00" + obj.obj.Value = &defaultValue + } + + return obj +} + +// The OTG implementation can provide a system generated value for this property. If the OTG is unable to generate a value the default value must be used. +// Auto returns a string +func (obj *deviceIpv4GatewayMAC) Auto() string { + + if obj.obj.Auto == nil { + obj.setChoice(DeviceIpv4GatewayMACChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation can provide a system generated value for this property. If the OTG is unable to generate a value the default value must be used. +// Auto returns a string +func (obj *deviceIpv4GatewayMAC) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Value returns a string +func (obj *deviceIpv4GatewayMAC) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(DeviceIpv4GatewayMACChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *deviceIpv4GatewayMAC) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the DeviceIpv4GatewayMAC object +func (obj *deviceIpv4GatewayMAC) SetValue(value string) DeviceIpv4GatewayMAC { + obj.setChoice(DeviceIpv4GatewayMACChoice.VALUE) + obj.obj.Value = &value + return obj +} + +func (obj *deviceIpv4GatewayMAC) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Auto != nil { + + err := obj.validateMac(obj.Auto()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv4GatewayMAC.Auto")) + } + + } + + if obj.obj.Value != nil { + + err := obj.validateMac(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv4GatewayMAC.Value")) + } + + } + +} + +func (obj *deviceIpv4GatewayMAC) setDefault() { + var choices_set int = 0 + var choice DeviceIpv4GatewayMACChoiceEnum + + if obj.obj.Auto != nil { + choices_set += 1 + choice = DeviceIpv4GatewayMACChoice.AUTO + } + + if obj.obj.Value != nil { + choices_set += 1 + choice = DeviceIpv4GatewayMACChoice.VALUE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(DeviceIpv4GatewayMACChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in DeviceIpv4GatewayMAC") + } + } else { + intVal := otg.DeviceIpv4GatewayMAC_Choice_Enum_value[string(choice)] + enumValue := otg.DeviceIpv4GatewayMAC_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/device_ipv4_loopback.go b/gosnappi/device_ipv4_loopback.go new file mode 100644 index 00000000..aab2659a --- /dev/null +++ b/gosnappi/device_ipv4_loopback.go @@ -0,0 +1,381 @@ +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" +) + +// ***** DeviceIpv4Loopback ***** +type deviceIpv4Loopback struct { + validation + obj *otg.DeviceIpv4Loopback + marshaller marshalDeviceIpv4Loopback + unMarshaller unMarshalDeviceIpv4Loopback +} + +func NewDeviceIpv4Loopback() DeviceIpv4Loopback { + obj := deviceIpv4Loopback{obj: &otg.DeviceIpv4Loopback{}} + obj.setDefault() + return &obj +} + +func (obj *deviceIpv4Loopback) msg() *otg.DeviceIpv4Loopback { + return obj.obj +} + +func (obj *deviceIpv4Loopback) setMsg(msg *otg.DeviceIpv4Loopback) DeviceIpv4Loopback { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceIpv4Loopback struct { + obj *deviceIpv4Loopback +} + +type marshalDeviceIpv4Loopback interface { + // ToProto marshals DeviceIpv4Loopback to protobuf object *otg.DeviceIpv4Loopback + ToProto() (*otg.DeviceIpv4Loopback, error) + // ToPbText marshals DeviceIpv4Loopback to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceIpv4Loopback to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceIpv4Loopback to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceIpv4Loopback struct { + obj *deviceIpv4Loopback +} + +type unMarshalDeviceIpv4Loopback interface { + // FromProto unmarshals DeviceIpv4Loopback from protobuf object *otg.DeviceIpv4Loopback + FromProto(msg *otg.DeviceIpv4Loopback) (DeviceIpv4Loopback, error) + // FromPbText unmarshals DeviceIpv4Loopback from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceIpv4Loopback from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceIpv4Loopback from JSON text + FromJson(value string) error +} + +func (obj *deviceIpv4Loopback) Marshal() marshalDeviceIpv4Loopback { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceIpv4Loopback{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceIpv4Loopback) Unmarshal() unMarshalDeviceIpv4Loopback { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceIpv4Loopback{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceIpv4Loopback) ToProto() (*otg.DeviceIpv4Loopback, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceIpv4Loopback) FromProto(msg *otg.DeviceIpv4Loopback) (DeviceIpv4Loopback, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceIpv4Loopback) 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 *unMarshaldeviceIpv4Loopback) 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 *marshaldeviceIpv4Loopback) 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 *unMarshaldeviceIpv4Loopback) 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 *marshaldeviceIpv4Loopback) 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 *unMarshaldeviceIpv4Loopback) 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 *deviceIpv4Loopback) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceIpv4Loopback) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceIpv4Loopback) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceIpv4Loopback) Clone() (DeviceIpv4Loopback, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceIpv4Loopback() + 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 +} + +// DeviceIpv4Loopback is an IPv4 Loopback interface. +type DeviceIpv4Loopback interface { + Validation + // msg marshals DeviceIpv4Loopback to protobuf object *otg.DeviceIpv4Loopback + // and doesn't set defaults + msg() *otg.DeviceIpv4Loopback + // setMsg unmarshals DeviceIpv4Loopback from protobuf object *otg.DeviceIpv4Loopback + // and doesn't set defaults + setMsg(*otg.DeviceIpv4Loopback) DeviceIpv4Loopback + // provides marshal interface + Marshal() marshalDeviceIpv4Loopback + // provides unmarshal interface + Unmarshal() unMarshalDeviceIpv4Loopback + // validate validates DeviceIpv4Loopback + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceIpv4Loopback, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // EthName returns string, set in DeviceIpv4Loopback. + EthName() string + // SetEthName assigns string provided by user to DeviceIpv4Loopback + SetEthName(value string) DeviceIpv4Loopback + // Address returns string, set in DeviceIpv4Loopback. + Address() string + // SetAddress assigns string provided by user to DeviceIpv4Loopback + SetAddress(value string) DeviceIpv4Loopback + // HasAddress checks if Address has been set in DeviceIpv4Loopback + HasAddress() bool + // Name returns string, set in DeviceIpv4Loopback. + Name() string + // SetName assigns string provided by user to DeviceIpv4Loopback + SetName(value string) DeviceIpv4Loopback +} + +// The unique name of the Ethernet interface behind which this Loopback interface will be created. +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// EthName returns a string +func (obj *deviceIpv4Loopback) EthName() string { + + return *obj.obj.EthName + +} + +// The unique name of the Ethernet interface behind which this Loopback interface will be created. +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// SetEthName sets the string value in the DeviceIpv4Loopback object +func (obj *deviceIpv4Loopback) SetEthName(value string) DeviceIpv4Loopback { + + obj.obj.EthName = &value + return obj +} + +// The IPv4 Loopback address with prefix length of 32. +// Address returns a string +func (obj *deviceIpv4Loopback) Address() string { + + return *obj.obj.Address + +} + +// The IPv4 Loopback address with prefix length of 32. +// Address returns a string +func (obj *deviceIpv4Loopback) HasAddress() bool { + return obj.obj.Address != nil +} + +// The IPv4 Loopback address with prefix length of 32. +// SetAddress sets the string value in the DeviceIpv4Loopback object +func (obj *deviceIpv4Loopback) SetAddress(value string) DeviceIpv4Loopback { + + obj.obj.Address = &value + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *deviceIpv4Loopback) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the DeviceIpv4Loopback object +func (obj *deviceIpv4Loopback) SetName(value string) DeviceIpv4Loopback { + + obj.obj.Name = &value + return obj +} + +func (obj *deviceIpv4Loopback) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // EthName is required + if obj.obj.EthName == nil { + vObj.validationErrors = append(vObj.validationErrors, "EthName is required field on interface DeviceIpv4Loopback") + } + + if obj.obj.Address != nil { + + err := obj.validateIpv4(obj.Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv4Loopback.Address")) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceIpv4Loopback") + } +} + +func (obj *deviceIpv4Loopback) setDefault() { + if obj.obj.Address == nil { + obj.SetAddress("0.0.0.0") + } + +} diff --git a/gosnappi/device_ipv6.go b/gosnappi/device_ipv6.go new file mode 100644 index 00000000..4e326d76 --- /dev/null +++ b/gosnappi/device_ipv6.go @@ -0,0 +1,463 @@ +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" +) + +// ***** DeviceIpv6 ***** +type deviceIpv6 struct { + validation + obj *otg.DeviceIpv6 + marshaller marshalDeviceIpv6 + unMarshaller unMarshalDeviceIpv6 + gatewayMacHolder DeviceIpv6GatewayMAC +} + +func NewDeviceIpv6() DeviceIpv6 { + obj := deviceIpv6{obj: &otg.DeviceIpv6{}} + obj.setDefault() + return &obj +} + +func (obj *deviceIpv6) msg() *otg.DeviceIpv6 { + return obj.obj +} + +func (obj *deviceIpv6) setMsg(msg *otg.DeviceIpv6) DeviceIpv6 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceIpv6 struct { + obj *deviceIpv6 +} + +type marshalDeviceIpv6 interface { + // ToProto marshals DeviceIpv6 to protobuf object *otg.DeviceIpv6 + ToProto() (*otg.DeviceIpv6, error) + // ToPbText marshals DeviceIpv6 to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceIpv6 to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceIpv6 to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceIpv6 struct { + obj *deviceIpv6 +} + +type unMarshalDeviceIpv6 interface { + // FromProto unmarshals DeviceIpv6 from protobuf object *otg.DeviceIpv6 + FromProto(msg *otg.DeviceIpv6) (DeviceIpv6, error) + // FromPbText unmarshals DeviceIpv6 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceIpv6 from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceIpv6 from JSON text + FromJson(value string) error +} + +func (obj *deviceIpv6) Marshal() marshalDeviceIpv6 { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceIpv6{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceIpv6) Unmarshal() unMarshalDeviceIpv6 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceIpv6{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceIpv6) ToProto() (*otg.DeviceIpv6, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceIpv6) FromProto(msg *otg.DeviceIpv6) (DeviceIpv6, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceIpv6) 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 *unMarshaldeviceIpv6) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshaldeviceIpv6) 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 *unMarshaldeviceIpv6) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshaldeviceIpv6) 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 *unMarshaldeviceIpv6) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *deviceIpv6) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceIpv6) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceIpv6) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceIpv6) Clone() (DeviceIpv6, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceIpv6() + 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 +} + +func (obj *deviceIpv6) setNil() { + obj.gatewayMacHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// DeviceIpv6 is an IPv6 interface with gateway. +type DeviceIpv6 interface { + Validation + // msg marshals DeviceIpv6 to protobuf object *otg.DeviceIpv6 + // and doesn't set defaults + msg() *otg.DeviceIpv6 + // setMsg unmarshals DeviceIpv6 from protobuf object *otg.DeviceIpv6 + // and doesn't set defaults + setMsg(*otg.DeviceIpv6) DeviceIpv6 + // provides marshal interface + Marshal() marshalDeviceIpv6 + // provides unmarshal interface + Unmarshal() unMarshalDeviceIpv6 + // validate validates DeviceIpv6 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceIpv6, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Gateway returns string, set in DeviceIpv6. + Gateway() string + // SetGateway assigns string provided by user to DeviceIpv6 + SetGateway(value string) DeviceIpv6 + // GatewayMac returns DeviceIpv6GatewayMAC, set in DeviceIpv6. + // DeviceIpv6GatewayMAC is by default auto(resolved gateway mac) is set. Setting a value would mean that ND will not be used for learning MAC of connected device. The user-configured MAC address will be used for auto-filling the destination + // MAC address in the control and data packets sent from this IPv6 endpoint + // whenever applicable. + GatewayMac() DeviceIpv6GatewayMAC + // SetGatewayMac assigns DeviceIpv6GatewayMAC provided by user to DeviceIpv6. + // DeviceIpv6GatewayMAC is by default auto(resolved gateway mac) is set. Setting a value would mean that ND will not be used for learning MAC of connected device. The user-configured MAC address will be used for auto-filling the destination + // MAC address in the control and data packets sent from this IPv6 endpoint + // whenever applicable. + SetGatewayMac(value DeviceIpv6GatewayMAC) DeviceIpv6 + // HasGatewayMac checks if GatewayMac has been set in DeviceIpv6 + HasGatewayMac() bool + // Address returns string, set in DeviceIpv6. + Address() string + // SetAddress assigns string provided by user to DeviceIpv6 + SetAddress(value string) DeviceIpv6 + // Prefix returns uint32, set in DeviceIpv6. + Prefix() uint32 + // SetPrefix assigns uint32 provided by user to DeviceIpv6 + SetPrefix(value uint32) DeviceIpv6 + // HasPrefix checks if Prefix has been set in DeviceIpv6 + HasPrefix() bool + // Name returns string, set in DeviceIpv6. + Name() string + // SetName assigns string provided by user to DeviceIpv6 + SetName(value string) DeviceIpv6 + setNil() +} + +// The IPv6 gateway address. +// Gateway returns a string +func (obj *deviceIpv6) Gateway() string { + + return *obj.obj.Gateway + +} + +// The IPv6 gateway address. +// SetGateway sets the string value in the DeviceIpv6 object +func (obj *deviceIpv6) SetGateway(value string) DeviceIpv6 { + + obj.obj.Gateway = &value + return obj +} + +// description is TBD +// GatewayMac returns a DeviceIpv6GatewayMAC +func (obj *deviceIpv6) GatewayMac() DeviceIpv6GatewayMAC { + if obj.obj.GatewayMac == nil { + obj.obj.GatewayMac = NewDeviceIpv6GatewayMAC().msg() + } + if obj.gatewayMacHolder == nil { + obj.gatewayMacHolder = &deviceIpv6GatewayMAC{obj: obj.obj.GatewayMac} + } + return obj.gatewayMacHolder +} + +// description is TBD +// GatewayMac returns a DeviceIpv6GatewayMAC +func (obj *deviceIpv6) HasGatewayMac() bool { + return obj.obj.GatewayMac != nil +} + +// description is TBD +// SetGatewayMac sets the DeviceIpv6GatewayMAC value in the DeviceIpv6 object +func (obj *deviceIpv6) SetGatewayMac(value DeviceIpv6GatewayMAC) DeviceIpv6 { + + obj.gatewayMacHolder = nil + obj.obj.GatewayMac = value.msg() + + return obj +} + +// The IPv6 address. +// Address returns a string +func (obj *deviceIpv6) Address() string { + + return *obj.obj.Address + +} + +// The IPv6 address. +// SetAddress sets the string value in the DeviceIpv6 object +func (obj *deviceIpv6) SetAddress(value string) DeviceIpv6 { + + obj.obj.Address = &value + return obj +} + +// The network prefix. +// Prefix returns a uint32 +func (obj *deviceIpv6) Prefix() uint32 { + + return *obj.obj.Prefix + +} + +// The network prefix. +// Prefix returns a uint32 +func (obj *deviceIpv6) HasPrefix() bool { + return obj.obj.Prefix != nil +} + +// The network prefix. +// SetPrefix sets the uint32 value in the DeviceIpv6 object +func (obj *deviceIpv6) SetPrefix(value uint32) DeviceIpv6 { + + obj.obj.Prefix = &value + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *deviceIpv6) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the DeviceIpv6 object +func (obj *deviceIpv6) SetName(value string) DeviceIpv6 { + + obj.obj.Name = &value + return obj +} + +func (obj *deviceIpv6) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Gateway is required + if obj.obj.Gateway == nil { + vObj.validationErrors = append(vObj.validationErrors, "Gateway is required field on interface DeviceIpv6") + } + if obj.obj.Gateway != nil { + + err := obj.validateIpv6(obj.Gateway()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv6.Gateway")) + } + + } + + if obj.obj.GatewayMac != nil { + + obj.GatewayMac().validateObj(vObj, set_default) + } + + // Address is required + if obj.obj.Address == nil { + vObj.validationErrors = append(vObj.validationErrors, "Address is required field on interface DeviceIpv6") + } + if obj.obj.Address != nil { + + err := obj.validateIpv6(obj.Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv6.Address")) + } + + } + + if obj.obj.Prefix != nil { + + if *obj.obj.Prefix < 1 || *obj.obj.Prefix > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= DeviceIpv6.Prefix <= 128 but Got %d", *obj.obj.Prefix)) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceIpv6") + } +} + +func (obj *deviceIpv6) setDefault() { + if obj.obj.Prefix == nil { + obj.SetPrefix(64) + } + +} diff --git a/gosnappi/device_ipv6_gateway_mac.go b/gosnappi/device_ipv6_gateway_mac.go new file mode 100644 index 00000000..9c66579a --- /dev/null +++ b/gosnappi/device_ipv6_gateway_mac.go @@ -0,0 +1,433 @@ +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" +) + +// ***** DeviceIpv6GatewayMAC ***** +type deviceIpv6GatewayMAC struct { + validation + obj *otg.DeviceIpv6GatewayMAC + marshaller marshalDeviceIpv6GatewayMAC + unMarshaller unMarshalDeviceIpv6GatewayMAC +} + +func NewDeviceIpv6GatewayMAC() DeviceIpv6GatewayMAC { + obj := deviceIpv6GatewayMAC{obj: &otg.DeviceIpv6GatewayMAC{}} + obj.setDefault() + return &obj +} + +func (obj *deviceIpv6GatewayMAC) msg() *otg.DeviceIpv6GatewayMAC { + return obj.obj +} + +func (obj *deviceIpv6GatewayMAC) setMsg(msg *otg.DeviceIpv6GatewayMAC) DeviceIpv6GatewayMAC { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceIpv6GatewayMAC struct { + obj *deviceIpv6GatewayMAC +} + +type marshalDeviceIpv6GatewayMAC interface { + // ToProto marshals DeviceIpv6GatewayMAC to protobuf object *otg.DeviceIpv6GatewayMAC + ToProto() (*otg.DeviceIpv6GatewayMAC, error) + // ToPbText marshals DeviceIpv6GatewayMAC to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceIpv6GatewayMAC to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceIpv6GatewayMAC to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceIpv6GatewayMAC struct { + obj *deviceIpv6GatewayMAC +} + +type unMarshalDeviceIpv6GatewayMAC interface { + // FromProto unmarshals DeviceIpv6GatewayMAC from protobuf object *otg.DeviceIpv6GatewayMAC + FromProto(msg *otg.DeviceIpv6GatewayMAC) (DeviceIpv6GatewayMAC, error) + // FromPbText unmarshals DeviceIpv6GatewayMAC from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceIpv6GatewayMAC from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceIpv6GatewayMAC from JSON text + FromJson(value string) error +} + +func (obj *deviceIpv6GatewayMAC) Marshal() marshalDeviceIpv6GatewayMAC { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceIpv6GatewayMAC{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceIpv6GatewayMAC) Unmarshal() unMarshalDeviceIpv6GatewayMAC { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceIpv6GatewayMAC{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceIpv6GatewayMAC) ToProto() (*otg.DeviceIpv6GatewayMAC, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceIpv6GatewayMAC) FromProto(msg *otg.DeviceIpv6GatewayMAC) (DeviceIpv6GatewayMAC, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceIpv6GatewayMAC) 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 *unMarshaldeviceIpv6GatewayMAC) 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 *marshaldeviceIpv6GatewayMAC) 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 *unMarshaldeviceIpv6GatewayMAC) 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 *marshaldeviceIpv6GatewayMAC) 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 *unMarshaldeviceIpv6GatewayMAC) 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 *deviceIpv6GatewayMAC) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceIpv6GatewayMAC) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceIpv6GatewayMAC) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceIpv6GatewayMAC) Clone() (DeviceIpv6GatewayMAC, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceIpv6GatewayMAC() + 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 +} + +// DeviceIpv6GatewayMAC is by default auto(resolved gateway mac) is set. Setting a value would mean that ND will not be used for learning MAC of connected device. The user-configured MAC address will be used for auto-filling the destination +// MAC address in the control and data packets sent from this IPv6 endpoint +// whenever applicable. +type DeviceIpv6GatewayMAC interface { + Validation + // msg marshals DeviceIpv6GatewayMAC to protobuf object *otg.DeviceIpv6GatewayMAC + // and doesn't set defaults + msg() *otg.DeviceIpv6GatewayMAC + // setMsg unmarshals DeviceIpv6GatewayMAC from protobuf object *otg.DeviceIpv6GatewayMAC + // and doesn't set defaults + setMsg(*otg.DeviceIpv6GatewayMAC) DeviceIpv6GatewayMAC + // provides marshal interface + Marshal() marshalDeviceIpv6GatewayMAC + // provides unmarshal interface + Unmarshal() unMarshalDeviceIpv6GatewayMAC + // validate validates DeviceIpv6GatewayMAC + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceIpv6GatewayMAC, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns DeviceIpv6GatewayMACChoiceEnum, set in DeviceIpv6GatewayMAC + Choice() DeviceIpv6GatewayMACChoiceEnum + // setChoice assigns DeviceIpv6GatewayMACChoiceEnum provided by user to DeviceIpv6GatewayMAC + setChoice(value DeviceIpv6GatewayMACChoiceEnum) DeviceIpv6GatewayMAC + // HasChoice checks if Choice has been set in DeviceIpv6GatewayMAC + HasChoice() bool + // Auto returns string, set in DeviceIpv6GatewayMAC. + Auto() string + // HasAuto checks if Auto has been set in DeviceIpv6GatewayMAC + HasAuto() bool + // Value returns string, set in DeviceIpv6GatewayMAC. + Value() string + // SetValue assigns string provided by user to DeviceIpv6GatewayMAC + SetValue(value string) DeviceIpv6GatewayMAC + // HasValue checks if Value has been set in DeviceIpv6GatewayMAC + HasValue() bool +} + +type DeviceIpv6GatewayMACChoiceEnum string + +// Enum of Choice on DeviceIpv6GatewayMAC +var DeviceIpv6GatewayMACChoice = struct { + AUTO DeviceIpv6GatewayMACChoiceEnum + VALUE DeviceIpv6GatewayMACChoiceEnum +}{ + AUTO: DeviceIpv6GatewayMACChoiceEnum("auto"), + VALUE: DeviceIpv6GatewayMACChoiceEnum("value"), +} + +func (obj *deviceIpv6GatewayMAC) Choice() DeviceIpv6GatewayMACChoiceEnum { + return DeviceIpv6GatewayMACChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// auto or configured value. +// Choice returns a string +func (obj *deviceIpv6GatewayMAC) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *deviceIpv6GatewayMAC) setChoice(value DeviceIpv6GatewayMACChoiceEnum) DeviceIpv6GatewayMAC { + intValue, ok := otg.DeviceIpv6GatewayMAC_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on DeviceIpv6GatewayMACChoiceEnum", string(value))) + return obj + } + enumValue := otg.DeviceIpv6GatewayMAC_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Value = nil + obj.obj.Auto = nil + + if value == DeviceIpv6GatewayMACChoice.AUTO { + defaultValue := "00:00:00:00:00:00" + obj.obj.Auto = &defaultValue + } + + if value == DeviceIpv6GatewayMACChoice.VALUE { + defaultValue := "00:00:00:00:00:00" + obj.obj.Value = &defaultValue + } + + return obj +} + +// The OTG implementation can provide a system generated value for this property. If the OTG is unable to generate a value the default value must be used. +// Auto returns a string +func (obj *deviceIpv6GatewayMAC) Auto() string { + + if obj.obj.Auto == nil { + obj.setChoice(DeviceIpv6GatewayMACChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation can provide a system generated value for this property. If the OTG is unable to generate a value the default value must be used. +// Auto returns a string +func (obj *deviceIpv6GatewayMAC) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Value returns a string +func (obj *deviceIpv6GatewayMAC) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(DeviceIpv6GatewayMACChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *deviceIpv6GatewayMAC) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the DeviceIpv6GatewayMAC object +func (obj *deviceIpv6GatewayMAC) SetValue(value string) DeviceIpv6GatewayMAC { + obj.setChoice(DeviceIpv6GatewayMACChoice.VALUE) + obj.obj.Value = &value + return obj +} + +func (obj *deviceIpv6GatewayMAC) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Auto != nil { + + err := obj.validateMac(obj.Auto()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv6GatewayMAC.Auto")) + } + + } + + if obj.obj.Value != nil { + + err := obj.validateMac(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv6GatewayMAC.Value")) + } + + } + +} + +func (obj *deviceIpv6GatewayMAC) setDefault() { + var choices_set int = 0 + var choice DeviceIpv6GatewayMACChoiceEnum + + if obj.obj.Auto != nil { + choices_set += 1 + choice = DeviceIpv6GatewayMACChoice.AUTO + } + + if obj.obj.Value != nil { + choices_set += 1 + choice = DeviceIpv6GatewayMACChoice.VALUE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(DeviceIpv6GatewayMACChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in DeviceIpv6GatewayMAC") + } + } else { + intVal := otg.DeviceIpv6GatewayMAC_Choice_Enum_value[string(choice)] + enumValue := otg.DeviceIpv6GatewayMAC_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/device_ipv6_loopback.go b/gosnappi/device_ipv6_loopback.go new file mode 100644 index 00000000..4dba4917 --- /dev/null +++ b/gosnappi/device_ipv6_loopback.go @@ -0,0 +1,383 @@ +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" +) + +// ***** DeviceIpv6Loopback ***** +type deviceIpv6Loopback struct { + validation + obj *otg.DeviceIpv6Loopback + marshaller marshalDeviceIpv6Loopback + unMarshaller unMarshalDeviceIpv6Loopback +} + +func NewDeviceIpv6Loopback() DeviceIpv6Loopback { + obj := deviceIpv6Loopback{obj: &otg.DeviceIpv6Loopback{}} + obj.setDefault() + return &obj +} + +func (obj *deviceIpv6Loopback) msg() *otg.DeviceIpv6Loopback { + return obj.obj +} + +func (obj *deviceIpv6Loopback) setMsg(msg *otg.DeviceIpv6Loopback) DeviceIpv6Loopback { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceIpv6Loopback struct { + obj *deviceIpv6Loopback +} + +type marshalDeviceIpv6Loopback interface { + // ToProto marshals DeviceIpv6Loopback to protobuf object *otg.DeviceIpv6Loopback + ToProto() (*otg.DeviceIpv6Loopback, error) + // ToPbText marshals DeviceIpv6Loopback to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceIpv6Loopback to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceIpv6Loopback to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceIpv6Loopback struct { + obj *deviceIpv6Loopback +} + +type unMarshalDeviceIpv6Loopback interface { + // FromProto unmarshals DeviceIpv6Loopback from protobuf object *otg.DeviceIpv6Loopback + FromProto(msg *otg.DeviceIpv6Loopback) (DeviceIpv6Loopback, error) + // FromPbText unmarshals DeviceIpv6Loopback from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceIpv6Loopback from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceIpv6Loopback from JSON text + FromJson(value string) error +} + +func (obj *deviceIpv6Loopback) Marshal() marshalDeviceIpv6Loopback { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceIpv6Loopback{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceIpv6Loopback) Unmarshal() unMarshalDeviceIpv6Loopback { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceIpv6Loopback{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceIpv6Loopback) ToProto() (*otg.DeviceIpv6Loopback, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceIpv6Loopback) FromProto(msg *otg.DeviceIpv6Loopback) (DeviceIpv6Loopback, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceIpv6Loopback) 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 *unMarshaldeviceIpv6Loopback) 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 *marshaldeviceIpv6Loopback) 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 *unMarshaldeviceIpv6Loopback) 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 *marshaldeviceIpv6Loopback) 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 *unMarshaldeviceIpv6Loopback) 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 *deviceIpv6Loopback) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceIpv6Loopback) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceIpv6Loopback) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceIpv6Loopback) Clone() (DeviceIpv6Loopback, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceIpv6Loopback() + 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 +} + +// DeviceIpv6Loopback is an IPv6 Loopback interface +type DeviceIpv6Loopback interface { + Validation + // msg marshals DeviceIpv6Loopback to protobuf object *otg.DeviceIpv6Loopback + // and doesn't set defaults + msg() *otg.DeviceIpv6Loopback + // setMsg unmarshals DeviceIpv6Loopback from protobuf object *otg.DeviceIpv6Loopback + // and doesn't set defaults + setMsg(*otg.DeviceIpv6Loopback) DeviceIpv6Loopback + // provides marshal interface + Marshal() marshalDeviceIpv6Loopback + // provides unmarshal interface + Unmarshal() unMarshalDeviceIpv6Loopback + // validate validates DeviceIpv6Loopback + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceIpv6Loopback, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // EthName returns string, set in DeviceIpv6Loopback. + EthName() string + // SetEthName assigns string provided by user to DeviceIpv6Loopback + SetEthName(value string) DeviceIpv6Loopback + // Address returns string, set in DeviceIpv6Loopback. + Address() string + // SetAddress assigns string provided by user to DeviceIpv6Loopback + SetAddress(value string) DeviceIpv6Loopback + // HasAddress checks if Address has been set in DeviceIpv6Loopback + HasAddress() bool + // Name returns string, set in DeviceIpv6Loopback. + Name() string + // SetName assigns string provided by user to DeviceIpv6Loopback + SetName(value string) DeviceIpv6Loopback +} + +// The unique name of the Ethernet interface behind which this Loopback +// interface will be created. +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// EthName returns a string +func (obj *deviceIpv6Loopback) EthName() string { + + return *obj.obj.EthName + +} + +// The unique name of the Ethernet interface behind which this Loopback +// interface will be created. +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// SetEthName sets the string value in the DeviceIpv6Loopback object +func (obj *deviceIpv6Loopback) SetEthName(value string) DeviceIpv6Loopback { + + obj.obj.EthName = &value + return obj +} + +// The IPv6 Loopback address with prefix length of 128. +// Address returns a string +func (obj *deviceIpv6Loopback) Address() string { + + return *obj.obj.Address + +} + +// The IPv6 Loopback address with prefix length of 128. +// Address returns a string +func (obj *deviceIpv6Loopback) HasAddress() bool { + return obj.obj.Address != nil +} + +// The IPv6 Loopback address with prefix length of 128. +// SetAddress sets the string value in the DeviceIpv6Loopback object +func (obj *deviceIpv6Loopback) SetAddress(value string) DeviceIpv6Loopback { + + obj.obj.Address = &value + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *deviceIpv6Loopback) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the DeviceIpv6Loopback object +func (obj *deviceIpv6Loopback) SetName(value string) DeviceIpv6Loopback { + + obj.obj.Name = &value + return obj +} + +func (obj *deviceIpv6Loopback) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // EthName is required + if obj.obj.EthName == nil { + vObj.validationErrors = append(vObj.validationErrors, "EthName is required field on interface DeviceIpv6Loopback") + } + + if obj.obj.Address != nil { + + err := obj.validateIpv6(obj.Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv6Loopback.Address")) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceIpv6Loopback") + } +} + +func (obj *deviceIpv6Loopback) setDefault() { + if obj.obj.Address == nil { + obj.SetAddress("::0") + } + +} diff --git a/gosnappi/device_isis_multi_instance.go b/gosnappi/device_isis_multi_instance.go new file mode 100644 index 00000000..d19eeaf6 --- /dev/null +++ b/gosnappi/device_isis_multi_instance.go @@ -0,0 +1,357 @@ +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" +) + +// ***** DeviceIsisMultiInstance ***** +type deviceIsisMultiInstance struct { + validation + obj *otg.DeviceIsisMultiInstance + marshaller marshalDeviceIsisMultiInstance + unMarshaller unMarshalDeviceIsisMultiInstance +} + +func NewDeviceIsisMultiInstance() DeviceIsisMultiInstance { + obj := deviceIsisMultiInstance{obj: &otg.DeviceIsisMultiInstance{}} + obj.setDefault() + return &obj +} + +func (obj *deviceIsisMultiInstance) msg() *otg.DeviceIsisMultiInstance { + return obj.obj +} + +func (obj *deviceIsisMultiInstance) setMsg(msg *otg.DeviceIsisMultiInstance) DeviceIsisMultiInstance { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceIsisMultiInstance struct { + obj *deviceIsisMultiInstance +} + +type marshalDeviceIsisMultiInstance interface { + // ToProto marshals DeviceIsisMultiInstance to protobuf object *otg.DeviceIsisMultiInstance + ToProto() (*otg.DeviceIsisMultiInstance, error) + // ToPbText marshals DeviceIsisMultiInstance to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceIsisMultiInstance to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceIsisMultiInstance to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceIsisMultiInstance struct { + obj *deviceIsisMultiInstance +} + +type unMarshalDeviceIsisMultiInstance interface { + // FromProto unmarshals DeviceIsisMultiInstance from protobuf object *otg.DeviceIsisMultiInstance + FromProto(msg *otg.DeviceIsisMultiInstance) (DeviceIsisMultiInstance, error) + // FromPbText unmarshals DeviceIsisMultiInstance from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceIsisMultiInstance from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceIsisMultiInstance from JSON text + FromJson(value string) error +} + +func (obj *deviceIsisMultiInstance) Marshal() marshalDeviceIsisMultiInstance { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceIsisMultiInstance{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceIsisMultiInstance) Unmarshal() unMarshalDeviceIsisMultiInstance { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceIsisMultiInstance{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceIsisMultiInstance) ToProto() (*otg.DeviceIsisMultiInstance, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceIsisMultiInstance) FromProto(msg *otg.DeviceIsisMultiInstance) (DeviceIsisMultiInstance, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceIsisMultiInstance) 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 *unMarshaldeviceIsisMultiInstance) 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 *marshaldeviceIsisMultiInstance) 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 *unMarshaldeviceIsisMultiInstance) 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 *marshaldeviceIsisMultiInstance) 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 *unMarshaldeviceIsisMultiInstance) 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 *deviceIsisMultiInstance) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceIsisMultiInstance) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceIsisMultiInstance) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceIsisMultiInstance) Clone() (DeviceIsisMultiInstance, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceIsisMultiInstance() + 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 +} + +// DeviceIsisMultiInstance is this container properties of an Multi-Instance-capable router (MI-RTR). +type DeviceIsisMultiInstance interface { + Validation + // msg marshals DeviceIsisMultiInstance to protobuf object *otg.DeviceIsisMultiInstance + // and doesn't set defaults + msg() *otg.DeviceIsisMultiInstance + // setMsg unmarshals DeviceIsisMultiInstance from protobuf object *otg.DeviceIsisMultiInstance + // and doesn't set defaults + setMsg(*otg.DeviceIsisMultiInstance) DeviceIsisMultiInstance + // provides marshal interface + Marshal() marshalDeviceIsisMultiInstance + // provides unmarshal interface + Unmarshal() unMarshalDeviceIsisMultiInstance + // validate validates DeviceIsisMultiInstance + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceIsisMultiInstance, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Iid returns uint32, set in DeviceIsisMultiInstance. + Iid() uint32 + // SetIid assigns uint32 provided by user to DeviceIsisMultiInstance + SetIid(value uint32) DeviceIsisMultiInstance + // HasIid checks if Iid has been set in DeviceIsisMultiInstance + HasIid() bool + // Itids returns []uint32, set in DeviceIsisMultiInstance. + Itids() []uint32 + // SetItids assigns []uint32 provided by user to DeviceIsisMultiInstance + SetItids(value []uint32) DeviceIsisMultiInstance +} + +// Instance Identifier (IID) TLV will associate a PDU with an ISIS instance by using a unique 16-bit number and including one or more Instance-Specific Topology Identifiers (ITIDs). +// Iid returns a uint32 +func (obj *deviceIsisMultiInstance) Iid() uint32 { + + return *obj.obj.Iid + +} + +// Instance Identifier (IID) TLV will associate a PDU with an ISIS instance by using a unique 16-bit number and including one or more Instance-Specific Topology Identifiers (ITIDs). +// Iid returns a uint32 +func (obj *deviceIsisMultiInstance) HasIid() bool { + return obj.obj.Iid != nil +} + +// Instance Identifier (IID) TLV will associate a PDU with an ISIS instance by using a unique 16-bit number and including one or more Instance-Specific Topology Identifiers (ITIDs). +// SetIid sets the uint32 value in the DeviceIsisMultiInstance object +func (obj *deviceIsisMultiInstance) SetIid(value uint32) DeviceIsisMultiInstance { + + obj.obj.Iid = &value + return obj +} + +// This contains one or more ITIDs that will be advertised in IID TLV. +// Itids returns a []uint32 +func (obj *deviceIsisMultiInstance) Itids() []uint32 { + if obj.obj.Itids == nil { + obj.obj.Itids = make([]uint32, 0) + } + return obj.obj.Itids +} + +// This contains one or more ITIDs that will be advertised in IID TLV. +// SetItids sets the []uint32 value in the DeviceIsisMultiInstance object +func (obj *deviceIsisMultiInstance) SetItids(value []uint32) DeviceIsisMultiInstance { + + if obj.obj.Itids == nil { + obj.obj.Itids = make([]uint32, 0) + } + obj.obj.Itids = value + + return obj +} + +func (obj *deviceIsisMultiInstance) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Iid != nil { + + if *obj.obj.Iid > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= DeviceIsisMultiInstance.Iid <= 65535 but Got %d", *obj.obj.Iid)) + } + + } + + if obj.obj.Itids != nil { + + for _, item := range obj.obj.Itids { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= DeviceIsisMultiInstance.Itids <= 65535 but Got %d", item)) + } + + } + + } + +} + +func (obj *deviceIsisMultiInstance) setDefault() { + if obj.obj.Iid == nil { + obj.SetIid(1) + } + +} diff --git a/gosnappi/device_isis_router.go b/gosnappi/device_isis_router.go new file mode 100644 index 00000000..31d3232a --- /dev/null +++ b/gosnappi/device_isis_router.go @@ -0,0 +1,829 @@ +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" +) + +// ***** DeviceIsisRouter ***** +type deviceIsisRouter struct { + validation + obj *otg.DeviceIsisRouter + marshaller marshalDeviceIsisRouter + unMarshaller unMarshalDeviceIsisRouter + instanceHolder DeviceIsisMultiInstance + interfacesHolder DeviceIsisRouterIsisInterfaceIter + basicHolder IsisBasic + advancedHolder IsisAdvanced + routerAuthHolder IsisAuthentication + v4RoutesHolder DeviceIsisRouterIsisV4RouteRangeIter + v6RoutesHolder DeviceIsisRouterIsisV6RouteRangeIter +} + +func NewDeviceIsisRouter() DeviceIsisRouter { + obj := deviceIsisRouter{obj: &otg.DeviceIsisRouter{}} + obj.setDefault() + return &obj +} + +func (obj *deviceIsisRouter) msg() *otg.DeviceIsisRouter { + return obj.obj +} + +func (obj *deviceIsisRouter) setMsg(msg *otg.DeviceIsisRouter) DeviceIsisRouter { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceIsisRouter struct { + obj *deviceIsisRouter +} + +type marshalDeviceIsisRouter interface { + // ToProto marshals DeviceIsisRouter to protobuf object *otg.DeviceIsisRouter + ToProto() (*otg.DeviceIsisRouter, error) + // ToPbText marshals DeviceIsisRouter to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceIsisRouter to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceIsisRouter to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceIsisRouter struct { + obj *deviceIsisRouter +} + +type unMarshalDeviceIsisRouter interface { + // FromProto unmarshals DeviceIsisRouter from protobuf object *otg.DeviceIsisRouter + FromProto(msg *otg.DeviceIsisRouter) (DeviceIsisRouter, error) + // FromPbText unmarshals DeviceIsisRouter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceIsisRouter from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceIsisRouter from JSON text + FromJson(value string) error +} + +func (obj *deviceIsisRouter) Marshal() marshalDeviceIsisRouter { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceIsisRouter{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceIsisRouter) Unmarshal() unMarshalDeviceIsisRouter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceIsisRouter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceIsisRouter) ToProto() (*otg.DeviceIsisRouter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceIsisRouter) FromProto(msg *otg.DeviceIsisRouter) (DeviceIsisRouter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceIsisRouter) 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 *unMarshaldeviceIsisRouter) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshaldeviceIsisRouter) 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 *unMarshaldeviceIsisRouter) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshaldeviceIsisRouter) 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 *unMarshaldeviceIsisRouter) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *deviceIsisRouter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceIsisRouter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceIsisRouter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceIsisRouter) Clone() (DeviceIsisRouter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceIsisRouter() + 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 +} + +func (obj *deviceIsisRouter) setNil() { + obj.instanceHolder = nil + obj.interfacesHolder = nil + obj.basicHolder = nil + obj.advancedHolder = nil + obj.routerAuthHolder = nil + obj.v4RoutesHolder = nil + obj.v6RoutesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// DeviceIsisRouter is a container of properties for an ISIS router and its interfaces. +type DeviceIsisRouter interface { + Validation + // msg marshals DeviceIsisRouter to protobuf object *otg.DeviceIsisRouter + // and doesn't set defaults + msg() *otg.DeviceIsisRouter + // setMsg unmarshals DeviceIsisRouter from protobuf object *otg.DeviceIsisRouter + // and doesn't set defaults + setMsg(*otg.DeviceIsisRouter) DeviceIsisRouter + // provides marshal interface + Marshal() marshalDeviceIsisRouter + // provides unmarshal interface + Unmarshal() unMarshalDeviceIsisRouter + // validate validates DeviceIsisRouter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceIsisRouter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Instance returns DeviceIsisMultiInstance, set in DeviceIsisRouter. + // DeviceIsisMultiInstance is this container properties of an Multi-Instance-capable router (MI-RTR). + Instance() DeviceIsisMultiInstance + // SetInstance assigns DeviceIsisMultiInstance provided by user to DeviceIsisRouter. + // DeviceIsisMultiInstance is this container properties of an Multi-Instance-capable router (MI-RTR). + SetInstance(value DeviceIsisMultiInstance) DeviceIsisRouter + // HasInstance checks if Instance has been set in DeviceIsisRouter + HasInstance() bool + // SystemId returns string, set in DeviceIsisRouter. + SystemId() string + // SetSystemId assigns string provided by user to DeviceIsisRouter + SetSystemId(value string) DeviceIsisRouter + // Interfaces returns DeviceIsisRouterIsisInterfaceIterIter, set in DeviceIsisRouter + Interfaces() DeviceIsisRouterIsisInterfaceIter + // Basic returns IsisBasic, set in DeviceIsisRouter. + // IsisBasic is this contains ISIS router basic properties. + Basic() IsisBasic + // SetBasic assigns IsisBasic provided by user to DeviceIsisRouter. + // IsisBasic is this contains ISIS router basic properties. + SetBasic(value IsisBasic) DeviceIsisRouter + // HasBasic checks if Basic has been set in DeviceIsisRouter + HasBasic() bool + // Advanced returns IsisAdvanced, set in DeviceIsisRouter. + // IsisAdvanced is contains ISIS router advanced properties. + Advanced() IsisAdvanced + // SetAdvanced assigns IsisAdvanced provided by user to DeviceIsisRouter. + // IsisAdvanced is contains ISIS router advanced properties. + SetAdvanced(value IsisAdvanced) DeviceIsisRouter + // HasAdvanced checks if Advanced has been set in DeviceIsisRouter + HasAdvanced() bool + // RouterAuth returns IsisAuthentication, set in DeviceIsisRouter. + // IsisAuthentication is this contains ISIS Area/Domain authentication properties. + RouterAuth() IsisAuthentication + // SetRouterAuth assigns IsisAuthentication provided by user to DeviceIsisRouter. + // IsisAuthentication is this contains ISIS Area/Domain authentication properties. + SetRouterAuth(value IsisAuthentication) DeviceIsisRouter + // HasRouterAuth checks if RouterAuth has been set in DeviceIsisRouter + HasRouterAuth() bool + // V4Routes returns DeviceIsisRouterIsisV4RouteRangeIterIter, set in DeviceIsisRouter + V4Routes() DeviceIsisRouterIsisV4RouteRangeIter + // V6Routes returns DeviceIsisRouterIsisV6RouteRangeIterIter, set in DeviceIsisRouter + V6Routes() DeviceIsisRouterIsisV6RouteRangeIter + // Name returns string, set in DeviceIsisRouter. + Name() string + // SetName assigns string provided by user to DeviceIsisRouter + SetName(value string) DeviceIsisRouter + setNil() +} + +// This contains the properties of a Multi-Instance-capable routers or MI-RTR. Each router can emulate one ISIS instance at a time. +// Instance returns a DeviceIsisMultiInstance +func (obj *deviceIsisRouter) Instance() DeviceIsisMultiInstance { + if obj.obj.Instance == nil { + obj.obj.Instance = NewDeviceIsisMultiInstance().msg() + } + if obj.instanceHolder == nil { + obj.instanceHolder = &deviceIsisMultiInstance{obj: obj.obj.Instance} + } + return obj.instanceHolder +} + +// This contains the properties of a Multi-Instance-capable routers or MI-RTR. Each router can emulate one ISIS instance at a time. +// Instance returns a DeviceIsisMultiInstance +func (obj *deviceIsisRouter) HasInstance() bool { + return obj.obj.Instance != nil +} + +// This contains the properties of a Multi-Instance-capable routers or MI-RTR. Each router can emulate one ISIS instance at a time. +// SetInstance sets the DeviceIsisMultiInstance value in the DeviceIsisRouter object +func (obj *deviceIsisRouter) SetInstance(value DeviceIsisMultiInstance) DeviceIsisRouter { + + obj.instanceHolder = nil + obj.obj.Instance = value.msg() + + return obj +} + +// The System ID for this emulated ISIS router, e.g. "640100010000". +// SystemId returns a string +func (obj *deviceIsisRouter) SystemId() string { + + return *obj.obj.SystemId + +} + +// The System ID for this emulated ISIS router, e.g. "640100010000". +// SetSystemId sets the string value in the DeviceIsisRouter object +func (obj *deviceIsisRouter) SetSystemId(value string) DeviceIsisRouter { + + obj.obj.SystemId = &value + return obj +} + +// List of ISIS interfaces for this router. +// Interfaces returns a []IsisInterface +func (obj *deviceIsisRouter) Interfaces() DeviceIsisRouterIsisInterfaceIter { + if len(obj.obj.Interfaces) == 0 { + obj.obj.Interfaces = []*otg.IsisInterface{} + } + if obj.interfacesHolder == nil { + obj.interfacesHolder = newDeviceIsisRouterIsisInterfaceIter(&obj.obj.Interfaces).setMsg(obj) + } + return obj.interfacesHolder +} + +type deviceIsisRouterIsisInterfaceIter struct { + obj *deviceIsisRouter + isisInterfaceSlice []IsisInterface + fieldPtr *[]*otg.IsisInterface +} + +func newDeviceIsisRouterIsisInterfaceIter(ptr *[]*otg.IsisInterface) DeviceIsisRouterIsisInterfaceIter { + return &deviceIsisRouterIsisInterfaceIter{fieldPtr: ptr} +} + +type DeviceIsisRouterIsisInterfaceIter interface { + setMsg(*deviceIsisRouter) DeviceIsisRouterIsisInterfaceIter + Items() []IsisInterface + Add() IsisInterface + Append(items ...IsisInterface) DeviceIsisRouterIsisInterfaceIter + Set(index int, newObj IsisInterface) DeviceIsisRouterIsisInterfaceIter + Clear() DeviceIsisRouterIsisInterfaceIter + clearHolderSlice() DeviceIsisRouterIsisInterfaceIter + appendHolderSlice(item IsisInterface) DeviceIsisRouterIsisInterfaceIter +} + +func (obj *deviceIsisRouterIsisInterfaceIter) setMsg(msg *deviceIsisRouter) DeviceIsisRouterIsisInterfaceIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisInterface{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceIsisRouterIsisInterfaceIter) Items() []IsisInterface { + return obj.isisInterfaceSlice +} + +func (obj *deviceIsisRouterIsisInterfaceIter) Add() IsisInterface { + newObj := &otg.IsisInterface{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisInterface{obj: newObj} + newLibObj.setDefault() + obj.isisInterfaceSlice = append(obj.isisInterfaceSlice, newLibObj) + return newLibObj +} + +func (obj *deviceIsisRouterIsisInterfaceIter) Append(items ...IsisInterface) DeviceIsisRouterIsisInterfaceIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisInterfaceSlice = append(obj.isisInterfaceSlice, item) + } + return obj +} + +func (obj *deviceIsisRouterIsisInterfaceIter) Set(index int, newObj IsisInterface) DeviceIsisRouterIsisInterfaceIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisInterfaceSlice[index] = newObj + return obj +} +func (obj *deviceIsisRouterIsisInterfaceIter) Clear() DeviceIsisRouterIsisInterfaceIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisInterface{} + obj.isisInterfaceSlice = []IsisInterface{} + } + return obj +} +func (obj *deviceIsisRouterIsisInterfaceIter) clearHolderSlice() DeviceIsisRouterIsisInterfaceIter { + if len(obj.isisInterfaceSlice) > 0 { + obj.isisInterfaceSlice = []IsisInterface{} + } + return obj +} +func (obj *deviceIsisRouterIsisInterfaceIter) appendHolderSlice(item IsisInterface) DeviceIsisRouterIsisInterfaceIter { + obj.isisInterfaceSlice = append(obj.isisInterfaceSlice, item) + return obj +} + +// Contains basic properties of an ISIS Router. +// Basic returns a IsisBasic +func (obj *deviceIsisRouter) Basic() IsisBasic { + if obj.obj.Basic == nil { + obj.obj.Basic = NewIsisBasic().msg() + } + if obj.basicHolder == nil { + obj.basicHolder = &isisBasic{obj: obj.obj.Basic} + } + return obj.basicHolder +} + +// Contains basic properties of an ISIS Router. +// Basic returns a IsisBasic +func (obj *deviceIsisRouter) HasBasic() bool { + return obj.obj.Basic != nil +} + +// Contains basic properties of an ISIS Router. +// SetBasic sets the IsisBasic value in the DeviceIsisRouter object +func (obj *deviceIsisRouter) SetBasic(value IsisBasic) DeviceIsisRouter { + + obj.basicHolder = nil + obj.obj.Basic = value.msg() + + return obj +} + +// Contains advance properties of an ISIS Router.. +// Advanced returns a IsisAdvanced +func (obj *deviceIsisRouter) Advanced() IsisAdvanced { + if obj.obj.Advanced == nil { + obj.obj.Advanced = NewIsisAdvanced().msg() + } + if obj.advancedHolder == nil { + obj.advancedHolder = &isisAdvanced{obj: obj.obj.Advanced} + } + return obj.advancedHolder +} + +// Contains advance properties of an ISIS Router.. +// Advanced returns a IsisAdvanced +func (obj *deviceIsisRouter) HasAdvanced() bool { + return obj.obj.Advanced != nil +} + +// Contains advance properties of an ISIS Router.. +// SetAdvanced sets the IsisAdvanced value in the DeviceIsisRouter object +func (obj *deviceIsisRouter) SetAdvanced(value IsisAdvanced) DeviceIsisRouter { + + obj.advancedHolder = nil + obj.obj.Advanced = value.msg() + + return obj +} + +// ISIS Router authentication properties. +// RouterAuth returns a IsisAuthentication +func (obj *deviceIsisRouter) RouterAuth() IsisAuthentication { + if obj.obj.RouterAuth == nil { + obj.obj.RouterAuth = NewIsisAuthentication().msg() + } + if obj.routerAuthHolder == nil { + obj.routerAuthHolder = &isisAuthentication{obj: obj.obj.RouterAuth} + } + return obj.routerAuthHolder +} + +// ISIS Router authentication properties. +// RouterAuth returns a IsisAuthentication +func (obj *deviceIsisRouter) HasRouterAuth() bool { + return obj.obj.RouterAuth != nil +} + +// ISIS Router authentication properties. +// SetRouterAuth sets the IsisAuthentication value in the DeviceIsisRouter object +func (obj *deviceIsisRouter) SetRouterAuth(value IsisAuthentication) DeviceIsisRouter { + + obj.routerAuthHolder = nil + obj.obj.RouterAuth = value.msg() + + return obj +} + +// Emulated ISIS IPv4 routes. +// V4Routes returns a []IsisV4RouteRange +func (obj *deviceIsisRouter) V4Routes() DeviceIsisRouterIsisV4RouteRangeIter { + if len(obj.obj.V4Routes) == 0 { + obj.obj.V4Routes = []*otg.IsisV4RouteRange{} + } + if obj.v4RoutesHolder == nil { + obj.v4RoutesHolder = newDeviceIsisRouterIsisV4RouteRangeIter(&obj.obj.V4Routes).setMsg(obj) + } + return obj.v4RoutesHolder +} + +type deviceIsisRouterIsisV4RouteRangeIter struct { + obj *deviceIsisRouter + isisV4RouteRangeSlice []IsisV4RouteRange + fieldPtr *[]*otg.IsisV4RouteRange +} + +func newDeviceIsisRouterIsisV4RouteRangeIter(ptr *[]*otg.IsisV4RouteRange) DeviceIsisRouterIsisV4RouteRangeIter { + return &deviceIsisRouterIsisV4RouteRangeIter{fieldPtr: ptr} +} + +type DeviceIsisRouterIsisV4RouteRangeIter interface { + setMsg(*deviceIsisRouter) DeviceIsisRouterIsisV4RouteRangeIter + Items() []IsisV4RouteRange + Add() IsisV4RouteRange + Append(items ...IsisV4RouteRange) DeviceIsisRouterIsisV4RouteRangeIter + Set(index int, newObj IsisV4RouteRange) DeviceIsisRouterIsisV4RouteRangeIter + Clear() DeviceIsisRouterIsisV4RouteRangeIter + clearHolderSlice() DeviceIsisRouterIsisV4RouteRangeIter + appendHolderSlice(item IsisV4RouteRange) DeviceIsisRouterIsisV4RouteRangeIter +} + +func (obj *deviceIsisRouterIsisV4RouteRangeIter) setMsg(msg *deviceIsisRouter) DeviceIsisRouterIsisV4RouteRangeIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisV4RouteRange{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceIsisRouterIsisV4RouteRangeIter) Items() []IsisV4RouteRange { + return obj.isisV4RouteRangeSlice +} + +func (obj *deviceIsisRouterIsisV4RouteRangeIter) Add() IsisV4RouteRange { + newObj := &otg.IsisV4RouteRange{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisV4RouteRange{obj: newObj} + newLibObj.setDefault() + obj.isisV4RouteRangeSlice = append(obj.isisV4RouteRangeSlice, newLibObj) + return newLibObj +} + +func (obj *deviceIsisRouterIsisV4RouteRangeIter) Append(items ...IsisV4RouteRange) DeviceIsisRouterIsisV4RouteRangeIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisV4RouteRangeSlice = append(obj.isisV4RouteRangeSlice, item) + } + return obj +} + +func (obj *deviceIsisRouterIsisV4RouteRangeIter) Set(index int, newObj IsisV4RouteRange) DeviceIsisRouterIsisV4RouteRangeIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisV4RouteRangeSlice[index] = newObj + return obj +} +func (obj *deviceIsisRouterIsisV4RouteRangeIter) Clear() DeviceIsisRouterIsisV4RouteRangeIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisV4RouteRange{} + obj.isisV4RouteRangeSlice = []IsisV4RouteRange{} + } + return obj +} +func (obj *deviceIsisRouterIsisV4RouteRangeIter) clearHolderSlice() DeviceIsisRouterIsisV4RouteRangeIter { + if len(obj.isisV4RouteRangeSlice) > 0 { + obj.isisV4RouteRangeSlice = []IsisV4RouteRange{} + } + return obj +} +func (obj *deviceIsisRouterIsisV4RouteRangeIter) appendHolderSlice(item IsisV4RouteRange) DeviceIsisRouterIsisV4RouteRangeIter { + obj.isisV4RouteRangeSlice = append(obj.isisV4RouteRangeSlice, item) + return obj +} + +// Emulated ISIS IPv6 routes. +// V6Routes returns a []IsisV6RouteRange +func (obj *deviceIsisRouter) V6Routes() DeviceIsisRouterIsisV6RouteRangeIter { + if len(obj.obj.V6Routes) == 0 { + obj.obj.V6Routes = []*otg.IsisV6RouteRange{} + } + if obj.v6RoutesHolder == nil { + obj.v6RoutesHolder = newDeviceIsisRouterIsisV6RouteRangeIter(&obj.obj.V6Routes).setMsg(obj) + } + return obj.v6RoutesHolder +} + +type deviceIsisRouterIsisV6RouteRangeIter struct { + obj *deviceIsisRouter + isisV6RouteRangeSlice []IsisV6RouteRange + fieldPtr *[]*otg.IsisV6RouteRange +} + +func newDeviceIsisRouterIsisV6RouteRangeIter(ptr *[]*otg.IsisV6RouteRange) DeviceIsisRouterIsisV6RouteRangeIter { + return &deviceIsisRouterIsisV6RouteRangeIter{fieldPtr: ptr} +} + +type DeviceIsisRouterIsisV6RouteRangeIter interface { + setMsg(*deviceIsisRouter) DeviceIsisRouterIsisV6RouteRangeIter + Items() []IsisV6RouteRange + Add() IsisV6RouteRange + Append(items ...IsisV6RouteRange) DeviceIsisRouterIsisV6RouteRangeIter + Set(index int, newObj IsisV6RouteRange) DeviceIsisRouterIsisV6RouteRangeIter + Clear() DeviceIsisRouterIsisV6RouteRangeIter + clearHolderSlice() DeviceIsisRouterIsisV6RouteRangeIter + appendHolderSlice(item IsisV6RouteRange) DeviceIsisRouterIsisV6RouteRangeIter +} + +func (obj *deviceIsisRouterIsisV6RouteRangeIter) setMsg(msg *deviceIsisRouter) DeviceIsisRouterIsisV6RouteRangeIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisV6RouteRange{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceIsisRouterIsisV6RouteRangeIter) Items() []IsisV6RouteRange { + return obj.isisV6RouteRangeSlice +} + +func (obj *deviceIsisRouterIsisV6RouteRangeIter) Add() IsisV6RouteRange { + newObj := &otg.IsisV6RouteRange{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisV6RouteRange{obj: newObj} + newLibObj.setDefault() + obj.isisV6RouteRangeSlice = append(obj.isisV6RouteRangeSlice, newLibObj) + return newLibObj +} + +func (obj *deviceIsisRouterIsisV6RouteRangeIter) Append(items ...IsisV6RouteRange) DeviceIsisRouterIsisV6RouteRangeIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisV6RouteRangeSlice = append(obj.isisV6RouteRangeSlice, item) + } + return obj +} + +func (obj *deviceIsisRouterIsisV6RouteRangeIter) Set(index int, newObj IsisV6RouteRange) DeviceIsisRouterIsisV6RouteRangeIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisV6RouteRangeSlice[index] = newObj + return obj +} +func (obj *deviceIsisRouterIsisV6RouteRangeIter) Clear() DeviceIsisRouterIsisV6RouteRangeIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisV6RouteRange{} + obj.isisV6RouteRangeSlice = []IsisV6RouteRange{} + } + return obj +} +func (obj *deviceIsisRouterIsisV6RouteRangeIter) clearHolderSlice() DeviceIsisRouterIsisV6RouteRangeIter { + if len(obj.isisV6RouteRangeSlice) > 0 { + obj.isisV6RouteRangeSlice = []IsisV6RouteRange{} + } + return obj +} +func (obj *deviceIsisRouterIsisV6RouteRangeIter) appendHolderSlice(item IsisV6RouteRange) DeviceIsisRouterIsisV6RouteRangeIter { + obj.isisV6RouteRangeSlice = append(obj.isisV6RouteRangeSlice, item) + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *deviceIsisRouter) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the DeviceIsisRouter object +func (obj *deviceIsisRouter) SetName(value string) DeviceIsisRouter { + + obj.obj.Name = &value + return obj +} + +func (obj *deviceIsisRouter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Instance != nil { + + obj.Instance().validateObj(vObj, set_default) + } + + // SystemId is required + if obj.obj.SystemId == nil { + vObj.validationErrors = append(vObj.validationErrors, "SystemId is required field on interface DeviceIsisRouter") + } + if obj.obj.SystemId != nil { + + err := obj.validateHex(obj.SystemId()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIsisRouter.SystemId")) + } + + } + + if len(obj.obj.Interfaces) != 0 { + + if set_default { + obj.Interfaces().clearHolderSlice() + for _, item := range obj.obj.Interfaces { + obj.Interfaces().appendHolderSlice(&isisInterface{obj: item}) + } + } + for _, item := range obj.Interfaces().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Basic != nil { + + obj.Basic().validateObj(vObj, set_default) + } + + if obj.obj.Advanced != nil { + + obj.Advanced().validateObj(vObj, set_default) + } + + if obj.obj.RouterAuth != nil { + + obj.RouterAuth().validateObj(vObj, set_default) + } + + if len(obj.obj.V4Routes) != 0 { + + if set_default { + obj.V4Routes().clearHolderSlice() + for _, item := range obj.obj.V4Routes { + obj.V4Routes().appendHolderSlice(&isisV4RouteRange{obj: item}) + } + } + for _, item := range obj.V4Routes().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.V6Routes) != 0 { + + if set_default { + obj.V6Routes().clearHolderSlice() + for _, item := range obj.obj.V6Routes { + obj.V6Routes().appendHolderSlice(&isisV6RouteRange{obj: item}) + } + } + for _, item := range obj.V6Routes().Items() { + item.validateObj(vObj, set_default) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceIsisRouter") + } +} + +func (obj *deviceIsisRouter) setDefault() { + +} diff --git a/gosnappi/device_rsvp.go b/gosnappi/device_rsvp.go new file mode 100644 index 00000000..873316a8 --- /dev/null +++ b/gosnappi/device_rsvp.go @@ -0,0 +1,523 @@ +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" +) + +// ***** DeviceRsvp ***** +type deviceRsvp struct { + validation + obj *otg.DeviceRsvp + marshaller marshalDeviceRsvp + unMarshaller unMarshalDeviceRsvp + ipv4InterfacesHolder DeviceRsvpRsvpIpv4InterfaceIter + lspIpv4InterfacesHolder DeviceRsvpRsvpLspIpv4InterfaceIter +} + +func NewDeviceRsvp() DeviceRsvp { + obj := deviceRsvp{obj: &otg.DeviceRsvp{}} + obj.setDefault() + return &obj +} + +func (obj *deviceRsvp) msg() *otg.DeviceRsvp { + return obj.obj +} + +func (obj *deviceRsvp) setMsg(msg *otg.DeviceRsvp) DeviceRsvp { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceRsvp struct { + obj *deviceRsvp +} + +type marshalDeviceRsvp interface { + // ToProto marshals DeviceRsvp to protobuf object *otg.DeviceRsvp + ToProto() (*otg.DeviceRsvp, error) + // ToPbText marshals DeviceRsvp to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceRsvp to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceRsvp to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceRsvp struct { + obj *deviceRsvp +} + +type unMarshalDeviceRsvp interface { + // FromProto unmarshals DeviceRsvp from protobuf object *otg.DeviceRsvp + FromProto(msg *otg.DeviceRsvp) (DeviceRsvp, error) + // FromPbText unmarshals DeviceRsvp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceRsvp from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceRsvp from JSON text + FromJson(value string) error +} + +func (obj *deviceRsvp) Marshal() marshalDeviceRsvp { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceRsvp{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceRsvp) Unmarshal() unMarshalDeviceRsvp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceRsvp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceRsvp) ToProto() (*otg.DeviceRsvp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceRsvp) FromProto(msg *otg.DeviceRsvp) (DeviceRsvp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceRsvp) 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 *unMarshaldeviceRsvp) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshaldeviceRsvp) 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 *unMarshaldeviceRsvp) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshaldeviceRsvp) 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 *unMarshaldeviceRsvp) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *deviceRsvp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceRsvp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceRsvp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceRsvp) Clone() (DeviceRsvp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceRsvp() + 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 +} + +func (obj *deviceRsvp) setNil() { + obj.ipv4InterfacesHolder = nil + obj.lspIpv4InterfacesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// DeviceRsvp is configuration for one or more RSVP interfaces, ingress and egress LSPs. In this model, currently IPv4 RSVP and point-to-point LSPs are supported as per RFC3209 and related specifications. +type DeviceRsvp interface { + Validation + // msg marshals DeviceRsvp to protobuf object *otg.DeviceRsvp + // and doesn't set defaults + msg() *otg.DeviceRsvp + // setMsg unmarshals DeviceRsvp from protobuf object *otg.DeviceRsvp + // and doesn't set defaults + setMsg(*otg.DeviceRsvp) DeviceRsvp + // provides marshal interface + Marshal() marshalDeviceRsvp + // provides unmarshal interface + Unmarshal() unMarshalDeviceRsvp + // validate validates DeviceRsvp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceRsvp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv4Interfaces returns DeviceRsvpRsvpIpv4InterfaceIterIter, set in DeviceRsvp + Ipv4Interfaces() DeviceRsvpRsvpIpv4InterfaceIter + // LspIpv4Interfaces returns DeviceRsvpRsvpLspIpv4InterfaceIterIter, set in DeviceRsvp + LspIpv4Interfaces() DeviceRsvpRsvpLspIpv4InterfaceIter + // Name returns string, set in DeviceRsvp. + Name() string + // SetName assigns string provided by user to DeviceRsvp + SetName(value string) DeviceRsvp + // HasName checks if Name has been set in DeviceRsvp + HasName() bool + setNil() +} + +// List of IPv4 RSVP connected interfaces. At least one interface should be present for device connected to the DUT. For unconnected devices, this array must be empty. +// Ipv4Interfaces returns a []RsvpIpv4Interface +func (obj *deviceRsvp) Ipv4Interfaces() DeviceRsvpRsvpIpv4InterfaceIter { + if len(obj.obj.Ipv4Interfaces) == 0 { + obj.obj.Ipv4Interfaces = []*otg.RsvpIpv4Interface{} + } + if obj.ipv4InterfacesHolder == nil { + obj.ipv4InterfacesHolder = newDeviceRsvpRsvpIpv4InterfaceIter(&obj.obj.Ipv4Interfaces).setMsg(obj) + } + return obj.ipv4InterfacesHolder +} + +type deviceRsvpRsvpIpv4InterfaceIter struct { + obj *deviceRsvp + rsvpIpv4InterfaceSlice []RsvpIpv4Interface + fieldPtr *[]*otg.RsvpIpv4Interface +} + +func newDeviceRsvpRsvpIpv4InterfaceIter(ptr *[]*otg.RsvpIpv4Interface) DeviceRsvpRsvpIpv4InterfaceIter { + return &deviceRsvpRsvpIpv4InterfaceIter{fieldPtr: ptr} +} + +type DeviceRsvpRsvpIpv4InterfaceIter interface { + setMsg(*deviceRsvp) DeviceRsvpRsvpIpv4InterfaceIter + Items() []RsvpIpv4Interface + Add() RsvpIpv4Interface + Append(items ...RsvpIpv4Interface) DeviceRsvpRsvpIpv4InterfaceIter + Set(index int, newObj RsvpIpv4Interface) DeviceRsvpRsvpIpv4InterfaceIter + Clear() DeviceRsvpRsvpIpv4InterfaceIter + clearHolderSlice() DeviceRsvpRsvpIpv4InterfaceIter + appendHolderSlice(item RsvpIpv4Interface) DeviceRsvpRsvpIpv4InterfaceIter +} + +func (obj *deviceRsvpRsvpIpv4InterfaceIter) setMsg(msg *deviceRsvp) DeviceRsvpRsvpIpv4InterfaceIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&rsvpIpv4Interface{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceRsvpRsvpIpv4InterfaceIter) Items() []RsvpIpv4Interface { + return obj.rsvpIpv4InterfaceSlice +} + +func (obj *deviceRsvpRsvpIpv4InterfaceIter) Add() RsvpIpv4Interface { + newObj := &otg.RsvpIpv4Interface{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &rsvpIpv4Interface{obj: newObj} + newLibObj.setDefault() + obj.rsvpIpv4InterfaceSlice = append(obj.rsvpIpv4InterfaceSlice, newLibObj) + return newLibObj +} + +func (obj *deviceRsvpRsvpIpv4InterfaceIter) Append(items ...RsvpIpv4Interface) DeviceRsvpRsvpIpv4InterfaceIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.rsvpIpv4InterfaceSlice = append(obj.rsvpIpv4InterfaceSlice, item) + } + return obj +} + +func (obj *deviceRsvpRsvpIpv4InterfaceIter) Set(index int, newObj RsvpIpv4Interface) DeviceRsvpRsvpIpv4InterfaceIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.rsvpIpv4InterfaceSlice[index] = newObj + return obj +} +func (obj *deviceRsvpRsvpIpv4InterfaceIter) Clear() DeviceRsvpRsvpIpv4InterfaceIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.RsvpIpv4Interface{} + obj.rsvpIpv4InterfaceSlice = []RsvpIpv4Interface{} + } + return obj +} +func (obj *deviceRsvpRsvpIpv4InterfaceIter) clearHolderSlice() DeviceRsvpRsvpIpv4InterfaceIter { + if len(obj.rsvpIpv4InterfaceSlice) > 0 { + obj.rsvpIpv4InterfaceSlice = []RsvpIpv4Interface{} + } + return obj +} +func (obj *deviceRsvpRsvpIpv4InterfaceIter) appendHolderSlice(item RsvpIpv4Interface) DeviceRsvpRsvpIpv4InterfaceIter { + obj.rsvpIpv4InterfaceSlice = append(obj.rsvpIpv4InterfaceSlice, item) + return obj +} + +// List of IPv4 Loopback or IPv4 connected interfaces acting as RSVP ingress and egress endpoints. +// LspIpv4Interfaces returns a []RsvpLspIpv4Interface +func (obj *deviceRsvp) LspIpv4Interfaces() DeviceRsvpRsvpLspIpv4InterfaceIter { + if len(obj.obj.LspIpv4Interfaces) == 0 { + obj.obj.LspIpv4Interfaces = []*otg.RsvpLspIpv4Interface{} + } + if obj.lspIpv4InterfacesHolder == nil { + obj.lspIpv4InterfacesHolder = newDeviceRsvpRsvpLspIpv4InterfaceIter(&obj.obj.LspIpv4Interfaces).setMsg(obj) + } + return obj.lspIpv4InterfacesHolder +} + +type deviceRsvpRsvpLspIpv4InterfaceIter struct { + obj *deviceRsvp + rsvpLspIpv4InterfaceSlice []RsvpLspIpv4Interface + fieldPtr *[]*otg.RsvpLspIpv4Interface +} + +func newDeviceRsvpRsvpLspIpv4InterfaceIter(ptr *[]*otg.RsvpLspIpv4Interface) DeviceRsvpRsvpLspIpv4InterfaceIter { + return &deviceRsvpRsvpLspIpv4InterfaceIter{fieldPtr: ptr} +} + +type DeviceRsvpRsvpLspIpv4InterfaceIter interface { + setMsg(*deviceRsvp) DeviceRsvpRsvpLspIpv4InterfaceIter + Items() []RsvpLspIpv4Interface + Add() RsvpLspIpv4Interface + Append(items ...RsvpLspIpv4Interface) DeviceRsvpRsvpLspIpv4InterfaceIter + Set(index int, newObj RsvpLspIpv4Interface) DeviceRsvpRsvpLspIpv4InterfaceIter + Clear() DeviceRsvpRsvpLspIpv4InterfaceIter + clearHolderSlice() DeviceRsvpRsvpLspIpv4InterfaceIter + appendHolderSlice(item RsvpLspIpv4Interface) DeviceRsvpRsvpLspIpv4InterfaceIter +} + +func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) setMsg(msg *deviceRsvp) DeviceRsvpRsvpLspIpv4InterfaceIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&rsvpLspIpv4Interface{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) Items() []RsvpLspIpv4Interface { + return obj.rsvpLspIpv4InterfaceSlice +} + +func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) Add() RsvpLspIpv4Interface { + newObj := &otg.RsvpLspIpv4Interface{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &rsvpLspIpv4Interface{obj: newObj} + newLibObj.setDefault() + obj.rsvpLspIpv4InterfaceSlice = append(obj.rsvpLspIpv4InterfaceSlice, newLibObj) + return newLibObj +} + +func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) Append(items ...RsvpLspIpv4Interface) DeviceRsvpRsvpLspIpv4InterfaceIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.rsvpLspIpv4InterfaceSlice = append(obj.rsvpLspIpv4InterfaceSlice, item) + } + return obj +} + +func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) Set(index int, newObj RsvpLspIpv4Interface) DeviceRsvpRsvpLspIpv4InterfaceIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.rsvpLspIpv4InterfaceSlice[index] = newObj + return obj +} +func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) Clear() DeviceRsvpRsvpLspIpv4InterfaceIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.RsvpLspIpv4Interface{} + obj.rsvpLspIpv4InterfaceSlice = []RsvpLspIpv4Interface{} + } + return obj +} +func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) clearHolderSlice() DeviceRsvpRsvpLspIpv4InterfaceIter { + if len(obj.rsvpLspIpv4InterfaceSlice) > 0 { + obj.rsvpLspIpv4InterfaceSlice = []RsvpLspIpv4Interface{} + } + return obj +} +func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) appendHolderSlice(item RsvpLspIpv4Interface) DeviceRsvpRsvpLspIpv4InterfaceIter { + obj.rsvpLspIpv4InterfaceSlice = append(obj.rsvpLspIpv4InterfaceSlice, item) + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *deviceRsvp) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *deviceRsvp) HasName() bool { + return obj.obj.Name != nil +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the DeviceRsvp object +func (obj *deviceRsvp) SetName(value string) DeviceRsvp { + + obj.obj.Name = &value + return obj +} + +func (obj *deviceRsvp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Ipv4Interfaces) != 0 { + + if set_default { + obj.Ipv4Interfaces().clearHolderSlice() + for _, item := range obj.obj.Ipv4Interfaces { + obj.Ipv4Interfaces().appendHolderSlice(&rsvpIpv4Interface{obj: item}) + } + } + for _, item := range obj.Ipv4Interfaces().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.LspIpv4Interfaces) != 0 { + + if set_default { + obj.LspIpv4Interfaces().clearHolderSlice() + for _, item := range obj.obj.LspIpv4Interfaces { + obj.LspIpv4Interfaces().appendHolderSlice(&rsvpLspIpv4Interface{obj: item}) + } + } + for _, item := range obj.LspIpv4Interfaces().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *deviceRsvp) setDefault() { + +} diff --git a/gosnappi/device_vlan.go b/gosnappi/device_vlan.go new file mode 100644 index 00000000..d40a4704 --- /dev/null +++ b/gosnappi/device_vlan.go @@ -0,0 +1,434 @@ +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" +) + +// ***** DeviceVlan ***** +type deviceVlan struct { + validation + obj *otg.DeviceVlan + marshaller marshalDeviceVlan + unMarshaller unMarshalDeviceVlan +} + +func NewDeviceVlan() DeviceVlan { + obj := deviceVlan{obj: &otg.DeviceVlan{}} + obj.setDefault() + return &obj +} + +func (obj *deviceVlan) msg() *otg.DeviceVlan { + return obj.obj +} + +func (obj *deviceVlan) setMsg(msg *otg.DeviceVlan) DeviceVlan { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceVlan struct { + obj *deviceVlan +} + +type marshalDeviceVlan interface { + // ToProto marshals DeviceVlan to protobuf object *otg.DeviceVlan + ToProto() (*otg.DeviceVlan, error) + // ToPbText marshals DeviceVlan to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceVlan to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceVlan to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceVlan struct { + obj *deviceVlan +} + +type unMarshalDeviceVlan interface { + // FromProto unmarshals DeviceVlan from protobuf object *otg.DeviceVlan + FromProto(msg *otg.DeviceVlan) (DeviceVlan, error) + // FromPbText unmarshals DeviceVlan from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceVlan from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceVlan from JSON text + FromJson(value string) error +} + +func (obj *deviceVlan) Marshal() marshalDeviceVlan { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceVlan{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceVlan) Unmarshal() unMarshalDeviceVlan { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceVlan{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceVlan) ToProto() (*otg.DeviceVlan, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceVlan) FromProto(msg *otg.DeviceVlan) (DeviceVlan, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceVlan) 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 *unMarshaldeviceVlan) 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 *marshaldeviceVlan) 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 *unMarshaldeviceVlan) 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 *marshaldeviceVlan) 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 *unMarshaldeviceVlan) 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 *deviceVlan) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceVlan) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceVlan) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceVlan) Clone() (DeviceVlan, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceVlan() + 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 +} + +// DeviceVlan is emulated VLAN protocol. +type DeviceVlan interface { + Validation + // msg marshals DeviceVlan to protobuf object *otg.DeviceVlan + // and doesn't set defaults + msg() *otg.DeviceVlan + // setMsg unmarshals DeviceVlan from protobuf object *otg.DeviceVlan + // and doesn't set defaults + setMsg(*otg.DeviceVlan) DeviceVlan + // provides marshal interface + Marshal() marshalDeviceVlan + // provides unmarshal interface + Unmarshal() unMarshalDeviceVlan + // validate validates DeviceVlan + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceVlan, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Tpid returns DeviceVlanTpidEnum, set in DeviceVlan + Tpid() DeviceVlanTpidEnum + // SetTpid assigns DeviceVlanTpidEnum provided by user to DeviceVlan + SetTpid(value DeviceVlanTpidEnum) DeviceVlan + // HasTpid checks if Tpid has been set in DeviceVlan + HasTpid() bool + // Priority returns uint32, set in DeviceVlan. + Priority() uint32 + // SetPriority assigns uint32 provided by user to DeviceVlan + SetPriority(value uint32) DeviceVlan + // HasPriority checks if Priority has been set in DeviceVlan + HasPriority() bool + // Id returns uint32, set in DeviceVlan. + Id() uint32 + // SetId assigns uint32 provided by user to DeviceVlan + SetId(value uint32) DeviceVlan + // HasId checks if Id has been set in DeviceVlan + HasId() bool + // Name returns string, set in DeviceVlan. + Name() string + // SetName assigns string provided by user to DeviceVlan + SetName(value string) DeviceVlan +} + +type DeviceVlanTpidEnum string + +// Enum of Tpid on DeviceVlan +var DeviceVlanTpid = struct { + X8100 DeviceVlanTpidEnum + X88A8 DeviceVlanTpidEnum + X9100 DeviceVlanTpidEnum + X9200 DeviceVlanTpidEnum + X9300 DeviceVlanTpidEnum +}{ + X8100: DeviceVlanTpidEnum("x8100"), + X88A8: DeviceVlanTpidEnum("x88A8"), + X9100: DeviceVlanTpidEnum("x9100"), + X9200: DeviceVlanTpidEnum("x9200"), + X9300: DeviceVlanTpidEnum("x9300"), +} + +func (obj *deviceVlan) Tpid() DeviceVlanTpidEnum { + return DeviceVlanTpidEnum(obj.obj.Tpid.Enum().String()) +} + +// Tag protocol identifier +// Tpid returns a string +func (obj *deviceVlan) HasTpid() bool { + return obj.obj.Tpid != nil +} + +func (obj *deviceVlan) SetTpid(value DeviceVlanTpidEnum) DeviceVlan { + intValue, ok := otg.DeviceVlan_Tpid_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on DeviceVlanTpidEnum", string(value))) + return obj + } + enumValue := otg.DeviceVlan_Tpid_Enum(intValue) + obj.obj.Tpid = &enumValue + + return obj +} + +// Priority code point +// Priority returns a uint32 +func (obj *deviceVlan) Priority() uint32 { + + return *obj.obj.Priority + +} + +// Priority code point +// Priority returns a uint32 +func (obj *deviceVlan) HasPriority() bool { + return obj.obj.Priority != nil +} + +// Priority code point +// SetPriority sets the uint32 value in the DeviceVlan object +func (obj *deviceVlan) SetPriority(value uint32) DeviceVlan { + + obj.obj.Priority = &value + return obj +} + +// VLAN identifier +// Id returns a uint32 +func (obj *deviceVlan) Id() uint32 { + + return *obj.obj.Id + +} + +// VLAN identifier +// Id returns a uint32 +func (obj *deviceVlan) HasId() bool { + return obj.obj.Id != nil +} + +// VLAN identifier +// SetId sets the uint32 value in the DeviceVlan object +func (obj *deviceVlan) SetId(value uint32) DeviceVlan { + + obj.obj.Id = &value + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *deviceVlan) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the DeviceVlan object +func (obj *deviceVlan) SetName(value string) DeviceVlan { + + obj.obj.Name = &value + return obj +} + +func (obj *deviceVlan) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Priority != nil { + + if *obj.obj.Priority > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= DeviceVlan.Priority <= 3 but Got %d", *obj.obj.Priority)) + } + + } + + if obj.obj.Id != nil { + + if *obj.obj.Id > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= DeviceVlan.Id <= 4095 but Got %d", *obj.obj.Id)) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceVlan") + } +} + +func (obj *deviceVlan) setDefault() { + if obj.obj.Tpid == nil { + obj.SetTpid(DeviceVlanTpid.X8100) + + } + if obj.obj.Priority == nil { + obj.SetPriority(0) + } + if obj.obj.Id == nil { + obj.SetId(1) + } + +} diff --git a/gosnappi/device_vxlan.go b/gosnappi/device_vxlan.go new file mode 100644 index 00000000..c9986241 --- /dev/null +++ b/gosnappi/device_vxlan.go @@ -0,0 +1,495 @@ +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" +) + +// ***** DeviceVxlan ***** +type deviceVxlan struct { + validation + obj *otg.DeviceVxlan + marshaller marshalDeviceVxlan + unMarshaller unMarshalDeviceVxlan + v4TunnelsHolder DeviceVxlanVxlanV4TunnelIter + v6TunnelsHolder DeviceVxlanVxlanV6TunnelIter +} + +func NewDeviceVxlan() DeviceVxlan { + obj := deviceVxlan{obj: &otg.DeviceVxlan{}} + obj.setDefault() + return &obj +} + +func (obj *deviceVxlan) msg() *otg.DeviceVxlan { + return obj.obj +} + +func (obj *deviceVxlan) setMsg(msg *otg.DeviceVxlan) DeviceVxlan { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldeviceVxlan struct { + obj *deviceVxlan +} + +type marshalDeviceVxlan interface { + // ToProto marshals DeviceVxlan to protobuf object *otg.DeviceVxlan + ToProto() (*otg.DeviceVxlan, error) + // ToPbText marshals DeviceVxlan to protobuf text + ToPbText() (string, error) + // ToYaml marshals DeviceVxlan to YAML text + ToYaml() (string, error) + // ToJson marshals DeviceVxlan to JSON text + ToJson() (string, error) +} + +type unMarshaldeviceVxlan struct { + obj *deviceVxlan +} + +type unMarshalDeviceVxlan interface { + // FromProto unmarshals DeviceVxlan from protobuf object *otg.DeviceVxlan + FromProto(msg *otg.DeviceVxlan) (DeviceVxlan, error) + // FromPbText unmarshals DeviceVxlan from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DeviceVxlan from YAML text + FromYaml(value string) error + // FromJson unmarshals DeviceVxlan from JSON text + FromJson(value string) error +} + +func (obj *deviceVxlan) Marshal() marshalDeviceVxlan { + if obj.marshaller == nil { + obj.marshaller = &marshaldeviceVxlan{obj: obj} + } + return obj.marshaller +} + +func (obj *deviceVxlan) Unmarshal() unMarshalDeviceVxlan { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldeviceVxlan{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldeviceVxlan) ToProto() (*otg.DeviceVxlan, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldeviceVxlan) FromProto(msg *otg.DeviceVxlan) (DeviceVxlan, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldeviceVxlan) 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 *unMarshaldeviceVxlan) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshaldeviceVxlan) 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 *unMarshaldeviceVxlan) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshaldeviceVxlan) 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 *unMarshaldeviceVxlan) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *deviceVxlan) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *deviceVxlan) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *deviceVxlan) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *deviceVxlan) Clone() (DeviceVxlan, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDeviceVxlan() + 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 +} + +func (obj *deviceVxlan) setNil() { + obj.v4TunnelsHolder = nil + obj.v6TunnelsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// DeviceVxlan is description is TBD +type DeviceVxlan interface { + Validation + // msg marshals DeviceVxlan to protobuf object *otg.DeviceVxlan + // and doesn't set defaults + msg() *otg.DeviceVxlan + // setMsg unmarshals DeviceVxlan from protobuf object *otg.DeviceVxlan + // and doesn't set defaults + setMsg(*otg.DeviceVxlan) DeviceVxlan + // provides marshal interface + Marshal() marshalDeviceVxlan + // provides unmarshal interface + Unmarshal() unMarshalDeviceVxlan + // validate validates DeviceVxlan + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DeviceVxlan, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // V4Tunnels returns DeviceVxlanVxlanV4TunnelIterIter, set in DeviceVxlan + V4Tunnels() DeviceVxlanVxlanV4TunnelIter + // V6Tunnels returns DeviceVxlanVxlanV6TunnelIterIter, set in DeviceVxlan + V6Tunnels() DeviceVxlanVxlanV6TunnelIter + setNil() +} + +// IPv4 VXLAN Tunnels +// V4Tunnels returns a []VxlanV4Tunnel +func (obj *deviceVxlan) V4Tunnels() DeviceVxlanVxlanV4TunnelIter { + if len(obj.obj.V4Tunnels) == 0 { + obj.obj.V4Tunnels = []*otg.VxlanV4Tunnel{} + } + if obj.v4TunnelsHolder == nil { + obj.v4TunnelsHolder = newDeviceVxlanVxlanV4TunnelIter(&obj.obj.V4Tunnels).setMsg(obj) + } + return obj.v4TunnelsHolder +} + +type deviceVxlanVxlanV4TunnelIter struct { + obj *deviceVxlan + vxlanV4TunnelSlice []VxlanV4Tunnel + fieldPtr *[]*otg.VxlanV4Tunnel +} + +func newDeviceVxlanVxlanV4TunnelIter(ptr *[]*otg.VxlanV4Tunnel) DeviceVxlanVxlanV4TunnelIter { + return &deviceVxlanVxlanV4TunnelIter{fieldPtr: ptr} +} + +type DeviceVxlanVxlanV4TunnelIter interface { + setMsg(*deviceVxlan) DeviceVxlanVxlanV4TunnelIter + Items() []VxlanV4Tunnel + Add() VxlanV4Tunnel + Append(items ...VxlanV4Tunnel) DeviceVxlanVxlanV4TunnelIter + Set(index int, newObj VxlanV4Tunnel) DeviceVxlanVxlanV4TunnelIter + Clear() DeviceVxlanVxlanV4TunnelIter + clearHolderSlice() DeviceVxlanVxlanV4TunnelIter + appendHolderSlice(item VxlanV4Tunnel) DeviceVxlanVxlanV4TunnelIter +} + +func (obj *deviceVxlanVxlanV4TunnelIter) setMsg(msg *deviceVxlan) DeviceVxlanVxlanV4TunnelIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&vxlanV4Tunnel{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceVxlanVxlanV4TunnelIter) Items() []VxlanV4Tunnel { + return obj.vxlanV4TunnelSlice +} + +func (obj *deviceVxlanVxlanV4TunnelIter) Add() VxlanV4Tunnel { + newObj := &otg.VxlanV4Tunnel{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &vxlanV4Tunnel{obj: newObj} + newLibObj.setDefault() + obj.vxlanV4TunnelSlice = append(obj.vxlanV4TunnelSlice, newLibObj) + return newLibObj +} + +func (obj *deviceVxlanVxlanV4TunnelIter) Append(items ...VxlanV4Tunnel) DeviceVxlanVxlanV4TunnelIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.vxlanV4TunnelSlice = append(obj.vxlanV4TunnelSlice, item) + } + return obj +} + +func (obj *deviceVxlanVxlanV4TunnelIter) Set(index int, newObj VxlanV4Tunnel) DeviceVxlanVxlanV4TunnelIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.vxlanV4TunnelSlice[index] = newObj + return obj +} +func (obj *deviceVxlanVxlanV4TunnelIter) Clear() DeviceVxlanVxlanV4TunnelIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.VxlanV4Tunnel{} + obj.vxlanV4TunnelSlice = []VxlanV4Tunnel{} + } + return obj +} +func (obj *deviceVxlanVxlanV4TunnelIter) clearHolderSlice() DeviceVxlanVxlanV4TunnelIter { + if len(obj.vxlanV4TunnelSlice) > 0 { + obj.vxlanV4TunnelSlice = []VxlanV4Tunnel{} + } + return obj +} +func (obj *deviceVxlanVxlanV4TunnelIter) appendHolderSlice(item VxlanV4Tunnel) DeviceVxlanVxlanV4TunnelIter { + obj.vxlanV4TunnelSlice = append(obj.vxlanV4TunnelSlice, item) + return obj +} + +// IPv6 VXLAN Tunnels +// V6Tunnels returns a []VxlanV6Tunnel +func (obj *deviceVxlan) V6Tunnels() DeviceVxlanVxlanV6TunnelIter { + if len(obj.obj.V6Tunnels) == 0 { + obj.obj.V6Tunnels = []*otg.VxlanV6Tunnel{} + } + if obj.v6TunnelsHolder == nil { + obj.v6TunnelsHolder = newDeviceVxlanVxlanV6TunnelIter(&obj.obj.V6Tunnels).setMsg(obj) + } + return obj.v6TunnelsHolder +} + +type deviceVxlanVxlanV6TunnelIter struct { + obj *deviceVxlan + vxlanV6TunnelSlice []VxlanV6Tunnel + fieldPtr *[]*otg.VxlanV6Tunnel +} + +func newDeviceVxlanVxlanV6TunnelIter(ptr *[]*otg.VxlanV6Tunnel) DeviceVxlanVxlanV6TunnelIter { + return &deviceVxlanVxlanV6TunnelIter{fieldPtr: ptr} +} + +type DeviceVxlanVxlanV6TunnelIter interface { + setMsg(*deviceVxlan) DeviceVxlanVxlanV6TunnelIter + Items() []VxlanV6Tunnel + Add() VxlanV6Tunnel + Append(items ...VxlanV6Tunnel) DeviceVxlanVxlanV6TunnelIter + Set(index int, newObj VxlanV6Tunnel) DeviceVxlanVxlanV6TunnelIter + Clear() DeviceVxlanVxlanV6TunnelIter + clearHolderSlice() DeviceVxlanVxlanV6TunnelIter + appendHolderSlice(item VxlanV6Tunnel) DeviceVxlanVxlanV6TunnelIter +} + +func (obj *deviceVxlanVxlanV6TunnelIter) setMsg(msg *deviceVxlan) DeviceVxlanVxlanV6TunnelIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&vxlanV6Tunnel{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *deviceVxlanVxlanV6TunnelIter) Items() []VxlanV6Tunnel { + return obj.vxlanV6TunnelSlice +} + +func (obj *deviceVxlanVxlanV6TunnelIter) Add() VxlanV6Tunnel { + newObj := &otg.VxlanV6Tunnel{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &vxlanV6Tunnel{obj: newObj} + newLibObj.setDefault() + obj.vxlanV6TunnelSlice = append(obj.vxlanV6TunnelSlice, newLibObj) + return newLibObj +} + +func (obj *deviceVxlanVxlanV6TunnelIter) Append(items ...VxlanV6Tunnel) DeviceVxlanVxlanV6TunnelIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.vxlanV6TunnelSlice = append(obj.vxlanV6TunnelSlice, item) + } + return obj +} + +func (obj *deviceVxlanVxlanV6TunnelIter) Set(index int, newObj VxlanV6Tunnel) DeviceVxlanVxlanV6TunnelIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.vxlanV6TunnelSlice[index] = newObj + return obj +} +func (obj *deviceVxlanVxlanV6TunnelIter) Clear() DeviceVxlanVxlanV6TunnelIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.VxlanV6Tunnel{} + obj.vxlanV6TunnelSlice = []VxlanV6Tunnel{} + } + return obj +} +func (obj *deviceVxlanVxlanV6TunnelIter) clearHolderSlice() DeviceVxlanVxlanV6TunnelIter { + if len(obj.vxlanV6TunnelSlice) > 0 { + obj.vxlanV6TunnelSlice = []VxlanV6Tunnel{} + } + return obj +} +func (obj *deviceVxlanVxlanV6TunnelIter) appendHolderSlice(item VxlanV6Tunnel) DeviceVxlanVxlanV6TunnelIter { + obj.vxlanV6TunnelSlice = append(obj.vxlanV6TunnelSlice, item) + return obj +} + +func (obj *deviceVxlan) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.V4Tunnels) != 0 { + + if set_default { + obj.V4Tunnels().clearHolderSlice() + for _, item := range obj.obj.V4Tunnels { + obj.V4Tunnels().appendHolderSlice(&vxlanV4Tunnel{obj: item}) + } + } + for _, item := range obj.V4Tunnels().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.V6Tunnels) != 0 { + + if set_default { + obj.V6Tunnels().clearHolderSlice() + for _, item := range obj.obj.V6Tunnels { + obj.V6Tunnels().appendHolderSlice(&vxlanV6Tunnel{obj: item}) + } + } + for _, item := range obj.V6Tunnels().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *deviceVxlan) setDefault() { + +} diff --git a/gosnappi/dhcp_server_v4.go b/gosnappi/dhcp_server_v4.go new file mode 100644 index 00000000..999d73c9 --- /dev/null +++ b/gosnappi/dhcp_server_v4.go @@ -0,0 +1,454 @@ +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" +) + +// ***** DhcpServerV4 ***** +type dhcpServerV4 struct { + validation + obj *otg.DhcpServerV4 + marshaller marshalDhcpServerV4 + unMarshaller unMarshalDhcpServerV4 + addressPoolsHolder DhcpServerV4DhcpServerV4PoolIter +} + +func NewDhcpServerV4() DhcpServerV4 { + obj := dhcpServerV4{obj: &otg.DhcpServerV4{}} + obj.setDefault() + return &obj +} + +func (obj *dhcpServerV4) msg() *otg.DhcpServerV4 { + return obj.obj +} + +func (obj *dhcpServerV4) setMsg(msg *otg.DhcpServerV4) DhcpServerV4 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldhcpServerV4 struct { + obj *dhcpServerV4 +} + +type marshalDhcpServerV4 interface { + // ToProto marshals DhcpServerV4 to protobuf object *otg.DhcpServerV4 + ToProto() (*otg.DhcpServerV4, error) + // ToPbText marshals DhcpServerV4 to protobuf text + ToPbText() (string, error) + // ToYaml marshals DhcpServerV4 to YAML text + ToYaml() (string, error) + // ToJson marshals DhcpServerV4 to JSON text + ToJson() (string, error) +} + +type unMarshaldhcpServerV4 struct { + obj *dhcpServerV4 +} + +type unMarshalDhcpServerV4 interface { + // FromProto unmarshals DhcpServerV4 from protobuf object *otg.DhcpServerV4 + FromProto(msg *otg.DhcpServerV4) (DhcpServerV4, error) + // FromPbText unmarshals DhcpServerV4 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DhcpServerV4 from YAML text + FromYaml(value string) error + // FromJson unmarshals DhcpServerV4 from JSON text + FromJson(value string) error +} + +func (obj *dhcpServerV4) Marshal() marshalDhcpServerV4 { + if obj.marshaller == nil { + obj.marshaller = &marshaldhcpServerV4{obj: obj} + } + return obj.marshaller +} + +func (obj *dhcpServerV4) Unmarshal() unMarshalDhcpServerV4 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldhcpServerV4{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldhcpServerV4) ToProto() (*otg.DhcpServerV4, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldhcpServerV4) FromProto(msg *otg.DhcpServerV4) (DhcpServerV4, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldhcpServerV4) 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 *unMarshaldhcpServerV4) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshaldhcpServerV4) 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 *unMarshaldhcpServerV4) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshaldhcpServerV4) 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 *unMarshaldhcpServerV4) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *dhcpServerV4) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *dhcpServerV4) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *dhcpServerV4) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *dhcpServerV4) Clone() (DhcpServerV4, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDhcpServerV4() + 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 +} + +func (obj *dhcpServerV4) setNil() { + obj.addressPoolsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// DhcpServerV4 is configuration for emulated DHCPv4 Server. +type DhcpServerV4 interface { + Validation + // msg marshals DhcpServerV4 to protobuf object *otg.DhcpServerV4 + // and doesn't set defaults + msg() *otg.DhcpServerV4 + // setMsg unmarshals DhcpServerV4 from protobuf object *otg.DhcpServerV4 + // and doesn't set defaults + setMsg(*otg.DhcpServerV4) DhcpServerV4 + // provides marshal interface + Marshal() marshalDhcpServerV4 + // provides unmarshal interface + Unmarshal() unMarshalDhcpServerV4 + // validate validates DhcpServerV4 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DhcpServerV4, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in DhcpServerV4. + Name() string + // SetName assigns string provided by user to DhcpServerV4 + SetName(value string) DhcpServerV4 + // Ipv4Name returns string, set in DhcpServerV4. + Ipv4Name() string + // SetIpv4Name assigns string provided by user to DhcpServerV4 + SetIpv4Name(value string) DhcpServerV4 + // AddressPools returns DhcpServerV4DhcpServerV4PoolIterIter, set in DhcpServerV4 + AddressPools() DhcpServerV4DhcpServerV4PoolIter + setNil() +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *dhcpServerV4) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the DhcpServerV4 object +func (obj *dhcpServerV4) SetName(value string) DhcpServerV4 { + + obj.obj.Name = &value + return obj +} + +// The unique name of the IPv4 on which DHCPv4 server will run. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// Ipv4Name returns a string +func (obj *dhcpServerV4) Ipv4Name() string { + + return *obj.obj.Ipv4Name + +} + +// The unique name of the IPv4 on which DHCPv4 server will run. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// SetIpv4Name sets the string value in the DhcpServerV4 object +func (obj *dhcpServerV4) SetIpv4Name(value string) DhcpServerV4 { + + obj.obj.Ipv4Name = &value + return obj +} + +// List of DHCPv4 Server Lease parameters +// AddressPools returns a []DhcpServerV4Pool +func (obj *dhcpServerV4) AddressPools() DhcpServerV4DhcpServerV4PoolIter { + if len(obj.obj.AddressPools) == 0 { + obj.obj.AddressPools = []*otg.DhcpServerV4Pool{} + } + if obj.addressPoolsHolder == nil { + obj.addressPoolsHolder = newDhcpServerV4DhcpServerV4PoolIter(&obj.obj.AddressPools).setMsg(obj) + } + return obj.addressPoolsHolder +} + +type dhcpServerV4DhcpServerV4PoolIter struct { + obj *dhcpServerV4 + dhcpServerV4PoolSlice []DhcpServerV4Pool + fieldPtr *[]*otg.DhcpServerV4Pool +} + +func newDhcpServerV4DhcpServerV4PoolIter(ptr *[]*otg.DhcpServerV4Pool) DhcpServerV4DhcpServerV4PoolIter { + return &dhcpServerV4DhcpServerV4PoolIter{fieldPtr: ptr} +} + +type DhcpServerV4DhcpServerV4PoolIter interface { + setMsg(*dhcpServerV4) DhcpServerV4DhcpServerV4PoolIter + Items() []DhcpServerV4Pool + Add() DhcpServerV4Pool + Append(items ...DhcpServerV4Pool) DhcpServerV4DhcpServerV4PoolIter + Set(index int, newObj DhcpServerV4Pool) DhcpServerV4DhcpServerV4PoolIter + Clear() DhcpServerV4DhcpServerV4PoolIter + clearHolderSlice() DhcpServerV4DhcpServerV4PoolIter + appendHolderSlice(item DhcpServerV4Pool) DhcpServerV4DhcpServerV4PoolIter +} + +func (obj *dhcpServerV4DhcpServerV4PoolIter) setMsg(msg *dhcpServerV4) DhcpServerV4DhcpServerV4PoolIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&dhcpServerV4Pool{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *dhcpServerV4DhcpServerV4PoolIter) Items() []DhcpServerV4Pool { + return obj.dhcpServerV4PoolSlice +} + +func (obj *dhcpServerV4DhcpServerV4PoolIter) Add() DhcpServerV4Pool { + newObj := &otg.DhcpServerV4Pool{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &dhcpServerV4Pool{obj: newObj} + newLibObj.setDefault() + obj.dhcpServerV4PoolSlice = append(obj.dhcpServerV4PoolSlice, newLibObj) + return newLibObj +} + +func (obj *dhcpServerV4DhcpServerV4PoolIter) Append(items ...DhcpServerV4Pool) DhcpServerV4DhcpServerV4PoolIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.dhcpServerV4PoolSlice = append(obj.dhcpServerV4PoolSlice, item) + } + return obj +} + +func (obj *dhcpServerV4DhcpServerV4PoolIter) Set(index int, newObj DhcpServerV4Pool) DhcpServerV4DhcpServerV4PoolIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.dhcpServerV4PoolSlice[index] = newObj + return obj +} +func (obj *dhcpServerV4DhcpServerV4PoolIter) Clear() DhcpServerV4DhcpServerV4PoolIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.DhcpServerV4Pool{} + obj.dhcpServerV4PoolSlice = []DhcpServerV4Pool{} + } + return obj +} +func (obj *dhcpServerV4DhcpServerV4PoolIter) clearHolderSlice() DhcpServerV4DhcpServerV4PoolIter { + if len(obj.dhcpServerV4PoolSlice) > 0 { + obj.dhcpServerV4PoolSlice = []DhcpServerV4Pool{} + } + return obj +} +func (obj *dhcpServerV4DhcpServerV4PoolIter) appendHolderSlice(item DhcpServerV4Pool) DhcpServerV4DhcpServerV4PoolIter { + obj.dhcpServerV4PoolSlice = append(obj.dhcpServerV4PoolSlice, item) + return obj +} + +func (obj *dhcpServerV4) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DhcpServerV4") + } + + // Ipv4Name is required + if obj.obj.Ipv4Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Ipv4Name is required field on interface DhcpServerV4") + } + + if len(obj.obj.AddressPools) != 0 { + + if set_default { + obj.AddressPools().clearHolderSlice() + for _, item := range obj.obj.AddressPools { + obj.AddressPools().appendHolderSlice(&dhcpServerV4Pool{obj: item}) + } + } + for _, item := range obj.AddressPools().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *dhcpServerV4) setDefault() { + +} diff --git a/gosnappi/dhcp_server_v4_pool.go b/gosnappi/dhcp_server_v4_pool.go new file mode 100644 index 00000000..84952a98 --- /dev/null +++ b/gosnappi/dhcp_server_v4_pool.go @@ -0,0 +1,553 @@ +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" +) + +// ***** DhcpServerV4Pool ***** +type dhcpServerV4Pool struct { + validation + obj *otg.DhcpServerV4Pool + marshaller marshalDhcpServerV4Pool + unMarshaller unMarshalDhcpServerV4Pool + optionsHolder DhcpServerV4PoolOption +} + +func NewDhcpServerV4Pool() DhcpServerV4Pool { + obj := dhcpServerV4Pool{obj: &otg.DhcpServerV4Pool{}} + obj.setDefault() + return &obj +} + +func (obj *dhcpServerV4Pool) msg() *otg.DhcpServerV4Pool { + return obj.obj +} + +func (obj *dhcpServerV4Pool) setMsg(msg *otg.DhcpServerV4Pool) DhcpServerV4Pool { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldhcpServerV4Pool struct { + obj *dhcpServerV4Pool +} + +type marshalDhcpServerV4Pool interface { + // ToProto marshals DhcpServerV4Pool to protobuf object *otg.DhcpServerV4Pool + ToProto() (*otg.DhcpServerV4Pool, error) + // ToPbText marshals DhcpServerV4Pool to protobuf text + ToPbText() (string, error) + // ToYaml marshals DhcpServerV4Pool to YAML text + ToYaml() (string, error) + // ToJson marshals DhcpServerV4Pool to JSON text + ToJson() (string, error) +} + +type unMarshaldhcpServerV4Pool struct { + obj *dhcpServerV4Pool +} + +type unMarshalDhcpServerV4Pool interface { + // FromProto unmarshals DhcpServerV4Pool from protobuf object *otg.DhcpServerV4Pool + FromProto(msg *otg.DhcpServerV4Pool) (DhcpServerV4Pool, error) + // FromPbText unmarshals DhcpServerV4Pool from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DhcpServerV4Pool from YAML text + FromYaml(value string) error + // FromJson unmarshals DhcpServerV4Pool from JSON text + FromJson(value string) error +} + +func (obj *dhcpServerV4Pool) Marshal() marshalDhcpServerV4Pool { + if obj.marshaller == nil { + obj.marshaller = &marshaldhcpServerV4Pool{obj: obj} + } + return obj.marshaller +} + +func (obj *dhcpServerV4Pool) Unmarshal() unMarshalDhcpServerV4Pool { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldhcpServerV4Pool{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldhcpServerV4Pool) ToProto() (*otg.DhcpServerV4Pool, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldhcpServerV4Pool) FromProto(msg *otg.DhcpServerV4Pool) (DhcpServerV4Pool, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldhcpServerV4Pool) 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 *unMarshaldhcpServerV4Pool) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshaldhcpServerV4Pool) 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 *unMarshaldhcpServerV4Pool) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshaldhcpServerV4Pool) 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 *unMarshaldhcpServerV4Pool) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *dhcpServerV4Pool) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *dhcpServerV4Pool) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *dhcpServerV4Pool) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *dhcpServerV4Pool) Clone() (DhcpServerV4Pool, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDhcpServerV4Pool() + 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 +} + +func (obj *dhcpServerV4Pool) setNil() { + obj.optionsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// DhcpServerV4Pool is configuration for DHCPv4 address pool for a lease. +type DhcpServerV4Pool interface { + Validation + // msg marshals DhcpServerV4Pool to protobuf object *otg.DhcpServerV4Pool + // and doesn't set defaults + msg() *otg.DhcpServerV4Pool + // setMsg unmarshals DhcpServerV4Pool from protobuf object *otg.DhcpServerV4Pool + // and doesn't set defaults + setMsg(*otg.DhcpServerV4Pool) DhcpServerV4Pool + // provides marshal interface + Marshal() marshalDhcpServerV4Pool + // provides unmarshal interface + Unmarshal() unMarshalDhcpServerV4Pool + // validate validates DhcpServerV4Pool + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DhcpServerV4Pool, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in DhcpServerV4Pool. + Name() string + // SetName assigns string provided by user to DhcpServerV4Pool + SetName(value string) DhcpServerV4Pool + // HasName checks if Name has been set in DhcpServerV4Pool + HasName() bool + // LeaseTime returns uint32, set in DhcpServerV4Pool. + LeaseTime() uint32 + // SetLeaseTime assigns uint32 provided by user to DhcpServerV4Pool + SetLeaseTime(value uint32) DhcpServerV4Pool + // HasLeaseTime checks if LeaseTime has been set in DhcpServerV4Pool + HasLeaseTime() bool + // StartAddress returns string, set in DhcpServerV4Pool. + StartAddress() string + // SetStartAddress assigns string provided by user to DhcpServerV4Pool + SetStartAddress(value string) DhcpServerV4Pool + // PrefixLength returns uint32, set in DhcpServerV4Pool. + PrefixLength() uint32 + // SetPrefixLength assigns uint32 provided by user to DhcpServerV4Pool + SetPrefixLength(value uint32) DhcpServerV4Pool + // HasPrefixLength checks if PrefixLength has been set in DhcpServerV4Pool + HasPrefixLength() bool + // Count returns uint32, set in DhcpServerV4Pool. + Count() uint32 + // SetCount assigns uint32 provided by user to DhcpServerV4Pool + SetCount(value uint32) DhcpServerV4Pool + // HasCount checks if Count has been set in DhcpServerV4Pool + HasCount() bool + // Step returns uint32, set in DhcpServerV4Pool. + Step() uint32 + // SetStep assigns uint32 provided by user to DhcpServerV4Pool + SetStep(value uint32) DhcpServerV4Pool + // HasStep checks if Step has been set in DhcpServerV4Pool + HasStep() bool + // Options returns DhcpServerV4PoolOption, set in DhcpServerV4Pool. + // DhcpServerV4PoolOption is optional configuration for DHCPv4 address pool for the lease. + Options() DhcpServerV4PoolOption + // SetOptions assigns DhcpServerV4PoolOption provided by user to DhcpServerV4Pool. + // DhcpServerV4PoolOption is optional configuration for DHCPv4 address pool for the lease. + SetOptions(value DhcpServerV4PoolOption) DhcpServerV4Pool + // HasOptions checks if Options has been set in DhcpServerV4Pool + HasOptions() bool + setNil() +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *dhcpServerV4Pool) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *dhcpServerV4Pool) HasName() bool { + return obj.obj.Name != nil +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the DhcpServerV4Pool object +func (obj *dhcpServerV4Pool) SetName(value string) DhcpServerV4Pool { + + obj.obj.Name = &value + return obj +} + +// The duration of time in seconds that is assigned to a lease. +// LeaseTime returns a uint32 +func (obj *dhcpServerV4Pool) LeaseTime() uint32 { + + return *obj.obj.LeaseTime + +} + +// The duration of time in seconds that is assigned to a lease. +// LeaseTime returns a uint32 +func (obj *dhcpServerV4Pool) HasLeaseTime() bool { + return obj.obj.LeaseTime != nil +} + +// The duration of time in seconds that is assigned to a lease. +// SetLeaseTime sets the uint32 value in the DhcpServerV4Pool object +func (obj *dhcpServerV4Pool) SetLeaseTime(value uint32) DhcpServerV4Pool { + + obj.obj.LeaseTime = &value + return obj +} + +// The IPv4 address of the first lease pool. +// StartAddress returns a string +func (obj *dhcpServerV4Pool) StartAddress() string { + + return *obj.obj.StartAddress + +} + +// The IPv4 address of the first lease pool. +// SetStartAddress sets the string value in the DhcpServerV4Pool object +func (obj *dhcpServerV4Pool) SetStartAddress(value string) DhcpServerV4Pool { + + obj.obj.StartAddress = &value + return obj +} + +// The IPv4 network prefix length to be applied to the address. +// PrefixLength returns a uint32 +func (obj *dhcpServerV4Pool) PrefixLength() uint32 { + + return *obj.obj.PrefixLength + +} + +// The IPv4 network prefix length to be applied to the address. +// PrefixLength returns a uint32 +func (obj *dhcpServerV4Pool) HasPrefixLength() bool { + return obj.obj.PrefixLength != nil +} + +// The IPv4 network prefix length to be applied to the address. +// SetPrefixLength sets the uint32 value in the DhcpServerV4Pool object +func (obj *dhcpServerV4Pool) SetPrefixLength(value uint32) DhcpServerV4Pool { + + obj.obj.PrefixLength = &value + return obj +} + +// The total number of addresses in the pool. +// Count returns a uint32 +func (obj *dhcpServerV4Pool) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of addresses in the pool. +// Count returns a uint32 +func (obj *dhcpServerV4Pool) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of addresses in the pool. +// SetCount sets the uint32 value in the DhcpServerV4Pool object +func (obj *dhcpServerV4Pool) SetCount(value uint32) DhcpServerV4Pool { + + obj.obj.Count = &value + return obj +} + +// The increment value for the lease address within the lease pool. The value is incremented according to the prefix_length and step. +// Step returns a uint32 +func (obj *dhcpServerV4Pool) Step() uint32 { + + return *obj.obj.Step + +} + +// The increment value for the lease address within the lease pool. The value is incremented according to the prefix_length and step. +// Step returns a uint32 +func (obj *dhcpServerV4Pool) HasStep() bool { + return obj.obj.Step != nil +} + +// The increment value for the lease address within the lease pool. The value is incremented according to the prefix_length and step. +// SetStep sets the uint32 value in the DhcpServerV4Pool object +func (obj *dhcpServerV4Pool) SetStep(value uint32) DhcpServerV4Pool { + + obj.obj.Step = &value + return obj +} + +// Optional configuration for DHCPv4 address pool for the lease. +// Options returns a DhcpServerV4PoolOption +func (obj *dhcpServerV4Pool) Options() DhcpServerV4PoolOption { + if obj.obj.Options == nil { + obj.obj.Options = NewDhcpServerV4PoolOption().msg() + } + if obj.optionsHolder == nil { + obj.optionsHolder = &dhcpServerV4PoolOption{obj: obj.obj.Options} + } + return obj.optionsHolder +} + +// Optional configuration for DHCPv4 address pool for the lease. +// Options returns a DhcpServerV4PoolOption +func (obj *dhcpServerV4Pool) HasOptions() bool { + return obj.obj.Options != nil +} + +// Optional configuration for DHCPv4 address pool for the lease. +// SetOptions sets the DhcpServerV4PoolOption value in the DhcpServerV4Pool object +func (obj *dhcpServerV4Pool) SetOptions(value DhcpServerV4PoolOption) DhcpServerV4Pool { + + obj.optionsHolder = nil + obj.obj.Options = value.msg() + + return obj +} + +func (obj *dhcpServerV4Pool) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.LeaseTime != nil { + + if *obj.obj.LeaseTime < 10 || *obj.obj.LeaseTime > 4294967295 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("10 <= DhcpServerV4Pool.LeaseTime <= 4294967295 but Got %d", *obj.obj.LeaseTime)) + } + + } + + // StartAddress is required + if obj.obj.StartAddress == nil { + vObj.validationErrors = append(vObj.validationErrors, "StartAddress is required field on interface DhcpServerV4Pool") + } + if obj.obj.StartAddress != nil { + + err := obj.validateIpv4(obj.StartAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DhcpServerV4Pool.StartAddress")) + } + + } + + if obj.obj.PrefixLength != nil { + + if *obj.obj.PrefixLength > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= DhcpServerV4Pool.PrefixLength <= 32 but Got %d", *obj.obj.PrefixLength)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count < 1 || *obj.obj.Count > 4294967295 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= DhcpServerV4Pool.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 <= DhcpServerV4Pool.Step <= 4294967295 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Options != nil { + + obj.Options().validateObj(vObj, set_default) + } + +} + +func (obj *dhcpServerV4Pool) setDefault() { + if obj.obj.LeaseTime == nil { + obj.SetLeaseTime(86400) + } + if obj.obj.PrefixLength == nil { + obj.SetPrefixLength(24) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + +} diff --git a/gosnappi/dhcp_server_v4_pool_option.go b/gosnappi/dhcp_server_v4_pool_option.go new file mode 100644 index 00000000..a0508438 --- /dev/null +++ b/gosnappi/dhcp_server_v4_pool_option.go @@ -0,0 +1,429 @@ +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" +) + +// ***** DhcpServerV4PoolOption ***** +type dhcpServerV4PoolOption struct { + validation + obj *otg.DhcpServerV4PoolOption + marshaller marshalDhcpServerV4PoolOption + unMarshaller unMarshalDhcpServerV4PoolOption +} + +func NewDhcpServerV4PoolOption() DhcpServerV4PoolOption { + obj := dhcpServerV4PoolOption{obj: &otg.DhcpServerV4PoolOption{}} + obj.setDefault() + return &obj +} + +func (obj *dhcpServerV4PoolOption) msg() *otg.DhcpServerV4PoolOption { + return obj.obj +} + +func (obj *dhcpServerV4PoolOption) setMsg(msg *otg.DhcpServerV4PoolOption) DhcpServerV4PoolOption { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldhcpServerV4PoolOption struct { + obj *dhcpServerV4PoolOption +} + +type marshalDhcpServerV4PoolOption interface { + // ToProto marshals DhcpServerV4PoolOption to protobuf object *otg.DhcpServerV4PoolOption + ToProto() (*otg.DhcpServerV4PoolOption, error) + // ToPbText marshals DhcpServerV4PoolOption to protobuf text + ToPbText() (string, error) + // ToYaml marshals DhcpServerV4PoolOption to YAML text + ToYaml() (string, error) + // ToJson marshals DhcpServerV4PoolOption to JSON text + ToJson() (string, error) +} + +type unMarshaldhcpServerV4PoolOption struct { + obj *dhcpServerV4PoolOption +} + +type unMarshalDhcpServerV4PoolOption interface { + // FromProto unmarshals DhcpServerV4PoolOption from protobuf object *otg.DhcpServerV4PoolOption + FromProto(msg *otg.DhcpServerV4PoolOption) (DhcpServerV4PoolOption, error) + // FromPbText unmarshals DhcpServerV4PoolOption from protobuf text + FromPbText(value string) error + // FromYaml unmarshals DhcpServerV4PoolOption from YAML text + FromYaml(value string) error + // FromJson unmarshals DhcpServerV4PoolOption from JSON text + FromJson(value string) error +} + +func (obj *dhcpServerV4PoolOption) Marshal() marshalDhcpServerV4PoolOption { + if obj.marshaller == nil { + obj.marshaller = &marshaldhcpServerV4PoolOption{obj: obj} + } + return obj.marshaller +} + +func (obj *dhcpServerV4PoolOption) Unmarshal() unMarshalDhcpServerV4PoolOption { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldhcpServerV4PoolOption{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldhcpServerV4PoolOption) ToProto() (*otg.DhcpServerV4PoolOption, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldhcpServerV4PoolOption) FromProto(msg *otg.DhcpServerV4PoolOption) (DhcpServerV4PoolOption, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldhcpServerV4PoolOption) 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 *unMarshaldhcpServerV4PoolOption) 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 *marshaldhcpServerV4PoolOption) 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 *unMarshaldhcpServerV4PoolOption) 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 *marshaldhcpServerV4PoolOption) 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 *unMarshaldhcpServerV4PoolOption) 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 *dhcpServerV4PoolOption) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *dhcpServerV4PoolOption) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *dhcpServerV4PoolOption) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *dhcpServerV4PoolOption) Clone() (DhcpServerV4PoolOption, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDhcpServerV4PoolOption() + 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 +} + +// DhcpServerV4PoolOption is optional configuration for DHCPv4 address pool for the lease. +type DhcpServerV4PoolOption interface { + Validation + // msg marshals DhcpServerV4PoolOption to protobuf object *otg.DhcpServerV4PoolOption + // and doesn't set defaults + msg() *otg.DhcpServerV4PoolOption + // setMsg unmarshals DhcpServerV4PoolOption from protobuf object *otg.DhcpServerV4PoolOption + // and doesn't set defaults + setMsg(*otg.DhcpServerV4PoolOption) DhcpServerV4PoolOption + // provides marshal interface + Marshal() marshalDhcpServerV4PoolOption + // provides unmarshal interface + Unmarshal() unMarshalDhcpServerV4PoolOption + // validate validates DhcpServerV4PoolOption + validate() error + // A stringer function + String() string + // Clones the object + Clone() (DhcpServerV4PoolOption, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RouterAddress returns string, set in DhcpServerV4PoolOption. + RouterAddress() string + // SetRouterAddress assigns string provided by user to DhcpServerV4PoolOption + SetRouterAddress(value string) DhcpServerV4PoolOption + // HasRouterAddress checks if RouterAddress has been set in DhcpServerV4PoolOption + HasRouterAddress() bool + // PrimaryDnsServer returns string, set in DhcpServerV4PoolOption. + PrimaryDnsServer() string + // SetPrimaryDnsServer assigns string provided by user to DhcpServerV4PoolOption + SetPrimaryDnsServer(value string) DhcpServerV4PoolOption + // HasPrimaryDnsServer checks if PrimaryDnsServer has been set in DhcpServerV4PoolOption + HasPrimaryDnsServer() bool + // SecondaryDnsServer returns string, set in DhcpServerV4PoolOption. + SecondaryDnsServer() string + // SetSecondaryDnsServer assigns string provided by user to DhcpServerV4PoolOption + SetSecondaryDnsServer(value string) DhcpServerV4PoolOption + // HasSecondaryDnsServer checks if SecondaryDnsServer has been set in DhcpServerV4PoolOption + HasSecondaryDnsServer() bool + // EchoRelayWithTlv82 returns bool, set in DhcpServerV4PoolOption. + EchoRelayWithTlv82() bool + // SetEchoRelayWithTlv82 assigns bool provided by user to DhcpServerV4PoolOption + SetEchoRelayWithTlv82(value bool) DhcpServerV4PoolOption + // HasEchoRelayWithTlv82 checks if EchoRelayWithTlv82 has been set in DhcpServerV4PoolOption + HasEchoRelayWithTlv82() bool +} + +// The Router address advertised by the DHCPv4 server in Offer and Ack messages. +// RouterAddress returns a string +func (obj *dhcpServerV4PoolOption) RouterAddress() string { + + return *obj.obj.RouterAddress + +} + +// The Router address advertised by the DHCPv4 server in Offer and Ack messages. +// RouterAddress returns a string +func (obj *dhcpServerV4PoolOption) HasRouterAddress() bool { + return obj.obj.RouterAddress != nil +} + +// The Router address advertised by the DHCPv4 server in Offer and Ack messages. +// SetRouterAddress sets the string value in the DhcpServerV4PoolOption object +func (obj *dhcpServerV4PoolOption) SetRouterAddress(value string) DhcpServerV4PoolOption { + + obj.obj.RouterAddress = &value + return obj +} + +// The primary DNS server address that is offered to DHCP clients that request this information through a TLV option. +// PrimaryDnsServer returns a string +func (obj *dhcpServerV4PoolOption) PrimaryDnsServer() string { + + return *obj.obj.PrimaryDnsServer + +} + +// The primary DNS server address that is offered to DHCP clients that request this information through a TLV option. +// PrimaryDnsServer returns a string +func (obj *dhcpServerV4PoolOption) HasPrimaryDnsServer() bool { + return obj.obj.PrimaryDnsServer != nil +} + +// The primary DNS server address that is offered to DHCP clients that request this information through a TLV option. +// SetPrimaryDnsServer sets the string value in the DhcpServerV4PoolOption object +func (obj *dhcpServerV4PoolOption) SetPrimaryDnsServer(value string) DhcpServerV4PoolOption { + + obj.obj.PrimaryDnsServer = &value + return obj +} + +// The primary DNS server address that is offered to DHCP clients that request this information through a TLV option. +// SecondaryDnsServer returns a string +func (obj *dhcpServerV4PoolOption) SecondaryDnsServer() string { + + return *obj.obj.SecondaryDnsServer + +} + +// The primary DNS server address that is offered to DHCP clients that request this information through a TLV option. +// SecondaryDnsServer returns a string +func (obj *dhcpServerV4PoolOption) HasSecondaryDnsServer() bool { + return obj.obj.SecondaryDnsServer != nil +} + +// The primary DNS server address that is offered to DHCP clients that request this information through a TLV option. +// SetSecondaryDnsServer sets the string value in the DhcpServerV4PoolOption object +func (obj *dhcpServerV4PoolOption) SetSecondaryDnsServer(value string) DhcpServerV4PoolOption { + + obj.obj.SecondaryDnsServer = &value + return obj +} + +// If selected, the DHCP server includes in its replies the TLV information for the DHCPv4 Relay Agent Option 82 and the corresponding sub-TLVs that it receives from a DHCP relay agent, otherwise it replies without including this TLV. +// EchoRelayWithTlv82 returns a bool +func (obj *dhcpServerV4PoolOption) EchoRelayWithTlv82() bool { + + return *obj.obj.EchoRelayWithTlv_82 + +} + +// If selected, the DHCP server includes in its replies the TLV information for the DHCPv4 Relay Agent Option 82 and the corresponding sub-TLVs that it receives from a DHCP relay agent, otherwise it replies without including this TLV. +// EchoRelayWithTlv82 returns a bool +func (obj *dhcpServerV4PoolOption) HasEchoRelayWithTlv82() bool { + return obj.obj.EchoRelayWithTlv_82 != nil +} + +// If selected, the DHCP server includes in its replies the TLV information for the DHCPv4 Relay Agent Option 82 and the corresponding sub-TLVs that it receives from a DHCP relay agent, otherwise it replies without including this TLV. +// SetEchoRelayWithTlv82 sets the bool value in the DhcpServerV4PoolOption object +func (obj *dhcpServerV4PoolOption) SetEchoRelayWithTlv82(value bool) DhcpServerV4PoolOption { + + obj.obj.EchoRelayWithTlv_82 = &value + return obj +} + +func (obj *dhcpServerV4PoolOption) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RouterAddress != nil { + + err := obj.validateIpv4(obj.RouterAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DhcpServerV4PoolOption.RouterAddress")) + } + + } + + if obj.obj.PrimaryDnsServer != nil { + + err := obj.validateIpv4(obj.PrimaryDnsServer()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DhcpServerV4PoolOption.PrimaryDnsServer")) + } + + } + + if obj.obj.SecondaryDnsServer != nil { + + err := obj.validateIpv4(obj.SecondaryDnsServer()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DhcpServerV4PoolOption.SecondaryDnsServer")) + } + + } + +} + +func (obj *dhcpServerV4PoolOption) setDefault() { + if obj.obj.RouterAddress == nil { + obj.SetRouterAddress("0.0.0.0") + } + if obj.obj.PrimaryDnsServer == nil { + obj.SetPrimaryDnsServer("0.0.0.0") + } + if obj.obj.SecondaryDnsServer == nil { + obj.SetSecondaryDnsServer("0.0.0.0") + } + if obj.obj.EchoRelayWithTlv_82 == nil { + obj.SetEchoRelayWithTlv82(true) + } + +} diff --git a/gosnappi/dhcpv4_client_metric.go b/gosnappi/dhcpv4_client_metric.go new file mode 100644 index 00000000..365a3749 --- /dev/null +++ b/gosnappi/dhcpv4_client_metric.go @@ -0,0 +1,502 @@ +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" +) + +// ***** Dhcpv4ClientMetric ***** +type dhcpv4ClientMetric struct { + validation + obj *otg.Dhcpv4ClientMetric + marshaller marshalDhcpv4ClientMetric + unMarshaller unMarshalDhcpv4ClientMetric +} + +func NewDhcpv4ClientMetric() Dhcpv4ClientMetric { + obj := dhcpv4ClientMetric{obj: &otg.Dhcpv4ClientMetric{}} + obj.setDefault() + return &obj +} + +func (obj *dhcpv4ClientMetric) msg() *otg.Dhcpv4ClientMetric { + return obj.obj +} + +func (obj *dhcpv4ClientMetric) setMsg(msg *otg.Dhcpv4ClientMetric) Dhcpv4ClientMetric { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldhcpv4ClientMetric struct { + obj *dhcpv4ClientMetric +} + +type marshalDhcpv4ClientMetric interface { + // ToProto marshals Dhcpv4ClientMetric to protobuf object *otg.Dhcpv4ClientMetric + ToProto() (*otg.Dhcpv4ClientMetric, error) + // ToPbText marshals Dhcpv4ClientMetric to protobuf text + ToPbText() (string, error) + // ToYaml marshals Dhcpv4ClientMetric to YAML text + ToYaml() (string, error) + // ToJson marshals Dhcpv4ClientMetric to JSON text + ToJson() (string, error) +} + +type unMarshaldhcpv4ClientMetric struct { + obj *dhcpv4ClientMetric +} + +type unMarshalDhcpv4ClientMetric interface { + // FromProto unmarshals Dhcpv4ClientMetric from protobuf object *otg.Dhcpv4ClientMetric + FromProto(msg *otg.Dhcpv4ClientMetric) (Dhcpv4ClientMetric, error) + // FromPbText unmarshals Dhcpv4ClientMetric from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Dhcpv4ClientMetric from YAML text + FromYaml(value string) error + // FromJson unmarshals Dhcpv4ClientMetric from JSON text + FromJson(value string) error +} + +func (obj *dhcpv4ClientMetric) Marshal() marshalDhcpv4ClientMetric { + if obj.marshaller == nil { + obj.marshaller = &marshaldhcpv4ClientMetric{obj: obj} + } + return obj.marshaller +} + +func (obj *dhcpv4ClientMetric) Unmarshal() unMarshalDhcpv4ClientMetric { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldhcpv4ClientMetric{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldhcpv4ClientMetric) ToProto() (*otg.Dhcpv4ClientMetric, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldhcpv4ClientMetric) FromProto(msg *otg.Dhcpv4ClientMetric) (Dhcpv4ClientMetric, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldhcpv4ClientMetric) 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 *unMarshaldhcpv4ClientMetric) 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 *marshaldhcpv4ClientMetric) 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 *unMarshaldhcpv4ClientMetric) 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 *marshaldhcpv4ClientMetric) 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 *unMarshaldhcpv4ClientMetric) 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 *dhcpv4ClientMetric) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *dhcpv4ClientMetric) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *dhcpv4ClientMetric) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *dhcpv4ClientMetric) Clone() (Dhcpv4ClientMetric, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDhcpv4ClientMetric() + 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 +} + +// Dhcpv4ClientMetric is dHCPv4 per peer statistics information. +type Dhcpv4ClientMetric interface { + Validation + // msg marshals Dhcpv4ClientMetric to protobuf object *otg.Dhcpv4ClientMetric + // and doesn't set defaults + msg() *otg.Dhcpv4ClientMetric + // setMsg unmarshals Dhcpv4ClientMetric from protobuf object *otg.Dhcpv4ClientMetric + // and doesn't set defaults + setMsg(*otg.Dhcpv4ClientMetric) Dhcpv4ClientMetric + // provides marshal interface + Marshal() marshalDhcpv4ClientMetric + // provides unmarshal interface + Unmarshal() unMarshalDhcpv4ClientMetric + // validate validates Dhcpv4ClientMetric + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Dhcpv4ClientMetric, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in Dhcpv4ClientMetric. + Name() string + // SetName assigns string provided by user to Dhcpv4ClientMetric + SetName(value string) Dhcpv4ClientMetric + // HasName checks if Name has been set in Dhcpv4ClientMetric + HasName() bool + // DiscoversSent returns uint64, set in Dhcpv4ClientMetric. + DiscoversSent() uint64 + // SetDiscoversSent assigns uint64 provided by user to Dhcpv4ClientMetric + SetDiscoversSent(value uint64) Dhcpv4ClientMetric + // HasDiscoversSent checks if DiscoversSent has been set in Dhcpv4ClientMetric + HasDiscoversSent() bool + // OffersReceived returns uint64, set in Dhcpv4ClientMetric. + OffersReceived() uint64 + // SetOffersReceived assigns uint64 provided by user to Dhcpv4ClientMetric + SetOffersReceived(value uint64) Dhcpv4ClientMetric + // HasOffersReceived checks if OffersReceived has been set in Dhcpv4ClientMetric + HasOffersReceived() bool + // RequestsSent returns uint64, set in Dhcpv4ClientMetric. + RequestsSent() uint64 + // SetRequestsSent assigns uint64 provided by user to Dhcpv4ClientMetric + SetRequestsSent(value uint64) Dhcpv4ClientMetric + // HasRequestsSent checks if RequestsSent has been set in Dhcpv4ClientMetric + HasRequestsSent() bool + // AcksReceived returns uint64, set in Dhcpv4ClientMetric. + AcksReceived() uint64 + // SetAcksReceived assigns uint64 provided by user to Dhcpv4ClientMetric + SetAcksReceived(value uint64) Dhcpv4ClientMetric + // HasAcksReceived checks if AcksReceived has been set in Dhcpv4ClientMetric + HasAcksReceived() bool + // NacksReceived returns uint64, set in Dhcpv4ClientMetric. + NacksReceived() uint64 + // SetNacksReceived assigns uint64 provided by user to Dhcpv4ClientMetric + SetNacksReceived(value uint64) Dhcpv4ClientMetric + // HasNacksReceived checks if NacksReceived has been set in Dhcpv4ClientMetric + HasNacksReceived() bool + // ReleasesSent returns uint64, set in Dhcpv4ClientMetric. + ReleasesSent() uint64 + // SetReleasesSent assigns uint64 provided by user to Dhcpv4ClientMetric + SetReleasesSent(value uint64) Dhcpv4ClientMetric + // HasReleasesSent checks if ReleasesSent has been set in Dhcpv4ClientMetric + HasReleasesSent() bool + // DeclinesSent returns uint64, set in Dhcpv4ClientMetric. + DeclinesSent() uint64 + // SetDeclinesSent assigns uint64 provided by user to Dhcpv4ClientMetric + SetDeclinesSent(value uint64) Dhcpv4ClientMetric + // HasDeclinesSent checks if DeclinesSent has been set in Dhcpv4ClientMetric + HasDeclinesSent() bool +} + +// The name of a configured DHCPv4 client. +// Name returns a string +func (obj *dhcpv4ClientMetric) Name() string { + + return *obj.obj.Name + +} + +// The name of a configured DHCPv4 client. +// Name returns a string +func (obj *dhcpv4ClientMetric) HasName() bool { + return obj.obj.Name != nil +} + +// The name of a configured DHCPv4 client. +// SetName sets the string value in the Dhcpv4ClientMetric object +func (obj *dhcpv4ClientMetric) SetName(value string) Dhcpv4ClientMetric { + + obj.obj.Name = &value + return obj +} + +// Number of DHCPDISCOVER messages sent. +// DiscoversSent returns a uint64 +func (obj *dhcpv4ClientMetric) DiscoversSent() uint64 { + + return *obj.obj.DiscoversSent + +} + +// Number of DHCPDISCOVER messages sent. +// DiscoversSent returns a uint64 +func (obj *dhcpv4ClientMetric) HasDiscoversSent() bool { + return obj.obj.DiscoversSent != nil +} + +// Number of DHCPDISCOVER messages sent. +// SetDiscoversSent sets the uint64 value in the Dhcpv4ClientMetric object +func (obj *dhcpv4ClientMetric) SetDiscoversSent(value uint64) Dhcpv4ClientMetric { + + obj.obj.DiscoversSent = &value + return obj +} + +// Number of DHCPOFFER messages received. +// OffersReceived returns a uint64 +func (obj *dhcpv4ClientMetric) OffersReceived() uint64 { + + return *obj.obj.OffersReceived + +} + +// Number of DHCPOFFER messages received. +// OffersReceived returns a uint64 +func (obj *dhcpv4ClientMetric) HasOffersReceived() bool { + return obj.obj.OffersReceived != nil +} + +// Number of DHCPOFFER messages received. +// SetOffersReceived sets the uint64 value in the Dhcpv4ClientMetric object +func (obj *dhcpv4ClientMetric) SetOffersReceived(value uint64) Dhcpv4ClientMetric { + + obj.obj.OffersReceived = &value + return obj +} + +// Number of DHCPREQUEST messages sent. +// RequestsSent returns a uint64 +func (obj *dhcpv4ClientMetric) RequestsSent() uint64 { + + return *obj.obj.RequestsSent + +} + +// Number of DHCPREQUEST messages sent. +// RequestsSent returns a uint64 +func (obj *dhcpv4ClientMetric) HasRequestsSent() bool { + return obj.obj.RequestsSent != nil +} + +// Number of DHCPREQUEST messages sent. +// SetRequestsSent sets the uint64 value in the Dhcpv4ClientMetric object +func (obj *dhcpv4ClientMetric) SetRequestsSent(value uint64) Dhcpv4ClientMetric { + + obj.obj.RequestsSent = &value + return obj +} + +// Number of lease DHCPACK messages received. +// AcksReceived returns a uint64 +func (obj *dhcpv4ClientMetric) AcksReceived() uint64 { + + return *obj.obj.AcksReceived + +} + +// Number of lease DHCPACK messages received. +// AcksReceived returns a uint64 +func (obj *dhcpv4ClientMetric) HasAcksReceived() bool { + return obj.obj.AcksReceived != nil +} + +// Number of lease DHCPACK messages received. +// SetAcksReceived sets the uint64 value in the Dhcpv4ClientMetric object +func (obj *dhcpv4ClientMetric) SetAcksReceived(value uint64) Dhcpv4ClientMetric { + + obj.obj.AcksReceived = &value + return obj +} + +// Number of negative lease DHCPNACK messages received. +// NacksReceived returns a uint64 +func (obj *dhcpv4ClientMetric) NacksReceived() uint64 { + + return *obj.obj.NacksReceived + +} + +// Number of negative lease DHCPNACK messages received. +// NacksReceived returns a uint64 +func (obj *dhcpv4ClientMetric) HasNacksReceived() bool { + return obj.obj.NacksReceived != nil +} + +// Number of negative lease DHCPNACK messages received. +// SetNacksReceived sets the uint64 value in the Dhcpv4ClientMetric object +func (obj *dhcpv4ClientMetric) SetNacksReceived(value uint64) Dhcpv4ClientMetric { + + obj.obj.NacksReceived = &value + return obj +} + +// Number of DHCPRELEASE messages sent. +// ReleasesSent returns a uint64 +func (obj *dhcpv4ClientMetric) ReleasesSent() uint64 { + + return *obj.obj.ReleasesSent + +} + +// Number of DHCPRELEASE messages sent. +// ReleasesSent returns a uint64 +func (obj *dhcpv4ClientMetric) HasReleasesSent() bool { + return obj.obj.ReleasesSent != nil +} + +// Number of DHCPRELEASE messages sent. +// SetReleasesSent sets the uint64 value in the Dhcpv4ClientMetric object +func (obj *dhcpv4ClientMetric) SetReleasesSent(value uint64) Dhcpv4ClientMetric { + + obj.obj.ReleasesSent = &value + return obj +} + +// Number of DHCPDECLINE messages sent. +// DeclinesSent returns a uint64 +func (obj *dhcpv4ClientMetric) DeclinesSent() uint64 { + + return *obj.obj.DeclinesSent + +} + +// Number of DHCPDECLINE messages sent. +// DeclinesSent returns a uint64 +func (obj *dhcpv4ClientMetric) HasDeclinesSent() bool { + return obj.obj.DeclinesSent != nil +} + +// Number of DHCPDECLINE messages sent. +// SetDeclinesSent sets the uint64 value in the Dhcpv4ClientMetric object +func (obj *dhcpv4ClientMetric) SetDeclinesSent(value uint64) Dhcpv4ClientMetric { + + obj.obj.DeclinesSent = &value + return obj +} + +func (obj *dhcpv4ClientMetric) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *dhcpv4ClientMetric) setDefault() { + +} diff --git a/gosnappi/dhcpv4_client_metrics_request.go b/gosnappi/dhcpv4_client_metrics_request.go new file mode 100644 index 00000000..59eddaa9 --- /dev/null +++ b/gosnappi/dhcpv4_client_metrics_request.go @@ -0,0 +1,363 @@ +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" +) + +// ***** Dhcpv4ClientMetricsRequest ***** +type dhcpv4ClientMetricsRequest struct { + validation + obj *otg.Dhcpv4ClientMetricsRequest + marshaller marshalDhcpv4ClientMetricsRequest + unMarshaller unMarshalDhcpv4ClientMetricsRequest +} + +func NewDhcpv4ClientMetricsRequest() Dhcpv4ClientMetricsRequest { + obj := dhcpv4ClientMetricsRequest{obj: &otg.Dhcpv4ClientMetricsRequest{}} + obj.setDefault() + return &obj +} + +func (obj *dhcpv4ClientMetricsRequest) msg() *otg.Dhcpv4ClientMetricsRequest { + return obj.obj +} + +func (obj *dhcpv4ClientMetricsRequest) setMsg(msg *otg.Dhcpv4ClientMetricsRequest) Dhcpv4ClientMetricsRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldhcpv4ClientMetricsRequest struct { + obj *dhcpv4ClientMetricsRequest +} + +type marshalDhcpv4ClientMetricsRequest interface { + // ToProto marshals Dhcpv4ClientMetricsRequest to protobuf object *otg.Dhcpv4ClientMetricsRequest + ToProto() (*otg.Dhcpv4ClientMetricsRequest, error) + // ToPbText marshals Dhcpv4ClientMetricsRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals Dhcpv4ClientMetricsRequest to YAML text + ToYaml() (string, error) + // ToJson marshals Dhcpv4ClientMetricsRequest to JSON text + ToJson() (string, error) +} + +type unMarshaldhcpv4ClientMetricsRequest struct { + obj *dhcpv4ClientMetricsRequest +} + +type unMarshalDhcpv4ClientMetricsRequest interface { + // FromProto unmarshals Dhcpv4ClientMetricsRequest from protobuf object *otg.Dhcpv4ClientMetricsRequest + FromProto(msg *otg.Dhcpv4ClientMetricsRequest) (Dhcpv4ClientMetricsRequest, error) + // FromPbText unmarshals Dhcpv4ClientMetricsRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Dhcpv4ClientMetricsRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals Dhcpv4ClientMetricsRequest from JSON text + FromJson(value string) error +} + +func (obj *dhcpv4ClientMetricsRequest) Marshal() marshalDhcpv4ClientMetricsRequest { + if obj.marshaller == nil { + obj.marshaller = &marshaldhcpv4ClientMetricsRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *dhcpv4ClientMetricsRequest) Unmarshal() unMarshalDhcpv4ClientMetricsRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldhcpv4ClientMetricsRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldhcpv4ClientMetricsRequest) ToProto() (*otg.Dhcpv4ClientMetricsRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldhcpv4ClientMetricsRequest) FromProto(msg *otg.Dhcpv4ClientMetricsRequest) (Dhcpv4ClientMetricsRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldhcpv4ClientMetricsRequest) 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 *unMarshaldhcpv4ClientMetricsRequest) 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 *marshaldhcpv4ClientMetricsRequest) 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 *unMarshaldhcpv4ClientMetricsRequest) 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 *marshaldhcpv4ClientMetricsRequest) 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 *unMarshaldhcpv4ClientMetricsRequest) 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 *dhcpv4ClientMetricsRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *dhcpv4ClientMetricsRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *dhcpv4ClientMetricsRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *dhcpv4ClientMetricsRequest) Clone() (Dhcpv4ClientMetricsRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDhcpv4ClientMetricsRequest() + 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 +} + +// Dhcpv4ClientMetricsRequest is the request to retrieve DHCPv4 per client metrics/statistics. +type Dhcpv4ClientMetricsRequest interface { + Validation + // msg marshals Dhcpv4ClientMetricsRequest to protobuf object *otg.Dhcpv4ClientMetricsRequest + // and doesn't set defaults + msg() *otg.Dhcpv4ClientMetricsRequest + // setMsg unmarshals Dhcpv4ClientMetricsRequest from protobuf object *otg.Dhcpv4ClientMetricsRequest + // and doesn't set defaults + setMsg(*otg.Dhcpv4ClientMetricsRequest) Dhcpv4ClientMetricsRequest + // provides marshal interface + Marshal() marshalDhcpv4ClientMetricsRequest + // provides unmarshal interface + Unmarshal() unMarshalDhcpv4ClientMetricsRequest + // validate validates Dhcpv4ClientMetricsRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Dhcpv4ClientMetricsRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ClientNames returns []string, set in Dhcpv4ClientMetricsRequest. + ClientNames() []string + // SetClientNames assigns []string provided by user to Dhcpv4ClientMetricsRequest + SetClientNames(value []string) Dhcpv4ClientMetricsRequest + // ColumnNames returns []Dhcpv4ClientMetricsRequestColumnNamesEnum, set in Dhcpv4ClientMetricsRequest + ColumnNames() []Dhcpv4ClientMetricsRequestColumnNamesEnum + // SetColumnNames assigns []Dhcpv4ClientMetricsRequestColumnNamesEnum provided by user to Dhcpv4ClientMetricsRequest + SetColumnNames(value []Dhcpv4ClientMetricsRequestColumnNamesEnum) Dhcpv4ClientMetricsRequest +} + +// The names of DHCPv4 clients to return results for. An empty list will return results for all DHCPv4 client. +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// ClientNames returns a []string +func (obj *dhcpv4ClientMetricsRequest) ClientNames() []string { + if obj.obj.ClientNames == nil { + obj.obj.ClientNames = make([]string, 0) + } + return obj.obj.ClientNames +} + +// The names of DHCPv4 clients to return results for. An empty list will return results for all DHCPv4 client. +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// SetClientNames sets the []string value in the Dhcpv4ClientMetricsRequest object +func (obj *dhcpv4ClientMetricsRequest) SetClientNames(value []string) Dhcpv4ClientMetricsRequest { + + if obj.obj.ClientNames == nil { + obj.obj.ClientNames = make([]string, 0) + } + obj.obj.ClientNames = value + + return obj +} + +type Dhcpv4ClientMetricsRequestColumnNamesEnum string + +// Enum of ColumnNames on Dhcpv4ClientMetricsRequest +var Dhcpv4ClientMetricsRequestColumnNames = struct { + DISCOVERS_SENT Dhcpv4ClientMetricsRequestColumnNamesEnum + OFFERS_RECEIVED Dhcpv4ClientMetricsRequestColumnNamesEnum + REQUESTS_SENT Dhcpv4ClientMetricsRequestColumnNamesEnum + ACKS_RECEIVED Dhcpv4ClientMetricsRequestColumnNamesEnum + NACKS_RECEIVED Dhcpv4ClientMetricsRequestColumnNamesEnum + RELEASES_SENT Dhcpv4ClientMetricsRequestColumnNamesEnum + DECLINES_SENT Dhcpv4ClientMetricsRequestColumnNamesEnum +}{ + DISCOVERS_SENT: Dhcpv4ClientMetricsRequestColumnNamesEnum("discovers_sent"), + OFFERS_RECEIVED: Dhcpv4ClientMetricsRequestColumnNamesEnum("offers_received"), + REQUESTS_SENT: Dhcpv4ClientMetricsRequestColumnNamesEnum("requests_sent"), + ACKS_RECEIVED: Dhcpv4ClientMetricsRequestColumnNamesEnum("acks_received"), + NACKS_RECEIVED: Dhcpv4ClientMetricsRequestColumnNamesEnum("nacks_received"), + RELEASES_SENT: Dhcpv4ClientMetricsRequestColumnNamesEnum("releases_sent"), + DECLINES_SENT: Dhcpv4ClientMetricsRequestColumnNamesEnum("declines_sent"), +} + +func (obj *dhcpv4ClientMetricsRequest) ColumnNames() []Dhcpv4ClientMetricsRequestColumnNamesEnum { + items := []Dhcpv4ClientMetricsRequestColumnNamesEnum{} + for _, item := range obj.obj.ColumnNames { + items = append(items, Dhcpv4ClientMetricsRequestColumnNamesEnum(item.String())) + } + return items +} + +// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned. The name of the DHCPv4 client cannot be excluded. +// SetColumnNames sets the []string value in the Dhcpv4ClientMetricsRequest object +func (obj *dhcpv4ClientMetricsRequest) SetColumnNames(value []Dhcpv4ClientMetricsRequestColumnNamesEnum) Dhcpv4ClientMetricsRequest { + + items := []otg.Dhcpv4ClientMetricsRequest_ColumnNames_Enum{} + for _, item := range value { + intValue := otg.Dhcpv4ClientMetricsRequest_ColumnNames_Enum_value[string(item)] + items = append(items, otg.Dhcpv4ClientMetricsRequest_ColumnNames_Enum(intValue)) + } + obj.obj.ColumnNames = items + return obj +} + +func (obj *dhcpv4ClientMetricsRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *dhcpv4ClientMetricsRequest) setDefault() { + +} diff --git a/gosnappi/dhcpv4_client_params.go b/gosnappi/dhcpv4_client_params.go new file mode 100644 index 00000000..2b3d7804 --- /dev/null +++ b/gosnappi/dhcpv4_client_params.go @@ -0,0 +1,402 @@ +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" +) + +// ***** Dhcpv4ClientParams ***** +type dhcpv4ClientParams struct { + validation + obj *otg.Dhcpv4ClientParams + marshaller marshalDhcpv4ClientParams + unMarshaller unMarshalDhcpv4ClientParams +} + +func NewDhcpv4ClientParams() Dhcpv4ClientParams { + obj := dhcpv4ClientParams{obj: &otg.Dhcpv4ClientParams{}} + obj.setDefault() + return &obj +} + +func (obj *dhcpv4ClientParams) msg() *otg.Dhcpv4ClientParams { + return obj.obj +} + +func (obj *dhcpv4ClientParams) setMsg(msg *otg.Dhcpv4ClientParams) Dhcpv4ClientParams { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldhcpv4ClientParams struct { + obj *dhcpv4ClientParams +} + +type marshalDhcpv4ClientParams interface { + // ToProto marshals Dhcpv4ClientParams to protobuf object *otg.Dhcpv4ClientParams + ToProto() (*otg.Dhcpv4ClientParams, error) + // ToPbText marshals Dhcpv4ClientParams to protobuf text + ToPbText() (string, error) + // ToYaml marshals Dhcpv4ClientParams to YAML text + ToYaml() (string, error) + // ToJson marshals Dhcpv4ClientParams to JSON text + ToJson() (string, error) +} + +type unMarshaldhcpv4ClientParams struct { + obj *dhcpv4ClientParams +} + +type unMarshalDhcpv4ClientParams interface { + // FromProto unmarshals Dhcpv4ClientParams from protobuf object *otg.Dhcpv4ClientParams + FromProto(msg *otg.Dhcpv4ClientParams) (Dhcpv4ClientParams, error) + // FromPbText unmarshals Dhcpv4ClientParams from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Dhcpv4ClientParams from YAML text + FromYaml(value string) error + // FromJson unmarshals Dhcpv4ClientParams from JSON text + FromJson(value string) error +} + +func (obj *dhcpv4ClientParams) Marshal() marshalDhcpv4ClientParams { + if obj.marshaller == nil { + obj.marshaller = &marshaldhcpv4ClientParams{obj: obj} + } + return obj.marshaller +} + +func (obj *dhcpv4ClientParams) Unmarshal() unMarshalDhcpv4ClientParams { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldhcpv4ClientParams{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldhcpv4ClientParams) ToProto() (*otg.Dhcpv4ClientParams, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldhcpv4ClientParams) FromProto(msg *otg.Dhcpv4ClientParams) (Dhcpv4ClientParams, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldhcpv4ClientParams) 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 *unMarshaldhcpv4ClientParams) 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 *marshaldhcpv4ClientParams) 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 *unMarshaldhcpv4ClientParams) 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 *marshaldhcpv4ClientParams) 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 *unMarshaldhcpv4ClientParams) 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 *dhcpv4ClientParams) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *dhcpv4ClientParams) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *dhcpv4ClientParams) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *dhcpv4ClientParams) Clone() (Dhcpv4ClientParams, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDhcpv4ClientParams() + 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 +} + +// Dhcpv4ClientParams is configuration Parameter request list by emulated DHCPv4 Client. +type Dhcpv4ClientParams interface { + Validation + // msg marshals Dhcpv4ClientParams to protobuf object *otg.Dhcpv4ClientParams + // and doesn't set defaults + msg() *otg.Dhcpv4ClientParams + // setMsg unmarshals Dhcpv4ClientParams from protobuf object *otg.Dhcpv4ClientParams + // and doesn't set defaults + setMsg(*otg.Dhcpv4ClientParams) Dhcpv4ClientParams + // provides marshal interface + Marshal() marshalDhcpv4ClientParams + // provides unmarshal interface + Unmarshal() unMarshalDhcpv4ClientParams + // validate validates Dhcpv4ClientParams + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Dhcpv4ClientParams, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // SubnetMask returns bool, set in Dhcpv4ClientParams. + SubnetMask() bool + // SetSubnetMask assigns bool provided by user to Dhcpv4ClientParams + SetSubnetMask(value bool) Dhcpv4ClientParams + // HasSubnetMask checks if SubnetMask has been set in Dhcpv4ClientParams + HasSubnetMask() bool + // Router returns bool, set in Dhcpv4ClientParams. + Router() bool + // SetRouter assigns bool provided by user to Dhcpv4ClientParams + SetRouter(value bool) Dhcpv4ClientParams + // HasRouter checks if Router has been set in Dhcpv4ClientParams + HasRouter() bool + // RenewalTimer returns bool, set in Dhcpv4ClientParams. + RenewalTimer() bool + // SetRenewalTimer assigns bool provided by user to Dhcpv4ClientParams + SetRenewalTimer(value bool) Dhcpv4ClientParams + // HasRenewalTimer checks if RenewalTimer has been set in Dhcpv4ClientParams + HasRenewalTimer() bool + // RebindingTimer returns bool, set in Dhcpv4ClientParams. + RebindingTimer() bool + // SetRebindingTimer assigns bool provided by user to Dhcpv4ClientParams + SetRebindingTimer(value bool) Dhcpv4ClientParams + // HasRebindingTimer checks if RebindingTimer has been set in Dhcpv4ClientParams + HasRebindingTimer() bool +} + +// Request for the subnet mask option specifies the client's subnet mask as per RFC950. +// SubnetMask returns a bool +func (obj *dhcpv4ClientParams) SubnetMask() bool { + + return *obj.obj.SubnetMask + +} + +// Request for the subnet mask option specifies the client's subnet mask as per RFC950. +// SubnetMask returns a bool +func (obj *dhcpv4ClientParams) HasSubnetMask() bool { + return obj.obj.SubnetMask != nil +} + +// Request for the subnet mask option specifies the client's subnet mask as per RFC950. +// SetSubnetMask sets the bool value in the Dhcpv4ClientParams object +func (obj *dhcpv4ClientParams) SetSubnetMask(value bool) Dhcpv4ClientParams { + + obj.obj.SubnetMask = &value + return obj +} + +// Request for the router option that specifies a list of IP addresses for routers on the client's subnet. +// Router returns a bool +func (obj *dhcpv4ClientParams) Router() bool { + + return *obj.obj.Router + +} + +// Request for the router option that specifies a list of IP addresses for routers on the client's subnet. +// Router returns a bool +func (obj *dhcpv4ClientParams) HasRouter() bool { + return obj.obj.Router != nil +} + +// Request for the router option that specifies a list of IP addresses for routers on the client's subnet. +// SetRouter sets the bool value in the Dhcpv4ClientParams object +func (obj *dhcpv4ClientParams) SetRouter(value bool) Dhcpv4ClientParams { + + obj.obj.Router = &value + return obj +} + +// Request for the renewal timer, T1. When the timer expires, the client transitions from the BOUND state to the RENEWING state. +// RenewalTimer returns a bool +func (obj *dhcpv4ClientParams) RenewalTimer() bool { + + return *obj.obj.RenewalTimer + +} + +// Request for the renewal timer, T1. When the timer expires, the client transitions from the BOUND state to the RENEWING state. +// RenewalTimer returns a bool +func (obj *dhcpv4ClientParams) HasRenewalTimer() bool { + return obj.obj.RenewalTimer != nil +} + +// Request for the renewal timer, T1. When the timer expires, the client transitions from the BOUND state to the RENEWING state. +// SetRenewalTimer sets the bool value in the Dhcpv4ClientParams object +func (obj *dhcpv4ClientParams) SetRenewalTimer(value bool) Dhcpv4ClientParams { + + obj.obj.RenewalTimer = &value + return obj +} + +// Request for the rebinding timer (T2). When expires, the client transitions to the REBINDING state. +// RebindingTimer returns a bool +func (obj *dhcpv4ClientParams) RebindingTimer() bool { + + return *obj.obj.RebindingTimer + +} + +// Request for the rebinding timer (T2). When expires, the client transitions to the REBINDING state. +// RebindingTimer returns a bool +func (obj *dhcpv4ClientParams) HasRebindingTimer() bool { + return obj.obj.RebindingTimer != nil +} + +// Request for the rebinding timer (T2). When expires, the client transitions to the REBINDING state. +// SetRebindingTimer sets the bool value in the Dhcpv4ClientParams object +func (obj *dhcpv4ClientParams) SetRebindingTimer(value bool) Dhcpv4ClientParams { + + obj.obj.RebindingTimer = &value + return obj +} + +func (obj *dhcpv4ClientParams) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *dhcpv4ClientParams) setDefault() { + if obj.obj.SubnetMask == nil { + obj.SetSubnetMask(true) + } + if obj.obj.Router == nil { + obj.SetRouter(true) + } + if obj.obj.RenewalTimer == nil { + obj.SetRenewalTimer(false) + } + if obj.obj.RebindingTimer == nil { + obj.SetRebindingTimer(false) + } + +} diff --git a/gosnappi/dhcpv4_interface_state.go b/gosnappi/dhcpv4_interface_state.go new file mode 100644 index 00000000..e9f9171e --- /dev/null +++ b/gosnappi/dhcpv4_interface_state.go @@ -0,0 +1,484 @@ +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" +) + +// ***** Dhcpv4InterfaceState ***** +type dhcpv4InterfaceState struct { + validation + obj *otg.Dhcpv4InterfaceState + marshaller marshalDhcpv4InterfaceState + unMarshaller unMarshalDhcpv4InterfaceState +} + +func NewDhcpv4InterfaceState() Dhcpv4InterfaceState { + obj := dhcpv4InterfaceState{obj: &otg.Dhcpv4InterfaceState{}} + obj.setDefault() + return &obj +} + +func (obj *dhcpv4InterfaceState) msg() *otg.Dhcpv4InterfaceState { + return obj.obj +} + +func (obj *dhcpv4InterfaceState) setMsg(msg *otg.Dhcpv4InterfaceState) Dhcpv4InterfaceState { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldhcpv4InterfaceState struct { + obj *dhcpv4InterfaceState +} + +type marshalDhcpv4InterfaceState interface { + // ToProto marshals Dhcpv4InterfaceState to protobuf object *otg.Dhcpv4InterfaceState + ToProto() (*otg.Dhcpv4InterfaceState, error) + // ToPbText marshals Dhcpv4InterfaceState to protobuf text + ToPbText() (string, error) + // ToYaml marshals Dhcpv4InterfaceState to YAML text + ToYaml() (string, error) + // ToJson marshals Dhcpv4InterfaceState to JSON text + ToJson() (string, error) +} + +type unMarshaldhcpv4InterfaceState struct { + obj *dhcpv4InterfaceState +} + +type unMarshalDhcpv4InterfaceState interface { + // FromProto unmarshals Dhcpv4InterfaceState from protobuf object *otg.Dhcpv4InterfaceState + FromProto(msg *otg.Dhcpv4InterfaceState) (Dhcpv4InterfaceState, error) + // FromPbText unmarshals Dhcpv4InterfaceState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Dhcpv4InterfaceState from YAML text + FromYaml(value string) error + // FromJson unmarshals Dhcpv4InterfaceState from JSON text + FromJson(value string) error +} + +func (obj *dhcpv4InterfaceState) Marshal() marshalDhcpv4InterfaceState { + if obj.marshaller == nil { + obj.marshaller = &marshaldhcpv4InterfaceState{obj: obj} + } + return obj.marshaller +} + +func (obj *dhcpv4InterfaceState) Unmarshal() unMarshalDhcpv4InterfaceState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldhcpv4InterfaceState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldhcpv4InterfaceState) ToProto() (*otg.Dhcpv4InterfaceState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldhcpv4InterfaceState) FromProto(msg *otg.Dhcpv4InterfaceState) (Dhcpv4InterfaceState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldhcpv4InterfaceState) 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 *unMarshaldhcpv4InterfaceState) 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 *marshaldhcpv4InterfaceState) 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 *unMarshaldhcpv4InterfaceState) 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 *marshaldhcpv4InterfaceState) 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 *unMarshaldhcpv4InterfaceState) 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 *dhcpv4InterfaceState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *dhcpv4InterfaceState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *dhcpv4InterfaceState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *dhcpv4InterfaceState) Clone() (Dhcpv4InterfaceState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDhcpv4InterfaceState() + 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 +} + +// Dhcpv4InterfaceState is the IPv4 address associated with this DHCP Client session. +type Dhcpv4InterfaceState interface { + Validation + // msg marshals Dhcpv4InterfaceState to protobuf object *otg.Dhcpv4InterfaceState + // and doesn't set defaults + msg() *otg.Dhcpv4InterfaceState + // setMsg unmarshals Dhcpv4InterfaceState from protobuf object *otg.Dhcpv4InterfaceState + // and doesn't set defaults + setMsg(*otg.Dhcpv4InterfaceState) Dhcpv4InterfaceState + // provides marshal interface + Marshal() marshalDhcpv4InterfaceState + // provides unmarshal interface + Unmarshal() unMarshalDhcpv4InterfaceState + // validate validates Dhcpv4InterfaceState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Dhcpv4InterfaceState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // DhcpClientName returns string, set in Dhcpv4InterfaceState. + DhcpClientName() string + // SetDhcpClientName assigns string provided by user to Dhcpv4InterfaceState + SetDhcpClientName(value string) Dhcpv4InterfaceState + // HasDhcpClientName checks if DhcpClientName has been set in Dhcpv4InterfaceState + HasDhcpClientName() bool + // Ipv4Address returns string, set in Dhcpv4InterfaceState. + Ipv4Address() string + // SetIpv4Address assigns string provided by user to Dhcpv4InterfaceState + SetIpv4Address(value string) Dhcpv4InterfaceState + // HasIpv4Address checks if Ipv4Address has been set in Dhcpv4InterfaceState + HasIpv4Address() bool + // PrefixLength returns uint32, set in Dhcpv4InterfaceState. + PrefixLength() uint32 + // SetPrefixLength assigns uint32 provided by user to Dhcpv4InterfaceState + SetPrefixLength(value uint32) Dhcpv4InterfaceState + // HasPrefixLength checks if PrefixLength has been set in Dhcpv4InterfaceState + HasPrefixLength() bool + // GatewayAddress returns string, set in Dhcpv4InterfaceState. + GatewayAddress() string + // SetGatewayAddress assigns string provided by user to Dhcpv4InterfaceState + SetGatewayAddress(value string) Dhcpv4InterfaceState + // HasGatewayAddress checks if GatewayAddress has been set in Dhcpv4InterfaceState + HasGatewayAddress() bool + // LeaseTime returns uint32, set in Dhcpv4InterfaceState. + LeaseTime() uint32 + // SetLeaseTime assigns uint32 provided by user to Dhcpv4InterfaceState + SetLeaseTime(value uint32) Dhcpv4InterfaceState + // HasLeaseTime checks if LeaseTime has been set in Dhcpv4InterfaceState + HasLeaseTime() bool + // RenewTime returns uint32, set in Dhcpv4InterfaceState. + RenewTime() uint32 + // SetRenewTime assigns uint32 provided by user to Dhcpv4InterfaceState + SetRenewTime(value uint32) Dhcpv4InterfaceState + // HasRenewTime checks if RenewTime has been set in Dhcpv4InterfaceState + HasRenewTime() bool + // RebindTime returns uint32, set in Dhcpv4InterfaceState. + RebindTime() uint32 + // SetRebindTime assigns uint32 provided by user to Dhcpv4InterfaceState + SetRebindTime(value uint32) Dhcpv4InterfaceState + // HasRebindTime checks if RebindTime has been set in Dhcpv4InterfaceState + HasRebindTime() bool +} + +// The name of a DHCPv4 Client. +// DhcpClientName returns a string +func (obj *dhcpv4InterfaceState) DhcpClientName() string { + + return *obj.obj.DhcpClientName + +} + +// The name of a DHCPv4 Client. +// DhcpClientName returns a string +func (obj *dhcpv4InterfaceState) HasDhcpClientName() bool { + return obj.obj.DhcpClientName != nil +} + +// The name of a DHCPv4 Client. +// SetDhcpClientName sets the string value in the Dhcpv4InterfaceState object +func (obj *dhcpv4InterfaceState) SetDhcpClientName(value string) Dhcpv4InterfaceState { + + obj.obj.DhcpClientName = &value + return obj +} + +// The IPv4 address associated with this DHCP Client session. +// Ipv4Address returns a string +func (obj *dhcpv4InterfaceState) Ipv4Address() string { + + return *obj.obj.Ipv4Address + +} + +// The IPv4 address associated with this DHCP Client session. +// Ipv4Address returns a string +func (obj *dhcpv4InterfaceState) HasIpv4Address() bool { + return obj.obj.Ipv4Address != nil +} + +// The IPv4 address associated with this DHCP Client session. +// SetIpv4Address sets the string value in the Dhcpv4InterfaceState object +func (obj *dhcpv4InterfaceState) SetIpv4Address(value string) Dhcpv4InterfaceState { + + obj.obj.Ipv4Address = &value + return obj +} + +// The length of the prefix. +// PrefixLength returns a uint32 +func (obj *dhcpv4InterfaceState) PrefixLength() uint32 { + + return *obj.obj.PrefixLength + +} + +// The length of the prefix. +// PrefixLength returns a uint32 +func (obj *dhcpv4InterfaceState) HasPrefixLength() bool { + return obj.obj.PrefixLength != nil +} + +// The length of the prefix. +// SetPrefixLength sets the uint32 value in the Dhcpv4InterfaceState object +func (obj *dhcpv4InterfaceState) SetPrefixLength(value uint32) Dhcpv4InterfaceState { + + obj.obj.PrefixLength = &value + return obj +} + +// The Gateway Ipv4 address associated with this DHCP Client session. +// GatewayAddress returns a string +func (obj *dhcpv4InterfaceState) GatewayAddress() string { + + return *obj.obj.GatewayAddress + +} + +// The Gateway Ipv4 address associated with this DHCP Client session. +// GatewayAddress returns a string +func (obj *dhcpv4InterfaceState) HasGatewayAddress() bool { + return obj.obj.GatewayAddress != nil +} + +// The Gateway Ipv4 address associated with this DHCP Client session. +// SetGatewayAddress sets the string value in the Dhcpv4InterfaceState object +func (obj *dhcpv4InterfaceState) SetGatewayAddress(value string) Dhcpv4InterfaceState { + + obj.obj.GatewayAddress = &value + return obj +} + +// The duration of the IPv4 address lease, in seconds. +// LeaseTime returns a uint32 +func (obj *dhcpv4InterfaceState) LeaseTime() uint32 { + + return *obj.obj.LeaseTime + +} + +// The duration of the IPv4 address lease, in seconds. +// LeaseTime returns a uint32 +func (obj *dhcpv4InterfaceState) HasLeaseTime() bool { + return obj.obj.LeaseTime != nil +} + +// The duration of the IPv4 address lease, in seconds. +// SetLeaseTime sets the uint32 value in the Dhcpv4InterfaceState object +func (obj *dhcpv4InterfaceState) SetLeaseTime(value uint32) Dhcpv4InterfaceState { + + obj.obj.LeaseTime = &value + return obj +} + +// Time in seconds until the DHCPv4 client starts renewing the lease. +// RenewTime returns a uint32 +func (obj *dhcpv4InterfaceState) RenewTime() uint32 { + + return *obj.obj.RenewTime + +} + +// Time in seconds until the DHCPv4 client starts renewing the lease. +// RenewTime returns a uint32 +func (obj *dhcpv4InterfaceState) HasRenewTime() bool { + return obj.obj.RenewTime != nil +} + +// Time in seconds until the DHCPv4 client starts renewing the lease. +// SetRenewTime sets the uint32 value in the Dhcpv4InterfaceState object +func (obj *dhcpv4InterfaceState) SetRenewTime(value uint32) Dhcpv4InterfaceState { + + obj.obj.RenewTime = &value + return obj +} + +// Time in seconds until the DHCPv4 client starts rebinding. +// RebindTime returns a uint32 +func (obj *dhcpv4InterfaceState) RebindTime() uint32 { + + return *obj.obj.RebindTime + +} + +// Time in seconds until the DHCPv4 client starts rebinding. +// RebindTime returns a uint32 +func (obj *dhcpv4InterfaceState) HasRebindTime() bool { + return obj.obj.RebindTime != nil +} + +// Time in seconds until the DHCPv4 client starts rebinding. +// SetRebindTime sets the uint32 value in the Dhcpv4InterfaceState object +func (obj *dhcpv4InterfaceState) SetRebindTime(value uint32) Dhcpv4InterfaceState { + + obj.obj.RebindTime = &value + return obj +} + +func (obj *dhcpv4InterfaceState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.PrefixLength != nil { + + if *obj.obj.PrefixLength > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= Dhcpv4InterfaceState.PrefixLength <= 32 but Got %d", *obj.obj.PrefixLength)) + } + + } + +} + +func (obj *dhcpv4InterfaceState) setDefault() { + +} diff --git a/gosnappi/dhcpv4_interface_state_request.go b/gosnappi/dhcpv4_interface_state_request.go new file mode 100644 index 00000000..fdfb484f --- /dev/null +++ b/gosnappi/dhcpv4_interface_state_request.go @@ -0,0 +1,317 @@ +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" +) + +// ***** Dhcpv4InterfaceStateRequest ***** +type dhcpv4InterfaceStateRequest struct { + validation + obj *otg.Dhcpv4InterfaceStateRequest + marshaller marshalDhcpv4InterfaceStateRequest + unMarshaller unMarshalDhcpv4InterfaceStateRequest +} + +func NewDhcpv4InterfaceStateRequest() Dhcpv4InterfaceStateRequest { + obj := dhcpv4InterfaceStateRequest{obj: &otg.Dhcpv4InterfaceStateRequest{}} + obj.setDefault() + return &obj +} + +func (obj *dhcpv4InterfaceStateRequest) msg() *otg.Dhcpv4InterfaceStateRequest { + return obj.obj +} + +func (obj *dhcpv4InterfaceStateRequest) setMsg(msg *otg.Dhcpv4InterfaceStateRequest) Dhcpv4InterfaceStateRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldhcpv4InterfaceStateRequest struct { + obj *dhcpv4InterfaceStateRequest +} + +type marshalDhcpv4InterfaceStateRequest interface { + // ToProto marshals Dhcpv4InterfaceStateRequest to protobuf object *otg.Dhcpv4InterfaceStateRequest + ToProto() (*otg.Dhcpv4InterfaceStateRequest, error) + // ToPbText marshals Dhcpv4InterfaceStateRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals Dhcpv4InterfaceStateRequest to YAML text + ToYaml() (string, error) + // ToJson marshals Dhcpv4InterfaceStateRequest to JSON text + ToJson() (string, error) +} + +type unMarshaldhcpv4InterfaceStateRequest struct { + obj *dhcpv4InterfaceStateRequest +} + +type unMarshalDhcpv4InterfaceStateRequest interface { + // FromProto unmarshals Dhcpv4InterfaceStateRequest from protobuf object *otg.Dhcpv4InterfaceStateRequest + FromProto(msg *otg.Dhcpv4InterfaceStateRequest) (Dhcpv4InterfaceStateRequest, error) + // FromPbText unmarshals Dhcpv4InterfaceStateRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Dhcpv4InterfaceStateRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals Dhcpv4InterfaceStateRequest from JSON text + FromJson(value string) error +} + +func (obj *dhcpv4InterfaceStateRequest) Marshal() marshalDhcpv4InterfaceStateRequest { + if obj.marshaller == nil { + obj.marshaller = &marshaldhcpv4InterfaceStateRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *dhcpv4InterfaceStateRequest) Unmarshal() unMarshalDhcpv4InterfaceStateRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldhcpv4InterfaceStateRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldhcpv4InterfaceStateRequest) ToProto() (*otg.Dhcpv4InterfaceStateRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldhcpv4InterfaceStateRequest) FromProto(msg *otg.Dhcpv4InterfaceStateRequest) (Dhcpv4InterfaceStateRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldhcpv4InterfaceStateRequest) 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 *unMarshaldhcpv4InterfaceStateRequest) 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 *marshaldhcpv4InterfaceStateRequest) 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 *unMarshaldhcpv4InterfaceStateRequest) 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 *marshaldhcpv4InterfaceStateRequest) 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 *unMarshaldhcpv4InterfaceStateRequest) 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 *dhcpv4InterfaceStateRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *dhcpv4InterfaceStateRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *dhcpv4InterfaceStateRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *dhcpv4InterfaceStateRequest) Clone() (Dhcpv4InterfaceStateRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDhcpv4InterfaceStateRequest() + 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 +} + +// Dhcpv4InterfaceStateRequest is the request for assigned IPv4 address information associated with DHCP Client sessions. +type Dhcpv4InterfaceStateRequest interface { + Validation + // msg marshals Dhcpv4InterfaceStateRequest to protobuf object *otg.Dhcpv4InterfaceStateRequest + // and doesn't set defaults + msg() *otg.Dhcpv4InterfaceStateRequest + // setMsg unmarshals Dhcpv4InterfaceStateRequest from protobuf object *otg.Dhcpv4InterfaceStateRequest + // and doesn't set defaults + setMsg(*otg.Dhcpv4InterfaceStateRequest) Dhcpv4InterfaceStateRequest + // provides marshal interface + Marshal() marshalDhcpv4InterfaceStateRequest + // provides unmarshal interface + Unmarshal() unMarshalDhcpv4InterfaceStateRequest + // validate validates Dhcpv4InterfaceStateRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Dhcpv4InterfaceStateRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // DhcpClientNames returns []string, set in Dhcpv4InterfaceStateRequest. + DhcpClientNames() []string + // SetDhcpClientNames assigns []string provided by user to Dhcpv4InterfaceStateRequest + SetDhcpClientNames(value []string) Dhcpv4InterfaceStateRequest +} + +// The names of DHCPv4 client to return results for. An empty list will return results for all DHCPv4 Client address information. +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// DhcpClientNames returns a []string +func (obj *dhcpv4InterfaceStateRequest) DhcpClientNames() []string { + if obj.obj.DhcpClientNames == nil { + obj.obj.DhcpClientNames = make([]string, 0) + } + return obj.obj.DhcpClientNames +} + +// The names of DHCPv4 client to return results for. An empty list will return results for all DHCPv4 Client address information. +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// SetDhcpClientNames sets the []string value in the Dhcpv4InterfaceStateRequest object +func (obj *dhcpv4InterfaceStateRequest) SetDhcpClientNames(value []string) Dhcpv4InterfaceStateRequest { + + if obj.obj.DhcpClientNames == nil { + obj.obj.DhcpClientNames = make([]string, 0) + } + obj.obj.DhcpClientNames = value + + return obj +} + +func (obj *dhcpv4InterfaceStateRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *dhcpv4InterfaceStateRequest) setDefault() { + +} diff --git a/gosnappi/dhcpv4_lease_state.go b/gosnappi/dhcpv4_lease_state.go new file mode 100644 index 00000000..ea18a22d --- /dev/null +++ b/gosnappi/dhcpv4_lease_state.go @@ -0,0 +1,502 @@ +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" +) + +// ***** Dhcpv4LeaseState ***** +type dhcpv4LeaseState struct { + validation + obj *otg.Dhcpv4LeaseState + marshaller marshalDhcpv4LeaseState + unMarshaller unMarshalDhcpv4LeaseState +} + +func NewDhcpv4LeaseState() Dhcpv4LeaseState { + obj := dhcpv4LeaseState{obj: &otg.Dhcpv4LeaseState{}} + obj.setDefault() + return &obj +} + +func (obj *dhcpv4LeaseState) msg() *otg.Dhcpv4LeaseState { + return obj.obj +} + +func (obj *dhcpv4LeaseState) setMsg(msg *otg.Dhcpv4LeaseState) Dhcpv4LeaseState { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldhcpv4LeaseState struct { + obj *dhcpv4LeaseState +} + +type marshalDhcpv4LeaseState interface { + // ToProto marshals Dhcpv4LeaseState to protobuf object *otg.Dhcpv4LeaseState + ToProto() (*otg.Dhcpv4LeaseState, error) + // ToPbText marshals Dhcpv4LeaseState to protobuf text + ToPbText() (string, error) + // ToYaml marshals Dhcpv4LeaseState to YAML text + ToYaml() (string, error) + // ToJson marshals Dhcpv4LeaseState to JSON text + ToJson() (string, error) +} + +type unMarshaldhcpv4LeaseState struct { + obj *dhcpv4LeaseState +} + +type unMarshalDhcpv4LeaseState interface { + // FromProto unmarshals Dhcpv4LeaseState from protobuf object *otg.Dhcpv4LeaseState + FromProto(msg *otg.Dhcpv4LeaseState) (Dhcpv4LeaseState, error) + // FromPbText unmarshals Dhcpv4LeaseState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Dhcpv4LeaseState from YAML text + FromYaml(value string) error + // FromJson unmarshals Dhcpv4LeaseState from JSON text + FromJson(value string) error +} + +func (obj *dhcpv4LeaseState) Marshal() marshalDhcpv4LeaseState { + if obj.marshaller == nil { + obj.marshaller = &marshaldhcpv4LeaseState{obj: obj} + } + return obj.marshaller +} + +func (obj *dhcpv4LeaseState) Unmarshal() unMarshalDhcpv4LeaseState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldhcpv4LeaseState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldhcpv4LeaseState) ToProto() (*otg.Dhcpv4LeaseState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldhcpv4LeaseState) FromProto(msg *otg.Dhcpv4LeaseState) (Dhcpv4LeaseState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldhcpv4LeaseState) 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 *unMarshaldhcpv4LeaseState) 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 *marshaldhcpv4LeaseState) 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 *unMarshaldhcpv4LeaseState) 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 *marshaldhcpv4LeaseState) 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 *unMarshaldhcpv4LeaseState) 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 *dhcpv4LeaseState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *dhcpv4LeaseState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *dhcpv4LeaseState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *dhcpv4LeaseState) Clone() (Dhcpv4LeaseState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDhcpv4LeaseState() + 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 +} + +// Dhcpv4LeaseState is iPv4 address lease state. +type Dhcpv4LeaseState interface { + Validation + // msg marshals Dhcpv4LeaseState to protobuf object *otg.Dhcpv4LeaseState + // and doesn't set defaults + msg() *otg.Dhcpv4LeaseState + // setMsg unmarshals Dhcpv4LeaseState from protobuf object *otg.Dhcpv4LeaseState + // and doesn't set defaults + setMsg(*otg.Dhcpv4LeaseState) Dhcpv4LeaseState + // provides marshal interface + Marshal() marshalDhcpv4LeaseState + // provides unmarshal interface + Unmarshal() unMarshalDhcpv4LeaseState + // validate validates Dhcpv4LeaseState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Dhcpv4LeaseState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Address returns string, set in Dhcpv4LeaseState. + Address() string + // SetAddress assigns string provided by user to Dhcpv4LeaseState + SetAddress(value string) Dhcpv4LeaseState + // HasAddress checks if Address has been set in Dhcpv4LeaseState + HasAddress() bool + // ValidTime returns uint32, set in Dhcpv4LeaseState. + ValidTime() uint32 + // SetValidTime assigns uint32 provided by user to Dhcpv4LeaseState + SetValidTime(value uint32) Dhcpv4LeaseState + // HasValidTime checks if ValidTime has been set in Dhcpv4LeaseState + HasValidTime() bool + // PreferredTime returns uint32, set in Dhcpv4LeaseState. + PreferredTime() uint32 + // SetPreferredTime assigns uint32 provided by user to Dhcpv4LeaseState + SetPreferredTime(value uint32) Dhcpv4LeaseState + // HasPreferredTime checks if PreferredTime has been set in Dhcpv4LeaseState + HasPreferredTime() bool + // RenewTime returns uint32, set in Dhcpv4LeaseState. + RenewTime() uint32 + // SetRenewTime assigns uint32 provided by user to Dhcpv4LeaseState + SetRenewTime(value uint32) Dhcpv4LeaseState + // HasRenewTime checks if RenewTime has been set in Dhcpv4LeaseState + HasRenewTime() bool + // RebindTime returns uint32, set in Dhcpv4LeaseState. + RebindTime() uint32 + // SetRebindTime assigns uint32 provided by user to Dhcpv4LeaseState + SetRebindTime(value uint32) Dhcpv4LeaseState + // HasRebindTime checks if RebindTime has been set in Dhcpv4LeaseState + HasRebindTime() bool + // ClientId returns string, set in Dhcpv4LeaseState. + ClientId() string + // SetClientId assigns string provided by user to Dhcpv4LeaseState + SetClientId(value string) Dhcpv4LeaseState + // HasClientId checks if ClientId has been set in Dhcpv4LeaseState + HasClientId() bool + // CircuitId returns string, set in Dhcpv4LeaseState. + CircuitId() string + // SetCircuitId assigns string provided by user to Dhcpv4LeaseState + SetCircuitId(value string) Dhcpv4LeaseState + // HasCircuitId checks if CircuitId has been set in Dhcpv4LeaseState + HasCircuitId() bool + // RemoteId returns string, set in Dhcpv4LeaseState. + RemoteId() string + // SetRemoteId assigns string provided by user to Dhcpv4LeaseState + SetRemoteId(value string) Dhcpv4LeaseState + // HasRemoteId checks if RemoteId has been set in Dhcpv4LeaseState + HasRemoteId() bool +} + +// The IPv4 address associated with this lease. +// Address returns a string +func (obj *dhcpv4LeaseState) Address() string { + + return *obj.obj.Address + +} + +// The IPv4 address associated with this lease. +// Address returns a string +func (obj *dhcpv4LeaseState) HasAddress() bool { + return obj.obj.Address != nil +} + +// The IPv4 address associated with this lease. +// SetAddress sets the string value in the Dhcpv4LeaseState object +func (obj *dhcpv4LeaseState) SetAddress(value string) Dhcpv4LeaseState { + + obj.obj.Address = &value + return obj +} + +// The time in seconds after which the IPv4 address lease will expire. +// ValidTime returns a uint32 +func (obj *dhcpv4LeaseState) ValidTime() uint32 { + + return *obj.obj.ValidTime + +} + +// The time in seconds after which the IPv4 address lease will expire. +// ValidTime returns a uint32 +func (obj *dhcpv4LeaseState) HasValidTime() bool { + return obj.obj.ValidTime != nil +} + +// The time in seconds after which the IPv4 address lease will expire. +// SetValidTime sets the uint32 value in the Dhcpv4LeaseState object +func (obj *dhcpv4LeaseState) SetValidTime(value uint32) Dhcpv4LeaseState { + + obj.obj.ValidTime = &value + return obj +} + +// The elapsed time in seconds since the address has been renewed. +// PreferredTime returns a uint32 +func (obj *dhcpv4LeaseState) PreferredTime() uint32 { + + return *obj.obj.PreferredTime + +} + +// The elapsed time in seconds since the address has been renewed. +// PreferredTime returns a uint32 +func (obj *dhcpv4LeaseState) HasPreferredTime() bool { + return obj.obj.PreferredTime != nil +} + +// The elapsed time in seconds since the address has been renewed. +// SetPreferredTime sets the uint32 value in the Dhcpv4LeaseState object +func (obj *dhcpv4LeaseState) SetPreferredTime(value uint32) Dhcpv4LeaseState { + + obj.obj.PreferredTime = &value + return obj +} + +// Time in seconds until the DHCPv4 client starts renewing the lease. +// RenewTime returns a uint32 +func (obj *dhcpv4LeaseState) RenewTime() uint32 { + + return *obj.obj.RenewTime + +} + +// Time in seconds until the DHCPv4 client starts renewing the lease. +// RenewTime returns a uint32 +func (obj *dhcpv4LeaseState) HasRenewTime() bool { + return obj.obj.RenewTime != nil +} + +// Time in seconds until the DHCPv4 client starts renewing the lease. +// SetRenewTime sets the uint32 value in the Dhcpv4LeaseState object +func (obj *dhcpv4LeaseState) SetRenewTime(value uint32) Dhcpv4LeaseState { + + obj.obj.RenewTime = &value + return obj +} + +// Time in seconds until the DHCPv4 client starts rebinding. +// RebindTime returns a uint32 +func (obj *dhcpv4LeaseState) RebindTime() uint32 { + + return *obj.obj.RebindTime + +} + +// Time in seconds until the DHCPv4 client starts rebinding. +// RebindTime returns a uint32 +func (obj *dhcpv4LeaseState) HasRebindTime() bool { + return obj.obj.RebindTime != nil +} + +// Time in seconds until the DHCPv4 client starts rebinding. +// SetRebindTime sets the uint32 value in the Dhcpv4LeaseState object +func (obj *dhcpv4LeaseState) SetRebindTime(value uint32) Dhcpv4LeaseState { + + obj.obj.RebindTime = &value + return obj +} + +// The ID of the DHCPv4 client holding this lease. +// ClientId returns a string +func (obj *dhcpv4LeaseState) ClientId() string { + + return *obj.obj.ClientId + +} + +// The ID of the DHCPv4 client holding this lease. +// ClientId returns a string +func (obj *dhcpv4LeaseState) HasClientId() bool { + return obj.obj.ClientId != nil +} + +// The ID of the DHCPv4 client holding this lease. +// SetClientId sets the string value in the Dhcpv4LeaseState object +func (obj *dhcpv4LeaseState) SetClientId(value string) Dhcpv4LeaseState { + + obj.obj.ClientId = &value + return obj +} + +// The Circuit ID option found in the last request message. +// CircuitId returns a string +func (obj *dhcpv4LeaseState) CircuitId() string { + + return *obj.obj.CircuitId + +} + +// The Circuit ID option found in the last request message. +// CircuitId returns a string +func (obj *dhcpv4LeaseState) HasCircuitId() bool { + return obj.obj.CircuitId != nil +} + +// The Circuit ID option found in the last request message. +// SetCircuitId sets the string value in the Dhcpv4LeaseState object +func (obj *dhcpv4LeaseState) SetCircuitId(value string) Dhcpv4LeaseState { + + obj.obj.CircuitId = &value + return obj +} + +// The Remote ID option found in the last request message. +// RemoteId returns a string +func (obj *dhcpv4LeaseState) RemoteId() string { + + return *obj.obj.RemoteId + +} + +// The Remote ID option found in the last request message. +// RemoteId returns a string +func (obj *dhcpv4LeaseState) HasRemoteId() bool { + return obj.obj.RemoteId != nil +} + +// The Remote ID option found in the last request message. +// SetRemoteId sets the string value in the Dhcpv4LeaseState object +func (obj *dhcpv4LeaseState) SetRemoteId(value string) Dhcpv4LeaseState { + + obj.obj.RemoteId = &value + return obj +} + +func (obj *dhcpv4LeaseState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *dhcpv4LeaseState) setDefault() { + +} diff --git a/gosnappi/dhcpv4_lease_state_request.go b/gosnappi/dhcpv4_lease_state_request.go new file mode 100644 index 00000000..d447343d --- /dev/null +++ b/gosnappi/dhcpv4_lease_state_request.go @@ -0,0 +1,317 @@ +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" +) + +// ***** Dhcpv4LeaseStateRequest ***** +type dhcpv4LeaseStateRequest struct { + validation + obj *otg.Dhcpv4LeaseStateRequest + marshaller marshalDhcpv4LeaseStateRequest + unMarshaller unMarshalDhcpv4LeaseStateRequest +} + +func NewDhcpv4LeaseStateRequest() Dhcpv4LeaseStateRequest { + obj := dhcpv4LeaseStateRequest{obj: &otg.Dhcpv4LeaseStateRequest{}} + obj.setDefault() + return &obj +} + +func (obj *dhcpv4LeaseStateRequest) msg() *otg.Dhcpv4LeaseStateRequest { + return obj.obj +} + +func (obj *dhcpv4LeaseStateRequest) setMsg(msg *otg.Dhcpv4LeaseStateRequest) Dhcpv4LeaseStateRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldhcpv4LeaseStateRequest struct { + obj *dhcpv4LeaseStateRequest +} + +type marshalDhcpv4LeaseStateRequest interface { + // ToProto marshals Dhcpv4LeaseStateRequest to protobuf object *otg.Dhcpv4LeaseStateRequest + ToProto() (*otg.Dhcpv4LeaseStateRequest, error) + // ToPbText marshals Dhcpv4LeaseStateRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals Dhcpv4LeaseStateRequest to YAML text + ToYaml() (string, error) + // ToJson marshals Dhcpv4LeaseStateRequest to JSON text + ToJson() (string, error) +} + +type unMarshaldhcpv4LeaseStateRequest struct { + obj *dhcpv4LeaseStateRequest +} + +type unMarshalDhcpv4LeaseStateRequest interface { + // FromProto unmarshals Dhcpv4LeaseStateRequest from protobuf object *otg.Dhcpv4LeaseStateRequest + FromProto(msg *otg.Dhcpv4LeaseStateRequest) (Dhcpv4LeaseStateRequest, error) + // FromPbText unmarshals Dhcpv4LeaseStateRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Dhcpv4LeaseStateRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals Dhcpv4LeaseStateRequest from JSON text + FromJson(value string) error +} + +func (obj *dhcpv4LeaseStateRequest) Marshal() marshalDhcpv4LeaseStateRequest { + if obj.marshaller == nil { + obj.marshaller = &marshaldhcpv4LeaseStateRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *dhcpv4LeaseStateRequest) Unmarshal() unMarshalDhcpv4LeaseStateRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldhcpv4LeaseStateRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldhcpv4LeaseStateRequest) ToProto() (*otg.Dhcpv4LeaseStateRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldhcpv4LeaseStateRequest) FromProto(msg *otg.Dhcpv4LeaseStateRequest) (Dhcpv4LeaseStateRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldhcpv4LeaseStateRequest) 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 *unMarshaldhcpv4LeaseStateRequest) 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 *marshaldhcpv4LeaseStateRequest) 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 *unMarshaldhcpv4LeaseStateRequest) 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 *marshaldhcpv4LeaseStateRequest) 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 *unMarshaldhcpv4LeaseStateRequest) 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 *dhcpv4LeaseStateRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *dhcpv4LeaseStateRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *dhcpv4LeaseStateRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *dhcpv4LeaseStateRequest) Clone() (Dhcpv4LeaseStateRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDhcpv4LeaseStateRequest() + 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 +} + +// Dhcpv4LeaseStateRequest is the request to retrieve DHCP Server host allocated status. +type Dhcpv4LeaseStateRequest interface { + Validation + // msg marshals Dhcpv4LeaseStateRequest to protobuf object *otg.Dhcpv4LeaseStateRequest + // and doesn't set defaults + msg() *otg.Dhcpv4LeaseStateRequest + // setMsg unmarshals Dhcpv4LeaseStateRequest from protobuf object *otg.Dhcpv4LeaseStateRequest + // and doesn't set defaults + setMsg(*otg.Dhcpv4LeaseStateRequest) Dhcpv4LeaseStateRequest + // provides marshal interface + Marshal() marshalDhcpv4LeaseStateRequest + // provides unmarshal interface + Unmarshal() unMarshalDhcpv4LeaseStateRequest + // validate validates Dhcpv4LeaseStateRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Dhcpv4LeaseStateRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // DhcpServerNames returns []string, set in Dhcpv4LeaseStateRequest. + DhcpServerNames() []string + // SetDhcpServerNames assigns []string provided by user to Dhcpv4LeaseStateRequest + SetDhcpServerNames(value []string) Dhcpv4LeaseStateRequest +} + +// The names of DHCPv4 server to return results for. An empty list will return results for all DHCPv4 servers. +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4server/properties/name +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4server/properties/name +// +// DhcpServerNames returns a []string +func (obj *dhcpv4LeaseStateRequest) DhcpServerNames() []string { + if obj.obj.DhcpServerNames == nil { + obj.obj.DhcpServerNames = make([]string, 0) + } + return obj.obj.DhcpServerNames +} + +// The names of DHCPv4 server to return results for. An empty list will return results for all DHCPv4 servers. +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4server/properties/name +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4server/properties/name +// +// SetDhcpServerNames sets the []string value in the Dhcpv4LeaseStateRequest object +func (obj *dhcpv4LeaseStateRequest) SetDhcpServerNames(value []string) Dhcpv4LeaseStateRequest { + + if obj.obj.DhcpServerNames == nil { + obj.obj.DhcpServerNames = make([]string, 0) + } + obj.obj.DhcpServerNames = value + + return obj +} + +func (obj *dhcpv4LeaseStateRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *dhcpv4LeaseStateRequest) setDefault() { + +} diff --git a/gosnappi/dhcpv4_leases_state.go b/gosnappi/dhcpv4_leases_state.go new file mode 100644 index 00000000..9691d4a4 --- /dev/null +++ b/gosnappi/dhcpv4_leases_state.go @@ -0,0 +1,418 @@ +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" +) + +// ***** Dhcpv4LeasesState ***** +type dhcpv4LeasesState struct { + validation + obj *otg.Dhcpv4LeasesState + marshaller marshalDhcpv4LeasesState + unMarshaller unMarshalDhcpv4LeasesState + leasesHolder Dhcpv4LeasesStateDhcpv4LeaseStateIter +} + +func NewDhcpv4LeasesState() Dhcpv4LeasesState { + obj := dhcpv4LeasesState{obj: &otg.Dhcpv4LeasesState{}} + obj.setDefault() + return &obj +} + +func (obj *dhcpv4LeasesState) msg() *otg.Dhcpv4LeasesState { + return obj.obj +} + +func (obj *dhcpv4LeasesState) setMsg(msg *otg.Dhcpv4LeasesState) Dhcpv4LeasesState { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldhcpv4LeasesState struct { + obj *dhcpv4LeasesState +} + +type marshalDhcpv4LeasesState interface { + // ToProto marshals Dhcpv4LeasesState to protobuf object *otg.Dhcpv4LeasesState + ToProto() (*otg.Dhcpv4LeasesState, error) + // ToPbText marshals Dhcpv4LeasesState to protobuf text + ToPbText() (string, error) + // ToYaml marshals Dhcpv4LeasesState to YAML text + ToYaml() (string, error) + // ToJson marshals Dhcpv4LeasesState to JSON text + ToJson() (string, error) +} + +type unMarshaldhcpv4LeasesState struct { + obj *dhcpv4LeasesState +} + +type unMarshalDhcpv4LeasesState interface { + // FromProto unmarshals Dhcpv4LeasesState from protobuf object *otg.Dhcpv4LeasesState + FromProto(msg *otg.Dhcpv4LeasesState) (Dhcpv4LeasesState, error) + // FromPbText unmarshals Dhcpv4LeasesState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Dhcpv4LeasesState from YAML text + FromYaml(value string) error + // FromJson unmarshals Dhcpv4LeasesState from JSON text + FromJson(value string) error +} + +func (obj *dhcpv4LeasesState) Marshal() marshalDhcpv4LeasesState { + if obj.marshaller == nil { + obj.marshaller = &marshaldhcpv4LeasesState{obj: obj} + } + return obj.marshaller +} + +func (obj *dhcpv4LeasesState) Unmarshal() unMarshalDhcpv4LeasesState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldhcpv4LeasesState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldhcpv4LeasesState) ToProto() (*otg.Dhcpv4LeasesState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldhcpv4LeasesState) FromProto(msg *otg.Dhcpv4LeasesState) (Dhcpv4LeasesState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldhcpv4LeasesState) 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 *unMarshaldhcpv4LeasesState) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshaldhcpv4LeasesState) 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 *unMarshaldhcpv4LeasesState) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshaldhcpv4LeasesState) 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 *unMarshaldhcpv4LeasesState) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *dhcpv4LeasesState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *dhcpv4LeasesState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *dhcpv4LeasesState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *dhcpv4LeasesState) Clone() (Dhcpv4LeasesState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDhcpv4LeasesState() + 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 +} + +func (obj *dhcpv4LeasesState) setNil() { + obj.leasesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// Dhcpv4LeasesState is lease information of DHCP Server. +type Dhcpv4LeasesState interface { + Validation + // msg marshals Dhcpv4LeasesState to protobuf object *otg.Dhcpv4LeasesState + // and doesn't set defaults + msg() *otg.Dhcpv4LeasesState + // setMsg unmarshals Dhcpv4LeasesState from protobuf object *otg.Dhcpv4LeasesState + // and doesn't set defaults + setMsg(*otg.Dhcpv4LeasesState) Dhcpv4LeasesState + // provides marshal interface + Marshal() marshalDhcpv4LeasesState + // provides unmarshal interface + Unmarshal() unMarshalDhcpv4LeasesState + // validate validates Dhcpv4LeasesState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Dhcpv4LeasesState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // DhcpServerName returns string, set in Dhcpv4LeasesState. + DhcpServerName() string + // SetDhcpServerName assigns string provided by user to Dhcpv4LeasesState + SetDhcpServerName(value string) Dhcpv4LeasesState + // HasDhcpServerName checks if DhcpServerName has been set in Dhcpv4LeasesState + HasDhcpServerName() bool + // Leases returns Dhcpv4LeasesStateDhcpv4LeaseStateIterIter, set in Dhcpv4LeasesState + Leases() Dhcpv4LeasesStateDhcpv4LeaseStateIter + setNil() +} + +// The name of a DHCP Server. +// DhcpServerName returns a string +func (obj *dhcpv4LeasesState) DhcpServerName() string { + + return *obj.obj.DhcpServerName + +} + +// The name of a DHCP Server. +// DhcpServerName returns a string +func (obj *dhcpv4LeasesState) HasDhcpServerName() bool { + return obj.obj.DhcpServerName != nil +} + +// The name of a DHCP Server. +// SetDhcpServerName sets the string value in the Dhcpv4LeasesState object +func (obj *dhcpv4LeasesState) SetDhcpServerName(value string) Dhcpv4LeasesState { + + obj.obj.DhcpServerName = &value + return obj +} + +// description is TBD +// Leases returns a []Dhcpv4LeaseState +func (obj *dhcpv4LeasesState) Leases() Dhcpv4LeasesStateDhcpv4LeaseStateIter { + if len(obj.obj.Leases) == 0 { + obj.obj.Leases = []*otg.Dhcpv4LeaseState{} + } + if obj.leasesHolder == nil { + obj.leasesHolder = newDhcpv4LeasesStateDhcpv4LeaseStateIter(&obj.obj.Leases).setMsg(obj) + } + return obj.leasesHolder +} + +type dhcpv4LeasesStateDhcpv4LeaseStateIter struct { + obj *dhcpv4LeasesState + dhcpv4LeaseStateSlice []Dhcpv4LeaseState + fieldPtr *[]*otg.Dhcpv4LeaseState +} + +func newDhcpv4LeasesStateDhcpv4LeaseStateIter(ptr *[]*otg.Dhcpv4LeaseState) Dhcpv4LeasesStateDhcpv4LeaseStateIter { + return &dhcpv4LeasesStateDhcpv4LeaseStateIter{fieldPtr: ptr} +} + +type Dhcpv4LeasesStateDhcpv4LeaseStateIter interface { + setMsg(*dhcpv4LeasesState) Dhcpv4LeasesStateDhcpv4LeaseStateIter + Items() []Dhcpv4LeaseState + Add() Dhcpv4LeaseState + Append(items ...Dhcpv4LeaseState) Dhcpv4LeasesStateDhcpv4LeaseStateIter + Set(index int, newObj Dhcpv4LeaseState) Dhcpv4LeasesStateDhcpv4LeaseStateIter + Clear() Dhcpv4LeasesStateDhcpv4LeaseStateIter + clearHolderSlice() Dhcpv4LeasesStateDhcpv4LeaseStateIter + appendHolderSlice(item Dhcpv4LeaseState) Dhcpv4LeasesStateDhcpv4LeaseStateIter +} + +func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) setMsg(msg *dhcpv4LeasesState) Dhcpv4LeasesStateDhcpv4LeaseStateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&dhcpv4LeaseState{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) Items() []Dhcpv4LeaseState { + return obj.dhcpv4LeaseStateSlice +} + +func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) Add() Dhcpv4LeaseState { + newObj := &otg.Dhcpv4LeaseState{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &dhcpv4LeaseState{obj: newObj} + newLibObj.setDefault() + obj.dhcpv4LeaseStateSlice = append(obj.dhcpv4LeaseStateSlice, newLibObj) + return newLibObj +} + +func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) Append(items ...Dhcpv4LeaseState) Dhcpv4LeasesStateDhcpv4LeaseStateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.dhcpv4LeaseStateSlice = append(obj.dhcpv4LeaseStateSlice, item) + } + return obj +} + +func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) Set(index int, newObj Dhcpv4LeaseState) Dhcpv4LeasesStateDhcpv4LeaseStateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.dhcpv4LeaseStateSlice[index] = newObj + return obj +} +func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) Clear() Dhcpv4LeasesStateDhcpv4LeaseStateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Dhcpv4LeaseState{} + obj.dhcpv4LeaseStateSlice = []Dhcpv4LeaseState{} + } + return obj +} +func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) clearHolderSlice() Dhcpv4LeasesStateDhcpv4LeaseStateIter { + if len(obj.dhcpv4LeaseStateSlice) > 0 { + obj.dhcpv4LeaseStateSlice = []Dhcpv4LeaseState{} + } + return obj +} +func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) appendHolderSlice(item Dhcpv4LeaseState) Dhcpv4LeasesStateDhcpv4LeaseStateIter { + obj.dhcpv4LeaseStateSlice = append(obj.dhcpv4LeaseStateSlice, item) + return obj +} + +func (obj *dhcpv4LeasesState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Leases) != 0 { + + if set_default { + obj.Leases().clearHolderSlice() + for _, item := range obj.obj.Leases { + obj.Leases().appendHolderSlice(&dhcpv4LeaseState{obj: item}) + } + } + for _, item := range obj.Leases().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *dhcpv4LeasesState) setDefault() { + +} diff --git a/gosnappi/dhcpv4_server_metric.go b/gosnappi/dhcpv4_server_metric.go new file mode 100644 index 00000000..60b7c127 --- /dev/null +++ b/gosnappi/dhcpv4_server_metric.go @@ -0,0 +1,502 @@ +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" +) + +// ***** Dhcpv4ServerMetric ***** +type dhcpv4ServerMetric struct { + validation + obj *otg.Dhcpv4ServerMetric + marshaller marshalDhcpv4ServerMetric + unMarshaller unMarshalDhcpv4ServerMetric +} + +func NewDhcpv4ServerMetric() Dhcpv4ServerMetric { + obj := dhcpv4ServerMetric{obj: &otg.Dhcpv4ServerMetric{}} + obj.setDefault() + return &obj +} + +func (obj *dhcpv4ServerMetric) msg() *otg.Dhcpv4ServerMetric { + return obj.obj +} + +func (obj *dhcpv4ServerMetric) setMsg(msg *otg.Dhcpv4ServerMetric) Dhcpv4ServerMetric { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldhcpv4ServerMetric struct { + obj *dhcpv4ServerMetric +} + +type marshalDhcpv4ServerMetric interface { + // ToProto marshals Dhcpv4ServerMetric to protobuf object *otg.Dhcpv4ServerMetric + ToProto() (*otg.Dhcpv4ServerMetric, error) + // ToPbText marshals Dhcpv4ServerMetric to protobuf text + ToPbText() (string, error) + // ToYaml marshals Dhcpv4ServerMetric to YAML text + ToYaml() (string, error) + // ToJson marshals Dhcpv4ServerMetric to JSON text + ToJson() (string, error) +} + +type unMarshaldhcpv4ServerMetric struct { + obj *dhcpv4ServerMetric +} + +type unMarshalDhcpv4ServerMetric interface { + // FromProto unmarshals Dhcpv4ServerMetric from protobuf object *otg.Dhcpv4ServerMetric + FromProto(msg *otg.Dhcpv4ServerMetric) (Dhcpv4ServerMetric, error) + // FromPbText unmarshals Dhcpv4ServerMetric from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Dhcpv4ServerMetric from YAML text + FromYaml(value string) error + // FromJson unmarshals Dhcpv4ServerMetric from JSON text + FromJson(value string) error +} + +func (obj *dhcpv4ServerMetric) Marshal() marshalDhcpv4ServerMetric { + if obj.marshaller == nil { + obj.marshaller = &marshaldhcpv4ServerMetric{obj: obj} + } + return obj.marshaller +} + +func (obj *dhcpv4ServerMetric) Unmarshal() unMarshalDhcpv4ServerMetric { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldhcpv4ServerMetric{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldhcpv4ServerMetric) ToProto() (*otg.Dhcpv4ServerMetric, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldhcpv4ServerMetric) FromProto(msg *otg.Dhcpv4ServerMetric) (Dhcpv4ServerMetric, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldhcpv4ServerMetric) 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 *unMarshaldhcpv4ServerMetric) 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 *marshaldhcpv4ServerMetric) 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 *unMarshaldhcpv4ServerMetric) 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 *marshaldhcpv4ServerMetric) 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 *unMarshaldhcpv4ServerMetric) 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 *dhcpv4ServerMetric) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *dhcpv4ServerMetric) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *dhcpv4ServerMetric) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *dhcpv4ServerMetric) Clone() (Dhcpv4ServerMetric, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDhcpv4ServerMetric() + 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 +} + +// Dhcpv4ServerMetric is dHCPv4 per peer statistics information. +type Dhcpv4ServerMetric interface { + Validation + // msg marshals Dhcpv4ServerMetric to protobuf object *otg.Dhcpv4ServerMetric + // and doesn't set defaults + msg() *otg.Dhcpv4ServerMetric + // setMsg unmarshals Dhcpv4ServerMetric from protobuf object *otg.Dhcpv4ServerMetric + // and doesn't set defaults + setMsg(*otg.Dhcpv4ServerMetric) Dhcpv4ServerMetric + // provides marshal interface + Marshal() marshalDhcpv4ServerMetric + // provides unmarshal interface + Unmarshal() unMarshalDhcpv4ServerMetric + // validate validates Dhcpv4ServerMetric + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Dhcpv4ServerMetric, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in Dhcpv4ServerMetric. + Name() string + // SetName assigns string provided by user to Dhcpv4ServerMetric + SetName(value string) Dhcpv4ServerMetric + // HasName checks if Name has been set in Dhcpv4ServerMetric + HasName() bool + // DiscoversReceived returns uint64, set in Dhcpv4ServerMetric. + DiscoversReceived() uint64 + // SetDiscoversReceived assigns uint64 provided by user to Dhcpv4ServerMetric + SetDiscoversReceived(value uint64) Dhcpv4ServerMetric + // HasDiscoversReceived checks if DiscoversReceived has been set in Dhcpv4ServerMetric + HasDiscoversReceived() bool + // OffersSent returns uint64, set in Dhcpv4ServerMetric. + OffersSent() uint64 + // SetOffersSent assigns uint64 provided by user to Dhcpv4ServerMetric + SetOffersSent(value uint64) Dhcpv4ServerMetric + // HasOffersSent checks if OffersSent has been set in Dhcpv4ServerMetric + HasOffersSent() bool + // RequestsReceived returns uint64, set in Dhcpv4ServerMetric. + RequestsReceived() uint64 + // SetRequestsReceived assigns uint64 provided by user to Dhcpv4ServerMetric + SetRequestsReceived(value uint64) Dhcpv4ServerMetric + // HasRequestsReceived checks if RequestsReceived has been set in Dhcpv4ServerMetric + HasRequestsReceived() bool + // AcksSent returns uint64, set in Dhcpv4ServerMetric. + AcksSent() uint64 + // SetAcksSent assigns uint64 provided by user to Dhcpv4ServerMetric + SetAcksSent(value uint64) Dhcpv4ServerMetric + // HasAcksSent checks if AcksSent has been set in Dhcpv4ServerMetric + HasAcksSent() bool + // NacksSent returns uint64, set in Dhcpv4ServerMetric. + NacksSent() uint64 + // SetNacksSent assigns uint64 provided by user to Dhcpv4ServerMetric + SetNacksSent(value uint64) Dhcpv4ServerMetric + // HasNacksSent checks if NacksSent has been set in Dhcpv4ServerMetric + HasNacksSent() bool + // ReleasesReceived returns uint64, set in Dhcpv4ServerMetric. + ReleasesReceived() uint64 + // SetReleasesReceived assigns uint64 provided by user to Dhcpv4ServerMetric + SetReleasesReceived(value uint64) Dhcpv4ServerMetric + // HasReleasesReceived checks if ReleasesReceived has been set in Dhcpv4ServerMetric + HasReleasesReceived() bool + // DeclinesReceived returns uint64, set in Dhcpv4ServerMetric. + DeclinesReceived() uint64 + // SetDeclinesReceived assigns uint64 provided by user to Dhcpv4ServerMetric + SetDeclinesReceived(value uint64) Dhcpv4ServerMetric + // HasDeclinesReceived checks if DeclinesReceived has been set in Dhcpv4ServerMetric + HasDeclinesReceived() bool +} + +// The name of a configured DHCPv4 Server. +// Name returns a string +func (obj *dhcpv4ServerMetric) Name() string { + + return *obj.obj.Name + +} + +// The name of a configured DHCPv4 Server. +// Name returns a string +func (obj *dhcpv4ServerMetric) HasName() bool { + return obj.obj.Name != nil +} + +// The name of a configured DHCPv4 Server. +// SetName sets the string value in the Dhcpv4ServerMetric object +func (obj *dhcpv4ServerMetric) SetName(value string) Dhcpv4ServerMetric { + + obj.obj.Name = &value + return obj +} + +// Number of DHCPDISCOVER messages received. +// DiscoversReceived returns a uint64 +func (obj *dhcpv4ServerMetric) DiscoversReceived() uint64 { + + return *obj.obj.DiscoversReceived + +} + +// Number of DHCPDISCOVER messages received. +// DiscoversReceived returns a uint64 +func (obj *dhcpv4ServerMetric) HasDiscoversReceived() bool { + return obj.obj.DiscoversReceived != nil +} + +// Number of DHCPDISCOVER messages received. +// SetDiscoversReceived sets the uint64 value in the Dhcpv4ServerMetric object +func (obj *dhcpv4ServerMetric) SetDiscoversReceived(value uint64) Dhcpv4ServerMetric { + + obj.obj.DiscoversReceived = &value + return obj +} + +// Number of DHCPOFFER messages sent. +// OffersSent returns a uint64 +func (obj *dhcpv4ServerMetric) OffersSent() uint64 { + + return *obj.obj.OffersSent + +} + +// Number of DHCPOFFER messages sent. +// OffersSent returns a uint64 +func (obj *dhcpv4ServerMetric) HasOffersSent() bool { + return obj.obj.OffersSent != nil +} + +// Number of DHCPOFFER messages sent. +// SetOffersSent sets the uint64 value in the Dhcpv4ServerMetric object +func (obj *dhcpv4ServerMetric) SetOffersSent(value uint64) Dhcpv4ServerMetric { + + obj.obj.OffersSent = &value + return obj +} + +// Number of DHCPOFFER messages received. +// RequestsReceived returns a uint64 +func (obj *dhcpv4ServerMetric) RequestsReceived() uint64 { + + return *obj.obj.RequestsReceived + +} + +// Number of DHCPOFFER messages received. +// RequestsReceived returns a uint64 +func (obj *dhcpv4ServerMetric) HasRequestsReceived() bool { + return obj.obj.RequestsReceived != nil +} + +// Number of DHCPOFFER messages received. +// SetRequestsReceived sets the uint64 value in the Dhcpv4ServerMetric object +func (obj *dhcpv4ServerMetric) SetRequestsReceived(value uint64) Dhcpv4ServerMetric { + + obj.obj.RequestsReceived = &value + return obj +} + +// Number of lease DHCPACK messages sent. +// AcksSent returns a uint64 +func (obj *dhcpv4ServerMetric) AcksSent() uint64 { + + return *obj.obj.AcksSent + +} + +// Number of lease DHCPACK messages sent. +// AcksSent returns a uint64 +func (obj *dhcpv4ServerMetric) HasAcksSent() bool { + return obj.obj.AcksSent != nil +} + +// Number of lease DHCPACK messages sent. +// SetAcksSent sets the uint64 value in the Dhcpv4ServerMetric object +func (obj *dhcpv4ServerMetric) SetAcksSent(value uint64) Dhcpv4ServerMetric { + + obj.obj.AcksSent = &value + return obj +} + +// Number of negative lease DHCPNACK messages sent. +// NacksSent returns a uint64 +func (obj *dhcpv4ServerMetric) NacksSent() uint64 { + + return *obj.obj.NacksSent + +} + +// Number of negative lease DHCPNACK messages sent. +// NacksSent returns a uint64 +func (obj *dhcpv4ServerMetric) HasNacksSent() bool { + return obj.obj.NacksSent != nil +} + +// Number of negative lease DHCPNACK messages sent. +// SetNacksSent sets the uint64 value in the Dhcpv4ServerMetric object +func (obj *dhcpv4ServerMetric) SetNacksSent(value uint64) Dhcpv4ServerMetric { + + obj.obj.NacksSent = &value + return obj +} + +// Number of DHCPRELEASE messages received. +// ReleasesReceived returns a uint64 +func (obj *dhcpv4ServerMetric) ReleasesReceived() uint64 { + + return *obj.obj.ReleasesReceived + +} + +// Number of DHCPRELEASE messages received. +// ReleasesReceived returns a uint64 +func (obj *dhcpv4ServerMetric) HasReleasesReceived() bool { + return obj.obj.ReleasesReceived != nil +} + +// Number of DHCPRELEASE messages received. +// SetReleasesReceived sets the uint64 value in the Dhcpv4ServerMetric object +func (obj *dhcpv4ServerMetric) SetReleasesReceived(value uint64) Dhcpv4ServerMetric { + + obj.obj.ReleasesReceived = &value + return obj +} + +// Number of DHCPDECLINE messages received. +// DeclinesReceived returns a uint64 +func (obj *dhcpv4ServerMetric) DeclinesReceived() uint64 { + + return *obj.obj.DeclinesReceived + +} + +// Number of DHCPDECLINE messages received. +// DeclinesReceived returns a uint64 +func (obj *dhcpv4ServerMetric) HasDeclinesReceived() bool { + return obj.obj.DeclinesReceived != nil +} + +// Number of DHCPDECLINE messages received. +// SetDeclinesReceived sets the uint64 value in the Dhcpv4ServerMetric object +func (obj *dhcpv4ServerMetric) SetDeclinesReceived(value uint64) Dhcpv4ServerMetric { + + obj.obj.DeclinesReceived = &value + return obj +} + +func (obj *dhcpv4ServerMetric) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *dhcpv4ServerMetric) setDefault() { + +} diff --git a/gosnappi/dhcpv4_server_metrics_request.go b/gosnappi/dhcpv4_server_metrics_request.go new file mode 100644 index 00000000..0c704e76 --- /dev/null +++ b/gosnappi/dhcpv4_server_metrics_request.go @@ -0,0 +1,363 @@ +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" +) + +// ***** Dhcpv4ServerMetricsRequest ***** +type dhcpv4ServerMetricsRequest struct { + validation + obj *otg.Dhcpv4ServerMetricsRequest + marshaller marshalDhcpv4ServerMetricsRequest + unMarshaller unMarshalDhcpv4ServerMetricsRequest +} + +func NewDhcpv4ServerMetricsRequest() Dhcpv4ServerMetricsRequest { + obj := dhcpv4ServerMetricsRequest{obj: &otg.Dhcpv4ServerMetricsRequest{}} + obj.setDefault() + return &obj +} + +func (obj *dhcpv4ServerMetricsRequest) msg() *otg.Dhcpv4ServerMetricsRequest { + return obj.obj +} + +func (obj *dhcpv4ServerMetricsRequest) setMsg(msg *otg.Dhcpv4ServerMetricsRequest) Dhcpv4ServerMetricsRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaldhcpv4ServerMetricsRequest struct { + obj *dhcpv4ServerMetricsRequest +} + +type marshalDhcpv4ServerMetricsRequest interface { + // ToProto marshals Dhcpv4ServerMetricsRequest to protobuf object *otg.Dhcpv4ServerMetricsRequest + ToProto() (*otg.Dhcpv4ServerMetricsRequest, error) + // ToPbText marshals Dhcpv4ServerMetricsRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals Dhcpv4ServerMetricsRequest to YAML text + ToYaml() (string, error) + // ToJson marshals Dhcpv4ServerMetricsRequest to JSON text + ToJson() (string, error) +} + +type unMarshaldhcpv4ServerMetricsRequest struct { + obj *dhcpv4ServerMetricsRequest +} + +type unMarshalDhcpv4ServerMetricsRequest interface { + // FromProto unmarshals Dhcpv4ServerMetricsRequest from protobuf object *otg.Dhcpv4ServerMetricsRequest + FromProto(msg *otg.Dhcpv4ServerMetricsRequest) (Dhcpv4ServerMetricsRequest, error) + // FromPbText unmarshals Dhcpv4ServerMetricsRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Dhcpv4ServerMetricsRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals Dhcpv4ServerMetricsRequest from JSON text + FromJson(value string) error +} + +func (obj *dhcpv4ServerMetricsRequest) Marshal() marshalDhcpv4ServerMetricsRequest { + if obj.marshaller == nil { + obj.marshaller = &marshaldhcpv4ServerMetricsRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *dhcpv4ServerMetricsRequest) Unmarshal() unMarshalDhcpv4ServerMetricsRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaldhcpv4ServerMetricsRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaldhcpv4ServerMetricsRequest) ToProto() (*otg.Dhcpv4ServerMetricsRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaldhcpv4ServerMetricsRequest) FromProto(msg *otg.Dhcpv4ServerMetricsRequest) (Dhcpv4ServerMetricsRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaldhcpv4ServerMetricsRequest) 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 *unMarshaldhcpv4ServerMetricsRequest) 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 *marshaldhcpv4ServerMetricsRequest) 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 *unMarshaldhcpv4ServerMetricsRequest) 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 *marshaldhcpv4ServerMetricsRequest) 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 *unMarshaldhcpv4ServerMetricsRequest) 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 *dhcpv4ServerMetricsRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *dhcpv4ServerMetricsRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *dhcpv4ServerMetricsRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *dhcpv4ServerMetricsRequest) Clone() (Dhcpv4ServerMetricsRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewDhcpv4ServerMetricsRequest() + 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 +} + +// Dhcpv4ServerMetricsRequest is the request to retrieve DHCPv4 per Server metrics/statistics. +type Dhcpv4ServerMetricsRequest interface { + Validation + // msg marshals Dhcpv4ServerMetricsRequest to protobuf object *otg.Dhcpv4ServerMetricsRequest + // and doesn't set defaults + msg() *otg.Dhcpv4ServerMetricsRequest + // setMsg unmarshals Dhcpv4ServerMetricsRequest from protobuf object *otg.Dhcpv4ServerMetricsRequest + // and doesn't set defaults + setMsg(*otg.Dhcpv4ServerMetricsRequest) Dhcpv4ServerMetricsRequest + // provides marshal interface + Marshal() marshalDhcpv4ServerMetricsRequest + // provides unmarshal interface + Unmarshal() unMarshalDhcpv4ServerMetricsRequest + // validate validates Dhcpv4ServerMetricsRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Dhcpv4ServerMetricsRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ServerNames returns []string, set in Dhcpv4ServerMetricsRequest. + ServerNames() []string + // SetServerNames assigns []string provided by user to Dhcpv4ServerMetricsRequest + SetServerNames(value []string) Dhcpv4ServerMetricsRequest + // ColumnNames returns []Dhcpv4ServerMetricsRequestColumnNamesEnum, set in Dhcpv4ServerMetricsRequest + ColumnNames() []Dhcpv4ServerMetricsRequestColumnNamesEnum + // SetColumnNames assigns []Dhcpv4ServerMetricsRequestColumnNamesEnum provided by user to Dhcpv4ServerMetricsRequest + SetColumnNames(value []Dhcpv4ServerMetricsRequestColumnNamesEnum) Dhcpv4ServerMetricsRequest +} + +// The names of DHCPv4 Servers to return results for. An empty list will return results for all DHCPv4 Server. +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4Server/properties/name +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4Server/properties/name +// +// ServerNames returns a []string +func (obj *dhcpv4ServerMetricsRequest) ServerNames() []string { + if obj.obj.ServerNames == nil { + obj.obj.ServerNames = make([]string, 0) + } + return obj.obj.ServerNames +} + +// The names of DHCPv4 Servers to return results for. An empty list will return results for all DHCPv4 Server. +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4Server/properties/name +// +// x-constraint: +// - /components/schemas/Device.Dhcpv4Server/properties/name +// +// SetServerNames sets the []string value in the Dhcpv4ServerMetricsRequest object +func (obj *dhcpv4ServerMetricsRequest) SetServerNames(value []string) Dhcpv4ServerMetricsRequest { + + if obj.obj.ServerNames == nil { + obj.obj.ServerNames = make([]string, 0) + } + obj.obj.ServerNames = value + + return obj +} + +type Dhcpv4ServerMetricsRequestColumnNamesEnum string + +// Enum of ColumnNames on Dhcpv4ServerMetricsRequest +var Dhcpv4ServerMetricsRequestColumnNames = struct { + DISCOVERS_RECEIVED Dhcpv4ServerMetricsRequestColumnNamesEnum + OFFERS_SENT Dhcpv4ServerMetricsRequestColumnNamesEnum + REQUESTS_RECEIVED Dhcpv4ServerMetricsRequestColumnNamesEnum + ACKS_SENT Dhcpv4ServerMetricsRequestColumnNamesEnum + NACKS_SENT Dhcpv4ServerMetricsRequestColumnNamesEnum + RELEASES_RECEIVED Dhcpv4ServerMetricsRequestColumnNamesEnum + DECLINES_RECEIVED Dhcpv4ServerMetricsRequestColumnNamesEnum +}{ + DISCOVERS_RECEIVED: Dhcpv4ServerMetricsRequestColumnNamesEnum("discovers_received"), + OFFERS_SENT: Dhcpv4ServerMetricsRequestColumnNamesEnum("offers_sent"), + REQUESTS_RECEIVED: Dhcpv4ServerMetricsRequestColumnNamesEnum("requests_received"), + ACKS_SENT: Dhcpv4ServerMetricsRequestColumnNamesEnum("acks_sent"), + NACKS_SENT: Dhcpv4ServerMetricsRequestColumnNamesEnum("nacks_sent"), + RELEASES_RECEIVED: Dhcpv4ServerMetricsRequestColumnNamesEnum("releases_received"), + DECLINES_RECEIVED: Dhcpv4ServerMetricsRequestColumnNamesEnum("declines_received"), +} + +func (obj *dhcpv4ServerMetricsRequest) ColumnNames() []Dhcpv4ServerMetricsRequestColumnNamesEnum { + items := []Dhcpv4ServerMetricsRequestColumnNamesEnum{} + for _, item := range obj.obj.ColumnNames { + items = append(items, Dhcpv4ServerMetricsRequestColumnNamesEnum(item.String())) + } + return items +} + +// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned. The name of the DHCPv4 server cannot be excluded. +// SetColumnNames sets the []string value in the Dhcpv4ServerMetricsRequest object +func (obj *dhcpv4ServerMetricsRequest) SetColumnNames(value []Dhcpv4ServerMetricsRequestColumnNamesEnum) Dhcpv4ServerMetricsRequest { + + items := []otg.Dhcpv4ServerMetricsRequest_ColumnNames_Enum{} + for _, item := range value { + intValue := otg.Dhcpv4ServerMetricsRequest_ColumnNames_Enum_value[string(item)] + items = append(items, otg.Dhcpv4ServerMetricsRequest_ColumnNames_Enum(intValue)) + } + obj.obj.ColumnNames = items + return obj +} + +func (obj *dhcpv4ServerMetricsRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *dhcpv4ServerMetricsRequest) setDefault() { + +} diff --git a/gosnappi/error.go b/gosnappi/error.go new file mode 100644 index 00000000..24315d18 --- /dev/null +++ b/gosnappi/error.go @@ -0,0 +1,386 @@ +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" +) + +// ***** Error ***** +type _error struct { + validation + obj *otg.Error + marshaller marshalError + unMarshaller unMarshalError +} + +func NewError() Error { + obj := _error{obj: &otg.Error{}} + obj.setDefault() + return &obj +} + +func (obj *_error) msg() *otg.Error { + return obj.obj +} + +func (obj *_error) setMsg(msg *otg.Error) Error { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshal_error struct { + obj *_error +} + +type marshalError interface { + // ToProto marshals Error to protobuf object *otg.Error + ToProto() (*otg.Error, error) + // ToPbText marshals Error to protobuf text + ToPbText() (string, error) + // ToYaml marshals Error to YAML text + ToYaml() (string, error) + // ToJson marshals Error to JSON text + ToJson() (string, error) +} + +type unMarshal_error struct { + obj *_error +} + +type unMarshalError interface { + // FromProto unmarshals Error from protobuf object *otg.Error + FromProto(msg *otg.Error) (Error, error) + // FromPbText unmarshals Error from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Error from YAML text + FromYaml(value string) error + // FromJson unmarshals Error from JSON text + FromJson(value string) error +} + +func (obj *_error) Marshal() marshalError { + if obj.marshaller == nil { + obj.marshaller = &marshal_error{obj: obj} + } + return obj.marshaller +} + +func (obj *_error) Unmarshal() unMarshalError { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshal_error{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshal_error) ToProto() (*otg.Error, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshal_error) FromProto(msg *otg.Error) (Error, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshal_error) 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 *unMarshal_error) 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 *marshal_error) 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 *unMarshal_error) 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 *marshal_error) 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 *unMarshal_error) 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 *_error) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *_error) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *_error) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *_error) Clone() (Error, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewError() + 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 +} + +// Error is error response generated while serving API request. +type Error interface { + Validation + // msg marshals Error to protobuf object *otg.Error + // and doesn't set defaults + msg() *otg.Error + // setMsg unmarshals Error from protobuf object *otg.Error + // and doesn't set defaults + setMsg(*otg.Error) Error + // provides marshal interface + Marshal() marshalError + // provides unmarshal interface + Unmarshal() unMarshalError + // validate validates Error + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Error, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Code returns int32, set in Error. + Code() int32 + // SetCode assigns int32 provided by user to Error + SetCode(value int32) Error + // Kind returns ErrorKindEnum, set in Error + Kind() ErrorKindEnum + // SetKind assigns ErrorKindEnum provided by user to Error + SetKind(value ErrorKindEnum) Error + // HasKind checks if Kind has been set in Error + HasKind() bool + // Errors returns []string, set in Error. + Errors() []string + // SetErrors assigns []string provided by user to Error + SetErrors(value []string) Error + // implement Error function for implementingnative Error Interface. + Error() string +} + +func (obj *_error) Error() string { + json, err := obj.Marshal().ToJson() + if err != nil { + return fmt.Sprintf("could not convert Error to JSON: %v", err) + } + return json +} + +// Numeric status code based on the underlying transport being used. +// The API server MUST set this code explicitly based on following references: +// - HTTP 4xx errors: https://datatracker.ietf.org/doc/html/rfc9110#section-15.5 +// - HTTP 5xx errors: https://datatracker.ietf.org/doc/html/rfc9110#section-15.6 +// - gRPC errors: https://grpc.github.io/grpc/core/md_doc_statuscodes.html +// Code returns a int32 +func (obj *_error) Code() int32 { + + return *obj.obj.Code + +} + +// Numeric status code based on the underlying transport being used. +// The API server MUST set this code explicitly based on following references: +// - HTTP 4xx errors: https://datatracker.ietf.org/doc/html/rfc9110#section-15.5 +// - HTTP 5xx errors: https://datatracker.ietf.org/doc/html/rfc9110#section-15.6 +// - gRPC errors: https://grpc.github.io/grpc/core/md_doc_statuscodes.html +// SetCode sets the int32 value in the Error object +func (obj *_error) SetCode(value int32) Error { + + obj.obj.Code = &value + return obj +} + +type ErrorKindEnum string + +// Enum of Kind on Error +var ErrorKind = struct { + VALIDATION ErrorKindEnum + INTERNAL ErrorKindEnum +}{ + VALIDATION: ErrorKindEnum("validation"), + INTERNAL: ErrorKindEnum("internal"), +} + +func (obj *_error) Kind() ErrorKindEnum { + return ErrorKindEnum(obj.obj.Kind.Enum().String()) +} + +// Classification of error originating from within API server that may not be mapped to the value in `code`. +// Absence of this field may indicate that the error did not originate from within API server. +// Kind returns a string +func (obj *_error) HasKind() bool { + return obj.obj.Kind != nil +} + +func (obj *_error) SetKind(value ErrorKindEnum) Error { + intValue, ok := otg.Error_Kind_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ErrorKindEnum", string(value))) + return obj + } + enumValue := otg.Error_Kind_Enum(intValue) + obj.obj.Kind = &enumValue + + return obj +} + +// List of error messages generated while executing the request. +// Errors returns a []string +func (obj *_error) Errors() []string { + if obj.obj.Errors == nil { + obj.obj.Errors = make([]string, 0) + } + return obj.obj.Errors +} + +// List of error messages generated while executing the request. +// SetErrors sets the []string value in the Error object +func (obj *_error) SetErrors(value []string) Error { + + if obj.obj.Errors == nil { + obj.obj.Errors = make([]string, 0) + } + obj.obj.Errors = value + + return obj +} + +func (obj *_error) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Code is required + if obj.obj.Code == nil { + vObj.validationErrors = append(vObj.validationErrors, "Code is required field on interface Error") + } +} + +func (obj *_error) setDefault() { + +} diff --git a/gosnappi/ethernet_connection.go b/gosnappi/ethernet_connection.go new file mode 100644 index 00000000..ec4c412f --- /dev/null +++ b/gosnappi/ethernet_connection.go @@ -0,0 +1,515 @@ +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" +) + +// ***** EthernetConnection ***** +type ethernetConnection struct { + validation + obj *otg.EthernetConnection + marshaller marshalEthernetConnection + unMarshaller unMarshalEthernetConnection +} + +func NewEthernetConnection() EthernetConnection { + obj := ethernetConnection{obj: &otg.EthernetConnection{}} + obj.setDefault() + return &obj +} + +func (obj *ethernetConnection) msg() *otg.EthernetConnection { + return obj.obj +} + +func (obj *ethernetConnection) setMsg(msg *otg.EthernetConnection) EthernetConnection { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalethernetConnection struct { + obj *ethernetConnection +} + +type marshalEthernetConnection interface { + // ToProto marshals EthernetConnection to protobuf object *otg.EthernetConnection + ToProto() (*otg.EthernetConnection, error) + // ToPbText marshals EthernetConnection to protobuf text + ToPbText() (string, error) + // ToYaml marshals EthernetConnection to YAML text + ToYaml() (string, error) + // ToJson marshals EthernetConnection to JSON text + ToJson() (string, error) +} + +type unMarshalethernetConnection struct { + obj *ethernetConnection +} + +type unMarshalEthernetConnection interface { + // FromProto unmarshals EthernetConnection from protobuf object *otg.EthernetConnection + FromProto(msg *otg.EthernetConnection) (EthernetConnection, error) + // FromPbText unmarshals EthernetConnection from protobuf text + FromPbText(value string) error + // FromYaml unmarshals EthernetConnection from YAML text + FromYaml(value string) error + // FromJson unmarshals EthernetConnection from JSON text + FromJson(value string) error +} + +func (obj *ethernetConnection) Marshal() marshalEthernetConnection { + if obj.marshaller == nil { + obj.marshaller = &marshalethernetConnection{obj: obj} + } + return obj.marshaller +} + +func (obj *ethernetConnection) Unmarshal() unMarshalEthernetConnection { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalethernetConnection{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalethernetConnection) ToProto() (*otg.EthernetConnection, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalethernetConnection) FromProto(msg *otg.EthernetConnection) (EthernetConnection, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalethernetConnection) 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 *unMarshalethernetConnection) 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 *marshalethernetConnection) 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 *unMarshalethernetConnection) 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 *marshalethernetConnection) 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 *unMarshalethernetConnection) 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 *ethernetConnection) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *ethernetConnection) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *ethernetConnection) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *ethernetConnection) Clone() (EthernetConnection, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewEthernetConnection() + 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 +} + +// EthernetConnection is ethernet interface connection to a port, LAG or VXLAN tunnel. +type EthernetConnection interface { + Validation + // msg marshals EthernetConnection to protobuf object *otg.EthernetConnection + // and doesn't set defaults + msg() *otg.EthernetConnection + // setMsg unmarshals EthernetConnection from protobuf object *otg.EthernetConnection + // and doesn't set defaults + setMsg(*otg.EthernetConnection) EthernetConnection + // provides marshal interface + Marshal() marshalEthernetConnection + // provides unmarshal interface + Unmarshal() unMarshalEthernetConnection + // validate validates EthernetConnection + validate() error + // A stringer function + String() string + // Clones the object + Clone() (EthernetConnection, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns EthernetConnectionChoiceEnum, set in EthernetConnection + Choice() EthernetConnectionChoiceEnum + // setChoice assigns EthernetConnectionChoiceEnum provided by user to EthernetConnection + setChoice(value EthernetConnectionChoiceEnum) EthernetConnection + // HasChoice checks if Choice has been set in EthernetConnection + HasChoice() bool + // PortName returns string, set in EthernetConnection. + PortName() string + // SetPortName assigns string provided by user to EthernetConnection + SetPortName(value string) EthernetConnection + // HasPortName checks if PortName has been set in EthernetConnection + HasPortName() bool + // LagName returns string, set in EthernetConnection. + LagName() string + // SetLagName assigns string provided by user to EthernetConnection + SetLagName(value string) EthernetConnection + // HasLagName checks if LagName has been set in EthernetConnection + HasLagName() bool + // VxlanName returns string, set in EthernetConnection. + VxlanName() string + // SetVxlanName assigns string provided by user to EthernetConnection + SetVxlanName(value string) EthernetConnection + // HasVxlanName checks if VxlanName has been set in EthernetConnection + HasVxlanName() bool +} + +type EthernetConnectionChoiceEnum string + +// Enum of Choice on EthernetConnection +var EthernetConnectionChoice = struct { + PORT_NAME EthernetConnectionChoiceEnum + LAG_NAME EthernetConnectionChoiceEnum + VXLAN_NAME EthernetConnectionChoiceEnum +}{ + PORT_NAME: EthernetConnectionChoiceEnum("port_name"), + LAG_NAME: EthernetConnectionChoiceEnum("lag_name"), + VXLAN_NAME: EthernetConnectionChoiceEnum("vxlan_name"), +} + +func (obj *ethernetConnection) Choice() EthernetConnectionChoiceEnum { + return EthernetConnectionChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// port_name, lag_name or vxlan_name +// Choice returns a string +func (obj *ethernetConnection) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *ethernetConnection) setChoice(value EthernetConnectionChoiceEnum) EthernetConnection { + intValue, ok := otg.EthernetConnection_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on EthernetConnectionChoiceEnum", string(value))) + return obj + } + enumValue := otg.EthernetConnection_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.VxlanName = nil + obj.obj.LagName = nil + obj.obj.PortName = nil + return obj +} + +// Name of the port that the Ethernet interface is configured on. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// PortName returns a string +func (obj *ethernetConnection) PortName() string { + + if obj.obj.PortName == nil { + obj.setChoice(EthernetConnectionChoice.PORT_NAME) + } + + return *obj.obj.PortName + +} + +// Name of the port that the Ethernet interface is configured on. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// PortName returns a string +func (obj *ethernetConnection) HasPortName() bool { + return obj.obj.PortName != nil +} + +// Name of the port that the Ethernet interface is configured on. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// SetPortName sets the string value in the EthernetConnection object +func (obj *ethernetConnection) SetPortName(value string) EthernetConnection { + obj.setChoice(EthernetConnectionChoice.PORT_NAME) + obj.obj.PortName = &value + return obj +} + +// Name of the LAG that the Ethernet interface is configured on. +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// LagName returns a string +func (obj *ethernetConnection) LagName() string { + + if obj.obj.LagName == nil { + obj.setChoice(EthernetConnectionChoice.LAG_NAME) + } + + return *obj.obj.LagName + +} + +// Name of the LAG that the Ethernet interface is configured on. +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// LagName returns a string +func (obj *ethernetConnection) HasLagName() bool { + return obj.obj.LagName != nil +} + +// Name of the LAG that the Ethernet interface is configured on. +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// SetLagName sets the string value in the EthernetConnection object +func (obj *ethernetConnection) SetLagName(value string) EthernetConnection { + obj.setChoice(EthernetConnectionChoice.LAG_NAME) + obj.obj.LagName = &value + return obj +} + +// Name of the VXLAN instance (or VXLAN tunnel) that this Ethernet interface is connected to. +// +// x-constraint: +// - #/components/schemas/Vxlan.V4Tunnel/properties/name +// - #/components/schemas/Vxlan.V6Tunnel/properties/name +// +// x-constraint: +// - #/components/schemas/Vxlan.V4Tunnel/properties/name +// - #/components/schemas/Vxlan.V6Tunnel/properties/name +// +// VxlanName returns a string +func (obj *ethernetConnection) VxlanName() string { + + if obj.obj.VxlanName == nil { + obj.setChoice(EthernetConnectionChoice.VXLAN_NAME) + } + + return *obj.obj.VxlanName + +} + +// Name of the VXLAN instance (or VXLAN tunnel) that this Ethernet interface is connected to. +// +// x-constraint: +// - #/components/schemas/Vxlan.V4Tunnel/properties/name +// - #/components/schemas/Vxlan.V6Tunnel/properties/name +// +// x-constraint: +// - #/components/schemas/Vxlan.V4Tunnel/properties/name +// - #/components/schemas/Vxlan.V6Tunnel/properties/name +// +// VxlanName returns a string +func (obj *ethernetConnection) HasVxlanName() bool { + return obj.obj.VxlanName != nil +} + +// Name of the VXLAN instance (or VXLAN tunnel) that this Ethernet interface is connected to. +// +// x-constraint: +// - #/components/schemas/Vxlan.V4Tunnel/properties/name +// - #/components/schemas/Vxlan.V6Tunnel/properties/name +// +// x-constraint: +// - #/components/schemas/Vxlan.V4Tunnel/properties/name +// - #/components/schemas/Vxlan.V6Tunnel/properties/name +// +// SetVxlanName sets the string value in the EthernetConnection object +func (obj *ethernetConnection) SetVxlanName(value string) EthernetConnection { + obj.setChoice(EthernetConnectionChoice.VXLAN_NAME) + obj.obj.VxlanName = &value + return obj +} + +func (obj *ethernetConnection) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *ethernetConnection) setDefault() { + var choices_set int = 0 + var choice EthernetConnectionChoiceEnum + + if obj.obj.PortName != nil { + choices_set += 1 + choice = EthernetConnectionChoice.PORT_NAME + } + + if obj.obj.LagName != nil { + choices_set += 1 + choice = EthernetConnectionChoice.LAG_NAME + } + + if obj.obj.VxlanName != nil { + choices_set += 1 + choice = EthernetConnectionChoice.VXLAN_NAME + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in EthernetConnection") + } + } else { + intVal := otg.EthernetConnection_Choice_Enum_value[string(choice)] + enumValue := otg.EthernetConnection_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/event.go b/gosnappi/event.go new file mode 100644 index 00000000..73b8aad8 --- /dev/null +++ b/gosnappi/event.go @@ -0,0 +1,451 @@ +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" +) + +// ***** Event ***** +type event struct { + validation + obj *otg.Event + marshaller marshalEvent + unMarshaller unMarshalEvent + linkHolder EventLink + rxRateThresholdHolder EventRxRateThreshold + routeAdvertiseWithdrawHolder EventRouteAdvertiseWithdraw +} + +func NewEvent() Event { + obj := event{obj: &otg.Event{}} + obj.setDefault() + return &obj +} + +func (obj *event) msg() *otg.Event { + return obj.obj +} + +func (obj *event) setMsg(msg *otg.Event) Event { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalevent struct { + obj *event +} + +type marshalEvent interface { + // ToProto marshals Event to protobuf object *otg.Event + ToProto() (*otg.Event, error) + // ToPbText marshals Event to protobuf text + ToPbText() (string, error) + // ToYaml marshals Event to YAML text + ToYaml() (string, error) + // ToJson marshals Event to JSON text + ToJson() (string, error) +} + +type unMarshalevent struct { + obj *event +} + +type unMarshalEvent interface { + // FromProto unmarshals Event from protobuf object *otg.Event + FromProto(msg *otg.Event) (Event, error) + // FromPbText unmarshals Event from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Event from YAML text + FromYaml(value string) error + // FromJson unmarshals Event from JSON text + FromJson(value string) error +} + +func (obj *event) Marshal() marshalEvent { + if obj.marshaller == nil { + obj.marshaller = &marshalevent{obj: obj} + } + return obj.marshaller +} + +func (obj *event) Unmarshal() unMarshalEvent { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalevent{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalevent) ToProto() (*otg.Event, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalevent) FromProto(msg *otg.Event) (Event, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalevent) 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 *unMarshalevent) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalevent) 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 *unMarshalevent) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalevent) 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 *unMarshalevent) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *event) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *event) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *event) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *event) Clone() (Event, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewEvent() + 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 +} + +func (obj *event) setNil() { + obj.linkHolder = nil + obj.rxRateThresholdHolder = nil + obj.routeAdvertiseWithdrawHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// Event is the optional container for event configuration. +type Event interface { + Validation + // msg marshals Event to protobuf object *otg.Event + // and doesn't set defaults + msg() *otg.Event + // setMsg unmarshals Event from protobuf object *otg.Event + // and doesn't set defaults + setMsg(*otg.Event) Event + // provides marshal interface + Marshal() marshalEvent + // provides unmarshal interface + Unmarshal() unMarshalEvent + // validate validates Event + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Event, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Enable returns bool, set in Event. + Enable() bool + // SetEnable assigns bool provided by user to Event + SetEnable(value bool) Event + // HasEnable checks if Enable has been set in Event + HasEnable() bool + // Link returns EventLink, set in Event. + // EventLink is the optional container for link up/down event configuration. + Link() EventLink + // SetLink assigns EventLink provided by user to Event. + // EventLink is the optional container for link up/down event configuration. + SetLink(value EventLink) Event + // HasLink checks if Link has been set in Event + HasLink() bool + // RxRateThreshold returns EventRxRateThreshold, set in Event. + // EventRxRateThreshold is the optional container for rx rate threshold event configuration. + RxRateThreshold() EventRxRateThreshold + // SetRxRateThreshold assigns EventRxRateThreshold provided by user to Event. + // EventRxRateThreshold is the optional container for rx rate threshold event configuration. + SetRxRateThreshold(value EventRxRateThreshold) Event + // HasRxRateThreshold checks if RxRateThreshold has been set in Event + HasRxRateThreshold() bool + // RouteAdvertiseWithdraw returns EventRouteAdvertiseWithdraw, set in Event. + // EventRouteAdvertiseWithdraw is the optional container for route advertise/withdraw event configuration. + RouteAdvertiseWithdraw() EventRouteAdvertiseWithdraw + // SetRouteAdvertiseWithdraw assigns EventRouteAdvertiseWithdraw provided by user to Event. + // EventRouteAdvertiseWithdraw is the optional container for route advertise/withdraw event configuration. + SetRouteAdvertiseWithdraw(value EventRouteAdvertiseWithdraw) Event + // HasRouteAdvertiseWithdraw checks if RouteAdvertiseWithdraw has been set in Event + HasRouteAdvertiseWithdraw() bool + setNil() +} + +// True to enable all events. +// Enabling this option may affect the resultant packet payload due to +// additional instrumentation data. +// Enable returns a bool +func (obj *event) Enable() bool { + + return *obj.obj.Enable + +} + +// True to enable all events. +// Enabling this option may affect the resultant packet payload due to +// additional instrumentation data. +// Enable returns a bool +func (obj *event) HasEnable() bool { + return obj.obj.Enable != nil +} + +// True to enable all events. +// Enabling this option may affect the resultant packet payload due to +// additional instrumentation data. +// SetEnable sets the bool value in the Event object +func (obj *event) SetEnable(value bool) Event { + + obj.obj.Enable = &value + return obj +} + +// description is TBD +// Link returns a EventLink +func (obj *event) Link() EventLink { + if obj.obj.Link == nil { + obj.obj.Link = NewEventLink().msg() + } + if obj.linkHolder == nil { + obj.linkHolder = &eventLink{obj: obj.obj.Link} + } + return obj.linkHolder +} + +// description is TBD +// Link returns a EventLink +func (obj *event) HasLink() bool { + return obj.obj.Link != nil +} + +// description is TBD +// SetLink sets the EventLink value in the Event object +func (obj *event) SetLink(value EventLink) Event { + + obj.linkHolder = nil + obj.obj.Link = value.msg() + + return obj +} + +// description is TBD +// RxRateThreshold returns a EventRxRateThreshold +func (obj *event) RxRateThreshold() EventRxRateThreshold { + if obj.obj.RxRateThreshold == nil { + obj.obj.RxRateThreshold = NewEventRxRateThreshold().msg() + } + if obj.rxRateThresholdHolder == nil { + obj.rxRateThresholdHolder = &eventRxRateThreshold{obj: obj.obj.RxRateThreshold} + } + return obj.rxRateThresholdHolder +} + +// description is TBD +// RxRateThreshold returns a EventRxRateThreshold +func (obj *event) HasRxRateThreshold() bool { + return obj.obj.RxRateThreshold != nil +} + +// description is TBD +// SetRxRateThreshold sets the EventRxRateThreshold value in the Event object +func (obj *event) SetRxRateThreshold(value EventRxRateThreshold) Event { + + obj.rxRateThresholdHolder = nil + obj.obj.RxRateThreshold = value.msg() + + return obj +} + +// description is TBD +// RouteAdvertiseWithdraw returns a EventRouteAdvertiseWithdraw +func (obj *event) RouteAdvertiseWithdraw() EventRouteAdvertiseWithdraw { + if obj.obj.RouteAdvertiseWithdraw == nil { + obj.obj.RouteAdvertiseWithdraw = NewEventRouteAdvertiseWithdraw().msg() + } + if obj.routeAdvertiseWithdrawHolder == nil { + obj.routeAdvertiseWithdrawHolder = &eventRouteAdvertiseWithdraw{obj: obj.obj.RouteAdvertiseWithdraw} + } + return obj.routeAdvertiseWithdrawHolder +} + +// description is TBD +// RouteAdvertiseWithdraw returns a EventRouteAdvertiseWithdraw +func (obj *event) HasRouteAdvertiseWithdraw() bool { + return obj.obj.RouteAdvertiseWithdraw != nil +} + +// description is TBD +// SetRouteAdvertiseWithdraw sets the EventRouteAdvertiseWithdraw value in the Event object +func (obj *event) SetRouteAdvertiseWithdraw(value EventRouteAdvertiseWithdraw) Event { + + obj.routeAdvertiseWithdrawHolder = nil + obj.obj.RouteAdvertiseWithdraw = value.msg() + + return obj +} + +func (obj *event) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Link != nil { + + obj.Link().validateObj(vObj, set_default) + } + + if obj.obj.RxRateThreshold != nil { + + obj.RxRateThreshold().validateObj(vObj, set_default) + } + + if obj.obj.RouteAdvertiseWithdraw != nil { + + obj.RouteAdvertiseWithdraw().validateObj(vObj, set_default) + } + +} + +func (obj *event) setDefault() { + if obj.obj.Enable == nil { + obj.SetEnable(false) + } + +} diff --git a/gosnappi/event_link.go b/gosnappi/event_link.go new file mode 100644 index 00000000..70b1afc3 --- /dev/null +++ b/gosnappi/event_link.go @@ -0,0 +1,309 @@ +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" +) + +// ***** EventLink ***** +type eventLink struct { + validation + obj *otg.EventLink + marshaller marshalEventLink + unMarshaller unMarshalEventLink +} + +func NewEventLink() EventLink { + obj := eventLink{obj: &otg.EventLink{}} + obj.setDefault() + return &obj +} + +func (obj *eventLink) msg() *otg.EventLink { + return obj.obj +} + +func (obj *eventLink) setMsg(msg *otg.EventLink) EventLink { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaleventLink struct { + obj *eventLink +} + +type marshalEventLink interface { + // ToProto marshals EventLink to protobuf object *otg.EventLink + ToProto() (*otg.EventLink, error) + // ToPbText marshals EventLink to protobuf text + ToPbText() (string, error) + // ToYaml marshals EventLink to YAML text + ToYaml() (string, error) + // ToJson marshals EventLink to JSON text + ToJson() (string, error) +} + +type unMarshaleventLink struct { + obj *eventLink +} + +type unMarshalEventLink interface { + // FromProto unmarshals EventLink from protobuf object *otg.EventLink + FromProto(msg *otg.EventLink) (EventLink, error) + // FromPbText unmarshals EventLink from protobuf text + FromPbText(value string) error + // FromYaml unmarshals EventLink from YAML text + FromYaml(value string) error + // FromJson unmarshals EventLink from JSON text + FromJson(value string) error +} + +func (obj *eventLink) Marshal() marshalEventLink { + if obj.marshaller == nil { + obj.marshaller = &marshaleventLink{obj: obj} + } + return obj.marshaller +} + +func (obj *eventLink) Unmarshal() unMarshalEventLink { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaleventLink{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaleventLink) ToProto() (*otg.EventLink, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaleventLink) FromProto(msg *otg.EventLink) (EventLink, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaleventLink) 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 *unMarshaleventLink) 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 *marshaleventLink) 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 *unMarshaleventLink) 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 *marshaleventLink) 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 *unMarshaleventLink) 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 *eventLink) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *eventLink) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *eventLink) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *eventLink) Clone() (EventLink, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewEventLink() + 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 +} + +// EventLink is the optional container for link up/down event configuration. +type EventLink interface { + Validation + // msg marshals EventLink to protobuf object *otg.EventLink + // and doesn't set defaults + msg() *otg.EventLink + // setMsg unmarshals EventLink from protobuf object *otg.EventLink + // and doesn't set defaults + setMsg(*otg.EventLink) EventLink + // provides marshal interface + Marshal() marshalEventLink + // provides unmarshal interface + Unmarshal() unMarshalEventLink + // validate validates EventLink + validate() error + // A stringer function + String() string + // Clones the object + Clone() (EventLink, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Enable returns bool, set in EventLink. + Enable() bool + // SetEnable assigns bool provided by user to EventLink + SetEnable(value bool) EventLink + // HasEnable checks if Enable has been set in EventLink + HasEnable() bool +} + +// True to enable notifications when a link up/down event occurs. +// Enable returns a bool +func (obj *eventLink) Enable() bool { + + return *obj.obj.Enable + +} + +// True to enable notifications when a link up/down event occurs. +// Enable returns a bool +func (obj *eventLink) HasEnable() bool { + return obj.obj.Enable != nil +} + +// True to enable notifications when a link up/down event occurs. +// SetEnable sets the bool value in the EventLink object +func (obj *eventLink) SetEnable(value bool) EventLink { + + obj.obj.Enable = &value + return obj +} + +func (obj *eventLink) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *eventLink) setDefault() { + if obj.obj.Enable == nil { + obj.SetEnable(false) + } + +} diff --git a/gosnappi/event_route_advertise_withdraw.go b/gosnappi/event_route_advertise_withdraw.go new file mode 100644 index 00000000..f67ff9a0 --- /dev/null +++ b/gosnappi/event_route_advertise_withdraw.go @@ -0,0 +1,312 @@ +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" +) + +// ***** EventRouteAdvertiseWithdraw ***** +type eventRouteAdvertiseWithdraw struct { + validation + obj *otg.EventRouteAdvertiseWithdraw + marshaller marshalEventRouteAdvertiseWithdraw + unMarshaller unMarshalEventRouteAdvertiseWithdraw +} + +func NewEventRouteAdvertiseWithdraw() EventRouteAdvertiseWithdraw { + obj := eventRouteAdvertiseWithdraw{obj: &otg.EventRouteAdvertiseWithdraw{}} + obj.setDefault() + return &obj +} + +func (obj *eventRouteAdvertiseWithdraw) msg() *otg.EventRouteAdvertiseWithdraw { + return obj.obj +} + +func (obj *eventRouteAdvertiseWithdraw) setMsg(msg *otg.EventRouteAdvertiseWithdraw) EventRouteAdvertiseWithdraw { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaleventRouteAdvertiseWithdraw struct { + obj *eventRouteAdvertiseWithdraw +} + +type marshalEventRouteAdvertiseWithdraw interface { + // ToProto marshals EventRouteAdvertiseWithdraw to protobuf object *otg.EventRouteAdvertiseWithdraw + ToProto() (*otg.EventRouteAdvertiseWithdraw, error) + // ToPbText marshals EventRouteAdvertiseWithdraw to protobuf text + ToPbText() (string, error) + // ToYaml marshals EventRouteAdvertiseWithdraw to YAML text + ToYaml() (string, error) + // ToJson marshals EventRouteAdvertiseWithdraw to JSON text + ToJson() (string, error) +} + +type unMarshaleventRouteAdvertiseWithdraw struct { + obj *eventRouteAdvertiseWithdraw +} + +type unMarshalEventRouteAdvertiseWithdraw interface { + // FromProto unmarshals EventRouteAdvertiseWithdraw from protobuf object *otg.EventRouteAdvertiseWithdraw + FromProto(msg *otg.EventRouteAdvertiseWithdraw) (EventRouteAdvertiseWithdraw, error) + // FromPbText unmarshals EventRouteAdvertiseWithdraw from protobuf text + FromPbText(value string) error + // FromYaml unmarshals EventRouteAdvertiseWithdraw from YAML text + FromYaml(value string) error + // FromJson unmarshals EventRouteAdvertiseWithdraw from JSON text + FromJson(value string) error +} + +func (obj *eventRouteAdvertiseWithdraw) Marshal() marshalEventRouteAdvertiseWithdraw { + if obj.marshaller == nil { + obj.marshaller = &marshaleventRouteAdvertiseWithdraw{obj: obj} + } + return obj.marshaller +} + +func (obj *eventRouteAdvertiseWithdraw) Unmarshal() unMarshalEventRouteAdvertiseWithdraw { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaleventRouteAdvertiseWithdraw{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaleventRouteAdvertiseWithdraw) ToProto() (*otg.EventRouteAdvertiseWithdraw, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaleventRouteAdvertiseWithdraw) FromProto(msg *otg.EventRouteAdvertiseWithdraw) (EventRouteAdvertiseWithdraw, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaleventRouteAdvertiseWithdraw) 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 *unMarshaleventRouteAdvertiseWithdraw) 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 *marshaleventRouteAdvertiseWithdraw) 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 *unMarshaleventRouteAdvertiseWithdraw) 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 *marshaleventRouteAdvertiseWithdraw) 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 *unMarshaleventRouteAdvertiseWithdraw) 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 *eventRouteAdvertiseWithdraw) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *eventRouteAdvertiseWithdraw) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *eventRouteAdvertiseWithdraw) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *eventRouteAdvertiseWithdraw) Clone() (EventRouteAdvertiseWithdraw, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewEventRouteAdvertiseWithdraw() + 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 +} + +// EventRouteAdvertiseWithdraw is the optional container for route advertise/withdraw event configuration. +type EventRouteAdvertiseWithdraw interface { + Validation + // msg marshals EventRouteAdvertiseWithdraw to protobuf object *otg.EventRouteAdvertiseWithdraw + // and doesn't set defaults + msg() *otg.EventRouteAdvertiseWithdraw + // setMsg unmarshals EventRouteAdvertiseWithdraw from protobuf object *otg.EventRouteAdvertiseWithdraw + // and doesn't set defaults + setMsg(*otg.EventRouteAdvertiseWithdraw) EventRouteAdvertiseWithdraw + // provides marshal interface + Marshal() marshalEventRouteAdvertiseWithdraw + // provides unmarshal interface + Unmarshal() unMarshalEventRouteAdvertiseWithdraw + // validate validates EventRouteAdvertiseWithdraw + validate() error + // A stringer function + String() string + // Clones the object + Clone() (EventRouteAdvertiseWithdraw, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Enable returns bool, set in EventRouteAdvertiseWithdraw. + Enable() bool + // SetEnable assigns bool provided by user to EventRouteAdvertiseWithdraw + SetEnable(value bool) EventRouteAdvertiseWithdraw + // HasEnable checks if Enable has been set in EventRouteAdvertiseWithdraw + HasEnable() bool +} + +// True to enable notifications when a route advertise/withdraw +// event occurs. +// Enable returns a bool +func (obj *eventRouteAdvertiseWithdraw) Enable() bool { + + return *obj.obj.Enable + +} + +// True to enable notifications when a route advertise/withdraw +// event occurs. +// Enable returns a bool +func (obj *eventRouteAdvertiseWithdraw) HasEnable() bool { + return obj.obj.Enable != nil +} + +// True to enable notifications when a route advertise/withdraw +// event occurs. +// SetEnable sets the bool value in the EventRouteAdvertiseWithdraw object +func (obj *eventRouteAdvertiseWithdraw) SetEnable(value bool) EventRouteAdvertiseWithdraw { + + obj.obj.Enable = &value + return obj +} + +func (obj *eventRouteAdvertiseWithdraw) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *eventRouteAdvertiseWithdraw) setDefault() { + if obj.obj.Enable == nil { + obj.SetEnable(false) + } + +} diff --git a/gosnappi/event_rx_rate_threshold.go b/gosnappi/event_rx_rate_threshold.go new file mode 100644 index 00000000..066adcb2 --- /dev/null +++ b/gosnappi/event_rx_rate_threshold.go @@ -0,0 +1,359 @@ +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" +) + +// ***** EventRxRateThreshold ***** +type eventRxRateThreshold struct { + validation + obj *otg.EventRxRateThreshold + marshaller marshalEventRxRateThreshold + unMarshaller unMarshalEventRxRateThreshold +} + +func NewEventRxRateThreshold() EventRxRateThreshold { + obj := eventRxRateThreshold{obj: &otg.EventRxRateThreshold{}} + obj.setDefault() + return &obj +} + +func (obj *eventRxRateThreshold) msg() *otg.EventRxRateThreshold { + return obj.obj +} + +func (obj *eventRxRateThreshold) setMsg(msg *otg.EventRxRateThreshold) EventRxRateThreshold { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshaleventRxRateThreshold struct { + obj *eventRxRateThreshold +} + +type marshalEventRxRateThreshold interface { + // ToProto marshals EventRxRateThreshold to protobuf object *otg.EventRxRateThreshold + ToProto() (*otg.EventRxRateThreshold, error) + // ToPbText marshals EventRxRateThreshold to protobuf text + ToPbText() (string, error) + // ToYaml marshals EventRxRateThreshold to YAML text + ToYaml() (string, error) + // ToJson marshals EventRxRateThreshold to JSON text + ToJson() (string, error) +} + +type unMarshaleventRxRateThreshold struct { + obj *eventRxRateThreshold +} + +type unMarshalEventRxRateThreshold interface { + // FromProto unmarshals EventRxRateThreshold from protobuf object *otg.EventRxRateThreshold + FromProto(msg *otg.EventRxRateThreshold) (EventRxRateThreshold, error) + // FromPbText unmarshals EventRxRateThreshold from protobuf text + FromPbText(value string) error + // FromYaml unmarshals EventRxRateThreshold from YAML text + FromYaml(value string) error + // FromJson unmarshals EventRxRateThreshold from JSON text + FromJson(value string) error +} + +func (obj *eventRxRateThreshold) Marshal() marshalEventRxRateThreshold { + if obj.marshaller == nil { + obj.marshaller = &marshaleventRxRateThreshold{obj: obj} + } + return obj.marshaller +} + +func (obj *eventRxRateThreshold) Unmarshal() unMarshalEventRxRateThreshold { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshaleventRxRateThreshold{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshaleventRxRateThreshold) ToProto() (*otg.EventRxRateThreshold, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshaleventRxRateThreshold) FromProto(msg *otg.EventRxRateThreshold) (EventRxRateThreshold, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshaleventRxRateThreshold) 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 *unMarshaleventRxRateThreshold) 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 *marshaleventRxRateThreshold) 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 *unMarshaleventRxRateThreshold) 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 *marshaleventRxRateThreshold) 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 *unMarshaleventRxRateThreshold) 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 *eventRxRateThreshold) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *eventRxRateThreshold) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *eventRxRateThreshold) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *eventRxRateThreshold) Clone() (EventRxRateThreshold, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewEventRxRateThreshold() + 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 +} + +// EventRxRateThreshold is the optional container for rx rate threshold event configuration. +type EventRxRateThreshold interface { + Validation + // msg marshals EventRxRateThreshold to protobuf object *otg.EventRxRateThreshold + // and doesn't set defaults + msg() *otg.EventRxRateThreshold + // setMsg unmarshals EventRxRateThreshold from protobuf object *otg.EventRxRateThreshold + // and doesn't set defaults + setMsg(*otg.EventRxRateThreshold) EventRxRateThreshold + // provides marshal interface + Marshal() marshalEventRxRateThreshold + // provides unmarshal interface + Unmarshal() unMarshalEventRxRateThreshold + // validate validates EventRxRateThreshold + validate() error + // A stringer function + String() string + // Clones the object + Clone() (EventRxRateThreshold, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Enable returns bool, set in EventRxRateThreshold. + Enable() bool + // SetEnable assigns bool provided by user to EventRxRateThreshold + SetEnable(value bool) EventRxRateThreshold + // HasEnable checks if Enable has been set in EventRxRateThreshold + HasEnable() bool + // Threshold returns float32, set in EventRxRateThreshold. + Threshold() float32 + // SetThreshold assigns float32 provided by user to EventRxRateThreshold + SetThreshold(value float32) EventRxRateThreshold + // HasThreshold checks if Threshold has been set in EventRxRateThreshold + HasThreshold() bool +} + +// True to enable the rx_rate_threshold event. +// Enabling this option may affect the resultant packet payload due to +// additional instrumentation data. +// Enable returns a bool +func (obj *eventRxRateThreshold) Enable() bool { + + return *obj.obj.Enable + +} + +// True to enable the rx_rate_threshold event. +// Enabling this option may affect the resultant packet payload due to +// additional instrumentation data. +// Enable returns a bool +func (obj *eventRxRateThreshold) HasEnable() bool { + return obj.obj.Enable != nil +} + +// True to enable the rx_rate_threshold event. +// Enabling this option may affect the resultant packet payload due to +// additional instrumentation data. +// SetEnable sets the bool value in the EventRxRateThreshold object +func (obj *eventRxRateThreshold) SetEnable(value bool) EventRxRateThreshold { + + obj.obj.Enable = &value + return obj +} + +// True to enable notifications when the rx rate of a flow passes above +// or below the threshold value. +// Threshold returns a float32 +func (obj *eventRxRateThreshold) Threshold() float32 { + + return *obj.obj.Threshold + +} + +// True to enable notifications when the rx rate of a flow passes above +// or below the threshold value. +// Threshold returns a float32 +func (obj *eventRxRateThreshold) HasThreshold() bool { + return obj.obj.Threshold != nil +} + +// True to enable notifications when the rx rate of a flow passes above +// or below the threshold value. +// SetThreshold sets the float32 value in the EventRxRateThreshold object +func (obj *eventRxRateThreshold) SetThreshold(value float32) EventRxRateThreshold { + + obj.obj.Threshold = &value + return obj +} + +func (obj *eventRxRateThreshold) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Threshold != nil { + + if *obj.obj.Threshold < 0 || *obj.obj.Threshold > 100 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= EventRxRateThreshold.Threshold <= 100 but Got %f", *obj.obj.Threshold)) + } + + } + +} + +func (obj *eventRxRateThreshold) setDefault() { + if obj.obj.Enable == nil { + obj.SetEnable(false) + } + if obj.obj.Threshold == nil { + obj.SetThreshold(95) + } + +} diff --git a/gosnappi/flow.go b/gosnappi/flow.go new file mode 100644 index 00000000..6934c481 --- /dev/null +++ b/gosnappi/flow.go @@ -0,0 +1,679 @@ +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" +) + +// ***** Flow ***** +type flow struct { + validation + obj *otg.Flow + marshaller marshalFlow + unMarshaller unMarshalFlow + txRxHolder FlowTxRx + packetHolder FlowFlowHeaderIter + egressPacketHolder FlowFlowHeaderIter + sizeHolder FlowSize + rateHolder FlowRate + durationHolder FlowDuration + metricsHolder FlowMetrics +} + +func NewFlow() Flow { + obj := flow{obj: &otg.Flow{}} + obj.setDefault() + return &obj +} + +func (obj *flow) msg() *otg.Flow { + return obj.obj +} + +func (obj *flow) setMsg(msg *otg.Flow) Flow { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflow struct { + obj *flow +} + +type marshalFlow interface { + // ToProto marshals Flow to protobuf object *otg.Flow + ToProto() (*otg.Flow, error) + // ToPbText marshals Flow to protobuf text + ToPbText() (string, error) + // ToYaml marshals Flow to YAML text + ToYaml() (string, error) + // ToJson marshals Flow to JSON text + ToJson() (string, error) +} + +type unMarshalflow struct { + obj *flow +} + +type unMarshalFlow interface { + // FromProto unmarshals Flow from protobuf object *otg.Flow + FromProto(msg *otg.Flow) (Flow, error) + // FromPbText unmarshals Flow from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Flow from YAML text + FromYaml(value string) error + // FromJson unmarshals Flow from JSON text + FromJson(value string) error +} + +func (obj *flow) Marshal() marshalFlow { + if obj.marshaller == nil { + obj.marshaller = &marshalflow{obj: obj} + } + return obj.marshaller +} + +func (obj *flow) Unmarshal() unMarshalFlow { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflow{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflow) ToProto() (*otg.Flow, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflow) FromProto(msg *otg.Flow) (Flow, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflow) 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 *unMarshalflow) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflow) 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 *unMarshalflow) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflow) 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 *unMarshalflow) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flow) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flow) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flow) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flow) Clone() (Flow, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlow() + 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 +} + +func (obj *flow) setNil() { + obj.txRxHolder = nil + obj.packetHolder = nil + obj.egressPacketHolder = nil + obj.sizeHolder = nil + obj.rateHolder = nil + obj.durationHolder = nil + obj.metricsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// Flow is a high level data plane traffic flow. +type Flow interface { + Validation + // msg marshals Flow to protobuf object *otg.Flow + // and doesn't set defaults + msg() *otg.Flow + // setMsg unmarshals Flow from protobuf object *otg.Flow + // and doesn't set defaults + setMsg(*otg.Flow) Flow + // provides marshal interface + Marshal() marshalFlow + // provides unmarshal interface + Unmarshal() unMarshalFlow + // validate validates Flow + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Flow, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // TxRx returns FlowTxRx, set in Flow. + // FlowTxRx is a container for different types of transmit and receive + // endpoint containers. + TxRx() FlowTxRx + // SetTxRx assigns FlowTxRx provided by user to Flow. + // FlowTxRx is a container for different types of transmit and receive + // endpoint containers. + SetTxRx(value FlowTxRx) Flow + // Packet returns FlowFlowHeaderIterIter, set in Flow + Packet() FlowFlowHeaderIter + // EgressPacket returns FlowFlowHeaderIterIter, set in Flow + EgressPacket() FlowFlowHeaderIter + // Size returns FlowSize, set in Flow. + // FlowSize is the frame size which overrides the total length of the packet + Size() FlowSize + // SetSize assigns FlowSize provided by user to Flow. + // FlowSize is the frame size which overrides the total length of the packet + SetSize(value FlowSize) Flow + // HasSize checks if Size has been set in Flow + HasSize() bool + // Rate returns FlowRate, set in Flow. + // FlowRate is the rate of packet transmission + Rate() FlowRate + // SetRate assigns FlowRate provided by user to Flow. + // FlowRate is the rate of packet transmission + SetRate(value FlowRate) Flow + // HasRate checks if Rate has been set in Flow + HasRate() bool + // Duration returns FlowDuration, set in Flow. + // FlowDuration is a container for different transmit durations. + Duration() FlowDuration + // SetDuration assigns FlowDuration provided by user to Flow. + // FlowDuration is a container for different transmit durations. + SetDuration(value FlowDuration) Flow + // HasDuration checks if Duration has been set in Flow + HasDuration() bool + // Metrics returns FlowMetrics, set in Flow. + // FlowMetrics is the optional container for configuring flow metrics. + Metrics() FlowMetrics + // SetMetrics assigns FlowMetrics provided by user to Flow. + // FlowMetrics is the optional container for configuring flow metrics. + SetMetrics(value FlowMetrics) Flow + // HasMetrics checks if Metrics has been set in Flow + HasMetrics() bool + // Name returns string, set in Flow. + Name() string + // SetName assigns string provided by user to Flow + SetName(value string) Flow + setNil() +} + +// The transmit and receive endpoints. +// TxRx returns a FlowTxRx +func (obj *flow) TxRx() FlowTxRx { + if obj.obj.TxRx == nil { + obj.obj.TxRx = NewFlowTxRx().msg() + } + if obj.txRxHolder == nil { + obj.txRxHolder = &flowTxRx{obj: obj.obj.TxRx} + } + return obj.txRxHolder +} + +// The transmit and receive endpoints. +// SetTxRx sets the FlowTxRx value in the Flow object +func (obj *flow) SetTxRx(value FlowTxRx) Flow { + + obj.txRxHolder = nil + obj.obj.TxRx = value.msg() + + return obj +} + +// The list of protocol headers defining the shape of all +// intended packets in corresponding flow as it is transmitted +// by traffic-generator port. +// +// The order of protocol headers assigned to the list is the +// order they will appear on the wire. +// +// In the case of an empty list the keyword/value of minItems: 1 +// indicates that an implementation MUST provide at least one +// Flow.Header object. +// +// The default value for the Flow.Header choice property is ethernet +// which will result in an implementation by default providing at least +// one ethernet packet header. +// Packet returns a []FlowHeader +func (obj *flow) Packet() FlowFlowHeaderIter { + if len(obj.obj.Packet) == 0 { + obj.obj.Packet = []*otg.FlowHeader{} + } + if obj.packetHolder == nil { + obj.packetHolder = newFlowFlowHeaderIter(&obj.obj.Packet).setMsg(obj) + } + return obj.packetHolder +} + +type flowFlowHeaderIter struct { + obj *flow + flowHeaderSlice []FlowHeader + fieldPtr *[]*otg.FlowHeader +} + +func newFlowFlowHeaderIter(ptr *[]*otg.FlowHeader) FlowFlowHeaderIter { + return &flowFlowHeaderIter{fieldPtr: ptr} +} + +type FlowFlowHeaderIter interface { + setMsg(*flow) FlowFlowHeaderIter + Items() []FlowHeader + Add() FlowHeader + Append(items ...FlowHeader) FlowFlowHeaderIter + Set(index int, newObj FlowHeader) FlowFlowHeaderIter + Clear() FlowFlowHeaderIter + clearHolderSlice() FlowFlowHeaderIter + appendHolderSlice(item FlowHeader) FlowFlowHeaderIter +} + +func (obj *flowFlowHeaderIter) setMsg(msg *flow) FlowFlowHeaderIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flowHeader{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *flowFlowHeaderIter) Items() []FlowHeader { + return obj.flowHeaderSlice +} + +func (obj *flowFlowHeaderIter) Add() FlowHeader { + newObj := &otg.FlowHeader{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flowHeader{obj: newObj} + newLibObj.setDefault() + obj.flowHeaderSlice = append(obj.flowHeaderSlice, newLibObj) + return newLibObj +} + +func (obj *flowFlowHeaderIter) Append(items ...FlowHeader) FlowFlowHeaderIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowHeaderSlice = append(obj.flowHeaderSlice, item) + } + return obj +} + +func (obj *flowFlowHeaderIter) Set(index int, newObj FlowHeader) FlowFlowHeaderIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowHeaderSlice[index] = newObj + return obj +} +func (obj *flowFlowHeaderIter) Clear() FlowFlowHeaderIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.FlowHeader{} + obj.flowHeaderSlice = []FlowHeader{} + } + return obj +} +func (obj *flowFlowHeaderIter) clearHolderSlice() FlowFlowHeaderIter { + if len(obj.flowHeaderSlice) > 0 { + obj.flowHeaderSlice = []FlowHeader{} + } + return obj +} +func (obj *flowFlowHeaderIter) appendHolderSlice(item FlowHeader) FlowFlowHeaderIter { + obj.flowHeaderSlice = append(obj.flowHeaderSlice, item) + return obj +} + +// Under Review: The packet header schema for egress tracking currently exposes unwanted fields. The query structure for tagged metrics inside flows metrics requires documenting expected response format. +// +// Under Review: The packet header schema for egress tracking currently exposes unwanted fields. The query structure for tagged metrics inside flows metrics requires documenting expected response format. +// +// The list of protocol headers defining the shape of all +// intended packets in corresponding flow as it is received +// by traffic-generator port. +// +// For all protocol headers, only the `metric_tags` property is configurable. +// EgressPacket returns a []FlowHeader +func (obj *flow) EgressPacket() FlowFlowHeaderIter { + if len(obj.obj.EgressPacket) == 0 { + obj.obj.EgressPacket = []*otg.FlowHeader{} + } + if obj.egressPacketHolder == nil { + obj.egressPacketHolder = newFlowFlowHeaderIter(&obj.obj.EgressPacket).setMsg(obj) + } + return obj.egressPacketHolder +} + +// The size of the packets. +// Size returns a FlowSize +func (obj *flow) Size() FlowSize { + if obj.obj.Size == nil { + obj.obj.Size = NewFlowSize().msg() + } + if obj.sizeHolder == nil { + obj.sizeHolder = &flowSize{obj: obj.obj.Size} + } + return obj.sizeHolder +} + +// The size of the packets. +// Size returns a FlowSize +func (obj *flow) HasSize() bool { + return obj.obj.Size != nil +} + +// The size of the packets. +// SetSize sets the FlowSize value in the Flow object +func (obj *flow) SetSize(value FlowSize) Flow { + + obj.sizeHolder = nil + obj.obj.Size = value.msg() + + return obj +} + +// The transmit rate of the packets. +// Rate returns a FlowRate +func (obj *flow) Rate() FlowRate { + if obj.obj.Rate == nil { + obj.obj.Rate = NewFlowRate().msg() + } + if obj.rateHolder == nil { + obj.rateHolder = &flowRate{obj: obj.obj.Rate} + } + return obj.rateHolder +} + +// The transmit rate of the packets. +// Rate returns a FlowRate +func (obj *flow) HasRate() bool { + return obj.obj.Rate != nil +} + +// The transmit rate of the packets. +// SetRate sets the FlowRate value in the Flow object +func (obj *flow) SetRate(value FlowRate) Flow { + + obj.rateHolder = nil + obj.obj.Rate = value.msg() + + return obj +} + +// The transmit duration of the packets. +// Duration returns a FlowDuration +func (obj *flow) Duration() FlowDuration { + if obj.obj.Duration == nil { + obj.obj.Duration = NewFlowDuration().msg() + } + if obj.durationHolder == nil { + obj.durationHolder = &flowDuration{obj: obj.obj.Duration} + } + return obj.durationHolder +} + +// The transmit duration of the packets. +// Duration returns a FlowDuration +func (obj *flow) HasDuration() bool { + return obj.obj.Duration != nil +} + +// The transmit duration of the packets. +// SetDuration sets the FlowDuration value in the Flow object +func (obj *flow) SetDuration(value FlowDuration) Flow { + + obj.durationHolder = nil + obj.obj.Duration = value.msg() + + return obj +} + +// Flow metrics. +// Metrics returns a FlowMetrics +func (obj *flow) Metrics() FlowMetrics { + if obj.obj.Metrics == nil { + obj.obj.Metrics = NewFlowMetrics().msg() + } + if obj.metricsHolder == nil { + obj.metricsHolder = &flowMetrics{obj: obj.obj.Metrics} + } + return obj.metricsHolder +} + +// Flow metrics. +// Metrics returns a FlowMetrics +func (obj *flow) HasMetrics() bool { + return obj.obj.Metrics != nil +} + +// Flow metrics. +// SetMetrics sets the FlowMetrics value in the Flow object +func (obj *flow) SetMetrics(value FlowMetrics) Flow { + + obj.metricsHolder = nil + obj.obj.Metrics = value.msg() + + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *flow) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the Flow object +func (obj *flow) SetName(value string) Flow { + + obj.obj.Name = &value + return obj +} + +func (obj *flow) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // TxRx is required + if obj.obj.TxRx == nil { + vObj.validationErrors = append(vObj.validationErrors, "TxRx is required field on interface Flow") + } + + if obj.obj.TxRx != nil { + + obj.TxRx().validateObj(vObj, set_default) + } + + if len(obj.obj.Packet) != 0 { + + if set_default { + obj.Packet().clearHolderSlice() + for _, item := range obj.obj.Packet { + obj.Packet().appendHolderSlice(&flowHeader{obj: item}) + } + } + for _, item := range obj.Packet().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.EgressPacket) != 0 { + + if set_default { + obj.EgressPacket().clearHolderSlice() + for _, item := range obj.obj.EgressPacket { + obj.EgressPacket().appendHolderSlice(&flowHeader{obj: item}) + } + } + for _, item := range obj.EgressPacket().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Size != nil { + + obj.Size().validateObj(vObj, set_default) + } + + if obj.obj.Rate != nil { + + obj.Rate().validateObj(vObj, set_default) + } + + if obj.obj.Duration != nil { + + obj.Duration().validateObj(vObj, set_default) + } + + if obj.obj.Metrics != nil { + + obj.Metrics().validateObj(vObj, set_default) + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface Flow") + } +} + +func (obj *flow) setDefault() { + +} diff --git a/gosnappi/flow_arp.go b/gosnappi/flow_arp.go new file mode 100644 index 00000000..ab67599a --- /dev/null +++ b/gosnappi/flow_arp.go @@ -0,0 +1,672 @@ +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" +) + +// ***** FlowArp ***** +type flowArp struct { + validation + obj *otg.FlowArp + marshaller marshalFlowArp + unMarshaller unMarshalFlowArp + hardwareTypeHolder PatternFlowArpHardwareType + protocolTypeHolder PatternFlowArpProtocolType + hardwareLengthHolder PatternFlowArpHardwareLength + protocolLengthHolder PatternFlowArpProtocolLength + operationHolder PatternFlowArpOperation + senderHardwareAddrHolder PatternFlowArpSenderHardwareAddr + senderProtocolAddrHolder PatternFlowArpSenderProtocolAddr + targetHardwareAddrHolder PatternFlowArpTargetHardwareAddr + targetProtocolAddrHolder PatternFlowArpTargetProtocolAddr +} + +func NewFlowArp() FlowArp { + obj := flowArp{obj: &otg.FlowArp{}} + obj.setDefault() + return &obj +} + +func (obj *flowArp) msg() *otg.FlowArp { + return obj.obj +} + +func (obj *flowArp) setMsg(msg *otg.FlowArp) FlowArp { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowArp struct { + obj *flowArp +} + +type marshalFlowArp interface { + // ToProto marshals FlowArp to protobuf object *otg.FlowArp + ToProto() (*otg.FlowArp, error) + // ToPbText marshals FlowArp to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowArp to YAML text + ToYaml() (string, error) + // ToJson marshals FlowArp to JSON text + ToJson() (string, error) +} + +type unMarshalflowArp struct { + obj *flowArp +} + +type unMarshalFlowArp interface { + // FromProto unmarshals FlowArp from protobuf object *otg.FlowArp + FromProto(msg *otg.FlowArp) (FlowArp, error) + // FromPbText unmarshals FlowArp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowArp from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowArp from JSON text + FromJson(value string) error +} + +func (obj *flowArp) Marshal() marshalFlowArp { + if obj.marshaller == nil { + obj.marshaller = &marshalflowArp{obj: obj} + } + return obj.marshaller +} + +func (obj *flowArp) Unmarshal() unMarshalFlowArp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowArp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowArp) ToProto() (*otg.FlowArp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowArp) FromProto(msg *otg.FlowArp) (FlowArp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowArp) 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 *unMarshalflowArp) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowArp) 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 *unMarshalflowArp) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowArp) 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 *unMarshalflowArp) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowArp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowArp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowArp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowArp) Clone() (FlowArp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowArp() + 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 +} + +func (obj *flowArp) setNil() { + obj.hardwareTypeHolder = nil + obj.protocolTypeHolder = nil + obj.hardwareLengthHolder = nil + obj.protocolLengthHolder = nil + obj.operationHolder = nil + obj.senderHardwareAddrHolder = nil + obj.senderProtocolAddrHolder = nil + obj.targetHardwareAddrHolder = nil + obj.targetProtocolAddrHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowArp is aRP packet header +type FlowArp interface { + Validation + // msg marshals FlowArp to protobuf object *otg.FlowArp + // and doesn't set defaults + msg() *otg.FlowArp + // setMsg unmarshals FlowArp from protobuf object *otg.FlowArp + // and doesn't set defaults + setMsg(*otg.FlowArp) FlowArp + // provides marshal interface + Marshal() marshalFlowArp + // provides unmarshal interface + Unmarshal() unMarshalFlowArp + // validate validates FlowArp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowArp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // HardwareType returns PatternFlowArpHardwareType, set in FlowArp. + // PatternFlowArpHardwareType is network link protocol type + HardwareType() PatternFlowArpHardwareType + // SetHardwareType assigns PatternFlowArpHardwareType provided by user to FlowArp. + // PatternFlowArpHardwareType is network link protocol type + SetHardwareType(value PatternFlowArpHardwareType) FlowArp + // HasHardwareType checks if HardwareType has been set in FlowArp + HasHardwareType() bool + // ProtocolType returns PatternFlowArpProtocolType, set in FlowArp. + // PatternFlowArpProtocolType is the internetwork protocol for which the ARP request is intended + ProtocolType() PatternFlowArpProtocolType + // SetProtocolType assigns PatternFlowArpProtocolType provided by user to FlowArp. + // PatternFlowArpProtocolType is the internetwork protocol for which the ARP request is intended + SetProtocolType(value PatternFlowArpProtocolType) FlowArp + // HasProtocolType checks if ProtocolType has been set in FlowArp + HasProtocolType() bool + // HardwareLength returns PatternFlowArpHardwareLength, set in FlowArp. + // PatternFlowArpHardwareLength is length (in octets) of a hardware address + HardwareLength() PatternFlowArpHardwareLength + // SetHardwareLength assigns PatternFlowArpHardwareLength provided by user to FlowArp. + // PatternFlowArpHardwareLength is length (in octets) of a hardware address + SetHardwareLength(value PatternFlowArpHardwareLength) FlowArp + // HasHardwareLength checks if HardwareLength has been set in FlowArp + HasHardwareLength() bool + // ProtocolLength returns PatternFlowArpProtocolLength, set in FlowArp. + // PatternFlowArpProtocolLength is length (in octets) of internetwork addresses + ProtocolLength() PatternFlowArpProtocolLength + // SetProtocolLength assigns PatternFlowArpProtocolLength provided by user to FlowArp. + // PatternFlowArpProtocolLength is length (in octets) of internetwork addresses + SetProtocolLength(value PatternFlowArpProtocolLength) FlowArp + // HasProtocolLength checks if ProtocolLength has been set in FlowArp + HasProtocolLength() bool + // Operation returns PatternFlowArpOperation, set in FlowArp. + // PatternFlowArpOperation is the operation that the sender is performing + Operation() PatternFlowArpOperation + // SetOperation assigns PatternFlowArpOperation provided by user to FlowArp. + // PatternFlowArpOperation is the operation that the sender is performing + SetOperation(value PatternFlowArpOperation) FlowArp + // HasOperation checks if Operation has been set in FlowArp + HasOperation() bool + // SenderHardwareAddr returns PatternFlowArpSenderHardwareAddr, set in FlowArp. + // PatternFlowArpSenderHardwareAddr is media address of the sender + SenderHardwareAddr() PatternFlowArpSenderHardwareAddr + // SetSenderHardwareAddr assigns PatternFlowArpSenderHardwareAddr provided by user to FlowArp. + // PatternFlowArpSenderHardwareAddr is media address of the sender + SetSenderHardwareAddr(value PatternFlowArpSenderHardwareAddr) FlowArp + // HasSenderHardwareAddr checks if SenderHardwareAddr has been set in FlowArp + HasSenderHardwareAddr() bool + // SenderProtocolAddr returns PatternFlowArpSenderProtocolAddr, set in FlowArp. + // PatternFlowArpSenderProtocolAddr is internetwork address of the sender + SenderProtocolAddr() PatternFlowArpSenderProtocolAddr + // SetSenderProtocolAddr assigns PatternFlowArpSenderProtocolAddr provided by user to FlowArp. + // PatternFlowArpSenderProtocolAddr is internetwork address of the sender + SetSenderProtocolAddr(value PatternFlowArpSenderProtocolAddr) FlowArp + // HasSenderProtocolAddr checks if SenderProtocolAddr has been set in FlowArp + HasSenderProtocolAddr() bool + // TargetHardwareAddr returns PatternFlowArpTargetHardwareAddr, set in FlowArp. + // PatternFlowArpTargetHardwareAddr is media address of the target + TargetHardwareAddr() PatternFlowArpTargetHardwareAddr + // SetTargetHardwareAddr assigns PatternFlowArpTargetHardwareAddr provided by user to FlowArp. + // PatternFlowArpTargetHardwareAddr is media address of the target + SetTargetHardwareAddr(value PatternFlowArpTargetHardwareAddr) FlowArp + // HasTargetHardwareAddr checks if TargetHardwareAddr has been set in FlowArp + HasTargetHardwareAddr() bool + // TargetProtocolAddr returns PatternFlowArpTargetProtocolAddr, set in FlowArp. + // PatternFlowArpTargetProtocolAddr is internetwork address of the target + TargetProtocolAddr() PatternFlowArpTargetProtocolAddr + // SetTargetProtocolAddr assigns PatternFlowArpTargetProtocolAddr provided by user to FlowArp. + // PatternFlowArpTargetProtocolAddr is internetwork address of the target + SetTargetProtocolAddr(value PatternFlowArpTargetProtocolAddr) FlowArp + // HasTargetProtocolAddr checks if TargetProtocolAddr has been set in FlowArp + HasTargetProtocolAddr() bool + setNil() +} + +// description is TBD +// HardwareType returns a PatternFlowArpHardwareType +func (obj *flowArp) HardwareType() PatternFlowArpHardwareType { + if obj.obj.HardwareType == nil { + obj.obj.HardwareType = NewPatternFlowArpHardwareType().msg() + } + if obj.hardwareTypeHolder == nil { + obj.hardwareTypeHolder = &patternFlowArpHardwareType{obj: obj.obj.HardwareType} + } + return obj.hardwareTypeHolder +} + +// description is TBD +// HardwareType returns a PatternFlowArpHardwareType +func (obj *flowArp) HasHardwareType() bool { + return obj.obj.HardwareType != nil +} + +// description is TBD +// SetHardwareType sets the PatternFlowArpHardwareType value in the FlowArp object +func (obj *flowArp) SetHardwareType(value PatternFlowArpHardwareType) FlowArp { + + obj.hardwareTypeHolder = nil + obj.obj.HardwareType = value.msg() + + return obj +} + +// description is TBD +// ProtocolType returns a PatternFlowArpProtocolType +func (obj *flowArp) ProtocolType() PatternFlowArpProtocolType { + if obj.obj.ProtocolType == nil { + obj.obj.ProtocolType = NewPatternFlowArpProtocolType().msg() + } + if obj.protocolTypeHolder == nil { + obj.protocolTypeHolder = &patternFlowArpProtocolType{obj: obj.obj.ProtocolType} + } + return obj.protocolTypeHolder +} + +// description is TBD +// ProtocolType returns a PatternFlowArpProtocolType +func (obj *flowArp) HasProtocolType() bool { + return obj.obj.ProtocolType != nil +} + +// description is TBD +// SetProtocolType sets the PatternFlowArpProtocolType value in the FlowArp object +func (obj *flowArp) SetProtocolType(value PatternFlowArpProtocolType) FlowArp { + + obj.protocolTypeHolder = nil + obj.obj.ProtocolType = value.msg() + + return obj +} + +// description is TBD +// HardwareLength returns a PatternFlowArpHardwareLength +func (obj *flowArp) HardwareLength() PatternFlowArpHardwareLength { + if obj.obj.HardwareLength == nil { + obj.obj.HardwareLength = NewPatternFlowArpHardwareLength().msg() + } + if obj.hardwareLengthHolder == nil { + obj.hardwareLengthHolder = &patternFlowArpHardwareLength{obj: obj.obj.HardwareLength} + } + return obj.hardwareLengthHolder +} + +// description is TBD +// HardwareLength returns a PatternFlowArpHardwareLength +func (obj *flowArp) HasHardwareLength() bool { + return obj.obj.HardwareLength != nil +} + +// description is TBD +// SetHardwareLength sets the PatternFlowArpHardwareLength value in the FlowArp object +func (obj *flowArp) SetHardwareLength(value PatternFlowArpHardwareLength) FlowArp { + + obj.hardwareLengthHolder = nil + obj.obj.HardwareLength = value.msg() + + return obj +} + +// description is TBD +// ProtocolLength returns a PatternFlowArpProtocolLength +func (obj *flowArp) ProtocolLength() PatternFlowArpProtocolLength { + if obj.obj.ProtocolLength == nil { + obj.obj.ProtocolLength = NewPatternFlowArpProtocolLength().msg() + } + if obj.protocolLengthHolder == nil { + obj.protocolLengthHolder = &patternFlowArpProtocolLength{obj: obj.obj.ProtocolLength} + } + return obj.protocolLengthHolder +} + +// description is TBD +// ProtocolLength returns a PatternFlowArpProtocolLength +func (obj *flowArp) HasProtocolLength() bool { + return obj.obj.ProtocolLength != nil +} + +// description is TBD +// SetProtocolLength sets the PatternFlowArpProtocolLength value in the FlowArp object +func (obj *flowArp) SetProtocolLength(value PatternFlowArpProtocolLength) FlowArp { + + obj.protocolLengthHolder = nil + obj.obj.ProtocolLength = value.msg() + + return obj +} + +// description is TBD +// Operation returns a PatternFlowArpOperation +func (obj *flowArp) Operation() PatternFlowArpOperation { + if obj.obj.Operation == nil { + obj.obj.Operation = NewPatternFlowArpOperation().msg() + } + if obj.operationHolder == nil { + obj.operationHolder = &patternFlowArpOperation{obj: obj.obj.Operation} + } + return obj.operationHolder +} + +// description is TBD +// Operation returns a PatternFlowArpOperation +func (obj *flowArp) HasOperation() bool { + return obj.obj.Operation != nil +} + +// description is TBD +// SetOperation sets the PatternFlowArpOperation value in the FlowArp object +func (obj *flowArp) SetOperation(value PatternFlowArpOperation) FlowArp { + + obj.operationHolder = nil + obj.obj.Operation = value.msg() + + return obj +} + +// description is TBD +// SenderHardwareAddr returns a PatternFlowArpSenderHardwareAddr +func (obj *flowArp) SenderHardwareAddr() PatternFlowArpSenderHardwareAddr { + if obj.obj.SenderHardwareAddr == nil { + obj.obj.SenderHardwareAddr = NewPatternFlowArpSenderHardwareAddr().msg() + } + if obj.senderHardwareAddrHolder == nil { + obj.senderHardwareAddrHolder = &patternFlowArpSenderHardwareAddr{obj: obj.obj.SenderHardwareAddr} + } + return obj.senderHardwareAddrHolder +} + +// description is TBD +// SenderHardwareAddr returns a PatternFlowArpSenderHardwareAddr +func (obj *flowArp) HasSenderHardwareAddr() bool { + return obj.obj.SenderHardwareAddr != nil +} + +// description is TBD +// SetSenderHardwareAddr sets the PatternFlowArpSenderHardwareAddr value in the FlowArp object +func (obj *flowArp) SetSenderHardwareAddr(value PatternFlowArpSenderHardwareAddr) FlowArp { + + obj.senderHardwareAddrHolder = nil + obj.obj.SenderHardwareAddr = value.msg() + + return obj +} + +// description is TBD +// SenderProtocolAddr returns a PatternFlowArpSenderProtocolAddr +func (obj *flowArp) SenderProtocolAddr() PatternFlowArpSenderProtocolAddr { + if obj.obj.SenderProtocolAddr == nil { + obj.obj.SenderProtocolAddr = NewPatternFlowArpSenderProtocolAddr().msg() + } + if obj.senderProtocolAddrHolder == nil { + obj.senderProtocolAddrHolder = &patternFlowArpSenderProtocolAddr{obj: obj.obj.SenderProtocolAddr} + } + return obj.senderProtocolAddrHolder +} + +// description is TBD +// SenderProtocolAddr returns a PatternFlowArpSenderProtocolAddr +func (obj *flowArp) HasSenderProtocolAddr() bool { + return obj.obj.SenderProtocolAddr != nil +} + +// description is TBD +// SetSenderProtocolAddr sets the PatternFlowArpSenderProtocolAddr value in the FlowArp object +func (obj *flowArp) SetSenderProtocolAddr(value PatternFlowArpSenderProtocolAddr) FlowArp { + + obj.senderProtocolAddrHolder = nil + obj.obj.SenderProtocolAddr = value.msg() + + return obj +} + +// description is TBD +// TargetHardwareAddr returns a PatternFlowArpTargetHardwareAddr +func (obj *flowArp) TargetHardwareAddr() PatternFlowArpTargetHardwareAddr { + if obj.obj.TargetHardwareAddr == nil { + obj.obj.TargetHardwareAddr = NewPatternFlowArpTargetHardwareAddr().msg() + } + if obj.targetHardwareAddrHolder == nil { + obj.targetHardwareAddrHolder = &patternFlowArpTargetHardwareAddr{obj: obj.obj.TargetHardwareAddr} + } + return obj.targetHardwareAddrHolder +} + +// description is TBD +// TargetHardwareAddr returns a PatternFlowArpTargetHardwareAddr +func (obj *flowArp) HasTargetHardwareAddr() bool { + return obj.obj.TargetHardwareAddr != nil +} + +// description is TBD +// SetTargetHardwareAddr sets the PatternFlowArpTargetHardwareAddr value in the FlowArp object +func (obj *flowArp) SetTargetHardwareAddr(value PatternFlowArpTargetHardwareAddr) FlowArp { + + obj.targetHardwareAddrHolder = nil + obj.obj.TargetHardwareAddr = value.msg() + + return obj +} + +// description is TBD +// TargetProtocolAddr returns a PatternFlowArpTargetProtocolAddr +func (obj *flowArp) TargetProtocolAddr() PatternFlowArpTargetProtocolAddr { + if obj.obj.TargetProtocolAddr == nil { + obj.obj.TargetProtocolAddr = NewPatternFlowArpTargetProtocolAddr().msg() + } + if obj.targetProtocolAddrHolder == nil { + obj.targetProtocolAddrHolder = &patternFlowArpTargetProtocolAddr{obj: obj.obj.TargetProtocolAddr} + } + return obj.targetProtocolAddrHolder +} + +// description is TBD +// TargetProtocolAddr returns a PatternFlowArpTargetProtocolAddr +func (obj *flowArp) HasTargetProtocolAddr() bool { + return obj.obj.TargetProtocolAddr != nil +} + +// description is TBD +// SetTargetProtocolAddr sets the PatternFlowArpTargetProtocolAddr value in the FlowArp object +func (obj *flowArp) SetTargetProtocolAddr(value PatternFlowArpTargetProtocolAddr) FlowArp { + + obj.targetProtocolAddrHolder = nil + obj.obj.TargetProtocolAddr = value.msg() + + return obj +} + +func (obj *flowArp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.HardwareType != nil { + + obj.HardwareType().validateObj(vObj, set_default) + } + + if obj.obj.ProtocolType != nil { + + obj.ProtocolType().validateObj(vObj, set_default) + } + + if obj.obj.HardwareLength != nil { + + obj.HardwareLength().validateObj(vObj, set_default) + } + + if obj.obj.ProtocolLength != nil { + + obj.ProtocolLength().validateObj(vObj, set_default) + } + + if obj.obj.Operation != nil { + + obj.Operation().validateObj(vObj, set_default) + } + + if obj.obj.SenderHardwareAddr != nil { + + obj.SenderHardwareAddr().validateObj(vObj, set_default) + } + + if obj.obj.SenderProtocolAddr != nil { + + obj.SenderProtocolAddr().validateObj(vObj, set_default) + } + + if obj.obj.TargetHardwareAddr != nil { + + obj.TargetHardwareAddr().validateObj(vObj, set_default) + } + + if obj.obj.TargetProtocolAddr != nil { + + obj.TargetProtocolAddr().validateObj(vObj, set_default) + } + +} + +func (obj *flowArp) setDefault() { + +} diff --git a/gosnappi/flow_burst.go b/gosnappi/flow_burst.go new file mode 100644 index 00000000..05f5099b --- /dev/null +++ b/gosnappi/flow_burst.go @@ -0,0 +1,436 @@ +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" +) + +// ***** FlowBurst ***** +type flowBurst struct { + validation + obj *otg.FlowBurst + marshaller marshalFlowBurst + unMarshaller unMarshalFlowBurst + interBurstGapHolder FlowDurationInterBurstGap +} + +func NewFlowBurst() FlowBurst { + obj := flowBurst{obj: &otg.FlowBurst{}} + obj.setDefault() + return &obj +} + +func (obj *flowBurst) msg() *otg.FlowBurst { + return obj.obj +} + +func (obj *flowBurst) setMsg(msg *otg.FlowBurst) FlowBurst { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowBurst struct { + obj *flowBurst +} + +type marshalFlowBurst interface { + // ToProto marshals FlowBurst to protobuf object *otg.FlowBurst + ToProto() (*otg.FlowBurst, error) + // ToPbText marshals FlowBurst to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowBurst to YAML text + ToYaml() (string, error) + // ToJson marshals FlowBurst to JSON text + ToJson() (string, error) +} + +type unMarshalflowBurst struct { + obj *flowBurst +} + +type unMarshalFlowBurst interface { + // FromProto unmarshals FlowBurst from protobuf object *otg.FlowBurst + FromProto(msg *otg.FlowBurst) (FlowBurst, error) + // FromPbText unmarshals FlowBurst from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowBurst from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowBurst from JSON text + FromJson(value string) error +} + +func (obj *flowBurst) Marshal() marshalFlowBurst { + if obj.marshaller == nil { + obj.marshaller = &marshalflowBurst{obj: obj} + } + return obj.marshaller +} + +func (obj *flowBurst) Unmarshal() unMarshalFlowBurst { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowBurst{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowBurst) ToProto() (*otg.FlowBurst, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowBurst) FromProto(msg *otg.FlowBurst) (FlowBurst, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowBurst) 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 *unMarshalflowBurst) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowBurst) 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 *unMarshalflowBurst) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowBurst) 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 *unMarshalflowBurst) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowBurst) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowBurst) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowBurst) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowBurst) Clone() (FlowBurst, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowBurst() + 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 +} + +func (obj *flowBurst) setNil() { + obj.interBurstGapHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowBurst is transmits continuous or fixed burst of packets. +// For continuous burst of packets, it will not automatically stop. +// For fixed burst of packets, it will stop after transmitting fixed number of bursts. +type FlowBurst interface { + Validation + // msg marshals FlowBurst to protobuf object *otg.FlowBurst + // and doesn't set defaults + msg() *otg.FlowBurst + // setMsg unmarshals FlowBurst from protobuf object *otg.FlowBurst + // and doesn't set defaults + setMsg(*otg.FlowBurst) FlowBurst + // provides marshal interface + Marshal() marshalFlowBurst + // provides unmarshal interface + Unmarshal() unMarshalFlowBurst + // validate validates FlowBurst + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowBurst, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Bursts returns uint32, set in FlowBurst. + Bursts() uint32 + // SetBursts assigns uint32 provided by user to FlowBurst + SetBursts(value uint32) FlowBurst + // HasBursts checks if Bursts has been set in FlowBurst + HasBursts() bool + // Packets returns uint32, set in FlowBurst. + Packets() uint32 + // SetPackets assigns uint32 provided by user to FlowBurst + SetPackets(value uint32) FlowBurst + // HasPackets checks if Packets has been set in FlowBurst + HasPackets() bool + // Gap returns uint32, set in FlowBurst. + Gap() uint32 + // SetGap assigns uint32 provided by user to FlowBurst + SetGap(value uint32) FlowBurst + // HasGap checks if Gap has been set in FlowBurst + HasGap() bool + // InterBurstGap returns FlowDurationInterBurstGap, set in FlowBurst. + // FlowDurationInterBurstGap is the optional container for specifying a gap between bursts. + InterBurstGap() FlowDurationInterBurstGap + // SetInterBurstGap assigns FlowDurationInterBurstGap provided by user to FlowBurst. + // FlowDurationInterBurstGap is the optional container for specifying a gap between bursts. + SetInterBurstGap(value FlowDurationInterBurstGap) FlowBurst + // HasInterBurstGap checks if InterBurstGap has been set in FlowBurst + HasInterBurstGap() bool + setNil() +} + +// The number of packet bursts transmitted per flow. +// A value of 0 implies continuous burst of packets. +// Bursts returns a uint32 +func (obj *flowBurst) Bursts() uint32 { + + return *obj.obj.Bursts + +} + +// The number of packet bursts transmitted per flow. +// A value of 0 implies continuous burst of packets. +// Bursts returns a uint32 +func (obj *flowBurst) HasBursts() bool { + return obj.obj.Bursts != nil +} + +// The number of packet bursts transmitted per flow. +// A value of 0 implies continuous burst of packets. +// SetBursts sets the uint32 value in the FlowBurst object +func (obj *flowBurst) SetBursts(value uint32) FlowBurst { + + obj.obj.Bursts = &value + return obj +} + +// The number of packets transmitted per burst. +// Packets returns a uint32 +func (obj *flowBurst) Packets() uint32 { + + return *obj.obj.Packets + +} + +// The number of packets transmitted per burst. +// Packets returns a uint32 +func (obj *flowBurst) HasPackets() bool { + return obj.obj.Packets != nil +} + +// The number of packets transmitted per burst. +// SetPackets sets the uint32 value in the FlowBurst object +func (obj *flowBurst) SetPackets(value uint32) FlowBurst { + + obj.obj.Packets = &value + return obj +} + +// The minimum gap between packets expressed as bytes. +// Gap returns a uint32 +func (obj *flowBurst) Gap() uint32 { + + return *obj.obj.Gap + +} + +// The minimum gap between packets expressed as bytes. +// Gap returns a uint32 +func (obj *flowBurst) HasGap() bool { + return obj.obj.Gap != nil +} + +// The minimum gap between packets expressed as bytes. +// SetGap sets the uint32 value in the FlowBurst object +func (obj *flowBurst) SetGap(value uint32) FlowBurst { + + obj.obj.Gap = &value + return obj +} + +// description is TBD +// InterBurstGap returns a FlowDurationInterBurstGap +func (obj *flowBurst) InterBurstGap() FlowDurationInterBurstGap { + if obj.obj.InterBurstGap == nil { + obj.obj.InterBurstGap = NewFlowDurationInterBurstGap().msg() + } + if obj.interBurstGapHolder == nil { + obj.interBurstGapHolder = &flowDurationInterBurstGap{obj: obj.obj.InterBurstGap} + } + return obj.interBurstGapHolder +} + +// description is TBD +// InterBurstGap returns a FlowDurationInterBurstGap +func (obj *flowBurst) HasInterBurstGap() bool { + return obj.obj.InterBurstGap != nil +} + +// description is TBD +// SetInterBurstGap sets the FlowDurationInterBurstGap value in the FlowBurst object +func (obj *flowBurst) SetInterBurstGap(value FlowDurationInterBurstGap) FlowBurst { + + obj.interBurstGapHolder = nil + obj.obj.InterBurstGap = value.msg() + + return obj +} + +func (obj *flowBurst) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Packets != nil { + + if *obj.obj.Packets < 1 || *obj.obj.Packets > 4294967295 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= FlowBurst.Packets <= 4294967295 but Got %d", *obj.obj.Packets)) + } + + } + + if obj.obj.InterBurstGap != nil { + + obj.InterBurstGap().validateObj(vObj, set_default) + } + +} + +func (obj *flowBurst) setDefault() { + if obj.obj.Bursts == nil { + obj.SetBursts(0) + } + if obj.obj.Packets == nil { + obj.SetPackets(1) + } + if obj.obj.Gap == nil { + obj.SetGap(12) + } + +} diff --git a/gosnappi/flow_continuous.go b/gosnappi/flow_continuous.go new file mode 100644 index 00000000..3fcfb8d4 --- /dev/null +++ b/gosnappi/flow_continuous.go @@ -0,0 +1,361 @@ +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" +) + +// ***** FlowContinuous ***** +type flowContinuous struct { + validation + obj *otg.FlowContinuous + marshaller marshalFlowContinuous + unMarshaller unMarshalFlowContinuous + delayHolder FlowDelay +} + +func NewFlowContinuous() FlowContinuous { + obj := flowContinuous{obj: &otg.FlowContinuous{}} + obj.setDefault() + return &obj +} + +func (obj *flowContinuous) msg() *otg.FlowContinuous { + return obj.obj +} + +func (obj *flowContinuous) setMsg(msg *otg.FlowContinuous) FlowContinuous { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowContinuous struct { + obj *flowContinuous +} + +type marshalFlowContinuous interface { + // ToProto marshals FlowContinuous to protobuf object *otg.FlowContinuous + ToProto() (*otg.FlowContinuous, error) + // ToPbText marshals FlowContinuous to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowContinuous to YAML text + ToYaml() (string, error) + // ToJson marshals FlowContinuous to JSON text + ToJson() (string, error) +} + +type unMarshalflowContinuous struct { + obj *flowContinuous +} + +type unMarshalFlowContinuous interface { + // FromProto unmarshals FlowContinuous from protobuf object *otg.FlowContinuous + FromProto(msg *otg.FlowContinuous) (FlowContinuous, error) + // FromPbText unmarshals FlowContinuous from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowContinuous from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowContinuous from JSON text + FromJson(value string) error +} + +func (obj *flowContinuous) Marshal() marshalFlowContinuous { + if obj.marshaller == nil { + obj.marshaller = &marshalflowContinuous{obj: obj} + } + return obj.marshaller +} + +func (obj *flowContinuous) Unmarshal() unMarshalFlowContinuous { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowContinuous{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowContinuous) ToProto() (*otg.FlowContinuous, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowContinuous) FromProto(msg *otg.FlowContinuous) (FlowContinuous, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowContinuous) 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 *unMarshalflowContinuous) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowContinuous) 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 *unMarshalflowContinuous) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowContinuous) 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 *unMarshalflowContinuous) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowContinuous) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowContinuous) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowContinuous) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowContinuous) Clone() (FlowContinuous, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowContinuous() + 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 +} + +func (obj *flowContinuous) setNil() { + obj.delayHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowContinuous is transmit will be continuous and will not stop automatically. +type FlowContinuous interface { + Validation + // msg marshals FlowContinuous to protobuf object *otg.FlowContinuous + // and doesn't set defaults + msg() *otg.FlowContinuous + // setMsg unmarshals FlowContinuous from protobuf object *otg.FlowContinuous + // and doesn't set defaults + setMsg(*otg.FlowContinuous) FlowContinuous + // provides marshal interface + Marshal() marshalFlowContinuous + // provides unmarshal interface + Unmarshal() unMarshalFlowContinuous + // validate validates FlowContinuous + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowContinuous, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Gap returns uint32, set in FlowContinuous. + Gap() uint32 + // SetGap assigns uint32 provided by user to FlowContinuous + SetGap(value uint32) FlowContinuous + // HasGap checks if Gap has been set in FlowContinuous + HasGap() bool + // Delay returns FlowDelay, set in FlowContinuous. + // FlowDelay is the optional container to specify the delay before starting + // transmission of packets. + Delay() FlowDelay + // SetDelay assigns FlowDelay provided by user to FlowContinuous. + // FlowDelay is the optional container to specify the delay before starting + // transmission of packets. + SetDelay(value FlowDelay) FlowContinuous + // HasDelay checks if Delay has been set in FlowContinuous + HasDelay() bool + setNil() +} + +// The minimum gap between packets expressed as bytes. +// Gap returns a uint32 +func (obj *flowContinuous) Gap() uint32 { + + return *obj.obj.Gap + +} + +// The minimum gap between packets expressed as bytes. +// Gap returns a uint32 +func (obj *flowContinuous) HasGap() bool { + return obj.obj.Gap != nil +} + +// The minimum gap between packets expressed as bytes. +// SetGap sets the uint32 value in the FlowContinuous object +func (obj *flowContinuous) SetGap(value uint32) FlowContinuous { + + obj.obj.Gap = &value + return obj +} + +// description is TBD +// Delay returns a FlowDelay +func (obj *flowContinuous) Delay() FlowDelay { + if obj.obj.Delay == nil { + obj.obj.Delay = NewFlowDelay().msg() + } + if obj.delayHolder == nil { + obj.delayHolder = &flowDelay{obj: obj.obj.Delay} + } + return obj.delayHolder +} + +// description is TBD +// Delay returns a FlowDelay +func (obj *flowContinuous) HasDelay() bool { + return obj.obj.Delay != nil +} + +// description is TBD +// SetDelay sets the FlowDelay value in the FlowContinuous object +func (obj *flowContinuous) SetDelay(value FlowDelay) FlowContinuous { + + obj.delayHolder = nil + obj.obj.Delay = value.msg() + + return obj +} + +func (obj *flowContinuous) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Delay != nil { + + obj.Delay().validateObj(vObj, set_default) + } + +} + +func (obj *flowContinuous) setDefault() { + if obj.obj.Gap == nil { + obj.SetGap(12) + } + +} diff --git a/gosnappi/flow_custom.go b/gosnappi/flow_custom.go new file mode 100644 index 00000000..bb7ab594 --- /dev/null +++ b/gosnappi/flow_custom.go @@ -0,0 +1,417 @@ +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" +) + +// ***** FlowCustom ***** +type flowCustom struct { + validation + obj *otg.FlowCustom + marshaller marshalFlowCustom + unMarshaller unMarshalFlowCustom + metricTagsHolder FlowCustomFlowCustomMetricTagIter +} + +func NewFlowCustom() FlowCustom { + obj := flowCustom{obj: &otg.FlowCustom{}} + obj.setDefault() + return &obj +} + +func (obj *flowCustom) msg() *otg.FlowCustom { + return obj.obj +} + +func (obj *flowCustom) setMsg(msg *otg.FlowCustom) FlowCustom { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowCustom struct { + obj *flowCustom +} + +type marshalFlowCustom interface { + // ToProto marshals FlowCustom to protobuf object *otg.FlowCustom + ToProto() (*otg.FlowCustom, error) + // ToPbText marshals FlowCustom to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowCustom to YAML text + ToYaml() (string, error) + // ToJson marshals FlowCustom to JSON text + ToJson() (string, error) +} + +type unMarshalflowCustom struct { + obj *flowCustom +} + +type unMarshalFlowCustom interface { + // FromProto unmarshals FlowCustom from protobuf object *otg.FlowCustom + FromProto(msg *otg.FlowCustom) (FlowCustom, error) + // FromPbText unmarshals FlowCustom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowCustom from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowCustom from JSON text + FromJson(value string) error +} + +func (obj *flowCustom) Marshal() marshalFlowCustom { + if obj.marshaller == nil { + obj.marshaller = &marshalflowCustom{obj: obj} + } + return obj.marshaller +} + +func (obj *flowCustom) Unmarshal() unMarshalFlowCustom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowCustom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowCustom) ToProto() (*otg.FlowCustom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowCustom) FromProto(msg *otg.FlowCustom) (FlowCustom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowCustom) 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 *unMarshalflowCustom) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowCustom) 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 *unMarshalflowCustom) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowCustom) 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 *unMarshalflowCustom) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowCustom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowCustom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowCustom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowCustom) Clone() (FlowCustom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowCustom() + 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 +} + +func (obj *flowCustom) setNil() { + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowCustom is custom packet header +type FlowCustom interface { + Validation + // msg marshals FlowCustom to protobuf object *otg.FlowCustom + // and doesn't set defaults + msg() *otg.FlowCustom + // setMsg unmarshals FlowCustom from protobuf object *otg.FlowCustom + // and doesn't set defaults + setMsg(*otg.FlowCustom) FlowCustom + // provides marshal interface + Marshal() marshalFlowCustom + // provides unmarshal interface + Unmarshal() unMarshalFlowCustom + // validate validates FlowCustom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowCustom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Bytes returns string, set in FlowCustom. + Bytes() string + // SetBytes assigns string provided by user to FlowCustom + SetBytes(value string) FlowCustom + // MetricTags returns FlowCustomFlowCustomMetricTagIterIter, set in FlowCustom + MetricTags() FlowCustomFlowCustomMetricTagIter + setNil() +} + +// A custom packet header defined as a string of hex bytes. The string MUST contain sequence of valid hex bytes. Spaces or colons can be part of the bytes but will be discarded. This packet header can be used in multiple places in the packet. +// Bytes returns a string +func (obj *flowCustom) Bytes() string { + + return *obj.obj.Bytes + +} + +// A custom packet header defined as a string of hex bytes. The string MUST contain sequence of valid hex bytes. Spaces or colons can be part of the bytes but will be discarded. This packet header can be used in multiple places in the packet. +// SetBytes sets the string value in the FlowCustom object +func (obj *flowCustom) SetBytes(value string) FlowCustom { + + obj.obj.Bytes = &value + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits +// in a corresponding header field for metrics per each applicable value. +// These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []FlowCustomMetricTag +func (obj *flowCustom) MetricTags() FlowCustomFlowCustomMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.FlowCustomMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newFlowCustomFlowCustomMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type flowCustomFlowCustomMetricTagIter struct { + obj *flowCustom + flowCustomMetricTagSlice []FlowCustomMetricTag + fieldPtr *[]*otg.FlowCustomMetricTag +} + +func newFlowCustomFlowCustomMetricTagIter(ptr *[]*otg.FlowCustomMetricTag) FlowCustomFlowCustomMetricTagIter { + return &flowCustomFlowCustomMetricTagIter{fieldPtr: ptr} +} + +type FlowCustomFlowCustomMetricTagIter interface { + setMsg(*flowCustom) FlowCustomFlowCustomMetricTagIter + Items() []FlowCustomMetricTag + Add() FlowCustomMetricTag + Append(items ...FlowCustomMetricTag) FlowCustomFlowCustomMetricTagIter + Set(index int, newObj FlowCustomMetricTag) FlowCustomFlowCustomMetricTagIter + Clear() FlowCustomFlowCustomMetricTagIter + clearHolderSlice() FlowCustomFlowCustomMetricTagIter + appendHolderSlice(item FlowCustomMetricTag) FlowCustomFlowCustomMetricTagIter +} + +func (obj *flowCustomFlowCustomMetricTagIter) setMsg(msg *flowCustom) FlowCustomFlowCustomMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flowCustomMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *flowCustomFlowCustomMetricTagIter) Items() []FlowCustomMetricTag { + return obj.flowCustomMetricTagSlice +} + +func (obj *flowCustomFlowCustomMetricTagIter) Add() FlowCustomMetricTag { + newObj := &otg.FlowCustomMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flowCustomMetricTag{obj: newObj} + newLibObj.setDefault() + obj.flowCustomMetricTagSlice = append(obj.flowCustomMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *flowCustomFlowCustomMetricTagIter) Append(items ...FlowCustomMetricTag) FlowCustomFlowCustomMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowCustomMetricTagSlice = append(obj.flowCustomMetricTagSlice, item) + } + return obj +} + +func (obj *flowCustomFlowCustomMetricTagIter) Set(index int, newObj FlowCustomMetricTag) FlowCustomFlowCustomMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowCustomMetricTagSlice[index] = newObj + return obj +} +func (obj *flowCustomFlowCustomMetricTagIter) Clear() FlowCustomFlowCustomMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.FlowCustomMetricTag{} + obj.flowCustomMetricTagSlice = []FlowCustomMetricTag{} + } + return obj +} +func (obj *flowCustomFlowCustomMetricTagIter) clearHolderSlice() FlowCustomFlowCustomMetricTagIter { + if len(obj.flowCustomMetricTagSlice) > 0 { + obj.flowCustomMetricTagSlice = []FlowCustomMetricTag{} + } + return obj +} +func (obj *flowCustomFlowCustomMetricTagIter) appendHolderSlice(item FlowCustomMetricTag) FlowCustomFlowCustomMetricTagIter { + obj.flowCustomMetricTagSlice = append(obj.flowCustomMetricTagSlice, item) + return obj +} + +func (obj *flowCustom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Bytes is required + if obj.obj.Bytes == nil { + vObj.validationErrors = append(vObj.validationErrors, "Bytes is required field on interface FlowCustom") + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&flowCustomMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *flowCustom) setDefault() { + +} diff --git a/gosnappi/flow_custom_metric_tag.go b/gosnappi/flow_custom_metric_tag.go new file mode 100644 index 00000000..ab9e3700 --- /dev/null +++ b/gosnappi/flow_custom_metric_tag.go @@ -0,0 +1,382 @@ +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" +) + +// ***** FlowCustomMetricTag ***** +type flowCustomMetricTag struct { + validation + obj *otg.FlowCustomMetricTag + marshaller marshalFlowCustomMetricTag + unMarshaller unMarshalFlowCustomMetricTag +} + +func NewFlowCustomMetricTag() FlowCustomMetricTag { + obj := flowCustomMetricTag{obj: &otg.FlowCustomMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *flowCustomMetricTag) msg() *otg.FlowCustomMetricTag { + return obj.obj +} + +func (obj *flowCustomMetricTag) setMsg(msg *otg.FlowCustomMetricTag) FlowCustomMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowCustomMetricTag struct { + obj *flowCustomMetricTag +} + +type marshalFlowCustomMetricTag interface { + // ToProto marshals FlowCustomMetricTag to protobuf object *otg.FlowCustomMetricTag + ToProto() (*otg.FlowCustomMetricTag, error) + // ToPbText marshals FlowCustomMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowCustomMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals FlowCustomMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalflowCustomMetricTag struct { + obj *flowCustomMetricTag +} + +type unMarshalFlowCustomMetricTag interface { + // FromProto unmarshals FlowCustomMetricTag from protobuf object *otg.FlowCustomMetricTag + FromProto(msg *otg.FlowCustomMetricTag) (FlowCustomMetricTag, error) + // FromPbText unmarshals FlowCustomMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowCustomMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowCustomMetricTag from JSON text + FromJson(value string) error +} + +func (obj *flowCustomMetricTag) Marshal() marshalFlowCustomMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalflowCustomMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *flowCustomMetricTag) Unmarshal() unMarshalFlowCustomMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowCustomMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowCustomMetricTag) ToProto() (*otg.FlowCustomMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowCustomMetricTag) FromProto(msg *otg.FlowCustomMetricTag) (FlowCustomMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowCustomMetricTag) 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 *unMarshalflowCustomMetricTag) 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 *marshalflowCustomMetricTag) 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 *unMarshalflowCustomMetricTag) 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 *marshalflowCustomMetricTag) 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 *unMarshalflowCustomMetricTag) 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 *flowCustomMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowCustomMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowCustomMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowCustomMetricTag) Clone() (FlowCustomMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowCustomMetricTag() + 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 +} + +// FlowCustomMetricTag is metric Tag can be used to enable tracking portion of or all bits +// in a corresponding header field for metrics per each applicable value. +// These would appear as tagged metrics in corresponding flow metrics. +type FlowCustomMetricTag interface { + Validation + // msg marshals FlowCustomMetricTag to protobuf object *otg.FlowCustomMetricTag + // and doesn't set defaults + msg() *otg.FlowCustomMetricTag + // setMsg unmarshals FlowCustomMetricTag from protobuf object *otg.FlowCustomMetricTag + // and doesn't set defaults + setMsg(*otg.FlowCustomMetricTag) FlowCustomMetricTag + // provides marshal interface + Marshal() marshalFlowCustomMetricTag + // provides unmarshal interface + Unmarshal() unMarshalFlowCustomMetricTag + // validate validates FlowCustomMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowCustomMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in FlowCustomMetricTag. + Name() string + // SetName assigns string provided by user to FlowCustomMetricTag + SetName(value string) FlowCustomMetricTag + // Offset returns uint32, set in FlowCustomMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to FlowCustomMetricTag + SetOffset(value uint32) FlowCustomMetricTag + // HasOffset checks if Offset has been set in FlowCustomMetricTag + HasOffset() bool + // Length returns uint32, set in FlowCustomMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to FlowCustomMetricTag + SetLength(value uint32) FlowCustomMetricTag + // HasLength checks if Length has been set in FlowCustomMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable +// for configured offset and length inside corresponding header field +// Name returns a string +func (obj *flowCustomMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable +// for configured offset and length inside corresponding header field +// SetName sets the string value in the FlowCustomMetricTag object +func (obj *flowCustomMetricTag) SetName(value string) FlowCustomMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *flowCustomMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *flowCustomMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the FlowCustomMetricTag object +func (obj *flowCustomMetricTag) SetOffset(value uint32) FlowCustomMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset +// of corresponding header field +// Length returns a uint32 +func (obj *flowCustomMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset +// of corresponding header field +// Length returns a uint32 +func (obj *flowCustomMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset +// of corresponding header field +// SetLength sets the uint32 value in the FlowCustomMetricTag object +func (obj *flowCustomMetricTag) SetLength(value uint32) FlowCustomMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *flowCustomMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface FlowCustomMetricTag") + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 4294967295 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= FlowCustomMetricTag.Length <= 4294967295 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *flowCustomMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/flow_delay.go b/gosnappi/flow_delay.go new file mode 100644 index 00000000..7bf647bb --- /dev/null +++ b/gosnappi/flow_delay.go @@ -0,0 +1,508 @@ +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" +) + +// ***** FlowDelay ***** +type flowDelay struct { + validation + obj *otg.FlowDelay + marshaller marshalFlowDelay + unMarshaller unMarshalFlowDelay +} + +func NewFlowDelay() FlowDelay { + obj := flowDelay{obj: &otg.FlowDelay{}} + obj.setDefault() + return &obj +} + +func (obj *flowDelay) msg() *otg.FlowDelay { + return obj.obj +} + +func (obj *flowDelay) setMsg(msg *otg.FlowDelay) FlowDelay { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowDelay struct { + obj *flowDelay +} + +type marshalFlowDelay interface { + // ToProto marshals FlowDelay to protobuf object *otg.FlowDelay + ToProto() (*otg.FlowDelay, error) + // ToPbText marshals FlowDelay to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowDelay to YAML text + ToYaml() (string, error) + // ToJson marshals FlowDelay to JSON text + ToJson() (string, error) +} + +type unMarshalflowDelay struct { + obj *flowDelay +} + +type unMarshalFlowDelay interface { + // FromProto unmarshals FlowDelay from protobuf object *otg.FlowDelay + FromProto(msg *otg.FlowDelay) (FlowDelay, error) + // FromPbText unmarshals FlowDelay from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowDelay from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowDelay from JSON text + FromJson(value string) error +} + +func (obj *flowDelay) Marshal() marshalFlowDelay { + if obj.marshaller == nil { + obj.marshaller = &marshalflowDelay{obj: obj} + } + return obj.marshaller +} + +func (obj *flowDelay) Unmarshal() unMarshalFlowDelay { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowDelay{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowDelay) ToProto() (*otg.FlowDelay, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowDelay) FromProto(msg *otg.FlowDelay) (FlowDelay, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowDelay) 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 *unMarshalflowDelay) 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 *marshalflowDelay) 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 *unMarshalflowDelay) 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 *marshalflowDelay) 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 *unMarshalflowDelay) 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 *flowDelay) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowDelay) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowDelay) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowDelay) Clone() (FlowDelay, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowDelay() + 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 +} + +// FlowDelay is the optional container to specify the delay before starting +// transmission of packets. +type FlowDelay interface { + Validation + // msg marshals FlowDelay to protobuf object *otg.FlowDelay + // and doesn't set defaults + msg() *otg.FlowDelay + // setMsg unmarshals FlowDelay from protobuf object *otg.FlowDelay + // and doesn't set defaults + setMsg(*otg.FlowDelay) FlowDelay + // provides marshal interface + Marshal() marshalFlowDelay + // provides unmarshal interface + Unmarshal() unMarshalFlowDelay + // validate validates FlowDelay + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowDelay, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowDelayChoiceEnum, set in FlowDelay + Choice() FlowDelayChoiceEnum + // setChoice assigns FlowDelayChoiceEnum provided by user to FlowDelay + setChoice(value FlowDelayChoiceEnum) FlowDelay + // HasChoice checks if Choice has been set in FlowDelay + HasChoice() bool + // Bytes returns float32, set in FlowDelay. + Bytes() float32 + // SetBytes assigns float32 provided by user to FlowDelay + SetBytes(value float32) FlowDelay + // HasBytes checks if Bytes has been set in FlowDelay + HasBytes() bool + // Nanoseconds returns float32, set in FlowDelay. + Nanoseconds() float32 + // SetNanoseconds assigns float32 provided by user to FlowDelay + SetNanoseconds(value float32) FlowDelay + // HasNanoseconds checks if Nanoseconds has been set in FlowDelay + HasNanoseconds() bool + // Microseconds returns float32, set in FlowDelay. + Microseconds() float32 + // SetMicroseconds assigns float32 provided by user to FlowDelay + SetMicroseconds(value float32) FlowDelay + // HasMicroseconds checks if Microseconds has been set in FlowDelay + HasMicroseconds() bool +} + +type FlowDelayChoiceEnum string + +// Enum of Choice on FlowDelay +var FlowDelayChoice = struct { + BYTES FlowDelayChoiceEnum + NANOSECONDS FlowDelayChoiceEnum + MICROSECONDS FlowDelayChoiceEnum +}{ + BYTES: FlowDelayChoiceEnum("bytes"), + NANOSECONDS: FlowDelayChoiceEnum("nanoseconds"), + MICROSECONDS: FlowDelayChoiceEnum("microseconds"), +} + +func (obj *flowDelay) Choice() FlowDelayChoiceEnum { + return FlowDelayChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowDelay) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowDelay) setChoice(value FlowDelayChoiceEnum) FlowDelay { + intValue, ok := otg.FlowDelay_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowDelayChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowDelay_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Microseconds = nil + obj.obj.Nanoseconds = nil + obj.obj.Bytes = nil + + if value == FlowDelayChoice.BYTES { + defaultValue := float32(0) + obj.obj.Bytes = &defaultValue + } + + if value == FlowDelayChoice.NANOSECONDS { + defaultValue := float32(0) + obj.obj.Nanoseconds = &defaultValue + } + + if value == FlowDelayChoice.MICROSECONDS { + defaultValue := float32(0) + obj.obj.Microseconds = &defaultValue + } + + return obj +} + +// The delay before starting transmission of packets. +// A value of 0 indicates no delay. +// Bytes returns a float32 +func (obj *flowDelay) Bytes() float32 { + + if obj.obj.Bytes == nil { + obj.setChoice(FlowDelayChoice.BYTES) + } + + return *obj.obj.Bytes + +} + +// The delay before starting transmission of packets. +// A value of 0 indicates no delay. +// Bytes returns a float32 +func (obj *flowDelay) HasBytes() bool { + return obj.obj.Bytes != nil +} + +// The delay before starting transmission of packets. +// A value of 0 indicates no delay. +// SetBytes sets the float32 value in the FlowDelay object +func (obj *flowDelay) SetBytes(value float32) FlowDelay { + obj.setChoice(FlowDelayChoice.BYTES) + obj.obj.Bytes = &value + return obj +} + +// The delay before starting transmission of packets. +// A value of 0 indicates no delay. +// Nanoseconds returns a float32 +func (obj *flowDelay) Nanoseconds() float32 { + + if obj.obj.Nanoseconds == nil { + obj.setChoice(FlowDelayChoice.NANOSECONDS) + } + + return *obj.obj.Nanoseconds + +} + +// The delay before starting transmission of packets. +// A value of 0 indicates no delay. +// Nanoseconds returns a float32 +func (obj *flowDelay) HasNanoseconds() bool { + return obj.obj.Nanoseconds != nil +} + +// The delay before starting transmission of packets. +// A value of 0 indicates no delay. +// SetNanoseconds sets the float32 value in the FlowDelay object +func (obj *flowDelay) SetNanoseconds(value float32) FlowDelay { + obj.setChoice(FlowDelayChoice.NANOSECONDS) + obj.obj.Nanoseconds = &value + return obj +} + +// The delay before starting transmission of packets. +// A value of 0 indicates no delay. +// Microseconds returns a float32 +func (obj *flowDelay) Microseconds() float32 { + + if obj.obj.Microseconds == nil { + obj.setChoice(FlowDelayChoice.MICROSECONDS) + } + + return *obj.obj.Microseconds + +} + +// The delay before starting transmission of packets. +// A value of 0 indicates no delay. +// Microseconds returns a float32 +func (obj *flowDelay) HasMicroseconds() bool { + return obj.obj.Microseconds != nil +} + +// The delay before starting transmission of packets. +// A value of 0 indicates no delay. +// SetMicroseconds sets the float32 value in the FlowDelay object +func (obj *flowDelay) SetMicroseconds(value float32) FlowDelay { + obj.setChoice(FlowDelayChoice.MICROSECONDS) + obj.obj.Microseconds = &value + return obj +} + +func (obj *flowDelay) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Bytes != nil { + + if *obj.obj.Bytes < 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowDelay.Bytes <= max(float32) but Got %f", *obj.obj.Bytes)) + } + + } + + if obj.obj.Nanoseconds != nil { + + if *obj.obj.Nanoseconds < 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowDelay.Nanoseconds <= max(float32) but Got %f", *obj.obj.Nanoseconds)) + } + + } + + if obj.obj.Microseconds != nil { + + if *obj.obj.Microseconds < 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowDelay.Microseconds <= max(float32) but Got %f", *obj.obj.Microseconds)) + } + + } + +} + +func (obj *flowDelay) setDefault() { + var choices_set int = 0 + var choice FlowDelayChoiceEnum + + if obj.obj.Bytes != nil { + choices_set += 1 + choice = FlowDelayChoice.BYTES + } + + if obj.obj.Nanoseconds != nil { + choices_set += 1 + choice = FlowDelayChoice.NANOSECONDS + } + + if obj.obj.Microseconds != nil { + choices_set += 1 + choice = FlowDelayChoice.MICROSECONDS + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowDelayChoice.BYTES) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowDelay") + } + } else { + intVal := otg.FlowDelay_Choice_Enum_value[string(choice)] + enumValue := otg.FlowDelay_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_duration.go b/gosnappi/flow_duration.go new file mode 100644 index 00000000..52437757 --- /dev/null +++ b/gosnappi/flow_duration.go @@ -0,0 +1,568 @@ +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" +) + +// ***** FlowDuration ***** +type flowDuration struct { + validation + obj *otg.FlowDuration + marshaller marshalFlowDuration + unMarshaller unMarshalFlowDuration + fixedPacketsHolder FlowFixedPackets + fixedSecondsHolder FlowFixedSeconds + burstHolder FlowBurst + continuousHolder FlowContinuous +} + +func NewFlowDuration() FlowDuration { + obj := flowDuration{obj: &otg.FlowDuration{}} + obj.setDefault() + return &obj +} + +func (obj *flowDuration) msg() *otg.FlowDuration { + return obj.obj +} + +func (obj *flowDuration) setMsg(msg *otg.FlowDuration) FlowDuration { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowDuration struct { + obj *flowDuration +} + +type marshalFlowDuration interface { + // ToProto marshals FlowDuration to protobuf object *otg.FlowDuration + ToProto() (*otg.FlowDuration, error) + // ToPbText marshals FlowDuration to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowDuration to YAML text + ToYaml() (string, error) + // ToJson marshals FlowDuration to JSON text + ToJson() (string, error) +} + +type unMarshalflowDuration struct { + obj *flowDuration +} + +type unMarshalFlowDuration interface { + // FromProto unmarshals FlowDuration from protobuf object *otg.FlowDuration + FromProto(msg *otg.FlowDuration) (FlowDuration, error) + // FromPbText unmarshals FlowDuration from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowDuration from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowDuration from JSON text + FromJson(value string) error +} + +func (obj *flowDuration) Marshal() marshalFlowDuration { + if obj.marshaller == nil { + obj.marshaller = &marshalflowDuration{obj: obj} + } + return obj.marshaller +} + +func (obj *flowDuration) Unmarshal() unMarshalFlowDuration { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowDuration{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowDuration) ToProto() (*otg.FlowDuration, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowDuration) FromProto(msg *otg.FlowDuration) (FlowDuration, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowDuration) 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 *unMarshalflowDuration) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowDuration) 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 *unMarshalflowDuration) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowDuration) 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 *unMarshalflowDuration) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowDuration) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowDuration) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowDuration) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowDuration) Clone() (FlowDuration, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowDuration() + 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 +} + +func (obj *flowDuration) setNil() { + obj.fixedPacketsHolder = nil + obj.fixedSecondsHolder = nil + obj.burstHolder = nil + obj.continuousHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowDuration is a container for different transmit durations. +type FlowDuration interface { + Validation + // msg marshals FlowDuration to protobuf object *otg.FlowDuration + // and doesn't set defaults + msg() *otg.FlowDuration + // setMsg unmarshals FlowDuration from protobuf object *otg.FlowDuration + // and doesn't set defaults + setMsg(*otg.FlowDuration) FlowDuration + // provides marshal interface + Marshal() marshalFlowDuration + // provides unmarshal interface + Unmarshal() unMarshalFlowDuration + // validate validates FlowDuration + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowDuration, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowDurationChoiceEnum, set in FlowDuration + Choice() FlowDurationChoiceEnum + // setChoice assigns FlowDurationChoiceEnum provided by user to FlowDuration + setChoice(value FlowDurationChoiceEnum) FlowDuration + // HasChoice checks if Choice has been set in FlowDuration + HasChoice() bool + // FixedPackets returns FlowFixedPackets, set in FlowDuration. + // FlowFixedPackets is transmit a fixed number of packets after which the flow will stop. + FixedPackets() FlowFixedPackets + // SetFixedPackets assigns FlowFixedPackets provided by user to FlowDuration. + // FlowFixedPackets is transmit a fixed number of packets after which the flow will stop. + SetFixedPackets(value FlowFixedPackets) FlowDuration + // HasFixedPackets checks if FixedPackets has been set in FlowDuration + HasFixedPackets() bool + // FixedSeconds returns FlowFixedSeconds, set in FlowDuration. + // FlowFixedSeconds is transmit for a fixed number of seconds after which the flow will stop. + FixedSeconds() FlowFixedSeconds + // SetFixedSeconds assigns FlowFixedSeconds provided by user to FlowDuration. + // FlowFixedSeconds is transmit for a fixed number of seconds after which the flow will stop. + SetFixedSeconds(value FlowFixedSeconds) FlowDuration + // HasFixedSeconds checks if FixedSeconds has been set in FlowDuration + HasFixedSeconds() bool + // Burst returns FlowBurst, set in FlowDuration. + // FlowBurst is transmits continuous or fixed burst of packets. + // For continuous burst of packets, it will not automatically stop. + // For fixed burst of packets, it will stop after transmitting fixed number of bursts. + Burst() FlowBurst + // SetBurst assigns FlowBurst provided by user to FlowDuration. + // FlowBurst is transmits continuous or fixed burst of packets. + // For continuous burst of packets, it will not automatically stop. + // For fixed burst of packets, it will stop after transmitting fixed number of bursts. + SetBurst(value FlowBurst) FlowDuration + // HasBurst checks if Burst has been set in FlowDuration + HasBurst() bool + // Continuous returns FlowContinuous, set in FlowDuration. + // FlowContinuous is transmit will be continuous and will not stop automatically. + Continuous() FlowContinuous + // SetContinuous assigns FlowContinuous provided by user to FlowDuration. + // FlowContinuous is transmit will be continuous and will not stop automatically. + SetContinuous(value FlowContinuous) FlowDuration + // HasContinuous checks if Continuous has been set in FlowDuration + HasContinuous() bool + setNil() +} + +type FlowDurationChoiceEnum string + +// Enum of Choice on FlowDuration +var FlowDurationChoice = struct { + FIXED_PACKETS FlowDurationChoiceEnum + FIXED_SECONDS FlowDurationChoiceEnum + BURST FlowDurationChoiceEnum + CONTINUOUS FlowDurationChoiceEnum +}{ + FIXED_PACKETS: FlowDurationChoiceEnum("fixed_packets"), + FIXED_SECONDS: FlowDurationChoiceEnum("fixed_seconds"), + BURST: FlowDurationChoiceEnum("burst"), + CONTINUOUS: FlowDurationChoiceEnum("continuous"), +} + +func (obj *flowDuration) Choice() FlowDurationChoiceEnum { + return FlowDurationChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// A choice used to determine the type of duration. +// Choice returns a string +func (obj *flowDuration) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowDuration) setChoice(value FlowDurationChoiceEnum) FlowDuration { + intValue, ok := otg.FlowDuration_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowDurationChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowDuration_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Continuous = nil + obj.continuousHolder = nil + obj.obj.Burst = nil + obj.burstHolder = nil + obj.obj.FixedSeconds = nil + obj.fixedSecondsHolder = nil + obj.obj.FixedPackets = nil + obj.fixedPacketsHolder = nil + + if value == FlowDurationChoice.FIXED_PACKETS { + obj.obj.FixedPackets = NewFlowFixedPackets().msg() + } + + if value == FlowDurationChoice.FIXED_SECONDS { + obj.obj.FixedSeconds = NewFlowFixedSeconds().msg() + } + + if value == FlowDurationChoice.BURST { + obj.obj.Burst = NewFlowBurst().msg() + } + + if value == FlowDurationChoice.CONTINUOUS { + obj.obj.Continuous = NewFlowContinuous().msg() + } + + return obj +} + +// description is TBD +// FixedPackets returns a FlowFixedPackets +func (obj *flowDuration) FixedPackets() FlowFixedPackets { + if obj.obj.FixedPackets == nil { + obj.setChoice(FlowDurationChoice.FIXED_PACKETS) + } + if obj.fixedPacketsHolder == nil { + obj.fixedPacketsHolder = &flowFixedPackets{obj: obj.obj.FixedPackets} + } + return obj.fixedPacketsHolder +} + +// description is TBD +// FixedPackets returns a FlowFixedPackets +func (obj *flowDuration) HasFixedPackets() bool { + return obj.obj.FixedPackets != nil +} + +// description is TBD +// SetFixedPackets sets the FlowFixedPackets value in the FlowDuration object +func (obj *flowDuration) SetFixedPackets(value FlowFixedPackets) FlowDuration { + obj.setChoice(FlowDurationChoice.FIXED_PACKETS) + obj.fixedPacketsHolder = nil + obj.obj.FixedPackets = value.msg() + + return obj +} + +// description is TBD +// FixedSeconds returns a FlowFixedSeconds +func (obj *flowDuration) FixedSeconds() FlowFixedSeconds { + if obj.obj.FixedSeconds == nil { + obj.setChoice(FlowDurationChoice.FIXED_SECONDS) + } + if obj.fixedSecondsHolder == nil { + obj.fixedSecondsHolder = &flowFixedSeconds{obj: obj.obj.FixedSeconds} + } + return obj.fixedSecondsHolder +} + +// description is TBD +// FixedSeconds returns a FlowFixedSeconds +func (obj *flowDuration) HasFixedSeconds() bool { + return obj.obj.FixedSeconds != nil +} + +// description is TBD +// SetFixedSeconds sets the FlowFixedSeconds value in the FlowDuration object +func (obj *flowDuration) SetFixedSeconds(value FlowFixedSeconds) FlowDuration { + obj.setChoice(FlowDurationChoice.FIXED_SECONDS) + obj.fixedSecondsHolder = nil + obj.obj.FixedSeconds = value.msg() + + return obj +} + +// description is TBD +// Burst returns a FlowBurst +func (obj *flowDuration) Burst() FlowBurst { + if obj.obj.Burst == nil { + obj.setChoice(FlowDurationChoice.BURST) + } + if obj.burstHolder == nil { + obj.burstHolder = &flowBurst{obj: obj.obj.Burst} + } + return obj.burstHolder +} + +// description is TBD +// Burst returns a FlowBurst +func (obj *flowDuration) HasBurst() bool { + return obj.obj.Burst != nil +} + +// description is TBD +// SetBurst sets the FlowBurst value in the FlowDuration object +func (obj *flowDuration) SetBurst(value FlowBurst) FlowDuration { + obj.setChoice(FlowDurationChoice.BURST) + obj.burstHolder = nil + obj.obj.Burst = value.msg() + + return obj +} + +// description is TBD +// Continuous returns a FlowContinuous +func (obj *flowDuration) Continuous() FlowContinuous { + if obj.obj.Continuous == nil { + obj.setChoice(FlowDurationChoice.CONTINUOUS) + } + if obj.continuousHolder == nil { + obj.continuousHolder = &flowContinuous{obj: obj.obj.Continuous} + } + return obj.continuousHolder +} + +// description is TBD +// Continuous returns a FlowContinuous +func (obj *flowDuration) HasContinuous() bool { + return obj.obj.Continuous != nil +} + +// description is TBD +// SetContinuous sets the FlowContinuous value in the FlowDuration object +func (obj *flowDuration) SetContinuous(value FlowContinuous) FlowDuration { + obj.setChoice(FlowDurationChoice.CONTINUOUS) + obj.continuousHolder = nil + obj.obj.Continuous = value.msg() + + return obj +} + +func (obj *flowDuration) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.FixedPackets != nil { + + obj.FixedPackets().validateObj(vObj, set_default) + } + + if obj.obj.FixedSeconds != nil { + + obj.FixedSeconds().validateObj(vObj, set_default) + } + + if obj.obj.Burst != nil { + + obj.Burst().validateObj(vObj, set_default) + } + + if obj.obj.Continuous != nil { + + obj.Continuous().validateObj(vObj, set_default) + } + +} + +func (obj *flowDuration) setDefault() { + var choices_set int = 0 + var choice FlowDurationChoiceEnum + + if obj.obj.FixedPackets != nil { + choices_set += 1 + choice = FlowDurationChoice.FIXED_PACKETS + } + + if obj.obj.FixedSeconds != nil { + choices_set += 1 + choice = FlowDurationChoice.FIXED_SECONDS + } + + if obj.obj.Burst != nil { + choices_set += 1 + choice = FlowDurationChoice.BURST + } + + if obj.obj.Continuous != nil { + choices_set += 1 + choice = FlowDurationChoice.CONTINUOUS + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowDurationChoice.CONTINUOUS) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowDuration") + } + } else { + intVal := otg.FlowDuration_Choice_Enum_value[string(choice)] + enumValue := otg.FlowDuration_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_duration_inter_burst_gap.go b/gosnappi/flow_duration_inter_burst_gap.go new file mode 100644 index 00000000..44a1b8e1 --- /dev/null +++ b/gosnappi/flow_duration_inter_burst_gap.go @@ -0,0 +1,507 @@ +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" +) + +// ***** FlowDurationInterBurstGap ***** +type flowDurationInterBurstGap struct { + validation + obj *otg.FlowDurationInterBurstGap + marshaller marshalFlowDurationInterBurstGap + unMarshaller unMarshalFlowDurationInterBurstGap +} + +func NewFlowDurationInterBurstGap() FlowDurationInterBurstGap { + obj := flowDurationInterBurstGap{obj: &otg.FlowDurationInterBurstGap{}} + obj.setDefault() + return &obj +} + +func (obj *flowDurationInterBurstGap) msg() *otg.FlowDurationInterBurstGap { + return obj.obj +} + +func (obj *flowDurationInterBurstGap) setMsg(msg *otg.FlowDurationInterBurstGap) FlowDurationInterBurstGap { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowDurationInterBurstGap struct { + obj *flowDurationInterBurstGap +} + +type marshalFlowDurationInterBurstGap interface { + // ToProto marshals FlowDurationInterBurstGap to protobuf object *otg.FlowDurationInterBurstGap + ToProto() (*otg.FlowDurationInterBurstGap, error) + // ToPbText marshals FlowDurationInterBurstGap to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowDurationInterBurstGap to YAML text + ToYaml() (string, error) + // ToJson marshals FlowDurationInterBurstGap to JSON text + ToJson() (string, error) +} + +type unMarshalflowDurationInterBurstGap struct { + obj *flowDurationInterBurstGap +} + +type unMarshalFlowDurationInterBurstGap interface { + // FromProto unmarshals FlowDurationInterBurstGap from protobuf object *otg.FlowDurationInterBurstGap + FromProto(msg *otg.FlowDurationInterBurstGap) (FlowDurationInterBurstGap, error) + // FromPbText unmarshals FlowDurationInterBurstGap from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowDurationInterBurstGap from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowDurationInterBurstGap from JSON text + FromJson(value string) error +} + +func (obj *flowDurationInterBurstGap) Marshal() marshalFlowDurationInterBurstGap { + if obj.marshaller == nil { + obj.marshaller = &marshalflowDurationInterBurstGap{obj: obj} + } + return obj.marshaller +} + +func (obj *flowDurationInterBurstGap) Unmarshal() unMarshalFlowDurationInterBurstGap { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowDurationInterBurstGap{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowDurationInterBurstGap) ToProto() (*otg.FlowDurationInterBurstGap, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowDurationInterBurstGap) FromProto(msg *otg.FlowDurationInterBurstGap) (FlowDurationInterBurstGap, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowDurationInterBurstGap) 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 *unMarshalflowDurationInterBurstGap) 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 *marshalflowDurationInterBurstGap) 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 *unMarshalflowDurationInterBurstGap) 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 *marshalflowDurationInterBurstGap) 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 *unMarshalflowDurationInterBurstGap) 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 *flowDurationInterBurstGap) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowDurationInterBurstGap) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowDurationInterBurstGap) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowDurationInterBurstGap) Clone() (FlowDurationInterBurstGap, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowDurationInterBurstGap() + 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 +} + +// FlowDurationInterBurstGap is the optional container for specifying a gap between bursts. +type FlowDurationInterBurstGap interface { + Validation + // msg marshals FlowDurationInterBurstGap to protobuf object *otg.FlowDurationInterBurstGap + // and doesn't set defaults + msg() *otg.FlowDurationInterBurstGap + // setMsg unmarshals FlowDurationInterBurstGap from protobuf object *otg.FlowDurationInterBurstGap + // and doesn't set defaults + setMsg(*otg.FlowDurationInterBurstGap) FlowDurationInterBurstGap + // provides marshal interface + Marshal() marshalFlowDurationInterBurstGap + // provides unmarshal interface + Unmarshal() unMarshalFlowDurationInterBurstGap + // validate validates FlowDurationInterBurstGap + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowDurationInterBurstGap, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowDurationInterBurstGapChoiceEnum, set in FlowDurationInterBurstGap + Choice() FlowDurationInterBurstGapChoiceEnum + // setChoice assigns FlowDurationInterBurstGapChoiceEnum provided by user to FlowDurationInterBurstGap + setChoice(value FlowDurationInterBurstGapChoiceEnum) FlowDurationInterBurstGap + // HasChoice checks if Choice has been set in FlowDurationInterBurstGap + HasChoice() bool + // Bytes returns float64, set in FlowDurationInterBurstGap. + Bytes() float64 + // SetBytes assigns float64 provided by user to FlowDurationInterBurstGap + SetBytes(value float64) FlowDurationInterBurstGap + // HasBytes checks if Bytes has been set in FlowDurationInterBurstGap + HasBytes() bool + // Nanoseconds returns float64, set in FlowDurationInterBurstGap. + Nanoseconds() float64 + // SetNanoseconds assigns float64 provided by user to FlowDurationInterBurstGap + SetNanoseconds(value float64) FlowDurationInterBurstGap + // HasNanoseconds checks if Nanoseconds has been set in FlowDurationInterBurstGap + HasNanoseconds() bool + // Microseconds returns float64, set in FlowDurationInterBurstGap. + Microseconds() float64 + // SetMicroseconds assigns float64 provided by user to FlowDurationInterBurstGap + SetMicroseconds(value float64) FlowDurationInterBurstGap + // HasMicroseconds checks if Microseconds has been set in FlowDurationInterBurstGap + HasMicroseconds() bool +} + +type FlowDurationInterBurstGapChoiceEnum string + +// Enum of Choice on FlowDurationInterBurstGap +var FlowDurationInterBurstGapChoice = struct { + BYTES FlowDurationInterBurstGapChoiceEnum + NANOSECONDS FlowDurationInterBurstGapChoiceEnum + MICROSECONDS FlowDurationInterBurstGapChoiceEnum +}{ + BYTES: FlowDurationInterBurstGapChoiceEnum("bytes"), + NANOSECONDS: FlowDurationInterBurstGapChoiceEnum("nanoseconds"), + MICROSECONDS: FlowDurationInterBurstGapChoiceEnum("microseconds"), +} + +func (obj *flowDurationInterBurstGap) Choice() FlowDurationInterBurstGapChoiceEnum { + return FlowDurationInterBurstGapChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The type of inter burst gap units. +// Choice returns a string +func (obj *flowDurationInterBurstGap) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowDurationInterBurstGap) setChoice(value FlowDurationInterBurstGapChoiceEnum) FlowDurationInterBurstGap { + intValue, ok := otg.FlowDurationInterBurstGap_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowDurationInterBurstGapChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowDurationInterBurstGap_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Microseconds = nil + obj.obj.Nanoseconds = nil + obj.obj.Bytes = nil + + if value == FlowDurationInterBurstGapChoice.BYTES { + defaultValue := float64(12) + obj.obj.Bytes = &defaultValue + } + + if value == FlowDurationInterBurstGapChoice.NANOSECONDS { + defaultValue := float64(96) + obj.obj.Nanoseconds = &defaultValue + } + + if value == FlowDurationInterBurstGapChoice.MICROSECONDS { + defaultValue := float64(0.096) + obj.obj.Microseconds = &defaultValue + } + + return obj +} + +// The amount of time between bursts expressed in bytes. +// A value of 0 indicates no gap between bursts. +// Bytes returns a float64 +func (obj *flowDurationInterBurstGap) Bytes() float64 { + + if obj.obj.Bytes == nil { + obj.setChoice(FlowDurationInterBurstGapChoice.BYTES) + } + + return *obj.obj.Bytes + +} + +// The amount of time between bursts expressed in bytes. +// A value of 0 indicates no gap between bursts. +// Bytes returns a float64 +func (obj *flowDurationInterBurstGap) HasBytes() bool { + return obj.obj.Bytes != nil +} + +// The amount of time between bursts expressed in bytes. +// A value of 0 indicates no gap between bursts. +// SetBytes sets the float64 value in the FlowDurationInterBurstGap object +func (obj *flowDurationInterBurstGap) SetBytes(value float64) FlowDurationInterBurstGap { + obj.setChoice(FlowDurationInterBurstGapChoice.BYTES) + obj.obj.Bytes = &value + return obj +} + +// The amount of time between bursts expressed in nanoseconds. +// A value of 0 indicates no gap between bursts. +// Nanoseconds returns a float64 +func (obj *flowDurationInterBurstGap) Nanoseconds() float64 { + + if obj.obj.Nanoseconds == nil { + obj.setChoice(FlowDurationInterBurstGapChoice.NANOSECONDS) + } + + return *obj.obj.Nanoseconds + +} + +// The amount of time between bursts expressed in nanoseconds. +// A value of 0 indicates no gap between bursts. +// Nanoseconds returns a float64 +func (obj *flowDurationInterBurstGap) HasNanoseconds() bool { + return obj.obj.Nanoseconds != nil +} + +// The amount of time between bursts expressed in nanoseconds. +// A value of 0 indicates no gap between bursts. +// SetNanoseconds sets the float64 value in the FlowDurationInterBurstGap object +func (obj *flowDurationInterBurstGap) SetNanoseconds(value float64) FlowDurationInterBurstGap { + obj.setChoice(FlowDurationInterBurstGapChoice.NANOSECONDS) + obj.obj.Nanoseconds = &value + return obj +} + +// The amount of time between bursts expressed in microseconds. +// A value of 0 indicates no gap between bursts. +// Microseconds returns a float64 +func (obj *flowDurationInterBurstGap) Microseconds() float64 { + + if obj.obj.Microseconds == nil { + obj.setChoice(FlowDurationInterBurstGapChoice.MICROSECONDS) + } + + return *obj.obj.Microseconds + +} + +// The amount of time between bursts expressed in microseconds. +// A value of 0 indicates no gap between bursts. +// Microseconds returns a float64 +func (obj *flowDurationInterBurstGap) HasMicroseconds() bool { + return obj.obj.Microseconds != nil +} + +// The amount of time between bursts expressed in microseconds. +// A value of 0 indicates no gap between bursts. +// SetMicroseconds sets the float64 value in the FlowDurationInterBurstGap object +func (obj *flowDurationInterBurstGap) SetMicroseconds(value float64) FlowDurationInterBurstGap { + obj.setChoice(FlowDurationInterBurstGapChoice.MICROSECONDS) + obj.obj.Microseconds = &value + return obj +} + +func (obj *flowDurationInterBurstGap) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Bytes != nil { + + if *obj.obj.Bytes < 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowDurationInterBurstGap.Bytes <= max(float64) but Got %f", *obj.obj.Bytes)) + } + + } + + if obj.obj.Nanoseconds != nil { + + if *obj.obj.Nanoseconds < 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowDurationInterBurstGap.Nanoseconds <= max(float64) but Got %f", *obj.obj.Nanoseconds)) + } + + } + + if obj.obj.Microseconds != nil { + + if *obj.obj.Microseconds < 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowDurationInterBurstGap.Microseconds <= max(float64) but Got %f", *obj.obj.Microseconds)) + } + + } + +} + +func (obj *flowDurationInterBurstGap) setDefault() { + var choices_set int = 0 + var choice FlowDurationInterBurstGapChoiceEnum + + if obj.obj.Bytes != nil { + choices_set += 1 + choice = FlowDurationInterBurstGapChoice.BYTES + } + + if obj.obj.Nanoseconds != nil { + choices_set += 1 + choice = FlowDurationInterBurstGapChoice.NANOSECONDS + } + + if obj.obj.Microseconds != nil { + choices_set += 1 + choice = FlowDurationInterBurstGapChoice.MICROSECONDS + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowDurationInterBurstGapChoice.BYTES) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowDurationInterBurstGap") + } + } else { + intVal := otg.FlowDurationInterBurstGap_Choice_Enum_value[string(choice)] + enumValue := otg.FlowDurationInterBurstGap_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_ethernet.go b/gosnappi/flow_ethernet.go new file mode 100644 index 00000000..b707b619 --- /dev/null +++ b/gosnappi/flow_ethernet.go @@ -0,0 +1,457 @@ +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" +) + +// ***** FlowEthernet ***** +type flowEthernet struct { + validation + obj *otg.FlowEthernet + marshaller marshalFlowEthernet + unMarshaller unMarshalFlowEthernet + dstHolder PatternFlowEthernetDst + srcHolder PatternFlowEthernetSrc + etherTypeHolder PatternFlowEthernetEtherType + pfcQueueHolder PatternFlowEthernetPfcQueue +} + +func NewFlowEthernet() FlowEthernet { + obj := flowEthernet{obj: &otg.FlowEthernet{}} + obj.setDefault() + return &obj +} + +func (obj *flowEthernet) msg() *otg.FlowEthernet { + return obj.obj +} + +func (obj *flowEthernet) setMsg(msg *otg.FlowEthernet) FlowEthernet { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowEthernet struct { + obj *flowEthernet +} + +type marshalFlowEthernet interface { + // ToProto marshals FlowEthernet to protobuf object *otg.FlowEthernet + ToProto() (*otg.FlowEthernet, error) + // ToPbText marshals FlowEthernet to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowEthernet to YAML text + ToYaml() (string, error) + // ToJson marshals FlowEthernet to JSON text + ToJson() (string, error) +} + +type unMarshalflowEthernet struct { + obj *flowEthernet +} + +type unMarshalFlowEthernet interface { + // FromProto unmarshals FlowEthernet from protobuf object *otg.FlowEthernet + FromProto(msg *otg.FlowEthernet) (FlowEthernet, error) + // FromPbText unmarshals FlowEthernet from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowEthernet from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowEthernet from JSON text + FromJson(value string) error +} + +func (obj *flowEthernet) Marshal() marshalFlowEthernet { + if obj.marshaller == nil { + obj.marshaller = &marshalflowEthernet{obj: obj} + } + return obj.marshaller +} + +func (obj *flowEthernet) Unmarshal() unMarshalFlowEthernet { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowEthernet{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowEthernet) ToProto() (*otg.FlowEthernet, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowEthernet) FromProto(msg *otg.FlowEthernet) (FlowEthernet, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowEthernet) 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 *unMarshalflowEthernet) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowEthernet) 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 *unMarshalflowEthernet) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowEthernet) 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 *unMarshalflowEthernet) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowEthernet) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowEthernet) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowEthernet) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowEthernet) Clone() (FlowEthernet, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowEthernet() + 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 +} + +func (obj *flowEthernet) setNil() { + obj.dstHolder = nil + obj.srcHolder = nil + obj.etherTypeHolder = nil + obj.pfcQueueHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowEthernet is ethernet packet header +type FlowEthernet interface { + Validation + // msg marshals FlowEthernet to protobuf object *otg.FlowEthernet + // and doesn't set defaults + msg() *otg.FlowEthernet + // setMsg unmarshals FlowEthernet from protobuf object *otg.FlowEthernet + // and doesn't set defaults + setMsg(*otg.FlowEthernet) FlowEthernet + // provides marshal interface + Marshal() marshalFlowEthernet + // provides unmarshal interface + Unmarshal() unMarshalFlowEthernet + // validate validates FlowEthernet + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowEthernet, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Dst returns PatternFlowEthernetDst, set in FlowEthernet. + // PatternFlowEthernetDst is destination MAC address + Dst() PatternFlowEthernetDst + // SetDst assigns PatternFlowEthernetDst provided by user to FlowEthernet. + // PatternFlowEthernetDst is destination MAC address + SetDst(value PatternFlowEthernetDst) FlowEthernet + // HasDst checks if Dst has been set in FlowEthernet + HasDst() bool + // Src returns PatternFlowEthernetSrc, set in FlowEthernet. + // PatternFlowEthernetSrc is source MAC address + Src() PatternFlowEthernetSrc + // SetSrc assigns PatternFlowEthernetSrc provided by user to FlowEthernet. + // PatternFlowEthernetSrc is source MAC address + SetSrc(value PatternFlowEthernetSrc) FlowEthernet + // HasSrc checks if Src has been set in FlowEthernet + HasSrc() bool + // EtherType returns PatternFlowEthernetEtherType, set in FlowEthernet. + // PatternFlowEthernetEtherType is ethernet type + EtherType() PatternFlowEthernetEtherType + // SetEtherType assigns PatternFlowEthernetEtherType provided by user to FlowEthernet. + // PatternFlowEthernetEtherType is ethernet type + SetEtherType(value PatternFlowEthernetEtherType) FlowEthernet + // HasEtherType checks if EtherType has been set in FlowEthernet + HasEtherType() bool + // PfcQueue returns PatternFlowEthernetPfcQueue, set in FlowEthernet. + // PatternFlowEthernetPfcQueue is priority flow control queue + PfcQueue() PatternFlowEthernetPfcQueue + // SetPfcQueue assigns PatternFlowEthernetPfcQueue provided by user to FlowEthernet. + // PatternFlowEthernetPfcQueue is priority flow control queue + SetPfcQueue(value PatternFlowEthernetPfcQueue) FlowEthernet + // HasPfcQueue checks if PfcQueue has been set in FlowEthernet + HasPfcQueue() bool + setNil() +} + +// description is TBD +// Dst returns a PatternFlowEthernetDst +func (obj *flowEthernet) Dst() PatternFlowEthernetDst { + if obj.obj.Dst == nil { + obj.obj.Dst = NewPatternFlowEthernetDst().msg() + } + if obj.dstHolder == nil { + obj.dstHolder = &patternFlowEthernetDst{obj: obj.obj.Dst} + } + return obj.dstHolder +} + +// description is TBD +// Dst returns a PatternFlowEthernetDst +func (obj *flowEthernet) HasDst() bool { + return obj.obj.Dst != nil +} + +// description is TBD +// SetDst sets the PatternFlowEthernetDst value in the FlowEthernet object +func (obj *flowEthernet) SetDst(value PatternFlowEthernetDst) FlowEthernet { + + obj.dstHolder = nil + obj.obj.Dst = value.msg() + + return obj +} + +// description is TBD +// Src returns a PatternFlowEthernetSrc +func (obj *flowEthernet) Src() PatternFlowEthernetSrc { + if obj.obj.Src == nil { + obj.obj.Src = NewPatternFlowEthernetSrc().msg() + } + if obj.srcHolder == nil { + obj.srcHolder = &patternFlowEthernetSrc{obj: obj.obj.Src} + } + return obj.srcHolder +} + +// description is TBD +// Src returns a PatternFlowEthernetSrc +func (obj *flowEthernet) HasSrc() bool { + return obj.obj.Src != nil +} + +// description is TBD +// SetSrc sets the PatternFlowEthernetSrc value in the FlowEthernet object +func (obj *flowEthernet) SetSrc(value PatternFlowEthernetSrc) FlowEthernet { + + obj.srcHolder = nil + obj.obj.Src = value.msg() + + return obj +} + +// description is TBD +// EtherType returns a PatternFlowEthernetEtherType +func (obj *flowEthernet) EtherType() PatternFlowEthernetEtherType { + if obj.obj.EtherType == nil { + obj.obj.EtherType = NewPatternFlowEthernetEtherType().msg() + } + if obj.etherTypeHolder == nil { + obj.etherTypeHolder = &patternFlowEthernetEtherType{obj: obj.obj.EtherType} + } + return obj.etherTypeHolder +} + +// description is TBD +// EtherType returns a PatternFlowEthernetEtherType +func (obj *flowEthernet) HasEtherType() bool { + return obj.obj.EtherType != nil +} + +// description is TBD +// SetEtherType sets the PatternFlowEthernetEtherType value in the FlowEthernet object +func (obj *flowEthernet) SetEtherType(value PatternFlowEthernetEtherType) FlowEthernet { + + obj.etherTypeHolder = nil + obj.obj.EtherType = value.msg() + + return obj +} + +// description is TBD +// PfcQueue returns a PatternFlowEthernetPfcQueue +func (obj *flowEthernet) PfcQueue() PatternFlowEthernetPfcQueue { + if obj.obj.PfcQueue == nil { + obj.obj.PfcQueue = NewPatternFlowEthernetPfcQueue().msg() + } + if obj.pfcQueueHolder == nil { + obj.pfcQueueHolder = &patternFlowEthernetPfcQueue{obj: obj.obj.PfcQueue} + } + return obj.pfcQueueHolder +} + +// description is TBD +// PfcQueue returns a PatternFlowEthernetPfcQueue +func (obj *flowEthernet) HasPfcQueue() bool { + return obj.obj.PfcQueue != nil +} + +// description is TBD +// SetPfcQueue sets the PatternFlowEthernetPfcQueue value in the FlowEthernet object +func (obj *flowEthernet) SetPfcQueue(value PatternFlowEthernetPfcQueue) FlowEthernet { + + obj.pfcQueueHolder = nil + obj.obj.PfcQueue = value.msg() + + return obj +} + +func (obj *flowEthernet) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Dst != nil { + + obj.Dst().validateObj(vObj, set_default) + } + + if obj.obj.Src != nil { + + obj.Src().validateObj(vObj, set_default) + } + + if obj.obj.EtherType != nil { + + obj.EtherType().validateObj(vObj, set_default) + } + + if obj.obj.PfcQueue != nil { + + obj.PfcQueue().validateObj(vObj, set_default) + } + +} + +func (obj *flowEthernet) setDefault() { + +} diff --git a/gosnappi/flow_ethernet_pause.go b/gosnappi/flow_ethernet_pause.go new file mode 100644 index 00000000..3c5022c7 --- /dev/null +++ b/gosnappi/flow_ethernet_pause.go @@ -0,0 +1,500 @@ +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" +) + +// ***** FlowEthernetPause ***** +type flowEthernetPause struct { + validation + obj *otg.FlowEthernetPause + marshaller marshalFlowEthernetPause + unMarshaller unMarshalFlowEthernetPause + dstHolder PatternFlowEthernetPauseDst + srcHolder PatternFlowEthernetPauseSrc + etherTypeHolder PatternFlowEthernetPauseEtherType + controlOpCodeHolder PatternFlowEthernetPauseControlOpCode + timeHolder PatternFlowEthernetPauseTime +} + +func NewFlowEthernetPause() FlowEthernetPause { + obj := flowEthernetPause{obj: &otg.FlowEthernetPause{}} + obj.setDefault() + return &obj +} + +func (obj *flowEthernetPause) msg() *otg.FlowEthernetPause { + return obj.obj +} + +func (obj *flowEthernetPause) setMsg(msg *otg.FlowEthernetPause) FlowEthernetPause { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowEthernetPause struct { + obj *flowEthernetPause +} + +type marshalFlowEthernetPause interface { + // ToProto marshals FlowEthernetPause to protobuf object *otg.FlowEthernetPause + ToProto() (*otg.FlowEthernetPause, error) + // ToPbText marshals FlowEthernetPause to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowEthernetPause to YAML text + ToYaml() (string, error) + // ToJson marshals FlowEthernetPause to JSON text + ToJson() (string, error) +} + +type unMarshalflowEthernetPause struct { + obj *flowEthernetPause +} + +type unMarshalFlowEthernetPause interface { + // FromProto unmarshals FlowEthernetPause from protobuf object *otg.FlowEthernetPause + FromProto(msg *otg.FlowEthernetPause) (FlowEthernetPause, error) + // FromPbText unmarshals FlowEthernetPause from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowEthernetPause from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowEthernetPause from JSON text + FromJson(value string) error +} + +func (obj *flowEthernetPause) Marshal() marshalFlowEthernetPause { + if obj.marshaller == nil { + obj.marshaller = &marshalflowEthernetPause{obj: obj} + } + return obj.marshaller +} + +func (obj *flowEthernetPause) Unmarshal() unMarshalFlowEthernetPause { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowEthernetPause{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowEthernetPause) ToProto() (*otg.FlowEthernetPause, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowEthernetPause) FromProto(msg *otg.FlowEthernetPause) (FlowEthernetPause, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowEthernetPause) 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 *unMarshalflowEthernetPause) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowEthernetPause) 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 *unMarshalflowEthernetPause) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowEthernetPause) 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 *unMarshalflowEthernetPause) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowEthernetPause) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowEthernetPause) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowEthernetPause) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowEthernetPause) Clone() (FlowEthernetPause, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowEthernetPause() + 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 +} + +func (obj *flowEthernetPause) setNil() { + obj.dstHolder = nil + obj.srcHolder = nil + obj.etherTypeHolder = nil + obj.controlOpCodeHolder = nil + obj.timeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowEthernetPause is iEEE 802.3x global ethernet pause packet header +type FlowEthernetPause interface { + Validation + // msg marshals FlowEthernetPause to protobuf object *otg.FlowEthernetPause + // and doesn't set defaults + msg() *otg.FlowEthernetPause + // setMsg unmarshals FlowEthernetPause from protobuf object *otg.FlowEthernetPause + // and doesn't set defaults + setMsg(*otg.FlowEthernetPause) FlowEthernetPause + // provides marshal interface + Marshal() marshalFlowEthernetPause + // provides unmarshal interface + Unmarshal() unMarshalFlowEthernetPause + // validate validates FlowEthernetPause + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowEthernetPause, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Dst returns PatternFlowEthernetPauseDst, set in FlowEthernetPause. + // PatternFlowEthernetPauseDst is destination MAC address + Dst() PatternFlowEthernetPauseDst + // SetDst assigns PatternFlowEthernetPauseDst provided by user to FlowEthernetPause. + // PatternFlowEthernetPauseDst is destination MAC address + SetDst(value PatternFlowEthernetPauseDst) FlowEthernetPause + // HasDst checks if Dst has been set in FlowEthernetPause + HasDst() bool + // Src returns PatternFlowEthernetPauseSrc, set in FlowEthernetPause. + // PatternFlowEthernetPauseSrc is source MAC address + Src() PatternFlowEthernetPauseSrc + // SetSrc assigns PatternFlowEthernetPauseSrc provided by user to FlowEthernetPause. + // PatternFlowEthernetPauseSrc is source MAC address + SetSrc(value PatternFlowEthernetPauseSrc) FlowEthernetPause + // HasSrc checks if Src has been set in FlowEthernetPause + HasSrc() bool + // EtherType returns PatternFlowEthernetPauseEtherType, set in FlowEthernetPause. + // PatternFlowEthernetPauseEtherType is ethernet type + EtherType() PatternFlowEthernetPauseEtherType + // SetEtherType assigns PatternFlowEthernetPauseEtherType provided by user to FlowEthernetPause. + // PatternFlowEthernetPauseEtherType is ethernet type + SetEtherType(value PatternFlowEthernetPauseEtherType) FlowEthernetPause + // HasEtherType checks if EtherType has been set in FlowEthernetPause + HasEtherType() bool + // ControlOpCode returns PatternFlowEthernetPauseControlOpCode, set in FlowEthernetPause. + // PatternFlowEthernetPauseControlOpCode is control operation code + ControlOpCode() PatternFlowEthernetPauseControlOpCode + // SetControlOpCode assigns PatternFlowEthernetPauseControlOpCode provided by user to FlowEthernetPause. + // PatternFlowEthernetPauseControlOpCode is control operation code + SetControlOpCode(value PatternFlowEthernetPauseControlOpCode) FlowEthernetPause + // HasControlOpCode checks if ControlOpCode has been set in FlowEthernetPause + HasControlOpCode() bool + // Time returns PatternFlowEthernetPauseTime, set in FlowEthernetPause. + // PatternFlowEthernetPauseTime is time + Time() PatternFlowEthernetPauseTime + // SetTime assigns PatternFlowEthernetPauseTime provided by user to FlowEthernetPause. + // PatternFlowEthernetPauseTime is time + SetTime(value PatternFlowEthernetPauseTime) FlowEthernetPause + // HasTime checks if Time has been set in FlowEthernetPause + HasTime() bool + setNil() +} + +// description is TBD +// Dst returns a PatternFlowEthernetPauseDst +func (obj *flowEthernetPause) Dst() PatternFlowEthernetPauseDst { + if obj.obj.Dst == nil { + obj.obj.Dst = NewPatternFlowEthernetPauseDst().msg() + } + if obj.dstHolder == nil { + obj.dstHolder = &patternFlowEthernetPauseDst{obj: obj.obj.Dst} + } + return obj.dstHolder +} + +// description is TBD +// Dst returns a PatternFlowEthernetPauseDst +func (obj *flowEthernetPause) HasDst() bool { + return obj.obj.Dst != nil +} + +// description is TBD +// SetDst sets the PatternFlowEthernetPauseDst value in the FlowEthernetPause object +func (obj *flowEthernetPause) SetDst(value PatternFlowEthernetPauseDst) FlowEthernetPause { + + obj.dstHolder = nil + obj.obj.Dst = value.msg() + + return obj +} + +// description is TBD +// Src returns a PatternFlowEthernetPauseSrc +func (obj *flowEthernetPause) Src() PatternFlowEthernetPauseSrc { + if obj.obj.Src == nil { + obj.obj.Src = NewPatternFlowEthernetPauseSrc().msg() + } + if obj.srcHolder == nil { + obj.srcHolder = &patternFlowEthernetPauseSrc{obj: obj.obj.Src} + } + return obj.srcHolder +} + +// description is TBD +// Src returns a PatternFlowEthernetPauseSrc +func (obj *flowEthernetPause) HasSrc() bool { + return obj.obj.Src != nil +} + +// description is TBD +// SetSrc sets the PatternFlowEthernetPauseSrc value in the FlowEthernetPause object +func (obj *flowEthernetPause) SetSrc(value PatternFlowEthernetPauseSrc) FlowEthernetPause { + + obj.srcHolder = nil + obj.obj.Src = value.msg() + + return obj +} + +// description is TBD +// EtherType returns a PatternFlowEthernetPauseEtherType +func (obj *flowEthernetPause) EtherType() PatternFlowEthernetPauseEtherType { + if obj.obj.EtherType == nil { + obj.obj.EtherType = NewPatternFlowEthernetPauseEtherType().msg() + } + if obj.etherTypeHolder == nil { + obj.etherTypeHolder = &patternFlowEthernetPauseEtherType{obj: obj.obj.EtherType} + } + return obj.etherTypeHolder +} + +// description is TBD +// EtherType returns a PatternFlowEthernetPauseEtherType +func (obj *flowEthernetPause) HasEtherType() bool { + return obj.obj.EtherType != nil +} + +// description is TBD +// SetEtherType sets the PatternFlowEthernetPauseEtherType value in the FlowEthernetPause object +func (obj *flowEthernetPause) SetEtherType(value PatternFlowEthernetPauseEtherType) FlowEthernetPause { + + obj.etherTypeHolder = nil + obj.obj.EtherType = value.msg() + + return obj +} + +// description is TBD +// ControlOpCode returns a PatternFlowEthernetPauseControlOpCode +func (obj *flowEthernetPause) ControlOpCode() PatternFlowEthernetPauseControlOpCode { + if obj.obj.ControlOpCode == nil { + obj.obj.ControlOpCode = NewPatternFlowEthernetPauseControlOpCode().msg() + } + if obj.controlOpCodeHolder == nil { + obj.controlOpCodeHolder = &patternFlowEthernetPauseControlOpCode{obj: obj.obj.ControlOpCode} + } + return obj.controlOpCodeHolder +} + +// description is TBD +// ControlOpCode returns a PatternFlowEthernetPauseControlOpCode +func (obj *flowEthernetPause) HasControlOpCode() bool { + return obj.obj.ControlOpCode != nil +} + +// description is TBD +// SetControlOpCode sets the PatternFlowEthernetPauseControlOpCode value in the FlowEthernetPause object +func (obj *flowEthernetPause) SetControlOpCode(value PatternFlowEthernetPauseControlOpCode) FlowEthernetPause { + + obj.controlOpCodeHolder = nil + obj.obj.ControlOpCode = value.msg() + + return obj +} + +// description is TBD +// Time returns a PatternFlowEthernetPauseTime +func (obj *flowEthernetPause) Time() PatternFlowEthernetPauseTime { + if obj.obj.Time == nil { + obj.obj.Time = NewPatternFlowEthernetPauseTime().msg() + } + if obj.timeHolder == nil { + obj.timeHolder = &patternFlowEthernetPauseTime{obj: obj.obj.Time} + } + return obj.timeHolder +} + +// description is TBD +// Time returns a PatternFlowEthernetPauseTime +func (obj *flowEthernetPause) HasTime() bool { + return obj.obj.Time != nil +} + +// description is TBD +// SetTime sets the PatternFlowEthernetPauseTime value in the FlowEthernetPause object +func (obj *flowEthernetPause) SetTime(value PatternFlowEthernetPauseTime) FlowEthernetPause { + + obj.timeHolder = nil + obj.obj.Time = value.msg() + + return obj +} + +func (obj *flowEthernetPause) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Dst != nil { + + obj.Dst().validateObj(vObj, set_default) + } + + if obj.obj.Src != nil { + + obj.Src().validateObj(vObj, set_default) + } + + if obj.obj.EtherType != nil { + + obj.EtherType().validateObj(vObj, set_default) + } + + if obj.obj.ControlOpCode != nil { + + obj.ControlOpCode().validateObj(vObj, set_default) + } + + if obj.obj.Time != nil { + + obj.Time().validateObj(vObj, set_default) + } + +} + +func (obj *flowEthernetPause) setDefault() { + +} diff --git a/gosnappi/flow_fixed_packets.go b/gosnappi/flow_fixed_packets.go new file mode 100644 index 00000000..2c394b88 --- /dev/null +++ b/gosnappi/flow_fixed_packets.go @@ -0,0 +1,402 @@ +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" +) + +// ***** FlowFixedPackets ***** +type flowFixedPackets struct { + validation + obj *otg.FlowFixedPackets + marshaller marshalFlowFixedPackets + unMarshaller unMarshalFlowFixedPackets + delayHolder FlowDelay +} + +func NewFlowFixedPackets() FlowFixedPackets { + obj := flowFixedPackets{obj: &otg.FlowFixedPackets{}} + obj.setDefault() + return &obj +} + +func (obj *flowFixedPackets) msg() *otg.FlowFixedPackets { + return obj.obj +} + +func (obj *flowFixedPackets) setMsg(msg *otg.FlowFixedPackets) FlowFixedPackets { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowFixedPackets struct { + obj *flowFixedPackets +} + +type marshalFlowFixedPackets interface { + // ToProto marshals FlowFixedPackets to protobuf object *otg.FlowFixedPackets + ToProto() (*otg.FlowFixedPackets, error) + // ToPbText marshals FlowFixedPackets to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowFixedPackets to YAML text + ToYaml() (string, error) + // ToJson marshals FlowFixedPackets to JSON text + ToJson() (string, error) +} + +type unMarshalflowFixedPackets struct { + obj *flowFixedPackets +} + +type unMarshalFlowFixedPackets interface { + // FromProto unmarshals FlowFixedPackets from protobuf object *otg.FlowFixedPackets + FromProto(msg *otg.FlowFixedPackets) (FlowFixedPackets, error) + // FromPbText unmarshals FlowFixedPackets from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowFixedPackets from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowFixedPackets from JSON text + FromJson(value string) error +} + +func (obj *flowFixedPackets) Marshal() marshalFlowFixedPackets { + if obj.marshaller == nil { + obj.marshaller = &marshalflowFixedPackets{obj: obj} + } + return obj.marshaller +} + +func (obj *flowFixedPackets) Unmarshal() unMarshalFlowFixedPackets { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowFixedPackets{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowFixedPackets) ToProto() (*otg.FlowFixedPackets, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowFixedPackets) FromProto(msg *otg.FlowFixedPackets) (FlowFixedPackets, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowFixedPackets) 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 *unMarshalflowFixedPackets) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowFixedPackets) 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 *unMarshalflowFixedPackets) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowFixedPackets) 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 *unMarshalflowFixedPackets) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowFixedPackets) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowFixedPackets) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowFixedPackets) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowFixedPackets) Clone() (FlowFixedPackets, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowFixedPackets() + 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 +} + +func (obj *flowFixedPackets) setNil() { + obj.delayHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowFixedPackets is transmit a fixed number of packets after which the flow will stop. +type FlowFixedPackets interface { + Validation + // msg marshals FlowFixedPackets to protobuf object *otg.FlowFixedPackets + // and doesn't set defaults + msg() *otg.FlowFixedPackets + // setMsg unmarshals FlowFixedPackets from protobuf object *otg.FlowFixedPackets + // and doesn't set defaults + setMsg(*otg.FlowFixedPackets) FlowFixedPackets + // provides marshal interface + Marshal() marshalFlowFixedPackets + // provides unmarshal interface + Unmarshal() unMarshalFlowFixedPackets + // validate validates FlowFixedPackets + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowFixedPackets, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Packets returns uint32, set in FlowFixedPackets. + Packets() uint32 + // SetPackets assigns uint32 provided by user to FlowFixedPackets + SetPackets(value uint32) FlowFixedPackets + // HasPackets checks if Packets has been set in FlowFixedPackets + HasPackets() bool + // Gap returns uint32, set in FlowFixedPackets. + Gap() uint32 + // SetGap assigns uint32 provided by user to FlowFixedPackets + SetGap(value uint32) FlowFixedPackets + // HasGap checks if Gap has been set in FlowFixedPackets + HasGap() bool + // Delay returns FlowDelay, set in FlowFixedPackets. + // FlowDelay is the optional container to specify the delay before starting + // transmission of packets. + Delay() FlowDelay + // SetDelay assigns FlowDelay provided by user to FlowFixedPackets. + // FlowDelay is the optional container to specify the delay before starting + // transmission of packets. + SetDelay(value FlowDelay) FlowFixedPackets + // HasDelay checks if Delay has been set in FlowFixedPackets + HasDelay() bool + setNil() +} + +// Stop transmit of the flow after this number of packets. +// Packets returns a uint32 +func (obj *flowFixedPackets) Packets() uint32 { + + return *obj.obj.Packets + +} + +// Stop transmit of the flow after this number of packets. +// Packets returns a uint32 +func (obj *flowFixedPackets) HasPackets() bool { + return obj.obj.Packets != nil +} + +// Stop transmit of the flow after this number of packets. +// SetPackets sets the uint32 value in the FlowFixedPackets object +func (obj *flowFixedPackets) SetPackets(value uint32) FlowFixedPackets { + + obj.obj.Packets = &value + return obj +} + +// The minimum gap between packets expressed as bytes. +// Gap returns a uint32 +func (obj *flowFixedPackets) Gap() uint32 { + + return *obj.obj.Gap + +} + +// The minimum gap between packets expressed as bytes. +// Gap returns a uint32 +func (obj *flowFixedPackets) HasGap() bool { + return obj.obj.Gap != nil +} + +// The minimum gap between packets expressed as bytes. +// SetGap sets the uint32 value in the FlowFixedPackets object +func (obj *flowFixedPackets) SetGap(value uint32) FlowFixedPackets { + + obj.obj.Gap = &value + return obj +} + +// description is TBD +// Delay returns a FlowDelay +func (obj *flowFixedPackets) Delay() FlowDelay { + if obj.obj.Delay == nil { + obj.obj.Delay = NewFlowDelay().msg() + } + if obj.delayHolder == nil { + obj.delayHolder = &flowDelay{obj: obj.obj.Delay} + } + return obj.delayHolder +} + +// description is TBD +// Delay returns a FlowDelay +func (obj *flowFixedPackets) HasDelay() bool { + return obj.obj.Delay != nil +} + +// description is TBD +// SetDelay sets the FlowDelay value in the FlowFixedPackets object +func (obj *flowFixedPackets) SetDelay(value FlowDelay) FlowFixedPackets { + + obj.delayHolder = nil + obj.obj.Delay = value.msg() + + return obj +} + +func (obj *flowFixedPackets) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Packets != nil { + + if *obj.obj.Packets < 1 || *obj.obj.Packets > 4294967295 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= FlowFixedPackets.Packets <= 4294967295 but Got %d", *obj.obj.Packets)) + } + + } + + if obj.obj.Delay != nil { + + obj.Delay().validateObj(vObj, set_default) + } + +} + +func (obj *flowFixedPackets) setDefault() { + if obj.obj.Packets == nil { + obj.SetPackets(1) + } + if obj.obj.Gap == nil { + obj.SetGap(12) + } + +} diff --git a/gosnappi/flow_fixed_seconds.go b/gosnappi/flow_fixed_seconds.go new file mode 100644 index 00000000..eeb2e2ba --- /dev/null +++ b/gosnappi/flow_fixed_seconds.go @@ -0,0 +1,402 @@ +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" +) + +// ***** FlowFixedSeconds ***** +type flowFixedSeconds struct { + validation + obj *otg.FlowFixedSeconds + marshaller marshalFlowFixedSeconds + unMarshaller unMarshalFlowFixedSeconds + delayHolder FlowDelay +} + +func NewFlowFixedSeconds() FlowFixedSeconds { + obj := flowFixedSeconds{obj: &otg.FlowFixedSeconds{}} + obj.setDefault() + return &obj +} + +func (obj *flowFixedSeconds) msg() *otg.FlowFixedSeconds { + return obj.obj +} + +func (obj *flowFixedSeconds) setMsg(msg *otg.FlowFixedSeconds) FlowFixedSeconds { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowFixedSeconds struct { + obj *flowFixedSeconds +} + +type marshalFlowFixedSeconds interface { + // ToProto marshals FlowFixedSeconds to protobuf object *otg.FlowFixedSeconds + ToProto() (*otg.FlowFixedSeconds, error) + // ToPbText marshals FlowFixedSeconds to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowFixedSeconds to YAML text + ToYaml() (string, error) + // ToJson marshals FlowFixedSeconds to JSON text + ToJson() (string, error) +} + +type unMarshalflowFixedSeconds struct { + obj *flowFixedSeconds +} + +type unMarshalFlowFixedSeconds interface { + // FromProto unmarshals FlowFixedSeconds from protobuf object *otg.FlowFixedSeconds + FromProto(msg *otg.FlowFixedSeconds) (FlowFixedSeconds, error) + // FromPbText unmarshals FlowFixedSeconds from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowFixedSeconds from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowFixedSeconds from JSON text + FromJson(value string) error +} + +func (obj *flowFixedSeconds) Marshal() marshalFlowFixedSeconds { + if obj.marshaller == nil { + obj.marshaller = &marshalflowFixedSeconds{obj: obj} + } + return obj.marshaller +} + +func (obj *flowFixedSeconds) Unmarshal() unMarshalFlowFixedSeconds { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowFixedSeconds{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowFixedSeconds) ToProto() (*otg.FlowFixedSeconds, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowFixedSeconds) FromProto(msg *otg.FlowFixedSeconds) (FlowFixedSeconds, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowFixedSeconds) 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 *unMarshalflowFixedSeconds) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowFixedSeconds) 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 *unMarshalflowFixedSeconds) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowFixedSeconds) 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 *unMarshalflowFixedSeconds) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowFixedSeconds) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowFixedSeconds) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowFixedSeconds) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowFixedSeconds) Clone() (FlowFixedSeconds, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowFixedSeconds() + 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 +} + +func (obj *flowFixedSeconds) setNil() { + obj.delayHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowFixedSeconds is transmit for a fixed number of seconds after which the flow will stop. +type FlowFixedSeconds interface { + Validation + // msg marshals FlowFixedSeconds to protobuf object *otg.FlowFixedSeconds + // and doesn't set defaults + msg() *otg.FlowFixedSeconds + // setMsg unmarshals FlowFixedSeconds from protobuf object *otg.FlowFixedSeconds + // and doesn't set defaults + setMsg(*otg.FlowFixedSeconds) FlowFixedSeconds + // provides marshal interface + Marshal() marshalFlowFixedSeconds + // provides unmarshal interface + Unmarshal() unMarshalFlowFixedSeconds + // validate validates FlowFixedSeconds + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowFixedSeconds, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Seconds returns float32, set in FlowFixedSeconds. + Seconds() float32 + // SetSeconds assigns float32 provided by user to FlowFixedSeconds + SetSeconds(value float32) FlowFixedSeconds + // HasSeconds checks if Seconds has been set in FlowFixedSeconds + HasSeconds() bool + // Gap returns uint32, set in FlowFixedSeconds. + Gap() uint32 + // SetGap assigns uint32 provided by user to FlowFixedSeconds + SetGap(value uint32) FlowFixedSeconds + // HasGap checks if Gap has been set in FlowFixedSeconds + HasGap() bool + // Delay returns FlowDelay, set in FlowFixedSeconds. + // FlowDelay is the optional container to specify the delay before starting + // transmission of packets. + Delay() FlowDelay + // SetDelay assigns FlowDelay provided by user to FlowFixedSeconds. + // FlowDelay is the optional container to specify the delay before starting + // transmission of packets. + SetDelay(value FlowDelay) FlowFixedSeconds + // HasDelay checks if Delay has been set in FlowFixedSeconds + HasDelay() bool + setNil() +} + +// Stop transmit of the flow after this number of seconds. +// Seconds returns a float32 +func (obj *flowFixedSeconds) Seconds() float32 { + + return *obj.obj.Seconds + +} + +// Stop transmit of the flow after this number of seconds. +// Seconds returns a float32 +func (obj *flowFixedSeconds) HasSeconds() bool { + return obj.obj.Seconds != nil +} + +// Stop transmit of the flow after this number of seconds. +// SetSeconds sets the float32 value in the FlowFixedSeconds object +func (obj *flowFixedSeconds) SetSeconds(value float32) FlowFixedSeconds { + + obj.obj.Seconds = &value + return obj +} + +// The minimum gap between packets expressed as bytes. +// Gap returns a uint32 +func (obj *flowFixedSeconds) Gap() uint32 { + + return *obj.obj.Gap + +} + +// The minimum gap between packets expressed as bytes. +// Gap returns a uint32 +func (obj *flowFixedSeconds) HasGap() bool { + return obj.obj.Gap != nil +} + +// The minimum gap between packets expressed as bytes. +// SetGap sets the uint32 value in the FlowFixedSeconds object +func (obj *flowFixedSeconds) SetGap(value uint32) FlowFixedSeconds { + + obj.obj.Gap = &value + return obj +} + +// description is TBD +// Delay returns a FlowDelay +func (obj *flowFixedSeconds) Delay() FlowDelay { + if obj.obj.Delay == nil { + obj.obj.Delay = NewFlowDelay().msg() + } + if obj.delayHolder == nil { + obj.delayHolder = &flowDelay{obj: obj.obj.Delay} + } + return obj.delayHolder +} + +// description is TBD +// Delay returns a FlowDelay +func (obj *flowFixedSeconds) HasDelay() bool { + return obj.obj.Delay != nil +} + +// description is TBD +// SetDelay sets the FlowDelay value in the FlowFixedSeconds object +func (obj *flowFixedSeconds) SetDelay(value FlowDelay) FlowFixedSeconds { + + obj.delayHolder = nil + obj.obj.Delay = value.msg() + + return obj +} + +func (obj *flowFixedSeconds) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Seconds != nil { + + if *obj.obj.Seconds < 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowFixedSeconds.Seconds <= max(float32) but Got %f", *obj.obj.Seconds)) + } + + } + + if obj.obj.Delay != nil { + + obj.Delay().validateObj(vObj, set_default) + } + +} + +func (obj *flowFixedSeconds) setDefault() { + if obj.obj.Seconds == nil { + obj.SetSeconds(1) + } + if obj.obj.Gap == nil { + obj.SetGap(12) + } + +} diff --git a/gosnappi/flow_gre.go b/gosnappi/flow_gre.go new file mode 100644 index 00000000..f41cb7e1 --- /dev/null +++ b/gosnappi/flow_gre.go @@ -0,0 +1,543 @@ +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" +) + +// ***** FlowGre ***** +type flowGre struct { + validation + obj *otg.FlowGre + marshaller marshalFlowGre + unMarshaller unMarshalFlowGre + checksumPresentHolder PatternFlowGreChecksumPresent + reserved0Holder PatternFlowGreReserved0 + versionHolder PatternFlowGreVersion + protocolHolder PatternFlowGreProtocol + checksumHolder PatternFlowGreChecksum + reserved1Holder PatternFlowGreReserved1 +} + +func NewFlowGre() FlowGre { + obj := flowGre{obj: &otg.FlowGre{}} + obj.setDefault() + return &obj +} + +func (obj *flowGre) msg() *otg.FlowGre { + return obj.obj +} + +func (obj *flowGre) setMsg(msg *otg.FlowGre) FlowGre { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowGre struct { + obj *flowGre +} + +type marshalFlowGre interface { + // ToProto marshals FlowGre to protobuf object *otg.FlowGre + ToProto() (*otg.FlowGre, error) + // ToPbText marshals FlowGre to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowGre to YAML text + ToYaml() (string, error) + // ToJson marshals FlowGre to JSON text + ToJson() (string, error) +} + +type unMarshalflowGre struct { + obj *flowGre +} + +type unMarshalFlowGre interface { + // FromProto unmarshals FlowGre from protobuf object *otg.FlowGre + FromProto(msg *otg.FlowGre) (FlowGre, error) + // FromPbText unmarshals FlowGre from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowGre from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowGre from JSON text + FromJson(value string) error +} + +func (obj *flowGre) Marshal() marshalFlowGre { + if obj.marshaller == nil { + obj.marshaller = &marshalflowGre{obj: obj} + } + return obj.marshaller +} + +func (obj *flowGre) Unmarshal() unMarshalFlowGre { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowGre{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowGre) ToProto() (*otg.FlowGre, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowGre) FromProto(msg *otg.FlowGre) (FlowGre, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowGre) 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 *unMarshalflowGre) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowGre) 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 *unMarshalflowGre) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowGre) 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 *unMarshalflowGre) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowGre) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowGre) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowGre) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowGre) Clone() (FlowGre, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowGre() + 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 +} + +func (obj *flowGre) setNil() { + obj.checksumPresentHolder = nil + obj.reserved0Holder = nil + obj.versionHolder = nil + obj.protocolHolder = nil + obj.checksumHolder = nil + obj.reserved1Holder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowGre is standard GRE packet header (RFC2784) +type FlowGre interface { + Validation + // msg marshals FlowGre to protobuf object *otg.FlowGre + // and doesn't set defaults + msg() *otg.FlowGre + // setMsg unmarshals FlowGre from protobuf object *otg.FlowGre + // and doesn't set defaults + setMsg(*otg.FlowGre) FlowGre + // provides marshal interface + Marshal() marshalFlowGre + // provides unmarshal interface + Unmarshal() unMarshalFlowGre + // validate validates FlowGre + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowGre, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ChecksumPresent returns PatternFlowGreChecksumPresent, set in FlowGre. + // PatternFlowGreChecksumPresent is checksum present bit + ChecksumPresent() PatternFlowGreChecksumPresent + // SetChecksumPresent assigns PatternFlowGreChecksumPresent provided by user to FlowGre. + // PatternFlowGreChecksumPresent is checksum present bit + SetChecksumPresent(value PatternFlowGreChecksumPresent) FlowGre + // HasChecksumPresent checks if ChecksumPresent has been set in FlowGre + HasChecksumPresent() bool + // Reserved0 returns PatternFlowGreReserved0, set in FlowGre. + // PatternFlowGreReserved0 is reserved bits + Reserved0() PatternFlowGreReserved0 + // SetReserved0 assigns PatternFlowGreReserved0 provided by user to FlowGre. + // PatternFlowGreReserved0 is reserved bits + SetReserved0(value PatternFlowGreReserved0) FlowGre + // HasReserved0 checks if Reserved0 has been set in FlowGre + HasReserved0() bool + // Version returns PatternFlowGreVersion, set in FlowGre. + // PatternFlowGreVersion is gRE version number + Version() PatternFlowGreVersion + // SetVersion assigns PatternFlowGreVersion provided by user to FlowGre. + // PatternFlowGreVersion is gRE version number + SetVersion(value PatternFlowGreVersion) FlowGre + // HasVersion checks if Version has been set in FlowGre + HasVersion() bool + // Protocol returns PatternFlowGreProtocol, set in FlowGre. + // PatternFlowGreProtocol is protocol type of encapsulated payload + Protocol() PatternFlowGreProtocol + // SetProtocol assigns PatternFlowGreProtocol provided by user to FlowGre. + // PatternFlowGreProtocol is protocol type of encapsulated payload + SetProtocol(value PatternFlowGreProtocol) FlowGre + // HasProtocol checks if Protocol has been set in FlowGre + HasProtocol() bool + // Checksum returns PatternFlowGreChecksum, set in FlowGre. + // PatternFlowGreChecksum is optional checksum of GRE header and payload. Only present if the checksum_present bit is set. + Checksum() PatternFlowGreChecksum + // SetChecksum assigns PatternFlowGreChecksum provided by user to FlowGre. + // PatternFlowGreChecksum is optional checksum of GRE header and payload. Only present if the checksum_present bit is set. + SetChecksum(value PatternFlowGreChecksum) FlowGre + // HasChecksum checks if Checksum has been set in FlowGre + HasChecksum() bool + // Reserved1 returns PatternFlowGreReserved1, set in FlowGre. + // PatternFlowGreReserved1 is optional reserved field. Only present if the checksum_present bit is set. + Reserved1() PatternFlowGreReserved1 + // SetReserved1 assigns PatternFlowGreReserved1 provided by user to FlowGre. + // PatternFlowGreReserved1 is optional reserved field. Only present if the checksum_present bit is set. + SetReserved1(value PatternFlowGreReserved1) FlowGre + // HasReserved1 checks if Reserved1 has been set in FlowGre + HasReserved1() bool + setNil() +} + +// description is TBD +// ChecksumPresent returns a PatternFlowGreChecksumPresent +func (obj *flowGre) ChecksumPresent() PatternFlowGreChecksumPresent { + if obj.obj.ChecksumPresent == nil { + obj.obj.ChecksumPresent = NewPatternFlowGreChecksumPresent().msg() + } + if obj.checksumPresentHolder == nil { + obj.checksumPresentHolder = &patternFlowGreChecksumPresent{obj: obj.obj.ChecksumPresent} + } + return obj.checksumPresentHolder +} + +// description is TBD +// ChecksumPresent returns a PatternFlowGreChecksumPresent +func (obj *flowGre) HasChecksumPresent() bool { + return obj.obj.ChecksumPresent != nil +} + +// description is TBD +// SetChecksumPresent sets the PatternFlowGreChecksumPresent value in the FlowGre object +func (obj *flowGre) SetChecksumPresent(value PatternFlowGreChecksumPresent) FlowGre { + + obj.checksumPresentHolder = nil + obj.obj.ChecksumPresent = value.msg() + + return obj +} + +// description is TBD +// Reserved0 returns a PatternFlowGreReserved0 +func (obj *flowGre) Reserved0() PatternFlowGreReserved0 { + if obj.obj.Reserved0 == nil { + obj.obj.Reserved0 = NewPatternFlowGreReserved0().msg() + } + if obj.reserved0Holder == nil { + obj.reserved0Holder = &patternFlowGreReserved0{obj: obj.obj.Reserved0} + } + return obj.reserved0Holder +} + +// description is TBD +// Reserved0 returns a PatternFlowGreReserved0 +func (obj *flowGre) HasReserved0() bool { + return obj.obj.Reserved0 != nil +} + +// description is TBD +// SetReserved0 sets the PatternFlowGreReserved0 value in the FlowGre object +func (obj *flowGre) SetReserved0(value PatternFlowGreReserved0) FlowGre { + + obj.reserved0Holder = nil + obj.obj.Reserved0 = value.msg() + + return obj +} + +// description is TBD +// Version returns a PatternFlowGreVersion +func (obj *flowGre) Version() PatternFlowGreVersion { + if obj.obj.Version == nil { + obj.obj.Version = NewPatternFlowGreVersion().msg() + } + if obj.versionHolder == nil { + obj.versionHolder = &patternFlowGreVersion{obj: obj.obj.Version} + } + return obj.versionHolder +} + +// description is TBD +// Version returns a PatternFlowGreVersion +func (obj *flowGre) HasVersion() bool { + return obj.obj.Version != nil +} + +// description is TBD +// SetVersion sets the PatternFlowGreVersion value in the FlowGre object +func (obj *flowGre) SetVersion(value PatternFlowGreVersion) FlowGre { + + obj.versionHolder = nil + obj.obj.Version = value.msg() + + return obj +} + +// description is TBD +// Protocol returns a PatternFlowGreProtocol +func (obj *flowGre) Protocol() PatternFlowGreProtocol { + if obj.obj.Protocol == nil { + obj.obj.Protocol = NewPatternFlowGreProtocol().msg() + } + if obj.protocolHolder == nil { + obj.protocolHolder = &patternFlowGreProtocol{obj: obj.obj.Protocol} + } + return obj.protocolHolder +} + +// description is TBD +// Protocol returns a PatternFlowGreProtocol +func (obj *flowGre) HasProtocol() bool { + return obj.obj.Protocol != nil +} + +// description is TBD +// SetProtocol sets the PatternFlowGreProtocol value in the FlowGre object +func (obj *flowGre) SetProtocol(value PatternFlowGreProtocol) FlowGre { + + obj.protocolHolder = nil + obj.obj.Protocol = value.msg() + + return obj +} + +// description is TBD +// Checksum returns a PatternFlowGreChecksum +func (obj *flowGre) Checksum() PatternFlowGreChecksum { + if obj.obj.Checksum == nil { + obj.obj.Checksum = NewPatternFlowGreChecksum().msg() + } + if obj.checksumHolder == nil { + obj.checksumHolder = &patternFlowGreChecksum{obj: obj.obj.Checksum} + } + return obj.checksumHolder +} + +// description is TBD +// Checksum returns a PatternFlowGreChecksum +func (obj *flowGre) HasChecksum() bool { + return obj.obj.Checksum != nil +} + +// description is TBD +// SetChecksum sets the PatternFlowGreChecksum value in the FlowGre object +func (obj *flowGre) SetChecksum(value PatternFlowGreChecksum) FlowGre { + + obj.checksumHolder = nil + obj.obj.Checksum = value.msg() + + return obj +} + +// description is TBD +// Reserved1 returns a PatternFlowGreReserved1 +func (obj *flowGre) Reserved1() PatternFlowGreReserved1 { + if obj.obj.Reserved1 == nil { + obj.obj.Reserved1 = NewPatternFlowGreReserved1().msg() + } + if obj.reserved1Holder == nil { + obj.reserved1Holder = &patternFlowGreReserved1{obj: obj.obj.Reserved1} + } + return obj.reserved1Holder +} + +// description is TBD +// Reserved1 returns a PatternFlowGreReserved1 +func (obj *flowGre) HasReserved1() bool { + return obj.obj.Reserved1 != nil +} + +// description is TBD +// SetReserved1 sets the PatternFlowGreReserved1 value in the FlowGre object +func (obj *flowGre) SetReserved1(value PatternFlowGreReserved1) FlowGre { + + obj.reserved1Holder = nil + obj.obj.Reserved1 = value.msg() + + return obj +} + +func (obj *flowGre) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.ChecksumPresent != nil { + + obj.ChecksumPresent().validateObj(vObj, set_default) + } + + if obj.obj.Reserved0 != nil { + + obj.Reserved0().validateObj(vObj, set_default) + } + + if obj.obj.Version != nil { + + obj.Version().validateObj(vObj, set_default) + } + + if obj.obj.Protocol != nil { + + obj.Protocol().validateObj(vObj, set_default) + } + + if obj.obj.Checksum != nil { + + obj.Checksum().validateObj(vObj, set_default) + } + + if obj.obj.Reserved1 != nil { + + obj.Reserved1().validateObj(vObj, set_default) + } + +} + +func (obj *flowGre) setDefault() { + +} diff --git a/gosnappi/flow_gtp_extension.go b/gosnappi/flow_gtp_extension.go new file mode 100644 index 00000000..4ec45d33 --- /dev/null +++ b/gosnappi/flow_gtp_extension.go @@ -0,0 +1,414 @@ +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" +) + +// ***** FlowGtpExtension ***** +type flowGtpExtension struct { + validation + obj *otg.FlowGtpExtension + marshaller marshalFlowGtpExtension + unMarshaller unMarshalFlowGtpExtension + extensionLengthHolder PatternFlowGtpExtensionExtensionLength + contentsHolder PatternFlowGtpExtensionContents + nextExtensionHeaderHolder PatternFlowGtpExtensionNextExtensionHeader +} + +func NewFlowGtpExtension() FlowGtpExtension { + obj := flowGtpExtension{obj: &otg.FlowGtpExtension{}} + obj.setDefault() + return &obj +} + +func (obj *flowGtpExtension) msg() *otg.FlowGtpExtension { + return obj.obj +} + +func (obj *flowGtpExtension) setMsg(msg *otg.FlowGtpExtension) FlowGtpExtension { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowGtpExtension struct { + obj *flowGtpExtension +} + +type marshalFlowGtpExtension interface { + // ToProto marshals FlowGtpExtension to protobuf object *otg.FlowGtpExtension + ToProto() (*otg.FlowGtpExtension, error) + // ToPbText marshals FlowGtpExtension to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowGtpExtension to YAML text + ToYaml() (string, error) + // ToJson marshals FlowGtpExtension to JSON text + ToJson() (string, error) +} + +type unMarshalflowGtpExtension struct { + obj *flowGtpExtension +} + +type unMarshalFlowGtpExtension interface { + // FromProto unmarshals FlowGtpExtension from protobuf object *otg.FlowGtpExtension + FromProto(msg *otg.FlowGtpExtension) (FlowGtpExtension, error) + // FromPbText unmarshals FlowGtpExtension from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowGtpExtension from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowGtpExtension from JSON text + FromJson(value string) error +} + +func (obj *flowGtpExtension) Marshal() marshalFlowGtpExtension { + if obj.marshaller == nil { + obj.marshaller = &marshalflowGtpExtension{obj: obj} + } + return obj.marshaller +} + +func (obj *flowGtpExtension) Unmarshal() unMarshalFlowGtpExtension { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowGtpExtension{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowGtpExtension) ToProto() (*otg.FlowGtpExtension, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowGtpExtension) FromProto(msg *otg.FlowGtpExtension) (FlowGtpExtension, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowGtpExtension) 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 *unMarshalflowGtpExtension) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowGtpExtension) 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 *unMarshalflowGtpExtension) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowGtpExtension) 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 *unMarshalflowGtpExtension) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowGtpExtension) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowGtpExtension) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowGtpExtension) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowGtpExtension) Clone() (FlowGtpExtension, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowGtpExtension() + 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 +} + +func (obj *flowGtpExtension) setNil() { + obj.extensionLengthHolder = nil + obj.contentsHolder = nil + obj.nextExtensionHeaderHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowGtpExtension is description is TBD +type FlowGtpExtension interface { + Validation + // msg marshals FlowGtpExtension to protobuf object *otg.FlowGtpExtension + // and doesn't set defaults + msg() *otg.FlowGtpExtension + // setMsg unmarshals FlowGtpExtension from protobuf object *otg.FlowGtpExtension + // and doesn't set defaults + setMsg(*otg.FlowGtpExtension) FlowGtpExtension + // provides marshal interface + Marshal() marshalFlowGtpExtension + // provides unmarshal interface + Unmarshal() unMarshalFlowGtpExtension + // validate validates FlowGtpExtension + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowGtpExtension, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ExtensionLength returns PatternFlowGtpExtensionExtensionLength, set in FlowGtpExtension. + // PatternFlowGtpExtensionExtensionLength is this field states the length of this extension header, including the length, the contents, and the next extension header field, in 4-octet units, so the length of the extension must always be a multiple of 4. + ExtensionLength() PatternFlowGtpExtensionExtensionLength + // SetExtensionLength assigns PatternFlowGtpExtensionExtensionLength provided by user to FlowGtpExtension. + // PatternFlowGtpExtensionExtensionLength is this field states the length of this extension header, including the length, the contents, and the next extension header field, in 4-octet units, so the length of the extension must always be a multiple of 4. + SetExtensionLength(value PatternFlowGtpExtensionExtensionLength) FlowGtpExtension + // HasExtensionLength checks if ExtensionLength has been set in FlowGtpExtension + HasExtensionLength() bool + // Contents returns PatternFlowGtpExtensionContents, set in FlowGtpExtension. + // PatternFlowGtpExtensionContents is the extension header contents + Contents() PatternFlowGtpExtensionContents + // SetContents assigns PatternFlowGtpExtensionContents provided by user to FlowGtpExtension. + // PatternFlowGtpExtensionContents is the extension header contents + SetContents(value PatternFlowGtpExtensionContents) FlowGtpExtension + // HasContents checks if Contents has been set in FlowGtpExtension + HasContents() bool + // NextExtensionHeader returns PatternFlowGtpExtensionNextExtensionHeader, set in FlowGtpExtension. + // PatternFlowGtpExtensionNextExtensionHeader is it states the type of the next extension, or 0 if no next extension exists. This permits chaining several next extension headers. + NextExtensionHeader() PatternFlowGtpExtensionNextExtensionHeader + // SetNextExtensionHeader assigns PatternFlowGtpExtensionNextExtensionHeader provided by user to FlowGtpExtension. + // PatternFlowGtpExtensionNextExtensionHeader is it states the type of the next extension, or 0 if no next extension exists. This permits chaining several next extension headers. + SetNextExtensionHeader(value PatternFlowGtpExtensionNextExtensionHeader) FlowGtpExtension + // HasNextExtensionHeader checks if NextExtensionHeader has been set in FlowGtpExtension + HasNextExtensionHeader() bool + setNil() +} + +// description is TBD +// ExtensionLength returns a PatternFlowGtpExtensionExtensionLength +func (obj *flowGtpExtension) ExtensionLength() PatternFlowGtpExtensionExtensionLength { + if obj.obj.ExtensionLength == nil { + obj.obj.ExtensionLength = NewPatternFlowGtpExtensionExtensionLength().msg() + } + if obj.extensionLengthHolder == nil { + obj.extensionLengthHolder = &patternFlowGtpExtensionExtensionLength{obj: obj.obj.ExtensionLength} + } + return obj.extensionLengthHolder +} + +// description is TBD +// ExtensionLength returns a PatternFlowGtpExtensionExtensionLength +func (obj *flowGtpExtension) HasExtensionLength() bool { + return obj.obj.ExtensionLength != nil +} + +// description is TBD +// SetExtensionLength sets the PatternFlowGtpExtensionExtensionLength value in the FlowGtpExtension object +func (obj *flowGtpExtension) SetExtensionLength(value PatternFlowGtpExtensionExtensionLength) FlowGtpExtension { + + obj.extensionLengthHolder = nil + obj.obj.ExtensionLength = value.msg() + + return obj +} + +// description is TBD +// Contents returns a PatternFlowGtpExtensionContents +func (obj *flowGtpExtension) Contents() PatternFlowGtpExtensionContents { + if obj.obj.Contents == nil { + obj.obj.Contents = NewPatternFlowGtpExtensionContents().msg() + } + if obj.contentsHolder == nil { + obj.contentsHolder = &patternFlowGtpExtensionContents{obj: obj.obj.Contents} + } + return obj.contentsHolder +} + +// description is TBD +// Contents returns a PatternFlowGtpExtensionContents +func (obj *flowGtpExtension) HasContents() bool { + return obj.obj.Contents != nil +} + +// description is TBD +// SetContents sets the PatternFlowGtpExtensionContents value in the FlowGtpExtension object +func (obj *flowGtpExtension) SetContents(value PatternFlowGtpExtensionContents) FlowGtpExtension { + + obj.contentsHolder = nil + obj.obj.Contents = value.msg() + + return obj +} + +// description is TBD +// NextExtensionHeader returns a PatternFlowGtpExtensionNextExtensionHeader +func (obj *flowGtpExtension) NextExtensionHeader() PatternFlowGtpExtensionNextExtensionHeader { + if obj.obj.NextExtensionHeader == nil { + obj.obj.NextExtensionHeader = NewPatternFlowGtpExtensionNextExtensionHeader().msg() + } + if obj.nextExtensionHeaderHolder == nil { + obj.nextExtensionHeaderHolder = &patternFlowGtpExtensionNextExtensionHeader{obj: obj.obj.NextExtensionHeader} + } + return obj.nextExtensionHeaderHolder +} + +// description is TBD +// NextExtensionHeader returns a PatternFlowGtpExtensionNextExtensionHeader +func (obj *flowGtpExtension) HasNextExtensionHeader() bool { + return obj.obj.NextExtensionHeader != nil +} + +// description is TBD +// SetNextExtensionHeader sets the PatternFlowGtpExtensionNextExtensionHeader value in the FlowGtpExtension object +func (obj *flowGtpExtension) SetNextExtensionHeader(value PatternFlowGtpExtensionNextExtensionHeader) FlowGtpExtension { + + obj.nextExtensionHeaderHolder = nil + obj.obj.NextExtensionHeader = value.msg() + + return obj +} + +func (obj *flowGtpExtension) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.ExtensionLength != nil { + + obj.ExtensionLength().validateObj(vObj, set_default) + } + + if obj.obj.Contents != nil { + + obj.Contents().validateObj(vObj, set_default) + } + + if obj.obj.NextExtensionHeader != nil { + + obj.NextExtensionHeader().validateObj(vObj, set_default) + } + +} + +func (obj *flowGtpExtension) setDefault() { + +} diff --git a/gosnappi/flow_gtpv1.go b/gosnappi/flow_gtpv1.go new file mode 100644 index 00000000..d0d18374 --- /dev/null +++ b/gosnappi/flow_gtpv1.go @@ -0,0 +1,906 @@ +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" +) + +// ***** FlowGtpv1 ***** +type flowGtpv1 struct { + validation + obj *otg.FlowGtpv1 + marshaller marshalFlowGtpv1 + unMarshaller unMarshalFlowGtpv1 + versionHolder PatternFlowGtpv1Version + protocolTypeHolder PatternFlowGtpv1ProtocolType + reservedHolder PatternFlowGtpv1Reserved + eFlagHolder PatternFlowGtpv1EFlag + sFlagHolder PatternFlowGtpv1SFlag + pnFlagHolder PatternFlowGtpv1PnFlag + messageTypeHolder PatternFlowGtpv1MessageType + messageLengthHolder PatternFlowGtpv1MessageLength + teidHolder PatternFlowGtpv1Teid + squenceNumberHolder PatternFlowGtpv1SquenceNumber + nPduNumberHolder PatternFlowGtpv1NPduNumber + nextExtensionHeaderTypeHolder PatternFlowGtpv1NextExtensionHeaderType + extensionHeadersHolder FlowGtpv1FlowGtpExtensionIter +} + +func NewFlowGtpv1() FlowGtpv1 { + obj := flowGtpv1{obj: &otg.FlowGtpv1{}} + obj.setDefault() + return &obj +} + +func (obj *flowGtpv1) msg() *otg.FlowGtpv1 { + return obj.obj +} + +func (obj *flowGtpv1) setMsg(msg *otg.FlowGtpv1) FlowGtpv1 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowGtpv1 struct { + obj *flowGtpv1 +} + +type marshalFlowGtpv1 interface { + // ToProto marshals FlowGtpv1 to protobuf object *otg.FlowGtpv1 + ToProto() (*otg.FlowGtpv1, error) + // ToPbText marshals FlowGtpv1 to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowGtpv1 to YAML text + ToYaml() (string, error) + // ToJson marshals FlowGtpv1 to JSON text + ToJson() (string, error) +} + +type unMarshalflowGtpv1 struct { + obj *flowGtpv1 +} + +type unMarshalFlowGtpv1 interface { + // FromProto unmarshals FlowGtpv1 from protobuf object *otg.FlowGtpv1 + FromProto(msg *otg.FlowGtpv1) (FlowGtpv1, error) + // FromPbText unmarshals FlowGtpv1 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowGtpv1 from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowGtpv1 from JSON text + FromJson(value string) error +} + +func (obj *flowGtpv1) Marshal() marshalFlowGtpv1 { + if obj.marshaller == nil { + obj.marshaller = &marshalflowGtpv1{obj: obj} + } + return obj.marshaller +} + +func (obj *flowGtpv1) Unmarshal() unMarshalFlowGtpv1 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowGtpv1{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowGtpv1) ToProto() (*otg.FlowGtpv1, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowGtpv1) FromProto(msg *otg.FlowGtpv1) (FlowGtpv1, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowGtpv1) 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 *unMarshalflowGtpv1) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowGtpv1) 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 *unMarshalflowGtpv1) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowGtpv1) 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 *unMarshalflowGtpv1) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowGtpv1) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowGtpv1) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowGtpv1) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowGtpv1) Clone() (FlowGtpv1, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowGtpv1() + 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 +} + +func (obj *flowGtpv1) setNil() { + obj.versionHolder = nil + obj.protocolTypeHolder = nil + obj.reservedHolder = nil + obj.eFlagHolder = nil + obj.sFlagHolder = nil + obj.pnFlagHolder = nil + obj.messageTypeHolder = nil + obj.messageLengthHolder = nil + obj.teidHolder = nil + obj.squenceNumberHolder = nil + obj.nPduNumberHolder = nil + obj.nextExtensionHeaderTypeHolder = nil + obj.extensionHeadersHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowGtpv1 is gTPv1 packet header +type FlowGtpv1 interface { + Validation + // msg marshals FlowGtpv1 to protobuf object *otg.FlowGtpv1 + // and doesn't set defaults + msg() *otg.FlowGtpv1 + // setMsg unmarshals FlowGtpv1 from protobuf object *otg.FlowGtpv1 + // and doesn't set defaults + setMsg(*otg.FlowGtpv1) FlowGtpv1 + // provides marshal interface + Marshal() marshalFlowGtpv1 + // provides unmarshal interface + Unmarshal() unMarshalFlowGtpv1 + // validate validates FlowGtpv1 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowGtpv1, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Version returns PatternFlowGtpv1Version, set in FlowGtpv1. + // PatternFlowGtpv1Version is gTPv1 version + Version() PatternFlowGtpv1Version + // SetVersion assigns PatternFlowGtpv1Version provided by user to FlowGtpv1. + // PatternFlowGtpv1Version is gTPv1 version + SetVersion(value PatternFlowGtpv1Version) FlowGtpv1 + // HasVersion checks if Version has been set in FlowGtpv1 + HasVersion() bool + // ProtocolType returns PatternFlowGtpv1ProtocolType, set in FlowGtpv1. + // PatternFlowGtpv1ProtocolType is protocol type, GTP is 1, GTP' is 0 + ProtocolType() PatternFlowGtpv1ProtocolType + // SetProtocolType assigns PatternFlowGtpv1ProtocolType provided by user to FlowGtpv1. + // PatternFlowGtpv1ProtocolType is protocol type, GTP is 1, GTP' is 0 + SetProtocolType(value PatternFlowGtpv1ProtocolType) FlowGtpv1 + // HasProtocolType checks if ProtocolType has been set in FlowGtpv1 + HasProtocolType() bool + // Reserved returns PatternFlowGtpv1Reserved, set in FlowGtpv1. + // PatternFlowGtpv1Reserved is reserved field + Reserved() PatternFlowGtpv1Reserved + // SetReserved assigns PatternFlowGtpv1Reserved provided by user to FlowGtpv1. + // PatternFlowGtpv1Reserved is reserved field + SetReserved(value PatternFlowGtpv1Reserved) FlowGtpv1 + // HasReserved checks if Reserved has been set in FlowGtpv1 + HasReserved() bool + // EFlag returns PatternFlowGtpv1EFlag, set in FlowGtpv1. + // PatternFlowGtpv1EFlag is extension header field present + EFlag() PatternFlowGtpv1EFlag + // SetEFlag assigns PatternFlowGtpv1EFlag provided by user to FlowGtpv1. + // PatternFlowGtpv1EFlag is extension header field present + SetEFlag(value PatternFlowGtpv1EFlag) FlowGtpv1 + // HasEFlag checks if EFlag has been set in FlowGtpv1 + HasEFlag() bool + // SFlag returns PatternFlowGtpv1SFlag, set in FlowGtpv1. + // PatternFlowGtpv1SFlag is sequence number field present + SFlag() PatternFlowGtpv1SFlag + // SetSFlag assigns PatternFlowGtpv1SFlag provided by user to FlowGtpv1. + // PatternFlowGtpv1SFlag is sequence number field present + SetSFlag(value PatternFlowGtpv1SFlag) FlowGtpv1 + // HasSFlag checks if SFlag has been set in FlowGtpv1 + HasSFlag() bool + // PnFlag returns PatternFlowGtpv1PnFlag, set in FlowGtpv1. + // PatternFlowGtpv1PnFlag is n-PDU field present + PnFlag() PatternFlowGtpv1PnFlag + // SetPnFlag assigns PatternFlowGtpv1PnFlag provided by user to FlowGtpv1. + // PatternFlowGtpv1PnFlag is n-PDU field present + SetPnFlag(value PatternFlowGtpv1PnFlag) FlowGtpv1 + // HasPnFlag checks if PnFlag has been set in FlowGtpv1 + HasPnFlag() bool + // MessageType returns PatternFlowGtpv1MessageType, set in FlowGtpv1. + // PatternFlowGtpv1MessageType is the type of GTP message Different types of messages are defined in 3GPP TS 29.060 section 7.1 + MessageType() PatternFlowGtpv1MessageType + // SetMessageType assigns PatternFlowGtpv1MessageType provided by user to FlowGtpv1. + // PatternFlowGtpv1MessageType is the type of GTP message Different types of messages are defined in 3GPP TS 29.060 section 7.1 + SetMessageType(value PatternFlowGtpv1MessageType) FlowGtpv1 + // HasMessageType checks if MessageType has been set in FlowGtpv1 + HasMessageType() bool + // MessageLength returns PatternFlowGtpv1MessageLength, set in FlowGtpv1. + // PatternFlowGtpv1MessageLength is the length of the payload (the bytes following the mandatory 8-byte GTP header) in bytes that includes any optional fields + MessageLength() PatternFlowGtpv1MessageLength + // SetMessageLength assigns PatternFlowGtpv1MessageLength provided by user to FlowGtpv1. + // PatternFlowGtpv1MessageLength is the length of the payload (the bytes following the mandatory 8-byte GTP header) in bytes that includes any optional fields + SetMessageLength(value PatternFlowGtpv1MessageLength) FlowGtpv1 + // HasMessageLength checks if MessageLength has been set in FlowGtpv1 + HasMessageLength() bool + // Teid returns PatternFlowGtpv1Teid, set in FlowGtpv1. + // PatternFlowGtpv1Teid is tunnel endpoint identifier (TEID) used to multiplex connections in the same GTP tunnel + Teid() PatternFlowGtpv1Teid + // SetTeid assigns PatternFlowGtpv1Teid provided by user to FlowGtpv1. + // PatternFlowGtpv1Teid is tunnel endpoint identifier (TEID) used to multiplex connections in the same GTP tunnel + SetTeid(value PatternFlowGtpv1Teid) FlowGtpv1 + // HasTeid checks if Teid has been set in FlowGtpv1 + HasTeid() bool + // SquenceNumber returns PatternFlowGtpv1SquenceNumber, set in FlowGtpv1. + // PatternFlowGtpv1SquenceNumber is sequence number. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the s_flag bit is on. + SquenceNumber() PatternFlowGtpv1SquenceNumber + // SetSquenceNumber assigns PatternFlowGtpv1SquenceNumber provided by user to FlowGtpv1. + // PatternFlowGtpv1SquenceNumber is sequence number. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the s_flag bit is on. + SetSquenceNumber(value PatternFlowGtpv1SquenceNumber) FlowGtpv1 + // HasSquenceNumber checks if SquenceNumber has been set in FlowGtpv1 + HasSquenceNumber() bool + // NPduNumber returns PatternFlowGtpv1NPduNumber, set in FlowGtpv1. + // PatternFlowGtpv1NPduNumber is n-PDU number. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the pn_flag bit is on. + NPduNumber() PatternFlowGtpv1NPduNumber + // SetNPduNumber assigns PatternFlowGtpv1NPduNumber provided by user to FlowGtpv1. + // PatternFlowGtpv1NPduNumber is n-PDU number. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the pn_flag bit is on. + SetNPduNumber(value PatternFlowGtpv1NPduNumber) FlowGtpv1 + // HasNPduNumber checks if NPduNumber has been set in FlowGtpv1 + HasNPduNumber() bool + // NextExtensionHeaderType returns PatternFlowGtpv1NextExtensionHeaderType, set in FlowGtpv1. + // PatternFlowGtpv1NextExtensionHeaderType is next extension header. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the e_flag bit is on. + NextExtensionHeaderType() PatternFlowGtpv1NextExtensionHeaderType + // SetNextExtensionHeaderType assigns PatternFlowGtpv1NextExtensionHeaderType provided by user to FlowGtpv1. + // PatternFlowGtpv1NextExtensionHeaderType is next extension header. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the e_flag bit is on. + SetNextExtensionHeaderType(value PatternFlowGtpv1NextExtensionHeaderType) FlowGtpv1 + // HasNextExtensionHeaderType checks if NextExtensionHeaderType has been set in FlowGtpv1 + HasNextExtensionHeaderType() bool + // ExtensionHeaders returns FlowGtpv1FlowGtpExtensionIterIter, set in FlowGtpv1 + ExtensionHeaders() FlowGtpv1FlowGtpExtensionIter + setNil() +} + +// description is TBD +// Version returns a PatternFlowGtpv1Version +func (obj *flowGtpv1) Version() PatternFlowGtpv1Version { + if obj.obj.Version == nil { + obj.obj.Version = NewPatternFlowGtpv1Version().msg() + } + if obj.versionHolder == nil { + obj.versionHolder = &patternFlowGtpv1Version{obj: obj.obj.Version} + } + return obj.versionHolder +} + +// description is TBD +// Version returns a PatternFlowGtpv1Version +func (obj *flowGtpv1) HasVersion() bool { + return obj.obj.Version != nil +} + +// description is TBD +// SetVersion sets the PatternFlowGtpv1Version value in the FlowGtpv1 object +func (obj *flowGtpv1) SetVersion(value PatternFlowGtpv1Version) FlowGtpv1 { + + obj.versionHolder = nil + obj.obj.Version = value.msg() + + return obj +} + +// description is TBD +// ProtocolType returns a PatternFlowGtpv1ProtocolType +func (obj *flowGtpv1) ProtocolType() PatternFlowGtpv1ProtocolType { + if obj.obj.ProtocolType == nil { + obj.obj.ProtocolType = NewPatternFlowGtpv1ProtocolType().msg() + } + if obj.protocolTypeHolder == nil { + obj.protocolTypeHolder = &patternFlowGtpv1ProtocolType{obj: obj.obj.ProtocolType} + } + return obj.protocolTypeHolder +} + +// description is TBD +// ProtocolType returns a PatternFlowGtpv1ProtocolType +func (obj *flowGtpv1) HasProtocolType() bool { + return obj.obj.ProtocolType != nil +} + +// description is TBD +// SetProtocolType sets the PatternFlowGtpv1ProtocolType value in the FlowGtpv1 object +func (obj *flowGtpv1) SetProtocolType(value PatternFlowGtpv1ProtocolType) FlowGtpv1 { + + obj.protocolTypeHolder = nil + obj.obj.ProtocolType = value.msg() + + return obj +} + +// description is TBD +// Reserved returns a PatternFlowGtpv1Reserved +func (obj *flowGtpv1) Reserved() PatternFlowGtpv1Reserved { + if obj.obj.Reserved == nil { + obj.obj.Reserved = NewPatternFlowGtpv1Reserved().msg() + } + if obj.reservedHolder == nil { + obj.reservedHolder = &patternFlowGtpv1Reserved{obj: obj.obj.Reserved} + } + return obj.reservedHolder +} + +// description is TBD +// Reserved returns a PatternFlowGtpv1Reserved +func (obj *flowGtpv1) HasReserved() bool { + return obj.obj.Reserved != nil +} + +// description is TBD +// SetReserved sets the PatternFlowGtpv1Reserved value in the FlowGtpv1 object +func (obj *flowGtpv1) SetReserved(value PatternFlowGtpv1Reserved) FlowGtpv1 { + + obj.reservedHolder = nil + obj.obj.Reserved = value.msg() + + return obj +} + +// description is TBD +// EFlag returns a PatternFlowGtpv1EFlag +func (obj *flowGtpv1) EFlag() PatternFlowGtpv1EFlag { + if obj.obj.EFlag == nil { + obj.obj.EFlag = NewPatternFlowGtpv1EFlag().msg() + } + if obj.eFlagHolder == nil { + obj.eFlagHolder = &patternFlowGtpv1EFlag{obj: obj.obj.EFlag} + } + return obj.eFlagHolder +} + +// description is TBD +// EFlag returns a PatternFlowGtpv1EFlag +func (obj *flowGtpv1) HasEFlag() bool { + return obj.obj.EFlag != nil +} + +// description is TBD +// SetEFlag sets the PatternFlowGtpv1EFlag value in the FlowGtpv1 object +func (obj *flowGtpv1) SetEFlag(value PatternFlowGtpv1EFlag) FlowGtpv1 { + + obj.eFlagHolder = nil + obj.obj.EFlag = value.msg() + + return obj +} + +// description is TBD +// SFlag returns a PatternFlowGtpv1SFlag +func (obj *flowGtpv1) SFlag() PatternFlowGtpv1SFlag { + if obj.obj.SFlag == nil { + obj.obj.SFlag = NewPatternFlowGtpv1SFlag().msg() + } + if obj.sFlagHolder == nil { + obj.sFlagHolder = &patternFlowGtpv1SFlag{obj: obj.obj.SFlag} + } + return obj.sFlagHolder +} + +// description is TBD +// SFlag returns a PatternFlowGtpv1SFlag +func (obj *flowGtpv1) HasSFlag() bool { + return obj.obj.SFlag != nil +} + +// description is TBD +// SetSFlag sets the PatternFlowGtpv1SFlag value in the FlowGtpv1 object +func (obj *flowGtpv1) SetSFlag(value PatternFlowGtpv1SFlag) FlowGtpv1 { + + obj.sFlagHolder = nil + obj.obj.SFlag = value.msg() + + return obj +} + +// description is TBD +// PnFlag returns a PatternFlowGtpv1PnFlag +func (obj *flowGtpv1) PnFlag() PatternFlowGtpv1PnFlag { + if obj.obj.PnFlag == nil { + obj.obj.PnFlag = NewPatternFlowGtpv1PnFlag().msg() + } + if obj.pnFlagHolder == nil { + obj.pnFlagHolder = &patternFlowGtpv1PnFlag{obj: obj.obj.PnFlag} + } + return obj.pnFlagHolder +} + +// description is TBD +// PnFlag returns a PatternFlowGtpv1PnFlag +func (obj *flowGtpv1) HasPnFlag() bool { + return obj.obj.PnFlag != nil +} + +// description is TBD +// SetPnFlag sets the PatternFlowGtpv1PnFlag value in the FlowGtpv1 object +func (obj *flowGtpv1) SetPnFlag(value PatternFlowGtpv1PnFlag) FlowGtpv1 { + + obj.pnFlagHolder = nil + obj.obj.PnFlag = value.msg() + + return obj +} + +// description is TBD +// MessageType returns a PatternFlowGtpv1MessageType +func (obj *flowGtpv1) MessageType() PatternFlowGtpv1MessageType { + if obj.obj.MessageType == nil { + obj.obj.MessageType = NewPatternFlowGtpv1MessageType().msg() + } + if obj.messageTypeHolder == nil { + obj.messageTypeHolder = &patternFlowGtpv1MessageType{obj: obj.obj.MessageType} + } + return obj.messageTypeHolder +} + +// description is TBD +// MessageType returns a PatternFlowGtpv1MessageType +func (obj *flowGtpv1) HasMessageType() bool { + return obj.obj.MessageType != nil +} + +// description is TBD +// SetMessageType sets the PatternFlowGtpv1MessageType value in the FlowGtpv1 object +func (obj *flowGtpv1) SetMessageType(value PatternFlowGtpv1MessageType) FlowGtpv1 { + + obj.messageTypeHolder = nil + obj.obj.MessageType = value.msg() + + return obj +} + +// description is TBD +// MessageLength returns a PatternFlowGtpv1MessageLength +func (obj *flowGtpv1) MessageLength() PatternFlowGtpv1MessageLength { + if obj.obj.MessageLength == nil { + obj.obj.MessageLength = NewPatternFlowGtpv1MessageLength().msg() + } + if obj.messageLengthHolder == nil { + obj.messageLengthHolder = &patternFlowGtpv1MessageLength{obj: obj.obj.MessageLength} + } + return obj.messageLengthHolder +} + +// description is TBD +// MessageLength returns a PatternFlowGtpv1MessageLength +func (obj *flowGtpv1) HasMessageLength() bool { + return obj.obj.MessageLength != nil +} + +// description is TBD +// SetMessageLength sets the PatternFlowGtpv1MessageLength value in the FlowGtpv1 object +func (obj *flowGtpv1) SetMessageLength(value PatternFlowGtpv1MessageLength) FlowGtpv1 { + + obj.messageLengthHolder = nil + obj.obj.MessageLength = value.msg() + + return obj +} + +// description is TBD +// Teid returns a PatternFlowGtpv1Teid +func (obj *flowGtpv1) Teid() PatternFlowGtpv1Teid { + if obj.obj.Teid == nil { + obj.obj.Teid = NewPatternFlowGtpv1Teid().msg() + } + if obj.teidHolder == nil { + obj.teidHolder = &patternFlowGtpv1Teid{obj: obj.obj.Teid} + } + return obj.teidHolder +} + +// description is TBD +// Teid returns a PatternFlowGtpv1Teid +func (obj *flowGtpv1) HasTeid() bool { + return obj.obj.Teid != nil +} + +// description is TBD +// SetTeid sets the PatternFlowGtpv1Teid value in the FlowGtpv1 object +func (obj *flowGtpv1) SetTeid(value PatternFlowGtpv1Teid) FlowGtpv1 { + + obj.teidHolder = nil + obj.obj.Teid = value.msg() + + return obj +} + +// description is TBD +// SquenceNumber returns a PatternFlowGtpv1SquenceNumber +func (obj *flowGtpv1) SquenceNumber() PatternFlowGtpv1SquenceNumber { + if obj.obj.SquenceNumber == nil { + obj.obj.SquenceNumber = NewPatternFlowGtpv1SquenceNumber().msg() + } + if obj.squenceNumberHolder == nil { + obj.squenceNumberHolder = &patternFlowGtpv1SquenceNumber{obj: obj.obj.SquenceNumber} + } + return obj.squenceNumberHolder +} + +// description is TBD +// SquenceNumber returns a PatternFlowGtpv1SquenceNumber +func (obj *flowGtpv1) HasSquenceNumber() bool { + return obj.obj.SquenceNumber != nil +} + +// description is TBD +// SetSquenceNumber sets the PatternFlowGtpv1SquenceNumber value in the FlowGtpv1 object +func (obj *flowGtpv1) SetSquenceNumber(value PatternFlowGtpv1SquenceNumber) FlowGtpv1 { + + obj.squenceNumberHolder = nil + obj.obj.SquenceNumber = value.msg() + + return obj +} + +// description is TBD +// NPduNumber returns a PatternFlowGtpv1NPduNumber +func (obj *flowGtpv1) NPduNumber() PatternFlowGtpv1NPduNumber { + if obj.obj.NPduNumber == nil { + obj.obj.NPduNumber = NewPatternFlowGtpv1NPduNumber().msg() + } + if obj.nPduNumberHolder == nil { + obj.nPduNumberHolder = &patternFlowGtpv1NPduNumber{obj: obj.obj.NPduNumber} + } + return obj.nPduNumberHolder +} + +// description is TBD +// NPduNumber returns a PatternFlowGtpv1NPduNumber +func (obj *flowGtpv1) HasNPduNumber() bool { + return obj.obj.NPduNumber != nil +} + +// description is TBD +// SetNPduNumber sets the PatternFlowGtpv1NPduNumber value in the FlowGtpv1 object +func (obj *flowGtpv1) SetNPduNumber(value PatternFlowGtpv1NPduNumber) FlowGtpv1 { + + obj.nPduNumberHolder = nil + obj.obj.NPduNumber = value.msg() + + return obj +} + +// description is TBD +// NextExtensionHeaderType returns a PatternFlowGtpv1NextExtensionHeaderType +func (obj *flowGtpv1) NextExtensionHeaderType() PatternFlowGtpv1NextExtensionHeaderType { + if obj.obj.NextExtensionHeaderType == nil { + obj.obj.NextExtensionHeaderType = NewPatternFlowGtpv1NextExtensionHeaderType().msg() + } + if obj.nextExtensionHeaderTypeHolder == nil { + obj.nextExtensionHeaderTypeHolder = &patternFlowGtpv1NextExtensionHeaderType{obj: obj.obj.NextExtensionHeaderType} + } + return obj.nextExtensionHeaderTypeHolder +} + +// description is TBD +// NextExtensionHeaderType returns a PatternFlowGtpv1NextExtensionHeaderType +func (obj *flowGtpv1) HasNextExtensionHeaderType() bool { + return obj.obj.NextExtensionHeaderType != nil +} + +// description is TBD +// SetNextExtensionHeaderType sets the PatternFlowGtpv1NextExtensionHeaderType value in the FlowGtpv1 object +func (obj *flowGtpv1) SetNextExtensionHeaderType(value PatternFlowGtpv1NextExtensionHeaderType) FlowGtpv1 { + + obj.nextExtensionHeaderTypeHolder = nil + obj.obj.NextExtensionHeaderType = value.msg() + + return obj +} + +// A list of optional extension headers. +// ExtensionHeaders returns a []FlowGtpExtension +func (obj *flowGtpv1) ExtensionHeaders() FlowGtpv1FlowGtpExtensionIter { + if len(obj.obj.ExtensionHeaders) == 0 { + obj.obj.ExtensionHeaders = []*otg.FlowGtpExtension{} + } + if obj.extensionHeadersHolder == nil { + obj.extensionHeadersHolder = newFlowGtpv1FlowGtpExtensionIter(&obj.obj.ExtensionHeaders).setMsg(obj) + } + return obj.extensionHeadersHolder +} + +type flowGtpv1FlowGtpExtensionIter struct { + obj *flowGtpv1 + flowGtpExtensionSlice []FlowGtpExtension + fieldPtr *[]*otg.FlowGtpExtension +} + +func newFlowGtpv1FlowGtpExtensionIter(ptr *[]*otg.FlowGtpExtension) FlowGtpv1FlowGtpExtensionIter { + return &flowGtpv1FlowGtpExtensionIter{fieldPtr: ptr} +} + +type FlowGtpv1FlowGtpExtensionIter interface { + setMsg(*flowGtpv1) FlowGtpv1FlowGtpExtensionIter + Items() []FlowGtpExtension + Add() FlowGtpExtension + Append(items ...FlowGtpExtension) FlowGtpv1FlowGtpExtensionIter + Set(index int, newObj FlowGtpExtension) FlowGtpv1FlowGtpExtensionIter + Clear() FlowGtpv1FlowGtpExtensionIter + clearHolderSlice() FlowGtpv1FlowGtpExtensionIter + appendHolderSlice(item FlowGtpExtension) FlowGtpv1FlowGtpExtensionIter +} + +func (obj *flowGtpv1FlowGtpExtensionIter) setMsg(msg *flowGtpv1) FlowGtpv1FlowGtpExtensionIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flowGtpExtension{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *flowGtpv1FlowGtpExtensionIter) Items() []FlowGtpExtension { + return obj.flowGtpExtensionSlice +} + +func (obj *flowGtpv1FlowGtpExtensionIter) Add() FlowGtpExtension { + newObj := &otg.FlowGtpExtension{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flowGtpExtension{obj: newObj} + newLibObj.setDefault() + obj.flowGtpExtensionSlice = append(obj.flowGtpExtensionSlice, newLibObj) + return newLibObj +} + +func (obj *flowGtpv1FlowGtpExtensionIter) Append(items ...FlowGtpExtension) FlowGtpv1FlowGtpExtensionIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowGtpExtensionSlice = append(obj.flowGtpExtensionSlice, item) + } + return obj +} + +func (obj *flowGtpv1FlowGtpExtensionIter) Set(index int, newObj FlowGtpExtension) FlowGtpv1FlowGtpExtensionIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowGtpExtensionSlice[index] = newObj + return obj +} +func (obj *flowGtpv1FlowGtpExtensionIter) Clear() FlowGtpv1FlowGtpExtensionIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.FlowGtpExtension{} + obj.flowGtpExtensionSlice = []FlowGtpExtension{} + } + return obj +} +func (obj *flowGtpv1FlowGtpExtensionIter) clearHolderSlice() FlowGtpv1FlowGtpExtensionIter { + if len(obj.flowGtpExtensionSlice) > 0 { + obj.flowGtpExtensionSlice = []FlowGtpExtension{} + } + return obj +} +func (obj *flowGtpv1FlowGtpExtensionIter) appendHolderSlice(item FlowGtpExtension) FlowGtpv1FlowGtpExtensionIter { + obj.flowGtpExtensionSlice = append(obj.flowGtpExtensionSlice, item) + return obj +} + +func (obj *flowGtpv1) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Version != nil { + + obj.Version().validateObj(vObj, set_default) + } + + if obj.obj.ProtocolType != nil { + + obj.ProtocolType().validateObj(vObj, set_default) + } + + if obj.obj.Reserved != nil { + + obj.Reserved().validateObj(vObj, set_default) + } + + if obj.obj.EFlag != nil { + + obj.EFlag().validateObj(vObj, set_default) + } + + if obj.obj.SFlag != nil { + + obj.SFlag().validateObj(vObj, set_default) + } + + if obj.obj.PnFlag != nil { + + obj.PnFlag().validateObj(vObj, set_default) + } + + if obj.obj.MessageType != nil { + + obj.MessageType().validateObj(vObj, set_default) + } + + if obj.obj.MessageLength != nil { + + obj.MessageLength().validateObj(vObj, set_default) + } + + if obj.obj.Teid != nil { + + obj.Teid().validateObj(vObj, set_default) + } + + if obj.obj.SquenceNumber != nil { + + obj.SquenceNumber().validateObj(vObj, set_default) + } + + if obj.obj.NPduNumber != nil { + + obj.NPduNumber().validateObj(vObj, set_default) + } + + if obj.obj.NextExtensionHeaderType != nil { + + obj.NextExtensionHeaderType().validateObj(vObj, set_default) + } + + if len(obj.obj.ExtensionHeaders) != 0 { + + if set_default { + obj.ExtensionHeaders().clearHolderSlice() + for _, item := range obj.obj.ExtensionHeaders { + obj.ExtensionHeaders().appendHolderSlice(&flowGtpExtension{obj: item}) + } + } + for _, item := range obj.ExtensionHeaders().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *flowGtpv1) setDefault() { + +} diff --git a/gosnappi/flow_gtpv2.go b/gosnappi/flow_gtpv2.go new file mode 100644 index 00000000..18437265 --- /dev/null +++ b/gosnappi/flow_gtpv2.go @@ -0,0 +1,672 @@ +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" +) + +// ***** FlowGtpv2 ***** +type flowGtpv2 struct { + validation + obj *otg.FlowGtpv2 + marshaller marshalFlowGtpv2 + unMarshaller unMarshalFlowGtpv2 + versionHolder PatternFlowGtpv2Version + piggybackingFlagHolder PatternFlowGtpv2PiggybackingFlag + teidFlagHolder PatternFlowGtpv2TeidFlag + spare1Holder PatternFlowGtpv2Spare1 + messageTypeHolder PatternFlowGtpv2MessageType + messageLengthHolder PatternFlowGtpv2MessageLength + teidHolder PatternFlowGtpv2Teid + sequenceNumberHolder PatternFlowGtpv2SequenceNumber + spare2Holder PatternFlowGtpv2Spare2 +} + +func NewFlowGtpv2() FlowGtpv2 { + obj := flowGtpv2{obj: &otg.FlowGtpv2{}} + obj.setDefault() + return &obj +} + +func (obj *flowGtpv2) msg() *otg.FlowGtpv2 { + return obj.obj +} + +func (obj *flowGtpv2) setMsg(msg *otg.FlowGtpv2) FlowGtpv2 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowGtpv2 struct { + obj *flowGtpv2 +} + +type marshalFlowGtpv2 interface { + // ToProto marshals FlowGtpv2 to protobuf object *otg.FlowGtpv2 + ToProto() (*otg.FlowGtpv2, error) + // ToPbText marshals FlowGtpv2 to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowGtpv2 to YAML text + ToYaml() (string, error) + // ToJson marshals FlowGtpv2 to JSON text + ToJson() (string, error) +} + +type unMarshalflowGtpv2 struct { + obj *flowGtpv2 +} + +type unMarshalFlowGtpv2 interface { + // FromProto unmarshals FlowGtpv2 from protobuf object *otg.FlowGtpv2 + FromProto(msg *otg.FlowGtpv2) (FlowGtpv2, error) + // FromPbText unmarshals FlowGtpv2 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowGtpv2 from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowGtpv2 from JSON text + FromJson(value string) error +} + +func (obj *flowGtpv2) Marshal() marshalFlowGtpv2 { + if obj.marshaller == nil { + obj.marshaller = &marshalflowGtpv2{obj: obj} + } + return obj.marshaller +} + +func (obj *flowGtpv2) Unmarshal() unMarshalFlowGtpv2 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowGtpv2{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowGtpv2) ToProto() (*otg.FlowGtpv2, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowGtpv2) FromProto(msg *otg.FlowGtpv2) (FlowGtpv2, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowGtpv2) 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 *unMarshalflowGtpv2) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowGtpv2) 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 *unMarshalflowGtpv2) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowGtpv2) 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 *unMarshalflowGtpv2) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowGtpv2) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowGtpv2) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowGtpv2) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowGtpv2) Clone() (FlowGtpv2, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowGtpv2() + 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 +} + +func (obj *flowGtpv2) setNil() { + obj.versionHolder = nil + obj.piggybackingFlagHolder = nil + obj.teidFlagHolder = nil + obj.spare1Holder = nil + obj.messageTypeHolder = nil + obj.messageLengthHolder = nil + obj.teidHolder = nil + obj.sequenceNumberHolder = nil + obj.spare2Holder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowGtpv2 is gTPv2 packet header +type FlowGtpv2 interface { + Validation + // msg marshals FlowGtpv2 to protobuf object *otg.FlowGtpv2 + // and doesn't set defaults + msg() *otg.FlowGtpv2 + // setMsg unmarshals FlowGtpv2 from protobuf object *otg.FlowGtpv2 + // and doesn't set defaults + setMsg(*otg.FlowGtpv2) FlowGtpv2 + // provides marshal interface + Marshal() marshalFlowGtpv2 + // provides unmarshal interface + Unmarshal() unMarshalFlowGtpv2 + // validate validates FlowGtpv2 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowGtpv2, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Version returns PatternFlowGtpv2Version, set in FlowGtpv2. + // PatternFlowGtpv2Version is version number + Version() PatternFlowGtpv2Version + // SetVersion assigns PatternFlowGtpv2Version provided by user to FlowGtpv2. + // PatternFlowGtpv2Version is version number + SetVersion(value PatternFlowGtpv2Version) FlowGtpv2 + // HasVersion checks if Version has been set in FlowGtpv2 + HasVersion() bool + // PiggybackingFlag returns PatternFlowGtpv2PiggybackingFlag, set in FlowGtpv2. + // PatternFlowGtpv2PiggybackingFlag is if piggybacking_flag is set to 1 then another GTP-C message with its own header shall be present at the end of the current message + PiggybackingFlag() PatternFlowGtpv2PiggybackingFlag + // SetPiggybackingFlag assigns PatternFlowGtpv2PiggybackingFlag provided by user to FlowGtpv2. + // PatternFlowGtpv2PiggybackingFlag is if piggybacking_flag is set to 1 then another GTP-C message with its own header shall be present at the end of the current message + SetPiggybackingFlag(value PatternFlowGtpv2PiggybackingFlag) FlowGtpv2 + // HasPiggybackingFlag checks if PiggybackingFlag has been set in FlowGtpv2 + HasPiggybackingFlag() bool + // TeidFlag returns PatternFlowGtpv2TeidFlag, set in FlowGtpv2. + // PatternFlowGtpv2TeidFlag is if teid_flag is set to 1 then the TEID field will be present between the message length and the sequence number. All messages except Echo and Echo reply require TEID to be present + TeidFlag() PatternFlowGtpv2TeidFlag + // SetTeidFlag assigns PatternFlowGtpv2TeidFlag provided by user to FlowGtpv2. + // PatternFlowGtpv2TeidFlag is if teid_flag is set to 1 then the TEID field will be present between the message length and the sequence number. All messages except Echo and Echo reply require TEID to be present + SetTeidFlag(value PatternFlowGtpv2TeidFlag) FlowGtpv2 + // HasTeidFlag checks if TeidFlag has been set in FlowGtpv2 + HasTeidFlag() bool + // Spare1 returns PatternFlowGtpv2Spare1, set in FlowGtpv2. + // PatternFlowGtpv2Spare1 is a 3-bit reserved field (must be 0). + Spare1() PatternFlowGtpv2Spare1 + // SetSpare1 assigns PatternFlowGtpv2Spare1 provided by user to FlowGtpv2. + // PatternFlowGtpv2Spare1 is a 3-bit reserved field (must be 0). + SetSpare1(value PatternFlowGtpv2Spare1) FlowGtpv2 + // HasSpare1 checks if Spare1 has been set in FlowGtpv2 + HasSpare1() bool + // MessageType returns PatternFlowGtpv2MessageType, set in FlowGtpv2. + // PatternFlowGtpv2MessageType is an 8-bit field that indicates the type of GTP message. Different types of messages are defined in 3GPP TS 29.060 section 7.1 + MessageType() PatternFlowGtpv2MessageType + // SetMessageType assigns PatternFlowGtpv2MessageType provided by user to FlowGtpv2. + // PatternFlowGtpv2MessageType is an 8-bit field that indicates the type of GTP message. Different types of messages are defined in 3GPP TS 29.060 section 7.1 + SetMessageType(value PatternFlowGtpv2MessageType) FlowGtpv2 + // HasMessageType checks if MessageType has been set in FlowGtpv2 + HasMessageType() bool + // MessageLength returns PatternFlowGtpv2MessageLength, set in FlowGtpv2. + // PatternFlowGtpv2MessageLength is a 16-bit field that indicates the length of the payload in bytes, excluding the mandatory GTP-c header (first 4 bytes). Includes the TEID and sequence_number if they are present. + MessageLength() PatternFlowGtpv2MessageLength + // SetMessageLength assigns PatternFlowGtpv2MessageLength provided by user to FlowGtpv2. + // PatternFlowGtpv2MessageLength is a 16-bit field that indicates the length of the payload in bytes, excluding the mandatory GTP-c header (first 4 bytes). Includes the TEID and sequence_number if they are present. + SetMessageLength(value PatternFlowGtpv2MessageLength) FlowGtpv2 + // HasMessageLength checks if MessageLength has been set in FlowGtpv2 + HasMessageLength() bool + // Teid returns PatternFlowGtpv2Teid, set in FlowGtpv2. + // PatternFlowGtpv2Teid is tunnel endpoint identifier. A 32-bit (4-octet) field used to multiplex different connections in the same GTP tunnel. Is present only if the teid_flag is set. + Teid() PatternFlowGtpv2Teid + // SetTeid assigns PatternFlowGtpv2Teid provided by user to FlowGtpv2. + // PatternFlowGtpv2Teid is tunnel endpoint identifier. A 32-bit (4-octet) field used to multiplex different connections in the same GTP tunnel. Is present only if the teid_flag is set. + SetTeid(value PatternFlowGtpv2Teid) FlowGtpv2 + // HasTeid checks if Teid has been set in FlowGtpv2 + HasTeid() bool + // SequenceNumber returns PatternFlowGtpv2SequenceNumber, set in FlowGtpv2. + // PatternFlowGtpv2SequenceNumber is the sequence number + SequenceNumber() PatternFlowGtpv2SequenceNumber + // SetSequenceNumber assigns PatternFlowGtpv2SequenceNumber provided by user to FlowGtpv2. + // PatternFlowGtpv2SequenceNumber is the sequence number + SetSequenceNumber(value PatternFlowGtpv2SequenceNumber) FlowGtpv2 + // HasSequenceNumber checks if SequenceNumber has been set in FlowGtpv2 + HasSequenceNumber() bool + // Spare2 returns PatternFlowGtpv2Spare2, set in FlowGtpv2. + // PatternFlowGtpv2Spare2 is reserved field + Spare2() PatternFlowGtpv2Spare2 + // SetSpare2 assigns PatternFlowGtpv2Spare2 provided by user to FlowGtpv2. + // PatternFlowGtpv2Spare2 is reserved field + SetSpare2(value PatternFlowGtpv2Spare2) FlowGtpv2 + // HasSpare2 checks if Spare2 has been set in FlowGtpv2 + HasSpare2() bool + setNil() +} + +// description is TBD +// Version returns a PatternFlowGtpv2Version +func (obj *flowGtpv2) Version() PatternFlowGtpv2Version { + if obj.obj.Version == nil { + obj.obj.Version = NewPatternFlowGtpv2Version().msg() + } + if obj.versionHolder == nil { + obj.versionHolder = &patternFlowGtpv2Version{obj: obj.obj.Version} + } + return obj.versionHolder +} + +// description is TBD +// Version returns a PatternFlowGtpv2Version +func (obj *flowGtpv2) HasVersion() bool { + return obj.obj.Version != nil +} + +// description is TBD +// SetVersion sets the PatternFlowGtpv2Version value in the FlowGtpv2 object +func (obj *flowGtpv2) SetVersion(value PatternFlowGtpv2Version) FlowGtpv2 { + + obj.versionHolder = nil + obj.obj.Version = value.msg() + + return obj +} + +// description is TBD +// PiggybackingFlag returns a PatternFlowGtpv2PiggybackingFlag +func (obj *flowGtpv2) PiggybackingFlag() PatternFlowGtpv2PiggybackingFlag { + if obj.obj.PiggybackingFlag == nil { + obj.obj.PiggybackingFlag = NewPatternFlowGtpv2PiggybackingFlag().msg() + } + if obj.piggybackingFlagHolder == nil { + obj.piggybackingFlagHolder = &patternFlowGtpv2PiggybackingFlag{obj: obj.obj.PiggybackingFlag} + } + return obj.piggybackingFlagHolder +} + +// description is TBD +// PiggybackingFlag returns a PatternFlowGtpv2PiggybackingFlag +func (obj *flowGtpv2) HasPiggybackingFlag() bool { + return obj.obj.PiggybackingFlag != nil +} + +// description is TBD +// SetPiggybackingFlag sets the PatternFlowGtpv2PiggybackingFlag value in the FlowGtpv2 object +func (obj *flowGtpv2) SetPiggybackingFlag(value PatternFlowGtpv2PiggybackingFlag) FlowGtpv2 { + + obj.piggybackingFlagHolder = nil + obj.obj.PiggybackingFlag = value.msg() + + return obj +} + +// description is TBD +// TeidFlag returns a PatternFlowGtpv2TeidFlag +func (obj *flowGtpv2) TeidFlag() PatternFlowGtpv2TeidFlag { + if obj.obj.TeidFlag == nil { + obj.obj.TeidFlag = NewPatternFlowGtpv2TeidFlag().msg() + } + if obj.teidFlagHolder == nil { + obj.teidFlagHolder = &patternFlowGtpv2TeidFlag{obj: obj.obj.TeidFlag} + } + return obj.teidFlagHolder +} + +// description is TBD +// TeidFlag returns a PatternFlowGtpv2TeidFlag +func (obj *flowGtpv2) HasTeidFlag() bool { + return obj.obj.TeidFlag != nil +} + +// description is TBD +// SetTeidFlag sets the PatternFlowGtpv2TeidFlag value in the FlowGtpv2 object +func (obj *flowGtpv2) SetTeidFlag(value PatternFlowGtpv2TeidFlag) FlowGtpv2 { + + obj.teidFlagHolder = nil + obj.obj.TeidFlag = value.msg() + + return obj +} + +// description is TBD +// Spare1 returns a PatternFlowGtpv2Spare1 +func (obj *flowGtpv2) Spare1() PatternFlowGtpv2Spare1 { + if obj.obj.Spare1 == nil { + obj.obj.Spare1 = NewPatternFlowGtpv2Spare1().msg() + } + if obj.spare1Holder == nil { + obj.spare1Holder = &patternFlowGtpv2Spare1{obj: obj.obj.Spare1} + } + return obj.spare1Holder +} + +// description is TBD +// Spare1 returns a PatternFlowGtpv2Spare1 +func (obj *flowGtpv2) HasSpare1() bool { + return obj.obj.Spare1 != nil +} + +// description is TBD +// SetSpare1 sets the PatternFlowGtpv2Spare1 value in the FlowGtpv2 object +func (obj *flowGtpv2) SetSpare1(value PatternFlowGtpv2Spare1) FlowGtpv2 { + + obj.spare1Holder = nil + obj.obj.Spare1 = value.msg() + + return obj +} + +// description is TBD +// MessageType returns a PatternFlowGtpv2MessageType +func (obj *flowGtpv2) MessageType() PatternFlowGtpv2MessageType { + if obj.obj.MessageType == nil { + obj.obj.MessageType = NewPatternFlowGtpv2MessageType().msg() + } + if obj.messageTypeHolder == nil { + obj.messageTypeHolder = &patternFlowGtpv2MessageType{obj: obj.obj.MessageType} + } + return obj.messageTypeHolder +} + +// description is TBD +// MessageType returns a PatternFlowGtpv2MessageType +func (obj *flowGtpv2) HasMessageType() bool { + return obj.obj.MessageType != nil +} + +// description is TBD +// SetMessageType sets the PatternFlowGtpv2MessageType value in the FlowGtpv2 object +func (obj *flowGtpv2) SetMessageType(value PatternFlowGtpv2MessageType) FlowGtpv2 { + + obj.messageTypeHolder = nil + obj.obj.MessageType = value.msg() + + return obj +} + +// description is TBD +// MessageLength returns a PatternFlowGtpv2MessageLength +func (obj *flowGtpv2) MessageLength() PatternFlowGtpv2MessageLength { + if obj.obj.MessageLength == nil { + obj.obj.MessageLength = NewPatternFlowGtpv2MessageLength().msg() + } + if obj.messageLengthHolder == nil { + obj.messageLengthHolder = &patternFlowGtpv2MessageLength{obj: obj.obj.MessageLength} + } + return obj.messageLengthHolder +} + +// description is TBD +// MessageLength returns a PatternFlowGtpv2MessageLength +func (obj *flowGtpv2) HasMessageLength() bool { + return obj.obj.MessageLength != nil +} + +// description is TBD +// SetMessageLength sets the PatternFlowGtpv2MessageLength value in the FlowGtpv2 object +func (obj *flowGtpv2) SetMessageLength(value PatternFlowGtpv2MessageLength) FlowGtpv2 { + + obj.messageLengthHolder = nil + obj.obj.MessageLength = value.msg() + + return obj +} + +// description is TBD +// Teid returns a PatternFlowGtpv2Teid +func (obj *flowGtpv2) Teid() PatternFlowGtpv2Teid { + if obj.obj.Teid == nil { + obj.obj.Teid = NewPatternFlowGtpv2Teid().msg() + } + if obj.teidHolder == nil { + obj.teidHolder = &patternFlowGtpv2Teid{obj: obj.obj.Teid} + } + return obj.teidHolder +} + +// description is TBD +// Teid returns a PatternFlowGtpv2Teid +func (obj *flowGtpv2) HasTeid() bool { + return obj.obj.Teid != nil +} + +// description is TBD +// SetTeid sets the PatternFlowGtpv2Teid value in the FlowGtpv2 object +func (obj *flowGtpv2) SetTeid(value PatternFlowGtpv2Teid) FlowGtpv2 { + + obj.teidHolder = nil + obj.obj.Teid = value.msg() + + return obj +} + +// description is TBD +// SequenceNumber returns a PatternFlowGtpv2SequenceNumber +func (obj *flowGtpv2) SequenceNumber() PatternFlowGtpv2SequenceNumber { + if obj.obj.SequenceNumber == nil { + obj.obj.SequenceNumber = NewPatternFlowGtpv2SequenceNumber().msg() + } + if obj.sequenceNumberHolder == nil { + obj.sequenceNumberHolder = &patternFlowGtpv2SequenceNumber{obj: obj.obj.SequenceNumber} + } + return obj.sequenceNumberHolder +} + +// description is TBD +// SequenceNumber returns a PatternFlowGtpv2SequenceNumber +func (obj *flowGtpv2) HasSequenceNumber() bool { + return obj.obj.SequenceNumber != nil +} + +// description is TBD +// SetSequenceNumber sets the PatternFlowGtpv2SequenceNumber value in the FlowGtpv2 object +func (obj *flowGtpv2) SetSequenceNumber(value PatternFlowGtpv2SequenceNumber) FlowGtpv2 { + + obj.sequenceNumberHolder = nil + obj.obj.SequenceNumber = value.msg() + + return obj +} + +// description is TBD +// Spare2 returns a PatternFlowGtpv2Spare2 +func (obj *flowGtpv2) Spare2() PatternFlowGtpv2Spare2 { + if obj.obj.Spare2 == nil { + obj.obj.Spare2 = NewPatternFlowGtpv2Spare2().msg() + } + if obj.spare2Holder == nil { + obj.spare2Holder = &patternFlowGtpv2Spare2{obj: obj.obj.Spare2} + } + return obj.spare2Holder +} + +// description is TBD +// Spare2 returns a PatternFlowGtpv2Spare2 +func (obj *flowGtpv2) HasSpare2() bool { + return obj.obj.Spare2 != nil +} + +// description is TBD +// SetSpare2 sets the PatternFlowGtpv2Spare2 value in the FlowGtpv2 object +func (obj *flowGtpv2) SetSpare2(value PatternFlowGtpv2Spare2) FlowGtpv2 { + + obj.spare2Holder = nil + obj.obj.Spare2 = value.msg() + + return obj +} + +func (obj *flowGtpv2) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Version != nil { + + obj.Version().validateObj(vObj, set_default) + } + + if obj.obj.PiggybackingFlag != nil { + + obj.PiggybackingFlag().validateObj(vObj, set_default) + } + + if obj.obj.TeidFlag != nil { + + obj.TeidFlag().validateObj(vObj, set_default) + } + + if obj.obj.Spare1 != nil { + + obj.Spare1().validateObj(vObj, set_default) + } + + if obj.obj.MessageType != nil { + + obj.MessageType().validateObj(vObj, set_default) + } + + if obj.obj.MessageLength != nil { + + obj.MessageLength().validateObj(vObj, set_default) + } + + if obj.obj.Teid != nil { + + obj.Teid().validateObj(vObj, set_default) + } + + if obj.obj.SequenceNumber != nil { + + obj.SequenceNumber().validateObj(vObj, set_default) + } + + if obj.obj.Spare2 != nil { + + obj.Spare2().validateObj(vObj, set_default) + } + +} + +func (obj *flowGtpv2) setDefault() { + +} diff --git a/gosnappi/flow_header.go b/gosnappi/flow_header.go new file mode 100644 index 00000000..f4e2020a --- /dev/null +++ b/gosnappi/flow_header.go @@ -0,0 +1,1515 @@ +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" +) + +// ***** FlowHeader ***** +type flowHeader struct { + validation + obj *otg.FlowHeader + marshaller marshalFlowHeader + unMarshaller unMarshalFlowHeader + customHolder FlowCustom + ethernetHolder FlowEthernet + vlanHolder FlowVlan + vxlanHolder FlowVxlan + ipv4Holder FlowIpv4 + ipv6Holder FlowIpv6 + pfcpauseHolder FlowPfcPause + ethernetpauseHolder FlowEthernetPause + tcpHolder FlowTcp + udpHolder FlowUdp + greHolder FlowGre + gtpv1Holder FlowGtpv1 + gtpv2Holder FlowGtpv2 + arpHolder FlowArp + icmpHolder FlowIcmp + icmpv6Holder FlowIcmpv6 + pppHolder FlowPpp + igmpv1Holder FlowIgmpv1 + mplsHolder FlowMpls + snmpv2CHolder FlowSnmpv2C + rsvpHolder FlowRsvp +} + +func NewFlowHeader() FlowHeader { + obj := flowHeader{obj: &otg.FlowHeader{}} + obj.setDefault() + return &obj +} + +func (obj *flowHeader) msg() *otg.FlowHeader { + return obj.obj +} + +func (obj *flowHeader) setMsg(msg *otg.FlowHeader) FlowHeader { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowHeader struct { + obj *flowHeader +} + +type marshalFlowHeader interface { + // ToProto marshals FlowHeader to protobuf object *otg.FlowHeader + ToProto() (*otg.FlowHeader, error) + // ToPbText marshals FlowHeader to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowHeader to YAML text + ToYaml() (string, error) + // ToJson marshals FlowHeader to JSON text + ToJson() (string, error) +} + +type unMarshalflowHeader struct { + obj *flowHeader +} + +type unMarshalFlowHeader interface { + // FromProto unmarshals FlowHeader from protobuf object *otg.FlowHeader + FromProto(msg *otg.FlowHeader) (FlowHeader, error) + // FromPbText unmarshals FlowHeader from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowHeader from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowHeader from JSON text + FromJson(value string) error +} + +func (obj *flowHeader) Marshal() marshalFlowHeader { + if obj.marshaller == nil { + obj.marshaller = &marshalflowHeader{obj: obj} + } + return obj.marshaller +} + +func (obj *flowHeader) Unmarshal() unMarshalFlowHeader { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowHeader{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowHeader) ToProto() (*otg.FlowHeader, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowHeader) FromProto(msg *otg.FlowHeader) (FlowHeader, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowHeader) 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 *unMarshalflowHeader) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowHeader) 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 *unMarshalflowHeader) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowHeader) 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 *unMarshalflowHeader) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowHeader) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowHeader) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowHeader) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowHeader) Clone() (FlowHeader, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowHeader() + 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 +} + +func (obj *flowHeader) setNil() { + obj.customHolder = nil + obj.ethernetHolder = nil + obj.vlanHolder = nil + obj.vxlanHolder = nil + obj.ipv4Holder = nil + obj.ipv6Holder = nil + obj.pfcpauseHolder = nil + obj.ethernetpauseHolder = nil + obj.tcpHolder = nil + obj.udpHolder = nil + obj.greHolder = nil + obj.gtpv1Holder = nil + obj.gtpv2Holder = nil + obj.arpHolder = nil + obj.icmpHolder = nil + obj.icmpv6Holder = nil + obj.pppHolder = nil + obj.igmpv1Holder = nil + obj.mplsHolder = nil + obj.snmpv2CHolder = nil + obj.rsvpHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowHeader is configuration for all traffic packet headers +type FlowHeader interface { + Validation + // msg marshals FlowHeader to protobuf object *otg.FlowHeader + // and doesn't set defaults + msg() *otg.FlowHeader + // setMsg unmarshals FlowHeader from protobuf object *otg.FlowHeader + // and doesn't set defaults + setMsg(*otg.FlowHeader) FlowHeader + // provides marshal interface + Marshal() marshalFlowHeader + // provides unmarshal interface + Unmarshal() unMarshalFlowHeader + // validate validates FlowHeader + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowHeader, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowHeaderChoiceEnum, set in FlowHeader + Choice() FlowHeaderChoiceEnum + // setChoice assigns FlowHeaderChoiceEnum provided by user to FlowHeader + setChoice(value FlowHeaderChoiceEnum) FlowHeader + // HasChoice checks if Choice has been set in FlowHeader + HasChoice() bool + // Custom returns FlowCustom, set in FlowHeader. + // FlowCustom is custom packet header + Custom() FlowCustom + // SetCustom assigns FlowCustom provided by user to FlowHeader. + // FlowCustom is custom packet header + SetCustom(value FlowCustom) FlowHeader + // HasCustom checks if Custom has been set in FlowHeader + HasCustom() bool + // Ethernet returns FlowEthernet, set in FlowHeader. + // FlowEthernet is ethernet packet header + Ethernet() FlowEthernet + // SetEthernet assigns FlowEthernet provided by user to FlowHeader. + // FlowEthernet is ethernet packet header + SetEthernet(value FlowEthernet) FlowHeader + // HasEthernet checks if Ethernet has been set in FlowHeader + HasEthernet() bool + // Vlan returns FlowVlan, set in FlowHeader. + // FlowVlan is vLAN packet header + Vlan() FlowVlan + // SetVlan assigns FlowVlan provided by user to FlowHeader. + // FlowVlan is vLAN packet header + SetVlan(value FlowVlan) FlowHeader + // HasVlan checks if Vlan has been set in FlowHeader + HasVlan() bool + // Vxlan returns FlowVxlan, set in FlowHeader. + // FlowVxlan is vXLAN packet header + Vxlan() FlowVxlan + // SetVxlan assigns FlowVxlan provided by user to FlowHeader. + // FlowVxlan is vXLAN packet header + SetVxlan(value FlowVxlan) FlowHeader + // HasVxlan checks if Vxlan has been set in FlowHeader + HasVxlan() bool + // Ipv4 returns FlowIpv4, set in FlowHeader. + // FlowIpv4 is iPv4 packet header + Ipv4() FlowIpv4 + // SetIpv4 assigns FlowIpv4 provided by user to FlowHeader. + // FlowIpv4 is iPv4 packet header + SetIpv4(value FlowIpv4) FlowHeader + // HasIpv4 checks if Ipv4 has been set in FlowHeader + HasIpv4() bool + // Ipv6 returns FlowIpv6, set in FlowHeader. + // FlowIpv6 is iPv6 packet header + Ipv6() FlowIpv6 + // SetIpv6 assigns FlowIpv6 provided by user to FlowHeader. + // FlowIpv6 is iPv6 packet header + SetIpv6(value FlowIpv6) FlowHeader + // HasIpv6 checks if Ipv6 has been set in FlowHeader + HasIpv6() bool + // Pfcpause returns FlowPfcPause, set in FlowHeader. + // FlowPfcPause is iEEE 802.1Qbb PFC Pause packet header. + Pfcpause() FlowPfcPause + // SetPfcpause assigns FlowPfcPause provided by user to FlowHeader. + // FlowPfcPause is iEEE 802.1Qbb PFC Pause packet header. + SetPfcpause(value FlowPfcPause) FlowHeader + // HasPfcpause checks if Pfcpause has been set in FlowHeader + HasPfcpause() bool + // Ethernetpause returns FlowEthernetPause, set in FlowHeader. + // FlowEthernetPause is iEEE 802.3x global ethernet pause packet header + Ethernetpause() FlowEthernetPause + // SetEthernetpause assigns FlowEthernetPause provided by user to FlowHeader. + // FlowEthernetPause is iEEE 802.3x global ethernet pause packet header + SetEthernetpause(value FlowEthernetPause) FlowHeader + // HasEthernetpause checks if Ethernetpause has been set in FlowHeader + HasEthernetpause() bool + // Tcp returns FlowTcp, set in FlowHeader. + // FlowTcp is tCP packet header + Tcp() FlowTcp + // SetTcp assigns FlowTcp provided by user to FlowHeader. + // FlowTcp is tCP packet header + SetTcp(value FlowTcp) FlowHeader + // HasTcp checks if Tcp has been set in FlowHeader + HasTcp() bool + // Udp returns FlowUdp, set in FlowHeader. + // FlowUdp is uDP packet header + Udp() FlowUdp + // SetUdp assigns FlowUdp provided by user to FlowHeader. + // FlowUdp is uDP packet header + SetUdp(value FlowUdp) FlowHeader + // HasUdp checks if Udp has been set in FlowHeader + HasUdp() bool + // Gre returns FlowGre, set in FlowHeader. + // FlowGre is standard GRE packet header (RFC2784) + Gre() FlowGre + // SetGre assigns FlowGre provided by user to FlowHeader. + // FlowGre is standard GRE packet header (RFC2784) + SetGre(value FlowGre) FlowHeader + // HasGre checks if Gre has been set in FlowHeader + HasGre() bool + // Gtpv1 returns FlowGtpv1, set in FlowHeader. + // FlowGtpv1 is gTPv1 packet header + Gtpv1() FlowGtpv1 + // SetGtpv1 assigns FlowGtpv1 provided by user to FlowHeader. + // FlowGtpv1 is gTPv1 packet header + SetGtpv1(value FlowGtpv1) FlowHeader + // HasGtpv1 checks if Gtpv1 has been set in FlowHeader + HasGtpv1() bool + // Gtpv2 returns FlowGtpv2, set in FlowHeader. + // FlowGtpv2 is gTPv2 packet header + Gtpv2() FlowGtpv2 + // SetGtpv2 assigns FlowGtpv2 provided by user to FlowHeader. + // FlowGtpv2 is gTPv2 packet header + SetGtpv2(value FlowGtpv2) FlowHeader + // HasGtpv2 checks if Gtpv2 has been set in FlowHeader + HasGtpv2() bool + // Arp returns FlowArp, set in FlowHeader. + // FlowArp is aRP packet header + Arp() FlowArp + // SetArp assigns FlowArp provided by user to FlowHeader. + // FlowArp is aRP packet header + SetArp(value FlowArp) FlowHeader + // HasArp checks if Arp has been set in FlowHeader + HasArp() bool + // Icmp returns FlowIcmp, set in FlowHeader. + // FlowIcmp is iCMP packet header + Icmp() FlowIcmp + // SetIcmp assigns FlowIcmp provided by user to FlowHeader. + // FlowIcmp is iCMP packet header + SetIcmp(value FlowIcmp) FlowHeader + // HasIcmp checks if Icmp has been set in FlowHeader + HasIcmp() bool + // Icmpv6 returns FlowIcmpv6, set in FlowHeader. + // FlowIcmpv6 is iCMPv6 packet header + Icmpv6() FlowIcmpv6 + // SetIcmpv6 assigns FlowIcmpv6 provided by user to FlowHeader. + // FlowIcmpv6 is iCMPv6 packet header + SetIcmpv6(value FlowIcmpv6) FlowHeader + // HasIcmpv6 checks if Icmpv6 has been set in FlowHeader + HasIcmpv6() bool + // Ppp returns FlowPpp, set in FlowHeader. + // FlowPpp is pPP packet header + Ppp() FlowPpp + // SetPpp assigns FlowPpp provided by user to FlowHeader. + // FlowPpp is pPP packet header + SetPpp(value FlowPpp) FlowHeader + // HasPpp checks if Ppp has been set in FlowHeader + HasPpp() bool + // Igmpv1 returns FlowIgmpv1, set in FlowHeader. + // FlowIgmpv1 is iGMPv1 packet header + Igmpv1() FlowIgmpv1 + // SetIgmpv1 assigns FlowIgmpv1 provided by user to FlowHeader. + // FlowIgmpv1 is iGMPv1 packet header + SetIgmpv1(value FlowIgmpv1) FlowHeader + // HasIgmpv1 checks if Igmpv1 has been set in FlowHeader + HasIgmpv1() bool + // Mpls returns FlowMpls, set in FlowHeader. + // FlowMpls is mPLS packet header; When configuring multiple such headers, the count shall not exceed 20. + Mpls() FlowMpls + // SetMpls assigns FlowMpls provided by user to FlowHeader. + // FlowMpls is mPLS packet header; When configuring multiple such headers, the count shall not exceed 20. + SetMpls(value FlowMpls) FlowHeader + // HasMpls checks if Mpls has been set in FlowHeader + HasMpls() bool + // Snmpv2C returns FlowSnmpv2C, set in FlowHeader. + Snmpv2C() FlowSnmpv2C + // SetSnmpv2C assigns FlowSnmpv2C provided by user to FlowHeader. + SetSnmpv2C(value FlowSnmpv2C) FlowHeader + // HasSnmpv2C checks if Snmpv2C has been set in FlowHeader + HasSnmpv2C() bool + // Rsvp returns FlowRsvp, set in FlowHeader. + // FlowRsvp is rSVP packet header as defined in RFC2205 and RFC3209. Currently only supported message type is "Path" with mandatory objects and sub-objects. + Rsvp() FlowRsvp + // SetRsvp assigns FlowRsvp provided by user to FlowHeader. + // FlowRsvp is rSVP packet header as defined in RFC2205 and RFC3209. Currently only supported message type is "Path" with mandatory objects and sub-objects. + SetRsvp(value FlowRsvp) FlowHeader + // HasRsvp checks if Rsvp has been set in FlowHeader + HasRsvp() bool + setNil() +} + +type FlowHeaderChoiceEnum string + +// Enum of Choice on FlowHeader +var FlowHeaderChoice = struct { + CUSTOM FlowHeaderChoiceEnum + ETHERNET FlowHeaderChoiceEnum + VLAN FlowHeaderChoiceEnum + VXLAN FlowHeaderChoiceEnum + IPV4 FlowHeaderChoiceEnum + IPV6 FlowHeaderChoiceEnum + PFCPAUSE FlowHeaderChoiceEnum + ETHERNETPAUSE FlowHeaderChoiceEnum + TCP FlowHeaderChoiceEnum + UDP FlowHeaderChoiceEnum + GRE FlowHeaderChoiceEnum + GTPV1 FlowHeaderChoiceEnum + GTPV2 FlowHeaderChoiceEnum + ARP FlowHeaderChoiceEnum + ICMP FlowHeaderChoiceEnum + ICMPV6 FlowHeaderChoiceEnum + PPP FlowHeaderChoiceEnum + IGMPV1 FlowHeaderChoiceEnum + MPLS FlowHeaderChoiceEnum + SNMPV2C FlowHeaderChoiceEnum + RSVP FlowHeaderChoiceEnum +}{ + CUSTOM: FlowHeaderChoiceEnum("custom"), + ETHERNET: FlowHeaderChoiceEnum("ethernet"), + VLAN: FlowHeaderChoiceEnum("vlan"), + VXLAN: FlowHeaderChoiceEnum("vxlan"), + IPV4: FlowHeaderChoiceEnum("ipv4"), + IPV6: FlowHeaderChoiceEnum("ipv6"), + PFCPAUSE: FlowHeaderChoiceEnum("pfcpause"), + ETHERNETPAUSE: FlowHeaderChoiceEnum("ethernetpause"), + TCP: FlowHeaderChoiceEnum("tcp"), + UDP: FlowHeaderChoiceEnum("udp"), + GRE: FlowHeaderChoiceEnum("gre"), + GTPV1: FlowHeaderChoiceEnum("gtpv1"), + GTPV2: FlowHeaderChoiceEnum("gtpv2"), + ARP: FlowHeaderChoiceEnum("arp"), + ICMP: FlowHeaderChoiceEnum("icmp"), + ICMPV6: FlowHeaderChoiceEnum("icmpv6"), + PPP: FlowHeaderChoiceEnum("ppp"), + IGMPV1: FlowHeaderChoiceEnum("igmpv1"), + MPLS: FlowHeaderChoiceEnum("mpls"), + SNMPV2C: FlowHeaderChoiceEnum("snmpv2c"), + RSVP: FlowHeaderChoiceEnum("rsvp"), +} + +func (obj *flowHeader) Choice() FlowHeaderChoiceEnum { + return FlowHeaderChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The available types of flow headers. If one is not provided the +// default ethernet packet header MUST be provided. +// Choice returns a string +func (obj *flowHeader) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowHeader) setChoice(value FlowHeaderChoiceEnum) FlowHeader { + intValue, ok := otg.FlowHeader_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowHeaderChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowHeader_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Rsvp = nil + obj.rsvpHolder = nil + obj.obj.Snmpv2C = nil + obj.snmpv2CHolder = nil + obj.obj.Mpls = nil + obj.mplsHolder = nil + obj.obj.Igmpv1 = nil + obj.igmpv1Holder = nil + obj.obj.Ppp = nil + obj.pppHolder = nil + obj.obj.Icmpv6 = nil + obj.icmpv6Holder = nil + obj.obj.Icmp = nil + obj.icmpHolder = nil + obj.obj.Arp = nil + obj.arpHolder = nil + obj.obj.Gtpv2 = nil + obj.gtpv2Holder = nil + obj.obj.Gtpv1 = nil + obj.gtpv1Holder = nil + obj.obj.Gre = nil + obj.greHolder = nil + obj.obj.Udp = nil + obj.udpHolder = nil + obj.obj.Tcp = nil + obj.tcpHolder = nil + obj.obj.Ethernetpause = nil + obj.ethernetpauseHolder = nil + obj.obj.Pfcpause = nil + obj.pfcpauseHolder = nil + obj.obj.Ipv6 = nil + obj.ipv6Holder = nil + obj.obj.Ipv4 = nil + obj.ipv4Holder = nil + obj.obj.Vxlan = nil + obj.vxlanHolder = nil + obj.obj.Vlan = nil + obj.vlanHolder = nil + obj.obj.Ethernet = nil + obj.ethernetHolder = nil + obj.obj.Custom = nil + obj.customHolder = nil + + if value == FlowHeaderChoice.CUSTOM { + obj.obj.Custom = NewFlowCustom().msg() + } + + if value == FlowHeaderChoice.ETHERNET { + obj.obj.Ethernet = NewFlowEthernet().msg() + } + + if value == FlowHeaderChoice.VLAN { + obj.obj.Vlan = NewFlowVlan().msg() + } + + if value == FlowHeaderChoice.VXLAN { + obj.obj.Vxlan = NewFlowVxlan().msg() + } + + if value == FlowHeaderChoice.IPV4 { + obj.obj.Ipv4 = NewFlowIpv4().msg() + } + + if value == FlowHeaderChoice.IPV6 { + obj.obj.Ipv6 = NewFlowIpv6().msg() + } + + if value == FlowHeaderChoice.PFCPAUSE { + obj.obj.Pfcpause = NewFlowPfcPause().msg() + } + + if value == FlowHeaderChoice.ETHERNETPAUSE { + obj.obj.Ethernetpause = NewFlowEthernetPause().msg() + } + + if value == FlowHeaderChoice.TCP { + obj.obj.Tcp = NewFlowTcp().msg() + } + + if value == FlowHeaderChoice.UDP { + obj.obj.Udp = NewFlowUdp().msg() + } + + if value == FlowHeaderChoice.GRE { + obj.obj.Gre = NewFlowGre().msg() + } + + if value == FlowHeaderChoice.GTPV1 { + obj.obj.Gtpv1 = NewFlowGtpv1().msg() + } + + if value == FlowHeaderChoice.GTPV2 { + obj.obj.Gtpv2 = NewFlowGtpv2().msg() + } + + if value == FlowHeaderChoice.ARP { + obj.obj.Arp = NewFlowArp().msg() + } + + if value == FlowHeaderChoice.ICMP { + obj.obj.Icmp = NewFlowIcmp().msg() + } + + if value == FlowHeaderChoice.ICMPV6 { + obj.obj.Icmpv6 = NewFlowIcmpv6().msg() + } + + if value == FlowHeaderChoice.PPP { + obj.obj.Ppp = NewFlowPpp().msg() + } + + if value == FlowHeaderChoice.IGMPV1 { + obj.obj.Igmpv1 = NewFlowIgmpv1().msg() + } + + if value == FlowHeaderChoice.MPLS { + obj.obj.Mpls = NewFlowMpls().msg() + } + + if value == FlowHeaderChoice.SNMPV2C { + obj.obj.Snmpv2C = NewFlowSnmpv2C().msg() + } + + if value == FlowHeaderChoice.RSVP { + obj.obj.Rsvp = NewFlowRsvp().msg() + } + + return obj +} + +// description is TBD +// Custom returns a FlowCustom +func (obj *flowHeader) Custom() FlowCustom { + if obj.obj.Custom == nil { + obj.setChoice(FlowHeaderChoice.CUSTOM) + } + if obj.customHolder == nil { + obj.customHolder = &flowCustom{obj: obj.obj.Custom} + } + return obj.customHolder +} + +// description is TBD +// Custom returns a FlowCustom +func (obj *flowHeader) HasCustom() bool { + return obj.obj.Custom != nil +} + +// description is TBD +// SetCustom sets the FlowCustom value in the FlowHeader object +func (obj *flowHeader) SetCustom(value FlowCustom) FlowHeader { + obj.setChoice(FlowHeaderChoice.CUSTOM) + obj.customHolder = nil + obj.obj.Custom = value.msg() + + return obj +} + +// description is TBD +// Ethernet returns a FlowEthernet +func (obj *flowHeader) Ethernet() FlowEthernet { + if obj.obj.Ethernet == nil { + obj.setChoice(FlowHeaderChoice.ETHERNET) + } + if obj.ethernetHolder == nil { + obj.ethernetHolder = &flowEthernet{obj: obj.obj.Ethernet} + } + return obj.ethernetHolder +} + +// description is TBD +// Ethernet returns a FlowEthernet +func (obj *flowHeader) HasEthernet() bool { + return obj.obj.Ethernet != nil +} + +// description is TBD +// SetEthernet sets the FlowEthernet value in the FlowHeader object +func (obj *flowHeader) SetEthernet(value FlowEthernet) FlowHeader { + obj.setChoice(FlowHeaderChoice.ETHERNET) + obj.ethernetHolder = nil + obj.obj.Ethernet = value.msg() + + return obj +} + +// description is TBD +// Vlan returns a FlowVlan +func (obj *flowHeader) Vlan() FlowVlan { + if obj.obj.Vlan == nil { + obj.setChoice(FlowHeaderChoice.VLAN) + } + if obj.vlanHolder == nil { + obj.vlanHolder = &flowVlan{obj: obj.obj.Vlan} + } + return obj.vlanHolder +} + +// description is TBD +// Vlan returns a FlowVlan +func (obj *flowHeader) HasVlan() bool { + return obj.obj.Vlan != nil +} + +// description is TBD +// SetVlan sets the FlowVlan value in the FlowHeader object +func (obj *flowHeader) SetVlan(value FlowVlan) FlowHeader { + obj.setChoice(FlowHeaderChoice.VLAN) + obj.vlanHolder = nil + obj.obj.Vlan = value.msg() + + return obj +} + +// description is TBD +// Vxlan returns a FlowVxlan +func (obj *flowHeader) Vxlan() FlowVxlan { + if obj.obj.Vxlan == nil { + obj.setChoice(FlowHeaderChoice.VXLAN) + } + if obj.vxlanHolder == nil { + obj.vxlanHolder = &flowVxlan{obj: obj.obj.Vxlan} + } + return obj.vxlanHolder +} + +// description is TBD +// Vxlan returns a FlowVxlan +func (obj *flowHeader) HasVxlan() bool { + return obj.obj.Vxlan != nil +} + +// description is TBD +// SetVxlan sets the FlowVxlan value in the FlowHeader object +func (obj *flowHeader) SetVxlan(value FlowVxlan) FlowHeader { + obj.setChoice(FlowHeaderChoice.VXLAN) + obj.vxlanHolder = nil + obj.obj.Vxlan = value.msg() + + return obj +} + +// description is TBD +// Ipv4 returns a FlowIpv4 +func (obj *flowHeader) Ipv4() FlowIpv4 { + if obj.obj.Ipv4 == nil { + obj.setChoice(FlowHeaderChoice.IPV4) + } + if obj.ipv4Holder == nil { + obj.ipv4Holder = &flowIpv4{obj: obj.obj.Ipv4} + } + return obj.ipv4Holder +} + +// description is TBD +// Ipv4 returns a FlowIpv4 +func (obj *flowHeader) HasIpv4() bool { + return obj.obj.Ipv4 != nil +} + +// description is TBD +// SetIpv4 sets the FlowIpv4 value in the FlowHeader object +func (obj *flowHeader) SetIpv4(value FlowIpv4) FlowHeader { + obj.setChoice(FlowHeaderChoice.IPV4) + obj.ipv4Holder = nil + obj.obj.Ipv4 = value.msg() + + return obj +} + +// description is TBD +// Ipv6 returns a FlowIpv6 +func (obj *flowHeader) Ipv6() FlowIpv6 { + if obj.obj.Ipv6 == nil { + obj.setChoice(FlowHeaderChoice.IPV6) + } + if obj.ipv6Holder == nil { + obj.ipv6Holder = &flowIpv6{obj: obj.obj.Ipv6} + } + return obj.ipv6Holder +} + +// description is TBD +// Ipv6 returns a FlowIpv6 +func (obj *flowHeader) HasIpv6() bool { + return obj.obj.Ipv6 != nil +} + +// description is TBD +// SetIpv6 sets the FlowIpv6 value in the FlowHeader object +func (obj *flowHeader) SetIpv6(value FlowIpv6) FlowHeader { + obj.setChoice(FlowHeaderChoice.IPV6) + obj.ipv6Holder = nil + obj.obj.Ipv6 = value.msg() + + return obj +} + +// description is TBD +// Pfcpause returns a FlowPfcPause +func (obj *flowHeader) Pfcpause() FlowPfcPause { + if obj.obj.Pfcpause == nil { + obj.setChoice(FlowHeaderChoice.PFCPAUSE) + } + if obj.pfcpauseHolder == nil { + obj.pfcpauseHolder = &flowPfcPause{obj: obj.obj.Pfcpause} + } + return obj.pfcpauseHolder +} + +// description is TBD +// Pfcpause returns a FlowPfcPause +func (obj *flowHeader) HasPfcpause() bool { + return obj.obj.Pfcpause != nil +} + +// description is TBD +// SetPfcpause sets the FlowPfcPause value in the FlowHeader object +func (obj *flowHeader) SetPfcpause(value FlowPfcPause) FlowHeader { + obj.setChoice(FlowHeaderChoice.PFCPAUSE) + obj.pfcpauseHolder = nil + obj.obj.Pfcpause = value.msg() + + return obj +} + +// description is TBD +// Ethernetpause returns a FlowEthernetPause +func (obj *flowHeader) Ethernetpause() FlowEthernetPause { + if obj.obj.Ethernetpause == nil { + obj.setChoice(FlowHeaderChoice.ETHERNETPAUSE) + } + if obj.ethernetpauseHolder == nil { + obj.ethernetpauseHolder = &flowEthernetPause{obj: obj.obj.Ethernetpause} + } + return obj.ethernetpauseHolder +} + +// description is TBD +// Ethernetpause returns a FlowEthernetPause +func (obj *flowHeader) HasEthernetpause() bool { + return obj.obj.Ethernetpause != nil +} + +// description is TBD +// SetEthernetpause sets the FlowEthernetPause value in the FlowHeader object +func (obj *flowHeader) SetEthernetpause(value FlowEthernetPause) FlowHeader { + obj.setChoice(FlowHeaderChoice.ETHERNETPAUSE) + obj.ethernetpauseHolder = nil + obj.obj.Ethernetpause = value.msg() + + return obj +} + +// description is TBD +// Tcp returns a FlowTcp +func (obj *flowHeader) Tcp() FlowTcp { + if obj.obj.Tcp == nil { + obj.setChoice(FlowHeaderChoice.TCP) + } + if obj.tcpHolder == nil { + obj.tcpHolder = &flowTcp{obj: obj.obj.Tcp} + } + return obj.tcpHolder +} + +// description is TBD +// Tcp returns a FlowTcp +func (obj *flowHeader) HasTcp() bool { + return obj.obj.Tcp != nil +} + +// description is TBD +// SetTcp sets the FlowTcp value in the FlowHeader object +func (obj *flowHeader) SetTcp(value FlowTcp) FlowHeader { + obj.setChoice(FlowHeaderChoice.TCP) + obj.tcpHolder = nil + obj.obj.Tcp = value.msg() + + return obj +} + +// description is TBD +// Udp returns a FlowUdp +func (obj *flowHeader) Udp() FlowUdp { + if obj.obj.Udp == nil { + obj.setChoice(FlowHeaderChoice.UDP) + } + if obj.udpHolder == nil { + obj.udpHolder = &flowUdp{obj: obj.obj.Udp} + } + return obj.udpHolder +} + +// description is TBD +// Udp returns a FlowUdp +func (obj *flowHeader) HasUdp() bool { + return obj.obj.Udp != nil +} + +// description is TBD +// SetUdp sets the FlowUdp value in the FlowHeader object +func (obj *flowHeader) SetUdp(value FlowUdp) FlowHeader { + obj.setChoice(FlowHeaderChoice.UDP) + obj.udpHolder = nil + obj.obj.Udp = value.msg() + + return obj +} + +// description is TBD +// Gre returns a FlowGre +func (obj *flowHeader) Gre() FlowGre { + if obj.obj.Gre == nil { + obj.setChoice(FlowHeaderChoice.GRE) + } + if obj.greHolder == nil { + obj.greHolder = &flowGre{obj: obj.obj.Gre} + } + return obj.greHolder +} + +// description is TBD +// Gre returns a FlowGre +func (obj *flowHeader) HasGre() bool { + return obj.obj.Gre != nil +} + +// description is TBD +// SetGre sets the FlowGre value in the FlowHeader object +func (obj *flowHeader) SetGre(value FlowGre) FlowHeader { + obj.setChoice(FlowHeaderChoice.GRE) + obj.greHolder = nil + obj.obj.Gre = value.msg() + + return obj +} + +// description is TBD +// Gtpv1 returns a FlowGtpv1 +func (obj *flowHeader) Gtpv1() FlowGtpv1 { + if obj.obj.Gtpv1 == nil { + obj.setChoice(FlowHeaderChoice.GTPV1) + } + if obj.gtpv1Holder == nil { + obj.gtpv1Holder = &flowGtpv1{obj: obj.obj.Gtpv1} + } + return obj.gtpv1Holder +} + +// description is TBD +// Gtpv1 returns a FlowGtpv1 +func (obj *flowHeader) HasGtpv1() bool { + return obj.obj.Gtpv1 != nil +} + +// description is TBD +// SetGtpv1 sets the FlowGtpv1 value in the FlowHeader object +func (obj *flowHeader) SetGtpv1(value FlowGtpv1) FlowHeader { + obj.setChoice(FlowHeaderChoice.GTPV1) + obj.gtpv1Holder = nil + obj.obj.Gtpv1 = value.msg() + + return obj +} + +// description is TBD +// Gtpv2 returns a FlowGtpv2 +func (obj *flowHeader) Gtpv2() FlowGtpv2 { + if obj.obj.Gtpv2 == nil { + obj.setChoice(FlowHeaderChoice.GTPV2) + } + if obj.gtpv2Holder == nil { + obj.gtpv2Holder = &flowGtpv2{obj: obj.obj.Gtpv2} + } + return obj.gtpv2Holder +} + +// description is TBD +// Gtpv2 returns a FlowGtpv2 +func (obj *flowHeader) HasGtpv2() bool { + return obj.obj.Gtpv2 != nil +} + +// description is TBD +// SetGtpv2 sets the FlowGtpv2 value in the FlowHeader object +func (obj *flowHeader) SetGtpv2(value FlowGtpv2) FlowHeader { + obj.setChoice(FlowHeaderChoice.GTPV2) + obj.gtpv2Holder = nil + obj.obj.Gtpv2 = value.msg() + + return obj +} + +// description is TBD +// Arp returns a FlowArp +func (obj *flowHeader) Arp() FlowArp { + if obj.obj.Arp == nil { + obj.setChoice(FlowHeaderChoice.ARP) + } + if obj.arpHolder == nil { + obj.arpHolder = &flowArp{obj: obj.obj.Arp} + } + return obj.arpHolder +} + +// description is TBD +// Arp returns a FlowArp +func (obj *flowHeader) HasArp() bool { + return obj.obj.Arp != nil +} + +// description is TBD +// SetArp sets the FlowArp value in the FlowHeader object +func (obj *flowHeader) SetArp(value FlowArp) FlowHeader { + obj.setChoice(FlowHeaderChoice.ARP) + obj.arpHolder = nil + obj.obj.Arp = value.msg() + + return obj +} + +// description is TBD +// Icmp returns a FlowIcmp +func (obj *flowHeader) Icmp() FlowIcmp { + if obj.obj.Icmp == nil { + obj.setChoice(FlowHeaderChoice.ICMP) + } + if obj.icmpHolder == nil { + obj.icmpHolder = &flowIcmp{obj: obj.obj.Icmp} + } + return obj.icmpHolder +} + +// description is TBD +// Icmp returns a FlowIcmp +func (obj *flowHeader) HasIcmp() bool { + return obj.obj.Icmp != nil +} + +// description is TBD +// SetIcmp sets the FlowIcmp value in the FlowHeader object +func (obj *flowHeader) SetIcmp(value FlowIcmp) FlowHeader { + obj.setChoice(FlowHeaderChoice.ICMP) + obj.icmpHolder = nil + obj.obj.Icmp = value.msg() + + return obj +} + +// description is TBD +// Icmpv6 returns a FlowIcmpv6 +func (obj *flowHeader) Icmpv6() FlowIcmpv6 { + if obj.obj.Icmpv6 == nil { + obj.setChoice(FlowHeaderChoice.ICMPV6) + } + if obj.icmpv6Holder == nil { + obj.icmpv6Holder = &flowIcmpv6{obj: obj.obj.Icmpv6} + } + return obj.icmpv6Holder +} + +// description is TBD +// Icmpv6 returns a FlowIcmpv6 +func (obj *flowHeader) HasIcmpv6() bool { + return obj.obj.Icmpv6 != nil +} + +// description is TBD +// SetIcmpv6 sets the FlowIcmpv6 value in the FlowHeader object +func (obj *flowHeader) SetIcmpv6(value FlowIcmpv6) FlowHeader { + obj.setChoice(FlowHeaderChoice.ICMPV6) + obj.icmpv6Holder = nil + obj.obj.Icmpv6 = value.msg() + + return obj +} + +// description is TBD +// Ppp returns a FlowPpp +func (obj *flowHeader) Ppp() FlowPpp { + if obj.obj.Ppp == nil { + obj.setChoice(FlowHeaderChoice.PPP) + } + if obj.pppHolder == nil { + obj.pppHolder = &flowPpp{obj: obj.obj.Ppp} + } + return obj.pppHolder +} + +// description is TBD +// Ppp returns a FlowPpp +func (obj *flowHeader) HasPpp() bool { + return obj.obj.Ppp != nil +} + +// description is TBD +// SetPpp sets the FlowPpp value in the FlowHeader object +func (obj *flowHeader) SetPpp(value FlowPpp) FlowHeader { + obj.setChoice(FlowHeaderChoice.PPP) + obj.pppHolder = nil + obj.obj.Ppp = value.msg() + + return obj +} + +// description is TBD +// Igmpv1 returns a FlowIgmpv1 +func (obj *flowHeader) Igmpv1() FlowIgmpv1 { + if obj.obj.Igmpv1 == nil { + obj.setChoice(FlowHeaderChoice.IGMPV1) + } + if obj.igmpv1Holder == nil { + obj.igmpv1Holder = &flowIgmpv1{obj: obj.obj.Igmpv1} + } + return obj.igmpv1Holder +} + +// description is TBD +// Igmpv1 returns a FlowIgmpv1 +func (obj *flowHeader) HasIgmpv1() bool { + return obj.obj.Igmpv1 != nil +} + +// description is TBD +// SetIgmpv1 sets the FlowIgmpv1 value in the FlowHeader object +func (obj *flowHeader) SetIgmpv1(value FlowIgmpv1) FlowHeader { + obj.setChoice(FlowHeaderChoice.IGMPV1) + obj.igmpv1Holder = nil + obj.obj.Igmpv1 = value.msg() + + return obj +} + +// description is TBD +// Mpls returns a FlowMpls +func (obj *flowHeader) Mpls() FlowMpls { + if obj.obj.Mpls == nil { + obj.setChoice(FlowHeaderChoice.MPLS) + } + if obj.mplsHolder == nil { + obj.mplsHolder = &flowMpls{obj: obj.obj.Mpls} + } + return obj.mplsHolder +} + +// description is TBD +// Mpls returns a FlowMpls +func (obj *flowHeader) HasMpls() bool { + return obj.obj.Mpls != nil +} + +// description is TBD +// SetMpls sets the FlowMpls value in the FlowHeader object +func (obj *flowHeader) SetMpls(value FlowMpls) FlowHeader { + obj.setChoice(FlowHeaderChoice.MPLS) + obj.mplsHolder = nil + obj.obj.Mpls = value.msg() + + return obj +} + +// description is TBD +// Snmpv2C returns a FlowSnmpv2C +func (obj *flowHeader) Snmpv2C() FlowSnmpv2C { + if obj.obj.Snmpv2C == nil { + obj.setChoice(FlowHeaderChoice.SNMPV2C) + } + if obj.snmpv2CHolder == nil { + obj.snmpv2CHolder = &flowSnmpv2C{obj: obj.obj.Snmpv2C} + } + return obj.snmpv2CHolder +} + +// description is TBD +// Snmpv2C returns a FlowSnmpv2C +func (obj *flowHeader) HasSnmpv2C() bool { + return obj.obj.Snmpv2C != nil +} + +// description is TBD +// SetSnmpv2C sets the FlowSnmpv2C value in the FlowHeader object +func (obj *flowHeader) SetSnmpv2C(value FlowSnmpv2C) FlowHeader { + obj.setChoice(FlowHeaderChoice.SNMPV2C) + obj.snmpv2CHolder = nil + obj.obj.Snmpv2C = value.msg() + + return obj +} + +// description is TBD +// Rsvp returns a FlowRsvp +func (obj *flowHeader) Rsvp() FlowRsvp { + if obj.obj.Rsvp == nil { + obj.setChoice(FlowHeaderChoice.RSVP) + } + if obj.rsvpHolder == nil { + obj.rsvpHolder = &flowRsvp{obj: obj.obj.Rsvp} + } + return obj.rsvpHolder +} + +// description is TBD +// Rsvp returns a FlowRsvp +func (obj *flowHeader) HasRsvp() bool { + return obj.obj.Rsvp != nil +} + +// description is TBD +// SetRsvp sets the FlowRsvp value in the FlowHeader object +func (obj *flowHeader) SetRsvp(value FlowRsvp) FlowHeader { + obj.setChoice(FlowHeaderChoice.RSVP) + obj.rsvpHolder = nil + obj.obj.Rsvp = value.msg() + + return obj +} + +func (obj *flowHeader) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Custom != nil { + + obj.Custom().validateObj(vObj, set_default) + } + + if obj.obj.Ethernet != nil { + + obj.Ethernet().validateObj(vObj, set_default) + } + + if obj.obj.Vlan != nil { + + obj.Vlan().validateObj(vObj, set_default) + } + + if obj.obj.Vxlan != nil { + + obj.Vxlan().validateObj(vObj, set_default) + } + + if obj.obj.Ipv4 != nil { + + obj.Ipv4().validateObj(vObj, set_default) + } + + if obj.obj.Ipv6 != nil { + + obj.Ipv6().validateObj(vObj, set_default) + } + + if obj.obj.Pfcpause != nil { + + obj.Pfcpause().validateObj(vObj, set_default) + } + + if obj.obj.Ethernetpause != nil { + + obj.Ethernetpause().validateObj(vObj, set_default) + } + + if obj.obj.Tcp != nil { + + obj.Tcp().validateObj(vObj, set_default) + } + + if obj.obj.Udp != nil { + + obj.Udp().validateObj(vObj, set_default) + } + + if obj.obj.Gre != nil { + + obj.Gre().validateObj(vObj, set_default) + } + + if obj.obj.Gtpv1 != nil { + + obj.Gtpv1().validateObj(vObj, set_default) + } + + if obj.obj.Gtpv2 != nil { + + obj.Gtpv2().validateObj(vObj, set_default) + } + + if obj.obj.Arp != nil { + + obj.Arp().validateObj(vObj, set_default) + } + + if obj.obj.Icmp != nil { + + obj.Icmp().validateObj(vObj, set_default) + } + + if obj.obj.Icmpv6 != nil { + + obj.Icmpv6().validateObj(vObj, set_default) + } + + if obj.obj.Ppp != nil { + + obj.Ppp().validateObj(vObj, set_default) + } + + if obj.obj.Igmpv1 != nil { + + obj.Igmpv1().validateObj(vObj, set_default) + } + + if obj.obj.Mpls != nil { + + obj.Mpls().validateObj(vObj, set_default) + } + + if obj.obj.Snmpv2C != nil { + + obj.Snmpv2C().validateObj(vObj, set_default) + } + + if obj.obj.Rsvp != nil { + + obj.Rsvp().validateObj(vObj, set_default) + } + +} + +func (obj *flowHeader) setDefault() { + var choices_set int = 0 + var choice FlowHeaderChoiceEnum + + if obj.obj.Custom != nil { + choices_set += 1 + choice = FlowHeaderChoice.CUSTOM + } + + if obj.obj.Ethernet != nil { + choices_set += 1 + choice = FlowHeaderChoice.ETHERNET + } + + if obj.obj.Vlan != nil { + choices_set += 1 + choice = FlowHeaderChoice.VLAN + } + + if obj.obj.Vxlan != nil { + choices_set += 1 + choice = FlowHeaderChoice.VXLAN + } + + if obj.obj.Ipv4 != nil { + choices_set += 1 + choice = FlowHeaderChoice.IPV4 + } + + if obj.obj.Ipv6 != nil { + choices_set += 1 + choice = FlowHeaderChoice.IPV6 + } + + if obj.obj.Pfcpause != nil { + choices_set += 1 + choice = FlowHeaderChoice.PFCPAUSE + } + + if obj.obj.Ethernetpause != nil { + choices_set += 1 + choice = FlowHeaderChoice.ETHERNETPAUSE + } + + if obj.obj.Tcp != nil { + choices_set += 1 + choice = FlowHeaderChoice.TCP + } + + if obj.obj.Udp != nil { + choices_set += 1 + choice = FlowHeaderChoice.UDP + } + + if obj.obj.Gre != nil { + choices_set += 1 + choice = FlowHeaderChoice.GRE + } + + if obj.obj.Gtpv1 != nil { + choices_set += 1 + choice = FlowHeaderChoice.GTPV1 + } + + if obj.obj.Gtpv2 != nil { + choices_set += 1 + choice = FlowHeaderChoice.GTPV2 + } + + if obj.obj.Arp != nil { + choices_set += 1 + choice = FlowHeaderChoice.ARP + } + + if obj.obj.Icmp != nil { + choices_set += 1 + choice = FlowHeaderChoice.ICMP + } + + if obj.obj.Icmpv6 != nil { + choices_set += 1 + choice = FlowHeaderChoice.ICMPV6 + } + + if obj.obj.Ppp != nil { + choices_set += 1 + choice = FlowHeaderChoice.PPP + } + + if obj.obj.Igmpv1 != nil { + choices_set += 1 + choice = FlowHeaderChoice.IGMPV1 + } + + if obj.obj.Mpls != nil { + choices_set += 1 + choice = FlowHeaderChoice.MPLS + } + + if obj.obj.Snmpv2C != nil { + choices_set += 1 + choice = FlowHeaderChoice.SNMPV2C + } + + if obj.obj.Rsvp != nil { + choices_set += 1 + choice = FlowHeaderChoice.RSVP + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowHeaderChoice.ETHERNET) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowHeader") + } + } else { + intVal := otg.FlowHeader_Choice_Enum_value[string(choice)] + enumValue := otg.FlowHeader_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_icmp.go b/gosnappi/flow_icmp.go new file mode 100644 index 00000000..5e86943d --- /dev/null +++ b/gosnappi/flow_icmp.go @@ -0,0 +1,396 @@ +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" +) + +// ***** FlowIcmp ***** +type flowIcmp struct { + validation + obj *otg.FlowIcmp + marshaller marshalFlowIcmp + unMarshaller unMarshalFlowIcmp + echoHolder FlowIcmpEcho +} + +func NewFlowIcmp() FlowIcmp { + obj := flowIcmp{obj: &otg.FlowIcmp{}} + obj.setDefault() + return &obj +} + +func (obj *flowIcmp) msg() *otg.FlowIcmp { + return obj.obj +} + +func (obj *flowIcmp) setMsg(msg *otg.FlowIcmp) FlowIcmp { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIcmp struct { + obj *flowIcmp +} + +type marshalFlowIcmp interface { + // ToProto marshals FlowIcmp to protobuf object *otg.FlowIcmp + ToProto() (*otg.FlowIcmp, error) + // ToPbText marshals FlowIcmp to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIcmp to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIcmp to JSON text + ToJson() (string, error) +} + +type unMarshalflowIcmp struct { + obj *flowIcmp +} + +type unMarshalFlowIcmp interface { + // FromProto unmarshals FlowIcmp from protobuf object *otg.FlowIcmp + FromProto(msg *otg.FlowIcmp) (FlowIcmp, error) + // FromPbText unmarshals FlowIcmp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIcmp from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIcmp from JSON text + FromJson(value string) error +} + +func (obj *flowIcmp) Marshal() marshalFlowIcmp { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIcmp{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIcmp) Unmarshal() unMarshalFlowIcmp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIcmp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIcmp) ToProto() (*otg.FlowIcmp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIcmp) FromProto(msg *otg.FlowIcmp) (FlowIcmp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIcmp) 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 *unMarshalflowIcmp) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowIcmp) 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 *unMarshalflowIcmp) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowIcmp) 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 *unMarshalflowIcmp) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowIcmp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIcmp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIcmp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIcmp) Clone() (FlowIcmp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIcmp() + 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 +} + +func (obj *flowIcmp) setNil() { + obj.echoHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowIcmp is iCMP packet header +type FlowIcmp interface { + Validation + // msg marshals FlowIcmp to protobuf object *otg.FlowIcmp + // and doesn't set defaults + msg() *otg.FlowIcmp + // setMsg unmarshals FlowIcmp from protobuf object *otg.FlowIcmp + // and doesn't set defaults + setMsg(*otg.FlowIcmp) FlowIcmp + // provides marshal interface + Marshal() marshalFlowIcmp + // provides unmarshal interface + Unmarshal() unMarshalFlowIcmp + // validate validates FlowIcmp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIcmp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowIcmpChoiceEnum, set in FlowIcmp + Choice() FlowIcmpChoiceEnum + // setChoice assigns FlowIcmpChoiceEnum provided by user to FlowIcmp + setChoice(value FlowIcmpChoiceEnum) FlowIcmp + // HasChoice checks if Choice has been set in FlowIcmp + HasChoice() bool + // Echo returns FlowIcmpEcho, set in FlowIcmp. + // FlowIcmpEcho is packet Header for ICMP echo request + Echo() FlowIcmpEcho + // SetEcho assigns FlowIcmpEcho provided by user to FlowIcmp. + // FlowIcmpEcho is packet Header for ICMP echo request + SetEcho(value FlowIcmpEcho) FlowIcmp + // HasEcho checks if Echo has been set in FlowIcmp + HasEcho() bool + setNil() +} + +type FlowIcmpChoiceEnum string + +// Enum of Choice on FlowIcmp +var FlowIcmpChoice = struct { + ECHO FlowIcmpChoiceEnum +}{ + ECHO: FlowIcmpChoiceEnum("echo"), +} + +func (obj *flowIcmp) Choice() FlowIcmpChoiceEnum { + return FlowIcmpChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowIcmp) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowIcmp) setChoice(value FlowIcmpChoiceEnum) FlowIcmp { + intValue, ok := otg.FlowIcmp_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowIcmpChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowIcmp_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Echo = nil + obj.echoHolder = nil + + if value == FlowIcmpChoice.ECHO { + obj.obj.Echo = NewFlowIcmpEcho().msg() + } + + return obj +} + +// description is TBD +// Echo returns a FlowIcmpEcho +func (obj *flowIcmp) Echo() FlowIcmpEcho { + if obj.obj.Echo == nil { + obj.setChoice(FlowIcmpChoice.ECHO) + } + if obj.echoHolder == nil { + obj.echoHolder = &flowIcmpEcho{obj: obj.obj.Echo} + } + return obj.echoHolder +} + +// description is TBD +// Echo returns a FlowIcmpEcho +func (obj *flowIcmp) HasEcho() bool { + return obj.obj.Echo != nil +} + +// description is TBD +// SetEcho sets the FlowIcmpEcho value in the FlowIcmp object +func (obj *flowIcmp) SetEcho(value FlowIcmpEcho) FlowIcmp { + obj.setChoice(FlowIcmpChoice.ECHO) + obj.echoHolder = nil + obj.obj.Echo = value.msg() + + return obj +} + +func (obj *flowIcmp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Echo != nil { + + obj.Echo().validateObj(vObj, set_default) + } + +} + +func (obj *flowIcmp) setDefault() { + var choices_set int = 0 + var choice FlowIcmpChoiceEnum + + if obj.obj.Echo != nil { + choices_set += 1 + choice = FlowIcmpChoice.ECHO + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowIcmpChoice.ECHO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowIcmp") + } + } else { + intVal := otg.FlowIcmp_Choice_Enum_value[string(choice)] + enumValue := otg.FlowIcmp_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_icmp_echo.go b/gosnappi/flow_icmp_echo.go new file mode 100644 index 00000000..f2f1a4de --- /dev/null +++ b/gosnappi/flow_icmp_echo.go @@ -0,0 +1,500 @@ +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" +) + +// ***** FlowIcmpEcho ***** +type flowIcmpEcho struct { + validation + obj *otg.FlowIcmpEcho + marshaller marshalFlowIcmpEcho + unMarshaller unMarshalFlowIcmpEcho + typeHolder PatternFlowIcmpEchoType + codeHolder PatternFlowIcmpEchoCode + checksumHolder PatternFlowIcmpEchoChecksum + identifierHolder PatternFlowIcmpEchoIdentifier + sequenceNumberHolder PatternFlowIcmpEchoSequenceNumber +} + +func NewFlowIcmpEcho() FlowIcmpEcho { + obj := flowIcmpEcho{obj: &otg.FlowIcmpEcho{}} + obj.setDefault() + return &obj +} + +func (obj *flowIcmpEcho) msg() *otg.FlowIcmpEcho { + return obj.obj +} + +func (obj *flowIcmpEcho) setMsg(msg *otg.FlowIcmpEcho) FlowIcmpEcho { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIcmpEcho struct { + obj *flowIcmpEcho +} + +type marshalFlowIcmpEcho interface { + // ToProto marshals FlowIcmpEcho to protobuf object *otg.FlowIcmpEcho + ToProto() (*otg.FlowIcmpEcho, error) + // ToPbText marshals FlowIcmpEcho to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIcmpEcho to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIcmpEcho to JSON text + ToJson() (string, error) +} + +type unMarshalflowIcmpEcho struct { + obj *flowIcmpEcho +} + +type unMarshalFlowIcmpEcho interface { + // FromProto unmarshals FlowIcmpEcho from protobuf object *otg.FlowIcmpEcho + FromProto(msg *otg.FlowIcmpEcho) (FlowIcmpEcho, error) + // FromPbText unmarshals FlowIcmpEcho from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIcmpEcho from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIcmpEcho from JSON text + FromJson(value string) error +} + +func (obj *flowIcmpEcho) Marshal() marshalFlowIcmpEcho { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIcmpEcho{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIcmpEcho) Unmarshal() unMarshalFlowIcmpEcho { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIcmpEcho{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIcmpEcho) ToProto() (*otg.FlowIcmpEcho, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIcmpEcho) FromProto(msg *otg.FlowIcmpEcho) (FlowIcmpEcho, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIcmpEcho) 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 *unMarshalflowIcmpEcho) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowIcmpEcho) 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 *unMarshalflowIcmpEcho) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowIcmpEcho) 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 *unMarshalflowIcmpEcho) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowIcmpEcho) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIcmpEcho) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIcmpEcho) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIcmpEcho) Clone() (FlowIcmpEcho, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIcmpEcho() + 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 +} + +func (obj *flowIcmpEcho) setNil() { + obj.typeHolder = nil + obj.codeHolder = nil + obj.checksumHolder = nil + obj.identifierHolder = nil + obj.sequenceNumberHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowIcmpEcho is packet Header for ICMP echo request +type FlowIcmpEcho interface { + Validation + // msg marshals FlowIcmpEcho to protobuf object *otg.FlowIcmpEcho + // and doesn't set defaults + msg() *otg.FlowIcmpEcho + // setMsg unmarshals FlowIcmpEcho from protobuf object *otg.FlowIcmpEcho + // and doesn't set defaults + setMsg(*otg.FlowIcmpEcho) FlowIcmpEcho + // provides marshal interface + Marshal() marshalFlowIcmpEcho + // provides unmarshal interface + Unmarshal() unMarshalFlowIcmpEcho + // validate validates FlowIcmpEcho + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIcmpEcho, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Type returns PatternFlowIcmpEchoType, set in FlowIcmpEcho. + // PatternFlowIcmpEchoType is the type of ICMP echo packet + Type() PatternFlowIcmpEchoType + // SetType assigns PatternFlowIcmpEchoType provided by user to FlowIcmpEcho. + // PatternFlowIcmpEchoType is the type of ICMP echo packet + SetType(value PatternFlowIcmpEchoType) FlowIcmpEcho + // HasType checks if Type has been set in FlowIcmpEcho + HasType() bool + // Code returns PatternFlowIcmpEchoCode, set in FlowIcmpEcho. + // PatternFlowIcmpEchoCode is the ICMP subtype. The default code for ICMP echo request and reply is 0. + Code() PatternFlowIcmpEchoCode + // SetCode assigns PatternFlowIcmpEchoCode provided by user to FlowIcmpEcho. + // PatternFlowIcmpEchoCode is the ICMP subtype. The default code for ICMP echo request and reply is 0. + SetCode(value PatternFlowIcmpEchoCode) FlowIcmpEcho + // HasCode checks if Code has been set in FlowIcmpEcho + HasCode() bool + // Checksum returns PatternFlowIcmpEchoChecksum, set in FlowIcmpEcho. + // PatternFlowIcmpEchoChecksum is iCMP checksum + Checksum() PatternFlowIcmpEchoChecksum + // SetChecksum assigns PatternFlowIcmpEchoChecksum provided by user to FlowIcmpEcho. + // PatternFlowIcmpEchoChecksum is iCMP checksum + SetChecksum(value PatternFlowIcmpEchoChecksum) FlowIcmpEcho + // HasChecksum checks if Checksum has been set in FlowIcmpEcho + HasChecksum() bool + // Identifier returns PatternFlowIcmpEchoIdentifier, set in FlowIcmpEcho. + // PatternFlowIcmpEchoIdentifier is iCMP identifier + Identifier() PatternFlowIcmpEchoIdentifier + // SetIdentifier assigns PatternFlowIcmpEchoIdentifier provided by user to FlowIcmpEcho. + // PatternFlowIcmpEchoIdentifier is iCMP identifier + SetIdentifier(value PatternFlowIcmpEchoIdentifier) FlowIcmpEcho + // HasIdentifier checks if Identifier has been set in FlowIcmpEcho + HasIdentifier() bool + // SequenceNumber returns PatternFlowIcmpEchoSequenceNumber, set in FlowIcmpEcho. + // PatternFlowIcmpEchoSequenceNumber is iCMP sequence number + SequenceNumber() PatternFlowIcmpEchoSequenceNumber + // SetSequenceNumber assigns PatternFlowIcmpEchoSequenceNumber provided by user to FlowIcmpEcho. + // PatternFlowIcmpEchoSequenceNumber is iCMP sequence number + SetSequenceNumber(value PatternFlowIcmpEchoSequenceNumber) FlowIcmpEcho + // HasSequenceNumber checks if SequenceNumber has been set in FlowIcmpEcho + HasSequenceNumber() bool + setNil() +} + +// description is TBD +// Type returns a PatternFlowIcmpEchoType +func (obj *flowIcmpEcho) Type() PatternFlowIcmpEchoType { + if obj.obj.Type == nil { + obj.obj.Type = NewPatternFlowIcmpEchoType().msg() + } + if obj.typeHolder == nil { + obj.typeHolder = &patternFlowIcmpEchoType{obj: obj.obj.Type} + } + return obj.typeHolder +} + +// description is TBD +// Type returns a PatternFlowIcmpEchoType +func (obj *flowIcmpEcho) HasType() bool { + return obj.obj.Type != nil +} + +// description is TBD +// SetType sets the PatternFlowIcmpEchoType value in the FlowIcmpEcho object +func (obj *flowIcmpEcho) SetType(value PatternFlowIcmpEchoType) FlowIcmpEcho { + + obj.typeHolder = nil + obj.obj.Type = value.msg() + + return obj +} + +// description is TBD +// Code returns a PatternFlowIcmpEchoCode +func (obj *flowIcmpEcho) Code() PatternFlowIcmpEchoCode { + if obj.obj.Code == nil { + obj.obj.Code = NewPatternFlowIcmpEchoCode().msg() + } + if obj.codeHolder == nil { + obj.codeHolder = &patternFlowIcmpEchoCode{obj: obj.obj.Code} + } + return obj.codeHolder +} + +// description is TBD +// Code returns a PatternFlowIcmpEchoCode +func (obj *flowIcmpEcho) HasCode() bool { + return obj.obj.Code != nil +} + +// description is TBD +// SetCode sets the PatternFlowIcmpEchoCode value in the FlowIcmpEcho object +func (obj *flowIcmpEcho) SetCode(value PatternFlowIcmpEchoCode) FlowIcmpEcho { + + obj.codeHolder = nil + obj.obj.Code = value.msg() + + return obj +} + +// description is TBD +// Checksum returns a PatternFlowIcmpEchoChecksum +func (obj *flowIcmpEcho) Checksum() PatternFlowIcmpEchoChecksum { + if obj.obj.Checksum == nil { + obj.obj.Checksum = NewPatternFlowIcmpEchoChecksum().msg() + } + if obj.checksumHolder == nil { + obj.checksumHolder = &patternFlowIcmpEchoChecksum{obj: obj.obj.Checksum} + } + return obj.checksumHolder +} + +// description is TBD +// Checksum returns a PatternFlowIcmpEchoChecksum +func (obj *flowIcmpEcho) HasChecksum() bool { + return obj.obj.Checksum != nil +} + +// description is TBD +// SetChecksum sets the PatternFlowIcmpEchoChecksum value in the FlowIcmpEcho object +func (obj *flowIcmpEcho) SetChecksum(value PatternFlowIcmpEchoChecksum) FlowIcmpEcho { + + obj.checksumHolder = nil + obj.obj.Checksum = value.msg() + + return obj +} + +// description is TBD +// Identifier returns a PatternFlowIcmpEchoIdentifier +func (obj *flowIcmpEcho) Identifier() PatternFlowIcmpEchoIdentifier { + if obj.obj.Identifier == nil { + obj.obj.Identifier = NewPatternFlowIcmpEchoIdentifier().msg() + } + if obj.identifierHolder == nil { + obj.identifierHolder = &patternFlowIcmpEchoIdentifier{obj: obj.obj.Identifier} + } + return obj.identifierHolder +} + +// description is TBD +// Identifier returns a PatternFlowIcmpEchoIdentifier +func (obj *flowIcmpEcho) HasIdentifier() bool { + return obj.obj.Identifier != nil +} + +// description is TBD +// SetIdentifier sets the PatternFlowIcmpEchoIdentifier value in the FlowIcmpEcho object +func (obj *flowIcmpEcho) SetIdentifier(value PatternFlowIcmpEchoIdentifier) FlowIcmpEcho { + + obj.identifierHolder = nil + obj.obj.Identifier = value.msg() + + return obj +} + +// description is TBD +// SequenceNumber returns a PatternFlowIcmpEchoSequenceNumber +func (obj *flowIcmpEcho) SequenceNumber() PatternFlowIcmpEchoSequenceNumber { + if obj.obj.SequenceNumber == nil { + obj.obj.SequenceNumber = NewPatternFlowIcmpEchoSequenceNumber().msg() + } + if obj.sequenceNumberHolder == nil { + obj.sequenceNumberHolder = &patternFlowIcmpEchoSequenceNumber{obj: obj.obj.SequenceNumber} + } + return obj.sequenceNumberHolder +} + +// description is TBD +// SequenceNumber returns a PatternFlowIcmpEchoSequenceNumber +func (obj *flowIcmpEcho) HasSequenceNumber() bool { + return obj.obj.SequenceNumber != nil +} + +// description is TBD +// SetSequenceNumber sets the PatternFlowIcmpEchoSequenceNumber value in the FlowIcmpEcho object +func (obj *flowIcmpEcho) SetSequenceNumber(value PatternFlowIcmpEchoSequenceNumber) FlowIcmpEcho { + + obj.sequenceNumberHolder = nil + obj.obj.SequenceNumber = value.msg() + + return obj +} + +func (obj *flowIcmpEcho) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Type != nil { + + obj.Type().validateObj(vObj, set_default) + } + + if obj.obj.Code != nil { + + obj.Code().validateObj(vObj, set_default) + } + + if obj.obj.Checksum != nil { + + obj.Checksum().validateObj(vObj, set_default) + } + + if obj.obj.Identifier != nil { + + obj.Identifier().validateObj(vObj, set_default) + } + + if obj.obj.SequenceNumber != nil { + + obj.SequenceNumber().validateObj(vObj, set_default) + } + +} + +func (obj *flowIcmpEcho) setDefault() { + +} diff --git a/gosnappi/flow_icmpv6.go b/gosnappi/flow_icmpv6.go new file mode 100644 index 00000000..f9dbcdc0 --- /dev/null +++ b/gosnappi/flow_icmpv6.go @@ -0,0 +1,396 @@ +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" +) + +// ***** FlowIcmpv6 ***** +type flowIcmpv6 struct { + validation + obj *otg.FlowIcmpv6 + marshaller marshalFlowIcmpv6 + unMarshaller unMarshalFlowIcmpv6 + echoHolder FlowIcmpv6Echo +} + +func NewFlowIcmpv6() FlowIcmpv6 { + obj := flowIcmpv6{obj: &otg.FlowIcmpv6{}} + obj.setDefault() + return &obj +} + +func (obj *flowIcmpv6) msg() *otg.FlowIcmpv6 { + return obj.obj +} + +func (obj *flowIcmpv6) setMsg(msg *otg.FlowIcmpv6) FlowIcmpv6 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIcmpv6 struct { + obj *flowIcmpv6 +} + +type marshalFlowIcmpv6 interface { + // ToProto marshals FlowIcmpv6 to protobuf object *otg.FlowIcmpv6 + ToProto() (*otg.FlowIcmpv6, error) + // ToPbText marshals FlowIcmpv6 to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIcmpv6 to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIcmpv6 to JSON text + ToJson() (string, error) +} + +type unMarshalflowIcmpv6 struct { + obj *flowIcmpv6 +} + +type unMarshalFlowIcmpv6 interface { + // FromProto unmarshals FlowIcmpv6 from protobuf object *otg.FlowIcmpv6 + FromProto(msg *otg.FlowIcmpv6) (FlowIcmpv6, error) + // FromPbText unmarshals FlowIcmpv6 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIcmpv6 from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIcmpv6 from JSON text + FromJson(value string) error +} + +func (obj *flowIcmpv6) Marshal() marshalFlowIcmpv6 { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIcmpv6{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIcmpv6) Unmarshal() unMarshalFlowIcmpv6 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIcmpv6{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIcmpv6) ToProto() (*otg.FlowIcmpv6, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIcmpv6) FromProto(msg *otg.FlowIcmpv6) (FlowIcmpv6, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIcmpv6) 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 *unMarshalflowIcmpv6) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowIcmpv6) 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 *unMarshalflowIcmpv6) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowIcmpv6) 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 *unMarshalflowIcmpv6) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowIcmpv6) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIcmpv6) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIcmpv6) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIcmpv6) Clone() (FlowIcmpv6, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIcmpv6() + 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 +} + +func (obj *flowIcmpv6) setNil() { + obj.echoHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowIcmpv6 is iCMPv6 packet header +type FlowIcmpv6 interface { + Validation + // msg marshals FlowIcmpv6 to protobuf object *otg.FlowIcmpv6 + // and doesn't set defaults + msg() *otg.FlowIcmpv6 + // setMsg unmarshals FlowIcmpv6 from protobuf object *otg.FlowIcmpv6 + // and doesn't set defaults + setMsg(*otg.FlowIcmpv6) FlowIcmpv6 + // provides marshal interface + Marshal() marshalFlowIcmpv6 + // provides unmarshal interface + Unmarshal() unMarshalFlowIcmpv6 + // validate validates FlowIcmpv6 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIcmpv6, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowIcmpv6ChoiceEnum, set in FlowIcmpv6 + Choice() FlowIcmpv6ChoiceEnum + // setChoice assigns FlowIcmpv6ChoiceEnum provided by user to FlowIcmpv6 + setChoice(value FlowIcmpv6ChoiceEnum) FlowIcmpv6 + // HasChoice checks if Choice has been set in FlowIcmpv6 + HasChoice() bool + // Echo returns FlowIcmpv6Echo, set in FlowIcmpv6. + // FlowIcmpv6Echo is packet Header for ICMPv6 Echo + Echo() FlowIcmpv6Echo + // SetEcho assigns FlowIcmpv6Echo provided by user to FlowIcmpv6. + // FlowIcmpv6Echo is packet Header for ICMPv6 Echo + SetEcho(value FlowIcmpv6Echo) FlowIcmpv6 + // HasEcho checks if Echo has been set in FlowIcmpv6 + HasEcho() bool + setNil() +} + +type FlowIcmpv6ChoiceEnum string + +// Enum of Choice on FlowIcmpv6 +var FlowIcmpv6Choice = struct { + ECHO FlowIcmpv6ChoiceEnum +}{ + ECHO: FlowIcmpv6ChoiceEnum("echo"), +} + +func (obj *flowIcmpv6) Choice() FlowIcmpv6ChoiceEnum { + return FlowIcmpv6ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowIcmpv6) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowIcmpv6) setChoice(value FlowIcmpv6ChoiceEnum) FlowIcmpv6 { + intValue, ok := otg.FlowIcmpv6_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowIcmpv6ChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowIcmpv6_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Echo = nil + obj.echoHolder = nil + + if value == FlowIcmpv6Choice.ECHO { + obj.obj.Echo = NewFlowIcmpv6Echo().msg() + } + + return obj +} + +// description is TBD +// Echo returns a FlowIcmpv6Echo +func (obj *flowIcmpv6) Echo() FlowIcmpv6Echo { + if obj.obj.Echo == nil { + obj.setChoice(FlowIcmpv6Choice.ECHO) + } + if obj.echoHolder == nil { + obj.echoHolder = &flowIcmpv6Echo{obj: obj.obj.Echo} + } + return obj.echoHolder +} + +// description is TBD +// Echo returns a FlowIcmpv6Echo +func (obj *flowIcmpv6) HasEcho() bool { + return obj.obj.Echo != nil +} + +// description is TBD +// SetEcho sets the FlowIcmpv6Echo value in the FlowIcmpv6 object +func (obj *flowIcmpv6) SetEcho(value FlowIcmpv6Echo) FlowIcmpv6 { + obj.setChoice(FlowIcmpv6Choice.ECHO) + obj.echoHolder = nil + obj.obj.Echo = value.msg() + + return obj +} + +func (obj *flowIcmpv6) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Echo != nil { + + obj.Echo().validateObj(vObj, set_default) + } + +} + +func (obj *flowIcmpv6) setDefault() { + var choices_set int = 0 + var choice FlowIcmpv6ChoiceEnum + + if obj.obj.Echo != nil { + choices_set += 1 + choice = FlowIcmpv6Choice.ECHO + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowIcmpv6Choice.ECHO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowIcmpv6") + } + } else { + intVal := otg.FlowIcmpv6_Choice_Enum_value[string(choice)] + enumValue := otg.FlowIcmpv6_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_icmpv6_echo.go b/gosnappi/flow_icmpv6_echo.go new file mode 100644 index 00000000..1c683307 --- /dev/null +++ b/gosnappi/flow_icmpv6_echo.go @@ -0,0 +1,500 @@ +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" +) + +// ***** FlowIcmpv6Echo ***** +type flowIcmpv6Echo struct { + validation + obj *otg.FlowIcmpv6Echo + marshaller marshalFlowIcmpv6Echo + unMarshaller unMarshalFlowIcmpv6Echo + typeHolder PatternFlowIcmpv6EchoType + codeHolder PatternFlowIcmpv6EchoCode + identifierHolder PatternFlowIcmpv6EchoIdentifier + sequenceNumberHolder PatternFlowIcmpv6EchoSequenceNumber + checksumHolder PatternFlowIcmpv6EchoChecksum +} + +func NewFlowIcmpv6Echo() FlowIcmpv6Echo { + obj := flowIcmpv6Echo{obj: &otg.FlowIcmpv6Echo{}} + obj.setDefault() + return &obj +} + +func (obj *flowIcmpv6Echo) msg() *otg.FlowIcmpv6Echo { + return obj.obj +} + +func (obj *flowIcmpv6Echo) setMsg(msg *otg.FlowIcmpv6Echo) FlowIcmpv6Echo { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIcmpv6Echo struct { + obj *flowIcmpv6Echo +} + +type marshalFlowIcmpv6Echo interface { + // ToProto marshals FlowIcmpv6Echo to protobuf object *otg.FlowIcmpv6Echo + ToProto() (*otg.FlowIcmpv6Echo, error) + // ToPbText marshals FlowIcmpv6Echo to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIcmpv6Echo to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIcmpv6Echo to JSON text + ToJson() (string, error) +} + +type unMarshalflowIcmpv6Echo struct { + obj *flowIcmpv6Echo +} + +type unMarshalFlowIcmpv6Echo interface { + // FromProto unmarshals FlowIcmpv6Echo from protobuf object *otg.FlowIcmpv6Echo + FromProto(msg *otg.FlowIcmpv6Echo) (FlowIcmpv6Echo, error) + // FromPbText unmarshals FlowIcmpv6Echo from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIcmpv6Echo from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIcmpv6Echo from JSON text + FromJson(value string) error +} + +func (obj *flowIcmpv6Echo) Marshal() marshalFlowIcmpv6Echo { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIcmpv6Echo{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIcmpv6Echo) Unmarshal() unMarshalFlowIcmpv6Echo { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIcmpv6Echo{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIcmpv6Echo) ToProto() (*otg.FlowIcmpv6Echo, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIcmpv6Echo) FromProto(msg *otg.FlowIcmpv6Echo) (FlowIcmpv6Echo, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIcmpv6Echo) 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 *unMarshalflowIcmpv6Echo) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowIcmpv6Echo) 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 *unMarshalflowIcmpv6Echo) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowIcmpv6Echo) 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 *unMarshalflowIcmpv6Echo) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowIcmpv6Echo) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIcmpv6Echo) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIcmpv6Echo) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIcmpv6Echo) Clone() (FlowIcmpv6Echo, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIcmpv6Echo() + 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 +} + +func (obj *flowIcmpv6Echo) setNil() { + obj.typeHolder = nil + obj.codeHolder = nil + obj.identifierHolder = nil + obj.sequenceNumberHolder = nil + obj.checksumHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowIcmpv6Echo is packet Header for ICMPv6 Echo +type FlowIcmpv6Echo interface { + Validation + // msg marshals FlowIcmpv6Echo to protobuf object *otg.FlowIcmpv6Echo + // and doesn't set defaults + msg() *otg.FlowIcmpv6Echo + // setMsg unmarshals FlowIcmpv6Echo from protobuf object *otg.FlowIcmpv6Echo + // and doesn't set defaults + setMsg(*otg.FlowIcmpv6Echo) FlowIcmpv6Echo + // provides marshal interface + Marshal() marshalFlowIcmpv6Echo + // provides unmarshal interface + Unmarshal() unMarshalFlowIcmpv6Echo + // validate validates FlowIcmpv6Echo + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIcmpv6Echo, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Type returns PatternFlowIcmpv6EchoType, set in FlowIcmpv6Echo. + // PatternFlowIcmpv6EchoType is iCMPv6 echo type + Type() PatternFlowIcmpv6EchoType + // SetType assigns PatternFlowIcmpv6EchoType provided by user to FlowIcmpv6Echo. + // PatternFlowIcmpv6EchoType is iCMPv6 echo type + SetType(value PatternFlowIcmpv6EchoType) FlowIcmpv6Echo + // HasType checks if Type has been set in FlowIcmpv6Echo + HasType() bool + // Code returns PatternFlowIcmpv6EchoCode, set in FlowIcmpv6Echo. + // PatternFlowIcmpv6EchoCode is iCMPv6 echo sub type + Code() PatternFlowIcmpv6EchoCode + // SetCode assigns PatternFlowIcmpv6EchoCode provided by user to FlowIcmpv6Echo. + // PatternFlowIcmpv6EchoCode is iCMPv6 echo sub type + SetCode(value PatternFlowIcmpv6EchoCode) FlowIcmpv6Echo + // HasCode checks if Code has been set in FlowIcmpv6Echo + HasCode() bool + // Identifier returns PatternFlowIcmpv6EchoIdentifier, set in FlowIcmpv6Echo. + // PatternFlowIcmpv6EchoIdentifier is iCMPv6 echo identifier + Identifier() PatternFlowIcmpv6EchoIdentifier + // SetIdentifier assigns PatternFlowIcmpv6EchoIdentifier provided by user to FlowIcmpv6Echo. + // PatternFlowIcmpv6EchoIdentifier is iCMPv6 echo identifier + SetIdentifier(value PatternFlowIcmpv6EchoIdentifier) FlowIcmpv6Echo + // HasIdentifier checks if Identifier has been set in FlowIcmpv6Echo + HasIdentifier() bool + // SequenceNumber returns PatternFlowIcmpv6EchoSequenceNumber, set in FlowIcmpv6Echo. + // PatternFlowIcmpv6EchoSequenceNumber is iCMPv6 echo sequence number + SequenceNumber() PatternFlowIcmpv6EchoSequenceNumber + // SetSequenceNumber assigns PatternFlowIcmpv6EchoSequenceNumber provided by user to FlowIcmpv6Echo. + // PatternFlowIcmpv6EchoSequenceNumber is iCMPv6 echo sequence number + SetSequenceNumber(value PatternFlowIcmpv6EchoSequenceNumber) FlowIcmpv6Echo + // HasSequenceNumber checks if SequenceNumber has been set in FlowIcmpv6Echo + HasSequenceNumber() bool + // Checksum returns PatternFlowIcmpv6EchoChecksum, set in FlowIcmpv6Echo. + // PatternFlowIcmpv6EchoChecksum is iCMPv6 checksum + Checksum() PatternFlowIcmpv6EchoChecksum + // SetChecksum assigns PatternFlowIcmpv6EchoChecksum provided by user to FlowIcmpv6Echo. + // PatternFlowIcmpv6EchoChecksum is iCMPv6 checksum + SetChecksum(value PatternFlowIcmpv6EchoChecksum) FlowIcmpv6Echo + // HasChecksum checks if Checksum has been set in FlowIcmpv6Echo + HasChecksum() bool + setNil() +} + +// description is TBD +// Type returns a PatternFlowIcmpv6EchoType +func (obj *flowIcmpv6Echo) Type() PatternFlowIcmpv6EchoType { + if obj.obj.Type == nil { + obj.obj.Type = NewPatternFlowIcmpv6EchoType().msg() + } + if obj.typeHolder == nil { + obj.typeHolder = &patternFlowIcmpv6EchoType{obj: obj.obj.Type} + } + return obj.typeHolder +} + +// description is TBD +// Type returns a PatternFlowIcmpv6EchoType +func (obj *flowIcmpv6Echo) HasType() bool { + return obj.obj.Type != nil +} + +// description is TBD +// SetType sets the PatternFlowIcmpv6EchoType value in the FlowIcmpv6Echo object +func (obj *flowIcmpv6Echo) SetType(value PatternFlowIcmpv6EchoType) FlowIcmpv6Echo { + + obj.typeHolder = nil + obj.obj.Type = value.msg() + + return obj +} + +// description is TBD +// Code returns a PatternFlowIcmpv6EchoCode +func (obj *flowIcmpv6Echo) Code() PatternFlowIcmpv6EchoCode { + if obj.obj.Code == nil { + obj.obj.Code = NewPatternFlowIcmpv6EchoCode().msg() + } + if obj.codeHolder == nil { + obj.codeHolder = &patternFlowIcmpv6EchoCode{obj: obj.obj.Code} + } + return obj.codeHolder +} + +// description is TBD +// Code returns a PatternFlowIcmpv6EchoCode +func (obj *flowIcmpv6Echo) HasCode() bool { + return obj.obj.Code != nil +} + +// description is TBD +// SetCode sets the PatternFlowIcmpv6EchoCode value in the FlowIcmpv6Echo object +func (obj *flowIcmpv6Echo) SetCode(value PatternFlowIcmpv6EchoCode) FlowIcmpv6Echo { + + obj.codeHolder = nil + obj.obj.Code = value.msg() + + return obj +} + +// description is TBD +// Identifier returns a PatternFlowIcmpv6EchoIdentifier +func (obj *flowIcmpv6Echo) Identifier() PatternFlowIcmpv6EchoIdentifier { + if obj.obj.Identifier == nil { + obj.obj.Identifier = NewPatternFlowIcmpv6EchoIdentifier().msg() + } + if obj.identifierHolder == nil { + obj.identifierHolder = &patternFlowIcmpv6EchoIdentifier{obj: obj.obj.Identifier} + } + return obj.identifierHolder +} + +// description is TBD +// Identifier returns a PatternFlowIcmpv6EchoIdentifier +func (obj *flowIcmpv6Echo) HasIdentifier() bool { + return obj.obj.Identifier != nil +} + +// description is TBD +// SetIdentifier sets the PatternFlowIcmpv6EchoIdentifier value in the FlowIcmpv6Echo object +func (obj *flowIcmpv6Echo) SetIdentifier(value PatternFlowIcmpv6EchoIdentifier) FlowIcmpv6Echo { + + obj.identifierHolder = nil + obj.obj.Identifier = value.msg() + + return obj +} + +// description is TBD +// SequenceNumber returns a PatternFlowIcmpv6EchoSequenceNumber +func (obj *flowIcmpv6Echo) SequenceNumber() PatternFlowIcmpv6EchoSequenceNumber { + if obj.obj.SequenceNumber == nil { + obj.obj.SequenceNumber = NewPatternFlowIcmpv6EchoSequenceNumber().msg() + } + if obj.sequenceNumberHolder == nil { + obj.sequenceNumberHolder = &patternFlowIcmpv6EchoSequenceNumber{obj: obj.obj.SequenceNumber} + } + return obj.sequenceNumberHolder +} + +// description is TBD +// SequenceNumber returns a PatternFlowIcmpv6EchoSequenceNumber +func (obj *flowIcmpv6Echo) HasSequenceNumber() bool { + return obj.obj.SequenceNumber != nil +} + +// description is TBD +// SetSequenceNumber sets the PatternFlowIcmpv6EchoSequenceNumber value in the FlowIcmpv6Echo object +func (obj *flowIcmpv6Echo) SetSequenceNumber(value PatternFlowIcmpv6EchoSequenceNumber) FlowIcmpv6Echo { + + obj.sequenceNumberHolder = nil + obj.obj.SequenceNumber = value.msg() + + return obj +} + +// description is TBD +// Checksum returns a PatternFlowIcmpv6EchoChecksum +func (obj *flowIcmpv6Echo) Checksum() PatternFlowIcmpv6EchoChecksum { + if obj.obj.Checksum == nil { + obj.obj.Checksum = NewPatternFlowIcmpv6EchoChecksum().msg() + } + if obj.checksumHolder == nil { + obj.checksumHolder = &patternFlowIcmpv6EchoChecksum{obj: obj.obj.Checksum} + } + return obj.checksumHolder +} + +// description is TBD +// Checksum returns a PatternFlowIcmpv6EchoChecksum +func (obj *flowIcmpv6Echo) HasChecksum() bool { + return obj.obj.Checksum != nil +} + +// description is TBD +// SetChecksum sets the PatternFlowIcmpv6EchoChecksum value in the FlowIcmpv6Echo object +func (obj *flowIcmpv6Echo) SetChecksum(value PatternFlowIcmpv6EchoChecksum) FlowIcmpv6Echo { + + obj.checksumHolder = nil + obj.obj.Checksum = value.msg() + + return obj +} + +func (obj *flowIcmpv6Echo) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Type != nil { + + obj.Type().validateObj(vObj, set_default) + } + + if obj.obj.Code != nil { + + obj.Code().validateObj(vObj, set_default) + } + + if obj.obj.Identifier != nil { + + obj.Identifier().validateObj(vObj, set_default) + } + + if obj.obj.SequenceNumber != nil { + + obj.SequenceNumber().validateObj(vObj, set_default) + } + + if obj.obj.Checksum != nil { + + obj.Checksum().validateObj(vObj, set_default) + } + +} + +func (obj *flowIcmpv6Echo) setDefault() { + +} diff --git a/gosnappi/flow_igmpv1.go b/gosnappi/flow_igmpv1.go new file mode 100644 index 00000000..005613dd --- /dev/null +++ b/gosnappi/flow_igmpv1.go @@ -0,0 +1,500 @@ +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" +) + +// ***** FlowIgmpv1 ***** +type flowIgmpv1 struct { + validation + obj *otg.FlowIgmpv1 + marshaller marshalFlowIgmpv1 + unMarshaller unMarshalFlowIgmpv1 + versionHolder PatternFlowIgmpv1Version + typeHolder PatternFlowIgmpv1Type + unusedHolder PatternFlowIgmpv1Unused + checksumHolder PatternFlowIgmpv1Checksum + groupAddressHolder PatternFlowIgmpv1GroupAddress +} + +func NewFlowIgmpv1() FlowIgmpv1 { + obj := flowIgmpv1{obj: &otg.FlowIgmpv1{}} + obj.setDefault() + return &obj +} + +func (obj *flowIgmpv1) msg() *otg.FlowIgmpv1 { + return obj.obj +} + +func (obj *flowIgmpv1) setMsg(msg *otg.FlowIgmpv1) FlowIgmpv1 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIgmpv1 struct { + obj *flowIgmpv1 +} + +type marshalFlowIgmpv1 interface { + // ToProto marshals FlowIgmpv1 to protobuf object *otg.FlowIgmpv1 + ToProto() (*otg.FlowIgmpv1, error) + // ToPbText marshals FlowIgmpv1 to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIgmpv1 to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIgmpv1 to JSON text + ToJson() (string, error) +} + +type unMarshalflowIgmpv1 struct { + obj *flowIgmpv1 +} + +type unMarshalFlowIgmpv1 interface { + // FromProto unmarshals FlowIgmpv1 from protobuf object *otg.FlowIgmpv1 + FromProto(msg *otg.FlowIgmpv1) (FlowIgmpv1, error) + // FromPbText unmarshals FlowIgmpv1 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIgmpv1 from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIgmpv1 from JSON text + FromJson(value string) error +} + +func (obj *flowIgmpv1) Marshal() marshalFlowIgmpv1 { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIgmpv1{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIgmpv1) Unmarshal() unMarshalFlowIgmpv1 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIgmpv1{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIgmpv1) ToProto() (*otg.FlowIgmpv1, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIgmpv1) FromProto(msg *otg.FlowIgmpv1) (FlowIgmpv1, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIgmpv1) 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 *unMarshalflowIgmpv1) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowIgmpv1) 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 *unMarshalflowIgmpv1) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowIgmpv1) 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 *unMarshalflowIgmpv1) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowIgmpv1) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIgmpv1) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIgmpv1) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIgmpv1) Clone() (FlowIgmpv1, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIgmpv1() + 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 +} + +func (obj *flowIgmpv1) setNil() { + obj.versionHolder = nil + obj.typeHolder = nil + obj.unusedHolder = nil + obj.checksumHolder = nil + obj.groupAddressHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowIgmpv1 is iGMPv1 packet header +type FlowIgmpv1 interface { + Validation + // msg marshals FlowIgmpv1 to protobuf object *otg.FlowIgmpv1 + // and doesn't set defaults + msg() *otg.FlowIgmpv1 + // setMsg unmarshals FlowIgmpv1 from protobuf object *otg.FlowIgmpv1 + // and doesn't set defaults + setMsg(*otg.FlowIgmpv1) FlowIgmpv1 + // provides marshal interface + Marshal() marshalFlowIgmpv1 + // provides unmarshal interface + Unmarshal() unMarshalFlowIgmpv1 + // validate validates FlowIgmpv1 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIgmpv1, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Version returns PatternFlowIgmpv1Version, set in FlowIgmpv1. + // PatternFlowIgmpv1Version is version number + Version() PatternFlowIgmpv1Version + // SetVersion assigns PatternFlowIgmpv1Version provided by user to FlowIgmpv1. + // PatternFlowIgmpv1Version is version number + SetVersion(value PatternFlowIgmpv1Version) FlowIgmpv1 + // HasVersion checks if Version has been set in FlowIgmpv1 + HasVersion() bool + // Type returns PatternFlowIgmpv1Type, set in FlowIgmpv1. + // PatternFlowIgmpv1Type is type of message + Type() PatternFlowIgmpv1Type + // SetType assigns PatternFlowIgmpv1Type provided by user to FlowIgmpv1. + // PatternFlowIgmpv1Type is type of message + SetType(value PatternFlowIgmpv1Type) FlowIgmpv1 + // HasType checks if Type has been set in FlowIgmpv1 + HasType() bool + // Unused returns PatternFlowIgmpv1Unused, set in FlowIgmpv1. + // PatternFlowIgmpv1Unused is unused + Unused() PatternFlowIgmpv1Unused + // SetUnused assigns PatternFlowIgmpv1Unused provided by user to FlowIgmpv1. + // PatternFlowIgmpv1Unused is unused + SetUnused(value PatternFlowIgmpv1Unused) FlowIgmpv1 + // HasUnused checks if Unused has been set in FlowIgmpv1 + HasUnused() bool + // Checksum returns PatternFlowIgmpv1Checksum, set in FlowIgmpv1. + // PatternFlowIgmpv1Checksum is checksum + Checksum() PatternFlowIgmpv1Checksum + // SetChecksum assigns PatternFlowIgmpv1Checksum provided by user to FlowIgmpv1. + // PatternFlowIgmpv1Checksum is checksum + SetChecksum(value PatternFlowIgmpv1Checksum) FlowIgmpv1 + // HasChecksum checks if Checksum has been set in FlowIgmpv1 + HasChecksum() bool + // GroupAddress returns PatternFlowIgmpv1GroupAddress, set in FlowIgmpv1. + // PatternFlowIgmpv1GroupAddress is group address + GroupAddress() PatternFlowIgmpv1GroupAddress + // SetGroupAddress assigns PatternFlowIgmpv1GroupAddress provided by user to FlowIgmpv1. + // PatternFlowIgmpv1GroupAddress is group address + SetGroupAddress(value PatternFlowIgmpv1GroupAddress) FlowIgmpv1 + // HasGroupAddress checks if GroupAddress has been set in FlowIgmpv1 + HasGroupAddress() bool + setNil() +} + +// description is TBD +// Version returns a PatternFlowIgmpv1Version +func (obj *flowIgmpv1) Version() PatternFlowIgmpv1Version { + if obj.obj.Version == nil { + obj.obj.Version = NewPatternFlowIgmpv1Version().msg() + } + if obj.versionHolder == nil { + obj.versionHolder = &patternFlowIgmpv1Version{obj: obj.obj.Version} + } + return obj.versionHolder +} + +// description is TBD +// Version returns a PatternFlowIgmpv1Version +func (obj *flowIgmpv1) HasVersion() bool { + return obj.obj.Version != nil +} + +// description is TBD +// SetVersion sets the PatternFlowIgmpv1Version value in the FlowIgmpv1 object +func (obj *flowIgmpv1) SetVersion(value PatternFlowIgmpv1Version) FlowIgmpv1 { + + obj.versionHolder = nil + obj.obj.Version = value.msg() + + return obj +} + +// description is TBD +// Type returns a PatternFlowIgmpv1Type +func (obj *flowIgmpv1) Type() PatternFlowIgmpv1Type { + if obj.obj.Type == nil { + obj.obj.Type = NewPatternFlowIgmpv1Type().msg() + } + if obj.typeHolder == nil { + obj.typeHolder = &patternFlowIgmpv1Type{obj: obj.obj.Type} + } + return obj.typeHolder +} + +// description is TBD +// Type returns a PatternFlowIgmpv1Type +func (obj *flowIgmpv1) HasType() bool { + return obj.obj.Type != nil +} + +// description is TBD +// SetType sets the PatternFlowIgmpv1Type value in the FlowIgmpv1 object +func (obj *flowIgmpv1) SetType(value PatternFlowIgmpv1Type) FlowIgmpv1 { + + obj.typeHolder = nil + obj.obj.Type = value.msg() + + return obj +} + +// description is TBD +// Unused returns a PatternFlowIgmpv1Unused +func (obj *flowIgmpv1) Unused() PatternFlowIgmpv1Unused { + if obj.obj.Unused == nil { + obj.obj.Unused = NewPatternFlowIgmpv1Unused().msg() + } + if obj.unusedHolder == nil { + obj.unusedHolder = &patternFlowIgmpv1Unused{obj: obj.obj.Unused} + } + return obj.unusedHolder +} + +// description is TBD +// Unused returns a PatternFlowIgmpv1Unused +func (obj *flowIgmpv1) HasUnused() bool { + return obj.obj.Unused != nil +} + +// description is TBD +// SetUnused sets the PatternFlowIgmpv1Unused value in the FlowIgmpv1 object +func (obj *flowIgmpv1) SetUnused(value PatternFlowIgmpv1Unused) FlowIgmpv1 { + + obj.unusedHolder = nil + obj.obj.Unused = value.msg() + + return obj +} + +// description is TBD +// Checksum returns a PatternFlowIgmpv1Checksum +func (obj *flowIgmpv1) Checksum() PatternFlowIgmpv1Checksum { + if obj.obj.Checksum == nil { + obj.obj.Checksum = NewPatternFlowIgmpv1Checksum().msg() + } + if obj.checksumHolder == nil { + obj.checksumHolder = &patternFlowIgmpv1Checksum{obj: obj.obj.Checksum} + } + return obj.checksumHolder +} + +// description is TBD +// Checksum returns a PatternFlowIgmpv1Checksum +func (obj *flowIgmpv1) HasChecksum() bool { + return obj.obj.Checksum != nil +} + +// description is TBD +// SetChecksum sets the PatternFlowIgmpv1Checksum value in the FlowIgmpv1 object +func (obj *flowIgmpv1) SetChecksum(value PatternFlowIgmpv1Checksum) FlowIgmpv1 { + + obj.checksumHolder = nil + obj.obj.Checksum = value.msg() + + return obj +} + +// description is TBD +// GroupAddress returns a PatternFlowIgmpv1GroupAddress +func (obj *flowIgmpv1) GroupAddress() PatternFlowIgmpv1GroupAddress { + if obj.obj.GroupAddress == nil { + obj.obj.GroupAddress = NewPatternFlowIgmpv1GroupAddress().msg() + } + if obj.groupAddressHolder == nil { + obj.groupAddressHolder = &patternFlowIgmpv1GroupAddress{obj: obj.obj.GroupAddress} + } + return obj.groupAddressHolder +} + +// description is TBD +// GroupAddress returns a PatternFlowIgmpv1GroupAddress +func (obj *flowIgmpv1) HasGroupAddress() bool { + return obj.obj.GroupAddress != nil +} + +// description is TBD +// SetGroupAddress sets the PatternFlowIgmpv1GroupAddress value in the FlowIgmpv1 object +func (obj *flowIgmpv1) SetGroupAddress(value PatternFlowIgmpv1GroupAddress) FlowIgmpv1 { + + obj.groupAddressHolder = nil + obj.obj.GroupAddress = value.msg() + + return obj +} + +func (obj *flowIgmpv1) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Version != nil { + + obj.Version().validateObj(vObj, set_default) + } + + if obj.obj.Type != nil { + + obj.Type().validateObj(vObj, set_default) + } + + if obj.obj.Unused != nil { + + obj.Unused().validateObj(vObj, set_default) + } + + if obj.obj.Checksum != nil { + + obj.Checksum().validateObj(vObj, set_default) + } + + if obj.obj.GroupAddress != nil { + + obj.GroupAddress().validateObj(vObj, set_default) + } + +} + +func (obj *flowIgmpv1) setDefault() { + +} diff --git a/gosnappi/flow_ipv4.go b/gosnappi/flow_ipv4.go new file mode 100644 index 00000000..096fe5a3 --- /dev/null +++ b/gosnappi/flow_ipv4.go @@ -0,0 +1,992 @@ +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" +) + +// ***** FlowIpv4 ***** +type flowIpv4 struct { + validation + obj *otg.FlowIpv4 + marshaller marshalFlowIpv4 + unMarshaller unMarshalFlowIpv4 + versionHolder PatternFlowIpv4Version + headerLengthHolder PatternFlowIpv4HeaderLength + priorityHolder FlowIpv4Priority + totalLengthHolder PatternFlowIpv4TotalLength + identificationHolder PatternFlowIpv4Identification + reservedHolder PatternFlowIpv4Reserved + dontFragmentHolder PatternFlowIpv4DontFragment + moreFragmentsHolder PatternFlowIpv4MoreFragments + fragmentOffsetHolder PatternFlowIpv4FragmentOffset + timeToLiveHolder PatternFlowIpv4TimeToLive + protocolHolder PatternFlowIpv4Protocol + headerChecksumHolder PatternFlowIpv4HeaderChecksum + srcHolder PatternFlowIpv4Src + dstHolder PatternFlowIpv4Dst + optionsHolder FlowIpv4FlowIpv4OptionsIter +} + +func NewFlowIpv4() FlowIpv4 { + obj := flowIpv4{obj: &otg.FlowIpv4{}} + obj.setDefault() + return &obj +} + +func (obj *flowIpv4) msg() *otg.FlowIpv4 { + return obj.obj +} + +func (obj *flowIpv4) setMsg(msg *otg.FlowIpv4) FlowIpv4 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIpv4 struct { + obj *flowIpv4 +} + +type marshalFlowIpv4 interface { + // ToProto marshals FlowIpv4 to protobuf object *otg.FlowIpv4 + ToProto() (*otg.FlowIpv4, error) + // ToPbText marshals FlowIpv4 to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIpv4 to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIpv4 to JSON text + ToJson() (string, error) +} + +type unMarshalflowIpv4 struct { + obj *flowIpv4 +} + +type unMarshalFlowIpv4 interface { + // FromProto unmarshals FlowIpv4 from protobuf object *otg.FlowIpv4 + FromProto(msg *otg.FlowIpv4) (FlowIpv4, error) + // FromPbText unmarshals FlowIpv4 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIpv4 from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIpv4 from JSON text + FromJson(value string) error +} + +func (obj *flowIpv4) Marshal() marshalFlowIpv4 { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIpv4{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIpv4) Unmarshal() unMarshalFlowIpv4 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIpv4{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIpv4) ToProto() (*otg.FlowIpv4, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIpv4) FromProto(msg *otg.FlowIpv4) (FlowIpv4, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIpv4) 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 *unMarshalflowIpv4) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowIpv4) 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 *unMarshalflowIpv4) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowIpv4) 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 *unMarshalflowIpv4) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowIpv4) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIpv4) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIpv4) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIpv4) Clone() (FlowIpv4, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIpv4() + 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 +} + +func (obj *flowIpv4) setNil() { + obj.versionHolder = nil + obj.headerLengthHolder = nil + obj.priorityHolder = nil + obj.totalLengthHolder = nil + obj.identificationHolder = nil + obj.reservedHolder = nil + obj.dontFragmentHolder = nil + obj.moreFragmentsHolder = nil + obj.fragmentOffsetHolder = nil + obj.timeToLiveHolder = nil + obj.protocolHolder = nil + obj.headerChecksumHolder = nil + obj.srcHolder = nil + obj.dstHolder = nil + obj.optionsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowIpv4 is iPv4 packet header +type FlowIpv4 interface { + Validation + // msg marshals FlowIpv4 to protobuf object *otg.FlowIpv4 + // and doesn't set defaults + msg() *otg.FlowIpv4 + // setMsg unmarshals FlowIpv4 from protobuf object *otg.FlowIpv4 + // and doesn't set defaults + setMsg(*otg.FlowIpv4) FlowIpv4 + // provides marshal interface + Marshal() marshalFlowIpv4 + // provides unmarshal interface + Unmarshal() unMarshalFlowIpv4 + // validate validates FlowIpv4 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIpv4, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Version returns PatternFlowIpv4Version, set in FlowIpv4. + // PatternFlowIpv4Version is version + Version() PatternFlowIpv4Version + // SetVersion assigns PatternFlowIpv4Version provided by user to FlowIpv4. + // PatternFlowIpv4Version is version + SetVersion(value PatternFlowIpv4Version) FlowIpv4 + // HasVersion checks if Version has been set in FlowIpv4 + HasVersion() bool + // HeaderLength returns PatternFlowIpv4HeaderLength, set in FlowIpv4. + // PatternFlowIpv4HeaderLength is header length + HeaderLength() PatternFlowIpv4HeaderLength + // SetHeaderLength assigns PatternFlowIpv4HeaderLength provided by user to FlowIpv4. + // PatternFlowIpv4HeaderLength is header length + SetHeaderLength(value PatternFlowIpv4HeaderLength) FlowIpv4 + // HasHeaderLength checks if HeaderLength has been set in FlowIpv4 + HasHeaderLength() bool + // Priority returns FlowIpv4Priority, set in FlowIpv4. + // FlowIpv4Priority is a container for ipv4 raw, tos, dscp ip priorities. + Priority() FlowIpv4Priority + // SetPriority assigns FlowIpv4Priority provided by user to FlowIpv4. + // FlowIpv4Priority is a container for ipv4 raw, tos, dscp ip priorities. + SetPriority(value FlowIpv4Priority) FlowIpv4 + // HasPriority checks if Priority has been set in FlowIpv4 + HasPriority() bool + // TotalLength returns PatternFlowIpv4TotalLength, set in FlowIpv4. + // PatternFlowIpv4TotalLength is total length + TotalLength() PatternFlowIpv4TotalLength + // SetTotalLength assigns PatternFlowIpv4TotalLength provided by user to FlowIpv4. + // PatternFlowIpv4TotalLength is total length + SetTotalLength(value PatternFlowIpv4TotalLength) FlowIpv4 + // HasTotalLength checks if TotalLength has been set in FlowIpv4 + HasTotalLength() bool + // Identification returns PatternFlowIpv4Identification, set in FlowIpv4. + // PatternFlowIpv4Identification is identification + Identification() PatternFlowIpv4Identification + // SetIdentification assigns PatternFlowIpv4Identification provided by user to FlowIpv4. + // PatternFlowIpv4Identification is identification + SetIdentification(value PatternFlowIpv4Identification) FlowIpv4 + // HasIdentification checks if Identification has been set in FlowIpv4 + HasIdentification() bool + // Reserved returns PatternFlowIpv4Reserved, set in FlowIpv4. + // PatternFlowIpv4Reserved is reserved flag. + Reserved() PatternFlowIpv4Reserved + // SetReserved assigns PatternFlowIpv4Reserved provided by user to FlowIpv4. + // PatternFlowIpv4Reserved is reserved flag. + SetReserved(value PatternFlowIpv4Reserved) FlowIpv4 + // HasReserved checks if Reserved has been set in FlowIpv4 + HasReserved() bool + // DontFragment returns PatternFlowIpv4DontFragment, set in FlowIpv4. + // PatternFlowIpv4DontFragment is dont fragment flag If the dont_fragment flag is set and fragmentation is required to route the packet then the packet is dropped. + DontFragment() PatternFlowIpv4DontFragment + // SetDontFragment assigns PatternFlowIpv4DontFragment provided by user to FlowIpv4. + // PatternFlowIpv4DontFragment is dont fragment flag If the dont_fragment flag is set and fragmentation is required to route the packet then the packet is dropped. + SetDontFragment(value PatternFlowIpv4DontFragment) FlowIpv4 + // HasDontFragment checks if DontFragment has been set in FlowIpv4 + HasDontFragment() bool + // MoreFragments returns PatternFlowIpv4MoreFragments, set in FlowIpv4. + // PatternFlowIpv4MoreFragments is more fragments flag + MoreFragments() PatternFlowIpv4MoreFragments + // SetMoreFragments assigns PatternFlowIpv4MoreFragments provided by user to FlowIpv4. + // PatternFlowIpv4MoreFragments is more fragments flag + SetMoreFragments(value PatternFlowIpv4MoreFragments) FlowIpv4 + // HasMoreFragments checks if MoreFragments has been set in FlowIpv4 + HasMoreFragments() bool + // FragmentOffset returns PatternFlowIpv4FragmentOffset, set in FlowIpv4. + // PatternFlowIpv4FragmentOffset is fragment offset + FragmentOffset() PatternFlowIpv4FragmentOffset + // SetFragmentOffset assigns PatternFlowIpv4FragmentOffset provided by user to FlowIpv4. + // PatternFlowIpv4FragmentOffset is fragment offset + SetFragmentOffset(value PatternFlowIpv4FragmentOffset) FlowIpv4 + // HasFragmentOffset checks if FragmentOffset has been set in FlowIpv4 + HasFragmentOffset() bool + // TimeToLive returns PatternFlowIpv4TimeToLive, set in FlowIpv4. + // PatternFlowIpv4TimeToLive is time to live + TimeToLive() PatternFlowIpv4TimeToLive + // SetTimeToLive assigns PatternFlowIpv4TimeToLive provided by user to FlowIpv4. + // PatternFlowIpv4TimeToLive is time to live + SetTimeToLive(value PatternFlowIpv4TimeToLive) FlowIpv4 + // HasTimeToLive checks if TimeToLive has been set in FlowIpv4 + HasTimeToLive() bool + // Protocol returns PatternFlowIpv4Protocol, set in FlowIpv4. + // PatternFlowIpv4Protocol is protocol, default is 61 any host internal protocol + Protocol() PatternFlowIpv4Protocol + // SetProtocol assigns PatternFlowIpv4Protocol provided by user to FlowIpv4. + // PatternFlowIpv4Protocol is protocol, default is 61 any host internal protocol + SetProtocol(value PatternFlowIpv4Protocol) FlowIpv4 + // HasProtocol checks if Protocol has been set in FlowIpv4 + HasProtocol() bool + // HeaderChecksum returns PatternFlowIpv4HeaderChecksum, set in FlowIpv4. + // PatternFlowIpv4HeaderChecksum is header checksum + HeaderChecksum() PatternFlowIpv4HeaderChecksum + // SetHeaderChecksum assigns PatternFlowIpv4HeaderChecksum provided by user to FlowIpv4. + // PatternFlowIpv4HeaderChecksum is header checksum + SetHeaderChecksum(value PatternFlowIpv4HeaderChecksum) FlowIpv4 + // HasHeaderChecksum checks if HeaderChecksum has been set in FlowIpv4 + HasHeaderChecksum() bool + // Src returns PatternFlowIpv4Src, set in FlowIpv4. + // PatternFlowIpv4Src is source address + Src() PatternFlowIpv4Src + // SetSrc assigns PatternFlowIpv4Src provided by user to FlowIpv4. + // PatternFlowIpv4Src is source address + SetSrc(value PatternFlowIpv4Src) FlowIpv4 + // HasSrc checks if Src has been set in FlowIpv4 + HasSrc() bool + // Dst returns PatternFlowIpv4Dst, set in FlowIpv4. + // PatternFlowIpv4Dst is destination address + Dst() PatternFlowIpv4Dst + // SetDst assigns PatternFlowIpv4Dst provided by user to FlowIpv4. + // PatternFlowIpv4Dst is destination address + SetDst(value PatternFlowIpv4Dst) FlowIpv4 + // HasDst checks if Dst has been set in FlowIpv4 + HasDst() bool + // Options returns FlowIpv4FlowIpv4OptionsIterIter, set in FlowIpv4 + Options() FlowIpv4FlowIpv4OptionsIter + setNil() +} + +// description is TBD +// Version returns a PatternFlowIpv4Version +func (obj *flowIpv4) Version() PatternFlowIpv4Version { + if obj.obj.Version == nil { + obj.obj.Version = NewPatternFlowIpv4Version().msg() + } + if obj.versionHolder == nil { + obj.versionHolder = &patternFlowIpv4Version{obj: obj.obj.Version} + } + return obj.versionHolder +} + +// description is TBD +// Version returns a PatternFlowIpv4Version +func (obj *flowIpv4) HasVersion() bool { + return obj.obj.Version != nil +} + +// description is TBD +// SetVersion sets the PatternFlowIpv4Version value in the FlowIpv4 object +func (obj *flowIpv4) SetVersion(value PatternFlowIpv4Version) FlowIpv4 { + + obj.versionHolder = nil + obj.obj.Version = value.msg() + + return obj +} + +// description is TBD +// HeaderLength returns a PatternFlowIpv4HeaderLength +func (obj *flowIpv4) HeaderLength() PatternFlowIpv4HeaderLength { + if obj.obj.HeaderLength == nil { + obj.obj.HeaderLength = NewPatternFlowIpv4HeaderLength().msg() + } + if obj.headerLengthHolder == nil { + obj.headerLengthHolder = &patternFlowIpv4HeaderLength{obj: obj.obj.HeaderLength} + } + return obj.headerLengthHolder +} + +// description is TBD +// HeaderLength returns a PatternFlowIpv4HeaderLength +func (obj *flowIpv4) HasHeaderLength() bool { + return obj.obj.HeaderLength != nil +} + +// description is TBD +// SetHeaderLength sets the PatternFlowIpv4HeaderLength value in the FlowIpv4 object +func (obj *flowIpv4) SetHeaderLength(value PatternFlowIpv4HeaderLength) FlowIpv4 { + + obj.headerLengthHolder = nil + obj.obj.HeaderLength = value.msg() + + return obj +} + +// description is TBD +// Priority returns a FlowIpv4Priority +func (obj *flowIpv4) Priority() FlowIpv4Priority { + if obj.obj.Priority == nil { + obj.obj.Priority = NewFlowIpv4Priority().msg() + } + if obj.priorityHolder == nil { + obj.priorityHolder = &flowIpv4Priority{obj: obj.obj.Priority} + } + return obj.priorityHolder +} + +// description is TBD +// Priority returns a FlowIpv4Priority +func (obj *flowIpv4) HasPriority() bool { + return obj.obj.Priority != nil +} + +// description is TBD +// SetPriority sets the FlowIpv4Priority value in the FlowIpv4 object +func (obj *flowIpv4) SetPriority(value FlowIpv4Priority) FlowIpv4 { + + obj.priorityHolder = nil + obj.obj.Priority = value.msg() + + return obj +} + +// description is TBD +// TotalLength returns a PatternFlowIpv4TotalLength +func (obj *flowIpv4) TotalLength() PatternFlowIpv4TotalLength { + if obj.obj.TotalLength == nil { + obj.obj.TotalLength = NewPatternFlowIpv4TotalLength().msg() + } + if obj.totalLengthHolder == nil { + obj.totalLengthHolder = &patternFlowIpv4TotalLength{obj: obj.obj.TotalLength} + } + return obj.totalLengthHolder +} + +// description is TBD +// TotalLength returns a PatternFlowIpv4TotalLength +func (obj *flowIpv4) HasTotalLength() bool { + return obj.obj.TotalLength != nil +} + +// description is TBD +// SetTotalLength sets the PatternFlowIpv4TotalLength value in the FlowIpv4 object +func (obj *flowIpv4) SetTotalLength(value PatternFlowIpv4TotalLength) FlowIpv4 { + + obj.totalLengthHolder = nil + obj.obj.TotalLength = value.msg() + + return obj +} + +// description is TBD +// Identification returns a PatternFlowIpv4Identification +func (obj *flowIpv4) Identification() PatternFlowIpv4Identification { + if obj.obj.Identification == nil { + obj.obj.Identification = NewPatternFlowIpv4Identification().msg() + } + if obj.identificationHolder == nil { + obj.identificationHolder = &patternFlowIpv4Identification{obj: obj.obj.Identification} + } + return obj.identificationHolder +} + +// description is TBD +// Identification returns a PatternFlowIpv4Identification +func (obj *flowIpv4) HasIdentification() bool { + return obj.obj.Identification != nil +} + +// description is TBD +// SetIdentification sets the PatternFlowIpv4Identification value in the FlowIpv4 object +func (obj *flowIpv4) SetIdentification(value PatternFlowIpv4Identification) FlowIpv4 { + + obj.identificationHolder = nil + obj.obj.Identification = value.msg() + + return obj +} + +// description is TBD +// Reserved returns a PatternFlowIpv4Reserved +func (obj *flowIpv4) Reserved() PatternFlowIpv4Reserved { + if obj.obj.Reserved == nil { + obj.obj.Reserved = NewPatternFlowIpv4Reserved().msg() + } + if obj.reservedHolder == nil { + obj.reservedHolder = &patternFlowIpv4Reserved{obj: obj.obj.Reserved} + } + return obj.reservedHolder +} + +// description is TBD +// Reserved returns a PatternFlowIpv4Reserved +func (obj *flowIpv4) HasReserved() bool { + return obj.obj.Reserved != nil +} + +// description is TBD +// SetReserved sets the PatternFlowIpv4Reserved value in the FlowIpv4 object +func (obj *flowIpv4) SetReserved(value PatternFlowIpv4Reserved) FlowIpv4 { + + obj.reservedHolder = nil + obj.obj.Reserved = value.msg() + + return obj +} + +// description is TBD +// DontFragment returns a PatternFlowIpv4DontFragment +func (obj *flowIpv4) DontFragment() PatternFlowIpv4DontFragment { + if obj.obj.DontFragment == nil { + obj.obj.DontFragment = NewPatternFlowIpv4DontFragment().msg() + } + if obj.dontFragmentHolder == nil { + obj.dontFragmentHolder = &patternFlowIpv4DontFragment{obj: obj.obj.DontFragment} + } + return obj.dontFragmentHolder +} + +// description is TBD +// DontFragment returns a PatternFlowIpv4DontFragment +func (obj *flowIpv4) HasDontFragment() bool { + return obj.obj.DontFragment != nil +} + +// description is TBD +// SetDontFragment sets the PatternFlowIpv4DontFragment value in the FlowIpv4 object +func (obj *flowIpv4) SetDontFragment(value PatternFlowIpv4DontFragment) FlowIpv4 { + + obj.dontFragmentHolder = nil + obj.obj.DontFragment = value.msg() + + return obj +} + +// description is TBD +// MoreFragments returns a PatternFlowIpv4MoreFragments +func (obj *flowIpv4) MoreFragments() PatternFlowIpv4MoreFragments { + if obj.obj.MoreFragments == nil { + obj.obj.MoreFragments = NewPatternFlowIpv4MoreFragments().msg() + } + if obj.moreFragmentsHolder == nil { + obj.moreFragmentsHolder = &patternFlowIpv4MoreFragments{obj: obj.obj.MoreFragments} + } + return obj.moreFragmentsHolder +} + +// description is TBD +// MoreFragments returns a PatternFlowIpv4MoreFragments +func (obj *flowIpv4) HasMoreFragments() bool { + return obj.obj.MoreFragments != nil +} + +// description is TBD +// SetMoreFragments sets the PatternFlowIpv4MoreFragments value in the FlowIpv4 object +func (obj *flowIpv4) SetMoreFragments(value PatternFlowIpv4MoreFragments) FlowIpv4 { + + obj.moreFragmentsHolder = nil + obj.obj.MoreFragments = value.msg() + + return obj +} + +// description is TBD +// FragmentOffset returns a PatternFlowIpv4FragmentOffset +func (obj *flowIpv4) FragmentOffset() PatternFlowIpv4FragmentOffset { + if obj.obj.FragmentOffset == nil { + obj.obj.FragmentOffset = NewPatternFlowIpv4FragmentOffset().msg() + } + if obj.fragmentOffsetHolder == nil { + obj.fragmentOffsetHolder = &patternFlowIpv4FragmentOffset{obj: obj.obj.FragmentOffset} + } + return obj.fragmentOffsetHolder +} + +// description is TBD +// FragmentOffset returns a PatternFlowIpv4FragmentOffset +func (obj *flowIpv4) HasFragmentOffset() bool { + return obj.obj.FragmentOffset != nil +} + +// description is TBD +// SetFragmentOffset sets the PatternFlowIpv4FragmentOffset value in the FlowIpv4 object +func (obj *flowIpv4) SetFragmentOffset(value PatternFlowIpv4FragmentOffset) FlowIpv4 { + + obj.fragmentOffsetHolder = nil + obj.obj.FragmentOffset = value.msg() + + return obj +} + +// description is TBD +// TimeToLive returns a PatternFlowIpv4TimeToLive +func (obj *flowIpv4) TimeToLive() PatternFlowIpv4TimeToLive { + if obj.obj.TimeToLive == nil { + obj.obj.TimeToLive = NewPatternFlowIpv4TimeToLive().msg() + } + if obj.timeToLiveHolder == nil { + obj.timeToLiveHolder = &patternFlowIpv4TimeToLive{obj: obj.obj.TimeToLive} + } + return obj.timeToLiveHolder +} + +// description is TBD +// TimeToLive returns a PatternFlowIpv4TimeToLive +func (obj *flowIpv4) HasTimeToLive() bool { + return obj.obj.TimeToLive != nil +} + +// description is TBD +// SetTimeToLive sets the PatternFlowIpv4TimeToLive value in the FlowIpv4 object +func (obj *flowIpv4) SetTimeToLive(value PatternFlowIpv4TimeToLive) FlowIpv4 { + + obj.timeToLiveHolder = nil + obj.obj.TimeToLive = value.msg() + + return obj +} + +// description is TBD +// Protocol returns a PatternFlowIpv4Protocol +func (obj *flowIpv4) Protocol() PatternFlowIpv4Protocol { + if obj.obj.Protocol == nil { + obj.obj.Protocol = NewPatternFlowIpv4Protocol().msg() + } + if obj.protocolHolder == nil { + obj.protocolHolder = &patternFlowIpv4Protocol{obj: obj.obj.Protocol} + } + return obj.protocolHolder +} + +// description is TBD +// Protocol returns a PatternFlowIpv4Protocol +func (obj *flowIpv4) HasProtocol() bool { + return obj.obj.Protocol != nil +} + +// description is TBD +// SetProtocol sets the PatternFlowIpv4Protocol value in the FlowIpv4 object +func (obj *flowIpv4) SetProtocol(value PatternFlowIpv4Protocol) FlowIpv4 { + + obj.protocolHolder = nil + obj.obj.Protocol = value.msg() + + return obj +} + +// description is TBD +// HeaderChecksum returns a PatternFlowIpv4HeaderChecksum +func (obj *flowIpv4) HeaderChecksum() PatternFlowIpv4HeaderChecksum { + if obj.obj.HeaderChecksum == nil { + obj.obj.HeaderChecksum = NewPatternFlowIpv4HeaderChecksum().msg() + } + if obj.headerChecksumHolder == nil { + obj.headerChecksumHolder = &patternFlowIpv4HeaderChecksum{obj: obj.obj.HeaderChecksum} + } + return obj.headerChecksumHolder +} + +// description is TBD +// HeaderChecksum returns a PatternFlowIpv4HeaderChecksum +func (obj *flowIpv4) HasHeaderChecksum() bool { + return obj.obj.HeaderChecksum != nil +} + +// description is TBD +// SetHeaderChecksum sets the PatternFlowIpv4HeaderChecksum value in the FlowIpv4 object +func (obj *flowIpv4) SetHeaderChecksum(value PatternFlowIpv4HeaderChecksum) FlowIpv4 { + + obj.headerChecksumHolder = nil + obj.obj.HeaderChecksum = value.msg() + + return obj +} + +// description is TBD +// Src returns a PatternFlowIpv4Src +func (obj *flowIpv4) Src() PatternFlowIpv4Src { + if obj.obj.Src == nil { + obj.obj.Src = NewPatternFlowIpv4Src().msg() + } + if obj.srcHolder == nil { + obj.srcHolder = &patternFlowIpv4Src{obj: obj.obj.Src} + } + return obj.srcHolder +} + +// description is TBD +// Src returns a PatternFlowIpv4Src +func (obj *flowIpv4) HasSrc() bool { + return obj.obj.Src != nil +} + +// description is TBD +// SetSrc sets the PatternFlowIpv4Src value in the FlowIpv4 object +func (obj *flowIpv4) SetSrc(value PatternFlowIpv4Src) FlowIpv4 { + + obj.srcHolder = nil + obj.obj.Src = value.msg() + + return obj +} + +// description is TBD +// Dst returns a PatternFlowIpv4Dst +func (obj *flowIpv4) Dst() PatternFlowIpv4Dst { + if obj.obj.Dst == nil { + obj.obj.Dst = NewPatternFlowIpv4Dst().msg() + } + if obj.dstHolder == nil { + obj.dstHolder = &patternFlowIpv4Dst{obj: obj.obj.Dst} + } + return obj.dstHolder +} + +// description is TBD +// Dst returns a PatternFlowIpv4Dst +func (obj *flowIpv4) HasDst() bool { + return obj.obj.Dst != nil +} + +// description is TBD +// SetDst sets the PatternFlowIpv4Dst value in the FlowIpv4 object +func (obj *flowIpv4) SetDst(value PatternFlowIpv4Dst) FlowIpv4 { + + obj.dstHolder = nil + obj.obj.Dst = value.msg() + + return obj +} + +// description is TBD +// Options returns a []FlowIpv4Options +func (obj *flowIpv4) Options() FlowIpv4FlowIpv4OptionsIter { + if len(obj.obj.Options) == 0 { + obj.obj.Options = []*otg.FlowIpv4Options{} + } + if obj.optionsHolder == nil { + obj.optionsHolder = newFlowIpv4FlowIpv4OptionsIter(&obj.obj.Options).setMsg(obj) + } + return obj.optionsHolder +} + +type flowIpv4FlowIpv4OptionsIter struct { + obj *flowIpv4 + flowIpv4OptionsSlice []FlowIpv4Options + fieldPtr *[]*otg.FlowIpv4Options +} + +func newFlowIpv4FlowIpv4OptionsIter(ptr *[]*otg.FlowIpv4Options) FlowIpv4FlowIpv4OptionsIter { + return &flowIpv4FlowIpv4OptionsIter{fieldPtr: ptr} +} + +type FlowIpv4FlowIpv4OptionsIter interface { + setMsg(*flowIpv4) FlowIpv4FlowIpv4OptionsIter + Items() []FlowIpv4Options + Add() FlowIpv4Options + Append(items ...FlowIpv4Options) FlowIpv4FlowIpv4OptionsIter + Set(index int, newObj FlowIpv4Options) FlowIpv4FlowIpv4OptionsIter + Clear() FlowIpv4FlowIpv4OptionsIter + clearHolderSlice() FlowIpv4FlowIpv4OptionsIter + appendHolderSlice(item FlowIpv4Options) FlowIpv4FlowIpv4OptionsIter +} + +func (obj *flowIpv4FlowIpv4OptionsIter) setMsg(msg *flowIpv4) FlowIpv4FlowIpv4OptionsIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flowIpv4Options{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *flowIpv4FlowIpv4OptionsIter) Items() []FlowIpv4Options { + return obj.flowIpv4OptionsSlice +} + +func (obj *flowIpv4FlowIpv4OptionsIter) Add() FlowIpv4Options { + newObj := &otg.FlowIpv4Options{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flowIpv4Options{obj: newObj} + newLibObj.setDefault() + obj.flowIpv4OptionsSlice = append(obj.flowIpv4OptionsSlice, newLibObj) + return newLibObj +} + +func (obj *flowIpv4FlowIpv4OptionsIter) Append(items ...FlowIpv4Options) FlowIpv4FlowIpv4OptionsIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowIpv4OptionsSlice = append(obj.flowIpv4OptionsSlice, item) + } + return obj +} + +func (obj *flowIpv4FlowIpv4OptionsIter) Set(index int, newObj FlowIpv4Options) FlowIpv4FlowIpv4OptionsIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowIpv4OptionsSlice[index] = newObj + return obj +} +func (obj *flowIpv4FlowIpv4OptionsIter) Clear() FlowIpv4FlowIpv4OptionsIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.FlowIpv4Options{} + obj.flowIpv4OptionsSlice = []FlowIpv4Options{} + } + return obj +} +func (obj *flowIpv4FlowIpv4OptionsIter) clearHolderSlice() FlowIpv4FlowIpv4OptionsIter { + if len(obj.flowIpv4OptionsSlice) > 0 { + obj.flowIpv4OptionsSlice = []FlowIpv4Options{} + } + return obj +} +func (obj *flowIpv4FlowIpv4OptionsIter) appendHolderSlice(item FlowIpv4Options) FlowIpv4FlowIpv4OptionsIter { + obj.flowIpv4OptionsSlice = append(obj.flowIpv4OptionsSlice, item) + return obj +} + +func (obj *flowIpv4) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Version != nil { + + obj.Version().validateObj(vObj, set_default) + } + + if obj.obj.HeaderLength != nil { + + obj.HeaderLength().validateObj(vObj, set_default) + } + + if obj.obj.Priority != nil { + + obj.Priority().validateObj(vObj, set_default) + } + + if obj.obj.TotalLength != nil { + + obj.TotalLength().validateObj(vObj, set_default) + } + + if obj.obj.Identification != nil { + + obj.Identification().validateObj(vObj, set_default) + } + + if obj.obj.Reserved != nil { + + obj.Reserved().validateObj(vObj, set_default) + } + + if obj.obj.DontFragment != nil { + + obj.DontFragment().validateObj(vObj, set_default) + } + + if obj.obj.MoreFragments != nil { + + obj.MoreFragments().validateObj(vObj, set_default) + } + + if obj.obj.FragmentOffset != nil { + + obj.FragmentOffset().validateObj(vObj, set_default) + } + + if obj.obj.TimeToLive != nil { + + obj.TimeToLive().validateObj(vObj, set_default) + } + + if obj.obj.Protocol != nil { + + obj.Protocol().validateObj(vObj, set_default) + } + + if obj.obj.HeaderChecksum != nil { + + obj.HeaderChecksum().validateObj(vObj, set_default) + } + + if obj.obj.Src != nil { + + obj.Src().validateObj(vObj, set_default) + } + + if obj.obj.Dst != nil { + + obj.Dst().validateObj(vObj, set_default) + } + + if len(obj.obj.Options) != 0 { + + if set_default { + obj.Options().clearHolderSlice() + for _, item := range obj.obj.Options { + obj.Options().appendHolderSlice(&flowIpv4Options{obj: item}) + } + } + for _, item := range obj.Options().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *flowIpv4) setDefault() { + +} diff --git a/gosnappi/flow_ipv4_auto.go b/gosnappi/flow_ipv4_auto.go new file mode 100644 index 00000000..2be58f3b --- /dev/null +++ b/gosnappi/flow_ipv4_auto.go @@ -0,0 +1,332 @@ +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" +) + +// ***** FlowIpv4Auto ***** +type flowIpv4Auto struct { + validation + obj *otg.FlowIpv4Auto + marshaller marshalFlowIpv4Auto + unMarshaller unMarshalFlowIpv4Auto +} + +func NewFlowIpv4Auto() FlowIpv4Auto { + obj := flowIpv4Auto{obj: &otg.FlowIpv4Auto{}} + obj.setDefault() + return &obj +} + +func (obj *flowIpv4Auto) msg() *otg.FlowIpv4Auto { + return obj.obj +} + +func (obj *flowIpv4Auto) setMsg(msg *otg.FlowIpv4Auto) FlowIpv4Auto { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIpv4Auto struct { + obj *flowIpv4Auto +} + +type marshalFlowIpv4Auto interface { + // ToProto marshals FlowIpv4Auto to protobuf object *otg.FlowIpv4Auto + ToProto() (*otg.FlowIpv4Auto, error) + // ToPbText marshals FlowIpv4Auto to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIpv4Auto to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIpv4Auto to JSON text + ToJson() (string, error) +} + +type unMarshalflowIpv4Auto struct { + obj *flowIpv4Auto +} + +type unMarshalFlowIpv4Auto interface { + // FromProto unmarshals FlowIpv4Auto from protobuf object *otg.FlowIpv4Auto + FromProto(msg *otg.FlowIpv4Auto) (FlowIpv4Auto, error) + // FromPbText unmarshals FlowIpv4Auto from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIpv4Auto from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIpv4Auto from JSON text + FromJson(value string) error +} + +func (obj *flowIpv4Auto) Marshal() marshalFlowIpv4Auto { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIpv4Auto{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIpv4Auto) Unmarshal() unMarshalFlowIpv4Auto { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIpv4Auto{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIpv4Auto) ToProto() (*otg.FlowIpv4Auto, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIpv4Auto) FromProto(msg *otg.FlowIpv4Auto) (FlowIpv4Auto, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIpv4Auto) 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 *unMarshalflowIpv4Auto) 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 *marshalflowIpv4Auto) 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 *unMarshalflowIpv4Auto) 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 *marshalflowIpv4Auto) 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 *unMarshalflowIpv4Auto) 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 *flowIpv4Auto) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIpv4Auto) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIpv4Auto) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIpv4Auto) Clone() (FlowIpv4Auto, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIpv4Auto() + 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 +} + +// FlowIpv4Auto is the OTG implementation can provide a system generated, value for this property. +type FlowIpv4Auto interface { + Validation + // msg marshals FlowIpv4Auto to protobuf object *otg.FlowIpv4Auto + // and doesn't set defaults + msg() *otg.FlowIpv4Auto + // setMsg unmarshals FlowIpv4Auto from protobuf object *otg.FlowIpv4Auto + // and doesn't set defaults + setMsg(*otg.FlowIpv4Auto) FlowIpv4Auto + // provides marshal interface + Marshal() marshalFlowIpv4Auto + // provides unmarshal interface + Unmarshal() unMarshalFlowIpv4Auto + // validate validates FlowIpv4Auto + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIpv4Auto, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowIpv4AutoChoiceEnum, set in FlowIpv4Auto + Choice() FlowIpv4AutoChoiceEnum + // setChoice assigns FlowIpv4AutoChoiceEnum provided by user to FlowIpv4Auto + setChoice(value FlowIpv4AutoChoiceEnum) FlowIpv4Auto + // getter for Dhcp to set choice. + Dhcp() +} + +type FlowIpv4AutoChoiceEnum string + +// Enum of Choice on FlowIpv4Auto +var FlowIpv4AutoChoice = struct { + DHCP FlowIpv4AutoChoiceEnum +}{ + DHCP: FlowIpv4AutoChoiceEnum("dhcp"), +} + +func (obj *flowIpv4Auto) Choice() FlowIpv4AutoChoiceEnum { + return FlowIpv4AutoChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// getter for Dhcp to set choice +func (obj *flowIpv4Auto) Dhcp() { + obj.setChoice(FlowIpv4AutoChoice.DHCP) +} + +func (obj *flowIpv4Auto) setChoice(value FlowIpv4AutoChoiceEnum) FlowIpv4Auto { + intValue, ok := otg.FlowIpv4Auto_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowIpv4AutoChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowIpv4Auto_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + + return obj +} + +func (obj *flowIpv4Auto) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface FlowIpv4Auto") + } +} + +func (obj *flowIpv4Auto) setDefault() { + var choices_set int = 0 + var choice FlowIpv4AutoChoiceEnum + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowIpv4Auto") + } + } else { + intVal := otg.FlowIpv4Auto_Choice_Enum_value[string(choice)] + enumValue := otg.FlowIpv4Auto_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_ipv4_dscp.go b/gosnappi/flow_ipv4_dscp.go new file mode 100644 index 00000000..c91000b4 --- /dev/null +++ b/gosnappi/flow_ipv4_dscp.go @@ -0,0 +1,371 @@ +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" +) + +// ***** FlowIpv4Dscp ***** +type flowIpv4Dscp struct { + validation + obj *otg.FlowIpv4Dscp + marshaller marshalFlowIpv4Dscp + unMarshaller unMarshalFlowIpv4Dscp + phbHolder PatternFlowIpv4DscpPhb + ecnHolder PatternFlowIpv4DscpEcn +} + +func NewFlowIpv4Dscp() FlowIpv4Dscp { + obj := flowIpv4Dscp{obj: &otg.FlowIpv4Dscp{}} + obj.setDefault() + return &obj +} + +func (obj *flowIpv4Dscp) msg() *otg.FlowIpv4Dscp { + return obj.obj +} + +func (obj *flowIpv4Dscp) setMsg(msg *otg.FlowIpv4Dscp) FlowIpv4Dscp { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIpv4Dscp struct { + obj *flowIpv4Dscp +} + +type marshalFlowIpv4Dscp interface { + // ToProto marshals FlowIpv4Dscp to protobuf object *otg.FlowIpv4Dscp + ToProto() (*otg.FlowIpv4Dscp, error) + // ToPbText marshals FlowIpv4Dscp to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIpv4Dscp to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIpv4Dscp to JSON text + ToJson() (string, error) +} + +type unMarshalflowIpv4Dscp struct { + obj *flowIpv4Dscp +} + +type unMarshalFlowIpv4Dscp interface { + // FromProto unmarshals FlowIpv4Dscp from protobuf object *otg.FlowIpv4Dscp + FromProto(msg *otg.FlowIpv4Dscp) (FlowIpv4Dscp, error) + // FromPbText unmarshals FlowIpv4Dscp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIpv4Dscp from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIpv4Dscp from JSON text + FromJson(value string) error +} + +func (obj *flowIpv4Dscp) Marshal() marshalFlowIpv4Dscp { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIpv4Dscp{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIpv4Dscp) Unmarshal() unMarshalFlowIpv4Dscp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIpv4Dscp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIpv4Dscp) ToProto() (*otg.FlowIpv4Dscp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIpv4Dscp) FromProto(msg *otg.FlowIpv4Dscp) (FlowIpv4Dscp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIpv4Dscp) 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 *unMarshalflowIpv4Dscp) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowIpv4Dscp) 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 *unMarshalflowIpv4Dscp) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowIpv4Dscp) 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 *unMarshalflowIpv4Dscp) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowIpv4Dscp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIpv4Dscp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIpv4Dscp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIpv4Dscp) Clone() (FlowIpv4Dscp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIpv4Dscp() + 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 +} + +func (obj *flowIpv4Dscp) setNil() { + obj.phbHolder = nil + obj.ecnHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowIpv4Dscp is differentiated services code point (DSCP) packet field. +type FlowIpv4Dscp interface { + Validation + // msg marshals FlowIpv4Dscp to protobuf object *otg.FlowIpv4Dscp + // and doesn't set defaults + msg() *otg.FlowIpv4Dscp + // setMsg unmarshals FlowIpv4Dscp from protobuf object *otg.FlowIpv4Dscp + // and doesn't set defaults + setMsg(*otg.FlowIpv4Dscp) FlowIpv4Dscp + // provides marshal interface + Marshal() marshalFlowIpv4Dscp + // provides unmarshal interface + Unmarshal() unMarshalFlowIpv4Dscp + // validate validates FlowIpv4Dscp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIpv4Dscp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Phb returns PatternFlowIpv4DscpPhb, set in FlowIpv4Dscp. + // PatternFlowIpv4DscpPhb is per hop behavior + Phb() PatternFlowIpv4DscpPhb + // SetPhb assigns PatternFlowIpv4DscpPhb provided by user to FlowIpv4Dscp. + // PatternFlowIpv4DscpPhb is per hop behavior + SetPhb(value PatternFlowIpv4DscpPhb) FlowIpv4Dscp + // HasPhb checks if Phb has been set in FlowIpv4Dscp + HasPhb() bool + // Ecn returns PatternFlowIpv4DscpEcn, set in FlowIpv4Dscp. + // PatternFlowIpv4DscpEcn is explicit congestion notification + Ecn() PatternFlowIpv4DscpEcn + // SetEcn assigns PatternFlowIpv4DscpEcn provided by user to FlowIpv4Dscp. + // PatternFlowIpv4DscpEcn is explicit congestion notification + SetEcn(value PatternFlowIpv4DscpEcn) FlowIpv4Dscp + // HasEcn checks if Ecn has been set in FlowIpv4Dscp + HasEcn() bool + setNil() +} + +// description is TBD +// Phb returns a PatternFlowIpv4DscpPhb +func (obj *flowIpv4Dscp) Phb() PatternFlowIpv4DscpPhb { + if obj.obj.Phb == nil { + obj.obj.Phb = NewPatternFlowIpv4DscpPhb().msg() + } + if obj.phbHolder == nil { + obj.phbHolder = &patternFlowIpv4DscpPhb{obj: obj.obj.Phb} + } + return obj.phbHolder +} + +// description is TBD +// Phb returns a PatternFlowIpv4DscpPhb +func (obj *flowIpv4Dscp) HasPhb() bool { + return obj.obj.Phb != nil +} + +// description is TBD +// SetPhb sets the PatternFlowIpv4DscpPhb value in the FlowIpv4Dscp object +func (obj *flowIpv4Dscp) SetPhb(value PatternFlowIpv4DscpPhb) FlowIpv4Dscp { + + obj.phbHolder = nil + obj.obj.Phb = value.msg() + + return obj +} + +// description is TBD +// Ecn returns a PatternFlowIpv4DscpEcn +func (obj *flowIpv4Dscp) Ecn() PatternFlowIpv4DscpEcn { + if obj.obj.Ecn == nil { + obj.obj.Ecn = NewPatternFlowIpv4DscpEcn().msg() + } + if obj.ecnHolder == nil { + obj.ecnHolder = &patternFlowIpv4DscpEcn{obj: obj.obj.Ecn} + } + return obj.ecnHolder +} + +// description is TBD +// Ecn returns a PatternFlowIpv4DscpEcn +func (obj *flowIpv4Dscp) HasEcn() bool { + return obj.obj.Ecn != nil +} + +// description is TBD +// SetEcn sets the PatternFlowIpv4DscpEcn value in the FlowIpv4Dscp object +func (obj *flowIpv4Dscp) SetEcn(value PatternFlowIpv4DscpEcn) FlowIpv4Dscp { + + obj.ecnHolder = nil + obj.obj.Ecn = value.msg() + + return obj +} + +func (obj *flowIpv4Dscp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Phb != nil { + + obj.Phb().validateObj(vObj, set_default) + } + + if obj.obj.Ecn != nil { + + obj.Ecn().validateObj(vObj, set_default) + } + +} + +func (obj *flowIpv4Dscp) setDefault() { + +} diff --git a/gosnappi/flow_ipv4_options.go b/gosnappi/flow_ipv4_options.go new file mode 100644 index 00000000..26b22e9d --- /dev/null +++ b/gosnappi/flow_ipv4_options.go @@ -0,0 +1,405 @@ +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" +) + +// ***** FlowIpv4Options ***** +type flowIpv4Options struct { + validation + obj *otg.FlowIpv4Options + marshaller marshalFlowIpv4Options + unMarshaller unMarshalFlowIpv4Options + customHolder FlowIpv4OptionsCustom +} + +func NewFlowIpv4Options() FlowIpv4Options { + obj := flowIpv4Options{obj: &otg.FlowIpv4Options{}} + obj.setDefault() + return &obj +} + +func (obj *flowIpv4Options) msg() *otg.FlowIpv4Options { + return obj.obj +} + +func (obj *flowIpv4Options) setMsg(msg *otg.FlowIpv4Options) FlowIpv4Options { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIpv4Options struct { + obj *flowIpv4Options +} + +type marshalFlowIpv4Options interface { + // ToProto marshals FlowIpv4Options to protobuf object *otg.FlowIpv4Options + ToProto() (*otg.FlowIpv4Options, error) + // ToPbText marshals FlowIpv4Options to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIpv4Options to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIpv4Options to JSON text + ToJson() (string, error) +} + +type unMarshalflowIpv4Options struct { + obj *flowIpv4Options +} + +type unMarshalFlowIpv4Options interface { + // FromProto unmarshals FlowIpv4Options from protobuf object *otg.FlowIpv4Options + FromProto(msg *otg.FlowIpv4Options) (FlowIpv4Options, error) + // FromPbText unmarshals FlowIpv4Options from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIpv4Options from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIpv4Options from JSON text + FromJson(value string) error +} + +func (obj *flowIpv4Options) Marshal() marshalFlowIpv4Options { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIpv4Options{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIpv4Options) Unmarshal() unMarshalFlowIpv4Options { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIpv4Options{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIpv4Options) ToProto() (*otg.FlowIpv4Options, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIpv4Options) FromProto(msg *otg.FlowIpv4Options) (FlowIpv4Options, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIpv4Options) 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 *unMarshalflowIpv4Options) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowIpv4Options) 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 *unMarshalflowIpv4Options) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowIpv4Options) 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 *unMarshalflowIpv4Options) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowIpv4Options) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIpv4Options) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIpv4Options) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIpv4Options) Clone() (FlowIpv4Options, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIpv4Options() + 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 +} + +func (obj *flowIpv4Options) setNil() { + obj.customHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowIpv4Options is iPv4 options are optional extensions for the IPv4 header that can be utilised to provide additional information about the IPv4 datagram. It is encoded as a series of type, length and value attributes. The IP header length MUST be increased to accommodate the extra bytes needed to encode the IP options. The length of the all options included to a IPv4 header should not exceed 40 bytes since IPv4 Header length (4 bits) can at max specify 15 4-word octets for a total of 60 bytes which includes 20 bytes needed for mandatory attributes of the IPv4 header. If the user adds multiples IPv4 options that exceeds 40 bytes and specify header length as "auto", implementation should throw error. Currently IP options supported are: 1. router_alert option allows devices to intercept packets not addressed to them directly as defined in RFC2113. 2. custom option is provided to configure user defined IP options as needed. +type FlowIpv4Options interface { + Validation + // msg marshals FlowIpv4Options to protobuf object *otg.FlowIpv4Options + // and doesn't set defaults + msg() *otg.FlowIpv4Options + // setMsg unmarshals FlowIpv4Options from protobuf object *otg.FlowIpv4Options + // and doesn't set defaults + setMsg(*otg.FlowIpv4Options) FlowIpv4Options + // provides marshal interface + Marshal() marshalFlowIpv4Options + // provides unmarshal interface + Unmarshal() unMarshalFlowIpv4Options + // validate validates FlowIpv4Options + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIpv4Options, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowIpv4OptionsChoiceEnum, set in FlowIpv4Options + Choice() FlowIpv4OptionsChoiceEnum + // setChoice assigns FlowIpv4OptionsChoiceEnum provided by user to FlowIpv4Options + setChoice(value FlowIpv4OptionsChoiceEnum) FlowIpv4Options + // HasChoice checks if Choice has been set in FlowIpv4Options + HasChoice() bool + // getter for RouterAlert to set choice. + RouterAlert() + // Custom returns FlowIpv4OptionsCustom, set in FlowIpv4Options. + // FlowIpv4OptionsCustom is user defined IP options to be appended to the IPv4 header. + Custom() FlowIpv4OptionsCustom + // SetCustom assigns FlowIpv4OptionsCustom provided by user to FlowIpv4Options. + // FlowIpv4OptionsCustom is user defined IP options to be appended to the IPv4 header. + SetCustom(value FlowIpv4OptionsCustom) FlowIpv4Options + // HasCustom checks if Custom has been set in FlowIpv4Options + HasCustom() bool + setNil() +} + +type FlowIpv4OptionsChoiceEnum string + +// Enum of Choice on FlowIpv4Options +var FlowIpv4OptionsChoice = struct { + ROUTER_ALERT FlowIpv4OptionsChoiceEnum + CUSTOM FlowIpv4OptionsChoiceEnum +}{ + ROUTER_ALERT: FlowIpv4OptionsChoiceEnum("router_alert"), + CUSTOM: FlowIpv4OptionsChoiceEnum("custom"), +} + +func (obj *flowIpv4Options) Choice() FlowIpv4OptionsChoiceEnum { + return FlowIpv4OptionsChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// getter for RouterAlert to set choice +func (obj *flowIpv4Options) RouterAlert() { + obj.setChoice(FlowIpv4OptionsChoice.ROUTER_ALERT) +} + +// description is TBD +// Choice returns a string +func (obj *flowIpv4Options) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowIpv4Options) setChoice(value FlowIpv4OptionsChoiceEnum) FlowIpv4Options { + intValue, ok := otg.FlowIpv4Options_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowIpv4OptionsChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowIpv4Options_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Custom = nil + obj.customHolder = nil + + if value == FlowIpv4OptionsChoice.CUSTOM { + obj.obj.Custom = NewFlowIpv4OptionsCustom().msg() + } + + return obj +} + +// description is TBD +// Custom returns a FlowIpv4OptionsCustom +func (obj *flowIpv4Options) Custom() FlowIpv4OptionsCustom { + if obj.obj.Custom == nil { + obj.setChoice(FlowIpv4OptionsChoice.CUSTOM) + } + if obj.customHolder == nil { + obj.customHolder = &flowIpv4OptionsCustom{obj: obj.obj.Custom} + } + return obj.customHolder +} + +// description is TBD +// Custom returns a FlowIpv4OptionsCustom +func (obj *flowIpv4Options) HasCustom() bool { + return obj.obj.Custom != nil +} + +// description is TBD +// SetCustom sets the FlowIpv4OptionsCustom value in the FlowIpv4Options object +func (obj *flowIpv4Options) SetCustom(value FlowIpv4OptionsCustom) FlowIpv4Options { + obj.setChoice(FlowIpv4OptionsChoice.CUSTOM) + obj.customHolder = nil + obj.obj.Custom = value.msg() + + return obj +} + +func (obj *flowIpv4Options) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Custom != nil { + + obj.Custom().validateObj(vObj, set_default) + } + +} + +func (obj *flowIpv4Options) setDefault() { + var choices_set int = 0 + var choice FlowIpv4OptionsChoiceEnum + + if obj.obj.Custom != nil { + choices_set += 1 + choice = FlowIpv4OptionsChoice.CUSTOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowIpv4OptionsChoice.ROUTER_ALERT) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowIpv4Options") + } + } else { + intVal := otg.FlowIpv4Options_Choice_Enum_value[string(choice)] + enumValue := otg.FlowIpv4Options_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_ipv4_options_custom.go b/gosnappi/flow_ipv4_options_custom.go new file mode 100644 index 00000000..ba640025 --- /dev/null +++ b/gosnappi/flow_ipv4_options_custom.go @@ -0,0 +1,414 @@ +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" +) + +// ***** FlowIpv4OptionsCustom ***** +type flowIpv4OptionsCustom struct { + validation + obj *otg.FlowIpv4OptionsCustom + marshaller marshalFlowIpv4OptionsCustom + unMarshaller unMarshalFlowIpv4OptionsCustom + typeHolder FlowIpv4OptionsCustomType + lengthHolder FlowIpv4OptionsCustomLength +} + +func NewFlowIpv4OptionsCustom() FlowIpv4OptionsCustom { + obj := flowIpv4OptionsCustom{obj: &otg.FlowIpv4OptionsCustom{}} + obj.setDefault() + return &obj +} + +func (obj *flowIpv4OptionsCustom) msg() *otg.FlowIpv4OptionsCustom { + return obj.obj +} + +func (obj *flowIpv4OptionsCustom) setMsg(msg *otg.FlowIpv4OptionsCustom) FlowIpv4OptionsCustom { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIpv4OptionsCustom struct { + obj *flowIpv4OptionsCustom +} + +type marshalFlowIpv4OptionsCustom interface { + // ToProto marshals FlowIpv4OptionsCustom to protobuf object *otg.FlowIpv4OptionsCustom + ToProto() (*otg.FlowIpv4OptionsCustom, error) + // ToPbText marshals FlowIpv4OptionsCustom to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIpv4OptionsCustom to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIpv4OptionsCustom to JSON text + ToJson() (string, error) +} + +type unMarshalflowIpv4OptionsCustom struct { + obj *flowIpv4OptionsCustom +} + +type unMarshalFlowIpv4OptionsCustom interface { + // FromProto unmarshals FlowIpv4OptionsCustom from protobuf object *otg.FlowIpv4OptionsCustom + FromProto(msg *otg.FlowIpv4OptionsCustom) (FlowIpv4OptionsCustom, error) + // FromPbText unmarshals FlowIpv4OptionsCustom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIpv4OptionsCustom from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIpv4OptionsCustom from JSON text + FromJson(value string) error +} + +func (obj *flowIpv4OptionsCustom) Marshal() marshalFlowIpv4OptionsCustom { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIpv4OptionsCustom{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIpv4OptionsCustom) Unmarshal() unMarshalFlowIpv4OptionsCustom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIpv4OptionsCustom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIpv4OptionsCustom) ToProto() (*otg.FlowIpv4OptionsCustom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIpv4OptionsCustom) FromProto(msg *otg.FlowIpv4OptionsCustom) (FlowIpv4OptionsCustom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIpv4OptionsCustom) 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 *unMarshalflowIpv4OptionsCustom) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowIpv4OptionsCustom) 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 *unMarshalflowIpv4OptionsCustom) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowIpv4OptionsCustom) 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 *unMarshalflowIpv4OptionsCustom) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowIpv4OptionsCustom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIpv4OptionsCustom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIpv4OptionsCustom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIpv4OptionsCustom) Clone() (FlowIpv4OptionsCustom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIpv4OptionsCustom() + 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 +} + +func (obj *flowIpv4OptionsCustom) setNil() { + obj.typeHolder = nil + obj.lengthHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowIpv4OptionsCustom is user defined IP options to be appended to the IPv4 header. +type FlowIpv4OptionsCustom interface { + Validation + // msg marshals FlowIpv4OptionsCustom to protobuf object *otg.FlowIpv4OptionsCustom + // and doesn't set defaults + msg() *otg.FlowIpv4OptionsCustom + // setMsg unmarshals FlowIpv4OptionsCustom from protobuf object *otg.FlowIpv4OptionsCustom + // and doesn't set defaults + setMsg(*otg.FlowIpv4OptionsCustom) FlowIpv4OptionsCustom + // provides marshal interface + Marshal() marshalFlowIpv4OptionsCustom + // provides unmarshal interface + Unmarshal() unMarshalFlowIpv4OptionsCustom + // validate validates FlowIpv4OptionsCustom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIpv4OptionsCustom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Type returns FlowIpv4OptionsCustomType, set in FlowIpv4OptionsCustom. + // FlowIpv4OptionsCustomType is type options for custom options. + Type() FlowIpv4OptionsCustomType + // SetType assigns FlowIpv4OptionsCustomType provided by user to FlowIpv4OptionsCustom. + // FlowIpv4OptionsCustomType is type options for custom options. + SetType(value FlowIpv4OptionsCustomType) FlowIpv4OptionsCustom + // HasType checks if Type has been set in FlowIpv4OptionsCustom + HasType() bool + // Length returns FlowIpv4OptionsCustomLength, set in FlowIpv4OptionsCustom. + // FlowIpv4OptionsCustomLength is length for custom options. + Length() FlowIpv4OptionsCustomLength + // SetLength assigns FlowIpv4OptionsCustomLength provided by user to FlowIpv4OptionsCustom. + // FlowIpv4OptionsCustomLength is length for custom options. + SetLength(value FlowIpv4OptionsCustomLength) FlowIpv4OptionsCustom + // HasLength checks if Length has been set in FlowIpv4OptionsCustom + HasLength() bool + // Value returns string, set in FlowIpv4OptionsCustom. + Value() string + // SetValue assigns string provided by user to FlowIpv4OptionsCustom + SetValue(value string) FlowIpv4OptionsCustom + // HasValue checks if Value has been set in FlowIpv4OptionsCustom + HasValue() bool + setNil() +} + +// description is TBD +// Type returns a FlowIpv4OptionsCustomType +func (obj *flowIpv4OptionsCustom) Type() FlowIpv4OptionsCustomType { + if obj.obj.Type == nil { + obj.obj.Type = NewFlowIpv4OptionsCustomType().msg() + } + if obj.typeHolder == nil { + obj.typeHolder = &flowIpv4OptionsCustomType{obj: obj.obj.Type} + } + return obj.typeHolder +} + +// description is TBD +// Type returns a FlowIpv4OptionsCustomType +func (obj *flowIpv4OptionsCustom) HasType() bool { + return obj.obj.Type != nil +} + +// description is TBD +// SetType sets the FlowIpv4OptionsCustomType value in the FlowIpv4OptionsCustom object +func (obj *flowIpv4OptionsCustom) SetType(value FlowIpv4OptionsCustomType) FlowIpv4OptionsCustom { + + obj.typeHolder = nil + obj.obj.Type = value.msg() + + return obj +} + +// description is TBD +// Length returns a FlowIpv4OptionsCustomLength +func (obj *flowIpv4OptionsCustom) Length() FlowIpv4OptionsCustomLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowIpv4OptionsCustomLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowIpv4OptionsCustomLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// description is TBD +// Length returns a FlowIpv4OptionsCustomLength +func (obj *flowIpv4OptionsCustom) HasLength() bool { + return obj.obj.Length != nil +} + +// description is TBD +// SetLength sets the FlowIpv4OptionsCustomLength value in the FlowIpv4OptionsCustom object +func (obj *flowIpv4OptionsCustom) SetLength(value FlowIpv4OptionsCustomLength) FlowIpv4OptionsCustom { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// Value of the option field should not excced 38 bytes since maximum 40 bytes can be added as options in IPv4 header. For type and length requires 2 bytes, hence maximum of 38 bytes are expected. Maximum length of this attribute is 76 (38 * 2 hex character per byte). +// Value returns a string +func (obj *flowIpv4OptionsCustom) Value() string { + + return *obj.obj.Value + +} + +// Value of the option field should not excced 38 bytes since maximum 40 bytes can be added as options in IPv4 header. For type and length requires 2 bytes, hence maximum of 38 bytes are expected. Maximum length of this attribute is 76 (38 * 2 hex character per byte). +// Value returns a string +func (obj *flowIpv4OptionsCustom) HasValue() bool { + return obj.obj.Value != nil +} + +// Value of the option field should not excced 38 bytes since maximum 40 bytes can be added as options in IPv4 header. For type and length requires 2 bytes, hence maximum of 38 bytes are expected. Maximum length of this attribute is 76 (38 * 2 hex character per byte). +// SetValue sets the string value in the FlowIpv4OptionsCustom object +func (obj *flowIpv4OptionsCustom) SetValue(value string) FlowIpv4OptionsCustom { + + obj.obj.Value = &value + return obj +} + +func (obj *flowIpv4OptionsCustom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Type != nil { + + obj.Type().validateObj(vObj, set_default) + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.Value != nil { + + if len(*obj.obj.Value) < 0 || len(*obj.obj.Value) > 76 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of FlowIpv4OptionsCustom.Value <= 76 but Got %d", + len(*obj.obj.Value))) + } + + } + +} + +func (obj *flowIpv4OptionsCustom) setDefault() { + if obj.obj.Value == nil { + obj.SetValue("0000") + } + +} diff --git a/gosnappi/flow_ipv4_options_custom_length.go b/gosnappi/flow_ipv4_options_custom_length.go new file mode 100644 index 00000000..86c032fb --- /dev/null +++ b/gosnappi/flow_ipv4_options_custom_length.go @@ -0,0 +1,413 @@ +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" +) + +// ***** FlowIpv4OptionsCustomLength ***** +type flowIpv4OptionsCustomLength struct { + validation + obj *otg.FlowIpv4OptionsCustomLength + marshaller marshalFlowIpv4OptionsCustomLength + unMarshaller unMarshalFlowIpv4OptionsCustomLength +} + +func NewFlowIpv4OptionsCustomLength() FlowIpv4OptionsCustomLength { + obj := flowIpv4OptionsCustomLength{obj: &otg.FlowIpv4OptionsCustomLength{}} + obj.setDefault() + return &obj +} + +func (obj *flowIpv4OptionsCustomLength) msg() *otg.FlowIpv4OptionsCustomLength { + return obj.obj +} + +func (obj *flowIpv4OptionsCustomLength) setMsg(msg *otg.FlowIpv4OptionsCustomLength) FlowIpv4OptionsCustomLength { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIpv4OptionsCustomLength struct { + obj *flowIpv4OptionsCustomLength +} + +type marshalFlowIpv4OptionsCustomLength interface { + // ToProto marshals FlowIpv4OptionsCustomLength to protobuf object *otg.FlowIpv4OptionsCustomLength + ToProto() (*otg.FlowIpv4OptionsCustomLength, error) + // ToPbText marshals FlowIpv4OptionsCustomLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIpv4OptionsCustomLength to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIpv4OptionsCustomLength to JSON text + ToJson() (string, error) +} + +type unMarshalflowIpv4OptionsCustomLength struct { + obj *flowIpv4OptionsCustomLength +} + +type unMarshalFlowIpv4OptionsCustomLength interface { + // FromProto unmarshals FlowIpv4OptionsCustomLength from protobuf object *otg.FlowIpv4OptionsCustomLength + FromProto(msg *otg.FlowIpv4OptionsCustomLength) (FlowIpv4OptionsCustomLength, error) + // FromPbText unmarshals FlowIpv4OptionsCustomLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIpv4OptionsCustomLength from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIpv4OptionsCustomLength from JSON text + FromJson(value string) error +} + +func (obj *flowIpv4OptionsCustomLength) Marshal() marshalFlowIpv4OptionsCustomLength { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIpv4OptionsCustomLength{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIpv4OptionsCustomLength) Unmarshal() unMarshalFlowIpv4OptionsCustomLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIpv4OptionsCustomLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIpv4OptionsCustomLength) ToProto() (*otg.FlowIpv4OptionsCustomLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIpv4OptionsCustomLength) FromProto(msg *otg.FlowIpv4OptionsCustomLength) (FlowIpv4OptionsCustomLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIpv4OptionsCustomLength) 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 *unMarshalflowIpv4OptionsCustomLength) 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 *marshalflowIpv4OptionsCustomLength) 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 *unMarshalflowIpv4OptionsCustomLength) 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 *marshalflowIpv4OptionsCustomLength) 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 *unMarshalflowIpv4OptionsCustomLength) 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 *flowIpv4OptionsCustomLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIpv4OptionsCustomLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIpv4OptionsCustomLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIpv4OptionsCustomLength) Clone() (FlowIpv4OptionsCustomLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIpv4OptionsCustomLength() + 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 +} + +// FlowIpv4OptionsCustomLength is length for custom options. +type FlowIpv4OptionsCustomLength interface { + Validation + // msg marshals FlowIpv4OptionsCustomLength to protobuf object *otg.FlowIpv4OptionsCustomLength + // and doesn't set defaults + msg() *otg.FlowIpv4OptionsCustomLength + // setMsg unmarshals FlowIpv4OptionsCustomLength from protobuf object *otg.FlowIpv4OptionsCustomLength + // and doesn't set defaults + setMsg(*otg.FlowIpv4OptionsCustomLength) FlowIpv4OptionsCustomLength + // provides marshal interface + Marshal() marshalFlowIpv4OptionsCustomLength + // provides unmarshal interface + Unmarshal() unMarshalFlowIpv4OptionsCustomLength + // validate validates FlowIpv4OptionsCustomLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIpv4OptionsCustomLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowIpv4OptionsCustomLengthChoiceEnum, set in FlowIpv4OptionsCustomLength + Choice() FlowIpv4OptionsCustomLengthChoiceEnum + // setChoice assigns FlowIpv4OptionsCustomLengthChoiceEnum provided by user to FlowIpv4OptionsCustomLength + setChoice(value FlowIpv4OptionsCustomLengthChoiceEnum) FlowIpv4OptionsCustomLength + // HasChoice checks if Choice has been set in FlowIpv4OptionsCustomLength + HasChoice() bool + // Auto returns uint32, set in FlowIpv4OptionsCustomLength. + Auto() uint32 + // HasAuto checks if Auto has been set in FlowIpv4OptionsCustomLength + HasAuto() bool + // Value returns uint32, set in FlowIpv4OptionsCustomLength. + Value() uint32 + // SetValue assigns uint32 provided by user to FlowIpv4OptionsCustomLength + SetValue(value uint32) FlowIpv4OptionsCustomLength + // HasValue checks if Value has been set in FlowIpv4OptionsCustomLength + HasValue() bool +} + +type FlowIpv4OptionsCustomLengthChoiceEnum string + +// Enum of Choice on FlowIpv4OptionsCustomLength +var FlowIpv4OptionsCustomLengthChoice = struct { + AUTO FlowIpv4OptionsCustomLengthChoiceEnum + VALUE FlowIpv4OptionsCustomLengthChoiceEnum +}{ + AUTO: FlowIpv4OptionsCustomLengthChoiceEnum("auto"), + VALUE: FlowIpv4OptionsCustomLengthChoiceEnum("value"), +} + +func (obj *flowIpv4OptionsCustomLength) Choice() FlowIpv4OptionsCustomLengthChoiceEnum { + return FlowIpv4OptionsCustomLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// auto or configured value. +// Choice returns a string +func (obj *flowIpv4OptionsCustomLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowIpv4OptionsCustomLength) setChoice(value FlowIpv4OptionsCustomLengthChoiceEnum) FlowIpv4OptionsCustomLength { + intValue, ok := otg.FlowIpv4OptionsCustomLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowIpv4OptionsCustomLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowIpv4OptionsCustomLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Value = nil + obj.obj.Auto = nil + + if value == FlowIpv4OptionsCustomLengthChoice.AUTO { + defaultValue := uint32(0) + obj.obj.Auto = &defaultValue + } + + if value == FlowIpv4OptionsCustomLengthChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + return obj +} + +// The OTG implementation can provide a system generated value for this property. If the OTG is unable to generate a value the default value must be used. +// Auto returns a uint32 +func (obj *flowIpv4OptionsCustomLength) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(FlowIpv4OptionsCustomLengthChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation can provide a system generated value for this property. If the OTG is unable to generate a value the default value must be used. +// Auto returns a uint32 +func (obj *flowIpv4OptionsCustomLength) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Value returns a uint32 +func (obj *flowIpv4OptionsCustomLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(FlowIpv4OptionsCustomLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *flowIpv4OptionsCustomLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the FlowIpv4OptionsCustomLength object +func (obj *flowIpv4OptionsCustomLength) SetValue(value uint32) FlowIpv4OptionsCustomLength { + obj.setChoice(FlowIpv4OptionsCustomLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +func (obj *flowIpv4OptionsCustomLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *flowIpv4OptionsCustomLength) setDefault() { + var choices_set int = 0 + var choice FlowIpv4OptionsCustomLengthChoiceEnum + + if obj.obj.Auto != nil { + choices_set += 1 + choice = FlowIpv4OptionsCustomLengthChoice.AUTO + } + + if obj.obj.Value != nil { + choices_set += 1 + choice = FlowIpv4OptionsCustomLengthChoice.VALUE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowIpv4OptionsCustomLengthChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowIpv4OptionsCustomLength") + } + } else { + intVal := otg.FlowIpv4OptionsCustomLength_Choice_Enum_value[string(choice)] + enumValue := otg.FlowIpv4OptionsCustomLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_ipv4_options_custom_type.go b/gosnappi/flow_ipv4_options_custom_type.go new file mode 100644 index 00000000..85c08f9c --- /dev/null +++ b/gosnappi/flow_ipv4_options_custom_type.go @@ -0,0 +1,414 @@ +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" +) + +// ***** FlowIpv4OptionsCustomType ***** +type flowIpv4OptionsCustomType struct { + validation + obj *otg.FlowIpv4OptionsCustomType + marshaller marshalFlowIpv4OptionsCustomType + unMarshaller unMarshalFlowIpv4OptionsCustomType + copiedFlagHolder PatternFlowIpv4OptionsCustomTypeCopiedFlag + optionClassHolder PatternFlowIpv4OptionsCustomTypeOptionClass + optionNumberHolder PatternFlowIpv4OptionsCustomTypeOptionNumber +} + +func NewFlowIpv4OptionsCustomType() FlowIpv4OptionsCustomType { + obj := flowIpv4OptionsCustomType{obj: &otg.FlowIpv4OptionsCustomType{}} + obj.setDefault() + return &obj +} + +func (obj *flowIpv4OptionsCustomType) msg() *otg.FlowIpv4OptionsCustomType { + return obj.obj +} + +func (obj *flowIpv4OptionsCustomType) setMsg(msg *otg.FlowIpv4OptionsCustomType) FlowIpv4OptionsCustomType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIpv4OptionsCustomType struct { + obj *flowIpv4OptionsCustomType +} + +type marshalFlowIpv4OptionsCustomType interface { + // ToProto marshals FlowIpv4OptionsCustomType to protobuf object *otg.FlowIpv4OptionsCustomType + ToProto() (*otg.FlowIpv4OptionsCustomType, error) + // ToPbText marshals FlowIpv4OptionsCustomType to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIpv4OptionsCustomType to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIpv4OptionsCustomType to JSON text + ToJson() (string, error) +} + +type unMarshalflowIpv4OptionsCustomType struct { + obj *flowIpv4OptionsCustomType +} + +type unMarshalFlowIpv4OptionsCustomType interface { + // FromProto unmarshals FlowIpv4OptionsCustomType from protobuf object *otg.FlowIpv4OptionsCustomType + FromProto(msg *otg.FlowIpv4OptionsCustomType) (FlowIpv4OptionsCustomType, error) + // FromPbText unmarshals FlowIpv4OptionsCustomType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIpv4OptionsCustomType from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIpv4OptionsCustomType from JSON text + FromJson(value string) error +} + +func (obj *flowIpv4OptionsCustomType) Marshal() marshalFlowIpv4OptionsCustomType { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIpv4OptionsCustomType{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIpv4OptionsCustomType) Unmarshal() unMarshalFlowIpv4OptionsCustomType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIpv4OptionsCustomType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIpv4OptionsCustomType) ToProto() (*otg.FlowIpv4OptionsCustomType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIpv4OptionsCustomType) FromProto(msg *otg.FlowIpv4OptionsCustomType) (FlowIpv4OptionsCustomType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIpv4OptionsCustomType) 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 *unMarshalflowIpv4OptionsCustomType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowIpv4OptionsCustomType) 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 *unMarshalflowIpv4OptionsCustomType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowIpv4OptionsCustomType) 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 *unMarshalflowIpv4OptionsCustomType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowIpv4OptionsCustomType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIpv4OptionsCustomType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIpv4OptionsCustomType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIpv4OptionsCustomType) Clone() (FlowIpv4OptionsCustomType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIpv4OptionsCustomType() + 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 +} + +func (obj *flowIpv4OptionsCustomType) setNil() { + obj.copiedFlagHolder = nil + obj.optionClassHolder = nil + obj.optionNumberHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowIpv4OptionsCustomType is type options for custom options. +type FlowIpv4OptionsCustomType interface { + Validation + // msg marshals FlowIpv4OptionsCustomType to protobuf object *otg.FlowIpv4OptionsCustomType + // and doesn't set defaults + msg() *otg.FlowIpv4OptionsCustomType + // setMsg unmarshals FlowIpv4OptionsCustomType from protobuf object *otg.FlowIpv4OptionsCustomType + // and doesn't set defaults + setMsg(*otg.FlowIpv4OptionsCustomType) FlowIpv4OptionsCustomType + // provides marshal interface + Marshal() marshalFlowIpv4OptionsCustomType + // provides unmarshal interface + Unmarshal() unMarshalFlowIpv4OptionsCustomType + // validate validates FlowIpv4OptionsCustomType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIpv4OptionsCustomType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // CopiedFlag returns PatternFlowIpv4OptionsCustomTypeCopiedFlag, set in FlowIpv4OptionsCustomType. + // PatternFlowIpv4OptionsCustomTypeCopiedFlag is this flag indicates this option is copied to all fragments on fragmentations. + CopiedFlag() PatternFlowIpv4OptionsCustomTypeCopiedFlag + // SetCopiedFlag assigns PatternFlowIpv4OptionsCustomTypeCopiedFlag provided by user to FlowIpv4OptionsCustomType. + // PatternFlowIpv4OptionsCustomTypeCopiedFlag is this flag indicates this option is copied to all fragments on fragmentations. + SetCopiedFlag(value PatternFlowIpv4OptionsCustomTypeCopiedFlag) FlowIpv4OptionsCustomType + // HasCopiedFlag checks if CopiedFlag has been set in FlowIpv4OptionsCustomType + HasCopiedFlag() bool + // OptionClass returns PatternFlowIpv4OptionsCustomTypeOptionClass, set in FlowIpv4OptionsCustomType. + // PatternFlowIpv4OptionsCustomTypeOptionClass is option class [Ref:https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-1]. + OptionClass() PatternFlowIpv4OptionsCustomTypeOptionClass + // SetOptionClass assigns PatternFlowIpv4OptionsCustomTypeOptionClass provided by user to FlowIpv4OptionsCustomType. + // PatternFlowIpv4OptionsCustomTypeOptionClass is option class [Ref:https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-1]. + SetOptionClass(value PatternFlowIpv4OptionsCustomTypeOptionClass) FlowIpv4OptionsCustomType + // HasOptionClass checks if OptionClass has been set in FlowIpv4OptionsCustomType + HasOptionClass() bool + // OptionNumber returns PatternFlowIpv4OptionsCustomTypeOptionNumber, set in FlowIpv4OptionsCustomType. + // PatternFlowIpv4OptionsCustomTypeOptionNumber is option Number [Ref:https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-1]. + OptionNumber() PatternFlowIpv4OptionsCustomTypeOptionNumber + // SetOptionNumber assigns PatternFlowIpv4OptionsCustomTypeOptionNumber provided by user to FlowIpv4OptionsCustomType. + // PatternFlowIpv4OptionsCustomTypeOptionNumber is option Number [Ref:https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-1]. + SetOptionNumber(value PatternFlowIpv4OptionsCustomTypeOptionNumber) FlowIpv4OptionsCustomType + // HasOptionNumber checks if OptionNumber has been set in FlowIpv4OptionsCustomType + HasOptionNumber() bool + setNil() +} + +// description is TBD +// CopiedFlag returns a PatternFlowIpv4OptionsCustomTypeCopiedFlag +func (obj *flowIpv4OptionsCustomType) CopiedFlag() PatternFlowIpv4OptionsCustomTypeCopiedFlag { + if obj.obj.CopiedFlag == nil { + obj.obj.CopiedFlag = NewPatternFlowIpv4OptionsCustomTypeCopiedFlag().msg() + } + if obj.copiedFlagHolder == nil { + obj.copiedFlagHolder = &patternFlowIpv4OptionsCustomTypeCopiedFlag{obj: obj.obj.CopiedFlag} + } + return obj.copiedFlagHolder +} + +// description is TBD +// CopiedFlag returns a PatternFlowIpv4OptionsCustomTypeCopiedFlag +func (obj *flowIpv4OptionsCustomType) HasCopiedFlag() bool { + return obj.obj.CopiedFlag != nil +} + +// description is TBD +// SetCopiedFlag sets the PatternFlowIpv4OptionsCustomTypeCopiedFlag value in the FlowIpv4OptionsCustomType object +func (obj *flowIpv4OptionsCustomType) SetCopiedFlag(value PatternFlowIpv4OptionsCustomTypeCopiedFlag) FlowIpv4OptionsCustomType { + + obj.copiedFlagHolder = nil + obj.obj.CopiedFlag = value.msg() + + return obj +} + +// description is TBD +// OptionClass returns a PatternFlowIpv4OptionsCustomTypeOptionClass +func (obj *flowIpv4OptionsCustomType) OptionClass() PatternFlowIpv4OptionsCustomTypeOptionClass { + if obj.obj.OptionClass == nil { + obj.obj.OptionClass = NewPatternFlowIpv4OptionsCustomTypeOptionClass().msg() + } + if obj.optionClassHolder == nil { + obj.optionClassHolder = &patternFlowIpv4OptionsCustomTypeOptionClass{obj: obj.obj.OptionClass} + } + return obj.optionClassHolder +} + +// description is TBD +// OptionClass returns a PatternFlowIpv4OptionsCustomTypeOptionClass +func (obj *flowIpv4OptionsCustomType) HasOptionClass() bool { + return obj.obj.OptionClass != nil +} + +// description is TBD +// SetOptionClass sets the PatternFlowIpv4OptionsCustomTypeOptionClass value in the FlowIpv4OptionsCustomType object +func (obj *flowIpv4OptionsCustomType) SetOptionClass(value PatternFlowIpv4OptionsCustomTypeOptionClass) FlowIpv4OptionsCustomType { + + obj.optionClassHolder = nil + obj.obj.OptionClass = value.msg() + + return obj +} + +// description is TBD +// OptionNumber returns a PatternFlowIpv4OptionsCustomTypeOptionNumber +func (obj *flowIpv4OptionsCustomType) OptionNumber() PatternFlowIpv4OptionsCustomTypeOptionNumber { + if obj.obj.OptionNumber == nil { + obj.obj.OptionNumber = NewPatternFlowIpv4OptionsCustomTypeOptionNumber().msg() + } + if obj.optionNumberHolder == nil { + obj.optionNumberHolder = &patternFlowIpv4OptionsCustomTypeOptionNumber{obj: obj.obj.OptionNumber} + } + return obj.optionNumberHolder +} + +// description is TBD +// OptionNumber returns a PatternFlowIpv4OptionsCustomTypeOptionNumber +func (obj *flowIpv4OptionsCustomType) HasOptionNumber() bool { + return obj.obj.OptionNumber != nil +} + +// description is TBD +// SetOptionNumber sets the PatternFlowIpv4OptionsCustomTypeOptionNumber value in the FlowIpv4OptionsCustomType object +func (obj *flowIpv4OptionsCustomType) SetOptionNumber(value PatternFlowIpv4OptionsCustomTypeOptionNumber) FlowIpv4OptionsCustomType { + + obj.optionNumberHolder = nil + obj.obj.OptionNumber = value.msg() + + return obj +} + +func (obj *flowIpv4OptionsCustomType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.CopiedFlag != nil { + + obj.CopiedFlag().validateObj(vObj, set_default) + } + + if obj.obj.OptionClass != nil { + + obj.OptionClass().validateObj(vObj, set_default) + } + + if obj.obj.OptionNumber != nil { + + obj.OptionNumber().validateObj(vObj, set_default) + } + +} + +func (obj *flowIpv4OptionsCustomType) setDefault() { + +} diff --git a/gosnappi/flow_ipv4_priority.go b/gosnappi/flow_ipv4_priority.go new file mode 100644 index 00000000..ce5cf8bb --- /dev/null +++ b/gosnappi/flow_ipv4_priority.go @@ -0,0 +1,508 @@ +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" +) + +// ***** FlowIpv4Priority ***** +type flowIpv4Priority struct { + validation + obj *otg.FlowIpv4Priority + marshaller marshalFlowIpv4Priority + unMarshaller unMarshalFlowIpv4Priority + rawHolder PatternFlowIpv4PriorityRaw + tosHolder FlowIpv4Tos + dscpHolder FlowIpv4Dscp +} + +func NewFlowIpv4Priority() FlowIpv4Priority { + obj := flowIpv4Priority{obj: &otg.FlowIpv4Priority{}} + obj.setDefault() + return &obj +} + +func (obj *flowIpv4Priority) msg() *otg.FlowIpv4Priority { + return obj.obj +} + +func (obj *flowIpv4Priority) setMsg(msg *otg.FlowIpv4Priority) FlowIpv4Priority { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIpv4Priority struct { + obj *flowIpv4Priority +} + +type marshalFlowIpv4Priority interface { + // ToProto marshals FlowIpv4Priority to protobuf object *otg.FlowIpv4Priority + ToProto() (*otg.FlowIpv4Priority, error) + // ToPbText marshals FlowIpv4Priority to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIpv4Priority to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIpv4Priority to JSON text + ToJson() (string, error) +} + +type unMarshalflowIpv4Priority struct { + obj *flowIpv4Priority +} + +type unMarshalFlowIpv4Priority interface { + // FromProto unmarshals FlowIpv4Priority from protobuf object *otg.FlowIpv4Priority + FromProto(msg *otg.FlowIpv4Priority) (FlowIpv4Priority, error) + // FromPbText unmarshals FlowIpv4Priority from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIpv4Priority from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIpv4Priority from JSON text + FromJson(value string) error +} + +func (obj *flowIpv4Priority) Marshal() marshalFlowIpv4Priority { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIpv4Priority{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIpv4Priority) Unmarshal() unMarshalFlowIpv4Priority { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIpv4Priority{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIpv4Priority) ToProto() (*otg.FlowIpv4Priority, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIpv4Priority) FromProto(msg *otg.FlowIpv4Priority) (FlowIpv4Priority, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIpv4Priority) 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 *unMarshalflowIpv4Priority) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowIpv4Priority) 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 *unMarshalflowIpv4Priority) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowIpv4Priority) 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 *unMarshalflowIpv4Priority) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowIpv4Priority) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIpv4Priority) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIpv4Priority) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIpv4Priority) Clone() (FlowIpv4Priority, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIpv4Priority() + 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 +} + +func (obj *flowIpv4Priority) setNil() { + obj.rawHolder = nil + obj.tosHolder = nil + obj.dscpHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowIpv4Priority is a container for ipv4 raw, tos, dscp ip priorities. +type FlowIpv4Priority interface { + Validation + // msg marshals FlowIpv4Priority to protobuf object *otg.FlowIpv4Priority + // and doesn't set defaults + msg() *otg.FlowIpv4Priority + // setMsg unmarshals FlowIpv4Priority from protobuf object *otg.FlowIpv4Priority + // and doesn't set defaults + setMsg(*otg.FlowIpv4Priority) FlowIpv4Priority + // provides marshal interface + Marshal() marshalFlowIpv4Priority + // provides unmarshal interface + Unmarshal() unMarshalFlowIpv4Priority + // validate validates FlowIpv4Priority + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIpv4Priority, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowIpv4PriorityChoiceEnum, set in FlowIpv4Priority + Choice() FlowIpv4PriorityChoiceEnum + // setChoice assigns FlowIpv4PriorityChoiceEnum provided by user to FlowIpv4Priority + setChoice(value FlowIpv4PriorityChoiceEnum) FlowIpv4Priority + // HasChoice checks if Choice has been set in FlowIpv4Priority + HasChoice() bool + // Raw returns PatternFlowIpv4PriorityRaw, set in FlowIpv4Priority. + // PatternFlowIpv4PriorityRaw is raw priority + Raw() PatternFlowIpv4PriorityRaw + // SetRaw assigns PatternFlowIpv4PriorityRaw provided by user to FlowIpv4Priority. + // PatternFlowIpv4PriorityRaw is raw priority + SetRaw(value PatternFlowIpv4PriorityRaw) FlowIpv4Priority + // HasRaw checks if Raw has been set in FlowIpv4Priority + HasRaw() bool + // Tos returns FlowIpv4Tos, set in FlowIpv4Priority. + // FlowIpv4Tos is type of service (TOS) packet field. + Tos() FlowIpv4Tos + // SetTos assigns FlowIpv4Tos provided by user to FlowIpv4Priority. + // FlowIpv4Tos is type of service (TOS) packet field. + SetTos(value FlowIpv4Tos) FlowIpv4Priority + // HasTos checks if Tos has been set in FlowIpv4Priority + HasTos() bool + // Dscp returns FlowIpv4Dscp, set in FlowIpv4Priority. + // FlowIpv4Dscp is differentiated services code point (DSCP) packet field. + Dscp() FlowIpv4Dscp + // SetDscp assigns FlowIpv4Dscp provided by user to FlowIpv4Priority. + // FlowIpv4Dscp is differentiated services code point (DSCP) packet field. + SetDscp(value FlowIpv4Dscp) FlowIpv4Priority + // HasDscp checks if Dscp has been set in FlowIpv4Priority + HasDscp() bool + setNil() +} + +type FlowIpv4PriorityChoiceEnum string + +// Enum of Choice on FlowIpv4Priority +var FlowIpv4PriorityChoice = struct { + RAW FlowIpv4PriorityChoiceEnum + TOS FlowIpv4PriorityChoiceEnum + DSCP FlowIpv4PriorityChoiceEnum +}{ + RAW: FlowIpv4PriorityChoiceEnum("raw"), + TOS: FlowIpv4PriorityChoiceEnum("tos"), + DSCP: FlowIpv4PriorityChoiceEnum("dscp"), +} + +func (obj *flowIpv4Priority) Choice() FlowIpv4PriorityChoiceEnum { + return FlowIpv4PriorityChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowIpv4Priority) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowIpv4Priority) setChoice(value FlowIpv4PriorityChoiceEnum) FlowIpv4Priority { + intValue, ok := otg.FlowIpv4Priority_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowIpv4PriorityChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowIpv4Priority_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Dscp = nil + obj.dscpHolder = nil + obj.obj.Tos = nil + obj.tosHolder = nil + obj.obj.Raw = nil + obj.rawHolder = nil + + if value == FlowIpv4PriorityChoice.RAW { + obj.obj.Raw = NewPatternFlowIpv4PriorityRaw().msg() + } + + if value == FlowIpv4PriorityChoice.TOS { + obj.obj.Tos = NewFlowIpv4Tos().msg() + } + + if value == FlowIpv4PriorityChoice.DSCP { + obj.obj.Dscp = NewFlowIpv4Dscp().msg() + } + + return obj +} + +// description is TBD +// Raw returns a PatternFlowIpv4PriorityRaw +func (obj *flowIpv4Priority) Raw() PatternFlowIpv4PriorityRaw { + if obj.obj.Raw == nil { + obj.setChoice(FlowIpv4PriorityChoice.RAW) + } + if obj.rawHolder == nil { + obj.rawHolder = &patternFlowIpv4PriorityRaw{obj: obj.obj.Raw} + } + return obj.rawHolder +} + +// description is TBD +// Raw returns a PatternFlowIpv4PriorityRaw +func (obj *flowIpv4Priority) HasRaw() bool { + return obj.obj.Raw != nil +} + +// description is TBD +// SetRaw sets the PatternFlowIpv4PriorityRaw value in the FlowIpv4Priority object +func (obj *flowIpv4Priority) SetRaw(value PatternFlowIpv4PriorityRaw) FlowIpv4Priority { + obj.setChoice(FlowIpv4PriorityChoice.RAW) + obj.rawHolder = nil + obj.obj.Raw = value.msg() + + return obj +} + +// description is TBD +// Tos returns a FlowIpv4Tos +func (obj *flowIpv4Priority) Tos() FlowIpv4Tos { + if obj.obj.Tos == nil { + obj.setChoice(FlowIpv4PriorityChoice.TOS) + } + if obj.tosHolder == nil { + obj.tosHolder = &flowIpv4Tos{obj: obj.obj.Tos} + } + return obj.tosHolder +} + +// description is TBD +// Tos returns a FlowIpv4Tos +func (obj *flowIpv4Priority) HasTos() bool { + return obj.obj.Tos != nil +} + +// description is TBD +// SetTos sets the FlowIpv4Tos value in the FlowIpv4Priority object +func (obj *flowIpv4Priority) SetTos(value FlowIpv4Tos) FlowIpv4Priority { + obj.setChoice(FlowIpv4PriorityChoice.TOS) + obj.tosHolder = nil + obj.obj.Tos = value.msg() + + return obj +} + +// description is TBD +// Dscp returns a FlowIpv4Dscp +func (obj *flowIpv4Priority) Dscp() FlowIpv4Dscp { + if obj.obj.Dscp == nil { + obj.setChoice(FlowIpv4PriorityChoice.DSCP) + } + if obj.dscpHolder == nil { + obj.dscpHolder = &flowIpv4Dscp{obj: obj.obj.Dscp} + } + return obj.dscpHolder +} + +// description is TBD +// Dscp returns a FlowIpv4Dscp +func (obj *flowIpv4Priority) HasDscp() bool { + return obj.obj.Dscp != nil +} + +// description is TBD +// SetDscp sets the FlowIpv4Dscp value in the FlowIpv4Priority object +func (obj *flowIpv4Priority) SetDscp(value FlowIpv4Dscp) FlowIpv4Priority { + obj.setChoice(FlowIpv4PriorityChoice.DSCP) + obj.dscpHolder = nil + obj.obj.Dscp = value.msg() + + return obj +} + +func (obj *flowIpv4Priority) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Raw != nil { + + obj.Raw().validateObj(vObj, set_default) + } + + if obj.obj.Tos != nil { + + obj.Tos().validateObj(vObj, set_default) + } + + if obj.obj.Dscp != nil { + + obj.Dscp().validateObj(vObj, set_default) + } + +} + +func (obj *flowIpv4Priority) setDefault() { + var choices_set int = 0 + var choice FlowIpv4PriorityChoiceEnum + + if obj.obj.Raw != nil { + choices_set += 1 + choice = FlowIpv4PriorityChoice.RAW + } + + if obj.obj.Tos != nil { + choices_set += 1 + choice = FlowIpv4PriorityChoice.TOS + } + + if obj.obj.Dscp != nil { + choices_set += 1 + choice = FlowIpv4PriorityChoice.DSCP + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowIpv4PriorityChoice.DSCP) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowIpv4Priority") + } + } else { + intVal := otg.FlowIpv4Priority_Choice_Enum_value[string(choice)] + enumValue := otg.FlowIpv4Priority_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_ipv4_tos.go b/gosnappi/flow_ipv4_tos.go new file mode 100644 index 00000000..1bd1f84e --- /dev/null +++ b/gosnappi/flow_ipv4_tos.go @@ -0,0 +1,543 @@ +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" +) + +// ***** FlowIpv4Tos ***** +type flowIpv4Tos struct { + validation + obj *otg.FlowIpv4Tos + marshaller marshalFlowIpv4Tos + unMarshaller unMarshalFlowIpv4Tos + precedenceHolder PatternFlowIpv4TosPrecedence + delayHolder PatternFlowIpv4TosDelay + throughputHolder PatternFlowIpv4TosThroughput + reliabilityHolder PatternFlowIpv4TosReliability + monetaryHolder PatternFlowIpv4TosMonetary + unusedHolder PatternFlowIpv4TosUnused +} + +func NewFlowIpv4Tos() FlowIpv4Tos { + obj := flowIpv4Tos{obj: &otg.FlowIpv4Tos{}} + obj.setDefault() + return &obj +} + +func (obj *flowIpv4Tos) msg() *otg.FlowIpv4Tos { + return obj.obj +} + +func (obj *flowIpv4Tos) setMsg(msg *otg.FlowIpv4Tos) FlowIpv4Tos { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIpv4Tos struct { + obj *flowIpv4Tos +} + +type marshalFlowIpv4Tos interface { + // ToProto marshals FlowIpv4Tos to protobuf object *otg.FlowIpv4Tos + ToProto() (*otg.FlowIpv4Tos, error) + // ToPbText marshals FlowIpv4Tos to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIpv4Tos to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIpv4Tos to JSON text + ToJson() (string, error) +} + +type unMarshalflowIpv4Tos struct { + obj *flowIpv4Tos +} + +type unMarshalFlowIpv4Tos interface { + // FromProto unmarshals FlowIpv4Tos from protobuf object *otg.FlowIpv4Tos + FromProto(msg *otg.FlowIpv4Tos) (FlowIpv4Tos, error) + // FromPbText unmarshals FlowIpv4Tos from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIpv4Tos from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIpv4Tos from JSON text + FromJson(value string) error +} + +func (obj *flowIpv4Tos) Marshal() marshalFlowIpv4Tos { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIpv4Tos{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIpv4Tos) Unmarshal() unMarshalFlowIpv4Tos { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIpv4Tos{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIpv4Tos) ToProto() (*otg.FlowIpv4Tos, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIpv4Tos) FromProto(msg *otg.FlowIpv4Tos) (FlowIpv4Tos, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIpv4Tos) 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 *unMarshalflowIpv4Tos) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowIpv4Tos) 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 *unMarshalflowIpv4Tos) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowIpv4Tos) 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 *unMarshalflowIpv4Tos) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowIpv4Tos) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIpv4Tos) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIpv4Tos) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIpv4Tos) Clone() (FlowIpv4Tos, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIpv4Tos() + 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 +} + +func (obj *flowIpv4Tos) setNil() { + obj.precedenceHolder = nil + obj.delayHolder = nil + obj.throughputHolder = nil + obj.reliabilityHolder = nil + obj.monetaryHolder = nil + obj.unusedHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowIpv4Tos is type of service (TOS) packet field. +type FlowIpv4Tos interface { + Validation + // msg marshals FlowIpv4Tos to protobuf object *otg.FlowIpv4Tos + // and doesn't set defaults + msg() *otg.FlowIpv4Tos + // setMsg unmarshals FlowIpv4Tos from protobuf object *otg.FlowIpv4Tos + // and doesn't set defaults + setMsg(*otg.FlowIpv4Tos) FlowIpv4Tos + // provides marshal interface + Marshal() marshalFlowIpv4Tos + // provides unmarshal interface + Unmarshal() unMarshalFlowIpv4Tos + // validate validates FlowIpv4Tos + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIpv4Tos, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Precedence returns PatternFlowIpv4TosPrecedence, set in FlowIpv4Tos. + // PatternFlowIpv4TosPrecedence is precedence + Precedence() PatternFlowIpv4TosPrecedence + // SetPrecedence assigns PatternFlowIpv4TosPrecedence provided by user to FlowIpv4Tos. + // PatternFlowIpv4TosPrecedence is precedence + SetPrecedence(value PatternFlowIpv4TosPrecedence) FlowIpv4Tos + // HasPrecedence checks if Precedence has been set in FlowIpv4Tos + HasPrecedence() bool + // Delay returns PatternFlowIpv4TosDelay, set in FlowIpv4Tos. + // PatternFlowIpv4TosDelay is delay + Delay() PatternFlowIpv4TosDelay + // SetDelay assigns PatternFlowIpv4TosDelay provided by user to FlowIpv4Tos. + // PatternFlowIpv4TosDelay is delay + SetDelay(value PatternFlowIpv4TosDelay) FlowIpv4Tos + // HasDelay checks if Delay has been set in FlowIpv4Tos + HasDelay() bool + // Throughput returns PatternFlowIpv4TosThroughput, set in FlowIpv4Tos. + // PatternFlowIpv4TosThroughput is throughput + Throughput() PatternFlowIpv4TosThroughput + // SetThroughput assigns PatternFlowIpv4TosThroughput provided by user to FlowIpv4Tos. + // PatternFlowIpv4TosThroughput is throughput + SetThroughput(value PatternFlowIpv4TosThroughput) FlowIpv4Tos + // HasThroughput checks if Throughput has been set in FlowIpv4Tos + HasThroughput() bool + // Reliability returns PatternFlowIpv4TosReliability, set in FlowIpv4Tos. + // PatternFlowIpv4TosReliability is reliability + Reliability() PatternFlowIpv4TosReliability + // SetReliability assigns PatternFlowIpv4TosReliability provided by user to FlowIpv4Tos. + // PatternFlowIpv4TosReliability is reliability + SetReliability(value PatternFlowIpv4TosReliability) FlowIpv4Tos + // HasReliability checks if Reliability has been set in FlowIpv4Tos + HasReliability() bool + // Monetary returns PatternFlowIpv4TosMonetary, set in FlowIpv4Tos. + // PatternFlowIpv4TosMonetary is monetary + Monetary() PatternFlowIpv4TosMonetary + // SetMonetary assigns PatternFlowIpv4TosMonetary provided by user to FlowIpv4Tos. + // PatternFlowIpv4TosMonetary is monetary + SetMonetary(value PatternFlowIpv4TosMonetary) FlowIpv4Tos + // HasMonetary checks if Monetary has been set in FlowIpv4Tos + HasMonetary() bool + // Unused returns PatternFlowIpv4TosUnused, set in FlowIpv4Tos. + // PatternFlowIpv4TosUnused is unused + Unused() PatternFlowIpv4TosUnused + // SetUnused assigns PatternFlowIpv4TosUnused provided by user to FlowIpv4Tos. + // PatternFlowIpv4TosUnused is unused + SetUnused(value PatternFlowIpv4TosUnused) FlowIpv4Tos + // HasUnused checks if Unused has been set in FlowIpv4Tos + HasUnused() bool + setNil() +} + +// description is TBD +// Precedence returns a PatternFlowIpv4TosPrecedence +func (obj *flowIpv4Tos) Precedence() PatternFlowIpv4TosPrecedence { + if obj.obj.Precedence == nil { + obj.obj.Precedence = NewPatternFlowIpv4TosPrecedence().msg() + } + if obj.precedenceHolder == nil { + obj.precedenceHolder = &patternFlowIpv4TosPrecedence{obj: obj.obj.Precedence} + } + return obj.precedenceHolder +} + +// description is TBD +// Precedence returns a PatternFlowIpv4TosPrecedence +func (obj *flowIpv4Tos) HasPrecedence() bool { + return obj.obj.Precedence != nil +} + +// description is TBD +// SetPrecedence sets the PatternFlowIpv4TosPrecedence value in the FlowIpv4Tos object +func (obj *flowIpv4Tos) SetPrecedence(value PatternFlowIpv4TosPrecedence) FlowIpv4Tos { + + obj.precedenceHolder = nil + obj.obj.Precedence = value.msg() + + return obj +} + +// description is TBD +// Delay returns a PatternFlowIpv4TosDelay +func (obj *flowIpv4Tos) Delay() PatternFlowIpv4TosDelay { + if obj.obj.Delay == nil { + obj.obj.Delay = NewPatternFlowIpv4TosDelay().msg() + } + if obj.delayHolder == nil { + obj.delayHolder = &patternFlowIpv4TosDelay{obj: obj.obj.Delay} + } + return obj.delayHolder +} + +// description is TBD +// Delay returns a PatternFlowIpv4TosDelay +func (obj *flowIpv4Tos) HasDelay() bool { + return obj.obj.Delay != nil +} + +// description is TBD +// SetDelay sets the PatternFlowIpv4TosDelay value in the FlowIpv4Tos object +func (obj *flowIpv4Tos) SetDelay(value PatternFlowIpv4TosDelay) FlowIpv4Tos { + + obj.delayHolder = nil + obj.obj.Delay = value.msg() + + return obj +} + +// description is TBD +// Throughput returns a PatternFlowIpv4TosThroughput +func (obj *flowIpv4Tos) Throughput() PatternFlowIpv4TosThroughput { + if obj.obj.Throughput == nil { + obj.obj.Throughput = NewPatternFlowIpv4TosThroughput().msg() + } + if obj.throughputHolder == nil { + obj.throughputHolder = &patternFlowIpv4TosThroughput{obj: obj.obj.Throughput} + } + return obj.throughputHolder +} + +// description is TBD +// Throughput returns a PatternFlowIpv4TosThroughput +func (obj *flowIpv4Tos) HasThroughput() bool { + return obj.obj.Throughput != nil +} + +// description is TBD +// SetThroughput sets the PatternFlowIpv4TosThroughput value in the FlowIpv4Tos object +func (obj *flowIpv4Tos) SetThroughput(value PatternFlowIpv4TosThroughput) FlowIpv4Tos { + + obj.throughputHolder = nil + obj.obj.Throughput = value.msg() + + return obj +} + +// description is TBD +// Reliability returns a PatternFlowIpv4TosReliability +func (obj *flowIpv4Tos) Reliability() PatternFlowIpv4TosReliability { + if obj.obj.Reliability == nil { + obj.obj.Reliability = NewPatternFlowIpv4TosReliability().msg() + } + if obj.reliabilityHolder == nil { + obj.reliabilityHolder = &patternFlowIpv4TosReliability{obj: obj.obj.Reliability} + } + return obj.reliabilityHolder +} + +// description is TBD +// Reliability returns a PatternFlowIpv4TosReliability +func (obj *flowIpv4Tos) HasReliability() bool { + return obj.obj.Reliability != nil +} + +// description is TBD +// SetReliability sets the PatternFlowIpv4TosReliability value in the FlowIpv4Tos object +func (obj *flowIpv4Tos) SetReliability(value PatternFlowIpv4TosReliability) FlowIpv4Tos { + + obj.reliabilityHolder = nil + obj.obj.Reliability = value.msg() + + return obj +} + +// description is TBD +// Monetary returns a PatternFlowIpv4TosMonetary +func (obj *flowIpv4Tos) Monetary() PatternFlowIpv4TosMonetary { + if obj.obj.Monetary == nil { + obj.obj.Monetary = NewPatternFlowIpv4TosMonetary().msg() + } + if obj.monetaryHolder == nil { + obj.monetaryHolder = &patternFlowIpv4TosMonetary{obj: obj.obj.Monetary} + } + return obj.monetaryHolder +} + +// description is TBD +// Monetary returns a PatternFlowIpv4TosMonetary +func (obj *flowIpv4Tos) HasMonetary() bool { + return obj.obj.Monetary != nil +} + +// description is TBD +// SetMonetary sets the PatternFlowIpv4TosMonetary value in the FlowIpv4Tos object +func (obj *flowIpv4Tos) SetMonetary(value PatternFlowIpv4TosMonetary) FlowIpv4Tos { + + obj.monetaryHolder = nil + obj.obj.Monetary = value.msg() + + return obj +} + +// description is TBD +// Unused returns a PatternFlowIpv4TosUnused +func (obj *flowIpv4Tos) Unused() PatternFlowIpv4TosUnused { + if obj.obj.Unused == nil { + obj.obj.Unused = NewPatternFlowIpv4TosUnused().msg() + } + if obj.unusedHolder == nil { + obj.unusedHolder = &patternFlowIpv4TosUnused{obj: obj.obj.Unused} + } + return obj.unusedHolder +} + +// description is TBD +// Unused returns a PatternFlowIpv4TosUnused +func (obj *flowIpv4Tos) HasUnused() bool { + return obj.obj.Unused != nil +} + +// description is TBD +// SetUnused sets the PatternFlowIpv4TosUnused value in the FlowIpv4Tos object +func (obj *flowIpv4Tos) SetUnused(value PatternFlowIpv4TosUnused) FlowIpv4Tos { + + obj.unusedHolder = nil + obj.obj.Unused = value.msg() + + return obj +} + +func (obj *flowIpv4Tos) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Precedence != nil { + + obj.Precedence().validateObj(vObj, set_default) + } + + if obj.obj.Delay != nil { + + obj.Delay().validateObj(vObj, set_default) + } + + if obj.obj.Throughput != nil { + + obj.Throughput().validateObj(vObj, set_default) + } + + if obj.obj.Reliability != nil { + + obj.Reliability().validateObj(vObj, set_default) + } + + if obj.obj.Monetary != nil { + + obj.Monetary().validateObj(vObj, set_default) + } + + if obj.obj.Unused != nil { + + obj.Unused().validateObj(vObj, set_default) + } + +} + +func (obj *flowIpv4Tos) setDefault() { + +} diff --git a/gosnappi/flow_ipv6.go b/gosnappi/flow_ipv6.go new file mode 100644 index 00000000..8da80bf5 --- /dev/null +++ b/gosnappi/flow_ipv6.go @@ -0,0 +1,629 @@ +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" +) + +// ***** FlowIpv6 ***** +type flowIpv6 struct { + validation + obj *otg.FlowIpv6 + marshaller marshalFlowIpv6 + unMarshaller unMarshalFlowIpv6 + versionHolder PatternFlowIpv6Version + trafficClassHolder PatternFlowIpv6TrafficClass + flowLabelHolder PatternFlowIpv6FlowLabel + payloadLengthHolder PatternFlowIpv6PayloadLength + nextHeaderHolder PatternFlowIpv6NextHeader + hopLimitHolder PatternFlowIpv6HopLimit + srcHolder PatternFlowIpv6Src + dstHolder PatternFlowIpv6Dst +} + +func NewFlowIpv6() FlowIpv6 { + obj := flowIpv6{obj: &otg.FlowIpv6{}} + obj.setDefault() + return &obj +} + +func (obj *flowIpv6) msg() *otg.FlowIpv6 { + return obj.obj +} + +func (obj *flowIpv6) setMsg(msg *otg.FlowIpv6) FlowIpv6 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowIpv6 struct { + obj *flowIpv6 +} + +type marshalFlowIpv6 interface { + // ToProto marshals FlowIpv6 to protobuf object *otg.FlowIpv6 + ToProto() (*otg.FlowIpv6, error) + // ToPbText marshals FlowIpv6 to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowIpv6 to YAML text + ToYaml() (string, error) + // ToJson marshals FlowIpv6 to JSON text + ToJson() (string, error) +} + +type unMarshalflowIpv6 struct { + obj *flowIpv6 +} + +type unMarshalFlowIpv6 interface { + // FromProto unmarshals FlowIpv6 from protobuf object *otg.FlowIpv6 + FromProto(msg *otg.FlowIpv6) (FlowIpv6, error) + // FromPbText unmarshals FlowIpv6 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowIpv6 from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowIpv6 from JSON text + FromJson(value string) error +} + +func (obj *flowIpv6) Marshal() marshalFlowIpv6 { + if obj.marshaller == nil { + obj.marshaller = &marshalflowIpv6{obj: obj} + } + return obj.marshaller +} + +func (obj *flowIpv6) Unmarshal() unMarshalFlowIpv6 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowIpv6{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowIpv6) ToProto() (*otg.FlowIpv6, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowIpv6) FromProto(msg *otg.FlowIpv6) (FlowIpv6, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowIpv6) 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 *unMarshalflowIpv6) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowIpv6) 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 *unMarshalflowIpv6) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowIpv6) 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 *unMarshalflowIpv6) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowIpv6) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowIpv6) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowIpv6) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowIpv6) Clone() (FlowIpv6, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowIpv6() + 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 +} + +func (obj *flowIpv6) setNil() { + obj.versionHolder = nil + obj.trafficClassHolder = nil + obj.flowLabelHolder = nil + obj.payloadLengthHolder = nil + obj.nextHeaderHolder = nil + obj.hopLimitHolder = nil + obj.srcHolder = nil + obj.dstHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowIpv6 is iPv6 packet header +type FlowIpv6 interface { + Validation + // msg marshals FlowIpv6 to protobuf object *otg.FlowIpv6 + // and doesn't set defaults + msg() *otg.FlowIpv6 + // setMsg unmarshals FlowIpv6 from protobuf object *otg.FlowIpv6 + // and doesn't set defaults + setMsg(*otg.FlowIpv6) FlowIpv6 + // provides marshal interface + Marshal() marshalFlowIpv6 + // provides unmarshal interface + Unmarshal() unMarshalFlowIpv6 + // validate validates FlowIpv6 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowIpv6, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Version returns PatternFlowIpv6Version, set in FlowIpv6. + // PatternFlowIpv6Version is version number + Version() PatternFlowIpv6Version + // SetVersion assigns PatternFlowIpv6Version provided by user to FlowIpv6. + // PatternFlowIpv6Version is version number + SetVersion(value PatternFlowIpv6Version) FlowIpv6 + // HasVersion checks if Version has been set in FlowIpv6 + HasVersion() bool + // TrafficClass returns PatternFlowIpv6TrafficClass, set in FlowIpv6. + // PatternFlowIpv6TrafficClass is traffic class + TrafficClass() PatternFlowIpv6TrafficClass + // SetTrafficClass assigns PatternFlowIpv6TrafficClass provided by user to FlowIpv6. + // PatternFlowIpv6TrafficClass is traffic class + SetTrafficClass(value PatternFlowIpv6TrafficClass) FlowIpv6 + // HasTrafficClass checks if TrafficClass has been set in FlowIpv6 + HasTrafficClass() bool + // FlowLabel returns PatternFlowIpv6FlowLabel, set in FlowIpv6. + // PatternFlowIpv6FlowLabel is flow label + FlowLabel() PatternFlowIpv6FlowLabel + // SetFlowLabel assigns PatternFlowIpv6FlowLabel provided by user to FlowIpv6. + // PatternFlowIpv6FlowLabel is flow label + SetFlowLabel(value PatternFlowIpv6FlowLabel) FlowIpv6 + // HasFlowLabel checks if FlowLabel has been set in FlowIpv6 + HasFlowLabel() bool + // PayloadLength returns PatternFlowIpv6PayloadLength, set in FlowIpv6. + // PatternFlowIpv6PayloadLength is payload length + PayloadLength() PatternFlowIpv6PayloadLength + // SetPayloadLength assigns PatternFlowIpv6PayloadLength provided by user to FlowIpv6. + // PatternFlowIpv6PayloadLength is payload length + SetPayloadLength(value PatternFlowIpv6PayloadLength) FlowIpv6 + // HasPayloadLength checks if PayloadLength has been set in FlowIpv6 + HasPayloadLength() bool + // NextHeader returns PatternFlowIpv6NextHeader, set in FlowIpv6. + // PatternFlowIpv6NextHeader is next header + NextHeader() PatternFlowIpv6NextHeader + // SetNextHeader assigns PatternFlowIpv6NextHeader provided by user to FlowIpv6. + // PatternFlowIpv6NextHeader is next header + SetNextHeader(value PatternFlowIpv6NextHeader) FlowIpv6 + // HasNextHeader checks if NextHeader has been set in FlowIpv6 + HasNextHeader() bool + // HopLimit returns PatternFlowIpv6HopLimit, set in FlowIpv6. + // PatternFlowIpv6HopLimit is hop limit + HopLimit() PatternFlowIpv6HopLimit + // SetHopLimit assigns PatternFlowIpv6HopLimit provided by user to FlowIpv6. + // PatternFlowIpv6HopLimit is hop limit + SetHopLimit(value PatternFlowIpv6HopLimit) FlowIpv6 + // HasHopLimit checks if HopLimit has been set in FlowIpv6 + HasHopLimit() bool + // Src returns PatternFlowIpv6Src, set in FlowIpv6. + // PatternFlowIpv6Src is source address + Src() PatternFlowIpv6Src + // SetSrc assigns PatternFlowIpv6Src provided by user to FlowIpv6. + // PatternFlowIpv6Src is source address + SetSrc(value PatternFlowIpv6Src) FlowIpv6 + // HasSrc checks if Src has been set in FlowIpv6 + HasSrc() bool + // Dst returns PatternFlowIpv6Dst, set in FlowIpv6. + // PatternFlowIpv6Dst is destination address + Dst() PatternFlowIpv6Dst + // SetDst assigns PatternFlowIpv6Dst provided by user to FlowIpv6. + // PatternFlowIpv6Dst is destination address + SetDst(value PatternFlowIpv6Dst) FlowIpv6 + // HasDst checks if Dst has been set in FlowIpv6 + HasDst() bool + setNil() +} + +// description is TBD +// Version returns a PatternFlowIpv6Version +func (obj *flowIpv6) Version() PatternFlowIpv6Version { + if obj.obj.Version == nil { + obj.obj.Version = NewPatternFlowIpv6Version().msg() + } + if obj.versionHolder == nil { + obj.versionHolder = &patternFlowIpv6Version{obj: obj.obj.Version} + } + return obj.versionHolder +} + +// description is TBD +// Version returns a PatternFlowIpv6Version +func (obj *flowIpv6) HasVersion() bool { + return obj.obj.Version != nil +} + +// description is TBD +// SetVersion sets the PatternFlowIpv6Version value in the FlowIpv6 object +func (obj *flowIpv6) SetVersion(value PatternFlowIpv6Version) FlowIpv6 { + + obj.versionHolder = nil + obj.obj.Version = value.msg() + + return obj +} + +// description is TBD +// TrafficClass returns a PatternFlowIpv6TrafficClass +func (obj *flowIpv6) TrafficClass() PatternFlowIpv6TrafficClass { + if obj.obj.TrafficClass == nil { + obj.obj.TrafficClass = NewPatternFlowIpv6TrafficClass().msg() + } + if obj.trafficClassHolder == nil { + obj.trafficClassHolder = &patternFlowIpv6TrafficClass{obj: obj.obj.TrafficClass} + } + return obj.trafficClassHolder +} + +// description is TBD +// TrafficClass returns a PatternFlowIpv6TrafficClass +func (obj *flowIpv6) HasTrafficClass() bool { + return obj.obj.TrafficClass != nil +} + +// description is TBD +// SetTrafficClass sets the PatternFlowIpv6TrafficClass value in the FlowIpv6 object +func (obj *flowIpv6) SetTrafficClass(value PatternFlowIpv6TrafficClass) FlowIpv6 { + + obj.trafficClassHolder = nil + obj.obj.TrafficClass = value.msg() + + return obj +} + +// description is TBD +// FlowLabel returns a PatternFlowIpv6FlowLabel +func (obj *flowIpv6) FlowLabel() PatternFlowIpv6FlowLabel { + if obj.obj.FlowLabel == nil { + obj.obj.FlowLabel = NewPatternFlowIpv6FlowLabel().msg() + } + if obj.flowLabelHolder == nil { + obj.flowLabelHolder = &patternFlowIpv6FlowLabel{obj: obj.obj.FlowLabel} + } + return obj.flowLabelHolder +} + +// description is TBD +// FlowLabel returns a PatternFlowIpv6FlowLabel +func (obj *flowIpv6) HasFlowLabel() bool { + return obj.obj.FlowLabel != nil +} + +// description is TBD +// SetFlowLabel sets the PatternFlowIpv6FlowLabel value in the FlowIpv6 object +func (obj *flowIpv6) SetFlowLabel(value PatternFlowIpv6FlowLabel) FlowIpv6 { + + obj.flowLabelHolder = nil + obj.obj.FlowLabel = value.msg() + + return obj +} + +// description is TBD +// PayloadLength returns a PatternFlowIpv6PayloadLength +func (obj *flowIpv6) PayloadLength() PatternFlowIpv6PayloadLength { + if obj.obj.PayloadLength == nil { + obj.obj.PayloadLength = NewPatternFlowIpv6PayloadLength().msg() + } + if obj.payloadLengthHolder == nil { + obj.payloadLengthHolder = &patternFlowIpv6PayloadLength{obj: obj.obj.PayloadLength} + } + return obj.payloadLengthHolder +} + +// description is TBD +// PayloadLength returns a PatternFlowIpv6PayloadLength +func (obj *flowIpv6) HasPayloadLength() bool { + return obj.obj.PayloadLength != nil +} + +// description is TBD +// SetPayloadLength sets the PatternFlowIpv6PayloadLength value in the FlowIpv6 object +func (obj *flowIpv6) SetPayloadLength(value PatternFlowIpv6PayloadLength) FlowIpv6 { + + obj.payloadLengthHolder = nil + obj.obj.PayloadLength = value.msg() + + return obj +} + +// description is TBD +// NextHeader returns a PatternFlowIpv6NextHeader +func (obj *flowIpv6) NextHeader() PatternFlowIpv6NextHeader { + if obj.obj.NextHeader == nil { + obj.obj.NextHeader = NewPatternFlowIpv6NextHeader().msg() + } + if obj.nextHeaderHolder == nil { + obj.nextHeaderHolder = &patternFlowIpv6NextHeader{obj: obj.obj.NextHeader} + } + return obj.nextHeaderHolder +} + +// description is TBD +// NextHeader returns a PatternFlowIpv6NextHeader +func (obj *flowIpv6) HasNextHeader() bool { + return obj.obj.NextHeader != nil +} + +// description is TBD +// SetNextHeader sets the PatternFlowIpv6NextHeader value in the FlowIpv6 object +func (obj *flowIpv6) SetNextHeader(value PatternFlowIpv6NextHeader) FlowIpv6 { + + obj.nextHeaderHolder = nil + obj.obj.NextHeader = value.msg() + + return obj +} + +// description is TBD +// HopLimit returns a PatternFlowIpv6HopLimit +func (obj *flowIpv6) HopLimit() PatternFlowIpv6HopLimit { + if obj.obj.HopLimit == nil { + obj.obj.HopLimit = NewPatternFlowIpv6HopLimit().msg() + } + if obj.hopLimitHolder == nil { + obj.hopLimitHolder = &patternFlowIpv6HopLimit{obj: obj.obj.HopLimit} + } + return obj.hopLimitHolder +} + +// description is TBD +// HopLimit returns a PatternFlowIpv6HopLimit +func (obj *flowIpv6) HasHopLimit() bool { + return obj.obj.HopLimit != nil +} + +// description is TBD +// SetHopLimit sets the PatternFlowIpv6HopLimit value in the FlowIpv6 object +func (obj *flowIpv6) SetHopLimit(value PatternFlowIpv6HopLimit) FlowIpv6 { + + obj.hopLimitHolder = nil + obj.obj.HopLimit = value.msg() + + return obj +} + +// description is TBD +// Src returns a PatternFlowIpv6Src +func (obj *flowIpv6) Src() PatternFlowIpv6Src { + if obj.obj.Src == nil { + obj.obj.Src = NewPatternFlowIpv6Src().msg() + } + if obj.srcHolder == nil { + obj.srcHolder = &patternFlowIpv6Src{obj: obj.obj.Src} + } + return obj.srcHolder +} + +// description is TBD +// Src returns a PatternFlowIpv6Src +func (obj *flowIpv6) HasSrc() bool { + return obj.obj.Src != nil +} + +// description is TBD +// SetSrc sets the PatternFlowIpv6Src value in the FlowIpv6 object +func (obj *flowIpv6) SetSrc(value PatternFlowIpv6Src) FlowIpv6 { + + obj.srcHolder = nil + obj.obj.Src = value.msg() + + return obj +} + +// description is TBD +// Dst returns a PatternFlowIpv6Dst +func (obj *flowIpv6) Dst() PatternFlowIpv6Dst { + if obj.obj.Dst == nil { + obj.obj.Dst = NewPatternFlowIpv6Dst().msg() + } + if obj.dstHolder == nil { + obj.dstHolder = &patternFlowIpv6Dst{obj: obj.obj.Dst} + } + return obj.dstHolder +} + +// description is TBD +// Dst returns a PatternFlowIpv6Dst +func (obj *flowIpv6) HasDst() bool { + return obj.obj.Dst != nil +} + +// description is TBD +// SetDst sets the PatternFlowIpv6Dst value in the FlowIpv6 object +func (obj *flowIpv6) SetDst(value PatternFlowIpv6Dst) FlowIpv6 { + + obj.dstHolder = nil + obj.obj.Dst = value.msg() + + return obj +} + +func (obj *flowIpv6) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Version != nil { + + obj.Version().validateObj(vObj, set_default) + } + + if obj.obj.TrafficClass != nil { + + obj.TrafficClass().validateObj(vObj, set_default) + } + + if obj.obj.FlowLabel != nil { + + obj.FlowLabel().validateObj(vObj, set_default) + } + + if obj.obj.PayloadLength != nil { + + obj.PayloadLength().validateObj(vObj, set_default) + } + + if obj.obj.NextHeader != nil { + + obj.NextHeader().validateObj(vObj, set_default) + } + + if obj.obj.HopLimit != nil { + + obj.HopLimit().validateObj(vObj, set_default) + } + + if obj.obj.Src != nil { + + obj.Src().validateObj(vObj, set_default) + } + + if obj.obj.Dst != nil { + + obj.Dst().validateObj(vObj, set_default) + } + +} + +func (obj *flowIpv6) setDefault() { + +} diff --git a/gosnappi/flow_latency_metrics.go b/gosnappi/flow_latency_metrics.go new file mode 100644 index 00000000..116eb5c9 --- /dev/null +++ b/gosnappi/flow_latency_metrics.go @@ -0,0 +1,374 @@ +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" +) + +// ***** FlowLatencyMetrics ***** +type flowLatencyMetrics struct { + validation + obj *otg.FlowLatencyMetrics + marshaller marshalFlowLatencyMetrics + unMarshaller unMarshalFlowLatencyMetrics +} + +func NewFlowLatencyMetrics() FlowLatencyMetrics { + obj := flowLatencyMetrics{obj: &otg.FlowLatencyMetrics{}} + obj.setDefault() + return &obj +} + +func (obj *flowLatencyMetrics) msg() *otg.FlowLatencyMetrics { + return obj.obj +} + +func (obj *flowLatencyMetrics) setMsg(msg *otg.FlowLatencyMetrics) FlowLatencyMetrics { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowLatencyMetrics struct { + obj *flowLatencyMetrics +} + +type marshalFlowLatencyMetrics interface { + // ToProto marshals FlowLatencyMetrics to protobuf object *otg.FlowLatencyMetrics + ToProto() (*otg.FlowLatencyMetrics, error) + // ToPbText marshals FlowLatencyMetrics to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowLatencyMetrics to YAML text + ToYaml() (string, error) + // ToJson marshals FlowLatencyMetrics to JSON text + ToJson() (string, error) +} + +type unMarshalflowLatencyMetrics struct { + obj *flowLatencyMetrics +} + +type unMarshalFlowLatencyMetrics interface { + // FromProto unmarshals FlowLatencyMetrics from protobuf object *otg.FlowLatencyMetrics + FromProto(msg *otg.FlowLatencyMetrics) (FlowLatencyMetrics, error) + // FromPbText unmarshals FlowLatencyMetrics from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowLatencyMetrics from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowLatencyMetrics from JSON text + FromJson(value string) error +} + +func (obj *flowLatencyMetrics) Marshal() marshalFlowLatencyMetrics { + if obj.marshaller == nil { + obj.marshaller = &marshalflowLatencyMetrics{obj: obj} + } + return obj.marshaller +} + +func (obj *flowLatencyMetrics) Unmarshal() unMarshalFlowLatencyMetrics { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowLatencyMetrics{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowLatencyMetrics) ToProto() (*otg.FlowLatencyMetrics, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowLatencyMetrics) FromProto(msg *otg.FlowLatencyMetrics) (FlowLatencyMetrics, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowLatencyMetrics) 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 *unMarshalflowLatencyMetrics) 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 *marshalflowLatencyMetrics) 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 *unMarshalflowLatencyMetrics) 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 *marshalflowLatencyMetrics) 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 *unMarshalflowLatencyMetrics) 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 *flowLatencyMetrics) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowLatencyMetrics) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowLatencyMetrics) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowLatencyMetrics) Clone() (FlowLatencyMetrics, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowLatencyMetrics() + 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 +} + +// FlowLatencyMetrics is the optional container for per flow latency metric configuration. +type FlowLatencyMetrics interface { + Validation + // msg marshals FlowLatencyMetrics to protobuf object *otg.FlowLatencyMetrics + // and doesn't set defaults + msg() *otg.FlowLatencyMetrics + // setMsg unmarshals FlowLatencyMetrics from protobuf object *otg.FlowLatencyMetrics + // and doesn't set defaults + setMsg(*otg.FlowLatencyMetrics) FlowLatencyMetrics + // provides marshal interface + Marshal() marshalFlowLatencyMetrics + // provides unmarshal interface + Unmarshal() unMarshalFlowLatencyMetrics + // validate validates FlowLatencyMetrics + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowLatencyMetrics, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Enable returns bool, set in FlowLatencyMetrics. + Enable() bool + // SetEnable assigns bool provided by user to FlowLatencyMetrics + SetEnable(value bool) FlowLatencyMetrics + // HasEnable checks if Enable has been set in FlowLatencyMetrics + HasEnable() bool + // Mode returns FlowLatencyMetricsModeEnum, set in FlowLatencyMetrics + Mode() FlowLatencyMetricsModeEnum + // SetMode assigns FlowLatencyMetricsModeEnum provided by user to FlowLatencyMetrics + SetMode(value FlowLatencyMetricsModeEnum) FlowLatencyMetrics + // HasMode checks if Mode has been set in FlowLatencyMetrics + HasMode() bool +} + +// True to enable latency metrics using timestamps. +// +// Enabling this option may affect the resultant packet payload due to +// additional instrumentation data. +// Enable returns a bool +func (obj *flowLatencyMetrics) Enable() bool { + + return *obj.obj.Enable + +} + +// True to enable latency metrics using timestamps. +// +// Enabling this option may affect the resultant packet payload due to +// additional instrumentation data. +// Enable returns a bool +func (obj *flowLatencyMetrics) HasEnable() bool { + return obj.obj.Enable != nil +} + +// True to enable latency metrics using timestamps. +// +// Enabling this option may affect the resultant packet payload due to +// additional instrumentation data. +// SetEnable sets the bool value in the FlowLatencyMetrics object +func (obj *flowLatencyMetrics) SetEnable(value bool) FlowLatencyMetrics { + + obj.obj.Enable = &value + return obj +} + +type FlowLatencyMetricsModeEnum string + +// Enum of Mode on FlowLatencyMetrics +var FlowLatencyMetricsMode = struct { + STORE_FORWARD FlowLatencyMetricsModeEnum + CUT_THROUGH FlowLatencyMetricsModeEnum +}{ + STORE_FORWARD: FlowLatencyMetricsModeEnum("store_forward"), + CUT_THROUGH: FlowLatencyMetricsModeEnum("cut_through"), +} + +func (obj *flowLatencyMetrics) Mode() FlowLatencyMetricsModeEnum { + return FlowLatencyMetricsModeEnum(obj.obj.Mode.Enum().String()) +} + +// Select the type of latency measurement. The different types of +// latency measurements are: +// +// store_forward: +// The time interval starting when the last bit of the frame leaves the +// sending port and ending when the first bit of the frame is seen on +// the receiving port (LIFO). This is based on the RFC 1242 standard. +// +// cut_through: +// The time interval starting when the first bit of the frame leaves +// the sending port and ending when the first bit of the frame is seen +// on the receiving port (FIFO). This is based on the RFC 1242 +// standard. +// Mode returns a string +func (obj *flowLatencyMetrics) HasMode() bool { + return obj.obj.Mode != nil +} + +func (obj *flowLatencyMetrics) SetMode(value FlowLatencyMetricsModeEnum) FlowLatencyMetrics { + intValue, ok := otg.FlowLatencyMetrics_Mode_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowLatencyMetricsModeEnum", string(value))) + return obj + } + enumValue := otg.FlowLatencyMetrics_Mode_Enum(intValue) + obj.obj.Mode = &enumValue + + return obj +} + +func (obj *flowLatencyMetrics) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *flowLatencyMetrics) setDefault() { + if obj.obj.Enable == nil { + obj.SetEnable(false) + } + if obj.obj.Mode == nil { + obj.SetMode(FlowLatencyMetricsMode.STORE_FORWARD) + + } + +} diff --git a/gosnappi/flow_metric.go b/gosnappi/flow_metric.go new file mode 100644 index 00000000..a6cb5404 --- /dev/null +++ b/gosnappi/flow_metric.go @@ -0,0 +1,813 @@ +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" +) + +// ***** FlowMetric ***** +type flowMetric struct { + validation + obj *otg.FlowMetric + marshaller marshalFlowMetric + unMarshaller unMarshalFlowMetric + timestampsHolder MetricTimestamp + latencyHolder MetricLatency + taggedMetricsHolder FlowMetricFlowTaggedMetricIter +} + +func NewFlowMetric() FlowMetric { + obj := flowMetric{obj: &otg.FlowMetric{}} + obj.setDefault() + return &obj +} + +func (obj *flowMetric) msg() *otg.FlowMetric { + return obj.obj +} + +func (obj *flowMetric) setMsg(msg *otg.FlowMetric) FlowMetric { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowMetric struct { + obj *flowMetric +} + +type marshalFlowMetric interface { + // ToProto marshals FlowMetric to protobuf object *otg.FlowMetric + ToProto() (*otg.FlowMetric, error) + // ToPbText marshals FlowMetric to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowMetric to YAML text + ToYaml() (string, error) + // ToJson marshals FlowMetric to JSON text + ToJson() (string, error) +} + +type unMarshalflowMetric struct { + obj *flowMetric +} + +type unMarshalFlowMetric interface { + // FromProto unmarshals FlowMetric from protobuf object *otg.FlowMetric + FromProto(msg *otg.FlowMetric) (FlowMetric, error) + // FromPbText unmarshals FlowMetric from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowMetric from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowMetric from JSON text + FromJson(value string) error +} + +func (obj *flowMetric) Marshal() marshalFlowMetric { + if obj.marshaller == nil { + obj.marshaller = &marshalflowMetric{obj: obj} + } + return obj.marshaller +} + +func (obj *flowMetric) Unmarshal() unMarshalFlowMetric { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowMetric{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowMetric) ToProto() (*otg.FlowMetric, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowMetric) FromProto(msg *otg.FlowMetric) (FlowMetric, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowMetric) 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 *unMarshalflowMetric) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowMetric) 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 *unMarshalflowMetric) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowMetric) 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 *unMarshalflowMetric) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowMetric) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowMetric) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowMetric) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowMetric) Clone() (FlowMetric, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowMetric() + 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 +} + +func (obj *flowMetric) setNil() { + obj.timestampsHolder = nil + obj.latencyHolder = nil + obj.taggedMetricsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowMetric is a container for flow metrics. +// The container is keyed by the name, port_tx and port_rx. +type FlowMetric interface { + Validation + // msg marshals FlowMetric to protobuf object *otg.FlowMetric + // and doesn't set defaults + msg() *otg.FlowMetric + // setMsg unmarshals FlowMetric from protobuf object *otg.FlowMetric + // and doesn't set defaults + setMsg(*otg.FlowMetric) FlowMetric + // provides marshal interface + Marshal() marshalFlowMetric + // provides unmarshal interface + Unmarshal() unMarshalFlowMetric + // validate validates FlowMetric + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowMetric, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in FlowMetric. + Name() string + // SetName assigns string provided by user to FlowMetric + SetName(value string) FlowMetric + // HasName checks if Name has been set in FlowMetric + HasName() bool + // PortTx returns string, set in FlowMetric. + PortTx() string + // SetPortTx assigns string provided by user to FlowMetric + SetPortTx(value string) FlowMetric + // HasPortTx checks if PortTx has been set in FlowMetric + HasPortTx() bool + // PortRx returns string, set in FlowMetric. + PortRx() string + // SetPortRx assigns string provided by user to FlowMetric + SetPortRx(value string) FlowMetric + // HasPortRx checks if PortRx has been set in FlowMetric + HasPortRx() bool + // Transmit returns FlowMetricTransmitEnum, set in FlowMetric + Transmit() FlowMetricTransmitEnum + // SetTransmit assigns FlowMetricTransmitEnum provided by user to FlowMetric + SetTransmit(value FlowMetricTransmitEnum) FlowMetric + // HasTransmit checks if Transmit has been set in FlowMetric + HasTransmit() bool + // FramesTx returns uint64, set in FlowMetric. + FramesTx() uint64 + // SetFramesTx assigns uint64 provided by user to FlowMetric + SetFramesTx(value uint64) FlowMetric + // HasFramesTx checks if FramesTx has been set in FlowMetric + HasFramesTx() bool + // FramesRx returns uint64, set in FlowMetric. + FramesRx() uint64 + // SetFramesRx assigns uint64 provided by user to FlowMetric + SetFramesRx(value uint64) FlowMetric + // HasFramesRx checks if FramesRx has been set in FlowMetric + HasFramesRx() bool + // BytesTx returns uint64, set in FlowMetric. + BytesTx() uint64 + // SetBytesTx assigns uint64 provided by user to FlowMetric + SetBytesTx(value uint64) FlowMetric + // HasBytesTx checks if BytesTx has been set in FlowMetric + HasBytesTx() bool + // BytesRx returns uint64, set in FlowMetric. + BytesRx() uint64 + // SetBytesRx assigns uint64 provided by user to FlowMetric + SetBytesRx(value uint64) FlowMetric + // HasBytesRx checks if BytesRx has been set in FlowMetric + HasBytesRx() bool + // FramesTxRate returns float32, set in FlowMetric. + FramesTxRate() float32 + // SetFramesTxRate assigns float32 provided by user to FlowMetric + SetFramesTxRate(value float32) FlowMetric + // HasFramesTxRate checks if FramesTxRate has been set in FlowMetric + HasFramesTxRate() bool + // FramesRxRate returns float32, set in FlowMetric. + FramesRxRate() float32 + // SetFramesRxRate assigns float32 provided by user to FlowMetric + SetFramesRxRate(value float32) FlowMetric + // HasFramesRxRate checks if FramesRxRate has been set in FlowMetric + HasFramesRxRate() bool + // Loss returns float32, set in FlowMetric. + Loss() float32 + // SetLoss assigns float32 provided by user to FlowMetric + SetLoss(value float32) FlowMetric + // HasLoss checks if Loss has been set in FlowMetric + HasLoss() bool + // Timestamps returns MetricTimestamp, set in FlowMetric. + // MetricTimestamp is the container for timestamp metrics. + // The container will be empty if the timestamp has not been configured for + // the flow. + Timestamps() MetricTimestamp + // SetTimestamps assigns MetricTimestamp provided by user to FlowMetric. + // MetricTimestamp is the container for timestamp metrics. + // The container will be empty if the timestamp has not been configured for + // the flow. + SetTimestamps(value MetricTimestamp) FlowMetric + // HasTimestamps checks if Timestamps has been set in FlowMetric + HasTimestamps() bool + // Latency returns MetricLatency, set in FlowMetric. + // MetricLatency is the container for latency metrics. + // The min/max/avg values are dependent on the type of latency measurement + // mode that is configured. + // The container will be empty if the latency has not been configured for + // the flow. + Latency() MetricLatency + // SetLatency assigns MetricLatency provided by user to FlowMetric. + // MetricLatency is the container for latency metrics. + // The min/max/avg values are dependent on the type of latency measurement + // mode that is configured. + // The container will be empty if the latency has not been configured for + // the flow. + SetLatency(value MetricLatency) FlowMetric + // HasLatency checks if Latency has been set in FlowMetric + HasLatency() bool + // TaggedMetrics returns FlowMetricFlowTaggedMetricIterIter, set in FlowMetric + TaggedMetrics() FlowMetricFlowTaggedMetricIter + setNil() +} + +// The name of the flow +// Name returns a string +func (obj *flowMetric) Name() string { + + return *obj.obj.Name + +} + +// The name of the flow +// Name returns a string +func (obj *flowMetric) HasName() bool { + return obj.obj.Name != nil +} + +// The name of the flow +// SetName sets the string value in the FlowMetric object +func (obj *flowMetric) SetName(value string) FlowMetric { + + obj.obj.Name = &value + return obj +} + +// The name of the transmit port +// PortTx returns a string +func (obj *flowMetric) PortTx() string { + + return *obj.obj.PortTx + +} + +// The name of the transmit port +// PortTx returns a string +func (obj *flowMetric) HasPortTx() bool { + return obj.obj.PortTx != nil +} + +// The name of the transmit port +// SetPortTx sets the string value in the FlowMetric object +func (obj *flowMetric) SetPortTx(value string) FlowMetric { + + obj.obj.PortTx = &value + return obj +} + +// The name of the receive port +// PortRx returns a string +func (obj *flowMetric) PortRx() string { + + return *obj.obj.PortRx + +} + +// The name of the receive port +// PortRx returns a string +func (obj *flowMetric) HasPortRx() bool { + return obj.obj.PortRx != nil +} + +// The name of the receive port +// SetPortRx sets the string value in the FlowMetric object +func (obj *flowMetric) SetPortRx(value string) FlowMetric { + + obj.obj.PortRx = &value + return obj +} + +type FlowMetricTransmitEnum string + +// Enum of Transmit on FlowMetric +var FlowMetricTransmit = struct { + STARTED FlowMetricTransmitEnum + STOPPED FlowMetricTransmitEnum + PAUSED FlowMetricTransmitEnum +}{ + STARTED: FlowMetricTransmitEnum("started"), + STOPPED: FlowMetricTransmitEnum("stopped"), + PAUSED: FlowMetricTransmitEnum("paused"), +} + +func (obj *flowMetric) Transmit() FlowMetricTransmitEnum { + return FlowMetricTransmitEnum(obj.obj.Transmit.Enum().String()) +} + +// The transmit state of the flow. +// Transmit returns a string +func (obj *flowMetric) HasTransmit() bool { + return obj.obj.Transmit != nil +} + +func (obj *flowMetric) SetTransmit(value FlowMetricTransmitEnum) FlowMetric { + intValue, ok := otg.FlowMetric_Transmit_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowMetricTransmitEnum", string(value))) + return obj + } + enumValue := otg.FlowMetric_Transmit_Enum(intValue) + obj.obj.Transmit = &enumValue + + return obj +} + +// The current total number of frames transmitted +// FramesTx returns a uint64 +func (obj *flowMetric) FramesTx() uint64 { + + return *obj.obj.FramesTx + +} + +// The current total number of frames transmitted +// FramesTx returns a uint64 +func (obj *flowMetric) HasFramesTx() bool { + return obj.obj.FramesTx != nil +} + +// The current total number of frames transmitted +// SetFramesTx sets the uint64 value in the FlowMetric object +func (obj *flowMetric) SetFramesTx(value uint64) FlowMetric { + + obj.obj.FramesTx = &value + return obj +} + +// The current total number of valid frames received +// FramesRx returns a uint64 +func (obj *flowMetric) FramesRx() uint64 { + + return *obj.obj.FramesRx + +} + +// The current total number of valid frames received +// FramesRx returns a uint64 +func (obj *flowMetric) HasFramesRx() bool { + return obj.obj.FramesRx != nil +} + +// The current total number of valid frames received +// SetFramesRx sets the uint64 value in the FlowMetric object +func (obj *flowMetric) SetFramesRx(value uint64) FlowMetric { + + obj.obj.FramesRx = &value + return obj +} + +// The current total number of bytes transmitted +// BytesTx returns a uint64 +func (obj *flowMetric) BytesTx() uint64 { + + return *obj.obj.BytesTx + +} + +// The current total number of bytes transmitted +// BytesTx returns a uint64 +func (obj *flowMetric) HasBytesTx() bool { + return obj.obj.BytesTx != nil +} + +// The current total number of bytes transmitted +// SetBytesTx sets the uint64 value in the FlowMetric object +func (obj *flowMetric) SetBytesTx(value uint64) FlowMetric { + + obj.obj.BytesTx = &value + return obj +} + +// The current total number of bytes received +// BytesRx returns a uint64 +func (obj *flowMetric) BytesRx() uint64 { + + return *obj.obj.BytesRx + +} + +// The current total number of bytes received +// BytesRx returns a uint64 +func (obj *flowMetric) HasBytesRx() bool { + return obj.obj.BytesRx != nil +} + +// The current total number of bytes received +// SetBytesRx sets the uint64 value in the FlowMetric object +func (obj *flowMetric) SetBytesRx(value uint64) FlowMetric { + + obj.obj.BytesRx = &value + return obj +} + +// The current rate of frames transmitted +// FramesTxRate returns a float32 +func (obj *flowMetric) FramesTxRate() float32 { + + return *obj.obj.FramesTxRate + +} + +// The current rate of frames transmitted +// FramesTxRate returns a float32 +func (obj *flowMetric) HasFramesTxRate() bool { + return obj.obj.FramesTxRate != nil +} + +// The current rate of frames transmitted +// SetFramesTxRate sets the float32 value in the FlowMetric object +func (obj *flowMetric) SetFramesTxRate(value float32) FlowMetric { + + obj.obj.FramesTxRate = &value + return obj +} + +// The current rate of valid frames received +// FramesRxRate returns a float32 +func (obj *flowMetric) FramesRxRate() float32 { + + return *obj.obj.FramesRxRate + +} + +// The current rate of valid frames received +// FramesRxRate returns a float32 +func (obj *flowMetric) HasFramesRxRate() bool { + return obj.obj.FramesRxRate != nil +} + +// The current rate of valid frames received +// SetFramesRxRate sets the float32 value in the FlowMetric object +func (obj *flowMetric) SetFramesRxRate(value float32) FlowMetric { + + obj.obj.FramesRxRate = &value + return obj +} + +// The percentage of lost frames +// Loss returns a float32 +func (obj *flowMetric) Loss() float32 { + + return *obj.obj.Loss + +} + +// The percentage of lost frames +// Loss returns a float32 +func (obj *flowMetric) HasLoss() bool { + return obj.obj.Loss != nil +} + +// The percentage of lost frames +// SetLoss sets the float32 value in the FlowMetric object +func (obj *flowMetric) SetLoss(value float32) FlowMetric { + + obj.obj.Loss = &value + return obj +} + +// description is TBD +// Timestamps returns a MetricTimestamp +func (obj *flowMetric) Timestamps() MetricTimestamp { + if obj.obj.Timestamps == nil { + obj.obj.Timestamps = NewMetricTimestamp().msg() + } + if obj.timestampsHolder == nil { + obj.timestampsHolder = &metricTimestamp{obj: obj.obj.Timestamps} + } + return obj.timestampsHolder +} + +// description is TBD +// Timestamps returns a MetricTimestamp +func (obj *flowMetric) HasTimestamps() bool { + return obj.obj.Timestamps != nil +} + +// description is TBD +// SetTimestamps sets the MetricTimestamp value in the FlowMetric object +func (obj *flowMetric) SetTimestamps(value MetricTimestamp) FlowMetric { + + obj.timestampsHolder = nil + obj.obj.Timestamps = value.msg() + + return obj +} + +// description is TBD +// Latency returns a MetricLatency +func (obj *flowMetric) Latency() MetricLatency { + if obj.obj.Latency == nil { + obj.obj.Latency = NewMetricLatency().msg() + } + if obj.latencyHolder == nil { + obj.latencyHolder = &metricLatency{obj: obj.obj.Latency} + } + return obj.latencyHolder +} + +// description is TBD +// Latency returns a MetricLatency +func (obj *flowMetric) HasLatency() bool { + return obj.obj.Latency != nil +} + +// description is TBD +// SetLatency sets the MetricLatency value in the FlowMetric object +func (obj *flowMetric) SetLatency(value MetricLatency) FlowMetric { + + obj.latencyHolder = nil + obj.obj.Latency = value.msg() + + return obj +} + +// List of metrics corresponding to a set of values applicable +// for configured metric tags in ingress or egress packet header fields of corresponding flow. +// The container is keyed by list of tag-value pairs. +// TaggedMetrics returns a []FlowTaggedMetric +func (obj *flowMetric) TaggedMetrics() FlowMetricFlowTaggedMetricIter { + if len(obj.obj.TaggedMetrics) == 0 { + obj.obj.TaggedMetrics = []*otg.FlowTaggedMetric{} + } + if obj.taggedMetricsHolder == nil { + obj.taggedMetricsHolder = newFlowMetricFlowTaggedMetricIter(&obj.obj.TaggedMetrics).setMsg(obj) + } + return obj.taggedMetricsHolder +} + +type flowMetricFlowTaggedMetricIter struct { + obj *flowMetric + flowTaggedMetricSlice []FlowTaggedMetric + fieldPtr *[]*otg.FlowTaggedMetric +} + +func newFlowMetricFlowTaggedMetricIter(ptr *[]*otg.FlowTaggedMetric) FlowMetricFlowTaggedMetricIter { + return &flowMetricFlowTaggedMetricIter{fieldPtr: ptr} +} + +type FlowMetricFlowTaggedMetricIter interface { + setMsg(*flowMetric) FlowMetricFlowTaggedMetricIter + Items() []FlowTaggedMetric + Add() FlowTaggedMetric + Append(items ...FlowTaggedMetric) FlowMetricFlowTaggedMetricIter + Set(index int, newObj FlowTaggedMetric) FlowMetricFlowTaggedMetricIter + Clear() FlowMetricFlowTaggedMetricIter + clearHolderSlice() FlowMetricFlowTaggedMetricIter + appendHolderSlice(item FlowTaggedMetric) FlowMetricFlowTaggedMetricIter +} + +func (obj *flowMetricFlowTaggedMetricIter) setMsg(msg *flowMetric) FlowMetricFlowTaggedMetricIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flowTaggedMetric{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *flowMetricFlowTaggedMetricIter) Items() []FlowTaggedMetric { + return obj.flowTaggedMetricSlice +} + +func (obj *flowMetricFlowTaggedMetricIter) Add() FlowTaggedMetric { + newObj := &otg.FlowTaggedMetric{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flowTaggedMetric{obj: newObj} + newLibObj.setDefault() + obj.flowTaggedMetricSlice = append(obj.flowTaggedMetricSlice, newLibObj) + return newLibObj +} + +func (obj *flowMetricFlowTaggedMetricIter) Append(items ...FlowTaggedMetric) FlowMetricFlowTaggedMetricIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowTaggedMetricSlice = append(obj.flowTaggedMetricSlice, item) + } + return obj +} + +func (obj *flowMetricFlowTaggedMetricIter) Set(index int, newObj FlowTaggedMetric) FlowMetricFlowTaggedMetricIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowTaggedMetricSlice[index] = newObj + return obj +} +func (obj *flowMetricFlowTaggedMetricIter) Clear() FlowMetricFlowTaggedMetricIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.FlowTaggedMetric{} + obj.flowTaggedMetricSlice = []FlowTaggedMetric{} + } + return obj +} +func (obj *flowMetricFlowTaggedMetricIter) clearHolderSlice() FlowMetricFlowTaggedMetricIter { + if len(obj.flowTaggedMetricSlice) > 0 { + obj.flowTaggedMetricSlice = []FlowTaggedMetric{} + } + return obj +} +func (obj *flowMetricFlowTaggedMetricIter) appendHolderSlice(item FlowTaggedMetric) FlowMetricFlowTaggedMetricIter { + obj.flowTaggedMetricSlice = append(obj.flowTaggedMetricSlice, item) + return obj +} + +func (obj *flowMetric) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Timestamps != nil { + + obj.Timestamps().validateObj(vObj, set_default) + } + + if obj.obj.Latency != nil { + + obj.Latency().validateObj(vObj, set_default) + } + + if len(obj.obj.TaggedMetrics) != 0 { + + if set_default { + obj.TaggedMetrics().clearHolderSlice() + for _, item := range obj.obj.TaggedMetrics { + obj.TaggedMetrics().appendHolderSlice(&flowTaggedMetric{obj: item}) + } + } + for _, item := range obj.TaggedMetrics().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *flowMetric) setDefault() { + +} diff --git a/gosnappi/flow_metric_tag.go b/gosnappi/flow_metric_tag.go new file mode 100644 index 00000000..816d4e7e --- /dev/null +++ b/gosnappi/flow_metric_tag.go @@ -0,0 +1,356 @@ +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" +) + +// ***** FlowMetricTag ***** +type flowMetricTag struct { + validation + obj *otg.FlowMetricTag + marshaller marshalFlowMetricTag + unMarshaller unMarshalFlowMetricTag + valueHolder FlowMetricTagValue +} + +func NewFlowMetricTag() FlowMetricTag { + obj := flowMetricTag{obj: &otg.FlowMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *flowMetricTag) msg() *otg.FlowMetricTag { + return obj.obj +} + +func (obj *flowMetricTag) setMsg(msg *otg.FlowMetricTag) FlowMetricTag { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowMetricTag struct { + obj *flowMetricTag +} + +type marshalFlowMetricTag interface { + // ToProto marshals FlowMetricTag to protobuf object *otg.FlowMetricTag + ToProto() (*otg.FlowMetricTag, error) + // ToPbText marshals FlowMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals FlowMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalflowMetricTag struct { + obj *flowMetricTag +} + +type unMarshalFlowMetricTag interface { + // FromProto unmarshals FlowMetricTag from protobuf object *otg.FlowMetricTag + FromProto(msg *otg.FlowMetricTag) (FlowMetricTag, error) + // FromPbText unmarshals FlowMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowMetricTag from JSON text + FromJson(value string) error +} + +func (obj *flowMetricTag) Marshal() marshalFlowMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalflowMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *flowMetricTag) Unmarshal() unMarshalFlowMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowMetricTag) ToProto() (*otg.FlowMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowMetricTag) FromProto(msg *otg.FlowMetricTag) (FlowMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowMetricTag) 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 *unMarshalflowMetricTag) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowMetricTag) 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 *unMarshalflowMetricTag) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowMetricTag) 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 *unMarshalflowMetricTag) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowMetricTag) Clone() (FlowMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowMetricTag() + 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 +} + +func (obj *flowMetricTag) setNil() { + obj.valueHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowMetricTag is description is TBD +type FlowMetricTag interface { + Validation + // msg marshals FlowMetricTag to protobuf object *otg.FlowMetricTag + // and doesn't set defaults + msg() *otg.FlowMetricTag + // setMsg unmarshals FlowMetricTag from protobuf object *otg.FlowMetricTag + // and doesn't set defaults + setMsg(*otg.FlowMetricTag) FlowMetricTag + // provides marshal interface + Marshal() marshalFlowMetricTag + // provides unmarshal interface + Unmarshal() unMarshalFlowMetricTag + // validate validates FlowMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in FlowMetricTag. + Name() string + // SetName assigns string provided by user to FlowMetricTag + SetName(value string) FlowMetricTag + // HasName checks if Name has been set in FlowMetricTag + HasName() bool + // Value returns FlowMetricTagValue, set in FlowMetricTag. + // FlowMetricTagValue is a container for metric tag value + Value() FlowMetricTagValue + // SetValue assigns FlowMetricTagValue provided by user to FlowMetricTag. + // FlowMetricTagValue is a container for metric tag value + SetValue(value FlowMetricTagValue) FlowMetricTag + // HasValue checks if Value has been set in FlowMetricTag + HasValue() bool + setNil() +} + +// Name of packet field metric tag +// Name returns a string +func (obj *flowMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name of packet field metric tag +// Name returns a string +func (obj *flowMetricTag) HasName() bool { + return obj.obj.Name != nil +} + +// Name of packet field metric tag +// SetName sets the string value in the FlowMetricTag object +func (obj *flowMetricTag) SetName(value string) FlowMetricTag { + + obj.obj.Name = &value + return obj +} + +// description is TBD +// Value returns a FlowMetricTagValue +func (obj *flowMetricTag) Value() FlowMetricTagValue { + if obj.obj.Value == nil { + obj.obj.Value = NewFlowMetricTagValue().msg() + } + if obj.valueHolder == nil { + obj.valueHolder = &flowMetricTagValue{obj: obj.obj.Value} + } + return obj.valueHolder +} + +// description is TBD +// Value returns a FlowMetricTagValue +func (obj *flowMetricTag) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the FlowMetricTagValue value in the FlowMetricTag object +func (obj *flowMetricTag) SetValue(value FlowMetricTagValue) FlowMetricTag { + + obj.valueHolder = nil + obj.obj.Value = value.msg() + + return obj +} + +func (obj *flowMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + obj.Value().validateObj(vObj, set_default) + } + +} + +func (obj *flowMetricTag) setDefault() { + +} diff --git a/gosnappi/flow_metric_tag_filter.go b/gosnappi/flow_metric_tag_filter.go new file mode 100644 index 00000000..97c7ab95 --- /dev/null +++ b/gosnappi/flow_metric_tag_filter.go @@ -0,0 +1,337 @@ +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" +) + +// ***** FlowMetricTagFilter ***** +type flowMetricTagFilter struct { + validation + obj *otg.FlowMetricTagFilter + marshaller marshalFlowMetricTagFilter + unMarshaller unMarshalFlowMetricTagFilter +} + +func NewFlowMetricTagFilter() FlowMetricTagFilter { + obj := flowMetricTagFilter{obj: &otg.FlowMetricTagFilter{}} + obj.setDefault() + return &obj +} + +func (obj *flowMetricTagFilter) msg() *otg.FlowMetricTagFilter { + return obj.obj +} + +func (obj *flowMetricTagFilter) setMsg(msg *otg.FlowMetricTagFilter) FlowMetricTagFilter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowMetricTagFilter struct { + obj *flowMetricTagFilter +} + +type marshalFlowMetricTagFilter interface { + // ToProto marshals FlowMetricTagFilter to protobuf object *otg.FlowMetricTagFilter + ToProto() (*otg.FlowMetricTagFilter, error) + // ToPbText marshals FlowMetricTagFilter to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowMetricTagFilter to YAML text + ToYaml() (string, error) + // ToJson marshals FlowMetricTagFilter to JSON text + ToJson() (string, error) +} + +type unMarshalflowMetricTagFilter struct { + obj *flowMetricTagFilter +} + +type unMarshalFlowMetricTagFilter interface { + // FromProto unmarshals FlowMetricTagFilter from protobuf object *otg.FlowMetricTagFilter + FromProto(msg *otg.FlowMetricTagFilter) (FlowMetricTagFilter, error) + // FromPbText unmarshals FlowMetricTagFilter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowMetricTagFilter from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowMetricTagFilter from JSON text + FromJson(value string) error +} + +func (obj *flowMetricTagFilter) Marshal() marshalFlowMetricTagFilter { + if obj.marshaller == nil { + obj.marshaller = &marshalflowMetricTagFilter{obj: obj} + } + return obj.marshaller +} + +func (obj *flowMetricTagFilter) Unmarshal() unMarshalFlowMetricTagFilter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowMetricTagFilter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowMetricTagFilter) ToProto() (*otg.FlowMetricTagFilter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowMetricTagFilter) FromProto(msg *otg.FlowMetricTagFilter) (FlowMetricTagFilter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowMetricTagFilter) 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 *unMarshalflowMetricTagFilter) 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 *marshalflowMetricTagFilter) 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 *unMarshalflowMetricTagFilter) 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 *marshalflowMetricTagFilter) 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 *unMarshalflowMetricTagFilter) 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 *flowMetricTagFilter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowMetricTagFilter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowMetricTagFilter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowMetricTagFilter) Clone() (FlowMetricTagFilter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowMetricTagFilter() + 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 +} + +// FlowMetricTagFilter is a container for filtering ingress and/or egress metric tags. +// The Tx stats may not be applicable in both the request and response filter. +type FlowMetricTagFilter interface { + Validation + // msg marshals FlowMetricTagFilter to protobuf object *otg.FlowMetricTagFilter + // and doesn't set defaults + msg() *otg.FlowMetricTagFilter + // setMsg unmarshals FlowMetricTagFilter from protobuf object *otg.FlowMetricTagFilter + // and doesn't set defaults + setMsg(*otg.FlowMetricTagFilter) FlowMetricTagFilter + // provides marshal interface + Marshal() marshalFlowMetricTagFilter + // provides unmarshal interface + Unmarshal() unMarshalFlowMetricTagFilter + // validate validates FlowMetricTagFilter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowMetricTagFilter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in FlowMetricTagFilter. + Name() string + // SetName assigns string provided by user to FlowMetricTagFilter + SetName(value string) FlowMetricTagFilter + // HasName checks if Name has been set in FlowMetricTagFilter + HasName() bool + // Values returns []string, set in FlowMetricTagFilter. + Values() []string + // SetValues assigns []string provided by user to FlowMetricTagFilter + SetValues(value []string) FlowMetricTagFilter +} + +// A metric tag name that MUST exist in a flow packet or +// flow egress_packet configuration +// Name returns a string +func (obj *flowMetricTagFilter) Name() string { + + return *obj.obj.Name + +} + +// A metric tag name that MUST exist in a flow packet or +// flow egress_packet configuration +// Name returns a string +func (obj *flowMetricTagFilter) HasName() bool { + return obj.obj.Name != nil +} + +// A metric tag name that MUST exist in a flow packet or +// flow egress_packet configuration +// SetName sets the string value in the FlowMetricTagFilter object +func (obj *flowMetricTagFilter) SetName(value string) FlowMetricTagFilter { + + obj.obj.Name = &value + return obj +} + +// A list of filters that can be applied to the metric tag name. +// By default all values will be included in the flow metric results. +// Values returns a []string +func (obj *flowMetricTagFilter) Values() []string { + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + return obj.obj.Values +} + +// A list of filters that can be applied to the metric tag name. +// By default all values will be included in the flow metric results. +// SetValues sets the []string value in the FlowMetricTagFilter object +func (obj *flowMetricTagFilter) SetValues(value []string) FlowMetricTagFilter { + + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +func (obj *flowMetricTagFilter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *flowMetricTagFilter) setDefault() { + +} diff --git a/gosnappi/flow_metric_tag_value.go b/gosnappi/flow_metric_tag_value.go new file mode 100644 index 00000000..28ccd039 --- /dev/null +++ b/gosnappi/flow_metric_tag_value.go @@ -0,0 +1,421 @@ +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" +) + +// ***** FlowMetricTagValue ***** +type flowMetricTagValue struct { + validation + obj *otg.FlowMetricTagValue + marshaller marshalFlowMetricTagValue + unMarshaller unMarshalFlowMetricTagValue +} + +func NewFlowMetricTagValue() FlowMetricTagValue { + obj := flowMetricTagValue{obj: &otg.FlowMetricTagValue{}} + obj.setDefault() + return &obj +} + +func (obj *flowMetricTagValue) msg() *otg.FlowMetricTagValue { + return obj.obj +} + +func (obj *flowMetricTagValue) setMsg(msg *otg.FlowMetricTagValue) FlowMetricTagValue { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowMetricTagValue struct { + obj *flowMetricTagValue +} + +type marshalFlowMetricTagValue interface { + // ToProto marshals FlowMetricTagValue to protobuf object *otg.FlowMetricTagValue + ToProto() (*otg.FlowMetricTagValue, error) + // ToPbText marshals FlowMetricTagValue to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowMetricTagValue to YAML text + ToYaml() (string, error) + // ToJson marshals FlowMetricTagValue to JSON text + ToJson() (string, error) +} + +type unMarshalflowMetricTagValue struct { + obj *flowMetricTagValue +} + +type unMarshalFlowMetricTagValue interface { + // FromProto unmarshals FlowMetricTagValue from protobuf object *otg.FlowMetricTagValue + FromProto(msg *otg.FlowMetricTagValue) (FlowMetricTagValue, error) + // FromPbText unmarshals FlowMetricTagValue from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowMetricTagValue from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowMetricTagValue from JSON text + FromJson(value string) error +} + +func (obj *flowMetricTagValue) Marshal() marshalFlowMetricTagValue { + if obj.marshaller == nil { + obj.marshaller = &marshalflowMetricTagValue{obj: obj} + } + return obj.marshaller +} + +func (obj *flowMetricTagValue) Unmarshal() unMarshalFlowMetricTagValue { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowMetricTagValue{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowMetricTagValue) ToProto() (*otg.FlowMetricTagValue, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowMetricTagValue) FromProto(msg *otg.FlowMetricTagValue) (FlowMetricTagValue, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowMetricTagValue) 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 *unMarshalflowMetricTagValue) 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 *marshalflowMetricTagValue) 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 *unMarshalflowMetricTagValue) 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 *marshalflowMetricTagValue) 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 *unMarshalflowMetricTagValue) 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 *flowMetricTagValue) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowMetricTagValue) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowMetricTagValue) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowMetricTagValue) Clone() (FlowMetricTagValue, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowMetricTagValue() + 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 +} + +// FlowMetricTagValue is a container for metric tag value +type FlowMetricTagValue interface { + Validation + // msg marshals FlowMetricTagValue to protobuf object *otg.FlowMetricTagValue + // and doesn't set defaults + msg() *otg.FlowMetricTagValue + // setMsg unmarshals FlowMetricTagValue from protobuf object *otg.FlowMetricTagValue + // and doesn't set defaults + setMsg(*otg.FlowMetricTagValue) FlowMetricTagValue + // provides marshal interface + Marshal() marshalFlowMetricTagValue + // provides unmarshal interface + Unmarshal() unMarshalFlowMetricTagValue + // validate validates FlowMetricTagValue + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowMetricTagValue, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowMetricTagValueChoiceEnum, set in FlowMetricTagValue + Choice() FlowMetricTagValueChoiceEnum + // setChoice assigns FlowMetricTagValueChoiceEnum provided by user to FlowMetricTagValue + setChoice(value FlowMetricTagValueChoiceEnum) FlowMetricTagValue + // HasChoice checks if Choice has been set in FlowMetricTagValue + HasChoice() bool + // Hex returns string, set in FlowMetricTagValue. + Hex() string + // SetHex assigns string provided by user to FlowMetricTagValue + SetHex(value string) FlowMetricTagValue + // HasHex checks if Hex has been set in FlowMetricTagValue + HasHex() bool + // Str returns string, set in FlowMetricTagValue. + Str() string + // SetStr assigns string provided by user to FlowMetricTagValue + SetStr(value string) FlowMetricTagValue + // HasStr checks if Str has been set in FlowMetricTagValue + HasStr() bool +} + +type FlowMetricTagValueChoiceEnum string + +// Enum of Choice on FlowMetricTagValue +var FlowMetricTagValueChoice = struct { + HEX FlowMetricTagValueChoiceEnum + STR FlowMetricTagValueChoiceEnum +}{ + HEX: FlowMetricTagValueChoiceEnum("hex"), + STR: FlowMetricTagValueChoiceEnum("str"), +} + +func (obj *flowMetricTagValue) Choice() FlowMetricTagValueChoiceEnum { + return FlowMetricTagValueChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// Available formats for metric tag value +// Choice returns a string +func (obj *flowMetricTagValue) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowMetricTagValue) setChoice(value FlowMetricTagValueChoiceEnum) FlowMetricTagValue { + intValue, ok := otg.FlowMetricTagValue_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowMetricTagValueChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowMetricTagValue_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Str = nil + obj.obj.Hex = nil + return obj +} + +// Value represented in hexadecimal format +// Hex returns a string +func (obj *flowMetricTagValue) Hex() string { + + if obj.obj.Hex == nil { + obj.setChoice(FlowMetricTagValueChoice.HEX) + } + + return *obj.obj.Hex + +} + +// Value represented in hexadecimal format +// Hex returns a string +func (obj *flowMetricTagValue) HasHex() bool { + return obj.obj.Hex != nil +} + +// Value represented in hexadecimal format +// SetHex sets the string value in the FlowMetricTagValue object +func (obj *flowMetricTagValue) SetHex(value string) FlowMetricTagValue { + obj.setChoice(FlowMetricTagValueChoice.HEX) + obj.obj.Hex = &value + return obj +} + +// Value represented in string format +// Str returns a string +func (obj *flowMetricTagValue) Str() string { + + if obj.obj.Str == nil { + obj.setChoice(FlowMetricTagValueChoice.STR) + } + + return *obj.obj.Str + +} + +// Value represented in string format +// Str returns a string +func (obj *flowMetricTagValue) HasStr() bool { + return obj.obj.Str != nil +} + +// Value represented in string format +// SetStr sets the string value in the FlowMetricTagValue object +func (obj *flowMetricTagValue) SetStr(value string) FlowMetricTagValue { + obj.setChoice(FlowMetricTagValueChoice.STR) + obj.obj.Str = &value + return obj +} + +func (obj *flowMetricTagValue) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Hex != nil { + + err := obj.validateHex(obj.Hex()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on FlowMetricTagValue.Hex")) + } + + } + +} + +func (obj *flowMetricTagValue) setDefault() { + var choices_set int = 0 + var choice FlowMetricTagValueChoiceEnum + + if obj.obj.Hex != nil { + choices_set += 1 + choice = FlowMetricTagValueChoice.HEX + } + + if obj.obj.Str != nil { + choices_set += 1 + choice = FlowMetricTagValueChoice.STR + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowMetricTagValueChoice.HEX) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowMetricTagValue") + } + } else { + intVal := otg.FlowMetricTagValue_Choice_Enum_value[string(choice)] + enumValue := otg.FlowMetricTagValue_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_metrics.go b/gosnappi/flow_metrics.go new file mode 100644 index 00000000..c546f103 --- /dev/null +++ b/gosnappi/flow_metrics.go @@ -0,0 +1,519 @@ +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" +) + +// ***** FlowMetrics ***** +type flowMetrics struct { + validation + obj *otg.FlowMetrics + marshaller marshalFlowMetrics + unMarshaller unMarshalFlowMetrics + rxTxRatioHolder FlowRxTxRatio + latencyHolder FlowLatencyMetrics + predefinedMetricTagsHolder FlowPredefinedTags +} + +func NewFlowMetrics() FlowMetrics { + obj := flowMetrics{obj: &otg.FlowMetrics{}} + obj.setDefault() + return &obj +} + +func (obj *flowMetrics) msg() *otg.FlowMetrics { + return obj.obj +} + +func (obj *flowMetrics) setMsg(msg *otg.FlowMetrics) FlowMetrics { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowMetrics struct { + obj *flowMetrics +} + +type marshalFlowMetrics interface { + // ToProto marshals FlowMetrics to protobuf object *otg.FlowMetrics + ToProto() (*otg.FlowMetrics, error) + // ToPbText marshals FlowMetrics to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowMetrics to YAML text + ToYaml() (string, error) + // ToJson marshals FlowMetrics to JSON text + ToJson() (string, error) +} + +type unMarshalflowMetrics struct { + obj *flowMetrics +} + +type unMarshalFlowMetrics interface { + // FromProto unmarshals FlowMetrics from protobuf object *otg.FlowMetrics + FromProto(msg *otg.FlowMetrics) (FlowMetrics, error) + // FromPbText unmarshals FlowMetrics from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowMetrics from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowMetrics from JSON text + FromJson(value string) error +} + +func (obj *flowMetrics) Marshal() marshalFlowMetrics { + if obj.marshaller == nil { + obj.marshaller = &marshalflowMetrics{obj: obj} + } + return obj.marshaller +} + +func (obj *flowMetrics) Unmarshal() unMarshalFlowMetrics { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowMetrics{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowMetrics) ToProto() (*otg.FlowMetrics, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowMetrics) FromProto(msg *otg.FlowMetrics) (FlowMetrics, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowMetrics) 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 *unMarshalflowMetrics) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowMetrics) 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 *unMarshalflowMetrics) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowMetrics) 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 *unMarshalflowMetrics) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowMetrics) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowMetrics) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowMetrics) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowMetrics) Clone() (FlowMetrics, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowMetrics() + 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 +} + +func (obj *flowMetrics) setNil() { + obj.rxTxRatioHolder = nil + obj.latencyHolder = nil + obj.predefinedMetricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowMetrics is the optional container for configuring flow metrics. +type FlowMetrics interface { + Validation + // msg marshals FlowMetrics to protobuf object *otg.FlowMetrics + // and doesn't set defaults + msg() *otg.FlowMetrics + // setMsg unmarshals FlowMetrics from protobuf object *otg.FlowMetrics + // and doesn't set defaults + setMsg(*otg.FlowMetrics) FlowMetrics + // provides marshal interface + Marshal() marshalFlowMetrics + // provides unmarshal interface + Unmarshal() unMarshalFlowMetrics + // validate validates FlowMetrics + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowMetrics, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Enable returns bool, set in FlowMetrics. + Enable() bool + // SetEnable assigns bool provided by user to FlowMetrics + SetEnable(value bool) FlowMetrics + // HasEnable checks if Enable has been set in FlowMetrics + HasEnable() bool + // Loss returns bool, set in FlowMetrics. + Loss() bool + // SetLoss assigns bool provided by user to FlowMetrics + SetLoss(value bool) FlowMetrics + // HasLoss checks if Loss has been set in FlowMetrics + HasLoss() bool + // RxTxRatio returns FlowRxTxRatio, set in FlowMetrics. + // FlowRxTxRatio is rx Tx ratio is the ratio of expected number of Rx packets across all Rx ports to the Tx packets + // for the configured flow. It is a factor by which the Tx packet count is multiplied to calculate + // the sum of expected Rx packet count, across all Rx ports. This will be used to calculate loss + // percentage of flow at aggregate level. + RxTxRatio() FlowRxTxRatio + // SetRxTxRatio assigns FlowRxTxRatio provided by user to FlowMetrics. + // FlowRxTxRatio is rx Tx ratio is the ratio of expected number of Rx packets across all Rx ports to the Tx packets + // for the configured flow. It is a factor by which the Tx packet count is multiplied to calculate + // the sum of expected Rx packet count, across all Rx ports. This will be used to calculate loss + // percentage of flow at aggregate level. + SetRxTxRatio(value FlowRxTxRatio) FlowMetrics + // HasRxTxRatio checks if RxTxRatio has been set in FlowMetrics + HasRxTxRatio() bool + // Timestamps returns bool, set in FlowMetrics. + Timestamps() bool + // SetTimestamps assigns bool provided by user to FlowMetrics + SetTimestamps(value bool) FlowMetrics + // HasTimestamps checks if Timestamps has been set in FlowMetrics + HasTimestamps() bool + // Latency returns FlowLatencyMetrics, set in FlowMetrics. + // FlowLatencyMetrics is the optional container for per flow latency metric configuration. + Latency() FlowLatencyMetrics + // SetLatency assigns FlowLatencyMetrics provided by user to FlowMetrics. + // FlowLatencyMetrics is the optional container for per flow latency metric configuration. + SetLatency(value FlowLatencyMetrics) FlowMetrics + // HasLatency checks if Latency has been set in FlowMetrics + HasLatency() bool + // PredefinedMetricTags returns FlowPredefinedTags, set in FlowMetrics. + // FlowPredefinedTags is list of predefined flow tracking options, outside packet fields, that can be enabled. + PredefinedMetricTags() FlowPredefinedTags + // SetPredefinedMetricTags assigns FlowPredefinedTags provided by user to FlowMetrics. + // FlowPredefinedTags is list of predefined flow tracking options, outside packet fields, that can be enabled. + SetPredefinedMetricTags(value FlowPredefinedTags) FlowMetrics + // HasPredefinedMetricTags checks if PredefinedMetricTags has been set in FlowMetrics + HasPredefinedMetricTags() bool + setNil() +} + +// Enables flow metrics. +// Enabling this option may affect the resultant packet payload due to +// additional instrumentation data. +// Enable returns a bool +func (obj *flowMetrics) Enable() bool { + + return *obj.obj.Enable + +} + +// Enables flow metrics. +// Enabling this option may affect the resultant packet payload due to +// additional instrumentation data. +// Enable returns a bool +func (obj *flowMetrics) HasEnable() bool { + return obj.obj.Enable != nil +} + +// Enables flow metrics. +// Enabling this option may affect the resultant packet payload due to +// additional instrumentation data. +// SetEnable sets the bool value in the FlowMetrics object +func (obj *flowMetrics) SetEnable(value bool) FlowMetrics { + + obj.obj.Enable = &value + return obj +} + +// Enables additional flow metric loss calculation. +// Loss returns a bool +func (obj *flowMetrics) Loss() bool { + + return *obj.obj.Loss + +} + +// Enables additional flow metric loss calculation. +// Loss returns a bool +func (obj *flowMetrics) HasLoss() bool { + return obj.obj.Loss != nil +} + +// Enables additional flow metric loss calculation. +// SetLoss sets the bool value in the FlowMetrics object +func (obj *flowMetrics) SetLoss(value bool) FlowMetrics { + + obj.obj.Loss = &value + return obj +} + +// Rx Tx ratio. +// RxTxRatio returns a FlowRxTxRatio +func (obj *flowMetrics) RxTxRatio() FlowRxTxRatio { + if obj.obj.RxTxRatio == nil { + obj.obj.RxTxRatio = NewFlowRxTxRatio().msg() + } + if obj.rxTxRatioHolder == nil { + obj.rxTxRatioHolder = &flowRxTxRatio{obj: obj.obj.RxTxRatio} + } + return obj.rxTxRatioHolder +} + +// Rx Tx ratio. +// RxTxRatio returns a FlowRxTxRatio +func (obj *flowMetrics) HasRxTxRatio() bool { + return obj.obj.RxTxRatio != nil +} + +// Rx Tx ratio. +// SetRxTxRatio sets the FlowRxTxRatio value in the FlowMetrics object +func (obj *flowMetrics) SetRxTxRatio(value FlowRxTxRatio) FlowMetrics { + + obj.rxTxRatioHolder = nil + obj.obj.RxTxRatio = value.msg() + + return obj +} + +// Enables additional flow metric first and last timestamps. +// Timestamps returns a bool +func (obj *flowMetrics) Timestamps() bool { + + return *obj.obj.Timestamps + +} + +// Enables additional flow metric first and last timestamps. +// Timestamps returns a bool +func (obj *flowMetrics) HasTimestamps() bool { + return obj.obj.Timestamps != nil +} + +// Enables additional flow metric first and last timestamps. +// SetTimestamps sets the bool value in the FlowMetrics object +func (obj *flowMetrics) SetTimestamps(value bool) FlowMetrics { + + obj.obj.Timestamps = &value + return obj +} + +// Latency metrics. +// Latency returns a FlowLatencyMetrics +func (obj *flowMetrics) Latency() FlowLatencyMetrics { + if obj.obj.Latency == nil { + obj.obj.Latency = NewFlowLatencyMetrics().msg() + } + if obj.latencyHolder == nil { + obj.latencyHolder = &flowLatencyMetrics{obj: obj.obj.Latency} + } + return obj.latencyHolder +} + +// Latency metrics. +// Latency returns a FlowLatencyMetrics +func (obj *flowMetrics) HasLatency() bool { + return obj.obj.Latency != nil +} + +// Latency metrics. +// SetLatency sets the FlowLatencyMetrics value in the FlowMetrics object +func (obj *flowMetrics) SetLatency(value FlowLatencyMetrics) FlowMetrics { + + obj.latencyHolder = nil + obj.obj.Latency = value.msg() + + return obj +} + +// Predefined metric tags +// PredefinedMetricTags returns a FlowPredefinedTags +func (obj *flowMetrics) PredefinedMetricTags() FlowPredefinedTags { + if obj.obj.PredefinedMetricTags == nil { + obj.obj.PredefinedMetricTags = NewFlowPredefinedTags().msg() + } + if obj.predefinedMetricTagsHolder == nil { + obj.predefinedMetricTagsHolder = &flowPredefinedTags{obj: obj.obj.PredefinedMetricTags} + } + return obj.predefinedMetricTagsHolder +} + +// Predefined metric tags +// PredefinedMetricTags returns a FlowPredefinedTags +func (obj *flowMetrics) HasPredefinedMetricTags() bool { + return obj.obj.PredefinedMetricTags != nil +} + +// Predefined metric tags +// SetPredefinedMetricTags sets the FlowPredefinedTags value in the FlowMetrics object +func (obj *flowMetrics) SetPredefinedMetricTags(value FlowPredefinedTags) FlowMetrics { + + obj.predefinedMetricTagsHolder = nil + obj.obj.PredefinedMetricTags = value.msg() + + return obj +} + +func (obj *flowMetrics) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RxTxRatio != nil { + + obj.RxTxRatio().validateObj(vObj, set_default) + } + + if obj.obj.Latency != nil { + + obj.Latency().validateObj(vObj, set_default) + } + + if obj.obj.PredefinedMetricTags != nil { + + obj.PredefinedMetricTags().validateObj(vObj, set_default) + } + +} + +func (obj *flowMetrics) setDefault() { + if obj.obj.Enable == nil { + obj.SetEnable(false) + } + if obj.obj.Loss == nil { + obj.SetLoss(false) + } + if obj.obj.Timestamps == nil { + obj.SetTimestamps(false) + } + +} diff --git a/gosnappi/flow_metrics_request.go b/gosnappi/flow_metrics_request.go new file mode 100644 index 00000000..e747e9de --- /dev/null +++ b/gosnappi/flow_metrics_request.go @@ -0,0 +1,415 @@ +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" +) + +// ***** FlowMetricsRequest ***** +type flowMetricsRequest struct { + validation + obj *otg.FlowMetricsRequest + marshaller marshalFlowMetricsRequest + unMarshaller unMarshalFlowMetricsRequest + taggedMetricsHolder FlowTaggedMetricsFilter +} + +func NewFlowMetricsRequest() FlowMetricsRequest { + obj := flowMetricsRequest{obj: &otg.FlowMetricsRequest{}} + obj.setDefault() + return &obj +} + +func (obj *flowMetricsRequest) msg() *otg.FlowMetricsRequest { + return obj.obj +} + +func (obj *flowMetricsRequest) setMsg(msg *otg.FlowMetricsRequest) FlowMetricsRequest { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowMetricsRequest struct { + obj *flowMetricsRequest +} + +type marshalFlowMetricsRequest interface { + // ToProto marshals FlowMetricsRequest to protobuf object *otg.FlowMetricsRequest + ToProto() (*otg.FlowMetricsRequest, error) + // ToPbText marshals FlowMetricsRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowMetricsRequest to YAML text + ToYaml() (string, error) + // ToJson marshals FlowMetricsRequest to JSON text + ToJson() (string, error) +} + +type unMarshalflowMetricsRequest struct { + obj *flowMetricsRequest +} + +type unMarshalFlowMetricsRequest interface { + // FromProto unmarshals FlowMetricsRequest from protobuf object *otg.FlowMetricsRequest + FromProto(msg *otg.FlowMetricsRequest) (FlowMetricsRequest, error) + // FromPbText unmarshals FlowMetricsRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowMetricsRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowMetricsRequest from JSON text + FromJson(value string) error +} + +func (obj *flowMetricsRequest) Marshal() marshalFlowMetricsRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalflowMetricsRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *flowMetricsRequest) Unmarshal() unMarshalFlowMetricsRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowMetricsRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowMetricsRequest) ToProto() (*otg.FlowMetricsRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowMetricsRequest) FromProto(msg *otg.FlowMetricsRequest) (FlowMetricsRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowMetricsRequest) 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 *unMarshalflowMetricsRequest) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowMetricsRequest) 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 *unMarshalflowMetricsRequest) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowMetricsRequest) 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 *unMarshalflowMetricsRequest) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowMetricsRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowMetricsRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowMetricsRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowMetricsRequest) Clone() (FlowMetricsRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowMetricsRequest() + 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 +} + +func (obj *flowMetricsRequest) setNil() { + obj.taggedMetricsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowMetricsRequest is the container for a flow metric request. +type FlowMetricsRequest interface { + Validation + // msg marshals FlowMetricsRequest to protobuf object *otg.FlowMetricsRequest + // and doesn't set defaults + msg() *otg.FlowMetricsRequest + // setMsg unmarshals FlowMetricsRequest from protobuf object *otg.FlowMetricsRequest + // and doesn't set defaults + setMsg(*otg.FlowMetricsRequest) FlowMetricsRequest + // provides marshal interface + Marshal() marshalFlowMetricsRequest + // provides unmarshal interface + Unmarshal() unMarshalFlowMetricsRequest + // validate validates FlowMetricsRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowMetricsRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // FlowNames returns []string, set in FlowMetricsRequest. + FlowNames() []string + // SetFlowNames assigns []string provided by user to FlowMetricsRequest + SetFlowNames(value []string) FlowMetricsRequest + // MetricNames returns []FlowMetricsRequestMetricNamesEnum, set in FlowMetricsRequest + MetricNames() []FlowMetricsRequestMetricNamesEnum + // SetMetricNames assigns []FlowMetricsRequestMetricNamesEnum provided by user to FlowMetricsRequest + SetMetricNames(value []FlowMetricsRequestMetricNamesEnum) FlowMetricsRequest + // TaggedMetrics returns FlowTaggedMetricsFilter, set in FlowMetricsRequest. + // FlowTaggedMetricsFilter is filter for tagged metrics + TaggedMetrics() FlowTaggedMetricsFilter + // SetTaggedMetrics assigns FlowTaggedMetricsFilter provided by user to FlowMetricsRequest. + // FlowTaggedMetricsFilter is filter for tagged metrics + SetTaggedMetrics(value FlowTaggedMetricsFilter) FlowMetricsRequest + // HasTaggedMetrics checks if TaggedMetrics has been set in FlowMetricsRequest + HasTaggedMetrics() bool + setNil() +} + +// Flow metrics will be retrieved for these flow names. +// If no flow names are specified then all flows will be returned. +// +// x-constraint: +// - /components/schemas/Flow/properties/name +// +// x-constraint: +// - /components/schemas/Flow/properties/name +// +// FlowNames returns a []string +func (obj *flowMetricsRequest) FlowNames() []string { + if obj.obj.FlowNames == nil { + obj.obj.FlowNames = make([]string, 0) + } + return obj.obj.FlowNames +} + +// Flow metrics will be retrieved for these flow names. +// If no flow names are specified then all flows will be returned. +// +// x-constraint: +// - /components/schemas/Flow/properties/name +// +// x-constraint: +// - /components/schemas/Flow/properties/name +// +// SetFlowNames sets the []string value in the FlowMetricsRequest object +func (obj *flowMetricsRequest) SetFlowNames(value []string) FlowMetricsRequest { + + if obj.obj.FlowNames == nil { + obj.obj.FlowNames = make([]string, 0) + } + obj.obj.FlowNames = value + + return obj +} + +type FlowMetricsRequestMetricNamesEnum string + +// Enum of MetricNames on FlowMetricsRequest +var FlowMetricsRequestMetricNames = struct { + TRANSMIT FlowMetricsRequestMetricNamesEnum + FRAMES_TX FlowMetricsRequestMetricNamesEnum + FRAMES_RX FlowMetricsRequestMetricNamesEnum + BYTES_TX FlowMetricsRequestMetricNamesEnum + BYTES_RX FlowMetricsRequestMetricNamesEnum + FRAMES_TX_RATE FlowMetricsRequestMetricNamesEnum + FRAMES_RX_RATE FlowMetricsRequestMetricNamesEnum +}{ + TRANSMIT: FlowMetricsRequestMetricNamesEnum("transmit"), + FRAMES_TX: FlowMetricsRequestMetricNamesEnum("frames_tx"), + FRAMES_RX: FlowMetricsRequestMetricNamesEnum("frames_rx"), + BYTES_TX: FlowMetricsRequestMetricNamesEnum("bytes_tx"), + BYTES_RX: FlowMetricsRequestMetricNamesEnum("bytes_rx"), + FRAMES_TX_RATE: FlowMetricsRequestMetricNamesEnum("frames_tx_rate"), + FRAMES_RX_RATE: FlowMetricsRequestMetricNamesEnum("frames_rx_rate"), +} + +func (obj *flowMetricsRequest) MetricNames() []FlowMetricsRequestMetricNamesEnum { + items := []FlowMetricsRequestMetricNamesEnum{} + for _, item := range obj.obj.MetricNames { + items = append(items, FlowMetricsRequestMetricNamesEnum(item.String())) + } + return items +} + +// The list of metric names that the returned result set will contain. If the list is empty then all metrics will be returned. +// SetMetricNames sets the []string value in the FlowMetricsRequest object +func (obj *flowMetricsRequest) SetMetricNames(value []FlowMetricsRequestMetricNamesEnum) FlowMetricsRequest { + + items := []otg.FlowMetricsRequest_MetricNames_Enum{} + for _, item := range value { + intValue := otg.FlowMetricsRequest_MetricNames_Enum_value[string(item)] + items = append(items, otg.FlowMetricsRequest_MetricNames_Enum(intValue)) + } + obj.obj.MetricNames = items + return obj +} + +// description is TBD +// TaggedMetrics returns a FlowTaggedMetricsFilter +func (obj *flowMetricsRequest) TaggedMetrics() FlowTaggedMetricsFilter { + if obj.obj.TaggedMetrics == nil { + obj.obj.TaggedMetrics = NewFlowTaggedMetricsFilter().msg() + } + if obj.taggedMetricsHolder == nil { + obj.taggedMetricsHolder = &flowTaggedMetricsFilter{obj: obj.obj.TaggedMetrics} + } + return obj.taggedMetricsHolder +} + +// description is TBD +// TaggedMetrics returns a FlowTaggedMetricsFilter +func (obj *flowMetricsRequest) HasTaggedMetrics() bool { + return obj.obj.TaggedMetrics != nil +} + +// description is TBD +// SetTaggedMetrics sets the FlowTaggedMetricsFilter value in the FlowMetricsRequest object +func (obj *flowMetricsRequest) SetTaggedMetrics(value FlowTaggedMetricsFilter) FlowMetricsRequest { + + obj.taggedMetricsHolder = nil + obj.obj.TaggedMetrics = value.msg() + + return obj +} + +func (obj *flowMetricsRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.TaggedMetrics != nil { + + obj.TaggedMetrics().validateObj(vObj, set_default) + } + +} + +func (obj *flowMetricsRequest) setDefault() { + +} diff --git a/gosnappi/flow_mpls.go b/gosnappi/flow_mpls.go new file mode 100644 index 00000000..7650c315 --- /dev/null +++ b/gosnappi/flow_mpls.go @@ -0,0 +1,457 @@ +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" +) + +// ***** FlowMpls ***** +type flowMpls struct { + validation + obj *otg.FlowMpls + marshaller marshalFlowMpls + unMarshaller unMarshalFlowMpls + labelHolder PatternFlowMplsLabel + trafficClassHolder PatternFlowMplsTrafficClass + bottomOfStackHolder PatternFlowMplsBottomOfStack + timeToLiveHolder PatternFlowMplsTimeToLive +} + +func NewFlowMpls() FlowMpls { + obj := flowMpls{obj: &otg.FlowMpls{}} + obj.setDefault() + return &obj +} + +func (obj *flowMpls) msg() *otg.FlowMpls { + return obj.obj +} + +func (obj *flowMpls) setMsg(msg *otg.FlowMpls) FlowMpls { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowMpls struct { + obj *flowMpls +} + +type marshalFlowMpls interface { + // ToProto marshals FlowMpls to protobuf object *otg.FlowMpls + ToProto() (*otg.FlowMpls, error) + // ToPbText marshals FlowMpls to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowMpls to YAML text + ToYaml() (string, error) + // ToJson marshals FlowMpls to JSON text + ToJson() (string, error) +} + +type unMarshalflowMpls struct { + obj *flowMpls +} + +type unMarshalFlowMpls interface { + // FromProto unmarshals FlowMpls from protobuf object *otg.FlowMpls + FromProto(msg *otg.FlowMpls) (FlowMpls, error) + // FromPbText unmarshals FlowMpls from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowMpls from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowMpls from JSON text + FromJson(value string) error +} + +func (obj *flowMpls) Marshal() marshalFlowMpls { + if obj.marshaller == nil { + obj.marshaller = &marshalflowMpls{obj: obj} + } + return obj.marshaller +} + +func (obj *flowMpls) Unmarshal() unMarshalFlowMpls { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowMpls{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowMpls) ToProto() (*otg.FlowMpls, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowMpls) FromProto(msg *otg.FlowMpls) (FlowMpls, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowMpls) 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 *unMarshalflowMpls) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowMpls) 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 *unMarshalflowMpls) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowMpls) 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 *unMarshalflowMpls) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowMpls) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowMpls) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowMpls) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowMpls) Clone() (FlowMpls, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowMpls() + 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 +} + +func (obj *flowMpls) setNil() { + obj.labelHolder = nil + obj.trafficClassHolder = nil + obj.bottomOfStackHolder = nil + obj.timeToLiveHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowMpls is mPLS packet header; When configuring multiple such headers, the count shall not exceed 20. +type FlowMpls interface { + Validation + // msg marshals FlowMpls to protobuf object *otg.FlowMpls + // and doesn't set defaults + msg() *otg.FlowMpls + // setMsg unmarshals FlowMpls from protobuf object *otg.FlowMpls + // and doesn't set defaults + setMsg(*otg.FlowMpls) FlowMpls + // provides marshal interface + Marshal() marshalFlowMpls + // provides unmarshal interface + Unmarshal() unMarshalFlowMpls + // validate validates FlowMpls + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowMpls, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Label returns PatternFlowMplsLabel, set in FlowMpls. + // PatternFlowMplsLabel is label of routers + Label() PatternFlowMplsLabel + // SetLabel assigns PatternFlowMplsLabel provided by user to FlowMpls. + // PatternFlowMplsLabel is label of routers + SetLabel(value PatternFlowMplsLabel) FlowMpls + // HasLabel checks if Label has been set in FlowMpls + HasLabel() bool + // TrafficClass returns PatternFlowMplsTrafficClass, set in FlowMpls. + // PatternFlowMplsTrafficClass is traffic class + TrafficClass() PatternFlowMplsTrafficClass + // SetTrafficClass assigns PatternFlowMplsTrafficClass provided by user to FlowMpls. + // PatternFlowMplsTrafficClass is traffic class + SetTrafficClass(value PatternFlowMplsTrafficClass) FlowMpls + // HasTrafficClass checks if TrafficClass has been set in FlowMpls + HasTrafficClass() bool + // BottomOfStack returns PatternFlowMplsBottomOfStack, set in FlowMpls. + // PatternFlowMplsBottomOfStack is bottom of stack + BottomOfStack() PatternFlowMplsBottomOfStack + // SetBottomOfStack assigns PatternFlowMplsBottomOfStack provided by user to FlowMpls. + // PatternFlowMplsBottomOfStack is bottom of stack + SetBottomOfStack(value PatternFlowMplsBottomOfStack) FlowMpls + // HasBottomOfStack checks if BottomOfStack has been set in FlowMpls + HasBottomOfStack() bool + // TimeToLive returns PatternFlowMplsTimeToLive, set in FlowMpls. + // PatternFlowMplsTimeToLive is time to live + TimeToLive() PatternFlowMplsTimeToLive + // SetTimeToLive assigns PatternFlowMplsTimeToLive provided by user to FlowMpls. + // PatternFlowMplsTimeToLive is time to live + SetTimeToLive(value PatternFlowMplsTimeToLive) FlowMpls + // HasTimeToLive checks if TimeToLive has been set in FlowMpls + HasTimeToLive() bool + setNil() +} + +// description is TBD +// Label returns a PatternFlowMplsLabel +func (obj *flowMpls) Label() PatternFlowMplsLabel { + if obj.obj.Label == nil { + obj.obj.Label = NewPatternFlowMplsLabel().msg() + } + if obj.labelHolder == nil { + obj.labelHolder = &patternFlowMplsLabel{obj: obj.obj.Label} + } + return obj.labelHolder +} + +// description is TBD +// Label returns a PatternFlowMplsLabel +func (obj *flowMpls) HasLabel() bool { + return obj.obj.Label != nil +} + +// description is TBD +// SetLabel sets the PatternFlowMplsLabel value in the FlowMpls object +func (obj *flowMpls) SetLabel(value PatternFlowMplsLabel) FlowMpls { + + obj.labelHolder = nil + obj.obj.Label = value.msg() + + return obj +} + +// description is TBD +// TrafficClass returns a PatternFlowMplsTrafficClass +func (obj *flowMpls) TrafficClass() PatternFlowMplsTrafficClass { + if obj.obj.TrafficClass == nil { + obj.obj.TrafficClass = NewPatternFlowMplsTrafficClass().msg() + } + if obj.trafficClassHolder == nil { + obj.trafficClassHolder = &patternFlowMplsTrafficClass{obj: obj.obj.TrafficClass} + } + return obj.trafficClassHolder +} + +// description is TBD +// TrafficClass returns a PatternFlowMplsTrafficClass +func (obj *flowMpls) HasTrafficClass() bool { + return obj.obj.TrafficClass != nil +} + +// description is TBD +// SetTrafficClass sets the PatternFlowMplsTrafficClass value in the FlowMpls object +func (obj *flowMpls) SetTrafficClass(value PatternFlowMplsTrafficClass) FlowMpls { + + obj.trafficClassHolder = nil + obj.obj.TrafficClass = value.msg() + + return obj +} + +// description is TBD +// BottomOfStack returns a PatternFlowMplsBottomOfStack +func (obj *flowMpls) BottomOfStack() PatternFlowMplsBottomOfStack { + if obj.obj.BottomOfStack == nil { + obj.obj.BottomOfStack = NewPatternFlowMplsBottomOfStack().msg() + } + if obj.bottomOfStackHolder == nil { + obj.bottomOfStackHolder = &patternFlowMplsBottomOfStack{obj: obj.obj.BottomOfStack} + } + return obj.bottomOfStackHolder +} + +// description is TBD +// BottomOfStack returns a PatternFlowMplsBottomOfStack +func (obj *flowMpls) HasBottomOfStack() bool { + return obj.obj.BottomOfStack != nil +} + +// description is TBD +// SetBottomOfStack sets the PatternFlowMplsBottomOfStack value in the FlowMpls object +func (obj *flowMpls) SetBottomOfStack(value PatternFlowMplsBottomOfStack) FlowMpls { + + obj.bottomOfStackHolder = nil + obj.obj.BottomOfStack = value.msg() + + return obj +} + +// description is TBD +// TimeToLive returns a PatternFlowMplsTimeToLive +func (obj *flowMpls) TimeToLive() PatternFlowMplsTimeToLive { + if obj.obj.TimeToLive == nil { + obj.obj.TimeToLive = NewPatternFlowMplsTimeToLive().msg() + } + if obj.timeToLiveHolder == nil { + obj.timeToLiveHolder = &patternFlowMplsTimeToLive{obj: obj.obj.TimeToLive} + } + return obj.timeToLiveHolder +} + +// description is TBD +// TimeToLive returns a PatternFlowMplsTimeToLive +func (obj *flowMpls) HasTimeToLive() bool { + return obj.obj.TimeToLive != nil +} + +// description is TBD +// SetTimeToLive sets the PatternFlowMplsTimeToLive value in the FlowMpls object +func (obj *flowMpls) SetTimeToLive(value PatternFlowMplsTimeToLive) FlowMpls { + + obj.timeToLiveHolder = nil + obj.obj.TimeToLive = value.msg() + + return obj +} + +func (obj *flowMpls) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Label != nil { + + obj.Label().validateObj(vObj, set_default) + } + + if obj.obj.TrafficClass != nil { + + obj.TrafficClass().validateObj(vObj, set_default) + } + + if obj.obj.BottomOfStack != nil { + + obj.BottomOfStack().validateObj(vObj, set_default) + } + + if obj.obj.TimeToLive != nil { + + obj.TimeToLive().validateObj(vObj, set_default) + } + +} + +func (obj *flowMpls) setDefault() { + +} diff --git a/gosnappi/flow_pfc_pause.go b/gosnappi/flow_pfc_pause.go new file mode 100644 index 00000000..6cabca73 --- /dev/null +++ b/gosnappi/flow_pfc_pause.go @@ -0,0 +1,844 @@ +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" +) + +// ***** FlowPfcPause ***** +type flowPfcPause struct { + validation + obj *otg.FlowPfcPause + marshaller marshalFlowPfcPause + unMarshaller unMarshalFlowPfcPause + dstHolder PatternFlowPfcPauseDst + srcHolder PatternFlowPfcPauseSrc + etherTypeHolder PatternFlowPfcPauseEtherType + controlOpCodeHolder PatternFlowPfcPauseControlOpCode + classEnableVectorHolder PatternFlowPfcPauseClassEnableVector + pauseClass_0Holder PatternFlowPfcPausePauseClass0 + pauseClass_1Holder PatternFlowPfcPausePauseClass1 + pauseClass_2Holder PatternFlowPfcPausePauseClass2 + pauseClass_3Holder PatternFlowPfcPausePauseClass3 + pauseClass_4Holder PatternFlowPfcPausePauseClass4 + pauseClass_5Holder PatternFlowPfcPausePauseClass5 + pauseClass_6Holder PatternFlowPfcPausePauseClass6 + pauseClass_7Holder PatternFlowPfcPausePauseClass7 +} + +func NewFlowPfcPause() FlowPfcPause { + obj := flowPfcPause{obj: &otg.FlowPfcPause{}} + obj.setDefault() + return &obj +} + +func (obj *flowPfcPause) msg() *otg.FlowPfcPause { + return obj.obj +} + +func (obj *flowPfcPause) setMsg(msg *otg.FlowPfcPause) FlowPfcPause { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowPfcPause struct { + obj *flowPfcPause +} + +type marshalFlowPfcPause interface { + // ToProto marshals FlowPfcPause to protobuf object *otg.FlowPfcPause + ToProto() (*otg.FlowPfcPause, error) + // ToPbText marshals FlowPfcPause to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowPfcPause to YAML text + ToYaml() (string, error) + // ToJson marshals FlowPfcPause to JSON text + ToJson() (string, error) +} + +type unMarshalflowPfcPause struct { + obj *flowPfcPause +} + +type unMarshalFlowPfcPause interface { + // FromProto unmarshals FlowPfcPause from protobuf object *otg.FlowPfcPause + FromProto(msg *otg.FlowPfcPause) (FlowPfcPause, error) + // FromPbText unmarshals FlowPfcPause from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowPfcPause from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowPfcPause from JSON text + FromJson(value string) error +} + +func (obj *flowPfcPause) Marshal() marshalFlowPfcPause { + if obj.marshaller == nil { + obj.marshaller = &marshalflowPfcPause{obj: obj} + } + return obj.marshaller +} + +func (obj *flowPfcPause) Unmarshal() unMarshalFlowPfcPause { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowPfcPause{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowPfcPause) ToProto() (*otg.FlowPfcPause, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowPfcPause) FromProto(msg *otg.FlowPfcPause) (FlowPfcPause, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowPfcPause) 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 *unMarshalflowPfcPause) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowPfcPause) 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 *unMarshalflowPfcPause) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowPfcPause) 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 *unMarshalflowPfcPause) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowPfcPause) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowPfcPause) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowPfcPause) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowPfcPause) Clone() (FlowPfcPause, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowPfcPause() + 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 +} + +func (obj *flowPfcPause) setNil() { + obj.dstHolder = nil + obj.srcHolder = nil + obj.etherTypeHolder = nil + obj.controlOpCodeHolder = nil + obj.classEnableVectorHolder = nil + obj.pauseClass_0Holder = nil + obj.pauseClass_1Holder = nil + obj.pauseClass_2Holder = nil + obj.pauseClass_3Holder = nil + obj.pauseClass_4Holder = nil + obj.pauseClass_5Holder = nil + obj.pauseClass_6Holder = nil + obj.pauseClass_7Holder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowPfcPause is iEEE 802.1Qbb PFC Pause packet header. +type FlowPfcPause interface { + Validation + // msg marshals FlowPfcPause to protobuf object *otg.FlowPfcPause + // and doesn't set defaults + msg() *otg.FlowPfcPause + // setMsg unmarshals FlowPfcPause from protobuf object *otg.FlowPfcPause + // and doesn't set defaults + setMsg(*otg.FlowPfcPause) FlowPfcPause + // provides marshal interface + Marshal() marshalFlowPfcPause + // provides unmarshal interface + Unmarshal() unMarshalFlowPfcPause + // validate validates FlowPfcPause + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowPfcPause, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Dst returns PatternFlowPfcPauseDst, set in FlowPfcPause. + // PatternFlowPfcPauseDst is destination MAC address + Dst() PatternFlowPfcPauseDst + // SetDst assigns PatternFlowPfcPauseDst provided by user to FlowPfcPause. + // PatternFlowPfcPauseDst is destination MAC address + SetDst(value PatternFlowPfcPauseDst) FlowPfcPause + // HasDst checks if Dst has been set in FlowPfcPause + HasDst() bool + // Src returns PatternFlowPfcPauseSrc, set in FlowPfcPause. + // PatternFlowPfcPauseSrc is source MAC address + Src() PatternFlowPfcPauseSrc + // SetSrc assigns PatternFlowPfcPauseSrc provided by user to FlowPfcPause. + // PatternFlowPfcPauseSrc is source MAC address + SetSrc(value PatternFlowPfcPauseSrc) FlowPfcPause + // HasSrc checks if Src has been set in FlowPfcPause + HasSrc() bool + // EtherType returns PatternFlowPfcPauseEtherType, set in FlowPfcPause. + // PatternFlowPfcPauseEtherType is ethernet type + EtherType() PatternFlowPfcPauseEtherType + // SetEtherType assigns PatternFlowPfcPauseEtherType provided by user to FlowPfcPause. + // PatternFlowPfcPauseEtherType is ethernet type + SetEtherType(value PatternFlowPfcPauseEtherType) FlowPfcPause + // HasEtherType checks if EtherType has been set in FlowPfcPause + HasEtherType() bool + // ControlOpCode returns PatternFlowPfcPauseControlOpCode, set in FlowPfcPause. + // PatternFlowPfcPauseControlOpCode is control operation code + ControlOpCode() PatternFlowPfcPauseControlOpCode + // SetControlOpCode assigns PatternFlowPfcPauseControlOpCode provided by user to FlowPfcPause. + // PatternFlowPfcPauseControlOpCode is control operation code + SetControlOpCode(value PatternFlowPfcPauseControlOpCode) FlowPfcPause + // HasControlOpCode checks if ControlOpCode has been set in FlowPfcPause + HasControlOpCode() bool + // ClassEnableVector returns PatternFlowPfcPauseClassEnableVector, set in FlowPfcPause. + // PatternFlowPfcPauseClassEnableVector is destination + ClassEnableVector() PatternFlowPfcPauseClassEnableVector + // SetClassEnableVector assigns PatternFlowPfcPauseClassEnableVector provided by user to FlowPfcPause. + // PatternFlowPfcPauseClassEnableVector is destination + SetClassEnableVector(value PatternFlowPfcPauseClassEnableVector) FlowPfcPause + // HasClassEnableVector checks if ClassEnableVector has been set in FlowPfcPause + HasClassEnableVector() bool + // PauseClass0 returns PatternFlowPfcPausePauseClass0, set in FlowPfcPause. + // PatternFlowPfcPausePauseClass0 is pause class 0 + PauseClass0() PatternFlowPfcPausePauseClass0 + // SetPauseClass0 assigns PatternFlowPfcPausePauseClass0 provided by user to FlowPfcPause. + // PatternFlowPfcPausePauseClass0 is pause class 0 + SetPauseClass0(value PatternFlowPfcPausePauseClass0) FlowPfcPause + // HasPauseClass0 checks if PauseClass0 has been set in FlowPfcPause + HasPauseClass0() bool + // PauseClass1 returns PatternFlowPfcPausePauseClass1, set in FlowPfcPause. + // PatternFlowPfcPausePauseClass1 is pause class 1 + PauseClass1() PatternFlowPfcPausePauseClass1 + // SetPauseClass1 assigns PatternFlowPfcPausePauseClass1 provided by user to FlowPfcPause. + // PatternFlowPfcPausePauseClass1 is pause class 1 + SetPauseClass1(value PatternFlowPfcPausePauseClass1) FlowPfcPause + // HasPauseClass1 checks if PauseClass1 has been set in FlowPfcPause + HasPauseClass1() bool + // PauseClass2 returns PatternFlowPfcPausePauseClass2, set in FlowPfcPause. + // PatternFlowPfcPausePauseClass2 is pause class 2 + PauseClass2() PatternFlowPfcPausePauseClass2 + // SetPauseClass2 assigns PatternFlowPfcPausePauseClass2 provided by user to FlowPfcPause. + // PatternFlowPfcPausePauseClass2 is pause class 2 + SetPauseClass2(value PatternFlowPfcPausePauseClass2) FlowPfcPause + // HasPauseClass2 checks if PauseClass2 has been set in FlowPfcPause + HasPauseClass2() bool + // PauseClass3 returns PatternFlowPfcPausePauseClass3, set in FlowPfcPause. + // PatternFlowPfcPausePauseClass3 is pause class 3 + PauseClass3() PatternFlowPfcPausePauseClass3 + // SetPauseClass3 assigns PatternFlowPfcPausePauseClass3 provided by user to FlowPfcPause. + // PatternFlowPfcPausePauseClass3 is pause class 3 + SetPauseClass3(value PatternFlowPfcPausePauseClass3) FlowPfcPause + // HasPauseClass3 checks if PauseClass3 has been set in FlowPfcPause + HasPauseClass3() bool + // PauseClass4 returns PatternFlowPfcPausePauseClass4, set in FlowPfcPause. + // PatternFlowPfcPausePauseClass4 is pause class 4 + PauseClass4() PatternFlowPfcPausePauseClass4 + // SetPauseClass4 assigns PatternFlowPfcPausePauseClass4 provided by user to FlowPfcPause. + // PatternFlowPfcPausePauseClass4 is pause class 4 + SetPauseClass4(value PatternFlowPfcPausePauseClass4) FlowPfcPause + // HasPauseClass4 checks if PauseClass4 has been set in FlowPfcPause + HasPauseClass4() bool + // PauseClass5 returns PatternFlowPfcPausePauseClass5, set in FlowPfcPause. + // PatternFlowPfcPausePauseClass5 is pause class 5 + PauseClass5() PatternFlowPfcPausePauseClass5 + // SetPauseClass5 assigns PatternFlowPfcPausePauseClass5 provided by user to FlowPfcPause. + // PatternFlowPfcPausePauseClass5 is pause class 5 + SetPauseClass5(value PatternFlowPfcPausePauseClass5) FlowPfcPause + // HasPauseClass5 checks if PauseClass5 has been set in FlowPfcPause + HasPauseClass5() bool + // PauseClass6 returns PatternFlowPfcPausePauseClass6, set in FlowPfcPause. + // PatternFlowPfcPausePauseClass6 is pause class 6 + PauseClass6() PatternFlowPfcPausePauseClass6 + // SetPauseClass6 assigns PatternFlowPfcPausePauseClass6 provided by user to FlowPfcPause. + // PatternFlowPfcPausePauseClass6 is pause class 6 + SetPauseClass6(value PatternFlowPfcPausePauseClass6) FlowPfcPause + // HasPauseClass6 checks if PauseClass6 has been set in FlowPfcPause + HasPauseClass6() bool + // PauseClass7 returns PatternFlowPfcPausePauseClass7, set in FlowPfcPause. + // PatternFlowPfcPausePauseClass7 is pause class 7 + PauseClass7() PatternFlowPfcPausePauseClass7 + // SetPauseClass7 assigns PatternFlowPfcPausePauseClass7 provided by user to FlowPfcPause. + // PatternFlowPfcPausePauseClass7 is pause class 7 + SetPauseClass7(value PatternFlowPfcPausePauseClass7) FlowPfcPause + // HasPauseClass7 checks if PauseClass7 has been set in FlowPfcPause + HasPauseClass7() bool + setNil() +} + +// description is TBD +// Dst returns a PatternFlowPfcPauseDst +func (obj *flowPfcPause) Dst() PatternFlowPfcPauseDst { + if obj.obj.Dst == nil { + obj.obj.Dst = NewPatternFlowPfcPauseDst().msg() + } + if obj.dstHolder == nil { + obj.dstHolder = &patternFlowPfcPauseDst{obj: obj.obj.Dst} + } + return obj.dstHolder +} + +// description is TBD +// Dst returns a PatternFlowPfcPauseDst +func (obj *flowPfcPause) HasDst() bool { + return obj.obj.Dst != nil +} + +// description is TBD +// SetDst sets the PatternFlowPfcPauseDst value in the FlowPfcPause object +func (obj *flowPfcPause) SetDst(value PatternFlowPfcPauseDst) FlowPfcPause { + + obj.dstHolder = nil + obj.obj.Dst = value.msg() + + return obj +} + +// description is TBD +// Src returns a PatternFlowPfcPauseSrc +func (obj *flowPfcPause) Src() PatternFlowPfcPauseSrc { + if obj.obj.Src == nil { + obj.obj.Src = NewPatternFlowPfcPauseSrc().msg() + } + if obj.srcHolder == nil { + obj.srcHolder = &patternFlowPfcPauseSrc{obj: obj.obj.Src} + } + return obj.srcHolder +} + +// description is TBD +// Src returns a PatternFlowPfcPauseSrc +func (obj *flowPfcPause) HasSrc() bool { + return obj.obj.Src != nil +} + +// description is TBD +// SetSrc sets the PatternFlowPfcPauseSrc value in the FlowPfcPause object +func (obj *flowPfcPause) SetSrc(value PatternFlowPfcPauseSrc) FlowPfcPause { + + obj.srcHolder = nil + obj.obj.Src = value.msg() + + return obj +} + +// description is TBD +// EtherType returns a PatternFlowPfcPauseEtherType +func (obj *flowPfcPause) EtherType() PatternFlowPfcPauseEtherType { + if obj.obj.EtherType == nil { + obj.obj.EtherType = NewPatternFlowPfcPauseEtherType().msg() + } + if obj.etherTypeHolder == nil { + obj.etherTypeHolder = &patternFlowPfcPauseEtherType{obj: obj.obj.EtherType} + } + return obj.etherTypeHolder +} + +// description is TBD +// EtherType returns a PatternFlowPfcPauseEtherType +func (obj *flowPfcPause) HasEtherType() bool { + return obj.obj.EtherType != nil +} + +// description is TBD +// SetEtherType sets the PatternFlowPfcPauseEtherType value in the FlowPfcPause object +func (obj *flowPfcPause) SetEtherType(value PatternFlowPfcPauseEtherType) FlowPfcPause { + + obj.etherTypeHolder = nil + obj.obj.EtherType = value.msg() + + return obj +} + +// description is TBD +// ControlOpCode returns a PatternFlowPfcPauseControlOpCode +func (obj *flowPfcPause) ControlOpCode() PatternFlowPfcPauseControlOpCode { + if obj.obj.ControlOpCode == nil { + obj.obj.ControlOpCode = NewPatternFlowPfcPauseControlOpCode().msg() + } + if obj.controlOpCodeHolder == nil { + obj.controlOpCodeHolder = &patternFlowPfcPauseControlOpCode{obj: obj.obj.ControlOpCode} + } + return obj.controlOpCodeHolder +} + +// description is TBD +// ControlOpCode returns a PatternFlowPfcPauseControlOpCode +func (obj *flowPfcPause) HasControlOpCode() bool { + return obj.obj.ControlOpCode != nil +} + +// description is TBD +// SetControlOpCode sets the PatternFlowPfcPauseControlOpCode value in the FlowPfcPause object +func (obj *flowPfcPause) SetControlOpCode(value PatternFlowPfcPauseControlOpCode) FlowPfcPause { + + obj.controlOpCodeHolder = nil + obj.obj.ControlOpCode = value.msg() + + return obj +} + +// description is TBD +// ClassEnableVector returns a PatternFlowPfcPauseClassEnableVector +func (obj *flowPfcPause) ClassEnableVector() PatternFlowPfcPauseClassEnableVector { + if obj.obj.ClassEnableVector == nil { + obj.obj.ClassEnableVector = NewPatternFlowPfcPauseClassEnableVector().msg() + } + if obj.classEnableVectorHolder == nil { + obj.classEnableVectorHolder = &patternFlowPfcPauseClassEnableVector{obj: obj.obj.ClassEnableVector} + } + return obj.classEnableVectorHolder +} + +// description is TBD +// ClassEnableVector returns a PatternFlowPfcPauseClassEnableVector +func (obj *flowPfcPause) HasClassEnableVector() bool { + return obj.obj.ClassEnableVector != nil +} + +// description is TBD +// SetClassEnableVector sets the PatternFlowPfcPauseClassEnableVector value in the FlowPfcPause object +func (obj *flowPfcPause) SetClassEnableVector(value PatternFlowPfcPauseClassEnableVector) FlowPfcPause { + + obj.classEnableVectorHolder = nil + obj.obj.ClassEnableVector = value.msg() + + return obj +} + +// description is TBD +// PauseClass0 returns a PatternFlowPfcPausePauseClass0 +func (obj *flowPfcPause) PauseClass0() PatternFlowPfcPausePauseClass0 { + if obj.obj.PauseClass_0 == nil { + obj.obj.PauseClass_0 = NewPatternFlowPfcPausePauseClass0().msg() + } + if obj.pauseClass_0Holder == nil { + obj.pauseClass_0Holder = &patternFlowPfcPausePauseClass0{obj: obj.obj.PauseClass_0} + } + return obj.pauseClass_0Holder +} + +// description is TBD +// PauseClass0 returns a PatternFlowPfcPausePauseClass0 +func (obj *flowPfcPause) HasPauseClass0() bool { + return obj.obj.PauseClass_0 != nil +} + +// description is TBD +// SetPauseClass0 sets the PatternFlowPfcPausePauseClass0 value in the FlowPfcPause object +func (obj *flowPfcPause) SetPauseClass0(value PatternFlowPfcPausePauseClass0) FlowPfcPause { + + obj.pauseClass_0Holder = nil + obj.obj.PauseClass_0 = value.msg() + + return obj +} + +// description is TBD +// PauseClass1 returns a PatternFlowPfcPausePauseClass1 +func (obj *flowPfcPause) PauseClass1() PatternFlowPfcPausePauseClass1 { + if obj.obj.PauseClass_1 == nil { + obj.obj.PauseClass_1 = NewPatternFlowPfcPausePauseClass1().msg() + } + if obj.pauseClass_1Holder == nil { + obj.pauseClass_1Holder = &patternFlowPfcPausePauseClass1{obj: obj.obj.PauseClass_1} + } + return obj.pauseClass_1Holder +} + +// description is TBD +// PauseClass1 returns a PatternFlowPfcPausePauseClass1 +func (obj *flowPfcPause) HasPauseClass1() bool { + return obj.obj.PauseClass_1 != nil +} + +// description is TBD +// SetPauseClass1 sets the PatternFlowPfcPausePauseClass1 value in the FlowPfcPause object +func (obj *flowPfcPause) SetPauseClass1(value PatternFlowPfcPausePauseClass1) FlowPfcPause { + + obj.pauseClass_1Holder = nil + obj.obj.PauseClass_1 = value.msg() + + return obj +} + +// description is TBD +// PauseClass2 returns a PatternFlowPfcPausePauseClass2 +func (obj *flowPfcPause) PauseClass2() PatternFlowPfcPausePauseClass2 { + if obj.obj.PauseClass_2 == nil { + obj.obj.PauseClass_2 = NewPatternFlowPfcPausePauseClass2().msg() + } + if obj.pauseClass_2Holder == nil { + obj.pauseClass_2Holder = &patternFlowPfcPausePauseClass2{obj: obj.obj.PauseClass_2} + } + return obj.pauseClass_2Holder +} + +// description is TBD +// PauseClass2 returns a PatternFlowPfcPausePauseClass2 +func (obj *flowPfcPause) HasPauseClass2() bool { + return obj.obj.PauseClass_2 != nil +} + +// description is TBD +// SetPauseClass2 sets the PatternFlowPfcPausePauseClass2 value in the FlowPfcPause object +func (obj *flowPfcPause) SetPauseClass2(value PatternFlowPfcPausePauseClass2) FlowPfcPause { + + obj.pauseClass_2Holder = nil + obj.obj.PauseClass_2 = value.msg() + + return obj +} + +// description is TBD +// PauseClass3 returns a PatternFlowPfcPausePauseClass3 +func (obj *flowPfcPause) PauseClass3() PatternFlowPfcPausePauseClass3 { + if obj.obj.PauseClass_3 == nil { + obj.obj.PauseClass_3 = NewPatternFlowPfcPausePauseClass3().msg() + } + if obj.pauseClass_3Holder == nil { + obj.pauseClass_3Holder = &patternFlowPfcPausePauseClass3{obj: obj.obj.PauseClass_3} + } + return obj.pauseClass_3Holder +} + +// description is TBD +// PauseClass3 returns a PatternFlowPfcPausePauseClass3 +func (obj *flowPfcPause) HasPauseClass3() bool { + return obj.obj.PauseClass_3 != nil +} + +// description is TBD +// SetPauseClass3 sets the PatternFlowPfcPausePauseClass3 value in the FlowPfcPause object +func (obj *flowPfcPause) SetPauseClass3(value PatternFlowPfcPausePauseClass3) FlowPfcPause { + + obj.pauseClass_3Holder = nil + obj.obj.PauseClass_3 = value.msg() + + return obj +} + +// description is TBD +// PauseClass4 returns a PatternFlowPfcPausePauseClass4 +func (obj *flowPfcPause) PauseClass4() PatternFlowPfcPausePauseClass4 { + if obj.obj.PauseClass_4 == nil { + obj.obj.PauseClass_4 = NewPatternFlowPfcPausePauseClass4().msg() + } + if obj.pauseClass_4Holder == nil { + obj.pauseClass_4Holder = &patternFlowPfcPausePauseClass4{obj: obj.obj.PauseClass_4} + } + return obj.pauseClass_4Holder +} + +// description is TBD +// PauseClass4 returns a PatternFlowPfcPausePauseClass4 +func (obj *flowPfcPause) HasPauseClass4() bool { + return obj.obj.PauseClass_4 != nil +} + +// description is TBD +// SetPauseClass4 sets the PatternFlowPfcPausePauseClass4 value in the FlowPfcPause object +func (obj *flowPfcPause) SetPauseClass4(value PatternFlowPfcPausePauseClass4) FlowPfcPause { + + obj.pauseClass_4Holder = nil + obj.obj.PauseClass_4 = value.msg() + + return obj +} + +// description is TBD +// PauseClass5 returns a PatternFlowPfcPausePauseClass5 +func (obj *flowPfcPause) PauseClass5() PatternFlowPfcPausePauseClass5 { + if obj.obj.PauseClass_5 == nil { + obj.obj.PauseClass_5 = NewPatternFlowPfcPausePauseClass5().msg() + } + if obj.pauseClass_5Holder == nil { + obj.pauseClass_5Holder = &patternFlowPfcPausePauseClass5{obj: obj.obj.PauseClass_5} + } + return obj.pauseClass_5Holder +} + +// description is TBD +// PauseClass5 returns a PatternFlowPfcPausePauseClass5 +func (obj *flowPfcPause) HasPauseClass5() bool { + return obj.obj.PauseClass_5 != nil +} + +// description is TBD +// SetPauseClass5 sets the PatternFlowPfcPausePauseClass5 value in the FlowPfcPause object +func (obj *flowPfcPause) SetPauseClass5(value PatternFlowPfcPausePauseClass5) FlowPfcPause { + + obj.pauseClass_5Holder = nil + obj.obj.PauseClass_5 = value.msg() + + return obj +} + +// description is TBD +// PauseClass6 returns a PatternFlowPfcPausePauseClass6 +func (obj *flowPfcPause) PauseClass6() PatternFlowPfcPausePauseClass6 { + if obj.obj.PauseClass_6 == nil { + obj.obj.PauseClass_6 = NewPatternFlowPfcPausePauseClass6().msg() + } + if obj.pauseClass_6Holder == nil { + obj.pauseClass_6Holder = &patternFlowPfcPausePauseClass6{obj: obj.obj.PauseClass_6} + } + return obj.pauseClass_6Holder +} + +// description is TBD +// PauseClass6 returns a PatternFlowPfcPausePauseClass6 +func (obj *flowPfcPause) HasPauseClass6() bool { + return obj.obj.PauseClass_6 != nil +} + +// description is TBD +// SetPauseClass6 sets the PatternFlowPfcPausePauseClass6 value in the FlowPfcPause object +func (obj *flowPfcPause) SetPauseClass6(value PatternFlowPfcPausePauseClass6) FlowPfcPause { + + obj.pauseClass_6Holder = nil + obj.obj.PauseClass_6 = value.msg() + + return obj +} + +// description is TBD +// PauseClass7 returns a PatternFlowPfcPausePauseClass7 +func (obj *flowPfcPause) PauseClass7() PatternFlowPfcPausePauseClass7 { + if obj.obj.PauseClass_7 == nil { + obj.obj.PauseClass_7 = NewPatternFlowPfcPausePauseClass7().msg() + } + if obj.pauseClass_7Holder == nil { + obj.pauseClass_7Holder = &patternFlowPfcPausePauseClass7{obj: obj.obj.PauseClass_7} + } + return obj.pauseClass_7Holder +} + +// description is TBD +// PauseClass7 returns a PatternFlowPfcPausePauseClass7 +func (obj *flowPfcPause) HasPauseClass7() bool { + return obj.obj.PauseClass_7 != nil +} + +// description is TBD +// SetPauseClass7 sets the PatternFlowPfcPausePauseClass7 value in the FlowPfcPause object +func (obj *flowPfcPause) SetPauseClass7(value PatternFlowPfcPausePauseClass7) FlowPfcPause { + + obj.pauseClass_7Holder = nil + obj.obj.PauseClass_7 = value.msg() + + return obj +} + +func (obj *flowPfcPause) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Dst != nil { + + obj.Dst().validateObj(vObj, set_default) + } + + if obj.obj.Src != nil { + + obj.Src().validateObj(vObj, set_default) + } + + if obj.obj.EtherType != nil { + + obj.EtherType().validateObj(vObj, set_default) + } + + if obj.obj.ControlOpCode != nil { + + obj.ControlOpCode().validateObj(vObj, set_default) + } + + if obj.obj.ClassEnableVector != nil { + + obj.ClassEnableVector().validateObj(vObj, set_default) + } + + if obj.obj.PauseClass_0 != nil { + + obj.PauseClass0().validateObj(vObj, set_default) + } + + if obj.obj.PauseClass_1 != nil { + + obj.PauseClass1().validateObj(vObj, set_default) + } + + if obj.obj.PauseClass_2 != nil { + + obj.PauseClass2().validateObj(vObj, set_default) + } + + if obj.obj.PauseClass_3 != nil { + + obj.PauseClass3().validateObj(vObj, set_default) + } + + if obj.obj.PauseClass_4 != nil { + + obj.PauseClass4().validateObj(vObj, set_default) + } + + if obj.obj.PauseClass_5 != nil { + + obj.PauseClass5().validateObj(vObj, set_default) + } + + if obj.obj.PauseClass_6 != nil { + + obj.PauseClass6().validateObj(vObj, set_default) + } + + if obj.obj.PauseClass_7 != nil { + + obj.PauseClass7().validateObj(vObj, set_default) + } + +} + +func (obj *flowPfcPause) setDefault() { + +} diff --git a/gosnappi/flow_port.go b/gosnappi/flow_port.go new file mode 100644 index 00000000..0faf6317 --- /dev/null +++ b/gosnappi/flow_port.go @@ -0,0 +1,442 @@ +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" +) + +// ***** FlowPort ***** +type flowPort struct { + validation + obj *otg.FlowPort + marshaller marshalFlowPort + unMarshaller unMarshalFlowPort +} + +func NewFlowPort() FlowPort { + obj := flowPort{obj: &otg.FlowPort{}} + obj.setDefault() + return &obj +} + +func (obj *flowPort) msg() *otg.FlowPort { + return obj.obj +} + +func (obj *flowPort) setMsg(msg *otg.FlowPort) FlowPort { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowPort struct { + obj *flowPort +} + +type marshalFlowPort interface { + // ToProto marshals FlowPort to protobuf object *otg.FlowPort + ToProto() (*otg.FlowPort, error) + // ToPbText marshals FlowPort to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowPort to YAML text + ToYaml() (string, error) + // ToJson marshals FlowPort to JSON text + ToJson() (string, error) +} + +type unMarshalflowPort struct { + obj *flowPort +} + +type unMarshalFlowPort interface { + // FromProto unmarshals FlowPort from protobuf object *otg.FlowPort + FromProto(msg *otg.FlowPort) (FlowPort, error) + // FromPbText unmarshals FlowPort from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowPort from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowPort from JSON text + FromJson(value string) error +} + +func (obj *flowPort) Marshal() marshalFlowPort { + if obj.marshaller == nil { + obj.marshaller = &marshalflowPort{obj: obj} + } + return obj.marshaller +} + +func (obj *flowPort) Unmarshal() unMarshalFlowPort { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowPort{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowPort) ToProto() (*otg.FlowPort, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowPort) FromProto(msg *otg.FlowPort) (FlowPort, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowPort) 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 *unMarshalflowPort) 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 *marshalflowPort) 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 *unMarshalflowPort) 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 *marshalflowPort) 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 *unMarshalflowPort) 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 *flowPort) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowPort) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowPort) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowPort) Clone() (FlowPort, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowPort() + 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 +} + +// FlowPort is a container for a transmit port and 0..n intended receive ports. +// When assigning this container to a flow the flows's +// packet headers will not be populated with any address resolution +// information such as source and/or destination addresses. +// For example Flow.Ethernet dst mac address values will be defaulted to 0. +// For full control over the Flow.properties.packet header contents use this +// container. +type FlowPort interface { + Validation + // msg marshals FlowPort to protobuf object *otg.FlowPort + // and doesn't set defaults + msg() *otg.FlowPort + // setMsg unmarshals FlowPort from protobuf object *otg.FlowPort + // and doesn't set defaults + setMsg(*otg.FlowPort) FlowPort + // provides marshal interface + Marshal() marshalFlowPort + // provides unmarshal interface + Unmarshal() unMarshalFlowPort + // validate validates FlowPort + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowPort, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // TxName returns string, set in FlowPort. + TxName() string + // SetTxName assigns string provided by user to FlowPort + SetTxName(value string) FlowPort + // RxName returns string, set in FlowPort. + RxName() string + // SetRxName assigns string provided by user to FlowPort + SetRxName(value string) FlowPort + // HasRxName checks if RxName has been set in FlowPort + HasRxName() bool + // RxNames returns []string, set in FlowPort. + RxNames() []string + // SetRxNames assigns []string provided by user to FlowPort + SetRxNames(value []string) FlowPort +} + +// The unique name of a port that is the transmit port. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// - /components/schemas/Lag/properties/name +// +// TxName returns a string +func (obj *flowPort) TxName() string { + + return *obj.obj.TxName + +} + +// The unique name of a port that is the transmit port. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// - /components/schemas/Lag/properties/name +// +// SetTxName sets the string value in the FlowPort object +func (obj *flowPort) SetTxName(value string) FlowPort { + + obj.obj.TxName = &value + return obj +} + +// Deprecated: This property is deprecated in favor of property rx_names +// +// Deprecated: This property is deprecated in favor of property rx_names +// +// The unique name of a port that is the intended receive port. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// - /components/schemas/Lag/properties/name +// +// RxName returns a string +func (obj *flowPort) RxName() string { + + return *obj.obj.RxName + +} + +// Deprecated: This property is deprecated in favor of property rx_names +// +// Deprecated: This property is deprecated in favor of property rx_names +// +// The unique name of a port that is the intended receive port. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// - /components/schemas/Lag/properties/name +// +// RxName returns a string +func (obj *flowPort) HasRxName() bool { + return obj.obj.RxName != nil +} + +// Deprecated: This property is deprecated in favor of property rx_names +// +// Deprecated: This property is deprecated in favor of property rx_names +// +// The unique name of a port that is the intended receive port. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// - /components/schemas/Lag/properties/name +// +// SetRxName sets the string value in the FlowPort object +func (obj *flowPort) SetRxName(value string) FlowPort { + + obj.obj.RxName = &value + return obj +} + +// Unique name of ports or lags that are intended receive endpoints. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// - /components/schemas/Lag/properties/name +// +// RxNames returns a []string +func (obj *flowPort) RxNames() []string { + if obj.obj.RxNames == nil { + obj.obj.RxNames = make([]string, 0) + } + return obj.obj.RxNames +} + +// Unique name of ports or lags that are intended receive endpoints. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// - /components/schemas/Lag/properties/name +// +// SetRxNames sets the []string value in the FlowPort object +func (obj *flowPort) SetRxNames(value []string) FlowPort { + + if obj.obj.RxNames == nil { + obj.obj.RxNames = make([]string, 0) + } + obj.obj.RxNames = value + + return obj +} + +func (obj *flowPort) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // TxName is required + if obj.obj.TxName == nil { + vObj.validationErrors = append(vObj.validationErrors, "TxName is required field on interface FlowPort") + } + + // RxName is deprecated + if obj.obj.RxName != nil { + obj.addWarnings("RxName property in schema FlowPort is deprecated, This property is deprecated in favor of property rx_names") + } + +} + +func (obj *flowPort) setDefault() { + +} diff --git a/gosnappi/flow_ppp.go b/gosnappi/flow_ppp.go new file mode 100644 index 00000000..c3b7b4a7 --- /dev/null +++ b/gosnappi/flow_ppp.go @@ -0,0 +1,414 @@ +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" +) + +// ***** FlowPpp ***** +type flowPpp struct { + validation + obj *otg.FlowPpp + marshaller marshalFlowPpp + unMarshaller unMarshalFlowPpp + addressHolder PatternFlowPppAddress + controlHolder PatternFlowPppControl + protocolTypeHolder PatternFlowPppProtocolType +} + +func NewFlowPpp() FlowPpp { + obj := flowPpp{obj: &otg.FlowPpp{}} + obj.setDefault() + return &obj +} + +func (obj *flowPpp) msg() *otg.FlowPpp { + return obj.obj +} + +func (obj *flowPpp) setMsg(msg *otg.FlowPpp) FlowPpp { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowPpp struct { + obj *flowPpp +} + +type marshalFlowPpp interface { + // ToProto marshals FlowPpp to protobuf object *otg.FlowPpp + ToProto() (*otg.FlowPpp, error) + // ToPbText marshals FlowPpp to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowPpp to YAML text + ToYaml() (string, error) + // ToJson marshals FlowPpp to JSON text + ToJson() (string, error) +} + +type unMarshalflowPpp struct { + obj *flowPpp +} + +type unMarshalFlowPpp interface { + // FromProto unmarshals FlowPpp from protobuf object *otg.FlowPpp + FromProto(msg *otg.FlowPpp) (FlowPpp, error) + // FromPbText unmarshals FlowPpp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowPpp from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowPpp from JSON text + FromJson(value string) error +} + +func (obj *flowPpp) Marshal() marshalFlowPpp { + if obj.marshaller == nil { + obj.marshaller = &marshalflowPpp{obj: obj} + } + return obj.marshaller +} + +func (obj *flowPpp) Unmarshal() unMarshalFlowPpp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowPpp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowPpp) ToProto() (*otg.FlowPpp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowPpp) FromProto(msg *otg.FlowPpp) (FlowPpp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowPpp) 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 *unMarshalflowPpp) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowPpp) 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 *unMarshalflowPpp) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowPpp) 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 *unMarshalflowPpp) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowPpp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowPpp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowPpp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowPpp) Clone() (FlowPpp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowPpp() + 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 +} + +func (obj *flowPpp) setNil() { + obj.addressHolder = nil + obj.controlHolder = nil + obj.protocolTypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowPpp is pPP packet header +type FlowPpp interface { + Validation + // msg marshals FlowPpp to protobuf object *otg.FlowPpp + // and doesn't set defaults + msg() *otg.FlowPpp + // setMsg unmarshals FlowPpp from protobuf object *otg.FlowPpp + // and doesn't set defaults + setMsg(*otg.FlowPpp) FlowPpp + // provides marshal interface + Marshal() marshalFlowPpp + // provides unmarshal interface + Unmarshal() unMarshalFlowPpp + // validate validates FlowPpp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowPpp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Address returns PatternFlowPppAddress, set in FlowPpp. + // PatternFlowPppAddress is pPP address + Address() PatternFlowPppAddress + // SetAddress assigns PatternFlowPppAddress provided by user to FlowPpp. + // PatternFlowPppAddress is pPP address + SetAddress(value PatternFlowPppAddress) FlowPpp + // HasAddress checks if Address has been set in FlowPpp + HasAddress() bool + // Control returns PatternFlowPppControl, set in FlowPpp. + // PatternFlowPppControl is pPP control + Control() PatternFlowPppControl + // SetControl assigns PatternFlowPppControl provided by user to FlowPpp. + // PatternFlowPppControl is pPP control + SetControl(value PatternFlowPppControl) FlowPpp + // HasControl checks if Control has been set in FlowPpp + HasControl() bool + // ProtocolType returns PatternFlowPppProtocolType, set in FlowPpp. + // PatternFlowPppProtocolType is pPP protocol type + ProtocolType() PatternFlowPppProtocolType + // SetProtocolType assigns PatternFlowPppProtocolType provided by user to FlowPpp. + // PatternFlowPppProtocolType is pPP protocol type + SetProtocolType(value PatternFlowPppProtocolType) FlowPpp + // HasProtocolType checks if ProtocolType has been set in FlowPpp + HasProtocolType() bool + setNil() +} + +// description is TBD +// Address returns a PatternFlowPppAddress +func (obj *flowPpp) Address() PatternFlowPppAddress { + if obj.obj.Address == nil { + obj.obj.Address = NewPatternFlowPppAddress().msg() + } + if obj.addressHolder == nil { + obj.addressHolder = &patternFlowPppAddress{obj: obj.obj.Address} + } + return obj.addressHolder +} + +// description is TBD +// Address returns a PatternFlowPppAddress +func (obj *flowPpp) HasAddress() bool { + return obj.obj.Address != nil +} + +// description is TBD +// SetAddress sets the PatternFlowPppAddress value in the FlowPpp object +func (obj *flowPpp) SetAddress(value PatternFlowPppAddress) FlowPpp { + + obj.addressHolder = nil + obj.obj.Address = value.msg() + + return obj +} + +// description is TBD +// Control returns a PatternFlowPppControl +func (obj *flowPpp) Control() PatternFlowPppControl { + if obj.obj.Control == nil { + obj.obj.Control = NewPatternFlowPppControl().msg() + } + if obj.controlHolder == nil { + obj.controlHolder = &patternFlowPppControl{obj: obj.obj.Control} + } + return obj.controlHolder +} + +// description is TBD +// Control returns a PatternFlowPppControl +func (obj *flowPpp) HasControl() bool { + return obj.obj.Control != nil +} + +// description is TBD +// SetControl sets the PatternFlowPppControl value in the FlowPpp object +func (obj *flowPpp) SetControl(value PatternFlowPppControl) FlowPpp { + + obj.controlHolder = nil + obj.obj.Control = value.msg() + + return obj +} + +// description is TBD +// ProtocolType returns a PatternFlowPppProtocolType +func (obj *flowPpp) ProtocolType() PatternFlowPppProtocolType { + if obj.obj.ProtocolType == nil { + obj.obj.ProtocolType = NewPatternFlowPppProtocolType().msg() + } + if obj.protocolTypeHolder == nil { + obj.protocolTypeHolder = &patternFlowPppProtocolType{obj: obj.obj.ProtocolType} + } + return obj.protocolTypeHolder +} + +// description is TBD +// ProtocolType returns a PatternFlowPppProtocolType +func (obj *flowPpp) HasProtocolType() bool { + return obj.obj.ProtocolType != nil +} + +// description is TBD +// SetProtocolType sets the PatternFlowPppProtocolType value in the FlowPpp object +func (obj *flowPpp) SetProtocolType(value PatternFlowPppProtocolType) FlowPpp { + + obj.protocolTypeHolder = nil + obj.obj.ProtocolType = value.msg() + + return obj +} + +func (obj *flowPpp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Address != nil { + + obj.Address().validateObj(vObj, set_default) + } + + if obj.obj.Control != nil { + + obj.Control().validateObj(vObj, set_default) + } + + if obj.obj.ProtocolType != nil { + + obj.ProtocolType().validateObj(vObj, set_default) + } + +} + +func (obj *flowPpp) setDefault() { + +} diff --git a/gosnappi/flow_predefined_tags.go b/gosnappi/flow_predefined_tags.go new file mode 100644 index 00000000..393ff8b5 --- /dev/null +++ b/gosnappi/flow_predefined_tags.go @@ -0,0 +1,312 @@ +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" +) + +// ***** FlowPredefinedTags ***** +type flowPredefinedTags struct { + validation + obj *otg.FlowPredefinedTags + marshaller marshalFlowPredefinedTags + unMarshaller unMarshalFlowPredefinedTags +} + +func NewFlowPredefinedTags() FlowPredefinedTags { + obj := flowPredefinedTags{obj: &otg.FlowPredefinedTags{}} + obj.setDefault() + return &obj +} + +func (obj *flowPredefinedTags) msg() *otg.FlowPredefinedTags { + return obj.obj +} + +func (obj *flowPredefinedTags) setMsg(msg *otg.FlowPredefinedTags) FlowPredefinedTags { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowPredefinedTags struct { + obj *flowPredefinedTags +} + +type marshalFlowPredefinedTags interface { + // ToProto marshals FlowPredefinedTags to protobuf object *otg.FlowPredefinedTags + ToProto() (*otg.FlowPredefinedTags, error) + // ToPbText marshals FlowPredefinedTags to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowPredefinedTags to YAML text + ToYaml() (string, error) + // ToJson marshals FlowPredefinedTags to JSON text + ToJson() (string, error) +} + +type unMarshalflowPredefinedTags struct { + obj *flowPredefinedTags +} + +type unMarshalFlowPredefinedTags interface { + // FromProto unmarshals FlowPredefinedTags from protobuf object *otg.FlowPredefinedTags + FromProto(msg *otg.FlowPredefinedTags) (FlowPredefinedTags, error) + // FromPbText unmarshals FlowPredefinedTags from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowPredefinedTags from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowPredefinedTags from JSON text + FromJson(value string) error +} + +func (obj *flowPredefinedTags) Marshal() marshalFlowPredefinedTags { + if obj.marshaller == nil { + obj.marshaller = &marshalflowPredefinedTags{obj: obj} + } + return obj.marshaller +} + +func (obj *flowPredefinedTags) Unmarshal() unMarshalFlowPredefinedTags { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowPredefinedTags{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowPredefinedTags) ToProto() (*otg.FlowPredefinedTags, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowPredefinedTags) FromProto(msg *otg.FlowPredefinedTags) (FlowPredefinedTags, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowPredefinedTags) 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 *unMarshalflowPredefinedTags) 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 *marshalflowPredefinedTags) 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 *unMarshalflowPredefinedTags) 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 *marshalflowPredefinedTags) 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 *unMarshalflowPredefinedTags) 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 *flowPredefinedTags) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowPredefinedTags) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowPredefinedTags) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowPredefinedTags) Clone() (FlowPredefinedTags, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowPredefinedTags() + 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 +} + +// FlowPredefinedTags is list of predefined flow tracking options, outside packet fields, that can be enabled. +type FlowPredefinedTags interface { + Validation + // msg marshals FlowPredefinedTags to protobuf object *otg.FlowPredefinedTags + // and doesn't set defaults + msg() *otg.FlowPredefinedTags + // setMsg unmarshals FlowPredefinedTags from protobuf object *otg.FlowPredefinedTags + // and doesn't set defaults + setMsg(*otg.FlowPredefinedTags) FlowPredefinedTags + // provides marshal interface + Marshal() marshalFlowPredefinedTags + // provides unmarshal interface + Unmarshal() unMarshalFlowPredefinedTags + // validate validates FlowPredefinedTags + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowPredefinedTags, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RxName returns bool, set in FlowPredefinedTags. + RxName() bool + // SetRxName assigns bool provided by user to FlowPredefinedTags + SetRxName(value bool) FlowPredefinedTags + // HasRxName checks if RxName has been set in FlowPredefinedTags + HasRxName() bool +} + +// Enables Rx port or lag level disaggregation with predefined metrics tag name set as "rx_name". +// The Rx port / lag names can be found under tagged_metrics tag names in flow metrics response. +// RxName returns a bool +func (obj *flowPredefinedTags) RxName() bool { + + return *obj.obj.RxName + +} + +// Enables Rx port or lag level disaggregation with predefined metrics tag name set as "rx_name". +// The Rx port / lag names can be found under tagged_metrics tag names in flow metrics response. +// RxName returns a bool +func (obj *flowPredefinedTags) HasRxName() bool { + return obj.obj.RxName != nil +} + +// Enables Rx port or lag level disaggregation with predefined metrics tag name set as "rx_name". +// The Rx port / lag names can be found under tagged_metrics tag names in flow metrics response. +// SetRxName sets the bool value in the FlowPredefinedTags object +func (obj *flowPredefinedTags) SetRxName(value bool) FlowPredefinedTags { + + obj.obj.RxName = &value + return obj +} + +func (obj *flowPredefinedTags) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *flowPredefinedTags) setDefault() { + if obj.obj.RxName == nil { + obj.SetRxName(false) + } + +} diff --git a/gosnappi/flow_rate.go b/gosnappi/flow_rate.go new file mode 100644 index 00000000..959e02eb --- /dev/null +++ b/gosnappi/flow_rate.go @@ -0,0 +1,663 @@ +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" +) + +// ***** FlowRate ***** +type flowRate struct { + validation + obj *otg.FlowRate + marshaller marshalFlowRate + unMarshaller unMarshalFlowRate +} + +func NewFlowRate() FlowRate { + obj := flowRate{obj: &otg.FlowRate{}} + obj.setDefault() + return &obj +} + +func (obj *flowRate) msg() *otg.FlowRate { + return obj.obj +} + +func (obj *flowRate) setMsg(msg *otg.FlowRate) FlowRate { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRate struct { + obj *flowRate +} + +type marshalFlowRate interface { + // ToProto marshals FlowRate to protobuf object *otg.FlowRate + ToProto() (*otg.FlowRate, error) + // ToPbText marshals FlowRate to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRate to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRate to JSON text + ToJson() (string, error) +} + +type unMarshalflowRate struct { + obj *flowRate +} + +type unMarshalFlowRate interface { + // FromProto unmarshals FlowRate from protobuf object *otg.FlowRate + FromProto(msg *otg.FlowRate) (FlowRate, error) + // FromPbText unmarshals FlowRate from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRate from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRate from JSON text + FromJson(value string) error +} + +func (obj *flowRate) Marshal() marshalFlowRate { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRate{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRate) Unmarshal() unMarshalFlowRate { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRate{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRate) ToProto() (*otg.FlowRate, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRate) FromProto(msg *otg.FlowRate) (FlowRate, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRate) 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 *unMarshalflowRate) 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 *marshalflowRate) 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 *unMarshalflowRate) 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 *marshalflowRate) 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 *unMarshalflowRate) 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 *flowRate) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRate) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRate) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRate) Clone() (FlowRate, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRate() + 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 +} + +// FlowRate is the rate of packet transmission +type FlowRate interface { + Validation + // msg marshals FlowRate to protobuf object *otg.FlowRate + // and doesn't set defaults + msg() *otg.FlowRate + // setMsg unmarshals FlowRate from protobuf object *otg.FlowRate + // and doesn't set defaults + setMsg(*otg.FlowRate) FlowRate + // provides marshal interface + Marshal() marshalFlowRate + // provides unmarshal interface + Unmarshal() unMarshalFlowRate + // validate validates FlowRate + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRate, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRateChoiceEnum, set in FlowRate + Choice() FlowRateChoiceEnum + // setChoice assigns FlowRateChoiceEnum provided by user to FlowRate + setChoice(value FlowRateChoiceEnum) FlowRate + // HasChoice checks if Choice has been set in FlowRate + HasChoice() bool + // Pps returns uint64, set in FlowRate. + Pps() uint64 + // SetPps assigns uint64 provided by user to FlowRate + SetPps(value uint64) FlowRate + // HasPps checks if Pps has been set in FlowRate + HasPps() bool + // Bps returns uint64, set in FlowRate. + Bps() uint64 + // SetBps assigns uint64 provided by user to FlowRate + SetBps(value uint64) FlowRate + // HasBps checks if Bps has been set in FlowRate + HasBps() bool + // Kbps returns uint64, set in FlowRate. + Kbps() uint64 + // SetKbps assigns uint64 provided by user to FlowRate + SetKbps(value uint64) FlowRate + // HasKbps checks if Kbps has been set in FlowRate + HasKbps() bool + // Mbps returns uint64, set in FlowRate. + Mbps() uint64 + // SetMbps assigns uint64 provided by user to FlowRate + SetMbps(value uint64) FlowRate + // HasMbps checks if Mbps has been set in FlowRate + HasMbps() bool + // Gbps returns uint32, set in FlowRate. + Gbps() uint32 + // SetGbps assigns uint32 provided by user to FlowRate + SetGbps(value uint32) FlowRate + // HasGbps checks if Gbps has been set in FlowRate + HasGbps() bool + // Percentage returns float32, set in FlowRate. + Percentage() float32 + // SetPercentage assigns float32 provided by user to FlowRate + SetPercentage(value float32) FlowRate + // HasPercentage checks if Percentage has been set in FlowRate + HasPercentage() bool +} + +type FlowRateChoiceEnum string + +// Enum of Choice on FlowRate +var FlowRateChoice = struct { + PPS FlowRateChoiceEnum + BPS FlowRateChoiceEnum + KBPS FlowRateChoiceEnum + MBPS FlowRateChoiceEnum + GBPS FlowRateChoiceEnum + PERCENTAGE FlowRateChoiceEnum +}{ + PPS: FlowRateChoiceEnum("pps"), + BPS: FlowRateChoiceEnum("bps"), + KBPS: FlowRateChoiceEnum("kbps"), + MBPS: FlowRateChoiceEnum("mbps"), + GBPS: FlowRateChoiceEnum("gbps"), + PERCENTAGE: FlowRateChoiceEnum("percentage"), +} + +func (obj *flowRate) Choice() FlowRateChoiceEnum { + return FlowRateChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The available types of flow rate. +// Choice returns a string +func (obj *flowRate) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRate) setChoice(value FlowRateChoiceEnum) FlowRate { + intValue, ok := otg.FlowRate_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRateChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRate_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Percentage = nil + obj.obj.Gbps = nil + obj.obj.Mbps = nil + obj.obj.Kbps = nil + obj.obj.Bps = nil + obj.obj.Pps = nil + + if value == FlowRateChoice.PPS { + defaultValue := uint64(1000) + obj.obj.Pps = &defaultValue + } + + if value == FlowRateChoice.BPS { + defaultValue := uint64(1000000000) + obj.obj.Bps = &defaultValue + } + + if value == FlowRateChoice.KBPS { + defaultValue := uint64(1000000) + obj.obj.Kbps = &defaultValue + } + + if value == FlowRateChoice.MBPS { + defaultValue := uint64(1000) + obj.obj.Mbps = &defaultValue + } + + if value == FlowRateChoice.GBPS { + defaultValue := uint32(1) + obj.obj.Gbps = &defaultValue + } + + if value == FlowRateChoice.PERCENTAGE { + defaultValue := float32(100) + obj.obj.Percentage = &defaultValue + } + + return obj +} + +// Packets per second. +// Pps returns a uint64 +func (obj *flowRate) Pps() uint64 { + + if obj.obj.Pps == nil { + obj.setChoice(FlowRateChoice.PPS) + } + + return *obj.obj.Pps + +} + +// Packets per second. +// Pps returns a uint64 +func (obj *flowRate) HasPps() bool { + return obj.obj.Pps != nil +} + +// Packets per second. +// SetPps sets the uint64 value in the FlowRate object +func (obj *flowRate) SetPps(value uint64) FlowRate { + obj.setChoice(FlowRateChoice.PPS) + obj.obj.Pps = &value + return obj +} + +// Bits per second. +// Bps returns a uint64 +func (obj *flowRate) Bps() uint64 { + + if obj.obj.Bps == nil { + obj.setChoice(FlowRateChoice.BPS) + } + + return *obj.obj.Bps + +} + +// Bits per second. +// Bps returns a uint64 +func (obj *flowRate) HasBps() bool { + return obj.obj.Bps != nil +} + +// Bits per second. +// SetBps sets the uint64 value in the FlowRate object +func (obj *flowRate) SetBps(value uint64) FlowRate { + obj.setChoice(FlowRateChoice.BPS) + obj.obj.Bps = &value + return obj +} + +// Kilobits per second. +// Kbps returns a uint64 +func (obj *flowRate) Kbps() uint64 { + + if obj.obj.Kbps == nil { + obj.setChoice(FlowRateChoice.KBPS) + } + + return *obj.obj.Kbps + +} + +// Kilobits per second. +// Kbps returns a uint64 +func (obj *flowRate) HasKbps() bool { + return obj.obj.Kbps != nil +} + +// Kilobits per second. +// SetKbps sets the uint64 value in the FlowRate object +func (obj *flowRate) SetKbps(value uint64) FlowRate { + obj.setChoice(FlowRateChoice.KBPS) + obj.obj.Kbps = &value + return obj +} + +// Megabits per second. +// Mbps returns a uint64 +func (obj *flowRate) Mbps() uint64 { + + if obj.obj.Mbps == nil { + obj.setChoice(FlowRateChoice.MBPS) + } + + return *obj.obj.Mbps + +} + +// Megabits per second. +// Mbps returns a uint64 +func (obj *flowRate) HasMbps() bool { + return obj.obj.Mbps != nil +} + +// Megabits per second. +// SetMbps sets the uint64 value in the FlowRate object +func (obj *flowRate) SetMbps(value uint64) FlowRate { + obj.setChoice(FlowRateChoice.MBPS) + obj.obj.Mbps = &value + return obj +} + +// Gigabits per second. +// Gbps returns a uint32 +func (obj *flowRate) Gbps() uint32 { + + if obj.obj.Gbps == nil { + obj.setChoice(FlowRateChoice.GBPS) + } + + return *obj.obj.Gbps + +} + +// Gigabits per second. +// Gbps returns a uint32 +func (obj *flowRate) HasGbps() bool { + return obj.obj.Gbps != nil +} + +// Gigabits per second. +// SetGbps sets the uint32 value in the FlowRate object +func (obj *flowRate) SetGbps(value uint32) FlowRate { + obj.setChoice(FlowRateChoice.GBPS) + obj.obj.Gbps = &value + return obj +} + +// The percentage of a port location's available bandwidth. +// Percentage returns a float32 +func (obj *flowRate) Percentage() float32 { + + if obj.obj.Percentage == nil { + obj.setChoice(FlowRateChoice.PERCENTAGE) + } + + return *obj.obj.Percentage + +} + +// The percentage of a port location's available bandwidth. +// Percentage returns a float32 +func (obj *flowRate) HasPercentage() bool { + return obj.obj.Percentage != nil +} + +// The percentage of a port location's available bandwidth. +// SetPercentage sets the float32 value in the FlowRate object +func (obj *flowRate) SetPercentage(value float32) FlowRate { + obj.setChoice(FlowRateChoice.PERCENTAGE) + obj.obj.Percentage = &value + return obj +} + +func (obj *flowRate) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Pps != nil { + + if *obj.obj.Pps < 1 || *obj.obj.Pps > 18446744073709551615 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= FlowRate.Pps <= 18446744073709551615 but Got %d", *obj.obj.Pps)) + } + + } + + if obj.obj.Bps != nil { + + if *obj.obj.Bps < 672 || *obj.obj.Bps > 18446744073709551615 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("672 <= FlowRate.Bps <= 18446744073709551615 but Got %d", *obj.obj.Bps)) + } + + } + + if obj.obj.Kbps != nil { + + if *obj.obj.Kbps < 1 || *obj.obj.Kbps > 18446744073709551615 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= FlowRate.Kbps <= 18446744073709551615 but Got %d", *obj.obj.Kbps)) + } + + } + + if obj.obj.Mbps != nil { + + if *obj.obj.Mbps < 1 || *obj.obj.Mbps > 18446744073709551615 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= FlowRate.Mbps <= 18446744073709551615 but Got %d", *obj.obj.Mbps)) + } + + } + + if obj.obj.Gbps != nil { + + if *obj.obj.Gbps < 1 || *obj.obj.Gbps > 4294967295 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= FlowRate.Gbps <= 4294967295 but Got %d", *obj.obj.Gbps)) + } + + } + + if obj.obj.Percentage != nil { + + if *obj.obj.Percentage < 0 || *obj.obj.Percentage > 100 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowRate.Percentage <= 100 but Got %f", *obj.obj.Percentage)) + } + + } + +} + +func (obj *flowRate) setDefault() { + var choices_set int = 0 + var choice FlowRateChoiceEnum + + if obj.obj.Pps != nil { + choices_set += 1 + choice = FlowRateChoice.PPS + } + + if obj.obj.Bps != nil { + choices_set += 1 + choice = FlowRateChoice.BPS + } + + if obj.obj.Kbps != nil { + choices_set += 1 + choice = FlowRateChoice.KBPS + } + + if obj.obj.Mbps != nil { + choices_set += 1 + choice = FlowRateChoice.MBPS + } + + if obj.obj.Gbps != nil { + choices_set += 1 + choice = FlowRateChoice.GBPS + } + + if obj.obj.Percentage != nil { + choices_set += 1 + choice = FlowRateChoice.PERCENTAGE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRateChoice.PPS) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRate") + } + } else { + intVal := otg.FlowRate_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRate_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_router.go b/gosnappi/flow_router.go new file mode 100644 index 00000000..baaf89c3 --- /dev/null +++ b/gosnappi/flow_router.go @@ -0,0 +1,498 @@ +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" +) + +// ***** FlowRouter ***** +type flowRouter struct { + validation + obj *otg.FlowRouter + marshaller marshalFlowRouter + unMarshaller unMarshalFlowRouter +} + +func NewFlowRouter() FlowRouter { + obj := flowRouter{obj: &otg.FlowRouter{}} + obj.setDefault() + return &obj +} + +func (obj *flowRouter) msg() *otg.FlowRouter { + return obj.obj +} + +func (obj *flowRouter) setMsg(msg *otg.FlowRouter) FlowRouter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRouter struct { + obj *flowRouter +} + +type marshalFlowRouter interface { + // ToProto marshals FlowRouter to protobuf object *otg.FlowRouter + ToProto() (*otg.FlowRouter, error) + // ToPbText marshals FlowRouter to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRouter to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRouter to JSON text + ToJson() (string, error) +} + +type unMarshalflowRouter struct { + obj *flowRouter +} + +type unMarshalFlowRouter interface { + // FromProto unmarshals FlowRouter from protobuf object *otg.FlowRouter + FromProto(msg *otg.FlowRouter) (FlowRouter, error) + // FromPbText unmarshals FlowRouter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRouter from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRouter from JSON text + FromJson(value string) error +} + +func (obj *flowRouter) Marshal() marshalFlowRouter { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRouter{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRouter) Unmarshal() unMarshalFlowRouter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRouter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRouter) ToProto() (*otg.FlowRouter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRouter) FromProto(msg *otg.FlowRouter) (FlowRouter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRouter) 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 *unMarshalflowRouter) 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 *marshalflowRouter) 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 *unMarshalflowRouter) 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 *marshalflowRouter) 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 *unMarshalflowRouter) 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 *flowRouter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRouter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRouter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRouter) Clone() (FlowRouter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRouter() + 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 +} + +// FlowRouter is a container for declaring a map of 1..n transmit devices to 1..n receive devices. This allows for a single flow to have different tx to rx device flows such as a single one to one map or a many to many map. +type FlowRouter interface { + Validation + // msg marshals FlowRouter to protobuf object *otg.FlowRouter + // and doesn't set defaults + msg() *otg.FlowRouter + // setMsg unmarshals FlowRouter from protobuf object *otg.FlowRouter + // and doesn't set defaults + setMsg(*otg.FlowRouter) FlowRouter + // provides marshal interface + Marshal() marshalFlowRouter + // provides unmarshal interface + Unmarshal() unMarshalFlowRouter + // validate validates FlowRouter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRouter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Mode returns FlowRouterModeEnum, set in FlowRouter + Mode() FlowRouterModeEnum + // SetMode assigns FlowRouterModeEnum provided by user to FlowRouter + SetMode(value FlowRouterModeEnum) FlowRouter + // HasMode checks if Mode has been set in FlowRouter + HasMode() bool + // TxNames returns []string, set in FlowRouter. + TxNames() []string + // SetTxNames assigns []string provided by user to FlowRouter + SetTxNames(value []string) FlowRouter + // RxNames returns []string, set in FlowRouter. + RxNames() []string + // SetRxNames assigns []string provided by user to FlowRouter + SetRxNames(value []string) FlowRouter +} + +type FlowRouterModeEnum string + +// Enum of Mode on FlowRouter +var FlowRouterMode = struct { + MESH FlowRouterModeEnum + ONE_TO_ONE FlowRouterModeEnum +}{ + MESH: FlowRouterModeEnum("mesh"), + ONE_TO_ONE: FlowRouterModeEnum("one_to_one"), +} + +func (obj *flowRouter) Mode() FlowRouterModeEnum { + return FlowRouterModeEnum(obj.obj.Mode.Enum().String()) +} + +// Determines the intent of creating traffic sub-flow(s) between the device +// endpoints, from the entities of tx_names to the entities of rx_names +// to derive how auto packet fields can be populated with +// the actual value(s) by the implementation. +// +// The one_to_one mode creates traffic sub-flow(s) between each device endpoint pair in +// tx_names to rx_names by index. +// The length of tx_names and rx_names MUST be the same. +// The same device name can be repeated multiple times in tx_names or rx_names, in any order to create desired meshing between device(s). +// For 2 values in tx_names and 2 values in rx_names, 2 device endpoint pairs would be generated (each pair representing a traffic sub-flow). +// +// The mesh mode creates traffic sub-flow(s) between each value in tx_names to +// every value in rx_names, forming the device endpoint pair(s). +// For 2 values in tx_names and 3 values in rx_names, generated device endpoint pairs would be 2x3=6. +// +// A generated device endpoint pair with same device endpoint name for both transmit & receive device endpoint MUST raise an error. +// +// Packet fields of type auto would be populated with one value for each device endpoint pair (representing the traffic sub-flow). +// The value would be determined considering transmit & receive device of the sub-flow. And the sequence of the populated value(s) +// would be in the order of generated device endpoint pair(s). +// If 2 device endpoint pairs are generated (based on mode, tx_names and rx_names), say (d1 to d3) and (d2 to d3), and ethernet.dst is set as auto, then +// the auto field would be replaced by the implementation with a sequence of 2 values, [v1,v2] where +// v1 is determined using context (d1,d3) and v2 using context (d2,d3). +// The final outcome is that packets generated on the wire will contain the values v1,v2,v1,... for ethernet.dst field. Any non-auto packet fields +// should be configured accordingly. For example, non-auto packet field ethernet.src can be configured with values [u1, u2], where +// u1 & u2 are source MAC of the connected interface of device d1 and d2 respectively. Then packets on the wire will contain correct value pairs +// (u1,v1),(u2,v2),(u1,v1),... for (ethernet.src,ethernet.dst) fields. +// Mode returns a string +func (obj *flowRouter) HasMode() bool { + return obj.obj.Mode != nil +} + +func (obj *flowRouter) SetMode(value FlowRouterModeEnum) FlowRouter { + intValue, ok := otg.FlowRouter_Mode_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRouterModeEnum", string(value))) + return obj + } + enumValue := otg.FlowRouter_Mode_Enum(intValue) + obj.obj.Mode = &enumValue + + return obj +} + +// TBD +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Bgp.V4RouteRange/properties/name +// - /components/schemas/Bgp.V6RouteRange/properties/name +// - /components/schemas/Bgp.CMacIpRange/properties/name +// - /components/schemas/Rsvp.LspIpv4Interface.P2PIngressIpv4Lsp/properties/name +// - /components/schemas/Isis.V4RouteRange/properties/name +// - /components/schemas/Isis.V6RouteRange/properties/name +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Bgp.V4RouteRange/properties/name +// - /components/schemas/Bgp.V6RouteRange/properties/name +// - /components/schemas/Bgp.CMacIpRange/properties/name +// - /components/schemas/Rsvp.LspIpv4Interface.P2PIngressIpv4Lsp/properties/name +// - /components/schemas/Isis.V4RouteRange/properties/name +// - /components/schemas/Isis.V6RouteRange/properties/name +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// TxNames returns a []string +func (obj *flowRouter) TxNames() []string { + if obj.obj.TxNames == nil { + obj.obj.TxNames = make([]string, 0) + } + return obj.obj.TxNames +} + +// TBD +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Bgp.V4RouteRange/properties/name +// - /components/schemas/Bgp.V6RouteRange/properties/name +// - /components/schemas/Bgp.CMacIpRange/properties/name +// - /components/schemas/Rsvp.LspIpv4Interface.P2PIngressIpv4Lsp/properties/name +// - /components/schemas/Isis.V4RouteRange/properties/name +// - /components/schemas/Isis.V6RouteRange/properties/name +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Bgp.V4RouteRange/properties/name +// - /components/schemas/Bgp.V6RouteRange/properties/name +// - /components/schemas/Bgp.CMacIpRange/properties/name +// - /components/schemas/Rsvp.LspIpv4Interface.P2PIngressIpv4Lsp/properties/name +// - /components/schemas/Isis.V4RouteRange/properties/name +// - /components/schemas/Isis.V6RouteRange/properties/name +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// SetTxNames sets the []string value in the FlowRouter object +func (obj *flowRouter) SetTxNames(value []string) FlowRouter { + + if obj.obj.TxNames == nil { + obj.obj.TxNames = make([]string, 0) + } + obj.obj.TxNames = value + + return obj +} + +// TBD +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Bgp.V4RouteRange/properties/name +// - /components/schemas/Bgp.V6RouteRange/properties/name +// - /components/schemas/Bgp.CMacIpRange/properties/name +// - /components/schemas/Rsvp.LspIpv4Interface.P2PEgressIpv4Lsp/properties/name +// - /components/schemas/Isis.V4RouteRange/properties/name +// - /components/schemas/Isis.V6RouteRange/properties/name +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Bgp.V4RouteRange/properties/name +// - /components/schemas/Bgp.V6RouteRange/properties/name +// - /components/schemas/Bgp.CMacIpRange/properties/name +// - /components/schemas/Rsvp.LspIpv4Interface.P2PEgressIpv4Lsp/properties/name +// - /components/schemas/Isis.V4RouteRange/properties/name +// - /components/schemas/Isis.V6RouteRange/properties/name +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// RxNames returns a []string +func (obj *flowRouter) RxNames() []string { + if obj.obj.RxNames == nil { + obj.obj.RxNames = make([]string, 0) + } + return obj.obj.RxNames +} + +// TBD +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Bgp.V4RouteRange/properties/name +// - /components/schemas/Bgp.V6RouteRange/properties/name +// - /components/schemas/Bgp.CMacIpRange/properties/name +// - /components/schemas/Rsvp.LspIpv4Interface.P2PEgressIpv4Lsp/properties/name +// - /components/schemas/Isis.V4RouteRange/properties/name +// - /components/schemas/Isis.V6RouteRange/properties/name +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Bgp.V4RouteRange/properties/name +// - /components/schemas/Bgp.V6RouteRange/properties/name +// - /components/schemas/Bgp.CMacIpRange/properties/name +// - /components/schemas/Rsvp.LspIpv4Interface.P2PEgressIpv4Lsp/properties/name +// - /components/schemas/Isis.V4RouteRange/properties/name +// - /components/schemas/Isis.V6RouteRange/properties/name +// - /components/schemas/Device.Dhcpv4client/properties/name +// +// SetRxNames sets the []string value in the FlowRouter object +func (obj *flowRouter) SetRxNames(value []string) FlowRouter { + + if obj.obj.RxNames == nil { + obj.obj.RxNames = make([]string, 0) + } + obj.obj.RxNames = value + + return obj +} + +func (obj *flowRouter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *flowRouter) setDefault() { + if obj.obj.Mode == nil { + obj.SetMode(FlowRouterMode.MESH) + + } + +} diff --git a/gosnappi/flow_rsvp.go b/gosnappi/flow_rsvp.go new file mode 100644 index 00000000..bef09bd4 --- /dev/null +++ b/gosnappi/flow_rsvp.go @@ -0,0 +1,585 @@ +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" +) + +// ***** FlowRsvp ***** +type flowRsvp struct { + validation + obj *otg.FlowRsvp + marshaller marshalFlowRsvp + unMarshaller unMarshalFlowRsvp + rsvpChecksumHolder PatternFlowRsvpRsvpChecksum + timeToLiveHolder PatternFlowRsvpTimeToLive + reservedHolder PatternFlowRsvpReserved + rsvpLengthHolder FlowRSVPLength + messageTypeHolder FlowRSVPMessage +} + +func NewFlowRsvp() FlowRsvp { + obj := flowRsvp{obj: &otg.FlowRsvp{}} + obj.setDefault() + return &obj +} + +func (obj *flowRsvp) msg() *otg.FlowRsvp { + return obj.obj +} + +func (obj *flowRsvp) setMsg(msg *otg.FlowRsvp) FlowRsvp { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRsvp struct { + obj *flowRsvp +} + +type marshalFlowRsvp interface { + // ToProto marshals FlowRsvp to protobuf object *otg.FlowRsvp + ToProto() (*otg.FlowRsvp, error) + // ToPbText marshals FlowRsvp to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRsvp to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRsvp to JSON text + ToJson() (string, error) +} + +type unMarshalflowRsvp struct { + obj *flowRsvp +} + +type unMarshalFlowRsvp interface { + // FromProto unmarshals FlowRsvp from protobuf object *otg.FlowRsvp + FromProto(msg *otg.FlowRsvp) (FlowRsvp, error) + // FromPbText unmarshals FlowRsvp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRsvp from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRsvp from JSON text + FromJson(value string) error +} + +func (obj *flowRsvp) Marshal() marshalFlowRsvp { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRsvp{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRsvp) Unmarshal() unMarshalFlowRsvp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRsvp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRsvp) ToProto() (*otg.FlowRsvp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRsvp) FromProto(msg *otg.FlowRsvp) (FlowRsvp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRsvp) 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 *unMarshalflowRsvp) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRsvp) 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 *unMarshalflowRsvp) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRsvp) 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 *unMarshalflowRsvp) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRsvp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRsvp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRsvp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRsvp) Clone() (FlowRsvp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRsvp() + 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 +} + +func (obj *flowRsvp) setNil() { + obj.rsvpChecksumHolder = nil + obj.timeToLiveHolder = nil + obj.reservedHolder = nil + obj.rsvpLengthHolder = nil + obj.messageTypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRsvp is rSVP packet header as defined in RFC2205 and RFC3209. Currently only supported message type is "Path" with mandatory objects and sub-objects. +type FlowRsvp interface { + Validation + // msg marshals FlowRsvp to protobuf object *otg.FlowRsvp + // and doesn't set defaults + msg() *otg.FlowRsvp + // setMsg unmarshals FlowRsvp from protobuf object *otg.FlowRsvp + // and doesn't set defaults + setMsg(*otg.FlowRsvp) FlowRsvp + // provides marshal interface + Marshal() marshalFlowRsvp + // provides unmarshal interface + Unmarshal() unMarshalFlowRsvp + // validate validates FlowRsvp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRsvp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Version returns uint32, set in FlowRsvp. + Version() uint32 + // SetVersion assigns uint32 provided by user to FlowRsvp + SetVersion(value uint32) FlowRsvp + // HasVersion checks if Version has been set in FlowRsvp + HasVersion() bool + // Flag returns FlowRsvpFlagEnum, set in FlowRsvp + Flag() FlowRsvpFlagEnum + // SetFlag assigns FlowRsvpFlagEnum provided by user to FlowRsvp + SetFlag(value FlowRsvpFlagEnum) FlowRsvp + // HasFlag checks if Flag has been set in FlowRsvp + HasFlag() bool + // RsvpChecksum returns PatternFlowRsvpRsvpChecksum, set in FlowRsvp. + // PatternFlowRsvpRsvpChecksum is the one's complement of the one's complement sum of the message, with the checksum field replaced by zero for the purpose of computing the checksum. An all-zero value means that no checksum was transmitted. + RsvpChecksum() PatternFlowRsvpRsvpChecksum + // SetRsvpChecksum assigns PatternFlowRsvpRsvpChecksum provided by user to FlowRsvp. + // PatternFlowRsvpRsvpChecksum is the one's complement of the one's complement sum of the message, with the checksum field replaced by zero for the purpose of computing the checksum. An all-zero value means that no checksum was transmitted. + SetRsvpChecksum(value PatternFlowRsvpRsvpChecksum) FlowRsvp + // HasRsvpChecksum checks if RsvpChecksum has been set in FlowRsvp + HasRsvpChecksum() bool + // TimeToLive returns PatternFlowRsvpTimeToLive, set in FlowRsvp. + // PatternFlowRsvpTimeToLive is the IP time-to-live(TTL) value with which the message was sent. + TimeToLive() PatternFlowRsvpTimeToLive + // SetTimeToLive assigns PatternFlowRsvpTimeToLive provided by user to FlowRsvp. + // PatternFlowRsvpTimeToLive is the IP time-to-live(TTL) value with which the message was sent. + SetTimeToLive(value PatternFlowRsvpTimeToLive) FlowRsvp + // HasTimeToLive checks if TimeToLive has been set in FlowRsvp + HasTimeToLive() bool + // Reserved returns PatternFlowRsvpReserved, set in FlowRsvp. + // PatternFlowRsvpReserved is reserved + Reserved() PatternFlowRsvpReserved + // SetReserved assigns PatternFlowRsvpReserved provided by user to FlowRsvp. + // PatternFlowRsvpReserved is reserved + SetReserved(value PatternFlowRsvpReserved) FlowRsvp + // HasReserved checks if Reserved has been set in FlowRsvp + HasReserved() bool + // RsvpLength returns FlowRSVPLength, set in FlowRsvp. + // FlowRSVPLength is description is TBD + RsvpLength() FlowRSVPLength + // SetRsvpLength assigns FlowRSVPLength provided by user to FlowRsvp. + // FlowRSVPLength is description is TBD + SetRsvpLength(value FlowRSVPLength) FlowRsvp + // HasRsvpLength checks if RsvpLength has been set in FlowRsvp + HasRsvpLength() bool + // MessageType returns FlowRSVPMessage, set in FlowRsvp. + // FlowRSVPMessage is description is TBD + MessageType() FlowRSVPMessage + // SetMessageType assigns FlowRSVPMessage provided by user to FlowRsvp. + // FlowRSVPMessage is description is TBD + SetMessageType(value FlowRSVPMessage) FlowRsvp + // HasMessageType checks if MessageType has been set in FlowRsvp + HasMessageType() bool + setNil() +} + +// RSVP Protocol Version. +// Version returns a uint32 +func (obj *flowRsvp) Version() uint32 { + + return *obj.obj.Version + +} + +// RSVP Protocol Version. +// Version returns a uint32 +func (obj *flowRsvp) HasVersion() bool { + return obj.obj.Version != nil +} + +// RSVP Protocol Version. +// SetVersion sets the uint32 value in the FlowRsvp object +func (obj *flowRsvp) SetVersion(value uint32) FlowRsvp { + + obj.obj.Version = &value + return obj +} + +type FlowRsvpFlagEnum string + +// Enum of Flag on FlowRsvp +var FlowRsvpFlag = struct { + NOT_REFRESH_REDUCTION_CAPABLE FlowRsvpFlagEnum + REFRESH_REDUCTION_CAPABLE FlowRsvpFlagEnum +}{ + NOT_REFRESH_REDUCTION_CAPABLE: FlowRsvpFlagEnum("not_refresh_reduction_capable"), + REFRESH_REDUCTION_CAPABLE: FlowRsvpFlagEnum("refresh_reduction_capable"), +} + +func (obj *flowRsvp) Flag() FlowRsvpFlagEnum { + return FlowRsvpFlagEnum(obj.obj.Flag.Enum().String()) +} + +// Flag, 0x01-0x08: Reserved. +// Flag returns a string +func (obj *flowRsvp) HasFlag() bool { + return obj.obj.Flag != nil +} + +func (obj *flowRsvp) SetFlag(value FlowRsvpFlagEnum) FlowRsvp { + intValue, ok := otg.FlowRsvp_Flag_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRsvpFlagEnum", string(value))) + return obj + } + enumValue := otg.FlowRsvp_Flag_Enum(intValue) + obj.obj.Flag = &enumValue + + return obj +} + +// description is TBD +// RsvpChecksum returns a PatternFlowRsvpRsvpChecksum +func (obj *flowRsvp) RsvpChecksum() PatternFlowRsvpRsvpChecksum { + if obj.obj.RsvpChecksum == nil { + obj.obj.RsvpChecksum = NewPatternFlowRsvpRsvpChecksum().msg() + } + if obj.rsvpChecksumHolder == nil { + obj.rsvpChecksumHolder = &patternFlowRsvpRsvpChecksum{obj: obj.obj.RsvpChecksum} + } + return obj.rsvpChecksumHolder +} + +// description is TBD +// RsvpChecksum returns a PatternFlowRsvpRsvpChecksum +func (obj *flowRsvp) HasRsvpChecksum() bool { + return obj.obj.RsvpChecksum != nil +} + +// description is TBD +// SetRsvpChecksum sets the PatternFlowRsvpRsvpChecksum value in the FlowRsvp object +func (obj *flowRsvp) SetRsvpChecksum(value PatternFlowRsvpRsvpChecksum) FlowRsvp { + + obj.rsvpChecksumHolder = nil + obj.obj.RsvpChecksum = value.msg() + + return obj +} + +// description is TBD +// TimeToLive returns a PatternFlowRsvpTimeToLive +func (obj *flowRsvp) TimeToLive() PatternFlowRsvpTimeToLive { + if obj.obj.TimeToLive == nil { + obj.obj.TimeToLive = NewPatternFlowRsvpTimeToLive().msg() + } + if obj.timeToLiveHolder == nil { + obj.timeToLiveHolder = &patternFlowRsvpTimeToLive{obj: obj.obj.TimeToLive} + } + return obj.timeToLiveHolder +} + +// description is TBD +// TimeToLive returns a PatternFlowRsvpTimeToLive +func (obj *flowRsvp) HasTimeToLive() bool { + return obj.obj.TimeToLive != nil +} + +// description is TBD +// SetTimeToLive sets the PatternFlowRsvpTimeToLive value in the FlowRsvp object +func (obj *flowRsvp) SetTimeToLive(value PatternFlowRsvpTimeToLive) FlowRsvp { + + obj.timeToLiveHolder = nil + obj.obj.TimeToLive = value.msg() + + return obj +} + +// description is TBD +// Reserved returns a PatternFlowRsvpReserved +func (obj *flowRsvp) Reserved() PatternFlowRsvpReserved { + if obj.obj.Reserved == nil { + obj.obj.Reserved = NewPatternFlowRsvpReserved().msg() + } + if obj.reservedHolder == nil { + obj.reservedHolder = &patternFlowRsvpReserved{obj: obj.obj.Reserved} + } + return obj.reservedHolder +} + +// description is TBD +// Reserved returns a PatternFlowRsvpReserved +func (obj *flowRsvp) HasReserved() bool { + return obj.obj.Reserved != nil +} + +// description is TBD +// SetReserved sets the PatternFlowRsvpReserved value in the FlowRsvp object +func (obj *flowRsvp) SetReserved(value PatternFlowRsvpReserved) FlowRsvp { + + obj.reservedHolder = nil + obj.obj.Reserved = value.msg() + + return obj +} + +// The sum of the lengths of the common header and all objects included in the message. +// RsvpLength returns a FlowRSVPLength +func (obj *flowRsvp) RsvpLength() FlowRSVPLength { + if obj.obj.RsvpLength == nil { + obj.obj.RsvpLength = NewFlowRSVPLength().msg() + } + if obj.rsvpLengthHolder == nil { + obj.rsvpLengthHolder = &flowRSVPLength{obj: obj.obj.RsvpLength} + } + return obj.rsvpLengthHolder +} + +// The sum of the lengths of the common header and all objects included in the message. +// RsvpLength returns a FlowRSVPLength +func (obj *flowRsvp) HasRsvpLength() bool { + return obj.obj.RsvpLength != nil +} + +// The sum of the lengths of the common header and all objects included in the message. +// SetRsvpLength sets the FlowRSVPLength value in the FlowRsvp object +func (obj *flowRsvp) SetRsvpLength(value FlowRSVPLength) FlowRsvp { + + obj.rsvpLengthHolder = nil + obj.obj.RsvpLength = value.msg() + + return obj +} + +// An 8-bit number that identifies the function of the RSVP message. There are aound 20 message types defined in https://www.iana.org/assignments/rsvp-parameters/rsvp-parameters.xhtml#rsvp-parameters-2 . Among these presently supported is "Path"(value: 1) message type. +// MessageType returns a FlowRSVPMessage +func (obj *flowRsvp) MessageType() FlowRSVPMessage { + if obj.obj.MessageType == nil { + obj.obj.MessageType = NewFlowRSVPMessage().msg() + } + if obj.messageTypeHolder == nil { + obj.messageTypeHolder = &flowRSVPMessage{obj: obj.obj.MessageType} + } + return obj.messageTypeHolder +} + +// An 8-bit number that identifies the function of the RSVP message. There are aound 20 message types defined in https://www.iana.org/assignments/rsvp-parameters/rsvp-parameters.xhtml#rsvp-parameters-2 . Among these presently supported is "Path"(value: 1) message type. +// MessageType returns a FlowRSVPMessage +func (obj *flowRsvp) HasMessageType() bool { + return obj.obj.MessageType != nil +} + +// An 8-bit number that identifies the function of the RSVP message. There are aound 20 message types defined in https://www.iana.org/assignments/rsvp-parameters/rsvp-parameters.xhtml#rsvp-parameters-2 . Among these presently supported is "Path"(value: 1) message type. +// SetMessageType sets the FlowRSVPMessage value in the FlowRsvp object +func (obj *flowRsvp) SetMessageType(value FlowRSVPMessage) FlowRsvp { + + obj.messageTypeHolder = nil + obj.obj.MessageType = value.msg() + + return obj +} + +func (obj *flowRsvp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Version != nil { + + if *obj.obj.Version > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowRsvp.Version <= 15 but Got %d", *obj.obj.Version)) + } + + } + + if obj.obj.RsvpChecksum != nil { + + obj.RsvpChecksum().validateObj(vObj, set_default) + } + + if obj.obj.TimeToLive != nil { + + obj.TimeToLive().validateObj(vObj, set_default) + } + + if obj.obj.Reserved != nil { + + obj.Reserved().validateObj(vObj, set_default) + } + + if obj.obj.RsvpLength != nil { + + obj.RsvpLength().validateObj(vObj, set_default) + } + + if obj.obj.MessageType != nil { + + obj.MessageType().validateObj(vObj, set_default) + } + +} + +func (obj *flowRsvp) setDefault() { + if obj.obj.Version == nil { + obj.SetVersion(1) + } + if obj.obj.Flag == nil { + obj.SetFlag(FlowRsvpFlag.NOT_REFRESH_REDUCTION_CAPABLE) + + } + +} diff --git a/gosnappi/flow_rsvp_explicit_route_as_number_length.go b/gosnappi/flow_rsvp_explicit_route_as_number_length.go new file mode 100644 index 00000000..67a9d89f --- /dev/null +++ b/gosnappi/flow_rsvp_explicit_route_as_number_length.go @@ -0,0 +1,423 @@ +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" +) + +// ***** FlowRSVPExplicitRouteASNumberLength ***** +type flowRSVPExplicitRouteASNumberLength struct { + validation + obj *otg.FlowRSVPExplicitRouteASNumberLength + marshaller marshalFlowRSVPExplicitRouteASNumberLength + unMarshaller unMarshalFlowRSVPExplicitRouteASNumberLength +} + +func NewFlowRSVPExplicitRouteASNumberLength() FlowRSVPExplicitRouteASNumberLength { + obj := flowRSVPExplicitRouteASNumberLength{obj: &otg.FlowRSVPExplicitRouteASNumberLength{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPExplicitRouteASNumberLength) msg() *otg.FlowRSVPExplicitRouteASNumberLength { + return obj.obj +} + +func (obj *flowRSVPExplicitRouteASNumberLength) setMsg(msg *otg.FlowRSVPExplicitRouteASNumberLength) FlowRSVPExplicitRouteASNumberLength { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPExplicitRouteASNumberLength struct { + obj *flowRSVPExplicitRouteASNumberLength +} + +type marshalFlowRSVPExplicitRouteASNumberLength interface { + // ToProto marshals FlowRSVPExplicitRouteASNumberLength to protobuf object *otg.FlowRSVPExplicitRouteASNumberLength + ToProto() (*otg.FlowRSVPExplicitRouteASNumberLength, error) + // ToPbText marshals FlowRSVPExplicitRouteASNumberLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPExplicitRouteASNumberLength to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPExplicitRouteASNumberLength to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPExplicitRouteASNumberLength struct { + obj *flowRSVPExplicitRouteASNumberLength +} + +type unMarshalFlowRSVPExplicitRouteASNumberLength interface { + // FromProto unmarshals FlowRSVPExplicitRouteASNumberLength from protobuf object *otg.FlowRSVPExplicitRouteASNumberLength + FromProto(msg *otg.FlowRSVPExplicitRouteASNumberLength) (FlowRSVPExplicitRouteASNumberLength, error) + // FromPbText unmarshals FlowRSVPExplicitRouteASNumberLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPExplicitRouteASNumberLength from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPExplicitRouteASNumberLength from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPExplicitRouteASNumberLength) Marshal() marshalFlowRSVPExplicitRouteASNumberLength { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPExplicitRouteASNumberLength{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPExplicitRouteASNumberLength) Unmarshal() unMarshalFlowRSVPExplicitRouteASNumberLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPExplicitRouteASNumberLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPExplicitRouteASNumberLength) ToProto() (*otg.FlowRSVPExplicitRouteASNumberLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPExplicitRouteASNumberLength) FromProto(msg *otg.FlowRSVPExplicitRouteASNumberLength) (FlowRSVPExplicitRouteASNumberLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPExplicitRouteASNumberLength) 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 *unMarshalflowRSVPExplicitRouteASNumberLength) 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 *marshalflowRSVPExplicitRouteASNumberLength) 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 *unMarshalflowRSVPExplicitRouteASNumberLength) 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 *marshalflowRSVPExplicitRouteASNumberLength) 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 *unMarshalflowRSVPExplicitRouteASNumberLength) 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 *flowRSVPExplicitRouteASNumberLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPExplicitRouteASNumberLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPExplicitRouteASNumberLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPExplicitRouteASNumberLength) Clone() (FlowRSVPExplicitRouteASNumberLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPExplicitRouteASNumberLength() + 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 +} + +// FlowRSVPExplicitRouteASNumberLength is description is TBD +type FlowRSVPExplicitRouteASNumberLength interface { + Validation + // msg marshals FlowRSVPExplicitRouteASNumberLength to protobuf object *otg.FlowRSVPExplicitRouteASNumberLength + // and doesn't set defaults + msg() *otg.FlowRSVPExplicitRouteASNumberLength + // setMsg unmarshals FlowRSVPExplicitRouteASNumberLength from protobuf object *otg.FlowRSVPExplicitRouteASNumberLength + // and doesn't set defaults + setMsg(*otg.FlowRSVPExplicitRouteASNumberLength) FlowRSVPExplicitRouteASNumberLength + // provides marshal interface + Marshal() marshalFlowRSVPExplicitRouteASNumberLength + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPExplicitRouteASNumberLength + // validate validates FlowRSVPExplicitRouteASNumberLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPExplicitRouteASNumberLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPExplicitRouteASNumberLengthChoiceEnum, set in FlowRSVPExplicitRouteASNumberLength + Choice() FlowRSVPExplicitRouteASNumberLengthChoiceEnum + // setChoice assigns FlowRSVPExplicitRouteASNumberLengthChoiceEnum provided by user to FlowRSVPExplicitRouteASNumberLength + setChoice(value FlowRSVPExplicitRouteASNumberLengthChoiceEnum) FlowRSVPExplicitRouteASNumberLength + // HasChoice checks if Choice has been set in FlowRSVPExplicitRouteASNumberLength + HasChoice() bool + // Auto returns uint32, set in FlowRSVPExplicitRouteASNumberLength. + Auto() uint32 + // HasAuto checks if Auto has been set in FlowRSVPExplicitRouteASNumberLength + HasAuto() bool + // Value returns uint32, set in FlowRSVPExplicitRouteASNumberLength. + Value() uint32 + // SetValue assigns uint32 provided by user to FlowRSVPExplicitRouteASNumberLength + SetValue(value uint32) FlowRSVPExplicitRouteASNumberLength + // HasValue checks if Value has been set in FlowRSVPExplicitRouteASNumberLength + HasValue() bool +} + +type FlowRSVPExplicitRouteASNumberLengthChoiceEnum string + +// Enum of Choice on FlowRSVPExplicitRouteASNumberLength +var FlowRSVPExplicitRouteASNumberLengthChoice = struct { + AUTO FlowRSVPExplicitRouteASNumberLengthChoiceEnum + VALUE FlowRSVPExplicitRouteASNumberLengthChoiceEnum +}{ + AUTO: FlowRSVPExplicitRouteASNumberLengthChoiceEnum("auto"), + VALUE: FlowRSVPExplicitRouteASNumberLengthChoiceEnum("value"), +} + +func (obj *flowRSVPExplicitRouteASNumberLength) Choice() FlowRSVPExplicitRouteASNumberLengthChoiceEnum { + return FlowRSVPExplicitRouteASNumberLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// auto or configured value. +// Choice returns a string +func (obj *flowRSVPExplicitRouteASNumberLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPExplicitRouteASNumberLength) setChoice(value FlowRSVPExplicitRouteASNumberLengthChoiceEnum) FlowRSVPExplicitRouteASNumberLength { + intValue, ok := otg.FlowRSVPExplicitRouteASNumberLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPExplicitRouteASNumberLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPExplicitRouteASNumberLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Value = nil + obj.obj.Auto = nil + + if value == FlowRSVPExplicitRouteASNumberLengthChoice.AUTO { + defaultValue := uint32(4) + obj.obj.Auto = &defaultValue + } + + if value == FlowRSVPExplicitRouteASNumberLengthChoice.VALUE { + defaultValue := uint32(4) + obj.obj.Value = &defaultValue + } + + return obj +} + +// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. +// Auto returns a uint32 +func (obj *flowRSVPExplicitRouteASNumberLength) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(FlowRSVPExplicitRouteASNumberLengthChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. +// Auto returns a uint32 +func (obj *flowRSVPExplicitRouteASNumberLength) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Value returns a uint32 +func (obj *flowRSVPExplicitRouteASNumberLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(FlowRSVPExplicitRouteASNumberLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *flowRSVPExplicitRouteASNumberLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the FlowRSVPExplicitRouteASNumberLength object +func (obj *flowRSVPExplicitRouteASNumberLength) SetValue(value uint32) FlowRSVPExplicitRouteASNumberLength { + obj.setChoice(FlowRSVPExplicitRouteASNumberLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +func (obj *flowRSVPExplicitRouteASNumberLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowRSVPExplicitRouteASNumberLength.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + +} + +func (obj *flowRSVPExplicitRouteASNumberLength) setDefault() { + var choices_set int = 0 + var choice FlowRSVPExplicitRouteASNumberLengthChoiceEnum + + if obj.obj.Auto != nil { + choices_set += 1 + choice = FlowRSVPExplicitRouteASNumberLengthChoice.AUTO + } + + if obj.obj.Value != nil { + choices_set += 1 + choice = FlowRSVPExplicitRouteASNumberLengthChoice.VALUE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPExplicitRouteASNumberLengthChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPExplicitRouteASNumberLength") + } + } else { + intVal := otg.FlowRSVPExplicitRouteASNumberLength_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPExplicitRouteASNumberLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_explicit_route_length.go b/gosnappi/flow_rsvp_explicit_route_length.go new file mode 100644 index 00000000..9a28e4e5 --- /dev/null +++ b/gosnappi/flow_rsvp_explicit_route_length.go @@ -0,0 +1,423 @@ +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" +) + +// ***** FlowRSVPExplicitRouteLength ***** +type flowRSVPExplicitRouteLength struct { + validation + obj *otg.FlowRSVPExplicitRouteLength + marshaller marshalFlowRSVPExplicitRouteLength + unMarshaller unMarshalFlowRSVPExplicitRouteLength +} + +func NewFlowRSVPExplicitRouteLength() FlowRSVPExplicitRouteLength { + obj := flowRSVPExplicitRouteLength{obj: &otg.FlowRSVPExplicitRouteLength{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPExplicitRouteLength) msg() *otg.FlowRSVPExplicitRouteLength { + return obj.obj +} + +func (obj *flowRSVPExplicitRouteLength) setMsg(msg *otg.FlowRSVPExplicitRouteLength) FlowRSVPExplicitRouteLength { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPExplicitRouteLength struct { + obj *flowRSVPExplicitRouteLength +} + +type marshalFlowRSVPExplicitRouteLength interface { + // ToProto marshals FlowRSVPExplicitRouteLength to protobuf object *otg.FlowRSVPExplicitRouteLength + ToProto() (*otg.FlowRSVPExplicitRouteLength, error) + // ToPbText marshals FlowRSVPExplicitRouteLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPExplicitRouteLength to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPExplicitRouteLength to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPExplicitRouteLength struct { + obj *flowRSVPExplicitRouteLength +} + +type unMarshalFlowRSVPExplicitRouteLength interface { + // FromProto unmarshals FlowRSVPExplicitRouteLength from protobuf object *otg.FlowRSVPExplicitRouteLength + FromProto(msg *otg.FlowRSVPExplicitRouteLength) (FlowRSVPExplicitRouteLength, error) + // FromPbText unmarshals FlowRSVPExplicitRouteLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPExplicitRouteLength from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPExplicitRouteLength from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPExplicitRouteLength) Marshal() marshalFlowRSVPExplicitRouteLength { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPExplicitRouteLength{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPExplicitRouteLength) Unmarshal() unMarshalFlowRSVPExplicitRouteLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPExplicitRouteLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPExplicitRouteLength) ToProto() (*otg.FlowRSVPExplicitRouteLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPExplicitRouteLength) FromProto(msg *otg.FlowRSVPExplicitRouteLength) (FlowRSVPExplicitRouteLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPExplicitRouteLength) 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 *unMarshalflowRSVPExplicitRouteLength) 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 *marshalflowRSVPExplicitRouteLength) 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 *unMarshalflowRSVPExplicitRouteLength) 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 *marshalflowRSVPExplicitRouteLength) 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 *unMarshalflowRSVPExplicitRouteLength) 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 *flowRSVPExplicitRouteLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPExplicitRouteLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPExplicitRouteLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPExplicitRouteLength) Clone() (FlowRSVPExplicitRouteLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPExplicitRouteLength() + 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 +} + +// FlowRSVPExplicitRouteLength is description is TBD +type FlowRSVPExplicitRouteLength interface { + Validation + // msg marshals FlowRSVPExplicitRouteLength to protobuf object *otg.FlowRSVPExplicitRouteLength + // and doesn't set defaults + msg() *otg.FlowRSVPExplicitRouteLength + // setMsg unmarshals FlowRSVPExplicitRouteLength from protobuf object *otg.FlowRSVPExplicitRouteLength + // and doesn't set defaults + setMsg(*otg.FlowRSVPExplicitRouteLength) FlowRSVPExplicitRouteLength + // provides marshal interface + Marshal() marshalFlowRSVPExplicitRouteLength + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPExplicitRouteLength + // validate validates FlowRSVPExplicitRouteLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPExplicitRouteLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPExplicitRouteLengthChoiceEnum, set in FlowRSVPExplicitRouteLength + Choice() FlowRSVPExplicitRouteLengthChoiceEnum + // setChoice assigns FlowRSVPExplicitRouteLengthChoiceEnum provided by user to FlowRSVPExplicitRouteLength + setChoice(value FlowRSVPExplicitRouteLengthChoiceEnum) FlowRSVPExplicitRouteLength + // HasChoice checks if Choice has been set in FlowRSVPExplicitRouteLength + HasChoice() bool + // Auto returns uint32, set in FlowRSVPExplicitRouteLength. + Auto() uint32 + // HasAuto checks if Auto has been set in FlowRSVPExplicitRouteLength + HasAuto() bool + // Value returns uint32, set in FlowRSVPExplicitRouteLength. + Value() uint32 + // SetValue assigns uint32 provided by user to FlowRSVPExplicitRouteLength + SetValue(value uint32) FlowRSVPExplicitRouteLength + // HasValue checks if Value has been set in FlowRSVPExplicitRouteLength + HasValue() bool +} + +type FlowRSVPExplicitRouteLengthChoiceEnum string + +// Enum of Choice on FlowRSVPExplicitRouteLength +var FlowRSVPExplicitRouteLengthChoice = struct { + AUTO FlowRSVPExplicitRouteLengthChoiceEnum + VALUE FlowRSVPExplicitRouteLengthChoiceEnum +}{ + AUTO: FlowRSVPExplicitRouteLengthChoiceEnum("auto"), + VALUE: FlowRSVPExplicitRouteLengthChoiceEnum("value"), +} + +func (obj *flowRSVPExplicitRouteLength) Choice() FlowRSVPExplicitRouteLengthChoiceEnum { + return FlowRSVPExplicitRouteLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// auto or configured value. +// Choice returns a string +func (obj *flowRSVPExplicitRouteLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPExplicitRouteLength) setChoice(value FlowRSVPExplicitRouteLengthChoiceEnum) FlowRSVPExplicitRouteLength { + intValue, ok := otg.FlowRSVPExplicitRouteLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPExplicitRouteLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPExplicitRouteLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Value = nil + obj.obj.Auto = nil + + if value == FlowRSVPExplicitRouteLengthChoice.AUTO { + defaultValue := uint32(8) + obj.obj.Auto = &defaultValue + } + + if value == FlowRSVPExplicitRouteLengthChoice.VALUE { + defaultValue := uint32(8) + obj.obj.Value = &defaultValue + } + + return obj +} + +// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. +// Auto returns a uint32 +func (obj *flowRSVPExplicitRouteLength) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(FlowRSVPExplicitRouteLengthChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. +// Auto returns a uint32 +func (obj *flowRSVPExplicitRouteLength) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Value returns a uint32 +func (obj *flowRSVPExplicitRouteLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(FlowRSVPExplicitRouteLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *flowRSVPExplicitRouteLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the FlowRSVPExplicitRouteLength object +func (obj *flowRSVPExplicitRouteLength) SetValue(value uint32) FlowRSVPExplicitRouteLength { + obj.setChoice(FlowRSVPExplicitRouteLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +func (obj *flowRSVPExplicitRouteLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowRSVPExplicitRouteLength.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + +} + +func (obj *flowRSVPExplicitRouteLength) setDefault() { + var choices_set int = 0 + var choice FlowRSVPExplicitRouteLengthChoiceEnum + + if obj.obj.Auto != nil { + choices_set += 1 + choice = FlowRSVPExplicitRouteLengthChoice.AUTO + } + + if obj.obj.Value != nil { + choices_set += 1 + choice = FlowRSVPExplicitRouteLengthChoice.VALUE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPExplicitRouteLengthChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPExplicitRouteLength") + } + } else { + intVal := otg.FlowRSVPExplicitRouteLength_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPExplicitRouteLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_length.go b/gosnappi/flow_rsvp_length.go new file mode 100644 index 00000000..3fc19b26 --- /dev/null +++ b/gosnappi/flow_rsvp_length.go @@ -0,0 +1,423 @@ +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" +) + +// ***** FlowRSVPLength ***** +type flowRSVPLength struct { + validation + obj *otg.FlowRSVPLength + marshaller marshalFlowRSVPLength + unMarshaller unMarshalFlowRSVPLength +} + +func NewFlowRSVPLength() FlowRSVPLength { + obj := flowRSVPLength{obj: &otg.FlowRSVPLength{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPLength) msg() *otg.FlowRSVPLength { + return obj.obj +} + +func (obj *flowRSVPLength) setMsg(msg *otg.FlowRSVPLength) FlowRSVPLength { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPLength struct { + obj *flowRSVPLength +} + +type marshalFlowRSVPLength interface { + // ToProto marshals FlowRSVPLength to protobuf object *otg.FlowRSVPLength + ToProto() (*otg.FlowRSVPLength, error) + // ToPbText marshals FlowRSVPLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPLength to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPLength to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPLength struct { + obj *flowRSVPLength +} + +type unMarshalFlowRSVPLength interface { + // FromProto unmarshals FlowRSVPLength from protobuf object *otg.FlowRSVPLength + FromProto(msg *otg.FlowRSVPLength) (FlowRSVPLength, error) + // FromPbText unmarshals FlowRSVPLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPLength from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPLength from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPLength) Marshal() marshalFlowRSVPLength { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPLength{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPLength) Unmarshal() unMarshalFlowRSVPLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPLength) ToProto() (*otg.FlowRSVPLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPLength) FromProto(msg *otg.FlowRSVPLength) (FlowRSVPLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPLength) 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 *unMarshalflowRSVPLength) 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 *marshalflowRSVPLength) 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 *unMarshalflowRSVPLength) 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 *marshalflowRSVPLength) 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 *unMarshalflowRSVPLength) 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 *flowRSVPLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPLength) Clone() (FlowRSVPLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPLength() + 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 +} + +// FlowRSVPLength is description is TBD +type FlowRSVPLength interface { + Validation + // msg marshals FlowRSVPLength to protobuf object *otg.FlowRSVPLength + // and doesn't set defaults + msg() *otg.FlowRSVPLength + // setMsg unmarshals FlowRSVPLength from protobuf object *otg.FlowRSVPLength + // and doesn't set defaults + setMsg(*otg.FlowRSVPLength) FlowRSVPLength + // provides marshal interface + Marshal() marshalFlowRSVPLength + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPLength + // validate validates FlowRSVPLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPLengthChoiceEnum, set in FlowRSVPLength + Choice() FlowRSVPLengthChoiceEnum + // setChoice assigns FlowRSVPLengthChoiceEnum provided by user to FlowRSVPLength + setChoice(value FlowRSVPLengthChoiceEnum) FlowRSVPLength + // HasChoice checks if Choice has been set in FlowRSVPLength + HasChoice() bool + // Auto returns uint32, set in FlowRSVPLength. + Auto() uint32 + // HasAuto checks if Auto has been set in FlowRSVPLength + HasAuto() bool + // Value returns uint32, set in FlowRSVPLength. + Value() uint32 + // SetValue assigns uint32 provided by user to FlowRSVPLength + SetValue(value uint32) FlowRSVPLength + // HasValue checks if Value has been set in FlowRSVPLength + HasValue() bool +} + +type FlowRSVPLengthChoiceEnum string + +// Enum of Choice on FlowRSVPLength +var FlowRSVPLengthChoice = struct { + AUTO FlowRSVPLengthChoiceEnum + VALUE FlowRSVPLengthChoiceEnum +}{ + AUTO: FlowRSVPLengthChoiceEnum("auto"), + VALUE: FlowRSVPLengthChoiceEnum("value"), +} + +func (obj *flowRSVPLength) Choice() FlowRSVPLengthChoiceEnum { + return FlowRSVPLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// auto or configured value. +// Choice returns a string +func (obj *flowRSVPLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPLength) setChoice(value FlowRSVPLengthChoiceEnum) FlowRSVPLength { + intValue, ok := otg.FlowRSVPLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Value = nil + obj.obj.Auto = nil + + if value == FlowRSVPLengthChoice.AUTO { + defaultValue := uint32(0) + obj.obj.Auto = &defaultValue + } + + if value == FlowRSVPLengthChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + return obj +} + +// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. +// Auto returns a uint32 +func (obj *flowRSVPLength) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(FlowRSVPLengthChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. +// Auto returns a uint32 +func (obj *flowRSVPLength) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Value returns a uint32 +func (obj *flowRSVPLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(FlowRSVPLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *flowRSVPLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the FlowRSVPLength object +func (obj *flowRSVPLength) SetValue(value uint32) FlowRSVPLength { + obj.setChoice(FlowRSVPLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +func (obj *flowRSVPLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowRSVPLength.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + +} + +func (obj *flowRSVPLength) setDefault() { + var choices_set int = 0 + var choice FlowRSVPLengthChoiceEnum + + if obj.obj.Auto != nil { + choices_set += 1 + choice = FlowRSVPLengthChoice.AUTO + } + + if obj.obj.Value != nil { + choices_set += 1 + choice = FlowRSVPLengthChoice.VALUE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPLengthChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPLength") + } + } else { + intVal := otg.FlowRSVPLength_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_lsp_tunnel_flag.go b/gosnappi/flow_rsvp_lsp_tunnel_flag.go new file mode 100644 index 00000000..98f008f7 --- /dev/null +++ b/gosnappi/flow_rsvp_lsp_tunnel_flag.go @@ -0,0 +1,360 @@ +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" +) + +// ***** FlowRSVPLspTunnelFlag ***** +type flowRSVPLspTunnelFlag struct { + validation + obj *otg.FlowRSVPLspTunnelFlag + marshaller marshalFlowRSVPLspTunnelFlag + unMarshaller unMarshalFlowRSVPLspTunnelFlag +} + +func NewFlowRSVPLspTunnelFlag() FlowRSVPLspTunnelFlag { + obj := flowRSVPLspTunnelFlag{obj: &otg.FlowRSVPLspTunnelFlag{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPLspTunnelFlag) msg() *otg.FlowRSVPLspTunnelFlag { + return obj.obj +} + +func (obj *flowRSVPLspTunnelFlag) setMsg(msg *otg.FlowRSVPLspTunnelFlag) FlowRSVPLspTunnelFlag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPLspTunnelFlag struct { + obj *flowRSVPLspTunnelFlag +} + +type marshalFlowRSVPLspTunnelFlag interface { + // ToProto marshals FlowRSVPLspTunnelFlag to protobuf object *otg.FlowRSVPLspTunnelFlag + ToProto() (*otg.FlowRSVPLspTunnelFlag, error) + // ToPbText marshals FlowRSVPLspTunnelFlag to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPLspTunnelFlag to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPLspTunnelFlag to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPLspTunnelFlag struct { + obj *flowRSVPLspTunnelFlag +} + +type unMarshalFlowRSVPLspTunnelFlag interface { + // FromProto unmarshals FlowRSVPLspTunnelFlag from protobuf object *otg.FlowRSVPLspTunnelFlag + FromProto(msg *otg.FlowRSVPLspTunnelFlag) (FlowRSVPLspTunnelFlag, error) + // FromPbText unmarshals FlowRSVPLspTunnelFlag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPLspTunnelFlag from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPLspTunnelFlag from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPLspTunnelFlag) Marshal() marshalFlowRSVPLspTunnelFlag { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPLspTunnelFlag{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPLspTunnelFlag) Unmarshal() unMarshalFlowRSVPLspTunnelFlag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPLspTunnelFlag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPLspTunnelFlag) ToProto() (*otg.FlowRSVPLspTunnelFlag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPLspTunnelFlag) FromProto(msg *otg.FlowRSVPLspTunnelFlag) (FlowRSVPLspTunnelFlag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPLspTunnelFlag) 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 *unMarshalflowRSVPLspTunnelFlag) 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 *marshalflowRSVPLspTunnelFlag) 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 *unMarshalflowRSVPLspTunnelFlag) 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 *marshalflowRSVPLspTunnelFlag) 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 *unMarshalflowRSVPLspTunnelFlag) 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 *flowRSVPLspTunnelFlag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPLspTunnelFlag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPLspTunnelFlag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPLspTunnelFlag) Clone() (FlowRSVPLspTunnelFlag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPLspTunnelFlag() + 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 +} + +// FlowRSVPLspTunnelFlag is description is TBD +type FlowRSVPLspTunnelFlag interface { + Validation + // msg marshals FlowRSVPLspTunnelFlag to protobuf object *otg.FlowRSVPLspTunnelFlag + // and doesn't set defaults + msg() *otg.FlowRSVPLspTunnelFlag + // setMsg unmarshals FlowRSVPLspTunnelFlag from protobuf object *otg.FlowRSVPLspTunnelFlag + // and doesn't set defaults + setMsg(*otg.FlowRSVPLspTunnelFlag) FlowRSVPLspTunnelFlag + // provides marshal interface + Marshal() marshalFlowRSVPLspTunnelFlag + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPLspTunnelFlag + // validate validates FlowRSVPLspTunnelFlag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPLspTunnelFlag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPLspTunnelFlagChoiceEnum, set in FlowRSVPLspTunnelFlag + Choice() FlowRSVPLspTunnelFlagChoiceEnum + // setChoice assigns FlowRSVPLspTunnelFlagChoiceEnum provided by user to FlowRSVPLspTunnelFlag + setChoice(value FlowRSVPLspTunnelFlagChoiceEnum) FlowRSVPLspTunnelFlag + // HasChoice checks if Choice has been set in FlowRSVPLspTunnelFlag + HasChoice() bool + // getter for LocalProtectionDesired to set choice. + LocalProtectionDesired() + // getter for LabelRecordingDesired to set choice. + LabelRecordingDesired() + // getter for SeStyleDesired to set choice. + SeStyleDesired() +} + +type FlowRSVPLspTunnelFlagChoiceEnum string + +// Enum of Choice on FlowRSVPLspTunnelFlag +var FlowRSVPLspTunnelFlagChoice = struct { + LOCAL_PROTECTION_DESIRED FlowRSVPLspTunnelFlagChoiceEnum + LABEL_RECORDING_DESIRED FlowRSVPLspTunnelFlagChoiceEnum + SE_STYLE_DESIRED FlowRSVPLspTunnelFlagChoiceEnum +}{ + LOCAL_PROTECTION_DESIRED: FlowRSVPLspTunnelFlagChoiceEnum("local_protection_desired"), + LABEL_RECORDING_DESIRED: FlowRSVPLspTunnelFlagChoiceEnum("label_recording_desired"), + SE_STYLE_DESIRED: FlowRSVPLspTunnelFlagChoiceEnum("se_style_desired"), +} + +func (obj *flowRSVPLspTunnelFlag) Choice() FlowRSVPLspTunnelFlagChoiceEnum { + return FlowRSVPLspTunnelFlagChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// getter for LocalProtectionDesired to set choice +func (obj *flowRSVPLspTunnelFlag) LocalProtectionDesired() { + obj.setChoice(FlowRSVPLspTunnelFlagChoice.LOCAL_PROTECTION_DESIRED) +} + +// getter for LabelRecordingDesired to set choice +func (obj *flowRSVPLspTunnelFlag) LabelRecordingDesired() { + obj.setChoice(FlowRSVPLspTunnelFlagChoice.LABEL_RECORDING_DESIRED) +} + +// getter for SeStyleDesired to set choice +func (obj *flowRSVPLspTunnelFlag) SeStyleDesired() { + obj.setChoice(FlowRSVPLspTunnelFlagChoice.SE_STYLE_DESIRED) +} + +// description is TBD +// Choice returns a string +func (obj *flowRSVPLspTunnelFlag) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPLspTunnelFlag) setChoice(value FlowRSVPLspTunnelFlagChoiceEnum) FlowRSVPLspTunnelFlag { + intValue, ok := otg.FlowRSVPLspTunnelFlag_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPLspTunnelFlagChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPLspTunnelFlag_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + + return obj +} + +func (obj *flowRSVPLspTunnelFlag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *flowRSVPLspTunnelFlag) setDefault() { + var choices_set int = 0 + var choice FlowRSVPLspTunnelFlagChoiceEnum + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPLspTunnelFlagChoice.LOCAL_PROTECTION_DESIRED) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPLspTunnelFlag") + } + } else { + intVal := otg.FlowRSVPLspTunnelFlag_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPLspTunnelFlag_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_message.go b/gosnappi/flow_rsvp_message.go new file mode 100644 index 00000000..baba64f4 --- /dev/null +++ b/gosnappi/flow_rsvp_message.go @@ -0,0 +1,396 @@ +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" +) + +// ***** FlowRSVPMessage ***** +type flowRSVPMessage struct { + validation + obj *otg.FlowRSVPMessage + marshaller marshalFlowRSVPMessage + unMarshaller unMarshalFlowRSVPMessage + pathHolder FlowRSVPPathMessage +} + +func NewFlowRSVPMessage() FlowRSVPMessage { + obj := flowRSVPMessage{obj: &otg.FlowRSVPMessage{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPMessage) msg() *otg.FlowRSVPMessage { + return obj.obj +} + +func (obj *flowRSVPMessage) setMsg(msg *otg.FlowRSVPMessage) FlowRSVPMessage { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPMessage struct { + obj *flowRSVPMessage +} + +type marshalFlowRSVPMessage interface { + // ToProto marshals FlowRSVPMessage to protobuf object *otg.FlowRSVPMessage + ToProto() (*otg.FlowRSVPMessage, error) + // ToPbText marshals FlowRSVPMessage to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPMessage to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPMessage to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPMessage struct { + obj *flowRSVPMessage +} + +type unMarshalFlowRSVPMessage interface { + // FromProto unmarshals FlowRSVPMessage from protobuf object *otg.FlowRSVPMessage + FromProto(msg *otg.FlowRSVPMessage) (FlowRSVPMessage, error) + // FromPbText unmarshals FlowRSVPMessage from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPMessage from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPMessage from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPMessage) Marshal() marshalFlowRSVPMessage { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPMessage{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPMessage) Unmarshal() unMarshalFlowRSVPMessage { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPMessage{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPMessage) ToProto() (*otg.FlowRSVPMessage, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPMessage) FromProto(msg *otg.FlowRSVPMessage) (FlowRSVPMessage, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPMessage) 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 *unMarshalflowRSVPMessage) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPMessage) 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 *unMarshalflowRSVPMessage) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPMessage) 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 *unMarshalflowRSVPMessage) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPMessage) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPMessage) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPMessage) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPMessage) Clone() (FlowRSVPMessage, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPMessage() + 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 +} + +func (obj *flowRSVPMessage) setNil() { + obj.pathHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPMessage is description is TBD +type FlowRSVPMessage interface { + Validation + // msg marshals FlowRSVPMessage to protobuf object *otg.FlowRSVPMessage + // and doesn't set defaults + msg() *otg.FlowRSVPMessage + // setMsg unmarshals FlowRSVPMessage from protobuf object *otg.FlowRSVPMessage + // and doesn't set defaults + setMsg(*otg.FlowRSVPMessage) FlowRSVPMessage + // provides marshal interface + Marshal() marshalFlowRSVPMessage + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPMessage + // validate validates FlowRSVPMessage + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPMessage, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPMessageChoiceEnum, set in FlowRSVPMessage + Choice() FlowRSVPMessageChoiceEnum + // setChoice assigns FlowRSVPMessageChoiceEnum provided by user to FlowRSVPMessage + setChoice(value FlowRSVPMessageChoiceEnum) FlowRSVPMessage + // HasChoice checks if Choice has been set in FlowRSVPMessage + HasChoice() bool + // Path returns FlowRSVPPathMessage, set in FlowRSVPMessage. + // FlowRSVPPathMessage is "Path" message requires the following list of objects in order as defined in https://www.rfc-editor.org/rfc/rfc3209.html#page-15: 1. SESSION 2. RSVP_HOP 3. TIME_VALUES 4. EXPLICIT_ROUTE [optional] 5. LABEL_REQUEST 6. SESSION_ATTRIBUTE [optional] 7. SENDER_TEMPLATE 8. SENDER_TSPEC 9. RECORD_ROUTE [optional] + Path() FlowRSVPPathMessage + // SetPath assigns FlowRSVPPathMessage provided by user to FlowRSVPMessage. + // FlowRSVPPathMessage is "Path" message requires the following list of objects in order as defined in https://www.rfc-editor.org/rfc/rfc3209.html#page-15: 1. SESSION 2. RSVP_HOP 3. TIME_VALUES 4. EXPLICIT_ROUTE [optional] 5. LABEL_REQUEST 6. SESSION_ATTRIBUTE [optional] 7. SENDER_TEMPLATE 8. SENDER_TSPEC 9. RECORD_ROUTE [optional] + SetPath(value FlowRSVPPathMessage) FlowRSVPMessage + // HasPath checks if Path has been set in FlowRSVPMessage + HasPath() bool + setNil() +} + +type FlowRSVPMessageChoiceEnum string + +// Enum of Choice on FlowRSVPMessage +var FlowRSVPMessageChoice = struct { + PATH FlowRSVPMessageChoiceEnum +}{ + PATH: FlowRSVPMessageChoiceEnum("path"), +} + +func (obj *flowRSVPMessage) Choice() FlowRSVPMessageChoiceEnum { + return FlowRSVPMessageChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowRSVPMessage) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPMessage) setChoice(value FlowRSVPMessageChoiceEnum) FlowRSVPMessage { + intValue, ok := otg.FlowRSVPMessage_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPMessageChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPMessage_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Path = nil + obj.pathHolder = nil + + if value == FlowRSVPMessageChoice.PATH { + obj.obj.Path = NewFlowRSVPPathMessage().msg() + } + + return obj +} + +// description is TBD +// Path returns a FlowRSVPPathMessage +func (obj *flowRSVPMessage) Path() FlowRSVPPathMessage { + if obj.obj.Path == nil { + obj.setChoice(FlowRSVPMessageChoice.PATH) + } + if obj.pathHolder == nil { + obj.pathHolder = &flowRSVPPathMessage{obj: obj.obj.Path} + } + return obj.pathHolder +} + +// description is TBD +// Path returns a FlowRSVPPathMessage +func (obj *flowRSVPMessage) HasPath() bool { + return obj.obj.Path != nil +} + +// description is TBD +// SetPath sets the FlowRSVPPathMessage value in the FlowRSVPMessage object +func (obj *flowRSVPMessage) SetPath(value FlowRSVPPathMessage) FlowRSVPMessage { + obj.setChoice(FlowRSVPMessageChoice.PATH) + obj.pathHolder = nil + obj.obj.Path = value.msg() + + return obj +} + +func (obj *flowRSVPMessage) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Path != nil { + + obj.Path().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPMessage) setDefault() { + var choices_set int = 0 + var choice FlowRSVPMessageChoiceEnum + + if obj.obj.Path != nil { + choices_set += 1 + choice = FlowRSVPMessageChoice.PATH + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPMessageChoice.PATH) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPMessage") + } + } else { + intVal := otg.FlowRSVPMessage_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPMessage_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_object_length.go b/gosnappi/flow_rsvp_object_length.go new file mode 100644 index 00000000..09c3be5b --- /dev/null +++ b/gosnappi/flow_rsvp_object_length.go @@ -0,0 +1,423 @@ +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" +) + +// ***** FlowRSVPObjectLength ***** +type flowRSVPObjectLength struct { + validation + obj *otg.FlowRSVPObjectLength + marshaller marshalFlowRSVPObjectLength + unMarshaller unMarshalFlowRSVPObjectLength +} + +func NewFlowRSVPObjectLength() FlowRSVPObjectLength { + obj := flowRSVPObjectLength{obj: &otg.FlowRSVPObjectLength{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPObjectLength) msg() *otg.FlowRSVPObjectLength { + return obj.obj +} + +func (obj *flowRSVPObjectLength) setMsg(msg *otg.FlowRSVPObjectLength) FlowRSVPObjectLength { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPObjectLength struct { + obj *flowRSVPObjectLength +} + +type marshalFlowRSVPObjectLength interface { + // ToProto marshals FlowRSVPObjectLength to protobuf object *otg.FlowRSVPObjectLength + ToProto() (*otg.FlowRSVPObjectLength, error) + // ToPbText marshals FlowRSVPObjectLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPObjectLength to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPObjectLength to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPObjectLength struct { + obj *flowRSVPObjectLength +} + +type unMarshalFlowRSVPObjectLength interface { + // FromProto unmarshals FlowRSVPObjectLength from protobuf object *otg.FlowRSVPObjectLength + FromProto(msg *otg.FlowRSVPObjectLength) (FlowRSVPObjectLength, error) + // FromPbText unmarshals FlowRSVPObjectLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPObjectLength from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPObjectLength from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPObjectLength) Marshal() marshalFlowRSVPObjectLength { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPObjectLength{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPObjectLength) Unmarshal() unMarshalFlowRSVPObjectLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPObjectLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPObjectLength) ToProto() (*otg.FlowRSVPObjectLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPObjectLength) FromProto(msg *otg.FlowRSVPObjectLength) (FlowRSVPObjectLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPObjectLength) 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 *unMarshalflowRSVPObjectLength) 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 *marshalflowRSVPObjectLength) 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 *unMarshalflowRSVPObjectLength) 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 *marshalflowRSVPObjectLength) 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 *unMarshalflowRSVPObjectLength) 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 *flowRSVPObjectLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPObjectLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPObjectLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPObjectLength) Clone() (FlowRSVPObjectLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPObjectLength() + 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 +} + +// FlowRSVPObjectLength is description is TBD +type FlowRSVPObjectLength interface { + Validation + // msg marshals FlowRSVPObjectLength to protobuf object *otg.FlowRSVPObjectLength + // and doesn't set defaults + msg() *otg.FlowRSVPObjectLength + // setMsg unmarshals FlowRSVPObjectLength from protobuf object *otg.FlowRSVPObjectLength + // and doesn't set defaults + setMsg(*otg.FlowRSVPObjectLength) FlowRSVPObjectLength + // provides marshal interface + Marshal() marshalFlowRSVPObjectLength + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPObjectLength + // validate validates FlowRSVPObjectLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPObjectLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPObjectLengthChoiceEnum, set in FlowRSVPObjectLength + Choice() FlowRSVPObjectLengthChoiceEnum + // setChoice assigns FlowRSVPObjectLengthChoiceEnum provided by user to FlowRSVPObjectLength + setChoice(value FlowRSVPObjectLengthChoiceEnum) FlowRSVPObjectLength + // HasChoice checks if Choice has been set in FlowRSVPObjectLength + HasChoice() bool + // Auto returns uint32, set in FlowRSVPObjectLength. + Auto() uint32 + // HasAuto checks if Auto has been set in FlowRSVPObjectLength + HasAuto() bool + // Value returns uint32, set in FlowRSVPObjectLength. + Value() uint32 + // SetValue assigns uint32 provided by user to FlowRSVPObjectLength + SetValue(value uint32) FlowRSVPObjectLength + // HasValue checks if Value has been set in FlowRSVPObjectLength + HasValue() bool +} + +type FlowRSVPObjectLengthChoiceEnum string + +// Enum of Choice on FlowRSVPObjectLength +var FlowRSVPObjectLengthChoice = struct { + AUTO FlowRSVPObjectLengthChoiceEnum + VALUE FlowRSVPObjectLengthChoiceEnum +}{ + AUTO: FlowRSVPObjectLengthChoiceEnum("auto"), + VALUE: FlowRSVPObjectLengthChoiceEnum("value"), +} + +func (obj *flowRSVPObjectLength) Choice() FlowRSVPObjectLengthChoiceEnum { + return FlowRSVPObjectLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// auto or configured value. +// Choice returns a string +func (obj *flowRSVPObjectLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPObjectLength) setChoice(value FlowRSVPObjectLengthChoiceEnum) FlowRSVPObjectLength { + intValue, ok := otg.FlowRSVPObjectLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPObjectLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPObjectLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Value = nil + obj.obj.Auto = nil + + if value == FlowRSVPObjectLengthChoice.AUTO { + defaultValue := uint32(4) + obj.obj.Auto = &defaultValue + } + + if value == FlowRSVPObjectLengthChoice.VALUE { + defaultValue := uint32(4) + obj.obj.Value = &defaultValue + } + + return obj +} + +// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. +// Auto returns a uint32 +func (obj *flowRSVPObjectLength) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(FlowRSVPObjectLengthChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. +// Auto returns a uint32 +func (obj *flowRSVPObjectLength) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Value returns a uint32 +func (obj *flowRSVPObjectLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(FlowRSVPObjectLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *flowRSVPObjectLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the FlowRSVPObjectLength object +func (obj *flowRSVPObjectLength) SetValue(value uint32) FlowRSVPObjectLength { + obj.setChoice(FlowRSVPObjectLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +func (obj *flowRSVPObjectLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value < 4 || *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("4 <= FlowRSVPObjectLength.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + +} + +func (obj *flowRSVPObjectLength) setDefault() { + var choices_set int = 0 + var choice FlowRSVPObjectLengthChoiceEnum + + if obj.obj.Auto != nil { + choices_set += 1 + choice = FlowRSVPObjectLengthChoice.AUTO + } + + if obj.obj.Value != nil { + choices_set += 1 + choice = FlowRSVPObjectLengthChoice.VALUE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPObjectLengthChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPObjectLength") + } + } else { + intVal := otg.FlowRSVPObjectLength_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPObjectLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_path_explicit_route_type1.go b/gosnappi/flow_rsvp_path_explicit_route_type1.go new file mode 100644 index 00000000..40e95ad1 --- /dev/null +++ b/gosnappi/flow_rsvp_path_explicit_route_type1.go @@ -0,0 +1,390 @@ +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" +) + +// ***** FlowRSVPPathExplicitRouteType1 ***** +type flowRSVPPathExplicitRouteType1 struct { + validation + obj *otg.FlowRSVPPathExplicitRouteType1 + marshaller marshalFlowRSVPPathExplicitRouteType1 + unMarshaller unMarshalFlowRSVPPathExplicitRouteType1 + subobjectsHolder FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter +} + +func NewFlowRSVPPathExplicitRouteType1() FlowRSVPPathExplicitRouteType1 { + obj := flowRSVPPathExplicitRouteType1{obj: &otg.FlowRSVPPathExplicitRouteType1{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathExplicitRouteType1) msg() *otg.FlowRSVPPathExplicitRouteType1 { + return obj.obj +} + +func (obj *flowRSVPPathExplicitRouteType1) setMsg(msg *otg.FlowRSVPPathExplicitRouteType1) FlowRSVPPathExplicitRouteType1 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathExplicitRouteType1 struct { + obj *flowRSVPPathExplicitRouteType1 +} + +type marshalFlowRSVPPathExplicitRouteType1 interface { + // ToProto marshals FlowRSVPPathExplicitRouteType1 to protobuf object *otg.FlowRSVPPathExplicitRouteType1 + ToProto() (*otg.FlowRSVPPathExplicitRouteType1, error) + // ToPbText marshals FlowRSVPPathExplicitRouteType1 to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathExplicitRouteType1 to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathExplicitRouteType1 to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathExplicitRouteType1 struct { + obj *flowRSVPPathExplicitRouteType1 +} + +type unMarshalFlowRSVPPathExplicitRouteType1 interface { + // FromProto unmarshals FlowRSVPPathExplicitRouteType1 from protobuf object *otg.FlowRSVPPathExplicitRouteType1 + FromProto(msg *otg.FlowRSVPPathExplicitRouteType1) (FlowRSVPPathExplicitRouteType1, error) + // FromPbText unmarshals FlowRSVPPathExplicitRouteType1 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathExplicitRouteType1 from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathExplicitRouteType1 from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathExplicitRouteType1) Marshal() marshalFlowRSVPPathExplicitRouteType1 { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathExplicitRouteType1{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathExplicitRouteType1) Unmarshal() unMarshalFlowRSVPPathExplicitRouteType1 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathExplicitRouteType1{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathExplicitRouteType1) ToProto() (*otg.FlowRSVPPathExplicitRouteType1, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathExplicitRouteType1) FromProto(msg *otg.FlowRSVPPathExplicitRouteType1) (FlowRSVPPathExplicitRouteType1, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathExplicitRouteType1) 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 *unMarshalflowRSVPPathExplicitRouteType1) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathExplicitRouteType1) 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 *unMarshalflowRSVPPathExplicitRouteType1) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathExplicitRouteType1) 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 *unMarshalflowRSVPPathExplicitRouteType1) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathExplicitRouteType1) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathExplicitRouteType1) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathExplicitRouteType1) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathExplicitRouteType1) Clone() (FlowRSVPPathExplicitRouteType1, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathExplicitRouteType1() + 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 +} + +func (obj *flowRSVPPathExplicitRouteType1) setNil() { + obj.subobjectsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathExplicitRouteType1 is type1 Explicit Route has subobjects. Currently supported subobjects are IPv4 prefix and Autonomous system number. +type FlowRSVPPathExplicitRouteType1 interface { + Validation + // msg marshals FlowRSVPPathExplicitRouteType1 to protobuf object *otg.FlowRSVPPathExplicitRouteType1 + // and doesn't set defaults + msg() *otg.FlowRSVPPathExplicitRouteType1 + // setMsg unmarshals FlowRSVPPathExplicitRouteType1 from protobuf object *otg.FlowRSVPPathExplicitRouteType1 + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathExplicitRouteType1) FlowRSVPPathExplicitRouteType1 + // provides marshal interface + Marshal() marshalFlowRSVPPathExplicitRouteType1 + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathExplicitRouteType1 + // validate validates FlowRSVPPathExplicitRouteType1 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathExplicitRouteType1, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Subobjects returns FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIterIter, set in FlowRSVPPathExplicitRouteType1 + Subobjects() FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter + setNil() +} + +// description is TBD +// Subobjects returns a []FlowRSVPType1ExplicitRouteSubobjects +func (obj *flowRSVPPathExplicitRouteType1) Subobjects() FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { + if len(obj.obj.Subobjects) == 0 { + obj.obj.Subobjects = []*otg.FlowRSVPType1ExplicitRouteSubobjects{} + } + if obj.subobjectsHolder == nil { + obj.subobjectsHolder = newFlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter(&obj.obj.Subobjects).setMsg(obj) + } + return obj.subobjectsHolder +} + +type flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter struct { + obj *flowRSVPPathExplicitRouteType1 + flowRSVPType1ExplicitRouteSubobjectsSlice []FlowRSVPType1ExplicitRouteSubobjects + fieldPtr *[]*otg.FlowRSVPType1ExplicitRouteSubobjects +} + +func newFlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter(ptr *[]*otg.FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { + return &flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter{fieldPtr: ptr} +} + +type FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter interface { + setMsg(*flowRSVPPathExplicitRouteType1) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter + Items() []FlowRSVPType1ExplicitRouteSubobjects + Add() FlowRSVPType1ExplicitRouteSubobjects + Append(items ...FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter + Set(index int, newObj FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter + Clear() FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter + clearHolderSlice() FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter + appendHolderSlice(item FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter +} + +func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) setMsg(msg *flowRSVPPathExplicitRouteType1) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flowRSVPType1ExplicitRouteSubobjects{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) Items() []FlowRSVPType1ExplicitRouteSubobjects { + return obj.flowRSVPType1ExplicitRouteSubobjectsSlice +} + +func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) Add() FlowRSVPType1ExplicitRouteSubobjects { + newObj := &otg.FlowRSVPType1ExplicitRouteSubobjects{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flowRSVPType1ExplicitRouteSubobjects{obj: newObj} + newLibObj.setDefault() + obj.flowRSVPType1ExplicitRouteSubobjectsSlice = append(obj.flowRSVPType1ExplicitRouteSubobjectsSlice, newLibObj) + return newLibObj +} + +func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) Append(items ...FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowRSVPType1ExplicitRouteSubobjectsSlice = append(obj.flowRSVPType1ExplicitRouteSubobjectsSlice, item) + } + return obj +} + +func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) Set(index int, newObj FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowRSVPType1ExplicitRouteSubobjectsSlice[index] = newObj + return obj +} +func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) Clear() FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.FlowRSVPType1ExplicitRouteSubobjects{} + obj.flowRSVPType1ExplicitRouteSubobjectsSlice = []FlowRSVPType1ExplicitRouteSubobjects{} + } + return obj +} +func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) clearHolderSlice() FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { + if len(obj.flowRSVPType1ExplicitRouteSubobjectsSlice) > 0 { + obj.flowRSVPType1ExplicitRouteSubobjectsSlice = []FlowRSVPType1ExplicitRouteSubobjects{} + } + return obj +} +func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) appendHolderSlice(item FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { + obj.flowRSVPType1ExplicitRouteSubobjectsSlice = append(obj.flowRSVPType1ExplicitRouteSubobjectsSlice, item) + return obj +} + +func (obj *flowRSVPPathExplicitRouteType1) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Subobjects) != 0 { + + if set_default { + obj.Subobjects().clearHolderSlice() + for _, item := range obj.obj.Subobjects { + obj.Subobjects().appendHolderSlice(&flowRSVPType1ExplicitRouteSubobjects{obj: item}) + } + } + for _, item := range obj.Subobjects().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *flowRSVPPathExplicitRouteType1) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_explicit_route_type1_as_number.go b/gosnappi/flow_rsvp_path_explicit_route_type1_as_number.go new file mode 100644 index 00000000..92b16d05 --- /dev/null +++ b/gosnappi/flow_rsvp_path_explicit_route_type1_as_number.go @@ -0,0 +1,412 @@ +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" +) + +// ***** FlowRSVPPathExplicitRouteType1ASNumber ***** +type flowRSVPPathExplicitRouteType1ASNumber struct { + validation + obj *otg.FlowRSVPPathExplicitRouteType1ASNumber + marshaller marshalFlowRSVPPathExplicitRouteType1ASNumber + unMarshaller unMarshalFlowRSVPPathExplicitRouteType1ASNumber + lBitHolder PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + lengthHolder FlowRSVPExplicitRouteASNumberLength +} + +func NewFlowRSVPPathExplicitRouteType1ASNumber() FlowRSVPPathExplicitRouteType1ASNumber { + obj := flowRSVPPathExplicitRouteType1ASNumber{obj: &otg.FlowRSVPPathExplicitRouteType1ASNumber{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathExplicitRouteType1ASNumber) msg() *otg.FlowRSVPPathExplicitRouteType1ASNumber { + return obj.obj +} + +func (obj *flowRSVPPathExplicitRouteType1ASNumber) setMsg(msg *otg.FlowRSVPPathExplicitRouteType1ASNumber) FlowRSVPPathExplicitRouteType1ASNumber { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathExplicitRouteType1ASNumber struct { + obj *flowRSVPPathExplicitRouteType1ASNumber +} + +type marshalFlowRSVPPathExplicitRouteType1ASNumber interface { + // ToProto marshals FlowRSVPPathExplicitRouteType1ASNumber to protobuf object *otg.FlowRSVPPathExplicitRouteType1ASNumber + ToProto() (*otg.FlowRSVPPathExplicitRouteType1ASNumber, error) + // ToPbText marshals FlowRSVPPathExplicitRouteType1ASNumber to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathExplicitRouteType1ASNumber to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathExplicitRouteType1ASNumber to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathExplicitRouteType1ASNumber struct { + obj *flowRSVPPathExplicitRouteType1ASNumber +} + +type unMarshalFlowRSVPPathExplicitRouteType1ASNumber interface { + // FromProto unmarshals FlowRSVPPathExplicitRouteType1ASNumber from protobuf object *otg.FlowRSVPPathExplicitRouteType1ASNumber + FromProto(msg *otg.FlowRSVPPathExplicitRouteType1ASNumber) (FlowRSVPPathExplicitRouteType1ASNumber, error) + // FromPbText unmarshals FlowRSVPPathExplicitRouteType1ASNumber from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathExplicitRouteType1ASNumber from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathExplicitRouteType1ASNumber from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathExplicitRouteType1ASNumber) Marshal() marshalFlowRSVPPathExplicitRouteType1ASNumber { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathExplicitRouteType1ASNumber{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathExplicitRouteType1ASNumber) Unmarshal() unMarshalFlowRSVPPathExplicitRouteType1ASNumber { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathExplicitRouteType1ASNumber{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathExplicitRouteType1ASNumber) ToProto() (*otg.FlowRSVPPathExplicitRouteType1ASNumber, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathExplicitRouteType1ASNumber) FromProto(msg *otg.FlowRSVPPathExplicitRouteType1ASNumber) (FlowRSVPPathExplicitRouteType1ASNumber, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathExplicitRouteType1ASNumber) 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 *unMarshalflowRSVPPathExplicitRouteType1ASNumber) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathExplicitRouteType1ASNumber) 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 *unMarshalflowRSVPPathExplicitRouteType1ASNumber) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathExplicitRouteType1ASNumber) 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 *unMarshalflowRSVPPathExplicitRouteType1ASNumber) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathExplicitRouteType1ASNumber) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathExplicitRouteType1ASNumber) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathExplicitRouteType1ASNumber) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathExplicitRouteType1ASNumber) Clone() (FlowRSVPPathExplicitRouteType1ASNumber, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathExplicitRouteType1ASNumber() + 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 +} + +func (obj *flowRSVPPathExplicitRouteType1ASNumber) setNil() { + obj.lBitHolder = nil + obj.lengthHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathExplicitRouteType1ASNumber is class = EXPLICIT_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: Autonomous system number, C-Type: 32 +type FlowRSVPPathExplicitRouteType1ASNumber interface { + Validation + // msg marshals FlowRSVPPathExplicitRouteType1ASNumber to protobuf object *otg.FlowRSVPPathExplicitRouteType1ASNumber + // and doesn't set defaults + msg() *otg.FlowRSVPPathExplicitRouteType1ASNumber + // setMsg unmarshals FlowRSVPPathExplicitRouteType1ASNumber from protobuf object *otg.FlowRSVPPathExplicitRouteType1ASNumber + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathExplicitRouteType1ASNumber) FlowRSVPPathExplicitRouteType1ASNumber + // provides marshal interface + Marshal() marshalFlowRSVPPathExplicitRouteType1ASNumber + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathExplicitRouteType1ASNumber + // validate validates FlowRSVPPathExplicitRouteType1ASNumber + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathExplicitRouteType1ASNumber, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // LBit returns PatternFlowRSVPPathExplicitRouteType1ASNumberLBit, set in FlowRSVPPathExplicitRouteType1ASNumber. + // PatternFlowRSVPPathExplicitRouteType1ASNumberLBit is the L bit is an attribute of the subobject. The L bit is set if the subobject represents a loose hop in the explicit route. If the bit is not set, the subobject represents a strict hop in the explicit route. + LBit() PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + // SetLBit assigns PatternFlowRSVPPathExplicitRouteType1ASNumberLBit provided by user to FlowRSVPPathExplicitRouteType1ASNumber. + // PatternFlowRSVPPathExplicitRouteType1ASNumberLBit is the L bit is an attribute of the subobject. The L bit is set if the subobject represents a loose hop in the explicit route. If the bit is not set, the subobject represents a strict hop in the explicit route. + SetLBit(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) FlowRSVPPathExplicitRouteType1ASNumber + // HasLBit checks if LBit has been set in FlowRSVPPathExplicitRouteType1ASNumber + HasLBit() bool + // Length returns FlowRSVPExplicitRouteASNumberLength, set in FlowRSVPPathExplicitRouteType1ASNumber. + // FlowRSVPExplicitRouteASNumberLength is description is TBD + Length() FlowRSVPExplicitRouteASNumberLength + // SetLength assigns FlowRSVPExplicitRouteASNumberLength provided by user to FlowRSVPPathExplicitRouteType1ASNumber. + // FlowRSVPExplicitRouteASNumberLength is description is TBD + SetLength(value FlowRSVPExplicitRouteASNumberLength) FlowRSVPPathExplicitRouteType1ASNumber + // HasLength checks if Length has been set in FlowRSVPPathExplicitRouteType1ASNumber + HasLength() bool + // AsNumber returns uint32, set in FlowRSVPPathExplicitRouteType1ASNumber. + AsNumber() uint32 + // SetAsNumber assigns uint32 provided by user to FlowRSVPPathExplicitRouteType1ASNumber + SetAsNumber(value uint32) FlowRSVPPathExplicitRouteType1ASNumber + // HasAsNumber checks if AsNumber has been set in FlowRSVPPathExplicitRouteType1ASNumber + HasAsNumber() bool + setNil() +} + +// description is TBD +// LBit returns a PatternFlowRSVPPathExplicitRouteType1ASNumberLBit +func (obj *flowRSVPPathExplicitRouteType1ASNumber) LBit() PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { + if obj.obj.LBit == nil { + obj.obj.LBit = NewPatternFlowRSVPPathExplicitRouteType1ASNumberLBit().msg() + } + if obj.lBitHolder == nil { + obj.lBitHolder = &patternFlowRSVPPathExplicitRouteType1ASNumberLBit{obj: obj.obj.LBit} + } + return obj.lBitHolder +} + +// description is TBD +// LBit returns a PatternFlowRSVPPathExplicitRouteType1ASNumberLBit +func (obj *flowRSVPPathExplicitRouteType1ASNumber) HasLBit() bool { + return obj.obj.LBit != nil +} + +// description is TBD +// SetLBit sets the PatternFlowRSVPPathExplicitRouteType1ASNumberLBit value in the FlowRSVPPathExplicitRouteType1ASNumber object +func (obj *flowRSVPPathExplicitRouteType1ASNumber) SetLBit(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) FlowRSVPPathExplicitRouteType1ASNumber { + + obj.lBitHolder = nil + obj.obj.LBit = value.msg() + + return obj +} + +// The Length contains the total length of the subobject in bytes,including L, Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. +// Length returns a FlowRSVPExplicitRouteASNumberLength +func (obj *flowRSVPPathExplicitRouteType1ASNumber) Length() FlowRSVPExplicitRouteASNumberLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowRSVPExplicitRouteASNumberLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowRSVPExplicitRouteASNumberLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// The Length contains the total length of the subobject in bytes,including L, Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. +// Length returns a FlowRSVPExplicitRouteASNumberLength +func (obj *flowRSVPPathExplicitRouteType1ASNumber) HasLength() bool { + return obj.obj.Length != nil +} + +// The Length contains the total length of the subobject in bytes,including L, Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. +// SetLength sets the FlowRSVPExplicitRouteASNumberLength value in the FlowRSVPPathExplicitRouteType1ASNumber object +func (obj *flowRSVPPathExplicitRouteType1ASNumber) SetLength(value FlowRSVPExplicitRouteASNumberLength) FlowRSVPPathExplicitRouteType1ASNumber { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// Autonomous System number to be set in the ERO sub-object that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'as_number'. +// AsNumber returns a uint32 +func (obj *flowRSVPPathExplicitRouteType1ASNumber) AsNumber() uint32 { + + return *obj.obj.AsNumber + +} + +// Autonomous System number to be set in the ERO sub-object that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'as_number'. +// AsNumber returns a uint32 +func (obj *flowRSVPPathExplicitRouteType1ASNumber) HasAsNumber() bool { + return obj.obj.AsNumber != nil +} + +// Autonomous System number to be set in the ERO sub-object that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'as_number'. +// SetAsNumber sets the uint32 value in the FlowRSVPPathExplicitRouteType1ASNumber object +func (obj *flowRSVPPathExplicitRouteType1ASNumber) SetAsNumber(value uint32) FlowRSVPPathExplicitRouteType1ASNumber { + + obj.obj.AsNumber = &value + return obj +} + +func (obj *flowRSVPPathExplicitRouteType1ASNumber) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.LBit != nil { + + obj.LBit().validateObj(vObj, set_default) + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.AsNumber != nil { + + if *obj.obj.AsNumber > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowRSVPPathExplicitRouteType1ASNumber.AsNumber <= 65535 but Got %d", *obj.obj.AsNumber)) + } + + } + +} + +func (obj *flowRSVPPathExplicitRouteType1ASNumber) setDefault() { + if obj.obj.AsNumber == nil { + obj.SetAsNumber(0) + } + +} diff --git a/gosnappi/flow_rsvp_path_explicit_route_type1_ipv4_prefix.go b/gosnappi/flow_rsvp_path_explicit_route_type1_ipv4_prefix.go new file mode 100644 index 00000000..365d287d --- /dev/null +++ b/gosnappi/flow_rsvp_path_explicit_route_type1_ipv4_prefix.go @@ -0,0 +1,455 @@ +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" +) + +// ***** FlowRSVPPathExplicitRouteType1Ipv4Prefix ***** +type flowRSVPPathExplicitRouteType1Ipv4Prefix struct { + validation + obj *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix + marshaller marshalFlowRSVPPathExplicitRouteType1Ipv4Prefix + unMarshaller unMarshalFlowRSVPPathExplicitRouteType1Ipv4Prefix + lBitHolder PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + lengthHolder FlowRSVPExplicitRouteLength + ipv4AddressHolder PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address +} + +func NewFlowRSVPPathExplicitRouteType1Ipv4Prefix() FlowRSVPPathExplicitRouteType1Ipv4Prefix { + obj := flowRSVPPathExplicitRouteType1Ipv4Prefix{obj: &otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) msg() *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix { + return obj.obj +} + +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) setMsg(msg *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix) FlowRSVPPathExplicitRouteType1Ipv4Prefix { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathExplicitRouteType1Ipv4Prefix struct { + obj *flowRSVPPathExplicitRouteType1Ipv4Prefix +} + +type marshalFlowRSVPPathExplicitRouteType1Ipv4Prefix interface { + // ToProto marshals FlowRSVPPathExplicitRouteType1Ipv4Prefix to protobuf object *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix + ToProto() (*otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix, error) + // ToPbText marshals FlowRSVPPathExplicitRouteType1Ipv4Prefix to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathExplicitRouteType1Ipv4Prefix to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathExplicitRouteType1Ipv4Prefix to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathExplicitRouteType1Ipv4Prefix struct { + obj *flowRSVPPathExplicitRouteType1Ipv4Prefix +} + +type unMarshalFlowRSVPPathExplicitRouteType1Ipv4Prefix interface { + // FromProto unmarshals FlowRSVPPathExplicitRouteType1Ipv4Prefix from protobuf object *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix + FromProto(msg *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix) (FlowRSVPPathExplicitRouteType1Ipv4Prefix, error) + // FromPbText unmarshals FlowRSVPPathExplicitRouteType1Ipv4Prefix from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathExplicitRouteType1Ipv4Prefix from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathExplicitRouteType1Ipv4Prefix from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) Marshal() marshalFlowRSVPPathExplicitRouteType1Ipv4Prefix { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathExplicitRouteType1Ipv4Prefix{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) Unmarshal() unMarshalFlowRSVPPathExplicitRouteType1Ipv4Prefix { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathExplicitRouteType1Ipv4Prefix{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathExplicitRouteType1Ipv4Prefix) ToProto() (*otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathExplicitRouteType1Ipv4Prefix) FromProto(msg *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix) (FlowRSVPPathExplicitRouteType1Ipv4Prefix, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathExplicitRouteType1Ipv4Prefix) 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 *unMarshalflowRSVPPathExplicitRouteType1Ipv4Prefix) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathExplicitRouteType1Ipv4Prefix) 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 *unMarshalflowRSVPPathExplicitRouteType1Ipv4Prefix) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathExplicitRouteType1Ipv4Prefix) 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 *unMarshalflowRSVPPathExplicitRouteType1Ipv4Prefix) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) Clone() (FlowRSVPPathExplicitRouteType1Ipv4Prefix, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathExplicitRouteType1Ipv4Prefix() + 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 +} + +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) setNil() { + obj.lBitHolder = nil + obj.lengthHolder = nil + obj.ipv4AddressHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathExplicitRouteType1Ipv4Prefix is class = EXPLICIT_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: IPv4 Prefix, C-Type: 1 +type FlowRSVPPathExplicitRouteType1Ipv4Prefix interface { + Validation + // msg marshals FlowRSVPPathExplicitRouteType1Ipv4Prefix to protobuf object *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix + // and doesn't set defaults + msg() *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix + // setMsg unmarshals FlowRSVPPathExplicitRouteType1Ipv4Prefix from protobuf object *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix) FlowRSVPPathExplicitRouteType1Ipv4Prefix + // provides marshal interface + Marshal() marshalFlowRSVPPathExplicitRouteType1Ipv4Prefix + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathExplicitRouteType1Ipv4Prefix + // validate validates FlowRSVPPathExplicitRouteType1Ipv4Prefix + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathExplicitRouteType1Ipv4Prefix, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // LBit returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit, set in FlowRSVPPathExplicitRouteType1Ipv4Prefix. + // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit is the L bit is an attribute of the subobject. The L bit is set if the subobject represents a loose hop in the explicit route. If the bit is not set, the subobject represents a strict hop in the explicit route. + LBit() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + // SetLBit assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit provided by user to FlowRSVPPathExplicitRouteType1Ipv4Prefix. + // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit is the L bit is an attribute of the subobject. The L bit is set if the subobject represents a loose hop in the explicit route. If the bit is not set, the subobject represents a strict hop in the explicit route. + SetLBit(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) FlowRSVPPathExplicitRouteType1Ipv4Prefix + // HasLBit checks if LBit has been set in FlowRSVPPathExplicitRouteType1Ipv4Prefix + HasLBit() bool + // Length returns FlowRSVPExplicitRouteLength, set in FlowRSVPPathExplicitRouteType1Ipv4Prefix. + // FlowRSVPExplicitRouteLength is description is TBD + Length() FlowRSVPExplicitRouteLength + // SetLength assigns FlowRSVPExplicitRouteLength provided by user to FlowRSVPPathExplicitRouteType1Ipv4Prefix. + // FlowRSVPExplicitRouteLength is description is TBD + SetLength(value FlowRSVPExplicitRouteLength) FlowRSVPPathExplicitRouteType1Ipv4Prefix + // HasLength checks if Length has been set in FlowRSVPPathExplicitRouteType1Ipv4Prefix + HasLength() bool + // Ipv4Address returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address, set in FlowRSVPPathExplicitRouteType1Ipv4Prefix. + // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address is this IPv4 address is treated as a prefix based on the prefix length value below. Bits beyond the prefix are ignored on receipt and SHOULD be set to zero on transmission. + Ipv4Address() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + // SetIpv4Address assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address provided by user to FlowRSVPPathExplicitRouteType1Ipv4Prefix. + // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address is this IPv4 address is treated as a prefix based on the prefix length value below. Bits beyond the prefix are ignored on receipt and SHOULD be set to zero on transmission. + SetIpv4Address(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) FlowRSVPPathExplicitRouteType1Ipv4Prefix + // HasIpv4Address checks if Ipv4Address has been set in FlowRSVPPathExplicitRouteType1Ipv4Prefix + HasIpv4Address() bool + // Prefix returns uint32, set in FlowRSVPPathExplicitRouteType1Ipv4Prefix. + Prefix() uint32 + // SetPrefix assigns uint32 provided by user to FlowRSVPPathExplicitRouteType1Ipv4Prefix + SetPrefix(value uint32) FlowRSVPPathExplicitRouteType1Ipv4Prefix + // HasPrefix checks if Prefix has been set in FlowRSVPPathExplicitRouteType1Ipv4Prefix + HasPrefix() bool + setNil() +} + +// description is TBD +// LBit returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) LBit() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { + if obj.obj.LBit == nil { + obj.obj.LBit = NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit().msg() + } + if obj.lBitHolder == nil { + obj.lBitHolder = &patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit{obj: obj.obj.LBit} + } + return obj.lBitHolder +} + +// description is TBD +// LBit returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) HasLBit() bool { + return obj.obj.LBit != nil +} + +// description is TBD +// SetLBit sets the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit value in the FlowRSVPPathExplicitRouteType1Ipv4Prefix object +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) SetLBit(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) FlowRSVPPathExplicitRouteType1Ipv4Prefix { + + obj.lBitHolder = nil + obj.obj.LBit = value.msg() + + return obj +} + +// The Length contains the total length of the subobject in bytes,including L,Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. +// Length returns a FlowRSVPExplicitRouteLength +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) Length() FlowRSVPExplicitRouteLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowRSVPExplicitRouteLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowRSVPExplicitRouteLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// The Length contains the total length of the subobject in bytes,including L,Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. +// Length returns a FlowRSVPExplicitRouteLength +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) HasLength() bool { + return obj.obj.Length != nil +} + +// The Length contains the total length of the subobject in bytes,including L,Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. +// SetLength sets the FlowRSVPExplicitRouteLength value in the FlowRSVPPathExplicitRouteType1Ipv4Prefix object +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) SetLength(value FlowRSVPExplicitRouteLength) FlowRSVPPathExplicitRouteType1Ipv4Prefix { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// description is TBD +// Ipv4Address returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) Ipv4Address() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { + if obj.obj.Ipv4Address == nil { + obj.obj.Ipv4Address = NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address().msg() + } + if obj.ipv4AddressHolder == nil { + obj.ipv4AddressHolder = &patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address{obj: obj.obj.Ipv4Address} + } + return obj.ipv4AddressHolder +} + +// description is TBD +// Ipv4Address returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) HasIpv4Address() bool { + return obj.obj.Ipv4Address != nil +} + +// description is TBD +// SetIpv4Address sets the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address value in the FlowRSVPPathExplicitRouteType1Ipv4Prefix object +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) SetIpv4Address(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) FlowRSVPPathExplicitRouteType1Ipv4Prefix { + + obj.ipv4AddressHolder = nil + obj.obj.Ipv4Address = value.msg() + + return obj +} + +// The prefix length of the IPv4 address. +// Prefix returns a uint32 +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) Prefix() uint32 { + + return *obj.obj.Prefix + +} + +// The prefix length of the IPv4 address. +// Prefix returns a uint32 +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) HasPrefix() bool { + return obj.obj.Prefix != nil +} + +// The prefix length of the IPv4 address. +// SetPrefix sets the uint32 value in the FlowRSVPPathExplicitRouteType1Ipv4Prefix object +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) SetPrefix(value uint32) FlowRSVPPathExplicitRouteType1Ipv4Prefix { + + obj.obj.Prefix = &value + return obj +} + +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.LBit != nil { + + obj.LBit().validateObj(vObj, set_default) + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.Ipv4Address != nil { + + obj.Ipv4Address().validateObj(vObj, set_default) + } + + if obj.obj.Prefix != nil { + + if *obj.obj.Prefix < 1 || *obj.obj.Prefix > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= FlowRSVPPathExplicitRouteType1Ipv4Prefix.Prefix <= 32 but Got %d", *obj.obj.Prefix)) + } + + } + +} + +func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) setDefault() { + if obj.obj.Prefix == nil { + obj.SetPrefix(32) + } + +} diff --git a/gosnappi/flow_rsvp_path_label_request_without_label_range.go b/gosnappi/flow_rsvp_path_label_request_without_label_range.go new file mode 100644 index 00000000..84a34dfa --- /dev/null +++ b/gosnappi/flow_rsvp_path_label_request_without_label_range.go @@ -0,0 +1,369 @@ +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" +) + +// ***** FlowRSVPPathLabelRequestWithoutLabelRange ***** +type flowRSVPPathLabelRequestWithoutLabelRange struct { + validation + obj *otg.FlowRSVPPathLabelRequestWithoutLabelRange + marshaller marshalFlowRSVPPathLabelRequestWithoutLabelRange + unMarshaller unMarshalFlowRSVPPathLabelRequestWithoutLabelRange + reservedHolder PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + l3PidHolder PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid +} + +func NewFlowRSVPPathLabelRequestWithoutLabelRange() FlowRSVPPathLabelRequestWithoutLabelRange { + obj := flowRSVPPathLabelRequestWithoutLabelRange{obj: &otg.FlowRSVPPathLabelRequestWithoutLabelRange{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) msg() *otg.FlowRSVPPathLabelRequestWithoutLabelRange { + return obj.obj +} + +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) setMsg(msg *otg.FlowRSVPPathLabelRequestWithoutLabelRange) FlowRSVPPathLabelRequestWithoutLabelRange { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathLabelRequestWithoutLabelRange struct { + obj *flowRSVPPathLabelRequestWithoutLabelRange +} + +type marshalFlowRSVPPathLabelRequestWithoutLabelRange interface { + // ToProto marshals FlowRSVPPathLabelRequestWithoutLabelRange to protobuf object *otg.FlowRSVPPathLabelRequestWithoutLabelRange + ToProto() (*otg.FlowRSVPPathLabelRequestWithoutLabelRange, error) + // ToPbText marshals FlowRSVPPathLabelRequestWithoutLabelRange to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathLabelRequestWithoutLabelRange to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathLabelRequestWithoutLabelRange to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathLabelRequestWithoutLabelRange struct { + obj *flowRSVPPathLabelRequestWithoutLabelRange +} + +type unMarshalFlowRSVPPathLabelRequestWithoutLabelRange interface { + // FromProto unmarshals FlowRSVPPathLabelRequestWithoutLabelRange from protobuf object *otg.FlowRSVPPathLabelRequestWithoutLabelRange + FromProto(msg *otg.FlowRSVPPathLabelRequestWithoutLabelRange) (FlowRSVPPathLabelRequestWithoutLabelRange, error) + // FromPbText unmarshals FlowRSVPPathLabelRequestWithoutLabelRange from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathLabelRequestWithoutLabelRange from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathLabelRequestWithoutLabelRange from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) Marshal() marshalFlowRSVPPathLabelRequestWithoutLabelRange { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathLabelRequestWithoutLabelRange{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) Unmarshal() unMarshalFlowRSVPPathLabelRequestWithoutLabelRange { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathLabelRequestWithoutLabelRange{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathLabelRequestWithoutLabelRange) ToProto() (*otg.FlowRSVPPathLabelRequestWithoutLabelRange, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathLabelRequestWithoutLabelRange) FromProto(msg *otg.FlowRSVPPathLabelRequestWithoutLabelRange) (FlowRSVPPathLabelRequestWithoutLabelRange, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathLabelRequestWithoutLabelRange) 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 *unMarshalflowRSVPPathLabelRequestWithoutLabelRange) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathLabelRequestWithoutLabelRange) 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 *unMarshalflowRSVPPathLabelRequestWithoutLabelRange) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathLabelRequestWithoutLabelRange) 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 *unMarshalflowRSVPPathLabelRequestWithoutLabelRange) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) Clone() (FlowRSVPPathLabelRequestWithoutLabelRange, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathLabelRequestWithoutLabelRange() + 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 +} + +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) setNil() { + obj.reservedHolder = nil + obj.l3PidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathLabelRequestWithoutLabelRange is class = LABEL_REQUEST, Without Label Range C-Type = 1 +type FlowRSVPPathLabelRequestWithoutLabelRange interface { + Validation + // msg marshals FlowRSVPPathLabelRequestWithoutLabelRange to protobuf object *otg.FlowRSVPPathLabelRequestWithoutLabelRange + // and doesn't set defaults + msg() *otg.FlowRSVPPathLabelRequestWithoutLabelRange + // setMsg unmarshals FlowRSVPPathLabelRequestWithoutLabelRange from protobuf object *otg.FlowRSVPPathLabelRequestWithoutLabelRange + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathLabelRequestWithoutLabelRange) FlowRSVPPathLabelRequestWithoutLabelRange + // provides marshal interface + Marshal() marshalFlowRSVPPathLabelRequestWithoutLabelRange + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathLabelRequestWithoutLabelRange + // validate validates FlowRSVPPathLabelRequestWithoutLabelRange + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathLabelRequestWithoutLabelRange, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Reserved returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved, set in FlowRSVPPathLabelRequestWithoutLabelRange. + // PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved is this field is reserved. It MUST be set to zero on transmission and MUST be ignored on receipt. + Reserved() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + // SetReserved assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved provided by user to FlowRSVPPathLabelRequestWithoutLabelRange. + // PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved is this field is reserved. It MUST be set to zero on transmission and MUST be ignored on receipt. + SetReserved(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) FlowRSVPPathLabelRequestWithoutLabelRange + // HasReserved checks if Reserved has been set in FlowRSVPPathLabelRequestWithoutLabelRange + HasReserved() bool + // L3Pid returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid, set in FlowRSVPPathLabelRequestWithoutLabelRange. + L3Pid() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + // SetL3Pid assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid provided by user to FlowRSVPPathLabelRequestWithoutLabelRange. + SetL3Pid(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) FlowRSVPPathLabelRequestWithoutLabelRange + // HasL3Pid checks if L3Pid has been set in FlowRSVPPathLabelRequestWithoutLabelRange + HasL3Pid() bool + setNil() +} + +// description is TBD +// Reserved returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) Reserved() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { + if obj.obj.Reserved == nil { + obj.obj.Reserved = NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved().msg() + } + if obj.reservedHolder == nil { + obj.reservedHolder = &patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved{obj: obj.obj.Reserved} + } + return obj.reservedHolder +} + +// description is TBD +// Reserved returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) HasReserved() bool { + return obj.obj.Reserved != nil +} + +// description is TBD +// SetReserved sets the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved value in the FlowRSVPPathLabelRequestWithoutLabelRange object +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) SetReserved(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) FlowRSVPPathLabelRequestWithoutLabelRange { + + obj.reservedHolder = nil + obj.obj.Reserved = value.msg() + + return obj +} + +// description is TBD +// L3Pid returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) L3Pid() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { + if obj.obj.L3Pid == nil { + obj.obj.L3Pid = NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid().msg() + } + if obj.l3PidHolder == nil { + obj.l3PidHolder = &patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid{obj: obj.obj.L3Pid} + } + return obj.l3PidHolder +} + +// description is TBD +// L3Pid returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) HasL3Pid() bool { + return obj.obj.L3Pid != nil +} + +// description is TBD +// SetL3Pid sets the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid value in the FlowRSVPPathLabelRequestWithoutLabelRange object +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) SetL3Pid(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) FlowRSVPPathLabelRequestWithoutLabelRange { + + obj.l3PidHolder = nil + obj.obj.L3Pid = value.msg() + + return obj +} + +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Reserved != nil { + + obj.Reserved().validateObj(vObj, set_default) + } + + if obj.obj.L3Pid != nil { + + obj.L3Pid().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathLabelRequestWithoutLabelRange) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_message.go b/gosnappi/flow_rsvp_path_message.go new file mode 100644 index 00000000..11509ca6 --- /dev/null +++ b/gosnappi/flow_rsvp_path_message.go @@ -0,0 +1,390 @@ +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" +) + +// ***** FlowRSVPPathMessage ***** +type flowRSVPPathMessage struct { + validation + obj *otg.FlowRSVPPathMessage + marshaller marshalFlowRSVPPathMessage + unMarshaller unMarshalFlowRSVPPathMessage + objectsHolder FlowRSVPPathMessageFlowRSVPPathObjectsIter +} + +func NewFlowRSVPPathMessage() FlowRSVPPathMessage { + obj := flowRSVPPathMessage{obj: &otg.FlowRSVPPathMessage{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathMessage) msg() *otg.FlowRSVPPathMessage { + return obj.obj +} + +func (obj *flowRSVPPathMessage) setMsg(msg *otg.FlowRSVPPathMessage) FlowRSVPPathMessage { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathMessage struct { + obj *flowRSVPPathMessage +} + +type marshalFlowRSVPPathMessage interface { + // ToProto marshals FlowRSVPPathMessage to protobuf object *otg.FlowRSVPPathMessage + ToProto() (*otg.FlowRSVPPathMessage, error) + // ToPbText marshals FlowRSVPPathMessage to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathMessage to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathMessage to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathMessage struct { + obj *flowRSVPPathMessage +} + +type unMarshalFlowRSVPPathMessage interface { + // FromProto unmarshals FlowRSVPPathMessage from protobuf object *otg.FlowRSVPPathMessage + FromProto(msg *otg.FlowRSVPPathMessage) (FlowRSVPPathMessage, error) + // FromPbText unmarshals FlowRSVPPathMessage from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathMessage from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathMessage from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathMessage) Marshal() marshalFlowRSVPPathMessage { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathMessage{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathMessage) Unmarshal() unMarshalFlowRSVPPathMessage { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathMessage{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathMessage) ToProto() (*otg.FlowRSVPPathMessage, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathMessage) FromProto(msg *otg.FlowRSVPPathMessage) (FlowRSVPPathMessage, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathMessage) 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 *unMarshalflowRSVPPathMessage) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathMessage) 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 *unMarshalflowRSVPPathMessage) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathMessage) 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 *unMarshalflowRSVPPathMessage) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathMessage) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathMessage) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathMessage) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathMessage) Clone() (FlowRSVPPathMessage, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathMessage() + 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 +} + +func (obj *flowRSVPPathMessage) setNil() { + obj.objectsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathMessage is "Path" message requires the following list of objects in order as defined in https://www.rfc-editor.org/rfc/rfc3209.html#page-15: 1. SESSION 2. RSVP_HOP 3. TIME_VALUES 4. EXPLICIT_ROUTE [optional] 5. LABEL_REQUEST 6. SESSION_ATTRIBUTE [optional] 7. SENDER_TEMPLATE 8. SENDER_TSPEC 9. RECORD_ROUTE [optional] +type FlowRSVPPathMessage interface { + Validation + // msg marshals FlowRSVPPathMessage to protobuf object *otg.FlowRSVPPathMessage + // and doesn't set defaults + msg() *otg.FlowRSVPPathMessage + // setMsg unmarshals FlowRSVPPathMessage from protobuf object *otg.FlowRSVPPathMessage + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathMessage) FlowRSVPPathMessage + // provides marshal interface + Marshal() marshalFlowRSVPPathMessage + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathMessage + // validate validates FlowRSVPPathMessage + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathMessage, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Objects returns FlowRSVPPathMessageFlowRSVPPathObjectsIterIter, set in FlowRSVPPathMessage + Objects() FlowRSVPPathMessageFlowRSVPPathObjectsIter + setNil() +} + +// "Path" message requires atleast SESSION, RSVP_HOP, TIME_VALUES, LABEL_REQUEST, SENDER_TEMPLATE and SENDER_TSPEC objects in order. +// Objects returns a []FlowRSVPPathObjects +func (obj *flowRSVPPathMessage) Objects() FlowRSVPPathMessageFlowRSVPPathObjectsIter { + if len(obj.obj.Objects) == 0 { + obj.obj.Objects = []*otg.FlowRSVPPathObjects{} + } + if obj.objectsHolder == nil { + obj.objectsHolder = newFlowRSVPPathMessageFlowRSVPPathObjectsIter(&obj.obj.Objects).setMsg(obj) + } + return obj.objectsHolder +} + +type flowRSVPPathMessageFlowRSVPPathObjectsIter struct { + obj *flowRSVPPathMessage + flowRSVPPathObjectsSlice []FlowRSVPPathObjects + fieldPtr *[]*otg.FlowRSVPPathObjects +} + +func newFlowRSVPPathMessageFlowRSVPPathObjectsIter(ptr *[]*otg.FlowRSVPPathObjects) FlowRSVPPathMessageFlowRSVPPathObjectsIter { + return &flowRSVPPathMessageFlowRSVPPathObjectsIter{fieldPtr: ptr} +} + +type FlowRSVPPathMessageFlowRSVPPathObjectsIter interface { + setMsg(*flowRSVPPathMessage) FlowRSVPPathMessageFlowRSVPPathObjectsIter + Items() []FlowRSVPPathObjects + Add() FlowRSVPPathObjects + Append(items ...FlowRSVPPathObjects) FlowRSVPPathMessageFlowRSVPPathObjectsIter + Set(index int, newObj FlowRSVPPathObjects) FlowRSVPPathMessageFlowRSVPPathObjectsIter + Clear() FlowRSVPPathMessageFlowRSVPPathObjectsIter + clearHolderSlice() FlowRSVPPathMessageFlowRSVPPathObjectsIter + appendHolderSlice(item FlowRSVPPathObjects) FlowRSVPPathMessageFlowRSVPPathObjectsIter +} + +func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) setMsg(msg *flowRSVPPathMessage) FlowRSVPPathMessageFlowRSVPPathObjectsIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flowRSVPPathObjects{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) Items() []FlowRSVPPathObjects { + return obj.flowRSVPPathObjectsSlice +} + +func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) Add() FlowRSVPPathObjects { + newObj := &otg.FlowRSVPPathObjects{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flowRSVPPathObjects{obj: newObj} + newLibObj.setDefault() + obj.flowRSVPPathObjectsSlice = append(obj.flowRSVPPathObjectsSlice, newLibObj) + return newLibObj +} + +func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) Append(items ...FlowRSVPPathObjects) FlowRSVPPathMessageFlowRSVPPathObjectsIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowRSVPPathObjectsSlice = append(obj.flowRSVPPathObjectsSlice, item) + } + return obj +} + +func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) Set(index int, newObj FlowRSVPPathObjects) FlowRSVPPathMessageFlowRSVPPathObjectsIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowRSVPPathObjectsSlice[index] = newObj + return obj +} +func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) Clear() FlowRSVPPathMessageFlowRSVPPathObjectsIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.FlowRSVPPathObjects{} + obj.flowRSVPPathObjectsSlice = []FlowRSVPPathObjects{} + } + return obj +} +func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) clearHolderSlice() FlowRSVPPathMessageFlowRSVPPathObjectsIter { + if len(obj.flowRSVPPathObjectsSlice) > 0 { + obj.flowRSVPPathObjectsSlice = []FlowRSVPPathObjects{} + } + return obj +} +func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) appendHolderSlice(item FlowRSVPPathObjects) FlowRSVPPathMessageFlowRSVPPathObjectsIter { + obj.flowRSVPPathObjectsSlice = append(obj.flowRSVPPathObjectsSlice, item) + return obj +} + +func (obj *flowRSVPPathMessage) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Objects) != 0 { + + if set_default { + obj.Objects().clearHolderSlice() + for _, item := range obj.obj.Objects { + obj.Objects().appendHolderSlice(&flowRSVPPathObjects{obj: item}) + } + } + for _, item := range obj.Objects().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *flowRSVPPathMessage) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_objects.go b/gosnappi/flow_rsvp_path_objects.go new file mode 100644 index 00000000..f77ebd84 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects.go @@ -0,0 +1,328 @@ +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" +) + +// ***** FlowRSVPPathObjects ***** +type flowRSVPPathObjects struct { + validation + obj *otg.FlowRSVPPathObjects + marshaller marshalFlowRSVPPathObjects + unMarshaller unMarshalFlowRSVPPathObjects + classNumHolder FlowRSVPPathObjectsClass +} + +func NewFlowRSVPPathObjects() FlowRSVPPathObjects { + obj := flowRSVPPathObjects{obj: &otg.FlowRSVPPathObjects{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjects) msg() *otg.FlowRSVPPathObjects { + return obj.obj +} + +func (obj *flowRSVPPathObjects) setMsg(msg *otg.FlowRSVPPathObjects) FlowRSVPPathObjects { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjects struct { + obj *flowRSVPPathObjects +} + +type marshalFlowRSVPPathObjects interface { + // ToProto marshals FlowRSVPPathObjects to protobuf object *otg.FlowRSVPPathObjects + ToProto() (*otg.FlowRSVPPathObjects, error) + // ToPbText marshals FlowRSVPPathObjects to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjects to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjects to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjects struct { + obj *flowRSVPPathObjects +} + +type unMarshalFlowRSVPPathObjects interface { + // FromProto unmarshals FlowRSVPPathObjects from protobuf object *otg.FlowRSVPPathObjects + FromProto(msg *otg.FlowRSVPPathObjects) (FlowRSVPPathObjects, error) + // FromPbText unmarshals FlowRSVPPathObjects from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjects from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjects from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjects) Marshal() marshalFlowRSVPPathObjects { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjects{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjects) Unmarshal() unMarshalFlowRSVPPathObjects { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjects{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjects) ToProto() (*otg.FlowRSVPPathObjects, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjects) FromProto(msg *otg.FlowRSVPPathObjects) (FlowRSVPPathObjects, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjects) 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 *unMarshalflowRSVPPathObjects) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjects) 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 *unMarshalflowRSVPPathObjects) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjects) 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 *unMarshalflowRSVPPathObjects) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjects) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjects) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjects) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjects) Clone() (FlowRSVPPathObjects, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjects() + 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 +} + +func (obj *flowRSVPPathObjects) setNil() { + obj.classNumHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjects is every RSVP object encapsulated in an RSVP message consists of a 32-bit word header and the object's contents. +type FlowRSVPPathObjects interface { + Validation + // msg marshals FlowRSVPPathObjects to protobuf object *otg.FlowRSVPPathObjects + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjects + // setMsg unmarshals FlowRSVPPathObjects from protobuf object *otg.FlowRSVPPathObjects + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjects) FlowRSVPPathObjects + // provides marshal interface + Marshal() marshalFlowRSVPPathObjects + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjects + // validate validates FlowRSVPPathObjects + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjects, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ClassNum returns FlowRSVPPathObjectsClass, set in FlowRSVPPathObjects. + // FlowRSVPPathObjectsClass is the class number is used to identify the class of an object. Defined in https://www.iana.org/assignments/rsvp-parameters/rsvp-parameters.xhtml#rsvp-parameters-4 . Curently supported class numbers are for "Path" message type. "Path" message: Supported Class numbers and it's value: SESSION: 1, RSVP_HOP: 3, TIME_VALUES: 5, EXPLICIT_ROUTE: 20, LABEL_REQUEST: 19, SESSION_ATTRIBUTE: 207, SENDER_TEMPLATE: 11, SENDER_TSPEC: 12, RECORD_ROUTE: 21, Custom: User defined bytes based on class and c-types not supported in above options. + ClassNum() FlowRSVPPathObjectsClass + // SetClassNum assigns FlowRSVPPathObjectsClass provided by user to FlowRSVPPathObjects. + // FlowRSVPPathObjectsClass is the class number is used to identify the class of an object. Defined in https://www.iana.org/assignments/rsvp-parameters/rsvp-parameters.xhtml#rsvp-parameters-4 . Curently supported class numbers are for "Path" message type. "Path" message: Supported Class numbers and it's value: SESSION: 1, RSVP_HOP: 3, TIME_VALUES: 5, EXPLICIT_ROUTE: 20, LABEL_REQUEST: 19, SESSION_ATTRIBUTE: 207, SENDER_TEMPLATE: 11, SENDER_TSPEC: 12, RECORD_ROUTE: 21, Custom: User defined bytes based on class and c-types not supported in above options. + SetClassNum(value FlowRSVPPathObjectsClass) FlowRSVPPathObjects + // HasClassNum checks if ClassNum has been set in FlowRSVPPathObjects + HasClassNum() bool + setNil() +} + +// description is TBD +// ClassNum returns a FlowRSVPPathObjectsClass +func (obj *flowRSVPPathObjects) ClassNum() FlowRSVPPathObjectsClass { + if obj.obj.ClassNum == nil { + obj.obj.ClassNum = NewFlowRSVPPathObjectsClass().msg() + } + if obj.classNumHolder == nil { + obj.classNumHolder = &flowRSVPPathObjectsClass{obj: obj.obj.ClassNum} + } + return obj.classNumHolder +} + +// description is TBD +// ClassNum returns a FlowRSVPPathObjectsClass +func (obj *flowRSVPPathObjects) HasClassNum() bool { + return obj.obj.ClassNum != nil +} + +// description is TBD +// SetClassNum sets the FlowRSVPPathObjectsClass value in the FlowRSVPPathObjects object +func (obj *flowRSVPPathObjects) SetClassNum(value FlowRSVPPathObjectsClass) FlowRSVPPathObjects { + + obj.classNumHolder = nil + obj.obj.ClassNum = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjects) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.ClassNum != nil { + + obj.ClassNum().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjects) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_objects_class.go b/gosnappi/flow_rsvp_path_objects_class.go new file mode 100644 index 00000000..2f1a5d53 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_class.go @@ -0,0 +1,891 @@ +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" +) + +// ***** FlowRSVPPathObjectsClass ***** +type flowRSVPPathObjectsClass struct { + validation + obj *otg.FlowRSVPPathObjectsClass + marshaller marshalFlowRSVPPathObjectsClass + unMarshaller unMarshalFlowRSVPPathObjectsClass + sessionHolder FlowRSVPPathObjectsClassSession + rsvpHopHolder FlowRSVPPathObjectsClassRsvpHop + timeValuesHolder FlowRSVPPathObjectsClassTimeValues + explicitRouteHolder FlowRSVPPathObjectsClassExplicitRoute + labelRequestHolder FlowRSVPPathObjectsClassLabelRequest + sessionAttributeHolder FlowRSVPPathObjectsClassSessionAttribute + senderTemplateHolder FlowRSVPPathObjectsClassSenderTemplate + senderTspecHolder FlowRSVPPathObjectsClassSenderTspec + recordRouteHolder FlowRSVPPathObjectsClassRecordRoute + customHolder FlowRSVPPathObjectsCustom +} + +func NewFlowRSVPPathObjectsClass() FlowRSVPPathObjectsClass { + obj := flowRSVPPathObjectsClass{obj: &otg.FlowRSVPPathObjectsClass{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsClass) msg() *otg.FlowRSVPPathObjectsClass { + return obj.obj +} + +func (obj *flowRSVPPathObjectsClass) setMsg(msg *otg.FlowRSVPPathObjectsClass) FlowRSVPPathObjectsClass { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsClass struct { + obj *flowRSVPPathObjectsClass +} + +type marshalFlowRSVPPathObjectsClass interface { + // ToProto marshals FlowRSVPPathObjectsClass to protobuf object *otg.FlowRSVPPathObjectsClass + ToProto() (*otg.FlowRSVPPathObjectsClass, error) + // ToPbText marshals FlowRSVPPathObjectsClass to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsClass to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsClass to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsClass struct { + obj *flowRSVPPathObjectsClass +} + +type unMarshalFlowRSVPPathObjectsClass interface { + // FromProto unmarshals FlowRSVPPathObjectsClass from protobuf object *otg.FlowRSVPPathObjectsClass + FromProto(msg *otg.FlowRSVPPathObjectsClass) (FlowRSVPPathObjectsClass, error) + // FromPbText unmarshals FlowRSVPPathObjectsClass from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsClass from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsClass from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsClass) Marshal() marshalFlowRSVPPathObjectsClass { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsClass{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsClass) Unmarshal() unMarshalFlowRSVPPathObjectsClass { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsClass{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsClass) ToProto() (*otg.FlowRSVPPathObjectsClass, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsClass) FromProto(msg *otg.FlowRSVPPathObjectsClass) (FlowRSVPPathObjectsClass, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsClass) 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 *unMarshalflowRSVPPathObjectsClass) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsClass) 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 *unMarshalflowRSVPPathObjectsClass) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsClass) 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 *unMarshalflowRSVPPathObjectsClass) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsClass) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClass) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClass) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsClass) Clone() (FlowRSVPPathObjectsClass, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsClass() + 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 +} + +func (obj *flowRSVPPathObjectsClass) setNil() { + obj.sessionHolder = nil + obj.rsvpHopHolder = nil + obj.timeValuesHolder = nil + obj.explicitRouteHolder = nil + obj.labelRequestHolder = nil + obj.sessionAttributeHolder = nil + obj.senderTemplateHolder = nil + obj.senderTspecHolder = nil + obj.recordRouteHolder = nil + obj.customHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsClass is the class number is used to identify the class of an object. Defined in https://www.iana.org/assignments/rsvp-parameters/rsvp-parameters.xhtml#rsvp-parameters-4 . Curently supported class numbers are for "Path" message type. "Path" message: Supported Class numbers and it's value: SESSION: 1, RSVP_HOP: 3, TIME_VALUES: 5, EXPLICIT_ROUTE: 20, LABEL_REQUEST: 19, SESSION_ATTRIBUTE: 207, SENDER_TEMPLATE: 11, SENDER_TSPEC: 12, RECORD_ROUTE: 21, Custom: User defined bytes based on class and c-types not supported in above options. +type FlowRSVPPathObjectsClass interface { + Validation + // msg marshals FlowRSVPPathObjectsClass to protobuf object *otg.FlowRSVPPathObjectsClass + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsClass + // setMsg unmarshals FlowRSVPPathObjectsClass from protobuf object *otg.FlowRSVPPathObjectsClass + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsClass) FlowRSVPPathObjectsClass + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsClass + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsClass + // validate validates FlowRSVPPathObjectsClass + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsClass, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPPathObjectsClassChoiceEnum, set in FlowRSVPPathObjectsClass + Choice() FlowRSVPPathObjectsClassChoiceEnum + // setChoice assigns FlowRSVPPathObjectsClassChoiceEnum provided by user to FlowRSVPPathObjectsClass + setChoice(value FlowRSVPPathObjectsClassChoiceEnum) FlowRSVPPathObjectsClass + // Session returns FlowRSVPPathObjectsClassSession, set in FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassSession is c-Type is specific to a class num. + Session() FlowRSVPPathObjectsClassSession + // SetSession assigns FlowRSVPPathObjectsClassSession provided by user to FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassSession is c-Type is specific to a class num. + SetSession(value FlowRSVPPathObjectsClassSession) FlowRSVPPathObjectsClass + // HasSession checks if Session has been set in FlowRSVPPathObjectsClass + HasSession() bool + // RsvpHop returns FlowRSVPPathObjectsClassRsvpHop, set in FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassRsvpHop is c-Type is specific to a class num. + RsvpHop() FlowRSVPPathObjectsClassRsvpHop + // SetRsvpHop assigns FlowRSVPPathObjectsClassRsvpHop provided by user to FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassRsvpHop is c-Type is specific to a class num. + SetRsvpHop(value FlowRSVPPathObjectsClassRsvpHop) FlowRSVPPathObjectsClass + // HasRsvpHop checks if RsvpHop has been set in FlowRSVPPathObjectsClass + HasRsvpHop() bool + // TimeValues returns FlowRSVPPathObjectsClassTimeValues, set in FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassTimeValues is c-Type is specific to a class num. + TimeValues() FlowRSVPPathObjectsClassTimeValues + // SetTimeValues assigns FlowRSVPPathObjectsClassTimeValues provided by user to FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassTimeValues is c-Type is specific to a class num. + SetTimeValues(value FlowRSVPPathObjectsClassTimeValues) FlowRSVPPathObjectsClass + // HasTimeValues checks if TimeValues has been set in FlowRSVPPathObjectsClass + HasTimeValues() bool + // ExplicitRoute returns FlowRSVPPathObjectsClassExplicitRoute, set in FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassExplicitRoute is c-Type is specific to a class num. + ExplicitRoute() FlowRSVPPathObjectsClassExplicitRoute + // SetExplicitRoute assigns FlowRSVPPathObjectsClassExplicitRoute provided by user to FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassExplicitRoute is c-Type is specific to a class num. + SetExplicitRoute(value FlowRSVPPathObjectsClassExplicitRoute) FlowRSVPPathObjectsClass + // HasExplicitRoute checks if ExplicitRoute has been set in FlowRSVPPathObjectsClass + HasExplicitRoute() bool + // LabelRequest returns FlowRSVPPathObjectsClassLabelRequest, set in FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassLabelRequest is c-Type is specific to a class num. + LabelRequest() FlowRSVPPathObjectsClassLabelRequest + // SetLabelRequest assigns FlowRSVPPathObjectsClassLabelRequest provided by user to FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassLabelRequest is c-Type is specific to a class num. + SetLabelRequest(value FlowRSVPPathObjectsClassLabelRequest) FlowRSVPPathObjectsClass + // HasLabelRequest checks if LabelRequest has been set in FlowRSVPPathObjectsClass + HasLabelRequest() bool + // SessionAttribute returns FlowRSVPPathObjectsClassSessionAttribute, set in FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassSessionAttribute is c-Type is specific to a class num. + SessionAttribute() FlowRSVPPathObjectsClassSessionAttribute + // SetSessionAttribute assigns FlowRSVPPathObjectsClassSessionAttribute provided by user to FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassSessionAttribute is c-Type is specific to a class num. + SetSessionAttribute(value FlowRSVPPathObjectsClassSessionAttribute) FlowRSVPPathObjectsClass + // HasSessionAttribute checks if SessionAttribute has been set in FlowRSVPPathObjectsClass + HasSessionAttribute() bool + // SenderTemplate returns FlowRSVPPathObjectsClassSenderTemplate, set in FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassSenderTemplate is c-Type is specific to a class num. + SenderTemplate() FlowRSVPPathObjectsClassSenderTemplate + // SetSenderTemplate assigns FlowRSVPPathObjectsClassSenderTemplate provided by user to FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassSenderTemplate is c-Type is specific to a class num. + SetSenderTemplate(value FlowRSVPPathObjectsClassSenderTemplate) FlowRSVPPathObjectsClass + // HasSenderTemplate checks if SenderTemplate has been set in FlowRSVPPathObjectsClass + HasSenderTemplate() bool + // SenderTspec returns FlowRSVPPathObjectsClassSenderTspec, set in FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassSenderTspec is c-Type is specific to a class num. + SenderTspec() FlowRSVPPathObjectsClassSenderTspec + // SetSenderTspec assigns FlowRSVPPathObjectsClassSenderTspec provided by user to FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassSenderTspec is c-Type is specific to a class num. + SetSenderTspec(value FlowRSVPPathObjectsClassSenderTspec) FlowRSVPPathObjectsClass + // HasSenderTspec checks if SenderTspec has been set in FlowRSVPPathObjectsClass + HasSenderTspec() bool + // RecordRoute returns FlowRSVPPathObjectsClassRecordRoute, set in FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassRecordRoute is c-Type is specific to a class num. + RecordRoute() FlowRSVPPathObjectsClassRecordRoute + // SetRecordRoute assigns FlowRSVPPathObjectsClassRecordRoute provided by user to FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsClassRecordRoute is c-Type is specific to a class num. + SetRecordRoute(value FlowRSVPPathObjectsClassRecordRoute) FlowRSVPPathObjectsClass + // HasRecordRoute checks if RecordRoute has been set in FlowRSVPPathObjectsClass + HasRecordRoute() bool + // Custom returns FlowRSVPPathObjectsCustom, set in FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsCustom is custom packet header + Custom() FlowRSVPPathObjectsCustom + // SetCustom assigns FlowRSVPPathObjectsCustom provided by user to FlowRSVPPathObjectsClass. + // FlowRSVPPathObjectsCustom is custom packet header + SetCustom(value FlowRSVPPathObjectsCustom) FlowRSVPPathObjectsClass + // HasCustom checks if Custom has been set in FlowRSVPPathObjectsClass + HasCustom() bool + setNil() +} + +type FlowRSVPPathObjectsClassChoiceEnum string + +// Enum of Choice on FlowRSVPPathObjectsClass +var FlowRSVPPathObjectsClassChoice = struct { + SESSION FlowRSVPPathObjectsClassChoiceEnum + RSVP_HOP FlowRSVPPathObjectsClassChoiceEnum + TIME_VALUES FlowRSVPPathObjectsClassChoiceEnum + EXPLICIT_ROUTE FlowRSVPPathObjectsClassChoiceEnum + LABEL_REQUEST FlowRSVPPathObjectsClassChoiceEnum + SESSION_ATTRIBUTE FlowRSVPPathObjectsClassChoiceEnum + SENDER_TEMPLATE FlowRSVPPathObjectsClassChoiceEnum + SENDER_TSPEC FlowRSVPPathObjectsClassChoiceEnum + RECORD_ROUTE FlowRSVPPathObjectsClassChoiceEnum + CUSTOM FlowRSVPPathObjectsClassChoiceEnum +}{ + SESSION: FlowRSVPPathObjectsClassChoiceEnum("session"), + RSVP_HOP: FlowRSVPPathObjectsClassChoiceEnum("rsvp_hop"), + TIME_VALUES: FlowRSVPPathObjectsClassChoiceEnum("time_values"), + EXPLICIT_ROUTE: FlowRSVPPathObjectsClassChoiceEnum("explicit_route"), + LABEL_REQUEST: FlowRSVPPathObjectsClassChoiceEnum("label_request"), + SESSION_ATTRIBUTE: FlowRSVPPathObjectsClassChoiceEnum("session_attribute"), + SENDER_TEMPLATE: FlowRSVPPathObjectsClassChoiceEnum("sender_template"), + SENDER_TSPEC: FlowRSVPPathObjectsClassChoiceEnum("sender_tspec"), + RECORD_ROUTE: FlowRSVPPathObjectsClassChoiceEnum("record_route"), + CUSTOM: FlowRSVPPathObjectsClassChoiceEnum("custom"), +} + +func (obj *flowRSVPPathObjectsClass) Choice() FlowRSVPPathObjectsClassChoiceEnum { + return FlowRSVPPathObjectsClassChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *flowRSVPPathObjectsClass) setChoice(value FlowRSVPPathObjectsClassChoiceEnum) FlowRSVPPathObjectsClass { + intValue, ok := otg.FlowRSVPPathObjectsClass_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPPathObjectsClassChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPPathObjectsClass_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Custom = nil + obj.customHolder = nil + obj.obj.RecordRoute = nil + obj.recordRouteHolder = nil + obj.obj.SenderTspec = nil + obj.senderTspecHolder = nil + obj.obj.SenderTemplate = nil + obj.senderTemplateHolder = nil + obj.obj.SessionAttribute = nil + obj.sessionAttributeHolder = nil + obj.obj.LabelRequest = nil + obj.labelRequestHolder = nil + obj.obj.ExplicitRoute = nil + obj.explicitRouteHolder = nil + obj.obj.TimeValues = nil + obj.timeValuesHolder = nil + obj.obj.RsvpHop = nil + obj.rsvpHopHolder = nil + obj.obj.Session = nil + obj.sessionHolder = nil + + if value == FlowRSVPPathObjectsClassChoice.SESSION { + obj.obj.Session = NewFlowRSVPPathObjectsClassSession().msg() + } + + if value == FlowRSVPPathObjectsClassChoice.RSVP_HOP { + obj.obj.RsvpHop = NewFlowRSVPPathObjectsClassRsvpHop().msg() + } + + if value == FlowRSVPPathObjectsClassChoice.TIME_VALUES { + obj.obj.TimeValues = NewFlowRSVPPathObjectsClassTimeValues().msg() + } + + if value == FlowRSVPPathObjectsClassChoice.EXPLICIT_ROUTE { + obj.obj.ExplicitRoute = NewFlowRSVPPathObjectsClassExplicitRoute().msg() + } + + if value == FlowRSVPPathObjectsClassChoice.LABEL_REQUEST { + obj.obj.LabelRequest = NewFlowRSVPPathObjectsClassLabelRequest().msg() + } + + if value == FlowRSVPPathObjectsClassChoice.SESSION_ATTRIBUTE { + obj.obj.SessionAttribute = NewFlowRSVPPathObjectsClassSessionAttribute().msg() + } + + if value == FlowRSVPPathObjectsClassChoice.SENDER_TEMPLATE { + obj.obj.SenderTemplate = NewFlowRSVPPathObjectsClassSenderTemplate().msg() + } + + if value == FlowRSVPPathObjectsClassChoice.SENDER_TSPEC { + obj.obj.SenderTspec = NewFlowRSVPPathObjectsClassSenderTspec().msg() + } + + if value == FlowRSVPPathObjectsClassChoice.RECORD_ROUTE { + obj.obj.RecordRoute = NewFlowRSVPPathObjectsClassRecordRoute().msg() + } + + if value == FlowRSVPPathObjectsClassChoice.CUSTOM { + obj.obj.Custom = NewFlowRSVPPathObjectsCustom().msg() + } + + return obj +} + +// description is TBD +// Session returns a FlowRSVPPathObjectsClassSession +func (obj *flowRSVPPathObjectsClass) Session() FlowRSVPPathObjectsClassSession { + if obj.obj.Session == nil { + obj.setChoice(FlowRSVPPathObjectsClassChoice.SESSION) + } + if obj.sessionHolder == nil { + obj.sessionHolder = &flowRSVPPathObjectsClassSession{obj: obj.obj.Session} + } + return obj.sessionHolder +} + +// description is TBD +// Session returns a FlowRSVPPathObjectsClassSession +func (obj *flowRSVPPathObjectsClass) HasSession() bool { + return obj.obj.Session != nil +} + +// description is TBD +// SetSession sets the FlowRSVPPathObjectsClassSession value in the FlowRSVPPathObjectsClass object +func (obj *flowRSVPPathObjectsClass) SetSession(value FlowRSVPPathObjectsClassSession) FlowRSVPPathObjectsClass { + obj.setChoice(FlowRSVPPathObjectsClassChoice.SESSION) + obj.sessionHolder = nil + obj.obj.Session = value.msg() + + return obj +} + +// description is TBD +// RsvpHop returns a FlowRSVPPathObjectsClassRsvpHop +func (obj *flowRSVPPathObjectsClass) RsvpHop() FlowRSVPPathObjectsClassRsvpHop { + if obj.obj.RsvpHop == nil { + obj.setChoice(FlowRSVPPathObjectsClassChoice.RSVP_HOP) + } + if obj.rsvpHopHolder == nil { + obj.rsvpHopHolder = &flowRSVPPathObjectsClassRsvpHop{obj: obj.obj.RsvpHop} + } + return obj.rsvpHopHolder +} + +// description is TBD +// RsvpHop returns a FlowRSVPPathObjectsClassRsvpHop +func (obj *flowRSVPPathObjectsClass) HasRsvpHop() bool { + return obj.obj.RsvpHop != nil +} + +// description is TBD +// SetRsvpHop sets the FlowRSVPPathObjectsClassRsvpHop value in the FlowRSVPPathObjectsClass object +func (obj *flowRSVPPathObjectsClass) SetRsvpHop(value FlowRSVPPathObjectsClassRsvpHop) FlowRSVPPathObjectsClass { + obj.setChoice(FlowRSVPPathObjectsClassChoice.RSVP_HOP) + obj.rsvpHopHolder = nil + obj.obj.RsvpHop = value.msg() + + return obj +} + +// description is TBD +// TimeValues returns a FlowRSVPPathObjectsClassTimeValues +func (obj *flowRSVPPathObjectsClass) TimeValues() FlowRSVPPathObjectsClassTimeValues { + if obj.obj.TimeValues == nil { + obj.setChoice(FlowRSVPPathObjectsClassChoice.TIME_VALUES) + } + if obj.timeValuesHolder == nil { + obj.timeValuesHolder = &flowRSVPPathObjectsClassTimeValues{obj: obj.obj.TimeValues} + } + return obj.timeValuesHolder +} + +// description is TBD +// TimeValues returns a FlowRSVPPathObjectsClassTimeValues +func (obj *flowRSVPPathObjectsClass) HasTimeValues() bool { + return obj.obj.TimeValues != nil +} + +// description is TBD +// SetTimeValues sets the FlowRSVPPathObjectsClassTimeValues value in the FlowRSVPPathObjectsClass object +func (obj *flowRSVPPathObjectsClass) SetTimeValues(value FlowRSVPPathObjectsClassTimeValues) FlowRSVPPathObjectsClass { + obj.setChoice(FlowRSVPPathObjectsClassChoice.TIME_VALUES) + obj.timeValuesHolder = nil + obj.obj.TimeValues = value.msg() + + return obj +} + +// description is TBD +// ExplicitRoute returns a FlowRSVPPathObjectsClassExplicitRoute +func (obj *flowRSVPPathObjectsClass) ExplicitRoute() FlowRSVPPathObjectsClassExplicitRoute { + if obj.obj.ExplicitRoute == nil { + obj.setChoice(FlowRSVPPathObjectsClassChoice.EXPLICIT_ROUTE) + } + if obj.explicitRouteHolder == nil { + obj.explicitRouteHolder = &flowRSVPPathObjectsClassExplicitRoute{obj: obj.obj.ExplicitRoute} + } + return obj.explicitRouteHolder +} + +// description is TBD +// ExplicitRoute returns a FlowRSVPPathObjectsClassExplicitRoute +func (obj *flowRSVPPathObjectsClass) HasExplicitRoute() bool { + return obj.obj.ExplicitRoute != nil +} + +// description is TBD +// SetExplicitRoute sets the FlowRSVPPathObjectsClassExplicitRoute value in the FlowRSVPPathObjectsClass object +func (obj *flowRSVPPathObjectsClass) SetExplicitRoute(value FlowRSVPPathObjectsClassExplicitRoute) FlowRSVPPathObjectsClass { + obj.setChoice(FlowRSVPPathObjectsClassChoice.EXPLICIT_ROUTE) + obj.explicitRouteHolder = nil + obj.obj.ExplicitRoute = value.msg() + + return obj +} + +// description is TBD +// LabelRequest returns a FlowRSVPPathObjectsClassLabelRequest +func (obj *flowRSVPPathObjectsClass) LabelRequest() FlowRSVPPathObjectsClassLabelRequest { + if obj.obj.LabelRequest == nil { + obj.setChoice(FlowRSVPPathObjectsClassChoice.LABEL_REQUEST) + } + if obj.labelRequestHolder == nil { + obj.labelRequestHolder = &flowRSVPPathObjectsClassLabelRequest{obj: obj.obj.LabelRequest} + } + return obj.labelRequestHolder +} + +// description is TBD +// LabelRequest returns a FlowRSVPPathObjectsClassLabelRequest +func (obj *flowRSVPPathObjectsClass) HasLabelRequest() bool { + return obj.obj.LabelRequest != nil +} + +// description is TBD +// SetLabelRequest sets the FlowRSVPPathObjectsClassLabelRequest value in the FlowRSVPPathObjectsClass object +func (obj *flowRSVPPathObjectsClass) SetLabelRequest(value FlowRSVPPathObjectsClassLabelRequest) FlowRSVPPathObjectsClass { + obj.setChoice(FlowRSVPPathObjectsClassChoice.LABEL_REQUEST) + obj.labelRequestHolder = nil + obj.obj.LabelRequest = value.msg() + + return obj +} + +// description is TBD +// SessionAttribute returns a FlowRSVPPathObjectsClassSessionAttribute +func (obj *flowRSVPPathObjectsClass) SessionAttribute() FlowRSVPPathObjectsClassSessionAttribute { + if obj.obj.SessionAttribute == nil { + obj.setChoice(FlowRSVPPathObjectsClassChoice.SESSION_ATTRIBUTE) + } + if obj.sessionAttributeHolder == nil { + obj.sessionAttributeHolder = &flowRSVPPathObjectsClassSessionAttribute{obj: obj.obj.SessionAttribute} + } + return obj.sessionAttributeHolder +} + +// description is TBD +// SessionAttribute returns a FlowRSVPPathObjectsClassSessionAttribute +func (obj *flowRSVPPathObjectsClass) HasSessionAttribute() bool { + return obj.obj.SessionAttribute != nil +} + +// description is TBD +// SetSessionAttribute sets the FlowRSVPPathObjectsClassSessionAttribute value in the FlowRSVPPathObjectsClass object +func (obj *flowRSVPPathObjectsClass) SetSessionAttribute(value FlowRSVPPathObjectsClassSessionAttribute) FlowRSVPPathObjectsClass { + obj.setChoice(FlowRSVPPathObjectsClassChoice.SESSION_ATTRIBUTE) + obj.sessionAttributeHolder = nil + obj.obj.SessionAttribute = value.msg() + + return obj +} + +// description is TBD +// SenderTemplate returns a FlowRSVPPathObjectsClassSenderTemplate +func (obj *flowRSVPPathObjectsClass) SenderTemplate() FlowRSVPPathObjectsClassSenderTemplate { + if obj.obj.SenderTemplate == nil { + obj.setChoice(FlowRSVPPathObjectsClassChoice.SENDER_TEMPLATE) + } + if obj.senderTemplateHolder == nil { + obj.senderTemplateHolder = &flowRSVPPathObjectsClassSenderTemplate{obj: obj.obj.SenderTemplate} + } + return obj.senderTemplateHolder +} + +// description is TBD +// SenderTemplate returns a FlowRSVPPathObjectsClassSenderTemplate +func (obj *flowRSVPPathObjectsClass) HasSenderTemplate() bool { + return obj.obj.SenderTemplate != nil +} + +// description is TBD +// SetSenderTemplate sets the FlowRSVPPathObjectsClassSenderTemplate value in the FlowRSVPPathObjectsClass object +func (obj *flowRSVPPathObjectsClass) SetSenderTemplate(value FlowRSVPPathObjectsClassSenderTemplate) FlowRSVPPathObjectsClass { + obj.setChoice(FlowRSVPPathObjectsClassChoice.SENDER_TEMPLATE) + obj.senderTemplateHolder = nil + obj.obj.SenderTemplate = value.msg() + + return obj +} + +// description is TBD +// SenderTspec returns a FlowRSVPPathObjectsClassSenderTspec +func (obj *flowRSVPPathObjectsClass) SenderTspec() FlowRSVPPathObjectsClassSenderTspec { + if obj.obj.SenderTspec == nil { + obj.setChoice(FlowRSVPPathObjectsClassChoice.SENDER_TSPEC) + } + if obj.senderTspecHolder == nil { + obj.senderTspecHolder = &flowRSVPPathObjectsClassSenderTspec{obj: obj.obj.SenderTspec} + } + return obj.senderTspecHolder +} + +// description is TBD +// SenderTspec returns a FlowRSVPPathObjectsClassSenderTspec +func (obj *flowRSVPPathObjectsClass) HasSenderTspec() bool { + return obj.obj.SenderTspec != nil +} + +// description is TBD +// SetSenderTspec sets the FlowRSVPPathObjectsClassSenderTspec value in the FlowRSVPPathObjectsClass object +func (obj *flowRSVPPathObjectsClass) SetSenderTspec(value FlowRSVPPathObjectsClassSenderTspec) FlowRSVPPathObjectsClass { + obj.setChoice(FlowRSVPPathObjectsClassChoice.SENDER_TSPEC) + obj.senderTspecHolder = nil + obj.obj.SenderTspec = value.msg() + + return obj +} + +// description is TBD +// RecordRoute returns a FlowRSVPPathObjectsClassRecordRoute +func (obj *flowRSVPPathObjectsClass) RecordRoute() FlowRSVPPathObjectsClassRecordRoute { + if obj.obj.RecordRoute == nil { + obj.setChoice(FlowRSVPPathObjectsClassChoice.RECORD_ROUTE) + } + if obj.recordRouteHolder == nil { + obj.recordRouteHolder = &flowRSVPPathObjectsClassRecordRoute{obj: obj.obj.RecordRoute} + } + return obj.recordRouteHolder +} + +// description is TBD +// RecordRoute returns a FlowRSVPPathObjectsClassRecordRoute +func (obj *flowRSVPPathObjectsClass) HasRecordRoute() bool { + return obj.obj.RecordRoute != nil +} + +// description is TBD +// SetRecordRoute sets the FlowRSVPPathObjectsClassRecordRoute value in the FlowRSVPPathObjectsClass object +func (obj *flowRSVPPathObjectsClass) SetRecordRoute(value FlowRSVPPathObjectsClassRecordRoute) FlowRSVPPathObjectsClass { + obj.setChoice(FlowRSVPPathObjectsClassChoice.RECORD_ROUTE) + obj.recordRouteHolder = nil + obj.obj.RecordRoute = value.msg() + + return obj +} + +// description is TBD +// Custom returns a FlowRSVPPathObjectsCustom +func (obj *flowRSVPPathObjectsClass) Custom() FlowRSVPPathObjectsCustom { + if obj.obj.Custom == nil { + obj.setChoice(FlowRSVPPathObjectsClassChoice.CUSTOM) + } + if obj.customHolder == nil { + obj.customHolder = &flowRSVPPathObjectsCustom{obj: obj.obj.Custom} + } + return obj.customHolder +} + +// description is TBD +// Custom returns a FlowRSVPPathObjectsCustom +func (obj *flowRSVPPathObjectsClass) HasCustom() bool { + return obj.obj.Custom != nil +} + +// description is TBD +// SetCustom sets the FlowRSVPPathObjectsCustom value in the FlowRSVPPathObjectsClass object +func (obj *flowRSVPPathObjectsClass) SetCustom(value FlowRSVPPathObjectsCustom) FlowRSVPPathObjectsClass { + obj.setChoice(FlowRSVPPathObjectsClassChoice.CUSTOM) + obj.customHolder = nil + obj.obj.Custom = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsClass) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface FlowRSVPPathObjectsClass") + } + + if obj.obj.Session != nil { + + obj.Session().validateObj(vObj, set_default) + } + + if obj.obj.RsvpHop != nil { + + obj.RsvpHop().validateObj(vObj, set_default) + } + + if obj.obj.TimeValues != nil { + + obj.TimeValues().validateObj(vObj, set_default) + } + + if obj.obj.ExplicitRoute != nil { + + obj.ExplicitRoute().validateObj(vObj, set_default) + } + + if obj.obj.LabelRequest != nil { + + obj.LabelRequest().validateObj(vObj, set_default) + } + + if obj.obj.SessionAttribute != nil { + + obj.SessionAttribute().validateObj(vObj, set_default) + } + + if obj.obj.SenderTemplate != nil { + + obj.SenderTemplate().validateObj(vObj, set_default) + } + + if obj.obj.SenderTspec != nil { + + obj.SenderTspec().validateObj(vObj, set_default) + } + + if obj.obj.RecordRoute != nil { + + obj.RecordRoute().validateObj(vObj, set_default) + } + + if obj.obj.Custom != nil { + + obj.Custom().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsClass) setDefault() { + var choices_set int = 0 + var choice FlowRSVPPathObjectsClassChoiceEnum + + if obj.obj.Session != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsClassChoice.SESSION + } + + if obj.obj.RsvpHop != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsClassChoice.RSVP_HOP + } + + if obj.obj.TimeValues != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsClassChoice.TIME_VALUES + } + + if obj.obj.ExplicitRoute != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsClassChoice.EXPLICIT_ROUTE + } + + if obj.obj.LabelRequest != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsClassChoice.LABEL_REQUEST + } + + if obj.obj.SessionAttribute != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsClassChoice.SESSION_ATTRIBUTE + } + + if obj.obj.SenderTemplate != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsClassChoice.SENDER_TEMPLATE + } + + if obj.obj.SenderTspec != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsClassChoice.SENDER_TSPEC + } + + if obj.obj.RecordRoute != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsClassChoice.RECORD_ROUTE + } + + if obj.obj.Custom != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsClassChoice.CUSTOM + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsClass") + } + } else { + intVal := otg.FlowRSVPPathObjectsClass_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPPathObjectsClass_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_path_objects_class_explicit_route.go b/gosnappi/flow_rsvp_path_objects_class_explicit_route.go new file mode 100644 index 00000000..635dcb10 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_class_explicit_route.go @@ -0,0 +1,371 @@ +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" +) + +// ***** FlowRSVPPathObjectsClassExplicitRoute ***** +type flowRSVPPathObjectsClassExplicitRoute struct { + validation + obj *otg.FlowRSVPPathObjectsClassExplicitRoute + marshaller marshalFlowRSVPPathObjectsClassExplicitRoute + unMarshaller unMarshalFlowRSVPPathObjectsClassExplicitRoute + lengthHolder FlowRSVPObjectLength + cTypeHolder FlowRSVPPathObjectsClassExplicitRouteCType +} + +func NewFlowRSVPPathObjectsClassExplicitRoute() FlowRSVPPathObjectsClassExplicitRoute { + obj := flowRSVPPathObjectsClassExplicitRoute{obj: &otg.FlowRSVPPathObjectsClassExplicitRoute{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsClassExplicitRoute) msg() *otg.FlowRSVPPathObjectsClassExplicitRoute { + return obj.obj +} + +func (obj *flowRSVPPathObjectsClassExplicitRoute) setMsg(msg *otg.FlowRSVPPathObjectsClassExplicitRoute) FlowRSVPPathObjectsClassExplicitRoute { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsClassExplicitRoute struct { + obj *flowRSVPPathObjectsClassExplicitRoute +} + +type marshalFlowRSVPPathObjectsClassExplicitRoute interface { + // ToProto marshals FlowRSVPPathObjectsClassExplicitRoute to protobuf object *otg.FlowRSVPPathObjectsClassExplicitRoute + ToProto() (*otg.FlowRSVPPathObjectsClassExplicitRoute, error) + // ToPbText marshals FlowRSVPPathObjectsClassExplicitRoute to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsClassExplicitRoute to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsClassExplicitRoute to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsClassExplicitRoute struct { + obj *flowRSVPPathObjectsClassExplicitRoute +} + +type unMarshalFlowRSVPPathObjectsClassExplicitRoute interface { + // FromProto unmarshals FlowRSVPPathObjectsClassExplicitRoute from protobuf object *otg.FlowRSVPPathObjectsClassExplicitRoute + FromProto(msg *otg.FlowRSVPPathObjectsClassExplicitRoute) (FlowRSVPPathObjectsClassExplicitRoute, error) + // FromPbText unmarshals FlowRSVPPathObjectsClassExplicitRoute from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsClassExplicitRoute from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsClassExplicitRoute from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsClassExplicitRoute) Marshal() marshalFlowRSVPPathObjectsClassExplicitRoute { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsClassExplicitRoute{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsClassExplicitRoute) Unmarshal() unMarshalFlowRSVPPathObjectsClassExplicitRoute { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassExplicitRoute{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsClassExplicitRoute) ToProto() (*otg.FlowRSVPPathObjectsClassExplicitRoute, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsClassExplicitRoute) FromProto(msg *otg.FlowRSVPPathObjectsClassExplicitRoute) (FlowRSVPPathObjectsClassExplicitRoute, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsClassExplicitRoute) 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 *unMarshalflowRSVPPathObjectsClassExplicitRoute) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsClassExplicitRoute) 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 *unMarshalflowRSVPPathObjectsClassExplicitRoute) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsClassExplicitRoute) 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 *unMarshalflowRSVPPathObjectsClassExplicitRoute) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsClassExplicitRoute) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassExplicitRoute) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassExplicitRoute) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsClassExplicitRoute) Clone() (FlowRSVPPathObjectsClassExplicitRoute, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsClassExplicitRoute() + 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 +} + +func (obj *flowRSVPPathObjectsClassExplicitRoute) setNil() { + obj.lengthHolder = nil + obj.cTypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsClassExplicitRoute is c-Type is specific to a class num. +type FlowRSVPPathObjectsClassExplicitRoute interface { + Validation + // msg marshals FlowRSVPPathObjectsClassExplicitRoute to protobuf object *otg.FlowRSVPPathObjectsClassExplicitRoute + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsClassExplicitRoute + // setMsg unmarshals FlowRSVPPathObjectsClassExplicitRoute from protobuf object *otg.FlowRSVPPathObjectsClassExplicitRoute + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsClassExplicitRoute) FlowRSVPPathObjectsClassExplicitRoute + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsClassExplicitRoute + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsClassExplicitRoute + // validate validates FlowRSVPPathObjectsClassExplicitRoute + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsClassExplicitRoute, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassExplicitRoute. + // FlowRSVPObjectLength is description is TBD + Length() FlowRSVPObjectLength + // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassExplicitRoute. + // FlowRSVPObjectLength is description is TBD + SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassExplicitRoute + // HasLength checks if Length has been set in FlowRSVPPathObjectsClassExplicitRoute + HasLength() bool + // CType returns FlowRSVPPathObjectsClassExplicitRouteCType, set in FlowRSVPPathObjectsClassExplicitRoute. + // FlowRSVPPathObjectsClassExplicitRouteCType is object for EXPLICIT_ROUTE class and c-type is Type 1 Explicit Route (1). + CType() FlowRSVPPathObjectsClassExplicitRouteCType + // SetCType assigns FlowRSVPPathObjectsClassExplicitRouteCType provided by user to FlowRSVPPathObjectsClassExplicitRoute. + // FlowRSVPPathObjectsClassExplicitRouteCType is object for EXPLICIT_ROUTE class and c-type is Type 1 Explicit Route (1). + SetCType(value FlowRSVPPathObjectsClassExplicitRouteCType) FlowRSVPPathObjectsClassExplicitRoute + // HasCType checks if CType has been set in FlowRSVPPathObjectsClassExplicitRoute + HasCType() bool + setNil() +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassExplicitRoute) Length() FlowRSVPObjectLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowRSVPObjectLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassExplicitRoute) HasLength() bool { + return obj.obj.Length != nil +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassExplicitRoute object +func (obj *flowRSVPPathObjectsClassExplicitRoute) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassExplicitRoute { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsClassExplicitRouteCType +func (obj *flowRSVPPathObjectsClassExplicitRoute) CType() FlowRSVPPathObjectsClassExplicitRouteCType { + if obj.obj.CType == nil { + obj.obj.CType = NewFlowRSVPPathObjectsClassExplicitRouteCType().msg() + } + if obj.cTypeHolder == nil { + obj.cTypeHolder = &flowRSVPPathObjectsClassExplicitRouteCType{obj: obj.obj.CType} + } + return obj.cTypeHolder +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsClassExplicitRouteCType +func (obj *flowRSVPPathObjectsClassExplicitRoute) HasCType() bool { + return obj.obj.CType != nil +} + +// description is TBD +// SetCType sets the FlowRSVPPathObjectsClassExplicitRouteCType value in the FlowRSVPPathObjectsClassExplicitRoute object +func (obj *flowRSVPPathObjectsClassExplicitRoute) SetCType(value FlowRSVPPathObjectsClassExplicitRouteCType) FlowRSVPPathObjectsClassExplicitRoute { + + obj.cTypeHolder = nil + obj.obj.CType = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsClassExplicitRoute) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.CType != nil { + + obj.CType().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsClassExplicitRoute) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_objects_class_explicit_route_c_type.go b/gosnappi/flow_rsvp_path_objects_class_explicit_route_c_type.go new file mode 100644 index 00000000..90480b17 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_class_explicit_route_c_type.go @@ -0,0 +1,396 @@ +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" +) + +// ***** FlowRSVPPathObjectsClassExplicitRouteCType ***** +type flowRSVPPathObjectsClassExplicitRouteCType struct { + validation + obj *otg.FlowRSVPPathObjectsClassExplicitRouteCType + marshaller marshalFlowRSVPPathObjectsClassExplicitRouteCType + unMarshaller unMarshalFlowRSVPPathObjectsClassExplicitRouteCType + type_1Holder FlowRSVPPathExplicitRouteType1 +} + +func NewFlowRSVPPathObjectsClassExplicitRouteCType() FlowRSVPPathObjectsClassExplicitRouteCType { + obj := flowRSVPPathObjectsClassExplicitRouteCType{obj: &otg.FlowRSVPPathObjectsClassExplicitRouteCType{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) msg() *otg.FlowRSVPPathObjectsClassExplicitRouteCType { + return obj.obj +} + +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) setMsg(msg *otg.FlowRSVPPathObjectsClassExplicitRouteCType) FlowRSVPPathObjectsClassExplicitRouteCType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsClassExplicitRouteCType struct { + obj *flowRSVPPathObjectsClassExplicitRouteCType +} + +type marshalFlowRSVPPathObjectsClassExplicitRouteCType interface { + // ToProto marshals FlowRSVPPathObjectsClassExplicitRouteCType to protobuf object *otg.FlowRSVPPathObjectsClassExplicitRouteCType + ToProto() (*otg.FlowRSVPPathObjectsClassExplicitRouteCType, error) + // ToPbText marshals FlowRSVPPathObjectsClassExplicitRouteCType to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsClassExplicitRouteCType to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsClassExplicitRouteCType to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsClassExplicitRouteCType struct { + obj *flowRSVPPathObjectsClassExplicitRouteCType +} + +type unMarshalFlowRSVPPathObjectsClassExplicitRouteCType interface { + // FromProto unmarshals FlowRSVPPathObjectsClassExplicitRouteCType from protobuf object *otg.FlowRSVPPathObjectsClassExplicitRouteCType + FromProto(msg *otg.FlowRSVPPathObjectsClassExplicitRouteCType) (FlowRSVPPathObjectsClassExplicitRouteCType, error) + // FromPbText unmarshals FlowRSVPPathObjectsClassExplicitRouteCType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsClassExplicitRouteCType from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsClassExplicitRouteCType from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) Marshal() marshalFlowRSVPPathObjectsClassExplicitRouteCType { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsClassExplicitRouteCType{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) Unmarshal() unMarshalFlowRSVPPathObjectsClassExplicitRouteCType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassExplicitRouteCType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsClassExplicitRouteCType) ToProto() (*otg.FlowRSVPPathObjectsClassExplicitRouteCType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsClassExplicitRouteCType) FromProto(msg *otg.FlowRSVPPathObjectsClassExplicitRouteCType) (FlowRSVPPathObjectsClassExplicitRouteCType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsClassExplicitRouteCType) 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 *unMarshalflowRSVPPathObjectsClassExplicitRouteCType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsClassExplicitRouteCType) 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 *unMarshalflowRSVPPathObjectsClassExplicitRouteCType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsClassExplicitRouteCType) 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 *unMarshalflowRSVPPathObjectsClassExplicitRouteCType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) Clone() (FlowRSVPPathObjectsClassExplicitRouteCType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsClassExplicitRouteCType() + 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 +} + +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) setNil() { + obj.type_1Holder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsClassExplicitRouteCType is object for EXPLICIT_ROUTE class and c-type is Type 1 Explicit Route (1). +type FlowRSVPPathObjectsClassExplicitRouteCType interface { + Validation + // msg marshals FlowRSVPPathObjectsClassExplicitRouteCType to protobuf object *otg.FlowRSVPPathObjectsClassExplicitRouteCType + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsClassExplicitRouteCType + // setMsg unmarshals FlowRSVPPathObjectsClassExplicitRouteCType from protobuf object *otg.FlowRSVPPathObjectsClassExplicitRouteCType + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsClassExplicitRouteCType) FlowRSVPPathObjectsClassExplicitRouteCType + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsClassExplicitRouteCType + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsClassExplicitRouteCType + // validate validates FlowRSVPPathObjectsClassExplicitRouteCType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsClassExplicitRouteCType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum, set in FlowRSVPPathObjectsClassExplicitRouteCType + Choice() FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum + // setChoice assigns FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum provided by user to FlowRSVPPathObjectsClassExplicitRouteCType + setChoice(value FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum) FlowRSVPPathObjectsClassExplicitRouteCType + // HasChoice checks if Choice has been set in FlowRSVPPathObjectsClassExplicitRouteCType + HasChoice() bool + // Type1 returns FlowRSVPPathExplicitRouteType1, set in FlowRSVPPathObjectsClassExplicitRouteCType. + // FlowRSVPPathExplicitRouteType1 is type1 Explicit Route has subobjects. Currently supported subobjects are IPv4 prefix and Autonomous system number. + Type1() FlowRSVPPathExplicitRouteType1 + // SetType1 assigns FlowRSVPPathExplicitRouteType1 provided by user to FlowRSVPPathObjectsClassExplicitRouteCType. + // FlowRSVPPathExplicitRouteType1 is type1 Explicit Route has subobjects. Currently supported subobjects are IPv4 prefix and Autonomous system number. + SetType1(value FlowRSVPPathExplicitRouteType1) FlowRSVPPathObjectsClassExplicitRouteCType + // HasType1 checks if Type1 has been set in FlowRSVPPathObjectsClassExplicitRouteCType + HasType1() bool + setNil() +} + +type FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum string + +// Enum of Choice on FlowRSVPPathObjectsClassExplicitRouteCType +var FlowRSVPPathObjectsClassExplicitRouteCTypeChoice = struct { + TYPE_1 FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum +}{ + TYPE_1: FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum("type_1"), +} + +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) Choice() FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum { + return FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) setChoice(value FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum) FlowRSVPPathObjectsClassExplicitRouteCType { + intValue, ok := otg.FlowRSVPPathObjectsClassExplicitRouteCType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPPathObjectsClassExplicitRouteCType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Type_1 = nil + obj.type_1Holder = nil + + if value == FlowRSVPPathObjectsClassExplicitRouteCTypeChoice.TYPE_1 { + obj.obj.Type_1 = NewFlowRSVPPathExplicitRouteType1().msg() + } + + return obj +} + +// description is TBD +// Type1 returns a FlowRSVPPathExplicitRouteType1 +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) Type1() FlowRSVPPathExplicitRouteType1 { + if obj.obj.Type_1 == nil { + obj.setChoice(FlowRSVPPathObjectsClassExplicitRouteCTypeChoice.TYPE_1) + } + if obj.type_1Holder == nil { + obj.type_1Holder = &flowRSVPPathExplicitRouteType1{obj: obj.obj.Type_1} + } + return obj.type_1Holder +} + +// description is TBD +// Type1 returns a FlowRSVPPathExplicitRouteType1 +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) HasType1() bool { + return obj.obj.Type_1 != nil +} + +// description is TBD +// SetType1 sets the FlowRSVPPathExplicitRouteType1 value in the FlowRSVPPathObjectsClassExplicitRouteCType object +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) SetType1(value FlowRSVPPathExplicitRouteType1) FlowRSVPPathObjectsClassExplicitRouteCType { + obj.setChoice(FlowRSVPPathObjectsClassExplicitRouteCTypeChoice.TYPE_1) + obj.type_1Holder = nil + obj.obj.Type_1 = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Type_1 != nil { + + obj.Type1().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsClassExplicitRouteCType) setDefault() { + var choices_set int = 0 + var choice FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum + + if obj.obj.Type_1 != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsClassExplicitRouteCTypeChoice.TYPE_1 + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPPathObjectsClassExplicitRouteCTypeChoice.TYPE_1) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsClassExplicitRouteCType") + } + } else { + intVal := otg.FlowRSVPPathObjectsClassExplicitRouteCType_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPPathObjectsClassExplicitRouteCType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_path_objects_class_label_request.go b/gosnappi/flow_rsvp_path_objects_class_label_request.go new file mode 100644 index 00000000..004382dc --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_class_label_request.go @@ -0,0 +1,371 @@ +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" +) + +// ***** FlowRSVPPathObjectsClassLabelRequest ***** +type flowRSVPPathObjectsClassLabelRequest struct { + validation + obj *otg.FlowRSVPPathObjectsClassLabelRequest + marshaller marshalFlowRSVPPathObjectsClassLabelRequest + unMarshaller unMarshalFlowRSVPPathObjectsClassLabelRequest + lengthHolder FlowRSVPObjectLength + cTypeHolder FlowRSVPPathObjectsLabelRequestCType +} + +func NewFlowRSVPPathObjectsClassLabelRequest() FlowRSVPPathObjectsClassLabelRequest { + obj := flowRSVPPathObjectsClassLabelRequest{obj: &otg.FlowRSVPPathObjectsClassLabelRequest{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsClassLabelRequest) msg() *otg.FlowRSVPPathObjectsClassLabelRequest { + return obj.obj +} + +func (obj *flowRSVPPathObjectsClassLabelRequest) setMsg(msg *otg.FlowRSVPPathObjectsClassLabelRequest) FlowRSVPPathObjectsClassLabelRequest { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsClassLabelRequest struct { + obj *flowRSVPPathObjectsClassLabelRequest +} + +type marshalFlowRSVPPathObjectsClassLabelRequest interface { + // ToProto marshals FlowRSVPPathObjectsClassLabelRequest to protobuf object *otg.FlowRSVPPathObjectsClassLabelRequest + ToProto() (*otg.FlowRSVPPathObjectsClassLabelRequest, error) + // ToPbText marshals FlowRSVPPathObjectsClassLabelRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsClassLabelRequest to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsClassLabelRequest to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsClassLabelRequest struct { + obj *flowRSVPPathObjectsClassLabelRequest +} + +type unMarshalFlowRSVPPathObjectsClassLabelRequest interface { + // FromProto unmarshals FlowRSVPPathObjectsClassLabelRequest from protobuf object *otg.FlowRSVPPathObjectsClassLabelRequest + FromProto(msg *otg.FlowRSVPPathObjectsClassLabelRequest) (FlowRSVPPathObjectsClassLabelRequest, error) + // FromPbText unmarshals FlowRSVPPathObjectsClassLabelRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsClassLabelRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsClassLabelRequest from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsClassLabelRequest) Marshal() marshalFlowRSVPPathObjectsClassLabelRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsClassLabelRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsClassLabelRequest) Unmarshal() unMarshalFlowRSVPPathObjectsClassLabelRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassLabelRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsClassLabelRequest) ToProto() (*otg.FlowRSVPPathObjectsClassLabelRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsClassLabelRequest) FromProto(msg *otg.FlowRSVPPathObjectsClassLabelRequest) (FlowRSVPPathObjectsClassLabelRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsClassLabelRequest) 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 *unMarshalflowRSVPPathObjectsClassLabelRequest) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsClassLabelRequest) 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 *unMarshalflowRSVPPathObjectsClassLabelRequest) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsClassLabelRequest) 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 *unMarshalflowRSVPPathObjectsClassLabelRequest) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsClassLabelRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassLabelRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassLabelRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsClassLabelRequest) Clone() (FlowRSVPPathObjectsClassLabelRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsClassLabelRequest() + 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 +} + +func (obj *flowRSVPPathObjectsClassLabelRequest) setNil() { + obj.lengthHolder = nil + obj.cTypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsClassLabelRequest is c-Type is specific to a class num. +type FlowRSVPPathObjectsClassLabelRequest interface { + Validation + // msg marshals FlowRSVPPathObjectsClassLabelRequest to protobuf object *otg.FlowRSVPPathObjectsClassLabelRequest + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsClassLabelRequest + // setMsg unmarshals FlowRSVPPathObjectsClassLabelRequest from protobuf object *otg.FlowRSVPPathObjectsClassLabelRequest + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsClassLabelRequest) FlowRSVPPathObjectsClassLabelRequest + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsClassLabelRequest + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsClassLabelRequest + // validate validates FlowRSVPPathObjectsClassLabelRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsClassLabelRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassLabelRequest. + // FlowRSVPObjectLength is description is TBD + Length() FlowRSVPObjectLength + // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassLabelRequest. + // FlowRSVPObjectLength is description is TBD + SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassLabelRequest + // HasLength checks if Length has been set in FlowRSVPPathObjectsClassLabelRequest + HasLength() bool + // CType returns FlowRSVPPathObjectsLabelRequestCType, set in FlowRSVPPathObjectsClassLabelRequest. + // FlowRSVPPathObjectsLabelRequestCType is object for LABEL_REQUEST class. Currently supported c-type is Without Label Range (1). + CType() FlowRSVPPathObjectsLabelRequestCType + // SetCType assigns FlowRSVPPathObjectsLabelRequestCType provided by user to FlowRSVPPathObjectsClassLabelRequest. + // FlowRSVPPathObjectsLabelRequestCType is object for LABEL_REQUEST class. Currently supported c-type is Without Label Range (1). + SetCType(value FlowRSVPPathObjectsLabelRequestCType) FlowRSVPPathObjectsClassLabelRequest + // HasCType checks if CType has been set in FlowRSVPPathObjectsClassLabelRequest + HasCType() bool + setNil() +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassLabelRequest) Length() FlowRSVPObjectLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowRSVPObjectLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassLabelRequest) HasLength() bool { + return obj.obj.Length != nil +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassLabelRequest object +func (obj *flowRSVPPathObjectsClassLabelRequest) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassLabelRequest { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsLabelRequestCType +func (obj *flowRSVPPathObjectsClassLabelRequest) CType() FlowRSVPPathObjectsLabelRequestCType { + if obj.obj.CType == nil { + obj.obj.CType = NewFlowRSVPPathObjectsLabelRequestCType().msg() + } + if obj.cTypeHolder == nil { + obj.cTypeHolder = &flowRSVPPathObjectsLabelRequestCType{obj: obj.obj.CType} + } + return obj.cTypeHolder +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsLabelRequestCType +func (obj *flowRSVPPathObjectsClassLabelRequest) HasCType() bool { + return obj.obj.CType != nil +} + +// description is TBD +// SetCType sets the FlowRSVPPathObjectsLabelRequestCType value in the FlowRSVPPathObjectsClassLabelRequest object +func (obj *flowRSVPPathObjectsClassLabelRequest) SetCType(value FlowRSVPPathObjectsLabelRequestCType) FlowRSVPPathObjectsClassLabelRequest { + + obj.cTypeHolder = nil + obj.obj.CType = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsClassLabelRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.CType != nil { + + obj.CType().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsClassLabelRequest) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_objects_class_record_route.go b/gosnappi/flow_rsvp_path_objects_class_record_route.go new file mode 100644 index 00000000..555f7a79 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_class_record_route.go @@ -0,0 +1,371 @@ +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" +) + +// ***** FlowRSVPPathObjectsClassRecordRoute ***** +type flowRSVPPathObjectsClassRecordRoute struct { + validation + obj *otg.FlowRSVPPathObjectsClassRecordRoute + marshaller marshalFlowRSVPPathObjectsClassRecordRoute + unMarshaller unMarshalFlowRSVPPathObjectsClassRecordRoute + lengthHolder FlowRSVPObjectLength + cTypeHolder FlowRSVPPathObjectsRecordRouteCType +} + +func NewFlowRSVPPathObjectsClassRecordRoute() FlowRSVPPathObjectsClassRecordRoute { + obj := flowRSVPPathObjectsClassRecordRoute{obj: &otg.FlowRSVPPathObjectsClassRecordRoute{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsClassRecordRoute) msg() *otg.FlowRSVPPathObjectsClassRecordRoute { + return obj.obj +} + +func (obj *flowRSVPPathObjectsClassRecordRoute) setMsg(msg *otg.FlowRSVPPathObjectsClassRecordRoute) FlowRSVPPathObjectsClassRecordRoute { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsClassRecordRoute struct { + obj *flowRSVPPathObjectsClassRecordRoute +} + +type marshalFlowRSVPPathObjectsClassRecordRoute interface { + // ToProto marshals FlowRSVPPathObjectsClassRecordRoute to protobuf object *otg.FlowRSVPPathObjectsClassRecordRoute + ToProto() (*otg.FlowRSVPPathObjectsClassRecordRoute, error) + // ToPbText marshals FlowRSVPPathObjectsClassRecordRoute to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsClassRecordRoute to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsClassRecordRoute to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsClassRecordRoute struct { + obj *flowRSVPPathObjectsClassRecordRoute +} + +type unMarshalFlowRSVPPathObjectsClassRecordRoute interface { + // FromProto unmarshals FlowRSVPPathObjectsClassRecordRoute from protobuf object *otg.FlowRSVPPathObjectsClassRecordRoute + FromProto(msg *otg.FlowRSVPPathObjectsClassRecordRoute) (FlowRSVPPathObjectsClassRecordRoute, error) + // FromPbText unmarshals FlowRSVPPathObjectsClassRecordRoute from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsClassRecordRoute from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsClassRecordRoute from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsClassRecordRoute) Marshal() marshalFlowRSVPPathObjectsClassRecordRoute { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsClassRecordRoute{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsClassRecordRoute) Unmarshal() unMarshalFlowRSVPPathObjectsClassRecordRoute { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassRecordRoute{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsClassRecordRoute) ToProto() (*otg.FlowRSVPPathObjectsClassRecordRoute, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsClassRecordRoute) FromProto(msg *otg.FlowRSVPPathObjectsClassRecordRoute) (FlowRSVPPathObjectsClassRecordRoute, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsClassRecordRoute) 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 *unMarshalflowRSVPPathObjectsClassRecordRoute) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsClassRecordRoute) 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 *unMarshalflowRSVPPathObjectsClassRecordRoute) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsClassRecordRoute) 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 *unMarshalflowRSVPPathObjectsClassRecordRoute) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsClassRecordRoute) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassRecordRoute) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassRecordRoute) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsClassRecordRoute) Clone() (FlowRSVPPathObjectsClassRecordRoute, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsClassRecordRoute() + 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 +} + +func (obj *flowRSVPPathObjectsClassRecordRoute) setNil() { + obj.lengthHolder = nil + obj.cTypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsClassRecordRoute is c-Type is specific to a class num. +type FlowRSVPPathObjectsClassRecordRoute interface { + Validation + // msg marshals FlowRSVPPathObjectsClassRecordRoute to protobuf object *otg.FlowRSVPPathObjectsClassRecordRoute + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsClassRecordRoute + // setMsg unmarshals FlowRSVPPathObjectsClassRecordRoute from protobuf object *otg.FlowRSVPPathObjectsClassRecordRoute + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsClassRecordRoute) FlowRSVPPathObjectsClassRecordRoute + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsClassRecordRoute + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsClassRecordRoute + // validate validates FlowRSVPPathObjectsClassRecordRoute + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsClassRecordRoute, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassRecordRoute. + // FlowRSVPObjectLength is description is TBD + Length() FlowRSVPObjectLength + // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassRecordRoute. + // FlowRSVPObjectLength is description is TBD + SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassRecordRoute + // HasLength checks if Length has been set in FlowRSVPPathObjectsClassRecordRoute + HasLength() bool + // CType returns FlowRSVPPathObjectsRecordRouteCType, set in FlowRSVPPathObjectsClassRecordRoute. + // FlowRSVPPathObjectsRecordRouteCType is object for RECORD_ROUTE class. c-type is Type 1 Route Record (1). + CType() FlowRSVPPathObjectsRecordRouteCType + // SetCType assigns FlowRSVPPathObjectsRecordRouteCType provided by user to FlowRSVPPathObjectsClassRecordRoute. + // FlowRSVPPathObjectsRecordRouteCType is object for RECORD_ROUTE class. c-type is Type 1 Route Record (1). + SetCType(value FlowRSVPPathObjectsRecordRouteCType) FlowRSVPPathObjectsClassRecordRoute + // HasCType checks if CType has been set in FlowRSVPPathObjectsClassRecordRoute + HasCType() bool + setNil() +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassRecordRoute) Length() FlowRSVPObjectLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowRSVPObjectLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassRecordRoute) HasLength() bool { + return obj.obj.Length != nil +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassRecordRoute object +func (obj *flowRSVPPathObjectsClassRecordRoute) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassRecordRoute { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsRecordRouteCType +func (obj *flowRSVPPathObjectsClassRecordRoute) CType() FlowRSVPPathObjectsRecordRouteCType { + if obj.obj.CType == nil { + obj.obj.CType = NewFlowRSVPPathObjectsRecordRouteCType().msg() + } + if obj.cTypeHolder == nil { + obj.cTypeHolder = &flowRSVPPathObjectsRecordRouteCType{obj: obj.obj.CType} + } + return obj.cTypeHolder +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsRecordRouteCType +func (obj *flowRSVPPathObjectsClassRecordRoute) HasCType() bool { + return obj.obj.CType != nil +} + +// description is TBD +// SetCType sets the FlowRSVPPathObjectsRecordRouteCType value in the FlowRSVPPathObjectsClassRecordRoute object +func (obj *flowRSVPPathObjectsClassRecordRoute) SetCType(value FlowRSVPPathObjectsRecordRouteCType) FlowRSVPPathObjectsClassRecordRoute { + + obj.cTypeHolder = nil + obj.obj.CType = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsClassRecordRoute) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.CType != nil { + + obj.CType().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsClassRecordRoute) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_objects_class_rsvp_hop.go b/gosnappi/flow_rsvp_path_objects_class_rsvp_hop.go new file mode 100644 index 00000000..43074331 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_class_rsvp_hop.go @@ -0,0 +1,371 @@ +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" +) + +// ***** FlowRSVPPathObjectsClassRsvpHop ***** +type flowRSVPPathObjectsClassRsvpHop struct { + validation + obj *otg.FlowRSVPPathObjectsClassRsvpHop + marshaller marshalFlowRSVPPathObjectsClassRsvpHop + unMarshaller unMarshalFlowRSVPPathObjectsClassRsvpHop + lengthHolder FlowRSVPObjectLength + cTypeHolder FlowRSVPPathObjectsRsvpHopCType +} + +func NewFlowRSVPPathObjectsClassRsvpHop() FlowRSVPPathObjectsClassRsvpHop { + obj := flowRSVPPathObjectsClassRsvpHop{obj: &otg.FlowRSVPPathObjectsClassRsvpHop{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsClassRsvpHop) msg() *otg.FlowRSVPPathObjectsClassRsvpHop { + return obj.obj +} + +func (obj *flowRSVPPathObjectsClassRsvpHop) setMsg(msg *otg.FlowRSVPPathObjectsClassRsvpHop) FlowRSVPPathObjectsClassRsvpHop { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsClassRsvpHop struct { + obj *flowRSVPPathObjectsClassRsvpHop +} + +type marshalFlowRSVPPathObjectsClassRsvpHop interface { + // ToProto marshals FlowRSVPPathObjectsClassRsvpHop to protobuf object *otg.FlowRSVPPathObjectsClassRsvpHop + ToProto() (*otg.FlowRSVPPathObjectsClassRsvpHop, error) + // ToPbText marshals FlowRSVPPathObjectsClassRsvpHop to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsClassRsvpHop to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsClassRsvpHop to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsClassRsvpHop struct { + obj *flowRSVPPathObjectsClassRsvpHop +} + +type unMarshalFlowRSVPPathObjectsClassRsvpHop interface { + // FromProto unmarshals FlowRSVPPathObjectsClassRsvpHop from protobuf object *otg.FlowRSVPPathObjectsClassRsvpHop + FromProto(msg *otg.FlowRSVPPathObjectsClassRsvpHop) (FlowRSVPPathObjectsClassRsvpHop, error) + // FromPbText unmarshals FlowRSVPPathObjectsClassRsvpHop from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsClassRsvpHop from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsClassRsvpHop from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsClassRsvpHop) Marshal() marshalFlowRSVPPathObjectsClassRsvpHop { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsClassRsvpHop{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsClassRsvpHop) Unmarshal() unMarshalFlowRSVPPathObjectsClassRsvpHop { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassRsvpHop{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsClassRsvpHop) ToProto() (*otg.FlowRSVPPathObjectsClassRsvpHop, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsClassRsvpHop) FromProto(msg *otg.FlowRSVPPathObjectsClassRsvpHop) (FlowRSVPPathObjectsClassRsvpHop, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsClassRsvpHop) 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 *unMarshalflowRSVPPathObjectsClassRsvpHop) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsClassRsvpHop) 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 *unMarshalflowRSVPPathObjectsClassRsvpHop) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsClassRsvpHop) 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 *unMarshalflowRSVPPathObjectsClassRsvpHop) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsClassRsvpHop) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassRsvpHop) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassRsvpHop) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsClassRsvpHop) Clone() (FlowRSVPPathObjectsClassRsvpHop, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsClassRsvpHop() + 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 +} + +func (obj *flowRSVPPathObjectsClassRsvpHop) setNil() { + obj.lengthHolder = nil + obj.cTypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsClassRsvpHop is c-Type is specific to a class num. +type FlowRSVPPathObjectsClassRsvpHop interface { + Validation + // msg marshals FlowRSVPPathObjectsClassRsvpHop to protobuf object *otg.FlowRSVPPathObjectsClassRsvpHop + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsClassRsvpHop + // setMsg unmarshals FlowRSVPPathObjectsClassRsvpHop from protobuf object *otg.FlowRSVPPathObjectsClassRsvpHop + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsClassRsvpHop) FlowRSVPPathObjectsClassRsvpHop + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsClassRsvpHop + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsClassRsvpHop + // validate validates FlowRSVPPathObjectsClassRsvpHop + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsClassRsvpHop, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassRsvpHop. + // FlowRSVPObjectLength is description is TBD + Length() FlowRSVPObjectLength + // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassRsvpHop. + // FlowRSVPObjectLength is description is TBD + SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassRsvpHop + // HasLength checks if Length has been set in FlowRSVPPathObjectsClassRsvpHop + HasLength() bool + // CType returns FlowRSVPPathObjectsRsvpHopCType, set in FlowRSVPPathObjectsClassRsvpHop. + // FlowRSVPPathObjectsRsvpHopCType is object for RSVP_HOP class. Currently supported c-type is IPv4 (1). + CType() FlowRSVPPathObjectsRsvpHopCType + // SetCType assigns FlowRSVPPathObjectsRsvpHopCType provided by user to FlowRSVPPathObjectsClassRsvpHop. + // FlowRSVPPathObjectsRsvpHopCType is object for RSVP_HOP class. Currently supported c-type is IPv4 (1). + SetCType(value FlowRSVPPathObjectsRsvpHopCType) FlowRSVPPathObjectsClassRsvpHop + // HasCType checks if CType has been set in FlowRSVPPathObjectsClassRsvpHop + HasCType() bool + setNil() +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassRsvpHop) Length() FlowRSVPObjectLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowRSVPObjectLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassRsvpHop) HasLength() bool { + return obj.obj.Length != nil +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassRsvpHop object +func (obj *flowRSVPPathObjectsClassRsvpHop) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassRsvpHop { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsRsvpHopCType +func (obj *flowRSVPPathObjectsClassRsvpHop) CType() FlowRSVPPathObjectsRsvpHopCType { + if obj.obj.CType == nil { + obj.obj.CType = NewFlowRSVPPathObjectsRsvpHopCType().msg() + } + if obj.cTypeHolder == nil { + obj.cTypeHolder = &flowRSVPPathObjectsRsvpHopCType{obj: obj.obj.CType} + } + return obj.cTypeHolder +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsRsvpHopCType +func (obj *flowRSVPPathObjectsClassRsvpHop) HasCType() bool { + return obj.obj.CType != nil +} + +// description is TBD +// SetCType sets the FlowRSVPPathObjectsRsvpHopCType value in the FlowRSVPPathObjectsClassRsvpHop object +func (obj *flowRSVPPathObjectsClassRsvpHop) SetCType(value FlowRSVPPathObjectsRsvpHopCType) FlowRSVPPathObjectsClassRsvpHop { + + obj.cTypeHolder = nil + obj.obj.CType = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsClassRsvpHop) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.CType != nil { + + obj.CType().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsClassRsvpHop) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_objects_class_sender_template.go b/gosnappi/flow_rsvp_path_objects_class_sender_template.go new file mode 100644 index 00000000..b69684ef --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_class_sender_template.go @@ -0,0 +1,371 @@ +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" +) + +// ***** FlowRSVPPathObjectsClassSenderTemplate ***** +type flowRSVPPathObjectsClassSenderTemplate struct { + validation + obj *otg.FlowRSVPPathObjectsClassSenderTemplate + marshaller marshalFlowRSVPPathObjectsClassSenderTemplate + unMarshaller unMarshalFlowRSVPPathObjectsClassSenderTemplate + lengthHolder FlowRSVPObjectLength + cTypeHolder FlowRSVPPathObjectsSenderTemplateCType +} + +func NewFlowRSVPPathObjectsClassSenderTemplate() FlowRSVPPathObjectsClassSenderTemplate { + obj := flowRSVPPathObjectsClassSenderTemplate{obj: &otg.FlowRSVPPathObjectsClassSenderTemplate{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsClassSenderTemplate) msg() *otg.FlowRSVPPathObjectsClassSenderTemplate { + return obj.obj +} + +func (obj *flowRSVPPathObjectsClassSenderTemplate) setMsg(msg *otg.FlowRSVPPathObjectsClassSenderTemplate) FlowRSVPPathObjectsClassSenderTemplate { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsClassSenderTemplate struct { + obj *flowRSVPPathObjectsClassSenderTemplate +} + +type marshalFlowRSVPPathObjectsClassSenderTemplate interface { + // ToProto marshals FlowRSVPPathObjectsClassSenderTemplate to protobuf object *otg.FlowRSVPPathObjectsClassSenderTemplate + ToProto() (*otg.FlowRSVPPathObjectsClassSenderTemplate, error) + // ToPbText marshals FlowRSVPPathObjectsClassSenderTemplate to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsClassSenderTemplate to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsClassSenderTemplate to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsClassSenderTemplate struct { + obj *flowRSVPPathObjectsClassSenderTemplate +} + +type unMarshalFlowRSVPPathObjectsClassSenderTemplate interface { + // FromProto unmarshals FlowRSVPPathObjectsClassSenderTemplate from protobuf object *otg.FlowRSVPPathObjectsClassSenderTemplate + FromProto(msg *otg.FlowRSVPPathObjectsClassSenderTemplate) (FlowRSVPPathObjectsClassSenderTemplate, error) + // FromPbText unmarshals FlowRSVPPathObjectsClassSenderTemplate from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsClassSenderTemplate from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsClassSenderTemplate from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsClassSenderTemplate) Marshal() marshalFlowRSVPPathObjectsClassSenderTemplate { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsClassSenderTemplate{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsClassSenderTemplate) Unmarshal() unMarshalFlowRSVPPathObjectsClassSenderTemplate { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassSenderTemplate{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsClassSenderTemplate) ToProto() (*otg.FlowRSVPPathObjectsClassSenderTemplate, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsClassSenderTemplate) FromProto(msg *otg.FlowRSVPPathObjectsClassSenderTemplate) (FlowRSVPPathObjectsClassSenderTemplate, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsClassSenderTemplate) 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 *unMarshalflowRSVPPathObjectsClassSenderTemplate) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsClassSenderTemplate) 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 *unMarshalflowRSVPPathObjectsClassSenderTemplate) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsClassSenderTemplate) 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 *unMarshalflowRSVPPathObjectsClassSenderTemplate) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsClassSenderTemplate) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassSenderTemplate) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassSenderTemplate) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsClassSenderTemplate) Clone() (FlowRSVPPathObjectsClassSenderTemplate, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsClassSenderTemplate() + 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 +} + +func (obj *flowRSVPPathObjectsClassSenderTemplate) setNil() { + obj.lengthHolder = nil + obj.cTypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsClassSenderTemplate is c-Type is specific to a class num. +type FlowRSVPPathObjectsClassSenderTemplate interface { + Validation + // msg marshals FlowRSVPPathObjectsClassSenderTemplate to protobuf object *otg.FlowRSVPPathObjectsClassSenderTemplate + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsClassSenderTemplate + // setMsg unmarshals FlowRSVPPathObjectsClassSenderTemplate from protobuf object *otg.FlowRSVPPathObjectsClassSenderTemplate + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsClassSenderTemplate) FlowRSVPPathObjectsClassSenderTemplate + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsClassSenderTemplate + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsClassSenderTemplate + // validate validates FlowRSVPPathObjectsClassSenderTemplate + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsClassSenderTemplate, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassSenderTemplate. + // FlowRSVPObjectLength is description is TBD + Length() FlowRSVPObjectLength + // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassSenderTemplate. + // FlowRSVPObjectLength is description is TBD + SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSenderTemplate + // HasLength checks if Length has been set in FlowRSVPPathObjectsClassSenderTemplate + HasLength() bool + // CType returns FlowRSVPPathObjectsSenderTemplateCType, set in FlowRSVPPathObjectsClassSenderTemplate. + // FlowRSVPPathObjectsSenderTemplateCType is object for SENDER_TEMPLATE class. Currently supported c-type is LSP Tunnel IPv4 (7). + CType() FlowRSVPPathObjectsSenderTemplateCType + // SetCType assigns FlowRSVPPathObjectsSenderTemplateCType provided by user to FlowRSVPPathObjectsClassSenderTemplate. + // FlowRSVPPathObjectsSenderTemplateCType is object for SENDER_TEMPLATE class. Currently supported c-type is LSP Tunnel IPv4 (7). + SetCType(value FlowRSVPPathObjectsSenderTemplateCType) FlowRSVPPathObjectsClassSenderTemplate + // HasCType checks if CType has been set in FlowRSVPPathObjectsClassSenderTemplate + HasCType() bool + setNil() +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassSenderTemplate) Length() FlowRSVPObjectLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowRSVPObjectLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassSenderTemplate) HasLength() bool { + return obj.obj.Length != nil +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassSenderTemplate object +func (obj *flowRSVPPathObjectsClassSenderTemplate) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSenderTemplate { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsSenderTemplateCType +func (obj *flowRSVPPathObjectsClassSenderTemplate) CType() FlowRSVPPathObjectsSenderTemplateCType { + if obj.obj.CType == nil { + obj.obj.CType = NewFlowRSVPPathObjectsSenderTemplateCType().msg() + } + if obj.cTypeHolder == nil { + obj.cTypeHolder = &flowRSVPPathObjectsSenderTemplateCType{obj: obj.obj.CType} + } + return obj.cTypeHolder +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsSenderTemplateCType +func (obj *flowRSVPPathObjectsClassSenderTemplate) HasCType() bool { + return obj.obj.CType != nil +} + +// description is TBD +// SetCType sets the FlowRSVPPathObjectsSenderTemplateCType value in the FlowRSVPPathObjectsClassSenderTemplate object +func (obj *flowRSVPPathObjectsClassSenderTemplate) SetCType(value FlowRSVPPathObjectsSenderTemplateCType) FlowRSVPPathObjectsClassSenderTemplate { + + obj.cTypeHolder = nil + obj.obj.CType = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsClassSenderTemplate) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.CType != nil { + + obj.CType().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsClassSenderTemplate) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_objects_class_sender_tspec.go b/gosnappi/flow_rsvp_path_objects_class_sender_tspec.go new file mode 100644 index 00000000..d3b2fba5 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_class_sender_tspec.go @@ -0,0 +1,371 @@ +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" +) + +// ***** FlowRSVPPathObjectsClassSenderTspec ***** +type flowRSVPPathObjectsClassSenderTspec struct { + validation + obj *otg.FlowRSVPPathObjectsClassSenderTspec + marshaller marshalFlowRSVPPathObjectsClassSenderTspec + unMarshaller unMarshalFlowRSVPPathObjectsClassSenderTspec + lengthHolder FlowRSVPObjectLength + cTypeHolder FlowRSVPPathObjectsSenderTspecCType +} + +func NewFlowRSVPPathObjectsClassSenderTspec() FlowRSVPPathObjectsClassSenderTspec { + obj := flowRSVPPathObjectsClassSenderTspec{obj: &otg.FlowRSVPPathObjectsClassSenderTspec{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsClassSenderTspec) msg() *otg.FlowRSVPPathObjectsClassSenderTspec { + return obj.obj +} + +func (obj *flowRSVPPathObjectsClassSenderTspec) setMsg(msg *otg.FlowRSVPPathObjectsClassSenderTspec) FlowRSVPPathObjectsClassSenderTspec { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsClassSenderTspec struct { + obj *flowRSVPPathObjectsClassSenderTspec +} + +type marshalFlowRSVPPathObjectsClassSenderTspec interface { + // ToProto marshals FlowRSVPPathObjectsClassSenderTspec to protobuf object *otg.FlowRSVPPathObjectsClassSenderTspec + ToProto() (*otg.FlowRSVPPathObjectsClassSenderTspec, error) + // ToPbText marshals FlowRSVPPathObjectsClassSenderTspec to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsClassSenderTspec to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsClassSenderTspec to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsClassSenderTspec struct { + obj *flowRSVPPathObjectsClassSenderTspec +} + +type unMarshalFlowRSVPPathObjectsClassSenderTspec interface { + // FromProto unmarshals FlowRSVPPathObjectsClassSenderTspec from protobuf object *otg.FlowRSVPPathObjectsClassSenderTspec + FromProto(msg *otg.FlowRSVPPathObjectsClassSenderTspec) (FlowRSVPPathObjectsClassSenderTspec, error) + // FromPbText unmarshals FlowRSVPPathObjectsClassSenderTspec from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsClassSenderTspec from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsClassSenderTspec from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsClassSenderTspec) Marshal() marshalFlowRSVPPathObjectsClassSenderTspec { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsClassSenderTspec{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsClassSenderTspec) Unmarshal() unMarshalFlowRSVPPathObjectsClassSenderTspec { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassSenderTspec{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsClassSenderTspec) ToProto() (*otg.FlowRSVPPathObjectsClassSenderTspec, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsClassSenderTspec) FromProto(msg *otg.FlowRSVPPathObjectsClassSenderTspec) (FlowRSVPPathObjectsClassSenderTspec, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsClassSenderTspec) 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 *unMarshalflowRSVPPathObjectsClassSenderTspec) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsClassSenderTspec) 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 *unMarshalflowRSVPPathObjectsClassSenderTspec) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsClassSenderTspec) 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 *unMarshalflowRSVPPathObjectsClassSenderTspec) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsClassSenderTspec) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassSenderTspec) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassSenderTspec) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsClassSenderTspec) Clone() (FlowRSVPPathObjectsClassSenderTspec, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsClassSenderTspec() + 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 +} + +func (obj *flowRSVPPathObjectsClassSenderTspec) setNil() { + obj.lengthHolder = nil + obj.cTypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsClassSenderTspec is c-Type is specific to a class num. +type FlowRSVPPathObjectsClassSenderTspec interface { + Validation + // msg marshals FlowRSVPPathObjectsClassSenderTspec to protobuf object *otg.FlowRSVPPathObjectsClassSenderTspec + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsClassSenderTspec + // setMsg unmarshals FlowRSVPPathObjectsClassSenderTspec from protobuf object *otg.FlowRSVPPathObjectsClassSenderTspec + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsClassSenderTspec) FlowRSVPPathObjectsClassSenderTspec + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsClassSenderTspec + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsClassSenderTspec + // validate validates FlowRSVPPathObjectsClassSenderTspec + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsClassSenderTspec, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassSenderTspec. + // FlowRSVPObjectLength is description is TBD + Length() FlowRSVPObjectLength + // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassSenderTspec. + // FlowRSVPObjectLength is description is TBD + SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSenderTspec + // HasLength checks if Length has been set in FlowRSVPPathObjectsClassSenderTspec + HasLength() bool + // CType returns FlowRSVPPathObjectsSenderTspecCType, set in FlowRSVPPathObjectsClassSenderTspec. + // FlowRSVPPathObjectsSenderTspecCType is object for SENDER_TSPEC class. Currently supported c-type is int-serv (2). + CType() FlowRSVPPathObjectsSenderTspecCType + // SetCType assigns FlowRSVPPathObjectsSenderTspecCType provided by user to FlowRSVPPathObjectsClassSenderTspec. + // FlowRSVPPathObjectsSenderTspecCType is object for SENDER_TSPEC class. Currently supported c-type is int-serv (2). + SetCType(value FlowRSVPPathObjectsSenderTspecCType) FlowRSVPPathObjectsClassSenderTspec + // HasCType checks if CType has been set in FlowRSVPPathObjectsClassSenderTspec + HasCType() bool + setNil() +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassSenderTspec) Length() FlowRSVPObjectLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowRSVPObjectLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassSenderTspec) HasLength() bool { + return obj.obj.Length != nil +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassSenderTspec object +func (obj *flowRSVPPathObjectsClassSenderTspec) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSenderTspec { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsSenderTspecCType +func (obj *flowRSVPPathObjectsClassSenderTspec) CType() FlowRSVPPathObjectsSenderTspecCType { + if obj.obj.CType == nil { + obj.obj.CType = NewFlowRSVPPathObjectsSenderTspecCType().msg() + } + if obj.cTypeHolder == nil { + obj.cTypeHolder = &flowRSVPPathObjectsSenderTspecCType{obj: obj.obj.CType} + } + return obj.cTypeHolder +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsSenderTspecCType +func (obj *flowRSVPPathObjectsClassSenderTspec) HasCType() bool { + return obj.obj.CType != nil +} + +// description is TBD +// SetCType sets the FlowRSVPPathObjectsSenderTspecCType value in the FlowRSVPPathObjectsClassSenderTspec object +func (obj *flowRSVPPathObjectsClassSenderTspec) SetCType(value FlowRSVPPathObjectsSenderTspecCType) FlowRSVPPathObjectsClassSenderTspec { + + obj.cTypeHolder = nil + obj.obj.CType = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsClassSenderTspec) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.CType != nil { + + obj.CType().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsClassSenderTspec) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_objects_class_session.go b/gosnappi/flow_rsvp_path_objects_class_session.go new file mode 100644 index 00000000..1f9c86d6 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_class_session.go @@ -0,0 +1,371 @@ +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" +) + +// ***** FlowRSVPPathObjectsClassSession ***** +type flowRSVPPathObjectsClassSession struct { + validation + obj *otg.FlowRSVPPathObjectsClassSession + marshaller marshalFlowRSVPPathObjectsClassSession + unMarshaller unMarshalFlowRSVPPathObjectsClassSession + lengthHolder FlowRSVPObjectLength + cTypeHolder FlowRSVPPathObjectsSessionCType +} + +func NewFlowRSVPPathObjectsClassSession() FlowRSVPPathObjectsClassSession { + obj := flowRSVPPathObjectsClassSession{obj: &otg.FlowRSVPPathObjectsClassSession{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsClassSession) msg() *otg.FlowRSVPPathObjectsClassSession { + return obj.obj +} + +func (obj *flowRSVPPathObjectsClassSession) setMsg(msg *otg.FlowRSVPPathObjectsClassSession) FlowRSVPPathObjectsClassSession { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsClassSession struct { + obj *flowRSVPPathObjectsClassSession +} + +type marshalFlowRSVPPathObjectsClassSession interface { + // ToProto marshals FlowRSVPPathObjectsClassSession to protobuf object *otg.FlowRSVPPathObjectsClassSession + ToProto() (*otg.FlowRSVPPathObjectsClassSession, error) + // ToPbText marshals FlowRSVPPathObjectsClassSession to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsClassSession to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsClassSession to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsClassSession struct { + obj *flowRSVPPathObjectsClassSession +} + +type unMarshalFlowRSVPPathObjectsClassSession interface { + // FromProto unmarshals FlowRSVPPathObjectsClassSession from protobuf object *otg.FlowRSVPPathObjectsClassSession + FromProto(msg *otg.FlowRSVPPathObjectsClassSession) (FlowRSVPPathObjectsClassSession, error) + // FromPbText unmarshals FlowRSVPPathObjectsClassSession from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsClassSession from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsClassSession from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsClassSession) Marshal() marshalFlowRSVPPathObjectsClassSession { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsClassSession{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsClassSession) Unmarshal() unMarshalFlowRSVPPathObjectsClassSession { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassSession{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsClassSession) ToProto() (*otg.FlowRSVPPathObjectsClassSession, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsClassSession) FromProto(msg *otg.FlowRSVPPathObjectsClassSession) (FlowRSVPPathObjectsClassSession, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsClassSession) 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 *unMarshalflowRSVPPathObjectsClassSession) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsClassSession) 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 *unMarshalflowRSVPPathObjectsClassSession) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsClassSession) 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 *unMarshalflowRSVPPathObjectsClassSession) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsClassSession) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassSession) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassSession) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsClassSession) Clone() (FlowRSVPPathObjectsClassSession, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsClassSession() + 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 +} + +func (obj *flowRSVPPathObjectsClassSession) setNil() { + obj.lengthHolder = nil + obj.cTypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsClassSession is c-Type is specific to a class num. +type FlowRSVPPathObjectsClassSession interface { + Validation + // msg marshals FlowRSVPPathObjectsClassSession to protobuf object *otg.FlowRSVPPathObjectsClassSession + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsClassSession + // setMsg unmarshals FlowRSVPPathObjectsClassSession from protobuf object *otg.FlowRSVPPathObjectsClassSession + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsClassSession) FlowRSVPPathObjectsClassSession + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsClassSession + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsClassSession + // validate validates FlowRSVPPathObjectsClassSession + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsClassSession, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassSession. + // FlowRSVPObjectLength is description is TBD + Length() FlowRSVPObjectLength + // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassSession. + // FlowRSVPObjectLength is description is TBD + SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSession + // HasLength checks if Length has been set in FlowRSVPPathObjectsClassSession + HasLength() bool + // CType returns FlowRSVPPathObjectsSessionCType, set in FlowRSVPPathObjectsClassSession. + // FlowRSVPPathObjectsSessionCType is the body of an object corresponding to the class number and c-type. Currently supported c-type for SESSION object is LSP Tunnel IPv4 (7). + CType() FlowRSVPPathObjectsSessionCType + // SetCType assigns FlowRSVPPathObjectsSessionCType provided by user to FlowRSVPPathObjectsClassSession. + // FlowRSVPPathObjectsSessionCType is the body of an object corresponding to the class number and c-type. Currently supported c-type for SESSION object is LSP Tunnel IPv4 (7). + SetCType(value FlowRSVPPathObjectsSessionCType) FlowRSVPPathObjectsClassSession + // HasCType checks if CType has been set in FlowRSVPPathObjectsClassSession + HasCType() bool + setNil() +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassSession) Length() FlowRSVPObjectLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowRSVPObjectLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassSession) HasLength() bool { + return obj.obj.Length != nil +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassSession object +func (obj *flowRSVPPathObjectsClassSession) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSession { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsSessionCType +func (obj *flowRSVPPathObjectsClassSession) CType() FlowRSVPPathObjectsSessionCType { + if obj.obj.CType == nil { + obj.obj.CType = NewFlowRSVPPathObjectsSessionCType().msg() + } + if obj.cTypeHolder == nil { + obj.cTypeHolder = &flowRSVPPathObjectsSessionCType{obj: obj.obj.CType} + } + return obj.cTypeHolder +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsSessionCType +func (obj *flowRSVPPathObjectsClassSession) HasCType() bool { + return obj.obj.CType != nil +} + +// description is TBD +// SetCType sets the FlowRSVPPathObjectsSessionCType value in the FlowRSVPPathObjectsClassSession object +func (obj *flowRSVPPathObjectsClassSession) SetCType(value FlowRSVPPathObjectsSessionCType) FlowRSVPPathObjectsClassSession { + + obj.cTypeHolder = nil + obj.obj.CType = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsClassSession) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.CType != nil { + + obj.CType().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsClassSession) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_objects_class_session_attribute.go b/gosnappi/flow_rsvp_path_objects_class_session_attribute.go new file mode 100644 index 00000000..c90f4fbd --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_class_session_attribute.go @@ -0,0 +1,371 @@ +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" +) + +// ***** FlowRSVPPathObjectsClassSessionAttribute ***** +type flowRSVPPathObjectsClassSessionAttribute struct { + validation + obj *otg.FlowRSVPPathObjectsClassSessionAttribute + marshaller marshalFlowRSVPPathObjectsClassSessionAttribute + unMarshaller unMarshalFlowRSVPPathObjectsClassSessionAttribute + lengthHolder FlowRSVPObjectLength + cTypeHolder FlowRSVPPathObjectsSessionAttributeCType +} + +func NewFlowRSVPPathObjectsClassSessionAttribute() FlowRSVPPathObjectsClassSessionAttribute { + obj := flowRSVPPathObjectsClassSessionAttribute{obj: &otg.FlowRSVPPathObjectsClassSessionAttribute{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsClassSessionAttribute) msg() *otg.FlowRSVPPathObjectsClassSessionAttribute { + return obj.obj +} + +func (obj *flowRSVPPathObjectsClassSessionAttribute) setMsg(msg *otg.FlowRSVPPathObjectsClassSessionAttribute) FlowRSVPPathObjectsClassSessionAttribute { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsClassSessionAttribute struct { + obj *flowRSVPPathObjectsClassSessionAttribute +} + +type marshalFlowRSVPPathObjectsClassSessionAttribute interface { + // ToProto marshals FlowRSVPPathObjectsClassSessionAttribute to protobuf object *otg.FlowRSVPPathObjectsClassSessionAttribute + ToProto() (*otg.FlowRSVPPathObjectsClassSessionAttribute, error) + // ToPbText marshals FlowRSVPPathObjectsClassSessionAttribute to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsClassSessionAttribute to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsClassSessionAttribute to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsClassSessionAttribute struct { + obj *flowRSVPPathObjectsClassSessionAttribute +} + +type unMarshalFlowRSVPPathObjectsClassSessionAttribute interface { + // FromProto unmarshals FlowRSVPPathObjectsClassSessionAttribute from protobuf object *otg.FlowRSVPPathObjectsClassSessionAttribute + FromProto(msg *otg.FlowRSVPPathObjectsClassSessionAttribute) (FlowRSVPPathObjectsClassSessionAttribute, error) + // FromPbText unmarshals FlowRSVPPathObjectsClassSessionAttribute from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsClassSessionAttribute from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsClassSessionAttribute from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsClassSessionAttribute) Marshal() marshalFlowRSVPPathObjectsClassSessionAttribute { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsClassSessionAttribute{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsClassSessionAttribute) Unmarshal() unMarshalFlowRSVPPathObjectsClassSessionAttribute { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassSessionAttribute{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsClassSessionAttribute) ToProto() (*otg.FlowRSVPPathObjectsClassSessionAttribute, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsClassSessionAttribute) FromProto(msg *otg.FlowRSVPPathObjectsClassSessionAttribute) (FlowRSVPPathObjectsClassSessionAttribute, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsClassSessionAttribute) 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 *unMarshalflowRSVPPathObjectsClassSessionAttribute) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsClassSessionAttribute) 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 *unMarshalflowRSVPPathObjectsClassSessionAttribute) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsClassSessionAttribute) 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 *unMarshalflowRSVPPathObjectsClassSessionAttribute) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsClassSessionAttribute) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassSessionAttribute) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassSessionAttribute) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsClassSessionAttribute) Clone() (FlowRSVPPathObjectsClassSessionAttribute, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsClassSessionAttribute() + 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 +} + +func (obj *flowRSVPPathObjectsClassSessionAttribute) setNil() { + obj.lengthHolder = nil + obj.cTypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsClassSessionAttribute is c-Type is specific to a class num. +type FlowRSVPPathObjectsClassSessionAttribute interface { + Validation + // msg marshals FlowRSVPPathObjectsClassSessionAttribute to protobuf object *otg.FlowRSVPPathObjectsClassSessionAttribute + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsClassSessionAttribute + // setMsg unmarshals FlowRSVPPathObjectsClassSessionAttribute from protobuf object *otg.FlowRSVPPathObjectsClassSessionAttribute + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsClassSessionAttribute) FlowRSVPPathObjectsClassSessionAttribute + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsClassSessionAttribute + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsClassSessionAttribute + // validate validates FlowRSVPPathObjectsClassSessionAttribute + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsClassSessionAttribute, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassSessionAttribute. + // FlowRSVPObjectLength is description is TBD + Length() FlowRSVPObjectLength + // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassSessionAttribute. + // FlowRSVPObjectLength is description is TBD + SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSessionAttribute + // HasLength checks if Length has been set in FlowRSVPPathObjectsClassSessionAttribute + HasLength() bool + // CType returns FlowRSVPPathObjectsSessionAttributeCType, set in FlowRSVPPathObjectsClassSessionAttribute. + // FlowRSVPPathObjectsSessionAttributeCType is object for SESSION_ATTRIBUTE class. Currently supported c-type is LSP_Tunnel_RA (1) and LSP_Tunnel (7). + CType() FlowRSVPPathObjectsSessionAttributeCType + // SetCType assigns FlowRSVPPathObjectsSessionAttributeCType provided by user to FlowRSVPPathObjectsClassSessionAttribute. + // FlowRSVPPathObjectsSessionAttributeCType is object for SESSION_ATTRIBUTE class. Currently supported c-type is LSP_Tunnel_RA (1) and LSP_Tunnel (7). + SetCType(value FlowRSVPPathObjectsSessionAttributeCType) FlowRSVPPathObjectsClassSessionAttribute + // HasCType checks if CType has been set in FlowRSVPPathObjectsClassSessionAttribute + HasCType() bool + setNil() +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassSessionAttribute) Length() FlowRSVPObjectLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowRSVPObjectLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassSessionAttribute) HasLength() bool { + return obj.obj.Length != nil +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassSessionAttribute object +func (obj *flowRSVPPathObjectsClassSessionAttribute) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSessionAttribute { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsSessionAttributeCType +func (obj *flowRSVPPathObjectsClassSessionAttribute) CType() FlowRSVPPathObjectsSessionAttributeCType { + if obj.obj.CType == nil { + obj.obj.CType = NewFlowRSVPPathObjectsSessionAttributeCType().msg() + } + if obj.cTypeHolder == nil { + obj.cTypeHolder = &flowRSVPPathObjectsSessionAttributeCType{obj: obj.obj.CType} + } + return obj.cTypeHolder +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsSessionAttributeCType +func (obj *flowRSVPPathObjectsClassSessionAttribute) HasCType() bool { + return obj.obj.CType != nil +} + +// description is TBD +// SetCType sets the FlowRSVPPathObjectsSessionAttributeCType value in the FlowRSVPPathObjectsClassSessionAttribute object +func (obj *flowRSVPPathObjectsClassSessionAttribute) SetCType(value FlowRSVPPathObjectsSessionAttributeCType) FlowRSVPPathObjectsClassSessionAttribute { + + obj.cTypeHolder = nil + obj.obj.CType = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsClassSessionAttribute) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.CType != nil { + + obj.CType().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsClassSessionAttribute) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_objects_class_time_values.go b/gosnappi/flow_rsvp_path_objects_class_time_values.go new file mode 100644 index 00000000..663074a8 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_class_time_values.go @@ -0,0 +1,371 @@ +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" +) + +// ***** FlowRSVPPathObjectsClassTimeValues ***** +type flowRSVPPathObjectsClassTimeValues struct { + validation + obj *otg.FlowRSVPPathObjectsClassTimeValues + marshaller marshalFlowRSVPPathObjectsClassTimeValues + unMarshaller unMarshalFlowRSVPPathObjectsClassTimeValues + lengthHolder FlowRSVPObjectLength + cTypeHolder FlowRSVPPathObjectsTimeValuesCType +} + +func NewFlowRSVPPathObjectsClassTimeValues() FlowRSVPPathObjectsClassTimeValues { + obj := flowRSVPPathObjectsClassTimeValues{obj: &otg.FlowRSVPPathObjectsClassTimeValues{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsClassTimeValues) msg() *otg.FlowRSVPPathObjectsClassTimeValues { + return obj.obj +} + +func (obj *flowRSVPPathObjectsClassTimeValues) setMsg(msg *otg.FlowRSVPPathObjectsClassTimeValues) FlowRSVPPathObjectsClassTimeValues { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsClassTimeValues struct { + obj *flowRSVPPathObjectsClassTimeValues +} + +type marshalFlowRSVPPathObjectsClassTimeValues interface { + // ToProto marshals FlowRSVPPathObjectsClassTimeValues to protobuf object *otg.FlowRSVPPathObjectsClassTimeValues + ToProto() (*otg.FlowRSVPPathObjectsClassTimeValues, error) + // ToPbText marshals FlowRSVPPathObjectsClassTimeValues to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsClassTimeValues to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsClassTimeValues to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsClassTimeValues struct { + obj *flowRSVPPathObjectsClassTimeValues +} + +type unMarshalFlowRSVPPathObjectsClassTimeValues interface { + // FromProto unmarshals FlowRSVPPathObjectsClassTimeValues from protobuf object *otg.FlowRSVPPathObjectsClassTimeValues + FromProto(msg *otg.FlowRSVPPathObjectsClassTimeValues) (FlowRSVPPathObjectsClassTimeValues, error) + // FromPbText unmarshals FlowRSVPPathObjectsClassTimeValues from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsClassTimeValues from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsClassTimeValues from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsClassTimeValues) Marshal() marshalFlowRSVPPathObjectsClassTimeValues { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsClassTimeValues{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsClassTimeValues) Unmarshal() unMarshalFlowRSVPPathObjectsClassTimeValues { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassTimeValues{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsClassTimeValues) ToProto() (*otg.FlowRSVPPathObjectsClassTimeValues, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsClassTimeValues) FromProto(msg *otg.FlowRSVPPathObjectsClassTimeValues) (FlowRSVPPathObjectsClassTimeValues, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsClassTimeValues) 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 *unMarshalflowRSVPPathObjectsClassTimeValues) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsClassTimeValues) 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 *unMarshalflowRSVPPathObjectsClassTimeValues) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsClassTimeValues) 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 *unMarshalflowRSVPPathObjectsClassTimeValues) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsClassTimeValues) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassTimeValues) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsClassTimeValues) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsClassTimeValues) Clone() (FlowRSVPPathObjectsClassTimeValues, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsClassTimeValues() + 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 +} + +func (obj *flowRSVPPathObjectsClassTimeValues) setNil() { + obj.lengthHolder = nil + obj.cTypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsClassTimeValues is c-Type is specific to a class num. +type FlowRSVPPathObjectsClassTimeValues interface { + Validation + // msg marshals FlowRSVPPathObjectsClassTimeValues to protobuf object *otg.FlowRSVPPathObjectsClassTimeValues + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsClassTimeValues + // setMsg unmarshals FlowRSVPPathObjectsClassTimeValues from protobuf object *otg.FlowRSVPPathObjectsClassTimeValues + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsClassTimeValues) FlowRSVPPathObjectsClassTimeValues + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsClassTimeValues + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsClassTimeValues + // validate validates FlowRSVPPathObjectsClassTimeValues + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsClassTimeValues, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassTimeValues. + // FlowRSVPObjectLength is description is TBD + Length() FlowRSVPObjectLength + // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassTimeValues. + // FlowRSVPObjectLength is description is TBD + SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassTimeValues + // HasLength checks if Length has been set in FlowRSVPPathObjectsClassTimeValues + HasLength() bool + // CType returns FlowRSVPPathObjectsTimeValuesCType, set in FlowRSVPPathObjectsClassTimeValues. + // FlowRSVPPathObjectsTimeValuesCType is object for TIME_VALUES class. Currently supported c-type is Type 1 Time Value (1). + CType() FlowRSVPPathObjectsTimeValuesCType + // SetCType assigns FlowRSVPPathObjectsTimeValuesCType provided by user to FlowRSVPPathObjectsClassTimeValues. + // FlowRSVPPathObjectsTimeValuesCType is object for TIME_VALUES class. Currently supported c-type is Type 1 Time Value (1). + SetCType(value FlowRSVPPathObjectsTimeValuesCType) FlowRSVPPathObjectsClassTimeValues + // HasCType checks if CType has been set in FlowRSVPPathObjectsClassTimeValues + HasCType() bool + setNil() +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassTimeValues) Length() FlowRSVPObjectLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowRSVPObjectLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsClassTimeValues) HasLength() bool { + return obj.obj.Length != nil +} + +// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. +// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassTimeValues object +func (obj *flowRSVPPathObjectsClassTimeValues) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassTimeValues { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsTimeValuesCType +func (obj *flowRSVPPathObjectsClassTimeValues) CType() FlowRSVPPathObjectsTimeValuesCType { + if obj.obj.CType == nil { + obj.obj.CType = NewFlowRSVPPathObjectsTimeValuesCType().msg() + } + if obj.cTypeHolder == nil { + obj.cTypeHolder = &flowRSVPPathObjectsTimeValuesCType{obj: obj.obj.CType} + } + return obj.cTypeHolder +} + +// description is TBD +// CType returns a FlowRSVPPathObjectsTimeValuesCType +func (obj *flowRSVPPathObjectsClassTimeValues) HasCType() bool { + return obj.obj.CType != nil +} + +// description is TBD +// SetCType sets the FlowRSVPPathObjectsTimeValuesCType value in the FlowRSVPPathObjectsClassTimeValues object +func (obj *flowRSVPPathObjectsClassTimeValues) SetCType(value FlowRSVPPathObjectsTimeValuesCType) FlowRSVPPathObjectsClassTimeValues { + + obj.cTypeHolder = nil + obj.obj.CType = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsClassTimeValues) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.CType != nil { + + obj.CType().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsClassTimeValues) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_objects_custom.go b/gosnappi/flow_rsvp_path_objects_custom.go new file mode 100644 index 00000000..510d0475 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_custom.go @@ -0,0 +1,414 @@ +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" +) + +// ***** FlowRSVPPathObjectsCustom ***** +type flowRSVPPathObjectsCustom struct { + validation + obj *otg.FlowRSVPPathObjectsCustom + marshaller marshalFlowRSVPPathObjectsCustom + unMarshaller unMarshalFlowRSVPPathObjectsCustom + typeHolder PatternFlowRSVPPathObjectsCustomType + lengthHolder FlowRSVPObjectLength +} + +func NewFlowRSVPPathObjectsCustom() FlowRSVPPathObjectsCustom { + obj := flowRSVPPathObjectsCustom{obj: &otg.FlowRSVPPathObjectsCustom{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsCustom) msg() *otg.FlowRSVPPathObjectsCustom { + return obj.obj +} + +func (obj *flowRSVPPathObjectsCustom) setMsg(msg *otg.FlowRSVPPathObjectsCustom) FlowRSVPPathObjectsCustom { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsCustom struct { + obj *flowRSVPPathObjectsCustom +} + +type marshalFlowRSVPPathObjectsCustom interface { + // ToProto marshals FlowRSVPPathObjectsCustom to protobuf object *otg.FlowRSVPPathObjectsCustom + ToProto() (*otg.FlowRSVPPathObjectsCustom, error) + // ToPbText marshals FlowRSVPPathObjectsCustom to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsCustom to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsCustom to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsCustom struct { + obj *flowRSVPPathObjectsCustom +} + +type unMarshalFlowRSVPPathObjectsCustom interface { + // FromProto unmarshals FlowRSVPPathObjectsCustom from protobuf object *otg.FlowRSVPPathObjectsCustom + FromProto(msg *otg.FlowRSVPPathObjectsCustom) (FlowRSVPPathObjectsCustom, error) + // FromPbText unmarshals FlowRSVPPathObjectsCustom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsCustom from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsCustom from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsCustom) Marshal() marshalFlowRSVPPathObjectsCustom { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsCustom{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsCustom) Unmarshal() unMarshalFlowRSVPPathObjectsCustom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsCustom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsCustom) ToProto() (*otg.FlowRSVPPathObjectsCustom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsCustom) FromProto(msg *otg.FlowRSVPPathObjectsCustom) (FlowRSVPPathObjectsCustom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsCustom) 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 *unMarshalflowRSVPPathObjectsCustom) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsCustom) 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 *unMarshalflowRSVPPathObjectsCustom) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsCustom) 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 *unMarshalflowRSVPPathObjectsCustom) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsCustom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsCustom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsCustom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsCustom) Clone() (FlowRSVPPathObjectsCustom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsCustom() + 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 +} + +func (obj *flowRSVPPathObjectsCustom) setNil() { + obj.typeHolder = nil + obj.lengthHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsCustom is custom packet header +type FlowRSVPPathObjectsCustom interface { + Validation + // msg marshals FlowRSVPPathObjectsCustom to protobuf object *otg.FlowRSVPPathObjectsCustom + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsCustom + // setMsg unmarshals FlowRSVPPathObjectsCustom from protobuf object *otg.FlowRSVPPathObjectsCustom + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsCustom) FlowRSVPPathObjectsCustom + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsCustom + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsCustom + // validate validates FlowRSVPPathObjectsCustom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsCustom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Type returns PatternFlowRSVPPathObjectsCustomType, set in FlowRSVPPathObjectsCustom. + // PatternFlowRSVPPathObjectsCustomType is user defined object type. + Type() PatternFlowRSVPPathObjectsCustomType + // SetType assigns PatternFlowRSVPPathObjectsCustomType provided by user to FlowRSVPPathObjectsCustom. + // PatternFlowRSVPPathObjectsCustomType is user defined object type. + SetType(value PatternFlowRSVPPathObjectsCustomType) FlowRSVPPathObjectsCustom + // HasType checks if Type has been set in FlowRSVPPathObjectsCustom + HasType() bool + // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsCustom. + // FlowRSVPObjectLength is description is TBD + Length() FlowRSVPObjectLength + // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsCustom. + // FlowRSVPObjectLength is description is TBD + SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsCustom + // HasLength checks if Length has been set in FlowRSVPPathObjectsCustom + HasLength() bool + // Bytes returns string, set in FlowRSVPPathObjectsCustom. + Bytes() string + // SetBytes assigns string provided by user to FlowRSVPPathObjectsCustom + SetBytes(value string) FlowRSVPPathObjectsCustom + // HasBytes checks if Bytes has been set in FlowRSVPPathObjectsCustom + HasBytes() bool + setNil() +} + +// description is TBD +// Type returns a PatternFlowRSVPPathObjectsCustomType +func (obj *flowRSVPPathObjectsCustom) Type() PatternFlowRSVPPathObjectsCustomType { + if obj.obj.Type == nil { + obj.obj.Type = NewPatternFlowRSVPPathObjectsCustomType().msg() + } + if obj.typeHolder == nil { + obj.typeHolder = &patternFlowRSVPPathObjectsCustomType{obj: obj.obj.Type} + } + return obj.typeHolder +} + +// description is TBD +// Type returns a PatternFlowRSVPPathObjectsCustomType +func (obj *flowRSVPPathObjectsCustom) HasType() bool { + return obj.obj.Type != nil +} + +// description is TBD +// SetType sets the PatternFlowRSVPPathObjectsCustomType value in the FlowRSVPPathObjectsCustom object +func (obj *flowRSVPPathObjectsCustom) SetType(value PatternFlowRSVPPathObjectsCustomType) FlowRSVPPathObjectsCustom { + + obj.typeHolder = nil + obj.obj.Type = value.msg() + + return obj +} + +// description is TBD +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsCustom) Length() FlowRSVPObjectLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowRSVPObjectLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// description is TBD +// Length returns a FlowRSVPObjectLength +func (obj *flowRSVPPathObjectsCustom) HasLength() bool { + return obj.obj.Length != nil +} + +// description is TBD +// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsCustom object +func (obj *flowRSVPPathObjectsCustom) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsCustom { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// A custom packet header defined as a string of hex bytes. The string MUST contain sequence of valid hex bytes. Spaces or colons can be part of the bytes but will be discarded. Value of the this field should not excced 65525 bytes since maximum 65528 bytes can be added as object-contents in RSVP header. For type and length requires 3 bytes, hence maximum of 65524 bytes are expected. Maximum length of this attribute is 131050 (65525 * 2 hex character per byte). +// Bytes returns a string +func (obj *flowRSVPPathObjectsCustom) Bytes() string { + + return *obj.obj.Bytes + +} + +// A custom packet header defined as a string of hex bytes. The string MUST contain sequence of valid hex bytes. Spaces or colons can be part of the bytes but will be discarded. Value of the this field should not excced 65525 bytes since maximum 65528 bytes can be added as object-contents in RSVP header. For type and length requires 3 bytes, hence maximum of 65524 bytes are expected. Maximum length of this attribute is 131050 (65525 * 2 hex character per byte). +// Bytes returns a string +func (obj *flowRSVPPathObjectsCustom) HasBytes() bool { + return obj.obj.Bytes != nil +} + +// A custom packet header defined as a string of hex bytes. The string MUST contain sequence of valid hex bytes. Spaces or colons can be part of the bytes but will be discarded. Value of the this field should not excced 65525 bytes since maximum 65528 bytes can be added as object-contents in RSVP header. For type and length requires 3 bytes, hence maximum of 65524 bytes are expected. Maximum length of this attribute is 131050 (65525 * 2 hex character per byte). +// SetBytes sets the string value in the FlowRSVPPathObjectsCustom object +func (obj *flowRSVPPathObjectsCustom) SetBytes(value string) FlowRSVPPathObjectsCustom { + + obj.obj.Bytes = &value + return obj +} + +func (obj *flowRSVPPathObjectsCustom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Type != nil { + + obj.Type().validateObj(vObj, set_default) + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.Bytes != nil { + + if len(*obj.obj.Bytes) < 1 || len(*obj.obj.Bytes) > 131050 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "1 <= length of FlowRSVPPathObjectsCustom.Bytes <= 131050 but Got %d", + len(*obj.obj.Bytes))) + } + + } + +} + +func (obj *flowRSVPPathObjectsCustom) setDefault() { + if obj.obj.Bytes == nil { + obj.SetBytes("0000") + } + +} diff --git a/gosnappi/flow_rsvp_path_objects_label_request_c_type.go b/gosnappi/flow_rsvp_path_objects_label_request_c_type.go new file mode 100644 index 00000000..65aaf40c --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_label_request_c_type.go @@ -0,0 +1,396 @@ +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" +) + +// ***** FlowRSVPPathObjectsLabelRequestCType ***** +type flowRSVPPathObjectsLabelRequestCType struct { + validation + obj *otg.FlowRSVPPathObjectsLabelRequestCType + marshaller marshalFlowRSVPPathObjectsLabelRequestCType + unMarshaller unMarshalFlowRSVPPathObjectsLabelRequestCType + withoutLabelRangeHolder FlowRSVPPathLabelRequestWithoutLabelRange +} + +func NewFlowRSVPPathObjectsLabelRequestCType() FlowRSVPPathObjectsLabelRequestCType { + obj := flowRSVPPathObjectsLabelRequestCType{obj: &otg.FlowRSVPPathObjectsLabelRequestCType{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsLabelRequestCType) msg() *otg.FlowRSVPPathObjectsLabelRequestCType { + return obj.obj +} + +func (obj *flowRSVPPathObjectsLabelRequestCType) setMsg(msg *otg.FlowRSVPPathObjectsLabelRequestCType) FlowRSVPPathObjectsLabelRequestCType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsLabelRequestCType struct { + obj *flowRSVPPathObjectsLabelRequestCType +} + +type marshalFlowRSVPPathObjectsLabelRequestCType interface { + // ToProto marshals FlowRSVPPathObjectsLabelRequestCType to protobuf object *otg.FlowRSVPPathObjectsLabelRequestCType + ToProto() (*otg.FlowRSVPPathObjectsLabelRequestCType, error) + // ToPbText marshals FlowRSVPPathObjectsLabelRequestCType to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsLabelRequestCType to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsLabelRequestCType to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsLabelRequestCType struct { + obj *flowRSVPPathObjectsLabelRequestCType +} + +type unMarshalFlowRSVPPathObjectsLabelRequestCType interface { + // FromProto unmarshals FlowRSVPPathObjectsLabelRequestCType from protobuf object *otg.FlowRSVPPathObjectsLabelRequestCType + FromProto(msg *otg.FlowRSVPPathObjectsLabelRequestCType) (FlowRSVPPathObjectsLabelRequestCType, error) + // FromPbText unmarshals FlowRSVPPathObjectsLabelRequestCType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsLabelRequestCType from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsLabelRequestCType from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsLabelRequestCType) Marshal() marshalFlowRSVPPathObjectsLabelRequestCType { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsLabelRequestCType{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsLabelRequestCType) Unmarshal() unMarshalFlowRSVPPathObjectsLabelRequestCType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsLabelRequestCType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsLabelRequestCType) ToProto() (*otg.FlowRSVPPathObjectsLabelRequestCType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsLabelRequestCType) FromProto(msg *otg.FlowRSVPPathObjectsLabelRequestCType) (FlowRSVPPathObjectsLabelRequestCType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsLabelRequestCType) 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 *unMarshalflowRSVPPathObjectsLabelRequestCType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsLabelRequestCType) 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 *unMarshalflowRSVPPathObjectsLabelRequestCType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsLabelRequestCType) 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 *unMarshalflowRSVPPathObjectsLabelRequestCType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsLabelRequestCType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsLabelRequestCType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsLabelRequestCType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsLabelRequestCType) Clone() (FlowRSVPPathObjectsLabelRequestCType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsLabelRequestCType() + 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 +} + +func (obj *flowRSVPPathObjectsLabelRequestCType) setNil() { + obj.withoutLabelRangeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsLabelRequestCType is object for LABEL_REQUEST class. Currently supported c-type is Without Label Range (1). +type FlowRSVPPathObjectsLabelRequestCType interface { + Validation + // msg marshals FlowRSVPPathObjectsLabelRequestCType to protobuf object *otg.FlowRSVPPathObjectsLabelRequestCType + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsLabelRequestCType + // setMsg unmarshals FlowRSVPPathObjectsLabelRequestCType from protobuf object *otg.FlowRSVPPathObjectsLabelRequestCType + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsLabelRequestCType) FlowRSVPPathObjectsLabelRequestCType + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsLabelRequestCType + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsLabelRequestCType + // validate validates FlowRSVPPathObjectsLabelRequestCType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsLabelRequestCType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum, set in FlowRSVPPathObjectsLabelRequestCType + Choice() FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum + // setChoice assigns FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum provided by user to FlowRSVPPathObjectsLabelRequestCType + setChoice(value FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum) FlowRSVPPathObjectsLabelRequestCType + // HasChoice checks if Choice has been set in FlowRSVPPathObjectsLabelRequestCType + HasChoice() bool + // WithoutLabelRange returns FlowRSVPPathLabelRequestWithoutLabelRange, set in FlowRSVPPathObjectsLabelRequestCType. + // FlowRSVPPathLabelRequestWithoutLabelRange is class = LABEL_REQUEST, Without Label Range C-Type = 1 + WithoutLabelRange() FlowRSVPPathLabelRequestWithoutLabelRange + // SetWithoutLabelRange assigns FlowRSVPPathLabelRequestWithoutLabelRange provided by user to FlowRSVPPathObjectsLabelRequestCType. + // FlowRSVPPathLabelRequestWithoutLabelRange is class = LABEL_REQUEST, Without Label Range C-Type = 1 + SetWithoutLabelRange(value FlowRSVPPathLabelRequestWithoutLabelRange) FlowRSVPPathObjectsLabelRequestCType + // HasWithoutLabelRange checks if WithoutLabelRange has been set in FlowRSVPPathObjectsLabelRequestCType + HasWithoutLabelRange() bool + setNil() +} + +type FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum string + +// Enum of Choice on FlowRSVPPathObjectsLabelRequestCType +var FlowRSVPPathObjectsLabelRequestCTypeChoice = struct { + WITHOUT_LABEL_RANGE FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum +}{ + WITHOUT_LABEL_RANGE: FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum("without_label_range"), +} + +func (obj *flowRSVPPathObjectsLabelRequestCType) Choice() FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum { + return FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowRSVPPathObjectsLabelRequestCType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPPathObjectsLabelRequestCType) setChoice(value FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum) FlowRSVPPathObjectsLabelRequestCType { + intValue, ok := otg.FlowRSVPPathObjectsLabelRequestCType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPPathObjectsLabelRequestCType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.WithoutLabelRange = nil + obj.withoutLabelRangeHolder = nil + + if value == FlowRSVPPathObjectsLabelRequestCTypeChoice.WITHOUT_LABEL_RANGE { + obj.obj.WithoutLabelRange = NewFlowRSVPPathLabelRequestWithoutLabelRange().msg() + } + + return obj +} + +// description is TBD +// WithoutLabelRange returns a FlowRSVPPathLabelRequestWithoutLabelRange +func (obj *flowRSVPPathObjectsLabelRequestCType) WithoutLabelRange() FlowRSVPPathLabelRequestWithoutLabelRange { + if obj.obj.WithoutLabelRange == nil { + obj.setChoice(FlowRSVPPathObjectsLabelRequestCTypeChoice.WITHOUT_LABEL_RANGE) + } + if obj.withoutLabelRangeHolder == nil { + obj.withoutLabelRangeHolder = &flowRSVPPathLabelRequestWithoutLabelRange{obj: obj.obj.WithoutLabelRange} + } + return obj.withoutLabelRangeHolder +} + +// description is TBD +// WithoutLabelRange returns a FlowRSVPPathLabelRequestWithoutLabelRange +func (obj *flowRSVPPathObjectsLabelRequestCType) HasWithoutLabelRange() bool { + return obj.obj.WithoutLabelRange != nil +} + +// description is TBD +// SetWithoutLabelRange sets the FlowRSVPPathLabelRequestWithoutLabelRange value in the FlowRSVPPathObjectsLabelRequestCType object +func (obj *flowRSVPPathObjectsLabelRequestCType) SetWithoutLabelRange(value FlowRSVPPathLabelRequestWithoutLabelRange) FlowRSVPPathObjectsLabelRequestCType { + obj.setChoice(FlowRSVPPathObjectsLabelRequestCTypeChoice.WITHOUT_LABEL_RANGE) + obj.withoutLabelRangeHolder = nil + obj.obj.WithoutLabelRange = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsLabelRequestCType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.WithoutLabelRange != nil { + + obj.WithoutLabelRange().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsLabelRequestCType) setDefault() { + var choices_set int = 0 + var choice FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum + + if obj.obj.WithoutLabelRange != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsLabelRequestCTypeChoice.WITHOUT_LABEL_RANGE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPPathObjectsLabelRequestCTypeChoice.WITHOUT_LABEL_RANGE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsLabelRequestCType") + } + } else { + intVal := otg.FlowRSVPPathObjectsLabelRequestCType_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPPathObjectsLabelRequestCType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_path_objects_record_route_c_type.go b/gosnappi/flow_rsvp_path_objects_record_route_c_type.go new file mode 100644 index 00000000..33cd0a60 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_record_route_c_type.go @@ -0,0 +1,396 @@ +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" +) + +// ***** FlowRSVPPathObjectsRecordRouteCType ***** +type flowRSVPPathObjectsRecordRouteCType struct { + validation + obj *otg.FlowRSVPPathObjectsRecordRouteCType + marshaller marshalFlowRSVPPathObjectsRecordRouteCType + unMarshaller unMarshalFlowRSVPPathObjectsRecordRouteCType + type_1Holder FlowRSVPPathRecordRouteType1 +} + +func NewFlowRSVPPathObjectsRecordRouteCType() FlowRSVPPathObjectsRecordRouteCType { + obj := flowRSVPPathObjectsRecordRouteCType{obj: &otg.FlowRSVPPathObjectsRecordRouteCType{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsRecordRouteCType) msg() *otg.FlowRSVPPathObjectsRecordRouteCType { + return obj.obj +} + +func (obj *flowRSVPPathObjectsRecordRouteCType) setMsg(msg *otg.FlowRSVPPathObjectsRecordRouteCType) FlowRSVPPathObjectsRecordRouteCType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsRecordRouteCType struct { + obj *flowRSVPPathObjectsRecordRouteCType +} + +type marshalFlowRSVPPathObjectsRecordRouteCType interface { + // ToProto marshals FlowRSVPPathObjectsRecordRouteCType to protobuf object *otg.FlowRSVPPathObjectsRecordRouteCType + ToProto() (*otg.FlowRSVPPathObjectsRecordRouteCType, error) + // ToPbText marshals FlowRSVPPathObjectsRecordRouteCType to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsRecordRouteCType to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsRecordRouteCType to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsRecordRouteCType struct { + obj *flowRSVPPathObjectsRecordRouteCType +} + +type unMarshalFlowRSVPPathObjectsRecordRouteCType interface { + // FromProto unmarshals FlowRSVPPathObjectsRecordRouteCType from protobuf object *otg.FlowRSVPPathObjectsRecordRouteCType + FromProto(msg *otg.FlowRSVPPathObjectsRecordRouteCType) (FlowRSVPPathObjectsRecordRouteCType, error) + // FromPbText unmarshals FlowRSVPPathObjectsRecordRouteCType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsRecordRouteCType from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsRecordRouteCType from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsRecordRouteCType) Marshal() marshalFlowRSVPPathObjectsRecordRouteCType { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsRecordRouteCType{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsRecordRouteCType) Unmarshal() unMarshalFlowRSVPPathObjectsRecordRouteCType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsRecordRouteCType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsRecordRouteCType) ToProto() (*otg.FlowRSVPPathObjectsRecordRouteCType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsRecordRouteCType) FromProto(msg *otg.FlowRSVPPathObjectsRecordRouteCType) (FlowRSVPPathObjectsRecordRouteCType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsRecordRouteCType) 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 *unMarshalflowRSVPPathObjectsRecordRouteCType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsRecordRouteCType) 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 *unMarshalflowRSVPPathObjectsRecordRouteCType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsRecordRouteCType) 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 *unMarshalflowRSVPPathObjectsRecordRouteCType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsRecordRouteCType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsRecordRouteCType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsRecordRouteCType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsRecordRouteCType) Clone() (FlowRSVPPathObjectsRecordRouteCType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsRecordRouteCType() + 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 +} + +func (obj *flowRSVPPathObjectsRecordRouteCType) setNil() { + obj.type_1Holder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsRecordRouteCType is object for RECORD_ROUTE class. c-type is Type 1 Route Record (1). +type FlowRSVPPathObjectsRecordRouteCType interface { + Validation + // msg marshals FlowRSVPPathObjectsRecordRouteCType to protobuf object *otg.FlowRSVPPathObjectsRecordRouteCType + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsRecordRouteCType + // setMsg unmarshals FlowRSVPPathObjectsRecordRouteCType from protobuf object *otg.FlowRSVPPathObjectsRecordRouteCType + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsRecordRouteCType) FlowRSVPPathObjectsRecordRouteCType + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsRecordRouteCType + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsRecordRouteCType + // validate validates FlowRSVPPathObjectsRecordRouteCType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsRecordRouteCType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum, set in FlowRSVPPathObjectsRecordRouteCType + Choice() FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum + // setChoice assigns FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum provided by user to FlowRSVPPathObjectsRecordRouteCType + setChoice(value FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum) FlowRSVPPathObjectsRecordRouteCType + // HasChoice checks if Choice has been set in FlowRSVPPathObjectsRecordRouteCType + HasChoice() bool + // Type1 returns FlowRSVPPathRecordRouteType1, set in FlowRSVPPathObjectsRecordRouteCType. + // FlowRSVPPathRecordRouteType1 is type1 record route has list of subobjects. Currently supported subobjects are IPv4 address(1) and Label(3). + Type1() FlowRSVPPathRecordRouteType1 + // SetType1 assigns FlowRSVPPathRecordRouteType1 provided by user to FlowRSVPPathObjectsRecordRouteCType. + // FlowRSVPPathRecordRouteType1 is type1 record route has list of subobjects. Currently supported subobjects are IPv4 address(1) and Label(3). + SetType1(value FlowRSVPPathRecordRouteType1) FlowRSVPPathObjectsRecordRouteCType + // HasType1 checks if Type1 has been set in FlowRSVPPathObjectsRecordRouteCType + HasType1() bool + setNil() +} + +type FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum string + +// Enum of Choice on FlowRSVPPathObjectsRecordRouteCType +var FlowRSVPPathObjectsRecordRouteCTypeChoice = struct { + TYPE_1 FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum +}{ + TYPE_1: FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum("type_1"), +} + +func (obj *flowRSVPPathObjectsRecordRouteCType) Choice() FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum { + return FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowRSVPPathObjectsRecordRouteCType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPPathObjectsRecordRouteCType) setChoice(value FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum) FlowRSVPPathObjectsRecordRouteCType { + intValue, ok := otg.FlowRSVPPathObjectsRecordRouteCType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPPathObjectsRecordRouteCType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Type_1 = nil + obj.type_1Holder = nil + + if value == FlowRSVPPathObjectsRecordRouteCTypeChoice.TYPE_1 { + obj.obj.Type_1 = NewFlowRSVPPathRecordRouteType1().msg() + } + + return obj +} + +// description is TBD +// Type1 returns a FlowRSVPPathRecordRouteType1 +func (obj *flowRSVPPathObjectsRecordRouteCType) Type1() FlowRSVPPathRecordRouteType1 { + if obj.obj.Type_1 == nil { + obj.setChoice(FlowRSVPPathObjectsRecordRouteCTypeChoice.TYPE_1) + } + if obj.type_1Holder == nil { + obj.type_1Holder = &flowRSVPPathRecordRouteType1{obj: obj.obj.Type_1} + } + return obj.type_1Holder +} + +// description is TBD +// Type1 returns a FlowRSVPPathRecordRouteType1 +func (obj *flowRSVPPathObjectsRecordRouteCType) HasType1() bool { + return obj.obj.Type_1 != nil +} + +// description is TBD +// SetType1 sets the FlowRSVPPathRecordRouteType1 value in the FlowRSVPPathObjectsRecordRouteCType object +func (obj *flowRSVPPathObjectsRecordRouteCType) SetType1(value FlowRSVPPathRecordRouteType1) FlowRSVPPathObjectsRecordRouteCType { + obj.setChoice(FlowRSVPPathObjectsRecordRouteCTypeChoice.TYPE_1) + obj.type_1Holder = nil + obj.obj.Type_1 = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsRecordRouteCType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Type_1 != nil { + + obj.Type1().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsRecordRouteCType) setDefault() { + var choices_set int = 0 + var choice FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum + + if obj.obj.Type_1 != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsRecordRouteCTypeChoice.TYPE_1 + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPPathObjectsRecordRouteCTypeChoice.TYPE_1) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsRecordRouteCType") + } + } else { + intVal := otg.FlowRSVPPathObjectsRecordRouteCType_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPPathObjectsRecordRouteCType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_path_objects_record_route_sub_object_type.go b/gosnappi/flow_rsvp_path_objects_record_route_sub_object_type.go new file mode 100644 index 00000000..f56a374a --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_record_route_sub_object_type.go @@ -0,0 +1,452 @@ +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" +) + +// ***** FlowRSVPPathObjectsRecordRouteSubObjectType ***** +type flowRSVPPathObjectsRecordRouteSubObjectType struct { + validation + obj *otg.FlowRSVPPathObjectsRecordRouteSubObjectType + marshaller marshalFlowRSVPPathObjectsRecordRouteSubObjectType + unMarshaller unMarshalFlowRSVPPathObjectsRecordRouteSubObjectType + ipv4AddressHolder FlowRSVPPathRecordRouteType1Ipv4Address + labelHolder FlowRSVPPathRecordRouteType1Label +} + +func NewFlowRSVPPathObjectsRecordRouteSubObjectType() FlowRSVPPathObjectsRecordRouteSubObjectType { + obj := flowRSVPPathObjectsRecordRouteSubObjectType{obj: &otg.FlowRSVPPathObjectsRecordRouteSubObjectType{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) msg() *otg.FlowRSVPPathObjectsRecordRouteSubObjectType { + return obj.obj +} + +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) setMsg(msg *otg.FlowRSVPPathObjectsRecordRouteSubObjectType) FlowRSVPPathObjectsRecordRouteSubObjectType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsRecordRouteSubObjectType struct { + obj *flowRSVPPathObjectsRecordRouteSubObjectType +} + +type marshalFlowRSVPPathObjectsRecordRouteSubObjectType interface { + // ToProto marshals FlowRSVPPathObjectsRecordRouteSubObjectType to protobuf object *otg.FlowRSVPPathObjectsRecordRouteSubObjectType + ToProto() (*otg.FlowRSVPPathObjectsRecordRouteSubObjectType, error) + // ToPbText marshals FlowRSVPPathObjectsRecordRouteSubObjectType to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsRecordRouteSubObjectType to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsRecordRouteSubObjectType to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsRecordRouteSubObjectType struct { + obj *flowRSVPPathObjectsRecordRouteSubObjectType +} + +type unMarshalFlowRSVPPathObjectsRecordRouteSubObjectType interface { + // FromProto unmarshals FlowRSVPPathObjectsRecordRouteSubObjectType from protobuf object *otg.FlowRSVPPathObjectsRecordRouteSubObjectType + FromProto(msg *otg.FlowRSVPPathObjectsRecordRouteSubObjectType) (FlowRSVPPathObjectsRecordRouteSubObjectType, error) + // FromPbText unmarshals FlowRSVPPathObjectsRecordRouteSubObjectType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsRecordRouteSubObjectType from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsRecordRouteSubObjectType from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) Marshal() marshalFlowRSVPPathObjectsRecordRouteSubObjectType { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsRecordRouteSubObjectType{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) Unmarshal() unMarshalFlowRSVPPathObjectsRecordRouteSubObjectType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsRecordRouteSubObjectType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsRecordRouteSubObjectType) ToProto() (*otg.FlowRSVPPathObjectsRecordRouteSubObjectType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsRecordRouteSubObjectType) FromProto(msg *otg.FlowRSVPPathObjectsRecordRouteSubObjectType) (FlowRSVPPathObjectsRecordRouteSubObjectType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsRecordRouteSubObjectType) 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 *unMarshalflowRSVPPathObjectsRecordRouteSubObjectType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsRecordRouteSubObjectType) 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 *unMarshalflowRSVPPathObjectsRecordRouteSubObjectType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsRecordRouteSubObjectType) 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 *unMarshalflowRSVPPathObjectsRecordRouteSubObjectType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) Clone() (FlowRSVPPathObjectsRecordRouteSubObjectType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsRecordRouteSubObjectType() + 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 +} + +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) setNil() { + obj.ipv4AddressHolder = nil + obj.labelHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsRecordRouteSubObjectType is currently supported subobjects are IPv4 address(1) and Label(3). +type FlowRSVPPathObjectsRecordRouteSubObjectType interface { + Validation + // msg marshals FlowRSVPPathObjectsRecordRouteSubObjectType to protobuf object *otg.FlowRSVPPathObjectsRecordRouteSubObjectType + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsRecordRouteSubObjectType + // setMsg unmarshals FlowRSVPPathObjectsRecordRouteSubObjectType from protobuf object *otg.FlowRSVPPathObjectsRecordRouteSubObjectType + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsRecordRouteSubObjectType) FlowRSVPPathObjectsRecordRouteSubObjectType + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsRecordRouteSubObjectType + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsRecordRouteSubObjectType + // validate validates FlowRSVPPathObjectsRecordRouteSubObjectType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsRecordRouteSubObjectType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum, set in FlowRSVPPathObjectsRecordRouteSubObjectType + Choice() FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum + // setChoice assigns FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum provided by user to FlowRSVPPathObjectsRecordRouteSubObjectType + setChoice(value FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum) FlowRSVPPathObjectsRecordRouteSubObjectType + // HasChoice checks if Choice has been set in FlowRSVPPathObjectsRecordRouteSubObjectType + HasChoice() bool + // Ipv4Address returns FlowRSVPPathRecordRouteType1Ipv4Address, set in FlowRSVPPathObjectsRecordRouteSubObjectType. + // FlowRSVPPathRecordRouteType1Ipv4Address is class = RECORD_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: IPv4 Address, C-Type: 1 + Ipv4Address() FlowRSVPPathRecordRouteType1Ipv4Address + // SetIpv4Address assigns FlowRSVPPathRecordRouteType1Ipv4Address provided by user to FlowRSVPPathObjectsRecordRouteSubObjectType. + // FlowRSVPPathRecordRouteType1Ipv4Address is class = RECORD_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: IPv4 Address, C-Type: 1 + SetIpv4Address(value FlowRSVPPathRecordRouteType1Ipv4Address) FlowRSVPPathObjectsRecordRouteSubObjectType + // HasIpv4Address checks if Ipv4Address has been set in FlowRSVPPathObjectsRecordRouteSubObjectType + HasIpv4Address() bool + // Label returns FlowRSVPPathRecordRouteType1Label, set in FlowRSVPPathObjectsRecordRouteSubObjectType. + // FlowRSVPPathRecordRouteType1Label is class = RECORD_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: Label, C-Type: 3 + Label() FlowRSVPPathRecordRouteType1Label + // SetLabel assigns FlowRSVPPathRecordRouteType1Label provided by user to FlowRSVPPathObjectsRecordRouteSubObjectType. + // FlowRSVPPathRecordRouteType1Label is class = RECORD_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: Label, C-Type: 3 + SetLabel(value FlowRSVPPathRecordRouteType1Label) FlowRSVPPathObjectsRecordRouteSubObjectType + // HasLabel checks if Label has been set in FlowRSVPPathObjectsRecordRouteSubObjectType + HasLabel() bool + setNil() +} + +type FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum string + +// Enum of Choice on FlowRSVPPathObjectsRecordRouteSubObjectType +var FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice = struct { + IPV4_ADDRESS FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum + LABEL FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum +}{ + IPV4_ADDRESS: FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum("ipv4_address"), + LABEL: FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum("label"), +} + +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) Choice() FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum { + return FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) setChoice(value FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum) FlowRSVPPathObjectsRecordRouteSubObjectType { + intValue, ok := otg.FlowRSVPPathObjectsRecordRouteSubObjectType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPPathObjectsRecordRouteSubObjectType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Label = nil + obj.labelHolder = nil + obj.obj.Ipv4Address = nil + obj.ipv4AddressHolder = nil + + if value == FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.IPV4_ADDRESS { + obj.obj.Ipv4Address = NewFlowRSVPPathRecordRouteType1Ipv4Address().msg() + } + + if value == FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.LABEL { + obj.obj.Label = NewFlowRSVPPathRecordRouteType1Label().msg() + } + + return obj +} + +// description is TBD +// Ipv4Address returns a FlowRSVPPathRecordRouteType1Ipv4Address +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) Ipv4Address() FlowRSVPPathRecordRouteType1Ipv4Address { + if obj.obj.Ipv4Address == nil { + obj.setChoice(FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.IPV4_ADDRESS) + } + if obj.ipv4AddressHolder == nil { + obj.ipv4AddressHolder = &flowRSVPPathRecordRouteType1Ipv4Address{obj: obj.obj.Ipv4Address} + } + return obj.ipv4AddressHolder +} + +// description is TBD +// Ipv4Address returns a FlowRSVPPathRecordRouteType1Ipv4Address +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) HasIpv4Address() bool { + return obj.obj.Ipv4Address != nil +} + +// description is TBD +// SetIpv4Address sets the FlowRSVPPathRecordRouteType1Ipv4Address value in the FlowRSVPPathObjectsRecordRouteSubObjectType object +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) SetIpv4Address(value FlowRSVPPathRecordRouteType1Ipv4Address) FlowRSVPPathObjectsRecordRouteSubObjectType { + obj.setChoice(FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.IPV4_ADDRESS) + obj.ipv4AddressHolder = nil + obj.obj.Ipv4Address = value.msg() + + return obj +} + +// description is TBD +// Label returns a FlowRSVPPathRecordRouteType1Label +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) Label() FlowRSVPPathRecordRouteType1Label { + if obj.obj.Label == nil { + obj.setChoice(FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.LABEL) + } + if obj.labelHolder == nil { + obj.labelHolder = &flowRSVPPathRecordRouteType1Label{obj: obj.obj.Label} + } + return obj.labelHolder +} + +// description is TBD +// Label returns a FlowRSVPPathRecordRouteType1Label +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) HasLabel() bool { + return obj.obj.Label != nil +} + +// description is TBD +// SetLabel sets the FlowRSVPPathRecordRouteType1Label value in the FlowRSVPPathObjectsRecordRouteSubObjectType object +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) SetLabel(value FlowRSVPPathRecordRouteType1Label) FlowRSVPPathObjectsRecordRouteSubObjectType { + obj.setChoice(FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.LABEL) + obj.labelHolder = nil + obj.obj.Label = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv4Address != nil { + + obj.Ipv4Address().validateObj(vObj, set_default) + } + + if obj.obj.Label != nil { + + obj.Label().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) setDefault() { + var choices_set int = 0 + var choice FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum + + if obj.obj.Ipv4Address != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.IPV4_ADDRESS + } + + if obj.obj.Label != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.LABEL + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.IPV4_ADDRESS) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsRecordRouteSubObjectType") + } + } else { + intVal := otg.FlowRSVPPathObjectsRecordRouteSubObjectType_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPPathObjectsRecordRouteSubObjectType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_path_objects_rsvp_hop_c_type.go b/gosnappi/flow_rsvp_path_objects_rsvp_hop_c_type.go new file mode 100644 index 00000000..89c6f0c2 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_rsvp_hop_c_type.go @@ -0,0 +1,396 @@ +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" +) + +// ***** FlowRSVPPathObjectsRsvpHopCType ***** +type flowRSVPPathObjectsRsvpHopCType struct { + validation + obj *otg.FlowRSVPPathObjectsRsvpHopCType + marshaller marshalFlowRSVPPathObjectsRsvpHopCType + unMarshaller unMarshalFlowRSVPPathObjectsRsvpHopCType + ipv4Holder FlowRSVPPathRsvpHopIpv4 +} + +func NewFlowRSVPPathObjectsRsvpHopCType() FlowRSVPPathObjectsRsvpHopCType { + obj := flowRSVPPathObjectsRsvpHopCType{obj: &otg.FlowRSVPPathObjectsRsvpHopCType{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsRsvpHopCType) msg() *otg.FlowRSVPPathObjectsRsvpHopCType { + return obj.obj +} + +func (obj *flowRSVPPathObjectsRsvpHopCType) setMsg(msg *otg.FlowRSVPPathObjectsRsvpHopCType) FlowRSVPPathObjectsRsvpHopCType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsRsvpHopCType struct { + obj *flowRSVPPathObjectsRsvpHopCType +} + +type marshalFlowRSVPPathObjectsRsvpHopCType interface { + // ToProto marshals FlowRSVPPathObjectsRsvpHopCType to protobuf object *otg.FlowRSVPPathObjectsRsvpHopCType + ToProto() (*otg.FlowRSVPPathObjectsRsvpHopCType, error) + // ToPbText marshals FlowRSVPPathObjectsRsvpHopCType to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsRsvpHopCType to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsRsvpHopCType to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsRsvpHopCType struct { + obj *flowRSVPPathObjectsRsvpHopCType +} + +type unMarshalFlowRSVPPathObjectsRsvpHopCType interface { + // FromProto unmarshals FlowRSVPPathObjectsRsvpHopCType from protobuf object *otg.FlowRSVPPathObjectsRsvpHopCType + FromProto(msg *otg.FlowRSVPPathObjectsRsvpHopCType) (FlowRSVPPathObjectsRsvpHopCType, error) + // FromPbText unmarshals FlowRSVPPathObjectsRsvpHopCType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsRsvpHopCType from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsRsvpHopCType from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsRsvpHopCType) Marshal() marshalFlowRSVPPathObjectsRsvpHopCType { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsRsvpHopCType{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsRsvpHopCType) Unmarshal() unMarshalFlowRSVPPathObjectsRsvpHopCType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsRsvpHopCType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsRsvpHopCType) ToProto() (*otg.FlowRSVPPathObjectsRsvpHopCType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsRsvpHopCType) FromProto(msg *otg.FlowRSVPPathObjectsRsvpHopCType) (FlowRSVPPathObjectsRsvpHopCType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsRsvpHopCType) 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 *unMarshalflowRSVPPathObjectsRsvpHopCType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsRsvpHopCType) 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 *unMarshalflowRSVPPathObjectsRsvpHopCType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsRsvpHopCType) 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 *unMarshalflowRSVPPathObjectsRsvpHopCType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsRsvpHopCType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsRsvpHopCType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsRsvpHopCType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsRsvpHopCType) Clone() (FlowRSVPPathObjectsRsvpHopCType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsRsvpHopCType() + 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 +} + +func (obj *flowRSVPPathObjectsRsvpHopCType) setNil() { + obj.ipv4Holder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsRsvpHopCType is object for RSVP_HOP class. Currently supported c-type is IPv4 (1). +type FlowRSVPPathObjectsRsvpHopCType interface { + Validation + // msg marshals FlowRSVPPathObjectsRsvpHopCType to protobuf object *otg.FlowRSVPPathObjectsRsvpHopCType + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsRsvpHopCType + // setMsg unmarshals FlowRSVPPathObjectsRsvpHopCType from protobuf object *otg.FlowRSVPPathObjectsRsvpHopCType + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsRsvpHopCType) FlowRSVPPathObjectsRsvpHopCType + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsRsvpHopCType + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsRsvpHopCType + // validate validates FlowRSVPPathObjectsRsvpHopCType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsRsvpHopCType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum, set in FlowRSVPPathObjectsRsvpHopCType + Choice() FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum + // setChoice assigns FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum provided by user to FlowRSVPPathObjectsRsvpHopCType + setChoice(value FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum) FlowRSVPPathObjectsRsvpHopCType + // HasChoice checks if Choice has been set in FlowRSVPPathObjectsRsvpHopCType + HasChoice() bool + // Ipv4 returns FlowRSVPPathRsvpHopIpv4, set in FlowRSVPPathObjectsRsvpHopCType. + // FlowRSVPPathRsvpHopIpv4 is iPv4 RSVP_HOP object: Class = 3, C-Type = 1 + Ipv4() FlowRSVPPathRsvpHopIpv4 + // SetIpv4 assigns FlowRSVPPathRsvpHopIpv4 provided by user to FlowRSVPPathObjectsRsvpHopCType. + // FlowRSVPPathRsvpHopIpv4 is iPv4 RSVP_HOP object: Class = 3, C-Type = 1 + SetIpv4(value FlowRSVPPathRsvpHopIpv4) FlowRSVPPathObjectsRsvpHopCType + // HasIpv4 checks if Ipv4 has been set in FlowRSVPPathObjectsRsvpHopCType + HasIpv4() bool + setNil() +} + +type FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum string + +// Enum of Choice on FlowRSVPPathObjectsRsvpHopCType +var FlowRSVPPathObjectsRsvpHopCTypeChoice = struct { + IPV4 FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum +}{ + IPV4: FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum("ipv4"), +} + +func (obj *flowRSVPPathObjectsRsvpHopCType) Choice() FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum { + return FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowRSVPPathObjectsRsvpHopCType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPPathObjectsRsvpHopCType) setChoice(value FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum) FlowRSVPPathObjectsRsvpHopCType { + intValue, ok := otg.FlowRSVPPathObjectsRsvpHopCType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPPathObjectsRsvpHopCType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Ipv4 = nil + obj.ipv4Holder = nil + + if value == FlowRSVPPathObjectsRsvpHopCTypeChoice.IPV4 { + obj.obj.Ipv4 = NewFlowRSVPPathRsvpHopIpv4().msg() + } + + return obj +} + +// description is TBD +// Ipv4 returns a FlowRSVPPathRsvpHopIpv4 +func (obj *flowRSVPPathObjectsRsvpHopCType) Ipv4() FlowRSVPPathRsvpHopIpv4 { + if obj.obj.Ipv4 == nil { + obj.setChoice(FlowRSVPPathObjectsRsvpHopCTypeChoice.IPV4) + } + if obj.ipv4Holder == nil { + obj.ipv4Holder = &flowRSVPPathRsvpHopIpv4{obj: obj.obj.Ipv4} + } + return obj.ipv4Holder +} + +// description is TBD +// Ipv4 returns a FlowRSVPPathRsvpHopIpv4 +func (obj *flowRSVPPathObjectsRsvpHopCType) HasIpv4() bool { + return obj.obj.Ipv4 != nil +} + +// description is TBD +// SetIpv4 sets the FlowRSVPPathRsvpHopIpv4 value in the FlowRSVPPathObjectsRsvpHopCType object +func (obj *flowRSVPPathObjectsRsvpHopCType) SetIpv4(value FlowRSVPPathRsvpHopIpv4) FlowRSVPPathObjectsRsvpHopCType { + obj.setChoice(FlowRSVPPathObjectsRsvpHopCTypeChoice.IPV4) + obj.ipv4Holder = nil + obj.obj.Ipv4 = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsRsvpHopCType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv4 != nil { + + obj.Ipv4().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsRsvpHopCType) setDefault() { + var choices_set int = 0 + var choice FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum + + if obj.obj.Ipv4 != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsRsvpHopCTypeChoice.IPV4 + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPPathObjectsRsvpHopCTypeChoice.IPV4) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsRsvpHopCType") + } + } else { + intVal := otg.FlowRSVPPathObjectsRsvpHopCType_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPPathObjectsRsvpHopCType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_path_objects_sender_template_c_type.go b/gosnappi/flow_rsvp_path_objects_sender_template_c_type.go new file mode 100644 index 00000000..13e1e2f6 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_sender_template_c_type.go @@ -0,0 +1,396 @@ +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" +) + +// ***** FlowRSVPPathObjectsSenderTemplateCType ***** +type flowRSVPPathObjectsSenderTemplateCType struct { + validation + obj *otg.FlowRSVPPathObjectsSenderTemplateCType + marshaller marshalFlowRSVPPathObjectsSenderTemplateCType + unMarshaller unMarshalFlowRSVPPathObjectsSenderTemplateCType + lspTunnelIpv4Holder FlowRSVPPathSenderTemplateLspTunnelIpv4 +} + +func NewFlowRSVPPathObjectsSenderTemplateCType() FlowRSVPPathObjectsSenderTemplateCType { + obj := flowRSVPPathObjectsSenderTemplateCType{obj: &otg.FlowRSVPPathObjectsSenderTemplateCType{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsSenderTemplateCType) msg() *otg.FlowRSVPPathObjectsSenderTemplateCType { + return obj.obj +} + +func (obj *flowRSVPPathObjectsSenderTemplateCType) setMsg(msg *otg.FlowRSVPPathObjectsSenderTemplateCType) FlowRSVPPathObjectsSenderTemplateCType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsSenderTemplateCType struct { + obj *flowRSVPPathObjectsSenderTemplateCType +} + +type marshalFlowRSVPPathObjectsSenderTemplateCType interface { + // ToProto marshals FlowRSVPPathObjectsSenderTemplateCType to protobuf object *otg.FlowRSVPPathObjectsSenderTemplateCType + ToProto() (*otg.FlowRSVPPathObjectsSenderTemplateCType, error) + // ToPbText marshals FlowRSVPPathObjectsSenderTemplateCType to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsSenderTemplateCType to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsSenderTemplateCType to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsSenderTemplateCType struct { + obj *flowRSVPPathObjectsSenderTemplateCType +} + +type unMarshalFlowRSVPPathObjectsSenderTemplateCType interface { + // FromProto unmarshals FlowRSVPPathObjectsSenderTemplateCType from protobuf object *otg.FlowRSVPPathObjectsSenderTemplateCType + FromProto(msg *otg.FlowRSVPPathObjectsSenderTemplateCType) (FlowRSVPPathObjectsSenderTemplateCType, error) + // FromPbText unmarshals FlowRSVPPathObjectsSenderTemplateCType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsSenderTemplateCType from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsSenderTemplateCType from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsSenderTemplateCType) Marshal() marshalFlowRSVPPathObjectsSenderTemplateCType { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsSenderTemplateCType{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsSenderTemplateCType) Unmarshal() unMarshalFlowRSVPPathObjectsSenderTemplateCType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsSenderTemplateCType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsSenderTemplateCType) ToProto() (*otg.FlowRSVPPathObjectsSenderTemplateCType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsSenderTemplateCType) FromProto(msg *otg.FlowRSVPPathObjectsSenderTemplateCType) (FlowRSVPPathObjectsSenderTemplateCType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsSenderTemplateCType) 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 *unMarshalflowRSVPPathObjectsSenderTemplateCType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsSenderTemplateCType) 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 *unMarshalflowRSVPPathObjectsSenderTemplateCType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsSenderTemplateCType) 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 *unMarshalflowRSVPPathObjectsSenderTemplateCType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsSenderTemplateCType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsSenderTemplateCType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsSenderTemplateCType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsSenderTemplateCType) Clone() (FlowRSVPPathObjectsSenderTemplateCType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsSenderTemplateCType() + 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 +} + +func (obj *flowRSVPPathObjectsSenderTemplateCType) setNil() { + obj.lspTunnelIpv4Holder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsSenderTemplateCType is object for SENDER_TEMPLATE class. Currently supported c-type is LSP Tunnel IPv4 (7). +type FlowRSVPPathObjectsSenderTemplateCType interface { + Validation + // msg marshals FlowRSVPPathObjectsSenderTemplateCType to protobuf object *otg.FlowRSVPPathObjectsSenderTemplateCType + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsSenderTemplateCType + // setMsg unmarshals FlowRSVPPathObjectsSenderTemplateCType from protobuf object *otg.FlowRSVPPathObjectsSenderTemplateCType + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsSenderTemplateCType) FlowRSVPPathObjectsSenderTemplateCType + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsSenderTemplateCType + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsSenderTemplateCType + // validate validates FlowRSVPPathObjectsSenderTemplateCType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsSenderTemplateCType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum, set in FlowRSVPPathObjectsSenderTemplateCType + Choice() FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum + // setChoice assigns FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum provided by user to FlowRSVPPathObjectsSenderTemplateCType + setChoice(value FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum) FlowRSVPPathObjectsSenderTemplateCType + // HasChoice checks if Choice has been set in FlowRSVPPathObjectsSenderTemplateCType + HasChoice() bool + // LspTunnelIpv4 returns FlowRSVPPathSenderTemplateLspTunnelIpv4, set in FlowRSVPPathObjectsSenderTemplateCType. + // FlowRSVPPathSenderTemplateLspTunnelIpv4 is class = SENDER_TEMPLATE, LSP_TUNNEL_IPv4 C-Type = 7 + LspTunnelIpv4() FlowRSVPPathSenderTemplateLspTunnelIpv4 + // SetLspTunnelIpv4 assigns FlowRSVPPathSenderTemplateLspTunnelIpv4 provided by user to FlowRSVPPathObjectsSenderTemplateCType. + // FlowRSVPPathSenderTemplateLspTunnelIpv4 is class = SENDER_TEMPLATE, LSP_TUNNEL_IPv4 C-Type = 7 + SetLspTunnelIpv4(value FlowRSVPPathSenderTemplateLspTunnelIpv4) FlowRSVPPathObjectsSenderTemplateCType + // HasLspTunnelIpv4 checks if LspTunnelIpv4 has been set in FlowRSVPPathObjectsSenderTemplateCType + HasLspTunnelIpv4() bool + setNil() +} + +type FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum string + +// Enum of Choice on FlowRSVPPathObjectsSenderTemplateCType +var FlowRSVPPathObjectsSenderTemplateCTypeChoice = struct { + LSP_TUNNEL_IPV4 FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum +}{ + LSP_TUNNEL_IPV4: FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum("lsp_tunnel_ipv4"), +} + +func (obj *flowRSVPPathObjectsSenderTemplateCType) Choice() FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum { + return FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowRSVPPathObjectsSenderTemplateCType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPPathObjectsSenderTemplateCType) setChoice(value FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum) FlowRSVPPathObjectsSenderTemplateCType { + intValue, ok := otg.FlowRSVPPathObjectsSenderTemplateCType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPPathObjectsSenderTemplateCType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.LspTunnelIpv4 = nil + obj.lspTunnelIpv4Holder = nil + + if value == FlowRSVPPathObjectsSenderTemplateCTypeChoice.LSP_TUNNEL_IPV4 { + obj.obj.LspTunnelIpv4 = NewFlowRSVPPathSenderTemplateLspTunnelIpv4().msg() + } + + return obj +} + +// description is TBD +// LspTunnelIpv4 returns a FlowRSVPPathSenderTemplateLspTunnelIpv4 +func (obj *flowRSVPPathObjectsSenderTemplateCType) LspTunnelIpv4() FlowRSVPPathSenderTemplateLspTunnelIpv4 { + if obj.obj.LspTunnelIpv4 == nil { + obj.setChoice(FlowRSVPPathObjectsSenderTemplateCTypeChoice.LSP_TUNNEL_IPV4) + } + if obj.lspTunnelIpv4Holder == nil { + obj.lspTunnelIpv4Holder = &flowRSVPPathSenderTemplateLspTunnelIpv4{obj: obj.obj.LspTunnelIpv4} + } + return obj.lspTunnelIpv4Holder +} + +// description is TBD +// LspTunnelIpv4 returns a FlowRSVPPathSenderTemplateLspTunnelIpv4 +func (obj *flowRSVPPathObjectsSenderTemplateCType) HasLspTunnelIpv4() bool { + return obj.obj.LspTunnelIpv4 != nil +} + +// description is TBD +// SetLspTunnelIpv4 sets the FlowRSVPPathSenderTemplateLspTunnelIpv4 value in the FlowRSVPPathObjectsSenderTemplateCType object +func (obj *flowRSVPPathObjectsSenderTemplateCType) SetLspTunnelIpv4(value FlowRSVPPathSenderTemplateLspTunnelIpv4) FlowRSVPPathObjectsSenderTemplateCType { + obj.setChoice(FlowRSVPPathObjectsSenderTemplateCTypeChoice.LSP_TUNNEL_IPV4) + obj.lspTunnelIpv4Holder = nil + obj.obj.LspTunnelIpv4 = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsSenderTemplateCType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.LspTunnelIpv4 != nil { + + obj.LspTunnelIpv4().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsSenderTemplateCType) setDefault() { + var choices_set int = 0 + var choice FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum + + if obj.obj.LspTunnelIpv4 != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsSenderTemplateCTypeChoice.LSP_TUNNEL_IPV4 + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPPathObjectsSenderTemplateCTypeChoice.LSP_TUNNEL_IPV4) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsSenderTemplateCType") + } + } else { + intVal := otg.FlowRSVPPathObjectsSenderTemplateCType_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPPathObjectsSenderTemplateCType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_path_objects_sender_tspec_c_type.go b/gosnappi/flow_rsvp_path_objects_sender_tspec_c_type.go new file mode 100644 index 00000000..05421f54 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_sender_tspec_c_type.go @@ -0,0 +1,396 @@ +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" +) + +// ***** FlowRSVPPathObjectsSenderTspecCType ***** +type flowRSVPPathObjectsSenderTspecCType struct { + validation + obj *otg.FlowRSVPPathObjectsSenderTspecCType + marshaller marshalFlowRSVPPathObjectsSenderTspecCType + unMarshaller unMarshalFlowRSVPPathObjectsSenderTspecCType + intServHolder FlowRSVPPathSenderTspecIntServ +} + +func NewFlowRSVPPathObjectsSenderTspecCType() FlowRSVPPathObjectsSenderTspecCType { + obj := flowRSVPPathObjectsSenderTspecCType{obj: &otg.FlowRSVPPathObjectsSenderTspecCType{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsSenderTspecCType) msg() *otg.FlowRSVPPathObjectsSenderTspecCType { + return obj.obj +} + +func (obj *flowRSVPPathObjectsSenderTspecCType) setMsg(msg *otg.FlowRSVPPathObjectsSenderTspecCType) FlowRSVPPathObjectsSenderTspecCType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsSenderTspecCType struct { + obj *flowRSVPPathObjectsSenderTspecCType +} + +type marshalFlowRSVPPathObjectsSenderTspecCType interface { + // ToProto marshals FlowRSVPPathObjectsSenderTspecCType to protobuf object *otg.FlowRSVPPathObjectsSenderTspecCType + ToProto() (*otg.FlowRSVPPathObjectsSenderTspecCType, error) + // ToPbText marshals FlowRSVPPathObjectsSenderTspecCType to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsSenderTspecCType to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsSenderTspecCType to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsSenderTspecCType struct { + obj *flowRSVPPathObjectsSenderTspecCType +} + +type unMarshalFlowRSVPPathObjectsSenderTspecCType interface { + // FromProto unmarshals FlowRSVPPathObjectsSenderTspecCType from protobuf object *otg.FlowRSVPPathObjectsSenderTspecCType + FromProto(msg *otg.FlowRSVPPathObjectsSenderTspecCType) (FlowRSVPPathObjectsSenderTspecCType, error) + // FromPbText unmarshals FlowRSVPPathObjectsSenderTspecCType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsSenderTspecCType from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsSenderTspecCType from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsSenderTspecCType) Marshal() marshalFlowRSVPPathObjectsSenderTspecCType { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsSenderTspecCType{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsSenderTspecCType) Unmarshal() unMarshalFlowRSVPPathObjectsSenderTspecCType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsSenderTspecCType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsSenderTspecCType) ToProto() (*otg.FlowRSVPPathObjectsSenderTspecCType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsSenderTspecCType) FromProto(msg *otg.FlowRSVPPathObjectsSenderTspecCType) (FlowRSVPPathObjectsSenderTspecCType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsSenderTspecCType) 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 *unMarshalflowRSVPPathObjectsSenderTspecCType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsSenderTspecCType) 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 *unMarshalflowRSVPPathObjectsSenderTspecCType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsSenderTspecCType) 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 *unMarshalflowRSVPPathObjectsSenderTspecCType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsSenderTspecCType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsSenderTspecCType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsSenderTspecCType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsSenderTspecCType) Clone() (FlowRSVPPathObjectsSenderTspecCType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsSenderTspecCType() + 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 +} + +func (obj *flowRSVPPathObjectsSenderTspecCType) setNil() { + obj.intServHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsSenderTspecCType is object for SENDER_TSPEC class. Currently supported c-type is int-serv (2). +type FlowRSVPPathObjectsSenderTspecCType interface { + Validation + // msg marshals FlowRSVPPathObjectsSenderTspecCType to protobuf object *otg.FlowRSVPPathObjectsSenderTspecCType + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsSenderTspecCType + // setMsg unmarshals FlowRSVPPathObjectsSenderTspecCType from protobuf object *otg.FlowRSVPPathObjectsSenderTspecCType + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsSenderTspecCType) FlowRSVPPathObjectsSenderTspecCType + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsSenderTspecCType + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsSenderTspecCType + // validate validates FlowRSVPPathObjectsSenderTspecCType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsSenderTspecCType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum, set in FlowRSVPPathObjectsSenderTspecCType + Choice() FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum + // setChoice assigns FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum provided by user to FlowRSVPPathObjectsSenderTspecCType + setChoice(value FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum) FlowRSVPPathObjectsSenderTspecCType + // HasChoice checks if Choice has been set in FlowRSVPPathObjectsSenderTspecCType + HasChoice() bool + // IntServ returns FlowRSVPPathSenderTspecIntServ, set in FlowRSVPPathObjectsSenderTspecCType. + // FlowRSVPPathSenderTspecIntServ is int-serv SENDER_TSPEC object: Class = 12, C-Type = 2 + IntServ() FlowRSVPPathSenderTspecIntServ + // SetIntServ assigns FlowRSVPPathSenderTspecIntServ provided by user to FlowRSVPPathObjectsSenderTspecCType. + // FlowRSVPPathSenderTspecIntServ is int-serv SENDER_TSPEC object: Class = 12, C-Type = 2 + SetIntServ(value FlowRSVPPathSenderTspecIntServ) FlowRSVPPathObjectsSenderTspecCType + // HasIntServ checks if IntServ has been set in FlowRSVPPathObjectsSenderTspecCType + HasIntServ() bool + setNil() +} + +type FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum string + +// Enum of Choice on FlowRSVPPathObjectsSenderTspecCType +var FlowRSVPPathObjectsSenderTspecCTypeChoice = struct { + INT_SERV FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum +}{ + INT_SERV: FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum("int_serv"), +} + +func (obj *flowRSVPPathObjectsSenderTspecCType) Choice() FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum { + return FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowRSVPPathObjectsSenderTspecCType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPPathObjectsSenderTspecCType) setChoice(value FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum) FlowRSVPPathObjectsSenderTspecCType { + intValue, ok := otg.FlowRSVPPathObjectsSenderTspecCType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPPathObjectsSenderTspecCType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.IntServ = nil + obj.intServHolder = nil + + if value == FlowRSVPPathObjectsSenderTspecCTypeChoice.INT_SERV { + obj.obj.IntServ = NewFlowRSVPPathSenderTspecIntServ().msg() + } + + return obj +} + +// description is TBD +// IntServ returns a FlowRSVPPathSenderTspecIntServ +func (obj *flowRSVPPathObjectsSenderTspecCType) IntServ() FlowRSVPPathSenderTspecIntServ { + if obj.obj.IntServ == nil { + obj.setChoice(FlowRSVPPathObjectsSenderTspecCTypeChoice.INT_SERV) + } + if obj.intServHolder == nil { + obj.intServHolder = &flowRSVPPathSenderTspecIntServ{obj: obj.obj.IntServ} + } + return obj.intServHolder +} + +// description is TBD +// IntServ returns a FlowRSVPPathSenderTspecIntServ +func (obj *flowRSVPPathObjectsSenderTspecCType) HasIntServ() bool { + return obj.obj.IntServ != nil +} + +// description is TBD +// SetIntServ sets the FlowRSVPPathSenderTspecIntServ value in the FlowRSVPPathObjectsSenderTspecCType object +func (obj *flowRSVPPathObjectsSenderTspecCType) SetIntServ(value FlowRSVPPathSenderTspecIntServ) FlowRSVPPathObjectsSenderTspecCType { + obj.setChoice(FlowRSVPPathObjectsSenderTspecCTypeChoice.INT_SERV) + obj.intServHolder = nil + obj.obj.IntServ = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsSenderTspecCType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.IntServ != nil { + + obj.IntServ().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsSenderTspecCType) setDefault() { + var choices_set int = 0 + var choice FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum + + if obj.obj.IntServ != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsSenderTspecCTypeChoice.INT_SERV + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPPathObjectsSenderTspecCTypeChoice.INT_SERV) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsSenderTspecCType") + } + } else { + intVal := otg.FlowRSVPPathObjectsSenderTspecCType_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPPathObjectsSenderTspecCType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_path_objects_session_attribute_c_type.go b/gosnappi/flow_rsvp_path_objects_session_attribute_c_type.go new file mode 100644 index 00000000..6ef47733 --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_session_attribute_c_type.go @@ -0,0 +1,452 @@ +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" +) + +// ***** FlowRSVPPathObjectsSessionAttributeCType ***** +type flowRSVPPathObjectsSessionAttributeCType struct { + validation + obj *otg.FlowRSVPPathObjectsSessionAttributeCType + marshaller marshalFlowRSVPPathObjectsSessionAttributeCType + unMarshaller unMarshalFlowRSVPPathObjectsSessionAttributeCType + lspTunnelHolder FlowRSVPPathSessionAttributeLspTunnel + lspTunnelRaHolder FlowRSVPPathSessionAttributeLspTunnelRa +} + +func NewFlowRSVPPathObjectsSessionAttributeCType() FlowRSVPPathObjectsSessionAttributeCType { + obj := flowRSVPPathObjectsSessionAttributeCType{obj: &otg.FlowRSVPPathObjectsSessionAttributeCType{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsSessionAttributeCType) msg() *otg.FlowRSVPPathObjectsSessionAttributeCType { + return obj.obj +} + +func (obj *flowRSVPPathObjectsSessionAttributeCType) setMsg(msg *otg.FlowRSVPPathObjectsSessionAttributeCType) FlowRSVPPathObjectsSessionAttributeCType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsSessionAttributeCType struct { + obj *flowRSVPPathObjectsSessionAttributeCType +} + +type marshalFlowRSVPPathObjectsSessionAttributeCType interface { + // ToProto marshals FlowRSVPPathObjectsSessionAttributeCType to protobuf object *otg.FlowRSVPPathObjectsSessionAttributeCType + ToProto() (*otg.FlowRSVPPathObjectsSessionAttributeCType, error) + // ToPbText marshals FlowRSVPPathObjectsSessionAttributeCType to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsSessionAttributeCType to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsSessionAttributeCType to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsSessionAttributeCType struct { + obj *flowRSVPPathObjectsSessionAttributeCType +} + +type unMarshalFlowRSVPPathObjectsSessionAttributeCType interface { + // FromProto unmarshals FlowRSVPPathObjectsSessionAttributeCType from protobuf object *otg.FlowRSVPPathObjectsSessionAttributeCType + FromProto(msg *otg.FlowRSVPPathObjectsSessionAttributeCType) (FlowRSVPPathObjectsSessionAttributeCType, error) + // FromPbText unmarshals FlowRSVPPathObjectsSessionAttributeCType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsSessionAttributeCType from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsSessionAttributeCType from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsSessionAttributeCType) Marshal() marshalFlowRSVPPathObjectsSessionAttributeCType { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsSessionAttributeCType{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsSessionAttributeCType) Unmarshal() unMarshalFlowRSVPPathObjectsSessionAttributeCType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsSessionAttributeCType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsSessionAttributeCType) ToProto() (*otg.FlowRSVPPathObjectsSessionAttributeCType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsSessionAttributeCType) FromProto(msg *otg.FlowRSVPPathObjectsSessionAttributeCType) (FlowRSVPPathObjectsSessionAttributeCType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsSessionAttributeCType) 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 *unMarshalflowRSVPPathObjectsSessionAttributeCType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsSessionAttributeCType) 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 *unMarshalflowRSVPPathObjectsSessionAttributeCType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsSessionAttributeCType) 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 *unMarshalflowRSVPPathObjectsSessionAttributeCType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsSessionAttributeCType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsSessionAttributeCType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsSessionAttributeCType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsSessionAttributeCType) Clone() (FlowRSVPPathObjectsSessionAttributeCType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsSessionAttributeCType() + 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 +} + +func (obj *flowRSVPPathObjectsSessionAttributeCType) setNil() { + obj.lspTunnelHolder = nil + obj.lspTunnelRaHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsSessionAttributeCType is object for SESSION_ATTRIBUTE class. Currently supported c-type is LSP_Tunnel_RA (1) and LSP_Tunnel (7). +type FlowRSVPPathObjectsSessionAttributeCType interface { + Validation + // msg marshals FlowRSVPPathObjectsSessionAttributeCType to protobuf object *otg.FlowRSVPPathObjectsSessionAttributeCType + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsSessionAttributeCType + // setMsg unmarshals FlowRSVPPathObjectsSessionAttributeCType from protobuf object *otg.FlowRSVPPathObjectsSessionAttributeCType + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsSessionAttributeCType) FlowRSVPPathObjectsSessionAttributeCType + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsSessionAttributeCType + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsSessionAttributeCType + // validate validates FlowRSVPPathObjectsSessionAttributeCType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsSessionAttributeCType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum, set in FlowRSVPPathObjectsSessionAttributeCType + Choice() FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum + // setChoice assigns FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum provided by user to FlowRSVPPathObjectsSessionAttributeCType + setChoice(value FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum) FlowRSVPPathObjectsSessionAttributeCType + // HasChoice checks if Choice has been set in FlowRSVPPathObjectsSessionAttributeCType + HasChoice() bool + // LspTunnel returns FlowRSVPPathSessionAttributeLspTunnel, set in FlowRSVPPathObjectsSessionAttributeCType. + // FlowRSVPPathSessionAttributeLspTunnel is sESSION_ATTRIBUTE class = 207, LSP_TUNNEL_RA C-Type = 7, resource affinity information. + LspTunnel() FlowRSVPPathSessionAttributeLspTunnel + // SetLspTunnel assigns FlowRSVPPathSessionAttributeLspTunnel provided by user to FlowRSVPPathObjectsSessionAttributeCType. + // FlowRSVPPathSessionAttributeLspTunnel is sESSION_ATTRIBUTE class = 207, LSP_TUNNEL_RA C-Type = 7, resource affinity information. + SetLspTunnel(value FlowRSVPPathSessionAttributeLspTunnel) FlowRSVPPathObjectsSessionAttributeCType + // HasLspTunnel checks if LspTunnel has been set in FlowRSVPPathObjectsSessionAttributeCType + HasLspTunnel() bool + // LspTunnelRa returns FlowRSVPPathSessionAttributeLspTunnelRa, set in FlowRSVPPathObjectsSessionAttributeCType. + // FlowRSVPPathSessionAttributeLspTunnelRa is sESSION_ATTRIBUTE class = 207, LSP_TUNNEL_RA C-Type = 1, it carries resource affinity information. + LspTunnelRa() FlowRSVPPathSessionAttributeLspTunnelRa + // SetLspTunnelRa assigns FlowRSVPPathSessionAttributeLspTunnelRa provided by user to FlowRSVPPathObjectsSessionAttributeCType. + // FlowRSVPPathSessionAttributeLspTunnelRa is sESSION_ATTRIBUTE class = 207, LSP_TUNNEL_RA C-Type = 1, it carries resource affinity information. + SetLspTunnelRa(value FlowRSVPPathSessionAttributeLspTunnelRa) FlowRSVPPathObjectsSessionAttributeCType + // HasLspTunnelRa checks if LspTunnelRa has been set in FlowRSVPPathObjectsSessionAttributeCType + HasLspTunnelRa() bool + setNil() +} + +type FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum string + +// Enum of Choice on FlowRSVPPathObjectsSessionAttributeCType +var FlowRSVPPathObjectsSessionAttributeCTypeChoice = struct { + LSP_TUNNEL FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum + LSP_TUNNEL_RA FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum +}{ + LSP_TUNNEL: FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum("lsp_tunnel"), + LSP_TUNNEL_RA: FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum("lsp_tunnel_ra"), +} + +func (obj *flowRSVPPathObjectsSessionAttributeCType) Choice() FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum { + return FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowRSVPPathObjectsSessionAttributeCType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPPathObjectsSessionAttributeCType) setChoice(value FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum) FlowRSVPPathObjectsSessionAttributeCType { + intValue, ok := otg.FlowRSVPPathObjectsSessionAttributeCType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPPathObjectsSessionAttributeCType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.LspTunnelRa = nil + obj.lspTunnelRaHolder = nil + obj.obj.LspTunnel = nil + obj.lspTunnelHolder = nil + + if value == FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL { + obj.obj.LspTunnel = NewFlowRSVPPathSessionAttributeLspTunnel().msg() + } + + if value == FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL_RA { + obj.obj.LspTunnelRa = NewFlowRSVPPathSessionAttributeLspTunnelRa().msg() + } + + return obj +} + +// description is TBD +// LspTunnel returns a FlowRSVPPathSessionAttributeLspTunnel +func (obj *flowRSVPPathObjectsSessionAttributeCType) LspTunnel() FlowRSVPPathSessionAttributeLspTunnel { + if obj.obj.LspTunnel == nil { + obj.setChoice(FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL) + } + if obj.lspTunnelHolder == nil { + obj.lspTunnelHolder = &flowRSVPPathSessionAttributeLspTunnel{obj: obj.obj.LspTunnel} + } + return obj.lspTunnelHolder +} + +// description is TBD +// LspTunnel returns a FlowRSVPPathSessionAttributeLspTunnel +func (obj *flowRSVPPathObjectsSessionAttributeCType) HasLspTunnel() bool { + return obj.obj.LspTunnel != nil +} + +// description is TBD +// SetLspTunnel sets the FlowRSVPPathSessionAttributeLspTunnel value in the FlowRSVPPathObjectsSessionAttributeCType object +func (obj *flowRSVPPathObjectsSessionAttributeCType) SetLspTunnel(value FlowRSVPPathSessionAttributeLspTunnel) FlowRSVPPathObjectsSessionAttributeCType { + obj.setChoice(FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL) + obj.lspTunnelHolder = nil + obj.obj.LspTunnel = value.msg() + + return obj +} + +// description is TBD +// LspTunnelRa returns a FlowRSVPPathSessionAttributeLspTunnelRa +func (obj *flowRSVPPathObjectsSessionAttributeCType) LspTunnelRa() FlowRSVPPathSessionAttributeLspTunnelRa { + if obj.obj.LspTunnelRa == nil { + obj.setChoice(FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL_RA) + } + if obj.lspTunnelRaHolder == nil { + obj.lspTunnelRaHolder = &flowRSVPPathSessionAttributeLspTunnelRa{obj: obj.obj.LspTunnelRa} + } + return obj.lspTunnelRaHolder +} + +// description is TBD +// LspTunnelRa returns a FlowRSVPPathSessionAttributeLspTunnelRa +func (obj *flowRSVPPathObjectsSessionAttributeCType) HasLspTunnelRa() bool { + return obj.obj.LspTunnelRa != nil +} + +// description is TBD +// SetLspTunnelRa sets the FlowRSVPPathSessionAttributeLspTunnelRa value in the FlowRSVPPathObjectsSessionAttributeCType object +func (obj *flowRSVPPathObjectsSessionAttributeCType) SetLspTunnelRa(value FlowRSVPPathSessionAttributeLspTunnelRa) FlowRSVPPathObjectsSessionAttributeCType { + obj.setChoice(FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL_RA) + obj.lspTunnelRaHolder = nil + obj.obj.LspTunnelRa = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsSessionAttributeCType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.LspTunnel != nil { + + obj.LspTunnel().validateObj(vObj, set_default) + } + + if obj.obj.LspTunnelRa != nil { + + obj.LspTunnelRa().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsSessionAttributeCType) setDefault() { + var choices_set int = 0 + var choice FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum + + if obj.obj.LspTunnel != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL + } + + if obj.obj.LspTunnelRa != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL_RA + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsSessionAttributeCType") + } + } else { + intVal := otg.FlowRSVPPathObjectsSessionAttributeCType_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPPathObjectsSessionAttributeCType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_path_objects_session_c_type.go b/gosnappi/flow_rsvp_path_objects_session_c_type.go new file mode 100644 index 00000000..66dc095b --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_session_c_type.go @@ -0,0 +1,396 @@ +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" +) + +// ***** FlowRSVPPathObjectsSessionCType ***** +type flowRSVPPathObjectsSessionCType struct { + validation + obj *otg.FlowRSVPPathObjectsSessionCType + marshaller marshalFlowRSVPPathObjectsSessionCType + unMarshaller unMarshalFlowRSVPPathObjectsSessionCType + lspTunnelIpv4Holder FlowRSVPPathSessionLspTunnelIpv4 +} + +func NewFlowRSVPPathObjectsSessionCType() FlowRSVPPathObjectsSessionCType { + obj := flowRSVPPathObjectsSessionCType{obj: &otg.FlowRSVPPathObjectsSessionCType{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsSessionCType) msg() *otg.FlowRSVPPathObjectsSessionCType { + return obj.obj +} + +func (obj *flowRSVPPathObjectsSessionCType) setMsg(msg *otg.FlowRSVPPathObjectsSessionCType) FlowRSVPPathObjectsSessionCType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsSessionCType struct { + obj *flowRSVPPathObjectsSessionCType +} + +type marshalFlowRSVPPathObjectsSessionCType interface { + // ToProto marshals FlowRSVPPathObjectsSessionCType to protobuf object *otg.FlowRSVPPathObjectsSessionCType + ToProto() (*otg.FlowRSVPPathObjectsSessionCType, error) + // ToPbText marshals FlowRSVPPathObjectsSessionCType to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsSessionCType to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsSessionCType to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsSessionCType struct { + obj *flowRSVPPathObjectsSessionCType +} + +type unMarshalFlowRSVPPathObjectsSessionCType interface { + // FromProto unmarshals FlowRSVPPathObjectsSessionCType from protobuf object *otg.FlowRSVPPathObjectsSessionCType + FromProto(msg *otg.FlowRSVPPathObjectsSessionCType) (FlowRSVPPathObjectsSessionCType, error) + // FromPbText unmarshals FlowRSVPPathObjectsSessionCType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsSessionCType from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsSessionCType from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsSessionCType) Marshal() marshalFlowRSVPPathObjectsSessionCType { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsSessionCType{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsSessionCType) Unmarshal() unMarshalFlowRSVPPathObjectsSessionCType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsSessionCType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsSessionCType) ToProto() (*otg.FlowRSVPPathObjectsSessionCType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsSessionCType) FromProto(msg *otg.FlowRSVPPathObjectsSessionCType) (FlowRSVPPathObjectsSessionCType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsSessionCType) 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 *unMarshalflowRSVPPathObjectsSessionCType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsSessionCType) 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 *unMarshalflowRSVPPathObjectsSessionCType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsSessionCType) 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 *unMarshalflowRSVPPathObjectsSessionCType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsSessionCType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsSessionCType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsSessionCType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsSessionCType) Clone() (FlowRSVPPathObjectsSessionCType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsSessionCType() + 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 +} + +func (obj *flowRSVPPathObjectsSessionCType) setNil() { + obj.lspTunnelIpv4Holder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsSessionCType is the body of an object corresponding to the class number and c-type. Currently supported c-type for SESSION object is LSP Tunnel IPv4 (7). +type FlowRSVPPathObjectsSessionCType interface { + Validation + // msg marshals FlowRSVPPathObjectsSessionCType to protobuf object *otg.FlowRSVPPathObjectsSessionCType + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsSessionCType + // setMsg unmarshals FlowRSVPPathObjectsSessionCType from protobuf object *otg.FlowRSVPPathObjectsSessionCType + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsSessionCType) FlowRSVPPathObjectsSessionCType + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsSessionCType + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsSessionCType + // validate validates FlowRSVPPathObjectsSessionCType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsSessionCType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPPathObjectsSessionCTypeChoiceEnum, set in FlowRSVPPathObjectsSessionCType + Choice() FlowRSVPPathObjectsSessionCTypeChoiceEnum + // setChoice assigns FlowRSVPPathObjectsSessionCTypeChoiceEnum provided by user to FlowRSVPPathObjectsSessionCType + setChoice(value FlowRSVPPathObjectsSessionCTypeChoiceEnum) FlowRSVPPathObjectsSessionCType + // HasChoice checks if Choice has been set in FlowRSVPPathObjectsSessionCType + HasChoice() bool + // LspTunnelIpv4 returns FlowRSVPPathSessionLspTunnelIpv4, set in FlowRSVPPathObjectsSessionCType. + // FlowRSVPPathSessionLspTunnelIpv4 is class = SESSION, LSP_TUNNEL_IPv4 C-Type = 7. + LspTunnelIpv4() FlowRSVPPathSessionLspTunnelIpv4 + // SetLspTunnelIpv4 assigns FlowRSVPPathSessionLspTunnelIpv4 provided by user to FlowRSVPPathObjectsSessionCType. + // FlowRSVPPathSessionLspTunnelIpv4 is class = SESSION, LSP_TUNNEL_IPv4 C-Type = 7. + SetLspTunnelIpv4(value FlowRSVPPathSessionLspTunnelIpv4) FlowRSVPPathObjectsSessionCType + // HasLspTunnelIpv4 checks if LspTunnelIpv4 has been set in FlowRSVPPathObjectsSessionCType + HasLspTunnelIpv4() bool + setNil() +} + +type FlowRSVPPathObjectsSessionCTypeChoiceEnum string + +// Enum of Choice on FlowRSVPPathObjectsSessionCType +var FlowRSVPPathObjectsSessionCTypeChoice = struct { + LSP_TUNNEL_IPV4 FlowRSVPPathObjectsSessionCTypeChoiceEnum +}{ + LSP_TUNNEL_IPV4: FlowRSVPPathObjectsSessionCTypeChoiceEnum("lsp_tunnel_ipv4"), +} + +func (obj *flowRSVPPathObjectsSessionCType) Choice() FlowRSVPPathObjectsSessionCTypeChoiceEnum { + return FlowRSVPPathObjectsSessionCTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowRSVPPathObjectsSessionCType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPPathObjectsSessionCType) setChoice(value FlowRSVPPathObjectsSessionCTypeChoiceEnum) FlowRSVPPathObjectsSessionCType { + intValue, ok := otg.FlowRSVPPathObjectsSessionCType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPPathObjectsSessionCTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPPathObjectsSessionCType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.LspTunnelIpv4 = nil + obj.lspTunnelIpv4Holder = nil + + if value == FlowRSVPPathObjectsSessionCTypeChoice.LSP_TUNNEL_IPV4 { + obj.obj.LspTunnelIpv4 = NewFlowRSVPPathSessionLspTunnelIpv4().msg() + } + + return obj +} + +// description is TBD +// LspTunnelIpv4 returns a FlowRSVPPathSessionLspTunnelIpv4 +func (obj *flowRSVPPathObjectsSessionCType) LspTunnelIpv4() FlowRSVPPathSessionLspTunnelIpv4 { + if obj.obj.LspTunnelIpv4 == nil { + obj.setChoice(FlowRSVPPathObjectsSessionCTypeChoice.LSP_TUNNEL_IPV4) + } + if obj.lspTunnelIpv4Holder == nil { + obj.lspTunnelIpv4Holder = &flowRSVPPathSessionLspTunnelIpv4{obj: obj.obj.LspTunnelIpv4} + } + return obj.lspTunnelIpv4Holder +} + +// description is TBD +// LspTunnelIpv4 returns a FlowRSVPPathSessionLspTunnelIpv4 +func (obj *flowRSVPPathObjectsSessionCType) HasLspTunnelIpv4() bool { + return obj.obj.LspTunnelIpv4 != nil +} + +// description is TBD +// SetLspTunnelIpv4 sets the FlowRSVPPathSessionLspTunnelIpv4 value in the FlowRSVPPathObjectsSessionCType object +func (obj *flowRSVPPathObjectsSessionCType) SetLspTunnelIpv4(value FlowRSVPPathSessionLspTunnelIpv4) FlowRSVPPathObjectsSessionCType { + obj.setChoice(FlowRSVPPathObjectsSessionCTypeChoice.LSP_TUNNEL_IPV4) + obj.lspTunnelIpv4Holder = nil + obj.obj.LspTunnelIpv4 = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsSessionCType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.LspTunnelIpv4 != nil { + + obj.LspTunnelIpv4().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsSessionCType) setDefault() { + var choices_set int = 0 + var choice FlowRSVPPathObjectsSessionCTypeChoiceEnum + + if obj.obj.LspTunnelIpv4 != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsSessionCTypeChoice.LSP_TUNNEL_IPV4 + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPPathObjectsSessionCTypeChoice.LSP_TUNNEL_IPV4) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsSessionCType") + } + } else { + intVal := otg.FlowRSVPPathObjectsSessionCType_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPPathObjectsSessionCType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_path_objects_time_values_c_type.go b/gosnappi/flow_rsvp_path_objects_time_values_c_type.go new file mode 100644 index 00000000..cdb0ad3d --- /dev/null +++ b/gosnappi/flow_rsvp_path_objects_time_values_c_type.go @@ -0,0 +1,396 @@ +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" +) + +// ***** FlowRSVPPathObjectsTimeValuesCType ***** +type flowRSVPPathObjectsTimeValuesCType struct { + validation + obj *otg.FlowRSVPPathObjectsTimeValuesCType + marshaller marshalFlowRSVPPathObjectsTimeValuesCType + unMarshaller unMarshalFlowRSVPPathObjectsTimeValuesCType + type_1Holder FlowRSVPPathTimeValuesType1 +} + +func NewFlowRSVPPathObjectsTimeValuesCType() FlowRSVPPathObjectsTimeValuesCType { + obj := flowRSVPPathObjectsTimeValuesCType{obj: &otg.FlowRSVPPathObjectsTimeValuesCType{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathObjectsTimeValuesCType) msg() *otg.FlowRSVPPathObjectsTimeValuesCType { + return obj.obj +} + +func (obj *flowRSVPPathObjectsTimeValuesCType) setMsg(msg *otg.FlowRSVPPathObjectsTimeValuesCType) FlowRSVPPathObjectsTimeValuesCType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathObjectsTimeValuesCType struct { + obj *flowRSVPPathObjectsTimeValuesCType +} + +type marshalFlowRSVPPathObjectsTimeValuesCType interface { + // ToProto marshals FlowRSVPPathObjectsTimeValuesCType to protobuf object *otg.FlowRSVPPathObjectsTimeValuesCType + ToProto() (*otg.FlowRSVPPathObjectsTimeValuesCType, error) + // ToPbText marshals FlowRSVPPathObjectsTimeValuesCType to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathObjectsTimeValuesCType to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathObjectsTimeValuesCType to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathObjectsTimeValuesCType struct { + obj *flowRSVPPathObjectsTimeValuesCType +} + +type unMarshalFlowRSVPPathObjectsTimeValuesCType interface { + // FromProto unmarshals FlowRSVPPathObjectsTimeValuesCType from protobuf object *otg.FlowRSVPPathObjectsTimeValuesCType + FromProto(msg *otg.FlowRSVPPathObjectsTimeValuesCType) (FlowRSVPPathObjectsTimeValuesCType, error) + // FromPbText unmarshals FlowRSVPPathObjectsTimeValuesCType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathObjectsTimeValuesCType from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathObjectsTimeValuesCType from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathObjectsTimeValuesCType) Marshal() marshalFlowRSVPPathObjectsTimeValuesCType { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathObjectsTimeValuesCType{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathObjectsTimeValuesCType) Unmarshal() unMarshalFlowRSVPPathObjectsTimeValuesCType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathObjectsTimeValuesCType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathObjectsTimeValuesCType) ToProto() (*otg.FlowRSVPPathObjectsTimeValuesCType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathObjectsTimeValuesCType) FromProto(msg *otg.FlowRSVPPathObjectsTimeValuesCType) (FlowRSVPPathObjectsTimeValuesCType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathObjectsTimeValuesCType) 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 *unMarshalflowRSVPPathObjectsTimeValuesCType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathObjectsTimeValuesCType) 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 *unMarshalflowRSVPPathObjectsTimeValuesCType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathObjectsTimeValuesCType) 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 *unMarshalflowRSVPPathObjectsTimeValuesCType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathObjectsTimeValuesCType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsTimeValuesCType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathObjectsTimeValuesCType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathObjectsTimeValuesCType) Clone() (FlowRSVPPathObjectsTimeValuesCType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathObjectsTimeValuesCType() + 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 +} + +func (obj *flowRSVPPathObjectsTimeValuesCType) setNil() { + obj.type_1Holder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathObjectsTimeValuesCType is object for TIME_VALUES class. Currently supported c-type is Type 1 Time Value (1). +type FlowRSVPPathObjectsTimeValuesCType interface { + Validation + // msg marshals FlowRSVPPathObjectsTimeValuesCType to protobuf object *otg.FlowRSVPPathObjectsTimeValuesCType + // and doesn't set defaults + msg() *otg.FlowRSVPPathObjectsTimeValuesCType + // setMsg unmarshals FlowRSVPPathObjectsTimeValuesCType from protobuf object *otg.FlowRSVPPathObjectsTimeValuesCType + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathObjectsTimeValuesCType) FlowRSVPPathObjectsTimeValuesCType + // provides marshal interface + Marshal() marshalFlowRSVPPathObjectsTimeValuesCType + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathObjectsTimeValuesCType + // validate validates FlowRSVPPathObjectsTimeValuesCType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathObjectsTimeValuesCType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum, set in FlowRSVPPathObjectsTimeValuesCType + Choice() FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum + // setChoice assigns FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum provided by user to FlowRSVPPathObjectsTimeValuesCType + setChoice(value FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum) FlowRSVPPathObjectsTimeValuesCType + // HasChoice checks if Choice has been set in FlowRSVPPathObjectsTimeValuesCType + HasChoice() bool + // Type1 returns FlowRSVPPathTimeValuesType1, set in FlowRSVPPathObjectsTimeValuesCType. + // FlowRSVPPathTimeValuesType1 is tIME_VALUES Object: Class = 5, C-Type = 1 + Type1() FlowRSVPPathTimeValuesType1 + // SetType1 assigns FlowRSVPPathTimeValuesType1 provided by user to FlowRSVPPathObjectsTimeValuesCType. + // FlowRSVPPathTimeValuesType1 is tIME_VALUES Object: Class = 5, C-Type = 1 + SetType1(value FlowRSVPPathTimeValuesType1) FlowRSVPPathObjectsTimeValuesCType + // HasType1 checks if Type1 has been set in FlowRSVPPathObjectsTimeValuesCType + HasType1() bool + setNil() +} + +type FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum string + +// Enum of Choice on FlowRSVPPathObjectsTimeValuesCType +var FlowRSVPPathObjectsTimeValuesCTypeChoice = struct { + TYPE_1 FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum +}{ + TYPE_1: FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum("type_1"), +} + +func (obj *flowRSVPPathObjectsTimeValuesCType) Choice() FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum { + return FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowRSVPPathObjectsTimeValuesCType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPPathObjectsTimeValuesCType) setChoice(value FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum) FlowRSVPPathObjectsTimeValuesCType { + intValue, ok := otg.FlowRSVPPathObjectsTimeValuesCType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPPathObjectsTimeValuesCType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Type_1 = nil + obj.type_1Holder = nil + + if value == FlowRSVPPathObjectsTimeValuesCTypeChoice.TYPE_1 { + obj.obj.Type_1 = NewFlowRSVPPathTimeValuesType1().msg() + } + + return obj +} + +// description is TBD +// Type1 returns a FlowRSVPPathTimeValuesType1 +func (obj *flowRSVPPathObjectsTimeValuesCType) Type1() FlowRSVPPathTimeValuesType1 { + if obj.obj.Type_1 == nil { + obj.setChoice(FlowRSVPPathObjectsTimeValuesCTypeChoice.TYPE_1) + } + if obj.type_1Holder == nil { + obj.type_1Holder = &flowRSVPPathTimeValuesType1{obj: obj.obj.Type_1} + } + return obj.type_1Holder +} + +// description is TBD +// Type1 returns a FlowRSVPPathTimeValuesType1 +func (obj *flowRSVPPathObjectsTimeValuesCType) HasType1() bool { + return obj.obj.Type_1 != nil +} + +// description is TBD +// SetType1 sets the FlowRSVPPathTimeValuesType1 value in the FlowRSVPPathObjectsTimeValuesCType object +func (obj *flowRSVPPathObjectsTimeValuesCType) SetType1(value FlowRSVPPathTimeValuesType1) FlowRSVPPathObjectsTimeValuesCType { + obj.setChoice(FlowRSVPPathObjectsTimeValuesCTypeChoice.TYPE_1) + obj.type_1Holder = nil + obj.obj.Type_1 = value.msg() + + return obj +} + +func (obj *flowRSVPPathObjectsTimeValuesCType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Type_1 != nil { + + obj.Type1().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathObjectsTimeValuesCType) setDefault() { + var choices_set int = 0 + var choice FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum + + if obj.obj.Type_1 != nil { + choices_set += 1 + choice = FlowRSVPPathObjectsTimeValuesCTypeChoice.TYPE_1 + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPPathObjectsTimeValuesCTypeChoice.TYPE_1) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsTimeValuesCType") + } + } else { + intVal := otg.FlowRSVPPathObjectsTimeValuesCType_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPPathObjectsTimeValuesCType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_path_record_route_label.go b/gosnappi/flow_rsvp_path_record_route_label.go new file mode 100644 index 00000000..0f1d8f55 --- /dev/null +++ b/gosnappi/flow_rsvp_path_record_route_label.go @@ -0,0 +1,445 @@ +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" +) + +// ***** FlowRSVPPathRecordRouteLabel ***** +type flowRSVPPathRecordRouteLabel struct { + validation + obj *otg.FlowRSVPPathRecordRouteLabel + marshaller marshalFlowRSVPPathRecordRouteLabel + unMarshaller unMarshalFlowRSVPPathRecordRouteLabel +} + +func NewFlowRSVPPathRecordRouteLabel() FlowRSVPPathRecordRouteLabel { + obj := flowRSVPPathRecordRouteLabel{obj: &otg.FlowRSVPPathRecordRouteLabel{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathRecordRouteLabel) msg() *otg.FlowRSVPPathRecordRouteLabel { + return obj.obj +} + +func (obj *flowRSVPPathRecordRouteLabel) setMsg(msg *otg.FlowRSVPPathRecordRouteLabel) FlowRSVPPathRecordRouteLabel { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathRecordRouteLabel struct { + obj *flowRSVPPathRecordRouteLabel +} + +type marshalFlowRSVPPathRecordRouteLabel interface { + // ToProto marshals FlowRSVPPathRecordRouteLabel to protobuf object *otg.FlowRSVPPathRecordRouteLabel + ToProto() (*otg.FlowRSVPPathRecordRouteLabel, error) + // ToPbText marshals FlowRSVPPathRecordRouteLabel to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathRecordRouteLabel to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathRecordRouteLabel to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathRecordRouteLabel struct { + obj *flowRSVPPathRecordRouteLabel +} + +type unMarshalFlowRSVPPathRecordRouteLabel interface { + // FromProto unmarshals FlowRSVPPathRecordRouteLabel from protobuf object *otg.FlowRSVPPathRecordRouteLabel + FromProto(msg *otg.FlowRSVPPathRecordRouteLabel) (FlowRSVPPathRecordRouteLabel, error) + // FromPbText unmarshals FlowRSVPPathRecordRouteLabel from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathRecordRouteLabel from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathRecordRouteLabel from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathRecordRouteLabel) Marshal() marshalFlowRSVPPathRecordRouteLabel { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathRecordRouteLabel{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathRecordRouteLabel) Unmarshal() unMarshalFlowRSVPPathRecordRouteLabel { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathRecordRouteLabel{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathRecordRouteLabel) ToProto() (*otg.FlowRSVPPathRecordRouteLabel, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathRecordRouteLabel) FromProto(msg *otg.FlowRSVPPathRecordRouteLabel) (FlowRSVPPathRecordRouteLabel, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathRecordRouteLabel) 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 *unMarshalflowRSVPPathRecordRouteLabel) 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 *marshalflowRSVPPathRecordRouteLabel) 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 *unMarshalflowRSVPPathRecordRouteLabel) 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 *marshalflowRSVPPathRecordRouteLabel) 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 *unMarshalflowRSVPPathRecordRouteLabel) 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 *flowRSVPPathRecordRouteLabel) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathRecordRouteLabel) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathRecordRouteLabel) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathRecordRouteLabel) Clone() (FlowRSVPPathRecordRouteLabel, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathRecordRouteLabel() + 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 +} + +// FlowRSVPPathRecordRouteLabel is description is TBD +type FlowRSVPPathRecordRouteLabel interface { + Validation + // msg marshals FlowRSVPPathRecordRouteLabel to protobuf object *otg.FlowRSVPPathRecordRouteLabel + // and doesn't set defaults + msg() *otg.FlowRSVPPathRecordRouteLabel + // setMsg unmarshals FlowRSVPPathRecordRouteLabel from protobuf object *otg.FlowRSVPPathRecordRouteLabel + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathRecordRouteLabel) FlowRSVPPathRecordRouteLabel + // provides marshal interface + Marshal() marshalFlowRSVPPathRecordRouteLabel + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathRecordRouteLabel + // validate validates FlowRSVPPathRecordRouteLabel + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathRecordRouteLabel, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPPathRecordRouteLabelChoiceEnum, set in FlowRSVPPathRecordRouteLabel + Choice() FlowRSVPPathRecordRouteLabelChoiceEnum + // setChoice assigns FlowRSVPPathRecordRouteLabelChoiceEnum provided by user to FlowRSVPPathRecordRouteLabel + setChoice(value FlowRSVPPathRecordRouteLabelChoiceEnum) FlowRSVPPathRecordRouteLabel + // HasChoice checks if Choice has been set in FlowRSVPPathRecordRouteLabel + HasChoice() bool + // AsInteger returns uint32, set in FlowRSVPPathRecordRouteLabel. + AsInteger() uint32 + // SetAsInteger assigns uint32 provided by user to FlowRSVPPathRecordRouteLabel + SetAsInteger(value uint32) FlowRSVPPathRecordRouteLabel + // HasAsInteger checks if AsInteger has been set in FlowRSVPPathRecordRouteLabel + HasAsInteger() bool + // AsHex returns string, set in FlowRSVPPathRecordRouteLabel. + AsHex() string + // SetAsHex assigns string provided by user to FlowRSVPPathRecordRouteLabel + SetAsHex(value string) FlowRSVPPathRecordRouteLabel + // HasAsHex checks if AsHex has been set in FlowRSVPPathRecordRouteLabel + HasAsHex() bool +} + +type FlowRSVPPathRecordRouteLabelChoiceEnum string + +// Enum of Choice on FlowRSVPPathRecordRouteLabel +var FlowRSVPPathRecordRouteLabelChoice = struct { + AS_INTEGER FlowRSVPPathRecordRouteLabelChoiceEnum + AS_HEX FlowRSVPPathRecordRouteLabelChoiceEnum +}{ + AS_INTEGER: FlowRSVPPathRecordRouteLabelChoiceEnum("as_integer"), + AS_HEX: FlowRSVPPathRecordRouteLabelChoiceEnum("as_hex"), +} + +func (obj *flowRSVPPathRecordRouteLabel) Choice() FlowRSVPPathRecordRouteLabelChoiceEnum { + return FlowRSVPPathRecordRouteLabelChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// 32 bit integer or hex value. +// Choice returns a string +func (obj *flowRSVPPathRecordRouteLabel) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPPathRecordRouteLabel) setChoice(value FlowRSVPPathRecordRouteLabelChoiceEnum) FlowRSVPPathRecordRouteLabel { + intValue, ok := otg.FlowRSVPPathRecordRouteLabel_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPPathRecordRouteLabelChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPPathRecordRouteLabel_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.AsHex = nil + obj.obj.AsInteger = nil + + if value == FlowRSVPPathRecordRouteLabelChoice.AS_INTEGER { + defaultValue := uint32(16) + obj.obj.AsInteger = &defaultValue + } + + if value == FlowRSVPPathRecordRouteLabelChoice.AS_HEX { + defaultValue := "10" + obj.obj.AsHex = &defaultValue + } + + return obj +} + +// description is TBD +// AsInteger returns a uint32 +func (obj *flowRSVPPathRecordRouteLabel) AsInteger() uint32 { + + if obj.obj.AsInteger == nil { + obj.setChoice(FlowRSVPPathRecordRouteLabelChoice.AS_INTEGER) + } + + return *obj.obj.AsInteger + +} + +// description is TBD +// AsInteger returns a uint32 +func (obj *flowRSVPPathRecordRouteLabel) HasAsInteger() bool { + return obj.obj.AsInteger != nil +} + +// description is TBD +// SetAsInteger sets the uint32 value in the FlowRSVPPathRecordRouteLabel object +func (obj *flowRSVPPathRecordRouteLabel) SetAsInteger(value uint32) FlowRSVPPathRecordRouteLabel { + obj.setChoice(FlowRSVPPathRecordRouteLabelChoice.AS_INTEGER) + obj.obj.AsInteger = &value + return obj +} + +// Value of the this field should not excced 4 bytes. Maximum length of this attribute is 8 (4 * 2 hex character per byte). +// AsHex returns a string +func (obj *flowRSVPPathRecordRouteLabel) AsHex() string { + + if obj.obj.AsHex == nil { + obj.setChoice(FlowRSVPPathRecordRouteLabelChoice.AS_HEX) + } + + return *obj.obj.AsHex + +} + +// Value of the this field should not excced 4 bytes. Maximum length of this attribute is 8 (4 * 2 hex character per byte). +// AsHex returns a string +func (obj *flowRSVPPathRecordRouteLabel) HasAsHex() bool { + return obj.obj.AsHex != nil +} + +// Value of the this field should not excced 4 bytes. Maximum length of this attribute is 8 (4 * 2 hex character per byte). +// SetAsHex sets the string value in the FlowRSVPPathRecordRouteLabel object +func (obj *flowRSVPPathRecordRouteLabel) SetAsHex(value string) FlowRSVPPathRecordRouteLabel { + obj.setChoice(FlowRSVPPathRecordRouteLabelChoice.AS_HEX) + obj.obj.AsHex = &value + return obj +} + +func (obj *flowRSVPPathRecordRouteLabel) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.AsInteger != nil { + + if *obj.obj.AsInteger > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowRSVPPathRecordRouteLabel.AsInteger <= 1048575 but Got %d", *obj.obj.AsInteger)) + } + + } + + if obj.obj.AsHex != nil { + + if len(*obj.obj.AsHex) > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "None <= length of FlowRSVPPathRecordRouteLabel.AsHex <= 8 but Got %d", + len(*obj.obj.AsHex))) + } + + } + +} + +func (obj *flowRSVPPathRecordRouteLabel) setDefault() { + var choices_set int = 0 + var choice FlowRSVPPathRecordRouteLabelChoiceEnum + + if obj.obj.AsInteger != nil { + choices_set += 1 + choice = FlowRSVPPathRecordRouteLabelChoice.AS_INTEGER + } + + if obj.obj.AsHex != nil { + choices_set += 1 + choice = FlowRSVPPathRecordRouteLabelChoice.AS_HEX + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPPathRecordRouteLabelChoice.AS_INTEGER) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathRecordRouteLabel") + } + } else { + intVal := otg.FlowRSVPPathRecordRouteLabel_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPPathRecordRouteLabel_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_path_record_route_type1.go b/gosnappi/flow_rsvp_path_record_route_type1.go new file mode 100644 index 00000000..8ef81e04 --- /dev/null +++ b/gosnappi/flow_rsvp_path_record_route_type1.go @@ -0,0 +1,390 @@ +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" +) + +// ***** FlowRSVPPathRecordRouteType1 ***** +type flowRSVPPathRecordRouteType1 struct { + validation + obj *otg.FlowRSVPPathRecordRouteType1 + marshaller marshalFlowRSVPPathRecordRouteType1 + unMarshaller unMarshalFlowRSVPPathRecordRouteType1 + subobjectsHolder FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter +} + +func NewFlowRSVPPathRecordRouteType1() FlowRSVPPathRecordRouteType1 { + obj := flowRSVPPathRecordRouteType1{obj: &otg.FlowRSVPPathRecordRouteType1{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathRecordRouteType1) msg() *otg.FlowRSVPPathRecordRouteType1 { + return obj.obj +} + +func (obj *flowRSVPPathRecordRouteType1) setMsg(msg *otg.FlowRSVPPathRecordRouteType1) FlowRSVPPathRecordRouteType1 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathRecordRouteType1 struct { + obj *flowRSVPPathRecordRouteType1 +} + +type marshalFlowRSVPPathRecordRouteType1 interface { + // ToProto marshals FlowRSVPPathRecordRouteType1 to protobuf object *otg.FlowRSVPPathRecordRouteType1 + ToProto() (*otg.FlowRSVPPathRecordRouteType1, error) + // ToPbText marshals FlowRSVPPathRecordRouteType1 to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathRecordRouteType1 to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathRecordRouteType1 to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathRecordRouteType1 struct { + obj *flowRSVPPathRecordRouteType1 +} + +type unMarshalFlowRSVPPathRecordRouteType1 interface { + // FromProto unmarshals FlowRSVPPathRecordRouteType1 from protobuf object *otg.FlowRSVPPathRecordRouteType1 + FromProto(msg *otg.FlowRSVPPathRecordRouteType1) (FlowRSVPPathRecordRouteType1, error) + // FromPbText unmarshals FlowRSVPPathRecordRouteType1 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathRecordRouteType1 from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathRecordRouteType1 from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathRecordRouteType1) Marshal() marshalFlowRSVPPathRecordRouteType1 { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathRecordRouteType1{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathRecordRouteType1) Unmarshal() unMarshalFlowRSVPPathRecordRouteType1 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathRecordRouteType1{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathRecordRouteType1) ToProto() (*otg.FlowRSVPPathRecordRouteType1, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathRecordRouteType1) FromProto(msg *otg.FlowRSVPPathRecordRouteType1) (FlowRSVPPathRecordRouteType1, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathRecordRouteType1) 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 *unMarshalflowRSVPPathRecordRouteType1) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathRecordRouteType1) 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 *unMarshalflowRSVPPathRecordRouteType1) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathRecordRouteType1) 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 *unMarshalflowRSVPPathRecordRouteType1) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathRecordRouteType1) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathRecordRouteType1) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathRecordRouteType1) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathRecordRouteType1) Clone() (FlowRSVPPathRecordRouteType1, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathRecordRouteType1() + 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 +} + +func (obj *flowRSVPPathRecordRouteType1) setNil() { + obj.subobjectsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathRecordRouteType1 is type1 record route has list of subobjects. Currently supported subobjects are IPv4 address(1) and Label(3). +type FlowRSVPPathRecordRouteType1 interface { + Validation + // msg marshals FlowRSVPPathRecordRouteType1 to protobuf object *otg.FlowRSVPPathRecordRouteType1 + // and doesn't set defaults + msg() *otg.FlowRSVPPathRecordRouteType1 + // setMsg unmarshals FlowRSVPPathRecordRouteType1 from protobuf object *otg.FlowRSVPPathRecordRouteType1 + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathRecordRouteType1) FlowRSVPPathRecordRouteType1 + // provides marshal interface + Marshal() marshalFlowRSVPPathRecordRouteType1 + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathRecordRouteType1 + // validate validates FlowRSVPPathRecordRouteType1 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathRecordRouteType1, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Subobjects returns FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIterIter, set in FlowRSVPPathRecordRouteType1 + Subobjects() FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter + setNil() +} + +// description is TBD +// Subobjects returns a []FlowRSVPType1RecordRouteSubobjects +func (obj *flowRSVPPathRecordRouteType1) Subobjects() FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { + if len(obj.obj.Subobjects) == 0 { + obj.obj.Subobjects = []*otg.FlowRSVPType1RecordRouteSubobjects{} + } + if obj.subobjectsHolder == nil { + obj.subobjectsHolder = newFlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter(&obj.obj.Subobjects).setMsg(obj) + } + return obj.subobjectsHolder +} + +type flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter struct { + obj *flowRSVPPathRecordRouteType1 + flowRSVPType1RecordRouteSubobjectsSlice []FlowRSVPType1RecordRouteSubobjects + fieldPtr *[]*otg.FlowRSVPType1RecordRouteSubobjects +} + +func newFlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter(ptr *[]*otg.FlowRSVPType1RecordRouteSubobjects) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { + return &flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter{fieldPtr: ptr} +} + +type FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter interface { + setMsg(*flowRSVPPathRecordRouteType1) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter + Items() []FlowRSVPType1RecordRouteSubobjects + Add() FlowRSVPType1RecordRouteSubobjects + Append(items ...FlowRSVPType1RecordRouteSubobjects) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter + Set(index int, newObj FlowRSVPType1RecordRouteSubobjects) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter + Clear() FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter + clearHolderSlice() FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter + appendHolderSlice(item FlowRSVPType1RecordRouteSubobjects) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter +} + +func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) setMsg(msg *flowRSVPPathRecordRouteType1) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flowRSVPType1RecordRouteSubobjects{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) Items() []FlowRSVPType1RecordRouteSubobjects { + return obj.flowRSVPType1RecordRouteSubobjectsSlice +} + +func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) Add() FlowRSVPType1RecordRouteSubobjects { + newObj := &otg.FlowRSVPType1RecordRouteSubobjects{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flowRSVPType1RecordRouteSubobjects{obj: newObj} + newLibObj.setDefault() + obj.flowRSVPType1RecordRouteSubobjectsSlice = append(obj.flowRSVPType1RecordRouteSubobjectsSlice, newLibObj) + return newLibObj +} + +func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) Append(items ...FlowRSVPType1RecordRouteSubobjects) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowRSVPType1RecordRouteSubobjectsSlice = append(obj.flowRSVPType1RecordRouteSubobjectsSlice, item) + } + return obj +} + +func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) Set(index int, newObj FlowRSVPType1RecordRouteSubobjects) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowRSVPType1RecordRouteSubobjectsSlice[index] = newObj + return obj +} +func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) Clear() FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.FlowRSVPType1RecordRouteSubobjects{} + obj.flowRSVPType1RecordRouteSubobjectsSlice = []FlowRSVPType1RecordRouteSubobjects{} + } + return obj +} +func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) clearHolderSlice() FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { + if len(obj.flowRSVPType1RecordRouteSubobjectsSlice) > 0 { + obj.flowRSVPType1RecordRouteSubobjectsSlice = []FlowRSVPType1RecordRouteSubobjects{} + } + return obj +} +func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) appendHolderSlice(item FlowRSVPType1RecordRouteSubobjects) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { + obj.flowRSVPType1RecordRouteSubobjectsSlice = append(obj.flowRSVPType1RecordRouteSubobjectsSlice, item) + return obj +} + +func (obj *flowRSVPPathRecordRouteType1) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Subobjects) != 0 { + + if set_default { + obj.Subobjects().clearHolderSlice() + for _, item := range obj.obj.Subobjects { + obj.Subobjects().appendHolderSlice(&flowRSVPType1RecordRouteSubobjects{obj: item}) + } + } + for _, item := range obj.Subobjects().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *flowRSVPPathRecordRouteType1) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_record_route_type1_ipv4_address.go b/gosnappi/flow_rsvp_path_record_route_type1_ipv4_address.go new file mode 100644 index 00000000..6848189e --- /dev/null +++ b/gosnappi/flow_rsvp_path_record_route_type1_ipv4_address.go @@ -0,0 +1,457 @@ +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" +) + +// ***** FlowRSVPPathRecordRouteType1Ipv4Address ***** +type flowRSVPPathRecordRouteType1Ipv4Address struct { + validation + obj *otg.FlowRSVPPathRecordRouteType1Ipv4Address + marshaller marshalFlowRSVPPathRecordRouteType1Ipv4Address + unMarshaller unMarshalFlowRSVPPathRecordRouteType1Ipv4Address + lengthHolder FlowRSVPRouteRecordLength + ipv4AddressHolder PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + prefixLengthHolder PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + flagsHolder FlowRSVPRecordRouteIPv4Flag +} + +func NewFlowRSVPPathRecordRouteType1Ipv4Address() FlowRSVPPathRecordRouteType1Ipv4Address { + obj := flowRSVPPathRecordRouteType1Ipv4Address{obj: &otg.FlowRSVPPathRecordRouteType1Ipv4Address{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) msg() *otg.FlowRSVPPathRecordRouteType1Ipv4Address { + return obj.obj +} + +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) setMsg(msg *otg.FlowRSVPPathRecordRouteType1Ipv4Address) FlowRSVPPathRecordRouteType1Ipv4Address { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathRecordRouteType1Ipv4Address struct { + obj *flowRSVPPathRecordRouteType1Ipv4Address +} + +type marshalFlowRSVPPathRecordRouteType1Ipv4Address interface { + // ToProto marshals FlowRSVPPathRecordRouteType1Ipv4Address to protobuf object *otg.FlowRSVPPathRecordRouteType1Ipv4Address + ToProto() (*otg.FlowRSVPPathRecordRouteType1Ipv4Address, error) + // ToPbText marshals FlowRSVPPathRecordRouteType1Ipv4Address to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathRecordRouteType1Ipv4Address to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathRecordRouteType1Ipv4Address to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathRecordRouteType1Ipv4Address struct { + obj *flowRSVPPathRecordRouteType1Ipv4Address +} + +type unMarshalFlowRSVPPathRecordRouteType1Ipv4Address interface { + // FromProto unmarshals FlowRSVPPathRecordRouteType1Ipv4Address from protobuf object *otg.FlowRSVPPathRecordRouteType1Ipv4Address + FromProto(msg *otg.FlowRSVPPathRecordRouteType1Ipv4Address) (FlowRSVPPathRecordRouteType1Ipv4Address, error) + // FromPbText unmarshals FlowRSVPPathRecordRouteType1Ipv4Address from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathRecordRouteType1Ipv4Address from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathRecordRouteType1Ipv4Address from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) Marshal() marshalFlowRSVPPathRecordRouteType1Ipv4Address { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathRecordRouteType1Ipv4Address{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) Unmarshal() unMarshalFlowRSVPPathRecordRouteType1Ipv4Address { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathRecordRouteType1Ipv4Address{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathRecordRouteType1Ipv4Address) ToProto() (*otg.FlowRSVPPathRecordRouteType1Ipv4Address, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathRecordRouteType1Ipv4Address) FromProto(msg *otg.FlowRSVPPathRecordRouteType1Ipv4Address) (FlowRSVPPathRecordRouteType1Ipv4Address, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathRecordRouteType1Ipv4Address) 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 *unMarshalflowRSVPPathRecordRouteType1Ipv4Address) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathRecordRouteType1Ipv4Address) 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 *unMarshalflowRSVPPathRecordRouteType1Ipv4Address) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathRecordRouteType1Ipv4Address) 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 *unMarshalflowRSVPPathRecordRouteType1Ipv4Address) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) Clone() (FlowRSVPPathRecordRouteType1Ipv4Address, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathRecordRouteType1Ipv4Address() + 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 +} + +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) setNil() { + obj.lengthHolder = nil + obj.ipv4AddressHolder = nil + obj.prefixLengthHolder = nil + obj.flagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathRecordRouteType1Ipv4Address is class = RECORD_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: IPv4 Address, C-Type: 1 +type FlowRSVPPathRecordRouteType1Ipv4Address interface { + Validation + // msg marshals FlowRSVPPathRecordRouteType1Ipv4Address to protobuf object *otg.FlowRSVPPathRecordRouteType1Ipv4Address + // and doesn't set defaults + msg() *otg.FlowRSVPPathRecordRouteType1Ipv4Address + // setMsg unmarshals FlowRSVPPathRecordRouteType1Ipv4Address from protobuf object *otg.FlowRSVPPathRecordRouteType1Ipv4Address + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathRecordRouteType1Ipv4Address) FlowRSVPPathRecordRouteType1Ipv4Address + // provides marshal interface + Marshal() marshalFlowRSVPPathRecordRouteType1Ipv4Address + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathRecordRouteType1Ipv4Address + // validate validates FlowRSVPPathRecordRouteType1Ipv4Address + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathRecordRouteType1Ipv4Address, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Length returns FlowRSVPRouteRecordLength, set in FlowRSVPPathRecordRouteType1Ipv4Address. + // FlowRSVPRouteRecordLength is description is TBD + Length() FlowRSVPRouteRecordLength + // SetLength assigns FlowRSVPRouteRecordLength provided by user to FlowRSVPPathRecordRouteType1Ipv4Address. + // FlowRSVPRouteRecordLength is description is TBD + SetLength(value FlowRSVPRouteRecordLength) FlowRSVPPathRecordRouteType1Ipv4Address + // HasLength checks if Length has been set in FlowRSVPPathRecordRouteType1Ipv4Address + HasLength() bool + // Ipv4Address returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address, set in FlowRSVPPathRecordRouteType1Ipv4Address. + // PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address is a 32-bit unicast, host address. Any network-reachable interface address is allowed here. Illegal addresses, such as certain loopback addresses, SHOULD NOT be used. + Ipv4Address() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + // SetIpv4Address assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address provided by user to FlowRSVPPathRecordRouteType1Ipv4Address. + // PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address is a 32-bit unicast, host address. Any network-reachable interface address is allowed here. Illegal addresses, such as certain loopback addresses, SHOULD NOT be used. + SetIpv4Address(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) FlowRSVPPathRecordRouteType1Ipv4Address + // HasIpv4Address checks if Ipv4Address has been set in FlowRSVPPathRecordRouteType1Ipv4Address + HasIpv4Address() bool + // PrefixLength returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength, set in FlowRSVPPathRecordRouteType1Ipv4Address. + // PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength is prefix-length of IPv4 address. + PrefixLength() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + // SetPrefixLength assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength provided by user to FlowRSVPPathRecordRouteType1Ipv4Address. + // PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength is prefix-length of IPv4 address. + SetPrefixLength(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) FlowRSVPPathRecordRouteType1Ipv4Address + // HasPrefixLength checks if PrefixLength has been set in FlowRSVPPathRecordRouteType1Ipv4Address + HasPrefixLength() bool + // Flags returns FlowRSVPRecordRouteIPv4Flag, set in FlowRSVPPathRecordRouteType1Ipv4Address. + // FlowRSVPRecordRouteIPv4Flag is description is TBD + Flags() FlowRSVPRecordRouteIPv4Flag + // SetFlags assigns FlowRSVPRecordRouteIPv4Flag provided by user to FlowRSVPPathRecordRouteType1Ipv4Address. + // FlowRSVPRecordRouteIPv4Flag is description is TBD + SetFlags(value FlowRSVPRecordRouteIPv4Flag) FlowRSVPPathRecordRouteType1Ipv4Address + // HasFlags checks if Flags has been set in FlowRSVPPathRecordRouteType1Ipv4Address + HasFlags() bool + setNil() +} + +// The Length contains the total length of the subobject in bytes, including the Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. +// Length returns a FlowRSVPRouteRecordLength +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) Length() FlowRSVPRouteRecordLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowRSVPRouteRecordLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowRSVPRouteRecordLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// The Length contains the total length of the subobject in bytes, including the Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. +// Length returns a FlowRSVPRouteRecordLength +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) HasLength() bool { + return obj.obj.Length != nil +} + +// The Length contains the total length of the subobject in bytes, including the Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. +// SetLength sets the FlowRSVPRouteRecordLength value in the FlowRSVPPathRecordRouteType1Ipv4Address object +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) SetLength(value FlowRSVPRouteRecordLength) FlowRSVPPathRecordRouteType1Ipv4Address { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// description is TBD +// Ipv4Address returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) Ipv4Address() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { + if obj.obj.Ipv4Address == nil { + obj.obj.Ipv4Address = NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address().msg() + } + if obj.ipv4AddressHolder == nil { + obj.ipv4AddressHolder = &patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address{obj: obj.obj.Ipv4Address} + } + return obj.ipv4AddressHolder +} + +// description is TBD +// Ipv4Address returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) HasIpv4Address() bool { + return obj.obj.Ipv4Address != nil +} + +// description is TBD +// SetIpv4Address sets the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address value in the FlowRSVPPathRecordRouteType1Ipv4Address object +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) SetIpv4Address(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) FlowRSVPPathRecordRouteType1Ipv4Address { + + obj.ipv4AddressHolder = nil + obj.obj.Ipv4Address = value.msg() + + return obj +} + +// description is TBD +// PrefixLength returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) PrefixLength() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { + if obj.obj.PrefixLength == nil { + obj.obj.PrefixLength = NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength().msg() + } + if obj.prefixLengthHolder == nil { + obj.prefixLengthHolder = &patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength{obj: obj.obj.PrefixLength} + } + return obj.prefixLengthHolder +} + +// description is TBD +// PrefixLength returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) HasPrefixLength() bool { + return obj.obj.PrefixLength != nil +} + +// description is TBD +// SetPrefixLength sets the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength value in the FlowRSVPPathRecordRouteType1Ipv4Address object +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) SetPrefixLength(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) FlowRSVPPathRecordRouteType1Ipv4Address { + + obj.prefixLengthHolder = nil + obj.obj.PrefixLength = value.msg() + + return obj +} + +// 0x01 local_protection_available, 0x02 local_protection_in_use +// Flags returns a FlowRSVPRecordRouteIPv4Flag +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) Flags() FlowRSVPRecordRouteIPv4Flag { + if obj.obj.Flags == nil { + obj.obj.Flags = NewFlowRSVPRecordRouteIPv4Flag().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &flowRSVPRecordRouteIPv4Flag{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// 0x01 local_protection_available, 0x02 local_protection_in_use +// Flags returns a FlowRSVPRecordRouteIPv4Flag +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) HasFlags() bool { + return obj.obj.Flags != nil +} + +// 0x01 local_protection_available, 0x02 local_protection_in_use +// SetFlags sets the FlowRSVPRecordRouteIPv4Flag value in the FlowRSVPPathRecordRouteType1Ipv4Address object +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) SetFlags(value FlowRSVPRecordRouteIPv4Flag) FlowRSVPPathRecordRouteType1Ipv4Address { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.Ipv4Address != nil { + + obj.Ipv4Address().validateObj(vObj, set_default) + } + + if obj.obj.PrefixLength != nil { + + obj.PrefixLength().validateObj(vObj, set_default) + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathRecordRouteType1Ipv4Address) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_record_route_type1_label.go b/gosnappi/flow_rsvp_path_record_route_type1_label.go new file mode 100644 index 00000000..eb1c7a1e --- /dev/null +++ b/gosnappi/flow_rsvp_path_record_route_type1_label.go @@ -0,0 +1,457 @@ +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" +) + +// ***** FlowRSVPPathRecordRouteType1Label ***** +type flowRSVPPathRecordRouteType1Label struct { + validation + obj *otg.FlowRSVPPathRecordRouteType1Label + marshaller marshalFlowRSVPPathRecordRouteType1Label + unMarshaller unMarshalFlowRSVPPathRecordRouteType1Label + lengthHolder FlowRSVPRouteRecordLength + flagsHolder PatternFlowRSVPPathRecordRouteType1LabelFlags + cTypeHolder PatternFlowRSVPPathRecordRouteType1LabelCType + labelHolder FlowRSVPPathRecordRouteLabel +} + +func NewFlowRSVPPathRecordRouteType1Label() FlowRSVPPathRecordRouteType1Label { + obj := flowRSVPPathRecordRouteType1Label{obj: &otg.FlowRSVPPathRecordRouteType1Label{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathRecordRouteType1Label) msg() *otg.FlowRSVPPathRecordRouteType1Label { + return obj.obj +} + +func (obj *flowRSVPPathRecordRouteType1Label) setMsg(msg *otg.FlowRSVPPathRecordRouteType1Label) FlowRSVPPathRecordRouteType1Label { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathRecordRouteType1Label struct { + obj *flowRSVPPathRecordRouteType1Label +} + +type marshalFlowRSVPPathRecordRouteType1Label interface { + // ToProto marshals FlowRSVPPathRecordRouteType1Label to protobuf object *otg.FlowRSVPPathRecordRouteType1Label + ToProto() (*otg.FlowRSVPPathRecordRouteType1Label, error) + // ToPbText marshals FlowRSVPPathRecordRouteType1Label to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathRecordRouteType1Label to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathRecordRouteType1Label to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathRecordRouteType1Label struct { + obj *flowRSVPPathRecordRouteType1Label +} + +type unMarshalFlowRSVPPathRecordRouteType1Label interface { + // FromProto unmarshals FlowRSVPPathRecordRouteType1Label from protobuf object *otg.FlowRSVPPathRecordRouteType1Label + FromProto(msg *otg.FlowRSVPPathRecordRouteType1Label) (FlowRSVPPathRecordRouteType1Label, error) + // FromPbText unmarshals FlowRSVPPathRecordRouteType1Label from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathRecordRouteType1Label from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathRecordRouteType1Label from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathRecordRouteType1Label) Marshal() marshalFlowRSVPPathRecordRouteType1Label { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathRecordRouteType1Label{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathRecordRouteType1Label) Unmarshal() unMarshalFlowRSVPPathRecordRouteType1Label { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathRecordRouteType1Label{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathRecordRouteType1Label) ToProto() (*otg.FlowRSVPPathRecordRouteType1Label, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathRecordRouteType1Label) FromProto(msg *otg.FlowRSVPPathRecordRouteType1Label) (FlowRSVPPathRecordRouteType1Label, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathRecordRouteType1Label) 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 *unMarshalflowRSVPPathRecordRouteType1Label) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathRecordRouteType1Label) 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 *unMarshalflowRSVPPathRecordRouteType1Label) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathRecordRouteType1Label) 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 *unMarshalflowRSVPPathRecordRouteType1Label) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathRecordRouteType1Label) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathRecordRouteType1Label) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathRecordRouteType1Label) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathRecordRouteType1Label) Clone() (FlowRSVPPathRecordRouteType1Label, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathRecordRouteType1Label() + 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 +} + +func (obj *flowRSVPPathRecordRouteType1Label) setNil() { + obj.lengthHolder = nil + obj.flagsHolder = nil + obj.cTypeHolder = nil + obj.labelHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathRecordRouteType1Label is class = RECORD_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: Label, C-Type: 3 +type FlowRSVPPathRecordRouteType1Label interface { + Validation + // msg marshals FlowRSVPPathRecordRouteType1Label to protobuf object *otg.FlowRSVPPathRecordRouteType1Label + // and doesn't set defaults + msg() *otg.FlowRSVPPathRecordRouteType1Label + // setMsg unmarshals FlowRSVPPathRecordRouteType1Label from protobuf object *otg.FlowRSVPPathRecordRouteType1Label + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathRecordRouteType1Label) FlowRSVPPathRecordRouteType1Label + // provides marshal interface + Marshal() marshalFlowRSVPPathRecordRouteType1Label + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathRecordRouteType1Label + // validate validates FlowRSVPPathRecordRouteType1Label + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathRecordRouteType1Label, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Length returns FlowRSVPRouteRecordLength, set in FlowRSVPPathRecordRouteType1Label. + // FlowRSVPRouteRecordLength is description is TBD + Length() FlowRSVPRouteRecordLength + // SetLength assigns FlowRSVPRouteRecordLength provided by user to FlowRSVPPathRecordRouteType1Label. + // FlowRSVPRouteRecordLength is description is TBD + SetLength(value FlowRSVPRouteRecordLength) FlowRSVPPathRecordRouteType1Label + // HasLength checks if Length has been set in FlowRSVPPathRecordRouteType1Label + HasLength() bool + // Flags returns PatternFlowRSVPPathRecordRouteType1LabelFlags, set in FlowRSVPPathRecordRouteType1Label. + // PatternFlowRSVPPathRecordRouteType1LabelFlags is 0x01 = Global label. This flag indicates that the label will be understood if received on any interface. + Flags() PatternFlowRSVPPathRecordRouteType1LabelFlags + // SetFlags assigns PatternFlowRSVPPathRecordRouteType1LabelFlags provided by user to FlowRSVPPathRecordRouteType1Label. + // PatternFlowRSVPPathRecordRouteType1LabelFlags is 0x01 = Global label. This flag indicates that the label will be understood if received on any interface. + SetFlags(value PatternFlowRSVPPathRecordRouteType1LabelFlags) FlowRSVPPathRecordRouteType1Label + // HasFlags checks if Flags has been set in FlowRSVPPathRecordRouteType1Label + HasFlags() bool + // CType returns PatternFlowRSVPPathRecordRouteType1LabelCType, set in FlowRSVPPathRecordRouteType1Label. + // PatternFlowRSVPPathRecordRouteType1LabelCType is the C-Type of the included Label Object. Copied from the Label object. + CType() PatternFlowRSVPPathRecordRouteType1LabelCType + // SetCType assigns PatternFlowRSVPPathRecordRouteType1LabelCType provided by user to FlowRSVPPathRecordRouteType1Label. + // PatternFlowRSVPPathRecordRouteType1LabelCType is the C-Type of the included Label Object. Copied from the Label object. + SetCType(value PatternFlowRSVPPathRecordRouteType1LabelCType) FlowRSVPPathRecordRouteType1Label + // HasCType checks if CType has been set in FlowRSVPPathRecordRouteType1Label + HasCType() bool + // Label returns FlowRSVPPathRecordRouteLabel, set in FlowRSVPPathRecordRouteType1Label. + // FlowRSVPPathRecordRouteLabel is description is TBD + Label() FlowRSVPPathRecordRouteLabel + // SetLabel assigns FlowRSVPPathRecordRouteLabel provided by user to FlowRSVPPathRecordRouteType1Label. + // FlowRSVPPathRecordRouteLabel is description is TBD + SetLabel(value FlowRSVPPathRecordRouteLabel) FlowRSVPPathRecordRouteType1Label + // HasLabel checks if Label has been set in FlowRSVPPathRecordRouteType1Label + HasLabel() bool + setNil() +} + +// The Length contains the total length of the subobject in bytes, including the Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. +// Length returns a FlowRSVPRouteRecordLength +func (obj *flowRSVPPathRecordRouteType1Label) Length() FlowRSVPRouteRecordLength { + if obj.obj.Length == nil { + obj.obj.Length = NewFlowRSVPRouteRecordLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &flowRSVPRouteRecordLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// The Length contains the total length of the subobject in bytes, including the Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. +// Length returns a FlowRSVPRouteRecordLength +func (obj *flowRSVPPathRecordRouteType1Label) HasLength() bool { + return obj.obj.Length != nil +} + +// The Length contains the total length of the subobject in bytes, including the Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. +// SetLength sets the FlowRSVPRouteRecordLength value in the FlowRSVPPathRecordRouteType1Label object +func (obj *flowRSVPPathRecordRouteType1Label) SetLength(value FlowRSVPRouteRecordLength) FlowRSVPPathRecordRouteType1Label { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// description is TBD +// Flags returns a PatternFlowRSVPPathRecordRouteType1LabelFlags +func (obj *flowRSVPPathRecordRouteType1Label) Flags() PatternFlowRSVPPathRecordRouteType1LabelFlags { + if obj.obj.Flags == nil { + obj.obj.Flags = NewPatternFlowRSVPPathRecordRouteType1LabelFlags().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &patternFlowRSVPPathRecordRouteType1LabelFlags{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// description is TBD +// Flags returns a PatternFlowRSVPPathRecordRouteType1LabelFlags +func (obj *flowRSVPPathRecordRouteType1Label) HasFlags() bool { + return obj.obj.Flags != nil +} + +// description is TBD +// SetFlags sets the PatternFlowRSVPPathRecordRouteType1LabelFlags value in the FlowRSVPPathRecordRouteType1Label object +func (obj *flowRSVPPathRecordRouteType1Label) SetFlags(value PatternFlowRSVPPathRecordRouteType1LabelFlags) FlowRSVPPathRecordRouteType1Label { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// description is TBD +// CType returns a PatternFlowRSVPPathRecordRouteType1LabelCType +func (obj *flowRSVPPathRecordRouteType1Label) CType() PatternFlowRSVPPathRecordRouteType1LabelCType { + if obj.obj.CType == nil { + obj.obj.CType = NewPatternFlowRSVPPathRecordRouteType1LabelCType().msg() + } + if obj.cTypeHolder == nil { + obj.cTypeHolder = &patternFlowRSVPPathRecordRouteType1LabelCType{obj: obj.obj.CType} + } + return obj.cTypeHolder +} + +// description is TBD +// CType returns a PatternFlowRSVPPathRecordRouteType1LabelCType +func (obj *flowRSVPPathRecordRouteType1Label) HasCType() bool { + return obj.obj.CType != nil +} + +// description is TBD +// SetCType sets the PatternFlowRSVPPathRecordRouteType1LabelCType value in the FlowRSVPPathRecordRouteType1Label object +func (obj *flowRSVPPathRecordRouteType1Label) SetCType(value PatternFlowRSVPPathRecordRouteType1LabelCType) FlowRSVPPathRecordRouteType1Label { + + obj.cTypeHolder = nil + obj.obj.CType = value.msg() + + return obj +} + +// The contents of the Label Object. Copied from the Label Object. +// Label returns a FlowRSVPPathRecordRouteLabel +func (obj *flowRSVPPathRecordRouteType1Label) Label() FlowRSVPPathRecordRouteLabel { + if obj.obj.Label == nil { + obj.obj.Label = NewFlowRSVPPathRecordRouteLabel().msg() + } + if obj.labelHolder == nil { + obj.labelHolder = &flowRSVPPathRecordRouteLabel{obj: obj.obj.Label} + } + return obj.labelHolder +} + +// The contents of the Label Object. Copied from the Label Object. +// Label returns a FlowRSVPPathRecordRouteLabel +func (obj *flowRSVPPathRecordRouteType1Label) HasLabel() bool { + return obj.obj.Label != nil +} + +// The contents of the Label Object. Copied from the Label Object. +// SetLabel sets the FlowRSVPPathRecordRouteLabel value in the FlowRSVPPathRecordRouteType1Label object +func (obj *flowRSVPPathRecordRouteType1Label) SetLabel(value FlowRSVPPathRecordRouteLabel) FlowRSVPPathRecordRouteType1Label { + + obj.labelHolder = nil + obj.obj.Label = value.msg() + + return obj +} + +func (obj *flowRSVPPathRecordRouteType1Label) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.CType != nil { + + obj.CType().validateObj(vObj, set_default) + } + + if obj.obj.Label != nil { + + obj.Label().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathRecordRouteType1Label) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_rsvp_hop_ipv4.go b/gosnappi/flow_rsvp_path_rsvp_hop_ipv4.go new file mode 100644 index 00000000..b243060e --- /dev/null +++ b/gosnappi/flow_rsvp_path_rsvp_hop_ipv4.go @@ -0,0 +1,371 @@ +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" +) + +// ***** FlowRSVPPathRsvpHopIpv4 ***** +type flowRSVPPathRsvpHopIpv4 struct { + validation + obj *otg.FlowRSVPPathRsvpHopIpv4 + marshaller marshalFlowRSVPPathRsvpHopIpv4 + unMarshaller unMarshalFlowRSVPPathRsvpHopIpv4 + ipv4AddressHolder PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + logicalInterfaceHandleHolder PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle +} + +func NewFlowRSVPPathRsvpHopIpv4() FlowRSVPPathRsvpHopIpv4 { + obj := flowRSVPPathRsvpHopIpv4{obj: &otg.FlowRSVPPathRsvpHopIpv4{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathRsvpHopIpv4) msg() *otg.FlowRSVPPathRsvpHopIpv4 { + return obj.obj +} + +func (obj *flowRSVPPathRsvpHopIpv4) setMsg(msg *otg.FlowRSVPPathRsvpHopIpv4) FlowRSVPPathRsvpHopIpv4 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathRsvpHopIpv4 struct { + obj *flowRSVPPathRsvpHopIpv4 +} + +type marshalFlowRSVPPathRsvpHopIpv4 interface { + // ToProto marshals FlowRSVPPathRsvpHopIpv4 to protobuf object *otg.FlowRSVPPathRsvpHopIpv4 + ToProto() (*otg.FlowRSVPPathRsvpHopIpv4, error) + // ToPbText marshals FlowRSVPPathRsvpHopIpv4 to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathRsvpHopIpv4 to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathRsvpHopIpv4 to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathRsvpHopIpv4 struct { + obj *flowRSVPPathRsvpHopIpv4 +} + +type unMarshalFlowRSVPPathRsvpHopIpv4 interface { + // FromProto unmarshals FlowRSVPPathRsvpHopIpv4 from protobuf object *otg.FlowRSVPPathRsvpHopIpv4 + FromProto(msg *otg.FlowRSVPPathRsvpHopIpv4) (FlowRSVPPathRsvpHopIpv4, error) + // FromPbText unmarshals FlowRSVPPathRsvpHopIpv4 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathRsvpHopIpv4 from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathRsvpHopIpv4 from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathRsvpHopIpv4) Marshal() marshalFlowRSVPPathRsvpHopIpv4 { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathRsvpHopIpv4{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathRsvpHopIpv4) Unmarshal() unMarshalFlowRSVPPathRsvpHopIpv4 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathRsvpHopIpv4{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathRsvpHopIpv4) ToProto() (*otg.FlowRSVPPathRsvpHopIpv4, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathRsvpHopIpv4) FromProto(msg *otg.FlowRSVPPathRsvpHopIpv4) (FlowRSVPPathRsvpHopIpv4, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathRsvpHopIpv4) 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 *unMarshalflowRSVPPathRsvpHopIpv4) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathRsvpHopIpv4) 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 *unMarshalflowRSVPPathRsvpHopIpv4) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathRsvpHopIpv4) 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 *unMarshalflowRSVPPathRsvpHopIpv4) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathRsvpHopIpv4) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathRsvpHopIpv4) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathRsvpHopIpv4) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathRsvpHopIpv4) Clone() (FlowRSVPPathRsvpHopIpv4, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathRsvpHopIpv4() + 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 +} + +func (obj *flowRSVPPathRsvpHopIpv4) setNil() { + obj.ipv4AddressHolder = nil + obj.logicalInterfaceHandleHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathRsvpHopIpv4 is iPv4 RSVP_HOP object: Class = 3, C-Type = 1 +type FlowRSVPPathRsvpHopIpv4 interface { + Validation + // msg marshals FlowRSVPPathRsvpHopIpv4 to protobuf object *otg.FlowRSVPPathRsvpHopIpv4 + // and doesn't set defaults + msg() *otg.FlowRSVPPathRsvpHopIpv4 + // setMsg unmarshals FlowRSVPPathRsvpHopIpv4 from protobuf object *otg.FlowRSVPPathRsvpHopIpv4 + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathRsvpHopIpv4) FlowRSVPPathRsvpHopIpv4 + // provides marshal interface + Marshal() marshalFlowRSVPPathRsvpHopIpv4 + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathRsvpHopIpv4 + // validate validates FlowRSVPPathRsvpHopIpv4 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathRsvpHopIpv4, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv4Address returns PatternFlowRSVPPathRsvpHopIpv4Ipv4Address, set in FlowRSVPPathRsvpHopIpv4. + // PatternFlowRSVPPathRsvpHopIpv4Ipv4Address is the IPv4 address of the interface through which the last RSVP-knowledgeable hop forwarded this message. + Ipv4Address() PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + // SetIpv4Address assigns PatternFlowRSVPPathRsvpHopIpv4Ipv4Address provided by user to FlowRSVPPathRsvpHopIpv4. + // PatternFlowRSVPPathRsvpHopIpv4Ipv4Address is the IPv4 address of the interface through which the last RSVP-knowledgeable hop forwarded this message. + SetIpv4Address(value PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) FlowRSVPPathRsvpHopIpv4 + // HasIpv4Address checks if Ipv4Address has been set in FlowRSVPPathRsvpHopIpv4 + HasIpv4Address() bool + // LogicalInterfaceHandle returns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle, set in FlowRSVPPathRsvpHopIpv4. + // PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle is logical Interface Handle (LIH) is used to distinguish logical outgoing interfaces. A node receiving an LIH in a Path message saves its value and returns it in the HOP objects of subsequent Resv messages sent to the node that originated the LIH. The LIH should be identically zero if there is no logical interface handle. + LogicalInterfaceHandle() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + // SetLogicalInterfaceHandle assigns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle provided by user to FlowRSVPPathRsvpHopIpv4. + // PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle is logical Interface Handle (LIH) is used to distinguish logical outgoing interfaces. A node receiving an LIH in a Path message saves its value and returns it in the HOP objects of subsequent Resv messages sent to the node that originated the LIH. The LIH should be identically zero if there is no logical interface handle. + SetLogicalInterfaceHandle(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) FlowRSVPPathRsvpHopIpv4 + // HasLogicalInterfaceHandle checks if LogicalInterfaceHandle has been set in FlowRSVPPathRsvpHopIpv4 + HasLogicalInterfaceHandle() bool + setNil() +} + +// description is TBD +// Ipv4Address returns a PatternFlowRSVPPathRsvpHopIpv4Ipv4Address +func (obj *flowRSVPPathRsvpHopIpv4) Ipv4Address() PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { + if obj.obj.Ipv4Address == nil { + obj.obj.Ipv4Address = NewPatternFlowRSVPPathRsvpHopIpv4Ipv4Address().msg() + } + if obj.ipv4AddressHolder == nil { + obj.ipv4AddressHolder = &patternFlowRSVPPathRsvpHopIpv4Ipv4Address{obj: obj.obj.Ipv4Address} + } + return obj.ipv4AddressHolder +} + +// description is TBD +// Ipv4Address returns a PatternFlowRSVPPathRsvpHopIpv4Ipv4Address +func (obj *flowRSVPPathRsvpHopIpv4) HasIpv4Address() bool { + return obj.obj.Ipv4Address != nil +} + +// description is TBD +// SetIpv4Address sets the PatternFlowRSVPPathRsvpHopIpv4Ipv4Address value in the FlowRSVPPathRsvpHopIpv4 object +func (obj *flowRSVPPathRsvpHopIpv4) SetIpv4Address(value PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) FlowRSVPPathRsvpHopIpv4 { + + obj.ipv4AddressHolder = nil + obj.obj.Ipv4Address = value.msg() + + return obj +} + +// description is TBD +// LogicalInterfaceHandle returns a PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle +func (obj *flowRSVPPathRsvpHopIpv4) LogicalInterfaceHandle() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { + if obj.obj.LogicalInterfaceHandle == nil { + obj.obj.LogicalInterfaceHandle = NewPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle().msg() + } + if obj.logicalInterfaceHandleHolder == nil { + obj.logicalInterfaceHandleHolder = &patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle{obj: obj.obj.LogicalInterfaceHandle} + } + return obj.logicalInterfaceHandleHolder +} + +// description is TBD +// LogicalInterfaceHandle returns a PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle +func (obj *flowRSVPPathRsvpHopIpv4) HasLogicalInterfaceHandle() bool { + return obj.obj.LogicalInterfaceHandle != nil +} + +// description is TBD +// SetLogicalInterfaceHandle sets the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle value in the FlowRSVPPathRsvpHopIpv4 object +func (obj *flowRSVPPathRsvpHopIpv4) SetLogicalInterfaceHandle(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) FlowRSVPPathRsvpHopIpv4 { + + obj.logicalInterfaceHandleHolder = nil + obj.obj.LogicalInterfaceHandle = value.msg() + + return obj +} + +func (obj *flowRSVPPathRsvpHopIpv4) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv4Address != nil { + + obj.Ipv4Address().validateObj(vObj, set_default) + } + + if obj.obj.LogicalInterfaceHandle != nil { + + obj.LogicalInterfaceHandle().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathRsvpHopIpv4) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_sender_template_lsp_tunnel_ipv4.go b/gosnappi/flow_rsvp_path_sender_template_lsp_tunnel_ipv4.go new file mode 100644 index 00000000..49f0286a --- /dev/null +++ b/gosnappi/flow_rsvp_path_sender_template_lsp_tunnel_ipv4.go @@ -0,0 +1,414 @@ +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" +) + +// ***** FlowRSVPPathSenderTemplateLspTunnelIpv4 ***** +type flowRSVPPathSenderTemplateLspTunnelIpv4 struct { + validation + obj *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 + marshaller marshalFlowRSVPPathSenderTemplateLspTunnelIpv4 + unMarshaller unMarshalFlowRSVPPathSenderTemplateLspTunnelIpv4 + ipv4TunnelSenderAddressHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + reservedHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + lspIdHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId +} + +func NewFlowRSVPPathSenderTemplateLspTunnelIpv4() FlowRSVPPathSenderTemplateLspTunnelIpv4 { + obj := flowRSVPPathSenderTemplateLspTunnelIpv4{obj: &otg.FlowRSVPPathSenderTemplateLspTunnelIpv4{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) msg() *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 { + return obj.obj +} + +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) setMsg(msg *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4) FlowRSVPPathSenderTemplateLspTunnelIpv4 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathSenderTemplateLspTunnelIpv4 struct { + obj *flowRSVPPathSenderTemplateLspTunnelIpv4 +} + +type marshalFlowRSVPPathSenderTemplateLspTunnelIpv4 interface { + // ToProto marshals FlowRSVPPathSenderTemplateLspTunnelIpv4 to protobuf object *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 + ToProto() (*otg.FlowRSVPPathSenderTemplateLspTunnelIpv4, error) + // ToPbText marshals FlowRSVPPathSenderTemplateLspTunnelIpv4 to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathSenderTemplateLspTunnelIpv4 to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathSenderTemplateLspTunnelIpv4 to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathSenderTemplateLspTunnelIpv4 struct { + obj *flowRSVPPathSenderTemplateLspTunnelIpv4 +} + +type unMarshalFlowRSVPPathSenderTemplateLspTunnelIpv4 interface { + // FromProto unmarshals FlowRSVPPathSenderTemplateLspTunnelIpv4 from protobuf object *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 + FromProto(msg *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4) (FlowRSVPPathSenderTemplateLspTunnelIpv4, error) + // FromPbText unmarshals FlowRSVPPathSenderTemplateLspTunnelIpv4 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathSenderTemplateLspTunnelIpv4 from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathSenderTemplateLspTunnelIpv4 from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) Marshal() marshalFlowRSVPPathSenderTemplateLspTunnelIpv4 { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathSenderTemplateLspTunnelIpv4{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) Unmarshal() unMarshalFlowRSVPPathSenderTemplateLspTunnelIpv4 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathSenderTemplateLspTunnelIpv4{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathSenderTemplateLspTunnelIpv4) ToProto() (*otg.FlowRSVPPathSenderTemplateLspTunnelIpv4, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathSenderTemplateLspTunnelIpv4) FromProto(msg *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4) (FlowRSVPPathSenderTemplateLspTunnelIpv4, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathSenderTemplateLspTunnelIpv4) 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 *unMarshalflowRSVPPathSenderTemplateLspTunnelIpv4) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathSenderTemplateLspTunnelIpv4) 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 *unMarshalflowRSVPPathSenderTemplateLspTunnelIpv4) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathSenderTemplateLspTunnelIpv4) 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 *unMarshalflowRSVPPathSenderTemplateLspTunnelIpv4) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) Clone() (FlowRSVPPathSenderTemplateLspTunnelIpv4, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathSenderTemplateLspTunnelIpv4() + 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 +} + +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) setNil() { + obj.ipv4TunnelSenderAddressHolder = nil + obj.reservedHolder = nil + obj.lspIdHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathSenderTemplateLspTunnelIpv4 is class = SENDER_TEMPLATE, LSP_TUNNEL_IPv4 C-Type = 7 +type FlowRSVPPathSenderTemplateLspTunnelIpv4 interface { + Validation + // msg marshals FlowRSVPPathSenderTemplateLspTunnelIpv4 to protobuf object *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 + // and doesn't set defaults + msg() *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 + // setMsg unmarshals FlowRSVPPathSenderTemplateLspTunnelIpv4 from protobuf object *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathSenderTemplateLspTunnelIpv4) FlowRSVPPathSenderTemplateLspTunnelIpv4 + // provides marshal interface + Marshal() marshalFlowRSVPPathSenderTemplateLspTunnelIpv4 + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathSenderTemplateLspTunnelIpv4 + // validate validates FlowRSVPPathSenderTemplateLspTunnelIpv4 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathSenderTemplateLspTunnelIpv4, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv4TunnelSenderAddress returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress, set in FlowRSVPPathSenderTemplateLspTunnelIpv4. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress is iPv4 address for a sender node. + Ipv4TunnelSenderAddress() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + // SetIpv4TunnelSenderAddress assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress provided by user to FlowRSVPPathSenderTemplateLspTunnelIpv4. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress is iPv4 address for a sender node. + SetIpv4TunnelSenderAddress(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) FlowRSVPPathSenderTemplateLspTunnelIpv4 + // HasIpv4TunnelSenderAddress checks if Ipv4TunnelSenderAddress has been set in FlowRSVPPathSenderTemplateLspTunnelIpv4 + HasIpv4TunnelSenderAddress() bool + // Reserved returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved, set in FlowRSVPPathSenderTemplateLspTunnelIpv4. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved is reserved field, MUST be zero. + Reserved() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + // SetReserved assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved provided by user to FlowRSVPPathSenderTemplateLspTunnelIpv4. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved is reserved field, MUST be zero. + SetReserved(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) FlowRSVPPathSenderTemplateLspTunnelIpv4 + // HasReserved checks if Reserved has been set in FlowRSVPPathSenderTemplateLspTunnelIpv4 + HasReserved() bool + // LspId returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId, set in FlowRSVPPathSenderTemplateLspTunnelIpv4. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId is a 16-bit identifier used in the SENDER_TEMPLATE that can be changed to allow a sender to share resources with itself. + LspId() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + // SetLspId assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId provided by user to FlowRSVPPathSenderTemplateLspTunnelIpv4. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId is a 16-bit identifier used in the SENDER_TEMPLATE that can be changed to allow a sender to share resources with itself. + SetLspId(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) FlowRSVPPathSenderTemplateLspTunnelIpv4 + // HasLspId checks if LspId has been set in FlowRSVPPathSenderTemplateLspTunnelIpv4 + HasLspId() bool + setNil() +} + +// description is TBD +// Ipv4TunnelSenderAddress returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) Ipv4TunnelSenderAddress() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { + if obj.obj.Ipv4TunnelSenderAddress == nil { + obj.obj.Ipv4TunnelSenderAddress = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress().msg() + } + if obj.ipv4TunnelSenderAddressHolder == nil { + obj.ipv4TunnelSenderAddressHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress{obj: obj.obj.Ipv4TunnelSenderAddress} + } + return obj.ipv4TunnelSenderAddressHolder +} + +// description is TBD +// Ipv4TunnelSenderAddress returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) HasIpv4TunnelSenderAddress() bool { + return obj.obj.Ipv4TunnelSenderAddress != nil +} + +// description is TBD +// SetIpv4TunnelSenderAddress sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress value in the FlowRSVPPathSenderTemplateLspTunnelIpv4 object +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) SetIpv4TunnelSenderAddress(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) FlowRSVPPathSenderTemplateLspTunnelIpv4 { + + obj.ipv4TunnelSenderAddressHolder = nil + obj.obj.Ipv4TunnelSenderAddress = value.msg() + + return obj +} + +// description is TBD +// Reserved returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) Reserved() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { + if obj.obj.Reserved == nil { + obj.obj.Reserved = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved().msg() + } + if obj.reservedHolder == nil { + obj.reservedHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved{obj: obj.obj.Reserved} + } + return obj.reservedHolder +} + +// description is TBD +// Reserved returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) HasReserved() bool { + return obj.obj.Reserved != nil +} + +// description is TBD +// SetReserved sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved value in the FlowRSVPPathSenderTemplateLspTunnelIpv4 object +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) SetReserved(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) FlowRSVPPathSenderTemplateLspTunnelIpv4 { + + obj.reservedHolder = nil + obj.obj.Reserved = value.msg() + + return obj +} + +// description is TBD +// LspId returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) LspId() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { + if obj.obj.LspId == nil { + obj.obj.LspId = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId().msg() + } + if obj.lspIdHolder == nil { + obj.lspIdHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId{obj: obj.obj.LspId} + } + return obj.lspIdHolder +} + +// description is TBD +// LspId returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) HasLspId() bool { + return obj.obj.LspId != nil +} + +// description is TBD +// SetLspId sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId value in the FlowRSVPPathSenderTemplateLspTunnelIpv4 object +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) SetLspId(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) FlowRSVPPathSenderTemplateLspTunnelIpv4 { + + obj.lspIdHolder = nil + obj.obj.LspId = value.msg() + + return obj +} + +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv4TunnelSenderAddress != nil { + + obj.Ipv4TunnelSenderAddress().validateObj(vObj, set_default) + } + + if obj.obj.Reserved != nil { + + obj.Reserved().validateObj(vObj, set_default) + } + + if obj.obj.LspId != nil { + + obj.LspId().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_sender_tspec_int_serv.go b/gosnappi/flow_rsvp_path_sender_tspec_int_serv.go new file mode 100644 index 00000000..707d9f53 --- /dev/null +++ b/gosnappi/flow_rsvp_path_sender_tspec_int_serv.go @@ -0,0 +1,894 @@ +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" +) + +// ***** FlowRSVPPathSenderTspecIntServ ***** +type flowRSVPPathSenderTspecIntServ struct { + validation + obj *otg.FlowRSVPPathSenderTspecIntServ + marshaller marshalFlowRSVPPathSenderTspecIntServ + unMarshaller unMarshalFlowRSVPPathSenderTspecIntServ + versionHolder PatternFlowRSVPPathSenderTspecIntServVersion + reserved1Holder PatternFlowRSVPPathSenderTspecIntServReserved1 + overallLengthHolder PatternFlowRSVPPathSenderTspecIntServOverallLength + serviceHeaderHolder PatternFlowRSVPPathSenderTspecIntServServiceHeader + zeroBitHolder PatternFlowRSVPPathSenderTspecIntServZeroBit + reserved2Holder PatternFlowRSVPPathSenderTspecIntServReserved2 + lengthOfServiceDataHolder PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + parameterIdTokenBucketTspecHolder PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + parameter_127FlagHolder PatternFlowRSVPPathSenderTspecIntServParameter127Flag + parameter_127LengthHolder PatternFlowRSVPPathSenderTspecIntServParameter127Length + minimumPolicedUnitHolder PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + maximumPacketSizeHolder PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize +} + +func NewFlowRSVPPathSenderTspecIntServ() FlowRSVPPathSenderTspecIntServ { + obj := flowRSVPPathSenderTspecIntServ{obj: &otg.FlowRSVPPathSenderTspecIntServ{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathSenderTspecIntServ) msg() *otg.FlowRSVPPathSenderTspecIntServ { + return obj.obj +} + +func (obj *flowRSVPPathSenderTspecIntServ) setMsg(msg *otg.FlowRSVPPathSenderTspecIntServ) FlowRSVPPathSenderTspecIntServ { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathSenderTspecIntServ struct { + obj *flowRSVPPathSenderTspecIntServ +} + +type marshalFlowRSVPPathSenderTspecIntServ interface { + // ToProto marshals FlowRSVPPathSenderTspecIntServ to protobuf object *otg.FlowRSVPPathSenderTspecIntServ + ToProto() (*otg.FlowRSVPPathSenderTspecIntServ, error) + // ToPbText marshals FlowRSVPPathSenderTspecIntServ to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathSenderTspecIntServ to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathSenderTspecIntServ to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathSenderTspecIntServ struct { + obj *flowRSVPPathSenderTspecIntServ +} + +type unMarshalFlowRSVPPathSenderTspecIntServ interface { + // FromProto unmarshals FlowRSVPPathSenderTspecIntServ from protobuf object *otg.FlowRSVPPathSenderTspecIntServ + FromProto(msg *otg.FlowRSVPPathSenderTspecIntServ) (FlowRSVPPathSenderTspecIntServ, error) + // FromPbText unmarshals FlowRSVPPathSenderTspecIntServ from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathSenderTspecIntServ from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathSenderTspecIntServ from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathSenderTspecIntServ) Marshal() marshalFlowRSVPPathSenderTspecIntServ { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathSenderTspecIntServ{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathSenderTspecIntServ) Unmarshal() unMarshalFlowRSVPPathSenderTspecIntServ { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathSenderTspecIntServ{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathSenderTspecIntServ) ToProto() (*otg.FlowRSVPPathSenderTspecIntServ, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathSenderTspecIntServ) FromProto(msg *otg.FlowRSVPPathSenderTspecIntServ) (FlowRSVPPathSenderTspecIntServ, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathSenderTspecIntServ) 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 *unMarshalflowRSVPPathSenderTspecIntServ) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathSenderTspecIntServ) 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 *unMarshalflowRSVPPathSenderTspecIntServ) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathSenderTspecIntServ) 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 *unMarshalflowRSVPPathSenderTspecIntServ) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathSenderTspecIntServ) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathSenderTspecIntServ) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathSenderTspecIntServ) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathSenderTspecIntServ) Clone() (FlowRSVPPathSenderTspecIntServ, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathSenderTspecIntServ() + 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 +} + +func (obj *flowRSVPPathSenderTspecIntServ) setNil() { + obj.versionHolder = nil + obj.reserved1Holder = nil + obj.overallLengthHolder = nil + obj.serviceHeaderHolder = nil + obj.zeroBitHolder = nil + obj.reserved2Holder = nil + obj.lengthOfServiceDataHolder = nil + obj.parameterIdTokenBucketTspecHolder = nil + obj.parameter_127FlagHolder = nil + obj.parameter_127LengthHolder = nil + obj.minimumPolicedUnitHolder = nil + obj.maximumPacketSizeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathSenderTspecIntServ is int-serv SENDER_TSPEC object: Class = 12, C-Type = 2 +type FlowRSVPPathSenderTspecIntServ interface { + Validation + // msg marshals FlowRSVPPathSenderTspecIntServ to protobuf object *otg.FlowRSVPPathSenderTspecIntServ + // and doesn't set defaults + msg() *otg.FlowRSVPPathSenderTspecIntServ + // setMsg unmarshals FlowRSVPPathSenderTspecIntServ from protobuf object *otg.FlowRSVPPathSenderTspecIntServ + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathSenderTspecIntServ) FlowRSVPPathSenderTspecIntServ + // provides marshal interface + Marshal() marshalFlowRSVPPathSenderTspecIntServ + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathSenderTspecIntServ + // validate validates FlowRSVPPathSenderTspecIntServ + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathSenderTspecIntServ, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Version returns PatternFlowRSVPPathSenderTspecIntServVersion, set in FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServVersion is message format version number. + Version() PatternFlowRSVPPathSenderTspecIntServVersion + // SetVersion assigns PatternFlowRSVPPathSenderTspecIntServVersion provided by user to FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServVersion is message format version number. + SetVersion(value PatternFlowRSVPPathSenderTspecIntServVersion) FlowRSVPPathSenderTspecIntServ + // HasVersion checks if Version has been set in FlowRSVPPathSenderTspecIntServ + HasVersion() bool + // Reserved1 returns PatternFlowRSVPPathSenderTspecIntServReserved1, set in FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServReserved1 is reserved. + Reserved1() PatternFlowRSVPPathSenderTspecIntServReserved1 + // SetReserved1 assigns PatternFlowRSVPPathSenderTspecIntServReserved1 provided by user to FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServReserved1 is reserved. + SetReserved1(value PatternFlowRSVPPathSenderTspecIntServReserved1) FlowRSVPPathSenderTspecIntServ + // HasReserved1 checks if Reserved1 has been set in FlowRSVPPathSenderTspecIntServ + HasReserved1() bool + // OverallLength returns PatternFlowRSVPPathSenderTspecIntServOverallLength, set in FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServOverallLength is overall length (7 words not including header). + OverallLength() PatternFlowRSVPPathSenderTspecIntServOverallLength + // SetOverallLength assigns PatternFlowRSVPPathSenderTspecIntServOverallLength provided by user to FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServOverallLength is overall length (7 words not including header). + SetOverallLength(value PatternFlowRSVPPathSenderTspecIntServOverallLength) FlowRSVPPathSenderTspecIntServ + // HasOverallLength checks if OverallLength has been set in FlowRSVPPathSenderTspecIntServ + HasOverallLength() bool + // ServiceHeader returns PatternFlowRSVPPathSenderTspecIntServServiceHeader, set in FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServServiceHeader is service header, service number - '1' (Generic information) if in a PATH message. + ServiceHeader() PatternFlowRSVPPathSenderTspecIntServServiceHeader + // SetServiceHeader assigns PatternFlowRSVPPathSenderTspecIntServServiceHeader provided by user to FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServServiceHeader is service header, service number - '1' (Generic information) if in a PATH message. + SetServiceHeader(value PatternFlowRSVPPathSenderTspecIntServServiceHeader) FlowRSVPPathSenderTspecIntServ + // HasServiceHeader checks if ServiceHeader has been set in FlowRSVPPathSenderTspecIntServ + HasServiceHeader() bool + // ZeroBit returns PatternFlowRSVPPathSenderTspecIntServZeroBit, set in FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServZeroBit is mUST be 0. + ZeroBit() PatternFlowRSVPPathSenderTspecIntServZeroBit + // SetZeroBit assigns PatternFlowRSVPPathSenderTspecIntServZeroBit provided by user to FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServZeroBit is mUST be 0. + SetZeroBit(value PatternFlowRSVPPathSenderTspecIntServZeroBit) FlowRSVPPathSenderTspecIntServ + // HasZeroBit checks if ZeroBit has been set in FlowRSVPPathSenderTspecIntServ + HasZeroBit() bool + // Reserved2 returns PatternFlowRSVPPathSenderTspecIntServReserved2, set in FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServReserved2 is reserved. + Reserved2() PatternFlowRSVPPathSenderTspecIntServReserved2 + // SetReserved2 assigns PatternFlowRSVPPathSenderTspecIntServReserved2 provided by user to FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServReserved2 is reserved. + SetReserved2(value PatternFlowRSVPPathSenderTspecIntServReserved2) FlowRSVPPathSenderTspecIntServ + // HasReserved2 checks if Reserved2 has been set in FlowRSVPPathSenderTspecIntServ + HasReserved2() bool + // LengthOfServiceData returns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData, set in FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData is length of service data, 6 words not including per-service header. + LengthOfServiceData() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + // SetLengthOfServiceData assigns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData provided by user to FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData is length of service data, 6 words not including per-service header. + SetLengthOfServiceData(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) FlowRSVPPathSenderTspecIntServ + // HasLengthOfServiceData checks if LengthOfServiceData has been set in FlowRSVPPathSenderTspecIntServ + HasLengthOfServiceData() bool + // ParameterIdTokenBucketTspec returns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec, set in FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec is parameter ID, parameter 127 (Token Bucket TSpec) + ParameterIdTokenBucketTspec() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + // SetParameterIdTokenBucketTspec assigns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec provided by user to FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec is parameter ID, parameter 127 (Token Bucket TSpec) + SetParameterIdTokenBucketTspec(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) FlowRSVPPathSenderTspecIntServ + // HasParameterIdTokenBucketTspec checks if ParameterIdTokenBucketTspec has been set in FlowRSVPPathSenderTspecIntServ + HasParameterIdTokenBucketTspec() bool + // Parameter127Flag returns PatternFlowRSVPPathSenderTspecIntServParameter127Flag, set in FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServParameter127Flag is parameter 127 flags (none set) + Parameter127Flag() PatternFlowRSVPPathSenderTspecIntServParameter127Flag + // SetParameter127Flag assigns PatternFlowRSVPPathSenderTspecIntServParameter127Flag provided by user to FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServParameter127Flag is parameter 127 flags (none set) + SetParameter127Flag(value PatternFlowRSVPPathSenderTspecIntServParameter127Flag) FlowRSVPPathSenderTspecIntServ + // HasParameter127Flag checks if Parameter127Flag has been set in FlowRSVPPathSenderTspecIntServ + HasParameter127Flag() bool + // Parameter127Length returns PatternFlowRSVPPathSenderTspecIntServParameter127Length, set in FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServParameter127Length is parameter 127 length, 5 words not including per-service header + Parameter127Length() PatternFlowRSVPPathSenderTspecIntServParameter127Length + // SetParameter127Length assigns PatternFlowRSVPPathSenderTspecIntServParameter127Length provided by user to FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServParameter127Length is parameter 127 length, 5 words not including per-service header + SetParameter127Length(value PatternFlowRSVPPathSenderTspecIntServParameter127Length) FlowRSVPPathSenderTspecIntServ + // HasParameter127Length checks if Parameter127Length has been set in FlowRSVPPathSenderTspecIntServ + HasParameter127Length() bool + // TokenBucketRate returns float32, set in FlowRSVPPathSenderTspecIntServ. + TokenBucketRate() float32 + // SetTokenBucketRate assigns float32 provided by user to FlowRSVPPathSenderTspecIntServ + SetTokenBucketRate(value float32) FlowRSVPPathSenderTspecIntServ + // HasTokenBucketRate checks if TokenBucketRate has been set in FlowRSVPPathSenderTspecIntServ + HasTokenBucketRate() bool + // TokenBucketSize returns float32, set in FlowRSVPPathSenderTspecIntServ. + TokenBucketSize() float32 + // SetTokenBucketSize assigns float32 provided by user to FlowRSVPPathSenderTspecIntServ + SetTokenBucketSize(value float32) FlowRSVPPathSenderTspecIntServ + // HasTokenBucketSize checks if TokenBucketSize has been set in FlowRSVPPathSenderTspecIntServ + HasTokenBucketSize() bool + // PeakDataRate returns float32, set in FlowRSVPPathSenderTspecIntServ. + PeakDataRate() float32 + // SetPeakDataRate assigns float32 provided by user to FlowRSVPPathSenderTspecIntServ + SetPeakDataRate(value float32) FlowRSVPPathSenderTspecIntServ + // HasPeakDataRate checks if PeakDataRate has been set in FlowRSVPPathSenderTspecIntServ + HasPeakDataRate() bool + // MinimumPolicedUnit returns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit, set in FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit is the minimum policed unit parameter should generally be set equal to the size of the smallest packet generated by the application. + MinimumPolicedUnit() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + // SetMinimumPolicedUnit assigns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit provided by user to FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit is the minimum policed unit parameter should generally be set equal to the size of the smallest packet generated by the application. + SetMinimumPolicedUnit(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) FlowRSVPPathSenderTspecIntServ + // HasMinimumPolicedUnit checks if MinimumPolicedUnit has been set in FlowRSVPPathSenderTspecIntServ + HasMinimumPolicedUnit() bool + // MaximumPacketSize returns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize, set in FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize is the maximum packet size parameter should be set to the size of the largest packet the application might wish to generate. This value must, by definition, be equal to or larger than the value of The minimum policed unit. + MaximumPacketSize() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + // SetMaximumPacketSize assigns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize provided by user to FlowRSVPPathSenderTspecIntServ. + // PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize is the maximum packet size parameter should be set to the size of the largest packet the application might wish to generate. This value must, by definition, be equal to or larger than the value of The minimum policed unit. + SetMaximumPacketSize(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) FlowRSVPPathSenderTspecIntServ + // HasMaximumPacketSize checks if MaximumPacketSize has been set in FlowRSVPPathSenderTspecIntServ + HasMaximumPacketSize() bool + setNil() +} + +// description is TBD +// Version returns a PatternFlowRSVPPathSenderTspecIntServVersion +func (obj *flowRSVPPathSenderTspecIntServ) Version() PatternFlowRSVPPathSenderTspecIntServVersion { + if obj.obj.Version == nil { + obj.obj.Version = NewPatternFlowRSVPPathSenderTspecIntServVersion().msg() + } + if obj.versionHolder == nil { + obj.versionHolder = &patternFlowRSVPPathSenderTspecIntServVersion{obj: obj.obj.Version} + } + return obj.versionHolder +} + +// description is TBD +// Version returns a PatternFlowRSVPPathSenderTspecIntServVersion +func (obj *flowRSVPPathSenderTspecIntServ) HasVersion() bool { + return obj.obj.Version != nil +} + +// description is TBD +// SetVersion sets the PatternFlowRSVPPathSenderTspecIntServVersion value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetVersion(value PatternFlowRSVPPathSenderTspecIntServVersion) FlowRSVPPathSenderTspecIntServ { + + obj.versionHolder = nil + obj.obj.Version = value.msg() + + return obj +} + +// description is TBD +// Reserved1 returns a PatternFlowRSVPPathSenderTspecIntServReserved1 +func (obj *flowRSVPPathSenderTspecIntServ) Reserved1() PatternFlowRSVPPathSenderTspecIntServReserved1 { + if obj.obj.Reserved1 == nil { + obj.obj.Reserved1 = NewPatternFlowRSVPPathSenderTspecIntServReserved1().msg() + } + if obj.reserved1Holder == nil { + obj.reserved1Holder = &patternFlowRSVPPathSenderTspecIntServReserved1{obj: obj.obj.Reserved1} + } + return obj.reserved1Holder +} + +// description is TBD +// Reserved1 returns a PatternFlowRSVPPathSenderTspecIntServReserved1 +func (obj *flowRSVPPathSenderTspecIntServ) HasReserved1() bool { + return obj.obj.Reserved1 != nil +} + +// description is TBD +// SetReserved1 sets the PatternFlowRSVPPathSenderTspecIntServReserved1 value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetReserved1(value PatternFlowRSVPPathSenderTspecIntServReserved1) FlowRSVPPathSenderTspecIntServ { + + obj.reserved1Holder = nil + obj.obj.Reserved1 = value.msg() + + return obj +} + +// description is TBD +// OverallLength returns a PatternFlowRSVPPathSenderTspecIntServOverallLength +func (obj *flowRSVPPathSenderTspecIntServ) OverallLength() PatternFlowRSVPPathSenderTspecIntServOverallLength { + if obj.obj.OverallLength == nil { + obj.obj.OverallLength = NewPatternFlowRSVPPathSenderTspecIntServOverallLength().msg() + } + if obj.overallLengthHolder == nil { + obj.overallLengthHolder = &patternFlowRSVPPathSenderTspecIntServOverallLength{obj: obj.obj.OverallLength} + } + return obj.overallLengthHolder +} + +// description is TBD +// OverallLength returns a PatternFlowRSVPPathSenderTspecIntServOverallLength +func (obj *flowRSVPPathSenderTspecIntServ) HasOverallLength() bool { + return obj.obj.OverallLength != nil +} + +// description is TBD +// SetOverallLength sets the PatternFlowRSVPPathSenderTspecIntServOverallLength value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetOverallLength(value PatternFlowRSVPPathSenderTspecIntServOverallLength) FlowRSVPPathSenderTspecIntServ { + + obj.overallLengthHolder = nil + obj.obj.OverallLength = value.msg() + + return obj +} + +// description is TBD +// ServiceHeader returns a PatternFlowRSVPPathSenderTspecIntServServiceHeader +func (obj *flowRSVPPathSenderTspecIntServ) ServiceHeader() PatternFlowRSVPPathSenderTspecIntServServiceHeader { + if obj.obj.ServiceHeader == nil { + obj.obj.ServiceHeader = NewPatternFlowRSVPPathSenderTspecIntServServiceHeader().msg() + } + if obj.serviceHeaderHolder == nil { + obj.serviceHeaderHolder = &patternFlowRSVPPathSenderTspecIntServServiceHeader{obj: obj.obj.ServiceHeader} + } + return obj.serviceHeaderHolder +} + +// description is TBD +// ServiceHeader returns a PatternFlowRSVPPathSenderTspecIntServServiceHeader +func (obj *flowRSVPPathSenderTspecIntServ) HasServiceHeader() bool { + return obj.obj.ServiceHeader != nil +} + +// description is TBD +// SetServiceHeader sets the PatternFlowRSVPPathSenderTspecIntServServiceHeader value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetServiceHeader(value PatternFlowRSVPPathSenderTspecIntServServiceHeader) FlowRSVPPathSenderTspecIntServ { + + obj.serviceHeaderHolder = nil + obj.obj.ServiceHeader = value.msg() + + return obj +} + +// description is TBD +// ZeroBit returns a PatternFlowRSVPPathSenderTspecIntServZeroBit +func (obj *flowRSVPPathSenderTspecIntServ) ZeroBit() PatternFlowRSVPPathSenderTspecIntServZeroBit { + if obj.obj.ZeroBit == nil { + obj.obj.ZeroBit = NewPatternFlowRSVPPathSenderTspecIntServZeroBit().msg() + } + if obj.zeroBitHolder == nil { + obj.zeroBitHolder = &patternFlowRSVPPathSenderTspecIntServZeroBit{obj: obj.obj.ZeroBit} + } + return obj.zeroBitHolder +} + +// description is TBD +// ZeroBit returns a PatternFlowRSVPPathSenderTspecIntServZeroBit +func (obj *flowRSVPPathSenderTspecIntServ) HasZeroBit() bool { + return obj.obj.ZeroBit != nil +} + +// description is TBD +// SetZeroBit sets the PatternFlowRSVPPathSenderTspecIntServZeroBit value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetZeroBit(value PatternFlowRSVPPathSenderTspecIntServZeroBit) FlowRSVPPathSenderTspecIntServ { + + obj.zeroBitHolder = nil + obj.obj.ZeroBit = value.msg() + + return obj +} + +// description is TBD +// Reserved2 returns a PatternFlowRSVPPathSenderTspecIntServReserved2 +func (obj *flowRSVPPathSenderTspecIntServ) Reserved2() PatternFlowRSVPPathSenderTspecIntServReserved2 { + if obj.obj.Reserved2 == nil { + obj.obj.Reserved2 = NewPatternFlowRSVPPathSenderTspecIntServReserved2().msg() + } + if obj.reserved2Holder == nil { + obj.reserved2Holder = &patternFlowRSVPPathSenderTspecIntServReserved2{obj: obj.obj.Reserved2} + } + return obj.reserved2Holder +} + +// description is TBD +// Reserved2 returns a PatternFlowRSVPPathSenderTspecIntServReserved2 +func (obj *flowRSVPPathSenderTspecIntServ) HasReserved2() bool { + return obj.obj.Reserved2 != nil +} + +// description is TBD +// SetReserved2 sets the PatternFlowRSVPPathSenderTspecIntServReserved2 value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetReserved2(value PatternFlowRSVPPathSenderTspecIntServReserved2) FlowRSVPPathSenderTspecIntServ { + + obj.reserved2Holder = nil + obj.obj.Reserved2 = value.msg() + + return obj +} + +// description is TBD +// LengthOfServiceData returns a PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData +func (obj *flowRSVPPathSenderTspecIntServ) LengthOfServiceData() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { + if obj.obj.LengthOfServiceData == nil { + obj.obj.LengthOfServiceData = NewPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData().msg() + } + if obj.lengthOfServiceDataHolder == nil { + obj.lengthOfServiceDataHolder = &patternFlowRSVPPathSenderTspecIntServLengthOfServiceData{obj: obj.obj.LengthOfServiceData} + } + return obj.lengthOfServiceDataHolder +} + +// description is TBD +// LengthOfServiceData returns a PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData +func (obj *flowRSVPPathSenderTspecIntServ) HasLengthOfServiceData() bool { + return obj.obj.LengthOfServiceData != nil +} + +// description is TBD +// SetLengthOfServiceData sets the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetLengthOfServiceData(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) FlowRSVPPathSenderTspecIntServ { + + obj.lengthOfServiceDataHolder = nil + obj.obj.LengthOfServiceData = value.msg() + + return obj +} + +// description is TBD +// ParameterIdTokenBucketTspec returns a PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec +func (obj *flowRSVPPathSenderTspecIntServ) ParameterIdTokenBucketTspec() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { + if obj.obj.ParameterIdTokenBucketTspec == nil { + obj.obj.ParameterIdTokenBucketTspec = NewPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec().msg() + } + if obj.parameterIdTokenBucketTspecHolder == nil { + obj.parameterIdTokenBucketTspecHolder = &patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec{obj: obj.obj.ParameterIdTokenBucketTspec} + } + return obj.parameterIdTokenBucketTspecHolder +} + +// description is TBD +// ParameterIdTokenBucketTspec returns a PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec +func (obj *flowRSVPPathSenderTspecIntServ) HasParameterIdTokenBucketTspec() bool { + return obj.obj.ParameterIdTokenBucketTspec != nil +} + +// description is TBD +// SetParameterIdTokenBucketTspec sets the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetParameterIdTokenBucketTspec(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) FlowRSVPPathSenderTspecIntServ { + + obj.parameterIdTokenBucketTspecHolder = nil + obj.obj.ParameterIdTokenBucketTspec = value.msg() + + return obj +} + +// description is TBD +// Parameter127Flag returns a PatternFlowRSVPPathSenderTspecIntServParameter127Flag +func (obj *flowRSVPPathSenderTspecIntServ) Parameter127Flag() PatternFlowRSVPPathSenderTspecIntServParameter127Flag { + if obj.obj.Parameter_127Flag == nil { + obj.obj.Parameter_127Flag = NewPatternFlowRSVPPathSenderTspecIntServParameter127Flag().msg() + } + if obj.parameter_127FlagHolder == nil { + obj.parameter_127FlagHolder = &patternFlowRSVPPathSenderTspecIntServParameter127Flag{obj: obj.obj.Parameter_127Flag} + } + return obj.parameter_127FlagHolder +} + +// description is TBD +// Parameter127Flag returns a PatternFlowRSVPPathSenderTspecIntServParameter127Flag +func (obj *flowRSVPPathSenderTspecIntServ) HasParameter127Flag() bool { + return obj.obj.Parameter_127Flag != nil +} + +// description is TBD +// SetParameter127Flag sets the PatternFlowRSVPPathSenderTspecIntServParameter127Flag value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetParameter127Flag(value PatternFlowRSVPPathSenderTspecIntServParameter127Flag) FlowRSVPPathSenderTspecIntServ { + + obj.parameter_127FlagHolder = nil + obj.obj.Parameter_127Flag = value.msg() + + return obj +} + +// description is TBD +// Parameter127Length returns a PatternFlowRSVPPathSenderTspecIntServParameter127Length +func (obj *flowRSVPPathSenderTspecIntServ) Parameter127Length() PatternFlowRSVPPathSenderTspecIntServParameter127Length { + if obj.obj.Parameter_127Length == nil { + obj.obj.Parameter_127Length = NewPatternFlowRSVPPathSenderTspecIntServParameter127Length().msg() + } + if obj.parameter_127LengthHolder == nil { + obj.parameter_127LengthHolder = &patternFlowRSVPPathSenderTspecIntServParameter127Length{obj: obj.obj.Parameter_127Length} + } + return obj.parameter_127LengthHolder +} + +// description is TBD +// Parameter127Length returns a PatternFlowRSVPPathSenderTspecIntServParameter127Length +func (obj *flowRSVPPathSenderTspecIntServ) HasParameter127Length() bool { + return obj.obj.Parameter_127Length != nil +} + +// description is TBD +// SetParameter127Length sets the PatternFlowRSVPPathSenderTspecIntServParameter127Length value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetParameter127Length(value PatternFlowRSVPPathSenderTspecIntServParameter127Length) FlowRSVPPathSenderTspecIntServ { + + obj.parameter_127LengthHolder = nil + obj.obj.Parameter_127Length = value.msg() + + return obj +} + +// Token bucket rate is set to sender's view of its generated traffic. +// TokenBucketRate returns a float32 +func (obj *flowRSVPPathSenderTspecIntServ) TokenBucketRate() float32 { + + return *obj.obj.TokenBucketRate + +} + +// Token bucket rate is set to sender's view of its generated traffic. +// TokenBucketRate returns a float32 +func (obj *flowRSVPPathSenderTspecIntServ) HasTokenBucketRate() bool { + return obj.obj.TokenBucketRate != nil +} + +// Token bucket rate is set to sender's view of its generated traffic. +// SetTokenBucketRate sets the float32 value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetTokenBucketRate(value float32) FlowRSVPPathSenderTspecIntServ { + + obj.obj.TokenBucketRate = &value + return obj +} + +// Token bucket size is set to sender's view of its generated traffic. +// TokenBucketSize returns a float32 +func (obj *flowRSVPPathSenderTspecIntServ) TokenBucketSize() float32 { + + return *obj.obj.TokenBucketSize + +} + +// Token bucket size is set to sender's view of its generated traffic. +// TokenBucketSize returns a float32 +func (obj *flowRSVPPathSenderTspecIntServ) HasTokenBucketSize() bool { + return obj.obj.TokenBucketSize != nil +} + +// Token bucket size is set to sender's view of its generated traffic. +// SetTokenBucketSize sets the float32 value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetTokenBucketSize(value float32) FlowRSVPPathSenderTspecIntServ { + + obj.obj.TokenBucketSize = &value + return obj +} + +// The peak rate may be set to the sender's peak traffic generation rate (if known and controlled), the physical interface line rate (if known), or positive infinity (if no better value is available). +// PeakDataRate returns a float32 +func (obj *flowRSVPPathSenderTspecIntServ) PeakDataRate() float32 { + + return *obj.obj.PeakDataRate + +} + +// The peak rate may be set to the sender's peak traffic generation rate (if known and controlled), the physical interface line rate (if known), or positive infinity (if no better value is available). +// PeakDataRate returns a float32 +func (obj *flowRSVPPathSenderTspecIntServ) HasPeakDataRate() bool { + return obj.obj.PeakDataRate != nil +} + +// The peak rate may be set to the sender's peak traffic generation rate (if known and controlled), the physical interface line rate (if known), or positive infinity (if no better value is available). +// SetPeakDataRate sets the float32 value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetPeakDataRate(value float32) FlowRSVPPathSenderTspecIntServ { + + obj.obj.PeakDataRate = &value + return obj +} + +// description is TBD +// MinimumPolicedUnit returns a PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit +func (obj *flowRSVPPathSenderTspecIntServ) MinimumPolicedUnit() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { + if obj.obj.MinimumPolicedUnit == nil { + obj.obj.MinimumPolicedUnit = NewPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit().msg() + } + if obj.minimumPolicedUnitHolder == nil { + obj.minimumPolicedUnitHolder = &patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit{obj: obj.obj.MinimumPolicedUnit} + } + return obj.minimumPolicedUnitHolder +} + +// description is TBD +// MinimumPolicedUnit returns a PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit +func (obj *flowRSVPPathSenderTspecIntServ) HasMinimumPolicedUnit() bool { + return obj.obj.MinimumPolicedUnit != nil +} + +// description is TBD +// SetMinimumPolicedUnit sets the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetMinimumPolicedUnit(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) FlowRSVPPathSenderTspecIntServ { + + obj.minimumPolicedUnitHolder = nil + obj.obj.MinimumPolicedUnit = value.msg() + + return obj +} + +// description is TBD +// MaximumPacketSize returns a PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize +func (obj *flowRSVPPathSenderTspecIntServ) MaximumPacketSize() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { + if obj.obj.MaximumPacketSize == nil { + obj.obj.MaximumPacketSize = NewPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize().msg() + } + if obj.maximumPacketSizeHolder == nil { + obj.maximumPacketSizeHolder = &patternFlowRSVPPathSenderTspecIntServMaximumPacketSize{obj: obj.obj.MaximumPacketSize} + } + return obj.maximumPacketSizeHolder +} + +// description is TBD +// MaximumPacketSize returns a PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize +func (obj *flowRSVPPathSenderTspecIntServ) HasMaximumPacketSize() bool { + return obj.obj.MaximumPacketSize != nil +} + +// description is TBD +// SetMaximumPacketSize sets the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize value in the FlowRSVPPathSenderTspecIntServ object +func (obj *flowRSVPPathSenderTspecIntServ) SetMaximumPacketSize(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) FlowRSVPPathSenderTspecIntServ { + + obj.maximumPacketSizeHolder = nil + obj.obj.MaximumPacketSize = value.msg() + + return obj +} + +func (obj *flowRSVPPathSenderTspecIntServ) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Version != nil { + + obj.Version().validateObj(vObj, set_default) + } + + if obj.obj.Reserved1 != nil { + + obj.Reserved1().validateObj(vObj, set_default) + } + + if obj.obj.OverallLength != nil { + + obj.OverallLength().validateObj(vObj, set_default) + } + + if obj.obj.ServiceHeader != nil { + + obj.ServiceHeader().validateObj(vObj, set_default) + } + + if obj.obj.ZeroBit != nil { + + obj.ZeroBit().validateObj(vObj, set_default) + } + + if obj.obj.Reserved2 != nil { + + obj.Reserved2().validateObj(vObj, set_default) + } + + if obj.obj.LengthOfServiceData != nil { + + obj.LengthOfServiceData().validateObj(vObj, set_default) + } + + if obj.obj.ParameterIdTokenBucketTspec != nil { + + obj.ParameterIdTokenBucketTspec().validateObj(vObj, set_default) + } + + if obj.obj.Parameter_127Flag != nil { + + obj.Parameter127Flag().validateObj(vObj, set_default) + } + + if obj.obj.Parameter_127Length != nil { + + obj.Parameter127Length().validateObj(vObj, set_default) + } + + if obj.obj.MinimumPolicedUnit != nil { + + obj.MinimumPolicedUnit().validateObj(vObj, set_default) + } + + if obj.obj.MaximumPacketSize != nil { + + obj.MaximumPacketSize().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathSenderTspecIntServ) setDefault() { + if obj.obj.TokenBucketRate == nil { + obj.SetTokenBucketRate(0) + } + if obj.obj.TokenBucketSize == nil { + obj.SetTokenBucketSize(0) + } + if obj.obj.PeakDataRate == nil { + obj.SetPeakDataRate(0) + } + +} diff --git a/gosnappi/flow_rsvp_path_session_attribute_lsp_tunnel.go b/gosnappi/flow_rsvp_path_session_attribute_lsp_tunnel.go new file mode 100644 index 00000000..93ae23e0 --- /dev/null +++ b/gosnappi/flow_rsvp_path_session_attribute_lsp_tunnel.go @@ -0,0 +1,496 @@ +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" +) + +// ***** FlowRSVPPathSessionAttributeLspTunnel ***** +type flowRSVPPathSessionAttributeLspTunnel struct { + validation + obj *otg.FlowRSVPPathSessionAttributeLspTunnel + marshaller marshalFlowRSVPPathSessionAttributeLspTunnel + unMarshaller unMarshalFlowRSVPPathSessionAttributeLspTunnel + flagsHolder FlowRSVPLspTunnelFlag + nameLengthHolder FlowRSVPSessionAttributeNameLength +} + +func NewFlowRSVPPathSessionAttributeLspTunnel() FlowRSVPPathSessionAttributeLspTunnel { + obj := flowRSVPPathSessionAttributeLspTunnel{obj: &otg.FlowRSVPPathSessionAttributeLspTunnel{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathSessionAttributeLspTunnel) msg() *otg.FlowRSVPPathSessionAttributeLspTunnel { + return obj.obj +} + +func (obj *flowRSVPPathSessionAttributeLspTunnel) setMsg(msg *otg.FlowRSVPPathSessionAttributeLspTunnel) FlowRSVPPathSessionAttributeLspTunnel { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathSessionAttributeLspTunnel struct { + obj *flowRSVPPathSessionAttributeLspTunnel +} + +type marshalFlowRSVPPathSessionAttributeLspTunnel interface { + // ToProto marshals FlowRSVPPathSessionAttributeLspTunnel to protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnel + ToProto() (*otg.FlowRSVPPathSessionAttributeLspTunnel, error) + // ToPbText marshals FlowRSVPPathSessionAttributeLspTunnel to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathSessionAttributeLspTunnel to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathSessionAttributeLspTunnel to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathSessionAttributeLspTunnel struct { + obj *flowRSVPPathSessionAttributeLspTunnel +} + +type unMarshalFlowRSVPPathSessionAttributeLspTunnel interface { + // FromProto unmarshals FlowRSVPPathSessionAttributeLspTunnel from protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnel + FromProto(msg *otg.FlowRSVPPathSessionAttributeLspTunnel) (FlowRSVPPathSessionAttributeLspTunnel, error) + // FromPbText unmarshals FlowRSVPPathSessionAttributeLspTunnel from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathSessionAttributeLspTunnel from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathSessionAttributeLspTunnel from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathSessionAttributeLspTunnel) Marshal() marshalFlowRSVPPathSessionAttributeLspTunnel { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathSessionAttributeLspTunnel{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathSessionAttributeLspTunnel) Unmarshal() unMarshalFlowRSVPPathSessionAttributeLspTunnel { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathSessionAttributeLspTunnel{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathSessionAttributeLspTunnel) ToProto() (*otg.FlowRSVPPathSessionAttributeLspTunnel, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathSessionAttributeLspTunnel) FromProto(msg *otg.FlowRSVPPathSessionAttributeLspTunnel) (FlowRSVPPathSessionAttributeLspTunnel, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathSessionAttributeLspTunnel) 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 *unMarshalflowRSVPPathSessionAttributeLspTunnel) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathSessionAttributeLspTunnel) 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 *unMarshalflowRSVPPathSessionAttributeLspTunnel) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathSessionAttributeLspTunnel) 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 *unMarshalflowRSVPPathSessionAttributeLspTunnel) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathSessionAttributeLspTunnel) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathSessionAttributeLspTunnel) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathSessionAttributeLspTunnel) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathSessionAttributeLspTunnel) Clone() (FlowRSVPPathSessionAttributeLspTunnel, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathSessionAttributeLspTunnel() + 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 +} + +func (obj *flowRSVPPathSessionAttributeLspTunnel) setNil() { + obj.flagsHolder = nil + obj.nameLengthHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathSessionAttributeLspTunnel is sESSION_ATTRIBUTE class = 207, LSP_TUNNEL_RA C-Type = 7, resource affinity information. +type FlowRSVPPathSessionAttributeLspTunnel interface { + Validation + // msg marshals FlowRSVPPathSessionAttributeLspTunnel to protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnel + // and doesn't set defaults + msg() *otg.FlowRSVPPathSessionAttributeLspTunnel + // setMsg unmarshals FlowRSVPPathSessionAttributeLspTunnel from protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnel + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathSessionAttributeLspTunnel) FlowRSVPPathSessionAttributeLspTunnel + // provides marshal interface + Marshal() marshalFlowRSVPPathSessionAttributeLspTunnel + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathSessionAttributeLspTunnel + // validate validates FlowRSVPPathSessionAttributeLspTunnel + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathSessionAttributeLspTunnel, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // SetupPriority returns uint32, set in FlowRSVPPathSessionAttributeLspTunnel. + SetupPriority() uint32 + // SetSetupPriority assigns uint32 provided by user to FlowRSVPPathSessionAttributeLspTunnel + SetSetupPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnel + // HasSetupPriority checks if SetupPriority has been set in FlowRSVPPathSessionAttributeLspTunnel + HasSetupPriority() bool + // HoldingPriority returns uint32, set in FlowRSVPPathSessionAttributeLspTunnel. + HoldingPriority() uint32 + // SetHoldingPriority assigns uint32 provided by user to FlowRSVPPathSessionAttributeLspTunnel + SetHoldingPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnel + // HasHoldingPriority checks if HoldingPriority has been set in FlowRSVPPathSessionAttributeLspTunnel + HasHoldingPriority() bool + // Flags returns FlowRSVPLspTunnelFlag, set in FlowRSVPPathSessionAttributeLspTunnel. + // FlowRSVPLspTunnelFlag is description is TBD + Flags() FlowRSVPLspTunnelFlag + // SetFlags assigns FlowRSVPLspTunnelFlag provided by user to FlowRSVPPathSessionAttributeLspTunnel. + // FlowRSVPLspTunnelFlag is description is TBD + SetFlags(value FlowRSVPLspTunnelFlag) FlowRSVPPathSessionAttributeLspTunnel + // HasFlags checks if Flags has been set in FlowRSVPPathSessionAttributeLspTunnel + HasFlags() bool + // NameLength returns FlowRSVPSessionAttributeNameLength, set in FlowRSVPPathSessionAttributeLspTunnel. + // FlowRSVPSessionAttributeNameLength is description is TBD + NameLength() FlowRSVPSessionAttributeNameLength + // SetNameLength assigns FlowRSVPSessionAttributeNameLength provided by user to FlowRSVPPathSessionAttributeLspTunnel. + // FlowRSVPSessionAttributeNameLength is description is TBD + SetNameLength(value FlowRSVPSessionAttributeNameLength) FlowRSVPPathSessionAttributeLspTunnel + // HasNameLength checks if NameLength has been set in FlowRSVPPathSessionAttributeLspTunnel + HasNameLength() bool + // SessionName returns string, set in FlowRSVPPathSessionAttributeLspTunnel. + SessionName() string + // SetSessionName assigns string provided by user to FlowRSVPPathSessionAttributeLspTunnel + SetSessionName(value string) FlowRSVPPathSessionAttributeLspTunnel + // HasSessionName checks if SessionName has been set in FlowRSVPPathSessionAttributeLspTunnel + HasSessionName() bool + setNil() +} + +// The priority of the session with respect to taking resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. +// SetupPriority returns a uint32 +func (obj *flowRSVPPathSessionAttributeLspTunnel) SetupPriority() uint32 { + + return *obj.obj.SetupPriority + +} + +// The priority of the session with respect to taking resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. +// SetupPriority returns a uint32 +func (obj *flowRSVPPathSessionAttributeLspTunnel) HasSetupPriority() bool { + return obj.obj.SetupPriority != nil +} + +// The priority of the session with respect to taking resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. +// SetSetupPriority sets the uint32 value in the FlowRSVPPathSessionAttributeLspTunnel object +func (obj *flowRSVPPathSessionAttributeLspTunnel) SetSetupPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnel { + + obj.obj.SetupPriority = &value + return obj +} + +// The priority of the session with respect to holding resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. +// HoldingPriority returns a uint32 +func (obj *flowRSVPPathSessionAttributeLspTunnel) HoldingPriority() uint32 { + + return *obj.obj.HoldingPriority + +} + +// The priority of the session with respect to holding resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. +// HoldingPriority returns a uint32 +func (obj *flowRSVPPathSessionAttributeLspTunnel) HasHoldingPriority() bool { + return obj.obj.HoldingPriority != nil +} + +// The priority of the session with respect to holding resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. +// SetHoldingPriority sets the uint32 value in the FlowRSVPPathSessionAttributeLspTunnel object +func (obj *flowRSVPPathSessionAttributeLspTunnel) SetHoldingPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnel { + + obj.obj.HoldingPriority = &value + return obj +} + +// 0x01 Local protection desired, 0x02 Label recording desired, 0x04 SE Style desired +// Flags returns a FlowRSVPLspTunnelFlag +func (obj *flowRSVPPathSessionAttributeLspTunnel) Flags() FlowRSVPLspTunnelFlag { + if obj.obj.Flags == nil { + obj.obj.Flags = NewFlowRSVPLspTunnelFlag().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &flowRSVPLspTunnelFlag{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// 0x01 Local protection desired, 0x02 Label recording desired, 0x04 SE Style desired +// Flags returns a FlowRSVPLspTunnelFlag +func (obj *flowRSVPPathSessionAttributeLspTunnel) HasFlags() bool { + return obj.obj.Flags != nil +} + +// 0x01 Local protection desired, 0x02 Label recording desired, 0x04 SE Style desired +// SetFlags sets the FlowRSVPLspTunnelFlag value in the FlowRSVPPathSessionAttributeLspTunnel object +func (obj *flowRSVPPathSessionAttributeLspTunnel) SetFlags(value FlowRSVPLspTunnelFlag) FlowRSVPPathSessionAttributeLspTunnel { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// The length of the display string before padding, in bytes. +// NameLength returns a FlowRSVPSessionAttributeNameLength +func (obj *flowRSVPPathSessionAttributeLspTunnel) NameLength() FlowRSVPSessionAttributeNameLength { + if obj.obj.NameLength == nil { + obj.obj.NameLength = NewFlowRSVPSessionAttributeNameLength().msg() + } + if obj.nameLengthHolder == nil { + obj.nameLengthHolder = &flowRSVPSessionAttributeNameLength{obj: obj.obj.NameLength} + } + return obj.nameLengthHolder +} + +// The length of the display string before padding, in bytes. +// NameLength returns a FlowRSVPSessionAttributeNameLength +func (obj *flowRSVPPathSessionAttributeLspTunnel) HasNameLength() bool { + return obj.obj.NameLength != nil +} + +// The length of the display string before padding, in bytes. +// SetNameLength sets the FlowRSVPSessionAttributeNameLength value in the FlowRSVPPathSessionAttributeLspTunnel object +func (obj *flowRSVPPathSessionAttributeLspTunnel) SetNameLength(value FlowRSVPSessionAttributeNameLength) FlowRSVPPathSessionAttributeLspTunnel { + + obj.nameLengthHolder = nil + obj.obj.NameLength = value.msg() + + return obj +} + +// A null padded string of characters. +// SessionName returns a string +func (obj *flowRSVPPathSessionAttributeLspTunnel) SessionName() string { + + return *obj.obj.SessionName + +} + +// A null padded string of characters. +// SessionName returns a string +func (obj *flowRSVPPathSessionAttributeLspTunnel) HasSessionName() bool { + return obj.obj.SessionName != nil +} + +// A null padded string of characters. +// SetSessionName sets the string value in the FlowRSVPPathSessionAttributeLspTunnel object +func (obj *flowRSVPPathSessionAttributeLspTunnel) SetSessionName(value string) FlowRSVPPathSessionAttributeLspTunnel { + + obj.obj.SessionName = &value + return obj +} + +func (obj *flowRSVPPathSessionAttributeLspTunnel) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.SetupPriority != nil { + + if *obj.obj.SetupPriority > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowRSVPPathSessionAttributeLspTunnel.SetupPriority <= 7 but Got %d", *obj.obj.SetupPriority)) + } + + } + + if obj.obj.HoldingPriority != nil { + + if *obj.obj.HoldingPriority > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowRSVPPathSessionAttributeLspTunnel.HoldingPriority <= 7 but Got %d", *obj.obj.HoldingPriority)) + } + + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.NameLength != nil { + + obj.NameLength().validateObj(vObj, set_default) + } + + if obj.obj.SessionName != nil { + + if len(*obj.obj.SessionName) < 0 || len(*obj.obj.SessionName) > 254 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of FlowRSVPPathSessionAttributeLspTunnel.SessionName <= 254 but Got %d", + len(*obj.obj.SessionName))) + } + + } + +} + +func (obj *flowRSVPPathSessionAttributeLspTunnel) setDefault() { + if obj.obj.SetupPriority == nil { + obj.SetSetupPriority(7) + } + if obj.obj.HoldingPriority == nil { + obj.SetHoldingPriority(7) + } + if obj.obj.SessionName == nil { + obj.SetSessionName("") + } + +} diff --git a/gosnappi/flow_rsvp_path_session_attribute_lsp_tunnel_ra.go b/gosnappi/flow_rsvp_path_session_attribute_lsp_tunnel_ra.go new file mode 100644 index 00000000..420b2377 --- /dev/null +++ b/gosnappi/flow_rsvp_path_session_attribute_lsp_tunnel_ra.go @@ -0,0 +1,625 @@ +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" +) + +// ***** FlowRSVPPathSessionAttributeLspTunnelRa ***** +type flowRSVPPathSessionAttributeLspTunnelRa struct { + validation + obj *otg.FlowRSVPPathSessionAttributeLspTunnelRa + marshaller marshalFlowRSVPPathSessionAttributeLspTunnelRa + unMarshaller unMarshalFlowRSVPPathSessionAttributeLspTunnelRa + flagsHolder FlowRSVPLspTunnelFlag + nameLengthHolder FlowRSVPSessionAttributeNameLength +} + +func NewFlowRSVPPathSessionAttributeLspTunnelRa() FlowRSVPPathSessionAttributeLspTunnelRa { + obj := flowRSVPPathSessionAttributeLspTunnelRa{obj: &otg.FlowRSVPPathSessionAttributeLspTunnelRa{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) msg() *otg.FlowRSVPPathSessionAttributeLspTunnelRa { + return obj.obj +} + +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) setMsg(msg *otg.FlowRSVPPathSessionAttributeLspTunnelRa) FlowRSVPPathSessionAttributeLspTunnelRa { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathSessionAttributeLspTunnelRa struct { + obj *flowRSVPPathSessionAttributeLspTunnelRa +} + +type marshalFlowRSVPPathSessionAttributeLspTunnelRa interface { + // ToProto marshals FlowRSVPPathSessionAttributeLspTunnelRa to protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnelRa + ToProto() (*otg.FlowRSVPPathSessionAttributeLspTunnelRa, error) + // ToPbText marshals FlowRSVPPathSessionAttributeLspTunnelRa to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathSessionAttributeLspTunnelRa to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathSessionAttributeLspTunnelRa to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathSessionAttributeLspTunnelRa struct { + obj *flowRSVPPathSessionAttributeLspTunnelRa +} + +type unMarshalFlowRSVPPathSessionAttributeLspTunnelRa interface { + // FromProto unmarshals FlowRSVPPathSessionAttributeLspTunnelRa from protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnelRa + FromProto(msg *otg.FlowRSVPPathSessionAttributeLspTunnelRa) (FlowRSVPPathSessionAttributeLspTunnelRa, error) + // FromPbText unmarshals FlowRSVPPathSessionAttributeLspTunnelRa from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathSessionAttributeLspTunnelRa from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathSessionAttributeLspTunnelRa from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) Marshal() marshalFlowRSVPPathSessionAttributeLspTunnelRa { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathSessionAttributeLspTunnelRa{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) Unmarshal() unMarshalFlowRSVPPathSessionAttributeLspTunnelRa { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathSessionAttributeLspTunnelRa{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathSessionAttributeLspTunnelRa) ToProto() (*otg.FlowRSVPPathSessionAttributeLspTunnelRa, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathSessionAttributeLspTunnelRa) FromProto(msg *otg.FlowRSVPPathSessionAttributeLspTunnelRa) (FlowRSVPPathSessionAttributeLspTunnelRa, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathSessionAttributeLspTunnelRa) 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 *unMarshalflowRSVPPathSessionAttributeLspTunnelRa) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathSessionAttributeLspTunnelRa) 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 *unMarshalflowRSVPPathSessionAttributeLspTunnelRa) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathSessionAttributeLspTunnelRa) 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 *unMarshalflowRSVPPathSessionAttributeLspTunnelRa) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) Clone() (FlowRSVPPathSessionAttributeLspTunnelRa, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathSessionAttributeLspTunnelRa() + 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 +} + +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) setNil() { + obj.flagsHolder = nil + obj.nameLengthHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathSessionAttributeLspTunnelRa is sESSION_ATTRIBUTE class = 207, LSP_TUNNEL_RA C-Type = 1, it carries resource affinity information. +type FlowRSVPPathSessionAttributeLspTunnelRa interface { + Validation + // msg marshals FlowRSVPPathSessionAttributeLspTunnelRa to protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnelRa + // and doesn't set defaults + msg() *otg.FlowRSVPPathSessionAttributeLspTunnelRa + // setMsg unmarshals FlowRSVPPathSessionAttributeLspTunnelRa from protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnelRa + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathSessionAttributeLspTunnelRa) FlowRSVPPathSessionAttributeLspTunnelRa + // provides marshal interface + Marshal() marshalFlowRSVPPathSessionAttributeLspTunnelRa + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathSessionAttributeLspTunnelRa + // validate validates FlowRSVPPathSessionAttributeLspTunnelRa + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathSessionAttributeLspTunnelRa, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ExcludeAny returns string, set in FlowRSVPPathSessionAttributeLspTunnelRa. + ExcludeAny() string + // SetExcludeAny assigns string provided by user to FlowRSVPPathSessionAttributeLspTunnelRa + SetExcludeAny(value string) FlowRSVPPathSessionAttributeLspTunnelRa + // HasExcludeAny checks if ExcludeAny has been set in FlowRSVPPathSessionAttributeLspTunnelRa + HasExcludeAny() bool + // IncludeAny returns string, set in FlowRSVPPathSessionAttributeLspTunnelRa. + IncludeAny() string + // SetIncludeAny assigns string provided by user to FlowRSVPPathSessionAttributeLspTunnelRa + SetIncludeAny(value string) FlowRSVPPathSessionAttributeLspTunnelRa + // HasIncludeAny checks if IncludeAny has been set in FlowRSVPPathSessionAttributeLspTunnelRa + HasIncludeAny() bool + // IncludeAll returns string, set in FlowRSVPPathSessionAttributeLspTunnelRa. + IncludeAll() string + // SetIncludeAll assigns string provided by user to FlowRSVPPathSessionAttributeLspTunnelRa + SetIncludeAll(value string) FlowRSVPPathSessionAttributeLspTunnelRa + // HasIncludeAll checks if IncludeAll has been set in FlowRSVPPathSessionAttributeLspTunnelRa + HasIncludeAll() bool + // SetupPriority returns uint32, set in FlowRSVPPathSessionAttributeLspTunnelRa. + SetupPriority() uint32 + // SetSetupPriority assigns uint32 provided by user to FlowRSVPPathSessionAttributeLspTunnelRa + SetSetupPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnelRa + // HasSetupPriority checks if SetupPriority has been set in FlowRSVPPathSessionAttributeLspTunnelRa + HasSetupPriority() bool + // HoldingPriority returns uint32, set in FlowRSVPPathSessionAttributeLspTunnelRa. + HoldingPriority() uint32 + // SetHoldingPriority assigns uint32 provided by user to FlowRSVPPathSessionAttributeLspTunnelRa + SetHoldingPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnelRa + // HasHoldingPriority checks if HoldingPriority has been set in FlowRSVPPathSessionAttributeLspTunnelRa + HasHoldingPriority() bool + // Flags returns FlowRSVPLspTunnelFlag, set in FlowRSVPPathSessionAttributeLspTunnelRa. + // FlowRSVPLspTunnelFlag is description is TBD + Flags() FlowRSVPLspTunnelFlag + // SetFlags assigns FlowRSVPLspTunnelFlag provided by user to FlowRSVPPathSessionAttributeLspTunnelRa. + // FlowRSVPLspTunnelFlag is description is TBD + SetFlags(value FlowRSVPLspTunnelFlag) FlowRSVPPathSessionAttributeLspTunnelRa + // HasFlags checks if Flags has been set in FlowRSVPPathSessionAttributeLspTunnelRa + HasFlags() bool + // NameLength returns FlowRSVPSessionAttributeNameLength, set in FlowRSVPPathSessionAttributeLspTunnelRa. + // FlowRSVPSessionAttributeNameLength is description is TBD + NameLength() FlowRSVPSessionAttributeNameLength + // SetNameLength assigns FlowRSVPSessionAttributeNameLength provided by user to FlowRSVPPathSessionAttributeLspTunnelRa. + // FlowRSVPSessionAttributeNameLength is description is TBD + SetNameLength(value FlowRSVPSessionAttributeNameLength) FlowRSVPPathSessionAttributeLspTunnelRa + // HasNameLength checks if NameLength has been set in FlowRSVPPathSessionAttributeLspTunnelRa + HasNameLength() bool + // SessionName returns string, set in FlowRSVPPathSessionAttributeLspTunnelRa. + SessionName() string + // SetSessionName assigns string provided by user to FlowRSVPPathSessionAttributeLspTunnelRa + SetSessionName(value string) FlowRSVPPathSessionAttributeLspTunnelRa + // HasSessionName checks if SessionName has been set in FlowRSVPPathSessionAttributeLspTunnelRa + HasSessionName() bool + setNil() +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// ExcludeAny returns a string +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) ExcludeAny() string { + + return *obj.obj.ExcludeAny + +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// ExcludeAny returns a string +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasExcludeAny() bool { + return obj.obj.ExcludeAny != nil +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// SetExcludeAny sets the string value in the FlowRSVPPathSessionAttributeLspTunnelRa object +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetExcludeAny(value string) FlowRSVPPathSessionAttributeLspTunnelRa { + + obj.obj.ExcludeAny = &value + return obj +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// IncludeAny returns a string +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) IncludeAny() string { + + return *obj.obj.IncludeAny + +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// IncludeAny returns a string +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasIncludeAny() bool { + return obj.obj.IncludeAny != nil +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// SetIncludeAny sets the string value in the FlowRSVPPathSessionAttributeLspTunnelRa object +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetIncludeAny(value string) FlowRSVPPathSessionAttributeLspTunnelRa { + + obj.obj.IncludeAny = &value + return obj +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// IncludeAll returns a string +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) IncludeAll() string { + + return *obj.obj.IncludeAll + +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// IncludeAll returns a string +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasIncludeAll() bool { + return obj.obj.IncludeAll != nil +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// SetIncludeAll sets the string value in the FlowRSVPPathSessionAttributeLspTunnelRa object +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetIncludeAll(value string) FlowRSVPPathSessionAttributeLspTunnelRa { + + obj.obj.IncludeAll = &value + return obj +} + +// The priority of the session with respect to taking resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. +// SetupPriority returns a uint32 +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetupPriority() uint32 { + + return *obj.obj.SetupPriority + +} + +// The priority of the session with respect to taking resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. +// SetupPriority returns a uint32 +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasSetupPriority() bool { + return obj.obj.SetupPriority != nil +} + +// The priority of the session with respect to taking resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. +// SetSetupPriority sets the uint32 value in the FlowRSVPPathSessionAttributeLspTunnelRa object +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetSetupPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnelRa { + + obj.obj.SetupPriority = &value + return obj +} + +// The priority of the session with respect to holding resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. +// HoldingPriority returns a uint32 +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HoldingPriority() uint32 { + + return *obj.obj.HoldingPriority + +} + +// The priority of the session with respect to holding resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. +// HoldingPriority returns a uint32 +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasHoldingPriority() bool { + return obj.obj.HoldingPriority != nil +} + +// The priority of the session with respect to holding resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. +// SetHoldingPriority sets the uint32 value in the FlowRSVPPathSessionAttributeLspTunnelRa object +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetHoldingPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnelRa { + + obj.obj.HoldingPriority = &value + return obj +} + +// 0x01 Local protection desired, 0x02 Label recording desired, 0x04 SE Style desired +// Flags returns a FlowRSVPLspTunnelFlag +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) Flags() FlowRSVPLspTunnelFlag { + if obj.obj.Flags == nil { + obj.obj.Flags = NewFlowRSVPLspTunnelFlag().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &flowRSVPLspTunnelFlag{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// 0x01 Local protection desired, 0x02 Label recording desired, 0x04 SE Style desired +// Flags returns a FlowRSVPLspTunnelFlag +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasFlags() bool { + return obj.obj.Flags != nil +} + +// 0x01 Local protection desired, 0x02 Label recording desired, 0x04 SE Style desired +// SetFlags sets the FlowRSVPLspTunnelFlag value in the FlowRSVPPathSessionAttributeLspTunnelRa object +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetFlags(value FlowRSVPLspTunnelFlag) FlowRSVPPathSessionAttributeLspTunnelRa { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// The length of the display string before padding, in bytes. +// NameLength returns a FlowRSVPSessionAttributeNameLength +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) NameLength() FlowRSVPSessionAttributeNameLength { + if obj.obj.NameLength == nil { + obj.obj.NameLength = NewFlowRSVPSessionAttributeNameLength().msg() + } + if obj.nameLengthHolder == nil { + obj.nameLengthHolder = &flowRSVPSessionAttributeNameLength{obj: obj.obj.NameLength} + } + return obj.nameLengthHolder +} + +// The length of the display string before padding, in bytes. +// NameLength returns a FlowRSVPSessionAttributeNameLength +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasNameLength() bool { + return obj.obj.NameLength != nil +} + +// The length of the display string before padding, in bytes. +// SetNameLength sets the FlowRSVPSessionAttributeNameLength value in the FlowRSVPPathSessionAttributeLspTunnelRa object +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetNameLength(value FlowRSVPSessionAttributeNameLength) FlowRSVPPathSessionAttributeLspTunnelRa { + + obj.nameLengthHolder = nil + obj.obj.NameLength = value.msg() + + return obj +} + +// A null padded string of characters. +// SessionName returns a string +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SessionName() string { + + return *obj.obj.SessionName + +} + +// A null padded string of characters. +// SessionName returns a string +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasSessionName() bool { + return obj.obj.SessionName != nil +} + +// A null padded string of characters. +// SetSessionName sets the string value in the FlowRSVPPathSessionAttributeLspTunnelRa object +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetSessionName(value string) FlowRSVPPathSessionAttributeLspTunnelRa { + + obj.obj.SessionName = &value + return obj +} + +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.ExcludeAny != nil { + + if len(*obj.obj.ExcludeAny) < 0 || len(*obj.obj.ExcludeAny) > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of FlowRSVPPathSessionAttributeLspTunnelRa.ExcludeAny <= 8 but Got %d", + len(*obj.obj.ExcludeAny))) + } + + } + + if obj.obj.IncludeAny != nil { + + if len(*obj.obj.IncludeAny) < 0 || len(*obj.obj.IncludeAny) > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of FlowRSVPPathSessionAttributeLspTunnelRa.IncludeAny <= 8 but Got %d", + len(*obj.obj.IncludeAny))) + } + + } + + if obj.obj.IncludeAll != nil { + + if len(*obj.obj.IncludeAll) < 0 || len(*obj.obj.IncludeAll) > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of FlowRSVPPathSessionAttributeLspTunnelRa.IncludeAll <= 8 but Got %d", + len(*obj.obj.IncludeAll))) + } + + } + + if obj.obj.SetupPriority != nil { + + if *obj.obj.SetupPriority > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowRSVPPathSessionAttributeLspTunnelRa.SetupPriority <= 7 but Got %d", *obj.obj.SetupPriority)) + } + + } + + if obj.obj.HoldingPriority != nil { + + if *obj.obj.HoldingPriority > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowRSVPPathSessionAttributeLspTunnelRa.HoldingPriority <= 7 but Got %d", *obj.obj.HoldingPriority)) + } + + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.NameLength != nil { + + obj.NameLength().validateObj(vObj, set_default) + } + + if obj.obj.SessionName != nil { + + if len(*obj.obj.SessionName) < 0 || len(*obj.obj.SessionName) > 254 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of FlowRSVPPathSessionAttributeLspTunnelRa.SessionName <= 254 but Got %d", + len(*obj.obj.SessionName))) + } + + } + +} + +func (obj *flowRSVPPathSessionAttributeLspTunnelRa) setDefault() { + if obj.obj.ExcludeAny == nil { + obj.SetExcludeAny("00") + } + if obj.obj.IncludeAny == nil { + obj.SetIncludeAny("00") + } + if obj.obj.IncludeAll == nil { + obj.SetIncludeAll("00") + } + if obj.obj.SetupPriority == nil { + obj.SetSetupPriority(7) + } + if obj.obj.HoldingPriority == nil { + obj.SetHoldingPriority(7) + } + if obj.obj.SessionName == nil { + obj.SetSessionName("") + } + +} diff --git a/gosnappi/flow_rsvp_path_session_ext_tunnel_id.go b/gosnappi/flow_rsvp_path_session_ext_tunnel_id.go new file mode 100644 index 00000000..4f6283e8 --- /dev/null +++ b/gosnappi/flow_rsvp_path_session_ext_tunnel_id.go @@ -0,0 +1,452 @@ +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" +) + +// ***** FlowRSVPPathSessionExtTunnelId ***** +type flowRSVPPathSessionExtTunnelId struct { + validation + obj *otg.FlowRSVPPathSessionExtTunnelId + marshaller marshalFlowRSVPPathSessionExtTunnelId + unMarshaller unMarshalFlowRSVPPathSessionExtTunnelId + asIntegerHolder PatternFlowRSVPPathSessionExtTunnelIdAsInteger + asIpv4Holder PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 +} + +func NewFlowRSVPPathSessionExtTunnelId() FlowRSVPPathSessionExtTunnelId { + obj := flowRSVPPathSessionExtTunnelId{obj: &otg.FlowRSVPPathSessionExtTunnelId{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathSessionExtTunnelId) msg() *otg.FlowRSVPPathSessionExtTunnelId { + return obj.obj +} + +func (obj *flowRSVPPathSessionExtTunnelId) setMsg(msg *otg.FlowRSVPPathSessionExtTunnelId) FlowRSVPPathSessionExtTunnelId { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathSessionExtTunnelId struct { + obj *flowRSVPPathSessionExtTunnelId +} + +type marshalFlowRSVPPathSessionExtTunnelId interface { + // ToProto marshals FlowRSVPPathSessionExtTunnelId to protobuf object *otg.FlowRSVPPathSessionExtTunnelId + ToProto() (*otg.FlowRSVPPathSessionExtTunnelId, error) + // ToPbText marshals FlowRSVPPathSessionExtTunnelId to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathSessionExtTunnelId to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathSessionExtTunnelId to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathSessionExtTunnelId struct { + obj *flowRSVPPathSessionExtTunnelId +} + +type unMarshalFlowRSVPPathSessionExtTunnelId interface { + // FromProto unmarshals FlowRSVPPathSessionExtTunnelId from protobuf object *otg.FlowRSVPPathSessionExtTunnelId + FromProto(msg *otg.FlowRSVPPathSessionExtTunnelId) (FlowRSVPPathSessionExtTunnelId, error) + // FromPbText unmarshals FlowRSVPPathSessionExtTunnelId from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathSessionExtTunnelId from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathSessionExtTunnelId from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathSessionExtTunnelId) Marshal() marshalFlowRSVPPathSessionExtTunnelId { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathSessionExtTunnelId{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathSessionExtTunnelId) Unmarshal() unMarshalFlowRSVPPathSessionExtTunnelId { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathSessionExtTunnelId{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathSessionExtTunnelId) ToProto() (*otg.FlowRSVPPathSessionExtTunnelId, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathSessionExtTunnelId) FromProto(msg *otg.FlowRSVPPathSessionExtTunnelId) (FlowRSVPPathSessionExtTunnelId, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathSessionExtTunnelId) 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 *unMarshalflowRSVPPathSessionExtTunnelId) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathSessionExtTunnelId) 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 *unMarshalflowRSVPPathSessionExtTunnelId) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathSessionExtTunnelId) 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 *unMarshalflowRSVPPathSessionExtTunnelId) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathSessionExtTunnelId) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathSessionExtTunnelId) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathSessionExtTunnelId) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathSessionExtTunnelId) Clone() (FlowRSVPPathSessionExtTunnelId, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathSessionExtTunnelId() + 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 +} + +func (obj *flowRSVPPathSessionExtTunnelId) setNil() { + obj.asIntegerHolder = nil + obj.asIpv4Holder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathSessionExtTunnelId is description is TBD +type FlowRSVPPathSessionExtTunnelId interface { + Validation + // msg marshals FlowRSVPPathSessionExtTunnelId to protobuf object *otg.FlowRSVPPathSessionExtTunnelId + // and doesn't set defaults + msg() *otg.FlowRSVPPathSessionExtTunnelId + // setMsg unmarshals FlowRSVPPathSessionExtTunnelId from protobuf object *otg.FlowRSVPPathSessionExtTunnelId + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathSessionExtTunnelId) FlowRSVPPathSessionExtTunnelId + // provides marshal interface + Marshal() marshalFlowRSVPPathSessionExtTunnelId + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathSessionExtTunnelId + // validate validates FlowRSVPPathSessionExtTunnelId + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathSessionExtTunnelId, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPPathSessionExtTunnelIdChoiceEnum, set in FlowRSVPPathSessionExtTunnelId + Choice() FlowRSVPPathSessionExtTunnelIdChoiceEnum + // setChoice assigns FlowRSVPPathSessionExtTunnelIdChoiceEnum provided by user to FlowRSVPPathSessionExtTunnelId + setChoice(value FlowRSVPPathSessionExtTunnelIdChoiceEnum) FlowRSVPPathSessionExtTunnelId + // HasChoice checks if Choice has been set in FlowRSVPPathSessionExtTunnelId + HasChoice() bool + // AsInteger returns PatternFlowRSVPPathSessionExtTunnelIdAsInteger, set in FlowRSVPPathSessionExtTunnelId. + // PatternFlowRSVPPathSessionExtTunnelIdAsInteger is tBD + AsInteger() PatternFlowRSVPPathSessionExtTunnelIdAsInteger + // SetAsInteger assigns PatternFlowRSVPPathSessionExtTunnelIdAsInteger provided by user to FlowRSVPPathSessionExtTunnelId. + // PatternFlowRSVPPathSessionExtTunnelIdAsInteger is tBD + SetAsInteger(value PatternFlowRSVPPathSessionExtTunnelIdAsInteger) FlowRSVPPathSessionExtTunnelId + // HasAsInteger checks if AsInteger has been set in FlowRSVPPathSessionExtTunnelId + HasAsInteger() bool + // AsIpv4 returns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4, set in FlowRSVPPathSessionExtTunnelId. + // PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 is iPv4 address of the ingress endpoint for the tunnel. + AsIpv4() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + // SetAsIpv4 assigns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 provided by user to FlowRSVPPathSessionExtTunnelId. + // PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 is iPv4 address of the ingress endpoint for the tunnel. + SetAsIpv4(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) FlowRSVPPathSessionExtTunnelId + // HasAsIpv4 checks if AsIpv4 has been set in FlowRSVPPathSessionExtTunnelId + HasAsIpv4() bool + setNil() +} + +type FlowRSVPPathSessionExtTunnelIdChoiceEnum string + +// Enum of Choice on FlowRSVPPathSessionExtTunnelId +var FlowRSVPPathSessionExtTunnelIdChoice = struct { + AS_INTEGER FlowRSVPPathSessionExtTunnelIdChoiceEnum + AS_IPV4 FlowRSVPPathSessionExtTunnelIdChoiceEnum +}{ + AS_INTEGER: FlowRSVPPathSessionExtTunnelIdChoiceEnum("as_integer"), + AS_IPV4: FlowRSVPPathSessionExtTunnelIdChoiceEnum("as_ipv4"), +} + +func (obj *flowRSVPPathSessionExtTunnelId) Choice() FlowRSVPPathSessionExtTunnelIdChoiceEnum { + return FlowRSVPPathSessionExtTunnelIdChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// 32 bit integer or IPv4 address. +// Choice returns a string +func (obj *flowRSVPPathSessionExtTunnelId) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPPathSessionExtTunnelId) setChoice(value FlowRSVPPathSessionExtTunnelIdChoiceEnum) FlowRSVPPathSessionExtTunnelId { + intValue, ok := otg.FlowRSVPPathSessionExtTunnelId_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPPathSessionExtTunnelIdChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPPathSessionExtTunnelId_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.AsIpv4 = nil + obj.asIpv4Holder = nil + obj.obj.AsInteger = nil + obj.asIntegerHolder = nil + + if value == FlowRSVPPathSessionExtTunnelIdChoice.AS_INTEGER { + obj.obj.AsInteger = NewPatternFlowRSVPPathSessionExtTunnelIdAsInteger().msg() + } + + if value == FlowRSVPPathSessionExtTunnelIdChoice.AS_IPV4 { + obj.obj.AsIpv4 = NewPatternFlowRSVPPathSessionExtTunnelIdAsIpv4().msg() + } + + return obj +} + +// description is TBD +// AsInteger returns a PatternFlowRSVPPathSessionExtTunnelIdAsInteger +func (obj *flowRSVPPathSessionExtTunnelId) AsInteger() PatternFlowRSVPPathSessionExtTunnelIdAsInteger { + if obj.obj.AsInteger == nil { + obj.setChoice(FlowRSVPPathSessionExtTunnelIdChoice.AS_INTEGER) + } + if obj.asIntegerHolder == nil { + obj.asIntegerHolder = &patternFlowRSVPPathSessionExtTunnelIdAsInteger{obj: obj.obj.AsInteger} + } + return obj.asIntegerHolder +} + +// description is TBD +// AsInteger returns a PatternFlowRSVPPathSessionExtTunnelIdAsInteger +func (obj *flowRSVPPathSessionExtTunnelId) HasAsInteger() bool { + return obj.obj.AsInteger != nil +} + +// description is TBD +// SetAsInteger sets the PatternFlowRSVPPathSessionExtTunnelIdAsInteger value in the FlowRSVPPathSessionExtTunnelId object +func (obj *flowRSVPPathSessionExtTunnelId) SetAsInteger(value PatternFlowRSVPPathSessionExtTunnelIdAsInteger) FlowRSVPPathSessionExtTunnelId { + obj.setChoice(FlowRSVPPathSessionExtTunnelIdChoice.AS_INTEGER) + obj.asIntegerHolder = nil + obj.obj.AsInteger = value.msg() + + return obj +} + +// description is TBD +// AsIpv4 returns a PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 +func (obj *flowRSVPPathSessionExtTunnelId) AsIpv4() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { + if obj.obj.AsIpv4 == nil { + obj.setChoice(FlowRSVPPathSessionExtTunnelIdChoice.AS_IPV4) + } + if obj.asIpv4Holder == nil { + obj.asIpv4Holder = &patternFlowRSVPPathSessionExtTunnelIdAsIpv4{obj: obj.obj.AsIpv4} + } + return obj.asIpv4Holder +} + +// description is TBD +// AsIpv4 returns a PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 +func (obj *flowRSVPPathSessionExtTunnelId) HasAsIpv4() bool { + return obj.obj.AsIpv4 != nil +} + +// description is TBD +// SetAsIpv4 sets the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 value in the FlowRSVPPathSessionExtTunnelId object +func (obj *flowRSVPPathSessionExtTunnelId) SetAsIpv4(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) FlowRSVPPathSessionExtTunnelId { + obj.setChoice(FlowRSVPPathSessionExtTunnelIdChoice.AS_IPV4) + obj.asIpv4Holder = nil + obj.obj.AsIpv4 = value.msg() + + return obj +} + +func (obj *flowRSVPPathSessionExtTunnelId) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.AsInteger != nil { + + obj.AsInteger().validateObj(vObj, set_default) + } + + if obj.obj.AsIpv4 != nil { + + obj.AsIpv4().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathSessionExtTunnelId) setDefault() { + var choices_set int = 0 + var choice FlowRSVPPathSessionExtTunnelIdChoiceEnum + + if obj.obj.AsInteger != nil { + choices_set += 1 + choice = FlowRSVPPathSessionExtTunnelIdChoice.AS_INTEGER + } + + if obj.obj.AsIpv4 != nil { + choices_set += 1 + choice = FlowRSVPPathSessionExtTunnelIdChoice.AS_IPV4 + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPPathSessionExtTunnelIdChoice.AS_INTEGER) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathSessionExtTunnelId") + } + } else { + intVal := otg.FlowRSVPPathSessionExtTunnelId_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPPathSessionExtTunnelId_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_path_session_lsp_tunnel_ipv4.go b/gosnappi/flow_rsvp_path_session_lsp_tunnel_ipv4.go new file mode 100644 index 00000000..22321254 --- /dev/null +++ b/gosnappi/flow_rsvp_path_session_lsp_tunnel_ipv4.go @@ -0,0 +1,457 @@ +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" +) + +// ***** FlowRSVPPathSessionLspTunnelIpv4 ***** +type flowRSVPPathSessionLspTunnelIpv4 struct { + validation + obj *otg.FlowRSVPPathSessionLspTunnelIpv4 + marshaller marshalFlowRSVPPathSessionLspTunnelIpv4 + unMarshaller unMarshalFlowRSVPPathSessionLspTunnelIpv4 + ipv4TunnelEndPointAddressHolder PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + reservedHolder PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + tunnelIdHolder PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + extendedTunnelIdHolder FlowRSVPPathSessionExtTunnelId +} + +func NewFlowRSVPPathSessionLspTunnelIpv4() FlowRSVPPathSessionLspTunnelIpv4 { + obj := flowRSVPPathSessionLspTunnelIpv4{obj: &otg.FlowRSVPPathSessionLspTunnelIpv4{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathSessionLspTunnelIpv4) msg() *otg.FlowRSVPPathSessionLspTunnelIpv4 { + return obj.obj +} + +func (obj *flowRSVPPathSessionLspTunnelIpv4) setMsg(msg *otg.FlowRSVPPathSessionLspTunnelIpv4) FlowRSVPPathSessionLspTunnelIpv4 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathSessionLspTunnelIpv4 struct { + obj *flowRSVPPathSessionLspTunnelIpv4 +} + +type marshalFlowRSVPPathSessionLspTunnelIpv4 interface { + // ToProto marshals FlowRSVPPathSessionLspTunnelIpv4 to protobuf object *otg.FlowRSVPPathSessionLspTunnelIpv4 + ToProto() (*otg.FlowRSVPPathSessionLspTunnelIpv4, error) + // ToPbText marshals FlowRSVPPathSessionLspTunnelIpv4 to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathSessionLspTunnelIpv4 to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathSessionLspTunnelIpv4 to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathSessionLspTunnelIpv4 struct { + obj *flowRSVPPathSessionLspTunnelIpv4 +} + +type unMarshalFlowRSVPPathSessionLspTunnelIpv4 interface { + // FromProto unmarshals FlowRSVPPathSessionLspTunnelIpv4 from protobuf object *otg.FlowRSVPPathSessionLspTunnelIpv4 + FromProto(msg *otg.FlowRSVPPathSessionLspTunnelIpv4) (FlowRSVPPathSessionLspTunnelIpv4, error) + // FromPbText unmarshals FlowRSVPPathSessionLspTunnelIpv4 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathSessionLspTunnelIpv4 from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathSessionLspTunnelIpv4 from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathSessionLspTunnelIpv4) Marshal() marshalFlowRSVPPathSessionLspTunnelIpv4 { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathSessionLspTunnelIpv4{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathSessionLspTunnelIpv4) Unmarshal() unMarshalFlowRSVPPathSessionLspTunnelIpv4 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathSessionLspTunnelIpv4{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathSessionLspTunnelIpv4) ToProto() (*otg.FlowRSVPPathSessionLspTunnelIpv4, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathSessionLspTunnelIpv4) FromProto(msg *otg.FlowRSVPPathSessionLspTunnelIpv4) (FlowRSVPPathSessionLspTunnelIpv4, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathSessionLspTunnelIpv4) 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 *unMarshalflowRSVPPathSessionLspTunnelIpv4) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathSessionLspTunnelIpv4) 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 *unMarshalflowRSVPPathSessionLspTunnelIpv4) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathSessionLspTunnelIpv4) 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 *unMarshalflowRSVPPathSessionLspTunnelIpv4) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathSessionLspTunnelIpv4) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathSessionLspTunnelIpv4) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathSessionLspTunnelIpv4) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathSessionLspTunnelIpv4) Clone() (FlowRSVPPathSessionLspTunnelIpv4, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathSessionLspTunnelIpv4() + 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 +} + +func (obj *flowRSVPPathSessionLspTunnelIpv4) setNil() { + obj.ipv4TunnelEndPointAddressHolder = nil + obj.reservedHolder = nil + obj.tunnelIdHolder = nil + obj.extendedTunnelIdHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathSessionLspTunnelIpv4 is class = SESSION, LSP_TUNNEL_IPv4 C-Type = 7. +type FlowRSVPPathSessionLspTunnelIpv4 interface { + Validation + // msg marshals FlowRSVPPathSessionLspTunnelIpv4 to protobuf object *otg.FlowRSVPPathSessionLspTunnelIpv4 + // and doesn't set defaults + msg() *otg.FlowRSVPPathSessionLspTunnelIpv4 + // setMsg unmarshals FlowRSVPPathSessionLspTunnelIpv4 from protobuf object *otg.FlowRSVPPathSessionLspTunnelIpv4 + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathSessionLspTunnelIpv4) FlowRSVPPathSessionLspTunnelIpv4 + // provides marshal interface + Marshal() marshalFlowRSVPPathSessionLspTunnelIpv4 + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathSessionLspTunnelIpv4 + // validate validates FlowRSVPPathSessionLspTunnelIpv4 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathSessionLspTunnelIpv4, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv4TunnelEndPointAddress returns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress, set in FlowRSVPPathSessionLspTunnelIpv4. + // PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress is iPv4 address of the egress node for the tunnel. + Ipv4TunnelEndPointAddress() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + // SetIpv4TunnelEndPointAddress assigns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress provided by user to FlowRSVPPathSessionLspTunnelIpv4. + // PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress is iPv4 address of the egress node for the tunnel. + SetIpv4TunnelEndPointAddress(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) FlowRSVPPathSessionLspTunnelIpv4 + // HasIpv4TunnelEndPointAddress checks if Ipv4TunnelEndPointAddress has been set in FlowRSVPPathSessionLspTunnelIpv4 + HasIpv4TunnelEndPointAddress() bool + // Reserved returns PatternFlowRSVPPathSessionLspTunnelIpv4Reserved, set in FlowRSVPPathSessionLspTunnelIpv4. + // PatternFlowRSVPPathSessionLspTunnelIpv4Reserved is reserved field, MUST be zero. + Reserved() PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + // SetReserved assigns PatternFlowRSVPPathSessionLspTunnelIpv4Reserved provided by user to FlowRSVPPathSessionLspTunnelIpv4. + // PatternFlowRSVPPathSessionLspTunnelIpv4Reserved is reserved field, MUST be zero. + SetReserved(value PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) FlowRSVPPathSessionLspTunnelIpv4 + // HasReserved checks if Reserved has been set in FlowRSVPPathSessionLspTunnelIpv4 + HasReserved() bool + // TunnelId returns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId, set in FlowRSVPPathSessionLspTunnelIpv4. + // PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId is a 16-bit identifier used in the SESSION that remains constant over the life of the tunnel. + TunnelId() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + // SetTunnelId assigns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId provided by user to FlowRSVPPathSessionLspTunnelIpv4. + // PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId is a 16-bit identifier used in the SESSION that remains constant over the life of the tunnel. + SetTunnelId(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) FlowRSVPPathSessionLspTunnelIpv4 + // HasTunnelId checks if TunnelId has been set in FlowRSVPPathSessionLspTunnelIpv4 + HasTunnelId() bool + // ExtendedTunnelId returns FlowRSVPPathSessionExtTunnelId, set in FlowRSVPPathSessionLspTunnelIpv4. + // FlowRSVPPathSessionExtTunnelId is description is TBD + ExtendedTunnelId() FlowRSVPPathSessionExtTunnelId + // SetExtendedTunnelId assigns FlowRSVPPathSessionExtTunnelId provided by user to FlowRSVPPathSessionLspTunnelIpv4. + // FlowRSVPPathSessionExtTunnelId is description is TBD + SetExtendedTunnelId(value FlowRSVPPathSessionExtTunnelId) FlowRSVPPathSessionLspTunnelIpv4 + // HasExtendedTunnelId checks if ExtendedTunnelId has been set in FlowRSVPPathSessionLspTunnelIpv4 + HasExtendedTunnelId() bool + setNil() +} + +// description is TBD +// Ipv4TunnelEndPointAddress returns a PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress +func (obj *flowRSVPPathSessionLspTunnelIpv4) Ipv4TunnelEndPointAddress() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { + if obj.obj.Ipv4TunnelEndPointAddress == nil { + obj.obj.Ipv4TunnelEndPointAddress = NewPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress().msg() + } + if obj.ipv4TunnelEndPointAddressHolder == nil { + obj.ipv4TunnelEndPointAddressHolder = &patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress{obj: obj.obj.Ipv4TunnelEndPointAddress} + } + return obj.ipv4TunnelEndPointAddressHolder +} + +// description is TBD +// Ipv4TunnelEndPointAddress returns a PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress +func (obj *flowRSVPPathSessionLspTunnelIpv4) HasIpv4TunnelEndPointAddress() bool { + return obj.obj.Ipv4TunnelEndPointAddress != nil +} + +// description is TBD +// SetIpv4TunnelEndPointAddress sets the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress value in the FlowRSVPPathSessionLspTunnelIpv4 object +func (obj *flowRSVPPathSessionLspTunnelIpv4) SetIpv4TunnelEndPointAddress(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) FlowRSVPPathSessionLspTunnelIpv4 { + + obj.ipv4TunnelEndPointAddressHolder = nil + obj.obj.Ipv4TunnelEndPointAddress = value.msg() + + return obj +} + +// description is TBD +// Reserved returns a PatternFlowRSVPPathSessionLspTunnelIpv4Reserved +func (obj *flowRSVPPathSessionLspTunnelIpv4) Reserved() PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { + if obj.obj.Reserved == nil { + obj.obj.Reserved = NewPatternFlowRSVPPathSessionLspTunnelIpv4Reserved().msg() + } + if obj.reservedHolder == nil { + obj.reservedHolder = &patternFlowRSVPPathSessionLspTunnelIpv4Reserved{obj: obj.obj.Reserved} + } + return obj.reservedHolder +} + +// description is TBD +// Reserved returns a PatternFlowRSVPPathSessionLspTunnelIpv4Reserved +func (obj *flowRSVPPathSessionLspTunnelIpv4) HasReserved() bool { + return obj.obj.Reserved != nil +} + +// description is TBD +// SetReserved sets the PatternFlowRSVPPathSessionLspTunnelIpv4Reserved value in the FlowRSVPPathSessionLspTunnelIpv4 object +func (obj *flowRSVPPathSessionLspTunnelIpv4) SetReserved(value PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) FlowRSVPPathSessionLspTunnelIpv4 { + + obj.reservedHolder = nil + obj.obj.Reserved = value.msg() + + return obj +} + +// description is TBD +// TunnelId returns a PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId +func (obj *flowRSVPPathSessionLspTunnelIpv4) TunnelId() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { + if obj.obj.TunnelId == nil { + obj.obj.TunnelId = NewPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId().msg() + } + if obj.tunnelIdHolder == nil { + obj.tunnelIdHolder = &patternFlowRSVPPathSessionLspTunnelIpv4TunnelId{obj: obj.obj.TunnelId} + } + return obj.tunnelIdHolder +} + +// description is TBD +// TunnelId returns a PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId +func (obj *flowRSVPPathSessionLspTunnelIpv4) HasTunnelId() bool { + return obj.obj.TunnelId != nil +} + +// description is TBD +// SetTunnelId sets the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId value in the FlowRSVPPathSessionLspTunnelIpv4 object +func (obj *flowRSVPPathSessionLspTunnelIpv4) SetTunnelId(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) FlowRSVPPathSessionLspTunnelIpv4 { + + obj.tunnelIdHolder = nil + obj.obj.TunnelId = value.msg() + + return obj +} + +// A 32-bit identifier used in the SESSION that remains constant over the life of the tunnel. Normally set to all zeros. Ingress nodes that wish to narrow the scope of a SESSION to the ingress-egress pair may place their IPv4 address here as a globally unique identifier. +// ExtendedTunnelId returns a FlowRSVPPathSessionExtTunnelId +func (obj *flowRSVPPathSessionLspTunnelIpv4) ExtendedTunnelId() FlowRSVPPathSessionExtTunnelId { + if obj.obj.ExtendedTunnelId == nil { + obj.obj.ExtendedTunnelId = NewFlowRSVPPathSessionExtTunnelId().msg() + } + if obj.extendedTunnelIdHolder == nil { + obj.extendedTunnelIdHolder = &flowRSVPPathSessionExtTunnelId{obj: obj.obj.ExtendedTunnelId} + } + return obj.extendedTunnelIdHolder +} + +// A 32-bit identifier used in the SESSION that remains constant over the life of the tunnel. Normally set to all zeros. Ingress nodes that wish to narrow the scope of a SESSION to the ingress-egress pair may place their IPv4 address here as a globally unique identifier. +// ExtendedTunnelId returns a FlowRSVPPathSessionExtTunnelId +func (obj *flowRSVPPathSessionLspTunnelIpv4) HasExtendedTunnelId() bool { + return obj.obj.ExtendedTunnelId != nil +} + +// A 32-bit identifier used in the SESSION that remains constant over the life of the tunnel. Normally set to all zeros. Ingress nodes that wish to narrow the scope of a SESSION to the ingress-egress pair may place their IPv4 address here as a globally unique identifier. +// SetExtendedTunnelId sets the FlowRSVPPathSessionExtTunnelId value in the FlowRSVPPathSessionLspTunnelIpv4 object +func (obj *flowRSVPPathSessionLspTunnelIpv4) SetExtendedTunnelId(value FlowRSVPPathSessionExtTunnelId) FlowRSVPPathSessionLspTunnelIpv4 { + + obj.extendedTunnelIdHolder = nil + obj.obj.ExtendedTunnelId = value.msg() + + return obj +} + +func (obj *flowRSVPPathSessionLspTunnelIpv4) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv4TunnelEndPointAddress != nil { + + obj.Ipv4TunnelEndPointAddress().validateObj(vObj, set_default) + } + + if obj.obj.Reserved != nil { + + obj.Reserved().validateObj(vObj, set_default) + } + + if obj.obj.TunnelId != nil { + + obj.TunnelId().validateObj(vObj, set_default) + } + + if obj.obj.ExtendedTunnelId != nil { + + obj.ExtendedTunnelId().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathSessionLspTunnelIpv4) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_path_time_values_type1.go b/gosnappi/flow_rsvp_path_time_values_type1.go new file mode 100644 index 00000000..217fac32 --- /dev/null +++ b/gosnappi/flow_rsvp_path_time_values_type1.go @@ -0,0 +1,328 @@ +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" +) + +// ***** FlowRSVPPathTimeValuesType1 ***** +type flowRSVPPathTimeValuesType1 struct { + validation + obj *otg.FlowRSVPPathTimeValuesType1 + marshaller marshalFlowRSVPPathTimeValuesType1 + unMarshaller unMarshalFlowRSVPPathTimeValuesType1 + refreshPeriodRHolder PatternFlowRSVPPathTimeValuesType1RefreshPeriodR +} + +func NewFlowRSVPPathTimeValuesType1() FlowRSVPPathTimeValuesType1 { + obj := flowRSVPPathTimeValuesType1{obj: &otg.FlowRSVPPathTimeValuesType1{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPPathTimeValuesType1) msg() *otg.FlowRSVPPathTimeValuesType1 { + return obj.obj +} + +func (obj *flowRSVPPathTimeValuesType1) setMsg(msg *otg.FlowRSVPPathTimeValuesType1) FlowRSVPPathTimeValuesType1 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPPathTimeValuesType1 struct { + obj *flowRSVPPathTimeValuesType1 +} + +type marshalFlowRSVPPathTimeValuesType1 interface { + // ToProto marshals FlowRSVPPathTimeValuesType1 to protobuf object *otg.FlowRSVPPathTimeValuesType1 + ToProto() (*otg.FlowRSVPPathTimeValuesType1, error) + // ToPbText marshals FlowRSVPPathTimeValuesType1 to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPPathTimeValuesType1 to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPPathTimeValuesType1 to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPPathTimeValuesType1 struct { + obj *flowRSVPPathTimeValuesType1 +} + +type unMarshalFlowRSVPPathTimeValuesType1 interface { + // FromProto unmarshals FlowRSVPPathTimeValuesType1 from protobuf object *otg.FlowRSVPPathTimeValuesType1 + FromProto(msg *otg.FlowRSVPPathTimeValuesType1) (FlowRSVPPathTimeValuesType1, error) + // FromPbText unmarshals FlowRSVPPathTimeValuesType1 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPPathTimeValuesType1 from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPPathTimeValuesType1 from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPPathTimeValuesType1) Marshal() marshalFlowRSVPPathTimeValuesType1 { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPPathTimeValuesType1{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPPathTimeValuesType1) Unmarshal() unMarshalFlowRSVPPathTimeValuesType1 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPPathTimeValuesType1{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPPathTimeValuesType1) ToProto() (*otg.FlowRSVPPathTimeValuesType1, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPPathTimeValuesType1) FromProto(msg *otg.FlowRSVPPathTimeValuesType1) (FlowRSVPPathTimeValuesType1, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPPathTimeValuesType1) 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 *unMarshalflowRSVPPathTimeValuesType1) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPPathTimeValuesType1) 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 *unMarshalflowRSVPPathTimeValuesType1) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPPathTimeValuesType1) 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 *unMarshalflowRSVPPathTimeValuesType1) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPPathTimeValuesType1) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPPathTimeValuesType1) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPPathTimeValuesType1) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPPathTimeValuesType1) Clone() (FlowRSVPPathTimeValuesType1, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPPathTimeValuesType1() + 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 +} + +func (obj *flowRSVPPathTimeValuesType1) setNil() { + obj.refreshPeriodRHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPPathTimeValuesType1 is tIME_VALUES Object: Class = 5, C-Type = 1 +type FlowRSVPPathTimeValuesType1 interface { + Validation + // msg marshals FlowRSVPPathTimeValuesType1 to protobuf object *otg.FlowRSVPPathTimeValuesType1 + // and doesn't set defaults + msg() *otg.FlowRSVPPathTimeValuesType1 + // setMsg unmarshals FlowRSVPPathTimeValuesType1 from protobuf object *otg.FlowRSVPPathTimeValuesType1 + // and doesn't set defaults + setMsg(*otg.FlowRSVPPathTimeValuesType1) FlowRSVPPathTimeValuesType1 + // provides marshal interface + Marshal() marshalFlowRSVPPathTimeValuesType1 + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPPathTimeValuesType1 + // validate validates FlowRSVPPathTimeValuesType1 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPPathTimeValuesType1, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RefreshPeriodR returns PatternFlowRSVPPathTimeValuesType1RefreshPeriodR, set in FlowRSVPPathTimeValuesType1. + // PatternFlowRSVPPathTimeValuesType1RefreshPeriodR is the refresh timeout period R used to generate this message;in milliseconds. + RefreshPeriodR() PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + // SetRefreshPeriodR assigns PatternFlowRSVPPathTimeValuesType1RefreshPeriodR provided by user to FlowRSVPPathTimeValuesType1. + // PatternFlowRSVPPathTimeValuesType1RefreshPeriodR is the refresh timeout period R used to generate this message;in milliseconds. + SetRefreshPeriodR(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) FlowRSVPPathTimeValuesType1 + // HasRefreshPeriodR checks if RefreshPeriodR has been set in FlowRSVPPathTimeValuesType1 + HasRefreshPeriodR() bool + setNil() +} + +// description is TBD +// RefreshPeriodR returns a PatternFlowRSVPPathTimeValuesType1RefreshPeriodR +func (obj *flowRSVPPathTimeValuesType1) RefreshPeriodR() PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { + if obj.obj.RefreshPeriodR == nil { + obj.obj.RefreshPeriodR = NewPatternFlowRSVPPathTimeValuesType1RefreshPeriodR().msg() + } + if obj.refreshPeriodRHolder == nil { + obj.refreshPeriodRHolder = &patternFlowRSVPPathTimeValuesType1RefreshPeriodR{obj: obj.obj.RefreshPeriodR} + } + return obj.refreshPeriodRHolder +} + +// description is TBD +// RefreshPeriodR returns a PatternFlowRSVPPathTimeValuesType1RefreshPeriodR +func (obj *flowRSVPPathTimeValuesType1) HasRefreshPeriodR() bool { + return obj.obj.RefreshPeriodR != nil +} + +// description is TBD +// SetRefreshPeriodR sets the PatternFlowRSVPPathTimeValuesType1RefreshPeriodR value in the FlowRSVPPathTimeValuesType1 object +func (obj *flowRSVPPathTimeValuesType1) SetRefreshPeriodR(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) FlowRSVPPathTimeValuesType1 { + + obj.refreshPeriodRHolder = nil + obj.obj.RefreshPeriodR = value.msg() + + return obj +} + +func (obj *flowRSVPPathTimeValuesType1) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RefreshPeriodR != nil { + + obj.RefreshPeriodR().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPPathTimeValuesType1) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_record_route_i_pv4_flag.go b/gosnappi/flow_rsvp_record_route_i_pv4_flag.go new file mode 100644 index 00000000..8ec9fad0 --- /dev/null +++ b/gosnappi/flow_rsvp_record_route_i_pv4_flag.go @@ -0,0 +1,351 @@ +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" +) + +// ***** FlowRSVPRecordRouteIPv4Flag ***** +type flowRSVPRecordRouteIPv4Flag struct { + validation + obj *otg.FlowRSVPRecordRouteIPv4Flag + marshaller marshalFlowRSVPRecordRouteIPv4Flag + unMarshaller unMarshalFlowRSVPRecordRouteIPv4Flag +} + +func NewFlowRSVPRecordRouteIPv4Flag() FlowRSVPRecordRouteIPv4Flag { + obj := flowRSVPRecordRouteIPv4Flag{obj: &otg.FlowRSVPRecordRouteIPv4Flag{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPRecordRouteIPv4Flag) msg() *otg.FlowRSVPRecordRouteIPv4Flag { + return obj.obj +} + +func (obj *flowRSVPRecordRouteIPv4Flag) setMsg(msg *otg.FlowRSVPRecordRouteIPv4Flag) FlowRSVPRecordRouteIPv4Flag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPRecordRouteIPv4Flag struct { + obj *flowRSVPRecordRouteIPv4Flag +} + +type marshalFlowRSVPRecordRouteIPv4Flag interface { + // ToProto marshals FlowRSVPRecordRouteIPv4Flag to protobuf object *otg.FlowRSVPRecordRouteIPv4Flag + ToProto() (*otg.FlowRSVPRecordRouteIPv4Flag, error) + // ToPbText marshals FlowRSVPRecordRouteIPv4Flag to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPRecordRouteIPv4Flag to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPRecordRouteIPv4Flag to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPRecordRouteIPv4Flag struct { + obj *flowRSVPRecordRouteIPv4Flag +} + +type unMarshalFlowRSVPRecordRouteIPv4Flag interface { + // FromProto unmarshals FlowRSVPRecordRouteIPv4Flag from protobuf object *otg.FlowRSVPRecordRouteIPv4Flag + FromProto(msg *otg.FlowRSVPRecordRouteIPv4Flag) (FlowRSVPRecordRouteIPv4Flag, error) + // FromPbText unmarshals FlowRSVPRecordRouteIPv4Flag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPRecordRouteIPv4Flag from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPRecordRouteIPv4Flag from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPRecordRouteIPv4Flag) Marshal() marshalFlowRSVPRecordRouteIPv4Flag { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPRecordRouteIPv4Flag{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPRecordRouteIPv4Flag) Unmarshal() unMarshalFlowRSVPRecordRouteIPv4Flag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPRecordRouteIPv4Flag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPRecordRouteIPv4Flag) ToProto() (*otg.FlowRSVPRecordRouteIPv4Flag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPRecordRouteIPv4Flag) FromProto(msg *otg.FlowRSVPRecordRouteIPv4Flag) (FlowRSVPRecordRouteIPv4Flag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPRecordRouteIPv4Flag) 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 *unMarshalflowRSVPRecordRouteIPv4Flag) 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 *marshalflowRSVPRecordRouteIPv4Flag) 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 *unMarshalflowRSVPRecordRouteIPv4Flag) 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 *marshalflowRSVPRecordRouteIPv4Flag) 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 *unMarshalflowRSVPRecordRouteIPv4Flag) 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 *flowRSVPRecordRouteIPv4Flag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPRecordRouteIPv4Flag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPRecordRouteIPv4Flag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPRecordRouteIPv4Flag) Clone() (FlowRSVPRecordRouteIPv4Flag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPRecordRouteIPv4Flag() + 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 +} + +// FlowRSVPRecordRouteIPv4Flag is description is TBD +type FlowRSVPRecordRouteIPv4Flag interface { + Validation + // msg marshals FlowRSVPRecordRouteIPv4Flag to protobuf object *otg.FlowRSVPRecordRouteIPv4Flag + // and doesn't set defaults + msg() *otg.FlowRSVPRecordRouteIPv4Flag + // setMsg unmarshals FlowRSVPRecordRouteIPv4Flag from protobuf object *otg.FlowRSVPRecordRouteIPv4Flag + // and doesn't set defaults + setMsg(*otg.FlowRSVPRecordRouteIPv4Flag) FlowRSVPRecordRouteIPv4Flag + // provides marshal interface + Marshal() marshalFlowRSVPRecordRouteIPv4Flag + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPRecordRouteIPv4Flag + // validate validates FlowRSVPRecordRouteIPv4Flag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPRecordRouteIPv4Flag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPRecordRouteIPv4FlagChoiceEnum, set in FlowRSVPRecordRouteIPv4Flag + Choice() FlowRSVPRecordRouteIPv4FlagChoiceEnum + // setChoice assigns FlowRSVPRecordRouteIPv4FlagChoiceEnum provided by user to FlowRSVPRecordRouteIPv4Flag + setChoice(value FlowRSVPRecordRouteIPv4FlagChoiceEnum) FlowRSVPRecordRouteIPv4Flag + // HasChoice checks if Choice has been set in FlowRSVPRecordRouteIPv4Flag + HasChoice() bool + // getter for LocalProtectionAvailable to set choice. + LocalProtectionAvailable() + // getter for LocalProtectionInUse to set choice. + LocalProtectionInUse() +} + +type FlowRSVPRecordRouteIPv4FlagChoiceEnum string + +// Enum of Choice on FlowRSVPRecordRouteIPv4Flag +var FlowRSVPRecordRouteIPv4FlagChoice = struct { + LOCAL_PROTECTION_AVAILABLE FlowRSVPRecordRouteIPv4FlagChoiceEnum + LOCAL_PROTECTION_IN_USE FlowRSVPRecordRouteIPv4FlagChoiceEnum +}{ + LOCAL_PROTECTION_AVAILABLE: FlowRSVPRecordRouteIPv4FlagChoiceEnum("local_protection_available"), + LOCAL_PROTECTION_IN_USE: FlowRSVPRecordRouteIPv4FlagChoiceEnum("local_protection_in_use"), +} + +func (obj *flowRSVPRecordRouteIPv4Flag) Choice() FlowRSVPRecordRouteIPv4FlagChoiceEnum { + return FlowRSVPRecordRouteIPv4FlagChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// 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 { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPRecordRouteIPv4Flag) setChoice(value FlowRSVPRecordRouteIPv4FlagChoiceEnum) FlowRSVPRecordRouteIPv4Flag { + intValue, ok := otg.FlowRSVPRecordRouteIPv4Flag_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPRecordRouteIPv4FlagChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPRecordRouteIPv4Flag_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + + return obj +} + +func (obj *flowRSVPRecordRouteIPv4Flag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *flowRSVPRecordRouteIPv4Flag) setDefault() { + var choices_set int = 0 + var choice FlowRSVPRecordRouteIPv4FlagChoiceEnum + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPRecordRouteIPv4FlagChoice.LOCAL_PROTECTION_AVAILABLE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPRecordRouteIPv4Flag") + } + } else { + intVal := otg.FlowRSVPRecordRouteIPv4Flag_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPRecordRouteIPv4Flag_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_route_record_length.go b/gosnappi/flow_rsvp_route_record_length.go new file mode 100644 index 00000000..d7a05279 --- /dev/null +++ b/gosnappi/flow_rsvp_route_record_length.go @@ -0,0 +1,423 @@ +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" +) + +// ***** FlowRSVPRouteRecordLength ***** +type flowRSVPRouteRecordLength struct { + validation + obj *otg.FlowRSVPRouteRecordLength + marshaller marshalFlowRSVPRouteRecordLength + unMarshaller unMarshalFlowRSVPRouteRecordLength +} + +func NewFlowRSVPRouteRecordLength() FlowRSVPRouteRecordLength { + obj := flowRSVPRouteRecordLength{obj: &otg.FlowRSVPRouteRecordLength{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPRouteRecordLength) msg() *otg.FlowRSVPRouteRecordLength { + return obj.obj +} + +func (obj *flowRSVPRouteRecordLength) setMsg(msg *otg.FlowRSVPRouteRecordLength) FlowRSVPRouteRecordLength { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPRouteRecordLength struct { + obj *flowRSVPRouteRecordLength +} + +type marshalFlowRSVPRouteRecordLength interface { + // ToProto marshals FlowRSVPRouteRecordLength to protobuf object *otg.FlowRSVPRouteRecordLength + ToProto() (*otg.FlowRSVPRouteRecordLength, error) + // ToPbText marshals FlowRSVPRouteRecordLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPRouteRecordLength to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPRouteRecordLength to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPRouteRecordLength struct { + obj *flowRSVPRouteRecordLength +} + +type unMarshalFlowRSVPRouteRecordLength interface { + // FromProto unmarshals FlowRSVPRouteRecordLength from protobuf object *otg.FlowRSVPRouteRecordLength + FromProto(msg *otg.FlowRSVPRouteRecordLength) (FlowRSVPRouteRecordLength, error) + // FromPbText unmarshals FlowRSVPRouteRecordLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPRouteRecordLength from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPRouteRecordLength from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPRouteRecordLength) Marshal() marshalFlowRSVPRouteRecordLength { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPRouteRecordLength{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPRouteRecordLength) Unmarshal() unMarshalFlowRSVPRouteRecordLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPRouteRecordLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPRouteRecordLength) ToProto() (*otg.FlowRSVPRouteRecordLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPRouteRecordLength) FromProto(msg *otg.FlowRSVPRouteRecordLength) (FlowRSVPRouteRecordLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPRouteRecordLength) 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 *unMarshalflowRSVPRouteRecordLength) 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 *marshalflowRSVPRouteRecordLength) 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 *unMarshalflowRSVPRouteRecordLength) 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 *marshalflowRSVPRouteRecordLength) 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 *unMarshalflowRSVPRouteRecordLength) 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 *flowRSVPRouteRecordLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPRouteRecordLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPRouteRecordLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPRouteRecordLength) Clone() (FlowRSVPRouteRecordLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPRouteRecordLength() + 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 +} + +// FlowRSVPRouteRecordLength is description is TBD +type FlowRSVPRouteRecordLength interface { + Validation + // msg marshals FlowRSVPRouteRecordLength to protobuf object *otg.FlowRSVPRouteRecordLength + // and doesn't set defaults + msg() *otg.FlowRSVPRouteRecordLength + // setMsg unmarshals FlowRSVPRouteRecordLength from protobuf object *otg.FlowRSVPRouteRecordLength + // and doesn't set defaults + setMsg(*otg.FlowRSVPRouteRecordLength) FlowRSVPRouteRecordLength + // provides marshal interface + Marshal() marshalFlowRSVPRouteRecordLength + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPRouteRecordLength + // validate validates FlowRSVPRouteRecordLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPRouteRecordLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPRouteRecordLengthChoiceEnum, set in FlowRSVPRouteRecordLength + Choice() FlowRSVPRouteRecordLengthChoiceEnum + // setChoice assigns FlowRSVPRouteRecordLengthChoiceEnum provided by user to FlowRSVPRouteRecordLength + setChoice(value FlowRSVPRouteRecordLengthChoiceEnum) FlowRSVPRouteRecordLength + // HasChoice checks if Choice has been set in FlowRSVPRouteRecordLength + HasChoice() bool + // Auto returns uint32, set in FlowRSVPRouteRecordLength. + Auto() uint32 + // HasAuto checks if Auto has been set in FlowRSVPRouteRecordLength + HasAuto() bool + // Value returns uint32, set in FlowRSVPRouteRecordLength. + Value() uint32 + // SetValue assigns uint32 provided by user to FlowRSVPRouteRecordLength + SetValue(value uint32) FlowRSVPRouteRecordLength + // HasValue checks if Value has been set in FlowRSVPRouteRecordLength + HasValue() bool +} + +type FlowRSVPRouteRecordLengthChoiceEnum string + +// Enum of Choice on FlowRSVPRouteRecordLength +var FlowRSVPRouteRecordLengthChoice = struct { + AUTO FlowRSVPRouteRecordLengthChoiceEnum + VALUE FlowRSVPRouteRecordLengthChoiceEnum +}{ + AUTO: FlowRSVPRouteRecordLengthChoiceEnum("auto"), + VALUE: FlowRSVPRouteRecordLengthChoiceEnum("value"), +} + +func (obj *flowRSVPRouteRecordLength) Choice() FlowRSVPRouteRecordLengthChoiceEnum { + return FlowRSVPRouteRecordLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// auto or configured value. +// Choice returns a string +func (obj *flowRSVPRouteRecordLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPRouteRecordLength) setChoice(value FlowRSVPRouteRecordLengthChoiceEnum) FlowRSVPRouteRecordLength { + intValue, ok := otg.FlowRSVPRouteRecordLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPRouteRecordLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPRouteRecordLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Value = nil + obj.obj.Auto = nil + + if value == FlowRSVPRouteRecordLengthChoice.AUTO { + defaultValue := uint32(8) + obj.obj.Auto = &defaultValue + } + + if value == FlowRSVPRouteRecordLengthChoice.VALUE { + defaultValue := uint32(8) + obj.obj.Value = &defaultValue + } + + return obj +} + +// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. +// Auto returns a uint32 +func (obj *flowRSVPRouteRecordLength) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(FlowRSVPRouteRecordLengthChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. +// Auto returns a uint32 +func (obj *flowRSVPRouteRecordLength) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Value returns a uint32 +func (obj *flowRSVPRouteRecordLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(FlowRSVPRouteRecordLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *flowRSVPRouteRecordLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the FlowRSVPRouteRecordLength object +func (obj *flowRSVPRouteRecordLength) SetValue(value uint32) FlowRSVPRouteRecordLength { + obj.setChoice(FlowRSVPRouteRecordLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +func (obj *flowRSVPRouteRecordLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowRSVPRouteRecordLength.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + +} + +func (obj *flowRSVPRouteRecordLength) setDefault() { + var choices_set int = 0 + var choice FlowRSVPRouteRecordLengthChoiceEnum + + if obj.obj.Auto != nil { + choices_set += 1 + choice = FlowRSVPRouteRecordLengthChoice.AUTO + } + + if obj.obj.Value != nil { + choices_set += 1 + choice = FlowRSVPRouteRecordLengthChoice.VALUE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPRouteRecordLengthChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPRouteRecordLength") + } + } else { + intVal := otg.FlowRSVPRouteRecordLength_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPRouteRecordLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_session_attribute_name_length.go b/gosnappi/flow_rsvp_session_attribute_name_length.go new file mode 100644 index 00000000..cf2b608b --- /dev/null +++ b/gosnappi/flow_rsvp_session_attribute_name_length.go @@ -0,0 +1,423 @@ +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" +) + +// ***** FlowRSVPSessionAttributeNameLength ***** +type flowRSVPSessionAttributeNameLength struct { + validation + obj *otg.FlowRSVPSessionAttributeNameLength + marshaller marshalFlowRSVPSessionAttributeNameLength + unMarshaller unMarshalFlowRSVPSessionAttributeNameLength +} + +func NewFlowRSVPSessionAttributeNameLength() FlowRSVPSessionAttributeNameLength { + obj := flowRSVPSessionAttributeNameLength{obj: &otg.FlowRSVPSessionAttributeNameLength{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPSessionAttributeNameLength) msg() *otg.FlowRSVPSessionAttributeNameLength { + return obj.obj +} + +func (obj *flowRSVPSessionAttributeNameLength) setMsg(msg *otg.FlowRSVPSessionAttributeNameLength) FlowRSVPSessionAttributeNameLength { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPSessionAttributeNameLength struct { + obj *flowRSVPSessionAttributeNameLength +} + +type marshalFlowRSVPSessionAttributeNameLength interface { + // ToProto marshals FlowRSVPSessionAttributeNameLength to protobuf object *otg.FlowRSVPSessionAttributeNameLength + ToProto() (*otg.FlowRSVPSessionAttributeNameLength, error) + // ToPbText marshals FlowRSVPSessionAttributeNameLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPSessionAttributeNameLength to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPSessionAttributeNameLength to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPSessionAttributeNameLength struct { + obj *flowRSVPSessionAttributeNameLength +} + +type unMarshalFlowRSVPSessionAttributeNameLength interface { + // FromProto unmarshals FlowRSVPSessionAttributeNameLength from protobuf object *otg.FlowRSVPSessionAttributeNameLength + FromProto(msg *otg.FlowRSVPSessionAttributeNameLength) (FlowRSVPSessionAttributeNameLength, error) + // FromPbText unmarshals FlowRSVPSessionAttributeNameLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPSessionAttributeNameLength from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPSessionAttributeNameLength from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPSessionAttributeNameLength) Marshal() marshalFlowRSVPSessionAttributeNameLength { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPSessionAttributeNameLength{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPSessionAttributeNameLength) Unmarshal() unMarshalFlowRSVPSessionAttributeNameLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPSessionAttributeNameLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPSessionAttributeNameLength) ToProto() (*otg.FlowRSVPSessionAttributeNameLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPSessionAttributeNameLength) FromProto(msg *otg.FlowRSVPSessionAttributeNameLength) (FlowRSVPSessionAttributeNameLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPSessionAttributeNameLength) 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 *unMarshalflowRSVPSessionAttributeNameLength) 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 *marshalflowRSVPSessionAttributeNameLength) 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 *unMarshalflowRSVPSessionAttributeNameLength) 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 *marshalflowRSVPSessionAttributeNameLength) 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 *unMarshalflowRSVPSessionAttributeNameLength) 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 *flowRSVPSessionAttributeNameLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPSessionAttributeNameLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPSessionAttributeNameLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPSessionAttributeNameLength) Clone() (FlowRSVPSessionAttributeNameLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPSessionAttributeNameLength() + 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 +} + +// FlowRSVPSessionAttributeNameLength is description is TBD +type FlowRSVPSessionAttributeNameLength interface { + Validation + // msg marshals FlowRSVPSessionAttributeNameLength to protobuf object *otg.FlowRSVPSessionAttributeNameLength + // and doesn't set defaults + msg() *otg.FlowRSVPSessionAttributeNameLength + // setMsg unmarshals FlowRSVPSessionAttributeNameLength from protobuf object *otg.FlowRSVPSessionAttributeNameLength + // and doesn't set defaults + setMsg(*otg.FlowRSVPSessionAttributeNameLength) FlowRSVPSessionAttributeNameLength + // provides marshal interface + Marshal() marshalFlowRSVPSessionAttributeNameLength + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPSessionAttributeNameLength + // validate validates FlowRSVPSessionAttributeNameLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPSessionAttributeNameLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPSessionAttributeNameLengthChoiceEnum, set in FlowRSVPSessionAttributeNameLength + Choice() FlowRSVPSessionAttributeNameLengthChoiceEnum + // setChoice assigns FlowRSVPSessionAttributeNameLengthChoiceEnum provided by user to FlowRSVPSessionAttributeNameLength + setChoice(value FlowRSVPSessionAttributeNameLengthChoiceEnum) FlowRSVPSessionAttributeNameLength + // HasChoice checks if Choice has been set in FlowRSVPSessionAttributeNameLength + HasChoice() bool + // Auto returns uint32, set in FlowRSVPSessionAttributeNameLength. + Auto() uint32 + // HasAuto checks if Auto has been set in FlowRSVPSessionAttributeNameLength + HasAuto() bool + // Value returns uint32, set in FlowRSVPSessionAttributeNameLength. + Value() uint32 + // SetValue assigns uint32 provided by user to FlowRSVPSessionAttributeNameLength + SetValue(value uint32) FlowRSVPSessionAttributeNameLength + // HasValue checks if Value has been set in FlowRSVPSessionAttributeNameLength + HasValue() bool +} + +type FlowRSVPSessionAttributeNameLengthChoiceEnum string + +// Enum of Choice on FlowRSVPSessionAttributeNameLength +var FlowRSVPSessionAttributeNameLengthChoice = struct { + AUTO FlowRSVPSessionAttributeNameLengthChoiceEnum + VALUE FlowRSVPSessionAttributeNameLengthChoiceEnum +}{ + AUTO: FlowRSVPSessionAttributeNameLengthChoiceEnum("auto"), + VALUE: FlowRSVPSessionAttributeNameLengthChoiceEnum("value"), +} + +func (obj *flowRSVPSessionAttributeNameLength) Choice() FlowRSVPSessionAttributeNameLengthChoiceEnum { + return FlowRSVPSessionAttributeNameLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// auto or configured value. +// Choice returns a string +func (obj *flowRSVPSessionAttributeNameLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPSessionAttributeNameLength) setChoice(value FlowRSVPSessionAttributeNameLengthChoiceEnum) FlowRSVPSessionAttributeNameLength { + intValue, ok := otg.FlowRSVPSessionAttributeNameLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPSessionAttributeNameLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPSessionAttributeNameLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Value = nil + obj.obj.Auto = nil + + if value == FlowRSVPSessionAttributeNameLengthChoice.AUTO { + defaultValue := uint32(0) + obj.obj.Auto = &defaultValue + } + + if value == FlowRSVPSessionAttributeNameLengthChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + return obj +} + +// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. +// Auto returns a uint32 +func (obj *flowRSVPSessionAttributeNameLength) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(FlowRSVPSessionAttributeNameLengthChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. +// Auto returns a uint32 +func (obj *flowRSVPSessionAttributeNameLength) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Value returns a uint32 +func (obj *flowRSVPSessionAttributeNameLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(FlowRSVPSessionAttributeNameLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *flowRSVPSessionAttributeNameLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the FlowRSVPSessionAttributeNameLength object +func (obj *flowRSVPSessionAttributeNameLength) SetValue(value uint32) FlowRSVPSessionAttributeNameLength { + obj.setChoice(FlowRSVPSessionAttributeNameLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +func (obj *flowRSVPSessionAttributeNameLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= FlowRSVPSessionAttributeNameLength.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + +} + +func (obj *flowRSVPSessionAttributeNameLength) setDefault() { + var choices_set int = 0 + var choice FlowRSVPSessionAttributeNameLengthChoiceEnum + + if obj.obj.Auto != nil { + choices_set += 1 + choice = FlowRSVPSessionAttributeNameLengthChoice.AUTO + } + + if obj.obj.Value != nil { + choices_set += 1 + choice = FlowRSVPSessionAttributeNameLengthChoice.VALUE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPSessionAttributeNameLengthChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPSessionAttributeNameLength") + } + } else { + intVal := otg.FlowRSVPSessionAttributeNameLength_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPSessionAttributeNameLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_type1_explicit_route_subobjects.go b/gosnappi/flow_rsvp_type1_explicit_route_subobjects.go new file mode 100644 index 00000000..597b77b0 --- /dev/null +++ b/gosnappi/flow_rsvp_type1_explicit_route_subobjects.go @@ -0,0 +1,328 @@ +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" +) + +// ***** FlowRSVPType1ExplicitRouteSubobjects ***** +type flowRSVPType1ExplicitRouteSubobjects struct { + validation + obj *otg.FlowRSVPType1ExplicitRouteSubobjects + marshaller marshalFlowRSVPType1ExplicitRouteSubobjects + unMarshaller unMarshalFlowRSVPType1ExplicitRouteSubobjects + typeHolder FlowRSVPType1ExplicitRouteSubobjectsType +} + +func NewFlowRSVPType1ExplicitRouteSubobjects() FlowRSVPType1ExplicitRouteSubobjects { + obj := flowRSVPType1ExplicitRouteSubobjects{obj: &otg.FlowRSVPType1ExplicitRouteSubobjects{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPType1ExplicitRouteSubobjects) msg() *otg.FlowRSVPType1ExplicitRouteSubobjects { + return obj.obj +} + +func (obj *flowRSVPType1ExplicitRouteSubobjects) setMsg(msg *otg.FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPType1ExplicitRouteSubobjects { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPType1ExplicitRouteSubobjects struct { + obj *flowRSVPType1ExplicitRouteSubobjects +} + +type marshalFlowRSVPType1ExplicitRouteSubobjects interface { + // ToProto marshals FlowRSVPType1ExplicitRouteSubobjects to protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjects + ToProto() (*otg.FlowRSVPType1ExplicitRouteSubobjects, error) + // ToPbText marshals FlowRSVPType1ExplicitRouteSubobjects to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPType1ExplicitRouteSubobjects to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPType1ExplicitRouteSubobjects to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPType1ExplicitRouteSubobjects struct { + obj *flowRSVPType1ExplicitRouteSubobjects +} + +type unMarshalFlowRSVPType1ExplicitRouteSubobjects interface { + // FromProto unmarshals FlowRSVPType1ExplicitRouteSubobjects from protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjects + FromProto(msg *otg.FlowRSVPType1ExplicitRouteSubobjects) (FlowRSVPType1ExplicitRouteSubobjects, error) + // FromPbText unmarshals FlowRSVPType1ExplicitRouteSubobjects from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPType1ExplicitRouteSubobjects from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPType1ExplicitRouteSubobjects from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPType1ExplicitRouteSubobjects) Marshal() marshalFlowRSVPType1ExplicitRouteSubobjects { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPType1ExplicitRouteSubobjects{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPType1ExplicitRouteSubobjects) Unmarshal() unMarshalFlowRSVPType1ExplicitRouteSubobjects { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPType1ExplicitRouteSubobjects{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPType1ExplicitRouteSubobjects) ToProto() (*otg.FlowRSVPType1ExplicitRouteSubobjects, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPType1ExplicitRouteSubobjects) FromProto(msg *otg.FlowRSVPType1ExplicitRouteSubobjects) (FlowRSVPType1ExplicitRouteSubobjects, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPType1ExplicitRouteSubobjects) 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 *unMarshalflowRSVPType1ExplicitRouteSubobjects) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPType1ExplicitRouteSubobjects) 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 *unMarshalflowRSVPType1ExplicitRouteSubobjects) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPType1ExplicitRouteSubobjects) 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 *unMarshalflowRSVPType1ExplicitRouteSubobjects) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPType1ExplicitRouteSubobjects) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPType1ExplicitRouteSubobjects) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPType1ExplicitRouteSubobjects) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPType1ExplicitRouteSubobjects) Clone() (FlowRSVPType1ExplicitRouteSubobjects, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPType1ExplicitRouteSubobjects() + 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 +} + +func (obj *flowRSVPType1ExplicitRouteSubobjects) setNil() { + obj.typeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPType1ExplicitRouteSubobjects is type is specific to a subobject. +type FlowRSVPType1ExplicitRouteSubobjects interface { + Validation + // msg marshals FlowRSVPType1ExplicitRouteSubobjects to protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjects + // and doesn't set defaults + msg() *otg.FlowRSVPType1ExplicitRouteSubobjects + // setMsg unmarshals FlowRSVPType1ExplicitRouteSubobjects from protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjects + // and doesn't set defaults + setMsg(*otg.FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPType1ExplicitRouteSubobjects + // provides marshal interface + Marshal() marshalFlowRSVPType1ExplicitRouteSubobjects + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPType1ExplicitRouteSubobjects + // validate validates FlowRSVPType1ExplicitRouteSubobjects + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPType1ExplicitRouteSubobjects, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Type returns FlowRSVPType1ExplicitRouteSubobjectsType, set in FlowRSVPType1ExplicitRouteSubobjects. + // FlowRSVPType1ExplicitRouteSubobjectsType is currently supported subobjects are IPv4 address(1) and Autonomous system number(32). + Type() FlowRSVPType1ExplicitRouteSubobjectsType + // SetType assigns FlowRSVPType1ExplicitRouteSubobjectsType provided by user to FlowRSVPType1ExplicitRouteSubobjects. + // FlowRSVPType1ExplicitRouteSubobjectsType is currently supported subobjects are IPv4 address(1) and Autonomous system number(32). + SetType(value FlowRSVPType1ExplicitRouteSubobjectsType) FlowRSVPType1ExplicitRouteSubobjects + // HasType checks if Type has been set in FlowRSVPType1ExplicitRouteSubobjects + HasType() bool + setNil() +} + +// description is TBD +// Type returns a FlowRSVPType1ExplicitRouteSubobjectsType +func (obj *flowRSVPType1ExplicitRouteSubobjects) Type() FlowRSVPType1ExplicitRouteSubobjectsType { + if obj.obj.Type == nil { + obj.obj.Type = NewFlowRSVPType1ExplicitRouteSubobjectsType().msg() + } + if obj.typeHolder == nil { + obj.typeHolder = &flowRSVPType1ExplicitRouteSubobjectsType{obj: obj.obj.Type} + } + return obj.typeHolder +} + +// description is TBD +// Type returns a FlowRSVPType1ExplicitRouteSubobjectsType +func (obj *flowRSVPType1ExplicitRouteSubobjects) HasType() bool { + return obj.obj.Type != nil +} + +// description is TBD +// SetType sets the FlowRSVPType1ExplicitRouteSubobjectsType value in the FlowRSVPType1ExplicitRouteSubobjects object +func (obj *flowRSVPType1ExplicitRouteSubobjects) SetType(value FlowRSVPType1ExplicitRouteSubobjectsType) FlowRSVPType1ExplicitRouteSubobjects { + + obj.typeHolder = nil + obj.obj.Type = value.msg() + + return obj +} + +func (obj *flowRSVPType1ExplicitRouteSubobjects) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Type != nil { + + obj.Type().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPType1ExplicitRouteSubobjects) setDefault() { + +} diff --git a/gosnappi/flow_rsvp_type1_explicit_route_subobjects_type.go b/gosnappi/flow_rsvp_type1_explicit_route_subobjects_type.go new file mode 100644 index 00000000..4dd6d7af --- /dev/null +++ b/gosnappi/flow_rsvp_type1_explicit_route_subobjects_type.go @@ -0,0 +1,452 @@ +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" +) + +// ***** FlowRSVPType1ExplicitRouteSubobjectsType ***** +type flowRSVPType1ExplicitRouteSubobjectsType struct { + validation + obj *otg.FlowRSVPType1ExplicitRouteSubobjectsType + marshaller marshalFlowRSVPType1ExplicitRouteSubobjectsType + unMarshaller unMarshalFlowRSVPType1ExplicitRouteSubobjectsType + ipv4PrefixHolder FlowRSVPPathExplicitRouteType1Ipv4Prefix + asNumberHolder FlowRSVPPathExplicitRouteType1ASNumber +} + +func NewFlowRSVPType1ExplicitRouteSubobjectsType() FlowRSVPType1ExplicitRouteSubobjectsType { + obj := flowRSVPType1ExplicitRouteSubobjectsType{obj: &otg.FlowRSVPType1ExplicitRouteSubobjectsType{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) msg() *otg.FlowRSVPType1ExplicitRouteSubobjectsType { + return obj.obj +} + +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) setMsg(msg *otg.FlowRSVPType1ExplicitRouteSubobjectsType) FlowRSVPType1ExplicitRouteSubobjectsType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPType1ExplicitRouteSubobjectsType struct { + obj *flowRSVPType1ExplicitRouteSubobjectsType +} + +type marshalFlowRSVPType1ExplicitRouteSubobjectsType interface { + // ToProto marshals FlowRSVPType1ExplicitRouteSubobjectsType to protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjectsType + ToProto() (*otg.FlowRSVPType1ExplicitRouteSubobjectsType, error) + // ToPbText marshals FlowRSVPType1ExplicitRouteSubobjectsType to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPType1ExplicitRouteSubobjectsType to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPType1ExplicitRouteSubobjectsType to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPType1ExplicitRouteSubobjectsType struct { + obj *flowRSVPType1ExplicitRouteSubobjectsType +} + +type unMarshalFlowRSVPType1ExplicitRouteSubobjectsType interface { + // FromProto unmarshals FlowRSVPType1ExplicitRouteSubobjectsType from protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjectsType + FromProto(msg *otg.FlowRSVPType1ExplicitRouteSubobjectsType) (FlowRSVPType1ExplicitRouteSubobjectsType, error) + // FromPbText unmarshals FlowRSVPType1ExplicitRouteSubobjectsType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPType1ExplicitRouteSubobjectsType from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPType1ExplicitRouteSubobjectsType from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) Marshal() marshalFlowRSVPType1ExplicitRouteSubobjectsType { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPType1ExplicitRouteSubobjectsType{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) Unmarshal() unMarshalFlowRSVPType1ExplicitRouteSubobjectsType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPType1ExplicitRouteSubobjectsType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPType1ExplicitRouteSubobjectsType) ToProto() (*otg.FlowRSVPType1ExplicitRouteSubobjectsType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPType1ExplicitRouteSubobjectsType) FromProto(msg *otg.FlowRSVPType1ExplicitRouteSubobjectsType) (FlowRSVPType1ExplicitRouteSubobjectsType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPType1ExplicitRouteSubobjectsType) 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 *unMarshalflowRSVPType1ExplicitRouteSubobjectsType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPType1ExplicitRouteSubobjectsType) 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 *unMarshalflowRSVPType1ExplicitRouteSubobjectsType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPType1ExplicitRouteSubobjectsType) 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 *unMarshalflowRSVPType1ExplicitRouteSubobjectsType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) Clone() (FlowRSVPType1ExplicitRouteSubobjectsType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPType1ExplicitRouteSubobjectsType() + 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 +} + +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) setNil() { + obj.ipv4PrefixHolder = nil + obj.asNumberHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPType1ExplicitRouteSubobjectsType is currently supported subobjects are IPv4 address(1) and Autonomous system number(32). +type FlowRSVPType1ExplicitRouteSubobjectsType interface { + Validation + // msg marshals FlowRSVPType1ExplicitRouteSubobjectsType to protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjectsType + // and doesn't set defaults + msg() *otg.FlowRSVPType1ExplicitRouteSubobjectsType + // setMsg unmarshals FlowRSVPType1ExplicitRouteSubobjectsType from protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjectsType + // and doesn't set defaults + setMsg(*otg.FlowRSVPType1ExplicitRouteSubobjectsType) FlowRSVPType1ExplicitRouteSubobjectsType + // provides marshal interface + Marshal() marshalFlowRSVPType1ExplicitRouteSubobjectsType + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPType1ExplicitRouteSubobjectsType + // validate validates FlowRSVPType1ExplicitRouteSubobjectsType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPType1ExplicitRouteSubobjectsType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum, set in FlowRSVPType1ExplicitRouteSubobjectsType + Choice() FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum + // setChoice assigns FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum provided by user to FlowRSVPType1ExplicitRouteSubobjectsType + setChoice(value FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum) FlowRSVPType1ExplicitRouteSubobjectsType + // HasChoice checks if Choice has been set in FlowRSVPType1ExplicitRouteSubobjectsType + HasChoice() bool + // Ipv4Prefix returns FlowRSVPPathExplicitRouteType1Ipv4Prefix, set in FlowRSVPType1ExplicitRouteSubobjectsType. + // FlowRSVPPathExplicitRouteType1Ipv4Prefix is class = EXPLICIT_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: IPv4 Prefix, C-Type: 1 + Ipv4Prefix() FlowRSVPPathExplicitRouteType1Ipv4Prefix + // SetIpv4Prefix assigns FlowRSVPPathExplicitRouteType1Ipv4Prefix provided by user to FlowRSVPType1ExplicitRouteSubobjectsType. + // FlowRSVPPathExplicitRouteType1Ipv4Prefix is class = EXPLICIT_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: IPv4 Prefix, C-Type: 1 + SetIpv4Prefix(value FlowRSVPPathExplicitRouteType1Ipv4Prefix) FlowRSVPType1ExplicitRouteSubobjectsType + // HasIpv4Prefix checks if Ipv4Prefix has been set in FlowRSVPType1ExplicitRouteSubobjectsType + HasIpv4Prefix() bool + // AsNumber returns FlowRSVPPathExplicitRouteType1ASNumber, set in FlowRSVPType1ExplicitRouteSubobjectsType. + // FlowRSVPPathExplicitRouteType1ASNumber is class = EXPLICIT_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: Autonomous system number, C-Type: 32 + AsNumber() FlowRSVPPathExplicitRouteType1ASNumber + // SetAsNumber assigns FlowRSVPPathExplicitRouteType1ASNumber provided by user to FlowRSVPType1ExplicitRouteSubobjectsType. + // FlowRSVPPathExplicitRouteType1ASNumber is class = EXPLICIT_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: Autonomous system number, C-Type: 32 + SetAsNumber(value FlowRSVPPathExplicitRouteType1ASNumber) FlowRSVPType1ExplicitRouteSubobjectsType + // HasAsNumber checks if AsNumber has been set in FlowRSVPType1ExplicitRouteSubobjectsType + HasAsNumber() bool + setNil() +} + +type FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum string + +// Enum of Choice on FlowRSVPType1ExplicitRouteSubobjectsType +var FlowRSVPType1ExplicitRouteSubobjectsTypeChoice = struct { + IPV4_PREFIX FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum + AS_NUMBER FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum +}{ + IPV4_PREFIX: FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum("ipv4_prefix"), + AS_NUMBER: FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum("as_number"), +} + +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) Choice() FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum { + return FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) setChoice(value FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum) FlowRSVPType1ExplicitRouteSubobjectsType { + intValue, ok := otg.FlowRSVPType1ExplicitRouteSubobjectsType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRSVPType1ExplicitRouteSubobjectsType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.AsNumber = nil + obj.asNumberHolder = nil + obj.obj.Ipv4Prefix = nil + obj.ipv4PrefixHolder = nil + + if value == FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.IPV4_PREFIX { + obj.obj.Ipv4Prefix = NewFlowRSVPPathExplicitRouteType1Ipv4Prefix().msg() + } + + if value == FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.AS_NUMBER { + obj.obj.AsNumber = NewFlowRSVPPathExplicitRouteType1ASNumber().msg() + } + + return obj +} + +// description is TBD +// Ipv4Prefix returns a FlowRSVPPathExplicitRouteType1Ipv4Prefix +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) Ipv4Prefix() FlowRSVPPathExplicitRouteType1Ipv4Prefix { + if obj.obj.Ipv4Prefix == nil { + obj.setChoice(FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.IPV4_PREFIX) + } + if obj.ipv4PrefixHolder == nil { + obj.ipv4PrefixHolder = &flowRSVPPathExplicitRouteType1Ipv4Prefix{obj: obj.obj.Ipv4Prefix} + } + return obj.ipv4PrefixHolder +} + +// description is TBD +// Ipv4Prefix returns a FlowRSVPPathExplicitRouteType1Ipv4Prefix +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) HasIpv4Prefix() bool { + return obj.obj.Ipv4Prefix != nil +} + +// description is TBD +// SetIpv4Prefix sets the FlowRSVPPathExplicitRouteType1Ipv4Prefix value in the FlowRSVPType1ExplicitRouteSubobjectsType object +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) SetIpv4Prefix(value FlowRSVPPathExplicitRouteType1Ipv4Prefix) FlowRSVPType1ExplicitRouteSubobjectsType { + obj.setChoice(FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.IPV4_PREFIX) + obj.ipv4PrefixHolder = nil + obj.obj.Ipv4Prefix = value.msg() + + return obj +} + +// description is TBD +// AsNumber returns a FlowRSVPPathExplicitRouteType1ASNumber +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) AsNumber() FlowRSVPPathExplicitRouteType1ASNumber { + if obj.obj.AsNumber == nil { + obj.setChoice(FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.AS_NUMBER) + } + if obj.asNumberHolder == nil { + obj.asNumberHolder = &flowRSVPPathExplicitRouteType1ASNumber{obj: obj.obj.AsNumber} + } + return obj.asNumberHolder +} + +// description is TBD +// AsNumber returns a FlowRSVPPathExplicitRouteType1ASNumber +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) HasAsNumber() bool { + return obj.obj.AsNumber != nil +} + +// description is TBD +// SetAsNumber sets the FlowRSVPPathExplicitRouteType1ASNumber value in the FlowRSVPType1ExplicitRouteSubobjectsType object +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) SetAsNumber(value FlowRSVPPathExplicitRouteType1ASNumber) FlowRSVPType1ExplicitRouteSubobjectsType { + obj.setChoice(FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.AS_NUMBER) + obj.asNumberHolder = nil + obj.obj.AsNumber = value.msg() + + return obj +} + +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv4Prefix != nil { + + obj.Ipv4Prefix().validateObj(vObj, set_default) + } + + if obj.obj.AsNumber != nil { + + obj.AsNumber().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPType1ExplicitRouteSubobjectsType) setDefault() { + var choices_set int = 0 + var choice FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum + + if obj.obj.Ipv4Prefix != nil { + choices_set += 1 + choice = FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.IPV4_PREFIX + } + + if obj.obj.AsNumber != nil { + choices_set += 1 + choice = FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.AS_NUMBER + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.IPV4_PREFIX) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPType1ExplicitRouteSubobjectsType") + } + } else { + intVal := otg.FlowRSVPType1ExplicitRouteSubobjectsType_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRSVPType1ExplicitRouteSubobjectsType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rsvp_type1_record_route_subobjects.go b/gosnappi/flow_rsvp_type1_record_route_subobjects.go new file mode 100644 index 00000000..bb318aed --- /dev/null +++ b/gosnappi/flow_rsvp_type1_record_route_subobjects.go @@ -0,0 +1,328 @@ +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" +) + +// ***** FlowRSVPType1RecordRouteSubobjects ***** +type flowRSVPType1RecordRouteSubobjects struct { + validation + obj *otg.FlowRSVPType1RecordRouteSubobjects + marshaller marshalFlowRSVPType1RecordRouteSubobjects + unMarshaller unMarshalFlowRSVPType1RecordRouteSubobjects + typeHolder FlowRSVPPathObjectsRecordRouteSubObjectType +} + +func NewFlowRSVPType1RecordRouteSubobjects() FlowRSVPType1RecordRouteSubobjects { + obj := flowRSVPType1RecordRouteSubobjects{obj: &otg.FlowRSVPType1RecordRouteSubobjects{}} + obj.setDefault() + return &obj +} + +func (obj *flowRSVPType1RecordRouteSubobjects) msg() *otg.FlowRSVPType1RecordRouteSubobjects { + return obj.obj +} + +func (obj *flowRSVPType1RecordRouteSubobjects) setMsg(msg *otg.FlowRSVPType1RecordRouteSubobjects) FlowRSVPType1RecordRouteSubobjects { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRSVPType1RecordRouteSubobjects struct { + obj *flowRSVPType1RecordRouteSubobjects +} + +type marshalFlowRSVPType1RecordRouteSubobjects interface { + // ToProto marshals FlowRSVPType1RecordRouteSubobjects to protobuf object *otg.FlowRSVPType1RecordRouteSubobjects + ToProto() (*otg.FlowRSVPType1RecordRouteSubobjects, error) + // ToPbText marshals FlowRSVPType1RecordRouteSubobjects to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRSVPType1RecordRouteSubobjects to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRSVPType1RecordRouteSubobjects to JSON text + ToJson() (string, error) +} + +type unMarshalflowRSVPType1RecordRouteSubobjects struct { + obj *flowRSVPType1RecordRouteSubobjects +} + +type unMarshalFlowRSVPType1RecordRouteSubobjects interface { + // FromProto unmarshals FlowRSVPType1RecordRouteSubobjects from protobuf object *otg.FlowRSVPType1RecordRouteSubobjects + FromProto(msg *otg.FlowRSVPType1RecordRouteSubobjects) (FlowRSVPType1RecordRouteSubobjects, error) + // FromPbText unmarshals FlowRSVPType1RecordRouteSubobjects from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRSVPType1RecordRouteSubobjects from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRSVPType1RecordRouteSubobjects from JSON text + FromJson(value string) error +} + +func (obj *flowRSVPType1RecordRouteSubobjects) Marshal() marshalFlowRSVPType1RecordRouteSubobjects { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRSVPType1RecordRouteSubobjects{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRSVPType1RecordRouteSubobjects) Unmarshal() unMarshalFlowRSVPType1RecordRouteSubobjects { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRSVPType1RecordRouteSubobjects{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRSVPType1RecordRouteSubobjects) ToProto() (*otg.FlowRSVPType1RecordRouteSubobjects, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRSVPType1RecordRouteSubobjects) FromProto(msg *otg.FlowRSVPType1RecordRouteSubobjects) (FlowRSVPType1RecordRouteSubobjects, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRSVPType1RecordRouteSubobjects) 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 *unMarshalflowRSVPType1RecordRouteSubobjects) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRSVPType1RecordRouteSubobjects) 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 *unMarshalflowRSVPType1RecordRouteSubobjects) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRSVPType1RecordRouteSubobjects) 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 *unMarshalflowRSVPType1RecordRouteSubobjects) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRSVPType1RecordRouteSubobjects) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRSVPType1RecordRouteSubobjects) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRSVPType1RecordRouteSubobjects) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRSVPType1RecordRouteSubobjects) Clone() (FlowRSVPType1RecordRouteSubobjects, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRSVPType1RecordRouteSubobjects() + 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 +} + +func (obj *flowRSVPType1RecordRouteSubobjects) setNil() { + obj.typeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRSVPType1RecordRouteSubobjects is type is specific to a subobject. +type FlowRSVPType1RecordRouteSubobjects interface { + Validation + // msg marshals FlowRSVPType1RecordRouteSubobjects to protobuf object *otg.FlowRSVPType1RecordRouteSubobjects + // and doesn't set defaults + msg() *otg.FlowRSVPType1RecordRouteSubobjects + // setMsg unmarshals FlowRSVPType1RecordRouteSubobjects from protobuf object *otg.FlowRSVPType1RecordRouteSubobjects + // and doesn't set defaults + setMsg(*otg.FlowRSVPType1RecordRouteSubobjects) FlowRSVPType1RecordRouteSubobjects + // provides marshal interface + Marshal() marshalFlowRSVPType1RecordRouteSubobjects + // provides unmarshal interface + Unmarshal() unMarshalFlowRSVPType1RecordRouteSubobjects + // validate validates FlowRSVPType1RecordRouteSubobjects + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRSVPType1RecordRouteSubobjects, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Type returns FlowRSVPPathObjectsRecordRouteSubObjectType, set in FlowRSVPType1RecordRouteSubobjects. + // FlowRSVPPathObjectsRecordRouteSubObjectType is currently supported subobjects are IPv4 address(1) and Label(3). + Type() FlowRSVPPathObjectsRecordRouteSubObjectType + // SetType assigns FlowRSVPPathObjectsRecordRouteSubObjectType provided by user to FlowRSVPType1RecordRouteSubobjects. + // FlowRSVPPathObjectsRecordRouteSubObjectType is currently supported subobjects are IPv4 address(1) and Label(3). + SetType(value FlowRSVPPathObjectsRecordRouteSubObjectType) FlowRSVPType1RecordRouteSubobjects + // HasType checks if Type has been set in FlowRSVPType1RecordRouteSubobjects + HasType() bool + setNil() +} + +// description is TBD +// Type returns a FlowRSVPPathObjectsRecordRouteSubObjectType +func (obj *flowRSVPType1RecordRouteSubobjects) Type() FlowRSVPPathObjectsRecordRouteSubObjectType { + if obj.obj.Type == nil { + obj.obj.Type = NewFlowRSVPPathObjectsRecordRouteSubObjectType().msg() + } + if obj.typeHolder == nil { + obj.typeHolder = &flowRSVPPathObjectsRecordRouteSubObjectType{obj: obj.obj.Type} + } + return obj.typeHolder +} + +// description is TBD +// Type returns a FlowRSVPPathObjectsRecordRouteSubObjectType +func (obj *flowRSVPType1RecordRouteSubobjects) HasType() bool { + return obj.obj.Type != nil +} + +// description is TBD +// SetType sets the FlowRSVPPathObjectsRecordRouteSubObjectType value in the FlowRSVPType1RecordRouteSubobjects object +func (obj *flowRSVPType1RecordRouteSubobjects) SetType(value FlowRSVPPathObjectsRecordRouteSubObjectType) FlowRSVPType1RecordRouteSubobjects { + + obj.typeHolder = nil + obj.obj.Type = value.msg() + + return obj +} + +func (obj *flowRSVPType1RecordRouteSubobjects) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Type != nil { + + obj.Type().validateObj(vObj, set_default) + } + +} + +func (obj *flowRSVPType1RecordRouteSubobjects) setDefault() { + +} diff --git a/gosnappi/flow_rx_tx_ratio.go b/gosnappi/flow_rx_tx_ratio.go new file mode 100644 index 00000000..46d9dc10 --- /dev/null +++ b/gosnappi/flow_rx_tx_ratio.go @@ -0,0 +1,461 @@ +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" +) + +// ***** FlowRxTxRatio ***** +type flowRxTxRatio struct { + validation + obj *otg.FlowRxTxRatio + marshaller marshalFlowRxTxRatio + unMarshaller unMarshalFlowRxTxRatio + rxCountHolder FlowRxTxRatioRxCount +} + +func NewFlowRxTxRatio() FlowRxTxRatio { + obj := flowRxTxRatio{obj: &otg.FlowRxTxRatio{}} + obj.setDefault() + return &obj +} + +func (obj *flowRxTxRatio) msg() *otg.FlowRxTxRatio { + return obj.obj +} + +func (obj *flowRxTxRatio) setMsg(msg *otg.FlowRxTxRatio) FlowRxTxRatio { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRxTxRatio struct { + obj *flowRxTxRatio +} + +type marshalFlowRxTxRatio interface { + // ToProto marshals FlowRxTxRatio to protobuf object *otg.FlowRxTxRatio + ToProto() (*otg.FlowRxTxRatio, error) + // ToPbText marshals FlowRxTxRatio to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRxTxRatio to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRxTxRatio to JSON text + ToJson() (string, error) +} + +type unMarshalflowRxTxRatio struct { + obj *flowRxTxRatio +} + +type unMarshalFlowRxTxRatio interface { + // FromProto unmarshals FlowRxTxRatio from protobuf object *otg.FlowRxTxRatio + FromProto(msg *otg.FlowRxTxRatio) (FlowRxTxRatio, error) + // FromPbText unmarshals FlowRxTxRatio from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRxTxRatio from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRxTxRatio from JSON text + FromJson(value string) error +} + +func (obj *flowRxTxRatio) Marshal() marshalFlowRxTxRatio { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRxTxRatio{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRxTxRatio) Unmarshal() unMarshalFlowRxTxRatio { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRxTxRatio{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRxTxRatio) ToProto() (*otg.FlowRxTxRatio, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRxTxRatio) FromProto(msg *otg.FlowRxTxRatio) (FlowRxTxRatio, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRxTxRatio) 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 *unMarshalflowRxTxRatio) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowRxTxRatio) 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 *unMarshalflowRxTxRatio) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowRxTxRatio) 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 *unMarshalflowRxTxRatio) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowRxTxRatio) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRxTxRatio) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRxTxRatio) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRxTxRatio) Clone() (FlowRxTxRatio, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRxTxRatio() + 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 +} + +func (obj *flowRxTxRatio) setNil() { + obj.rxCountHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowRxTxRatio is rx Tx ratio is the ratio of expected number of Rx packets across all Rx ports to the Tx packets +// for the configured flow. It is a factor by which the Tx packet count is multiplied to calculate +// the sum of expected Rx packet count, across all Rx ports. This will be used to calculate loss +// percentage of flow at aggregate level. +type FlowRxTxRatio interface { + Validation + // msg marshals FlowRxTxRatio to protobuf object *otg.FlowRxTxRatio + // and doesn't set defaults + msg() *otg.FlowRxTxRatio + // setMsg unmarshals FlowRxTxRatio from protobuf object *otg.FlowRxTxRatio + // and doesn't set defaults + setMsg(*otg.FlowRxTxRatio) FlowRxTxRatio + // provides marshal interface + Marshal() marshalFlowRxTxRatio + // provides unmarshal interface + Unmarshal() unMarshalFlowRxTxRatio + // validate validates FlowRxTxRatio + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRxTxRatio, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowRxTxRatioChoiceEnum, set in FlowRxTxRatio + Choice() FlowRxTxRatioChoiceEnum + // setChoice assigns FlowRxTxRatioChoiceEnum provided by user to FlowRxTxRatio + setChoice(value FlowRxTxRatioChoiceEnum) FlowRxTxRatio + // HasChoice checks if Choice has been set in FlowRxTxRatio + HasChoice() bool + // RxCount returns FlowRxTxRatioRxCount, set in FlowRxTxRatio. + // FlowRxTxRatioRxCount is this is for cases where one copy of Tx packet is received on all Rx ports and so the sum total of Rx packets + // received across all Rx ports is a multiple of Rx port count and Tx packets. + RxCount() FlowRxTxRatioRxCount + // SetRxCount assigns FlowRxTxRatioRxCount provided by user to FlowRxTxRatio. + // FlowRxTxRatioRxCount is this is for cases where one copy of Tx packet is received on all Rx ports and so the sum total of Rx packets + // received across all Rx ports is a multiple of Rx port count and Tx packets. + SetRxCount(value FlowRxTxRatioRxCount) FlowRxTxRatio + // HasRxCount checks if RxCount has been set in FlowRxTxRatio + HasRxCount() bool + // Value returns float32, set in FlowRxTxRatio. + Value() float32 + // SetValue assigns float32 provided by user to FlowRxTxRatio + SetValue(value float32) FlowRxTxRatio + // HasValue checks if Value has been set in FlowRxTxRatio + HasValue() bool + setNil() +} + +type FlowRxTxRatioChoiceEnum string + +// Enum of Choice on FlowRxTxRatio +var FlowRxTxRatioChoice = struct { + RX_COUNT FlowRxTxRatioChoiceEnum + VALUE FlowRxTxRatioChoiceEnum +}{ + RX_COUNT: FlowRxTxRatioChoiceEnum("rx_count"), + VALUE: FlowRxTxRatioChoiceEnum("value"), +} + +func (obj *flowRxTxRatio) Choice() FlowRxTxRatioChoiceEnum { + return FlowRxTxRatioChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowRxTxRatio) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowRxTxRatio) setChoice(value FlowRxTxRatioChoiceEnum) FlowRxTxRatio { + intValue, ok := otg.FlowRxTxRatio_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowRxTxRatioChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowRxTxRatio_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Value = nil + obj.obj.RxCount = nil + obj.rxCountHolder = nil + + if value == FlowRxTxRatioChoice.RX_COUNT { + obj.obj.RxCount = NewFlowRxTxRatioRxCount().msg() + } + + if value == FlowRxTxRatioChoice.VALUE { + defaultValue := float32(1.0) + obj.obj.Value = &defaultValue + } + + return obj +} + +// description is TBD +// RxCount returns a FlowRxTxRatioRxCount +func (obj *flowRxTxRatio) RxCount() FlowRxTxRatioRxCount { + if obj.obj.RxCount == nil { + obj.setChoice(FlowRxTxRatioChoice.RX_COUNT) + } + if obj.rxCountHolder == nil { + obj.rxCountHolder = &flowRxTxRatioRxCount{obj: obj.obj.RxCount} + } + return obj.rxCountHolder +} + +// description is TBD +// RxCount returns a FlowRxTxRatioRxCount +func (obj *flowRxTxRatio) HasRxCount() bool { + return obj.obj.RxCount != nil +} + +// description is TBD +// SetRxCount sets the FlowRxTxRatioRxCount value in the FlowRxTxRatio object +func (obj *flowRxTxRatio) SetRxCount(value FlowRxTxRatioRxCount) FlowRxTxRatio { + obj.setChoice(FlowRxTxRatioChoice.RX_COUNT) + obj.rxCountHolder = nil + obj.obj.RxCount = value.msg() + + return obj +} + +// Should be a positive, non-zero value. The default value of 1, is when the Rx packet count across +// all ports is expected to match the Tx packet count. A custom integer value (>1) can be specified for +// loss calculation for cases when there are multiple destination addresses configured within one flow, +// but DUT is configured to replicate only to a subset of Rx ports. For cases when Tx side generates two +// packets from each source in 1:1 protection mode but only one of the two packets are received by the +// Rx port, we may need to specify a fractional value instead. +// Value returns a float32 +func (obj *flowRxTxRatio) Value() float32 { + + if obj.obj.Value == nil { + obj.setChoice(FlowRxTxRatioChoice.VALUE) + } + + return *obj.obj.Value + +} + +// Should be a positive, non-zero value. The default value of 1, is when the Rx packet count across +// all ports is expected to match the Tx packet count. A custom integer value (>1) can be specified for +// loss calculation for cases when there are multiple destination addresses configured within one flow, +// but DUT is configured to replicate only to a subset of Rx ports. For cases when Tx side generates two +// packets from each source in 1:1 protection mode but only one of the two packets are received by the +// Rx port, we may need to specify a fractional value instead. +// Value returns a float32 +func (obj *flowRxTxRatio) HasValue() bool { + return obj.obj.Value != nil +} + +// Should be a positive, non-zero value. The default value of 1, is when the Rx packet count across +// all ports is expected to match the Tx packet count. A custom integer value (>1) can be specified for +// loss calculation for cases when there are multiple destination addresses configured within one flow, +// but DUT is configured to replicate only to a subset of Rx ports. For cases when Tx side generates two +// packets from each source in 1:1 protection mode but only one of the two packets are received by the +// Rx port, we may need to specify a fractional value instead. +// SetValue sets the float32 value in the FlowRxTxRatio object +func (obj *flowRxTxRatio) SetValue(value float32) FlowRxTxRatio { + obj.setChoice(FlowRxTxRatioChoice.VALUE) + obj.obj.Value = &value + return obj +} + +func (obj *flowRxTxRatio) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RxCount != nil { + + obj.RxCount().validateObj(vObj, set_default) + } + +} + +func (obj *flowRxTxRatio) setDefault() { + var choices_set int = 0 + var choice FlowRxTxRatioChoiceEnum + + if obj.obj.RxCount != nil { + choices_set += 1 + choice = FlowRxTxRatioChoice.RX_COUNT + } + + if obj.obj.Value != nil { + choices_set += 1 + choice = FlowRxTxRatioChoice.VALUE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowRxTxRatioChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRxTxRatio") + } + } else { + intVal := otg.FlowRxTxRatio_Choice_Enum_value[string(choice)] + enumValue := otg.FlowRxTxRatio_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_rx_tx_ratio_rx_count.go b/gosnappi/flow_rx_tx_ratio_rx_count.go new file mode 100644 index 00000000..babfc601 --- /dev/null +++ b/gosnappi/flow_rx_tx_ratio_rx_count.go @@ -0,0 +1,279 @@ +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" +) + +// ***** FlowRxTxRatioRxCount ***** +type flowRxTxRatioRxCount struct { + validation + obj *otg.FlowRxTxRatioRxCount + marshaller marshalFlowRxTxRatioRxCount + unMarshaller unMarshalFlowRxTxRatioRxCount +} + +func NewFlowRxTxRatioRxCount() FlowRxTxRatioRxCount { + obj := flowRxTxRatioRxCount{obj: &otg.FlowRxTxRatioRxCount{}} + obj.setDefault() + return &obj +} + +func (obj *flowRxTxRatioRxCount) msg() *otg.FlowRxTxRatioRxCount { + return obj.obj +} + +func (obj *flowRxTxRatioRxCount) setMsg(msg *otg.FlowRxTxRatioRxCount) FlowRxTxRatioRxCount { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowRxTxRatioRxCount struct { + obj *flowRxTxRatioRxCount +} + +type marshalFlowRxTxRatioRxCount interface { + // ToProto marshals FlowRxTxRatioRxCount to protobuf object *otg.FlowRxTxRatioRxCount + ToProto() (*otg.FlowRxTxRatioRxCount, error) + // ToPbText marshals FlowRxTxRatioRxCount to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowRxTxRatioRxCount to YAML text + ToYaml() (string, error) + // ToJson marshals FlowRxTxRatioRxCount to JSON text + ToJson() (string, error) +} + +type unMarshalflowRxTxRatioRxCount struct { + obj *flowRxTxRatioRxCount +} + +type unMarshalFlowRxTxRatioRxCount interface { + // FromProto unmarshals FlowRxTxRatioRxCount from protobuf object *otg.FlowRxTxRatioRxCount + FromProto(msg *otg.FlowRxTxRatioRxCount) (FlowRxTxRatioRxCount, error) + // FromPbText unmarshals FlowRxTxRatioRxCount from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowRxTxRatioRxCount from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowRxTxRatioRxCount from JSON text + FromJson(value string) error +} + +func (obj *flowRxTxRatioRxCount) Marshal() marshalFlowRxTxRatioRxCount { + if obj.marshaller == nil { + obj.marshaller = &marshalflowRxTxRatioRxCount{obj: obj} + } + return obj.marshaller +} + +func (obj *flowRxTxRatioRxCount) Unmarshal() unMarshalFlowRxTxRatioRxCount { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowRxTxRatioRxCount{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowRxTxRatioRxCount) ToProto() (*otg.FlowRxTxRatioRxCount, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowRxTxRatioRxCount) FromProto(msg *otg.FlowRxTxRatioRxCount) (FlowRxTxRatioRxCount, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowRxTxRatioRxCount) 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 *unMarshalflowRxTxRatioRxCount) 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 *marshalflowRxTxRatioRxCount) 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 *unMarshalflowRxTxRatioRxCount) 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 *marshalflowRxTxRatioRxCount) 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 *unMarshalflowRxTxRatioRxCount) 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 *flowRxTxRatioRxCount) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowRxTxRatioRxCount) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowRxTxRatioRxCount) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowRxTxRatioRxCount) Clone() (FlowRxTxRatioRxCount, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowRxTxRatioRxCount() + 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 +} + +// FlowRxTxRatioRxCount is this is for cases where one copy of Tx packet is received on all Rx ports and so the sum total of Rx packets +// received across all Rx ports is a multiple of Rx port count and Tx packets. +type FlowRxTxRatioRxCount interface { + Validation + // msg marshals FlowRxTxRatioRxCount to protobuf object *otg.FlowRxTxRatioRxCount + // and doesn't set defaults + msg() *otg.FlowRxTxRatioRxCount + // setMsg unmarshals FlowRxTxRatioRxCount from protobuf object *otg.FlowRxTxRatioRxCount + // and doesn't set defaults + setMsg(*otg.FlowRxTxRatioRxCount) FlowRxTxRatioRxCount + // provides marshal interface + Marshal() marshalFlowRxTxRatioRxCount + // provides unmarshal interface + Unmarshal() unMarshalFlowRxTxRatioRxCount + // validate validates FlowRxTxRatioRxCount + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowRxTxRatioRxCount, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() +} + +func (obj *flowRxTxRatioRxCount) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *flowRxTxRatioRxCount) setDefault() { + +} diff --git a/gosnappi/flow_size.go b/gosnappi/flow_size.go new file mode 100644 index 00000000..f586f599 --- /dev/null +++ b/gosnappi/flow_size.go @@ -0,0 +1,563 @@ +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" +) + +// ***** FlowSize ***** +type flowSize struct { + validation + obj *otg.FlowSize + marshaller marshalFlowSize + unMarshaller unMarshalFlowSize + incrementHolder FlowSizeIncrement + randomHolder FlowSizeRandom + weightPairsHolder FlowSizeWeightPairs +} + +func NewFlowSize() FlowSize { + obj := flowSize{obj: &otg.FlowSize{}} + obj.setDefault() + return &obj +} + +func (obj *flowSize) msg() *otg.FlowSize { + return obj.obj +} + +func (obj *flowSize) setMsg(msg *otg.FlowSize) FlowSize { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowSize struct { + obj *flowSize +} + +type marshalFlowSize interface { + // ToProto marshals FlowSize to protobuf object *otg.FlowSize + ToProto() (*otg.FlowSize, error) + // ToPbText marshals FlowSize to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowSize to YAML text + ToYaml() (string, error) + // ToJson marshals FlowSize to JSON text + ToJson() (string, error) +} + +type unMarshalflowSize struct { + obj *flowSize +} + +type unMarshalFlowSize interface { + // FromProto unmarshals FlowSize from protobuf object *otg.FlowSize + FromProto(msg *otg.FlowSize) (FlowSize, error) + // FromPbText unmarshals FlowSize from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowSize from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowSize from JSON text + FromJson(value string) error +} + +func (obj *flowSize) Marshal() marshalFlowSize { + if obj.marshaller == nil { + obj.marshaller = &marshalflowSize{obj: obj} + } + return obj.marshaller +} + +func (obj *flowSize) Unmarshal() unMarshalFlowSize { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowSize{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowSize) ToProto() (*otg.FlowSize, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowSize) FromProto(msg *otg.FlowSize) (FlowSize, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowSize) 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 *unMarshalflowSize) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowSize) 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 *unMarshalflowSize) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowSize) 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 *unMarshalflowSize) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowSize) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowSize) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowSize) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowSize) Clone() (FlowSize, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowSize() + 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 +} + +func (obj *flowSize) setNil() { + obj.incrementHolder = nil + obj.randomHolder = nil + obj.weightPairsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowSize is the frame size which overrides the total length of the packet +type FlowSize interface { + Validation + // msg marshals FlowSize to protobuf object *otg.FlowSize + // and doesn't set defaults + msg() *otg.FlowSize + // setMsg unmarshals FlowSize from protobuf object *otg.FlowSize + // and doesn't set defaults + setMsg(*otg.FlowSize) FlowSize + // provides marshal interface + Marshal() marshalFlowSize + // provides unmarshal interface + Unmarshal() unMarshalFlowSize + // validate validates FlowSize + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowSize, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowSizeChoiceEnum, set in FlowSize + Choice() FlowSizeChoiceEnum + // setChoice assigns FlowSizeChoiceEnum provided by user to FlowSize + setChoice(value FlowSizeChoiceEnum) FlowSize + // HasChoice checks if Choice has been set in FlowSize + HasChoice() bool + // Fixed returns uint32, set in FlowSize. + Fixed() uint32 + // SetFixed assigns uint32 provided by user to FlowSize + SetFixed(value uint32) FlowSize + // HasFixed checks if Fixed has been set in FlowSize + HasFixed() bool + // Increment returns FlowSizeIncrement, set in FlowSize. + // FlowSizeIncrement is frame size that increments from a starting size to + // an ending size incrementing by a step size. + Increment() FlowSizeIncrement + // SetIncrement assigns FlowSizeIncrement provided by user to FlowSize. + // FlowSizeIncrement is frame size that increments from a starting size to + // an ending size incrementing by a step size. + SetIncrement(value FlowSizeIncrement) FlowSize + // HasIncrement checks if Increment has been set in FlowSize + HasIncrement() bool + // Random returns FlowSizeRandom, set in FlowSize. + // FlowSizeRandom is random frame size from a min value to a max value. + Random() FlowSizeRandom + // SetRandom assigns FlowSizeRandom provided by user to FlowSize. + // FlowSizeRandom is random frame size from a min value to a max value. + SetRandom(value FlowSizeRandom) FlowSize + // HasRandom checks if Random has been set in FlowSize + HasRandom() bool + // WeightPairs returns FlowSizeWeightPairs, set in FlowSize. + // FlowSizeWeightPairs is frame size distribution, defined as pairs (including IMIX distribution). + // Frames are randomly generated such that the proportion of each frame size out of the total number of frames + // are matching with the weight value of the pair. However, as with any other probability + // distribution, the sample distribution is close to theoretical value only if the size of the sample is reasonably large. + // When the number of frames is very low the transmitted frames may not come close to the ratio described in the weight. + WeightPairs() FlowSizeWeightPairs + // SetWeightPairs assigns FlowSizeWeightPairs provided by user to FlowSize. + // FlowSizeWeightPairs is frame size distribution, defined as pairs (including IMIX distribution). + // Frames are randomly generated such that the proportion of each frame size out of the total number of frames + // are matching with the weight value of the pair. However, as with any other probability + // distribution, the sample distribution is close to theoretical value only if the size of the sample is reasonably large. + // When the number of frames is very low the transmitted frames may not come close to the ratio described in the weight. + SetWeightPairs(value FlowSizeWeightPairs) FlowSize + // HasWeightPairs checks if WeightPairs has been set in FlowSize + HasWeightPairs() bool + setNil() +} + +type FlowSizeChoiceEnum string + +// Enum of Choice on FlowSize +var FlowSizeChoice = struct { + FIXED FlowSizeChoiceEnum + INCREMENT FlowSizeChoiceEnum + RANDOM FlowSizeChoiceEnum + WEIGHT_PAIRS FlowSizeChoiceEnum +}{ + FIXED: FlowSizeChoiceEnum("fixed"), + INCREMENT: FlowSizeChoiceEnum("increment"), + RANDOM: FlowSizeChoiceEnum("random"), + WEIGHT_PAIRS: FlowSizeChoiceEnum("weight_pairs"), +} + +func (obj *flowSize) Choice() FlowSizeChoiceEnum { + return FlowSizeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowSize) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowSize) setChoice(value FlowSizeChoiceEnum) FlowSize { + intValue, ok := otg.FlowSize_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowSizeChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowSize_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.WeightPairs = nil + obj.weightPairsHolder = nil + obj.obj.Random = nil + obj.randomHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Fixed = nil + + if value == FlowSizeChoice.FIXED { + defaultValue := uint32(64) + obj.obj.Fixed = &defaultValue + } + + if value == FlowSizeChoice.INCREMENT { + obj.obj.Increment = NewFlowSizeIncrement().msg() + } + + if value == FlowSizeChoice.RANDOM { + obj.obj.Random = NewFlowSizeRandom().msg() + } + + if value == FlowSizeChoice.WEIGHT_PAIRS { + obj.obj.WeightPairs = NewFlowSizeWeightPairs().msg() + } + + return obj +} + +// description is TBD +// Fixed returns a uint32 +func (obj *flowSize) Fixed() uint32 { + + if obj.obj.Fixed == nil { + obj.setChoice(FlowSizeChoice.FIXED) + } + + return *obj.obj.Fixed + +} + +// description is TBD +// Fixed returns a uint32 +func (obj *flowSize) HasFixed() bool { + return obj.obj.Fixed != nil +} + +// description is TBD +// SetFixed sets the uint32 value in the FlowSize object +func (obj *flowSize) SetFixed(value uint32) FlowSize { + obj.setChoice(FlowSizeChoice.FIXED) + obj.obj.Fixed = &value + return obj +} + +// description is TBD +// Increment returns a FlowSizeIncrement +func (obj *flowSize) Increment() FlowSizeIncrement { + if obj.obj.Increment == nil { + obj.setChoice(FlowSizeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &flowSizeIncrement{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a FlowSizeIncrement +func (obj *flowSize) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the FlowSizeIncrement value in the FlowSize object +func (obj *flowSize) SetIncrement(value FlowSizeIncrement) FlowSize { + obj.setChoice(FlowSizeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Random returns a FlowSizeRandom +func (obj *flowSize) Random() FlowSizeRandom { + if obj.obj.Random == nil { + obj.setChoice(FlowSizeChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &flowSizeRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a FlowSizeRandom +func (obj *flowSize) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the FlowSizeRandom value in the FlowSize object +func (obj *flowSize) SetRandom(value FlowSizeRandom) FlowSize { + obj.setChoice(FlowSizeChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + +// description is TBD +// WeightPairs returns a FlowSizeWeightPairs +func (obj *flowSize) WeightPairs() FlowSizeWeightPairs { + if obj.obj.WeightPairs == nil { + obj.setChoice(FlowSizeChoice.WEIGHT_PAIRS) + } + if obj.weightPairsHolder == nil { + obj.weightPairsHolder = &flowSizeWeightPairs{obj: obj.obj.WeightPairs} + } + return obj.weightPairsHolder +} + +// description is TBD +// WeightPairs returns a FlowSizeWeightPairs +func (obj *flowSize) HasWeightPairs() bool { + return obj.obj.WeightPairs != nil +} + +// description is TBD +// SetWeightPairs sets the FlowSizeWeightPairs value in the FlowSize object +func (obj *flowSize) SetWeightPairs(value FlowSizeWeightPairs) FlowSize { + obj.setChoice(FlowSizeChoice.WEIGHT_PAIRS) + obj.weightPairsHolder = nil + obj.obj.WeightPairs = value.msg() + + return obj +} + +func (obj *flowSize) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + + if obj.obj.WeightPairs != nil { + + obj.WeightPairs().validateObj(vObj, set_default) + } + +} + +func (obj *flowSize) setDefault() { + var choices_set int = 0 + var choice FlowSizeChoiceEnum + + if obj.obj.Fixed != nil { + choices_set += 1 + choice = FlowSizeChoice.FIXED + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = FlowSizeChoice.INCREMENT + } + + if obj.obj.Random != nil { + choices_set += 1 + choice = FlowSizeChoice.RANDOM + } + + if obj.obj.WeightPairs != nil { + choices_set += 1 + choice = FlowSizeChoice.WEIGHT_PAIRS + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowSizeChoice.FIXED) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowSize") + } + } else { + intVal := otg.FlowSize_Choice_Enum_value[string(choice)] + enumValue := otg.FlowSize_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_size_increment.go b/gosnappi/flow_size_increment.go new file mode 100644 index 00000000..97cd41dd --- /dev/null +++ b/gosnappi/flow_size_increment.go @@ -0,0 +1,392 @@ +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" +) + +// ***** FlowSizeIncrement ***** +type flowSizeIncrement struct { + validation + obj *otg.FlowSizeIncrement + marshaller marshalFlowSizeIncrement + unMarshaller unMarshalFlowSizeIncrement +} + +func NewFlowSizeIncrement() FlowSizeIncrement { + obj := flowSizeIncrement{obj: &otg.FlowSizeIncrement{}} + obj.setDefault() + return &obj +} + +func (obj *flowSizeIncrement) msg() *otg.FlowSizeIncrement { + return obj.obj +} + +func (obj *flowSizeIncrement) setMsg(msg *otg.FlowSizeIncrement) FlowSizeIncrement { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowSizeIncrement struct { + obj *flowSizeIncrement +} + +type marshalFlowSizeIncrement interface { + // ToProto marshals FlowSizeIncrement to protobuf object *otg.FlowSizeIncrement + ToProto() (*otg.FlowSizeIncrement, error) + // ToPbText marshals FlowSizeIncrement to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowSizeIncrement to YAML text + ToYaml() (string, error) + // ToJson marshals FlowSizeIncrement to JSON text + ToJson() (string, error) +} + +type unMarshalflowSizeIncrement struct { + obj *flowSizeIncrement +} + +type unMarshalFlowSizeIncrement interface { + // FromProto unmarshals FlowSizeIncrement from protobuf object *otg.FlowSizeIncrement + FromProto(msg *otg.FlowSizeIncrement) (FlowSizeIncrement, error) + // FromPbText unmarshals FlowSizeIncrement from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowSizeIncrement from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowSizeIncrement from JSON text + FromJson(value string) error +} + +func (obj *flowSizeIncrement) Marshal() marshalFlowSizeIncrement { + if obj.marshaller == nil { + obj.marshaller = &marshalflowSizeIncrement{obj: obj} + } + return obj.marshaller +} + +func (obj *flowSizeIncrement) Unmarshal() unMarshalFlowSizeIncrement { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowSizeIncrement{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowSizeIncrement) ToProto() (*otg.FlowSizeIncrement, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowSizeIncrement) FromProto(msg *otg.FlowSizeIncrement) (FlowSizeIncrement, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowSizeIncrement) 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 *unMarshalflowSizeIncrement) 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 *marshalflowSizeIncrement) 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 *unMarshalflowSizeIncrement) 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 *marshalflowSizeIncrement) 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 *unMarshalflowSizeIncrement) 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 *flowSizeIncrement) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowSizeIncrement) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowSizeIncrement) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowSizeIncrement) Clone() (FlowSizeIncrement, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowSizeIncrement() + 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 +} + +// FlowSizeIncrement is frame size that increments from a starting size to +// an ending size incrementing by a step size. +type FlowSizeIncrement interface { + Validation + // msg marshals FlowSizeIncrement to protobuf object *otg.FlowSizeIncrement + // and doesn't set defaults + msg() *otg.FlowSizeIncrement + // setMsg unmarshals FlowSizeIncrement from protobuf object *otg.FlowSizeIncrement + // and doesn't set defaults + setMsg(*otg.FlowSizeIncrement) FlowSizeIncrement + // provides marshal interface + Marshal() marshalFlowSizeIncrement + // provides unmarshal interface + Unmarshal() unMarshalFlowSizeIncrement + // validate validates FlowSizeIncrement + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowSizeIncrement, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in FlowSizeIncrement. + Start() uint32 + // SetStart assigns uint32 provided by user to FlowSizeIncrement + SetStart(value uint32) FlowSizeIncrement + // HasStart checks if Start has been set in FlowSizeIncrement + HasStart() bool + // End returns uint32, set in FlowSizeIncrement. + End() uint32 + // SetEnd assigns uint32 provided by user to FlowSizeIncrement + SetEnd(value uint32) FlowSizeIncrement + // HasEnd checks if End has been set in FlowSizeIncrement + HasEnd() bool + // Step returns uint32, set in FlowSizeIncrement. + Step() uint32 + // SetStep assigns uint32 provided by user to FlowSizeIncrement + SetStep(value uint32) FlowSizeIncrement + // HasStep checks if Step has been set in FlowSizeIncrement + HasStep() bool +} + +// Starting frame size in bytes +// Start returns a uint32 +func (obj *flowSizeIncrement) Start() uint32 { + + return *obj.obj.Start + +} + +// Starting frame size in bytes +// Start returns a uint32 +func (obj *flowSizeIncrement) HasStart() bool { + return obj.obj.Start != nil +} + +// Starting frame size in bytes +// SetStart sets the uint32 value in the FlowSizeIncrement object +func (obj *flowSizeIncrement) SetStart(value uint32) FlowSizeIncrement { + + obj.obj.Start = &value + return obj +} + +// Ending frame size in bytes +// End returns a uint32 +func (obj *flowSizeIncrement) End() uint32 { + + return *obj.obj.End + +} + +// Ending frame size in bytes +// End returns a uint32 +func (obj *flowSizeIncrement) HasEnd() bool { + return obj.obj.End != nil +} + +// Ending frame size in bytes +// SetEnd sets the uint32 value in the FlowSizeIncrement object +func (obj *flowSizeIncrement) SetEnd(value uint32) FlowSizeIncrement { + + obj.obj.End = &value + return obj +} + +// Step frame size in bytes +// Step returns a uint32 +func (obj *flowSizeIncrement) Step() uint32 { + + return *obj.obj.Step + +} + +// Step frame size in bytes +// Step returns a uint32 +func (obj *flowSizeIncrement) HasStep() bool { + return obj.obj.Step != nil +} + +// Step frame size in bytes +// SetStep sets the uint32 value in the FlowSizeIncrement object +func (obj *flowSizeIncrement) SetStep(value uint32) FlowSizeIncrement { + + obj.obj.Step = &value + return obj +} + +func (obj *flowSizeIncrement) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start < 1 || *obj.obj.Start > 4294967295 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= FlowSizeIncrement.Start <= 4294967295 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.End != nil { + + if *obj.obj.End < 64 || *obj.obj.End > 4294967295 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("64 <= FlowSizeIncrement.End <= 4294967295 but Got %d", *obj.obj.End)) + } + + } + +} + +func (obj *flowSizeIncrement) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(64) + } + if obj.obj.End == nil { + obj.SetEnd(1518) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + +} diff --git a/gosnappi/flow_size_random.go b/gosnappi/flow_size_random.go new file mode 100644 index 00000000..c0318424 --- /dev/null +++ b/gosnappi/flow_size_random.go @@ -0,0 +1,340 @@ +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" +) + +// ***** FlowSizeRandom ***** +type flowSizeRandom struct { + validation + obj *otg.FlowSizeRandom + marshaller marshalFlowSizeRandom + unMarshaller unMarshalFlowSizeRandom +} + +func NewFlowSizeRandom() FlowSizeRandom { + obj := flowSizeRandom{obj: &otg.FlowSizeRandom{}} + obj.setDefault() + return &obj +} + +func (obj *flowSizeRandom) msg() *otg.FlowSizeRandom { + return obj.obj +} + +func (obj *flowSizeRandom) setMsg(msg *otg.FlowSizeRandom) FlowSizeRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowSizeRandom struct { + obj *flowSizeRandom +} + +type marshalFlowSizeRandom interface { + // ToProto marshals FlowSizeRandom to protobuf object *otg.FlowSizeRandom + ToProto() (*otg.FlowSizeRandom, error) + // ToPbText marshals FlowSizeRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowSizeRandom to YAML text + ToYaml() (string, error) + // ToJson marshals FlowSizeRandom to JSON text + ToJson() (string, error) +} + +type unMarshalflowSizeRandom struct { + obj *flowSizeRandom +} + +type unMarshalFlowSizeRandom interface { + // FromProto unmarshals FlowSizeRandom from protobuf object *otg.FlowSizeRandom + FromProto(msg *otg.FlowSizeRandom) (FlowSizeRandom, error) + // FromPbText unmarshals FlowSizeRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowSizeRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowSizeRandom from JSON text + FromJson(value string) error +} + +func (obj *flowSizeRandom) Marshal() marshalFlowSizeRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalflowSizeRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *flowSizeRandom) Unmarshal() unMarshalFlowSizeRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowSizeRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowSizeRandom) ToProto() (*otg.FlowSizeRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowSizeRandom) FromProto(msg *otg.FlowSizeRandom) (FlowSizeRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowSizeRandom) 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 *unMarshalflowSizeRandom) 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 *marshalflowSizeRandom) 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 *unMarshalflowSizeRandom) 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 *marshalflowSizeRandom) 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 *unMarshalflowSizeRandom) 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 *flowSizeRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowSizeRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowSizeRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowSizeRandom) Clone() (FlowSizeRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowSizeRandom() + 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 +} + +// FlowSizeRandom is random frame size from a min value to a max value. +type FlowSizeRandom interface { + Validation + // msg marshals FlowSizeRandom to protobuf object *otg.FlowSizeRandom + // and doesn't set defaults + msg() *otg.FlowSizeRandom + // setMsg unmarshals FlowSizeRandom from protobuf object *otg.FlowSizeRandom + // and doesn't set defaults + setMsg(*otg.FlowSizeRandom) FlowSizeRandom + // provides marshal interface + Marshal() marshalFlowSizeRandom + // provides unmarshal interface + Unmarshal() unMarshalFlowSizeRandom + // validate validates FlowSizeRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowSizeRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns uint32, set in FlowSizeRandom. + Min() uint32 + // SetMin assigns uint32 provided by user to FlowSizeRandom + SetMin(value uint32) FlowSizeRandom + // HasMin checks if Min has been set in FlowSizeRandom + HasMin() bool + // Max returns uint32, set in FlowSizeRandom. + Max() uint32 + // SetMax assigns uint32 provided by user to FlowSizeRandom + SetMax(value uint32) FlowSizeRandom + // HasMax checks if Max has been set in FlowSizeRandom + HasMax() bool +} + +// description is TBD +// Min returns a uint32 +func (obj *flowSizeRandom) Min() uint32 { + + return *obj.obj.Min + +} + +// description is TBD +// Min returns a uint32 +func (obj *flowSizeRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// description is TBD +// SetMin sets the uint32 value in the FlowSizeRandom object +func (obj *flowSizeRandom) SetMin(value uint32) FlowSizeRandom { + + obj.obj.Min = &value + return obj +} + +// description is TBD +// Max returns a uint32 +func (obj *flowSizeRandom) Max() uint32 { + + return *obj.obj.Max + +} + +// description is TBD +// Max returns a uint32 +func (obj *flowSizeRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// description is TBD +// SetMax sets the uint32 value in the FlowSizeRandom object +func (obj *flowSizeRandom) SetMax(value uint32) FlowSizeRandom { + + obj.obj.Max = &value + return obj +} + +func (obj *flowSizeRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *flowSizeRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin(64) + } + if obj.obj.Max == nil { + obj.SetMax(1518) + } + +} diff --git a/gosnappi/flow_size_weight_pairs.go b/gosnappi/flow_size_weight_pairs.go new file mode 100644 index 00000000..ca427cc9 --- /dev/null +++ b/gosnappi/flow_size_weight_pairs.go @@ -0,0 +1,526 @@ +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" +) + +// ***** FlowSizeWeightPairs ***** +type flowSizeWeightPairs struct { + validation + obj *otg.FlowSizeWeightPairs + marshaller marshalFlowSizeWeightPairs + unMarshaller unMarshalFlowSizeWeightPairs + customHolder FlowSizeWeightPairsFlowSizeWeightPairsCustomIter +} + +func NewFlowSizeWeightPairs() FlowSizeWeightPairs { + obj := flowSizeWeightPairs{obj: &otg.FlowSizeWeightPairs{}} + obj.setDefault() + return &obj +} + +func (obj *flowSizeWeightPairs) msg() *otg.FlowSizeWeightPairs { + return obj.obj +} + +func (obj *flowSizeWeightPairs) setMsg(msg *otg.FlowSizeWeightPairs) FlowSizeWeightPairs { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowSizeWeightPairs struct { + obj *flowSizeWeightPairs +} + +type marshalFlowSizeWeightPairs interface { + // ToProto marshals FlowSizeWeightPairs to protobuf object *otg.FlowSizeWeightPairs + ToProto() (*otg.FlowSizeWeightPairs, error) + // ToPbText marshals FlowSizeWeightPairs to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowSizeWeightPairs to YAML text + ToYaml() (string, error) + // ToJson marshals FlowSizeWeightPairs to JSON text + ToJson() (string, error) +} + +type unMarshalflowSizeWeightPairs struct { + obj *flowSizeWeightPairs +} + +type unMarshalFlowSizeWeightPairs interface { + // FromProto unmarshals FlowSizeWeightPairs from protobuf object *otg.FlowSizeWeightPairs + FromProto(msg *otg.FlowSizeWeightPairs) (FlowSizeWeightPairs, error) + // FromPbText unmarshals FlowSizeWeightPairs from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowSizeWeightPairs from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowSizeWeightPairs from JSON text + FromJson(value string) error +} + +func (obj *flowSizeWeightPairs) Marshal() marshalFlowSizeWeightPairs { + if obj.marshaller == nil { + obj.marshaller = &marshalflowSizeWeightPairs{obj: obj} + } + return obj.marshaller +} + +func (obj *flowSizeWeightPairs) Unmarshal() unMarshalFlowSizeWeightPairs { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowSizeWeightPairs{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowSizeWeightPairs) ToProto() (*otg.FlowSizeWeightPairs, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowSizeWeightPairs) FromProto(msg *otg.FlowSizeWeightPairs) (FlowSizeWeightPairs, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowSizeWeightPairs) 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 *unMarshalflowSizeWeightPairs) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowSizeWeightPairs) 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 *unMarshalflowSizeWeightPairs) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowSizeWeightPairs) 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 *unMarshalflowSizeWeightPairs) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowSizeWeightPairs) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowSizeWeightPairs) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowSizeWeightPairs) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowSizeWeightPairs) Clone() (FlowSizeWeightPairs, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowSizeWeightPairs() + 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 +} + +func (obj *flowSizeWeightPairs) setNil() { + obj.customHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowSizeWeightPairs is frame size distribution, defined as pairs (including IMIX distribution). +// Frames are randomly generated such that the proportion of each frame size out of the total number of frames +// are matching with the weight value of the pair. However, as with any other probability +// distribution, the sample distribution is close to theoretical value only if the size of the sample is reasonably large. +// When the number of frames is very low the transmitted frames may not come close to the ratio described in the weight. +type FlowSizeWeightPairs interface { + Validation + // msg marshals FlowSizeWeightPairs to protobuf object *otg.FlowSizeWeightPairs + // and doesn't set defaults + msg() *otg.FlowSizeWeightPairs + // setMsg unmarshals FlowSizeWeightPairs from protobuf object *otg.FlowSizeWeightPairs + // and doesn't set defaults + setMsg(*otg.FlowSizeWeightPairs) FlowSizeWeightPairs + // provides marshal interface + Marshal() marshalFlowSizeWeightPairs + // provides unmarshal interface + Unmarshal() unMarshalFlowSizeWeightPairs + // validate validates FlowSizeWeightPairs + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowSizeWeightPairs, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowSizeWeightPairsChoiceEnum, set in FlowSizeWeightPairs + Choice() FlowSizeWeightPairsChoiceEnum + // setChoice assigns FlowSizeWeightPairsChoiceEnum provided by user to FlowSizeWeightPairs + setChoice(value FlowSizeWeightPairsChoiceEnum) FlowSizeWeightPairs + // HasChoice checks if Choice has been set in FlowSizeWeightPairs + HasChoice() bool + // Predefined returns FlowSizeWeightPairsPredefinedEnum, set in FlowSizeWeightPairs + Predefined() FlowSizeWeightPairsPredefinedEnum + // SetPredefined assigns FlowSizeWeightPairsPredefinedEnum provided by user to FlowSizeWeightPairs + SetPredefined(value FlowSizeWeightPairsPredefinedEnum) FlowSizeWeightPairs + // HasPredefined checks if Predefined has been set in FlowSizeWeightPairs + HasPredefined() bool + // Custom returns FlowSizeWeightPairsFlowSizeWeightPairsCustomIterIter, set in FlowSizeWeightPairs + Custom() FlowSizeWeightPairsFlowSizeWeightPairsCustomIter + setNil() +} + +type FlowSizeWeightPairsChoiceEnum string + +// Enum of Choice on FlowSizeWeightPairs +var FlowSizeWeightPairsChoice = struct { + PREDEFINED FlowSizeWeightPairsChoiceEnum + CUSTOM FlowSizeWeightPairsChoiceEnum +}{ + PREDEFINED: FlowSizeWeightPairsChoiceEnum("predefined"), + CUSTOM: FlowSizeWeightPairsChoiceEnum("custom"), +} + +func (obj *flowSizeWeightPairs) Choice() FlowSizeWeightPairsChoiceEnum { + return FlowSizeWeightPairsChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowSizeWeightPairs) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowSizeWeightPairs) setChoice(value FlowSizeWeightPairsChoiceEnum) FlowSizeWeightPairs { + intValue, ok := otg.FlowSizeWeightPairs_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowSizeWeightPairsChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowSizeWeightPairs_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Custom = nil + obj.customHolder = nil + obj.obj.Predefined = otg.FlowSizeWeightPairs_Predefined_unspecified.Enum() + + if value == FlowSizeWeightPairsChoice.CUSTOM { + obj.obj.Custom = []*otg.FlowSizeWeightPairsCustom{} + } + + return obj +} + +type FlowSizeWeightPairsPredefinedEnum string + +// Enum of Predefined on FlowSizeWeightPairs +var FlowSizeWeightPairsPredefined = struct { + IMIX FlowSizeWeightPairsPredefinedEnum + IPSEC_IMIX FlowSizeWeightPairsPredefinedEnum + IPV6_IMIX FlowSizeWeightPairsPredefinedEnum + STANDARD_IMIX FlowSizeWeightPairsPredefinedEnum + TCP_IMIX FlowSizeWeightPairsPredefinedEnum +}{ + IMIX: FlowSizeWeightPairsPredefinedEnum("imix"), + IPSEC_IMIX: FlowSizeWeightPairsPredefinedEnum("ipsec_imix"), + IPV6_IMIX: FlowSizeWeightPairsPredefinedEnum("ipv6_imix"), + STANDARD_IMIX: FlowSizeWeightPairsPredefinedEnum("standard_imix"), + TCP_IMIX: FlowSizeWeightPairsPredefinedEnum("tcp_imix"), +} + +func (obj *flowSizeWeightPairs) Predefined() FlowSizeWeightPairsPredefinedEnum { + return FlowSizeWeightPairsPredefinedEnum(obj.obj.Predefined.Enum().String()) +} + +// Specify predefined frame size distribution pairs (including IMIX distribution). +// The available predefined distribution pairs are: +// - IMIX (64:7, 570:4, and 1518:1) +// - IPSec IMIX (90:58.67, 92:2, 594:23.66 and 1418:15.67) +// - IPv6 IMIX (60:58.67, 496:2, 594:23.66 and 1518:15.67) +// - Standard IMIX (58:58.67, 62:2, 594:23.66 and 1518:15.67) +// - TCP IMIX (90:58.67, 92:2, 594:23.66 and 1518:15.67) +// Predefined returns a string +func (obj *flowSizeWeightPairs) HasPredefined() bool { + return obj.obj.Predefined != nil +} + +func (obj *flowSizeWeightPairs) SetPredefined(value FlowSizeWeightPairsPredefinedEnum) FlowSizeWeightPairs { + intValue, ok := otg.FlowSizeWeightPairs_Predefined_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowSizeWeightPairsPredefinedEnum", string(value))) + return obj + } + enumValue := otg.FlowSizeWeightPairs_Predefined_Enum(intValue) + obj.obj.Predefined = &enumValue + + return obj +} + +// description is TBD +// Custom returns a []FlowSizeWeightPairsCustom +func (obj *flowSizeWeightPairs) Custom() FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { + if len(obj.obj.Custom) == 0 { + obj.setChoice(FlowSizeWeightPairsChoice.CUSTOM) + } + if obj.customHolder == nil { + obj.customHolder = newFlowSizeWeightPairsFlowSizeWeightPairsCustomIter(&obj.obj.Custom).setMsg(obj) + } + return obj.customHolder +} + +type flowSizeWeightPairsFlowSizeWeightPairsCustomIter struct { + obj *flowSizeWeightPairs + flowSizeWeightPairsCustomSlice []FlowSizeWeightPairsCustom + fieldPtr *[]*otg.FlowSizeWeightPairsCustom +} + +func newFlowSizeWeightPairsFlowSizeWeightPairsCustomIter(ptr *[]*otg.FlowSizeWeightPairsCustom) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { + return &flowSizeWeightPairsFlowSizeWeightPairsCustomIter{fieldPtr: ptr} +} + +type FlowSizeWeightPairsFlowSizeWeightPairsCustomIter interface { + setMsg(*flowSizeWeightPairs) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter + Items() []FlowSizeWeightPairsCustom + Add() FlowSizeWeightPairsCustom + Append(items ...FlowSizeWeightPairsCustom) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter + Set(index int, newObj FlowSizeWeightPairsCustom) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter + Clear() FlowSizeWeightPairsFlowSizeWeightPairsCustomIter + clearHolderSlice() FlowSizeWeightPairsFlowSizeWeightPairsCustomIter + appendHolderSlice(item FlowSizeWeightPairsCustom) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter +} + +func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) setMsg(msg *flowSizeWeightPairs) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flowSizeWeightPairsCustom{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) Items() []FlowSizeWeightPairsCustom { + return obj.flowSizeWeightPairsCustomSlice +} + +func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) Add() FlowSizeWeightPairsCustom { + newObj := &otg.FlowSizeWeightPairsCustom{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flowSizeWeightPairsCustom{obj: newObj} + newLibObj.setDefault() + obj.flowSizeWeightPairsCustomSlice = append(obj.flowSizeWeightPairsCustomSlice, newLibObj) + return newLibObj +} + +func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) Append(items ...FlowSizeWeightPairsCustom) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowSizeWeightPairsCustomSlice = append(obj.flowSizeWeightPairsCustomSlice, item) + } + return obj +} + +func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) Set(index int, newObj FlowSizeWeightPairsCustom) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowSizeWeightPairsCustomSlice[index] = newObj + return obj +} +func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) Clear() FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.FlowSizeWeightPairsCustom{} + obj.flowSizeWeightPairsCustomSlice = []FlowSizeWeightPairsCustom{} + } + return obj +} +func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) clearHolderSlice() FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { + if len(obj.flowSizeWeightPairsCustomSlice) > 0 { + obj.flowSizeWeightPairsCustomSlice = []FlowSizeWeightPairsCustom{} + } + return obj +} +func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) appendHolderSlice(item FlowSizeWeightPairsCustom) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { + obj.flowSizeWeightPairsCustomSlice = append(obj.flowSizeWeightPairsCustomSlice, item) + return obj +} + +func (obj *flowSizeWeightPairs) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Custom) != 0 { + + if set_default { + obj.Custom().clearHolderSlice() + for _, item := range obj.obj.Custom { + obj.Custom().appendHolderSlice(&flowSizeWeightPairsCustom{obj: item}) + } + } + for _, item := range obj.Custom().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *flowSizeWeightPairs) setDefault() { + var choices_set int = 0 + var choice FlowSizeWeightPairsChoiceEnum + + if obj.obj.Predefined != nil && obj.obj.Predefined.Number() != 0 { + choices_set += 1 + choice = FlowSizeWeightPairsChoice.PREDEFINED + } + + if len(obj.obj.Custom) > 0 { + choices_set += 1 + choice = FlowSizeWeightPairsChoice.CUSTOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowSizeWeightPairsChoice.PREDEFINED) + if obj.obj.Predefined.Number() == 0 { + obj.SetPredefined(FlowSizeWeightPairsPredefined.IMIX) + + } + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowSizeWeightPairs") + } + } else { + intVal := otg.FlowSizeWeightPairs_Choice_Enum_value[string(choice)] + enumValue := otg.FlowSizeWeightPairs_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_size_weight_pairs_custom.go b/gosnappi/flow_size_weight_pairs_custom.go new file mode 100644 index 00000000..5c8b4779 --- /dev/null +++ b/gosnappi/flow_size_weight_pairs_custom.go @@ -0,0 +1,353 @@ +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" +) + +// ***** FlowSizeWeightPairsCustom ***** +type flowSizeWeightPairsCustom struct { + validation + obj *otg.FlowSizeWeightPairsCustom + marshaller marshalFlowSizeWeightPairsCustom + unMarshaller unMarshalFlowSizeWeightPairsCustom +} + +func NewFlowSizeWeightPairsCustom() FlowSizeWeightPairsCustom { + obj := flowSizeWeightPairsCustom{obj: &otg.FlowSizeWeightPairsCustom{}} + obj.setDefault() + return &obj +} + +func (obj *flowSizeWeightPairsCustom) msg() *otg.FlowSizeWeightPairsCustom { + return obj.obj +} + +func (obj *flowSizeWeightPairsCustom) setMsg(msg *otg.FlowSizeWeightPairsCustom) FlowSizeWeightPairsCustom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowSizeWeightPairsCustom struct { + obj *flowSizeWeightPairsCustom +} + +type marshalFlowSizeWeightPairsCustom interface { + // ToProto marshals FlowSizeWeightPairsCustom to protobuf object *otg.FlowSizeWeightPairsCustom + ToProto() (*otg.FlowSizeWeightPairsCustom, error) + // ToPbText marshals FlowSizeWeightPairsCustom to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowSizeWeightPairsCustom to YAML text + ToYaml() (string, error) + // ToJson marshals FlowSizeWeightPairsCustom to JSON text + ToJson() (string, error) +} + +type unMarshalflowSizeWeightPairsCustom struct { + obj *flowSizeWeightPairsCustom +} + +type unMarshalFlowSizeWeightPairsCustom interface { + // FromProto unmarshals FlowSizeWeightPairsCustom from protobuf object *otg.FlowSizeWeightPairsCustom + FromProto(msg *otg.FlowSizeWeightPairsCustom) (FlowSizeWeightPairsCustom, error) + // FromPbText unmarshals FlowSizeWeightPairsCustom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowSizeWeightPairsCustom from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowSizeWeightPairsCustom from JSON text + FromJson(value string) error +} + +func (obj *flowSizeWeightPairsCustom) Marshal() marshalFlowSizeWeightPairsCustom { + if obj.marshaller == nil { + obj.marshaller = &marshalflowSizeWeightPairsCustom{obj: obj} + } + return obj.marshaller +} + +func (obj *flowSizeWeightPairsCustom) Unmarshal() unMarshalFlowSizeWeightPairsCustom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowSizeWeightPairsCustom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowSizeWeightPairsCustom) ToProto() (*otg.FlowSizeWeightPairsCustom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowSizeWeightPairsCustom) FromProto(msg *otg.FlowSizeWeightPairsCustom) (FlowSizeWeightPairsCustom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowSizeWeightPairsCustom) 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 *unMarshalflowSizeWeightPairsCustom) 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 *marshalflowSizeWeightPairsCustom) 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 *unMarshalflowSizeWeightPairsCustom) 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 *marshalflowSizeWeightPairsCustom) 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 *unMarshalflowSizeWeightPairsCustom) 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 *flowSizeWeightPairsCustom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowSizeWeightPairsCustom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowSizeWeightPairsCustom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowSizeWeightPairsCustom) Clone() (FlowSizeWeightPairsCustom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowSizeWeightPairsCustom() + 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 +} + +// FlowSizeWeightPairsCustom is custom frame size distribution pair. +type FlowSizeWeightPairsCustom interface { + Validation + // msg marshals FlowSizeWeightPairsCustom to protobuf object *otg.FlowSizeWeightPairsCustom + // and doesn't set defaults + msg() *otg.FlowSizeWeightPairsCustom + // setMsg unmarshals FlowSizeWeightPairsCustom from protobuf object *otg.FlowSizeWeightPairsCustom + // and doesn't set defaults + setMsg(*otg.FlowSizeWeightPairsCustom) FlowSizeWeightPairsCustom + // provides marshal interface + Marshal() marshalFlowSizeWeightPairsCustom + // provides unmarshal interface + Unmarshal() unMarshalFlowSizeWeightPairsCustom + // validate validates FlowSizeWeightPairsCustom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowSizeWeightPairsCustom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Size returns uint32, set in FlowSizeWeightPairsCustom. + Size() uint32 + // SetSize assigns uint32 provided by user to FlowSizeWeightPairsCustom + SetSize(value uint32) FlowSizeWeightPairsCustom + // HasSize checks if Size has been set in FlowSizeWeightPairsCustom + HasSize() bool + // Weight returns float32, set in FlowSizeWeightPairsCustom. + Weight() float32 + // SetWeight assigns float32 provided by user to FlowSizeWeightPairsCustom + SetWeight(value float32) FlowSizeWeightPairsCustom + // HasWeight checks if Weight has been set in FlowSizeWeightPairsCustom + HasWeight() bool +} + +// The size of the frame (in bytes) for this weight pair. +// Size returns a uint32 +func (obj *flowSizeWeightPairsCustom) Size() uint32 { + + return *obj.obj.Size + +} + +// The size of the frame (in bytes) for this weight pair. +// Size returns a uint32 +func (obj *flowSizeWeightPairsCustom) HasSize() bool { + return obj.obj.Size != nil +} + +// The size of the frame (in bytes) for this weight pair. +// SetSize sets the uint32 value in the FlowSizeWeightPairsCustom object +func (obj *flowSizeWeightPairsCustom) SetSize(value uint32) FlowSizeWeightPairsCustom { + + obj.obj.Size = &value + return obj +} + +// Weight assigned to the corresponding frame size in this weight pair. +// Higher weight means more packets. +// Weight returns a float32 +func (obj *flowSizeWeightPairsCustom) Weight() float32 { + + return *obj.obj.Weight + +} + +// Weight assigned to the corresponding frame size in this weight pair. +// Higher weight means more packets. +// Weight returns a float32 +func (obj *flowSizeWeightPairsCustom) HasWeight() bool { + return obj.obj.Weight != nil +} + +// Weight assigned to the corresponding frame size in this weight pair. +// Higher weight means more packets. +// SetWeight sets the float32 value in the FlowSizeWeightPairsCustom object +func (obj *flowSizeWeightPairsCustom) SetWeight(value float32) FlowSizeWeightPairsCustom { + + obj.obj.Weight = &value + return obj +} + +func (obj *flowSizeWeightPairsCustom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Size != nil { + + if *obj.obj.Size < 12 || *obj.obj.Size > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("12 <= FlowSizeWeightPairsCustom.Size <= 65535 but Got %d", *obj.obj.Size)) + } + + } + +} + +func (obj *flowSizeWeightPairsCustom) setDefault() { + if obj.obj.Size == nil { + obj.SetSize(64) + } + if obj.obj.Weight == nil { + obj.SetWeight(1) + } + +} diff --git a/gosnappi/flow_snmpv2_c.go b/gosnappi/flow_snmpv2_c.go new file mode 100644 index 00000000..d31c065b --- /dev/null +++ b/gosnappi/flow_snmpv2_c.go @@ -0,0 +1,407 @@ +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" +) + +// ***** FlowSnmpv2C ***** +type flowSnmpv2C struct { + validation + obj *otg.FlowSnmpv2C + marshaller marshalFlowSnmpv2C + unMarshaller unMarshalFlowSnmpv2C + versionHolder PatternFlowSnmpv2CVersion + dataHolder FlowSnmpv2CData +} + +func NewFlowSnmpv2C() FlowSnmpv2C { + obj := flowSnmpv2C{obj: &otg.FlowSnmpv2C{}} + obj.setDefault() + return &obj +} + +func (obj *flowSnmpv2C) msg() *otg.FlowSnmpv2C { + return obj.obj +} + +func (obj *flowSnmpv2C) setMsg(msg *otg.FlowSnmpv2C) FlowSnmpv2C { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowSnmpv2C struct { + obj *flowSnmpv2C +} + +type marshalFlowSnmpv2C interface { + // ToProto marshals FlowSnmpv2C to protobuf object *otg.FlowSnmpv2C + ToProto() (*otg.FlowSnmpv2C, error) + // ToPbText marshals FlowSnmpv2C to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowSnmpv2C to YAML text + ToYaml() (string, error) + // ToJson marshals FlowSnmpv2C to JSON text + ToJson() (string, error) +} + +type unMarshalflowSnmpv2C struct { + obj *flowSnmpv2C +} + +type unMarshalFlowSnmpv2C interface { + // FromProto unmarshals FlowSnmpv2C from protobuf object *otg.FlowSnmpv2C + FromProto(msg *otg.FlowSnmpv2C) (FlowSnmpv2C, error) + // FromPbText unmarshals FlowSnmpv2C from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowSnmpv2C from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowSnmpv2C from JSON text + FromJson(value string) error +} + +func (obj *flowSnmpv2C) Marshal() marshalFlowSnmpv2C { + if obj.marshaller == nil { + obj.marshaller = &marshalflowSnmpv2C{obj: obj} + } + return obj.marshaller +} + +func (obj *flowSnmpv2C) Unmarshal() unMarshalFlowSnmpv2C { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowSnmpv2C{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowSnmpv2C) ToProto() (*otg.FlowSnmpv2C, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowSnmpv2C) FromProto(msg *otg.FlowSnmpv2C) (FlowSnmpv2C, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowSnmpv2C) 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 *unMarshalflowSnmpv2C) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowSnmpv2C) 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 *unMarshalflowSnmpv2C) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowSnmpv2C) 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 *unMarshalflowSnmpv2C) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowSnmpv2C) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowSnmpv2C) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowSnmpv2C) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowSnmpv2C) Clone() (FlowSnmpv2C, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowSnmpv2C() + 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 +} + +func (obj *flowSnmpv2C) setNil() { + obj.versionHolder = nil + obj.dataHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowSnmpv2C is sNMPv2C packet header as defined in RFC1901 and RFC3416. +type FlowSnmpv2C interface { + Validation + // msg marshals FlowSnmpv2C to protobuf object *otg.FlowSnmpv2C + // and doesn't set defaults + msg() *otg.FlowSnmpv2C + // setMsg unmarshals FlowSnmpv2C from protobuf object *otg.FlowSnmpv2C + // and doesn't set defaults + setMsg(*otg.FlowSnmpv2C) FlowSnmpv2C + // provides marshal interface + Marshal() marshalFlowSnmpv2C + // provides unmarshal interface + Unmarshal() unMarshalFlowSnmpv2C + // validate validates FlowSnmpv2C + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowSnmpv2C, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Version returns PatternFlowSnmpv2CVersion, set in FlowSnmpv2C. + Version() PatternFlowSnmpv2CVersion + // SetVersion assigns PatternFlowSnmpv2CVersion provided by user to FlowSnmpv2C. + SetVersion(value PatternFlowSnmpv2CVersion) FlowSnmpv2C + // HasVersion checks if Version has been set in FlowSnmpv2C + HasVersion() bool + // Community returns string, set in FlowSnmpv2C. + Community() string + // SetCommunity assigns string provided by user to FlowSnmpv2C + SetCommunity(value string) FlowSnmpv2C + // HasCommunity checks if Community has been set in FlowSnmpv2C + HasCommunity() bool + // Data returns FlowSnmpv2CData, set in FlowSnmpv2C. + Data() FlowSnmpv2CData + // SetData assigns FlowSnmpv2CData provided by user to FlowSnmpv2C. + SetData(value FlowSnmpv2CData) FlowSnmpv2C + setNil() +} + +// description is TBD +// Version returns a PatternFlowSnmpv2CVersion +func (obj *flowSnmpv2C) Version() PatternFlowSnmpv2CVersion { + if obj.obj.Version == nil { + obj.obj.Version = NewPatternFlowSnmpv2CVersion().msg() + } + if obj.versionHolder == nil { + obj.versionHolder = &patternFlowSnmpv2CVersion{obj: obj.obj.Version} + } + return obj.versionHolder +} + +// description is TBD +// Version returns a PatternFlowSnmpv2CVersion +func (obj *flowSnmpv2C) HasVersion() bool { + return obj.obj.Version != nil +} + +// description is TBD +// SetVersion sets the PatternFlowSnmpv2CVersion value in the FlowSnmpv2C object +func (obj *flowSnmpv2C) SetVersion(value PatternFlowSnmpv2CVersion) FlowSnmpv2C { + + obj.versionHolder = nil + obj.obj.Version = value.msg() + + return obj +} + +// It is an ASCII based octet string which identifies the SNMP community in which the sender and recipient of this message are located. It should match the read-only or read-write community string configured on the recipient for the PDU to be accepted. +// Community returns a string +func (obj *flowSnmpv2C) Community() string { + + return *obj.obj.Community + +} + +// It is an ASCII based octet string which identifies the SNMP community in which the sender and recipient of this message are located. It should match the read-only or read-write community string configured on the recipient for the PDU to be accepted. +// Community returns a string +func (obj *flowSnmpv2C) HasCommunity() bool { + return obj.obj.Community != nil +} + +// It is an ASCII based octet string which identifies the SNMP community in which the sender and recipient of this message are located. It should match the read-only or read-write community string configured on the recipient for the PDU to be accepted. +// SetCommunity sets the string value in the FlowSnmpv2C object +func (obj *flowSnmpv2C) SetCommunity(value string) FlowSnmpv2C { + + obj.obj.Community = &value + return obj +} + +// description is TBD +// Data returns a FlowSnmpv2CData +func (obj *flowSnmpv2C) Data() FlowSnmpv2CData { + if obj.obj.Data == nil { + obj.obj.Data = NewFlowSnmpv2CData().msg() + } + if obj.dataHolder == nil { + obj.dataHolder = &flowSnmpv2CData{obj: obj.obj.Data} + } + return obj.dataHolder +} + +// description is TBD +// SetData sets the FlowSnmpv2CData value in the FlowSnmpv2C object +func (obj *flowSnmpv2C) SetData(value FlowSnmpv2CData) FlowSnmpv2C { + + obj.dataHolder = nil + obj.obj.Data = value.msg() + + return obj +} + +func (obj *flowSnmpv2C) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Version != nil { + + obj.Version().validateObj(vObj, set_default) + } + + if obj.obj.Community != nil { + + if len(*obj.obj.Community) > 10000 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "None <= length of FlowSnmpv2C.Community <= 10000 but Got %d", + len(*obj.obj.Community))) + } + + } + + // Data is required + if obj.obj.Data == nil { + vObj.validationErrors = append(vObj.validationErrors, "Data is required field on interface FlowSnmpv2C") + } + + if obj.obj.Data != nil { + + obj.Data().validateObj(vObj, set_default) + } + +} + +func (obj *flowSnmpv2C) setDefault() { + if obj.obj.Community == nil { + obj.SetCommunity("community") + } + +} diff --git a/gosnappi/flow_snmpv2_c_bulk_pdu.go b/gosnappi/flow_snmpv2_c_bulk_pdu.go new file mode 100644 index 00000000..b8f393d1 --- /dev/null +++ b/gosnappi/flow_snmpv2_c_bulk_pdu.go @@ -0,0 +1,513 @@ +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" +) + +// ***** FlowSnmpv2CBulkPDU ***** +type flowSnmpv2CBulkPDU struct { + validation + obj *otg.FlowSnmpv2CBulkPDU + marshaller marshalFlowSnmpv2CBulkPDU + unMarshaller unMarshalFlowSnmpv2CBulkPDU + requestIdHolder PatternFlowSnmpv2CBulkPDURequestId + nonRepeatersHolder PatternFlowSnmpv2CBulkPDUNonRepeaters + maxRepetitionsHolder PatternFlowSnmpv2CBulkPDUMaxRepetitions + variableBindingsHolder FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter +} + +func NewFlowSnmpv2CBulkPDU() FlowSnmpv2CBulkPDU { + obj := flowSnmpv2CBulkPDU{obj: &otg.FlowSnmpv2CBulkPDU{}} + obj.setDefault() + return &obj +} + +func (obj *flowSnmpv2CBulkPDU) msg() *otg.FlowSnmpv2CBulkPDU { + return obj.obj +} + +func (obj *flowSnmpv2CBulkPDU) setMsg(msg *otg.FlowSnmpv2CBulkPDU) FlowSnmpv2CBulkPDU { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowSnmpv2CBulkPDU struct { + obj *flowSnmpv2CBulkPDU +} + +type marshalFlowSnmpv2CBulkPDU interface { + // ToProto marshals FlowSnmpv2CBulkPDU to protobuf object *otg.FlowSnmpv2CBulkPDU + ToProto() (*otg.FlowSnmpv2CBulkPDU, error) + // ToPbText marshals FlowSnmpv2CBulkPDU to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowSnmpv2CBulkPDU to YAML text + ToYaml() (string, error) + // ToJson marshals FlowSnmpv2CBulkPDU to JSON text + ToJson() (string, error) +} + +type unMarshalflowSnmpv2CBulkPDU struct { + obj *flowSnmpv2CBulkPDU +} + +type unMarshalFlowSnmpv2CBulkPDU interface { + // FromProto unmarshals FlowSnmpv2CBulkPDU from protobuf object *otg.FlowSnmpv2CBulkPDU + FromProto(msg *otg.FlowSnmpv2CBulkPDU) (FlowSnmpv2CBulkPDU, error) + // FromPbText unmarshals FlowSnmpv2CBulkPDU from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowSnmpv2CBulkPDU from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowSnmpv2CBulkPDU from JSON text + FromJson(value string) error +} + +func (obj *flowSnmpv2CBulkPDU) Marshal() marshalFlowSnmpv2CBulkPDU { + if obj.marshaller == nil { + obj.marshaller = &marshalflowSnmpv2CBulkPDU{obj: obj} + } + return obj.marshaller +} + +func (obj *flowSnmpv2CBulkPDU) Unmarshal() unMarshalFlowSnmpv2CBulkPDU { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowSnmpv2CBulkPDU{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowSnmpv2CBulkPDU) ToProto() (*otg.FlowSnmpv2CBulkPDU, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowSnmpv2CBulkPDU) FromProto(msg *otg.FlowSnmpv2CBulkPDU) (FlowSnmpv2CBulkPDU, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowSnmpv2CBulkPDU) 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 *unMarshalflowSnmpv2CBulkPDU) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowSnmpv2CBulkPDU) 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 *unMarshalflowSnmpv2CBulkPDU) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowSnmpv2CBulkPDU) 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 *unMarshalflowSnmpv2CBulkPDU) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowSnmpv2CBulkPDU) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowSnmpv2CBulkPDU) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowSnmpv2CBulkPDU) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowSnmpv2CBulkPDU) Clone() (FlowSnmpv2CBulkPDU, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowSnmpv2CBulkPDU() + 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 +} + +func (obj *flowSnmpv2CBulkPDU) setNil() { + obj.requestIdHolder = nil + obj.nonRepeatersHolder = nil + obj.maxRepetitionsHolder = nil + obj.variableBindingsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowSnmpv2CBulkPDU is the purpose of the GetBulkRequest-PDU is to request the transfer of a potentially large amount of data, including, but not limited to, the efficient and rapid retrieval of large tables. +type FlowSnmpv2CBulkPDU interface { + Validation + // msg marshals FlowSnmpv2CBulkPDU to protobuf object *otg.FlowSnmpv2CBulkPDU + // and doesn't set defaults + msg() *otg.FlowSnmpv2CBulkPDU + // setMsg unmarshals FlowSnmpv2CBulkPDU from protobuf object *otg.FlowSnmpv2CBulkPDU + // and doesn't set defaults + setMsg(*otg.FlowSnmpv2CBulkPDU) FlowSnmpv2CBulkPDU + // provides marshal interface + Marshal() marshalFlowSnmpv2CBulkPDU + // provides unmarshal interface + Unmarshal() unMarshalFlowSnmpv2CBulkPDU + // validate validates FlowSnmpv2CBulkPDU + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowSnmpv2CBulkPDU, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RequestId returns PatternFlowSnmpv2CBulkPDURequestId, set in FlowSnmpv2CBulkPDU. + RequestId() PatternFlowSnmpv2CBulkPDURequestId + // SetRequestId assigns PatternFlowSnmpv2CBulkPDURequestId provided by user to FlowSnmpv2CBulkPDU. + SetRequestId(value PatternFlowSnmpv2CBulkPDURequestId) FlowSnmpv2CBulkPDU + // HasRequestId checks if RequestId has been set in FlowSnmpv2CBulkPDU + HasRequestId() bool + // NonRepeaters returns PatternFlowSnmpv2CBulkPDUNonRepeaters, set in FlowSnmpv2CBulkPDU. + NonRepeaters() PatternFlowSnmpv2CBulkPDUNonRepeaters + // SetNonRepeaters assigns PatternFlowSnmpv2CBulkPDUNonRepeaters provided by user to FlowSnmpv2CBulkPDU. + SetNonRepeaters(value PatternFlowSnmpv2CBulkPDUNonRepeaters) FlowSnmpv2CBulkPDU + // HasNonRepeaters checks if NonRepeaters has been set in FlowSnmpv2CBulkPDU + HasNonRepeaters() bool + // MaxRepetitions returns PatternFlowSnmpv2CBulkPDUMaxRepetitions, set in FlowSnmpv2CBulkPDU. + MaxRepetitions() PatternFlowSnmpv2CBulkPDUMaxRepetitions + // SetMaxRepetitions assigns PatternFlowSnmpv2CBulkPDUMaxRepetitions provided by user to FlowSnmpv2CBulkPDU. + SetMaxRepetitions(value PatternFlowSnmpv2CBulkPDUMaxRepetitions) FlowSnmpv2CBulkPDU + // HasMaxRepetitions checks if MaxRepetitions has been set in FlowSnmpv2CBulkPDU + HasMaxRepetitions() bool + // VariableBindings returns FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIterIter, set in FlowSnmpv2CBulkPDU + VariableBindings() FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter + setNil() +} + +// description is TBD +// RequestId returns a PatternFlowSnmpv2CBulkPDURequestId +func (obj *flowSnmpv2CBulkPDU) RequestId() PatternFlowSnmpv2CBulkPDURequestId { + if obj.obj.RequestId == nil { + obj.obj.RequestId = NewPatternFlowSnmpv2CBulkPDURequestId().msg() + } + if obj.requestIdHolder == nil { + obj.requestIdHolder = &patternFlowSnmpv2CBulkPDURequestId{obj: obj.obj.RequestId} + } + return obj.requestIdHolder +} + +// description is TBD +// RequestId returns a PatternFlowSnmpv2CBulkPDURequestId +func (obj *flowSnmpv2CBulkPDU) HasRequestId() bool { + return obj.obj.RequestId != nil +} + +// description is TBD +// SetRequestId sets the PatternFlowSnmpv2CBulkPDURequestId value in the FlowSnmpv2CBulkPDU object +func (obj *flowSnmpv2CBulkPDU) SetRequestId(value PatternFlowSnmpv2CBulkPDURequestId) FlowSnmpv2CBulkPDU { + + obj.requestIdHolder = nil + obj.obj.RequestId = value.msg() + + return obj +} + +// description is TBD +// NonRepeaters returns a PatternFlowSnmpv2CBulkPDUNonRepeaters +func (obj *flowSnmpv2CBulkPDU) NonRepeaters() PatternFlowSnmpv2CBulkPDUNonRepeaters { + if obj.obj.NonRepeaters == nil { + obj.obj.NonRepeaters = NewPatternFlowSnmpv2CBulkPDUNonRepeaters().msg() + } + if obj.nonRepeatersHolder == nil { + obj.nonRepeatersHolder = &patternFlowSnmpv2CBulkPDUNonRepeaters{obj: obj.obj.NonRepeaters} + } + return obj.nonRepeatersHolder +} + +// description is TBD +// NonRepeaters returns a PatternFlowSnmpv2CBulkPDUNonRepeaters +func (obj *flowSnmpv2CBulkPDU) HasNonRepeaters() bool { + return obj.obj.NonRepeaters != nil +} + +// description is TBD +// SetNonRepeaters sets the PatternFlowSnmpv2CBulkPDUNonRepeaters value in the FlowSnmpv2CBulkPDU object +func (obj *flowSnmpv2CBulkPDU) SetNonRepeaters(value PatternFlowSnmpv2CBulkPDUNonRepeaters) FlowSnmpv2CBulkPDU { + + obj.nonRepeatersHolder = nil + obj.obj.NonRepeaters = value.msg() + + return obj +} + +// description is TBD +// MaxRepetitions returns a PatternFlowSnmpv2CBulkPDUMaxRepetitions +func (obj *flowSnmpv2CBulkPDU) MaxRepetitions() PatternFlowSnmpv2CBulkPDUMaxRepetitions { + if obj.obj.MaxRepetitions == nil { + obj.obj.MaxRepetitions = NewPatternFlowSnmpv2CBulkPDUMaxRepetitions().msg() + } + if obj.maxRepetitionsHolder == nil { + obj.maxRepetitionsHolder = &patternFlowSnmpv2CBulkPDUMaxRepetitions{obj: obj.obj.MaxRepetitions} + } + return obj.maxRepetitionsHolder +} + +// description is TBD +// MaxRepetitions returns a PatternFlowSnmpv2CBulkPDUMaxRepetitions +func (obj *flowSnmpv2CBulkPDU) HasMaxRepetitions() bool { + return obj.obj.MaxRepetitions != nil +} + +// description is TBD +// SetMaxRepetitions sets the PatternFlowSnmpv2CBulkPDUMaxRepetitions value in the FlowSnmpv2CBulkPDU object +func (obj *flowSnmpv2CBulkPDU) SetMaxRepetitions(value PatternFlowSnmpv2CBulkPDUMaxRepetitions) FlowSnmpv2CBulkPDU { + + obj.maxRepetitionsHolder = nil + obj.obj.MaxRepetitions = value.msg() + + return obj +} + +// A Sequence of variable_bindings. +// VariableBindings returns a []FlowSnmpv2CVariableBinding +func (obj *flowSnmpv2CBulkPDU) VariableBindings() FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { + if len(obj.obj.VariableBindings) == 0 { + obj.obj.VariableBindings = []*otg.FlowSnmpv2CVariableBinding{} + } + if obj.variableBindingsHolder == nil { + obj.variableBindingsHolder = newFlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter(&obj.obj.VariableBindings).setMsg(obj) + } + return obj.variableBindingsHolder +} + +type flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter struct { + obj *flowSnmpv2CBulkPDU + flowSnmpv2CVariableBindingSlice []FlowSnmpv2CVariableBinding + fieldPtr *[]*otg.FlowSnmpv2CVariableBinding +} + +func newFlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter(ptr *[]*otg.FlowSnmpv2CVariableBinding) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { + return &flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter{fieldPtr: ptr} +} + +type FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter interface { + setMsg(*flowSnmpv2CBulkPDU) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter + Items() []FlowSnmpv2CVariableBinding + Add() FlowSnmpv2CVariableBinding + Append(items ...FlowSnmpv2CVariableBinding) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter + Set(index int, newObj FlowSnmpv2CVariableBinding) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter + Clear() FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter + clearHolderSlice() FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter + appendHolderSlice(item FlowSnmpv2CVariableBinding) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter +} + +func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) setMsg(msg *flowSnmpv2CBulkPDU) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flowSnmpv2CVariableBinding{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) Items() []FlowSnmpv2CVariableBinding { + return obj.flowSnmpv2CVariableBindingSlice +} + +func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) Add() FlowSnmpv2CVariableBinding { + newObj := &otg.FlowSnmpv2CVariableBinding{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flowSnmpv2CVariableBinding{obj: newObj} + newLibObj.setDefault() + obj.flowSnmpv2CVariableBindingSlice = append(obj.flowSnmpv2CVariableBindingSlice, newLibObj) + return newLibObj +} + +func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) Append(items ...FlowSnmpv2CVariableBinding) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowSnmpv2CVariableBindingSlice = append(obj.flowSnmpv2CVariableBindingSlice, item) + } + return obj +} + +func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) Set(index int, newObj FlowSnmpv2CVariableBinding) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowSnmpv2CVariableBindingSlice[index] = newObj + return obj +} +func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) Clear() FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.FlowSnmpv2CVariableBinding{} + obj.flowSnmpv2CVariableBindingSlice = []FlowSnmpv2CVariableBinding{} + } + return obj +} +func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) clearHolderSlice() FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { + if len(obj.flowSnmpv2CVariableBindingSlice) > 0 { + obj.flowSnmpv2CVariableBindingSlice = []FlowSnmpv2CVariableBinding{} + } + return obj +} +func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) appendHolderSlice(item FlowSnmpv2CVariableBinding) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { + obj.flowSnmpv2CVariableBindingSlice = append(obj.flowSnmpv2CVariableBindingSlice, item) + return obj +} + +func (obj *flowSnmpv2CBulkPDU) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RequestId != nil { + + obj.RequestId().validateObj(vObj, set_default) + } + + if obj.obj.NonRepeaters != nil { + + obj.NonRepeaters().validateObj(vObj, set_default) + } + + if obj.obj.MaxRepetitions != nil { + + obj.MaxRepetitions().validateObj(vObj, set_default) + } + + if len(obj.obj.VariableBindings) != 0 { + + if set_default { + obj.VariableBindings().clearHolderSlice() + for _, item := range obj.obj.VariableBindings { + obj.VariableBindings().appendHolderSlice(&flowSnmpv2CVariableBinding{obj: item}) + } + } + for _, item := range obj.VariableBindings().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *flowSnmpv2CBulkPDU) setDefault() { + +} diff --git a/gosnappi/flow_snmpv2_c_data.go b/gosnappi/flow_snmpv2_c_data.go new file mode 100644 index 00000000..4b31a2e4 --- /dev/null +++ b/gosnappi/flow_snmpv2_c_data.go @@ -0,0 +1,766 @@ +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" +) + +// ***** FlowSnmpv2CData ***** +type flowSnmpv2CData struct { + validation + obj *otg.FlowSnmpv2CData + marshaller marshalFlowSnmpv2CData + unMarshaller unMarshalFlowSnmpv2CData + getRequestHolder FlowSnmpv2CPDU + getNextRequestHolder FlowSnmpv2CPDU + responseHolder FlowSnmpv2CPDU + setRequestHolder FlowSnmpv2CPDU + getBulkRequestHolder FlowSnmpv2CBulkPDU + informRequestHolder FlowSnmpv2CPDU + snmpv2TrapHolder FlowSnmpv2CPDU + reportHolder FlowSnmpv2CPDU +} + +func NewFlowSnmpv2CData() FlowSnmpv2CData { + obj := flowSnmpv2CData{obj: &otg.FlowSnmpv2CData{}} + obj.setDefault() + return &obj +} + +func (obj *flowSnmpv2CData) msg() *otg.FlowSnmpv2CData { + return obj.obj +} + +func (obj *flowSnmpv2CData) setMsg(msg *otg.FlowSnmpv2CData) FlowSnmpv2CData { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowSnmpv2CData struct { + obj *flowSnmpv2CData +} + +type marshalFlowSnmpv2CData interface { + // ToProto marshals FlowSnmpv2CData to protobuf object *otg.FlowSnmpv2CData + ToProto() (*otg.FlowSnmpv2CData, error) + // ToPbText marshals FlowSnmpv2CData to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowSnmpv2CData to YAML text + ToYaml() (string, error) + // ToJson marshals FlowSnmpv2CData to JSON text + ToJson() (string, error) +} + +type unMarshalflowSnmpv2CData struct { + obj *flowSnmpv2CData +} + +type unMarshalFlowSnmpv2CData interface { + // FromProto unmarshals FlowSnmpv2CData from protobuf object *otg.FlowSnmpv2CData + FromProto(msg *otg.FlowSnmpv2CData) (FlowSnmpv2CData, error) + // FromPbText unmarshals FlowSnmpv2CData from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowSnmpv2CData from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowSnmpv2CData from JSON text + FromJson(value string) error +} + +func (obj *flowSnmpv2CData) Marshal() marshalFlowSnmpv2CData { + if obj.marshaller == nil { + obj.marshaller = &marshalflowSnmpv2CData{obj: obj} + } + return obj.marshaller +} + +func (obj *flowSnmpv2CData) Unmarshal() unMarshalFlowSnmpv2CData { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowSnmpv2CData{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowSnmpv2CData) ToProto() (*otg.FlowSnmpv2CData, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowSnmpv2CData) FromProto(msg *otg.FlowSnmpv2CData) (FlowSnmpv2CData, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowSnmpv2CData) 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 *unMarshalflowSnmpv2CData) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowSnmpv2CData) 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 *unMarshalflowSnmpv2CData) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowSnmpv2CData) 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 *unMarshalflowSnmpv2CData) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowSnmpv2CData) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowSnmpv2CData) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowSnmpv2CData) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowSnmpv2CData) Clone() (FlowSnmpv2CData, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowSnmpv2CData() + 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 +} + +func (obj *flowSnmpv2CData) setNil() { + obj.getRequestHolder = nil + obj.getNextRequestHolder = nil + obj.responseHolder = nil + obj.setRequestHolder = nil + obj.getBulkRequestHolder = nil + obj.informRequestHolder = nil + obj.snmpv2TrapHolder = nil + obj.reportHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowSnmpv2CData is this contains the body of the SNMPv2C message. +// +// - Encoding of subsequent fields follow ASN.1 specification. +// Refer: http://www.itu.int/ITU-T/asn1 +type FlowSnmpv2CData interface { + Validation + // msg marshals FlowSnmpv2CData to protobuf object *otg.FlowSnmpv2CData + // and doesn't set defaults + msg() *otg.FlowSnmpv2CData + // setMsg unmarshals FlowSnmpv2CData from protobuf object *otg.FlowSnmpv2CData + // and doesn't set defaults + setMsg(*otg.FlowSnmpv2CData) FlowSnmpv2CData + // provides marshal interface + Marshal() marshalFlowSnmpv2CData + // provides unmarshal interface + Unmarshal() unMarshalFlowSnmpv2CData + // validate validates FlowSnmpv2CData + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowSnmpv2CData, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowSnmpv2CDataChoiceEnum, set in FlowSnmpv2CData + Choice() FlowSnmpv2CDataChoiceEnum + // setChoice assigns FlowSnmpv2CDataChoiceEnum provided by user to FlowSnmpv2CData + setChoice(value FlowSnmpv2CDataChoiceEnum) FlowSnmpv2CData + // GetRequest returns FlowSnmpv2CPDU, set in FlowSnmpv2CData. + GetRequest() FlowSnmpv2CPDU + // SetGetRequest assigns FlowSnmpv2CPDU provided by user to FlowSnmpv2CData. + SetGetRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData + // HasGetRequest checks if GetRequest has been set in FlowSnmpv2CData + HasGetRequest() bool + // GetNextRequest returns FlowSnmpv2CPDU, set in FlowSnmpv2CData. + GetNextRequest() FlowSnmpv2CPDU + // SetGetNextRequest assigns FlowSnmpv2CPDU provided by user to FlowSnmpv2CData. + SetGetNextRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData + // HasGetNextRequest checks if GetNextRequest has been set in FlowSnmpv2CData + HasGetNextRequest() bool + // Response returns FlowSnmpv2CPDU, set in FlowSnmpv2CData. + Response() FlowSnmpv2CPDU + // SetResponse assigns FlowSnmpv2CPDU provided by user to FlowSnmpv2CData. + SetResponse(value FlowSnmpv2CPDU) FlowSnmpv2CData + // HasResponse checks if Response has been set in FlowSnmpv2CData + HasResponse() bool + // SetRequest returns FlowSnmpv2CPDU, set in FlowSnmpv2CData. + SetRequest() FlowSnmpv2CPDU + // SetSetRequest assigns FlowSnmpv2CPDU provided by user to FlowSnmpv2CData. + SetSetRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData + // HasSetRequest checks if SetRequest has been set in FlowSnmpv2CData + HasSetRequest() bool + // GetBulkRequest returns FlowSnmpv2CBulkPDU, set in FlowSnmpv2CData. + GetBulkRequest() FlowSnmpv2CBulkPDU + // SetGetBulkRequest assigns FlowSnmpv2CBulkPDU provided by user to FlowSnmpv2CData. + SetGetBulkRequest(value FlowSnmpv2CBulkPDU) FlowSnmpv2CData + // HasGetBulkRequest checks if GetBulkRequest has been set in FlowSnmpv2CData + HasGetBulkRequest() bool + // InformRequest returns FlowSnmpv2CPDU, set in FlowSnmpv2CData. + InformRequest() FlowSnmpv2CPDU + // SetInformRequest assigns FlowSnmpv2CPDU provided by user to FlowSnmpv2CData. + SetInformRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData + // HasInformRequest checks if InformRequest has been set in FlowSnmpv2CData + HasInformRequest() bool + // Snmpv2Trap returns FlowSnmpv2CPDU, set in FlowSnmpv2CData. + Snmpv2Trap() FlowSnmpv2CPDU + // SetSnmpv2Trap assigns FlowSnmpv2CPDU provided by user to FlowSnmpv2CData. + SetSnmpv2Trap(value FlowSnmpv2CPDU) FlowSnmpv2CData + // HasSnmpv2Trap checks if Snmpv2Trap has been set in FlowSnmpv2CData + HasSnmpv2Trap() bool + // Report returns FlowSnmpv2CPDU, set in FlowSnmpv2CData. + Report() FlowSnmpv2CPDU + // SetReport assigns FlowSnmpv2CPDU provided by user to FlowSnmpv2CData. + SetReport(value FlowSnmpv2CPDU) FlowSnmpv2CData + // HasReport checks if Report has been set in FlowSnmpv2CData + HasReport() bool + setNil() +} + +type FlowSnmpv2CDataChoiceEnum string + +// Enum of Choice on FlowSnmpv2CData +var FlowSnmpv2CDataChoice = struct { + GET_REQUEST FlowSnmpv2CDataChoiceEnum + GET_NEXT_REQUEST FlowSnmpv2CDataChoiceEnum + RESPONSE FlowSnmpv2CDataChoiceEnum + SET_REQUEST FlowSnmpv2CDataChoiceEnum + GET_BULK_REQUEST FlowSnmpv2CDataChoiceEnum + INFORM_REQUEST FlowSnmpv2CDataChoiceEnum + SNMPV2_TRAP FlowSnmpv2CDataChoiceEnum + REPORT FlowSnmpv2CDataChoiceEnum +}{ + GET_REQUEST: FlowSnmpv2CDataChoiceEnum("get_request"), + GET_NEXT_REQUEST: FlowSnmpv2CDataChoiceEnum("get_next_request"), + RESPONSE: FlowSnmpv2CDataChoiceEnum("response"), + SET_REQUEST: FlowSnmpv2CDataChoiceEnum("set_request"), + GET_BULK_REQUEST: FlowSnmpv2CDataChoiceEnum("get_bulk_request"), + INFORM_REQUEST: FlowSnmpv2CDataChoiceEnum("inform_request"), + SNMPV2_TRAP: FlowSnmpv2CDataChoiceEnum("snmpv2_trap"), + REPORT: FlowSnmpv2CDataChoiceEnum("report"), +} + +func (obj *flowSnmpv2CData) Choice() FlowSnmpv2CDataChoiceEnum { + return FlowSnmpv2CDataChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *flowSnmpv2CData) setChoice(value FlowSnmpv2CDataChoiceEnum) FlowSnmpv2CData { + intValue, ok := otg.FlowSnmpv2CData_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowSnmpv2CDataChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowSnmpv2CData_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Report = nil + obj.reportHolder = nil + obj.obj.Snmpv2Trap = nil + obj.snmpv2TrapHolder = nil + obj.obj.InformRequest = nil + obj.informRequestHolder = nil + obj.obj.GetBulkRequest = nil + obj.getBulkRequestHolder = nil + obj.obj.SetRequest = nil + obj.setRequestHolder = nil + obj.obj.Response = nil + obj.responseHolder = nil + obj.obj.GetNextRequest = nil + obj.getNextRequestHolder = nil + obj.obj.GetRequest = nil + obj.getRequestHolder = nil + + if value == FlowSnmpv2CDataChoice.GET_REQUEST { + obj.obj.GetRequest = NewFlowSnmpv2CPDU().msg() + } + + if value == FlowSnmpv2CDataChoice.GET_NEXT_REQUEST { + obj.obj.GetNextRequest = NewFlowSnmpv2CPDU().msg() + } + + if value == FlowSnmpv2CDataChoice.RESPONSE { + obj.obj.Response = NewFlowSnmpv2CPDU().msg() + } + + if value == FlowSnmpv2CDataChoice.SET_REQUEST { + obj.obj.SetRequest = NewFlowSnmpv2CPDU().msg() + } + + if value == FlowSnmpv2CDataChoice.GET_BULK_REQUEST { + obj.obj.GetBulkRequest = NewFlowSnmpv2CBulkPDU().msg() + } + + if value == FlowSnmpv2CDataChoice.INFORM_REQUEST { + obj.obj.InformRequest = NewFlowSnmpv2CPDU().msg() + } + + if value == FlowSnmpv2CDataChoice.SNMPV2_TRAP { + obj.obj.Snmpv2Trap = NewFlowSnmpv2CPDU().msg() + } + + if value == FlowSnmpv2CDataChoice.REPORT { + obj.obj.Report = NewFlowSnmpv2CPDU().msg() + } + + return obj +} + +// description is TBD +// GetRequest returns a FlowSnmpv2CPDU +func (obj *flowSnmpv2CData) GetRequest() FlowSnmpv2CPDU { + if obj.obj.GetRequest == nil { + obj.setChoice(FlowSnmpv2CDataChoice.GET_REQUEST) + } + if obj.getRequestHolder == nil { + obj.getRequestHolder = &flowSnmpv2CPDU{obj: obj.obj.GetRequest} + } + return obj.getRequestHolder +} + +// description is TBD +// GetRequest returns a FlowSnmpv2CPDU +func (obj *flowSnmpv2CData) HasGetRequest() bool { + return obj.obj.GetRequest != nil +} + +// description is TBD +// SetGetRequest sets the FlowSnmpv2CPDU value in the FlowSnmpv2CData object +func (obj *flowSnmpv2CData) SetGetRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData { + obj.setChoice(FlowSnmpv2CDataChoice.GET_REQUEST) + obj.getRequestHolder = nil + obj.obj.GetRequest = value.msg() + + return obj +} + +// description is TBD +// GetNextRequest returns a FlowSnmpv2CPDU +func (obj *flowSnmpv2CData) GetNextRequest() FlowSnmpv2CPDU { + if obj.obj.GetNextRequest == nil { + obj.setChoice(FlowSnmpv2CDataChoice.GET_NEXT_REQUEST) + } + if obj.getNextRequestHolder == nil { + obj.getNextRequestHolder = &flowSnmpv2CPDU{obj: obj.obj.GetNextRequest} + } + return obj.getNextRequestHolder +} + +// description is TBD +// GetNextRequest returns a FlowSnmpv2CPDU +func (obj *flowSnmpv2CData) HasGetNextRequest() bool { + return obj.obj.GetNextRequest != nil +} + +// description is TBD +// SetGetNextRequest sets the FlowSnmpv2CPDU value in the FlowSnmpv2CData object +func (obj *flowSnmpv2CData) SetGetNextRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData { + obj.setChoice(FlowSnmpv2CDataChoice.GET_NEXT_REQUEST) + obj.getNextRequestHolder = nil + obj.obj.GetNextRequest = value.msg() + + return obj +} + +// description is TBD +// Response returns a FlowSnmpv2CPDU +func (obj *flowSnmpv2CData) Response() FlowSnmpv2CPDU { + if obj.obj.Response == nil { + obj.setChoice(FlowSnmpv2CDataChoice.RESPONSE) + } + if obj.responseHolder == nil { + obj.responseHolder = &flowSnmpv2CPDU{obj: obj.obj.Response} + } + return obj.responseHolder +} + +// description is TBD +// Response returns a FlowSnmpv2CPDU +func (obj *flowSnmpv2CData) HasResponse() bool { + return obj.obj.Response != nil +} + +// description is TBD +// SetResponse sets the FlowSnmpv2CPDU value in the FlowSnmpv2CData object +func (obj *flowSnmpv2CData) SetResponse(value FlowSnmpv2CPDU) FlowSnmpv2CData { + obj.setChoice(FlowSnmpv2CDataChoice.RESPONSE) + obj.responseHolder = nil + obj.obj.Response = value.msg() + + return obj +} + +// description is TBD +// SetRequest returns a FlowSnmpv2CPDU +func (obj *flowSnmpv2CData) SetRequest() FlowSnmpv2CPDU { + if obj.obj.SetRequest == nil { + obj.setChoice(FlowSnmpv2CDataChoice.SET_REQUEST) + } + if obj.setRequestHolder == nil { + obj.setRequestHolder = &flowSnmpv2CPDU{obj: obj.obj.SetRequest} + } + return obj.setRequestHolder +} + +// description is TBD +// SetRequest returns a FlowSnmpv2CPDU +func (obj *flowSnmpv2CData) HasSetRequest() bool { + return obj.obj.SetRequest != nil +} + +// description is TBD +// SetSetRequest sets the FlowSnmpv2CPDU value in the FlowSnmpv2CData object +func (obj *flowSnmpv2CData) SetSetRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData { + obj.setChoice(FlowSnmpv2CDataChoice.SET_REQUEST) + obj.setRequestHolder = nil + obj.obj.SetRequest = value.msg() + + return obj +} + +// description is TBD +// GetBulkRequest returns a FlowSnmpv2CBulkPDU +func (obj *flowSnmpv2CData) GetBulkRequest() FlowSnmpv2CBulkPDU { + if obj.obj.GetBulkRequest == nil { + obj.setChoice(FlowSnmpv2CDataChoice.GET_BULK_REQUEST) + } + if obj.getBulkRequestHolder == nil { + obj.getBulkRequestHolder = &flowSnmpv2CBulkPDU{obj: obj.obj.GetBulkRequest} + } + return obj.getBulkRequestHolder +} + +// description is TBD +// GetBulkRequest returns a FlowSnmpv2CBulkPDU +func (obj *flowSnmpv2CData) HasGetBulkRequest() bool { + return obj.obj.GetBulkRequest != nil +} + +// description is TBD +// SetGetBulkRequest sets the FlowSnmpv2CBulkPDU value in the FlowSnmpv2CData object +func (obj *flowSnmpv2CData) SetGetBulkRequest(value FlowSnmpv2CBulkPDU) FlowSnmpv2CData { + obj.setChoice(FlowSnmpv2CDataChoice.GET_BULK_REQUEST) + obj.getBulkRequestHolder = nil + obj.obj.GetBulkRequest = value.msg() + + return obj +} + +// description is TBD +// InformRequest returns a FlowSnmpv2CPDU +func (obj *flowSnmpv2CData) InformRequest() FlowSnmpv2CPDU { + if obj.obj.InformRequest == nil { + obj.setChoice(FlowSnmpv2CDataChoice.INFORM_REQUEST) + } + if obj.informRequestHolder == nil { + obj.informRequestHolder = &flowSnmpv2CPDU{obj: obj.obj.InformRequest} + } + return obj.informRequestHolder +} + +// description is TBD +// InformRequest returns a FlowSnmpv2CPDU +func (obj *flowSnmpv2CData) HasInformRequest() bool { + return obj.obj.InformRequest != nil +} + +// description is TBD +// SetInformRequest sets the FlowSnmpv2CPDU value in the FlowSnmpv2CData object +func (obj *flowSnmpv2CData) SetInformRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData { + obj.setChoice(FlowSnmpv2CDataChoice.INFORM_REQUEST) + obj.informRequestHolder = nil + obj.obj.InformRequest = value.msg() + + return obj +} + +// description is TBD +// Snmpv2Trap returns a FlowSnmpv2CPDU +func (obj *flowSnmpv2CData) Snmpv2Trap() FlowSnmpv2CPDU { + if obj.obj.Snmpv2Trap == nil { + obj.setChoice(FlowSnmpv2CDataChoice.SNMPV2_TRAP) + } + if obj.snmpv2TrapHolder == nil { + obj.snmpv2TrapHolder = &flowSnmpv2CPDU{obj: obj.obj.Snmpv2Trap} + } + return obj.snmpv2TrapHolder +} + +// description is TBD +// Snmpv2Trap returns a FlowSnmpv2CPDU +func (obj *flowSnmpv2CData) HasSnmpv2Trap() bool { + return obj.obj.Snmpv2Trap != nil +} + +// description is TBD +// SetSnmpv2Trap sets the FlowSnmpv2CPDU value in the FlowSnmpv2CData object +func (obj *flowSnmpv2CData) SetSnmpv2Trap(value FlowSnmpv2CPDU) FlowSnmpv2CData { + obj.setChoice(FlowSnmpv2CDataChoice.SNMPV2_TRAP) + obj.snmpv2TrapHolder = nil + obj.obj.Snmpv2Trap = value.msg() + + return obj +} + +// description is TBD +// Report returns a FlowSnmpv2CPDU +func (obj *flowSnmpv2CData) Report() FlowSnmpv2CPDU { + if obj.obj.Report == nil { + obj.setChoice(FlowSnmpv2CDataChoice.REPORT) + } + if obj.reportHolder == nil { + obj.reportHolder = &flowSnmpv2CPDU{obj: obj.obj.Report} + } + return obj.reportHolder +} + +// description is TBD +// Report returns a FlowSnmpv2CPDU +func (obj *flowSnmpv2CData) HasReport() bool { + return obj.obj.Report != nil +} + +// description is TBD +// SetReport sets the FlowSnmpv2CPDU value in the FlowSnmpv2CData object +func (obj *flowSnmpv2CData) SetReport(value FlowSnmpv2CPDU) FlowSnmpv2CData { + obj.setChoice(FlowSnmpv2CDataChoice.REPORT) + obj.reportHolder = nil + obj.obj.Report = value.msg() + + return obj +} + +func (obj *flowSnmpv2CData) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface FlowSnmpv2CData") + } + + if obj.obj.GetRequest != nil { + + obj.GetRequest().validateObj(vObj, set_default) + } + + if obj.obj.GetNextRequest != nil { + + obj.GetNextRequest().validateObj(vObj, set_default) + } + + if obj.obj.Response != nil { + + obj.Response().validateObj(vObj, set_default) + } + + if obj.obj.SetRequest != nil { + + obj.SetRequest().validateObj(vObj, set_default) + } + + if obj.obj.GetBulkRequest != nil { + + obj.GetBulkRequest().validateObj(vObj, set_default) + } + + if obj.obj.InformRequest != nil { + + obj.InformRequest().validateObj(vObj, set_default) + } + + if obj.obj.Snmpv2Trap != nil { + + obj.Snmpv2Trap().validateObj(vObj, set_default) + } + + if obj.obj.Report != nil { + + obj.Report().validateObj(vObj, set_default) + } + +} + +func (obj *flowSnmpv2CData) setDefault() { + var choices_set int = 0 + var choice FlowSnmpv2CDataChoiceEnum + + if obj.obj.GetRequest != nil { + choices_set += 1 + choice = FlowSnmpv2CDataChoice.GET_REQUEST + } + + if obj.obj.GetNextRequest != nil { + choices_set += 1 + choice = FlowSnmpv2CDataChoice.GET_NEXT_REQUEST + } + + if obj.obj.Response != nil { + choices_set += 1 + choice = FlowSnmpv2CDataChoice.RESPONSE + } + + if obj.obj.SetRequest != nil { + choices_set += 1 + choice = FlowSnmpv2CDataChoice.SET_REQUEST + } + + if obj.obj.GetBulkRequest != nil { + choices_set += 1 + choice = FlowSnmpv2CDataChoice.GET_BULK_REQUEST + } + + if obj.obj.InformRequest != nil { + choices_set += 1 + choice = FlowSnmpv2CDataChoice.INFORM_REQUEST + } + + if obj.obj.Snmpv2Trap != nil { + choices_set += 1 + choice = FlowSnmpv2CDataChoice.SNMPV2_TRAP + } + + if obj.obj.Report != nil { + choices_set += 1 + choice = FlowSnmpv2CDataChoice.REPORT + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowSnmpv2CData") + } + } else { + intVal := otg.FlowSnmpv2CData_Choice_Enum_value[string(choice)] + enumValue := otg.FlowSnmpv2CData_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_snmpv2_c_variable_binding.go b/gosnappi/flow_snmpv2_c_variable_binding.go new file mode 100644 index 00000000..aa6f7d43 --- /dev/null +++ b/gosnappi/flow_snmpv2_c_variable_binding.go @@ -0,0 +1,405 @@ +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" +) + +// ***** FlowSnmpv2CVariableBinding ***** +type flowSnmpv2CVariableBinding struct { + validation + obj *otg.FlowSnmpv2CVariableBinding + marshaller marshalFlowSnmpv2CVariableBinding + unMarshaller unMarshalFlowSnmpv2CVariableBinding + valueHolder FlowSnmpv2CVariableBindingValue +} + +func NewFlowSnmpv2CVariableBinding() FlowSnmpv2CVariableBinding { + obj := flowSnmpv2CVariableBinding{obj: &otg.FlowSnmpv2CVariableBinding{}} + obj.setDefault() + return &obj +} + +func (obj *flowSnmpv2CVariableBinding) msg() *otg.FlowSnmpv2CVariableBinding { + return obj.obj +} + +func (obj *flowSnmpv2CVariableBinding) setMsg(msg *otg.FlowSnmpv2CVariableBinding) FlowSnmpv2CVariableBinding { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowSnmpv2CVariableBinding struct { + obj *flowSnmpv2CVariableBinding +} + +type marshalFlowSnmpv2CVariableBinding interface { + // ToProto marshals FlowSnmpv2CVariableBinding to protobuf object *otg.FlowSnmpv2CVariableBinding + ToProto() (*otg.FlowSnmpv2CVariableBinding, error) + // ToPbText marshals FlowSnmpv2CVariableBinding to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowSnmpv2CVariableBinding to YAML text + ToYaml() (string, error) + // ToJson marshals FlowSnmpv2CVariableBinding to JSON text + ToJson() (string, error) +} + +type unMarshalflowSnmpv2CVariableBinding struct { + obj *flowSnmpv2CVariableBinding +} + +type unMarshalFlowSnmpv2CVariableBinding interface { + // FromProto unmarshals FlowSnmpv2CVariableBinding from protobuf object *otg.FlowSnmpv2CVariableBinding + FromProto(msg *otg.FlowSnmpv2CVariableBinding) (FlowSnmpv2CVariableBinding, error) + // FromPbText unmarshals FlowSnmpv2CVariableBinding from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowSnmpv2CVariableBinding from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowSnmpv2CVariableBinding from JSON text + FromJson(value string) error +} + +func (obj *flowSnmpv2CVariableBinding) Marshal() marshalFlowSnmpv2CVariableBinding { + if obj.marshaller == nil { + obj.marshaller = &marshalflowSnmpv2CVariableBinding{obj: obj} + } + return obj.marshaller +} + +func (obj *flowSnmpv2CVariableBinding) Unmarshal() unMarshalFlowSnmpv2CVariableBinding { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowSnmpv2CVariableBinding{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowSnmpv2CVariableBinding) ToProto() (*otg.FlowSnmpv2CVariableBinding, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowSnmpv2CVariableBinding) FromProto(msg *otg.FlowSnmpv2CVariableBinding) (FlowSnmpv2CVariableBinding, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowSnmpv2CVariableBinding) 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 *unMarshalflowSnmpv2CVariableBinding) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowSnmpv2CVariableBinding) 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 *unMarshalflowSnmpv2CVariableBinding) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowSnmpv2CVariableBinding) 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 *unMarshalflowSnmpv2CVariableBinding) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowSnmpv2CVariableBinding) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowSnmpv2CVariableBinding) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowSnmpv2CVariableBinding) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowSnmpv2CVariableBinding) Clone() (FlowSnmpv2CVariableBinding, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowSnmpv2CVariableBinding() + 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 +} + +func (obj *flowSnmpv2CVariableBinding) setNil() { + obj.valueHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowSnmpv2CVariableBinding is a Sequence of two fields, an object_identifier and the value for/from that object_identifier. +type FlowSnmpv2CVariableBinding interface { + Validation + // msg marshals FlowSnmpv2CVariableBinding to protobuf object *otg.FlowSnmpv2CVariableBinding + // and doesn't set defaults + msg() *otg.FlowSnmpv2CVariableBinding + // setMsg unmarshals FlowSnmpv2CVariableBinding from protobuf object *otg.FlowSnmpv2CVariableBinding + // and doesn't set defaults + setMsg(*otg.FlowSnmpv2CVariableBinding) FlowSnmpv2CVariableBinding + // provides marshal interface + Marshal() marshalFlowSnmpv2CVariableBinding + // provides unmarshal interface + Unmarshal() unMarshalFlowSnmpv2CVariableBinding + // validate validates FlowSnmpv2CVariableBinding + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowSnmpv2CVariableBinding, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ObjectIdentifier returns string, set in FlowSnmpv2CVariableBinding. + ObjectIdentifier() string + // SetObjectIdentifier assigns string provided by user to FlowSnmpv2CVariableBinding + SetObjectIdentifier(value string) FlowSnmpv2CVariableBinding + // HasObjectIdentifier checks if ObjectIdentifier has been set in FlowSnmpv2CVariableBinding + HasObjectIdentifier() bool + // Value returns FlowSnmpv2CVariableBindingValue, set in FlowSnmpv2CVariableBinding. + Value() FlowSnmpv2CVariableBindingValue + // SetValue assigns FlowSnmpv2CVariableBindingValue provided by user to FlowSnmpv2CVariableBinding. + SetValue(value FlowSnmpv2CVariableBindingValue) FlowSnmpv2CVariableBinding + // HasValue checks if Value has been set in FlowSnmpv2CVariableBinding + HasValue() bool + setNil() +} + +// The Object Identifier points to a particular parameter in the SNMP agent. +// - Encoding of this field follows RFC2578(section 3.5) and ASN.1 X.690(section 8.1.3.6) specification. +// Refer: http://www.itu.int/ITU-T/asn1/ +// - According to BER, the first two numbers of any OID (x.y) are encoded as one value using the formula (40*x)+y. +// Example, the first two numbers of an SNMP OID 1.3... are encoded as 43 or 0x2B, because (40*1)+3 = 43. +// - After the first two numbers are encoded, the subsequent numbers in the OID are each encoded as a byte. +// - However, a special rule is required for large numbers because one byte can only represent a number from 0-127. +// - The rule for large numbers states that only the lower 7 bits in the byte are used for holding the value (0-127). +// - The highest order bit(8th) is used as a flag to indicate that this number spans more than one byte. Therefore, any number over 127 must be encoded using more than one byte. +// - Example, the number 2680 in the OID '1.3.6.1.4.1.2680.1.2.7.3.2.0' cannot be encoded using a single byte. +// According to this rule, the number 2680 must be encoded as 0x94 0x78. +// Since the most significant bit is set in the first byte (0x94), it indicates that number spans to the next byte. +// Since the most significant bit is not set in the next byte (0x78), it indicates that the number ends at the second byte. +// The value is derived by appending 7 bits from each of the concatenated bytes i.e (0x14 *128^1) + (0x78 * 128^0) = 2680. +// ObjectIdentifier returns a string +func (obj *flowSnmpv2CVariableBinding) ObjectIdentifier() string { + + return *obj.obj.ObjectIdentifier + +} + +// The Object Identifier points to a particular parameter in the SNMP agent. +// - Encoding of this field follows RFC2578(section 3.5) and ASN.1 X.690(section 8.1.3.6) specification. +// Refer: http://www.itu.int/ITU-T/asn1/ +// - According to BER, the first two numbers of any OID (x.y) are encoded as one value using the formula (40*x)+y. +// Example, the first two numbers of an SNMP OID 1.3... are encoded as 43 or 0x2B, because (40*1)+3 = 43. +// - After the first two numbers are encoded, the subsequent numbers in the OID are each encoded as a byte. +// - However, a special rule is required for large numbers because one byte can only represent a number from 0-127. +// - The rule for large numbers states that only the lower 7 bits in the byte are used for holding the value (0-127). +// - The highest order bit(8th) is used as a flag to indicate that this number spans more than one byte. Therefore, any number over 127 must be encoded using more than one byte. +// - Example, the number 2680 in the OID '1.3.6.1.4.1.2680.1.2.7.3.2.0' cannot be encoded using a single byte. +// According to this rule, the number 2680 must be encoded as 0x94 0x78. +// Since the most significant bit is set in the first byte (0x94), it indicates that number spans to the next byte. +// Since the most significant bit is not set in the next byte (0x78), it indicates that the number ends at the second byte. +// The value is derived by appending 7 bits from each of the concatenated bytes i.e (0x14 *128^1) + (0x78 * 128^0) = 2680. +// ObjectIdentifier returns a string +func (obj *flowSnmpv2CVariableBinding) HasObjectIdentifier() bool { + return obj.obj.ObjectIdentifier != nil +} + +// The Object Identifier points to a particular parameter in the SNMP agent. +// - Encoding of this field follows RFC2578(section 3.5) and ASN.1 X.690(section 8.1.3.6) specification. +// Refer: http://www.itu.int/ITU-T/asn1/ +// - According to BER, the first two numbers of any OID (x.y) are encoded as one value using the formula (40*x)+y. +// Example, the first two numbers of an SNMP OID 1.3... are encoded as 43 or 0x2B, because (40*1)+3 = 43. +// - After the first two numbers are encoded, the subsequent numbers in the OID are each encoded as a byte. +// - However, a special rule is required for large numbers because one byte can only represent a number from 0-127. +// - The rule for large numbers states that only the lower 7 bits in the byte are used for holding the value (0-127). +// - The highest order bit(8th) is used as a flag to indicate that this number spans more than one byte. Therefore, any number over 127 must be encoded using more than one byte. +// - Example, the number 2680 in the OID '1.3.6.1.4.1.2680.1.2.7.3.2.0' cannot be encoded using a single byte. +// According to this rule, the number 2680 must be encoded as 0x94 0x78. +// Since the most significant bit is set in the first byte (0x94), it indicates that number spans to the next byte. +// Since the most significant bit is not set in the next byte (0x78), it indicates that the number ends at the second byte. +// The value is derived by appending 7 bits from each of the concatenated bytes i.e (0x14 *128^1) + (0x78 * 128^0) = 2680. +// SetObjectIdentifier sets the string value in the FlowSnmpv2CVariableBinding object +func (obj *flowSnmpv2CVariableBinding) SetObjectIdentifier(value string) FlowSnmpv2CVariableBinding { + + obj.obj.ObjectIdentifier = &value + return obj +} + +// description is TBD +// Value returns a FlowSnmpv2CVariableBindingValue +func (obj *flowSnmpv2CVariableBinding) Value() FlowSnmpv2CVariableBindingValue { + if obj.obj.Value == nil { + obj.obj.Value = NewFlowSnmpv2CVariableBindingValue().msg() + } + if obj.valueHolder == nil { + obj.valueHolder = &flowSnmpv2CVariableBindingValue{obj: obj.obj.Value} + } + return obj.valueHolder +} + +// description is TBD +// Value returns a FlowSnmpv2CVariableBindingValue +func (obj *flowSnmpv2CVariableBinding) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the FlowSnmpv2CVariableBindingValue value in the FlowSnmpv2CVariableBinding object +func (obj *flowSnmpv2CVariableBinding) SetValue(value FlowSnmpv2CVariableBindingValue) FlowSnmpv2CVariableBinding { + + obj.valueHolder = nil + obj.obj.Value = value.msg() + + return obj +} + +func (obj *flowSnmpv2CVariableBinding) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.ObjectIdentifier != nil { + + err := obj.validateOid(obj.ObjectIdentifier()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on FlowSnmpv2CVariableBinding.ObjectIdentifier")) + } + + } + + if obj.obj.Value != nil { + + obj.Value().validateObj(vObj, set_default) + } + +} + +func (obj *flowSnmpv2CVariableBinding) setDefault() { + if obj.obj.ObjectIdentifier == nil { + obj.SetObjectIdentifier("0.1") + } + +} diff --git a/gosnappi/flow_snmpv2_c_variable_binding_string_value.go b/gosnappi/flow_snmpv2_c_variable_binding_string_value.go new file mode 100644 index 00000000..0ba93612 --- /dev/null +++ b/gosnappi/flow_snmpv2_c_variable_binding_string_value.go @@ -0,0 +1,447 @@ +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" +) + +// ***** FlowSnmpv2CVariableBindingStringValue ***** +type flowSnmpv2CVariableBindingStringValue struct { + validation + obj *otg.FlowSnmpv2CVariableBindingStringValue + marshaller marshalFlowSnmpv2CVariableBindingStringValue + unMarshaller unMarshalFlowSnmpv2CVariableBindingStringValue +} + +func NewFlowSnmpv2CVariableBindingStringValue() FlowSnmpv2CVariableBindingStringValue { + obj := flowSnmpv2CVariableBindingStringValue{obj: &otg.FlowSnmpv2CVariableBindingStringValue{}} + obj.setDefault() + return &obj +} + +func (obj *flowSnmpv2CVariableBindingStringValue) msg() *otg.FlowSnmpv2CVariableBindingStringValue { + return obj.obj +} + +func (obj *flowSnmpv2CVariableBindingStringValue) setMsg(msg *otg.FlowSnmpv2CVariableBindingStringValue) FlowSnmpv2CVariableBindingStringValue { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowSnmpv2CVariableBindingStringValue struct { + obj *flowSnmpv2CVariableBindingStringValue +} + +type marshalFlowSnmpv2CVariableBindingStringValue interface { + // ToProto marshals FlowSnmpv2CVariableBindingStringValue to protobuf object *otg.FlowSnmpv2CVariableBindingStringValue + ToProto() (*otg.FlowSnmpv2CVariableBindingStringValue, error) + // ToPbText marshals FlowSnmpv2CVariableBindingStringValue to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowSnmpv2CVariableBindingStringValue to YAML text + ToYaml() (string, error) + // ToJson marshals FlowSnmpv2CVariableBindingStringValue to JSON text + ToJson() (string, error) +} + +type unMarshalflowSnmpv2CVariableBindingStringValue struct { + obj *flowSnmpv2CVariableBindingStringValue +} + +type unMarshalFlowSnmpv2CVariableBindingStringValue interface { + // FromProto unmarshals FlowSnmpv2CVariableBindingStringValue from protobuf object *otg.FlowSnmpv2CVariableBindingStringValue + FromProto(msg *otg.FlowSnmpv2CVariableBindingStringValue) (FlowSnmpv2CVariableBindingStringValue, error) + // FromPbText unmarshals FlowSnmpv2CVariableBindingStringValue from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowSnmpv2CVariableBindingStringValue from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowSnmpv2CVariableBindingStringValue from JSON text + FromJson(value string) error +} + +func (obj *flowSnmpv2CVariableBindingStringValue) Marshal() marshalFlowSnmpv2CVariableBindingStringValue { + if obj.marshaller == nil { + obj.marshaller = &marshalflowSnmpv2CVariableBindingStringValue{obj: obj} + } + return obj.marshaller +} + +func (obj *flowSnmpv2CVariableBindingStringValue) Unmarshal() unMarshalFlowSnmpv2CVariableBindingStringValue { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowSnmpv2CVariableBindingStringValue{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowSnmpv2CVariableBindingStringValue) ToProto() (*otg.FlowSnmpv2CVariableBindingStringValue, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowSnmpv2CVariableBindingStringValue) FromProto(msg *otg.FlowSnmpv2CVariableBindingStringValue) (FlowSnmpv2CVariableBindingStringValue, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowSnmpv2CVariableBindingStringValue) 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 *unMarshalflowSnmpv2CVariableBindingStringValue) 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 *marshalflowSnmpv2CVariableBindingStringValue) 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 *unMarshalflowSnmpv2CVariableBindingStringValue) 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 *marshalflowSnmpv2CVariableBindingStringValue) 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 *unMarshalflowSnmpv2CVariableBindingStringValue) 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 *flowSnmpv2CVariableBindingStringValue) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowSnmpv2CVariableBindingStringValue) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowSnmpv2CVariableBindingStringValue) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowSnmpv2CVariableBindingStringValue) Clone() (FlowSnmpv2CVariableBindingStringValue, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowSnmpv2CVariableBindingStringValue() + 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 +} + +// FlowSnmpv2CVariableBindingStringValue is it contains the raw/ascii string value to be sent. +type FlowSnmpv2CVariableBindingStringValue interface { + Validation + // msg marshals FlowSnmpv2CVariableBindingStringValue to protobuf object *otg.FlowSnmpv2CVariableBindingStringValue + // and doesn't set defaults + msg() *otg.FlowSnmpv2CVariableBindingStringValue + // setMsg unmarshals FlowSnmpv2CVariableBindingStringValue from protobuf object *otg.FlowSnmpv2CVariableBindingStringValue + // and doesn't set defaults + setMsg(*otg.FlowSnmpv2CVariableBindingStringValue) FlowSnmpv2CVariableBindingStringValue + // provides marshal interface + Marshal() marshalFlowSnmpv2CVariableBindingStringValue + // provides unmarshal interface + Unmarshal() unMarshalFlowSnmpv2CVariableBindingStringValue + // validate validates FlowSnmpv2CVariableBindingStringValue + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowSnmpv2CVariableBindingStringValue, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowSnmpv2CVariableBindingStringValueChoiceEnum, set in FlowSnmpv2CVariableBindingStringValue + Choice() FlowSnmpv2CVariableBindingStringValueChoiceEnum + // setChoice assigns FlowSnmpv2CVariableBindingStringValueChoiceEnum provided by user to FlowSnmpv2CVariableBindingStringValue + setChoice(value FlowSnmpv2CVariableBindingStringValueChoiceEnum) FlowSnmpv2CVariableBindingStringValue + // HasChoice checks if Choice has been set in FlowSnmpv2CVariableBindingStringValue + HasChoice() bool + // Ascii returns string, set in FlowSnmpv2CVariableBindingStringValue. + Ascii() string + // SetAscii assigns string provided by user to FlowSnmpv2CVariableBindingStringValue + SetAscii(value string) FlowSnmpv2CVariableBindingStringValue + // HasAscii checks if Ascii has been set in FlowSnmpv2CVariableBindingStringValue + HasAscii() bool + // Raw returns string, set in FlowSnmpv2CVariableBindingStringValue. + Raw() string + // SetRaw assigns string provided by user to FlowSnmpv2CVariableBindingStringValue + SetRaw(value string) FlowSnmpv2CVariableBindingStringValue + // HasRaw checks if Raw has been set in FlowSnmpv2CVariableBindingStringValue + HasRaw() bool +} + +type FlowSnmpv2CVariableBindingStringValueChoiceEnum string + +// Enum of Choice on FlowSnmpv2CVariableBindingStringValue +var FlowSnmpv2CVariableBindingStringValueChoice = struct { + ASCII FlowSnmpv2CVariableBindingStringValueChoiceEnum + RAW FlowSnmpv2CVariableBindingStringValueChoiceEnum +}{ + ASCII: FlowSnmpv2CVariableBindingStringValueChoiceEnum("ascii"), + RAW: FlowSnmpv2CVariableBindingStringValueChoiceEnum("raw"), +} + +func (obj *flowSnmpv2CVariableBindingStringValue) Choice() FlowSnmpv2CVariableBindingStringValueChoiceEnum { + return FlowSnmpv2CVariableBindingStringValueChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *flowSnmpv2CVariableBindingStringValue) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowSnmpv2CVariableBindingStringValue) setChoice(value FlowSnmpv2CVariableBindingStringValueChoiceEnum) FlowSnmpv2CVariableBindingStringValue { + intValue, ok := otg.FlowSnmpv2CVariableBindingStringValue_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowSnmpv2CVariableBindingStringValueChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowSnmpv2CVariableBindingStringValue_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Raw = nil + obj.obj.Ascii = nil + + if value == FlowSnmpv2CVariableBindingStringValueChoice.ASCII { + defaultValue := "ascii" + obj.obj.Ascii = &defaultValue + } + + if value == FlowSnmpv2CVariableBindingStringValueChoice.RAW { + defaultValue := "00" + obj.obj.Raw = &defaultValue + } + + return obj +} + +// It contains the ASCII string to be sent. As of now it is restricted to 10000 bytes. +// Ascii returns a string +func (obj *flowSnmpv2CVariableBindingStringValue) Ascii() string { + + if obj.obj.Ascii == nil { + obj.setChoice(FlowSnmpv2CVariableBindingStringValueChoice.ASCII) + } + + return *obj.obj.Ascii + +} + +// It contains the ASCII string to be sent. As of now it is restricted to 10000 bytes. +// Ascii returns a string +func (obj *flowSnmpv2CVariableBindingStringValue) HasAscii() bool { + return obj.obj.Ascii != nil +} + +// It contains the ASCII string to be sent. As of now it is restricted to 10000 bytes. +// SetAscii sets the string value in the FlowSnmpv2CVariableBindingStringValue object +func (obj *flowSnmpv2CVariableBindingStringValue) SetAscii(value string) FlowSnmpv2CVariableBindingStringValue { + obj.setChoice(FlowSnmpv2CVariableBindingStringValueChoice.ASCII) + obj.obj.Ascii = &value + return obj +} + +// It contains the hex string to be sent. As of now it is restricted to 10000 bytes. +// Raw returns a string +func (obj *flowSnmpv2CVariableBindingStringValue) Raw() string { + + if obj.obj.Raw == nil { + obj.setChoice(FlowSnmpv2CVariableBindingStringValueChoice.RAW) + } + + return *obj.obj.Raw + +} + +// It contains the hex string to be sent. As of now it is restricted to 10000 bytes. +// Raw returns a string +func (obj *flowSnmpv2CVariableBindingStringValue) HasRaw() bool { + return obj.obj.Raw != nil +} + +// It contains the hex string to be sent. As of now it is restricted to 10000 bytes. +// SetRaw sets the string value in the FlowSnmpv2CVariableBindingStringValue object +func (obj *flowSnmpv2CVariableBindingStringValue) SetRaw(value string) FlowSnmpv2CVariableBindingStringValue { + obj.setChoice(FlowSnmpv2CVariableBindingStringValueChoice.RAW) + obj.obj.Raw = &value + return obj +} + +func (obj *flowSnmpv2CVariableBindingStringValue) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ascii != nil { + + if len(*obj.obj.Ascii) > 10000 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "None <= length of FlowSnmpv2CVariableBindingStringValue.Ascii <= 10000 but Got %d", + len(*obj.obj.Ascii))) + } + + } + + if obj.obj.Raw != nil { + + if len(*obj.obj.Raw) > 10000 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "None <= length of FlowSnmpv2CVariableBindingStringValue.Raw <= 10000 but Got %d", + len(*obj.obj.Raw))) + } + + } + +} + +func (obj *flowSnmpv2CVariableBindingStringValue) setDefault() { + var choices_set int = 0 + var choice FlowSnmpv2CVariableBindingStringValueChoiceEnum + + if obj.obj.Ascii != nil { + choices_set += 1 + choice = FlowSnmpv2CVariableBindingStringValueChoice.ASCII + } + + if obj.obj.Raw != nil { + choices_set += 1 + choice = FlowSnmpv2CVariableBindingStringValueChoice.RAW + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowSnmpv2CVariableBindingStringValueChoice.ASCII) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowSnmpv2CVariableBindingStringValue") + } + } else { + intVal := otg.FlowSnmpv2CVariableBindingStringValue_Choice_Enum_value[string(choice)] + enumValue := otg.FlowSnmpv2CVariableBindingStringValue_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_snmpv2_c_variable_binding_value.go b/gosnappi/flow_snmpv2_c_variable_binding_value.go new file mode 100644 index 00000000..a38962a9 --- /dev/null +++ b/gosnappi/flow_snmpv2_c_variable_binding_value.go @@ -0,0 +1,877 @@ +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" +) + +// ***** FlowSnmpv2CVariableBindingValue ***** +type flowSnmpv2CVariableBindingValue struct { + validation + obj *otg.FlowSnmpv2CVariableBindingValue + marshaller marshalFlowSnmpv2CVariableBindingValue + unMarshaller unMarshalFlowSnmpv2CVariableBindingValue + integerValueHolder PatternFlowSnmpv2CVariableBindingValueIntegerValue + stringValueHolder FlowSnmpv2CVariableBindingStringValue + ipAddressValueHolder PatternFlowSnmpv2CVariableBindingValueIpAddressValue + counterValueHolder PatternFlowSnmpv2CVariableBindingValueCounterValue + timeticksValueHolder PatternFlowSnmpv2CVariableBindingValueTimeticksValue + bigCounterValueHolder PatternFlowSnmpv2CVariableBindingValueBigCounterValue + unsignedIntegerValueHolder PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue +} + +func NewFlowSnmpv2CVariableBindingValue() FlowSnmpv2CVariableBindingValue { + obj := flowSnmpv2CVariableBindingValue{obj: &otg.FlowSnmpv2CVariableBindingValue{}} + obj.setDefault() + return &obj +} + +func (obj *flowSnmpv2CVariableBindingValue) msg() *otg.FlowSnmpv2CVariableBindingValue { + return obj.obj +} + +func (obj *flowSnmpv2CVariableBindingValue) setMsg(msg *otg.FlowSnmpv2CVariableBindingValue) FlowSnmpv2CVariableBindingValue { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowSnmpv2CVariableBindingValue struct { + obj *flowSnmpv2CVariableBindingValue +} + +type marshalFlowSnmpv2CVariableBindingValue interface { + // ToProto marshals FlowSnmpv2CVariableBindingValue to protobuf object *otg.FlowSnmpv2CVariableBindingValue + ToProto() (*otg.FlowSnmpv2CVariableBindingValue, error) + // ToPbText marshals FlowSnmpv2CVariableBindingValue to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowSnmpv2CVariableBindingValue to YAML text + ToYaml() (string, error) + // ToJson marshals FlowSnmpv2CVariableBindingValue to JSON text + ToJson() (string, error) +} + +type unMarshalflowSnmpv2CVariableBindingValue struct { + obj *flowSnmpv2CVariableBindingValue +} + +type unMarshalFlowSnmpv2CVariableBindingValue interface { + // FromProto unmarshals FlowSnmpv2CVariableBindingValue from protobuf object *otg.FlowSnmpv2CVariableBindingValue + FromProto(msg *otg.FlowSnmpv2CVariableBindingValue) (FlowSnmpv2CVariableBindingValue, error) + // FromPbText unmarshals FlowSnmpv2CVariableBindingValue from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowSnmpv2CVariableBindingValue from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowSnmpv2CVariableBindingValue from JSON text + FromJson(value string) error +} + +func (obj *flowSnmpv2CVariableBindingValue) Marshal() marshalFlowSnmpv2CVariableBindingValue { + if obj.marshaller == nil { + obj.marshaller = &marshalflowSnmpv2CVariableBindingValue{obj: obj} + } + return obj.marshaller +} + +func (obj *flowSnmpv2CVariableBindingValue) Unmarshal() unMarshalFlowSnmpv2CVariableBindingValue { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowSnmpv2CVariableBindingValue{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowSnmpv2CVariableBindingValue) ToProto() (*otg.FlowSnmpv2CVariableBindingValue, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowSnmpv2CVariableBindingValue) FromProto(msg *otg.FlowSnmpv2CVariableBindingValue) (FlowSnmpv2CVariableBindingValue, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowSnmpv2CVariableBindingValue) 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 *unMarshalflowSnmpv2CVariableBindingValue) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowSnmpv2CVariableBindingValue) 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 *unMarshalflowSnmpv2CVariableBindingValue) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowSnmpv2CVariableBindingValue) 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 *unMarshalflowSnmpv2CVariableBindingValue) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowSnmpv2CVariableBindingValue) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowSnmpv2CVariableBindingValue) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowSnmpv2CVariableBindingValue) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowSnmpv2CVariableBindingValue) Clone() (FlowSnmpv2CVariableBindingValue, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowSnmpv2CVariableBindingValue() + 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 +} + +func (obj *flowSnmpv2CVariableBindingValue) setNil() { + obj.integerValueHolder = nil + obj.stringValueHolder = nil + obj.ipAddressValueHolder = nil + obj.counterValueHolder = nil + obj.timeticksValueHolder = nil + obj.bigCounterValueHolder = nil + obj.unsignedIntegerValueHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowSnmpv2CVariableBindingValue is the value for the object_identifier as per RFC2578. +type FlowSnmpv2CVariableBindingValue interface { + Validation + // msg marshals FlowSnmpv2CVariableBindingValue to protobuf object *otg.FlowSnmpv2CVariableBindingValue + // and doesn't set defaults + msg() *otg.FlowSnmpv2CVariableBindingValue + // setMsg unmarshals FlowSnmpv2CVariableBindingValue from protobuf object *otg.FlowSnmpv2CVariableBindingValue + // and doesn't set defaults + setMsg(*otg.FlowSnmpv2CVariableBindingValue) FlowSnmpv2CVariableBindingValue + // provides marshal interface + Marshal() marshalFlowSnmpv2CVariableBindingValue + // provides unmarshal interface + Unmarshal() unMarshalFlowSnmpv2CVariableBindingValue + // validate validates FlowSnmpv2CVariableBindingValue + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowSnmpv2CVariableBindingValue, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowSnmpv2CVariableBindingValueChoiceEnum, set in FlowSnmpv2CVariableBindingValue + Choice() FlowSnmpv2CVariableBindingValueChoiceEnum + // setChoice assigns FlowSnmpv2CVariableBindingValueChoiceEnum provided by user to FlowSnmpv2CVariableBindingValue + setChoice(value FlowSnmpv2CVariableBindingValueChoiceEnum) FlowSnmpv2CVariableBindingValue + // HasChoice checks if Choice has been set in FlowSnmpv2CVariableBindingValue + HasChoice() bool + // getter for NoValue to set choice. + NoValue() + // IntegerValue returns PatternFlowSnmpv2CVariableBindingValueIntegerValue, set in FlowSnmpv2CVariableBindingValue. + IntegerValue() PatternFlowSnmpv2CVariableBindingValueIntegerValue + // SetIntegerValue assigns PatternFlowSnmpv2CVariableBindingValueIntegerValue provided by user to FlowSnmpv2CVariableBindingValue. + SetIntegerValue(value PatternFlowSnmpv2CVariableBindingValueIntegerValue) FlowSnmpv2CVariableBindingValue + // HasIntegerValue checks if IntegerValue has been set in FlowSnmpv2CVariableBindingValue + HasIntegerValue() bool + // StringValue returns FlowSnmpv2CVariableBindingStringValue, set in FlowSnmpv2CVariableBindingValue. + StringValue() FlowSnmpv2CVariableBindingStringValue + // SetStringValue assigns FlowSnmpv2CVariableBindingStringValue provided by user to FlowSnmpv2CVariableBindingValue. + SetStringValue(value FlowSnmpv2CVariableBindingStringValue) FlowSnmpv2CVariableBindingValue + // HasStringValue checks if StringValue has been set in FlowSnmpv2CVariableBindingValue + HasStringValue() bool + // ObjectIdentifierValue returns string, set in FlowSnmpv2CVariableBindingValue. + ObjectIdentifierValue() string + // SetObjectIdentifierValue assigns string provided by user to FlowSnmpv2CVariableBindingValue + SetObjectIdentifierValue(value string) FlowSnmpv2CVariableBindingValue + // HasObjectIdentifierValue checks if ObjectIdentifierValue has been set in FlowSnmpv2CVariableBindingValue + HasObjectIdentifierValue() bool + // IpAddressValue returns PatternFlowSnmpv2CVariableBindingValueIpAddressValue, set in FlowSnmpv2CVariableBindingValue. + IpAddressValue() PatternFlowSnmpv2CVariableBindingValueIpAddressValue + // SetIpAddressValue assigns PatternFlowSnmpv2CVariableBindingValueIpAddressValue provided by user to FlowSnmpv2CVariableBindingValue. + SetIpAddressValue(value PatternFlowSnmpv2CVariableBindingValueIpAddressValue) FlowSnmpv2CVariableBindingValue + // HasIpAddressValue checks if IpAddressValue has been set in FlowSnmpv2CVariableBindingValue + HasIpAddressValue() bool + // CounterValue returns PatternFlowSnmpv2CVariableBindingValueCounterValue, set in FlowSnmpv2CVariableBindingValue. + CounterValue() PatternFlowSnmpv2CVariableBindingValueCounterValue + // SetCounterValue assigns PatternFlowSnmpv2CVariableBindingValueCounterValue provided by user to FlowSnmpv2CVariableBindingValue. + SetCounterValue(value PatternFlowSnmpv2CVariableBindingValueCounterValue) FlowSnmpv2CVariableBindingValue + // HasCounterValue checks if CounterValue has been set in FlowSnmpv2CVariableBindingValue + HasCounterValue() bool + // TimeticksValue returns PatternFlowSnmpv2CVariableBindingValueTimeticksValue, set in FlowSnmpv2CVariableBindingValue. + TimeticksValue() PatternFlowSnmpv2CVariableBindingValueTimeticksValue + // SetTimeticksValue assigns PatternFlowSnmpv2CVariableBindingValueTimeticksValue provided by user to FlowSnmpv2CVariableBindingValue. + SetTimeticksValue(value PatternFlowSnmpv2CVariableBindingValueTimeticksValue) FlowSnmpv2CVariableBindingValue + // HasTimeticksValue checks if TimeticksValue has been set in FlowSnmpv2CVariableBindingValue + HasTimeticksValue() bool + // ArbitraryValue returns string, set in FlowSnmpv2CVariableBindingValue. + ArbitraryValue() string + // SetArbitraryValue assigns string provided by user to FlowSnmpv2CVariableBindingValue + SetArbitraryValue(value string) FlowSnmpv2CVariableBindingValue + // HasArbitraryValue checks if ArbitraryValue has been set in FlowSnmpv2CVariableBindingValue + HasArbitraryValue() bool + // BigCounterValue returns PatternFlowSnmpv2CVariableBindingValueBigCounterValue, set in FlowSnmpv2CVariableBindingValue. + BigCounterValue() PatternFlowSnmpv2CVariableBindingValueBigCounterValue + // SetBigCounterValue assigns PatternFlowSnmpv2CVariableBindingValueBigCounterValue provided by user to FlowSnmpv2CVariableBindingValue. + SetBigCounterValue(value PatternFlowSnmpv2CVariableBindingValueBigCounterValue) FlowSnmpv2CVariableBindingValue + // HasBigCounterValue checks if BigCounterValue has been set in FlowSnmpv2CVariableBindingValue + HasBigCounterValue() bool + // UnsignedIntegerValue returns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue, set in FlowSnmpv2CVariableBindingValue. + UnsignedIntegerValue() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + // SetUnsignedIntegerValue assigns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue provided by user to FlowSnmpv2CVariableBindingValue. + SetUnsignedIntegerValue(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) FlowSnmpv2CVariableBindingValue + // HasUnsignedIntegerValue checks if UnsignedIntegerValue has been set in FlowSnmpv2CVariableBindingValue + HasUnsignedIntegerValue() bool + setNil() +} + +type FlowSnmpv2CVariableBindingValueChoiceEnum string + +// Enum of Choice on FlowSnmpv2CVariableBindingValue +var FlowSnmpv2CVariableBindingValueChoice = struct { + NO_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum + INTEGER_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum + STRING_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum + OBJECT_IDENTIFIER_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum + IP_ADDRESS_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum + COUNTER_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum + TIMETICKS_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum + ARBITRARY_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum + BIG_COUNTER_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum + UNSIGNED_INTEGER_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum +}{ + NO_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("no_value"), + INTEGER_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("integer_value"), + STRING_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("string_value"), + OBJECT_IDENTIFIER_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("object_identifier_value"), + IP_ADDRESS_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("ip_address_value"), + COUNTER_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("counter_value"), + TIMETICKS_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("timeticks_value"), + ARBITRARY_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("arbitrary_value"), + BIG_COUNTER_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("big_counter_value"), + UNSIGNED_INTEGER_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("unsigned_integer_value"), +} + +func (obj *flowSnmpv2CVariableBindingValue) Choice() FlowSnmpv2CVariableBindingValueChoiceEnum { + return FlowSnmpv2CVariableBindingValueChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// getter for NoValue to set choice +func (obj *flowSnmpv2CVariableBindingValue) NoValue() { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.NO_VALUE) +} + +// description is TBD +// Choice returns a string +func (obj *flowSnmpv2CVariableBindingValue) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowSnmpv2CVariableBindingValue) setChoice(value FlowSnmpv2CVariableBindingValueChoiceEnum) FlowSnmpv2CVariableBindingValue { + intValue, ok := otg.FlowSnmpv2CVariableBindingValue_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowSnmpv2CVariableBindingValueChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowSnmpv2CVariableBindingValue_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.UnsignedIntegerValue = nil + obj.unsignedIntegerValueHolder = nil + obj.obj.BigCounterValue = nil + obj.bigCounterValueHolder = nil + obj.obj.ArbitraryValue = nil + obj.obj.TimeticksValue = nil + obj.timeticksValueHolder = nil + obj.obj.CounterValue = nil + obj.counterValueHolder = nil + obj.obj.IpAddressValue = nil + obj.ipAddressValueHolder = nil + obj.obj.ObjectIdentifierValue = nil + obj.obj.StringValue = nil + obj.stringValueHolder = nil + obj.obj.IntegerValue = nil + obj.integerValueHolder = nil + + if value == FlowSnmpv2CVariableBindingValueChoice.INTEGER_VALUE { + obj.obj.IntegerValue = NewPatternFlowSnmpv2CVariableBindingValueIntegerValue().msg() + } + + if value == FlowSnmpv2CVariableBindingValueChoice.STRING_VALUE { + obj.obj.StringValue = NewFlowSnmpv2CVariableBindingStringValue().msg() + } + + if value == FlowSnmpv2CVariableBindingValueChoice.OBJECT_IDENTIFIER_VALUE { + defaultValue := "0.1" + obj.obj.ObjectIdentifierValue = &defaultValue + } + + if value == FlowSnmpv2CVariableBindingValueChoice.IP_ADDRESS_VALUE { + obj.obj.IpAddressValue = NewPatternFlowSnmpv2CVariableBindingValueIpAddressValue().msg() + } + + if value == FlowSnmpv2CVariableBindingValueChoice.COUNTER_VALUE { + obj.obj.CounterValue = NewPatternFlowSnmpv2CVariableBindingValueCounterValue().msg() + } + + if value == FlowSnmpv2CVariableBindingValueChoice.TIMETICKS_VALUE { + obj.obj.TimeticksValue = NewPatternFlowSnmpv2CVariableBindingValueTimeticksValue().msg() + } + + if value == FlowSnmpv2CVariableBindingValueChoice.ARBITRARY_VALUE { + defaultValue := "00" + obj.obj.ArbitraryValue = &defaultValue + } + + if value == FlowSnmpv2CVariableBindingValueChoice.BIG_COUNTER_VALUE { + obj.obj.BigCounterValue = NewPatternFlowSnmpv2CVariableBindingValueBigCounterValue().msg() + } + + if value == FlowSnmpv2CVariableBindingValueChoice.UNSIGNED_INTEGER_VALUE { + obj.obj.UnsignedIntegerValue = NewPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue().msg() + } + + return obj +} + +// description is TBD +// IntegerValue returns a PatternFlowSnmpv2CVariableBindingValueIntegerValue +func (obj *flowSnmpv2CVariableBindingValue) IntegerValue() PatternFlowSnmpv2CVariableBindingValueIntegerValue { + if obj.obj.IntegerValue == nil { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.INTEGER_VALUE) + } + if obj.integerValueHolder == nil { + obj.integerValueHolder = &patternFlowSnmpv2CVariableBindingValueIntegerValue{obj: obj.obj.IntegerValue} + } + return obj.integerValueHolder +} + +// description is TBD +// IntegerValue returns a PatternFlowSnmpv2CVariableBindingValueIntegerValue +func (obj *flowSnmpv2CVariableBindingValue) HasIntegerValue() bool { + return obj.obj.IntegerValue != nil +} + +// description is TBD +// SetIntegerValue sets the PatternFlowSnmpv2CVariableBindingValueIntegerValue value in the FlowSnmpv2CVariableBindingValue object +func (obj *flowSnmpv2CVariableBindingValue) SetIntegerValue(value PatternFlowSnmpv2CVariableBindingValueIntegerValue) FlowSnmpv2CVariableBindingValue { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.INTEGER_VALUE) + obj.integerValueHolder = nil + obj.obj.IntegerValue = value.msg() + + return obj +} + +// description is TBD +// StringValue returns a FlowSnmpv2CVariableBindingStringValue +func (obj *flowSnmpv2CVariableBindingValue) StringValue() FlowSnmpv2CVariableBindingStringValue { + if obj.obj.StringValue == nil { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.STRING_VALUE) + } + if obj.stringValueHolder == nil { + obj.stringValueHolder = &flowSnmpv2CVariableBindingStringValue{obj: obj.obj.StringValue} + } + return obj.stringValueHolder +} + +// description is TBD +// StringValue returns a FlowSnmpv2CVariableBindingStringValue +func (obj *flowSnmpv2CVariableBindingValue) HasStringValue() bool { + return obj.obj.StringValue != nil +} + +// description is TBD +// SetStringValue sets the FlowSnmpv2CVariableBindingStringValue value in the FlowSnmpv2CVariableBindingValue object +func (obj *flowSnmpv2CVariableBindingValue) SetStringValue(value FlowSnmpv2CVariableBindingStringValue) FlowSnmpv2CVariableBindingValue { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.STRING_VALUE) + obj.stringValueHolder = nil + obj.obj.StringValue = value.msg() + + return obj +} + +// The Object Identifier points to a particular parameter in the SNMP agent. +// - Encoding of this field follows RFC2578(section 3.5) and ASN.1 X.690(section 8.1.3.6) specification. +// Refer: http://www.itu.int/ITU-T/asn1/ +// - According to BER, the first two numbers of any OID (x.y) are encoded as one value using the formula (40*x)+y. +// Example, the first two numbers of an SNMP OID 1.3... are encoded as 43 or 0x2B, because (40*1)+3 = 43. +// - After the first two numbers are encoded, the subsequent numbers in the OID are each encoded as a byte. +// - However, a special rule is required for large numbers because one byte can only represent a number from 0-127. +// - The rule for large numbers states that only the lower 7 bits in the byte are used for holding the value (0-127). +// - The highest order bit(8th) is used as a flag to indicate that this number spans more than one byte. Therefore, any number over 127 must be encoded using more than one byte. +// - Example, the number 2680 in the OID '1.3.6.1.4.1.2680.1.2.7.3.2.0' cannot be encoded using a single byte. +// According to this rule, the number 2680 must be encoded as 0x94 0x78. +// Since the most significant bit is set in the first byte (0x94), it indicates that number spans to the next byte. +// Since the most significant bit is not set in the next byte (0x78), it indicates that the number ends at the second byte. +// The value is derived by appending 7 bits from each of the concatenated bytes i.e (0x14 *128^1) + (0x78 * 128^0) = 2680. +// ObjectIdentifierValue returns a string +func (obj *flowSnmpv2CVariableBindingValue) ObjectIdentifierValue() string { + + if obj.obj.ObjectIdentifierValue == nil { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.OBJECT_IDENTIFIER_VALUE) + } + + return *obj.obj.ObjectIdentifierValue + +} + +// The Object Identifier points to a particular parameter in the SNMP agent. +// - Encoding of this field follows RFC2578(section 3.5) and ASN.1 X.690(section 8.1.3.6) specification. +// Refer: http://www.itu.int/ITU-T/asn1/ +// - According to BER, the first two numbers of any OID (x.y) are encoded as one value using the formula (40*x)+y. +// Example, the first two numbers of an SNMP OID 1.3... are encoded as 43 or 0x2B, because (40*1)+3 = 43. +// - After the first two numbers are encoded, the subsequent numbers in the OID are each encoded as a byte. +// - However, a special rule is required for large numbers because one byte can only represent a number from 0-127. +// - The rule for large numbers states that only the lower 7 bits in the byte are used for holding the value (0-127). +// - The highest order bit(8th) is used as a flag to indicate that this number spans more than one byte. Therefore, any number over 127 must be encoded using more than one byte. +// - Example, the number 2680 in the OID '1.3.6.1.4.1.2680.1.2.7.3.2.0' cannot be encoded using a single byte. +// According to this rule, the number 2680 must be encoded as 0x94 0x78. +// Since the most significant bit is set in the first byte (0x94), it indicates that number spans to the next byte. +// Since the most significant bit is not set in the next byte (0x78), it indicates that the number ends at the second byte. +// The value is derived by appending 7 bits from each of the concatenated bytes i.e (0x14 *128^1) + (0x78 * 128^0) = 2680. +// ObjectIdentifierValue returns a string +func (obj *flowSnmpv2CVariableBindingValue) HasObjectIdentifierValue() bool { + return obj.obj.ObjectIdentifierValue != nil +} + +// The Object Identifier points to a particular parameter in the SNMP agent. +// - Encoding of this field follows RFC2578(section 3.5) and ASN.1 X.690(section 8.1.3.6) specification. +// Refer: http://www.itu.int/ITU-T/asn1/ +// - According to BER, the first two numbers of any OID (x.y) are encoded as one value using the formula (40*x)+y. +// Example, the first two numbers of an SNMP OID 1.3... are encoded as 43 or 0x2B, because (40*1)+3 = 43. +// - After the first two numbers are encoded, the subsequent numbers in the OID are each encoded as a byte. +// - However, a special rule is required for large numbers because one byte can only represent a number from 0-127. +// - The rule for large numbers states that only the lower 7 bits in the byte are used for holding the value (0-127). +// - The highest order bit(8th) is used as a flag to indicate that this number spans more than one byte. Therefore, any number over 127 must be encoded using more than one byte. +// - Example, the number 2680 in the OID '1.3.6.1.4.1.2680.1.2.7.3.2.0' cannot be encoded using a single byte. +// According to this rule, the number 2680 must be encoded as 0x94 0x78. +// Since the most significant bit is set in the first byte (0x94), it indicates that number spans to the next byte. +// Since the most significant bit is not set in the next byte (0x78), it indicates that the number ends at the second byte. +// The value is derived by appending 7 bits from each of the concatenated bytes i.e (0x14 *128^1) + (0x78 * 128^0) = 2680. +// SetObjectIdentifierValue sets the string value in the FlowSnmpv2CVariableBindingValue object +func (obj *flowSnmpv2CVariableBindingValue) SetObjectIdentifierValue(value string) FlowSnmpv2CVariableBindingValue { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.OBJECT_IDENTIFIER_VALUE) + obj.obj.ObjectIdentifierValue = &value + return obj +} + +// description is TBD +// IpAddressValue returns a PatternFlowSnmpv2CVariableBindingValueIpAddressValue +func (obj *flowSnmpv2CVariableBindingValue) IpAddressValue() PatternFlowSnmpv2CVariableBindingValueIpAddressValue { + if obj.obj.IpAddressValue == nil { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.IP_ADDRESS_VALUE) + } + if obj.ipAddressValueHolder == nil { + obj.ipAddressValueHolder = &patternFlowSnmpv2CVariableBindingValueIpAddressValue{obj: obj.obj.IpAddressValue} + } + return obj.ipAddressValueHolder +} + +// description is TBD +// IpAddressValue returns a PatternFlowSnmpv2CVariableBindingValueIpAddressValue +func (obj *flowSnmpv2CVariableBindingValue) HasIpAddressValue() bool { + return obj.obj.IpAddressValue != nil +} + +// description is TBD +// SetIpAddressValue sets the PatternFlowSnmpv2CVariableBindingValueIpAddressValue value in the FlowSnmpv2CVariableBindingValue object +func (obj *flowSnmpv2CVariableBindingValue) SetIpAddressValue(value PatternFlowSnmpv2CVariableBindingValueIpAddressValue) FlowSnmpv2CVariableBindingValue { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.IP_ADDRESS_VALUE) + obj.ipAddressValueHolder = nil + obj.obj.IpAddressValue = value.msg() + + return obj +} + +// description is TBD +// CounterValue returns a PatternFlowSnmpv2CVariableBindingValueCounterValue +func (obj *flowSnmpv2CVariableBindingValue) CounterValue() PatternFlowSnmpv2CVariableBindingValueCounterValue { + if obj.obj.CounterValue == nil { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.COUNTER_VALUE) + } + if obj.counterValueHolder == nil { + obj.counterValueHolder = &patternFlowSnmpv2CVariableBindingValueCounterValue{obj: obj.obj.CounterValue} + } + return obj.counterValueHolder +} + +// description is TBD +// CounterValue returns a PatternFlowSnmpv2CVariableBindingValueCounterValue +func (obj *flowSnmpv2CVariableBindingValue) HasCounterValue() bool { + return obj.obj.CounterValue != nil +} + +// description is TBD +// SetCounterValue sets the PatternFlowSnmpv2CVariableBindingValueCounterValue value in the FlowSnmpv2CVariableBindingValue object +func (obj *flowSnmpv2CVariableBindingValue) SetCounterValue(value PatternFlowSnmpv2CVariableBindingValueCounterValue) FlowSnmpv2CVariableBindingValue { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.COUNTER_VALUE) + obj.counterValueHolder = nil + obj.obj.CounterValue = value.msg() + + return obj +} + +// description is TBD +// TimeticksValue returns a PatternFlowSnmpv2CVariableBindingValueTimeticksValue +func (obj *flowSnmpv2CVariableBindingValue) TimeticksValue() PatternFlowSnmpv2CVariableBindingValueTimeticksValue { + if obj.obj.TimeticksValue == nil { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.TIMETICKS_VALUE) + } + if obj.timeticksValueHolder == nil { + obj.timeticksValueHolder = &patternFlowSnmpv2CVariableBindingValueTimeticksValue{obj: obj.obj.TimeticksValue} + } + return obj.timeticksValueHolder +} + +// description is TBD +// TimeticksValue returns a PatternFlowSnmpv2CVariableBindingValueTimeticksValue +func (obj *flowSnmpv2CVariableBindingValue) HasTimeticksValue() bool { + return obj.obj.TimeticksValue != nil +} + +// description is TBD +// SetTimeticksValue sets the PatternFlowSnmpv2CVariableBindingValueTimeticksValue value in the FlowSnmpv2CVariableBindingValue object +func (obj *flowSnmpv2CVariableBindingValue) SetTimeticksValue(value PatternFlowSnmpv2CVariableBindingValueTimeticksValue) FlowSnmpv2CVariableBindingValue { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.TIMETICKS_VALUE) + obj.timeticksValueHolder = nil + obj.obj.TimeticksValue = value.msg() + + return obj +} + +// It contains the hex bytes of the value to be sent. As of now it is restricted to 10000 bytes. +// ArbitraryValue returns a string +func (obj *flowSnmpv2CVariableBindingValue) ArbitraryValue() string { + + if obj.obj.ArbitraryValue == nil { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.ARBITRARY_VALUE) + } + + return *obj.obj.ArbitraryValue + +} + +// It contains the hex bytes of the value to be sent. As of now it is restricted to 10000 bytes. +// ArbitraryValue returns a string +func (obj *flowSnmpv2CVariableBindingValue) HasArbitraryValue() bool { + return obj.obj.ArbitraryValue != nil +} + +// It contains the hex bytes of the value to be sent. As of now it is restricted to 10000 bytes. +// SetArbitraryValue sets the string value in the FlowSnmpv2CVariableBindingValue object +func (obj *flowSnmpv2CVariableBindingValue) SetArbitraryValue(value string) FlowSnmpv2CVariableBindingValue { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.ARBITRARY_VALUE) + obj.obj.ArbitraryValue = &value + return obj +} + +// description is TBD +// BigCounterValue returns a PatternFlowSnmpv2CVariableBindingValueBigCounterValue +func (obj *flowSnmpv2CVariableBindingValue) BigCounterValue() PatternFlowSnmpv2CVariableBindingValueBigCounterValue { + if obj.obj.BigCounterValue == nil { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.BIG_COUNTER_VALUE) + } + if obj.bigCounterValueHolder == nil { + obj.bigCounterValueHolder = &patternFlowSnmpv2CVariableBindingValueBigCounterValue{obj: obj.obj.BigCounterValue} + } + return obj.bigCounterValueHolder +} + +// description is TBD +// BigCounterValue returns a PatternFlowSnmpv2CVariableBindingValueBigCounterValue +func (obj *flowSnmpv2CVariableBindingValue) HasBigCounterValue() bool { + return obj.obj.BigCounterValue != nil +} + +// description is TBD +// SetBigCounterValue sets the PatternFlowSnmpv2CVariableBindingValueBigCounterValue value in the FlowSnmpv2CVariableBindingValue object +func (obj *flowSnmpv2CVariableBindingValue) SetBigCounterValue(value PatternFlowSnmpv2CVariableBindingValueBigCounterValue) FlowSnmpv2CVariableBindingValue { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.BIG_COUNTER_VALUE) + obj.bigCounterValueHolder = nil + obj.obj.BigCounterValue = value.msg() + + return obj +} + +// description is TBD +// UnsignedIntegerValue returns a PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue +func (obj *flowSnmpv2CVariableBindingValue) UnsignedIntegerValue() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { + if obj.obj.UnsignedIntegerValue == nil { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.UNSIGNED_INTEGER_VALUE) + } + if obj.unsignedIntegerValueHolder == nil { + obj.unsignedIntegerValueHolder = &patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue{obj: obj.obj.UnsignedIntegerValue} + } + return obj.unsignedIntegerValueHolder +} + +// description is TBD +// UnsignedIntegerValue returns a PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue +func (obj *flowSnmpv2CVariableBindingValue) HasUnsignedIntegerValue() bool { + return obj.obj.UnsignedIntegerValue != nil +} + +// description is TBD +// SetUnsignedIntegerValue sets the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue value in the FlowSnmpv2CVariableBindingValue object +func (obj *flowSnmpv2CVariableBindingValue) SetUnsignedIntegerValue(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) FlowSnmpv2CVariableBindingValue { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.UNSIGNED_INTEGER_VALUE) + obj.unsignedIntegerValueHolder = nil + obj.obj.UnsignedIntegerValue = value.msg() + + return obj +} + +func (obj *flowSnmpv2CVariableBindingValue) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.IntegerValue != nil { + + obj.IntegerValue().validateObj(vObj, set_default) + } + + if obj.obj.StringValue != nil { + + obj.StringValue().validateObj(vObj, set_default) + } + + if obj.obj.ObjectIdentifierValue != nil { + + err := obj.validateOid(obj.ObjectIdentifierValue()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on FlowSnmpv2CVariableBindingValue.ObjectIdentifierValue")) + } + + } + + if obj.obj.IpAddressValue != nil { + + obj.IpAddressValue().validateObj(vObj, set_default) + } + + if obj.obj.CounterValue != nil { + + obj.CounterValue().validateObj(vObj, set_default) + } + + if obj.obj.TimeticksValue != nil { + + obj.TimeticksValue().validateObj(vObj, set_default) + } + + if obj.obj.ArbitraryValue != nil { + + if len(*obj.obj.ArbitraryValue) > 10000 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "None <= length of FlowSnmpv2CVariableBindingValue.ArbitraryValue <= 10000 but Got %d", + len(*obj.obj.ArbitraryValue))) + } + + } + + if obj.obj.BigCounterValue != nil { + + obj.BigCounterValue().validateObj(vObj, set_default) + } + + if obj.obj.UnsignedIntegerValue != nil { + + obj.UnsignedIntegerValue().validateObj(vObj, set_default) + } + +} + +func (obj *flowSnmpv2CVariableBindingValue) setDefault() { + var choices_set int = 0 + var choice FlowSnmpv2CVariableBindingValueChoiceEnum + + if obj.obj.IntegerValue != nil { + choices_set += 1 + choice = FlowSnmpv2CVariableBindingValueChoice.INTEGER_VALUE + } + + if obj.obj.StringValue != nil { + choices_set += 1 + choice = FlowSnmpv2CVariableBindingValueChoice.STRING_VALUE + } + + if obj.obj.ObjectIdentifierValue != nil { + choices_set += 1 + choice = FlowSnmpv2CVariableBindingValueChoice.OBJECT_IDENTIFIER_VALUE + } + + if obj.obj.IpAddressValue != nil { + choices_set += 1 + choice = FlowSnmpv2CVariableBindingValueChoice.IP_ADDRESS_VALUE + } + + if obj.obj.CounterValue != nil { + choices_set += 1 + choice = FlowSnmpv2CVariableBindingValueChoice.COUNTER_VALUE + } + + if obj.obj.TimeticksValue != nil { + choices_set += 1 + choice = FlowSnmpv2CVariableBindingValueChoice.TIMETICKS_VALUE + } + + if obj.obj.ArbitraryValue != nil { + choices_set += 1 + choice = FlowSnmpv2CVariableBindingValueChoice.ARBITRARY_VALUE + } + + if obj.obj.BigCounterValue != nil { + choices_set += 1 + choice = FlowSnmpv2CVariableBindingValueChoice.BIG_COUNTER_VALUE + } + + if obj.obj.UnsignedIntegerValue != nil { + choices_set += 1 + choice = FlowSnmpv2CVariableBindingValueChoice.UNSIGNED_INTEGER_VALUE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.NO_VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowSnmpv2CVariableBindingValue") + } + } else { + intVal := otg.FlowSnmpv2CVariableBindingValue_Choice_Enum_value[string(choice)] + enumValue := otg.FlowSnmpv2CVariableBindingValue_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_snmpv2_cpdu.go b/gosnappi/flow_snmpv2_cpdu.go new file mode 100644 index 00000000..b3b9c6e6 --- /dev/null +++ b/gosnappi/flow_snmpv2_cpdu.go @@ -0,0 +1,550 @@ +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" +) + +// ***** FlowSnmpv2CPDU ***** +type flowSnmpv2CPDU struct { + validation + obj *otg.FlowSnmpv2CPDU + marshaller marshalFlowSnmpv2CPDU + unMarshaller unMarshalFlowSnmpv2CPDU + requestIdHolder PatternFlowSnmpv2CPDURequestId + errorIndexHolder PatternFlowSnmpv2CPDUErrorIndex + variableBindingsHolder FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter +} + +func NewFlowSnmpv2CPDU() FlowSnmpv2CPDU { + obj := flowSnmpv2CPDU{obj: &otg.FlowSnmpv2CPDU{}} + obj.setDefault() + return &obj +} + +func (obj *flowSnmpv2CPDU) msg() *otg.FlowSnmpv2CPDU { + return obj.obj +} + +func (obj *flowSnmpv2CPDU) setMsg(msg *otg.FlowSnmpv2CPDU) FlowSnmpv2CPDU { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowSnmpv2CPDU struct { + obj *flowSnmpv2CPDU +} + +type marshalFlowSnmpv2CPDU interface { + // ToProto marshals FlowSnmpv2CPDU to protobuf object *otg.FlowSnmpv2CPDU + ToProto() (*otg.FlowSnmpv2CPDU, error) + // ToPbText marshals FlowSnmpv2CPDU to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowSnmpv2CPDU to YAML text + ToYaml() (string, error) + // ToJson marshals FlowSnmpv2CPDU to JSON text + ToJson() (string, error) +} + +type unMarshalflowSnmpv2CPDU struct { + obj *flowSnmpv2CPDU +} + +type unMarshalFlowSnmpv2CPDU interface { + // FromProto unmarshals FlowSnmpv2CPDU from protobuf object *otg.FlowSnmpv2CPDU + FromProto(msg *otg.FlowSnmpv2CPDU) (FlowSnmpv2CPDU, error) + // FromPbText unmarshals FlowSnmpv2CPDU from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowSnmpv2CPDU from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowSnmpv2CPDU from JSON text + FromJson(value string) error +} + +func (obj *flowSnmpv2CPDU) Marshal() marshalFlowSnmpv2CPDU { + if obj.marshaller == nil { + obj.marshaller = &marshalflowSnmpv2CPDU{obj: obj} + } + return obj.marshaller +} + +func (obj *flowSnmpv2CPDU) Unmarshal() unMarshalFlowSnmpv2CPDU { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowSnmpv2CPDU{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowSnmpv2CPDU) ToProto() (*otg.FlowSnmpv2CPDU, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowSnmpv2CPDU) FromProto(msg *otg.FlowSnmpv2CPDU) (FlowSnmpv2CPDU, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowSnmpv2CPDU) 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 *unMarshalflowSnmpv2CPDU) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowSnmpv2CPDU) 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 *unMarshalflowSnmpv2CPDU) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowSnmpv2CPDU) 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 *unMarshalflowSnmpv2CPDU) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowSnmpv2CPDU) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowSnmpv2CPDU) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowSnmpv2CPDU) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowSnmpv2CPDU) Clone() (FlowSnmpv2CPDU, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowSnmpv2CPDU() + 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 +} + +func (obj *flowSnmpv2CPDU) setNil() { + obj.requestIdHolder = nil + obj.errorIndexHolder = nil + obj.variableBindingsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowSnmpv2CPDU is this contains the body of the SNMPv2C PDU. +type FlowSnmpv2CPDU interface { + Validation + // msg marshals FlowSnmpv2CPDU to protobuf object *otg.FlowSnmpv2CPDU + // and doesn't set defaults + msg() *otg.FlowSnmpv2CPDU + // setMsg unmarshals FlowSnmpv2CPDU from protobuf object *otg.FlowSnmpv2CPDU + // and doesn't set defaults + setMsg(*otg.FlowSnmpv2CPDU) FlowSnmpv2CPDU + // provides marshal interface + Marshal() marshalFlowSnmpv2CPDU + // provides unmarshal interface + Unmarshal() unMarshalFlowSnmpv2CPDU + // validate validates FlowSnmpv2CPDU + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowSnmpv2CPDU, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RequestId returns PatternFlowSnmpv2CPDURequestId, set in FlowSnmpv2CPDU. + RequestId() PatternFlowSnmpv2CPDURequestId + // SetRequestId assigns PatternFlowSnmpv2CPDURequestId provided by user to FlowSnmpv2CPDU. + SetRequestId(value PatternFlowSnmpv2CPDURequestId) FlowSnmpv2CPDU + // HasRequestId checks if RequestId has been set in FlowSnmpv2CPDU + HasRequestId() bool + // ErrorStatus returns FlowSnmpv2CPDUErrorStatusEnum, set in FlowSnmpv2CPDU + ErrorStatus() FlowSnmpv2CPDUErrorStatusEnum + // SetErrorStatus assigns FlowSnmpv2CPDUErrorStatusEnum provided by user to FlowSnmpv2CPDU + SetErrorStatus(value FlowSnmpv2CPDUErrorStatusEnum) FlowSnmpv2CPDU + // HasErrorStatus checks if ErrorStatus has been set in FlowSnmpv2CPDU + HasErrorStatus() bool + // ErrorIndex returns PatternFlowSnmpv2CPDUErrorIndex, set in FlowSnmpv2CPDU. + ErrorIndex() PatternFlowSnmpv2CPDUErrorIndex + // SetErrorIndex assigns PatternFlowSnmpv2CPDUErrorIndex provided by user to FlowSnmpv2CPDU. + SetErrorIndex(value PatternFlowSnmpv2CPDUErrorIndex) FlowSnmpv2CPDU + // HasErrorIndex checks if ErrorIndex has been set in FlowSnmpv2CPDU + HasErrorIndex() bool + // VariableBindings returns FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIterIter, set in FlowSnmpv2CPDU + VariableBindings() FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter + setNil() +} + +// description is TBD +// RequestId returns a PatternFlowSnmpv2CPDURequestId +func (obj *flowSnmpv2CPDU) RequestId() PatternFlowSnmpv2CPDURequestId { + if obj.obj.RequestId == nil { + obj.obj.RequestId = NewPatternFlowSnmpv2CPDURequestId().msg() + } + if obj.requestIdHolder == nil { + obj.requestIdHolder = &patternFlowSnmpv2CPDURequestId{obj: obj.obj.RequestId} + } + return obj.requestIdHolder +} + +// description is TBD +// RequestId returns a PatternFlowSnmpv2CPDURequestId +func (obj *flowSnmpv2CPDU) HasRequestId() bool { + return obj.obj.RequestId != nil +} + +// description is TBD +// SetRequestId sets the PatternFlowSnmpv2CPDURequestId value in the FlowSnmpv2CPDU object +func (obj *flowSnmpv2CPDU) SetRequestId(value PatternFlowSnmpv2CPDURequestId) FlowSnmpv2CPDU { + + obj.requestIdHolder = nil + obj.obj.RequestId = value.msg() + + return obj +} + +type FlowSnmpv2CPDUErrorStatusEnum string + +// Enum of ErrorStatus on FlowSnmpv2CPDU +var FlowSnmpv2CPDUErrorStatus = struct { + NO_ERROR FlowSnmpv2CPDUErrorStatusEnum + TOO_BIG FlowSnmpv2CPDUErrorStatusEnum + NO_SUCH_NAME FlowSnmpv2CPDUErrorStatusEnum + BAD_VALUE FlowSnmpv2CPDUErrorStatusEnum + READ_ONLY FlowSnmpv2CPDUErrorStatusEnum + GEN_ERR FlowSnmpv2CPDUErrorStatusEnum + NO_ACCESS FlowSnmpv2CPDUErrorStatusEnum + WRONG_TYPE FlowSnmpv2CPDUErrorStatusEnum + WRONG_LENGTH FlowSnmpv2CPDUErrorStatusEnum + WRONG_ENCODING FlowSnmpv2CPDUErrorStatusEnum + WRONG_VALUE FlowSnmpv2CPDUErrorStatusEnum + NO_CREATION FlowSnmpv2CPDUErrorStatusEnum + INCONSISTENT_VALUE FlowSnmpv2CPDUErrorStatusEnum + RESOURCE_UNAVAILABLE FlowSnmpv2CPDUErrorStatusEnum + COMMIT_FAILED FlowSnmpv2CPDUErrorStatusEnum + UNDO_FAILED FlowSnmpv2CPDUErrorStatusEnum + AUTHORIZATION_ERROR FlowSnmpv2CPDUErrorStatusEnum + NOT_WRITABLE FlowSnmpv2CPDUErrorStatusEnum + INCONSISTENT_NAME FlowSnmpv2CPDUErrorStatusEnum +}{ + NO_ERROR: FlowSnmpv2CPDUErrorStatusEnum("no_error"), + TOO_BIG: FlowSnmpv2CPDUErrorStatusEnum("too_big"), + NO_SUCH_NAME: FlowSnmpv2CPDUErrorStatusEnum("no_such_name"), + BAD_VALUE: FlowSnmpv2CPDUErrorStatusEnum("bad_value"), + READ_ONLY: FlowSnmpv2CPDUErrorStatusEnum("read_only"), + GEN_ERR: FlowSnmpv2CPDUErrorStatusEnum("gen_err"), + NO_ACCESS: FlowSnmpv2CPDUErrorStatusEnum("no_access"), + WRONG_TYPE: FlowSnmpv2CPDUErrorStatusEnum("wrong_type"), + WRONG_LENGTH: FlowSnmpv2CPDUErrorStatusEnum("wrong_length"), + WRONG_ENCODING: FlowSnmpv2CPDUErrorStatusEnum("wrong_encoding"), + WRONG_VALUE: FlowSnmpv2CPDUErrorStatusEnum("wrong_value"), + NO_CREATION: FlowSnmpv2CPDUErrorStatusEnum("no_creation"), + INCONSISTENT_VALUE: FlowSnmpv2CPDUErrorStatusEnum("inconsistent_value"), + RESOURCE_UNAVAILABLE: FlowSnmpv2CPDUErrorStatusEnum("resource_unavailable"), + COMMIT_FAILED: FlowSnmpv2CPDUErrorStatusEnum("commit_failed"), + UNDO_FAILED: FlowSnmpv2CPDUErrorStatusEnum("undo_failed"), + AUTHORIZATION_ERROR: FlowSnmpv2CPDUErrorStatusEnum("authorization_error"), + NOT_WRITABLE: FlowSnmpv2CPDUErrorStatusEnum("not_writable"), + INCONSISTENT_NAME: FlowSnmpv2CPDUErrorStatusEnum("inconsistent_name"), +} + +func (obj *flowSnmpv2CPDU) ErrorStatus() FlowSnmpv2CPDUErrorStatusEnum { + return FlowSnmpv2CPDUErrorStatusEnum(obj.obj.ErrorStatus.Enum().String()) +} + +// The SNMP agent places an error code in this field in the response message if an error occurred processing the request. +// ErrorStatus returns a string +func (obj *flowSnmpv2CPDU) HasErrorStatus() bool { + return obj.obj.ErrorStatus != nil +} + +func (obj *flowSnmpv2CPDU) SetErrorStatus(value FlowSnmpv2CPDUErrorStatusEnum) FlowSnmpv2CPDU { + intValue, ok := otg.FlowSnmpv2CPDU_ErrorStatus_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowSnmpv2CPDUErrorStatusEnum", string(value))) + return obj + } + enumValue := otg.FlowSnmpv2CPDU_ErrorStatus_Enum(intValue) + obj.obj.ErrorStatus = &enumValue + + return obj +} + +// description is TBD +// ErrorIndex returns a PatternFlowSnmpv2CPDUErrorIndex +func (obj *flowSnmpv2CPDU) ErrorIndex() PatternFlowSnmpv2CPDUErrorIndex { + if obj.obj.ErrorIndex == nil { + obj.obj.ErrorIndex = NewPatternFlowSnmpv2CPDUErrorIndex().msg() + } + if obj.errorIndexHolder == nil { + obj.errorIndexHolder = &patternFlowSnmpv2CPDUErrorIndex{obj: obj.obj.ErrorIndex} + } + return obj.errorIndexHolder +} + +// description is TBD +// ErrorIndex returns a PatternFlowSnmpv2CPDUErrorIndex +func (obj *flowSnmpv2CPDU) HasErrorIndex() bool { + return obj.obj.ErrorIndex != nil +} + +// description is TBD +// SetErrorIndex sets the PatternFlowSnmpv2CPDUErrorIndex value in the FlowSnmpv2CPDU object +func (obj *flowSnmpv2CPDU) SetErrorIndex(value PatternFlowSnmpv2CPDUErrorIndex) FlowSnmpv2CPDU { + + obj.errorIndexHolder = nil + obj.obj.ErrorIndex = value.msg() + + return obj +} + +// A Sequence of variable_bindings. +// VariableBindings returns a []FlowSnmpv2CVariableBinding +func (obj *flowSnmpv2CPDU) VariableBindings() FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { + if len(obj.obj.VariableBindings) == 0 { + obj.obj.VariableBindings = []*otg.FlowSnmpv2CVariableBinding{} + } + if obj.variableBindingsHolder == nil { + obj.variableBindingsHolder = newFlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter(&obj.obj.VariableBindings).setMsg(obj) + } + return obj.variableBindingsHolder +} + +type flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter struct { + obj *flowSnmpv2CPDU + flowSnmpv2CVariableBindingSlice []FlowSnmpv2CVariableBinding + fieldPtr *[]*otg.FlowSnmpv2CVariableBinding +} + +func newFlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter(ptr *[]*otg.FlowSnmpv2CVariableBinding) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { + return &flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter{fieldPtr: ptr} +} + +type FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter interface { + setMsg(*flowSnmpv2CPDU) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter + Items() []FlowSnmpv2CVariableBinding + Add() FlowSnmpv2CVariableBinding + Append(items ...FlowSnmpv2CVariableBinding) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter + Set(index int, newObj FlowSnmpv2CVariableBinding) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter + Clear() FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter + clearHolderSlice() FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter + appendHolderSlice(item FlowSnmpv2CVariableBinding) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter +} + +func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) setMsg(msg *flowSnmpv2CPDU) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flowSnmpv2CVariableBinding{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) Items() []FlowSnmpv2CVariableBinding { + return obj.flowSnmpv2CVariableBindingSlice +} + +func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) Add() FlowSnmpv2CVariableBinding { + newObj := &otg.FlowSnmpv2CVariableBinding{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flowSnmpv2CVariableBinding{obj: newObj} + newLibObj.setDefault() + obj.flowSnmpv2CVariableBindingSlice = append(obj.flowSnmpv2CVariableBindingSlice, newLibObj) + return newLibObj +} + +func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) Append(items ...FlowSnmpv2CVariableBinding) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowSnmpv2CVariableBindingSlice = append(obj.flowSnmpv2CVariableBindingSlice, item) + } + return obj +} + +func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) Set(index int, newObj FlowSnmpv2CVariableBinding) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowSnmpv2CVariableBindingSlice[index] = newObj + return obj +} +func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) Clear() FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.FlowSnmpv2CVariableBinding{} + obj.flowSnmpv2CVariableBindingSlice = []FlowSnmpv2CVariableBinding{} + } + return obj +} +func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) clearHolderSlice() FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { + if len(obj.flowSnmpv2CVariableBindingSlice) > 0 { + obj.flowSnmpv2CVariableBindingSlice = []FlowSnmpv2CVariableBinding{} + } + return obj +} +func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) appendHolderSlice(item FlowSnmpv2CVariableBinding) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { + obj.flowSnmpv2CVariableBindingSlice = append(obj.flowSnmpv2CVariableBindingSlice, item) + return obj +} + +func (obj *flowSnmpv2CPDU) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RequestId != nil { + + obj.RequestId().validateObj(vObj, set_default) + } + + if obj.obj.ErrorIndex != nil { + + obj.ErrorIndex().validateObj(vObj, set_default) + } + + if len(obj.obj.VariableBindings) != 0 { + + if set_default { + obj.VariableBindings().clearHolderSlice() + for _, item := range obj.obj.VariableBindings { + obj.VariableBindings().appendHolderSlice(&flowSnmpv2CVariableBinding{obj: item}) + } + } + for _, item := range obj.VariableBindings().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *flowSnmpv2CPDU) setDefault() { + if obj.obj.ErrorStatus == nil { + obj.SetErrorStatus(FlowSnmpv2CPDUErrorStatus.NO_ERROR) + + } + +} diff --git a/gosnappi/flow_tagged_metric.go b/gosnappi/flow_tagged_metric.go new file mode 100644 index 00000000..f76cfe97 --- /dev/null +++ b/gosnappi/flow_tagged_metric.go @@ -0,0 +1,686 @@ +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" +) + +// ***** FlowTaggedMetric ***** +type flowTaggedMetric struct { + validation + obj *otg.FlowTaggedMetric + marshaller marshalFlowTaggedMetric + unMarshaller unMarshalFlowTaggedMetric + tagsHolder FlowTaggedMetricFlowMetricTagIter + timestampsHolder MetricTimestamp + latencyHolder MetricLatency +} + +func NewFlowTaggedMetric() FlowTaggedMetric { + obj := flowTaggedMetric{obj: &otg.FlowTaggedMetric{}} + obj.setDefault() + return &obj +} + +func (obj *flowTaggedMetric) msg() *otg.FlowTaggedMetric { + return obj.obj +} + +func (obj *flowTaggedMetric) setMsg(msg *otg.FlowTaggedMetric) FlowTaggedMetric { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowTaggedMetric struct { + obj *flowTaggedMetric +} + +type marshalFlowTaggedMetric interface { + // ToProto marshals FlowTaggedMetric to protobuf object *otg.FlowTaggedMetric + ToProto() (*otg.FlowTaggedMetric, error) + // ToPbText marshals FlowTaggedMetric to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowTaggedMetric to YAML text + ToYaml() (string, error) + // ToJson marshals FlowTaggedMetric to JSON text + ToJson() (string, error) +} + +type unMarshalflowTaggedMetric struct { + obj *flowTaggedMetric +} + +type unMarshalFlowTaggedMetric interface { + // FromProto unmarshals FlowTaggedMetric from protobuf object *otg.FlowTaggedMetric + FromProto(msg *otg.FlowTaggedMetric) (FlowTaggedMetric, error) + // FromPbText unmarshals FlowTaggedMetric from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowTaggedMetric from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowTaggedMetric from JSON text + FromJson(value string) error +} + +func (obj *flowTaggedMetric) Marshal() marshalFlowTaggedMetric { + if obj.marshaller == nil { + obj.marshaller = &marshalflowTaggedMetric{obj: obj} + } + return obj.marshaller +} + +func (obj *flowTaggedMetric) Unmarshal() unMarshalFlowTaggedMetric { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowTaggedMetric{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowTaggedMetric) ToProto() (*otg.FlowTaggedMetric, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowTaggedMetric) FromProto(msg *otg.FlowTaggedMetric) (FlowTaggedMetric, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowTaggedMetric) 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 *unMarshalflowTaggedMetric) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowTaggedMetric) 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 *unMarshalflowTaggedMetric) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowTaggedMetric) 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 *unMarshalflowTaggedMetric) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowTaggedMetric) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowTaggedMetric) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowTaggedMetric) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowTaggedMetric) Clone() (FlowTaggedMetric, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowTaggedMetric() + 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 +} + +func (obj *flowTaggedMetric) setNil() { + obj.tagsHolder = nil + obj.timestampsHolder = nil + obj.latencyHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowTaggedMetric is metrics for each set of values applicable for configured +// metric tags in ingress or egress packet header fields of corresponding flow. +// The container is keyed by list of tag-value pairs. +type FlowTaggedMetric interface { + Validation + // msg marshals FlowTaggedMetric to protobuf object *otg.FlowTaggedMetric + // and doesn't set defaults + msg() *otg.FlowTaggedMetric + // setMsg unmarshals FlowTaggedMetric from protobuf object *otg.FlowTaggedMetric + // and doesn't set defaults + setMsg(*otg.FlowTaggedMetric) FlowTaggedMetric + // provides marshal interface + Marshal() marshalFlowTaggedMetric + // provides unmarshal interface + Unmarshal() unMarshalFlowTaggedMetric + // validate validates FlowTaggedMetric + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowTaggedMetric, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Tags returns FlowTaggedMetricFlowMetricTagIterIter, set in FlowTaggedMetric + Tags() FlowTaggedMetricFlowMetricTagIter + // FramesTx returns uint64, set in FlowTaggedMetric. + FramesTx() uint64 + // SetFramesTx assigns uint64 provided by user to FlowTaggedMetric + SetFramesTx(value uint64) FlowTaggedMetric + // HasFramesTx checks if FramesTx has been set in FlowTaggedMetric + HasFramesTx() bool + // FramesRx returns uint64, set in FlowTaggedMetric. + FramesRx() uint64 + // SetFramesRx assigns uint64 provided by user to FlowTaggedMetric + SetFramesRx(value uint64) FlowTaggedMetric + // HasFramesRx checks if FramesRx has been set in FlowTaggedMetric + HasFramesRx() bool + // BytesTx returns uint64, set in FlowTaggedMetric. + BytesTx() uint64 + // SetBytesTx assigns uint64 provided by user to FlowTaggedMetric + SetBytesTx(value uint64) FlowTaggedMetric + // HasBytesTx checks if BytesTx has been set in FlowTaggedMetric + HasBytesTx() bool + // BytesRx returns uint64, set in FlowTaggedMetric. + BytesRx() uint64 + // SetBytesRx assigns uint64 provided by user to FlowTaggedMetric + SetBytesRx(value uint64) FlowTaggedMetric + // HasBytesRx checks if BytesRx has been set in FlowTaggedMetric + HasBytesRx() bool + // FramesTxRate returns float32, set in FlowTaggedMetric. + FramesTxRate() float32 + // SetFramesTxRate assigns float32 provided by user to FlowTaggedMetric + SetFramesTxRate(value float32) FlowTaggedMetric + // HasFramesTxRate checks if FramesTxRate has been set in FlowTaggedMetric + HasFramesTxRate() bool + // FramesRxRate returns float32, set in FlowTaggedMetric. + FramesRxRate() float32 + // SetFramesRxRate assigns float32 provided by user to FlowTaggedMetric + SetFramesRxRate(value float32) FlowTaggedMetric + // HasFramesRxRate checks if FramesRxRate has been set in FlowTaggedMetric + HasFramesRxRate() bool + // Loss returns float32, set in FlowTaggedMetric. + Loss() float32 + // SetLoss assigns float32 provided by user to FlowTaggedMetric + SetLoss(value float32) FlowTaggedMetric + // HasLoss checks if Loss has been set in FlowTaggedMetric + HasLoss() bool + // Timestamps returns MetricTimestamp, set in FlowTaggedMetric. + // MetricTimestamp is the container for timestamp metrics. + // The container will be empty if the timestamp has not been configured for + // the flow. + Timestamps() MetricTimestamp + // SetTimestamps assigns MetricTimestamp provided by user to FlowTaggedMetric. + // MetricTimestamp is the container for timestamp metrics. + // The container will be empty if the timestamp has not been configured for + // the flow. + SetTimestamps(value MetricTimestamp) FlowTaggedMetric + // HasTimestamps checks if Timestamps has been set in FlowTaggedMetric + HasTimestamps() bool + // Latency returns MetricLatency, set in FlowTaggedMetric. + // MetricLatency is the container for latency metrics. + // The min/max/avg values are dependent on the type of latency measurement + // mode that is configured. + // The container will be empty if the latency has not been configured for + // the flow. + Latency() MetricLatency + // SetLatency assigns MetricLatency provided by user to FlowTaggedMetric. + // MetricLatency is the container for latency metrics. + // The min/max/avg values are dependent on the type of latency measurement + // mode that is configured. + // The container will be empty if the latency has not been configured for + // the flow. + SetLatency(value MetricLatency) FlowTaggedMetric + // HasLatency checks if Latency has been set in FlowTaggedMetric + HasLatency() bool + setNil() +} + +// List of tag and value pairs +// Tags returns a []FlowMetricTag +func (obj *flowTaggedMetric) Tags() FlowTaggedMetricFlowMetricTagIter { + if len(obj.obj.Tags) == 0 { + obj.obj.Tags = []*otg.FlowMetricTag{} + } + if obj.tagsHolder == nil { + obj.tagsHolder = newFlowTaggedMetricFlowMetricTagIter(&obj.obj.Tags).setMsg(obj) + } + return obj.tagsHolder +} + +type flowTaggedMetricFlowMetricTagIter struct { + obj *flowTaggedMetric + flowMetricTagSlice []FlowMetricTag + fieldPtr *[]*otg.FlowMetricTag +} + +func newFlowTaggedMetricFlowMetricTagIter(ptr *[]*otg.FlowMetricTag) FlowTaggedMetricFlowMetricTagIter { + return &flowTaggedMetricFlowMetricTagIter{fieldPtr: ptr} +} + +type FlowTaggedMetricFlowMetricTagIter interface { + setMsg(*flowTaggedMetric) FlowTaggedMetricFlowMetricTagIter + Items() []FlowMetricTag + Add() FlowMetricTag + Append(items ...FlowMetricTag) FlowTaggedMetricFlowMetricTagIter + Set(index int, newObj FlowMetricTag) FlowTaggedMetricFlowMetricTagIter + Clear() FlowTaggedMetricFlowMetricTagIter + clearHolderSlice() FlowTaggedMetricFlowMetricTagIter + appendHolderSlice(item FlowMetricTag) FlowTaggedMetricFlowMetricTagIter +} + +func (obj *flowTaggedMetricFlowMetricTagIter) setMsg(msg *flowTaggedMetric) FlowTaggedMetricFlowMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flowMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *flowTaggedMetricFlowMetricTagIter) Items() []FlowMetricTag { + return obj.flowMetricTagSlice +} + +func (obj *flowTaggedMetricFlowMetricTagIter) Add() FlowMetricTag { + newObj := &otg.FlowMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flowMetricTag{obj: newObj} + newLibObj.setDefault() + obj.flowMetricTagSlice = append(obj.flowMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *flowTaggedMetricFlowMetricTagIter) Append(items ...FlowMetricTag) FlowTaggedMetricFlowMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowMetricTagSlice = append(obj.flowMetricTagSlice, item) + } + return obj +} + +func (obj *flowTaggedMetricFlowMetricTagIter) Set(index int, newObj FlowMetricTag) FlowTaggedMetricFlowMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowMetricTagSlice[index] = newObj + return obj +} +func (obj *flowTaggedMetricFlowMetricTagIter) Clear() FlowTaggedMetricFlowMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.FlowMetricTag{} + obj.flowMetricTagSlice = []FlowMetricTag{} + } + return obj +} +func (obj *flowTaggedMetricFlowMetricTagIter) clearHolderSlice() FlowTaggedMetricFlowMetricTagIter { + if len(obj.flowMetricTagSlice) > 0 { + obj.flowMetricTagSlice = []FlowMetricTag{} + } + return obj +} +func (obj *flowTaggedMetricFlowMetricTagIter) appendHolderSlice(item FlowMetricTag) FlowTaggedMetricFlowMetricTagIter { + obj.flowMetricTagSlice = append(obj.flowMetricTagSlice, item) + return obj +} + +// The current total number of frames transmitted +// FramesTx returns a uint64 +func (obj *flowTaggedMetric) FramesTx() uint64 { + + return *obj.obj.FramesTx + +} + +// The current total number of frames transmitted +// FramesTx returns a uint64 +func (obj *flowTaggedMetric) HasFramesTx() bool { + return obj.obj.FramesTx != nil +} + +// The current total number of frames transmitted +// SetFramesTx sets the uint64 value in the FlowTaggedMetric object +func (obj *flowTaggedMetric) SetFramesTx(value uint64) FlowTaggedMetric { + + obj.obj.FramesTx = &value + return obj +} + +// The current total number of valid frames received +// FramesRx returns a uint64 +func (obj *flowTaggedMetric) FramesRx() uint64 { + + return *obj.obj.FramesRx + +} + +// The current total number of valid frames received +// FramesRx returns a uint64 +func (obj *flowTaggedMetric) HasFramesRx() bool { + return obj.obj.FramesRx != nil +} + +// The current total number of valid frames received +// SetFramesRx sets the uint64 value in the FlowTaggedMetric object +func (obj *flowTaggedMetric) SetFramesRx(value uint64) FlowTaggedMetric { + + obj.obj.FramesRx = &value + return obj +} + +// The current total number of bytes transmitted +// BytesTx returns a uint64 +func (obj *flowTaggedMetric) BytesTx() uint64 { + + return *obj.obj.BytesTx + +} + +// The current total number of bytes transmitted +// BytesTx returns a uint64 +func (obj *flowTaggedMetric) HasBytesTx() bool { + return obj.obj.BytesTx != nil +} + +// The current total number of bytes transmitted +// SetBytesTx sets the uint64 value in the FlowTaggedMetric object +func (obj *flowTaggedMetric) SetBytesTx(value uint64) FlowTaggedMetric { + + obj.obj.BytesTx = &value + return obj +} + +// The current total number of bytes received +// BytesRx returns a uint64 +func (obj *flowTaggedMetric) BytesRx() uint64 { + + return *obj.obj.BytesRx + +} + +// The current total number of bytes received +// BytesRx returns a uint64 +func (obj *flowTaggedMetric) HasBytesRx() bool { + return obj.obj.BytesRx != nil +} + +// The current total number of bytes received +// SetBytesRx sets the uint64 value in the FlowTaggedMetric object +func (obj *flowTaggedMetric) SetBytesRx(value uint64) FlowTaggedMetric { + + obj.obj.BytesRx = &value + return obj +} + +// The current rate of frames transmitted +// FramesTxRate returns a float32 +func (obj *flowTaggedMetric) FramesTxRate() float32 { + + return *obj.obj.FramesTxRate + +} + +// The current rate of frames transmitted +// FramesTxRate returns a float32 +func (obj *flowTaggedMetric) HasFramesTxRate() bool { + return obj.obj.FramesTxRate != nil +} + +// The current rate of frames transmitted +// SetFramesTxRate sets the float32 value in the FlowTaggedMetric object +func (obj *flowTaggedMetric) SetFramesTxRate(value float32) FlowTaggedMetric { + + obj.obj.FramesTxRate = &value + return obj +} + +// The current rate of valid frames received +// FramesRxRate returns a float32 +func (obj *flowTaggedMetric) FramesRxRate() float32 { + + return *obj.obj.FramesRxRate + +} + +// The current rate of valid frames received +// FramesRxRate returns a float32 +func (obj *flowTaggedMetric) HasFramesRxRate() bool { + return obj.obj.FramesRxRate != nil +} + +// The current rate of valid frames received +// SetFramesRxRate sets the float32 value in the FlowTaggedMetric object +func (obj *flowTaggedMetric) SetFramesRxRate(value float32) FlowTaggedMetric { + + obj.obj.FramesRxRate = &value + return obj +} + +// The percentage of lost frames +// Loss returns a float32 +func (obj *flowTaggedMetric) Loss() float32 { + + return *obj.obj.Loss + +} + +// The percentage of lost frames +// Loss returns a float32 +func (obj *flowTaggedMetric) HasLoss() bool { + return obj.obj.Loss != nil +} + +// The percentage of lost frames +// SetLoss sets the float32 value in the FlowTaggedMetric object +func (obj *flowTaggedMetric) SetLoss(value float32) FlowTaggedMetric { + + obj.obj.Loss = &value + return obj +} + +// description is TBD +// Timestamps returns a MetricTimestamp +func (obj *flowTaggedMetric) Timestamps() MetricTimestamp { + if obj.obj.Timestamps == nil { + obj.obj.Timestamps = NewMetricTimestamp().msg() + } + if obj.timestampsHolder == nil { + obj.timestampsHolder = &metricTimestamp{obj: obj.obj.Timestamps} + } + return obj.timestampsHolder +} + +// description is TBD +// Timestamps returns a MetricTimestamp +func (obj *flowTaggedMetric) HasTimestamps() bool { + return obj.obj.Timestamps != nil +} + +// description is TBD +// SetTimestamps sets the MetricTimestamp value in the FlowTaggedMetric object +func (obj *flowTaggedMetric) SetTimestamps(value MetricTimestamp) FlowTaggedMetric { + + obj.timestampsHolder = nil + obj.obj.Timestamps = value.msg() + + return obj +} + +// description is TBD +// Latency returns a MetricLatency +func (obj *flowTaggedMetric) Latency() MetricLatency { + if obj.obj.Latency == nil { + obj.obj.Latency = NewMetricLatency().msg() + } + if obj.latencyHolder == nil { + obj.latencyHolder = &metricLatency{obj: obj.obj.Latency} + } + return obj.latencyHolder +} + +// description is TBD +// Latency returns a MetricLatency +func (obj *flowTaggedMetric) HasLatency() bool { + return obj.obj.Latency != nil +} + +// description is TBD +// SetLatency sets the MetricLatency value in the FlowTaggedMetric object +func (obj *flowTaggedMetric) SetLatency(value MetricLatency) FlowTaggedMetric { + + obj.latencyHolder = nil + obj.obj.Latency = value.msg() + + return obj +} + +func (obj *flowTaggedMetric) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Tags) != 0 { + + if set_default { + obj.Tags().clearHolderSlice() + for _, item := range obj.obj.Tags { + obj.Tags().appendHolderSlice(&flowMetricTag{obj: item}) + } + } + for _, item := range obj.Tags().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Timestamps != nil { + + obj.Timestamps().validateObj(vObj, set_default) + } + + if obj.obj.Latency != nil { + + obj.Latency().validateObj(vObj, set_default) + } + +} + +func (obj *flowTaggedMetric) setDefault() { + +} diff --git a/gosnappi/flow_tagged_metrics_filter.go b/gosnappi/flow_tagged_metrics_filter.go new file mode 100644 index 00000000..6b096f39 --- /dev/null +++ b/gosnappi/flow_tagged_metrics_filter.go @@ -0,0 +1,496 @@ +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" +) + +// ***** FlowTaggedMetricsFilter ***** +type flowTaggedMetricsFilter struct { + validation + obj *otg.FlowTaggedMetricsFilter + marshaller marshalFlowTaggedMetricsFilter + unMarshaller unMarshalFlowTaggedMetricsFilter + filtersHolder FlowTaggedMetricsFilterFlowMetricTagFilterIter +} + +func NewFlowTaggedMetricsFilter() FlowTaggedMetricsFilter { + obj := flowTaggedMetricsFilter{obj: &otg.FlowTaggedMetricsFilter{}} + obj.setDefault() + return &obj +} + +func (obj *flowTaggedMetricsFilter) msg() *otg.FlowTaggedMetricsFilter { + return obj.obj +} + +func (obj *flowTaggedMetricsFilter) setMsg(msg *otg.FlowTaggedMetricsFilter) FlowTaggedMetricsFilter { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowTaggedMetricsFilter struct { + obj *flowTaggedMetricsFilter +} + +type marshalFlowTaggedMetricsFilter interface { + // ToProto marshals FlowTaggedMetricsFilter to protobuf object *otg.FlowTaggedMetricsFilter + ToProto() (*otg.FlowTaggedMetricsFilter, error) + // ToPbText marshals FlowTaggedMetricsFilter to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowTaggedMetricsFilter to YAML text + ToYaml() (string, error) + // ToJson marshals FlowTaggedMetricsFilter to JSON text + ToJson() (string, error) +} + +type unMarshalflowTaggedMetricsFilter struct { + obj *flowTaggedMetricsFilter +} + +type unMarshalFlowTaggedMetricsFilter interface { + // FromProto unmarshals FlowTaggedMetricsFilter from protobuf object *otg.FlowTaggedMetricsFilter + FromProto(msg *otg.FlowTaggedMetricsFilter) (FlowTaggedMetricsFilter, error) + // FromPbText unmarshals FlowTaggedMetricsFilter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowTaggedMetricsFilter from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowTaggedMetricsFilter from JSON text + FromJson(value string) error +} + +func (obj *flowTaggedMetricsFilter) Marshal() marshalFlowTaggedMetricsFilter { + if obj.marshaller == nil { + obj.marshaller = &marshalflowTaggedMetricsFilter{obj: obj} + } + return obj.marshaller +} + +func (obj *flowTaggedMetricsFilter) Unmarshal() unMarshalFlowTaggedMetricsFilter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowTaggedMetricsFilter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowTaggedMetricsFilter) ToProto() (*otg.FlowTaggedMetricsFilter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowTaggedMetricsFilter) FromProto(msg *otg.FlowTaggedMetricsFilter) (FlowTaggedMetricsFilter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowTaggedMetricsFilter) 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 *unMarshalflowTaggedMetricsFilter) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowTaggedMetricsFilter) 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 *unMarshalflowTaggedMetricsFilter) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowTaggedMetricsFilter) 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 *unMarshalflowTaggedMetricsFilter) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowTaggedMetricsFilter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowTaggedMetricsFilter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowTaggedMetricsFilter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowTaggedMetricsFilter) Clone() (FlowTaggedMetricsFilter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowTaggedMetricsFilter() + 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 +} + +func (obj *flowTaggedMetricsFilter) setNil() { + obj.filtersHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowTaggedMetricsFilter is filter for tagged metrics +type FlowTaggedMetricsFilter interface { + Validation + // msg marshals FlowTaggedMetricsFilter to protobuf object *otg.FlowTaggedMetricsFilter + // and doesn't set defaults + msg() *otg.FlowTaggedMetricsFilter + // setMsg unmarshals FlowTaggedMetricsFilter from protobuf object *otg.FlowTaggedMetricsFilter + // and doesn't set defaults + setMsg(*otg.FlowTaggedMetricsFilter) FlowTaggedMetricsFilter + // provides marshal interface + Marshal() marshalFlowTaggedMetricsFilter + // provides unmarshal interface + Unmarshal() unMarshalFlowTaggedMetricsFilter + // validate validates FlowTaggedMetricsFilter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowTaggedMetricsFilter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Include returns bool, set in FlowTaggedMetricsFilter. + Include() bool + // SetInclude assigns bool provided by user to FlowTaggedMetricsFilter + SetInclude(value bool) FlowTaggedMetricsFilter + // HasInclude checks if Include has been set in FlowTaggedMetricsFilter + HasInclude() bool + // IncludeEmptyMetrics returns bool, set in FlowTaggedMetricsFilter. + IncludeEmptyMetrics() bool + // SetIncludeEmptyMetrics assigns bool provided by user to FlowTaggedMetricsFilter + SetIncludeEmptyMetrics(value bool) FlowTaggedMetricsFilter + // HasIncludeEmptyMetrics checks if IncludeEmptyMetrics has been set in FlowTaggedMetricsFilter + HasIncludeEmptyMetrics() bool + // MetricNames returns []FlowTaggedMetricsFilterMetricNamesEnum, set in FlowTaggedMetricsFilter + MetricNames() []FlowTaggedMetricsFilterMetricNamesEnum + // SetMetricNames assigns []FlowTaggedMetricsFilterMetricNamesEnum provided by user to FlowTaggedMetricsFilter + SetMetricNames(value []FlowTaggedMetricsFilterMetricNamesEnum) FlowTaggedMetricsFilter + // Filters returns FlowTaggedMetricsFilterFlowMetricTagFilterIterIter, set in FlowTaggedMetricsFilter + Filters() FlowTaggedMetricsFilterFlowMetricTagFilterIter + setNil() +} + +// Controls inclusion/exclusion of tagged metrics when fetching flow metrics. +// Include returns a bool +func (obj *flowTaggedMetricsFilter) Include() bool { + + return *obj.obj.Include + +} + +// Controls inclusion/exclusion of tagged metrics when fetching flow metrics. +// Include returns a bool +func (obj *flowTaggedMetricsFilter) HasInclude() bool { + return obj.obj.Include != nil +} + +// Controls inclusion/exclusion of tagged metrics when fetching flow metrics. +// SetInclude sets the bool value in the FlowTaggedMetricsFilter object +func (obj *flowTaggedMetricsFilter) SetInclude(value bool) FlowTaggedMetricsFilter { + + obj.obj.Include = &value + return obj +} + +// Controls inclusion/exclusion of tagged metrics where each underlying attributes has zero value or absent value. +// IncludeEmptyMetrics returns a bool +func (obj *flowTaggedMetricsFilter) IncludeEmptyMetrics() bool { + + return *obj.obj.IncludeEmptyMetrics + +} + +// Controls inclusion/exclusion of tagged metrics where each underlying attributes has zero value or absent value. +// IncludeEmptyMetrics returns a bool +func (obj *flowTaggedMetricsFilter) HasIncludeEmptyMetrics() bool { + return obj.obj.IncludeEmptyMetrics != nil +} + +// Controls inclusion/exclusion of tagged metrics where each underlying attributes has zero value or absent value. +// SetIncludeEmptyMetrics sets the bool value in the FlowTaggedMetricsFilter object +func (obj *flowTaggedMetricsFilter) SetIncludeEmptyMetrics(value bool) FlowTaggedMetricsFilter { + + obj.obj.IncludeEmptyMetrics = &value + return obj +} + +type FlowTaggedMetricsFilterMetricNamesEnum string + +// Enum of MetricNames on FlowTaggedMetricsFilter +var FlowTaggedMetricsFilterMetricNames = struct { + FRAMES_TX FlowTaggedMetricsFilterMetricNamesEnum + FRAMES_RX FlowTaggedMetricsFilterMetricNamesEnum + BYTES_TX FlowTaggedMetricsFilterMetricNamesEnum + BYTES_RX FlowTaggedMetricsFilterMetricNamesEnum + FRAMES_TX_RATE FlowTaggedMetricsFilterMetricNamesEnum + FRAMES_RX_RATE FlowTaggedMetricsFilterMetricNamesEnum +}{ + FRAMES_TX: FlowTaggedMetricsFilterMetricNamesEnum("frames_tx"), + FRAMES_RX: FlowTaggedMetricsFilterMetricNamesEnum("frames_rx"), + BYTES_TX: FlowTaggedMetricsFilterMetricNamesEnum("bytes_tx"), + BYTES_RX: FlowTaggedMetricsFilterMetricNamesEnum("bytes_rx"), + FRAMES_TX_RATE: FlowTaggedMetricsFilterMetricNamesEnum("frames_tx_rate"), + FRAMES_RX_RATE: FlowTaggedMetricsFilterMetricNamesEnum("frames_rx_rate"), +} + +func (obj *flowTaggedMetricsFilter) MetricNames() []FlowTaggedMetricsFilterMetricNamesEnum { + items := []FlowTaggedMetricsFilterMetricNamesEnum{} + for _, item := range obj.obj.MetricNames { + items = append(items, FlowTaggedMetricsFilterMetricNamesEnum(item.String())) + } + return items +} + +// The list of metric names that the returned result set will contain. If the list is empty then all metrics will be returned. +// SetMetricNames sets the []string value in the FlowTaggedMetricsFilter object +func (obj *flowTaggedMetricsFilter) SetMetricNames(value []FlowTaggedMetricsFilterMetricNamesEnum) FlowTaggedMetricsFilter { + + items := []otg.FlowTaggedMetricsFilter_MetricNames_Enum{} + for _, item := range value { + intValue := otg.FlowTaggedMetricsFilter_MetricNames_Enum_value[string(item)] + items = append(items, otg.FlowTaggedMetricsFilter_MetricNames_Enum(intValue)) + } + obj.obj.MetricNames = items + return obj +} + +// List of filters to selectively fetch tagged metrics with certain tag and corresponding value. +// Filters returns a []FlowMetricTagFilter +func (obj *flowTaggedMetricsFilter) Filters() FlowTaggedMetricsFilterFlowMetricTagFilterIter { + if len(obj.obj.Filters) == 0 { + obj.obj.Filters = []*otg.FlowMetricTagFilter{} + } + if obj.filtersHolder == nil { + obj.filtersHolder = newFlowTaggedMetricsFilterFlowMetricTagFilterIter(&obj.obj.Filters).setMsg(obj) + } + return obj.filtersHolder +} + +type flowTaggedMetricsFilterFlowMetricTagFilterIter struct { + obj *flowTaggedMetricsFilter + flowMetricTagFilterSlice []FlowMetricTagFilter + fieldPtr *[]*otg.FlowMetricTagFilter +} + +func newFlowTaggedMetricsFilterFlowMetricTagFilterIter(ptr *[]*otg.FlowMetricTagFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter { + return &flowTaggedMetricsFilterFlowMetricTagFilterIter{fieldPtr: ptr} +} + +type FlowTaggedMetricsFilterFlowMetricTagFilterIter interface { + setMsg(*flowTaggedMetricsFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter + Items() []FlowMetricTagFilter + Add() FlowMetricTagFilter + Append(items ...FlowMetricTagFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter + Set(index int, newObj FlowMetricTagFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter + Clear() FlowTaggedMetricsFilterFlowMetricTagFilterIter + clearHolderSlice() FlowTaggedMetricsFilterFlowMetricTagFilterIter + appendHolderSlice(item FlowMetricTagFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter +} + +func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) setMsg(msg *flowTaggedMetricsFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flowMetricTagFilter{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) Items() []FlowMetricTagFilter { + return obj.flowMetricTagFilterSlice +} + +func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) Add() FlowMetricTagFilter { + newObj := &otg.FlowMetricTagFilter{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flowMetricTagFilter{obj: newObj} + newLibObj.setDefault() + obj.flowMetricTagFilterSlice = append(obj.flowMetricTagFilterSlice, newLibObj) + return newLibObj +} + +func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) Append(items ...FlowMetricTagFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowMetricTagFilterSlice = append(obj.flowMetricTagFilterSlice, item) + } + return obj +} + +func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) Set(index int, newObj FlowMetricTagFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowMetricTagFilterSlice[index] = newObj + return obj +} +func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) Clear() FlowTaggedMetricsFilterFlowMetricTagFilterIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.FlowMetricTagFilter{} + obj.flowMetricTagFilterSlice = []FlowMetricTagFilter{} + } + return obj +} +func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) clearHolderSlice() FlowTaggedMetricsFilterFlowMetricTagFilterIter { + if len(obj.flowMetricTagFilterSlice) > 0 { + obj.flowMetricTagFilterSlice = []FlowMetricTagFilter{} + } + return obj +} +func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) appendHolderSlice(item FlowMetricTagFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter { + obj.flowMetricTagFilterSlice = append(obj.flowMetricTagFilterSlice, item) + return obj +} + +func (obj *flowTaggedMetricsFilter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Filters) != 0 { + + if set_default { + obj.Filters().clearHolderSlice() + for _, item := range obj.obj.Filters { + obj.Filters().appendHolderSlice(&flowMetricTagFilter{obj: item}) + } + } + for _, item := range obj.Filters().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *flowTaggedMetricsFilter) setDefault() { + if obj.obj.Include == nil { + obj.SetInclude(true) + } + if obj.obj.IncludeEmptyMetrics == nil { + obj.SetIncludeEmptyMetrics(false) + } + +} diff --git a/gosnappi/flow_tcp.go b/gosnappi/flow_tcp.go new file mode 100644 index 00000000..a9b4c3ad --- /dev/null +++ b/gosnappi/flow_tcp.go @@ -0,0 +1,973 @@ +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" +) + +// ***** FlowTcp ***** +type flowTcp struct { + validation + obj *otg.FlowTcp + marshaller marshalFlowTcp + unMarshaller unMarshalFlowTcp + srcPortHolder PatternFlowTcpSrcPort + dstPortHolder PatternFlowTcpDstPort + seqNumHolder PatternFlowTcpSeqNum + ackNumHolder PatternFlowTcpAckNum + dataOffsetHolder PatternFlowTcpDataOffset + ecnNsHolder PatternFlowTcpEcnNs + ecnCwrHolder PatternFlowTcpEcnCwr + ecnEchoHolder PatternFlowTcpEcnEcho + ctlUrgHolder PatternFlowTcpCtlUrg + ctlAckHolder PatternFlowTcpCtlAck + ctlPshHolder PatternFlowTcpCtlPsh + ctlRstHolder PatternFlowTcpCtlRst + ctlSynHolder PatternFlowTcpCtlSyn + ctlFinHolder PatternFlowTcpCtlFin + windowHolder PatternFlowTcpWindow + checksumHolder PatternFlowTcpChecksum +} + +func NewFlowTcp() FlowTcp { + obj := flowTcp{obj: &otg.FlowTcp{}} + obj.setDefault() + return &obj +} + +func (obj *flowTcp) msg() *otg.FlowTcp { + return obj.obj +} + +func (obj *flowTcp) setMsg(msg *otg.FlowTcp) FlowTcp { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowTcp struct { + obj *flowTcp +} + +type marshalFlowTcp interface { + // ToProto marshals FlowTcp to protobuf object *otg.FlowTcp + ToProto() (*otg.FlowTcp, error) + // ToPbText marshals FlowTcp to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowTcp to YAML text + ToYaml() (string, error) + // ToJson marshals FlowTcp to JSON text + ToJson() (string, error) +} + +type unMarshalflowTcp struct { + obj *flowTcp +} + +type unMarshalFlowTcp interface { + // FromProto unmarshals FlowTcp from protobuf object *otg.FlowTcp + FromProto(msg *otg.FlowTcp) (FlowTcp, error) + // FromPbText unmarshals FlowTcp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowTcp from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowTcp from JSON text + FromJson(value string) error +} + +func (obj *flowTcp) Marshal() marshalFlowTcp { + if obj.marshaller == nil { + obj.marshaller = &marshalflowTcp{obj: obj} + } + return obj.marshaller +} + +func (obj *flowTcp) Unmarshal() unMarshalFlowTcp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowTcp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowTcp) ToProto() (*otg.FlowTcp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowTcp) FromProto(msg *otg.FlowTcp) (FlowTcp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowTcp) 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 *unMarshalflowTcp) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowTcp) 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 *unMarshalflowTcp) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowTcp) 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 *unMarshalflowTcp) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowTcp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowTcp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowTcp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowTcp) Clone() (FlowTcp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowTcp() + 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 +} + +func (obj *flowTcp) setNil() { + obj.srcPortHolder = nil + obj.dstPortHolder = nil + obj.seqNumHolder = nil + obj.ackNumHolder = nil + obj.dataOffsetHolder = nil + obj.ecnNsHolder = nil + obj.ecnCwrHolder = nil + obj.ecnEchoHolder = nil + obj.ctlUrgHolder = nil + obj.ctlAckHolder = nil + obj.ctlPshHolder = nil + obj.ctlRstHolder = nil + obj.ctlSynHolder = nil + obj.ctlFinHolder = nil + obj.windowHolder = nil + obj.checksumHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowTcp is tCP packet header +type FlowTcp interface { + Validation + // msg marshals FlowTcp to protobuf object *otg.FlowTcp + // and doesn't set defaults + msg() *otg.FlowTcp + // setMsg unmarshals FlowTcp from protobuf object *otg.FlowTcp + // and doesn't set defaults + setMsg(*otg.FlowTcp) FlowTcp + // provides marshal interface + Marshal() marshalFlowTcp + // provides unmarshal interface + Unmarshal() unMarshalFlowTcp + // validate validates FlowTcp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowTcp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // SrcPort returns PatternFlowTcpSrcPort, set in FlowTcp. + // PatternFlowTcpSrcPort is source port + SrcPort() PatternFlowTcpSrcPort + // SetSrcPort assigns PatternFlowTcpSrcPort provided by user to FlowTcp. + // PatternFlowTcpSrcPort is source port + SetSrcPort(value PatternFlowTcpSrcPort) FlowTcp + // HasSrcPort checks if SrcPort has been set in FlowTcp + HasSrcPort() bool + // DstPort returns PatternFlowTcpDstPort, set in FlowTcp. + // PatternFlowTcpDstPort is destination port + DstPort() PatternFlowTcpDstPort + // SetDstPort assigns PatternFlowTcpDstPort provided by user to FlowTcp. + // PatternFlowTcpDstPort is destination port + SetDstPort(value PatternFlowTcpDstPort) FlowTcp + // HasDstPort checks if DstPort has been set in FlowTcp + HasDstPort() bool + // SeqNum returns PatternFlowTcpSeqNum, set in FlowTcp. + // PatternFlowTcpSeqNum is sequence number + SeqNum() PatternFlowTcpSeqNum + // SetSeqNum assigns PatternFlowTcpSeqNum provided by user to FlowTcp. + // PatternFlowTcpSeqNum is sequence number + SetSeqNum(value PatternFlowTcpSeqNum) FlowTcp + // HasSeqNum checks if SeqNum has been set in FlowTcp + HasSeqNum() bool + // AckNum returns PatternFlowTcpAckNum, set in FlowTcp. + // PatternFlowTcpAckNum is acknowledgement number + AckNum() PatternFlowTcpAckNum + // SetAckNum assigns PatternFlowTcpAckNum provided by user to FlowTcp. + // PatternFlowTcpAckNum is acknowledgement number + SetAckNum(value PatternFlowTcpAckNum) FlowTcp + // HasAckNum checks if AckNum has been set in FlowTcp + HasAckNum() bool + // DataOffset returns PatternFlowTcpDataOffset, set in FlowTcp. + // PatternFlowTcpDataOffset is the number of 32 bit words in the TCP header. This indicates where the data begins. + DataOffset() PatternFlowTcpDataOffset + // SetDataOffset assigns PatternFlowTcpDataOffset provided by user to FlowTcp. + // PatternFlowTcpDataOffset is the number of 32 bit words in the TCP header. This indicates where the data begins. + SetDataOffset(value PatternFlowTcpDataOffset) FlowTcp + // HasDataOffset checks if DataOffset has been set in FlowTcp + HasDataOffset() bool + // EcnNs returns PatternFlowTcpEcnNs, set in FlowTcp. + // PatternFlowTcpEcnNs is explicit congestion notification, concealment protection. + EcnNs() PatternFlowTcpEcnNs + // SetEcnNs assigns PatternFlowTcpEcnNs provided by user to FlowTcp. + // PatternFlowTcpEcnNs is explicit congestion notification, concealment protection. + SetEcnNs(value PatternFlowTcpEcnNs) FlowTcp + // HasEcnNs checks if EcnNs has been set in FlowTcp + HasEcnNs() bool + // EcnCwr returns PatternFlowTcpEcnCwr, set in FlowTcp. + // PatternFlowTcpEcnCwr is explicit congestion notification, congestion window reduced. + EcnCwr() PatternFlowTcpEcnCwr + // SetEcnCwr assigns PatternFlowTcpEcnCwr provided by user to FlowTcp. + // PatternFlowTcpEcnCwr is explicit congestion notification, congestion window reduced. + SetEcnCwr(value PatternFlowTcpEcnCwr) FlowTcp + // HasEcnCwr checks if EcnCwr has been set in FlowTcp + HasEcnCwr() bool + // EcnEcho returns PatternFlowTcpEcnEcho, set in FlowTcp. + // PatternFlowTcpEcnEcho is explicit congestion notification, echo. 1 indicates the peer is ecn capable. 0 indicates that a packet with ipv4.ecn = 11 in the ip header was received during normal transmission. + EcnEcho() PatternFlowTcpEcnEcho + // SetEcnEcho assigns PatternFlowTcpEcnEcho provided by user to FlowTcp. + // PatternFlowTcpEcnEcho is explicit congestion notification, echo. 1 indicates the peer is ecn capable. 0 indicates that a packet with ipv4.ecn = 11 in the ip header was received during normal transmission. + SetEcnEcho(value PatternFlowTcpEcnEcho) FlowTcp + // HasEcnEcho checks if EcnEcho has been set in FlowTcp + HasEcnEcho() bool + // CtlUrg returns PatternFlowTcpCtlUrg, set in FlowTcp. + // PatternFlowTcpCtlUrg is a value of 1 indicates that the urgent pointer field is significant. + CtlUrg() PatternFlowTcpCtlUrg + // SetCtlUrg assigns PatternFlowTcpCtlUrg provided by user to FlowTcp. + // PatternFlowTcpCtlUrg is a value of 1 indicates that the urgent pointer field is significant. + SetCtlUrg(value PatternFlowTcpCtlUrg) FlowTcp + // HasCtlUrg checks if CtlUrg has been set in FlowTcp + HasCtlUrg() bool + // CtlAck returns PatternFlowTcpCtlAck, set in FlowTcp. + // PatternFlowTcpCtlAck is a value of 1 indicates that the ackknowledgment field is significant. + CtlAck() PatternFlowTcpCtlAck + // SetCtlAck assigns PatternFlowTcpCtlAck provided by user to FlowTcp. + // PatternFlowTcpCtlAck is a value of 1 indicates that the ackknowledgment field is significant. + SetCtlAck(value PatternFlowTcpCtlAck) FlowTcp + // HasCtlAck checks if CtlAck has been set in FlowTcp + HasCtlAck() bool + // CtlPsh returns PatternFlowTcpCtlPsh, set in FlowTcp. + // PatternFlowTcpCtlPsh is asks to push the buffered data to the receiving application. + CtlPsh() PatternFlowTcpCtlPsh + // SetCtlPsh assigns PatternFlowTcpCtlPsh provided by user to FlowTcp. + // PatternFlowTcpCtlPsh is asks to push the buffered data to the receiving application. + SetCtlPsh(value PatternFlowTcpCtlPsh) FlowTcp + // HasCtlPsh checks if CtlPsh has been set in FlowTcp + HasCtlPsh() bool + // CtlRst returns PatternFlowTcpCtlRst, set in FlowTcp. + // PatternFlowTcpCtlRst is reset the connection. + CtlRst() PatternFlowTcpCtlRst + // SetCtlRst assigns PatternFlowTcpCtlRst provided by user to FlowTcp. + // PatternFlowTcpCtlRst is reset the connection. + SetCtlRst(value PatternFlowTcpCtlRst) FlowTcp + // HasCtlRst checks if CtlRst has been set in FlowTcp + HasCtlRst() bool + // CtlSyn returns PatternFlowTcpCtlSyn, set in FlowTcp. + // PatternFlowTcpCtlSyn is synchronize sequenece numbers. + CtlSyn() PatternFlowTcpCtlSyn + // SetCtlSyn assigns PatternFlowTcpCtlSyn provided by user to FlowTcp. + // PatternFlowTcpCtlSyn is synchronize sequenece numbers. + SetCtlSyn(value PatternFlowTcpCtlSyn) FlowTcp + // HasCtlSyn checks if CtlSyn has been set in FlowTcp + HasCtlSyn() bool + // CtlFin returns PatternFlowTcpCtlFin, set in FlowTcp. + // PatternFlowTcpCtlFin is last packet from the sender. + CtlFin() PatternFlowTcpCtlFin + // SetCtlFin assigns PatternFlowTcpCtlFin provided by user to FlowTcp. + // PatternFlowTcpCtlFin is last packet from the sender. + SetCtlFin(value PatternFlowTcpCtlFin) FlowTcp + // HasCtlFin checks if CtlFin has been set in FlowTcp + HasCtlFin() bool + // Window returns PatternFlowTcpWindow, set in FlowTcp. + // PatternFlowTcpWindow is tcp connection window. + Window() PatternFlowTcpWindow + // SetWindow assigns PatternFlowTcpWindow provided by user to FlowTcp. + // PatternFlowTcpWindow is tcp connection window. + SetWindow(value PatternFlowTcpWindow) FlowTcp + // HasWindow checks if Window has been set in FlowTcp + HasWindow() bool + // Checksum returns PatternFlowTcpChecksum, set in FlowTcp. + // PatternFlowTcpChecksum is the one's complement of the one's complement sum of all 16 bit words in header and text. An all-zero value means that no checksum will be transmitted. While computing the checksum, the checksum field itself is replaced with zeros. + Checksum() PatternFlowTcpChecksum + // SetChecksum assigns PatternFlowTcpChecksum provided by user to FlowTcp. + // PatternFlowTcpChecksum is the one's complement of the one's complement sum of all 16 bit words in header and text. An all-zero value means that no checksum will be transmitted. While computing the checksum, the checksum field itself is replaced with zeros. + SetChecksum(value PatternFlowTcpChecksum) FlowTcp + // HasChecksum checks if Checksum has been set in FlowTcp + HasChecksum() bool + setNil() +} + +// description is TBD +// SrcPort returns a PatternFlowTcpSrcPort +func (obj *flowTcp) SrcPort() PatternFlowTcpSrcPort { + if obj.obj.SrcPort == nil { + obj.obj.SrcPort = NewPatternFlowTcpSrcPort().msg() + } + if obj.srcPortHolder == nil { + obj.srcPortHolder = &patternFlowTcpSrcPort{obj: obj.obj.SrcPort} + } + return obj.srcPortHolder +} + +// description is TBD +// SrcPort returns a PatternFlowTcpSrcPort +func (obj *flowTcp) HasSrcPort() bool { + return obj.obj.SrcPort != nil +} + +// description is TBD +// SetSrcPort sets the PatternFlowTcpSrcPort value in the FlowTcp object +func (obj *flowTcp) SetSrcPort(value PatternFlowTcpSrcPort) FlowTcp { + + obj.srcPortHolder = nil + obj.obj.SrcPort = value.msg() + + return obj +} + +// description is TBD +// DstPort returns a PatternFlowTcpDstPort +func (obj *flowTcp) DstPort() PatternFlowTcpDstPort { + if obj.obj.DstPort == nil { + obj.obj.DstPort = NewPatternFlowTcpDstPort().msg() + } + if obj.dstPortHolder == nil { + obj.dstPortHolder = &patternFlowTcpDstPort{obj: obj.obj.DstPort} + } + return obj.dstPortHolder +} + +// description is TBD +// DstPort returns a PatternFlowTcpDstPort +func (obj *flowTcp) HasDstPort() bool { + return obj.obj.DstPort != nil +} + +// description is TBD +// SetDstPort sets the PatternFlowTcpDstPort value in the FlowTcp object +func (obj *flowTcp) SetDstPort(value PatternFlowTcpDstPort) FlowTcp { + + obj.dstPortHolder = nil + obj.obj.DstPort = value.msg() + + return obj +} + +// description is TBD +// SeqNum returns a PatternFlowTcpSeqNum +func (obj *flowTcp) SeqNum() PatternFlowTcpSeqNum { + if obj.obj.SeqNum == nil { + obj.obj.SeqNum = NewPatternFlowTcpSeqNum().msg() + } + if obj.seqNumHolder == nil { + obj.seqNumHolder = &patternFlowTcpSeqNum{obj: obj.obj.SeqNum} + } + return obj.seqNumHolder +} + +// description is TBD +// SeqNum returns a PatternFlowTcpSeqNum +func (obj *flowTcp) HasSeqNum() bool { + return obj.obj.SeqNum != nil +} + +// description is TBD +// SetSeqNum sets the PatternFlowTcpSeqNum value in the FlowTcp object +func (obj *flowTcp) SetSeqNum(value PatternFlowTcpSeqNum) FlowTcp { + + obj.seqNumHolder = nil + obj.obj.SeqNum = value.msg() + + return obj +} + +// description is TBD +// AckNum returns a PatternFlowTcpAckNum +func (obj *flowTcp) AckNum() PatternFlowTcpAckNum { + if obj.obj.AckNum == nil { + obj.obj.AckNum = NewPatternFlowTcpAckNum().msg() + } + if obj.ackNumHolder == nil { + obj.ackNumHolder = &patternFlowTcpAckNum{obj: obj.obj.AckNum} + } + return obj.ackNumHolder +} + +// description is TBD +// AckNum returns a PatternFlowTcpAckNum +func (obj *flowTcp) HasAckNum() bool { + return obj.obj.AckNum != nil +} + +// description is TBD +// SetAckNum sets the PatternFlowTcpAckNum value in the FlowTcp object +func (obj *flowTcp) SetAckNum(value PatternFlowTcpAckNum) FlowTcp { + + obj.ackNumHolder = nil + obj.obj.AckNum = value.msg() + + return obj +} + +// description is TBD +// DataOffset returns a PatternFlowTcpDataOffset +func (obj *flowTcp) DataOffset() PatternFlowTcpDataOffset { + if obj.obj.DataOffset == nil { + obj.obj.DataOffset = NewPatternFlowTcpDataOffset().msg() + } + if obj.dataOffsetHolder == nil { + obj.dataOffsetHolder = &patternFlowTcpDataOffset{obj: obj.obj.DataOffset} + } + return obj.dataOffsetHolder +} + +// description is TBD +// DataOffset returns a PatternFlowTcpDataOffset +func (obj *flowTcp) HasDataOffset() bool { + return obj.obj.DataOffset != nil +} + +// description is TBD +// SetDataOffset sets the PatternFlowTcpDataOffset value in the FlowTcp object +func (obj *flowTcp) SetDataOffset(value PatternFlowTcpDataOffset) FlowTcp { + + obj.dataOffsetHolder = nil + obj.obj.DataOffset = value.msg() + + return obj +} + +// description is TBD +// EcnNs returns a PatternFlowTcpEcnNs +func (obj *flowTcp) EcnNs() PatternFlowTcpEcnNs { + if obj.obj.EcnNs == nil { + obj.obj.EcnNs = NewPatternFlowTcpEcnNs().msg() + } + if obj.ecnNsHolder == nil { + obj.ecnNsHolder = &patternFlowTcpEcnNs{obj: obj.obj.EcnNs} + } + return obj.ecnNsHolder +} + +// description is TBD +// EcnNs returns a PatternFlowTcpEcnNs +func (obj *flowTcp) HasEcnNs() bool { + return obj.obj.EcnNs != nil +} + +// description is TBD +// SetEcnNs sets the PatternFlowTcpEcnNs value in the FlowTcp object +func (obj *flowTcp) SetEcnNs(value PatternFlowTcpEcnNs) FlowTcp { + + obj.ecnNsHolder = nil + obj.obj.EcnNs = value.msg() + + return obj +} + +// description is TBD +// EcnCwr returns a PatternFlowTcpEcnCwr +func (obj *flowTcp) EcnCwr() PatternFlowTcpEcnCwr { + if obj.obj.EcnCwr == nil { + obj.obj.EcnCwr = NewPatternFlowTcpEcnCwr().msg() + } + if obj.ecnCwrHolder == nil { + obj.ecnCwrHolder = &patternFlowTcpEcnCwr{obj: obj.obj.EcnCwr} + } + return obj.ecnCwrHolder +} + +// description is TBD +// EcnCwr returns a PatternFlowTcpEcnCwr +func (obj *flowTcp) HasEcnCwr() bool { + return obj.obj.EcnCwr != nil +} + +// description is TBD +// SetEcnCwr sets the PatternFlowTcpEcnCwr value in the FlowTcp object +func (obj *flowTcp) SetEcnCwr(value PatternFlowTcpEcnCwr) FlowTcp { + + obj.ecnCwrHolder = nil + obj.obj.EcnCwr = value.msg() + + return obj +} + +// description is TBD +// EcnEcho returns a PatternFlowTcpEcnEcho +func (obj *flowTcp) EcnEcho() PatternFlowTcpEcnEcho { + if obj.obj.EcnEcho == nil { + obj.obj.EcnEcho = NewPatternFlowTcpEcnEcho().msg() + } + if obj.ecnEchoHolder == nil { + obj.ecnEchoHolder = &patternFlowTcpEcnEcho{obj: obj.obj.EcnEcho} + } + return obj.ecnEchoHolder +} + +// description is TBD +// EcnEcho returns a PatternFlowTcpEcnEcho +func (obj *flowTcp) HasEcnEcho() bool { + return obj.obj.EcnEcho != nil +} + +// description is TBD +// SetEcnEcho sets the PatternFlowTcpEcnEcho value in the FlowTcp object +func (obj *flowTcp) SetEcnEcho(value PatternFlowTcpEcnEcho) FlowTcp { + + obj.ecnEchoHolder = nil + obj.obj.EcnEcho = value.msg() + + return obj +} + +// description is TBD +// CtlUrg returns a PatternFlowTcpCtlUrg +func (obj *flowTcp) CtlUrg() PatternFlowTcpCtlUrg { + if obj.obj.CtlUrg == nil { + obj.obj.CtlUrg = NewPatternFlowTcpCtlUrg().msg() + } + if obj.ctlUrgHolder == nil { + obj.ctlUrgHolder = &patternFlowTcpCtlUrg{obj: obj.obj.CtlUrg} + } + return obj.ctlUrgHolder +} + +// description is TBD +// CtlUrg returns a PatternFlowTcpCtlUrg +func (obj *flowTcp) HasCtlUrg() bool { + return obj.obj.CtlUrg != nil +} + +// description is TBD +// SetCtlUrg sets the PatternFlowTcpCtlUrg value in the FlowTcp object +func (obj *flowTcp) SetCtlUrg(value PatternFlowTcpCtlUrg) FlowTcp { + + obj.ctlUrgHolder = nil + obj.obj.CtlUrg = value.msg() + + return obj +} + +// description is TBD +// CtlAck returns a PatternFlowTcpCtlAck +func (obj *flowTcp) CtlAck() PatternFlowTcpCtlAck { + if obj.obj.CtlAck == nil { + obj.obj.CtlAck = NewPatternFlowTcpCtlAck().msg() + } + if obj.ctlAckHolder == nil { + obj.ctlAckHolder = &patternFlowTcpCtlAck{obj: obj.obj.CtlAck} + } + return obj.ctlAckHolder +} + +// description is TBD +// CtlAck returns a PatternFlowTcpCtlAck +func (obj *flowTcp) HasCtlAck() bool { + return obj.obj.CtlAck != nil +} + +// description is TBD +// SetCtlAck sets the PatternFlowTcpCtlAck value in the FlowTcp object +func (obj *flowTcp) SetCtlAck(value PatternFlowTcpCtlAck) FlowTcp { + + obj.ctlAckHolder = nil + obj.obj.CtlAck = value.msg() + + return obj +} + +// description is TBD +// CtlPsh returns a PatternFlowTcpCtlPsh +func (obj *flowTcp) CtlPsh() PatternFlowTcpCtlPsh { + if obj.obj.CtlPsh == nil { + obj.obj.CtlPsh = NewPatternFlowTcpCtlPsh().msg() + } + if obj.ctlPshHolder == nil { + obj.ctlPshHolder = &patternFlowTcpCtlPsh{obj: obj.obj.CtlPsh} + } + return obj.ctlPshHolder +} + +// description is TBD +// CtlPsh returns a PatternFlowTcpCtlPsh +func (obj *flowTcp) HasCtlPsh() bool { + return obj.obj.CtlPsh != nil +} + +// description is TBD +// SetCtlPsh sets the PatternFlowTcpCtlPsh value in the FlowTcp object +func (obj *flowTcp) SetCtlPsh(value PatternFlowTcpCtlPsh) FlowTcp { + + obj.ctlPshHolder = nil + obj.obj.CtlPsh = value.msg() + + return obj +} + +// description is TBD +// CtlRst returns a PatternFlowTcpCtlRst +func (obj *flowTcp) CtlRst() PatternFlowTcpCtlRst { + if obj.obj.CtlRst == nil { + obj.obj.CtlRst = NewPatternFlowTcpCtlRst().msg() + } + if obj.ctlRstHolder == nil { + obj.ctlRstHolder = &patternFlowTcpCtlRst{obj: obj.obj.CtlRst} + } + return obj.ctlRstHolder +} + +// description is TBD +// CtlRst returns a PatternFlowTcpCtlRst +func (obj *flowTcp) HasCtlRst() bool { + return obj.obj.CtlRst != nil +} + +// description is TBD +// SetCtlRst sets the PatternFlowTcpCtlRst value in the FlowTcp object +func (obj *flowTcp) SetCtlRst(value PatternFlowTcpCtlRst) FlowTcp { + + obj.ctlRstHolder = nil + obj.obj.CtlRst = value.msg() + + return obj +} + +// description is TBD +// CtlSyn returns a PatternFlowTcpCtlSyn +func (obj *flowTcp) CtlSyn() PatternFlowTcpCtlSyn { + if obj.obj.CtlSyn == nil { + obj.obj.CtlSyn = NewPatternFlowTcpCtlSyn().msg() + } + if obj.ctlSynHolder == nil { + obj.ctlSynHolder = &patternFlowTcpCtlSyn{obj: obj.obj.CtlSyn} + } + return obj.ctlSynHolder +} + +// description is TBD +// CtlSyn returns a PatternFlowTcpCtlSyn +func (obj *flowTcp) HasCtlSyn() bool { + return obj.obj.CtlSyn != nil +} + +// description is TBD +// SetCtlSyn sets the PatternFlowTcpCtlSyn value in the FlowTcp object +func (obj *flowTcp) SetCtlSyn(value PatternFlowTcpCtlSyn) FlowTcp { + + obj.ctlSynHolder = nil + obj.obj.CtlSyn = value.msg() + + return obj +} + +// description is TBD +// CtlFin returns a PatternFlowTcpCtlFin +func (obj *flowTcp) CtlFin() PatternFlowTcpCtlFin { + if obj.obj.CtlFin == nil { + obj.obj.CtlFin = NewPatternFlowTcpCtlFin().msg() + } + if obj.ctlFinHolder == nil { + obj.ctlFinHolder = &patternFlowTcpCtlFin{obj: obj.obj.CtlFin} + } + return obj.ctlFinHolder +} + +// description is TBD +// CtlFin returns a PatternFlowTcpCtlFin +func (obj *flowTcp) HasCtlFin() bool { + return obj.obj.CtlFin != nil +} + +// description is TBD +// SetCtlFin sets the PatternFlowTcpCtlFin value in the FlowTcp object +func (obj *flowTcp) SetCtlFin(value PatternFlowTcpCtlFin) FlowTcp { + + obj.ctlFinHolder = nil + obj.obj.CtlFin = value.msg() + + return obj +} + +// description is TBD +// Window returns a PatternFlowTcpWindow +func (obj *flowTcp) Window() PatternFlowTcpWindow { + if obj.obj.Window == nil { + obj.obj.Window = NewPatternFlowTcpWindow().msg() + } + if obj.windowHolder == nil { + obj.windowHolder = &patternFlowTcpWindow{obj: obj.obj.Window} + } + return obj.windowHolder +} + +// description is TBD +// Window returns a PatternFlowTcpWindow +func (obj *flowTcp) HasWindow() bool { + return obj.obj.Window != nil +} + +// description is TBD +// SetWindow sets the PatternFlowTcpWindow value in the FlowTcp object +func (obj *flowTcp) SetWindow(value PatternFlowTcpWindow) FlowTcp { + + obj.windowHolder = nil + obj.obj.Window = value.msg() + + return obj +} + +// description is TBD +// Checksum returns a PatternFlowTcpChecksum +func (obj *flowTcp) Checksum() PatternFlowTcpChecksum { + if obj.obj.Checksum == nil { + obj.obj.Checksum = NewPatternFlowTcpChecksum().msg() + } + if obj.checksumHolder == nil { + obj.checksumHolder = &patternFlowTcpChecksum{obj: obj.obj.Checksum} + } + return obj.checksumHolder +} + +// description is TBD +// Checksum returns a PatternFlowTcpChecksum +func (obj *flowTcp) HasChecksum() bool { + return obj.obj.Checksum != nil +} + +// description is TBD +// SetChecksum sets the PatternFlowTcpChecksum value in the FlowTcp object +func (obj *flowTcp) SetChecksum(value PatternFlowTcpChecksum) FlowTcp { + + obj.checksumHolder = nil + obj.obj.Checksum = value.msg() + + return obj +} + +func (obj *flowTcp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.SrcPort != nil { + + obj.SrcPort().validateObj(vObj, set_default) + } + + if obj.obj.DstPort != nil { + + obj.DstPort().validateObj(vObj, set_default) + } + + if obj.obj.SeqNum != nil { + + obj.SeqNum().validateObj(vObj, set_default) + } + + if obj.obj.AckNum != nil { + + obj.AckNum().validateObj(vObj, set_default) + } + + if obj.obj.DataOffset != nil { + + obj.DataOffset().validateObj(vObj, set_default) + } + + if obj.obj.EcnNs != nil { + + obj.EcnNs().validateObj(vObj, set_default) + } + + if obj.obj.EcnCwr != nil { + + obj.EcnCwr().validateObj(vObj, set_default) + } + + if obj.obj.EcnEcho != nil { + + obj.EcnEcho().validateObj(vObj, set_default) + } + + if obj.obj.CtlUrg != nil { + + obj.CtlUrg().validateObj(vObj, set_default) + } + + if obj.obj.CtlAck != nil { + + obj.CtlAck().validateObj(vObj, set_default) + } + + if obj.obj.CtlPsh != nil { + + obj.CtlPsh().validateObj(vObj, set_default) + } + + if obj.obj.CtlRst != nil { + + obj.CtlRst().validateObj(vObj, set_default) + } + + if obj.obj.CtlSyn != nil { + + obj.CtlSyn().validateObj(vObj, set_default) + } + + if obj.obj.CtlFin != nil { + + obj.CtlFin().validateObj(vObj, set_default) + } + + if obj.obj.Window != nil { + + obj.Window().validateObj(vObj, set_default) + } + + if obj.obj.Checksum != nil { + + obj.Checksum().validateObj(vObj, set_default) + } + +} + +func (obj *flowTcp) setDefault() { + +} diff --git a/gosnappi/flow_tx_rx.go b/gosnappi/flow_tx_rx.go new file mode 100644 index 00000000..1705d767 --- /dev/null +++ b/gosnappi/flow_tx_rx.go @@ -0,0 +1,465 @@ +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" +) + +// ***** FlowTxRx ***** +type flowTxRx struct { + validation + obj *otg.FlowTxRx + marshaller marshalFlowTxRx + unMarshaller unMarshalFlowTxRx + portHolder FlowPort + deviceHolder FlowRouter +} + +func NewFlowTxRx() FlowTxRx { + obj := flowTxRx{obj: &otg.FlowTxRx{}} + obj.setDefault() + return &obj +} + +func (obj *flowTxRx) msg() *otg.FlowTxRx { + return obj.obj +} + +func (obj *flowTxRx) setMsg(msg *otg.FlowTxRx) FlowTxRx { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowTxRx struct { + obj *flowTxRx +} + +type marshalFlowTxRx interface { + // ToProto marshals FlowTxRx to protobuf object *otg.FlowTxRx + ToProto() (*otg.FlowTxRx, error) + // ToPbText marshals FlowTxRx to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowTxRx to YAML text + ToYaml() (string, error) + // ToJson marshals FlowTxRx to JSON text + ToJson() (string, error) +} + +type unMarshalflowTxRx struct { + obj *flowTxRx +} + +type unMarshalFlowTxRx interface { + // FromProto unmarshals FlowTxRx from protobuf object *otg.FlowTxRx + FromProto(msg *otg.FlowTxRx) (FlowTxRx, error) + // FromPbText unmarshals FlowTxRx from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowTxRx from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowTxRx from JSON text + FromJson(value string) error +} + +func (obj *flowTxRx) Marshal() marshalFlowTxRx { + if obj.marshaller == nil { + obj.marshaller = &marshalflowTxRx{obj: obj} + } + return obj.marshaller +} + +func (obj *flowTxRx) Unmarshal() unMarshalFlowTxRx { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowTxRx{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowTxRx) ToProto() (*otg.FlowTxRx, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowTxRx) FromProto(msg *otg.FlowTxRx) (FlowTxRx, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowTxRx) 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 *unMarshalflowTxRx) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowTxRx) 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 *unMarshalflowTxRx) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowTxRx) 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 *unMarshalflowTxRx) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowTxRx) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowTxRx) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowTxRx) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowTxRx) Clone() (FlowTxRx, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowTxRx() + 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 +} + +func (obj *flowTxRx) setNil() { + obj.portHolder = nil + obj.deviceHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowTxRx is a container for different types of transmit and receive +// endpoint containers. +type FlowTxRx interface { + Validation + // msg marshals FlowTxRx to protobuf object *otg.FlowTxRx + // and doesn't set defaults + msg() *otg.FlowTxRx + // setMsg unmarshals FlowTxRx from protobuf object *otg.FlowTxRx + // and doesn't set defaults + setMsg(*otg.FlowTxRx) FlowTxRx + // provides marshal interface + Marshal() marshalFlowTxRx + // provides unmarshal interface + Unmarshal() unMarshalFlowTxRx + // validate validates FlowTxRx + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowTxRx, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns FlowTxRxChoiceEnum, set in FlowTxRx + Choice() FlowTxRxChoiceEnum + // setChoice assigns FlowTxRxChoiceEnum provided by user to FlowTxRx + setChoice(value FlowTxRxChoiceEnum) FlowTxRx + // HasChoice checks if Choice has been set in FlowTxRx + HasChoice() bool + // Port returns FlowPort, set in FlowTxRx. + // FlowPort is a container for a transmit port and 0..n intended receive ports. + // When assigning this container to a flow the flows's + // packet headers will not be populated with any address resolution + // information such as source and/or destination addresses. + // For example Flow.Ethernet dst mac address values will be defaulted to 0. + // For full control over the Flow.properties.packet header contents use this + // container. + Port() FlowPort + // SetPort assigns FlowPort provided by user to FlowTxRx. + // FlowPort is a container for a transmit port and 0..n intended receive ports. + // When assigning this container to a flow the flows's + // packet headers will not be populated with any address resolution + // information such as source and/or destination addresses. + // For example Flow.Ethernet dst mac address values will be defaulted to 0. + // For full control over the Flow.properties.packet header contents use this + // container. + SetPort(value FlowPort) FlowTxRx + // HasPort checks if Port has been set in FlowTxRx + HasPort() bool + // Device returns FlowRouter, set in FlowTxRx. + // FlowRouter is a container for declaring a map of 1..n transmit devices to 1..n receive devices. This allows for a single flow to have different tx to rx device flows such as a single one to one map or a many to many map. + Device() FlowRouter + // SetDevice assigns FlowRouter provided by user to FlowTxRx. + // FlowRouter is a container for declaring a map of 1..n transmit devices to 1..n receive devices. This allows for a single flow to have different tx to rx device flows such as a single one to one map or a many to many map. + SetDevice(value FlowRouter) FlowTxRx + // HasDevice checks if Device has been set in FlowTxRx + HasDevice() bool + setNil() +} + +type FlowTxRxChoiceEnum string + +// Enum of Choice on FlowTxRx +var FlowTxRxChoice = struct { + PORT FlowTxRxChoiceEnum + DEVICE FlowTxRxChoiceEnum +}{ + PORT: FlowTxRxChoiceEnum("port"), + DEVICE: FlowTxRxChoiceEnum("device"), +} + +func (obj *flowTxRx) Choice() FlowTxRxChoiceEnum { + return FlowTxRxChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The type of transmit and receive container used by the flow. +// Choice returns a string +func (obj *flowTxRx) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *flowTxRx) setChoice(value FlowTxRxChoiceEnum) FlowTxRx { + intValue, ok := otg.FlowTxRx_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on FlowTxRxChoiceEnum", string(value))) + return obj + } + enumValue := otg.FlowTxRx_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Device = nil + obj.deviceHolder = nil + obj.obj.Port = nil + obj.portHolder = nil + + if value == FlowTxRxChoice.PORT { + obj.obj.Port = NewFlowPort().msg() + } + + if value == FlowTxRxChoice.DEVICE { + obj.obj.Device = NewFlowRouter().msg() + } + + return obj +} + +// description is TBD +// Port returns a FlowPort +func (obj *flowTxRx) Port() FlowPort { + if obj.obj.Port == nil { + obj.setChoice(FlowTxRxChoice.PORT) + } + if obj.portHolder == nil { + obj.portHolder = &flowPort{obj: obj.obj.Port} + } + return obj.portHolder +} + +// description is TBD +// Port returns a FlowPort +func (obj *flowTxRx) HasPort() bool { + return obj.obj.Port != nil +} + +// description is TBD +// SetPort sets the FlowPort value in the FlowTxRx object +func (obj *flowTxRx) SetPort(value FlowPort) FlowTxRx { + obj.setChoice(FlowTxRxChoice.PORT) + obj.portHolder = nil + obj.obj.Port = value.msg() + + return obj +} + +// description is TBD +// Device returns a FlowRouter +func (obj *flowTxRx) Device() FlowRouter { + if obj.obj.Device == nil { + obj.setChoice(FlowTxRxChoice.DEVICE) + } + if obj.deviceHolder == nil { + obj.deviceHolder = &flowRouter{obj: obj.obj.Device} + } + return obj.deviceHolder +} + +// description is TBD +// Device returns a FlowRouter +func (obj *flowTxRx) HasDevice() bool { + return obj.obj.Device != nil +} + +// description is TBD +// SetDevice sets the FlowRouter value in the FlowTxRx object +func (obj *flowTxRx) SetDevice(value FlowRouter) FlowTxRx { + obj.setChoice(FlowTxRxChoice.DEVICE) + obj.deviceHolder = nil + obj.obj.Device = value.msg() + + return obj +} + +func (obj *flowTxRx) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Port != nil { + + obj.Port().validateObj(vObj, set_default) + } + + if obj.obj.Device != nil { + + obj.Device().validateObj(vObj, set_default) + } + +} + +func (obj *flowTxRx) setDefault() { + var choices_set int = 0 + var choice FlowTxRxChoiceEnum + + if obj.obj.Port != nil { + choices_set += 1 + choice = FlowTxRxChoice.PORT + } + + if obj.obj.Device != nil { + choices_set += 1 + choice = FlowTxRxChoice.DEVICE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(FlowTxRxChoice.PORT) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowTxRx") + } + } else { + intVal := otg.FlowTxRx_Choice_Enum_value[string(choice)] + enumValue := otg.FlowTxRx_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/flow_udp.go b/gosnappi/flow_udp.go new file mode 100644 index 00000000..b96923f9 --- /dev/null +++ b/gosnappi/flow_udp.go @@ -0,0 +1,457 @@ +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" +) + +// ***** FlowUdp ***** +type flowUdp struct { + validation + obj *otg.FlowUdp + marshaller marshalFlowUdp + unMarshaller unMarshalFlowUdp + srcPortHolder PatternFlowUdpSrcPort + dstPortHolder PatternFlowUdpDstPort + lengthHolder PatternFlowUdpLength + checksumHolder PatternFlowUdpChecksum +} + +func NewFlowUdp() FlowUdp { + obj := flowUdp{obj: &otg.FlowUdp{}} + obj.setDefault() + return &obj +} + +func (obj *flowUdp) msg() *otg.FlowUdp { + return obj.obj +} + +func (obj *flowUdp) setMsg(msg *otg.FlowUdp) FlowUdp { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowUdp struct { + obj *flowUdp +} + +type marshalFlowUdp interface { + // ToProto marshals FlowUdp to protobuf object *otg.FlowUdp + ToProto() (*otg.FlowUdp, error) + // ToPbText marshals FlowUdp to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowUdp to YAML text + ToYaml() (string, error) + // ToJson marshals FlowUdp to JSON text + ToJson() (string, error) +} + +type unMarshalflowUdp struct { + obj *flowUdp +} + +type unMarshalFlowUdp interface { + // FromProto unmarshals FlowUdp from protobuf object *otg.FlowUdp + FromProto(msg *otg.FlowUdp) (FlowUdp, error) + // FromPbText unmarshals FlowUdp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowUdp from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowUdp from JSON text + FromJson(value string) error +} + +func (obj *flowUdp) Marshal() marshalFlowUdp { + if obj.marshaller == nil { + obj.marshaller = &marshalflowUdp{obj: obj} + } + return obj.marshaller +} + +func (obj *flowUdp) Unmarshal() unMarshalFlowUdp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowUdp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowUdp) ToProto() (*otg.FlowUdp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowUdp) FromProto(msg *otg.FlowUdp) (FlowUdp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowUdp) 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 *unMarshalflowUdp) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowUdp) 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 *unMarshalflowUdp) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowUdp) 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 *unMarshalflowUdp) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowUdp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowUdp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowUdp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowUdp) Clone() (FlowUdp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowUdp() + 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 +} + +func (obj *flowUdp) setNil() { + obj.srcPortHolder = nil + obj.dstPortHolder = nil + obj.lengthHolder = nil + obj.checksumHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowUdp is uDP packet header +type FlowUdp interface { + Validation + // msg marshals FlowUdp to protobuf object *otg.FlowUdp + // and doesn't set defaults + msg() *otg.FlowUdp + // setMsg unmarshals FlowUdp from protobuf object *otg.FlowUdp + // and doesn't set defaults + setMsg(*otg.FlowUdp) FlowUdp + // provides marshal interface + Marshal() marshalFlowUdp + // provides unmarshal interface + Unmarshal() unMarshalFlowUdp + // validate validates FlowUdp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowUdp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // SrcPort returns PatternFlowUdpSrcPort, set in FlowUdp. + // PatternFlowUdpSrcPort is source port + SrcPort() PatternFlowUdpSrcPort + // SetSrcPort assigns PatternFlowUdpSrcPort provided by user to FlowUdp. + // PatternFlowUdpSrcPort is source port + SetSrcPort(value PatternFlowUdpSrcPort) FlowUdp + // HasSrcPort checks if SrcPort has been set in FlowUdp + HasSrcPort() bool + // DstPort returns PatternFlowUdpDstPort, set in FlowUdp. + // PatternFlowUdpDstPort is destination port + DstPort() PatternFlowUdpDstPort + // SetDstPort assigns PatternFlowUdpDstPort provided by user to FlowUdp. + // PatternFlowUdpDstPort is destination port + SetDstPort(value PatternFlowUdpDstPort) FlowUdp + // HasDstPort checks if DstPort has been set in FlowUdp + HasDstPort() bool + // Length returns PatternFlowUdpLength, set in FlowUdp. + // PatternFlowUdpLength is length + Length() PatternFlowUdpLength + // SetLength assigns PatternFlowUdpLength provided by user to FlowUdp. + // PatternFlowUdpLength is length + SetLength(value PatternFlowUdpLength) FlowUdp + // HasLength checks if Length has been set in FlowUdp + HasLength() bool + // Checksum returns PatternFlowUdpChecksum, set in FlowUdp. + // PatternFlowUdpChecksum is uDP checksum + Checksum() PatternFlowUdpChecksum + // SetChecksum assigns PatternFlowUdpChecksum provided by user to FlowUdp. + // PatternFlowUdpChecksum is uDP checksum + SetChecksum(value PatternFlowUdpChecksum) FlowUdp + // HasChecksum checks if Checksum has been set in FlowUdp + HasChecksum() bool + setNil() +} + +// description is TBD +// SrcPort returns a PatternFlowUdpSrcPort +func (obj *flowUdp) SrcPort() PatternFlowUdpSrcPort { + if obj.obj.SrcPort == nil { + obj.obj.SrcPort = NewPatternFlowUdpSrcPort().msg() + } + if obj.srcPortHolder == nil { + obj.srcPortHolder = &patternFlowUdpSrcPort{obj: obj.obj.SrcPort} + } + return obj.srcPortHolder +} + +// description is TBD +// SrcPort returns a PatternFlowUdpSrcPort +func (obj *flowUdp) HasSrcPort() bool { + return obj.obj.SrcPort != nil +} + +// description is TBD +// SetSrcPort sets the PatternFlowUdpSrcPort value in the FlowUdp object +func (obj *flowUdp) SetSrcPort(value PatternFlowUdpSrcPort) FlowUdp { + + obj.srcPortHolder = nil + obj.obj.SrcPort = value.msg() + + return obj +} + +// description is TBD +// DstPort returns a PatternFlowUdpDstPort +func (obj *flowUdp) DstPort() PatternFlowUdpDstPort { + if obj.obj.DstPort == nil { + obj.obj.DstPort = NewPatternFlowUdpDstPort().msg() + } + if obj.dstPortHolder == nil { + obj.dstPortHolder = &patternFlowUdpDstPort{obj: obj.obj.DstPort} + } + return obj.dstPortHolder +} + +// description is TBD +// DstPort returns a PatternFlowUdpDstPort +func (obj *flowUdp) HasDstPort() bool { + return obj.obj.DstPort != nil +} + +// description is TBD +// SetDstPort sets the PatternFlowUdpDstPort value in the FlowUdp object +func (obj *flowUdp) SetDstPort(value PatternFlowUdpDstPort) FlowUdp { + + obj.dstPortHolder = nil + obj.obj.DstPort = value.msg() + + return obj +} + +// description is TBD +// Length returns a PatternFlowUdpLength +func (obj *flowUdp) Length() PatternFlowUdpLength { + if obj.obj.Length == nil { + obj.obj.Length = NewPatternFlowUdpLength().msg() + } + if obj.lengthHolder == nil { + obj.lengthHolder = &patternFlowUdpLength{obj: obj.obj.Length} + } + return obj.lengthHolder +} + +// description is TBD +// Length returns a PatternFlowUdpLength +func (obj *flowUdp) HasLength() bool { + return obj.obj.Length != nil +} + +// description is TBD +// SetLength sets the PatternFlowUdpLength value in the FlowUdp object +func (obj *flowUdp) SetLength(value PatternFlowUdpLength) FlowUdp { + + obj.lengthHolder = nil + obj.obj.Length = value.msg() + + return obj +} + +// description is TBD +// Checksum returns a PatternFlowUdpChecksum +func (obj *flowUdp) Checksum() PatternFlowUdpChecksum { + if obj.obj.Checksum == nil { + obj.obj.Checksum = NewPatternFlowUdpChecksum().msg() + } + if obj.checksumHolder == nil { + obj.checksumHolder = &patternFlowUdpChecksum{obj: obj.obj.Checksum} + } + return obj.checksumHolder +} + +// description is TBD +// Checksum returns a PatternFlowUdpChecksum +func (obj *flowUdp) HasChecksum() bool { + return obj.obj.Checksum != nil +} + +// description is TBD +// SetChecksum sets the PatternFlowUdpChecksum value in the FlowUdp object +func (obj *flowUdp) SetChecksum(value PatternFlowUdpChecksum) FlowUdp { + + obj.checksumHolder = nil + obj.obj.Checksum = value.msg() + + return obj +} + +func (obj *flowUdp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.SrcPort != nil { + + obj.SrcPort().validateObj(vObj, set_default) + } + + if obj.obj.DstPort != nil { + + obj.DstPort().validateObj(vObj, set_default) + } + + if obj.obj.Length != nil { + + obj.Length().validateObj(vObj, set_default) + } + + if obj.obj.Checksum != nil { + + obj.Checksum().validateObj(vObj, set_default) + } + +} + +func (obj *flowUdp) setDefault() { + +} diff --git a/gosnappi/flow_vlan.go b/gosnappi/flow_vlan.go new file mode 100644 index 00000000..8b9cbe47 --- /dev/null +++ b/gosnappi/flow_vlan.go @@ -0,0 +1,457 @@ +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" +) + +// ***** FlowVlan ***** +type flowVlan struct { + validation + obj *otg.FlowVlan + marshaller marshalFlowVlan + unMarshaller unMarshalFlowVlan + priorityHolder PatternFlowVlanPriority + cfiHolder PatternFlowVlanCfi + idHolder PatternFlowVlanId + tpidHolder PatternFlowVlanTpid +} + +func NewFlowVlan() FlowVlan { + obj := flowVlan{obj: &otg.FlowVlan{}} + obj.setDefault() + return &obj +} + +func (obj *flowVlan) msg() *otg.FlowVlan { + return obj.obj +} + +func (obj *flowVlan) setMsg(msg *otg.FlowVlan) FlowVlan { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowVlan struct { + obj *flowVlan +} + +type marshalFlowVlan interface { + // ToProto marshals FlowVlan to protobuf object *otg.FlowVlan + ToProto() (*otg.FlowVlan, error) + // ToPbText marshals FlowVlan to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowVlan to YAML text + ToYaml() (string, error) + // ToJson marshals FlowVlan to JSON text + ToJson() (string, error) +} + +type unMarshalflowVlan struct { + obj *flowVlan +} + +type unMarshalFlowVlan interface { + // FromProto unmarshals FlowVlan from protobuf object *otg.FlowVlan + FromProto(msg *otg.FlowVlan) (FlowVlan, error) + // FromPbText unmarshals FlowVlan from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowVlan from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowVlan from JSON text + FromJson(value string) error +} + +func (obj *flowVlan) Marshal() marshalFlowVlan { + if obj.marshaller == nil { + obj.marshaller = &marshalflowVlan{obj: obj} + } + return obj.marshaller +} + +func (obj *flowVlan) Unmarshal() unMarshalFlowVlan { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowVlan{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowVlan) ToProto() (*otg.FlowVlan, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowVlan) FromProto(msg *otg.FlowVlan) (FlowVlan, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowVlan) 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 *unMarshalflowVlan) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowVlan) 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 *unMarshalflowVlan) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowVlan) 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 *unMarshalflowVlan) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowVlan) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowVlan) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowVlan) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowVlan) Clone() (FlowVlan, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowVlan() + 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 +} + +func (obj *flowVlan) setNil() { + obj.priorityHolder = nil + obj.cfiHolder = nil + obj.idHolder = nil + obj.tpidHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowVlan is vLAN packet header +type FlowVlan interface { + Validation + // msg marshals FlowVlan to protobuf object *otg.FlowVlan + // and doesn't set defaults + msg() *otg.FlowVlan + // setMsg unmarshals FlowVlan from protobuf object *otg.FlowVlan + // and doesn't set defaults + setMsg(*otg.FlowVlan) FlowVlan + // provides marshal interface + Marshal() marshalFlowVlan + // provides unmarshal interface + Unmarshal() unMarshalFlowVlan + // validate validates FlowVlan + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowVlan, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Priority returns PatternFlowVlanPriority, set in FlowVlan. + // PatternFlowVlanPriority is priority code point + Priority() PatternFlowVlanPriority + // SetPriority assigns PatternFlowVlanPriority provided by user to FlowVlan. + // PatternFlowVlanPriority is priority code point + SetPriority(value PatternFlowVlanPriority) FlowVlan + // HasPriority checks if Priority has been set in FlowVlan + HasPriority() bool + // Cfi returns PatternFlowVlanCfi, set in FlowVlan. + // PatternFlowVlanCfi is canonical format indicator or drop elegible indicator + Cfi() PatternFlowVlanCfi + // SetCfi assigns PatternFlowVlanCfi provided by user to FlowVlan. + // PatternFlowVlanCfi is canonical format indicator or drop elegible indicator + SetCfi(value PatternFlowVlanCfi) FlowVlan + // HasCfi checks if Cfi has been set in FlowVlan + HasCfi() bool + // Id returns PatternFlowVlanId, set in FlowVlan. + // PatternFlowVlanId is vlan identifier + Id() PatternFlowVlanId + // SetId assigns PatternFlowVlanId provided by user to FlowVlan. + // PatternFlowVlanId is vlan identifier + SetId(value PatternFlowVlanId) FlowVlan + // HasId checks if Id has been set in FlowVlan + HasId() bool + // Tpid returns PatternFlowVlanTpid, set in FlowVlan. + // PatternFlowVlanTpid is protocol identifier + Tpid() PatternFlowVlanTpid + // SetTpid assigns PatternFlowVlanTpid provided by user to FlowVlan. + // PatternFlowVlanTpid is protocol identifier + SetTpid(value PatternFlowVlanTpid) FlowVlan + // HasTpid checks if Tpid has been set in FlowVlan + HasTpid() bool + setNil() +} + +// description is TBD +// Priority returns a PatternFlowVlanPriority +func (obj *flowVlan) Priority() PatternFlowVlanPriority { + if obj.obj.Priority == nil { + obj.obj.Priority = NewPatternFlowVlanPriority().msg() + } + if obj.priorityHolder == nil { + obj.priorityHolder = &patternFlowVlanPriority{obj: obj.obj.Priority} + } + return obj.priorityHolder +} + +// description is TBD +// Priority returns a PatternFlowVlanPriority +func (obj *flowVlan) HasPriority() bool { + return obj.obj.Priority != nil +} + +// description is TBD +// SetPriority sets the PatternFlowVlanPriority value in the FlowVlan object +func (obj *flowVlan) SetPriority(value PatternFlowVlanPriority) FlowVlan { + + obj.priorityHolder = nil + obj.obj.Priority = value.msg() + + return obj +} + +// description is TBD +// Cfi returns a PatternFlowVlanCfi +func (obj *flowVlan) Cfi() PatternFlowVlanCfi { + if obj.obj.Cfi == nil { + obj.obj.Cfi = NewPatternFlowVlanCfi().msg() + } + if obj.cfiHolder == nil { + obj.cfiHolder = &patternFlowVlanCfi{obj: obj.obj.Cfi} + } + return obj.cfiHolder +} + +// description is TBD +// Cfi returns a PatternFlowVlanCfi +func (obj *flowVlan) HasCfi() bool { + return obj.obj.Cfi != nil +} + +// description is TBD +// SetCfi sets the PatternFlowVlanCfi value in the FlowVlan object +func (obj *flowVlan) SetCfi(value PatternFlowVlanCfi) FlowVlan { + + obj.cfiHolder = nil + obj.obj.Cfi = value.msg() + + return obj +} + +// description is TBD +// Id returns a PatternFlowVlanId +func (obj *flowVlan) Id() PatternFlowVlanId { + if obj.obj.Id == nil { + obj.obj.Id = NewPatternFlowVlanId().msg() + } + if obj.idHolder == nil { + obj.idHolder = &patternFlowVlanId{obj: obj.obj.Id} + } + return obj.idHolder +} + +// description is TBD +// Id returns a PatternFlowVlanId +func (obj *flowVlan) HasId() bool { + return obj.obj.Id != nil +} + +// description is TBD +// SetId sets the PatternFlowVlanId value in the FlowVlan object +func (obj *flowVlan) SetId(value PatternFlowVlanId) FlowVlan { + + obj.idHolder = nil + obj.obj.Id = value.msg() + + return obj +} + +// description is TBD +// Tpid returns a PatternFlowVlanTpid +func (obj *flowVlan) Tpid() PatternFlowVlanTpid { + if obj.obj.Tpid == nil { + obj.obj.Tpid = NewPatternFlowVlanTpid().msg() + } + if obj.tpidHolder == nil { + obj.tpidHolder = &patternFlowVlanTpid{obj: obj.obj.Tpid} + } + return obj.tpidHolder +} + +// description is TBD +// Tpid returns a PatternFlowVlanTpid +func (obj *flowVlan) HasTpid() bool { + return obj.obj.Tpid != nil +} + +// description is TBD +// SetTpid sets the PatternFlowVlanTpid value in the FlowVlan object +func (obj *flowVlan) SetTpid(value PatternFlowVlanTpid) FlowVlan { + + obj.tpidHolder = nil + obj.obj.Tpid = value.msg() + + return obj +} + +func (obj *flowVlan) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Priority != nil { + + obj.Priority().validateObj(vObj, set_default) + } + + if obj.obj.Cfi != nil { + + obj.Cfi().validateObj(vObj, set_default) + } + + if obj.obj.Id != nil { + + obj.Id().validateObj(vObj, set_default) + } + + if obj.obj.Tpid != nil { + + obj.Tpid().validateObj(vObj, set_default) + } + +} + +func (obj *flowVlan) setDefault() { + +} diff --git a/gosnappi/flow_vxlan.go b/gosnappi/flow_vxlan.go new file mode 100644 index 00000000..8ef504ae --- /dev/null +++ b/gosnappi/flow_vxlan.go @@ -0,0 +1,457 @@ +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" +) + +// ***** FlowVxlan ***** +type flowVxlan struct { + validation + obj *otg.FlowVxlan + marshaller marshalFlowVxlan + unMarshaller unMarshalFlowVxlan + flagsHolder PatternFlowVxlanFlags + reserved0Holder PatternFlowVxlanReserved0 + vniHolder PatternFlowVxlanVni + reserved1Holder PatternFlowVxlanReserved1 +} + +func NewFlowVxlan() FlowVxlan { + obj := flowVxlan{obj: &otg.FlowVxlan{}} + obj.setDefault() + return &obj +} + +func (obj *flowVxlan) msg() *otg.FlowVxlan { + return obj.obj +} + +func (obj *flowVxlan) setMsg(msg *otg.FlowVxlan) FlowVxlan { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowVxlan struct { + obj *flowVxlan +} + +type marshalFlowVxlan interface { + // ToProto marshals FlowVxlan to protobuf object *otg.FlowVxlan + ToProto() (*otg.FlowVxlan, error) + // ToPbText marshals FlowVxlan to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowVxlan to YAML text + ToYaml() (string, error) + // ToJson marshals FlowVxlan to JSON text + ToJson() (string, error) +} + +type unMarshalflowVxlan struct { + obj *flowVxlan +} + +type unMarshalFlowVxlan interface { + // FromProto unmarshals FlowVxlan from protobuf object *otg.FlowVxlan + FromProto(msg *otg.FlowVxlan) (FlowVxlan, error) + // FromPbText unmarshals FlowVxlan from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowVxlan from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowVxlan from JSON text + FromJson(value string) error +} + +func (obj *flowVxlan) Marshal() marshalFlowVxlan { + if obj.marshaller == nil { + obj.marshaller = &marshalflowVxlan{obj: obj} + } + return obj.marshaller +} + +func (obj *flowVxlan) Unmarshal() unMarshalFlowVxlan { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowVxlan{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowVxlan) ToProto() (*otg.FlowVxlan, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowVxlan) FromProto(msg *otg.FlowVxlan) (FlowVxlan, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowVxlan) 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 *unMarshalflowVxlan) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowVxlan) 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 *unMarshalflowVxlan) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowVxlan) 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 *unMarshalflowVxlan) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowVxlan) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowVxlan) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowVxlan) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowVxlan) Clone() (FlowVxlan, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowVxlan() + 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 +} + +func (obj *flowVxlan) setNil() { + obj.flagsHolder = nil + obj.reserved0Holder = nil + obj.vniHolder = nil + obj.reserved1Holder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowVxlan is vXLAN packet header +type FlowVxlan interface { + Validation + // msg marshals FlowVxlan to protobuf object *otg.FlowVxlan + // and doesn't set defaults + msg() *otg.FlowVxlan + // setMsg unmarshals FlowVxlan from protobuf object *otg.FlowVxlan + // and doesn't set defaults + setMsg(*otg.FlowVxlan) FlowVxlan + // provides marshal interface + Marshal() marshalFlowVxlan + // provides unmarshal interface + Unmarshal() unMarshalFlowVxlan + // validate validates FlowVxlan + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowVxlan, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns PatternFlowVxlanFlags, set in FlowVxlan. + // PatternFlowVxlanFlags is flags field with a bit format of RRRRIRRR. The I flag MUST be set to 1 for a valid vxlan network id (VNI). The other 7 bits (designated "R") are reserved fields and MUST be set to zero on transmission and ignored on receipt. + Flags() PatternFlowVxlanFlags + // SetFlags assigns PatternFlowVxlanFlags provided by user to FlowVxlan. + // PatternFlowVxlanFlags is flags field with a bit format of RRRRIRRR. The I flag MUST be set to 1 for a valid vxlan network id (VNI). The other 7 bits (designated "R") are reserved fields and MUST be set to zero on transmission and ignored on receipt. + SetFlags(value PatternFlowVxlanFlags) FlowVxlan + // HasFlags checks if Flags has been set in FlowVxlan + HasFlags() bool + // Reserved0 returns PatternFlowVxlanReserved0, set in FlowVxlan. + // PatternFlowVxlanReserved0 is reserved field + Reserved0() PatternFlowVxlanReserved0 + // SetReserved0 assigns PatternFlowVxlanReserved0 provided by user to FlowVxlan. + // PatternFlowVxlanReserved0 is reserved field + SetReserved0(value PatternFlowVxlanReserved0) FlowVxlan + // HasReserved0 checks if Reserved0 has been set in FlowVxlan + HasReserved0() bool + // Vni returns PatternFlowVxlanVni, set in FlowVxlan. + // PatternFlowVxlanVni is vXLAN network id + Vni() PatternFlowVxlanVni + // SetVni assigns PatternFlowVxlanVni provided by user to FlowVxlan. + // PatternFlowVxlanVni is vXLAN network id + SetVni(value PatternFlowVxlanVni) FlowVxlan + // HasVni checks if Vni has been set in FlowVxlan + HasVni() bool + // Reserved1 returns PatternFlowVxlanReserved1, set in FlowVxlan. + // PatternFlowVxlanReserved1 is reserved field + Reserved1() PatternFlowVxlanReserved1 + // SetReserved1 assigns PatternFlowVxlanReserved1 provided by user to FlowVxlan. + // PatternFlowVxlanReserved1 is reserved field + SetReserved1(value PatternFlowVxlanReserved1) FlowVxlan + // HasReserved1 checks if Reserved1 has been set in FlowVxlan + HasReserved1() bool + setNil() +} + +// description is TBD +// Flags returns a PatternFlowVxlanFlags +func (obj *flowVxlan) Flags() PatternFlowVxlanFlags { + if obj.obj.Flags == nil { + obj.obj.Flags = NewPatternFlowVxlanFlags().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &patternFlowVxlanFlags{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// description is TBD +// Flags returns a PatternFlowVxlanFlags +func (obj *flowVxlan) HasFlags() bool { + return obj.obj.Flags != nil +} + +// description is TBD +// SetFlags sets the PatternFlowVxlanFlags value in the FlowVxlan object +func (obj *flowVxlan) SetFlags(value PatternFlowVxlanFlags) FlowVxlan { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// description is TBD +// Reserved0 returns a PatternFlowVxlanReserved0 +func (obj *flowVxlan) Reserved0() PatternFlowVxlanReserved0 { + if obj.obj.Reserved0 == nil { + obj.obj.Reserved0 = NewPatternFlowVxlanReserved0().msg() + } + if obj.reserved0Holder == nil { + obj.reserved0Holder = &patternFlowVxlanReserved0{obj: obj.obj.Reserved0} + } + return obj.reserved0Holder +} + +// description is TBD +// Reserved0 returns a PatternFlowVxlanReserved0 +func (obj *flowVxlan) HasReserved0() bool { + return obj.obj.Reserved0 != nil +} + +// description is TBD +// SetReserved0 sets the PatternFlowVxlanReserved0 value in the FlowVxlan object +func (obj *flowVxlan) SetReserved0(value PatternFlowVxlanReserved0) FlowVxlan { + + obj.reserved0Holder = nil + obj.obj.Reserved0 = value.msg() + + return obj +} + +// description is TBD +// Vni returns a PatternFlowVxlanVni +func (obj *flowVxlan) Vni() PatternFlowVxlanVni { + if obj.obj.Vni == nil { + obj.obj.Vni = NewPatternFlowVxlanVni().msg() + } + if obj.vniHolder == nil { + obj.vniHolder = &patternFlowVxlanVni{obj: obj.obj.Vni} + } + return obj.vniHolder +} + +// description is TBD +// Vni returns a PatternFlowVxlanVni +func (obj *flowVxlan) HasVni() bool { + return obj.obj.Vni != nil +} + +// description is TBD +// SetVni sets the PatternFlowVxlanVni value in the FlowVxlan object +func (obj *flowVxlan) SetVni(value PatternFlowVxlanVni) FlowVxlan { + + obj.vniHolder = nil + obj.obj.Vni = value.msg() + + return obj +} + +// description is TBD +// Reserved1 returns a PatternFlowVxlanReserved1 +func (obj *flowVxlan) Reserved1() PatternFlowVxlanReserved1 { + if obj.obj.Reserved1 == nil { + obj.obj.Reserved1 = NewPatternFlowVxlanReserved1().msg() + } + if obj.reserved1Holder == nil { + obj.reserved1Holder = &patternFlowVxlanReserved1{obj: obj.obj.Reserved1} + } + return obj.reserved1Holder +} + +// description is TBD +// Reserved1 returns a PatternFlowVxlanReserved1 +func (obj *flowVxlan) HasReserved1() bool { + return obj.obj.Reserved1 != nil +} + +// description is TBD +// SetReserved1 sets the PatternFlowVxlanReserved1 value in the FlowVxlan object +func (obj *flowVxlan) SetReserved1(value PatternFlowVxlanReserved1) FlowVxlan { + + obj.reserved1Holder = nil + obj.obj.Reserved1 = value.msg() + + return obj +} + +func (obj *flowVxlan) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.Reserved0 != nil { + + obj.Reserved0().validateObj(vObj, set_default) + } + + if obj.obj.Vni != nil { + + obj.Vni().validateObj(vObj, set_default) + } + + if obj.obj.Reserved1 != nil { + + obj.Reserved1().validateObj(vObj, set_default) + } + +} + +func (obj *flowVxlan) setDefault() { + +} diff --git a/gosnappi/flows_update.go b/gosnappi/flows_update.go new file mode 100644 index 00000000..e3cdc055 --- /dev/null +++ b/gosnappi/flows_update.go @@ -0,0 +1,426 @@ +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" +) + +// ***** FlowsUpdate ***** +type flowsUpdate struct { + validation + obj *otg.FlowsUpdate + marshaller marshalFlowsUpdate + unMarshaller unMarshalFlowsUpdate + flowsHolder FlowsUpdateFlowIter +} + +func NewFlowsUpdate() FlowsUpdate { + obj := flowsUpdate{obj: &otg.FlowsUpdate{}} + obj.setDefault() + return &obj +} + +func (obj *flowsUpdate) msg() *otg.FlowsUpdate { + return obj.obj +} + +func (obj *flowsUpdate) setMsg(msg *otg.FlowsUpdate) FlowsUpdate { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalflowsUpdate struct { + obj *flowsUpdate +} + +type marshalFlowsUpdate interface { + // ToProto marshals FlowsUpdate to protobuf object *otg.FlowsUpdate + ToProto() (*otg.FlowsUpdate, error) + // ToPbText marshals FlowsUpdate to protobuf text + ToPbText() (string, error) + // ToYaml marshals FlowsUpdate to YAML text + ToYaml() (string, error) + // ToJson marshals FlowsUpdate to JSON text + ToJson() (string, error) +} + +type unMarshalflowsUpdate struct { + obj *flowsUpdate +} + +type unMarshalFlowsUpdate interface { + // FromProto unmarshals FlowsUpdate from protobuf object *otg.FlowsUpdate + FromProto(msg *otg.FlowsUpdate) (FlowsUpdate, error) + // FromPbText unmarshals FlowsUpdate from protobuf text + FromPbText(value string) error + // FromYaml unmarshals FlowsUpdate from YAML text + FromYaml(value string) error + // FromJson unmarshals FlowsUpdate from JSON text + FromJson(value string) error +} + +func (obj *flowsUpdate) Marshal() marshalFlowsUpdate { + if obj.marshaller == nil { + obj.marshaller = &marshalflowsUpdate{obj: obj} + } + return obj.marshaller +} + +func (obj *flowsUpdate) Unmarshal() unMarshalFlowsUpdate { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalflowsUpdate{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalflowsUpdate) ToProto() (*otg.FlowsUpdate, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalflowsUpdate) FromProto(msg *otg.FlowsUpdate) (FlowsUpdate, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalflowsUpdate) 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 *unMarshalflowsUpdate) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalflowsUpdate) 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 *unMarshalflowsUpdate) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalflowsUpdate) 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 *unMarshalflowsUpdate) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *flowsUpdate) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *flowsUpdate) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *flowsUpdate) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *flowsUpdate) Clone() (FlowsUpdate, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewFlowsUpdate() + 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 +} + +func (obj *flowsUpdate) setNil() { + obj.flowsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// FlowsUpdate is a container of flows with associated properties to be updated without affecting the flows current transmit state. +type FlowsUpdate interface { + Validation + // msg marshals FlowsUpdate to protobuf object *otg.FlowsUpdate + // and doesn't set defaults + msg() *otg.FlowsUpdate + // setMsg unmarshals FlowsUpdate from protobuf object *otg.FlowsUpdate + // and doesn't set defaults + setMsg(*otg.FlowsUpdate) FlowsUpdate + // provides marshal interface + Marshal() marshalFlowsUpdate + // provides unmarshal interface + Unmarshal() unMarshalFlowsUpdate + // validate validates FlowsUpdate + validate() error + // A stringer function + String() string + // Clones the object + Clone() (FlowsUpdate, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PropertyNames returns []FlowsUpdatePropertyNamesEnum, set in FlowsUpdate + PropertyNames() []FlowsUpdatePropertyNamesEnum + // SetPropertyNames assigns []FlowsUpdatePropertyNamesEnum provided by user to FlowsUpdate + SetPropertyNames(value []FlowsUpdatePropertyNamesEnum) FlowsUpdate + // Flows returns FlowsUpdateFlowIterIter, set in FlowsUpdate + Flows() FlowsUpdateFlowIter + setNil() +} + +type FlowsUpdatePropertyNamesEnum string + +// Enum of PropertyNames on FlowsUpdate +var FlowsUpdatePropertyNames = struct { + RATE FlowsUpdatePropertyNamesEnum + SIZE FlowsUpdatePropertyNamesEnum +}{ + RATE: FlowsUpdatePropertyNamesEnum("rate"), + SIZE: FlowsUpdatePropertyNamesEnum("size"), +} + +func (obj *flowsUpdate) PropertyNames() []FlowsUpdatePropertyNamesEnum { + items := []FlowsUpdatePropertyNamesEnum{} + for _, item := range obj.obj.PropertyNames { + items = append(items, FlowsUpdatePropertyNamesEnum(item.String())) + } + return items +} + +// Flow properties to be updated without affecting the transmit state. +// SetPropertyNames sets the []string value in the FlowsUpdate object +func (obj *flowsUpdate) SetPropertyNames(value []FlowsUpdatePropertyNamesEnum) FlowsUpdate { + + items := []otg.FlowsUpdate_PropertyNames_Enum{} + for _, item := range value { + intValue := otg.FlowsUpdate_PropertyNames_Enum_value[string(item)] + items = append(items, otg.FlowsUpdate_PropertyNames_Enum(intValue)) + } + obj.obj.PropertyNames = items + return obj +} + +// The list of configured flows for which given property will be updated. +// Flows returns a []Flow +func (obj *flowsUpdate) Flows() FlowsUpdateFlowIter { + if len(obj.obj.Flows) == 0 { + obj.obj.Flows = []*otg.Flow{} + } + if obj.flowsHolder == nil { + obj.flowsHolder = newFlowsUpdateFlowIter(&obj.obj.Flows).setMsg(obj) + } + return obj.flowsHolder +} + +type flowsUpdateFlowIter struct { + obj *flowsUpdate + flowSlice []Flow + fieldPtr *[]*otg.Flow +} + +func newFlowsUpdateFlowIter(ptr *[]*otg.Flow) FlowsUpdateFlowIter { + return &flowsUpdateFlowIter{fieldPtr: ptr} +} + +type FlowsUpdateFlowIter interface { + setMsg(*flowsUpdate) FlowsUpdateFlowIter + Items() []Flow + Add() Flow + Append(items ...Flow) FlowsUpdateFlowIter + Set(index int, newObj Flow) FlowsUpdateFlowIter + Clear() FlowsUpdateFlowIter + clearHolderSlice() FlowsUpdateFlowIter + appendHolderSlice(item Flow) FlowsUpdateFlowIter +} + +func (obj *flowsUpdateFlowIter) setMsg(msg *flowsUpdate) FlowsUpdateFlowIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flow{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *flowsUpdateFlowIter) Items() []Flow { + return obj.flowSlice +} + +func (obj *flowsUpdateFlowIter) Add() Flow { + newObj := &otg.Flow{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flow{obj: newObj} + newLibObj.setDefault() + obj.flowSlice = append(obj.flowSlice, newLibObj) + return newLibObj +} + +func (obj *flowsUpdateFlowIter) Append(items ...Flow) FlowsUpdateFlowIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowSlice = append(obj.flowSlice, item) + } + return obj +} + +func (obj *flowsUpdateFlowIter) Set(index int, newObj Flow) FlowsUpdateFlowIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowSlice[index] = newObj + return obj +} +func (obj *flowsUpdateFlowIter) Clear() FlowsUpdateFlowIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Flow{} + obj.flowSlice = []Flow{} + } + return obj +} +func (obj *flowsUpdateFlowIter) clearHolderSlice() FlowsUpdateFlowIter { + if len(obj.flowSlice) > 0 { + obj.flowSlice = []Flow{} + } + return obj +} +func (obj *flowsUpdateFlowIter) appendHolderSlice(item Flow) FlowsUpdateFlowIter { + obj.flowSlice = append(obj.flowSlice, item) + return obj +} + +func (obj *flowsUpdate) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Flows) != 0 { + + if set_default { + obj.Flows().clearHolderSlice() + for _, item := range obj.obj.Flows { + obj.Flows().appendHolderSlice(&flow{obj: item}) + } + } + for _, item := range obj.Flows().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *flowsUpdate) setDefault() { + +} diff --git a/gosnappi/get_capture_response.go b/gosnappi/get_capture_response.go new file mode 100644 index 00000000..b0afe7a1 --- /dev/null +++ b/gosnappi/get_capture_response.go @@ -0,0 +1,305 @@ +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" +) + +// ***** GetCaptureResponse ***** +type getCaptureResponse struct { + validation + obj *otg.GetCaptureResponse + marshaller marshalGetCaptureResponse + unMarshaller unMarshalGetCaptureResponse +} + +func NewGetCaptureResponse() GetCaptureResponse { + obj := getCaptureResponse{obj: &otg.GetCaptureResponse{}} + obj.setDefault() + return &obj +} + +func (obj *getCaptureResponse) msg() *otg.GetCaptureResponse { + return obj.obj +} + +func (obj *getCaptureResponse) setMsg(msg *otg.GetCaptureResponse) GetCaptureResponse { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalgetCaptureResponse struct { + obj *getCaptureResponse +} + +type marshalGetCaptureResponse interface { + // ToProto marshals GetCaptureResponse to protobuf object *otg.GetCaptureResponse + ToProto() (*otg.GetCaptureResponse, error) + // ToPbText marshals GetCaptureResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals GetCaptureResponse to YAML text + ToYaml() (string, error) + // ToJson marshals GetCaptureResponse to JSON text + ToJson() (string, error) +} + +type unMarshalgetCaptureResponse struct { + obj *getCaptureResponse +} + +type unMarshalGetCaptureResponse interface { + // FromProto unmarshals GetCaptureResponse from protobuf object *otg.GetCaptureResponse + FromProto(msg *otg.GetCaptureResponse) (GetCaptureResponse, error) + // FromPbText unmarshals GetCaptureResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals GetCaptureResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals GetCaptureResponse from JSON text + FromJson(value string) error +} + +func (obj *getCaptureResponse) Marshal() marshalGetCaptureResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalgetCaptureResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *getCaptureResponse) Unmarshal() unMarshalGetCaptureResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalgetCaptureResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalgetCaptureResponse) ToProto() (*otg.GetCaptureResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalgetCaptureResponse) FromProto(msg *otg.GetCaptureResponse) (GetCaptureResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalgetCaptureResponse) 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 *unMarshalgetCaptureResponse) 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 *marshalgetCaptureResponse) 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 *unMarshalgetCaptureResponse) 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 *marshalgetCaptureResponse) 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 *unMarshalgetCaptureResponse) 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 *getCaptureResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *getCaptureResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *getCaptureResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *getCaptureResponse) Clone() (GetCaptureResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewGetCaptureResponse() + 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 +} + +// GetCaptureResponse is description is TBD +type GetCaptureResponse interface { + Validation + // msg marshals GetCaptureResponse to protobuf object *otg.GetCaptureResponse + // and doesn't set defaults + msg() *otg.GetCaptureResponse + // setMsg unmarshals GetCaptureResponse from protobuf object *otg.GetCaptureResponse + // and doesn't set defaults + setMsg(*otg.GetCaptureResponse) GetCaptureResponse + // provides marshal interface + Marshal() marshalGetCaptureResponse + // provides unmarshal interface + Unmarshal() unMarshalGetCaptureResponse + // validate validates GetCaptureResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (GetCaptureResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ResponseBytes returns []byte, set in GetCaptureResponse. + ResponseBytes() []byte + // SetResponseBytes assigns []byte provided by user to GetCaptureResponse + SetResponseBytes(value []byte) GetCaptureResponse + // HasResponseBytes checks if ResponseBytes has been set in GetCaptureResponse + HasResponseBytes() bool +} + +// description is TBD +// ResponseBytes returns a []byte +func (obj *getCaptureResponse) ResponseBytes() []byte { + + return obj.obj.ResponseBytes +} + +// description is TBD +// ResponseBytes returns a []byte +func (obj *getCaptureResponse) HasResponseBytes() bool { + return obj.obj.ResponseBytes != nil +} + +// description is TBD +// SetResponseBytes sets the []byte value in the GetCaptureResponse object +func (obj *getCaptureResponse) SetResponseBytes(value []byte) GetCaptureResponse { + + obj.obj.ResponseBytes = value + return obj +} + +func (obj *getCaptureResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *getCaptureResponse) setDefault() { + +} diff --git a/gosnappi/get_config_response.go b/gosnappi/get_config_response.go new file mode 100644 index 00000000..c1ca1a64 --- /dev/null +++ b/gosnappi/get_config_response.go @@ -0,0 +1,328 @@ +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" +) + +// ***** GetConfigResponse ***** +type getConfigResponse struct { + validation + obj *otg.GetConfigResponse + marshaller marshalGetConfigResponse + unMarshaller unMarshalGetConfigResponse + configHolder Config +} + +func NewGetConfigResponse() GetConfigResponse { + obj := getConfigResponse{obj: &otg.GetConfigResponse{}} + obj.setDefault() + return &obj +} + +func (obj *getConfigResponse) msg() *otg.GetConfigResponse { + return obj.obj +} + +func (obj *getConfigResponse) setMsg(msg *otg.GetConfigResponse) GetConfigResponse { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalgetConfigResponse struct { + obj *getConfigResponse +} + +type marshalGetConfigResponse interface { + // ToProto marshals GetConfigResponse to protobuf object *otg.GetConfigResponse + ToProto() (*otg.GetConfigResponse, error) + // ToPbText marshals GetConfigResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals GetConfigResponse to YAML text + ToYaml() (string, error) + // ToJson marshals GetConfigResponse to JSON text + ToJson() (string, error) +} + +type unMarshalgetConfigResponse struct { + obj *getConfigResponse +} + +type unMarshalGetConfigResponse interface { + // FromProto unmarshals GetConfigResponse from protobuf object *otg.GetConfigResponse + FromProto(msg *otg.GetConfigResponse) (GetConfigResponse, error) + // FromPbText unmarshals GetConfigResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals GetConfigResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals GetConfigResponse from JSON text + FromJson(value string) error +} + +func (obj *getConfigResponse) Marshal() marshalGetConfigResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalgetConfigResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *getConfigResponse) Unmarshal() unMarshalGetConfigResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalgetConfigResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalgetConfigResponse) ToProto() (*otg.GetConfigResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalgetConfigResponse) FromProto(msg *otg.GetConfigResponse) (GetConfigResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalgetConfigResponse) 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 *unMarshalgetConfigResponse) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalgetConfigResponse) 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 *unMarshalgetConfigResponse) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalgetConfigResponse) 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 *unMarshalgetConfigResponse) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *getConfigResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *getConfigResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *getConfigResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *getConfigResponse) Clone() (GetConfigResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewGetConfigResponse() + 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 +} + +func (obj *getConfigResponse) setNil() { + obj.configHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// GetConfigResponse is description is TBD +type GetConfigResponse interface { + Validation + // msg marshals GetConfigResponse to protobuf object *otg.GetConfigResponse + // and doesn't set defaults + msg() *otg.GetConfigResponse + // setMsg unmarshals GetConfigResponse from protobuf object *otg.GetConfigResponse + // and doesn't set defaults + setMsg(*otg.GetConfigResponse) GetConfigResponse + // provides marshal interface + Marshal() marshalGetConfigResponse + // provides unmarshal interface + Unmarshal() unMarshalGetConfigResponse + // validate validates GetConfigResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (GetConfigResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Config returns Config, set in GetConfigResponse. + // Config is a container for all models that are part of the configuration. + Config() Config + // SetConfig assigns Config provided by user to GetConfigResponse. + // Config is a container for all models that are part of the configuration. + SetConfig(value Config) GetConfigResponse + // HasConfig checks if Config has been set in GetConfigResponse + HasConfig() bool + setNil() +} + +// description is TBD +// Config returns a Config +func (obj *getConfigResponse) Config() Config { + if obj.obj.Config == nil { + obj.obj.Config = NewConfig().msg() + } + if obj.configHolder == nil { + obj.configHolder = &config{obj: obj.obj.Config} + } + return obj.configHolder +} + +// description is TBD +// Config returns a Config +func (obj *getConfigResponse) HasConfig() bool { + return obj.obj.Config != nil +} + +// description is TBD +// SetConfig sets the Config value in the GetConfigResponse object +func (obj *getConfigResponse) SetConfig(value Config) GetConfigResponse { + + obj.configHolder = nil + obj.obj.Config = value.msg() + + return obj +} + +func (obj *getConfigResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Config != nil { + + obj.Config().validateObj(vObj, set_default) + } + +} + +func (obj *getConfigResponse) setDefault() { + +} diff --git a/gosnappi/get_metrics_response.go b/gosnappi/get_metrics_response.go new file mode 100644 index 00000000..261202d0 --- /dev/null +++ b/gosnappi/get_metrics_response.go @@ -0,0 +1,328 @@ +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" +) + +// ***** GetMetricsResponse ***** +type getMetricsResponse struct { + validation + obj *otg.GetMetricsResponse + marshaller marshalGetMetricsResponse + unMarshaller unMarshalGetMetricsResponse + metricsResponseHolder MetricsResponse +} + +func NewGetMetricsResponse() GetMetricsResponse { + obj := getMetricsResponse{obj: &otg.GetMetricsResponse{}} + obj.setDefault() + return &obj +} + +func (obj *getMetricsResponse) msg() *otg.GetMetricsResponse { + return obj.obj +} + +func (obj *getMetricsResponse) setMsg(msg *otg.GetMetricsResponse) GetMetricsResponse { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalgetMetricsResponse struct { + obj *getMetricsResponse +} + +type marshalGetMetricsResponse interface { + // ToProto marshals GetMetricsResponse to protobuf object *otg.GetMetricsResponse + ToProto() (*otg.GetMetricsResponse, error) + // ToPbText marshals GetMetricsResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals GetMetricsResponse to YAML text + ToYaml() (string, error) + // ToJson marshals GetMetricsResponse to JSON text + ToJson() (string, error) +} + +type unMarshalgetMetricsResponse struct { + obj *getMetricsResponse +} + +type unMarshalGetMetricsResponse interface { + // FromProto unmarshals GetMetricsResponse from protobuf object *otg.GetMetricsResponse + FromProto(msg *otg.GetMetricsResponse) (GetMetricsResponse, error) + // FromPbText unmarshals GetMetricsResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals GetMetricsResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals GetMetricsResponse from JSON text + FromJson(value string) error +} + +func (obj *getMetricsResponse) Marshal() marshalGetMetricsResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalgetMetricsResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *getMetricsResponse) Unmarshal() unMarshalGetMetricsResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalgetMetricsResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalgetMetricsResponse) ToProto() (*otg.GetMetricsResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalgetMetricsResponse) FromProto(msg *otg.GetMetricsResponse) (GetMetricsResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalgetMetricsResponse) 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 *unMarshalgetMetricsResponse) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalgetMetricsResponse) 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 *unMarshalgetMetricsResponse) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalgetMetricsResponse) 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 *unMarshalgetMetricsResponse) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *getMetricsResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *getMetricsResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *getMetricsResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *getMetricsResponse) Clone() (GetMetricsResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewGetMetricsResponse() + 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 +} + +func (obj *getMetricsResponse) setNil() { + obj.metricsResponseHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// GetMetricsResponse is description is TBD +type GetMetricsResponse interface { + Validation + // msg marshals GetMetricsResponse to protobuf object *otg.GetMetricsResponse + // and doesn't set defaults + msg() *otg.GetMetricsResponse + // setMsg unmarshals GetMetricsResponse from protobuf object *otg.GetMetricsResponse + // and doesn't set defaults + setMsg(*otg.GetMetricsResponse) GetMetricsResponse + // provides marshal interface + Marshal() marshalGetMetricsResponse + // provides unmarshal interface + Unmarshal() unMarshalGetMetricsResponse + // validate validates GetMetricsResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (GetMetricsResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // MetricsResponse returns MetricsResponse, set in GetMetricsResponse. + // MetricsResponse is response containing chosen traffic generator metrics. + MetricsResponse() MetricsResponse + // SetMetricsResponse assigns MetricsResponse provided by user to GetMetricsResponse. + // MetricsResponse is response containing chosen traffic generator metrics. + SetMetricsResponse(value MetricsResponse) GetMetricsResponse + // HasMetricsResponse checks if MetricsResponse has been set in GetMetricsResponse + HasMetricsResponse() bool + setNil() +} + +// description is TBD +// MetricsResponse returns a MetricsResponse +func (obj *getMetricsResponse) MetricsResponse() MetricsResponse { + if obj.obj.MetricsResponse == nil { + obj.obj.MetricsResponse = NewMetricsResponse().msg() + } + if obj.metricsResponseHolder == nil { + obj.metricsResponseHolder = &metricsResponse{obj: obj.obj.MetricsResponse} + } + return obj.metricsResponseHolder +} + +// description is TBD +// MetricsResponse returns a MetricsResponse +func (obj *getMetricsResponse) HasMetricsResponse() bool { + return obj.obj.MetricsResponse != nil +} + +// description is TBD +// SetMetricsResponse sets the MetricsResponse value in the GetMetricsResponse object +func (obj *getMetricsResponse) SetMetricsResponse(value MetricsResponse) GetMetricsResponse { + + obj.metricsResponseHolder = nil + obj.obj.MetricsResponse = value.msg() + + return obj +} + +func (obj *getMetricsResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.MetricsResponse != nil { + + obj.MetricsResponse().validateObj(vObj, set_default) + } + +} + +func (obj *getMetricsResponse) setDefault() { + +} diff --git a/gosnappi/get_states_response.go b/gosnappi/get_states_response.go new file mode 100644 index 00000000..3578c95e --- /dev/null +++ b/gosnappi/get_states_response.go @@ -0,0 +1,328 @@ +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" +) + +// ***** GetStatesResponse ***** +type getStatesResponse struct { + validation + obj *otg.GetStatesResponse + marshaller marshalGetStatesResponse + unMarshaller unMarshalGetStatesResponse + statesResponseHolder StatesResponse +} + +func NewGetStatesResponse() GetStatesResponse { + obj := getStatesResponse{obj: &otg.GetStatesResponse{}} + obj.setDefault() + return &obj +} + +func (obj *getStatesResponse) msg() *otg.GetStatesResponse { + return obj.obj +} + +func (obj *getStatesResponse) setMsg(msg *otg.GetStatesResponse) GetStatesResponse { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalgetStatesResponse struct { + obj *getStatesResponse +} + +type marshalGetStatesResponse interface { + // ToProto marshals GetStatesResponse to protobuf object *otg.GetStatesResponse + ToProto() (*otg.GetStatesResponse, error) + // ToPbText marshals GetStatesResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals GetStatesResponse to YAML text + ToYaml() (string, error) + // ToJson marshals GetStatesResponse to JSON text + ToJson() (string, error) +} + +type unMarshalgetStatesResponse struct { + obj *getStatesResponse +} + +type unMarshalGetStatesResponse interface { + // FromProto unmarshals GetStatesResponse from protobuf object *otg.GetStatesResponse + FromProto(msg *otg.GetStatesResponse) (GetStatesResponse, error) + // FromPbText unmarshals GetStatesResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals GetStatesResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals GetStatesResponse from JSON text + FromJson(value string) error +} + +func (obj *getStatesResponse) Marshal() marshalGetStatesResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalgetStatesResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *getStatesResponse) Unmarshal() unMarshalGetStatesResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalgetStatesResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalgetStatesResponse) ToProto() (*otg.GetStatesResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalgetStatesResponse) FromProto(msg *otg.GetStatesResponse) (GetStatesResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalgetStatesResponse) 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 *unMarshalgetStatesResponse) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalgetStatesResponse) 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 *unMarshalgetStatesResponse) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalgetStatesResponse) 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 *unMarshalgetStatesResponse) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *getStatesResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *getStatesResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *getStatesResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *getStatesResponse) Clone() (GetStatesResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewGetStatesResponse() + 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 +} + +func (obj *getStatesResponse) setNil() { + obj.statesResponseHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// GetStatesResponse is description is TBD +type GetStatesResponse interface { + Validation + // msg marshals GetStatesResponse to protobuf object *otg.GetStatesResponse + // and doesn't set defaults + msg() *otg.GetStatesResponse + // setMsg unmarshals GetStatesResponse from protobuf object *otg.GetStatesResponse + // and doesn't set defaults + setMsg(*otg.GetStatesResponse) GetStatesResponse + // provides marshal interface + Marshal() marshalGetStatesResponse + // provides unmarshal interface + Unmarshal() unMarshalGetStatesResponse + // validate validates GetStatesResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (GetStatesResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // StatesResponse returns StatesResponse, set in GetStatesResponse. + // StatesResponse is response containing chosen traffic generator states + StatesResponse() StatesResponse + // SetStatesResponse assigns StatesResponse provided by user to GetStatesResponse. + // StatesResponse is response containing chosen traffic generator states + SetStatesResponse(value StatesResponse) GetStatesResponse + // HasStatesResponse checks if StatesResponse has been set in GetStatesResponse + HasStatesResponse() bool + setNil() +} + +// description is TBD +// StatesResponse returns a StatesResponse +func (obj *getStatesResponse) StatesResponse() StatesResponse { + if obj.obj.StatesResponse == nil { + obj.obj.StatesResponse = NewStatesResponse().msg() + } + if obj.statesResponseHolder == nil { + obj.statesResponseHolder = &statesResponse{obj: obj.obj.StatesResponse} + } + return obj.statesResponseHolder +} + +// description is TBD +// StatesResponse returns a StatesResponse +func (obj *getStatesResponse) HasStatesResponse() bool { + return obj.obj.StatesResponse != nil +} + +// description is TBD +// SetStatesResponse sets the StatesResponse value in the GetStatesResponse object +func (obj *getStatesResponse) SetStatesResponse(value StatesResponse) GetStatesResponse { + + obj.statesResponseHolder = nil + obj.obj.StatesResponse = value.msg() + + return obj +} + +func (obj *getStatesResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.StatesResponse != nil { + + obj.StatesResponse().validateObj(vObj, set_default) + } + +} + +func (obj *getStatesResponse) setDefault() { + +} diff --git a/gosnappi/get_version_response.go b/gosnappi/get_version_response.go new file mode 100644 index 00000000..c1a4c4bf --- /dev/null +++ b/gosnappi/get_version_response.go @@ -0,0 +1,328 @@ +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" +) + +// ***** GetVersionResponse ***** +type getVersionResponse struct { + validation + obj *otg.GetVersionResponse + marshaller marshalGetVersionResponse + unMarshaller unMarshalGetVersionResponse + versionHolder Version +} + +func NewGetVersionResponse() GetVersionResponse { + obj := getVersionResponse{obj: &otg.GetVersionResponse{}} + obj.setDefault() + return &obj +} + +func (obj *getVersionResponse) msg() *otg.GetVersionResponse { + return obj.obj +} + +func (obj *getVersionResponse) setMsg(msg *otg.GetVersionResponse) GetVersionResponse { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalgetVersionResponse struct { + obj *getVersionResponse +} + +type marshalGetVersionResponse interface { + // ToProto marshals GetVersionResponse to protobuf object *otg.GetVersionResponse + ToProto() (*otg.GetVersionResponse, error) + // ToPbText marshals GetVersionResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals GetVersionResponse to YAML text + ToYaml() (string, error) + // ToJson marshals GetVersionResponse to JSON text + ToJson() (string, error) +} + +type unMarshalgetVersionResponse struct { + obj *getVersionResponse +} + +type unMarshalGetVersionResponse interface { + // FromProto unmarshals GetVersionResponse from protobuf object *otg.GetVersionResponse + FromProto(msg *otg.GetVersionResponse) (GetVersionResponse, error) + // FromPbText unmarshals GetVersionResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals GetVersionResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals GetVersionResponse from JSON text + FromJson(value string) error +} + +func (obj *getVersionResponse) Marshal() marshalGetVersionResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalgetVersionResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *getVersionResponse) Unmarshal() unMarshalGetVersionResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalgetVersionResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalgetVersionResponse) ToProto() (*otg.GetVersionResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalgetVersionResponse) FromProto(msg *otg.GetVersionResponse) (GetVersionResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalgetVersionResponse) 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 *unMarshalgetVersionResponse) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalgetVersionResponse) 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 *unMarshalgetVersionResponse) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalgetVersionResponse) 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 *unMarshalgetVersionResponse) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *getVersionResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *getVersionResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *getVersionResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *getVersionResponse) Clone() (GetVersionResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewGetVersionResponse() + 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 +} + +func (obj *getVersionResponse) setNil() { + obj.versionHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// GetVersionResponse is description is TBD +type GetVersionResponse interface { + Validation + // msg marshals GetVersionResponse to protobuf object *otg.GetVersionResponse + // and doesn't set defaults + msg() *otg.GetVersionResponse + // setMsg unmarshals GetVersionResponse from protobuf object *otg.GetVersionResponse + // and doesn't set defaults + setMsg(*otg.GetVersionResponse) GetVersionResponse + // provides marshal interface + Marshal() marshalGetVersionResponse + // provides unmarshal interface + Unmarshal() unMarshalGetVersionResponse + // validate validates GetVersionResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (GetVersionResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Version returns Version, set in GetVersionResponse. + // Version is version details + Version() Version + // SetVersion assigns Version provided by user to GetVersionResponse. + // Version is version details + SetVersion(value Version) GetVersionResponse + // HasVersion checks if Version has been set in GetVersionResponse + HasVersion() bool + setNil() +} + +// description is TBD +// Version returns a Version +func (obj *getVersionResponse) Version() Version { + if obj.obj.Version == nil { + obj.obj.Version = NewVersion().msg() + } + if obj.versionHolder == nil { + obj.versionHolder = &version{obj: obj.obj.Version} + } + return obj.versionHolder +} + +// description is TBD +// Version returns a Version +func (obj *getVersionResponse) HasVersion() bool { + return obj.obj.Version != nil +} + +// description is TBD +// SetVersion sets the Version value in the GetVersionResponse object +func (obj *getVersionResponse) SetVersion(value Version) GetVersionResponse { + + obj.versionHolder = nil + obj.obj.Version = value.msg() + + return obj +} + +func (obj *getVersionResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Version != nil { + + obj.Version().validateObj(vObj, set_default) + } + +} + +func (obj *getVersionResponse) setDefault() { + +} diff --git a/gosnappi/gosnappi.go b/gosnappi/gosnappi.go index 415a9a30..6dcded0c 100644 --- a/gosnappi/gosnappi.go +++ b/gosnappi/gosnappi.go @@ -20,15 +20,11 @@ import ( "net" "net/http" "net/url" - "strings" - "github.com/ghodss/yaml" otg "github.com/open-traffic-generator/snappi/gosnappi/otg" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/status" - "google.golang.org/protobuf/encoding/protojson" - "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/emptypb" ) @@ -829,469830 +825,3 @@ func (api *gosnappiApi) httpGetVersion() (Version, error) { return nil, fromHttpError(resp.StatusCode, bodyBytes) } } - -// ***** Config ***** -type config struct { - validation - obj *otg.Config - marshaller marshalConfig - unMarshaller unMarshalConfig - portsHolder ConfigPortIter - lagsHolder ConfigLagIter - layer1Holder ConfigLayer1Iter - capturesHolder ConfigCaptureIter - devicesHolder ConfigDeviceIter - flowsHolder ConfigFlowIter - eventsHolder Event - optionsHolder ConfigOptions - lldpHolder ConfigLldpIter -} - -func NewConfig() Config { - obj := config{obj: &otg.Config{}} - obj.setDefault() - return &obj -} - -func (obj *config) msg() *otg.Config { - return obj.obj -} - -func (obj *config) setMsg(msg *otg.Config) Config { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalconfig struct { - obj *config -} - -type marshalConfig interface { - // ToProto marshals Config to protobuf object *otg.Config - ToProto() (*otg.Config, error) - // ToPbText marshals Config to protobuf text - ToPbText() (string, error) - // ToYaml marshals Config to YAML text - ToYaml() (string, error) - // ToJson marshals Config to JSON text - ToJson() (string, error) -} - -type unMarshalconfig struct { - obj *config -} - -type unMarshalConfig interface { - // FromProto unmarshals Config from protobuf object *otg.Config - FromProto(msg *otg.Config) (Config, error) - // FromPbText unmarshals Config from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Config from YAML text - FromYaml(value string) error - // FromJson unmarshals Config from JSON text - FromJson(value string) error -} - -func (obj *config) Marshal() marshalConfig { - if obj.marshaller == nil { - obj.marshaller = &marshalconfig{obj: obj} - } - return obj.marshaller -} - -func (obj *config) Unmarshal() unMarshalConfig { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalconfig{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalconfig) ToProto() (*otg.Config, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalconfig) FromProto(msg *otg.Config) (Config, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalconfig) 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 *unMarshalconfig) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalconfig) 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 *unMarshalconfig) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalconfig) 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 *unMarshalconfig) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *config) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *config) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *config) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *config) Clone() (Config, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewConfig() - 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 -} - -func (obj *config) setNil() { - obj.portsHolder = nil - obj.lagsHolder = nil - obj.layer1Holder = nil - obj.capturesHolder = nil - obj.devicesHolder = nil - obj.flowsHolder = nil - obj.eventsHolder = nil - obj.optionsHolder = nil - obj.lldpHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// Config is a container for all models that are part of the configuration. -type Config interface { - Validation - // msg marshals Config to protobuf object *otg.Config - // and doesn't set defaults - msg() *otg.Config - // setMsg unmarshals Config from protobuf object *otg.Config - // and doesn't set defaults - setMsg(*otg.Config) Config - // provides marshal interface - Marshal() marshalConfig - // provides unmarshal interface - Unmarshal() unMarshalConfig - // validate validates Config - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Config, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ports returns ConfigPortIterIter, set in Config - Ports() ConfigPortIter - // Lags returns ConfigLagIterIter, set in Config - Lags() ConfigLagIter - // Layer1 returns ConfigLayer1IterIter, set in Config - Layer1() ConfigLayer1Iter - // Captures returns ConfigCaptureIterIter, set in Config - Captures() ConfigCaptureIter - // Devices returns ConfigDeviceIterIter, set in Config - Devices() ConfigDeviceIter - // Flows returns ConfigFlowIterIter, set in Config - Flows() ConfigFlowIter - // Events returns Event, set in Config. - // Event is the optional container for event configuration. - Events() Event - // SetEvents assigns Event provided by user to Config. - // Event is the optional container for event configuration. - SetEvents(value Event) Config - // HasEvents checks if Events has been set in Config - HasEvents() bool - // Options returns ConfigOptions, set in Config. - // ConfigOptions is global configuration options. - Options() ConfigOptions - // SetOptions assigns ConfigOptions provided by user to Config. - // ConfigOptions is global configuration options. - SetOptions(value ConfigOptions) Config - // HasOptions checks if Options has been set in Config - HasOptions() bool - // Lldp returns ConfigLldpIterIter, set in Config - Lldp() ConfigLldpIter - setNil() -} - -// The ports that will be configured on the traffic generator. -// Ports returns a []Port -func (obj *config) Ports() ConfigPortIter { - if len(obj.obj.Ports) == 0 { - obj.obj.Ports = []*otg.Port{} - } - if obj.portsHolder == nil { - obj.portsHolder = newConfigPortIter(&obj.obj.Ports).setMsg(obj) - } - return obj.portsHolder -} - -type configPortIter struct { - obj *config - portSlice []Port - fieldPtr *[]*otg.Port -} - -func newConfigPortIter(ptr *[]*otg.Port) ConfigPortIter { - return &configPortIter{fieldPtr: ptr} -} - -type ConfigPortIter interface { - setMsg(*config) ConfigPortIter - Items() []Port - Add() Port - Append(items ...Port) ConfigPortIter - Set(index int, newObj Port) ConfigPortIter - Clear() ConfigPortIter - clearHolderSlice() ConfigPortIter - appendHolderSlice(item Port) ConfigPortIter -} - -func (obj *configPortIter) setMsg(msg *config) ConfigPortIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&port{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *configPortIter) Items() []Port { - return obj.portSlice -} - -func (obj *configPortIter) Add() Port { - newObj := &otg.Port{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &port{obj: newObj} - newLibObj.setDefault() - obj.portSlice = append(obj.portSlice, newLibObj) - return newLibObj -} - -func (obj *configPortIter) Append(items ...Port) ConfigPortIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.portSlice = append(obj.portSlice, item) - } - return obj -} - -func (obj *configPortIter) Set(index int, newObj Port) ConfigPortIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.portSlice[index] = newObj - return obj -} -func (obj *configPortIter) Clear() ConfigPortIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Port{} - obj.portSlice = []Port{} - } - return obj -} -func (obj *configPortIter) clearHolderSlice() ConfigPortIter { - if len(obj.portSlice) > 0 { - obj.portSlice = []Port{} - } - return obj -} -func (obj *configPortIter) appendHolderSlice(item Port) ConfigPortIter { - obj.portSlice = append(obj.portSlice, item) - return obj -} - -// The LAGs that will be configured on the traffic generator. -// Lags returns a []Lag -func (obj *config) Lags() ConfigLagIter { - if len(obj.obj.Lags) == 0 { - obj.obj.Lags = []*otg.Lag{} - } - if obj.lagsHolder == nil { - obj.lagsHolder = newConfigLagIter(&obj.obj.Lags).setMsg(obj) - } - return obj.lagsHolder -} - -type configLagIter struct { - obj *config - lagSlice []Lag - fieldPtr *[]*otg.Lag -} - -func newConfigLagIter(ptr *[]*otg.Lag) ConfigLagIter { - return &configLagIter{fieldPtr: ptr} -} - -type ConfigLagIter interface { - setMsg(*config) ConfigLagIter - Items() []Lag - Add() Lag - Append(items ...Lag) ConfigLagIter - Set(index int, newObj Lag) ConfigLagIter - Clear() ConfigLagIter - clearHolderSlice() ConfigLagIter - appendHolderSlice(item Lag) ConfigLagIter -} - -func (obj *configLagIter) setMsg(msg *config) ConfigLagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&lag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *configLagIter) Items() []Lag { - return obj.lagSlice -} - -func (obj *configLagIter) Add() Lag { - newObj := &otg.Lag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &lag{obj: newObj} - newLibObj.setDefault() - obj.lagSlice = append(obj.lagSlice, newLibObj) - return newLibObj -} - -func (obj *configLagIter) Append(items ...Lag) ConfigLagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.lagSlice = append(obj.lagSlice, item) - } - return obj -} - -func (obj *configLagIter) Set(index int, newObj Lag) ConfigLagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.lagSlice[index] = newObj - return obj -} -func (obj *configLagIter) Clear() ConfigLagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Lag{} - obj.lagSlice = []Lag{} - } - return obj -} -func (obj *configLagIter) clearHolderSlice() ConfigLagIter { - if len(obj.lagSlice) > 0 { - obj.lagSlice = []Lag{} - } - return obj -} -func (obj *configLagIter) appendHolderSlice(item Lag) ConfigLagIter { - obj.lagSlice = append(obj.lagSlice, item) - return obj -} - -// The layer1 settings that will be configured on the traffic generator. -// Since layer1 settings usually vary across variety of test ports, these -// most likely won't be portable. -// Layer1 returns a []Layer1 -func (obj *config) Layer1() ConfigLayer1Iter { - if len(obj.obj.Layer1) == 0 { - obj.obj.Layer1 = []*otg.Layer1{} - } - if obj.layer1Holder == nil { - obj.layer1Holder = newConfigLayer1Iter(&obj.obj.Layer1).setMsg(obj) - } - return obj.layer1Holder -} - -type configLayer1Iter struct { - obj *config - layer1Slice []Layer1 - fieldPtr *[]*otg.Layer1 -} - -func newConfigLayer1Iter(ptr *[]*otg.Layer1) ConfigLayer1Iter { - return &configLayer1Iter{fieldPtr: ptr} -} - -type ConfigLayer1Iter interface { - setMsg(*config) ConfigLayer1Iter - Items() []Layer1 - Add() Layer1 - Append(items ...Layer1) ConfigLayer1Iter - Set(index int, newObj Layer1) ConfigLayer1Iter - Clear() ConfigLayer1Iter - clearHolderSlice() ConfigLayer1Iter - appendHolderSlice(item Layer1) ConfigLayer1Iter -} - -func (obj *configLayer1Iter) setMsg(msg *config) ConfigLayer1Iter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&layer1{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *configLayer1Iter) Items() []Layer1 { - return obj.layer1Slice -} - -func (obj *configLayer1Iter) Add() Layer1 { - newObj := &otg.Layer1{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &layer1{obj: newObj} - newLibObj.setDefault() - obj.layer1Slice = append(obj.layer1Slice, newLibObj) - return newLibObj -} - -func (obj *configLayer1Iter) Append(items ...Layer1) ConfigLayer1Iter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.layer1Slice = append(obj.layer1Slice, item) - } - return obj -} - -func (obj *configLayer1Iter) Set(index int, newObj Layer1) ConfigLayer1Iter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.layer1Slice[index] = newObj - return obj -} -func (obj *configLayer1Iter) Clear() ConfigLayer1Iter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Layer1{} - obj.layer1Slice = []Layer1{} - } - return obj -} -func (obj *configLayer1Iter) clearHolderSlice() ConfigLayer1Iter { - if len(obj.layer1Slice) > 0 { - obj.layer1Slice = []Layer1{} - } - return obj -} -func (obj *configLayer1Iter) appendHolderSlice(item Layer1) ConfigLayer1Iter { - obj.layer1Slice = append(obj.layer1Slice, item) - return obj -} - -// The capture settings that will be configured on the traffic generator. -// Captures returns a []Capture -func (obj *config) Captures() ConfigCaptureIter { - if len(obj.obj.Captures) == 0 { - obj.obj.Captures = []*otg.Capture{} - } - if obj.capturesHolder == nil { - obj.capturesHolder = newConfigCaptureIter(&obj.obj.Captures).setMsg(obj) - } - return obj.capturesHolder -} - -type configCaptureIter struct { - obj *config - captureSlice []Capture - fieldPtr *[]*otg.Capture -} - -func newConfigCaptureIter(ptr *[]*otg.Capture) ConfigCaptureIter { - return &configCaptureIter{fieldPtr: ptr} -} - -type ConfigCaptureIter interface { - setMsg(*config) ConfigCaptureIter - Items() []Capture - Add() Capture - Append(items ...Capture) ConfigCaptureIter - Set(index int, newObj Capture) ConfigCaptureIter - Clear() ConfigCaptureIter - clearHolderSlice() ConfigCaptureIter - appendHolderSlice(item Capture) ConfigCaptureIter -} - -func (obj *configCaptureIter) setMsg(msg *config) ConfigCaptureIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&capture{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *configCaptureIter) Items() []Capture { - return obj.captureSlice -} - -func (obj *configCaptureIter) Add() Capture { - newObj := &otg.Capture{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &capture{obj: newObj} - newLibObj.setDefault() - obj.captureSlice = append(obj.captureSlice, newLibObj) - return newLibObj -} - -func (obj *configCaptureIter) Append(items ...Capture) ConfigCaptureIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.captureSlice = append(obj.captureSlice, item) - } - return obj -} - -func (obj *configCaptureIter) Set(index int, newObj Capture) ConfigCaptureIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.captureSlice[index] = newObj - return obj -} -func (obj *configCaptureIter) Clear() ConfigCaptureIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Capture{} - obj.captureSlice = []Capture{} - } - return obj -} -func (obj *configCaptureIter) clearHolderSlice() ConfigCaptureIter { - if len(obj.captureSlice) > 0 { - obj.captureSlice = []Capture{} - } - return obj -} -func (obj *configCaptureIter) appendHolderSlice(item Capture) ConfigCaptureIter { - obj.captureSlice = append(obj.captureSlice, item) - return obj -} - -// The emulated devices that will be configured on the traffic generator. -// Each device contains configurations for network interfaces and -// protocols running on top of those interfaces. -// Devices returns a []Device -func (obj *config) Devices() ConfigDeviceIter { - if len(obj.obj.Devices) == 0 { - obj.obj.Devices = []*otg.Device{} - } - if obj.devicesHolder == nil { - obj.devicesHolder = newConfigDeviceIter(&obj.obj.Devices).setMsg(obj) - } - return obj.devicesHolder -} - -type configDeviceIter struct { - obj *config - deviceSlice []Device - fieldPtr *[]*otg.Device -} - -func newConfigDeviceIter(ptr *[]*otg.Device) ConfigDeviceIter { - return &configDeviceIter{fieldPtr: ptr} -} - -type ConfigDeviceIter interface { - setMsg(*config) ConfigDeviceIter - Items() []Device - Add() Device - Append(items ...Device) ConfigDeviceIter - Set(index int, newObj Device) ConfigDeviceIter - Clear() ConfigDeviceIter - clearHolderSlice() ConfigDeviceIter - appendHolderSlice(item Device) ConfigDeviceIter -} - -func (obj *configDeviceIter) setMsg(msg *config) ConfigDeviceIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&device{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *configDeviceIter) Items() []Device { - return obj.deviceSlice -} - -func (obj *configDeviceIter) Add() Device { - newObj := &otg.Device{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &device{obj: newObj} - newLibObj.setDefault() - obj.deviceSlice = append(obj.deviceSlice, newLibObj) - return newLibObj -} - -func (obj *configDeviceIter) Append(items ...Device) ConfigDeviceIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.deviceSlice = append(obj.deviceSlice, item) - } - return obj -} - -func (obj *configDeviceIter) Set(index int, newObj Device) ConfigDeviceIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.deviceSlice[index] = newObj - return obj -} -func (obj *configDeviceIter) Clear() ConfigDeviceIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Device{} - obj.deviceSlice = []Device{} - } - return obj -} -func (obj *configDeviceIter) clearHolderSlice() ConfigDeviceIter { - if len(obj.deviceSlice) > 0 { - obj.deviceSlice = []Device{} - } - return obj -} -func (obj *configDeviceIter) appendHolderSlice(item Device) ConfigDeviceIter { - obj.deviceSlice = append(obj.deviceSlice, item) - return obj -} - -// The flows that will be configured on the traffic generator. -// Flows returns a []Flow -func (obj *config) Flows() ConfigFlowIter { - if len(obj.obj.Flows) == 0 { - obj.obj.Flows = []*otg.Flow{} - } - if obj.flowsHolder == nil { - obj.flowsHolder = newConfigFlowIter(&obj.obj.Flows).setMsg(obj) - } - return obj.flowsHolder -} - -type configFlowIter struct { - obj *config - flowSlice []Flow - fieldPtr *[]*otg.Flow -} - -func newConfigFlowIter(ptr *[]*otg.Flow) ConfigFlowIter { - return &configFlowIter{fieldPtr: ptr} -} - -type ConfigFlowIter interface { - setMsg(*config) ConfigFlowIter - Items() []Flow - Add() Flow - Append(items ...Flow) ConfigFlowIter - Set(index int, newObj Flow) ConfigFlowIter - Clear() ConfigFlowIter - clearHolderSlice() ConfigFlowIter - appendHolderSlice(item Flow) ConfigFlowIter -} - -func (obj *configFlowIter) setMsg(msg *config) ConfigFlowIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flow{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *configFlowIter) Items() []Flow { - return obj.flowSlice -} - -func (obj *configFlowIter) Add() Flow { - newObj := &otg.Flow{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flow{obj: newObj} - newLibObj.setDefault() - obj.flowSlice = append(obj.flowSlice, newLibObj) - return newLibObj -} - -func (obj *configFlowIter) Append(items ...Flow) ConfigFlowIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowSlice = append(obj.flowSlice, item) - } - return obj -} - -func (obj *configFlowIter) Set(index int, newObj Flow) ConfigFlowIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowSlice[index] = newObj - return obj -} -func (obj *configFlowIter) Clear() ConfigFlowIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Flow{} - obj.flowSlice = []Flow{} - } - return obj -} -func (obj *configFlowIter) clearHolderSlice() ConfigFlowIter { - if len(obj.flowSlice) > 0 { - obj.flowSlice = []Flow{} - } - return obj -} -func (obj *configFlowIter) appendHolderSlice(item Flow) ConfigFlowIter { - obj.flowSlice = append(obj.flowSlice, item) - return obj -} - -// description is TBD -// Events returns a Event -func (obj *config) Events() Event { - if obj.obj.Events == nil { - obj.obj.Events = NewEvent().msg() - } - if obj.eventsHolder == nil { - obj.eventsHolder = &event{obj: obj.obj.Events} - } - return obj.eventsHolder -} - -// description is TBD -// Events returns a Event -func (obj *config) HasEvents() bool { - return obj.obj.Events != nil -} - -// description is TBD -// SetEvents sets the Event value in the Config object -func (obj *config) SetEvents(value Event) Config { - - obj.eventsHolder = nil - obj.obj.Events = value.msg() - - return obj -} - -// description is TBD -// Options returns a ConfigOptions -func (obj *config) Options() ConfigOptions { - if obj.obj.Options == nil { - obj.obj.Options = NewConfigOptions().msg() - } - if obj.optionsHolder == nil { - obj.optionsHolder = &configOptions{obj: obj.obj.Options} - } - return obj.optionsHolder -} - -// description is TBD -// Options returns a ConfigOptions -func (obj *config) HasOptions() bool { - return obj.obj.Options != nil -} - -// description is TBD -// SetOptions sets the ConfigOptions value in the Config object -func (obj *config) SetOptions(value ConfigOptions) Config { - - obj.optionsHolder = nil - obj.obj.Options = value.msg() - - return obj -} - -// LLDP protocol that will be configured on traffic generator. -// Lldp returns a []Lldp -func (obj *config) Lldp() ConfigLldpIter { - if len(obj.obj.Lldp) == 0 { - obj.obj.Lldp = []*otg.Lldp{} - } - if obj.lldpHolder == nil { - obj.lldpHolder = newConfigLldpIter(&obj.obj.Lldp).setMsg(obj) - } - return obj.lldpHolder -} - -type configLldpIter struct { - obj *config - lldpSlice []Lldp - fieldPtr *[]*otg.Lldp -} - -func newConfigLldpIter(ptr *[]*otg.Lldp) ConfigLldpIter { - return &configLldpIter{fieldPtr: ptr} -} - -type ConfigLldpIter interface { - setMsg(*config) ConfigLldpIter - Items() []Lldp - Add() Lldp - Append(items ...Lldp) ConfigLldpIter - Set(index int, newObj Lldp) ConfigLldpIter - Clear() ConfigLldpIter - clearHolderSlice() ConfigLldpIter - appendHolderSlice(item Lldp) ConfigLldpIter -} - -func (obj *configLldpIter) setMsg(msg *config) ConfigLldpIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&lldp{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *configLldpIter) Items() []Lldp { - return obj.lldpSlice -} - -func (obj *configLldpIter) Add() Lldp { - newObj := &otg.Lldp{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &lldp{obj: newObj} - newLibObj.setDefault() - obj.lldpSlice = append(obj.lldpSlice, newLibObj) - return newLibObj -} - -func (obj *configLldpIter) Append(items ...Lldp) ConfigLldpIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.lldpSlice = append(obj.lldpSlice, item) - } - return obj -} - -func (obj *configLldpIter) Set(index int, newObj Lldp) ConfigLldpIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.lldpSlice[index] = newObj - return obj -} -func (obj *configLldpIter) Clear() ConfigLldpIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Lldp{} - obj.lldpSlice = []Lldp{} - } - return obj -} -func (obj *configLldpIter) clearHolderSlice() ConfigLldpIter { - if len(obj.lldpSlice) > 0 { - obj.lldpSlice = []Lldp{} - } - return obj -} -func (obj *configLldpIter) appendHolderSlice(item Lldp) ConfigLldpIter { - obj.lldpSlice = append(obj.lldpSlice, item) - return obj -} - -func (obj *config) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Ports) != 0 { - - if set_default { - obj.Ports().clearHolderSlice() - for _, item := range obj.obj.Ports { - obj.Ports().appendHolderSlice(&port{obj: item}) - } - } - for _, item := range obj.Ports().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Lags) != 0 { - - if set_default { - obj.Lags().clearHolderSlice() - for _, item := range obj.obj.Lags { - obj.Lags().appendHolderSlice(&lag{obj: item}) - } - } - for _, item := range obj.Lags().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Layer1) != 0 { - - if set_default { - obj.Layer1().clearHolderSlice() - for _, item := range obj.obj.Layer1 { - obj.Layer1().appendHolderSlice(&layer1{obj: item}) - } - } - for _, item := range obj.Layer1().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Captures) != 0 { - - if set_default { - obj.Captures().clearHolderSlice() - for _, item := range obj.obj.Captures { - obj.Captures().appendHolderSlice(&capture{obj: item}) - } - } - for _, item := range obj.Captures().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Devices) != 0 { - - if set_default { - obj.Devices().clearHolderSlice() - for _, item := range obj.obj.Devices { - obj.Devices().appendHolderSlice(&device{obj: item}) - } - } - for _, item := range obj.Devices().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Flows) != 0 { - - if set_default { - obj.Flows().clearHolderSlice() - for _, item := range obj.obj.Flows { - obj.Flows().appendHolderSlice(&flow{obj: item}) - } - } - for _, item := range obj.Flows().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Events != nil { - - obj.Events().validateObj(vObj, set_default) - } - - if obj.obj.Options != nil { - - obj.Options().validateObj(vObj, set_default) - } - - if len(obj.obj.Lldp) != 0 { - - if set_default { - obj.Lldp().clearHolderSlice() - for _, item := range obj.obj.Lldp { - obj.Lldp().appendHolderSlice(&lldp{obj: item}) - } - } - for _, item := range obj.Lldp().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *config) setDefault() { - -} - -// ***** ConfigUpdate ***** -type configUpdate struct { - validation - obj *otg.ConfigUpdate - marshaller marshalConfigUpdate - unMarshaller unMarshalConfigUpdate - flowsHolder FlowsUpdate -} - -func NewConfigUpdate() ConfigUpdate { - obj := configUpdate{obj: &otg.ConfigUpdate{}} - obj.setDefault() - return &obj -} - -func (obj *configUpdate) msg() *otg.ConfigUpdate { - return obj.obj -} - -func (obj *configUpdate) setMsg(msg *otg.ConfigUpdate) ConfigUpdate { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalconfigUpdate struct { - obj *configUpdate -} - -type marshalConfigUpdate interface { - // ToProto marshals ConfigUpdate to protobuf object *otg.ConfigUpdate - ToProto() (*otg.ConfigUpdate, error) - // ToPbText marshals ConfigUpdate to protobuf text - ToPbText() (string, error) - // ToYaml marshals ConfigUpdate to YAML text - ToYaml() (string, error) - // ToJson marshals ConfigUpdate to JSON text - ToJson() (string, error) -} - -type unMarshalconfigUpdate struct { - obj *configUpdate -} - -type unMarshalConfigUpdate interface { - // FromProto unmarshals ConfigUpdate from protobuf object *otg.ConfigUpdate - FromProto(msg *otg.ConfigUpdate) (ConfigUpdate, error) - // FromPbText unmarshals ConfigUpdate from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ConfigUpdate from YAML text - FromYaml(value string) error - // FromJson unmarshals ConfigUpdate from JSON text - FromJson(value string) error -} - -func (obj *configUpdate) Marshal() marshalConfigUpdate { - if obj.marshaller == nil { - obj.marshaller = &marshalconfigUpdate{obj: obj} - } - return obj.marshaller -} - -func (obj *configUpdate) Unmarshal() unMarshalConfigUpdate { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalconfigUpdate{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalconfigUpdate) ToProto() (*otg.ConfigUpdate, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalconfigUpdate) FromProto(msg *otg.ConfigUpdate) (ConfigUpdate, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalconfigUpdate) 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 *unMarshalconfigUpdate) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalconfigUpdate) 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 *unMarshalconfigUpdate) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalconfigUpdate) 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 *unMarshalconfigUpdate) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *configUpdate) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *configUpdate) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *configUpdate) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *configUpdate) Clone() (ConfigUpdate, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewConfigUpdate() - 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 -} - -func (obj *configUpdate) setNil() { - obj.flowsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ConfigUpdate is request for updating specific attributes of resources in traffic generator -type ConfigUpdate interface { - Validation - // msg marshals ConfigUpdate to protobuf object *otg.ConfigUpdate - // and doesn't set defaults - msg() *otg.ConfigUpdate - // setMsg unmarshals ConfigUpdate from protobuf object *otg.ConfigUpdate - // and doesn't set defaults - setMsg(*otg.ConfigUpdate) ConfigUpdate - // provides marshal interface - Marshal() marshalConfigUpdate - // provides unmarshal interface - Unmarshal() unMarshalConfigUpdate - // validate validates ConfigUpdate - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ConfigUpdate, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ConfigUpdateChoiceEnum, set in ConfigUpdate - Choice() ConfigUpdateChoiceEnum - // setChoice assigns ConfigUpdateChoiceEnum provided by user to ConfigUpdate - setChoice(value ConfigUpdateChoiceEnum) ConfigUpdate - // HasChoice checks if Choice has been set in ConfigUpdate - HasChoice() bool - // Flows returns FlowsUpdate, set in ConfigUpdate. - // FlowsUpdate is a container of flows with associated properties to be updated without affecting the flows current transmit state. - Flows() FlowsUpdate - // SetFlows assigns FlowsUpdate provided by user to ConfigUpdate. - // FlowsUpdate is a container of flows with associated properties to be updated without affecting the flows current transmit state. - SetFlows(value FlowsUpdate) ConfigUpdate - // HasFlows checks if Flows has been set in ConfigUpdate - HasFlows() bool - setNil() -} - -type ConfigUpdateChoiceEnum string - -// Enum of Choice on ConfigUpdate -var ConfigUpdateChoice = struct { - FLOWS ConfigUpdateChoiceEnum -}{ - FLOWS: ConfigUpdateChoiceEnum("flows"), -} - -func (obj *configUpdate) Choice() ConfigUpdateChoiceEnum { - return ConfigUpdateChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *configUpdate) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *configUpdate) setChoice(value ConfigUpdateChoiceEnum) ConfigUpdate { - intValue, ok := otg.ConfigUpdate_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ConfigUpdateChoiceEnum", string(value))) - return obj - } - enumValue := otg.ConfigUpdate_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Flows = nil - obj.flowsHolder = nil - - if value == ConfigUpdateChoice.FLOWS { - obj.obj.Flows = NewFlowsUpdate().msg() - } - - return obj -} - -// description is TBD -// Flows returns a FlowsUpdate -func (obj *configUpdate) Flows() FlowsUpdate { - if obj.obj.Flows == nil { - obj.setChoice(ConfigUpdateChoice.FLOWS) - } - if obj.flowsHolder == nil { - obj.flowsHolder = &flowsUpdate{obj: obj.obj.Flows} - } - return obj.flowsHolder -} - -// description is TBD -// Flows returns a FlowsUpdate -func (obj *configUpdate) HasFlows() bool { - return obj.obj.Flows != nil -} - -// description is TBD -// SetFlows sets the FlowsUpdate value in the ConfigUpdate object -func (obj *configUpdate) SetFlows(value FlowsUpdate) ConfigUpdate { - obj.setChoice(ConfigUpdateChoice.FLOWS) - obj.flowsHolder = nil - obj.obj.Flows = value.msg() - - return obj -} - -func (obj *configUpdate) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flows != nil { - - obj.Flows().validateObj(vObj, set_default) - } - -} - -func (obj *configUpdate) setDefault() { - var choices_set int = 0 - var choice ConfigUpdateChoiceEnum - - if obj.obj.Flows != nil { - choices_set += 1 - choice = ConfigUpdateChoice.FLOWS - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ConfigUpdate") - } - } else { - intVal := otg.ConfigUpdate_Choice_Enum_value[string(choice)] - enumValue := otg.ConfigUpdate_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** ControlState ***** -type controlState struct { - validation - obj *otg.ControlState - marshaller marshalControlState - unMarshaller unMarshalControlState - portHolder StatePort - protocolHolder StateProtocol - trafficHolder StateTraffic -} - -func NewControlState() ControlState { - obj := controlState{obj: &otg.ControlState{}} - obj.setDefault() - return &obj -} - -func (obj *controlState) msg() *otg.ControlState { - return obj.obj -} - -func (obj *controlState) setMsg(msg *otg.ControlState) ControlState { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalcontrolState struct { - obj *controlState -} - -type marshalControlState interface { - // ToProto marshals ControlState to protobuf object *otg.ControlState - ToProto() (*otg.ControlState, error) - // ToPbText marshals ControlState to protobuf text - ToPbText() (string, error) - // ToYaml marshals ControlState to YAML text - ToYaml() (string, error) - // ToJson marshals ControlState to JSON text - ToJson() (string, error) -} - -type unMarshalcontrolState struct { - obj *controlState -} - -type unMarshalControlState interface { - // FromProto unmarshals ControlState from protobuf object *otg.ControlState - FromProto(msg *otg.ControlState) (ControlState, error) - // FromPbText unmarshals ControlState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ControlState from YAML text - FromYaml(value string) error - // FromJson unmarshals ControlState from JSON text - FromJson(value string) error -} - -func (obj *controlState) Marshal() marshalControlState { - if obj.marshaller == nil { - obj.marshaller = &marshalcontrolState{obj: obj} - } - return obj.marshaller -} - -func (obj *controlState) Unmarshal() unMarshalControlState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalcontrolState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalcontrolState) ToProto() (*otg.ControlState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalcontrolState) FromProto(msg *otg.ControlState) (ControlState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalcontrolState) 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 *unMarshalcontrolState) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalcontrolState) 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 *unMarshalcontrolState) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalcontrolState) 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 *unMarshalcontrolState) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *controlState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *controlState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *controlState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *controlState) Clone() (ControlState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewControlState() - 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 -} - -func (obj *controlState) setNil() { - obj.portHolder = nil - obj.protocolHolder = nil - obj.trafficHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ControlState is request for setting operational state of configured resources. -type ControlState interface { - Validation - // msg marshals ControlState to protobuf object *otg.ControlState - // and doesn't set defaults - msg() *otg.ControlState - // setMsg unmarshals ControlState from protobuf object *otg.ControlState - // and doesn't set defaults - setMsg(*otg.ControlState) ControlState - // provides marshal interface - Marshal() marshalControlState - // provides unmarshal interface - Unmarshal() unMarshalControlState - // validate validates ControlState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ControlState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ControlStateChoiceEnum, set in ControlState - Choice() ControlStateChoiceEnum - // setChoice assigns ControlStateChoiceEnum provided by user to ControlState - setChoice(value ControlStateChoiceEnum) ControlState - // Port returns StatePort, set in ControlState. - // StatePort is states associated with configured ports. - Port() StatePort - // SetPort assigns StatePort provided by user to ControlState. - // StatePort is states associated with configured ports. - SetPort(value StatePort) ControlState - // HasPort checks if Port has been set in ControlState - HasPort() bool - // Protocol returns StateProtocol, set in ControlState. - // StateProtocol is states associated with protocols on configured resources. - Protocol() StateProtocol - // SetProtocol assigns StateProtocol provided by user to ControlState. - // StateProtocol is states associated with protocols on configured resources. - SetProtocol(value StateProtocol) ControlState - // HasProtocol checks if Protocol has been set in ControlState - HasProtocol() bool - // Traffic returns StateTraffic, set in ControlState. - // StateTraffic is states associated with configured flows - Traffic() StateTraffic - // SetTraffic assigns StateTraffic provided by user to ControlState. - // StateTraffic is states associated with configured flows - SetTraffic(value StateTraffic) ControlState - // HasTraffic checks if Traffic has been set in ControlState - HasTraffic() bool - setNil() -} - -type ControlStateChoiceEnum string - -// Enum of Choice on ControlState -var ControlStateChoice = struct { - PORT ControlStateChoiceEnum - PROTOCOL ControlStateChoiceEnum - TRAFFIC ControlStateChoiceEnum -}{ - PORT: ControlStateChoiceEnum("port"), - PROTOCOL: ControlStateChoiceEnum("protocol"), - TRAFFIC: ControlStateChoiceEnum("traffic"), -} - -func (obj *controlState) Choice() ControlStateChoiceEnum { - return ControlStateChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *controlState) setChoice(value ControlStateChoiceEnum) ControlState { - intValue, ok := otg.ControlState_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ControlStateChoiceEnum", string(value))) - return obj - } - enumValue := otg.ControlState_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Traffic = nil - obj.trafficHolder = nil - obj.obj.Protocol = nil - obj.protocolHolder = nil - obj.obj.Port = nil - obj.portHolder = nil - - if value == ControlStateChoice.PORT { - obj.obj.Port = NewStatePort().msg() - } - - if value == ControlStateChoice.PROTOCOL { - obj.obj.Protocol = NewStateProtocol().msg() - } - - if value == ControlStateChoice.TRAFFIC { - obj.obj.Traffic = NewStateTraffic().msg() - } - - return obj -} - -// description is TBD -// Port returns a StatePort -func (obj *controlState) Port() StatePort { - if obj.obj.Port == nil { - obj.setChoice(ControlStateChoice.PORT) - } - if obj.portHolder == nil { - obj.portHolder = &statePort{obj: obj.obj.Port} - } - return obj.portHolder -} - -// description is TBD -// Port returns a StatePort -func (obj *controlState) HasPort() bool { - return obj.obj.Port != nil -} - -// description is TBD -// SetPort sets the StatePort value in the ControlState object -func (obj *controlState) SetPort(value StatePort) ControlState { - obj.setChoice(ControlStateChoice.PORT) - obj.portHolder = nil - obj.obj.Port = value.msg() - - return obj -} - -// description is TBD -// Protocol returns a StateProtocol -func (obj *controlState) Protocol() StateProtocol { - if obj.obj.Protocol == nil { - obj.setChoice(ControlStateChoice.PROTOCOL) - } - if obj.protocolHolder == nil { - obj.protocolHolder = &stateProtocol{obj: obj.obj.Protocol} - } - return obj.protocolHolder -} - -// description is TBD -// Protocol returns a StateProtocol -func (obj *controlState) HasProtocol() bool { - return obj.obj.Protocol != nil -} - -// description is TBD -// SetProtocol sets the StateProtocol value in the ControlState object -func (obj *controlState) SetProtocol(value StateProtocol) ControlState { - obj.setChoice(ControlStateChoice.PROTOCOL) - obj.protocolHolder = nil - obj.obj.Protocol = value.msg() - - return obj -} - -// description is TBD -// Traffic returns a StateTraffic -func (obj *controlState) Traffic() StateTraffic { - if obj.obj.Traffic == nil { - obj.setChoice(ControlStateChoice.TRAFFIC) - } - if obj.trafficHolder == nil { - obj.trafficHolder = &stateTraffic{obj: obj.obj.Traffic} - } - return obj.trafficHolder -} - -// description is TBD -// Traffic returns a StateTraffic -func (obj *controlState) HasTraffic() bool { - return obj.obj.Traffic != nil -} - -// description is TBD -// SetTraffic sets the StateTraffic value in the ControlState object -func (obj *controlState) SetTraffic(value StateTraffic) ControlState { - obj.setChoice(ControlStateChoice.TRAFFIC) - obj.trafficHolder = nil - obj.obj.Traffic = value.msg() - - return obj -} - -func (obj *controlState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ControlState") - } - - if obj.obj.Port != nil { - - obj.Port().validateObj(vObj, set_default) - } - - if obj.obj.Protocol != nil { - - obj.Protocol().validateObj(vObj, set_default) - } - - if obj.obj.Traffic != nil { - - obj.Traffic().validateObj(vObj, set_default) - } - -} - -func (obj *controlState) setDefault() { - var choices_set int = 0 - var choice ControlStateChoiceEnum - - if obj.obj.Port != nil { - choices_set += 1 - choice = ControlStateChoice.PORT - } - - if obj.obj.Protocol != nil { - choices_set += 1 - choice = ControlStateChoice.PROTOCOL - } - - if obj.obj.Traffic != nil { - choices_set += 1 - choice = ControlStateChoice.TRAFFIC - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ControlState") - } - } else { - intVal := otg.ControlState_Choice_Enum_value[string(choice)] - enumValue := otg.ControlState_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** ControlAction ***** -type controlAction struct { - validation - obj *otg.ControlAction - marshaller marshalControlAction - unMarshaller unMarshalControlAction - protocolHolder ActionProtocol -} - -func NewControlAction() ControlAction { - obj := controlAction{obj: &otg.ControlAction{}} - obj.setDefault() - return &obj -} - -func (obj *controlAction) msg() *otg.ControlAction { - return obj.obj -} - -func (obj *controlAction) setMsg(msg *otg.ControlAction) ControlAction { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalcontrolAction struct { - obj *controlAction -} - -type marshalControlAction interface { - // ToProto marshals ControlAction to protobuf object *otg.ControlAction - ToProto() (*otg.ControlAction, error) - // ToPbText marshals ControlAction to protobuf text - ToPbText() (string, error) - // ToYaml marshals ControlAction to YAML text - ToYaml() (string, error) - // ToJson marshals ControlAction to JSON text - ToJson() (string, error) -} - -type unMarshalcontrolAction struct { - obj *controlAction -} - -type unMarshalControlAction interface { - // FromProto unmarshals ControlAction from protobuf object *otg.ControlAction - FromProto(msg *otg.ControlAction) (ControlAction, error) - // FromPbText unmarshals ControlAction from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ControlAction from YAML text - FromYaml(value string) error - // FromJson unmarshals ControlAction from JSON text - FromJson(value string) error -} - -func (obj *controlAction) Marshal() marshalControlAction { - if obj.marshaller == nil { - obj.marshaller = &marshalcontrolAction{obj: obj} - } - return obj.marshaller -} - -func (obj *controlAction) Unmarshal() unMarshalControlAction { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalcontrolAction{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalcontrolAction) ToProto() (*otg.ControlAction, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalcontrolAction) FromProto(msg *otg.ControlAction) (ControlAction, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalcontrolAction) 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 *unMarshalcontrolAction) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalcontrolAction) 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 *unMarshalcontrolAction) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalcontrolAction) 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 *unMarshalcontrolAction) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *controlAction) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *controlAction) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *controlAction) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *controlAction) Clone() (ControlAction, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewControlAction() - 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 -} - -func (obj *controlAction) setNil() { - obj.protocolHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ControlAction is request for triggering action against configured resources. -type ControlAction interface { - Validation - // msg marshals ControlAction to protobuf object *otg.ControlAction - // and doesn't set defaults - msg() *otg.ControlAction - // setMsg unmarshals ControlAction from protobuf object *otg.ControlAction - // and doesn't set defaults - setMsg(*otg.ControlAction) ControlAction - // provides marshal interface - Marshal() marshalControlAction - // provides unmarshal interface - Unmarshal() unMarshalControlAction - // validate validates ControlAction - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ControlAction, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ControlActionChoiceEnum, set in ControlAction - Choice() ControlActionChoiceEnum - // setChoice assigns ControlActionChoiceEnum provided by user to ControlAction - setChoice(value ControlActionChoiceEnum) ControlAction - // Protocol returns ActionProtocol, set in ControlAction. - // ActionProtocol is actions associated with protocols on configured resources. - Protocol() ActionProtocol - // SetProtocol assigns ActionProtocol provided by user to ControlAction. - // ActionProtocol is actions associated with protocols on configured resources. - SetProtocol(value ActionProtocol) ControlAction - // HasProtocol checks if Protocol has been set in ControlAction - HasProtocol() bool - setNil() -} - -type ControlActionChoiceEnum string - -// Enum of Choice on ControlAction -var ControlActionChoice = struct { - PROTOCOL ControlActionChoiceEnum -}{ - PROTOCOL: ControlActionChoiceEnum("protocol"), -} - -func (obj *controlAction) Choice() ControlActionChoiceEnum { - return ControlActionChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *controlAction) setChoice(value ControlActionChoiceEnum) ControlAction { - intValue, ok := otg.ControlAction_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ControlActionChoiceEnum", string(value))) - return obj - } - enumValue := otg.ControlAction_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Protocol = nil - obj.protocolHolder = nil - - if value == ControlActionChoice.PROTOCOL { - obj.obj.Protocol = NewActionProtocol().msg() - } - - return obj -} - -// description is TBD -// Protocol returns a ActionProtocol -func (obj *controlAction) Protocol() ActionProtocol { - if obj.obj.Protocol == nil { - obj.setChoice(ControlActionChoice.PROTOCOL) - } - if obj.protocolHolder == nil { - obj.protocolHolder = &actionProtocol{obj: obj.obj.Protocol} - } - return obj.protocolHolder -} - -// description is TBD -// Protocol returns a ActionProtocol -func (obj *controlAction) HasProtocol() bool { - return obj.obj.Protocol != nil -} - -// description is TBD -// SetProtocol sets the ActionProtocol value in the ControlAction object -func (obj *controlAction) SetProtocol(value ActionProtocol) ControlAction { - obj.setChoice(ControlActionChoice.PROTOCOL) - obj.protocolHolder = nil - obj.obj.Protocol = value.msg() - - return obj -} - -func (obj *controlAction) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ControlAction") - } - - if obj.obj.Protocol != nil { - - obj.Protocol().validateObj(vObj, set_default) - } - -} - -func (obj *controlAction) setDefault() { - var choices_set int = 0 - var choice ControlActionChoiceEnum - - if obj.obj.Protocol != nil { - choices_set += 1 - choice = ControlActionChoice.PROTOCOL - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ControlAction") - } - } else { - intVal := otg.ControlAction_Choice_Enum_value[string(choice)] - enumValue := otg.ControlAction_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** MetricsRequest ***** -type metricsRequest struct { - validation - obj *otg.MetricsRequest - marshaller marshalMetricsRequest - unMarshaller unMarshalMetricsRequest - portHolder PortMetricsRequest - flowHolder FlowMetricsRequest - bgpv4Holder Bgpv4MetricsRequest - bgpv6Holder Bgpv6MetricsRequest - isisHolder IsisMetricsRequest - lagHolder LagMetricsRequest - lacpHolder LacpMetricsRequest - lldpHolder LldpMetricsRequest - rsvpHolder RsvpMetricsRequest - dhcpv4ClientHolder Dhcpv4ClientMetricsRequest - dhcpv4ServerHolder Dhcpv4ServerMetricsRequest -} - -func NewMetricsRequest() MetricsRequest { - obj := metricsRequest{obj: &otg.MetricsRequest{}} - obj.setDefault() - return &obj -} - -func (obj *metricsRequest) msg() *otg.MetricsRequest { - return obj.obj -} - -func (obj *metricsRequest) setMsg(msg *otg.MetricsRequest) MetricsRequest { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalmetricsRequest struct { - obj *metricsRequest -} - -type marshalMetricsRequest interface { - // ToProto marshals MetricsRequest to protobuf object *otg.MetricsRequest - ToProto() (*otg.MetricsRequest, error) - // ToPbText marshals MetricsRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals MetricsRequest to YAML text - ToYaml() (string, error) - // ToJson marshals MetricsRequest to JSON text - ToJson() (string, error) -} - -type unMarshalmetricsRequest struct { - obj *metricsRequest -} - -type unMarshalMetricsRequest interface { - // FromProto unmarshals MetricsRequest from protobuf object *otg.MetricsRequest - FromProto(msg *otg.MetricsRequest) (MetricsRequest, error) - // FromPbText unmarshals MetricsRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals MetricsRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals MetricsRequest from JSON text - FromJson(value string) error -} - -func (obj *metricsRequest) Marshal() marshalMetricsRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalmetricsRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *metricsRequest) Unmarshal() unMarshalMetricsRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalmetricsRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalmetricsRequest) ToProto() (*otg.MetricsRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalmetricsRequest) FromProto(msg *otg.MetricsRequest) (MetricsRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalmetricsRequest) 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 *unMarshalmetricsRequest) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalmetricsRequest) 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 *unMarshalmetricsRequest) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalmetricsRequest) 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 *unMarshalmetricsRequest) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *metricsRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *metricsRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *metricsRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *metricsRequest) Clone() (MetricsRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewMetricsRequest() - 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 -} - -func (obj *metricsRequest) setNil() { - obj.portHolder = nil - obj.flowHolder = nil - obj.bgpv4Holder = nil - obj.bgpv6Holder = nil - obj.isisHolder = nil - obj.lagHolder = nil - obj.lacpHolder = nil - obj.lldpHolder = nil - obj.rsvpHolder = nil - obj.dhcpv4ClientHolder = nil - obj.dhcpv4ServerHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// MetricsRequest is request to traffic generator for metrics of choice. -type MetricsRequest interface { - Validation - // msg marshals MetricsRequest to protobuf object *otg.MetricsRequest - // and doesn't set defaults - msg() *otg.MetricsRequest - // setMsg unmarshals MetricsRequest from protobuf object *otg.MetricsRequest - // and doesn't set defaults - setMsg(*otg.MetricsRequest) MetricsRequest - // provides marshal interface - Marshal() marshalMetricsRequest - // provides unmarshal interface - Unmarshal() unMarshalMetricsRequest - // validate validates MetricsRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (MetricsRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns MetricsRequestChoiceEnum, set in MetricsRequest - Choice() MetricsRequestChoiceEnum - // setChoice assigns MetricsRequestChoiceEnum provided by user to MetricsRequest - setChoice(value MetricsRequestChoiceEnum) MetricsRequest - // HasChoice checks if Choice has been set in MetricsRequest - HasChoice() bool - // Port returns PortMetricsRequest, set in MetricsRequest. - // PortMetricsRequest is the port result request to the traffic generator - Port() PortMetricsRequest - // SetPort assigns PortMetricsRequest provided by user to MetricsRequest. - // PortMetricsRequest is the port result request to the traffic generator - SetPort(value PortMetricsRequest) MetricsRequest - // HasPort checks if Port has been set in MetricsRequest - HasPort() bool - // Flow returns FlowMetricsRequest, set in MetricsRequest. - // FlowMetricsRequest is the container for a flow metric request. - Flow() FlowMetricsRequest - // SetFlow assigns FlowMetricsRequest provided by user to MetricsRequest. - // FlowMetricsRequest is the container for a flow metric request. - SetFlow(value FlowMetricsRequest) MetricsRequest - // HasFlow checks if Flow has been set in MetricsRequest - HasFlow() bool - // Bgpv4 returns Bgpv4MetricsRequest, set in MetricsRequest. - // Bgpv4MetricsRequest is the request to retrieve BGPv4 per peer metrics/statistics. - Bgpv4() Bgpv4MetricsRequest - // SetBgpv4 assigns Bgpv4MetricsRequest provided by user to MetricsRequest. - // Bgpv4MetricsRequest is the request to retrieve BGPv4 per peer metrics/statistics. - SetBgpv4(value Bgpv4MetricsRequest) MetricsRequest - // HasBgpv4 checks if Bgpv4 has been set in MetricsRequest - HasBgpv4() bool - // Bgpv6 returns Bgpv6MetricsRequest, set in MetricsRequest. - // Bgpv6MetricsRequest is the request to retrieve BGPv6 per peer metrics/statistics. - Bgpv6() Bgpv6MetricsRequest - // SetBgpv6 assigns Bgpv6MetricsRequest provided by user to MetricsRequest. - // Bgpv6MetricsRequest is the request to retrieve BGPv6 per peer metrics/statistics. - SetBgpv6(value Bgpv6MetricsRequest) MetricsRequest - // HasBgpv6 checks if Bgpv6 has been set in MetricsRequest - HasBgpv6() bool - // Isis returns IsisMetricsRequest, set in MetricsRequest. - // IsisMetricsRequest is the request to retrieve ISIS per Router metrics/statistics. - Isis() IsisMetricsRequest - // SetIsis assigns IsisMetricsRequest provided by user to MetricsRequest. - // IsisMetricsRequest is the request to retrieve ISIS per Router metrics/statistics. - SetIsis(value IsisMetricsRequest) MetricsRequest - // HasIsis checks if Isis has been set in MetricsRequest - HasIsis() bool - // Lag returns LagMetricsRequest, set in MetricsRequest. - // LagMetricsRequest is the request to retrieve per LAG metrics/statistics. - Lag() LagMetricsRequest - // SetLag assigns LagMetricsRequest provided by user to MetricsRequest. - // LagMetricsRequest is the request to retrieve per LAG metrics/statistics. - SetLag(value LagMetricsRequest) MetricsRequest - // HasLag checks if Lag has been set in MetricsRequest - HasLag() bool - // Lacp returns LacpMetricsRequest, set in MetricsRequest. - // LacpMetricsRequest is the request to retrieve LACP per LAG member metrics/statistics. - Lacp() LacpMetricsRequest - // SetLacp assigns LacpMetricsRequest provided by user to MetricsRequest. - // LacpMetricsRequest is the request to retrieve LACP per LAG member metrics/statistics. - SetLacp(value LacpMetricsRequest) MetricsRequest - // HasLacp checks if Lacp has been set in MetricsRequest - HasLacp() bool - // Lldp returns LldpMetricsRequest, set in MetricsRequest. - // LldpMetricsRequest is the request to retrieve LLDP per instance metrics/statistics. - Lldp() LldpMetricsRequest - // SetLldp assigns LldpMetricsRequest provided by user to MetricsRequest. - // LldpMetricsRequest is the request to retrieve LLDP per instance metrics/statistics. - SetLldp(value LldpMetricsRequest) MetricsRequest - // HasLldp checks if Lldp has been set in MetricsRequest - HasLldp() bool - // Rsvp returns RsvpMetricsRequest, set in MetricsRequest. - // RsvpMetricsRequest is the request to retrieve RSVP-TE per Router metrics/statistics. - Rsvp() RsvpMetricsRequest - // SetRsvp assigns RsvpMetricsRequest provided by user to MetricsRequest. - // RsvpMetricsRequest is the request to retrieve RSVP-TE per Router metrics/statistics. - SetRsvp(value RsvpMetricsRequest) MetricsRequest - // HasRsvp checks if Rsvp has been set in MetricsRequest - HasRsvp() bool - // Dhcpv4Client returns Dhcpv4ClientMetricsRequest, set in MetricsRequest. - // Dhcpv4ClientMetricsRequest is the request to retrieve DHCPv4 per client metrics/statistics. - Dhcpv4Client() Dhcpv4ClientMetricsRequest - // SetDhcpv4Client assigns Dhcpv4ClientMetricsRequest provided by user to MetricsRequest. - // Dhcpv4ClientMetricsRequest is the request to retrieve DHCPv4 per client metrics/statistics. - SetDhcpv4Client(value Dhcpv4ClientMetricsRequest) MetricsRequest - // HasDhcpv4Client checks if Dhcpv4Client has been set in MetricsRequest - HasDhcpv4Client() bool - // Dhcpv4Server returns Dhcpv4ServerMetricsRequest, set in MetricsRequest. - // Dhcpv4ServerMetricsRequest is the request to retrieve DHCPv4 per Server metrics/statistics. - Dhcpv4Server() Dhcpv4ServerMetricsRequest - // SetDhcpv4Server assigns Dhcpv4ServerMetricsRequest provided by user to MetricsRequest. - // Dhcpv4ServerMetricsRequest is the request to retrieve DHCPv4 per Server metrics/statistics. - SetDhcpv4Server(value Dhcpv4ServerMetricsRequest) MetricsRequest - // HasDhcpv4Server checks if Dhcpv4Server has been set in MetricsRequest - HasDhcpv4Server() bool - setNil() -} - -type MetricsRequestChoiceEnum string - -// Enum of Choice on MetricsRequest -var MetricsRequestChoice = struct { - PORT MetricsRequestChoiceEnum - FLOW MetricsRequestChoiceEnum - BGPV4 MetricsRequestChoiceEnum - BGPV6 MetricsRequestChoiceEnum - ISIS MetricsRequestChoiceEnum - LAG MetricsRequestChoiceEnum - LACP MetricsRequestChoiceEnum - LLDP MetricsRequestChoiceEnum - RSVP MetricsRequestChoiceEnum - DHCPV4_CLIENT MetricsRequestChoiceEnum - DHCPV4_SERVER MetricsRequestChoiceEnum -}{ - PORT: MetricsRequestChoiceEnum("port"), - FLOW: MetricsRequestChoiceEnum("flow"), - BGPV4: MetricsRequestChoiceEnum("bgpv4"), - BGPV6: MetricsRequestChoiceEnum("bgpv6"), - ISIS: MetricsRequestChoiceEnum("isis"), - LAG: MetricsRequestChoiceEnum("lag"), - LACP: MetricsRequestChoiceEnum("lacp"), - LLDP: MetricsRequestChoiceEnum("lldp"), - RSVP: MetricsRequestChoiceEnum("rsvp"), - DHCPV4_CLIENT: MetricsRequestChoiceEnum("dhcpv4_client"), - DHCPV4_SERVER: MetricsRequestChoiceEnum("dhcpv4_server"), -} - -func (obj *metricsRequest) Choice() MetricsRequestChoiceEnum { - return MetricsRequestChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *metricsRequest) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *metricsRequest) setChoice(value MetricsRequestChoiceEnum) MetricsRequest { - intValue, ok := otg.MetricsRequest_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on MetricsRequestChoiceEnum", string(value))) - return obj - } - enumValue := otg.MetricsRequest_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Dhcpv4Server = nil - obj.dhcpv4ServerHolder = nil - obj.obj.Dhcpv4Client = nil - obj.dhcpv4ClientHolder = nil - obj.obj.Rsvp = nil - obj.rsvpHolder = nil - obj.obj.Lldp = nil - obj.lldpHolder = nil - obj.obj.Lacp = nil - obj.lacpHolder = nil - obj.obj.Lag = nil - obj.lagHolder = nil - obj.obj.Isis = nil - obj.isisHolder = nil - obj.obj.Bgpv6 = nil - obj.bgpv6Holder = nil - obj.obj.Bgpv4 = nil - obj.bgpv4Holder = nil - obj.obj.Flow = nil - obj.flowHolder = nil - obj.obj.Port = nil - obj.portHolder = nil - - if value == MetricsRequestChoice.PORT { - obj.obj.Port = NewPortMetricsRequest().msg() - } - - if value == MetricsRequestChoice.FLOW { - obj.obj.Flow = NewFlowMetricsRequest().msg() - } - - if value == MetricsRequestChoice.BGPV4 { - obj.obj.Bgpv4 = NewBgpv4MetricsRequest().msg() - } - - if value == MetricsRequestChoice.BGPV6 { - obj.obj.Bgpv6 = NewBgpv6MetricsRequest().msg() - } - - if value == MetricsRequestChoice.ISIS { - obj.obj.Isis = NewIsisMetricsRequest().msg() - } - - if value == MetricsRequestChoice.LAG { - obj.obj.Lag = NewLagMetricsRequest().msg() - } - - if value == MetricsRequestChoice.LACP { - obj.obj.Lacp = NewLacpMetricsRequest().msg() - } - - if value == MetricsRequestChoice.LLDP { - obj.obj.Lldp = NewLldpMetricsRequest().msg() - } - - if value == MetricsRequestChoice.RSVP { - obj.obj.Rsvp = NewRsvpMetricsRequest().msg() - } - - if value == MetricsRequestChoice.DHCPV4_CLIENT { - obj.obj.Dhcpv4Client = NewDhcpv4ClientMetricsRequest().msg() - } - - if value == MetricsRequestChoice.DHCPV4_SERVER { - obj.obj.Dhcpv4Server = NewDhcpv4ServerMetricsRequest().msg() - } - - return obj -} - -// description is TBD -// Port returns a PortMetricsRequest -func (obj *metricsRequest) Port() PortMetricsRequest { - if obj.obj.Port == nil { - obj.setChoice(MetricsRequestChoice.PORT) - } - if obj.portHolder == nil { - obj.portHolder = &portMetricsRequest{obj: obj.obj.Port} - } - return obj.portHolder -} - -// description is TBD -// Port returns a PortMetricsRequest -func (obj *metricsRequest) HasPort() bool { - return obj.obj.Port != nil -} - -// description is TBD -// SetPort sets the PortMetricsRequest value in the MetricsRequest object -func (obj *metricsRequest) SetPort(value PortMetricsRequest) MetricsRequest { - obj.setChoice(MetricsRequestChoice.PORT) - obj.portHolder = nil - obj.obj.Port = value.msg() - - return obj -} - -// description is TBD -// Flow returns a FlowMetricsRequest -func (obj *metricsRequest) Flow() FlowMetricsRequest { - if obj.obj.Flow == nil { - obj.setChoice(MetricsRequestChoice.FLOW) - } - if obj.flowHolder == nil { - obj.flowHolder = &flowMetricsRequest{obj: obj.obj.Flow} - } - return obj.flowHolder -} - -// description is TBD -// Flow returns a FlowMetricsRequest -func (obj *metricsRequest) HasFlow() bool { - return obj.obj.Flow != nil -} - -// description is TBD -// SetFlow sets the FlowMetricsRequest value in the MetricsRequest object -func (obj *metricsRequest) SetFlow(value FlowMetricsRequest) MetricsRequest { - obj.setChoice(MetricsRequestChoice.FLOW) - obj.flowHolder = nil - obj.obj.Flow = value.msg() - - return obj -} - -// description is TBD -// Bgpv4 returns a Bgpv4MetricsRequest -func (obj *metricsRequest) Bgpv4() Bgpv4MetricsRequest { - if obj.obj.Bgpv4 == nil { - obj.setChoice(MetricsRequestChoice.BGPV4) - } - if obj.bgpv4Holder == nil { - obj.bgpv4Holder = &bgpv4MetricsRequest{obj: obj.obj.Bgpv4} - } - return obj.bgpv4Holder -} - -// description is TBD -// Bgpv4 returns a Bgpv4MetricsRequest -func (obj *metricsRequest) HasBgpv4() bool { - return obj.obj.Bgpv4 != nil -} - -// description is TBD -// SetBgpv4 sets the Bgpv4MetricsRequest value in the MetricsRequest object -func (obj *metricsRequest) SetBgpv4(value Bgpv4MetricsRequest) MetricsRequest { - obj.setChoice(MetricsRequestChoice.BGPV4) - obj.bgpv4Holder = nil - obj.obj.Bgpv4 = value.msg() - - return obj -} - -// description is TBD -// Bgpv6 returns a Bgpv6MetricsRequest -func (obj *metricsRequest) Bgpv6() Bgpv6MetricsRequest { - if obj.obj.Bgpv6 == nil { - obj.setChoice(MetricsRequestChoice.BGPV6) - } - if obj.bgpv6Holder == nil { - obj.bgpv6Holder = &bgpv6MetricsRequest{obj: obj.obj.Bgpv6} - } - return obj.bgpv6Holder -} - -// description is TBD -// Bgpv6 returns a Bgpv6MetricsRequest -func (obj *metricsRequest) HasBgpv6() bool { - return obj.obj.Bgpv6 != nil -} - -// description is TBD -// SetBgpv6 sets the Bgpv6MetricsRequest value in the MetricsRequest object -func (obj *metricsRequest) SetBgpv6(value Bgpv6MetricsRequest) MetricsRequest { - obj.setChoice(MetricsRequestChoice.BGPV6) - obj.bgpv6Holder = nil - obj.obj.Bgpv6 = value.msg() - - return obj -} - -// description is TBD -// Isis returns a IsisMetricsRequest -func (obj *metricsRequest) Isis() IsisMetricsRequest { - if obj.obj.Isis == nil { - obj.setChoice(MetricsRequestChoice.ISIS) - } - if obj.isisHolder == nil { - obj.isisHolder = &isisMetricsRequest{obj: obj.obj.Isis} - } - return obj.isisHolder -} - -// description is TBD -// Isis returns a IsisMetricsRequest -func (obj *metricsRequest) HasIsis() bool { - return obj.obj.Isis != nil -} - -// description is TBD -// SetIsis sets the IsisMetricsRequest value in the MetricsRequest object -func (obj *metricsRequest) SetIsis(value IsisMetricsRequest) MetricsRequest { - obj.setChoice(MetricsRequestChoice.ISIS) - obj.isisHolder = nil - obj.obj.Isis = value.msg() - - return obj -} - -// description is TBD -// Lag returns a LagMetricsRequest -func (obj *metricsRequest) Lag() LagMetricsRequest { - if obj.obj.Lag == nil { - obj.setChoice(MetricsRequestChoice.LAG) - } - if obj.lagHolder == nil { - obj.lagHolder = &lagMetricsRequest{obj: obj.obj.Lag} - } - return obj.lagHolder -} - -// description is TBD -// Lag returns a LagMetricsRequest -func (obj *metricsRequest) HasLag() bool { - return obj.obj.Lag != nil -} - -// description is TBD -// SetLag sets the LagMetricsRequest value in the MetricsRequest object -func (obj *metricsRequest) SetLag(value LagMetricsRequest) MetricsRequest { - obj.setChoice(MetricsRequestChoice.LAG) - obj.lagHolder = nil - obj.obj.Lag = value.msg() - - return obj -} - -// description is TBD -// Lacp returns a LacpMetricsRequest -func (obj *metricsRequest) Lacp() LacpMetricsRequest { - if obj.obj.Lacp == nil { - obj.setChoice(MetricsRequestChoice.LACP) - } - if obj.lacpHolder == nil { - obj.lacpHolder = &lacpMetricsRequest{obj: obj.obj.Lacp} - } - return obj.lacpHolder -} - -// description is TBD -// Lacp returns a LacpMetricsRequest -func (obj *metricsRequest) HasLacp() bool { - return obj.obj.Lacp != nil -} - -// description is TBD -// SetLacp sets the LacpMetricsRequest value in the MetricsRequest object -func (obj *metricsRequest) SetLacp(value LacpMetricsRequest) MetricsRequest { - obj.setChoice(MetricsRequestChoice.LACP) - obj.lacpHolder = nil - obj.obj.Lacp = value.msg() - - return obj -} - -// description is TBD -// Lldp returns a LldpMetricsRequest -func (obj *metricsRequest) Lldp() LldpMetricsRequest { - if obj.obj.Lldp == nil { - obj.setChoice(MetricsRequestChoice.LLDP) - } - if obj.lldpHolder == nil { - obj.lldpHolder = &lldpMetricsRequest{obj: obj.obj.Lldp} - } - return obj.lldpHolder -} - -// description is TBD -// Lldp returns a LldpMetricsRequest -func (obj *metricsRequest) HasLldp() bool { - return obj.obj.Lldp != nil -} - -// description is TBD -// SetLldp sets the LldpMetricsRequest value in the MetricsRequest object -func (obj *metricsRequest) SetLldp(value LldpMetricsRequest) MetricsRequest { - obj.setChoice(MetricsRequestChoice.LLDP) - obj.lldpHolder = nil - obj.obj.Lldp = value.msg() - - return obj -} - -// description is TBD -// Rsvp returns a RsvpMetricsRequest -func (obj *metricsRequest) Rsvp() RsvpMetricsRequest { - if obj.obj.Rsvp == nil { - obj.setChoice(MetricsRequestChoice.RSVP) - } - if obj.rsvpHolder == nil { - obj.rsvpHolder = &rsvpMetricsRequest{obj: obj.obj.Rsvp} - } - return obj.rsvpHolder -} - -// description is TBD -// Rsvp returns a RsvpMetricsRequest -func (obj *metricsRequest) HasRsvp() bool { - return obj.obj.Rsvp != nil -} - -// description is TBD -// SetRsvp sets the RsvpMetricsRequest value in the MetricsRequest object -func (obj *metricsRequest) SetRsvp(value RsvpMetricsRequest) MetricsRequest { - obj.setChoice(MetricsRequestChoice.RSVP) - obj.rsvpHolder = nil - obj.obj.Rsvp = value.msg() - - return obj -} - -// description is TBD -// Dhcpv4Client returns a Dhcpv4ClientMetricsRequest -func (obj *metricsRequest) Dhcpv4Client() Dhcpv4ClientMetricsRequest { - if obj.obj.Dhcpv4Client == nil { - obj.setChoice(MetricsRequestChoice.DHCPV4_CLIENT) - } - if obj.dhcpv4ClientHolder == nil { - obj.dhcpv4ClientHolder = &dhcpv4ClientMetricsRequest{obj: obj.obj.Dhcpv4Client} - } - return obj.dhcpv4ClientHolder -} - -// description is TBD -// Dhcpv4Client returns a Dhcpv4ClientMetricsRequest -func (obj *metricsRequest) HasDhcpv4Client() bool { - return obj.obj.Dhcpv4Client != nil -} - -// description is TBD -// SetDhcpv4Client sets the Dhcpv4ClientMetricsRequest value in the MetricsRequest object -func (obj *metricsRequest) SetDhcpv4Client(value Dhcpv4ClientMetricsRequest) MetricsRequest { - obj.setChoice(MetricsRequestChoice.DHCPV4_CLIENT) - obj.dhcpv4ClientHolder = nil - obj.obj.Dhcpv4Client = value.msg() - - return obj -} - -// description is TBD -// Dhcpv4Server returns a Dhcpv4ServerMetricsRequest -func (obj *metricsRequest) Dhcpv4Server() Dhcpv4ServerMetricsRequest { - if obj.obj.Dhcpv4Server == nil { - obj.setChoice(MetricsRequestChoice.DHCPV4_SERVER) - } - if obj.dhcpv4ServerHolder == nil { - obj.dhcpv4ServerHolder = &dhcpv4ServerMetricsRequest{obj: obj.obj.Dhcpv4Server} - } - return obj.dhcpv4ServerHolder -} - -// description is TBD -// Dhcpv4Server returns a Dhcpv4ServerMetricsRequest -func (obj *metricsRequest) HasDhcpv4Server() bool { - return obj.obj.Dhcpv4Server != nil -} - -// description is TBD -// SetDhcpv4Server sets the Dhcpv4ServerMetricsRequest value in the MetricsRequest object -func (obj *metricsRequest) SetDhcpv4Server(value Dhcpv4ServerMetricsRequest) MetricsRequest { - obj.setChoice(MetricsRequestChoice.DHCPV4_SERVER) - obj.dhcpv4ServerHolder = nil - obj.obj.Dhcpv4Server = value.msg() - - return obj -} - -func (obj *metricsRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Port != nil { - - obj.Port().validateObj(vObj, set_default) - } - - if obj.obj.Flow != nil { - - obj.Flow().validateObj(vObj, set_default) - } - - if obj.obj.Bgpv4 != nil { - - obj.Bgpv4().validateObj(vObj, set_default) - } - - if obj.obj.Bgpv6 != nil { - - obj.Bgpv6().validateObj(vObj, set_default) - } - - if obj.obj.Isis != nil { - - obj.Isis().validateObj(vObj, set_default) - } - - if obj.obj.Lag != nil { - - obj.Lag().validateObj(vObj, set_default) - } - - if obj.obj.Lacp != nil { - - obj.Lacp().validateObj(vObj, set_default) - } - - if obj.obj.Lldp != nil { - - obj.Lldp().validateObj(vObj, set_default) - } - - if obj.obj.Rsvp != nil { - - obj.Rsvp().validateObj(vObj, set_default) - } - - if obj.obj.Dhcpv4Client != nil { - - obj.Dhcpv4Client().validateObj(vObj, set_default) - } - - if obj.obj.Dhcpv4Server != nil { - - obj.Dhcpv4Server().validateObj(vObj, set_default) - } - -} - -func (obj *metricsRequest) setDefault() { - var choices_set int = 0 - var choice MetricsRequestChoiceEnum - - if obj.obj.Port != nil { - choices_set += 1 - choice = MetricsRequestChoice.PORT - } - - if obj.obj.Flow != nil { - choices_set += 1 - choice = MetricsRequestChoice.FLOW - } - - if obj.obj.Bgpv4 != nil { - choices_set += 1 - choice = MetricsRequestChoice.BGPV4 - } - - if obj.obj.Bgpv6 != nil { - choices_set += 1 - choice = MetricsRequestChoice.BGPV6 - } - - if obj.obj.Isis != nil { - choices_set += 1 - choice = MetricsRequestChoice.ISIS - } - - if obj.obj.Lag != nil { - choices_set += 1 - choice = MetricsRequestChoice.LAG - } - - if obj.obj.Lacp != nil { - choices_set += 1 - choice = MetricsRequestChoice.LACP - } - - if obj.obj.Lldp != nil { - choices_set += 1 - choice = MetricsRequestChoice.LLDP - } - - if obj.obj.Rsvp != nil { - choices_set += 1 - choice = MetricsRequestChoice.RSVP - } - - if obj.obj.Dhcpv4Client != nil { - choices_set += 1 - choice = MetricsRequestChoice.DHCPV4_CLIENT - } - - if obj.obj.Dhcpv4Server != nil { - choices_set += 1 - choice = MetricsRequestChoice.DHCPV4_SERVER - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(MetricsRequestChoice.PORT) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in MetricsRequest") - } - } else { - intVal := otg.MetricsRequest_Choice_Enum_value[string(choice)] - enumValue := otg.MetricsRequest_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** StatesRequest ***** -type statesRequest struct { - validation - obj *otg.StatesRequest - marshaller marshalStatesRequest - unMarshaller unMarshalStatesRequest - ipv4NeighborsHolder Neighborsv4StatesRequest - ipv6NeighborsHolder Neighborsv6StatesRequest - bgpPrefixesHolder BgpPrefixStateRequest - isisLspsHolder IsisLspsStateRequest - lldpNeighborsHolder LldpNeighborsStateRequest - rsvpLspsHolder RsvpLspsStateRequest - dhcpv4InterfacesHolder Dhcpv4InterfaceStateRequest - dhcpv4LeasesHolder Dhcpv4LeaseStateRequest -} - -func NewStatesRequest() StatesRequest { - obj := statesRequest{obj: &otg.StatesRequest{}} - obj.setDefault() - return &obj -} - -func (obj *statesRequest) msg() *otg.StatesRequest { - return obj.obj -} - -func (obj *statesRequest) setMsg(msg *otg.StatesRequest) StatesRequest { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstatesRequest struct { - obj *statesRequest -} - -type marshalStatesRequest interface { - // ToProto marshals StatesRequest to protobuf object *otg.StatesRequest - ToProto() (*otg.StatesRequest, error) - // ToPbText marshals StatesRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals StatesRequest to YAML text - ToYaml() (string, error) - // ToJson marshals StatesRequest to JSON text - ToJson() (string, error) -} - -type unMarshalstatesRequest struct { - obj *statesRequest -} - -type unMarshalStatesRequest interface { - // FromProto unmarshals StatesRequest from protobuf object *otg.StatesRequest - FromProto(msg *otg.StatesRequest) (StatesRequest, error) - // FromPbText unmarshals StatesRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StatesRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals StatesRequest from JSON text - FromJson(value string) error -} - -func (obj *statesRequest) Marshal() marshalStatesRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalstatesRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *statesRequest) Unmarshal() unMarshalStatesRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstatesRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstatesRequest) ToProto() (*otg.StatesRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstatesRequest) FromProto(msg *otg.StatesRequest) (StatesRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstatesRequest) 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 *unMarshalstatesRequest) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalstatesRequest) 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 *unMarshalstatesRequest) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalstatesRequest) 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 *unMarshalstatesRequest) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *statesRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *statesRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *statesRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *statesRequest) Clone() (StatesRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStatesRequest() - 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 -} - -func (obj *statesRequest) setNil() { - obj.ipv4NeighborsHolder = nil - obj.ipv6NeighborsHolder = nil - obj.bgpPrefixesHolder = nil - obj.isisLspsHolder = nil - obj.lldpNeighborsHolder = nil - obj.rsvpLspsHolder = nil - obj.dhcpv4InterfacesHolder = nil - obj.dhcpv4LeasesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// StatesRequest is request to traffic generator for states of choice -type StatesRequest interface { - Validation - // msg marshals StatesRequest to protobuf object *otg.StatesRequest - // and doesn't set defaults - msg() *otg.StatesRequest - // setMsg unmarshals StatesRequest from protobuf object *otg.StatesRequest - // and doesn't set defaults - setMsg(*otg.StatesRequest) StatesRequest - // provides marshal interface - Marshal() marshalStatesRequest - // provides unmarshal interface - Unmarshal() unMarshalStatesRequest - // validate validates StatesRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StatesRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns StatesRequestChoiceEnum, set in StatesRequest - Choice() StatesRequestChoiceEnum - // setChoice assigns StatesRequestChoiceEnum provided by user to StatesRequest - setChoice(value StatesRequestChoiceEnum) StatesRequest - // HasChoice checks if Choice has been set in StatesRequest - HasChoice() bool - // Ipv4Neighbors returns Neighborsv4StatesRequest, set in StatesRequest. - // Neighborsv4StatesRequest is the request to retrieve IPv4 Neighbor state (ARP cache entries) of a network interface(s). - Ipv4Neighbors() Neighborsv4StatesRequest - // SetIpv4Neighbors assigns Neighborsv4StatesRequest provided by user to StatesRequest. - // Neighborsv4StatesRequest is the request to retrieve IPv4 Neighbor state (ARP cache entries) of a network interface(s). - SetIpv4Neighbors(value Neighborsv4StatesRequest) StatesRequest - // HasIpv4Neighbors checks if Ipv4Neighbors has been set in StatesRequest - HasIpv4Neighbors() bool - // Ipv6Neighbors returns Neighborsv6StatesRequest, set in StatesRequest. - // Neighborsv6StatesRequest is the request to retrieve IPv6 Neighbor state (NDISC cache entries) of a network interface(s). - Ipv6Neighbors() Neighborsv6StatesRequest - // SetIpv6Neighbors assigns Neighborsv6StatesRequest provided by user to StatesRequest. - // Neighborsv6StatesRequest is the request to retrieve IPv6 Neighbor state (NDISC cache entries) of a network interface(s). - SetIpv6Neighbors(value Neighborsv6StatesRequest) StatesRequest - // HasIpv6Neighbors checks if Ipv6Neighbors has been set in StatesRequest - HasIpv6Neighbors() bool - // BgpPrefixes returns BgpPrefixStateRequest, set in StatesRequest. - // BgpPrefixStateRequest is the request to retrieve BGP peer prefix information. - BgpPrefixes() BgpPrefixStateRequest - // SetBgpPrefixes assigns BgpPrefixStateRequest provided by user to StatesRequest. - // BgpPrefixStateRequest is the request to retrieve BGP peer prefix information. - SetBgpPrefixes(value BgpPrefixStateRequest) StatesRequest - // HasBgpPrefixes checks if BgpPrefixes has been set in StatesRequest - HasBgpPrefixes() bool - // IsisLsps returns IsisLspsStateRequest, set in StatesRequest. - // IsisLspsStateRequest is the request to retrieve ISIS Link State PDU (LSP) information learned by the router. - IsisLsps() IsisLspsStateRequest - // SetIsisLsps assigns IsisLspsStateRequest provided by user to StatesRequest. - // IsisLspsStateRequest is the request to retrieve ISIS Link State PDU (LSP) information learned by the router. - SetIsisLsps(value IsisLspsStateRequest) StatesRequest - // HasIsisLsps checks if IsisLsps has been set in StatesRequest - HasIsisLsps() bool - // LldpNeighbors returns LldpNeighborsStateRequest, set in StatesRequest. - // LldpNeighborsStateRequest is the request to retrieve LLDP neighbor information for a given instance. - LldpNeighbors() LldpNeighborsStateRequest - // SetLldpNeighbors assigns LldpNeighborsStateRequest provided by user to StatesRequest. - // LldpNeighborsStateRequest is the request to retrieve LLDP neighbor information for a given instance. - SetLldpNeighbors(value LldpNeighborsStateRequest) StatesRequest - // HasLldpNeighbors checks if LldpNeighbors has been set in StatesRequest - HasLldpNeighbors() bool - // RsvpLsps returns RsvpLspsStateRequest, set in StatesRequest. - // RsvpLspsStateRequest is the request to retrieve RSVP Label Switched Path (LSP) information learned by the router. - RsvpLsps() RsvpLspsStateRequest - // SetRsvpLsps assigns RsvpLspsStateRequest provided by user to StatesRequest. - // RsvpLspsStateRequest is the request to retrieve RSVP Label Switched Path (LSP) information learned by the router. - SetRsvpLsps(value RsvpLspsStateRequest) StatesRequest - // HasRsvpLsps checks if RsvpLsps has been set in StatesRequest - HasRsvpLsps() bool - // Dhcpv4Interfaces returns Dhcpv4InterfaceStateRequest, set in StatesRequest. - // Dhcpv4InterfaceStateRequest is the request for assigned IPv4 address information associated with DHCP Client sessions. - Dhcpv4Interfaces() Dhcpv4InterfaceStateRequest - // SetDhcpv4Interfaces assigns Dhcpv4InterfaceStateRequest provided by user to StatesRequest. - // Dhcpv4InterfaceStateRequest is the request for assigned IPv4 address information associated with DHCP Client sessions. - SetDhcpv4Interfaces(value Dhcpv4InterfaceStateRequest) StatesRequest - // HasDhcpv4Interfaces checks if Dhcpv4Interfaces has been set in StatesRequest - HasDhcpv4Interfaces() bool - // Dhcpv4Leases returns Dhcpv4LeaseStateRequest, set in StatesRequest. - // Dhcpv4LeaseStateRequest is the request to retrieve DHCP Server host allocated status. - Dhcpv4Leases() Dhcpv4LeaseStateRequest - // SetDhcpv4Leases assigns Dhcpv4LeaseStateRequest provided by user to StatesRequest. - // Dhcpv4LeaseStateRequest is the request to retrieve DHCP Server host allocated status. - SetDhcpv4Leases(value Dhcpv4LeaseStateRequest) StatesRequest - // HasDhcpv4Leases checks if Dhcpv4Leases has been set in StatesRequest - HasDhcpv4Leases() bool - setNil() -} - -type StatesRequestChoiceEnum string - -// Enum of Choice on StatesRequest -var StatesRequestChoice = struct { - IPV4_NEIGHBORS StatesRequestChoiceEnum - IPV6_NEIGHBORS StatesRequestChoiceEnum - BGP_PREFIXES StatesRequestChoiceEnum - ISIS_LSPS StatesRequestChoiceEnum - LLDP_NEIGHBORS StatesRequestChoiceEnum - RSVP_LSPS StatesRequestChoiceEnum - DHCPV4_INTERFACES StatesRequestChoiceEnum - DHCPV4_LEASES StatesRequestChoiceEnum -}{ - IPV4_NEIGHBORS: StatesRequestChoiceEnum("ipv4_neighbors"), - IPV6_NEIGHBORS: StatesRequestChoiceEnum("ipv6_neighbors"), - BGP_PREFIXES: StatesRequestChoiceEnum("bgp_prefixes"), - ISIS_LSPS: StatesRequestChoiceEnum("isis_lsps"), - LLDP_NEIGHBORS: StatesRequestChoiceEnum("lldp_neighbors"), - RSVP_LSPS: StatesRequestChoiceEnum("rsvp_lsps"), - DHCPV4_INTERFACES: StatesRequestChoiceEnum("dhcpv4_interfaces"), - DHCPV4_LEASES: StatesRequestChoiceEnum("dhcpv4_leases"), -} - -func (obj *statesRequest) Choice() StatesRequestChoiceEnum { - return StatesRequestChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *statesRequest) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *statesRequest) setChoice(value StatesRequestChoiceEnum) StatesRequest { - intValue, ok := otg.StatesRequest_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StatesRequestChoiceEnum", string(value))) - return obj - } - enumValue := otg.StatesRequest_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Dhcpv4Leases = nil - obj.dhcpv4LeasesHolder = nil - obj.obj.Dhcpv4Interfaces = nil - obj.dhcpv4InterfacesHolder = nil - obj.obj.RsvpLsps = nil - obj.rsvpLspsHolder = nil - obj.obj.LldpNeighbors = nil - obj.lldpNeighborsHolder = nil - obj.obj.IsisLsps = nil - obj.isisLspsHolder = nil - obj.obj.BgpPrefixes = nil - obj.bgpPrefixesHolder = nil - obj.obj.Ipv6Neighbors = nil - obj.ipv6NeighborsHolder = nil - obj.obj.Ipv4Neighbors = nil - obj.ipv4NeighborsHolder = nil - - if value == StatesRequestChoice.IPV4_NEIGHBORS { - obj.obj.Ipv4Neighbors = NewNeighborsv4StatesRequest().msg() - } - - if value == StatesRequestChoice.IPV6_NEIGHBORS { - obj.obj.Ipv6Neighbors = NewNeighborsv6StatesRequest().msg() - } - - if value == StatesRequestChoice.BGP_PREFIXES { - obj.obj.BgpPrefixes = NewBgpPrefixStateRequest().msg() - } - - if value == StatesRequestChoice.ISIS_LSPS { - obj.obj.IsisLsps = NewIsisLspsStateRequest().msg() - } - - if value == StatesRequestChoice.LLDP_NEIGHBORS { - obj.obj.LldpNeighbors = NewLldpNeighborsStateRequest().msg() - } - - if value == StatesRequestChoice.RSVP_LSPS { - obj.obj.RsvpLsps = NewRsvpLspsStateRequest().msg() - } - - if value == StatesRequestChoice.DHCPV4_INTERFACES { - obj.obj.Dhcpv4Interfaces = NewDhcpv4InterfaceStateRequest().msg() - } - - if value == StatesRequestChoice.DHCPV4_LEASES { - obj.obj.Dhcpv4Leases = NewDhcpv4LeaseStateRequest().msg() - } - - return obj -} - -// description is TBD -// Ipv4Neighbors returns a Neighborsv4StatesRequest -func (obj *statesRequest) Ipv4Neighbors() Neighborsv4StatesRequest { - if obj.obj.Ipv4Neighbors == nil { - obj.setChoice(StatesRequestChoice.IPV4_NEIGHBORS) - } - if obj.ipv4NeighborsHolder == nil { - obj.ipv4NeighborsHolder = &neighborsv4StatesRequest{obj: obj.obj.Ipv4Neighbors} - } - return obj.ipv4NeighborsHolder -} - -// description is TBD -// Ipv4Neighbors returns a Neighborsv4StatesRequest -func (obj *statesRequest) HasIpv4Neighbors() bool { - return obj.obj.Ipv4Neighbors != nil -} - -// description is TBD -// SetIpv4Neighbors sets the Neighborsv4StatesRequest value in the StatesRequest object -func (obj *statesRequest) SetIpv4Neighbors(value Neighborsv4StatesRequest) StatesRequest { - obj.setChoice(StatesRequestChoice.IPV4_NEIGHBORS) - obj.ipv4NeighborsHolder = nil - obj.obj.Ipv4Neighbors = value.msg() - - return obj -} - -// description is TBD -// Ipv6Neighbors returns a Neighborsv6StatesRequest -func (obj *statesRequest) Ipv6Neighbors() Neighborsv6StatesRequest { - if obj.obj.Ipv6Neighbors == nil { - obj.setChoice(StatesRequestChoice.IPV6_NEIGHBORS) - } - if obj.ipv6NeighborsHolder == nil { - obj.ipv6NeighborsHolder = &neighborsv6StatesRequest{obj: obj.obj.Ipv6Neighbors} - } - return obj.ipv6NeighborsHolder -} - -// description is TBD -// Ipv6Neighbors returns a Neighborsv6StatesRequest -func (obj *statesRequest) HasIpv6Neighbors() bool { - return obj.obj.Ipv6Neighbors != nil -} - -// description is TBD -// SetIpv6Neighbors sets the Neighborsv6StatesRequest value in the StatesRequest object -func (obj *statesRequest) SetIpv6Neighbors(value Neighborsv6StatesRequest) StatesRequest { - obj.setChoice(StatesRequestChoice.IPV6_NEIGHBORS) - obj.ipv6NeighborsHolder = nil - obj.obj.Ipv6Neighbors = value.msg() - - return obj -} - -// description is TBD -// BgpPrefixes returns a BgpPrefixStateRequest -func (obj *statesRequest) BgpPrefixes() BgpPrefixStateRequest { - if obj.obj.BgpPrefixes == nil { - obj.setChoice(StatesRequestChoice.BGP_PREFIXES) - } - if obj.bgpPrefixesHolder == nil { - obj.bgpPrefixesHolder = &bgpPrefixStateRequest{obj: obj.obj.BgpPrefixes} - } - return obj.bgpPrefixesHolder -} - -// description is TBD -// BgpPrefixes returns a BgpPrefixStateRequest -func (obj *statesRequest) HasBgpPrefixes() bool { - return obj.obj.BgpPrefixes != nil -} - -// description is TBD -// SetBgpPrefixes sets the BgpPrefixStateRequest value in the StatesRequest object -func (obj *statesRequest) SetBgpPrefixes(value BgpPrefixStateRequest) StatesRequest { - obj.setChoice(StatesRequestChoice.BGP_PREFIXES) - obj.bgpPrefixesHolder = nil - obj.obj.BgpPrefixes = value.msg() - - return obj -} - -// description is TBD -// IsisLsps returns a IsisLspsStateRequest -func (obj *statesRequest) IsisLsps() IsisLspsStateRequest { - if obj.obj.IsisLsps == nil { - obj.setChoice(StatesRequestChoice.ISIS_LSPS) - } - if obj.isisLspsHolder == nil { - obj.isisLspsHolder = &isisLspsStateRequest{obj: obj.obj.IsisLsps} - } - return obj.isisLspsHolder -} - -// description is TBD -// IsisLsps returns a IsisLspsStateRequest -func (obj *statesRequest) HasIsisLsps() bool { - return obj.obj.IsisLsps != nil -} - -// description is TBD -// SetIsisLsps sets the IsisLspsStateRequest value in the StatesRequest object -func (obj *statesRequest) SetIsisLsps(value IsisLspsStateRequest) StatesRequest { - obj.setChoice(StatesRequestChoice.ISIS_LSPS) - obj.isisLspsHolder = nil - obj.obj.IsisLsps = value.msg() - - return obj -} - -// description is TBD -// LldpNeighbors returns a LldpNeighborsStateRequest -func (obj *statesRequest) LldpNeighbors() LldpNeighborsStateRequest { - if obj.obj.LldpNeighbors == nil { - obj.setChoice(StatesRequestChoice.LLDP_NEIGHBORS) - } - if obj.lldpNeighborsHolder == nil { - obj.lldpNeighborsHolder = &lldpNeighborsStateRequest{obj: obj.obj.LldpNeighbors} - } - return obj.lldpNeighborsHolder -} - -// description is TBD -// LldpNeighbors returns a LldpNeighborsStateRequest -func (obj *statesRequest) HasLldpNeighbors() bool { - return obj.obj.LldpNeighbors != nil -} - -// description is TBD -// SetLldpNeighbors sets the LldpNeighborsStateRequest value in the StatesRequest object -func (obj *statesRequest) SetLldpNeighbors(value LldpNeighborsStateRequest) StatesRequest { - obj.setChoice(StatesRequestChoice.LLDP_NEIGHBORS) - obj.lldpNeighborsHolder = nil - obj.obj.LldpNeighbors = value.msg() - - return obj -} - -// description is TBD -// RsvpLsps returns a RsvpLspsStateRequest -func (obj *statesRequest) RsvpLsps() RsvpLspsStateRequest { - if obj.obj.RsvpLsps == nil { - obj.setChoice(StatesRequestChoice.RSVP_LSPS) - } - if obj.rsvpLspsHolder == nil { - obj.rsvpLspsHolder = &rsvpLspsStateRequest{obj: obj.obj.RsvpLsps} - } - return obj.rsvpLspsHolder -} - -// description is TBD -// RsvpLsps returns a RsvpLspsStateRequest -func (obj *statesRequest) HasRsvpLsps() bool { - return obj.obj.RsvpLsps != nil -} - -// description is TBD -// SetRsvpLsps sets the RsvpLspsStateRequest value in the StatesRequest object -func (obj *statesRequest) SetRsvpLsps(value RsvpLspsStateRequest) StatesRequest { - obj.setChoice(StatesRequestChoice.RSVP_LSPS) - obj.rsvpLspsHolder = nil - obj.obj.RsvpLsps = value.msg() - - return obj -} - -// description is TBD -// Dhcpv4Interfaces returns a Dhcpv4InterfaceStateRequest -func (obj *statesRequest) Dhcpv4Interfaces() Dhcpv4InterfaceStateRequest { - if obj.obj.Dhcpv4Interfaces == nil { - obj.setChoice(StatesRequestChoice.DHCPV4_INTERFACES) - } - if obj.dhcpv4InterfacesHolder == nil { - obj.dhcpv4InterfacesHolder = &dhcpv4InterfaceStateRequest{obj: obj.obj.Dhcpv4Interfaces} - } - return obj.dhcpv4InterfacesHolder -} - -// description is TBD -// Dhcpv4Interfaces returns a Dhcpv4InterfaceStateRequest -func (obj *statesRequest) HasDhcpv4Interfaces() bool { - return obj.obj.Dhcpv4Interfaces != nil -} - -// description is TBD -// SetDhcpv4Interfaces sets the Dhcpv4InterfaceStateRequest value in the StatesRequest object -func (obj *statesRequest) SetDhcpv4Interfaces(value Dhcpv4InterfaceStateRequest) StatesRequest { - obj.setChoice(StatesRequestChoice.DHCPV4_INTERFACES) - obj.dhcpv4InterfacesHolder = nil - obj.obj.Dhcpv4Interfaces = value.msg() - - return obj -} - -// description is TBD -// Dhcpv4Leases returns a Dhcpv4LeaseStateRequest -func (obj *statesRequest) Dhcpv4Leases() Dhcpv4LeaseStateRequest { - if obj.obj.Dhcpv4Leases == nil { - obj.setChoice(StatesRequestChoice.DHCPV4_LEASES) - } - if obj.dhcpv4LeasesHolder == nil { - obj.dhcpv4LeasesHolder = &dhcpv4LeaseStateRequest{obj: obj.obj.Dhcpv4Leases} - } - return obj.dhcpv4LeasesHolder -} - -// description is TBD -// Dhcpv4Leases returns a Dhcpv4LeaseStateRequest -func (obj *statesRequest) HasDhcpv4Leases() bool { - return obj.obj.Dhcpv4Leases != nil -} - -// description is TBD -// SetDhcpv4Leases sets the Dhcpv4LeaseStateRequest value in the StatesRequest object -func (obj *statesRequest) SetDhcpv4Leases(value Dhcpv4LeaseStateRequest) StatesRequest { - obj.setChoice(StatesRequestChoice.DHCPV4_LEASES) - obj.dhcpv4LeasesHolder = nil - obj.obj.Dhcpv4Leases = value.msg() - - return obj -} - -func (obj *statesRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv4Neighbors != nil { - - obj.Ipv4Neighbors().validateObj(vObj, set_default) - } - - if obj.obj.Ipv6Neighbors != nil { - - obj.Ipv6Neighbors().validateObj(vObj, set_default) - } - - if obj.obj.BgpPrefixes != nil { - - obj.BgpPrefixes().validateObj(vObj, set_default) - } - - if obj.obj.IsisLsps != nil { - - obj.IsisLsps().validateObj(vObj, set_default) - } - - if obj.obj.LldpNeighbors != nil { - - obj.LldpNeighbors().validateObj(vObj, set_default) - } - - if obj.obj.RsvpLsps != nil { - - obj.RsvpLsps().validateObj(vObj, set_default) - } - - if obj.obj.Dhcpv4Interfaces != nil { - - obj.Dhcpv4Interfaces().validateObj(vObj, set_default) - } - - if obj.obj.Dhcpv4Leases != nil { - - obj.Dhcpv4Leases().validateObj(vObj, set_default) - } - -} - -func (obj *statesRequest) setDefault() { - var choices_set int = 0 - var choice StatesRequestChoiceEnum - - if obj.obj.Ipv4Neighbors != nil { - choices_set += 1 - choice = StatesRequestChoice.IPV4_NEIGHBORS - } - - if obj.obj.Ipv6Neighbors != nil { - choices_set += 1 - choice = StatesRequestChoice.IPV6_NEIGHBORS - } - - if obj.obj.BgpPrefixes != nil { - choices_set += 1 - choice = StatesRequestChoice.BGP_PREFIXES - } - - if obj.obj.IsisLsps != nil { - choices_set += 1 - choice = StatesRequestChoice.ISIS_LSPS - } - - if obj.obj.LldpNeighbors != nil { - choices_set += 1 - choice = StatesRequestChoice.LLDP_NEIGHBORS - } - - if obj.obj.RsvpLsps != nil { - choices_set += 1 - choice = StatesRequestChoice.RSVP_LSPS - } - - if obj.obj.Dhcpv4Interfaces != nil { - choices_set += 1 - choice = StatesRequestChoice.DHCPV4_INTERFACES - } - - if obj.obj.Dhcpv4Leases != nil { - choices_set += 1 - choice = StatesRequestChoice.DHCPV4_LEASES - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(StatesRequestChoice.IPV4_NEIGHBORS) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StatesRequest") - } - } else { - intVal := otg.StatesRequest_Choice_Enum_value[string(choice)] - enumValue := otg.StatesRequest_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** CaptureRequest ***** -type captureRequest struct { - validation - obj *otg.CaptureRequest - marshaller marshalCaptureRequest - unMarshaller unMarshalCaptureRequest -} - -func NewCaptureRequest() CaptureRequest { - obj := captureRequest{obj: &otg.CaptureRequest{}} - obj.setDefault() - return &obj -} - -func (obj *captureRequest) msg() *otg.CaptureRequest { - return obj.obj -} - -func (obj *captureRequest) setMsg(msg *otg.CaptureRequest) CaptureRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalcaptureRequest struct { - obj *captureRequest -} - -type marshalCaptureRequest interface { - // ToProto marshals CaptureRequest to protobuf object *otg.CaptureRequest - ToProto() (*otg.CaptureRequest, error) - // ToPbText marshals CaptureRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals CaptureRequest to YAML text - ToYaml() (string, error) - // ToJson marshals CaptureRequest to JSON text - ToJson() (string, error) -} - -type unMarshalcaptureRequest struct { - obj *captureRequest -} - -type unMarshalCaptureRequest interface { - // FromProto unmarshals CaptureRequest from protobuf object *otg.CaptureRequest - FromProto(msg *otg.CaptureRequest) (CaptureRequest, error) - // FromPbText unmarshals CaptureRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals CaptureRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals CaptureRequest from JSON text - FromJson(value string) error -} - -func (obj *captureRequest) Marshal() marshalCaptureRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalcaptureRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *captureRequest) Unmarshal() unMarshalCaptureRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalcaptureRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalcaptureRequest) ToProto() (*otg.CaptureRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalcaptureRequest) FromProto(msg *otg.CaptureRequest) (CaptureRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalcaptureRequest) 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 *unMarshalcaptureRequest) 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 *marshalcaptureRequest) 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 *unMarshalcaptureRequest) 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 *marshalcaptureRequest) 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 *unMarshalcaptureRequest) 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 *captureRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *captureRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *captureRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *captureRequest) Clone() (CaptureRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewCaptureRequest() - 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 -} - -// CaptureRequest is the capture result request to the traffic generator. Stops the port capture on the port_name and returns the capture. -type CaptureRequest interface { - Validation - // msg marshals CaptureRequest to protobuf object *otg.CaptureRequest - // and doesn't set defaults - msg() *otg.CaptureRequest - // setMsg unmarshals CaptureRequest from protobuf object *otg.CaptureRequest - // and doesn't set defaults - setMsg(*otg.CaptureRequest) CaptureRequest - // provides marshal interface - Marshal() marshalCaptureRequest - // provides unmarshal interface - Unmarshal() unMarshalCaptureRequest - // validate validates CaptureRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (CaptureRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PortName returns string, set in CaptureRequest. - PortName() string - // SetPortName assigns string provided by user to CaptureRequest - SetPortName(value string) CaptureRequest -} - -// The name of a port a capture is started on. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// PortName returns a string -func (obj *captureRequest) PortName() string { - - return *obj.obj.PortName - -} - -// The name of a port a capture is started on. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// SetPortName sets the string value in the CaptureRequest object -func (obj *captureRequest) SetPortName(value string) CaptureRequest { - - obj.obj.PortName = &value - return obj -} - -func (obj *captureRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // PortName is required - if obj.obj.PortName == nil { - vObj.validationErrors = append(vObj.validationErrors, "PortName is required field on interface CaptureRequest") - } -} - -func (obj *captureRequest) setDefault() { - -} - -// ***** SetConfigResponse ***** -type setConfigResponse struct { - validation - obj *otg.SetConfigResponse - marshaller marshalSetConfigResponse - unMarshaller unMarshalSetConfigResponse - warningHolder Warning -} - -func NewSetConfigResponse() SetConfigResponse { - obj := setConfigResponse{obj: &otg.SetConfigResponse{}} - obj.setDefault() - return &obj -} - -func (obj *setConfigResponse) msg() *otg.SetConfigResponse { - return obj.obj -} - -func (obj *setConfigResponse) setMsg(msg *otg.SetConfigResponse) SetConfigResponse { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalsetConfigResponse struct { - obj *setConfigResponse -} - -type marshalSetConfigResponse interface { - // ToProto marshals SetConfigResponse to protobuf object *otg.SetConfigResponse - ToProto() (*otg.SetConfigResponse, error) - // ToPbText marshals SetConfigResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals SetConfigResponse to YAML text - ToYaml() (string, error) - // ToJson marshals SetConfigResponse to JSON text - ToJson() (string, error) -} - -type unMarshalsetConfigResponse struct { - obj *setConfigResponse -} - -type unMarshalSetConfigResponse interface { - // FromProto unmarshals SetConfigResponse from protobuf object *otg.SetConfigResponse - FromProto(msg *otg.SetConfigResponse) (SetConfigResponse, error) - // FromPbText unmarshals SetConfigResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals SetConfigResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals SetConfigResponse from JSON text - FromJson(value string) error -} - -func (obj *setConfigResponse) Marshal() marshalSetConfigResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalsetConfigResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *setConfigResponse) Unmarshal() unMarshalSetConfigResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalsetConfigResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalsetConfigResponse) ToProto() (*otg.SetConfigResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalsetConfigResponse) FromProto(msg *otg.SetConfigResponse) (SetConfigResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalsetConfigResponse) 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 *unMarshalsetConfigResponse) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalsetConfigResponse) 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 *unMarshalsetConfigResponse) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalsetConfigResponse) 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 *unMarshalsetConfigResponse) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *setConfigResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *setConfigResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *setConfigResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *setConfigResponse) Clone() (SetConfigResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewSetConfigResponse() - 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 -} - -func (obj *setConfigResponse) setNil() { - obj.warningHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// SetConfigResponse is description is TBD -type SetConfigResponse interface { - Validation - // msg marshals SetConfigResponse to protobuf object *otg.SetConfigResponse - // and doesn't set defaults - msg() *otg.SetConfigResponse - // setMsg unmarshals SetConfigResponse from protobuf object *otg.SetConfigResponse - // and doesn't set defaults - setMsg(*otg.SetConfigResponse) SetConfigResponse - // provides marshal interface - Marshal() marshalSetConfigResponse - // provides unmarshal interface - Unmarshal() unMarshalSetConfigResponse - // validate validates SetConfigResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (SetConfigResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Warning returns Warning, set in SetConfigResponse. - // Warning is a list of warnings that have occurred while executing the request. - Warning() Warning - // SetWarning assigns Warning provided by user to SetConfigResponse. - // Warning is a list of warnings that have occurred while executing the request. - SetWarning(value Warning) SetConfigResponse - // HasWarning checks if Warning has been set in SetConfigResponse - HasWarning() bool - setNil() -} - -// description is TBD -// Warning returns a Warning -func (obj *setConfigResponse) Warning() Warning { - if obj.obj.Warning == nil { - obj.obj.Warning = NewWarning().msg() - } - if obj.warningHolder == nil { - obj.warningHolder = &warning{obj: obj.obj.Warning} - } - return obj.warningHolder -} - -// description is TBD -// Warning returns a Warning -func (obj *setConfigResponse) HasWarning() bool { - return obj.obj.Warning != nil -} - -// description is TBD -// SetWarning sets the Warning value in the SetConfigResponse object -func (obj *setConfigResponse) SetWarning(value Warning) SetConfigResponse { - - obj.warningHolder = nil - obj.obj.Warning = value.msg() - - return obj -} - -func (obj *setConfigResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Warning != nil { - - obj.Warning().validateObj(vObj, set_default) - } - -} - -func (obj *setConfigResponse) setDefault() { - -} - -// ***** GetConfigResponse ***** -type getConfigResponse struct { - validation - obj *otg.GetConfigResponse - marshaller marshalGetConfigResponse - unMarshaller unMarshalGetConfigResponse - configHolder Config -} - -func NewGetConfigResponse() GetConfigResponse { - obj := getConfigResponse{obj: &otg.GetConfigResponse{}} - obj.setDefault() - return &obj -} - -func (obj *getConfigResponse) msg() *otg.GetConfigResponse { - return obj.obj -} - -func (obj *getConfigResponse) setMsg(msg *otg.GetConfigResponse) GetConfigResponse { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalgetConfigResponse struct { - obj *getConfigResponse -} - -type marshalGetConfigResponse interface { - // ToProto marshals GetConfigResponse to protobuf object *otg.GetConfigResponse - ToProto() (*otg.GetConfigResponse, error) - // ToPbText marshals GetConfigResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals GetConfigResponse to YAML text - ToYaml() (string, error) - // ToJson marshals GetConfigResponse to JSON text - ToJson() (string, error) -} - -type unMarshalgetConfigResponse struct { - obj *getConfigResponse -} - -type unMarshalGetConfigResponse interface { - // FromProto unmarshals GetConfigResponse from protobuf object *otg.GetConfigResponse - FromProto(msg *otg.GetConfigResponse) (GetConfigResponse, error) - // FromPbText unmarshals GetConfigResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals GetConfigResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals GetConfigResponse from JSON text - FromJson(value string) error -} - -func (obj *getConfigResponse) Marshal() marshalGetConfigResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalgetConfigResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *getConfigResponse) Unmarshal() unMarshalGetConfigResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalgetConfigResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalgetConfigResponse) ToProto() (*otg.GetConfigResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalgetConfigResponse) FromProto(msg *otg.GetConfigResponse) (GetConfigResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalgetConfigResponse) 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 *unMarshalgetConfigResponse) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalgetConfigResponse) 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 *unMarshalgetConfigResponse) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalgetConfigResponse) 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 *unMarshalgetConfigResponse) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *getConfigResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *getConfigResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *getConfigResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *getConfigResponse) Clone() (GetConfigResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewGetConfigResponse() - 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 -} - -func (obj *getConfigResponse) setNil() { - obj.configHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// GetConfigResponse is description is TBD -type GetConfigResponse interface { - Validation - // msg marshals GetConfigResponse to protobuf object *otg.GetConfigResponse - // and doesn't set defaults - msg() *otg.GetConfigResponse - // setMsg unmarshals GetConfigResponse from protobuf object *otg.GetConfigResponse - // and doesn't set defaults - setMsg(*otg.GetConfigResponse) GetConfigResponse - // provides marshal interface - Marshal() marshalGetConfigResponse - // provides unmarshal interface - Unmarshal() unMarshalGetConfigResponse - // validate validates GetConfigResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (GetConfigResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Config returns Config, set in GetConfigResponse. - // Config is a container for all models that are part of the configuration. - Config() Config - // SetConfig assigns Config provided by user to GetConfigResponse. - // Config is a container for all models that are part of the configuration. - SetConfig(value Config) GetConfigResponse - // HasConfig checks if Config has been set in GetConfigResponse - HasConfig() bool - setNil() -} - -// description is TBD -// Config returns a Config -func (obj *getConfigResponse) Config() Config { - if obj.obj.Config == nil { - obj.obj.Config = NewConfig().msg() - } - if obj.configHolder == nil { - obj.configHolder = &config{obj: obj.obj.Config} - } - return obj.configHolder -} - -// description is TBD -// Config returns a Config -func (obj *getConfigResponse) HasConfig() bool { - return obj.obj.Config != nil -} - -// description is TBD -// SetConfig sets the Config value in the GetConfigResponse object -func (obj *getConfigResponse) SetConfig(value Config) GetConfigResponse { - - obj.configHolder = nil - obj.obj.Config = value.msg() - - return obj -} - -func (obj *getConfigResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Config != nil { - - obj.Config().validateObj(vObj, set_default) - } - -} - -func (obj *getConfigResponse) setDefault() { - -} - -// ***** UpdateConfigResponse ***** -type updateConfigResponse struct { - validation - obj *otg.UpdateConfigResponse - marshaller marshalUpdateConfigResponse - unMarshaller unMarshalUpdateConfigResponse - warningHolder Warning -} - -func NewUpdateConfigResponse() UpdateConfigResponse { - obj := updateConfigResponse{obj: &otg.UpdateConfigResponse{}} - obj.setDefault() - return &obj -} - -func (obj *updateConfigResponse) msg() *otg.UpdateConfigResponse { - return obj.obj -} - -func (obj *updateConfigResponse) setMsg(msg *otg.UpdateConfigResponse) UpdateConfigResponse { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalupdateConfigResponse struct { - obj *updateConfigResponse -} - -type marshalUpdateConfigResponse interface { - // ToProto marshals UpdateConfigResponse to protobuf object *otg.UpdateConfigResponse - ToProto() (*otg.UpdateConfigResponse, error) - // ToPbText marshals UpdateConfigResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals UpdateConfigResponse to YAML text - ToYaml() (string, error) - // ToJson marshals UpdateConfigResponse to JSON text - ToJson() (string, error) -} - -type unMarshalupdateConfigResponse struct { - obj *updateConfigResponse -} - -type unMarshalUpdateConfigResponse interface { - // FromProto unmarshals UpdateConfigResponse from protobuf object *otg.UpdateConfigResponse - FromProto(msg *otg.UpdateConfigResponse) (UpdateConfigResponse, error) - // FromPbText unmarshals UpdateConfigResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals UpdateConfigResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals UpdateConfigResponse from JSON text - FromJson(value string) error -} - -func (obj *updateConfigResponse) Marshal() marshalUpdateConfigResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalupdateConfigResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *updateConfigResponse) Unmarshal() unMarshalUpdateConfigResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalupdateConfigResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalupdateConfigResponse) ToProto() (*otg.UpdateConfigResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalupdateConfigResponse) FromProto(msg *otg.UpdateConfigResponse) (UpdateConfigResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalupdateConfigResponse) 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 *unMarshalupdateConfigResponse) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalupdateConfigResponse) 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 *unMarshalupdateConfigResponse) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalupdateConfigResponse) 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 *unMarshalupdateConfigResponse) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *updateConfigResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *updateConfigResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *updateConfigResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *updateConfigResponse) Clone() (UpdateConfigResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewUpdateConfigResponse() - 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 -} - -func (obj *updateConfigResponse) setNil() { - obj.warningHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// UpdateConfigResponse is description is TBD -type UpdateConfigResponse interface { - Validation - // msg marshals UpdateConfigResponse to protobuf object *otg.UpdateConfigResponse - // and doesn't set defaults - msg() *otg.UpdateConfigResponse - // setMsg unmarshals UpdateConfigResponse from protobuf object *otg.UpdateConfigResponse - // and doesn't set defaults - setMsg(*otg.UpdateConfigResponse) UpdateConfigResponse - // provides marshal interface - Marshal() marshalUpdateConfigResponse - // provides unmarshal interface - Unmarshal() unMarshalUpdateConfigResponse - // validate validates UpdateConfigResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (UpdateConfigResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Warning returns Warning, set in UpdateConfigResponse. - // Warning is a list of warnings that have occurred while executing the request. - Warning() Warning - // SetWarning assigns Warning provided by user to UpdateConfigResponse. - // Warning is a list of warnings that have occurred while executing the request. - SetWarning(value Warning) UpdateConfigResponse - // HasWarning checks if Warning has been set in UpdateConfigResponse - HasWarning() bool - setNil() -} - -// description is TBD -// Warning returns a Warning -func (obj *updateConfigResponse) Warning() Warning { - if obj.obj.Warning == nil { - obj.obj.Warning = NewWarning().msg() - } - if obj.warningHolder == nil { - obj.warningHolder = &warning{obj: obj.obj.Warning} - } - return obj.warningHolder -} - -// description is TBD -// Warning returns a Warning -func (obj *updateConfigResponse) HasWarning() bool { - return obj.obj.Warning != nil -} - -// description is TBD -// SetWarning sets the Warning value in the UpdateConfigResponse object -func (obj *updateConfigResponse) SetWarning(value Warning) UpdateConfigResponse { - - obj.warningHolder = nil - obj.obj.Warning = value.msg() - - return obj -} - -func (obj *updateConfigResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Warning != nil { - - obj.Warning().validateObj(vObj, set_default) - } - -} - -func (obj *updateConfigResponse) setDefault() { - -} - -// ***** SetControlStateResponse ***** -type setControlStateResponse struct { - validation - obj *otg.SetControlStateResponse - marshaller marshalSetControlStateResponse - unMarshaller unMarshalSetControlStateResponse - warningHolder Warning -} - -func NewSetControlStateResponse() SetControlStateResponse { - obj := setControlStateResponse{obj: &otg.SetControlStateResponse{}} - obj.setDefault() - return &obj -} - -func (obj *setControlStateResponse) msg() *otg.SetControlStateResponse { - return obj.obj -} - -func (obj *setControlStateResponse) setMsg(msg *otg.SetControlStateResponse) SetControlStateResponse { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalsetControlStateResponse struct { - obj *setControlStateResponse -} - -type marshalSetControlStateResponse interface { - // ToProto marshals SetControlStateResponse to protobuf object *otg.SetControlStateResponse - ToProto() (*otg.SetControlStateResponse, error) - // ToPbText marshals SetControlStateResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals SetControlStateResponse to YAML text - ToYaml() (string, error) - // ToJson marshals SetControlStateResponse to JSON text - ToJson() (string, error) -} - -type unMarshalsetControlStateResponse struct { - obj *setControlStateResponse -} - -type unMarshalSetControlStateResponse interface { - // FromProto unmarshals SetControlStateResponse from protobuf object *otg.SetControlStateResponse - FromProto(msg *otg.SetControlStateResponse) (SetControlStateResponse, error) - // FromPbText unmarshals SetControlStateResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals SetControlStateResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals SetControlStateResponse from JSON text - FromJson(value string) error -} - -func (obj *setControlStateResponse) Marshal() marshalSetControlStateResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalsetControlStateResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *setControlStateResponse) Unmarshal() unMarshalSetControlStateResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalsetControlStateResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalsetControlStateResponse) ToProto() (*otg.SetControlStateResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalsetControlStateResponse) FromProto(msg *otg.SetControlStateResponse) (SetControlStateResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalsetControlStateResponse) 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 *unMarshalsetControlStateResponse) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalsetControlStateResponse) 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 *unMarshalsetControlStateResponse) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalsetControlStateResponse) 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 *unMarshalsetControlStateResponse) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *setControlStateResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *setControlStateResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *setControlStateResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *setControlStateResponse) Clone() (SetControlStateResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewSetControlStateResponse() - 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 -} - -func (obj *setControlStateResponse) setNil() { - obj.warningHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// SetControlStateResponse is description is TBD -type SetControlStateResponse interface { - Validation - // msg marshals SetControlStateResponse to protobuf object *otg.SetControlStateResponse - // and doesn't set defaults - msg() *otg.SetControlStateResponse - // setMsg unmarshals SetControlStateResponse from protobuf object *otg.SetControlStateResponse - // and doesn't set defaults - setMsg(*otg.SetControlStateResponse) SetControlStateResponse - // provides marshal interface - Marshal() marshalSetControlStateResponse - // provides unmarshal interface - Unmarshal() unMarshalSetControlStateResponse - // validate validates SetControlStateResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (SetControlStateResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Warning returns Warning, set in SetControlStateResponse. - // Warning is a list of warnings that have occurred while executing the request. - Warning() Warning - // SetWarning assigns Warning provided by user to SetControlStateResponse. - // Warning is a list of warnings that have occurred while executing the request. - SetWarning(value Warning) SetControlStateResponse - // HasWarning checks if Warning has been set in SetControlStateResponse - HasWarning() bool - setNil() -} - -// description is TBD -// Warning returns a Warning -func (obj *setControlStateResponse) Warning() Warning { - if obj.obj.Warning == nil { - obj.obj.Warning = NewWarning().msg() - } - if obj.warningHolder == nil { - obj.warningHolder = &warning{obj: obj.obj.Warning} - } - return obj.warningHolder -} - -// description is TBD -// Warning returns a Warning -func (obj *setControlStateResponse) HasWarning() bool { - return obj.obj.Warning != nil -} - -// description is TBD -// SetWarning sets the Warning value in the SetControlStateResponse object -func (obj *setControlStateResponse) SetWarning(value Warning) SetControlStateResponse { - - obj.warningHolder = nil - obj.obj.Warning = value.msg() - - return obj -} - -func (obj *setControlStateResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Warning != nil { - - obj.Warning().validateObj(vObj, set_default) - } - -} - -func (obj *setControlStateResponse) setDefault() { - -} - -// ***** SetControlActionResponse ***** -type setControlActionResponse struct { - validation - obj *otg.SetControlActionResponse - marshaller marshalSetControlActionResponse - unMarshaller unMarshalSetControlActionResponse - controlActionResponseHolder ControlActionResponse -} - -func NewSetControlActionResponse() SetControlActionResponse { - obj := setControlActionResponse{obj: &otg.SetControlActionResponse{}} - obj.setDefault() - return &obj -} - -func (obj *setControlActionResponse) msg() *otg.SetControlActionResponse { - return obj.obj -} - -func (obj *setControlActionResponse) setMsg(msg *otg.SetControlActionResponse) SetControlActionResponse { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalsetControlActionResponse struct { - obj *setControlActionResponse -} - -type marshalSetControlActionResponse interface { - // ToProto marshals SetControlActionResponse to protobuf object *otg.SetControlActionResponse - ToProto() (*otg.SetControlActionResponse, error) - // ToPbText marshals SetControlActionResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals SetControlActionResponse to YAML text - ToYaml() (string, error) - // ToJson marshals SetControlActionResponse to JSON text - ToJson() (string, error) -} - -type unMarshalsetControlActionResponse struct { - obj *setControlActionResponse -} - -type unMarshalSetControlActionResponse interface { - // FromProto unmarshals SetControlActionResponse from protobuf object *otg.SetControlActionResponse - FromProto(msg *otg.SetControlActionResponse) (SetControlActionResponse, error) - // FromPbText unmarshals SetControlActionResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals SetControlActionResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals SetControlActionResponse from JSON text - FromJson(value string) error -} - -func (obj *setControlActionResponse) Marshal() marshalSetControlActionResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalsetControlActionResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *setControlActionResponse) Unmarshal() unMarshalSetControlActionResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalsetControlActionResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalsetControlActionResponse) ToProto() (*otg.SetControlActionResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalsetControlActionResponse) FromProto(msg *otg.SetControlActionResponse) (SetControlActionResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalsetControlActionResponse) 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 *unMarshalsetControlActionResponse) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalsetControlActionResponse) 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 *unMarshalsetControlActionResponse) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalsetControlActionResponse) 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 *unMarshalsetControlActionResponse) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *setControlActionResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *setControlActionResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *setControlActionResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *setControlActionResponse) Clone() (SetControlActionResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewSetControlActionResponse() - 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 -} - -func (obj *setControlActionResponse) setNil() { - obj.controlActionResponseHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// SetControlActionResponse is description is TBD -type SetControlActionResponse interface { - Validation - // msg marshals SetControlActionResponse to protobuf object *otg.SetControlActionResponse - // and doesn't set defaults - msg() *otg.SetControlActionResponse - // setMsg unmarshals SetControlActionResponse from protobuf object *otg.SetControlActionResponse - // and doesn't set defaults - setMsg(*otg.SetControlActionResponse) SetControlActionResponse - // provides marshal interface - Marshal() marshalSetControlActionResponse - // provides unmarshal interface - Unmarshal() unMarshalSetControlActionResponse - // validate validates SetControlActionResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (SetControlActionResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ControlActionResponse returns ControlActionResponse, set in SetControlActionResponse. - // ControlActionResponse is response for action triggered against configured resources along with warnings. - ControlActionResponse() ControlActionResponse - // SetControlActionResponse assigns ControlActionResponse provided by user to SetControlActionResponse. - // ControlActionResponse is response for action triggered against configured resources along with warnings. - SetControlActionResponse(value ControlActionResponse) SetControlActionResponse - // HasControlActionResponse checks if ControlActionResponse has been set in SetControlActionResponse - HasControlActionResponse() bool - setNil() -} - -// description is TBD -// ControlActionResponse returns a ControlActionResponse -func (obj *setControlActionResponse) ControlActionResponse() ControlActionResponse { - if obj.obj.ControlActionResponse == nil { - obj.obj.ControlActionResponse = NewControlActionResponse().msg() - } - if obj.controlActionResponseHolder == nil { - obj.controlActionResponseHolder = &controlActionResponse{obj: obj.obj.ControlActionResponse} - } - return obj.controlActionResponseHolder -} - -// description is TBD -// ControlActionResponse returns a ControlActionResponse -func (obj *setControlActionResponse) HasControlActionResponse() bool { - return obj.obj.ControlActionResponse != nil -} - -// description is TBD -// SetControlActionResponse sets the ControlActionResponse value in the SetControlActionResponse object -func (obj *setControlActionResponse) SetControlActionResponse(value ControlActionResponse) SetControlActionResponse { - - obj.controlActionResponseHolder = nil - obj.obj.ControlActionResponse = value.msg() - - return obj -} - -func (obj *setControlActionResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.ControlActionResponse != nil { - - obj.ControlActionResponse().validateObj(vObj, set_default) - } - -} - -func (obj *setControlActionResponse) setDefault() { - -} - -// ***** GetMetricsResponse ***** -type getMetricsResponse struct { - validation - obj *otg.GetMetricsResponse - marshaller marshalGetMetricsResponse - unMarshaller unMarshalGetMetricsResponse - metricsResponseHolder MetricsResponse -} - -func NewGetMetricsResponse() GetMetricsResponse { - obj := getMetricsResponse{obj: &otg.GetMetricsResponse{}} - obj.setDefault() - return &obj -} - -func (obj *getMetricsResponse) msg() *otg.GetMetricsResponse { - return obj.obj -} - -func (obj *getMetricsResponse) setMsg(msg *otg.GetMetricsResponse) GetMetricsResponse { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalgetMetricsResponse struct { - obj *getMetricsResponse -} - -type marshalGetMetricsResponse interface { - // ToProto marshals GetMetricsResponse to protobuf object *otg.GetMetricsResponse - ToProto() (*otg.GetMetricsResponse, error) - // ToPbText marshals GetMetricsResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals GetMetricsResponse to YAML text - ToYaml() (string, error) - // ToJson marshals GetMetricsResponse to JSON text - ToJson() (string, error) -} - -type unMarshalgetMetricsResponse struct { - obj *getMetricsResponse -} - -type unMarshalGetMetricsResponse interface { - // FromProto unmarshals GetMetricsResponse from protobuf object *otg.GetMetricsResponse - FromProto(msg *otg.GetMetricsResponse) (GetMetricsResponse, error) - // FromPbText unmarshals GetMetricsResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals GetMetricsResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals GetMetricsResponse from JSON text - FromJson(value string) error -} - -func (obj *getMetricsResponse) Marshal() marshalGetMetricsResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalgetMetricsResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *getMetricsResponse) Unmarshal() unMarshalGetMetricsResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalgetMetricsResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalgetMetricsResponse) ToProto() (*otg.GetMetricsResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalgetMetricsResponse) FromProto(msg *otg.GetMetricsResponse) (GetMetricsResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalgetMetricsResponse) 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 *unMarshalgetMetricsResponse) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalgetMetricsResponse) 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 *unMarshalgetMetricsResponse) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalgetMetricsResponse) 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 *unMarshalgetMetricsResponse) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *getMetricsResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *getMetricsResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *getMetricsResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *getMetricsResponse) Clone() (GetMetricsResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewGetMetricsResponse() - 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 -} - -func (obj *getMetricsResponse) setNil() { - obj.metricsResponseHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// GetMetricsResponse is description is TBD -type GetMetricsResponse interface { - Validation - // msg marshals GetMetricsResponse to protobuf object *otg.GetMetricsResponse - // and doesn't set defaults - msg() *otg.GetMetricsResponse - // setMsg unmarshals GetMetricsResponse from protobuf object *otg.GetMetricsResponse - // and doesn't set defaults - setMsg(*otg.GetMetricsResponse) GetMetricsResponse - // provides marshal interface - Marshal() marshalGetMetricsResponse - // provides unmarshal interface - Unmarshal() unMarshalGetMetricsResponse - // validate validates GetMetricsResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (GetMetricsResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // MetricsResponse returns MetricsResponse, set in GetMetricsResponse. - // MetricsResponse is response containing chosen traffic generator metrics. - MetricsResponse() MetricsResponse - // SetMetricsResponse assigns MetricsResponse provided by user to GetMetricsResponse. - // MetricsResponse is response containing chosen traffic generator metrics. - SetMetricsResponse(value MetricsResponse) GetMetricsResponse - // HasMetricsResponse checks if MetricsResponse has been set in GetMetricsResponse - HasMetricsResponse() bool - setNil() -} - -// description is TBD -// MetricsResponse returns a MetricsResponse -func (obj *getMetricsResponse) MetricsResponse() MetricsResponse { - if obj.obj.MetricsResponse == nil { - obj.obj.MetricsResponse = NewMetricsResponse().msg() - } - if obj.metricsResponseHolder == nil { - obj.metricsResponseHolder = &metricsResponse{obj: obj.obj.MetricsResponse} - } - return obj.metricsResponseHolder -} - -// description is TBD -// MetricsResponse returns a MetricsResponse -func (obj *getMetricsResponse) HasMetricsResponse() bool { - return obj.obj.MetricsResponse != nil -} - -// description is TBD -// SetMetricsResponse sets the MetricsResponse value in the GetMetricsResponse object -func (obj *getMetricsResponse) SetMetricsResponse(value MetricsResponse) GetMetricsResponse { - - obj.metricsResponseHolder = nil - obj.obj.MetricsResponse = value.msg() - - return obj -} - -func (obj *getMetricsResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.MetricsResponse != nil { - - obj.MetricsResponse().validateObj(vObj, set_default) - } - -} - -func (obj *getMetricsResponse) setDefault() { - -} - -// ***** GetStatesResponse ***** -type getStatesResponse struct { - validation - obj *otg.GetStatesResponse - marshaller marshalGetStatesResponse - unMarshaller unMarshalGetStatesResponse - statesResponseHolder StatesResponse -} - -func NewGetStatesResponse() GetStatesResponse { - obj := getStatesResponse{obj: &otg.GetStatesResponse{}} - obj.setDefault() - return &obj -} - -func (obj *getStatesResponse) msg() *otg.GetStatesResponse { - return obj.obj -} - -func (obj *getStatesResponse) setMsg(msg *otg.GetStatesResponse) GetStatesResponse { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalgetStatesResponse struct { - obj *getStatesResponse -} - -type marshalGetStatesResponse interface { - // ToProto marshals GetStatesResponse to protobuf object *otg.GetStatesResponse - ToProto() (*otg.GetStatesResponse, error) - // ToPbText marshals GetStatesResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals GetStatesResponse to YAML text - ToYaml() (string, error) - // ToJson marshals GetStatesResponse to JSON text - ToJson() (string, error) -} - -type unMarshalgetStatesResponse struct { - obj *getStatesResponse -} - -type unMarshalGetStatesResponse interface { - // FromProto unmarshals GetStatesResponse from protobuf object *otg.GetStatesResponse - FromProto(msg *otg.GetStatesResponse) (GetStatesResponse, error) - // FromPbText unmarshals GetStatesResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals GetStatesResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals GetStatesResponse from JSON text - FromJson(value string) error -} - -func (obj *getStatesResponse) Marshal() marshalGetStatesResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalgetStatesResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *getStatesResponse) Unmarshal() unMarshalGetStatesResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalgetStatesResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalgetStatesResponse) ToProto() (*otg.GetStatesResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalgetStatesResponse) FromProto(msg *otg.GetStatesResponse) (GetStatesResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalgetStatesResponse) 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 *unMarshalgetStatesResponse) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalgetStatesResponse) 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 *unMarshalgetStatesResponse) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalgetStatesResponse) 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 *unMarshalgetStatesResponse) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *getStatesResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *getStatesResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *getStatesResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *getStatesResponse) Clone() (GetStatesResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewGetStatesResponse() - 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 -} - -func (obj *getStatesResponse) setNil() { - obj.statesResponseHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// GetStatesResponse is description is TBD -type GetStatesResponse interface { - Validation - // msg marshals GetStatesResponse to protobuf object *otg.GetStatesResponse - // and doesn't set defaults - msg() *otg.GetStatesResponse - // setMsg unmarshals GetStatesResponse from protobuf object *otg.GetStatesResponse - // and doesn't set defaults - setMsg(*otg.GetStatesResponse) GetStatesResponse - // provides marshal interface - Marshal() marshalGetStatesResponse - // provides unmarshal interface - Unmarshal() unMarshalGetStatesResponse - // validate validates GetStatesResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (GetStatesResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // StatesResponse returns StatesResponse, set in GetStatesResponse. - // StatesResponse is response containing chosen traffic generator states - StatesResponse() StatesResponse - // SetStatesResponse assigns StatesResponse provided by user to GetStatesResponse. - // StatesResponse is response containing chosen traffic generator states - SetStatesResponse(value StatesResponse) GetStatesResponse - // HasStatesResponse checks if StatesResponse has been set in GetStatesResponse - HasStatesResponse() bool - setNil() -} - -// description is TBD -// StatesResponse returns a StatesResponse -func (obj *getStatesResponse) StatesResponse() StatesResponse { - if obj.obj.StatesResponse == nil { - obj.obj.StatesResponse = NewStatesResponse().msg() - } - if obj.statesResponseHolder == nil { - obj.statesResponseHolder = &statesResponse{obj: obj.obj.StatesResponse} - } - return obj.statesResponseHolder -} - -// description is TBD -// StatesResponse returns a StatesResponse -func (obj *getStatesResponse) HasStatesResponse() bool { - return obj.obj.StatesResponse != nil -} - -// description is TBD -// SetStatesResponse sets the StatesResponse value in the GetStatesResponse object -func (obj *getStatesResponse) SetStatesResponse(value StatesResponse) GetStatesResponse { - - obj.statesResponseHolder = nil - obj.obj.StatesResponse = value.msg() - - return obj -} - -func (obj *getStatesResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.StatesResponse != nil { - - obj.StatesResponse().validateObj(vObj, set_default) - } - -} - -func (obj *getStatesResponse) setDefault() { - -} - -// ***** GetCaptureResponse ***** -type getCaptureResponse struct { - validation - obj *otg.GetCaptureResponse - marshaller marshalGetCaptureResponse - unMarshaller unMarshalGetCaptureResponse -} - -func NewGetCaptureResponse() GetCaptureResponse { - obj := getCaptureResponse{obj: &otg.GetCaptureResponse{}} - obj.setDefault() - return &obj -} - -func (obj *getCaptureResponse) msg() *otg.GetCaptureResponse { - return obj.obj -} - -func (obj *getCaptureResponse) setMsg(msg *otg.GetCaptureResponse) GetCaptureResponse { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalgetCaptureResponse struct { - obj *getCaptureResponse -} - -type marshalGetCaptureResponse interface { - // ToProto marshals GetCaptureResponse to protobuf object *otg.GetCaptureResponse - ToProto() (*otg.GetCaptureResponse, error) - // ToPbText marshals GetCaptureResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals GetCaptureResponse to YAML text - ToYaml() (string, error) - // ToJson marshals GetCaptureResponse to JSON text - ToJson() (string, error) -} - -type unMarshalgetCaptureResponse struct { - obj *getCaptureResponse -} - -type unMarshalGetCaptureResponse interface { - // FromProto unmarshals GetCaptureResponse from protobuf object *otg.GetCaptureResponse - FromProto(msg *otg.GetCaptureResponse) (GetCaptureResponse, error) - // FromPbText unmarshals GetCaptureResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals GetCaptureResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals GetCaptureResponse from JSON text - FromJson(value string) error -} - -func (obj *getCaptureResponse) Marshal() marshalGetCaptureResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalgetCaptureResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *getCaptureResponse) Unmarshal() unMarshalGetCaptureResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalgetCaptureResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalgetCaptureResponse) ToProto() (*otg.GetCaptureResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalgetCaptureResponse) FromProto(msg *otg.GetCaptureResponse) (GetCaptureResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalgetCaptureResponse) 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 *unMarshalgetCaptureResponse) 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 *marshalgetCaptureResponse) 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 *unMarshalgetCaptureResponse) 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 *marshalgetCaptureResponse) 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 *unMarshalgetCaptureResponse) 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 *getCaptureResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *getCaptureResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *getCaptureResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *getCaptureResponse) Clone() (GetCaptureResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewGetCaptureResponse() - 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 -} - -// GetCaptureResponse is description is TBD -type GetCaptureResponse interface { - Validation - // msg marshals GetCaptureResponse to protobuf object *otg.GetCaptureResponse - // and doesn't set defaults - msg() *otg.GetCaptureResponse - // setMsg unmarshals GetCaptureResponse from protobuf object *otg.GetCaptureResponse - // and doesn't set defaults - setMsg(*otg.GetCaptureResponse) GetCaptureResponse - // provides marshal interface - Marshal() marshalGetCaptureResponse - // provides unmarshal interface - Unmarshal() unMarshalGetCaptureResponse - // validate validates GetCaptureResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (GetCaptureResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ResponseBytes returns []byte, set in GetCaptureResponse. - ResponseBytes() []byte - // SetResponseBytes assigns []byte provided by user to GetCaptureResponse - SetResponseBytes(value []byte) GetCaptureResponse - // HasResponseBytes checks if ResponseBytes has been set in GetCaptureResponse - HasResponseBytes() bool -} - -// description is TBD -// ResponseBytes returns a []byte -func (obj *getCaptureResponse) ResponseBytes() []byte { - - return obj.obj.ResponseBytes -} - -// description is TBD -// ResponseBytes returns a []byte -func (obj *getCaptureResponse) HasResponseBytes() bool { - return obj.obj.ResponseBytes != nil -} - -// description is TBD -// SetResponseBytes sets the []byte value in the GetCaptureResponse object -func (obj *getCaptureResponse) SetResponseBytes(value []byte) GetCaptureResponse { - - obj.obj.ResponseBytes = value - return obj -} - -func (obj *getCaptureResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *getCaptureResponse) setDefault() { - -} - -// ***** GetVersionResponse ***** -type getVersionResponse struct { - validation - obj *otg.GetVersionResponse - marshaller marshalGetVersionResponse - unMarshaller unMarshalGetVersionResponse - versionHolder Version -} - -func NewGetVersionResponse() GetVersionResponse { - obj := getVersionResponse{obj: &otg.GetVersionResponse{}} - obj.setDefault() - return &obj -} - -func (obj *getVersionResponse) msg() *otg.GetVersionResponse { - return obj.obj -} - -func (obj *getVersionResponse) setMsg(msg *otg.GetVersionResponse) GetVersionResponse { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalgetVersionResponse struct { - obj *getVersionResponse -} - -type marshalGetVersionResponse interface { - // ToProto marshals GetVersionResponse to protobuf object *otg.GetVersionResponse - ToProto() (*otg.GetVersionResponse, error) - // ToPbText marshals GetVersionResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals GetVersionResponse to YAML text - ToYaml() (string, error) - // ToJson marshals GetVersionResponse to JSON text - ToJson() (string, error) -} - -type unMarshalgetVersionResponse struct { - obj *getVersionResponse -} - -type unMarshalGetVersionResponse interface { - // FromProto unmarshals GetVersionResponse from protobuf object *otg.GetVersionResponse - FromProto(msg *otg.GetVersionResponse) (GetVersionResponse, error) - // FromPbText unmarshals GetVersionResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals GetVersionResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals GetVersionResponse from JSON text - FromJson(value string) error -} - -func (obj *getVersionResponse) Marshal() marshalGetVersionResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalgetVersionResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *getVersionResponse) Unmarshal() unMarshalGetVersionResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalgetVersionResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalgetVersionResponse) ToProto() (*otg.GetVersionResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalgetVersionResponse) FromProto(msg *otg.GetVersionResponse) (GetVersionResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalgetVersionResponse) 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 *unMarshalgetVersionResponse) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalgetVersionResponse) 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 *unMarshalgetVersionResponse) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalgetVersionResponse) 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 *unMarshalgetVersionResponse) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *getVersionResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *getVersionResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *getVersionResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *getVersionResponse) Clone() (GetVersionResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewGetVersionResponse() - 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 -} - -func (obj *getVersionResponse) setNil() { - obj.versionHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// GetVersionResponse is description is TBD -type GetVersionResponse interface { - Validation - // msg marshals GetVersionResponse to protobuf object *otg.GetVersionResponse - // and doesn't set defaults - msg() *otg.GetVersionResponse - // setMsg unmarshals GetVersionResponse from protobuf object *otg.GetVersionResponse - // and doesn't set defaults - setMsg(*otg.GetVersionResponse) GetVersionResponse - // provides marshal interface - Marshal() marshalGetVersionResponse - // provides unmarshal interface - Unmarshal() unMarshalGetVersionResponse - // validate validates GetVersionResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (GetVersionResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Version returns Version, set in GetVersionResponse. - // Version is version details - Version() Version - // SetVersion assigns Version provided by user to GetVersionResponse. - // Version is version details - SetVersion(value Version) GetVersionResponse - // HasVersion checks if Version has been set in GetVersionResponse - HasVersion() bool - setNil() -} - -// description is TBD -// Version returns a Version -func (obj *getVersionResponse) Version() Version { - if obj.obj.Version == nil { - obj.obj.Version = NewVersion().msg() - } - if obj.versionHolder == nil { - obj.versionHolder = &version{obj: obj.obj.Version} - } - return obj.versionHolder -} - -// description is TBD -// Version returns a Version -func (obj *getVersionResponse) HasVersion() bool { - return obj.obj.Version != nil -} - -// description is TBD -// SetVersion sets the Version value in the GetVersionResponse object -func (obj *getVersionResponse) SetVersion(value Version) GetVersionResponse { - - obj.versionHolder = nil - obj.obj.Version = value.msg() - - return obj -} - -func (obj *getVersionResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Version != nil { - - obj.Version().validateObj(vObj, set_default) - } - -} - -func (obj *getVersionResponse) setDefault() { - -} - -// ***** Port ***** -type port struct { - validation - obj *otg.Port - marshaller marshalPort - unMarshaller unMarshalPort -} - -func NewPort() Port { - obj := port{obj: &otg.Port{}} - obj.setDefault() - return &obj -} - -func (obj *port) msg() *otg.Port { - return obj.obj -} - -func (obj *port) setMsg(msg *otg.Port) Port { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalport struct { - obj *port -} - -type marshalPort interface { - // ToProto marshals Port to protobuf object *otg.Port - ToProto() (*otg.Port, error) - // ToPbText marshals Port to protobuf text - ToPbText() (string, error) - // ToYaml marshals Port to YAML text - ToYaml() (string, error) - // ToJson marshals Port to JSON text - ToJson() (string, error) -} - -type unMarshalport struct { - obj *port -} - -type unMarshalPort interface { - // FromProto unmarshals Port from protobuf object *otg.Port - FromProto(msg *otg.Port) (Port, error) - // FromPbText unmarshals Port from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Port from YAML text - FromYaml(value string) error - // FromJson unmarshals Port from JSON text - FromJson(value string) error -} - -func (obj *port) Marshal() marshalPort { - if obj.marshaller == nil { - obj.marshaller = &marshalport{obj: obj} - } - return obj.marshaller -} - -func (obj *port) Unmarshal() unMarshalPort { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalport{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalport) ToProto() (*otg.Port, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalport) FromProto(msg *otg.Port) (Port, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalport) 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 *unMarshalport) 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 *marshalport) 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 *unMarshalport) 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 *marshalport) 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 *unMarshalport) 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 *port) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *port) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *port) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *port) Clone() (Port, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPort() - 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 -} - -// Port is an abstract test port. -type Port interface { - Validation - // msg marshals Port to protobuf object *otg.Port - // and doesn't set defaults - msg() *otg.Port - // setMsg unmarshals Port from protobuf object *otg.Port - // and doesn't set defaults - setMsg(*otg.Port) Port - // provides marshal interface - Marshal() marshalPort - // provides unmarshal interface - Unmarshal() unMarshalPort - // validate validates Port - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Port, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Location returns string, set in Port. - Location() string - // SetLocation assigns string provided by user to Port - SetLocation(value string) Port - // HasLocation checks if Location has been set in Port - HasLocation() bool - // Name returns string, set in Port. - Name() string - // SetName assigns string provided by user to Port - SetName(value string) Port -} - -// The location of a test port. It is the endpoint where packets will emit from. -// Test port locations can be the following: -// - physical appliance with multiple ports -// - physical chassis with multiple cards and ports -// - local interface -// - virtual machine, docker container, kubernetes cluster -// -// The test port location format is implementation specific. Use the /results/capabilities API to determine what formats an implementation supports for the location property. -// Get the configured location state by using the /results/port API. -// Location returns a string -func (obj *port) Location() string { - - return *obj.obj.Location - -} - -// The location of a test port. It is the endpoint where packets will emit from. -// Test port locations can be the following: -// - physical appliance with multiple ports -// - physical chassis with multiple cards and ports -// - local interface -// - virtual machine, docker container, kubernetes cluster -// -// The test port location format is implementation specific. Use the /results/capabilities API to determine what formats an implementation supports for the location property. -// Get the configured location state by using the /results/port API. -// Location returns a string -func (obj *port) HasLocation() bool { - return obj.obj.Location != nil -} - -// The location of a test port. It is the endpoint where packets will emit from. -// Test port locations can be the following: -// - physical appliance with multiple ports -// - physical chassis with multiple cards and ports -// - local interface -// - virtual machine, docker container, kubernetes cluster -// -// The test port location format is implementation specific. Use the /results/capabilities API to determine what formats an implementation supports for the location property. -// Get the configured location state by using the /results/port API. -// SetLocation sets the string value in the Port object -func (obj *port) SetLocation(value string) Port { - - obj.obj.Location = &value - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *port) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the Port object -func (obj *port) SetName(value string) Port { - - obj.obj.Name = &value - return obj -} - -func (obj *port) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface Port") - } -} - -func (obj *port) setDefault() { - -} - -// ***** Lag ***** -type lag struct { - validation - obj *otg.Lag - marshaller marshalLag - unMarshaller unMarshalLag - portsHolder LagLagPortIter - protocolHolder LagProtocol -} - -func NewLag() Lag { - obj := lag{obj: &otg.Lag{}} - obj.setDefault() - return &obj -} - -func (obj *lag) msg() *otg.Lag { - return obj.obj -} - -func (obj *lag) setMsg(msg *otg.Lag) Lag { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshallag struct { - obj *lag -} - -type marshalLag interface { - // ToProto marshals Lag to protobuf object *otg.Lag - ToProto() (*otg.Lag, error) - // ToPbText marshals Lag to protobuf text - ToPbText() (string, error) - // ToYaml marshals Lag to YAML text - ToYaml() (string, error) - // ToJson marshals Lag to JSON text - ToJson() (string, error) -} - -type unMarshallag struct { - obj *lag -} - -type unMarshalLag interface { - // FromProto unmarshals Lag from protobuf object *otg.Lag - FromProto(msg *otg.Lag) (Lag, error) - // FromPbText unmarshals Lag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Lag from YAML text - FromYaml(value string) error - // FromJson unmarshals Lag from JSON text - FromJson(value string) error -} - -func (obj *lag) Marshal() marshalLag { - if obj.marshaller == nil { - obj.marshaller = &marshallag{obj: obj} - } - return obj.marshaller -} - -func (obj *lag) Unmarshal() unMarshalLag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallag) ToProto() (*otg.Lag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallag) FromProto(msg *otg.Lag) (Lag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallag) 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 *unMarshallag) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshallag) 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 *unMarshallag) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshallag) 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 *unMarshallag) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *lag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lag) Clone() (Lag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLag() - 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 -} - -func (obj *lag) setNil() { - obj.portsHolder = nil - obj.protocolHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// Lag is the container for LAG (ports group) - aggregation of multiple LAG members (ports) -type Lag interface { - Validation - // msg marshals Lag to protobuf object *otg.Lag - // and doesn't set defaults - msg() *otg.Lag - // setMsg unmarshals Lag from protobuf object *otg.Lag - // and doesn't set defaults - setMsg(*otg.Lag) Lag - // provides marshal interface - Marshal() marshalLag - // provides unmarshal interface - Unmarshal() unMarshalLag - // validate validates Lag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Lag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ports returns LagLagPortIterIter, set in Lag - Ports() LagLagPortIter - // Protocol returns LagProtocol, set in Lag. - // LagProtocol is description is TBD - Protocol() LagProtocol - // SetProtocol assigns LagProtocol provided by user to Lag. - // LagProtocol is description is TBD - SetProtocol(value LagProtocol) Lag - // HasProtocol checks if Protocol has been set in Lag - HasProtocol() bool - // MinLinks returns uint32, set in Lag. - MinLinks() uint32 - // SetMinLinks assigns uint32 provided by user to Lag - SetMinLinks(value uint32) Lag - // HasMinLinks checks if MinLinks has been set in Lag - HasMinLinks() bool - // Name returns string, set in Lag. - Name() string - // SetName assigns string provided by user to Lag - SetName(value string) Lag - setNil() -} - -// description is TBD -// Ports returns a []LagPort -func (obj *lag) Ports() LagLagPortIter { - if len(obj.obj.Ports) == 0 { - obj.obj.Ports = []*otg.LagPort{} - } - if obj.portsHolder == nil { - obj.portsHolder = newLagLagPortIter(&obj.obj.Ports).setMsg(obj) - } - return obj.portsHolder -} - -type lagLagPortIter struct { - obj *lag - lagPortSlice []LagPort - fieldPtr *[]*otg.LagPort -} - -func newLagLagPortIter(ptr *[]*otg.LagPort) LagLagPortIter { - return &lagLagPortIter{fieldPtr: ptr} -} - -type LagLagPortIter interface { - setMsg(*lag) LagLagPortIter - Items() []LagPort - Add() LagPort - Append(items ...LagPort) LagLagPortIter - Set(index int, newObj LagPort) LagLagPortIter - Clear() LagLagPortIter - clearHolderSlice() LagLagPortIter - appendHolderSlice(item LagPort) LagLagPortIter -} - -func (obj *lagLagPortIter) setMsg(msg *lag) LagLagPortIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&lagPort{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *lagLagPortIter) Items() []LagPort { - return obj.lagPortSlice -} - -func (obj *lagLagPortIter) Add() LagPort { - newObj := &otg.LagPort{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &lagPort{obj: newObj} - newLibObj.setDefault() - obj.lagPortSlice = append(obj.lagPortSlice, newLibObj) - return newLibObj -} - -func (obj *lagLagPortIter) Append(items ...LagPort) LagLagPortIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.lagPortSlice = append(obj.lagPortSlice, item) - } - return obj -} - -func (obj *lagLagPortIter) Set(index int, newObj LagPort) LagLagPortIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.lagPortSlice[index] = newObj - return obj -} -func (obj *lagLagPortIter) Clear() LagLagPortIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.LagPort{} - obj.lagPortSlice = []LagPort{} - } - return obj -} -func (obj *lagLagPortIter) clearHolderSlice() LagLagPortIter { - if len(obj.lagPortSlice) > 0 { - obj.lagPortSlice = []LagPort{} - } - return obj -} -func (obj *lagLagPortIter) appendHolderSlice(item LagPort) LagLagPortIter { - obj.lagPortSlice = append(obj.lagPortSlice, item) - return obj -} - -// description is TBD -// Protocol returns a LagProtocol -func (obj *lag) Protocol() LagProtocol { - if obj.obj.Protocol == nil { - obj.obj.Protocol = NewLagProtocol().msg() - } - if obj.protocolHolder == nil { - obj.protocolHolder = &lagProtocol{obj: obj.obj.Protocol} - } - return obj.protocolHolder -} - -// description is TBD -// Protocol returns a LagProtocol -func (obj *lag) HasProtocol() bool { - return obj.obj.Protocol != nil -} - -// description is TBD -// SetProtocol sets the LagProtocol value in the Lag object -func (obj *lag) SetProtocol(value LagProtocol) Lag { - - obj.protocolHolder = nil - obj.obj.Protocol = value.msg() - - return obj -} - -// Specifies the mininum number of member interfaces that must be active for the aggregate interface to be available. -// If the aggregate interface is not available due to min-links criterion not being met, LACPDUs continue to be transmitted and received by the member interfaces if LACP is enabled, but other PDUs are not transmitted or received. -// MinLinks returns a uint32 -func (obj *lag) MinLinks() uint32 { - - return *obj.obj.MinLinks - -} - -// Specifies the mininum number of member interfaces that must be active for the aggregate interface to be available. -// If the aggregate interface is not available due to min-links criterion not being met, LACPDUs continue to be transmitted and received by the member interfaces if LACP is enabled, but other PDUs are not transmitted or received. -// MinLinks returns a uint32 -func (obj *lag) HasMinLinks() bool { - return obj.obj.MinLinks != nil -} - -// Specifies the mininum number of member interfaces that must be active for the aggregate interface to be available. -// If the aggregate interface is not available due to min-links criterion not being met, LACPDUs continue to be transmitted and received by the member interfaces if LACP is enabled, but other PDUs are not transmitted or received. -// SetMinLinks sets the uint32 value in the Lag object -func (obj *lag) SetMinLinks(value uint32) Lag { - - obj.obj.MinLinks = &value - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *lag) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the Lag object -func (obj *lag) SetName(value string) Lag { - - obj.obj.Name = &value - return obj -} - -func (obj *lag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Ports) != 0 { - - if set_default { - obj.Ports().clearHolderSlice() - for _, item := range obj.obj.Ports { - obj.Ports().appendHolderSlice(&lagPort{obj: item}) - } - } - for _, item := range obj.Ports().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Protocol != nil { - - obj.Protocol().validateObj(vObj, set_default) - } - - if obj.obj.MinLinks != nil { - - if *obj.obj.MinLinks > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= Lag.MinLinks <= 32 but Got %d", *obj.obj.MinLinks)) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface Lag") - } -} - -func (obj *lag) setDefault() { - if obj.obj.MinLinks == nil { - obj.SetMinLinks(1) - } - -} - -// ***** Layer1 ***** -type layer1 struct { - validation - obj *otg.Layer1 - marshaller marshalLayer1 - unMarshaller unMarshalLayer1 - autoNegotiationHolder Layer1AutoNegotiation - flowControlHolder Layer1FlowControl -} - -func NewLayer1() Layer1 { - obj := layer1{obj: &otg.Layer1{}} - obj.setDefault() - return &obj -} - -func (obj *layer1) msg() *otg.Layer1 { - return obj.obj -} - -func (obj *layer1) setMsg(msg *otg.Layer1) Layer1 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshallayer1 struct { - obj *layer1 -} - -type marshalLayer1 interface { - // ToProto marshals Layer1 to protobuf object *otg.Layer1 - ToProto() (*otg.Layer1, error) - // ToPbText marshals Layer1 to protobuf text - ToPbText() (string, error) - // ToYaml marshals Layer1 to YAML text - ToYaml() (string, error) - // ToJson marshals Layer1 to JSON text - ToJson() (string, error) -} - -type unMarshallayer1 struct { - obj *layer1 -} - -type unMarshalLayer1 interface { - // FromProto unmarshals Layer1 from protobuf object *otg.Layer1 - FromProto(msg *otg.Layer1) (Layer1, error) - // FromPbText unmarshals Layer1 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Layer1 from YAML text - FromYaml(value string) error - // FromJson unmarshals Layer1 from JSON text - FromJson(value string) error -} - -func (obj *layer1) Marshal() marshalLayer1 { - if obj.marshaller == nil { - obj.marshaller = &marshallayer1{obj: obj} - } - return obj.marshaller -} - -func (obj *layer1) Unmarshal() unMarshalLayer1 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallayer1{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallayer1) ToProto() (*otg.Layer1, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallayer1) FromProto(msg *otg.Layer1) (Layer1, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallayer1) 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 *unMarshallayer1) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshallayer1) 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 *unMarshallayer1) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshallayer1) 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 *unMarshallayer1) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *layer1) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *layer1) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *layer1) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *layer1) Clone() (Layer1, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLayer1() - 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 -} - -func (obj *layer1) setNil() { - obj.autoNegotiationHolder = nil - obj.flowControlHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// Layer1 is a container for layer1 settings. -type Layer1 interface { - Validation - // msg marshals Layer1 to protobuf object *otg.Layer1 - // and doesn't set defaults - msg() *otg.Layer1 - // setMsg unmarshals Layer1 from protobuf object *otg.Layer1 - // and doesn't set defaults - setMsg(*otg.Layer1) Layer1 - // provides marshal interface - Marshal() marshalLayer1 - // provides unmarshal interface - Unmarshal() unMarshalLayer1 - // validate validates Layer1 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Layer1, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PortNames returns []string, set in Layer1. - PortNames() []string - // SetPortNames assigns []string provided by user to Layer1 - SetPortNames(value []string) Layer1 - // Speed returns Layer1SpeedEnum, set in Layer1 - Speed() Layer1SpeedEnum - // SetSpeed assigns Layer1SpeedEnum provided by user to Layer1 - SetSpeed(value Layer1SpeedEnum) Layer1 - // HasSpeed checks if Speed has been set in Layer1 - HasSpeed() bool - // Media returns Layer1MediaEnum, set in Layer1 - Media() Layer1MediaEnum - // SetMedia assigns Layer1MediaEnum provided by user to Layer1 - SetMedia(value Layer1MediaEnum) Layer1 - // HasMedia checks if Media has been set in Layer1 - HasMedia() bool - // Promiscuous returns bool, set in Layer1. - Promiscuous() bool - // SetPromiscuous assigns bool provided by user to Layer1 - SetPromiscuous(value bool) Layer1 - // HasPromiscuous checks if Promiscuous has been set in Layer1 - HasPromiscuous() bool - // Mtu returns uint32, set in Layer1. - Mtu() uint32 - // SetMtu assigns uint32 provided by user to Layer1 - SetMtu(value uint32) Layer1 - // HasMtu checks if Mtu has been set in Layer1 - HasMtu() bool - // IeeeMediaDefaults returns bool, set in Layer1. - IeeeMediaDefaults() bool - // SetIeeeMediaDefaults assigns bool provided by user to Layer1 - SetIeeeMediaDefaults(value bool) Layer1 - // HasIeeeMediaDefaults checks if IeeeMediaDefaults has been set in Layer1 - HasIeeeMediaDefaults() bool - // AutoNegotiate returns bool, set in Layer1. - AutoNegotiate() bool - // SetAutoNegotiate assigns bool provided by user to Layer1 - SetAutoNegotiate(value bool) Layer1 - // HasAutoNegotiate checks if AutoNegotiate has been set in Layer1 - HasAutoNegotiate() bool - // AutoNegotiation returns Layer1AutoNegotiation, set in Layer1. - // Layer1AutoNegotiation is configuration for auto negotiation settings - AutoNegotiation() Layer1AutoNegotiation - // SetAutoNegotiation assigns Layer1AutoNegotiation provided by user to Layer1. - // Layer1AutoNegotiation is configuration for auto negotiation settings - SetAutoNegotiation(value Layer1AutoNegotiation) Layer1 - // HasAutoNegotiation checks if AutoNegotiation has been set in Layer1 - HasAutoNegotiation() bool - // FlowControl returns Layer1FlowControl, set in Layer1. - // Layer1FlowControl is a container for layer1 receive flow control settings. - // To enable flow control settings on ports this object must be a valid - // object not a null value. - FlowControl() Layer1FlowControl - // SetFlowControl assigns Layer1FlowControl provided by user to Layer1. - // Layer1FlowControl is a container for layer1 receive flow control settings. - // To enable flow control settings on ports this object must be a valid - // object not a null value. - SetFlowControl(value Layer1FlowControl) Layer1 - // HasFlowControl checks if FlowControl has been set in Layer1 - HasFlowControl() bool - // Name returns string, set in Layer1. - Name() string - // SetName assigns string provided by user to Layer1 - SetName(value string) Layer1 - setNil() -} - -// A list of unique names of port objects that will share the -// choice settings. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// PortNames returns a []string -func (obj *layer1) PortNames() []string { - if obj.obj.PortNames == nil { - obj.obj.PortNames = make([]string, 0) - } - return obj.obj.PortNames -} - -// A list of unique names of port objects that will share the -// choice settings. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// SetPortNames sets the []string value in the Layer1 object -func (obj *layer1) SetPortNames(value []string) Layer1 { - - if obj.obj.PortNames == nil { - obj.obj.PortNames = make([]string, 0) - } - obj.obj.PortNames = value - - return obj -} - -type Layer1SpeedEnum string - -// Enum of Speed on Layer1 -var Layer1Speed = struct { - SPEED_10_FD_MBPS Layer1SpeedEnum - SPEED_10_HD_MBPS Layer1SpeedEnum - SPEED_100_FD_MBPS Layer1SpeedEnum - SPEED_100_HD_MBPS Layer1SpeedEnum - SPEED_1_GBPS Layer1SpeedEnum - SPEED_10_GBPS Layer1SpeedEnum - SPEED_25_GBPS Layer1SpeedEnum - SPEED_40_GBPS Layer1SpeedEnum - SPEED_50_GBPS Layer1SpeedEnum - SPEED_100_GBPS Layer1SpeedEnum - SPEED_200_GBPS Layer1SpeedEnum - SPEED_400_GBPS Layer1SpeedEnum - SPEED_800_GBPS Layer1SpeedEnum -}{ - SPEED_10_FD_MBPS: Layer1SpeedEnum("speed_10_fd_mbps"), - SPEED_10_HD_MBPS: Layer1SpeedEnum("speed_10_hd_mbps"), - SPEED_100_FD_MBPS: Layer1SpeedEnum("speed_100_fd_mbps"), - SPEED_100_HD_MBPS: Layer1SpeedEnum("speed_100_hd_mbps"), - SPEED_1_GBPS: Layer1SpeedEnum("speed_1_gbps"), - SPEED_10_GBPS: Layer1SpeedEnum("speed_10_gbps"), - SPEED_25_GBPS: Layer1SpeedEnum("speed_25_gbps"), - SPEED_40_GBPS: Layer1SpeedEnum("speed_40_gbps"), - SPEED_50_GBPS: Layer1SpeedEnum("speed_50_gbps"), - SPEED_100_GBPS: Layer1SpeedEnum("speed_100_gbps"), - SPEED_200_GBPS: Layer1SpeedEnum("speed_200_gbps"), - SPEED_400_GBPS: Layer1SpeedEnum("speed_400_gbps"), - SPEED_800_GBPS: Layer1SpeedEnum("speed_800_gbps"), -} - -func (obj *layer1) Speed() Layer1SpeedEnum { - return Layer1SpeedEnum(obj.obj.Speed.Enum().String()) -} - -// Set the speed if supported. When no speed is explicitly set, the current -// speed of underlying test interface shall be assumed. -// Speed returns a string -func (obj *layer1) HasSpeed() bool { - return obj.obj.Speed != nil -} - -func (obj *layer1) SetSpeed(value Layer1SpeedEnum) Layer1 { - intValue, ok := otg.Layer1_Speed_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on Layer1SpeedEnum", string(value))) - return obj - } - enumValue := otg.Layer1_Speed_Enum(intValue) - obj.obj.Speed = &enumValue - - return obj -} - -type Layer1MediaEnum string - -// Enum of Media on Layer1 -var Layer1Media = struct { - COPPER Layer1MediaEnum - FIBER Layer1MediaEnum - SGMII Layer1MediaEnum -}{ - COPPER: Layer1MediaEnum("copper"), - FIBER: Layer1MediaEnum("fiber"), - SGMII: Layer1MediaEnum("sgmii"), -} - -func (obj *layer1) Media() Layer1MediaEnum { - return Layer1MediaEnum(obj.obj.Media.Enum().String()) -} - -// Set the type of media for test interface if supported. When no media -// type is explicitly set, the current media type of underlying test -// interface shall be assumed. -// Media returns a string -func (obj *layer1) HasMedia() bool { - return obj.obj.Media != nil -} - -func (obj *layer1) SetMedia(value Layer1MediaEnum) Layer1 { - intValue, ok := otg.Layer1_Media_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on Layer1MediaEnum", string(value))) - return obj - } - enumValue := otg.Layer1_Media_Enum(intValue) - obj.obj.Media = &enumValue - - return obj -} - -// Enable promiscuous mode on test interface. A warning shall be raised if -// this field is set to `true`, even when it's not supported, ignoring -// the setting altogether. -// Promiscuous returns a bool -func (obj *layer1) Promiscuous() bool { - - return *obj.obj.Promiscuous - -} - -// Enable promiscuous mode on test interface. A warning shall be raised if -// this field is set to `true`, even when it's not supported, ignoring -// the setting altogether. -// Promiscuous returns a bool -func (obj *layer1) HasPromiscuous() bool { - return obj.obj.Promiscuous != nil -} - -// Enable promiscuous mode on test interface. A warning shall be raised if -// this field is set to `true`, even when it's not supported, ignoring -// the setting altogether. -// SetPromiscuous sets the bool value in the Layer1 object -func (obj *layer1) SetPromiscuous(value bool) Layer1 { - - obj.obj.Promiscuous = &value - return obj -} - -// Set the maximum transmission unit size. A warning shall be raised if -// the specified value is valid but not supported, ignoring the setting altogether. -// Mtu returns a uint32 -func (obj *layer1) Mtu() uint32 { - - return *obj.obj.Mtu - -} - -// Set the maximum transmission unit size. A warning shall be raised if -// the specified value is valid but not supported, ignoring the setting altogether. -// Mtu returns a uint32 -func (obj *layer1) HasMtu() bool { - return obj.obj.Mtu != nil -} - -// Set the maximum transmission unit size. A warning shall be raised if -// the specified value is valid but not supported, ignoring the setting altogether. -// SetMtu sets the uint32 value in the Layer1 object -func (obj *layer1) SetMtu(value uint32) Layer1 { - - obj.obj.Mtu = &value - return obj -} - -// Under Review: This field is currently under review for pending exploration on use cases -// -// Under Review: This field is currently under review for pending exploration on use cases -// -// Set to true to override the auto_negotiate, link_training -// and rs_fec settings for gigabit ethernet interfaces. -// IeeeMediaDefaults returns a bool -func (obj *layer1) IeeeMediaDefaults() bool { - - return *obj.obj.IeeeMediaDefaults - -} - -// Under Review: This field is currently under review for pending exploration on use cases -// -// Under Review: This field is currently under review for pending exploration on use cases -// -// Set to true to override the auto_negotiate, link_training -// and rs_fec settings for gigabit ethernet interfaces. -// IeeeMediaDefaults returns a bool -func (obj *layer1) HasIeeeMediaDefaults() bool { - return obj.obj.IeeeMediaDefaults != nil -} - -// Under Review: This field is currently under review for pending exploration on use cases -// -// Under Review: This field is currently under review for pending exploration on use cases -// -// Set to true to override the auto_negotiate, link_training -// and rs_fec settings for gigabit ethernet interfaces. -// SetIeeeMediaDefaults sets the bool value in the Layer1 object -func (obj *layer1) SetIeeeMediaDefaults(value bool) Layer1 { - - obj.obj.IeeeMediaDefaults = &value - return obj -} - -// Under Review: This field is currently under review for pending exploration on use cases, given that a separate configuration called `AutoNegotiation` already exists. -// -// Under Review: This field is currently under review for pending exploration on use cases, given that a separate configuration called `AutoNegotiation` already exists. -// -// Enable/disable auto negotiation. -// AutoNegotiate returns a bool -func (obj *layer1) AutoNegotiate() bool { - - return *obj.obj.AutoNegotiate - -} - -// Under Review: This field is currently under review for pending exploration on use cases, given that a separate configuration called `AutoNegotiation` already exists. -// -// Under Review: This field is currently under review for pending exploration on use cases, given that a separate configuration called `AutoNegotiation` already exists. -// -// Enable/disable auto negotiation. -// AutoNegotiate returns a bool -func (obj *layer1) HasAutoNegotiate() bool { - return obj.obj.AutoNegotiate != nil -} - -// Under Review: This field is currently under review for pending exploration on use cases, given that a separate configuration called `AutoNegotiation` already exists. -// -// Under Review: This field is currently under review for pending exploration on use cases, given that a separate configuration called `AutoNegotiation` already exists. -// -// Enable/disable auto negotiation. -// SetAutoNegotiate sets the bool value in the Layer1 object -func (obj *layer1) SetAutoNegotiate(value bool) Layer1 { - - obj.obj.AutoNegotiate = &value - return obj -} - -// description is TBD -// AutoNegotiation returns a Layer1AutoNegotiation -func (obj *layer1) AutoNegotiation() Layer1AutoNegotiation { - if obj.obj.AutoNegotiation == nil { - obj.obj.AutoNegotiation = NewLayer1AutoNegotiation().msg() - } - if obj.autoNegotiationHolder == nil { - obj.autoNegotiationHolder = &layer1AutoNegotiation{obj: obj.obj.AutoNegotiation} - } - return obj.autoNegotiationHolder -} - -// description is TBD -// AutoNegotiation returns a Layer1AutoNegotiation -func (obj *layer1) HasAutoNegotiation() bool { - return obj.obj.AutoNegotiation != nil -} - -// description is TBD -// SetAutoNegotiation sets the Layer1AutoNegotiation value in the Layer1 object -func (obj *layer1) SetAutoNegotiation(value Layer1AutoNegotiation) Layer1 { - - obj.autoNegotiationHolder = nil - obj.obj.AutoNegotiation = value.msg() - - return obj -} - -// description is TBD -// FlowControl returns a Layer1FlowControl -func (obj *layer1) FlowControl() Layer1FlowControl { - if obj.obj.FlowControl == nil { - obj.obj.FlowControl = NewLayer1FlowControl().msg() - } - if obj.flowControlHolder == nil { - obj.flowControlHolder = &layer1FlowControl{obj: obj.obj.FlowControl} - } - return obj.flowControlHolder -} - -// description is TBD -// FlowControl returns a Layer1FlowControl -func (obj *layer1) HasFlowControl() bool { - return obj.obj.FlowControl != nil -} - -// description is TBD -// SetFlowControl sets the Layer1FlowControl value in the Layer1 object -func (obj *layer1) SetFlowControl(value Layer1FlowControl) Layer1 { - - obj.flowControlHolder = nil - obj.obj.FlowControl = value.msg() - - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *layer1) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the Layer1 object -func (obj *layer1) SetName(value string) Layer1 { - - obj.obj.Name = &value - return obj -} - -func (obj *layer1) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Mtu != nil { - - if *obj.obj.Mtu < 64 || *obj.obj.Mtu > 9000 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("64 <= Layer1.Mtu <= 9000 but Got %d", *obj.obj.Mtu)) - } - - } - - if obj.obj.AutoNegotiation != nil { - - obj.AutoNegotiation().validateObj(vObj, set_default) - } - - if obj.obj.FlowControl != nil { - - obj.FlowControl().validateObj(vObj, set_default) - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface Layer1") - } -} - -func (obj *layer1) setDefault() { - if obj.obj.Promiscuous == nil { - obj.SetPromiscuous(true) - } - if obj.obj.Mtu == nil { - obj.SetMtu(1500) - } - -} - -// ***** Capture ***** -type capture struct { - validation - obj *otg.Capture - marshaller marshalCapture - unMarshaller unMarshalCapture - filtersHolder CaptureCaptureFilterIter -} - -func NewCapture() Capture { - obj := capture{obj: &otg.Capture{}} - obj.setDefault() - return &obj -} - -func (obj *capture) msg() *otg.Capture { - return obj.obj -} - -func (obj *capture) setMsg(msg *otg.Capture) Capture { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalcapture struct { - obj *capture -} - -type marshalCapture interface { - // ToProto marshals Capture to protobuf object *otg.Capture - ToProto() (*otg.Capture, error) - // ToPbText marshals Capture to protobuf text - ToPbText() (string, error) - // ToYaml marshals Capture to YAML text - ToYaml() (string, error) - // ToJson marshals Capture to JSON text - ToJson() (string, error) -} - -type unMarshalcapture struct { - obj *capture -} - -type unMarshalCapture interface { - // FromProto unmarshals Capture from protobuf object *otg.Capture - FromProto(msg *otg.Capture) (Capture, error) - // FromPbText unmarshals Capture from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Capture from YAML text - FromYaml(value string) error - // FromJson unmarshals Capture from JSON text - FromJson(value string) error -} - -func (obj *capture) Marshal() marshalCapture { - if obj.marshaller == nil { - obj.marshaller = &marshalcapture{obj: obj} - } - return obj.marshaller -} - -func (obj *capture) Unmarshal() unMarshalCapture { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalcapture{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalcapture) ToProto() (*otg.Capture, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalcapture) FromProto(msg *otg.Capture) (Capture, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalcapture) 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 *unMarshalcapture) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalcapture) 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 *unMarshalcapture) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalcapture) 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 *unMarshalcapture) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *capture) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *capture) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *capture) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *capture) Clone() (Capture, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewCapture() - 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 -} - -func (obj *capture) setNil() { - obj.filtersHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// Capture is under Review: There may be changes in filter configuration -// -// Under Review: There may be changes in filter configuration -// -// Configuration for capture settings. -type Capture interface { - Validation - // msg marshals Capture to protobuf object *otg.Capture - // and doesn't set defaults - msg() *otg.Capture - // setMsg unmarshals Capture from protobuf object *otg.Capture - // and doesn't set defaults - setMsg(*otg.Capture) Capture - // provides marshal interface - Marshal() marshalCapture - // provides unmarshal interface - Unmarshal() unMarshalCapture - // validate validates Capture - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Capture, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PortNames returns []string, set in Capture. - PortNames() []string - // SetPortNames assigns []string provided by user to Capture - SetPortNames(value []string) Capture - // Filters returns CaptureCaptureFilterIterIter, set in Capture - Filters() CaptureCaptureFilterIter - // Overwrite returns bool, set in Capture. - Overwrite() bool - // SetOverwrite assigns bool provided by user to Capture - SetOverwrite(value bool) Capture - // HasOverwrite checks if Overwrite has been set in Capture - HasOverwrite() bool - // PacketSize returns uint32, set in Capture. - PacketSize() uint32 - // SetPacketSize assigns uint32 provided by user to Capture - SetPacketSize(value uint32) Capture - // HasPacketSize checks if PacketSize has been set in Capture - HasPacketSize() bool - // Format returns CaptureFormatEnum, set in Capture - Format() CaptureFormatEnum - // SetFormat assigns CaptureFormatEnum provided by user to Capture - SetFormat(value CaptureFormatEnum) Capture - // HasFormat checks if Format has been set in Capture - HasFormat() bool - // Name returns string, set in Capture. - Name() string - // SetName assigns string provided by user to Capture - SetName(value string) Capture - setNil() -} - -// The unique names of ports that the capture settings will apply to. Port_names cannot be duplicated between capture objects. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// PortNames returns a []string -func (obj *capture) PortNames() []string { - if obj.obj.PortNames == nil { - obj.obj.PortNames = make([]string, 0) - } - return obj.obj.PortNames -} - -// The unique names of ports that the capture settings will apply to. Port_names cannot be duplicated between capture objects. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// SetPortNames sets the []string value in the Capture object -func (obj *capture) SetPortNames(value []string) Capture { - - if obj.obj.PortNames == nil { - obj.obj.PortNames = make([]string, 0) - } - obj.obj.PortNames = value - - return obj -} - -// A list of filters to apply to the capturing ports. If no filters are specified then all packets will be captured. A capture can have multiple filters. The number of filters supported is determined by the implementation which can be retrieved using the capabilities API. -// When multiple filters are specified the capture implementation must && (and) all the filters. -// Filters returns a []CaptureFilter -func (obj *capture) Filters() CaptureCaptureFilterIter { - if len(obj.obj.Filters) == 0 { - obj.obj.Filters = []*otg.CaptureFilter{} - } - if obj.filtersHolder == nil { - obj.filtersHolder = newCaptureCaptureFilterIter(&obj.obj.Filters).setMsg(obj) - } - return obj.filtersHolder -} - -type captureCaptureFilterIter struct { - obj *capture - captureFilterSlice []CaptureFilter - fieldPtr *[]*otg.CaptureFilter -} - -func newCaptureCaptureFilterIter(ptr *[]*otg.CaptureFilter) CaptureCaptureFilterIter { - return &captureCaptureFilterIter{fieldPtr: ptr} -} - -type CaptureCaptureFilterIter interface { - setMsg(*capture) CaptureCaptureFilterIter - Items() []CaptureFilter - Add() CaptureFilter - Append(items ...CaptureFilter) CaptureCaptureFilterIter - Set(index int, newObj CaptureFilter) CaptureCaptureFilterIter - Clear() CaptureCaptureFilterIter - clearHolderSlice() CaptureCaptureFilterIter - appendHolderSlice(item CaptureFilter) CaptureCaptureFilterIter -} - -func (obj *captureCaptureFilterIter) setMsg(msg *capture) CaptureCaptureFilterIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&captureFilter{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *captureCaptureFilterIter) Items() []CaptureFilter { - return obj.captureFilterSlice -} - -func (obj *captureCaptureFilterIter) Add() CaptureFilter { - newObj := &otg.CaptureFilter{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &captureFilter{obj: newObj} - newLibObj.setDefault() - obj.captureFilterSlice = append(obj.captureFilterSlice, newLibObj) - return newLibObj -} - -func (obj *captureCaptureFilterIter) Append(items ...CaptureFilter) CaptureCaptureFilterIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.captureFilterSlice = append(obj.captureFilterSlice, item) - } - return obj -} - -func (obj *captureCaptureFilterIter) Set(index int, newObj CaptureFilter) CaptureCaptureFilterIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.captureFilterSlice[index] = newObj - return obj -} -func (obj *captureCaptureFilterIter) Clear() CaptureCaptureFilterIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.CaptureFilter{} - obj.captureFilterSlice = []CaptureFilter{} - } - return obj -} -func (obj *captureCaptureFilterIter) clearHolderSlice() CaptureCaptureFilterIter { - if len(obj.captureFilterSlice) > 0 { - obj.captureFilterSlice = []CaptureFilter{} - } - return obj -} -func (obj *captureCaptureFilterIter) appendHolderSlice(item CaptureFilter) CaptureCaptureFilterIter { - obj.captureFilterSlice = append(obj.captureFilterSlice, item) - return obj -} - -// Overwrite the capture buffer. -// Overwrite returns a bool -func (obj *capture) Overwrite() bool { - - return *obj.obj.Overwrite - -} - -// Overwrite the capture buffer. -// Overwrite returns a bool -func (obj *capture) HasOverwrite() bool { - return obj.obj.Overwrite != nil -} - -// Overwrite the capture buffer. -// SetOverwrite sets the bool value in the Capture object -func (obj *capture) SetOverwrite(value bool) Capture { - - obj.obj.Overwrite = &value - return obj -} - -// The maximum size of each captured packet. If no value is specified or it is null then the entire packet will be captured. -// PacketSize returns a uint32 -func (obj *capture) PacketSize() uint32 { - - return *obj.obj.PacketSize - -} - -// The maximum size of each captured packet. If no value is specified or it is null then the entire packet will be captured. -// PacketSize returns a uint32 -func (obj *capture) HasPacketSize() bool { - return obj.obj.PacketSize != nil -} - -// The maximum size of each captured packet. If no value is specified or it is null then the entire packet will be captured. -// SetPacketSize sets the uint32 value in the Capture object -func (obj *capture) SetPacketSize(value uint32) Capture { - - obj.obj.PacketSize = &value - return obj -} - -type CaptureFormatEnum string - -// Enum of Format on Capture -var CaptureFormat = struct { - PCAP CaptureFormatEnum - PCAPNG CaptureFormatEnum -}{ - PCAP: CaptureFormatEnum("pcap"), - PCAPNG: CaptureFormatEnum("pcapng"), -} - -func (obj *capture) Format() CaptureFormatEnum { - return CaptureFormatEnum(obj.obj.Format.Enum().String()) -} - -// The format of the capture file. -// Format returns a string -func (obj *capture) HasFormat() bool { - return obj.obj.Format != nil -} - -func (obj *capture) SetFormat(value CaptureFormatEnum) Capture { - intValue, ok := otg.Capture_Format_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on CaptureFormatEnum", string(value))) - return obj - } - enumValue := otg.Capture_Format_Enum(intValue) - obj.obj.Format = &enumValue - - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *capture) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the Capture object -func (obj *capture) SetName(value string) Capture { - - obj.obj.Name = &value - return obj -} - -func (obj *capture) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - obj.addWarnings("Capture is under review, There may be changes in filter configuration") - - if len(obj.obj.Filters) != 0 { - - if set_default { - obj.Filters().clearHolderSlice() - for _, item := range obj.obj.Filters { - obj.Filters().appendHolderSlice(&captureFilter{obj: item}) - } - } - for _, item := range obj.Filters().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.PacketSize != nil { - - if *obj.obj.PacketSize > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= Capture.PacketSize <= 65535 but Got %d", *obj.obj.PacketSize)) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface Capture") - } -} - -func (obj *capture) setDefault() { - if obj.obj.Overwrite == nil { - obj.SetOverwrite(true) - } - if obj.obj.Format == nil { - obj.SetFormat(CaptureFormat.PCAP) - - } - -} - -// ***** Device ***** -type device struct { - validation - obj *otg.Device - marshaller marshalDevice - unMarshaller unMarshalDevice - ethernetsHolder DeviceDeviceEthernetIter - ipv4LoopbacksHolder DeviceDeviceIpv4LoopbackIter - ipv6LoopbacksHolder DeviceDeviceIpv6LoopbackIter - isisHolder DeviceIsisRouter - bgpHolder DeviceBgpRouter - vxlanHolder DeviceVxlan - rsvpHolder DeviceRsvp - dhcpServerHolder DeviceDhcpServer -} - -func NewDevice() Device { - obj := device{obj: &otg.Device{}} - obj.setDefault() - return &obj -} - -func (obj *device) msg() *otg.Device { - return obj.obj -} - -func (obj *device) setMsg(msg *otg.Device) Device { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldevice struct { - obj *device -} - -type marshalDevice interface { - // ToProto marshals Device to protobuf object *otg.Device - ToProto() (*otg.Device, error) - // ToPbText marshals Device to protobuf text - ToPbText() (string, error) - // ToYaml marshals Device to YAML text - ToYaml() (string, error) - // ToJson marshals Device to JSON text - ToJson() (string, error) -} - -type unMarshaldevice struct { - obj *device -} - -type unMarshalDevice interface { - // FromProto unmarshals Device from protobuf object *otg.Device - FromProto(msg *otg.Device) (Device, error) - // FromPbText unmarshals Device from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Device from YAML text - FromYaml(value string) error - // FromJson unmarshals Device from JSON text - FromJson(value string) error -} - -func (obj *device) Marshal() marshalDevice { - if obj.marshaller == nil { - obj.marshaller = &marshaldevice{obj: obj} - } - return obj.marshaller -} - -func (obj *device) Unmarshal() unMarshalDevice { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldevice{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldevice) ToProto() (*otg.Device, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldevice) FromProto(msg *otg.Device) (Device, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldevice) 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 *unMarshaldevice) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshaldevice) 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 *unMarshaldevice) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshaldevice) 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 *unMarshaldevice) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *device) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *device) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *device) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *device) Clone() (Device, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDevice() - 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 -} - -func (obj *device) setNil() { - obj.ethernetsHolder = nil - obj.ipv4LoopbacksHolder = nil - obj.ipv6LoopbacksHolder = nil - obj.isisHolder = nil - obj.bgpHolder = nil - obj.vxlanHolder = nil - obj.rsvpHolder = nil - obj.dhcpServerHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// Device is a container for emulated interfaces, loopback interfaces and protocol configurations. -type Device interface { - Validation - // msg marshals Device to protobuf object *otg.Device - // and doesn't set defaults - msg() *otg.Device - // setMsg unmarshals Device from protobuf object *otg.Device - // and doesn't set defaults - setMsg(*otg.Device) Device - // provides marshal interface - Marshal() marshalDevice - // provides unmarshal interface - Unmarshal() unMarshalDevice - // validate validates Device - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Device, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ethernets returns DeviceDeviceEthernetIterIter, set in Device - Ethernets() DeviceDeviceEthernetIter - // Ipv4Loopbacks returns DeviceDeviceIpv4LoopbackIterIter, set in Device - Ipv4Loopbacks() DeviceDeviceIpv4LoopbackIter - // Ipv6Loopbacks returns DeviceDeviceIpv6LoopbackIterIter, set in Device - Ipv6Loopbacks() DeviceDeviceIpv6LoopbackIter - // Isis returns DeviceIsisRouter, set in Device. - // DeviceIsisRouter is a container of properties for an ISIS router and its interfaces. - Isis() DeviceIsisRouter - // SetIsis assigns DeviceIsisRouter provided by user to Device. - // DeviceIsisRouter is a container of properties for an ISIS router and its interfaces. - SetIsis(value DeviceIsisRouter) Device - // HasIsis checks if Isis has been set in Device - HasIsis() bool - // Bgp returns DeviceBgpRouter, set in Device. - // DeviceBgpRouter is configuration for one or more IPv4 or IPv6 BGP peers. - Bgp() DeviceBgpRouter - // SetBgp assigns DeviceBgpRouter provided by user to Device. - // DeviceBgpRouter is configuration for one or more IPv4 or IPv6 BGP peers. - SetBgp(value DeviceBgpRouter) Device - // HasBgp checks if Bgp has been set in Device - HasBgp() bool - // Vxlan returns DeviceVxlan, set in Device. - // DeviceVxlan is description is TBD - Vxlan() DeviceVxlan - // SetVxlan assigns DeviceVxlan provided by user to Device. - // DeviceVxlan is description is TBD - SetVxlan(value DeviceVxlan) Device - // HasVxlan checks if Vxlan has been set in Device - HasVxlan() bool - // Name returns string, set in Device. - Name() string - // SetName assigns string provided by user to Device - SetName(value string) Device - // Rsvp returns DeviceRsvp, set in Device. - // DeviceRsvp is configuration for one or more RSVP interfaces, ingress and egress LSPs. In this model, currently IPv4 RSVP and point-to-point LSPs are supported as per RFC3209 and related specifications. - Rsvp() DeviceRsvp - // SetRsvp assigns DeviceRsvp provided by user to Device. - // DeviceRsvp is configuration for one or more RSVP interfaces, ingress and egress LSPs. In this model, currently IPv4 RSVP and point-to-point LSPs are supported as per RFC3209 and related specifications. - SetRsvp(value DeviceRsvp) Device - // HasRsvp checks if Rsvp has been set in Device - HasRsvp() bool - // DhcpServer returns DeviceDhcpServer, set in Device. - // DeviceDhcpServer is configuration for one or more IPv4 or IPv6 DHCP servers. - DhcpServer() DeviceDhcpServer - // SetDhcpServer assigns DeviceDhcpServer provided by user to Device. - // DeviceDhcpServer is configuration for one or more IPv4 or IPv6 DHCP servers. - SetDhcpServer(value DeviceDhcpServer) Device - // HasDhcpServer checks if DhcpServer has been set in Device - HasDhcpServer() bool - setNil() -} - -// Ethernet configuration for one or more emulated network interfaces. -// Ethernets returns a []DeviceEthernet -func (obj *device) Ethernets() DeviceDeviceEthernetIter { - if len(obj.obj.Ethernets) == 0 { - obj.obj.Ethernets = []*otg.DeviceEthernet{} - } - if obj.ethernetsHolder == nil { - obj.ethernetsHolder = newDeviceDeviceEthernetIter(&obj.obj.Ethernets).setMsg(obj) - } - return obj.ethernetsHolder -} - -type deviceDeviceEthernetIter struct { - obj *device - deviceEthernetSlice []DeviceEthernet - fieldPtr *[]*otg.DeviceEthernet -} - -func newDeviceDeviceEthernetIter(ptr *[]*otg.DeviceEthernet) DeviceDeviceEthernetIter { - return &deviceDeviceEthernetIter{fieldPtr: ptr} -} - -type DeviceDeviceEthernetIter interface { - setMsg(*device) DeviceDeviceEthernetIter - Items() []DeviceEthernet - Add() DeviceEthernet - Append(items ...DeviceEthernet) DeviceDeviceEthernetIter - Set(index int, newObj DeviceEthernet) DeviceDeviceEthernetIter - Clear() DeviceDeviceEthernetIter - clearHolderSlice() DeviceDeviceEthernetIter - appendHolderSlice(item DeviceEthernet) DeviceDeviceEthernetIter -} - -func (obj *deviceDeviceEthernetIter) setMsg(msg *device) DeviceDeviceEthernetIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&deviceEthernet{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceDeviceEthernetIter) Items() []DeviceEthernet { - return obj.deviceEthernetSlice -} - -func (obj *deviceDeviceEthernetIter) Add() DeviceEthernet { - newObj := &otg.DeviceEthernet{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &deviceEthernet{obj: newObj} - newLibObj.setDefault() - obj.deviceEthernetSlice = append(obj.deviceEthernetSlice, newLibObj) - return newLibObj -} - -func (obj *deviceDeviceEthernetIter) Append(items ...DeviceEthernet) DeviceDeviceEthernetIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.deviceEthernetSlice = append(obj.deviceEthernetSlice, item) - } - return obj -} - -func (obj *deviceDeviceEthernetIter) Set(index int, newObj DeviceEthernet) DeviceDeviceEthernetIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.deviceEthernetSlice[index] = newObj - return obj -} -func (obj *deviceDeviceEthernetIter) Clear() DeviceDeviceEthernetIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.DeviceEthernet{} - obj.deviceEthernetSlice = []DeviceEthernet{} - } - return obj -} -func (obj *deviceDeviceEthernetIter) clearHolderSlice() DeviceDeviceEthernetIter { - if len(obj.deviceEthernetSlice) > 0 { - obj.deviceEthernetSlice = []DeviceEthernet{} - } - return obj -} -func (obj *deviceDeviceEthernetIter) appendHolderSlice(item DeviceEthernet) DeviceDeviceEthernetIter { - obj.deviceEthernetSlice = append(obj.deviceEthernetSlice, item) - return obj -} - -// IPv4 Loopback interface that can be attached to an Ethernet in the same device or to an Ethernet in another device. -// Ipv4Loopbacks returns a []DeviceIpv4Loopback -func (obj *device) Ipv4Loopbacks() DeviceDeviceIpv4LoopbackIter { - if len(obj.obj.Ipv4Loopbacks) == 0 { - obj.obj.Ipv4Loopbacks = []*otg.DeviceIpv4Loopback{} - } - if obj.ipv4LoopbacksHolder == nil { - obj.ipv4LoopbacksHolder = newDeviceDeviceIpv4LoopbackIter(&obj.obj.Ipv4Loopbacks).setMsg(obj) - } - return obj.ipv4LoopbacksHolder -} - -type deviceDeviceIpv4LoopbackIter struct { - obj *device - deviceIpv4LoopbackSlice []DeviceIpv4Loopback - fieldPtr *[]*otg.DeviceIpv4Loopback -} - -func newDeviceDeviceIpv4LoopbackIter(ptr *[]*otg.DeviceIpv4Loopback) DeviceDeviceIpv4LoopbackIter { - return &deviceDeviceIpv4LoopbackIter{fieldPtr: ptr} -} - -type DeviceDeviceIpv4LoopbackIter interface { - setMsg(*device) DeviceDeviceIpv4LoopbackIter - Items() []DeviceIpv4Loopback - Add() DeviceIpv4Loopback - Append(items ...DeviceIpv4Loopback) DeviceDeviceIpv4LoopbackIter - Set(index int, newObj DeviceIpv4Loopback) DeviceDeviceIpv4LoopbackIter - Clear() DeviceDeviceIpv4LoopbackIter - clearHolderSlice() DeviceDeviceIpv4LoopbackIter - appendHolderSlice(item DeviceIpv4Loopback) DeviceDeviceIpv4LoopbackIter -} - -func (obj *deviceDeviceIpv4LoopbackIter) setMsg(msg *device) DeviceDeviceIpv4LoopbackIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&deviceIpv4Loopback{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceDeviceIpv4LoopbackIter) Items() []DeviceIpv4Loopback { - return obj.deviceIpv4LoopbackSlice -} - -func (obj *deviceDeviceIpv4LoopbackIter) Add() DeviceIpv4Loopback { - newObj := &otg.DeviceIpv4Loopback{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &deviceIpv4Loopback{obj: newObj} - newLibObj.setDefault() - obj.deviceIpv4LoopbackSlice = append(obj.deviceIpv4LoopbackSlice, newLibObj) - return newLibObj -} - -func (obj *deviceDeviceIpv4LoopbackIter) Append(items ...DeviceIpv4Loopback) DeviceDeviceIpv4LoopbackIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.deviceIpv4LoopbackSlice = append(obj.deviceIpv4LoopbackSlice, item) - } - return obj -} - -func (obj *deviceDeviceIpv4LoopbackIter) Set(index int, newObj DeviceIpv4Loopback) DeviceDeviceIpv4LoopbackIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.deviceIpv4LoopbackSlice[index] = newObj - return obj -} -func (obj *deviceDeviceIpv4LoopbackIter) Clear() DeviceDeviceIpv4LoopbackIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.DeviceIpv4Loopback{} - obj.deviceIpv4LoopbackSlice = []DeviceIpv4Loopback{} - } - return obj -} -func (obj *deviceDeviceIpv4LoopbackIter) clearHolderSlice() DeviceDeviceIpv4LoopbackIter { - if len(obj.deviceIpv4LoopbackSlice) > 0 { - obj.deviceIpv4LoopbackSlice = []DeviceIpv4Loopback{} - } - return obj -} -func (obj *deviceDeviceIpv4LoopbackIter) appendHolderSlice(item DeviceIpv4Loopback) DeviceDeviceIpv4LoopbackIter { - obj.deviceIpv4LoopbackSlice = append(obj.deviceIpv4LoopbackSlice, item) - return obj -} - -// IPv6 Loopback interface that can be attached to an Ethernet in the same device or to an Ethernet in another device. -// Ipv6Loopbacks returns a []DeviceIpv6Loopback -func (obj *device) Ipv6Loopbacks() DeviceDeviceIpv6LoopbackIter { - if len(obj.obj.Ipv6Loopbacks) == 0 { - obj.obj.Ipv6Loopbacks = []*otg.DeviceIpv6Loopback{} - } - if obj.ipv6LoopbacksHolder == nil { - obj.ipv6LoopbacksHolder = newDeviceDeviceIpv6LoopbackIter(&obj.obj.Ipv6Loopbacks).setMsg(obj) - } - return obj.ipv6LoopbacksHolder -} - -type deviceDeviceIpv6LoopbackIter struct { - obj *device - deviceIpv6LoopbackSlice []DeviceIpv6Loopback - fieldPtr *[]*otg.DeviceIpv6Loopback -} - -func newDeviceDeviceIpv6LoopbackIter(ptr *[]*otg.DeviceIpv6Loopback) DeviceDeviceIpv6LoopbackIter { - return &deviceDeviceIpv6LoopbackIter{fieldPtr: ptr} -} - -type DeviceDeviceIpv6LoopbackIter interface { - setMsg(*device) DeviceDeviceIpv6LoopbackIter - Items() []DeviceIpv6Loopback - Add() DeviceIpv6Loopback - Append(items ...DeviceIpv6Loopback) DeviceDeviceIpv6LoopbackIter - Set(index int, newObj DeviceIpv6Loopback) DeviceDeviceIpv6LoopbackIter - Clear() DeviceDeviceIpv6LoopbackIter - clearHolderSlice() DeviceDeviceIpv6LoopbackIter - appendHolderSlice(item DeviceIpv6Loopback) DeviceDeviceIpv6LoopbackIter -} - -func (obj *deviceDeviceIpv6LoopbackIter) setMsg(msg *device) DeviceDeviceIpv6LoopbackIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&deviceIpv6Loopback{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceDeviceIpv6LoopbackIter) Items() []DeviceIpv6Loopback { - return obj.deviceIpv6LoopbackSlice -} - -func (obj *deviceDeviceIpv6LoopbackIter) Add() DeviceIpv6Loopback { - newObj := &otg.DeviceIpv6Loopback{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &deviceIpv6Loopback{obj: newObj} - newLibObj.setDefault() - obj.deviceIpv6LoopbackSlice = append(obj.deviceIpv6LoopbackSlice, newLibObj) - return newLibObj -} - -func (obj *deviceDeviceIpv6LoopbackIter) Append(items ...DeviceIpv6Loopback) DeviceDeviceIpv6LoopbackIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.deviceIpv6LoopbackSlice = append(obj.deviceIpv6LoopbackSlice, item) - } - return obj -} - -func (obj *deviceDeviceIpv6LoopbackIter) Set(index int, newObj DeviceIpv6Loopback) DeviceDeviceIpv6LoopbackIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.deviceIpv6LoopbackSlice[index] = newObj - return obj -} -func (obj *deviceDeviceIpv6LoopbackIter) Clear() DeviceDeviceIpv6LoopbackIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.DeviceIpv6Loopback{} - obj.deviceIpv6LoopbackSlice = []DeviceIpv6Loopback{} - } - return obj -} -func (obj *deviceDeviceIpv6LoopbackIter) clearHolderSlice() DeviceDeviceIpv6LoopbackIter { - if len(obj.deviceIpv6LoopbackSlice) > 0 { - obj.deviceIpv6LoopbackSlice = []DeviceIpv6Loopback{} - } - return obj -} -func (obj *deviceDeviceIpv6LoopbackIter) appendHolderSlice(item DeviceIpv6Loopback) DeviceDeviceIpv6LoopbackIter { - obj.deviceIpv6LoopbackSlice = append(obj.deviceIpv6LoopbackSlice, item) - return obj -} - -// The properties of an IS-IS router and its children, such as IS-IS interfaces and route ranges. -// Isis returns a DeviceIsisRouter -func (obj *device) Isis() DeviceIsisRouter { - if obj.obj.Isis == nil { - obj.obj.Isis = NewDeviceIsisRouter().msg() - } - if obj.isisHolder == nil { - obj.isisHolder = &deviceIsisRouter{obj: obj.obj.Isis} - } - return obj.isisHolder -} - -// The properties of an IS-IS router and its children, such as IS-IS interfaces and route ranges. -// Isis returns a DeviceIsisRouter -func (obj *device) HasIsis() bool { - return obj.obj.Isis != nil -} - -// The properties of an IS-IS router and its children, such as IS-IS interfaces and route ranges. -// SetIsis sets the DeviceIsisRouter value in the Device object -func (obj *device) SetIsis(value DeviceIsisRouter) Device { - - obj.isisHolder = nil - obj.obj.Isis = value.msg() - - return obj -} - -// The properties of BGP router and its children, such as BGPv4, BGPv6 peers and their route ranges. -// Bgp returns a DeviceBgpRouter -func (obj *device) Bgp() DeviceBgpRouter { - if obj.obj.Bgp == nil { - obj.obj.Bgp = NewDeviceBgpRouter().msg() - } - if obj.bgpHolder == nil { - obj.bgpHolder = &deviceBgpRouter{obj: obj.obj.Bgp} - } - return obj.bgpHolder -} - -// The properties of BGP router and its children, such as BGPv4, BGPv6 peers and their route ranges. -// Bgp returns a DeviceBgpRouter -func (obj *device) HasBgp() bool { - return obj.obj.Bgp != nil -} - -// The properties of BGP router and its children, such as BGPv4, BGPv6 peers and their route ranges. -// SetBgp sets the DeviceBgpRouter value in the Device object -func (obj *device) SetBgp(value DeviceBgpRouter) Device { - - obj.bgpHolder = nil - obj.obj.Bgp = value.msg() - - return obj -} - -// Configuration of VXLAN tunnel interfaces RFC Ref: https://datatracker.ietf.org/doc/html/rfc7348 -// Vxlan returns a DeviceVxlan -func (obj *device) Vxlan() DeviceVxlan { - if obj.obj.Vxlan == nil { - obj.obj.Vxlan = NewDeviceVxlan().msg() - } - if obj.vxlanHolder == nil { - obj.vxlanHolder = &deviceVxlan{obj: obj.obj.Vxlan} - } - return obj.vxlanHolder -} - -// Configuration of VXLAN tunnel interfaces RFC Ref: https://datatracker.ietf.org/doc/html/rfc7348 -// Vxlan returns a DeviceVxlan -func (obj *device) HasVxlan() bool { - return obj.obj.Vxlan != nil -} - -// Configuration of VXLAN tunnel interfaces RFC Ref: https://datatracker.ietf.org/doc/html/rfc7348 -// SetVxlan sets the DeviceVxlan value in the Device object -func (obj *device) SetVxlan(value DeviceVxlan) Device { - - obj.vxlanHolder = nil - obj.obj.Vxlan = value.msg() - - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *device) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the Device object -func (obj *device) SetName(value string) Device { - - obj.obj.Name = &value - return obj -} - -// The properties of an RSVP router and its children. -// Rsvp returns a DeviceRsvp -func (obj *device) Rsvp() DeviceRsvp { - if obj.obj.Rsvp == nil { - obj.obj.Rsvp = NewDeviceRsvp().msg() - } - if obj.rsvpHolder == nil { - obj.rsvpHolder = &deviceRsvp{obj: obj.obj.Rsvp} - } - return obj.rsvpHolder -} - -// The properties of an RSVP router and its children. -// Rsvp returns a DeviceRsvp -func (obj *device) HasRsvp() bool { - return obj.obj.Rsvp != nil -} - -// The properties of an RSVP router and its children. -// SetRsvp sets the DeviceRsvp value in the Device object -func (obj *device) SetRsvp(value DeviceRsvp) Device { - - obj.rsvpHolder = nil - obj.obj.Rsvp = value.msg() - - return obj -} - -// The properties of DHCP Server and its children, such as DHCPv4, DHCPv6 servers. -// DhcpServer returns a DeviceDhcpServer -func (obj *device) DhcpServer() DeviceDhcpServer { - if obj.obj.DhcpServer == nil { - obj.obj.DhcpServer = NewDeviceDhcpServer().msg() - } - if obj.dhcpServerHolder == nil { - obj.dhcpServerHolder = &deviceDhcpServer{obj: obj.obj.DhcpServer} - } - return obj.dhcpServerHolder -} - -// The properties of DHCP Server and its children, such as DHCPv4, DHCPv6 servers. -// DhcpServer returns a DeviceDhcpServer -func (obj *device) HasDhcpServer() bool { - return obj.obj.DhcpServer != nil -} - -// The properties of DHCP Server and its children, such as DHCPv4, DHCPv6 servers. -// SetDhcpServer sets the DeviceDhcpServer value in the Device object -func (obj *device) SetDhcpServer(value DeviceDhcpServer) Device { - - obj.dhcpServerHolder = nil - obj.obj.DhcpServer = value.msg() - - return obj -} - -func (obj *device) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Ethernets) != 0 { - - if set_default { - obj.Ethernets().clearHolderSlice() - for _, item := range obj.obj.Ethernets { - obj.Ethernets().appendHolderSlice(&deviceEthernet{obj: item}) - } - } - for _, item := range obj.Ethernets().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Ipv4Loopbacks) != 0 { - - if set_default { - obj.Ipv4Loopbacks().clearHolderSlice() - for _, item := range obj.obj.Ipv4Loopbacks { - obj.Ipv4Loopbacks().appendHolderSlice(&deviceIpv4Loopback{obj: item}) - } - } - for _, item := range obj.Ipv4Loopbacks().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Ipv6Loopbacks) != 0 { - - if set_default { - obj.Ipv6Loopbacks().clearHolderSlice() - for _, item := range obj.obj.Ipv6Loopbacks { - obj.Ipv6Loopbacks().appendHolderSlice(&deviceIpv6Loopback{obj: item}) - } - } - for _, item := range obj.Ipv6Loopbacks().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Isis != nil { - - obj.Isis().validateObj(vObj, set_default) - } - - if obj.obj.Bgp != nil { - - obj.Bgp().validateObj(vObj, set_default) - } - - if obj.obj.Vxlan != nil { - - obj.Vxlan().validateObj(vObj, set_default) - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface Device") - } - - if obj.obj.Rsvp != nil { - - obj.Rsvp().validateObj(vObj, set_default) - } - - if obj.obj.DhcpServer != nil { - - obj.DhcpServer().validateObj(vObj, set_default) - } - -} - -func (obj *device) setDefault() { - -} - -// ***** Flow ***** -type flow struct { - validation - obj *otg.Flow - marshaller marshalFlow - unMarshaller unMarshalFlow - txRxHolder FlowTxRx - packetHolder FlowFlowHeaderIter - egressPacketHolder FlowFlowHeaderIter - sizeHolder FlowSize - rateHolder FlowRate - durationHolder FlowDuration - metricsHolder FlowMetrics -} - -func NewFlow() Flow { - obj := flow{obj: &otg.Flow{}} - obj.setDefault() - return &obj -} - -func (obj *flow) msg() *otg.Flow { - return obj.obj -} - -func (obj *flow) setMsg(msg *otg.Flow) Flow { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflow struct { - obj *flow -} - -type marshalFlow interface { - // ToProto marshals Flow to protobuf object *otg.Flow - ToProto() (*otg.Flow, error) - // ToPbText marshals Flow to protobuf text - ToPbText() (string, error) - // ToYaml marshals Flow to YAML text - ToYaml() (string, error) - // ToJson marshals Flow to JSON text - ToJson() (string, error) -} - -type unMarshalflow struct { - obj *flow -} - -type unMarshalFlow interface { - // FromProto unmarshals Flow from protobuf object *otg.Flow - FromProto(msg *otg.Flow) (Flow, error) - // FromPbText unmarshals Flow from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Flow from YAML text - FromYaml(value string) error - // FromJson unmarshals Flow from JSON text - FromJson(value string) error -} - -func (obj *flow) Marshal() marshalFlow { - if obj.marshaller == nil { - obj.marshaller = &marshalflow{obj: obj} - } - return obj.marshaller -} - -func (obj *flow) Unmarshal() unMarshalFlow { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflow{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflow) ToProto() (*otg.Flow, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflow) FromProto(msg *otg.Flow) (Flow, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflow) 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 *unMarshalflow) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflow) 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 *unMarshalflow) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflow) 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 *unMarshalflow) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flow) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flow) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flow) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flow) Clone() (Flow, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlow() - 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 -} - -func (obj *flow) setNil() { - obj.txRxHolder = nil - obj.packetHolder = nil - obj.egressPacketHolder = nil - obj.sizeHolder = nil - obj.rateHolder = nil - obj.durationHolder = nil - obj.metricsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// Flow is a high level data plane traffic flow. -type Flow interface { - Validation - // msg marshals Flow to protobuf object *otg.Flow - // and doesn't set defaults - msg() *otg.Flow - // setMsg unmarshals Flow from protobuf object *otg.Flow - // and doesn't set defaults - setMsg(*otg.Flow) Flow - // provides marshal interface - Marshal() marshalFlow - // provides unmarshal interface - Unmarshal() unMarshalFlow - // validate validates Flow - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Flow, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // TxRx returns FlowTxRx, set in Flow. - // FlowTxRx is a container for different types of transmit and receive - // endpoint containers. - TxRx() FlowTxRx - // SetTxRx assigns FlowTxRx provided by user to Flow. - // FlowTxRx is a container for different types of transmit and receive - // endpoint containers. - SetTxRx(value FlowTxRx) Flow - // Packet returns FlowFlowHeaderIterIter, set in Flow - Packet() FlowFlowHeaderIter - // EgressPacket returns FlowFlowHeaderIterIter, set in Flow - EgressPacket() FlowFlowHeaderIter - // Size returns FlowSize, set in Flow. - // FlowSize is the frame size which overrides the total length of the packet - Size() FlowSize - // SetSize assigns FlowSize provided by user to Flow. - // FlowSize is the frame size which overrides the total length of the packet - SetSize(value FlowSize) Flow - // HasSize checks if Size has been set in Flow - HasSize() bool - // Rate returns FlowRate, set in Flow. - // FlowRate is the rate of packet transmission - Rate() FlowRate - // SetRate assigns FlowRate provided by user to Flow. - // FlowRate is the rate of packet transmission - SetRate(value FlowRate) Flow - // HasRate checks if Rate has been set in Flow - HasRate() bool - // Duration returns FlowDuration, set in Flow. - // FlowDuration is a container for different transmit durations. - Duration() FlowDuration - // SetDuration assigns FlowDuration provided by user to Flow. - // FlowDuration is a container for different transmit durations. - SetDuration(value FlowDuration) Flow - // HasDuration checks if Duration has been set in Flow - HasDuration() bool - // Metrics returns FlowMetrics, set in Flow. - // FlowMetrics is the optional container for configuring flow metrics. - Metrics() FlowMetrics - // SetMetrics assigns FlowMetrics provided by user to Flow. - // FlowMetrics is the optional container for configuring flow metrics. - SetMetrics(value FlowMetrics) Flow - // HasMetrics checks if Metrics has been set in Flow - HasMetrics() bool - // Name returns string, set in Flow. - Name() string - // SetName assigns string provided by user to Flow - SetName(value string) Flow - setNil() -} - -// The transmit and receive endpoints. -// TxRx returns a FlowTxRx -func (obj *flow) TxRx() FlowTxRx { - if obj.obj.TxRx == nil { - obj.obj.TxRx = NewFlowTxRx().msg() - } - if obj.txRxHolder == nil { - obj.txRxHolder = &flowTxRx{obj: obj.obj.TxRx} - } - return obj.txRxHolder -} - -// The transmit and receive endpoints. -// SetTxRx sets the FlowTxRx value in the Flow object -func (obj *flow) SetTxRx(value FlowTxRx) Flow { - - obj.txRxHolder = nil - obj.obj.TxRx = value.msg() - - return obj -} - -// The list of protocol headers defining the shape of all -// intended packets in corresponding flow as it is transmitted -// by traffic-generator port. -// -// The order of protocol headers assigned to the list is the -// order they will appear on the wire. -// -// In the case of an empty list the keyword/value of minItems: 1 -// indicates that an implementation MUST provide at least one -// Flow.Header object. -// -// The default value for the Flow.Header choice property is ethernet -// which will result in an implementation by default providing at least -// one ethernet packet header. -// Packet returns a []FlowHeader -func (obj *flow) Packet() FlowFlowHeaderIter { - if len(obj.obj.Packet) == 0 { - obj.obj.Packet = []*otg.FlowHeader{} - } - if obj.packetHolder == nil { - obj.packetHolder = newFlowFlowHeaderIter(&obj.obj.Packet).setMsg(obj) - } - return obj.packetHolder -} - -type flowFlowHeaderIter struct { - obj *flow - flowHeaderSlice []FlowHeader - fieldPtr *[]*otg.FlowHeader -} - -func newFlowFlowHeaderIter(ptr *[]*otg.FlowHeader) FlowFlowHeaderIter { - return &flowFlowHeaderIter{fieldPtr: ptr} -} - -type FlowFlowHeaderIter interface { - setMsg(*flow) FlowFlowHeaderIter - Items() []FlowHeader - Add() FlowHeader - Append(items ...FlowHeader) FlowFlowHeaderIter - Set(index int, newObj FlowHeader) FlowFlowHeaderIter - Clear() FlowFlowHeaderIter - clearHolderSlice() FlowFlowHeaderIter - appendHolderSlice(item FlowHeader) FlowFlowHeaderIter -} - -func (obj *flowFlowHeaderIter) setMsg(msg *flow) FlowFlowHeaderIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flowHeader{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *flowFlowHeaderIter) Items() []FlowHeader { - return obj.flowHeaderSlice -} - -func (obj *flowFlowHeaderIter) Add() FlowHeader { - newObj := &otg.FlowHeader{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flowHeader{obj: newObj} - newLibObj.setDefault() - obj.flowHeaderSlice = append(obj.flowHeaderSlice, newLibObj) - return newLibObj -} - -func (obj *flowFlowHeaderIter) Append(items ...FlowHeader) FlowFlowHeaderIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowHeaderSlice = append(obj.flowHeaderSlice, item) - } - return obj -} - -func (obj *flowFlowHeaderIter) Set(index int, newObj FlowHeader) FlowFlowHeaderIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowHeaderSlice[index] = newObj - return obj -} -func (obj *flowFlowHeaderIter) Clear() FlowFlowHeaderIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.FlowHeader{} - obj.flowHeaderSlice = []FlowHeader{} - } - return obj -} -func (obj *flowFlowHeaderIter) clearHolderSlice() FlowFlowHeaderIter { - if len(obj.flowHeaderSlice) > 0 { - obj.flowHeaderSlice = []FlowHeader{} - } - return obj -} -func (obj *flowFlowHeaderIter) appendHolderSlice(item FlowHeader) FlowFlowHeaderIter { - obj.flowHeaderSlice = append(obj.flowHeaderSlice, item) - return obj -} - -// Under Review: The packet header schema for egress tracking currently exposes unwanted fields. The query structure for tagged metrics inside flows metrics requires documenting expected response format. -// -// Under Review: The packet header schema for egress tracking currently exposes unwanted fields. The query structure for tagged metrics inside flows metrics requires documenting expected response format. -// -// The list of protocol headers defining the shape of all -// intended packets in corresponding flow as it is received -// by traffic-generator port. -// -// For all protocol headers, only the `metric_tags` property is configurable. -// EgressPacket returns a []FlowHeader -func (obj *flow) EgressPacket() FlowFlowHeaderIter { - if len(obj.obj.EgressPacket) == 0 { - obj.obj.EgressPacket = []*otg.FlowHeader{} - } - if obj.egressPacketHolder == nil { - obj.egressPacketHolder = newFlowFlowHeaderIter(&obj.obj.EgressPacket).setMsg(obj) - } - return obj.egressPacketHolder -} - -// The size of the packets. -// Size returns a FlowSize -func (obj *flow) Size() FlowSize { - if obj.obj.Size == nil { - obj.obj.Size = NewFlowSize().msg() - } - if obj.sizeHolder == nil { - obj.sizeHolder = &flowSize{obj: obj.obj.Size} - } - return obj.sizeHolder -} - -// The size of the packets. -// Size returns a FlowSize -func (obj *flow) HasSize() bool { - return obj.obj.Size != nil -} - -// The size of the packets. -// SetSize sets the FlowSize value in the Flow object -func (obj *flow) SetSize(value FlowSize) Flow { - - obj.sizeHolder = nil - obj.obj.Size = value.msg() - - return obj -} - -// The transmit rate of the packets. -// Rate returns a FlowRate -func (obj *flow) Rate() FlowRate { - if obj.obj.Rate == nil { - obj.obj.Rate = NewFlowRate().msg() - } - if obj.rateHolder == nil { - obj.rateHolder = &flowRate{obj: obj.obj.Rate} - } - return obj.rateHolder -} - -// The transmit rate of the packets. -// Rate returns a FlowRate -func (obj *flow) HasRate() bool { - return obj.obj.Rate != nil -} - -// The transmit rate of the packets. -// SetRate sets the FlowRate value in the Flow object -func (obj *flow) SetRate(value FlowRate) Flow { - - obj.rateHolder = nil - obj.obj.Rate = value.msg() - - return obj -} - -// The transmit duration of the packets. -// Duration returns a FlowDuration -func (obj *flow) Duration() FlowDuration { - if obj.obj.Duration == nil { - obj.obj.Duration = NewFlowDuration().msg() - } - if obj.durationHolder == nil { - obj.durationHolder = &flowDuration{obj: obj.obj.Duration} - } - return obj.durationHolder -} - -// The transmit duration of the packets. -// Duration returns a FlowDuration -func (obj *flow) HasDuration() bool { - return obj.obj.Duration != nil -} - -// The transmit duration of the packets. -// SetDuration sets the FlowDuration value in the Flow object -func (obj *flow) SetDuration(value FlowDuration) Flow { - - obj.durationHolder = nil - obj.obj.Duration = value.msg() - - return obj -} - -// Flow metrics. -// Metrics returns a FlowMetrics -func (obj *flow) Metrics() FlowMetrics { - if obj.obj.Metrics == nil { - obj.obj.Metrics = NewFlowMetrics().msg() - } - if obj.metricsHolder == nil { - obj.metricsHolder = &flowMetrics{obj: obj.obj.Metrics} - } - return obj.metricsHolder -} - -// Flow metrics. -// Metrics returns a FlowMetrics -func (obj *flow) HasMetrics() bool { - return obj.obj.Metrics != nil -} - -// Flow metrics. -// SetMetrics sets the FlowMetrics value in the Flow object -func (obj *flow) SetMetrics(value FlowMetrics) Flow { - - obj.metricsHolder = nil - obj.obj.Metrics = value.msg() - - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *flow) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the Flow object -func (obj *flow) SetName(value string) Flow { - - obj.obj.Name = &value - return obj -} - -func (obj *flow) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // TxRx is required - if obj.obj.TxRx == nil { - vObj.validationErrors = append(vObj.validationErrors, "TxRx is required field on interface Flow") - } - - if obj.obj.TxRx != nil { - - obj.TxRx().validateObj(vObj, set_default) - } - - if len(obj.obj.Packet) != 0 { - - if set_default { - obj.Packet().clearHolderSlice() - for _, item := range obj.obj.Packet { - obj.Packet().appendHolderSlice(&flowHeader{obj: item}) - } - } - for _, item := range obj.Packet().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.EgressPacket) != 0 { - - if set_default { - obj.EgressPacket().clearHolderSlice() - for _, item := range obj.obj.EgressPacket { - obj.EgressPacket().appendHolderSlice(&flowHeader{obj: item}) - } - } - for _, item := range obj.EgressPacket().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Size != nil { - - obj.Size().validateObj(vObj, set_default) - } - - if obj.obj.Rate != nil { - - obj.Rate().validateObj(vObj, set_default) - } - - if obj.obj.Duration != nil { - - obj.Duration().validateObj(vObj, set_default) - } - - if obj.obj.Metrics != nil { - - obj.Metrics().validateObj(vObj, set_default) - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface Flow") - } -} - -func (obj *flow) setDefault() { - -} - -// ***** Event ***** -type event struct { - validation - obj *otg.Event - marshaller marshalEvent - unMarshaller unMarshalEvent - linkHolder EventLink - rxRateThresholdHolder EventRxRateThreshold - routeAdvertiseWithdrawHolder EventRouteAdvertiseWithdraw -} - -func NewEvent() Event { - obj := event{obj: &otg.Event{}} - obj.setDefault() - return &obj -} - -func (obj *event) msg() *otg.Event { - return obj.obj -} - -func (obj *event) setMsg(msg *otg.Event) Event { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalevent struct { - obj *event -} - -type marshalEvent interface { - // ToProto marshals Event to protobuf object *otg.Event - ToProto() (*otg.Event, error) - // ToPbText marshals Event to protobuf text - ToPbText() (string, error) - // ToYaml marshals Event to YAML text - ToYaml() (string, error) - // ToJson marshals Event to JSON text - ToJson() (string, error) -} - -type unMarshalevent struct { - obj *event -} - -type unMarshalEvent interface { - // FromProto unmarshals Event from protobuf object *otg.Event - FromProto(msg *otg.Event) (Event, error) - // FromPbText unmarshals Event from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Event from YAML text - FromYaml(value string) error - // FromJson unmarshals Event from JSON text - FromJson(value string) error -} - -func (obj *event) Marshal() marshalEvent { - if obj.marshaller == nil { - obj.marshaller = &marshalevent{obj: obj} - } - return obj.marshaller -} - -func (obj *event) Unmarshal() unMarshalEvent { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalevent{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalevent) ToProto() (*otg.Event, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalevent) FromProto(msg *otg.Event) (Event, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalevent) 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 *unMarshalevent) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalevent) 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 *unMarshalevent) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalevent) 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 *unMarshalevent) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *event) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *event) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *event) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *event) Clone() (Event, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewEvent() - 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 -} - -func (obj *event) setNil() { - obj.linkHolder = nil - obj.rxRateThresholdHolder = nil - obj.routeAdvertiseWithdrawHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// Event is the optional container for event configuration. -type Event interface { - Validation - // msg marshals Event to protobuf object *otg.Event - // and doesn't set defaults - msg() *otg.Event - // setMsg unmarshals Event from protobuf object *otg.Event - // and doesn't set defaults - setMsg(*otg.Event) Event - // provides marshal interface - Marshal() marshalEvent - // provides unmarshal interface - Unmarshal() unMarshalEvent - // validate validates Event - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Event, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Enable returns bool, set in Event. - Enable() bool - // SetEnable assigns bool provided by user to Event - SetEnable(value bool) Event - // HasEnable checks if Enable has been set in Event - HasEnable() bool - // Link returns EventLink, set in Event. - // EventLink is the optional container for link up/down event configuration. - Link() EventLink - // SetLink assigns EventLink provided by user to Event. - // EventLink is the optional container for link up/down event configuration. - SetLink(value EventLink) Event - // HasLink checks if Link has been set in Event - HasLink() bool - // RxRateThreshold returns EventRxRateThreshold, set in Event. - // EventRxRateThreshold is the optional container for rx rate threshold event configuration. - RxRateThreshold() EventRxRateThreshold - // SetRxRateThreshold assigns EventRxRateThreshold provided by user to Event. - // EventRxRateThreshold is the optional container for rx rate threshold event configuration. - SetRxRateThreshold(value EventRxRateThreshold) Event - // HasRxRateThreshold checks if RxRateThreshold has been set in Event - HasRxRateThreshold() bool - // RouteAdvertiseWithdraw returns EventRouteAdvertiseWithdraw, set in Event. - // EventRouteAdvertiseWithdraw is the optional container for route advertise/withdraw event configuration. - RouteAdvertiseWithdraw() EventRouteAdvertiseWithdraw - // SetRouteAdvertiseWithdraw assigns EventRouteAdvertiseWithdraw provided by user to Event. - // EventRouteAdvertiseWithdraw is the optional container for route advertise/withdraw event configuration. - SetRouteAdvertiseWithdraw(value EventRouteAdvertiseWithdraw) Event - // HasRouteAdvertiseWithdraw checks if RouteAdvertiseWithdraw has been set in Event - HasRouteAdvertiseWithdraw() bool - setNil() -} - -// True to enable all events. -// Enabling this option may affect the resultant packet payload due to -// additional instrumentation data. -// Enable returns a bool -func (obj *event) Enable() bool { - - return *obj.obj.Enable - -} - -// True to enable all events. -// Enabling this option may affect the resultant packet payload due to -// additional instrumentation data. -// Enable returns a bool -func (obj *event) HasEnable() bool { - return obj.obj.Enable != nil -} - -// True to enable all events. -// Enabling this option may affect the resultant packet payload due to -// additional instrumentation data. -// SetEnable sets the bool value in the Event object -func (obj *event) SetEnable(value bool) Event { - - obj.obj.Enable = &value - return obj -} - -// description is TBD -// Link returns a EventLink -func (obj *event) Link() EventLink { - if obj.obj.Link == nil { - obj.obj.Link = NewEventLink().msg() - } - if obj.linkHolder == nil { - obj.linkHolder = &eventLink{obj: obj.obj.Link} - } - return obj.linkHolder -} - -// description is TBD -// Link returns a EventLink -func (obj *event) HasLink() bool { - return obj.obj.Link != nil -} - -// description is TBD -// SetLink sets the EventLink value in the Event object -func (obj *event) SetLink(value EventLink) Event { - - obj.linkHolder = nil - obj.obj.Link = value.msg() - - return obj -} - -// description is TBD -// RxRateThreshold returns a EventRxRateThreshold -func (obj *event) RxRateThreshold() EventRxRateThreshold { - if obj.obj.RxRateThreshold == nil { - obj.obj.RxRateThreshold = NewEventRxRateThreshold().msg() - } - if obj.rxRateThresholdHolder == nil { - obj.rxRateThresholdHolder = &eventRxRateThreshold{obj: obj.obj.RxRateThreshold} - } - return obj.rxRateThresholdHolder -} - -// description is TBD -// RxRateThreshold returns a EventRxRateThreshold -func (obj *event) HasRxRateThreshold() bool { - return obj.obj.RxRateThreshold != nil -} - -// description is TBD -// SetRxRateThreshold sets the EventRxRateThreshold value in the Event object -func (obj *event) SetRxRateThreshold(value EventRxRateThreshold) Event { - - obj.rxRateThresholdHolder = nil - obj.obj.RxRateThreshold = value.msg() - - return obj -} - -// description is TBD -// RouteAdvertiseWithdraw returns a EventRouteAdvertiseWithdraw -func (obj *event) RouteAdvertiseWithdraw() EventRouteAdvertiseWithdraw { - if obj.obj.RouteAdvertiseWithdraw == nil { - obj.obj.RouteAdvertiseWithdraw = NewEventRouteAdvertiseWithdraw().msg() - } - if obj.routeAdvertiseWithdrawHolder == nil { - obj.routeAdvertiseWithdrawHolder = &eventRouteAdvertiseWithdraw{obj: obj.obj.RouteAdvertiseWithdraw} - } - return obj.routeAdvertiseWithdrawHolder -} - -// description is TBD -// RouteAdvertiseWithdraw returns a EventRouteAdvertiseWithdraw -func (obj *event) HasRouteAdvertiseWithdraw() bool { - return obj.obj.RouteAdvertiseWithdraw != nil -} - -// description is TBD -// SetRouteAdvertiseWithdraw sets the EventRouteAdvertiseWithdraw value in the Event object -func (obj *event) SetRouteAdvertiseWithdraw(value EventRouteAdvertiseWithdraw) Event { - - obj.routeAdvertiseWithdrawHolder = nil - obj.obj.RouteAdvertiseWithdraw = value.msg() - - return obj -} - -func (obj *event) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Link != nil { - - obj.Link().validateObj(vObj, set_default) - } - - if obj.obj.RxRateThreshold != nil { - - obj.RxRateThreshold().validateObj(vObj, set_default) - } - - if obj.obj.RouteAdvertiseWithdraw != nil { - - obj.RouteAdvertiseWithdraw().validateObj(vObj, set_default) - } - -} - -func (obj *event) setDefault() { - if obj.obj.Enable == nil { - obj.SetEnable(false) - } - -} - -// ***** ConfigOptions ***** -type configOptions struct { - validation - obj *otg.ConfigOptions - marshaller marshalConfigOptions - unMarshaller unMarshalConfigOptions - portOptionsHolder PortOptions - protocolOptionsHolder ProtocolOptions -} - -func NewConfigOptions() ConfigOptions { - obj := configOptions{obj: &otg.ConfigOptions{}} - obj.setDefault() - return &obj -} - -func (obj *configOptions) msg() *otg.ConfigOptions { - return obj.obj -} - -func (obj *configOptions) setMsg(msg *otg.ConfigOptions) ConfigOptions { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalconfigOptions struct { - obj *configOptions -} - -type marshalConfigOptions interface { - // ToProto marshals ConfigOptions to protobuf object *otg.ConfigOptions - ToProto() (*otg.ConfigOptions, error) - // ToPbText marshals ConfigOptions to protobuf text - ToPbText() (string, error) - // ToYaml marshals ConfigOptions to YAML text - ToYaml() (string, error) - // ToJson marshals ConfigOptions to JSON text - ToJson() (string, error) -} - -type unMarshalconfigOptions struct { - obj *configOptions -} - -type unMarshalConfigOptions interface { - // FromProto unmarshals ConfigOptions from protobuf object *otg.ConfigOptions - FromProto(msg *otg.ConfigOptions) (ConfigOptions, error) - // FromPbText unmarshals ConfigOptions from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ConfigOptions from YAML text - FromYaml(value string) error - // FromJson unmarshals ConfigOptions from JSON text - FromJson(value string) error -} - -func (obj *configOptions) Marshal() marshalConfigOptions { - if obj.marshaller == nil { - obj.marshaller = &marshalconfigOptions{obj: obj} - } - return obj.marshaller -} - -func (obj *configOptions) Unmarshal() unMarshalConfigOptions { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalconfigOptions{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalconfigOptions) ToProto() (*otg.ConfigOptions, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalconfigOptions) FromProto(msg *otg.ConfigOptions) (ConfigOptions, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalconfigOptions) 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 *unMarshalconfigOptions) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalconfigOptions) 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 *unMarshalconfigOptions) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalconfigOptions) 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 *unMarshalconfigOptions) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *configOptions) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *configOptions) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *configOptions) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *configOptions) Clone() (ConfigOptions, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewConfigOptions() - 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 -} - -func (obj *configOptions) setNil() { - obj.portOptionsHolder = nil - obj.protocolOptionsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ConfigOptions is global configuration options. -type ConfigOptions interface { - Validation - // msg marshals ConfigOptions to protobuf object *otg.ConfigOptions - // and doesn't set defaults - msg() *otg.ConfigOptions - // setMsg unmarshals ConfigOptions from protobuf object *otg.ConfigOptions - // and doesn't set defaults - setMsg(*otg.ConfigOptions) ConfigOptions - // provides marshal interface - Marshal() marshalConfigOptions - // provides unmarshal interface - Unmarshal() unMarshalConfigOptions - // validate validates ConfigOptions - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ConfigOptions, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PortOptions returns PortOptions, set in ConfigOptions. - // PortOptions is common port options that apply to all configured Port objects. - PortOptions() PortOptions - // SetPortOptions assigns PortOptions provided by user to ConfigOptions. - // PortOptions is common port options that apply to all configured Port objects. - SetPortOptions(value PortOptions) ConfigOptions - // HasPortOptions checks if PortOptions has been set in ConfigOptions - HasPortOptions() bool - // ProtocolOptions returns ProtocolOptions, set in ConfigOptions. - // ProtocolOptions is common options that apply to all configured protocols and interfaces. - ProtocolOptions() ProtocolOptions - // SetProtocolOptions assigns ProtocolOptions provided by user to ConfigOptions. - // ProtocolOptions is common options that apply to all configured protocols and interfaces. - SetProtocolOptions(value ProtocolOptions) ConfigOptions - // HasProtocolOptions checks if ProtocolOptions has been set in ConfigOptions - HasProtocolOptions() bool - setNil() -} - -// description is TBD -// PortOptions returns a PortOptions -func (obj *configOptions) PortOptions() PortOptions { - if obj.obj.PortOptions == nil { - obj.obj.PortOptions = NewPortOptions().msg() - } - if obj.portOptionsHolder == nil { - obj.portOptionsHolder = &portOptions{obj: obj.obj.PortOptions} - } - return obj.portOptionsHolder -} - -// description is TBD -// PortOptions returns a PortOptions -func (obj *configOptions) HasPortOptions() bool { - return obj.obj.PortOptions != nil -} - -// description is TBD -// SetPortOptions sets the PortOptions value in the ConfigOptions object -func (obj *configOptions) SetPortOptions(value PortOptions) ConfigOptions { - - obj.portOptionsHolder = nil - obj.obj.PortOptions = value.msg() - - return obj -} - -// description is TBD -// ProtocolOptions returns a ProtocolOptions -func (obj *configOptions) ProtocolOptions() ProtocolOptions { - if obj.obj.ProtocolOptions == nil { - obj.obj.ProtocolOptions = NewProtocolOptions().msg() - } - if obj.protocolOptionsHolder == nil { - obj.protocolOptionsHolder = &protocolOptions{obj: obj.obj.ProtocolOptions} - } - return obj.protocolOptionsHolder -} - -// description is TBD -// ProtocolOptions returns a ProtocolOptions -func (obj *configOptions) HasProtocolOptions() bool { - return obj.obj.ProtocolOptions != nil -} - -// description is TBD -// SetProtocolOptions sets the ProtocolOptions value in the ConfigOptions object -func (obj *configOptions) SetProtocolOptions(value ProtocolOptions) ConfigOptions { - - obj.protocolOptionsHolder = nil - obj.obj.ProtocolOptions = value.msg() - - return obj -} - -func (obj *configOptions) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.PortOptions != nil { - - obj.PortOptions().validateObj(vObj, set_default) - } - - if obj.obj.ProtocolOptions != nil { - - obj.ProtocolOptions().validateObj(vObj, set_default) - } - -} - -func (obj *configOptions) setDefault() { - -} - -// ***** Lldp ***** -type lldp struct { - validation - obj *otg.Lldp - marshaller marshalLldp - unMarshaller unMarshalLldp - connectionHolder LldpConnection - chassisIdHolder LldpChassisId - portIdHolder LldpPortId - systemNameHolder LldpSystemName -} - -func NewLldp() Lldp { - obj := lldp{obj: &otg.Lldp{}} - obj.setDefault() - return &obj -} - -func (obj *lldp) msg() *otg.Lldp { - return obj.obj -} - -func (obj *lldp) setMsg(msg *otg.Lldp) Lldp { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshallldp struct { - obj *lldp -} - -type marshalLldp interface { - // ToProto marshals Lldp to protobuf object *otg.Lldp - ToProto() (*otg.Lldp, error) - // ToPbText marshals Lldp to protobuf text - ToPbText() (string, error) - // ToYaml marshals Lldp to YAML text - ToYaml() (string, error) - // ToJson marshals Lldp to JSON text - ToJson() (string, error) -} - -type unMarshallldp struct { - obj *lldp -} - -type unMarshalLldp interface { - // FromProto unmarshals Lldp from protobuf object *otg.Lldp - FromProto(msg *otg.Lldp) (Lldp, error) - // FromPbText unmarshals Lldp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Lldp from YAML text - FromYaml(value string) error - // FromJson unmarshals Lldp from JSON text - FromJson(value string) error -} - -func (obj *lldp) Marshal() marshalLldp { - if obj.marshaller == nil { - obj.marshaller = &marshallldp{obj: obj} - } - return obj.marshaller -} - -func (obj *lldp) Unmarshal() unMarshalLldp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallldp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallldp) ToProto() (*otg.Lldp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallldp) FromProto(msg *otg.Lldp) (Lldp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallldp) 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 *unMarshallldp) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshallldp) 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 *unMarshallldp) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshallldp) 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 *unMarshallldp) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *lldp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lldp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lldp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lldp) Clone() (Lldp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLldp() - 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 -} - -func (obj *lldp) setNil() { - obj.connectionHolder = nil - obj.chassisIdHolder = nil - obj.portIdHolder = nil - obj.systemNameHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// Lldp is configuration of LLDP protocol IEEE Ref: https://www.ieee802.org/1/files/public/docs2002/lldp-protocol-00.pdf -type Lldp interface { - Validation - // msg marshals Lldp to protobuf object *otg.Lldp - // and doesn't set defaults - msg() *otg.Lldp - // setMsg unmarshals Lldp from protobuf object *otg.Lldp - // and doesn't set defaults - setMsg(*otg.Lldp) Lldp - // provides marshal interface - Marshal() marshalLldp - // provides unmarshal interface - Unmarshal() unMarshalLldp - // validate validates Lldp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Lldp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Connection returns LldpConnection, set in Lldp. - // LldpConnection is lLDP connection to a test port. In future if more connection options arise LLDP connection object will be enhanced. - Connection() LldpConnection - // SetConnection assigns LldpConnection provided by user to Lldp. - // LldpConnection is lLDP connection to a test port. In future if more connection options arise LLDP connection object will be enhanced. - SetConnection(value LldpConnection) Lldp - // ChassisId returns LldpChassisId, set in Lldp. - // LldpChassisId is the Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. This field identifies the format and source of the chassis identifier string. It is based on the enumerator defined by the LldpChassisIdSubtype object from IEEE 802.1AB MIB. - ChassisId() LldpChassisId - // SetChassisId assigns LldpChassisId provided by user to Lldp. - // LldpChassisId is the Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. This field identifies the format and source of the chassis identifier string. It is based on the enumerator defined by the LldpChassisIdSubtype object from IEEE 802.1AB MIB. - SetChassisId(value LldpChassisId) Lldp - // HasChassisId checks if ChassisId has been set in Lldp - HasChassisId() bool - // PortId returns LldpPortId, set in Lldp. - // LldpPortId is the Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent.This field identifies the format and source of the port identifier string. It is based on the enumerator defined by the PtopoPortIdType object from RFC2922. - PortId() LldpPortId - // SetPortId assigns LldpPortId provided by user to Lldp. - // LldpPortId is the Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent.This field identifies the format and source of the port identifier string. It is based on the enumerator defined by the PtopoPortIdType object from RFC2922. - SetPortId(value LldpPortId) Lldp - // HasPortId checks if PortId has been set in Lldp - HasPortId() bool - // SystemName returns LldpSystemName, set in Lldp. - // LldpSystemName is the system Name configured in the System Name TLV. - SystemName() LldpSystemName - // SetSystemName assigns LldpSystemName provided by user to Lldp. - // LldpSystemName is the system Name configured in the System Name TLV. - SetSystemName(value LldpSystemName) Lldp - // HasSystemName checks if SystemName has been set in Lldp - HasSystemName() bool - // HoldTime returns uint32, set in Lldp. - HoldTime() uint32 - // SetHoldTime assigns uint32 provided by user to Lldp - SetHoldTime(value uint32) Lldp - // HasHoldTime checks if HoldTime has been set in Lldp - HasHoldTime() bool - // AdvertisementInterval returns uint32, set in Lldp. - AdvertisementInterval() uint32 - // SetAdvertisementInterval assigns uint32 provided by user to Lldp - SetAdvertisementInterval(value uint32) Lldp - // HasAdvertisementInterval checks if AdvertisementInterval has been set in Lldp - HasAdvertisementInterval() bool - // Name returns string, set in Lldp. - Name() string - // SetName assigns string provided by user to Lldp - SetName(value string) Lldp - setNil() -} - -// The unique name of the object on which LLDP is running. -// Connection returns a LldpConnection -func (obj *lldp) Connection() LldpConnection { - if obj.obj.Connection == nil { - obj.obj.Connection = NewLldpConnection().msg() - } - if obj.connectionHolder == nil { - obj.connectionHolder = &lldpConnection{obj: obj.obj.Connection} - } - return obj.connectionHolder -} - -// The unique name of the object on which LLDP is running. -// SetConnection sets the LldpConnection value in the Lldp object -func (obj *lldp) SetConnection(value LldpConnection) Lldp { - - obj.connectionHolder = nil - obj.obj.Connection = value.msg() - - return obj -} - -// The Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. If mac address is specified it should be in colon seperated mac address format. -// ChassisId returns a LldpChassisId -func (obj *lldp) ChassisId() LldpChassisId { - if obj.obj.ChassisId == nil { - obj.obj.ChassisId = NewLldpChassisId().msg() - } - if obj.chassisIdHolder == nil { - obj.chassisIdHolder = &lldpChassisId{obj: obj.obj.ChassisId} - } - return obj.chassisIdHolder -} - -// The Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. If mac address is specified it should be in colon seperated mac address format. -// ChassisId returns a LldpChassisId -func (obj *lldp) HasChassisId() bool { - return obj.obj.ChassisId != nil -} - -// The Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. If mac address is specified it should be in colon seperated mac address format. -// SetChassisId sets the LldpChassisId value in the Lldp object -func (obj *lldp) SetChassisId(value LldpChassisId) Lldp { - - obj.chassisIdHolder = nil - obj.obj.ChassisId = value.msg() - - return obj -} - -// The Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent. If the specified port is an IEEE 802.3 Repeater port, then this TLV is optional. -// PortId returns a LldpPortId -func (obj *lldp) PortId() LldpPortId { - if obj.obj.PortId == nil { - obj.obj.PortId = NewLldpPortId().msg() - } - if obj.portIdHolder == nil { - obj.portIdHolder = &lldpPortId{obj: obj.obj.PortId} - } - return obj.portIdHolder -} - -// The Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent. If the specified port is an IEEE 802.3 Repeater port, then this TLV is optional. -// PortId returns a LldpPortId -func (obj *lldp) HasPortId() bool { - return obj.obj.PortId != nil -} - -// The Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent. If the specified port is an IEEE 802.3 Repeater port, then this TLV is optional. -// SetPortId sets the LldpPortId value in the Lldp object -func (obj *lldp) SetPortId(value LldpPortId) Lldp { - - obj.portIdHolder = nil - obj.obj.PortId = value.msg() - - return obj -} - -// The system name field shall contain an alpha-numeric string that indicates the system's administratively assigned name. The system name should be the system's fully qualified domain name. If implementations support IETF RFC 3418, the sysName object should be used for this field. -// SystemName returns a LldpSystemName -func (obj *lldp) SystemName() LldpSystemName { - if obj.obj.SystemName == nil { - obj.obj.SystemName = NewLldpSystemName().msg() - } - if obj.systemNameHolder == nil { - obj.systemNameHolder = &lldpSystemName{obj: obj.obj.SystemName} - } - return obj.systemNameHolder -} - -// The system name field shall contain an alpha-numeric string that indicates the system's administratively assigned name. The system name should be the system's fully qualified domain name. If implementations support IETF RFC 3418, the sysName object should be used for this field. -// SystemName returns a LldpSystemName -func (obj *lldp) HasSystemName() bool { - return obj.obj.SystemName != nil -} - -// The system name field shall contain an alpha-numeric string that indicates the system's administratively assigned name. The system name should be the system's fully qualified domain name. If implementations support IETF RFC 3418, the sysName object should be used for this field. -// SetSystemName sets the LldpSystemName value in the Lldp object -func (obj *lldp) SetSystemName(value LldpSystemName) Lldp { - - obj.systemNameHolder = nil - obj.obj.SystemName = value.msg() - - return obj -} - -// Specifies the amount of time in seconds a receiving device should maintain LLDP information sent by the device before discarding it. -// HoldTime returns a uint32 -func (obj *lldp) HoldTime() uint32 { - - return *obj.obj.HoldTime - -} - -// Specifies the amount of time in seconds a receiving device should maintain LLDP information sent by the device before discarding it. -// HoldTime returns a uint32 -func (obj *lldp) HasHoldTime() bool { - return obj.obj.HoldTime != nil -} - -// Specifies the amount of time in seconds a receiving device should maintain LLDP information sent by the device before discarding it. -// SetHoldTime sets the uint32 value in the Lldp object -func (obj *lldp) SetHoldTime(value uint32) Lldp { - - obj.obj.HoldTime = &value - return obj -} - -// Set the transmission frequency of LLDP updates in seconds. -// AdvertisementInterval returns a uint32 -func (obj *lldp) AdvertisementInterval() uint32 { - - return *obj.obj.AdvertisementInterval - -} - -// Set the transmission frequency of LLDP updates in seconds. -// AdvertisementInterval returns a uint32 -func (obj *lldp) HasAdvertisementInterval() bool { - return obj.obj.AdvertisementInterval != nil -} - -// Set the transmission frequency of LLDP updates in seconds. -// SetAdvertisementInterval sets the uint32 value in the Lldp object -func (obj *lldp) SetAdvertisementInterval(value uint32) Lldp { - - obj.obj.AdvertisementInterval = &value - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *lldp) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the Lldp object -func (obj *lldp) SetName(value string) Lldp { - - obj.obj.Name = &value - return obj -} - -func (obj *lldp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Connection is required - if obj.obj.Connection == nil { - vObj.validationErrors = append(vObj.validationErrors, "Connection is required field on interface Lldp") - } - - if obj.obj.Connection != nil { - - obj.Connection().validateObj(vObj, set_default) - } - - if obj.obj.ChassisId != nil { - - obj.ChassisId().validateObj(vObj, set_default) - } - - if obj.obj.PortId != nil { - - obj.PortId().validateObj(vObj, set_default) - } - - if obj.obj.SystemName != nil { - - obj.SystemName().validateObj(vObj, set_default) - } - - if obj.obj.HoldTime != nil { - - if *obj.obj.HoldTime < 10 || *obj.obj.HoldTime > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("10 <= Lldp.HoldTime <= 65535 but Got %d", *obj.obj.HoldTime)) - } - - } - - if obj.obj.AdvertisementInterval != nil { - - if *obj.obj.AdvertisementInterval < 5 || *obj.obj.AdvertisementInterval > 65534 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("5 <= Lldp.AdvertisementInterval <= 65534 but Got %d", *obj.obj.AdvertisementInterval)) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface Lldp") - } -} - -func (obj *lldp) setDefault() { - if obj.obj.HoldTime == nil { - obj.SetHoldTime(120) - } - if obj.obj.AdvertisementInterval == nil { - obj.SetAdvertisementInterval(30) - } - -} - -// ***** FlowsUpdate ***** -type flowsUpdate struct { - validation - obj *otg.FlowsUpdate - marshaller marshalFlowsUpdate - unMarshaller unMarshalFlowsUpdate - flowsHolder FlowsUpdateFlowIter -} - -func NewFlowsUpdate() FlowsUpdate { - obj := flowsUpdate{obj: &otg.FlowsUpdate{}} - obj.setDefault() - return &obj -} - -func (obj *flowsUpdate) msg() *otg.FlowsUpdate { - return obj.obj -} - -func (obj *flowsUpdate) setMsg(msg *otg.FlowsUpdate) FlowsUpdate { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowsUpdate struct { - obj *flowsUpdate -} - -type marshalFlowsUpdate interface { - // ToProto marshals FlowsUpdate to protobuf object *otg.FlowsUpdate - ToProto() (*otg.FlowsUpdate, error) - // ToPbText marshals FlowsUpdate to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowsUpdate to YAML text - ToYaml() (string, error) - // ToJson marshals FlowsUpdate to JSON text - ToJson() (string, error) -} - -type unMarshalflowsUpdate struct { - obj *flowsUpdate -} - -type unMarshalFlowsUpdate interface { - // FromProto unmarshals FlowsUpdate from protobuf object *otg.FlowsUpdate - FromProto(msg *otg.FlowsUpdate) (FlowsUpdate, error) - // FromPbText unmarshals FlowsUpdate from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowsUpdate from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowsUpdate from JSON text - FromJson(value string) error -} - -func (obj *flowsUpdate) Marshal() marshalFlowsUpdate { - if obj.marshaller == nil { - obj.marshaller = &marshalflowsUpdate{obj: obj} - } - return obj.marshaller -} - -func (obj *flowsUpdate) Unmarshal() unMarshalFlowsUpdate { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowsUpdate{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowsUpdate) ToProto() (*otg.FlowsUpdate, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowsUpdate) FromProto(msg *otg.FlowsUpdate) (FlowsUpdate, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowsUpdate) 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 *unMarshalflowsUpdate) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowsUpdate) 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 *unMarshalflowsUpdate) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowsUpdate) 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 *unMarshalflowsUpdate) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowsUpdate) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowsUpdate) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowsUpdate) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowsUpdate) Clone() (FlowsUpdate, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowsUpdate() - 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 -} - -func (obj *flowsUpdate) setNil() { - obj.flowsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowsUpdate is a container of flows with associated properties to be updated without affecting the flows current transmit state. -type FlowsUpdate interface { - Validation - // msg marshals FlowsUpdate to protobuf object *otg.FlowsUpdate - // and doesn't set defaults - msg() *otg.FlowsUpdate - // setMsg unmarshals FlowsUpdate from protobuf object *otg.FlowsUpdate - // and doesn't set defaults - setMsg(*otg.FlowsUpdate) FlowsUpdate - // provides marshal interface - Marshal() marshalFlowsUpdate - // provides unmarshal interface - Unmarshal() unMarshalFlowsUpdate - // validate validates FlowsUpdate - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowsUpdate, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PropertyNames returns []FlowsUpdatePropertyNamesEnum, set in FlowsUpdate - PropertyNames() []FlowsUpdatePropertyNamesEnum - // SetPropertyNames assigns []FlowsUpdatePropertyNamesEnum provided by user to FlowsUpdate - SetPropertyNames(value []FlowsUpdatePropertyNamesEnum) FlowsUpdate - // Flows returns FlowsUpdateFlowIterIter, set in FlowsUpdate - Flows() FlowsUpdateFlowIter - setNil() -} - -type FlowsUpdatePropertyNamesEnum string - -// Enum of PropertyNames on FlowsUpdate -var FlowsUpdatePropertyNames = struct { - RATE FlowsUpdatePropertyNamesEnum - SIZE FlowsUpdatePropertyNamesEnum -}{ - RATE: FlowsUpdatePropertyNamesEnum("rate"), - SIZE: FlowsUpdatePropertyNamesEnum("size"), -} - -func (obj *flowsUpdate) PropertyNames() []FlowsUpdatePropertyNamesEnum { - items := []FlowsUpdatePropertyNamesEnum{} - for _, item := range obj.obj.PropertyNames { - items = append(items, FlowsUpdatePropertyNamesEnum(item.String())) - } - return items -} - -// Flow properties to be updated without affecting the transmit state. -// SetPropertyNames sets the []string value in the FlowsUpdate object -func (obj *flowsUpdate) SetPropertyNames(value []FlowsUpdatePropertyNamesEnum) FlowsUpdate { - - items := []otg.FlowsUpdate_PropertyNames_Enum{} - for _, item := range value { - intValue := otg.FlowsUpdate_PropertyNames_Enum_value[string(item)] - items = append(items, otg.FlowsUpdate_PropertyNames_Enum(intValue)) - } - obj.obj.PropertyNames = items - return obj -} - -// The list of configured flows for which given property will be updated. -// Flows returns a []Flow -func (obj *flowsUpdate) Flows() FlowsUpdateFlowIter { - if len(obj.obj.Flows) == 0 { - obj.obj.Flows = []*otg.Flow{} - } - if obj.flowsHolder == nil { - obj.flowsHolder = newFlowsUpdateFlowIter(&obj.obj.Flows).setMsg(obj) - } - return obj.flowsHolder -} - -type flowsUpdateFlowIter struct { - obj *flowsUpdate - flowSlice []Flow - fieldPtr *[]*otg.Flow -} - -func newFlowsUpdateFlowIter(ptr *[]*otg.Flow) FlowsUpdateFlowIter { - return &flowsUpdateFlowIter{fieldPtr: ptr} -} - -type FlowsUpdateFlowIter interface { - setMsg(*flowsUpdate) FlowsUpdateFlowIter - Items() []Flow - Add() Flow - Append(items ...Flow) FlowsUpdateFlowIter - Set(index int, newObj Flow) FlowsUpdateFlowIter - Clear() FlowsUpdateFlowIter - clearHolderSlice() FlowsUpdateFlowIter - appendHolderSlice(item Flow) FlowsUpdateFlowIter -} - -func (obj *flowsUpdateFlowIter) setMsg(msg *flowsUpdate) FlowsUpdateFlowIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flow{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *flowsUpdateFlowIter) Items() []Flow { - return obj.flowSlice -} - -func (obj *flowsUpdateFlowIter) Add() Flow { - newObj := &otg.Flow{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flow{obj: newObj} - newLibObj.setDefault() - obj.flowSlice = append(obj.flowSlice, newLibObj) - return newLibObj -} - -func (obj *flowsUpdateFlowIter) Append(items ...Flow) FlowsUpdateFlowIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowSlice = append(obj.flowSlice, item) - } - return obj -} - -func (obj *flowsUpdateFlowIter) Set(index int, newObj Flow) FlowsUpdateFlowIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowSlice[index] = newObj - return obj -} -func (obj *flowsUpdateFlowIter) Clear() FlowsUpdateFlowIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Flow{} - obj.flowSlice = []Flow{} - } - return obj -} -func (obj *flowsUpdateFlowIter) clearHolderSlice() FlowsUpdateFlowIter { - if len(obj.flowSlice) > 0 { - obj.flowSlice = []Flow{} - } - return obj -} -func (obj *flowsUpdateFlowIter) appendHolderSlice(item Flow) FlowsUpdateFlowIter { - obj.flowSlice = append(obj.flowSlice, item) - return obj -} - -func (obj *flowsUpdate) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Flows) != 0 { - - if set_default { - obj.Flows().clearHolderSlice() - for _, item := range obj.obj.Flows { - obj.Flows().appendHolderSlice(&flow{obj: item}) - } - } - for _, item := range obj.Flows().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *flowsUpdate) setDefault() { - -} - -// ***** StatePort ***** -type statePort struct { - validation - obj *otg.StatePort - marshaller marshalStatePort - unMarshaller unMarshalStatePort - linkHolder StatePortLink - captureHolder StatePortCapture -} - -func NewStatePort() StatePort { - obj := statePort{obj: &otg.StatePort{}} - obj.setDefault() - return &obj -} - -func (obj *statePort) msg() *otg.StatePort { - return obj.obj -} - -func (obj *statePort) setMsg(msg *otg.StatePort) StatePort { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstatePort struct { - obj *statePort -} - -type marshalStatePort interface { - // ToProto marshals StatePort to protobuf object *otg.StatePort - ToProto() (*otg.StatePort, error) - // ToPbText marshals StatePort to protobuf text - ToPbText() (string, error) - // ToYaml marshals StatePort to YAML text - ToYaml() (string, error) - // ToJson marshals StatePort to JSON text - ToJson() (string, error) -} - -type unMarshalstatePort struct { - obj *statePort -} - -type unMarshalStatePort interface { - // FromProto unmarshals StatePort from protobuf object *otg.StatePort - FromProto(msg *otg.StatePort) (StatePort, error) - // FromPbText unmarshals StatePort from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StatePort from YAML text - FromYaml(value string) error - // FromJson unmarshals StatePort from JSON text - FromJson(value string) error -} - -func (obj *statePort) Marshal() marshalStatePort { - if obj.marshaller == nil { - obj.marshaller = &marshalstatePort{obj: obj} - } - return obj.marshaller -} - -func (obj *statePort) Unmarshal() unMarshalStatePort { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstatePort{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstatePort) ToProto() (*otg.StatePort, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstatePort) FromProto(msg *otg.StatePort) (StatePort, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstatePort) 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 *unMarshalstatePort) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalstatePort) 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 *unMarshalstatePort) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalstatePort) 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 *unMarshalstatePort) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *statePort) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *statePort) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *statePort) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *statePort) Clone() (StatePort, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStatePort() - 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 -} - -func (obj *statePort) setNil() { - obj.linkHolder = nil - obj.captureHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// StatePort is states associated with configured ports. -type StatePort interface { - Validation - // msg marshals StatePort to protobuf object *otg.StatePort - // and doesn't set defaults - msg() *otg.StatePort - // setMsg unmarshals StatePort from protobuf object *otg.StatePort - // and doesn't set defaults - setMsg(*otg.StatePort) StatePort - // provides marshal interface - Marshal() marshalStatePort - // provides unmarshal interface - Unmarshal() unMarshalStatePort - // validate validates StatePort - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StatePort, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns StatePortChoiceEnum, set in StatePort - Choice() StatePortChoiceEnum - // setChoice assigns StatePortChoiceEnum provided by user to StatePort - setChoice(value StatePortChoiceEnum) StatePort - // Link returns StatePortLink, set in StatePort. - // StatePortLink is sets the link of configured ports. - Link() StatePortLink - // SetLink assigns StatePortLink provided by user to StatePort. - // StatePortLink is sets the link of configured ports. - SetLink(value StatePortLink) StatePort - // HasLink checks if Link has been set in StatePort - HasLink() bool - // Capture returns StatePortCapture, set in StatePort. - // StatePortCapture is sets the capture state of configured ports - Capture() StatePortCapture - // SetCapture assigns StatePortCapture provided by user to StatePort. - // StatePortCapture is sets the capture state of configured ports - SetCapture(value StatePortCapture) StatePort - // HasCapture checks if Capture has been set in StatePort - HasCapture() bool - setNil() -} - -type StatePortChoiceEnum string - -// Enum of Choice on StatePort -var StatePortChoice = struct { - LINK StatePortChoiceEnum - CAPTURE StatePortChoiceEnum -}{ - LINK: StatePortChoiceEnum("link"), - CAPTURE: StatePortChoiceEnum("capture"), -} - -func (obj *statePort) Choice() StatePortChoiceEnum { - return StatePortChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *statePort) setChoice(value StatePortChoiceEnum) StatePort { - intValue, ok := otg.StatePort_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StatePortChoiceEnum", string(value))) - return obj - } - enumValue := otg.StatePort_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Capture = nil - obj.captureHolder = nil - obj.obj.Link = nil - obj.linkHolder = nil - - if value == StatePortChoice.LINK { - obj.obj.Link = NewStatePortLink().msg() - } - - if value == StatePortChoice.CAPTURE { - obj.obj.Capture = NewStatePortCapture().msg() - } - - return obj -} - -// description is TBD -// Link returns a StatePortLink -func (obj *statePort) Link() StatePortLink { - if obj.obj.Link == nil { - obj.setChoice(StatePortChoice.LINK) - } - if obj.linkHolder == nil { - obj.linkHolder = &statePortLink{obj: obj.obj.Link} - } - return obj.linkHolder -} - -// description is TBD -// Link returns a StatePortLink -func (obj *statePort) HasLink() bool { - return obj.obj.Link != nil -} - -// description is TBD -// SetLink sets the StatePortLink value in the StatePort object -func (obj *statePort) SetLink(value StatePortLink) StatePort { - obj.setChoice(StatePortChoice.LINK) - obj.linkHolder = nil - obj.obj.Link = value.msg() - - return obj -} - -// description is TBD -// Capture returns a StatePortCapture -func (obj *statePort) Capture() StatePortCapture { - if obj.obj.Capture == nil { - obj.setChoice(StatePortChoice.CAPTURE) - } - if obj.captureHolder == nil { - obj.captureHolder = &statePortCapture{obj: obj.obj.Capture} - } - return obj.captureHolder -} - -// description is TBD -// Capture returns a StatePortCapture -func (obj *statePort) HasCapture() bool { - return obj.obj.Capture != nil -} - -// description is TBD -// SetCapture sets the StatePortCapture value in the StatePort object -func (obj *statePort) SetCapture(value StatePortCapture) StatePort { - obj.setChoice(StatePortChoice.CAPTURE) - obj.captureHolder = nil - obj.obj.Capture = value.msg() - - return obj -} - -func (obj *statePort) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface StatePort") - } - - if obj.obj.Link != nil { - - obj.Link().validateObj(vObj, set_default) - } - - if obj.obj.Capture != nil { - - obj.Capture().validateObj(vObj, set_default) - } - -} - -func (obj *statePort) setDefault() { - var choices_set int = 0 - var choice StatePortChoiceEnum - - if obj.obj.Link != nil { - choices_set += 1 - choice = StatePortChoice.LINK - } - - if obj.obj.Capture != nil { - choices_set += 1 - choice = StatePortChoice.CAPTURE - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StatePort") - } - } else { - intVal := otg.StatePort_Choice_Enum_value[string(choice)] - enumValue := otg.StatePort_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** StateProtocol ***** -type stateProtocol struct { - validation - obj *otg.StateProtocol - marshaller marshalStateProtocol - unMarshaller unMarshalStateProtocol - allHolder StateProtocolAll - routeHolder StateProtocolRoute - lacpHolder StateProtocolLacp - bgpHolder StateProtocolBgp - isisHolder StateProtocolIsis -} - -func NewStateProtocol() StateProtocol { - obj := stateProtocol{obj: &otg.StateProtocol{}} - obj.setDefault() - return &obj -} - -func (obj *stateProtocol) msg() *otg.StateProtocol { - return obj.obj -} - -func (obj *stateProtocol) setMsg(msg *otg.StateProtocol) StateProtocol { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstateProtocol struct { - obj *stateProtocol -} - -type marshalStateProtocol interface { - // ToProto marshals StateProtocol to protobuf object *otg.StateProtocol - ToProto() (*otg.StateProtocol, error) - // ToPbText marshals StateProtocol to protobuf text - ToPbText() (string, error) - // ToYaml marshals StateProtocol to YAML text - ToYaml() (string, error) - // ToJson marshals StateProtocol to JSON text - ToJson() (string, error) -} - -type unMarshalstateProtocol struct { - obj *stateProtocol -} - -type unMarshalStateProtocol interface { - // FromProto unmarshals StateProtocol from protobuf object *otg.StateProtocol - FromProto(msg *otg.StateProtocol) (StateProtocol, error) - // FromPbText unmarshals StateProtocol from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StateProtocol from YAML text - FromYaml(value string) error - // FromJson unmarshals StateProtocol from JSON text - FromJson(value string) error -} - -func (obj *stateProtocol) Marshal() marshalStateProtocol { - if obj.marshaller == nil { - obj.marshaller = &marshalstateProtocol{obj: obj} - } - return obj.marshaller -} - -func (obj *stateProtocol) Unmarshal() unMarshalStateProtocol { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstateProtocol{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstateProtocol) ToProto() (*otg.StateProtocol, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstateProtocol) FromProto(msg *otg.StateProtocol) (StateProtocol, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstateProtocol) 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 *unMarshalstateProtocol) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalstateProtocol) 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 *unMarshalstateProtocol) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalstateProtocol) 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 *unMarshalstateProtocol) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *stateProtocol) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *stateProtocol) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *stateProtocol) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *stateProtocol) Clone() (StateProtocol, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStateProtocol() - 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 -} - -func (obj *stateProtocol) setNil() { - obj.allHolder = nil - obj.routeHolder = nil - obj.lacpHolder = nil - obj.bgpHolder = nil - obj.isisHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// StateProtocol is states associated with protocols on configured resources. -type StateProtocol interface { - Validation - // msg marshals StateProtocol to protobuf object *otg.StateProtocol - // and doesn't set defaults - msg() *otg.StateProtocol - // setMsg unmarshals StateProtocol from protobuf object *otg.StateProtocol - // and doesn't set defaults - setMsg(*otg.StateProtocol) StateProtocol - // provides marshal interface - Marshal() marshalStateProtocol - // provides unmarshal interface - Unmarshal() unMarshalStateProtocol - // validate validates StateProtocol - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StateProtocol, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns StateProtocolChoiceEnum, set in StateProtocol - Choice() StateProtocolChoiceEnum - // setChoice assigns StateProtocolChoiceEnum provided by user to StateProtocol - setChoice(value StateProtocolChoiceEnum) StateProtocol - // All returns StateProtocolAll, set in StateProtocol. - // StateProtocolAll is sets all configured protocols to `start` or `stop` state. - // Setting protocol state to `start` shall be a no-op if preceding `set_config` API call was made with `config.options.protocol_options.auto_start_all` set to `true` or if all the configured protocols are already started. - All() StateProtocolAll - // SetAll assigns StateProtocolAll provided by user to StateProtocol. - // StateProtocolAll is sets all configured protocols to `start` or `stop` state. - // Setting protocol state to `start` shall be a no-op if preceding `set_config` API call was made with `config.options.protocol_options.auto_start_all` set to `true` or if all the configured protocols are already started. - SetAll(value StateProtocolAll) StateProtocol - // HasAll checks if All has been set in StateProtocol - HasAll() bool - // Route returns StateProtocolRoute, set in StateProtocol. - // StateProtocolRoute is sets the state of configured routes - Route() StateProtocolRoute - // SetRoute assigns StateProtocolRoute provided by user to StateProtocol. - // StateProtocolRoute is sets the state of configured routes - SetRoute(value StateProtocolRoute) StateProtocol - // HasRoute checks if Route has been set in StateProtocol - HasRoute() bool - // Lacp returns StateProtocolLacp, set in StateProtocol. - // StateProtocolLacp is sets state of configured LACP - Lacp() StateProtocolLacp - // SetLacp assigns StateProtocolLacp provided by user to StateProtocol. - // StateProtocolLacp is sets state of configured LACP - SetLacp(value StateProtocolLacp) StateProtocol - // HasLacp checks if Lacp has been set in StateProtocol - HasLacp() bool - // Bgp returns StateProtocolBgp, set in StateProtocol. - // StateProtocolBgp is sets state of configured BGP peers. - Bgp() StateProtocolBgp - // SetBgp assigns StateProtocolBgp provided by user to StateProtocol. - // StateProtocolBgp is sets state of configured BGP peers. - SetBgp(value StateProtocolBgp) StateProtocol - // HasBgp checks if Bgp has been set in StateProtocol - HasBgp() bool - // Isis returns StateProtocolIsis, set in StateProtocol. - // StateProtocolIsis is sets state of configured ISIS routers. - Isis() StateProtocolIsis - // SetIsis assigns StateProtocolIsis provided by user to StateProtocol. - // StateProtocolIsis is sets state of configured ISIS routers. - SetIsis(value StateProtocolIsis) StateProtocol - // HasIsis checks if Isis has been set in StateProtocol - HasIsis() bool - setNil() -} - -type StateProtocolChoiceEnum string - -// Enum of Choice on StateProtocol -var StateProtocolChoice = struct { - ALL StateProtocolChoiceEnum - ROUTE StateProtocolChoiceEnum - LACP StateProtocolChoiceEnum - BGP StateProtocolChoiceEnum - ISIS StateProtocolChoiceEnum -}{ - ALL: StateProtocolChoiceEnum("all"), - ROUTE: StateProtocolChoiceEnum("route"), - LACP: StateProtocolChoiceEnum("lacp"), - BGP: StateProtocolChoiceEnum("bgp"), - ISIS: StateProtocolChoiceEnum("isis"), -} - -func (obj *stateProtocol) Choice() StateProtocolChoiceEnum { - return StateProtocolChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *stateProtocol) setChoice(value StateProtocolChoiceEnum) StateProtocol { - intValue, ok := otg.StateProtocol_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StateProtocolChoiceEnum", string(value))) - return obj - } - enumValue := otg.StateProtocol_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Isis = nil - obj.isisHolder = nil - obj.obj.Bgp = nil - obj.bgpHolder = nil - obj.obj.Lacp = nil - obj.lacpHolder = nil - obj.obj.Route = nil - obj.routeHolder = nil - obj.obj.All = nil - obj.allHolder = nil - - if value == StateProtocolChoice.ALL { - obj.obj.All = NewStateProtocolAll().msg() - } - - if value == StateProtocolChoice.ROUTE { - obj.obj.Route = NewStateProtocolRoute().msg() - } - - if value == StateProtocolChoice.LACP { - obj.obj.Lacp = NewStateProtocolLacp().msg() - } - - if value == StateProtocolChoice.BGP { - obj.obj.Bgp = NewStateProtocolBgp().msg() - } - - if value == StateProtocolChoice.ISIS { - obj.obj.Isis = NewStateProtocolIsis().msg() - } - - return obj -} - -// description is TBD -// All returns a StateProtocolAll -func (obj *stateProtocol) All() StateProtocolAll { - if obj.obj.All == nil { - obj.setChoice(StateProtocolChoice.ALL) - } - if obj.allHolder == nil { - obj.allHolder = &stateProtocolAll{obj: obj.obj.All} - } - return obj.allHolder -} - -// description is TBD -// All returns a StateProtocolAll -func (obj *stateProtocol) HasAll() bool { - return obj.obj.All != nil -} - -// description is TBD -// SetAll sets the StateProtocolAll value in the StateProtocol object -func (obj *stateProtocol) SetAll(value StateProtocolAll) StateProtocol { - obj.setChoice(StateProtocolChoice.ALL) - obj.allHolder = nil - obj.obj.All = value.msg() - - return obj -} - -// description is TBD -// Route returns a StateProtocolRoute -func (obj *stateProtocol) Route() StateProtocolRoute { - if obj.obj.Route == nil { - obj.setChoice(StateProtocolChoice.ROUTE) - } - if obj.routeHolder == nil { - obj.routeHolder = &stateProtocolRoute{obj: obj.obj.Route} - } - return obj.routeHolder -} - -// description is TBD -// Route returns a StateProtocolRoute -func (obj *stateProtocol) HasRoute() bool { - return obj.obj.Route != nil -} - -// description is TBD -// SetRoute sets the StateProtocolRoute value in the StateProtocol object -func (obj *stateProtocol) SetRoute(value StateProtocolRoute) StateProtocol { - obj.setChoice(StateProtocolChoice.ROUTE) - obj.routeHolder = nil - obj.obj.Route = value.msg() - - return obj -} - -// description is TBD -// Lacp returns a StateProtocolLacp -func (obj *stateProtocol) Lacp() StateProtocolLacp { - if obj.obj.Lacp == nil { - obj.setChoice(StateProtocolChoice.LACP) - } - if obj.lacpHolder == nil { - obj.lacpHolder = &stateProtocolLacp{obj: obj.obj.Lacp} - } - return obj.lacpHolder -} - -// description is TBD -// Lacp returns a StateProtocolLacp -func (obj *stateProtocol) HasLacp() bool { - return obj.obj.Lacp != nil -} - -// description is TBD -// SetLacp sets the StateProtocolLacp value in the StateProtocol object -func (obj *stateProtocol) SetLacp(value StateProtocolLacp) StateProtocol { - obj.setChoice(StateProtocolChoice.LACP) - obj.lacpHolder = nil - obj.obj.Lacp = value.msg() - - return obj -} - -// description is TBD -// Bgp returns a StateProtocolBgp -func (obj *stateProtocol) Bgp() StateProtocolBgp { - if obj.obj.Bgp == nil { - obj.setChoice(StateProtocolChoice.BGP) - } - if obj.bgpHolder == nil { - obj.bgpHolder = &stateProtocolBgp{obj: obj.obj.Bgp} - } - return obj.bgpHolder -} - -// description is TBD -// Bgp returns a StateProtocolBgp -func (obj *stateProtocol) HasBgp() bool { - return obj.obj.Bgp != nil -} - -// description is TBD -// SetBgp sets the StateProtocolBgp value in the StateProtocol object -func (obj *stateProtocol) SetBgp(value StateProtocolBgp) StateProtocol { - obj.setChoice(StateProtocolChoice.BGP) - obj.bgpHolder = nil - obj.obj.Bgp = value.msg() - - return obj -} - -// description is TBD -// Isis returns a StateProtocolIsis -func (obj *stateProtocol) Isis() StateProtocolIsis { - if obj.obj.Isis == nil { - obj.setChoice(StateProtocolChoice.ISIS) - } - if obj.isisHolder == nil { - obj.isisHolder = &stateProtocolIsis{obj: obj.obj.Isis} - } - return obj.isisHolder -} - -// description is TBD -// Isis returns a StateProtocolIsis -func (obj *stateProtocol) HasIsis() bool { - return obj.obj.Isis != nil -} - -// description is TBD -// SetIsis sets the StateProtocolIsis value in the StateProtocol object -func (obj *stateProtocol) SetIsis(value StateProtocolIsis) StateProtocol { - obj.setChoice(StateProtocolChoice.ISIS) - obj.isisHolder = nil - obj.obj.Isis = value.msg() - - return obj -} - -func (obj *stateProtocol) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface StateProtocol") - } - - if obj.obj.All != nil { - - obj.All().validateObj(vObj, set_default) - } - - if obj.obj.Route != nil { - - obj.Route().validateObj(vObj, set_default) - } - - if obj.obj.Lacp != nil { - - obj.Lacp().validateObj(vObj, set_default) - } - - if obj.obj.Bgp != nil { - - obj.Bgp().validateObj(vObj, set_default) - } - - if obj.obj.Isis != nil { - - obj.Isis().validateObj(vObj, set_default) - } - -} - -func (obj *stateProtocol) setDefault() { - var choices_set int = 0 - var choice StateProtocolChoiceEnum - - if obj.obj.All != nil { - choices_set += 1 - choice = StateProtocolChoice.ALL - } - - if obj.obj.Route != nil { - choices_set += 1 - choice = StateProtocolChoice.ROUTE - } - - if obj.obj.Lacp != nil { - choices_set += 1 - choice = StateProtocolChoice.LACP - } - - if obj.obj.Bgp != nil { - choices_set += 1 - choice = StateProtocolChoice.BGP - } - - if obj.obj.Isis != nil { - choices_set += 1 - choice = StateProtocolChoice.ISIS - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StateProtocol") - } - } else { - intVal := otg.StateProtocol_Choice_Enum_value[string(choice)] - enumValue := otg.StateProtocol_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** StateTraffic ***** -type stateTraffic struct { - validation - obj *otg.StateTraffic - marshaller marshalStateTraffic - unMarshaller unMarshalStateTraffic - flowTransmitHolder StateTrafficFlowTransmit -} - -func NewStateTraffic() StateTraffic { - obj := stateTraffic{obj: &otg.StateTraffic{}} - obj.setDefault() - return &obj -} - -func (obj *stateTraffic) msg() *otg.StateTraffic { - return obj.obj -} - -func (obj *stateTraffic) setMsg(msg *otg.StateTraffic) StateTraffic { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstateTraffic struct { - obj *stateTraffic -} - -type marshalStateTraffic interface { - // ToProto marshals StateTraffic to protobuf object *otg.StateTraffic - ToProto() (*otg.StateTraffic, error) - // ToPbText marshals StateTraffic to protobuf text - ToPbText() (string, error) - // ToYaml marshals StateTraffic to YAML text - ToYaml() (string, error) - // ToJson marshals StateTraffic to JSON text - ToJson() (string, error) -} - -type unMarshalstateTraffic struct { - obj *stateTraffic -} - -type unMarshalStateTraffic interface { - // FromProto unmarshals StateTraffic from protobuf object *otg.StateTraffic - FromProto(msg *otg.StateTraffic) (StateTraffic, error) - // FromPbText unmarshals StateTraffic from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StateTraffic from YAML text - FromYaml(value string) error - // FromJson unmarshals StateTraffic from JSON text - FromJson(value string) error -} - -func (obj *stateTraffic) Marshal() marshalStateTraffic { - if obj.marshaller == nil { - obj.marshaller = &marshalstateTraffic{obj: obj} - } - return obj.marshaller -} - -func (obj *stateTraffic) Unmarshal() unMarshalStateTraffic { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstateTraffic{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstateTraffic) ToProto() (*otg.StateTraffic, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstateTraffic) FromProto(msg *otg.StateTraffic) (StateTraffic, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstateTraffic) 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 *unMarshalstateTraffic) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalstateTraffic) 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 *unMarshalstateTraffic) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalstateTraffic) 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 *unMarshalstateTraffic) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *stateTraffic) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *stateTraffic) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *stateTraffic) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *stateTraffic) Clone() (StateTraffic, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStateTraffic() - 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 -} - -func (obj *stateTraffic) setNil() { - obj.flowTransmitHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// StateTraffic is states associated with configured flows -type StateTraffic interface { - Validation - // msg marshals StateTraffic to protobuf object *otg.StateTraffic - // and doesn't set defaults - msg() *otg.StateTraffic - // setMsg unmarshals StateTraffic from protobuf object *otg.StateTraffic - // and doesn't set defaults - setMsg(*otg.StateTraffic) StateTraffic - // provides marshal interface - Marshal() marshalStateTraffic - // provides unmarshal interface - Unmarshal() unMarshalStateTraffic - // validate validates StateTraffic - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StateTraffic, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns StateTrafficChoiceEnum, set in StateTraffic - Choice() StateTrafficChoiceEnum - // setChoice assigns StateTrafficChoiceEnum provided by user to StateTraffic - setChoice(value StateTrafficChoiceEnum) StateTraffic - // FlowTransmit returns StateTrafficFlowTransmit, set in StateTraffic. - // StateTrafficFlowTransmit is provides state control of flow transmission. - FlowTransmit() StateTrafficFlowTransmit - // SetFlowTransmit assigns StateTrafficFlowTransmit provided by user to StateTraffic. - // StateTrafficFlowTransmit is provides state control of flow transmission. - SetFlowTransmit(value StateTrafficFlowTransmit) StateTraffic - // HasFlowTransmit checks if FlowTransmit has been set in StateTraffic - HasFlowTransmit() bool - setNil() -} - -type StateTrafficChoiceEnum string - -// Enum of Choice on StateTraffic -var StateTrafficChoice = struct { - FLOW_TRANSMIT StateTrafficChoiceEnum -}{ - FLOW_TRANSMIT: StateTrafficChoiceEnum("flow_transmit"), -} - -func (obj *stateTraffic) Choice() StateTrafficChoiceEnum { - return StateTrafficChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *stateTraffic) setChoice(value StateTrafficChoiceEnum) StateTraffic { - intValue, ok := otg.StateTraffic_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StateTrafficChoiceEnum", string(value))) - return obj - } - enumValue := otg.StateTraffic_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.FlowTransmit = nil - obj.flowTransmitHolder = nil - - if value == StateTrafficChoice.FLOW_TRANSMIT { - obj.obj.FlowTransmit = NewStateTrafficFlowTransmit().msg() - } - - return obj -} - -// description is TBD -// FlowTransmit returns a StateTrafficFlowTransmit -func (obj *stateTraffic) FlowTransmit() StateTrafficFlowTransmit { - if obj.obj.FlowTransmit == nil { - obj.setChoice(StateTrafficChoice.FLOW_TRANSMIT) - } - if obj.flowTransmitHolder == nil { - obj.flowTransmitHolder = &stateTrafficFlowTransmit{obj: obj.obj.FlowTransmit} - } - return obj.flowTransmitHolder -} - -// description is TBD -// FlowTransmit returns a StateTrafficFlowTransmit -func (obj *stateTraffic) HasFlowTransmit() bool { - return obj.obj.FlowTransmit != nil -} - -// description is TBD -// SetFlowTransmit sets the StateTrafficFlowTransmit value in the StateTraffic object -func (obj *stateTraffic) SetFlowTransmit(value StateTrafficFlowTransmit) StateTraffic { - obj.setChoice(StateTrafficChoice.FLOW_TRANSMIT) - obj.flowTransmitHolder = nil - obj.obj.FlowTransmit = value.msg() - - return obj -} - -func (obj *stateTraffic) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface StateTraffic") - } - - if obj.obj.FlowTransmit != nil { - - obj.FlowTransmit().validateObj(vObj, set_default) - } - -} - -func (obj *stateTraffic) setDefault() { - var choices_set int = 0 - var choice StateTrafficChoiceEnum - - if obj.obj.FlowTransmit != nil { - choices_set += 1 - choice = StateTrafficChoice.FLOW_TRANSMIT - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StateTraffic") - } - } else { - intVal := otg.StateTraffic_Choice_Enum_value[string(choice)] - enumValue := otg.StateTraffic_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** ActionProtocol ***** -type actionProtocol struct { - validation - obj *otg.ActionProtocol - marshaller marshalActionProtocol - unMarshaller unMarshalActionProtocol - ipv4Holder ActionProtocolIpv4 - ipv6Holder ActionProtocolIpv6 - bgpHolder ActionProtocolBgp -} - -func NewActionProtocol() ActionProtocol { - obj := actionProtocol{obj: &otg.ActionProtocol{}} - obj.setDefault() - return &obj -} - -func (obj *actionProtocol) msg() *otg.ActionProtocol { - return obj.obj -} - -func (obj *actionProtocol) setMsg(msg *otg.ActionProtocol) ActionProtocol { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionProtocol struct { - obj *actionProtocol -} - -type marshalActionProtocol interface { - // ToProto marshals ActionProtocol to protobuf object *otg.ActionProtocol - ToProto() (*otg.ActionProtocol, error) - // ToPbText marshals ActionProtocol to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionProtocol to YAML text - ToYaml() (string, error) - // ToJson marshals ActionProtocol to JSON text - ToJson() (string, error) -} - -type unMarshalactionProtocol struct { - obj *actionProtocol -} - -type unMarshalActionProtocol interface { - // FromProto unmarshals ActionProtocol from protobuf object *otg.ActionProtocol - FromProto(msg *otg.ActionProtocol) (ActionProtocol, error) - // FromPbText unmarshals ActionProtocol from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionProtocol from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionProtocol from JSON text - FromJson(value string) error -} - -func (obj *actionProtocol) Marshal() marshalActionProtocol { - if obj.marshaller == nil { - obj.marshaller = &marshalactionProtocol{obj: obj} - } - return obj.marshaller -} - -func (obj *actionProtocol) Unmarshal() unMarshalActionProtocol { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionProtocol{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionProtocol) ToProto() (*otg.ActionProtocol, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionProtocol) FromProto(msg *otg.ActionProtocol) (ActionProtocol, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionProtocol) 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 *unMarshalactionProtocol) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalactionProtocol) 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 *unMarshalactionProtocol) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalactionProtocol) 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 *unMarshalactionProtocol) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *actionProtocol) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionProtocol) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionProtocol) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionProtocol) Clone() (ActionProtocol, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionProtocol() - 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 -} - -func (obj *actionProtocol) setNil() { - obj.ipv4Holder = nil - obj.ipv6Holder = nil - obj.bgpHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ActionProtocol is actions associated with protocols on configured resources. -type ActionProtocol interface { - Validation - // msg marshals ActionProtocol to protobuf object *otg.ActionProtocol - // and doesn't set defaults - msg() *otg.ActionProtocol - // setMsg unmarshals ActionProtocol from protobuf object *otg.ActionProtocol - // and doesn't set defaults - setMsg(*otg.ActionProtocol) ActionProtocol - // provides marshal interface - Marshal() marshalActionProtocol - // provides unmarshal interface - Unmarshal() unMarshalActionProtocol - // validate validates ActionProtocol - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionProtocol, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ActionProtocolChoiceEnum, set in ActionProtocol - Choice() ActionProtocolChoiceEnum - // setChoice assigns ActionProtocolChoiceEnum provided by user to ActionProtocol - setChoice(value ActionProtocolChoiceEnum) ActionProtocol - // Ipv4 returns ActionProtocolIpv4, set in ActionProtocol. - // ActionProtocolIpv4 is actions associated with IPv4 on configured resources. - Ipv4() ActionProtocolIpv4 - // SetIpv4 assigns ActionProtocolIpv4 provided by user to ActionProtocol. - // ActionProtocolIpv4 is actions associated with IPv4 on configured resources. - SetIpv4(value ActionProtocolIpv4) ActionProtocol - // HasIpv4 checks if Ipv4 has been set in ActionProtocol - HasIpv4() bool - // Ipv6 returns ActionProtocolIpv6, set in ActionProtocol. - // ActionProtocolIpv6 is actions associated with IPv6 on configured resources. - Ipv6() ActionProtocolIpv6 - // SetIpv6 assigns ActionProtocolIpv6 provided by user to ActionProtocol. - // ActionProtocolIpv6 is actions associated with IPv6 on configured resources. - SetIpv6(value ActionProtocolIpv6) ActionProtocol - // HasIpv6 checks if Ipv6 has been set in ActionProtocol - HasIpv6() bool - // Bgp returns ActionProtocolBgp, set in ActionProtocol. - // ActionProtocolBgp is actions associated with BGP on configured resources. - Bgp() ActionProtocolBgp - // SetBgp assigns ActionProtocolBgp provided by user to ActionProtocol. - // ActionProtocolBgp is actions associated with BGP on configured resources. - SetBgp(value ActionProtocolBgp) ActionProtocol - // HasBgp checks if Bgp has been set in ActionProtocol - HasBgp() bool - setNil() -} - -type ActionProtocolChoiceEnum string - -// Enum of Choice on ActionProtocol -var ActionProtocolChoice = struct { - IPV4 ActionProtocolChoiceEnum - IPV6 ActionProtocolChoiceEnum - BGP ActionProtocolChoiceEnum -}{ - IPV4: ActionProtocolChoiceEnum("ipv4"), - IPV6: ActionProtocolChoiceEnum("ipv6"), - BGP: ActionProtocolChoiceEnum("bgp"), -} - -func (obj *actionProtocol) Choice() ActionProtocolChoiceEnum { - return ActionProtocolChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *actionProtocol) setChoice(value ActionProtocolChoiceEnum) ActionProtocol { - intValue, ok := otg.ActionProtocol_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ActionProtocolChoiceEnum", string(value))) - return obj - } - enumValue := otg.ActionProtocol_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Bgp = nil - obj.bgpHolder = nil - obj.obj.Ipv6 = nil - obj.ipv6Holder = nil - obj.obj.Ipv4 = nil - obj.ipv4Holder = nil - - if value == ActionProtocolChoice.IPV4 { - obj.obj.Ipv4 = NewActionProtocolIpv4().msg() - } - - if value == ActionProtocolChoice.IPV6 { - obj.obj.Ipv6 = NewActionProtocolIpv6().msg() - } - - if value == ActionProtocolChoice.BGP { - obj.obj.Bgp = NewActionProtocolBgp().msg() - } - - return obj -} - -// description is TBD -// Ipv4 returns a ActionProtocolIpv4 -func (obj *actionProtocol) Ipv4() ActionProtocolIpv4 { - if obj.obj.Ipv4 == nil { - obj.setChoice(ActionProtocolChoice.IPV4) - } - if obj.ipv4Holder == nil { - obj.ipv4Holder = &actionProtocolIpv4{obj: obj.obj.Ipv4} - } - return obj.ipv4Holder -} - -// description is TBD -// Ipv4 returns a ActionProtocolIpv4 -func (obj *actionProtocol) HasIpv4() bool { - return obj.obj.Ipv4 != nil -} - -// description is TBD -// SetIpv4 sets the ActionProtocolIpv4 value in the ActionProtocol object -func (obj *actionProtocol) SetIpv4(value ActionProtocolIpv4) ActionProtocol { - obj.setChoice(ActionProtocolChoice.IPV4) - obj.ipv4Holder = nil - obj.obj.Ipv4 = value.msg() - - return obj -} - -// description is TBD -// Ipv6 returns a ActionProtocolIpv6 -func (obj *actionProtocol) Ipv6() ActionProtocolIpv6 { - if obj.obj.Ipv6 == nil { - obj.setChoice(ActionProtocolChoice.IPV6) - } - if obj.ipv6Holder == nil { - obj.ipv6Holder = &actionProtocolIpv6{obj: obj.obj.Ipv6} - } - return obj.ipv6Holder -} - -// description is TBD -// Ipv6 returns a ActionProtocolIpv6 -func (obj *actionProtocol) HasIpv6() bool { - return obj.obj.Ipv6 != nil -} - -// description is TBD -// SetIpv6 sets the ActionProtocolIpv6 value in the ActionProtocol object -func (obj *actionProtocol) SetIpv6(value ActionProtocolIpv6) ActionProtocol { - obj.setChoice(ActionProtocolChoice.IPV6) - obj.ipv6Holder = nil - obj.obj.Ipv6 = value.msg() - - return obj -} - -// description is TBD -// Bgp returns a ActionProtocolBgp -func (obj *actionProtocol) Bgp() ActionProtocolBgp { - if obj.obj.Bgp == nil { - obj.setChoice(ActionProtocolChoice.BGP) - } - if obj.bgpHolder == nil { - obj.bgpHolder = &actionProtocolBgp{obj: obj.obj.Bgp} - } - return obj.bgpHolder -} - -// description is TBD -// Bgp returns a ActionProtocolBgp -func (obj *actionProtocol) HasBgp() bool { - return obj.obj.Bgp != nil -} - -// description is TBD -// SetBgp sets the ActionProtocolBgp value in the ActionProtocol object -func (obj *actionProtocol) SetBgp(value ActionProtocolBgp) ActionProtocol { - obj.setChoice(ActionProtocolChoice.BGP) - obj.bgpHolder = nil - obj.obj.Bgp = value.msg() - - return obj -} - -func (obj *actionProtocol) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionProtocol") - } - - if obj.obj.Ipv4 != nil { - - obj.Ipv4().validateObj(vObj, set_default) - } - - if obj.obj.Ipv6 != nil { - - obj.Ipv6().validateObj(vObj, set_default) - } - - if obj.obj.Bgp != nil { - - obj.Bgp().validateObj(vObj, set_default) - } - -} - -func (obj *actionProtocol) setDefault() { - var choices_set int = 0 - var choice ActionProtocolChoiceEnum - - if obj.obj.Ipv4 != nil { - choices_set += 1 - choice = ActionProtocolChoice.IPV4 - } - - if obj.obj.Ipv6 != nil { - choices_set += 1 - choice = ActionProtocolChoice.IPV6 - } - - if obj.obj.Bgp != nil { - choices_set += 1 - choice = ActionProtocolChoice.BGP - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionProtocol") - } - } else { - intVal := otg.ActionProtocol_Choice_Enum_value[string(choice)] - enumValue := otg.ActionProtocol_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PortMetricsRequest ***** -type portMetricsRequest struct { - validation - obj *otg.PortMetricsRequest - marshaller marshalPortMetricsRequest - unMarshaller unMarshalPortMetricsRequest -} - -func NewPortMetricsRequest() PortMetricsRequest { - obj := portMetricsRequest{obj: &otg.PortMetricsRequest{}} - obj.setDefault() - return &obj -} - -func (obj *portMetricsRequest) msg() *otg.PortMetricsRequest { - return obj.obj -} - -func (obj *portMetricsRequest) setMsg(msg *otg.PortMetricsRequest) PortMetricsRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalportMetricsRequest struct { - obj *portMetricsRequest -} - -type marshalPortMetricsRequest interface { - // ToProto marshals PortMetricsRequest to protobuf object *otg.PortMetricsRequest - ToProto() (*otg.PortMetricsRequest, error) - // ToPbText marshals PortMetricsRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals PortMetricsRequest to YAML text - ToYaml() (string, error) - // ToJson marshals PortMetricsRequest to JSON text - ToJson() (string, error) -} - -type unMarshalportMetricsRequest struct { - obj *portMetricsRequest -} - -type unMarshalPortMetricsRequest interface { - // FromProto unmarshals PortMetricsRequest from protobuf object *otg.PortMetricsRequest - FromProto(msg *otg.PortMetricsRequest) (PortMetricsRequest, error) - // FromPbText unmarshals PortMetricsRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PortMetricsRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals PortMetricsRequest from JSON text - FromJson(value string) error -} - -func (obj *portMetricsRequest) Marshal() marshalPortMetricsRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalportMetricsRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *portMetricsRequest) Unmarshal() unMarshalPortMetricsRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalportMetricsRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalportMetricsRequest) ToProto() (*otg.PortMetricsRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalportMetricsRequest) FromProto(msg *otg.PortMetricsRequest) (PortMetricsRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalportMetricsRequest) 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 *unMarshalportMetricsRequest) 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 *marshalportMetricsRequest) 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 *unMarshalportMetricsRequest) 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 *marshalportMetricsRequest) 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 *unMarshalportMetricsRequest) 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 *portMetricsRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *portMetricsRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *portMetricsRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *portMetricsRequest) Clone() (PortMetricsRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPortMetricsRequest() - 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 -} - -// PortMetricsRequest is the port result request to the traffic generator -type PortMetricsRequest interface { - Validation - // msg marshals PortMetricsRequest to protobuf object *otg.PortMetricsRequest - // and doesn't set defaults - msg() *otg.PortMetricsRequest - // setMsg unmarshals PortMetricsRequest from protobuf object *otg.PortMetricsRequest - // and doesn't set defaults - setMsg(*otg.PortMetricsRequest) PortMetricsRequest - // provides marshal interface - Marshal() marshalPortMetricsRequest - // provides unmarshal interface - Unmarshal() unMarshalPortMetricsRequest - // validate validates PortMetricsRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PortMetricsRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PortNames returns []string, set in PortMetricsRequest. - PortNames() []string - // SetPortNames assigns []string provided by user to PortMetricsRequest - SetPortNames(value []string) PortMetricsRequest - // ColumnNames returns []PortMetricsRequestColumnNamesEnum, set in PortMetricsRequest - ColumnNames() []PortMetricsRequestColumnNamesEnum - // SetColumnNames assigns []PortMetricsRequestColumnNamesEnum provided by user to PortMetricsRequest - SetColumnNames(value []PortMetricsRequestColumnNamesEnum) PortMetricsRequest -} - -// The names of objects to return results for. An empty list will return all port row results. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// PortNames returns a []string -func (obj *portMetricsRequest) PortNames() []string { - if obj.obj.PortNames == nil { - obj.obj.PortNames = make([]string, 0) - } - return obj.obj.PortNames -} - -// The names of objects to return results for. An empty list will return all port row results. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// SetPortNames sets the []string value in the PortMetricsRequest object -func (obj *portMetricsRequest) SetPortNames(value []string) PortMetricsRequest { - - if obj.obj.PortNames == nil { - obj.obj.PortNames = make([]string, 0) - } - obj.obj.PortNames = value - - return obj -} - -type PortMetricsRequestColumnNamesEnum string - -// Enum of ColumnNames on PortMetricsRequest -var PortMetricsRequestColumnNames = struct { - TRANSMIT PortMetricsRequestColumnNamesEnum - LOCATION PortMetricsRequestColumnNamesEnum - LINK PortMetricsRequestColumnNamesEnum - CAPTURE PortMetricsRequestColumnNamesEnum - FRAMES_TX PortMetricsRequestColumnNamesEnum - FRAMES_RX PortMetricsRequestColumnNamesEnum - BYTES_TX PortMetricsRequestColumnNamesEnum - BYTES_RX PortMetricsRequestColumnNamesEnum - FRAMES_TX_RATE PortMetricsRequestColumnNamesEnum - FRAMES_RX_RATE PortMetricsRequestColumnNamesEnum - BYTES_TX_RATE PortMetricsRequestColumnNamesEnum - BYTES_RX_RATE PortMetricsRequestColumnNamesEnum -}{ - TRANSMIT: PortMetricsRequestColumnNamesEnum("transmit"), - LOCATION: PortMetricsRequestColumnNamesEnum("location"), - LINK: PortMetricsRequestColumnNamesEnum("link"), - CAPTURE: PortMetricsRequestColumnNamesEnum("capture"), - FRAMES_TX: PortMetricsRequestColumnNamesEnum("frames_tx"), - FRAMES_RX: PortMetricsRequestColumnNamesEnum("frames_rx"), - BYTES_TX: PortMetricsRequestColumnNamesEnum("bytes_tx"), - BYTES_RX: PortMetricsRequestColumnNamesEnum("bytes_rx"), - FRAMES_TX_RATE: PortMetricsRequestColumnNamesEnum("frames_tx_rate"), - FRAMES_RX_RATE: PortMetricsRequestColumnNamesEnum("frames_rx_rate"), - BYTES_TX_RATE: PortMetricsRequestColumnNamesEnum("bytes_tx_rate"), - BYTES_RX_RATE: PortMetricsRequestColumnNamesEnum("bytes_rx_rate"), -} - -func (obj *portMetricsRequest) ColumnNames() []PortMetricsRequestColumnNamesEnum { - items := []PortMetricsRequestColumnNamesEnum{} - for _, item := range obj.obj.ColumnNames { - items = append(items, PortMetricsRequestColumnNamesEnum(item.String())) - } - return items -} - -// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned. The name of the port cannot be excluded. -// SetColumnNames sets the []string value in the PortMetricsRequest object -func (obj *portMetricsRequest) SetColumnNames(value []PortMetricsRequestColumnNamesEnum) PortMetricsRequest { - - items := []otg.PortMetricsRequest_ColumnNames_Enum{} - for _, item := range value { - intValue := otg.PortMetricsRequest_ColumnNames_Enum_value[string(item)] - items = append(items, otg.PortMetricsRequest_ColumnNames_Enum(intValue)) - } - obj.obj.ColumnNames = items - return obj -} - -func (obj *portMetricsRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *portMetricsRequest) setDefault() { - -} - -// ***** FlowMetricsRequest ***** -type flowMetricsRequest struct { - validation - obj *otg.FlowMetricsRequest - marshaller marshalFlowMetricsRequest - unMarshaller unMarshalFlowMetricsRequest - taggedMetricsHolder FlowTaggedMetricsFilter -} - -func NewFlowMetricsRequest() FlowMetricsRequest { - obj := flowMetricsRequest{obj: &otg.FlowMetricsRequest{}} - obj.setDefault() - return &obj -} - -func (obj *flowMetricsRequest) msg() *otg.FlowMetricsRequest { - return obj.obj -} - -func (obj *flowMetricsRequest) setMsg(msg *otg.FlowMetricsRequest) FlowMetricsRequest { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowMetricsRequest struct { - obj *flowMetricsRequest -} - -type marshalFlowMetricsRequest interface { - // ToProto marshals FlowMetricsRequest to protobuf object *otg.FlowMetricsRequest - ToProto() (*otg.FlowMetricsRequest, error) - // ToPbText marshals FlowMetricsRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowMetricsRequest to YAML text - ToYaml() (string, error) - // ToJson marshals FlowMetricsRequest to JSON text - ToJson() (string, error) -} - -type unMarshalflowMetricsRequest struct { - obj *flowMetricsRequest -} - -type unMarshalFlowMetricsRequest interface { - // FromProto unmarshals FlowMetricsRequest from protobuf object *otg.FlowMetricsRequest - FromProto(msg *otg.FlowMetricsRequest) (FlowMetricsRequest, error) - // FromPbText unmarshals FlowMetricsRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowMetricsRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowMetricsRequest from JSON text - FromJson(value string) error -} - -func (obj *flowMetricsRequest) Marshal() marshalFlowMetricsRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalflowMetricsRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *flowMetricsRequest) Unmarshal() unMarshalFlowMetricsRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowMetricsRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowMetricsRequest) ToProto() (*otg.FlowMetricsRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowMetricsRequest) FromProto(msg *otg.FlowMetricsRequest) (FlowMetricsRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowMetricsRequest) 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 *unMarshalflowMetricsRequest) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowMetricsRequest) 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 *unMarshalflowMetricsRequest) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowMetricsRequest) 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 *unMarshalflowMetricsRequest) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowMetricsRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowMetricsRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowMetricsRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowMetricsRequest) Clone() (FlowMetricsRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowMetricsRequest() - 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 -} - -func (obj *flowMetricsRequest) setNil() { - obj.taggedMetricsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowMetricsRequest is the container for a flow metric request. -type FlowMetricsRequest interface { - Validation - // msg marshals FlowMetricsRequest to protobuf object *otg.FlowMetricsRequest - // and doesn't set defaults - msg() *otg.FlowMetricsRequest - // setMsg unmarshals FlowMetricsRequest from protobuf object *otg.FlowMetricsRequest - // and doesn't set defaults - setMsg(*otg.FlowMetricsRequest) FlowMetricsRequest - // provides marshal interface - Marshal() marshalFlowMetricsRequest - // provides unmarshal interface - Unmarshal() unMarshalFlowMetricsRequest - // validate validates FlowMetricsRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowMetricsRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // FlowNames returns []string, set in FlowMetricsRequest. - FlowNames() []string - // SetFlowNames assigns []string provided by user to FlowMetricsRequest - SetFlowNames(value []string) FlowMetricsRequest - // MetricNames returns []FlowMetricsRequestMetricNamesEnum, set in FlowMetricsRequest - MetricNames() []FlowMetricsRequestMetricNamesEnum - // SetMetricNames assigns []FlowMetricsRequestMetricNamesEnum provided by user to FlowMetricsRequest - SetMetricNames(value []FlowMetricsRequestMetricNamesEnum) FlowMetricsRequest - // TaggedMetrics returns FlowTaggedMetricsFilter, set in FlowMetricsRequest. - // FlowTaggedMetricsFilter is filter for tagged metrics - TaggedMetrics() FlowTaggedMetricsFilter - // SetTaggedMetrics assigns FlowTaggedMetricsFilter provided by user to FlowMetricsRequest. - // FlowTaggedMetricsFilter is filter for tagged metrics - SetTaggedMetrics(value FlowTaggedMetricsFilter) FlowMetricsRequest - // HasTaggedMetrics checks if TaggedMetrics has been set in FlowMetricsRequest - HasTaggedMetrics() bool - setNil() -} - -// Flow metrics will be retrieved for these flow names. -// If no flow names are specified then all flows will be returned. -// -// x-constraint: -// - /components/schemas/Flow/properties/name -// -// x-constraint: -// - /components/schemas/Flow/properties/name -// -// FlowNames returns a []string -func (obj *flowMetricsRequest) FlowNames() []string { - if obj.obj.FlowNames == nil { - obj.obj.FlowNames = make([]string, 0) - } - return obj.obj.FlowNames -} - -// Flow metrics will be retrieved for these flow names. -// If no flow names are specified then all flows will be returned. -// -// x-constraint: -// - /components/schemas/Flow/properties/name -// -// x-constraint: -// - /components/schemas/Flow/properties/name -// -// SetFlowNames sets the []string value in the FlowMetricsRequest object -func (obj *flowMetricsRequest) SetFlowNames(value []string) FlowMetricsRequest { - - if obj.obj.FlowNames == nil { - obj.obj.FlowNames = make([]string, 0) - } - obj.obj.FlowNames = value - - return obj -} - -type FlowMetricsRequestMetricNamesEnum string - -// Enum of MetricNames on FlowMetricsRequest -var FlowMetricsRequestMetricNames = struct { - TRANSMIT FlowMetricsRequestMetricNamesEnum - FRAMES_TX FlowMetricsRequestMetricNamesEnum - FRAMES_RX FlowMetricsRequestMetricNamesEnum - BYTES_TX FlowMetricsRequestMetricNamesEnum - BYTES_RX FlowMetricsRequestMetricNamesEnum - FRAMES_TX_RATE FlowMetricsRequestMetricNamesEnum - FRAMES_RX_RATE FlowMetricsRequestMetricNamesEnum -}{ - TRANSMIT: FlowMetricsRequestMetricNamesEnum("transmit"), - FRAMES_TX: FlowMetricsRequestMetricNamesEnum("frames_tx"), - FRAMES_RX: FlowMetricsRequestMetricNamesEnum("frames_rx"), - BYTES_TX: FlowMetricsRequestMetricNamesEnum("bytes_tx"), - BYTES_RX: FlowMetricsRequestMetricNamesEnum("bytes_rx"), - FRAMES_TX_RATE: FlowMetricsRequestMetricNamesEnum("frames_tx_rate"), - FRAMES_RX_RATE: FlowMetricsRequestMetricNamesEnum("frames_rx_rate"), -} - -func (obj *flowMetricsRequest) MetricNames() []FlowMetricsRequestMetricNamesEnum { - items := []FlowMetricsRequestMetricNamesEnum{} - for _, item := range obj.obj.MetricNames { - items = append(items, FlowMetricsRequestMetricNamesEnum(item.String())) - } - return items -} - -// The list of metric names that the returned result set will contain. If the list is empty then all metrics will be returned. -// SetMetricNames sets the []string value in the FlowMetricsRequest object -func (obj *flowMetricsRequest) SetMetricNames(value []FlowMetricsRequestMetricNamesEnum) FlowMetricsRequest { - - items := []otg.FlowMetricsRequest_MetricNames_Enum{} - for _, item := range value { - intValue := otg.FlowMetricsRequest_MetricNames_Enum_value[string(item)] - items = append(items, otg.FlowMetricsRequest_MetricNames_Enum(intValue)) - } - obj.obj.MetricNames = items - return obj -} - -// description is TBD -// TaggedMetrics returns a FlowTaggedMetricsFilter -func (obj *flowMetricsRequest) TaggedMetrics() FlowTaggedMetricsFilter { - if obj.obj.TaggedMetrics == nil { - obj.obj.TaggedMetrics = NewFlowTaggedMetricsFilter().msg() - } - if obj.taggedMetricsHolder == nil { - obj.taggedMetricsHolder = &flowTaggedMetricsFilter{obj: obj.obj.TaggedMetrics} - } - return obj.taggedMetricsHolder -} - -// description is TBD -// TaggedMetrics returns a FlowTaggedMetricsFilter -func (obj *flowMetricsRequest) HasTaggedMetrics() bool { - return obj.obj.TaggedMetrics != nil -} - -// description is TBD -// SetTaggedMetrics sets the FlowTaggedMetricsFilter value in the FlowMetricsRequest object -func (obj *flowMetricsRequest) SetTaggedMetrics(value FlowTaggedMetricsFilter) FlowMetricsRequest { - - obj.taggedMetricsHolder = nil - obj.obj.TaggedMetrics = value.msg() - - return obj -} - -func (obj *flowMetricsRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.TaggedMetrics != nil { - - obj.TaggedMetrics().validateObj(vObj, set_default) - } - -} - -func (obj *flowMetricsRequest) setDefault() { - -} - -// ***** Bgpv4MetricsRequest ***** -type bgpv4MetricsRequest struct { - validation - obj *otg.Bgpv4MetricsRequest - marshaller marshalBgpv4MetricsRequest - unMarshaller unMarshalBgpv4MetricsRequest -} - -func NewBgpv4MetricsRequest() Bgpv4MetricsRequest { - obj := bgpv4MetricsRequest{obj: &otg.Bgpv4MetricsRequest{}} - obj.setDefault() - return &obj -} - -func (obj *bgpv4MetricsRequest) msg() *otg.Bgpv4MetricsRequest { - return obj.obj -} - -func (obj *bgpv4MetricsRequest) setMsg(msg *otg.Bgpv4MetricsRequest) Bgpv4MetricsRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpv4MetricsRequest struct { - obj *bgpv4MetricsRequest -} - -type marshalBgpv4MetricsRequest interface { - // ToProto marshals Bgpv4MetricsRequest to protobuf object *otg.Bgpv4MetricsRequest - ToProto() (*otg.Bgpv4MetricsRequest, error) - // ToPbText marshals Bgpv4MetricsRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals Bgpv4MetricsRequest to YAML text - ToYaml() (string, error) - // ToJson marshals Bgpv4MetricsRequest to JSON text - ToJson() (string, error) -} - -type unMarshalbgpv4MetricsRequest struct { - obj *bgpv4MetricsRequest -} - -type unMarshalBgpv4MetricsRequest interface { - // FromProto unmarshals Bgpv4MetricsRequest from protobuf object *otg.Bgpv4MetricsRequest - FromProto(msg *otg.Bgpv4MetricsRequest) (Bgpv4MetricsRequest, error) - // FromPbText unmarshals Bgpv4MetricsRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Bgpv4MetricsRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals Bgpv4MetricsRequest from JSON text - FromJson(value string) error -} - -func (obj *bgpv4MetricsRequest) Marshal() marshalBgpv4MetricsRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpv4MetricsRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpv4MetricsRequest) Unmarshal() unMarshalBgpv4MetricsRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpv4MetricsRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpv4MetricsRequest) ToProto() (*otg.Bgpv4MetricsRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpv4MetricsRequest) FromProto(msg *otg.Bgpv4MetricsRequest) (Bgpv4MetricsRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpv4MetricsRequest) 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 *unMarshalbgpv4MetricsRequest) 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 *marshalbgpv4MetricsRequest) 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 *unMarshalbgpv4MetricsRequest) 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 *marshalbgpv4MetricsRequest) 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 *unMarshalbgpv4MetricsRequest) 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 *bgpv4MetricsRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpv4MetricsRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpv4MetricsRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpv4MetricsRequest) Clone() (Bgpv4MetricsRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpv4MetricsRequest() - 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 -} - -// Bgpv4MetricsRequest is the request to retrieve BGPv4 per peer metrics/statistics. -type Bgpv4MetricsRequest interface { - Validation - // msg marshals Bgpv4MetricsRequest to protobuf object *otg.Bgpv4MetricsRequest - // and doesn't set defaults - msg() *otg.Bgpv4MetricsRequest - // setMsg unmarshals Bgpv4MetricsRequest from protobuf object *otg.Bgpv4MetricsRequest - // and doesn't set defaults - setMsg(*otg.Bgpv4MetricsRequest) Bgpv4MetricsRequest - // provides marshal interface - Marshal() marshalBgpv4MetricsRequest - // provides unmarshal interface - Unmarshal() unMarshalBgpv4MetricsRequest - // validate validates Bgpv4MetricsRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Bgpv4MetricsRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PeerNames returns []string, set in Bgpv4MetricsRequest. - PeerNames() []string - // SetPeerNames assigns []string provided by user to Bgpv4MetricsRequest - SetPeerNames(value []string) Bgpv4MetricsRequest - // ColumnNames returns []Bgpv4MetricsRequestColumnNamesEnum, set in Bgpv4MetricsRequest - ColumnNames() []Bgpv4MetricsRequestColumnNamesEnum - // SetColumnNames assigns []Bgpv4MetricsRequestColumnNamesEnum provided by user to Bgpv4MetricsRequest - SetColumnNames(value []Bgpv4MetricsRequestColumnNamesEnum) Bgpv4MetricsRequest -} - -// The names of BGPv4 peers to return results for. An empty list will return results for all BGPv4 peers. -// -// x-constraint: -// - /components/schemas/Bgp.V4peer/properties/name -// -// x-constraint: -// - /components/schemas/Bgp.V4peer/properties/name -// -// PeerNames returns a []string -func (obj *bgpv4MetricsRequest) PeerNames() []string { - if obj.obj.PeerNames == nil { - obj.obj.PeerNames = make([]string, 0) - } - return obj.obj.PeerNames -} - -// The names of BGPv4 peers to return results for. An empty list will return results for all BGPv4 peers. -// -// x-constraint: -// - /components/schemas/Bgp.V4peer/properties/name -// -// x-constraint: -// - /components/schemas/Bgp.V4peer/properties/name -// -// SetPeerNames sets the []string value in the Bgpv4MetricsRequest object -func (obj *bgpv4MetricsRequest) SetPeerNames(value []string) Bgpv4MetricsRequest { - - if obj.obj.PeerNames == nil { - obj.obj.PeerNames = make([]string, 0) - } - obj.obj.PeerNames = value - - return obj -} - -type Bgpv4MetricsRequestColumnNamesEnum string - -// Enum of ColumnNames on Bgpv4MetricsRequest -var Bgpv4MetricsRequestColumnNames = struct { - SESSION_STATE Bgpv4MetricsRequestColumnNamesEnum - SESSION_FLAP_COUNT Bgpv4MetricsRequestColumnNamesEnum - ROUTES_ADVERTISED Bgpv4MetricsRequestColumnNamesEnum - ROUTES_RECEIVED Bgpv4MetricsRequestColumnNamesEnum - ROUTE_WITHDRAWS_SENT Bgpv4MetricsRequestColumnNamesEnum - ROUTE_WITHDRAWS_RECEIVED Bgpv4MetricsRequestColumnNamesEnum - UPDATES_SENT Bgpv4MetricsRequestColumnNamesEnum - UPDATES_RECEIVED Bgpv4MetricsRequestColumnNamesEnum - OPENS_SENT Bgpv4MetricsRequestColumnNamesEnum - OPENS_RECEIVED Bgpv4MetricsRequestColumnNamesEnum - KEEPALIVES_SENT Bgpv4MetricsRequestColumnNamesEnum - KEEPALIVES_RECEIVED Bgpv4MetricsRequestColumnNamesEnum - NOTIFICATIONS_SENT Bgpv4MetricsRequestColumnNamesEnum - NOTIFICATIONS_RECEIVED Bgpv4MetricsRequestColumnNamesEnum - FSM_STATE Bgpv4MetricsRequestColumnNamesEnum - END_OF_RIB_RECEIVED Bgpv4MetricsRequestColumnNamesEnum -}{ - SESSION_STATE: Bgpv4MetricsRequestColumnNamesEnum("session_state"), - SESSION_FLAP_COUNT: Bgpv4MetricsRequestColumnNamesEnum("session_flap_count"), - ROUTES_ADVERTISED: Bgpv4MetricsRequestColumnNamesEnum("routes_advertised"), - ROUTES_RECEIVED: Bgpv4MetricsRequestColumnNamesEnum("routes_received"), - ROUTE_WITHDRAWS_SENT: Bgpv4MetricsRequestColumnNamesEnum("route_withdraws_sent"), - ROUTE_WITHDRAWS_RECEIVED: Bgpv4MetricsRequestColumnNamesEnum("route_withdraws_received"), - UPDATES_SENT: Bgpv4MetricsRequestColumnNamesEnum("updates_sent"), - UPDATES_RECEIVED: Bgpv4MetricsRequestColumnNamesEnum("updates_received"), - OPENS_SENT: Bgpv4MetricsRequestColumnNamesEnum("opens_sent"), - OPENS_RECEIVED: Bgpv4MetricsRequestColumnNamesEnum("opens_received"), - KEEPALIVES_SENT: Bgpv4MetricsRequestColumnNamesEnum("keepalives_sent"), - KEEPALIVES_RECEIVED: Bgpv4MetricsRequestColumnNamesEnum("keepalives_received"), - NOTIFICATIONS_SENT: Bgpv4MetricsRequestColumnNamesEnum("notifications_sent"), - NOTIFICATIONS_RECEIVED: Bgpv4MetricsRequestColumnNamesEnum("notifications_received"), - FSM_STATE: Bgpv4MetricsRequestColumnNamesEnum("fsm_state"), - END_OF_RIB_RECEIVED: Bgpv4MetricsRequestColumnNamesEnum("end_of_rib_received"), -} - -func (obj *bgpv4MetricsRequest) ColumnNames() []Bgpv4MetricsRequestColumnNamesEnum { - items := []Bgpv4MetricsRequestColumnNamesEnum{} - for _, item := range obj.obj.ColumnNames { - items = append(items, Bgpv4MetricsRequestColumnNamesEnum(item.String())) - } - return items -} - -// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned except for any result_groups. The name of the BGPv4 peer cannot be excluded. -// SetColumnNames sets the []string value in the Bgpv4MetricsRequest object -func (obj *bgpv4MetricsRequest) SetColumnNames(value []Bgpv4MetricsRequestColumnNamesEnum) Bgpv4MetricsRequest { - - items := []otg.Bgpv4MetricsRequest_ColumnNames_Enum{} - for _, item := range value { - intValue := otg.Bgpv4MetricsRequest_ColumnNames_Enum_value[string(item)] - items = append(items, otg.Bgpv4MetricsRequest_ColumnNames_Enum(intValue)) - } - obj.obj.ColumnNames = items - return obj -} - -func (obj *bgpv4MetricsRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpv4MetricsRequest) setDefault() { - -} - -// ***** Bgpv6MetricsRequest ***** -type bgpv6MetricsRequest struct { - validation - obj *otg.Bgpv6MetricsRequest - marshaller marshalBgpv6MetricsRequest - unMarshaller unMarshalBgpv6MetricsRequest -} - -func NewBgpv6MetricsRequest() Bgpv6MetricsRequest { - obj := bgpv6MetricsRequest{obj: &otg.Bgpv6MetricsRequest{}} - obj.setDefault() - return &obj -} - -func (obj *bgpv6MetricsRequest) msg() *otg.Bgpv6MetricsRequest { - return obj.obj -} - -func (obj *bgpv6MetricsRequest) setMsg(msg *otg.Bgpv6MetricsRequest) Bgpv6MetricsRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpv6MetricsRequest struct { - obj *bgpv6MetricsRequest -} - -type marshalBgpv6MetricsRequest interface { - // ToProto marshals Bgpv6MetricsRequest to protobuf object *otg.Bgpv6MetricsRequest - ToProto() (*otg.Bgpv6MetricsRequest, error) - // ToPbText marshals Bgpv6MetricsRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals Bgpv6MetricsRequest to YAML text - ToYaml() (string, error) - // ToJson marshals Bgpv6MetricsRequest to JSON text - ToJson() (string, error) -} - -type unMarshalbgpv6MetricsRequest struct { - obj *bgpv6MetricsRequest -} - -type unMarshalBgpv6MetricsRequest interface { - // FromProto unmarshals Bgpv6MetricsRequest from protobuf object *otg.Bgpv6MetricsRequest - FromProto(msg *otg.Bgpv6MetricsRequest) (Bgpv6MetricsRequest, error) - // FromPbText unmarshals Bgpv6MetricsRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Bgpv6MetricsRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals Bgpv6MetricsRequest from JSON text - FromJson(value string) error -} - -func (obj *bgpv6MetricsRequest) Marshal() marshalBgpv6MetricsRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpv6MetricsRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpv6MetricsRequest) Unmarshal() unMarshalBgpv6MetricsRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpv6MetricsRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpv6MetricsRequest) ToProto() (*otg.Bgpv6MetricsRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpv6MetricsRequest) FromProto(msg *otg.Bgpv6MetricsRequest) (Bgpv6MetricsRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpv6MetricsRequest) 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 *unMarshalbgpv6MetricsRequest) 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 *marshalbgpv6MetricsRequest) 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 *unMarshalbgpv6MetricsRequest) 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 *marshalbgpv6MetricsRequest) 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 *unMarshalbgpv6MetricsRequest) 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 *bgpv6MetricsRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpv6MetricsRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpv6MetricsRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpv6MetricsRequest) Clone() (Bgpv6MetricsRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpv6MetricsRequest() - 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 -} - -// Bgpv6MetricsRequest is the request to retrieve BGPv6 per peer metrics/statistics. -type Bgpv6MetricsRequest interface { - Validation - // msg marshals Bgpv6MetricsRequest to protobuf object *otg.Bgpv6MetricsRequest - // and doesn't set defaults - msg() *otg.Bgpv6MetricsRequest - // setMsg unmarshals Bgpv6MetricsRequest from protobuf object *otg.Bgpv6MetricsRequest - // and doesn't set defaults - setMsg(*otg.Bgpv6MetricsRequest) Bgpv6MetricsRequest - // provides marshal interface - Marshal() marshalBgpv6MetricsRequest - // provides unmarshal interface - Unmarshal() unMarshalBgpv6MetricsRequest - // validate validates Bgpv6MetricsRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Bgpv6MetricsRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PeerNames returns []string, set in Bgpv6MetricsRequest. - PeerNames() []string - // SetPeerNames assigns []string provided by user to Bgpv6MetricsRequest - SetPeerNames(value []string) Bgpv6MetricsRequest - // ColumnNames returns []Bgpv6MetricsRequestColumnNamesEnum, set in Bgpv6MetricsRequest - ColumnNames() []Bgpv6MetricsRequestColumnNamesEnum - // SetColumnNames assigns []Bgpv6MetricsRequestColumnNamesEnum provided by user to Bgpv6MetricsRequest - SetColumnNames(value []Bgpv6MetricsRequestColumnNamesEnum) Bgpv6MetricsRequest -} - -// The names of BGPv6 peers to return results for. An empty list will return results for all BGPv6 peers. -// -// x-constraint: -// - /components/schemas/Bgp.V6peer/properties/name -// -// x-constraint: -// - /components/schemas/Bgp.V6peer/properties/name -// -// PeerNames returns a []string -func (obj *bgpv6MetricsRequest) PeerNames() []string { - if obj.obj.PeerNames == nil { - obj.obj.PeerNames = make([]string, 0) - } - return obj.obj.PeerNames -} - -// The names of BGPv6 peers to return results for. An empty list will return results for all BGPv6 peers. -// -// x-constraint: -// - /components/schemas/Bgp.V6peer/properties/name -// -// x-constraint: -// - /components/schemas/Bgp.V6peer/properties/name -// -// SetPeerNames sets the []string value in the Bgpv6MetricsRequest object -func (obj *bgpv6MetricsRequest) SetPeerNames(value []string) Bgpv6MetricsRequest { - - if obj.obj.PeerNames == nil { - obj.obj.PeerNames = make([]string, 0) - } - obj.obj.PeerNames = value - - return obj -} - -type Bgpv6MetricsRequestColumnNamesEnum string - -// Enum of ColumnNames on Bgpv6MetricsRequest -var Bgpv6MetricsRequestColumnNames = struct { - SESSION_STATE Bgpv6MetricsRequestColumnNamesEnum - SESSION_FLAP_COUNT Bgpv6MetricsRequestColumnNamesEnum - ROUTES_ADVERTISED Bgpv6MetricsRequestColumnNamesEnum - ROUTES_RECEIVED Bgpv6MetricsRequestColumnNamesEnum - ROUTE_WITHDRAWS_SENT Bgpv6MetricsRequestColumnNamesEnum - ROUTE_WITHDRAWS_RECEIVED Bgpv6MetricsRequestColumnNamesEnum - UPDATES_SENT Bgpv6MetricsRequestColumnNamesEnum - UPDATES_RECEIVED Bgpv6MetricsRequestColumnNamesEnum - OPENS_SENT Bgpv6MetricsRequestColumnNamesEnum - OPENS_RECEIVED Bgpv6MetricsRequestColumnNamesEnum - KEEPALIVES_SENT Bgpv6MetricsRequestColumnNamesEnum - KEEPALIVES_RECEIVED Bgpv6MetricsRequestColumnNamesEnum - NOTIFICATIONS_SENT Bgpv6MetricsRequestColumnNamesEnum - NOTIFICATIONS_RECEIVED Bgpv6MetricsRequestColumnNamesEnum - FSM_STATE Bgpv6MetricsRequestColumnNamesEnum - END_OF_RIB_RECEIVED Bgpv6MetricsRequestColumnNamesEnum -}{ - SESSION_STATE: Bgpv6MetricsRequestColumnNamesEnum("session_state"), - SESSION_FLAP_COUNT: Bgpv6MetricsRequestColumnNamesEnum("session_flap_count"), - ROUTES_ADVERTISED: Bgpv6MetricsRequestColumnNamesEnum("routes_advertised"), - ROUTES_RECEIVED: Bgpv6MetricsRequestColumnNamesEnum("routes_received"), - ROUTE_WITHDRAWS_SENT: Bgpv6MetricsRequestColumnNamesEnum("route_withdraws_sent"), - ROUTE_WITHDRAWS_RECEIVED: Bgpv6MetricsRequestColumnNamesEnum("route_withdraws_received"), - UPDATES_SENT: Bgpv6MetricsRequestColumnNamesEnum("updates_sent"), - UPDATES_RECEIVED: Bgpv6MetricsRequestColumnNamesEnum("updates_received"), - OPENS_SENT: Bgpv6MetricsRequestColumnNamesEnum("opens_sent"), - OPENS_RECEIVED: Bgpv6MetricsRequestColumnNamesEnum("opens_received"), - KEEPALIVES_SENT: Bgpv6MetricsRequestColumnNamesEnum("keepalives_sent"), - KEEPALIVES_RECEIVED: Bgpv6MetricsRequestColumnNamesEnum("keepalives_received"), - NOTIFICATIONS_SENT: Bgpv6MetricsRequestColumnNamesEnum("notifications_sent"), - NOTIFICATIONS_RECEIVED: Bgpv6MetricsRequestColumnNamesEnum("notifications_received"), - FSM_STATE: Bgpv6MetricsRequestColumnNamesEnum("fsm_state"), - END_OF_RIB_RECEIVED: Bgpv6MetricsRequestColumnNamesEnum("end_of_rib_received"), -} - -func (obj *bgpv6MetricsRequest) ColumnNames() []Bgpv6MetricsRequestColumnNamesEnum { - items := []Bgpv6MetricsRequestColumnNamesEnum{} - for _, item := range obj.obj.ColumnNames { - items = append(items, Bgpv6MetricsRequestColumnNamesEnum(item.String())) - } - return items -} - -// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned except for any result_groups. The name of the BGPv6 peer cannot be excluded. -// SetColumnNames sets the []string value in the Bgpv6MetricsRequest object -func (obj *bgpv6MetricsRequest) SetColumnNames(value []Bgpv6MetricsRequestColumnNamesEnum) Bgpv6MetricsRequest { - - items := []otg.Bgpv6MetricsRequest_ColumnNames_Enum{} - for _, item := range value { - intValue := otg.Bgpv6MetricsRequest_ColumnNames_Enum_value[string(item)] - items = append(items, otg.Bgpv6MetricsRequest_ColumnNames_Enum(intValue)) - } - obj.obj.ColumnNames = items - return obj -} - -func (obj *bgpv6MetricsRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpv6MetricsRequest) setDefault() { - -} - -// ***** IsisMetricsRequest ***** -type isisMetricsRequest struct { - validation - obj *otg.IsisMetricsRequest - marshaller marshalIsisMetricsRequest - unMarshaller unMarshalIsisMetricsRequest -} - -func NewIsisMetricsRequest() IsisMetricsRequest { - obj := isisMetricsRequest{obj: &otg.IsisMetricsRequest{}} - obj.setDefault() - return &obj -} - -func (obj *isisMetricsRequest) msg() *otg.IsisMetricsRequest { - return obj.obj -} - -func (obj *isisMetricsRequest) setMsg(msg *otg.IsisMetricsRequest) IsisMetricsRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisMetricsRequest struct { - obj *isisMetricsRequest -} - -type marshalIsisMetricsRequest interface { - // ToProto marshals IsisMetricsRequest to protobuf object *otg.IsisMetricsRequest - ToProto() (*otg.IsisMetricsRequest, error) - // ToPbText marshals IsisMetricsRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisMetricsRequest to YAML text - ToYaml() (string, error) - // ToJson marshals IsisMetricsRequest to JSON text - ToJson() (string, error) -} - -type unMarshalisisMetricsRequest struct { - obj *isisMetricsRequest -} - -type unMarshalIsisMetricsRequest interface { - // FromProto unmarshals IsisMetricsRequest from protobuf object *otg.IsisMetricsRequest - FromProto(msg *otg.IsisMetricsRequest) (IsisMetricsRequest, error) - // FromPbText unmarshals IsisMetricsRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisMetricsRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisMetricsRequest from JSON text - FromJson(value string) error -} - -func (obj *isisMetricsRequest) Marshal() marshalIsisMetricsRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalisisMetricsRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *isisMetricsRequest) Unmarshal() unMarshalIsisMetricsRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisMetricsRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisMetricsRequest) ToProto() (*otg.IsisMetricsRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisMetricsRequest) FromProto(msg *otg.IsisMetricsRequest) (IsisMetricsRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisMetricsRequest) 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 *unMarshalisisMetricsRequest) 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 *marshalisisMetricsRequest) 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 *unMarshalisisMetricsRequest) 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 *marshalisisMetricsRequest) 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 *unMarshalisisMetricsRequest) 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 *isisMetricsRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisMetricsRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisMetricsRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisMetricsRequest) Clone() (IsisMetricsRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisMetricsRequest() - 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 -} - -// IsisMetricsRequest is the request to retrieve ISIS per Router metrics/statistics. -type IsisMetricsRequest interface { - Validation - // msg marshals IsisMetricsRequest to protobuf object *otg.IsisMetricsRequest - // and doesn't set defaults - msg() *otg.IsisMetricsRequest - // setMsg unmarshals IsisMetricsRequest from protobuf object *otg.IsisMetricsRequest - // and doesn't set defaults - setMsg(*otg.IsisMetricsRequest) IsisMetricsRequest - // provides marshal interface - Marshal() marshalIsisMetricsRequest - // provides unmarshal interface - Unmarshal() unMarshalIsisMetricsRequest - // validate validates IsisMetricsRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisMetricsRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RouterNames returns []string, set in IsisMetricsRequest. - RouterNames() []string - // SetRouterNames assigns []string provided by user to IsisMetricsRequest - SetRouterNames(value []string) IsisMetricsRequest - // ColumnNames returns []IsisMetricsRequestColumnNamesEnum, set in IsisMetricsRequest - ColumnNames() []IsisMetricsRequestColumnNamesEnum - // SetColumnNames assigns []IsisMetricsRequestColumnNamesEnum provided by user to IsisMetricsRequest - SetColumnNames(value []IsisMetricsRequestColumnNamesEnum) IsisMetricsRequest -} - -// The names of ISIS Routers to return results for. An empty list will return results for all ISIS router. -// -// x-constraint: -// - /components/schemas/Device.IsisRouter/properties/name -// -// x-constraint: -// - /components/schemas/Device.IsisRouter/properties/name -// -// RouterNames returns a []string -func (obj *isisMetricsRequest) RouterNames() []string { - if obj.obj.RouterNames == nil { - obj.obj.RouterNames = make([]string, 0) - } - return obj.obj.RouterNames -} - -// The names of ISIS Routers to return results for. An empty list will return results for all ISIS router. -// -// x-constraint: -// - /components/schemas/Device.IsisRouter/properties/name -// -// x-constraint: -// - /components/schemas/Device.IsisRouter/properties/name -// -// SetRouterNames sets the []string value in the IsisMetricsRequest object -func (obj *isisMetricsRequest) SetRouterNames(value []string) IsisMetricsRequest { - - if obj.obj.RouterNames == nil { - obj.obj.RouterNames = make([]string, 0) - } - obj.obj.RouterNames = value - - return obj -} - -type IsisMetricsRequestColumnNamesEnum string - -// Enum of ColumnNames on IsisMetricsRequest -var IsisMetricsRequestColumnNames = struct { - L1_SESSIONS_UP IsisMetricsRequestColumnNamesEnum - L1_SESSION_FLAP IsisMetricsRequestColumnNamesEnum - L1_DATABASE_SIZE IsisMetricsRequestColumnNamesEnum - L1_BROADCAST_HELLOS_SENT IsisMetricsRequestColumnNamesEnum - L1_BROADCAST_HELLOS_RECEIVED IsisMetricsRequestColumnNamesEnum - L1_POINT_TO_POINT_HELLOS_SENT IsisMetricsRequestColumnNamesEnum - L1_POINT_TO_POINT_HELLOS_RECEIVED IsisMetricsRequestColumnNamesEnum - L1_PSNP_SENT IsisMetricsRequestColumnNamesEnum - L1_PSNP_RECEIVED IsisMetricsRequestColumnNamesEnum - L1_CSNP_SENT IsisMetricsRequestColumnNamesEnum - L1_CSNP_RECEIVED IsisMetricsRequestColumnNamesEnum - L1_LSP_SENT IsisMetricsRequestColumnNamesEnum - L1_LSP_RECEIVED IsisMetricsRequestColumnNamesEnum - L2_SESSIONS_UP IsisMetricsRequestColumnNamesEnum - L2_SESSION_FLAP IsisMetricsRequestColumnNamesEnum - L2_DATABASE_SIZE IsisMetricsRequestColumnNamesEnum - L2_BROADCAST_HELLOS_SENT IsisMetricsRequestColumnNamesEnum - L2_BROADCAST_HELLOS_RECEIVED IsisMetricsRequestColumnNamesEnum - L2_POINT_TO_POINT_HELLOS_SENT IsisMetricsRequestColumnNamesEnum - L2_POINT_TO_POINT_HELLOS_RECEIVED IsisMetricsRequestColumnNamesEnum - L2_PSNP_SENT IsisMetricsRequestColumnNamesEnum - L2_PSNP_RECEIVED IsisMetricsRequestColumnNamesEnum - L2_CSNP_SENT IsisMetricsRequestColumnNamesEnum - L2_CSNP_RECEIVED IsisMetricsRequestColumnNamesEnum - L2_LSP_SENT IsisMetricsRequestColumnNamesEnum - L2_LSP_RECEIVED IsisMetricsRequestColumnNamesEnum -}{ - L1_SESSIONS_UP: IsisMetricsRequestColumnNamesEnum("l1_sessions_up"), - L1_SESSION_FLAP: IsisMetricsRequestColumnNamesEnum("l1_session_flap"), - L1_DATABASE_SIZE: IsisMetricsRequestColumnNamesEnum("l1_database_size"), - L1_BROADCAST_HELLOS_SENT: IsisMetricsRequestColumnNamesEnum("l1_broadcast_hellos_sent"), - L1_BROADCAST_HELLOS_RECEIVED: IsisMetricsRequestColumnNamesEnum("l1_broadcast_hellos_received"), - L1_POINT_TO_POINT_HELLOS_SENT: IsisMetricsRequestColumnNamesEnum("l1_point_to_point_hellos_sent"), - L1_POINT_TO_POINT_HELLOS_RECEIVED: IsisMetricsRequestColumnNamesEnum("l1_point_to_point_hellos_received"), - L1_PSNP_SENT: IsisMetricsRequestColumnNamesEnum("l1_psnp_sent"), - L1_PSNP_RECEIVED: IsisMetricsRequestColumnNamesEnum("l1_psnp_received"), - L1_CSNP_SENT: IsisMetricsRequestColumnNamesEnum("l1_csnp_sent"), - L1_CSNP_RECEIVED: IsisMetricsRequestColumnNamesEnum("l1_csnp_received"), - L1_LSP_SENT: IsisMetricsRequestColumnNamesEnum("l1_lsp_sent"), - L1_LSP_RECEIVED: IsisMetricsRequestColumnNamesEnum("l1_lsp_received"), - L2_SESSIONS_UP: IsisMetricsRequestColumnNamesEnum("l2_sessions_up"), - L2_SESSION_FLAP: IsisMetricsRequestColumnNamesEnum("l2_session_flap"), - L2_DATABASE_SIZE: IsisMetricsRequestColumnNamesEnum("l2_database_size"), - L2_BROADCAST_HELLOS_SENT: IsisMetricsRequestColumnNamesEnum("l2_broadcast_hellos_sent"), - L2_BROADCAST_HELLOS_RECEIVED: IsisMetricsRequestColumnNamesEnum("l2_broadcast_hellos_received"), - L2_POINT_TO_POINT_HELLOS_SENT: IsisMetricsRequestColumnNamesEnum("l2_point_to_point_hellos_sent"), - L2_POINT_TO_POINT_HELLOS_RECEIVED: IsisMetricsRequestColumnNamesEnum("l2_point_to_point_hellos_received"), - L2_PSNP_SENT: IsisMetricsRequestColumnNamesEnum("l2_psnp_sent"), - L2_PSNP_RECEIVED: IsisMetricsRequestColumnNamesEnum("l2_psnp_received"), - L2_CSNP_SENT: IsisMetricsRequestColumnNamesEnum("l2_csnp_sent"), - L2_CSNP_RECEIVED: IsisMetricsRequestColumnNamesEnum("l2_csnp_received"), - L2_LSP_SENT: IsisMetricsRequestColumnNamesEnum("l2_lsp_sent"), - L2_LSP_RECEIVED: IsisMetricsRequestColumnNamesEnum("l2_lsp_received"), -} - -func (obj *isisMetricsRequest) ColumnNames() []IsisMetricsRequestColumnNamesEnum { - items := []IsisMetricsRequestColumnNamesEnum{} - for _, item := range obj.obj.ColumnNames { - items = append(items, IsisMetricsRequestColumnNamesEnum(item.String())) - } - return items -} - -// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned except for any result_groups. The name of the ISIS Router cannot be excluded. -// SetColumnNames sets the []string value in the IsisMetricsRequest object -func (obj *isisMetricsRequest) SetColumnNames(value []IsisMetricsRequestColumnNamesEnum) IsisMetricsRequest { - - items := []otg.IsisMetricsRequest_ColumnNames_Enum{} - for _, item := range value { - intValue := otg.IsisMetricsRequest_ColumnNames_Enum_value[string(item)] - items = append(items, otg.IsisMetricsRequest_ColumnNames_Enum(intValue)) - } - obj.obj.ColumnNames = items - return obj -} - -func (obj *isisMetricsRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *isisMetricsRequest) setDefault() { - -} - -// ***** LagMetricsRequest ***** -type lagMetricsRequest struct { - validation - obj *otg.LagMetricsRequest - marshaller marshalLagMetricsRequest - unMarshaller unMarshalLagMetricsRequest -} - -func NewLagMetricsRequest() LagMetricsRequest { - obj := lagMetricsRequest{obj: &otg.LagMetricsRequest{}} - obj.setDefault() - return &obj -} - -func (obj *lagMetricsRequest) msg() *otg.LagMetricsRequest { - return obj.obj -} - -func (obj *lagMetricsRequest) setMsg(msg *otg.LagMetricsRequest) LagMetricsRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallagMetricsRequest struct { - obj *lagMetricsRequest -} - -type marshalLagMetricsRequest interface { - // ToProto marshals LagMetricsRequest to protobuf object *otg.LagMetricsRequest - ToProto() (*otg.LagMetricsRequest, error) - // ToPbText marshals LagMetricsRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals LagMetricsRequest to YAML text - ToYaml() (string, error) - // ToJson marshals LagMetricsRequest to JSON text - ToJson() (string, error) -} - -type unMarshallagMetricsRequest struct { - obj *lagMetricsRequest -} - -type unMarshalLagMetricsRequest interface { - // FromProto unmarshals LagMetricsRequest from protobuf object *otg.LagMetricsRequest - FromProto(msg *otg.LagMetricsRequest) (LagMetricsRequest, error) - // FromPbText unmarshals LagMetricsRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LagMetricsRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals LagMetricsRequest from JSON text - FromJson(value string) error -} - -func (obj *lagMetricsRequest) Marshal() marshalLagMetricsRequest { - if obj.marshaller == nil { - obj.marshaller = &marshallagMetricsRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *lagMetricsRequest) Unmarshal() unMarshalLagMetricsRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallagMetricsRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallagMetricsRequest) ToProto() (*otg.LagMetricsRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallagMetricsRequest) FromProto(msg *otg.LagMetricsRequest) (LagMetricsRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallagMetricsRequest) 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 *unMarshallagMetricsRequest) 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 *marshallagMetricsRequest) 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 *unMarshallagMetricsRequest) 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 *marshallagMetricsRequest) 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 *unMarshallagMetricsRequest) 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 *lagMetricsRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lagMetricsRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lagMetricsRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lagMetricsRequest) Clone() (LagMetricsRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLagMetricsRequest() - 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 -} - -// LagMetricsRequest is the request to retrieve per LAG metrics/statistics. -type LagMetricsRequest interface { - Validation - // msg marshals LagMetricsRequest to protobuf object *otg.LagMetricsRequest - // and doesn't set defaults - msg() *otg.LagMetricsRequest - // setMsg unmarshals LagMetricsRequest from protobuf object *otg.LagMetricsRequest - // and doesn't set defaults - setMsg(*otg.LagMetricsRequest) LagMetricsRequest - // provides marshal interface - Marshal() marshalLagMetricsRequest - // provides unmarshal interface - Unmarshal() unMarshalLagMetricsRequest - // validate validates LagMetricsRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LagMetricsRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // LagNames returns []string, set in LagMetricsRequest. - LagNames() []string - // SetLagNames assigns []string provided by user to LagMetricsRequest - SetLagNames(value []string) LagMetricsRequest - // ColumnNames returns []LagMetricsRequestColumnNamesEnum, set in LagMetricsRequest - ColumnNames() []LagMetricsRequestColumnNamesEnum - // SetColumnNames assigns []LagMetricsRequestColumnNamesEnum provided by user to LagMetricsRequest - SetColumnNames(value []LagMetricsRequestColumnNamesEnum) LagMetricsRequest -} - -// The names of LAGs to return results for. An empty list will return results for all LAGs. -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// LagNames returns a []string -func (obj *lagMetricsRequest) LagNames() []string { - if obj.obj.LagNames == nil { - obj.obj.LagNames = make([]string, 0) - } - return obj.obj.LagNames -} - -// The names of LAGs to return results for. An empty list will return results for all LAGs. -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// SetLagNames sets the []string value in the LagMetricsRequest object -func (obj *lagMetricsRequest) SetLagNames(value []string) LagMetricsRequest { - - if obj.obj.LagNames == nil { - obj.obj.LagNames = make([]string, 0) - } - obj.obj.LagNames = value - - return obj -} - -type LagMetricsRequestColumnNamesEnum string - -// Enum of ColumnNames on LagMetricsRequest -var LagMetricsRequestColumnNames = struct { - OPER_STATUS LagMetricsRequestColumnNamesEnum - MEMBER_PORTS_UP LagMetricsRequestColumnNamesEnum - FRAMES_TX LagMetricsRequestColumnNamesEnum - FRAMES_RX LagMetricsRequestColumnNamesEnum - BYTES_TX LagMetricsRequestColumnNamesEnum - BYTES_RX LagMetricsRequestColumnNamesEnum - FRAMES_TX_RATE LagMetricsRequestColumnNamesEnum - FRAMES_RX_RATE LagMetricsRequestColumnNamesEnum - BYTES_TX_RATE LagMetricsRequestColumnNamesEnum - BYTES_RX_RATE LagMetricsRequestColumnNamesEnum -}{ - OPER_STATUS: LagMetricsRequestColumnNamesEnum("oper_status"), - MEMBER_PORTS_UP: LagMetricsRequestColumnNamesEnum("member_ports_up"), - FRAMES_TX: LagMetricsRequestColumnNamesEnum("frames_tx"), - FRAMES_RX: LagMetricsRequestColumnNamesEnum("frames_rx"), - BYTES_TX: LagMetricsRequestColumnNamesEnum("bytes_tx"), - BYTES_RX: LagMetricsRequestColumnNamesEnum("bytes_rx"), - FRAMES_TX_RATE: LagMetricsRequestColumnNamesEnum("frames_tx_rate"), - FRAMES_RX_RATE: LagMetricsRequestColumnNamesEnum("frames_rx_rate"), - BYTES_TX_RATE: LagMetricsRequestColumnNamesEnum("bytes_tx_rate"), - BYTES_RX_RATE: LagMetricsRequestColumnNamesEnum("bytes_rx_rate"), -} - -func (obj *lagMetricsRequest) ColumnNames() []LagMetricsRequestColumnNamesEnum { - items := []LagMetricsRequestColumnNamesEnum{} - for _, item := range obj.obj.ColumnNames { - items = append(items, LagMetricsRequestColumnNamesEnum(item.String())) - } - return items -} - -// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned. The name of the LAG cannot be excluded. -// SetColumnNames sets the []string value in the LagMetricsRequest object -func (obj *lagMetricsRequest) SetColumnNames(value []LagMetricsRequestColumnNamesEnum) LagMetricsRequest { - - items := []otg.LagMetricsRequest_ColumnNames_Enum{} - for _, item := range value { - intValue := otg.LagMetricsRequest_ColumnNames_Enum_value[string(item)] - items = append(items, otg.LagMetricsRequest_ColumnNames_Enum(intValue)) - } - obj.obj.ColumnNames = items - return obj -} - -func (obj *lagMetricsRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *lagMetricsRequest) setDefault() { - -} - -// ***** LacpMetricsRequest ***** -type lacpMetricsRequest struct { - validation - obj *otg.LacpMetricsRequest - marshaller marshalLacpMetricsRequest - unMarshaller unMarshalLacpMetricsRequest -} - -func NewLacpMetricsRequest() LacpMetricsRequest { - obj := lacpMetricsRequest{obj: &otg.LacpMetricsRequest{}} - obj.setDefault() - return &obj -} - -func (obj *lacpMetricsRequest) msg() *otg.LacpMetricsRequest { - return obj.obj -} - -func (obj *lacpMetricsRequest) setMsg(msg *otg.LacpMetricsRequest) LacpMetricsRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallacpMetricsRequest struct { - obj *lacpMetricsRequest -} - -type marshalLacpMetricsRequest interface { - // ToProto marshals LacpMetricsRequest to protobuf object *otg.LacpMetricsRequest - ToProto() (*otg.LacpMetricsRequest, error) - // ToPbText marshals LacpMetricsRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals LacpMetricsRequest to YAML text - ToYaml() (string, error) - // ToJson marshals LacpMetricsRequest to JSON text - ToJson() (string, error) -} - -type unMarshallacpMetricsRequest struct { - obj *lacpMetricsRequest -} - -type unMarshalLacpMetricsRequest interface { - // FromProto unmarshals LacpMetricsRequest from protobuf object *otg.LacpMetricsRequest - FromProto(msg *otg.LacpMetricsRequest) (LacpMetricsRequest, error) - // FromPbText unmarshals LacpMetricsRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LacpMetricsRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals LacpMetricsRequest from JSON text - FromJson(value string) error -} - -func (obj *lacpMetricsRequest) Marshal() marshalLacpMetricsRequest { - if obj.marshaller == nil { - obj.marshaller = &marshallacpMetricsRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *lacpMetricsRequest) Unmarshal() unMarshalLacpMetricsRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallacpMetricsRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallacpMetricsRequest) ToProto() (*otg.LacpMetricsRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallacpMetricsRequest) FromProto(msg *otg.LacpMetricsRequest) (LacpMetricsRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallacpMetricsRequest) 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 *unMarshallacpMetricsRequest) 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 *marshallacpMetricsRequest) 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 *unMarshallacpMetricsRequest) 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 *marshallacpMetricsRequest) 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 *unMarshallacpMetricsRequest) 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 *lacpMetricsRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lacpMetricsRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lacpMetricsRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lacpMetricsRequest) Clone() (LacpMetricsRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLacpMetricsRequest() - 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 -} - -// LacpMetricsRequest is the request to retrieve LACP per LAG member metrics/statistics. -type LacpMetricsRequest interface { - Validation - // msg marshals LacpMetricsRequest to protobuf object *otg.LacpMetricsRequest - // and doesn't set defaults - msg() *otg.LacpMetricsRequest - // setMsg unmarshals LacpMetricsRequest from protobuf object *otg.LacpMetricsRequest - // and doesn't set defaults - setMsg(*otg.LacpMetricsRequest) LacpMetricsRequest - // provides marshal interface - Marshal() marshalLacpMetricsRequest - // provides unmarshal interface - Unmarshal() unMarshalLacpMetricsRequest - // validate validates LacpMetricsRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LacpMetricsRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // LagNames returns []string, set in LacpMetricsRequest. - LagNames() []string - // SetLagNames assigns []string provided by user to LacpMetricsRequest - SetLagNames(value []string) LacpMetricsRequest - // LagMemberPortNames returns []string, set in LacpMetricsRequest. - LagMemberPortNames() []string - // SetLagMemberPortNames assigns []string provided by user to LacpMetricsRequest - SetLagMemberPortNames(value []string) LacpMetricsRequest - // ColumnNames returns []LacpMetricsRequestColumnNamesEnum, set in LacpMetricsRequest - ColumnNames() []LacpMetricsRequestColumnNamesEnum - // SetColumnNames assigns []LacpMetricsRequestColumnNamesEnum provided by user to LacpMetricsRequest - SetColumnNames(value []LacpMetricsRequestColumnNamesEnum) LacpMetricsRequest -} - -// The names of LAG (ports group) for which LACP metrics to be returned. An empty list will return metrics for all LAGs. -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// LagNames returns a []string -func (obj *lacpMetricsRequest) LagNames() []string { - if obj.obj.LagNames == nil { - obj.obj.LagNames = make([]string, 0) - } - return obj.obj.LagNames -} - -// The names of LAG (ports group) for which LACP metrics to be returned. An empty list will return metrics for all LAGs. -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// SetLagNames sets the []string value in the LacpMetricsRequest object -func (obj *lacpMetricsRequest) SetLagNames(value []string) LacpMetricsRequest { - - if obj.obj.LagNames == nil { - obj.obj.LagNames = make([]string, 0) - } - obj.obj.LagNames = value - - return obj -} - -// The names of LAG members (ports) for which LACP metrics to be returned. An empty list will return metrics for all LAG members. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// LagMemberPortNames returns a []string -func (obj *lacpMetricsRequest) LagMemberPortNames() []string { - if obj.obj.LagMemberPortNames == nil { - obj.obj.LagMemberPortNames = make([]string, 0) - } - return obj.obj.LagMemberPortNames -} - -// The names of LAG members (ports) for which LACP metrics to be returned. An empty list will return metrics for all LAG members. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// SetLagMemberPortNames sets the []string value in the LacpMetricsRequest object -func (obj *lacpMetricsRequest) SetLagMemberPortNames(value []string) LacpMetricsRequest { - - if obj.obj.LagMemberPortNames == nil { - obj.obj.LagMemberPortNames = make([]string, 0) - } - obj.obj.LagMemberPortNames = value - - return obj -} - -type LacpMetricsRequestColumnNamesEnum string - -// Enum of ColumnNames on LacpMetricsRequest -var LacpMetricsRequestColumnNames = struct { - LACP_PACKETS_RX LacpMetricsRequestColumnNamesEnum - LACP_PACKETS_TX LacpMetricsRequestColumnNamesEnum - LACP_RX_ERRORS LacpMetricsRequestColumnNamesEnum - ACTIVITY LacpMetricsRequestColumnNamesEnum - TIMEOUT LacpMetricsRequestColumnNamesEnum - SYNCHRONIZATION LacpMetricsRequestColumnNamesEnum - AGGREGATABLE LacpMetricsRequestColumnNamesEnum - COLLECTING LacpMetricsRequestColumnNamesEnum - DISTRIBUTING LacpMetricsRequestColumnNamesEnum - SYSTEM_ID LacpMetricsRequestColumnNamesEnum - OPER_KEY LacpMetricsRequestColumnNamesEnum - PARTNER_ID LacpMetricsRequestColumnNamesEnum - PARTNER_KEY LacpMetricsRequestColumnNamesEnum - PORT_NUM LacpMetricsRequestColumnNamesEnum - PARTNER_PORT_NUM LacpMetricsRequestColumnNamesEnum -}{ - LACP_PACKETS_RX: LacpMetricsRequestColumnNamesEnum("lacp_packets_rx"), - LACP_PACKETS_TX: LacpMetricsRequestColumnNamesEnum("lacp_packets_tx"), - LACP_RX_ERRORS: LacpMetricsRequestColumnNamesEnum("lacp_rx_errors"), - ACTIVITY: LacpMetricsRequestColumnNamesEnum("activity"), - TIMEOUT: LacpMetricsRequestColumnNamesEnum("timeout"), - SYNCHRONIZATION: LacpMetricsRequestColumnNamesEnum("synchronization"), - AGGREGATABLE: LacpMetricsRequestColumnNamesEnum("aggregatable"), - COLLECTING: LacpMetricsRequestColumnNamesEnum("collecting"), - DISTRIBUTING: LacpMetricsRequestColumnNamesEnum("distributing"), - SYSTEM_ID: LacpMetricsRequestColumnNamesEnum("system_id"), - OPER_KEY: LacpMetricsRequestColumnNamesEnum("oper_key"), - PARTNER_ID: LacpMetricsRequestColumnNamesEnum("partner_id"), - PARTNER_KEY: LacpMetricsRequestColumnNamesEnum("partner_key"), - PORT_NUM: LacpMetricsRequestColumnNamesEnum("port_num"), - PARTNER_PORT_NUM: LacpMetricsRequestColumnNamesEnum("partner_port_num"), -} - -func (obj *lacpMetricsRequest) ColumnNames() []LacpMetricsRequestColumnNamesEnum { - items := []LacpMetricsRequestColumnNamesEnum{} - for _, item := range obj.obj.ColumnNames { - items = append(items, LacpMetricsRequestColumnNamesEnum(item.String())) - } - return items -} - -// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned. The name of LAG and LAG member can not be excluded. -// SetColumnNames sets the []string value in the LacpMetricsRequest object -func (obj *lacpMetricsRequest) SetColumnNames(value []LacpMetricsRequestColumnNamesEnum) LacpMetricsRequest { - - items := []otg.LacpMetricsRequest_ColumnNames_Enum{} - for _, item := range value { - intValue := otg.LacpMetricsRequest_ColumnNames_Enum_value[string(item)] - items = append(items, otg.LacpMetricsRequest_ColumnNames_Enum(intValue)) - } - obj.obj.ColumnNames = items - return obj -} - -func (obj *lacpMetricsRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *lacpMetricsRequest) setDefault() { - -} - -// ***** LldpMetricsRequest ***** -type lldpMetricsRequest struct { - validation - obj *otg.LldpMetricsRequest - marshaller marshalLldpMetricsRequest - unMarshaller unMarshalLldpMetricsRequest -} - -func NewLldpMetricsRequest() LldpMetricsRequest { - obj := lldpMetricsRequest{obj: &otg.LldpMetricsRequest{}} - obj.setDefault() - return &obj -} - -func (obj *lldpMetricsRequest) msg() *otg.LldpMetricsRequest { - return obj.obj -} - -func (obj *lldpMetricsRequest) setMsg(msg *otg.LldpMetricsRequest) LldpMetricsRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallldpMetricsRequest struct { - obj *lldpMetricsRequest -} - -type marshalLldpMetricsRequest interface { - // ToProto marshals LldpMetricsRequest to protobuf object *otg.LldpMetricsRequest - ToProto() (*otg.LldpMetricsRequest, error) - // ToPbText marshals LldpMetricsRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals LldpMetricsRequest to YAML text - ToYaml() (string, error) - // ToJson marshals LldpMetricsRequest to JSON text - ToJson() (string, error) -} - -type unMarshallldpMetricsRequest struct { - obj *lldpMetricsRequest -} - -type unMarshalLldpMetricsRequest interface { - // FromProto unmarshals LldpMetricsRequest from protobuf object *otg.LldpMetricsRequest - FromProto(msg *otg.LldpMetricsRequest) (LldpMetricsRequest, error) - // FromPbText unmarshals LldpMetricsRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LldpMetricsRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals LldpMetricsRequest from JSON text - FromJson(value string) error -} - -func (obj *lldpMetricsRequest) Marshal() marshalLldpMetricsRequest { - if obj.marshaller == nil { - obj.marshaller = &marshallldpMetricsRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *lldpMetricsRequest) Unmarshal() unMarshalLldpMetricsRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallldpMetricsRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallldpMetricsRequest) ToProto() (*otg.LldpMetricsRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallldpMetricsRequest) FromProto(msg *otg.LldpMetricsRequest) (LldpMetricsRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallldpMetricsRequest) 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 *unMarshallldpMetricsRequest) 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 *marshallldpMetricsRequest) 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 *unMarshallldpMetricsRequest) 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 *marshallldpMetricsRequest) 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 *unMarshallldpMetricsRequest) 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 *lldpMetricsRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lldpMetricsRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lldpMetricsRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lldpMetricsRequest) Clone() (LldpMetricsRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLldpMetricsRequest() - 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 -} - -// LldpMetricsRequest is the request to retrieve LLDP per instance metrics/statistics. -type LldpMetricsRequest interface { - Validation - // msg marshals LldpMetricsRequest to protobuf object *otg.LldpMetricsRequest - // and doesn't set defaults - msg() *otg.LldpMetricsRequest - // setMsg unmarshals LldpMetricsRequest from protobuf object *otg.LldpMetricsRequest - // and doesn't set defaults - setMsg(*otg.LldpMetricsRequest) LldpMetricsRequest - // provides marshal interface - Marshal() marshalLldpMetricsRequest - // provides unmarshal interface - Unmarshal() unMarshalLldpMetricsRequest - // validate validates LldpMetricsRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LldpMetricsRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // LldpNames returns []string, set in LldpMetricsRequest. - LldpNames() []string - // SetLldpNames assigns []string provided by user to LldpMetricsRequest - SetLldpNames(value []string) LldpMetricsRequest - // ColumnNames returns []LldpMetricsRequestColumnNamesEnum, set in LldpMetricsRequest - ColumnNames() []LldpMetricsRequestColumnNamesEnum - // SetColumnNames assigns []LldpMetricsRequestColumnNamesEnum provided by user to LldpMetricsRequest - SetColumnNames(value []LldpMetricsRequestColumnNamesEnum) LldpMetricsRequest -} - -// The names of LLDP instances to return results for. An empty list will return results for all LLDP instances. -// -// x-constraint: -// - /components/schemas/Lldp/properties/name -// -// x-constraint: -// - /components/schemas/Lldp/properties/name -// -// LldpNames returns a []string -func (obj *lldpMetricsRequest) LldpNames() []string { - if obj.obj.LldpNames == nil { - obj.obj.LldpNames = make([]string, 0) - } - return obj.obj.LldpNames -} - -// The names of LLDP instances to return results for. An empty list will return results for all LLDP instances. -// -// x-constraint: -// - /components/schemas/Lldp/properties/name -// -// x-constraint: -// - /components/schemas/Lldp/properties/name -// -// SetLldpNames sets the []string value in the LldpMetricsRequest object -func (obj *lldpMetricsRequest) SetLldpNames(value []string) LldpMetricsRequest { - - if obj.obj.LldpNames == nil { - obj.obj.LldpNames = make([]string, 0) - } - obj.obj.LldpNames = value - - return obj -} - -type LldpMetricsRequestColumnNamesEnum string - -// Enum of ColumnNames on LldpMetricsRequest -var LldpMetricsRequestColumnNames = struct { - FRAMES_RX LldpMetricsRequestColumnNamesEnum - FRAMES_TX LldpMetricsRequestColumnNamesEnum - FRAMES_ERROR_RX LldpMetricsRequestColumnNamesEnum - FRAMES_DISCARD LldpMetricsRequestColumnNamesEnum - TLVS_DISCARD LldpMetricsRequestColumnNamesEnum - TLVS_UNKNOWN LldpMetricsRequestColumnNamesEnum -}{ - FRAMES_RX: LldpMetricsRequestColumnNamesEnum("frames_rx"), - FRAMES_TX: LldpMetricsRequestColumnNamesEnum("frames_tx"), - FRAMES_ERROR_RX: LldpMetricsRequestColumnNamesEnum("frames_error_rx"), - FRAMES_DISCARD: LldpMetricsRequestColumnNamesEnum("frames_discard"), - TLVS_DISCARD: LldpMetricsRequestColumnNamesEnum("tlvs_discard"), - TLVS_UNKNOWN: LldpMetricsRequestColumnNamesEnum("tlvs_unknown"), -} - -func (obj *lldpMetricsRequest) ColumnNames() []LldpMetricsRequestColumnNamesEnum { - items := []LldpMetricsRequestColumnNamesEnum{} - for _, item := range obj.obj.ColumnNames { - items = append(items, LldpMetricsRequestColumnNamesEnum(item.String())) - } - return items -} - -// The requested list of column names for the result set. If the list is empty then metrics for all columns will be returned. The name of LLDP instance can not be excluded. -// SetColumnNames sets the []string value in the LldpMetricsRequest object -func (obj *lldpMetricsRequest) SetColumnNames(value []LldpMetricsRequestColumnNamesEnum) LldpMetricsRequest { - - items := []otg.LldpMetricsRequest_ColumnNames_Enum{} - for _, item := range value { - intValue := otg.LldpMetricsRequest_ColumnNames_Enum_value[string(item)] - items = append(items, otg.LldpMetricsRequest_ColumnNames_Enum(intValue)) - } - obj.obj.ColumnNames = items - return obj -} - -func (obj *lldpMetricsRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *lldpMetricsRequest) setDefault() { - -} - -// ***** RsvpMetricsRequest ***** -type rsvpMetricsRequest struct { - validation - obj *otg.RsvpMetricsRequest - marshaller marshalRsvpMetricsRequest - unMarshaller unMarshalRsvpMetricsRequest -} - -func NewRsvpMetricsRequest() RsvpMetricsRequest { - obj := rsvpMetricsRequest{obj: &otg.RsvpMetricsRequest{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpMetricsRequest) msg() *otg.RsvpMetricsRequest { - return obj.obj -} - -func (obj *rsvpMetricsRequest) setMsg(msg *otg.RsvpMetricsRequest) RsvpMetricsRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpMetricsRequest struct { - obj *rsvpMetricsRequest -} - -type marshalRsvpMetricsRequest interface { - // ToProto marshals RsvpMetricsRequest to protobuf object *otg.RsvpMetricsRequest - ToProto() (*otg.RsvpMetricsRequest, error) - // ToPbText marshals RsvpMetricsRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpMetricsRequest to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpMetricsRequest to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpMetricsRequest struct { - obj *rsvpMetricsRequest -} - -type unMarshalRsvpMetricsRequest interface { - // FromProto unmarshals RsvpMetricsRequest from protobuf object *otg.RsvpMetricsRequest - FromProto(msg *otg.RsvpMetricsRequest) (RsvpMetricsRequest, error) - // FromPbText unmarshals RsvpMetricsRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpMetricsRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpMetricsRequest from JSON text - FromJson(value string) error -} - -func (obj *rsvpMetricsRequest) Marshal() marshalRsvpMetricsRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpMetricsRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpMetricsRequest) Unmarshal() unMarshalRsvpMetricsRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpMetricsRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpMetricsRequest) ToProto() (*otg.RsvpMetricsRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpMetricsRequest) FromProto(msg *otg.RsvpMetricsRequest) (RsvpMetricsRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpMetricsRequest) 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 *unMarshalrsvpMetricsRequest) 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 *marshalrsvpMetricsRequest) 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 *unMarshalrsvpMetricsRequest) 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 *marshalrsvpMetricsRequest) 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 *unMarshalrsvpMetricsRequest) 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 *rsvpMetricsRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpMetricsRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpMetricsRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpMetricsRequest) Clone() (RsvpMetricsRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpMetricsRequest() - 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 -} - -// RsvpMetricsRequest is the request to retrieve RSVP-TE per Router metrics/statistics. -type RsvpMetricsRequest interface { - Validation - // msg marshals RsvpMetricsRequest to protobuf object *otg.RsvpMetricsRequest - // and doesn't set defaults - msg() *otg.RsvpMetricsRequest - // setMsg unmarshals RsvpMetricsRequest from protobuf object *otg.RsvpMetricsRequest - // and doesn't set defaults - setMsg(*otg.RsvpMetricsRequest) RsvpMetricsRequest - // provides marshal interface - Marshal() marshalRsvpMetricsRequest - // provides unmarshal interface - Unmarshal() unMarshalRsvpMetricsRequest - // validate validates RsvpMetricsRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpMetricsRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RouterNames returns []string, set in RsvpMetricsRequest. - RouterNames() []string - // SetRouterNames assigns []string provided by user to RsvpMetricsRequest - SetRouterNames(value []string) RsvpMetricsRequest - // ColumnNames returns []RsvpMetricsRequestColumnNamesEnum, set in RsvpMetricsRequest - ColumnNames() []RsvpMetricsRequestColumnNamesEnum - // SetColumnNames assigns []RsvpMetricsRequestColumnNamesEnum provided by user to RsvpMetricsRequest - SetColumnNames(value []RsvpMetricsRequestColumnNamesEnum) RsvpMetricsRequest -} - -// The names of RSVP-TE Routers to return results for. An empty list as input will return results for all RSVP-TE routers. -// -// x-constraint: -// - /components/schemas/Device.Rsvp/properties/name -// -// x-constraint: -// - /components/schemas/Device.Rsvp/properties/name -// -// RouterNames returns a []string -func (obj *rsvpMetricsRequest) RouterNames() []string { - if obj.obj.RouterNames == nil { - obj.obj.RouterNames = make([]string, 0) - } - return obj.obj.RouterNames -} - -// The names of RSVP-TE Routers to return results for. An empty list as input will return results for all RSVP-TE routers. -// -// x-constraint: -// - /components/schemas/Device.Rsvp/properties/name -// -// x-constraint: -// - /components/schemas/Device.Rsvp/properties/name -// -// SetRouterNames sets the []string value in the RsvpMetricsRequest object -func (obj *rsvpMetricsRequest) SetRouterNames(value []string) RsvpMetricsRequest { - - if obj.obj.RouterNames == nil { - obj.obj.RouterNames = make([]string, 0) - } - obj.obj.RouterNames = value - - return obj -} - -type RsvpMetricsRequestColumnNamesEnum string - -// Enum of ColumnNames on RsvpMetricsRequest -var RsvpMetricsRequestColumnNames = struct { - INGRESS_P2P_LSPS_CONFIGURED RsvpMetricsRequestColumnNamesEnum - INGRESS_P2P_LSPS_UP RsvpMetricsRequestColumnNamesEnum - EGRESS_P2P_LSPS_UP RsvpMetricsRequestColumnNamesEnum - LSP_FLAP_COUNT RsvpMetricsRequestColumnNamesEnum - PATHS_TX RsvpMetricsRequestColumnNamesEnum - PATHS_RX RsvpMetricsRequestColumnNamesEnum - RESVS_TX RsvpMetricsRequestColumnNamesEnum - RESVS_RX RsvpMetricsRequestColumnNamesEnum - PATH_TEARS_TX RsvpMetricsRequestColumnNamesEnum - PATH_TEARS_RX RsvpMetricsRequestColumnNamesEnum - RESV_TEARS_TX RsvpMetricsRequestColumnNamesEnum - RESV_TEARS_RX RsvpMetricsRequestColumnNamesEnum - PATH_ERRORS_TX RsvpMetricsRequestColumnNamesEnum - PATH_ERRORS_RX RsvpMetricsRequestColumnNamesEnum - RESV_ERRORS_TX RsvpMetricsRequestColumnNamesEnum - RESV_ERRORS_RX RsvpMetricsRequestColumnNamesEnum - RESV_CONF_TX RsvpMetricsRequestColumnNamesEnum - RESV_CONF_RX RsvpMetricsRequestColumnNamesEnum - HELLOS_TX RsvpMetricsRequestColumnNamesEnum - HELLOS_RX RsvpMetricsRequestColumnNamesEnum - ACKS_TX RsvpMetricsRequestColumnNamesEnum - ACKS_RX RsvpMetricsRequestColumnNamesEnum - NACKS_TX RsvpMetricsRequestColumnNamesEnum - NACKS_RX RsvpMetricsRequestColumnNamesEnum - SREFRESH_TX RsvpMetricsRequestColumnNamesEnum - SREFRESH_RX RsvpMetricsRequestColumnNamesEnum - BUNDLE_TX RsvpMetricsRequestColumnNamesEnum - BUNDLE_RX RsvpMetricsRequestColumnNamesEnum - PATH_REEVALUATION_REQUEST_TX RsvpMetricsRequestColumnNamesEnum - PATH_REOPTIMIZATIONS RsvpMetricsRequestColumnNamesEnum -}{ - INGRESS_P2P_LSPS_CONFIGURED: RsvpMetricsRequestColumnNamesEnum("ingress_p2p_lsps_configured"), - INGRESS_P2P_LSPS_UP: RsvpMetricsRequestColumnNamesEnum("ingress_p2p_lsps_up"), - EGRESS_P2P_LSPS_UP: RsvpMetricsRequestColumnNamesEnum("egress_p2p_lsps_up"), - LSP_FLAP_COUNT: RsvpMetricsRequestColumnNamesEnum("lsp_flap_count"), - PATHS_TX: RsvpMetricsRequestColumnNamesEnum("paths_tx"), - PATHS_RX: RsvpMetricsRequestColumnNamesEnum("paths_rx"), - RESVS_TX: RsvpMetricsRequestColumnNamesEnum("resvs_tx"), - RESVS_RX: RsvpMetricsRequestColumnNamesEnum("resvs_rx"), - PATH_TEARS_TX: RsvpMetricsRequestColumnNamesEnum("path_tears_tx"), - PATH_TEARS_RX: RsvpMetricsRequestColumnNamesEnum("path_tears_rx"), - RESV_TEARS_TX: RsvpMetricsRequestColumnNamesEnum("resv_tears_tx"), - RESV_TEARS_RX: RsvpMetricsRequestColumnNamesEnum("resv_tears_rx"), - PATH_ERRORS_TX: RsvpMetricsRequestColumnNamesEnum("path_errors_tx"), - PATH_ERRORS_RX: RsvpMetricsRequestColumnNamesEnum("path_errors_rx"), - RESV_ERRORS_TX: RsvpMetricsRequestColumnNamesEnum("resv_errors_tx"), - RESV_ERRORS_RX: RsvpMetricsRequestColumnNamesEnum("resv_errors_rx"), - RESV_CONF_TX: RsvpMetricsRequestColumnNamesEnum("resv_conf_tx"), - RESV_CONF_RX: RsvpMetricsRequestColumnNamesEnum("resv_conf_rx"), - HELLOS_TX: RsvpMetricsRequestColumnNamesEnum("hellos_tx"), - HELLOS_RX: RsvpMetricsRequestColumnNamesEnum("hellos_rx"), - ACKS_TX: RsvpMetricsRequestColumnNamesEnum("acks_tx"), - ACKS_RX: RsvpMetricsRequestColumnNamesEnum("acks_rx"), - NACKS_TX: RsvpMetricsRequestColumnNamesEnum("nacks_tx"), - NACKS_RX: RsvpMetricsRequestColumnNamesEnum("nacks_rx"), - SREFRESH_TX: RsvpMetricsRequestColumnNamesEnum("srefresh_tx"), - SREFRESH_RX: RsvpMetricsRequestColumnNamesEnum("srefresh_rx"), - BUNDLE_TX: RsvpMetricsRequestColumnNamesEnum("bundle_tx"), - BUNDLE_RX: RsvpMetricsRequestColumnNamesEnum("bundle_rx"), - PATH_REEVALUATION_REQUEST_TX: RsvpMetricsRequestColumnNamesEnum("path_reevaluation_request_tx"), - PATH_REOPTIMIZATIONS: RsvpMetricsRequestColumnNamesEnum("path_reoptimizations"), -} - -func (obj *rsvpMetricsRequest) ColumnNames() []RsvpMetricsRequestColumnNamesEnum { - items := []RsvpMetricsRequestColumnNamesEnum{} - for _, item := range obj.obj.ColumnNames { - items = append(items, RsvpMetricsRequestColumnNamesEnum(item.String())) - } - return items -} - -// The list of column names that the returned result set will contain. If the input list is empty then all columns will be returned except for any result_groups. -// SetColumnNames sets the []string value in the RsvpMetricsRequest object -func (obj *rsvpMetricsRequest) SetColumnNames(value []RsvpMetricsRequestColumnNamesEnum) RsvpMetricsRequest { - - items := []otg.RsvpMetricsRequest_ColumnNames_Enum{} - for _, item := range value { - intValue := otg.RsvpMetricsRequest_ColumnNames_Enum_value[string(item)] - items = append(items, otg.RsvpMetricsRequest_ColumnNames_Enum(intValue)) - } - obj.obj.ColumnNames = items - return obj -} - -func (obj *rsvpMetricsRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *rsvpMetricsRequest) setDefault() { - -} - -// ***** Dhcpv4ClientMetricsRequest ***** -type dhcpv4ClientMetricsRequest struct { - validation - obj *otg.Dhcpv4ClientMetricsRequest - marshaller marshalDhcpv4ClientMetricsRequest - unMarshaller unMarshalDhcpv4ClientMetricsRequest -} - -func NewDhcpv4ClientMetricsRequest() Dhcpv4ClientMetricsRequest { - obj := dhcpv4ClientMetricsRequest{obj: &otg.Dhcpv4ClientMetricsRequest{}} - obj.setDefault() - return &obj -} - -func (obj *dhcpv4ClientMetricsRequest) msg() *otg.Dhcpv4ClientMetricsRequest { - return obj.obj -} - -func (obj *dhcpv4ClientMetricsRequest) setMsg(msg *otg.Dhcpv4ClientMetricsRequest) Dhcpv4ClientMetricsRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldhcpv4ClientMetricsRequest struct { - obj *dhcpv4ClientMetricsRequest -} - -type marshalDhcpv4ClientMetricsRequest interface { - // ToProto marshals Dhcpv4ClientMetricsRequest to protobuf object *otg.Dhcpv4ClientMetricsRequest - ToProto() (*otg.Dhcpv4ClientMetricsRequest, error) - // ToPbText marshals Dhcpv4ClientMetricsRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals Dhcpv4ClientMetricsRequest to YAML text - ToYaml() (string, error) - // ToJson marshals Dhcpv4ClientMetricsRequest to JSON text - ToJson() (string, error) -} - -type unMarshaldhcpv4ClientMetricsRequest struct { - obj *dhcpv4ClientMetricsRequest -} - -type unMarshalDhcpv4ClientMetricsRequest interface { - // FromProto unmarshals Dhcpv4ClientMetricsRequest from protobuf object *otg.Dhcpv4ClientMetricsRequest - FromProto(msg *otg.Dhcpv4ClientMetricsRequest) (Dhcpv4ClientMetricsRequest, error) - // FromPbText unmarshals Dhcpv4ClientMetricsRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Dhcpv4ClientMetricsRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals Dhcpv4ClientMetricsRequest from JSON text - FromJson(value string) error -} - -func (obj *dhcpv4ClientMetricsRequest) Marshal() marshalDhcpv4ClientMetricsRequest { - if obj.marshaller == nil { - obj.marshaller = &marshaldhcpv4ClientMetricsRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *dhcpv4ClientMetricsRequest) Unmarshal() unMarshalDhcpv4ClientMetricsRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldhcpv4ClientMetricsRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldhcpv4ClientMetricsRequest) ToProto() (*otg.Dhcpv4ClientMetricsRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldhcpv4ClientMetricsRequest) FromProto(msg *otg.Dhcpv4ClientMetricsRequest) (Dhcpv4ClientMetricsRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldhcpv4ClientMetricsRequest) 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 *unMarshaldhcpv4ClientMetricsRequest) 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 *marshaldhcpv4ClientMetricsRequest) 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 *unMarshaldhcpv4ClientMetricsRequest) 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 *marshaldhcpv4ClientMetricsRequest) 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 *unMarshaldhcpv4ClientMetricsRequest) 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 *dhcpv4ClientMetricsRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *dhcpv4ClientMetricsRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *dhcpv4ClientMetricsRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *dhcpv4ClientMetricsRequest) Clone() (Dhcpv4ClientMetricsRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDhcpv4ClientMetricsRequest() - 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 -} - -// Dhcpv4ClientMetricsRequest is the request to retrieve DHCPv4 per client metrics/statistics. -type Dhcpv4ClientMetricsRequest interface { - Validation - // msg marshals Dhcpv4ClientMetricsRequest to protobuf object *otg.Dhcpv4ClientMetricsRequest - // and doesn't set defaults - msg() *otg.Dhcpv4ClientMetricsRequest - // setMsg unmarshals Dhcpv4ClientMetricsRequest from protobuf object *otg.Dhcpv4ClientMetricsRequest - // and doesn't set defaults - setMsg(*otg.Dhcpv4ClientMetricsRequest) Dhcpv4ClientMetricsRequest - // provides marshal interface - Marshal() marshalDhcpv4ClientMetricsRequest - // provides unmarshal interface - Unmarshal() unMarshalDhcpv4ClientMetricsRequest - // validate validates Dhcpv4ClientMetricsRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Dhcpv4ClientMetricsRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ClientNames returns []string, set in Dhcpv4ClientMetricsRequest. - ClientNames() []string - // SetClientNames assigns []string provided by user to Dhcpv4ClientMetricsRequest - SetClientNames(value []string) Dhcpv4ClientMetricsRequest - // ColumnNames returns []Dhcpv4ClientMetricsRequestColumnNamesEnum, set in Dhcpv4ClientMetricsRequest - ColumnNames() []Dhcpv4ClientMetricsRequestColumnNamesEnum - // SetColumnNames assigns []Dhcpv4ClientMetricsRequestColumnNamesEnum provided by user to Dhcpv4ClientMetricsRequest - SetColumnNames(value []Dhcpv4ClientMetricsRequestColumnNamesEnum) Dhcpv4ClientMetricsRequest -} - -// The names of DHCPv4 clients to return results for. An empty list will return results for all DHCPv4 client. -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// ClientNames returns a []string -func (obj *dhcpv4ClientMetricsRequest) ClientNames() []string { - if obj.obj.ClientNames == nil { - obj.obj.ClientNames = make([]string, 0) - } - return obj.obj.ClientNames -} - -// The names of DHCPv4 clients to return results for. An empty list will return results for all DHCPv4 client. -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// SetClientNames sets the []string value in the Dhcpv4ClientMetricsRequest object -func (obj *dhcpv4ClientMetricsRequest) SetClientNames(value []string) Dhcpv4ClientMetricsRequest { - - if obj.obj.ClientNames == nil { - obj.obj.ClientNames = make([]string, 0) - } - obj.obj.ClientNames = value - - return obj -} - -type Dhcpv4ClientMetricsRequestColumnNamesEnum string - -// Enum of ColumnNames on Dhcpv4ClientMetricsRequest -var Dhcpv4ClientMetricsRequestColumnNames = struct { - DISCOVERS_SENT Dhcpv4ClientMetricsRequestColumnNamesEnum - OFFERS_RECEIVED Dhcpv4ClientMetricsRequestColumnNamesEnum - REQUESTS_SENT Dhcpv4ClientMetricsRequestColumnNamesEnum - ACKS_RECEIVED Dhcpv4ClientMetricsRequestColumnNamesEnum - NACKS_RECEIVED Dhcpv4ClientMetricsRequestColumnNamesEnum - RELEASES_SENT Dhcpv4ClientMetricsRequestColumnNamesEnum - DECLINES_SENT Dhcpv4ClientMetricsRequestColumnNamesEnum -}{ - DISCOVERS_SENT: Dhcpv4ClientMetricsRequestColumnNamesEnum("discovers_sent"), - OFFERS_RECEIVED: Dhcpv4ClientMetricsRequestColumnNamesEnum("offers_received"), - REQUESTS_SENT: Dhcpv4ClientMetricsRequestColumnNamesEnum("requests_sent"), - ACKS_RECEIVED: Dhcpv4ClientMetricsRequestColumnNamesEnum("acks_received"), - NACKS_RECEIVED: Dhcpv4ClientMetricsRequestColumnNamesEnum("nacks_received"), - RELEASES_SENT: Dhcpv4ClientMetricsRequestColumnNamesEnum("releases_sent"), - DECLINES_SENT: Dhcpv4ClientMetricsRequestColumnNamesEnum("declines_sent"), -} - -func (obj *dhcpv4ClientMetricsRequest) ColumnNames() []Dhcpv4ClientMetricsRequestColumnNamesEnum { - items := []Dhcpv4ClientMetricsRequestColumnNamesEnum{} - for _, item := range obj.obj.ColumnNames { - items = append(items, Dhcpv4ClientMetricsRequestColumnNamesEnum(item.String())) - } - return items -} - -// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned. The name of the DHCPv4 client cannot be excluded. -// SetColumnNames sets the []string value in the Dhcpv4ClientMetricsRequest object -func (obj *dhcpv4ClientMetricsRequest) SetColumnNames(value []Dhcpv4ClientMetricsRequestColumnNamesEnum) Dhcpv4ClientMetricsRequest { - - items := []otg.Dhcpv4ClientMetricsRequest_ColumnNames_Enum{} - for _, item := range value { - intValue := otg.Dhcpv4ClientMetricsRequest_ColumnNames_Enum_value[string(item)] - items = append(items, otg.Dhcpv4ClientMetricsRequest_ColumnNames_Enum(intValue)) - } - obj.obj.ColumnNames = items - return obj -} - -func (obj *dhcpv4ClientMetricsRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *dhcpv4ClientMetricsRequest) setDefault() { - -} - -// ***** Dhcpv4ServerMetricsRequest ***** -type dhcpv4ServerMetricsRequest struct { - validation - obj *otg.Dhcpv4ServerMetricsRequest - marshaller marshalDhcpv4ServerMetricsRequest - unMarshaller unMarshalDhcpv4ServerMetricsRequest -} - -func NewDhcpv4ServerMetricsRequest() Dhcpv4ServerMetricsRequest { - obj := dhcpv4ServerMetricsRequest{obj: &otg.Dhcpv4ServerMetricsRequest{}} - obj.setDefault() - return &obj -} - -func (obj *dhcpv4ServerMetricsRequest) msg() *otg.Dhcpv4ServerMetricsRequest { - return obj.obj -} - -func (obj *dhcpv4ServerMetricsRequest) setMsg(msg *otg.Dhcpv4ServerMetricsRequest) Dhcpv4ServerMetricsRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldhcpv4ServerMetricsRequest struct { - obj *dhcpv4ServerMetricsRequest -} - -type marshalDhcpv4ServerMetricsRequest interface { - // ToProto marshals Dhcpv4ServerMetricsRequest to protobuf object *otg.Dhcpv4ServerMetricsRequest - ToProto() (*otg.Dhcpv4ServerMetricsRequest, error) - // ToPbText marshals Dhcpv4ServerMetricsRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals Dhcpv4ServerMetricsRequest to YAML text - ToYaml() (string, error) - // ToJson marshals Dhcpv4ServerMetricsRequest to JSON text - ToJson() (string, error) -} - -type unMarshaldhcpv4ServerMetricsRequest struct { - obj *dhcpv4ServerMetricsRequest -} - -type unMarshalDhcpv4ServerMetricsRequest interface { - // FromProto unmarshals Dhcpv4ServerMetricsRequest from protobuf object *otg.Dhcpv4ServerMetricsRequest - FromProto(msg *otg.Dhcpv4ServerMetricsRequest) (Dhcpv4ServerMetricsRequest, error) - // FromPbText unmarshals Dhcpv4ServerMetricsRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Dhcpv4ServerMetricsRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals Dhcpv4ServerMetricsRequest from JSON text - FromJson(value string) error -} - -func (obj *dhcpv4ServerMetricsRequest) Marshal() marshalDhcpv4ServerMetricsRequest { - if obj.marshaller == nil { - obj.marshaller = &marshaldhcpv4ServerMetricsRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *dhcpv4ServerMetricsRequest) Unmarshal() unMarshalDhcpv4ServerMetricsRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldhcpv4ServerMetricsRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldhcpv4ServerMetricsRequest) ToProto() (*otg.Dhcpv4ServerMetricsRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldhcpv4ServerMetricsRequest) FromProto(msg *otg.Dhcpv4ServerMetricsRequest) (Dhcpv4ServerMetricsRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldhcpv4ServerMetricsRequest) 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 *unMarshaldhcpv4ServerMetricsRequest) 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 *marshaldhcpv4ServerMetricsRequest) 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 *unMarshaldhcpv4ServerMetricsRequest) 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 *marshaldhcpv4ServerMetricsRequest) 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 *unMarshaldhcpv4ServerMetricsRequest) 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 *dhcpv4ServerMetricsRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *dhcpv4ServerMetricsRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *dhcpv4ServerMetricsRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *dhcpv4ServerMetricsRequest) Clone() (Dhcpv4ServerMetricsRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDhcpv4ServerMetricsRequest() - 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 -} - -// Dhcpv4ServerMetricsRequest is the request to retrieve DHCPv4 per Server metrics/statistics. -type Dhcpv4ServerMetricsRequest interface { - Validation - // msg marshals Dhcpv4ServerMetricsRequest to protobuf object *otg.Dhcpv4ServerMetricsRequest - // and doesn't set defaults - msg() *otg.Dhcpv4ServerMetricsRequest - // setMsg unmarshals Dhcpv4ServerMetricsRequest from protobuf object *otg.Dhcpv4ServerMetricsRequest - // and doesn't set defaults - setMsg(*otg.Dhcpv4ServerMetricsRequest) Dhcpv4ServerMetricsRequest - // provides marshal interface - Marshal() marshalDhcpv4ServerMetricsRequest - // provides unmarshal interface - Unmarshal() unMarshalDhcpv4ServerMetricsRequest - // validate validates Dhcpv4ServerMetricsRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Dhcpv4ServerMetricsRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ServerNames returns []string, set in Dhcpv4ServerMetricsRequest. - ServerNames() []string - // SetServerNames assigns []string provided by user to Dhcpv4ServerMetricsRequest - SetServerNames(value []string) Dhcpv4ServerMetricsRequest - // ColumnNames returns []Dhcpv4ServerMetricsRequestColumnNamesEnum, set in Dhcpv4ServerMetricsRequest - ColumnNames() []Dhcpv4ServerMetricsRequestColumnNamesEnum - // SetColumnNames assigns []Dhcpv4ServerMetricsRequestColumnNamesEnum provided by user to Dhcpv4ServerMetricsRequest - SetColumnNames(value []Dhcpv4ServerMetricsRequestColumnNamesEnum) Dhcpv4ServerMetricsRequest -} - -// The names of DHCPv4 Servers to return results for. An empty list will return results for all DHCPv4 Server. -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4Server/properties/name -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4Server/properties/name -// -// ServerNames returns a []string -func (obj *dhcpv4ServerMetricsRequest) ServerNames() []string { - if obj.obj.ServerNames == nil { - obj.obj.ServerNames = make([]string, 0) - } - return obj.obj.ServerNames -} - -// The names of DHCPv4 Servers to return results for. An empty list will return results for all DHCPv4 Server. -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4Server/properties/name -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4Server/properties/name -// -// SetServerNames sets the []string value in the Dhcpv4ServerMetricsRequest object -func (obj *dhcpv4ServerMetricsRequest) SetServerNames(value []string) Dhcpv4ServerMetricsRequest { - - if obj.obj.ServerNames == nil { - obj.obj.ServerNames = make([]string, 0) - } - obj.obj.ServerNames = value - - return obj -} - -type Dhcpv4ServerMetricsRequestColumnNamesEnum string - -// Enum of ColumnNames on Dhcpv4ServerMetricsRequest -var Dhcpv4ServerMetricsRequestColumnNames = struct { - DISCOVERS_RECEIVED Dhcpv4ServerMetricsRequestColumnNamesEnum - OFFERS_SENT Dhcpv4ServerMetricsRequestColumnNamesEnum - REQUESTS_RECEIVED Dhcpv4ServerMetricsRequestColumnNamesEnum - ACKS_SENT Dhcpv4ServerMetricsRequestColumnNamesEnum - NACKS_SENT Dhcpv4ServerMetricsRequestColumnNamesEnum - RELEASES_RECEIVED Dhcpv4ServerMetricsRequestColumnNamesEnum - DECLINES_RECEIVED Dhcpv4ServerMetricsRequestColumnNamesEnum -}{ - DISCOVERS_RECEIVED: Dhcpv4ServerMetricsRequestColumnNamesEnum("discovers_received"), - OFFERS_SENT: Dhcpv4ServerMetricsRequestColumnNamesEnum("offers_sent"), - REQUESTS_RECEIVED: Dhcpv4ServerMetricsRequestColumnNamesEnum("requests_received"), - ACKS_SENT: Dhcpv4ServerMetricsRequestColumnNamesEnum("acks_sent"), - NACKS_SENT: Dhcpv4ServerMetricsRequestColumnNamesEnum("nacks_sent"), - RELEASES_RECEIVED: Dhcpv4ServerMetricsRequestColumnNamesEnum("releases_received"), - DECLINES_RECEIVED: Dhcpv4ServerMetricsRequestColumnNamesEnum("declines_received"), -} - -func (obj *dhcpv4ServerMetricsRequest) ColumnNames() []Dhcpv4ServerMetricsRequestColumnNamesEnum { - items := []Dhcpv4ServerMetricsRequestColumnNamesEnum{} - for _, item := range obj.obj.ColumnNames { - items = append(items, Dhcpv4ServerMetricsRequestColumnNamesEnum(item.String())) - } - return items -} - -// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned. The name of the DHCPv4 server cannot be excluded. -// SetColumnNames sets the []string value in the Dhcpv4ServerMetricsRequest object -func (obj *dhcpv4ServerMetricsRequest) SetColumnNames(value []Dhcpv4ServerMetricsRequestColumnNamesEnum) Dhcpv4ServerMetricsRequest { - - items := []otg.Dhcpv4ServerMetricsRequest_ColumnNames_Enum{} - for _, item := range value { - intValue := otg.Dhcpv4ServerMetricsRequest_ColumnNames_Enum_value[string(item)] - items = append(items, otg.Dhcpv4ServerMetricsRequest_ColumnNames_Enum(intValue)) - } - obj.obj.ColumnNames = items - return obj -} - -func (obj *dhcpv4ServerMetricsRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *dhcpv4ServerMetricsRequest) setDefault() { - -} - -// ***** Neighborsv4StatesRequest ***** -type neighborsv4StatesRequest struct { - validation - obj *otg.Neighborsv4StatesRequest - marshaller marshalNeighborsv4StatesRequest - unMarshaller unMarshalNeighborsv4StatesRequest -} - -func NewNeighborsv4StatesRequest() Neighborsv4StatesRequest { - obj := neighborsv4StatesRequest{obj: &otg.Neighborsv4StatesRequest{}} - obj.setDefault() - return &obj -} - -func (obj *neighborsv4StatesRequest) msg() *otg.Neighborsv4StatesRequest { - return obj.obj -} - -func (obj *neighborsv4StatesRequest) setMsg(msg *otg.Neighborsv4StatesRequest) Neighborsv4StatesRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalneighborsv4StatesRequest struct { - obj *neighborsv4StatesRequest -} - -type marshalNeighborsv4StatesRequest interface { - // ToProto marshals Neighborsv4StatesRequest to protobuf object *otg.Neighborsv4StatesRequest - ToProto() (*otg.Neighborsv4StatesRequest, error) - // ToPbText marshals Neighborsv4StatesRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals Neighborsv4StatesRequest to YAML text - ToYaml() (string, error) - // ToJson marshals Neighborsv4StatesRequest to JSON text - ToJson() (string, error) -} - -type unMarshalneighborsv4StatesRequest struct { - obj *neighborsv4StatesRequest -} - -type unMarshalNeighborsv4StatesRequest interface { - // FromProto unmarshals Neighborsv4StatesRequest from protobuf object *otg.Neighborsv4StatesRequest - FromProto(msg *otg.Neighborsv4StatesRequest) (Neighborsv4StatesRequest, error) - // FromPbText unmarshals Neighborsv4StatesRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Neighborsv4StatesRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals Neighborsv4StatesRequest from JSON text - FromJson(value string) error -} - -func (obj *neighborsv4StatesRequest) Marshal() marshalNeighborsv4StatesRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalneighborsv4StatesRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *neighborsv4StatesRequest) Unmarshal() unMarshalNeighborsv4StatesRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalneighborsv4StatesRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalneighborsv4StatesRequest) ToProto() (*otg.Neighborsv4StatesRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalneighborsv4StatesRequest) FromProto(msg *otg.Neighborsv4StatesRequest) (Neighborsv4StatesRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalneighborsv4StatesRequest) 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 *unMarshalneighborsv4StatesRequest) 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 *marshalneighborsv4StatesRequest) 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 *unMarshalneighborsv4StatesRequest) 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 *marshalneighborsv4StatesRequest) 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 *unMarshalneighborsv4StatesRequest) 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 *neighborsv4StatesRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *neighborsv4StatesRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *neighborsv4StatesRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *neighborsv4StatesRequest) Clone() (Neighborsv4StatesRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewNeighborsv4StatesRequest() - 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 -} - -// Neighborsv4StatesRequest is the request to retrieve IPv4 Neighbor state (ARP cache entries) of a network interface(s). -type Neighborsv4StatesRequest interface { - Validation - // msg marshals Neighborsv4StatesRequest to protobuf object *otg.Neighborsv4StatesRequest - // and doesn't set defaults - msg() *otg.Neighborsv4StatesRequest - // setMsg unmarshals Neighborsv4StatesRequest from protobuf object *otg.Neighborsv4StatesRequest - // and doesn't set defaults - setMsg(*otg.Neighborsv4StatesRequest) Neighborsv4StatesRequest - // provides marshal interface - Marshal() marshalNeighborsv4StatesRequest - // provides unmarshal interface - Unmarshal() unMarshalNeighborsv4StatesRequest - // validate validates Neighborsv4StatesRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Neighborsv4StatesRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // EthernetNames returns []string, set in Neighborsv4StatesRequest. - EthernetNames() []string - // SetEthernetNames assigns []string provided by user to Neighborsv4StatesRequest - SetEthernetNames(value []string) Neighborsv4StatesRequest -} - -// The names of Ethernet interfaces for which Neighbor state (ARP cache entries) will be retrieved. If no names are specified then the results will contain Neighbor state (ARP cache entries) for all available Ethernet interfaces. -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// EthernetNames returns a []string -func (obj *neighborsv4StatesRequest) EthernetNames() []string { - if obj.obj.EthernetNames == nil { - obj.obj.EthernetNames = make([]string, 0) - } - return obj.obj.EthernetNames -} - -// The names of Ethernet interfaces for which Neighbor state (ARP cache entries) will be retrieved. If no names are specified then the results will contain Neighbor state (ARP cache entries) for all available Ethernet interfaces. -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// SetEthernetNames sets the []string value in the Neighborsv4StatesRequest object -func (obj *neighborsv4StatesRequest) SetEthernetNames(value []string) Neighborsv4StatesRequest { - - if obj.obj.EthernetNames == nil { - obj.obj.EthernetNames = make([]string, 0) - } - obj.obj.EthernetNames = value - - return obj -} - -func (obj *neighborsv4StatesRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *neighborsv4StatesRequest) setDefault() { - -} - -// ***** Neighborsv6StatesRequest ***** -type neighborsv6StatesRequest struct { - validation - obj *otg.Neighborsv6StatesRequest - marshaller marshalNeighborsv6StatesRequest - unMarshaller unMarshalNeighborsv6StatesRequest -} - -func NewNeighborsv6StatesRequest() Neighborsv6StatesRequest { - obj := neighborsv6StatesRequest{obj: &otg.Neighborsv6StatesRequest{}} - obj.setDefault() - return &obj -} - -func (obj *neighborsv6StatesRequest) msg() *otg.Neighborsv6StatesRequest { - return obj.obj -} - -func (obj *neighborsv6StatesRequest) setMsg(msg *otg.Neighborsv6StatesRequest) Neighborsv6StatesRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalneighborsv6StatesRequest struct { - obj *neighborsv6StatesRequest -} - -type marshalNeighborsv6StatesRequest interface { - // ToProto marshals Neighborsv6StatesRequest to protobuf object *otg.Neighborsv6StatesRequest - ToProto() (*otg.Neighborsv6StatesRequest, error) - // ToPbText marshals Neighborsv6StatesRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals Neighborsv6StatesRequest to YAML text - ToYaml() (string, error) - // ToJson marshals Neighborsv6StatesRequest to JSON text - ToJson() (string, error) -} - -type unMarshalneighborsv6StatesRequest struct { - obj *neighborsv6StatesRequest -} - -type unMarshalNeighborsv6StatesRequest interface { - // FromProto unmarshals Neighborsv6StatesRequest from protobuf object *otg.Neighborsv6StatesRequest - FromProto(msg *otg.Neighborsv6StatesRequest) (Neighborsv6StatesRequest, error) - // FromPbText unmarshals Neighborsv6StatesRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Neighborsv6StatesRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals Neighborsv6StatesRequest from JSON text - FromJson(value string) error -} - -func (obj *neighborsv6StatesRequest) Marshal() marshalNeighborsv6StatesRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalneighborsv6StatesRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *neighborsv6StatesRequest) Unmarshal() unMarshalNeighborsv6StatesRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalneighborsv6StatesRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalneighborsv6StatesRequest) ToProto() (*otg.Neighborsv6StatesRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalneighborsv6StatesRequest) FromProto(msg *otg.Neighborsv6StatesRequest) (Neighborsv6StatesRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalneighborsv6StatesRequest) 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 *unMarshalneighborsv6StatesRequest) 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 *marshalneighborsv6StatesRequest) 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 *unMarshalneighborsv6StatesRequest) 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 *marshalneighborsv6StatesRequest) 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 *unMarshalneighborsv6StatesRequest) 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 *neighborsv6StatesRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *neighborsv6StatesRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *neighborsv6StatesRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *neighborsv6StatesRequest) Clone() (Neighborsv6StatesRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewNeighborsv6StatesRequest() - 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 -} - -// Neighborsv6StatesRequest is the request to retrieve IPv6 Neighbor state (NDISC cache entries) of a network interface(s). -type Neighborsv6StatesRequest interface { - Validation - // msg marshals Neighborsv6StatesRequest to protobuf object *otg.Neighborsv6StatesRequest - // and doesn't set defaults - msg() *otg.Neighborsv6StatesRequest - // setMsg unmarshals Neighborsv6StatesRequest from protobuf object *otg.Neighborsv6StatesRequest - // and doesn't set defaults - setMsg(*otg.Neighborsv6StatesRequest) Neighborsv6StatesRequest - // provides marshal interface - Marshal() marshalNeighborsv6StatesRequest - // provides unmarshal interface - Unmarshal() unMarshalNeighborsv6StatesRequest - // validate validates Neighborsv6StatesRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Neighborsv6StatesRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // EthernetNames returns []string, set in Neighborsv6StatesRequest. - EthernetNames() []string - // SetEthernetNames assigns []string provided by user to Neighborsv6StatesRequest - SetEthernetNames(value []string) Neighborsv6StatesRequest -} - -// The names of Ethernet interfaces for which Neighbor state (NDISC cache entries) will be retrieved. If no names are specified then the results will contain Neighbor state (NDISC cache entries) for all available Ethernet interfaces. -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// EthernetNames returns a []string -func (obj *neighborsv6StatesRequest) EthernetNames() []string { - if obj.obj.EthernetNames == nil { - obj.obj.EthernetNames = make([]string, 0) - } - return obj.obj.EthernetNames -} - -// The names of Ethernet interfaces for which Neighbor state (NDISC cache entries) will be retrieved. If no names are specified then the results will contain Neighbor state (NDISC cache entries) for all available Ethernet interfaces. -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// SetEthernetNames sets the []string value in the Neighborsv6StatesRequest object -func (obj *neighborsv6StatesRequest) SetEthernetNames(value []string) Neighborsv6StatesRequest { - - if obj.obj.EthernetNames == nil { - obj.obj.EthernetNames = make([]string, 0) - } - obj.obj.EthernetNames = value - - return obj -} - -func (obj *neighborsv6StatesRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *neighborsv6StatesRequest) setDefault() { - -} - -// ***** BgpPrefixStateRequest ***** -type bgpPrefixStateRequest struct { - validation - obj *otg.BgpPrefixStateRequest - marshaller marshalBgpPrefixStateRequest - unMarshaller unMarshalBgpPrefixStateRequest - ipv4UnicastFiltersHolder BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter - ipv6UnicastFiltersHolder BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter -} - -func NewBgpPrefixStateRequest() BgpPrefixStateRequest { - obj := bgpPrefixStateRequest{obj: &otg.BgpPrefixStateRequest{}} - obj.setDefault() - return &obj -} - -func (obj *bgpPrefixStateRequest) msg() *otg.BgpPrefixStateRequest { - return obj.obj -} - -func (obj *bgpPrefixStateRequest) setMsg(msg *otg.BgpPrefixStateRequest) BgpPrefixStateRequest { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpPrefixStateRequest struct { - obj *bgpPrefixStateRequest -} - -type marshalBgpPrefixStateRequest interface { - // ToProto marshals BgpPrefixStateRequest to protobuf object *otg.BgpPrefixStateRequest - ToProto() (*otg.BgpPrefixStateRequest, error) - // ToPbText marshals BgpPrefixStateRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpPrefixStateRequest to YAML text - ToYaml() (string, error) - // ToJson marshals BgpPrefixStateRequest to JSON text - ToJson() (string, error) -} - -type unMarshalbgpPrefixStateRequest struct { - obj *bgpPrefixStateRequest -} - -type unMarshalBgpPrefixStateRequest interface { - // FromProto unmarshals BgpPrefixStateRequest from protobuf object *otg.BgpPrefixStateRequest - FromProto(msg *otg.BgpPrefixStateRequest) (BgpPrefixStateRequest, error) - // FromPbText unmarshals BgpPrefixStateRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpPrefixStateRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpPrefixStateRequest from JSON text - FromJson(value string) error -} - -func (obj *bgpPrefixStateRequest) Marshal() marshalBgpPrefixStateRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpPrefixStateRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpPrefixStateRequest) Unmarshal() unMarshalBgpPrefixStateRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpPrefixStateRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpPrefixStateRequest) ToProto() (*otg.BgpPrefixStateRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpPrefixStateRequest) FromProto(msg *otg.BgpPrefixStateRequest) (BgpPrefixStateRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpPrefixStateRequest) 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 *unMarshalbgpPrefixStateRequest) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpPrefixStateRequest) 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 *unMarshalbgpPrefixStateRequest) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpPrefixStateRequest) 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 *unMarshalbgpPrefixStateRequest) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpPrefixStateRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpPrefixStateRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpPrefixStateRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpPrefixStateRequest) Clone() (BgpPrefixStateRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpPrefixStateRequest() - 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 -} - -func (obj *bgpPrefixStateRequest) setNil() { - obj.ipv4UnicastFiltersHolder = nil - obj.ipv6UnicastFiltersHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpPrefixStateRequest is the request to retrieve BGP peer prefix information. -type BgpPrefixStateRequest interface { - Validation - // msg marshals BgpPrefixStateRequest to protobuf object *otg.BgpPrefixStateRequest - // and doesn't set defaults - msg() *otg.BgpPrefixStateRequest - // setMsg unmarshals BgpPrefixStateRequest from protobuf object *otg.BgpPrefixStateRequest - // and doesn't set defaults - setMsg(*otg.BgpPrefixStateRequest) BgpPrefixStateRequest - // provides marshal interface - Marshal() marshalBgpPrefixStateRequest - // provides unmarshal interface - Unmarshal() unMarshalBgpPrefixStateRequest - // validate validates BgpPrefixStateRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpPrefixStateRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // BgpPeerNames returns []string, set in BgpPrefixStateRequest. - BgpPeerNames() []string - // SetBgpPeerNames assigns []string provided by user to BgpPrefixStateRequest - SetBgpPeerNames(value []string) BgpPrefixStateRequest - // PrefixFilters returns []BgpPrefixStateRequestPrefixFiltersEnum, set in BgpPrefixStateRequest - PrefixFilters() []BgpPrefixStateRequestPrefixFiltersEnum - // SetPrefixFilters assigns []BgpPrefixStateRequestPrefixFiltersEnum provided by user to BgpPrefixStateRequest - SetPrefixFilters(value []BgpPrefixStateRequestPrefixFiltersEnum) BgpPrefixStateRequest - // Ipv4UnicastFilters returns BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIterIter, set in BgpPrefixStateRequest - Ipv4UnicastFilters() BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter - // Ipv6UnicastFilters returns BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIterIter, set in BgpPrefixStateRequest - Ipv6UnicastFilters() BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter - setNil() -} - -// The names of BGP peers for which prefix information will be retrieved. If no names are specified then the results will contain prefix information for all configured BGP peers. -// -// x-constraint: -// - /components/schemas/Bgp.V4Peer/properties/name -// - /components/schemas/Bgp.V6Peer/properties/name -// -// x-constraint: -// - /components/schemas/Bgp.V4Peer/properties/name -// - /components/schemas/Bgp.V6Peer/properties/name -// -// BgpPeerNames returns a []string -func (obj *bgpPrefixStateRequest) BgpPeerNames() []string { - if obj.obj.BgpPeerNames == nil { - obj.obj.BgpPeerNames = make([]string, 0) - } - return obj.obj.BgpPeerNames -} - -// The names of BGP peers for which prefix information will be retrieved. If no names are specified then the results will contain prefix information for all configured BGP peers. -// -// x-constraint: -// - /components/schemas/Bgp.V4Peer/properties/name -// - /components/schemas/Bgp.V6Peer/properties/name -// -// x-constraint: -// - /components/schemas/Bgp.V4Peer/properties/name -// - /components/schemas/Bgp.V6Peer/properties/name -// -// SetBgpPeerNames sets the []string value in the BgpPrefixStateRequest object -func (obj *bgpPrefixStateRequest) SetBgpPeerNames(value []string) BgpPrefixStateRequest { - - if obj.obj.BgpPeerNames == nil { - obj.obj.BgpPeerNames = make([]string, 0) - } - obj.obj.BgpPeerNames = value - - return obj -} - -type BgpPrefixStateRequestPrefixFiltersEnum string - -// Enum of PrefixFilters on BgpPrefixStateRequest -var BgpPrefixStateRequestPrefixFilters = struct { - IPV4_UNICAST BgpPrefixStateRequestPrefixFiltersEnum - IPV6_UNICAST BgpPrefixStateRequestPrefixFiltersEnum -}{ - IPV4_UNICAST: BgpPrefixStateRequestPrefixFiltersEnum("ipv4_unicast"), - IPV6_UNICAST: BgpPrefixStateRequestPrefixFiltersEnum("ipv6_unicast"), -} - -func (obj *bgpPrefixStateRequest) PrefixFilters() []BgpPrefixStateRequestPrefixFiltersEnum { - items := []BgpPrefixStateRequestPrefixFiltersEnum{} - for _, item := range obj.obj.PrefixFilters { - items = append(items, BgpPrefixStateRequestPrefixFiltersEnum(item.String())) - } - return items -} - -// Specify which prefixes to return. If the list is empty or missing then all prefixes will be returned. -// SetPrefixFilters sets the []string value in the BgpPrefixStateRequest object -func (obj *bgpPrefixStateRequest) SetPrefixFilters(value []BgpPrefixStateRequestPrefixFiltersEnum) BgpPrefixStateRequest { - - items := []otg.BgpPrefixStateRequest_PrefixFilters_Enum{} - for _, item := range value { - intValue := otg.BgpPrefixStateRequest_PrefixFilters_Enum_value[string(item)] - items = append(items, otg.BgpPrefixStateRequest_PrefixFilters_Enum(intValue)) - } - obj.obj.PrefixFilters = items - return obj -} - -// The IPv4 unicast results can be filtered by specifying additional prefix search criteria. If the ipv4_unicast_filters property is missing or empty then all IPv4 prefixes will be returned. -// Ipv4UnicastFilters returns a []BgpPrefixIpv4UnicastFilter -func (obj *bgpPrefixStateRequest) Ipv4UnicastFilters() BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { - if len(obj.obj.Ipv4UnicastFilters) == 0 { - obj.obj.Ipv4UnicastFilters = []*otg.BgpPrefixIpv4UnicastFilter{} - } - if obj.ipv4UnicastFiltersHolder == nil { - obj.ipv4UnicastFiltersHolder = newBgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter(&obj.obj.Ipv4UnicastFilters).setMsg(obj) - } - return obj.ipv4UnicastFiltersHolder -} - -type bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter struct { - obj *bgpPrefixStateRequest - bgpPrefixIpv4UnicastFilterSlice []BgpPrefixIpv4UnicastFilter - fieldPtr *[]*otg.BgpPrefixIpv4UnicastFilter -} - -func newBgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter(ptr *[]*otg.BgpPrefixIpv4UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { - return &bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter{fieldPtr: ptr} -} - -type BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter interface { - setMsg(*bgpPrefixStateRequest) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter - Items() []BgpPrefixIpv4UnicastFilter - Add() BgpPrefixIpv4UnicastFilter - Append(items ...BgpPrefixIpv4UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter - Set(index int, newObj BgpPrefixIpv4UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter - Clear() BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter - clearHolderSlice() BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter - appendHolderSlice(item BgpPrefixIpv4UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter -} - -func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) setMsg(msg *bgpPrefixStateRequest) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpPrefixIpv4UnicastFilter{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) Items() []BgpPrefixIpv4UnicastFilter { - return obj.bgpPrefixIpv4UnicastFilterSlice -} - -func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) Add() BgpPrefixIpv4UnicastFilter { - newObj := &otg.BgpPrefixIpv4UnicastFilter{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpPrefixIpv4UnicastFilter{obj: newObj} - newLibObj.setDefault() - obj.bgpPrefixIpv4UnicastFilterSlice = append(obj.bgpPrefixIpv4UnicastFilterSlice, newLibObj) - return newLibObj -} - -func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) Append(items ...BgpPrefixIpv4UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpPrefixIpv4UnicastFilterSlice = append(obj.bgpPrefixIpv4UnicastFilterSlice, item) - } - return obj -} - -func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) Set(index int, newObj BgpPrefixIpv4UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpPrefixIpv4UnicastFilterSlice[index] = newObj - return obj -} -func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) Clear() BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpPrefixIpv4UnicastFilter{} - obj.bgpPrefixIpv4UnicastFilterSlice = []BgpPrefixIpv4UnicastFilter{} - } - return obj -} -func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) clearHolderSlice() BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { - if len(obj.bgpPrefixIpv4UnicastFilterSlice) > 0 { - obj.bgpPrefixIpv4UnicastFilterSlice = []BgpPrefixIpv4UnicastFilter{} - } - return obj -} -func (obj *bgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter) appendHolderSlice(item BgpPrefixIpv4UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv4UnicastFilterIter { - obj.bgpPrefixIpv4UnicastFilterSlice = append(obj.bgpPrefixIpv4UnicastFilterSlice, item) - return obj -} - -// The IPv6 unicast results can be filtered by specifying additional prefix search criteria. If the ipv6_unicast_filters property is missing or empty then all IPv6 prefixes will be returned. -// Ipv6UnicastFilters returns a []BgpPrefixIpv6UnicastFilter -func (obj *bgpPrefixStateRequest) Ipv6UnicastFilters() BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { - if len(obj.obj.Ipv6UnicastFilters) == 0 { - obj.obj.Ipv6UnicastFilters = []*otg.BgpPrefixIpv6UnicastFilter{} - } - if obj.ipv6UnicastFiltersHolder == nil { - obj.ipv6UnicastFiltersHolder = newBgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter(&obj.obj.Ipv6UnicastFilters).setMsg(obj) - } - return obj.ipv6UnicastFiltersHolder -} - -type bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter struct { - obj *bgpPrefixStateRequest - bgpPrefixIpv6UnicastFilterSlice []BgpPrefixIpv6UnicastFilter - fieldPtr *[]*otg.BgpPrefixIpv6UnicastFilter -} - -func newBgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter(ptr *[]*otg.BgpPrefixIpv6UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { - return &bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter{fieldPtr: ptr} -} - -type BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter interface { - setMsg(*bgpPrefixStateRequest) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter - Items() []BgpPrefixIpv6UnicastFilter - Add() BgpPrefixIpv6UnicastFilter - Append(items ...BgpPrefixIpv6UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter - Set(index int, newObj BgpPrefixIpv6UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter - Clear() BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter - clearHolderSlice() BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter - appendHolderSlice(item BgpPrefixIpv6UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter -} - -func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) setMsg(msg *bgpPrefixStateRequest) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpPrefixIpv6UnicastFilter{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) Items() []BgpPrefixIpv6UnicastFilter { - return obj.bgpPrefixIpv6UnicastFilterSlice -} - -func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) Add() BgpPrefixIpv6UnicastFilter { - newObj := &otg.BgpPrefixIpv6UnicastFilter{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpPrefixIpv6UnicastFilter{obj: newObj} - newLibObj.setDefault() - obj.bgpPrefixIpv6UnicastFilterSlice = append(obj.bgpPrefixIpv6UnicastFilterSlice, newLibObj) - return newLibObj -} - -func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) Append(items ...BgpPrefixIpv6UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpPrefixIpv6UnicastFilterSlice = append(obj.bgpPrefixIpv6UnicastFilterSlice, item) - } - return obj -} - -func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) Set(index int, newObj BgpPrefixIpv6UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpPrefixIpv6UnicastFilterSlice[index] = newObj - return obj -} -func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) Clear() BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpPrefixIpv6UnicastFilter{} - obj.bgpPrefixIpv6UnicastFilterSlice = []BgpPrefixIpv6UnicastFilter{} - } - return obj -} -func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) clearHolderSlice() BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { - if len(obj.bgpPrefixIpv6UnicastFilterSlice) > 0 { - obj.bgpPrefixIpv6UnicastFilterSlice = []BgpPrefixIpv6UnicastFilter{} - } - return obj -} -func (obj *bgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter) appendHolderSlice(item BgpPrefixIpv6UnicastFilter) BgpPrefixStateRequestBgpPrefixIpv6UnicastFilterIter { - obj.bgpPrefixIpv6UnicastFilterSlice = append(obj.bgpPrefixIpv6UnicastFilterSlice, item) - return obj -} - -func (obj *bgpPrefixStateRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Ipv4UnicastFilters) != 0 { - - if set_default { - obj.Ipv4UnicastFilters().clearHolderSlice() - for _, item := range obj.obj.Ipv4UnicastFilters { - obj.Ipv4UnicastFilters().appendHolderSlice(&bgpPrefixIpv4UnicastFilter{obj: item}) - } - } - for _, item := range obj.Ipv4UnicastFilters().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Ipv6UnicastFilters) != 0 { - - if set_default { - obj.Ipv6UnicastFilters().clearHolderSlice() - for _, item := range obj.obj.Ipv6UnicastFilters { - obj.Ipv6UnicastFilters().appendHolderSlice(&bgpPrefixIpv6UnicastFilter{obj: item}) - } - } - for _, item := range obj.Ipv6UnicastFilters().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpPrefixStateRequest) setDefault() { - -} - -// ***** IsisLspsStateRequest ***** -type isisLspsStateRequest struct { - validation - obj *otg.IsisLspsStateRequest - marshaller marshalIsisLspsStateRequest - unMarshaller unMarshalIsisLspsStateRequest -} - -func NewIsisLspsStateRequest() IsisLspsStateRequest { - obj := isisLspsStateRequest{obj: &otg.IsisLspsStateRequest{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspsStateRequest) msg() *otg.IsisLspsStateRequest { - return obj.obj -} - -func (obj *isisLspsStateRequest) setMsg(msg *otg.IsisLspsStateRequest) IsisLspsStateRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspsStateRequest struct { - obj *isisLspsStateRequest -} - -type marshalIsisLspsStateRequest interface { - // ToProto marshals IsisLspsStateRequest to protobuf object *otg.IsisLspsStateRequest - ToProto() (*otg.IsisLspsStateRequest, error) - // ToPbText marshals IsisLspsStateRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspsStateRequest to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspsStateRequest to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspsStateRequest struct { - obj *isisLspsStateRequest -} - -type unMarshalIsisLspsStateRequest interface { - // FromProto unmarshals IsisLspsStateRequest from protobuf object *otg.IsisLspsStateRequest - FromProto(msg *otg.IsisLspsStateRequest) (IsisLspsStateRequest, error) - // FromPbText unmarshals IsisLspsStateRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspsStateRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspsStateRequest from JSON text - FromJson(value string) error -} - -func (obj *isisLspsStateRequest) Marshal() marshalIsisLspsStateRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspsStateRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspsStateRequest) Unmarshal() unMarshalIsisLspsStateRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspsStateRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspsStateRequest) ToProto() (*otg.IsisLspsStateRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspsStateRequest) FromProto(msg *otg.IsisLspsStateRequest) (IsisLspsStateRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspsStateRequest) 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 *unMarshalisisLspsStateRequest) 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 *marshalisisLspsStateRequest) 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 *unMarshalisisLspsStateRequest) 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 *marshalisisLspsStateRequest) 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 *unMarshalisisLspsStateRequest) 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 *isisLspsStateRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspsStateRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspsStateRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspsStateRequest) Clone() (IsisLspsStateRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspsStateRequest() - 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 -} - -// IsisLspsStateRequest is the request to retrieve ISIS Link State PDU (LSP) information learned by the router. -type IsisLspsStateRequest interface { - Validation - // msg marshals IsisLspsStateRequest to protobuf object *otg.IsisLspsStateRequest - // and doesn't set defaults - msg() *otg.IsisLspsStateRequest - // setMsg unmarshals IsisLspsStateRequest from protobuf object *otg.IsisLspsStateRequest - // and doesn't set defaults - setMsg(*otg.IsisLspsStateRequest) IsisLspsStateRequest - // provides marshal interface - Marshal() marshalIsisLspsStateRequest - // provides unmarshal interface - Unmarshal() unMarshalIsisLspsStateRequest - // validate validates IsisLspsStateRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspsStateRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // IsisRouterNames returns []string, set in IsisLspsStateRequest. - IsisRouterNames() []string - // SetIsisRouterNames assigns []string provided by user to IsisLspsStateRequest - SetIsisRouterNames(value []string) IsisLspsStateRequest -} - -// The names of ISIS routers for which learned information is requested. An empty list will return results for all ISIS routers. -// -// x-constraint: -// - /components/schemas/Device.IsisRouter/properties/name -// -// x-constraint: -// - /components/schemas/Device.IsisRouter/properties/name -// -// IsisRouterNames returns a []string -func (obj *isisLspsStateRequest) IsisRouterNames() []string { - if obj.obj.IsisRouterNames == nil { - obj.obj.IsisRouterNames = make([]string, 0) - } - return obj.obj.IsisRouterNames -} - -// The names of ISIS routers for which learned information is requested. An empty list will return results for all ISIS routers. -// -// x-constraint: -// - /components/schemas/Device.IsisRouter/properties/name -// -// x-constraint: -// - /components/schemas/Device.IsisRouter/properties/name -// -// SetIsisRouterNames sets the []string value in the IsisLspsStateRequest object -func (obj *isisLspsStateRequest) SetIsisRouterNames(value []string) IsisLspsStateRequest { - - if obj.obj.IsisRouterNames == nil { - obj.obj.IsisRouterNames = make([]string, 0) - } - obj.obj.IsisRouterNames = value - - return obj -} - -func (obj *isisLspsStateRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *isisLspsStateRequest) setDefault() { - -} - -// ***** LldpNeighborsStateRequest ***** -type lldpNeighborsStateRequest struct { - validation - obj *otg.LldpNeighborsStateRequest - marshaller marshalLldpNeighborsStateRequest - unMarshaller unMarshalLldpNeighborsStateRequest -} - -func NewLldpNeighborsStateRequest() LldpNeighborsStateRequest { - obj := lldpNeighborsStateRequest{obj: &otg.LldpNeighborsStateRequest{}} - obj.setDefault() - return &obj -} - -func (obj *lldpNeighborsStateRequest) msg() *otg.LldpNeighborsStateRequest { - return obj.obj -} - -func (obj *lldpNeighborsStateRequest) setMsg(msg *otg.LldpNeighborsStateRequest) LldpNeighborsStateRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallldpNeighborsStateRequest struct { - obj *lldpNeighborsStateRequest -} - -type marshalLldpNeighborsStateRequest interface { - // ToProto marshals LldpNeighborsStateRequest to protobuf object *otg.LldpNeighborsStateRequest - ToProto() (*otg.LldpNeighborsStateRequest, error) - // ToPbText marshals LldpNeighborsStateRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals LldpNeighborsStateRequest to YAML text - ToYaml() (string, error) - // ToJson marshals LldpNeighborsStateRequest to JSON text - ToJson() (string, error) -} - -type unMarshallldpNeighborsStateRequest struct { - obj *lldpNeighborsStateRequest -} - -type unMarshalLldpNeighborsStateRequest interface { - // FromProto unmarshals LldpNeighborsStateRequest from protobuf object *otg.LldpNeighborsStateRequest - FromProto(msg *otg.LldpNeighborsStateRequest) (LldpNeighborsStateRequest, error) - // FromPbText unmarshals LldpNeighborsStateRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LldpNeighborsStateRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals LldpNeighborsStateRequest from JSON text - FromJson(value string) error -} - -func (obj *lldpNeighborsStateRequest) Marshal() marshalLldpNeighborsStateRequest { - if obj.marshaller == nil { - obj.marshaller = &marshallldpNeighborsStateRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *lldpNeighborsStateRequest) Unmarshal() unMarshalLldpNeighborsStateRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallldpNeighborsStateRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallldpNeighborsStateRequest) ToProto() (*otg.LldpNeighborsStateRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallldpNeighborsStateRequest) FromProto(msg *otg.LldpNeighborsStateRequest) (LldpNeighborsStateRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallldpNeighborsStateRequest) 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 *unMarshallldpNeighborsStateRequest) 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 *marshallldpNeighborsStateRequest) 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 *unMarshallldpNeighborsStateRequest) 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 *marshallldpNeighborsStateRequest) 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 *unMarshallldpNeighborsStateRequest) 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 *lldpNeighborsStateRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lldpNeighborsStateRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lldpNeighborsStateRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lldpNeighborsStateRequest) Clone() (LldpNeighborsStateRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLldpNeighborsStateRequest() - 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 -} - -// LldpNeighborsStateRequest is the request to retrieve LLDP neighbor information for a given instance. -type LldpNeighborsStateRequest interface { - Validation - // msg marshals LldpNeighborsStateRequest to protobuf object *otg.LldpNeighborsStateRequest - // and doesn't set defaults - msg() *otg.LldpNeighborsStateRequest - // setMsg unmarshals LldpNeighborsStateRequest from protobuf object *otg.LldpNeighborsStateRequest - // and doesn't set defaults - setMsg(*otg.LldpNeighborsStateRequest) LldpNeighborsStateRequest - // provides marshal interface - Marshal() marshalLldpNeighborsStateRequest - // provides unmarshal interface - Unmarshal() unMarshalLldpNeighborsStateRequest - // validate validates LldpNeighborsStateRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LldpNeighborsStateRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // LldpNames returns []string, set in LldpNeighborsStateRequest. - LldpNames() []string - // SetLldpNames assigns []string provided by user to LldpNeighborsStateRequest - SetLldpNames(value []string) LldpNeighborsStateRequest - // NeighborIdFilters returns []string, set in LldpNeighborsStateRequest. - NeighborIdFilters() []string - // SetNeighborIdFilters assigns []string provided by user to LldpNeighborsStateRequest - SetNeighborIdFilters(value []string) LldpNeighborsStateRequest -} - -// The names of LLDP instances for which neighbor information will be retrieved. If no names are specified then the results will contain neighbor information for all configured LLDP instances. -// -// x-constraint: -// - /components/schemas/Lldp/properties/name -// -// x-constraint: -// - /components/schemas/Lldp/properties/name -// -// LldpNames returns a []string -func (obj *lldpNeighborsStateRequest) LldpNames() []string { - if obj.obj.LldpNames == nil { - obj.obj.LldpNames = make([]string, 0) - } - return obj.obj.LldpNames -} - -// The names of LLDP instances for which neighbor information will be retrieved. If no names are specified then the results will contain neighbor information for all configured LLDP instances. -// -// x-constraint: -// - /components/schemas/Lldp/properties/name -// -// x-constraint: -// - /components/schemas/Lldp/properties/name -// -// SetLldpNames sets the []string value in the LldpNeighborsStateRequest object -func (obj *lldpNeighborsStateRequest) SetLldpNames(value []string) LldpNeighborsStateRequest { - - if obj.obj.LldpNames == nil { - obj.obj.LldpNames = make([]string, 0) - } - obj.obj.LldpNames = value - - return obj -} - -// Specify the neighbors for which information will be returned. If empty or missing then information for all neighbors will be returned. -// NeighborIdFilters returns a []string -func (obj *lldpNeighborsStateRequest) NeighborIdFilters() []string { - if obj.obj.NeighborIdFilters == nil { - obj.obj.NeighborIdFilters = make([]string, 0) - } - return obj.obj.NeighborIdFilters -} - -// Specify the neighbors for which information will be returned. If empty or missing then information for all neighbors will be returned. -// SetNeighborIdFilters sets the []string value in the LldpNeighborsStateRequest object -func (obj *lldpNeighborsStateRequest) SetNeighborIdFilters(value []string) LldpNeighborsStateRequest { - - if obj.obj.NeighborIdFilters == nil { - obj.obj.NeighborIdFilters = make([]string, 0) - } - obj.obj.NeighborIdFilters = value - - return obj -} - -func (obj *lldpNeighborsStateRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *lldpNeighborsStateRequest) setDefault() { - -} - -// ***** RsvpLspsStateRequest ***** -type rsvpLspsStateRequest struct { - validation - obj *otg.RsvpLspsStateRequest - marshaller marshalRsvpLspsStateRequest - unMarshaller unMarshalRsvpLspsStateRequest -} - -func NewRsvpLspsStateRequest() RsvpLspsStateRequest { - obj := rsvpLspsStateRequest{obj: &otg.RsvpLspsStateRequest{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpLspsStateRequest) msg() *otg.RsvpLspsStateRequest { - return obj.obj -} - -func (obj *rsvpLspsStateRequest) setMsg(msg *otg.RsvpLspsStateRequest) RsvpLspsStateRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpLspsStateRequest struct { - obj *rsvpLspsStateRequest -} - -type marshalRsvpLspsStateRequest interface { - // ToProto marshals RsvpLspsStateRequest to protobuf object *otg.RsvpLspsStateRequest - ToProto() (*otg.RsvpLspsStateRequest, error) - // ToPbText marshals RsvpLspsStateRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpLspsStateRequest to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpLspsStateRequest to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpLspsStateRequest struct { - obj *rsvpLspsStateRequest -} - -type unMarshalRsvpLspsStateRequest interface { - // FromProto unmarshals RsvpLspsStateRequest from protobuf object *otg.RsvpLspsStateRequest - FromProto(msg *otg.RsvpLspsStateRequest) (RsvpLspsStateRequest, error) - // FromPbText unmarshals RsvpLspsStateRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpLspsStateRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpLspsStateRequest from JSON text - FromJson(value string) error -} - -func (obj *rsvpLspsStateRequest) Marshal() marshalRsvpLspsStateRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpLspsStateRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpLspsStateRequest) Unmarshal() unMarshalRsvpLspsStateRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpLspsStateRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpLspsStateRequest) ToProto() (*otg.RsvpLspsStateRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpLspsStateRequest) FromProto(msg *otg.RsvpLspsStateRequest) (RsvpLspsStateRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpLspsStateRequest) 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 *unMarshalrsvpLspsStateRequest) 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 *marshalrsvpLspsStateRequest) 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 *unMarshalrsvpLspsStateRequest) 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 *marshalrsvpLspsStateRequest) 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 *unMarshalrsvpLspsStateRequest) 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 *rsvpLspsStateRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpLspsStateRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpLspsStateRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpLspsStateRequest) Clone() (RsvpLspsStateRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpLspsStateRequest() - 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 -} - -// RsvpLspsStateRequest is the request to retrieve RSVP Label Switched Path (LSP) information learned by the router. -type RsvpLspsStateRequest interface { - Validation - // msg marshals RsvpLspsStateRequest to protobuf object *otg.RsvpLspsStateRequest - // and doesn't set defaults - msg() *otg.RsvpLspsStateRequest - // setMsg unmarshals RsvpLspsStateRequest from protobuf object *otg.RsvpLspsStateRequest - // and doesn't set defaults - setMsg(*otg.RsvpLspsStateRequest) RsvpLspsStateRequest - // provides marshal interface - Marshal() marshalRsvpLspsStateRequest - // provides unmarshal interface - Unmarshal() unMarshalRsvpLspsStateRequest - // validate validates RsvpLspsStateRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpLspsStateRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RsvpRouterNames returns []string, set in RsvpLspsStateRequest. - RsvpRouterNames() []string - // SetRsvpRouterNames assigns []string provided by user to RsvpLspsStateRequest - SetRsvpRouterNames(value []string) RsvpLspsStateRequest -} - -// The names of RSVP-TE routers for which learned information is requested. An empty list will return results for all RSVP=TE routers. -// -// x-constraint: -// - /components/schemas/Device.Rsvp/properties/name -// -// x-constraint: -// - /components/schemas/Device.Rsvp/properties/name -// -// RsvpRouterNames returns a []string -func (obj *rsvpLspsStateRequest) RsvpRouterNames() []string { - if obj.obj.RsvpRouterNames == nil { - obj.obj.RsvpRouterNames = make([]string, 0) - } - return obj.obj.RsvpRouterNames -} - -// The names of RSVP-TE routers for which learned information is requested. An empty list will return results for all RSVP=TE routers. -// -// x-constraint: -// - /components/schemas/Device.Rsvp/properties/name -// -// x-constraint: -// - /components/schemas/Device.Rsvp/properties/name -// -// SetRsvpRouterNames sets the []string value in the RsvpLspsStateRequest object -func (obj *rsvpLspsStateRequest) SetRsvpRouterNames(value []string) RsvpLspsStateRequest { - - if obj.obj.RsvpRouterNames == nil { - obj.obj.RsvpRouterNames = make([]string, 0) - } - obj.obj.RsvpRouterNames = value - - return obj -} - -func (obj *rsvpLspsStateRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *rsvpLspsStateRequest) setDefault() { - -} - -// ***** Dhcpv4InterfaceStateRequest ***** -type dhcpv4InterfaceStateRequest struct { - validation - obj *otg.Dhcpv4InterfaceStateRequest - marshaller marshalDhcpv4InterfaceStateRequest - unMarshaller unMarshalDhcpv4InterfaceStateRequest -} - -func NewDhcpv4InterfaceStateRequest() Dhcpv4InterfaceStateRequest { - obj := dhcpv4InterfaceStateRequest{obj: &otg.Dhcpv4InterfaceStateRequest{}} - obj.setDefault() - return &obj -} - -func (obj *dhcpv4InterfaceStateRequest) msg() *otg.Dhcpv4InterfaceStateRequest { - return obj.obj -} - -func (obj *dhcpv4InterfaceStateRequest) setMsg(msg *otg.Dhcpv4InterfaceStateRequest) Dhcpv4InterfaceStateRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldhcpv4InterfaceStateRequest struct { - obj *dhcpv4InterfaceStateRequest -} - -type marshalDhcpv4InterfaceStateRequest interface { - // ToProto marshals Dhcpv4InterfaceStateRequest to protobuf object *otg.Dhcpv4InterfaceStateRequest - ToProto() (*otg.Dhcpv4InterfaceStateRequest, error) - // ToPbText marshals Dhcpv4InterfaceStateRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals Dhcpv4InterfaceStateRequest to YAML text - ToYaml() (string, error) - // ToJson marshals Dhcpv4InterfaceStateRequest to JSON text - ToJson() (string, error) -} - -type unMarshaldhcpv4InterfaceStateRequest struct { - obj *dhcpv4InterfaceStateRequest -} - -type unMarshalDhcpv4InterfaceStateRequest interface { - // FromProto unmarshals Dhcpv4InterfaceStateRequest from protobuf object *otg.Dhcpv4InterfaceStateRequest - FromProto(msg *otg.Dhcpv4InterfaceStateRequest) (Dhcpv4InterfaceStateRequest, error) - // FromPbText unmarshals Dhcpv4InterfaceStateRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Dhcpv4InterfaceStateRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals Dhcpv4InterfaceStateRequest from JSON text - FromJson(value string) error -} - -func (obj *dhcpv4InterfaceStateRequest) Marshal() marshalDhcpv4InterfaceStateRequest { - if obj.marshaller == nil { - obj.marshaller = &marshaldhcpv4InterfaceStateRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *dhcpv4InterfaceStateRequest) Unmarshal() unMarshalDhcpv4InterfaceStateRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldhcpv4InterfaceStateRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldhcpv4InterfaceStateRequest) ToProto() (*otg.Dhcpv4InterfaceStateRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldhcpv4InterfaceStateRequest) FromProto(msg *otg.Dhcpv4InterfaceStateRequest) (Dhcpv4InterfaceStateRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldhcpv4InterfaceStateRequest) 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 *unMarshaldhcpv4InterfaceStateRequest) 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 *marshaldhcpv4InterfaceStateRequest) 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 *unMarshaldhcpv4InterfaceStateRequest) 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 *marshaldhcpv4InterfaceStateRequest) 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 *unMarshaldhcpv4InterfaceStateRequest) 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 *dhcpv4InterfaceStateRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *dhcpv4InterfaceStateRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *dhcpv4InterfaceStateRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *dhcpv4InterfaceStateRequest) Clone() (Dhcpv4InterfaceStateRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDhcpv4InterfaceStateRequest() - 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 -} - -// Dhcpv4InterfaceStateRequest is the request for assigned IPv4 address information associated with DHCP Client sessions. -type Dhcpv4InterfaceStateRequest interface { - Validation - // msg marshals Dhcpv4InterfaceStateRequest to protobuf object *otg.Dhcpv4InterfaceStateRequest - // and doesn't set defaults - msg() *otg.Dhcpv4InterfaceStateRequest - // setMsg unmarshals Dhcpv4InterfaceStateRequest from protobuf object *otg.Dhcpv4InterfaceStateRequest - // and doesn't set defaults - setMsg(*otg.Dhcpv4InterfaceStateRequest) Dhcpv4InterfaceStateRequest - // provides marshal interface - Marshal() marshalDhcpv4InterfaceStateRequest - // provides unmarshal interface - Unmarshal() unMarshalDhcpv4InterfaceStateRequest - // validate validates Dhcpv4InterfaceStateRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Dhcpv4InterfaceStateRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // DhcpClientNames returns []string, set in Dhcpv4InterfaceStateRequest. - DhcpClientNames() []string - // SetDhcpClientNames assigns []string provided by user to Dhcpv4InterfaceStateRequest - SetDhcpClientNames(value []string) Dhcpv4InterfaceStateRequest -} - -// The names of DHCPv4 client to return results for. An empty list will return results for all DHCPv4 Client address information. -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// DhcpClientNames returns a []string -func (obj *dhcpv4InterfaceStateRequest) DhcpClientNames() []string { - if obj.obj.DhcpClientNames == nil { - obj.obj.DhcpClientNames = make([]string, 0) - } - return obj.obj.DhcpClientNames -} - -// The names of DHCPv4 client to return results for. An empty list will return results for all DHCPv4 Client address information. -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// SetDhcpClientNames sets the []string value in the Dhcpv4InterfaceStateRequest object -func (obj *dhcpv4InterfaceStateRequest) SetDhcpClientNames(value []string) Dhcpv4InterfaceStateRequest { - - if obj.obj.DhcpClientNames == nil { - obj.obj.DhcpClientNames = make([]string, 0) - } - obj.obj.DhcpClientNames = value - - return obj -} - -func (obj *dhcpv4InterfaceStateRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *dhcpv4InterfaceStateRequest) setDefault() { - -} - -// ***** Dhcpv4LeaseStateRequest ***** -type dhcpv4LeaseStateRequest struct { - validation - obj *otg.Dhcpv4LeaseStateRequest - marshaller marshalDhcpv4LeaseStateRequest - unMarshaller unMarshalDhcpv4LeaseStateRequest -} - -func NewDhcpv4LeaseStateRequest() Dhcpv4LeaseStateRequest { - obj := dhcpv4LeaseStateRequest{obj: &otg.Dhcpv4LeaseStateRequest{}} - obj.setDefault() - return &obj -} - -func (obj *dhcpv4LeaseStateRequest) msg() *otg.Dhcpv4LeaseStateRequest { - return obj.obj -} - -func (obj *dhcpv4LeaseStateRequest) setMsg(msg *otg.Dhcpv4LeaseStateRequest) Dhcpv4LeaseStateRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldhcpv4LeaseStateRequest struct { - obj *dhcpv4LeaseStateRequest -} - -type marshalDhcpv4LeaseStateRequest interface { - // ToProto marshals Dhcpv4LeaseStateRequest to protobuf object *otg.Dhcpv4LeaseStateRequest - ToProto() (*otg.Dhcpv4LeaseStateRequest, error) - // ToPbText marshals Dhcpv4LeaseStateRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals Dhcpv4LeaseStateRequest to YAML text - ToYaml() (string, error) - // ToJson marshals Dhcpv4LeaseStateRequest to JSON text - ToJson() (string, error) -} - -type unMarshaldhcpv4LeaseStateRequest struct { - obj *dhcpv4LeaseStateRequest -} - -type unMarshalDhcpv4LeaseStateRequest interface { - // FromProto unmarshals Dhcpv4LeaseStateRequest from protobuf object *otg.Dhcpv4LeaseStateRequest - FromProto(msg *otg.Dhcpv4LeaseStateRequest) (Dhcpv4LeaseStateRequest, error) - // FromPbText unmarshals Dhcpv4LeaseStateRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Dhcpv4LeaseStateRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals Dhcpv4LeaseStateRequest from JSON text - FromJson(value string) error -} - -func (obj *dhcpv4LeaseStateRequest) Marshal() marshalDhcpv4LeaseStateRequest { - if obj.marshaller == nil { - obj.marshaller = &marshaldhcpv4LeaseStateRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *dhcpv4LeaseStateRequest) Unmarshal() unMarshalDhcpv4LeaseStateRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldhcpv4LeaseStateRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldhcpv4LeaseStateRequest) ToProto() (*otg.Dhcpv4LeaseStateRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldhcpv4LeaseStateRequest) FromProto(msg *otg.Dhcpv4LeaseStateRequest) (Dhcpv4LeaseStateRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldhcpv4LeaseStateRequest) 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 *unMarshaldhcpv4LeaseStateRequest) 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 *marshaldhcpv4LeaseStateRequest) 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 *unMarshaldhcpv4LeaseStateRequest) 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 *marshaldhcpv4LeaseStateRequest) 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 *unMarshaldhcpv4LeaseStateRequest) 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 *dhcpv4LeaseStateRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *dhcpv4LeaseStateRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *dhcpv4LeaseStateRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *dhcpv4LeaseStateRequest) Clone() (Dhcpv4LeaseStateRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDhcpv4LeaseStateRequest() - 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 -} - -// Dhcpv4LeaseStateRequest is the request to retrieve DHCP Server host allocated status. -type Dhcpv4LeaseStateRequest interface { - Validation - // msg marshals Dhcpv4LeaseStateRequest to protobuf object *otg.Dhcpv4LeaseStateRequest - // and doesn't set defaults - msg() *otg.Dhcpv4LeaseStateRequest - // setMsg unmarshals Dhcpv4LeaseStateRequest from protobuf object *otg.Dhcpv4LeaseStateRequest - // and doesn't set defaults - setMsg(*otg.Dhcpv4LeaseStateRequest) Dhcpv4LeaseStateRequest - // provides marshal interface - Marshal() marshalDhcpv4LeaseStateRequest - // provides unmarshal interface - Unmarshal() unMarshalDhcpv4LeaseStateRequest - // validate validates Dhcpv4LeaseStateRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Dhcpv4LeaseStateRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // DhcpServerNames returns []string, set in Dhcpv4LeaseStateRequest. - DhcpServerNames() []string - // SetDhcpServerNames assigns []string provided by user to Dhcpv4LeaseStateRequest - SetDhcpServerNames(value []string) Dhcpv4LeaseStateRequest -} - -// The names of DHCPv4 server to return results for. An empty list will return results for all DHCPv4 servers. -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4server/properties/name -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4server/properties/name -// -// DhcpServerNames returns a []string -func (obj *dhcpv4LeaseStateRequest) DhcpServerNames() []string { - if obj.obj.DhcpServerNames == nil { - obj.obj.DhcpServerNames = make([]string, 0) - } - return obj.obj.DhcpServerNames -} - -// The names of DHCPv4 server to return results for. An empty list will return results for all DHCPv4 servers. -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4server/properties/name -// -// x-constraint: -// - /components/schemas/Device.Dhcpv4server/properties/name -// -// SetDhcpServerNames sets the []string value in the Dhcpv4LeaseStateRequest object -func (obj *dhcpv4LeaseStateRequest) SetDhcpServerNames(value []string) Dhcpv4LeaseStateRequest { - - if obj.obj.DhcpServerNames == nil { - obj.obj.DhcpServerNames = make([]string, 0) - } - obj.obj.DhcpServerNames = value - - return obj -} - -func (obj *dhcpv4LeaseStateRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *dhcpv4LeaseStateRequest) setDefault() { - -} - -// ***** Warning ***** -type warning struct { - validation - obj *otg.Warning - marshaller marshalWarning - unMarshaller unMarshalWarning -} - -func NewWarning() Warning { - obj := warning{obj: &otg.Warning{}} - obj.setDefault() - return &obj -} - -func (obj *warning) msg() *otg.Warning { - return obj.obj -} - -func (obj *warning) setMsg(msg *otg.Warning) Warning { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalwarning struct { - obj *warning -} - -type marshalWarning interface { - // ToProto marshals Warning to protobuf object *otg.Warning - ToProto() (*otg.Warning, error) - // ToPbText marshals Warning to protobuf text - ToPbText() (string, error) - // ToYaml marshals Warning to YAML text - ToYaml() (string, error) - // ToJson marshals Warning to JSON text - ToJson() (string, error) -} - -type unMarshalwarning struct { - obj *warning -} - -type unMarshalWarning interface { - // FromProto unmarshals Warning from protobuf object *otg.Warning - FromProto(msg *otg.Warning) (Warning, error) - // FromPbText unmarshals Warning from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Warning from YAML text - FromYaml(value string) error - // FromJson unmarshals Warning from JSON text - FromJson(value string) error -} - -func (obj *warning) Marshal() marshalWarning { - if obj.marshaller == nil { - obj.marshaller = &marshalwarning{obj: obj} - } - return obj.marshaller -} - -func (obj *warning) Unmarshal() unMarshalWarning { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalwarning{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalwarning) ToProto() (*otg.Warning, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalwarning) FromProto(msg *otg.Warning) (Warning, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalwarning) 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 *unMarshalwarning) 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 *marshalwarning) 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 *unMarshalwarning) 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 *marshalwarning) 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 *unMarshalwarning) 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 *warning) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *warning) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *warning) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *warning) Clone() (Warning, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewWarning() - 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 -} - -// Warning is a list of warnings that have occurred while executing the request. -type Warning interface { - Validation - // msg marshals Warning to protobuf object *otg.Warning - // and doesn't set defaults - msg() *otg.Warning - // setMsg unmarshals Warning from protobuf object *otg.Warning - // and doesn't set defaults - setMsg(*otg.Warning) Warning - // provides marshal interface - Marshal() marshalWarning - // provides unmarshal interface - Unmarshal() unMarshalWarning - // validate validates Warning - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Warning, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Warnings returns []string, set in Warning. - Warnings() []string - // SetWarnings assigns []string provided by user to Warning - SetWarnings(value []string) Warning -} - -// A list of any system specific warnings that have occurred while -// executing the request. -// Warnings returns a []string -func (obj *warning) Warnings() []string { - if obj.obj.Warnings == nil { - obj.obj.Warnings = make([]string, 0) - } - return obj.obj.Warnings -} - -// A list of any system specific warnings that have occurred while -// executing the request. -// SetWarnings sets the []string value in the Warning object -func (obj *warning) SetWarnings(value []string) Warning { - - if obj.obj.Warnings == nil { - obj.obj.Warnings = make([]string, 0) - } - obj.obj.Warnings = value - - return obj -} - -func (obj *warning) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *warning) setDefault() { - -} - -// ***** Error ***** -type _error struct { - validation - obj *otg.Error - marshaller marshalError - unMarshaller unMarshalError -} - -func NewError() Error { - obj := _error{obj: &otg.Error{}} - obj.setDefault() - return &obj -} - -func (obj *_error) msg() *otg.Error { - return obj.obj -} - -func (obj *_error) setMsg(msg *otg.Error) Error { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshal_error struct { - obj *_error -} - -type marshalError interface { - // ToProto marshals Error to protobuf object *otg.Error - ToProto() (*otg.Error, error) - // ToPbText marshals Error to protobuf text - ToPbText() (string, error) - // ToYaml marshals Error to YAML text - ToYaml() (string, error) - // ToJson marshals Error to JSON text - ToJson() (string, error) -} - -type unMarshal_error struct { - obj *_error -} - -type unMarshalError interface { - // FromProto unmarshals Error from protobuf object *otg.Error - FromProto(msg *otg.Error) (Error, error) - // FromPbText unmarshals Error from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Error from YAML text - FromYaml(value string) error - // FromJson unmarshals Error from JSON text - FromJson(value string) error -} - -func (obj *_error) Marshal() marshalError { - if obj.marshaller == nil { - obj.marshaller = &marshal_error{obj: obj} - } - return obj.marshaller -} - -func (obj *_error) Unmarshal() unMarshalError { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshal_error{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshal_error) ToProto() (*otg.Error, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshal_error) FromProto(msg *otg.Error) (Error, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshal_error) 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 *unMarshal_error) 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 *marshal_error) 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 *unMarshal_error) 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 *marshal_error) 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 *unMarshal_error) 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 *_error) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *_error) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *_error) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *_error) Clone() (Error, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewError() - 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 -} - -// Error is error response generated while serving API request. -type Error interface { - Validation - // msg marshals Error to protobuf object *otg.Error - // and doesn't set defaults - msg() *otg.Error - // setMsg unmarshals Error from protobuf object *otg.Error - // and doesn't set defaults - setMsg(*otg.Error) Error - // provides marshal interface - Marshal() marshalError - // provides unmarshal interface - Unmarshal() unMarshalError - // validate validates Error - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Error, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Code returns int32, set in Error. - Code() int32 - // SetCode assigns int32 provided by user to Error - SetCode(value int32) Error - // Kind returns ErrorKindEnum, set in Error - Kind() ErrorKindEnum - // SetKind assigns ErrorKindEnum provided by user to Error - SetKind(value ErrorKindEnum) Error - // HasKind checks if Kind has been set in Error - HasKind() bool - // Errors returns []string, set in Error. - Errors() []string - // SetErrors assigns []string provided by user to Error - SetErrors(value []string) Error - // implement Error function for implementingnative Error Interface. - Error() string -} - -func (obj *_error) Error() string { - json, err := obj.Marshal().ToJson() - if err != nil { - return fmt.Sprintf("could not convert Error to JSON: %v", err) - } - return json -} - -// Numeric status code based on the underlying transport being used. -// The API server MUST set this code explicitly based on following references: -// - HTTP 4xx errors: https://datatracker.ietf.org/doc/html/rfc9110#section-15.5 -// - HTTP 5xx errors: https://datatracker.ietf.org/doc/html/rfc9110#section-15.6 -// - gRPC errors: https://grpc.github.io/grpc/core/md_doc_statuscodes.html -// Code returns a int32 -func (obj *_error) Code() int32 { - - return *obj.obj.Code - -} - -// Numeric status code based on the underlying transport being used. -// The API server MUST set this code explicitly based on following references: -// - HTTP 4xx errors: https://datatracker.ietf.org/doc/html/rfc9110#section-15.5 -// - HTTP 5xx errors: https://datatracker.ietf.org/doc/html/rfc9110#section-15.6 -// - gRPC errors: https://grpc.github.io/grpc/core/md_doc_statuscodes.html -// SetCode sets the int32 value in the Error object -func (obj *_error) SetCode(value int32) Error { - - obj.obj.Code = &value - return obj -} - -type ErrorKindEnum string - -// Enum of Kind on Error -var ErrorKind = struct { - VALIDATION ErrorKindEnum - INTERNAL ErrorKindEnum -}{ - VALIDATION: ErrorKindEnum("validation"), - INTERNAL: ErrorKindEnum("internal"), -} - -func (obj *_error) Kind() ErrorKindEnum { - return ErrorKindEnum(obj.obj.Kind.Enum().String()) -} - -// Classification of error originating from within API server that may not be mapped to the value in `code`. -// Absence of this field may indicate that the error did not originate from within API server. -// Kind returns a string -func (obj *_error) HasKind() bool { - return obj.obj.Kind != nil -} - -func (obj *_error) SetKind(value ErrorKindEnum) Error { - intValue, ok := otg.Error_Kind_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ErrorKindEnum", string(value))) - return obj - } - enumValue := otg.Error_Kind_Enum(intValue) - obj.obj.Kind = &enumValue - - return obj -} - -// List of error messages generated while executing the request. -// Errors returns a []string -func (obj *_error) Errors() []string { - if obj.obj.Errors == nil { - obj.obj.Errors = make([]string, 0) - } - return obj.obj.Errors -} - -// List of error messages generated while executing the request. -// SetErrors sets the []string value in the Error object -func (obj *_error) SetErrors(value []string) Error { - - if obj.obj.Errors == nil { - obj.obj.Errors = make([]string, 0) - } - obj.obj.Errors = value - - return obj -} - -func (obj *_error) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Code is required - if obj.obj.Code == nil { - vObj.validationErrors = append(vObj.validationErrors, "Code is required field on interface Error") - } -} - -func (obj *_error) setDefault() { - -} - -// ***** ControlActionResponse ***** -type controlActionResponse struct { - validation - obj *otg.ControlActionResponse - marshaller marshalControlActionResponse - unMarshaller unMarshalControlActionResponse - responseHolder ActionResponse -} - -func NewControlActionResponse() ControlActionResponse { - obj := controlActionResponse{obj: &otg.ControlActionResponse{}} - obj.setDefault() - return &obj -} - -func (obj *controlActionResponse) msg() *otg.ControlActionResponse { - return obj.obj -} - -func (obj *controlActionResponse) setMsg(msg *otg.ControlActionResponse) ControlActionResponse { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalcontrolActionResponse struct { - obj *controlActionResponse -} - -type marshalControlActionResponse interface { - // ToProto marshals ControlActionResponse to protobuf object *otg.ControlActionResponse - ToProto() (*otg.ControlActionResponse, error) - // ToPbText marshals ControlActionResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals ControlActionResponse to YAML text - ToYaml() (string, error) - // ToJson marshals ControlActionResponse to JSON text - ToJson() (string, error) -} - -type unMarshalcontrolActionResponse struct { - obj *controlActionResponse -} - -type unMarshalControlActionResponse interface { - // FromProto unmarshals ControlActionResponse from protobuf object *otg.ControlActionResponse - FromProto(msg *otg.ControlActionResponse) (ControlActionResponse, error) - // FromPbText unmarshals ControlActionResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ControlActionResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals ControlActionResponse from JSON text - FromJson(value string) error -} - -func (obj *controlActionResponse) Marshal() marshalControlActionResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalcontrolActionResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *controlActionResponse) Unmarshal() unMarshalControlActionResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalcontrolActionResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalcontrolActionResponse) ToProto() (*otg.ControlActionResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalcontrolActionResponse) FromProto(msg *otg.ControlActionResponse) (ControlActionResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalcontrolActionResponse) 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 *unMarshalcontrolActionResponse) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalcontrolActionResponse) 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 *unMarshalcontrolActionResponse) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalcontrolActionResponse) 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 *unMarshalcontrolActionResponse) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *controlActionResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *controlActionResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *controlActionResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *controlActionResponse) Clone() (ControlActionResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewControlActionResponse() - 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 -} - -func (obj *controlActionResponse) setNil() { - obj.responseHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ControlActionResponse is response for action triggered against configured resources along with warnings. -type ControlActionResponse interface { - Validation - // msg marshals ControlActionResponse to protobuf object *otg.ControlActionResponse - // and doesn't set defaults - msg() *otg.ControlActionResponse - // setMsg unmarshals ControlActionResponse from protobuf object *otg.ControlActionResponse - // and doesn't set defaults - setMsg(*otg.ControlActionResponse) ControlActionResponse - // provides marshal interface - Marshal() marshalControlActionResponse - // provides unmarshal interface - Unmarshal() unMarshalControlActionResponse - // validate validates ControlActionResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ControlActionResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Warnings returns []string, set in ControlActionResponse. - Warnings() []string - // SetWarnings assigns []string provided by user to ControlActionResponse - SetWarnings(value []string) ControlActionResponse - // Response returns ActionResponse, set in ControlActionResponse. - // ActionResponse is response for action triggered against configured resources. - Response() ActionResponse - // SetResponse assigns ActionResponse provided by user to ControlActionResponse. - // ActionResponse is response for action triggered against configured resources. - SetResponse(value ActionResponse) ControlActionResponse - // HasResponse checks if Response has been set in ControlActionResponse - HasResponse() bool - setNil() -} - -// List of warnings generated while triggering specified action -// Warnings returns a []string -func (obj *controlActionResponse) Warnings() []string { - if obj.obj.Warnings == nil { - obj.obj.Warnings = make([]string, 0) - } - return obj.obj.Warnings -} - -// List of warnings generated while triggering specified action -// SetWarnings sets the []string value in the ControlActionResponse object -func (obj *controlActionResponse) SetWarnings(value []string) ControlActionResponse { - - if obj.obj.Warnings == nil { - obj.obj.Warnings = make([]string, 0) - } - obj.obj.Warnings = value - - return obj -} - -// description is TBD -// Response returns a ActionResponse -func (obj *controlActionResponse) Response() ActionResponse { - if obj.obj.Response == nil { - obj.obj.Response = NewActionResponse().msg() - } - if obj.responseHolder == nil { - obj.responseHolder = &actionResponse{obj: obj.obj.Response} - } - return obj.responseHolder -} - -// description is TBD -// Response returns a ActionResponse -func (obj *controlActionResponse) HasResponse() bool { - return obj.obj.Response != nil -} - -// description is TBD -// SetResponse sets the ActionResponse value in the ControlActionResponse object -func (obj *controlActionResponse) SetResponse(value ActionResponse) ControlActionResponse { - - obj.responseHolder = nil - obj.obj.Response = value.msg() - - return obj -} - -func (obj *controlActionResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Response != nil { - - obj.Response().validateObj(vObj, set_default) - } - -} - -func (obj *controlActionResponse) setDefault() { - -} - -// ***** MetricsResponse ***** -type metricsResponse struct { - validation - obj *otg.MetricsResponse - marshaller marshalMetricsResponse - unMarshaller unMarshalMetricsResponse - portMetricsHolder MetricsResponsePortMetricIter - flowMetricsHolder MetricsResponseFlowMetricIter - bgpv4MetricsHolder MetricsResponseBgpv4MetricIter - bgpv6MetricsHolder MetricsResponseBgpv6MetricIter - isisMetricsHolder MetricsResponseIsisMetricIter - lagMetricsHolder MetricsResponseLagMetricIter - lacpMetricsHolder MetricsResponseLacpMetricIter - lldpMetricsHolder MetricsResponseLldpMetricIter - rsvpMetricsHolder MetricsResponseRsvpMetricIter - dhcpv4ClientMetricsHolder MetricsResponseDhcpv4ClientMetricIter - dhcpv4ServerMetricsHolder MetricsResponseDhcpv4ServerMetricIter -} - -func NewMetricsResponse() MetricsResponse { - obj := metricsResponse{obj: &otg.MetricsResponse{}} - obj.setDefault() - return &obj -} - -func (obj *metricsResponse) msg() *otg.MetricsResponse { - return obj.obj -} - -func (obj *metricsResponse) setMsg(msg *otg.MetricsResponse) MetricsResponse { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalmetricsResponse struct { - obj *metricsResponse -} - -type marshalMetricsResponse interface { - // ToProto marshals MetricsResponse to protobuf object *otg.MetricsResponse - ToProto() (*otg.MetricsResponse, error) - // ToPbText marshals MetricsResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals MetricsResponse to YAML text - ToYaml() (string, error) - // ToJson marshals MetricsResponse to JSON text - ToJson() (string, error) -} - -type unMarshalmetricsResponse struct { - obj *metricsResponse -} - -type unMarshalMetricsResponse interface { - // FromProto unmarshals MetricsResponse from protobuf object *otg.MetricsResponse - FromProto(msg *otg.MetricsResponse) (MetricsResponse, error) - // FromPbText unmarshals MetricsResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals MetricsResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals MetricsResponse from JSON text - FromJson(value string) error -} - -func (obj *metricsResponse) Marshal() marshalMetricsResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalmetricsResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *metricsResponse) Unmarshal() unMarshalMetricsResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalmetricsResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalmetricsResponse) ToProto() (*otg.MetricsResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalmetricsResponse) FromProto(msg *otg.MetricsResponse) (MetricsResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalmetricsResponse) 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 *unMarshalmetricsResponse) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalmetricsResponse) 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 *unMarshalmetricsResponse) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalmetricsResponse) 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 *unMarshalmetricsResponse) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *metricsResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *metricsResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *metricsResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *metricsResponse) Clone() (MetricsResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewMetricsResponse() - 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 -} - -func (obj *metricsResponse) setNil() { - obj.portMetricsHolder = nil - obj.flowMetricsHolder = nil - obj.bgpv4MetricsHolder = nil - obj.bgpv6MetricsHolder = nil - obj.isisMetricsHolder = nil - obj.lagMetricsHolder = nil - obj.lacpMetricsHolder = nil - obj.lldpMetricsHolder = nil - obj.rsvpMetricsHolder = nil - obj.dhcpv4ClientMetricsHolder = nil - obj.dhcpv4ServerMetricsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// MetricsResponse is response containing chosen traffic generator metrics. -type MetricsResponse interface { - Validation - // msg marshals MetricsResponse to protobuf object *otg.MetricsResponse - // and doesn't set defaults - msg() *otg.MetricsResponse - // setMsg unmarshals MetricsResponse from protobuf object *otg.MetricsResponse - // and doesn't set defaults - setMsg(*otg.MetricsResponse) MetricsResponse - // provides marshal interface - Marshal() marshalMetricsResponse - // provides unmarshal interface - Unmarshal() unMarshalMetricsResponse - // validate validates MetricsResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (MetricsResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns MetricsResponseChoiceEnum, set in MetricsResponse - Choice() MetricsResponseChoiceEnum - // setChoice assigns MetricsResponseChoiceEnum provided by user to MetricsResponse - 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() - // PortMetrics returns MetricsResponsePortMetricIterIter, set in MetricsResponse - PortMetrics() MetricsResponsePortMetricIter - // FlowMetrics returns MetricsResponseFlowMetricIterIter, set in MetricsResponse - FlowMetrics() MetricsResponseFlowMetricIter - // Bgpv4Metrics returns MetricsResponseBgpv4MetricIterIter, set in MetricsResponse - Bgpv4Metrics() MetricsResponseBgpv4MetricIter - // Bgpv6Metrics returns MetricsResponseBgpv6MetricIterIter, set in MetricsResponse - Bgpv6Metrics() MetricsResponseBgpv6MetricIter - // IsisMetrics returns MetricsResponseIsisMetricIterIter, set in MetricsResponse - IsisMetrics() MetricsResponseIsisMetricIter - // LagMetrics returns MetricsResponseLagMetricIterIter, set in MetricsResponse - LagMetrics() MetricsResponseLagMetricIter - // LacpMetrics returns MetricsResponseLacpMetricIterIter, set in MetricsResponse - LacpMetrics() MetricsResponseLacpMetricIter - // LldpMetrics returns MetricsResponseLldpMetricIterIter, set in MetricsResponse - LldpMetrics() MetricsResponseLldpMetricIter - // RsvpMetrics returns MetricsResponseRsvpMetricIterIter, set in MetricsResponse - RsvpMetrics() MetricsResponseRsvpMetricIter - // Dhcpv4ClientMetrics returns MetricsResponseDhcpv4ClientMetricIterIter, set in MetricsResponse - Dhcpv4ClientMetrics() MetricsResponseDhcpv4ClientMetricIter - // Dhcpv4ServerMetrics returns MetricsResponseDhcpv4ServerMetricIterIter, set in MetricsResponse - Dhcpv4ServerMetrics() MetricsResponseDhcpv4ServerMetricIter - setNil() -} - -type MetricsResponseChoiceEnum string - -// Enum of Choice on MetricsResponse -var MetricsResponseChoice = struct { - FLOW_METRICS MetricsResponseChoiceEnum - PORT_METRICS MetricsResponseChoiceEnum - BGPV4_METRICS MetricsResponseChoiceEnum - BGPV6_METRICS MetricsResponseChoiceEnum - ISIS_METRICS MetricsResponseChoiceEnum - LAG_METRICS MetricsResponseChoiceEnum - LACP_METRICS MetricsResponseChoiceEnum - LLDP_METRICS MetricsResponseChoiceEnum - RSVP_METRICS MetricsResponseChoiceEnum - DHCPV4_CLIENT MetricsResponseChoiceEnum - DHCPV4_SERVER MetricsResponseChoiceEnum -}{ - FLOW_METRICS: MetricsResponseChoiceEnum("flow_metrics"), - PORT_METRICS: MetricsResponseChoiceEnum("port_metrics"), - BGPV4_METRICS: MetricsResponseChoiceEnum("bgpv4_metrics"), - BGPV6_METRICS: MetricsResponseChoiceEnum("bgpv6_metrics"), - ISIS_METRICS: MetricsResponseChoiceEnum("isis_metrics"), - LAG_METRICS: MetricsResponseChoiceEnum("lag_metrics"), - LACP_METRICS: MetricsResponseChoiceEnum("lacp_metrics"), - LLDP_METRICS: MetricsResponseChoiceEnum("lldp_metrics"), - RSVP_METRICS: MetricsResponseChoiceEnum("rsvp_metrics"), - DHCPV4_CLIENT: MetricsResponseChoiceEnum("dhcpv4_client"), - DHCPV4_SERVER: MetricsResponseChoiceEnum("dhcpv4_server"), -} - -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) -} - -// description is TBD -// Choice returns a string -func (obj *metricsResponse) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *metricsResponse) setChoice(value MetricsResponseChoiceEnum) MetricsResponse { - intValue, ok := otg.MetricsResponse_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on MetricsResponseChoiceEnum", string(value))) - return obj - } - enumValue := otg.MetricsResponse_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.RsvpMetrics = nil - obj.rsvpMetricsHolder = nil - obj.obj.LldpMetrics = nil - obj.lldpMetricsHolder = nil - obj.obj.LacpMetrics = nil - obj.lacpMetricsHolder = nil - obj.obj.LagMetrics = nil - obj.lagMetricsHolder = nil - obj.obj.IsisMetrics = nil - obj.isisMetricsHolder = nil - obj.obj.Bgpv6Metrics = nil - obj.bgpv6MetricsHolder = nil - obj.obj.Bgpv4Metrics = nil - obj.bgpv4MetricsHolder = nil - obj.obj.FlowMetrics = nil - obj.flowMetricsHolder = nil - obj.obj.PortMetrics = nil - obj.portMetricsHolder = nil - - if value == MetricsResponseChoice.PORT_METRICS { - obj.obj.PortMetrics = []*otg.PortMetric{} - } - - if value == MetricsResponseChoice.FLOW_METRICS { - obj.obj.FlowMetrics = []*otg.FlowMetric{} - } - - if value == MetricsResponseChoice.BGPV4_METRICS { - obj.obj.Bgpv4Metrics = []*otg.Bgpv4Metric{} - } - - if value == MetricsResponseChoice.BGPV6_METRICS { - obj.obj.Bgpv6Metrics = []*otg.Bgpv6Metric{} - } - - if value == MetricsResponseChoice.ISIS_METRICS { - obj.obj.IsisMetrics = []*otg.IsisMetric{} - } - - if value == MetricsResponseChoice.LAG_METRICS { - obj.obj.LagMetrics = []*otg.LagMetric{} - } - - if value == MetricsResponseChoice.LACP_METRICS { - obj.obj.LacpMetrics = []*otg.LacpMetric{} - } - - if value == MetricsResponseChoice.LLDP_METRICS { - obj.obj.LldpMetrics = []*otg.LldpMetric{} - } - - if value == MetricsResponseChoice.RSVP_METRICS { - obj.obj.RsvpMetrics = []*otg.RsvpMetric{} - } - - return obj -} - -// description is TBD -// PortMetrics returns a []PortMetric -func (obj *metricsResponse) PortMetrics() MetricsResponsePortMetricIter { - if len(obj.obj.PortMetrics) == 0 { - obj.setChoice(MetricsResponseChoice.PORT_METRICS) - } - if obj.portMetricsHolder == nil { - obj.portMetricsHolder = newMetricsResponsePortMetricIter(&obj.obj.PortMetrics).setMsg(obj) - } - return obj.portMetricsHolder -} - -type metricsResponsePortMetricIter struct { - obj *metricsResponse - portMetricSlice []PortMetric - fieldPtr *[]*otg.PortMetric -} - -func newMetricsResponsePortMetricIter(ptr *[]*otg.PortMetric) MetricsResponsePortMetricIter { - return &metricsResponsePortMetricIter{fieldPtr: ptr} -} - -type MetricsResponsePortMetricIter interface { - setMsg(*metricsResponse) MetricsResponsePortMetricIter - Items() []PortMetric - Add() PortMetric - Append(items ...PortMetric) MetricsResponsePortMetricIter - Set(index int, newObj PortMetric) MetricsResponsePortMetricIter - Clear() MetricsResponsePortMetricIter - clearHolderSlice() MetricsResponsePortMetricIter - appendHolderSlice(item PortMetric) MetricsResponsePortMetricIter -} - -func (obj *metricsResponsePortMetricIter) setMsg(msg *metricsResponse) MetricsResponsePortMetricIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&portMetric{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *metricsResponsePortMetricIter) Items() []PortMetric { - return obj.portMetricSlice -} - -func (obj *metricsResponsePortMetricIter) Add() PortMetric { - newObj := &otg.PortMetric{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &portMetric{obj: newObj} - newLibObj.setDefault() - obj.portMetricSlice = append(obj.portMetricSlice, newLibObj) - return newLibObj -} - -func (obj *metricsResponsePortMetricIter) Append(items ...PortMetric) MetricsResponsePortMetricIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.portMetricSlice = append(obj.portMetricSlice, item) - } - return obj -} - -func (obj *metricsResponsePortMetricIter) Set(index int, newObj PortMetric) MetricsResponsePortMetricIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.portMetricSlice[index] = newObj - return obj -} -func (obj *metricsResponsePortMetricIter) Clear() MetricsResponsePortMetricIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PortMetric{} - obj.portMetricSlice = []PortMetric{} - } - return obj -} -func (obj *metricsResponsePortMetricIter) clearHolderSlice() MetricsResponsePortMetricIter { - if len(obj.portMetricSlice) > 0 { - obj.portMetricSlice = []PortMetric{} - } - return obj -} -func (obj *metricsResponsePortMetricIter) appendHolderSlice(item PortMetric) MetricsResponsePortMetricIter { - obj.portMetricSlice = append(obj.portMetricSlice, item) - return obj -} - -// description is TBD -// FlowMetrics returns a []FlowMetric -func (obj *metricsResponse) FlowMetrics() MetricsResponseFlowMetricIter { - if len(obj.obj.FlowMetrics) == 0 { - obj.setChoice(MetricsResponseChoice.FLOW_METRICS) - } - if obj.flowMetricsHolder == nil { - obj.flowMetricsHolder = newMetricsResponseFlowMetricIter(&obj.obj.FlowMetrics).setMsg(obj) - } - return obj.flowMetricsHolder -} - -type metricsResponseFlowMetricIter struct { - obj *metricsResponse - flowMetricSlice []FlowMetric - fieldPtr *[]*otg.FlowMetric -} - -func newMetricsResponseFlowMetricIter(ptr *[]*otg.FlowMetric) MetricsResponseFlowMetricIter { - return &metricsResponseFlowMetricIter{fieldPtr: ptr} -} - -type MetricsResponseFlowMetricIter interface { - setMsg(*metricsResponse) MetricsResponseFlowMetricIter - Items() []FlowMetric - Add() FlowMetric - Append(items ...FlowMetric) MetricsResponseFlowMetricIter - Set(index int, newObj FlowMetric) MetricsResponseFlowMetricIter - Clear() MetricsResponseFlowMetricIter - clearHolderSlice() MetricsResponseFlowMetricIter - appendHolderSlice(item FlowMetric) MetricsResponseFlowMetricIter -} - -func (obj *metricsResponseFlowMetricIter) setMsg(msg *metricsResponse) MetricsResponseFlowMetricIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flowMetric{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *metricsResponseFlowMetricIter) Items() []FlowMetric { - return obj.flowMetricSlice -} - -func (obj *metricsResponseFlowMetricIter) Add() FlowMetric { - newObj := &otg.FlowMetric{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flowMetric{obj: newObj} - newLibObj.setDefault() - obj.flowMetricSlice = append(obj.flowMetricSlice, newLibObj) - return newLibObj -} - -func (obj *metricsResponseFlowMetricIter) Append(items ...FlowMetric) MetricsResponseFlowMetricIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowMetricSlice = append(obj.flowMetricSlice, item) - } - return obj -} - -func (obj *metricsResponseFlowMetricIter) Set(index int, newObj FlowMetric) MetricsResponseFlowMetricIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowMetricSlice[index] = newObj - return obj -} -func (obj *metricsResponseFlowMetricIter) Clear() MetricsResponseFlowMetricIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.FlowMetric{} - obj.flowMetricSlice = []FlowMetric{} - } - return obj -} -func (obj *metricsResponseFlowMetricIter) clearHolderSlice() MetricsResponseFlowMetricIter { - if len(obj.flowMetricSlice) > 0 { - obj.flowMetricSlice = []FlowMetric{} - } - return obj -} -func (obj *metricsResponseFlowMetricIter) appendHolderSlice(item FlowMetric) MetricsResponseFlowMetricIter { - obj.flowMetricSlice = append(obj.flowMetricSlice, item) - return obj -} - -// description is TBD -// Bgpv4Metrics returns a []Bgpv4Metric -func (obj *metricsResponse) Bgpv4Metrics() MetricsResponseBgpv4MetricIter { - if len(obj.obj.Bgpv4Metrics) == 0 { - obj.setChoice(MetricsResponseChoice.BGPV4_METRICS) - } - if obj.bgpv4MetricsHolder == nil { - obj.bgpv4MetricsHolder = newMetricsResponseBgpv4MetricIter(&obj.obj.Bgpv4Metrics).setMsg(obj) - } - return obj.bgpv4MetricsHolder -} - -type metricsResponseBgpv4MetricIter struct { - obj *metricsResponse - bgpv4MetricSlice []Bgpv4Metric - fieldPtr *[]*otg.Bgpv4Metric -} - -func newMetricsResponseBgpv4MetricIter(ptr *[]*otg.Bgpv4Metric) MetricsResponseBgpv4MetricIter { - return &metricsResponseBgpv4MetricIter{fieldPtr: ptr} -} - -type MetricsResponseBgpv4MetricIter interface { - setMsg(*metricsResponse) MetricsResponseBgpv4MetricIter - Items() []Bgpv4Metric - Add() Bgpv4Metric - Append(items ...Bgpv4Metric) MetricsResponseBgpv4MetricIter - Set(index int, newObj Bgpv4Metric) MetricsResponseBgpv4MetricIter - Clear() MetricsResponseBgpv4MetricIter - clearHolderSlice() MetricsResponseBgpv4MetricIter - appendHolderSlice(item Bgpv4Metric) MetricsResponseBgpv4MetricIter -} - -func (obj *metricsResponseBgpv4MetricIter) setMsg(msg *metricsResponse) MetricsResponseBgpv4MetricIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpv4Metric{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *metricsResponseBgpv4MetricIter) Items() []Bgpv4Metric { - return obj.bgpv4MetricSlice -} - -func (obj *metricsResponseBgpv4MetricIter) Add() Bgpv4Metric { - newObj := &otg.Bgpv4Metric{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpv4Metric{obj: newObj} - newLibObj.setDefault() - obj.bgpv4MetricSlice = append(obj.bgpv4MetricSlice, newLibObj) - return newLibObj -} - -func (obj *metricsResponseBgpv4MetricIter) Append(items ...Bgpv4Metric) MetricsResponseBgpv4MetricIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpv4MetricSlice = append(obj.bgpv4MetricSlice, item) - } - return obj -} - -func (obj *metricsResponseBgpv4MetricIter) Set(index int, newObj Bgpv4Metric) MetricsResponseBgpv4MetricIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpv4MetricSlice[index] = newObj - return obj -} -func (obj *metricsResponseBgpv4MetricIter) Clear() MetricsResponseBgpv4MetricIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Bgpv4Metric{} - obj.bgpv4MetricSlice = []Bgpv4Metric{} - } - return obj -} -func (obj *metricsResponseBgpv4MetricIter) clearHolderSlice() MetricsResponseBgpv4MetricIter { - if len(obj.bgpv4MetricSlice) > 0 { - obj.bgpv4MetricSlice = []Bgpv4Metric{} - } - return obj -} -func (obj *metricsResponseBgpv4MetricIter) appendHolderSlice(item Bgpv4Metric) MetricsResponseBgpv4MetricIter { - obj.bgpv4MetricSlice = append(obj.bgpv4MetricSlice, item) - return obj -} - -// description is TBD -// Bgpv6Metrics returns a []Bgpv6Metric -func (obj *metricsResponse) Bgpv6Metrics() MetricsResponseBgpv6MetricIter { - if len(obj.obj.Bgpv6Metrics) == 0 { - obj.setChoice(MetricsResponseChoice.BGPV6_METRICS) - } - if obj.bgpv6MetricsHolder == nil { - obj.bgpv6MetricsHolder = newMetricsResponseBgpv6MetricIter(&obj.obj.Bgpv6Metrics).setMsg(obj) - } - return obj.bgpv6MetricsHolder -} - -type metricsResponseBgpv6MetricIter struct { - obj *metricsResponse - bgpv6MetricSlice []Bgpv6Metric - fieldPtr *[]*otg.Bgpv6Metric -} - -func newMetricsResponseBgpv6MetricIter(ptr *[]*otg.Bgpv6Metric) MetricsResponseBgpv6MetricIter { - return &metricsResponseBgpv6MetricIter{fieldPtr: ptr} -} - -type MetricsResponseBgpv6MetricIter interface { - setMsg(*metricsResponse) MetricsResponseBgpv6MetricIter - Items() []Bgpv6Metric - Add() Bgpv6Metric - Append(items ...Bgpv6Metric) MetricsResponseBgpv6MetricIter - Set(index int, newObj Bgpv6Metric) MetricsResponseBgpv6MetricIter - Clear() MetricsResponseBgpv6MetricIter - clearHolderSlice() MetricsResponseBgpv6MetricIter - appendHolderSlice(item Bgpv6Metric) MetricsResponseBgpv6MetricIter -} - -func (obj *metricsResponseBgpv6MetricIter) setMsg(msg *metricsResponse) MetricsResponseBgpv6MetricIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpv6Metric{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *metricsResponseBgpv6MetricIter) Items() []Bgpv6Metric { - return obj.bgpv6MetricSlice -} - -func (obj *metricsResponseBgpv6MetricIter) Add() Bgpv6Metric { - newObj := &otg.Bgpv6Metric{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpv6Metric{obj: newObj} - newLibObj.setDefault() - obj.bgpv6MetricSlice = append(obj.bgpv6MetricSlice, newLibObj) - return newLibObj -} - -func (obj *metricsResponseBgpv6MetricIter) Append(items ...Bgpv6Metric) MetricsResponseBgpv6MetricIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpv6MetricSlice = append(obj.bgpv6MetricSlice, item) - } - return obj -} - -func (obj *metricsResponseBgpv6MetricIter) Set(index int, newObj Bgpv6Metric) MetricsResponseBgpv6MetricIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpv6MetricSlice[index] = newObj - return obj -} -func (obj *metricsResponseBgpv6MetricIter) Clear() MetricsResponseBgpv6MetricIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Bgpv6Metric{} - obj.bgpv6MetricSlice = []Bgpv6Metric{} - } - return obj -} -func (obj *metricsResponseBgpv6MetricIter) clearHolderSlice() MetricsResponseBgpv6MetricIter { - if len(obj.bgpv6MetricSlice) > 0 { - obj.bgpv6MetricSlice = []Bgpv6Metric{} - } - return obj -} -func (obj *metricsResponseBgpv6MetricIter) appendHolderSlice(item Bgpv6Metric) MetricsResponseBgpv6MetricIter { - obj.bgpv6MetricSlice = append(obj.bgpv6MetricSlice, item) - return obj -} - -// description is TBD -// IsisMetrics returns a []IsisMetric -func (obj *metricsResponse) IsisMetrics() MetricsResponseIsisMetricIter { - if len(obj.obj.IsisMetrics) == 0 { - obj.setChoice(MetricsResponseChoice.ISIS_METRICS) - } - if obj.isisMetricsHolder == nil { - obj.isisMetricsHolder = newMetricsResponseIsisMetricIter(&obj.obj.IsisMetrics).setMsg(obj) - } - return obj.isisMetricsHolder -} - -type metricsResponseIsisMetricIter struct { - obj *metricsResponse - isisMetricSlice []IsisMetric - fieldPtr *[]*otg.IsisMetric -} - -func newMetricsResponseIsisMetricIter(ptr *[]*otg.IsisMetric) MetricsResponseIsisMetricIter { - return &metricsResponseIsisMetricIter{fieldPtr: ptr} -} - -type MetricsResponseIsisMetricIter interface { - setMsg(*metricsResponse) MetricsResponseIsisMetricIter - Items() []IsisMetric - Add() IsisMetric - Append(items ...IsisMetric) MetricsResponseIsisMetricIter - Set(index int, newObj IsisMetric) MetricsResponseIsisMetricIter - Clear() MetricsResponseIsisMetricIter - clearHolderSlice() MetricsResponseIsisMetricIter - appendHolderSlice(item IsisMetric) MetricsResponseIsisMetricIter -} - -func (obj *metricsResponseIsisMetricIter) setMsg(msg *metricsResponse) MetricsResponseIsisMetricIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisMetric{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *metricsResponseIsisMetricIter) Items() []IsisMetric { - return obj.isisMetricSlice -} - -func (obj *metricsResponseIsisMetricIter) Add() IsisMetric { - newObj := &otg.IsisMetric{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisMetric{obj: newObj} - newLibObj.setDefault() - obj.isisMetricSlice = append(obj.isisMetricSlice, newLibObj) - return newLibObj -} - -func (obj *metricsResponseIsisMetricIter) Append(items ...IsisMetric) MetricsResponseIsisMetricIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisMetricSlice = append(obj.isisMetricSlice, item) - } - return obj -} - -func (obj *metricsResponseIsisMetricIter) Set(index int, newObj IsisMetric) MetricsResponseIsisMetricIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisMetricSlice[index] = newObj - return obj -} -func (obj *metricsResponseIsisMetricIter) Clear() MetricsResponseIsisMetricIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisMetric{} - obj.isisMetricSlice = []IsisMetric{} - } - return obj -} -func (obj *metricsResponseIsisMetricIter) clearHolderSlice() MetricsResponseIsisMetricIter { - if len(obj.isisMetricSlice) > 0 { - obj.isisMetricSlice = []IsisMetric{} - } - return obj -} -func (obj *metricsResponseIsisMetricIter) appendHolderSlice(item IsisMetric) MetricsResponseIsisMetricIter { - obj.isisMetricSlice = append(obj.isisMetricSlice, item) - return obj -} - -// description is TBD -// LagMetrics returns a []LagMetric -func (obj *metricsResponse) LagMetrics() MetricsResponseLagMetricIter { - if len(obj.obj.LagMetrics) == 0 { - obj.setChoice(MetricsResponseChoice.LAG_METRICS) - } - if obj.lagMetricsHolder == nil { - obj.lagMetricsHolder = newMetricsResponseLagMetricIter(&obj.obj.LagMetrics).setMsg(obj) - } - return obj.lagMetricsHolder -} - -type metricsResponseLagMetricIter struct { - obj *metricsResponse - lagMetricSlice []LagMetric - fieldPtr *[]*otg.LagMetric -} - -func newMetricsResponseLagMetricIter(ptr *[]*otg.LagMetric) MetricsResponseLagMetricIter { - return &metricsResponseLagMetricIter{fieldPtr: ptr} -} - -type MetricsResponseLagMetricIter interface { - setMsg(*metricsResponse) MetricsResponseLagMetricIter - Items() []LagMetric - Add() LagMetric - Append(items ...LagMetric) MetricsResponseLagMetricIter - Set(index int, newObj LagMetric) MetricsResponseLagMetricIter - Clear() MetricsResponseLagMetricIter - clearHolderSlice() MetricsResponseLagMetricIter - appendHolderSlice(item LagMetric) MetricsResponseLagMetricIter -} - -func (obj *metricsResponseLagMetricIter) setMsg(msg *metricsResponse) MetricsResponseLagMetricIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&lagMetric{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *metricsResponseLagMetricIter) Items() []LagMetric { - return obj.lagMetricSlice -} - -func (obj *metricsResponseLagMetricIter) Add() LagMetric { - newObj := &otg.LagMetric{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &lagMetric{obj: newObj} - newLibObj.setDefault() - obj.lagMetricSlice = append(obj.lagMetricSlice, newLibObj) - return newLibObj -} - -func (obj *metricsResponseLagMetricIter) Append(items ...LagMetric) MetricsResponseLagMetricIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.lagMetricSlice = append(obj.lagMetricSlice, item) - } - return obj -} - -func (obj *metricsResponseLagMetricIter) Set(index int, newObj LagMetric) MetricsResponseLagMetricIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.lagMetricSlice[index] = newObj - return obj -} -func (obj *metricsResponseLagMetricIter) Clear() MetricsResponseLagMetricIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.LagMetric{} - obj.lagMetricSlice = []LagMetric{} - } - return obj -} -func (obj *metricsResponseLagMetricIter) clearHolderSlice() MetricsResponseLagMetricIter { - if len(obj.lagMetricSlice) > 0 { - obj.lagMetricSlice = []LagMetric{} - } - return obj -} -func (obj *metricsResponseLagMetricIter) appendHolderSlice(item LagMetric) MetricsResponseLagMetricIter { - obj.lagMetricSlice = append(obj.lagMetricSlice, item) - return obj -} - -// description is TBD -// LacpMetrics returns a []LacpMetric -func (obj *metricsResponse) LacpMetrics() MetricsResponseLacpMetricIter { - if len(obj.obj.LacpMetrics) == 0 { - obj.setChoice(MetricsResponseChoice.LACP_METRICS) - } - if obj.lacpMetricsHolder == nil { - obj.lacpMetricsHolder = newMetricsResponseLacpMetricIter(&obj.obj.LacpMetrics).setMsg(obj) - } - return obj.lacpMetricsHolder -} - -type metricsResponseLacpMetricIter struct { - obj *metricsResponse - lacpMetricSlice []LacpMetric - fieldPtr *[]*otg.LacpMetric -} - -func newMetricsResponseLacpMetricIter(ptr *[]*otg.LacpMetric) MetricsResponseLacpMetricIter { - return &metricsResponseLacpMetricIter{fieldPtr: ptr} -} - -type MetricsResponseLacpMetricIter interface { - setMsg(*metricsResponse) MetricsResponseLacpMetricIter - Items() []LacpMetric - Add() LacpMetric - Append(items ...LacpMetric) MetricsResponseLacpMetricIter - Set(index int, newObj LacpMetric) MetricsResponseLacpMetricIter - Clear() MetricsResponseLacpMetricIter - clearHolderSlice() MetricsResponseLacpMetricIter - appendHolderSlice(item LacpMetric) MetricsResponseLacpMetricIter -} - -func (obj *metricsResponseLacpMetricIter) setMsg(msg *metricsResponse) MetricsResponseLacpMetricIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&lacpMetric{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *metricsResponseLacpMetricIter) Items() []LacpMetric { - return obj.lacpMetricSlice -} - -func (obj *metricsResponseLacpMetricIter) Add() LacpMetric { - newObj := &otg.LacpMetric{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &lacpMetric{obj: newObj} - newLibObj.setDefault() - obj.lacpMetricSlice = append(obj.lacpMetricSlice, newLibObj) - return newLibObj -} - -func (obj *metricsResponseLacpMetricIter) Append(items ...LacpMetric) MetricsResponseLacpMetricIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.lacpMetricSlice = append(obj.lacpMetricSlice, item) - } - return obj -} - -func (obj *metricsResponseLacpMetricIter) Set(index int, newObj LacpMetric) MetricsResponseLacpMetricIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.lacpMetricSlice[index] = newObj - return obj -} -func (obj *metricsResponseLacpMetricIter) Clear() MetricsResponseLacpMetricIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.LacpMetric{} - obj.lacpMetricSlice = []LacpMetric{} - } - return obj -} -func (obj *metricsResponseLacpMetricIter) clearHolderSlice() MetricsResponseLacpMetricIter { - if len(obj.lacpMetricSlice) > 0 { - obj.lacpMetricSlice = []LacpMetric{} - } - return obj -} -func (obj *metricsResponseLacpMetricIter) appendHolderSlice(item LacpMetric) MetricsResponseLacpMetricIter { - obj.lacpMetricSlice = append(obj.lacpMetricSlice, item) - return obj -} - -// description is TBD -// LldpMetrics returns a []LldpMetric -func (obj *metricsResponse) LldpMetrics() MetricsResponseLldpMetricIter { - if len(obj.obj.LldpMetrics) == 0 { - obj.setChoice(MetricsResponseChoice.LLDP_METRICS) - } - if obj.lldpMetricsHolder == nil { - obj.lldpMetricsHolder = newMetricsResponseLldpMetricIter(&obj.obj.LldpMetrics).setMsg(obj) - } - return obj.lldpMetricsHolder -} - -type metricsResponseLldpMetricIter struct { - obj *metricsResponse - lldpMetricSlice []LldpMetric - fieldPtr *[]*otg.LldpMetric -} - -func newMetricsResponseLldpMetricIter(ptr *[]*otg.LldpMetric) MetricsResponseLldpMetricIter { - return &metricsResponseLldpMetricIter{fieldPtr: ptr} -} - -type MetricsResponseLldpMetricIter interface { - setMsg(*metricsResponse) MetricsResponseLldpMetricIter - Items() []LldpMetric - Add() LldpMetric - Append(items ...LldpMetric) MetricsResponseLldpMetricIter - Set(index int, newObj LldpMetric) MetricsResponseLldpMetricIter - Clear() MetricsResponseLldpMetricIter - clearHolderSlice() MetricsResponseLldpMetricIter - appendHolderSlice(item LldpMetric) MetricsResponseLldpMetricIter -} - -func (obj *metricsResponseLldpMetricIter) setMsg(msg *metricsResponse) MetricsResponseLldpMetricIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&lldpMetric{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *metricsResponseLldpMetricIter) Items() []LldpMetric { - return obj.lldpMetricSlice -} - -func (obj *metricsResponseLldpMetricIter) Add() LldpMetric { - newObj := &otg.LldpMetric{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &lldpMetric{obj: newObj} - newLibObj.setDefault() - obj.lldpMetricSlice = append(obj.lldpMetricSlice, newLibObj) - return newLibObj -} - -func (obj *metricsResponseLldpMetricIter) Append(items ...LldpMetric) MetricsResponseLldpMetricIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.lldpMetricSlice = append(obj.lldpMetricSlice, item) - } - return obj -} - -func (obj *metricsResponseLldpMetricIter) Set(index int, newObj LldpMetric) MetricsResponseLldpMetricIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.lldpMetricSlice[index] = newObj - return obj -} -func (obj *metricsResponseLldpMetricIter) Clear() MetricsResponseLldpMetricIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.LldpMetric{} - obj.lldpMetricSlice = []LldpMetric{} - } - return obj -} -func (obj *metricsResponseLldpMetricIter) clearHolderSlice() MetricsResponseLldpMetricIter { - if len(obj.lldpMetricSlice) > 0 { - obj.lldpMetricSlice = []LldpMetric{} - } - return obj -} -func (obj *metricsResponseLldpMetricIter) appendHolderSlice(item LldpMetric) MetricsResponseLldpMetricIter { - obj.lldpMetricSlice = append(obj.lldpMetricSlice, item) - return obj -} - -// description is TBD -// RsvpMetrics returns a []RsvpMetric -func (obj *metricsResponse) RsvpMetrics() MetricsResponseRsvpMetricIter { - if len(obj.obj.RsvpMetrics) == 0 { - obj.setChoice(MetricsResponseChoice.RSVP_METRICS) - } - if obj.rsvpMetricsHolder == nil { - obj.rsvpMetricsHolder = newMetricsResponseRsvpMetricIter(&obj.obj.RsvpMetrics).setMsg(obj) - } - return obj.rsvpMetricsHolder -} - -type metricsResponseRsvpMetricIter struct { - obj *metricsResponse - rsvpMetricSlice []RsvpMetric - fieldPtr *[]*otg.RsvpMetric -} - -func newMetricsResponseRsvpMetricIter(ptr *[]*otg.RsvpMetric) MetricsResponseRsvpMetricIter { - return &metricsResponseRsvpMetricIter{fieldPtr: ptr} -} - -type MetricsResponseRsvpMetricIter interface { - setMsg(*metricsResponse) MetricsResponseRsvpMetricIter - Items() []RsvpMetric - Add() RsvpMetric - Append(items ...RsvpMetric) MetricsResponseRsvpMetricIter - Set(index int, newObj RsvpMetric) MetricsResponseRsvpMetricIter - Clear() MetricsResponseRsvpMetricIter - clearHolderSlice() MetricsResponseRsvpMetricIter - appendHolderSlice(item RsvpMetric) MetricsResponseRsvpMetricIter -} - -func (obj *metricsResponseRsvpMetricIter) setMsg(msg *metricsResponse) MetricsResponseRsvpMetricIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&rsvpMetric{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *metricsResponseRsvpMetricIter) Items() []RsvpMetric { - return obj.rsvpMetricSlice -} - -func (obj *metricsResponseRsvpMetricIter) Add() RsvpMetric { - newObj := &otg.RsvpMetric{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &rsvpMetric{obj: newObj} - newLibObj.setDefault() - obj.rsvpMetricSlice = append(obj.rsvpMetricSlice, newLibObj) - return newLibObj -} - -func (obj *metricsResponseRsvpMetricIter) Append(items ...RsvpMetric) MetricsResponseRsvpMetricIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.rsvpMetricSlice = append(obj.rsvpMetricSlice, item) - } - return obj -} - -func (obj *metricsResponseRsvpMetricIter) Set(index int, newObj RsvpMetric) MetricsResponseRsvpMetricIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.rsvpMetricSlice[index] = newObj - return obj -} -func (obj *metricsResponseRsvpMetricIter) Clear() MetricsResponseRsvpMetricIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.RsvpMetric{} - obj.rsvpMetricSlice = []RsvpMetric{} - } - return obj -} -func (obj *metricsResponseRsvpMetricIter) clearHolderSlice() MetricsResponseRsvpMetricIter { - if len(obj.rsvpMetricSlice) > 0 { - obj.rsvpMetricSlice = []RsvpMetric{} - } - return obj -} -func (obj *metricsResponseRsvpMetricIter) appendHolderSlice(item RsvpMetric) MetricsResponseRsvpMetricIter { - obj.rsvpMetricSlice = append(obj.rsvpMetricSlice, item) - return obj -} - -// description is TBD -// Dhcpv4ClientMetrics returns a []Dhcpv4ClientMetric -func (obj *metricsResponse) Dhcpv4ClientMetrics() MetricsResponseDhcpv4ClientMetricIter { - if len(obj.obj.Dhcpv4ClientMetrics) == 0 { - obj.obj.Dhcpv4ClientMetrics = []*otg.Dhcpv4ClientMetric{} - } - if obj.dhcpv4ClientMetricsHolder == nil { - obj.dhcpv4ClientMetricsHolder = newMetricsResponseDhcpv4ClientMetricIter(&obj.obj.Dhcpv4ClientMetrics).setMsg(obj) - } - return obj.dhcpv4ClientMetricsHolder -} - -type metricsResponseDhcpv4ClientMetricIter struct { - obj *metricsResponse - dhcpv4ClientMetricSlice []Dhcpv4ClientMetric - fieldPtr *[]*otg.Dhcpv4ClientMetric -} - -func newMetricsResponseDhcpv4ClientMetricIter(ptr *[]*otg.Dhcpv4ClientMetric) MetricsResponseDhcpv4ClientMetricIter { - return &metricsResponseDhcpv4ClientMetricIter{fieldPtr: ptr} -} - -type MetricsResponseDhcpv4ClientMetricIter interface { - setMsg(*metricsResponse) MetricsResponseDhcpv4ClientMetricIter - Items() []Dhcpv4ClientMetric - Add() Dhcpv4ClientMetric - Append(items ...Dhcpv4ClientMetric) MetricsResponseDhcpv4ClientMetricIter - Set(index int, newObj Dhcpv4ClientMetric) MetricsResponseDhcpv4ClientMetricIter - Clear() MetricsResponseDhcpv4ClientMetricIter - clearHolderSlice() MetricsResponseDhcpv4ClientMetricIter - appendHolderSlice(item Dhcpv4ClientMetric) MetricsResponseDhcpv4ClientMetricIter -} - -func (obj *metricsResponseDhcpv4ClientMetricIter) setMsg(msg *metricsResponse) MetricsResponseDhcpv4ClientMetricIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&dhcpv4ClientMetric{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *metricsResponseDhcpv4ClientMetricIter) Items() []Dhcpv4ClientMetric { - return obj.dhcpv4ClientMetricSlice -} - -func (obj *metricsResponseDhcpv4ClientMetricIter) Add() Dhcpv4ClientMetric { - newObj := &otg.Dhcpv4ClientMetric{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &dhcpv4ClientMetric{obj: newObj} - newLibObj.setDefault() - obj.dhcpv4ClientMetricSlice = append(obj.dhcpv4ClientMetricSlice, newLibObj) - return newLibObj -} - -func (obj *metricsResponseDhcpv4ClientMetricIter) Append(items ...Dhcpv4ClientMetric) MetricsResponseDhcpv4ClientMetricIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.dhcpv4ClientMetricSlice = append(obj.dhcpv4ClientMetricSlice, item) - } - return obj -} - -func (obj *metricsResponseDhcpv4ClientMetricIter) Set(index int, newObj Dhcpv4ClientMetric) MetricsResponseDhcpv4ClientMetricIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.dhcpv4ClientMetricSlice[index] = newObj - return obj -} -func (obj *metricsResponseDhcpv4ClientMetricIter) Clear() MetricsResponseDhcpv4ClientMetricIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Dhcpv4ClientMetric{} - obj.dhcpv4ClientMetricSlice = []Dhcpv4ClientMetric{} - } - return obj -} -func (obj *metricsResponseDhcpv4ClientMetricIter) clearHolderSlice() MetricsResponseDhcpv4ClientMetricIter { - if len(obj.dhcpv4ClientMetricSlice) > 0 { - obj.dhcpv4ClientMetricSlice = []Dhcpv4ClientMetric{} - } - return obj -} -func (obj *metricsResponseDhcpv4ClientMetricIter) appendHolderSlice(item Dhcpv4ClientMetric) MetricsResponseDhcpv4ClientMetricIter { - obj.dhcpv4ClientMetricSlice = append(obj.dhcpv4ClientMetricSlice, item) - return obj -} - -// description is TBD -// Dhcpv4ServerMetrics returns a []Dhcpv4ServerMetric -func (obj *metricsResponse) Dhcpv4ServerMetrics() MetricsResponseDhcpv4ServerMetricIter { - if len(obj.obj.Dhcpv4ServerMetrics) == 0 { - obj.obj.Dhcpv4ServerMetrics = []*otg.Dhcpv4ServerMetric{} - } - if obj.dhcpv4ServerMetricsHolder == nil { - obj.dhcpv4ServerMetricsHolder = newMetricsResponseDhcpv4ServerMetricIter(&obj.obj.Dhcpv4ServerMetrics).setMsg(obj) - } - return obj.dhcpv4ServerMetricsHolder -} - -type metricsResponseDhcpv4ServerMetricIter struct { - obj *metricsResponse - dhcpv4ServerMetricSlice []Dhcpv4ServerMetric - fieldPtr *[]*otg.Dhcpv4ServerMetric -} - -func newMetricsResponseDhcpv4ServerMetricIter(ptr *[]*otg.Dhcpv4ServerMetric) MetricsResponseDhcpv4ServerMetricIter { - return &metricsResponseDhcpv4ServerMetricIter{fieldPtr: ptr} -} - -type MetricsResponseDhcpv4ServerMetricIter interface { - setMsg(*metricsResponse) MetricsResponseDhcpv4ServerMetricIter - Items() []Dhcpv4ServerMetric - Add() Dhcpv4ServerMetric - Append(items ...Dhcpv4ServerMetric) MetricsResponseDhcpv4ServerMetricIter - Set(index int, newObj Dhcpv4ServerMetric) MetricsResponseDhcpv4ServerMetricIter - Clear() MetricsResponseDhcpv4ServerMetricIter - clearHolderSlice() MetricsResponseDhcpv4ServerMetricIter - appendHolderSlice(item Dhcpv4ServerMetric) MetricsResponseDhcpv4ServerMetricIter -} - -func (obj *metricsResponseDhcpv4ServerMetricIter) setMsg(msg *metricsResponse) MetricsResponseDhcpv4ServerMetricIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&dhcpv4ServerMetric{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *metricsResponseDhcpv4ServerMetricIter) Items() []Dhcpv4ServerMetric { - return obj.dhcpv4ServerMetricSlice -} - -func (obj *metricsResponseDhcpv4ServerMetricIter) Add() Dhcpv4ServerMetric { - newObj := &otg.Dhcpv4ServerMetric{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &dhcpv4ServerMetric{obj: newObj} - newLibObj.setDefault() - obj.dhcpv4ServerMetricSlice = append(obj.dhcpv4ServerMetricSlice, newLibObj) - return newLibObj -} - -func (obj *metricsResponseDhcpv4ServerMetricIter) Append(items ...Dhcpv4ServerMetric) MetricsResponseDhcpv4ServerMetricIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.dhcpv4ServerMetricSlice = append(obj.dhcpv4ServerMetricSlice, item) - } - return obj -} - -func (obj *metricsResponseDhcpv4ServerMetricIter) Set(index int, newObj Dhcpv4ServerMetric) MetricsResponseDhcpv4ServerMetricIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.dhcpv4ServerMetricSlice[index] = newObj - return obj -} -func (obj *metricsResponseDhcpv4ServerMetricIter) Clear() MetricsResponseDhcpv4ServerMetricIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Dhcpv4ServerMetric{} - obj.dhcpv4ServerMetricSlice = []Dhcpv4ServerMetric{} - } - return obj -} -func (obj *metricsResponseDhcpv4ServerMetricIter) clearHolderSlice() MetricsResponseDhcpv4ServerMetricIter { - if len(obj.dhcpv4ServerMetricSlice) > 0 { - obj.dhcpv4ServerMetricSlice = []Dhcpv4ServerMetric{} - } - return obj -} -func (obj *metricsResponseDhcpv4ServerMetricIter) appendHolderSlice(item Dhcpv4ServerMetric) MetricsResponseDhcpv4ServerMetricIter { - obj.dhcpv4ServerMetricSlice = append(obj.dhcpv4ServerMetricSlice, item) - return obj -} - -func (obj *metricsResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.PortMetrics) != 0 { - - if set_default { - obj.PortMetrics().clearHolderSlice() - for _, item := range obj.obj.PortMetrics { - obj.PortMetrics().appendHolderSlice(&portMetric{obj: item}) - } - } - for _, item := range obj.PortMetrics().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.FlowMetrics) != 0 { - - if set_default { - obj.FlowMetrics().clearHolderSlice() - for _, item := range obj.obj.FlowMetrics { - obj.FlowMetrics().appendHolderSlice(&flowMetric{obj: item}) - } - } - for _, item := range obj.FlowMetrics().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Bgpv4Metrics) != 0 { - - if set_default { - obj.Bgpv4Metrics().clearHolderSlice() - for _, item := range obj.obj.Bgpv4Metrics { - obj.Bgpv4Metrics().appendHolderSlice(&bgpv4Metric{obj: item}) - } - } - for _, item := range obj.Bgpv4Metrics().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Bgpv6Metrics) != 0 { - - if set_default { - obj.Bgpv6Metrics().clearHolderSlice() - for _, item := range obj.obj.Bgpv6Metrics { - obj.Bgpv6Metrics().appendHolderSlice(&bgpv6Metric{obj: item}) - } - } - for _, item := range obj.Bgpv6Metrics().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.IsisMetrics) != 0 { - - if set_default { - obj.IsisMetrics().clearHolderSlice() - for _, item := range obj.obj.IsisMetrics { - obj.IsisMetrics().appendHolderSlice(&isisMetric{obj: item}) - } - } - for _, item := range obj.IsisMetrics().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.LagMetrics) != 0 { - - if set_default { - obj.LagMetrics().clearHolderSlice() - for _, item := range obj.obj.LagMetrics { - obj.LagMetrics().appendHolderSlice(&lagMetric{obj: item}) - } - } - for _, item := range obj.LagMetrics().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.LacpMetrics) != 0 { - - if set_default { - obj.LacpMetrics().clearHolderSlice() - for _, item := range obj.obj.LacpMetrics { - obj.LacpMetrics().appendHolderSlice(&lacpMetric{obj: item}) - } - } - for _, item := range obj.LacpMetrics().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.LldpMetrics) != 0 { - - if set_default { - obj.LldpMetrics().clearHolderSlice() - for _, item := range obj.obj.LldpMetrics { - obj.LldpMetrics().appendHolderSlice(&lldpMetric{obj: item}) - } - } - for _, item := range obj.LldpMetrics().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.RsvpMetrics) != 0 { - - if set_default { - obj.RsvpMetrics().clearHolderSlice() - for _, item := range obj.obj.RsvpMetrics { - obj.RsvpMetrics().appendHolderSlice(&rsvpMetric{obj: item}) - } - } - for _, item := range obj.RsvpMetrics().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Dhcpv4ClientMetrics) != 0 { - - if set_default { - obj.Dhcpv4ClientMetrics().clearHolderSlice() - for _, item := range obj.obj.Dhcpv4ClientMetrics { - obj.Dhcpv4ClientMetrics().appendHolderSlice(&dhcpv4ClientMetric{obj: item}) - } - } - for _, item := range obj.Dhcpv4ClientMetrics().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Dhcpv4ServerMetrics) != 0 { - - if set_default { - obj.Dhcpv4ServerMetrics().clearHolderSlice() - for _, item := range obj.obj.Dhcpv4ServerMetrics { - obj.Dhcpv4ServerMetrics().appendHolderSlice(&dhcpv4ServerMetric{obj: item}) - } - } - for _, item := range obj.Dhcpv4ServerMetrics().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *metricsResponse) setDefault() { - var choices_set int = 0 - var choice MetricsResponseChoiceEnum - - if len(obj.obj.FlowMetrics) > 0 { - choices_set += 1 - choice = MetricsResponseChoice.FLOW_METRICS - } - - if len(obj.obj.PortMetrics) > 0 { - choices_set += 1 - choice = MetricsResponseChoice.PORT_METRICS - } - - if len(obj.obj.Bgpv4Metrics) > 0 { - choices_set += 1 - choice = MetricsResponseChoice.BGPV4_METRICS - } - - if len(obj.obj.Bgpv6Metrics) > 0 { - choices_set += 1 - choice = MetricsResponseChoice.BGPV6_METRICS - } - - if len(obj.obj.IsisMetrics) > 0 { - choices_set += 1 - choice = MetricsResponseChoice.ISIS_METRICS - } - - if len(obj.obj.LagMetrics) > 0 { - choices_set += 1 - choice = MetricsResponseChoice.LAG_METRICS - } - - if len(obj.obj.LacpMetrics) > 0 { - choices_set += 1 - choice = MetricsResponseChoice.LACP_METRICS - } - - if len(obj.obj.LldpMetrics) > 0 { - choices_set += 1 - choice = MetricsResponseChoice.LLDP_METRICS - } - - if len(obj.obj.RsvpMetrics) > 0 { - choices_set += 1 - choice = MetricsResponseChoice.RSVP_METRICS - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(MetricsResponseChoice.PORT_METRICS) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in MetricsResponse") - } - } else { - intVal := otg.MetricsResponse_Choice_Enum_value[string(choice)] - enumValue := otg.MetricsResponse_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** StatesResponse ***** -type statesResponse struct { - validation - obj *otg.StatesResponse - marshaller marshalStatesResponse - unMarshaller unMarshalStatesResponse - ipv4NeighborsHolder StatesResponseNeighborsv4StateIter - ipv6NeighborsHolder StatesResponseNeighborsv6StateIter - bgpPrefixesHolder StatesResponseBgpPrefixesStateIter - isisLspsHolder StatesResponseIsisLspsStateIter - lldpNeighborsHolder StatesResponseLldpNeighborsStateIter - rsvpLspsHolder StatesResponseRsvpLspsStateIter - dhcpv4InterfacesHolder StatesResponseDhcpv4InterfaceStateIter - dhcpv4LeasesHolder StatesResponseDhcpv4LeasesStateIter -} - -func NewStatesResponse() StatesResponse { - obj := statesResponse{obj: &otg.StatesResponse{}} - obj.setDefault() - return &obj -} - -func (obj *statesResponse) msg() *otg.StatesResponse { - return obj.obj -} - -func (obj *statesResponse) setMsg(msg *otg.StatesResponse) StatesResponse { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstatesResponse struct { - obj *statesResponse -} - -type marshalStatesResponse interface { - // ToProto marshals StatesResponse to protobuf object *otg.StatesResponse - ToProto() (*otg.StatesResponse, error) - // ToPbText marshals StatesResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals StatesResponse to YAML text - ToYaml() (string, error) - // ToJson marshals StatesResponse to JSON text - ToJson() (string, error) -} - -type unMarshalstatesResponse struct { - obj *statesResponse -} - -type unMarshalStatesResponse interface { - // FromProto unmarshals StatesResponse from protobuf object *otg.StatesResponse - FromProto(msg *otg.StatesResponse) (StatesResponse, error) - // FromPbText unmarshals StatesResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StatesResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals StatesResponse from JSON text - FromJson(value string) error -} - -func (obj *statesResponse) Marshal() marshalStatesResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalstatesResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *statesResponse) Unmarshal() unMarshalStatesResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstatesResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstatesResponse) ToProto() (*otg.StatesResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstatesResponse) FromProto(msg *otg.StatesResponse) (StatesResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstatesResponse) 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 *unMarshalstatesResponse) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalstatesResponse) 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 *unMarshalstatesResponse) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalstatesResponse) 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 *unMarshalstatesResponse) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *statesResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *statesResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *statesResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *statesResponse) Clone() (StatesResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStatesResponse() - 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 -} - -func (obj *statesResponse) setNil() { - obj.ipv4NeighborsHolder = nil - obj.ipv6NeighborsHolder = nil - obj.bgpPrefixesHolder = nil - obj.isisLspsHolder = nil - obj.lldpNeighborsHolder = nil - obj.rsvpLspsHolder = nil - obj.dhcpv4InterfacesHolder = nil - obj.dhcpv4LeasesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// StatesResponse is response containing chosen traffic generator states -type StatesResponse interface { - Validation - // msg marshals StatesResponse to protobuf object *otg.StatesResponse - // and doesn't set defaults - msg() *otg.StatesResponse - // setMsg unmarshals StatesResponse from protobuf object *otg.StatesResponse - // and doesn't set defaults - setMsg(*otg.StatesResponse) StatesResponse - // provides marshal interface - Marshal() marshalStatesResponse - // provides unmarshal interface - Unmarshal() unMarshalStatesResponse - // validate validates StatesResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StatesResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns StatesResponseChoiceEnum, set in StatesResponse - Choice() StatesResponseChoiceEnum - // setChoice assigns StatesResponseChoiceEnum provided by user to StatesResponse - setChoice(value StatesResponseChoiceEnum) StatesResponse - // HasChoice checks if Choice has been set in StatesResponse - HasChoice() bool - // Ipv4Neighbors returns StatesResponseNeighborsv4StateIterIter, set in StatesResponse - Ipv4Neighbors() StatesResponseNeighborsv4StateIter - // Ipv6Neighbors returns StatesResponseNeighborsv6StateIterIter, set in StatesResponse - Ipv6Neighbors() StatesResponseNeighborsv6StateIter - // BgpPrefixes returns StatesResponseBgpPrefixesStateIterIter, set in StatesResponse - BgpPrefixes() StatesResponseBgpPrefixesStateIter - // IsisLsps returns StatesResponseIsisLspsStateIterIter, set in StatesResponse - IsisLsps() StatesResponseIsisLspsStateIter - // LldpNeighbors returns StatesResponseLldpNeighborsStateIterIter, set in StatesResponse - LldpNeighbors() StatesResponseLldpNeighborsStateIter - // RsvpLsps returns StatesResponseRsvpLspsStateIterIter, set in StatesResponse - RsvpLsps() StatesResponseRsvpLspsStateIter - // Dhcpv4Interfaces returns StatesResponseDhcpv4InterfaceStateIterIter, set in StatesResponse - Dhcpv4Interfaces() StatesResponseDhcpv4InterfaceStateIter - // Dhcpv4Leases returns StatesResponseDhcpv4LeasesStateIterIter, set in StatesResponse - Dhcpv4Leases() StatesResponseDhcpv4LeasesStateIter - setNil() -} - -type StatesResponseChoiceEnum string - -// Enum of Choice on StatesResponse -var StatesResponseChoice = struct { - IPV4_NEIGHBORS StatesResponseChoiceEnum - IPV6_NEIGHBORS StatesResponseChoiceEnum - BGP_PREFIXES StatesResponseChoiceEnum - ISIS_LSPS StatesResponseChoiceEnum - LLDP_NEIGHBORS StatesResponseChoiceEnum - RSVP_LSPS StatesResponseChoiceEnum - DHCPV4_INTERFACES StatesResponseChoiceEnum - DHCPV4_LEASES StatesResponseChoiceEnum -}{ - IPV4_NEIGHBORS: StatesResponseChoiceEnum("ipv4_neighbors"), - IPV6_NEIGHBORS: StatesResponseChoiceEnum("ipv6_neighbors"), - BGP_PREFIXES: StatesResponseChoiceEnum("bgp_prefixes"), - ISIS_LSPS: StatesResponseChoiceEnum("isis_lsps"), - LLDP_NEIGHBORS: StatesResponseChoiceEnum("lldp_neighbors"), - RSVP_LSPS: StatesResponseChoiceEnum("rsvp_lsps"), - DHCPV4_INTERFACES: StatesResponseChoiceEnum("dhcpv4_interfaces"), - DHCPV4_LEASES: StatesResponseChoiceEnum("dhcpv4_leases"), -} - -func (obj *statesResponse) Choice() StatesResponseChoiceEnum { - return StatesResponseChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *statesResponse) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *statesResponse) setChoice(value StatesResponseChoiceEnum) StatesResponse { - intValue, ok := otg.StatesResponse_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StatesResponseChoiceEnum", string(value))) - return obj - } - enumValue := otg.StatesResponse_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Dhcpv4Leases = nil - obj.dhcpv4LeasesHolder = nil - obj.obj.Dhcpv4Interfaces = nil - obj.dhcpv4InterfacesHolder = nil - obj.obj.RsvpLsps = nil - obj.rsvpLspsHolder = nil - obj.obj.LldpNeighbors = nil - obj.lldpNeighborsHolder = nil - obj.obj.IsisLsps = nil - obj.isisLspsHolder = nil - obj.obj.BgpPrefixes = nil - obj.bgpPrefixesHolder = nil - obj.obj.Ipv6Neighbors = nil - obj.ipv6NeighborsHolder = nil - obj.obj.Ipv4Neighbors = nil - obj.ipv4NeighborsHolder = nil - - if value == StatesResponseChoice.IPV4_NEIGHBORS { - obj.obj.Ipv4Neighbors = []*otg.Neighborsv4State{} - } - - if value == StatesResponseChoice.IPV6_NEIGHBORS { - obj.obj.Ipv6Neighbors = []*otg.Neighborsv6State{} - } - - if value == StatesResponseChoice.BGP_PREFIXES { - obj.obj.BgpPrefixes = []*otg.BgpPrefixesState{} - } - - if value == StatesResponseChoice.ISIS_LSPS { - obj.obj.IsisLsps = []*otg.IsisLspsState{} - } - - if value == StatesResponseChoice.LLDP_NEIGHBORS { - obj.obj.LldpNeighbors = []*otg.LldpNeighborsState{} - } - - if value == StatesResponseChoice.RSVP_LSPS { - obj.obj.RsvpLsps = []*otg.RsvpLspsState{} - } - - if value == StatesResponseChoice.DHCPV4_INTERFACES { - obj.obj.Dhcpv4Interfaces = []*otg.Dhcpv4InterfaceState{} - } - - if value == StatesResponseChoice.DHCPV4_LEASES { - obj.obj.Dhcpv4Leases = []*otg.Dhcpv4LeasesState{} - } - - return obj -} - -// description is TBD -// Ipv4Neighbors returns a []Neighborsv4State -func (obj *statesResponse) Ipv4Neighbors() StatesResponseNeighborsv4StateIter { - if len(obj.obj.Ipv4Neighbors) == 0 { - obj.setChoice(StatesResponseChoice.IPV4_NEIGHBORS) - } - if obj.ipv4NeighborsHolder == nil { - obj.ipv4NeighborsHolder = newStatesResponseNeighborsv4StateIter(&obj.obj.Ipv4Neighbors).setMsg(obj) - } - return obj.ipv4NeighborsHolder -} - -type statesResponseNeighborsv4StateIter struct { - obj *statesResponse - neighborsv4StateSlice []Neighborsv4State - fieldPtr *[]*otg.Neighborsv4State -} - -func newStatesResponseNeighborsv4StateIter(ptr *[]*otg.Neighborsv4State) StatesResponseNeighborsv4StateIter { - return &statesResponseNeighborsv4StateIter{fieldPtr: ptr} -} - -type StatesResponseNeighborsv4StateIter interface { - setMsg(*statesResponse) StatesResponseNeighborsv4StateIter - Items() []Neighborsv4State - Add() Neighborsv4State - Append(items ...Neighborsv4State) StatesResponseNeighborsv4StateIter - Set(index int, newObj Neighborsv4State) StatesResponseNeighborsv4StateIter - Clear() StatesResponseNeighborsv4StateIter - clearHolderSlice() StatesResponseNeighborsv4StateIter - appendHolderSlice(item Neighborsv4State) StatesResponseNeighborsv4StateIter -} - -func (obj *statesResponseNeighborsv4StateIter) setMsg(msg *statesResponse) StatesResponseNeighborsv4StateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&neighborsv4State{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *statesResponseNeighborsv4StateIter) Items() []Neighborsv4State { - return obj.neighborsv4StateSlice -} - -func (obj *statesResponseNeighborsv4StateIter) Add() Neighborsv4State { - newObj := &otg.Neighborsv4State{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &neighborsv4State{obj: newObj} - newLibObj.setDefault() - obj.neighborsv4StateSlice = append(obj.neighborsv4StateSlice, newLibObj) - return newLibObj -} - -func (obj *statesResponseNeighborsv4StateIter) Append(items ...Neighborsv4State) StatesResponseNeighborsv4StateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.neighborsv4StateSlice = append(obj.neighborsv4StateSlice, item) - } - return obj -} - -func (obj *statesResponseNeighborsv4StateIter) Set(index int, newObj Neighborsv4State) StatesResponseNeighborsv4StateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.neighborsv4StateSlice[index] = newObj - return obj -} -func (obj *statesResponseNeighborsv4StateIter) Clear() StatesResponseNeighborsv4StateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Neighborsv4State{} - obj.neighborsv4StateSlice = []Neighborsv4State{} - } - return obj -} -func (obj *statesResponseNeighborsv4StateIter) clearHolderSlice() StatesResponseNeighborsv4StateIter { - if len(obj.neighborsv4StateSlice) > 0 { - obj.neighborsv4StateSlice = []Neighborsv4State{} - } - return obj -} -func (obj *statesResponseNeighborsv4StateIter) appendHolderSlice(item Neighborsv4State) StatesResponseNeighborsv4StateIter { - obj.neighborsv4StateSlice = append(obj.neighborsv4StateSlice, item) - return obj -} - -// description is TBD -// Ipv6Neighbors returns a []Neighborsv6State -func (obj *statesResponse) Ipv6Neighbors() StatesResponseNeighborsv6StateIter { - if len(obj.obj.Ipv6Neighbors) == 0 { - obj.setChoice(StatesResponseChoice.IPV6_NEIGHBORS) - } - if obj.ipv6NeighborsHolder == nil { - obj.ipv6NeighborsHolder = newStatesResponseNeighborsv6StateIter(&obj.obj.Ipv6Neighbors).setMsg(obj) - } - return obj.ipv6NeighborsHolder -} - -type statesResponseNeighborsv6StateIter struct { - obj *statesResponse - neighborsv6StateSlice []Neighborsv6State - fieldPtr *[]*otg.Neighborsv6State -} - -func newStatesResponseNeighborsv6StateIter(ptr *[]*otg.Neighborsv6State) StatesResponseNeighborsv6StateIter { - return &statesResponseNeighborsv6StateIter{fieldPtr: ptr} -} - -type StatesResponseNeighborsv6StateIter interface { - setMsg(*statesResponse) StatesResponseNeighborsv6StateIter - Items() []Neighborsv6State - Add() Neighborsv6State - Append(items ...Neighborsv6State) StatesResponseNeighborsv6StateIter - Set(index int, newObj Neighborsv6State) StatesResponseNeighborsv6StateIter - Clear() StatesResponseNeighborsv6StateIter - clearHolderSlice() StatesResponseNeighborsv6StateIter - appendHolderSlice(item Neighborsv6State) StatesResponseNeighborsv6StateIter -} - -func (obj *statesResponseNeighborsv6StateIter) setMsg(msg *statesResponse) StatesResponseNeighborsv6StateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&neighborsv6State{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *statesResponseNeighborsv6StateIter) Items() []Neighborsv6State { - return obj.neighborsv6StateSlice -} - -func (obj *statesResponseNeighborsv6StateIter) Add() Neighborsv6State { - newObj := &otg.Neighborsv6State{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &neighborsv6State{obj: newObj} - newLibObj.setDefault() - obj.neighborsv6StateSlice = append(obj.neighborsv6StateSlice, newLibObj) - return newLibObj -} - -func (obj *statesResponseNeighborsv6StateIter) Append(items ...Neighborsv6State) StatesResponseNeighborsv6StateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.neighborsv6StateSlice = append(obj.neighborsv6StateSlice, item) - } - return obj -} - -func (obj *statesResponseNeighborsv6StateIter) Set(index int, newObj Neighborsv6State) StatesResponseNeighborsv6StateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.neighborsv6StateSlice[index] = newObj - return obj -} -func (obj *statesResponseNeighborsv6StateIter) Clear() StatesResponseNeighborsv6StateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Neighborsv6State{} - obj.neighborsv6StateSlice = []Neighborsv6State{} - } - return obj -} -func (obj *statesResponseNeighborsv6StateIter) clearHolderSlice() StatesResponseNeighborsv6StateIter { - if len(obj.neighborsv6StateSlice) > 0 { - obj.neighborsv6StateSlice = []Neighborsv6State{} - } - return obj -} -func (obj *statesResponseNeighborsv6StateIter) appendHolderSlice(item Neighborsv6State) StatesResponseNeighborsv6StateIter { - obj.neighborsv6StateSlice = append(obj.neighborsv6StateSlice, item) - return obj -} - -// description is TBD -// BgpPrefixes returns a []BgpPrefixesState -func (obj *statesResponse) BgpPrefixes() StatesResponseBgpPrefixesStateIter { - if len(obj.obj.BgpPrefixes) == 0 { - obj.setChoice(StatesResponseChoice.BGP_PREFIXES) - } - if obj.bgpPrefixesHolder == nil { - obj.bgpPrefixesHolder = newStatesResponseBgpPrefixesStateIter(&obj.obj.BgpPrefixes).setMsg(obj) - } - return obj.bgpPrefixesHolder -} - -type statesResponseBgpPrefixesStateIter struct { - obj *statesResponse - bgpPrefixesStateSlice []BgpPrefixesState - fieldPtr *[]*otg.BgpPrefixesState -} - -func newStatesResponseBgpPrefixesStateIter(ptr *[]*otg.BgpPrefixesState) StatesResponseBgpPrefixesStateIter { - return &statesResponseBgpPrefixesStateIter{fieldPtr: ptr} -} - -type StatesResponseBgpPrefixesStateIter interface { - setMsg(*statesResponse) StatesResponseBgpPrefixesStateIter - Items() []BgpPrefixesState - Add() BgpPrefixesState - Append(items ...BgpPrefixesState) StatesResponseBgpPrefixesStateIter - Set(index int, newObj BgpPrefixesState) StatesResponseBgpPrefixesStateIter - Clear() StatesResponseBgpPrefixesStateIter - clearHolderSlice() StatesResponseBgpPrefixesStateIter - appendHolderSlice(item BgpPrefixesState) StatesResponseBgpPrefixesStateIter -} - -func (obj *statesResponseBgpPrefixesStateIter) setMsg(msg *statesResponse) StatesResponseBgpPrefixesStateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpPrefixesState{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *statesResponseBgpPrefixesStateIter) Items() []BgpPrefixesState { - return obj.bgpPrefixesStateSlice -} - -func (obj *statesResponseBgpPrefixesStateIter) Add() BgpPrefixesState { - newObj := &otg.BgpPrefixesState{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpPrefixesState{obj: newObj} - newLibObj.setDefault() - obj.bgpPrefixesStateSlice = append(obj.bgpPrefixesStateSlice, newLibObj) - return newLibObj -} - -func (obj *statesResponseBgpPrefixesStateIter) Append(items ...BgpPrefixesState) StatesResponseBgpPrefixesStateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpPrefixesStateSlice = append(obj.bgpPrefixesStateSlice, item) - } - return obj -} - -func (obj *statesResponseBgpPrefixesStateIter) Set(index int, newObj BgpPrefixesState) StatesResponseBgpPrefixesStateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpPrefixesStateSlice[index] = newObj - return obj -} -func (obj *statesResponseBgpPrefixesStateIter) Clear() StatesResponseBgpPrefixesStateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpPrefixesState{} - obj.bgpPrefixesStateSlice = []BgpPrefixesState{} - } - return obj -} -func (obj *statesResponseBgpPrefixesStateIter) clearHolderSlice() StatesResponseBgpPrefixesStateIter { - if len(obj.bgpPrefixesStateSlice) > 0 { - obj.bgpPrefixesStateSlice = []BgpPrefixesState{} - } - return obj -} -func (obj *statesResponseBgpPrefixesStateIter) appendHolderSlice(item BgpPrefixesState) StatesResponseBgpPrefixesStateIter { - obj.bgpPrefixesStateSlice = append(obj.bgpPrefixesStateSlice, item) - return obj -} - -// description is TBD -// IsisLsps returns a []IsisLspsState -func (obj *statesResponse) IsisLsps() StatesResponseIsisLspsStateIter { - if len(obj.obj.IsisLsps) == 0 { - obj.setChoice(StatesResponseChoice.ISIS_LSPS) - } - if obj.isisLspsHolder == nil { - obj.isisLspsHolder = newStatesResponseIsisLspsStateIter(&obj.obj.IsisLsps).setMsg(obj) - } - return obj.isisLspsHolder -} - -type statesResponseIsisLspsStateIter struct { - obj *statesResponse - isisLspsStateSlice []IsisLspsState - fieldPtr *[]*otg.IsisLspsState -} - -func newStatesResponseIsisLspsStateIter(ptr *[]*otg.IsisLspsState) StatesResponseIsisLspsStateIter { - return &statesResponseIsisLspsStateIter{fieldPtr: ptr} -} - -type StatesResponseIsisLspsStateIter interface { - setMsg(*statesResponse) StatesResponseIsisLspsStateIter - Items() []IsisLspsState - Add() IsisLspsState - Append(items ...IsisLspsState) StatesResponseIsisLspsStateIter - Set(index int, newObj IsisLspsState) StatesResponseIsisLspsStateIter - Clear() StatesResponseIsisLspsStateIter - clearHolderSlice() StatesResponseIsisLspsStateIter - appendHolderSlice(item IsisLspsState) StatesResponseIsisLspsStateIter -} - -func (obj *statesResponseIsisLspsStateIter) setMsg(msg *statesResponse) StatesResponseIsisLspsStateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspsState{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *statesResponseIsisLspsStateIter) Items() []IsisLspsState { - return obj.isisLspsStateSlice -} - -func (obj *statesResponseIsisLspsStateIter) Add() IsisLspsState { - newObj := &otg.IsisLspsState{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspsState{obj: newObj} - newLibObj.setDefault() - obj.isisLspsStateSlice = append(obj.isisLspsStateSlice, newLibObj) - return newLibObj -} - -func (obj *statesResponseIsisLspsStateIter) Append(items ...IsisLspsState) StatesResponseIsisLspsStateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspsStateSlice = append(obj.isisLspsStateSlice, item) - } - return obj -} - -func (obj *statesResponseIsisLspsStateIter) Set(index int, newObj IsisLspsState) StatesResponseIsisLspsStateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspsStateSlice[index] = newObj - return obj -} -func (obj *statesResponseIsisLspsStateIter) Clear() StatesResponseIsisLspsStateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspsState{} - obj.isisLspsStateSlice = []IsisLspsState{} - } - return obj -} -func (obj *statesResponseIsisLspsStateIter) clearHolderSlice() StatesResponseIsisLspsStateIter { - if len(obj.isisLspsStateSlice) > 0 { - obj.isisLspsStateSlice = []IsisLspsState{} - } - return obj -} -func (obj *statesResponseIsisLspsStateIter) appendHolderSlice(item IsisLspsState) StatesResponseIsisLspsStateIter { - obj.isisLspsStateSlice = append(obj.isisLspsStateSlice, item) - return obj -} - -// description is TBD -// LldpNeighbors returns a []LldpNeighborsState -func (obj *statesResponse) LldpNeighbors() StatesResponseLldpNeighborsStateIter { - if len(obj.obj.LldpNeighbors) == 0 { - obj.setChoice(StatesResponseChoice.LLDP_NEIGHBORS) - } - if obj.lldpNeighborsHolder == nil { - obj.lldpNeighborsHolder = newStatesResponseLldpNeighborsStateIter(&obj.obj.LldpNeighbors).setMsg(obj) - } - return obj.lldpNeighborsHolder -} - -type statesResponseLldpNeighborsStateIter struct { - obj *statesResponse - lldpNeighborsStateSlice []LldpNeighborsState - fieldPtr *[]*otg.LldpNeighborsState -} - -func newStatesResponseLldpNeighborsStateIter(ptr *[]*otg.LldpNeighborsState) StatesResponseLldpNeighborsStateIter { - return &statesResponseLldpNeighborsStateIter{fieldPtr: ptr} -} - -type StatesResponseLldpNeighborsStateIter interface { - setMsg(*statesResponse) StatesResponseLldpNeighborsStateIter - Items() []LldpNeighborsState - Add() LldpNeighborsState - Append(items ...LldpNeighborsState) StatesResponseLldpNeighborsStateIter - Set(index int, newObj LldpNeighborsState) StatesResponseLldpNeighborsStateIter - Clear() StatesResponseLldpNeighborsStateIter - clearHolderSlice() StatesResponseLldpNeighborsStateIter - appendHolderSlice(item LldpNeighborsState) StatesResponseLldpNeighborsStateIter -} - -func (obj *statesResponseLldpNeighborsStateIter) setMsg(msg *statesResponse) StatesResponseLldpNeighborsStateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&lldpNeighborsState{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *statesResponseLldpNeighborsStateIter) Items() []LldpNeighborsState { - return obj.lldpNeighborsStateSlice -} - -func (obj *statesResponseLldpNeighborsStateIter) Add() LldpNeighborsState { - newObj := &otg.LldpNeighborsState{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &lldpNeighborsState{obj: newObj} - newLibObj.setDefault() - obj.lldpNeighborsStateSlice = append(obj.lldpNeighborsStateSlice, newLibObj) - return newLibObj -} - -func (obj *statesResponseLldpNeighborsStateIter) Append(items ...LldpNeighborsState) StatesResponseLldpNeighborsStateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.lldpNeighborsStateSlice = append(obj.lldpNeighborsStateSlice, item) - } - return obj -} - -func (obj *statesResponseLldpNeighborsStateIter) Set(index int, newObj LldpNeighborsState) StatesResponseLldpNeighborsStateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.lldpNeighborsStateSlice[index] = newObj - return obj -} -func (obj *statesResponseLldpNeighborsStateIter) Clear() StatesResponseLldpNeighborsStateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.LldpNeighborsState{} - obj.lldpNeighborsStateSlice = []LldpNeighborsState{} - } - return obj -} -func (obj *statesResponseLldpNeighborsStateIter) clearHolderSlice() StatesResponseLldpNeighborsStateIter { - if len(obj.lldpNeighborsStateSlice) > 0 { - obj.lldpNeighborsStateSlice = []LldpNeighborsState{} - } - return obj -} -func (obj *statesResponseLldpNeighborsStateIter) appendHolderSlice(item LldpNeighborsState) StatesResponseLldpNeighborsStateIter { - obj.lldpNeighborsStateSlice = append(obj.lldpNeighborsStateSlice, item) - return obj -} - -// description is TBD -// RsvpLsps returns a []RsvpLspsState -func (obj *statesResponse) RsvpLsps() StatesResponseRsvpLspsStateIter { - if len(obj.obj.RsvpLsps) == 0 { - obj.setChoice(StatesResponseChoice.RSVP_LSPS) - } - if obj.rsvpLspsHolder == nil { - obj.rsvpLspsHolder = newStatesResponseRsvpLspsStateIter(&obj.obj.RsvpLsps).setMsg(obj) - } - return obj.rsvpLspsHolder -} - -type statesResponseRsvpLspsStateIter struct { - obj *statesResponse - rsvpLspsStateSlice []RsvpLspsState - fieldPtr *[]*otg.RsvpLspsState -} - -func newStatesResponseRsvpLspsStateIter(ptr *[]*otg.RsvpLspsState) StatesResponseRsvpLspsStateIter { - return &statesResponseRsvpLspsStateIter{fieldPtr: ptr} -} - -type StatesResponseRsvpLspsStateIter interface { - setMsg(*statesResponse) StatesResponseRsvpLspsStateIter - Items() []RsvpLspsState - Add() RsvpLspsState - Append(items ...RsvpLspsState) StatesResponseRsvpLspsStateIter - Set(index int, newObj RsvpLspsState) StatesResponseRsvpLspsStateIter - Clear() StatesResponseRsvpLspsStateIter - clearHolderSlice() StatesResponseRsvpLspsStateIter - appendHolderSlice(item RsvpLspsState) StatesResponseRsvpLspsStateIter -} - -func (obj *statesResponseRsvpLspsStateIter) setMsg(msg *statesResponse) StatesResponseRsvpLspsStateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&rsvpLspsState{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *statesResponseRsvpLspsStateIter) Items() []RsvpLspsState { - return obj.rsvpLspsStateSlice -} - -func (obj *statesResponseRsvpLspsStateIter) Add() RsvpLspsState { - newObj := &otg.RsvpLspsState{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &rsvpLspsState{obj: newObj} - newLibObj.setDefault() - obj.rsvpLspsStateSlice = append(obj.rsvpLspsStateSlice, newLibObj) - return newLibObj -} - -func (obj *statesResponseRsvpLspsStateIter) Append(items ...RsvpLspsState) StatesResponseRsvpLspsStateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.rsvpLspsStateSlice = append(obj.rsvpLspsStateSlice, item) - } - return obj -} - -func (obj *statesResponseRsvpLspsStateIter) Set(index int, newObj RsvpLspsState) StatesResponseRsvpLspsStateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.rsvpLspsStateSlice[index] = newObj - return obj -} -func (obj *statesResponseRsvpLspsStateIter) Clear() StatesResponseRsvpLspsStateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.RsvpLspsState{} - obj.rsvpLspsStateSlice = []RsvpLspsState{} - } - return obj -} -func (obj *statesResponseRsvpLspsStateIter) clearHolderSlice() StatesResponseRsvpLspsStateIter { - if len(obj.rsvpLspsStateSlice) > 0 { - obj.rsvpLspsStateSlice = []RsvpLspsState{} - } - return obj -} -func (obj *statesResponseRsvpLspsStateIter) appendHolderSlice(item RsvpLspsState) StatesResponseRsvpLspsStateIter { - obj.rsvpLspsStateSlice = append(obj.rsvpLspsStateSlice, item) - return obj -} - -// description is TBD -// Dhcpv4Interfaces returns a []Dhcpv4InterfaceState -func (obj *statesResponse) Dhcpv4Interfaces() StatesResponseDhcpv4InterfaceStateIter { - if len(obj.obj.Dhcpv4Interfaces) == 0 { - obj.setChoice(StatesResponseChoice.DHCPV4_INTERFACES) - } - if obj.dhcpv4InterfacesHolder == nil { - obj.dhcpv4InterfacesHolder = newStatesResponseDhcpv4InterfaceStateIter(&obj.obj.Dhcpv4Interfaces).setMsg(obj) - } - return obj.dhcpv4InterfacesHolder -} - -type statesResponseDhcpv4InterfaceStateIter struct { - obj *statesResponse - dhcpv4InterfaceStateSlice []Dhcpv4InterfaceState - fieldPtr *[]*otg.Dhcpv4InterfaceState -} - -func newStatesResponseDhcpv4InterfaceStateIter(ptr *[]*otg.Dhcpv4InterfaceState) StatesResponseDhcpv4InterfaceStateIter { - return &statesResponseDhcpv4InterfaceStateIter{fieldPtr: ptr} -} - -type StatesResponseDhcpv4InterfaceStateIter interface { - setMsg(*statesResponse) StatesResponseDhcpv4InterfaceStateIter - Items() []Dhcpv4InterfaceState - Add() Dhcpv4InterfaceState - Append(items ...Dhcpv4InterfaceState) StatesResponseDhcpv4InterfaceStateIter - Set(index int, newObj Dhcpv4InterfaceState) StatesResponseDhcpv4InterfaceStateIter - Clear() StatesResponseDhcpv4InterfaceStateIter - clearHolderSlice() StatesResponseDhcpv4InterfaceStateIter - appendHolderSlice(item Dhcpv4InterfaceState) StatesResponseDhcpv4InterfaceStateIter -} - -func (obj *statesResponseDhcpv4InterfaceStateIter) setMsg(msg *statesResponse) StatesResponseDhcpv4InterfaceStateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&dhcpv4InterfaceState{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *statesResponseDhcpv4InterfaceStateIter) Items() []Dhcpv4InterfaceState { - return obj.dhcpv4InterfaceStateSlice -} - -func (obj *statesResponseDhcpv4InterfaceStateIter) Add() Dhcpv4InterfaceState { - newObj := &otg.Dhcpv4InterfaceState{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &dhcpv4InterfaceState{obj: newObj} - newLibObj.setDefault() - obj.dhcpv4InterfaceStateSlice = append(obj.dhcpv4InterfaceStateSlice, newLibObj) - return newLibObj -} - -func (obj *statesResponseDhcpv4InterfaceStateIter) Append(items ...Dhcpv4InterfaceState) StatesResponseDhcpv4InterfaceStateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.dhcpv4InterfaceStateSlice = append(obj.dhcpv4InterfaceStateSlice, item) - } - return obj -} - -func (obj *statesResponseDhcpv4InterfaceStateIter) Set(index int, newObj Dhcpv4InterfaceState) StatesResponseDhcpv4InterfaceStateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.dhcpv4InterfaceStateSlice[index] = newObj - return obj -} -func (obj *statesResponseDhcpv4InterfaceStateIter) Clear() StatesResponseDhcpv4InterfaceStateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Dhcpv4InterfaceState{} - obj.dhcpv4InterfaceStateSlice = []Dhcpv4InterfaceState{} - } - return obj -} -func (obj *statesResponseDhcpv4InterfaceStateIter) clearHolderSlice() StatesResponseDhcpv4InterfaceStateIter { - if len(obj.dhcpv4InterfaceStateSlice) > 0 { - obj.dhcpv4InterfaceStateSlice = []Dhcpv4InterfaceState{} - } - return obj -} -func (obj *statesResponseDhcpv4InterfaceStateIter) appendHolderSlice(item Dhcpv4InterfaceState) StatesResponseDhcpv4InterfaceStateIter { - obj.dhcpv4InterfaceStateSlice = append(obj.dhcpv4InterfaceStateSlice, item) - return obj -} - -// description is TBD -// Dhcpv4Leases returns a []Dhcpv4LeasesState -func (obj *statesResponse) Dhcpv4Leases() StatesResponseDhcpv4LeasesStateIter { - if len(obj.obj.Dhcpv4Leases) == 0 { - obj.setChoice(StatesResponseChoice.DHCPV4_LEASES) - } - if obj.dhcpv4LeasesHolder == nil { - obj.dhcpv4LeasesHolder = newStatesResponseDhcpv4LeasesStateIter(&obj.obj.Dhcpv4Leases).setMsg(obj) - } - return obj.dhcpv4LeasesHolder -} - -type statesResponseDhcpv4LeasesStateIter struct { - obj *statesResponse - dhcpv4LeasesStateSlice []Dhcpv4LeasesState - fieldPtr *[]*otg.Dhcpv4LeasesState -} - -func newStatesResponseDhcpv4LeasesStateIter(ptr *[]*otg.Dhcpv4LeasesState) StatesResponseDhcpv4LeasesStateIter { - return &statesResponseDhcpv4LeasesStateIter{fieldPtr: ptr} -} - -type StatesResponseDhcpv4LeasesStateIter interface { - setMsg(*statesResponse) StatesResponseDhcpv4LeasesStateIter - Items() []Dhcpv4LeasesState - Add() Dhcpv4LeasesState - Append(items ...Dhcpv4LeasesState) StatesResponseDhcpv4LeasesStateIter - Set(index int, newObj Dhcpv4LeasesState) StatesResponseDhcpv4LeasesStateIter - Clear() StatesResponseDhcpv4LeasesStateIter - clearHolderSlice() StatesResponseDhcpv4LeasesStateIter - appendHolderSlice(item Dhcpv4LeasesState) StatesResponseDhcpv4LeasesStateIter -} - -func (obj *statesResponseDhcpv4LeasesStateIter) setMsg(msg *statesResponse) StatesResponseDhcpv4LeasesStateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&dhcpv4LeasesState{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *statesResponseDhcpv4LeasesStateIter) Items() []Dhcpv4LeasesState { - return obj.dhcpv4LeasesStateSlice -} - -func (obj *statesResponseDhcpv4LeasesStateIter) Add() Dhcpv4LeasesState { - newObj := &otg.Dhcpv4LeasesState{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &dhcpv4LeasesState{obj: newObj} - newLibObj.setDefault() - obj.dhcpv4LeasesStateSlice = append(obj.dhcpv4LeasesStateSlice, newLibObj) - return newLibObj -} - -func (obj *statesResponseDhcpv4LeasesStateIter) Append(items ...Dhcpv4LeasesState) StatesResponseDhcpv4LeasesStateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.dhcpv4LeasesStateSlice = append(obj.dhcpv4LeasesStateSlice, item) - } - return obj -} - -func (obj *statesResponseDhcpv4LeasesStateIter) Set(index int, newObj Dhcpv4LeasesState) StatesResponseDhcpv4LeasesStateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.dhcpv4LeasesStateSlice[index] = newObj - return obj -} -func (obj *statesResponseDhcpv4LeasesStateIter) Clear() StatesResponseDhcpv4LeasesStateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Dhcpv4LeasesState{} - obj.dhcpv4LeasesStateSlice = []Dhcpv4LeasesState{} - } - return obj -} -func (obj *statesResponseDhcpv4LeasesStateIter) clearHolderSlice() StatesResponseDhcpv4LeasesStateIter { - if len(obj.dhcpv4LeasesStateSlice) > 0 { - obj.dhcpv4LeasesStateSlice = []Dhcpv4LeasesState{} - } - return obj -} -func (obj *statesResponseDhcpv4LeasesStateIter) appendHolderSlice(item Dhcpv4LeasesState) StatesResponseDhcpv4LeasesStateIter { - obj.dhcpv4LeasesStateSlice = append(obj.dhcpv4LeasesStateSlice, item) - return obj -} - -func (obj *statesResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Ipv4Neighbors) != 0 { - - if set_default { - obj.Ipv4Neighbors().clearHolderSlice() - for _, item := range obj.obj.Ipv4Neighbors { - obj.Ipv4Neighbors().appendHolderSlice(&neighborsv4State{obj: item}) - } - } - for _, item := range obj.Ipv4Neighbors().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Ipv6Neighbors) != 0 { - - if set_default { - obj.Ipv6Neighbors().clearHolderSlice() - for _, item := range obj.obj.Ipv6Neighbors { - obj.Ipv6Neighbors().appendHolderSlice(&neighborsv6State{obj: item}) - } - } - for _, item := range obj.Ipv6Neighbors().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.BgpPrefixes) != 0 { - - if set_default { - obj.BgpPrefixes().clearHolderSlice() - for _, item := range obj.obj.BgpPrefixes { - obj.BgpPrefixes().appendHolderSlice(&bgpPrefixesState{obj: item}) - } - } - for _, item := range obj.BgpPrefixes().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.IsisLsps) != 0 { - - if set_default { - obj.IsisLsps().clearHolderSlice() - for _, item := range obj.obj.IsisLsps { - obj.IsisLsps().appendHolderSlice(&isisLspsState{obj: item}) - } - } - for _, item := range obj.IsisLsps().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.LldpNeighbors) != 0 { - - if set_default { - obj.LldpNeighbors().clearHolderSlice() - for _, item := range obj.obj.LldpNeighbors { - obj.LldpNeighbors().appendHolderSlice(&lldpNeighborsState{obj: item}) - } - } - for _, item := range obj.LldpNeighbors().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.RsvpLsps) != 0 { - - if set_default { - obj.RsvpLsps().clearHolderSlice() - for _, item := range obj.obj.RsvpLsps { - obj.RsvpLsps().appendHolderSlice(&rsvpLspsState{obj: item}) - } - } - for _, item := range obj.RsvpLsps().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Dhcpv4Interfaces) != 0 { - - if set_default { - obj.Dhcpv4Interfaces().clearHolderSlice() - for _, item := range obj.obj.Dhcpv4Interfaces { - obj.Dhcpv4Interfaces().appendHolderSlice(&dhcpv4InterfaceState{obj: item}) - } - } - for _, item := range obj.Dhcpv4Interfaces().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Dhcpv4Leases) != 0 { - - if set_default { - obj.Dhcpv4Leases().clearHolderSlice() - for _, item := range obj.obj.Dhcpv4Leases { - obj.Dhcpv4Leases().appendHolderSlice(&dhcpv4LeasesState{obj: item}) - } - } - for _, item := range obj.Dhcpv4Leases().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *statesResponse) setDefault() { - var choices_set int = 0 - var choice StatesResponseChoiceEnum - - if len(obj.obj.Ipv4Neighbors) > 0 { - choices_set += 1 - choice = StatesResponseChoice.IPV4_NEIGHBORS - } - - if len(obj.obj.Ipv6Neighbors) > 0 { - choices_set += 1 - choice = StatesResponseChoice.IPV6_NEIGHBORS - } - - if len(obj.obj.BgpPrefixes) > 0 { - choices_set += 1 - choice = StatesResponseChoice.BGP_PREFIXES - } - - if len(obj.obj.IsisLsps) > 0 { - choices_set += 1 - choice = StatesResponseChoice.ISIS_LSPS - } - - if len(obj.obj.LldpNeighbors) > 0 { - choices_set += 1 - choice = StatesResponseChoice.LLDP_NEIGHBORS - } - - if len(obj.obj.RsvpLsps) > 0 { - choices_set += 1 - choice = StatesResponseChoice.RSVP_LSPS - } - - if len(obj.obj.Dhcpv4Interfaces) > 0 { - choices_set += 1 - choice = StatesResponseChoice.DHCPV4_INTERFACES - } - - if len(obj.obj.Dhcpv4Leases) > 0 { - choices_set += 1 - choice = StatesResponseChoice.DHCPV4_LEASES - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(StatesResponseChoice.IPV4_NEIGHBORS) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StatesResponse") - } - } else { - intVal := otg.StatesResponse_Choice_Enum_value[string(choice)] - enumValue := otg.StatesResponse_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** Version ***** -type version struct { - validation - obj *otg.Version - marshaller marshalVersion - unMarshaller unMarshalVersion -} - -func NewVersion() Version { - obj := version{obj: &otg.Version{}} - obj.setDefault() - return &obj -} - -func (obj *version) msg() *otg.Version { - return obj.obj -} - -func (obj *version) setMsg(msg *otg.Version) Version { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalversion struct { - obj *version -} - -type marshalVersion interface { - // ToProto marshals Version to protobuf object *otg.Version - ToProto() (*otg.Version, error) - // ToPbText marshals Version to protobuf text - ToPbText() (string, error) - // ToYaml marshals Version to YAML text - ToYaml() (string, error) - // ToJson marshals Version to JSON text - ToJson() (string, error) -} - -type unMarshalversion struct { - obj *version -} - -type unMarshalVersion interface { - // FromProto unmarshals Version from protobuf object *otg.Version - FromProto(msg *otg.Version) (Version, error) - // FromPbText unmarshals Version from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Version from YAML text - FromYaml(value string) error - // FromJson unmarshals Version from JSON text - FromJson(value string) error -} - -func (obj *version) Marshal() marshalVersion { - if obj.marshaller == nil { - obj.marshaller = &marshalversion{obj: obj} - } - return obj.marshaller -} - -func (obj *version) Unmarshal() unMarshalVersion { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalversion{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalversion) ToProto() (*otg.Version, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalversion) FromProto(msg *otg.Version) (Version, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalversion) 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 *unMarshalversion) 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 *marshalversion) 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 *unMarshalversion) 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 *marshalversion) 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 *unMarshalversion) 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 *version) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *version) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *version) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *version) Clone() (Version, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewVersion() - 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 -} - -// Version is version details -type Version interface { - Validation - // msg marshals Version to protobuf object *otg.Version - // and doesn't set defaults - msg() *otg.Version - // setMsg unmarshals Version from protobuf object *otg.Version - // and doesn't set defaults - setMsg(*otg.Version) Version - // provides marshal interface - Marshal() marshalVersion - // provides unmarshal interface - Unmarshal() unMarshalVersion - // validate validates Version - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Version, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ApiSpecVersion returns string, set in Version. - ApiSpecVersion() string - // SetApiSpecVersion assigns string provided by user to Version - SetApiSpecVersion(value string) Version - // HasApiSpecVersion checks if ApiSpecVersion has been set in Version - HasApiSpecVersion() bool - // SdkVersion returns string, set in Version. - SdkVersion() string - // SetSdkVersion assigns string provided by user to Version - SetSdkVersion(value string) Version - // HasSdkVersion checks if SdkVersion has been set in Version - HasSdkVersion() bool - // AppVersion returns string, set in Version. - AppVersion() string - // SetAppVersion assigns string provided by user to Version - SetAppVersion(value string) Version - // HasAppVersion checks if AppVersion has been set in Version - HasAppVersion() bool -} - -// Version of API specification -// ApiSpecVersion returns a string -func (obj *version) ApiSpecVersion() string { - - return *obj.obj.ApiSpecVersion - -} - -// Version of API specification -// ApiSpecVersion returns a string -func (obj *version) HasApiSpecVersion() bool { - return obj.obj.ApiSpecVersion != nil -} - -// Version of API specification -// SetApiSpecVersion sets the string value in the Version object -func (obj *version) SetApiSpecVersion(value string) Version { - - obj.obj.ApiSpecVersion = &value - return obj -} - -// Version of SDK generated from API specification -// SdkVersion returns a string -func (obj *version) SdkVersion() string { - - return *obj.obj.SdkVersion - -} - -// Version of SDK generated from API specification -// SdkVersion returns a string -func (obj *version) HasSdkVersion() bool { - return obj.obj.SdkVersion != nil -} - -// Version of SDK generated from API specification -// SetSdkVersion sets the string value in the Version object -func (obj *version) SetSdkVersion(value string) Version { - - obj.obj.SdkVersion = &value - return obj -} - -// Version of application consuming or serving the API -// AppVersion returns a string -func (obj *version) AppVersion() string { - - return *obj.obj.AppVersion - -} - -// Version of application consuming or serving the API -// AppVersion returns a string -func (obj *version) HasAppVersion() bool { - return obj.obj.AppVersion != nil -} - -// Version of application consuming or serving the API -// SetAppVersion sets the string value in the Version object -func (obj *version) SetAppVersion(value string) Version { - - obj.obj.AppVersion = &value - return obj -} - -func (obj *version) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *version) setDefault() { - if obj.obj.ApiSpecVersion == nil { - obj.SetApiSpecVersion("") - } - if obj.obj.SdkVersion == nil { - obj.SetSdkVersion("") - } - if obj.obj.AppVersion == nil { - obj.SetAppVersion("") - } - -} - -// ***** LagPort ***** -type lagPort struct { - validation - obj *otg.LagPort - marshaller marshalLagPort - unMarshaller unMarshalLagPort - lacpHolder LagPortLacp - ethernetHolder DeviceEthernetBase -} - -func NewLagPort() LagPort { - obj := lagPort{obj: &otg.LagPort{}} - obj.setDefault() - return &obj -} - -func (obj *lagPort) msg() *otg.LagPort { - return obj.obj -} - -func (obj *lagPort) setMsg(msg *otg.LagPort) LagPort { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshallagPort struct { - obj *lagPort -} - -type marshalLagPort interface { - // ToProto marshals LagPort to protobuf object *otg.LagPort - ToProto() (*otg.LagPort, error) - // ToPbText marshals LagPort to protobuf text - ToPbText() (string, error) - // ToYaml marshals LagPort to YAML text - ToYaml() (string, error) - // ToJson marshals LagPort to JSON text - ToJson() (string, error) -} - -type unMarshallagPort struct { - obj *lagPort -} - -type unMarshalLagPort interface { - // FromProto unmarshals LagPort from protobuf object *otg.LagPort - FromProto(msg *otg.LagPort) (LagPort, error) - // FromPbText unmarshals LagPort from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LagPort from YAML text - FromYaml(value string) error - // FromJson unmarshals LagPort from JSON text - FromJson(value string) error -} - -func (obj *lagPort) Marshal() marshalLagPort { - if obj.marshaller == nil { - obj.marshaller = &marshallagPort{obj: obj} - } - return obj.marshaller -} - -func (obj *lagPort) Unmarshal() unMarshalLagPort { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallagPort{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallagPort) ToProto() (*otg.LagPort, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallagPort) FromProto(msg *otg.LagPort) (LagPort, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallagPort) 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 *unMarshallagPort) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshallagPort) 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 *unMarshallagPort) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshallagPort) 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 *unMarshallagPort) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *lagPort) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lagPort) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lagPort) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lagPort) Clone() (LagPort, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLagPort() - 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 -} - -func (obj *lagPort) setNil() { - obj.lacpHolder = nil - obj.ethernetHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// LagPort is the container for a port's ethernet interface and LAG protocol settings -type LagPort interface { - Validation - // msg marshals LagPort to protobuf object *otg.LagPort - // and doesn't set defaults - msg() *otg.LagPort - // setMsg unmarshals LagPort from protobuf object *otg.LagPort - // and doesn't set defaults - setMsg(*otg.LagPort) LagPort - // provides marshal interface - Marshal() marshalLagPort - // provides unmarshal interface - Unmarshal() unMarshalLagPort - // validate validates LagPort - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LagPort, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PortName returns string, set in LagPort. - PortName() string - // SetPortName assigns string provided by user to LagPort - SetPortName(value string) LagPort - // Lacp returns LagPortLacp, set in LagPort. - // LagPortLacp is the container for link aggregation control protocol settings of a LAG member (port). - Lacp() LagPortLacp - // SetLacp assigns LagPortLacp provided by user to LagPort. - // LagPortLacp is the container for link aggregation control protocol settings of a LAG member (port). - SetLacp(value LagPortLacp) LagPort - // HasLacp checks if Lacp has been set in LagPort - HasLacp() bool - // Ethernet returns DeviceEthernetBase, set in LagPort. - // DeviceEthernetBase is base Ethernet interface. - Ethernet() DeviceEthernetBase - // SetEthernet assigns DeviceEthernetBase provided by user to LagPort. - // DeviceEthernetBase is base Ethernet interface. - SetEthernet(value DeviceEthernetBase) LagPort - setNil() -} - -// The name of a port object that will be part of the LAG. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// PortName returns a string -func (obj *lagPort) PortName() string { - - return *obj.obj.PortName - -} - -// The name of a port object that will be part of the LAG. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// SetPortName sets the string value in the LagPort object -func (obj *lagPort) SetPortName(value string) LagPort { - - obj.obj.PortName = &value - return obj -} - -// description is TBD -// Lacp returns a LagPortLacp -func (obj *lagPort) Lacp() LagPortLacp { - if obj.obj.Lacp == nil { - obj.obj.Lacp = NewLagPortLacp().msg() - } - if obj.lacpHolder == nil { - obj.lacpHolder = &lagPortLacp{obj: obj.obj.Lacp} - } - return obj.lacpHolder -} - -// description is TBD -// Lacp returns a LagPortLacp -func (obj *lagPort) HasLacp() bool { - return obj.obj.Lacp != nil -} - -// description is TBD -// SetLacp sets the LagPortLacp value in the LagPort object -func (obj *lagPort) SetLacp(value LagPortLacp) LagPort { - - obj.lacpHolder = nil - obj.obj.Lacp = value.msg() - - return obj -} - -// description is TBD -// Ethernet returns a DeviceEthernetBase -func (obj *lagPort) Ethernet() DeviceEthernetBase { - if obj.obj.Ethernet == nil { - obj.obj.Ethernet = NewDeviceEthernetBase().msg() - } - if obj.ethernetHolder == nil { - obj.ethernetHolder = &deviceEthernetBase{obj: obj.obj.Ethernet} - } - return obj.ethernetHolder -} - -// description is TBD -// SetEthernet sets the DeviceEthernetBase value in the LagPort object -func (obj *lagPort) SetEthernet(value DeviceEthernetBase) LagPort { - - obj.ethernetHolder = nil - obj.obj.Ethernet = value.msg() - - return obj -} - -func (obj *lagPort) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // PortName is required - if obj.obj.PortName == nil { - vObj.validationErrors = append(vObj.validationErrors, "PortName is required field on interface LagPort") - } - - if obj.obj.Lacp != nil { - - obj.Lacp().validateObj(vObj, set_default) - } - - // Ethernet is required - if obj.obj.Ethernet == nil { - vObj.validationErrors = append(vObj.validationErrors, "Ethernet is required field on interface LagPort") - } - - if obj.obj.Ethernet != nil { - - obj.Ethernet().validateObj(vObj, set_default) - } - -} - -func (obj *lagPort) setDefault() { - -} - -// ***** LagProtocol ***** -type lagProtocol struct { - validation - obj *otg.LagProtocol - marshaller marshalLagProtocol - unMarshaller unMarshalLagProtocol - lacpHolder LagProtocolLacp - staticHolder LagProtocolStatic -} - -func NewLagProtocol() LagProtocol { - obj := lagProtocol{obj: &otg.LagProtocol{}} - obj.setDefault() - return &obj -} - -func (obj *lagProtocol) msg() *otg.LagProtocol { - return obj.obj -} - -func (obj *lagProtocol) setMsg(msg *otg.LagProtocol) LagProtocol { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshallagProtocol struct { - obj *lagProtocol -} - -type marshalLagProtocol interface { - // ToProto marshals LagProtocol to protobuf object *otg.LagProtocol - ToProto() (*otg.LagProtocol, error) - // ToPbText marshals LagProtocol to protobuf text - ToPbText() (string, error) - // ToYaml marshals LagProtocol to YAML text - ToYaml() (string, error) - // ToJson marshals LagProtocol to JSON text - ToJson() (string, error) -} - -type unMarshallagProtocol struct { - obj *lagProtocol -} - -type unMarshalLagProtocol interface { - // FromProto unmarshals LagProtocol from protobuf object *otg.LagProtocol - FromProto(msg *otg.LagProtocol) (LagProtocol, error) - // FromPbText unmarshals LagProtocol from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LagProtocol from YAML text - FromYaml(value string) error - // FromJson unmarshals LagProtocol from JSON text - FromJson(value string) error -} - -func (obj *lagProtocol) Marshal() marshalLagProtocol { - if obj.marshaller == nil { - obj.marshaller = &marshallagProtocol{obj: obj} - } - return obj.marshaller -} - -func (obj *lagProtocol) Unmarshal() unMarshalLagProtocol { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallagProtocol{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallagProtocol) ToProto() (*otg.LagProtocol, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallagProtocol) FromProto(msg *otg.LagProtocol) (LagProtocol, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallagProtocol) 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 *unMarshallagProtocol) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshallagProtocol) 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 *unMarshallagProtocol) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshallagProtocol) 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 *unMarshallagProtocol) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *lagProtocol) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lagProtocol) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lagProtocol) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lagProtocol) Clone() (LagProtocol, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLagProtocol() - 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 -} - -func (obj *lagProtocol) setNil() { - obj.lacpHolder = nil - obj.staticHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// LagProtocol is description is TBD -type LagProtocol interface { - Validation - // msg marshals LagProtocol to protobuf object *otg.LagProtocol - // and doesn't set defaults - msg() *otg.LagProtocol - // setMsg unmarshals LagProtocol from protobuf object *otg.LagProtocol - // and doesn't set defaults - setMsg(*otg.LagProtocol) LagProtocol - // provides marshal interface - Marshal() marshalLagProtocol - // provides unmarshal interface - Unmarshal() unMarshalLagProtocol - // validate validates LagProtocol - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LagProtocol, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns LagProtocolChoiceEnum, set in LagProtocol - Choice() LagProtocolChoiceEnum - // setChoice assigns LagProtocolChoiceEnum provided by user to LagProtocol - setChoice(value LagProtocolChoiceEnum) LagProtocol - // HasChoice checks if Choice has been set in LagProtocol - HasChoice() bool - // Lacp returns LagProtocolLacp, set in LagProtocol. - // LagProtocolLacp is the container for link aggregation control protocol settings of a LAG (ports group). - Lacp() LagProtocolLacp - // SetLacp assigns LagProtocolLacp provided by user to LagProtocol. - // LagProtocolLacp is the container for link aggregation control protocol settings of a LAG (ports group). - SetLacp(value LagProtocolLacp) LagProtocol - // HasLacp checks if Lacp has been set in LagProtocol - HasLacp() bool - // Static returns LagProtocolStatic, set in LagProtocol. - // LagProtocolStatic is the container for static link aggregation protocol settings. - Static() LagProtocolStatic - // SetStatic assigns LagProtocolStatic provided by user to LagProtocol. - // LagProtocolStatic is the container for static link aggregation protocol settings. - SetStatic(value LagProtocolStatic) LagProtocol - // HasStatic checks if Static has been set in LagProtocol - HasStatic() bool - setNil() -} - -type LagProtocolChoiceEnum string - -// Enum of Choice on LagProtocol -var LagProtocolChoice = struct { - LACP LagProtocolChoiceEnum - STATIC LagProtocolChoiceEnum -}{ - LACP: LagProtocolChoiceEnum("lacp"), - STATIC: LagProtocolChoiceEnum("static"), -} - -func (obj *lagProtocol) Choice() LagProtocolChoiceEnum { - return LagProtocolChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The type of controlling protocol for the LAG (ports group). -// Choice returns a string -func (obj *lagProtocol) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *lagProtocol) setChoice(value LagProtocolChoiceEnum) LagProtocol { - intValue, ok := otg.LagProtocol_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LagProtocolChoiceEnum", string(value))) - return obj - } - enumValue := otg.LagProtocol_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Static = nil - obj.staticHolder = nil - obj.obj.Lacp = nil - obj.lacpHolder = nil - - if value == LagProtocolChoice.LACP { - obj.obj.Lacp = NewLagProtocolLacp().msg() - } - - if value == LagProtocolChoice.STATIC { - obj.obj.Static = NewLagProtocolStatic().msg() - } - - return obj -} - -// description is TBD -// Lacp returns a LagProtocolLacp -func (obj *lagProtocol) Lacp() LagProtocolLacp { - if obj.obj.Lacp == nil { - obj.setChoice(LagProtocolChoice.LACP) - } - if obj.lacpHolder == nil { - obj.lacpHolder = &lagProtocolLacp{obj: obj.obj.Lacp} - } - return obj.lacpHolder -} - -// description is TBD -// Lacp returns a LagProtocolLacp -func (obj *lagProtocol) HasLacp() bool { - return obj.obj.Lacp != nil -} - -// description is TBD -// SetLacp sets the LagProtocolLacp value in the LagProtocol object -func (obj *lagProtocol) SetLacp(value LagProtocolLacp) LagProtocol { - obj.setChoice(LagProtocolChoice.LACP) - obj.lacpHolder = nil - obj.obj.Lacp = value.msg() - - return obj -} - -// description is TBD -// Static returns a LagProtocolStatic -func (obj *lagProtocol) Static() LagProtocolStatic { - if obj.obj.Static == nil { - obj.setChoice(LagProtocolChoice.STATIC) - } - if obj.staticHolder == nil { - obj.staticHolder = &lagProtocolStatic{obj: obj.obj.Static} - } - return obj.staticHolder -} - -// description is TBD -// Static returns a LagProtocolStatic -func (obj *lagProtocol) HasStatic() bool { - return obj.obj.Static != nil -} - -// description is TBD -// SetStatic sets the LagProtocolStatic value in the LagProtocol object -func (obj *lagProtocol) SetStatic(value LagProtocolStatic) LagProtocol { - obj.setChoice(LagProtocolChoice.STATIC) - obj.staticHolder = nil - obj.obj.Static = value.msg() - - return obj -} - -func (obj *lagProtocol) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Lacp != nil { - - obj.Lacp().validateObj(vObj, set_default) - } - - if obj.obj.Static != nil { - - obj.Static().validateObj(vObj, set_default) - } - -} - -func (obj *lagProtocol) setDefault() { - var choices_set int = 0 - var choice LagProtocolChoiceEnum - - if obj.obj.Lacp != nil { - choices_set += 1 - choice = LagProtocolChoice.LACP - } - - if obj.obj.Static != nil { - choices_set += 1 - choice = LagProtocolChoice.STATIC - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(LagProtocolChoice.LACP) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in LagProtocol") - } - } else { - intVal := otg.LagProtocol_Choice_Enum_value[string(choice)] - enumValue := otg.LagProtocol_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** Layer1AutoNegotiation ***** -type layer1AutoNegotiation struct { - validation - obj *otg.Layer1AutoNegotiation - marshaller marshalLayer1AutoNegotiation - unMarshaller unMarshalLayer1AutoNegotiation -} - -func NewLayer1AutoNegotiation() Layer1AutoNegotiation { - obj := layer1AutoNegotiation{obj: &otg.Layer1AutoNegotiation{}} - obj.setDefault() - return &obj -} - -func (obj *layer1AutoNegotiation) msg() *otg.Layer1AutoNegotiation { - return obj.obj -} - -func (obj *layer1AutoNegotiation) setMsg(msg *otg.Layer1AutoNegotiation) Layer1AutoNegotiation { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallayer1AutoNegotiation struct { - obj *layer1AutoNegotiation -} - -type marshalLayer1AutoNegotiation interface { - // ToProto marshals Layer1AutoNegotiation to protobuf object *otg.Layer1AutoNegotiation - ToProto() (*otg.Layer1AutoNegotiation, error) - // ToPbText marshals Layer1AutoNegotiation to protobuf text - ToPbText() (string, error) - // ToYaml marshals Layer1AutoNegotiation to YAML text - ToYaml() (string, error) - // ToJson marshals Layer1AutoNegotiation to JSON text - ToJson() (string, error) -} - -type unMarshallayer1AutoNegotiation struct { - obj *layer1AutoNegotiation -} - -type unMarshalLayer1AutoNegotiation interface { - // FromProto unmarshals Layer1AutoNegotiation from protobuf object *otg.Layer1AutoNegotiation - FromProto(msg *otg.Layer1AutoNegotiation) (Layer1AutoNegotiation, error) - // FromPbText unmarshals Layer1AutoNegotiation from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Layer1AutoNegotiation from YAML text - FromYaml(value string) error - // FromJson unmarshals Layer1AutoNegotiation from JSON text - FromJson(value string) error -} - -func (obj *layer1AutoNegotiation) Marshal() marshalLayer1AutoNegotiation { - if obj.marshaller == nil { - obj.marshaller = &marshallayer1AutoNegotiation{obj: obj} - } - return obj.marshaller -} - -func (obj *layer1AutoNegotiation) Unmarshal() unMarshalLayer1AutoNegotiation { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallayer1AutoNegotiation{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallayer1AutoNegotiation) ToProto() (*otg.Layer1AutoNegotiation, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallayer1AutoNegotiation) FromProto(msg *otg.Layer1AutoNegotiation) (Layer1AutoNegotiation, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallayer1AutoNegotiation) 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 *unMarshallayer1AutoNegotiation) 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 *marshallayer1AutoNegotiation) 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 *unMarshallayer1AutoNegotiation) 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 *marshallayer1AutoNegotiation) 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 *unMarshallayer1AutoNegotiation) 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 *layer1AutoNegotiation) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *layer1AutoNegotiation) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *layer1AutoNegotiation) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *layer1AutoNegotiation) Clone() (Layer1AutoNegotiation, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLayer1AutoNegotiation() - 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 -} - -// Layer1AutoNegotiation is configuration for auto negotiation settings -type Layer1AutoNegotiation interface { - Validation - // msg marshals Layer1AutoNegotiation to protobuf object *otg.Layer1AutoNegotiation - // and doesn't set defaults - msg() *otg.Layer1AutoNegotiation - // setMsg unmarshals Layer1AutoNegotiation from protobuf object *otg.Layer1AutoNegotiation - // and doesn't set defaults - setMsg(*otg.Layer1AutoNegotiation) Layer1AutoNegotiation - // provides marshal interface - Marshal() marshalLayer1AutoNegotiation - // provides unmarshal interface - Unmarshal() unMarshalLayer1AutoNegotiation - // validate validates Layer1AutoNegotiation - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Layer1AutoNegotiation, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Advertise1000Mbps returns bool, set in Layer1AutoNegotiation. - Advertise1000Mbps() bool - // SetAdvertise1000Mbps assigns bool provided by user to Layer1AutoNegotiation - SetAdvertise1000Mbps(value bool) Layer1AutoNegotiation - // HasAdvertise1000Mbps checks if Advertise1000Mbps has been set in Layer1AutoNegotiation - HasAdvertise1000Mbps() bool - // Advertise100FdMbps returns bool, set in Layer1AutoNegotiation. - Advertise100FdMbps() bool - // SetAdvertise100FdMbps assigns bool provided by user to Layer1AutoNegotiation - SetAdvertise100FdMbps(value bool) Layer1AutoNegotiation - // HasAdvertise100FdMbps checks if Advertise100FdMbps has been set in Layer1AutoNegotiation - HasAdvertise100FdMbps() bool - // Advertise100HdMbps returns bool, set in Layer1AutoNegotiation. - Advertise100HdMbps() bool - // SetAdvertise100HdMbps assigns bool provided by user to Layer1AutoNegotiation - SetAdvertise100HdMbps(value bool) Layer1AutoNegotiation - // HasAdvertise100HdMbps checks if Advertise100HdMbps has been set in Layer1AutoNegotiation - HasAdvertise100HdMbps() bool - // Advertise10FdMbps returns bool, set in Layer1AutoNegotiation. - Advertise10FdMbps() bool - // SetAdvertise10FdMbps assigns bool provided by user to Layer1AutoNegotiation - SetAdvertise10FdMbps(value bool) Layer1AutoNegotiation - // HasAdvertise10FdMbps checks if Advertise10FdMbps has been set in Layer1AutoNegotiation - HasAdvertise10FdMbps() bool - // Advertise10HdMbps returns bool, set in Layer1AutoNegotiation. - Advertise10HdMbps() bool - // SetAdvertise10HdMbps assigns bool provided by user to Layer1AutoNegotiation - SetAdvertise10HdMbps(value bool) Layer1AutoNegotiation - // HasAdvertise10HdMbps checks if Advertise10HdMbps has been set in Layer1AutoNegotiation - HasAdvertise10HdMbps() bool - // LinkTraining returns bool, set in Layer1AutoNegotiation. - LinkTraining() bool - // SetLinkTraining assigns bool provided by user to Layer1AutoNegotiation - SetLinkTraining(value bool) Layer1AutoNegotiation - // HasLinkTraining checks if LinkTraining has been set in Layer1AutoNegotiation - HasLinkTraining() bool - // RsFec returns bool, set in Layer1AutoNegotiation. - RsFec() bool - // SetRsFec assigns bool provided by user to Layer1AutoNegotiation - SetRsFec(value bool) Layer1AutoNegotiation - // HasRsFec checks if RsFec has been set in Layer1AutoNegotiation - HasRsFec() bool -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// Advertise1000Mbps returns a bool -func (obj *layer1AutoNegotiation) Advertise1000Mbps() bool { - - return *obj.obj.Advertise_1000Mbps - -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// Advertise1000Mbps returns a bool -func (obj *layer1AutoNegotiation) HasAdvertise1000Mbps() bool { - return obj.obj.Advertise_1000Mbps != nil -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// SetAdvertise1000Mbps sets the bool value in the Layer1AutoNegotiation object -func (obj *layer1AutoNegotiation) SetAdvertise1000Mbps(value bool) Layer1AutoNegotiation { - - obj.obj.Advertise_1000Mbps = &value - return obj -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// Advertise100FdMbps returns a bool -func (obj *layer1AutoNegotiation) Advertise100FdMbps() bool { - - return *obj.obj.Advertise_100FdMbps - -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// Advertise100FdMbps returns a bool -func (obj *layer1AutoNegotiation) HasAdvertise100FdMbps() bool { - return obj.obj.Advertise_100FdMbps != nil -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// SetAdvertise100FdMbps sets the bool value in the Layer1AutoNegotiation object -func (obj *layer1AutoNegotiation) SetAdvertise100FdMbps(value bool) Layer1AutoNegotiation { - - obj.obj.Advertise_100FdMbps = &value - return obj -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// Advertise100HdMbps returns a bool -func (obj *layer1AutoNegotiation) Advertise100HdMbps() bool { - - return *obj.obj.Advertise_100HdMbps - -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// Advertise100HdMbps returns a bool -func (obj *layer1AutoNegotiation) HasAdvertise100HdMbps() bool { - return obj.obj.Advertise_100HdMbps != nil -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// SetAdvertise100HdMbps sets the bool value in the Layer1AutoNegotiation object -func (obj *layer1AutoNegotiation) SetAdvertise100HdMbps(value bool) Layer1AutoNegotiation { - - obj.obj.Advertise_100HdMbps = &value - return obj -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// Advertise10FdMbps returns a bool -func (obj *layer1AutoNegotiation) Advertise10FdMbps() bool { - - return *obj.obj.Advertise_10FdMbps - -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// Advertise10FdMbps returns a bool -func (obj *layer1AutoNegotiation) HasAdvertise10FdMbps() bool { - return obj.obj.Advertise_10FdMbps != nil -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// SetAdvertise10FdMbps sets the bool value in the Layer1AutoNegotiation object -func (obj *layer1AutoNegotiation) SetAdvertise10FdMbps(value bool) Layer1AutoNegotiation { - - obj.obj.Advertise_10FdMbps = &value - return obj -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// Advertise10HdMbps returns a bool -func (obj *layer1AutoNegotiation) Advertise10HdMbps() bool { - - return *obj.obj.Advertise_10HdMbps - -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// Advertise10HdMbps returns a bool -func (obj *layer1AutoNegotiation) HasAdvertise10HdMbps() bool { - return obj.obj.Advertise_10HdMbps != nil -} - -// If auto_negotiate is true and the interface supports this option -// then this speed will be advertised. -// SetAdvertise10HdMbps sets the bool value in the Layer1AutoNegotiation object -func (obj *layer1AutoNegotiation) SetAdvertise10HdMbps(value bool) Layer1AutoNegotiation { - - obj.obj.Advertise_10HdMbps = &value - return obj -} - -// Enable/disable gigabit ethernet link training. -// LinkTraining returns a bool -func (obj *layer1AutoNegotiation) LinkTraining() bool { - - return *obj.obj.LinkTraining - -} - -// Enable/disable gigabit ethernet link training. -// LinkTraining returns a bool -func (obj *layer1AutoNegotiation) HasLinkTraining() bool { - return obj.obj.LinkTraining != nil -} - -// Enable/disable gigabit ethernet link training. -// SetLinkTraining sets the bool value in the Layer1AutoNegotiation object -func (obj *layer1AutoNegotiation) SetLinkTraining(value bool) Layer1AutoNegotiation { - - obj.obj.LinkTraining = &value - return obj -} - -// Enable/disable gigabit ethernet reed solomon forward error correction (RS FEC). -// RsFec returns a bool -func (obj *layer1AutoNegotiation) RsFec() bool { - - return *obj.obj.RsFec - -} - -// Enable/disable gigabit ethernet reed solomon forward error correction (RS FEC). -// RsFec returns a bool -func (obj *layer1AutoNegotiation) HasRsFec() bool { - return obj.obj.RsFec != nil -} - -// Enable/disable gigabit ethernet reed solomon forward error correction (RS FEC). -// SetRsFec sets the bool value in the Layer1AutoNegotiation object -func (obj *layer1AutoNegotiation) SetRsFec(value bool) Layer1AutoNegotiation { - - obj.obj.RsFec = &value - return obj -} - -func (obj *layer1AutoNegotiation) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *layer1AutoNegotiation) setDefault() { - if obj.obj.Advertise_1000Mbps == nil { - obj.SetAdvertise1000Mbps(true) - } - if obj.obj.Advertise_100FdMbps == nil { - obj.SetAdvertise100FdMbps(true) - } - if obj.obj.Advertise_100HdMbps == nil { - obj.SetAdvertise100HdMbps(true) - } - if obj.obj.Advertise_10FdMbps == nil { - obj.SetAdvertise10FdMbps(true) - } - if obj.obj.Advertise_10HdMbps == nil { - obj.SetAdvertise10HdMbps(true) - } - if obj.obj.LinkTraining == nil { - obj.SetLinkTraining(false) - } - if obj.obj.RsFec == nil { - obj.SetRsFec(false) - } - -} - -// ***** Layer1FlowControl ***** -type layer1FlowControl struct { - validation - obj *otg.Layer1FlowControl - marshaller marshalLayer1FlowControl - unMarshaller unMarshalLayer1FlowControl - ieee_802_1QbbHolder Layer1Ieee8021Qbb - ieee_802_3XHolder Layer1Ieee8023X -} - -func NewLayer1FlowControl() Layer1FlowControl { - obj := layer1FlowControl{obj: &otg.Layer1FlowControl{}} - obj.setDefault() - return &obj -} - -func (obj *layer1FlowControl) msg() *otg.Layer1FlowControl { - return obj.obj -} - -func (obj *layer1FlowControl) setMsg(msg *otg.Layer1FlowControl) Layer1FlowControl { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshallayer1FlowControl struct { - obj *layer1FlowControl -} - -type marshalLayer1FlowControl interface { - // ToProto marshals Layer1FlowControl to protobuf object *otg.Layer1FlowControl - ToProto() (*otg.Layer1FlowControl, error) - // ToPbText marshals Layer1FlowControl to protobuf text - ToPbText() (string, error) - // ToYaml marshals Layer1FlowControl to YAML text - ToYaml() (string, error) - // ToJson marshals Layer1FlowControl to JSON text - ToJson() (string, error) -} - -type unMarshallayer1FlowControl struct { - obj *layer1FlowControl -} - -type unMarshalLayer1FlowControl interface { - // FromProto unmarshals Layer1FlowControl from protobuf object *otg.Layer1FlowControl - FromProto(msg *otg.Layer1FlowControl) (Layer1FlowControl, error) - // FromPbText unmarshals Layer1FlowControl from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Layer1FlowControl from YAML text - FromYaml(value string) error - // FromJson unmarshals Layer1FlowControl from JSON text - FromJson(value string) error -} - -func (obj *layer1FlowControl) Marshal() marshalLayer1FlowControl { - if obj.marshaller == nil { - obj.marshaller = &marshallayer1FlowControl{obj: obj} - } - return obj.marshaller -} - -func (obj *layer1FlowControl) Unmarshal() unMarshalLayer1FlowControl { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallayer1FlowControl{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallayer1FlowControl) ToProto() (*otg.Layer1FlowControl, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallayer1FlowControl) FromProto(msg *otg.Layer1FlowControl) (Layer1FlowControl, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallayer1FlowControl) 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 *unMarshallayer1FlowControl) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshallayer1FlowControl) 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 *unMarshallayer1FlowControl) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshallayer1FlowControl) 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 *unMarshallayer1FlowControl) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *layer1FlowControl) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *layer1FlowControl) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *layer1FlowControl) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *layer1FlowControl) Clone() (Layer1FlowControl, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLayer1FlowControl() - 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 -} - -func (obj *layer1FlowControl) setNil() { - obj.ieee_802_1QbbHolder = nil - obj.ieee_802_3XHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// Layer1FlowControl is a container for layer1 receive flow control settings. -// To enable flow control settings on ports this object must be a valid -// object not a null value. -type Layer1FlowControl interface { - Validation - // msg marshals Layer1FlowControl to protobuf object *otg.Layer1FlowControl - // and doesn't set defaults - msg() *otg.Layer1FlowControl - // setMsg unmarshals Layer1FlowControl from protobuf object *otg.Layer1FlowControl - // and doesn't set defaults - setMsg(*otg.Layer1FlowControl) Layer1FlowControl - // provides marshal interface - Marshal() marshalLayer1FlowControl - // provides unmarshal interface - Unmarshal() unMarshalLayer1FlowControl - // validate validates Layer1FlowControl - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Layer1FlowControl, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // DirectedAddress returns string, set in Layer1FlowControl. - DirectedAddress() string - // SetDirectedAddress assigns string provided by user to Layer1FlowControl - SetDirectedAddress(value string) Layer1FlowControl - // HasDirectedAddress checks if DirectedAddress has been set in Layer1FlowControl - HasDirectedAddress() bool - // Choice returns Layer1FlowControlChoiceEnum, set in Layer1FlowControl - Choice() Layer1FlowControlChoiceEnum - // setChoice assigns Layer1FlowControlChoiceEnum provided by user to Layer1FlowControl - setChoice(value Layer1FlowControlChoiceEnum) Layer1FlowControl - // HasChoice checks if Choice has been set in Layer1FlowControl - HasChoice() bool - // Ieee8021Qbb returns Layer1Ieee8021Qbb, set in Layer1FlowControl. - Ieee8021Qbb() Layer1Ieee8021Qbb - // SetIeee8021Qbb assigns Layer1Ieee8021Qbb provided by user to Layer1FlowControl. - SetIeee8021Qbb(value Layer1Ieee8021Qbb) Layer1FlowControl - // HasIeee8021Qbb checks if Ieee8021Qbb has been set in Layer1FlowControl - HasIeee8021Qbb() bool - // Ieee8023X returns Layer1Ieee8023X, set in Layer1FlowControl. - Ieee8023X() Layer1Ieee8023X - // SetIeee8023X assigns Layer1Ieee8023X provided by user to Layer1FlowControl. - SetIeee8023X(value Layer1Ieee8023X) Layer1FlowControl - // HasIeee8023X checks if Ieee8023X has been set in Layer1FlowControl - HasIeee8023X() bool - setNil() -} - -// The 48bit mac address that the layer1 port names will listen on -// for a directed pause. -// DirectedAddress returns a string -func (obj *layer1FlowControl) DirectedAddress() string { - - return *obj.obj.DirectedAddress - -} - -// The 48bit mac address that the layer1 port names will listen on -// for a directed pause. -// DirectedAddress returns a string -func (obj *layer1FlowControl) HasDirectedAddress() bool { - return obj.obj.DirectedAddress != nil -} - -// The 48bit mac address that the layer1 port names will listen on -// for a directed pause. -// SetDirectedAddress sets the string value in the Layer1FlowControl object -func (obj *layer1FlowControl) SetDirectedAddress(value string) Layer1FlowControl { - - obj.obj.DirectedAddress = &value - return obj -} - -type Layer1FlowControlChoiceEnum string - -// Enum of Choice on Layer1FlowControl -var Layer1FlowControlChoice = struct { - IEEE_802_1QBB Layer1FlowControlChoiceEnum - IEEE_802_3X Layer1FlowControlChoiceEnum -}{ - IEEE_802_1QBB: Layer1FlowControlChoiceEnum("ieee_802_1qbb"), - IEEE_802_3X: Layer1FlowControlChoiceEnum("ieee_802_3x"), -} - -func (obj *layer1FlowControl) Choice() Layer1FlowControlChoiceEnum { - return Layer1FlowControlChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The type of priority flow control. -// Choice returns a string -func (obj *layer1FlowControl) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *layer1FlowControl) setChoice(value Layer1FlowControlChoiceEnum) Layer1FlowControl { - intValue, ok := otg.Layer1FlowControl_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on Layer1FlowControlChoiceEnum", string(value))) - return obj - } - enumValue := otg.Layer1FlowControl_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Ieee_802_3X = nil - obj.ieee_802_3XHolder = nil - obj.obj.Ieee_802_1Qbb = nil - obj.ieee_802_1QbbHolder = nil - - if value == Layer1FlowControlChoice.IEEE_802_1QBB { - obj.obj.Ieee_802_1Qbb = NewLayer1Ieee8021Qbb().msg() - } - - if value == Layer1FlowControlChoice.IEEE_802_3X { - obj.obj.Ieee_802_3X = NewLayer1Ieee8023X().msg() - } - - return obj -} - -// description is TBD -// Ieee8021Qbb returns a Layer1Ieee8021Qbb -func (obj *layer1FlowControl) Ieee8021Qbb() Layer1Ieee8021Qbb { - if obj.obj.Ieee_802_1Qbb == nil { - obj.setChoice(Layer1FlowControlChoice.IEEE_802_1QBB) - } - if obj.ieee_802_1QbbHolder == nil { - obj.ieee_802_1QbbHolder = &layer1Ieee8021Qbb{obj: obj.obj.Ieee_802_1Qbb} - } - return obj.ieee_802_1QbbHolder -} - -// description is TBD -// Ieee8021Qbb returns a Layer1Ieee8021Qbb -func (obj *layer1FlowControl) HasIeee8021Qbb() bool { - return obj.obj.Ieee_802_1Qbb != nil -} - -// description is TBD -// SetIeee8021Qbb sets the Layer1Ieee8021Qbb value in the Layer1FlowControl object -func (obj *layer1FlowControl) SetIeee8021Qbb(value Layer1Ieee8021Qbb) Layer1FlowControl { - obj.setChoice(Layer1FlowControlChoice.IEEE_802_1QBB) - obj.ieee_802_1QbbHolder = nil - obj.obj.Ieee_802_1Qbb = value.msg() - - return obj -} - -// description is TBD -// Ieee8023X returns a Layer1Ieee8023X -func (obj *layer1FlowControl) Ieee8023X() Layer1Ieee8023X { - if obj.obj.Ieee_802_3X == nil { - obj.setChoice(Layer1FlowControlChoice.IEEE_802_3X) - } - if obj.ieee_802_3XHolder == nil { - obj.ieee_802_3XHolder = &layer1Ieee8023X{obj: obj.obj.Ieee_802_3X} - } - return obj.ieee_802_3XHolder -} - -// description is TBD -// Ieee8023X returns a Layer1Ieee8023X -func (obj *layer1FlowControl) HasIeee8023X() bool { - return obj.obj.Ieee_802_3X != nil -} - -// description is TBD -// SetIeee8023X sets the Layer1Ieee8023X value in the Layer1FlowControl object -func (obj *layer1FlowControl) SetIeee8023X(value Layer1Ieee8023X) Layer1FlowControl { - obj.setChoice(Layer1FlowControlChoice.IEEE_802_3X) - obj.ieee_802_3XHolder = nil - obj.obj.Ieee_802_3X = value.msg() - - return obj -} - -func (obj *layer1FlowControl) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.DirectedAddress != nil { - - err := obj.validateMac(obj.DirectedAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on Layer1FlowControl.DirectedAddress")) - } - - } - - if obj.obj.Ieee_802_1Qbb != nil { - - obj.Ieee8021Qbb().validateObj(vObj, set_default) - } - - if obj.obj.Ieee_802_3X != nil { - - obj.Ieee8023X().validateObj(vObj, set_default) - } - -} - -func (obj *layer1FlowControl) setDefault() { - var choices_set int = 0 - var choice Layer1FlowControlChoiceEnum - - if obj.obj.Ieee_802_1Qbb != nil { - choices_set += 1 - choice = Layer1FlowControlChoice.IEEE_802_1QBB - } - - if obj.obj.Ieee_802_3X != nil { - choices_set += 1 - choice = Layer1FlowControlChoice.IEEE_802_3X - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(Layer1FlowControlChoice.IEEE_802_1QBB) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in Layer1FlowControl") - } - } else { - intVal := otg.Layer1FlowControl_Choice_Enum_value[string(choice)] - enumValue := otg.Layer1FlowControl_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - - if obj.obj.DirectedAddress == nil { - obj.SetDirectedAddress("01:80:C2:00:00:01") - } - -} - -// ***** CaptureFilter ***** -type captureFilter struct { - validation - obj *otg.CaptureFilter - marshaller marshalCaptureFilter - unMarshaller unMarshalCaptureFilter - customHolder CaptureCustom - ethernetHolder CaptureEthernet - vlanHolder CaptureVlan - ipv4Holder CaptureIpv4 - ipv6Holder CaptureIpv6 -} - -func NewCaptureFilter() CaptureFilter { - obj := captureFilter{obj: &otg.CaptureFilter{}} - obj.setDefault() - return &obj -} - -func (obj *captureFilter) msg() *otg.CaptureFilter { - return obj.obj -} - -func (obj *captureFilter) setMsg(msg *otg.CaptureFilter) CaptureFilter { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalcaptureFilter struct { - obj *captureFilter -} - -type marshalCaptureFilter interface { - // ToProto marshals CaptureFilter to protobuf object *otg.CaptureFilter - ToProto() (*otg.CaptureFilter, error) - // ToPbText marshals CaptureFilter to protobuf text - ToPbText() (string, error) - // ToYaml marshals CaptureFilter to YAML text - ToYaml() (string, error) - // ToJson marshals CaptureFilter to JSON text - ToJson() (string, error) -} - -type unMarshalcaptureFilter struct { - obj *captureFilter -} - -type unMarshalCaptureFilter interface { - // FromProto unmarshals CaptureFilter from protobuf object *otg.CaptureFilter - FromProto(msg *otg.CaptureFilter) (CaptureFilter, error) - // FromPbText unmarshals CaptureFilter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals CaptureFilter from YAML text - FromYaml(value string) error - // FromJson unmarshals CaptureFilter from JSON text - FromJson(value string) error -} - -func (obj *captureFilter) Marshal() marshalCaptureFilter { - if obj.marshaller == nil { - obj.marshaller = &marshalcaptureFilter{obj: obj} - } - return obj.marshaller -} - -func (obj *captureFilter) Unmarshal() unMarshalCaptureFilter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalcaptureFilter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalcaptureFilter) ToProto() (*otg.CaptureFilter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalcaptureFilter) FromProto(msg *otg.CaptureFilter) (CaptureFilter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalcaptureFilter) 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 *unMarshalcaptureFilter) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalcaptureFilter) 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 *unMarshalcaptureFilter) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalcaptureFilter) 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 *unMarshalcaptureFilter) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *captureFilter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *captureFilter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *captureFilter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *captureFilter) Clone() (CaptureFilter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewCaptureFilter() - 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 -} - -func (obj *captureFilter) setNil() { - obj.customHolder = nil - obj.ethernetHolder = nil - obj.vlanHolder = nil - obj.ipv4Holder = nil - obj.ipv6Holder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// CaptureFilter is configuration for capture filters -type CaptureFilter interface { - Validation - // msg marshals CaptureFilter to protobuf object *otg.CaptureFilter - // and doesn't set defaults - msg() *otg.CaptureFilter - // setMsg unmarshals CaptureFilter from protobuf object *otg.CaptureFilter - // and doesn't set defaults - setMsg(*otg.CaptureFilter) CaptureFilter - // provides marshal interface - Marshal() marshalCaptureFilter - // provides unmarshal interface - Unmarshal() unMarshalCaptureFilter - // validate validates CaptureFilter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (CaptureFilter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns CaptureFilterChoiceEnum, set in CaptureFilter - Choice() CaptureFilterChoiceEnum - // setChoice assigns CaptureFilterChoiceEnum provided by user to CaptureFilter - setChoice(value CaptureFilterChoiceEnum) CaptureFilter - // HasChoice checks if Choice has been set in CaptureFilter - HasChoice() bool - // Custom returns CaptureCustom, set in CaptureFilter. - // CaptureCustom is description is TBD - Custom() CaptureCustom - // SetCustom assigns CaptureCustom provided by user to CaptureFilter. - // CaptureCustom is description is TBD - SetCustom(value CaptureCustom) CaptureFilter - // HasCustom checks if Custom has been set in CaptureFilter - HasCustom() bool - // Ethernet returns CaptureEthernet, set in CaptureFilter. - // CaptureEthernet is description is TBD - Ethernet() CaptureEthernet - // SetEthernet assigns CaptureEthernet provided by user to CaptureFilter. - // CaptureEthernet is description is TBD - SetEthernet(value CaptureEthernet) CaptureFilter - // HasEthernet checks if Ethernet has been set in CaptureFilter - HasEthernet() bool - // Vlan returns CaptureVlan, set in CaptureFilter. - // CaptureVlan is description is TBD - Vlan() CaptureVlan - // SetVlan assigns CaptureVlan provided by user to CaptureFilter. - // CaptureVlan is description is TBD - SetVlan(value CaptureVlan) CaptureFilter - // HasVlan checks if Vlan has been set in CaptureFilter - HasVlan() bool - // Ipv4 returns CaptureIpv4, set in CaptureFilter. - // CaptureIpv4 is description is TBD - Ipv4() CaptureIpv4 - // SetIpv4 assigns CaptureIpv4 provided by user to CaptureFilter. - // CaptureIpv4 is description is TBD - SetIpv4(value CaptureIpv4) CaptureFilter - // HasIpv4 checks if Ipv4 has been set in CaptureFilter - HasIpv4() bool - // Ipv6 returns CaptureIpv6, set in CaptureFilter. - // CaptureIpv6 is description is TBD - Ipv6() CaptureIpv6 - // SetIpv6 assigns CaptureIpv6 provided by user to CaptureFilter. - // CaptureIpv6 is description is TBD - SetIpv6(value CaptureIpv6) CaptureFilter - // HasIpv6 checks if Ipv6 has been set in CaptureFilter - HasIpv6() bool - setNil() -} - -type CaptureFilterChoiceEnum string - -// Enum of Choice on CaptureFilter -var CaptureFilterChoice = struct { - CUSTOM CaptureFilterChoiceEnum - ETHERNET CaptureFilterChoiceEnum - VLAN CaptureFilterChoiceEnum - IPV4 CaptureFilterChoiceEnum - IPV6 CaptureFilterChoiceEnum -}{ - CUSTOM: CaptureFilterChoiceEnum("custom"), - ETHERNET: CaptureFilterChoiceEnum("ethernet"), - VLAN: CaptureFilterChoiceEnum("vlan"), - IPV4: CaptureFilterChoiceEnum("ipv4"), - IPV6: CaptureFilterChoiceEnum("ipv6"), -} - -func (obj *captureFilter) Choice() CaptureFilterChoiceEnum { - return CaptureFilterChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The type of capture filter. -// Choice returns a string -func (obj *captureFilter) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *captureFilter) setChoice(value CaptureFilterChoiceEnum) CaptureFilter { - intValue, ok := otg.CaptureFilter_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on CaptureFilterChoiceEnum", string(value))) - return obj - } - enumValue := otg.CaptureFilter_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Ipv6 = nil - obj.ipv6Holder = nil - obj.obj.Ipv4 = nil - obj.ipv4Holder = nil - obj.obj.Vlan = nil - obj.vlanHolder = nil - obj.obj.Ethernet = nil - obj.ethernetHolder = nil - obj.obj.Custom = nil - obj.customHolder = nil - - if value == CaptureFilterChoice.CUSTOM { - obj.obj.Custom = NewCaptureCustom().msg() - } - - if value == CaptureFilterChoice.ETHERNET { - obj.obj.Ethernet = NewCaptureEthernet().msg() - } - - if value == CaptureFilterChoice.VLAN { - obj.obj.Vlan = NewCaptureVlan().msg() - } - - if value == CaptureFilterChoice.IPV4 { - obj.obj.Ipv4 = NewCaptureIpv4().msg() - } - - if value == CaptureFilterChoice.IPV6 { - obj.obj.Ipv6 = NewCaptureIpv6().msg() - } - - return obj -} - -// Offset from last filter in the list. If no filters are present it is offset from position 0. Multiple custom filters can be present, the length of each custom filter is the length of the value being filtered. -// Custom returns a CaptureCustom -func (obj *captureFilter) Custom() CaptureCustom { - if obj.obj.Custom == nil { - obj.setChoice(CaptureFilterChoice.CUSTOM) - } - if obj.customHolder == nil { - obj.customHolder = &captureCustom{obj: obj.obj.Custom} - } - return obj.customHolder -} - -// Offset from last filter in the list. If no filters are present it is offset from position 0. Multiple custom filters can be present, the length of each custom filter is the length of the value being filtered. -// Custom returns a CaptureCustom -func (obj *captureFilter) HasCustom() bool { - return obj.obj.Custom != nil -} - -// Offset from last filter in the list. If no filters are present it is offset from position 0. Multiple custom filters can be present, the length of each custom filter is the length of the value being filtered. -// SetCustom sets the CaptureCustom value in the CaptureFilter object -func (obj *captureFilter) SetCustom(value CaptureCustom) CaptureFilter { - obj.setChoice(CaptureFilterChoice.CUSTOM) - obj.customHolder = nil - obj.obj.Custom = value.msg() - - return obj -} - -// description is TBD -// Ethernet returns a CaptureEthernet -func (obj *captureFilter) Ethernet() CaptureEthernet { - if obj.obj.Ethernet == nil { - obj.setChoice(CaptureFilterChoice.ETHERNET) - } - if obj.ethernetHolder == nil { - obj.ethernetHolder = &captureEthernet{obj: obj.obj.Ethernet} - } - return obj.ethernetHolder -} - -// description is TBD -// Ethernet returns a CaptureEthernet -func (obj *captureFilter) HasEthernet() bool { - return obj.obj.Ethernet != nil -} - -// description is TBD -// SetEthernet sets the CaptureEthernet value in the CaptureFilter object -func (obj *captureFilter) SetEthernet(value CaptureEthernet) CaptureFilter { - obj.setChoice(CaptureFilterChoice.ETHERNET) - obj.ethernetHolder = nil - obj.obj.Ethernet = value.msg() - - return obj -} - -// description is TBD -// Vlan returns a CaptureVlan -func (obj *captureFilter) Vlan() CaptureVlan { - if obj.obj.Vlan == nil { - obj.setChoice(CaptureFilterChoice.VLAN) - } - if obj.vlanHolder == nil { - obj.vlanHolder = &captureVlan{obj: obj.obj.Vlan} - } - return obj.vlanHolder -} - -// description is TBD -// Vlan returns a CaptureVlan -func (obj *captureFilter) HasVlan() bool { - return obj.obj.Vlan != nil -} - -// description is TBD -// SetVlan sets the CaptureVlan value in the CaptureFilter object -func (obj *captureFilter) SetVlan(value CaptureVlan) CaptureFilter { - obj.setChoice(CaptureFilterChoice.VLAN) - obj.vlanHolder = nil - obj.obj.Vlan = value.msg() - - return obj -} - -// description is TBD -// Ipv4 returns a CaptureIpv4 -func (obj *captureFilter) Ipv4() CaptureIpv4 { - if obj.obj.Ipv4 == nil { - obj.setChoice(CaptureFilterChoice.IPV4) - } - if obj.ipv4Holder == nil { - obj.ipv4Holder = &captureIpv4{obj: obj.obj.Ipv4} - } - return obj.ipv4Holder -} - -// description is TBD -// Ipv4 returns a CaptureIpv4 -func (obj *captureFilter) HasIpv4() bool { - return obj.obj.Ipv4 != nil -} - -// description is TBD -// SetIpv4 sets the CaptureIpv4 value in the CaptureFilter object -func (obj *captureFilter) SetIpv4(value CaptureIpv4) CaptureFilter { - obj.setChoice(CaptureFilterChoice.IPV4) - obj.ipv4Holder = nil - obj.obj.Ipv4 = value.msg() - - return obj -} - -// description is TBD -// Ipv6 returns a CaptureIpv6 -func (obj *captureFilter) Ipv6() CaptureIpv6 { - if obj.obj.Ipv6 == nil { - obj.setChoice(CaptureFilterChoice.IPV6) - } - if obj.ipv6Holder == nil { - obj.ipv6Holder = &captureIpv6{obj: obj.obj.Ipv6} - } - return obj.ipv6Holder -} - -// description is TBD -// Ipv6 returns a CaptureIpv6 -func (obj *captureFilter) HasIpv6() bool { - return obj.obj.Ipv6 != nil -} - -// description is TBD -// SetIpv6 sets the CaptureIpv6 value in the CaptureFilter object -func (obj *captureFilter) SetIpv6(value CaptureIpv6) CaptureFilter { - obj.setChoice(CaptureFilterChoice.IPV6) - obj.ipv6Holder = nil - obj.obj.Ipv6 = value.msg() - - return obj -} - -func (obj *captureFilter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Custom != nil { - - obj.Custom().validateObj(vObj, set_default) - } - - if obj.obj.Ethernet != nil { - - obj.Ethernet().validateObj(vObj, set_default) - } - - if obj.obj.Vlan != nil { - - obj.Vlan().validateObj(vObj, set_default) - } - - if obj.obj.Ipv4 != nil { - - obj.Ipv4().validateObj(vObj, set_default) - } - - if obj.obj.Ipv6 != nil { - - obj.Ipv6().validateObj(vObj, set_default) - } - -} - -func (obj *captureFilter) setDefault() { - var choices_set int = 0 - var choice CaptureFilterChoiceEnum - - if obj.obj.Custom != nil { - choices_set += 1 - choice = CaptureFilterChoice.CUSTOM - } - - if obj.obj.Ethernet != nil { - choices_set += 1 - choice = CaptureFilterChoice.ETHERNET - } - - if obj.obj.Vlan != nil { - choices_set += 1 - choice = CaptureFilterChoice.VLAN - } - - if obj.obj.Ipv4 != nil { - choices_set += 1 - choice = CaptureFilterChoice.IPV4 - } - - if obj.obj.Ipv6 != nil { - choices_set += 1 - choice = CaptureFilterChoice.IPV6 - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(CaptureFilterChoice.CUSTOM) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in CaptureFilter") - } - } else { - intVal := otg.CaptureFilter_Choice_Enum_value[string(choice)] - enumValue := otg.CaptureFilter_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** DeviceEthernet ***** -type deviceEthernet struct { - validation - obj *otg.DeviceEthernet - marshaller marshalDeviceEthernet - unMarshaller unMarshalDeviceEthernet - connectionHolder EthernetConnection - ipv4AddressesHolder DeviceEthernetDeviceIpv4Iter - ipv6AddressesHolder DeviceEthernetDeviceIpv6Iter - vlansHolder DeviceEthernetDeviceVlanIter - dhcpv4InterfacesHolder DeviceEthernetDeviceDhcpv4ClientIter -} - -func NewDeviceEthernet() DeviceEthernet { - obj := deviceEthernet{obj: &otg.DeviceEthernet{}} - obj.setDefault() - return &obj -} - -func (obj *deviceEthernet) msg() *otg.DeviceEthernet { - return obj.obj -} - -func (obj *deviceEthernet) setMsg(msg *otg.DeviceEthernet) DeviceEthernet { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceEthernet struct { - obj *deviceEthernet -} - -type marshalDeviceEthernet interface { - // ToProto marshals DeviceEthernet to protobuf object *otg.DeviceEthernet - ToProto() (*otg.DeviceEthernet, error) - // ToPbText marshals DeviceEthernet to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceEthernet to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceEthernet to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceEthernet struct { - obj *deviceEthernet -} - -type unMarshalDeviceEthernet interface { - // FromProto unmarshals DeviceEthernet from protobuf object *otg.DeviceEthernet - FromProto(msg *otg.DeviceEthernet) (DeviceEthernet, error) - // FromPbText unmarshals DeviceEthernet from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceEthernet from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceEthernet from JSON text - FromJson(value string) error -} - -func (obj *deviceEthernet) Marshal() marshalDeviceEthernet { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceEthernet{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceEthernet) Unmarshal() unMarshalDeviceEthernet { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceEthernet{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceEthernet) ToProto() (*otg.DeviceEthernet, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceEthernet) FromProto(msg *otg.DeviceEthernet) (DeviceEthernet, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceEthernet) 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 *unMarshaldeviceEthernet) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshaldeviceEthernet) 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 *unMarshaldeviceEthernet) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshaldeviceEthernet) 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 *unMarshaldeviceEthernet) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *deviceEthernet) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceEthernet) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceEthernet) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceEthernet) Clone() (DeviceEthernet, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceEthernet() - 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 -} - -func (obj *deviceEthernet) setNil() { - obj.connectionHolder = nil - obj.ipv4AddressesHolder = nil - obj.ipv6AddressesHolder = nil - obj.vlansHolder = nil - obj.dhcpv4InterfacesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// DeviceEthernet is an Ethernet interface with IPv4 and IPv6 addresses. -type DeviceEthernet interface { - Validation - // msg marshals DeviceEthernet to protobuf object *otg.DeviceEthernet - // and doesn't set defaults - msg() *otg.DeviceEthernet - // setMsg unmarshals DeviceEthernet from protobuf object *otg.DeviceEthernet - // and doesn't set defaults - setMsg(*otg.DeviceEthernet) DeviceEthernet - // provides marshal interface - Marshal() marshalDeviceEthernet - // provides unmarshal interface - Unmarshal() unMarshalDeviceEthernet - // validate validates DeviceEthernet - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceEthernet, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Connection returns EthernetConnection, set in DeviceEthernet. - // EthernetConnection is ethernet interface connection to a port, LAG or VXLAN tunnel. - Connection() EthernetConnection - // SetConnection assigns EthernetConnection provided by user to DeviceEthernet. - // EthernetConnection is ethernet interface connection to a port, LAG or VXLAN tunnel. - SetConnection(value EthernetConnection) DeviceEthernet - // HasConnection checks if Connection has been set in DeviceEthernet - HasConnection() bool - // Ipv4Addresses returns DeviceEthernetDeviceIpv4IterIter, set in DeviceEthernet - Ipv4Addresses() DeviceEthernetDeviceIpv4Iter - // Ipv6Addresses returns DeviceEthernetDeviceIpv6IterIter, set in DeviceEthernet - Ipv6Addresses() DeviceEthernetDeviceIpv6Iter - // Mac returns string, set in DeviceEthernet. - Mac() string - // SetMac assigns string provided by user to DeviceEthernet - SetMac(value string) DeviceEthernet - // Mtu returns uint32, set in DeviceEthernet. - Mtu() uint32 - // SetMtu assigns uint32 provided by user to DeviceEthernet - SetMtu(value uint32) DeviceEthernet - // HasMtu checks if Mtu has been set in DeviceEthernet - HasMtu() bool - // Vlans returns DeviceEthernetDeviceVlanIterIter, set in DeviceEthernet - Vlans() DeviceEthernetDeviceVlanIter - // Name returns string, set in DeviceEthernet. - Name() string - // SetName assigns string provided by user to DeviceEthernet - SetName(value string) DeviceEthernet - // Dhcpv4Interfaces returns DeviceEthernetDeviceDhcpv4ClientIterIter, set in DeviceEthernet - Dhcpv4Interfaces() DeviceEthernetDeviceDhcpv4ClientIter - setNil() -} - -// Device connection to physical, LAG or another device. -// Connection returns a EthernetConnection -func (obj *deviceEthernet) Connection() EthernetConnection { - if obj.obj.Connection == nil { - obj.obj.Connection = NewEthernetConnection().msg() - } - if obj.connectionHolder == nil { - obj.connectionHolder = ðernetConnection{obj: obj.obj.Connection} - } - return obj.connectionHolder -} - -// Device connection to physical, LAG or another device. -// Connection returns a EthernetConnection -func (obj *deviceEthernet) HasConnection() bool { - return obj.obj.Connection != nil -} - -// Device connection to physical, LAG or another device. -// SetConnection sets the EthernetConnection value in the DeviceEthernet object -func (obj *deviceEthernet) SetConnection(value EthernetConnection) DeviceEthernet { - - obj.connectionHolder = nil - obj.obj.Connection = value.msg() - - return obj -} - -// List of IPv4 addresses and their gateways. -// Ipv4Addresses returns a []DeviceIpv4 -func (obj *deviceEthernet) Ipv4Addresses() DeviceEthernetDeviceIpv4Iter { - if len(obj.obj.Ipv4Addresses) == 0 { - obj.obj.Ipv4Addresses = []*otg.DeviceIpv4{} - } - if obj.ipv4AddressesHolder == nil { - obj.ipv4AddressesHolder = newDeviceEthernetDeviceIpv4Iter(&obj.obj.Ipv4Addresses).setMsg(obj) - } - return obj.ipv4AddressesHolder -} - -type deviceEthernetDeviceIpv4Iter struct { - obj *deviceEthernet - deviceIpv4Slice []DeviceIpv4 - fieldPtr *[]*otg.DeviceIpv4 -} - -func newDeviceEthernetDeviceIpv4Iter(ptr *[]*otg.DeviceIpv4) DeviceEthernetDeviceIpv4Iter { - return &deviceEthernetDeviceIpv4Iter{fieldPtr: ptr} -} - -type DeviceEthernetDeviceIpv4Iter interface { - setMsg(*deviceEthernet) DeviceEthernetDeviceIpv4Iter - Items() []DeviceIpv4 - Add() DeviceIpv4 - Append(items ...DeviceIpv4) DeviceEthernetDeviceIpv4Iter - Set(index int, newObj DeviceIpv4) DeviceEthernetDeviceIpv4Iter - Clear() DeviceEthernetDeviceIpv4Iter - clearHolderSlice() DeviceEthernetDeviceIpv4Iter - appendHolderSlice(item DeviceIpv4) DeviceEthernetDeviceIpv4Iter -} - -func (obj *deviceEthernetDeviceIpv4Iter) setMsg(msg *deviceEthernet) DeviceEthernetDeviceIpv4Iter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&deviceIpv4{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceEthernetDeviceIpv4Iter) Items() []DeviceIpv4 { - return obj.deviceIpv4Slice -} - -func (obj *deviceEthernetDeviceIpv4Iter) Add() DeviceIpv4 { - newObj := &otg.DeviceIpv4{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &deviceIpv4{obj: newObj} - newLibObj.setDefault() - obj.deviceIpv4Slice = append(obj.deviceIpv4Slice, newLibObj) - return newLibObj -} - -func (obj *deviceEthernetDeviceIpv4Iter) Append(items ...DeviceIpv4) DeviceEthernetDeviceIpv4Iter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.deviceIpv4Slice = append(obj.deviceIpv4Slice, item) - } - return obj -} - -func (obj *deviceEthernetDeviceIpv4Iter) Set(index int, newObj DeviceIpv4) DeviceEthernetDeviceIpv4Iter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.deviceIpv4Slice[index] = newObj - return obj -} -func (obj *deviceEthernetDeviceIpv4Iter) Clear() DeviceEthernetDeviceIpv4Iter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.DeviceIpv4{} - obj.deviceIpv4Slice = []DeviceIpv4{} - } - return obj -} -func (obj *deviceEthernetDeviceIpv4Iter) clearHolderSlice() DeviceEthernetDeviceIpv4Iter { - if len(obj.deviceIpv4Slice) > 0 { - obj.deviceIpv4Slice = []DeviceIpv4{} - } - return obj -} -func (obj *deviceEthernetDeviceIpv4Iter) appendHolderSlice(item DeviceIpv4) DeviceEthernetDeviceIpv4Iter { - obj.deviceIpv4Slice = append(obj.deviceIpv4Slice, item) - return obj -} - -// List of global IPv6 addresses and their gateways. -// The Link Local IPv6 address will be automatically generated. -// Ipv6Addresses returns a []DeviceIpv6 -func (obj *deviceEthernet) Ipv6Addresses() DeviceEthernetDeviceIpv6Iter { - if len(obj.obj.Ipv6Addresses) == 0 { - obj.obj.Ipv6Addresses = []*otg.DeviceIpv6{} - } - if obj.ipv6AddressesHolder == nil { - obj.ipv6AddressesHolder = newDeviceEthernetDeviceIpv6Iter(&obj.obj.Ipv6Addresses).setMsg(obj) - } - return obj.ipv6AddressesHolder -} - -type deviceEthernetDeviceIpv6Iter struct { - obj *deviceEthernet - deviceIpv6Slice []DeviceIpv6 - fieldPtr *[]*otg.DeviceIpv6 -} - -func newDeviceEthernetDeviceIpv6Iter(ptr *[]*otg.DeviceIpv6) DeviceEthernetDeviceIpv6Iter { - return &deviceEthernetDeviceIpv6Iter{fieldPtr: ptr} -} - -type DeviceEthernetDeviceIpv6Iter interface { - setMsg(*deviceEthernet) DeviceEthernetDeviceIpv6Iter - Items() []DeviceIpv6 - Add() DeviceIpv6 - Append(items ...DeviceIpv6) DeviceEthernetDeviceIpv6Iter - Set(index int, newObj DeviceIpv6) DeviceEthernetDeviceIpv6Iter - Clear() DeviceEthernetDeviceIpv6Iter - clearHolderSlice() DeviceEthernetDeviceIpv6Iter - appendHolderSlice(item DeviceIpv6) DeviceEthernetDeviceIpv6Iter -} - -func (obj *deviceEthernetDeviceIpv6Iter) setMsg(msg *deviceEthernet) DeviceEthernetDeviceIpv6Iter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&deviceIpv6{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceEthernetDeviceIpv6Iter) Items() []DeviceIpv6 { - return obj.deviceIpv6Slice -} - -func (obj *deviceEthernetDeviceIpv6Iter) Add() DeviceIpv6 { - newObj := &otg.DeviceIpv6{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &deviceIpv6{obj: newObj} - newLibObj.setDefault() - obj.deviceIpv6Slice = append(obj.deviceIpv6Slice, newLibObj) - return newLibObj -} - -func (obj *deviceEthernetDeviceIpv6Iter) Append(items ...DeviceIpv6) DeviceEthernetDeviceIpv6Iter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.deviceIpv6Slice = append(obj.deviceIpv6Slice, item) - } - return obj -} - -func (obj *deviceEthernetDeviceIpv6Iter) Set(index int, newObj DeviceIpv6) DeviceEthernetDeviceIpv6Iter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.deviceIpv6Slice[index] = newObj - return obj -} -func (obj *deviceEthernetDeviceIpv6Iter) Clear() DeviceEthernetDeviceIpv6Iter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.DeviceIpv6{} - obj.deviceIpv6Slice = []DeviceIpv6{} - } - return obj -} -func (obj *deviceEthernetDeviceIpv6Iter) clearHolderSlice() DeviceEthernetDeviceIpv6Iter { - if len(obj.deviceIpv6Slice) > 0 { - obj.deviceIpv6Slice = []DeviceIpv6{} - } - return obj -} -func (obj *deviceEthernetDeviceIpv6Iter) appendHolderSlice(item DeviceIpv6) DeviceEthernetDeviceIpv6Iter { - obj.deviceIpv6Slice = append(obj.deviceIpv6Slice, item) - return obj -} - -// Media Access Control address. -// Mac returns a string -func (obj *deviceEthernet) Mac() string { - - return *obj.obj.Mac - -} - -// Media Access Control address. -// SetMac sets the string value in the DeviceEthernet object -func (obj *deviceEthernet) SetMac(value string) DeviceEthernet { - - obj.obj.Mac = &value - return obj -} - -// Maximum Transmission Unit. -// Mtu returns a uint32 -func (obj *deviceEthernet) Mtu() uint32 { - - return *obj.obj.Mtu - -} - -// Maximum Transmission Unit. -// Mtu returns a uint32 -func (obj *deviceEthernet) HasMtu() bool { - return obj.obj.Mtu != nil -} - -// Maximum Transmission Unit. -// SetMtu sets the uint32 value in the DeviceEthernet object -func (obj *deviceEthernet) SetMtu(value uint32) DeviceEthernet { - - obj.obj.Mtu = &value - return obj -} - -// List of VLANs -// Vlans returns a []DeviceVlan -func (obj *deviceEthernet) Vlans() DeviceEthernetDeviceVlanIter { - if len(obj.obj.Vlans) == 0 { - obj.obj.Vlans = []*otg.DeviceVlan{} - } - if obj.vlansHolder == nil { - obj.vlansHolder = newDeviceEthernetDeviceVlanIter(&obj.obj.Vlans).setMsg(obj) - } - return obj.vlansHolder -} - -type deviceEthernetDeviceVlanIter struct { - obj *deviceEthernet - deviceVlanSlice []DeviceVlan - fieldPtr *[]*otg.DeviceVlan -} - -func newDeviceEthernetDeviceVlanIter(ptr *[]*otg.DeviceVlan) DeviceEthernetDeviceVlanIter { - return &deviceEthernetDeviceVlanIter{fieldPtr: ptr} -} - -type DeviceEthernetDeviceVlanIter interface { - setMsg(*deviceEthernet) DeviceEthernetDeviceVlanIter - Items() []DeviceVlan - Add() DeviceVlan - Append(items ...DeviceVlan) DeviceEthernetDeviceVlanIter - Set(index int, newObj DeviceVlan) DeviceEthernetDeviceVlanIter - Clear() DeviceEthernetDeviceVlanIter - clearHolderSlice() DeviceEthernetDeviceVlanIter - appendHolderSlice(item DeviceVlan) DeviceEthernetDeviceVlanIter -} - -func (obj *deviceEthernetDeviceVlanIter) setMsg(msg *deviceEthernet) DeviceEthernetDeviceVlanIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&deviceVlan{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceEthernetDeviceVlanIter) Items() []DeviceVlan { - return obj.deviceVlanSlice -} - -func (obj *deviceEthernetDeviceVlanIter) Add() DeviceVlan { - newObj := &otg.DeviceVlan{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &deviceVlan{obj: newObj} - newLibObj.setDefault() - obj.deviceVlanSlice = append(obj.deviceVlanSlice, newLibObj) - return newLibObj -} - -func (obj *deviceEthernetDeviceVlanIter) Append(items ...DeviceVlan) DeviceEthernetDeviceVlanIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.deviceVlanSlice = append(obj.deviceVlanSlice, item) - } - return obj -} - -func (obj *deviceEthernetDeviceVlanIter) Set(index int, newObj DeviceVlan) DeviceEthernetDeviceVlanIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.deviceVlanSlice[index] = newObj - return obj -} -func (obj *deviceEthernetDeviceVlanIter) Clear() DeviceEthernetDeviceVlanIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.DeviceVlan{} - obj.deviceVlanSlice = []DeviceVlan{} - } - return obj -} -func (obj *deviceEthernetDeviceVlanIter) clearHolderSlice() DeviceEthernetDeviceVlanIter { - if len(obj.deviceVlanSlice) > 0 { - obj.deviceVlanSlice = []DeviceVlan{} - } - return obj -} -func (obj *deviceEthernetDeviceVlanIter) appendHolderSlice(item DeviceVlan) DeviceEthernetDeviceVlanIter { - obj.deviceVlanSlice = append(obj.deviceVlanSlice, item) - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *deviceEthernet) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the DeviceEthernet object -func (obj *deviceEthernet) SetName(value string) DeviceEthernet { - - obj.obj.Name = &value - return obj -} - -// List of DHCPv4 Clients Configuration. -// Dhcpv4Interfaces returns a []DeviceDhcpv4Client -func (obj *deviceEthernet) Dhcpv4Interfaces() DeviceEthernetDeviceDhcpv4ClientIter { - if len(obj.obj.Dhcpv4Interfaces) == 0 { - obj.obj.Dhcpv4Interfaces = []*otg.DeviceDhcpv4Client{} - } - if obj.dhcpv4InterfacesHolder == nil { - obj.dhcpv4InterfacesHolder = newDeviceEthernetDeviceDhcpv4ClientIter(&obj.obj.Dhcpv4Interfaces).setMsg(obj) - } - return obj.dhcpv4InterfacesHolder -} - -type deviceEthernetDeviceDhcpv4ClientIter struct { - obj *deviceEthernet - deviceDhcpv4ClientSlice []DeviceDhcpv4Client - fieldPtr *[]*otg.DeviceDhcpv4Client -} - -func newDeviceEthernetDeviceDhcpv4ClientIter(ptr *[]*otg.DeviceDhcpv4Client) DeviceEthernetDeviceDhcpv4ClientIter { - return &deviceEthernetDeviceDhcpv4ClientIter{fieldPtr: ptr} -} - -type DeviceEthernetDeviceDhcpv4ClientIter interface { - setMsg(*deviceEthernet) DeviceEthernetDeviceDhcpv4ClientIter - Items() []DeviceDhcpv4Client - Add() DeviceDhcpv4Client - Append(items ...DeviceDhcpv4Client) DeviceEthernetDeviceDhcpv4ClientIter - Set(index int, newObj DeviceDhcpv4Client) DeviceEthernetDeviceDhcpv4ClientIter - Clear() DeviceEthernetDeviceDhcpv4ClientIter - clearHolderSlice() DeviceEthernetDeviceDhcpv4ClientIter - appendHolderSlice(item DeviceDhcpv4Client) DeviceEthernetDeviceDhcpv4ClientIter -} - -func (obj *deviceEthernetDeviceDhcpv4ClientIter) setMsg(msg *deviceEthernet) DeviceEthernetDeviceDhcpv4ClientIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&deviceDhcpv4Client{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceEthernetDeviceDhcpv4ClientIter) Items() []DeviceDhcpv4Client { - return obj.deviceDhcpv4ClientSlice -} - -func (obj *deviceEthernetDeviceDhcpv4ClientIter) Add() DeviceDhcpv4Client { - newObj := &otg.DeviceDhcpv4Client{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &deviceDhcpv4Client{obj: newObj} - newLibObj.setDefault() - obj.deviceDhcpv4ClientSlice = append(obj.deviceDhcpv4ClientSlice, newLibObj) - return newLibObj -} - -func (obj *deviceEthernetDeviceDhcpv4ClientIter) Append(items ...DeviceDhcpv4Client) DeviceEthernetDeviceDhcpv4ClientIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.deviceDhcpv4ClientSlice = append(obj.deviceDhcpv4ClientSlice, item) - } - return obj -} - -func (obj *deviceEthernetDeviceDhcpv4ClientIter) Set(index int, newObj DeviceDhcpv4Client) DeviceEthernetDeviceDhcpv4ClientIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.deviceDhcpv4ClientSlice[index] = newObj - return obj -} -func (obj *deviceEthernetDeviceDhcpv4ClientIter) Clear() DeviceEthernetDeviceDhcpv4ClientIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.DeviceDhcpv4Client{} - obj.deviceDhcpv4ClientSlice = []DeviceDhcpv4Client{} - } - return obj -} -func (obj *deviceEthernetDeviceDhcpv4ClientIter) clearHolderSlice() DeviceEthernetDeviceDhcpv4ClientIter { - if len(obj.deviceDhcpv4ClientSlice) > 0 { - obj.deviceDhcpv4ClientSlice = []DeviceDhcpv4Client{} - } - return obj -} -func (obj *deviceEthernetDeviceDhcpv4ClientIter) appendHolderSlice(item DeviceDhcpv4Client) DeviceEthernetDeviceDhcpv4ClientIter { - obj.deviceDhcpv4ClientSlice = append(obj.deviceDhcpv4ClientSlice, item) - return obj -} - -func (obj *deviceEthernet) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Connection != nil { - - obj.Connection().validateObj(vObj, set_default) - } - - if len(obj.obj.Ipv4Addresses) != 0 { - - if set_default { - obj.Ipv4Addresses().clearHolderSlice() - for _, item := range obj.obj.Ipv4Addresses { - obj.Ipv4Addresses().appendHolderSlice(&deviceIpv4{obj: item}) - } - } - for _, item := range obj.Ipv4Addresses().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Ipv6Addresses) != 0 { - - if set_default { - obj.Ipv6Addresses().clearHolderSlice() - for _, item := range obj.obj.Ipv6Addresses { - obj.Ipv6Addresses().appendHolderSlice(&deviceIpv6{obj: item}) - } - } - for _, item := range obj.Ipv6Addresses().Items() { - item.validateObj(vObj, set_default) - } - - } - - // Mac is required - if obj.obj.Mac == nil { - vObj.validationErrors = append(vObj.validationErrors, "Mac is required field on interface DeviceEthernet") - } - if obj.obj.Mac != nil { - - err := obj.validateMac(obj.Mac()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceEthernet.Mac")) - } - - } - - if obj.obj.Mtu != nil { - - if *obj.obj.Mtu > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= DeviceEthernet.Mtu <= 65535 but Got %d", *obj.obj.Mtu)) - } - - } - - if len(obj.obj.Vlans) != 0 { - - if set_default { - obj.Vlans().clearHolderSlice() - for _, item := range obj.obj.Vlans { - obj.Vlans().appendHolderSlice(&deviceVlan{obj: item}) - } - } - for _, item := range obj.Vlans().Items() { - item.validateObj(vObj, set_default) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceEthernet") - } - - if len(obj.obj.Dhcpv4Interfaces) != 0 { - - if set_default { - obj.Dhcpv4Interfaces().clearHolderSlice() - for _, item := range obj.obj.Dhcpv4Interfaces { - obj.Dhcpv4Interfaces().appendHolderSlice(&deviceDhcpv4Client{obj: item}) - } - } - for _, item := range obj.Dhcpv4Interfaces().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *deviceEthernet) setDefault() { - if obj.obj.Mtu == nil { - obj.SetMtu(1500) - } - -} - -// ***** DeviceIpv4Loopback ***** -type deviceIpv4Loopback struct { - validation - obj *otg.DeviceIpv4Loopback - marshaller marshalDeviceIpv4Loopback - unMarshaller unMarshalDeviceIpv4Loopback -} - -func NewDeviceIpv4Loopback() DeviceIpv4Loopback { - obj := deviceIpv4Loopback{obj: &otg.DeviceIpv4Loopback{}} - obj.setDefault() - return &obj -} - -func (obj *deviceIpv4Loopback) msg() *otg.DeviceIpv4Loopback { - return obj.obj -} - -func (obj *deviceIpv4Loopback) setMsg(msg *otg.DeviceIpv4Loopback) DeviceIpv4Loopback { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceIpv4Loopback struct { - obj *deviceIpv4Loopback -} - -type marshalDeviceIpv4Loopback interface { - // ToProto marshals DeviceIpv4Loopback to protobuf object *otg.DeviceIpv4Loopback - ToProto() (*otg.DeviceIpv4Loopback, error) - // ToPbText marshals DeviceIpv4Loopback to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceIpv4Loopback to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceIpv4Loopback to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceIpv4Loopback struct { - obj *deviceIpv4Loopback -} - -type unMarshalDeviceIpv4Loopback interface { - // FromProto unmarshals DeviceIpv4Loopback from protobuf object *otg.DeviceIpv4Loopback - FromProto(msg *otg.DeviceIpv4Loopback) (DeviceIpv4Loopback, error) - // FromPbText unmarshals DeviceIpv4Loopback from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceIpv4Loopback from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceIpv4Loopback from JSON text - FromJson(value string) error -} - -func (obj *deviceIpv4Loopback) Marshal() marshalDeviceIpv4Loopback { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceIpv4Loopback{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceIpv4Loopback) Unmarshal() unMarshalDeviceIpv4Loopback { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceIpv4Loopback{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceIpv4Loopback) ToProto() (*otg.DeviceIpv4Loopback, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceIpv4Loopback) FromProto(msg *otg.DeviceIpv4Loopback) (DeviceIpv4Loopback, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceIpv4Loopback) 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 *unMarshaldeviceIpv4Loopback) 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 *marshaldeviceIpv4Loopback) 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 *unMarshaldeviceIpv4Loopback) 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 *marshaldeviceIpv4Loopback) 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 *unMarshaldeviceIpv4Loopback) 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 *deviceIpv4Loopback) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceIpv4Loopback) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceIpv4Loopback) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceIpv4Loopback) Clone() (DeviceIpv4Loopback, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceIpv4Loopback() - 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 -} - -// DeviceIpv4Loopback is an IPv4 Loopback interface. -type DeviceIpv4Loopback interface { - Validation - // msg marshals DeviceIpv4Loopback to protobuf object *otg.DeviceIpv4Loopback - // and doesn't set defaults - msg() *otg.DeviceIpv4Loopback - // setMsg unmarshals DeviceIpv4Loopback from protobuf object *otg.DeviceIpv4Loopback - // and doesn't set defaults - setMsg(*otg.DeviceIpv4Loopback) DeviceIpv4Loopback - // provides marshal interface - Marshal() marshalDeviceIpv4Loopback - // provides unmarshal interface - Unmarshal() unMarshalDeviceIpv4Loopback - // validate validates DeviceIpv4Loopback - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceIpv4Loopback, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // EthName returns string, set in DeviceIpv4Loopback. - EthName() string - // SetEthName assigns string provided by user to DeviceIpv4Loopback - SetEthName(value string) DeviceIpv4Loopback - // Address returns string, set in DeviceIpv4Loopback. - Address() string - // SetAddress assigns string provided by user to DeviceIpv4Loopback - SetAddress(value string) DeviceIpv4Loopback - // HasAddress checks if Address has been set in DeviceIpv4Loopback - HasAddress() bool - // Name returns string, set in DeviceIpv4Loopback. - Name() string - // SetName assigns string provided by user to DeviceIpv4Loopback - SetName(value string) DeviceIpv4Loopback -} - -// The unique name of the Ethernet interface behind which this Loopback interface will be created. -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// EthName returns a string -func (obj *deviceIpv4Loopback) EthName() string { - - return *obj.obj.EthName - -} - -// The unique name of the Ethernet interface behind which this Loopback interface will be created. -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// SetEthName sets the string value in the DeviceIpv4Loopback object -func (obj *deviceIpv4Loopback) SetEthName(value string) DeviceIpv4Loopback { - - obj.obj.EthName = &value - return obj -} - -// The IPv4 Loopback address with prefix length of 32. -// Address returns a string -func (obj *deviceIpv4Loopback) Address() string { - - return *obj.obj.Address - -} - -// The IPv4 Loopback address with prefix length of 32. -// Address returns a string -func (obj *deviceIpv4Loopback) HasAddress() bool { - return obj.obj.Address != nil -} - -// The IPv4 Loopback address with prefix length of 32. -// SetAddress sets the string value in the DeviceIpv4Loopback object -func (obj *deviceIpv4Loopback) SetAddress(value string) DeviceIpv4Loopback { - - obj.obj.Address = &value - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *deviceIpv4Loopback) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the DeviceIpv4Loopback object -func (obj *deviceIpv4Loopback) SetName(value string) DeviceIpv4Loopback { - - obj.obj.Name = &value - return obj -} - -func (obj *deviceIpv4Loopback) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // EthName is required - if obj.obj.EthName == nil { - vObj.validationErrors = append(vObj.validationErrors, "EthName is required field on interface DeviceIpv4Loopback") - } - - if obj.obj.Address != nil { - - err := obj.validateIpv4(obj.Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv4Loopback.Address")) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceIpv4Loopback") - } -} - -func (obj *deviceIpv4Loopback) setDefault() { - if obj.obj.Address == nil { - obj.SetAddress("0.0.0.0") - } - -} - -// ***** DeviceIpv6Loopback ***** -type deviceIpv6Loopback struct { - validation - obj *otg.DeviceIpv6Loopback - marshaller marshalDeviceIpv6Loopback - unMarshaller unMarshalDeviceIpv6Loopback -} - -func NewDeviceIpv6Loopback() DeviceIpv6Loopback { - obj := deviceIpv6Loopback{obj: &otg.DeviceIpv6Loopback{}} - obj.setDefault() - return &obj -} - -func (obj *deviceIpv6Loopback) msg() *otg.DeviceIpv6Loopback { - return obj.obj -} - -func (obj *deviceIpv6Loopback) setMsg(msg *otg.DeviceIpv6Loopback) DeviceIpv6Loopback { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceIpv6Loopback struct { - obj *deviceIpv6Loopback -} - -type marshalDeviceIpv6Loopback interface { - // ToProto marshals DeviceIpv6Loopback to protobuf object *otg.DeviceIpv6Loopback - ToProto() (*otg.DeviceIpv6Loopback, error) - // ToPbText marshals DeviceIpv6Loopback to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceIpv6Loopback to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceIpv6Loopback to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceIpv6Loopback struct { - obj *deviceIpv6Loopback -} - -type unMarshalDeviceIpv6Loopback interface { - // FromProto unmarshals DeviceIpv6Loopback from protobuf object *otg.DeviceIpv6Loopback - FromProto(msg *otg.DeviceIpv6Loopback) (DeviceIpv6Loopback, error) - // FromPbText unmarshals DeviceIpv6Loopback from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceIpv6Loopback from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceIpv6Loopback from JSON text - FromJson(value string) error -} - -func (obj *deviceIpv6Loopback) Marshal() marshalDeviceIpv6Loopback { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceIpv6Loopback{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceIpv6Loopback) Unmarshal() unMarshalDeviceIpv6Loopback { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceIpv6Loopback{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceIpv6Loopback) ToProto() (*otg.DeviceIpv6Loopback, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceIpv6Loopback) FromProto(msg *otg.DeviceIpv6Loopback) (DeviceIpv6Loopback, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceIpv6Loopback) 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 *unMarshaldeviceIpv6Loopback) 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 *marshaldeviceIpv6Loopback) 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 *unMarshaldeviceIpv6Loopback) 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 *marshaldeviceIpv6Loopback) 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 *unMarshaldeviceIpv6Loopback) 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 *deviceIpv6Loopback) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceIpv6Loopback) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceIpv6Loopback) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceIpv6Loopback) Clone() (DeviceIpv6Loopback, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceIpv6Loopback() - 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 -} - -// DeviceIpv6Loopback is an IPv6 Loopback interface -type DeviceIpv6Loopback interface { - Validation - // msg marshals DeviceIpv6Loopback to protobuf object *otg.DeviceIpv6Loopback - // and doesn't set defaults - msg() *otg.DeviceIpv6Loopback - // setMsg unmarshals DeviceIpv6Loopback from protobuf object *otg.DeviceIpv6Loopback - // and doesn't set defaults - setMsg(*otg.DeviceIpv6Loopback) DeviceIpv6Loopback - // provides marshal interface - Marshal() marshalDeviceIpv6Loopback - // provides unmarshal interface - Unmarshal() unMarshalDeviceIpv6Loopback - // validate validates DeviceIpv6Loopback - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceIpv6Loopback, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // EthName returns string, set in DeviceIpv6Loopback. - EthName() string - // SetEthName assigns string provided by user to DeviceIpv6Loopback - SetEthName(value string) DeviceIpv6Loopback - // Address returns string, set in DeviceIpv6Loopback. - Address() string - // SetAddress assigns string provided by user to DeviceIpv6Loopback - SetAddress(value string) DeviceIpv6Loopback - // HasAddress checks if Address has been set in DeviceIpv6Loopback - HasAddress() bool - // Name returns string, set in DeviceIpv6Loopback. - Name() string - // SetName assigns string provided by user to DeviceIpv6Loopback - SetName(value string) DeviceIpv6Loopback -} - -// The unique name of the Ethernet interface behind which this Loopback -// interface will be created. -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// EthName returns a string -func (obj *deviceIpv6Loopback) EthName() string { - - return *obj.obj.EthName - -} - -// The unique name of the Ethernet interface behind which this Loopback -// interface will be created. -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// SetEthName sets the string value in the DeviceIpv6Loopback object -func (obj *deviceIpv6Loopback) SetEthName(value string) DeviceIpv6Loopback { - - obj.obj.EthName = &value - return obj -} - -// The IPv6 Loopback address with prefix length of 128. -// Address returns a string -func (obj *deviceIpv6Loopback) Address() string { - - return *obj.obj.Address - -} - -// The IPv6 Loopback address with prefix length of 128. -// Address returns a string -func (obj *deviceIpv6Loopback) HasAddress() bool { - return obj.obj.Address != nil -} - -// The IPv6 Loopback address with prefix length of 128. -// SetAddress sets the string value in the DeviceIpv6Loopback object -func (obj *deviceIpv6Loopback) SetAddress(value string) DeviceIpv6Loopback { - - obj.obj.Address = &value - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *deviceIpv6Loopback) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the DeviceIpv6Loopback object -func (obj *deviceIpv6Loopback) SetName(value string) DeviceIpv6Loopback { - - obj.obj.Name = &value - return obj -} - -func (obj *deviceIpv6Loopback) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // EthName is required - if obj.obj.EthName == nil { - vObj.validationErrors = append(vObj.validationErrors, "EthName is required field on interface DeviceIpv6Loopback") - } - - if obj.obj.Address != nil { - - err := obj.validateIpv6(obj.Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv6Loopback.Address")) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceIpv6Loopback") - } -} - -func (obj *deviceIpv6Loopback) setDefault() { - if obj.obj.Address == nil { - obj.SetAddress("::0") - } - -} - -// ***** DeviceIsisRouter ***** -type deviceIsisRouter struct { - validation - obj *otg.DeviceIsisRouter - marshaller marshalDeviceIsisRouter - unMarshaller unMarshalDeviceIsisRouter - instanceHolder DeviceIsisMultiInstance - interfacesHolder DeviceIsisRouterIsisInterfaceIter - basicHolder IsisBasic - advancedHolder IsisAdvanced - routerAuthHolder IsisAuthentication - v4RoutesHolder DeviceIsisRouterIsisV4RouteRangeIter - v6RoutesHolder DeviceIsisRouterIsisV6RouteRangeIter -} - -func NewDeviceIsisRouter() DeviceIsisRouter { - obj := deviceIsisRouter{obj: &otg.DeviceIsisRouter{}} - obj.setDefault() - return &obj -} - -func (obj *deviceIsisRouter) msg() *otg.DeviceIsisRouter { - return obj.obj -} - -func (obj *deviceIsisRouter) setMsg(msg *otg.DeviceIsisRouter) DeviceIsisRouter { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceIsisRouter struct { - obj *deviceIsisRouter -} - -type marshalDeviceIsisRouter interface { - // ToProto marshals DeviceIsisRouter to protobuf object *otg.DeviceIsisRouter - ToProto() (*otg.DeviceIsisRouter, error) - // ToPbText marshals DeviceIsisRouter to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceIsisRouter to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceIsisRouter to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceIsisRouter struct { - obj *deviceIsisRouter -} - -type unMarshalDeviceIsisRouter interface { - // FromProto unmarshals DeviceIsisRouter from protobuf object *otg.DeviceIsisRouter - FromProto(msg *otg.DeviceIsisRouter) (DeviceIsisRouter, error) - // FromPbText unmarshals DeviceIsisRouter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceIsisRouter from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceIsisRouter from JSON text - FromJson(value string) error -} - -func (obj *deviceIsisRouter) Marshal() marshalDeviceIsisRouter { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceIsisRouter{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceIsisRouter) Unmarshal() unMarshalDeviceIsisRouter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceIsisRouter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceIsisRouter) ToProto() (*otg.DeviceIsisRouter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceIsisRouter) FromProto(msg *otg.DeviceIsisRouter) (DeviceIsisRouter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceIsisRouter) 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 *unMarshaldeviceIsisRouter) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshaldeviceIsisRouter) 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 *unMarshaldeviceIsisRouter) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshaldeviceIsisRouter) 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 *unMarshaldeviceIsisRouter) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *deviceIsisRouter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceIsisRouter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceIsisRouter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceIsisRouter) Clone() (DeviceIsisRouter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceIsisRouter() - 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 -} - -func (obj *deviceIsisRouter) setNil() { - obj.instanceHolder = nil - obj.interfacesHolder = nil - obj.basicHolder = nil - obj.advancedHolder = nil - obj.routerAuthHolder = nil - obj.v4RoutesHolder = nil - obj.v6RoutesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// DeviceIsisRouter is a container of properties for an ISIS router and its interfaces. -type DeviceIsisRouter interface { - Validation - // msg marshals DeviceIsisRouter to protobuf object *otg.DeviceIsisRouter - // and doesn't set defaults - msg() *otg.DeviceIsisRouter - // setMsg unmarshals DeviceIsisRouter from protobuf object *otg.DeviceIsisRouter - // and doesn't set defaults - setMsg(*otg.DeviceIsisRouter) DeviceIsisRouter - // provides marshal interface - Marshal() marshalDeviceIsisRouter - // provides unmarshal interface - Unmarshal() unMarshalDeviceIsisRouter - // validate validates DeviceIsisRouter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceIsisRouter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Instance returns DeviceIsisMultiInstance, set in DeviceIsisRouter. - // DeviceIsisMultiInstance is this container properties of an Multi-Instance-capable router (MI-RTR). - Instance() DeviceIsisMultiInstance - // SetInstance assigns DeviceIsisMultiInstance provided by user to DeviceIsisRouter. - // DeviceIsisMultiInstance is this container properties of an Multi-Instance-capable router (MI-RTR). - SetInstance(value DeviceIsisMultiInstance) DeviceIsisRouter - // HasInstance checks if Instance has been set in DeviceIsisRouter - HasInstance() bool - // SystemId returns string, set in DeviceIsisRouter. - SystemId() string - // SetSystemId assigns string provided by user to DeviceIsisRouter - SetSystemId(value string) DeviceIsisRouter - // Interfaces returns DeviceIsisRouterIsisInterfaceIterIter, set in DeviceIsisRouter - Interfaces() DeviceIsisRouterIsisInterfaceIter - // Basic returns IsisBasic, set in DeviceIsisRouter. - // IsisBasic is this contains ISIS router basic properties. - Basic() IsisBasic - // SetBasic assigns IsisBasic provided by user to DeviceIsisRouter. - // IsisBasic is this contains ISIS router basic properties. - SetBasic(value IsisBasic) DeviceIsisRouter - // HasBasic checks if Basic has been set in DeviceIsisRouter - HasBasic() bool - // Advanced returns IsisAdvanced, set in DeviceIsisRouter. - // IsisAdvanced is contains ISIS router advanced properties. - Advanced() IsisAdvanced - // SetAdvanced assigns IsisAdvanced provided by user to DeviceIsisRouter. - // IsisAdvanced is contains ISIS router advanced properties. - SetAdvanced(value IsisAdvanced) DeviceIsisRouter - // HasAdvanced checks if Advanced has been set in DeviceIsisRouter - HasAdvanced() bool - // RouterAuth returns IsisAuthentication, set in DeviceIsisRouter. - // IsisAuthentication is this contains ISIS Area/Domain authentication properties. - RouterAuth() IsisAuthentication - // SetRouterAuth assigns IsisAuthentication provided by user to DeviceIsisRouter. - // IsisAuthentication is this contains ISIS Area/Domain authentication properties. - SetRouterAuth(value IsisAuthentication) DeviceIsisRouter - // HasRouterAuth checks if RouterAuth has been set in DeviceIsisRouter - HasRouterAuth() bool - // V4Routes returns DeviceIsisRouterIsisV4RouteRangeIterIter, set in DeviceIsisRouter - V4Routes() DeviceIsisRouterIsisV4RouteRangeIter - // V6Routes returns DeviceIsisRouterIsisV6RouteRangeIterIter, set in DeviceIsisRouter - V6Routes() DeviceIsisRouterIsisV6RouteRangeIter - // Name returns string, set in DeviceIsisRouter. - Name() string - // SetName assigns string provided by user to DeviceIsisRouter - SetName(value string) DeviceIsisRouter - setNil() -} - -// This contains the properties of a Multi-Instance-capable routers or MI-RTR. Each router can emulate one ISIS instance at a time. -// Instance returns a DeviceIsisMultiInstance -func (obj *deviceIsisRouter) Instance() DeviceIsisMultiInstance { - if obj.obj.Instance == nil { - obj.obj.Instance = NewDeviceIsisMultiInstance().msg() - } - if obj.instanceHolder == nil { - obj.instanceHolder = &deviceIsisMultiInstance{obj: obj.obj.Instance} - } - return obj.instanceHolder -} - -// This contains the properties of a Multi-Instance-capable routers or MI-RTR. Each router can emulate one ISIS instance at a time. -// Instance returns a DeviceIsisMultiInstance -func (obj *deviceIsisRouter) HasInstance() bool { - return obj.obj.Instance != nil -} - -// This contains the properties of a Multi-Instance-capable routers or MI-RTR. Each router can emulate one ISIS instance at a time. -// SetInstance sets the DeviceIsisMultiInstance value in the DeviceIsisRouter object -func (obj *deviceIsisRouter) SetInstance(value DeviceIsisMultiInstance) DeviceIsisRouter { - - obj.instanceHolder = nil - obj.obj.Instance = value.msg() - - return obj -} - -// The System ID for this emulated ISIS router, e.g. "640100010000". -// SystemId returns a string -func (obj *deviceIsisRouter) SystemId() string { - - return *obj.obj.SystemId - -} - -// The System ID for this emulated ISIS router, e.g. "640100010000". -// SetSystemId sets the string value in the DeviceIsisRouter object -func (obj *deviceIsisRouter) SetSystemId(value string) DeviceIsisRouter { - - obj.obj.SystemId = &value - return obj -} - -// List of ISIS interfaces for this router. -// Interfaces returns a []IsisInterface -func (obj *deviceIsisRouter) Interfaces() DeviceIsisRouterIsisInterfaceIter { - if len(obj.obj.Interfaces) == 0 { - obj.obj.Interfaces = []*otg.IsisInterface{} - } - if obj.interfacesHolder == nil { - obj.interfacesHolder = newDeviceIsisRouterIsisInterfaceIter(&obj.obj.Interfaces).setMsg(obj) - } - return obj.interfacesHolder -} - -type deviceIsisRouterIsisInterfaceIter struct { - obj *deviceIsisRouter - isisInterfaceSlice []IsisInterface - fieldPtr *[]*otg.IsisInterface -} - -func newDeviceIsisRouterIsisInterfaceIter(ptr *[]*otg.IsisInterface) DeviceIsisRouterIsisInterfaceIter { - return &deviceIsisRouterIsisInterfaceIter{fieldPtr: ptr} -} - -type DeviceIsisRouterIsisInterfaceIter interface { - setMsg(*deviceIsisRouter) DeviceIsisRouterIsisInterfaceIter - Items() []IsisInterface - Add() IsisInterface - Append(items ...IsisInterface) DeviceIsisRouterIsisInterfaceIter - Set(index int, newObj IsisInterface) DeviceIsisRouterIsisInterfaceIter - Clear() DeviceIsisRouterIsisInterfaceIter - clearHolderSlice() DeviceIsisRouterIsisInterfaceIter - appendHolderSlice(item IsisInterface) DeviceIsisRouterIsisInterfaceIter -} - -func (obj *deviceIsisRouterIsisInterfaceIter) setMsg(msg *deviceIsisRouter) DeviceIsisRouterIsisInterfaceIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisInterface{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceIsisRouterIsisInterfaceIter) Items() []IsisInterface { - return obj.isisInterfaceSlice -} - -func (obj *deviceIsisRouterIsisInterfaceIter) Add() IsisInterface { - newObj := &otg.IsisInterface{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisInterface{obj: newObj} - newLibObj.setDefault() - obj.isisInterfaceSlice = append(obj.isisInterfaceSlice, newLibObj) - return newLibObj -} - -func (obj *deviceIsisRouterIsisInterfaceIter) Append(items ...IsisInterface) DeviceIsisRouterIsisInterfaceIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisInterfaceSlice = append(obj.isisInterfaceSlice, item) - } - return obj -} - -func (obj *deviceIsisRouterIsisInterfaceIter) Set(index int, newObj IsisInterface) DeviceIsisRouterIsisInterfaceIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisInterfaceSlice[index] = newObj - return obj -} -func (obj *deviceIsisRouterIsisInterfaceIter) Clear() DeviceIsisRouterIsisInterfaceIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisInterface{} - obj.isisInterfaceSlice = []IsisInterface{} - } - return obj -} -func (obj *deviceIsisRouterIsisInterfaceIter) clearHolderSlice() DeviceIsisRouterIsisInterfaceIter { - if len(obj.isisInterfaceSlice) > 0 { - obj.isisInterfaceSlice = []IsisInterface{} - } - return obj -} -func (obj *deviceIsisRouterIsisInterfaceIter) appendHolderSlice(item IsisInterface) DeviceIsisRouterIsisInterfaceIter { - obj.isisInterfaceSlice = append(obj.isisInterfaceSlice, item) - return obj -} - -// Contains basic properties of an ISIS Router. -// Basic returns a IsisBasic -func (obj *deviceIsisRouter) Basic() IsisBasic { - if obj.obj.Basic == nil { - obj.obj.Basic = NewIsisBasic().msg() - } - if obj.basicHolder == nil { - obj.basicHolder = &isisBasic{obj: obj.obj.Basic} - } - return obj.basicHolder -} - -// Contains basic properties of an ISIS Router. -// Basic returns a IsisBasic -func (obj *deviceIsisRouter) HasBasic() bool { - return obj.obj.Basic != nil -} - -// Contains basic properties of an ISIS Router. -// SetBasic sets the IsisBasic value in the DeviceIsisRouter object -func (obj *deviceIsisRouter) SetBasic(value IsisBasic) DeviceIsisRouter { - - obj.basicHolder = nil - obj.obj.Basic = value.msg() - - return obj -} - -// Contains advance properties of an ISIS Router.. -// Advanced returns a IsisAdvanced -func (obj *deviceIsisRouter) Advanced() IsisAdvanced { - if obj.obj.Advanced == nil { - obj.obj.Advanced = NewIsisAdvanced().msg() - } - if obj.advancedHolder == nil { - obj.advancedHolder = &isisAdvanced{obj: obj.obj.Advanced} - } - return obj.advancedHolder -} - -// Contains advance properties of an ISIS Router.. -// Advanced returns a IsisAdvanced -func (obj *deviceIsisRouter) HasAdvanced() bool { - return obj.obj.Advanced != nil -} - -// Contains advance properties of an ISIS Router.. -// SetAdvanced sets the IsisAdvanced value in the DeviceIsisRouter object -func (obj *deviceIsisRouter) SetAdvanced(value IsisAdvanced) DeviceIsisRouter { - - obj.advancedHolder = nil - obj.obj.Advanced = value.msg() - - return obj -} - -// ISIS Router authentication properties. -// RouterAuth returns a IsisAuthentication -func (obj *deviceIsisRouter) RouterAuth() IsisAuthentication { - if obj.obj.RouterAuth == nil { - obj.obj.RouterAuth = NewIsisAuthentication().msg() - } - if obj.routerAuthHolder == nil { - obj.routerAuthHolder = &isisAuthentication{obj: obj.obj.RouterAuth} - } - return obj.routerAuthHolder -} - -// ISIS Router authentication properties. -// RouterAuth returns a IsisAuthentication -func (obj *deviceIsisRouter) HasRouterAuth() bool { - return obj.obj.RouterAuth != nil -} - -// ISIS Router authentication properties. -// SetRouterAuth sets the IsisAuthentication value in the DeviceIsisRouter object -func (obj *deviceIsisRouter) SetRouterAuth(value IsisAuthentication) DeviceIsisRouter { - - obj.routerAuthHolder = nil - obj.obj.RouterAuth = value.msg() - - return obj -} - -// Emulated ISIS IPv4 routes. -// V4Routes returns a []IsisV4RouteRange -func (obj *deviceIsisRouter) V4Routes() DeviceIsisRouterIsisV4RouteRangeIter { - if len(obj.obj.V4Routes) == 0 { - obj.obj.V4Routes = []*otg.IsisV4RouteRange{} - } - if obj.v4RoutesHolder == nil { - obj.v4RoutesHolder = newDeviceIsisRouterIsisV4RouteRangeIter(&obj.obj.V4Routes).setMsg(obj) - } - return obj.v4RoutesHolder -} - -type deviceIsisRouterIsisV4RouteRangeIter struct { - obj *deviceIsisRouter - isisV4RouteRangeSlice []IsisV4RouteRange - fieldPtr *[]*otg.IsisV4RouteRange -} - -func newDeviceIsisRouterIsisV4RouteRangeIter(ptr *[]*otg.IsisV4RouteRange) DeviceIsisRouterIsisV4RouteRangeIter { - return &deviceIsisRouterIsisV4RouteRangeIter{fieldPtr: ptr} -} - -type DeviceIsisRouterIsisV4RouteRangeIter interface { - setMsg(*deviceIsisRouter) DeviceIsisRouterIsisV4RouteRangeIter - Items() []IsisV4RouteRange - Add() IsisV4RouteRange - Append(items ...IsisV4RouteRange) DeviceIsisRouterIsisV4RouteRangeIter - Set(index int, newObj IsisV4RouteRange) DeviceIsisRouterIsisV4RouteRangeIter - Clear() DeviceIsisRouterIsisV4RouteRangeIter - clearHolderSlice() DeviceIsisRouterIsisV4RouteRangeIter - appendHolderSlice(item IsisV4RouteRange) DeviceIsisRouterIsisV4RouteRangeIter -} - -func (obj *deviceIsisRouterIsisV4RouteRangeIter) setMsg(msg *deviceIsisRouter) DeviceIsisRouterIsisV4RouteRangeIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisV4RouteRange{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceIsisRouterIsisV4RouteRangeIter) Items() []IsisV4RouteRange { - return obj.isisV4RouteRangeSlice -} - -func (obj *deviceIsisRouterIsisV4RouteRangeIter) Add() IsisV4RouteRange { - newObj := &otg.IsisV4RouteRange{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisV4RouteRange{obj: newObj} - newLibObj.setDefault() - obj.isisV4RouteRangeSlice = append(obj.isisV4RouteRangeSlice, newLibObj) - return newLibObj -} - -func (obj *deviceIsisRouterIsisV4RouteRangeIter) Append(items ...IsisV4RouteRange) DeviceIsisRouterIsisV4RouteRangeIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisV4RouteRangeSlice = append(obj.isisV4RouteRangeSlice, item) - } - return obj -} - -func (obj *deviceIsisRouterIsisV4RouteRangeIter) Set(index int, newObj IsisV4RouteRange) DeviceIsisRouterIsisV4RouteRangeIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisV4RouteRangeSlice[index] = newObj - return obj -} -func (obj *deviceIsisRouterIsisV4RouteRangeIter) Clear() DeviceIsisRouterIsisV4RouteRangeIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisV4RouteRange{} - obj.isisV4RouteRangeSlice = []IsisV4RouteRange{} - } - return obj -} -func (obj *deviceIsisRouterIsisV4RouteRangeIter) clearHolderSlice() DeviceIsisRouterIsisV4RouteRangeIter { - if len(obj.isisV4RouteRangeSlice) > 0 { - obj.isisV4RouteRangeSlice = []IsisV4RouteRange{} - } - return obj -} -func (obj *deviceIsisRouterIsisV4RouteRangeIter) appendHolderSlice(item IsisV4RouteRange) DeviceIsisRouterIsisV4RouteRangeIter { - obj.isisV4RouteRangeSlice = append(obj.isisV4RouteRangeSlice, item) - return obj -} - -// Emulated ISIS IPv6 routes. -// V6Routes returns a []IsisV6RouteRange -func (obj *deviceIsisRouter) V6Routes() DeviceIsisRouterIsisV6RouteRangeIter { - if len(obj.obj.V6Routes) == 0 { - obj.obj.V6Routes = []*otg.IsisV6RouteRange{} - } - if obj.v6RoutesHolder == nil { - obj.v6RoutesHolder = newDeviceIsisRouterIsisV6RouteRangeIter(&obj.obj.V6Routes).setMsg(obj) - } - return obj.v6RoutesHolder -} - -type deviceIsisRouterIsisV6RouteRangeIter struct { - obj *deviceIsisRouter - isisV6RouteRangeSlice []IsisV6RouteRange - fieldPtr *[]*otg.IsisV6RouteRange -} - -func newDeviceIsisRouterIsisV6RouteRangeIter(ptr *[]*otg.IsisV6RouteRange) DeviceIsisRouterIsisV6RouteRangeIter { - return &deviceIsisRouterIsisV6RouteRangeIter{fieldPtr: ptr} -} - -type DeviceIsisRouterIsisV6RouteRangeIter interface { - setMsg(*deviceIsisRouter) DeviceIsisRouterIsisV6RouteRangeIter - Items() []IsisV6RouteRange - Add() IsisV6RouteRange - Append(items ...IsisV6RouteRange) DeviceIsisRouterIsisV6RouteRangeIter - Set(index int, newObj IsisV6RouteRange) DeviceIsisRouterIsisV6RouteRangeIter - Clear() DeviceIsisRouterIsisV6RouteRangeIter - clearHolderSlice() DeviceIsisRouterIsisV6RouteRangeIter - appendHolderSlice(item IsisV6RouteRange) DeviceIsisRouterIsisV6RouteRangeIter -} - -func (obj *deviceIsisRouterIsisV6RouteRangeIter) setMsg(msg *deviceIsisRouter) DeviceIsisRouterIsisV6RouteRangeIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisV6RouteRange{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceIsisRouterIsisV6RouteRangeIter) Items() []IsisV6RouteRange { - return obj.isisV6RouteRangeSlice -} - -func (obj *deviceIsisRouterIsisV6RouteRangeIter) Add() IsisV6RouteRange { - newObj := &otg.IsisV6RouteRange{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisV6RouteRange{obj: newObj} - newLibObj.setDefault() - obj.isisV6RouteRangeSlice = append(obj.isisV6RouteRangeSlice, newLibObj) - return newLibObj -} - -func (obj *deviceIsisRouterIsisV6RouteRangeIter) Append(items ...IsisV6RouteRange) DeviceIsisRouterIsisV6RouteRangeIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisV6RouteRangeSlice = append(obj.isisV6RouteRangeSlice, item) - } - return obj -} - -func (obj *deviceIsisRouterIsisV6RouteRangeIter) Set(index int, newObj IsisV6RouteRange) DeviceIsisRouterIsisV6RouteRangeIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisV6RouteRangeSlice[index] = newObj - return obj -} -func (obj *deviceIsisRouterIsisV6RouteRangeIter) Clear() DeviceIsisRouterIsisV6RouteRangeIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisV6RouteRange{} - obj.isisV6RouteRangeSlice = []IsisV6RouteRange{} - } - return obj -} -func (obj *deviceIsisRouterIsisV6RouteRangeIter) clearHolderSlice() DeviceIsisRouterIsisV6RouteRangeIter { - if len(obj.isisV6RouteRangeSlice) > 0 { - obj.isisV6RouteRangeSlice = []IsisV6RouteRange{} - } - return obj -} -func (obj *deviceIsisRouterIsisV6RouteRangeIter) appendHolderSlice(item IsisV6RouteRange) DeviceIsisRouterIsisV6RouteRangeIter { - obj.isisV6RouteRangeSlice = append(obj.isisV6RouteRangeSlice, item) - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *deviceIsisRouter) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the DeviceIsisRouter object -func (obj *deviceIsisRouter) SetName(value string) DeviceIsisRouter { - - obj.obj.Name = &value - return obj -} - -func (obj *deviceIsisRouter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Instance != nil { - - obj.Instance().validateObj(vObj, set_default) - } - - // SystemId is required - if obj.obj.SystemId == nil { - vObj.validationErrors = append(vObj.validationErrors, "SystemId is required field on interface DeviceIsisRouter") - } - if obj.obj.SystemId != nil { - - err := obj.validateHex(obj.SystemId()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIsisRouter.SystemId")) - } - - } - - if len(obj.obj.Interfaces) != 0 { - - if set_default { - obj.Interfaces().clearHolderSlice() - for _, item := range obj.obj.Interfaces { - obj.Interfaces().appendHolderSlice(&isisInterface{obj: item}) - } - } - for _, item := range obj.Interfaces().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Basic != nil { - - obj.Basic().validateObj(vObj, set_default) - } - - if obj.obj.Advanced != nil { - - obj.Advanced().validateObj(vObj, set_default) - } - - if obj.obj.RouterAuth != nil { - - obj.RouterAuth().validateObj(vObj, set_default) - } - - if len(obj.obj.V4Routes) != 0 { - - if set_default { - obj.V4Routes().clearHolderSlice() - for _, item := range obj.obj.V4Routes { - obj.V4Routes().appendHolderSlice(&isisV4RouteRange{obj: item}) - } - } - for _, item := range obj.V4Routes().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.V6Routes) != 0 { - - if set_default { - obj.V6Routes().clearHolderSlice() - for _, item := range obj.obj.V6Routes { - obj.V6Routes().appendHolderSlice(&isisV6RouteRange{obj: item}) - } - } - for _, item := range obj.V6Routes().Items() { - item.validateObj(vObj, set_default) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceIsisRouter") - } -} - -func (obj *deviceIsisRouter) setDefault() { - -} - -// ***** DeviceBgpRouter ***** -type deviceBgpRouter struct { - validation - obj *otg.DeviceBgpRouter - marshaller marshalDeviceBgpRouter - unMarshaller unMarshalDeviceBgpRouter - ipv4InterfacesHolder DeviceBgpRouterBgpV4InterfaceIter - ipv6InterfacesHolder DeviceBgpRouterBgpV6InterfaceIter -} - -func NewDeviceBgpRouter() DeviceBgpRouter { - obj := deviceBgpRouter{obj: &otg.DeviceBgpRouter{}} - obj.setDefault() - return &obj -} - -func (obj *deviceBgpRouter) msg() *otg.DeviceBgpRouter { - return obj.obj -} - -func (obj *deviceBgpRouter) setMsg(msg *otg.DeviceBgpRouter) DeviceBgpRouter { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceBgpRouter struct { - obj *deviceBgpRouter -} - -type marshalDeviceBgpRouter interface { - // ToProto marshals DeviceBgpRouter to protobuf object *otg.DeviceBgpRouter - ToProto() (*otg.DeviceBgpRouter, error) - // ToPbText marshals DeviceBgpRouter to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceBgpRouter to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceBgpRouter to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceBgpRouter struct { - obj *deviceBgpRouter -} - -type unMarshalDeviceBgpRouter interface { - // FromProto unmarshals DeviceBgpRouter from protobuf object *otg.DeviceBgpRouter - FromProto(msg *otg.DeviceBgpRouter) (DeviceBgpRouter, error) - // FromPbText unmarshals DeviceBgpRouter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceBgpRouter from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceBgpRouter from JSON text - FromJson(value string) error -} - -func (obj *deviceBgpRouter) Marshal() marshalDeviceBgpRouter { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceBgpRouter{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceBgpRouter) Unmarshal() unMarshalDeviceBgpRouter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceBgpRouter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceBgpRouter) ToProto() (*otg.DeviceBgpRouter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceBgpRouter) FromProto(msg *otg.DeviceBgpRouter) (DeviceBgpRouter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceBgpRouter) 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 *unMarshaldeviceBgpRouter) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshaldeviceBgpRouter) 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 *unMarshaldeviceBgpRouter) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshaldeviceBgpRouter) 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 *unMarshaldeviceBgpRouter) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *deviceBgpRouter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceBgpRouter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceBgpRouter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceBgpRouter) Clone() (DeviceBgpRouter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceBgpRouter() - 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 -} - -func (obj *deviceBgpRouter) setNil() { - obj.ipv4InterfacesHolder = nil - obj.ipv6InterfacesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// DeviceBgpRouter is configuration for one or more IPv4 or IPv6 BGP peers. -type DeviceBgpRouter interface { - Validation - // msg marshals DeviceBgpRouter to protobuf object *otg.DeviceBgpRouter - // and doesn't set defaults - msg() *otg.DeviceBgpRouter - // setMsg unmarshals DeviceBgpRouter from protobuf object *otg.DeviceBgpRouter - // and doesn't set defaults - setMsg(*otg.DeviceBgpRouter) DeviceBgpRouter - // provides marshal interface - Marshal() marshalDeviceBgpRouter - // provides unmarshal interface - Unmarshal() unMarshalDeviceBgpRouter - // validate validates DeviceBgpRouter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceBgpRouter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RouterId returns string, set in DeviceBgpRouter. - RouterId() string - // SetRouterId assigns string provided by user to DeviceBgpRouter - SetRouterId(value string) DeviceBgpRouter - // Ipv4Interfaces returns DeviceBgpRouterBgpV4InterfaceIterIter, set in DeviceBgpRouter - Ipv4Interfaces() DeviceBgpRouterBgpV4InterfaceIter - // Ipv6Interfaces returns DeviceBgpRouterBgpV6InterfaceIterIter, set in DeviceBgpRouter - Ipv6Interfaces() DeviceBgpRouterBgpV6InterfaceIter - setNil() -} - -// The BGP router ID is a unique identifier used by BGP. It is a 32-bit value that is often represented by an IPv4 address. -// RouterId returns a string -func (obj *deviceBgpRouter) RouterId() string { - - return *obj.obj.RouterId - -} - -// The BGP router ID is a unique identifier used by BGP. It is a 32-bit value that is often represented by an IPv4 address. -// SetRouterId sets the string value in the DeviceBgpRouter object -func (obj *deviceBgpRouter) SetRouterId(value string) DeviceBgpRouter { - - obj.obj.RouterId = &value - return obj -} - -// This contains an array of references to IPv4 interfaces, each of which will have list of peers to different destinations. -// Ipv4Interfaces returns a []BgpV4Interface -func (obj *deviceBgpRouter) Ipv4Interfaces() DeviceBgpRouterBgpV4InterfaceIter { - if len(obj.obj.Ipv4Interfaces) == 0 { - obj.obj.Ipv4Interfaces = []*otg.BgpV4Interface{} - } - if obj.ipv4InterfacesHolder == nil { - obj.ipv4InterfacesHolder = newDeviceBgpRouterBgpV4InterfaceIter(&obj.obj.Ipv4Interfaces).setMsg(obj) - } - return obj.ipv4InterfacesHolder -} - -type deviceBgpRouterBgpV4InterfaceIter struct { - obj *deviceBgpRouter - bgpV4InterfaceSlice []BgpV4Interface - fieldPtr *[]*otg.BgpV4Interface -} - -func newDeviceBgpRouterBgpV4InterfaceIter(ptr *[]*otg.BgpV4Interface) DeviceBgpRouterBgpV4InterfaceIter { - return &deviceBgpRouterBgpV4InterfaceIter{fieldPtr: ptr} -} - -type DeviceBgpRouterBgpV4InterfaceIter interface { - setMsg(*deviceBgpRouter) DeviceBgpRouterBgpV4InterfaceIter - Items() []BgpV4Interface - Add() BgpV4Interface - Append(items ...BgpV4Interface) DeviceBgpRouterBgpV4InterfaceIter - Set(index int, newObj BgpV4Interface) DeviceBgpRouterBgpV4InterfaceIter - Clear() DeviceBgpRouterBgpV4InterfaceIter - clearHolderSlice() DeviceBgpRouterBgpV4InterfaceIter - appendHolderSlice(item BgpV4Interface) DeviceBgpRouterBgpV4InterfaceIter -} - -func (obj *deviceBgpRouterBgpV4InterfaceIter) setMsg(msg *deviceBgpRouter) DeviceBgpRouterBgpV4InterfaceIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpV4Interface{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceBgpRouterBgpV4InterfaceIter) Items() []BgpV4Interface { - return obj.bgpV4InterfaceSlice -} - -func (obj *deviceBgpRouterBgpV4InterfaceIter) Add() BgpV4Interface { - newObj := &otg.BgpV4Interface{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpV4Interface{obj: newObj} - newLibObj.setDefault() - obj.bgpV4InterfaceSlice = append(obj.bgpV4InterfaceSlice, newLibObj) - return newLibObj -} - -func (obj *deviceBgpRouterBgpV4InterfaceIter) Append(items ...BgpV4Interface) DeviceBgpRouterBgpV4InterfaceIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpV4InterfaceSlice = append(obj.bgpV4InterfaceSlice, item) - } - return obj -} - -func (obj *deviceBgpRouterBgpV4InterfaceIter) Set(index int, newObj BgpV4Interface) DeviceBgpRouterBgpV4InterfaceIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpV4InterfaceSlice[index] = newObj - return obj -} -func (obj *deviceBgpRouterBgpV4InterfaceIter) Clear() DeviceBgpRouterBgpV4InterfaceIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpV4Interface{} - obj.bgpV4InterfaceSlice = []BgpV4Interface{} - } - return obj -} -func (obj *deviceBgpRouterBgpV4InterfaceIter) clearHolderSlice() DeviceBgpRouterBgpV4InterfaceIter { - if len(obj.bgpV4InterfaceSlice) > 0 { - obj.bgpV4InterfaceSlice = []BgpV4Interface{} - } - return obj -} -func (obj *deviceBgpRouterBgpV4InterfaceIter) appendHolderSlice(item BgpV4Interface) DeviceBgpRouterBgpV4InterfaceIter { - obj.bgpV4InterfaceSlice = append(obj.bgpV4InterfaceSlice, item) - return obj -} - -// This contains an array of references to IPv6 interfaces, each of which will have list of peers to different destinations. -// Ipv6Interfaces returns a []BgpV6Interface -func (obj *deviceBgpRouter) Ipv6Interfaces() DeviceBgpRouterBgpV6InterfaceIter { - if len(obj.obj.Ipv6Interfaces) == 0 { - obj.obj.Ipv6Interfaces = []*otg.BgpV6Interface{} - } - if obj.ipv6InterfacesHolder == nil { - obj.ipv6InterfacesHolder = newDeviceBgpRouterBgpV6InterfaceIter(&obj.obj.Ipv6Interfaces).setMsg(obj) - } - return obj.ipv6InterfacesHolder -} - -type deviceBgpRouterBgpV6InterfaceIter struct { - obj *deviceBgpRouter - bgpV6InterfaceSlice []BgpV6Interface - fieldPtr *[]*otg.BgpV6Interface -} - -func newDeviceBgpRouterBgpV6InterfaceIter(ptr *[]*otg.BgpV6Interface) DeviceBgpRouterBgpV6InterfaceIter { - return &deviceBgpRouterBgpV6InterfaceIter{fieldPtr: ptr} -} - -type DeviceBgpRouterBgpV6InterfaceIter interface { - setMsg(*deviceBgpRouter) DeviceBgpRouterBgpV6InterfaceIter - Items() []BgpV6Interface - Add() BgpV6Interface - Append(items ...BgpV6Interface) DeviceBgpRouterBgpV6InterfaceIter - Set(index int, newObj BgpV6Interface) DeviceBgpRouterBgpV6InterfaceIter - Clear() DeviceBgpRouterBgpV6InterfaceIter - clearHolderSlice() DeviceBgpRouterBgpV6InterfaceIter - appendHolderSlice(item BgpV6Interface) DeviceBgpRouterBgpV6InterfaceIter -} - -func (obj *deviceBgpRouterBgpV6InterfaceIter) setMsg(msg *deviceBgpRouter) DeviceBgpRouterBgpV6InterfaceIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpV6Interface{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceBgpRouterBgpV6InterfaceIter) Items() []BgpV6Interface { - return obj.bgpV6InterfaceSlice -} - -func (obj *deviceBgpRouterBgpV6InterfaceIter) Add() BgpV6Interface { - newObj := &otg.BgpV6Interface{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpV6Interface{obj: newObj} - newLibObj.setDefault() - obj.bgpV6InterfaceSlice = append(obj.bgpV6InterfaceSlice, newLibObj) - return newLibObj -} - -func (obj *deviceBgpRouterBgpV6InterfaceIter) Append(items ...BgpV6Interface) DeviceBgpRouterBgpV6InterfaceIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpV6InterfaceSlice = append(obj.bgpV6InterfaceSlice, item) - } - return obj -} - -func (obj *deviceBgpRouterBgpV6InterfaceIter) Set(index int, newObj BgpV6Interface) DeviceBgpRouterBgpV6InterfaceIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpV6InterfaceSlice[index] = newObj - return obj -} -func (obj *deviceBgpRouterBgpV6InterfaceIter) Clear() DeviceBgpRouterBgpV6InterfaceIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpV6Interface{} - obj.bgpV6InterfaceSlice = []BgpV6Interface{} - } - return obj -} -func (obj *deviceBgpRouterBgpV6InterfaceIter) clearHolderSlice() DeviceBgpRouterBgpV6InterfaceIter { - if len(obj.bgpV6InterfaceSlice) > 0 { - obj.bgpV6InterfaceSlice = []BgpV6Interface{} - } - return obj -} -func (obj *deviceBgpRouterBgpV6InterfaceIter) appendHolderSlice(item BgpV6Interface) DeviceBgpRouterBgpV6InterfaceIter { - obj.bgpV6InterfaceSlice = append(obj.bgpV6InterfaceSlice, item) - return obj -} - -func (obj *deviceBgpRouter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // RouterId is required - if obj.obj.RouterId == nil { - vObj.validationErrors = append(vObj.validationErrors, "RouterId is required field on interface DeviceBgpRouter") - } - if obj.obj.RouterId != nil { - - err := obj.validateIpv4(obj.RouterId()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceBgpRouter.RouterId")) - } - - } - - if len(obj.obj.Ipv4Interfaces) != 0 { - - if set_default { - obj.Ipv4Interfaces().clearHolderSlice() - for _, item := range obj.obj.Ipv4Interfaces { - obj.Ipv4Interfaces().appendHolderSlice(&bgpV4Interface{obj: item}) - } - } - for _, item := range obj.Ipv4Interfaces().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Ipv6Interfaces) != 0 { - - if set_default { - obj.Ipv6Interfaces().clearHolderSlice() - for _, item := range obj.obj.Ipv6Interfaces { - obj.Ipv6Interfaces().appendHolderSlice(&bgpV6Interface{obj: item}) - } - } - for _, item := range obj.Ipv6Interfaces().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *deviceBgpRouter) setDefault() { - -} - -// ***** DeviceVxlan ***** -type deviceVxlan struct { - validation - obj *otg.DeviceVxlan - marshaller marshalDeviceVxlan - unMarshaller unMarshalDeviceVxlan - v4TunnelsHolder DeviceVxlanVxlanV4TunnelIter - v6TunnelsHolder DeviceVxlanVxlanV6TunnelIter -} - -func NewDeviceVxlan() DeviceVxlan { - obj := deviceVxlan{obj: &otg.DeviceVxlan{}} - obj.setDefault() - return &obj -} - -func (obj *deviceVxlan) msg() *otg.DeviceVxlan { - return obj.obj -} - -func (obj *deviceVxlan) setMsg(msg *otg.DeviceVxlan) DeviceVxlan { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceVxlan struct { - obj *deviceVxlan -} - -type marshalDeviceVxlan interface { - // ToProto marshals DeviceVxlan to protobuf object *otg.DeviceVxlan - ToProto() (*otg.DeviceVxlan, error) - // ToPbText marshals DeviceVxlan to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceVxlan to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceVxlan to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceVxlan struct { - obj *deviceVxlan -} - -type unMarshalDeviceVxlan interface { - // FromProto unmarshals DeviceVxlan from protobuf object *otg.DeviceVxlan - FromProto(msg *otg.DeviceVxlan) (DeviceVxlan, error) - // FromPbText unmarshals DeviceVxlan from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceVxlan from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceVxlan from JSON text - FromJson(value string) error -} - -func (obj *deviceVxlan) Marshal() marshalDeviceVxlan { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceVxlan{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceVxlan) Unmarshal() unMarshalDeviceVxlan { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceVxlan{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceVxlan) ToProto() (*otg.DeviceVxlan, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceVxlan) FromProto(msg *otg.DeviceVxlan) (DeviceVxlan, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceVxlan) 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 *unMarshaldeviceVxlan) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshaldeviceVxlan) 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 *unMarshaldeviceVxlan) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshaldeviceVxlan) 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 *unMarshaldeviceVxlan) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *deviceVxlan) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceVxlan) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceVxlan) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceVxlan) Clone() (DeviceVxlan, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceVxlan() - 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 -} - -func (obj *deviceVxlan) setNil() { - obj.v4TunnelsHolder = nil - obj.v6TunnelsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// DeviceVxlan is description is TBD -type DeviceVxlan interface { - Validation - // msg marshals DeviceVxlan to protobuf object *otg.DeviceVxlan - // and doesn't set defaults - msg() *otg.DeviceVxlan - // setMsg unmarshals DeviceVxlan from protobuf object *otg.DeviceVxlan - // and doesn't set defaults - setMsg(*otg.DeviceVxlan) DeviceVxlan - // provides marshal interface - Marshal() marshalDeviceVxlan - // provides unmarshal interface - Unmarshal() unMarshalDeviceVxlan - // validate validates DeviceVxlan - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceVxlan, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // V4Tunnels returns DeviceVxlanVxlanV4TunnelIterIter, set in DeviceVxlan - V4Tunnels() DeviceVxlanVxlanV4TunnelIter - // V6Tunnels returns DeviceVxlanVxlanV6TunnelIterIter, set in DeviceVxlan - V6Tunnels() DeviceVxlanVxlanV6TunnelIter - setNil() -} - -// IPv4 VXLAN Tunnels -// V4Tunnels returns a []VxlanV4Tunnel -func (obj *deviceVxlan) V4Tunnels() DeviceVxlanVxlanV4TunnelIter { - if len(obj.obj.V4Tunnels) == 0 { - obj.obj.V4Tunnels = []*otg.VxlanV4Tunnel{} - } - if obj.v4TunnelsHolder == nil { - obj.v4TunnelsHolder = newDeviceVxlanVxlanV4TunnelIter(&obj.obj.V4Tunnels).setMsg(obj) - } - return obj.v4TunnelsHolder -} - -type deviceVxlanVxlanV4TunnelIter struct { - obj *deviceVxlan - vxlanV4TunnelSlice []VxlanV4Tunnel - fieldPtr *[]*otg.VxlanV4Tunnel -} - -func newDeviceVxlanVxlanV4TunnelIter(ptr *[]*otg.VxlanV4Tunnel) DeviceVxlanVxlanV4TunnelIter { - return &deviceVxlanVxlanV4TunnelIter{fieldPtr: ptr} -} - -type DeviceVxlanVxlanV4TunnelIter interface { - setMsg(*deviceVxlan) DeviceVxlanVxlanV4TunnelIter - Items() []VxlanV4Tunnel - Add() VxlanV4Tunnel - Append(items ...VxlanV4Tunnel) DeviceVxlanVxlanV4TunnelIter - Set(index int, newObj VxlanV4Tunnel) DeviceVxlanVxlanV4TunnelIter - Clear() DeviceVxlanVxlanV4TunnelIter - clearHolderSlice() DeviceVxlanVxlanV4TunnelIter - appendHolderSlice(item VxlanV4Tunnel) DeviceVxlanVxlanV4TunnelIter -} - -func (obj *deviceVxlanVxlanV4TunnelIter) setMsg(msg *deviceVxlan) DeviceVxlanVxlanV4TunnelIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&vxlanV4Tunnel{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceVxlanVxlanV4TunnelIter) Items() []VxlanV4Tunnel { - return obj.vxlanV4TunnelSlice -} - -func (obj *deviceVxlanVxlanV4TunnelIter) Add() VxlanV4Tunnel { - newObj := &otg.VxlanV4Tunnel{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &vxlanV4Tunnel{obj: newObj} - newLibObj.setDefault() - obj.vxlanV4TunnelSlice = append(obj.vxlanV4TunnelSlice, newLibObj) - return newLibObj -} - -func (obj *deviceVxlanVxlanV4TunnelIter) Append(items ...VxlanV4Tunnel) DeviceVxlanVxlanV4TunnelIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.vxlanV4TunnelSlice = append(obj.vxlanV4TunnelSlice, item) - } - return obj -} - -func (obj *deviceVxlanVxlanV4TunnelIter) Set(index int, newObj VxlanV4Tunnel) DeviceVxlanVxlanV4TunnelIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.vxlanV4TunnelSlice[index] = newObj - return obj -} -func (obj *deviceVxlanVxlanV4TunnelIter) Clear() DeviceVxlanVxlanV4TunnelIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.VxlanV4Tunnel{} - obj.vxlanV4TunnelSlice = []VxlanV4Tunnel{} - } - return obj -} -func (obj *deviceVxlanVxlanV4TunnelIter) clearHolderSlice() DeviceVxlanVxlanV4TunnelIter { - if len(obj.vxlanV4TunnelSlice) > 0 { - obj.vxlanV4TunnelSlice = []VxlanV4Tunnel{} - } - return obj -} -func (obj *deviceVxlanVxlanV4TunnelIter) appendHolderSlice(item VxlanV4Tunnel) DeviceVxlanVxlanV4TunnelIter { - obj.vxlanV4TunnelSlice = append(obj.vxlanV4TunnelSlice, item) - return obj -} - -// IPv6 VXLAN Tunnels -// V6Tunnels returns a []VxlanV6Tunnel -func (obj *deviceVxlan) V6Tunnels() DeviceVxlanVxlanV6TunnelIter { - if len(obj.obj.V6Tunnels) == 0 { - obj.obj.V6Tunnels = []*otg.VxlanV6Tunnel{} - } - if obj.v6TunnelsHolder == nil { - obj.v6TunnelsHolder = newDeviceVxlanVxlanV6TunnelIter(&obj.obj.V6Tunnels).setMsg(obj) - } - return obj.v6TunnelsHolder -} - -type deviceVxlanVxlanV6TunnelIter struct { - obj *deviceVxlan - vxlanV6TunnelSlice []VxlanV6Tunnel - fieldPtr *[]*otg.VxlanV6Tunnel -} - -func newDeviceVxlanVxlanV6TunnelIter(ptr *[]*otg.VxlanV6Tunnel) DeviceVxlanVxlanV6TunnelIter { - return &deviceVxlanVxlanV6TunnelIter{fieldPtr: ptr} -} - -type DeviceVxlanVxlanV6TunnelIter interface { - setMsg(*deviceVxlan) DeviceVxlanVxlanV6TunnelIter - Items() []VxlanV6Tunnel - Add() VxlanV6Tunnel - Append(items ...VxlanV6Tunnel) DeviceVxlanVxlanV6TunnelIter - Set(index int, newObj VxlanV6Tunnel) DeviceVxlanVxlanV6TunnelIter - Clear() DeviceVxlanVxlanV6TunnelIter - clearHolderSlice() DeviceVxlanVxlanV6TunnelIter - appendHolderSlice(item VxlanV6Tunnel) DeviceVxlanVxlanV6TunnelIter -} - -func (obj *deviceVxlanVxlanV6TunnelIter) setMsg(msg *deviceVxlan) DeviceVxlanVxlanV6TunnelIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&vxlanV6Tunnel{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceVxlanVxlanV6TunnelIter) Items() []VxlanV6Tunnel { - return obj.vxlanV6TunnelSlice -} - -func (obj *deviceVxlanVxlanV6TunnelIter) Add() VxlanV6Tunnel { - newObj := &otg.VxlanV6Tunnel{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &vxlanV6Tunnel{obj: newObj} - newLibObj.setDefault() - obj.vxlanV6TunnelSlice = append(obj.vxlanV6TunnelSlice, newLibObj) - return newLibObj -} - -func (obj *deviceVxlanVxlanV6TunnelIter) Append(items ...VxlanV6Tunnel) DeviceVxlanVxlanV6TunnelIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.vxlanV6TunnelSlice = append(obj.vxlanV6TunnelSlice, item) - } - return obj -} - -func (obj *deviceVxlanVxlanV6TunnelIter) Set(index int, newObj VxlanV6Tunnel) DeviceVxlanVxlanV6TunnelIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.vxlanV6TunnelSlice[index] = newObj - return obj -} -func (obj *deviceVxlanVxlanV6TunnelIter) Clear() DeviceVxlanVxlanV6TunnelIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.VxlanV6Tunnel{} - obj.vxlanV6TunnelSlice = []VxlanV6Tunnel{} - } - return obj -} -func (obj *deviceVxlanVxlanV6TunnelIter) clearHolderSlice() DeviceVxlanVxlanV6TunnelIter { - if len(obj.vxlanV6TunnelSlice) > 0 { - obj.vxlanV6TunnelSlice = []VxlanV6Tunnel{} - } - return obj -} -func (obj *deviceVxlanVxlanV6TunnelIter) appendHolderSlice(item VxlanV6Tunnel) DeviceVxlanVxlanV6TunnelIter { - obj.vxlanV6TunnelSlice = append(obj.vxlanV6TunnelSlice, item) - return obj -} - -func (obj *deviceVxlan) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.V4Tunnels) != 0 { - - if set_default { - obj.V4Tunnels().clearHolderSlice() - for _, item := range obj.obj.V4Tunnels { - obj.V4Tunnels().appendHolderSlice(&vxlanV4Tunnel{obj: item}) - } - } - for _, item := range obj.V4Tunnels().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.V6Tunnels) != 0 { - - if set_default { - obj.V6Tunnels().clearHolderSlice() - for _, item := range obj.obj.V6Tunnels { - obj.V6Tunnels().appendHolderSlice(&vxlanV6Tunnel{obj: item}) - } - } - for _, item := range obj.V6Tunnels().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *deviceVxlan) setDefault() { - -} - -// ***** DeviceRsvp ***** -type deviceRsvp struct { - validation - obj *otg.DeviceRsvp - marshaller marshalDeviceRsvp - unMarshaller unMarshalDeviceRsvp - ipv4InterfacesHolder DeviceRsvpRsvpIpv4InterfaceIter - lspIpv4InterfacesHolder DeviceRsvpRsvpLspIpv4InterfaceIter -} - -func NewDeviceRsvp() DeviceRsvp { - obj := deviceRsvp{obj: &otg.DeviceRsvp{}} - obj.setDefault() - return &obj -} - -func (obj *deviceRsvp) msg() *otg.DeviceRsvp { - return obj.obj -} - -func (obj *deviceRsvp) setMsg(msg *otg.DeviceRsvp) DeviceRsvp { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceRsvp struct { - obj *deviceRsvp -} - -type marshalDeviceRsvp interface { - // ToProto marshals DeviceRsvp to protobuf object *otg.DeviceRsvp - ToProto() (*otg.DeviceRsvp, error) - // ToPbText marshals DeviceRsvp to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceRsvp to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceRsvp to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceRsvp struct { - obj *deviceRsvp -} - -type unMarshalDeviceRsvp interface { - // FromProto unmarshals DeviceRsvp from protobuf object *otg.DeviceRsvp - FromProto(msg *otg.DeviceRsvp) (DeviceRsvp, error) - // FromPbText unmarshals DeviceRsvp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceRsvp from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceRsvp from JSON text - FromJson(value string) error -} - -func (obj *deviceRsvp) Marshal() marshalDeviceRsvp { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceRsvp{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceRsvp) Unmarshal() unMarshalDeviceRsvp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceRsvp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceRsvp) ToProto() (*otg.DeviceRsvp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceRsvp) FromProto(msg *otg.DeviceRsvp) (DeviceRsvp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceRsvp) 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 *unMarshaldeviceRsvp) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshaldeviceRsvp) 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 *unMarshaldeviceRsvp) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshaldeviceRsvp) 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 *unMarshaldeviceRsvp) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *deviceRsvp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceRsvp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceRsvp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceRsvp) Clone() (DeviceRsvp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceRsvp() - 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 -} - -func (obj *deviceRsvp) setNil() { - obj.ipv4InterfacesHolder = nil - obj.lspIpv4InterfacesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// DeviceRsvp is configuration for one or more RSVP interfaces, ingress and egress LSPs. In this model, currently IPv4 RSVP and point-to-point LSPs are supported as per RFC3209 and related specifications. -type DeviceRsvp interface { - Validation - // msg marshals DeviceRsvp to protobuf object *otg.DeviceRsvp - // and doesn't set defaults - msg() *otg.DeviceRsvp - // setMsg unmarshals DeviceRsvp from protobuf object *otg.DeviceRsvp - // and doesn't set defaults - setMsg(*otg.DeviceRsvp) DeviceRsvp - // provides marshal interface - Marshal() marshalDeviceRsvp - // provides unmarshal interface - Unmarshal() unMarshalDeviceRsvp - // validate validates DeviceRsvp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceRsvp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv4Interfaces returns DeviceRsvpRsvpIpv4InterfaceIterIter, set in DeviceRsvp - Ipv4Interfaces() DeviceRsvpRsvpIpv4InterfaceIter - // LspIpv4Interfaces returns DeviceRsvpRsvpLspIpv4InterfaceIterIter, set in DeviceRsvp - LspIpv4Interfaces() DeviceRsvpRsvpLspIpv4InterfaceIter - // Name returns string, set in DeviceRsvp. - Name() string - // SetName assigns string provided by user to DeviceRsvp - SetName(value string) DeviceRsvp - // HasName checks if Name has been set in DeviceRsvp - HasName() bool - setNil() -} - -// List of IPv4 RSVP connected interfaces. At least one interface should be present for device connected to the DUT. For unconnected devices, this array must be empty. -// Ipv4Interfaces returns a []RsvpIpv4Interface -func (obj *deviceRsvp) Ipv4Interfaces() DeviceRsvpRsvpIpv4InterfaceIter { - if len(obj.obj.Ipv4Interfaces) == 0 { - obj.obj.Ipv4Interfaces = []*otg.RsvpIpv4Interface{} - } - if obj.ipv4InterfacesHolder == nil { - obj.ipv4InterfacesHolder = newDeviceRsvpRsvpIpv4InterfaceIter(&obj.obj.Ipv4Interfaces).setMsg(obj) - } - return obj.ipv4InterfacesHolder -} - -type deviceRsvpRsvpIpv4InterfaceIter struct { - obj *deviceRsvp - rsvpIpv4InterfaceSlice []RsvpIpv4Interface - fieldPtr *[]*otg.RsvpIpv4Interface -} - -func newDeviceRsvpRsvpIpv4InterfaceIter(ptr *[]*otg.RsvpIpv4Interface) DeviceRsvpRsvpIpv4InterfaceIter { - return &deviceRsvpRsvpIpv4InterfaceIter{fieldPtr: ptr} -} - -type DeviceRsvpRsvpIpv4InterfaceIter interface { - setMsg(*deviceRsvp) DeviceRsvpRsvpIpv4InterfaceIter - Items() []RsvpIpv4Interface - Add() RsvpIpv4Interface - Append(items ...RsvpIpv4Interface) DeviceRsvpRsvpIpv4InterfaceIter - Set(index int, newObj RsvpIpv4Interface) DeviceRsvpRsvpIpv4InterfaceIter - Clear() DeviceRsvpRsvpIpv4InterfaceIter - clearHolderSlice() DeviceRsvpRsvpIpv4InterfaceIter - appendHolderSlice(item RsvpIpv4Interface) DeviceRsvpRsvpIpv4InterfaceIter -} - -func (obj *deviceRsvpRsvpIpv4InterfaceIter) setMsg(msg *deviceRsvp) DeviceRsvpRsvpIpv4InterfaceIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&rsvpIpv4Interface{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceRsvpRsvpIpv4InterfaceIter) Items() []RsvpIpv4Interface { - return obj.rsvpIpv4InterfaceSlice -} - -func (obj *deviceRsvpRsvpIpv4InterfaceIter) Add() RsvpIpv4Interface { - newObj := &otg.RsvpIpv4Interface{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &rsvpIpv4Interface{obj: newObj} - newLibObj.setDefault() - obj.rsvpIpv4InterfaceSlice = append(obj.rsvpIpv4InterfaceSlice, newLibObj) - return newLibObj -} - -func (obj *deviceRsvpRsvpIpv4InterfaceIter) Append(items ...RsvpIpv4Interface) DeviceRsvpRsvpIpv4InterfaceIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.rsvpIpv4InterfaceSlice = append(obj.rsvpIpv4InterfaceSlice, item) - } - return obj -} - -func (obj *deviceRsvpRsvpIpv4InterfaceIter) Set(index int, newObj RsvpIpv4Interface) DeviceRsvpRsvpIpv4InterfaceIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.rsvpIpv4InterfaceSlice[index] = newObj - return obj -} -func (obj *deviceRsvpRsvpIpv4InterfaceIter) Clear() DeviceRsvpRsvpIpv4InterfaceIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.RsvpIpv4Interface{} - obj.rsvpIpv4InterfaceSlice = []RsvpIpv4Interface{} - } - return obj -} -func (obj *deviceRsvpRsvpIpv4InterfaceIter) clearHolderSlice() DeviceRsvpRsvpIpv4InterfaceIter { - if len(obj.rsvpIpv4InterfaceSlice) > 0 { - obj.rsvpIpv4InterfaceSlice = []RsvpIpv4Interface{} - } - return obj -} -func (obj *deviceRsvpRsvpIpv4InterfaceIter) appendHolderSlice(item RsvpIpv4Interface) DeviceRsvpRsvpIpv4InterfaceIter { - obj.rsvpIpv4InterfaceSlice = append(obj.rsvpIpv4InterfaceSlice, item) - return obj -} - -// List of IPv4 Loopback or IPv4 connected interfaces acting as RSVP ingress and egress endpoints. -// LspIpv4Interfaces returns a []RsvpLspIpv4Interface -func (obj *deviceRsvp) LspIpv4Interfaces() DeviceRsvpRsvpLspIpv4InterfaceIter { - if len(obj.obj.LspIpv4Interfaces) == 0 { - obj.obj.LspIpv4Interfaces = []*otg.RsvpLspIpv4Interface{} - } - if obj.lspIpv4InterfacesHolder == nil { - obj.lspIpv4InterfacesHolder = newDeviceRsvpRsvpLspIpv4InterfaceIter(&obj.obj.LspIpv4Interfaces).setMsg(obj) - } - return obj.lspIpv4InterfacesHolder -} - -type deviceRsvpRsvpLspIpv4InterfaceIter struct { - obj *deviceRsvp - rsvpLspIpv4InterfaceSlice []RsvpLspIpv4Interface - fieldPtr *[]*otg.RsvpLspIpv4Interface -} - -func newDeviceRsvpRsvpLspIpv4InterfaceIter(ptr *[]*otg.RsvpLspIpv4Interface) DeviceRsvpRsvpLspIpv4InterfaceIter { - return &deviceRsvpRsvpLspIpv4InterfaceIter{fieldPtr: ptr} -} - -type DeviceRsvpRsvpLspIpv4InterfaceIter interface { - setMsg(*deviceRsvp) DeviceRsvpRsvpLspIpv4InterfaceIter - Items() []RsvpLspIpv4Interface - Add() RsvpLspIpv4Interface - Append(items ...RsvpLspIpv4Interface) DeviceRsvpRsvpLspIpv4InterfaceIter - Set(index int, newObj RsvpLspIpv4Interface) DeviceRsvpRsvpLspIpv4InterfaceIter - Clear() DeviceRsvpRsvpLspIpv4InterfaceIter - clearHolderSlice() DeviceRsvpRsvpLspIpv4InterfaceIter - appendHolderSlice(item RsvpLspIpv4Interface) DeviceRsvpRsvpLspIpv4InterfaceIter -} - -func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) setMsg(msg *deviceRsvp) DeviceRsvpRsvpLspIpv4InterfaceIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&rsvpLspIpv4Interface{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) Items() []RsvpLspIpv4Interface { - return obj.rsvpLspIpv4InterfaceSlice -} - -func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) Add() RsvpLspIpv4Interface { - newObj := &otg.RsvpLspIpv4Interface{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &rsvpLspIpv4Interface{obj: newObj} - newLibObj.setDefault() - obj.rsvpLspIpv4InterfaceSlice = append(obj.rsvpLspIpv4InterfaceSlice, newLibObj) - return newLibObj -} - -func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) Append(items ...RsvpLspIpv4Interface) DeviceRsvpRsvpLspIpv4InterfaceIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.rsvpLspIpv4InterfaceSlice = append(obj.rsvpLspIpv4InterfaceSlice, item) - } - return obj -} - -func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) Set(index int, newObj RsvpLspIpv4Interface) DeviceRsvpRsvpLspIpv4InterfaceIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.rsvpLspIpv4InterfaceSlice[index] = newObj - return obj -} -func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) Clear() DeviceRsvpRsvpLspIpv4InterfaceIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.RsvpLspIpv4Interface{} - obj.rsvpLspIpv4InterfaceSlice = []RsvpLspIpv4Interface{} - } - return obj -} -func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) clearHolderSlice() DeviceRsvpRsvpLspIpv4InterfaceIter { - if len(obj.rsvpLspIpv4InterfaceSlice) > 0 { - obj.rsvpLspIpv4InterfaceSlice = []RsvpLspIpv4Interface{} - } - return obj -} -func (obj *deviceRsvpRsvpLspIpv4InterfaceIter) appendHolderSlice(item RsvpLspIpv4Interface) DeviceRsvpRsvpLspIpv4InterfaceIter { - obj.rsvpLspIpv4InterfaceSlice = append(obj.rsvpLspIpv4InterfaceSlice, item) - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *deviceRsvp) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *deviceRsvp) HasName() bool { - return obj.obj.Name != nil -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the DeviceRsvp object -func (obj *deviceRsvp) SetName(value string) DeviceRsvp { - - obj.obj.Name = &value - return obj -} - -func (obj *deviceRsvp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Ipv4Interfaces) != 0 { - - if set_default { - obj.Ipv4Interfaces().clearHolderSlice() - for _, item := range obj.obj.Ipv4Interfaces { - obj.Ipv4Interfaces().appendHolderSlice(&rsvpIpv4Interface{obj: item}) - } - } - for _, item := range obj.Ipv4Interfaces().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.LspIpv4Interfaces) != 0 { - - if set_default { - obj.LspIpv4Interfaces().clearHolderSlice() - for _, item := range obj.obj.LspIpv4Interfaces { - obj.LspIpv4Interfaces().appendHolderSlice(&rsvpLspIpv4Interface{obj: item}) - } - } - for _, item := range obj.LspIpv4Interfaces().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *deviceRsvp) setDefault() { - -} - -// ***** DeviceDhcpServer ***** -type deviceDhcpServer struct { - validation - obj *otg.DeviceDhcpServer - marshaller marshalDeviceDhcpServer - unMarshaller unMarshalDeviceDhcpServer - ipv4InterfacesHolder DeviceDhcpServerDhcpServerV4Iter -} - -func NewDeviceDhcpServer() DeviceDhcpServer { - obj := deviceDhcpServer{obj: &otg.DeviceDhcpServer{}} - obj.setDefault() - return &obj -} - -func (obj *deviceDhcpServer) msg() *otg.DeviceDhcpServer { - return obj.obj -} - -func (obj *deviceDhcpServer) setMsg(msg *otg.DeviceDhcpServer) DeviceDhcpServer { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceDhcpServer struct { - obj *deviceDhcpServer -} - -type marshalDeviceDhcpServer interface { - // ToProto marshals DeviceDhcpServer to protobuf object *otg.DeviceDhcpServer - ToProto() (*otg.DeviceDhcpServer, error) - // ToPbText marshals DeviceDhcpServer to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceDhcpServer to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceDhcpServer to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceDhcpServer struct { - obj *deviceDhcpServer -} - -type unMarshalDeviceDhcpServer interface { - // FromProto unmarshals DeviceDhcpServer from protobuf object *otg.DeviceDhcpServer - FromProto(msg *otg.DeviceDhcpServer) (DeviceDhcpServer, error) - // FromPbText unmarshals DeviceDhcpServer from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceDhcpServer from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceDhcpServer from JSON text - FromJson(value string) error -} - -func (obj *deviceDhcpServer) Marshal() marshalDeviceDhcpServer { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceDhcpServer{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceDhcpServer) Unmarshal() unMarshalDeviceDhcpServer { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceDhcpServer{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceDhcpServer) ToProto() (*otg.DeviceDhcpServer, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceDhcpServer) FromProto(msg *otg.DeviceDhcpServer) (DeviceDhcpServer, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceDhcpServer) 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 *unMarshaldeviceDhcpServer) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshaldeviceDhcpServer) 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 *unMarshaldeviceDhcpServer) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshaldeviceDhcpServer) 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 *unMarshaldeviceDhcpServer) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *deviceDhcpServer) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceDhcpServer) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceDhcpServer) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceDhcpServer) Clone() (DeviceDhcpServer, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceDhcpServer() - 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 -} - -func (obj *deviceDhcpServer) setNil() { - obj.ipv4InterfacesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// DeviceDhcpServer is configuration for one or more IPv4 or IPv6 DHCP servers. -type DeviceDhcpServer interface { - Validation - // msg marshals DeviceDhcpServer to protobuf object *otg.DeviceDhcpServer - // and doesn't set defaults - msg() *otg.DeviceDhcpServer - // setMsg unmarshals DeviceDhcpServer from protobuf object *otg.DeviceDhcpServer - // and doesn't set defaults - setMsg(*otg.DeviceDhcpServer) DeviceDhcpServer - // provides marshal interface - Marshal() marshalDeviceDhcpServer - // provides unmarshal interface - Unmarshal() unMarshalDeviceDhcpServer - // validate validates DeviceDhcpServer - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceDhcpServer, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv4Interfaces returns DeviceDhcpServerDhcpServerV4IterIter, set in DeviceDhcpServer - Ipv4Interfaces() DeviceDhcpServerDhcpServerV4Iter - setNil() -} - -// This contains an array of references to IPv4 interfaces, each of which will contain one DHCPv4 server. -// Ipv4Interfaces returns a []DhcpServerV4 -func (obj *deviceDhcpServer) Ipv4Interfaces() DeviceDhcpServerDhcpServerV4Iter { - if len(obj.obj.Ipv4Interfaces) == 0 { - obj.obj.Ipv4Interfaces = []*otg.DhcpServerV4{} - } - if obj.ipv4InterfacesHolder == nil { - obj.ipv4InterfacesHolder = newDeviceDhcpServerDhcpServerV4Iter(&obj.obj.Ipv4Interfaces).setMsg(obj) - } - return obj.ipv4InterfacesHolder -} - -type deviceDhcpServerDhcpServerV4Iter struct { - obj *deviceDhcpServer - dhcpServerV4Slice []DhcpServerV4 - fieldPtr *[]*otg.DhcpServerV4 -} - -func newDeviceDhcpServerDhcpServerV4Iter(ptr *[]*otg.DhcpServerV4) DeviceDhcpServerDhcpServerV4Iter { - return &deviceDhcpServerDhcpServerV4Iter{fieldPtr: ptr} -} - -type DeviceDhcpServerDhcpServerV4Iter interface { - setMsg(*deviceDhcpServer) DeviceDhcpServerDhcpServerV4Iter - Items() []DhcpServerV4 - Add() DhcpServerV4 - Append(items ...DhcpServerV4) DeviceDhcpServerDhcpServerV4Iter - Set(index int, newObj DhcpServerV4) DeviceDhcpServerDhcpServerV4Iter - Clear() DeviceDhcpServerDhcpServerV4Iter - clearHolderSlice() DeviceDhcpServerDhcpServerV4Iter - appendHolderSlice(item DhcpServerV4) DeviceDhcpServerDhcpServerV4Iter -} - -func (obj *deviceDhcpServerDhcpServerV4Iter) setMsg(msg *deviceDhcpServer) DeviceDhcpServerDhcpServerV4Iter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&dhcpServerV4{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceDhcpServerDhcpServerV4Iter) Items() []DhcpServerV4 { - return obj.dhcpServerV4Slice -} - -func (obj *deviceDhcpServerDhcpServerV4Iter) Add() DhcpServerV4 { - newObj := &otg.DhcpServerV4{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &dhcpServerV4{obj: newObj} - newLibObj.setDefault() - obj.dhcpServerV4Slice = append(obj.dhcpServerV4Slice, newLibObj) - return newLibObj -} - -func (obj *deviceDhcpServerDhcpServerV4Iter) Append(items ...DhcpServerV4) DeviceDhcpServerDhcpServerV4Iter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.dhcpServerV4Slice = append(obj.dhcpServerV4Slice, item) - } - return obj -} - -func (obj *deviceDhcpServerDhcpServerV4Iter) Set(index int, newObj DhcpServerV4) DeviceDhcpServerDhcpServerV4Iter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.dhcpServerV4Slice[index] = newObj - return obj -} -func (obj *deviceDhcpServerDhcpServerV4Iter) Clear() DeviceDhcpServerDhcpServerV4Iter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.DhcpServerV4{} - obj.dhcpServerV4Slice = []DhcpServerV4{} - } - return obj -} -func (obj *deviceDhcpServerDhcpServerV4Iter) clearHolderSlice() DeviceDhcpServerDhcpServerV4Iter { - if len(obj.dhcpServerV4Slice) > 0 { - obj.dhcpServerV4Slice = []DhcpServerV4{} - } - return obj -} -func (obj *deviceDhcpServerDhcpServerV4Iter) appendHolderSlice(item DhcpServerV4) DeviceDhcpServerDhcpServerV4Iter { - obj.dhcpServerV4Slice = append(obj.dhcpServerV4Slice, item) - return obj -} - -func (obj *deviceDhcpServer) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Ipv4Interfaces) != 0 { - - if set_default { - obj.Ipv4Interfaces().clearHolderSlice() - for _, item := range obj.obj.Ipv4Interfaces { - obj.Ipv4Interfaces().appendHolderSlice(&dhcpServerV4{obj: item}) - } - } - for _, item := range obj.Ipv4Interfaces().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *deviceDhcpServer) setDefault() { - -} - -// ***** FlowTxRx ***** -type flowTxRx struct { - validation - obj *otg.FlowTxRx - marshaller marshalFlowTxRx - unMarshaller unMarshalFlowTxRx - portHolder FlowPort - deviceHolder FlowRouter -} - -func NewFlowTxRx() FlowTxRx { - obj := flowTxRx{obj: &otg.FlowTxRx{}} - obj.setDefault() - return &obj -} - -func (obj *flowTxRx) msg() *otg.FlowTxRx { - return obj.obj -} - -func (obj *flowTxRx) setMsg(msg *otg.FlowTxRx) FlowTxRx { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowTxRx struct { - obj *flowTxRx -} - -type marshalFlowTxRx interface { - // ToProto marshals FlowTxRx to protobuf object *otg.FlowTxRx - ToProto() (*otg.FlowTxRx, error) - // ToPbText marshals FlowTxRx to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowTxRx to YAML text - ToYaml() (string, error) - // ToJson marshals FlowTxRx to JSON text - ToJson() (string, error) -} - -type unMarshalflowTxRx struct { - obj *flowTxRx -} - -type unMarshalFlowTxRx interface { - // FromProto unmarshals FlowTxRx from protobuf object *otg.FlowTxRx - FromProto(msg *otg.FlowTxRx) (FlowTxRx, error) - // FromPbText unmarshals FlowTxRx from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowTxRx from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowTxRx from JSON text - FromJson(value string) error -} - -func (obj *flowTxRx) Marshal() marshalFlowTxRx { - if obj.marshaller == nil { - obj.marshaller = &marshalflowTxRx{obj: obj} - } - return obj.marshaller -} - -func (obj *flowTxRx) Unmarshal() unMarshalFlowTxRx { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowTxRx{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowTxRx) ToProto() (*otg.FlowTxRx, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowTxRx) FromProto(msg *otg.FlowTxRx) (FlowTxRx, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowTxRx) 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 *unMarshalflowTxRx) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowTxRx) 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 *unMarshalflowTxRx) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowTxRx) 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 *unMarshalflowTxRx) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowTxRx) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowTxRx) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowTxRx) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowTxRx) Clone() (FlowTxRx, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowTxRx() - 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 -} - -func (obj *flowTxRx) setNil() { - obj.portHolder = nil - obj.deviceHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowTxRx is a container for different types of transmit and receive -// endpoint containers. -type FlowTxRx interface { - Validation - // msg marshals FlowTxRx to protobuf object *otg.FlowTxRx - // and doesn't set defaults - msg() *otg.FlowTxRx - // setMsg unmarshals FlowTxRx from protobuf object *otg.FlowTxRx - // and doesn't set defaults - setMsg(*otg.FlowTxRx) FlowTxRx - // provides marshal interface - Marshal() marshalFlowTxRx - // provides unmarshal interface - Unmarshal() unMarshalFlowTxRx - // validate validates FlowTxRx - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowTxRx, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowTxRxChoiceEnum, set in FlowTxRx - Choice() FlowTxRxChoiceEnum - // setChoice assigns FlowTxRxChoiceEnum provided by user to FlowTxRx - setChoice(value FlowTxRxChoiceEnum) FlowTxRx - // HasChoice checks if Choice has been set in FlowTxRx - HasChoice() bool - // Port returns FlowPort, set in FlowTxRx. - // FlowPort is a container for a transmit port and 0..n intended receive ports. - // When assigning this container to a flow the flows's - // packet headers will not be populated with any address resolution - // information such as source and/or destination addresses. - // For example Flow.Ethernet dst mac address values will be defaulted to 0. - // For full control over the Flow.properties.packet header contents use this - // container. - Port() FlowPort - // SetPort assigns FlowPort provided by user to FlowTxRx. - // FlowPort is a container for a transmit port and 0..n intended receive ports. - // When assigning this container to a flow the flows's - // packet headers will not be populated with any address resolution - // information such as source and/or destination addresses. - // For example Flow.Ethernet dst mac address values will be defaulted to 0. - // For full control over the Flow.properties.packet header contents use this - // container. - SetPort(value FlowPort) FlowTxRx - // HasPort checks if Port has been set in FlowTxRx - HasPort() bool - // Device returns FlowRouter, set in FlowTxRx. - // FlowRouter is a container for declaring a map of 1..n transmit devices to 1..n receive devices. This allows for a single flow to have different tx to rx device flows such as a single one to one map or a many to many map. - Device() FlowRouter - // SetDevice assigns FlowRouter provided by user to FlowTxRx. - // FlowRouter is a container for declaring a map of 1..n transmit devices to 1..n receive devices. This allows for a single flow to have different tx to rx device flows such as a single one to one map or a many to many map. - SetDevice(value FlowRouter) FlowTxRx - // HasDevice checks if Device has been set in FlowTxRx - HasDevice() bool - setNil() -} - -type FlowTxRxChoiceEnum string - -// Enum of Choice on FlowTxRx -var FlowTxRxChoice = struct { - PORT FlowTxRxChoiceEnum - DEVICE FlowTxRxChoiceEnum -}{ - PORT: FlowTxRxChoiceEnum("port"), - DEVICE: FlowTxRxChoiceEnum("device"), -} - -func (obj *flowTxRx) Choice() FlowTxRxChoiceEnum { - return FlowTxRxChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The type of transmit and receive container used by the flow. -// Choice returns a string -func (obj *flowTxRx) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowTxRx) setChoice(value FlowTxRxChoiceEnum) FlowTxRx { - intValue, ok := otg.FlowTxRx_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowTxRxChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowTxRx_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Device = nil - obj.deviceHolder = nil - obj.obj.Port = nil - obj.portHolder = nil - - if value == FlowTxRxChoice.PORT { - obj.obj.Port = NewFlowPort().msg() - } - - if value == FlowTxRxChoice.DEVICE { - obj.obj.Device = NewFlowRouter().msg() - } - - return obj -} - -// description is TBD -// Port returns a FlowPort -func (obj *flowTxRx) Port() FlowPort { - if obj.obj.Port == nil { - obj.setChoice(FlowTxRxChoice.PORT) - } - if obj.portHolder == nil { - obj.portHolder = &flowPort{obj: obj.obj.Port} - } - return obj.portHolder -} - -// description is TBD -// Port returns a FlowPort -func (obj *flowTxRx) HasPort() bool { - return obj.obj.Port != nil -} - -// description is TBD -// SetPort sets the FlowPort value in the FlowTxRx object -func (obj *flowTxRx) SetPort(value FlowPort) FlowTxRx { - obj.setChoice(FlowTxRxChoice.PORT) - obj.portHolder = nil - obj.obj.Port = value.msg() - - return obj -} - -// description is TBD -// Device returns a FlowRouter -func (obj *flowTxRx) Device() FlowRouter { - if obj.obj.Device == nil { - obj.setChoice(FlowTxRxChoice.DEVICE) - } - if obj.deviceHolder == nil { - obj.deviceHolder = &flowRouter{obj: obj.obj.Device} - } - return obj.deviceHolder -} - -// description is TBD -// Device returns a FlowRouter -func (obj *flowTxRx) HasDevice() bool { - return obj.obj.Device != nil -} - -// description is TBD -// SetDevice sets the FlowRouter value in the FlowTxRx object -func (obj *flowTxRx) SetDevice(value FlowRouter) FlowTxRx { - obj.setChoice(FlowTxRxChoice.DEVICE) - obj.deviceHolder = nil - obj.obj.Device = value.msg() - - return obj -} - -func (obj *flowTxRx) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Port != nil { - - obj.Port().validateObj(vObj, set_default) - } - - if obj.obj.Device != nil { - - obj.Device().validateObj(vObj, set_default) - } - -} - -func (obj *flowTxRx) setDefault() { - var choices_set int = 0 - var choice FlowTxRxChoiceEnum - - if obj.obj.Port != nil { - choices_set += 1 - choice = FlowTxRxChoice.PORT - } - - if obj.obj.Device != nil { - choices_set += 1 - choice = FlowTxRxChoice.DEVICE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowTxRxChoice.PORT) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowTxRx") - } - } else { - intVal := otg.FlowTxRx_Choice_Enum_value[string(choice)] - enumValue := otg.FlowTxRx_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowHeader ***** -type flowHeader struct { - validation - obj *otg.FlowHeader - marshaller marshalFlowHeader - unMarshaller unMarshalFlowHeader - customHolder FlowCustom - ethernetHolder FlowEthernet - vlanHolder FlowVlan - vxlanHolder FlowVxlan - ipv4Holder FlowIpv4 - ipv6Holder FlowIpv6 - pfcpauseHolder FlowPfcPause - ethernetpauseHolder FlowEthernetPause - tcpHolder FlowTcp - udpHolder FlowUdp - greHolder FlowGre - gtpv1Holder FlowGtpv1 - gtpv2Holder FlowGtpv2 - arpHolder FlowArp - icmpHolder FlowIcmp - icmpv6Holder FlowIcmpv6 - pppHolder FlowPpp - igmpv1Holder FlowIgmpv1 - mplsHolder FlowMpls - snmpv2CHolder FlowSnmpv2C - rsvpHolder FlowRsvp -} - -func NewFlowHeader() FlowHeader { - obj := flowHeader{obj: &otg.FlowHeader{}} - obj.setDefault() - return &obj -} - -func (obj *flowHeader) msg() *otg.FlowHeader { - return obj.obj -} - -func (obj *flowHeader) setMsg(msg *otg.FlowHeader) FlowHeader { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowHeader struct { - obj *flowHeader -} - -type marshalFlowHeader interface { - // ToProto marshals FlowHeader to protobuf object *otg.FlowHeader - ToProto() (*otg.FlowHeader, error) - // ToPbText marshals FlowHeader to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowHeader to YAML text - ToYaml() (string, error) - // ToJson marshals FlowHeader to JSON text - ToJson() (string, error) -} - -type unMarshalflowHeader struct { - obj *flowHeader -} - -type unMarshalFlowHeader interface { - // FromProto unmarshals FlowHeader from protobuf object *otg.FlowHeader - FromProto(msg *otg.FlowHeader) (FlowHeader, error) - // FromPbText unmarshals FlowHeader from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowHeader from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowHeader from JSON text - FromJson(value string) error -} - -func (obj *flowHeader) Marshal() marshalFlowHeader { - if obj.marshaller == nil { - obj.marshaller = &marshalflowHeader{obj: obj} - } - return obj.marshaller -} - -func (obj *flowHeader) Unmarshal() unMarshalFlowHeader { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowHeader{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowHeader) ToProto() (*otg.FlowHeader, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowHeader) FromProto(msg *otg.FlowHeader) (FlowHeader, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowHeader) 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 *unMarshalflowHeader) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowHeader) 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 *unMarshalflowHeader) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowHeader) 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 *unMarshalflowHeader) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowHeader) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowHeader) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowHeader) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowHeader) Clone() (FlowHeader, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowHeader() - 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 -} - -func (obj *flowHeader) setNil() { - obj.customHolder = nil - obj.ethernetHolder = nil - obj.vlanHolder = nil - obj.vxlanHolder = nil - obj.ipv4Holder = nil - obj.ipv6Holder = nil - obj.pfcpauseHolder = nil - obj.ethernetpauseHolder = nil - obj.tcpHolder = nil - obj.udpHolder = nil - obj.greHolder = nil - obj.gtpv1Holder = nil - obj.gtpv2Holder = nil - obj.arpHolder = nil - obj.icmpHolder = nil - obj.icmpv6Holder = nil - obj.pppHolder = nil - obj.igmpv1Holder = nil - obj.mplsHolder = nil - obj.snmpv2CHolder = nil - obj.rsvpHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowHeader is configuration for all traffic packet headers -type FlowHeader interface { - Validation - // msg marshals FlowHeader to protobuf object *otg.FlowHeader - // and doesn't set defaults - msg() *otg.FlowHeader - // setMsg unmarshals FlowHeader from protobuf object *otg.FlowHeader - // and doesn't set defaults - setMsg(*otg.FlowHeader) FlowHeader - // provides marshal interface - Marshal() marshalFlowHeader - // provides unmarshal interface - Unmarshal() unMarshalFlowHeader - // validate validates FlowHeader - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowHeader, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowHeaderChoiceEnum, set in FlowHeader - Choice() FlowHeaderChoiceEnum - // setChoice assigns FlowHeaderChoiceEnum provided by user to FlowHeader - setChoice(value FlowHeaderChoiceEnum) FlowHeader - // HasChoice checks if Choice has been set in FlowHeader - HasChoice() bool - // Custom returns FlowCustom, set in FlowHeader. - // FlowCustom is custom packet header - Custom() FlowCustom - // SetCustom assigns FlowCustom provided by user to FlowHeader. - // FlowCustom is custom packet header - SetCustom(value FlowCustom) FlowHeader - // HasCustom checks if Custom has been set in FlowHeader - HasCustom() bool - // Ethernet returns FlowEthernet, set in FlowHeader. - // FlowEthernet is ethernet packet header - Ethernet() FlowEthernet - // SetEthernet assigns FlowEthernet provided by user to FlowHeader. - // FlowEthernet is ethernet packet header - SetEthernet(value FlowEthernet) FlowHeader - // HasEthernet checks if Ethernet has been set in FlowHeader - HasEthernet() bool - // Vlan returns FlowVlan, set in FlowHeader. - // FlowVlan is vLAN packet header - Vlan() FlowVlan - // SetVlan assigns FlowVlan provided by user to FlowHeader. - // FlowVlan is vLAN packet header - SetVlan(value FlowVlan) FlowHeader - // HasVlan checks if Vlan has been set in FlowHeader - HasVlan() bool - // Vxlan returns FlowVxlan, set in FlowHeader. - // FlowVxlan is vXLAN packet header - Vxlan() FlowVxlan - // SetVxlan assigns FlowVxlan provided by user to FlowHeader. - // FlowVxlan is vXLAN packet header - SetVxlan(value FlowVxlan) FlowHeader - // HasVxlan checks if Vxlan has been set in FlowHeader - HasVxlan() bool - // Ipv4 returns FlowIpv4, set in FlowHeader. - // FlowIpv4 is iPv4 packet header - Ipv4() FlowIpv4 - // SetIpv4 assigns FlowIpv4 provided by user to FlowHeader. - // FlowIpv4 is iPv4 packet header - SetIpv4(value FlowIpv4) FlowHeader - // HasIpv4 checks if Ipv4 has been set in FlowHeader - HasIpv4() bool - // Ipv6 returns FlowIpv6, set in FlowHeader. - // FlowIpv6 is iPv6 packet header - Ipv6() FlowIpv6 - // SetIpv6 assigns FlowIpv6 provided by user to FlowHeader. - // FlowIpv6 is iPv6 packet header - SetIpv6(value FlowIpv6) FlowHeader - // HasIpv6 checks if Ipv6 has been set in FlowHeader - HasIpv6() bool - // Pfcpause returns FlowPfcPause, set in FlowHeader. - // FlowPfcPause is iEEE 802.1Qbb PFC Pause packet header. - Pfcpause() FlowPfcPause - // SetPfcpause assigns FlowPfcPause provided by user to FlowHeader. - // FlowPfcPause is iEEE 802.1Qbb PFC Pause packet header. - SetPfcpause(value FlowPfcPause) FlowHeader - // HasPfcpause checks if Pfcpause has been set in FlowHeader - HasPfcpause() bool - // Ethernetpause returns FlowEthernetPause, set in FlowHeader. - // FlowEthernetPause is iEEE 802.3x global ethernet pause packet header - Ethernetpause() FlowEthernetPause - // SetEthernetpause assigns FlowEthernetPause provided by user to FlowHeader. - // FlowEthernetPause is iEEE 802.3x global ethernet pause packet header - SetEthernetpause(value FlowEthernetPause) FlowHeader - // HasEthernetpause checks if Ethernetpause has been set in FlowHeader - HasEthernetpause() bool - // Tcp returns FlowTcp, set in FlowHeader. - // FlowTcp is tCP packet header - Tcp() FlowTcp - // SetTcp assigns FlowTcp provided by user to FlowHeader. - // FlowTcp is tCP packet header - SetTcp(value FlowTcp) FlowHeader - // HasTcp checks if Tcp has been set in FlowHeader - HasTcp() bool - // Udp returns FlowUdp, set in FlowHeader. - // FlowUdp is uDP packet header - Udp() FlowUdp - // SetUdp assigns FlowUdp provided by user to FlowHeader. - // FlowUdp is uDP packet header - SetUdp(value FlowUdp) FlowHeader - // HasUdp checks if Udp has been set in FlowHeader - HasUdp() bool - // Gre returns FlowGre, set in FlowHeader. - // FlowGre is standard GRE packet header (RFC2784) - Gre() FlowGre - // SetGre assigns FlowGre provided by user to FlowHeader. - // FlowGre is standard GRE packet header (RFC2784) - SetGre(value FlowGre) FlowHeader - // HasGre checks if Gre has been set in FlowHeader - HasGre() bool - // Gtpv1 returns FlowGtpv1, set in FlowHeader. - // FlowGtpv1 is gTPv1 packet header - Gtpv1() FlowGtpv1 - // SetGtpv1 assigns FlowGtpv1 provided by user to FlowHeader. - // FlowGtpv1 is gTPv1 packet header - SetGtpv1(value FlowGtpv1) FlowHeader - // HasGtpv1 checks if Gtpv1 has been set in FlowHeader - HasGtpv1() bool - // Gtpv2 returns FlowGtpv2, set in FlowHeader. - // FlowGtpv2 is gTPv2 packet header - Gtpv2() FlowGtpv2 - // SetGtpv2 assigns FlowGtpv2 provided by user to FlowHeader. - // FlowGtpv2 is gTPv2 packet header - SetGtpv2(value FlowGtpv2) FlowHeader - // HasGtpv2 checks if Gtpv2 has been set in FlowHeader - HasGtpv2() bool - // Arp returns FlowArp, set in FlowHeader. - // FlowArp is aRP packet header - Arp() FlowArp - // SetArp assigns FlowArp provided by user to FlowHeader. - // FlowArp is aRP packet header - SetArp(value FlowArp) FlowHeader - // HasArp checks if Arp has been set in FlowHeader - HasArp() bool - // Icmp returns FlowIcmp, set in FlowHeader. - // FlowIcmp is iCMP packet header - Icmp() FlowIcmp - // SetIcmp assigns FlowIcmp provided by user to FlowHeader. - // FlowIcmp is iCMP packet header - SetIcmp(value FlowIcmp) FlowHeader - // HasIcmp checks if Icmp has been set in FlowHeader - HasIcmp() bool - // Icmpv6 returns FlowIcmpv6, set in FlowHeader. - // FlowIcmpv6 is iCMPv6 packet header - Icmpv6() FlowIcmpv6 - // SetIcmpv6 assigns FlowIcmpv6 provided by user to FlowHeader. - // FlowIcmpv6 is iCMPv6 packet header - SetIcmpv6(value FlowIcmpv6) FlowHeader - // HasIcmpv6 checks if Icmpv6 has been set in FlowHeader - HasIcmpv6() bool - // Ppp returns FlowPpp, set in FlowHeader. - // FlowPpp is pPP packet header - Ppp() FlowPpp - // SetPpp assigns FlowPpp provided by user to FlowHeader. - // FlowPpp is pPP packet header - SetPpp(value FlowPpp) FlowHeader - // HasPpp checks if Ppp has been set in FlowHeader - HasPpp() bool - // Igmpv1 returns FlowIgmpv1, set in FlowHeader. - // FlowIgmpv1 is iGMPv1 packet header - Igmpv1() FlowIgmpv1 - // SetIgmpv1 assigns FlowIgmpv1 provided by user to FlowHeader. - // FlowIgmpv1 is iGMPv1 packet header - SetIgmpv1(value FlowIgmpv1) FlowHeader - // HasIgmpv1 checks if Igmpv1 has been set in FlowHeader - HasIgmpv1() bool - // Mpls returns FlowMpls, set in FlowHeader. - // FlowMpls is mPLS packet header; When configuring multiple such headers, the count shall not exceed 20. - Mpls() FlowMpls - // SetMpls assigns FlowMpls provided by user to FlowHeader. - // FlowMpls is mPLS packet header; When configuring multiple such headers, the count shall not exceed 20. - SetMpls(value FlowMpls) FlowHeader - // HasMpls checks if Mpls has been set in FlowHeader - HasMpls() bool - // Snmpv2C returns FlowSnmpv2C, set in FlowHeader. - Snmpv2C() FlowSnmpv2C - // SetSnmpv2C assigns FlowSnmpv2C provided by user to FlowHeader. - SetSnmpv2C(value FlowSnmpv2C) FlowHeader - // HasSnmpv2C checks if Snmpv2C has been set in FlowHeader - HasSnmpv2C() bool - // Rsvp returns FlowRsvp, set in FlowHeader. - // FlowRsvp is rSVP packet header as defined in RFC2205 and RFC3209. Currently only supported message type is "Path" with mandatory objects and sub-objects. - Rsvp() FlowRsvp - // SetRsvp assigns FlowRsvp provided by user to FlowHeader. - // FlowRsvp is rSVP packet header as defined in RFC2205 and RFC3209. Currently only supported message type is "Path" with mandatory objects and sub-objects. - SetRsvp(value FlowRsvp) FlowHeader - // HasRsvp checks if Rsvp has been set in FlowHeader - HasRsvp() bool - setNil() -} - -type FlowHeaderChoiceEnum string - -// Enum of Choice on FlowHeader -var FlowHeaderChoice = struct { - CUSTOM FlowHeaderChoiceEnum - ETHERNET FlowHeaderChoiceEnum - VLAN FlowHeaderChoiceEnum - VXLAN FlowHeaderChoiceEnum - IPV4 FlowHeaderChoiceEnum - IPV6 FlowHeaderChoiceEnum - PFCPAUSE FlowHeaderChoiceEnum - ETHERNETPAUSE FlowHeaderChoiceEnum - TCP FlowHeaderChoiceEnum - UDP FlowHeaderChoiceEnum - GRE FlowHeaderChoiceEnum - GTPV1 FlowHeaderChoiceEnum - GTPV2 FlowHeaderChoiceEnum - ARP FlowHeaderChoiceEnum - ICMP FlowHeaderChoiceEnum - ICMPV6 FlowHeaderChoiceEnum - PPP FlowHeaderChoiceEnum - IGMPV1 FlowHeaderChoiceEnum - MPLS FlowHeaderChoiceEnum - SNMPV2C FlowHeaderChoiceEnum - RSVP FlowHeaderChoiceEnum -}{ - CUSTOM: FlowHeaderChoiceEnum("custom"), - ETHERNET: FlowHeaderChoiceEnum("ethernet"), - VLAN: FlowHeaderChoiceEnum("vlan"), - VXLAN: FlowHeaderChoiceEnum("vxlan"), - IPV4: FlowHeaderChoiceEnum("ipv4"), - IPV6: FlowHeaderChoiceEnum("ipv6"), - PFCPAUSE: FlowHeaderChoiceEnum("pfcpause"), - ETHERNETPAUSE: FlowHeaderChoiceEnum("ethernetpause"), - TCP: FlowHeaderChoiceEnum("tcp"), - UDP: FlowHeaderChoiceEnum("udp"), - GRE: FlowHeaderChoiceEnum("gre"), - GTPV1: FlowHeaderChoiceEnum("gtpv1"), - GTPV2: FlowHeaderChoiceEnum("gtpv2"), - ARP: FlowHeaderChoiceEnum("arp"), - ICMP: FlowHeaderChoiceEnum("icmp"), - ICMPV6: FlowHeaderChoiceEnum("icmpv6"), - PPP: FlowHeaderChoiceEnum("ppp"), - IGMPV1: FlowHeaderChoiceEnum("igmpv1"), - MPLS: FlowHeaderChoiceEnum("mpls"), - SNMPV2C: FlowHeaderChoiceEnum("snmpv2c"), - RSVP: FlowHeaderChoiceEnum("rsvp"), -} - -func (obj *flowHeader) Choice() FlowHeaderChoiceEnum { - return FlowHeaderChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The available types of flow headers. If one is not provided the -// default ethernet packet header MUST be provided. -// Choice returns a string -func (obj *flowHeader) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowHeader) setChoice(value FlowHeaderChoiceEnum) FlowHeader { - intValue, ok := otg.FlowHeader_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowHeaderChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowHeader_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Rsvp = nil - obj.rsvpHolder = nil - obj.obj.Snmpv2C = nil - obj.snmpv2CHolder = nil - obj.obj.Mpls = nil - obj.mplsHolder = nil - obj.obj.Igmpv1 = nil - obj.igmpv1Holder = nil - obj.obj.Ppp = nil - obj.pppHolder = nil - obj.obj.Icmpv6 = nil - obj.icmpv6Holder = nil - obj.obj.Icmp = nil - obj.icmpHolder = nil - obj.obj.Arp = nil - obj.arpHolder = nil - obj.obj.Gtpv2 = nil - obj.gtpv2Holder = nil - obj.obj.Gtpv1 = nil - obj.gtpv1Holder = nil - obj.obj.Gre = nil - obj.greHolder = nil - obj.obj.Udp = nil - obj.udpHolder = nil - obj.obj.Tcp = nil - obj.tcpHolder = nil - obj.obj.Ethernetpause = nil - obj.ethernetpauseHolder = nil - obj.obj.Pfcpause = nil - obj.pfcpauseHolder = nil - obj.obj.Ipv6 = nil - obj.ipv6Holder = nil - obj.obj.Ipv4 = nil - obj.ipv4Holder = nil - obj.obj.Vxlan = nil - obj.vxlanHolder = nil - obj.obj.Vlan = nil - obj.vlanHolder = nil - obj.obj.Ethernet = nil - obj.ethernetHolder = nil - obj.obj.Custom = nil - obj.customHolder = nil - - if value == FlowHeaderChoice.CUSTOM { - obj.obj.Custom = NewFlowCustom().msg() - } - - if value == FlowHeaderChoice.ETHERNET { - obj.obj.Ethernet = NewFlowEthernet().msg() - } - - if value == FlowHeaderChoice.VLAN { - obj.obj.Vlan = NewFlowVlan().msg() - } - - if value == FlowHeaderChoice.VXLAN { - obj.obj.Vxlan = NewFlowVxlan().msg() - } - - if value == FlowHeaderChoice.IPV4 { - obj.obj.Ipv4 = NewFlowIpv4().msg() - } - - if value == FlowHeaderChoice.IPV6 { - obj.obj.Ipv6 = NewFlowIpv6().msg() - } - - if value == FlowHeaderChoice.PFCPAUSE { - obj.obj.Pfcpause = NewFlowPfcPause().msg() - } - - if value == FlowHeaderChoice.ETHERNETPAUSE { - obj.obj.Ethernetpause = NewFlowEthernetPause().msg() - } - - if value == FlowHeaderChoice.TCP { - obj.obj.Tcp = NewFlowTcp().msg() - } - - if value == FlowHeaderChoice.UDP { - obj.obj.Udp = NewFlowUdp().msg() - } - - if value == FlowHeaderChoice.GRE { - obj.obj.Gre = NewFlowGre().msg() - } - - if value == FlowHeaderChoice.GTPV1 { - obj.obj.Gtpv1 = NewFlowGtpv1().msg() - } - - if value == FlowHeaderChoice.GTPV2 { - obj.obj.Gtpv2 = NewFlowGtpv2().msg() - } - - if value == FlowHeaderChoice.ARP { - obj.obj.Arp = NewFlowArp().msg() - } - - if value == FlowHeaderChoice.ICMP { - obj.obj.Icmp = NewFlowIcmp().msg() - } - - if value == FlowHeaderChoice.ICMPV6 { - obj.obj.Icmpv6 = NewFlowIcmpv6().msg() - } - - if value == FlowHeaderChoice.PPP { - obj.obj.Ppp = NewFlowPpp().msg() - } - - if value == FlowHeaderChoice.IGMPV1 { - obj.obj.Igmpv1 = NewFlowIgmpv1().msg() - } - - if value == FlowHeaderChoice.MPLS { - obj.obj.Mpls = NewFlowMpls().msg() - } - - if value == FlowHeaderChoice.SNMPV2C { - obj.obj.Snmpv2C = NewFlowSnmpv2C().msg() - } - - if value == FlowHeaderChoice.RSVP { - obj.obj.Rsvp = NewFlowRsvp().msg() - } - - return obj -} - -// description is TBD -// Custom returns a FlowCustom -func (obj *flowHeader) Custom() FlowCustom { - if obj.obj.Custom == nil { - obj.setChoice(FlowHeaderChoice.CUSTOM) - } - if obj.customHolder == nil { - obj.customHolder = &flowCustom{obj: obj.obj.Custom} - } - return obj.customHolder -} - -// description is TBD -// Custom returns a FlowCustom -func (obj *flowHeader) HasCustom() bool { - return obj.obj.Custom != nil -} - -// description is TBD -// SetCustom sets the FlowCustom value in the FlowHeader object -func (obj *flowHeader) SetCustom(value FlowCustom) FlowHeader { - obj.setChoice(FlowHeaderChoice.CUSTOM) - obj.customHolder = nil - obj.obj.Custom = value.msg() - - return obj -} - -// description is TBD -// Ethernet returns a FlowEthernet -func (obj *flowHeader) Ethernet() FlowEthernet { - if obj.obj.Ethernet == nil { - obj.setChoice(FlowHeaderChoice.ETHERNET) - } - if obj.ethernetHolder == nil { - obj.ethernetHolder = &flowEthernet{obj: obj.obj.Ethernet} - } - return obj.ethernetHolder -} - -// description is TBD -// Ethernet returns a FlowEthernet -func (obj *flowHeader) HasEthernet() bool { - return obj.obj.Ethernet != nil -} - -// description is TBD -// SetEthernet sets the FlowEthernet value in the FlowHeader object -func (obj *flowHeader) SetEthernet(value FlowEthernet) FlowHeader { - obj.setChoice(FlowHeaderChoice.ETHERNET) - obj.ethernetHolder = nil - obj.obj.Ethernet = value.msg() - - return obj -} - -// description is TBD -// Vlan returns a FlowVlan -func (obj *flowHeader) Vlan() FlowVlan { - if obj.obj.Vlan == nil { - obj.setChoice(FlowHeaderChoice.VLAN) - } - if obj.vlanHolder == nil { - obj.vlanHolder = &flowVlan{obj: obj.obj.Vlan} - } - return obj.vlanHolder -} - -// description is TBD -// Vlan returns a FlowVlan -func (obj *flowHeader) HasVlan() bool { - return obj.obj.Vlan != nil -} - -// description is TBD -// SetVlan sets the FlowVlan value in the FlowHeader object -func (obj *flowHeader) SetVlan(value FlowVlan) FlowHeader { - obj.setChoice(FlowHeaderChoice.VLAN) - obj.vlanHolder = nil - obj.obj.Vlan = value.msg() - - return obj -} - -// description is TBD -// Vxlan returns a FlowVxlan -func (obj *flowHeader) Vxlan() FlowVxlan { - if obj.obj.Vxlan == nil { - obj.setChoice(FlowHeaderChoice.VXLAN) - } - if obj.vxlanHolder == nil { - obj.vxlanHolder = &flowVxlan{obj: obj.obj.Vxlan} - } - return obj.vxlanHolder -} - -// description is TBD -// Vxlan returns a FlowVxlan -func (obj *flowHeader) HasVxlan() bool { - return obj.obj.Vxlan != nil -} - -// description is TBD -// SetVxlan sets the FlowVxlan value in the FlowHeader object -func (obj *flowHeader) SetVxlan(value FlowVxlan) FlowHeader { - obj.setChoice(FlowHeaderChoice.VXLAN) - obj.vxlanHolder = nil - obj.obj.Vxlan = value.msg() - - return obj -} - -// description is TBD -// Ipv4 returns a FlowIpv4 -func (obj *flowHeader) Ipv4() FlowIpv4 { - if obj.obj.Ipv4 == nil { - obj.setChoice(FlowHeaderChoice.IPV4) - } - if obj.ipv4Holder == nil { - obj.ipv4Holder = &flowIpv4{obj: obj.obj.Ipv4} - } - return obj.ipv4Holder -} - -// description is TBD -// Ipv4 returns a FlowIpv4 -func (obj *flowHeader) HasIpv4() bool { - return obj.obj.Ipv4 != nil -} - -// description is TBD -// SetIpv4 sets the FlowIpv4 value in the FlowHeader object -func (obj *flowHeader) SetIpv4(value FlowIpv4) FlowHeader { - obj.setChoice(FlowHeaderChoice.IPV4) - obj.ipv4Holder = nil - obj.obj.Ipv4 = value.msg() - - return obj -} - -// description is TBD -// Ipv6 returns a FlowIpv6 -func (obj *flowHeader) Ipv6() FlowIpv6 { - if obj.obj.Ipv6 == nil { - obj.setChoice(FlowHeaderChoice.IPV6) - } - if obj.ipv6Holder == nil { - obj.ipv6Holder = &flowIpv6{obj: obj.obj.Ipv6} - } - return obj.ipv6Holder -} - -// description is TBD -// Ipv6 returns a FlowIpv6 -func (obj *flowHeader) HasIpv6() bool { - return obj.obj.Ipv6 != nil -} - -// description is TBD -// SetIpv6 sets the FlowIpv6 value in the FlowHeader object -func (obj *flowHeader) SetIpv6(value FlowIpv6) FlowHeader { - obj.setChoice(FlowHeaderChoice.IPV6) - obj.ipv6Holder = nil - obj.obj.Ipv6 = value.msg() - - return obj -} - -// description is TBD -// Pfcpause returns a FlowPfcPause -func (obj *flowHeader) Pfcpause() FlowPfcPause { - if obj.obj.Pfcpause == nil { - obj.setChoice(FlowHeaderChoice.PFCPAUSE) - } - if obj.pfcpauseHolder == nil { - obj.pfcpauseHolder = &flowPfcPause{obj: obj.obj.Pfcpause} - } - return obj.pfcpauseHolder -} - -// description is TBD -// Pfcpause returns a FlowPfcPause -func (obj *flowHeader) HasPfcpause() bool { - return obj.obj.Pfcpause != nil -} - -// description is TBD -// SetPfcpause sets the FlowPfcPause value in the FlowHeader object -func (obj *flowHeader) SetPfcpause(value FlowPfcPause) FlowHeader { - obj.setChoice(FlowHeaderChoice.PFCPAUSE) - obj.pfcpauseHolder = nil - obj.obj.Pfcpause = value.msg() - - return obj -} - -// description is TBD -// Ethernetpause returns a FlowEthernetPause -func (obj *flowHeader) Ethernetpause() FlowEthernetPause { - if obj.obj.Ethernetpause == nil { - obj.setChoice(FlowHeaderChoice.ETHERNETPAUSE) - } - if obj.ethernetpauseHolder == nil { - obj.ethernetpauseHolder = &flowEthernetPause{obj: obj.obj.Ethernetpause} - } - return obj.ethernetpauseHolder -} - -// description is TBD -// Ethernetpause returns a FlowEthernetPause -func (obj *flowHeader) HasEthernetpause() bool { - return obj.obj.Ethernetpause != nil -} - -// description is TBD -// SetEthernetpause sets the FlowEthernetPause value in the FlowHeader object -func (obj *flowHeader) SetEthernetpause(value FlowEthernetPause) FlowHeader { - obj.setChoice(FlowHeaderChoice.ETHERNETPAUSE) - obj.ethernetpauseHolder = nil - obj.obj.Ethernetpause = value.msg() - - return obj -} - -// description is TBD -// Tcp returns a FlowTcp -func (obj *flowHeader) Tcp() FlowTcp { - if obj.obj.Tcp == nil { - obj.setChoice(FlowHeaderChoice.TCP) - } - if obj.tcpHolder == nil { - obj.tcpHolder = &flowTcp{obj: obj.obj.Tcp} - } - return obj.tcpHolder -} - -// description is TBD -// Tcp returns a FlowTcp -func (obj *flowHeader) HasTcp() bool { - return obj.obj.Tcp != nil -} - -// description is TBD -// SetTcp sets the FlowTcp value in the FlowHeader object -func (obj *flowHeader) SetTcp(value FlowTcp) FlowHeader { - obj.setChoice(FlowHeaderChoice.TCP) - obj.tcpHolder = nil - obj.obj.Tcp = value.msg() - - return obj -} - -// description is TBD -// Udp returns a FlowUdp -func (obj *flowHeader) Udp() FlowUdp { - if obj.obj.Udp == nil { - obj.setChoice(FlowHeaderChoice.UDP) - } - if obj.udpHolder == nil { - obj.udpHolder = &flowUdp{obj: obj.obj.Udp} - } - return obj.udpHolder -} - -// description is TBD -// Udp returns a FlowUdp -func (obj *flowHeader) HasUdp() bool { - return obj.obj.Udp != nil -} - -// description is TBD -// SetUdp sets the FlowUdp value in the FlowHeader object -func (obj *flowHeader) SetUdp(value FlowUdp) FlowHeader { - obj.setChoice(FlowHeaderChoice.UDP) - obj.udpHolder = nil - obj.obj.Udp = value.msg() - - return obj -} - -// description is TBD -// Gre returns a FlowGre -func (obj *flowHeader) Gre() FlowGre { - if obj.obj.Gre == nil { - obj.setChoice(FlowHeaderChoice.GRE) - } - if obj.greHolder == nil { - obj.greHolder = &flowGre{obj: obj.obj.Gre} - } - return obj.greHolder -} - -// description is TBD -// Gre returns a FlowGre -func (obj *flowHeader) HasGre() bool { - return obj.obj.Gre != nil -} - -// description is TBD -// SetGre sets the FlowGre value in the FlowHeader object -func (obj *flowHeader) SetGre(value FlowGre) FlowHeader { - obj.setChoice(FlowHeaderChoice.GRE) - obj.greHolder = nil - obj.obj.Gre = value.msg() - - return obj -} - -// description is TBD -// Gtpv1 returns a FlowGtpv1 -func (obj *flowHeader) Gtpv1() FlowGtpv1 { - if obj.obj.Gtpv1 == nil { - obj.setChoice(FlowHeaderChoice.GTPV1) - } - if obj.gtpv1Holder == nil { - obj.gtpv1Holder = &flowGtpv1{obj: obj.obj.Gtpv1} - } - return obj.gtpv1Holder -} - -// description is TBD -// Gtpv1 returns a FlowGtpv1 -func (obj *flowHeader) HasGtpv1() bool { - return obj.obj.Gtpv1 != nil -} - -// description is TBD -// SetGtpv1 sets the FlowGtpv1 value in the FlowHeader object -func (obj *flowHeader) SetGtpv1(value FlowGtpv1) FlowHeader { - obj.setChoice(FlowHeaderChoice.GTPV1) - obj.gtpv1Holder = nil - obj.obj.Gtpv1 = value.msg() - - return obj -} - -// description is TBD -// Gtpv2 returns a FlowGtpv2 -func (obj *flowHeader) Gtpv2() FlowGtpv2 { - if obj.obj.Gtpv2 == nil { - obj.setChoice(FlowHeaderChoice.GTPV2) - } - if obj.gtpv2Holder == nil { - obj.gtpv2Holder = &flowGtpv2{obj: obj.obj.Gtpv2} - } - return obj.gtpv2Holder -} - -// description is TBD -// Gtpv2 returns a FlowGtpv2 -func (obj *flowHeader) HasGtpv2() bool { - return obj.obj.Gtpv2 != nil -} - -// description is TBD -// SetGtpv2 sets the FlowGtpv2 value in the FlowHeader object -func (obj *flowHeader) SetGtpv2(value FlowGtpv2) FlowHeader { - obj.setChoice(FlowHeaderChoice.GTPV2) - obj.gtpv2Holder = nil - obj.obj.Gtpv2 = value.msg() - - return obj -} - -// description is TBD -// Arp returns a FlowArp -func (obj *flowHeader) Arp() FlowArp { - if obj.obj.Arp == nil { - obj.setChoice(FlowHeaderChoice.ARP) - } - if obj.arpHolder == nil { - obj.arpHolder = &flowArp{obj: obj.obj.Arp} - } - return obj.arpHolder -} - -// description is TBD -// Arp returns a FlowArp -func (obj *flowHeader) HasArp() bool { - return obj.obj.Arp != nil -} - -// description is TBD -// SetArp sets the FlowArp value in the FlowHeader object -func (obj *flowHeader) SetArp(value FlowArp) FlowHeader { - obj.setChoice(FlowHeaderChoice.ARP) - obj.arpHolder = nil - obj.obj.Arp = value.msg() - - return obj -} - -// description is TBD -// Icmp returns a FlowIcmp -func (obj *flowHeader) Icmp() FlowIcmp { - if obj.obj.Icmp == nil { - obj.setChoice(FlowHeaderChoice.ICMP) - } - if obj.icmpHolder == nil { - obj.icmpHolder = &flowIcmp{obj: obj.obj.Icmp} - } - return obj.icmpHolder -} - -// description is TBD -// Icmp returns a FlowIcmp -func (obj *flowHeader) HasIcmp() bool { - return obj.obj.Icmp != nil -} - -// description is TBD -// SetIcmp sets the FlowIcmp value in the FlowHeader object -func (obj *flowHeader) SetIcmp(value FlowIcmp) FlowHeader { - obj.setChoice(FlowHeaderChoice.ICMP) - obj.icmpHolder = nil - obj.obj.Icmp = value.msg() - - return obj -} - -// description is TBD -// Icmpv6 returns a FlowIcmpv6 -func (obj *flowHeader) Icmpv6() FlowIcmpv6 { - if obj.obj.Icmpv6 == nil { - obj.setChoice(FlowHeaderChoice.ICMPV6) - } - if obj.icmpv6Holder == nil { - obj.icmpv6Holder = &flowIcmpv6{obj: obj.obj.Icmpv6} - } - return obj.icmpv6Holder -} - -// description is TBD -// Icmpv6 returns a FlowIcmpv6 -func (obj *flowHeader) HasIcmpv6() bool { - return obj.obj.Icmpv6 != nil -} - -// description is TBD -// SetIcmpv6 sets the FlowIcmpv6 value in the FlowHeader object -func (obj *flowHeader) SetIcmpv6(value FlowIcmpv6) FlowHeader { - obj.setChoice(FlowHeaderChoice.ICMPV6) - obj.icmpv6Holder = nil - obj.obj.Icmpv6 = value.msg() - - return obj -} - -// description is TBD -// Ppp returns a FlowPpp -func (obj *flowHeader) Ppp() FlowPpp { - if obj.obj.Ppp == nil { - obj.setChoice(FlowHeaderChoice.PPP) - } - if obj.pppHolder == nil { - obj.pppHolder = &flowPpp{obj: obj.obj.Ppp} - } - return obj.pppHolder -} - -// description is TBD -// Ppp returns a FlowPpp -func (obj *flowHeader) HasPpp() bool { - return obj.obj.Ppp != nil -} - -// description is TBD -// SetPpp sets the FlowPpp value in the FlowHeader object -func (obj *flowHeader) SetPpp(value FlowPpp) FlowHeader { - obj.setChoice(FlowHeaderChoice.PPP) - obj.pppHolder = nil - obj.obj.Ppp = value.msg() - - return obj -} - -// description is TBD -// Igmpv1 returns a FlowIgmpv1 -func (obj *flowHeader) Igmpv1() FlowIgmpv1 { - if obj.obj.Igmpv1 == nil { - obj.setChoice(FlowHeaderChoice.IGMPV1) - } - if obj.igmpv1Holder == nil { - obj.igmpv1Holder = &flowIgmpv1{obj: obj.obj.Igmpv1} - } - return obj.igmpv1Holder -} - -// description is TBD -// Igmpv1 returns a FlowIgmpv1 -func (obj *flowHeader) HasIgmpv1() bool { - return obj.obj.Igmpv1 != nil -} - -// description is TBD -// SetIgmpv1 sets the FlowIgmpv1 value in the FlowHeader object -func (obj *flowHeader) SetIgmpv1(value FlowIgmpv1) FlowHeader { - obj.setChoice(FlowHeaderChoice.IGMPV1) - obj.igmpv1Holder = nil - obj.obj.Igmpv1 = value.msg() - - return obj -} - -// description is TBD -// Mpls returns a FlowMpls -func (obj *flowHeader) Mpls() FlowMpls { - if obj.obj.Mpls == nil { - obj.setChoice(FlowHeaderChoice.MPLS) - } - if obj.mplsHolder == nil { - obj.mplsHolder = &flowMpls{obj: obj.obj.Mpls} - } - return obj.mplsHolder -} - -// description is TBD -// Mpls returns a FlowMpls -func (obj *flowHeader) HasMpls() bool { - return obj.obj.Mpls != nil -} - -// description is TBD -// SetMpls sets the FlowMpls value in the FlowHeader object -func (obj *flowHeader) SetMpls(value FlowMpls) FlowHeader { - obj.setChoice(FlowHeaderChoice.MPLS) - obj.mplsHolder = nil - obj.obj.Mpls = value.msg() - - return obj -} - -// description is TBD -// Snmpv2C returns a FlowSnmpv2C -func (obj *flowHeader) Snmpv2C() FlowSnmpv2C { - if obj.obj.Snmpv2C == nil { - obj.setChoice(FlowHeaderChoice.SNMPV2C) - } - if obj.snmpv2CHolder == nil { - obj.snmpv2CHolder = &flowSnmpv2C{obj: obj.obj.Snmpv2C} - } - return obj.snmpv2CHolder -} - -// description is TBD -// Snmpv2C returns a FlowSnmpv2C -func (obj *flowHeader) HasSnmpv2C() bool { - return obj.obj.Snmpv2C != nil -} - -// description is TBD -// SetSnmpv2C sets the FlowSnmpv2C value in the FlowHeader object -func (obj *flowHeader) SetSnmpv2C(value FlowSnmpv2C) FlowHeader { - obj.setChoice(FlowHeaderChoice.SNMPV2C) - obj.snmpv2CHolder = nil - obj.obj.Snmpv2C = value.msg() - - return obj -} - -// description is TBD -// Rsvp returns a FlowRsvp -func (obj *flowHeader) Rsvp() FlowRsvp { - if obj.obj.Rsvp == nil { - obj.setChoice(FlowHeaderChoice.RSVP) - } - if obj.rsvpHolder == nil { - obj.rsvpHolder = &flowRsvp{obj: obj.obj.Rsvp} - } - return obj.rsvpHolder -} - -// description is TBD -// Rsvp returns a FlowRsvp -func (obj *flowHeader) HasRsvp() bool { - return obj.obj.Rsvp != nil -} - -// description is TBD -// SetRsvp sets the FlowRsvp value in the FlowHeader object -func (obj *flowHeader) SetRsvp(value FlowRsvp) FlowHeader { - obj.setChoice(FlowHeaderChoice.RSVP) - obj.rsvpHolder = nil - obj.obj.Rsvp = value.msg() - - return obj -} - -func (obj *flowHeader) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Custom != nil { - - obj.Custom().validateObj(vObj, set_default) - } - - if obj.obj.Ethernet != nil { - - obj.Ethernet().validateObj(vObj, set_default) - } - - if obj.obj.Vlan != nil { - - obj.Vlan().validateObj(vObj, set_default) - } - - if obj.obj.Vxlan != nil { - - obj.Vxlan().validateObj(vObj, set_default) - } - - if obj.obj.Ipv4 != nil { - - obj.Ipv4().validateObj(vObj, set_default) - } - - if obj.obj.Ipv6 != nil { - - obj.Ipv6().validateObj(vObj, set_default) - } - - if obj.obj.Pfcpause != nil { - - obj.Pfcpause().validateObj(vObj, set_default) - } - - if obj.obj.Ethernetpause != nil { - - obj.Ethernetpause().validateObj(vObj, set_default) - } - - if obj.obj.Tcp != nil { - - obj.Tcp().validateObj(vObj, set_default) - } - - if obj.obj.Udp != nil { - - obj.Udp().validateObj(vObj, set_default) - } - - if obj.obj.Gre != nil { - - obj.Gre().validateObj(vObj, set_default) - } - - if obj.obj.Gtpv1 != nil { - - obj.Gtpv1().validateObj(vObj, set_default) - } - - if obj.obj.Gtpv2 != nil { - - obj.Gtpv2().validateObj(vObj, set_default) - } - - if obj.obj.Arp != nil { - - obj.Arp().validateObj(vObj, set_default) - } - - if obj.obj.Icmp != nil { - - obj.Icmp().validateObj(vObj, set_default) - } - - if obj.obj.Icmpv6 != nil { - - obj.Icmpv6().validateObj(vObj, set_default) - } - - if obj.obj.Ppp != nil { - - obj.Ppp().validateObj(vObj, set_default) - } - - if obj.obj.Igmpv1 != nil { - - obj.Igmpv1().validateObj(vObj, set_default) - } - - if obj.obj.Mpls != nil { - - obj.Mpls().validateObj(vObj, set_default) - } - - if obj.obj.Snmpv2C != nil { - - obj.Snmpv2C().validateObj(vObj, set_default) - } - - if obj.obj.Rsvp != nil { - - obj.Rsvp().validateObj(vObj, set_default) - } - -} - -func (obj *flowHeader) setDefault() { - var choices_set int = 0 - var choice FlowHeaderChoiceEnum - - if obj.obj.Custom != nil { - choices_set += 1 - choice = FlowHeaderChoice.CUSTOM - } - - if obj.obj.Ethernet != nil { - choices_set += 1 - choice = FlowHeaderChoice.ETHERNET - } - - if obj.obj.Vlan != nil { - choices_set += 1 - choice = FlowHeaderChoice.VLAN - } - - if obj.obj.Vxlan != nil { - choices_set += 1 - choice = FlowHeaderChoice.VXLAN - } - - if obj.obj.Ipv4 != nil { - choices_set += 1 - choice = FlowHeaderChoice.IPV4 - } - - if obj.obj.Ipv6 != nil { - choices_set += 1 - choice = FlowHeaderChoice.IPV6 - } - - if obj.obj.Pfcpause != nil { - choices_set += 1 - choice = FlowHeaderChoice.PFCPAUSE - } - - if obj.obj.Ethernetpause != nil { - choices_set += 1 - choice = FlowHeaderChoice.ETHERNETPAUSE - } - - if obj.obj.Tcp != nil { - choices_set += 1 - choice = FlowHeaderChoice.TCP - } - - if obj.obj.Udp != nil { - choices_set += 1 - choice = FlowHeaderChoice.UDP - } - - if obj.obj.Gre != nil { - choices_set += 1 - choice = FlowHeaderChoice.GRE - } - - if obj.obj.Gtpv1 != nil { - choices_set += 1 - choice = FlowHeaderChoice.GTPV1 - } - - if obj.obj.Gtpv2 != nil { - choices_set += 1 - choice = FlowHeaderChoice.GTPV2 - } - - if obj.obj.Arp != nil { - choices_set += 1 - choice = FlowHeaderChoice.ARP - } - - if obj.obj.Icmp != nil { - choices_set += 1 - choice = FlowHeaderChoice.ICMP - } - - if obj.obj.Icmpv6 != nil { - choices_set += 1 - choice = FlowHeaderChoice.ICMPV6 - } - - if obj.obj.Ppp != nil { - choices_set += 1 - choice = FlowHeaderChoice.PPP - } - - if obj.obj.Igmpv1 != nil { - choices_set += 1 - choice = FlowHeaderChoice.IGMPV1 - } - - if obj.obj.Mpls != nil { - choices_set += 1 - choice = FlowHeaderChoice.MPLS - } - - if obj.obj.Snmpv2C != nil { - choices_set += 1 - choice = FlowHeaderChoice.SNMPV2C - } - - if obj.obj.Rsvp != nil { - choices_set += 1 - choice = FlowHeaderChoice.RSVP - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowHeaderChoice.ETHERNET) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowHeader") - } - } else { - intVal := otg.FlowHeader_Choice_Enum_value[string(choice)] - enumValue := otg.FlowHeader_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowSize ***** -type flowSize struct { - validation - obj *otg.FlowSize - marshaller marshalFlowSize - unMarshaller unMarshalFlowSize - incrementHolder FlowSizeIncrement - randomHolder FlowSizeRandom - weightPairsHolder FlowSizeWeightPairs -} - -func NewFlowSize() FlowSize { - obj := flowSize{obj: &otg.FlowSize{}} - obj.setDefault() - return &obj -} - -func (obj *flowSize) msg() *otg.FlowSize { - return obj.obj -} - -func (obj *flowSize) setMsg(msg *otg.FlowSize) FlowSize { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowSize struct { - obj *flowSize -} - -type marshalFlowSize interface { - // ToProto marshals FlowSize to protobuf object *otg.FlowSize - ToProto() (*otg.FlowSize, error) - // ToPbText marshals FlowSize to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowSize to YAML text - ToYaml() (string, error) - // ToJson marshals FlowSize to JSON text - ToJson() (string, error) -} - -type unMarshalflowSize struct { - obj *flowSize -} - -type unMarshalFlowSize interface { - // FromProto unmarshals FlowSize from protobuf object *otg.FlowSize - FromProto(msg *otg.FlowSize) (FlowSize, error) - // FromPbText unmarshals FlowSize from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowSize from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowSize from JSON text - FromJson(value string) error -} - -func (obj *flowSize) Marshal() marshalFlowSize { - if obj.marshaller == nil { - obj.marshaller = &marshalflowSize{obj: obj} - } - return obj.marshaller -} - -func (obj *flowSize) Unmarshal() unMarshalFlowSize { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowSize{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowSize) ToProto() (*otg.FlowSize, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowSize) FromProto(msg *otg.FlowSize) (FlowSize, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowSize) 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 *unMarshalflowSize) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowSize) 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 *unMarshalflowSize) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowSize) 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 *unMarshalflowSize) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowSize) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowSize) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowSize) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowSize) Clone() (FlowSize, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowSize() - 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 -} - -func (obj *flowSize) setNil() { - obj.incrementHolder = nil - obj.randomHolder = nil - obj.weightPairsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowSize is the frame size which overrides the total length of the packet -type FlowSize interface { - Validation - // msg marshals FlowSize to protobuf object *otg.FlowSize - // and doesn't set defaults - msg() *otg.FlowSize - // setMsg unmarshals FlowSize from protobuf object *otg.FlowSize - // and doesn't set defaults - setMsg(*otg.FlowSize) FlowSize - // provides marshal interface - Marshal() marshalFlowSize - // provides unmarshal interface - Unmarshal() unMarshalFlowSize - // validate validates FlowSize - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowSize, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowSizeChoiceEnum, set in FlowSize - Choice() FlowSizeChoiceEnum - // setChoice assigns FlowSizeChoiceEnum provided by user to FlowSize - setChoice(value FlowSizeChoiceEnum) FlowSize - // HasChoice checks if Choice has been set in FlowSize - HasChoice() bool - // Fixed returns uint32, set in FlowSize. - Fixed() uint32 - // SetFixed assigns uint32 provided by user to FlowSize - SetFixed(value uint32) FlowSize - // HasFixed checks if Fixed has been set in FlowSize - HasFixed() bool - // Increment returns FlowSizeIncrement, set in FlowSize. - // FlowSizeIncrement is frame size that increments from a starting size to - // an ending size incrementing by a step size. - Increment() FlowSizeIncrement - // SetIncrement assigns FlowSizeIncrement provided by user to FlowSize. - // FlowSizeIncrement is frame size that increments from a starting size to - // an ending size incrementing by a step size. - SetIncrement(value FlowSizeIncrement) FlowSize - // HasIncrement checks if Increment has been set in FlowSize - HasIncrement() bool - // Random returns FlowSizeRandom, set in FlowSize. - // FlowSizeRandom is random frame size from a min value to a max value. - Random() FlowSizeRandom - // SetRandom assigns FlowSizeRandom provided by user to FlowSize. - // FlowSizeRandom is random frame size from a min value to a max value. - SetRandom(value FlowSizeRandom) FlowSize - // HasRandom checks if Random has been set in FlowSize - HasRandom() bool - // WeightPairs returns FlowSizeWeightPairs, set in FlowSize. - // FlowSizeWeightPairs is frame size distribution, defined as pairs (including IMIX distribution). - // Frames are randomly generated such that the proportion of each frame size out of the total number of frames - // are matching with the weight value of the pair. However, as with any other probability - // distribution, the sample distribution is close to theoretical value only if the size of the sample is reasonably large. - // When the number of frames is very low the transmitted frames may not come close to the ratio described in the weight. - WeightPairs() FlowSizeWeightPairs - // SetWeightPairs assigns FlowSizeWeightPairs provided by user to FlowSize. - // FlowSizeWeightPairs is frame size distribution, defined as pairs (including IMIX distribution). - // Frames are randomly generated such that the proportion of each frame size out of the total number of frames - // are matching with the weight value of the pair. However, as with any other probability - // distribution, the sample distribution is close to theoretical value only if the size of the sample is reasonably large. - // When the number of frames is very low the transmitted frames may not come close to the ratio described in the weight. - SetWeightPairs(value FlowSizeWeightPairs) FlowSize - // HasWeightPairs checks if WeightPairs has been set in FlowSize - HasWeightPairs() bool - setNil() -} - -type FlowSizeChoiceEnum string - -// Enum of Choice on FlowSize -var FlowSizeChoice = struct { - FIXED FlowSizeChoiceEnum - INCREMENT FlowSizeChoiceEnum - RANDOM FlowSizeChoiceEnum - WEIGHT_PAIRS FlowSizeChoiceEnum -}{ - FIXED: FlowSizeChoiceEnum("fixed"), - INCREMENT: FlowSizeChoiceEnum("increment"), - RANDOM: FlowSizeChoiceEnum("random"), - WEIGHT_PAIRS: FlowSizeChoiceEnum("weight_pairs"), -} - -func (obj *flowSize) Choice() FlowSizeChoiceEnum { - return FlowSizeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowSize) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowSize) setChoice(value FlowSizeChoiceEnum) FlowSize { - intValue, ok := otg.FlowSize_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowSizeChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowSize_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.WeightPairs = nil - obj.weightPairsHolder = nil - obj.obj.Random = nil - obj.randomHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Fixed = nil - - if value == FlowSizeChoice.FIXED { - defaultValue := uint32(64) - obj.obj.Fixed = &defaultValue - } - - if value == FlowSizeChoice.INCREMENT { - obj.obj.Increment = NewFlowSizeIncrement().msg() - } - - if value == FlowSizeChoice.RANDOM { - obj.obj.Random = NewFlowSizeRandom().msg() - } - - if value == FlowSizeChoice.WEIGHT_PAIRS { - obj.obj.WeightPairs = NewFlowSizeWeightPairs().msg() - } - - return obj -} - -// description is TBD -// Fixed returns a uint32 -func (obj *flowSize) Fixed() uint32 { - - if obj.obj.Fixed == nil { - obj.setChoice(FlowSizeChoice.FIXED) - } - - return *obj.obj.Fixed - -} - -// description is TBD -// Fixed returns a uint32 -func (obj *flowSize) HasFixed() bool { - return obj.obj.Fixed != nil -} - -// description is TBD -// SetFixed sets the uint32 value in the FlowSize object -func (obj *flowSize) SetFixed(value uint32) FlowSize { - obj.setChoice(FlowSizeChoice.FIXED) - obj.obj.Fixed = &value - return obj -} - -// description is TBD -// Increment returns a FlowSizeIncrement -func (obj *flowSize) Increment() FlowSizeIncrement { - if obj.obj.Increment == nil { - obj.setChoice(FlowSizeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &flowSizeIncrement{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a FlowSizeIncrement -func (obj *flowSize) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the FlowSizeIncrement value in the FlowSize object -func (obj *flowSize) SetIncrement(value FlowSizeIncrement) FlowSize { - obj.setChoice(FlowSizeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Random returns a FlowSizeRandom -func (obj *flowSize) Random() FlowSizeRandom { - if obj.obj.Random == nil { - obj.setChoice(FlowSizeChoice.RANDOM) - } - if obj.randomHolder == nil { - obj.randomHolder = &flowSizeRandom{obj: obj.obj.Random} - } - return obj.randomHolder -} - -// description is TBD -// Random returns a FlowSizeRandom -func (obj *flowSize) HasRandom() bool { - return obj.obj.Random != nil -} - -// description is TBD -// SetRandom sets the FlowSizeRandom value in the FlowSize object -func (obj *flowSize) SetRandom(value FlowSizeRandom) FlowSize { - obj.setChoice(FlowSizeChoice.RANDOM) - obj.randomHolder = nil - obj.obj.Random = value.msg() - - return obj -} - -// description is TBD -// WeightPairs returns a FlowSizeWeightPairs -func (obj *flowSize) WeightPairs() FlowSizeWeightPairs { - if obj.obj.WeightPairs == nil { - obj.setChoice(FlowSizeChoice.WEIGHT_PAIRS) - } - if obj.weightPairsHolder == nil { - obj.weightPairsHolder = &flowSizeWeightPairs{obj: obj.obj.WeightPairs} - } - return obj.weightPairsHolder -} - -// description is TBD -// WeightPairs returns a FlowSizeWeightPairs -func (obj *flowSize) HasWeightPairs() bool { - return obj.obj.WeightPairs != nil -} - -// description is TBD -// SetWeightPairs sets the FlowSizeWeightPairs value in the FlowSize object -func (obj *flowSize) SetWeightPairs(value FlowSizeWeightPairs) FlowSize { - obj.setChoice(FlowSizeChoice.WEIGHT_PAIRS) - obj.weightPairsHolder = nil - obj.obj.WeightPairs = value.msg() - - return obj -} - -func (obj *flowSize) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Random != nil { - - obj.Random().validateObj(vObj, set_default) - } - - if obj.obj.WeightPairs != nil { - - obj.WeightPairs().validateObj(vObj, set_default) - } - -} - -func (obj *flowSize) setDefault() { - var choices_set int = 0 - var choice FlowSizeChoiceEnum - - if obj.obj.Fixed != nil { - choices_set += 1 - choice = FlowSizeChoice.FIXED - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = FlowSizeChoice.INCREMENT - } - - if obj.obj.Random != nil { - choices_set += 1 - choice = FlowSizeChoice.RANDOM - } - - if obj.obj.WeightPairs != nil { - choices_set += 1 - choice = FlowSizeChoice.WEIGHT_PAIRS - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowSizeChoice.FIXED) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowSize") - } - } else { - intVal := otg.FlowSize_Choice_Enum_value[string(choice)] - enumValue := otg.FlowSize_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRate ***** -type flowRate struct { - validation - obj *otg.FlowRate - marshaller marshalFlowRate - unMarshaller unMarshalFlowRate -} - -func NewFlowRate() FlowRate { - obj := flowRate{obj: &otg.FlowRate{}} - obj.setDefault() - return &obj -} - -func (obj *flowRate) msg() *otg.FlowRate { - return obj.obj -} - -func (obj *flowRate) setMsg(msg *otg.FlowRate) FlowRate { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRate struct { - obj *flowRate -} - -type marshalFlowRate interface { - // ToProto marshals FlowRate to protobuf object *otg.FlowRate - ToProto() (*otg.FlowRate, error) - // ToPbText marshals FlowRate to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRate to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRate to JSON text - ToJson() (string, error) -} - -type unMarshalflowRate struct { - obj *flowRate -} - -type unMarshalFlowRate interface { - // FromProto unmarshals FlowRate from protobuf object *otg.FlowRate - FromProto(msg *otg.FlowRate) (FlowRate, error) - // FromPbText unmarshals FlowRate from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRate from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRate from JSON text - FromJson(value string) error -} - -func (obj *flowRate) Marshal() marshalFlowRate { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRate{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRate) Unmarshal() unMarshalFlowRate { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRate{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRate) ToProto() (*otg.FlowRate, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRate) FromProto(msg *otg.FlowRate) (FlowRate, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRate) 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 *unMarshalflowRate) 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 *marshalflowRate) 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 *unMarshalflowRate) 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 *marshalflowRate) 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 *unMarshalflowRate) 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 *flowRate) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRate) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRate) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRate) Clone() (FlowRate, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRate() - 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 -} - -// FlowRate is the rate of packet transmission -type FlowRate interface { - Validation - // msg marshals FlowRate to protobuf object *otg.FlowRate - // and doesn't set defaults - msg() *otg.FlowRate - // setMsg unmarshals FlowRate from protobuf object *otg.FlowRate - // and doesn't set defaults - setMsg(*otg.FlowRate) FlowRate - // provides marshal interface - Marshal() marshalFlowRate - // provides unmarshal interface - Unmarshal() unMarshalFlowRate - // validate validates FlowRate - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRate, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRateChoiceEnum, set in FlowRate - Choice() FlowRateChoiceEnum - // setChoice assigns FlowRateChoiceEnum provided by user to FlowRate - setChoice(value FlowRateChoiceEnum) FlowRate - // HasChoice checks if Choice has been set in FlowRate - HasChoice() bool - // Pps returns uint64, set in FlowRate. - Pps() uint64 - // SetPps assigns uint64 provided by user to FlowRate - SetPps(value uint64) FlowRate - // HasPps checks if Pps has been set in FlowRate - HasPps() bool - // Bps returns uint64, set in FlowRate. - Bps() uint64 - // SetBps assigns uint64 provided by user to FlowRate - SetBps(value uint64) FlowRate - // HasBps checks if Bps has been set in FlowRate - HasBps() bool - // Kbps returns uint64, set in FlowRate. - Kbps() uint64 - // SetKbps assigns uint64 provided by user to FlowRate - SetKbps(value uint64) FlowRate - // HasKbps checks if Kbps has been set in FlowRate - HasKbps() bool - // Mbps returns uint64, set in FlowRate. - Mbps() uint64 - // SetMbps assigns uint64 provided by user to FlowRate - SetMbps(value uint64) FlowRate - // HasMbps checks if Mbps has been set in FlowRate - HasMbps() bool - // Gbps returns uint32, set in FlowRate. - Gbps() uint32 - // SetGbps assigns uint32 provided by user to FlowRate - SetGbps(value uint32) FlowRate - // HasGbps checks if Gbps has been set in FlowRate - HasGbps() bool - // Percentage returns float32, set in FlowRate. - Percentage() float32 - // SetPercentage assigns float32 provided by user to FlowRate - SetPercentage(value float32) FlowRate - // HasPercentage checks if Percentage has been set in FlowRate - HasPercentage() bool -} - -type FlowRateChoiceEnum string - -// Enum of Choice on FlowRate -var FlowRateChoice = struct { - PPS FlowRateChoiceEnum - BPS FlowRateChoiceEnum - KBPS FlowRateChoiceEnum - MBPS FlowRateChoiceEnum - GBPS FlowRateChoiceEnum - PERCENTAGE FlowRateChoiceEnum -}{ - PPS: FlowRateChoiceEnum("pps"), - BPS: FlowRateChoiceEnum("bps"), - KBPS: FlowRateChoiceEnum("kbps"), - MBPS: FlowRateChoiceEnum("mbps"), - GBPS: FlowRateChoiceEnum("gbps"), - PERCENTAGE: FlowRateChoiceEnum("percentage"), -} - -func (obj *flowRate) Choice() FlowRateChoiceEnum { - return FlowRateChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The available types of flow rate. -// Choice returns a string -func (obj *flowRate) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRate) setChoice(value FlowRateChoiceEnum) FlowRate { - intValue, ok := otg.FlowRate_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRateChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRate_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Percentage = nil - obj.obj.Gbps = nil - obj.obj.Mbps = nil - obj.obj.Kbps = nil - obj.obj.Bps = nil - obj.obj.Pps = nil - - if value == FlowRateChoice.PPS { - defaultValue := uint64(1000) - obj.obj.Pps = &defaultValue - } - - if value == FlowRateChoice.BPS { - defaultValue := uint64(1000000000) - obj.obj.Bps = &defaultValue - } - - if value == FlowRateChoice.KBPS { - defaultValue := uint64(1000000) - obj.obj.Kbps = &defaultValue - } - - if value == FlowRateChoice.MBPS { - defaultValue := uint64(1000) - obj.obj.Mbps = &defaultValue - } - - if value == FlowRateChoice.GBPS { - defaultValue := uint32(1) - obj.obj.Gbps = &defaultValue - } - - if value == FlowRateChoice.PERCENTAGE { - defaultValue := float32(100) - obj.obj.Percentage = &defaultValue - } - - return obj -} - -// Packets per second. -// Pps returns a uint64 -func (obj *flowRate) Pps() uint64 { - - if obj.obj.Pps == nil { - obj.setChoice(FlowRateChoice.PPS) - } - - return *obj.obj.Pps - -} - -// Packets per second. -// Pps returns a uint64 -func (obj *flowRate) HasPps() bool { - return obj.obj.Pps != nil -} - -// Packets per second. -// SetPps sets the uint64 value in the FlowRate object -func (obj *flowRate) SetPps(value uint64) FlowRate { - obj.setChoice(FlowRateChoice.PPS) - obj.obj.Pps = &value - return obj -} - -// Bits per second. -// Bps returns a uint64 -func (obj *flowRate) Bps() uint64 { - - if obj.obj.Bps == nil { - obj.setChoice(FlowRateChoice.BPS) - } - - return *obj.obj.Bps - -} - -// Bits per second. -// Bps returns a uint64 -func (obj *flowRate) HasBps() bool { - return obj.obj.Bps != nil -} - -// Bits per second. -// SetBps sets the uint64 value in the FlowRate object -func (obj *flowRate) SetBps(value uint64) FlowRate { - obj.setChoice(FlowRateChoice.BPS) - obj.obj.Bps = &value - return obj -} - -// Kilobits per second. -// Kbps returns a uint64 -func (obj *flowRate) Kbps() uint64 { - - if obj.obj.Kbps == nil { - obj.setChoice(FlowRateChoice.KBPS) - } - - return *obj.obj.Kbps - -} - -// Kilobits per second. -// Kbps returns a uint64 -func (obj *flowRate) HasKbps() bool { - return obj.obj.Kbps != nil -} - -// Kilobits per second. -// SetKbps sets the uint64 value in the FlowRate object -func (obj *flowRate) SetKbps(value uint64) FlowRate { - obj.setChoice(FlowRateChoice.KBPS) - obj.obj.Kbps = &value - return obj -} - -// Megabits per second. -// Mbps returns a uint64 -func (obj *flowRate) Mbps() uint64 { - - if obj.obj.Mbps == nil { - obj.setChoice(FlowRateChoice.MBPS) - } - - return *obj.obj.Mbps - -} - -// Megabits per second. -// Mbps returns a uint64 -func (obj *flowRate) HasMbps() bool { - return obj.obj.Mbps != nil -} - -// Megabits per second. -// SetMbps sets the uint64 value in the FlowRate object -func (obj *flowRate) SetMbps(value uint64) FlowRate { - obj.setChoice(FlowRateChoice.MBPS) - obj.obj.Mbps = &value - return obj -} - -// Gigabits per second. -// Gbps returns a uint32 -func (obj *flowRate) Gbps() uint32 { - - if obj.obj.Gbps == nil { - obj.setChoice(FlowRateChoice.GBPS) - } - - return *obj.obj.Gbps - -} - -// Gigabits per second. -// Gbps returns a uint32 -func (obj *flowRate) HasGbps() bool { - return obj.obj.Gbps != nil -} - -// Gigabits per second. -// SetGbps sets the uint32 value in the FlowRate object -func (obj *flowRate) SetGbps(value uint32) FlowRate { - obj.setChoice(FlowRateChoice.GBPS) - obj.obj.Gbps = &value - return obj -} - -// The percentage of a port location's available bandwidth. -// Percentage returns a float32 -func (obj *flowRate) Percentage() float32 { - - if obj.obj.Percentage == nil { - obj.setChoice(FlowRateChoice.PERCENTAGE) - } - - return *obj.obj.Percentage - -} - -// The percentage of a port location's available bandwidth. -// Percentage returns a float32 -func (obj *flowRate) HasPercentage() bool { - return obj.obj.Percentage != nil -} - -// The percentage of a port location's available bandwidth. -// SetPercentage sets the float32 value in the FlowRate object -func (obj *flowRate) SetPercentage(value float32) FlowRate { - obj.setChoice(FlowRateChoice.PERCENTAGE) - obj.obj.Percentage = &value - return obj -} - -func (obj *flowRate) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Pps != nil { - - if *obj.obj.Pps < 1 || *obj.obj.Pps > 18446744073709551615 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= FlowRate.Pps <= 18446744073709551615 but Got %d", *obj.obj.Pps)) - } - - } - - if obj.obj.Bps != nil { - - if *obj.obj.Bps < 672 || *obj.obj.Bps > 18446744073709551615 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("672 <= FlowRate.Bps <= 18446744073709551615 but Got %d", *obj.obj.Bps)) - } - - } - - if obj.obj.Kbps != nil { - - if *obj.obj.Kbps < 1 || *obj.obj.Kbps > 18446744073709551615 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= FlowRate.Kbps <= 18446744073709551615 but Got %d", *obj.obj.Kbps)) - } - - } - - if obj.obj.Mbps != nil { - - if *obj.obj.Mbps < 1 || *obj.obj.Mbps > 18446744073709551615 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= FlowRate.Mbps <= 18446744073709551615 but Got %d", *obj.obj.Mbps)) - } - - } - - if obj.obj.Gbps != nil { - - if *obj.obj.Gbps < 1 || *obj.obj.Gbps > 4294967295 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= FlowRate.Gbps <= 4294967295 but Got %d", *obj.obj.Gbps)) - } - - } - - if obj.obj.Percentage != nil { - - if *obj.obj.Percentage < 0 || *obj.obj.Percentage > 100 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowRate.Percentage <= 100 but Got %f", *obj.obj.Percentage)) - } - - } - -} - -func (obj *flowRate) setDefault() { - var choices_set int = 0 - var choice FlowRateChoiceEnum - - if obj.obj.Pps != nil { - choices_set += 1 - choice = FlowRateChoice.PPS - } - - if obj.obj.Bps != nil { - choices_set += 1 - choice = FlowRateChoice.BPS - } - - if obj.obj.Kbps != nil { - choices_set += 1 - choice = FlowRateChoice.KBPS - } - - if obj.obj.Mbps != nil { - choices_set += 1 - choice = FlowRateChoice.MBPS - } - - if obj.obj.Gbps != nil { - choices_set += 1 - choice = FlowRateChoice.GBPS - } - - if obj.obj.Percentage != nil { - choices_set += 1 - choice = FlowRateChoice.PERCENTAGE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRateChoice.PPS) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRate") - } - } else { - intVal := otg.FlowRate_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRate_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowDuration ***** -type flowDuration struct { - validation - obj *otg.FlowDuration - marshaller marshalFlowDuration - unMarshaller unMarshalFlowDuration - fixedPacketsHolder FlowFixedPackets - fixedSecondsHolder FlowFixedSeconds - burstHolder FlowBurst - continuousHolder FlowContinuous -} - -func NewFlowDuration() FlowDuration { - obj := flowDuration{obj: &otg.FlowDuration{}} - obj.setDefault() - return &obj -} - -func (obj *flowDuration) msg() *otg.FlowDuration { - return obj.obj -} - -func (obj *flowDuration) setMsg(msg *otg.FlowDuration) FlowDuration { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowDuration struct { - obj *flowDuration -} - -type marshalFlowDuration interface { - // ToProto marshals FlowDuration to protobuf object *otg.FlowDuration - ToProto() (*otg.FlowDuration, error) - // ToPbText marshals FlowDuration to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowDuration to YAML text - ToYaml() (string, error) - // ToJson marshals FlowDuration to JSON text - ToJson() (string, error) -} - -type unMarshalflowDuration struct { - obj *flowDuration -} - -type unMarshalFlowDuration interface { - // FromProto unmarshals FlowDuration from protobuf object *otg.FlowDuration - FromProto(msg *otg.FlowDuration) (FlowDuration, error) - // FromPbText unmarshals FlowDuration from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowDuration from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowDuration from JSON text - FromJson(value string) error -} - -func (obj *flowDuration) Marshal() marshalFlowDuration { - if obj.marshaller == nil { - obj.marshaller = &marshalflowDuration{obj: obj} - } - return obj.marshaller -} - -func (obj *flowDuration) Unmarshal() unMarshalFlowDuration { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowDuration{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowDuration) ToProto() (*otg.FlowDuration, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowDuration) FromProto(msg *otg.FlowDuration) (FlowDuration, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowDuration) 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 *unMarshalflowDuration) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowDuration) 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 *unMarshalflowDuration) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowDuration) 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 *unMarshalflowDuration) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowDuration) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowDuration) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowDuration) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowDuration) Clone() (FlowDuration, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowDuration() - 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 -} - -func (obj *flowDuration) setNil() { - obj.fixedPacketsHolder = nil - obj.fixedSecondsHolder = nil - obj.burstHolder = nil - obj.continuousHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowDuration is a container for different transmit durations. -type FlowDuration interface { - Validation - // msg marshals FlowDuration to protobuf object *otg.FlowDuration - // and doesn't set defaults - msg() *otg.FlowDuration - // setMsg unmarshals FlowDuration from protobuf object *otg.FlowDuration - // and doesn't set defaults - setMsg(*otg.FlowDuration) FlowDuration - // provides marshal interface - Marshal() marshalFlowDuration - // provides unmarshal interface - Unmarshal() unMarshalFlowDuration - // validate validates FlowDuration - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowDuration, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowDurationChoiceEnum, set in FlowDuration - Choice() FlowDurationChoiceEnum - // setChoice assigns FlowDurationChoiceEnum provided by user to FlowDuration - setChoice(value FlowDurationChoiceEnum) FlowDuration - // HasChoice checks if Choice has been set in FlowDuration - HasChoice() bool - // FixedPackets returns FlowFixedPackets, set in FlowDuration. - // FlowFixedPackets is transmit a fixed number of packets after which the flow will stop. - FixedPackets() FlowFixedPackets - // SetFixedPackets assigns FlowFixedPackets provided by user to FlowDuration. - // FlowFixedPackets is transmit a fixed number of packets after which the flow will stop. - SetFixedPackets(value FlowFixedPackets) FlowDuration - // HasFixedPackets checks if FixedPackets has been set in FlowDuration - HasFixedPackets() bool - // FixedSeconds returns FlowFixedSeconds, set in FlowDuration. - // FlowFixedSeconds is transmit for a fixed number of seconds after which the flow will stop. - FixedSeconds() FlowFixedSeconds - // SetFixedSeconds assigns FlowFixedSeconds provided by user to FlowDuration. - // FlowFixedSeconds is transmit for a fixed number of seconds after which the flow will stop. - SetFixedSeconds(value FlowFixedSeconds) FlowDuration - // HasFixedSeconds checks if FixedSeconds has been set in FlowDuration - HasFixedSeconds() bool - // Burst returns FlowBurst, set in FlowDuration. - // FlowBurst is transmits continuous or fixed burst of packets. - // For continuous burst of packets, it will not automatically stop. - // For fixed burst of packets, it will stop after transmitting fixed number of bursts. - Burst() FlowBurst - // SetBurst assigns FlowBurst provided by user to FlowDuration. - // FlowBurst is transmits continuous or fixed burst of packets. - // For continuous burst of packets, it will not automatically stop. - // For fixed burst of packets, it will stop after transmitting fixed number of bursts. - SetBurst(value FlowBurst) FlowDuration - // HasBurst checks if Burst has been set in FlowDuration - HasBurst() bool - // Continuous returns FlowContinuous, set in FlowDuration. - // FlowContinuous is transmit will be continuous and will not stop automatically. - Continuous() FlowContinuous - // SetContinuous assigns FlowContinuous provided by user to FlowDuration. - // FlowContinuous is transmit will be continuous and will not stop automatically. - SetContinuous(value FlowContinuous) FlowDuration - // HasContinuous checks if Continuous has been set in FlowDuration - HasContinuous() bool - setNil() -} - -type FlowDurationChoiceEnum string - -// Enum of Choice on FlowDuration -var FlowDurationChoice = struct { - FIXED_PACKETS FlowDurationChoiceEnum - FIXED_SECONDS FlowDurationChoiceEnum - BURST FlowDurationChoiceEnum - CONTINUOUS FlowDurationChoiceEnum -}{ - FIXED_PACKETS: FlowDurationChoiceEnum("fixed_packets"), - FIXED_SECONDS: FlowDurationChoiceEnum("fixed_seconds"), - BURST: FlowDurationChoiceEnum("burst"), - CONTINUOUS: FlowDurationChoiceEnum("continuous"), -} - -func (obj *flowDuration) Choice() FlowDurationChoiceEnum { - return FlowDurationChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// A choice used to determine the type of duration. -// Choice returns a string -func (obj *flowDuration) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowDuration) setChoice(value FlowDurationChoiceEnum) FlowDuration { - intValue, ok := otg.FlowDuration_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowDurationChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowDuration_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Continuous = nil - obj.continuousHolder = nil - obj.obj.Burst = nil - obj.burstHolder = nil - obj.obj.FixedSeconds = nil - obj.fixedSecondsHolder = nil - obj.obj.FixedPackets = nil - obj.fixedPacketsHolder = nil - - if value == FlowDurationChoice.FIXED_PACKETS { - obj.obj.FixedPackets = NewFlowFixedPackets().msg() - } - - if value == FlowDurationChoice.FIXED_SECONDS { - obj.obj.FixedSeconds = NewFlowFixedSeconds().msg() - } - - if value == FlowDurationChoice.BURST { - obj.obj.Burst = NewFlowBurst().msg() - } - - if value == FlowDurationChoice.CONTINUOUS { - obj.obj.Continuous = NewFlowContinuous().msg() - } - - return obj -} - -// description is TBD -// FixedPackets returns a FlowFixedPackets -func (obj *flowDuration) FixedPackets() FlowFixedPackets { - if obj.obj.FixedPackets == nil { - obj.setChoice(FlowDurationChoice.FIXED_PACKETS) - } - if obj.fixedPacketsHolder == nil { - obj.fixedPacketsHolder = &flowFixedPackets{obj: obj.obj.FixedPackets} - } - return obj.fixedPacketsHolder -} - -// description is TBD -// FixedPackets returns a FlowFixedPackets -func (obj *flowDuration) HasFixedPackets() bool { - return obj.obj.FixedPackets != nil -} - -// description is TBD -// SetFixedPackets sets the FlowFixedPackets value in the FlowDuration object -func (obj *flowDuration) SetFixedPackets(value FlowFixedPackets) FlowDuration { - obj.setChoice(FlowDurationChoice.FIXED_PACKETS) - obj.fixedPacketsHolder = nil - obj.obj.FixedPackets = value.msg() - - return obj -} - -// description is TBD -// FixedSeconds returns a FlowFixedSeconds -func (obj *flowDuration) FixedSeconds() FlowFixedSeconds { - if obj.obj.FixedSeconds == nil { - obj.setChoice(FlowDurationChoice.FIXED_SECONDS) - } - if obj.fixedSecondsHolder == nil { - obj.fixedSecondsHolder = &flowFixedSeconds{obj: obj.obj.FixedSeconds} - } - return obj.fixedSecondsHolder -} - -// description is TBD -// FixedSeconds returns a FlowFixedSeconds -func (obj *flowDuration) HasFixedSeconds() bool { - return obj.obj.FixedSeconds != nil -} - -// description is TBD -// SetFixedSeconds sets the FlowFixedSeconds value in the FlowDuration object -func (obj *flowDuration) SetFixedSeconds(value FlowFixedSeconds) FlowDuration { - obj.setChoice(FlowDurationChoice.FIXED_SECONDS) - obj.fixedSecondsHolder = nil - obj.obj.FixedSeconds = value.msg() - - return obj -} - -// description is TBD -// Burst returns a FlowBurst -func (obj *flowDuration) Burst() FlowBurst { - if obj.obj.Burst == nil { - obj.setChoice(FlowDurationChoice.BURST) - } - if obj.burstHolder == nil { - obj.burstHolder = &flowBurst{obj: obj.obj.Burst} - } - return obj.burstHolder -} - -// description is TBD -// Burst returns a FlowBurst -func (obj *flowDuration) HasBurst() bool { - return obj.obj.Burst != nil -} - -// description is TBD -// SetBurst sets the FlowBurst value in the FlowDuration object -func (obj *flowDuration) SetBurst(value FlowBurst) FlowDuration { - obj.setChoice(FlowDurationChoice.BURST) - obj.burstHolder = nil - obj.obj.Burst = value.msg() - - return obj -} - -// description is TBD -// Continuous returns a FlowContinuous -func (obj *flowDuration) Continuous() FlowContinuous { - if obj.obj.Continuous == nil { - obj.setChoice(FlowDurationChoice.CONTINUOUS) - } - if obj.continuousHolder == nil { - obj.continuousHolder = &flowContinuous{obj: obj.obj.Continuous} - } - return obj.continuousHolder -} - -// description is TBD -// Continuous returns a FlowContinuous -func (obj *flowDuration) HasContinuous() bool { - return obj.obj.Continuous != nil -} - -// description is TBD -// SetContinuous sets the FlowContinuous value in the FlowDuration object -func (obj *flowDuration) SetContinuous(value FlowContinuous) FlowDuration { - obj.setChoice(FlowDurationChoice.CONTINUOUS) - obj.continuousHolder = nil - obj.obj.Continuous = value.msg() - - return obj -} - -func (obj *flowDuration) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.FixedPackets != nil { - - obj.FixedPackets().validateObj(vObj, set_default) - } - - if obj.obj.FixedSeconds != nil { - - obj.FixedSeconds().validateObj(vObj, set_default) - } - - if obj.obj.Burst != nil { - - obj.Burst().validateObj(vObj, set_default) - } - - if obj.obj.Continuous != nil { - - obj.Continuous().validateObj(vObj, set_default) - } - -} - -func (obj *flowDuration) setDefault() { - var choices_set int = 0 - var choice FlowDurationChoiceEnum - - if obj.obj.FixedPackets != nil { - choices_set += 1 - choice = FlowDurationChoice.FIXED_PACKETS - } - - if obj.obj.FixedSeconds != nil { - choices_set += 1 - choice = FlowDurationChoice.FIXED_SECONDS - } - - if obj.obj.Burst != nil { - choices_set += 1 - choice = FlowDurationChoice.BURST - } - - if obj.obj.Continuous != nil { - choices_set += 1 - choice = FlowDurationChoice.CONTINUOUS - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowDurationChoice.CONTINUOUS) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowDuration") - } - } else { - intVal := otg.FlowDuration_Choice_Enum_value[string(choice)] - enumValue := otg.FlowDuration_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowMetrics ***** -type flowMetrics struct { - validation - obj *otg.FlowMetrics - marshaller marshalFlowMetrics - unMarshaller unMarshalFlowMetrics - rxTxRatioHolder FlowRxTxRatio - latencyHolder FlowLatencyMetrics - predefinedMetricTagsHolder FlowPredefinedTags -} - -func NewFlowMetrics() FlowMetrics { - obj := flowMetrics{obj: &otg.FlowMetrics{}} - obj.setDefault() - return &obj -} - -func (obj *flowMetrics) msg() *otg.FlowMetrics { - return obj.obj -} - -func (obj *flowMetrics) setMsg(msg *otg.FlowMetrics) FlowMetrics { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowMetrics struct { - obj *flowMetrics -} - -type marshalFlowMetrics interface { - // ToProto marshals FlowMetrics to protobuf object *otg.FlowMetrics - ToProto() (*otg.FlowMetrics, error) - // ToPbText marshals FlowMetrics to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowMetrics to YAML text - ToYaml() (string, error) - // ToJson marshals FlowMetrics to JSON text - ToJson() (string, error) -} - -type unMarshalflowMetrics struct { - obj *flowMetrics -} - -type unMarshalFlowMetrics interface { - // FromProto unmarshals FlowMetrics from protobuf object *otg.FlowMetrics - FromProto(msg *otg.FlowMetrics) (FlowMetrics, error) - // FromPbText unmarshals FlowMetrics from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowMetrics from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowMetrics from JSON text - FromJson(value string) error -} - -func (obj *flowMetrics) Marshal() marshalFlowMetrics { - if obj.marshaller == nil { - obj.marshaller = &marshalflowMetrics{obj: obj} - } - return obj.marshaller -} - -func (obj *flowMetrics) Unmarshal() unMarshalFlowMetrics { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowMetrics{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowMetrics) ToProto() (*otg.FlowMetrics, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowMetrics) FromProto(msg *otg.FlowMetrics) (FlowMetrics, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowMetrics) 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 *unMarshalflowMetrics) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowMetrics) 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 *unMarshalflowMetrics) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowMetrics) 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 *unMarshalflowMetrics) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowMetrics) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowMetrics) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowMetrics) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowMetrics) Clone() (FlowMetrics, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowMetrics() - 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 -} - -func (obj *flowMetrics) setNil() { - obj.rxTxRatioHolder = nil - obj.latencyHolder = nil - obj.predefinedMetricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowMetrics is the optional container for configuring flow metrics. -type FlowMetrics interface { - Validation - // msg marshals FlowMetrics to protobuf object *otg.FlowMetrics - // and doesn't set defaults - msg() *otg.FlowMetrics - // setMsg unmarshals FlowMetrics from protobuf object *otg.FlowMetrics - // and doesn't set defaults - setMsg(*otg.FlowMetrics) FlowMetrics - // provides marshal interface - Marshal() marshalFlowMetrics - // provides unmarshal interface - Unmarshal() unMarshalFlowMetrics - // validate validates FlowMetrics - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowMetrics, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Enable returns bool, set in FlowMetrics. - Enable() bool - // SetEnable assigns bool provided by user to FlowMetrics - SetEnable(value bool) FlowMetrics - // HasEnable checks if Enable has been set in FlowMetrics - HasEnable() bool - // Loss returns bool, set in FlowMetrics. - Loss() bool - // SetLoss assigns bool provided by user to FlowMetrics - SetLoss(value bool) FlowMetrics - // HasLoss checks if Loss has been set in FlowMetrics - HasLoss() bool - // RxTxRatio returns FlowRxTxRatio, set in FlowMetrics. - // FlowRxTxRatio is rx Tx ratio is the ratio of expected number of Rx packets across all Rx ports to the Tx packets - // for the configured flow. It is a factor by which the Tx packet count is multiplied to calculate - // the sum of expected Rx packet count, across all Rx ports. This will be used to calculate loss - // percentage of flow at aggregate level. - RxTxRatio() FlowRxTxRatio - // SetRxTxRatio assigns FlowRxTxRatio provided by user to FlowMetrics. - // FlowRxTxRatio is rx Tx ratio is the ratio of expected number of Rx packets across all Rx ports to the Tx packets - // for the configured flow. It is a factor by which the Tx packet count is multiplied to calculate - // the sum of expected Rx packet count, across all Rx ports. This will be used to calculate loss - // percentage of flow at aggregate level. - SetRxTxRatio(value FlowRxTxRatio) FlowMetrics - // HasRxTxRatio checks if RxTxRatio has been set in FlowMetrics - HasRxTxRatio() bool - // Timestamps returns bool, set in FlowMetrics. - Timestamps() bool - // SetTimestamps assigns bool provided by user to FlowMetrics - SetTimestamps(value bool) FlowMetrics - // HasTimestamps checks if Timestamps has been set in FlowMetrics - HasTimestamps() bool - // Latency returns FlowLatencyMetrics, set in FlowMetrics. - // FlowLatencyMetrics is the optional container for per flow latency metric configuration. - Latency() FlowLatencyMetrics - // SetLatency assigns FlowLatencyMetrics provided by user to FlowMetrics. - // FlowLatencyMetrics is the optional container for per flow latency metric configuration. - SetLatency(value FlowLatencyMetrics) FlowMetrics - // HasLatency checks if Latency has been set in FlowMetrics - HasLatency() bool - // PredefinedMetricTags returns FlowPredefinedTags, set in FlowMetrics. - // FlowPredefinedTags is list of predefined flow tracking options, outside packet fields, that can be enabled. - PredefinedMetricTags() FlowPredefinedTags - // SetPredefinedMetricTags assigns FlowPredefinedTags provided by user to FlowMetrics. - // FlowPredefinedTags is list of predefined flow tracking options, outside packet fields, that can be enabled. - SetPredefinedMetricTags(value FlowPredefinedTags) FlowMetrics - // HasPredefinedMetricTags checks if PredefinedMetricTags has been set in FlowMetrics - HasPredefinedMetricTags() bool - setNil() -} - -// Enables flow metrics. -// Enabling this option may affect the resultant packet payload due to -// additional instrumentation data. -// Enable returns a bool -func (obj *flowMetrics) Enable() bool { - - return *obj.obj.Enable - -} - -// Enables flow metrics. -// Enabling this option may affect the resultant packet payload due to -// additional instrumentation data. -// Enable returns a bool -func (obj *flowMetrics) HasEnable() bool { - return obj.obj.Enable != nil -} - -// Enables flow metrics. -// Enabling this option may affect the resultant packet payload due to -// additional instrumentation data. -// SetEnable sets the bool value in the FlowMetrics object -func (obj *flowMetrics) SetEnable(value bool) FlowMetrics { - - obj.obj.Enable = &value - return obj -} - -// Enables additional flow metric loss calculation. -// Loss returns a bool -func (obj *flowMetrics) Loss() bool { - - return *obj.obj.Loss - -} - -// Enables additional flow metric loss calculation. -// Loss returns a bool -func (obj *flowMetrics) HasLoss() bool { - return obj.obj.Loss != nil -} - -// Enables additional flow metric loss calculation. -// SetLoss sets the bool value in the FlowMetrics object -func (obj *flowMetrics) SetLoss(value bool) FlowMetrics { - - obj.obj.Loss = &value - return obj -} - -// Rx Tx ratio. -// RxTxRatio returns a FlowRxTxRatio -func (obj *flowMetrics) RxTxRatio() FlowRxTxRatio { - if obj.obj.RxTxRatio == nil { - obj.obj.RxTxRatio = NewFlowRxTxRatio().msg() - } - if obj.rxTxRatioHolder == nil { - obj.rxTxRatioHolder = &flowRxTxRatio{obj: obj.obj.RxTxRatio} - } - return obj.rxTxRatioHolder -} - -// Rx Tx ratio. -// RxTxRatio returns a FlowRxTxRatio -func (obj *flowMetrics) HasRxTxRatio() bool { - return obj.obj.RxTxRatio != nil -} - -// Rx Tx ratio. -// SetRxTxRatio sets the FlowRxTxRatio value in the FlowMetrics object -func (obj *flowMetrics) SetRxTxRatio(value FlowRxTxRatio) FlowMetrics { - - obj.rxTxRatioHolder = nil - obj.obj.RxTxRatio = value.msg() - - return obj -} - -// Enables additional flow metric first and last timestamps. -// Timestamps returns a bool -func (obj *flowMetrics) Timestamps() bool { - - return *obj.obj.Timestamps - -} - -// Enables additional flow metric first and last timestamps. -// Timestamps returns a bool -func (obj *flowMetrics) HasTimestamps() bool { - return obj.obj.Timestamps != nil -} - -// Enables additional flow metric first and last timestamps. -// SetTimestamps sets the bool value in the FlowMetrics object -func (obj *flowMetrics) SetTimestamps(value bool) FlowMetrics { - - obj.obj.Timestamps = &value - return obj -} - -// Latency metrics. -// Latency returns a FlowLatencyMetrics -func (obj *flowMetrics) Latency() FlowLatencyMetrics { - if obj.obj.Latency == nil { - obj.obj.Latency = NewFlowLatencyMetrics().msg() - } - if obj.latencyHolder == nil { - obj.latencyHolder = &flowLatencyMetrics{obj: obj.obj.Latency} - } - return obj.latencyHolder -} - -// Latency metrics. -// Latency returns a FlowLatencyMetrics -func (obj *flowMetrics) HasLatency() bool { - return obj.obj.Latency != nil -} - -// Latency metrics. -// SetLatency sets the FlowLatencyMetrics value in the FlowMetrics object -func (obj *flowMetrics) SetLatency(value FlowLatencyMetrics) FlowMetrics { - - obj.latencyHolder = nil - obj.obj.Latency = value.msg() - - return obj -} - -// Predefined metric tags -// PredefinedMetricTags returns a FlowPredefinedTags -func (obj *flowMetrics) PredefinedMetricTags() FlowPredefinedTags { - if obj.obj.PredefinedMetricTags == nil { - obj.obj.PredefinedMetricTags = NewFlowPredefinedTags().msg() - } - if obj.predefinedMetricTagsHolder == nil { - obj.predefinedMetricTagsHolder = &flowPredefinedTags{obj: obj.obj.PredefinedMetricTags} - } - return obj.predefinedMetricTagsHolder -} - -// Predefined metric tags -// PredefinedMetricTags returns a FlowPredefinedTags -func (obj *flowMetrics) HasPredefinedMetricTags() bool { - return obj.obj.PredefinedMetricTags != nil -} - -// Predefined metric tags -// SetPredefinedMetricTags sets the FlowPredefinedTags value in the FlowMetrics object -func (obj *flowMetrics) SetPredefinedMetricTags(value FlowPredefinedTags) FlowMetrics { - - obj.predefinedMetricTagsHolder = nil - obj.obj.PredefinedMetricTags = value.msg() - - return obj -} - -func (obj *flowMetrics) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RxTxRatio != nil { - - obj.RxTxRatio().validateObj(vObj, set_default) - } - - if obj.obj.Latency != nil { - - obj.Latency().validateObj(vObj, set_default) - } - - if obj.obj.PredefinedMetricTags != nil { - - obj.PredefinedMetricTags().validateObj(vObj, set_default) - } - -} - -func (obj *flowMetrics) setDefault() { - if obj.obj.Enable == nil { - obj.SetEnable(false) - } - if obj.obj.Loss == nil { - obj.SetLoss(false) - } - if obj.obj.Timestamps == nil { - obj.SetTimestamps(false) - } - -} - -// ***** EventLink ***** -type eventLink struct { - validation - obj *otg.EventLink - marshaller marshalEventLink - unMarshaller unMarshalEventLink -} - -func NewEventLink() EventLink { - obj := eventLink{obj: &otg.EventLink{}} - obj.setDefault() - return &obj -} - -func (obj *eventLink) msg() *otg.EventLink { - return obj.obj -} - -func (obj *eventLink) setMsg(msg *otg.EventLink) EventLink { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaleventLink struct { - obj *eventLink -} - -type marshalEventLink interface { - // ToProto marshals EventLink to protobuf object *otg.EventLink - ToProto() (*otg.EventLink, error) - // ToPbText marshals EventLink to protobuf text - ToPbText() (string, error) - // ToYaml marshals EventLink to YAML text - ToYaml() (string, error) - // ToJson marshals EventLink to JSON text - ToJson() (string, error) -} - -type unMarshaleventLink struct { - obj *eventLink -} - -type unMarshalEventLink interface { - // FromProto unmarshals EventLink from protobuf object *otg.EventLink - FromProto(msg *otg.EventLink) (EventLink, error) - // FromPbText unmarshals EventLink from protobuf text - FromPbText(value string) error - // FromYaml unmarshals EventLink from YAML text - FromYaml(value string) error - // FromJson unmarshals EventLink from JSON text - FromJson(value string) error -} - -func (obj *eventLink) Marshal() marshalEventLink { - if obj.marshaller == nil { - obj.marshaller = &marshaleventLink{obj: obj} - } - return obj.marshaller -} - -func (obj *eventLink) Unmarshal() unMarshalEventLink { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaleventLink{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaleventLink) ToProto() (*otg.EventLink, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaleventLink) FromProto(msg *otg.EventLink) (EventLink, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaleventLink) 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 *unMarshaleventLink) 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 *marshaleventLink) 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 *unMarshaleventLink) 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 *marshaleventLink) 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 *unMarshaleventLink) 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 *eventLink) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *eventLink) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *eventLink) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *eventLink) Clone() (EventLink, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewEventLink() - 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 -} - -// EventLink is the optional container for link up/down event configuration. -type EventLink interface { - Validation - // msg marshals EventLink to protobuf object *otg.EventLink - // and doesn't set defaults - msg() *otg.EventLink - // setMsg unmarshals EventLink from protobuf object *otg.EventLink - // and doesn't set defaults - setMsg(*otg.EventLink) EventLink - // provides marshal interface - Marshal() marshalEventLink - // provides unmarshal interface - Unmarshal() unMarshalEventLink - // validate validates EventLink - validate() error - // A stringer function - String() string - // Clones the object - Clone() (EventLink, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Enable returns bool, set in EventLink. - Enable() bool - // SetEnable assigns bool provided by user to EventLink - SetEnable(value bool) EventLink - // HasEnable checks if Enable has been set in EventLink - HasEnable() bool -} - -// True to enable notifications when a link up/down event occurs. -// Enable returns a bool -func (obj *eventLink) Enable() bool { - - return *obj.obj.Enable - -} - -// True to enable notifications when a link up/down event occurs. -// Enable returns a bool -func (obj *eventLink) HasEnable() bool { - return obj.obj.Enable != nil -} - -// True to enable notifications when a link up/down event occurs. -// SetEnable sets the bool value in the EventLink object -func (obj *eventLink) SetEnable(value bool) EventLink { - - obj.obj.Enable = &value - return obj -} - -func (obj *eventLink) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *eventLink) setDefault() { - if obj.obj.Enable == nil { - obj.SetEnable(false) - } - -} - -// ***** EventRxRateThreshold ***** -type eventRxRateThreshold struct { - validation - obj *otg.EventRxRateThreshold - marshaller marshalEventRxRateThreshold - unMarshaller unMarshalEventRxRateThreshold -} - -func NewEventRxRateThreshold() EventRxRateThreshold { - obj := eventRxRateThreshold{obj: &otg.EventRxRateThreshold{}} - obj.setDefault() - return &obj -} - -func (obj *eventRxRateThreshold) msg() *otg.EventRxRateThreshold { - return obj.obj -} - -func (obj *eventRxRateThreshold) setMsg(msg *otg.EventRxRateThreshold) EventRxRateThreshold { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaleventRxRateThreshold struct { - obj *eventRxRateThreshold -} - -type marshalEventRxRateThreshold interface { - // ToProto marshals EventRxRateThreshold to protobuf object *otg.EventRxRateThreshold - ToProto() (*otg.EventRxRateThreshold, error) - // ToPbText marshals EventRxRateThreshold to protobuf text - ToPbText() (string, error) - // ToYaml marshals EventRxRateThreshold to YAML text - ToYaml() (string, error) - // ToJson marshals EventRxRateThreshold to JSON text - ToJson() (string, error) -} - -type unMarshaleventRxRateThreshold struct { - obj *eventRxRateThreshold -} - -type unMarshalEventRxRateThreshold interface { - // FromProto unmarshals EventRxRateThreshold from protobuf object *otg.EventRxRateThreshold - FromProto(msg *otg.EventRxRateThreshold) (EventRxRateThreshold, error) - // FromPbText unmarshals EventRxRateThreshold from protobuf text - FromPbText(value string) error - // FromYaml unmarshals EventRxRateThreshold from YAML text - FromYaml(value string) error - // FromJson unmarshals EventRxRateThreshold from JSON text - FromJson(value string) error -} - -func (obj *eventRxRateThreshold) Marshal() marshalEventRxRateThreshold { - if obj.marshaller == nil { - obj.marshaller = &marshaleventRxRateThreshold{obj: obj} - } - return obj.marshaller -} - -func (obj *eventRxRateThreshold) Unmarshal() unMarshalEventRxRateThreshold { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaleventRxRateThreshold{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaleventRxRateThreshold) ToProto() (*otg.EventRxRateThreshold, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaleventRxRateThreshold) FromProto(msg *otg.EventRxRateThreshold) (EventRxRateThreshold, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaleventRxRateThreshold) 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 *unMarshaleventRxRateThreshold) 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 *marshaleventRxRateThreshold) 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 *unMarshaleventRxRateThreshold) 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 *marshaleventRxRateThreshold) 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 *unMarshaleventRxRateThreshold) 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 *eventRxRateThreshold) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *eventRxRateThreshold) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *eventRxRateThreshold) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *eventRxRateThreshold) Clone() (EventRxRateThreshold, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewEventRxRateThreshold() - 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 -} - -// EventRxRateThreshold is the optional container for rx rate threshold event configuration. -type EventRxRateThreshold interface { - Validation - // msg marshals EventRxRateThreshold to protobuf object *otg.EventRxRateThreshold - // and doesn't set defaults - msg() *otg.EventRxRateThreshold - // setMsg unmarshals EventRxRateThreshold from protobuf object *otg.EventRxRateThreshold - // and doesn't set defaults - setMsg(*otg.EventRxRateThreshold) EventRxRateThreshold - // provides marshal interface - Marshal() marshalEventRxRateThreshold - // provides unmarshal interface - Unmarshal() unMarshalEventRxRateThreshold - // validate validates EventRxRateThreshold - validate() error - // A stringer function - String() string - // Clones the object - Clone() (EventRxRateThreshold, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Enable returns bool, set in EventRxRateThreshold. - Enable() bool - // SetEnable assigns bool provided by user to EventRxRateThreshold - SetEnable(value bool) EventRxRateThreshold - // HasEnable checks if Enable has been set in EventRxRateThreshold - HasEnable() bool - // Threshold returns float32, set in EventRxRateThreshold. - Threshold() float32 - // SetThreshold assigns float32 provided by user to EventRxRateThreshold - SetThreshold(value float32) EventRxRateThreshold - // HasThreshold checks if Threshold has been set in EventRxRateThreshold - HasThreshold() bool -} - -// True to enable the rx_rate_threshold event. -// Enabling this option may affect the resultant packet payload due to -// additional instrumentation data. -// Enable returns a bool -func (obj *eventRxRateThreshold) Enable() bool { - - return *obj.obj.Enable - -} - -// True to enable the rx_rate_threshold event. -// Enabling this option may affect the resultant packet payload due to -// additional instrumentation data. -// Enable returns a bool -func (obj *eventRxRateThreshold) HasEnable() bool { - return obj.obj.Enable != nil -} - -// True to enable the rx_rate_threshold event. -// Enabling this option may affect the resultant packet payload due to -// additional instrumentation data. -// SetEnable sets the bool value in the EventRxRateThreshold object -func (obj *eventRxRateThreshold) SetEnable(value bool) EventRxRateThreshold { - - obj.obj.Enable = &value - return obj -} - -// True to enable notifications when the rx rate of a flow passes above -// or below the threshold value. -// Threshold returns a float32 -func (obj *eventRxRateThreshold) Threshold() float32 { - - return *obj.obj.Threshold - -} - -// True to enable notifications when the rx rate of a flow passes above -// or below the threshold value. -// Threshold returns a float32 -func (obj *eventRxRateThreshold) HasThreshold() bool { - return obj.obj.Threshold != nil -} - -// True to enable notifications when the rx rate of a flow passes above -// or below the threshold value. -// SetThreshold sets the float32 value in the EventRxRateThreshold object -func (obj *eventRxRateThreshold) SetThreshold(value float32) EventRxRateThreshold { - - obj.obj.Threshold = &value - return obj -} - -func (obj *eventRxRateThreshold) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Threshold != nil { - - if *obj.obj.Threshold < 0 || *obj.obj.Threshold > 100 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= EventRxRateThreshold.Threshold <= 100 but Got %f", *obj.obj.Threshold)) - } - - } - -} - -func (obj *eventRxRateThreshold) setDefault() { - if obj.obj.Enable == nil { - obj.SetEnable(false) - } - if obj.obj.Threshold == nil { - obj.SetThreshold(95) - } - -} - -// ***** EventRouteAdvertiseWithdraw ***** -type eventRouteAdvertiseWithdraw struct { - validation - obj *otg.EventRouteAdvertiseWithdraw - marshaller marshalEventRouteAdvertiseWithdraw - unMarshaller unMarshalEventRouteAdvertiseWithdraw -} - -func NewEventRouteAdvertiseWithdraw() EventRouteAdvertiseWithdraw { - obj := eventRouteAdvertiseWithdraw{obj: &otg.EventRouteAdvertiseWithdraw{}} - obj.setDefault() - return &obj -} - -func (obj *eventRouteAdvertiseWithdraw) msg() *otg.EventRouteAdvertiseWithdraw { - return obj.obj -} - -func (obj *eventRouteAdvertiseWithdraw) setMsg(msg *otg.EventRouteAdvertiseWithdraw) EventRouteAdvertiseWithdraw { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaleventRouteAdvertiseWithdraw struct { - obj *eventRouteAdvertiseWithdraw -} - -type marshalEventRouteAdvertiseWithdraw interface { - // ToProto marshals EventRouteAdvertiseWithdraw to protobuf object *otg.EventRouteAdvertiseWithdraw - ToProto() (*otg.EventRouteAdvertiseWithdraw, error) - // ToPbText marshals EventRouteAdvertiseWithdraw to protobuf text - ToPbText() (string, error) - // ToYaml marshals EventRouteAdvertiseWithdraw to YAML text - ToYaml() (string, error) - // ToJson marshals EventRouteAdvertiseWithdraw to JSON text - ToJson() (string, error) -} - -type unMarshaleventRouteAdvertiseWithdraw struct { - obj *eventRouteAdvertiseWithdraw -} - -type unMarshalEventRouteAdvertiseWithdraw interface { - // FromProto unmarshals EventRouteAdvertiseWithdraw from protobuf object *otg.EventRouteAdvertiseWithdraw - FromProto(msg *otg.EventRouteAdvertiseWithdraw) (EventRouteAdvertiseWithdraw, error) - // FromPbText unmarshals EventRouteAdvertiseWithdraw from protobuf text - FromPbText(value string) error - // FromYaml unmarshals EventRouteAdvertiseWithdraw from YAML text - FromYaml(value string) error - // FromJson unmarshals EventRouteAdvertiseWithdraw from JSON text - FromJson(value string) error -} - -func (obj *eventRouteAdvertiseWithdraw) Marshal() marshalEventRouteAdvertiseWithdraw { - if obj.marshaller == nil { - obj.marshaller = &marshaleventRouteAdvertiseWithdraw{obj: obj} - } - return obj.marshaller -} - -func (obj *eventRouteAdvertiseWithdraw) Unmarshal() unMarshalEventRouteAdvertiseWithdraw { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaleventRouteAdvertiseWithdraw{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaleventRouteAdvertiseWithdraw) ToProto() (*otg.EventRouteAdvertiseWithdraw, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaleventRouteAdvertiseWithdraw) FromProto(msg *otg.EventRouteAdvertiseWithdraw) (EventRouteAdvertiseWithdraw, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaleventRouteAdvertiseWithdraw) 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 *unMarshaleventRouteAdvertiseWithdraw) 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 *marshaleventRouteAdvertiseWithdraw) 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 *unMarshaleventRouteAdvertiseWithdraw) 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 *marshaleventRouteAdvertiseWithdraw) 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 *unMarshaleventRouteAdvertiseWithdraw) 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 *eventRouteAdvertiseWithdraw) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *eventRouteAdvertiseWithdraw) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *eventRouteAdvertiseWithdraw) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *eventRouteAdvertiseWithdraw) Clone() (EventRouteAdvertiseWithdraw, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewEventRouteAdvertiseWithdraw() - 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 -} - -// EventRouteAdvertiseWithdraw is the optional container for route advertise/withdraw event configuration. -type EventRouteAdvertiseWithdraw interface { - Validation - // msg marshals EventRouteAdvertiseWithdraw to protobuf object *otg.EventRouteAdvertiseWithdraw - // and doesn't set defaults - msg() *otg.EventRouteAdvertiseWithdraw - // setMsg unmarshals EventRouteAdvertiseWithdraw from protobuf object *otg.EventRouteAdvertiseWithdraw - // and doesn't set defaults - setMsg(*otg.EventRouteAdvertiseWithdraw) EventRouteAdvertiseWithdraw - // provides marshal interface - Marshal() marshalEventRouteAdvertiseWithdraw - // provides unmarshal interface - Unmarshal() unMarshalEventRouteAdvertiseWithdraw - // validate validates EventRouteAdvertiseWithdraw - validate() error - // A stringer function - String() string - // Clones the object - Clone() (EventRouteAdvertiseWithdraw, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Enable returns bool, set in EventRouteAdvertiseWithdraw. - Enable() bool - // SetEnable assigns bool provided by user to EventRouteAdvertiseWithdraw - SetEnable(value bool) EventRouteAdvertiseWithdraw - // HasEnable checks if Enable has been set in EventRouteAdvertiseWithdraw - HasEnable() bool -} - -// True to enable notifications when a route advertise/withdraw -// event occurs. -// Enable returns a bool -func (obj *eventRouteAdvertiseWithdraw) Enable() bool { - - return *obj.obj.Enable - -} - -// True to enable notifications when a route advertise/withdraw -// event occurs. -// Enable returns a bool -func (obj *eventRouteAdvertiseWithdraw) HasEnable() bool { - return obj.obj.Enable != nil -} - -// True to enable notifications when a route advertise/withdraw -// event occurs. -// SetEnable sets the bool value in the EventRouteAdvertiseWithdraw object -func (obj *eventRouteAdvertiseWithdraw) SetEnable(value bool) EventRouteAdvertiseWithdraw { - - obj.obj.Enable = &value - return obj -} - -func (obj *eventRouteAdvertiseWithdraw) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *eventRouteAdvertiseWithdraw) setDefault() { - if obj.obj.Enable == nil { - obj.SetEnable(false) - } - -} - -// ***** PortOptions ***** -type portOptions struct { - validation - obj *otg.PortOptions - marshaller marshalPortOptions - unMarshaller unMarshalPortOptions -} - -func NewPortOptions() PortOptions { - obj := portOptions{obj: &otg.PortOptions{}} - obj.setDefault() - return &obj -} - -func (obj *portOptions) msg() *otg.PortOptions { - return obj.obj -} - -func (obj *portOptions) setMsg(msg *otg.PortOptions) PortOptions { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalportOptions struct { - obj *portOptions -} - -type marshalPortOptions interface { - // ToProto marshals PortOptions to protobuf object *otg.PortOptions - ToProto() (*otg.PortOptions, error) - // ToPbText marshals PortOptions to protobuf text - ToPbText() (string, error) - // ToYaml marshals PortOptions to YAML text - ToYaml() (string, error) - // ToJson marshals PortOptions to JSON text - ToJson() (string, error) -} - -type unMarshalportOptions struct { - obj *portOptions -} - -type unMarshalPortOptions interface { - // FromProto unmarshals PortOptions from protobuf object *otg.PortOptions - FromProto(msg *otg.PortOptions) (PortOptions, error) - // FromPbText unmarshals PortOptions from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PortOptions from YAML text - FromYaml(value string) error - // FromJson unmarshals PortOptions from JSON text - FromJson(value string) error -} - -func (obj *portOptions) Marshal() marshalPortOptions { - if obj.marshaller == nil { - obj.marshaller = &marshalportOptions{obj: obj} - } - return obj.marshaller -} - -func (obj *portOptions) Unmarshal() unMarshalPortOptions { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalportOptions{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalportOptions) ToProto() (*otg.PortOptions, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalportOptions) FromProto(msg *otg.PortOptions) (PortOptions, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalportOptions) 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 *unMarshalportOptions) 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 *marshalportOptions) 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 *unMarshalportOptions) 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 *marshalportOptions) 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 *unMarshalportOptions) 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 *portOptions) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *portOptions) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *portOptions) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *portOptions) Clone() (PortOptions, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPortOptions() - 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 -} - -// PortOptions is common port options that apply to all configured Port objects. -type PortOptions interface { - Validation - // msg marshals PortOptions to protobuf object *otg.PortOptions - // and doesn't set defaults - msg() *otg.PortOptions - // setMsg unmarshals PortOptions from protobuf object *otg.PortOptions - // and doesn't set defaults - setMsg(*otg.PortOptions) PortOptions - // provides marshal interface - Marshal() marshalPortOptions - // provides unmarshal interface - Unmarshal() unMarshalPortOptions - // validate validates PortOptions - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PortOptions, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // LocationPreemption returns bool, set in PortOptions. - LocationPreemption() bool - // SetLocationPreemption assigns bool provided by user to PortOptions - SetLocationPreemption(value bool) PortOptions - // HasLocationPreemption checks if LocationPreemption has been set in PortOptions - HasLocationPreemption() bool -} - -// Preempt all the test port locations as defined by the Port.Port.properties.location. If the test ports defined by their location values are in use and this value is true, the test ports will be preempted. -// LocationPreemption returns a bool -func (obj *portOptions) LocationPreemption() bool { - - return *obj.obj.LocationPreemption - -} - -// Preempt all the test port locations as defined by the Port.Port.properties.location. If the test ports defined by their location values are in use and this value is true, the test ports will be preempted. -// LocationPreemption returns a bool -func (obj *portOptions) HasLocationPreemption() bool { - return obj.obj.LocationPreemption != nil -} - -// Preempt all the test port locations as defined by the Port.Port.properties.location. If the test ports defined by their location values are in use and this value is true, the test ports will be preempted. -// SetLocationPreemption sets the bool value in the PortOptions object -func (obj *portOptions) SetLocationPreemption(value bool) PortOptions { - - obj.obj.LocationPreemption = &value - return obj -} - -func (obj *portOptions) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *portOptions) setDefault() { - if obj.obj.LocationPreemption == nil { - obj.SetLocationPreemption(false) - } - -} - -// ***** ProtocolOptions ***** -type protocolOptions struct { - validation - obj *otg.ProtocolOptions - marshaller marshalProtocolOptions - unMarshaller unMarshalProtocolOptions -} - -func NewProtocolOptions() ProtocolOptions { - obj := protocolOptions{obj: &otg.ProtocolOptions{}} - obj.setDefault() - return &obj -} - -func (obj *protocolOptions) msg() *otg.ProtocolOptions { - return obj.obj -} - -func (obj *protocolOptions) setMsg(msg *otg.ProtocolOptions) ProtocolOptions { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalprotocolOptions struct { - obj *protocolOptions -} - -type marshalProtocolOptions interface { - // ToProto marshals ProtocolOptions to protobuf object *otg.ProtocolOptions - ToProto() (*otg.ProtocolOptions, error) - // ToPbText marshals ProtocolOptions to protobuf text - ToPbText() (string, error) - // ToYaml marshals ProtocolOptions to YAML text - ToYaml() (string, error) - // ToJson marshals ProtocolOptions to JSON text - ToJson() (string, error) -} - -type unMarshalprotocolOptions struct { - obj *protocolOptions -} - -type unMarshalProtocolOptions interface { - // FromProto unmarshals ProtocolOptions from protobuf object *otg.ProtocolOptions - FromProto(msg *otg.ProtocolOptions) (ProtocolOptions, error) - // FromPbText unmarshals ProtocolOptions from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ProtocolOptions from YAML text - FromYaml(value string) error - // FromJson unmarshals ProtocolOptions from JSON text - FromJson(value string) error -} - -func (obj *protocolOptions) Marshal() marshalProtocolOptions { - if obj.marshaller == nil { - obj.marshaller = &marshalprotocolOptions{obj: obj} - } - return obj.marshaller -} - -func (obj *protocolOptions) Unmarshal() unMarshalProtocolOptions { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalprotocolOptions{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalprotocolOptions) ToProto() (*otg.ProtocolOptions, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalprotocolOptions) FromProto(msg *otg.ProtocolOptions) (ProtocolOptions, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalprotocolOptions) 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 *unMarshalprotocolOptions) 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 *marshalprotocolOptions) 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 *unMarshalprotocolOptions) 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 *marshalprotocolOptions) 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 *unMarshalprotocolOptions) 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 *protocolOptions) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *protocolOptions) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *protocolOptions) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *protocolOptions) Clone() (ProtocolOptions, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewProtocolOptions() - 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 -} - -// ProtocolOptions is common options that apply to all configured protocols and interfaces. -type ProtocolOptions interface { - Validation - // msg marshals ProtocolOptions to protobuf object *otg.ProtocolOptions - // and doesn't set defaults - msg() *otg.ProtocolOptions - // setMsg unmarshals ProtocolOptions from protobuf object *otg.ProtocolOptions - // and doesn't set defaults - setMsg(*otg.ProtocolOptions) ProtocolOptions - // provides marshal interface - Marshal() marshalProtocolOptions - // provides unmarshal interface - Unmarshal() unMarshalProtocolOptions - // validate validates ProtocolOptions - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ProtocolOptions, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // AutoStartAll returns bool, set in ProtocolOptions. - AutoStartAll() bool - // SetAutoStartAll assigns bool provided by user to ProtocolOptions - SetAutoStartAll(value bool) ProtocolOptions - // HasAutoStartAll checks if AutoStartAll has been set in ProtocolOptions - HasAutoStartAll() bool -} - -// When set to true, all underlying resources for configured protocols and interfaces shall be created and corresponding protocol session negotiation shall be initiated. Otherwise, when set to false, corresponding protocol session negotiation will need to be initiated using a separate set_protocol_state API call. -// AutoStartAll returns a bool -func (obj *protocolOptions) AutoStartAll() bool { - - return *obj.obj.AutoStartAll - -} - -// When set to true, all underlying resources for configured protocols and interfaces shall be created and corresponding protocol session negotiation shall be initiated. Otherwise, when set to false, corresponding protocol session negotiation will need to be initiated using a separate set_protocol_state API call. -// AutoStartAll returns a bool -func (obj *protocolOptions) HasAutoStartAll() bool { - return obj.obj.AutoStartAll != nil -} - -// When set to true, all underlying resources for configured protocols and interfaces shall be created and corresponding protocol session negotiation shall be initiated. Otherwise, when set to false, corresponding protocol session negotiation will need to be initiated using a separate set_protocol_state API call. -// SetAutoStartAll sets the bool value in the ProtocolOptions object -func (obj *protocolOptions) SetAutoStartAll(value bool) ProtocolOptions { - - obj.obj.AutoStartAll = &value - return obj -} - -func (obj *protocolOptions) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *protocolOptions) setDefault() { - if obj.obj.AutoStartAll == nil { - obj.SetAutoStartAll(true) - } - -} - -// ***** LldpConnection ***** -type lldpConnection struct { - validation - obj *otg.LldpConnection - marshaller marshalLldpConnection - unMarshaller unMarshalLldpConnection -} - -func NewLldpConnection() LldpConnection { - obj := lldpConnection{obj: &otg.LldpConnection{}} - obj.setDefault() - return &obj -} - -func (obj *lldpConnection) msg() *otg.LldpConnection { - return obj.obj -} - -func (obj *lldpConnection) setMsg(msg *otg.LldpConnection) LldpConnection { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallldpConnection struct { - obj *lldpConnection -} - -type marshalLldpConnection interface { - // ToProto marshals LldpConnection to protobuf object *otg.LldpConnection - ToProto() (*otg.LldpConnection, error) - // ToPbText marshals LldpConnection to protobuf text - ToPbText() (string, error) - // ToYaml marshals LldpConnection to YAML text - ToYaml() (string, error) - // ToJson marshals LldpConnection to JSON text - ToJson() (string, error) -} - -type unMarshallldpConnection struct { - obj *lldpConnection -} - -type unMarshalLldpConnection interface { - // FromProto unmarshals LldpConnection from protobuf object *otg.LldpConnection - FromProto(msg *otg.LldpConnection) (LldpConnection, error) - // FromPbText unmarshals LldpConnection from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LldpConnection from YAML text - FromYaml(value string) error - // FromJson unmarshals LldpConnection from JSON text - FromJson(value string) error -} - -func (obj *lldpConnection) Marshal() marshalLldpConnection { - if obj.marshaller == nil { - obj.marshaller = &marshallldpConnection{obj: obj} - } - return obj.marshaller -} - -func (obj *lldpConnection) Unmarshal() unMarshalLldpConnection { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallldpConnection{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallldpConnection) ToProto() (*otg.LldpConnection, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallldpConnection) FromProto(msg *otg.LldpConnection) (LldpConnection, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallldpConnection) 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 *unMarshallldpConnection) 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 *marshallldpConnection) 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 *unMarshallldpConnection) 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 *marshallldpConnection) 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 *unMarshallldpConnection) 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 *lldpConnection) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lldpConnection) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lldpConnection) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lldpConnection) Clone() (LldpConnection, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLldpConnection() - 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 -} - -// LldpConnection is lLDP connection to a test port. In future if more connection options arise LLDP connection object will be enhanced. -type LldpConnection interface { - Validation - // msg marshals LldpConnection to protobuf object *otg.LldpConnection - // and doesn't set defaults - msg() *otg.LldpConnection - // setMsg unmarshals LldpConnection from protobuf object *otg.LldpConnection - // and doesn't set defaults - setMsg(*otg.LldpConnection) LldpConnection - // provides marshal interface - Marshal() marshalLldpConnection - // provides unmarshal interface - Unmarshal() unMarshalLldpConnection - // validate validates LldpConnection - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LldpConnection, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns LldpConnectionChoiceEnum, set in LldpConnection - Choice() LldpConnectionChoiceEnum - // setChoice assigns LldpConnectionChoiceEnum provided by user to LldpConnection - setChoice(value LldpConnectionChoiceEnum) LldpConnection - // HasChoice checks if Choice has been set in LldpConnection - HasChoice() bool - // PortName returns string, set in LldpConnection. - PortName() string - // SetPortName assigns string provided by user to LldpConnection - SetPortName(value string) LldpConnection - // HasPortName checks if PortName has been set in LldpConnection - HasPortName() bool -} - -type LldpConnectionChoiceEnum string - -// Enum of Choice on LldpConnection -var LldpConnectionChoice = struct { - PORT_NAME LldpConnectionChoiceEnum -}{ - PORT_NAME: LldpConnectionChoiceEnum("port_name"), -} - -func (obj *lldpConnection) Choice() LldpConnectionChoiceEnum { - return LldpConnectionChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The name of the test port or other connection objects on which LLDP is configured. -// Choice returns a string -func (obj *lldpConnection) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *lldpConnection) setChoice(value LldpConnectionChoiceEnum) LldpConnection { - intValue, ok := otg.LldpConnection_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LldpConnectionChoiceEnum", string(value))) - return obj - } - enumValue := otg.LldpConnection_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.PortName = nil - return obj -} - -// Name of the test port on which LLDP is configured on. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// PortName returns a string -func (obj *lldpConnection) PortName() string { - - if obj.obj.PortName == nil { - obj.setChoice(LldpConnectionChoice.PORT_NAME) - } - - return *obj.obj.PortName - -} - -// Name of the test port on which LLDP is configured on. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// PortName returns a string -func (obj *lldpConnection) HasPortName() bool { - return obj.obj.PortName != nil -} - -// Name of the test port on which LLDP is configured on. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// SetPortName sets the string value in the LldpConnection object -func (obj *lldpConnection) SetPortName(value string) LldpConnection { - obj.setChoice(LldpConnectionChoice.PORT_NAME) - obj.obj.PortName = &value - return obj -} - -func (obj *lldpConnection) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *lldpConnection) setDefault() { - var choices_set int = 0 - var choice LldpConnectionChoiceEnum - - if obj.obj.PortName != nil { - choices_set += 1 - choice = LldpConnectionChoice.PORT_NAME - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in LldpConnection") - } - } else { - intVal := otg.LldpConnection_Choice_Enum_value[string(choice)] - enumValue := otg.LldpConnection_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** LldpChassisId ***** -type lldpChassisId struct { - validation - obj *otg.LldpChassisId - marshaller marshalLldpChassisId - unMarshaller unMarshalLldpChassisId - macAddressSubtypeHolder LldpChassisMacSubType -} - -func NewLldpChassisId() LldpChassisId { - obj := lldpChassisId{obj: &otg.LldpChassisId{}} - obj.setDefault() - return &obj -} - -func (obj *lldpChassisId) msg() *otg.LldpChassisId { - return obj.obj -} - -func (obj *lldpChassisId) setMsg(msg *otg.LldpChassisId) LldpChassisId { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshallldpChassisId struct { - obj *lldpChassisId -} - -type marshalLldpChassisId interface { - // ToProto marshals LldpChassisId to protobuf object *otg.LldpChassisId - ToProto() (*otg.LldpChassisId, error) - // ToPbText marshals LldpChassisId to protobuf text - ToPbText() (string, error) - // ToYaml marshals LldpChassisId to YAML text - ToYaml() (string, error) - // ToJson marshals LldpChassisId to JSON text - ToJson() (string, error) -} - -type unMarshallldpChassisId struct { - obj *lldpChassisId -} - -type unMarshalLldpChassisId interface { - // FromProto unmarshals LldpChassisId from protobuf object *otg.LldpChassisId - FromProto(msg *otg.LldpChassisId) (LldpChassisId, error) - // FromPbText unmarshals LldpChassisId from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LldpChassisId from YAML text - FromYaml(value string) error - // FromJson unmarshals LldpChassisId from JSON text - FromJson(value string) error -} - -func (obj *lldpChassisId) Marshal() marshalLldpChassisId { - if obj.marshaller == nil { - obj.marshaller = &marshallldpChassisId{obj: obj} - } - return obj.marshaller -} - -func (obj *lldpChassisId) Unmarshal() unMarshalLldpChassisId { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallldpChassisId{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallldpChassisId) ToProto() (*otg.LldpChassisId, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallldpChassisId) FromProto(msg *otg.LldpChassisId) (LldpChassisId, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallldpChassisId) 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 *unMarshallldpChassisId) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshallldpChassisId) 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 *unMarshallldpChassisId) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshallldpChassisId) 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 *unMarshallldpChassisId) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *lldpChassisId) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lldpChassisId) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lldpChassisId) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lldpChassisId) Clone() (LldpChassisId, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLldpChassisId() - 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 -} - -func (obj *lldpChassisId) setNil() { - obj.macAddressSubtypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// LldpChassisId is the Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. This field identifies the format and source of the chassis identifier string. It is based on the enumerator defined by the LldpChassisIdSubtype object from IEEE 802.1AB MIB. -type LldpChassisId interface { - Validation - // msg marshals LldpChassisId to protobuf object *otg.LldpChassisId - // and doesn't set defaults - msg() *otg.LldpChassisId - // setMsg unmarshals LldpChassisId from protobuf object *otg.LldpChassisId - // and doesn't set defaults - setMsg(*otg.LldpChassisId) LldpChassisId - // provides marshal interface - Marshal() marshalLldpChassisId - // provides unmarshal interface - Unmarshal() unMarshalLldpChassisId - // validate validates LldpChassisId - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LldpChassisId, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns LldpChassisIdChoiceEnum, set in LldpChassisId - Choice() LldpChassisIdChoiceEnum - // setChoice assigns LldpChassisIdChoiceEnum provided by user to LldpChassisId - setChoice(value LldpChassisIdChoiceEnum) LldpChassisId - // HasChoice checks if Choice has been set in LldpChassisId - HasChoice() bool - // MacAddressSubtype returns LldpChassisMacSubType, set in LldpChassisId. - // LldpChassisMacSubType is the MAC address configured in the Chassis ID TLV. - MacAddressSubtype() LldpChassisMacSubType - // SetMacAddressSubtype assigns LldpChassisMacSubType provided by user to LldpChassisId. - // LldpChassisMacSubType is the MAC address configured in the Chassis ID TLV. - SetMacAddressSubtype(value LldpChassisMacSubType) LldpChassisId - // HasMacAddressSubtype checks if MacAddressSubtype has been set in LldpChassisId - HasMacAddressSubtype() bool - // InterfaceNameSubtype returns string, set in LldpChassisId. - InterfaceNameSubtype() string - // SetInterfaceNameSubtype assigns string provided by user to LldpChassisId - SetInterfaceNameSubtype(value string) LldpChassisId - // HasInterfaceNameSubtype checks if InterfaceNameSubtype has been set in LldpChassisId - HasInterfaceNameSubtype() bool - // LocalSubtype returns string, set in LldpChassisId. - LocalSubtype() string - // SetLocalSubtype assigns string provided by user to LldpChassisId - SetLocalSubtype(value string) LldpChassisId - // HasLocalSubtype checks if LocalSubtype has been set in LldpChassisId - HasLocalSubtype() bool - setNil() -} - -type LldpChassisIdChoiceEnum string - -// Enum of Choice on LldpChassisId -var LldpChassisIdChoice = struct { - MAC_ADDRESS_SUBTYPE LldpChassisIdChoiceEnum - INTERFACE_NAME_SUBTYPE LldpChassisIdChoiceEnum - LOCAL_SUBTYPE LldpChassisIdChoiceEnum -}{ - MAC_ADDRESS_SUBTYPE: LldpChassisIdChoiceEnum("mac_address_subtype"), - INTERFACE_NAME_SUBTYPE: LldpChassisIdChoiceEnum("interface_name_subtype"), - LOCAL_SUBTYPE: LldpChassisIdChoiceEnum("local_subtype"), -} - -func (obj *lldpChassisId) Choice() LldpChassisIdChoiceEnum { - return LldpChassisIdChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// Chassis ID subtype to be used in Chassis ID TLV. -// Choice returns a string -func (obj *lldpChassisId) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *lldpChassisId) setChoice(value LldpChassisIdChoiceEnum) LldpChassisId { - intValue, ok := otg.LldpChassisId_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LldpChassisIdChoiceEnum", string(value))) - return obj - } - enumValue := otg.LldpChassisId_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.LocalSubtype = nil - obj.obj.InterfaceNameSubtype = nil - obj.obj.MacAddressSubtype = nil - obj.macAddressSubtypeHolder = nil - - if value == LldpChassisIdChoice.MAC_ADDRESS_SUBTYPE { - obj.obj.MacAddressSubtype = NewLldpChassisMacSubType().msg() - } - - return obj -} - -// description is TBD -// MacAddressSubtype returns a LldpChassisMacSubType -func (obj *lldpChassisId) MacAddressSubtype() LldpChassisMacSubType { - if obj.obj.MacAddressSubtype == nil { - obj.setChoice(LldpChassisIdChoice.MAC_ADDRESS_SUBTYPE) - } - if obj.macAddressSubtypeHolder == nil { - obj.macAddressSubtypeHolder = &lldpChassisMacSubType{obj: obj.obj.MacAddressSubtype} - } - return obj.macAddressSubtypeHolder -} - -// description is TBD -// MacAddressSubtype returns a LldpChassisMacSubType -func (obj *lldpChassisId) HasMacAddressSubtype() bool { - return obj.obj.MacAddressSubtype != nil -} - -// description is TBD -// SetMacAddressSubtype sets the LldpChassisMacSubType value in the LldpChassisId object -func (obj *lldpChassisId) SetMacAddressSubtype(value LldpChassisMacSubType) LldpChassisId { - obj.setChoice(LldpChassisIdChoice.MAC_ADDRESS_SUBTYPE) - obj.macAddressSubtypeHolder = nil - obj.obj.MacAddressSubtype = value.msg() - - return obj -} - -// Name of an interface of the chassis that uniquely identifies the chassis. -// InterfaceNameSubtype returns a string -func (obj *lldpChassisId) InterfaceNameSubtype() string { - - if obj.obj.InterfaceNameSubtype == nil { - obj.setChoice(LldpChassisIdChoice.INTERFACE_NAME_SUBTYPE) - } - - return *obj.obj.InterfaceNameSubtype - -} - -// Name of an interface of the chassis that uniquely identifies the chassis. -// InterfaceNameSubtype returns a string -func (obj *lldpChassisId) HasInterfaceNameSubtype() bool { - return obj.obj.InterfaceNameSubtype != nil -} - -// Name of an interface of the chassis that uniquely identifies the chassis. -// SetInterfaceNameSubtype sets the string value in the LldpChassisId object -func (obj *lldpChassisId) SetInterfaceNameSubtype(value string) LldpChassisId { - obj.setChoice(LldpChassisIdChoice.INTERFACE_NAME_SUBTYPE) - obj.obj.InterfaceNameSubtype = &value - return obj -} - -// Locally assigned name of the chassis. -// LocalSubtype returns a string -func (obj *lldpChassisId) LocalSubtype() string { - - if obj.obj.LocalSubtype == nil { - obj.setChoice(LldpChassisIdChoice.LOCAL_SUBTYPE) - } - - return *obj.obj.LocalSubtype - -} - -// Locally assigned name of the chassis. -// LocalSubtype returns a string -func (obj *lldpChassisId) HasLocalSubtype() bool { - return obj.obj.LocalSubtype != nil -} - -// Locally assigned name of the chassis. -// SetLocalSubtype sets the string value in the LldpChassisId object -func (obj *lldpChassisId) SetLocalSubtype(value string) LldpChassisId { - obj.setChoice(LldpChassisIdChoice.LOCAL_SUBTYPE) - obj.obj.LocalSubtype = &value - return obj -} - -func (obj *lldpChassisId) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.MacAddressSubtype != nil { - - obj.MacAddressSubtype().validateObj(vObj, set_default) - } - -} - -func (obj *lldpChassisId) setDefault() { - var choices_set int = 0 - var choice LldpChassisIdChoiceEnum - - if obj.obj.MacAddressSubtype != nil { - choices_set += 1 - choice = LldpChassisIdChoice.MAC_ADDRESS_SUBTYPE - } - - if obj.obj.InterfaceNameSubtype != nil { - choices_set += 1 - choice = LldpChassisIdChoice.INTERFACE_NAME_SUBTYPE - } - - if obj.obj.LocalSubtype != nil { - choices_set += 1 - choice = LldpChassisIdChoice.LOCAL_SUBTYPE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(LldpChassisIdChoice.MAC_ADDRESS_SUBTYPE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in LldpChassisId") - } - } else { - intVal := otg.LldpChassisId_Choice_Enum_value[string(choice)] - enumValue := otg.LldpChassisId_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** LldpPortId ***** -type lldpPortId struct { - validation - obj *otg.LldpPortId - marshaller marshalLldpPortId - unMarshaller unMarshalLldpPortId - interfaceNameSubtypeHolder LldpPortInterfaceNameSubType -} - -func NewLldpPortId() LldpPortId { - obj := lldpPortId{obj: &otg.LldpPortId{}} - obj.setDefault() - return &obj -} - -func (obj *lldpPortId) msg() *otg.LldpPortId { - return obj.obj -} - -func (obj *lldpPortId) setMsg(msg *otg.LldpPortId) LldpPortId { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshallldpPortId struct { - obj *lldpPortId -} - -type marshalLldpPortId interface { - // ToProto marshals LldpPortId to protobuf object *otg.LldpPortId - ToProto() (*otg.LldpPortId, error) - // ToPbText marshals LldpPortId to protobuf text - ToPbText() (string, error) - // ToYaml marshals LldpPortId to YAML text - ToYaml() (string, error) - // ToJson marshals LldpPortId to JSON text - ToJson() (string, error) -} - -type unMarshallldpPortId struct { - obj *lldpPortId -} - -type unMarshalLldpPortId interface { - // FromProto unmarshals LldpPortId from protobuf object *otg.LldpPortId - FromProto(msg *otg.LldpPortId) (LldpPortId, error) - // FromPbText unmarshals LldpPortId from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LldpPortId from YAML text - FromYaml(value string) error - // FromJson unmarshals LldpPortId from JSON text - FromJson(value string) error -} - -func (obj *lldpPortId) Marshal() marshalLldpPortId { - if obj.marshaller == nil { - obj.marshaller = &marshallldpPortId{obj: obj} - } - return obj.marshaller -} - -func (obj *lldpPortId) Unmarshal() unMarshalLldpPortId { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallldpPortId{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallldpPortId) ToProto() (*otg.LldpPortId, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallldpPortId) FromProto(msg *otg.LldpPortId) (LldpPortId, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallldpPortId) 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 *unMarshallldpPortId) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshallldpPortId) 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 *unMarshallldpPortId) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshallldpPortId) 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 *unMarshallldpPortId) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *lldpPortId) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lldpPortId) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lldpPortId) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lldpPortId) Clone() (LldpPortId, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLldpPortId() - 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 -} - -func (obj *lldpPortId) setNil() { - obj.interfaceNameSubtypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// LldpPortId is the Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent.This field identifies the format and source of the port identifier string. It is based on the enumerator defined by the PtopoPortIdType object from RFC2922. -type LldpPortId interface { - Validation - // msg marshals LldpPortId to protobuf object *otg.LldpPortId - // and doesn't set defaults - msg() *otg.LldpPortId - // setMsg unmarshals LldpPortId from protobuf object *otg.LldpPortId - // and doesn't set defaults - setMsg(*otg.LldpPortId) LldpPortId - // provides marshal interface - Marshal() marshalLldpPortId - // provides unmarshal interface - Unmarshal() unMarshalLldpPortId - // validate validates LldpPortId - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LldpPortId, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns LldpPortIdChoiceEnum, set in LldpPortId - Choice() LldpPortIdChoiceEnum - // setChoice assigns LldpPortIdChoiceEnum provided by user to LldpPortId - setChoice(value LldpPortIdChoiceEnum) LldpPortId - // HasChoice checks if Choice has been set in LldpPortId - HasChoice() bool - // MacAddressSubtype returns string, set in LldpPortId. - MacAddressSubtype() string - // SetMacAddressSubtype assigns string provided by user to LldpPortId - SetMacAddressSubtype(value string) LldpPortId - // HasMacAddressSubtype checks if MacAddressSubtype has been set in LldpPortId - HasMacAddressSubtype() bool - // InterfaceNameSubtype returns LldpPortInterfaceNameSubType, set in LldpPortId. - // LldpPortInterfaceNameSubType is the interface name configured in the Port ID TLV. - InterfaceNameSubtype() LldpPortInterfaceNameSubType - // SetInterfaceNameSubtype assigns LldpPortInterfaceNameSubType provided by user to LldpPortId. - // LldpPortInterfaceNameSubType is the interface name configured in the Port ID TLV. - SetInterfaceNameSubtype(value LldpPortInterfaceNameSubType) LldpPortId - // HasInterfaceNameSubtype checks if InterfaceNameSubtype has been set in LldpPortId - HasInterfaceNameSubtype() bool - // LocalSubtype returns string, set in LldpPortId. - LocalSubtype() string - // SetLocalSubtype assigns string provided by user to LldpPortId - SetLocalSubtype(value string) LldpPortId - // HasLocalSubtype checks if LocalSubtype has been set in LldpPortId - HasLocalSubtype() bool - setNil() -} - -type LldpPortIdChoiceEnum string - -// Enum of Choice on LldpPortId -var LldpPortIdChoice = struct { - MAC_ADDRESS_SUBTYPE LldpPortIdChoiceEnum - INTERFACE_NAME_SUBTYPE LldpPortIdChoiceEnum - LOCAL_SUBTYPE LldpPortIdChoiceEnum -}{ - MAC_ADDRESS_SUBTYPE: LldpPortIdChoiceEnum("mac_address_subtype"), - INTERFACE_NAME_SUBTYPE: LldpPortIdChoiceEnum("interface_name_subtype"), - LOCAL_SUBTYPE: LldpPortIdChoiceEnum("local_subtype"), -} - -func (obj *lldpPortId) Choice() LldpPortIdChoiceEnum { - return LldpPortIdChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// Port ID subtype to be used in Port ID TLV. -// Choice returns a string -func (obj *lldpPortId) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *lldpPortId) setChoice(value LldpPortIdChoiceEnum) LldpPortId { - intValue, ok := otg.LldpPortId_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LldpPortIdChoiceEnum", string(value))) - return obj - } - enumValue := otg.LldpPortId_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.LocalSubtype = nil - obj.obj.InterfaceNameSubtype = nil - obj.interfaceNameSubtypeHolder = nil - obj.obj.MacAddressSubtype = nil - - if value == LldpPortIdChoice.INTERFACE_NAME_SUBTYPE { - obj.obj.InterfaceNameSubtype = NewLldpPortInterfaceNameSubType().msg() - } - - return obj -} - -// The MAC Address configured in the Port ID TLV. -// MacAddressSubtype returns a string -func (obj *lldpPortId) MacAddressSubtype() string { - - if obj.obj.MacAddressSubtype == nil { - obj.setChoice(LldpPortIdChoice.MAC_ADDRESS_SUBTYPE) - } - - return *obj.obj.MacAddressSubtype - -} - -// The MAC Address configured in the Port ID TLV. -// MacAddressSubtype returns a string -func (obj *lldpPortId) HasMacAddressSubtype() bool { - return obj.obj.MacAddressSubtype != nil -} - -// The MAC Address configured in the Port ID TLV. -// SetMacAddressSubtype sets the string value in the LldpPortId object -func (obj *lldpPortId) SetMacAddressSubtype(value string) LldpPortId { - obj.setChoice(LldpPortIdChoice.MAC_ADDRESS_SUBTYPE) - obj.obj.MacAddressSubtype = &value - return obj -} - -// description is TBD -// InterfaceNameSubtype returns a LldpPortInterfaceNameSubType -func (obj *lldpPortId) InterfaceNameSubtype() LldpPortInterfaceNameSubType { - if obj.obj.InterfaceNameSubtype == nil { - obj.setChoice(LldpPortIdChoice.INTERFACE_NAME_SUBTYPE) - } - if obj.interfaceNameSubtypeHolder == nil { - obj.interfaceNameSubtypeHolder = &lldpPortInterfaceNameSubType{obj: obj.obj.InterfaceNameSubtype} - } - return obj.interfaceNameSubtypeHolder -} - -// description is TBD -// InterfaceNameSubtype returns a LldpPortInterfaceNameSubType -func (obj *lldpPortId) HasInterfaceNameSubtype() bool { - return obj.obj.InterfaceNameSubtype != nil -} - -// description is TBD -// SetInterfaceNameSubtype sets the LldpPortInterfaceNameSubType value in the LldpPortId object -func (obj *lldpPortId) SetInterfaceNameSubtype(value LldpPortInterfaceNameSubType) LldpPortId { - obj.setChoice(LldpPortIdChoice.INTERFACE_NAME_SUBTYPE) - obj.interfaceNameSubtypeHolder = nil - obj.obj.InterfaceNameSubtype = value.msg() - - return obj -} - -// The Locally assigned name configured in the Port ID TLV. -// LocalSubtype returns a string -func (obj *lldpPortId) LocalSubtype() string { - - if obj.obj.LocalSubtype == nil { - obj.setChoice(LldpPortIdChoice.LOCAL_SUBTYPE) - } - - return *obj.obj.LocalSubtype - -} - -// The Locally assigned name configured in the Port ID TLV. -// LocalSubtype returns a string -func (obj *lldpPortId) HasLocalSubtype() bool { - return obj.obj.LocalSubtype != nil -} - -// The Locally assigned name configured in the Port ID TLV. -// SetLocalSubtype sets the string value in the LldpPortId object -func (obj *lldpPortId) SetLocalSubtype(value string) LldpPortId { - obj.setChoice(LldpPortIdChoice.LOCAL_SUBTYPE) - obj.obj.LocalSubtype = &value - return obj -} - -func (obj *lldpPortId) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.InterfaceNameSubtype != nil { - - obj.InterfaceNameSubtype().validateObj(vObj, set_default) - } - -} - -func (obj *lldpPortId) setDefault() { - var choices_set int = 0 - var choice LldpPortIdChoiceEnum - - if obj.obj.MacAddressSubtype != nil { - choices_set += 1 - choice = LldpPortIdChoice.MAC_ADDRESS_SUBTYPE - } - - if obj.obj.InterfaceNameSubtype != nil { - choices_set += 1 - choice = LldpPortIdChoice.INTERFACE_NAME_SUBTYPE - } - - if obj.obj.LocalSubtype != nil { - choices_set += 1 - choice = LldpPortIdChoice.LOCAL_SUBTYPE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(LldpPortIdChoice.INTERFACE_NAME_SUBTYPE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in LldpPortId") - } - } else { - intVal := otg.LldpPortId_Choice_Enum_value[string(choice)] - enumValue := otg.LldpPortId_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** LldpSystemName ***** -type lldpSystemName struct { - validation - obj *otg.LldpSystemName - marshaller marshalLldpSystemName - unMarshaller unMarshalLldpSystemName -} - -func NewLldpSystemName() LldpSystemName { - obj := lldpSystemName{obj: &otg.LldpSystemName{}} - obj.setDefault() - return &obj -} - -func (obj *lldpSystemName) msg() *otg.LldpSystemName { - return obj.obj -} - -func (obj *lldpSystemName) setMsg(msg *otg.LldpSystemName) LldpSystemName { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallldpSystemName struct { - obj *lldpSystemName -} - -type marshalLldpSystemName interface { - // ToProto marshals LldpSystemName to protobuf object *otg.LldpSystemName - ToProto() (*otg.LldpSystemName, error) - // ToPbText marshals LldpSystemName to protobuf text - ToPbText() (string, error) - // ToYaml marshals LldpSystemName to YAML text - ToYaml() (string, error) - // ToJson marshals LldpSystemName to JSON text - ToJson() (string, error) -} - -type unMarshallldpSystemName struct { - obj *lldpSystemName -} - -type unMarshalLldpSystemName interface { - // FromProto unmarshals LldpSystemName from protobuf object *otg.LldpSystemName - FromProto(msg *otg.LldpSystemName) (LldpSystemName, error) - // FromPbText unmarshals LldpSystemName from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LldpSystemName from YAML text - FromYaml(value string) error - // FromJson unmarshals LldpSystemName from JSON text - FromJson(value string) error -} - -func (obj *lldpSystemName) Marshal() marshalLldpSystemName { - if obj.marshaller == nil { - obj.marshaller = &marshallldpSystemName{obj: obj} - } - return obj.marshaller -} - -func (obj *lldpSystemName) Unmarshal() unMarshalLldpSystemName { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallldpSystemName{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallldpSystemName) ToProto() (*otg.LldpSystemName, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallldpSystemName) FromProto(msg *otg.LldpSystemName) (LldpSystemName, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallldpSystemName) 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 *unMarshallldpSystemName) 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 *marshallldpSystemName) 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 *unMarshallldpSystemName) 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 *marshallldpSystemName) 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 *unMarshallldpSystemName) 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 *lldpSystemName) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lldpSystemName) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lldpSystemName) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lldpSystemName) Clone() (LldpSystemName, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLldpSystemName() - 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 -} - -// LldpSystemName is the system Name configured in the System Name TLV. -type LldpSystemName interface { - Validation - // msg marshals LldpSystemName to protobuf object *otg.LldpSystemName - // and doesn't set defaults - msg() *otg.LldpSystemName - // setMsg unmarshals LldpSystemName from protobuf object *otg.LldpSystemName - // and doesn't set defaults - setMsg(*otg.LldpSystemName) LldpSystemName - // provides marshal interface - Marshal() marshalLldpSystemName - // provides unmarshal interface - Unmarshal() unMarshalLldpSystemName - // validate validates LldpSystemName - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LldpSystemName, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns LldpSystemNameChoiceEnum, set in LldpSystemName - Choice() LldpSystemNameChoiceEnum - // setChoice assigns LldpSystemNameChoiceEnum provided by user to LldpSystemName - setChoice(value LldpSystemNameChoiceEnum) LldpSystemName - // HasChoice checks if Choice has been set in LldpSystemName - HasChoice() bool - // Auto returns string, set in LldpSystemName. - Auto() string - // HasAuto checks if Auto has been set in LldpSystemName - HasAuto() bool - // Value returns string, set in LldpSystemName. - Value() string - // SetValue assigns string provided by user to LldpSystemName - SetValue(value string) LldpSystemName - // HasValue checks if Value has been set in LldpSystemName - HasValue() bool -} - -type LldpSystemNameChoiceEnum string - -// Enum of Choice on LldpSystemName -var LldpSystemNameChoice = struct { - AUTO LldpSystemNameChoiceEnum - VALUE LldpSystemNameChoiceEnum -}{ - AUTO: LldpSystemNameChoiceEnum("auto"), - VALUE: LldpSystemNameChoiceEnum("value"), -} - -func (obj *lldpSystemName) Choice() LldpSystemNameChoiceEnum { - return LldpSystemNameChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// In auto mode the system generated value is set for this property, while if the choice is selected as value, a user configured value will be used for this property. -// Choice returns a string -func (obj *lldpSystemName) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *lldpSystemName) setChoice(value LldpSystemNameChoiceEnum) LldpSystemName { - intValue, ok := otg.LldpSystemName_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LldpSystemNameChoiceEnum", string(value))) - return obj - } - enumValue := otg.LldpSystemName_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Value = nil - obj.obj.Auto = nil - return obj -} - -// The OTG implementation must provide a system generated value for this property. -// Auto returns a string -func (obj *lldpSystemName) Auto() string { - - if obj.obj.Auto == nil { - obj.setChoice(LldpSystemNameChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation must provide a system generated value for this property. -// Auto returns a string -func (obj *lldpSystemName) HasAuto() bool { - return obj.obj.Auto != nil -} - -// User must specify a value if mode is not auto. -// Value returns a string -func (obj *lldpSystemName) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(LldpSystemNameChoice.VALUE) - } - - return *obj.obj.Value - -} - -// User must specify a value if mode is not auto. -// Value returns a string -func (obj *lldpSystemName) HasValue() bool { - return obj.obj.Value != nil -} - -// User must specify a value if mode is not auto. -// SetValue sets the string value in the LldpSystemName object -func (obj *lldpSystemName) SetValue(value string) LldpSystemName { - obj.setChoice(LldpSystemNameChoice.VALUE) - obj.obj.Value = &value - return obj -} - -func (obj *lldpSystemName) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *lldpSystemName) setDefault() { - var choices_set int = 0 - var choice LldpSystemNameChoiceEnum - - if obj.obj.Auto != nil { - choices_set += 1 - choice = LldpSystemNameChoice.AUTO - } - - if obj.obj.Value != nil { - choices_set += 1 - choice = LldpSystemNameChoice.VALUE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(LldpSystemNameChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in LldpSystemName") - } - } else { - intVal := otg.LldpSystemName_Choice_Enum_value[string(choice)] - enumValue := otg.LldpSystemName_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** StatePortLink ***** -type statePortLink struct { - validation - obj *otg.StatePortLink - marshaller marshalStatePortLink - unMarshaller unMarshalStatePortLink -} - -func NewStatePortLink() StatePortLink { - obj := statePortLink{obj: &otg.StatePortLink{}} - obj.setDefault() - return &obj -} - -func (obj *statePortLink) msg() *otg.StatePortLink { - return obj.obj -} - -func (obj *statePortLink) setMsg(msg *otg.StatePortLink) StatePortLink { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstatePortLink struct { - obj *statePortLink -} - -type marshalStatePortLink interface { - // ToProto marshals StatePortLink to protobuf object *otg.StatePortLink - ToProto() (*otg.StatePortLink, error) - // ToPbText marshals StatePortLink to protobuf text - ToPbText() (string, error) - // ToYaml marshals StatePortLink to YAML text - ToYaml() (string, error) - // ToJson marshals StatePortLink to JSON text - ToJson() (string, error) -} - -type unMarshalstatePortLink struct { - obj *statePortLink -} - -type unMarshalStatePortLink interface { - // FromProto unmarshals StatePortLink from protobuf object *otg.StatePortLink - FromProto(msg *otg.StatePortLink) (StatePortLink, error) - // FromPbText unmarshals StatePortLink from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StatePortLink from YAML text - FromYaml(value string) error - // FromJson unmarshals StatePortLink from JSON text - FromJson(value string) error -} - -func (obj *statePortLink) Marshal() marshalStatePortLink { - if obj.marshaller == nil { - obj.marshaller = &marshalstatePortLink{obj: obj} - } - return obj.marshaller -} - -func (obj *statePortLink) Unmarshal() unMarshalStatePortLink { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstatePortLink{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstatePortLink) ToProto() (*otg.StatePortLink, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstatePortLink) FromProto(msg *otg.StatePortLink) (StatePortLink, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstatePortLink) 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 *unMarshalstatePortLink) 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 *marshalstatePortLink) 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 *unMarshalstatePortLink) 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 *marshalstatePortLink) 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 *unMarshalstatePortLink) 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 *statePortLink) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *statePortLink) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *statePortLink) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *statePortLink) Clone() (StatePortLink, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStatePortLink() - 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 -} - -// StatePortLink is sets the link of configured ports. -type StatePortLink interface { - Validation - // msg marshals StatePortLink to protobuf object *otg.StatePortLink - // and doesn't set defaults - msg() *otg.StatePortLink - // setMsg unmarshals StatePortLink from protobuf object *otg.StatePortLink - // and doesn't set defaults - setMsg(*otg.StatePortLink) StatePortLink - // provides marshal interface - Marshal() marshalStatePortLink - // provides unmarshal interface - Unmarshal() unMarshalStatePortLink - // validate validates StatePortLink - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StatePortLink, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PortNames returns []string, set in StatePortLink. - PortNames() []string - // SetPortNames assigns []string provided by user to StatePortLink - SetPortNames(value []string) StatePortLink - // State returns StatePortLinkStateEnum, set in StatePortLink - State() StatePortLinkStateEnum - // SetState assigns StatePortLinkStateEnum provided by user to StatePortLink - SetState(value StatePortLinkStateEnum) StatePortLink -} - -// The names of target ports. An empty or null list will target all ports. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// PortNames returns a []string -func (obj *statePortLink) PortNames() []string { - if obj.obj.PortNames == nil { - obj.obj.PortNames = make([]string, 0) - } - return obj.obj.PortNames -} - -// The names of target ports. An empty or null list will target all ports. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// SetPortNames sets the []string value in the StatePortLink object -func (obj *statePortLink) SetPortNames(value []string) StatePortLink { - - if obj.obj.PortNames == nil { - obj.obj.PortNames = make([]string, 0) - } - obj.obj.PortNames = value - - return obj -} - -type StatePortLinkStateEnum string - -// Enum of State on StatePortLink -var StatePortLinkState = struct { - UP StatePortLinkStateEnum - DOWN StatePortLinkStateEnum -}{ - UP: StatePortLinkStateEnum("up"), - DOWN: StatePortLinkStateEnum("down"), -} - -func (obj *statePortLink) State() StatePortLinkStateEnum { - return StatePortLinkStateEnum(obj.obj.State.Enum().String()) -} - -func (obj *statePortLink) SetState(value StatePortLinkStateEnum) StatePortLink { - intValue, ok := otg.StatePortLink_State_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StatePortLinkStateEnum", string(value))) - return obj - } - enumValue := otg.StatePortLink_State_Enum(intValue) - obj.obj.State = &enumValue - - return obj -} - -func (obj *statePortLink) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // State is required - if obj.obj.State == nil { - vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StatePortLink") - } -} - -func (obj *statePortLink) setDefault() { - -} - -// ***** StatePortCapture ***** -type statePortCapture struct { - validation - obj *otg.StatePortCapture - marshaller marshalStatePortCapture - unMarshaller unMarshalStatePortCapture -} - -func NewStatePortCapture() StatePortCapture { - obj := statePortCapture{obj: &otg.StatePortCapture{}} - obj.setDefault() - return &obj -} - -func (obj *statePortCapture) msg() *otg.StatePortCapture { - return obj.obj -} - -func (obj *statePortCapture) setMsg(msg *otg.StatePortCapture) StatePortCapture { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstatePortCapture struct { - obj *statePortCapture -} - -type marshalStatePortCapture interface { - // ToProto marshals StatePortCapture to protobuf object *otg.StatePortCapture - ToProto() (*otg.StatePortCapture, error) - // ToPbText marshals StatePortCapture to protobuf text - ToPbText() (string, error) - // ToYaml marshals StatePortCapture to YAML text - ToYaml() (string, error) - // ToJson marshals StatePortCapture to JSON text - ToJson() (string, error) -} - -type unMarshalstatePortCapture struct { - obj *statePortCapture -} - -type unMarshalStatePortCapture interface { - // FromProto unmarshals StatePortCapture from protobuf object *otg.StatePortCapture - FromProto(msg *otg.StatePortCapture) (StatePortCapture, error) - // FromPbText unmarshals StatePortCapture from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StatePortCapture from YAML text - FromYaml(value string) error - // FromJson unmarshals StatePortCapture from JSON text - FromJson(value string) error -} - -func (obj *statePortCapture) Marshal() marshalStatePortCapture { - if obj.marshaller == nil { - obj.marshaller = &marshalstatePortCapture{obj: obj} - } - return obj.marshaller -} - -func (obj *statePortCapture) Unmarshal() unMarshalStatePortCapture { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstatePortCapture{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstatePortCapture) ToProto() (*otg.StatePortCapture, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstatePortCapture) FromProto(msg *otg.StatePortCapture) (StatePortCapture, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstatePortCapture) 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 *unMarshalstatePortCapture) 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 *marshalstatePortCapture) 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 *unMarshalstatePortCapture) 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 *marshalstatePortCapture) 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 *unMarshalstatePortCapture) 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 *statePortCapture) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *statePortCapture) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *statePortCapture) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *statePortCapture) Clone() (StatePortCapture, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStatePortCapture() - 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 -} - -// StatePortCapture is sets the capture state of configured ports -type StatePortCapture interface { - Validation - // msg marshals StatePortCapture to protobuf object *otg.StatePortCapture - // and doesn't set defaults - msg() *otg.StatePortCapture - // setMsg unmarshals StatePortCapture from protobuf object *otg.StatePortCapture - // and doesn't set defaults - setMsg(*otg.StatePortCapture) StatePortCapture - // provides marshal interface - Marshal() marshalStatePortCapture - // provides unmarshal interface - Unmarshal() unMarshalStatePortCapture - // validate validates StatePortCapture - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StatePortCapture, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PortNames returns []string, set in StatePortCapture. - PortNames() []string - // SetPortNames assigns []string provided by user to StatePortCapture - SetPortNames(value []string) StatePortCapture - // State returns StatePortCaptureStateEnum, set in StatePortCapture - State() StatePortCaptureStateEnum - // SetState assigns StatePortCaptureStateEnum provided by user to StatePortCapture - SetState(value StatePortCaptureStateEnum) StatePortCapture -} - -// The names of ports to which the capture state will be applied to. If the list of port_names is empty or null the state will be applied to all configured ports. -// If the list is not empty any port that is not included in the list of port_names MUST be ignored and not included in the state change. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// PortNames returns a []string -func (obj *statePortCapture) PortNames() []string { - if obj.obj.PortNames == nil { - obj.obj.PortNames = make([]string, 0) - } - return obj.obj.PortNames -} - -// The names of ports to which the capture state will be applied to. If the list of port_names is empty or null the state will be applied to all configured ports. -// If the list is not empty any port that is not included in the list of port_names MUST be ignored and not included in the state change. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// SetPortNames sets the []string value in the StatePortCapture object -func (obj *statePortCapture) SetPortNames(value []string) StatePortCapture { - - if obj.obj.PortNames == nil { - obj.obj.PortNames = make([]string, 0) - } - obj.obj.PortNames = value - - return obj -} - -type StatePortCaptureStateEnum string - -// Enum of State on StatePortCapture -var StatePortCaptureState = struct { - START StatePortCaptureStateEnum - STOP StatePortCaptureStateEnum -}{ - START: StatePortCaptureStateEnum("start"), - STOP: StatePortCaptureStateEnum("stop"), -} - -func (obj *statePortCapture) State() StatePortCaptureStateEnum { - return StatePortCaptureStateEnum(obj.obj.State.Enum().String()) -} - -func (obj *statePortCapture) SetState(value StatePortCaptureStateEnum) StatePortCapture { - intValue, ok := otg.StatePortCapture_State_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StatePortCaptureStateEnum", string(value))) - return obj - } - enumValue := otg.StatePortCapture_State_Enum(intValue) - obj.obj.State = &enumValue - - return obj -} - -func (obj *statePortCapture) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // State is required - if obj.obj.State == nil { - vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StatePortCapture") - } -} - -func (obj *statePortCapture) setDefault() { - -} - -// ***** StateProtocolAll ***** -type stateProtocolAll struct { - validation - obj *otg.StateProtocolAll - marshaller marshalStateProtocolAll - unMarshaller unMarshalStateProtocolAll -} - -func NewStateProtocolAll() StateProtocolAll { - obj := stateProtocolAll{obj: &otg.StateProtocolAll{}} - obj.setDefault() - return &obj -} - -func (obj *stateProtocolAll) msg() *otg.StateProtocolAll { - return obj.obj -} - -func (obj *stateProtocolAll) setMsg(msg *otg.StateProtocolAll) StateProtocolAll { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstateProtocolAll struct { - obj *stateProtocolAll -} - -type marshalStateProtocolAll interface { - // ToProto marshals StateProtocolAll to protobuf object *otg.StateProtocolAll - ToProto() (*otg.StateProtocolAll, error) - // ToPbText marshals StateProtocolAll to protobuf text - ToPbText() (string, error) - // ToYaml marshals StateProtocolAll to YAML text - ToYaml() (string, error) - // ToJson marshals StateProtocolAll to JSON text - ToJson() (string, error) -} - -type unMarshalstateProtocolAll struct { - obj *stateProtocolAll -} - -type unMarshalStateProtocolAll interface { - // FromProto unmarshals StateProtocolAll from protobuf object *otg.StateProtocolAll - FromProto(msg *otg.StateProtocolAll) (StateProtocolAll, error) - // FromPbText unmarshals StateProtocolAll from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StateProtocolAll from YAML text - FromYaml(value string) error - // FromJson unmarshals StateProtocolAll from JSON text - FromJson(value string) error -} - -func (obj *stateProtocolAll) Marshal() marshalStateProtocolAll { - if obj.marshaller == nil { - obj.marshaller = &marshalstateProtocolAll{obj: obj} - } - return obj.marshaller -} - -func (obj *stateProtocolAll) Unmarshal() unMarshalStateProtocolAll { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstateProtocolAll{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstateProtocolAll) ToProto() (*otg.StateProtocolAll, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstateProtocolAll) FromProto(msg *otg.StateProtocolAll) (StateProtocolAll, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstateProtocolAll) 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 *unMarshalstateProtocolAll) 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 *marshalstateProtocolAll) 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 *unMarshalstateProtocolAll) 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 *marshalstateProtocolAll) 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 *unMarshalstateProtocolAll) 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 *stateProtocolAll) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *stateProtocolAll) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *stateProtocolAll) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *stateProtocolAll) Clone() (StateProtocolAll, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStateProtocolAll() - 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 -} - -// StateProtocolAll is sets all configured protocols to `start` or `stop` state. -// Setting protocol state to `start` shall be a no-op if preceding `set_config` API call was made with `config.options.protocol_options.auto_start_all` set to `true` or if all the configured protocols are already started. -type StateProtocolAll interface { - Validation - // msg marshals StateProtocolAll to protobuf object *otg.StateProtocolAll - // and doesn't set defaults - msg() *otg.StateProtocolAll - // setMsg unmarshals StateProtocolAll from protobuf object *otg.StateProtocolAll - // and doesn't set defaults - setMsg(*otg.StateProtocolAll) StateProtocolAll - // provides marshal interface - Marshal() marshalStateProtocolAll - // provides unmarshal interface - Unmarshal() unMarshalStateProtocolAll - // validate validates StateProtocolAll - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StateProtocolAll, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // State returns StateProtocolAllStateEnum, set in StateProtocolAll - State() StateProtocolAllStateEnum - // SetState assigns StateProtocolAllStateEnum provided by user to StateProtocolAll - SetState(value StateProtocolAllStateEnum) StateProtocolAll -} - -type StateProtocolAllStateEnum string - -// Enum of State on StateProtocolAll -var StateProtocolAllState = struct { - START StateProtocolAllStateEnum - STOP StateProtocolAllStateEnum -}{ - START: StateProtocolAllStateEnum("start"), - STOP: StateProtocolAllStateEnum("stop"), -} - -func (obj *stateProtocolAll) State() StateProtocolAllStateEnum { - return StateProtocolAllStateEnum(obj.obj.State.Enum().String()) -} - -func (obj *stateProtocolAll) SetState(value StateProtocolAllStateEnum) StateProtocolAll { - intValue, ok := otg.StateProtocolAll_State_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StateProtocolAllStateEnum", string(value))) - return obj - } - enumValue := otg.StateProtocolAll_State_Enum(intValue) - obj.obj.State = &enumValue - - return obj -} - -func (obj *stateProtocolAll) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // State is required - if obj.obj.State == nil { - vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StateProtocolAll") - } -} - -func (obj *stateProtocolAll) setDefault() { - -} - -// ***** StateProtocolRoute ***** -type stateProtocolRoute struct { - validation - obj *otg.StateProtocolRoute - marshaller marshalStateProtocolRoute - unMarshaller unMarshalStateProtocolRoute -} - -func NewStateProtocolRoute() StateProtocolRoute { - obj := stateProtocolRoute{obj: &otg.StateProtocolRoute{}} - obj.setDefault() - return &obj -} - -func (obj *stateProtocolRoute) msg() *otg.StateProtocolRoute { - return obj.obj -} - -func (obj *stateProtocolRoute) setMsg(msg *otg.StateProtocolRoute) StateProtocolRoute { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstateProtocolRoute struct { - obj *stateProtocolRoute -} - -type marshalStateProtocolRoute interface { - // ToProto marshals StateProtocolRoute to protobuf object *otg.StateProtocolRoute - ToProto() (*otg.StateProtocolRoute, error) - // ToPbText marshals StateProtocolRoute to protobuf text - ToPbText() (string, error) - // ToYaml marshals StateProtocolRoute to YAML text - ToYaml() (string, error) - // ToJson marshals StateProtocolRoute to JSON text - ToJson() (string, error) -} - -type unMarshalstateProtocolRoute struct { - obj *stateProtocolRoute -} - -type unMarshalStateProtocolRoute interface { - // FromProto unmarshals StateProtocolRoute from protobuf object *otg.StateProtocolRoute - FromProto(msg *otg.StateProtocolRoute) (StateProtocolRoute, error) - // FromPbText unmarshals StateProtocolRoute from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StateProtocolRoute from YAML text - FromYaml(value string) error - // FromJson unmarshals StateProtocolRoute from JSON text - FromJson(value string) error -} - -func (obj *stateProtocolRoute) Marshal() marshalStateProtocolRoute { - if obj.marshaller == nil { - obj.marshaller = &marshalstateProtocolRoute{obj: obj} - } - return obj.marshaller -} - -func (obj *stateProtocolRoute) Unmarshal() unMarshalStateProtocolRoute { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstateProtocolRoute{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstateProtocolRoute) ToProto() (*otg.StateProtocolRoute, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstateProtocolRoute) FromProto(msg *otg.StateProtocolRoute) (StateProtocolRoute, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstateProtocolRoute) 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 *unMarshalstateProtocolRoute) 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 *marshalstateProtocolRoute) 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 *unMarshalstateProtocolRoute) 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 *marshalstateProtocolRoute) 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 *unMarshalstateProtocolRoute) 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 *stateProtocolRoute) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *stateProtocolRoute) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *stateProtocolRoute) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *stateProtocolRoute) Clone() (StateProtocolRoute, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStateProtocolRoute() - 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 -} - -// StateProtocolRoute is sets the state of configured routes -type StateProtocolRoute interface { - Validation - // msg marshals StateProtocolRoute to protobuf object *otg.StateProtocolRoute - // and doesn't set defaults - msg() *otg.StateProtocolRoute - // setMsg unmarshals StateProtocolRoute from protobuf object *otg.StateProtocolRoute - // and doesn't set defaults - setMsg(*otg.StateProtocolRoute) StateProtocolRoute - // provides marshal interface - Marshal() marshalStateProtocolRoute - // provides unmarshal interface - Unmarshal() unMarshalStateProtocolRoute - // validate validates StateProtocolRoute - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StateProtocolRoute, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Names returns []string, set in StateProtocolRoute. - Names() []string - // SetNames assigns []string provided by user to StateProtocolRoute - SetNames(value []string) StateProtocolRoute - // State returns StateProtocolRouteStateEnum, set in StateProtocolRoute - State() StateProtocolRouteStateEnum - // SetState assigns StateProtocolRouteStateEnum provided by user to StateProtocolRoute - SetState(value StateProtocolRouteStateEnum) StateProtocolRoute -} - -// The names of device route objects to control. If no names are specified then all route objects that match the x-constraint will be affected. -// -// x-constraint: -// - /components/schemas/Bgp.V4RouteRange/properties/name -// - /components/schemas/Bgp.V6RouteRange/properties/name -// - /components/schemas/Isis.V4RouteRange/properties/name -// - /components/schemas/Isis.V6RouteRange/properties/name -// -// x-constraint: -// - /components/schemas/Bgp.V4RouteRange/properties/name -// - /components/schemas/Bgp.V6RouteRange/properties/name -// - /components/schemas/Isis.V4RouteRange/properties/name -// - /components/schemas/Isis.V6RouteRange/properties/name -// -// Names returns a []string -func (obj *stateProtocolRoute) Names() []string { - if obj.obj.Names == nil { - obj.obj.Names = make([]string, 0) - } - return obj.obj.Names -} - -// The names of device route objects to control. If no names are specified then all route objects that match the x-constraint will be affected. -// -// x-constraint: -// - /components/schemas/Bgp.V4RouteRange/properties/name -// - /components/schemas/Bgp.V6RouteRange/properties/name -// - /components/schemas/Isis.V4RouteRange/properties/name -// - /components/schemas/Isis.V6RouteRange/properties/name -// -// x-constraint: -// - /components/schemas/Bgp.V4RouteRange/properties/name -// - /components/schemas/Bgp.V6RouteRange/properties/name -// - /components/schemas/Isis.V4RouteRange/properties/name -// - /components/schemas/Isis.V6RouteRange/properties/name -// -// SetNames sets the []string value in the StateProtocolRoute object -func (obj *stateProtocolRoute) SetNames(value []string) StateProtocolRoute { - - if obj.obj.Names == nil { - obj.obj.Names = make([]string, 0) - } - obj.obj.Names = value - - return obj -} - -type StateProtocolRouteStateEnum string - -// Enum of State on StateProtocolRoute -var StateProtocolRouteState = struct { - WITHDRAW StateProtocolRouteStateEnum - ADVERTISE StateProtocolRouteStateEnum -}{ - WITHDRAW: StateProtocolRouteStateEnum("withdraw"), - ADVERTISE: StateProtocolRouteStateEnum("advertise"), -} - -func (obj *stateProtocolRoute) State() StateProtocolRouteStateEnum { - return StateProtocolRouteStateEnum(obj.obj.State.Enum().String()) -} - -func (obj *stateProtocolRoute) SetState(value StateProtocolRouteStateEnum) StateProtocolRoute { - intValue, ok := otg.StateProtocolRoute_State_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StateProtocolRouteStateEnum", string(value))) - return obj - } - enumValue := otg.StateProtocolRoute_State_Enum(intValue) - obj.obj.State = &enumValue - - return obj -} - -func (obj *stateProtocolRoute) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // State is required - if obj.obj.State == nil { - vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StateProtocolRoute") - } -} - -func (obj *stateProtocolRoute) setDefault() { - -} - -// ***** StateProtocolLacp ***** -type stateProtocolLacp struct { - validation - obj *otg.StateProtocolLacp - marshaller marshalStateProtocolLacp - unMarshaller unMarshalStateProtocolLacp - adminHolder StateProtocolLacpAdmin - memberPortsHolder StateProtocolLacpMemberPorts -} - -func NewStateProtocolLacp() StateProtocolLacp { - obj := stateProtocolLacp{obj: &otg.StateProtocolLacp{}} - obj.setDefault() - return &obj -} - -func (obj *stateProtocolLacp) msg() *otg.StateProtocolLacp { - return obj.obj -} - -func (obj *stateProtocolLacp) setMsg(msg *otg.StateProtocolLacp) StateProtocolLacp { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstateProtocolLacp struct { - obj *stateProtocolLacp -} - -type marshalStateProtocolLacp interface { - // ToProto marshals StateProtocolLacp to protobuf object *otg.StateProtocolLacp - ToProto() (*otg.StateProtocolLacp, error) - // ToPbText marshals StateProtocolLacp to protobuf text - ToPbText() (string, error) - // ToYaml marshals StateProtocolLacp to YAML text - ToYaml() (string, error) - // ToJson marshals StateProtocolLacp to JSON text - ToJson() (string, error) -} - -type unMarshalstateProtocolLacp struct { - obj *stateProtocolLacp -} - -type unMarshalStateProtocolLacp interface { - // FromProto unmarshals StateProtocolLacp from protobuf object *otg.StateProtocolLacp - FromProto(msg *otg.StateProtocolLacp) (StateProtocolLacp, error) - // FromPbText unmarshals StateProtocolLacp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StateProtocolLacp from YAML text - FromYaml(value string) error - // FromJson unmarshals StateProtocolLacp from JSON text - FromJson(value string) error -} - -func (obj *stateProtocolLacp) Marshal() marshalStateProtocolLacp { - if obj.marshaller == nil { - obj.marshaller = &marshalstateProtocolLacp{obj: obj} - } - return obj.marshaller -} - -func (obj *stateProtocolLacp) Unmarshal() unMarshalStateProtocolLacp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstateProtocolLacp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstateProtocolLacp) ToProto() (*otg.StateProtocolLacp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstateProtocolLacp) FromProto(msg *otg.StateProtocolLacp) (StateProtocolLacp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstateProtocolLacp) 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 *unMarshalstateProtocolLacp) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalstateProtocolLacp) 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 *unMarshalstateProtocolLacp) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalstateProtocolLacp) 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 *unMarshalstateProtocolLacp) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *stateProtocolLacp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *stateProtocolLacp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *stateProtocolLacp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *stateProtocolLacp) Clone() (StateProtocolLacp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStateProtocolLacp() - 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 -} - -func (obj *stateProtocolLacp) setNil() { - obj.adminHolder = nil - obj.memberPortsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// StateProtocolLacp is sets state of configured LACP -type StateProtocolLacp interface { - Validation - // msg marshals StateProtocolLacp to protobuf object *otg.StateProtocolLacp - // and doesn't set defaults - msg() *otg.StateProtocolLacp - // setMsg unmarshals StateProtocolLacp from protobuf object *otg.StateProtocolLacp - // and doesn't set defaults - setMsg(*otg.StateProtocolLacp) StateProtocolLacp - // provides marshal interface - Marshal() marshalStateProtocolLacp - // provides unmarshal interface - Unmarshal() unMarshalStateProtocolLacp - // validate validates StateProtocolLacp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StateProtocolLacp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns StateProtocolLacpChoiceEnum, set in StateProtocolLacp - Choice() StateProtocolLacpChoiceEnum - // setChoice assigns StateProtocolLacpChoiceEnum provided by user to StateProtocolLacp - setChoice(value StateProtocolLacpChoiceEnum) StateProtocolLacp - // Admin returns StateProtocolLacpAdmin, set in StateProtocolLacp. - // StateProtocolLacpAdmin is sets admin state of LACP configured on LAG members - Admin() StateProtocolLacpAdmin - // SetAdmin assigns StateProtocolLacpAdmin provided by user to StateProtocolLacp. - // StateProtocolLacpAdmin is sets admin state of LACP configured on LAG members - SetAdmin(value StateProtocolLacpAdmin) StateProtocolLacp - // HasAdmin checks if Admin has been set in StateProtocolLacp - HasAdmin() bool - // MemberPorts returns StateProtocolLacpMemberPorts, set in StateProtocolLacp. - // StateProtocolLacpMemberPorts is sets state of LACP member ports configured on LAG. - MemberPorts() StateProtocolLacpMemberPorts - // SetMemberPorts assigns StateProtocolLacpMemberPorts provided by user to StateProtocolLacp. - // StateProtocolLacpMemberPorts is sets state of LACP member ports configured on LAG. - SetMemberPorts(value StateProtocolLacpMemberPorts) StateProtocolLacp - // HasMemberPorts checks if MemberPorts has been set in StateProtocolLacp - HasMemberPorts() bool - setNil() -} - -type StateProtocolLacpChoiceEnum string - -// Enum of Choice on StateProtocolLacp -var StateProtocolLacpChoice = struct { - ADMIN StateProtocolLacpChoiceEnum - MEMBER_PORTS StateProtocolLacpChoiceEnum -}{ - ADMIN: StateProtocolLacpChoiceEnum("admin"), - MEMBER_PORTS: StateProtocolLacpChoiceEnum("member_ports"), -} - -func (obj *stateProtocolLacp) Choice() StateProtocolLacpChoiceEnum { - return StateProtocolLacpChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *stateProtocolLacp) setChoice(value StateProtocolLacpChoiceEnum) StateProtocolLacp { - intValue, ok := otg.StateProtocolLacp_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StateProtocolLacpChoiceEnum", string(value))) - return obj - } - enumValue := otg.StateProtocolLacp_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.MemberPorts = nil - obj.memberPortsHolder = nil - obj.obj.Admin = nil - obj.adminHolder = nil - - if value == StateProtocolLacpChoice.ADMIN { - obj.obj.Admin = NewStateProtocolLacpAdmin().msg() - } - - if value == StateProtocolLacpChoice.MEMBER_PORTS { - obj.obj.MemberPorts = NewStateProtocolLacpMemberPorts().msg() - } - - return obj -} - -// description is TBD -// Admin returns a StateProtocolLacpAdmin -func (obj *stateProtocolLacp) Admin() StateProtocolLacpAdmin { - if obj.obj.Admin == nil { - obj.setChoice(StateProtocolLacpChoice.ADMIN) - } - if obj.adminHolder == nil { - obj.adminHolder = &stateProtocolLacpAdmin{obj: obj.obj.Admin} - } - return obj.adminHolder -} - -// description is TBD -// Admin returns a StateProtocolLacpAdmin -func (obj *stateProtocolLacp) HasAdmin() bool { - return obj.obj.Admin != nil -} - -// description is TBD -// SetAdmin sets the StateProtocolLacpAdmin value in the StateProtocolLacp object -func (obj *stateProtocolLacp) SetAdmin(value StateProtocolLacpAdmin) StateProtocolLacp { - obj.setChoice(StateProtocolLacpChoice.ADMIN) - obj.adminHolder = nil - obj.obj.Admin = value.msg() - - return obj -} - -// description is TBD -// MemberPorts returns a StateProtocolLacpMemberPorts -func (obj *stateProtocolLacp) MemberPorts() StateProtocolLacpMemberPorts { - if obj.obj.MemberPorts == nil { - obj.setChoice(StateProtocolLacpChoice.MEMBER_PORTS) - } - if obj.memberPortsHolder == nil { - obj.memberPortsHolder = &stateProtocolLacpMemberPorts{obj: obj.obj.MemberPorts} - } - return obj.memberPortsHolder -} - -// description is TBD -// MemberPorts returns a StateProtocolLacpMemberPorts -func (obj *stateProtocolLacp) HasMemberPorts() bool { - return obj.obj.MemberPorts != nil -} - -// description is TBD -// SetMemberPorts sets the StateProtocolLacpMemberPorts value in the StateProtocolLacp object -func (obj *stateProtocolLacp) SetMemberPorts(value StateProtocolLacpMemberPorts) StateProtocolLacp { - obj.setChoice(StateProtocolLacpChoice.MEMBER_PORTS) - obj.memberPortsHolder = nil - obj.obj.MemberPorts = value.msg() - - return obj -} - -func (obj *stateProtocolLacp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface StateProtocolLacp") - } - - if obj.obj.Admin != nil { - - obj.Admin().validateObj(vObj, set_default) - } - - if obj.obj.MemberPorts != nil { - - obj.MemberPorts().validateObj(vObj, set_default) - } - -} - -func (obj *stateProtocolLacp) setDefault() { - var choices_set int = 0 - var choice StateProtocolLacpChoiceEnum - - if obj.obj.Admin != nil { - choices_set += 1 - choice = StateProtocolLacpChoice.ADMIN - } - - if obj.obj.MemberPorts != nil { - choices_set += 1 - choice = StateProtocolLacpChoice.MEMBER_PORTS - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StateProtocolLacp") - } - } else { - intVal := otg.StateProtocolLacp_Choice_Enum_value[string(choice)] - enumValue := otg.StateProtocolLacp_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** StateProtocolBgp ***** -type stateProtocolBgp struct { - validation - obj *otg.StateProtocolBgp - marshaller marshalStateProtocolBgp - unMarshaller unMarshalStateProtocolBgp - peersHolder StateProtocolBgpPeers -} - -func NewStateProtocolBgp() StateProtocolBgp { - obj := stateProtocolBgp{obj: &otg.StateProtocolBgp{}} - obj.setDefault() - return &obj -} - -func (obj *stateProtocolBgp) msg() *otg.StateProtocolBgp { - return obj.obj -} - -func (obj *stateProtocolBgp) setMsg(msg *otg.StateProtocolBgp) StateProtocolBgp { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstateProtocolBgp struct { - obj *stateProtocolBgp -} - -type marshalStateProtocolBgp interface { - // ToProto marshals StateProtocolBgp to protobuf object *otg.StateProtocolBgp - ToProto() (*otg.StateProtocolBgp, error) - // ToPbText marshals StateProtocolBgp to protobuf text - ToPbText() (string, error) - // ToYaml marshals StateProtocolBgp to YAML text - ToYaml() (string, error) - // ToJson marshals StateProtocolBgp to JSON text - ToJson() (string, error) -} - -type unMarshalstateProtocolBgp struct { - obj *stateProtocolBgp -} - -type unMarshalStateProtocolBgp interface { - // FromProto unmarshals StateProtocolBgp from protobuf object *otg.StateProtocolBgp - FromProto(msg *otg.StateProtocolBgp) (StateProtocolBgp, error) - // FromPbText unmarshals StateProtocolBgp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StateProtocolBgp from YAML text - FromYaml(value string) error - // FromJson unmarshals StateProtocolBgp from JSON text - FromJson(value string) error -} - -func (obj *stateProtocolBgp) Marshal() marshalStateProtocolBgp { - if obj.marshaller == nil { - obj.marshaller = &marshalstateProtocolBgp{obj: obj} - } - return obj.marshaller -} - -func (obj *stateProtocolBgp) Unmarshal() unMarshalStateProtocolBgp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstateProtocolBgp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstateProtocolBgp) ToProto() (*otg.StateProtocolBgp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstateProtocolBgp) FromProto(msg *otg.StateProtocolBgp) (StateProtocolBgp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstateProtocolBgp) 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 *unMarshalstateProtocolBgp) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalstateProtocolBgp) 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 *unMarshalstateProtocolBgp) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalstateProtocolBgp) 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 *unMarshalstateProtocolBgp) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *stateProtocolBgp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *stateProtocolBgp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *stateProtocolBgp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *stateProtocolBgp) Clone() (StateProtocolBgp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStateProtocolBgp() - 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 -} - -func (obj *stateProtocolBgp) setNil() { - obj.peersHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// StateProtocolBgp is sets state of configured BGP peers. -type StateProtocolBgp interface { - Validation - // msg marshals StateProtocolBgp to protobuf object *otg.StateProtocolBgp - // and doesn't set defaults - msg() *otg.StateProtocolBgp - // setMsg unmarshals StateProtocolBgp from protobuf object *otg.StateProtocolBgp - // and doesn't set defaults - setMsg(*otg.StateProtocolBgp) StateProtocolBgp - // provides marshal interface - Marshal() marshalStateProtocolBgp - // provides unmarshal interface - Unmarshal() unMarshalStateProtocolBgp - // validate validates StateProtocolBgp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StateProtocolBgp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns StateProtocolBgpChoiceEnum, set in StateProtocolBgp - Choice() StateProtocolBgpChoiceEnum - // setChoice assigns StateProtocolBgpChoiceEnum provided by user to StateProtocolBgp - setChoice(value StateProtocolBgpChoiceEnum) StateProtocolBgp - // Peers returns StateProtocolBgpPeers, set in StateProtocolBgp. - // StateProtocolBgpPeers is sets state of configured BGP peers. - Peers() StateProtocolBgpPeers - // SetPeers assigns StateProtocolBgpPeers provided by user to StateProtocolBgp. - // StateProtocolBgpPeers is sets state of configured BGP peers. - SetPeers(value StateProtocolBgpPeers) StateProtocolBgp - // HasPeers checks if Peers has been set in StateProtocolBgp - HasPeers() bool - setNil() -} - -type StateProtocolBgpChoiceEnum string - -// Enum of Choice on StateProtocolBgp -var StateProtocolBgpChoice = struct { - PEERS StateProtocolBgpChoiceEnum -}{ - PEERS: StateProtocolBgpChoiceEnum("peers"), -} - -func (obj *stateProtocolBgp) Choice() StateProtocolBgpChoiceEnum { - return StateProtocolBgpChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *stateProtocolBgp) setChoice(value StateProtocolBgpChoiceEnum) StateProtocolBgp { - intValue, ok := otg.StateProtocolBgp_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StateProtocolBgpChoiceEnum", string(value))) - return obj - } - enumValue := otg.StateProtocolBgp_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Peers = nil - obj.peersHolder = nil - - if value == StateProtocolBgpChoice.PEERS { - obj.obj.Peers = NewStateProtocolBgpPeers().msg() - } - - return obj -} - -// description is TBD -// Peers returns a StateProtocolBgpPeers -func (obj *stateProtocolBgp) Peers() StateProtocolBgpPeers { - if obj.obj.Peers == nil { - obj.setChoice(StateProtocolBgpChoice.PEERS) - } - if obj.peersHolder == nil { - obj.peersHolder = &stateProtocolBgpPeers{obj: obj.obj.Peers} - } - return obj.peersHolder -} - -// description is TBD -// Peers returns a StateProtocolBgpPeers -func (obj *stateProtocolBgp) HasPeers() bool { - return obj.obj.Peers != nil -} - -// description is TBD -// SetPeers sets the StateProtocolBgpPeers value in the StateProtocolBgp object -func (obj *stateProtocolBgp) SetPeers(value StateProtocolBgpPeers) StateProtocolBgp { - obj.setChoice(StateProtocolBgpChoice.PEERS) - obj.peersHolder = nil - obj.obj.Peers = value.msg() - - return obj -} - -func (obj *stateProtocolBgp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface StateProtocolBgp") - } - - if obj.obj.Peers != nil { - - obj.Peers().validateObj(vObj, set_default) - } - -} - -func (obj *stateProtocolBgp) setDefault() { - var choices_set int = 0 - var choice StateProtocolBgpChoiceEnum - - if obj.obj.Peers != nil { - choices_set += 1 - choice = StateProtocolBgpChoice.PEERS - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StateProtocolBgp") - } - } else { - intVal := otg.StateProtocolBgp_Choice_Enum_value[string(choice)] - enumValue := otg.StateProtocolBgp_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** StateProtocolIsis ***** -type stateProtocolIsis struct { - validation - obj *otg.StateProtocolIsis - marshaller marshalStateProtocolIsis - unMarshaller unMarshalStateProtocolIsis - routersHolder StateProtocolIsisRouters -} - -func NewStateProtocolIsis() StateProtocolIsis { - obj := stateProtocolIsis{obj: &otg.StateProtocolIsis{}} - obj.setDefault() - return &obj -} - -func (obj *stateProtocolIsis) msg() *otg.StateProtocolIsis { - return obj.obj -} - -func (obj *stateProtocolIsis) setMsg(msg *otg.StateProtocolIsis) StateProtocolIsis { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstateProtocolIsis struct { - obj *stateProtocolIsis -} - -type marshalStateProtocolIsis interface { - // ToProto marshals StateProtocolIsis to protobuf object *otg.StateProtocolIsis - ToProto() (*otg.StateProtocolIsis, error) - // ToPbText marshals StateProtocolIsis to protobuf text - ToPbText() (string, error) - // ToYaml marshals StateProtocolIsis to YAML text - ToYaml() (string, error) - // ToJson marshals StateProtocolIsis to JSON text - ToJson() (string, error) -} - -type unMarshalstateProtocolIsis struct { - obj *stateProtocolIsis -} - -type unMarshalStateProtocolIsis interface { - // FromProto unmarshals StateProtocolIsis from protobuf object *otg.StateProtocolIsis - FromProto(msg *otg.StateProtocolIsis) (StateProtocolIsis, error) - // FromPbText unmarshals StateProtocolIsis from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StateProtocolIsis from YAML text - FromYaml(value string) error - // FromJson unmarshals StateProtocolIsis from JSON text - FromJson(value string) error -} - -func (obj *stateProtocolIsis) Marshal() marshalStateProtocolIsis { - if obj.marshaller == nil { - obj.marshaller = &marshalstateProtocolIsis{obj: obj} - } - return obj.marshaller -} - -func (obj *stateProtocolIsis) Unmarshal() unMarshalStateProtocolIsis { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstateProtocolIsis{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstateProtocolIsis) ToProto() (*otg.StateProtocolIsis, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstateProtocolIsis) FromProto(msg *otg.StateProtocolIsis) (StateProtocolIsis, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstateProtocolIsis) 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 *unMarshalstateProtocolIsis) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalstateProtocolIsis) 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 *unMarshalstateProtocolIsis) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalstateProtocolIsis) 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 *unMarshalstateProtocolIsis) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *stateProtocolIsis) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *stateProtocolIsis) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *stateProtocolIsis) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *stateProtocolIsis) Clone() (StateProtocolIsis, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStateProtocolIsis() - 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 -} - -func (obj *stateProtocolIsis) setNil() { - obj.routersHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// StateProtocolIsis is sets state of configured ISIS routers. -type StateProtocolIsis interface { - Validation - // msg marshals StateProtocolIsis to protobuf object *otg.StateProtocolIsis - // and doesn't set defaults - msg() *otg.StateProtocolIsis - // setMsg unmarshals StateProtocolIsis from protobuf object *otg.StateProtocolIsis - // and doesn't set defaults - setMsg(*otg.StateProtocolIsis) StateProtocolIsis - // provides marshal interface - Marshal() marshalStateProtocolIsis - // provides unmarshal interface - Unmarshal() unMarshalStateProtocolIsis - // validate validates StateProtocolIsis - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StateProtocolIsis, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns StateProtocolIsisChoiceEnum, set in StateProtocolIsis - Choice() StateProtocolIsisChoiceEnum - // setChoice assigns StateProtocolIsisChoiceEnum provided by user to StateProtocolIsis - setChoice(value StateProtocolIsisChoiceEnum) StateProtocolIsis - // Routers returns StateProtocolIsisRouters, set in StateProtocolIsis. - // StateProtocolIsisRouters is sets state of configured ISIS routers. - Routers() StateProtocolIsisRouters - // SetRouters assigns StateProtocolIsisRouters provided by user to StateProtocolIsis. - // StateProtocolIsisRouters is sets state of configured ISIS routers. - SetRouters(value StateProtocolIsisRouters) StateProtocolIsis - // HasRouters checks if Routers has been set in StateProtocolIsis - HasRouters() bool - setNil() -} - -type StateProtocolIsisChoiceEnum string - -// Enum of Choice on StateProtocolIsis -var StateProtocolIsisChoice = struct { - ROUTERS StateProtocolIsisChoiceEnum -}{ - ROUTERS: StateProtocolIsisChoiceEnum("routers"), -} - -func (obj *stateProtocolIsis) Choice() StateProtocolIsisChoiceEnum { - return StateProtocolIsisChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *stateProtocolIsis) setChoice(value StateProtocolIsisChoiceEnum) StateProtocolIsis { - intValue, ok := otg.StateProtocolIsis_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StateProtocolIsisChoiceEnum", string(value))) - return obj - } - enumValue := otg.StateProtocolIsis_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Routers = nil - obj.routersHolder = nil - - if value == StateProtocolIsisChoice.ROUTERS { - obj.obj.Routers = NewStateProtocolIsisRouters().msg() - } - - return obj -} - -// description is TBD -// Routers returns a StateProtocolIsisRouters -func (obj *stateProtocolIsis) Routers() StateProtocolIsisRouters { - if obj.obj.Routers == nil { - obj.setChoice(StateProtocolIsisChoice.ROUTERS) - } - if obj.routersHolder == nil { - obj.routersHolder = &stateProtocolIsisRouters{obj: obj.obj.Routers} - } - return obj.routersHolder -} - -// description is TBD -// Routers returns a StateProtocolIsisRouters -func (obj *stateProtocolIsis) HasRouters() bool { - return obj.obj.Routers != nil -} - -// description is TBD -// SetRouters sets the StateProtocolIsisRouters value in the StateProtocolIsis object -func (obj *stateProtocolIsis) SetRouters(value StateProtocolIsisRouters) StateProtocolIsis { - obj.setChoice(StateProtocolIsisChoice.ROUTERS) - obj.routersHolder = nil - obj.obj.Routers = value.msg() - - return obj -} - -func (obj *stateProtocolIsis) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface StateProtocolIsis") - } - - if obj.obj.Routers != nil { - - obj.Routers().validateObj(vObj, set_default) - } - -} - -func (obj *stateProtocolIsis) setDefault() { - var choices_set int = 0 - var choice StateProtocolIsisChoiceEnum - - if obj.obj.Routers != nil { - choices_set += 1 - choice = StateProtocolIsisChoice.ROUTERS - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StateProtocolIsis") - } - } else { - intVal := otg.StateProtocolIsis_Choice_Enum_value[string(choice)] - enumValue := otg.StateProtocolIsis_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** StateTrafficFlowTransmit ***** -type stateTrafficFlowTransmit struct { - validation - obj *otg.StateTrafficFlowTransmit - marshaller marshalStateTrafficFlowTransmit - unMarshaller unMarshalStateTrafficFlowTransmit -} - -func NewStateTrafficFlowTransmit() StateTrafficFlowTransmit { - obj := stateTrafficFlowTransmit{obj: &otg.StateTrafficFlowTransmit{}} - obj.setDefault() - return &obj -} - -func (obj *stateTrafficFlowTransmit) msg() *otg.StateTrafficFlowTransmit { - return obj.obj -} - -func (obj *stateTrafficFlowTransmit) setMsg(msg *otg.StateTrafficFlowTransmit) StateTrafficFlowTransmit { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstateTrafficFlowTransmit struct { - obj *stateTrafficFlowTransmit -} - -type marshalStateTrafficFlowTransmit interface { - // ToProto marshals StateTrafficFlowTransmit to protobuf object *otg.StateTrafficFlowTransmit - ToProto() (*otg.StateTrafficFlowTransmit, error) - // ToPbText marshals StateTrafficFlowTransmit to protobuf text - ToPbText() (string, error) - // ToYaml marshals StateTrafficFlowTransmit to YAML text - ToYaml() (string, error) - // ToJson marshals StateTrafficFlowTransmit to JSON text - ToJson() (string, error) -} - -type unMarshalstateTrafficFlowTransmit struct { - obj *stateTrafficFlowTransmit -} - -type unMarshalStateTrafficFlowTransmit interface { - // FromProto unmarshals StateTrafficFlowTransmit from protobuf object *otg.StateTrafficFlowTransmit - FromProto(msg *otg.StateTrafficFlowTransmit) (StateTrafficFlowTransmit, error) - // FromPbText unmarshals StateTrafficFlowTransmit from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StateTrafficFlowTransmit from YAML text - FromYaml(value string) error - // FromJson unmarshals StateTrafficFlowTransmit from JSON text - FromJson(value string) error -} - -func (obj *stateTrafficFlowTransmit) Marshal() marshalStateTrafficFlowTransmit { - if obj.marshaller == nil { - obj.marshaller = &marshalstateTrafficFlowTransmit{obj: obj} - } - return obj.marshaller -} - -func (obj *stateTrafficFlowTransmit) Unmarshal() unMarshalStateTrafficFlowTransmit { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstateTrafficFlowTransmit{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstateTrafficFlowTransmit) ToProto() (*otg.StateTrafficFlowTransmit, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstateTrafficFlowTransmit) FromProto(msg *otg.StateTrafficFlowTransmit) (StateTrafficFlowTransmit, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstateTrafficFlowTransmit) 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 *unMarshalstateTrafficFlowTransmit) 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 *marshalstateTrafficFlowTransmit) 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 *unMarshalstateTrafficFlowTransmit) 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 *marshalstateTrafficFlowTransmit) 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 *unMarshalstateTrafficFlowTransmit) 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 *stateTrafficFlowTransmit) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *stateTrafficFlowTransmit) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *stateTrafficFlowTransmit) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *stateTrafficFlowTransmit) Clone() (StateTrafficFlowTransmit, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStateTrafficFlowTransmit() - 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 -} - -// StateTrafficFlowTransmit is provides state control of flow transmission. -type StateTrafficFlowTransmit interface { - Validation - // msg marshals StateTrafficFlowTransmit to protobuf object *otg.StateTrafficFlowTransmit - // and doesn't set defaults - msg() *otg.StateTrafficFlowTransmit - // setMsg unmarshals StateTrafficFlowTransmit from protobuf object *otg.StateTrafficFlowTransmit - // and doesn't set defaults - setMsg(*otg.StateTrafficFlowTransmit) StateTrafficFlowTransmit - // provides marshal interface - Marshal() marshalStateTrafficFlowTransmit - // provides unmarshal interface - Unmarshal() unMarshalStateTrafficFlowTransmit - // validate validates StateTrafficFlowTransmit - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StateTrafficFlowTransmit, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // FlowNames returns []string, set in StateTrafficFlowTransmit. - FlowNames() []string - // SetFlowNames assigns []string provided by user to StateTrafficFlowTransmit - SetFlowNames(value []string) StateTrafficFlowTransmit - // State returns StateTrafficFlowTransmitStateEnum, set in StateTrafficFlowTransmit - State() StateTrafficFlowTransmitStateEnum - // SetState assigns StateTrafficFlowTransmitStateEnum provided by user to StateTrafficFlowTransmit - SetState(value StateTrafficFlowTransmitStateEnum) StateTrafficFlowTransmit -} - -// The names of flows to which the transmit state will be applied to. If the list of flow_names is empty or null the state will be applied to all configured flows. -// If the list is not empty any flow that is not included in the list of flow_names MUST be ignored and not included in the state change. -// -// x-constraint: -// - /components/schemas/Flow/properties/name -// -// x-constraint: -// - /components/schemas/Flow/properties/name -// -// FlowNames returns a []string -func (obj *stateTrafficFlowTransmit) FlowNames() []string { - if obj.obj.FlowNames == nil { - obj.obj.FlowNames = make([]string, 0) - } - return obj.obj.FlowNames -} - -// The names of flows to which the transmit state will be applied to. If the list of flow_names is empty or null the state will be applied to all configured flows. -// If the list is not empty any flow that is not included in the list of flow_names MUST be ignored and not included in the state change. -// -// x-constraint: -// - /components/schemas/Flow/properties/name -// -// x-constraint: -// - /components/schemas/Flow/properties/name -// -// SetFlowNames sets the []string value in the StateTrafficFlowTransmit object -func (obj *stateTrafficFlowTransmit) SetFlowNames(value []string) StateTrafficFlowTransmit { - - if obj.obj.FlowNames == nil { - obj.obj.FlowNames = make([]string, 0) - } - obj.obj.FlowNames = value - - return obj -} - -type StateTrafficFlowTransmitStateEnum string - -// Enum of State on StateTrafficFlowTransmit -var StateTrafficFlowTransmitState = struct { - START StateTrafficFlowTransmitStateEnum - STOP StateTrafficFlowTransmitStateEnum - PAUSE StateTrafficFlowTransmitStateEnum - RESUME StateTrafficFlowTransmitStateEnum -}{ - START: StateTrafficFlowTransmitStateEnum("start"), - STOP: StateTrafficFlowTransmitStateEnum("stop"), - PAUSE: StateTrafficFlowTransmitStateEnum("pause"), - RESUME: StateTrafficFlowTransmitStateEnum("resume"), -} - -func (obj *stateTrafficFlowTransmit) State() StateTrafficFlowTransmitStateEnum { - return StateTrafficFlowTransmitStateEnum(obj.obj.State.Enum().String()) -} - -func (obj *stateTrafficFlowTransmit) SetState(value StateTrafficFlowTransmitStateEnum) StateTrafficFlowTransmit { - intValue, ok := otg.StateTrafficFlowTransmit_State_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StateTrafficFlowTransmitStateEnum", string(value))) - return obj - } - enumValue := otg.StateTrafficFlowTransmit_State_Enum(intValue) - obj.obj.State = &enumValue - - return obj -} - -func (obj *stateTrafficFlowTransmit) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // State is required - if obj.obj.State == nil { - vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StateTrafficFlowTransmit") - } -} - -func (obj *stateTrafficFlowTransmit) setDefault() { - -} - -// ***** ActionProtocolIpv4 ***** -type actionProtocolIpv4 struct { - validation - obj *otg.ActionProtocolIpv4 - marshaller marshalActionProtocolIpv4 - unMarshaller unMarshalActionProtocolIpv4 - pingHolder ActionProtocolIpv4Ping -} - -func NewActionProtocolIpv4() ActionProtocolIpv4 { - obj := actionProtocolIpv4{obj: &otg.ActionProtocolIpv4{}} - obj.setDefault() - return &obj -} - -func (obj *actionProtocolIpv4) msg() *otg.ActionProtocolIpv4 { - return obj.obj -} - -func (obj *actionProtocolIpv4) setMsg(msg *otg.ActionProtocolIpv4) ActionProtocolIpv4 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionProtocolIpv4 struct { - obj *actionProtocolIpv4 -} - -type marshalActionProtocolIpv4 interface { - // ToProto marshals ActionProtocolIpv4 to protobuf object *otg.ActionProtocolIpv4 - ToProto() (*otg.ActionProtocolIpv4, error) - // ToPbText marshals ActionProtocolIpv4 to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionProtocolIpv4 to YAML text - ToYaml() (string, error) - // ToJson marshals ActionProtocolIpv4 to JSON text - ToJson() (string, error) -} - -type unMarshalactionProtocolIpv4 struct { - obj *actionProtocolIpv4 -} - -type unMarshalActionProtocolIpv4 interface { - // FromProto unmarshals ActionProtocolIpv4 from protobuf object *otg.ActionProtocolIpv4 - FromProto(msg *otg.ActionProtocolIpv4) (ActionProtocolIpv4, error) - // FromPbText unmarshals ActionProtocolIpv4 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionProtocolIpv4 from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionProtocolIpv4 from JSON text - FromJson(value string) error -} - -func (obj *actionProtocolIpv4) Marshal() marshalActionProtocolIpv4 { - if obj.marshaller == nil { - obj.marshaller = &marshalactionProtocolIpv4{obj: obj} - } - return obj.marshaller -} - -func (obj *actionProtocolIpv4) Unmarshal() unMarshalActionProtocolIpv4 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionProtocolIpv4{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionProtocolIpv4) ToProto() (*otg.ActionProtocolIpv4, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionProtocolIpv4) FromProto(msg *otg.ActionProtocolIpv4) (ActionProtocolIpv4, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionProtocolIpv4) 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 *unMarshalactionProtocolIpv4) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalactionProtocolIpv4) 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 *unMarshalactionProtocolIpv4) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalactionProtocolIpv4) 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 *unMarshalactionProtocolIpv4) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *actionProtocolIpv4) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionProtocolIpv4) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionProtocolIpv4) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionProtocolIpv4) Clone() (ActionProtocolIpv4, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionProtocolIpv4() - 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 -} - -func (obj *actionProtocolIpv4) setNil() { - obj.pingHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ActionProtocolIpv4 is actions associated with IPv4 on configured resources. -type ActionProtocolIpv4 interface { - Validation - // msg marshals ActionProtocolIpv4 to protobuf object *otg.ActionProtocolIpv4 - // and doesn't set defaults - msg() *otg.ActionProtocolIpv4 - // setMsg unmarshals ActionProtocolIpv4 from protobuf object *otg.ActionProtocolIpv4 - // and doesn't set defaults - setMsg(*otg.ActionProtocolIpv4) ActionProtocolIpv4 - // provides marshal interface - Marshal() marshalActionProtocolIpv4 - // provides unmarshal interface - Unmarshal() unMarshalActionProtocolIpv4 - // validate validates ActionProtocolIpv4 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionProtocolIpv4, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ActionProtocolIpv4ChoiceEnum, set in ActionProtocolIpv4 - Choice() ActionProtocolIpv4ChoiceEnum - // setChoice assigns ActionProtocolIpv4ChoiceEnum provided by user to ActionProtocolIpv4 - setChoice(value ActionProtocolIpv4ChoiceEnum) ActionProtocolIpv4 - // Ping returns ActionProtocolIpv4Ping, set in ActionProtocolIpv4. - // ActionProtocolIpv4Ping is request for initiating ping between multiple source and destination pairs. - Ping() ActionProtocolIpv4Ping - // SetPing assigns ActionProtocolIpv4Ping provided by user to ActionProtocolIpv4. - // ActionProtocolIpv4Ping is request for initiating ping between multiple source and destination pairs. - SetPing(value ActionProtocolIpv4Ping) ActionProtocolIpv4 - // HasPing checks if Ping has been set in ActionProtocolIpv4 - HasPing() bool - setNil() -} - -type ActionProtocolIpv4ChoiceEnum string - -// Enum of Choice on ActionProtocolIpv4 -var ActionProtocolIpv4Choice = struct { - PING ActionProtocolIpv4ChoiceEnum -}{ - PING: ActionProtocolIpv4ChoiceEnum("ping"), -} - -func (obj *actionProtocolIpv4) Choice() ActionProtocolIpv4ChoiceEnum { - return ActionProtocolIpv4ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *actionProtocolIpv4) setChoice(value ActionProtocolIpv4ChoiceEnum) ActionProtocolIpv4 { - intValue, ok := otg.ActionProtocolIpv4_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ActionProtocolIpv4ChoiceEnum", string(value))) - return obj - } - enumValue := otg.ActionProtocolIpv4_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Ping = nil - obj.pingHolder = nil - - if value == ActionProtocolIpv4Choice.PING { - obj.obj.Ping = NewActionProtocolIpv4Ping().msg() - } - - return obj -} - -// description is TBD -// Ping returns a ActionProtocolIpv4Ping -func (obj *actionProtocolIpv4) Ping() ActionProtocolIpv4Ping { - if obj.obj.Ping == nil { - obj.setChoice(ActionProtocolIpv4Choice.PING) - } - if obj.pingHolder == nil { - obj.pingHolder = &actionProtocolIpv4Ping{obj: obj.obj.Ping} - } - return obj.pingHolder -} - -// description is TBD -// Ping returns a ActionProtocolIpv4Ping -func (obj *actionProtocolIpv4) HasPing() bool { - return obj.obj.Ping != nil -} - -// description is TBD -// SetPing sets the ActionProtocolIpv4Ping value in the ActionProtocolIpv4 object -func (obj *actionProtocolIpv4) SetPing(value ActionProtocolIpv4Ping) ActionProtocolIpv4 { - obj.setChoice(ActionProtocolIpv4Choice.PING) - obj.pingHolder = nil - obj.obj.Ping = value.msg() - - return obj -} - -func (obj *actionProtocolIpv4) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionProtocolIpv4") - } - - if obj.obj.Ping != nil { - - obj.Ping().validateObj(vObj, set_default) - } - -} - -func (obj *actionProtocolIpv4) setDefault() { - var choices_set int = 0 - var choice ActionProtocolIpv4ChoiceEnum - - if obj.obj.Ping != nil { - choices_set += 1 - choice = ActionProtocolIpv4Choice.PING - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionProtocolIpv4") - } - } else { - intVal := otg.ActionProtocolIpv4_Choice_Enum_value[string(choice)] - enumValue := otg.ActionProtocolIpv4_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** ActionProtocolIpv6 ***** -type actionProtocolIpv6 struct { - validation - obj *otg.ActionProtocolIpv6 - marshaller marshalActionProtocolIpv6 - unMarshaller unMarshalActionProtocolIpv6 - pingHolder ActionProtocolIpv6Ping -} - -func NewActionProtocolIpv6() ActionProtocolIpv6 { - obj := actionProtocolIpv6{obj: &otg.ActionProtocolIpv6{}} - obj.setDefault() - return &obj -} - -func (obj *actionProtocolIpv6) msg() *otg.ActionProtocolIpv6 { - return obj.obj -} - -func (obj *actionProtocolIpv6) setMsg(msg *otg.ActionProtocolIpv6) ActionProtocolIpv6 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionProtocolIpv6 struct { - obj *actionProtocolIpv6 -} - -type marshalActionProtocolIpv6 interface { - // ToProto marshals ActionProtocolIpv6 to protobuf object *otg.ActionProtocolIpv6 - ToProto() (*otg.ActionProtocolIpv6, error) - // ToPbText marshals ActionProtocolIpv6 to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionProtocolIpv6 to YAML text - ToYaml() (string, error) - // ToJson marshals ActionProtocolIpv6 to JSON text - ToJson() (string, error) -} - -type unMarshalactionProtocolIpv6 struct { - obj *actionProtocolIpv6 -} - -type unMarshalActionProtocolIpv6 interface { - // FromProto unmarshals ActionProtocolIpv6 from protobuf object *otg.ActionProtocolIpv6 - FromProto(msg *otg.ActionProtocolIpv6) (ActionProtocolIpv6, error) - // FromPbText unmarshals ActionProtocolIpv6 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionProtocolIpv6 from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionProtocolIpv6 from JSON text - FromJson(value string) error -} - -func (obj *actionProtocolIpv6) Marshal() marshalActionProtocolIpv6 { - if obj.marshaller == nil { - obj.marshaller = &marshalactionProtocolIpv6{obj: obj} - } - return obj.marshaller -} - -func (obj *actionProtocolIpv6) Unmarshal() unMarshalActionProtocolIpv6 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionProtocolIpv6{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionProtocolIpv6) ToProto() (*otg.ActionProtocolIpv6, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionProtocolIpv6) FromProto(msg *otg.ActionProtocolIpv6) (ActionProtocolIpv6, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionProtocolIpv6) 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 *unMarshalactionProtocolIpv6) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalactionProtocolIpv6) 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 *unMarshalactionProtocolIpv6) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalactionProtocolIpv6) 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 *unMarshalactionProtocolIpv6) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *actionProtocolIpv6) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionProtocolIpv6) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionProtocolIpv6) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionProtocolIpv6) Clone() (ActionProtocolIpv6, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionProtocolIpv6() - 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 -} - -func (obj *actionProtocolIpv6) setNil() { - obj.pingHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ActionProtocolIpv6 is actions associated with IPv6 on configured resources. -type ActionProtocolIpv6 interface { - Validation - // msg marshals ActionProtocolIpv6 to protobuf object *otg.ActionProtocolIpv6 - // and doesn't set defaults - msg() *otg.ActionProtocolIpv6 - // setMsg unmarshals ActionProtocolIpv6 from protobuf object *otg.ActionProtocolIpv6 - // and doesn't set defaults - setMsg(*otg.ActionProtocolIpv6) ActionProtocolIpv6 - // provides marshal interface - Marshal() marshalActionProtocolIpv6 - // provides unmarshal interface - Unmarshal() unMarshalActionProtocolIpv6 - // validate validates ActionProtocolIpv6 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionProtocolIpv6, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ActionProtocolIpv6ChoiceEnum, set in ActionProtocolIpv6 - Choice() ActionProtocolIpv6ChoiceEnum - // setChoice assigns ActionProtocolIpv6ChoiceEnum provided by user to ActionProtocolIpv6 - setChoice(value ActionProtocolIpv6ChoiceEnum) ActionProtocolIpv6 - // Ping returns ActionProtocolIpv6Ping, set in ActionProtocolIpv6. - // ActionProtocolIpv6Ping is request for initiating ping between multiple source and destination pairs. - Ping() ActionProtocolIpv6Ping - // SetPing assigns ActionProtocolIpv6Ping provided by user to ActionProtocolIpv6. - // ActionProtocolIpv6Ping is request for initiating ping between multiple source and destination pairs. - SetPing(value ActionProtocolIpv6Ping) ActionProtocolIpv6 - // HasPing checks if Ping has been set in ActionProtocolIpv6 - HasPing() bool - setNil() -} - -type ActionProtocolIpv6ChoiceEnum string - -// Enum of Choice on ActionProtocolIpv6 -var ActionProtocolIpv6Choice = struct { - PING ActionProtocolIpv6ChoiceEnum -}{ - PING: ActionProtocolIpv6ChoiceEnum("ping"), -} - -func (obj *actionProtocolIpv6) Choice() ActionProtocolIpv6ChoiceEnum { - return ActionProtocolIpv6ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *actionProtocolIpv6) setChoice(value ActionProtocolIpv6ChoiceEnum) ActionProtocolIpv6 { - intValue, ok := otg.ActionProtocolIpv6_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ActionProtocolIpv6ChoiceEnum", string(value))) - return obj - } - enumValue := otg.ActionProtocolIpv6_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Ping = nil - obj.pingHolder = nil - - if value == ActionProtocolIpv6Choice.PING { - obj.obj.Ping = NewActionProtocolIpv6Ping().msg() - } - - return obj -} - -// description is TBD -// Ping returns a ActionProtocolIpv6Ping -func (obj *actionProtocolIpv6) Ping() ActionProtocolIpv6Ping { - if obj.obj.Ping == nil { - obj.setChoice(ActionProtocolIpv6Choice.PING) - } - if obj.pingHolder == nil { - obj.pingHolder = &actionProtocolIpv6Ping{obj: obj.obj.Ping} - } - return obj.pingHolder -} - -// description is TBD -// Ping returns a ActionProtocolIpv6Ping -func (obj *actionProtocolIpv6) HasPing() bool { - return obj.obj.Ping != nil -} - -// description is TBD -// SetPing sets the ActionProtocolIpv6Ping value in the ActionProtocolIpv6 object -func (obj *actionProtocolIpv6) SetPing(value ActionProtocolIpv6Ping) ActionProtocolIpv6 { - obj.setChoice(ActionProtocolIpv6Choice.PING) - obj.pingHolder = nil - obj.obj.Ping = value.msg() - - return obj -} - -func (obj *actionProtocolIpv6) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionProtocolIpv6") - } - - if obj.obj.Ping != nil { - - obj.Ping().validateObj(vObj, set_default) - } - -} - -func (obj *actionProtocolIpv6) setDefault() { - var choices_set int = 0 - var choice ActionProtocolIpv6ChoiceEnum - - if obj.obj.Ping != nil { - choices_set += 1 - choice = ActionProtocolIpv6Choice.PING - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionProtocolIpv6") - } - } else { - intVal := otg.ActionProtocolIpv6_Choice_Enum_value[string(choice)] - enumValue := otg.ActionProtocolIpv6_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** ActionProtocolBgp ***** -type actionProtocolBgp struct { - validation - obj *otg.ActionProtocolBgp - marshaller marshalActionProtocolBgp - unMarshaller unMarshalActionProtocolBgp - notificationHolder ActionProtocolBgpNotification - initiateGracefulRestartHolder ActionProtocolBgpInitiateGracefulRestart -} - -func NewActionProtocolBgp() ActionProtocolBgp { - obj := actionProtocolBgp{obj: &otg.ActionProtocolBgp{}} - obj.setDefault() - return &obj -} - -func (obj *actionProtocolBgp) msg() *otg.ActionProtocolBgp { - return obj.obj -} - -func (obj *actionProtocolBgp) setMsg(msg *otg.ActionProtocolBgp) ActionProtocolBgp { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionProtocolBgp struct { - obj *actionProtocolBgp -} - -type marshalActionProtocolBgp interface { - // ToProto marshals ActionProtocolBgp to protobuf object *otg.ActionProtocolBgp - ToProto() (*otg.ActionProtocolBgp, error) - // ToPbText marshals ActionProtocolBgp to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionProtocolBgp to YAML text - ToYaml() (string, error) - // ToJson marshals ActionProtocolBgp to JSON text - ToJson() (string, error) -} - -type unMarshalactionProtocolBgp struct { - obj *actionProtocolBgp -} - -type unMarshalActionProtocolBgp interface { - // FromProto unmarshals ActionProtocolBgp from protobuf object *otg.ActionProtocolBgp - FromProto(msg *otg.ActionProtocolBgp) (ActionProtocolBgp, error) - // FromPbText unmarshals ActionProtocolBgp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionProtocolBgp from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionProtocolBgp from JSON text - FromJson(value string) error -} - -func (obj *actionProtocolBgp) Marshal() marshalActionProtocolBgp { - if obj.marshaller == nil { - obj.marshaller = &marshalactionProtocolBgp{obj: obj} - } - return obj.marshaller -} - -func (obj *actionProtocolBgp) Unmarshal() unMarshalActionProtocolBgp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionProtocolBgp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionProtocolBgp) ToProto() (*otg.ActionProtocolBgp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionProtocolBgp) FromProto(msg *otg.ActionProtocolBgp) (ActionProtocolBgp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionProtocolBgp) 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 *unMarshalactionProtocolBgp) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalactionProtocolBgp) 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 *unMarshalactionProtocolBgp) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalactionProtocolBgp) 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 *unMarshalactionProtocolBgp) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *actionProtocolBgp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionProtocolBgp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionProtocolBgp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionProtocolBgp) Clone() (ActionProtocolBgp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionProtocolBgp() - 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 -} - -func (obj *actionProtocolBgp) setNil() { - obj.notificationHolder = nil - obj.initiateGracefulRestartHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ActionProtocolBgp is actions associated with BGP on configured resources. -type ActionProtocolBgp interface { - Validation - // msg marshals ActionProtocolBgp to protobuf object *otg.ActionProtocolBgp - // and doesn't set defaults - msg() *otg.ActionProtocolBgp - // setMsg unmarshals ActionProtocolBgp from protobuf object *otg.ActionProtocolBgp - // and doesn't set defaults - setMsg(*otg.ActionProtocolBgp) ActionProtocolBgp - // provides marshal interface - Marshal() marshalActionProtocolBgp - // provides unmarshal interface - Unmarshal() unMarshalActionProtocolBgp - // validate validates ActionProtocolBgp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionProtocolBgp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ActionProtocolBgpChoiceEnum, set in ActionProtocolBgp - Choice() ActionProtocolBgpChoiceEnum - // setChoice assigns ActionProtocolBgpChoiceEnum provided by user to ActionProtocolBgp - setChoice(value ActionProtocolBgpChoiceEnum) ActionProtocolBgp - // Notification returns ActionProtocolBgpNotification, set in ActionProtocolBgp. - // ActionProtocolBgpNotification is a NOTIFICATION message is sent when an error is detected with the BGP session, such as hold timer expiring, misconfigured AS number or a BGP session reset is requested. This causes the BGP connection to close. Send explicit NOTIFICATIONs for list of specified BGP peers. If a user wants to send custom Error Code and Error Subcode the custom object should be configured. A user can send IANA defined BGP NOTIFICATIONs according to https://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml. - Notification() ActionProtocolBgpNotification - // SetNotification assigns ActionProtocolBgpNotification provided by user to ActionProtocolBgp. - // ActionProtocolBgpNotification is a NOTIFICATION message is sent when an error is detected with the BGP session, such as hold timer expiring, misconfigured AS number or a BGP session reset is requested. This causes the BGP connection to close. Send explicit NOTIFICATIONs for list of specified BGP peers. If a user wants to send custom Error Code and Error Subcode the custom object should be configured. A user can send IANA defined BGP NOTIFICATIONs according to https://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml. - SetNotification(value ActionProtocolBgpNotification) ActionProtocolBgp - // HasNotification checks if Notification has been set in ActionProtocolBgp - HasNotification() bool - // InitiateGracefulRestart returns ActionProtocolBgpInitiateGracefulRestart, set in ActionProtocolBgp. - // ActionProtocolBgpInitiateGracefulRestart is initiates BGP Graceful Restart process for the selected BGP peers. If no name is specified then Graceful Restart will be sent to all configured BGP peers. - InitiateGracefulRestart() ActionProtocolBgpInitiateGracefulRestart - // SetInitiateGracefulRestart assigns ActionProtocolBgpInitiateGracefulRestart provided by user to ActionProtocolBgp. - // ActionProtocolBgpInitiateGracefulRestart is initiates BGP Graceful Restart process for the selected BGP peers. If no name is specified then Graceful Restart will be sent to all configured BGP peers. - SetInitiateGracefulRestart(value ActionProtocolBgpInitiateGracefulRestart) ActionProtocolBgp - // HasInitiateGracefulRestart checks if InitiateGracefulRestart has been set in ActionProtocolBgp - HasInitiateGracefulRestart() bool - setNil() -} - -type ActionProtocolBgpChoiceEnum string - -// Enum of Choice on ActionProtocolBgp -var ActionProtocolBgpChoice = struct { - NOTIFICATION ActionProtocolBgpChoiceEnum - INITIATE_GRACEFUL_RESTART ActionProtocolBgpChoiceEnum -}{ - NOTIFICATION: ActionProtocolBgpChoiceEnum("notification"), - INITIATE_GRACEFUL_RESTART: ActionProtocolBgpChoiceEnum("initiate_graceful_restart"), -} - -func (obj *actionProtocolBgp) Choice() ActionProtocolBgpChoiceEnum { - return ActionProtocolBgpChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *actionProtocolBgp) setChoice(value ActionProtocolBgpChoiceEnum) ActionProtocolBgp { - intValue, ok := otg.ActionProtocolBgp_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ActionProtocolBgpChoiceEnum", string(value))) - return obj - } - enumValue := otg.ActionProtocolBgp_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.InitiateGracefulRestart = nil - obj.initiateGracefulRestartHolder = nil - obj.obj.Notification = nil - obj.notificationHolder = nil - - if value == ActionProtocolBgpChoice.NOTIFICATION { - obj.obj.Notification = NewActionProtocolBgpNotification().msg() - } - - if value == ActionProtocolBgpChoice.INITIATE_GRACEFUL_RESTART { - obj.obj.InitiateGracefulRestart = NewActionProtocolBgpInitiateGracefulRestart().msg() - } - - return obj -} - -// description is TBD -// Notification returns a ActionProtocolBgpNotification -func (obj *actionProtocolBgp) Notification() ActionProtocolBgpNotification { - if obj.obj.Notification == nil { - obj.setChoice(ActionProtocolBgpChoice.NOTIFICATION) - } - if obj.notificationHolder == nil { - obj.notificationHolder = &actionProtocolBgpNotification{obj: obj.obj.Notification} - } - return obj.notificationHolder -} - -// description is TBD -// Notification returns a ActionProtocolBgpNotification -func (obj *actionProtocolBgp) HasNotification() bool { - return obj.obj.Notification != nil -} - -// description is TBD -// SetNotification sets the ActionProtocolBgpNotification value in the ActionProtocolBgp object -func (obj *actionProtocolBgp) SetNotification(value ActionProtocolBgpNotification) ActionProtocolBgp { - obj.setChoice(ActionProtocolBgpChoice.NOTIFICATION) - obj.notificationHolder = nil - obj.obj.Notification = value.msg() - - return obj -} - -// description is TBD -// InitiateGracefulRestart returns a ActionProtocolBgpInitiateGracefulRestart -func (obj *actionProtocolBgp) InitiateGracefulRestart() ActionProtocolBgpInitiateGracefulRestart { - if obj.obj.InitiateGracefulRestart == nil { - obj.setChoice(ActionProtocolBgpChoice.INITIATE_GRACEFUL_RESTART) - } - if obj.initiateGracefulRestartHolder == nil { - obj.initiateGracefulRestartHolder = &actionProtocolBgpInitiateGracefulRestart{obj: obj.obj.InitiateGracefulRestart} - } - return obj.initiateGracefulRestartHolder -} - -// description is TBD -// InitiateGracefulRestart returns a ActionProtocolBgpInitiateGracefulRestart -func (obj *actionProtocolBgp) HasInitiateGracefulRestart() bool { - return obj.obj.InitiateGracefulRestart != nil -} - -// description is TBD -// SetInitiateGracefulRestart sets the ActionProtocolBgpInitiateGracefulRestart value in the ActionProtocolBgp object -func (obj *actionProtocolBgp) SetInitiateGracefulRestart(value ActionProtocolBgpInitiateGracefulRestart) ActionProtocolBgp { - obj.setChoice(ActionProtocolBgpChoice.INITIATE_GRACEFUL_RESTART) - obj.initiateGracefulRestartHolder = nil - obj.obj.InitiateGracefulRestart = value.msg() - - return obj -} - -func (obj *actionProtocolBgp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionProtocolBgp") - } - - if obj.obj.Notification != nil { - - obj.Notification().validateObj(vObj, set_default) - } - - if obj.obj.InitiateGracefulRestart != nil { - - obj.InitiateGracefulRestart().validateObj(vObj, set_default) - } - -} - -func (obj *actionProtocolBgp) setDefault() { - var choices_set int = 0 - var choice ActionProtocolBgpChoiceEnum - - if obj.obj.Notification != nil { - choices_set += 1 - choice = ActionProtocolBgpChoice.NOTIFICATION - } - - if obj.obj.InitiateGracefulRestart != nil { - choices_set += 1 - choice = ActionProtocolBgpChoice.INITIATE_GRACEFUL_RESTART - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionProtocolBgp") - } - } else { - intVal := otg.ActionProtocolBgp_Choice_Enum_value[string(choice)] - enumValue := otg.ActionProtocolBgp_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowTaggedMetricsFilter ***** -type flowTaggedMetricsFilter struct { - validation - obj *otg.FlowTaggedMetricsFilter - marshaller marshalFlowTaggedMetricsFilter - unMarshaller unMarshalFlowTaggedMetricsFilter - filtersHolder FlowTaggedMetricsFilterFlowMetricTagFilterIter -} - -func NewFlowTaggedMetricsFilter() FlowTaggedMetricsFilter { - obj := flowTaggedMetricsFilter{obj: &otg.FlowTaggedMetricsFilter{}} - obj.setDefault() - return &obj -} - -func (obj *flowTaggedMetricsFilter) msg() *otg.FlowTaggedMetricsFilter { - return obj.obj -} - -func (obj *flowTaggedMetricsFilter) setMsg(msg *otg.FlowTaggedMetricsFilter) FlowTaggedMetricsFilter { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowTaggedMetricsFilter struct { - obj *flowTaggedMetricsFilter -} - -type marshalFlowTaggedMetricsFilter interface { - // ToProto marshals FlowTaggedMetricsFilter to protobuf object *otg.FlowTaggedMetricsFilter - ToProto() (*otg.FlowTaggedMetricsFilter, error) - // ToPbText marshals FlowTaggedMetricsFilter to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowTaggedMetricsFilter to YAML text - ToYaml() (string, error) - // ToJson marshals FlowTaggedMetricsFilter to JSON text - ToJson() (string, error) -} - -type unMarshalflowTaggedMetricsFilter struct { - obj *flowTaggedMetricsFilter -} - -type unMarshalFlowTaggedMetricsFilter interface { - // FromProto unmarshals FlowTaggedMetricsFilter from protobuf object *otg.FlowTaggedMetricsFilter - FromProto(msg *otg.FlowTaggedMetricsFilter) (FlowTaggedMetricsFilter, error) - // FromPbText unmarshals FlowTaggedMetricsFilter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowTaggedMetricsFilter from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowTaggedMetricsFilter from JSON text - FromJson(value string) error -} - -func (obj *flowTaggedMetricsFilter) Marshal() marshalFlowTaggedMetricsFilter { - if obj.marshaller == nil { - obj.marshaller = &marshalflowTaggedMetricsFilter{obj: obj} - } - return obj.marshaller -} - -func (obj *flowTaggedMetricsFilter) Unmarshal() unMarshalFlowTaggedMetricsFilter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowTaggedMetricsFilter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowTaggedMetricsFilter) ToProto() (*otg.FlowTaggedMetricsFilter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowTaggedMetricsFilter) FromProto(msg *otg.FlowTaggedMetricsFilter) (FlowTaggedMetricsFilter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowTaggedMetricsFilter) 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 *unMarshalflowTaggedMetricsFilter) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowTaggedMetricsFilter) 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 *unMarshalflowTaggedMetricsFilter) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowTaggedMetricsFilter) 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 *unMarshalflowTaggedMetricsFilter) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowTaggedMetricsFilter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowTaggedMetricsFilter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowTaggedMetricsFilter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowTaggedMetricsFilter) Clone() (FlowTaggedMetricsFilter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowTaggedMetricsFilter() - 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 -} - -func (obj *flowTaggedMetricsFilter) setNil() { - obj.filtersHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowTaggedMetricsFilter is filter for tagged metrics -type FlowTaggedMetricsFilter interface { - Validation - // msg marshals FlowTaggedMetricsFilter to protobuf object *otg.FlowTaggedMetricsFilter - // and doesn't set defaults - msg() *otg.FlowTaggedMetricsFilter - // setMsg unmarshals FlowTaggedMetricsFilter from protobuf object *otg.FlowTaggedMetricsFilter - // and doesn't set defaults - setMsg(*otg.FlowTaggedMetricsFilter) FlowTaggedMetricsFilter - // provides marshal interface - Marshal() marshalFlowTaggedMetricsFilter - // provides unmarshal interface - Unmarshal() unMarshalFlowTaggedMetricsFilter - // validate validates FlowTaggedMetricsFilter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowTaggedMetricsFilter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Include returns bool, set in FlowTaggedMetricsFilter. - Include() bool - // SetInclude assigns bool provided by user to FlowTaggedMetricsFilter - SetInclude(value bool) FlowTaggedMetricsFilter - // HasInclude checks if Include has been set in FlowTaggedMetricsFilter - HasInclude() bool - // IncludeEmptyMetrics returns bool, set in FlowTaggedMetricsFilter. - IncludeEmptyMetrics() bool - // SetIncludeEmptyMetrics assigns bool provided by user to FlowTaggedMetricsFilter - SetIncludeEmptyMetrics(value bool) FlowTaggedMetricsFilter - // HasIncludeEmptyMetrics checks if IncludeEmptyMetrics has been set in FlowTaggedMetricsFilter - HasIncludeEmptyMetrics() bool - // MetricNames returns []FlowTaggedMetricsFilterMetricNamesEnum, set in FlowTaggedMetricsFilter - MetricNames() []FlowTaggedMetricsFilterMetricNamesEnum - // SetMetricNames assigns []FlowTaggedMetricsFilterMetricNamesEnum provided by user to FlowTaggedMetricsFilter - SetMetricNames(value []FlowTaggedMetricsFilterMetricNamesEnum) FlowTaggedMetricsFilter - // Filters returns FlowTaggedMetricsFilterFlowMetricTagFilterIterIter, set in FlowTaggedMetricsFilter - Filters() FlowTaggedMetricsFilterFlowMetricTagFilterIter - setNil() -} - -// Controls inclusion/exclusion of tagged metrics when fetching flow metrics. -// Include returns a bool -func (obj *flowTaggedMetricsFilter) Include() bool { - - return *obj.obj.Include - -} - -// Controls inclusion/exclusion of tagged metrics when fetching flow metrics. -// Include returns a bool -func (obj *flowTaggedMetricsFilter) HasInclude() bool { - return obj.obj.Include != nil -} - -// Controls inclusion/exclusion of tagged metrics when fetching flow metrics. -// SetInclude sets the bool value in the FlowTaggedMetricsFilter object -func (obj *flowTaggedMetricsFilter) SetInclude(value bool) FlowTaggedMetricsFilter { - - obj.obj.Include = &value - return obj -} - -// Controls inclusion/exclusion of tagged metrics where each underlying attributes has zero value or absent value. -// IncludeEmptyMetrics returns a bool -func (obj *flowTaggedMetricsFilter) IncludeEmptyMetrics() bool { - - return *obj.obj.IncludeEmptyMetrics - -} - -// Controls inclusion/exclusion of tagged metrics where each underlying attributes has zero value or absent value. -// IncludeEmptyMetrics returns a bool -func (obj *flowTaggedMetricsFilter) HasIncludeEmptyMetrics() bool { - return obj.obj.IncludeEmptyMetrics != nil -} - -// Controls inclusion/exclusion of tagged metrics where each underlying attributes has zero value or absent value. -// SetIncludeEmptyMetrics sets the bool value in the FlowTaggedMetricsFilter object -func (obj *flowTaggedMetricsFilter) SetIncludeEmptyMetrics(value bool) FlowTaggedMetricsFilter { - - obj.obj.IncludeEmptyMetrics = &value - return obj -} - -type FlowTaggedMetricsFilterMetricNamesEnum string - -// Enum of MetricNames on FlowTaggedMetricsFilter -var FlowTaggedMetricsFilterMetricNames = struct { - FRAMES_TX FlowTaggedMetricsFilterMetricNamesEnum - FRAMES_RX FlowTaggedMetricsFilterMetricNamesEnum - BYTES_TX FlowTaggedMetricsFilterMetricNamesEnum - BYTES_RX FlowTaggedMetricsFilterMetricNamesEnum - FRAMES_TX_RATE FlowTaggedMetricsFilterMetricNamesEnum - FRAMES_RX_RATE FlowTaggedMetricsFilterMetricNamesEnum -}{ - FRAMES_TX: FlowTaggedMetricsFilterMetricNamesEnum("frames_tx"), - FRAMES_RX: FlowTaggedMetricsFilterMetricNamesEnum("frames_rx"), - BYTES_TX: FlowTaggedMetricsFilterMetricNamesEnum("bytes_tx"), - BYTES_RX: FlowTaggedMetricsFilterMetricNamesEnum("bytes_rx"), - FRAMES_TX_RATE: FlowTaggedMetricsFilterMetricNamesEnum("frames_tx_rate"), - FRAMES_RX_RATE: FlowTaggedMetricsFilterMetricNamesEnum("frames_rx_rate"), -} - -func (obj *flowTaggedMetricsFilter) MetricNames() []FlowTaggedMetricsFilterMetricNamesEnum { - items := []FlowTaggedMetricsFilterMetricNamesEnum{} - for _, item := range obj.obj.MetricNames { - items = append(items, FlowTaggedMetricsFilterMetricNamesEnum(item.String())) - } - return items -} - -// The list of metric names that the returned result set will contain. If the list is empty then all metrics will be returned. -// SetMetricNames sets the []string value in the FlowTaggedMetricsFilter object -func (obj *flowTaggedMetricsFilter) SetMetricNames(value []FlowTaggedMetricsFilterMetricNamesEnum) FlowTaggedMetricsFilter { - - items := []otg.FlowTaggedMetricsFilter_MetricNames_Enum{} - for _, item := range value { - intValue := otg.FlowTaggedMetricsFilter_MetricNames_Enum_value[string(item)] - items = append(items, otg.FlowTaggedMetricsFilter_MetricNames_Enum(intValue)) - } - obj.obj.MetricNames = items - return obj -} - -// List of filters to selectively fetch tagged metrics with certain tag and corresponding value. -// Filters returns a []FlowMetricTagFilter -func (obj *flowTaggedMetricsFilter) Filters() FlowTaggedMetricsFilterFlowMetricTagFilterIter { - if len(obj.obj.Filters) == 0 { - obj.obj.Filters = []*otg.FlowMetricTagFilter{} - } - if obj.filtersHolder == nil { - obj.filtersHolder = newFlowTaggedMetricsFilterFlowMetricTagFilterIter(&obj.obj.Filters).setMsg(obj) - } - return obj.filtersHolder -} - -type flowTaggedMetricsFilterFlowMetricTagFilterIter struct { - obj *flowTaggedMetricsFilter - flowMetricTagFilterSlice []FlowMetricTagFilter - fieldPtr *[]*otg.FlowMetricTagFilter -} - -func newFlowTaggedMetricsFilterFlowMetricTagFilterIter(ptr *[]*otg.FlowMetricTagFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter { - return &flowTaggedMetricsFilterFlowMetricTagFilterIter{fieldPtr: ptr} -} - -type FlowTaggedMetricsFilterFlowMetricTagFilterIter interface { - setMsg(*flowTaggedMetricsFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter - Items() []FlowMetricTagFilter - Add() FlowMetricTagFilter - Append(items ...FlowMetricTagFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter - Set(index int, newObj FlowMetricTagFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter - Clear() FlowTaggedMetricsFilterFlowMetricTagFilterIter - clearHolderSlice() FlowTaggedMetricsFilterFlowMetricTagFilterIter - appendHolderSlice(item FlowMetricTagFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter -} - -func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) setMsg(msg *flowTaggedMetricsFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flowMetricTagFilter{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) Items() []FlowMetricTagFilter { - return obj.flowMetricTagFilterSlice -} - -func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) Add() FlowMetricTagFilter { - newObj := &otg.FlowMetricTagFilter{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flowMetricTagFilter{obj: newObj} - newLibObj.setDefault() - obj.flowMetricTagFilterSlice = append(obj.flowMetricTagFilterSlice, newLibObj) - return newLibObj -} - -func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) Append(items ...FlowMetricTagFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowMetricTagFilterSlice = append(obj.flowMetricTagFilterSlice, item) - } - return obj -} - -func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) Set(index int, newObj FlowMetricTagFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowMetricTagFilterSlice[index] = newObj - return obj -} -func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) Clear() FlowTaggedMetricsFilterFlowMetricTagFilterIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.FlowMetricTagFilter{} - obj.flowMetricTagFilterSlice = []FlowMetricTagFilter{} - } - return obj -} -func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) clearHolderSlice() FlowTaggedMetricsFilterFlowMetricTagFilterIter { - if len(obj.flowMetricTagFilterSlice) > 0 { - obj.flowMetricTagFilterSlice = []FlowMetricTagFilter{} - } - return obj -} -func (obj *flowTaggedMetricsFilterFlowMetricTagFilterIter) appendHolderSlice(item FlowMetricTagFilter) FlowTaggedMetricsFilterFlowMetricTagFilterIter { - obj.flowMetricTagFilterSlice = append(obj.flowMetricTagFilterSlice, item) - return obj -} - -func (obj *flowTaggedMetricsFilter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Filters) != 0 { - - if set_default { - obj.Filters().clearHolderSlice() - for _, item := range obj.obj.Filters { - obj.Filters().appendHolderSlice(&flowMetricTagFilter{obj: item}) - } - } - for _, item := range obj.Filters().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *flowTaggedMetricsFilter) setDefault() { - if obj.obj.Include == nil { - obj.SetInclude(true) - } - if obj.obj.IncludeEmptyMetrics == nil { - obj.SetIncludeEmptyMetrics(false) - } - -} - -// ***** BgpPrefixIpv4UnicastFilter ***** -type bgpPrefixIpv4UnicastFilter struct { - validation - obj *otg.BgpPrefixIpv4UnicastFilter - marshaller marshalBgpPrefixIpv4UnicastFilter - unMarshaller unMarshalBgpPrefixIpv4UnicastFilter -} - -func NewBgpPrefixIpv4UnicastFilter() BgpPrefixIpv4UnicastFilter { - obj := bgpPrefixIpv4UnicastFilter{obj: &otg.BgpPrefixIpv4UnicastFilter{}} - obj.setDefault() - return &obj -} - -func (obj *bgpPrefixIpv4UnicastFilter) msg() *otg.BgpPrefixIpv4UnicastFilter { - return obj.obj -} - -func (obj *bgpPrefixIpv4UnicastFilter) setMsg(msg *otg.BgpPrefixIpv4UnicastFilter) BgpPrefixIpv4UnicastFilter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpPrefixIpv4UnicastFilter struct { - obj *bgpPrefixIpv4UnicastFilter -} - -type marshalBgpPrefixIpv4UnicastFilter interface { - // ToProto marshals BgpPrefixIpv4UnicastFilter to protobuf object *otg.BgpPrefixIpv4UnicastFilter - ToProto() (*otg.BgpPrefixIpv4UnicastFilter, error) - // ToPbText marshals BgpPrefixIpv4UnicastFilter to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpPrefixIpv4UnicastFilter to YAML text - ToYaml() (string, error) - // ToJson marshals BgpPrefixIpv4UnicastFilter to JSON text - ToJson() (string, error) -} - -type unMarshalbgpPrefixIpv4UnicastFilter struct { - obj *bgpPrefixIpv4UnicastFilter -} - -type unMarshalBgpPrefixIpv4UnicastFilter interface { - // FromProto unmarshals BgpPrefixIpv4UnicastFilter from protobuf object *otg.BgpPrefixIpv4UnicastFilter - FromProto(msg *otg.BgpPrefixIpv4UnicastFilter) (BgpPrefixIpv4UnicastFilter, error) - // FromPbText unmarshals BgpPrefixIpv4UnicastFilter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpPrefixIpv4UnicastFilter from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpPrefixIpv4UnicastFilter from JSON text - FromJson(value string) error -} - -func (obj *bgpPrefixIpv4UnicastFilter) Marshal() marshalBgpPrefixIpv4UnicastFilter { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpPrefixIpv4UnicastFilter{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpPrefixIpv4UnicastFilter) Unmarshal() unMarshalBgpPrefixIpv4UnicastFilter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpPrefixIpv4UnicastFilter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpPrefixIpv4UnicastFilter) ToProto() (*otg.BgpPrefixIpv4UnicastFilter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpPrefixIpv4UnicastFilter) FromProto(msg *otg.BgpPrefixIpv4UnicastFilter) (BgpPrefixIpv4UnicastFilter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpPrefixIpv4UnicastFilter) 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 *unMarshalbgpPrefixIpv4UnicastFilter) 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 *marshalbgpPrefixIpv4UnicastFilter) 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 *unMarshalbgpPrefixIpv4UnicastFilter) 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 *marshalbgpPrefixIpv4UnicastFilter) 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 *unMarshalbgpPrefixIpv4UnicastFilter) 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 *bgpPrefixIpv4UnicastFilter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpPrefixIpv4UnicastFilter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpPrefixIpv4UnicastFilter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpPrefixIpv4UnicastFilter) Clone() (BgpPrefixIpv4UnicastFilter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpPrefixIpv4UnicastFilter() - 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 -} - -// BgpPrefixIpv4UnicastFilter is description is TBD -type BgpPrefixIpv4UnicastFilter interface { - Validation - // msg marshals BgpPrefixIpv4UnicastFilter to protobuf object *otg.BgpPrefixIpv4UnicastFilter - // and doesn't set defaults - msg() *otg.BgpPrefixIpv4UnicastFilter - // setMsg unmarshals BgpPrefixIpv4UnicastFilter from protobuf object *otg.BgpPrefixIpv4UnicastFilter - // and doesn't set defaults - setMsg(*otg.BgpPrefixIpv4UnicastFilter) BgpPrefixIpv4UnicastFilter - // provides marshal interface - Marshal() marshalBgpPrefixIpv4UnicastFilter - // provides unmarshal interface - Unmarshal() unMarshalBgpPrefixIpv4UnicastFilter - // validate validates BgpPrefixIpv4UnicastFilter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpPrefixIpv4UnicastFilter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Addresses returns []string, set in BgpPrefixIpv4UnicastFilter. - Addresses() []string - // SetAddresses assigns []string provided by user to BgpPrefixIpv4UnicastFilter - SetAddresses(value []string) BgpPrefixIpv4UnicastFilter - // PrefixLength returns uint32, set in BgpPrefixIpv4UnicastFilter. - PrefixLength() uint32 - // SetPrefixLength assigns uint32 provided by user to BgpPrefixIpv4UnicastFilter - SetPrefixLength(value uint32) BgpPrefixIpv4UnicastFilter - // HasPrefixLength checks if PrefixLength has been set in BgpPrefixIpv4UnicastFilter - HasPrefixLength() bool - // Origin returns BgpPrefixIpv4UnicastFilterOriginEnum, set in BgpPrefixIpv4UnicastFilter - Origin() BgpPrefixIpv4UnicastFilterOriginEnum - // SetOrigin assigns BgpPrefixIpv4UnicastFilterOriginEnum provided by user to BgpPrefixIpv4UnicastFilter - SetOrigin(value BgpPrefixIpv4UnicastFilterOriginEnum) BgpPrefixIpv4UnicastFilter - // HasOrigin checks if Origin has been set in BgpPrefixIpv4UnicastFilter - HasOrigin() bool - // PathId returns uint32, set in BgpPrefixIpv4UnicastFilter. - PathId() uint32 - // SetPathId assigns uint32 provided by user to BgpPrefixIpv4UnicastFilter - SetPathId(value uint32) BgpPrefixIpv4UnicastFilter - // HasPathId checks if PathId has been set in BgpPrefixIpv4UnicastFilter - HasPathId() bool -} - -// The addresses to match. If the addresses property is missing or empty then all addresses will match. -// Addresses returns a []string -func (obj *bgpPrefixIpv4UnicastFilter) Addresses() []string { - if obj.obj.Addresses == nil { - obj.obj.Addresses = make([]string, 0) - } - return obj.obj.Addresses -} - -// The addresses to match. If the addresses property is missing or empty then all addresses will match. -// SetAddresses sets the []string value in the BgpPrefixIpv4UnicastFilter object -func (obj *bgpPrefixIpv4UnicastFilter) SetAddresses(value []string) BgpPrefixIpv4UnicastFilter { - - if obj.obj.Addresses == nil { - obj.obj.Addresses = make([]string, 0) - } - obj.obj.Addresses = value - - return obj -} - -// The prefix length to match. If the prefix length is missing then all prefix lengths will match. -// PrefixLength returns a uint32 -func (obj *bgpPrefixIpv4UnicastFilter) PrefixLength() uint32 { - - return *obj.obj.PrefixLength - -} - -// The prefix length to match. If the prefix length is missing then all prefix lengths will match. -// PrefixLength returns a uint32 -func (obj *bgpPrefixIpv4UnicastFilter) HasPrefixLength() bool { - return obj.obj.PrefixLength != nil -} - -// The prefix length to match. If the prefix length is missing then all prefix lengths will match. -// SetPrefixLength sets the uint32 value in the BgpPrefixIpv4UnicastFilter object -func (obj *bgpPrefixIpv4UnicastFilter) SetPrefixLength(value uint32) BgpPrefixIpv4UnicastFilter { - - obj.obj.PrefixLength = &value - return obj -} - -type BgpPrefixIpv4UnicastFilterOriginEnum string - -// Enum of Origin on BgpPrefixIpv4UnicastFilter -var BgpPrefixIpv4UnicastFilterOrigin = struct { - IGP BgpPrefixIpv4UnicastFilterOriginEnum - EGP BgpPrefixIpv4UnicastFilterOriginEnum - INCOMPLETE BgpPrefixIpv4UnicastFilterOriginEnum -}{ - IGP: BgpPrefixIpv4UnicastFilterOriginEnum("igp"), - EGP: BgpPrefixIpv4UnicastFilterOriginEnum("egp"), - INCOMPLETE: BgpPrefixIpv4UnicastFilterOriginEnum("incomplete"), -} - -func (obj *bgpPrefixIpv4UnicastFilter) Origin() BgpPrefixIpv4UnicastFilterOriginEnum { - return BgpPrefixIpv4UnicastFilterOriginEnum(obj.obj.Origin.Enum().String()) -} - -// The origin to match. If the origin is missing then all origins will match. -// Origin returns a string -func (obj *bgpPrefixIpv4UnicastFilter) HasOrigin() bool { - return obj.obj.Origin != nil -} - -func (obj *bgpPrefixIpv4UnicastFilter) SetOrigin(value BgpPrefixIpv4UnicastFilterOriginEnum) BgpPrefixIpv4UnicastFilter { - intValue, ok := otg.BgpPrefixIpv4UnicastFilter_Origin_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpPrefixIpv4UnicastFilterOriginEnum", string(value))) - return obj - } - enumValue := otg.BgpPrefixIpv4UnicastFilter_Origin_Enum(intValue) - obj.obj.Origin = &enumValue - - return obj -} - -// The path id to match. If the path id is missing then all path ids will match. -// PathId returns a uint32 -func (obj *bgpPrefixIpv4UnicastFilter) PathId() uint32 { - - return *obj.obj.PathId - -} - -// The path id to match. If the path id is missing then all path ids will match. -// PathId returns a uint32 -func (obj *bgpPrefixIpv4UnicastFilter) HasPathId() bool { - return obj.obj.PathId != nil -} - -// The path id to match. If the path id is missing then all path ids will match. -// SetPathId sets the uint32 value in the BgpPrefixIpv4UnicastFilter object -func (obj *bgpPrefixIpv4UnicastFilter) SetPathId(value uint32) BgpPrefixIpv4UnicastFilter { - - obj.obj.PathId = &value - return obj -} - -func (obj *bgpPrefixIpv4UnicastFilter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Addresses != nil { - - err := obj.validateIpv4Slice(obj.Addresses()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpPrefixIpv4UnicastFilter.Addresses")) - } - - } - - if obj.obj.PrefixLength != nil { - - if *obj.obj.PrefixLength > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpPrefixIpv4UnicastFilter.PrefixLength <= 128 but Got %d", *obj.obj.PrefixLength)) - } - - } - -} - -func (obj *bgpPrefixIpv4UnicastFilter) setDefault() { - -} - -// ***** BgpPrefixIpv6UnicastFilter ***** -type bgpPrefixIpv6UnicastFilter struct { - validation - obj *otg.BgpPrefixIpv6UnicastFilter - marshaller marshalBgpPrefixIpv6UnicastFilter - unMarshaller unMarshalBgpPrefixIpv6UnicastFilter -} - -func NewBgpPrefixIpv6UnicastFilter() BgpPrefixIpv6UnicastFilter { - obj := bgpPrefixIpv6UnicastFilter{obj: &otg.BgpPrefixIpv6UnicastFilter{}} - obj.setDefault() - return &obj -} - -func (obj *bgpPrefixIpv6UnicastFilter) msg() *otg.BgpPrefixIpv6UnicastFilter { - return obj.obj -} - -func (obj *bgpPrefixIpv6UnicastFilter) setMsg(msg *otg.BgpPrefixIpv6UnicastFilter) BgpPrefixIpv6UnicastFilter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpPrefixIpv6UnicastFilter struct { - obj *bgpPrefixIpv6UnicastFilter -} - -type marshalBgpPrefixIpv6UnicastFilter interface { - // ToProto marshals BgpPrefixIpv6UnicastFilter to protobuf object *otg.BgpPrefixIpv6UnicastFilter - ToProto() (*otg.BgpPrefixIpv6UnicastFilter, error) - // ToPbText marshals BgpPrefixIpv6UnicastFilter to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpPrefixIpv6UnicastFilter to YAML text - ToYaml() (string, error) - // ToJson marshals BgpPrefixIpv6UnicastFilter to JSON text - ToJson() (string, error) -} - -type unMarshalbgpPrefixIpv6UnicastFilter struct { - obj *bgpPrefixIpv6UnicastFilter -} - -type unMarshalBgpPrefixIpv6UnicastFilter interface { - // FromProto unmarshals BgpPrefixIpv6UnicastFilter from protobuf object *otg.BgpPrefixIpv6UnicastFilter - FromProto(msg *otg.BgpPrefixIpv6UnicastFilter) (BgpPrefixIpv6UnicastFilter, error) - // FromPbText unmarshals BgpPrefixIpv6UnicastFilter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpPrefixIpv6UnicastFilter from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpPrefixIpv6UnicastFilter from JSON text - FromJson(value string) error -} - -func (obj *bgpPrefixIpv6UnicastFilter) Marshal() marshalBgpPrefixIpv6UnicastFilter { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpPrefixIpv6UnicastFilter{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpPrefixIpv6UnicastFilter) Unmarshal() unMarshalBgpPrefixIpv6UnicastFilter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpPrefixIpv6UnicastFilter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpPrefixIpv6UnicastFilter) ToProto() (*otg.BgpPrefixIpv6UnicastFilter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpPrefixIpv6UnicastFilter) FromProto(msg *otg.BgpPrefixIpv6UnicastFilter) (BgpPrefixIpv6UnicastFilter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpPrefixIpv6UnicastFilter) 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 *unMarshalbgpPrefixIpv6UnicastFilter) 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 *marshalbgpPrefixIpv6UnicastFilter) 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 *unMarshalbgpPrefixIpv6UnicastFilter) 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 *marshalbgpPrefixIpv6UnicastFilter) 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 *unMarshalbgpPrefixIpv6UnicastFilter) 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 *bgpPrefixIpv6UnicastFilter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpPrefixIpv6UnicastFilter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpPrefixIpv6UnicastFilter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpPrefixIpv6UnicastFilter) Clone() (BgpPrefixIpv6UnicastFilter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpPrefixIpv6UnicastFilter() - 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 -} - -// BgpPrefixIpv6UnicastFilter is description is TBD -type BgpPrefixIpv6UnicastFilter interface { - Validation - // msg marshals BgpPrefixIpv6UnicastFilter to protobuf object *otg.BgpPrefixIpv6UnicastFilter - // and doesn't set defaults - msg() *otg.BgpPrefixIpv6UnicastFilter - // setMsg unmarshals BgpPrefixIpv6UnicastFilter from protobuf object *otg.BgpPrefixIpv6UnicastFilter - // and doesn't set defaults - setMsg(*otg.BgpPrefixIpv6UnicastFilter) BgpPrefixIpv6UnicastFilter - // provides marshal interface - Marshal() marshalBgpPrefixIpv6UnicastFilter - // provides unmarshal interface - Unmarshal() unMarshalBgpPrefixIpv6UnicastFilter - // validate validates BgpPrefixIpv6UnicastFilter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpPrefixIpv6UnicastFilter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Addresses returns []string, set in BgpPrefixIpv6UnicastFilter. - Addresses() []string - // SetAddresses assigns []string provided by user to BgpPrefixIpv6UnicastFilter - SetAddresses(value []string) BgpPrefixIpv6UnicastFilter - // PrefixLength returns uint32, set in BgpPrefixIpv6UnicastFilter. - PrefixLength() uint32 - // SetPrefixLength assigns uint32 provided by user to BgpPrefixIpv6UnicastFilter - SetPrefixLength(value uint32) BgpPrefixIpv6UnicastFilter - // HasPrefixLength checks if PrefixLength has been set in BgpPrefixIpv6UnicastFilter - HasPrefixLength() bool - // Origin returns BgpPrefixIpv6UnicastFilterOriginEnum, set in BgpPrefixIpv6UnicastFilter - Origin() BgpPrefixIpv6UnicastFilterOriginEnum - // SetOrigin assigns BgpPrefixIpv6UnicastFilterOriginEnum provided by user to BgpPrefixIpv6UnicastFilter - SetOrigin(value BgpPrefixIpv6UnicastFilterOriginEnum) BgpPrefixIpv6UnicastFilter - // HasOrigin checks if Origin has been set in BgpPrefixIpv6UnicastFilter - HasOrigin() bool - // PathId returns uint32, set in BgpPrefixIpv6UnicastFilter. - PathId() uint32 - // SetPathId assigns uint32 provided by user to BgpPrefixIpv6UnicastFilter - SetPathId(value uint32) BgpPrefixIpv6UnicastFilter - // HasPathId checks if PathId has been set in BgpPrefixIpv6UnicastFilter - HasPathId() bool -} - -// The addresses to match. If the addresses property is missing or empty then all addresses will match. -// Addresses returns a []string -func (obj *bgpPrefixIpv6UnicastFilter) Addresses() []string { - if obj.obj.Addresses == nil { - obj.obj.Addresses = make([]string, 0) - } - return obj.obj.Addresses -} - -// The addresses to match. If the addresses property is missing or empty then all addresses will match. -// SetAddresses sets the []string value in the BgpPrefixIpv6UnicastFilter object -func (obj *bgpPrefixIpv6UnicastFilter) SetAddresses(value []string) BgpPrefixIpv6UnicastFilter { - - if obj.obj.Addresses == nil { - obj.obj.Addresses = make([]string, 0) - } - obj.obj.Addresses = value - - return obj -} - -// The prefix length to match. If the prefix length is missing then all prefix lengths will match. -// PrefixLength returns a uint32 -func (obj *bgpPrefixIpv6UnicastFilter) PrefixLength() uint32 { - - return *obj.obj.PrefixLength - -} - -// The prefix length to match. If the prefix length is missing then all prefix lengths will match. -// PrefixLength returns a uint32 -func (obj *bgpPrefixIpv6UnicastFilter) HasPrefixLength() bool { - return obj.obj.PrefixLength != nil -} - -// The prefix length to match. If the prefix length is missing then all prefix lengths will match. -// SetPrefixLength sets the uint32 value in the BgpPrefixIpv6UnicastFilter object -func (obj *bgpPrefixIpv6UnicastFilter) SetPrefixLength(value uint32) BgpPrefixIpv6UnicastFilter { - - obj.obj.PrefixLength = &value - return obj -} - -type BgpPrefixIpv6UnicastFilterOriginEnum string - -// Enum of Origin on BgpPrefixIpv6UnicastFilter -var BgpPrefixIpv6UnicastFilterOrigin = struct { - IGP BgpPrefixIpv6UnicastFilterOriginEnum - EGP BgpPrefixIpv6UnicastFilterOriginEnum - INCOMPLETE BgpPrefixIpv6UnicastFilterOriginEnum -}{ - IGP: BgpPrefixIpv6UnicastFilterOriginEnum("igp"), - EGP: BgpPrefixIpv6UnicastFilterOriginEnum("egp"), - INCOMPLETE: BgpPrefixIpv6UnicastFilterOriginEnum("incomplete"), -} - -func (obj *bgpPrefixIpv6UnicastFilter) Origin() BgpPrefixIpv6UnicastFilterOriginEnum { - return BgpPrefixIpv6UnicastFilterOriginEnum(obj.obj.Origin.Enum().String()) -} - -// The origin to match. If the origin is missing then all origins will match. -// Origin returns a string -func (obj *bgpPrefixIpv6UnicastFilter) HasOrigin() bool { - return obj.obj.Origin != nil -} - -func (obj *bgpPrefixIpv6UnicastFilter) SetOrigin(value BgpPrefixIpv6UnicastFilterOriginEnum) BgpPrefixIpv6UnicastFilter { - intValue, ok := otg.BgpPrefixIpv6UnicastFilter_Origin_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpPrefixIpv6UnicastFilterOriginEnum", string(value))) - return obj - } - enumValue := otg.BgpPrefixIpv6UnicastFilter_Origin_Enum(intValue) - obj.obj.Origin = &enumValue - - return obj -} - -// The path id to match. If the path id is missing then all path ids will match. -// PathId returns a uint32 -func (obj *bgpPrefixIpv6UnicastFilter) PathId() uint32 { - - return *obj.obj.PathId - -} - -// The path id to match. If the path id is missing then all path ids will match. -// PathId returns a uint32 -func (obj *bgpPrefixIpv6UnicastFilter) HasPathId() bool { - return obj.obj.PathId != nil -} - -// The path id to match. If the path id is missing then all path ids will match. -// SetPathId sets the uint32 value in the BgpPrefixIpv6UnicastFilter object -func (obj *bgpPrefixIpv6UnicastFilter) SetPathId(value uint32) BgpPrefixIpv6UnicastFilter { - - obj.obj.PathId = &value - return obj -} - -func (obj *bgpPrefixIpv6UnicastFilter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Addresses != nil { - - err := obj.validateIpv6Slice(obj.Addresses()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpPrefixIpv6UnicastFilter.Addresses")) - } - - } - - if obj.obj.PrefixLength != nil { - - if *obj.obj.PrefixLength > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpPrefixIpv6UnicastFilter.PrefixLength <= 128 but Got %d", *obj.obj.PrefixLength)) - } - - } - -} - -func (obj *bgpPrefixIpv6UnicastFilter) setDefault() { - -} - -// ***** ActionResponse ***** -type actionResponse struct { - validation - obj *otg.ActionResponse - marshaller marshalActionResponse - unMarshaller unMarshalActionResponse - protocolHolder ActionResponseProtocol -} - -func NewActionResponse() ActionResponse { - obj := actionResponse{obj: &otg.ActionResponse{}} - obj.setDefault() - return &obj -} - -func (obj *actionResponse) msg() *otg.ActionResponse { - return obj.obj -} - -func (obj *actionResponse) setMsg(msg *otg.ActionResponse) ActionResponse { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionResponse struct { - obj *actionResponse -} - -type marshalActionResponse interface { - // ToProto marshals ActionResponse to protobuf object *otg.ActionResponse - ToProto() (*otg.ActionResponse, error) - // ToPbText marshals ActionResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionResponse to YAML text - ToYaml() (string, error) - // ToJson marshals ActionResponse to JSON text - ToJson() (string, error) -} - -type unMarshalactionResponse struct { - obj *actionResponse -} - -type unMarshalActionResponse interface { - // FromProto unmarshals ActionResponse from protobuf object *otg.ActionResponse - FromProto(msg *otg.ActionResponse) (ActionResponse, error) - // FromPbText unmarshals ActionResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionResponse from JSON text - FromJson(value string) error -} - -func (obj *actionResponse) Marshal() marshalActionResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalactionResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *actionResponse) Unmarshal() unMarshalActionResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionResponse) ToProto() (*otg.ActionResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionResponse) FromProto(msg *otg.ActionResponse) (ActionResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionResponse) 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 *unMarshalactionResponse) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalactionResponse) 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 *unMarshalactionResponse) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalactionResponse) 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 *unMarshalactionResponse) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *actionResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionResponse) Clone() (ActionResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionResponse() - 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 -} - -func (obj *actionResponse) setNil() { - obj.protocolHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ActionResponse is response for action triggered against configured resources. -type ActionResponse interface { - Validation - // msg marshals ActionResponse to protobuf object *otg.ActionResponse - // and doesn't set defaults - msg() *otg.ActionResponse - // setMsg unmarshals ActionResponse from protobuf object *otg.ActionResponse - // and doesn't set defaults - setMsg(*otg.ActionResponse) ActionResponse - // provides marshal interface - Marshal() marshalActionResponse - // provides unmarshal interface - Unmarshal() unMarshalActionResponse - // validate validates ActionResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ActionResponseChoiceEnum, set in ActionResponse - Choice() ActionResponseChoiceEnum - // setChoice assigns ActionResponseChoiceEnum provided by user to ActionResponse - setChoice(value ActionResponseChoiceEnum) ActionResponse - // Protocol returns ActionResponseProtocol, set in ActionResponse. - // ActionResponseProtocol is response for actions associated with protocols on configured resources. - Protocol() ActionResponseProtocol - // SetProtocol assigns ActionResponseProtocol provided by user to ActionResponse. - // ActionResponseProtocol is response for actions associated with protocols on configured resources. - SetProtocol(value ActionResponseProtocol) ActionResponse - // HasProtocol checks if Protocol has been set in ActionResponse - HasProtocol() bool - setNil() -} - -type ActionResponseChoiceEnum string - -// Enum of Choice on ActionResponse -var ActionResponseChoice = struct { - PROTOCOL ActionResponseChoiceEnum -}{ - PROTOCOL: ActionResponseChoiceEnum("protocol"), -} - -func (obj *actionResponse) Choice() ActionResponseChoiceEnum { - return ActionResponseChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *actionResponse) setChoice(value ActionResponseChoiceEnum) ActionResponse { - intValue, ok := otg.ActionResponse_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ActionResponseChoiceEnum", string(value))) - return obj - } - enumValue := otg.ActionResponse_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Protocol = nil - obj.protocolHolder = nil - - if value == ActionResponseChoice.PROTOCOL { - obj.obj.Protocol = NewActionResponseProtocol().msg() - } - - return obj -} - -// description is TBD -// Protocol returns a ActionResponseProtocol -func (obj *actionResponse) Protocol() ActionResponseProtocol { - if obj.obj.Protocol == nil { - obj.setChoice(ActionResponseChoice.PROTOCOL) - } - if obj.protocolHolder == nil { - obj.protocolHolder = &actionResponseProtocol{obj: obj.obj.Protocol} - } - return obj.protocolHolder -} - -// description is TBD -// Protocol returns a ActionResponseProtocol -func (obj *actionResponse) HasProtocol() bool { - return obj.obj.Protocol != nil -} - -// description is TBD -// SetProtocol sets the ActionResponseProtocol value in the ActionResponse object -func (obj *actionResponse) SetProtocol(value ActionResponseProtocol) ActionResponse { - obj.setChoice(ActionResponseChoice.PROTOCOL) - obj.protocolHolder = nil - obj.obj.Protocol = value.msg() - - return obj -} - -func (obj *actionResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionResponse") - } - - if obj.obj.Protocol != nil { - - obj.Protocol().validateObj(vObj, set_default) - } - -} - -func (obj *actionResponse) setDefault() { - var choices_set int = 0 - var choice ActionResponseChoiceEnum - - if obj.obj.Protocol != nil { - choices_set += 1 - choice = ActionResponseChoice.PROTOCOL - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionResponse") - } - } else { - intVal := otg.ActionResponse_Choice_Enum_value[string(choice)] - enumValue := otg.ActionResponse_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PortMetric ***** -type portMetric struct { - validation - obj *otg.PortMetric - marshaller marshalPortMetric - unMarshaller unMarshalPortMetric -} - -func NewPortMetric() PortMetric { - obj := portMetric{obj: &otg.PortMetric{}} - obj.setDefault() - return &obj -} - -func (obj *portMetric) msg() *otg.PortMetric { - return obj.obj -} - -func (obj *portMetric) setMsg(msg *otg.PortMetric) PortMetric { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalportMetric struct { - obj *portMetric -} - -type marshalPortMetric interface { - // ToProto marshals PortMetric to protobuf object *otg.PortMetric - ToProto() (*otg.PortMetric, error) - // ToPbText marshals PortMetric to protobuf text - ToPbText() (string, error) - // ToYaml marshals PortMetric to YAML text - ToYaml() (string, error) - // ToJson marshals PortMetric to JSON text - ToJson() (string, error) -} - -type unMarshalportMetric struct { - obj *portMetric -} - -type unMarshalPortMetric interface { - // FromProto unmarshals PortMetric from protobuf object *otg.PortMetric - FromProto(msg *otg.PortMetric) (PortMetric, error) - // FromPbText unmarshals PortMetric from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PortMetric from YAML text - FromYaml(value string) error - // FromJson unmarshals PortMetric from JSON text - FromJson(value string) error -} - -func (obj *portMetric) Marshal() marshalPortMetric { - if obj.marshaller == nil { - obj.marshaller = &marshalportMetric{obj: obj} - } - return obj.marshaller -} - -func (obj *portMetric) Unmarshal() unMarshalPortMetric { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalportMetric{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalportMetric) ToProto() (*otg.PortMetric, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalportMetric) FromProto(msg *otg.PortMetric) (PortMetric, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalportMetric) 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 *unMarshalportMetric) 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 *marshalportMetric) 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 *unMarshalportMetric) 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 *marshalportMetric) 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 *unMarshalportMetric) 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 *portMetric) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *portMetric) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *portMetric) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *portMetric) Clone() (PortMetric, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPortMetric() - 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 -} - -// PortMetric is description is TBD -type PortMetric interface { - Validation - // msg marshals PortMetric to protobuf object *otg.PortMetric - // and doesn't set defaults - msg() *otg.PortMetric - // setMsg unmarshals PortMetric from protobuf object *otg.PortMetric - // and doesn't set defaults - setMsg(*otg.PortMetric) PortMetric - // provides marshal interface - Marshal() marshalPortMetric - // provides unmarshal interface - Unmarshal() unMarshalPortMetric - // validate validates PortMetric - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PortMetric, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PortMetric. - Name() string - // SetName assigns string provided by user to PortMetric - SetName(value string) PortMetric - // HasName checks if Name has been set in PortMetric - HasName() bool - // Location returns string, set in PortMetric. - Location() string - // SetLocation assigns string provided by user to PortMetric - SetLocation(value string) PortMetric - // HasLocation checks if Location has been set in PortMetric - HasLocation() bool - // Link returns PortMetricLinkEnum, set in PortMetric - Link() PortMetricLinkEnum - // SetLink assigns PortMetricLinkEnum provided by user to PortMetric - SetLink(value PortMetricLinkEnum) PortMetric - // HasLink checks if Link has been set in PortMetric - HasLink() bool - // Capture returns PortMetricCaptureEnum, set in PortMetric - Capture() PortMetricCaptureEnum - // SetCapture assigns PortMetricCaptureEnum provided by user to PortMetric - SetCapture(value PortMetricCaptureEnum) PortMetric - // HasCapture checks if Capture has been set in PortMetric - HasCapture() bool - // FramesTx returns uint64, set in PortMetric. - FramesTx() uint64 - // SetFramesTx assigns uint64 provided by user to PortMetric - SetFramesTx(value uint64) PortMetric - // HasFramesTx checks if FramesTx has been set in PortMetric - HasFramesTx() bool - // FramesRx returns uint64, set in PortMetric. - FramesRx() uint64 - // SetFramesRx assigns uint64 provided by user to PortMetric - SetFramesRx(value uint64) PortMetric - // HasFramesRx checks if FramesRx has been set in PortMetric - HasFramesRx() bool - // BytesTx returns uint64, set in PortMetric. - BytesTx() uint64 - // SetBytesTx assigns uint64 provided by user to PortMetric - SetBytesTx(value uint64) PortMetric - // HasBytesTx checks if BytesTx has been set in PortMetric - HasBytesTx() bool - // BytesRx returns uint64, set in PortMetric. - BytesRx() uint64 - // SetBytesRx assigns uint64 provided by user to PortMetric - SetBytesRx(value uint64) PortMetric - // HasBytesRx checks if BytesRx has been set in PortMetric - HasBytesRx() bool - // FramesTxRate returns float32, set in PortMetric. - FramesTxRate() float32 - // SetFramesTxRate assigns float32 provided by user to PortMetric - SetFramesTxRate(value float32) PortMetric - // HasFramesTxRate checks if FramesTxRate has been set in PortMetric - HasFramesTxRate() bool - // FramesRxRate returns float32, set in PortMetric. - FramesRxRate() float32 - // SetFramesRxRate assigns float32 provided by user to PortMetric - SetFramesRxRate(value float32) PortMetric - // HasFramesRxRate checks if FramesRxRate has been set in PortMetric - HasFramesRxRate() bool - // BytesTxRate returns float32, set in PortMetric. - BytesTxRate() float32 - // SetBytesTxRate assigns float32 provided by user to PortMetric - SetBytesTxRate(value float32) PortMetric - // HasBytesTxRate checks if BytesTxRate has been set in PortMetric - HasBytesTxRate() bool - // BytesRxRate returns float32, set in PortMetric. - BytesRxRate() float32 - // SetBytesRxRate assigns float32 provided by user to PortMetric - SetBytesRxRate(value float32) PortMetric - // HasBytesRxRate checks if BytesRxRate has been set in PortMetric - HasBytesRxRate() bool - // Transmit returns PortMetricTransmitEnum, set in PortMetric - Transmit() PortMetricTransmitEnum - // SetTransmit assigns PortMetricTransmitEnum provided by user to PortMetric - SetTransmit(value PortMetricTransmitEnum) PortMetric - // HasTransmit checks if Transmit has been set in PortMetric - HasTransmit() bool -} - -// The name of a configured port -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// Name returns a string -func (obj *portMetric) Name() string { - - return *obj.obj.Name - -} - -// The name of a configured port -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// Name returns a string -func (obj *portMetric) HasName() bool { - return obj.obj.Name != nil -} - -// The name of a configured port -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// SetName sets the string value in the PortMetric object -func (obj *portMetric) SetName(value string) PortMetric { - - obj.obj.Name = &value - return obj -} - -// The state of the connection to the test port location. The format should be the configured port location along with any custom connection state message. -// Location returns a string -func (obj *portMetric) Location() string { - - return *obj.obj.Location - -} - -// The state of the connection to the test port location. The format should be the configured port location along with any custom connection state message. -// Location returns a string -func (obj *portMetric) HasLocation() bool { - return obj.obj.Location != nil -} - -// The state of the connection to the test port location. The format should be the configured port location along with any custom connection state message. -// SetLocation sets the string value in the PortMetric object -func (obj *portMetric) SetLocation(value string) PortMetric { - - obj.obj.Location = &value - return obj -} - -type PortMetricLinkEnum string - -// Enum of Link on PortMetric -var PortMetricLink = struct { - UP PortMetricLinkEnum - DOWN PortMetricLinkEnum -}{ - UP: PortMetricLinkEnum("up"), - DOWN: PortMetricLinkEnum("down"), -} - -func (obj *portMetric) Link() PortMetricLinkEnum { - return PortMetricLinkEnum(obj.obj.Link.Enum().String()) -} - -// The state of the test port link The string can be up, down or a custom error message. -// Link returns a string -func (obj *portMetric) HasLink() bool { - return obj.obj.Link != nil -} - -func (obj *portMetric) SetLink(value PortMetricLinkEnum) PortMetric { - intValue, ok := otg.PortMetric_Link_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PortMetricLinkEnum", string(value))) - return obj - } - enumValue := otg.PortMetric_Link_Enum(intValue) - obj.obj.Link = &enumValue - - return obj -} - -type PortMetricCaptureEnum string - -// Enum of Capture on PortMetric -var PortMetricCapture = struct { - STARTED PortMetricCaptureEnum - STOPPED PortMetricCaptureEnum -}{ - STARTED: PortMetricCaptureEnum("started"), - STOPPED: PortMetricCaptureEnum("stopped"), -} - -func (obj *portMetric) Capture() PortMetricCaptureEnum { - return PortMetricCaptureEnum(obj.obj.Capture.Enum().String()) -} - -// The state of the test port capture infrastructure. The string can be started, stopped or a custom error message. -// Capture returns a string -func (obj *portMetric) HasCapture() bool { - return obj.obj.Capture != nil -} - -func (obj *portMetric) SetCapture(value PortMetricCaptureEnum) PortMetric { - intValue, ok := otg.PortMetric_Capture_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PortMetricCaptureEnum", string(value))) - return obj - } - enumValue := otg.PortMetric_Capture_Enum(intValue) - obj.obj.Capture = &enumValue - - return obj -} - -// The current total number of frames transmitted -// FramesTx returns a uint64 -func (obj *portMetric) FramesTx() uint64 { - - return *obj.obj.FramesTx - -} - -// The current total number of frames transmitted -// FramesTx returns a uint64 -func (obj *portMetric) HasFramesTx() bool { - return obj.obj.FramesTx != nil -} - -// The current total number of frames transmitted -// SetFramesTx sets the uint64 value in the PortMetric object -func (obj *portMetric) SetFramesTx(value uint64) PortMetric { - - obj.obj.FramesTx = &value - return obj -} - -// The current total number of valid frames received -// FramesRx returns a uint64 -func (obj *portMetric) FramesRx() uint64 { - - return *obj.obj.FramesRx - -} - -// The current total number of valid frames received -// FramesRx returns a uint64 -func (obj *portMetric) HasFramesRx() bool { - return obj.obj.FramesRx != nil -} - -// The current total number of valid frames received -// SetFramesRx sets the uint64 value in the PortMetric object -func (obj *portMetric) SetFramesRx(value uint64) PortMetric { - - obj.obj.FramesRx = &value - return obj -} - -// The current total number of bytes transmitted -// BytesTx returns a uint64 -func (obj *portMetric) BytesTx() uint64 { - - return *obj.obj.BytesTx - -} - -// The current total number of bytes transmitted -// BytesTx returns a uint64 -func (obj *portMetric) HasBytesTx() bool { - return obj.obj.BytesTx != nil -} - -// The current total number of bytes transmitted -// SetBytesTx sets the uint64 value in the PortMetric object -func (obj *portMetric) SetBytesTx(value uint64) PortMetric { - - obj.obj.BytesTx = &value - return obj -} - -// The current total number of valid bytes received -// BytesRx returns a uint64 -func (obj *portMetric) BytesRx() uint64 { - - return *obj.obj.BytesRx - -} - -// The current total number of valid bytes received -// BytesRx returns a uint64 -func (obj *portMetric) HasBytesRx() bool { - return obj.obj.BytesRx != nil -} - -// The current total number of valid bytes received -// SetBytesRx sets the uint64 value in the PortMetric object -func (obj *portMetric) SetBytesRx(value uint64) PortMetric { - - obj.obj.BytesRx = &value - return obj -} - -// The current rate of frames transmitted -// FramesTxRate returns a float32 -func (obj *portMetric) FramesTxRate() float32 { - - return *obj.obj.FramesTxRate - -} - -// The current rate of frames transmitted -// FramesTxRate returns a float32 -func (obj *portMetric) HasFramesTxRate() bool { - return obj.obj.FramesTxRate != nil -} - -// The current rate of frames transmitted -// SetFramesTxRate sets the float32 value in the PortMetric object -func (obj *portMetric) SetFramesTxRate(value float32) PortMetric { - - obj.obj.FramesTxRate = &value - return obj -} - -// The current rate of valid frames received -// FramesRxRate returns a float32 -func (obj *portMetric) FramesRxRate() float32 { - - return *obj.obj.FramesRxRate - -} - -// The current rate of valid frames received -// FramesRxRate returns a float32 -func (obj *portMetric) HasFramesRxRate() bool { - return obj.obj.FramesRxRate != nil -} - -// The current rate of valid frames received -// SetFramesRxRate sets the float32 value in the PortMetric object -func (obj *portMetric) SetFramesRxRate(value float32) PortMetric { - - obj.obj.FramesRxRate = &value - return obj -} - -// The current rate of bytes transmitted -// BytesTxRate returns a float32 -func (obj *portMetric) BytesTxRate() float32 { - - return *obj.obj.BytesTxRate - -} - -// The current rate of bytes transmitted -// BytesTxRate returns a float32 -func (obj *portMetric) HasBytesTxRate() bool { - return obj.obj.BytesTxRate != nil -} - -// The current rate of bytes transmitted -// SetBytesTxRate sets the float32 value in the PortMetric object -func (obj *portMetric) SetBytesTxRate(value float32) PortMetric { - - obj.obj.BytesTxRate = &value - return obj -} - -// The current rate of bytes received -// BytesRxRate returns a float32 -func (obj *portMetric) BytesRxRate() float32 { - - return *obj.obj.BytesRxRate - -} - -// The current rate of bytes received -// BytesRxRate returns a float32 -func (obj *portMetric) HasBytesRxRate() bool { - return obj.obj.BytesRxRate != nil -} - -// The current rate of bytes received -// SetBytesRxRate sets the float32 value in the PortMetric object -func (obj *portMetric) SetBytesRxRate(value float32) PortMetric { - - obj.obj.BytesRxRate = &value - return obj -} - -type PortMetricTransmitEnum string - -// Enum of Transmit on PortMetric -var PortMetricTransmit = struct { - STARTED PortMetricTransmitEnum - STOPPED PortMetricTransmitEnum -}{ - STARTED: PortMetricTransmitEnum("started"), - STOPPED: PortMetricTransmitEnum("stopped"), -} - -func (obj *portMetric) Transmit() PortMetricTransmitEnum { - return PortMetricTransmitEnum(obj.obj.Transmit.Enum().String()) -} - -// The transmit state of the flow. -// Transmit returns a string -func (obj *portMetric) HasTransmit() bool { - return obj.obj.Transmit != nil -} - -func (obj *portMetric) SetTransmit(value PortMetricTransmitEnum) PortMetric { - intValue, ok := otg.PortMetric_Transmit_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PortMetricTransmitEnum", string(value))) - return obj - } - enumValue := otg.PortMetric_Transmit_Enum(intValue) - obj.obj.Transmit = &enumValue - - return obj -} - -func (obj *portMetric) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *portMetric) setDefault() { - -} - -// ***** FlowMetric ***** -type flowMetric struct { - validation - obj *otg.FlowMetric - marshaller marshalFlowMetric - unMarshaller unMarshalFlowMetric - timestampsHolder MetricTimestamp - latencyHolder MetricLatency - taggedMetricsHolder FlowMetricFlowTaggedMetricIter -} - -func NewFlowMetric() FlowMetric { - obj := flowMetric{obj: &otg.FlowMetric{}} - obj.setDefault() - return &obj -} - -func (obj *flowMetric) msg() *otg.FlowMetric { - return obj.obj -} - -func (obj *flowMetric) setMsg(msg *otg.FlowMetric) FlowMetric { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowMetric struct { - obj *flowMetric -} - -type marshalFlowMetric interface { - // ToProto marshals FlowMetric to protobuf object *otg.FlowMetric - ToProto() (*otg.FlowMetric, error) - // ToPbText marshals FlowMetric to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowMetric to YAML text - ToYaml() (string, error) - // ToJson marshals FlowMetric to JSON text - ToJson() (string, error) -} - -type unMarshalflowMetric struct { - obj *flowMetric -} - -type unMarshalFlowMetric interface { - // FromProto unmarshals FlowMetric from protobuf object *otg.FlowMetric - FromProto(msg *otg.FlowMetric) (FlowMetric, error) - // FromPbText unmarshals FlowMetric from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowMetric from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowMetric from JSON text - FromJson(value string) error -} - -func (obj *flowMetric) Marshal() marshalFlowMetric { - if obj.marshaller == nil { - obj.marshaller = &marshalflowMetric{obj: obj} - } - return obj.marshaller -} - -func (obj *flowMetric) Unmarshal() unMarshalFlowMetric { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowMetric{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowMetric) ToProto() (*otg.FlowMetric, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowMetric) FromProto(msg *otg.FlowMetric) (FlowMetric, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowMetric) 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 *unMarshalflowMetric) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowMetric) 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 *unMarshalflowMetric) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowMetric) 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 *unMarshalflowMetric) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowMetric) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowMetric) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowMetric) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowMetric) Clone() (FlowMetric, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowMetric() - 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 -} - -func (obj *flowMetric) setNil() { - obj.timestampsHolder = nil - obj.latencyHolder = nil - obj.taggedMetricsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowMetric is a container for flow metrics. -// The container is keyed by the name, port_tx and port_rx. -type FlowMetric interface { - Validation - // msg marshals FlowMetric to protobuf object *otg.FlowMetric - // and doesn't set defaults - msg() *otg.FlowMetric - // setMsg unmarshals FlowMetric from protobuf object *otg.FlowMetric - // and doesn't set defaults - setMsg(*otg.FlowMetric) FlowMetric - // provides marshal interface - Marshal() marshalFlowMetric - // provides unmarshal interface - Unmarshal() unMarshalFlowMetric - // validate validates FlowMetric - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowMetric, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in FlowMetric. - Name() string - // SetName assigns string provided by user to FlowMetric - SetName(value string) FlowMetric - // HasName checks if Name has been set in FlowMetric - HasName() bool - // PortTx returns string, set in FlowMetric. - PortTx() string - // SetPortTx assigns string provided by user to FlowMetric - SetPortTx(value string) FlowMetric - // HasPortTx checks if PortTx has been set in FlowMetric - HasPortTx() bool - // PortRx returns string, set in FlowMetric. - PortRx() string - // SetPortRx assigns string provided by user to FlowMetric - SetPortRx(value string) FlowMetric - // HasPortRx checks if PortRx has been set in FlowMetric - HasPortRx() bool - // Transmit returns FlowMetricTransmitEnum, set in FlowMetric - Transmit() FlowMetricTransmitEnum - // SetTransmit assigns FlowMetricTransmitEnum provided by user to FlowMetric - SetTransmit(value FlowMetricTransmitEnum) FlowMetric - // HasTransmit checks if Transmit has been set in FlowMetric - HasTransmit() bool - // FramesTx returns uint64, set in FlowMetric. - FramesTx() uint64 - // SetFramesTx assigns uint64 provided by user to FlowMetric - SetFramesTx(value uint64) FlowMetric - // HasFramesTx checks if FramesTx has been set in FlowMetric - HasFramesTx() bool - // FramesRx returns uint64, set in FlowMetric. - FramesRx() uint64 - // SetFramesRx assigns uint64 provided by user to FlowMetric - SetFramesRx(value uint64) FlowMetric - // HasFramesRx checks if FramesRx has been set in FlowMetric - HasFramesRx() bool - // BytesTx returns uint64, set in FlowMetric. - BytesTx() uint64 - // SetBytesTx assigns uint64 provided by user to FlowMetric - SetBytesTx(value uint64) FlowMetric - // HasBytesTx checks if BytesTx has been set in FlowMetric - HasBytesTx() bool - // BytesRx returns uint64, set in FlowMetric. - BytesRx() uint64 - // SetBytesRx assigns uint64 provided by user to FlowMetric - SetBytesRx(value uint64) FlowMetric - // HasBytesRx checks if BytesRx has been set in FlowMetric - HasBytesRx() bool - // FramesTxRate returns float32, set in FlowMetric. - FramesTxRate() float32 - // SetFramesTxRate assigns float32 provided by user to FlowMetric - SetFramesTxRate(value float32) FlowMetric - // HasFramesTxRate checks if FramesTxRate has been set in FlowMetric - HasFramesTxRate() bool - // FramesRxRate returns float32, set in FlowMetric. - FramesRxRate() float32 - // SetFramesRxRate assigns float32 provided by user to FlowMetric - SetFramesRxRate(value float32) FlowMetric - // HasFramesRxRate checks if FramesRxRate has been set in FlowMetric - HasFramesRxRate() bool - // Loss returns float32, set in FlowMetric. - Loss() float32 - // SetLoss assigns float32 provided by user to FlowMetric - SetLoss(value float32) FlowMetric - // HasLoss checks if Loss has been set in FlowMetric - HasLoss() bool - // Timestamps returns MetricTimestamp, set in FlowMetric. - // MetricTimestamp is the container for timestamp metrics. - // The container will be empty if the timestamp has not been configured for - // the flow. - Timestamps() MetricTimestamp - // SetTimestamps assigns MetricTimestamp provided by user to FlowMetric. - // MetricTimestamp is the container for timestamp metrics. - // The container will be empty if the timestamp has not been configured for - // the flow. - SetTimestamps(value MetricTimestamp) FlowMetric - // HasTimestamps checks if Timestamps has been set in FlowMetric - HasTimestamps() bool - // Latency returns MetricLatency, set in FlowMetric. - // MetricLatency is the container for latency metrics. - // The min/max/avg values are dependent on the type of latency measurement - // mode that is configured. - // The container will be empty if the latency has not been configured for - // the flow. - Latency() MetricLatency - // SetLatency assigns MetricLatency provided by user to FlowMetric. - // MetricLatency is the container for latency metrics. - // The min/max/avg values are dependent on the type of latency measurement - // mode that is configured. - // The container will be empty if the latency has not been configured for - // the flow. - SetLatency(value MetricLatency) FlowMetric - // HasLatency checks if Latency has been set in FlowMetric - HasLatency() bool - // TaggedMetrics returns FlowMetricFlowTaggedMetricIterIter, set in FlowMetric - TaggedMetrics() FlowMetricFlowTaggedMetricIter - setNil() -} - -// The name of the flow -// Name returns a string -func (obj *flowMetric) Name() string { - - return *obj.obj.Name - -} - -// The name of the flow -// Name returns a string -func (obj *flowMetric) HasName() bool { - return obj.obj.Name != nil -} - -// The name of the flow -// SetName sets the string value in the FlowMetric object -func (obj *flowMetric) SetName(value string) FlowMetric { - - obj.obj.Name = &value - return obj -} - -// The name of the transmit port -// PortTx returns a string -func (obj *flowMetric) PortTx() string { - - return *obj.obj.PortTx - -} - -// The name of the transmit port -// PortTx returns a string -func (obj *flowMetric) HasPortTx() bool { - return obj.obj.PortTx != nil -} - -// The name of the transmit port -// SetPortTx sets the string value in the FlowMetric object -func (obj *flowMetric) SetPortTx(value string) FlowMetric { - - obj.obj.PortTx = &value - return obj -} - -// The name of the receive port -// PortRx returns a string -func (obj *flowMetric) PortRx() string { - - return *obj.obj.PortRx - -} - -// The name of the receive port -// PortRx returns a string -func (obj *flowMetric) HasPortRx() bool { - return obj.obj.PortRx != nil -} - -// The name of the receive port -// SetPortRx sets the string value in the FlowMetric object -func (obj *flowMetric) SetPortRx(value string) FlowMetric { - - obj.obj.PortRx = &value - return obj -} - -type FlowMetricTransmitEnum string - -// Enum of Transmit on FlowMetric -var FlowMetricTransmit = struct { - STARTED FlowMetricTransmitEnum - STOPPED FlowMetricTransmitEnum - PAUSED FlowMetricTransmitEnum -}{ - STARTED: FlowMetricTransmitEnum("started"), - STOPPED: FlowMetricTransmitEnum("stopped"), - PAUSED: FlowMetricTransmitEnum("paused"), -} - -func (obj *flowMetric) Transmit() FlowMetricTransmitEnum { - return FlowMetricTransmitEnum(obj.obj.Transmit.Enum().String()) -} - -// The transmit state of the flow. -// Transmit returns a string -func (obj *flowMetric) HasTransmit() bool { - return obj.obj.Transmit != nil -} - -func (obj *flowMetric) SetTransmit(value FlowMetricTransmitEnum) FlowMetric { - intValue, ok := otg.FlowMetric_Transmit_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowMetricTransmitEnum", string(value))) - return obj - } - enumValue := otg.FlowMetric_Transmit_Enum(intValue) - obj.obj.Transmit = &enumValue - - return obj -} - -// The current total number of frames transmitted -// FramesTx returns a uint64 -func (obj *flowMetric) FramesTx() uint64 { - - return *obj.obj.FramesTx - -} - -// The current total number of frames transmitted -// FramesTx returns a uint64 -func (obj *flowMetric) HasFramesTx() bool { - return obj.obj.FramesTx != nil -} - -// The current total number of frames transmitted -// SetFramesTx sets the uint64 value in the FlowMetric object -func (obj *flowMetric) SetFramesTx(value uint64) FlowMetric { - - obj.obj.FramesTx = &value - return obj -} - -// The current total number of valid frames received -// FramesRx returns a uint64 -func (obj *flowMetric) FramesRx() uint64 { - - return *obj.obj.FramesRx - -} - -// The current total number of valid frames received -// FramesRx returns a uint64 -func (obj *flowMetric) HasFramesRx() bool { - return obj.obj.FramesRx != nil -} - -// The current total number of valid frames received -// SetFramesRx sets the uint64 value in the FlowMetric object -func (obj *flowMetric) SetFramesRx(value uint64) FlowMetric { - - obj.obj.FramesRx = &value - return obj -} - -// The current total number of bytes transmitted -// BytesTx returns a uint64 -func (obj *flowMetric) BytesTx() uint64 { - - return *obj.obj.BytesTx - -} - -// The current total number of bytes transmitted -// BytesTx returns a uint64 -func (obj *flowMetric) HasBytesTx() bool { - return obj.obj.BytesTx != nil -} - -// The current total number of bytes transmitted -// SetBytesTx sets the uint64 value in the FlowMetric object -func (obj *flowMetric) SetBytesTx(value uint64) FlowMetric { - - obj.obj.BytesTx = &value - return obj -} - -// The current total number of bytes received -// BytesRx returns a uint64 -func (obj *flowMetric) BytesRx() uint64 { - - return *obj.obj.BytesRx - -} - -// The current total number of bytes received -// BytesRx returns a uint64 -func (obj *flowMetric) HasBytesRx() bool { - return obj.obj.BytesRx != nil -} - -// The current total number of bytes received -// SetBytesRx sets the uint64 value in the FlowMetric object -func (obj *flowMetric) SetBytesRx(value uint64) FlowMetric { - - obj.obj.BytesRx = &value - return obj -} - -// The current rate of frames transmitted -// FramesTxRate returns a float32 -func (obj *flowMetric) FramesTxRate() float32 { - - return *obj.obj.FramesTxRate - -} - -// The current rate of frames transmitted -// FramesTxRate returns a float32 -func (obj *flowMetric) HasFramesTxRate() bool { - return obj.obj.FramesTxRate != nil -} - -// The current rate of frames transmitted -// SetFramesTxRate sets the float32 value in the FlowMetric object -func (obj *flowMetric) SetFramesTxRate(value float32) FlowMetric { - - obj.obj.FramesTxRate = &value - return obj -} - -// The current rate of valid frames received -// FramesRxRate returns a float32 -func (obj *flowMetric) FramesRxRate() float32 { - - return *obj.obj.FramesRxRate - -} - -// The current rate of valid frames received -// FramesRxRate returns a float32 -func (obj *flowMetric) HasFramesRxRate() bool { - return obj.obj.FramesRxRate != nil -} - -// The current rate of valid frames received -// SetFramesRxRate sets the float32 value in the FlowMetric object -func (obj *flowMetric) SetFramesRxRate(value float32) FlowMetric { - - obj.obj.FramesRxRate = &value - return obj -} - -// The percentage of lost frames -// Loss returns a float32 -func (obj *flowMetric) Loss() float32 { - - return *obj.obj.Loss - -} - -// The percentage of lost frames -// Loss returns a float32 -func (obj *flowMetric) HasLoss() bool { - return obj.obj.Loss != nil -} - -// The percentage of lost frames -// SetLoss sets the float32 value in the FlowMetric object -func (obj *flowMetric) SetLoss(value float32) FlowMetric { - - obj.obj.Loss = &value - return obj -} - -// description is TBD -// Timestamps returns a MetricTimestamp -func (obj *flowMetric) Timestamps() MetricTimestamp { - if obj.obj.Timestamps == nil { - obj.obj.Timestamps = NewMetricTimestamp().msg() - } - if obj.timestampsHolder == nil { - obj.timestampsHolder = &metricTimestamp{obj: obj.obj.Timestamps} - } - return obj.timestampsHolder -} - -// description is TBD -// Timestamps returns a MetricTimestamp -func (obj *flowMetric) HasTimestamps() bool { - return obj.obj.Timestamps != nil -} - -// description is TBD -// SetTimestamps sets the MetricTimestamp value in the FlowMetric object -func (obj *flowMetric) SetTimestamps(value MetricTimestamp) FlowMetric { - - obj.timestampsHolder = nil - obj.obj.Timestamps = value.msg() - - return obj -} - -// description is TBD -// Latency returns a MetricLatency -func (obj *flowMetric) Latency() MetricLatency { - if obj.obj.Latency == nil { - obj.obj.Latency = NewMetricLatency().msg() - } - if obj.latencyHolder == nil { - obj.latencyHolder = &metricLatency{obj: obj.obj.Latency} - } - return obj.latencyHolder -} - -// description is TBD -// Latency returns a MetricLatency -func (obj *flowMetric) HasLatency() bool { - return obj.obj.Latency != nil -} - -// description is TBD -// SetLatency sets the MetricLatency value in the FlowMetric object -func (obj *flowMetric) SetLatency(value MetricLatency) FlowMetric { - - obj.latencyHolder = nil - obj.obj.Latency = value.msg() - - return obj -} - -// List of metrics corresponding to a set of values applicable -// for configured metric tags in ingress or egress packet header fields of corresponding flow. -// The container is keyed by list of tag-value pairs. -// TaggedMetrics returns a []FlowTaggedMetric -func (obj *flowMetric) TaggedMetrics() FlowMetricFlowTaggedMetricIter { - if len(obj.obj.TaggedMetrics) == 0 { - obj.obj.TaggedMetrics = []*otg.FlowTaggedMetric{} - } - if obj.taggedMetricsHolder == nil { - obj.taggedMetricsHolder = newFlowMetricFlowTaggedMetricIter(&obj.obj.TaggedMetrics).setMsg(obj) - } - return obj.taggedMetricsHolder -} - -type flowMetricFlowTaggedMetricIter struct { - obj *flowMetric - flowTaggedMetricSlice []FlowTaggedMetric - fieldPtr *[]*otg.FlowTaggedMetric -} - -func newFlowMetricFlowTaggedMetricIter(ptr *[]*otg.FlowTaggedMetric) FlowMetricFlowTaggedMetricIter { - return &flowMetricFlowTaggedMetricIter{fieldPtr: ptr} -} - -type FlowMetricFlowTaggedMetricIter interface { - setMsg(*flowMetric) FlowMetricFlowTaggedMetricIter - Items() []FlowTaggedMetric - Add() FlowTaggedMetric - Append(items ...FlowTaggedMetric) FlowMetricFlowTaggedMetricIter - Set(index int, newObj FlowTaggedMetric) FlowMetricFlowTaggedMetricIter - Clear() FlowMetricFlowTaggedMetricIter - clearHolderSlice() FlowMetricFlowTaggedMetricIter - appendHolderSlice(item FlowTaggedMetric) FlowMetricFlowTaggedMetricIter -} - -func (obj *flowMetricFlowTaggedMetricIter) setMsg(msg *flowMetric) FlowMetricFlowTaggedMetricIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flowTaggedMetric{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *flowMetricFlowTaggedMetricIter) Items() []FlowTaggedMetric { - return obj.flowTaggedMetricSlice -} - -func (obj *flowMetricFlowTaggedMetricIter) Add() FlowTaggedMetric { - newObj := &otg.FlowTaggedMetric{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flowTaggedMetric{obj: newObj} - newLibObj.setDefault() - obj.flowTaggedMetricSlice = append(obj.flowTaggedMetricSlice, newLibObj) - return newLibObj -} - -func (obj *flowMetricFlowTaggedMetricIter) Append(items ...FlowTaggedMetric) FlowMetricFlowTaggedMetricIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowTaggedMetricSlice = append(obj.flowTaggedMetricSlice, item) - } - return obj -} - -func (obj *flowMetricFlowTaggedMetricIter) Set(index int, newObj FlowTaggedMetric) FlowMetricFlowTaggedMetricIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowTaggedMetricSlice[index] = newObj - return obj -} -func (obj *flowMetricFlowTaggedMetricIter) Clear() FlowMetricFlowTaggedMetricIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.FlowTaggedMetric{} - obj.flowTaggedMetricSlice = []FlowTaggedMetric{} - } - return obj -} -func (obj *flowMetricFlowTaggedMetricIter) clearHolderSlice() FlowMetricFlowTaggedMetricIter { - if len(obj.flowTaggedMetricSlice) > 0 { - obj.flowTaggedMetricSlice = []FlowTaggedMetric{} - } - return obj -} -func (obj *flowMetricFlowTaggedMetricIter) appendHolderSlice(item FlowTaggedMetric) FlowMetricFlowTaggedMetricIter { - obj.flowTaggedMetricSlice = append(obj.flowTaggedMetricSlice, item) - return obj -} - -func (obj *flowMetric) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Timestamps != nil { - - obj.Timestamps().validateObj(vObj, set_default) - } - - if obj.obj.Latency != nil { - - obj.Latency().validateObj(vObj, set_default) - } - - if len(obj.obj.TaggedMetrics) != 0 { - - if set_default { - obj.TaggedMetrics().clearHolderSlice() - for _, item := range obj.obj.TaggedMetrics { - obj.TaggedMetrics().appendHolderSlice(&flowTaggedMetric{obj: item}) - } - } - for _, item := range obj.TaggedMetrics().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *flowMetric) setDefault() { - -} - -// ***** Bgpv4Metric ***** -type bgpv4Metric struct { - validation - obj *otg.Bgpv4Metric - marshaller marshalBgpv4Metric - unMarshaller unMarshalBgpv4Metric -} - -func NewBgpv4Metric() Bgpv4Metric { - obj := bgpv4Metric{obj: &otg.Bgpv4Metric{}} - obj.setDefault() - return &obj -} - -func (obj *bgpv4Metric) msg() *otg.Bgpv4Metric { - return obj.obj -} - -func (obj *bgpv4Metric) setMsg(msg *otg.Bgpv4Metric) Bgpv4Metric { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpv4Metric struct { - obj *bgpv4Metric -} - -type marshalBgpv4Metric interface { - // ToProto marshals Bgpv4Metric to protobuf object *otg.Bgpv4Metric - ToProto() (*otg.Bgpv4Metric, error) - // ToPbText marshals Bgpv4Metric to protobuf text - ToPbText() (string, error) - // ToYaml marshals Bgpv4Metric to YAML text - ToYaml() (string, error) - // ToJson marshals Bgpv4Metric to JSON text - ToJson() (string, error) -} - -type unMarshalbgpv4Metric struct { - obj *bgpv4Metric -} - -type unMarshalBgpv4Metric interface { - // FromProto unmarshals Bgpv4Metric from protobuf object *otg.Bgpv4Metric - FromProto(msg *otg.Bgpv4Metric) (Bgpv4Metric, error) - // FromPbText unmarshals Bgpv4Metric from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Bgpv4Metric from YAML text - FromYaml(value string) error - // FromJson unmarshals Bgpv4Metric from JSON text - FromJson(value string) error -} - -func (obj *bgpv4Metric) Marshal() marshalBgpv4Metric { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpv4Metric{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpv4Metric) Unmarshal() unMarshalBgpv4Metric { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpv4Metric{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpv4Metric) ToProto() (*otg.Bgpv4Metric, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpv4Metric) FromProto(msg *otg.Bgpv4Metric) (Bgpv4Metric, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpv4Metric) 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 *unMarshalbgpv4Metric) 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 *marshalbgpv4Metric) 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 *unMarshalbgpv4Metric) 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 *marshalbgpv4Metric) 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 *unMarshalbgpv4Metric) 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 *bgpv4Metric) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpv4Metric) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpv4Metric) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpv4Metric) Clone() (Bgpv4Metric, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpv4Metric() - 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 -} - -// Bgpv4Metric is bGPv4 per peer statistics information. -type Bgpv4Metric interface { - Validation - // msg marshals Bgpv4Metric to protobuf object *otg.Bgpv4Metric - // and doesn't set defaults - msg() *otg.Bgpv4Metric - // setMsg unmarshals Bgpv4Metric from protobuf object *otg.Bgpv4Metric - // and doesn't set defaults - setMsg(*otg.Bgpv4Metric) Bgpv4Metric - // provides marshal interface - Marshal() marshalBgpv4Metric - // provides unmarshal interface - Unmarshal() unMarshalBgpv4Metric - // validate validates Bgpv4Metric - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Bgpv4Metric, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in Bgpv4Metric. - Name() string - // SetName assigns string provided by user to Bgpv4Metric - SetName(value string) Bgpv4Metric - // HasName checks if Name has been set in Bgpv4Metric - HasName() bool - // SessionState returns Bgpv4MetricSessionStateEnum, set in Bgpv4Metric - SessionState() Bgpv4MetricSessionStateEnum - // SetSessionState assigns Bgpv4MetricSessionStateEnum provided by user to Bgpv4Metric - SetSessionState(value Bgpv4MetricSessionStateEnum) Bgpv4Metric - // HasSessionState checks if SessionState has been set in Bgpv4Metric - HasSessionState() bool - // SessionFlapCount returns uint64, set in Bgpv4Metric. - SessionFlapCount() uint64 - // SetSessionFlapCount assigns uint64 provided by user to Bgpv4Metric - SetSessionFlapCount(value uint64) Bgpv4Metric - // HasSessionFlapCount checks if SessionFlapCount has been set in Bgpv4Metric - HasSessionFlapCount() bool - // RoutesAdvertised returns uint64, set in Bgpv4Metric. - RoutesAdvertised() uint64 - // SetRoutesAdvertised assigns uint64 provided by user to Bgpv4Metric - SetRoutesAdvertised(value uint64) Bgpv4Metric - // HasRoutesAdvertised checks if RoutesAdvertised has been set in Bgpv4Metric - HasRoutesAdvertised() bool - // RoutesReceived returns uint64, set in Bgpv4Metric. - RoutesReceived() uint64 - // SetRoutesReceived assigns uint64 provided by user to Bgpv4Metric - SetRoutesReceived(value uint64) Bgpv4Metric - // HasRoutesReceived checks if RoutesReceived has been set in Bgpv4Metric - HasRoutesReceived() bool - // RouteWithdrawsSent returns uint64, set in Bgpv4Metric. - RouteWithdrawsSent() uint64 - // SetRouteWithdrawsSent assigns uint64 provided by user to Bgpv4Metric - SetRouteWithdrawsSent(value uint64) Bgpv4Metric - // HasRouteWithdrawsSent checks if RouteWithdrawsSent has been set in Bgpv4Metric - HasRouteWithdrawsSent() bool - // RouteWithdrawsReceived returns uint64, set in Bgpv4Metric. - RouteWithdrawsReceived() uint64 - // SetRouteWithdrawsReceived assigns uint64 provided by user to Bgpv4Metric - SetRouteWithdrawsReceived(value uint64) Bgpv4Metric - // HasRouteWithdrawsReceived checks if RouteWithdrawsReceived has been set in Bgpv4Metric - HasRouteWithdrawsReceived() bool - // UpdatesSent returns uint64, set in Bgpv4Metric. - UpdatesSent() uint64 - // SetUpdatesSent assigns uint64 provided by user to Bgpv4Metric - SetUpdatesSent(value uint64) Bgpv4Metric - // HasUpdatesSent checks if UpdatesSent has been set in Bgpv4Metric - HasUpdatesSent() bool - // UpdatesReceived returns uint64, set in Bgpv4Metric. - UpdatesReceived() uint64 - // SetUpdatesReceived assigns uint64 provided by user to Bgpv4Metric - SetUpdatesReceived(value uint64) Bgpv4Metric - // HasUpdatesReceived checks if UpdatesReceived has been set in Bgpv4Metric - HasUpdatesReceived() bool - // OpensSent returns uint64, set in Bgpv4Metric. - OpensSent() uint64 - // SetOpensSent assigns uint64 provided by user to Bgpv4Metric - SetOpensSent(value uint64) Bgpv4Metric - // HasOpensSent checks if OpensSent has been set in Bgpv4Metric - HasOpensSent() bool - // OpensReceived returns uint64, set in Bgpv4Metric. - OpensReceived() uint64 - // SetOpensReceived assigns uint64 provided by user to Bgpv4Metric - SetOpensReceived(value uint64) Bgpv4Metric - // HasOpensReceived checks if OpensReceived has been set in Bgpv4Metric - HasOpensReceived() bool - // KeepalivesSent returns uint64, set in Bgpv4Metric. - KeepalivesSent() uint64 - // SetKeepalivesSent assigns uint64 provided by user to Bgpv4Metric - SetKeepalivesSent(value uint64) Bgpv4Metric - // HasKeepalivesSent checks if KeepalivesSent has been set in Bgpv4Metric - HasKeepalivesSent() bool - // KeepalivesReceived returns uint64, set in Bgpv4Metric. - KeepalivesReceived() uint64 - // SetKeepalivesReceived assigns uint64 provided by user to Bgpv4Metric - SetKeepalivesReceived(value uint64) Bgpv4Metric - // HasKeepalivesReceived checks if KeepalivesReceived has been set in Bgpv4Metric - HasKeepalivesReceived() bool - // NotificationsSent returns uint64, set in Bgpv4Metric. - NotificationsSent() uint64 - // SetNotificationsSent assigns uint64 provided by user to Bgpv4Metric - SetNotificationsSent(value uint64) Bgpv4Metric - // HasNotificationsSent checks if NotificationsSent has been set in Bgpv4Metric - HasNotificationsSent() bool - // NotificationsReceived returns uint64, set in Bgpv4Metric. - NotificationsReceived() uint64 - // SetNotificationsReceived assigns uint64 provided by user to Bgpv4Metric - SetNotificationsReceived(value uint64) Bgpv4Metric - // HasNotificationsReceived checks if NotificationsReceived has been set in Bgpv4Metric - HasNotificationsReceived() bool - // FsmState returns Bgpv4MetricFsmStateEnum, set in Bgpv4Metric - FsmState() Bgpv4MetricFsmStateEnum - // SetFsmState assigns Bgpv4MetricFsmStateEnum provided by user to Bgpv4Metric - SetFsmState(value Bgpv4MetricFsmStateEnum) Bgpv4Metric - // HasFsmState checks if FsmState has been set in Bgpv4Metric - HasFsmState() bool - // EndOfRibReceived returns uint64, set in Bgpv4Metric. - EndOfRibReceived() uint64 - // SetEndOfRibReceived assigns uint64 provided by user to Bgpv4Metric - SetEndOfRibReceived(value uint64) Bgpv4Metric - // HasEndOfRibReceived checks if EndOfRibReceived has been set in Bgpv4Metric - HasEndOfRibReceived() bool -} - -// The name of a configured BGPv4 peer. -// Name returns a string -func (obj *bgpv4Metric) Name() string { - - return *obj.obj.Name - -} - -// The name of a configured BGPv4 peer. -// Name returns a string -func (obj *bgpv4Metric) HasName() bool { - return obj.obj.Name != nil -} - -// The name of a configured BGPv4 peer. -// SetName sets the string value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetName(value string) Bgpv4Metric { - - obj.obj.Name = &value - return obj -} - -type Bgpv4MetricSessionStateEnum string - -// Enum of SessionState on Bgpv4Metric -var Bgpv4MetricSessionState = struct { - UP Bgpv4MetricSessionStateEnum - DOWN Bgpv4MetricSessionStateEnum -}{ - UP: Bgpv4MetricSessionStateEnum("up"), - DOWN: Bgpv4MetricSessionStateEnum("down"), -} - -func (obj *bgpv4Metric) SessionState() Bgpv4MetricSessionStateEnum { - return Bgpv4MetricSessionStateEnum(obj.obj.SessionState.Enum().String()) -} - -// Session state as up or down. Up refers to an Established state and Down refers to any other state. -// SessionState returns a string -func (obj *bgpv4Metric) HasSessionState() bool { - return obj.obj.SessionState != nil -} - -func (obj *bgpv4Metric) SetSessionState(value Bgpv4MetricSessionStateEnum) Bgpv4Metric { - intValue, ok := otg.Bgpv4Metric_SessionState_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on Bgpv4MetricSessionStateEnum", string(value))) - return obj - } - enumValue := otg.Bgpv4Metric_SessionState_Enum(intValue) - obj.obj.SessionState = &enumValue - - return obj -} - -// Number of times the session went from Up to Down state. -// SessionFlapCount returns a uint64 -func (obj *bgpv4Metric) SessionFlapCount() uint64 { - - return *obj.obj.SessionFlapCount - -} - -// Number of times the session went from Up to Down state. -// SessionFlapCount returns a uint64 -func (obj *bgpv4Metric) HasSessionFlapCount() bool { - return obj.obj.SessionFlapCount != nil -} - -// Number of times the session went from Up to Down state. -// SetSessionFlapCount sets the uint64 value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetSessionFlapCount(value uint64) Bgpv4Metric { - - obj.obj.SessionFlapCount = &value - return obj -} - -// Number of routes advertised. -// RoutesAdvertised returns a uint64 -func (obj *bgpv4Metric) RoutesAdvertised() uint64 { - - return *obj.obj.RoutesAdvertised - -} - -// Number of routes advertised. -// RoutesAdvertised returns a uint64 -func (obj *bgpv4Metric) HasRoutesAdvertised() bool { - return obj.obj.RoutesAdvertised != nil -} - -// Number of routes advertised. -// SetRoutesAdvertised sets the uint64 value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetRoutesAdvertised(value uint64) Bgpv4Metric { - - obj.obj.RoutesAdvertised = &value - return obj -} - -// Number of routes received. -// RoutesReceived returns a uint64 -func (obj *bgpv4Metric) RoutesReceived() uint64 { - - return *obj.obj.RoutesReceived - -} - -// Number of routes received. -// RoutesReceived returns a uint64 -func (obj *bgpv4Metric) HasRoutesReceived() bool { - return obj.obj.RoutesReceived != nil -} - -// Number of routes received. -// SetRoutesReceived sets the uint64 value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetRoutesReceived(value uint64) Bgpv4Metric { - - obj.obj.RoutesReceived = &value - return obj -} - -// Number of route withdraws sent. -// RouteWithdrawsSent returns a uint64 -func (obj *bgpv4Metric) RouteWithdrawsSent() uint64 { - - return *obj.obj.RouteWithdrawsSent - -} - -// Number of route withdraws sent. -// RouteWithdrawsSent returns a uint64 -func (obj *bgpv4Metric) HasRouteWithdrawsSent() bool { - return obj.obj.RouteWithdrawsSent != nil -} - -// Number of route withdraws sent. -// SetRouteWithdrawsSent sets the uint64 value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetRouteWithdrawsSent(value uint64) Bgpv4Metric { - - obj.obj.RouteWithdrawsSent = &value - return obj -} - -// Number of route withdraws received. -// RouteWithdrawsReceived returns a uint64 -func (obj *bgpv4Metric) RouteWithdrawsReceived() uint64 { - - return *obj.obj.RouteWithdrawsReceived - -} - -// Number of route withdraws received. -// RouteWithdrawsReceived returns a uint64 -func (obj *bgpv4Metric) HasRouteWithdrawsReceived() bool { - return obj.obj.RouteWithdrawsReceived != nil -} - -// Number of route withdraws received. -// SetRouteWithdrawsReceived sets the uint64 value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetRouteWithdrawsReceived(value uint64) Bgpv4Metric { - - obj.obj.RouteWithdrawsReceived = &value - return obj -} - -// Number of Update messages sent. -// UpdatesSent returns a uint64 -func (obj *bgpv4Metric) UpdatesSent() uint64 { - - return *obj.obj.UpdatesSent - -} - -// Number of Update messages sent. -// UpdatesSent returns a uint64 -func (obj *bgpv4Metric) HasUpdatesSent() bool { - return obj.obj.UpdatesSent != nil -} - -// Number of Update messages sent. -// SetUpdatesSent sets the uint64 value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetUpdatesSent(value uint64) Bgpv4Metric { - - obj.obj.UpdatesSent = &value - return obj -} - -// Number of Update messages received. -// UpdatesReceived returns a uint64 -func (obj *bgpv4Metric) UpdatesReceived() uint64 { - - return *obj.obj.UpdatesReceived - -} - -// Number of Update messages received. -// UpdatesReceived returns a uint64 -func (obj *bgpv4Metric) HasUpdatesReceived() bool { - return obj.obj.UpdatesReceived != nil -} - -// Number of Update messages received. -// SetUpdatesReceived sets the uint64 value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetUpdatesReceived(value uint64) Bgpv4Metric { - - obj.obj.UpdatesReceived = &value - return obj -} - -// Number of Open messages sent. -// OpensSent returns a uint64 -func (obj *bgpv4Metric) OpensSent() uint64 { - - return *obj.obj.OpensSent - -} - -// Number of Open messages sent. -// OpensSent returns a uint64 -func (obj *bgpv4Metric) HasOpensSent() bool { - return obj.obj.OpensSent != nil -} - -// Number of Open messages sent. -// SetOpensSent sets the uint64 value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetOpensSent(value uint64) Bgpv4Metric { - - obj.obj.OpensSent = &value - return obj -} - -// Number of Open messages received. -// OpensReceived returns a uint64 -func (obj *bgpv4Metric) OpensReceived() uint64 { - - return *obj.obj.OpensReceived - -} - -// Number of Open messages received. -// OpensReceived returns a uint64 -func (obj *bgpv4Metric) HasOpensReceived() bool { - return obj.obj.OpensReceived != nil -} - -// Number of Open messages received. -// SetOpensReceived sets the uint64 value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetOpensReceived(value uint64) Bgpv4Metric { - - obj.obj.OpensReceived = &value - return obj -} - -// Number of Keepalive messages sent. -// KeepalivesSent returns a uint64 -func (obj *bgpv4Metric) KeepalivesSent() uint64 { - - return *obj.obj.KeepalivesSent - -} - -// Number of Keepalive messages sent. -// KeepalivesSent returns a uint64 -func (obj *bgpv4Metric) HasKeepalivesSent() bool { - return obj.obj.KeepalivesSent != nil -} - -// Number of Keepalive messages sent. -// SetKeepalivesSent sets the uint64 value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetKeepalivesSent(value uint64) Bgpv4Metric { - - obj.obj.KeepalivesSent = &value - return obj -} - -// Number of Keepalive messages received. -// KeepalivesReceived returns a uint64 -func (obj *bgpv4Metric) KeepalivesReceived() uint64 { - - return *obj.obj.KeepalivesReceived - -} - -// Number of Keepalive messages received. -// KeepalivesReceived returns a uint64 -func (obj *bgpv4Metric) HasKeepalivesReceived() bool { - return obj.obj.KeepalivesReceived != nil -} - -// Number of Keepalive messages received. -// SetKeepalivesReceived sets the uint64 value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetKeepalivesReceived(value uint64) Bgpv4Metric { - - obj.obj.KeepalivesReceived = &value - return obj -} - -// Number of Notification messages sent. -// NotificationsSent returns a uint64 -func (obj *bgpv4Metric) NotificationsSent() uint64 { - - return *obj.obj.NotificationsSent - -} - -// Number of Notification messages sent. -// NotificationsSent returns a uint64 -func (obj *bgpv4Metric) HasNotificationsSent() bool { - return obj.obj.NotificationsSent != nil -} - -// Number of Notification messages sent. -// SetNotificationsSent sets the uint64 value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetNotificationsSent(value uint64) Bgpv4Metric { - - obj.obj.NotificationsSent = &value - return obj -} - -// Number of Notification messages received. -// NotificationsReceived returns a uint64 -func (obj *bgpv4Metric) NotificationsReceived() uint64 { - - return *obj.obj.NotificationsReceived - -} - -// Number of Notification messages received. -// NotificationsReceived returns a uint64 -func (obj *bgpv4Metric) HasNotificationsReceived() bool { - return obj.obj.NotificationsReceived != nil -} - -// Number of Notification messages received. -// SetNotificationsReceived sets the uint64 value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetNotificationsReceived(value uint64) Bgpv4Metric { - - obj.obj.NotificationsReceived = &value - return obj -} - -type Bgpv4MetricFsmStateEnum string - -// Enum of FsmState on Bgpv4Metric -var Bgpv4MetricFsmState = struct { - IDLE Bgpv4MetricFsmStateEnum - CONNECT Bgpv4MetricFsmStateEnum - ACTIVE Bgpv4MetricFsmStateEnum - OPENSENT Bgpv4MetricFsmStateEnum - OPENCONFIRM Bgpv4MetricFsmStateEnum - ESTABLISHED Bgpv4MetricFsmStateEnum -}{ - IDLE: Bgpv4MetricFsmStateEnum("idle"), - CONNECT: Bgpv4MetricFsmStateEnum("connect"), - ACTIVE: Bgpv4MetricFsmStateEnum("active"), - OPENSENT: Bgpv4MetricFsmStateEnum("opensent"), - OPENCONFIRM: Bgpv4MetricFsmStateEnum("openconfirm"), - ESTABLISHED: Bgpv4MetricFsmStateEnum("established"), -} - -func (obj *bgpv4Metric) FsmState() Bgpv4MetricFsmStateEnum { - return Bgpv4MetricFsmStateEnum(obj.obj.FsmState.Enum().String()) -} - -// BGP peer FSM (Finite State Machine) state as Idle, Connect, Active, OpenSent, OpenConfirm and Established. In all the states except Established the BGP session is down. Idle refers to the Idle state of the FSM. Connect refers to the state where the session is waiting for the underlying transport session to be established. Active refers to the state where the session is awaiting for a connection from the remote peer. OpenSent refers to the state where the session is in the process of being established. The local system has sent an OPEN message. OpenConfirm refers to the state where the session is in the process of being established. The local system has sent and received an OPEN message and is awaiting a NOTIFICATION or KEEPALIVE message from remote peer. Established refers to the state where the BGP session with the peer is established. -// FsmState returns a string -func (obj *bgpv4Metric) HasFsmState() bool { - return obj.obj.FsmState != nil -} - -func (obj *bgpv4Metric) SetFsmState(value Bgpv4MetricFsmStateEnum) Bgpv4Metric { - intValue, ok := otg.Bgpv4Metric_FsmState_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on Bgpv4MetricFsmStateEnum", string(value))) - return obj - } - enumValue := otg.Bgpv4Metric_FsmState_Enum(intValue) - obj.obj.FsmState = &enumValue - - return obj -} - -// Number of End-of-RIB markers received indicating the completion of the initial routing update for a particular address family after the session is established. For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message with the minimum length. For any other address family, it is an UPDATE message that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for that . -// EndOfRibReceived returns a uint64 -func (obj *bgpv4Metric) EndOfRibReceived() uint64 { - - return *obj.obj.EndOfRibReceived - -} - -// Number of End-of-RIB markers received indicating the completion of the initial routing update for a particular address family after the session is established. For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message with the minimum length. For any other address family, it is an UPDATE message that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for that . -// EndOfRibReceived returns a uint64 -func (obj *bgpv4Metric) HasEndOfRibReceived() bool { - return obj.obj.EndOfRibReceived != nil -} - -// Number of End-of-RIB markers received indicating the completion of the initial routing update for a particular address family after the session is established. For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message with the minimum length. For any other address family, it is an UPDATE message that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for that . -// SetEndOfRibReceived sets the uint64 value in the Bgpv4Metric object -func (obj *bgpv4Metric) SetEndOfRibReceived(value uint64) Bgpv4Metric { - - obj.obj.EndOfRibReceived = &value - return obj -} - -func (obj *bgpv4Metric) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpv4Metric) setDefault() { - -} - -// ***** Bgpv6Metric ***** -type bgpv6Metric struct { - validation - obj *otg.Bgpv6Metric - marshaller marshalBgpv6Metric - unMarshaller unMarshalBgpv6Metric -} - -func NewBgpv6Metric() Bgpv6Metric { - obj := bgpv6Metric{obj: &otg.Bgpv6Metric{}} - obj.setDefault() - return &obj -} - -func (obj *bgpv6Metric) msg() *otg.Bgpv6Metric { - return obj.obj -} - -func (obj *bgpv6Metric) setMsg(msg *otg.Bgpv6Metric) Bgpv6Metric { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpv6Metric struct { - obj *bgpv6Metric -} - -type marshalBgpv6Metric interface { - // ToProto marshals Bgpv6Metric to protobuf object *otg.Bgpv6Metric - ToProto() (*otg.Bgpv6Metric, error) - // ToPbText marshals Bgpv6Metric to protobuf text - ToPbText() (string, error) - // ToYaml marshals Bgpv6Metric to YAML text - ToYaml() (string, error) - // ToJson marshals Bgpv6Metric to JSON text - ToJson() (string, error) -} - -type unMarshalbgpv6Metric struct { - obj *bgpv6Metric -} - -type unMarshalBgpv6Metric interface { - // FromProto unmarshals Bgpv6Metric from protobuf object *otg.Bgpv6Metric - FromProto(msg *otg.Bgpv6Metric) (Bgpv6Metric, error) - // FromPbText unmarshals Bgpv6Metric from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Bgpv6Metric from YAML text - FromYaml(value string) error - // FromJson unmarshals Bgpv6Metric from JSON text - FromJson(value string) error -} - -func (obj *bgpv6Metric) Marshal() marshalBgpv6Metric { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpv6Metric{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpv6Metric) Unmarshal() unMarshalBgpv6Metric { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpv6Metric{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpv6Metric) ToProto() (*otg.Bgpv6Metric, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpv6Metric) FromProto(msg *otg.Bgpv6Metric) (Bgpv6Metric, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpv6Metric) 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 *unMarshalbgpv6Metric) 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 *marshalbgpv6Metric) 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 *unMarshalbgpv6Metric) 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 *marshalbgpv6Metric) 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 *unMarshalbgpv6Metric) 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 *bgpv6Metric) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpv6Metric) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpv6Metric) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpv6Metric) Clone() (Bgpv6Metric, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpv6Metric() - 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 -} - -// Bgpv6Metric is bGPv6 per peer statistics information. -type Bgpv6Metric interface { - Validation - // msg marshals Bgpv6Metric to protobuf object *otg.Bgpv6Metric - // and doesn't set defaults - msg() *otg.Bgpv6Metric - // setMsg unmarshals Bgpv6Metric from protobuf object *otg.Bgpv6Metric - // and doesn't set defaults - setMsg(*otg.Bgpv6Metric) Bgpv6Metric - // provides marshal interface - Marshal() marshalBgpv6Metric - // provides unmarshal interface - Unmarshal() unMarshalBgpv6Metric - // validate validates Bgpv6Metric - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Bgpv6Metric, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in Bgpv6Metric. - Name() string - // SetName assigns string provided by user to Bgpv6Metric - SetName(value string) Bgpv6Metric - // HasName checks if Name has been set in Bgpv6Metric - HasName() bool - // SessionState returns Bgpv6MetricSessionStateEnum, set in Bgpv6Metric - SessionState() Bgpv6MetricSessionStateEnum - // SetSessionState assigns Bgpv6MetricSessionStateEnum provided by user to Bgpv6Metric - SetSessionState(value Bgpv6MetricSessionStateEnum) Bgpv6Metric - // HasSessionState checks if SessionState has been set in Bgpv6Metric - HasSessionState() bool - // SessionFlapCount returns uint64, set in Bgpv6Metric. - SessionFlapCount() uint64 - // SetSessionFlapCount assigns uint64 provided by user to Bgpv6Metric - SetSessionFlapCount(value uint64) Bgpv6Metric - // HasSessionFlapCount checks if SessionFlapCount has been set in Bgpv6Metric - HasSessionFlapCount() bool - // RoutesAdvertised returns uint64, set in Bgpv6Metric. - RoutesAdvertised() uint64 - // SetRoutesAdvertised assigns uint64 provided by user to Bgpv6Metric - SetRoutesAdvertised(value uint64) Bgpv6Metric - // HasRoutesAdvertised checks if RoutesAdvertised has been set in Bgpv6Metric - HasRoutesAdvertised() bool - // RoutesReceived returns uint64, set in Bgpv6Metric. - RoutesReceived() uint64 - // SetRoutesReceived assigns uint64 provided by user to Bgpv6Metric - SetRoutesReceived(value uint64) Bgpv6Metric - // HasRoutesReceived checks if RoutesReceived has been set in Bgpv6Metric - HasRoutesReceived() bool - // RouteWithdrawsSent returns uint64, set in Bgpv6Metric. - RouteWithdrawsSent() uint64 - // SetRouteWithdrawsSent assigns uint64 provided by user to Bgpv6Metric - SetRouteWithdrawsSent(value uint64) Bgpv6Metric - // HasRouteWithdrawsSent checks if RouteWithdrawsSent has been set in Bgpv6Metric - HasRouteWithdrawsSent() bool - // RouteWithdrawsReceived returns uint64, set in Bgpv6Metric. - RouteWithdrawsReceived() uint64 - // SetRouteWithdrawsReceived assigns uint64 provided by user to Bgpv6Metric - SetRouteWithdrawsReceived(value uint64) Bgpv6Metric - // HasRouteWithdrawsReceived checks if RouteWithdrawsReceived has been set in Bgpv6Metric - HasRouteWithdrawsReceived() bool - // UpdatesSent returns uint64, set in Bgpv6Metric. - UpdatesSent() uint64 - // SetUpdatesSent assigns uint64 provided by user to Bgpv6Metric - SetUpdatesSent(value uint64) Bgpv6Metric - // HasUpdatesSent checks if UpdatesSent has been set in Bgpv6Metric - HasUpdatesSent() bool - // UpdatesReceived returns uint64, set in Bgpv6Metric. - UpdatesReceived() uint64 - // SetUpdatesReceived assigns uint64 provided by user to Bgpv6Metric - SetUpdatesReceived(value uint64) Bgpv6Metric - // HasUpdatesReceived checks if UpdatesReceived has been set in Bgpv6Metric - HasUpdatesReceived() bool - // OpensSent returns uint64, set in Bgpv6Metric. - OpensSent() uint64 - // SetOpensSent assigns uint64 provided by user to Bgpv6Metric - SetOpensSent(value uint64) Bgpv6Metric - // HasOpensSent checks if OpensSent has been set in Bgpv6Metric - HasOpensSent() bool - // OpensReceived returns uint64, set in Bgpv6Metric. - OpensReceived() uint64 - // SetOpensReceived assigns uint64 provided by user to Bgpv6Metric - SetOpensReceived(value uint64) Bgpv6Metric - // HasOpensReceived checks if OpensReceived has been set in Bgpv6Metric - HasOpensReceived() bool - // KeepalivesSent returns uint64, set in Bgpv6Metric. - KeepalivesSent() uint64 - // SetKeepalivesSent assigns uint64 provided by user to Bgpv6Metric - SetKeepalivesSent(value uint64) Bgpv6Metric - // HasKeepalivesSent checks if KeepalivesSent has been set in Bgpv6Metric - HasKeepalivesSent() bool - // KeepalivesReceived returns uint64, set in Bgpv6Metric. - KeepalivesReceived() uint64 - // SetKeepalivesReceived assigns uint64 provided by user to Bgpv6Metric - SetKeepalivesReceived(value uint64) Bgpv6Metric - // HasKeepalivesReceived checks if KeepalivesReceived has been set in Bgpv6Metric - HasKeepalivesReceived() bool - // NotificationsSent returns uint64, set in Bgpv6Metric. - NotificationsSent() uint64 - // SetNotificationsSent assigns uint64 provided by user to Bgpv6Metric - SetNotificationsSent(value uint64) Bgpv6Metric - // HasNotificationsSent checks if NotificationsSent has been set in Bgpv6Metric - HasNotificationsSent() bool - // NotificationsReceived returns uint64, set in Bgpv6Metric. - NotificationsReceived() uint64 - // SetNotificationsReceived assigns uint64 provided by user to Bgpv6Metric - SetNotificationsReceived(value uint64) Bgpv6Metric - // HasNotificationsReceived checks if NotificationsReceived has been set in Bgpv6Metric - HasNotificationsReceived() bool - // FsmState returns Bgpv6MetricFsmStateEnum, set in Bgpv6Metric - FsmState() Bgpv6MetricFsmStateEnum - // SetFsmState assigns Bgpv6MetricFsmStateEnum provided by user to Bgpv6Metric - SetFsmState(value Bgpv6MetricFsmStateEnum) Bgpv6Metric - // HasFsmState checks if FsmState has been set in Bgpv6Metric - HasFsmState() bool - // EndOfRibReceived returns uint64, set in Bgpv6Metric. - EndOfRibReceived() uint64 - // SetEndOfRibReceived assigns uint64 provided by user to Bgpv6Metric - SetEndOfRibReceived(value uint64) Bgpv6Metric - // HasEndOfRibReceived checks if EndOfRibReceived has been set in Bgpv6Metric - HasEndOfRibReceived() bool -} - -// The name of a configured BGPv6 peer. -// Name returns a string -func (obj *bgpv6Metric) Name() string { - - return *obj.obj.Name - -} - -// The name of a configured BGPv6 peer. -// Name returns a string -func (obj *bgpv6Metric) HasName() bool { - return obj.obj.Name != nil -} - -// The name of a configured BGPv6 peer. -// SetName sets the string value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetName(value string) Bgpv6Metric { - - obj.obj.Name = &value - return obj -} - -type Bgpv6MetricSessionStateEnum string - -// Enum of SessionState on Bgpv6Metric -var Bgpv6MetricSessionState = struct { - UP Bgpv6MetricSessionStateEnum - DOWN Bgpv6MetricSessionStateEnum -}{ - UP: Bgpv6MetricSessionStateEnum("up"), - DOWN: Bgpv6MetricSessionStateEnum("down"), -} - -func (obj *bgpv6Metric) SessionState() Bgpv6MetricSessionStateEnum { - return Bgpv6MetricSessionStateEnum(obj.obj.SessionState.Enum().String()) -} - -// Session state as up or down. Up refers to an Established state and Down refers to any other state. -// SessionState returns a string -func (obj *bgpv6Metric) HasSessionState() bool { - return obj.obj.SessionState != nil -} - -func (obj *bgpv6Metric) SetSessionState(value Bgpv6MetricSessionStateEnum) Bgpv6Metric { - intValue, ok := otg.Bgpv6Metric_SessionState_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on Bgpv6MetricSessionStateEnum", string(value))) - return obj - } - enumValue := otg.Bgpv6Metric_SessionState_Enum(intValue) - obj.obj.SessionState = &enumValue - - return obj -} - -// Number of times the session went from Up to Down state. -// SessionFlapCount returns a uint64 -func (obj *bgpv6Metric) SessionFlapCount() uint64 { - - return *obj.obj.SessionFlapCount - -} - -// Number of times the session went from Up to Down state. -// SessionFlapCount returns a uint64 -func (obj *bgpv6Metric) HasSessionFlapCount() bool { - return obj.obj.SessionFlapCount != nil -} - -// Number of times the session went from Up to Down state. -// SetSessionFlapCount sets the uint64 value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetSessionFlapCount(value uint64) Bgpv6Metric { - - obj.obj.SessionFlapCount = &value - return obj -} - -// Number of routes advertised. -// RoutesAdvertised returns a uint64 -func (obj *bgpv6Metric) RoutesAdvertised() uint64 { - - return *obj.obj.RoutesAdvertised - -} - -// Number of routes advertised. -// RoutesAdvertised returns a uint64 -func (obj *bgpv6Metric) HasRoutesAdvertised() bool { - return obj.obj.RoutesAdvertised != nil -} - -// Number of routes advertised. -// SetRoutesAdvertised sets the uint64 value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetRoutesAdvertised(value uint64) Bgpv6Metric { - - obj.obj.RoutesAdvertised = &value - return obj -} - -// Number of routes received. -// RoutesReceived returns a uint64 -func (obj *bgpv6Metric) RoutesReceived() uint64 { - - return *obj.obj.RoutesReceived - -} - -// Number of routes received. -// RoutesReceived returns a uint64 -func (obj *bgpv6Metric) HasRoutesReceived() bool { - return obj.obj.RoutesReceived != nil -} - -// Number of routes received. -// SetRoutesReceived sets the uint64 value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetRoutesReceived(value uint64) Bgpv6Metric { - - obj.obj.RoutesReceived = &value - return obj -} - -// Number of route withdraws sent. -// RouteWithdrawsSent returns a uint64 -func (obj *bgpv6Metric) RouteWithdrawsSent() uint64 { - - return *obj.obj.RouteWithdrawsSent - -} - -// Number of route withdraws sent. -// RouteWithdrawsSent returns a uint64 -func (obj *bgpv6Metric) HasRouteWithdrawsSent() bool { - return obj.obj.RouteWithdrawsSent != nil -} - -// Number of route withdraws sent. -// SetRouteWithdrawsSent sets the uint64 value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetRouteWithdrawsSent(value uint64) Bgpv6Metric { - - obj.obj.RouteWithdrawsSent = &value - return obj -} - -// Number of route withdraws received. -// RouteWithdrawsReceived returns a uint64 -func (obj *bgpv6Metric) RouteWithdrawsReceived() uint64 { - - return *obj.obj.RouteWithdrawsReceived - -} - -// Number of route withdraws received. -// RouteWithdrawsReceived returns a uint64 -func (obj *bgpv6Metric) HasRouteWithdrawsReceived() bool { - return obj.obj.RouteWithdrawsReceived != nil -} - -// Number of route withdraws received. -// SetRouteWithdrawsReceived sets the uint64 value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetRouteWithdrawsReceived(value uint64) Bgpv6Metric { - - obj.obj.RouteWithdrawsReceived = &value - return obj -} - -// Number of Update messages sent. -// UpdatesSent returns a uint64 -func (obj *bgpv6Metric) UpdatesSent() uint64 { - - return *obj.obj.UpdatesSent - -} - -// Number of Update messages sent. -// UpdatesSent returns a uint64 -func (obj *bgpv6Metric) HasUpdatesSent() bool { - return obj.obj.UpdatesSent != nil -} - -// Number of Update messages sent. -// SetUpdatesSent sets the uint64 value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetUpdatesSent(value uint64) Bgpv6Metric { - - obj.obj.UpdatesSent = &value - return obj -} - -// Number of Update messages received. -// UpdatesReceived returns a uint64 -func (obj *bgpv6Metric) UpdatesReceived() uint64 { - - return *obj.obj.UpdatesReceived - -} - -// Number of Update messages received. -// UpdatesReceived returns a uint64 -func (obj *bgpv6Metric) HasUpdatesReceived() bool { - return obj.obj.UpdatesReceived != nil -} - -// Number of Update messages received. -// SetUpdatesReceived sets the uint64 value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetUpdatesReceived(value uint64) Bgpv6Metric { - - obj.obj.UpdatesReceived = &value - return obj -} - -// Number of Open messages sent. -// OpensSent returns a uint64 -func (obj *bgpv6Metric) OpensSent() uint64 { - - return *obj.obj.OpensSent - -} - -// Number of Open messages sent. -// OpensSent returns a uint64 -func (obj *bgpv6Metric) HasOpensSent() bool { - return obj.obj.OpensSent != nil -} - -// Number of Open messages sent. -// SetOpensSent sets the uint64 value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetOpensSent(value uint64) Bgpv6Metric { - - obj.obj.OpensSent = &value - return obj -} - -// Number of Open messages received. -// OpensReceived returns a uint64 -func (obj *bgpv6Metric) OpensReceived() uint64 { - - return *obj.obj.OpensReceived - -} - -// Number of Open messages received. -// OpensReceived returns a uint64 -func (obj *bgpv6Metric) HasOpensReceived() bool { - return obj.obj.OpensReceived != nil -} - -// Number of Open messages received. -// SetOpensReceived sets the uint64 value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetOpensReceived(value uint64) Bgpv6Metric { - - obj.obj.OpensReceived = &value - return obj -} - -// Number of Keepalive messages sent. -// KeepalivesSent returns a uint64 -func (obj *bgpv6Metric) KeepalivesSent() uint64 { - - return *obj.obj.KeepalivesSent - -} - -// Number of Keepalive messages sent. -// KeepalivesSent returns a uint64 -func (obj *bgpv6Metric) HasKeepalivesSent() bool { - return obj.obj.KeepalivesSent != nil -} - -// Number of Keepalive messages sent. -// SetKeepalivesSent sets the uint64 value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetKeepalivesSent(value uint64) Bgpv6Metric { - - obj.obj.KeepalivesSent = &value - return obj -} - -// Number of Keepalive messages received. -// KeepalivesReceived returns a uint64 -func (obj *bgpv6Metric) KeepalivesReceived() uint64 { - - return *obj.obj.KeepalivesReceived - -} - -// Number of Keepalive messages received. -// KeepalivesReceived returns a uint64 -func (obj *bgpv6Metric) HasKeepalivesReceived() bool { - return obj.obj.KeepalivesReceived != nil -} - -// Number of Keepalive messages received. -// SetKeepalivesReceived sets the uint64 value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetKeepalivesReceived(value uint64) Bgpv6Metric { - - obj.obj.KeepalivesReceived = &value - return obj -} - -// Number of Notification messages sent. -// NotificationsSent returns a uint64 -func (obj *bgpv6Metric) NotificationsSent() uint64 { - - return *obj.obj.NotificationsSent - -} - -// Number of Notification messages sent. -// NotificationsSent returns a uint64 -func (obj *bgpv6Metric) HasNotificationsSent() bool { - return obj.obj.NotificationsSent != nil -} - -// Number of Notification messages sent. -// SetNotificationsSent sets the uint64 value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetNotificationsSent(value uint64) Bgpv6Metric { - - obj.obj.NotificationsSent = &value - return obj -} - -// Number of Notification messages received. -// NotificationsReceived returns a uint64 -func (obj *bgpv6Metric) NotificationsReceived() uint64 { - - return *obj.obj.NotificationsReceived - -} - -// Number of Notification messages received. -// NotificationsReceived returns a uint64 -func (obj *bgpv6Metric) HasNotificationsReceived() bool { - return obj.obj.NotificationsReceived != nil -} - -// Number of Notification messages received. -// SetNotificationsReceived sets the uint64 value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetNotificationsReceived(value uint64) Bgpv6Metric { - - obj.obj.NotificationsReceived = &value - return obj -} - -type Bgpv6MetricFsmStateEnum string - -// Enum of FsmState on Bgpv6Metric -var Bgpv6MetricFsmState = struct { - IDLE Bgpv6MetricFsmStateEnum - CONNECT Bgpv6MetricFsmStateEnum - ACTIVE Bgpv6MetricFsmStateEnum - OPENSENT Bgpv6MetricFsmStateEnum - OPENCONFIRM Bgpv6MetricFsmStateEnum - ESTABLISHED Bgpv6MetricFsmStateEnum -}{ - IDLE: Bgpv6MetricFsmStateEnum("idle"), - CONNECT: Bgpv6MetricFsmStateEnum("connect"), - ACTIVE: Bgpv6MetricFsmStateEnum("active"), - OPENSENT: Bgpv6MetricFsmStateEnum("opensent"), - OPENCONFIRM: Bgpv6MetricFsmStateEnum("openconfirm"), - ESTABLISHED: Bgpv6MetricFsmStateEnum("established"), -} - -func (obj *bgpv6Metric) FsmState() Bgpv6MetricFsmStateEnum { - return Bgpv6MetricFsmStateEnum(obj.obj.FsmState.Enum().String()) -} - -// BGP peer FSM (Finite State Machine) state as Idle, Connect, Active, OpenSent, OpenConfirm and Established. In all the states except Established the BGP session is down. Idle refers to the Idle state of the FSM. Connect refers to the state where the session is waiting for the underlying transport session to be established. Active refers to the state where the session is awaiting for a connection from the remote peer. OpenSent refers to the state where the session is in the process of being established. The local system has sent an OPEN message. OpenConfirm refers to the state where the session is in the process of being established. The local system has sent and received an OPEN message and is awaiting a NOTIFICATION or KEEPALIVE message from remote peer. Established refers to the state where the BGP session with the peer is established. -// FsmState returns a string -func (obj *bgpv6Metric) HasFsmState() bool { - return obj.obj.FsmState != nil -} - -func (obj *bgpv6Metric) SetFsmState(value Bgpv6MetricFsmStateEnum) Bgpv6Metric { - intValue, ok := otg.Bgpv6Metric_FsmState_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on Bgpv6MetricFsmStateEnum", string(value))) - return obj - } - enumValue := otg.Bgpv6Metric_FsmState_Enum(intValue) - obj.obj.FsmState = &enumValue - - return obj -} - -// Number of End-of-RIB markers received indicating the completion of the initial routing update for a particular address family after the session is established. For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message with the minimum length. For any other address family, it is an UPDATE message that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for that . -// EndOfRibReceived returns a uint64 -func (obj *bgpv6Metric) EndOfRibReceived() uint64 { - - return *obj.obj.EndOfRibReceived - -} - -// Number of End-of-RIB markers received indicating the completion of the initial routing update for a particular address family after the session is established. For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message with the minimum length. For any other address family, it is an UPDATE message that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for that . -// EndOfRibReceived returns a uint64 -func (obj *bgpv6Metric) HasEndOfRibReceived() bool { - return obj.obj.EndOfRibReceived != nil -} - -// Number of End-of-RIB markers received indicating the completion of the initial routing update for a particular address family after the session is established. For the IPv4 unicast address family, the End-of-RIB marker is an UPDATE message with the minimum length. For any other address family, it is an UPDATE message that contains only the MP_UNREACH_NLRI attribute with no withdrawn routes for that . -// SetEndOfRibReceived sets the uint64 value in the Bgpv6Metric object -func (obj *bgpv6Metric) SetEndOfRibReceived(value uint64) Bgpv6Metric { - - obj.obj.EndOfRibReceived = &value - return obj -} - -func (obj *bgpv6Metric) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpv6Metric) setDefault() { - -} - -// ***** IsisMetric ***** -type isisMetric struct { - validation - obj *otg.IsisMetric - marshaller marshalIsisMetric - unMarshaller unMarshalIsisMetric -} - -func NewIsisMetric() IsisMetric { - obj := isisMetric{obj: &otg.IsisMetric{}} - obj.setDefault() - return &obj -} - -func (obj *isisMetric) msg() *otg.IsisMetric { - return obj.obj -} - -func (obj *isisMetric) setMsg(msg *otg.IsisMetric) IsisMetric { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisMetric struct { - obj *isisMetric -} - -type marshalIsisMetric interface { - // ToProto marshals IsisMetric to protobuf object *otg.IsisMetric - ToProto() (*otg.IsisMetric, error) - // ToPbText marshals IsisMetric to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisMetric to YAML text - ToYaml() (string, error) - // ToJson marshals IsisMetric to JSON text - ToJson() (string, error) -} - -type unMarshalisisMetric struct { - obj *isisMetric -} - -type unMarshalIsisMetric interface { - // FromProto unmarshals IsisMetric from protobuf object *otg.IsisMetric - FromProto(msg *otg.IsisMetric) (IsisMetric, error) - // FromPbText unmarshals IsisMetric from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisMetric from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisMetric from JSON text - FromJson(value string) error -} - -func (obj *isisMetric) Marshal() marshalIsisMetric { - if obj.marshaller == nil { - obj.marshaller = &marshalisisMetric{obj: obj} - } - return obj.marshaller -} - -func (obj *isisMetric) Unmarshal() unMarshalIsisMetric { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisMetric{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisMetric) ToProto() (*otg.IsisMetric, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisMetric) FromProto(msg *otg.IsisMetric) (IsisMetric, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisMetric) 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 *unMarshalisisMetric) 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 *marshalisisMetric) 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 *unMarshalisisMetric) 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 *marshalisisMetric) 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 *unMarshalisisMetric) 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 *isisMetric) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisMetric) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisMetric) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisMetric) Clone() (IsisMetric, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisMetric() - 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 -} - -// IsisMetric is iSIS per router statistics information. -type IsisMetric interface { - Validation - // msg marshals IsisMetric to protobuf object *otg.IsisMetric - // and doesn't set defaults - msg() *otg.IsisMetric - // setMsg unmarshals IsisMetric from protobuf object *otg.IsisMetric - // and doesn't set defaults - setMsg(*otg.IsisMetric) IsisMetric - // provides marshal interface - Marshal() marshalIsisMetric - // provides unmarshal interface - Unmarshal() unMarshalIsisMetric - // validate validates IsisMetric - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisMetric, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in IsisMetric. - Name() string - // SetName assigns string provided by user to IsisMetric - SetName(value string) IsisMetric - // HasName checks if Name has been set in IsisMetric - HasName() bool - // L1SessionsUp returns uint32, set in IsisMetric. - L1SessionsUp() uint32 - // SetL1SessionsUp assigns uint32 provided by user to IsisMetric - SetL1SessionsUp(value uint32) IsisMetric - // HasL1SessionsUp checks if L1SessionsUp has been set in IsisMetric - HasL1SessionsUp() bool - // L1SessionFlap returns uint64, set in IsisMetric. - L1SessionFlap() uint64 - // SetL1SessionFlap assigns uint64 provided by user to IsisMetric - SetL1SessionFlap(value uint64) IsisMetric - // HasL1SessionFlap checks if L1SessionFlap has been set in IsisMetric - HasL1SessionFlap() bool - // L1BroadcastHellosSent returns uint64, set in IsisMetric. - L1BroadcastHellosSent() uint64 - // SetL1BroadcastHellosSent assigns uint64 provided by user to IsisMetric - SetL1BroadcastHellosSent(value uint64) IsisMetric - // HasL1BroadcastHellosSent checks if L1BroadcastHellosSent has been set in IsisMetric - HasL1BroadcastHellosSent() bool - // L1BroadcastHellosReceived returns uint64, set in IsisMetric. - L1BroadcastHellosReceived() uint64 - // SetL1BroadcastHellosReceived assigns uint64 provided by user to IsisMetric - SetL1BroadcastHellosReceived(value uint64) IsisMetric - // HasL1BroadcastHellosReceived checks if L1BroadcastHellosReceived has been set in IsisMetric - HasL1BroadcastHellosReceived() bool - // L1PointToPointHellosSent returns uint64, set in IsisMetric. - L1PointToPointHellosSent() uint64 - // SetL1PointToPointHellosSent assigns uint64 provided by user to IsisMetric - SetL1PointToPointHellosSent(value uint64) IsisMetric - // HasL1PointToPointHellosSent checks if L1PointToPointHellosSent has been set in IsisMetric - HasL1PointToPointHellosSent() bool - // L1PointToPointHellosReceived returns uint64, set in IsisMetric. - L1PointToPointHellosReceived() uint64 - // SetL1PointToPointHellosReceived assigns uint64 provided by user to IsisMetric - SetL1PointToPointHellosReceived(value uint64) IsisMetric - // HasL1PointToPointHellosReceived checks if L1PointToPointHellosReceived has been set in IsisMetric - HasL1PointToPointHellosReceived() bool - // L1DatabaseSize returns uint64, set in IsisMetric. - L1DatabaseSize() uint64 - // SetL1DatabaseSize assigns uint64 provided by user to IsisMetric - SetL1DatabaseSize(value uint64) IsisMetric - // HasL1DatabaseSize checks if L1DatabaseSize has been set in IsisMetric - HasL1DatabaseSize() bool - // L1PsnpSent returns uint64, set in IsisMetric. - L1PsnpSent() uint64 - // SetL1PsnpSent assigns uint64 provided by user to IsisMetric - SetL1PsnpSent(value uint64) IsisMetric - // HasL1PsnpSent checks if L1PsnpSent has been set in IsisMetric - HasL1PsnpSent() bool - // L1PsnpReceived returns uint64, set in IsisMetric. - L1PsnpReceived() uint64 - // SetL1PsnpReceived assigns uint64 provided by user to IsisMetric - SetL1PsnpReceived(value uint64) IsisMetric - // HasL1PsnpReceived checks if L1PsnpReceived has been set in IsisMetric - HasL1PsnpReceived() bool - // L1CsnpSent returns uint64, set in IsisMetric. - L1CsnpSent() uint64 - // SetL1CsnpSent assigns uint64 provided by user to IsisMetric - SetL1CsnpSent(value uint64) IsisMetric - // HasL1CsnpSent checks if L1CsnpSent has been set in IsisMetric - HasL1CsnpSent() bool - // L1CsnpReceived returns uint64, set in IsisMetric. - L1CsnpReceived() uint64 - // SetL1CsnpReceived assigns uint64 provided by user to IsisMetric - SetL1CsnpReceived(value uint64) IsisMetric - // HasL1CsnpReceived checks if L1CsnpReceived has been set in IsisMetric - HasL1CsnpReceived() bool - // L1LspSent returns uint64, set in IsisMetric. - L1LspSent() uint64 - // SetL1LspSent assigns uint64 provided by user to IsisMetric - SetL1LspSent(value uint64) IsisMetric - // HasL1LspSent checks if L1LspSent has been set in IsisMetric - HasL1LspSent() bool - // L1LspReceived returns uint64, set in IsisMetric. - L1LspReceived() uint64 - // SetL1LspReceived assigns uint64 provided by user to IsisMetric - SetL1LspReceived(value uint64) IsisMetric - // HasL1LspReceived checks if L1LspReceived has been set in IsisMetric - HasL1LspReceived() bool - // L2SessionsUp returns uint32, set in IsisMetric. - L2SessionsUp() uint32 - // SetL2SessionsUp assigns uint32 provided by user to IsisMetric - SetL2SessionsUp(value uint32) IsisMetric - // HasL2SessionsUp checks if L2SessionsUp has been set in IsisMetric - HasL2SessionsUp() bool - // L2SessionFlap returns uint64, set in IsisMetric. - L2SessionFlap() uint64 - // SetL2SessionFlap assigns uint64 provided by user to IsisMetric - SetL2SessionFlap(value uint64) IsisMetric - // HasL2SessionFlap checks if L2SessionFlap has been set in IsisMetric - HasL2SessionFlap() bool - // L2BroadcastHellosSent returns uint64, set in IsisMetric. - L2BroadcastHellosSent() uint64 - // SetL2BroadcastHellosSent assigns uint64 provided by user to IsisMetric - SetL2BroadcastHellosSent(value uint64) IsisMetric - // HasL2BroadcastHellosSent checks if L2BroadcastHellosSent has been set in IsisMetric - HasL2BroadcastHellosSent() bool - // L2BroadcastHellosReceived returns uint64, set in IsisMetric. - L2BroadcastHellosReceived() uint64 - // SetL2BroadcastHellosReceived assigns uint64 provided by user to IsisMetric - SetL2BroadcastHellosReceived(value uint64) IsisMetric - // HasL2BroadcastHellosReceived checks if L2BroadcastHellosReceived has been set in IsisMetric - HasL2BroadcastHellosReceived() bool - // L2PointToPointHellosSent returns uint64, set in IsisMetric. - L2PointToPointHellosSent() uint64 - // SetL2PointToPointHellosSent assigns uint64 provided by user to IsisMetric - SetL2PointToPointHellosSent(value uint64) IsisMetric - // HasL2PointToPointHellosSent checks if L2PointToPointHellosSent has been set in IsisMetric - HasL2PointToPointHellosSent() bool - // L2PointToPointHellosReceived returns uint64, set in IsisMetric. - L2PointToPointHellosReceived() uint64 - // SetL2PointToPointHellosReceived assigns uint64 provided by user to IsisMetric - SetL2PointToPointHellosReceived(value uint64) IsisMetric - // HasL2PointToPointHellosReceived checks if L2PointToPointHellosReceived has been set in IsisMetric - HasL2PointToPointHellosReceived() bool - // L2DatabaseSize returns uint64, set in IsisMetric. - L2DatabaseSize() uint64 - // SetL2DatabaseSize assigns uint64 provided by user to IsisMetric - SetL2DatabaseSize(value uint64) IsisMetric - // HasL2DatabaseSize checks if L2DatabaseSize has been set in IsisMetric - HasL2DatabaseSize() bool - // L2PsnpSent returns uint64, set in IsisMetric. - L2PsnpSent() uint64 - // SetL2PsnpSent assigns uint64 provided by user to IsisMetric - SetL2PsnpSent(value uint64) IsisMetric - // HasL2PsnpSent checks if L2PsnpSent has been set in IsisMetric - HasL2PsnpSent() bool - // L2PsnpReceived returns uint64, set in IsisMetric. - L2PsnpReceived() uint64 - // SetL2PsnpReceived assigns uint64 provided by user to IsisMetric - SetL2PsnpReceived(value uint64) IsisMetric - // HasL2PsnpReceived checks if L2PsnpReceived has been set in IsisMetric - HasL2PsnpReceived() bool - // L2CsnpSent returns uint64, set in IsisMetric. - L2CsnpSent() uint64 - // SetL2CsnpSent assigns uint64 provided by user to IsisMetric - SetL2CsnpSent(value uint64) IsisMetric - // HasL2CsnpSent checks if L2CsnpSent has been set in IsisMetric - HasL2CsnpSent() bool - // L2CsnpReceived returns uint64, set in IsisMetric. - L2CsnpReceived() uint64 - // SetL2CsnpReceived assigns uint64 provided by user to IsisMetric - SetL2CsnpReceived(value uint64) IsisMetric - // HasL2CsnpReceived checks if L2CsnpReceived has been set in IsisMetric - HasL2CsnpReceived() bool - // L2LspSent returns uint64, set in IsisMetric. - L2LspSent() uint64 - // SetL2LspSent assigns uint64 provided by user to IsisMetric - SetL2LspSent(value uint64) IsisMetric - // HasL2LspSent checks if L2LspSent has been set in IsisMetric - HasL2LspSent() bool - // L2LspReceived returns uint64, set in IsisMetric. - L2LspReceived() uint64 - // SetL2LspReceived assigns uint64 provided by user to IsisMetric - SetL2LspReceived(value uint64) IsisMetric - // HasL2LspReceived checks if L2LspReceived has been set in IsisMetric - HasL2LspReceived() bool -} - -// The name of a configured ISIS router. -// Name returns a string -func (obj *isisMetric) Name() string { - - return *obj.obj.Name - -} - -// The name of a configured ISIS router. -// Name returns a string -func (obj *isisMetric) HasName() bool { - return obj.obj.Name != nil -} - -// The name of a configured ISIS router. -// SetName sets the string value in the IsisMetric object -func (obj *isisMetric) SetName(value string) IsisMetric { - - obj.obj.Name = &value - return obj -} - -// The number of Level 1 (L1) sessions that are fully up. -// L1SessionsUp returns a uint32 -func (obj *isisMetric) L1SessionsUp() uint32 { - - return *obj.obj.L1SessionsUp - -} - -// The number of Level 1 (L1) sessions that are fully up. -// L1SessionsUp returns a uint32 -func (obj *isisMetric) HasL1SessionsUp() bool { - return obj.obj.L1SessionsUp != nil -} - -// The number of Level 1 (L1) sessions that are fully up. -// SetL1SessionsUp sets the uint32 value in the IsisMetric object -func (obj *isisMetric) SetL1SessionsUp(value uint32) IsisMetric { - - obj.obj.L1SessionsUp = &value - return obj -} - -// The number of Level 1 Sessions Flap. -// L1SessionFlap returns a uint64 -func (obj *isisMetric) L1SessionFlap() uint64 { - - return *obj.obj.L1SessionFlap - -} - -// The number of Level 1 Sessions Flap. -// L1SessionFlap returns a uint64 -func (obj *isisMetric) HasL1SessionFlap() bool { - return obj.obj.L1SessionFlap != nil -} - -// The number of Level 1 Sessions Flap. -// SetL1SessionFlap sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL1SessionFlap(value uint64) IsisMetric { - - obj.obj.L1SessionFlap = &value - return obj -} - -// Number of Level 1 Hello messages sent. -// L1BroadcastHellosSent returns a uint64 -func (obj *isisMetric) L1BroadcastHellosSent() uint64 { - - return *obj.obj.L1BroadcastHellosSent - -} - -// Number of Level 1 Hello messages sent. -// L1BroadcastHellosSent returns a uint64 -func (obj *isisMetric) HasL1BroadcastHellosSent() bool { - return obj.obj.L1BroadcastHellosSent != nil -} - -// Number of Level 1 Hello messages sent. -// SetL1BroadcastHellosSent sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL1BroadcastHellosSent(value uint64) IsisMetric { - - obj.obj.L1BroadcastHellosSent = &value - return obj -} - -// Number of Level 1 Hello messages received. -// L1BroadcastHellosReceived returns a uint64 -func (obj *isisMetric) L1BroadcastHellosReceived() uint64 { - - return *obj.obj.L1BroadcastHellosReceived - -} - -// Number of Level 1 Hello messages received. -// L1BroadcastHellosReceived returns a uint64 -func (obj *isisMetric) HasL1BroadcastHellosReceived() bool { - return obj.obj.L1BroadcastHellosReceived != nil -} - -// Number of Level 1 Hello messages received. -// SetL1BroadcastHellosReceived sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL1BroadcastHellosReceived(value uint64) IsisMetric { - - obj.obj.L1BroadcastHellosReceived = &value - return obj -} - -// Number of Level 1 Point-to-Point(P2P) Hello messages sent. -// L1PointToPointHellosSent returns a uint64 -func (obj *isisMetric) L1PointToPointHellosSent() uint64 { - - return *obj.obj.L1PointToPointHellosSent - -} - -// Number of Level 1 Point-to-Point(P2P) Hello messages sent. -// L1PointToPointHellosSent returns a uint64 -func (obj *isisMetric) HasL1PointToPointHellosSent() bool { - return obj.obj.L1PointToPointHellosSent != nil -} - -// Number of Level 1 Point-to-Point(P2P) Hello messages sent. -// SetL1PointToPointHellosSent sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL1PointToPointHellosSent(value uint64) IsisMetric { - - obj.obj.L1PointToPointHellosSent = &value - return obj -} - -// Number of Level 1 Point-to-Point(P2P) Hello messages received. -// L1PointToPointHellosReceived returns a uint64 -func (obj *isisMetric) L1PointToPointHellosReceived() uint64 { - - return *obj.obj.L1PointToPointHellosReceived - -} - -// Number of Level 1 Point-to-Point(P2P) Hello messages received. -// L1PointToPointHellosReceived returns a uint64 -func (obj *isisMetric) HasL1PointToPointHellosReceived() bool { - return obj.obj.L1PointToPointHellosReceived != nil -} - -// Number of Level 1 Point-to-Point(P2P) Hello messages received. -// SetL1PointToPointHellosReceived sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL1PointToPointHellosReceived(value uint64) IsisMetric { - - obj.obj.L1PointToPointHellosReceived = &value - return obj -} - -// Number of Link State Updates (LSPs) in the Level 1 LSP Databases. -// L1DatabaseSize returns a uint64 -func (obj *isisMetric) L1DatabaseSize() uint64 { - - return *obj.obj.L1DatabaseSize - -} - -// Number of Link State Updates (LSPs) in the Level 1 LSP Databases. -// L1DatabaseSize returns a uint64 -func (obj *isisMetric) HasL1DatabaseSize() bool { - return obj.obj.L1DatabaseSize != nil -} - -// Number of Link State Updates (LSPs) in the Level 1 LSP Databases. -// SetL1DatabaseSize sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL1DatabaseSize(value uint64) IsisMetric { - - obj.obj.L1DatabaseSize = &value - return obj -} - -// Number of Level 1 (L1) Partial Sequence Number Packet (PSNPs) sent. -// L1PsnpSent returns a uint64 -func (obj *isisMetric) L1PsnpSent() uint64 { - - return *obj.obj.L1PsnpSent - -} - -// Number of Level 1 (L1) Partial Sequence Number Packet (PSNPs) sent. -// L1PsnpSent returns a uint64 -func (obj *isisMetric) HasL1PsnpSent() bool { - return obj.obj.L1PsnpSent != nil -} - -// Number of Level 1 (L1) Partial Sequence Number Packet (PSNPs) sent. -// SetL1PsnpSent sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL1PsnpSent(value uint64) IsisMetric { - - obj.obj.L1PsnpSent = &value - return obj -} - -// Number of Level 1 (L1) Complete Sequence Number Packet (PSNPs) received. -// L1PsnpReceived returns a uint64 -func (obj *isisMetric) L1PsnpReceived() uint64 { - - return *obj.obj.L1PsnpReceived - -} - -// Number of Level 1 (L1) Complete Sequence Number Packet (PSNPs) received. -// L1PsnpReceived returns a uint64 -func (obj *isisMetric) HasL1PsnpReceived() bool { - return obj.obj.L1PsnpReceived != nil -} - -// Number of Level 1 (L1) Complete Sequence Number Packet (PSNPs) received. -// SetL1PsnpReceived sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL1PsnpReceived(value uint64) IsisMetric { - - obj.obj.L1PsnpReceived = &value - return obj -} - -// Number of Level 1 (L1) Complete Sequence Number Packet (CSNPs) sent. -// L1CsnpSent returns a uint64 -func (obj *isisMetric) L1CsnpSent() uint64 { - - return *obj.obj.L1CsnpSent - -} - -// Number of Level 1 (L1) Complete Sequence Number Packet (CSNPs) sent. -// L1CsnpSent returns a uint64 -func (obj *isisMetric) HasL1CsnpSent() bool { - return obj.obj.L1CsnpSent != nil -} - -// Number of Level 1 (L1) Complete Sequence Number Packet (CSNPs) sent. -// SetL1CsnpSent sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL1CsnpSent(value uint64) IsisMetric { - - obj.obj.L1CsnpSent = &value - return obj -} - -// Number of Level 1 (L1) Complete Sequence Number Packet (CSNPs) received. -// L1CsnpReceived returns a uint64 -func (obj *isisMetric) L1CsnpReceived() uint64 { - - return *obj.obj.L1CsnpReceived - -} - -// Number of Level 1 (L1) Complete Sequence Number Packet (CSNPs) received. -// L1CsnpReceived returns a uint64 -func (obj *isisMetric) HasL1CsnpReceived() bool { - return obj.obj.L1CsnpReceived != nil -} - -// Number of Level 1 (L1) Complete Sequence Number Packet (CSNPs) received. -// SetL1CsnpReceived sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL1CsnpReceived(value uint64) IsisMetric { - - obj.obj.L1CsnpReceived = &value - return obj -} - -// Number of Level 1 (L1) Link State Protocol Data Units (LSPs) sent. -// L1LspSent returns a uint64 -func (obj *isisMetric) L1LspSent() uint64 { - - return *obj.obj.L1LspSent - -} - -// Number of Level 1 (L1) Link State Protocol Data Units (LSPs) sent. -// L1LspSent returns a uint64 -func (obj *isisMetric) HasL1LspSent() bool { - return obj.obj.L1LspSent != nil -} - -// Number of Level 1 (L1) Link State Protocol Data Units (LSPs) sent. -// SetL1LspSent sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL1LspSent(value uint64) IsisMetric { - - obj.obj.L1LspSent = &value - return obj -} - -// Number of Level 1 (L1) Link State Protocol Data Units (LSPs) received. -// L1LspReceived returns a uint64 -func (obj *isisMetric) L1LspReceived() uint64 { - - return *obj.obj.L1LspReceived - -} - -// Number of Level 1 (L1) Link State Protocol Data Units (LSPs) received. -// L1LspReceived returns a uint64 -func (obj *isisMetric) HasL1LspReceived() bool { - return obj.obj.L1LspReceived != nil -} - -// Number of Level 1 (L1) Link State Protocol Data Units (LSPs) received. -// SetL1LspReceived sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL1LspReceived(value uint64) IsisMetric { - - obj.obj.L1LspReceived = &value - return obj -} - -// The number of Level 2 (L2) sessions that are fully up. -// L2SessionsUp returns a uint32 -func (obj *isisMetric) L2SessionsUp() uint32 { - - return *obj.obj.L2SessionsUp - -} - -// The number of Level 2 (L2) sessions that are fully up. -// L2SessionsUp returns a uint32 -func (obj *isisMetric) HasL2SessionsUp() bool { - return obj.obj.L2SessionsUp != nil -} - -// The number of Level 2 (L2) sessions that are fully up. -// SetL2SessionsUp sets the uint32 value in the IsisMetric object -func (obj *isisMetric) SetL2SessionsUp(value uint32) IsisMetric { - - obj.obj.L2SessionsUp = &value - return obj -} - -// The number of Level 2 Sessions Flap. -// L2SessionFlap returns a uint64 -func (obj *isisMetric) L2SessionFlap() uint64 { - - return *obj.obj.L2SessionFlap - -} - -// The number of Level 2 Sessions Flap. -// L2SessionFlap returns a uint64 -func (obj *isisMetric) HasL2SessionFlap() bool { - return obj.obj.L2SessionFlap != nil -} - -// The number of Level 2 Sessions Flap. -// SetL2SessionFlap sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL2SessionFlap(value uint64) IsisMetric { - - obj.obj.L2SessionFlap = &value - return obj -} - -// Number of Level 2 Hello messages sent. -// L2BroadcastHellosSent returns a uint64 -func (obj *isisMetric) L2BroadcastHellosSent() uint64 { - - return *obj.obj.L2BroadcastHellosSent - -} - -// Number of Level 2 Hello messages sent. -// L2BroadcastHellosSent returns a uint64 -func (obj *isisMetric) HasL2BroadcastHellosSent() bool { - return obj.obj.L2BroadcastHellosSent != nil -} - -// Number of Level 2 Hello messages sent. -// SetL2BroadcastHellosSent sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL2BroadcastHellosSent(value uint64) IsisMetric { - - obj.obj.L2BroadcastHellosSent = &value - return obj -} - -// Number of Level 2 Hello messages received. -// L2BroadcastHellosReceived returns a uint64 -func (obj *isisMetric) L2BroadcastHellosReceived() uint64 { - - return *obj.obj.L2BroadcastHellosReceived - -} - -// Number of Level 2 Hello messages received. -// L2BroadcastHellosReceived returns a uint64 -func (obj *isisMetric) HasL2BroadcastHellosReceived() bool { - return obj.obj.L2BroadcastHellosReceived != nil -} - -// Number of Level 2 Hello messages received. -// SetL2BroadcastHellosReceived sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL2BroadcastHellosReceived(value uint64) IsisMetric { - - obj.obj.L2BroadcastHellosReceived = &value - return obj -} - -// Number of Level 2 Point-to-Point(P2P) Hello messages sent. -// L2PointToPointHellosSent returns a uint64 -func (obj *isisMetric) L2PointToPointHellosSent() uint64 { - - return *obj.obj.L2PointToPointHellosSent - -} - -// Number of Level 2 Point-to-Point(P2P) Hello messages sent. -// L2PointToPointHellosSent returns a uint64 -func (obj *isisMetric) HasL2PointToPointHellosSent() bool { - return obj.obj.L2PointToPointHellosSent != nil -} - -// Number of Level 2 Point-to-Point(P2P) Hello messages sent. -// SetL2PointToPointHellosSent sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL2PointToPointHellosSent(value uint64) IsisMetric { - - obj.obj.L2PointToPointHellosSent = &value - return obj -} - -// Number of Level 2 Point-to-Point(P2P) Hello messages received. -// L2PointToPointHellosReceived returns a uint64 -func (obj *isisMetric) L2PointToPointHellosReceived() uint64 { - - return *obj.obj.L2PointToPointHellosReceived - -} - -// Number of Level 2 Point-to-Point(P2P) Hello messages received. -// L2PointToPointHellosReceived returns a uint64 -func (obj *isisMetric) HasL2PointToPointHellosReceived() bool { - return obj.obj.L2PointToPointHellosReceived != nil -} - -// Number of Level 2 Point-to-Point(P2P) Hello messages received. -// SetL2PointToPointHellosReceived sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL2PointToPointHellosReceived(value uint64) IsisMetric { - - obj.obj.L2PointToPointHellosReceived = &value - return obj -} - -// Number of Link State Updates (LSPs) in the Level 2 LSP Databases. -// L2DatabaseSize returns a uint64 -func (obj *isisMetric) L2DatabaseSize() uint64 { - - return *obj.obj.L2DatabaseSize - -} - -// Number of Link State Updates (LSPs) in the Level 2 LSP Databases. -// L2DatabaseSize returns a uint64 -func (obj *isisMetric) HasL2DatabaseSize() bool { - return obj.obj.L2DatabaseSize != nil -} - -// Number of Link State Updates (LSPs) in the Level 2 LSP Databases. -// SetL2DatabaseSize sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL2DatabaseSize(value uint64) IsisMetric { - - obj.obj.L2DatabaseSize = &value - return obj -} - -// Number of Level 2 (L2) Partial Sequence Number Packet (PSNPs) sent. -// L2PsnpSent returns a uint64 -func (obj *isisMetric) L2PsnpSent() uint64 { - - return *obj.obj.L2PsnpSent - -} - -// Number of Level 2 (L2) Partial Sequence Number Packet (PSNPs) sent. -// L2PsnpSent returns a uint64 -func (obj *isisMetric) HasL2PsnpSent() bool { - return obj.obj.L2PsnpSent != nil -} - -// Number of Level 2 (L2) Partial Sequence Number Packet (PSNPs) sent. -// SetL2PsnpSent sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL2PsnpSent(value uint64) IsisMetric { - - obj.obj.L2PsnpSent = &value - return obj -} - -// Number of Level 2 (L2) Complete Sequence Number Packet (PSNPs) received. -// L2PsnpReceived returns a uint64 -func (obj *isisMetric) L2PsnpReceived() uint64 { - - return *obj.obj.L2PsnpReceived - -} - -// Number of Level 2 (L2) Complete Sequence Number Packet (PSNPs) received. -// L2PsnpReceived returns a uint64 -func (obj *isisMetric) HasL2PsnpReceived() bool { - return obj.obj.L2PsnpReceived != nil -} - -// Number of Level 2 (L2) Complete Sequence Number Packet (PSNPs) received. -// SetL2PsnpReceived sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL2PsnpReceived(value uint64) IsisMetric { - - obj.obj.L2PsnpReceived = &value - return obj -} - -// Number of Level 2 (L2) Complete Sequence Number Packet (CSNPs) sent. -// L2CsnpSent returns a uint64 -func (obj *isisMetric) L2CsnpSent() uint64 { - - return *obj.obj.L2CsnpSent - -} - -// Number of Level 2 (L2) Complete Sequence Number Packet (CSNPs) sent. -// L2CsnpSent returns a uint64 -func (obj *isisMetric) HasL2CsnpSent() bool { - return obj.obj.L2CsnpSent != nil -} - -// Number of Level 2 (L2) Complete Sequence Number Packet (CSNPs) sent. -// SetL2CsnpSent sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL2CsnpSent(value uint64) IsisMetric { - - obj.obj.L2CsnpSent = &value - return obj -} - -// Number of Level 2 (L2) Complete Sequence Number Packet (CSNPs) received. -// L2CsnpReceived returns a uint64 -func (obj *isisMetric) L2CsnpReceived() uint64 { - - return *obj.obj.L2CsnpReceived - -} - -// Number of Level 2 (L2) Complete Sequence Number Packet (CSNPs) received. -// L2CsnpReceived returns a uint64 -func (obj *isisMetric) HasL2CsnpReceived() bool { - return obj.obj.L2CsnpReceived != nil -} - -// Number of Level 2 (L2) Complete Sequence Number Packet (CSNPs) received. -// SetL2CsnpReceived sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL2CsnpReceived(value uint64) IsisMetric { - - obj.obj.L2CsnpReceived = &value - return obj -} - -// Number of Level 2 (L2) Link State Protocol Data Units (LSPs) sent. -// L2LspSent returns a uint64 -func (obj *isisMetric) L2LspSent() uint64 { - - return *obj.obj.L2LspSent - -} - -// Number of Level 2 (L2) Link State Protocol Data Units (LSPs) sent. -// L2LspSent returns a uint64 -func (obj *isisMetric) HasL2LspSent() bool { - return obj.obj.L2LspSent != nil -} - -// Number of Level 2 (L2) Link State Protocol Data Units (LSPs) sent. -// SetL2LspSent sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL2LspSent(value uint64) IsisMetric { - - obj.obj.L2LspSent = &value - return obj -} - -// Number of Level 2 (L2) Link State Protocol Data Units (LSPs) received. -// L2LspReceived returns a uint64 -func (obj *isisMetric) L2LspReceived() uint64 { - - return *obj.obj.L2LspReceived - -} - -// Number of Level 2 (L2) Link State Protocol Data Units (LSPs) received. -// L2LspReceived returns a uint64 -func (obj *isisMetric) HasL2LspReceived() bool { - return obj.obj.L2LspReceived != nil -} - -// Number of Level 2 (L2) Link State Protocol Data Units (LSPs) received. -// SetL2LspReceived sets the uint64 value in the IsisMetric object -func (obj *isisMetric) SetL2LspReceived(value uint64) IsisMetric { - - obj.obj.L2LspReceived = &value - return obj -} - -func (obj *isisMetric) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *isisMetric) setDefault() { - -} - -// ***** LagMetric ***** -type lagMetric struct { - validation - obj *otg.LagMetric - marshaller marshalLagMetric - unMarshaller unMarshalLagMetric -} - -func NewLagMetric() LagMetric { - obj := lagMetric{obj: &otg.LagMetric{}} - obj.setDefault() - return &obj -} - -func (obj *lagMetric) msg() *otg.LagMetric { - return obj.obj -} - -func (obj *lagMetric) setMsg(msg *otg.LagMetric) LagMetric { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallagMetric struct { - obj *lagMetric -} - -type marshalLagMetric interface { - // ToProto marshals LagMetric to protobuf object *otg.LagMetric - ToProto() (*otg.LagMetric, error) - // ToPbText marshals LagMetric to protobuf text - ToPbText() (string, error) - // ToYaml marshals LagMetric to YAML text - ToYaml() (string, error) - // ToJson marshals LagMetric to JSON text - ToJson() (string, error) -} - -type unMarshallagMetric struct { - obj *lagMetric -} - -type unMarshalLagMetric interface { - // FromProto unmarshals LagMetric from protobuf object *otg.LagMetric - FromProto(msg *otg.LagMetric) (LagMetric, error) - // FromPbText unmarshals LagMetric from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LagMetric from YAML text - FromYaml(value string) error - // FromJson unmarshals LagMetric from JSON text - FromJson(value string) error -} - -func (obj *lagMetric) Marshal() marshalLagMetric { - if obj.marshaller == nil { - obj.marshaller = &marshallagMetric{obj: obj} - } - return obj.marshaller -} - -func (obj *lagMetric) Unmarshal() unMarshalLagMetric { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallagMetric{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallagMetric) ToProto() (*otg.LagMetric, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallagMetric) FromProto(msg *otg.LagMetric) (LagMetric, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallagMetric) 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 *unMarshallagMetric) 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 *marshallagMetric) 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 *unMarshallagMetric) 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 *marshallagMetric) 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 *unMarshallagMetric) 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 *lagMetric) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lagMetric) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lagMetric) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lagMetric) Clone() (LagMetric, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLagMetric() - 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 -} - -// LagMetric is description is TBD -type LagMetric interface { - Validation - // msg marshals LagMetric to protobuf object *otg.LagMetric - // and doesn't set defaults - msg() *otg.LagMetric - // setMsg unmarshals LagMetric from protobuf object *otg.LagMetric - // and doesn't set defaults - setMsg(*otg.LagMetric) LagMetric - // provides marshal interface - Marshal() marshalLagMetric - // provides unmarshal interface - Unmarshal() unMarshalLagMetric - // validate validates LagMetric - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LagMetric, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in LagMetric. - Name() string - // SetName assigns string provided by user to LagMetric - SetName(value string) LagMetric - // HasName checks if Name has been set in LagMetric - HasName() bool - // OperStatus returns LagMetricOperStatusEnum, set in LagMetric - OperStatus() LagMetricOperStatusEnum - // SetOperStatus assigns LagMetricOperStatusEnum provided by user to LagMetric - SetOperStatus(value LagMetricOperStatusEnum) LagMetric - // HasOperStatus checks if OperStatus has been set in LagMetric - HasOperStatus() bool - // MemberPortsUp returns uint32, set in LagMetric. - MemberPortsUp() uint32 - // SetMemberPortsUp assigns uint32 provided by user to LagMetric - SetMemberPortsUp(value uint32) LagMetric - // HasMemberPortsUp checks if MemberPortsUp has been set in LagMetric - HasMemberPortsUp() bool - // FramesTx returns uint64, set in LagMetric. - FramesTx() uint64 - // SetFramesTx assigns uint64 provided by user to LagMetric - SetFramesTx(value uint64) LagMetric - // HasFramesTx checks if FramesTx has been set in LagMetric - HasFramesTx() bool - // FramesRx returns uint64, set in LagMetric. - FramesRx() uint64 - // SetFramesRx assigns uint64 provided by user to LagMetric - SetFramesRx(value uint64) LagMetric - // HasFramesRx checks if FramesRx has been set in LagMetric - HasFramesRx() bool - // BytesTx returns uint64, set in LagMetric. - BytesTx() uint64 - // SetBytesTx assigns uint64 provided by user to LagMetric - SetBytesTx(value uint64) LagMetric - // HasBytesTx checks if BytesTx has been set in LagMetric - HasBytesTx() bool - // BytesRx returns uint64, set in LagMetric. - BytesRx() uint64 - // SetBytesRx assigns uint64 provided by user to LagMetric - SetBytesRx(value uint64) LagMetric - // HasBytesRx checks if BytesRx has been set in LagMetric - HasBytesRx() bool - // FramesTxRate returns float32, set in LagMetric. - FramesTxRate() float32 - // SetFramesTxRate assigns float32 provided by user to LagMetric - SetFramesTxRate(value float32) LagMetric - // HasFramesTxRate checks if FramesTxRate has been set in LagMetric - HasFramesTxRate() bool - // FramesRxRate returns float32, set in LagMetric. - FramesRxRate() float32 - // SetFramesRxRate assigns float32 provided by user to LagMetric - SetFramesRxRate(value float32) LagMetric - // HasFramesRxRate checks if FramesRxRate has been set in LagMetric - HasFramesRxRate() bool - // BytesTxRate returns float32, set in LagMetric. - BytesTxRate() float32 - // SetBytesTxRate assigns float32 provided by user to LagMetric - SetBytesTxRate(value float32) LagMetric - // HasBytesTxRate checks if BytesTxRate has been set in LagMetric - HasBytesTxRate() bool - // BytesRxRate returns float32, set in LagMetric. - BytesRxRate() float32 - // SetBytesRxRate assigns float32 provided by user to LagMetric - SetBytesRxRate(value float32) LagMetric - // HasBytesRxRate checks if BytesRxRate has been set in LagMetric - HasBytesRxRate() bool -} - -// The name of a configured LAG -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// Name returns a string -func (obj *lagMetric) Name() string { - - return *obj.obj.Name - -} - -// The name of a configured LAG -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// Name returns a string -func (obj *lagMetric) HasName() bool { - return obj.obj.Name != nil -} - -// The name of a configured LAG -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// SetName sets the string value in the LagMetric object -func (obj *lagMetric) SetName(value string) LagMetric { - - obj.obj.Name = &value - return obj -} - -type LagMetricOperStatusEnum string - -// Enum of OperStatus on LagMetric -var LagMetricOperStatus = struct { - UP LagMetricOperStatusEnum - DOWN LagMetricOperStatusEnum -}{ - UP: LagMetricOperStatusEnum("up"), - DOWN: LagMetricOperStatusEnum("down"), -} - -func (obj *lagMetric) OperStatus() LagMetricOperStatusEnum { - return LagMetricOperStatusEnum(obj.obj.OperStatus.Enum().String()) -} - -// The current operational state of the LAG. The state can be up or down. State 'up' indicates member_ports_up >= min_links. -// OperStatus returns a string -func (obj *lagMetric) HasOperStatus() bool { - return obj.obj.OperStatus != nil -} - -func (obj *lagMetric) SetOperStatus(value LagMetricOperStatusEnum) LagMetric { - intValue, ok := otg.LagMetric_OperStatus_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LagMetricOperStatusEnum", string(value))) - return obj - } - enumValue := otg.LagMetric_OperStatus_Enum(intValue) - obj.obj.OperStatus = &enumValue - - return obj -} - -// The number of LAG member ports up. -// MemberPortsUp returns a uint32 -func (obj *lagMetric) MemberPortsUp() uint32 { - - return *obj.obj.MemberPortsUp - -} - -// The number of LAG member ports up. -// MemberPortsUp returns a uint32 -func (obj *lagMetric) HasMemberPortsUp() bool { - return obj.obj.MemberPortsUp != nil -} - -// The number of LAG member ports up. -// SetMemberPortsUp sets the uint32 value in the LagMetric object -func (obj *lagMetric) SetMemberPortsUp(value uint32) LagMetric { - - obj.obj.MemberPortsUp = &value - return obj -} - -// The current total number of frames transmitted. -// FramesTx returns a uint64 -func (obj *lagMetric) FramesTx() uint64 { - - return *obj.obj.FramesTx - -} - -// The current total number of frames transmitted. -// FramesTx returns a uint64 -func (obj *lagMetric) HasFramesTx() bool { - return obj.obj.FramesTx != nil -} - -// The current total number of frames transmitted. -// SetFramesTx sets the uint64 value in the LagMetric object -func (obj *lagMetric) SetFramesTx(value uint64) LagMetric { - - obj.obj.FramesTx = &value - return obj -} - -// The current total number of valid frames received. -// FramesRx returns a uint64 -func (obj *lagMetric) FramesRx() uint64 { - - return *obj.obj.FramesRx - -} - -// The current total number of valid frames received. -// FramesRx returns a uint64 -func (obj *lagMetric) HasFramesRx() bool { - return obj.obj.FramesRx != nil -} - -// The current total number of valid frames received. -// SetFramesRx sets the uint64 value in the LagMetric object -func (obj *lagMetric) SetFramesRx(value uint64) LagMetric { - - obj.obj.FramesRx = &value - return obj -} - -// The current total number of bytes transmitted. -// BytesTx returns a uint64 -func (obj *lagMetric) BytesTx() uint64 { - - return *obj.obj.BytesTx - -} - -// The current total number of bytes transmitted. -// BytesTx returns a uint64 -func (obj *lagMetric) HasBytesTx() bool { - return obj.obj.BytesTx != nil -} - -// The current total number of bytes transmitted. -// SetBytesTx sets the uint64 value in the LagMetric object -func (obj *lagMetric) SetBytesTx(value uint64) LagMetric { - - obj.obj.BytesTx = &value - return obj -} - -// The current total number of valid bytes received. -// BytesRx returns a uint64 -func (obj *lagMetric) BytesRx() uint64 { - - return *obj.obj.BytesRx - -} - -// The current total number of valid bytes received. -// BytesRx returns a uint64 -func (obj *lagMetric) HasBytesRx() bool { - return obj.obj.BytesRx != nil -} - -// The current total number of valid bytes received. -// SetBytesRx sets the uint64 value in the LagMetric object -func (obj *lagMetric) SetBytesRx(value uint64) LagMetric { - - obj.obj.BytesRx = &value - return obj -} - -// The current rate of frames transmitted. -// FramesTxRate returns a float32 -func (obj *lagMetric) FramesTxRate() float32 { - - return *obj.obj.FramesTxRate - -} - -// The current rate of frames transmitted. -// FramesTxRate returns a float32 -func (obj *lagMetric) HasFramesTxRate() bool { - return obj.obj.FramesTxRate != nil -} - -// The current rate of frames transmitted. -// SetFramesTxRate sets the float32 value in the LagMetric object -func (obj *lagMetric) SetFramesTxRate(value float32) LagMetric { - - obj.obj.FramesTxRate = &value - return obj -} - -// The current rate of valid frames received. -// FramesRxRate returns a float32 -func (obj *lagMetric) FramesRxRate() float32 { - - return *obj.obj.FramesRxRate - -} - -// The current rate of valid frames received. -// FramesRxRate returns a float32 -func (obj *lagMetric) HasFramesRxRate() bool { - return obj.obj.FramesRxRate != nil -} - -// The current rate of valid frames received. -// SetFramesRxRate sets the float32 value in the LagMetric object -func (obj *lagMetric) SetFramesRxRate(value float32) LagMetric { - - obj.obj.FramesRxRate = &value - return obj -} - -// The current rate of bytes transmitted. -// BytesTxRate returns a float32 -func (obj *lagMetric) BytesTxRate() float32 { - - return *obj.obj.BytesTxRate - -} - -// The current rate of bytes transmitted. -// BytesTxRate returns a float32 -func (obj *lagMetric) HasBytesTxRate() bool { - return obj.obj.BytesTxRate != nil -} - -// The current rate of bytes transmitted. -// SetBytesTxRate sets the float32 value in the LagMetric object -func (obj *lagMetric) SetBytesTxRate(value float32) LagMetric { - - obj.obj.BytesTxRate = &value - return obj -} - -// The current rate of bytes received. -// BytesRxRate returns a float32 -func (obj *lagMetric) BytesRxRate() float32 { - - return *obj.obj.BytesRxRate - -} - -// The current rate of bytes received. -// BytesRxRate returns a float32 -func (obj *lagMetric) HasBytesRxRate() bool { - return obj.obj.BytesRxRate != nil -} - -// The current rate of bytes received. -// SetBytesRxRate sets the float32 value in the LagMetric object -func (obj *lagMetric) SetBytesRxRate(value float32) LagMetric { - - obj.obj.BytesRxRate = &value - return obj -} - -func (obj *lagMetric) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.BytesRx != nil { - - if *obj.obj.BytesRx > 18446744073709551615 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= LagMetric.BytesRx <= 18446744073709551615 but Got %d", *obj.obj.BytesRx)) - } - - } - -} - -func (obj *lagMetric) setDefault() { - -} - -// ***** LacpMetric ***** -type lacpMetric struct { - validation - obj *otg.LacpMetric - marshaller marshalLacpMetric - unMarshaller unMarshalLacpMetric -} - -func NewLacpMetric() LacpMetric { - obj := lacpMetric{obj: &otg.LacpMetric{}} - obj.setDefault() - return &obj -} - -func (obj *lacpMetric) msg() *otg.LacpMetric { - return obj.obj -} - -func (obj *lacpMetric) setMsg(msg *otg.LacpMetric) LacpMetric { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallacpMetric struct { - obj *lacpMetric -} - -type marshalLacpMetric interface { - // ToProto marshals LacpMetric to protobuf object *otg.LacpMetric - ToProto() (*otg.LacpMetric, error) - // ToPbText marshals LacpMetric to protobuf text - ToPbText() (string, error) - // ToYaml marshals LacpMetric to YAML text - ToYaml() (string, error) - // ToJson marshals LacpMetric to JSON text - ToJson() (string, error) -} - -type unMarshallacpMetric struct { - obj *lacpMetric -} - -type unMarshalLacpMetric interface { - // FromProto unmarshals LacpMetric from protobuf object *otg.LacpMetric - FromProto(msg *otg.LacpMetric) (LacpMetric, error) - // FromPbText unmarshals LacpMetric from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LacpMetric from YAML text - FromYaml(value string) error - // FromJson unmarshals LacpMetric from JSON text - FromJson(value string) error -} - -func (obj *lacpMetric) Marshal() marshalLacpMetric { - if obj.marshaller == nil { - obj.marshaller = &marshallacpMetric{obj: obj} - } - return obj.marshaller -} - -func (obj *lacpMetric) Unmarshal() unMarshalLacpMetric { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallacpMetric{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallacpMetric) ToProto() (*otg.LacpMetric, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallacpMetric) FromProto(msg *otg.LacpMetric) (LacpMetric, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallacpMetric) 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 *unMarshallacpMetric) 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 *marshallacpMetric) 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 *unMarshallacpMetric) 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 *marshallacpMetric) 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 *unMarshallacpMetric) 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 *lacpMetric) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lacpMetric) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lacpMetric) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lacpMetric) Clone() (LacpMetric, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLacpMetric() - 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 -} - -// LacpMetric is lACP metrics (statistics) per LAG member. -type LacpMetric interface { - Validation - // msg marshals LacpMetric to protobuf object *otg.LacpMetric - // and doesn't set defaults - msg() *otg.LacpMetric - // setMsg unmarshals LacpMetric from protobuf object *otg.LacpMetric - // and doesn't set defaults - setMsg(*otg.LacpMetric) LacpMetric - // provides marshal interface - Marshal() marshalLacpMetric - // provides unmarshal interface - Unmarshal() unMarshalLacpMetric - // validate validates LacpMetric - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LacpMetric, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // LagName returns string, set in LacpMetric. - LagName() string - // SetLagName assigns string provided by user to LacpMetric - SetLagName(value string) LacpMetric - // HasLagName checks if LagName has been set in LacpMetric - HasLagName() bool - // LagMemberPortName returns string, set in LacpMetric. - LagMemberPortName() string - // SetLagMemberPortName assigns string provided by user to LacpMetric - SetLagMemberPortName(value string) LacpMetric - // HasLagMemberPortName checks if LagMemberPortName has been set in LacpMetric - HasLagMemberPortName() bool - // LacpPacketsRx returns uint64, set in LacpMetric. - LacpPacketsRx() uint64 - // SetLacpPacketsRx assigns uint64 provided by user to LacpMetric - SetLacpPacketsRx(value uint64) LacpMetric - // HasLacpPacketsRx checks if LacpPacketsRx has been set in LacpMetric - HasLacpPacketsRx() bool - // LacpPacketsTx returns uint64, set in LacpMetric. - LacpPacketsTx() uint64 - // SetLacpPacketsTx assigns uint64 provided by user to LacpMetric - SetLacpPacketsTx(value uint64) LacpMetric - // HasLacpPacketsTx checks if LacpPacketsTx has been set in LacpMetric - HasLacpPacketsTx() bool - // LacpRxErrors returns uint64, set in LacpMetric. - LacpRxErrors() uint64 - // SetLacpRxErrors assigns uint64 provided by user to LacpMetric - SetLacpRxErrors(value uint64) LacpMetric - // HasLacpRxErrors checks if LacpRxErrors has been set in LacpMetric - HasLacpRxErrors() bool - // Activity returns LacpMetricActivityEnum, set in LacpMetric - Activity() LacpMetricActivityEnum - // SetActivity assigns LacpMetricActivityEnum provided by user to LacpMetric - SetActivity(value LacpMetricActivityEnum) LacpMetric - // HasActivity checks if Activity has been set in LacpMetric - HasActivity() bool - // Timeout returns LacpMetricTimeoutEnum, set in LacpMetric - Timeout() LacpMetricTimeoutEnum - // SetTimeout assigns LacpMetricTimeoutEnum provided by user to LacpMetric - SetTimeout(value LacpMetricTimeoutEnum) LacpMetric - // HasTimeout checks if Timeout has been set in LacpMetric - HasTimeout() bool - // Synchronization returns LacpMetricSynchronizationEnum, set in LacpMetric - Synchronization() LacpMetricSynchronizationEnum - // SetSynchronization assigns LacpMetricSynchronizationEnum provided by user to LacpMetric - SetSynchronization(value LacpMetricSynchronizationEnum) LacpMetric - // HasSynchronization checks if Synchronization has been set in LacpMetric - HasSynchronization() bool - // Aggregatable returns bool, set in LacpMetric. - Aggregatable() bool - // SetAggregatable assigns bool provided by user to LacpMetric - SetAggregatable(value bool) LacpMetric - // HasAggregatable checks if Aggregatable has been set in LacpMetric - HasAggregatable() bool - // Collecting returns bool, set in LacpMetric. - Collecting() bool - // SetCollecting assigns bool provided by user to LacpMetric - SetCollecting(value bool) LacpMetric - // HasCollecting checks if Collecting has been set in LacpMetric - HasCollecting() bool - // Distributing returns bool, set in LacpMetric. - Distributing() bool - // SetDistributing assigns bool provided by user to LacpMetric - SetDistributing(value bool) LacpMetric - // HasDistributing checks if Distributing has been set in LacpMetric - HasDistributing() bool - // SystemId returns string, set in LacpMetric. - SystemId() string - // SetSystemId assigns string provided by user to LacpMetric - SetSystemId(value string) LacpMetric - // HasSystemId checks if SystemId has been set in LacpMetric - HasSystemId() bool - // OperKey returns uint32, set in LacpMetric. - OperKey() uint32 - // SetOperKey assigns uint32 provided by user to LacpMetric - SetOperKey(value uint32) LacpMetric - // HasOperKey checks if OperKey has been set in LacpMetric - HasOperKey() bool - // PartnerId returns string, set in LacpMetric. - PartnerId() string - // SetPartnerId assigns string provided by user to LacpMetric - SetPartnerId(value string) LacpMetric - // HasPartnerId checks if PartnerId has been set in LacpMetric - HasPartnerId() bool - // PartnerKey returns uint32, set in LacpMetric. - PartnerKey() uint32 - // SetPartnerKey assigns uint32 provided by user to LacpMetric - SetPartnerKey(value uint32) LacpMetric - // HasPartnerKey checks if PartnerKey has been set in LacpMetric - HasPartnerKey() bool - // PortNum returns uint32, set in LacpMetric. - PortNum() uint32 - // SetPortNum assigns uint32 provided by user to LacpMetric - SetPortNum(value uint32) LacpMetric - // HasPortNum checks if PortNum has been set in LacpMetric - HasPortNum() bool - // PartnerPortNum returns uint32, set in LacpMetric. - PartnerPortNum() uint32 - // SetPartnerPortNum assigns uint32 provided by user to LacpMetric - SetPartnerPortNum(value uint32) LacpMetric - // HasPartnerPortNum checks if PartnerPortNum has been set in LacpMetric - HasPartnerPortNum() bool -} - -// The name of a LAG (ports group) configured with LACP. -// LagName returns a string -func (obj *lacpMetric) LagName() string { - - return *obj.obj.LagName - -} - -// The name of a LAG (ports group) configured with LACP. -// LagName returns a string -func (obj *lacpMetric) HasLagName() bool { - return obj.obj.LagName != nil -} - -// The name of a LAG (ports group) configured with LACP. -// SetLagName sets the string value in the LacpMetric object -func (obj *lacpMetric) SetLagName(value string) LacpMetric { - - obj.obj.LagName = &value - return obj -} - -// The name of a LAG member (port) configured with LACP. -// LagMemberPortName returns a string -func (obj *lacpMetric) LagMemberPortName() string { - - return *obj.obj.LagMemberPortName - -} - -// The name of a LAG member (port) configured with LACP. -// LagMemberPortName returns a string -func (obj *lacpMetric) HasLagMemberPortName() bool { - return obj.obj.LagMemberPortName != nil -} - -// The name of a LAG member (port) configured with LACP. -// SetLagMemberPortName sets the string value in the LacpMetric object -func (obj *lacpMetric) SetLagMemberPortName(value string) LacpMetric { - - obj.obj.LagMemberPortName = &value - return obj -} - -// Number of LACPDUs received. -// LacpPacketsRx returns a uint64 -func (obj *lacpMetric) LacpPacketsRx() uint64 { - - return *obj.obj.LacpPacketsRx - -} - -// Number of LACPDUs received. -// LacpPacketsRx returns a uint64 -func (obj *lacpMetric) HasLacpPacketsRx() bool { - return obj.obj.LacpPacketsRx != nil -} - -// Number of LACPDUs received. -// SetLacpPacketsRx sets the uint64 value in the LacpMetric object -func (obj *lacpMetric) SetLacpPacketsRx(value uint64) LacpMetric { - - obj.obj.LacpPacketsRx = &value - return obj -} - -// Number of LACPDUs transmitted. -// LacpPacketsTx returns a uint64 -func (obj *lacpMetric) LacpPacketsTx() uint64 { - - return *obj.obj.LacpPacketsTx - -} - -// Number of LACPDUs transmitted. -// LacpPacketsTx returns a uint64 -func (obj *lacpMetric) HasLacpPacketsTx() bool { - return obj.obj.LacpPacketsTx != nil -} - -// Number of LACPDUs transmitted. -// SetLacpPacketsTx sets the uint64 value in the LacpMetric object -func (obj *lacpMetric) SetLacpPacketsTx(value uint64) LacpMetric { - - obj.obj.LacpPacketsTx = &value - return obj -} - -// Number of LACPDUs receive packet errors. -// LacpRxErrors returns a uint64 -func (obj *lacpMetric) LacpRxErrors() uint64 { - - return *obj.obj.LacpRxErrors - -} - -// Number of LACPDUs receive packet errors. -// LacpRxErrors returns a uint64 -func (obj *lacpMetric) HasLacpRxErrors() bool { - return obj.obj.LacpRxErrors != nil -} - -// Number of LACPDUs receive packet errors. -// SetLacpRxErrors sets the uint64 value in the LacpMetric object -func (obj *lacpMetric) SetLacpRxErrors(value uint64) LacpMetric { - - obj.obj.LacpRxErrors = &value - return obj -} - -type LacpMetricActivityEnum string - -// Enum of Activity on LacpMetric -var LacpMetricActivity = struct { - ACTIVE LacpMetricActivityEnum - PASSIVE LacpMetricActivityEnum -}{ - ACTIVE: LacpMetricActivityEnum("active"), - PASSIVE: LacpMetricActivityEnum("passive"), -} - -func (obj *lacpMetric) Activity() LacpMetricActivityEnum { - return LacpMetricActivityEnum(obj.obj.Activity.Enum().String()) -} - -// Indicates participant is active or passive. -// Activity returns a string -func (obj *lacpMetric) HasActivity() bool { - return obj.obj.Activity != nil -} - -func (obj *lacpMetric) SetActivity(value LacpMetricActivityEnum) LacpMetric { - intValue, ok := otg.LacpMetric_Activity_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LacpMetricActivityEnum", string(value))) - return obj - } - enumValue := otg.LacpMetric_Activity_Enum(intValue) - obj.obj.Activity = &enumValue - - return obj -} - -type LacpMetricTimeoutEnum string - -// Enum of Timeout on LacpMetric -var LacpMetricTimeout = struct { - SHORT LacpMetricTimeoutEnum - LONG LacpMetricTimeoutEnum -}{ - SHORT: LacpMetricTimeoutEnum("short"), - LONG: LacpMetricTimeoutEnum("long"), -} - -func (obj *lacpMetric) Timeout() LacpMetricTimeoutEnum { - return LacpMetricTimeoutEnum(obj.obj.Timeout.Enum().String()) -} - -// The timeout type (short or long) used by the participant. -// Timeout returns a string -func (obj *lacpMetric) HasTimeout() bool { - return obj.obj.Timeout != nil -} - -func (obj *lacpMetric) SetTimeout(value LacpMetricTimeoutEnum) LacpMetric { - intValue, ok := otg.LacpMetric_Timeout_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LacpMetricTimeoutEnum", string(value))) - return obj - } - enumValue := otg.LacpMetric_Timeout_Enum(intValue) - obj.obj.Timeout = &enumValue - - return obj -} - -type LacpMetricSynchronizationEnum string - -// Enum of Synchronization on LacpMetric -var LacpMetricSynchronization = struct { - IN_SYNC LacpMetricSynchronizationEnum - OUT_SYNC LacpMetricSynchronizationEnum -}{ - IN_SYNC: LacpMetricSynchronizationEnum("in_sync"), - OUT_SYNC: LacpMetricSynchronizationEnum("out_sync"), -} - -func (obj *lacpMetric) Synchronization() LacpMetricSynchronizationEnum { - return LacpMetricSynchronizationEnum(obj.obj.Synchronization.Enum().String()) -} - -// Indicates whether the participant is in-sync or out-of-sync. -// Synchronization returns a string -func (obj *lacpMetric) HasSynchronization() bool { - return obj.obj.Synchronization != nil -} - -func (obj *lacpMetric) SetSynchronization(value LacpMetricSynchronizationEnum) LacpMetric { - intValue, ok := otg.LacpMetric_Synchronization_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LacpMetricSynchronizationEnum", string(value))) - return obj - } - enumValue := otg.LacpMetric_Synchronization_Enum(intValue) - obj.obj.Synchronization = &enumValue - - return obj -} - -// A true value indicates that the participant will allow the link to be used as part of the aggregate. A false value indicates the link should be used as an individual link. -// Aggregatable returns a bool -func (obj *lacpMetric) Aggregatable() bool { - - return *obj.obj.Aggregatable - -} - -// A true value indicates that the participant will allow the link to be used as part of the aggregate. A false value indicates the link should be used as an individual link. -// Aggregatable returns a bool -func (obj *lacpMetric) HasAggregatable() bool { - return obj.obj.Aggregatable != nil -} - -// A true value indicates that the participant will allow the link to be used as part of the aggregate. A false value indicates the link should be used as an individual link. -// SetAggregatable sets the bool value in the LacpMetric object -func (obj *lacpMetric) SetAggregatable(value bool) LacpMetric { - - obj.obj.Aggregatable = &value - return obj -} - -// If true, the participant is collecting incoming frames on the link, otherwise false. -// Collecting returns a bool -func (obj *lacpMetric) Collecting() bool { - - return *obj.obj.Collecting - -} - -// If true, the participant is collecting incoming frames on the link, otherwise false. -// Collecting returns a bool -func (obj *lacpMetric) HasCollecting() bool { - return obj.obj.Collecting != nil -} - -// If true, the participant is collecting incoming frames on the link, otherwise false. -// SetCollecting sets the bool value in the LacpMetric object -func (obj *lacpMetric) SetCollecting(value bool) LacpMetric { - - obj.obj.Collecting = &value - return obj -} - -// When true, the participant is distributing outgoing frames; when false, distribution is disabled. -// Distributing returns a bool -func (obj *lacpMetric) Distributing() bool { - - return *obj.obj.Distributing - -} - -// When true, the participant is distributing outgoing frames; when false, distribution is disabled. -// Distributing returns a bool -func (obj *lacpMetric) HasDistributing() bool { - return obj.obj.Distributing != nil -} - -// When true, the participant is distributing outgoing frames; when false, distribution is disabled. -// SetDistributing sets the bool value in the LacpMetric object -func (obj *lacpMetric) SetDistributing(value bool) LacpMetric { - - obj.obj.Distributing = &value - return obj -} - -// MAC address that defines the local system ID for the aggregate interface. -// SystemId returns a string -func (obj *lacpMetric) SystemId() string { - - return *obj.obj.SystemId - -} - -// MAC address that defines the local system ID for the aggregate interface. -// SystemId returns a string -func (obj *lacpMetric) HasSystemId() bool { - return obj.obj.SystemId != nil -} - -// MAC address that defines the local system ID for the aggregate interface. -// SetSystemId sets the string value in the LacpMetric object -func (obj *lacpMetric) SetSystemId(value string) LacpMetric { - - obj.obj.SystemId = &value - return obj -} - -// Current operational value of the key for the aggregate interface. -// OperKey returns a uint32 -func (obj *lacpMetric) OperKey() uint32 { - - return *obj.obj.OperKey - -} - -// Current operational value of the key for the aggregate interface. -// OperKey returns a uint32 -func (obj *lacpMetric) HasOperKey() bool { - return obj.obj.OperKey != nil -} - -// Current operational value of the key for the aggregate interface. -// SetOperKey sets the uint32 value in the LacpMetric object -func (obj *lacpMetric) SetOperKey(value uint32) LacpMetric { - - obj.obj.OperKey = &value - return obj -} - -// MAC address representing the protocol partner's interface system ID. -// PartnerId returns a string -func (obj *lacpMetric) PartnerId() string { - - return *obj.obj.PartnerId - -} - -// MAC address representing the protocol partner's interface system ID. -// PartnerId returns a string -func (obj *lacpMetric) HasPartnerId() bool { - return obj.obj.PartnerId != nil -} - -// MAC address representing the protocol partner's interface system ID. -// SetPartnerId sets the string value in the LacpMetric object -func (obj *lacpMetric) SetPartnerId(value string) LacpMetric { - - obj.obj.PartnerId = &value - return obj -} - -// Operational value of the protocol partner's key. -// PartnerKey returns a uint32 -func (obj *lacpMetric) PartnerKey() uint32 { - - return *obj.obj.PartnerKey - -} - -// Operational value of the protocol partner's key. -// PartnerKey returns a uint32 -func (obj *lacpMetric) HasPartnerKey() bool { - return obj.obj.PartnerKey != nil -} - -// Operational value of the protocol partner's key. -// SetPartnerKey sets the uint32 value in the LacpMetric object -func (obj *lacpMetric) SetPartnerKey(value uint32) LacpMetric { - - obj.obj.PartnerKey = &value - return obj -} - -// Port number of the local (actor) aggregation member. -// PortNum returns a uint32 -func (obj *lacpMetric) PortNum() uint32 { - - return *obj.obj.PortNum - -} - -// Port number of the local (actor) aggregation member. -// PortNum returns a uint32 -func (obj *lacpMetric) HasPortNum() bool { - return obj.obj.PortNum != nil -} - -// Port number of the local (actor) aggregation member. -// SetPortNum sets the uint32 value in the LacpMetric object -func (obj *lacpMetric) SetPortNum(value uint32) LacpMetric { - - obj.obj.PortNum = &value - return obj -} - -// Port number of the partner (remote) port for this member port. -// PartnerPortNum returns a uint32 -func (obj *lacpMetric) PartnerPortNum() uint32 { - - return *obj.obj.PartnerPortNum - -} - -// Port number of the partner (remote) port for this member port. -// PartnerPortNum returns a uint32 -func (obj *lacpMetric) HasPartnerPortNum() bool { - return obj.obj.PartnerPortNum != nil -} - -// Port number of the partner (remote) port for this member port. -// SetPartnerPortNum sets the uint32 value in the LacpMetric object -func (obj *lacpMetric) SetPartnerPortNum(value uint32) LacpMetric { - - obj.obj.PartnerPortNum = &value - return obj -} - -func (obj *lacpMetric) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.SystemId != nil { - - err := obj.validateMac(obj.SystemId()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on LacpMetric.SystemId")) - } - - } - - if obj.obj.PartnerId != nil { - - err := obj.validateMac(obj.PartnerId()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on LacpMetric.PartnerId")) - } - - } - -} - -func (obj *lacpMetric) setDefault() { - -} - -// ***** LldpMetric ***** -type lldpMetric struct { - validation - obj *otg.LldpMetric - marshaller marshalLldpMetric - unMarshaller unMarshalLldpMetric -} - -func NewLldpMetric() LldpMetric { - obj := lldpMetric{obj: &otg.LldpMetric{}} - obj.setDefault() - return &obj -} - -func (obj *lldpMetric) msg() *otg.LldpMetric { - return obj.obj -} - -func (obj *lldpMetric) setMsg(msg *otg.LldpMetric) LldpMetric { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallldpMetric struct { - obj *lldpMetric -} - -type marshalLldpMetric interface { - // ToProto marshals LldpMetric to protobuf object *otg.LldpMetric - ToProto() (*otg.LldpMetric, error) - // ToPbText marshals LldpMetric to protobuf text - ToPbText() (string, error) - // ToYaml marshals LldpMetric to YAML text - ToYaml() (string, error) - // ToJson marshals LldpMetric to JSON text - ToJson() (string, error) -} - -type unMarshallldpMetric struct { - obj *lldpMetric -} - -type unMarshalLldpMetric interface { - // FromProto unmarshals LldpMetric from protobuf object *otg.LldpMetric - FromProto(msg *otg.LldpMetric) (LldpMetric, error) - // FromPbText unmarshals LldpMetric from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LldpMetric from YAML text - FromYaml(value string) error - // FromJson unmarshals LldpMetric from JSON text - FromJson(value string) error -} - -func (obj *lldpMetric) Marshal() marshalLldpMetric { - if obj.marshaller == nil { - obj.marshaller = &marshallldpMetric{obj: obj} - } - return obj.marshaller -} - -func (obj *lldpMetric) Unmarshal() unMarshalLldpMetric { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallldpMetric{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallldpMetric) ToProto() (*otg.LldpMetric, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallldpMetric) FromProto(msg *otg.LldpMetric) (LldpMetric, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallldpMetric) 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 *unMarshallldpMetric) 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 *marshallldpMetric) 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 *unMarshallldpMetric) 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 *marshallldpMetric) 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 *unMarshallldpMetric) 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 *lldpMetric) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lldpMetric) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lldpMetric) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lldpMetric) Clone() (LldpMetric, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLldpMetric() - 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 -} - -// LldpMetric is lLDP per instance statistics information. -type LldpMetric interface { - Validation - // msg marshals LldpMetric to protobuf object *otg.LldpMetric - // and doesn't set defaults - msg() *otg.LldpMetric - // setMsg unmarshals LldpMetric from protobuf object *otg.LldpMetric - // and doesn't set defaults - setMsg(*otg.LldpMetric) LldpMetric - // provides marshal interface - Marshal() marshalLldpMetric - // provides unmarshal interface - Unmarshal() unMarshalLldpMetric - // validate validates LldpMetric - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LldpMetric, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in LldpMetric. - Name() string - // SetName assigns string provided by user to LldpMetric - SetName(value string) LldpMetric - // HasName checks if Name has been set in LldpMetric - HasName() bool - // FramesRx returns uint64, set in LldpMetric. - FramesRx() uint64 - // SetFramesRx assigns uint64 provided by user to LldpMetric - SetFramesRx(value uint64) LldpMetric - // HasFramesRx checks if FramesRx has been set in LldpMetric - HasFramesRx() bool - // FramesTx returns uint64, set in LldpMetric. - FramesTx() uint64 - // SetFramesTx assigns uint64 provided by user to LldpMetric - SetFramesTx(value uint64) LldpMetric - // HasFramesTx checks if FramesTx has been set in LldpMetric - HasFramesTx() bool - // FramesErrorRx returns uint64, set in LldpMetric. - FramesErrorRx() uint64 - // SetFramesErrorRx assigns uint64 provided by user to LldpMetric - SetFramesErrorRx(value uint64) LldpMetric - // HasFramesErrorRx checks if FramesErrorRx has been set in LldpMetric - HasFramesErrorRx() bool - // FramesDiscard returns uint64, set in LldpMetric. - FramesDiscard() uint64 - // SetFramesDiscard assigns uint64 provided by user to LldpMetric - SetFramesDiscard(value uint64) LldpMetric - // HasFramesDiscard checks if FramesDiscard has been set in LldpMetric - HasFramesDiscard() bool - // TlvsDiscard returns uint64, set in LldpMetric. - TlvsDiscard() uint64 - // SetTlvsDiscard assigns uint64 provided by user to LldpMetric - SetTlvsDiscard(value uint64) LldpMetric - // HasTlvsDiscard checks if TlvsDiscard has been set in LldpMetric - HasTlvsDiscard() bool - // TlvsUnknown returns uint64, set in LldpMetric. - TlvsUnknown() uint64 - // SetTlvsUnknown assigns uint64 provided by user to LldpMetric - SetTlvsUnknown(value uint64) LldpMetric - // HasTlvsUnknown checks if TlvsUnknown has been set in LldpMetric - HasTlvsUnknown() bool -} - -// The name of the configured LLDP instance. -// Name returns a string -func (obj *lldpMetric) Name() string { - - return *obj.obj.Name - -} - -// The name of the configured LLDP instance. -// Name returns a string -func (obj *lldpMetric) HasName() bool { - return obj.obj.Name != nil -} - -// The name of the configured LLDP instance. -// SetName sets the string value in the LldpMetric object -func (obj *lldpMetric) SetName(value string) LldpMetric { - - obj.obj.Name = &value - return obj -} - -// Number of LLDP frames received. -// FramesRx returns a uint64 -func (obj *lldpMetric) FramesRx() uint64 { - - return *obj.obj.FramesRx - -} - -// Number of LLDP frames received. -// FramesRx returns a uint64 -func (obj *lldpMetric) HasFramesRx() bool { - return obj.obj.FramesRx != nil -} - -// Number of LLDP frames received. -// SetFramesRx sets the uint64 value in the LldpMetric object -func (obj *lldpMetric) SetFramesRx(value uint64) LldpMetric { - - obj.obj.FramesRx = &value - return obj -} - -// Number of LLDP frames transmitted. -// FramesTx returns a uint64 -func (obj *lldpMetric) FramesTx() uint64 { - - return *obj.obj.FramesTx - -} - -// Number of LLDP frames transmitted. -// FramesTx returns a uint64 -func (obj *lldpMetric) HasFramesTx() bool { - return obj.obj.FramesTx != nil -} - -// Number of LLDP frames transmitted. -// SetFramesTx sets the uint64 value in the LldpMetric object -func (obj *lldpMetric) SetFramesTx(value uint64) LldpMetric { - - obj.obj.FramesTx = &value - return obj -} - -// Number of LLDP frames received with packet errors. This stat should be incremented based on statsFramesInErrorsTotal increment rule in section 10.3.2 of IEEE Std 802.1 AB-2005. -// FramesErrorRx returns a uint64 -func (obj *lldpMetric) FramesErrorRx() uint64 { - - return *obj.obj.FramesErrorRx - -} - -// Number of LLDP frames received with packet errors. This stat should be incremented based on statsFramesInErrorsTotal increment rule in section 10.3.2 of IEEE Std 802.1 AB-2005. -// FramesErrorRx returns a uint64 -func (obj *lldpMetric) HasFramesErrorRx() bool { - return obj.obj.FramesErrorRx != nil -} - -// Number of LLDP frames received with packet errors. This stat should be incremented based on statsFramesInErrorsTotal increment rule in section 10.3.2 of IEEE Std 802.1 AB-2005. -// SetFramesErrorRx sets the uint64 value in the LldpMetric object -func (obj *lldpMetric) SetFramesErrorRx(value uint64) LldpMetric { - - obj.obj.FramesErrorRx = &value - return obj -} - -// Number of LLDP frames received that are discarded. This stat should be incremented when one or more of the three mandatory TLVs at the beginning of the LLDPDU is missing, out of order or contains an out of range information string length. This stat should follow the validation rules in section 10.3.2 of IEEE Std 802.1 AB-2005. -// FramesDiscard returns a uint64 -func (obj *lldpMetric) FramesDiscard() uint64 { - - return *obj.obj.FramesDiscard - -} - -// Number of LLDP frames received that are discarded. This stat should be incremented when one or more of the three mandatory TLVs at the beginning of the LLDPDU is missing, out of order or contains an out of range information string length. This stat should follow the validation rules in section 10.3.2 of IEEE Std 802.1 AB-2005. -// FramesDiscard returns a uint64 -func (obj *lldpMetric) HasFramesDiscard() bool { - return obj.obj.FramesDiscard != nil -} - -// Number of LLDP frames received that are discarded. This stat should be incremented when one or more of the three mandatory TLVs at the beginning of the LLDPDU is missing, out of order or contains an out of range information string length. This stat should follow the validation rules in section 10.3.2 of IEEE Std 802.1 AB-2005. -// SetFramesDiscard sets the uint64 value in the LldpMetric object -func (obj *lldpMetric) SetFramesDiscard(value uint64) LldpMetric { - - obj.obj.FramesDiscard = &value - return obj -} - -// Number of LLDP tlvs received that are discarded. If any TLV contains an error condition specific for that particular TLV or if any TLV extends past the physical end of the frame then these TLVs will be discarded. -// TlvsDiscard returns a uint64 -func (obj *lldpMetric) TlvsDiscard() uint64 { - - return *obj.obj.TlvsDiscard - -} - -// Number of LLDP tlvs received that are discarded. If any TLV contains an error condition specific for that particular TLV or if any TLV extends past the physical end of the frame then these TLVs will be discarded. -// TlvsDiscard returns a uint64 -func (obj *lldpMetric) HasTlvsDiscard() bool { - return obj.obj.TlvsDiscard != nil -} - -// Number of LLDP tlvs received that are discarded. If any TLV contains an error condition specific for that particular TLV or if any TLV extends past the physical end of the frame then these TLVs will be discarded. -// SetTlvsDiscard sets the uint64 value in the LldpMetric object -func (obj *lldpMetric) SetTlvsDiscard(value uint64) LldpMetric { - - obj.obj.TlvsDiscard = &value - return obj -} - -// Number of LLDP unknown tlvs received. If the OUI of the organizationlly specific TLV and/or organizationally defined subtype are not recognized,or if TLV type value is in the range of reserved TLV types then these TLVs will be considered as unknown TLVs. -// TlvsUnknown returns a uint64 -func (obj *lldpMetric) TlvsUnknown() uint64 { - - return *obj.obj.TlvsUnknown - -} - -// Number of LLDP unknown tlvs received. If the OUI of the organizationlly specific TLV and/or organizationally defined subtype are not recognized,or if TLV type value is in the range of reserved TLV types then these TLVs will be considered as unknown TLVs. -// TlvsUnknown returns a uint64 -func (obj *lldpMetric) HasTlvsUnknown() bool { - return obj.obj.TlvsUnknown != nil -} - -// Number of LLDP unknown tlvs received. If the OUI of the organizationlly specific TLV and/or organizationally defined subtype are not recognized,or if TLV type value is in the range of reserved TLV types then these TLVs will be considered as unknown TLVs. -// SetTlvsUnknown sets the uint64 value in the LldpMetric object -func (obj *lldpMetric) SetTlvsUnknown(value uint64) LldpMetric { - - obj.obj.TlvsUnknown = &value - return obj -} - -func (obj *lldpMetric) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *lldpMetric) setDefault() { - -} - -// ***** RsvpMetric ***** -type rsvpMetric struct { - validation - obj *otg.RsvpMetric - marshaller marshalRsvpMetric - unMarshaller unMarshalRsvpMetric -} - -func NewRsvpMetric() RsvpMetric { - obj := rsvpMetric{obj: &otg.RsvpMetric{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpMetric) msg() *otg.RsvpMetric { - return obj.obj -} - -func (obj *rsvpMetric) setMsg(msg *otg.RsvpMetric) RsvpMetric { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpMetric struct { - obj *rsvpMetric -} - -type marshalRsvpMetric interface { - // ToProto marshals RsvpMetric to protobuf object *otg.RsvpMetric - ToProto() (*otg.RsvpMetric, error) - // ToPbText marshals RsvpMetric to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpMetric to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpMetric to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpMetric struct { - obj *rsvpMetric -} - -type unMarshalRsvpMetric interface { - // FromProto unmarshals RsvpMetric from protobuf object *otg.RsvpMetric - FromProto(msg *otg.RsvpMetric) (RsvpMetric, error) - // FromPbText unmarshals RsvpMetric from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpMetric from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpMetric from JSON text - FromJson(value string) error -} - -func (obj *rsvpMetric) Marshal() marshalRsvpMetric { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpMetric{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpMetric) Unmarshal() unMarshalRsvpMetric { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpMetric{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpMetric) ToProto() (*otg.RsvpMetric, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpMetric) FromProto(msg *otg.RsvpMetric) (RsvpMetric, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpMetric) 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 *unMarshalrsvpMetric) 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 *marshalrsvpMetric) 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 *unMarshalrsvpMetric) 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 *marshalrsvpMetric) 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 *unMarshalrsvpMetric) 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 *rsvpMetric) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpMetric) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpMetric) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpMetric) Clone() (RsvpMetric, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpMetric() - 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 -} - -// RsvpMetric is rSVP-TE per router statistics information. -type RsvpMetric interface { - Validation - // msg marshals RsvpMetric to protobuf object *otg.RsvpMetric - // and doesn't set defaults - msg() *otg.RsvpMetric - // setMsg unmarshals RsvpMetric from protobuf object *otg.RsvpMetric - // and doesn't set defaults - setMsg(*otg.RsvpMetric) RsvpMetric - // provides marshal interface - Marshal() marshalRsvpMetric - // provides unmarshal interface - Unmarshal() unMarshalRsvpMetric - // validate validates RsvpMetric - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpMetric, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in RsvpMetric. - Name() string - // SetName assigns string provided by user to RsvpMetric - SetName(value string) RsvpMetric - // HasName checks if Name has been set in RsvpMetric - HasName() bool - // IngressP2PLspsConfigured returns uint32, set in RsvpMetric. - IngressP2PLspsConfigured() uint32 - // SetIngressP2PLspsConfigured assigns uint32 provided by user to RsvpMetric - SetIngressP2PLspsConfigured(value uint32) RsvpMetric - // HasIngressP2PLspsConfigured checks if IngressP2PLspsConfigured has been set in RsvpMetric - HasIngressP2PLspsConfigured() bool - // IngressP2PLspsUp returns uint32, set in RsvpMetric. - IngressP2PLspsUp() uint32 - // SetIngressP2PLspsUp assigns uint32 provided by user to RsvpMetric - SetIngressP2PLspsUp(value uint32) RsvpMetric - // HasIngressP2PLspsUp checks if IngressP2PLspsUp has been set in RsvpMetric - HasIngressP2PLspsUp() bool - // EgressP2PLspsUp returns uint32, set in RsvpMetric. - EgressP2PLspsUp() uint32 - // SetEgressP2PLspsUp assigns uint32 provided by user to RsvpMetric - SetEgressP2PLspsUp(value uint32) RsvpMetric - // HasEgressP2PLspsUp checks if EgressP2PLspsUp has been set in RsvpMetric - HasEgressP2PLspsUp() bool - // LspFlapCount returns uint64, set in RsvpMetric. - LspFlapCount() uint64 - // SetLspFlapCount assigns uint64 provided by user to RsvpMetric - SetLspFlapCount(value uint64) RsvpMetric - // HasLspFlapCount checks if LspFlapCount has been set in RsvpMetric - HasLspFlapCount() bool - // PathsTx returns uint64, set in RsvpMetric. - PathsTx() uint64 - // SetPathsTx assigns uint64 provided by user to RsvpMetric - SetPathsTx(value uint64) RsvpMetric - // HasPathsTx checks if PathsTx has been set in RsvpMetric - HasPathsTx() bool - // PathsRx returns uint64, set in RsvpMetric. - PathsRx() uint64 - // SetPathsRx assigns uint64 provided by user to RsvpMetric - SetPathsRx(value uint64) RsvpMetric - // HasPathsRx checks if PathsRx has been set in RsvpMetric - HasPathsRx() bool - // ResvsTx returns uint64, set in RsvpMetric. - ResvsTx() uint64 - // SetResvsTx assigns uint64 provided by user to RsvpMetric - SetResvsTx(value uint64) RsvpMetric - // HasResvsTx checks if ResvsTx has been set in RsvpMetric - HasResvsTx() bool - // ResvsRx returns uint64, set in RsvpMetric. - ResvsRx() uint64 - // SetResvsRx assigns uint64 provided by user to RsvpMetric - SetResvsRx(value uint64) RsvpMetric - // HasResvsRx checks if ResvsRx has been set in RsvpMetric - HasResvsRx() bool - // PathTearsTx returns uint64, set in RsvpMetric. - PathTearsTx() uint64 - // SetPathTearsTx assigns uint64 provided by user to RsvpMetric - SetPathTearsTx(value uint64) RsvpMetric - // HasPathTearsTx checks if PathTearsTx has been set in RsvpMetric - HasPathTearsTx() bool - // PathTearsRx returns uint64, set in RsvpMetric. - PathTearsRx() uint64 - // SetPathTearsRx assigns uint64 provided by user to RsvpMetric - SetPathTearsRx(value uint64) RsvpMetric - // HasPathTearsRx checks if PathTearsRx has been set in RsvpMetric - HasPathTearsRx() bool - // ResvTearsTx returns uint64, set in RsvpMetric. - ResvTearsTx() uint64 - // SetResvTearsTx assigns uint64 provided by user to RsvpMetric - SetResvTearsTx(value uint64) RsvpMetric - // HasResvTearsTx checks if ResvTearsTx has been set in RsvpMetric - HasResvTearsTx() bool - // ResvTearsRx returns uint64, set in RsvpMetric. - ResvTearsRx() uint64 - // SetResvTearsRx assigns uint64 provided by user to RsvpMetric - SetResvTearsRx(value uint64) RsvpMetric - // HasResvTearsRx checks if ResvTearsRx has been set in RsvpMetric - HasResvTearsRx() bool - // PathErrorsTx returns uint64, set in RsvpMetric. - PathErrorsTx() uint64 - // SetPathErrorsTx assigns uint64 provided by user to RsvpMetric - SetPathErrorsTx(value uint64) RsvpMetric - // HasPathErrorsTx checks if PathErrorsTx has been set in RsvpMetric - HasPathErrorsTx() bool - // PathErrorsRx returns uint64, set in RsvpMetric. - PathErrorsRx() uint64 - // SetPathErrorsRx assigns uint64 provided by user to RsvpMetric - SetPathErrorsRx(value uint64) RsvpMetric - // HasPathErrorsRx checks if PathErrorsRx has been set in RsvpMetric - HasPathErrorsRx() bool - // ResvErrorsTx returns uint64, set in RsvpMetric. - ResvErrorsTx() uint64 - // SetResvErrorsTx assigns uint64 provided by user to RsvpMetric - SetResvErrorsTx(value uint64) RsvpMetric - // HasResvErrorsTx checks if ResvErrorsTx has been set in RsvpMetric - HasResvErrorsTx() bool - // ResvErrorsRx returns uint64, set in RsvpMetric. - ResvErrorsRx() uint64 - // SetResvErrorsRx assigns uint64 provided by user to RsvpMetric - SetResvErrorsRx(value uint64) RsvpMetric - // HasResvErrorsRx checks if ResvErrorsRx has been set in RsvpMetric - HasResvErrorsRx() bool - // ResvConfTx returns uint64, set in RsvpMetric. - ResvConfTx() uint64 - // SetResvConfTx assigns uint64 provided by user to RsvpMetric - SetResvConfTx(value uint64) RsvpMetric - // HasResvConfTx checks if ResvConfTx has been set in RsvpMetric - HasResvConfTx() bool - // ResvConfRx returns uint64, set in RsvpMetric. - ResvConfRx() uint64 - // SetResvConfRx assigns uint64 provided by user to RsvpMetric - SetResvConfRx(value uint64) RsvpMetric - // HasResvConfRx checks if ResvConfRx has been set in RsvpMetric - HasResvConfRx() bool - // HellosTx returns uint64, set in RsvpMetric. - HellosTx() uint64 - // SetHellosTx assigns uint64 provided by user to RsvpMetric - SetHellosTx(value uint64) RsvpMetric - // HasHellosTx checks if HellosTx has been set in RsvpMetric - HasHellosTx() bool - // HellosRx returns uint64, set in RsvpMetric. - HellosRx() uint64 - // SetHellosRx assigns uint64 provided by user to RsvpMetric - SetHellosRx(value uint64) RsvpMetric - // HasHellosRx checks if HellosRx has been set in RsvpMetric - HasHellosRx() bool - // AcksTx returns uint64, set in RsvpMetric. - AcksTx() uint64 - // SetAcksTx assigns uint64 provided by user to RsvpMetric - SetAcksTx(value uint64) RsvpMetric - // HasAcksTx checks if AcksTx has been set in RsvpMetric - HasAcksTx() bool - // AcksRx returns uint64, set in RsvpMetric. - AcksRx() uint64 - // SetAcksRx assigns uint64 provided by user to RsvpMetric - SetAcksRx(value uint64) RsvpMetric - // HasAcksRx checks if AcksRx has been set in RsvpMetric - HasAcksRx() bool - // NacksTx returns uint64, set in RsvpMetric. - NacksTx() uint64 - // SetNacksTx assigns uint64 provided by user to RsvpMetric - SetNacksTx(value uint64) RsvpMetric - // HasNacksTx checks if NacksTx has been set in RsvpMetric - HasNacksTx() bool - // NacksRx returns uint64, set in RsvpMetric. - NacksRx() uint64 - // SetNacksRx assigns uint64 provided by user to RsvpMetric - SetNacksRx(value uint64) RsvpMetric - // HasNacksRx checks if NacksRx has been set in RsvpMetric - HasNacksRx() bool - // SrefreshTx returns uint64, set in RsvpMetric. - SrefreshTx() uint64 - // SetSrefreshTx assigns uint64 provided by user to RsvpMetric - SetSrefreshTx(value uint64) RsvpMetric - // HasSrefreshTx checks if SrefreshTx has been set in RsvpMetric - HasSrefreshTx() bool - // SrefreshRx returns uint64, set in RsvpMetric. - SrefreshRx() uint64 - // SetSrefreshRx assigns uint64 provided by user to RsvpMetric - SetSrefreshRx(value uint64) RsvpMetric - // HasSrefreshRx checks if SrefreshRx has been set in RsvpMetric - HasSrefreshRx() bool - // BundleTx returns uint64, set in RsvpMetric. - BundleTx() uint64 - // SetBundleTx assigns uint64 provided by user to RsvpMetric - SetBundleTx(value uint64) RsvpMetric - // HasBundleTx checks if BundleTx has been set in RsvpMetric - HasBundleTx() bool - // BundleRx returns uint64, set in RsvpMetric. - BundleRx() uint64 - // SetBundleRx assigns uint64 provided by user to RsvpMetric - SetBundleRx(value uint64) RsvpMetric - // HasBundleRx checks if BundleRx has been set in RsvpMetric - HasBundleRx() bool - // PathReevaluationRequestTx returns uint64, set in RsvpMetric. - PathReevaluationRequestTx() uint64 - // SetPathReevaluationRequestTx assigns uint64 provided by user to RsvpMetric - SetPathReevaluationRequestTx(value uint64) RsvpMetric - // HasPathReevaluationRequestTx checks if PathReevaluationRequestTx has been set in RsvpMetric - HasPathReevaluationRequestTx() bool - // PathReoptimizations returns uint64, set in RsvpMetric. - PathReoptimizations() uint64 - // SetPathReoptimizations assigns uint64 provided by user to RsvpMetric - SetPathReoptimizations(value uint64) RsvpMetric - // HasPathReoptimizations checks if PathReoptimizations has been set in RsvpMetric - HasPathReoptimizations() bool -} - -// The name of a configured RSVP router. -// Name returns a string -func (obj *rsvpMetric) Name() string { - - return *obj.obj.Name - -} - -// The name of a configured RSVP router. -// Name returns a string -func (obj *rsvpMetric) HasName() bool { - return obj.obj.Name != nil -} - -// The name of a configured RSVP router. -// SetName sets the string value in the RsvpMetric object -func (obj *rsvpMetric) SetName(value string) RsvpMetric { - - obj.obj.Name = &value - return obj -} - -// The number of ingress point-to-point LSPs configured or transiting through the RSVP router which have been initated from the test port. -// IngressP2PLspsConfigured returns a uint32 -func (obj *rsvpMetric) IngressP2PLspsConfigured() uint32 { - - return *obj.obj.IngressP2PLspsConfigured - -} - -// The number of ingress point-to-point LSPs configured or transiting through the RSVP router which have been initated from the test port. -// IngressP2PLspsConfigured returns a uint32 -func (obj *rsvpMetric) HasIngressP2PLspsConfigured() bool { - return obj.obj.IngressP2PLspsConfigured != nil -} - -// The number of ingress point-to-point LSPs configured or transiting through the RSVP router which have been initated from the test port. -// SetIngressP2PLspsConfigured sets the uint32 value in the RsvpMetric object -func (obj *rsvpMetric) SetIngressP2PLspsConfigured(value uint32) RsvpMetric { - - obj.obj.IngressP2PLspsConfigured = &value - return obj -} - -// The number of ingress point-to-point LSPs for which Resv has been received and is currently up. -// IngressP2PLspsUp returns a uint32 -func (obj *rsvpMetric) IngressP2PLspsUp() uint32 { - - return *obj.obj.IngressP2PLspsUp - -} - -// The number of ingress point-to-point LSPs for which Resv has been received and is currently up. -// IngressP2PLspsUp returns a uint32 -func (obj *rsvpMetric) HasIngressP2PLspsUp() bool { - return obj.obj.IngressP2PLspsUp != nil -} - -// The number of ingress point-to-point LSPs for which Resv has been received and is currently up. -// SetIngressP2PLspsUp sets the uint32 value in the RsvpMetric object -func (obj *rsvpMetric) SetIngressP2PLspsUp(value uint32) RsvpMetric { - - obj.obj.IngressP2PLspsUp = &value - return obj -} - -// The number of egress point-to-point LSPs for which Path requests were successfully processed and is currently up. -// EgressP2PLspsUp returns a uint32 -func (obj *rsvpMetric) EgressP2PLspsUp() uint32 { - - return *obj.obj.EgressP2PLspsUp - -} - -// The number of egress point-to-point LSPs for which Path requests were successfully processed and is currently up. -// EgressP2PLspsUp returns a uint32 -func (obj *rsvpMetric) HasEgressP2PLspsUp() bool { - return obj.obj.EgressP2PLspsUp != nil -} - -// The number of egress point-to-point LSPs for which Path requests were successfully processed and is currently up. -// SetEgressP2PLspsUp sets the uint32 value in the RsvpMetric object -func (obj *rsvpMetric) SetEgressP2PLspsUp(value uint32) RsvpMetric { - - obj.obj.EgressP2PLspsUp = &value - return obj -} - -// The number of times an LSP went from up to down state either because it timed out while waiting for Refreshes or a PathTear or ResvTear message was received which caused the LSP to flap. -// LspFlapCount returns a uint64 -func (obj *rsvpMetric) LspFlapCount() uint64 { - - return *obj.obj.LspFlapCount - -} - -// The number of times an LSP went from up to down state either because it timed out while waiting for Refreshes or a PathTear or ResvTear message was received which caused the LSP to flap. -// LspFlapCount returns a uint64 -func (obj *rsvpMetric) HasLspFlapCount() bool { - return obj.obj.LspFlapCount != nil -} - -// The number of times an LSP went from up to down state either because it timed out while waiting for Refreshes or a PathTear or ResvTear message was received which caused the LSP to flap. -// SetLspFlapCount sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetLspFlapCount(value uint64) RsvpMetric { - - obj.obj.LspFlapCount = &value - return obj -} - -// The number of Path messages sent by this RSVP router. -// PathsTx returns a uint64 -func (obj *rsvpMetric) PathsTx() uint64 { - - return *obj.obj.PathsTx - -} - -// The number of Path messages sent by this RSVP router. -// PathsTx returns a uint64 -func (obj *rsvpMetric) HasPathsTx() bool { - return obj.obj.PathsTx != nil -} - -// The number of Path messages sent by this RSVP router. -// SetPathsTx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetPathsTx(value uint64) RsvpMetric { - - obj.obj.PathsTx = &value - return obj -} - -// The number of Path messages received by this RSVP router. -// PathsRx returns a uint64 -func (obj *rsvpMetric) PathsRx() uint64 { - - return *obj.obj.PathsRx - -} - -// The number of Path messages received by this RSVP router. -// PathsRx returns a uint64 -func (obj *rsvpMetric) HasPathsRx() bool { - return obj.obj.PathsRx != nil -} - -// The number of Path messages received by this RSVP router. -// SetPathsRx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetPathsRx(value uint64) RsvpMetric { - - obj.obj.PathsRx = &value - return obj -} - -// The number of Resv messages sent by this RSVP router. -// ResvsTx returns a uint64 -func (obj *rsvpMetric) ResvsTx() uint64 { - - return *obj.obj.ResvsTx - -} - -// The number of Resv messages sent by this RSVP router. -// ResvsTx returns a uint64 -func (obj *rsvpMetric) HasResvsTx() bool { - return obj.obj.ResvsTx != nil -} - -// The number of Resv messages sent by this RSVP router. -// SetResvsTx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetResvsTx(value uint64) RsvpMetric { - - obj.obj.ResvsTx = &value - return obj -} - -// The number of Resv messages received by this RSVP router. -// ResvsRx returns a uint64 -func (obj *rsvpMetric) ResvsRx() uint64 { - - return *obj.obj.ResvsRx - -} - -// The number of Resv messages received by this RSVP router. -// ResvsRx returns a uint64 -func (obj *rsvpMetric) HasResvsRx() bool { - return obj.obj.ResvsRx != nil -} - -// The number of Resv messages received by this RSVP router. -// SetResvsRx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetResvsRx(value uint64) RsvpMetric { - - obj.obj.ResvsRx = &value - return obj -} - -// The number of Path Tear messages sent by this RSVP router. -// PathTearsTx returns a uint64 -func (obj *rsvpMetric) PathTearsTx() uint64 { - - return *obj.obj.PathTearsTx - -} - -// The number of Path Tear messages sent by this RSVP router. -// PathTearsTx returns a uint64 -func (obj *rsvpMetric) HasPathTearsTx() bool { - return obj.obj.PathTearsTx != nil -} - -// The number of Path Tear messages sent by this RSVP router. -// SetPathTearsTx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetPathTearsTx(value uint64) RsvpMetric { - - obj.obj.PathTearsTx = &value - return obj -} - -// The number of Path Tear messages received by this RSVP router. -// PathTearsRx returns a uint64 -func (obj *rsvpMetric) PathTearsRx() uint64 { - - return *obj.obj.PathTearsRx - -} - -// The number of Path Tear messages received by this RSVP router. -// PathTearsRx returns a uint64 -func (obj *rsvpMetric) HasPathTearsRx() bool { - return obj.obj.PathTearsRx != nil -} - -// The number of Path Tear messages received by this RSVP router. -// SetPathTearsRx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetPathTearsRx(value uint64) RsvpMetric { - - obj.obj.PathTearsRx = &value - return obj -} - -// The number of Resv Tear messages sent by this RSVP router. -// ResvTearsTx returns a uint64 -func (obj *rsvpMetric) ResvTearsTx() uint64 { - - return *obj.obj.ResvTearsTx - -} - -// The number of Resv Tear messages sent by this RSVP router. -// ResvTearsTx returns a uint64 -func (obj *rsvpMetric) HasResvTearsTx() bool { - return obj.obj.ResvTearsTx != nil -} - -// The number of Resv Tear messages sent by this RSVP router. -// SetResvTearsTx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetResvTearsTx(value uint64) RsvpMetric { - - obj.obj.ResvTearsTx = &value - return obj -} - -// The number of Resv Tear messages received by this RSVP router. -// ResvTearsRx returns a uint64 -func (obj *rsvpMetric) ResvTearsRx() uint64 { - - return *obj.obj.ResvTearsRx - -} - -// The number of Resv Tear messages received by this RSVP router. -// ResvTearsRx returns a uint64 -func (obj *rsvpMetric) HasResvTearsRx() bool { - return obj.obj.ResvTearsRx != nil -} - -// The number of Resv Tear messages received by this RSVP router. -// SetResvTearsRx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetResvTearsRx(value uint64) RsvpMetric { - - obj.obj.ResvTearsRx = &value - return obj -} - -// The number of Path Error messages sent by this RSVP router. -// PathErrorsTx returns a uint64 -func (obj *rsvpMetric) PathErrorsTx() uint64 { - - return *obj.obj.PathErrorsTx - -} - -// The number of Path Error messages sent by this RSVP router. -// PathErrorsTx returns a uint64 -func (obj *rsvpMetric) HasPathErrorsTx() bool { - return obj.obj.PathErrorsTx != nil -} - -// The number of Path Error messages sent by this RSVP router. -// SetPathErrorsTx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetPathErrorsTx(value uint64) RsvpMetric { - - obj.obj.PathErrorsTx = &value - return obj -} - -// The number of Path Error messages received by this RSVP router. -// PathErrorsRx returns a uint64 -func (obj *rsvpMetric) PathErrorsRx() uint64 { - - return *obj.obj.PathErrorsRx - -} - -// The number of Path Error messages received by this RSVP router. -// PathErrorsRx returns a uint64 -func (obj *rsvpMetric) HasPathErrorsRx() bool { - return obj.obj.PathErrorsRx != nil -} - -// The number of Path Error messages received by this RSVP router. -// SetPathErrorsRx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetPathErrorsRx(value uint64) RsvpMetric { - - obj.obj.PathErrorsRx = &value - return obj -} - -// The number of Resv Error messages sent by this RSVP router. -// ResvErrorsTx returns a uint64 -func (obj *rsvpMetric) ResvErrorsTx() uint64 { - - return *obj.obj.ResvErrorsTx - -} - -// The number of Resv Error messages sent by this RSVP router. -// ResvErrorsTx returns a uint64 -func (obj *rsvpMetric) HasResvErrorsTx() bool { - return obj.obj.ResvErrorsTx != nil -} - -// The number of Resv Error messages sent by this RSVP router. -// SetResvErrorsTx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetResvErrorsTx(value uint64) RsvpMetric { - - obj.obj.ResvErrorsTx = &value - return obj -} - -// The number of Resv Error messages received by this RSVP router. -// ResvErrorsRx returns a uint64 -func (obj *rsvpMetric) ResvErrorsRx() uint64 { - - return *obj.obj.ResvErrorsRx - -} - -// The number of Resv Error messages received by this RSVP router. -// ResvErrorsRx returns a uint64 -func (obj *rsvpMetric) HasResvErrorsRx() bool { - return obj.obj.ResvErrorsRx != nil -} - -// The number of Resv Error messages received by this RSVP router. -// SetResvErrorsRx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetResvErrorsRx(value uint64) RsvpMetric { - - obj.obj.ResvErrorsRx = &value - return obj -} - -// The number of ResvConf messages sent by this RSVP router. -// ResvConfTx returns a uint64 -func (obj *rsvpMetric) ResvConfTx() uint64 { - - return *obj.obj.ResvConfTx - -} - -// The number of ResvConf messages sent by this RSVP router. -// ResvConfTx returns a uint64 -func (obj *rsvpMetric) HasResvConfTx() bool { - return obj.obj.ResvConfTx != nil -} - -// The number of ResvConf messages sent by this RSVP router. -// SetResvConfTx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetResvConfTx(value uint64) RsvpMetric { - - obj.obj.ResvConfTx = &value - return obj -} - -// The number of ResvConf messages received by this RSVP router. -// ResvConfRx returns a uint64 -func (obj *rsvpMetric) ResvConfRx() uint64 { - - return *obj.obj.ResvConfRx - -} - -// The number of ResvConf messages received by this RSVP router. -// ResvConfRx returns a uint64 -func (obj *rsvpMetric) HasResvConfRx() bool { - return obj.obj.ResvConfRx != nil -} - -// The number of ResvConf messages received by this RSVP router. -// SetResvConfRx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetResvConfRx(value uint64) RsvpMetric { - - obj.obj.ResvConfRx = &value - return obj -} - -// The number of Hello messages sent by this RSVP router. -// HellosTx returns a uint64 -func (obj *rsvpMetric) HellosTx() uint64 { - - return *obj.obj.HellosTx - -} - -// The number of Hello messages sent by this RSVP router. -// HellosTx returns a uint64 -func (obj *rsvpMetric) HasHellosTx() bool { - return obj.obj.HellosTx != nil -} - -// The number of Hello messages sent by this RSVP router. -// SetHellosTx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetHellosTx(value uint64) RsvpMetric { - - obj.obj.HellosTx = &value - return obj -} - -// The number of Hello messages received by this RSVP router. -// HellosRx returns a uint64 -func (obj *rsvpMetric) HellosRx() uint64 { - - return *obj.obj.HellosRx - -} - -// The number of Hello messages received by this RSVP router. -// HellosRx returns a uint64 -func (obj *rsvpMetric) HasHellosRx() bool { - return obj.obj.HellosRx != nil -} - -// The number of Hello messages received by this RSVP router. -// SetHellosRx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetHellosRx(value uint64) RsvpMetric { - - obj.obj.HellosRx = &value - return obj -} - -// The number of Ack messages sent by this RSVP router. -// AcksTx returns a uint64 -func (obj *rsvpMetric) AcksTx() uint64 { - - return *obj.obj.AcksTx - -} - -// The number of Ack messages sent by this RSVP router. -// AcksTx returns a uint64 -func (obj *rsvpMetric) HasAcksTx() bool { - return obj.obj.AcksTx != nil -} - -// The number of Ack messages sent by this RSVP router. -// SetAcksTx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetAcksTx(value uint64) RsvpMetric { - - obj.obj.AcksTx = &value - return obj -} - -// The number of Ack messages received by this RSVP router. -// AcksRx returns a uint64 -func (obj *rsvpMetric) AcksRx() uint64 { - - return *obj.obj.AcksRx - -} - -// The number of Ack messages received by this RSVP router. -// AcksRx returns a uint64 -func (obj *rsvpMetric) HasAcksRx() bool { - return obj.obj.AcksRx != nil -} - -// The number of Ack messages received by this RSVP router. -// SetAcksRx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetAcksRx(value uint64) RsvpMetric { - - obj.obj.AcksRx = &value - return obj -} - -// The number of Nack messages sent by this RSVP router. -// NacksTx returns a uint64 -func (obj *rsvpMetric) NacksTx() uint64 { - - return *obj.obj.NacksTx - -} - -// The number of Nack messages sent by this RSVP router. -// NacksTx returns a uint64 -func (obj *rsvpMetric) HasNacksTx() bool { - return obj.obj.NacksTx != nil -} - -// The number of Nack messages sent by this RSVP router. -// SetNacksTx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetNacksTx(value uint64) RsvpMetric { - - obj.obj.NacksTx = &value - return obj -} - -// The number of Nack messages received by this RSVP router. -// NacksRx returns a uint64 -func (obj *rsvpMetric) NacksRx() uint64 { - - return *obj.obj.NacksRx - -} - -// The number of Nack messages received by this RSVP router. -// NacksRx returns a uint64 -func (obj *rsvpMetric) HasNacksRx() bool { - return obj.obj.NacksRx != nil -} - -// The number of Nack messages received by this RSVP router. -// SetNacksRx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetNacksRx(value uint64) RsvpMetric { - - obj.obj.NacksRx = &value - return obj -} - -// The number of SRefresh messages sent by this RSVP router. -// SrefreshTx returns a uint64 -func (obj *rsvpMetric) SrefreshTx() uint64 { - - return *obj.obj.SrefreshTx - -} - -// The number of SRefresh messages sent by this RSVP router. -// SrefreshTx returns a uint64 -func (obj *rsvpMetric) HasSrefreshTx() bool { - return obj.obj.SrefreshTx != nil -} - -// The number of SRefresh messages sent by this RSVP router. -// SetSrefreshTx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetSrefreshTx(value uint64) RsvpMetric { - - obj.obj.SrefreshTx = &value - return obj -} - -// The number of SRefresh messages received by this RSVP router. -// SrefreshRx returns a uint64 -func (obj *rsvpMetric) SrefreshRx() uint64 { - - return *obj.obj.SrefreshRx - -} - -// The number of SRefresh messages received by this RSVP router. -// SrefreshRx returns a uint64 -func (obj *rsvpMetric) HasSrefreshRx() bool { - return obj.obj.SrefreshRx != nil -} - -// The number of SRefresh messages received by this RSVP router. -// SetSrefreshRx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetSrefreshRx(value uint64) RsvpMetric { - - obj.obj.SrefreshRx = &value - return obj -} - -// The number of Bundle messages sent by this RSVP router. -// BundleTx returns a uint64 -func (obj *rsvpMetric) BundleTx() uint64 { - - return *obj.obj.BundleTx - -} - -// The number of Bundle messages sent by this RSVP router. -// BundleTx returns a uint64 -func (obj *rsvpMetric) HasBundleTx() bool { - return obj.obj.BundleTx != nil -} - -// The number of Bundle messages sent by this RSVP router. -// SetBundleTx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetBundleTx(value uint64) RsvpMetric { - - obj.obj.BundleTx = &value - return obj -} - -// The number of Bundle messages received by this RSVP router. -// BundleRx returns a uint64 -func (obj *rsvpMetric) BundleRx() uint64 { - - return *obj.obj.BundleRx - -} - -// The number of Bundle messages received by this RSVP router. -// BundleRx returns a uint64 -func (obj *rsvpMetric) HasBundleRx() bool { - return obj.obj.BundleRx != nil -} - -// The number of Bundle messages received by this RSVP router. -// SetBundleRx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetBundleRx(value uint64) RsvpMetric { - - obj.obj.BundleRx = &value - return obj -} - -// The number of Path messages with Path Re-evaluation Request enabled sent by this RSVP router. -// PathReevaluationRequestTx returns a uint64 -func (obj *rsvpMetric) PathReevaluationRequestTx() uint64 { - - return *obj.obj.PathReevaluationRequestTx - -} - -// The number of Path messages with Path Re-evaluation Request enabled sent by this RSVP router. -// PathReevaluationRequestTx returns a uint64 -func (obj *rsvpMetric) HasPathReevaluationRequestTx() bool { - return obj.obj.PathReevaluationRequestTx != nil -} - -// The number of Path messages with Path Re-evaluation Request enabled sent by this RSVP router. -// SetPathReevaluationRequestTx sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetPathReevaluationRequestTx(value uint64) RsvpMetric { - - obj.obj.PathReevaluationRequestTx = &value - return obj -} - -// The number of successfully completed Make-Before-Break operations on LSPs on this RSVP router. -// PathReoptimizations returns a uint64 -func (obj *rsvpMetric) PathReoptimizations() uint64 { - - return *obj.obj.PathReoptimizations - -} - -// The number of successfully completed Make-Before-Break operations on LSPs on this RSVP router. -// PathReoptimizations returns a uint64 -func (obj *rsvpMetric) HasPathReoptimizations() bool { - return obj.obj.PathReoptimizations != nil -} - -// The number of successfully completed Make-Before-Break operations on LSPs on this RSVP router. -// SetPathReoptimizations sets the uint64 value in the RsvpMetric object -func (obj *rsvpMetric) SetPathReoptimizations(value uint64) RsvpMetric { - - obj.obj.PathReoptimizations = &value - return obj -} - -func (obj *rsvpMetric) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *rsvpMetric) setDefault() { - -} - -// ***** Dhcpv4ClientMetric ***** -type dhcpv4ClientMetric struct { - validation - obj *otg.Dhcpv4ClientMetric - marshaller marshalDhcpv4ClientMetric - unMarshaller unMarshalDhcpv4ClientMetric -} - -func NewDhcpv4ClientMetric() Dhcpv4ClientMetric { - obj := dhcpv4ClientMetric{obj: &otg.Dhcpv4ClientMetric{}} - obj.setDefault() - return &obj -} - -func (obj *dhcpv4ClientMetric) msg() *otg.Dhcpv4ClientMetric { - return obj.obj -} - -func (obj *dhcpv4ClientMetric) setMsg(msg *otg.Dhcpv4ClientMetric) Dhcpv4ClientMetric { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldhcpv4ClientMetric struct { - obj *dhcpv4ClientMetric -} - -type marshalDhcpv4ClientMetric interface { - // ToProto marshals Dhcpv4ClientMetric to protobuf object *otg.Dhcpv4ClientMetric - ToProto() (*otg.Dhcpv4ClientMetric, error) - // ToPbText marshals Dhcpv4ClientMetric to protobuf text - ToPbText() (string, error) - // ToYaml marshals Dhcpv4ClientMetric to YAML text - ToYaml() (string, error) - // ToJson marshals Dhcpv4ClientMetric to JSON text - ToJson() (string, error) -} - -type unMarshaldhcpv4ClientMetric struct { - obj *dhcpv4ClientMetric -} - -type unMarshalDhcpv4ClientMetric interface { - // FromProto unmarshals Dhcpv4ClientMetric from protobuf object *otg.Dhcpv4ClientMetric - FromProto(msg *otg.Dhcpv4ClientMetric) (Dhcpv4ClientMetric, error) - // FromPbText unmarshals Dhcpv4ClientMetric from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Dhcpv4ClientMetric from YAML text - FromYaml(value string) error - // FromJson unmarshals Dhcpv4ClientMetric from JSON text - FromJson(value string) error -} - -func (obj *dhcpv4ClientMetric) Marshal() marshalDhcpv4ClientMetric { - if obj.marshaller == nil { - obj.marshaller = &marshaldhcpv4ClientMetric{obj: obj} - } - return obj.marshaller -} - -func (obj *dhcpv4ClientMetric) Unmarshal() unMarshalDhcpv4ClientMetric { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldhcpv4ClientMetric{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldhcpv4ClientMetric) ToProto() (*otg.Dhcpv4ClientMetric, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldhcpv4ClientMetric) FromProto(msg *otg.Dhcpv4ClientMetric) (Dhcpv4ClientMetric, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldhcpv4ClientMetric) 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 *unMarshaldhcpv4ClientMetric) 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 *marshaldhcpv4ClientMetric) 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 *unMarshaldhcpv4ClientMetric) 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 *marshaldhcpv4ClientMetric) 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 *unMarshaldhcpv4ClientMetric) 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 *dhcpv4ClientMetric) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *dhcpv4ClientMetric) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *dhcpv4ClientMetric) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *dhcpv4ClientMetric) Clone() (Dhcpv4ClientMetric, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDhcpv4ClientMetric() - 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 -} - -// Dhcpv4ClientMetric is dHCPv4 per peer statistics information. -type Dhcpv4ClientMetric interface { - Validation - // msg marshals Dhcpv4ClientMetric to protobuf object *otg.Dhcpv4ClientMetric - // and doesn't set defaults - msg() *otg.Dhcpv4ClientMetric - // setMsg unmarshals Dhcpv4ClientMetric from protobuf object *otg.Dhcpv4ClientMetric - // and doesn't set defaults - setMsg(*otg.Dhcpv4ClientMetric) Dhcpv4ClientMetric - // provides marshal interface - Marshal() marshalDhcpv4ClientMetric - // provides unmarshal interface - Unmarshal() unMarshalDhcpv4ClientMetric - // validate validates Dhcpv4ClientMetric - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Dhcpv4ClientMetric, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in Dhcpv4ClientMetric. - Name() string - // SetName assigns string provided by user to Dhcpv4ClientMetric - SetName(value string) Dhcpv4ClientMetric - // HasName checks if Name has been set in Dhcpv4ClientMetric - HasName() bool - // DiscoversSent returns uint64, set in Dhcpv4ClientMetric. - DiscoversSent() uint64 - // SetDiscoversSent assigns uint64 provided by user to Dhcpv4ClientMetric - SetDiscoversSent(value uint64) Dhcpv4ClientMetric - // HasDiscoversSent checks if DiscoversSent has been set in Dhcpv4ClientMetric - HasDiscoversSent() bool - // OffersReceived returns uint64, set in Dhcpv4ClientMetric. - OffersReceived() uint64 - // SetOffersReceived assigns uint64 provided by user to Dhcpv4ClientMetric - SetOffersReceived(value uint64) Dhcpv4ClientMetric - // HasOffersReceived checks if OffersReceived has been set in Dhcpv4ClientMetric - HasOffersReceived() bool - // RequestsSent returns uint64, set in Dhcpv4ClientMetric. - RequestsSent() uint64 - // SetRequestsSent assigns uint64 provided by user to Dhcpv4ClientMetric - SetRequestsSent(value uint64) Dhcpv4ClientMetric - // HasRequestsSent checks if RequestsSent has been set in Dhcpv4ClientMetric - HasRequestsSent() bool - // AcksReceived returns uint64, set in Dhcpv4ClientMetric. - AcksReceived() uint64 - // SetAcksReceived assigns uint64 provided by user to Dhcpv4ClientMetric - SetAcksReceived(value uint64) Dhcpv4ClientMetric - // HasAcksReceived checks if AcksReceived has been set in Dhcpv4ClientMetric - HasAcksReceived() bool - // NacksReceived returns uint64, set in Dhcpv4ClientMetric. - NacksReceived() uint64 - // SetNacksReceived assigns uint64 provided by user to Dhcpv4ClientMetric - SetNacksReceived(value uint64) Dhcpv4ClientMetric - // HasNacksReceived checks if NacksReceived has been set in Dhcpv4ClientMetric - HasNacksReceived() bool - // ReleasesSent returns uint64, set in Dhcpv4ClientMetric. - ReleasesSent() uint64 - // SetReleasesSent assigns uint64 provided by user to Dhcpv4ClientMetric - SetReleasesSent(value uint64) Dhcpv4ClientMetric - // HasReleasesSent checks if ReleasesSent has been set in Dhcpv4ClientMetric - HasReleasesSent() bool - // DeclinesSent returns uint64, set in Dhcpv4ClientMetric. - DeclinesSent() uint64 - // SetDeclinesSent assigns uint64 provided by user to Dhcpv4ClientMetric - SetDeclinesSent(value uint64) Dhcpv4ClientMetric - // HasDeclinesSent checks if DeclinesSent has been set in Dhcpv4ClientMetric - HasDeclinesSent() bool -} - -// The name of a configured DHCPv4 client. -// Name returns a string -func (obj *dhcpv4ClientMetric) Name() string { - - return *obj.obj.Name - -} - -// The name of a configured DHCPv4 client. -// Name returns a string -func (obj *dhcpv4ClientMetric) HasName() bool { - return obj.obj.Name != nil -} - -// The name of a configured DHCPv4 client. -// SetName sets the string value in the Dhcpv4ClientMetric object -func (obj *dhcpv4ClientMetric) SetName(value string) Dhcpv4ClientMetric { - - obj.obj.Name = &value - return obj -} - -// Number of DHCPDISCOVER messages sent. -// DiscoversSent returns a uint64 -func (obj *dhcpv4ClientMetric) DiscoversSent() uint64 { - - return *obj.obj.DiscoversSent - -} - -// Number of DHCPDISCOVER messages sent. -// DiscoversSent returns a uint64 -func (obj *dhcpv4ClientMetric) HasDiscoversSent() bool { - return obj.obj.DiscoversSent != nil -} - -// Number of DHCPDISCOVER messages sent. -// SetDiscoversSent sets the uint64 value in the Dhcpv4ClientMetric object -func (obj *dhcpv4ClientMetric) SetDiscoversSent(value uint64) Dhcpv4ClientMetric { - - obj.obj.DiscoversSent = &value - return obj -} - -// Number of DHCPOFFER messages received. -// OffersReceived returns a uint64 -func (obj *dhcpv4ClientMetric) OffersReceived() uint64 { - - return *obj.obj.OffersReceived - -} - -// Number of DHCPOFFER messages received. -// OffersReceived returns a uint64 -func (obj *dhcpv4ClientMetric) HasOffersReceived() bool { - return obj.obj.OffersReceived != nil -} - -// Number of DHCPOFFER messages received. -// SetOffersReceived sets the uint64 value in the Dhcpv4ClientMetric object -func (obj *dhcpv4ClientMetric) SetOffersReceived(value uint64) Dhcpv4ClientMetric { - - obj.obj.OffersReceived = &value - return obj -} - -// Number of DHCPREQUEST messages sent. -// RequestsSent returns a uint64 -func (obj *dhcpv4ClientMetric) RequestsSent() uint64 { - - return *obj.obj.RequestsSent - -} - -// Number of DHCPREQUEST messages sent. -// RequestsSent returns a uint64 -func (obj *dhcpv4ClientMetric) HasRequestsSent() bool { - return obj.obj.RequestsSent != nil -} - -// Number of DHCPREQUEST messages sent. -// SetRequestsSent sets the uint64 value in the Dhcpv4ClientMetric object -func (obj *dhcpv4ClientMetric) SetRequestsSent(value uint64) Dhcpv4ClientMetric { - - obj.obj.RequestsSent = &value - return obj -} - -// Number of lease DHCPACK messages received. -// AcksReceived returns a uint64 -func (obj *dhcpv4ClientMetric) AcksReceived() uint64 { - - return *obj.obj.AcksReceived - -} - -// Number of lease DHCPACK messages received. -// AcksReceived returns a uint64 -func (obj *dhcpv4ClientMetric) HasAcksReceived() bool { - return obj.obj.AcksReceived != nil -} - -// Number of lease DHCPACK messages received. -// SetAcksReceived sets the uint64 value in the Dhcpv4ClientMetric object -func (obj *dhcpv4ClientMetric) SetAcksReceived(value uint64) Dhcpv4ClientMetric { - - obj.obj.AcksReceived = &value - return obj -} - -// Number of negative lease DHCPNACK messages received. -// NacksReceived returns a uint64 -func (obj *dhcpv4ClientMetric) NacksReceived() uint64 { - - return *obj.obj.NacksReceived - -} - -// Number of negative lease DHCPNACK messages received. -// NacksReceived returns a uint64 -func (obj *dhcpv4ClientMetric) HasNacksReceived() bool { - return obj.obj.NacksReceived != nil -} - -// Number of negative lease DHCPNACK messages received. -// SetNacksReceived sets the uint64 value in the Dhcpv4ClientMetric object -func (obj *dhcpv4ClientMetric) SetNacksReceived(value uint64) Dhcpv4ClientMetric { - - obj.obj.NacksReceived = &value - return obj -} - -// Number of DHCPRELEASE messages sent. -// ReleasesSent returns a uint64 -func (obj *dhcpv4ClientMetric) ReleasesSent() uint64 { - - return *obj.obj.ReleasesSent - -} - -// Number of DHCPRELEASE messages sent. -// ReleasesSent returns a uint64 -func (obj *dhcpv4ClientMetric) HasReleasesSent() bool { - return obj.obj.ReleasesSent != nil -} - -// Number of DHCPRELEASE messages sent. -// SetReleasesSent sets the uint64 value in the Dhcpv4ClientMetric object -func (obj *dhcpv4ClientMetric) SetReleasesSent(value uint64) Dhcpv4ClientMetric { - - obj.obj.ReleasesSent = &value - return obj -} - -// Number of DHCPDECLINE messages sent. -// DeclinesSent returns a uint64 -func (obj *dhcpv4ClientMetric) DeclinesSent() uint64 { - - return *obj.obj.DeclinesSent - -} - -// Number of DHCPDECLINE messages sent. -// DeclinesSent returns a uint64 -func (obj *dhcpv4ClientMetric) HasDeclinesSent() bool { - return obj.obj.DeclinesSent != nil -} - -// Number of DHCPDECLINE messages sent. -// SetDeclinesSent sets the uint64 value in the Dhcpv4ClientMetric object -func (obj *dhcpv4ClientMetric) SetDeclinesSent(value uint64) Dhcpv4ClientMetric { - - obj.obj.DeclinesSent = &value - return obj -} - -func (obj *dhcpv4ClientMetric) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *dhcpv4ClientMetric) setDefault() { - -} - -// ***** Dhcpv4ServerMetric ***** -type dhcpv4ServerMetric struct { - validation - obj *otg.Dhcpv4ServerMetric - marshaller marshalDhcpv4ServerMetric - unMarshaller unMarshalDhcpv4ServerMetric -} - -func NewDhcpv4ServerMetric() Dhcpv4ServerMetric { - obj := dhcpv4ServerMetric{obj: &otg.Dhcpv4ServerMetric{}} - obj.setDefault() - return &obj -} - -func (obj *dhcpv4ServerMetric) msg() *otg.Dhcpv4ServerMetric { - return obj.obj -} - -func (obj *dhcpv4ServerMetric) setMsg(msg *otg.Dhcpv4ServerMetric) Dhcpv4ServerMetric { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldhcpv4ServerMetric struct { - obj *dhcpv4ServerMetric -} - -type marshalDhcpv4ServerMetric interface { - // ToProto marshals Dhcpv4ServerMetric to protobuf object *otg.Dhcpv4ServerMetric - ToProto() (*otg.Dhcpv4ServerMetric, error) - // ToPbText marshals Dhcpv4ServerMetric to protobuf text - ToPbText() (string, error) - // ToYaml marshals Dhcpv4ServerMetric to YAML text - ToYaml() (string, error) - // ToJson marshals Dhcpv4ServerMetric to JSON text - ToJson() (string, error) -} - -type unMarshaldhcpv4ServerMetric struct { - obj *dhcpv4ServerMetric -} - -type unMarshalDhcpv4ServerMetric interface { - // FromProto unmarshals Dhcpv4ServerMetric from protobuf object *otg.Dhcpv4ServerMetric - FromProto(msg *otg.Dhcpv4ServerMetric) (Dhcpv4ServerMetric, error) - // FromPbText unmarshals Dhcpv4ServerMetric from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Dhcpv4ServerMetric from YAML text - FromYaml(value string) error - // FromJson unmarshals Dhcpv4ServerMetric from JSON text - FromJson(value string) error -} - -func (obj *dhcpv4ServerMetric) Marshal() marshalDhcpv4ServerMetric { - if obj.marshaller == nil { - obj.marshaller = &marshaldhcpv4ServerMetric{obj: obj} - } - return obj.marshaller -} - -func (obj *dhcpv4ServerMetric) Unmarshal() unMarshalDhcpv4ServerMetric { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldhcpv4ServerMetric{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldhcpv4ServerMetric) ToProto() (*otg.Dhcpv4ServerMetric, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldhcpv4ServerMetric) FromProto(msg *otg.Dhcpv4ServerMetric) (Dhcpv4ServerMetric, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldhcpv4ServerMetric) 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 *unMarshaldhcpv4ServerMetric) 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 *marshaldhcpv4ServerMetric) 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 *unMarshaldhcpv4ServerMetric) 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 *marshaldhcpv4ServerMetric) 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 *unMarshaldhcpv4ServerMetric) 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 *dhcpv4ServerMetric) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *dhcpv4ServerMetric) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *dhcpv4ServerMetric) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *dhcpv4ServerMetric) Clone() (Dhcpv4ServerMetric, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDhcpv4ServerMetric() - 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 -} - -// Dhcpv4ServerMetric is dHCPv4 per peer statistics information. -type Dhcpv4ServerMetric interface { - Validation - // msg marshals Dhcpv4ServerMetric to protobuf object *otg.Dhcpv4ServerMetric - // and doesn't set defaults - msg() *otg.Dhcpv4ServerMetric - // setMsg unmarshals Dhcpv4ServerMetric from protobuf object *otg.Dhcpv4ServerMetric - // and doesn't set defaults - setMsg(*otg.Dhcpv4ServerMetric) Dhcpv4ServerMetric - // provides marshal interface - Marshal() marshalDhcpv4ServerMetric - // provides unmarshal interface - Unmarshal() unMarshalDhcpv4ServerMetric - // validate validates Dhcpv4ServerMetric - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Dhcpv4ServerMetric, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in Dhcpv4ServerMetric. - Name() string - // SetName assigns string provided by user to Dhcpv4ServerMetric - SetName(value string) Dhcpv4ServerMetric - // HasName checks if Name has been set in Dhcpv4ServerMetric - HasName() bool - // DiscoversReceived returns uint64, set in Dhcpv4ServerMetric. - DiscoversReceived() uint64 - // SetDiscoversReceived assigns uint64 provided by user to Dhcpv4ServerMetric - SetDiscoversReceived(value uint64) Dhcpv4ServerMetric - // HasDiscoversReceived checks if DiscoversReceived has been set in Dhcpv4ServerMetric - HasDiscoversReceived() bool - // OffersSent returns uint64, set in Dhcpv4ServerMetric. - OffersSent() uint64 - // SetOffersSent assigns uint64 provided by user to Dhcpv4ServerMetric - SetOffersSent(value uint64) Dhcpv4ServerMetric - // HasOffersSent checks if OffersSent has been set in Dhcpv4ServerMetric - HasOffersSent() bool - // RequestsReceived returns uint64, set in Dhcpv4ServerMetric. - RequestsReceived() uint64 - // SetRequestsReceived assigns uint64 provided by user to Dhcpv4ServerMetric - SetRequestsReceived(value uint64) Dhcpv4ServerMetric - // HasRequestsReceived checks if RequestsReceived has been set in Dhcpv4ServerMetric - HasRequestsReceived() bool - // AcksSent returns uint64, set in Dhcpv4ServerMetric. - AcksSent() uint64 - // SetAcksSent assigns uint64 provided by user to Dhcpv4ServerMetric - SetAcksSent(value uint64) Dhcpv4ServerMetric - // HasAcksSent checks if AcksSent has been set in Dhcpv4ServerMetric - HasAcksSent() bool - // NacksSent returns uint64, set in Dhcpv4ServerMetric. - NacksSent() uint64 - // SetNacksSent assigns uint64 provided by user to Dhcpv4ServerMetric - SetNacksSent(value uint64) Dhcpv4ServerMetric - // HasNacksSent checks if NacksSent has been set in Dhcpv4ServerMetric - HasNacksSent() bool - // ReleasesReceived returns uint64, set in Dhcpv4ServerMetric. - ReleasesReceived() uint64 - // SetReleasesReceived assigns uint64 provided by user to Dhcpv4ServerMetric - SetReleasesReceived(value uint64) Dhcpv4ServerMetric - // HasReleasesReceived checks if ReleasesReceived has been set in Dhcpv4ServerMetric - HasReleasesReceived() bool - // DeclinesReceived returns uint64, set in Dhcpv4ServerMetric. - DeclinesReceived() uint64 - // SetDeclinesReceived assigns uint64 provided by user to Dhcpv4ServerMetric - SetDeclinesReceived(value uint64) Dhcpv4ServerMetric - // HasDeclinesReceived checks if DeclinesReceived has been set in Dhcpv4ServerMetric - HasDeclinesReceived() bool -} - -// The name of a configured DHCPv4 Server. -// Name returns a string -func (obj *dhcpv4ServerMetric) Name() string { - - return *obj.obj.Name - -} - -// The name of a configured DHCPv4 Server. -// Name returns a string -func (obj *dhcpv4ServerMetric) HasName() bool { - return obj.obj.Name != nil -} - -// The name of a configured DHCPv4 Server. -// SetName sets the string value in the Dhcpv4ServerMetric object -func (obj *dhcpv4ServerMetric) SetName(value string) Dhcpv4ServerMetric { - - obj.obj.Name = &value - return obj -} - -// Number of DHCPDISCOVER messages received. -// DiscoversReceived returns a uint64 -func (obj *dhcpv4ServerMetric) DiscoversReceived() uint64 { - - return *obj.obj.DiscoversReceived - -} - -// Number of DHCPDISCOVER messages received. -// DiscoversReceived returns a uint64 -func (obj *dhcpv4ServerMetric) HasDiscoversReceived() bool { - return obj.obj.DiscoversReceived != nil -} - -// Number of DHCPDISCOVER messages received. -// SetDiscoversReceived sets the uint64 value in the Dhcpv4ServerMetric object -func (obj *dhcpv4ServerMetric) SetDiscoversReceived(value uint64) Dhcpv4ServerMetric { - - obj.obj.DiscoversReceived = &value - return obj -} - -// Number of DHCPOFFER messages sent. -// OffersSent returns a uint64 -func (obj *dhcpv4ServerMetric) OffersSent() uint64 { - - return *obj.obj.OffersSent - -} - -// Number of DHCPOFFER messages sent. -// OffersSent returns a uint64 -func (obj *dhcpv4ServerMetric) HasOffersSent() bool { - return obj.obj.OffersSent != nil -} - -// Number of DHCPOFFER messages sent. -// SetOffersSent sets the uint64 value in the Dhcpv4ServerMetric object -func (obj *dhcpv4ServerMetric) SetOffersSent(value uint64) Dhcpv4ServerMetric { - - obj.obj.OffersSent = &value - return obj -} - -// Number of DHCPOFFER messages received. -// RequestsReceived returns a uint64 -func (obj *dhcpv4ServerMetric) RequestsReceived() uint64 { - - return *obj.obj.RequestsReceived - -} - -// Number of DHCPOFFER messages received. -// RequestsReceived returns a uint64 -func (obj *dhcpv4ServerMetric) HasRequestsReceived() bool { - return obj.obj.RequestsReceived != nil -} - -// Number of DHCPOFFER messages received. -// SetRequestsReceived sets the uint64 value in the Dhcpv4ServerMetric object -func (obj *dhcpv4ServerMetric) SetRequestsReceived(value uint64) Dhcpv4ServerMetric { - - obj.obj.RequestsReceived = &value - return obj -} - -// Number of lease DHCPACK messages sent. -// AcksSent returns a uint64 -func (obj *dhcpv4ServerMetric) AcksSent() uint64 { - - return *obj.obj.AcksSent - -} - -// Number of lease DHCPACK messages sent. -// AcksSent returns a uint64 -func (obj *dhcpv4ServerMetric) HasAcksSent() bool { - return obj.obj.AcksSent != nil -} - -// Number of lease DHCPACK messages sent. -// SetAcksSent sets the uint64 value in the Dhcpv4ServerMetric object -func (obj *dhcpv4ServerMetric) SetAcksSent(value uint64) Dhcpv4ServerMetric { - - obj.obj.AcksSent = &value - return obj -} - -// Number of negative lease DHCPNACK messages sent. -// NacksSent returns a uint64 -func (obj *dhcpv4ServerMetric) NacksSent() uint64 { - - return *obj.obj.NacksSent - -} - -// Number of negative lease DHCPNACK messages sent. -// NacksSent returns a uint64 -func (obj *dhcpv4ServerMetric) HasNacksSent() bool { - return obj.obj.NacksSent != nil -} - -// Number of negative lease DHCPNACK messages sent. -// SetNacksSent sets the uint64 value in the Dhcpv4ServerMetric object -func (obj *dhcpv4ServerMetric) SetNacksSent(value uint64) Dhcpv4ServerMetric { - - obj.obj.NacksSent = &value - return obj -} - -// Number of DHCPRELEASE messages received. -// ReleasesReceived returns a uint64 -func (obj *dhcpv4ServerMetric) ReleasesReceived() uint64 { - - return *obj.obj.ReleasesReceived - -} - -// Number of DHCPRELEASE messages received. -// ReleasesReceived returns a uint64 -func (obj *dhcpv4ServerMetric) HasReleasesReceived() bool { - return obj.obj.ReleasesReceived != nil -} - -// Number of DHCPRELEASE messages received. -// SetReleasesReceived sets the uint64 value in the Dhcpv4ServerMetric object -func (obj *dhcpv4ServerMetric) SetReleasesReceived(value uint64) Dhcpv4ServerMetric { - - obj.obj.ReleasesReceived = &value - return obj -} - -// Number of DHCPDECLINE messages received. -// DeclinesReceived returns a uint64 -func (obj *dhcpv4ServerMetric) DeclinesReceived() uint64 { - - return *obj.obj.DeclinesReceived - -} - -// Number of DHCPDECLINE messages received. -// DeclinesReceived returns a uint64 -func (obj *dhcpv4ServerMetric) HasDeclinesReceived() bool { - return obj.obj.DeclinesReceived != nil -} - -// Number of DHCPDECLINE messages received. -// SetDeclinesReceived sets the uint64 value in the Dhcpv4ServerMetric object -func (obj *dhcpv4ServerMetric) SetDeclinesReceived(value uint64) Dhcpv4ServerMetric { - - obj.obj.DeclinesReceived = &value - return obj -} - -func (obj *dhcpv4ServerMetric) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *dhcpv4ServerMetric) setDefault() { - -} - -// ***** Neighborsv4State ***** -type neighborsv4State struct { - validation - obj *otg.Neighborsv4State - marshaller marshalNeighborsv4State - unMarshaller unMarshalNeighborsv4State -} - -func NewNeighborsv4State() Neighborsv4State { - obj := neighborsv4State{obj: &otg.Neighborsv4State{}} - obj.setDefault() - return &obj -} - -func (obj *neighborsv4State) msg() *otg.Neighborsv4State { - return obj.obj -} - -func (obj *neighborsv4State) setMsg(msg *otg.Neighborsv4State) Neighborsv4State { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalneighborsv4State struct { - obj *neighborsv4State -} - -type marshalNeighborsv4State interface { - // ToProto marshals Neighborsv4State to protobuf object *otg.Neighborsv4State - ToProto() (*otg.Neighborsv4State, error) - // ToPbText marshals Neighborsv4State to protobuf text - ToPbText() (string, error) - // ToYaml marshals Neighborsv4State to YAML text - ToYaml() (string, error) - // ToJson marshals Neighborsv4State to JSON text - ToJson() (string, error) -} - -type unMarshalneighborsv4State struct { - obj *neighborsv4State -} - -type unMarshalNeighborsv4State interface { - // FromProto unmarshals Neighborsv4State from protobuf object *otg.Neighborsv4State - FromProto(msg *otg.Neighborsv4State) (Neighborsv4State, error) - // FromPbText unmarshals Neighborsv4State from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Neighborsv4State from YAML text - FromYaml(value string) error - // FromJson unmarshals Neighborsv4State from JSON text - FromJson(value string) error -} - -func (obj *neighborsv4State) Marshal() marshalNeighborsv4State { - if obj.marshaller == nil { - obj.marshaller = &marshalneighborsv4State{obj: obj} - } - return obj.marshaller -} - -func (obj *neighborsv4State) Unmarshal() unMarshalNeighborsv4State { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalneighborsv4State{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalneighborsv4State) ToProto() (*otg.Neighborsv4State, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalneighborsv4State) FromProto(msg *otg.Neighborsv4State) (Neighborsv4State, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalneighborsv4State) 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 *unMarshalneighborsv4State) 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 *marshalneighborsv4State) 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 *unMarshalneighborsv4State) 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 *marshalneighborsv4State) 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 *unMarshalneighborsv4State) 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 *neighborsv4State) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *neighborsv4State) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *neighborsv4State) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *neighborsv4State) Clone() (Neighborsv4State, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewNeighborsv4State() - 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 -} - -// Neighborsv4State is iPv4 Neighbor state (ARP cache entry). -type Neighborsv4State interface { - Validation - // msg marshals Neighborsv4State to protobuf object *otg.Neighborsv4State - // and doesn't set defaults - msg() *otg.Neighborsv4State - // setMsg unmarshals Neighborsv4State from protobuf object *otg.Neighborsv4State - // and doesn't set defaults - setMsg(*otg.Neighborsv4State) Neighborsv4State - // provides marshal interface - Marshal() marshalNeighborsv4State - // provides unmarshal interface - Unmarshal() unMarshalNeighborsv4State - // validate validates Neighborsv4State - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Neighborsv4State, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // EthernetName returns string, set in Neighborsv4State. - EthernetName() string - // SetEthernetName assigns string provided by user to Neighborsv4State - SetEthernetName(value string) Neighborsv4State - // Ipv4Address returns string, set in Neighborsv4State. - Ipv4Address() string - // SetIpv4Address assigns string provided by user to Neighborsv4State - SetIpv4Address(value string) Neighborsv4State - // LinkLayerAddress returns string, set in Neighborsv4State. - LinkLayerAddress() string - // SetLinkLayerAddress assigns string provided by user to Neighborsv4State - SetLinkLayerAddress(value string) Neighborsv4State - // HasLinkLayerAddress checks if LinkLayerAddress has been set in Neighborsv4State - HasLinkLayerAddress() bool -} - -// The name of the Ethernet interface associated with the Neighbor state (ARP cache entry). -// EthernetName returns a string -func (obj *neighborsv4State) EthernetName() string { - - return *obj.obj.EthernetName - -} - -// The name of the Ethernet interface associated with the Neighbor state (ARP cache entry). -// SetEthernetName sets the string value in the Neighborsv4State object -func (obj *neighborsv4State) SetEthernetName(value string) Neighborsv4State { - - obj.obj.EthernetName = &value - return obj -} - -// The IPv4 address of the neighbor. -// Ipv4Address returns a string -func (obj *neighborsv4State) Ipv4Address() string { - - return *obj.obj.Ipv4Address - -} - -// The IPv4 address of the neighbor. -// SetIpv4Address sets the string value in the Neighborsv4State object -func (obj *neighborsv4State) SetIpv4Address(value string) Neighborsv4State { - - obj.obj.Ipv4Address = &value - return obj -} - -// The link-layer address (MAC) of the neighbor. -// LinkLayerAddress returns a string -func (obj *neighborsv4State) LinkLayerAddress() string { - - return *obj.obj.LinkLayerAddress - -} - -// The link-layer address (MAC) of the neighbor. -// LinkLayerAddress returns a string -func (obj *neighborsv4State) HasLinkLayerAddress() bool { - return obj.obj.LinkLayerAddress != nil -} - -// The link-layer address (MAC) of the neighbor. -// SetLinkLayerAddress sets the string value in the Neighborsv4State object -func (obj *neighborsv4State) SetLinkLayerAddress(value string) Neighborsv4State { - - obj.obj.LinkLayerAddress = &value - return obj -} - -func (obj *neighborsv4State) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // EthernetName is required - if obj.obj.EthernetName == nil { - vObj.validationErrors = append(vObj.validationErrors, "EthernetName is required field on interface Neighborsv4State") - } - - // Ipv4Address is required - if obj.obj.Ipv4Address == nil { - vObj.validationErrors = append(vObj.validationErrors, "Ipv4Address is required field on interface Neighborsv4State") - } - if obj.obj.Ipv4Address != nil { - - err := obj.validateIpv4(obj.Ipv4Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on Neighborsv4State.Ipv4Address")) - } - - } - - if obj.obj.LinkLayerAddress != nil { - - err := obj.validateMac(obj.LinkLayerAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on Neighborsv4State.LinkLayerAddress")) - } - - } - -} - -func (obj *neighborsv4State) setDefault() { - -} - -// ***** Neighborsv6State ***** -type neighborsv6State struct { - validation - obj *otg.Neighborsv6State - marshaller marshalNeighborsv6State - unMarshaller unMarshalNeighborsv6State -} - -func NewNeighborsv6State() Neighborsv6State { - obj := neighborsv6State{obj: &otg.Neighborsv6State{}} - obj.setDefault() - return &obj -} - -func (obj *neighborsv6State) msg() *otg.Neighborsv6State { - return obj.obj -} - -func (obj *neighborsv6State) setMsg(msg *otg.Neighborsv6State) Neighborsv6State { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalneighborsv6State struct { - obj *neighborsv6State -} - -type marshalNeighborsv6State interface { - // ToProto marshals Neighborsv6State to protobuf object *otg.Neighborsv6State - ToProto() (*otg.Neighborsv6State, error) - // ToPbText marshals Neighborsv6State to protobuf text - ToPbText() (string, error) - // ToYaml marshals Neighborsv6State to YAML text - ToYaml() (string, error) - // ToJson marshals Neighborsv6State to JSON text - ToJson() (string, error) -} - -type unMarshalneighborsv6State struct { - obj *neighborsv6State -} - -type unMarshalNeighborsv6State interface { - // FromProto unmarshals Neighborsv6State from protobuf object *otg.Neighborsv6State - FromProto(msg *otg.Neighborsv6State) (Neighborsv6State, error) - // FromPbText unmarshals Neighborsv6State from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Neighborsv6State from YAML text - FromYaml(value string) error - // FromJson unmarshals Neighborsv6State from JSON text - FromJson(value string) error -} - -func (obj *neighborsv6State) Marshal() marshalNeighborsv6State { - if obj.marshaller == nil { - obj.marshaller = &marshalneighborsv6State{obj: obj} - } - return obj.marshaller -} - -func (obj *neighborsv6State) Unmarshal() unMarshalNeighborsv6State { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalneighborsv6State{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalneighborsv6State) ToProto() (*otg.Neighborsv6State, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalneighborsv6State) FromProto(msg *otg.Neighborsv6State) (Neighborsv6State, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalneighborsv6State) 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 *unMarshalneighborsv6State) 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 *marshalneighborsv6State) 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 *unMarshalneighborsv6State) 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 *marshalneighborsv6State) 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 *unMarshalneighborsv6State) 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 *neighborsv6State) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *neighborsv6State) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *neighborsv6State) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *neighborsv6State) Clone() (Neighborsv6State, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewNeighborsv6State() - 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 -} - -// Neighborsv6State is iPv6 Neighbor state (NDISC cache entry). -type Neighborsv6State interface { - Validation - // msg marshals Neighborsv6State to protobuf object *otg.Neighborsv6State - // and doesn't set defaults - msg() *otg.Neighborsv6State - // setMsg unmarshals Neighborsv6State from protobuf object *otg.Neighborsv6State - // and doesn't set defaults - setMsg(*otg.Neighborsv6State) Neighborsv6State - // provides marshal interface - Marshal() marshalNeighborsv6State - // provides unmarshal interface - Unmarshal() unMarshalNeighborsv6State - // validate validates Neighborsv6State - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Neighborsv6State, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // EthernetName returns string, set in Neighborsv6State. - EthernetName() string - // SetEthernetName assigns string provided by user to Neighborsv6State - SetEthernetName(value string) Neighborsv6State - // Ipv6Address returns string, set in Neighborsv6State. - Ipv6Address() string - // SetIpv6Address assigns string provided by user to Neighborsv6State - SetIpv6Address(value string) Neighborsv6State - // LinkLayerAddress returns string, set in Neighborsv6State. - LinkLayerAddress() string - // SetLinkLayerAddress assigns string provided by user to Neighborsv6State - SetLinkLayerAddress(value string) Neighborsv6State - // HasLinkLayerAddress checks if LinkLayerAddress has been set in Neighborsv6State - HasLinkLayerAddress() bool -} - -// The name of the Ethernet interface associated with the Neighbor state (NDISC cache entry). -// EthernetName returns a string -func (obj *neighborsv6State) EthernetName() string { - - return *obj.obj.EthernetName - -} - -// The name of the Ethernet interface associated with the Neighbor state (NDISC cache entry). -// SetEthernetName sets the string value in the Neighborsv6State object -func (obj *neighborsv6State) SetEthernetName(value string) Neighborsv6State { - - obj.obj.EthernetName = &value - return obj -} - -// The IPv6 address of the neighbor. -// Ipv6Address returns a string -func (obj *neighborsv6State) Ipv6Address() string { - - return *obj.obj.Ipv6Address - -} - -// The IPv6 address of the neighbor. -// SetIpv6Address sets the string value in the Neighborsv6State object -func (obj *neighborsv6State) SetIpv6Address(value string) Neighborsv6State { - - obj.obj.Ipv6Address = &value - return obj -} - -// The link-layer address (MAC) of the neighbor. -// LinkLayerAddress returns a string -func (obj *neighborsv6State) LinkLayerAddress() string { - - return *obj.obj.LinkLayerAddress - -} - -// The link-layer address (MAC) of the neighbor. -// LinkLayerAddress returns a string -func (obj *neighborsv6State) HasLinkLayerAddress() bool { - return obj.obj.LinkLayerAddress != nil -} - -// The link-layer address (MAC) of the neighbor. -// SetLinkLayerAddress sets the string value in the Neighborsv6State object -func (obj *neighborsv6State) SetLinkLayerAddress(value string) Neighborsv6State { - - obj.obj.LinkLayerAddress = &value - return obj -} - -func (obj *neighborsv6State) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // EthernetName is required - if obj.obj.EthernetName == nil { - vObj.validationErrors = append(vObj.validationErrors, "EthernetName is required field on interface Neighborsv6State") - } - - // Ipv6Address is required - if obj.obj.Ipv6Address == nil { - vObj.validationErrors = append(vObj.validationErrors, "Ipv6Address is required field on interface Neighborsv6State") - } - if obj.obj.Ipv6Address != nil { - - err := obj.validateIpv6(obj.Ipv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on Neighborsv6State.Ipv6Address")) - } - - } - - if obj.obj.LinkLayerAddress != nil { - - err := obj.validateMac(obj.LinkLayerAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on Neighborsv6State.LinkLayerAddress")) - } - - } - -} - -func (obj *neighborsv6State) setDefault() { - -} - -// ***** BgpPrefixesState ***** -type bgpPrefixesState struct { - validation - obj *otg.BgpPrefixesState - marshaller marshalBgpPrefixesState - unMarshaller unMarshalBgpPrefixesState - ipv4UnicastPrefixesHolder BgpPrefixesStateBgpPrefixIpv4UnicastStateIter - ipv6UnicastPrefixesHolder BgpPrefixesStateBgpPrefixIpv6UnicastStateIter -} - -func NewBgpPrefixesState() BgpPrefixesState { - obj := bgpPrefixesState{obj: &otg.BgpPrefixesState{}} - obj.setDefault() - return &obj -} - -func (obj *bgpPrefixesState) msg() *otg.BgpPrefixesState { - return obj.obj -} - -func (obj *bgpPrefixesState) setMsg(msg *otg.BgpPrefixesState) BgpPrefixesState { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpPrefixesState struct { - obj *bgpPrefixesState -} - -type marshalBgpPrefixesState interface { - // ToProto marshals BgpPrefixesState to protobuf object *otg.BgpPrefixesState - ToProto() (*otg.BgpPrefixesState, error) - // ToPbText marshals BgpPrefixesState to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpPrefixesState to YAML text - ToYaml() (string, error) - // ToJson marshals BgpPrefixesState to JSON text - ToJson() (string, error) -} - -type unMarshalbgpPrefixesState struct { - obj *bgpPrefixesState -} - -type unMarshalBgpPrefixesState interface { - // FromProto unmarshals BgpPrefixesState from protobuf object *otg.BgpPrefixesState - FromProto(msg *otg.BgpPrefixesState) (BgpPrefixesState, error) - // FromPbText unmarshals BgpPrefixesState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpPrefixesState from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpPrefixesState from JSON text - FromJson(value string) error -} - -func (obj *bgpPrefixesState) Marshal() marshalBgpPrefixesState { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpPrefixesState{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpPrefixesState) Unmarshal() unMarshalBgpPrefixesState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpPrefixesState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpPrefixesState) ToProto() (*otg.BgpPrefixesState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpPrefixesState) FromProto(msg *otg.BgpPrefixesState) (BgpPrefixesState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpPrefixesState) 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 *unMarshalbgpPrefixesState) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpPrefixesState) 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 *unMarshalbgpPrefixesState) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpPrefixesState) 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 *unMarshalbgpPrefixesState) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpPrefixesState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpPrefixesState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpPrefixesState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpPrefixesState) Clone() (BgpPrefixesState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpPrefixesState() - 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 -} - -func (obj *bgpPrefixesState) setNil() { - obj.ipv4UnicastPrefixesHolder = nil - obj.ipv6UnicastPrefixesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpPrefixesState is bGP peer prefixes. -type BgpPrefixesState interface { - Validation - // msg marshals BgpPrefixesState to protobuf object *otg.BgpPrefixesState - // and doesn't set defaults - msg() *otg.BgpPrefixesState - // setMsg unmarshals BgpPrefixesState from protobuf object *otg.BgpPrefixesState - // and doesn't set defaults - setMsg(*otg.BgpPrefixesState) BgpPrefixesState - // provides marshal interface - Marshal() marshalBgpPrefixesState - // provides unmarshal interface - Unmarshal() unMarshalBgpPrefixesState - // validate validates BgpPrefixesState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpPrefixesState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // BgpPeerName returns string, set in BgpPrefixesState. - BgpPeerName() string - // SetBgpPeerName assigns string provided by user to BgpPrefixesState - SetBgpPeerName(value string) BgpPrefixesState - // HasBgpPeerName checks if BgpPeerName has been set in BgpPrefixesState - HasBgpPeerName() bool - // Ipv4UnicastPrefixes returns BgpPrefixesStateBgpPrefixIpv4UnicastStateIterIter, set in BgpPrefixesState - Ipv4UnicastPrefixes() BgpPrefixesStateBgpPrefixIpv4UnicastStateIter - // Ipv6UnicastPrefixes returns BgpPrefixesStateBgpPrefixIpv6UnicastStateIterIter, set in BgpPrefixesState - Ipv6UnicastPrefixes() BgpPrefixesStateBgpPrefixIpv6UnicastStateIter - setNil() -} - -// The name of a BGP peer. -// BgpPeerName returns a string -func (obj *bgpPrefixesState) BgpPeerName() string { - - return *obj.obj.BgpPeerName - -} - -// The name of a BGP peer. -// BgpPeerName returns a string -func (obj *bgpPrefixesState) HasBgpPeerName() bool { - return obj.obj.BgpPeerName != nil -} - -// The name of a BGP peer. -// SetBgpPeerName sets the string value in the BgpPrefixesState object -func (obj *bgpPrefixesState) SetBgpPeerName(value string) BgpPrefixesState { - - obj.obj.BgpPeerName = &value - return obj -} - -// description is TBD -// Ipv4UnicastPrefixes returns a []BgpPrefixIpv4UnicastState -func (obj *bgpPrefixesState) Ipv4UnicastPrefixes() BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { - if len(obj.obj.Ipv4UnicastPrefixes) == 0 { - obj.obj.Ipv4UnicastPrefixes = []*otg.BgpPrefixIpv4UnicastState{} - } - if obj.ipv4UnicastPrefixesHolder == nil { - obj.ipv4UnicastPrefixesHolder = newBgpPrefixesStateBgpPrefixIpv4UnicastStateIter(&obj.obj.Ipv4UnicastPrefixes).setMsg(obj) - } - return obj.ipv4UnicastPrefixesHolder -} - -type bgpPrefixesStateBgpPrefixIpv4UnicastStateIter struct { - obj *bgpPrefixesState - bgpPrefixIpv4UnicastStateSlice []BgpPrefixIpv4UnicastState - fieldPtr *[]*otg.BgpPrefixIpv4UnicastState -} - -func newBgpPrefixesStateBgpPrefixIpv4UnicastStateIter(ptr *[]*otg.BgpPrefixIpv4UnicastState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { - return &bgpPrefixesStateBgpPrefixIpv4UnicastStateIter{fieldPtr: ptr} -} - -type BgpPrefixesStateBgpPrefixIpv4UnicastStateIter interface { - setMsg(*bgpPrefixesState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter - Items() []BgpPrefixIpv4UnicastState - Add() BgpPrefixIpv4UnicastState - Append(items ...BgpPrefixIpv4UnicastState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter - Set(index int, newObj BgpPrefixIpv4UnicastState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter - Clear() BgpPrefixesStateBgpPrefixIpv4UnicastStateIter - clearHolderSlice() BgpPrefixesStateBgpPrefixIpv4UnicastStateIter - appendHolderSlice(item BgpPrefixIpv4UnicastState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter -} - -func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) setMsg(msg *bgpPrefixesState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpPrefixIpv4UnicastState{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) Items() []BgpPrefixIpv4UnicastState { - return obj.bgpPrefixIpv4UnicastStateSlice -} - -func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) Add() BgpPrefixIpv4UnicastState { - newObj := &otg.BgpPrefixIpv4UnicastState{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpPrefixIpv4UnicastState{obj: newObj} - newLibObj.setDefault() - obj.bgpPrefixIpv4UnicastStateSlice = append(obj.bgpPrefixIpv4UnicastStateSlice, newLibObj) - return newLibObj -} - -func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) Append(items ...BgpPrefixIpv4UnicastState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpPrefixIpv4UnicastStateSlice = append(obj.bgpPrefixIpv4UnicastStateSlice, item) - } - return obj -} - -func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) Set(index int, newObj BgpPrefixIpv4UnicastState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpPrefixIpv4UnicastStateSlice[index] = newObj - return obj -} -func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) Clear() BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpPrefixIpv4UnicastState{} - obj.bgpPrefixIpv4UnicastStateSlice = []BgpPrefixIpv4UnicastState{} - } - return obj -} -func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) clearHolderSlice() BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { - if len(obj.bgpPrefixIpv4UnicastStateSlice) > 0 { - obj.bgpPrefixIpv4UnicastStateSlice = []BgpPrefixIpv4UnicastState{} - } - return obj -} -func (obj *bgpPrefixesStateBgpPrefixIpv4UnicastStateIter) appendHolderSlice(item BgpPrefixIpv4UnicastState) BgpPrefixesStateBgpPrefixIpv4UnicastStateIter { - obj.bgpPrefixIpv4UnicastStateSlice = append(obj.bgpPrefixIpv4UnicastStateSlice, item) - return obj -} - -// description is TBD -// Ipv6UnicastPrefixes returns a []BgpPrefixIpv6UnicastState -func (obj *bgpPrefixesState) Ipv6UnicastPrefixes() BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { - if len(obj.obj.Ipv6UnicastPrefixes) == 0 { - obj.obj.Ipv6UnicastPrefixes = []*otg.BgpPrefixIpv6UnicastState{} - } - if obj.ipv6UnicastPrefixesHolder == nil { - obj.ipv6UnicastPrefixesHolder = newBgpPrefixesStateBgpPrefixIpv6UnicastStateIter(&obj.obj.Ipv6UnicastPrefixes).setMsg(obj) - } - return obj.ipv6UnicastPrefixesHolder -} - -type bgpPrefixesStateBgpPrefixIpv6UnicastStateIter struct { - obj *bgpPrefixesState - bgpPrefixIpv6UnicastStateSlice []BgpPrefixIpv6UnicastState - fieldPtr *[]*otg.BgpPrefixIpv6UnicastState -} - -func newBgpPrefixesStateBgpPrefixIpv6UnicastStateIter(ptr *[]*otg.BgpPrefixIpv6UnicastState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { - return &bgpPrefixesStateBgpPrefixIpv6UnicastStateIter{fieldPtr: ptr} -} - -type BgpPrefixesStateBgpPrefixIpv6UnicastStateIter interface { - setMsg(*bgpPrefixesState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter - Items() []BgpPrefixIpv6UnicastState - Add() BgpPrefixIpv6UnicastState - Append(items ...BgpPrefixIpv6UnicastState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter - Set(index int, newObj BgpPrefixIpv6UnicastState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter - Clear() BgpPrefixesStateBgpPrefixIpv6UnicastStateIter - clearHolderSlice() BgpPrefixesStateBgpPrefixIpv6UnicastStateIter - appendHolderSlice(item BgpPrefixIpv6UnicastState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter -} - -func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) setMsg(msg *bgpPrefixesState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpPrefixIpv6UnicastState{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) Items() []BgpPrefixIpv6UnicastState { - return obj.bgpPrefixIpv6UnicastStateSlice -} - -func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) Add() BgpPrefixIpv6UnicastState { - newObj := &otg.BgpPrefixIpv6UnicastState{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpPrefixIpv6UnicastState{obj: newObj} - newLibObj.setDefault() - obj.bgpPrefixIpv6UnicastStateSlice = append(obj.bgpPrefixIpv6UnicastStateSlice, newLibObj) - return newLibObj -} - -func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) Append(items ...BgpPrefixIpv6UnicastState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpPrefixIpv6UnicastStateSlice = append(obj.bgpPrefixIpv6UnicastStateSlice, item) - } - return obj -} - -func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) Set(index int, newObj BgpPrefixIpv6UnicastState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpPrefixIpv6UnicastStateSlice[index] = newObj - return obj -} -func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) Clear() BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpPrefixIpv6UnicastState{} - obj.bgpPrefixIpv6UnicastStateSlice = []BgpPrefixIpv6UnicastState{} - } - return obj -} -func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) clearHolderSlice() BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { - if len(obj.bgpPrefixIpv6UnicastStateSlice) > 0 { - obj.bgpPrefixIpv6UnicastStateSlice = []BgpPrefixIpv6UnicastState{} - } - return obj -} -func (obj *bgpPrefixesStateBgpPrefixIpv6UnicastStateIter) appendHolderSlice(item BgpPrefixIpv6UnicastState) BgpPrefixesStateBgpPrefixIpv6UnicastStateIter { - obj.bgpPrefixIpv6UnicastStateSlice = append(obj.bgpPrefixIpv6UnicastStateSlice, item) - return obj -} - -func (obj *bgpPrefixesState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Ipv4UnicastPrefixes) != 0 { - - if set_default { - obj.Ipv4UnicastPrefixes().clearHolderSlice() - for _, item := range obj.obj.Ipv4UnicastPrefixes { - obj.Ipv4UnicastPrefixes().appendHolderSlice(&bgpPrefixIpv4UnicastState{obj: item}) - } - } - for _, item := range obj.Ipv4UnicastPrefixes().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Ipv6UnicastPrefixes) != 0 { - - if set_default { - obj.Ipv6UnicastPrefixes().clearHolderSlice() - for _, item := range obj.obj.Ipv6UnicastPrefixes { - obj.Ipv6UnicastPrefixes().appendHolderSlice(&bgpPrefixIpv6UnicastState{obj: item}) - } - } - for _, item := range obj.Ipv6UnicastPrefixes().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpPrefixesState) setDefault() { - -} - -// ***** IsisLspsState ***** -type isisLspsState struct { - validation - obj *otg.IsisLspsState - marshaller marshalIsisLspsState - unMarshaller unMarshalIsisLspsState - lspsHolder IsisLspsStateIsisLspStateIter -} - -func NewIsisLspsState() IsisLspsState { - obj := isisLspsState{obj: &otg.IsisLspsState{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspsState) msg() *otg.IsisLspsState { - return obj.obj -} - -func (obj *isisLspsState) setMsg(msg *otg.IsisLspsState) IsisLspsState { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspsState struct { - obj *isisLspsState -} - -type marshalIsisLspsState interface { - // ToProto marshals IsisLspsState to protobuf object *otg.IsisLspsState - ToProto() (*otg.IsisLspsState, error) - // ToPbText marshals IsisLspsState to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspsState to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspsState to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspsState struct { - obj *isisLspsState -} - -type unMarshalIsisLspsState interface { - // FromProto unmarshals IsisLspsState from protobuf object *otg.IsisLspsState - FromProto(msg *otg.IsisLspsState) (IsisLspsState, error) - // FromPbText unmarshals IsisLspsState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspsState from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspsState from JSON text - FromJson(value string) error -} - -func (obj *isisLspsState) Marshal() marshalIsisLspsState { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspsState{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspsState) Unmarshal() unMarshalIsisLspsState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspsState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspsState) ToProto() (*otg.IsisLspsState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspsState) FromProto(msg *otg.IsisLspsState) (IsisLspsState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspsState) 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 *unMarshalisisLspsState) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisLspsState) 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 *unMarshalisisLspsState) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisLspsState) 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 *unMarshalisisLspsState) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisLspsState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspsState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspsState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspsState) Clone() (IsisLspsState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspsState() - 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 -} - -func (obj *isisLspsState) setNil() { - obj.lspsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisLspsState is the result of ISIS LSP information that are retrieved. -type IsisLspsState interface { - Validation - // msg marshals IsisLspsState to protobuf object *otg.IsisLspsState - // and doesn't set defaults - msg() *otg.IsisLspsState - // setMsg unmarshals IsisLspsState from protobuf object *otg.IsisLspsState - // and doesn't set defaults - setMsg(*otg.IsisLspsState) IsisLspsState - // provides marshal interface - Marshal() marshalIsisLspsState - // provides unmarshal interface - Unmarshal() unMarshalIsisLspsState - // validate validates IsisLspsState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspsState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // IsisRouterName returns string, set in IsisLspsState. - IsisRouterName() string - // SetIsisRouterName assigns string provided by user to IsisLspsState - SetIsisRouterName(value string) IsisLspsState - // HasIsisRouterName checks if IsisRouterName has been set in IsisLspsState - HasIsisRouterName() bool - // Lsps returns IsisLspsStateIsisLspStateIterIter, set in IsisLspsState - Lsps() IsisLspsStateIsisLspStateIter - setNil() -} - -// The name of the ISIS Router. -// IsisRouterName returns a string -func (obj *isisLspsState) IsisRouterName() string { - - return *obj.obj.IsisRouterName - -} - -// The name of the ISIS Router. -// IsisRouterName returns a string -func (obj *isisLspsState) HasIsisRouterName() bool { - return obj.obj.IsisRouterName != nil -} - -// The name of the ISIS Router. -// SetIsisRouterName sets the string value in the IsisLspsState object -func (obj *isisLspsState) SetIsisRouterName(value string) IsisLspsState { - - obj.obj.IsisRouterName = &value - return obj -} - -// One or more LSPs that are learned by this ISIS router. -// Lsps returns a []IsisLspState -func (obj *isisLspsState) Lsps() IsisLspsStateIsisLspStateIter { - if len(obj.obj.Lsps) == 0 { - obj.obj.Lsps = []*otg.IsisLspState{} - } - if obj.lspsHolder == nil { - obj.lspsHolder = newIsisLspsStateIsisLspStateIter(&obj.obj.Lsps).setMsg(obj) - } - return obj.lspsHolder -} - -type isisLspsStateIsisLspStateIter struct { - obj *isisLspsState - isisLspStateSlice []IsisLspState - fieldPtr *[]*otg.IsisLspState -} - -func newIsisLspsStateIsisLspStateIter(ptr *[]*otg.IsisLspState) IsisLspsStateIsisLspStateIter { - return &isisLspsStateIsisLspStateIter{fieldPtr: ptr} -} - -type IsisLspsStateIsisLspStateIter interface { - setMsg(*isisLspsState) IsisLspsStateIsisLspStateIter - Items() []IsisLspState - Add() IsisLspState - Append(items ...IsisLspState) IsisLspsStateIsisLspStateIter - Set(index int, newObj IsisLspState) IsisLspsStateIsisLspStateIter - Clear() IsisLspsStateIsisLspStateIter - clearHolderSlice() IsisLspsStateIsisLspStateIter - appendHolderSlice(item IsisLspState) IsisLspsStateIsisLspStateIter -} - -func (obj *isisLspsStateIsisLspStateIter) setMsg(msg *isisLspsState) IsisLspsStateIsisLspStateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspState{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisLspsStateIsisLspStateIter) Items() []IsisLspState { - return obj.isisLspStateSlice -} - -func (obj *isisLspsStateIsisLspStateIter) Add() IsisLspState { - newObj := &otg.IsisLspState{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspState{obj: newObj} - newLibObj.setDefault() - obj.isisLspStateSlice = append(obj.isisLspStateSlice, newLibObj) - return newLibObj -} - -func (obj *isisLspsStateIsisLspStateIter) Append(items ...IsisLspState) IsisLspsStateIsisLspStateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspStateSlice = append(obj.isisLspStateSlice, item) - } - return obj -} - -func (obj *isisLspsStateIsisLspStateIter) Set(index int, newObj IsisLspState) IsisLspsStateIsisLspStateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspStateSlice[index] = newObj - return obj -} -func (obj *isisLspsStateIsisLspStateIter) Clear() IsisLspsStateIsisLspStateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspState{} - obj.isisLspStateSlice = []IsisLspState{} - } - return obj -} -func (obj *isisLspsStateIsisLspStateIter) clearHolderSlice() IsisLspsStateIsisLspStateIter { - if len(obj.isisLspStateSlice) > 0 { - obj.isisLspStateSlice = []IsisLspState{} - } - return obj -} -func (obj *isisLspsStateIsisLspStateIter) appendHolderSlice(item IsisLspState) IsisLspsStateIsisLspStateIter { - obj.isisLspStateSlice = append(obj.isisLspStateSlice, item) - return obj -} - -func (obj *isisLspsState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Lsps) != 0 { - - if set_default { - obj.Lsps().clearHolderSlice() - for _, item := range obj.obj.Lsps { - obj.Lsps().appendHolderSlice(&isisLspState{obj: item}) - } - } - for _, item := range obj.Lsps().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *isisLspsState) setDefault() { - -} - -// ***** LldpNeighborsState ***** -type lldpNeighborsState struct { - validation - obj *otg.LldpNeighborsState - marshaller marshalLldpNeighborsState - unMarshaller unMarshalLldpNeighborsState - customTlvsHolder LldpNeighborsStateLldpCustomTLVStateIter - capabilitiesHolder LldpNeighborsStateLldpCapabilityStateIter -} - -func NewLldpNeighborsState() LldpNeighborsState { - obj := lldpNeighborsState{obj: &otg.LldpNeighborsState{}} - obj.setDefault() - return &obj -} - -func (obj *lldpNeighborsState) msg() *otg.LldpNeighborsState { - return obj.obj -} - -func (obj *lldpNeighborsState) setMsg(msg *otg.LldpNeighborsState) LldpNeighborsState { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshallldpNeighborsState struct { - obj *lldpNeighborsState -} - -type marshalLldpNeighborsState interface { - // ToProto marshals LldpNeighborsState to protobuf object *otg.LldpNeighborsState - ToProto() (*otg.LldpNeighborsState, error) - // ToPbText marshals LldpNeighborsState to protobuf text - ToPbText() (string, error) - // ToYaml marshals LldpNeighborsState to YAML text - ToYaml() (string, error) - // ToJson marshals LldpNeighborsState to JSON text - ToJson() (string, error) -} - -type unMarshallldpNeighborsState struct { - obj *lldpNeighborsState -} - -type unMarshalLldpNeighborsState interface { - // FromProto unmarshals LldpNeighborsState from protobuf object *otg.LldpNeighborsState - FromProto(msg *otg.LldpNeighborsState) (LldpNeighborsState, error) - // FromPbText unmarshals LldpNeighborsState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LldpNeighborsState from YAML text - FromYaml(value string) error - // FromJson unmarshals LldpNeighborsState from JSON text - FromJson(value string) error -} - -func (obj *lldpNeighborsState) Marshal() marshalLldpNeighborsState { - if obj.marshaller == nil { - obj.marshaller = &marshallldpNeighborsState{obj: obj} - } - return obj.marshaller -} - -func (obj *lldpNeighborsState) Unmarshal() unMarshalLldpNeighborsState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallldpNeighborsState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallldpNeighborsState) ToProto() (*otg.LldpNeighborsState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallldpNeighborsState) FromProto(msg *otg.LldpNeighborsState) (LldpNeighborsState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallldpNeighborsState) 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 *unMarshallldpNeighborsState) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshallldpNeighborsState) 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 *unMarshallldpNeighborsState) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshallldpNeighborsState) 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 *unMarshallldpNeighborsState) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *lldpNeighborsState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lldpNeighborsState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lldpNeighborsState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lldpNeighborsState) Clone() (LldpNeighborsState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLldpNeighborsState() - 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 -} - -func (obj *lldpNeighborsState) setNil() { - obj.customTlvsHolder = nil - obj.capabilitiesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// LldpNeighborsState is lLDP neighbor information. -type LldpNeighborsState interface { - Validation - // msg marshals LldpNeighborsState to protobuf object *otg.LldpNeighborsState - // and doesn't set defaults - msg() *otg.LldpNeighborsState - // setMsg unmarshals LldpNeighborsState from protobuf object *otg.LldpNeighborsState - // and doesn't set defaults - setMsg(*otg.LldpNeighborsState) LldpNeighborsState - // provides marshal interface - Marshal() marshalLldpNeighborsState - // provides unmarshal interface - Unmarshal() unMarshalLldpNeighborsState - // validate validates LldpNeighborsState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LldpNeighborsState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // LldpName returns string, set in LldpNeighborsState. - LldpName() string - // SetLldpName assigns string provided by user to LldpNeighborsState - SetLldpName(value string) LldpNeighborsState - // HasLldpName checks if LldpName has been set in LldpNeighborsState - HasLldpName() bool - // SystemName returns string, set in LldpNeighborsState. - SystemName() string - // SetSystemName assigns string provided by user to LldpNeighborsState - SetSystemName(value string) LldpNeighborsState - // HasSystemName checks if SystemName has been set in LldpNeighborsState - HasSystemName() bool - // SystemDescription returns string, set in LldpNeighborsState. - SystemDescription() string - // SetSystemDescription assigns string provided by user to LldpNeighborsState - SetSystemDescription(value string) LldpNeighborsState - // HasSystemDescription checks if SystemDescription has been set in LldpNeighborsState - HasSystemDescription() bool - // ChassisId returns string, set in LldpNeighborsState. - ChassisId() string - // SetChassisId assigns string provided by user to LldpNeighborsState - SetChassisId(value string) LldpNeighborsState - // HasChassisId checks if ChassisId has been set in LldpNeighborsState - HasChassisId() bool - // ChassisIdType returns LldpNeighborsStateChassisIdTypeEnum, set in LldpNeighborsState - ChassisIdType() LldpNeighborsStateChassisIdTypeEnum - // SetChassisIdType assigns LldpNeighborsStateChassisIdTypeEnum provided by user to LldpNeighborsState - SetChassisIdType(value LldpNeighborsStateChassisIdTypeEnum) LldpNeighborsState - // HasChassisIdType checks if ChassisIdType has been set in LldpNeighborsState - HasChassisIdType() bool - // NeighborId returns string, set in LldpNeighborsState. - NeighborId() string - // SetNeighborId assigns string provided by user to LldpNeighborsState - SetNeighborId(value string) LldpNeighborsState - // HasNeighborId checks if NeighborId has been set in LldpNeighborsState - HasNeighborId() bool - // Age returns uint32, set in LldpNeighborsState. - Age() uint32 - // SetAge assigns uint32 provided by user to LldpNeighborsState - SetAge(value uint32) LldpNeighborsState - // HasAge checks if Age has been set in LldpNeighborsState - HasAge() bool - // LastUpdate returns uint32, set in LldpNeighborsState. - LastUpdate() uint32 - // SetLastUpdate assigns uint32 provided by user to LldpNeighborsState - SetLastUpdate(value uint32) LldpNeighborsState - // HasLastUpdate checks if LastUpdate has been set in LldpNeighborsState - HasLastUpdate() bool - // Ttl returns uint32, set in LldpNeighborsState. - Ttl() uint32 - // SetTtl assigns uint32 provided by user to LldpNeighborsState - SetTtl(value uint32) LldpNeighborsState - // HasTtl checks if Ttl has been set in LldpNeighborsState - HasTtl() bool - // PortId returns string, set in LldpNeighborsState. - PortId() string - // SetPortId assigns string provided by user to LldpNeighborsState - SetPortId(value string) LldpNeighborsState - // HasPortId checks if PortId has been set in LldpNeighborsState - HasPortId() bool - // PortIdType returns LldpNeighborsStatePortIdTypeEnum, set in LldpNeighborsState - PortIdType() LldpNeighborsStatePortIdTypeEnum - // SetPortIdType assigns LldpNeighborsStatePortIdTypeEnum provided by user to LldpNeighborsState - SetPortIdType(value LldpNeighborsStatePortIdTypeEnum) LldpNeighborsState - // HasPortIdType checks if PortIdType has been set in LldpNeighborsState - HasPortIdType() bool - // PortDescription returns string, set in LldpNeighborsState. - PortDescription() string - // SetPortDescription assigns string provided by user to LldpNeighborsState - SetPortDescription(value string) LldpNeighborsState - // HasPortDescription checks if PortDescription has been set in LldpNeighborsState - HasPortDescription() bool - // ManagementAddress returns string, set in LldpNeighborsState. - ManagementAddress() string - // SetManagementAddress assigns string provided by user to LldpNeighborsState - SetManagementAddress(value string) LldpNeighborsState - // HasManagementAddress checks if ManagementAddress has been set in LldpNeighborsState - HasManagementAddress() bool - // ManagementAddressType returns string, set in LldpNeighborsState. - ManagementAddressType() string - // SetManagementAddressType assigns string provided by user to LldpNeighborsState - SetManagementAddressType(value string) LldpNeighborsState - // HasManagementAddressType checks if ManagementAddressType has been set in LldpNeighborsState - HasManagementAddressType() bool - // CustomTlvs returns LldpNeighborsStateLldpCustomTLVStateIterIter, set in LldpNeighborsState - CustomTlvs() LldpNeighborsStateLldpCustomTLVStateIter - // Capabilities returns LldpNeighborsStateLldpCapabilityStateIterIter, set in LldpNeighborsState - Capabilities() LldpNeighborsStateLldpCapabilityStateIter - setNil() -} - -// The name of the LLDP instance. -// LldpName returns a string -func (obj *lldpNeighborsState) LldpName() string { - - return *obj.obj.LldpName - -} - -// The name of the LLDP instance. -// LldpName returns a string -func (obj *lldpNeighborsState) HasLldpName() bool { - return obj.obj.LldpName != nil -} - -// The name of the LLDP instance. -// SetLldpName sets the string value in the LldpNeighborsState object -func (obj *lldpNeighborsState) SetLldpName(value string) LldpNeighborsState { - - obj.obj.LldpName = &value - return obj -} - -// The system name field shall contain an alpha-numeric string that indicates the system's administratively assigned name. The system name should be the system's fully qualified domain name. If implementations support IETF RFC 3418, the sysName object should be used for this field. -// SystemName returns a string -func (obj *lldpNeighborsState) SystemName() string { - - return *obj.obj.SystemName - -} - -// The system name field shall contain an alpha-numeric string that indicates the system's administratively assigned name. The system name should be the system's fully qualified domain name. If implementations support IETF RFC 3418, the sysName object should be used for this field. -// SystemName returns a string -func (obj *lldpNeighborsState) HasSystemName() bool { - return obj.obj.SystemName != nil -} - -// The system name field shall contain an alpha-numeric string that indicates the system's administratively assigned name. The system name should be the system's fully qualified domain name. If implementations support IETF RFC 3418, the sysName object should be used for this field. -// SetSystemName sets the string value in the LldpNeighborsState object -func (obj *lldpNeighborsState) SetSystemName(value string) LldpNeighborsState { - - obj.obj.SystemName = &value - return obj -} - -// The system description field shall contain an alpha-numeric string that is the textual description of the network entity. The system description should include the full name and version identification of the system's hardware type, software operating system, and networking software. If implementations support IETF RFC 3418, the sysDescr object should be used for this field. -// SystemDescription returns a string -func (obj *lldpNeighborsState) SystemDescription() string { - - return *obj.obj.SystemDescription - -} - -// The system description field shall contain an alpha-numeric string that is the textual description of the network entity. The system description should include the full name and version identification of the system's hardware type, software operating system, and networking software. If implementations support IETF RFC 3418, the sysDescr object should be used for this field. -// SystemDescription returns a string -func (obj *lldpNeighborsState) HasSystemDescription() bool { - return obj.obj.SystemDescription != nil -} - -// The system description field shall contain an alpha-numeric string that is the textual description of the network entity. The system description should include the full name and version identification of the system's hardware type, software operating system, and networking software. If implementations support IETF RFC 3418, the sysDescr object should be used for this field. -// SetSystemDescription sets the string value in the LldpNeighborsState object -func (obj *lldpNeighborsState) SetSystemDescription(value string) LldpNeighborsState { - - obj.obj.SystemDescription = &value - return obj -} - -// The Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. -// ChassisId returns a string -func (obj *lldpNeighborsState) ChassisId() string { - - return *obj.obj.ChassisId - -} - -// The Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. -// ChassisId returns a string -func (obj *lldpNeighborsState) HasChassisId() bool { - return obj.obj.ChassisId != nil -} - -// The Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. -// SetChassisId sets the string value in the LldpNeighborsState object -func (obj *lldpNeighborsState) SetChassisId(value string) LldpNeighborsState { - - obj.obj.ChassisId = &value - return obj -} - -type LldpNeighborsStateChassisIdTypeEnum string - -// Enum of ChassisIdType on LldpNeighborsState -var LldpNeighborsStateChassisIdType = struct { - PORT_COMPONENT LldpNeighborsStateChassisIdTypeEnum - NETWORK_ADDRESS LldpNeighborsStateChassisIdTypeEnum - CHASSIS_COMPONENT LldpNeighborsStateChassisIdTypeEnum - MAC_ADDRESS LldpNeighborsStateChassisIdTypeEnum - INTERFACE_NAME LldpNeighborsStateChassisIdTypeEnum - LOCAL LldpNeighborsStateChassisIdTypeEnum - INTERFACE_ALIAS LldpNeighborsStateChassisIdTypeEnum -}{ - PORT_COMPONENT: LldpNeighborsStateChassisIdTypeEnum("port_component"), - NETWORK_ADDRESS: LldpNeighborsStateChassisIdTypeEnum("network_address"), - CHASSIS_COMPONENT: LldpNeighborsStateChassisIdTypeEnum("chassis_component"), - MAC_ADDRESS: LldpNeighborsStateChassisIdTypeEnum("mac_address"), - INTERFACE_NAME: LldpNeighborsStateChassisIdTypeEnum("interface_name"), - LOCAL: LldpNeighborsStateChassisIdTypeEnum("local"), - INTERFACE_ALIAS: LldpNeighborsStateChassisIdTypeEnum("interface_alias"), -} - -func (obj *lldpNeighborsState) ChassisIdType() LldpNeighborsStateChassisIdTypeEnum { - return LldpNeighborsStateChassisIdTypeEnum(obj.obj.ChassisIdType.Enum().String()) -} - -// This field identifies the format and source of the chassis identifier string. It is an enumerator defined by the LldpChassisIdSubtype object from IEEE 802.1AB MIB. -// ChassisIdType returns a string -func (obj *lldpNeighborsState) HasChassisIdType() bool { - return obj.obj.ChassisIdType != nil -} - -func (obj *lldpNeighborsState) SetChassisIdType(value LldpNeighborsStateChassisIdTypeEnum) LldpNeighborsState { - intValue, ok := otg.LldpNeighborsState_ChassisIdType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LldpNeighborsStateChassisIdTypeEnum", string(value))) - return obj - } - enumValue := otg.LldpNeighborsState_ChassisIdType_Enum(intValue) - obj.obj.ChassisIdType = &enumValue - - return obj -} - -// System generated identifier for the neighbor on the LLDP instance. -// NeighborId returns a string -func (obj *lldpNeighborsState) NeighborId() string { - - return *obj.obj.NeighborId - -} - -// System generated identifier for the neighbor on the LLDP instance. -// NeighborId returns a string -func (obj *lldpNeighborsState) HasNeighborId() bool { - return obj.obj.NeighborId != nil -} - -// System generated identifier for the neighbor on the LLDP instance. -// SetNeighborId sets the string value in the LldpNeighborsState object -func (obj *lldpNeighborsState) SetNeighborId(value string) LldpNeighborsState { - - obj.obj.NeighborId = &value - return obj -} - -// Age since discovery in seconds. -// Age returns a uint32 -func (obj *lldpNeighborsState) Age() uint32 { - - return *obj.obj.Age - -} - -// Age since discovery in seconds. -// Age returns a uint32 -func (obj *lldpNeighborsState) HasAge() bool { - return obj.obj.Age != nil -} - -// Age since discovery in seconds. -// SetAge sets the uint32 value in the LldpNeighborsState object -func (obj *lldpNeighborsState) SetAge(value uint32) LldpNeighborsState { - - obj.obj.Age = &value - return obj -} - -// Seconds since last update received. -// LastUpdate returns a uint32 -func (obj *lldpNeighborsState) LastUpdate() uint32 { - - return *obj.obj.LastUpdate - -} - -// Seconds since last update received. -// LastUpdate returns a uint32 -func (obj *lldpNeighborsState) HasLastUpdate() bool { - return obj.obj.LastUpdate != nil -} - -// Seconds since last update received. -// SetLastUpdate sets the uint32 value in the LldpNeighborsState object -func (obj *lldpNeighborsState) SetLastUpdate(value uint32) LldpNeighborsState { - - obj.obj.LastUpdate = &value - return obj -} - -// The time-to-live (TTL) in seconds is a mandatory TLV which indicates how long information from the neighbor should be considered valid. -// Ttl returns a uint32 -func (obj *lldpNeighborsState) Ttl() uint32 { - - return *obj.obj.Ttl - -} - -// The time-to-live (TTL) in seconds is a mandatory TLV which indicates how long information from the neighbor should be considered valid. -// Ttl returns a uint32 -func (obj *lldpNeighborsState) HasTtl() bool { - return obj.obj.Ttl != nil -} - -// The time-to-live (TTL) in seconds is a mandatory TLV which indicates how long information from the neighbor should be considered valid. -// SetTtl sets the uint32 value in the LldpNeighborsState object -func (obj *lldpNeighborsState) SetTtl(value uint32) LldpNeighborsState { - - obj.obj.Ttl = &value - return obj -} - -// The Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent. If the specified port is an IEEE 802.3 Repeater port, then this TLV is optional. -// PortId returns a string -func (obj *lldpNeighborsState) PortId() string { - - return *obj.obj.PortId - -} - -// The Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent. If the specified port is an IEEE 802.3 Repeater port, then this TLV is optional. -// PortId returns a string -func (obj *lldpNeighborsState) HasPortId() bool { - return obj.obj.PortId != nil -} - -// The Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent. If the specified port is an IEEE 802.3 Repeater port, then this TLV is optional. -// SetPortId sets the string value in the LldpNeighborsState object -func (obj *lldpNeighborsState) SetPortId(value string) LldpNeighborsState { - - obj.obj.PortId = &value - return obj -} - -type LldpNeighborsStatePortIdTypeEnum string - -// Enum of PortIdType on LldpNeighborsState -var LldpNeighborsStatePortIdType = struct { - PORT_COMPONENT LldpNeighborsStatePortIdTypeEnum - NETWORK_ADDRESS LldpNeighborsStatePortIdTypeEnum - AGENT_CIRCUIT_ID LldpNeighborsStatePortIdTypeEnum - MAC_ADDRESS LldpNeighborsStatePortIdTypeEnum - INTERFACE_NAME LldpNeighborsStatePortIdTypeEnum - LOCAL LldpNeighborsStatePortIdTypeEnum - INTERFACE_ALIAS LldpNeighborsStatePortIdTypeEnum -}{ - PORT_COMPONENT: LldpNeighborsStatePortIdTypeEnum("port_component"), - NETWORK_ADDRESS: LldpNeighborsStatePortIdTypeEnum("network_address"), - AGENT_CIRCUIT_ID: LldpNeighborsStatePortIdTypeEnum("agent_circuit_id"), - MAC_ADDRESS: LldpNeighborsStatePortIdTypeEnum("mac_address"), - INTERFACE_NAME: LldpNeighborsStatePortIdTypeEnum("interface_name"), - LOCAL: LldpNeighborsStatePortIdTypeEnum("local"), - INTERFACE_ALIAS: LldpNeighborsStatePortIdTypeEnum("interface_alias"), -} - -func (obj *lldpNeighborsState) PortIdType() LldpNeighborsStatePortIdTypeEnum { - return LldpNeighborsStatePortIdTypeEnum(obj.obj.PortIdType.Enum().String()) -} - -// This field identifies the format and source of the port identifier string. It is an enumerator defined by the PtopoPortIdType object from RFC2922. -// PortIdType returns a string -func (obj *lldpNeighborsState) HasPortIdType() bool { - return obj.obj.PortIdType != nil -} - -func (obj *lldpNeighborsState) SetPortIdType(value LldpNeighborsStatePortIdTypeEnum) LldpNeighborsState { - intValue, ok := otg.LldpNeighborsState_PortIdType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LldpNeighborsStatePortIdTypeEnum", string(value))) - return obj - } - enumValue := otg.LldpNeighborsState_PortIdType_Enum(intValue) - obj.obj.PortIdType = &enumValue - - return obj -} - -// The binary string containing the actual port identifier for the port which this LLDP PDU was transmitted. The source and format of this field is defined by PtopoPortId from RFC2922. -// PortDescription returns a string -func (obj *lldpNeighborsState) PortDescription() string { - - return *obj.obj.PortDescription - -} - -// The binary string containing the actual port identifier for the port which this LLDP PDU was transmitted. The source and format of this field is defined by PtopoPortId from RFC2922. -// PortDescription returns a string -func (obj *lldpNeighborsState) HasPortDescription() bool { - return obj.obj.PortDescription != nil -} - -// The binary string containing the actual port identifier for the port which this LLDP PDU was transmitted. The source and format of this field is defined by PtopoPortId from RFC2922. -// SetPortDescription sets the string value in the LldpNeighborsState object -func (obj *lldpNeighborsState) SetPortDescription(value string) LldpNeighborsState { - - obj.obj.PortDescription = &value - return obj -} - -// The Management Address is a mandatory TLV which identifies a network address associated with the local LLDP agent, which can be used to reach the agent on the port identified in the Port ID TLV. -// ManagementAddress returns a string -func (obj *lldpNeighborsState) ManagementAddress() string { - - return *obj.obj.ManagementAddress - -} - -// The Management Address is a mandatory TLV which identifies a network address associated with the local LLDP agent, which can be used to reach the agent on the port identified in the Port ID TLV. -// ManagementAddress returns a string -func (obj *lldpNeighborsState) HasManagementAddress() bool { - return obj.obj.ManagementAddress != nil -} - -// The Management Address is a mandatory TLV which identifies a network address associated with the local LLDP agent, which can be used to reach the agent on the port identified in the Port ID TLV. -// SetManagementAddress sets the string value in the LldpNeighborsState object -func (obj *lldpNeighborsState) SetManagementAddress(value string) LldpNeighborsState { - - obj.obj.ManagementAddress = &value - return obj -} - -// The enumerated value for the network address type identified in this TLV. This enumeration is defined in the 'Assigned Numbers' RFC [RFC3232] and the ianaAddressFamilyNumbers object. -// ManagementAddressType returns a string -func (obj *lldpNeighborsState) ManagementAddressType() string { - - return *obj.obj.ManagementAddressType - -} - -// The enumerated value for the network address type identified in this TLV. This enumeration is defined in the 'Assigned Numbers' RFC [RFC3232] and the ianaAddressFamilyNumbers object. -// ManagementAddressType returns a string -func (obj *lldpNeighborsState) HasManagementAddressType() bool { - return obj.obj.ManagementAddressType != nil -} - -// The enumerated value for the network address type identified in this TLV. This enumeration is defined in the 'Assigned Numbers' RFC [RFC3232] and the ianaAddressFamilyNumbers object. -// SetManagementAddressType sets the string value in the LldpNeighborsState object -func (obj *lldpNeighborsState) SetManagementAddressType(value string) LldpNeighborsState { - - obj.obj.ManagementAddressType = &value - return obj -} - -// description is TBD -// CustomTlvs returns a []LldpCustomTLVState -func (obj *lldpNeighborsState) CustomTlvs() LldpNeighborsStateLldpCustomTLVStateIter { - if len(obj.obj.CustomTlvs) == 0 { - obj.obj.CustomTlvs = []*otg.LldpCustomTLVState{} - } - if obj.customTlvsHolder == nil { - obj.customTlvsHolder = newLldpNeighborsStateLldpCustomTLVStateIter(&obj.obj.CustomTlvs).setMsg(obj) - } - return obj.customTlvsHolder -} - -type lldpNeighborsStateLldpCustomTLVStateIter struct { - obj *lldpNeighborsState - lldpCustomTLVStateSlice []LldpCustomTLVState - fieldPtr *[]*otg.LldpCustomTLVState -} - -func newLldpNeighborsStateLldpCustomTLVStateIter(ptr *[]*otg.LldpCustomTLVState) LldpNeighborsStateLldpCustomTLVStateIter { - return &lldpNeighborsStateLldpCustomTLVStateIter{fieldPtr: ptr} -} - -type LldpNeighborsStateLldpCustomTLVStateIter interface { - setMsg(*lldpNeighborsState) LldpNeighborsStateLldpCustomTLVStateIter - Items() []LldpCustomTLVState - Add() LldpCustomTLVState - Append(items ...LldpCustomTLVState) LldpNeighborsStateLldpCustomTLVStateIter - Set(index int, newObj LldpCustomTLVState) LldpNeighborsStateLldpCustomTLVStateIter - Clear() LldpNeighborsStateLldpCustomTLVStateIter - clearHolderSlice() LldpNeighborsStateLldpCustomTLVStateIter - appendHolderSlice(item LldpCustomTLVState) LldpNeighborsStateLldpCustomTLVStateIter -} - -func (obj *lldpNeighborsStateLldpCustomTLVStateIter) setMsg(msg *lldpNeighborsState) LldpNeighborsStateLldpCustomTLVStateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&lldpCustomTLVState{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *lldpNeighborsStateLldpCustomTLVStateIter) Items() []LldpCustomTLVState { - return obj.lldpCustomTLVStateSlice -} - -func (obj *lldpNeighborsStateLldpCustomTLVStateIter) Add() LldpCustomTLVState { - newObj := &otg.LldpCustomTLVState{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &lldpCustomTLVState{obj: newObj} - newLibObj.setDefault() - obj.lldpCustomTLVStateSlice = append(obj.lldpCustomTLVStateSlice, newLibObj) - return newLibObj -} - -func (obj *lldpNeighborsStateLldpCustomTLVStateIter) Append(items ...LldpCustomTLVState) LldpNeighborsStateLldpCustomTLVStateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.lldpCustomTLVStateSlice = append(obj.lldpCustomTLVStateSlice, item) - } - return obj -} - -func (obj *lldpNeighborsStateLldpCustomTLVStateIter) Set(index int, newObj LldpCustomTLVState) LldpNeighborsStateLldpCustomTLVStateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.lldpCustomTLVStateSlice[index] = newObj - return obj -} -func (obj *lldpNeighborsStateLldpCustomTLVStateIter) Clear() LldpNeighborsStateLldpCustomTLVStateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.LldpCustomTLVState{} - obj.lldpCustomTLVStateSlice = []LldpCustomTLVState{} - } - return obj -} -func (obj *lldpNeighborsStateLldpCustomTLVStateIter) clearHolderSlice() LldpNeighborsStateLldpCustomTLVStateIter { - if len(obj.lldpCustomTLVStateSlice) > 0 { - obj.lldpCustomTLVStateSlice = []LldpCustomTLVState{} - } - return obj -} -func (obj *lldpNeighborsStateLldpCustomTLVStateIter) appendHolderSlice(item LldpCustomTLVState) LldpNeighborsStateLldpCustomTLVStateIter { - obj.lldpCustomTLVStateSlice = append(obj.lldpCustomTLVStateSlice, item) - return obj -} - -// description is TBD -// Capabilities returns a []LldpCapabilityState -func (obj *lldpNeighborsState) Capabilities() LldpNeighborsStateLldpCapabilityStateIter { - if len(obj.obj.Capabilities) == 0 { - obj.obj.Capabilities = []*otg.LldpCapabilityState{} - } - if obj.capabilitiesHolder == nil { - obj.capabilitiesHolder = newLldpNeighborsStateLldpCapabilityStateIter(&obj.obj.Capabilities).setMsg(obj) - } - return obj.capabilitiesHolder -} - -type lldpNeighborsStateLldpCapabilityStateIter struct { - obj *lldpNeighborsState - lldpCapabilityStateSlice []LldpCapabilityState - fieldPtr *[]*otg.LldpCapabilityState -} - -func newLldpNeighborsStateLldpCapabilityStateIter(ptr *[]*otg.LldpCapabilityState) LldpNeighborsStateLldpCapabilityStateIter { - return &lldpNeighborsStateLldpCapabilityStateIter{fieldPtr: ptr} -} - -type LldpNeighborsStateLldpCapabilityStateIter interface { - setMsg(*lldpNeighborsState) LldpNeighborsStateLldpCapabilityStateIter - Items() []LldpCapabilityState - Add() LldpCapabilityState - Append(items ...LldpCapabilityState) LldpNeighborsStateLldpCapabilityStateIter - Set(index int, newObj LldpCapabilityState) LldpNeighborsStateLldpCapabilityStateIter - Clear() LldpNeighborsStateLldpCapabilityStateIter - clearHolderSlice() LldpNeighborsStateLldpCapabilityStateIter - appendHolderSlice(item LldpCapabilityState) LldpNeighborsStateLldpCapabilityStateIter -} - -func (obj *lldpNeighborsStateLldpCapabilityStateIter) setMsg(msg *lldpNeighborsState) LldpNeighborsStateLldpCapabilityStateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&lldpCapabilityState{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *lldpNeighborsStateLldpCapabilityStateIter) Items() []LldpCapabilityState { - return obj.lldpCapabilityStateSlice -} - -func (obj *lldpNeighborsStateLldpCapabilityStateIter) Add() LldpCapabilityState { - newObj := &otg.LldpCapabilityState{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &lldpCapabilityState{obj: newObj} - newLibObj.setDefault() - obj.lldpCapabilityStateSlice = append(obj.lldpCapabilityStateSlice, newLibObj) - return newLibObj -} - -func (obj *lldpNeighborsStateLldpCapabilityStateIter) Append(items ...LldpCapabilityState) LldpNeighborsStateLldpCapabilityStateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.lldpCapabilityStateSlice = append(obj.lldpCapabilityStateSlice, item) - } - return obj -} - -func (obj *lldpNeighborsStateLldpCapabilityStateIter) Set(index int, newObj LldpCapabilityState) LldpNeighborsStateLldpCapabilityStateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.lldpCapabilityStateSlice[index] = newObj - return obj -} -func (obj *lldpNeighborsStateLldpCapabilityStateIter) Clear() LldpNeighborsStateLldpCapabilityStateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.LldpCapabilityState{} - obj.lldpCapabilityStateSlice = []LldpCapabilityState{} - } - return obj -} -func (obj *lldpNeighborsStateLldpCapabilityStateIter) clearHolderSlice() LldpNeighborsStateLldpCapabilityStateIter { - if len(obj.lldpCapabilityStateSlice) > 0 { - obj.lldpCapabilityStateSlice = []LldpCapabilityState{} - } - return obj -} -func (obj *lldpNeighborsStateLldpCapabilityStateIter) appendHolderSlice(item LldpCapabilityState) LldpNeighborsStateLldpCapabilityStateIter { - obj.lldpCapabilityStateSlice = append(obj.lldpCapabilityStateSlice, item) - return obj -} - -func (obj *lldpNeighborsState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.CustomTlvs) != 0 { - - if set_default { - obj.CustomTlvs().clearHolderSlice() - for _, item := range obj.obj.CustomTlvs { - obj.CustomTlvs().appendHolderSlice(&lldpCustomTLVState{obj: item}) - } - } - for _, item := range obj.CustomTlvs().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Capabilities) != 0 { - - if set_default { - obj.Capabilities().clearHolderSlice() - for _, item := range obj.obj.Capabilities { - obj.Capabilities().appendHolderSlice(&lldpCapabilityState{obj: item}) - } - } - for _, item := range obj.Capabilities().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *lldpNeighborsState) setDefault() { - -} - -// ***** RsvpLspsState ***** -type rsvpLspsState struct { - validation - obj *otg.RsvpLspsState - marshaller marshalRsvpLspsState - unMarshaller unMarshalRsvpLspsState - ipv4LspsHolder RsvpLspsStateRsvpIPv4LspStateIter -} - -func NewRsvpLspsState() RsvpLspsState { - obj := rsvpLspsState{obj: &otg.RsvpLspsState{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpLspsState) msg() *otg.RsvpLspsState { - return obj.obj -} - -func (obj *rsvpLspsState) setMsg(msg *otg.RsvpLspsState) RsvpLspsState { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpLspsState struct { - obj *rsvpLspsState -} - -type marshalRsvpLspsState interface { - // ToProto marshals RsvpLspsState to protobuf object *otg.RsvpLspsState - ToProto() (*otg.RsvpLspsState, error) - // ToPbText marshals RsvpLspsState to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpLspsState to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpLspsState to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpLspsState struct { - obj *rsvpLspsState -} - -type unMarshalRsvpLspsState interface { - // FromProto unmarshals RsvpLspsState from protobuf object *otg.RsvpLspsState - FromProto(msg *otg.RsvpLspsState) (RsvpLspsState, error) - // FromPbText unmarshals RsvpLspsState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpLspsState from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpLspsState from JSON text - FromJson(value string) error -} - -func (obj *rsvpLspsState) Marshal() marshalRsvpLspsState { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpLspsState{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpLspsState) Unmarshal() unMarshalRsvpLspsState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpLspsState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpLspsState) ToProto() (*otg.RsvpLspsState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpLspsState) FromProto(msg *otg.RsvpLspsState) (RsvpLspsState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpLspsState) 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 *unMarshalrsvpLspsState) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalrsvpLspsState) 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 *unMarshalrsvpLspsState) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalrsvpLspsState) 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 *unMarshalrsvpLspsState) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *rsvpLspsState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpLspsState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpLspsState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpLspsState) Clone() (RsvpLspsState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpLspsState() - 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 -} - -func (obj *rsvpLspsState) setNil() { - obj.ipv4LspsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// RsvpLspsState is discovered IPv4 Point-to-Point LSPs of a RSVP-TE router. -type RsvpLspsState interface { - Validation - // msg marshals RsvpLspsState to protobuf object *otg.RsvpLspsState - // and doesn't set defaults - msg() *otg.RsvpLspsState - // setMsg unmarshals RsvpLspsState from protobuf object *otg.RsvpLspsState - // and doesn't set defaults - setMsg(*otg.RsvpLspsState) RsvpLspsState - // provides marshal interface - Marshal() marshalRsvpLspsState - // provides unmarshal interface - Unmarshal() unMarshalRsvpLspsState - // validate validates RsvpLspsState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpLspsState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RsvpRouterName returns string, set in RsvpLspsState. - RsvpRouterName() string - // SetRsvpRouterName assigns string provided by user to RsvpLspsState - SetRsvpRouterName(value string) RsvpLspsState - // HasRsvpRouterName checks if RsvpRouterName has been set in RsvpLspsState - HasRsvpRouterName() bool - // Ipv4Lsps returns RsvpLspsStateRsvpIPv4LspStateIterIter, set in RsvpLspsState - Ipv4Lsps() RsvpLspsStateRsvpIPv4LspStateIter - setNil() -} - -// The name of the RSVP-TE Router. -// RsvpRouterName returns a string -func (obj *rsvpLspsState) RsvpRouterName() string { - - return *obj.obj.RsvpRouterName - -} - -// The name of the RSVP-TE Router. -// RsvpRouterName returns a string -func (obj *rsvpLspsState) HasRsvpRouterName() bool { - return obj.obj.RsvpRouterName != nil -} - -// The name of the RSVP-TE Router. -// SetRsvpRouterName sets the string value in the RsvpLspsState object -func (obj *rsvpLspsState) SetRsvpRouterName(value string) RsvpLspsState { - - obj.obj.RsvpRouterName = &value - return obj -} - -// IPv4 Point-to-Point RSVP-TE Discovered LSPs. -// Ipv4Lsps returns a []RsvpIPv4LspState -func (obj *rsvpLspsState) Ipv4Lsps() RsvpLspsStateRsvpIPv4LspStateIter { - if len(obj.obj.Ipv4Lsps) == 0 { - obj.obj.Ipv4Lsps = []*otg.RsvpIPv4LspState{} - } - if obj.ipv4LspsHolder == nil { - obj.ipv4LspsHolder = newRsvpLspsStateRsvpIPv4LspStateIter(&obj.obj.Ipv4Lsps).setMsg(obj) - } - return obj.ipv4LspsHolder -} - -type rsvpLspsStateRsvpIPv4LspStateIter struct { - obj *rsvpLspsState - rsvpIPv4LspStateSlice []RsvpIPv4LspState - fieldPtr *[]*otg.RsvpIPv4LspState -} - -func newRsvpLspsStateRsvpIPv4LspStateIter(ptr *[]*otg.RsvpIPv4LspState) RsvpLspsStateRsvpIPv4LspStateIter { - return &rsvpLspsStateRsvpIPv4LspStateIter{fieldPtr: ptr} -} - -type RsvpLspsStateRsvpIPv4LspStateIter interface { - setMsg(*rsvpLspsState) RsvpLspsStateRsvpIPv4LspStateIter - Items() []RsvpIPv4LspState - Add() RsvpIPv4LspState - Append(items ...RsvpIPv4LspState) RsvpLspsStateRsvpIPv4LspStateIter - Set(index int, newObj RsvpIPv4LspState) RsvpLspsStateRsvpIPv4LspStateIter - Clear() RsvpLspsStateRsvpIPv4LspStateIter - clearHolderSlice() RsvpLspsStateRsvpIPv4LspStateIter - appendHolderSlice(item RsvpIPv4LspState) RsvpLspsStateRsvpIPv4LspStateIter -} - -func (obj *rsvpLspsStateRsvpIPv4LspStateIter) setMsg(msg *rsvpLspsState) RsvpLspsStateRsvpIPv4LspStateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&rsvpIPv4LspState{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *rsvpLspsStateRsvpIPv4LspStateIter) Items() []RsvpIPv4LspState { - return obj.rsvpIPv4LspStateSlice -} - -func (obj *rsvpLspsStateRsvpIPv4LspStateIter) Add() RsvpIPv4LspState { - newObj := &otg.RsvpIPv4LspState{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &rsvpIPv4LspState{obj: newObj} - newLibObj.setDefault() - obj.rsvpIPv4LspStateSlice = append(obj.rsvpIPv4LspStateSlice, newLibObj) - return newLibObj -} - -func (obj *rsvpLspsStateRsvpIPv4LspStateIter) Append(items ...RsvpIPv4LspState) RsvpLspsStateRsvpIPv4LspStateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.rsvpIPv4LspStateSlice = append(obj.rsvpIPv4LspStateSlice, item) - } - return obj -} - -func (obj *rsvpLspsStateRsvpIPv4LspStateIter) Set(index int, newObj RsvpIPv4LspState) RsvpLspsStateRsvpIPv4LspStateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.rsvpIPv4LspStateSlice[index] = newObj - return obj -} -func (obj *rsvpLspsStateRsvpIPv4LspStateIter) Clear() RsvpLspsStateRsvpIPv4LspStateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.RsvpIPv4LspState{} - obj.rsvpIPv4LspStateSlice = []RsvpIPv4LspState{} - } - return obj -} -func (obj *rsvpLspsStateRsvpIPv4LspStateIter) clearHolderSlice() RsvpLspsStateRsvpIPv4LspStateIter { - if len(obj.rsvpIPv4LspStateSlice) > 0 { - obj.rsvpIPv4LspStateSlice = []RsvpIPv4LspState{} - } - return obj -} -func (obj *rsvpLspsStateRsvpIPv4LspStateIter) appendHolderSlice(item RsvpIPv4LspState) RsvpLspsStateRsvpIPv4LspStateIter { - obj.rsvpIPv4LspStateSlice = append(obj.rsvpIPv4LspStateSlice, item) - return obj -} - -func (obj *rsvpLspsState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Ipv4Lsps) != 0 { - - if set_default { - obj.Ipv4Lsps().clearHolderSlice() - for _, item := range obj.obj.Ipv4Lsps { - obj.Ipv4Lsps().appendHolderSlice(&rsvpIPv4LspState{obj: item}) - } - } - for _, item := range obj.Ipv4Lsps().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *rsvpLspsState) setDefault() { - -} - -// ***** Dhcpv4InterfaceState ***** -type dhcpv4InterfaceState struct { - validation - obj *otg.Dhcpv4InterfaceState - marshaller marshalDhcpv4InterfaceState - unMarshaller unMarshalDhcpv4InterfaceState -} - -func NewDhcpv4InterfaceState() Dhcpv4InterfaceState { - obj := dhcpv4InterfaceState{obj: &otg.Dhcpv4InterfaceState{}} - obj.setDefault() - return &obj -} - -func (obj *dhcpv4InterfaceState) msg() *otg.Dhcpv4InterfaceState { - return obj.obj -} - -func (obj *dhcpv4InterfaceState) setMsg(msg *otg.Dhcpv4InterfaceState) Dhcpv4InterfaceState { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldhcpv4InterfaceState struct { - obj *dhcpv4InterfaceState -} - -type marshalDhcpv4InterfaceState interface { - // ToProto marshals Dhcpv4InterfaceState to protobuf object *otg.Dhcpv4InterfaceState - ToProto() (*otg.Dhcpv4InterfaceState, error) - // ToPbText marshals Dhcpv4InterfaceState to protobuf text - ToPbText() (string, error) - // ToYaml marshals Dhcpv4InterfaceState to YAML text - ToYaml() (string, error) - // ToJson marshals Dhcpv4InterfaceState to JSON text - ToJson() (string, error) -} - -type unMarshaldhcpv4InterfaceState struct { - obj *dhcpv4InterfaceState -} - -type unMarshalDhcpv4InterfaceState interface { - // FromProto unmarshals Dhcpv4InterfaceState from protobuf object *otg.Dhcpv4InterfaceState - FromProto(msg *otg.Dhcpv4InterfaceState) (Dhcpv4InterfaceState, error) - // FromPbText unmarshals Dhcpv4InterfaceState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Dhcpv4InterfaceState from YAML text - FromYaml(value string) error - // FromJson unmarshals Dhcpv4InterfaceState from JSON text - FromJson(value string) error -} - -func (obj *dhcpv4InterfaceState) Marshal() marshalDhcpv4InterfaceState { - if obj.marshaller == nil { - obj.marshaller = &marshaldhcpv4InterfaceState{obj: obj} - } - return obj.marshaller -} - -func (obj *dhcpv4InterfaceState) Unmarshal() unMarshalDhcpv4InterfaceState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldhcpv4InterfaceState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldhcpv4InterfaceState) ToProto() (*otg.Dhcpv4InterfaceState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldhcpv4InterfaceState) FromProto(msg *otg.Dhcpv4InterfaceState) (Dhcpv4InterfaceState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldhcpv4InterfaceState) 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 *unMarshaldhcpv4InterfaceState) 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 *marshaldhcpv4InterfaceState) 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 *unMarshaldhcpv4InterfaceState) 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 *marshaldhcpv4InterfaceState) 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 *unMarshaldhcpv4InterfaceState) 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 *dhcpv4InterfaceState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *dhcpv4InterfaceState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *dhcpv4InterfaceState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *dhcpv4InterfaceState) Clone() (Dhcpv4InterfaceState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDhcpv4InterfaceState() - 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 -} - -// Dhcpv4InterfaceState is the IPv4 address associated with this DHCP Client session. -type Dhcpv4InterfaceState interface { - Validation - // msg marshals Dhcpv4InterfaceState to protobuf object *otg.Dhcpv4InterfaceState - // and doesn't set defaults - msg() *otg.Dhcpv4InterfaceState - // setMsg unmarshals Dhcpv4InterfaceState from protobuf object *otg.Dhcpv4InterfaceState - // and doesn't set defaults - setMsg(*otg.Dhcpv4InterfaceState) Dhcpv4InterfaceState - // provides marshal interface - Marshal() marshalDhcpv4InterfaceState - // provides unmarshal interface - Unmarshal() unMarshalDhcpv4InterfaceState - // validate validates Dhcpv4InterfaceState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Dhcpv4InterfaceState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // DhcpClientName returns string, set in Dhcpv4InterfaceState. - DhcpClientName() string - // SetDhcpClientName assigns string provided by user to Dhcpv4InterfaceState - SetDhcpClientName(value string) Dhcpv4InterfaceState - // HasDhcpClientName checks if DhcpClientName has been set in Dhcpv4InterfaceState - HasDhcpClientName() bool - // Ipv4Address returns string, set in Dhcpv4InterfaceState. - Ipv4Address() string - // SetIpv4Address assigns string provided by user to Dhcpv4InterfaceState - SetIpv4Address(value string) Dhcpv4InterfaceState - // HasIpv4Address checks if Ipv4Address has been set in Dhcpv4InterfaceState - HasIpv4Address() bool - // PrefixLength returns uint32, set in Dhcpv4InterfaceState. - PrefixLength() uint32 - // SetPrefixLength assigns uint32 provided by user to Dhcpv4InterfaceState - SetPrefixLength(value uint32) Dhcpv4InterfaceState - // HasPrefixLength checks if PrefixLength has been set in Dhcpv4InterfaceState - HasPrefixLength() bool - // GatewayAddress returns string, set in Dhcpv4InterfaceState. - GatewayAddress() string - // SetGatewayAddress assigns string provided by user to Dhcpv4InterfaceState - SetGatewayAddress(value string) Dhcpv4InterfaceState - // HasGatewayAddress checks if GatewayAddress has been set in Dhcpv4InterfaceState - HasGatewayAddress() bool - // LeaseTime returns uint32, set in Dhcpv4InterfaceState. - LeaseTime() uint32 - // SetLeaseTime assigns uint32 provided by user to Dhcpv4InterfaceState - SetLeaseTime(value uint32) Dhcpv4InterfaceState - // HasLeaseTime checks if LeaseTime has been set in Dhcpv4InterfaceState - HasLeaseTime() bool - // RenewTime returns uint32, set in Dhcpv4InterfaceState. - RenewTime() uint32 - // SetRenewTime assigns uint32 provided by user to Dhcpv4InterfaceState - SetRenewTime(value uint32) Dhcpv4InterfaceState - // HasRenewTime checks if RenewTime has been set in Dhcpv4InterfaceState - HasRenewTime() bool - // RebindTime returns uint32, set in Dhcpv4InterfaceState. - RebindTime() uint32 - // SetRebindTime assigns uint32 provided by user to Dhcpv4InterfaceState - SetRebindTime(value uint32) Dhcpv4InterfaceState - // HasRebindTime checks if RebindTime has been set in Dhcpv4InterfaceState - HasRebindTime() bool -} - -// The name of a DHCPv4 Client. -// DhcpClientName returns a string -func (obj *dhcpv4InterfaceState) DhcpClientName() string { - - return *obj.obj.DhcpClientName - -} - -// The name of a DHCPv4 Client. -// DhcpClientName returns a string -func (obj *dhcpv4InterfaceState) HasDhcpClientName() bool { - return obj.obj.DhcpClientName != nil -} - -// The name of a DHCPv4 Client. -// SetDhcpClientName sets the string value in the Dhcpv4InterfaceState object -func (obj *dhcpv4InterfaceState) SetDhcpClientName(value string) Dhcpv4InterfaceState { - - obj.obj.DhcpClientName = &value - return obj -} - -// The IPv4 address associated with this DHCP Client session. -// Ipv4Address returns a string -func (obj *dhcpv4InterfaceState) Ipv4Address() string { - - return *obj.obj.Ipv4Address - -} - -// The IPv4 address associated with this DHCP Client session. -// Ipv4Address returns a string -func (obj *dhcpv4InterfaceState) HasIpv4Address() bool { - return obj.obj.Ipv4Address != nil -} - -// The IPv4 address associated with this DHCP Client session. -// SetIpv4Address sets the string value in the Dhcpv4InterfaceState object -func (obj *dhcpv4InterfaceState) SetIpv4Address(value string) Dhcpv4InterfaceState { - - obj.obj.Ipv4Address = &value - return obj -} - -// The length of the prefix. -// PrefixLength returns a uint32 -func (obj *dhcpv4InterfaceState) PrefixLength() uint32 { - - return *obj.obj.PrefixLength - -} - -// The length of the prefix. -// PrefixLength returns a uint32 -func (obj *dhcpv4InterfaceState) HasPrefixLength() bool { - return obj.obj.PrefixLength != nil -} - -// The length of the prefix. -// SetPrefixLength sets the uint32 value in the Dhcpv4InterfaceState object -func (obj *dhcpv4InterfaceState) SetPrefixLength(value uint32) Dhcpv4InterfaceState { - - obj.obj.PrefixLength = &value - return obj -} - -// The Gateway Ipv4 address associated with this DHCP Client session. -// GatewayAddress returns a string -func (obj *dhcpv4InterfaceState) GatewayAddress() string { - - return *obj.obj.GatewayAddress - -} - -// The Gateway Ipv4 address associated with this DHCP Client session. -// GatewayAddress returns a string -func (obj *dhcpv4InterfaceState) HasGatewayAddress() bool { - return obj.obj.GatewayAddress != nil -} - -// The Gateway Ipv4 address associated with this DHCP Client session. -// SetGatewayAddress sets the string value in the Dhcpv4InterfaceState object -func (obj *dhcpv4InterfaceState) SetGatewayAddress(value string) Dhcpv4InterfaceState { - - obj.obj.GatewayAddress = &value - return obj -} - -// The duration of the IPv4 address lease, in seconds. -// LeaseTime returns a uint32 -func (obj *dhcpv4InterfaceState) LeaseTime() uint32 { - - return *obj.obj.LeaseTime - -} - -// The duration of the IPv4 address lease, in seconds. -// LeaseTime returns a uint32 -func (obj *dhcpv4InterfaceState) HasLeaseTime() bool { - return obj.obj.LeaseTime != nil -} - -// The duration of the IPv4 address lease, in seconds. -// SetLeaseTime sets the uint32 value in the Dhcpv4InterfaceState object -func (obj *dhcpv4InterfaceState) SetLeaseTime(value uint32) Dhcpv4InterfaceState { - - obj.obj.LeaseTime = &value - return obj -} - -// Time in seconds until the DHCPv4 client starts renewing the lease. -// RenewTime returns a uint32 -func (obj *dhcpv4InterfaceState) RenewTime() uint32 { - - return *obj.obj.RenewTime - -} - -// Time in seconds until the DHCPv4 client starts renewing the lease. -// RenewTime returns a uint32 -func (obj *dhcpv4InterfaceState) HasRenewTime() bool { - return obj.obj.RenewTime != nil -} - -// Time in seconds until the DHCPv4 client starts renewing the lease. -// SetRenewTime sets the uint32 value in the Dhcpv4InterfaceState object -func (obj *dhcpv4InterfaceState) SetRenewTime(value uint32) Dhcpv4InterfaceState { - - obj.obj.RenewTime = &value - return obj -} - -// Time in seconds until the DHCPv4 client starts rebinding. -// RebindTime returns a uint32 -func (obj *dhcpv4InterfaceState) RebindTime() uint32 { - - return *obj.obj.RebindTime - -} - -// Time in seconds until the DHCPv4 client starts rebinding. -// RebindTime returns a uint32 -func (obj *dhcpv4InterfaceState) HasRebindTime() bool { - return obj.obj.RebindTime != nil -} - -// Time in seconds until the DHCPv4 client starts rebinding. -// SetRebindTime sets the uint32 value in the Dhcpv4InterfaceState object -func (obj *dhcpv4InterfaceState) SetRebindTime(value uint32) Dhcpv4InterfaceState { - - obj.obj.RebindTime = &value - return obj -} - -func (obj *dhcpv4InterfaceState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.PrefixLength != nil { - - if *obj.obj.PrefixLength > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= Dhcpv4InterfaceState.PrefixLength <= 32 but Got %d", *obj.obj.PrefixLength)) - } - - } - -} - -func (obj *dhcpv4InterfaceState) setDefault() { - -} - -// ***** Dhcpv4LeasesState ***** -type dhcpv4LeasesState struct { - validation - obj *otg.Dhcpv4LeasesState - marshaller marshalDhcpv4LeasesState - unMarshaller unMarshalDhcpv4LeasesState - leasesHolder Dhcpv4LeasesStateDhcpv4LeaseStateIter -} - -func NewDhcpv4LeasesState() Dhcpv4LeasesState { - obj := dhcpv4LeasesState{obj: &otg.Dhcpv4LeasesState{}} - obj.setDefault() - return &obj -} - -func (obj *dhcpv4LeasesState) msg() *otg.Dhcpv4LeasesState { - return obj.obj -} - -func (obj *dhcpv4LeasesState) setMsg(msg *otg.Dhcpv4LeasesState) Dhcpv4LeasesState { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldhcpv4LeasesState struct { - obj *dhcpv4LeasesState -} - -type marshalDhcpv4LeasesState interface { - // ToProto marshals Dhcpv4LeasesState to protobuf object *otg.Dhcpv4LeasesState - ToProto() (*otg.Dhcpv4LeasesState, error) - // ToPbText marshals Dhcpv4LeasesState to protobuf text - ToPbText() (string, error) - // ToYaml marshals Dhcpv4LeasesState to YAML text - ToYaml() (string, error) - // ToJson marshals Dhcpv4LeasesState to JSON text - ToJson() (string, error) -} - -type unMarshaldhcpv4LeasesState struct { - obj *dhcpv4LeasesState -} - -type unMarshalDhcpv4LeasesState interface { - // FromProto unmarshals Dhcpv4LeasesState from protobuf object *otg.Dhcpv4LeasesState - FromProto(msg *otg.Dhcpv4LeasesState) (Dhcpv4LeasesState, error) - // FromPbText unmarshals Dhcpv4LeasesState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Dhcpv4LeasesState from YAML text - FromYaml(value string) error - // FromJson unmarshals Dhcpv4LeasesState from JSON text - FromJson(value string) error -} - -func (obj *dhcpv4LeasesState) Marshal() marshalDhcpv4LeasesState { - if obj.marshaller == nil { - obj.marshaller = &marshaldhcpv4LeasesState{obj: obj} - } - return obj.marshaller -} - -func (obj *dhcpv4LeasesState) Unmarshal() unMarshalDhcpv4LeasesState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldhcpv4LeasesState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldhcpv4LeasesState) ToProto() (*otg.Dhcpv4LeasesState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldhcpv4LeasesState) FromProto(msg *otg.Dhcpv4LeasesState) (Dhcpv4LeasesState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldhcpv4LeasesState) 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 *unMarshaldhcpv4LeasesState) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshaldhcpv4LeasesState) 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 *unMarshaldhcpv4LeasesState) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshaldhcpv4LeasesState) 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 *unMarshaldhcpv4LeasesState) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *dhcpv4LeasesState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *dhcpv4LeasesState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *dhcpv4LeasesState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *dhcpv4LeasesState) Clone() (Dhcpv4LeasesState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDhcpv4LeasesState() - 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 -} - -func (obj *dhcpv4LeasesState) setNil() { - obj.leasesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// Dhcpv4LeasesState is lease information of DHCP Server. -type Dhcpv4LeasesState interface { - Validation - // msg marshals Dhcpv4LeasesState to protobuf object *otg.Dhcpv4LeasesState - // and doesn't set defaults - msg() *otg.Dhcpv4LeasesState - // setMsg unmarshals Dhcpv4LeasesState from protobuf object *otg.Dhcpv4LeasesState - // and doesn't set defaults - setMsg(*otg.Dhcpv4LeasesState) Dhcpv4LeasesState - // provides marshal interface - Marshal() marshalDhcpv4LeasesState - // provides unmarshal interface - Unmarshal() unMarshalDhcpv4LeasesState - // validate validates Dhcpv4LeasesState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Dhcpv4LeasesState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // DhcpServerName returns string, set in Dhcpv4LeasesState. - DhcpServerName() string - // SetDhcpServerName assigns string provided by user to Dhcpv4LeasesState - SetDhcpServerName(value string) Dhcpv4LeasesState - // HasDhcpServerName checks if DhcpServerName has been set in Dhcpv4LeasesState - HasDhcpServerName() bool - // Leases returns Dhcpv4LeasesStateDhcpv4LeaseStateIterIter, set in Dhcpv4LeasesState - Leases() Dhcpv4LeasesStateDhcpv4LeaseStateIter - setNil() -} - -// The name of a DHCP Server. -// DhcpServerName returns a string -func (obj *dhcpv4LeasesState) DhcpServerName() string { - - return *obj.obj.DhcpServerName - -} - -// The name of a DHCP Server. -// DhcpServerName returns a string -func (obj *dhcpv4LeasesState) HasDhcpServerName() bool { - return obj.obj.DhcpServerName != nil -} - -// The name of a DHCP Server. -// SetDhcpServerName sets the string value in the Dhcpv4LeasesState object -func (obj *dhcpv4LeasesState) SetDhcpServerName(value string) Dhcpv4LeasesState { - - obj.obj.DhcpServerName = &value - return obj -} - -// description is TBD -// Leases returns a []Dhcpv4LeaseState -func (obj *dhcpv4LeasesState) Leases() Dhcpv4LeasesStateDhcpv4LeaseStateIter { - if len(obj.obj.Leases) == 0 { - obj.obj.Leases = []*otg.Dhcpv4LeaseState{} - } - if obj.leasesHolder == nil { - obj.leasesHolder = newDhcpv4LeasesStateDhcpv4LeaseStateIter(&obj.obj.Leases).setMsg(obj) - } - return obj.leasesHolder -} - -type dhcpv4LeasesStateDhcpv4LeaseStateIter struct { - obj *dhcpv4LeasesState - dhcpv4LeaseStateSlice []Dhcpv4LeaseState - fieldPtr *[]*otg.Dhcpv4LeaseState -} - -func newDhcpv4LeasesStateDhcpv4LeaseStateIter(ptr *[]*otg.Dhcpv4LeaseState) Dhcpv4LeasesStateDhcpv4LeaseStateIter { - return &dhcpv4LeasesStateDhcpv4LeaseStateIter{fieldPtr: ptr} -} - -type Dhcpv4LeasesStateDhcpv4LeaseStateIter interface { - setMsg(*dhcpv4LeasesState) Dhcpv4LeasesStateDhcpv4LeaseStateIter - Items() []Dhcpv4LeaseState - Add() Dhcpv4LeaseState - Append(items ...Dhcpv4LeaseState) Dhcpv4LeasesStateDhcpv4LeaseStateIter - Set(index int, newObj Dhcpv4LeaseState) Dhcpv4LeasesStateDhcpv4LeaseStateIter - Clear() Dhcpv4LeasesStateDhcpv4LeaseStateIter - clearHolderSlice() Dhcpv4LeasesStateDhcpv4LeaseStateIter - appendHolderSlice(item Dhcpv4LeaseState) Dhcpv4LeasesStateDhcpv4LeaseStateIter -} - -func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) setMsg(msg *dhcpv4LeasesState) Dhcpv4LeasesStateDhcpv4LeaseStateIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&dhcpv4LeaseState{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) Items() []Dhcpv4LeaseState { - return obj.dhcpv4LeaseStateSlice -} - -func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) Add() Dhcpv4LeaseState { - newObj := &otg.Dhcpv4LeaseState{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &dhcpv4LeaseState{obj: newObj} - newLibObj.setDefault() - obj.dhcpv4LeaseStateSlice = append(obj.dhcpv4LeaseStateSlice, newLibObj) - return newLibObj -} - -func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) Append(items ...Dhcpv4LeaseState) Dhcpv4LeasesStateDhcpv4LeaseStateIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.dhcpv4LeaseStateSlice = append(obj.dhcpv4LeaseStateSlice, item) - } - return obj -} - -func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) Set(index int, newObj Dhcpv4LeaseState) Dhcpv4LeasesStateDhcpv4LeaseStateIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.dhcpv4LeaseStateSlice[index] = newObj - return obj -} -func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) Clear() Dhcpv4LeasesStateDhcpv4LeaseStateIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.Dhcpv4LeaseState{} - obj.dhcpv4LeaseStateSlice = []Dhcpv4LeaseState{} - } - return obj -} -func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) clearHolderSlice() Dhcpv4LeasesStateDhcpv4LeaseStateIter { - if len(obj.dhcpv4LeaseStateSlice) > 0 { - obj.dhcpv4LeaseStateSlice = []Dhcpv4LeaseState{} - } - return obj -} -func (obj *dhcpv4LeasesStateDhcpv4LeaseStateIter) appendHolderSlice(item Dhcpv4LeaseState) Dhcpv4LeasesStateDhcpv4LeaseStateIter { - obj.dhcpv4LeaseStateSlice = append(obj.dhcpv4LeaseStateSlice, item) - return obj -} - -func (obj *dhcpv4LeasesState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Leases) != 0 { - - if set_default { - obj.Leases().clearHolderSlice() - for _, item := range obj.obj.Leases { - obj.Leases().appendHolderSlice(&dhcpv4LeaseState{obj: item}) - } - } - for _, item := range obj.Leases().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *dhcpv4LeasesState) setDefault() { - -} - -// ***** LagPortLacp ***** -type lagPortLacp struct { - validation - obj *otg.LagPortLacp - marshaller marshalLagPortLacp - unMarshaller unMarshalLagPortLacp -} - -func NewLagPortLacp() LagPortLacp { - obj := lagPortLacp{obj: &otg.LagPortLacp{}} - obj.setDefault() - return &obj -} - -func (obj *lagPortLacp) msg() *otg.LagPortLacp { - return obj.obj -} - -func (obj *lagPortLacp) setMsg(msg *otg.LagPortLacp) LagPortLacp { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallagPortLacp struct { - obj *lagPortLacp -} - -type marshalLagPortLacp interface { - // ToProto marshals LagPortLacp to protobuf object *otg.LagPortLacp - ToProto() (*otg.LagPortLacp, error) - // ToPbText marshals LagPortLacp to protobuf text - ToPbText() (string, error) - // ToYaml marshals LagPortLacp to YAML text - ToYaml() (string, error) - // ToJson marshals LagPortLacp to JSON text - ToJson() (string, error) -} - -type unMarshallagPortLacp struct { - obj *lagPortLacp -} - -type unMarshalLagPortLacp interface { - // FromProto unmarshals LagPortLacp from protobuf object *otg.LagPortLacp - FromProto(msg *otg.LagPortLacp) (LagPortLacp, error) - // FromPbText unmarshals LagPortLacp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LagPortLacp from YAML text - FromYaml(value string) error - // FromJson unmarshals LagPortLacp from JSON text - FromJson(value string) error -} - -func (obj *lagPortLacp) Marshal() marshalLagPortLacp { - if obj.marshaller == nil { - obj.marshaller = &marshallagPortLacp{obj: obj} - } - return obj.marshaller -} - -func (obj *lagPortLacp) Unmarshal() unMarshalLagPortLacp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallagPortLacp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallagPortLacp) ToProto() (*otg.LagPortLacp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallagPortLacp) FromProto(msg *otg.LagPortLacp) (LagPortLacp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallagPortLacp) 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 *unMarshallagPortLacp) 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 *marshallagPortLacp) 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 *unMarshallagPortLacp) 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 *marshallagPortLacp) 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 *unMarshallagPortLacp) 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 *lagPortLacp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lagPortLacp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lagPortLacp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lagPortLacp) Clone() (LagPortLacp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLagPortLacp() - 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 -} - -// LagPortLacp is the container for link aggregation control protocol settings of a LAG member (port). -type LagPortLacp interface { - Validation - // msg marshals LagPortLacp to protobuf object *otg.LagPortLacp - // and doesn't set defaults - msg() *otg.LagPortLacp - // setMsg unmarshals LagPortLacp from protobuf object *otg.LagPortLacp - // and doesn't set defaults - setMsg(*otg.LagPortLacp) LagPortLacp - // provides marshal interface - Marshal() marshalLagPortLacp - // provides unmarshal interface - Unmarshal() unMarshalLagPortLacp - // validate validates LagPortLacp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LagPortLacp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ActorPortNumber returns uint32, set in LagPortLacp. - ActorPortNumber() uint32 - // SetActorPortNumber assigns uint32 provided by user to LagPortLacp - SetActorPortNumber(value uint32) LagPortLacp - // HasActorPortNumber checks if ActorPortNumber has been set in LagPortLacp - HasActorPortNumber() bool - // ActorPortPriority returns uint32, set in LagPortLacp. - ActorPortPriority() uint32 - // SetActorPortPriority assigns uint32 provided by user to LagPortLacp - SetActorPortPriority(value uint32) LagPortLacp - // HasActorPortPriority checks if ActorPortPriority has been set in LagPortLacp - HasActorPortPriority() bool - // ActorActivity returns LagPortLacpActorActivityEnum, set in LagPortLacp - ActorActivity() LagPortLacpActorActivityEnum - // SetActorActivity assigns LagPortLacpActorActivityEnum provided by user to LagPortLacp - SetActorActivity(value LagPortLacpActorActivityEnum) LagPortLacp - // HasActorActivity checks if ActorActivity has been set in LagPortLacp - HasActorActivity() bool - // LacpduPeriodicTimeInterval returns uint32, set in LagPortLacp. - LacpduPeriodicTimeInterval() uint32 - // SetLacpduPeriodicTimeInterval assigns uint32 provided by user to LagPortLacp - SetLacpduPeriodicTimeInterval(value uint32) LagPortLacp - // HasLacpduPeriodicTimeInterval checks if LacpduPeriodicTimeInterval has been set in LagPortLacp - HasLacpduPeriodicTimeInterval() bool - // LacpduTimeout returns uint32, set in LagPortLacp. - LacpduTimeout() uint32 - // SetLacpduTimeout assigns uint32 provided by user to LagPortLacp - SetLacpduTimeout(value uint32) LagPortLacp - // HasLacpduTimeout checks if LacpduTimeout has been set in LagPortLacp - HasLacpduTimeout() bool -} - -// The actor port number -// ActorPortNumber returns a uint32 -func (obj *lagPortLacp) ActorPortNumber() uint32 { - - return *obj.obj.ActorPortNumber - -} - -// The actor port number -// ActorPortNumber returns a uint32 -func (obj *lagPortLacp) HasActorPortNumber() bool { - return obj.obj.ActorPortNumber != nil -} - -// The actor port number -// SetActorPortNumber sets the uint32 value in the LagPortLacp object -func (obj *lagPortLacp) SetActorPortNumber(value uint32) LagPortLacp { - - obj.obj.ActorPortNumber = &value - return obj -} - -// The actor port priority -// ActorPortPriority returns a uint32 -func (obj *lagPortLacp) ActorPortPriority() uint32 { - - return *obj.obj.ActorPortPriority - -} - -// The actor port priority -// ActorPortPriority returns a uint32 -func (obj *lagPortLacp) HasActorPortPriority() bool { - return obj.obj.ActorPortPriority != nil -} - -// The actor port priority -// SetActorPortPriority sets the uint32 value in the LagPortLacp object -func (obj *lagPortLacp) SetActorPortPriority(value uint32) LagPortLacp { - - obj.obj.ActorPortPriority = &value - return obj -} - -type LagPortLacpActorActivityEnum string - -// Enum of ActorActivity on LagPortLacp -var LagPortLacpActorActivity = struct { - PASSIVE LagPortLacpActorActivityEnum - ACTIVE LagPortLacpActorActivityEnum -}{ - PASSIVE: LagPortLacpActorActivityEnum("passive"), - ACTIVE: LagPortLacpActorActivityEnum("active"), -} - -func (obj *lagPortLacp) ActorActivity() LagPortLacpActorActivityEnum { - return LagPortLacpActorActivityEnum(obj.obj.ActorActivity.Enum().String()) -} - -// Sets the value of LACP actor activity as either passive or active. -// Passive indicates the port's preference for not transmitting LACPDUs unless its partner's control is Active. -// Active indicates the port's preference to participate in the protocol regardless of the partner's control value. -// ActorActivity returns a string -func (obj *lagPortLacp) HasActorActivity() bool { - return obj.obj.ActorActivity != nil -} - -func (obj *lagPortLacp) SetActorActivity(value LagPortLacpActorActivityEnum) LagPortLacp { - intValue, ok := otg.LagPortLacp_ActorActivity_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LagPortLacpActorActivityEnum", string(value))) - return obj - } - enumValue := otg.LagPortLacp_ActorActivity_Enum(intValue) - obj.obj.ActorActivity = &enumValue - - return obj -} - -// This field defines how frequently LACPDUs are sent to the link partner -// LacpduPeriodicTimeInterval returns a uint32 -func (obj *lagPortLacp) LacpduPeriodicTimeInterval() uint32 { - - return *obj.obj.LacpduPeriodicTimeInterval - -} - -// This field defines how frequently LACPDUs are sent to the link partner -// LacpduPeriodicTimeInterval returns a uint32 -func (obj *lagPortLacp) HasLacpduPeriodicTimeInterval() bool { - return obj.obj.LacpduPeriodicTimeInterval != nil -} - -// This field defines how frequently LACPDUs are sent to the link partner -// SetLacpduPeriodicTimeInterval sets the uint32 value in the LagPortLacp object -func (obj *lagPortLacp) SetLacpduPeriodicTimeInterval(value uint32) LagPortLacp { - - obj.obj.LacpduPeriodicTimeInterval = &value - return obj -} - -// This timer is used to detect whether received protocol information has expired -// LacpduTimeout returns a uint32 -func (obj *lagPortLacp) LacpduTimeout() uint32 { - - return *obj.obj.LacpduTimeout - -} - -// This timer is used to detect whether received protocol information has expired -// LacpduTimeout returns a uint32 -func (obj *lagPortLacp) HasLacpduTimeout() bool { - return obj.obj.LacpduTimeout != nil -} - -// This timer is used to detect whether received protocol information has expired -// SetLacpduTimeout sets the uint32 value in the LagPortLacp object -func (obj *lagPortLacp) SetLacpduTimeout(value uint32) LagPortLacp { - - obj.obj.LacpduTimeout = &value - return obj -} - -func (obj *lagPortLacp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.ActorPortNumber != nil { - - if *obj.obj.ActorPortNumber > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= LagPortLacp.ActorPortNumber <= 65535 but Got %d", *obj.obj.ActorPortNumber)) - } - - } - - if obj.obj.ActorPortPriority != nil { - - if *obj.obj.ActorPortPriority > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= LagPortLacp.ActorPortPriority <= 65535 but Got %d", *obj.obj.ActorPortPriority)) - } - - } - - if obj.obj.LacpduPeriodicTimeInterval != nil { - - if *obj.obj.LacpduPeriodicTimeInterval > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= LagPortLacp.LacpduPeriodicTimeInterval <= 65535 but Got %d", *obj.obj.LacpduPeriodicTimeInterval)) - } - - } - - if obj.obj.LacpduTimeout != nil { - - if *obj.obj.LacpduTimeout > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= LagPortLacp.LacpduTimeout <= 65535 but Got %d", *obj.obj.LacpduTimeout)) - } - - } - -} - -func (obj *lagPortLacp) setDefault() { - if obj.obj.ActorPortNumber == nil { - obj.SetActorPortNumber(0) - } - if obj.obj.ActorPortPriority == nil { - obj.SetActorPortPriority(1) - } - if obj.obj.ActorActivity == nil { - obj.SetActorActivity(LagPortLacpActorActivity.ACTIVE) - - } - if obj.obj.LacpduPeriodicTimeInterval == nil { - obj.SetLacpduPeriodicTimeInterval(0) - } - if obj.obj.LacpduTimeout == nil { - obj.SetLacpduTimeout(0) - } - -} - -// ***** DeviceEthernetBase ***** -type deviceEthernetBase struct { - validation - obj *otg.DeviceEthernetBase - marshaller marshalDeviceEthernetBase - unMarshaller unMarshalDeviceEthernetBase - vlansHolder DeviceEthernetBaseDeviceVlanIter -} - -func NewDeviceEthernetBase() DeviceEthernetBase { - obj := deviceEthernetBase{obj: &otg.DeviceEthernetBase{}} - obj.setDefault() - return &obj -} - -func (obj *deviceEthernetBase) msg() *otg.DeviceEthernetBase { - return obj.obj -} - -func (obj *deviceEthernetBase) setMsg(msg *otg.DeviceEthernetBase) DeviceEthernetBase { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceEthernetBase struct { - obj *deviceEthernetBase -} - -type marshalDeviceEthernetBase interface { - // ToProto marshals DeviceEthernetBase to protobuf object *otg.DeviceEthernetBase - ToProto() (*otg.DeviceEthernetBase, error) - // ToPbText marshals DeviceEthernetBase to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceEthernetBase to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceEthernetBase to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceEthernetBase struct { - obj *deviceEthernetBase -} - -type unMarshalDeviceEthernetBase interface { - // FromProto unmarshals DeviceEthernetBase from protobuf object *otg.DeviceEthernetBase - FromProto(msg *otg.DeviceEthernetBase) (DeviceEthernetBase, error) - // FromPbText unmarshals DeviceEthernetBase from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceEthernetBase from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceEthernetBase from JSON text - FromJson(value string) error -} - -func (obj *deviceEthernetBase) Marshal() marshalDeviceEthernetBase { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceEthernetBase{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceEthernetBase) Unmarshal() unMarshalDeviceEthernetBase { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceEthernetBase{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceEthernetBase) ToProto() (*otg.DeviceEthernetBase, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceEthernetBase) FromProto(msg *otg.DeviceEthernetBase) (DeviceEthernetBase, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceEthernetBase) 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 *unMarshaldeviceEthernetBase) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshaldeviceEthernetBase) 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 *unMarshaldeviceEthernetBase) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshaldeviceEthernetBase) 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 *unMarshaldeviceEthernetBase) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *deviceEthernetBase) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceEthernetBase) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceEthernetBase) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceEthernetBase) Clone() (DeviceEthernetBase, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceEthernetBase() - 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 -} - -func (obj *deviceEthernetBase) setNil() { - obj.vlansHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// DeviceEthernetBase is base Ethernet interface. -type DeviceEthernetBase interface { - Validation - // msg marshals DeviceEthernetBase to protobuf object *otg.DeviceEthernetBase - // and doesn't set defaults - msg() *otg.DeviceEthernetBase - // setMsg unmarshals DeviceEthernetBase from protobuf object *otg.DeviceEthernetBase - // and doesn't set defaults - setMsg(*otg.DeviceEthernetBase) DeviceEthernetBase - // provides marshal interface - Marshal() marshalDeviceEthernetBase - // provides unmarshal interface - Unmarshal() unMarshalDeviceEthernetBase - // validate validates DeviceEthernetBase - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceEthernetBase, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Mac returns string, set in DeviceEthernetBase. - Mac() string - // SetMac assigns string provided by user to DeviceEthernetBase - SetMac(value string) DeviceEthernetBase - // Mtu returns uint32, set in DeviceEthernetBase. - Mtu() uint32 - // SetMtu assigns uint32 provided by user to DeviceEthernetBase - SetMtu(value uint32) DeviceEthernetBase - // HasMtu checks if Mtu has been set in DeviceEthernetBase - HasMtu() bool - // Vlans returns DeviceEthernetBaseDeviceVlanIterIter, set in DeviceEthernetBase - Vlans() DeviceEthernetBaseDeviceVlanIter - // Name returns string, set in DeviceEthernetBase. - Name() string - // SetName assigns string provided by user to DeviceEthernetBase - SetName(value string) DeviceEthernetBase - setNil() -} - -// Media Access Control address. -// Mac returns a string -func (obj *deviceEthernetBase) Mac() string { - - return *obj.obj.Mac - -} - -// Media Access Control address. -// SetMac sets the string value in the DeviceEthernetBase object -func (obj *deviceEthernetBase) SetMac(value string) DeviceEthernetBase { - - obj.obj.Mac = &value - return obj -} - -// Maximum Transmission Unit. -// Mtu returns a uint32 -func (obj *deviceEthernetBase) Mtu() uint32 { - - return *obj.obj.Mtu - -} - -// Maximum Transmission Unit. -// Mtu returns a uint32 -func (obj *deviceEthernetBase) HasMtu() bool { - return obj.obj.Mtu != nil -} - -// Maximum Transmission Unit. -// SetMtu sets the uint32 value in the DeviceEthernetBase object -func (obj *deviceEthernetBase) SetMtu(value uint32) DeviceEthernetBase { - - obj.obj.Mtu = &value - return obj -} - -// List of VLANs -// Vlans returns a []DeviceVlan -func (obj *deviceEthernetBase) Vlans() DeviceEthernetBaseDeviceVlanIter { - if len(obj.obj.Vlans) == 0 { - obj.obj.Vlans = []*otg.DeviceVlan{} - } - if obj.vlansHolder == nil { - obj.vlansHolder = newDeviceEthernetBaseDeviceVlanIter(&obj.obj.Vlans).setMsg(obj) - } - return obj.vlansHolder -} - -type deviceEthernetBaseDeviceVlanIter struct { - obj *deviceEthernetBase - deviceVlanSlice []DeviceVlan - fieldPtr *[]*otg.DeviceVlan -} - -func newDeviceEthernetBaseDeviceVlanIter(ptr *[]*otg.DeviceVlan) DeviceEthernetBaseDeviceVlanIter { - return &deviceEthernetBaseDeviceVlanIter{fieldPtr: ptr} -} - -type DeviceEthernetBaseDeviceVlanIter interface { - setMsg(*deviceEthernetBase) DeviceEthernetBaseDeviceVlanIter - Items() []DeviceVlan - Add() DeviceVlan - Append(items ...DeviceVlan) DeviceEthernetBaseDeviceVlanIter - Set(index int, newObj DeviceVlan) DeviceEthernetBaseDeviceVlanIter - Clear() DeviceEthernetBaseDeviceVlanIter - clearHolderSlice() DeviceEthernetBaseDeviceVlanIter - appendHolderSlice(item DeviceVlan) DeviceEthernetBaseDeviceVlanIter -} - -func (obj *deviceEthernetBaseDeviceVlanIter) setMsg(msg *deviceEthernetBase) DeviceEthernetBaseDeviceVlanIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&deviceVlan{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *deviceEthernetBaseDeviceVlanIter) Items() []DeviceVlan { - return obj.deviceVlanSlice -} - -func (obj *deviceEthernetBaseDeviceVlanIter) Add() DeviceVlan { - newObj := &otg.DeviceVlan{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &deviceVlan{obj: newObj} - newLibObj.setDefault() - obj.deviceVlanSlice = append(obj.deviceVlanSlice, newLibObj) - return newLibObj -} - -func (obj *deviceEthernetBaseDeviceVlanIter) Append(items ...DeviceVlan) DeviceEthernetBaseDeviceVlanIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.deviceVlanSlice = append(obj.deviceVlanSlice, item) - } - return obj -} - -func (obj *deviceEthernetBaseDeviceVlanIter) Set(index int, newObj DeviceVlan) DeviceEthernetBaseDeviceVlanIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.deviceVlanSlice[index] = newObj - return obj -} -func (obj *deviceEthernetBaseDeviceVlanIter) Clear() DeviceEthernetBaseDeviceVlanIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.DeviceVlan{} - obj.deviceVlanSlice = []DeviceVlan{} - } - return obj -} -func (obj *deviceEthernetBaseDeviceVlanIter) clearHolderSlice() DeviceEthernetBaseDeviceVlanIter { - if len(obj.deviceVlanSlice) > 0 { - obj.deviceVlanSlice = []DeviceVlan{} - } - return obj -} -func (obj *deviceEthernetBaseDeviceVlanIter) appendHolderSlice(item DeviceVlan) DeviceEthernetBaseDeviceVlanIter { - obj.deviceVlanSlice = append(obj.deviceVlanSlice, item) - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *deviceEthernetBase) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the DeviceEthernetBase object -func (obj *deviceEthernetBase) SetName(value string) DeviceEthernetBase { - - obj.obj.Name = &value - return obj -} - -func (obj *deviceEthernetBase) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Mac is required - if obj.obj.Mac == nil { - vObj.validationErrors = append(vObj.validationErrors, "Mac is required field on interface DeviceEthernetBase") - } - if obj.obj.Mac != nil { - - err := obj.validateMac(obj.Mac()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceEthernetBase.Mac")) - } - - } - - if obj.obj.Mtu != nil { - - if *obj.obj.Mtu > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= DeviceEthernetBase.Mtu <= 65535 but Got %d", *obj.obj.Mtu)) - } - - } - - if len(obj.obj.Vlans) != 0 { - - if set_default { - obj.Vlans().clearHolderSlice() - for _, item := range obj.obj.Vlans { - obj.Vlans().appendHolderSlice(&deviceVlan{obj: item}) - } - } - for _, item := range obj.Vlans().Items() { - item.validateObj(vObj, set_default) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceEthernetBase") - } -} - -func (obj *deviceEthernetBase) setDefault() { - if obj.obj.Mtu == nil { - obj.SetMtu(1500) - } - -} - -// ***** LagProtocolLacp ***** -type lagProtocolLacp struct { - validation - obj *otg.LagProtocolLacp - marshaller marshalLagProtocolLacp - unMarshaller unMarshalLagProtocolLacp -} - -func NewLagProtocolLacp() LagProtocolLacp { - obj := lagProtocolLacp{obj: &otg.LagProtocolLacp{}} - obj.setDefault() - return &obj -} - -func (obj *lagProtocolLacp) msg() *otg.LagProtocolLacp { - return obj.obj -} - -func (obj *lagProtocolLacp) setMsg(msg *otg.LagProtocolLacp) LagProtocolLacp { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallagProtocolLacp struct { - obj *lagProtocolLacp -} - -type marshalLagProtocolLacp interface { - // ToProto marshals LagProtocolLacp to protobuf object *otg.LagProtocolLacp - ToProto() (*otg.LagProtocolLacp, error) - // ToPbText marshals LagProtocolLacp to protobuf text - ToPbText() (string, error) - // ToYaml marshals LagProtocolLacp to YAML text - ToYaml() (string, error) - // ToJson marshals LagProtocolLacp to JSON text - ToJson() (string, error) -} - -type unMarshallagProtocolLacp struct { - obj *lagProtocolLacp -} - -type unMarshalLagProtocolLacp interface { - // FromProto unmarshals LagProtocolLacp from protobuf object *otg.LagProtocolLacp - FromProto(msg *otg.LagProtocolLacp) (LagProtocolLacp, error) - // FromPbText unmarshals LagProtocolLacp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LagProtocolLacp from YAML text - FromYaml(value string) error - // FromJson unmarshals LagProtocolLacp from JSON text - FromJson(value string) error -} - -func (obj *lagProtocolLacp) Marshal() marshalLagProtocolLacp { - if obj.marshaller == nil { - obj.marshaller = &marshallagProtocolLacp{obj: obj} - } - return obj.marshaller -} - -func (obj *lagProtocolLacp) Unmarshal() unMarshalLagProtocolLacp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallagProtocolLacp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallagProtocolLacp) ToProto() (*otg.LagProtocolLacp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallagProtocolLacp) FromProto(msg *otg.LagProtocolLacp) (LagProtocolLacp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallagProtocolLacp) 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 *unMarshallagProtocolLacp) 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 *marshallagProtocolLacp) 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 *unMarshallagProtocolLacp) 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 *marshallagProtocolLacp) 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 *unMarshallagProtocolLacp) 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 *lagProtocolLacp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lagProtocolLacp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lagProtocolLacp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lagProtocolLacp) Clone() (LagProtocolLacp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLagProtocolLacp() - 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 -} - -// LagProtocolLacp is the container for link aggregation control protocol settings of a LAG (ports group). -type LagProtocolLacp interface { - Validation - // msg marshals LagProtocolLacp to protobuf object *otg.LagProtocolLacp - // and doesn't set defaults - msg() *otg.LagProtocolLacp - // setMsg unmarshals LagProtocolLacp from protobuf object *otg.LagProtocolLacp - // and doesn't set defaults - setMsg(*otg.LagProtocolLacp) LagProtocolLacp - // provides marshal interface - Marshal() marshalLagProtocolLacp - // provides unmarshal interface - Unmarshal() unMarshalLagProtocolLacp - // validate validates LagProtocolLacp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LagProtocolLacp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ActorSystemId returns string, set in LagProtocolLacp. - ActorSystemId() string - // SetActorSystemId assigns string provided by user to LagProtocolLacp - SetActorSystemId(value string) LagProtocolLacp - // HasActorSystemId checks if ActorSystemId has been set in LagProtocolLacp - HasActorSystemId() bool - // ActorSystemPriority returns uint32, set in LagProtocolLacp. - ActorSystemPriority() uint32 - // SetActorSystemPriority assigns uint32 provided by user to LagProtocolLacp - SetActorSystemPriority(value uint32) LagProtocolLacp - // HasActorSystemPriority checks if ActorSystemPriority has been set in LagProtocolLacp - HasActorSystemPriority() bool - // ActorKey returns uint32, set in LagProtocolLacp. - ActorKey() uint32 - // SetActorKey assigns uint32 provided by user to LagProtocolLacp - SetActorKey(value uint32) LagProtocolLacp - // HasActorKey checks if ActorKey has been set in LagProtocolLacp - HasActorKey() bool -} - -// The actor system id -// ActorSystemId returns a string -func (obj *lagProtocolLacp) ActorSystemId() string { - - return *obj.obj.ActorSystemId - -} - -// The actor system id -// ActorSystemId returns a string -func (obj *lagProtocolLacp) HasActorSystemId() bool { - return obj.obj.ActorSystemId != nil -} - -// The actor system id -// SetActorSystemId sets the string value in the LagProtocolLacp object -func (obj *lagProtocolLacp) SetActorSystemId(value string) LagProtocolLacp { - - obj.obj.ActorSystemId = &value - return obj -} - -// The actor system priority -// ActorSystemPriority returns a uint32 -func (obj *lagProtocolLacp) ActorSystemPriority() uint32 { - - return *obj.obj.ActorSystemPriority - -} - -// The actor system priority -// ActorSystemPriority returns a uint32 -func (obj *lagProtocolLacp) HasActorSystemPriority() bool { - return obj.obj.ActorSystemPriority != nil -} - -// The actor system priority -// SetActorSystemPriority sets the uint32 value in the LagProtocolLacp object -func (obj *lagProtocolLacp) SetActorSystemPriority(value uint32) LagProtocolLacp { - - obj.obj.ActorSystemPriority = &value - return obj -} - -// The actor key -// ActorKey returns a uint32 -func (obj *lagProtocolLacp) ActorKey() uint32 { - - return *obj.obj.ActorKey - -} - -// The actor key -// ActorKey returns a uint32 -func (obj *lagProtocolLacp) HasActorKey() bool { - return obj.obj.ActorKey != nil -} - -// The actor key -// SetActorKey sets the uint32 value in the LagProtocolLacp object -func (obj *lagProtocolLacp) SetActorKey(value uint32) LagProtocolLacp { - - obj.obj.ActorKey = &value - return obj -} - -func (obj *lagProtocolLacp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.ActorSystemId != nil { - - err := obj.validateMac(obj.ActorSystemId()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on LagProtocolLacp.ActorSystemId")) - } - - } - - if obj.obj.ActorSystemPriority != nil { - - if *obj.obj.ActorSystemPriority > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= LagProtocolLacp.ActorSystemPriority <= 65535 but Got %d", *obj.obj.ActorSystemPriority)) - } - - } - - if obj.obj.ActorKey != nil { - - if *obj.obj.ActorKey > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= LagProtocolLacp.ActorKey <= 65535 but Got %d", *obj.obj.ActorKey)) - } - - } - -} - -func (obj *lagProtocolLacp) setDefault() { - if obj.obj.ActorSystemId == nil { - obj.SetActorSystemId("00:00:00:00:00:00") - } - if obj.obj.ActorSystemPriority == nil { - obj.SetActorSystemPriority(0) - } - if obj.obj.ActorKey == nil { - obj.SetActorKey(0) - } - -} - -// ***** LagProtocolStatic ***** -type lagProtocolStatic struct { - validation - obj *otg.LagProtocolStatic - marshaller marshalLagProtocolStatic - unMarshaller unMarshalLagProtocolStatic -} - -func NewLagProtocolStatic() LagProtocolStatic { - obj := lagProtocolStatic{obj: &otg.LagProtocolStatic{}} - obj.setDefault() - return &obj -} - -func (obj *lagProtocolStatic) msg() *otg.LagProtocolStatic { - return obj.obj -} - -func (obj *lagProtocolStatic) setMsg(msg *otg.LagProtocolStatic) LagProtocolStatic { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallagProtocolStatic struct { - obj *lagProtocolStatic -} - -type marshalLagProtocolStatic interface { - // ToProto marshals LagProtocolStatic to protobuf object *otg.LagProtocolStatic - ToProto() (*otg.LagProtocolStatic, error) - // ToPbText marshals LagProtocolStatic to protobuf text - ToPbText() (string, error) - // ToYaml marshals LagProtocolStatic to YAML text - ToYaml() (string, error) - // ToJson marshals LagProtocolStatic to JSON text - ToJson() (string, error) -} - -type unMarshallagProtocolStatic struct { - obj *lagProtocolStatic -} - -type unMarshalLagProtocolStatic interface { - // FromProto unmarshals LagProtocolStatic from protobuf object *otg.LagProtocolStatic - FromProto(msg *otg.LagProtocolStatic) (LagProtocolStatic, error) - // FromPbText unmarshals LagProtocolStatic from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LagProtocolStatic from YAML text - FromYaml(value string) error - // FromJson unmarshals LagProtocolStatic from JSON text - FromJson(value string) error -} - -func (obj *lagProtocolStatic) Marshal() marshalLagProtocolStatic { - if obj.marshaller == nil { - obj.marshaller = &marshallagProtocolStatic{obj: obj} - } - return obj.marshaller -} - -func (obj *lagProtocolStatic) Unmarshal() unMarshalLagProtocolStatic { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallagProtocolStatic{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallagProtocolStatic) ToProto() (*otg.LagProtocolStatic, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallagProtocolStatic) FromProto(msg *otg.LagProtocolStatic) (LagProtocolStatic, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallagProtocolStatic) 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 *unMarshallagProtocolStatic) 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 *marshallagProtocolStatic) 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 *unMarshallagProtocolStatic) 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 *marshallagProtocolStatic) 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 *unMarshallagProtocolStatic) 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 *lagProtocolStatic) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lagProtocolStatic) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lagProtocolStatic) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lagProtocolStatic) Clone() (LagProtocolStatic, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLagProtocolStatic() - 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 -} - -// LagProtocolStatic is the container for static link aggregation protocol settings. -type LagProtocolStatic interface { - Validation - // msg marshals LagProtocolStatic to protobuf object *otg.LagProtocolStatic - // and doesn't set defaults - msg() *otg.LagProtocolStatic - // setMsg unmarshals LagProtocolStatic from protobuf object *otg.LagProtocolStatic - // and doesn't set defaults - setMsg(*otg.LagProtocolStatic) LagProtocolStatic - // provides marshal interface - Marshal() marshalLagProtocolStatic - // provides unmarshal interface - Unmarshal() unMarshalLagProtocolStatic - // validate validates LagProtocolStatic - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LagProtocolStatic, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // LagId returns uint32, set in LagProtocolStatic. - LagId() uint32 - // SetLagId assigns uint32 provided by user to LagProtocolStatic - SetLagId(value uint32) LagProtocolStatic - // HasLagId checks if LagId has been set in LagProtocolStatic - HasLagId() bool -} - -// The static lag id -// LagId returns a uint32 -func (obj *lagProtocolStatic) LagId() uint32 { - - return *obj.obj.LagId - -} - -// The static lag id -// LagId returns a uint32 -func (obj *lagProtocolStatic) HasLagId() bool { - return obj.obj.LagId != nil -} - -// The static lag id -// SetLagId sets the uint32 value in the LagProtocolStatic object -func (obj *lagProtocolStatic) SetLagId(value uint32) LagProtocolStatic { - - obj.obj.LagId = &value - return obj -} - -func (obj *lagProtocolStatic) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.LagId != nil { - - if *obj.obj.LagId > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= LagProtocolStatic.LagId <= 65535 but Got %d", *obj.obj.LagId)) - } - - } - -} - -func (obj *lagProtocolStatic) setDefault() { - if obj.obj.LagId == nil { - obj.SetLagId(0) - } - -} - -// ***** Layer1Ieee8021Qbb ***** -type layer1Ieee8021Qbb struct { - validation - obj *otg.Layer1Ieee8021Qbb - marshaller marshalLayer1Ieee8021Qbb - unMarshaller unMarshalLayer1Ieee8021Qbb -} - -func NewLayer1Ieee8021Qbb() Layer1Ieee8021Qbb { - obj := layer1Ieee8021Qbb{obj: &otg.Layer1Ieee8021Qbb{}} - obj.setDefault() - return &obj -} - -func (obj *layer1Ieee8021Qbb) msg() *otg.Layer1Ieee8021Qbb { - return obj.obj -} - -func (obj *layer1Ieee8021Qbb) setMsg(msg *otg.Layer1Ieee8021Qbb) Layer1Ieee8021Qbb { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallayer1Ieee8021Qbb struct { - obj *layer1Ieee8021Qbb -} - -type marshalLayer1Ieee8021Qbb interface { - // ToProto marshals Layer1Ieee8021Qbb to protobuf object *otg.Layer1Ieee8021Qbb - ToProto() (*otg.Layer1Ieee8021Qbb, error) - // ToPbText marshals Layer1Ieee8021Qbb to protobuf text - ToPbText() (string, error) - // ToYaml marshals Layer1Ieee8021Qbb to YAML text - ToYaml() (string, error) - // ToJson marshals Layer1Ieee8021Qbb to JSON text - ToJson() (string, error) -} - -type unMarshallayer1Ieee8021Qbb struct { - obj *layer1Ieee8021Qbb -} - -type unMarshalLayer1Ieee8021Qbb interface { - // FromProto unmarshals Layer1Ieee8021Qbb from protobuf object *otg.Layer1Ieee8021Qbb - FromProto(msg *otg.Layer1Ieee8021Qbb) (Layer1Ieee8021Qbb, error) - // FromPbText unmarshals Layer1Ieee8021Qbb from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Layer1Ieee8021Qbb from YAML text - FromYaml(value string) error - // FromJson unmarshals Layer1Ieee8021Qbb from JSON text - FromJson(value string) error -} - -func (obj *layer1Ieee8021Qbb) Marshal() marshalLayer1Ieee8021Qbb { - if obj.marshaller == nil { - obj.marshaller = &marshallayer1Ieee8021Qbb{obj: obj} - } - return obj.marshaller -} - -func (obj *layer1Ieee8021Qbb) Unmarshal() unMarshalLayer1Ieee8021Qbb { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallayer1Ieee8021Qbb{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallayer1Ieee8021Qbb) ToProto() (*otg.Layer1Ieee8021Qbb, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallayer1Ieee8021Qbb) FromProto(msg *otg.Layer1Ieee8021Qbb) (Layer1Ieee8021Qbb, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallayer1Ieee8021Qbb) 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 *unMarshallayer1Ieee8021Qbb) 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 *marshallayer1Ieee8021Qbb) 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 *unMarshallayer1Ieee8021Qbb) 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 *marshallayer1Ieee8021Qbb) 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 *unMarshallayer1Ieee8021Qbb) 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 *layer1Ieee8021Qbb) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *layer1Ieee8021Qbb) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *layer1Ieee8021Qbb) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *layer1Ieee8021Qbb) Clone() (Layer1Ieee8021Qbb, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLayer1Ieee8021Qbb() - 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 -} - -// Layer1Ieee8021Qbb is these settings enhance the existing 802.3x pause priority capabilities -// to enable flow control based on 802.1p priorities (classes of service). -type Layer1Ieee8021Qbb interface { - Validation - // msg marshals Layer1Ieee8021Qbb to protobuf object *otg.Layer1Ieee8021Qbb - // and doesn't set defaults - msg() *otg.Layer1Ieee8021Qbb - // setMsg unmarshals Layer1Ieee8021Qbb from protobuf object *otg.Layer1Ieee8021Qbb - // and doesn't set defaults - setMsg(*otg.Layer1Ieee8021Qbb) Layer1Ieee8021Qbb - // provides marshal interface - Marshal() marshalLayer1Ieee8021Qbb - // provides unmarshal interface - Unmarshal() unMarshalLayer1Ieee8021Qbb - // validate validates Layer1Ieee8021Qbb - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Layer1Ieee8021Qbb, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PfcDelay returns uint32, set in Layer1Ieee8021Qbb. - PfcDelay() uint32 - // SetPfcDelay assigns uint32 provided by user to Layer1Ieee8021Qbb - SetPfcDelay(value uint32) Layer1Ieee8021Qbb - // HasPfcDelay checks if PfcDelay has been set in Layer1Ieee8021Qbb - HasPfcDelay() bool - // PfcClass0 returns uint32, set in Layer1Ieee8021Qbb. - PfcClass0() uint32 - // SetPfcClass0 assigns uint32 provided by user to Layer1Ieee8021Qbb - SetPfcClass0(value uint32) Layer1Ieee8021Qbb - // HasPfcClass0 checks if PfcClass0 has been set in Layer1Ieee8021Qbb - HasPfcClass0() bool - // PfcClass1 returns uint32, set in Layer1Ieee8021Qbb. - PfcClass1() uint32 - // SetPfcClass1 assigns uint32 provided by user to Layer1Ieee8021Qbb - SetPfcClass1(value uint32) Layer1Ieee8021Qbb - // HasPfcClass1 checks if PfcClass1 has been set in Layer1Ieee8021Qbb - HasPfcClass1() bool - // PfcClass2 returns uint32, set in Layer1Ieee8021Qbb. - PfcClass2() uint32 - // SetPfcClass2 assigns uint32 provided by user to Layer1Ieee8021Qbb - SetPfcClass2(value uint32) Layer1Ieee8021Qbb - // HasPfcClass2 checks if PfcClass2 has been set in Layer1Ieee8021Qbb - HasPfcClass2() bool - // PfcClass3 returns uint32, set in Layer1Ieee8021Qbb. - PfcClass3() uint32 - // SetPfcClass3 assigns uint32 provided by user to Layer1Ieee8021Qbb - SetPfcClass3(value uint32) Layer1Ieee8021Qbb - // HasPfcClass3 checks if PfcClass3 has been set in Layer1Ieee8021Qbb - HasPfcClass3() bool - // PfcClass4 returns uint32, set in Layer1Ieee8021Qbb. - PfcClass4() uint32 - // SetPfcClass4 assigns uint32 provided by user to Layer1Ieee8021Qbb - SetPfcClass4(value uint32) Layer1Ieee8021Qbb - // HasPfcClass4 checks if PfcClass4 has been set in Layer1Ieee8021Qbb - HasPfcClass4() bool - // PfcClass5 returns uint32, set in Layer1Ieee8021Qbb. - PfcClass5() uint32 - // SetPfcClass5 assigns uint32 provided by user to Layer1Ieee8021Qbb - SetPfcClass5(value uint32) Layer1Ieee8021Qbb - // HasPfcClass5 checks if PfcClass5 has been set in Layer1Ieee8021Qbb - HasPfcClass5() bool - // PfcClass6 returns uint32, set in Layer1Ieee8021Qbb. - PfcClass6() uint32 - // SetPfcClass6 assigns uint32 provided by user to Layer1Ieee8021Qbb - SetPfcClass6(value uint32) Layer1Ieee8021Qbb - // HasPfcClass6 checks if PfcClass6 has been set in Layer1Ieee8021Qbb - HasPfcClass6() bool - // PfcClass7 returns uint32, set in Layer1Ieee8021Qbb. - PfcClass7() uint32 - // SetPfcClass7 assigns uint32 provided by user to Layer1Ieee8021Qbb - SetPfcClass7(value uint32) Layer1Ieee8021Qbb - // HasPfcClass7 checks if PfcClass7 has been set in Layer1Ieee8021Qbb - HasPfcClass7() bool -} - -// The upper limit on the transmit time of a queue after receiving a -// message to pause a specified priority. -// A value of 0 or null indicates that pfc delay will not be enabled. -// PfcDelay returns a uint32 -func (obj *layer1Ieee8021Qbb) PfcDelay() uint32 { - - return *obj.obj.PfcDelay - -} - -// The upper limit on the transmit time of a queue after receiving a -// message to pause a specified priority. -// A value of 0 or null indicates that pfc delay will not be enabled. -// PfcDelay returns a uint32 -func (obj *layer1Ieee8021Qbb) HasPfcDelay() bool { - return obj.obj.PfcDelay != nil -} - -// The upper limit on the transmit time of a queue after receiving a -// message to pause a specified priority. -// A value of 0 or null indicates that pfc delay will not be enabled. -// SetPfcDelay sets the uint32 value in the Layer1Ieee8021Qbb object -func (obj *layer1Ieee8021Qbb) SetPfcDelay(value uint32) Layer1Ieee8021Qbb { - - obj.obj.PfcDelay = &value - return obj -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass0 returns a uint32 -func (obj *layer1Ieee8021Qbb) PfcClass0() uint32 { - - return *obj.obj.PfcClass_0 - -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass0 returns a uint32 -func (obj *layer1Ieee8021Qbb) HasPfcClass0() bool { - return obj.obj.PfcClass_0 != nil -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// SetPfcClass0 sets the uint32 value in the Layer1Ieee8021Qbb object -func (obj *layer1Ieee8021Qbb) SetPfcClass0(value uint32) Layer1Ieee8021Qbb { - - obj.obj.PfcClass_0 = &value - return obj -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass1 returns a uint32 -func (obj *layer1Ieee8021Qbb) PfcClass1() uint32 { - - return *obj.obj.PfcClass_1 - -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass1 returns a uint32 -func (obj *layer1Ieee8021Qbb) HasPfcClass1() bool { - return obj.obj.PfcClass_1 != nil -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// SetPfcClass1 sets the uint32 value in the Layer1Ieee8021Qbb object -func (obj *layer1Ieee8021Qbb) SetPfcClass1(value uint32) Layer1Ieee8021Qbb { - - obj.obj.PfcClass_1 = &value - return obj -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass2 returns a uint32 -func (obj *layer1Ieee8021Qbb) PfcClass2() uint32 { - - return *obj.obj.PfcClass_2 - -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass2 returns a uint32 -func (obj *layer1Ieee8021Qbb) HasPfcClass2() bool { - return obj.obj.PfcClass_2 != nil -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// SetPfcClass2 sets the uint32 value in the Layer1Ieee8021Qbb object -func (obj *layer1Ieee8021Qbb) SetPfcClass2(value uint32) Layer1Ieee8021Qbb { - - obj.obj.PfcClass_2 = &value - return obj -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass3 returns a uint32 -func (obj *layer1Ieee8021Qbb) PfcClass3() uint32 { - - return *obj.obj.PfcClass_3 - -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass3 returns a uint32 -func (obj *layer1Ieee8021Qbb) HasPfcClass3() bool { - return obj.obj.PfcClass_3 != nil -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// SetPfcClass3 sets the uint32 value in the Layer1Ieee8021Qbb object -func (obj *layer1Ieee8021Qbb) SetPfcClass3(value uint32) Layer1Ieee8021Qbb { - - obj.obj.PfcClass_3 = &value - return obj -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass4 returns a uint32 -func (obj *layer1Ieee8021Qbb) PfcClass4() uint32 { - - return *obj.obj.PfcClass_4 - -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass4 returns a uint32 -func (obj *layer1Ieee8021Qbb) HasPfcClass4() bool { - return obj.obj.PfcClass_4 != nil -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// SetPfcClass4 sets the uint32 value in the Layer1Ieee8021Qbb object -func (obj *layer1Ieee8021Qbb) SetPfcClass4(value uint32) Layer1Ieee8021Qbb { - - obj.obj.PfcClass_4 = &value - return obj -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass5 returns a uint32 -func (obj *layer1Ieee8021Qbb) PfcClass5() uint32 { - - return *obj.obj.PfcClass_5 - -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass5 returns a uint32 -func (obj *layer1Ieee8021Qbb) HasPfcClass5() bool { - return obj.obj.PfcClass_5 != nil -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// SetPfcClass5 sets the uint32 value in the Layer1Ieee8021Qbb object -func (obj *layer1Ieee8021Qbb) SetPfcClass5(value uint32) Layer1Ieee8021Qbb { - - obj.obj.PfcClass_5 = &value - return obj -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass6 returns a uint32 -func (obj *layer1Ieee8021Qbb) PfcClass6() uint32 { - - return *obj.obj.PfcClass_6 - -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass6 returns a uint32 -func (obj *layer1Ieee8021Qbb) HasPfcClass6() bool { - return obj.obj.PfcClass_6 != nil -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// SetPfcClass6 sets the uint32 value in the Layer1Ieee8021Qbb object -func (obj *layer1Ieee8021Qbb) SetPfcClass6(value uint32) Layer1Ieee8021Qbb { - - obj.obj.PfcClass_6 = &value - return obj -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass7 returns a uint32 -func (obj *layer1Ieee8021Qbb) PfcClass7() uint32 { - - return *obj.obj.PfcClass_7 - -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// PfcClass7 returns a uint32 -func (obj *layer1Ieee8021Qbb) HasPfcClass7() bool { - return obj.obj.PfcClass_7 != nil -} - -// The valid values are null, 0 - 7. -// A null value indicates there is no setting for this pfc class. -// SetPfcClass7 sets the uint32 value in the Layer1Ieee8021Qbb object -func (obj *layer1Ieee8021Qbb) SetPfcClass7(value uint32) Layer1Ieee8021Qbb { - - obj.obj.PfcClass_7 = &value - return obj -} - -func (obj *layer1Ieee8021Qbb) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.PfcDelay != nil { - - if *obj.obj.PfcDelay > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcDelay <= 65535 but Got %d", *obj.obj.PfcDelay)) - } - - } - - if obj.obj.PfcClass_0 != nil { - - if *obj.obj.PfcClass_0 > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_0 <= 7 but Got %d", *obj.obj.PfcClass_0)) - } - - } - - if obj.obj.PfcClass_1 != nil { - - if *obj.obj.PfcClass_1 > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_1 <= 7 but Got %d", *obj.obj.PfcClass_1)) - } - - } - - if obj.obj.PfcClass_2 != nil { - - if *obj.obj.PfcClass_2 > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_2 <= 7 but Got %d", *obj.obj.PfcClass_2)) - } - - } - - if obj.obj.PfcClass_3 != nil { - - if *obj.obj.PfcClass_3 > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_3 <= 7 but Got %d", *obj.obj.PfcClass_3)) - } - - } - - if obj.obj.PfcClass_4 != nil { - - if *obj.obj.PfcClass_4 > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_4 <= 7 but Got %d", *obj.obj.PfcClass_4)) - } - - } - - if obj.obj.PfcClass_5 != nil { - - if *obj.obj.PfcClass_5 > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_5 <= 7 but Got %d", *obj.obj.PfcClass_5)) - } - - } - - if obj.obj.PfcClass_6 != nil { - - if *obj.obj.PfcClass_6 > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_6 <= 7 but Got %d", *obj.obj.PfcClass_6)) - } - - } - - if obj.obj.PfcClass_7 != nil { - - if *obj.obj.PfcClass_7 > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_7 <= 7 but Got %d", *obj.obj.PfcClass_7)) - } - - } - -} - -func (obj *layer1Ieee8021Qbb) setDefault() { - if obj.obj.PfcDelay == nil { - obj.SetPfcDelay(0) - } - if obj.obj.PfcClass_0 == nil { - obj.SetPfcClass0(0) - } - if obj.obj.PfcClass_1 == nil { - obj.SetPfcClass1(1) - } - if obj.obj.PfcClass_2 == nil { - obj.SetPfcClass2(2) - } - if obj.obj.PfcClass_3 == nil { - obj.SetPfcClass3(3) - } - if obj.obj.PfcClass_4 == nil { - obj.SetPfcClass4(4) - } - if obj.obj.PfcClass_5 == nil { - obj.SetPfcClass5(5) - } - if obj.obj.PfcClass_6 == nil { - obj.SetPfcClass6(6) - } - if obj.obj.PfcClass_7 == nil { - obj.SetPfcClass7(7) - } - -} - -// ***** Layer1Ieee8023X ***** -type layer1Ieee8023X struct { - validation - obj *otg.Layer1Ieee8023X - marshaller marshalLayer1Ieee8023X - unMarshaller unMarshalLayer1Ieee8023X -} - -func NewLayer1Ieee8023X() Layer1Ieee8023X { - obj := layer1Ieee8023X{obj: &otg.Layer1Ieee8023X{}} - obj.setDefault() - return &obj -} - -func (obj *layer1Ieee8023X) msg() *otg.Layer1Ieee8023X { - return obj.obj -} - -func (obj *layer1Ieee8023X) setMsg(msg *otg.Layer1Ieee8023X) Layer1Ieee8023X { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallayer1Ieee8023X struct { - obj *layer1Ieee8023X -} - -type marshalLayer1Ieee8023X interface { - // ToProto marshals Layer1Ieee8023X to protobuf object *otg.Layer1Ieee8023X - ToProto() (*otg.Layer1Ieee8023X, error) - // ToPbText marshals Layer1Ieee8023X to protobuf text - ToPbText() (string, error) - // ToYaml marshals Layer1Ieee8023X to YAML text - ToYaml() (string, error) - // ToJson marshals Layer1Ieee8023X to JSON text - ToJson() (string, error) -} - -type unMarshallayer1Ieee8023X struct { - obj *layer1Ieee8023X -} - -type unMarshalLayer1Ieee8023X interface { - // FromProto unmarshals Layer1Ieee8023X from protobuf object *otg.Layer1Ieee8023X - FromProto(msg *otg.Layer1Ieee8023X) (Layer1Ieee8023X, error) - // FromPbText unmarshals Layer1Ieee8023X from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Layer1Ieee8023X from YAML text - FromYaml(value string) error - // FromJson unmarshals Layer1Ieee8023X from JSON text - FromJson(value string) error -} - -func (obj *layer1Ieee8023X) Marshal() marshalLayer1Ieee8023X { - if obj.marshaller == nil { - obj.marshaller = &marshallayer1Ieee8023X{obj: obj} - } - return obj.marshaller -} - -func (obj *layer1Ieee8023X) Unmarshal() unMarshalLayer1Ieee8023X { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallayer1Ieee8023X{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallayer1Ieee8023X) ToProto() (*otg.Layer1Ieee8023X, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallayer1Ieee8023X) FromProto(msg *otg.Layer1Ieee8023X) (Layer1Ieee8023X, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallayer1Ieee8023X) 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 *unMarshallayer1Ieee8023X) 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 *marshallayer1Ieee8023X) 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 *unMarshallayer1Ieee8023X) 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 *marshallayer1Ieee8023X) 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 *unMarshallayer1Ieee8023X) 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 *layer1Ieee8023X) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *layer1Ieee8023X) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *layer1Ieee8023X) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *layer1Ieee8023X) Clone() (Layer1Ieee8023X, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLayer1Ieee8023X() - 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 -} - -// Layer1Ieee8023X is a container for ieee 802.3x rx pause settings -type Layer1Ieee8023X interface { - Validation - // msg marshals Layer1Ieee8023X to protobuf object *otg.Layer1Ieee8023X - // and doesn't set defaults - msg() *otg.Layer1Ieee8023X - // setMsg unmarshals Layer1Ieee8023X from protobuf object *otg.Layer1Ieee8023X - // and doesn't set defaults - setMsg(*otg.Layer1Ieee8023X) Layer1Ieee8023X - // provides marshal interface - Marshal() marshalLayer1Ieee8023X - // provides unmarshal interface - Unmarshal() unMarshalLayer1Ieee8023X - // validate validates Layer1Ieee8023X - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Layer1Ieee8023X, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() -} - -func (obj *layer1Ieee8023X) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *layer1Ieee8023X) setDefault() { - -} - -// ***** CaptureCustom ***** -type captureCustom struct { - validation - obj *otg.CaptureCustom - marshaller marshalCaptureCustom - unMarshaller unMarshalCaptureCustom -} - -func NewCaptureCustom() CaptureCustom { - obj := captureCustom{obj: &otg.CaptureCustom{}} - obj.setDefault() - return &obj -} - -func (obj *captureCustom) msg() *otg.CaptureCustom { - return obj.obj -} - -func (obj *captureCustom) setMsg(msg *otg.CaptureCustom) CaptureCustom { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalcaptureCustom struct { - obj *captureCustom -} - -type marshalCaptureCustom interface { - // ToProto marshals CaptureCustom to protobuf object *otg.CaptureCustom - ToProto() (*otg.CaptureCustom, error) - // ToPbText marshals CaptureCustom to protobuf text - ToPbText() (string, error) - // ToYaml marshals CaptureCustom to YAML text - ToYaml() (string, error) - // ToJson marshals CaptureCustom to JSON text - ToJson() (string, error) -} - -type unMarshalcaptureCustom struct { - obj *captureCustom -} - -type unMarshalCaptureCustom interface { - // FromProto unmarshals CaptureCustom from protobuf object *otg.CaptureCustom - FromProto(msg *otg.CaptureCustom) (CaptureCustom, error) - // FromPbText unmarshals CaptureCustom from protobuf text - FromPbText(value string) error - // FromYaml unmarshals CaptureCustom from YAML text - FromYaml(value string) error - // FromJson unmarshals CaptureCustom from JSON text - FromJson(value string) error -} - -func (obj *captureCustom) Marshal() marshalCaptureCustom { - if obj.marshaller == nil { - obj.marshaller = &marshalcaptureCustom{obj: obj} - } - return obj.marshaller -} - -func (obj *captureCustom) Unmarshal() unMarshalCaptureCustom { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalcaptureCustom{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalcaptureCustom) ToProto() (*otg.CaptureCustom, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalcaptureCustom) FromProto(msg *otg.CaptureCustom) (CaptureCustom, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalcaptureCustom) 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 *unMarshalcaptureCustom) 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 *marshalcaptureCustom) 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 *unMarshalcaptureCustom) 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 *marshalcaptureCustom) 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 *unMarshalcaptureCustom) 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 *captureCustom) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *captureCustom) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *captureCustom) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *captureCustom) Clone() (CaptureCustom, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewCaptureCustom() - 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 -} - -// CaptureCustom is description is TBD -type CaptureCustom interface { - Validation - // msg marshals CaptureCustom to protobuf object *otg.CaptureCustom - // and doesn't set defaults - msg() *otg.CaptureCustom - // setMsg unmarshals CaptureCustom from protobuf object *otg.CaptureCustom - // and doesn't set defaults - setMsg(*otg.CaptureCustom) CaptureCustom - // provides marshal interface - Marshal() marshalCaptureCustom - // provides unmarshal interface - Unmarshal() unMarshalCaptureCustom - // validate validates CaptureCustom - validate() error - // A stringer function - String() string - // Clones the object - Clone() (CaptureCustom, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Offset returns uint32, set in CaptureCustom. - Offset() uint32 - // SetOffset assigns uint32 provided by user to CaptureCustom - SetOffset(value uint32) CaptureCustom - // HasOffset checks if Offset has been set in CaptureCustom - HasOffset() bool - // BitLength returns uint32, set in CaptureCustom. - BitLength() uint32 - // SetBitLength assigns uint32 provided by user to CaptureCustom - SetBitLength(value uint32) CaptureCustom - // HasBitLength checks if BitLength has been set in CaptureCustom - HasBitLength() bool - // Value returns string, set in CaptureCustom. - Value() string - // SetValue assigns string provided by user to CaptureCustom - SetValue(value string) CaptureCustom - // HasValue checks if Value has been set in CaptureCustom - HasValue() bool - // Mask returns string, set in CaptureCustom. - Mask() string - // SetMask assigns string provided by user to CaptureCustom - SetMask(value string) CaptureCustom - // HasMask checks if Mask has been set in CaptureCustom - HasMask() bool - // Negate returns bool, set in CaptureCustom. - Negate() bool - // SetNegate assigns bool provided by user to CaptureCustom - SetNegate(value bool) CaptureCustom - // HasNegate checks if Negate has been set in CaptureCustom - HasNegate() bool -} - -// The bit offset of field to filter on -// Offset returns a uint32 -func (obj *captureCustom) Offset() uint32 { - - return *obj.obj.Offset - -} - -// The bit offset of field to filter on -// Offset returns a uint32 -func (obj *captureCustom) HasOffset() bool { - return obj.obj.Offset != nil -} - -// The bit offset of field to filter on -// SetOffset sets the uint32 value in the CaptureCustom object -func (obj *captureCustom) SetOffset(value uint32) CaptureCustom { - - obj.obj.Offset = &value - return obj -} - -// The bit length of field to filter on -// BitLength returns a uint32 -func (obj *captureCustom) BitLength() uint32 { - - return *obj.obj.BitLength - -} - -// The bit length of field to filter on -// BitLength returns a uint32 -func (obj *captureCustom) HasBitLength() bool { - return obj.obj.BitLength != nil -} - -// The bit length of field to filter on -// SetBitLength sets the uint32 value in the CaptureCustom object -func (obj *captureCustom) SetBitLength(value uint32) CaptureCustom { - - obj.obj.BitLength = &value - return obj -} - -// description is TBD -// Value returns a string -func (obj *captureCustom) Value() string { - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *captureCustom) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the CaptureCustom object -func (obj *captureCustom) SetValue(value string) CaptureCustom { - - obj.obj.Value = &value - return obj -} - -// description is TBD -// Mask returns a string -func (obj *captureCustom) Mask() string { - - return *obj.obj.Mask - -} - -// description is TBD -// Mask returns a string -func (obj *captureCustom) HasMask() bool { - return obj.obj.Mask != nil -} - -// description is TBD -// SetMask sets the string value in the CaptureCustom object -func (obj *captureCustom) SetMask(value string) CaptureCustom { - - obj.obj.Mask = &value - return obj -} - -// description is TBD -// Negate returns a bool -func (obj *captureCustom) Negate() bool { - - return *obj.obj.Negate - -} - -// description is TBD -// Negate returns a bool -func (obj *captureCustom) HasNegate() bool { - return obj.obj.Negate != nil -} - -// description is TBD -// SetNegate sets the bool value in the CaptureCustom object -func (obj *captureCustom) SetNegate(value bool) CaptureCustom { - - obj.obj.Negate = &value - return obj -} - -func (obj *captureCustom) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateHex(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on CaptureCustom.Value")) - } - - } - - if obj.obj.Mask != nil { - - err := obj.validateHex(obj.Mask()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on CaptureCustom.Mask")) - } - - } - -} - -func (obj *captureCustom) setDefault() { - if obj.obj.BitLength == nil { - obj.SetBitLength(8) - } - if obj.obj.Value == nil { - obj.SetValue("00") - } - if obj.obj.Mask == nil { - obj.SetMask("00") - } - if obj.obj.Negate == nil { - obj.SetNegate(false) - } - -} - -// ***** CaptureEthernet ***** -type captureEthernet struct { - validation - obj *otg.CaptureEthernet - marshaller marshalCaptureEthernet - unMarshaller unMarshalCaptureEthernet - srcHolder CaptureField - dstHolder CaptureField - etherTypeHolder CaptureField - pfcQueueHolder CaptureField -} - -func NewCaptureEthernet() CaptureEthernet { - obj := captureEthernet{obj: &otg.CaptureEthernet{}} - obj.setDefault() - return &obj -} - -func (obj *captureEthernet) msg() *otg.CaptureEthernet { - return obj.obj -} - -func (obj *captureEthernet) setMsg(msg *otg.CaptureEthernet) CaptureEthernet { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalcaptureEthernet struct { - obj *captureEthernet -} - -type marshalCaptureEthernet interface { - // ToProto marshals CaptureEthernet to protobuf object *otg.CaptureEthernet - ToProto() (*otg.CaptureEthernet, error) - // ToPbText marshals CaptureEthernet to protobuf text - ToPbText() (string, error) - // ToYaml marshals CaptureEthernet to YAML text - ToYaml() (string, error) - // ToJson marshals CaptureEthernet to JSON text - ToJson() (string, error) -} - -type unMarshalcaptureEthernet struct { - obj *captureEthernet -} - -type unMarshalCaptureEthernet interface { - // FromProto unmarshals CaptureEthernet from protobuf object *otg.CaptureEthernet - FromProto(msg *otg.CaptureEthernet) (CaptureEthernet, error) - // FromPbText unmarshals CaptureEthernet from protobuf text - FromPbText(value string) error - // FromYaml unmarshals CaptureEthernet from YAML text - FromYaml(value string) error - // FromJson unmarshals CaptureEthernet from JSON text - FromJson(value string) error -} - -func (obj *captureEthernet) Marshal() marshalCaptureEthernet { - if obj.marshaller == nil { - obj.marshaller = &marshalcaptureEthernet{obj: obj} - } - return obj.marshaller -} - -func (obj *captureEthernet) Unmarshal() unMarshalCaptureEthernet { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalcaptureEthernet{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalcaptureEthernet) ToProto() (*otg.CaptureEthernet, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalcaptureEthernet) FromProto(msg *otg.CaptureEthernet) (CaptureEthernet, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalcaptureEthernet) 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 *unMarshalcaptureEthernet) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalcaptureEthernet) 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 *unMarshalcaptureEthernet) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalcaptureEthernet) 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 *unMarshalcaptureEthernet) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *captureEthernet) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *captureEthernet) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *captureEthernet) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *captureEthernet) Clone() (CaptureEthernet, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewCaptureEthernet() - 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 -} - -func (obj *captureEthernet) setNil() { - obj.srcHolder = nil - obj.dstHolder = nil - obj.etherTypeHolder = nil - obj.pfcQueueHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// CaptureEthernet is description is TBD -type CaptureEthernet interface { - Validation - // msg marshals CaptureEthernet to protobuf object *otg.CaptureEthernet - // and doesn't set defaults - msg() *otg.CaptureEthernet - // setMsg unmarshals CaptureEthernet from protobuf object *otg.CaptureEthernet - // and doesn't set defaults - setMsg(*otg.CaptureEthernet) CaptureEthernet - // provides marshal interface - Marshal() marshalCaptureEthernet - // provides unmarshal interface - Unmarshal() unMarshalCaptureEthernet - // validate validates CaptureEthernet - validate() error - // A stringer function - String() string - // Clones the object - Clone() (CaptureEthernet, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Src returns CaptureField, set in CaptureEthernet. - // CaptureField is description is TBD - Src() CaptureField - // SetSrc assigns CaptureField provided by user to CaptureEthernet. - // CaptureField is description is TBD - SetSrc(value CaptureField) CaptureEthernet - // HasSrc checks if Src has been set in CaptureEthernet - HasSrc() bool - // Dst returns CaptureField, set in CaptureEthernet. - // CaptureField is description is TBD - Dst() CaptureField - // SetDst assigns CaptureField provided by user to CaptureEthernet. - // CaptureField is description is TBD - SetDst(value CaptureField) CaptureEthernet - // HasDst checks if Dst has been set in CaptureEthernet - HasDst() bool - // EtherType returns CaptureField, set in CaptureEthernet. - // CaptureField is description is TBD - EtherType() CaptureField - // SetEtherType assigns CaptureField provided by user to CaptureEthernet. - // CaptureField is description is TBD - SetEtherType(value CaptureField) CaptureEthernet - // HasEtherType checks if EtherType has been set in CaptureEthernet - HasEtherType() bool - // PfcQueue returns CaptureField, set in CaptureEthernet. - // CaptureField is description is TBD - PfcQueue() CaptureField - // SetPfcQueue assigns CaptureField provided by user to CaptureEthernet. - // CaptureField is description is TBD - SetPfcQueue(value CaptureField) CaptureEthernet - // HasPfcQueue checks if PfcQueue has been set in CaptureEthernet - HasPfcQueue() bool - setNil() -} - -// description is TBD -// Src returns a CaptureField -func (obj *captureEthernet) Src() CaptureField { - if obj.obj.Src == nil { - obj.obj.Src = NewCaptureField().msg() - } - if obj.srcHolder == nil { - obj.srcHolder = &captureField{obj: obj.obj.Src} - } - return obj.srcHolder -} - -// description is TBD -// Src returns a CaptureField -func (obj *captureEthernet) HasSrc() bool { - return obj.obj.Src != nil -} - -// description is TBD -// SetSrc sets the CaptureField value in the CaptureEthernet object -func (obj *captureEthernet) SetSrc(value CaptureField) CaptureEthernet { - - obj.srcHolder = nil - obj.obj.Src = value.msg() - - return obj -} - -// description is TBD -// Dst returns a CaptureField -func (obj *captureEthernet) Dst() CaptureField { - if obj.obj.Dst == nil { - obj.obj.Dst = NewCaptureField().msg() - } - if obj.dstHolder == nil { - obj.dstHolder = &captureField{obj: obj.obj.Dst} - } - return obj.dstHolder -} - -// description is TBD -// Dst returns a CaptureField -func (obj *captureEthernet) HasDst() bool { - return obj.obj.Dst != nil -} - -// description is TBD -// SetDst sets the CaptureField value in the CaptureEthernet object -func (obj *captureEthernet) SetDst(value CaptureField) CaptureEthernet { - - obj.dstHolder = nil - obj.obj.Dst = value.msg() - - return obj -} - -// description is TBD -// EtherType returns a CaptureField -func (obj *captureEthernet) EtherType() CaptureField { - if obj.obj.EtherType == nil { - obj.obj.EtherType = NewCaptureField().msg() - } - if obj.etherTypeHolder == nil { - obj.etherTypeHolder = &captureField{obj: obj.obj.EtherType} - } - return obj.etherTypeHolder -} - -// description is TBD -// EtherType returns a CaptureField -func (obj *captureEthernet) HasEtherType() bool { - return obj.obj.EtherType != nil -} - -// description is TBD -// SetEtherType sets the CaptureField value in the CaptureEthernet object -func (obj *captureEthernet) SetEtherType(value CaptureField) CaptureEthernet { - - obj.etherTypeHolder = nil - obj.obj.EtherType = value.msg() - - return obj -} - -// description is TBD -// PfcQueue returns a CaptureField -func (obj *captureEthernet) PfcQueue() CaptureField { - if obj.obj.PfcQueue == nil { - obj.obj.PfcQueue = NewCaptureField().msg() - } - if obj.pfcQueueHolder == nil { - obj.pfcQueueHolder = &captureField{obj: obj.obj.PfcQueue} - } - return obj.pfcQueueHolder -} - -// description is TBD -// PfcQueue returns a CaptureField -func (obj *captureEthernet) HasPfcQueue() bool { - return obj.obj.PfcQueue != nil -} - -// description is TBD -// SetPfcQueue sets the CaptureField value in the CaptureEthernet object -func (obj *captureEthernet) SetPfcQueue(value CaptureField) CaptureEthernet { - - obj.pfcQueueHolder = nil - obj.obj.PfcQueue = value.msg() - - return obj -} - -func (obj *captureEthernet) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Src != nil { - - obj.Src().validateObj(vObj, set_default) - } - - if obj.obj.Dst != nil { - - obj.Dst().validateObj(vObj, set_default) - } - - if obj.obj.EtherType != nil { - - obj.EtherType().validateObj(vObj, set_default) - } - - if obj.obj.PfcQueue != nil { - - obj.PfcQueue().validateObj(vObj, set_default) - } - -} - -func (obj *captureEthernet) setDefault() { - -} - -// ***** CaptureVlan ***** -type captureVlan struct { - validation - obj *otg.CaptureVlan - marshaller marshalCaptureVlan - unMarshaller unMarshalCaptureVlan - priorityHolder CaptureField - cfiHolder CaptureField - idHolder CaptureField - protocolHolder CaptureField -} - -func NewCaptureVlan() CaptureVlan { - obj := captureVlan{obj: &otg.CaptureVlan{}} - obj.setDefault() - return &obj -} - -func (obj *captureVlan) msg() *otg.CaptureVlan { - return obj.obj -} - -func (obj *captureVlan) setMsg(msg *otg.CaptureVlan) CaptureVlan { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalcaptureVlan struct { - obj *captureVlan -} - -type marshalCaptureVlan interface { - // ToProto marshals CaptureVlan to protobuf object *otg.CaptureVlan - ToProto() (*otg.CaptureVlan, error) - // ToPbText marshals CaptureVlan to protobuf text - ToPbText() (string, error) - // ToYaml marshals CaptureVlan to YAML text - ToYaml() (string, error) - // ToJson marshals CaptureVlan to JSON text - ToJson() (string, error) -} - -type unMarshalcaptureVlan struct { - obj *captureVlan -} - -type unMarshalCaptureVlan interface { - // FromProto unmarshals CaptureVlan from protobuf object *otg.CaptureVlan - FromProto(msg *otg.CaptureVlan) (CaptureVlan, error) - // FromPbText unmarshals CaptureVlan from protobuf text - FromPbText(value string) error - // FromYaml unmarshals CaptureVlan from YAML text - FromYaml(value string) error - // FromJson unmarshals CaptureVlan from JSON text - FromJson(value string) error -} - -func (obj *captureVlan) Marshal() marshalCaptureVlan { - if obj.marshaller == nil { - obj.marshaller = &marshalcaptureVlan{obj: obj} - } - return obj.marshaller -} - -func (obj *captureVlan) Unmarshal() unMarshalCaptureVlan { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalcaptureVlan{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalcaptureVlan) ToProto() (*otg.CaptureVlan, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalcaptureVlan) FromProto(msg *otg.CaptureVlan) (CaptureVlan, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalcaptureVlan) 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 *unMarshalcaptureVlan) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalcaptureVlan) 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 *unMarshalcaptureVlan) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalcaptureVlan) 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 *unMarshalcaptureVlan) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *captureVlan) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *captureVlan) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *captureVlan) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *captureVlan) Clone() (CaptureVlan, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewCaptureVlan() - 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 -} - -func (obj *captureVlan) setNil() { - obj.priorityHolder = nil - obj.cfiHolder = nil - obj.idHolder = nil - obj.protocolHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// CaptureVlan is description is TBD -type CaptureVlan interface { - Validation - // msg marshals CaptureVlan to protobuf object *otg.CaptureVlan - // and doesn't set defaults - msg() *otg.CaptureVlan - // setMsg unmarshals CaptureVlan from protobuf object *otg.CaptureVlan - // and doesn't set defaults - setMsg(*otg.CaptureVlan) CaptureVlan - // provides marshal interface - Marshal() marshalCaptureVlan - // provides unmarshal interface - Unmarshal() unMarshalCaptureVlan - // validate validates CaptureVlan - validate() error - // A stringer function - String() string - // Clones the object - Clone() (CaptureVlan, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Priority returns CaptureField, set in CaptureVlan. - // CaptureField is description is TBD - Priority() CaptureField - // SetPriority assigns CaptureField provided by user to CaptureVlan. - // CaptureField is description is TBD - SetPriority(value CaptureField) CaptureVlan - // HasPriority checks if Priority has been set in CaptureVlan - HasPriority() bool - // Cfi returns CaptureField, set in CaptureVlan. - // CaptureField is description is TBD - Cfi() CaptureField - // SetCfi assigns CaptureField provided by user to CaptureVlan. - // CaptureField is description is TBD - SetCfi(value CaptureField) CaptureVlan - // HasCfi checks if Cfi has been set in CaptureVlan - HasCfi() bool - // Id returns CaptureField, set in CaptureVlan. - // CaptureField is description is TBD - Id() CaptureField - // SetId assigns CaptureField provided by user to CaptureVlan. - // CaptureField is description is TBD - SetId(value CaptureField) CaptureVlan - // HasId checks if Id has been set in CaptureVlan - HasId() bool - // Protocol returns CaptureField, set in CaptureVlan. - // CaptureField is description is TBD - Protocol() CaptureField - // SetProtocol assigns CaptureField provided by user to CaptureVlan. - // CaptureField is description is TBD - SetProtocol(value CaptureField) CaptureVlan - // HasProtocol checks if Protocol has been set in CaptureVlan - HasProtocol() bool - setNil() -} - -// description is TBD -// Priority returns a CaptureField -func (obj *captureVlan) Priority() CaptureField { - if obj.obj.Priority == nil { - obj.obj.Priority = NewCaptureField().msg() - } - if obj.priorityHolder == nil { - obj.priorityHolder = &captureField{obj: obj.obj.Priority} - } - return obj.priorityHolder -} - -// description is TBD -// Priority returns a CaptureField -func (obj *captureVlan) HasPriority() bool { - return obj.obj.Priority != nil -} - -// description is TBD -// SetPriority sets the CaptureField value in the CaptureVlan object -func (obj *captureVlan) SetPriority(value CaptureField) CaptureVlan { - - obj.priorityHolder = nil - obj.obj.Priority = value.msg() - - return obj -} - -// description is TBD -// Cfi returns a CaptureField -func (obj *captureVlan) Cfi() CaptureField { - if obj.obj.Cfi == nil { - obj.obj.Cfi = NewCaptureField().msg() - } - if obj.cfiHolder == nil { - obj.cfiHolder = &captureField{obj: obj.obj.Cfi} - } - return obj.cfiHolder -} - -// description is TBD -// Cfi returns a CaptureField -func (obj *captureVlan) HasCfi() bool { - return obj.obj.Cfi != nil -} - -// description is TBD -// SetCfi sets the CaptureField value in the CaptureVlan object -func (obj *captureVlan) SetCfi(value CaptureField) CaptureVlan { - - obj.cfiHolder = nil - obj.obj.Cfi = value.msg() - - return obj -} - -// description is TBD -// Id returns a CaptureField -func (obj *captureVlan) Id() CaptureField { - if obj.obj.Id == nil { - obj.obj.Id = NewCaptureField().msg() - } - if obj.idHolder == nil { - obj.idHolder = &captureField{obj: obj.obj.Id} - } - return obj.idHolder -} - -// description is TBD -// Id returns a CaptureField -func (obj *captureVlan) HasId() bool { - return obj.obj.Id != nil -} - -// description is TBD -// SetId sets the CaptureField value in the CaptureVlan object -func (obj *captureVlan) SetId(value CaptureField) CaptureVlan { - - obj.idHolder = nil - obj.obj.Id = value.msg() - - return obj -} - -// description is TBD -// Protocol returns a CaptureField -func (obj *captureVlan) Protocol() CaptureField { - if obj.obj.Protocol == nil { - obj.obj.Protocol = NewCaptureField().msg() - } - if obj.protocolHolder == nil { - obj.protocolHolder = &captureField{obj: obj.obj.Protocol} - } - return obj.protocolHolder -} - -// description is TBD -// Protocol returns a CaptureField -func (obj *captureVlan) HasProtocol() bool { - return obj.obj.Protocol != nil -} - -// description is TBD -// SetProtocol sets the CaptureField value in the CaptureVlan object -func (obj *captureVlan) SetProtocol(value CaptureField) CaptureVlan { - - obj.protocolHolder = nil - obj.obj.Protocol = value.msg() - - return obj -} - -func (obj *captureVlan) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Priority != nil { - - obj.Priority().validateObj(vObj, set_default) - } - - if obj.obj.Cfi != nil { - - obj.Cfi().validateObj(vObj, set_default) - } - - if obj.obj.Id != nil { - - obj.Id().validateObj(vObj, set_default) - } - - if obj.obj.Protocol != nil { - - obj.Protocol().validateObj(vObj, set_default) - } - -} - -func (obj *captureVlan) setDefault() { - -} - -// ***** CaptureIpv4 ***** -type captureIpv4 struct { - validation - obj *otg.CaptureIpv4 - marshaller marshalCaptureIpv4 - unMarshaller unMarshalCaptureIpv4 - versionHolder CaptureField - headerLengthHolder CaptureField - priorityHolder CaptureField - totalLengthHolder CaptureField - identificationHolder CaptureField - reservedHolder CaptureField - dontFragmentHolder CaptureField - moreFragmentsHolder CaptureField - fragmentOffsetHolder CaptureField - timeToLiveHolder CaptureField - protocolHolder CaptureField - headerChecksumHolder CaptureField - srcHolder CaptureField - dstHolder CaptureField -} - -func NewCaptureIpv4() CaptureIpv4 { - obj := captureIpv4{obj: &otg.CaptureIpv4{}} - obj.setDefault() - return &obj -} - -func (obj *captureIpv4) msg() *otg.CaptureIpv4 { - return obj.obj -} - -func (obj *captureIpv4) setMsg(msg *otg.CaptureIpv4) CaptureIpv4 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalcaptureIpv4 struct { - obj *captureIpv4 -} - -type marshalCaptureIpv4 interface { - // ToProto marshals CaptureIpv4 to protobuf object *otg.CaptureIpv4 - ToProto() (*otg.CaptureIpv4, error) - // ToPbText marshals CaptureIpv4 to protobuf text - ToPbText() (string, error) - // ToYaml marshals CaptureIpv4 to YAML text - ToYaml() (string, error) - // ToJson marshals CaptureIpv4 to JSON text - ToJson() (string, error) -} - -type unMarshalcaptureIpv4 struct { - obj *captureIpv4 -} - -type unMarshalCaptureIpv4 interface { - // FromProto unmarshals CaptureIpv4 from protobuf object *otg.CaptureIpv4 - FromProto(msg *otg.CaptureIpv4) (CaptureIpv4, error) - // FromPbText unmarshals CaptureIpv4 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals CaptureIpv4 from YAML text - FromYaml(value string) error - // FromJson unmarshals CaptureIpv4 from JSON text - FromJson(value string) error -} - -func (obj *captureIpv4) Marshal() marshalCaptureIpv4 { - if obj.marshaller == nil { - obj.marshaller = &marshalcaptureIpv4{obj: obj} - } - return obj.marshaller -} - -func (obj *captureIpv4) Unmarshal() unMarshalCaptureIpv4 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalcaptureIpv4{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalcaptureIpv4) ToProto() (*otg.CaptureIpv4, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalcaptureIpv4) FromProto(msg *otg.CaptureIpv4) (CaptureIpv4, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalcaptureIpv4) 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 *unMarshalcaptureIpv4) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalcaptureIpv4) 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 *unMarshalcaptureIpv4) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalcaptureIpv4) 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 *unMarshalcaptureIpv4) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *captureIpv4) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *captureIpv4) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *captureIpv4) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *captureIpv4) Clone() (CaptureIpv4, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewCaptureIpv4() - 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 -} - -func (obj *captureIpv4) setNil() { - obj.versionHolder = nil - obj.headerLengthHolder = nil - obj.priorityHolder = nil - obj.totalLengthHolder = nil - obj.identificationHolder = nil - obj.reservedHolder = nil - obj.dontFragmentHolder = nil - obj.moreFragmentsHolder = nil - obj.fragmentOffsetHolder = nil - obj.timeToLiveHolder = nil - obj.protocolHolder = nil - obj.headerChecksumHolder = nil - obj.srcHolder = nil - obj.dstHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// CaptureIpv4 is description is TBD -type CaptureIpv4 interface { - Validation - // msg marshals CaptureIpv4 to protobuf object *otg.CaptureIpv4 - // and doesn't set defaults - msg() *otg.CaptureIpv4 - // setMsg unmarshals CaptureIpv4 from protobuf object *otg.CaptureIpv4 - // and doesn't set defaults - setMsg(*otg.CaptureIpv4) CaptureIpv4 - // provides marshal interface - Marshal() marshalCaptureIpv4 - // provides unmarshal interface - Unmarshal() unMarshalCaptureIpv4 - // validate validates CaptureIpv4 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (CaptureIpv4, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Version returns CaptureField, set in CaptureIpv4. - // CaptureField is description is TBD - Version() CaptureField - // SetVersion assigns CaptureField provided by user to CaptureIpv4. - // CaptureField is description is TBD - SetVersion(value CaptureField) CaptureIpv4 - // HasVersion checks if Version has been set in CaptureIpv4 - HasVersion() bool - // HeaderLength returns CaptureField, set in CaptureIpv4. - // CaptureField is description is TBD - HeaderLength() CaptureField - // SetHeaderLength assigns CaptureField provided by user to CaptureIpv4. - // CaptureField is description is TBD - SetHeaderLength(value CaptureField) CaptureIpv4 - // HasHeaderLength checks if HeaderLength has been set in CaptureIpv4 - HasHeaderLength() bool - // Priority returns CaptureField, set in CaptureIpv4. - // CaptureField is description is TBD - Priority() CaptureField - // SetPriority assigns CaptureField provided by user to CaptureIpv4. - // CaptureField is description is TBD - SetPriority(value CaptureField) CaptureIpv4 - // HasPriority checks if Priority has been set in CaptureIpv4 - HasPriority() bool - // TotalLength returns CaptureField, set in CaptureIpv4. - // CaptureField is description is TBD - TotalLength() CaptureField - // SetTotalLength assigns CaptureField provided by user to CaptureIpv4. - // CaptureField is description is TBD - SetTotalLength(value CaptureField) CaptureIpv4 - // HasTotalLength checks if TotalLength has been set in CaptureIpv4 - HasTotalLength() bool - // Identification returns CaptureField, set in CaptureIpv4. - // CaptureField is description is TBD - Identification() CaptureField - // SetIdentification assigns CaptureField provided by user to CaptureIpv4. - // CaptureField is description is TBD - SetIdentification(value CaptureField) CaptureIpv4 - // HasIdentification checks if Identification has been set in CaptureIpv4 - HasIdentification() bool - // Reserved returns CaptureField, set in CaptureIpv4. - // CaptureField is description is TBD - Reserved() CaptureField - // SetReserved assigns CaptureField provided by user to CaptureIpv4. - // CaptureField is description is TBD - SetReserved(value CaptureField) CaptureIpv4 - // HasReserved checks if Reserved has been set in CaptureIpv4 - HasReserved() bool - // DontFragment returns CaptureField, set in CaptureIpv4. - // CaptureField is description is TBD - DontFragment() CaptureField - // SetDontFragment assigns CaptureField provided by user to CaptureIpv4. - // CaptureField is description is TBD - SetDontFragment(value CaptureField) CaptureIpv4 - // HasDontFragment checks if DontFragment has been set in CaptureIpv4 - HasDontFragment() bool - // MoreFragments returns CaptureField, set in CaptureIpv4. - // CaptureField is description is TBD - MoreFragments() CaptureField - // SetMoreFragments assigns CaptureField provided by user to CaptureIpv4. - // CaptureField is description is TBD - SetMoreFragments(value CaptureField) CaptureIpv4 - // HasMoreFragments checks if MoreFragments has been set in CaptureIpv4 - HasMoreFragments() bool - // FragmentOffset returns CaptureField, set in CaptureIpv4. - // CaptureField is description is TBD - FragmentOffset() CaptureField - // SetFragmentOffset assigns CaptureField provided by user to CaptureIpv4. - // CaptureField is description is TBD - SetFragmentOffset(value CaptureField) CaptureIpv4 - // HasFragmentOffset checks if FragmentOffset has been set in CaptureIpv4 - HasFragmentOffset() bool - // TimeToLive returns CaptureField, set in CaptureIpv4. - // CaptureField is description is TBD - TimeToLive() CaptureField - // SetTimeToLive assigns CaptureField provided by user to CaptureIpv4. - // CaptureField is description is TBD - SetTimeToLive(value CaptureField) CaptureIpv4 - // HasTimeToLive checks if TimeToLive has been set in CaptureIpv4 - HasTimeToLive() bool - // Protocol returns CaptureField, set in CaptureIpv4. - // CaptureField is description is TBD - Protocol() CaptureField - // SetProtocol assigns CaptureField provided by user to CaptureIpv4. - // CaptureField is description is TBD - SetProtocol(value CaptureField) CaptureIpv4 - // HasProtocol checks if Protocol has been set in CaptureIpv4 - HasProtocol() bool - // HeaderChecksum returns CaptureField, set in CaptureIpv4. - // CaptureField is description is TBD - HeaderChecksum() CaptureField - // SetHeaderChecksum assigns CaptureField provided by user to CaptureIpv4. - // CaptureField is description is TBD - SetHeaderChecksum(value CaptureField) CaptureIpv4 - // HasHeaderChecksum checks if HeaderChecksum has been set in CaptureIpv4 - HasHeaderChecksum() bool - // Src returns CaptureField, set in CaptureIpv4. - // CaptureField is description is TBD - Src() CaptureField - // SetSrc assigns CaptureField provided by user to CaptureIpv4. - // CaptureField is description is TBD - SetSrc(value CaptureField) CaptureIpv4 - // HasSrc checks if Src has been set in CaptureIpv4 - HasSrc() bool - // Dst returns CaptureField, set in CaptureIpv4. - // CaptureField is description is TBD - Dst() CaptureField - // SetDst assigns CaptureField provided by user to CaptureIpv4. - // CaptureField is description is TBD - SetDst(value CaptureField) CaptureIpv4 - // HasDst checks if Dst has been set in CaptureIpv4 - HasDst() bool - setNil() -} - -// description is TBD -// Version returns a CaptureField -func (obj *captureIpv4) Version() CaptureField { - if obj.obj.Version == nil { - obj.obj.Version = NewCaptureField().msg() - } - if obj.versionHolder == nil { - obj.versionHolder = &captureField{obj: obj.obj.Version} - } - return obj.versionHolder -} - -// description is TBD -// Version returns a CaptureField -func (obj *captureIpv4) HasVersion() bool { - return obj.obj.Version != nil -} - -// description is TBD -// SetVersion sets the CaptureField value in the CaptureIpv4 object -func (obj *captureIpv4) SetVersion(value CaptureField) CaptureIpv4 { - - obj.versionHolder = nil - obj.obj.Version = value.msg() - - return obj -} - -// description is TBD -// HeaderLength returns a CaptureField -func (obj *captureIpv4) HeaderLength() CaptureField { - if obj.obj.HeaderLength == nil { - obj.obj.HeaderLength = NewCaptureField().msg() - } - if obj.headerLengthHolder == nil { - obj.headerLengthHolder = &captureField{obj: obj.obj.HeaderLength} - } - return obj.headerLengthHolder -} - -// description is TBD -// HeaderLength returns a CaptureField -func (obj *captureIpv4) HasHeaderLength() bool { - return obj.obj.HeaderLength != nil -} - -// description is TBD -// SetHeaderLength sets the CaptureField value in the CaptureIpv4 object -func (obj *captureIpv4) SetHeaderLength(value CaptureField) CaptureIpv4 { - - obj.headerLengthHolder = nil - obj.obj.HeaderLength = value.msg() - - return obj -} - -// description is TBD -// Priority returns a CaptureField -func (obj *captureIpv4) Priority() CaptureField { - if obj.obj.Priority == nil { - obj.obj.Priority = NewCaptureField().msg() - } - if obj.priorityHolder == nil { - obj.priorityHolder = &captureField{obj: obj.obj.Priority} - } - return obj.priorityHolder -} - -// description is TBD -// Priority returns a CaptureField -func (obj *captureIpv4) HasPriority() bool { - return obj.obj.Priority != nil -} - -// description is TBD -// SetPriority sets the CaptureField value in the CaptureIpv4 object -func (obj *captureIpv4) SetPriority(value CaptureField) CaptureIpv4 { - - obj.priorityHolder = nil - obj.obj.Priority = value.msg() - - return obj -} - -// description is TBD -// TotalLength returns a CaptureField -func (obj *captureIpv4) TotalLength() CaptureField { - if obj.obj.TotalLength == nil { - obj.obj.TotalLength = NewCaptureField().msg() - } - if obj.totalLengthHolder == nil { - obj.totalLengthHolder = &captureField{obj: obj.obj.TotalLength} - } - return obj.totalLengthHolder -} - -// description is TBD -// TotalLength returns a CaptureField -func (obj *captureIpv4) HasTotalLength() bool { - return obj.obj.TotalLength != nil -} - -// description is TBD -// SetTotalLength sets the CaptureField value in the CaptureIpv4 object -func (obj *captureIpv4) SetTotalLength(value CaptureField) CaptureIpv4 { - - obj.totalLengthHolder = nil - obj.obj.TotalLength = value.msg() - - return obj -} - -// description is TBD -// Identification returns a CaptureField -func (obj *captureIpv4) Identification() CaptureField { - if obj.obj.Identification == nil { - obj.obj.Identification = NewCaptureField().msg() - } - if obj.identificationHolder == nil { - obj.identificationHolder = &captureField{obj: obj.obj.Identification} - } - return obj.identificationHolder -} - -// description is TBD -// Identification returns a CaptureField -func (obj *captureIpv4) HasIdentification() bool { - return obj.obj.Identification != nil -} - -// description is TBD -// SetIdentification sets the CaptureField value in the CaptureIpv4 object -func (obj *captureIpv4) SetIdentification(value CaptureField) CaptureIpv4 { - - obj.identificationHolder = nil - obj.obj.Identification = value.msg() - - return obj -} - -// description is TBD -// Reserved returns a CaptureField -func (obj *captureIpv4) Reserved() CaptureField { - if obj.obj.Reserved == nil { - obj.obj.Reserved = NewCaptureField().msg() - } - if obj.reservedHolder == nil { - obj.reservedHolder = &captureField{obj: obj.obj.Reserved} - } - return obj.reservedHolder -} - -// description is TBD -// Reserved returns a CaptureField -func (obj *captureIpv4) HasReserved() bool { - return obj.obj.Reserved != nil -} - -// description is TBD -// SetReserved sets the CaptureField value in the CaptureIpv4 object -func (obj *captureIpv4) SetReserved(value CaptureField) CaptureIpv4 { - - obj.reservedHolder = nil - obj.obj.Reserved = value.msg() - - return obj -} - -// description is TBD -// DontFragment returns a CaptureField -func (obj *captureIpv4) DontFragment() CaptureField { - if obj.obj.DontFragment == nil { - obj.obj.DontFragment = NewCaptureField().msg() - } - if obj.dontFragmentHolder == nil { - obj.dontFragmentHolder = &captureField{obj: obj.obj.DontFragment} - } - return obj.dontFragmentHolder -} - -// description is TBD -// DontFragment returns a CaptureField -func (obj *captureIpv4) HasDontFragment() bool { - return obj.obj.DontFragment != nil -} - -// description is TBD -// SetDontFragment sets the CaptureField value in the CaptureIpv4 object -func (obj *captureIpv4) SetDontFragment(value CaptureField) CaptureIpv4 { - - obj.dontFragmentHolder = nil - obj.obj.DontFragment = value.msg() - - return obj -} - -// description is TBD -// MoreFragments returns a CaptureField -func (obj *captureIpv4) MoreFragments() CaptureField { - if obj.obj.MoreFragments == nil { - obj.obj.MoreFragments = NewCaptureField().msg() - } - if obj.moreFragmentsHolder == nil { - obj.moreFragmentsHolder = &captureField{obj: obj.obj.MoreFragments} - } - return obj.moreFragmentsHolder -} - -// description is TBD -// MoreFragments returns a CaptureField -func (obj *captureIpv4) HasMoreFragments() bool { - return obj.obj.MoreFragments != nil -} - -// description is TBD -// SetMoreFragments sets the CaptureField value in the CaptureIpv4 object -func (obj *captureIpv4) SetMoreFragments(value CaptureField) CaptureIpv4 { - - obj.moreFragmentsHolder = nil - obj.obj.MoreFragments = value.msg() - - return obj -} - -// description is TBD -// FragmentOffset returns a CaptureField -func (obj *captureIpv4) FragmentOffset() CaptureField { - if obj.obj.FragmentOffset == nil { - obj.obj.FragmentOffset = NewCaptureField().msg() - } - if obj.fragmentOffsetHolder == nil { - obj.fragmentOffsetHolder = &captureField{obj: obj.obj.FragmentOffset} - } - return obj.fragmentOffsetHolder -} - -// description is TBD -// FragmentOffset returns a CaptureField -func (obj *captureIpv4) HasFragmentOffset() bool { - return obj.obj.FragmentOffset != nil -} - -// description is TBD -// SetFragmentOffset sets the CaptureField value in the CaptureIpv4 object -func (obj *captureIpv4) SetFragmentOffset(value CaptureField) CaptureIpv4 { - - obj.fragmentOffsetHolder = nil - obj.obj.FragmentOffset = value.msg() - - return obj -} - -// description is TBD -// TimeToLive returns a CaptureField -func (obj *captureIpv4) TimeToLive() CaptureField { - if obj.obj.TimeToLive == nil { - obj.obj.TimeToLive = NewCaptureField().msg() - } - if obj.timeToLiveHolder == nil { - obj.timeToLiveHolder = &captureField{obj: obj.obj.TimeToLive} - } - return obj.timeToLiveHolder -} - -// description is TBD -// TimeToLive returns a CaptureField -func (obj *captureIpv4) HasTimeToLive() bool { - return obj.obj.TimeToLive != nil -} - -// description is TBD -// SetTimeToLive sets the CaptureField value in the CaptureIpv4 object -func (obj *captureIpv4) SetTimeToLive(value CaptureField) CaptureIpv4 { - - obj.timeToLiveHolder = nil - obj.obj.TimeToLive = value.msg() - - return obj -} - -// description is TBD -// Protocol returns a CaptureField -func (obj *captureIpv4) Protocol() CaptureField { - if obj.obj.Protocol == nil { - obj.obj.Protocol = NewCaptureField().msg() - } - if obj.protocolHolder == nil { - obj.protocolHolder = &captureField{obj: obj.obj.Protocol} - } - return obj.protocolHolder -} - -// description is TBD -// Protocol returns a CaptureField -func (obj *captureIpv4) HasProtocol() bool { - return obj.obj.Protocol != nil -} - -// description is TBD -// SetProtocol sets the CaptureField value in the CaptureIpv4 object -func (obj *captureIpv4) SetProtocol(value CaptureField) CaptureIpv4 { - - obj.protocolHolder = nil - obj.obj.Protocol = value.msg() - - return obj -} - -// description is TBD -// HeaderChecksum returns a CaptureField -func (obj *captureIpv4) HeaderChecksum() CaptureField { - if obj.obj.HeaderChecksum == nil { - obj.obj.HeaderChecksum = NewCaptureField().msg() - } - if obj.headerChecksumHolder == nil { - obj.headerChecksumHolder = &captureField{obj: obj.obj.HeaderChecksum} - } - return obj.headerChecksumHolder -} - -// description is TBD -// HeaderChecksum returns a CaptureField -func (obj *captureIpv4) HasHeaderChecksum() bool { - return obj.obj.HeaderChecksum != nil -} - -// description is TBD -// SetHeaderChecksum sets the CaptureField value in the CaptureIpv4 object -func (obj *captureIpv4) SetHeaderChecksum(value CaptureField) CaptureIpv4 { - - obj.headerChecksumHolder = nil - obj.obj.HeaderChecksum = value.msg() - - return obj -} - -// description is TBD -// Src returns a CaptureField -func (obj *captureIpv4) Src() CaptureField { - if obj.obj.Src == nil { - obj.obj.Src = NewCaptureField().msg() - } - if obj.srcHolder == nil { - obj.srcHolder = &captureField{obj: obj.obj.Src} - } - return obj.srcHolder -} - -// description is TBD -// Src returns a CaptureField -func (obj *captureIpv4) HasSrc() bool { - return obj.obj.Src != nil -} - -// description is TBD -// SetSrc sets the CaptureField value in the CaptureIpv4 object -func (obj *captureIpv4) SetSrc(value CaptureField) CaptureIpv4 { - - obj.srcHolder = nil - obj.obj.Src = value.msg() - - return obj -} - -// description is TBD -// Dst returns a CaptureField -func (obj *captureIpv4) Dst() CaptureField { - if obj.obj.Dst == nil { - obj.obj.Dst = NewCaptureField().msg() - } - if obj.dstHolder == nil { - obj.dstHolder = &captureField{obj: obj.obj.Dst} - } - return obj.dstHolder -} - -// description is TBD -// Dst returns a CaptureField -func (obj *captureIpv4) HasDst() bool { - return obj.obj.Dst != nil -} - -// description is TBD -// SetDst sets the CaptureField value in the CaptureIpv4 object -func (obj *captureIpv4) SetDst(value CaptureField) CaptureIpv4 { - - obj.dstHolder = nil - obj.obj.Dst = value.msg() - - return obj -} - -func (obj *captureIpv4) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Version != nil { - - obj.Version().validateObj(vObj, set_default) - } - - if obj.obj.HeaderLength != nil { - - obj.HeaderLength().validateObj(vObj, set_default) - } - - if obj.obj.Priority != nil { - - obj.Priority().validateObj(vObj, set_default) - } - - if obj.obj.TotalLength != nil { - - obj.TotalLength().validateObj(vObj, set_default) - } - - if obj.obj.Identification != nil { - - obj.Identification().validateObj(vObj, set_default) - } - - if obj.obj.Reserved != nil { - - obj.Reserved().validateObj(vObj, set_default) - } - - if obj.obj.DontFragment != nil { - - obj.DontFragment().validateObj(vObj, set_default) - } - - if obj.obj.MoreFragments != nil { - - obj.MoreFragments().validateObj(vObj, set_default) - } - - if obj.obj.FragmentOffset != nil { - - obj.FragmentOffset().validateObj(vObj, set_default) - } - - if obj.obj.TimeToLive != nil { - - obj.TimeToLive().validateObj(vObj, set_default) - } - - if obj.obj.Protocol != nil { - - obj.Protocol().validateObj(vObj, set_default) - } - - if obj.obj.HeaderChecksum != nil { - - obj.HeaderChecksum().validateObj(vObj, set_default) - } - - if obj.obj.Src != nil { - - obj.Src().validateObj(vObj, set_default) - } - - if obj.obj.Dst != nil { - - obj.Dst().validateObj(vObj, set_default) - } - -} - -func (obj *captureIpv4) setDefault() { - -} - -// ***** CaptureIpv6 ***** -type captureIpv6 struct { - validation - obj *otg.CaptureIpv6 - marshaller marshalCaptureIpv6 - unMarshaller unMarshalCaptureIpv6 - versionHolder CaptureField - trafficClassHolder CaptureField - flowLabelHolder CaptureField - payloadLengthHolder CaptureField - nextHeaderHolder CaptureField - hopLimitHolder CaptureField - srcHolder CaptureField - dstHolder CaptureField -} - -func NewCaptureIpv6() CaptureIpv6 { - obj := captureIpv6{obj: &otg.CaptureIpv6{}} - obj.setDefault() - return &obj -} - -func (obj *captureIpv6) msg() *otg.CaptureIpv6 { - return obj.obj -} - -func (obj *captureIpv6) setMsg(msg *otg.CaptureIpv6) CaptureIpv6 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalcaptureIpv6 struct { - obj *captureIpv6 -} - -type marshalCaptureIpv6 interface { - // ToProto marshals CaptureIpv6 to protobuf object *otg.CaptureIpv6 - ToProto() (*otg.CaptureIpv6, error) - // ToPbText marshals CaptureIpv6 to protobuf text - ToPbText() (string, error) - // ToYaml marshals CaptureIpv6 to YAML text - ToYaml() (string, error) - // ToJson marshals CaptureIpv6 to JSON text - ToJson() (string, error) -} - -type unMarshalcaptureIpv6 struct { - obj *captureIpv6 -} - -type unMarshalCaptureIpv6 interface { - // FromProto unmarshals CaptureIpv6 from protobuf object *otg.CaptureIpv6 - FromProto(msg *otg.CaptureIpv6) (CaptureIpv6, error) - // FromPbText unmarshals CaptureIpv6 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals CaptureIpv6 from YAML text - FromYaml(value string) error - // FromJson unmarshals CaptureIpv6 from JSON text - FromJson(value string) error -} - -func (obj *captureIpv6) Marshal() marshalCaptureIpv6 { - if obj.marshaller == nil { - obj.marshaller = &marshalcaptureIpv6{obj: obj} - } - return obj.marshaller -} - -func (obj *captureIpv6) Unmarshal() unMarshalCaptureIpv6 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalcaptureIpv6{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalcaptureIpv6) ToProto() (*otg.CaptureIpv6, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalcaptureIpv6) FromProto(msg *otg.CaptureIpv6) (CaptureIpv6, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalcaptureIpv6) 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 *unMarshalcaptureIpv6) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalcaptureIpv6) 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 *unMarshalcaptureIpv6) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalcaptureIpv6) 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 *unMarshalcaptureIpv6) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *captureIpv6) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *captureIpv6) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *captureIpv6) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *captureIpv6) Clone() (CaptureIpv6, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewCaptureIpv6() - 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 -} - -func (obj *captureIpv6) setNil() { - obj.versionHolder = nil - obj.trafficClassHolder = nil - obj.flowLabelHolder = nil - obj.payloadLengthHolder = nil - obj.nextHeaderHolder = nil - obj.hopLimitHolder = nil - obj.srcHolder = nil - obj.dstHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// CaptureIpv6 is description is TBD -type CaptureIpv6 interface { - Validation - // msg marshals CaptureIpv6 to protobuf object *otg.CaptureIpv6 - // and doesn't set defaults - msg() *otg.CaptureIpv6 - // setMsg unmarshals CaptureIpv6 from protobuf object *otg.CaptureIpv6 - // and doesn't set defaults - setMsg(*otg.CaptureIpv6) CaptureIpv6 - // provides marshal interface - Marshal() marshalCaptureIpv6 - // provides unmarshal interface - Unmarshal() unMarshalCaptureIpv6 - // validate validates CaptureIpv6 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (CaptureIpv6, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Version returns CaptureField, set in CaptureIpv6. - // CaptureField is description is TBD - Version() CaptureField - // SetVersion assigns CaptureField provided by user to CaptureIpv6. - // CaptureField is description is TBD - SetVersion(value CaptureField) CaptureIpv6 - // HasVersion checks if Version has been set in CaptureIpv6 - HasVersion() bool - // TrafficClass returns CaptureField, set in CaptureIpv6. - // CaptureField is description is TBD - TrafficClass() CaptureField - // SetTrafficClass assigns CaptureField provided by user to CaptureIpv6. - // CaptureField is description is TBD - SetTrafficClass(value CaptureField) CaptureIpv6 - // HasTrafficClass checks if TrafficClass has been set in CaptureIpv6 - HasTrafficClass() bool - // FlowLabel returns CaptureField, set in CaptureIpv6. - // CaptureField is description is TBD - FlowLabel() CaptureField - // SetFlowLabel assigns CaptureField provided by user to CaptureIpv6. - // CaptureField is description is TBD - SetFlowLabel(value CaptureField) CaptureIpv6 - // HasFlowLabel checks if FlowLabel has been set in CaptureIpv6 - HasFlowLabel() bool - // PayloadLength returns CaptureField, set in CaptureIpv6. - // CaptureField is description is TBD - PayloadLength() CaptureField - // SetPayloadLength assigns CaptureField provided by user to CaptureIpv6. - // CaptureField is description is TBD - SetPayloadLength(value CaptureField) CaptureIpv6 - // HasPayloadLength checks if PayloadLength has been set in CaptureIpv6 - HasPayloadLength() bool - // NextHeader returns CaptureField, set in CaptureIpv6. - // CaptureField is description is TBD - NextHeader() CaptureField - // SetNextHeader assigns CaptureField provided by user to CaptureIpv6. - // CaptureField is description is TBD - SetNextHeader(value CaptureField) CaptureIpv6 - // HasNextHeader checks if NextHeader has been set in CaptureIpv6 - HasNextHeader() bool - // HopLimit returns CaptureField, set in CaptureIpv6. - // CaptureField is description is TBD - HopLimit() CaptureField - // SetHopLimit assigns CaptureField provided by user to CaptureIpv6. - // CaptureField is description is TBD - SetHopLimit(value CaptureField) CaptureIpv6 - // HasHopLimit checks if HopLimit has been set in CaptureIpv6 - HasHopLimit() bool - // Src returns CaptureField, set in CaptureIpv6. - // CaptureField is description is TBD - Src() CaptureField - // SetSrc assigns CaptureField provided by user to CaptureIpv6. - // CaptureField is description is TBD - SetSrc(value CaptureField) CaptureIpv6 - // HasSrc checks if Src has been set in CaptureIpv6 - HasSrc() bool - // Dst returns CaptureField, set in CaptureIpv6. - // CaptureField is description is TBD - Dst() CaptureField - // SetDst assigns CaptureField provided by user to CaptureIpv6. - // CaptureField is description is TBD - SetDst(value CaptureField) CaptureIpv6 - // HasDst checks if Dst has been set in CaptureIpv6 - HasDst() bool - setNil() -} - -// description is TBD -// Version returns a CaptureField -func (obj *captureIpv6) Version() CaptureField { - if obj.obj.Version == nil { - obj.obj.Version = NewCaptureField().msg() - } - if obj.versionHolder == nil { - obj.versionHolder = &captureField{obj: obj.obj.Version} - } - return obj.versionHolder -} - -// description is TBD -// Version returns a CaptureField -func (obj *captureIpv6) HasVersion() bool { - return obj.obj.Version != nil -} - -// description is TBD -// SetVersion sets the CaptureField value in the CaptureIpv6 object -func (obj *captureIpv6) SetVersion(value CaptureField) CaptureIpv6 { - - obj.versionHolder = nil - obj.obj.Version = value.msg() - - return obj -} - -// description is TBD -// TrafficClass returns a CaptureField -func (obj *captureIpv6) TrafficClass() CaptureField { - if obj.obj.TrafficClass == nil { - obj.obj.TrafficClass = NewCaptureField().msg() - } - if obj.trafficClassHolder == nil { - obj.trafficClassHolder = &captureField{obj: obj.obj.TrafficClass} - } - return obj.trafficClassHolder -} - -// description is TBD -// TrafficClass returns a CaptureField -func (obj *captureIpv6) HasTrafficClass() bool { - return obj.obj.TrafficClass != nil -} - -// description is TBD -// SetTrafficClass sets the CaptureField value in the CaptureIpv6 object -func (obj *captureIpv6) SetTrafficClass(value CaptureField) CaptureIpv6 { - - obj.trafficClassHolder = nil - obj.obj.TrafficClass = value.msg() - - return obj -} - -// description is TBD -// FlowLabel returns a CaptureField -func (obj *captureIpv6) FlowLabel() CaptureField { - if obj.obj.FlowLabel == nil { - obj.obj.FlowLabel = NewCaptureField().msg() - } - if obj.flowLabelHolder == nil { - obj.flowLabelHolder = &captureField{obj: obj.obj.FlowLabel} - } - return obj.flowLabelHolder -} - -// description is TBD -// FlowLabel returns a CaptureField -func (obj *captureIpv6) HasFlowLabel() bool { - return obj.obj.FlowLabel != nil -} - -// description is TBD -// SetFlowLabel sets the CaptureField value in the CaptureIpv6 object -func (obj *captureIpv6) SetFlowLabel(value CaptureField) CaptureIpv6 { - - obj.flowLabelHolder = nil - obj.obj.FlowLabel = value.msg() - - return obj -} - -// description is TBD -// PayloadLength returns a CaptureField -func (obj *captureIpv6) PayloadLength() CaptureField { - if obj.obj.PayloadLength == nil { - obj.obj.PayloadLength = NewCaptureField().msg() - } - if obj.payloadLengthHolder == nil { - obj.payloadLengthHolder = &captureField{obj: obj.obj.PayloadLength} - } - return obj.payloadLengthHolder -} - -// description is TBD -// PayloadLength returns a CaptureField -func (obj *captureIpv6) HasPayloadLength() bool { - return obj.obj.PayloadLength != nil -} - -// description is TBD -// SetPayloadLength sets the CaptureField value in the CaptureIpv6 object -func (obj *captureIpv6) SetPayloadLength(value CaptureField) CaptureIpv6 { - - obj.payloadLengthHolder = nil - obj.obj.PayloadLength = value.msg() - - return obj -} - -// description is TBD -// NextHeader returns a CaptureField -func (obj *captureIpv6) NextHeader() CaptureField { - if obj.obj.NextHeader == nil { - obj.obj.NextHeader = NewCaptureField().msg() - } - if obj.nextHeaderHolder == nil { - obj.nextHeaderHolder = &captureField{obj: obj.obj.NextHeader} - } - return obj.nextHeaderHolder -} - -// description is TBD -// NextHeader returns a CaptureField -func (obj *captureIpv6) HasNextHeader() bool { - return obj.obj.NextHeader != nil -} - -// description is TBD -// SetNextHeader sets the CaptureField value in the CaptureIpv6 object -func (obj *captureIpv6) SetNextHeader(value CaptureField) CaptureIpv6 { - - obj.nextHeaderHolder = nil - obj.obj.NextHeader = value.msg() - - return obj -} - -// description is TBD -// HopLimit returns a CaptureField -func (obj *captureIpv6) HopLimit() CaptureField { - if obj.obj.HopLimit == nil { - obj.obj.HopLimit = NewCaptureField().msg() - } - if obj.hopLimitHolder == nil { - obj.hopLimitHolder = &captureField{obj: obj.obj.HopLimit} - } - return obj.hopLimitHolder -} - -// description is TBD -// HopLimit returns a CaptureField -func (obj *captureIpv6) HasHopLimit() bool { - return obj.obj.HopLimit != nil -} - -// description is TBD -// SetHopLimit sets the CaptureField value in the CaptureIpv6 object -func (obj *captureIpv6) SetHopLimit(value CaptureField) CaptureIpv6 { - - obj.hopLimitHolder = nil - obj.obj.HopLimit = value.msg() - - return obj -} - -// description is TBD -// Src returns a CaptureField -func (obj *captureIpv6) Src() CaptureField { - if obj.obj.Src == nil { - obj.obj.Src = NewCaptureField().msg() - } - if obj.srcHolder == nil { - obj.srcHolder = &captureField{obj: obj.obj.Src} - } - return obj.srcHolder -} - -// description is TBD -// Src returns a CaptureField -func (obj *captureIpv6) HasSrc() bool { - return obj.obj.Src != nil -} - -// description is TBD -// SetSrc sets the CaptureField value in the CaptureIpv6 object -func (obj *captureIpv6) SetSrc(value CaptureField) CaptureIpv6 { - - obj.srcHolder = nil - obj.obj.Src = value.msg() - - return obj -} - -// description is TBD -// Dst returns a CaptureField -func (obj *captureIpv6) Dst() CaptureField { - if obj.obj.Dst == nil { - obj.obj.Dst = NewCaptureField().msg() - } - if obj.dstHolder == nil { - obj.dstHolder = &captureField{obj: obj.obj.Dst} - } - return obj.dstHolder -} - -// description is TBD -// Dst returns a CaptureField -func (obj *captureIpv6) HasDst() bool { - return obj.obj.Dst != nil -} - -// description is TBD -// SetDst sets the CaptureField value in the CaptureIpv6 object -func (obj *captureIpv6) SetDst(value CaptureField) CaptureIpv6 { - - obj.dstHolder = nil - obj.obj.Dst = value.msg() - - return obj -} - -func (obj *captureIpv6) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Version != nil { - - obj.Version().validateObj(vObj, set_default) - } - - if obj.obj.TrafficClass != nil { - - obj.TrafficClass().validateObj(vObj, set_default) - } - - if obj.obj.FlowLabel != nil { - - obj.FlowLabel().validateObj(vObj, set_default) - } - - if obj.obj.PayloadLength != nil { - - obj.PayloadLength().validateObj(vObj, set_default) - } - - if obj.obj.NextHeader != nil { - - obj.NextHeader().validateObj(vObj, set_default) - } - - if obj.obj.HopLimit != nil { - - obj.HopLimit().validateObj(vObj, set_default) - } - - if obj.obj.Src != nil { - - obj.Src().validateObj(vObj, set_default) - } - - if obj.obj.Dst != nil { - - obj.Dst().validateObj(vObj, set_default) - } - -} - -func (obj *captureIpv6) setDefault() { - -} - -// ***** EthernetConnection ***** -type ethernetConnection struct { - validation - obj *otg.EthernetConnection - marshaller marshalEthernetConnection - unMarshaller unMarshalEthernetConnection -} - -func NewEthernetConnection() EthernetConnection { - obj := ethernetConnection{obj: &otg.EthernetConnection{}} - obj.setDefault() - return &obj -} - -func (obj *ethernetConnection) msg() *otg.EthernetConnection { - return obj.obj -} - -func (obj *ethernetConnection) setMsg(msg *otg.EthernetConnection) EthernetConnection { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalethernetConnection struct { - obj *ethernetConnection -} - -type marshalEthernetConnection interface { - // ToProto marshals EthernetConnection to protobuf object *otg.EthernetConnection - ToProto() (*otg.EthernetConnection, error) - // ToPbText marshals EthernetConnection to protobuf text - ToPbText() (string, error) - // ToYaml marshals EthernetConnection to YAML text - ToYaml() (string, error) - // ToJson marshals EthernetConnection to JSON text - ToJson() (string, error) -} - -type unMarshalethernetConnection struct { - obj *ethernetConnection -} - -type unMarshalEthernetConnection interface { - // FromProto unmarshals EthernetConnection from protobuf object *otg.EthernetConnection - FromProto(msg *otg.EthernetConnection) (EthernetConnection, error) - // FromPbText unmarshals EthernetConnection from protobuf text - FromPbText(value string) error - // FromYaml unmarshals EthernetConnection from YAML text - FromYaml(value string) error - // FromJson unmarshals EthernetConnection from JSON text - FromJson(value string) error -} - -func (obj *ethernetConnection) Marshal() marshalEthernetConnection { - if obj.marshaller == nil { - obj.marshaller = &marshalethernetConnection{obj: obj} - } - return obj.marshaller -} - -func (obj *ethernetConnection) Unmarshal() unMarshalEthernetConnection { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalethernetConnection{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalethernetConnection) ToProto() (*otg.EthernetConnection, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalethernetConnection) FromProto(msg *otg.EthernetConnection) (EthernetConnection, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalethernetConnection) 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 *unMarshalethernetConnection) 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 *marshalethernetConnection) 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 *unMarshalethernetConnection) 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 *marshalethernetConnection) 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 *unMarshalethernetConnection) 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 *ethernetConnection) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *ethernetConnection) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *ethernetConnection) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *ethernetConnection) Clone() (EthernetConnection, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewEthernetConnection() - 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 -} - -// EthernetConnection is ethernet interface connection to a port, LAG or VXLAN tunnel. -type EthernetConnection interface { - Validation - // msg marshals EthernetConnection to protobuf object *otg.EthernetConnection - // and doesn't set defaults - msg() *otg.EthernetConnection - // setMsg unmarshals EthernetConnection from protobuf object *otg.EthernetConnection - // and doesn't set defaults - setMsg(*otg.EthernetConnection) EthernetConnection - // provides marshal interface - Marshal() marshalEthernetConnection - // provides unmarshal interface - Unmarshal() unMarshalEthernetConnection - // validate validates EthernetConnection - validate() error - // A stringer function - String() string - // Clones the object - Clone() (EthernetConnection, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns EthernetConnectionChoiceEnum, set in EthernetConnection - Choice() EthernetConnectionChoiceEnum - // setChoice assigns EthernetConnectionChoiceEnum provided by user to EthernetConnection - setChoice(value EthernetConnectionChoiceEnum) EthernetConnection - // HasChoice checks if Choice has been set in EthernetConnection - HasChoice() bool - // PortName returns string, set in EthernetConnection. - PortName() string - // SetPortName assigns string provided by user to EthernetConnection - SetPortName(value string) EthernetConnection - // HasPortName checks if PortName has been set in EthernetConnection - HasPortName() bool - // LagName returns string, set in EthernetConnection. - LagName() string - // SetLagName assigns string provided by user to EthernetConnection - SetLagName(value string) EthernetConnection - // HasLagName checks if LagName has been set in EthernetConnection - HasLagName() bool - // VxlanName returns string, set in EthernetConnection. - VxlanName() string - // SetVxlanName assigns string provided by user to EthernetConnection - SetVxlanName(value string) EthernetConnection - // HasVxlanName checks if VxlanName has been set in EthernetConnection - HasVxlanName() bool -} - -type EthernetConnectionChoiceEnum string - -// Enum of Choice on EthernetConnection -var EthernetConnectionChoice = struct { - PORT_NAME EthernetConnectionChoiceEnum - LAG_NAME EthernetConnectionChoiceEnum - VXLAN_NAME EthernetConnectionChoiceEnum -}{ - PORT_NAME: EthernetConnectionChoiceEnum("port_name"), - LAG_NAME: EthernetConnectionChoiceEnum("lag_name"), - VXLAN_NAME: EthernetConnectionChoiceEnum("vxlan_name"), -} - -func (obj *ethernetConnection) Choice() EthernetConnectionChoiceEnum { - return EthernetConnectionChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// port_name, lag_name or vxlan_name -// Choice returns a string -func (obj *ethernetConnection) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *ethernetConnection) setChoice(value EthernetConnectionChoiceEnum) EthernetConnection { - intValue, ok := otg.EthernetConnection_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on EthernetConnectionChoiceEnum", string(value))) - return obj - } - enumValue := otg.EthernetConnection_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.VxlanName = nil - obj.obj.LagName = nil - obj.obj.PortName = nil - return obj -} - -// Name of the port that the Ethernet interface is configured on. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// PortName returns a string -func (obj *ethernetConnection) PortName() string { - - if obj.obj.PortName == nil { - obj.setChoice(EthernetConnectionChoice.PORT_NAME) - } - - return *obj.obj.PortName - -} - -// Name of the port that the Ethernet interface is configured on. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// PortName returns a string -func (obj *ethernetConnection) HasPortName() bool { - return obj.obj.PortName != nil -} - -// Name of the port that the Ethernet interface is configured on. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// SetPortName sets the string value in the EthernetConnection object -func (obj *ethernetConnection) SetPortName(value string) EthernetConnection { - obj.setChoice(EthernetConnectionChoice.PORT_NAME) - obj.obj.PortName = &value - return obj -} - -// Name of the LAG that the Ethernet interface is configured on. -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// LagName returns a string -func (obj *ethernetConnection) LagName() string { - - if obj.obj.LagName == nil { - obj.setChoice(EthernetConnectionChoice.LAG_NAME) - } - - return *obj.obj.LagName - -} - -// Name of the LAG that the Ethernet interface is configured on. -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// LagName returns a string -func (obj *ethernetConnection) HasLagName() bool { - return obj.obj.LagName != nil -} - -// Name of the LAG that the Ethernet interface is configured on. -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Lag/properties/name -// -// SetLagName sets the string value in the EthernetConnection object -func (obj *ethernetConnection) SetLagName(value string) EthernetConnection { - obj.setChoice(EthernetConnectionChoice.LAG_NAME) - obj.obj.LagName = &value - return obj -} - -// Name of the VXLAN instance (or VXLAN tunnel) that this Ethernet interface is connected to. -// -// x-constraint: -// - #/components/schemas/Vxlan.V4Tunnel/properties/name -// - #/components/schemas/Vxlan.V6Tunnel/properties/name -// -// x-constraint: -// - #/components/schemas/Vxlan.V4Tunnel/properties/name -// - #/components/schemas/Vxlan.V6Tunnel/properties/name -// -// VxlanName returns a string -func (obj *ethernetConnection) VxlanName() string { - - if obj.obj.VxlanName == nil { - obj.setChoice(EthernetConnectionChoice.VXLAN_NAME) - } - - return *obj.obj.VxlanName - -} - -// Name of the VXLAN instance (or VXLAN tunnel) that this Ethernet interface is connected to. -// -// x-constraint: -// - #/components/schemas/Vxlan.V4Tunnel/properties/name -// - #/components/schemas/Vxlan.V6Tunnel/properties/name -// -// x-constraint: -// - #/components/schemas/Vxlan.V4Tunnel/properties/name -// - #/components/schemas/Vxlan.V6Tunnel/properties/name -// -// VxlanName returns a string -func (obj *ethernetConnection) HasVxlanName() bool { - return obj.obj.VxlanName != nil -} - -// Name of the VXLAN instance (or VXLAN tunnel) that this Ethernet interface is connected to. -// -// x-constraint: -// - #/components/schemas/Vxlan.V4Tunnel/properties/name -// - #/components/schemas/Vxlan.V6Tunnel/properties/name -// -// x-constraint: -// - #/components/schemas/Vxlan.V4Tunnel/properties/name -// - #/components/schemas/Vxlan.V6Tunnel/properties/name -// -// SetVxlanName sets the string value in the EthernetConnection object -func (obj *ethernetConnection) SetVxlanName(value string) EthernetConnection { - obj.setChoice(EthernetConnectionChoice.VXLAN_NAME) - obj.obj.VxlanName = &value - return obj -} - -func (obj *ethernetConnection) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *ethernetConnection) setDefault() { - var choices_set int = 0 - var choice EthernetConnectionChoiceEnum - - if obj.obj.PortName != nil { - choices_set += 1 - choice = EthernetConnectionChoice.PORT_NAME - } - - if obj.obj.LagName != nil { - choices_set += 1 - choice = EthernetConnectionChoice.LAG_NAME - } - - if obj.obj.VxlanName != nil { - choices_set += 1 - choice = EthernetConnectionChoice.VXLAN_NAME - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in EthernetConnection") - } - } else { - intVal := otg.EthernetConnection_Choice_Enum_value[string(choice)] - enumValue := otg.EthernetConnection_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** DeviceIpv4 ***** -type deviceIpv4 struct { - validation - obj *otg.DeviceIpv4 - marshaller marshalDeviceIpv4 - unMarshaller unMarshalDeviceIpv4 - gatewayMacHolder DeviceIpv4GatewayMAC -} - -func NewDeviceIpv4() DeviceIpv4 { - obj := deviceIpv4{obj: &otg.DeviceIpv4{}} - obj.setDefault() - return &obj -} - -func (obj *deviceIpv4) msg() *otg.DeviceIpv4 { - return obj.obj -} - -func (obj *deviceIpv4) setMsg(msg *otg.DeviceIpv4) DeviceIpv4 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceIpv4 struct { - obj *deviceIpv4 -} - -type marshalDeviceIpv4 interface { - // ToProto marshals DeviceIpv4 to protobuf object *otg.DeviceIpv4 - ToProto() (*otg.DeviceIpv4, error) - // ToPbText marshals DeviceIpv4 to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceIpv4 to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceIpv4 to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceIpv4 struct { - obj *deviceIpv4 -} - -type unMarshalDeviceIpv4 interface { - // FromProto unmarshals DeviceIpv4 from protobuf object *otg.DeviceIpv4 - FromProto(msg *otg.DeviceIpv4) (DeviceIpv4, error) - // FromPbText unmarshals DeviceIpv4 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceIpv4 from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceIpv4 from JSON text - FromJson(value string) error -} - -func (obj *deviceIpv4) Marshal() marshalDeviceIpv4 { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceIpv4{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceIpv4) Unmarshal() unMarshalDeviceIpv4 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceIpv4{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceIpv4) ToProto() (*otg.DeviceIpv4, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceIpv4) FromProto(msg *otg.DeviceIpv4) (DeviceIpv4, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceIpv4) 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 *unMarshaldeviceIpv4) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshaldeviceIpv4) 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 *unMarshaldeviceIpv4) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshaldeviceIpv4) 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 *unMarshaldeviceIpv4) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *deviceIpv4) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceIpv4) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceIpv4) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceIpv4) Clone() (DeviceIpv4, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceIpv4() - 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 -} - -func (obj *deviceIpv4) setNil() { - obj.gatewayMacHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// DeviceIpv4 is an IPv4 interface with gateway -type DeviceIpv4 interface { - Validation - // msg marshals DeviceIpv4 to protobuf object *otg.DeviceIpv4 - // and doesn't set defaults - msg() *otg.DeviceIpv4 - // setMsg unmarshals DeviceIpv4 from protobuf object *otg.DeviceIpv4 - // and doesn't set defaults - setMsg(*otg.DeviceIpv4) DeviceIpv4 - // provides marshal interface - Marshal() marshalDeviceIpv4 - // provides unmarshal interface - Unmarshal() unMarshalDeviceIpv4 - // validate validates DeviceIpv4 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceIpv4, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Gateway returns string, set in DeviceIpv4. - Gateway() string - // SetGateway assigns string provided by user to DeviceIpv4 - SetGateway(value string) DeviceIpv4 - // GatewayMac returns DeviceIpv4GatewayMAC, set in DeviceIpv4. - // DeviceIpv4GatewayMAC is by default auto(resolved gateway mac) is set. Setting a value would mean that ARP will not be used for learning MAC of connected device. The user-configured MAC address will be used for auto-filling the destination - // MAC address in the control and data packets sent from this IPv4 endpoint - // whenever applicable. - GatewayMac() DeviceIpv4GatewayMAC - // SetGatewayMac assigns DeviceIpv4GatewayMAC provided by user to DeviceIpv4. - // DeviceIpv4GatewayMAC is by default auto(resolved gateway mac) is set. Setting a value would mean that ARP will not be used for learning MAC of connected device. The user-configured MAC address will be used for auto-filling the destination - // MAC address in the control and data packets sent from this IPv4 endpoint - // whenever applicable. - SetGatewayMac(value DeviceIpv4GatewayMAC) DeviceIpv4 - // HasGatewayMac checks if GatewayMac has been set in DeviceIpv4 - HasGatewayMac() bool - // Address returns string, set in DeviceIpv4. - Address() string - // SetAddress assigns string provided by user to DeviceIpv4 - SetAddress(value string) DeviceIpv4 - // Prefix returns uint32, set in DeviceIpv4. - Prefix() uint32 - // SetPrefix assigns uint32 provided by user to DeviceIpv4 - SetPrefix(value uint32) DeviceIpv4 - // HasPrefix checks if Prefix has been set in DeviceIpv4 - HasPrefix() bool - // Name returns string, set in DeviceIpv4. - Name() string - // SetName assigns string provided by user to DeviceIpv4 - SetName(value string) DeviceIpv4 - setNil() -} - -// The IPv4 address of the gateway -// Gateway returns a string -func (obj *deviceIpv4) Gateway() string { - - return *obj.obj.Gateway - -} - -// The IPv4 address of the gateway -// SetGateway sets the string value in the DeviceIpv4 object -func (obj *deviceIpv4) SetGateway(value string) DeviceIpv4 { - - obj.obj.Gateway = &value - return obj -} - -// description is TBD -// GatewayMac returns a DeviceIpv4GatewayMAC -func (obj *deviceIpv4) GatewayMac() DeviceIpv4GatewayMAC { - if obj.obj.GatewayMac == nil { - obj.obj.GatewayMac = NewDeviceIpv4GatewayMAC().msg() - } - if obj.gatewayMacHolder == nil { - obj.gatewayMacHolder = &deviceIpv4GatewayMAC{obj: obj.obj.GatewayMac} - } - return obj.gatewayMacHolder -} - -// description is TBD -// GatewayMac returns a DeviceIpv4GatewayMAC -func (obj *deviceIpv4) HasGatewayMac() bool { - return obj.obj.GatewayMac != nil -} - -// description is TBD -// SetGatewayMac sets the DeviceIpv4GatewayMAC value in the DeviceIpv4 object -func (obj *deviceIpv4) SetGatewayMac(value DeviceIpv4GatewayMAC) DeviceIpv4 { - - obj.gatewayMacHolder = nil - obj.obj.GatewayMac = value.msg() - - return obj -} - -// The IPv4 address -// Address returns a string -func (obj *deviceIpv4) Address() string { - - return *obj.obj.Address - -} - -// The IPv4 address -// SetAddress sets the string value in the DeviceIpv4 object -func (obj *deviceIpv4) SetAddress(value string) DeviceIpv4 { - - obj.obj.Address = &value - return obj -} - -// The prefix of the IPv4 address. -// Prefix returns a uint32 -func (obj *deviceIpv4) Prefix() uint32 { - - return *obj.obj.Prefix - -} - -// The prefix of the IPv4 address. -// Prefix returns a uint32 -func (obj *deviceIpv4) HasPrefix() bool { - return obj.obj.Prefix != nil -} - -// The prefix of the IPv4 address. -// SetPrefix sets the uint32 value in the DeviceIpv4 object -func (obj *deviceIpv4) SetPrefix(value uint32) DeviceIpv4 { - - obj.obj.Prefix = &value - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *deviceIpv4) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the DeviceIpv4 object -func (obj *deviceIpv4) SetName(value string) DeviceIpv4 { - - obj.obj.Name = &value - return obj -} - -func (obj *deviceIpv4) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Gateway is required - if obj.obj.Gateway == nil { - vObj.validationErrors = append(vObj.validationErrors, "Gateway is required field on interface DeviceIpv4") - } - if obj.obj.Gateway != nil { - - err := obj.validateIpv4(obj.Gateway()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv4.Gateway")) - } - - } - - if obj.obj.GatewayMac != nil { - - obj.GatewayMac().validateObj(vObj, set_default) - } - - // Address is required - if obj.obj.Address == nil { - vObj.validationErrors = append(vObj.validationErrors, "Address is required field on interface DeviceIpv4") - } - if obj.obj.Address != nil { - - err := obj.validateIpv4(obj.Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv4.Address")) - } - - } - - if obj.obj.Prefix != nil { - - if *obj.obj.Prefix < 1 || *obj.obj.Prefix > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= DeviceIpv4.Prefix <= 32 but Got %d", *obj.obj.Prefix)) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceIpv4") - } -} - -func (obj *deviceIpv4) setDefault() { - if obj.obj.Prefix == nil { - obj.SetPrefix(24) - } - -} - -// ***** DeviceIpv6 ***** -type deviceIpv6 struct { - validation - obj *otg.DeviceIpv6 - marshaller marshalDeviceIpv6 - unMarshaller unMarshalDeviceIpv6 - gatewayMacHolder DeviceIpv6GatewayMAC -} - -func NewDeviceIpv6() DeviceIpv6 { - obj := deviceIpv6{obj: &otg.DeviceIpv6{}} - obj.setDefault() - return &obj -} - -func (obj *deviceIpv6) msg() *otg.DeviceIpv6 { - return obj.obj -} - -func (obj *deviceIpv6) setMsg(msg *otg.DeviceIpv6) DeviceIpv6 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceIpv6 struct { - obj *deviceIpv6 -} - -type marshalDeviceIpv6 interface { - // ToProto marshals DeviceIpv6 to protobuf object *otg.DeviceIpv6 - ToProto() (*otg.DeviceIpv6, error) - // ToPbText marshals DeviceIpv6 to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceIpv6 to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceIpv6 to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceIpv6 struct { - obj *deviceIpv6 -} - -type unMarshalDeviceIpv6 interface { - // FromProto unmarshals DeviceIpv6 from protobuf object *otg.DeviceIpv6 - FromProto(msg *otg.DeviceIpv6) (DeviceIpv6, error) - // FromPbText unmarshals DeviceIpv6 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceIpv6 from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceIpv6 from JSON text - FromJson(value string) error -} - -func (obj *deviceIpv6) Marshal() marshalDeviceIpv6 { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceIpv6{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceIpv6) Unmarshal() unMarshalDeviceIpv6 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceIpv6{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceIpv6) ToProto() (*otg.DeviceIpv6, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceIpv6) FromProto(msg *otg.DeviceIpv6) (DeviceIpv6, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceIpv6) 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 *unMarshaldeviceIpv6) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshaldeviceIpv6) 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 *unMarshaldeviceIpv6) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshaldeviceIpv6) 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 *unMarshaldeviceIpv6) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *deviceIpv6) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceIpv6) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceIpv6) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceIpv6) Clone() (DeviceIpv6, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceIpv6() - 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 -} - -func (obj *deviceIpv6) setNil() { - obj.gatewayMacHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// DeviceIpv6 is an IPv6 interface with gateway. -type DeviceIpv6 interface { - Validation - // msg marshals DeviceIpv6 to protobuf object *otg.DeviceIpv6 - // and doesn't set defaults - msg() *otg.DeviceIpv6 - // setMsg unmarshals DeviceIpv6 from protobuf object *otg.DeviceIpv6 - // and doesn't set defaults - setMsg(*otg.DeviceIpv6) DeviceIpv6 - // provides marshal interface - Marshal() marshalDeviceIpv6 - // provides unmarshal interface - Unmarshal() unMarshalDeviceIpv6 - // validate validates DeviceIpv6 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceIpv6, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Gateway returns string, set in DeviceIpv6. - Gateway() string - // SetGateway assigns string provided by user to DeviceIpv6 - SetGateway(value string) DeviceIpv6 - // GatewayMac returns DeviceIpv6GatewayMAC, set in DeviceIpv6. - // DeviceIpv6GatewayMAC is by default auto(resolved gateway mac) is set. Setting a value would mean that ND will not be used for learning MAC of connected device. The user-configured MAC address will be used for auto-filling the destination - // MAC address in the control and data packets sent from this IPv6 endpoint - // whenever applicable. - GatewayMac() DeviceIpv6GatewayMAC - // SetGatewayMac assigns DeviceIpv6GatewayMAC provided by user to DeviceIpv6. - // DeviceIpv6GatewayMAC is by default auto(resolved gateway mac) is set. Setting a value would mean that ND will not be used for learning MAC of connected device. The user-configured MAC address will be used for auto-filling the destination - // MAC address in the control and data packets sent from this IPv6 endpoint - // whenever applicable. - SetGatewayMac(value DeviceIpv6GatewayMAC) DeviceIpv6 - // HasGatewayMac checks if GatewayMac has been set in DeviceIpv6 - HasGatewayMac() bool - // Address returns string, set in DeviceIpv6. - Address() string - // SetAddress assigns string provided by user to DeviceIpv6 - SetAddress(value string) DeviceIpv6 - // Prefix returns uint32, set in DeviceIpv6. - Prefix() uint32 - // SetPrefix assigns uint32 provided by user to DeviceIpv6 - SetPrefix(value uint32) DeviceIpv6 - // HasPrefix checks if Prefix has been set in DeviceIpv6 - HasPrefix() bool - // Name returns string, set in DeviceIpv6. - Name() string - // SetName assigns string provided by user to DeviceIpv6 - SetName(value string) DeviceIpv6 - setNil() -} - -// The IPv6 gateway address. -// Gateway returns a string -func (obj *deviceIpv6) Gateway() string { - - return *obj.obj.Gateway - -} - -// The IPv6 gateway address. -// SetGateway sets the string value in the DeviceIpv6 object -func (obj *deviceIpv6) SetGateway(value string) DeviceIpv6 { - - obj.obj.Gateway = &value - return obj -} - -// description is TBD -// GatewayMac returns a DeviceIpv6GatewayMAC -func (obj *deviceIpv6) GatewayMac() DeviceIpv6GatewayMAC { - if obj.obj.GatewayMac == nil { - obj.obj.GatewayMac = NewDeviceIpv6GatewayMAC().msg() - } - if obj.gatewayMacHolder == nil { - obj.gatewayMacHolder = &deviceIpv6GatewayMAC{obj: obj.obj.GatewayMac} - } - return obj.gatewayMacHolder -} - -// description is TBD -// GatewayMac returns a DeviceIpv6GatewayMAC -func (obj *deviceIpv6) HasGatewayMac() bool { - return obj.obj.GatewayMac != nil -} - -// description is TBD -// SetGatewayMac sets the DeviceIpv6GatewayMAC value in the DeviceIpv6 object -func (obj *deviceIpv6) SetGatewayMac(value DeviceIpv6GatewayMAC) DeviceIpv6 { - - obj.gatewayMacHolder = nil - obj.obj.GatewayMac = value.msg() - - return obj -} - -// The IPv6 address. -// Address returns a string -func (obj *deviceIpv6) Address() string { - - return *obj.obj.Address - -} - -// The IPv6 address. -// SetAddress sets the string value in the DeviceIpv6 object -func (obj *deviceIpv6) SetAddress(value string) DeviceIpv6 { - - obj.obj.Address = &value - return obj -} - -// The network prefix. -// Prefix returns a uint32 -func (obj *deviceIpv6) Prefix() uint32 { - - return *obj.obj.Prefix - -} - -// The network prefix. -// Prefix returns a uint32 -func (obj *deviceIpv6) HasPrefix() bool { - return obj.obj.Prefix != nil -} - -// The network prefix. -// SetPrefix sets the uint32 value in the DeviceIpv6 object -func (obj *deviceIpv6) SetPrefix(value uint32) DeviceIpv6 { - - obj.obj.Prefix = &value - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *deviceIpv6) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the DeviceIpv6 object -func (obj *deviceIpv6) SetName(value string) DeviceIpv6 { - - obj.obj.Name = &value - return obj -} - -func (obj *deviceIpv6) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Gateway is required - if obj.obj.Gateway == nil { - vObj.validationErrors = append(vObj.validationErrors, "Gateway is required field on interface DeviceIpv6") - } - if obj.obj.Gateway != nil { - - err := obj.validateIpv6(obj.Gateway()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv6.Gateway")) - } - - } - - if obj.obj.GatewayMac != nil { - - obj.GatewayMac().validateObj(vObj, set_default) - } - - // Address is required - if obj.obj.Address == nil { - vObj.validationErrors = append(vObj.validationErrors, "Address is required field on interface DeviceIpv6") - } - if obj.obj.Address != nil { - - err := obj.validateIpv6(obj.Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv6.Address")) - } - - } - - if obj.obj.Prefix != nil { - - if *obj.obj.Prefix < 1 || *obj.obj.Prefix > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= DeviceIpv6.Prefix <= 128 but Got %d", *obj.obj.Prefix)) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceIpv6") - } -} - -func (obj *deviceIpv6) setDefault() { - if obj.obj.Prefix == nil { - obj.SetPrefix(64) - } - -} - -// ***** DeviceVlan ***** -type deviceVlan struct { - validation - obj *otg.DeviceVlan - marshaller marshalDeviceVlan - unMarshaller unMarshalDeviceVlan -} - -func NewDeviceVlan() DeviceVlan { - obj := deviceVlan{obj: &otg.DeviceVlan{}} - obj.setDefault() - return &obj -} - -func (obj *deviceVlan) msg() *otg.DeviceVlan { - return obj.obj -} - -func (obj *deviceVlan) setMsg(msg *otg.DeviceVlan) DeviceVlan { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceVlan struct { - obj *deviceVlan -} - -type marshalDeviceVlan interface { - // ToProto marshals DeviceVlan to protobuf object *otg.DeviceVlan - ToProto() (*otg.DeviceVlan, error) - // ToPbText marshals DeviceVlan to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceVlan to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceVlan to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceVlan struct { - obj *deviceVlan -} - -type unMarshalDeviceVlan interface { - // FromProto unmarshals DeviceVlan from protobuf object *otg.DeviceVlan - FromProto(msg *otg.DeviceVlan) (DeviceVlan, error) - // FromPbText unmarshals DeviceVlan from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceVlan from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceVlan from JSON text - FromJson(value string) error -} - -func (obj *deviceVlan) Marshal() marshalDeviceVlan { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceVlan{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceVlan) Unmarshal() unMarshalDeviceVlan { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceVlan{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceVlan) ToProto() (*otg.DeviceVlan, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceVlan) FromProto(msg *otg.DeviceVlan) (DeviceVlan, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceVlan) 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 *unMarshaldeviceVlan) 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 *marshaldeviceVlan) 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 *unMarshaldeviceVlan) 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 *marshaldeviceVlan) 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 *unMarshaldeviceVlan) 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 *deviceVlan) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceVlan) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceVlan) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceVlan) Clone() (DeviceVlan, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceVlan() - 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 -} - -// DeviceVlan is emulated VLAN protocol. -type DeviceVlan interface { - Validation - // msg marshals DeviceVlan to protobuf object *otg.DeviceVlan - // and doesn't set defaults - msg() *otg.DeviceVlan - // setMsg unmarshals DeviceVlan from protobuf object *otg.DeviceVlan - // and doesn't set defaults - setMsg(*otg.DeviceVlan) DeviceVlan - // provides marshal interface - Marshal() marshalDeviceVlan - // provides unmarshal interface - Unmarshal() unMarshalDeviceVlan - // validate validates DeviceVlan - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceVlan, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Tpid returns DeviceVlanTpidEnum, set in DeviceVlan - Tpid() DeviceVlanTpidEnum - // SetTpid assigns DeviceVlanTpidEnum provided by user to DeviceVlan - SetTpid(value DeviceVlanTpidEnum) DeviceVlan - // HasTpid checks if Tpid has been set in DeviceVlan - HasTpid() bool - // Priority returns uint32, set in DeviceVlan. - Priority() uint32 - // SetPriority assigns uint32 provided by user to DeviceVlan - SetPriority(value uint32) DeviceVlan - // HasPriority checks if Priority has been set in DeviceVlan - HasPriority() bool - // Id returns uint32, set in DeviceVlan. - Id() uint32 - // SetId assigns uint32 provided by user to DeviceVlan - SetId(value uint32) DeviceVlan - // HasId checks if Id has been set in DeviceVlan - HasId() bool - // Name returns string, set in DeviceVlan. - Name() string - // SetName assigns string provided by user to DeviceVlan - SetName(value string) DeviceVlan -} - -type DeviceVlanTpidEnum string - -// Enum of Tpid on DeviceVlan -var DeviceVlanTpid = struct { - X8100 DeviceVlanTpidEnum - X88A8 DeviceVlanTpidEnum - X9100 DeviceVlanTpidEnum - X9200 DeviceVlanTpidEnum - X9300 DeviceVlanTpidEnum -}{ - X8100: DeviceVlanTpidEnum("x8100"), - X88A8: DeviceVlanTpidEnum("x88A8"), - X9100: DeviceVlanTpidEnum("x9100"), - X9200: DeviceVlanTpidEnum("x9200"), - X9300: DeviceVlanTpidEnum("x9300"), -} - -func (obj *deviceVlan) Tpid() DeviceVlanTpidEnum { - return DeviceVlanTpidEnum(obj.obj.Tpid.Enum().String()) -} - -// Tag protocol identifier -// Tpid returns a string -func (obj *deviceVlan) HasTpid() bool { - return obj.obj.Tpid != nil -} - -func (obj *deviceVlan) SetTpid(value DeviceVlanTpidEnum) DeviceVlan { - intValue, ok := otg.DeviceVlan_Tpid_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on DeviceVlanTpidEnum", string(value))) - return obj - } - enumValue := otg.DeviceVlan_Tpid_Enum(intValue) - obj.obj.Tpid = &enumValue - - return obj -} - -// Priority code point -// Priority returns a uint32 -func (obj *deviceVlan) Priority() uint32 { - - return *obj.obj.Priority - -} - -// Priority code point -// Priority returns a uint32 -func (obj *deviceVlan) HasPriority() bool { - return obj.obj.Priority != nil -} - -// Priority code point -// SetPriority sets the uint32 value in the DeviceVlan object -func (obj *deviceVlan) SetPriority(value uint32) DeviceVlan { - - obj.obj.Priority = &value - return obj -} - -// VLAN identifier -// Id returns a uint32 -func (obj *deviceVlan) Id() uint32 { - - return *obj.obj.Id - -} - -// VLAN identifier -// Id returns a uint32 -func (obj *deviceVlan) HasId() bool { - return obj.obj.Id != nil -} - -// VLAN identifier -// SetId sets the uint32 value in the DeviceVlan object -func (obj *deviceVlan) SetId(value uint32) DeviceVlan { - - obj.obj.Id = &value - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *deviceVlan) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the DeviceVlan object -func (obj *deviceVlan) SetName(value string) DeviceVlan { - - obj.obj.Name = &value - return obj -} - -func (obj *deviceVlan) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Priority != nil { - - if *obj.obj.Priority > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= DeviceVlan.Priority <= 3 but Got %d", *obj.obj.Priority)) - } - - } - - if obj.obj.Id != nil { - - if *obj.obj.Id > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= DeviceVlan.Id <= 4095 but Got %d", *obj.obj.Id)) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceVlan") - } -} - -func (obj *deviceVlan) setDefault() { - if obj.obj.Tpid == nil { - obj.SetTpid(DeviceVlanTpid.X8100) - - } - if obj.obj.Priority == nil { - obj.SetPriority(0) - } - if obj.obj.Id == nil { - obj.SetId(1) - } - -} - -// ***** DeviceDhcpv4Client ***** -type deviceDhcpv4Client struct { - validation - obj *otg.DeviceDhcpv4Client - marshaller marshalDeviceDhcpv4Client - unMarshaller unMarshalDeviceDhcpv4Client - parametersRequestListHolder Dhcpv4ClientParams -} - -func NewDeviceDhcpv4Client() DeviceDhcpv4Client { - obj := deviceDhcpv4Client{obj: &otg.DeviceDhcpv4Client{}} - obj.setDefault() - return &obj -} - -func (obj *deviceDhcpv4Client) msg() *otg.DeviceDhcpv4Client { - return obj.obj -} - -func (obj *deviceDhcpv4Client) setMsg(msg *otg.DeviceDhcpv4Client) DeviceDhcpv4Client { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceDhcpv4Client struct { - obj *deviceDhcpv4Client -} - -type marshalDeviceDhcpv4Client interface { - // ToProto marshals DeviceDhcpv4Client to protobuf object *otg.DeviceDhcpv4Client - ToProto() (*otg.DeviceDhcpv4Client, error) - // ToPbText marshals DeviceDhcpv4Client to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceDhcpv4Client to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceDhcpv4Client to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceDhcpv4Client struct { - obj *deviceDhcpv4Client -} - -type unMarshalDeviceDhcpv4Client interface { - // FromProto unmarshals DeviceDhcpv4Client from protobuf object *otg.DeviceDhcpv4Client - FromProto(msg *otg.DeviceDhcpv4Client) (DeviceDhcpv4Client, error) - // FromPbText unmarshals DeviceDhcpv4Client from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceDhcpv4Client from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceDhcpv4Client from JSON text - FromJson(value string) error -} - -func (obj *deviceDhcpv4Client) Marshal() marshalDeviceDhcpv4Client { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceDhcpv4Client{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceDhcpv4Client) Unmarshal() unMarshalDeviceDhcpv4Client { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceDhcpv4Client{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceDhcpv4Client) ToProto() (*otg.DeviceDhcpv4Client, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceDhcpv4Client) FromProto(msg *otg.DeviceDhcpv4Client) (DeviceDhcpv4Client, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceDhcpv4Client) 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 *unMarshaldeviceDhcpv4Client) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshaldeviceDhcpv4Client) 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 *unMarshaldeviceDhcpv4Client) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshaldeviceDhcpv4Client) 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 *unMarshaldeviceDhcpv4Client) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *deviceDhcpv4Client) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceDhcpv4Client) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceDhcpv4Client) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceDhcpv4Client) Clone() (DeviceDhcpv4Client, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceDhcpv4Client() - 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 -} - -func (obj *deviceDhcpv4Client) setNil() { - obj.parametersRequestListHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// DeviceDhcpv4Client is configuration for emulated DHCPv4 Client on a single Interface. https://www.rfc-editor.org/rfc/rfc2131.html -type DeviceDhcpv4Client interface { - Validation - // msg marshals DeviceDhcpv4Client to protobuf object *otg.DeviceDhcpv4Client - // and doesn't set defaults - msg() *otg.DeviceDhcpv4Client - // setMsg unmarshals DeviceDhcpv4Client from protobuf object *otg.DeviceDhcpv4Client - // and doesn't set defaults - setMsg(*otg.DeviceDhcpv4Client) DeviceDhcpv4Client - // provides marshal interface - Marshal() marshalDeviceDhcpv4Client - // provides unmarshal interface - Unmarshal() unMarshalDeviceDhcpv4Client - // validate validates DeviceDhcpv4Client - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceDhcpv4Client, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in DeviceDhcpv4Client. - Name() string - // SetName assigns string provided by user to DeviceDhcpv4Client - SetName(value string) DeviceDhcpv4Client - // Choice returns DeviceDhcpv4ClientChoiceEnum, set in DeviceDhcpv4Client - Choice() DeviceDhcpv4ClientChoiceEnum - // setChoice assigns DeviceDhcpv4ClientChoiceEnum provided by user to DeviceDhcpv4Client - setChoice(value DeviceDhcpv4ClientChoiceEnum) DeviceDhcpv4Client - // HasChoice checks if Choice has been set in DeviceDhcpv4Client - HasChoice() bool - // getter for FirstServer to set choice. - FirstServer() - // ServerAddress returns string, set in DeviceDhcpv4Client. - ServerAddress() string - // SetServerAddress assigns string provided by user to DeviceDhcpv4Client - SetServerAddress(value string) DeviceDhcpv4Client - // HasServerAddress checks if ServerAddress has been set in DeviceDhcpv4Client - HasServerAddress() bool - // Broadcast returns bool, set in DeviceDhcpv4Client. - Broadcast() bool - // SetBroadcast assigns bool provided by user to DeviceDhcpv4Client - SetBroadcast(value bool) DeviceDhcpv4Client - // HasBroadcast checks if Broadcast has been set in DeviceDhcpv4Client - HasBroadcast() bool - // ParametersRequestList returns Dhcpv4ClientParams, set in DeviceDhcpv4Client. - // Dhcpv4ClientParams is configuration Parameter request list by emulated DHCPv4 Client. - ParametersRequestList() Dhcpv4ClientParams - // SetParametersRequestList assigns Dhcpv4ClientParams provided by user to DeviceDhcpv4Client. - // Dhcpv4ClientParams is configuration Parameter request list by emulated DHCPv4 Client. - SetParametersRequestList(value Dhcpv4ClientParams) DeviceDhcpv4Client - // HasParametersRequestList checks if ParametersRequestList has been set in DeviceDhcpv4Client - HasParametersRequestList() bool - setNil() -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *deviceDhcpv4Client) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the DeviceDhcpv4Client object -func (obj *deviceDhcpv4Client) SetName(value string) DeviceDhcpv4Client { - - obj.obj.Name = &value - return obj -} - -type DeviceDhcpv4ClientChoiceEnum string - -// Enum of Choice on DeviceDhcpv4Client -var DeviceDhcpv4ClientChoice = struct { - FIRST_SERVER DeviceDhcpv4ClientChoiceEnum - SERVER_ADDRESS DeviceDhcpv4ClientChoiceEnum -}{ - FIRST_SERVER: DeviceDhcpv4ClientChoiceEnum("first_server"), - SERVER_ADDRESS: DeviceDhcpv4ClientChoiceEnum("server_address"), -} - -func (obj *deviceDhcpv4Client) Choice() DeviceDhcpv4ClientChoiceEnum { - return DeviceDhcpv4ClientChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// getter for FirstServer to set choice -func (obj *deviceDhcpv4Client) FirstServer() { - obj.setChoice(DeviceDhcpv4ClientChoice.FIRST_SERVER) -} - -// The client receives one or more DHCPOFFER messages from one or more servers and client may choose to wait for multiple responses. -// The client chooses one server from which to request configuration -// parameters, based on the configuration parameters offered in the DHCPOFFER messages. -// - first_server: if selected, the subnet accepts the IP addresses offered by the first server to respond with an offer of IP addresses. -// - server_address: The address of the DHCP server from which the subnet will accept IP addresses. -// Choice returns a string -func (obj *deviceDhcpv4Client) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *deviceDhcpv4Client) setChoice(value DeviceDhcpv4ClientChoiceEnum) DeviceDhcpv4Client { - intValue, ok := otg.DeviceDhcpv4Client_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on DeviceDhcpv4ClientChoiceEnum", string(value))) - return obj - } - enumValue := otg.DeviceDhcpv4Client_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.ServerAddress = nil - return obj -} - -// The address of the DHCP server. -// ServerAddress returns a string -func (obj *deviceDhcpv4Client) ServerAddress() string { - - if obj.obj.ServerAddress == nil { - obj.setChoice(DeviceDhcpv4ClientChoice.SERVER_ADDRESS) - } - - return *obj.obj.ServerAddress - -} - -// The address of the DHCP server. -// ServerAddress returns a string -func (obj *deviceDhcpv4Client) HasServerAddress() bool { - return obj.obj.ServerAddress != nil -} - -// The address of the DHCP server. -// SetServerAddress sets the string value in the DeviceDhcpv4Client object -func (obj *deviceDhcpv4Client) SetServerAddress(value string) DeviceDhcpv4Client { - obj.setChoice(DeviceDhcpv4ClientChoice.SERVER_ADDRESS) - obj.obj.ServerAddress = &value - return obj -} - -// If the broadcast bit is set, then the server and relay agent broadcast DHCPOFFER and DHCPACK messages. -// Broadcast returns a bool -func (obj *deviceDhcpv4Client) Broadcast() bool { - - return *obj.obj.Broadcast - -} - -// If the broadcast bit is set, then the server and relay agent broadcast DHCPOFFER and DHCPACK messages. -// Broadcast returns a bool -func (obj *deviceDhcpv4Client) HasBroadcast() bool { - return obj.obj.Broadcast != nil -} - -// If the broadcast bit is set, then the server and relay agent broadcast DHCPOFFER and DHCPACK messages. -// SetBroadcast sets the bool value in the DeviceDhcpv4Client object -func (obj *deviceDhcpv4Client) SetBroadcast(value bool) DeviceDhcpv4Client { - - obj.obj.Broadcast = &value - return obj -} - -// Optional parameters field request list of DHCPv4 Client. -// ParametersRequestList returns a Dhcpv4ClientParams -func (obj *deviceDhcpv4Client) ParametersRequestList() Dhcpv4ClientParams { - if obj.obj.ParametersRequestList == nil { - obj.obj.ParametersRequestList = NewDhcpv4ClientParams().msg() - } - if obj.parametersRequestListHolder == nil { - obj.parametersRequestListHolder = &dhcpv4ClientParams{obj: obj.obj.ParametersRequestList} - } - return obj.parametersRequestListHolder -} - -// Optional parameters field request list of DHCPv4 Client. -// ParametersRequestList returns a Dhcpv4ClientParams -func (obj *deviceDhcpv4Client) HasParametersRequestList() bool { - return obj.obj.ParametersRequestList != nil -} - -// Optional parameters field request list of DHCPv4 Client. -// SetParametersRequestList sets the Dhcpv4ClientParams value in the DeviceDhcpv4Client object -func (obj *deviceDhcpv4Client) SetParametersRequestList(value Dhcpv4ClientParams) DeviceDhcpv4Client { - - obj.parametersRequestListHolder = nil - obj.obj.ParametersRequestList = value.msg() - - return obj -} - -func (obj *deviceDhcpv4Client) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DeviceDhcpv4Client") - } - - if obj.obj.ServerAddress != nil { - - err := obj.validateIpv4(obj.ServerAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceDhcpv4Client.ServerAddress")) - } - - } - - if obj.obj.ParametersRequestList != nil { - - obj.ParametersRequestList().validateObj(vObj, set_default) - } - -} - -func (obj *deviceDhcpv4Client) setDefault() { - var choices_set int = 0 - var choice DeviceDhcpv4ClientChoiceEnum - - if obj.obj.ServerAddress != nil { - choices_set += 1 - choice = DeviceDhcpv4ClientChoice.SERVER_ADDRESS - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(DeviceDhcpv4ClientChoice.FIRST_SERVER) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in DeviceDhcpv4Client") - } - } else { - intVal := otg.DeviceDhcpv4Client_Choice_Enum_value[string(choice)] - enumValue := otg.DeviceDhcpv4Client_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - - if obj.obj.Broadcast == nil { - obj.SetBroadcast(false) - } - -} - -// ***** DeviceIsisMultiInstance ***** -type deviceIsisMultiInstance struct { - validation - obj *otg.DeviceIsisMultiInstance - marshaller marshalDeviceIsisMultiInstance - unMarshaller unMarshalDeviceIsisMultiInstance -} - -func NewDeviceIsisMultiInstance() DeviceIsisMultiInstance { - obj := deviceIsisMultiInstance{obj: &otg.DeviceIsisMultiInstance{}} - obj.setDefault() - return &obj -} - -func (obj *deviceIsisMultiInstance) msg() *otg.DeviceIsisMultiInstance { - return obj.obj -} - -func (obj *deviceIsisMultiInstance) setMsg(msg *otg.DeviceIsisMultiInstance) DeviceIsisMultiInstance { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceIsisMultiInstance struct { - obj *deviceIsisMultiInstance -} - -type marshalDeviceIsisMultiInstance interface { - // ToProto marshals DeviceIsisMultiInstance to protobuf object *otg.DeviceIsisMultiInstance - ToProto() (*otg.DeviceIsisMultiInstance, error) - // ToPbText marshals DeviceIsisMultiInstance to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceIsisMultiInstance to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceIsisMultiInstance to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceIsisMultiInstance struct { - obj *deviceIsisMultiInstance -} - -type unMarshalDeviceIsisMultiInstance interface { - // FromProto unmarshals DeviceIsisMultiInstance from protobuf object *otg.DeviceIsisMultiInstance - FromProto(msg *otg.DeviceIsisMultiInstance) (DeviceIsisMultiInstance, error) - // FromPbText unmarshals DeviceIsisMultiInstance from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceIsisMultiInstance from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceIsisMultiInstance from JSON text - FromJson(value string) error -} - -func (obj *deviceIsisMultiInstance) Marshal() marshalDeviceIsisMultiInstance { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceIsisMultiInstance{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceIsisMultiInstance) Unmarshal() unMarshalDeviceIsisMultiInstance { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceIsisMultiInstance{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceIsisMultiInstance) ToProto() (*otg.DeviceIsisMultiInstance, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceIsisMultiInstance) FromProto(msg *otg.DeviceIsisMultiInstance) (DeviceIsisMultiInstance, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceIsisMultiInstance) 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 *unMarshaldeviceIsisMultiInstance) 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 *marshaldeviceIsisMultiInstance) 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 *unMarshaldeviceIsisMultiInstance) 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 *marshaldeviceIsisMultiInstance) 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 *unMarshaldeviceIsisMultiInstance) 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 *deviceIsisMultiInstance) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceIsisMultiInstance) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceIsisMultiInstance) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceIsisMultiInstance) Clone() (DeviceIsisMultiInstance, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceIsisMultiInstance() - 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 -} - -// DeviceIsisMultiInstance is this container properties of an Multi-Instance-capable router (MI-RTR). -type DeviceIsisMultiInstance interface { - Validation - // msg marshals DeviceIsisMultiInstance to protobuf object *otg.DeviceIsisMultiInstance - // and doesn't set defaults - msg() *otg.DeviceIsisMultiInstance - // setMsg unmarshals DeviceIsisMultiInstance from protobuf object *otg.DeviceIsisMultiInstance - // and doesn't set defaults - setMsg(*otg.DeviceIsisMultiInstance) DeviceIsisMultiInstance - // provides marshal interface - Marshal() marshalDeviceIsisMultiInstance - // provides unmarshal interface - Unmarshal() unMarshalDeviceIsisMultiInstance - // validate validates DeviceIsisMultiInstance - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceIsisMultiInstance, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Iid returns uint32, set in DeviceIsisMultiInstance. - Iid() uint32 - // SetIid assigns uint32 provided by user to DeviceIsisMultiInstance - SetIid(value uint32) DeviceIsisMultiInstance - // HasIid checks if Iid has been set in DeviceIsisMultiInstance - HasIid() bool - // Itids returns []uint32, set in DeviceIsisMultiInstance. - Itids() []uint32 - // SetItids assigns []uint32 provided by user to DeviceIsisMultiInstance - SetItids(value []uint32) DeviceIsisMultiInstance -} - -// Instance Identifier (IID) TLV will associate a PDU with an ISIS instance by using a unique 16-bit number and including one or more Instance-Specific Topology Identifiers (ITIDs). -// Iid returns a uint32 -func (obj *deviceIsisMultiInstance) Iid() uint32 { - - return *obj.obj.Iid - -} - -// Instance Identifier (IID) TLV will associate a PDU with an ISIS instance by using a unique 16-bit number and including one or more Instance-Specific Topology Identifiers (ITIDs). -// Iid returns a uint32 -func (obj *deviceIsisMultiInstance) HasIid() bool { - return obj.obj.Iid != nil -} - -// Instance Identifier (IID) TLV will associate a PDU with an ISIS instance by using a unique 16-bit number and including one or more Instance-Specific Topology Identifiers (ITIDs). -// SetIid sets the uint32 value in the DeviceIsisMultiInstance object -func (obj *deviceIsisMultiInstance) SetIid(value uint32) DeviceIsisMultiInstance { - - obj.obj.Iid = &value - return obj -} - -// This contains one or more ITIDs that will be advertised in IID TLV. -// Itids returns a []uint32 -func (obj *deviceIsisMultiInstance) Itids() []uint32 { - if obj.obj.Itids == nil { - obj.obj.Itids = make([]uint32, 0) - } - return obj.obj.Itids -} - -// This contains one or more ITIDs that will be advertised in IID TLV. -// SetItids sets the []uint32 value in the DeviceIsisMultiInstance object -func (obj *deviceIsisMultiInstance) SetItids(value []uint32) DeviceIsisMultiInstance { - - if obj.obj.Itids == nil { - obj.obj.Itids = make([]uint32, 0) - } - obj.obj.Itids = value - - return obj -} - -func (obj *deviceIsisMultiInstance) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Iid != nil { - - if *obj.obj.Iid > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= DeviceIsisMultiInstance.Iid <= 65535 but Got %d", *obj.obj.Iid)) - } - - } - - if obj.obj.Itids != nil { - - for _, item := range obj.obj.Itids { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= DeviceIsisMultiInstance.Itids <= 65535 but Got %d", item)) - } - - } - - } - -} - -func (obj *deviceIsisMultiInstance) setDefault() { - if obj.obj.Iid == nil { - obj.SetIid(1) - } - -} - -// ***** IsisInterface ***** -type isisInterface struct { - validation - obj *otg.IsisInterface - marshaller marshalIsisInterface - unMarshaller unMarshalIsisInterface - l1SettingsHolder IsisInterfaceLevel - l2SettingsHolder IsisInterfaceLevel - multiTopologyIdsHolder IsisInterfaceIsisMTIter - trafficEngineeringHolder IsisInterfaceLinkStateTEIter - authenticationHolder IsisInterfaceAuthentication - advancedHolder IsisInterfaceAdvanced - linkProtectionHolder IsisInterfaceLinkProtection -} - -func NewIsisInterface() IsisInterface { - obj := isisInterface{obj: &otg.IsisInterface{}} - obj.setDefault() - return &obj -} - -func (obj *isisInterface) msg() *otg.IsisInterface { - return obj.obj -} - -func (obj *isisInterface) setMsg(msg *otg.IsisInterface) IsisInterface { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisInterface struct { - obj *isisInterface -} - -type marshalIsisInterface interface { - // ToProto marshals IsisInterface to protobuf object *otg.IsisInterface - ToProto() (*otg.IsisInterface, error) - // ToPbText marshals IsisInterface to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisInterface to YAML text - ToYaml() (string, error) - // ToJson marshals IsisInterface to JSON text - ToJson() (string, error) -} - -type unMarshalisisInterface struct { - obj *isisInterface -} - -type unMarshalIsisInterface interface { - // FromProto unmarshals IsisInterface from protobuf object *otg.IsisInterface - FromProto(msg *otg.IsisInterface) (IsisInterface, error) - // FromPbText unmarshals IsisInterface from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisInterface from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisInterface from JSON text - FromJson(value string) error -} - -func (obj *isisInterface) Marshal() marshalIsisInterface { - if obj.marshaller == nil { - obj.marshaller = &marshalisisInterface{obj: obj} - } - return obj.marshaller -} - -func (obj *isisInterface) Unmarshal() unMarshalIsisInterface { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisInterface{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisInterface) ToProto() (*otg.IsisInterface, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisInterface) FromProto(msg *otg.IsisInterface) (IsisInterface, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisInterface) 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 *unMarshalisisInterface) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisInterface) 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 *unMarshalisisInterface) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisInterface) 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 *unMarshalisisInterface) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisInterface) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisInterface) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisInterface) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisInterface) Clone() (IsisInterface, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisInterface() - 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 -} - -func (obj *isisInterface) setNil() { - obj.l1SettingsHolder = nil - obj.l2SettingsHolder = nil - obj.multiTopologyIdsHolder = nil - obj.trafficEngineeringHolder = nil - obj.authenticationHolder = nil - obj.advancedHolder = nil - obj.linkProtectionHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisInterface is configuration for single ISIS interface. -type IsisInterface interface { - Validation - // msg marshals IsisInterface to protobuf object *otg.IsisInterface - // and doesn't set defaults - msg() *otg.IsisInterface - // setMsg unmarshals IsisInterface from protobuf object *otg.IsisInterface - // and doesn't set defaults - setMsg(*otg.IsisInterface) IsisInterface - // provides marshal interface - Marshal() marshalIsisInterface - // provides unmarshal interface - Unmarshal() unMarshalIsisInterface - // validate validates IsisInterface - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisInterface, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // EthName returns string, set in IsisInterface. - EthName() string - // SetEthName assigns string provided by user to IsisInterface - SetEthName(value string) IsisInterface - // Metric returns uint32, set in IsisInterface. - Metric() uint32 - // SetMetric assigns uint32 provided by user to IsisInterface - SetMetric(value uint32) IsisInterface - // HasMetric checks if Metric has been set in IsisInterface - HasMetric() bool - // NetworkType returns IsisInterfaceNetworkTypeEnum, set in IsisInterface - NetworkType() IsisInterfaceNetworkTypeEnum - // SetNetworkType assigns IsisInterfaceNetworkTypeEnum provided by user to IsisInterface - SetNetworkType(value IsisInterfaceNetworkTypeEnum) IsisInterface - // HasNetworkType checks if NetworkType has been set in IsisInterface - HasNetworkType() bool - // LevelType returns IsisInterfaceLevelTypeEnum, set in IsisInterface - LevelType() IsisInterfaceLevelTypeEnum - // SetLevelType assigns IsisInterfaceLevelTypeEnum provided by user to IsisInterface - SetLevelType(value IsisInterfaceLevelTypeEnum) IsisInterface - // HasLevelType checks if LevelType has been set in IsisInterface - HasLevelType() bool - // L1Settings returns IsisInterfaceLevel, set in IsisInterface. - // IsisInterfaceLevel is configuration for the properties of Level 1 Hello. - L1Settings() IsisInterfaceLevel - // SetL1Settings assigns IsisInterfaceLevel provided by user to IsisInterface. - // IsisInterfaceLevel is configuration for the properties of Level 1 Hello. - SetL1Settings(value IsisInterfaceLevel) IsisInterface - // HasL1Settings checks if L1Settings has been set in IsisInterface - HasL1Settings() bool - // L2Settings returns IsisInterfaceLevel, set in IsisInterface. - // IsisInterfaceLevel is configuration for the properties of Level 1 Hello. - L2Settings() IsisInterfaceLevel - // SetL2Settings assigns IsisInterfaceLevel provided by user to IsisInterface. - // IsisInterfaceLevel is configuration for the properties of Level 1 Hello. - SetL2Settings(value IsisInterfaceLevel) IsisInterface - // HasL2Settings checks if L2Settings has been set in IsisInterface - HasL2Settings() bool - // MultiTopologyIds returns IsisInterfaceIsisMTIterIter, set in IsisInterface - MultiTopologyIds() IsisInterfaceIsisMTIter - // TrafficEngineering returns IsisInterfaceLinkStateTEIterIter, set in IsisInterface - TrafficEngineering() IsisInterfaceLinkStateTEIter - // Authentication returns IsisInterfaceAuthentication, set in IsisInterface. - // IsisInterfaceAuthentication is optional container for circuit authentication properties. - Authentication() IsisInterfaceAuthentication - // SetAuthentication assigns IsisInterfaceAuthentication provided by user to IsisInterface. - // IsisInterfaceAuthentication is optional container for circuit authentication properties. - SetAuthentication(value IsisInterfaceAuthentication) IsisInterface - // HasAuthentication checks if Authentication has been set in IsisInterface - HasAuthentication() bool - // Advanced returns IsisInterfaceAdvanced, set in IsisInterface. - // IsisInterfaceAdvanced is optional container for advanced interface properties. - Advanced() IsisInterfaceAdvanced - // SetAdvanced assigns IsisInterfaceAdvanced provided by user to IsisInterface. - // IsisInterfaceAdvanced is optional container for advanced interface properties. - SetAdvanced(value IsisInterfaceAdvanced) IsisInterface - // HasAdvanced checks if Advanced has been set in IsisInterface - HasAdvanced() bool - // LinkProtection returns IsisInterfaceLinkProtection, set in IsisInterface. - // IsisInterfaceLinkProtection is optional container for the link protection sub TLV (type 20). - LinkProtection() IsisInterfaceLinkProtection - // SetLinkProtection assigns IsisInterfaceLinkProtection provided by user to IsisInterface. - // IsisInterfaceLinkProtection is optional container for the link protection sub TLV (type 20). - SetLinkProtection(value IsisInterfaceLinkProtection) IsisInterface - // HasLinkProtection checks if LinkProtection has been set in IsisInterface - HasLinkProtection() bool - // SrlgValues returns []uint32, set in IsisInterface. - SrlgValues() []uint32 - // SetSrlgValues assigns []uint32 provided by user to IsisInterface - SetSrlgValues(value []uint32) IsisInterface - // Name returns string, set in IsisInterface. - Name() string - // SetName assigns string provided by user to IsisInterface - SetName(value string) IsisInterface - setNil() -} - -// The unique name of the Ethernet interface on which ISIS is running. Two ISIS interfaces cannot share the same Ethernet. -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// EthName returns a string -func (obj *isisInterface) EthName() string { - - return *obj.obj.EthName - -} - -// The unique name of the Ethernet interface on which ISIS is running. Two ISIS interfaces cannot share the same Ethernet. -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// -// SetEthName sets the string value in the IsisInterface object -func (obj *isisInterface) SetEthName(value string) IsisInterface { - - obj.obj.EthName = &value - return obj -} - -// The default metric cost for the interface. -// Metric returns a uint32 -func (obj *isisInterface) Metric() uint32 { - - return *obj.obj.Metric - -} - -// The default metric cost for the interface. -// Metric returns a uint32 -func (obj *isisInterface) HasMetric() bool { - return obj.obj.Metric != nil -} - -// The default metric cost for the interface. -// SetMetric sets the uint32 value in the IsisInterface object -func (obj *isisInterface) SetMetric(value uint32) IsisInterface { - - obj.obj.Metric = &value - return obj -} - -type IsisInterfaceNetworkTypeEnum string - -// Enum of NetworkType on IsisInterface -var IsisInterfaceNetworkType = struct { - BROADCAST IsisInterfaceNetworkTypeEnum - POINT_TO_POINT IsisInterfaceNetworkTypeEnum -}{ - BROADCAST: IsisInterfaceNetworkTypeEnum("broadcast"), - POINT_TO_POINT: IsisInterfaceNetworkTypeEnum("point_to_point"), -} - -func (obj *isisInterface) NetworkType() IsisInterfaceNetworkTypeEnum { - return IsisInterfaceNetworkTypeEnum(obj.obj.NetworkType.Enum().String()) -} - -// The type of network link. -// NetworkType returns a string -func (obj *isisInterface) HasNetworkType() bool { - return obj.obj.NetworkType != nil -} - -func (obj *isisInterface) SetNetworkType(value IsisInterfaceNetworkTypeEnum) IsisInterface { - intValue, ok := otg.IsisInterface_NetworkType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on IsisInterfaceNetworkTypeEnum", string(value))) - return obj - } - enumValue := otg.IsisInterface_NetworkType_Enum(intValue) - obj.obj.NetworkType = &enumValue - - return obj -} - -type IsisInterfaceLevelTypeEnum string - -// Enum of LevelType on IsisInterface -var IsisInterfaceLevelType = struct { - LEVEL_1 IsisInterfaceLevelTypeEnum - LEVEL_2 IsisInterfaceLevelTypeEnum - LEVEL_1_2 IsisInterfaceLevelTypeEnum -}{ - LEVEL_1: IsisInterfaceLevelTypeEnum("level_1"), - LEVEL_2: IsisInterfaceLevelTypeEnum("level_2"), - LEVEL_1_2: IsisInterfaceLevelTypeEnum("level_1_2"), -} - -func (obj *isisInterface) LevelType() IsisInterfaceLevelTypeEnum { - return IsisInterfaceLevelTypeEnum(obj.obj.LevelType.Enum().String()) -} - -// This indicates whether this router is participating in Level-1 (L1), -// Level-2 (L2) or both L1 and L2 domains on this interface. -// LevelType returns a string -func (obj *isisInterface) HasLevelType() bool { - return obj.obj.LevelType != nil -} - -func (obj *isisInterface) SetLevelType(value IsisInterfaceLevelTypeEnum) IsisInterface { - intValue, ok := otg.IsisInterface_LevelType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on IsisInterfaceLevelTypeEnum", string(value))) - return obj - } - enumValue := otg.IsisInterface_LevelType_Enum(intValue) - obj.obj.LevelType = &enumValue - - return obj -} - -// Settings of Level 1 Hello. -// L1Settings returns a IsisInterfaceLevel -func (obj *isisInterface) L1Settings() IsisInterfaceLevel { - if obj.obj.L1Settings == nil { - obj.obj.L1Settings = NewIsisInterfaceLevel().msg() - } - if obj.l1SettingsHolder == nil { - obj.l1SettingsHolder = &isisInterfaceLevel{obj: obj.obj.L1Settings} - } - return obj.l1SettingsHolder -} - -// Settings of Level 1 Hello. -// L1Settings returns a IsisInterfaceLevel -func (obj *isisInterface) HasL1Settings() bool { - return obj.obj.L1Settings != nil -} - -// Settings of Level 1 Hello. -// SetL1Settings sets the IsisInterfaceLevel value in the IsisInterface object -func (obj *isisInterface) SetL1Settings(value IsisInterfaceLevel) IsisInterface { - - obj.l1SettingsHolder = nil - obj.obj.L1Settings = value.msg() - - return obj -} - -// Settings of Level 2 Hello. -// L2Settings returns a IsisInterfaceLevel -func (obj *isisInterface) L2Settings() IsisInterfaceLevel { - if obj.obj.L2Settings == nil { - obj.obj.L2Settings = NewIsisInterfaceLevel().msg() - } - if obj.l2SettingsHolder == nil { - obj.l2SettingsHolder = &isisInterfaceLevel{obj: obj.obj.L2Settings} - } - return obj.l2SettingsHolder -} - -// Settings of Level 2 Hello. -// L2Settings returns a IsisInterfaceLevel -func (obj *isisInterface) HasL2Settings() bool { - return obj.obj.L2Settings != nil -} - -// Settings of Level 2 Hello. -// SetL2Settings sets the IsisInterfaceLevel value in the IsisInterface object -func (obj *isisInterface) SetL2Settings(value IsisInterfaceLevel) IsisInterface { - - obj.l2SettingsHolder = nil - obj.obj.L2Settings = value.msg() - - return obj -} - -// Contains the properties of multiple topologies. -// MultiTopologyIds returns a []IsisMT -func (obj *isisInterface) MultiTopologyIds() IsisInterfaceIsisMTIter { - if len(obj.obj.MultiTopologyIds) == 0 { - obj.obj.MultiTopologyIds = []*otg.IsisMT{} - } - if obj.multiTopologyIdsHolder == nil { - obj.multiTopologyIdsHolder = newIsisInterfaceIsisMTIter(&obj.obj.MultiTopologyIds).setMsg(obj) - } - return obj.multiTopologyIdsHolder -} - -type isisInterfaceIsisMTIter struct { - obj *isisInterface - isisMTSlice []IsisMT - fieldPtr *[]*otg.IsisMT -} - -func newIsisInterfaceIsisMTIter(ptr *[]*otg.IsisMT) IsisInterfaceIsisMTIter { - return &isisInterfaceIsisMTIter{fieldPtr: ptr} -} - -type IsisInterfaceIsisMTIter interface { - setMsg(*isisInterface) IsisInterfaceIsisMTIter - Items() []IsisMT - Add() IsisMT - Append(items ...IsisMT) IsisInterfaceIsisMTIter - Set(index int, newObj IsisMT) IsisInterfaceIsisMTIter - Clear() IsisInterfaceIsisMTIter - clearHolderSlice() IsisInterfaceIsisMTIter - appendHolderSlice(item IsisMT) IsisInterfaceIsisMTIter -} - -func (obj *isisInterfaceIsisMTIter) setMsg(msg *isisInterface) IsisInterfaceIsisMTIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisMT{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisInterfaceIsisMTIter) Items() []IsisMT { - return obj.isisMTSlice -} - -func (obj *isisInterfaceIsisMTIter) Add() IsisMT { - newObj := &otg.IsisMT{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisMT{obj: newObj} - newLibObj.setDefault() - obj.isisMTSlice = append(obj.isisMTSlice, newLibObj) - return newLibObj -} - -func (obj *isisInterfaceIsisMTIter) Append(items ...IsisMT) IsisInterfaceIsisMTIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisMTSlice = append(obj.isisMTSlice, item) - } - return obj -} - -func (obj *isisInterfaceIsisMTIter) Set(index int, newObj IsisMT) IsisInterfaceIsisMTIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisMTSlice[index] = newObj - return obj -} -func (obj *isisInterfaceIsisMTIter) Clear() IsisInterfaceIsisMTIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisMT{} - obj.isisMTSlice = []IsisMT{} - } - return obj -} -func (obj *isisInterfaceIsisMTIter) clearHolderSlice() IsisInterfaceIsisMTIter { - if len(obj.isisMTSlice) > 0 { - obj.isisMTSlice = []IsisMT{} - } - return obj -} -func (obj *isisInterfaceIsisMTIter) appendHolderSlice(item IsisMT) IsisInterfaceIsisMTIter { - obj.isisMTSlice = append(obj.isisMTSlice, item) - return obj -} - -// Contains a list of Traffic Engineering attributes. -// TrafficEngineering returns a []LinkStateTE -func (obj *isisInterface) TrafficEngineering() IsisInterfaceLinkStateTEIter { - if len(obj.obj.TrafficEngineering) == 0 { - obj.obj.TrafficEngineering = []*otg.LinkStateTE{} - } - if obj.trafficEngineeringHolder == nil { - obj.trafficEngineeringHolder = newIsisInterfaceLinkStateTEIter(&obj.obj.TrafficEngineering).setMsg(obj) - } - return obj.trafficEngineeringHolder -} - -type isisInterfaceLinkStateTEIter struct { - obj *isisInterface - linkStateTESlice []LinkStateTE - fieldPtr *[]*otg.LinkStateTE -} - -func newIsisInterfaceLinkStateTEIter(ptr *[]*otg.LinkStateTE) IsisInterfaceLinkStateTEIter { - return &isisInterfaceLinkStateTEIter{fieldPtr: ptr} -} - -type IsisInterfaceLinkStateTEIter interface { - setMsg(*isisInterface) IsisInterfaceLinkStateTEIter - Items() []LinkStateTE - Add() LinkStateTE - Append(items ...LinkStateTE) IsisInterfaceLinkStateTEIter - Set(index int, newObj LinkStateTE) IsisInterfaceLinkStateTEIter - Clear() IsisInterfaceLinkStateTEIter - clearHolderSlice() IsisInterfaceLinkStateTEIter - appendHolderSlice(item LinkStateTE) IsisInterfaceLinkStateTEIter -} - -func (obj *isisInterfaceLinkStateTEIter) setMsg(msg *isisInterface) IsisInterfaceLinkStateTEIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&linkStateTE{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisInterfaceLinkStateTEIter) Items() []LinkStateTE { - return obj.linkStateTESlice -} - -func (obj *isisInterfaceLinkStateTEIter) Add() LinkStateTE { - newObj := &otg.LinkStateTE{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &linkStateTE{obj: newObj} - newLibObj.setDefault() - obj.linkStateTESlice = append(obj.linkStateTESlice, newLibObj) - return newLibObj -} - -func (obj *isisInterfaceLinkStateTEIter) Append(items ...LinkStateTE) IsisInterfaceLinkStateTEIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.linkStateTESlice = append(obj.linkStateTESlice, item) - } - return obj -} - -func (obj *isisInterfaceLinkStateTEIter) Set(index int, newObj LinkStateTE) IsisInterfaceLinkStateTEIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.linkStateTESlice[index] = newObj - return obj -} -func (obj *isisInterfaceLinkStateTEIter) Clear() IsisInterfaceLinkStateTEIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.LinkStateTE{} - obj.linkStateTESlice = []LinkStateTE{} - } - return obj -} -func (obj *isisInterfaceLinkStateTEIter) clearHolderSlice() IsisInterfaceLinkStateTEIter { - if len(obj.linkStateTESlice) > 0 { - obj.linkStateTESlice = []LinkStateTE{} - } - return obj -} -func (obj *isisInterfaceLinkStateTEIter) appendHolderSlice(item LinkStateTE) IsisInterfaceLinkStateTEIter { - obj.linkStateTESlice = append(obj.linkStateTESlice, item) - return obj -} - -// The Circuit authentication method used for the interfaces on this emulated ISIS v4/v6 router. -// Authentication returns a IsisInterfaceAuthentication -func (obj *isisInterface) Authentication() IsisInterfaceAuthentication { - if obj.obj.Authentication == nil { - obj.obj.Authentication = NewIsisInterfaceAuthentication().msg() - } - if obj.authenticationHolder == nil { - obj.authenticationHolder = &isisInterfaceAuthentication{obj: obj.obj.Authentication} - } - return obj.authenticationHolder -} - -// The Circuit authentication method used for the interfaces on this emulated ISIS v4/v6 router. -// Authentication returns a IsisInterfaceAuthentication -func (obj *isisInterface) HasAuthentication() bool { - return obj.obj.Authentication != nil -} - -// The Circuit authentication method used for the interfaces on this emulated ISIS v4/v6 router. -// SetAuthentication sets the IsisInterfaceAuthentication value in the IsisInterface object -func (obj *isisInterface) SetAuthentication(value IsisInterfaceAuthentication) IsisInterface { - - obj.authenticationHolder = nil - obj.obj.Authentication = value.msg() - - return obj -} - -// Optional container for advanced interface properties. -// Advanced returns a IsisInterfaceAdvanced -func (obj *isisInterface) Advanced() IsisInterfaceAdvanced { - if obj.obj.Advanced == nil { - obj.obj.Advanced = NewIsisInterfaceAdvanced().msg() - } - if obj.advancedHolder == nil { - obj.advancedHolder = &isisInterfaceAdvanced{obj: obj.obj.Advanced} - } - return obj.advancedHolder -} - -// Optional container for advanced interface properties. -// Advanced returns a IsisInterfaceAdvanced -func (obj *isisInterface) HasAdvanced() bool { - return obj.obj.Advanced != nil -} - -// Optional container for advanced interface properties. -// SetAdvanced sets the IsisInterfaceAdvanced value in the IsisInterface object -func (obj *isisInterface) SetAdvanced(value IsisInterfaceAdvanced) IsisInterface { - - obj.advancedHolder = nil - obj.obj.Advanced = value.msg() - - return obj -} - -// Link protection on the ISIS link between two interfaces. -// LinkProtection returns a IsisInterfaceLinkProtection -func (obj *isisInterface) LinkProtection() IsisInterfaceLinkProtection { - if obj.obj.LinkProtection == nil { - obj.obj.LinkProtection = NewIsisInterfaceLinkProtection().msg() - } - if obj.linkProtectionHolder == nil { - obj.linkProtectionHolder = &isisInterfaceLinkProtection{obj: obj.obj.LinkProtection} - } - return obj.linkProtectionHolder -} - -// Link protection on the ISIS link between two interfaces. -// LinkProtection returns a IsisInterfaceLinkProtection -func (obj *isisInterface) HasLinkProtection() bool { - return obj.obj.LinkProtection != nil -} - -// Link protection on the ISIS link between two interfaces. -// SetLinkProtection sets the IsisInterfaceLinkProtection value in the IsisInterface object -func (obj *isisInterface) SetLinkProtection(value IsisInterfaceLinkProtection) IsisInterface { - - obj.linkProtectionHolder = nil - obj.obj.LinkProtection = value.msg() - - return obj -} - -// This contains list of SRLG values for the link between two interfaces. -// SrlgValues returns a []uint32 -func (obj *isisInterface) SrlgValues() []uint32 { - if obj.obj.SrlgValues == nil { - obj.obj.SrlgValues = make([]uint32, 0) - } - return obj.obj.SrlgValues -} - -// This contains list of SRLG values for the link between two interfaces. -// SetSrlgValues sets the []uint32 value in the IsisInterface object -func (obj *isisInterface) SetSrlgValues(value []uint32) IsisInterface { - - if obj.obj.SrlgValues == nil { - obj.obj.SrlgValues = make([]uint32, 0) - } - obj.obj.SrlgValues = value - - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *isisInterface) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the IsisInterface object -func (obj *isisInterface) SetName(value string) IsisInterface { - - obj.obj.Name = &value - return obj -} - -func (obj *isisInterface) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // EthName is required - if obj.obj.EthName == nil { - vObj.validationErrors = append(vObj.validationErrors, "EthName is required field on interface IsisInterface") - } - - if obj.obj.Metric != nil { - - if *obj.obj.Metric > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= IsisInterface.Metric <= 16777215 but Got %d", *obj.obj.Metric)) - } - - } - - if obj.obj.L1Settings != nil { - - obj.L1Settings().validateObj(vObj, set_default) - } - - if obj.obj.L2Settings != nil { - - obj.L2Settings().validateObj(vObj, set_default) - } - - if len(obj.obj.MultiTopologyIds) != 0 { - - if set_default { - obj.MultiTopologyIds().clearHolderSlice() - for _, item := range obj.obj.MultiTopologyIds { - obj.MultiTopologyIds().appendHolderSlice(&isisMT{obj: item}) - } - } - for _, item := range obj.MultiTopologyIds().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.TrafficEngineering) != 0 { - - if set_default { - obj.TrafficEngineering().clearHolderSlice() - for _, item := range obj.obj.TrafficEngineering { - obj.TrafficEngineering().appendHolderSlice(&linkStateTE{obj: item}) - } - } - for _, item := range obj.TrafficEngineering().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Authentication != nil { - - obj.Authentication().validateObj(vObj, set_default) - } - - if obj.obj.Advanced != nil { - - obj.Advanced().validateObj(vObj, set_default) - } - - if obj.obj.LinkProtection != nil { - - obj.LinkProtection().validateObj(vObj, set_default) - } - - if obj.obj.SrlgValues != nil { - - for _, item := range obj.obj.SrlgValues { - if item > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= IsisInterface.SrlgValues <= 16777215 but Got %d", item)) - } - - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface IsisInterface") - } -} - -func (obj *isisInterface) setDefault() { - if obj.obj.Metric == nil { - obj.SetMetric(10) - } - if obj.obj.NetworkType == nil { - obj.SetNetworkType(IsisInterfaceNetworkType.BROADCAST) - - } - if obj.obj.LevelType == nil { - obj.SetLevelType(IsisInterfaceLevelType.LEVEL_2) - - } - -} - -// ***** IsisBasic ***** -type isisBasic struct { - validation - obj *otg.IsisBasic - marshaller marshalIsisBasic - unMarshaller unMarshalIsisBasic -} - -func NewIsisBasic() IsisBasic { - obj := isisBasic{obj: &otg.IsisBasic{}} - obj.setDefault() - return &obj -} - -func (obj *isisBasic) msg() *otg.IsisBasic { - return obj.obj -} - -func (obj *isisBasic) setMsg(msg *otg.IsisBasic) IsisBasic { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisBasic struct { - obj *isisBasic -} - -type marshalIsisBasic interface { - // ToProto marshals IsisBasic to protobuf object *otg.IsisBasic - ToProto() (*otg.IsisBasic, error) - // ToPbText marshals IsisBasic to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisBasic to YAML text - ToYaml() (string, error) - // ToJson marshals IsisBasic to JSON text - ToJson() (string, error) -} - -type unMarshalisisBasic struct { - obj *isisBasic -} - -type unMarshalIsisBasic interface { - // FromProto unmarshals IsisBasic from protobuf object *otg.IsisBasic - FromProto(msg *otg.IsisBasic) (IsisBasic, error) - // FromPbText unmarshals IsisBasic from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisBasic from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisBasic from JSON text - FromJson(value string) error -} - -func (obj *isisBasic) Marshal() marshalIsisBasic { - if obj.marshaller == nil { - obj.marshaller = &marshalisisBasic{obj: obj} - } - return obj.marshaller -} - -func (obj *isisBasic) Unmarshal() unMarshalIsisBasic { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisBasic{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisBasic) ToProto() (*otg.IsisBasic, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisBasic) FromProto(msg *otg.IsisBasic) (IsisBasic, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisBasic) 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 *unMarshalisisBasic) 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 *marshalisisBasic) 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 *unMarshalisisBasic) 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 *marshalisisBasic) 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 *unMarshalisisBasic) 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 *isisBasic) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisBasic) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisBasic) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisBasic) Clone() (IsisBasic, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisBasic() - 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 -} - -// IsisBasic is this contains ISIS router basic properties. -type IsisBasic interface { - Validation - // msg marshals IsisBasic to protobuf object *otg.IsisBasic - // and doesn't set defaults - msg() *otg.IsisBasic - // setMsg unmarshals IsisBasic from protobuf object *otg.IsisBasic - // and doesn't set defaults - setMsg(*otg.IsisBasic) IsisBasic - // provides marshal interface - Marshal() marshalIsisBasic - // provides unmarshal interface - Unmarshal() unMarshalIsisBasic - // validate validates IsisBasic - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisBasic, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv4TeRouterId returns string, set in IsisBasic. - Ipv4TeRouterId() string - // SetIpv4TeRouterId assigns string provided by user to IsisBasic - SetIpv4TeRouterId(value string) IsisBasic - // HasIpv4TeRouterId checks if Ipv4TeRouterId has been set in IsisBasic - HasIpv4TeRouterId() bool - // Hostname returns string, set in IsisBasic. - Hostname() string - // SetHostname assigns string provided by user to IsisBasic - SetHostname(value string) IsisBasic - // HasHostname checks if Hostname has been set in IsisBasic - HasHostname() bool - // EnableWideMetric returns bool, set in IsisBasic. - EnableWideMetric() bool - // SetEnableWideMetric assigns bool provided by user to IsisBasic - SetEnableWideMetric(value bool) IsisBasic - // HasEnableWideMetric checks if EnableWideMetric has been set in IsisBasic - HasEnableWideMetric() bool - // LearnedLspFilter returns bool, set in IsisBasic. - LearnedLspFilter() bool - // SetLearnedLspFilter assigns bool provided by user to IsisBasic - SetLearnedLspFilter(value bool) IsisBasic - // HasLearnedLspFilter checks if LearnedLspFilter has been set in IsisBasic - HasLearnedLspFilter() bool -} - -// IPv4 Traffic Engineering(TE) router id. This address should be configured as an IPv4 Loopback address in 'ipv4_loopbacks' in the Device. -// Ipv4TeRouterId returns a string -func (obj *isisBasic) Ipv4TeRouterId() string { - - return *obj.obj.Ipv4TeRouterId - -} - -// IPv4 Traffic Engineering(TE) router id. This address should be configured as an IPv4 Loopback address in 'ipv4_loopbacks' in the Device. -// Ipv4TeRouterId returns a string -func (obj *isisBasic) HasIpv4TeRouterId() bool { - return obj.obj.Ipv4TeRouterId != nil -} - -// IPv4 Traffic Engineering(TE) router id. This address should be configured as an IPv4 Loopback address in 'ipv4_loopbacks' in the Device. -// SetIpv4TeRouterId sets the string value in the IsisBasic object -func (obj *isisBasic) SetIpv4TeRouterId(value string) IsisBasic { - - obj.obj.Ipv4TeRouterId = &value - return obj -} - -// Host name for the router. The host name is transmitted in all the packets sent from the router. -// Hostname returns a string -func (obj *isisBasic) Hostname() string { - - return *obj.obj.Hostname - -} - -// Host name for the router. The host name is transmitted in all the packets sent from the router. -// Hostname returns a string -func (obj *isisBasic) HasHostname() bool { - return obj.obj.Hostname != nil -} - -// Host name for the router. The host name is transmitted in all the packets sent from the router. -// SetHostname sets the string value in the IsisBasic object -func (obj *isisBasic) SetHostname(value string) IsisBasic { - - obj.obj.Hostname = &value - return obj -} - -// When set to true, it allows sending of more detailed metric information for the routes using 32-bit wide values using TLV 135 IP reachability and more detailed reachability information for IS reachability by using TLV 22. The detailed usage is described in RFC3784. -// EnableWideMetric returns a bool -func (obj *isisBasic) EnableWideMetric() bool { - - return *obj.obj.EnableWideMetric - -} - -// When set to true, it allows sending of more detailed metric information for the routes using 32-bit wide values using TLV 135 IP reachability and more detailed reachability information for IS reachability by using TLV 22. The detailed usage is described in RFC3784. -// EnableWideMetric returns a bool -func (obj *isisBasic) HasEnableWideMetric() bool { - return obj.obj.EnableWideMetric != nil -} - -// When set to true, it allows sending of more detailed metric information for the routes using 32-bit wide values using TLV 135 IP reachability and more detailed reachability information for IS reachability by using TLV 22. The detailed usage is described in RFC3784. -// SetEnableWideMetric sets the bool value in the IsisBasic object -func (obj *isisBasic) SetEnableWideMetric(value bool) IsisBasic { - - obj.obj.EnableWideMetric = &value - return obj -} - -// Configuration for controlling storage of ISIS learned LSPs are received from the neighbors. -// LearnedLspFilter returns a bool -func (obj *isisBasic) LearnedLspFilter() bool { - - return *obj.obj.LearnedLspFilter - -} - -// Configuration for controlling storage of ISIS learned LSPs are received from the neighbors. -// LearnedLspFilter returns a bool -func (obj *isisBasic) HasLearnedLspFilter() bool { - return obj.obj.LearnedLspFilter != nil -} - -// Configuration for controlling storage of ISIS learned LSPs are received from the neighbors. -// SetLearnedLspFilter sets the bool value in the IsisBasic object -func (obj *isisBasic) SetLearnedLspFilter(value bool) IsisBasic { - - obj.obj.LearnedLspFilter = &value - return obj -} - -func (obj *isisBasic) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv4TeRouterId != nil { - - err := obj.validateIpv4(obj.Ipv4TeRouterId()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on IsisBasic.Ipv4TeRouterId")) - } - - } - -} - -func (obj *isisBasic) setDefault() { - if obj.obj.EnableWideMetric == nil { - obj.SetEnableWideMetric(true) - } - if obj.obj.LearnedLspFilter == nil { - obj.SetLearnedLspFilter(false) - } - -} - -// ***** IsisAdvanced ***** -type isisAdvanced struct { - validation - obj *otg.IsisAdvanced - marshaller marshalIsisAdvanced - unMarshaller unMarshalIsisAdvanced -} - -func NewIsisAdvanced() IsisAdvanced { - obj := isisAdvanced{obj: &otg.IsisAdvanced{}} - obj.setDefault() - return &obj -} - -func (obj *isisAdvanced) msg() *otg.IsisAdvanced { - return obj.obj -} - -func (obj *isisAdvanced) setMsg(msg *otg.IsisAdvanced) IsisAdvanced { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisAdvanced struct { - obj *isisAdvanced -} - -type marshalIsisAdvanced interface { - // ToProto marshals IsisAdvanced to protobuf object *otg.IsisAdvanced - ToProto() (*otg.IsisAdvanced, error) - // ToPbText marshals IsisAdvanced to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisAdvanced to YAML text - ToYaml() (string, error) - // ToJson marshals IsisAdvanced to JSON text - ToJson() (string, error) -} - -type unMarshalisisAdvanced struct { - obj *isisAdvanced -} - -type unMarshalIsisAdvanced interface { - // FromProto unmarshals IsisAdvanced from protobuf object *otg.IsisAdvanced - FromProto(msg *otg.IsisAdvanced) (IsisAdvanced, error) - // FromPbText unmarshals IsisAdvanced from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisAdvanced from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisAdvanced from JSON text - FromJson(value string) error -} - -func (obj *isisAdvanced) Marshal() marshalIsisAdvanced { - if obj.marshaller == nil { - obj.marshaller = &marshalisisAdvanced{obj: obj} - } - return obj.marshaller -} - -func (obj *isisAdvanced) Unmarshal() unMarshalIsisAdvanced { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisAdvanced{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisAdvanced) ToProto() (*otg.IsisAdvanced, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisAdvanced) FromProto(msg *otg.IsisAdvanced) (IsisAdvanced, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisAdvanced) 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 *unMarshalisisAdvanced) 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 *marshalisisAdvanced) 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 *unMarshalisisAdvanced) 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 *marshalisisAdvanced) 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 *unMarshalisisAdvanced) 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 *isisAdvanced) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisAdvanced) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisAdvanced) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisAdvanced) Clone() (IsisAdvanced, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisAdvanced() - 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 -} - -// IsisAdvanced is contains ISIS router advanced properties. -type IsisAdvanced interface { - Validation - // msg marshals IsisAdvanced to protobuf object *otg.IsisAdvanced - // and doesn't set defaults - msg() *otg.IsisAdvanced - // setMsg unmarshals IsisAdvanced from protobuf object *otg.IsisAdvanced - // and doesn't set defaults - setMsg(*otg.IsisAdvanced) IsisAdvanced - // provides marshal interface - Marshal() marshalIsisAdvanced - // provides unmarshal interface - Unmarshal() unMarshalIsisAdvanced - // validate validates IsisAdvanced - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisAdvanced, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // EnableHelloPadding returns bool, set in IsisAdvanced. - EnableHelloPadding() bool - // SetEnableHelloPadding assigns bool provided by user to IsisAdvanced - SetEnableHelloPadding(value bool) IsisAdvanced - // HasEnableHelloPadding checks if EnableHelloPadding has been set in IsisAdvanced - HasEnableHelloPadding() bool - // MaxAreaAddresses returns uint32, set in IsisAdvanced. - MaxAreaAddresses() uint32 - // SetMaxAreaAddresses assigns uint32 provided by user to IsisAdvanced - SetMaxAreaAddresses(value uint32) IsisAdvanced - // HasMaxAreaAddresses checks if MaxAreaAddresses has been set in IsisAdvanced - HasMaxAreaAddresses() bool - // AreaAddresses returns []string, set in IsisAdvanced. - AreaAddresses() []string - // SetAreaAddresses assigns []string provided by user to IsisAdvanced - SetAreaAddresses(value []string) IsisAdvanced - // LspRefreshRate returns uint32, set in IsisAdvanced. - LspRefreshRate() uint32 - // SetLspRefreshRate assigns uint32 provided by user to IsisAdvanced - SetLspRefreshRate(value uint32) IsisAdvanced - // HasLspRefreshRate checks if LspRefreshRate has been set in IsisAdvanced - HasLspRefreshRate() bool - // LspLifetime returns uint32, set in IsisAdvanced. - LspLifetime() uint32 - // SetLspLifetime assigns uint32 provided by user to IsisAdvanced - SetLspLifetime(value uint32) IsisAdvanced - // HasLspLifetime checks if LspLifetime has been set in IsisAdvanced - HasLspLifetime() bool - // PsnpInterval returns uint32, set in IsisAdvanced. - PsnpInterval() uint32 - // SetPsnpInterval assigns uint32 provided by user to IsisAdvanced - SetPsnpInterval(value uint32) IsisAdvanced - // HasPsnpInterval checks if PsnpInterval has been set in IsisAdvanced - HasPsnpInterval() bool - // CsnpInterval returns uint32, set in IsisAdvanced. - CsnpInterval() uint32 - // SetCsnpInterval assigns uint32 provided by user to IsisAdvanced - SetCsnpInterval(value uint32) IsisAdvanced - // HasCsnpInterval checks if CsnpInterval has been set in IsisAdvanced - HasCsnpInterval() bool - // MaxLspSize returns uint32, set in IsisAdvanced. - MaxLspSize() uint32 - // SetMaxLspSize assigns uint32 provided by user to IsisAdvanced - SetMaxLspSize(value uint32) IsisAdvanced - // HasMaxLspSize checks if MaxLspSize has been set in IsisAdvanced - HasMaxLspSize() bool - // LspMgroupMinTransInterval returns uint32, set in IsisAdvanced. - LspMgroupMinTransInterval() uint32 - // SetLspMgroupMinTransInterval assigns uint32 provided by user to IsisAdvanced - SetLspMgroupMinTransInterval(value uint32) IsisAdvanced - // HasLspMgroupMinTransInterval checks if LspMgroupMinTransInterval has been set in IsisAdvanced - HasLspMgroupMinTransInterval() bool - // EnableAttachedBit returns bool, set in IsisAdvanced. - EnableAttachedBit() bool - // SetEnableAttachedBit assigns bool provided by user to IsisAdvanced - SetEnableAttachedBit(value bool) IsisAdvanced - // HasEnableAttachedBit checks if EnableAttachedBit has been set in IsisAdvanced - HasEnableAttachedBit() bool -} - -// It enables padding of Hello message to MTU size. -// EnableHelloPadding returns a bool -func (obj *isisAdvanced) EnableHelloPadding() bool { - - return *obj.obj.EnableHelloPadding - -} - -// It enables padding of Hello message to MTU size. -// EnableHelloPadding returns a bool -func (obj *isisAdvanced) HasEnableHelloPadding() bool { - return obj.obj.EnableHelloPadding != nil -} - -// It enables padding of Hello message to MTU size. -// SetEnableHelloPadding sets the bool value in the IsisAdvanced object -func (obj *isisAdvanced) SetEnableHelloPadding(value bool) IsisAdvanced { - - obj.obj.EnableHelloPadding = &value - return obj -} - -// The Number of Area Addresses permitted, with a valid range from 0 to 254. A zero indicates a maximum of 3 addresses. -// MaxAreaAddresses returns a uint32 -func (obj *isisAdvanced) MaxAreaAddresses() uint32 { - - return *obj.obj.MaxAreaAddresses - -} - -// The Number of Area Addresses permitted, with a valid range from 0 to 254. A zero indicates a maximum of 3 addresses. -// MaxAreaAddresses returns a uint32 -func (obj *isisAdvanced) HasMaxAreaAddresses() bool { - return obj.obj.MaxAreaAddresses != nil -} - -// The Number of Area Addresses permitted, with a valid range from 0 to 254. A zero indicates a maximum of 3 addresses. -// SetMaxAreaAddresses sets the uint32 value in the IsisAdvanced object -func (obj *isisAdvanced) SetMaxAreaAddresses(value uint32) IsisAdvanced { - - obj.obj.MaxAreaAddresses = &value - return obj -} - -// Its combination of the ISP and HO-DSP.Usually all nodes within an area have the same area address. If no area addresses are configured, a default area of "490001" will be advertised. -// AreaAddresses returns a []string -func (obj *isisAdvanced) AreaAddresses() []string { - if obj.obj.AreaAddresses == nil { - obj.obj.AreaAddresses = make([]string, 0) - } - return obj.obj.AreaAddresses -} - -// Its combination of the ISP and HO-DSP.Usually all nodes within an area have the same area address. If no area addresses are configured, a default area of "490001" will be advertised. -// SetAreaAddresses sets the []string value in the IsisAdvanced object -func (obj *isisAdvanced) SetAreaAddresses(value []string) IsisAdvanced { - - if obj.obj.AreaAddresses == nil { - obj.obj.AreaAddresses = make([]string, 0) - } - obj.obj.AreaAddresses = value - - return obj -} - -// The rate at which LSPs are re-sent in seconds. -// LspRefreshRate returns a uint32 -func (obj *isisAdvanced) LspRefreshRate() uint32 { - - return *obj.obj.LspRefreshRate - -} - -// The rate at which LSPs are re-sent in seconds. -// LspRefreshRate returns a uint32 -func (obj *isisAdvanced) HasLspRefreshRate() bool { - return obj.obj.LspRefreshRate != nil -} - -// The rate at which LSPs are re-sent in seconds. -// SetLspRefreshRate sets the uint32 value in the IsisAdvanced object -func (obj *isisAdvanced) SetLspRefreshRate(value uint32) IsisAdvanced { - - obj.obj.LspRefreshRate = &value - return obj -} - -// The MaxAge for retaining a learned LSP on this router in seconds. -// LspLifetime returns a uint32 -func (obj *isisAdvanced) LspLifetime() uint32 { - - return *obj.obj.LspLifetime - -} - -// The MaxAge for retaining a learned LSP on this router in seconds. -// LspLifetime returns a uint32 -func (obj *isisAdvanced) HasLspLifetime() bool { - return obj.obj.LspLifetime != nil -} - -// The MaxAge for retaining a learned LSP on this router in seconds. -// SetLspLifetime sets the uint32 value in the IsisAdvanced object -func (obj *isisAdvanced) SetLspLifetime(value uint32) IsisAdvanced { - - obj.obj.LspLifetime = &value - return obj -} - -// The number of milliseconds between transmissions of Partial Sequence Number PDU. -// PsnpInterval returns a uint32 -func (obj *isisAdvanced) PsnpInterval() uint32 { - - return *obj.obj.PsnpInterval - -} - -// The number of milliseconds between transmissions of Partial Sequence Number PDU. -// PsnpInterval returns a uint32 -func (obj *isisAdvanced) HasPsnpInterval() bool { - return obj.obj.PsnpInterval != nil -} - -// The number of milliseconds between transmissions of Partial Sequence Number PDU. -// SetPsnpInterval sets the uint32 value in the IsisAdvanced object -func (obj *isisAdvanced) SetPsnpInterval(value uint32) IsisAdvanced { - - obj.obj.PsnpInterval = &value - return obj -} - -// The number of milliseconds between transmissions of Partial Sequence Number PDU. -// CsnpInterval returns a uint32 -func (obj *isisAdvanced) CsnpInterval() uint32 { - - return *obj.obj.CsnpInterval - -} - -// The number of milliseconds between transmissions of Partial Sequence Number PDU. -// CsnpInterval returns a uint32 -func (obj *isisAdvanced) HasCsnpInterval() bool { - return obj.obj.CsnpInterval != nil -} - -// The number of milliseconds between transmissions of Partial Sequence Number PDU. -// SetCsnpInterval sets the uint32 value in the IsisAdvanced object -func (obj *isisAdvanced) SetCsnpInterval(value uint32) IsisAdvanced { - - obj.obj.CsnpInterval = &value - return obj -} - -// The maximum size in bytes of any LSP that can be transmitted over a link of equal or less than maximum MTU size. -// MaxLspSize returns a uint32 -func (obj *isisAdvanced) MaxLspSize() uint32 { - - return *obj.obj.MaxLspSize - -} - -// The maximum size in bytes of any LSP that can be transmitted over a link of equal or less than maximum MTU size. -// MaxLspSize returns a uint32 -func (obj *isisAdvanced) HasMaxLspSize() bool { - return obj.obj.MaxLspSize != nil -} - -// The maximum size in bytes of any LSP that can be transmitted over a link of equal or less than maximum MTU size. -// SetMaxLspSize sets the uint32 value in the IsisAdvanced object -func (obj *isisAdvanced) SetMaxLspSize(value uint32) IsisAdvanced { - - obj.obj.MaxLspSize = &value - return obj -} - -// The number of seconds between transmissions of LSPs/MGROUP-PDUs. -// LspMgroupMinTransInterval returns a uint32 -func (obj *isisAdvanced) LspMgroupMinTransInterval() uint32 { - - return *obj.obj.LspMgroupMinTransInterval - -} - -// The number of seconds between transmissions of LSPs/MGROUP-PDUs. -// LspMgroupMinTransInterval returns a uint32 -func (obj *isisAdvanced) HasLspMgroupMinTransInterval() bool { - return obj.obj.LspMgroupMinTransInterval != nil -} - -// The number of seconds between transmissions of LSPs/MGROUP-PDUs. -// SetLspMgroupMinTransInterval sets the uint32 value in the IsisAdvanced object -func (obj *isisAdvanced) SetLspMgroupMinTransInterval(value uint32) IsisAdvanced { - - obj.obj.LspMgroupMinTransInterval = &value - return obj -} - -// If the Attached bit is enabled, it indicates that the ISIS router is attached to another area or the Level 2 backbone. The purpose of an Attached-Bit is to accomplish Inter-Area Routing. When an L1/L2 router is connected to more than one area, it sets the Attached-bit on its L1 LSP. This can cause a default route ( 0.0.0.0/0 ) to be installed by the receiving router. -// EnableAttachedBit returns a bool -func (obj *isisAdvanced) EnableAttachedBit() bool { - - return *obj.obj.EnableAttachedBit - -} - -// If the Attached bit is enabled, it indicates that the ISIS router is attached to another area or the Level 2 backbone. The purpose of an Attached-Bit is to accomplish Inter-Area Routing. When an L1/L2 router is connected to more than one area, it sets the Attached-bit on its L1 LSP. This can cause a default route ( 0.0.0.0/0 ) to be installed by the receiving router. -// EnableAttachedBit returns a bool -func (obj *isisAdvanced) HasEnableAttachedBit() bool { - return obj.obj.EnableAttachedBit != nil -} - -// If the Attached bit is enabled, it indicates that the ISIS router is attached to another area or the Level 2 backbone. The purpose of an Attached-Bit is to accomplish Inter-Area Routing. When an L1/L2 router is connected to more than one area, it sets the Attached-bit on its L1 LSP. This can cause a default route ( 0.0.0.0/0 ) to be installed by the receiving router. -// SetEnableAttachedBit sets the bool value in the IsisAdvanced object -func (obj *isisAdvanced) SetEnableAttachedBit(value bool) IsisAdvanced { - - obj.obj.EnableAttachedBit = &value - return obj -} - -func (obj *isisAdvanced) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.MaxAreaAddresses != nil { - - if *obj.obj.MaxAreaAddresses > 254 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= IsisAdvanced.MaxAreaAddresses <= 254 but Got %d", *obj.obj.MaxAreaAddresses)) - } - - } - - if obj.obj.AreaAddresses != nil { - - err := obj.validateHexSlice(obj.AreaAddresses()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on IsisAdvanced.AreaAddresses")) - } - - } - - if obj.obj.LspRefreshRate != nil { - - if *obj.obj.LspRefreshRate > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= IsisAdvanced.LspRefreshRate <= 65535 but Got %d", *obj.obj.LspRefreshRate)) - } - - } - - if obj.obj.LspLifetime != nil { - - if *obj.obj.LspLifetime > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= IsisAdvanced.LspLifetime <= 65535 but Got %d", *obj.obj.LspLifetime)) - } - - } - - if obj.obj.PsnpInterval != nil { - - if *obj.obj.PsnpInterval > 60000 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= IsisAdvanced.PsnpInterval <= 60000 but Got %d", *obj.obj.PsnpInterval)) - } - - } - - if obj.obj.CsnpInterval != nil { - - if *obj.obj.CsnpInterval < 1 || *obj.obj.CsnpInterval > 65535000 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= IsisAdvanced.CsnpInterval <= 65535000 but Got %d", *obj.obj.CsnpInterval)) - } - - } - - if obj.obj.MaxLspSize != nil { - - if *obj.obj.MaxLspSize < 64 || *obj.obj.MaxLspSize > 9216 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("64 <= IsisAdvanced.MaxLspSize <= 9216 but Got %d", *obj.obj.MaxLspSize)) - } - - } - - if obj.obj.LspMgroupMinTransInterval != nil { - - if *obj.obj.LspMgroupMinTransInterval < 1 || *obj.obj.LspMgroupMinTransInterval > 60000 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= IsisAdvanced.LspMgroupMinTransInterval <= 60000 but Got %d", *obj.obj.LspMgroupMinTransInterval)) - } - - } - -} - -func (obj *isisAdvanced) setDefault() { - if obj.obj.EnableHelloPadding == nil { - obj.SetEnableHelloPadding(true) - } - if obj.obj.MaxAreaAddresses == nil { - obj.SetMaxAreaAddresses(3) - } - if obj.obj.LspRefreshRate == nil { - obj.SetLspRefreshRate(600) - } - if obj.obj.LspLifetime == nil { - obj.SetLspLifetime(1200) - } - if obj.obj.PsnpInterval == nil { - obj.SetPsnpInterval(2000) - } - if obj.obj.CsnpInterval == nil { - obj.SetCsnpInterval(10000) - } - if obj.obj.MaxLspSize == nil { - obj.SetMaxLspSize(1492) - } - if obj.obj.LspMgroupMinTransInterval == nil { - obj.SetLspMgroupMinTransInterval(5000) - } - if obj.obj.EnableAttachedBit == nil { - obj.SetEnableAttachedBit(true) - } - -} - -// ***** IsisAuthentication ***** -type isisAuthentication struct { - validation - obj *otg.IsisAuthentication - marshaller marshalIsisAuthentication - unMarshaller unMarshalIsisAuthentication - areaAuthHolder IsisAuthenticationBase - domainAuthHolder IsisAuthenticationBase -} - -func NewIsisAuthentication() IsisAuthentication { - obj := isisAuthentication{obj: &otg.IsisAuthentication{}} - obj.setDefault() - return &obj -} - -func (obj *isisAuthentication) msg() *otg.IsisAuthentication { - return obj.obj -} - -func (obj *isisAuthentication) setMsg(msg *otg.IsisAuthentication) IsisAuthentication { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisAuthentication struct { - obj *isisAuthentication -} - -type marshalIsisAuthentication interface { - // ToProto marshals IsisAuthentication to protobuf object *otg.IsisAuthentication - ToProto() (*otg.IsisAuthentication, error) - // ToPbText marshals IsisAuthentication to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisAuthentication to YAML text - ToYaml() (string, error) - // ToJson marshals IsisAuthentication to JSON text - ToJson() (string, error) -} - -type unMarshalisisAuthentication struct { - obj *isisAuthentication -} - -type unMarshalIsisAuthentication interface { - // FromProto unmarshals IsisAuthentication from protobuf object *otg.IsisAuthentication - FromProto(msg *otg.IsisAuthentication) (IsisAuthentication, error) - // FromPbText unmarshals IsisAuthentication from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisAuthentication from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisAuthentication from JSON text - FromJson(value string) error -} - -func (obj *isisAuthentication) Marshal() marshalIsisAuthentication { - if obj.marshaller == nil { - obj.marshaller = &marshalisisAuthentication{obj: obj} - } - return obj.marshaller -} - -func (obj *isisAuthentication) Unmarshal() unMarshalIsisAuthentication { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisAuthentication{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisAuthentication) ToProto() (*otg.IsisAuthentication, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisAuthentication) FromProto(msg *otg.IsisAuthentication) (IsisAuthentication, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisAuthentication) 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 *unMarshalisisAuthentication) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisAuthentication) 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 *unMarshalisisAuthentication) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisAuthentication) 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 *unMarshalisisAuthentication) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisAuthentication) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisAuthentication) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisAuthentication) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisAuthentication) Clone() (IsisAuthentication, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisAuthentication() - 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 -} - -func (obj *isisAuthentication) setNil() { - obj.areaAuthHolder = nil - obj.domainAuthHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisAuthentication is this contains ISIS Area/Domain authentication properties. -type IsisAuthentication interface { - Validation - // msg marshals IsisAuthentication to protobuf object *otg.IsisAuthentication - // and doesn't set defaults - msg() *otg.IsisAuthentication - // setMsg unmarshals IsisAuthentication from protobuf object *otg.IsisAuthentication - // and doesn't set defaults - setMsg(*otg.IsisAuthentication) IsisAuthentication - // provides marshal interface - Marshal() marshalIsisAuthentication - // provides unmarshal interface - Unmarshal() unMarshalIsisAuthentication - // validate validates IsisAuthentication - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisAuthentication, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // IgnoreReceiveMd5 returns bool, set in IsisAuthentication. - IgnoreReceiveMd5() bool - // SetIgnoreReceiveMd5 assigns bool provided by user to IsisAuthentication - SetIgnoreReceiveMd5(value bool) IsisAuthentication - // HasIgnoreReceiveMd5 checks if IgnoreReceiveMd5 has been set in IsisAuthentication - HasIgnoreReceiveMd5() bool - // AreaAuth returns IsisAuthenticationBase, set in IsisAuthentication. - // IsisAuthenticationBase is optional container for ISIS authentication properties. - AreaAuth() IsisAuthenticationBase - // SetAreaAuth assigns IsisAuthenticationBase provided by user to IsisAuthentication. - // IsisAuthenticationBase is optional container for ISIS authentication properties. - SetAreaAuth(value IsisAuthenticationBase) IsisAuthentication - // HasAreaAuth checks if AreaAuth has been set in IsisAuthentication - HasAreaAuth() bool - // DomainAuth returns IsisAuthenticationBase, set in IsisAuthentication. - // IsisAuthenticationBase is optional container for ISIS authentication properties. - DomainAuth() IsisAuthenticationBase - // SetDomainAuth assigns IsisAuthenticationBase provided by user to IsisAuthentication. - // IsisAuthenticationBase is optional container for ISIS authentication properties. - SetDomainAuth(value IsisAuthenticationBase) IsisAuthentication - // HasDomainAuth checks if DomainAuth has been set in IsisAuthentication - HasDomainAuth() bool - setNil() -} - -// Do not verify MD5 checksum in received LSPs. -// IgnoreReceiveMd5 returns a bool -func (obj *isisAuthentication) IgnoreReceiveMd5() bool { - - return *obj.obj.IgnoreReceiveMd5 - -} - -// Do not verify MD5 checksum in received LSPs. -// IgnoreReceiveMd5 returns a bool -func (obj *isisAuthentication) HasIgnoreReceiveMd5() bool { - return obj.obj.IgnoreReceiveMd5 != nil -} - -// Do not verify MD5 checksum in received LSPs. -// SetIgnoreReceiveMd5 sets the bool value in the IsisAuthentication object -func (obj *isisAuthentication) SetIgnoreReceiveMd5(value bool) IsisAuthentication { - - obj.obj.IgnoreReceiveMd5 = &value - return obj -} - -// The Area authentication method used for the emulated ISIS router. -// This is used for L1 LSPs. -// AreaAuth returns a IsisAuthenticationBase -func (obj *isisAuthentication) AreaAuth() IsisAuthenticationBase { - if obj.obj.AreaAuth == nil { - obj.obj.AreaAuth = NewIsisAuthenticationBase().msg() - } - if obj.areaAuthHolder == nil { - obj.areaAuthHolder = &isisAuthenticationBase{obj: obj.obj.AreaAuth} - } - return obj.areaAuthHolder -} - -// The Area authentication method used for the emulated ISIS router. -// This is used for L1 LSPs. -// AreaAuth returns a IsisAuthenticationBase -func (obj *isisAuthentication) HasAreaAuth() bool { - return obj.obj.AreaAuth != nil -} - -// The Area authentication method used for the emulated ISIS router. -// This is used for L1 LSPs. -// SetAreaAuth sets the IsisAuthenticationBase value in the IsisAuthentication object -func (obj *isisAuthentication) SetAreaAuth(value IsisAuthenticationBase) IsisAuthentication { - - obj.areaAuthHolder = nil - obj.obj.AreaAuth = value.msg() - - return obj -} - -// The Domain authentication method used for the emulated ISIS router. -// This is used for L2 LSPs. -// DomainAuth returns a IsisAuthenticationBase -func (obj *isisAuthentication) DomainAuth() IsisAuthenticationBase { - if obj.obj.DomainAuth == nil { - obj.obj.DomainAuth = NewIsisAuthenticationBase().msg() - } - if obj.domainAuthHolder == nil { - obj.domainAuthHolder = &isisAuthenticationBase{obj: obj.obj.DomainAuth} - } - return obj.domainAuthHolder -} - -// The Domain authentication method used for the emulated ISIS router. -// This is used for L2 LSPs. -// DomainAuth returns a IsisAuthenticationBase -func (obj *isisAuthentication) HasDomainAuth() bool { - return obj.obj.DomainAuth != nil -} - -// The Domain authentication method used for the emulated ISIS router. -// This is used for L2 LSPs. -// SetDomainAuth sets the IsisAuthenticationBase value in the IsisAuthentication object -func (obj *isisAuthentication) SetDomainAuth(value IsisAuthenticationBase) IsisAuthentication { - - obj.domainAuthHolder = nil - obj.obj.DomainAuth = value.msg() - - return obj -} - -func (obj *isisAuthentication) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.AreaAuth != nil { - - obj.AreaAuth().validateObj(vObj, set_default) - } - - if obj.obj.DomainAuth != nil { - - obj.DomainAuth().validateObj(vObj, set_default) - } - -} - -func (obj *isisAuthentication) setDefault() { - if obj.obj.IgnoreReceiveMd5 == nil { - obj.SetIgnoreReceiveMd5(true) - } - -} - -// ***** IsisV4RouteRange ***** -type isisV4RouteRange struct { - validation - obj *otg.IsisV4RouteRange - marshaller marshalIsisV4RouteRange - unMarshaller unMarshalIsisV4RouteRange - addressesHolder IsisV4RouteRangeV4RouteAddressIter -} - -func NewIsisV4RouteRange() IsisV4RouteRange { - obj := isisV4RouteRange{obj: &otg.IsisV4RouteRange{}} - obj.setDefault() - return &obj -} - -func (obj *isisV4RouteRange) msg() *otg.IsisV4RouteRange { - return obj.obj -} - -func (obj *isisV4RouteRange) setMsg(msg *otg.IsisV4RouteRange) IsisV4RouteRange { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisV4RouteRange struct { - obj *isisV4RouteRange -} - -type marshalIsisV4RouteRange interface { - // ToProto marshals IsisV4RouteRange to protobuf object *otg.IsisV4RouteRange - ToProto() (*otg.IsisV4RouteRange, error) - // ToPbText marshals IsisV4RouteRange to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisV4RouteRange to YAML text - ToYaml() (string, error) - // ToJson marshals IsisV4RouteRange to JSON text - ToJson() (string, error) -} - -type unMarshalisisV4RouteRange struct { - obj *isisV4RouteRange -} - -type unMarshalIsisV4RouteRange interface { - // FromProto unmarshals IsisV4RouteRange from protobuf object *otg.IsisV4RouteRange - FromProto(msg *otg.IsisV4RouteRange) (IsisV4RouteRange, error) - // FromPbText unmarshals IsisV4RouteRange from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisV4RouteRange from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisV4RouteRange from JSON text - FromJson(value string) error -} - -func (obj *isisV4RouteRange) Marshal() marshalIsisV4RouteRange { - if obj.marshaller == nil { - obj.marshaller = &marshalisisV4RouteRange{obj: obj} - } - return obj.marshaller -} - -func (obj *isisV4RouteRange) Unmarshal() unMarshalIsisV4RouteRange { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisV4RouteRange{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisV4RouteRange) ToProto() (*otg.IsisV4RouteRange, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisV4RouteRange) FromProto(msg *otg.IsisV4RouteRange) (IsisV4RouteRange, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisV4RouteRange) 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 *unMarshalisisV4RouteRange) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisV4RouteRange) 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 *unMarshalisisV4RouteRange) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisV4RouteRange) 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 *unMarshalisisV4RouteRange) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisV4RouteRange) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisV4RouteRange) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisV4RouteRange) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisV4RouteRange) Clone() (IsisV4RouteRange, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisV4RouteRange() - 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 -} - -func (obj *isisV4RouteRange) setNil() { - obj.addressesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisV4RouteRange is emulated ISIS IPv4 routes. -type IsisV4RouteRange interface { - Validation - // msg marshals IsisV4RouteRange to protobuf object *otg.IsisV4RouteRange - // and doesn't set defaults - msg() *otg.IsisV4RouteRange - // setMsg unmarshals IsisV4RouteRange from protobuf object *otg.IsisV4RouteRange - // and doesn't set defaults - setMsg(*otg.IsisV4RouteRange) IsisV4RouteRange - // provides marshal interface - Marshal() marshalIsisV4RouteRange - // provides unmarshal interface - Unmarshal() unMarshalIsisV4RouteRange - // validate validates IsisV4RouteRange - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisV4RouteRange, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Addresses returns IsisV4RouteRangeV4RouteAddressIterIter, set in IsisV4RouteRange - Addresses() IsisV4RouteRangeV4RouteAddressIter - // LinkMetric returns uint32, set in IsisV4RouteRange. - LinkMetric() uint32 - // SetLinkMetric assigns uint32 provided by user to IsisV4RouteRange - SetLinkMetric(value uint32) IsisV4RouteRange - // HasLinkMetric checks if LinkMetric has been set in IsisV4RouteRange - HasLinkMetric() bool - // OriginType returns IsisV4RouteRangeOriginTypeEnum, set in IsisV4RouteRange - OriginType() IsisV4RouteRangeOriginTypeEnum - // SetOriginType assigns IsisV4RouteRangeOriginTypeEnum provided by user to IsisV4RouteRange - SetOriginType(value IsisV4RouteRangeOriginTypeEnum) IsisV4RouteRange - // HasOriginType checks if OriginType has been set in IsisV4RouteRange - HasOriginType() bool - // RedistributionType returns IsisV4RouteRangeRedistributionTypeEnum, set in IsisV4RouteRange - RedistributionType() IsisV4RouteRangeRedistributionTypeEnum - // SetRedistributionType assigns IsisV4RouteRangeRedistributionTypeEnum provided by user to IsisV4RouteRange - SetRedistributionType(value IsisV4RouteRangeRedistributionTypeEnum) IsisV4RouteRange - // HasRedistributionType checks if RedistributionType has been set in IsisV4RouteRange - HasRedistributionType() bool - // Name returns string, set in IsisV4RouteRange. - Name() string - // SetName assigns string provided by user to IsisV4RouteRange - SetName(value string) IsisV4RouteRange - // PrefixAttrEnabled returns bool, set in IsisV4RouteRange. - PrefixAttrEnabled() bool - // SetPrefixAttrEnabled assigns bool provided by user to IsisV4RouteRange - SetPrefixAttrEnabled(value bool) IsisV4RouteRange - // HasPrefixAttrEnabled checks if PrefixAttrEnabled has been set in IsisV4RouteRange - HasPrefixAttrEnabled() bool - // XFlag returns bool, set in IsisV4RouteRange. - XFlag() bool - // SetXFlag assigns bool provided by user to IsisV4RouteRange - SetXFlag(value bool) IsisV4RouteRange - // HasXFlag checks if XFlag has been set in IsisV4RouteRange - HasXFlag() bool - // RFlag returns bool, set in IsisV4RouteRange. - RFlag() bool - // SetRFlag assigns bool provided by user to IsisV4RouteRange - SetRFlag(value bool) IsisV4RouteRange - // HasRFlag checks if RFlag has been set in IsisV4RouteRange - HasRFlag() bool - // NFlag returns bool, set in IsisV4RouteRange. - NFlag() bool - // SetNFlag assigns bool provided by user to IsisV4RouteRange - SetNFlag(value bool) IsisV4RouteRange - // HasNFlag checks if NFlag has been set in IsisV4RouteRange - HasNFlag() bool - setNil() -} - -// A list of group of IPv4 route addresses. -// Addresses returns a []V4RouteAddress -func (obj *isisV4RouteRange) Addresses() IsisV4RouteRangeV4RouteAddressIter { - if len(obj.obj.Addresses) == 0 { - obj.obj.Addresses = []*otg.V4RouteAddress{} - } - if obj.addressesHolder == nil { - obj.addressesHolder = newIsisV4RouteRangeV4RouteAddressIter(&obj.obj.Addresses).setMsg(obj) - } - return obj.addressesHolder -} - -type isisV4RouteRangeV4RouteAddressIter struct { - obj *isisV4RouteRange - v4RouteAddressSlice []V4RouteAddress - fieldPtr *[]*otg.V4RouteAddress -} - -func newIsisV4RouteRangeV4RouteAddressIter(ptr *[]*otg.V4RouteAddress) IsisV4RouteRangeV4RouteAddressIter { - return &isisV4RouteRangeV4RouteAddressIter{fieldPtr: ptr} -} - -type IsisV4RouteRangeV4RouteAddressIter interface { - setMsg(*isisV4RouteRange) IsisV4RouteRangeV4RouteAddressIter - Items() []V4RouteAddress - Add() V4RouteAddress - Append(items ...V4RouteAddress) IsisV4RouteRangeV4RouteAddressIter - Set(index int, newObj V4RouteAddress) IsisV4RouteRangeV4RouteAddressIter - Clear() IsisV4RouteRangeV4RouteAddressIter - clearHolderSlice() IsisV4RouteRangeV4RouteAddressIter - appendHolderSlice(item V4RouteAddress) IsisV4RouteRangeV4RouteAddressIter -} - -func (obj *isisV4RouteRangeV4RouteAddressIter) setMsg(msg *isisV4RouteRange) IsisV4RouteRangeV4RouteAddressIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&v4RouteAddress{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisV4RouteRangeV4RouteAddressIter) Items() []V4RouteAddress { - return obj.v4RouteAddressSlice -} - -func (obj *isisV4RouteRangeV4RouteAddressIter) Add() V4RouteAddress { - newObj := &otg.V4RouteAddress{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &v4RouteAddress{obj: newObj} - newLibObj.setDefault() - obj.v4RouteAddressSlice = append(obj.v4RouteAddressSlice, newLibObj) - return newLibObj -} - -func (obj *isisV4RouteRangeV4RouteAddressIter) Append(items ...V4RouteAddress) IsisV4RouteRangeV4RouteAddressIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.v4RouteAddressSlice = append(obj.v4RouteAddressSlice, item) - } - return obj -} - -func (obj *isisV4RouteRangeV4RouteAddressIter) Set(index int, newObj V4RouteAddress) IsisV4RouteRangeV4RouteAddressIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.v4RouteAddressSlice[index] = newObj - return obj -} -func (obj *isisV4RouteRangeV4RouteAddressIter) Clear() IsisV4RouteRangeV4RouteAddressIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.V4RouteAddress{} - obj.v4RouteAddressSlice = []V4RouteAddress{} - } - return obj -} -func (obj *isisV4RouteRangeV4RouteAddressIter) clearHolderSlice() IsisV4RouteRangeV4RouteAddressIter { - if len(obj.v4RouteAddressSlice) > 0 { - obj.v4RouteAddressSlice = []V4RouteAddress{} - } - return obj -} -func (obj *isisV4RouteRangeV4RouteAddressIter) appendHolderSlice(item V4RouteAddress) IsisV4RouteRangeV4RouteAddressIter { - obj.v4RouteAddressSlice = append(obj.v4RouteAddressSlice, item) - return obj -} - -// The user-defined metric associated with this route range. -// LinkMetric returns a uint32 -func (obj *isisV4RouteRange) LinkMetric() uint32 { - - return *obj.obj.LinkMetric - -} - -// The user-defined metric associated with this route range. -// LinkMetric returns a uint32 -func (obj *isisV4RouteRange) HasLinkMetric() bool { - return obj.obj.LinkMetric != nil -} - -// The user-defined metric associated with this route range. -// SetLinkMetric sets the uint32 value in the IsisV4RouteRange object -func (obj *isisV4RouteRange) SetLinkMetric(value uint32) IsisV4RouteRange { - - obj.obj.LinkMetric = &value - return obj -} - -type IsisV4RouteRangeOriginTypeEnum string - -// Enum of OriginType on IsisV4RouteRange -var IsisV4RouteRangeOriginType = struct { - INTERNAL IsisV4RouteRangeOriginTypeEnum - EXTERNAL IsisV4RouteRangeOriginTypeEnum -}{ - INTERNAL: IsisV4RouteRangeOriginTypeEnum("internal"), - EXTERNAL: IsisV4RouteRangeOriginTypeEnum("external"), -} - -func (obj *isisV4RouteRange) OriginType() IsisV4RouteRangeOriginTypeEnum { - return IsisV4RouteRangeOriginTypeEnum(obj.obj.OriginType.Enum().String()) -} - -// The origin of the advertised route-internal or external to the ISIS area. Options include the following: -// Internal-for intra-area routes, through Level 1 LSPs. -// External-for inter-area routes redistributed within L1, through Level -// 1 LSPs. -// OriginType returns a string -func (obj *isisV4RouteRange) HasOriginType() bool { - return obj.obj.OriginType != nil -} - -func (obj *isisV4RouteRange) SetOriginType(value IsisV4RouteRangeOriginTypeEnum) IsisV4RouteRange { - intValue, ok := otg.IsisV4RouteRange_OriginType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on IsisV4RouteRangeOriginTypeEnum", string(value))) - return obj - } - enumValue := otg.IsisV4RouteRange_OriginType_Enum(intValue) - obj.obj.OriginType = &enumValue - - return obj -} - -type IsisV4RouteRangeRedistributionTypeEnum string - -// Enum of RedistributionType on IsisV4RouteRange -var IsisV4RouteRangeRedistributionType = struct { - UP IsisV4RouteRangeRedistributionTypeEnum - DOWN IsisV4RouteRangeRedistributionTypeEnum -}{ - UP: IsisV4RouteRangeRedistributionTypeEnum("up"), - DOWN: IsisV4RouteRangeRedistributionTypeEnum("down"), -} - -func (obj *isisV4RouteRange) RedistributionType() IsisV4RouteRangeRedistributionTypeEnum { - return IsisV4RouteRangeRedistributionTypeEnum(obj.obj.RedistributionType.Enum().String()) -} - -// Defines the Up/Down (Redistribution) bit defined for TLVs 128 and 130 by RFC 2966. It is used for domain-wide advertisement of prefix information. -// -// Up (0)-used when a prefix is initially advertised within the ISIS L3 -// hierarchy, -// and for all other prefixes in L1 and L2 LSPs. (default) -// Down (1)-used when an L1/L2 router advertises L2 prefixes in L1 LSPs. -// -// The prefixes are being advertised from a higher level (L2) down to a lower level (L1). -// RedistributionType returns a string -func (obj *isisV4RouteRange) HasRedistributionType() bool { - return obj.obj.RedistributionType != nil -} - -func (obj *isisV4RouteRange) SetRedistributionType(value IsisV4RouteRangeRedistributionTypeEnum) IsisV4RouteRange { - intValue, ok := otg.IsisV4RouteRange_RedistributionType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on IsisV4RouteRangeRedistributionTypeEnum", string(value))) - return obj - } - enumValue := otg.IsisV4RouteRange_RedistributionType_Enum(intValue) - obj.obj.RedistributionType = &enumValue - - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *isisV4RouteRange) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the IsisV4RouteRange object -func (obj *isisV4RouteRange) SetName(value string) IsisV4RouteRange { - - obj.obj.Name = &value - return obj -} - -// Specifies whether the sub-TLV for IPv4/IPv6 Extended Reachability Attribute Flags -// will be advertised or not. -// PrefixAttrEnabled returns a bool -func (obj *isisV4RouteRange) PrefixAttrEnabled() bool { - - return *obj.obj.PrefixAttrEnabled - -} - -// Specifies whether the sub-TLV for IPv4/IPv6 Extended Reachability Attribute Flags -// will be advertised or not. -// PrefixAttrEnabled returns a bool -func (obj *isisV4RouteRange) HasPrefixAttrEnabled() bool { - return obj.obj.PrefixAttrEnabled != nil -} - -// Specifies whether the sub-TLV for IPv4/IPv6 Extended Reachability Attribute Flags -// will be advertised or not. -// SetPrefixAttrEnabled sets the bool value in the IsisV4RouteRange object -func (obj *isisV4RouteRange) SetPrefixAttrEnabled(value bool) IsisV4RouteRange { - - obj.obj.PrefixAttrEnabled = &value - return obj -} - -// External Prefix Flag (Bit 0) -// XFlag returns a bool -func (obj *isisV4RouteRange) XFlag() bool { - - return *obj.obj.XFlag - -} - -// External Prefix Flag (Bit 0) -// XFlag returns a bool -func (obj *isisV4RouteRange) HasXFlag() bool { - return obj.obj.XFlag != nil -} - -// External Prefix Flag (Bit 0) -// SetXFlag sets the bool value in the IsisV4RouteRange object -func (obj *isisV4RouteRange) SetXFlag(value bool) IsisV4RouteRange { - - obj.obj.XFlag = &value - return obj -} - -// Re-advertisement Flag (Bit 1) -// RFlag returns a bool -func (obj *isisV4RouteRange) RFlag() bool { - - return *obj.obj.RFlag - -} - -// Re-advertisement Flag (Bit 1) -// RFlag returns a bool -func (obj *isisV4RouteRange) HasRFlag() bool { - return obj.obj.RFlag != nil -} - -// Re-advertisement Flag (Bit 1) -// SetRFlag sets the bool value in the IsisV4RouteRange object -func (obj *isisV4RouteRange) SetRFlag(value bool) IsisV4RouteRange { - - obj.obj.RFlag = &value - return obj -} - -// Node Flag (Bit 2) -// NFlag returns a bool -func (obj *isisV4RouteRange) NFlag() bool { - - return *obj.obj.NFlag - -} - -// Node Flag (Bit 2) -// NFlag returns a bool -func (obj *isisV4RouteRange) HasNFlag() bool { - return obj.obj.NFlag != nil -} - -// Node Flag (Bit 2) -// SetNFlag sets the bool value in the IsisV4RouteRange object -func (obj *isisV4RouteRange) SetNFlag(value bool) IsisV4RouteRange { - - obj.obj.NFlag = &value - return obj -} - -func (obj *isisV4RouteRange) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Addresses) != 0 { - - if set_default { - obj.Addresses().clearHolderSlice() - for _, item := range obj.obj.Addresses { - obj.Addresses().appendHolderSlice(&v4RouteAddress{obj: item}) - } - } - for _, item := range obj.Addresses().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.LinkMetric != nil { - - if *obj.obj.LinkMetric > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= IsisV4RouteRange.LinkMetric <= 16777215 but Got %d", *obj.obj.LinkMetric)) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface IsisV4RouteRange") - } -} - -func (obj *isisV4RouteRange) setDefault() { - if obj.obj.LinkMetric == nil { - obj.SetLinkMetric(0) - } - if obj.obj.OriginType == nil { - obj.SetOriginType(IsisV4RouteRangeOriginType.INTERNAL) - - } - if obj.obj.RedistributionType == nil { - obj.SetRedistributionType(IsisV4RouteRangeRedistributionType.UP) - - } - if obj.obj.PrefixAttrEnabled == nil { - obj.SetPrefixAttrEnabled(false) - } - if obj.obj.XFlag == nil { - obj.SetXFlag(false) - } - if obj.obj.RFlag == nil { - obj.SetRFlag(false) - } - if obj.obj.NFlag == nil { - obj.SetNFlag(false) - } - -} - -// ***** IsisV6RouteRange ***** -type isisV6RouteRange struct { - validation - obj *otg.IsisV6RouteRange - marshaller marshalIsisV6RouteRange - unMarshaller unMarshalIsisV6RouteRange - addressesHolder IsisV6RouteRangeV6RouteAddressIter -} - -func NewIsisV6RouteRange() IsisV6RouteRange { - obj := isisV6RouteRange{obj: &otg.IsisV6RouteRange{}} - obj.setDefault() - return &obj -} - -func (obj *isisV6RouteRange) msg() *otg.IsisV6RouteRange { - return obj.obj -} - -func (obj *isisV6RouteRange) setMsg(msg *otg.IsisV6RouteRange) IsisV6RouteRange { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisV6RouteRange struct { - obj *isisV6RouteRange -} - -type marshalIsisV6RouteRange interface { - // ToProto marshals IsisV6RouteRange to protobuf object *otg.IsisV6RouteRange - ToProto() (*otg.IsisV6RouteRange, error) - // ToPbText marshals IsisV6RouteRange to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisV6RouteRange to YAML text - ToYaml() (string, error) - // ToJson marshals IsisV6RouteRange to JSON text - ToJson() (string, error) -} - -type unMarshalisisV6RouteRange struct { - obj *isisV6RouteRange -} - -type unMarshalIsisV6RouteRange interface { - // FromProto unmarshals IsisV6RouteRange from protobuf object *otg.IsisV6RouteRange - FromProto(msg *otg.IsisV6RouteRange) (IsisV6RouteRange, error) - // FromPbText unmarshals IsisV6RouteRange from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisV6RouteRange from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisV6RouteRange from JSON text - FromJson(value string) error -} - -func (obj *isisV6RouteRange) Marshal() marshalIsisV6RouteRange { - if obj.marshaller == nil { - obj.marshaller = &marshalisisV6RouteRange{obj: obj} - } - return obj.marshaller -} - -func (obj *isisV6RouteRange) Unmarshal() unMarshalIsisV6RouteRange { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisV6RouteRange{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisV6RouteRange) ToProto() (*otg.IsisV6RouteRange, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisV6RouteRange) FromProto(msg *otg.IsisV6RouteRange) (IsisV6RouteRange, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisV6RouteRange) 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 *unMarshalisisV6RouteRange) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisV6RouteRange) 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 *unMarshalisisV6RouteRange) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisV6RouteRange) 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 *unMarshalisisV6RouteRange) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisV6RouteRange) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisV6RouteRange) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisV6RouteRange) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisV6RouteRange) Clone() (IsisV6RouteRange, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisV6RouteRange() - 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 -} - -func (obj *isisV6RouteRange) setNil() { - obj.addressesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisV6RouteRange is emulated ISIS IPv6 routes. -type IsisV6RouteRange interface { - Validation - // msg marshals IsisV6RouteRange to protobuf object *otg.IsisV6RouteRange - // and doesn't set defaults - msg() *otg.IsisV6RouteRange - // setMsg unmarshals IsisV6RouteRange from protobuf object *otg.IsisV6RouteRange - // and doesn't set defaults - setMsg(*otg.IsisV6RouteRange) IsisV6RouteRange - // provides marshal interface - Marshal() marshalIsisV6RouteRange - // provides unmarshal interface - Unmarshal() unMarshalIsisV6RouteRange - // validate validates IsisV6RouteRange - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisV6RouteRange, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Addresses returns IsisV6RouteRangeV6RouteAddressIterIter, set in IsisV6RouteRange - Addresses() IsisV6RouteRangeV6RouteAddressIter - // LinkMetric returns uint32, set in IsisV6RouteRange. - LinkMetric() uint32 - // SetLinkMetric assigns uint32 provided by user to IsisV6RouteRange - SetLinkMetric(value uint32) IsisV6RouteRange - // HasLinkMetric checks if LinkMetric has been set in IsisV6RouteRange - HasLinkMetric() bool - // OriginType returns IsisV6RouteRangeOriginTypeEnum, set in IsisV6RouteRange - OriginType() IsisV6RouteRangeOriginTypeEnum - // SetOriginType assigns IsisV6RouteRangeOriginTypeEnum provided by user to IsisV6RouteRange - SetOriginType(value IsisV6RouteRangeOriginTypeEnum) IsisV6RouteRange - // HasOriginType checks if OriginType has been set in IsisV6RouteRange - HasOriginType() bool - // RedistributionType returns IsisV6RouteRangeRedistributionTypeEnum, set in IsisV6RouteRange - RedistributionType() IsisV6RouteRangeRedistributionTypeEnum - // SetRedistributionType assigns IsisV6RouteRangeRedistributionTypeEnum provided by user to IsisV6RouteRange - SetRedistributionType(value IsisV6RouteRangeRedistributionTypeEnum) IsisV6RouteRange - // HasRedistributionType checks if RedistributionType has been set in IsisV6RouteRange - HasRedistributionType() bool - // Name returns string, set in IsisV6RouteRange. - Name() string - // SetName assigns string provided by user to IsisV6RouteRange - SetName(value string) IsisV6RouteRange - // PrefixAttrEnabled returns bool, set in IsisV6RouteRange. - PrefixAttrEnabled() bool - // SetPrefixAttrEnabled assigns bool provided by user to IsisV6RouteRange - SetPrefixAttrEnabled(value bool) IsisV6RouteRange - // HasPrefixAttrEnabled checks if PrefixAttrEnabled has been set in IsisV6RouteRange - HasPrefixAttrEnabled() bool - // XFlag returns bool, set in IsisV6RouteRange. - XFlag() bool - // SetXFlag assigns bool provided by user to IsisV6RouteRange - SetXFlag(value bool) IsisV6RouteRange - // HasXFlag checks if XFlag has been set in IsisV6RouteRange - HasXFlag() bool - // RFlag returns bool, set in IsisV6RouteRange. - RFlag() bool - // SetRFlag assigns bool provided by user to IsisV6RouteRange - SetRFlag(value bool) IsisV6RouteRange - // HasRFlag checks if RFlag has been set in IsisV6RouteRange - HasRFlag() bool - // NFlag returns bool, set in IsisV6RouteRange. - NFlag() bool - // SetNFlag assigns bool provided by user to IsisV6RouteRange - SetNFlag(value bool) IsisV6RouteRange - // HasNFlag checks if NFlag has been set in IsisV6RouteRange - HasNFlag() bool - setNil() -} - -// A list of group of IPv6 route addresses. -// Addresses returns a []V6RouteAddress -func (obj *isisV6RouteRange) Addresses() IsisV6RouteRangeV6RouteAddressIter { - if len(obj.obj.Addresses) == 0 { - obj.obj.Addresses = []*otg.V6RouteAddress{} - } - if obj.addressesHolder == nil { - obj.addressesHolder = newIsisV6RouteRangeV6RouteAddressIter(&obj.obj.Addresses).setMsg(obj) - } - return obj.addressesHolder -} - -type isisV6RouteRangeV6RouteAddressIter struct { - obj *isisV6RouteRange - v6RouteAddressSlice []V6RouteAddress - fieldPtr *[]*otg.V6RouteAddress -} - -func newIsisV6RouteRangeV6RouteAddressIter(ptr *[]*otg.V6RouteAddress) IsisV6RouteRangeV6RouteAddressIter { - return &isisV6RouteRangeV6RouteAddressIter{fieldPtr: ptr} -} - -type IsisV6RouteRangeV6RouteAddressIter interface { - setMsg(*isisV6RouteRange) IsisV6RouteRangeV6RouteAddressIter - Items() []V6RouteAddress - Add() V6RouteAddress - Append(items ...V6RouteAddress) IsisV6RouteRangeV6RouteAddressIter - Set(index int, newObj V6RouteAddress) IsisV6RouteRangeV6RouteAddressIter - Clear() IsisV6RouteRangeV6RouteAddressIter - clearHolderSlice() IsisV6RouteRangeV6RouteAddressIter - appendHolderSlice(item V6RouteAddress) IsisV6RouteRangeV6RouteAddressIter -} - -func (obj *isisV6RouteRangeV6RouteAddressIter) setMsg(msg *isisV6RouteRange) IsisV6RouteRangeV6RouteAddressIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&v6RouteAddress{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisV6RouteRangeV6RouteAddressIter) Items() []V6RouteAddress { - return obj.v6RouteAddressSlice -} - -func (obj *isisV6RouteRangeV6RouteAddressIter) Add() V6RouteAddress { - newObj := &otg.V6RouteAddress{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &v6RouteAddress{obj: newObj} - newLibObj.setDefault() - obj.v6RouteAddressSlice = append(obj.v6RouteAddressSlice, newLibObj) - return newLibObj -} - -func (obj *isisV6RouteRangeV6RouteAddressIter) Append(items ...V6RouteAddress) IsisV6RouteRangeV6RouteAddressIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.v6RouteAddressSlice = append(obj.v6RouteAddressSlice, item) - } - return obj -} - -func (obj *isisV6RouteRangeV6RouteAddressIter) Set(index int, newObj V6RouteAddress) IsisV6RouteRangeV6RouteAddressIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.v6RouteAddressSlice[index] = newObj - return obj -} -func (obj *isisV6RouteRangeV6RouteAddressIter) Clear() IsisV6RouteRangeV6RouteAddressIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.V6RouteAddress{} - obj.v6RouteAddressSlice = []V6RouteAddress{} - } - return obj -} -func (obj *isisV6RouteRangeV6RouteAddressIter) clearHolderSlice() IsisV6RouteRangeV6RouteAddressIter { - if len(obj.v6RouteAddressSlice) > 0 { - obj.v6RouteAddressSlice = []V6RouteAddress{} - } - return obj -} -func (obj *isisV6RouteRangeV6RouteAddressIter) appendHolderSlice(item V6RouteAddress) IsisV6RouteRangeV6RouteAddressIter { - obj.v6RouteAddressSlice = append(obj.v6RouteAddressSlice, item) - return obj -} - -// The user-defined metric associated with this route range. -// LinkMetric returns a uint32 -func (obj *isisV6RouteRange) LinkMetric() uint32 { - - return *obj.obj.LinkMetric - -} - -// The user-defined metric associated with this route range. -// LinkMetric returns a uint32 -func (obj *isisV6RouteRange) HasLinkMetric() bool { - return obj.obj.LinkMetric != nil -} - -// The user-defined metric associated with this route range. -// SetLinkMetric sets the uint32 value in the IsisV6RouteRange object -func (obj *isisV6RouteRange) SetLinkMetric(value uint32) IsisV6RouteRange { - - obj.obj.LinkMetric = &value - return obj -} - -type IsisV6RouteRangeOriginTypeEnum string - -// Enum of OriginType on IsisV6RouteRange -var IsisV6RouteRangeOriginType = struct { - INTERNAL IsisV6RouteRangeOriginTypeEnum - EXTERNAL IsisV6RouteRangeOriginTypeEnum -}{ - INTERNAL: IsisV6RouteRangeOriginTypeEnum("internal"), - EXTERNAL: IsisV6RouteRangeOriginTypeEnum("external"), -} - -func (obj *isisV6RouteRange) OriginType() IsisV6RouteRangeOriginTypeEnum { - return IsisV6RouteRangeOriginTypeEnum(obj.obj.OriginType.Enum().String()) -} - -// The origin of the advertised route-internal or external to the ISIS area. Options include the following: -// Internal-for intra-area routes, through Level 1 LSPs. -// External-for inter-area routes redistributed within L1, through Level -// 1 LSPs. -// OriginType returns a string -func (obj *isisV6RouteRange) HasOriginType() bool { - return obj.obj.OriginType != nil -} - -func (obj *isisV6RouteRange) SetOriginType(value IsisV6RouteRangeOriginTypeEnum) IsisV6RouteRange { - intValue, ok := otg.IsisV6RouteRange_OriginType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on IsisV6RouteRangeOriginTypeEnum", string(value))) - return obj - } - enumValue := otg.IsisV6RouteRange_OriginType_Enum(intValue) - obj.obj.OriginType = &enumValue - - return obj -} - -type IsisV6RouteRangeRedistributionTypeEnum string - -// Enum of RedistributionType on IsisV6RouteRange -var IsisV6RouteRangeRedistributionType = struct { - UP IsisV6RouteRangeRedistributionTypeEnum - DOWN IsisV6RouteRangeRedistributionTypeEnum -}{ - UP: IsisV6RouteRangeRedistributionTypeEnum("up"), - DOWN: IsisV6RouteRangeRedistributionTypeEnum("down"), -} - -func (obj *isisV6RouteRange) RedistributionType() IsisV6RouteRangeRedistributionTypeEnum { - return IsisV6RouteRangeRedistributionTypeEnum(obj.obj.RedistributionType.Enum().String()) -} - -// Defines the Up/Down (Redistribution) bit defined for TLVs 128 and 130 by RFC 2966. It is used for domain-wide advertisement of prefix information. -// -// Up (0)-used when a prefix is initially advertised within the ISIS L3 -// hierarchy, -// and for all other prefixes in L1 and L2 LSPs. (default) -// Down (1)-used when an L1/L2 router advertises L2 prefixes in L1 LSPs. -// -// The prefixes are being advertised from a higher level (L2) down to a lower level (L1). -// RedistributionType returns a string -func (obj *isisV6RouteRange) HasRedistributionType() bool { - return obj.obj.RedistributionType != nil -} - -func (obj *isisV6RouteRange) SetRedistributionType(value IsisV6RouteRangeRedistributionTypeEnum) IsisV6RouteRange { - intValue, ok := otg.IsisV6RouteRange_RedistributionType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on IsisV6RouteRangeRedistributionTypeEnum", string(value))) - return obj - } - enumValue := otg.IsisV6RouteRange_RedistributionType_Enum(intValue) - obj.obj.RedistributionType = &enumValue - - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *isisV6RouteRange) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the IsisV6RouteRange object -func (obj *isisV6RouteRange) SetName(value string) IsisV6RouteRange { - - obj.obj.Name = &value - return obj -} - -// Specifies whether the sub-TLV for IPv4/IPv6 Extended Reachability Attribute Flags -// will be advertised or not. -// PrefixAttrEnabled returns a bool -func (obj *isisV6RouteRange) PrefixAttrEnabled() bool { - - return *obj.obj.PrefixAttrEnabled - -} - -// Specifies whether the sub-TLV for IPv4/IPv6 Extended Reachability Attribute Flags -// will be advertised or not. -// PrefixAttrEnabled returns a bool -func (obj *isisV6RouteRange) HasPrefixAttrEnabled() bool { - return obj.obj.PrefixAttrEnabled != nil -} - -// Specifies whether the sub-TLV for IPv4/IPv6 Extended Reachability Attribute Flags -// will be advertised or not. -// SetPrefixAttrEnabled sets the bool value in the IsisV6RouteRange object -func (obj *isisV6RouteRange) SetPrefixAttrEnabled(value bool) IsisV6RouteRange { - - obj.obj.PrefixAttrEnabled = &value - return obj -} - -// External Prefix Flag (Bit 0) -// XFlag returns a bool -func (obj *isisV6RouteRange) XFlag() bool { - - return *obj.obj.XFlag - -} - -// External Prefix Flag (Bit 0) -// XFlag returns a bool -func (obj *isisV6RouteRange) HasXFlag() bool { - return obj.obj.XFlag != nil -} - -// External Prefix Flag (Bit 0) -// SetXFlag sets the bool value in the IsisV6RouteRange object -func (obj *isisV6RouteRange) SetXFlag(value bool) IsisV6RouteRange { - - obj.obj.XFlag = &value - return obj -} - -// Re-advertisement Flag (Bit 1) -// RFlag returns a bool -func (obj *isisV6RouteRange) RFlag() bool { - - return *obj.obj.RFlag - -} - -// Re-advertisement Flag (Bit 1) -// RFlag returns a bool -func (obj *isisV6RouteRange) HasRFlag() bool { - return obj.obj.RFlag != nil -} - -// Re-advertisement Flag (Bit 1) -// SetRFlag sets the bool value in the IsisV6RouteRange object -func (obj *isisV6RouteRange) SetRFlag(value bool) IsisV6RouteRange { - - obj.obj.RFlag = &value - return obj -} - -// Node Flag (Bit 2) -// NFlag returns a bool -func (obj *isisV6RouteRange) NFlag() bool { - - return *obj.obj.NFlag - -} - -// Node Flag (Bit 2) -// NFlag returns a bool -func (obj *isisV6RouteRange) HasNFlag() bool { - return obj.obj.NFlag != nil -} - -// Node Flag (Bit 2) -// SetNFlag sets the bool value in the IsisV6RouteRange object -func (obj *isisV6RouteRange) SetNFlag(value bool) IsisV6RouteRange { - - obj.obj.NFlag = &value - return obj -} - -func (obj *isisV6RouteRange) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Addresses) != 0 { - - if set_default { - obj.Addresses().clearHolderSlice() - for _, item := range obj.obj.Addresses { - obj.Addresses().appendHolderSlice(&v6RouteAddress{obj: item}) - } - } - for _, item := range obj.Addresses().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.LinkMetric != nil { - - if *obj.obj.LinkMetric > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= IsisV6RouteRange.LinkMetric <= 16777215 but Got %d", *obj.obj.LinkMetric)) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface IsisV6RouteRange") - } -} - -func (obj *isisV6RouteRange) setDefault() { - if obj.obj.LinkMetric == nil { - obj.SetLinkMetric(0) - } - if obj.obj.OriginType == nil { - obj.SetOriginType(IsisV6RouteRangeOriginType.INTERNAL) - - } - if obj.obj.RedistributionType == nil { - obj.SetRedistributionType(IsisV6RouteRangeRedistributionType.UP) - - } - if obj.obj.PrefixAttrEnabled == nil { - obj.SetPrefixAttrEnabled(false) - } - if obj.obj.XFlag == nil { - obj.SetXFlag(false) - } - if obj.obj.RFlag == nil { - obj.SetRFlag(false) - } - if obj.obj.NFlag == nil { - obj.SetNFlag(false) - } - -} - -// ***** BgpV4Interface ***** -type bgpV4Interface struct { - validation - obj *otg.BgpV4Interface - marshaller marshalBgpV4Interface - unMarshaller unMarshalBgpV4Interface - peersHolder BgpV4InterfaceBgpV4PeerIter -} - -func NewBgpV4Interface() BgpV4Interface { - obj := bgpV4Interface{obj: &otg.BgpV4Interface{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV4Interface) msg() *otg.BgpV4Interface { - return obj.obj -} - -func (obj *bgpV4Interface) setMsg(msg *otg.BgpV4Interface) BgpV4Interface { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV4Interface struct { - obj *bgpV4Interface -} - -type marshalBgpV4Interface interface { - // ToProto marshals BgpV4Interface to protobuf object *otg.BgpV4Interface - ToProto() (*otg.BgpV4Interface, error) - // ToPbText marshals BgpV4Interface to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV4Interface to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV4Interface to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV4Interface struct { - obj *bgpV4Interface -} - -type unMarshalBgpV4Interface interface { - // FromProto unmarshals BgpV4Interface from protobuf object *otg.BgpV4Interface - FromProto(msg *otg.BgpV4Interface) (BgpV4Interface, error) - // FromPbText unmarshals BgpV4Interface from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV4Interface from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV4Interface from JSON text - FromJson(value string) error -} - -func (obj *bgpV4Interface) Marshal() marshalBgpV4Interface { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV4Interface{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV4Interface) Unmarshal() unMarshalBgpV4Interface { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV4Interface{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV4Interface) ToProto() (*otg.BgpV4Interface, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV4Interface) FromProto(msg *otg.BgpV4Interface) (BgpV4Interface, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV4Interface) 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 *unMarshalbgpV4Interface) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpV4Interface) 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 *unMarshalbgpV4Interface) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpV4Interface) 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 *unMarshalbgpV4Interface) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpV4Interface) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV4Interface) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV4Interface) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV4Interface) Clone() (BgpV4Interface, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV4Interface() - 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 -} - -func (obj *bgpV4Interface) setNil() { - obj.peersHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpV4Interface is configuration for emulated BGPv4 peers and routes on a single IPv4 interface. -type BgpV4Interface interface { - Validation - // msg marshals BgpV4Interface to protobuf object *otg.BgpV4Interface - // and doesn't set defaults - msg() *otg.BgpV4Interface - // setMsg unmarshals BgpV4Interface from protobuf object *otg.BgpV4Interface - // and doesn't set defaults - setMsg(*otg.BgpV4Interface) BgpV4Interface - // provides marshal interface - Marshal() marshalBgpV4Interface - // provides unmarshal interface - Unmarshal() unMarshalBgpV4Interface - // validate validates BgpV4Interface - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV4Interface, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv4Name returns string, set in BgpV4Interface. - Ipv4Name() string - // SetIpv4Name assigns string provided by user to BgpV4Interface - SetIpv4Name(value string) BgpV4Interface - // Peers returns BgpV4InterfaceBgpV4PeerIterIter, set in BgpV4Interface - Peers() BgpV4InterfaceBgpV4PeerIter - setNil() -} - -// The unique name of the IPv4, Loopback IPv4 interface or DHCPv4 client used as the source IP for this list of BGP peers. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv4Loopback/properties/name -// - /components/schemas/DhcpClient.V4/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv4Loopback/properties/name -// - /components/schemas/DhcpClient.V4/properties/name -// -// Ipv4Name returns a string -func (obj *bgpV4Interface) Ipv4Name() string { - - return *obj.obj.Ipv4Name - -} - -// The unique name of the IPv4, Loopback IPv4 interface or DHCPv4 client used as the source IP for this list of BGP peers. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv4Loopback/properties/name -// - /components/schemas/DhcpClient.V4/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv4Loopback/properties/name -// - /components/schemas/DhcpClient.V4/properties/name -// -// SetIpv4Name sets the string value in the BgpV4Interface object -func (obj *bgpV4Interface) SetIpv4Name(value string) BgpV4Interface { - - obj.obj.Ipv4Name = &value - return obj -} - -// This contains the list of BGPv4 peers configured on this interface. -// Peers returns a []BgpV4Peer -func (obj *bgpV4Interface) Peers() BgpV4InterfaceBgpV4PeerIter { - if len(obj.obj.Peers) == 0 { - obj.obj.Peers = []*otg.BgpV4Peer{} - } - if obj.peersHolder == nil { - obj.peersHolder = newBgpV4InterfaceBgpV4PeerIter(&obj.obj.Peers).setMsg(obj) - } - return obj.peersHolder -} - -type bgpV4InterfaceBgpV4PeerIter struct { - obj *bgpV4Interface - bgpV4PeerSlice []BgpV4Peer - fieldPtr *[]*otg.BgpV4Peer -} - -func newBgpV4InterfaceBgpV4PeerIter(ptr *[]*otg.BgpV4Peer) BgpV4InterfaceBgpV4PeerIter { - return &bgpV4InterfaceBgpV4PeerIter{fieldPtr: ptr} -} - -type BgpV4InterfaceBgpV4PeerIter interface { - setMsg(*bgpV4Interface) BgpV4InterfaceBgpV4PeerIter - Items() []BgpV4Peer - Add() BgpV4Peer - Append(items ...BgpV4Peer) BgpV4InterfaceBgpV4PeerIter - Set(index int, newObj BgpV4Peer) BgpV4InterfaceBgpV4PeerIter - Clear() BgpV4InterfaceBgpV4PeerIter - clearHolderSlice() BgpV4InterfaceBgpV4PeerIter - appendHolderSlice(item BgpV4Peer) BgpV4InterfaceBgpV4PeerIter -} - -func (obj *bgpV4InterfaceBgpV4PeerIter) setMsg(msg *bgpV4Interface) BgpV4InterfaceBgpV4PeerIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpV4Peer{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4InterfaceBgpV4PeerIter) Items() []BgpV4Peer { - return obj.bgpV4PeerSlice -} - -func (obj *bgpV4InterfaceBgpV4PeerIter) Add() BgpV4Peer { - newObj := &otg.BgpV4Peer{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpV4Peer{obj: newObj} - newLibObj.setDefault() - obj.bgpV4PeerSlice = append(obj.bgpV4PeerSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4InterfaceBgpV4PeerIter) Append(items ...BgpV4Peer) BgpV4InterfaceBgpV4PeerIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpV4PeerSlice = append(obj.bgpV4PeerSlice, item) - } - return obj -} - -func (obj *bgpV4InterfaceBgpV4PeerIter) Set(index int, newObj BgpV4Peer) BgpV4InterfaceBgpV4PeerIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpV4PeerSlice[index] = newObj - return obj -} -func (obj *bgpV4InterfaceBgpV4PeerIter) Clear() BgpV4InterfaceBgpV4PeerIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpV4Peer{} - obj.bgpV4PeerSlice = []BgpV4Peer{} - } - return obj -} -func (obj *bgpV4InterfaceBgpV4PeerIter) clearHolderSlice() BgpV4InterfaceBgpV4PeerIter { - if len(obj.bgpV4PeerSlice) > 0 { - obj.bgpV4PeerSlice = []BgpV4Peer{} - } - return obj -} -func (obj *bgpV4InterfaceBgpV4PeerIter) appendHolderSlice(item BgpV4Peer) BgpV4InterfaceBgpV4PeerIter { - obj.bgpV4PeerSlice = append(obj.bgpV4PeerSlice, item) - return obj -} - -func (obj *bgpV4Interface) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Ipv4Name is required - if obj.obj.Ipv4Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Ipv4Name is required field on interface BgpV4Interface") - } - - if len(obj.obj.Peers) != 0 { - - if set_default { - obj.Peers().clearHolderSlice() - for _, item := range obj.obj.Peers { - obj.Peers().appendHolderSlice(&bgpV4Peer{obj: item}) - } - } - for _, item := range obj.Peers().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpV4Interface) setDefault() { - -} - -// ***** BgpV6Interface ***** -type bgpV6Interface struct { - validation - obj *otg.BgpV6Interface - marshaller marshalBgpV6Interface - unMarshaller unMarshalBgpV6Interface - peersHolder BgpV6InterfaceBgpV6PeerIter -} - -func NewBgpV6Interface() BgpV6Interface { - obj := bgpV6Interface{obj: &otg.BgpV6Interface{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV6Interface) msg() *otg.BgpV6Interface { - return obj.obj -} - -func (obj *bgpV6Interface) setMsg(msg *otg.BgpV6Interface) BgpV6Interface { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV6Interface struct { - obj *bgpV6Interface -} - -type marshalBgpV6Interface interface { - // ToProto marshals BgpV6Interface to protobuf object *otg.BgpV6Interface - ToProto() (*otg.BgpV6Interface, error) - // ToPbText marshals BgpV6Interface to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV6Interface to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV6Interface to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV6Interface struct { - obj *bgpV6Interface -} - -type unMarshalBgpV6Interface interface { - // FromProto unmarshals BgpV6Interface from protobuf object *otg.BgpV6Interface - FromProto(msg *otg.BgpV6Interface) (BgpV6Interface, error) - // FromPbText unmarshals BgpV6Interface from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV6Interface from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV6Interface from JSON text - FromJson(value string) error -} - -func (obj *bgpV6Interface) Marshal() marshalBgpV6Interface { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV6Interface{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV6Interface) Unmarshal() unMarshalBgpV6Interface { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV6Interface{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV6Interface) ToProto() (*otg.BgpV6Interface, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV6Interface) FromProto(msg *otg.BgpV6Interface) (BgpV6Interface, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV6Interface) 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 *unMarshalbgpV6Interface) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpV6Interface) 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 *unMarshalbgpV6Interface) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpV6Interface) 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 *unMarshalbgpV6Interface) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpV6Interface) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV6Interface) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV6Interface) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV6Interface) Clone() (BgpV6Interface, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV6Interface() - 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 -} - -func (obj *bgpV6Interface) setNil() { - obj.peersHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpV6Interface is configuration for emulated BGPv6 peers and routes on a single IPv6 interface. -type BgpV6Interface interface { - Validation - // msg marshals BgpV6Interface to protobuf object *otg.BgpV6Interface - // and doesn't set defaults - msg() *otg.BgpV6Interface - // setMsg unmarshals BgpV6Interface from protobuf object *otg.BgpV6Interface - // and doesn't set defaults - setMsg(*otg.BgpV6Interface) BgpV6Interface - // provides marshal interface - Marshal() marshalBgpV6Interface - // provides unmarshal interface - Unmarshal() unMarshalBgpV6Interface - // validate validates BgpV6Interface - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV6Interface, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv6Name returns string, set in BgpV6Interface. - Ipv6Name() string - // SetIpv6Name assigns string provided by user to BgpV6Interface - SetIpv6Name(value string) BgpV6Interface - // Peers returns BgpV6InterfaceBgpV6PeerIterIter, set in BgpV6Interface - Peers() BgpV6InterfaceBgpV6PeerIter - setNil() -} - -// The unique name of IPv6 Loopback IPv6 interface or DHCPv4 client used as the source IP for this list of BGP peers. -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Device.Ipv6Loopback/properties/name -// - /components/schemas/DhcpClient.V6/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Device.Ipv6Loopback/properties/name -// - /components/schemas/DhcpClient.V6/properties/name -// -// Ipv6Name returns a string -func (obj *bgpV6Interface) Ipv6Name() string { - - return *obj.obj.Ipv6Name - -} - -// The unique name of IPv6 Loopback IPv6 interface or DHCPv4 client used as the source IP for this list of BGP peers. -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Device.Ipv6Loopback/properties/name -// - /components/schemas/DhcpClient.V6/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Device.Ipv6Loopback/properties/name -// - /components/schemas/DhcpClient.V6/properties/name -// -// SetIpv6Name sets the string value in the BgpV6Interface object -func (obj *bgpV6Interface) SetIpv6Name(value string) BgpV6Interface { - - obj.obj.Ipv6Name = &value - return obj -} - -// This contains the list of BGPv6 peers configured on this interface. -// Peers returns a []BgpV6Peer -func (obj *bgpV6Interface) Peers() BgpV6InterfaceBgpV6PeerIter { - if len(obj.obj.Peers) == 0 { - obj.obj.Peers = []*otg.BgpV6Peer{} - } - if obj.peersHolder == nil { - obj.peersHolder = newBgpV6InterfaceBgpV6PeerIter(&obj.obj.Peers).setMsg(obj) - } - return obj.peersHolder -} - -type bgpV6InterfaceBgpV6PeerIter struct { - obj *bgpV6Interface - bgpV6PeerSlice []BgpV6Peer - fieldPtr *[]*otg.BgpV6Peer -} - -func newBgpV6InterfaceBgpV6PeerIter(ptr *[]*otg.BgpV6Peer) BgpV6InterfaceBgpV6PeerIter { - return &bgpV6InterfaceBgpV6PeerIter{fieldPtr: ptr} -} - -type BgpV6InterfaceBgpV6PeerIter interface { - setMsg(*bgpV6Interface) BgpV6InterfaceBgpV6PeerIter - Items() []BgpV6Peer - Add() BgpV6Peer - Append(items ...BgpV6Peer) BgpV6InterfaceBgpV6PeerIter - Set(index int, newObj BgpV6Peer) BgpV6InterfaceBgpV6PeerIter - Clear() BgpV6InterfaceBgpV6PeerIter - clearHolderSlice() BgpV6InterfaceBgpV6PeerIter - appendHolderSlice(item BgpV6Peer) BgpV6InterfaceBgpV6PeerIter -} - -func (obj *bgpV6InterfaceBgpV6PeerIter) setMsg(msg *bgpV6Interface) BgpV6InterfaceBgpV6PeerIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpV6Peer{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6InterfaceBgpV6PeerIter) Items() []BgpV6Peer { - return obj.bgpV6PeerSlice -} - -func (obj *bgpV6InterfaceBgpV6PeerIter) Add() BgpV6Peer { - newObj := &otg.BgpV6Peer{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpV6Peer{obj: newObj} - newLibObj.setDefault() - obj.bgpV6PeerSlice = append(obj.bgpV6PeerSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6InterfaceBgpV6PeerIter) Append(items ...BgpV6Peer) BgpV6InterfaceBgpV6PeerIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpV6PeerSlice = append(obj.bgpV6PeerSlice, item) - } - return obj -} - -func (obj *bgpV6InterfaceBgpV6PeerIter) Set(index int, newObj BgpV6Peer) BgpV6InterfaceBgpV6PeerIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpV6PeerSlice[index] = newObj - return obj -} -func (obj *bgpV6InterfaceBgpV6PeerIter) Clear() BgpV6InterfaceBgpV6PeerIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpV6Peer{} - obj.bgpV6PeerSlice = []BgpV6Peer{} - } - return obj -} -func (obj *bgpV6InterfaceBgpV6PeerIter) clearHolderSlice() BgpV6InterfaceBgpV6PeerIter { - if len(obj.bgpV6PeerSlice) > 0 { - obj.bgpV6PeerSlice = []BgpV6Peer{} - } - return obj -} -func (obj *bgpV6InterfaceBgpV6PeerIter) appendHolderSlice(item BgpV6Peer) BgpV6InterfaceBgpV6PeerIter { - obj.bgpV6PeerSlice = append(obj.bgpV6PeerSlice, item) - return obj -} - -func (obj *bgpV6Interface) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Ipv6Name is required - if obj.obj.Ipv6Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Ipv6Name is required field on interface BgpV6Interface") - } - - if len(obj.obj.Peers) != 0 { - - if set_default { - obj.Peers().clearHolderSlice() - for _, item := range obj.obj.Peers { - obj.Peers().appendHolderSlice(&bgpV6Peer{obj: item}) - } - } - for _, item := range obj.Peers().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpV6Interface) setDefault() { - -} - -// ***** VxlanV4Tunnel ***** -type vxlanV4Tunnel struct { - validation - obj *otg.VxlanV4Tunnel - marshaller marshalVxlanV4Tunnel - unMarshaller unMarshalVxlanV4Tunnel - destinationIpModeHolder VxlanV4TunnelDestinationIPMode -} - -func NewVxlanV4Tunnel() VxlanV4Tunnel { - obj := vxlanV4Tunnel{obj: &otg.VxlanV4Tunnel{}} - obj.setDefault() - return &obj -} - -func (obj *vxlanV4Tunnel) msg() *otg.VxlanV4Tunnel { - return obj.obj -} - -func (obj *vxlanV4Tunnel) setMsg(msg *otg.VxlanV4Tunnel) VxlanV4Tunnel { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalvxlanV4Tunnel struct { - obj *vxlanV4Tunnel -} - -type marshalVxlanV4Tunnel interface { - // ToProto marshals VxlanV4Tunnel to protobuf object *otg.VxlanV4Tunnel - ToProto() (*otg.VxlanV4Tunnel, error) - // ToPbText marshals VxlanV4Tunnel to protobuf text - ToPbText() (string, error) - // ToYaml marshals VxlanV4Tunnel to YAML text - ToYaml() (string, error) - // ToJson marshals VxlanV4Tunnel to JSON text - ToJson() (string, error) -} - -type unMarshalvxlanV4Tunnel struct { - obj *vxlanV4Tunnel -} - -type unMarshalVxlanV4Tunnel interface { - // FromProto unmarshals VxlanV4Tunnel from protobuf object *otg.VxlanV4Tunnel - FromProto(msg *otg.VxlanV4Tunnel) (VxlanV4Tunnel, error) - // FromPbText unmarshals VxlanV4Tunnel from protobuf text - FromPbText(value string) error - // FromYaml unmarshals VxlanV4Tunnel from YAML text - FromYaml(value string) error - // FromJson unmarshals VxlanV4Tunnel from JSON text - FromJson(value string) error -} - -func (obj *vxlanV4Tunnel) Marshal() marshalVxlanV4Tunnel { - if obj.marshaller == nil { - obj.marshaller = &marshalvxlanV4Tunnel{obj: obj} - } - return obj.marshaller -} - -func (obj *vxlanV4Tunnel) Unmarshal() unMarshalVxlanV4Tunnel { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalvxlanV4Tunnel{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalvxlanV4Tunnel) ToProto() (*otg.VxlanV4Tunnel, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalvxlanV4Tunnel) FromProto(msg *otg.VxlanV4Tunnel) (VxlanV4Tunnel, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalvxlanV4Tunnel) 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 *unMarshalvxlanV4Tunnel) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalvxlanV4Tunnel) 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 *unMarshalvxlanV4Tunnel) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalvxlanV4Tunnel) 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 *unMarshalvxlanV4Tunnel) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *vxlanV4Tunnel) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *vxlanV4Tunnel) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *vxlanV4Tunnel) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *vxlanV4Tunnel) Clone() (VxlanV4Tunnel, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewVxlanV4Tunnel() - 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 -} - -func (obj *vxlanV4Tunnel) setNil() { - obj.destinationIpModeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// VxlanV4Tunnel is configuration and operational state parameters relating to IPv4 VXLAN tunnel end-point interface. -type VxlanV4Tunnel interface { - Validation - // msg marshals VxlanV4Tunnel to protobuf object *otg.VxlanV4Tunnel - // and doesn't set defaults - msg() *otg.VxlanV4Tunnel - // setMsg unmarshals VxlanV4Tunnel from protobuf object *otg.VxlanV4Tunnel - // and doesn't set defaults - setMsg(*otg.VxlanV4Tunnel) VxlanV4Tunnel - // provides marshal interface - Marshal() marshalVxlanV4Tunnel - // provides unmarshal interface - Unmarshal() unMarshalVxlanV4Tunnel - // validate validates VxlanV4Tunnel - validate() error - // A stringer function - String() string - // Clones the object - Clone() (VxlanV4Tunnel, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // SourceInterface returns string, set in VxlanV4Tunnel. - SourceInterface() string - // SetSourceInterface assigns string provided by user to VxlanV4Tunnel - SetSourceInterface(value string) VxlanV4Tunnel - // DestinationIpMode returns VxlanV4TunnelDestinationIPMode, set in VxlanV4Tunnel. - // VxlanV4TunnelDestinationIPMode is communication mode between the VTEPs, either unicast or multicast. - DestinationIpMode() VxlanV4TunnelDestinationIPMode - // SetDestinationIpMode assigns VxlanV4TunnelDestinationIPMode provided by user to VxlanV4Tunnel. - // VxlanV4TunnelDestinationIPMode is communication mode between the VTEPs, either unicast or multicast. - SetDestinationIpMode(value VxlanV4TunnelDestinationIPMode) VxlanV4Tunnel - // HasDestinationIpMode checks if DestinationIpMode has been set in VxlanV4Tunnel - HasDestinationIpMode() bool - // Vni returns uint32, set in VxlanV4Tunnel. - Vni() uint32 - // SetVni assigns uint32 provided by user to VxlanV4Tunnel - SetVni(value uint32) VxlanV4Tunnel - // Name returns string, set in VxlanV4Tunnel. - Name() string - // SetName assigns string provided by user to VxlanV4Tunnel - SetName(value string) VxlanV4Tunnel - setNil() -} - -// Determines the source interface. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv4Loopback/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv4Loopback/properties/name -// -// SourceInterface returns a string -func (obj *vxlanV4Tunnel) SourceInterface() string { - - return *obj.obj.SourceInterface - -} - -// Determines the source interface. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv4Loopback/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv4Loopback/properties/name -// -// SetSourceInterface sets the string value in the VxlanV4Tunnel object -func (obj *vxlanV4Tunnel) SetSourceInterface(value string) VxlanV4Tunnel { - - obj.obj.SourceInterface = &value - return obj -} - -// description is TBD -// DestinationIpMode returns a VxlanV4TunnelDestinationIPMode -func (obj *vxlanV4Tunnel) DestinationIpMode() VxlanV4TunnelDestinationIPMode { - if obj.obj.DestinationIpMode == nil { - obj.obj.DestinationIpMode = NewVxlanV4TunnelDestinationIPMode().msg() - } - if obj.destinationIpModeHolder == nil { - obj.destinationIpModeHolder = &vxlanV4TunnelDestinationIPMode{obj: obj.obj.DestinationIpMode} - } - return obj.destinationIpModeHolder -} - -// description is TBD -// DestinationIpMode returns a VxlanV4TunnelDestinationIPMode -func (obj *vxlanV4Tunnel) HasDestinationIpMode() bool { - return obj.obj.DestinationIpMode != nil -} - -// description is TBD -// SetDestinationIpMode sets the VxlanV4TunnelDestinationIPMode value in the VxlanV4Tunnel object -func (obj *vxlanV4Tunnel) SetDestinationIpMode(value VxlanV4TunnelDestinationIPMode) VxlanV4Tunnel { - - obj.destinationIpModeHolder = nil - obj.obj.DestinationIpMode = value.msg() - - return obj -} - -// VXLAN Network Identifier (VNI) to distinguish network instances on the wire -// Vni returns a uint32 -func (obj *vxlanV4Tunnel) Vni() uint32 { - - return *obj.obj.Vni - -} - -// VXLAN Network Identifier (VNI) to distinguish network instances on the wire -// SetVni sets the uint32 value in the VxlanV4Tunnel object -func (obj *vxlanV4Tunnel) SetVni(value uint32) VxlanV4Tunnel { - - obj.obj.Vni = &value - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *vxlanV4Tunnel) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the VxlanV4Tunnel object -func (obj *vxlanV4Tunnel) SetName(value string) VxlanV4Tunnel { - - obj.obj.Name = &value - return obj -} - -func (obj *vxlanV4Tunnel) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // SourceInterface is required - if obj.obj.SourceInterface == nil { - vObj.validationErrors = append(vObj.validationErrors, "SourceInterface is required field on interface VxlanV4Tunnel") - } - - if obj.obj.DestinationIpMode != nil { - - obj.DestinationIpMode().validateObj(vObj, set_default) - } - - // Vni is required - if obj.obj.Vni == nil { - vObj.validationErrors = append(vObj.validationErrors, "Vni is required field on interface VxlanV4Tunnel") - } - if obj.obj.Vni != nil { - - if *obj.obj.Vni < 1 || *obj.obj.Vni > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= VxlanV4Tunnel.Vni <= 16777215 but Got %d", *obj.obj.Vni)) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface VxlanV4Tunnel") - } -} - -func (obj *vxlanV4Tunnel) setDefault() { - -} - -// ***** VxlanV6Tunnel ***** -type vxlanV6Tunnel struct { - validation - obj *otg.VxlanV6Tunnel - marshaller marshalVxlanV6Tunnel - unMarshaller unMarshalVxlanV6Tunnel - destinationIpModeHolder VxlanV6TunnelDestinationIPMode -} - -func NewVxlanV6Tunnel() VxlanV6Tunnel { - obj := vxlanV6Tunnel{obj: &otg.VxlanV6Tunnel{}} - obj.setDefault() - return &obj -} - -func (obj *vxlanV6Tunnel) msg() *otg.VxlanV6Tunnel { - return obj.obj -} - -func (obj *vxlanV6Tunnel) setMsg(msg *otg.VxlanV6Tunnel) VxlanV6Tunnel { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalvxlanV6Tunnel struct { - obj *vxlanV6Tunnel -} - -type marshalVxlanV6Tunnel interface { - // ToProto marshals VxlanV6Tunnel to protobuf object *otg.VxlanV6Tunnel - ToProto() (*otg.VxlanV6Tunnel, error) - // ToPbText marshals VxlanV6Tunnel to protobuf text - ToPbText() (string, error) - // ToYaml marshals VxlanV6Tunnel to YAML text - ToYaml() (string, error) - // ToJson marshals VxlanV6Tunnel to JSON text - ToJson() (string, error) -} - -type unMarshalvxlanV6Tunnel struct { - obj *vxlanV6Tunnel -} - -type unMarshalVxlanV6Tunnel interface { - // FromProto unmarshals VxlanV6Tunnel from protobuf object *otg.VxlanV6Tunnel - FromProto(msg *otg.VxlanV6Tunnel) (VxlanV6Tunnel, error) - // FromPbText unmarshals VxlanV6Tunnel from protobuf text - FromPbText(value string) error - // FromYaml unmarshals VxlanV6Tunnel from YAML text - FromYaml(value string) error - // FromJson unmarshals VxlanV6Tunnel from JSON text - FromJson(value string) error -} - -func (obj *vxlanV6Tunnel) Marshal() marshalVxlanV6Tunnel { - if obj.marshaller == nil { - obj.marshaller = &marshalvxlanV6Tunnel{obj: obj} - } - return obj.marshaller -} - -func (obj *vxlanV6Tunnel) Unmarshal() unMarshalVxlanV6Tunnel { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalvxlanV6Tunnel{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalvxlanV6Tunnel) ToProto() (*otg.VxlanV6Tunnel, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalvxlanV6Tunnel) FromProto(msg *otg.VxlanV6Tunnel) (VxlanV6Tunnel, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalvxlanV6Tunnel) 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 *unMarshalvxlanV6Tunnel) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalvxlanV6Tunnel) 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 *unMarshalvxlanV6Tunnel) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalvxlanV6Tunnel) 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 *unMarshalvxlanV6Tunnel) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *vxlanV6Tunnel) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *vxlanV6Tunnel) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *vxlanV6Tunnel) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *vxlanV6Tunnel) Clone() (VxlanV6Tunnel, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewVxlanV6Tunnel() - 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 -} - -func (obj *vxlanV6Tunnel) setNil() { - obj.destinationIpModeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// VxlanV6Tunnel is configuration and operational state parameters relating to IPv6 VXLAN tunnel end-point interface. -type VxlanV6Tunnel interface { - Validation - // msg marshals VxlanV6Tunnel to protobuf object *otg.VxlanV6Tunnel - // and doesn't set defaults - msg() *otg.VxlanV6Tunnel - // setMsg unmarshals VxlanV6Tunnel from protobuf object *otg.VxlanV6Tunnel - // and doesn't set defaults - setMsg(*otg.VxlanV6Tunnel) VxlanV6Tunnel - // provides marshal interface - Marshal() marshalVxlanV6Tunnel - // provides unmarshal interface - Unmarshal() unMarshalVxlanV6Tunnel - // validate validates VxlanV6Tunnel - validate() error - // A stringer function - String() string - // Clones the object - Clone() (VxlanV6Tunnel, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // SourceInterface returns string, set in VxlanV6Tunnel. - SourceInterface() string - // SetSourceInterface assigns string provided by user to VxlanV6Tunnel - SetSourceInterface(value string) VxlanV6Tunnel - // DestinationIpMode returns VxlanV6TunnelDestinationIPMode, set in VxlanV6Tunnel. - // VxlanV6TunnelDestinationIPMode is communication mode between the VTEPs, either unicast or multicast. - DestinationIpMode() VxlanV6TunnelDestinationIPMode - // SetDestinationIpMode assigns VxlanV6TunnelDestinationIPMode provided by user to VxlanV6Tunnel. - // VxlanV6TunnelDestinationIPMode is communication mode between the VTEPs, either unicast or multicast. - SetDestinationIpMode(value VxlanV6TunnelDestinationIPMode) VxlanV6Tunnel - // HasDestinationIpMode checks if DestinationIpMode has been set in VxlanV6Tunnel - HasDestinationIpMode() bool - // Vni returns uint32, set in VxlanV6Tunnel. - Vni() uint32 - // SetVni assigns uint32 provided by user to VxlanV6Tunnel - SetVni(value uint32) VxlanV6Tunnel - // Name returns string, set in VxlanV6Tunnel. - Name() string - // SetName assigns string provided by user to VxlanV6Tunnel - SetName(value string) VxlanV6Tunnel - setNil() -} - -// Determines the source interface. -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Device.Ipv6Loopback/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Device.Ipv6Loopback/properties/name -// -// SourceInterface returns a string -func (obj *vxlanV6Tunnel) SourceInterface() string { - - return *obj.obj.SourceInterface - -} - -// Determines the source interface. -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Device.Ipv6Loopback/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Device.Ipv6Loopback/properties/name -// -// SetSourceInterface sets the string value in the VxlanV6Tunnel object -func (obj *vxlanV6Tunnel) SetSourceInterface(value string) VxlanV6Tunnel { - - obj.obj.SourceInterface = &value - return obj -} - -// description is TBD -// DestinationIpMode returns a VxlanV6TunnelDestinationIPMode -func (obj *vxlanV6Tunnel) DestinationIpMode() VxlanV6TunnelDestinationIPMode { - if obj.obj.DestinationIpMode == nil { - obj.obj.DestinationIpMode = NewVxlanV6TunnelDestinationIPMode().msg() - } - if obj.destinationIpModeHolder == nil { - obj.destinationIpModeHolder = &vxlanV6TunnelDestinationIPMode{obj: obj.obj.DestinationIpMode} - } - return obj.destinationIpModeHolder -} - -// description is TBD -// DestinationIpMode returns a VxlanV6TunnelDestinationIPMode -func (obj *vxlanV6Tunnel) HasDestinationIpMode() bool { - return obj.obj.DestinationIpMode != nil -} - -// description is TBD -// SetDestinationIpMode sets the VxlanV6TunnelDestinationIPMode value in the VxlanV6Tunnel object -func (obj *vxlanV6Tunnel) SetDestinationIpMode(value VxlanV6TunnelDestinationIPMode) VxlanV6Tunnel { - - obj.destinationIpModeHolder = nil - obj.obj.DestinationIpMode = value.msg() - - return obj -} - -// VXLAN Network Identifier (VNI) to distinguish network instances on the wire -// Vni returns a uint32 -func (obj *vxlanV6Tunnel) Vni() uint32 { - - return *obj.obj.Vni - -} - -// VXLAN Network Identifier (VNI) to distinguish network instances on the wire -// SetVni sets the uint32 value in the VxlanV6Tunnel object -func (obj *vxlanV6Tunnel) SetVni(value uint32) VxlanV6Tunnel { - - obj.obj.Vni = &value - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *vxlanV6Tunnel) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the VxlanV6Tunnel object -func (obj *vxlanV6Tunnel) SetName(value string) VxlanV6Tunnel { - - obj.obj.Name = &value - return obj -} - -func (obj *vxlanV6Tunnel) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // SourceInterface is required - if obj.obj.SourceInterface == nil { - vObj.validationErrors = append(vObj.validationErrors, "SourceInterface is required field on interface VxlanV6Tunnel") - } - - if obj.obj.DestinationIpMode != nil { - - obj.DestinationIpMode().validateObj(vObj, set_default) - } - - // Vni is required - if obj.obj.Vni == nil { - vObj.validationErrors = append(vObj.validationErrors, "Vni is required field on interface VxlanV6Tunnel") - } - if obj.obj.Vni != nil { - - if *obj.obj.Vni < 1 || *obj.obj.Vni > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= VxlanV6Tunnel.Vni <= 16777215 but Got %d", *obj.obj.Vni)) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface VxlanV6Tunnel") - } -} - -func (obj *vxlanV6Tunnel) setDefault() { - -} - -// ***** RsvpIpv4Interface ***** -type rsvpIpv4Interface struct { - validation - obj *otg.RsvpIpv4Interface - marshaller marshalRsvpIpv4Interface - unMarshaller unMarshalRsvpIpv4Interface -} - -func NewRsvpIpv4Interface() RsvpIpv4Interface { - obj := rsvpIpv4Interface{obj: &otg.RsvpIpv4Interface{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpIpv4Interface) msg() *otg.RsvpIpv4Interface { - return obj.obj -} - -func (obj *rsvpIpv4Interface) setMsg(msg *otg.RsvpIpv4Interface) RsvpIpv4Interface { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpIpv4Interface struct { - obj *rsvpIpv4Interface -} - -type marshalRsvpIpv4Interface interface { - // ToProto marshals RsvpIpv4Interface to protobuf object *otg.RsvpIpv4Interface - ToProto() (*otg.RsvpIpv4Interface, error) - // ToPbText marshals RsvpIpv4Interface to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpIpv4Interface to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpIpv4Interface to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpIpv4Interface struct { - obj *rsvpIpv4Interface -} - -type unMarshalRsvpIpv4Interface interface { - // FromProto unmarshals RsvpIpv4Interface from protobuf object *otg.RsvpIpv4Interface - FromProto(msg *otg.RsvpIpv4Interface) (RsvpIpv4Interface, error) - // FromPbText unmarshals RsvpIpv4Interface from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpIpv4Interface from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpIpv4Interface from JSON text - FromJson(value string) error -} - -func (obj *rsvpIpv4Interface) Marshal() marshalRsvpIpv4Interface { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpIpv4Interface{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpIpv4Interface) Unmarshal() unMarshalRsvpIpv4Interface { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpIpv4Interface{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpIpv4Interface) ToProto() (*otg.RsvpIpv4Interface, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpIpv4Interface) FromProto(msg *otg.RsvpIpv4Interface) (RsvpIpv4Interface, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpIpv4Interface) 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 *unMarshalrsvpIpv4Interface) 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 *marshalrsvpIpv4Interface) 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 *unMarshalrsvpIpv4Interface) 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 *marshalrsvpIpv4Interface) 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 *unMarshalrsvpIpv4Interface) 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 *rsvpIpv4Interface) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpIpv4Interface) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpIpv4Interface) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpIpv4Interface) Clone() (RsvpIpv4Interface, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpIpv4Interface() - 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 -} - -// RsvpIpv4Interface is configuration for RSVP Interface. -type RsvpIpv4Interface interface { - Validation - // msg marshals RsvpIpv4Interface to protobuf object *otg.RsvpIpv4Interface - // and doesn't set defaults - msg() *otg.RsvpIpv4Interface - // setMsg unmarshals RsvpIpv4Interface from protobuf object *otg.RsvpIpv4Interface - // and doesn't set defaults - setMsg(*otg.RsvpIpv4Interface) RsvpIpv4Interface - // provides marshal interface - Marshal() marshalRsvpIpv4Interface - // provides unmarshal interface - Unmarshal() unMarshalRsvpIpv4Interface - // validate validates RsvpIpv4Interface - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpIpv4Interface, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv4Name returns string, set in RsvpIpv4Interface. - Ipv4Name() string - // SetIpv4Name assigns string provided by user to RsvpIpv4Interface - SetIpv4Name(value string) RsvpIpv4Interface - // NeighborIp returns string, set in RsvpIpv4Interface. - NeighborIp() string - // SetNeighborIp assigns string provided by user to RsvpIpv4Interface - SetNeighborIp(value string) RsvpIpv4Interface - // LabelSpaceStart returns uint32, set in RsvpIpv4Interface. - LabelSpaceStart() uint32 - // SetLabelSpaceStart assigns uint32 provided by user to RsvpIpv4Interface - SetLabelSpaceStart(value uint32) RsvpIpv4Interface - // HasLabelSpaceStart checks if LabelSpaceStart has been set in RsvpIpv4Interface - HasLabelSpaceStart() bool - // LabelSpaceEnd returns uint32, set in RsvpIpv4Interface. - LabelSpaceEnd() uint32 - // SetLabelSpaceEnd assigns uint32 provided by user to RsvpIpv4Interface - SetLabelSpaceEnd(value uint32) RsvpIpv4Interface - // HasLabelSpaceEnd checks if LabelSpaceEnd has been set in RsvpIpv4Interface - HasLabelSpaceEnd() bool - // EnableRefreshReduction returns bool, set in RsvpIpv4Interface. - EnableRefreshReduction() bool - // SetEnableRefreshReduction assigns bool provided by user to RsvpIpv4Interface - SetEnableRefreshReduction(value bool) RsvpIpv4Interface - // HasEnableRefreshReduction checks if EnableRefreshReduction has been set in RsvpIpv4Interface - HasEnableRefreshReduction() bool - // SummaryRefreshInterval returns uint32, set in RsvpIpv4Interface. - SummaryRefreshInterval() uint32 - // SetSummaryRefreshInterval assigns uint32 provided by user to RsvpIpv4Interface - SetSummaryRefreshInterval(value uint32) RsvpIpv4Interface - // HasSummaryRefreshInterval checks if SummaryRefreshInterval has been set in RsvpIpv4Interface - HasSummaryRefreshInterval() bool - // SendBundle returns bool, set in RsvpIpv4Interface. - SendBundle() bool - // SetSendBundle assigns bool provided by user to RsvpIpv4Interface - SetSendBundle(value bool) RsvpIpv4Interface - // HasSendBundle checks if SendBundle has been set in RsvpIpv4Interface - HasSendBundle() bool - // BundleThreshold returns uint32, set in RsvpIpv4Interface. - BundleThreshold() uint32 - // SetBundleThreshold assigns uint32 provided by user to RsvpIpv4Interface - SetBundleThreshold(value uint32) RsvpIpv4Interface - // HasBundleThreshold checks if BundleThreshold has been set in RsvpIpv4Interface - HasBundleThreshold() bool - // EnableHello returns bool, set in RsvpIpv4Interface. - EnableHello() bool - // SetEnableHello assigns bool provided by user to RsvpIpv4Interface - SetEnableHello(value bool) RsvpIpv4Interface - // HasEnableHello checks if EnableHello has been set in RsvpIpv4Interface - HasEnableHello() bool - // HelloInterval returns uint32, set in RsvpIpv4Interface. - HelloInterval() uint32 - // SetHelloInterval assigns uint32 provided by user to RsvpIpv4Interface - SetHelloInterval(value uint32) RsvpIpv4Interface - // HasHelloInterval checks if HelloInterval has been set in RsvpIpv4Interface - HasHelloInterval() bool - // TimeoutMultiplier returns uint32, set in RsvpIpv4Interface. - TimeoutMultiplier() uint32 - // SetTimeoutMultiplier assigns uint32 provided by user to RsvpIpv4Interface - SetTimeoutMultiplier(value uint32) RsvpIpv4Interface - // HasTimeoutMultiplier checks if TimeoutMultiplier has been set in RsvpIpv4Interface - HasTimeoutMultiplier() bool -} - -// The globally unique name of the IPv4 interface connected to the DUT. This name must match the "name" field of the "ipv4_addresses" on top which this RSVP interface is configured. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// Ipv4Name returns a string -func (obj *rsvpIpv4Interface) Ipv4Name() string { - - return *obj.obj.Ipv4Name - -} - -// The globally unique name of the IPv4 interface connected to the DUT. This name must match the "name" field of the "ipv4_addresses" on top which this RSVP interface is configured. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// SetIpv4Name sets the string value in the RsvpIpv4Interface object -func (obj *rsvpIpv4Interface) SetIpv4Name(value string) RsvpIpv4Interface { - - obj.obj.Ipv4Name = &value - return obj -} - -// IPv4 address of the RSVP neighbor on this interface. -// NeighborIp returns a string -func (obj *rsvpIpv4Interface) NeighborIp() string { - - return *obj.obj.NeighborIp - -} - -// IPv4 address of the RSVP neighbor on this interface. -// SetNeighborIp sets the string value in the RsvpIpv4Interface object -func (obj *rsvpIpv4Interface) SetNeighborIp(value string) RsvpIpv4Interface { - - obj.obj.NeighborIp = &value - return obj -} - -// The user-defined label space start value. The LSPs for which this router acts as a egress are assigned labels from this label pool.The"label_space_start" and "label_space_end" together defines this label-pool. -// LabelSpaceStart returns a uint32 -func (obj *rsvpIpv4Interface) LabelSpaceStart() uint32 { - - return *obj.obj.LabelSpaceStart - -} - -// The user-defined label space start value. The LSPs for which this router acts as a egress are assigned labels from this label pool.The"label_space_start" and "label_space_end" together defines this label-pool. -// LabelSpaceStart returns a uint32 -func (obj *rsvpIpv4Interface) HasLabelSpaceStart() bool { - return obj.obj.LabelSpaceStart != nil -} - -// The user-defined label space start value. The LSPs for which this router acts as a egress are assigned labels from this label pool.The"label_space_start" and "label_space_end" together defines this label-pool. -// SetLabelSpaceStart sets the uint32 value in the RsvpIpv4Interface object -func (obj *rsvpIpv4Interface) SetLabelSpaceStart(value uint32) RsvpIpv4Interface { - - obj.obj.LabelSpaceStart = &value - return obj -} - -// The user-defined label space end value.The last label value that can be assigned to the LSPs for which this router acts as egress. -// LabelSpaceEnd returns a uint32 -func (obj *rsvpIpv4Interface) LabelSpaceEnd() uint32 { - - return *obj.obj.LabelSpaceEnd - -} - -// The user-defined label space end value.The last label value that can be assigned to the LSPs for which this router acts as egress. -// LabelSpaceEnd returns a uint32 -func (obj *rsvpIpv4Interface) HasLabelSpaceEnd() bool { - return obj.obj.LabelSpaceEnd != nil -} - -// The user-defined label space end value.The last label value that can be assigned to the LSPs for which this router acts as egress. -// SetLabelSpaceEnd sets the uint32 value in the RsvpIpv4Interface object -func (obj *rsvpIpv4Interface) SetLabelSpaceEnd(value uint32) RsvpIpv4Interface { - - obj.obj.LabelSpaceEnd = &value - return obj -} - -// Enables sending of Refresh Reduction as described in RFC2961. -// EnableRefreshReduction returns a bool -func (obj *rsvpIpv4Interface) EnableRefreshReduction() bool { - - return *obj.obj.EnableRefreshReduction - -} - -// Enables sending of Refresh Reduction as described in RFC2961. -// EnableRefreshReduction returns a bool -func (obj *rsvpIpv4Interface) HasEnableRefreshReduction() bool { - return obj.obj.EnableRefreshReduction != nil -} - -// Enables sending of Refresh Reduction as described in RFC2961. -// SetEnableRefreshReduction sets the bool value in the RsvpIpv4Interface object -func (obj *rsvpIpv4Interface) SetEnableRefreshReduction(value bool) RsvpIpv4Interface { - - obj.obj.EnableRefreshReduction = &value - return obj -} - -// The number of seconds between transmissions of successive Summary Refreshes. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. -// SummaryRefreshInterval returns a uint32 -func (obj *rsvpIpv4Interface) SummaryRefreshInterval() uint32 { - - return *obj.obj.SummaryRefreshInterval - -} - -// The number of seconds between transmissions of successive Summary Refreshes. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. -// SummaryRefreshInterval returns a uint32 -func (obj *rsvpIpv4Interface) HasSummaryRefreshInterval() bool { - return obj.obj.SummaryRefreshInterval != nil -} - -// The number of seconds between transmissions of successive Summary Refreshes. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. -// SetSummaryRefreshInterval sets the uint32 value in the RsvpIpv4Interface object -func (obj *rsvpIpv4Interface) SetSummaryRefreshInterval(value uint32) RsvpIpv4Interface { - - obj.obj.SummaryRefreshInterval = &value - return obj -} - -// Enables aggregration of different RSVP messages within a single PDU. -// SendBundle returns a bool -func (obj *rsvpIpv4Interface) SendBundle() bool { - - return *obj.obj.SendBundle - -} - -// Enables aggregration of different RSVP messages within a single PDU. -// SendBundle returns a bool -func (obj *rsvpIpv4Interface) HasSendBundle() bool { - return obj.obj.SendBundle != nil -} - -// Enables aggregration of different RSVP messages within a single PDU. -// SetSendBundle sets the bool value in the RsvpIpv4Interface object -func (obj *rsvpIpv4Interface) SetSendBundle(value bool) RsvpIpv4Interface { - - obj.obj.SendBundle = &value - return obj -} - -// The number of milliseconds to wait after which RSVP will bundle different RSVP messages and transmit Bundle messages. -// BundleThreshold returns a uint32 -func (obj *rsvpIpv4Interface) BundleThreshold() uint32 { - - return *obj.obj.BundleThreshold - -} - -// The number of milliseconds to wait after which RSVP will bundle different RSVP messages and transmit Bundle messages. -// BundleThreshold returns a uint32 -func (obj *rsvpIpv4Interface) HasBundleThreshold() bool { - return obj.obj.BundleThreshold != nil -} - -// The number of milliseconds to wait after which RSVP will bundle different RSVP messages and transmit Bundle messages. -// SetBundleThreshold sets the uint32 value in the RsvpIpv4Interface object -func (obj *rsvpIpv4Interface) SetBundleThreshold(value uint32) RsvpIpv4Interface { - - obj.obj.BundleThreshold = &value - return obj -} - -// Enables sending of Hello Messages as per RFC3209. -// EnableHello returns a bool -func (obj *rsvpIpv4Interface) EnableHello() bool { - - return *obj.obj.EnableHello - -} - -// Enables sending of Hello Messages as per RFC3209. -// EnableHello returns a bool -func (obj *rsvpIpv4Interface) HasEnableHello() bool { - return obj.obj.EnableHello != nil -} - -// Enables sending of Hello Messages as per RFC3209. -// SetEnableHello sets the bool value in the RsvpIpv4Interface object -func (obj *rsvpIpv4Interface) SetEnableHello(value bool) RsvpIpv4Interface { - - obj.obj.EnableHello = &value - return obj -} - -// If enable_hello is set to 'true', this specifies the minimum hello interval in seconds at which successive Hello Messages are sent as per RFC3209. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. -// HelloInterval returns a uint32 -func (obj *rsvpIpv4Interface) HelloInterval() uint32 { - - return *obj.obj.HelloInterval - -} - -// If enable_hello is set to 'true', this specifies the minimum hello interval in seconds at which successive Hello Messages are sent as per RFC3209. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. -// HelloInterval returns a uint32 -func (obj *rsvpIpv4Interface) HasHelloInterval() bool { - return obj.obj.HelloInterval != nil -} - -// If enable_hello is set to 'true', this specifies the minimum hello interval in seconds at which successive Hello Messages are sent as per RFC3209. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. -// SetHelloInterval sets the uint32 value in the RsvpIpv4Interface object -func (obj *rsvpIpv4Interface) SetHelloInterval(value uint32) RsvpIpv4Interface { - - obj.obj.HelloInterval = &value - return obj -} - -// The number of missed hellos after which the node should consider RSVP Neighbor to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. -// TimeoutMultiplier returns a uint32 -func (obj *rsvpIpv4Interface) TimeoutMultiplier() uint32 { - - return *obj.obj.TimeoutMultiplier - -} - -// The number of missed hellos after which the node should consider RSVP Neighbor to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. -// TimeoutMultiplier returns a uint32 -func (obj *rsvpIpv4Interface) HasTimeoutMultiplier() bool { - return obj.obj.TimeoutMultiplier != nil -} - -// The number of missed hellos after which the node should consider RSVP Neighbor to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. -// SetTimeoutMultiplier sets the uint32 value in the RsvpIpv4Interface object -func (obj *rsvpIpv4Interface) SetTimeoutMultiplier(value uint32) RsvpIpv4Interface { - - obj.obj.TimeoutMultiplier = &value - return obj -} - -func (obj *rsvpIpv4Interface) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Ipv4Name is required - if obj.obj.Ipv4Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Ipv4Name is required field on interface RsvpIpv4Interface") - } - - // NeighborIp is required - if obj.obj.NeighborIp == nil { - vObj.validationErrors = append(vObj.validationErrors, "NeighborIp is required field on interface RsvpIpv4Interface") - } - if obj.obj.NeighborIp != nil { - - err := obj.validateIpv4(obj.NeighborIp()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on RsvpIpv4Interface.NeighborIp")) - } - - } - - if obj.obj.LabelSpaceStart != nil { - - if *obj.obj.LabelSpaceStart > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpIpv4Interface.LabelSpaceStart <= 1048575 but Got %d", *obj.obj.LabelSpaceStart)) - } - - } - - if obj.obj.LabelSpaceEnd != nil { - - if *obj.obj.LabelSpaceEnd > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpIpv4Interface.LabelSpaceEnd <= 1048575 but Got %d", *obj.obj.LabelSpaceEnd)) - } - - } - - if obj.obj.SummaryRefreshInterval != nil { - - if *obj.obj.SummaryRefreshInterval > 3600 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpIpv4Interface.SummaryRefreshInterval <= 3600 but Got %d", *obj.obj.SummaryRefreshInterval)) - } - - } - - if obj.obj.BundleThreshold != nil { - - if *obj.obj.BundleThreshold > 1000 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpIpv4Interface.BundleThreshold <= 1000 but Got %d", *obj.obj.BundleThreshold)) - } - - } - - if obj.obj.HelloInterval != nil { - - if *obj.obj.HelloInterval > 3600 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpIpv4Interface.HelloInterval <= 3600 but Got %d", *obj.obj.HelloInterval)) - } - - } - - if obj.obj.TimeoutMultiplier != nil { - - if *obj.obj.TimeoutMultiplier > 10 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpIpv4Interface.TimeoutMultiplier <= 10 but Got %d", *obj.obj.TimeoutMultiplier)) - } - - } - -} - -func (obj *rsvpIpv4Interface) setDefault() { - if obj.obj.LabelSpaceStart == nil { - obj.SetLabelSpaceStart(1000) - } - if obj.obj.LabelSpaceEnd == nil { - obj.SetLabelSpaceEnd(100000) - } - if obj.obj.EnableRefreshReduction == nil { - obj.SetEnableRefreshReduction(false) - } - if obj.obj.SummaryRefreshInterval == nil { - obj.SetSummaryRefreshInterval(30) - } - if obj.obj.SendBundle == nil { - obj.SetSendBundle(false) - } - if obj.obj.BundleThreshold == nil { - obj.SetBundleThreshold(50) - } - if obj.obj.EnableHello == nil { - obj.SetEnableHello(false) - } - if obj.obj.HelloInterval == nil { - obj.SetHelloInterval(9) - } - if obj.obj.TimeoutMultiplier == nil { - obj.SetTimeoutMultiplier(3) - } - -} - -// ***** RsvpLspIpv4Interface ***** -type rsvpLspIpv4Interface struct { - validation - obj *otg.RsvpLspIpv4Interface - marshaller marshalRsvpLspIpv4Interface - unMarshaller unMarshalRsvpLspIpv4Interface - p2PEgressIpv4LspsHolder RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - p2PIngressIpv4LspsHolder RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter -} - -func NewRsvpLspIpv4Interface() RsvpLspIpv4Interface { - obj := rsvpLspIpv4Interface{obj: &otg.RsvpLspIpv4Interface{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpLspIpv4Interface) msg() *otg.RsvpLspIpv4Interface { - return obj.obj -} - -func (obj *rsvpLspIpv4Interface) setMsg(msg *otg.RsvpLspIpv4Interface) RsvpLspIpv4Interface { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpLspIpv4Interface struct { - obj *rsvpLspIpv4Interface -} - -type marshalRsvpLspIpv4Interface interface { - // ToProto marshals RsvpLspIpv4Interface to protobuf object *otg.RsvpLspIpv4Interface - ToProto() (*otg.RsvpLspIpv4Interface, error) - // ToPbText marshals RsvpLspIpv4Interface to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpLspIpv4Interface to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpLspIpv4Interface to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpLspIpv4Interface struct { - obj *rsvpLspIpv4Interface -} - -type unMarshalRsvpLspIpv4Interface interface { - // FromProto unmarshals RsvpLspIpv4Interface from protobuf object *otg.RsvpLspIpv4Interface - FromProto(msg *otg.RsvpLspIpv4Interface) (RsvpLspIpv4Interface, error) - // FromPbText unmarshals RsvpLspIpv4Interface from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpLspIpv4Interface from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpLspIpv4Interface from JSON text - FromJson(value string) error -} - -func (obj *rsvpLspIpv4Interface) Marshal() marshalRsvpLspIpv4Interface { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpLspIpv4Interface{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpLspIpv4Interface) Unmarshal() unMarshalRsvpLspIpv4Interface { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpLspIpv4Interface{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpLspIpv4Interface) ToProto() (*otg.RsvpLspIpv4Interface, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpLspIpv4Interface) FromProto(msg *otg.RsvpLspIpv4Interface) (RsvpLspIpv4Interface, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpLspIpv4Interface) 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 *unMarshalrsvpLspIpv4Interface) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalrsvpLspIpv4Interface) 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 *unMarshalrsvpLspIpv4Interface) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalrsvpLspIpv4Interface) 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 *unMarshalrsvpLspIpv4Interface) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *rsvpLspIpv4Interface) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpLspIpv4Interface) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpLspIpv4Interface) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpLspIpv4Interface) Clone() (RsvpLspIpv4Interface, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpLspIpv4Interface() - 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 -} - -func (obj *rsvpLspIpv4Interface) setNil() { - obj.p2PEgressIpv4LspsHolder = nil - obj.p2PIngressIpv4LspsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// RsvpLspIpv4Interface is configuration for RSVP LSP IPv4 Interface. -type RsvpLspIpv4Interface interface { - Validation - // msg marshals RsvpLspIpv4Interface to protobuf object *otg.RsvpLspIpv4Interface - // and doesn't set defaults - msg() *otg.RsvpLspIpv4Interface - // setMsg unmarshals RsvpLspIpv4Interface from protobuf object *otg.RsvpLspIpv4Interface - // and doesn't set defaults - setMsg(*otg.RsvpLspIpv4Interface) RsvpLspIpv4Interface - // provides marshal interface - Marshal() marshalRsvpLspIpv4Interface - // provides unmarshal interface - Unmarshal() unMarshalRsvpLspIpv4Interface - // validate validates RsvpLspIpv4Interface - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpLspIpv4Interface, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv4Name returns string, set in RsvpLspIpv4Interface. - Ipv4Name() string - // SetIpv4Name assigns string provided by user to RsvpLspIpv4Interface - SetIpv4Name(value string) RsvpLspIpv4Interface - // P2PEgressIpv4Lsps returns RsvpLspIpv4InterfaceP2PEgressIpv4Lsp, set in RsvpLspIpv4Interface. - // RsvpLspIpv4InterfaceP2PEgressIpv4Lsp is configuration for RSVP Egress Point-to-Point(P2P) IPv4 LSPs. - P2PEgressIpv4Lsps() RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - // SetP2PEgressIpv4Lsps assigns RsvpLspIpv4InterfaceP2PEgressIpv4Lsp provided by user to RsvpLspIpv4Interface. - // RsvpLspIpv4InterfaceP2PEgressIpv4Lsp is configuration for RSVP Egress Point-to-Point(P2P) IPv4 LSPs. - SetP2PEgressIpv4Lsps(value RsvpLspIpv4InterfaceP2PEgressIpv4Lsp) RsvpLspIpv4Interface - // HasP2PEgressIpv4Lsps checks if P2PEgressIpv4Lsps has been set in RsvpLspIpv4Interface - HasP2PEgressIpv4Lsps() bool - // P2PIngressIpv4Lsps returns RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIterIter, set in RsvpLspIpv4Interface - P2PIngressIpv4Lsps() RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter - setNil() -} - -// The globally unique name of the IPv4 or Loopback IPv4 interface acting as the RSVP ingress and egress endpoint for the LSPs configured on this interface. This must match the "name" field of either "ipv4_addresses" or "ipv4_loopbacks" on which this LSP interface is configured. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv4Loopback/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv4Loopback/properties/name -// -// Ipv4Name returns a string -func (obj *rsvpLspIpv4Interface) Ipv4Name() string { - - return *obj.obj.Ipv4Name - -} - -// The globally unique name of the IPv4 or Loopback IPv4 interface acting as the RSVP ingress and egress endpoint for the LSPs configured on this interface. This must match the "name" field of either "ipv4_addresses" or "ipv4_loopbacks" on which this LSP interface is configured. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv4Loopback/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv4Loopback/properties/name -// -// SetIpv4Name sets the string value in the RsvpLspIpv4Interface object -func (obj *rsvpLspIpv4Interface) SetIpv4Name(value string) RsvpLspIpv4Interface { - - obj.obj.Ipv4Name = &value - return obj -} - -// Contains properties of Tail(Egress) LSPs. -// P2PEgressIpv4Lsps returns a RsvpLspIpv4InterfaceP2PEgressIpv4Lsp -func (obj *rsvpLspIpv4Interface) P2PEgressIpv4Lsps() RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { - if obj.obj.P2PEgressIpv4Lsps == nil { - obj.obj.P2PEgressIpv4Lsps = NewRsvpLspIpv4InterfaceP2PEgressIpv4Lsp().msg() - } - if obj.p2PEgressIpv4LspsHolder == nil { - obj.p2PEgressIpv4LspsHolder = &rsvpLspIpv4InterfaceP2PEgressIpv4Lsp{obj: obj.obj.P2PEgressIpv4Lsps} - } - return obj.p2PEgressIpv4LspsHolder -} - -// Contains properties of Tail(Egress) LSPs. -// P2PEgressIpv4Lsps returns a RsvpLspIpv4InterfaceP2PEgressIpv4Lsp -func (obj *rsvpLspIpv4Interface) HasP2PEgressIpv4Lsps() bool { - return obj.obj.P2PEgressIpv4Lsps != nil -} - -// Contains properties of Tail(Egress) LSPs. -// SetP2PEgressIpv4Lsps sets the RsvpLspIpv4InterfaceP2PEgressIpv4Lsp value in the RsvpLspIpv4Interface object -func (obj *rsvpLspIpv4Interface) SetP2PEgressIpv4Lsps(value RsvpLspIpv4InterfaceP2PEgressIpv4Lsp) RsvpLspIpv4Interface { - - obj.p2PEgressIpv4LspsHolder = nil - obj.obj.P2PEgressIpv4Lsps = value.msg() - - return obj -} - -// Array of point-to-point RSVP-TE P2P LSPs originating from this interface. -// P2PIngressIpv4Lsps returns a []RsvpLspIpv4InterfaceP2PIngressIpv4Lsp -func (obj *rsvpLspIpv4Interface) P2PIngressIpv4Lsps() RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { - if len(obj.obj.P2PIngressIpv4Lsps) == 0 { - obj.obj.P2PIngressIpv4Lsps = []*otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp{} - } - if obj.p2PIngressIpv4LspsHolder == nil { - obj.p2PIngressIpv4LspsHolder = newRsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter(&obj.obj.P2PIngressIpv4Lsps).setMsg(obj) - } - return obj.p2PIngressIpv4LspsHolder -} - -type rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter struct { - obj *rsvpLspIpv4Interface - rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice []RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - fieldPtr *[]*otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp -} - -func newRsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter(ptr *[]*otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { - return &rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter{fieldPtr: ptr} -} - -type RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter interface { - setMsg(*rsvpLspIpv4Interface) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter - Items() []RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - Add() RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - Append(items ...RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter - Set(index int, newObj RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter - Clear() RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter - clearHolderSlice() RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter - appendHolderSlice(item RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter -} - -func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) setMsg(msg *rsvpLspIpv4Interface) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&rsvpLspIpv4InterfaceP2PIngressIpv4Lsp{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) Items() []RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - return obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice -} - -func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) Add() RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - newObj := &otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &rsvpLspIpv4InterfaceP2PIngressIpv4Lsp{obj: newObj} - newLibObj.setDefault() - obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice = append(obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice, newLibObj) - return newLibObj -} - -func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) Append(items ...RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice = append(obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice, item) - } - return obj -} - -func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) Set(index int, newObj RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice[index] = newObj - return obj -} -func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) Clear() RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp{} - obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice = []RsvpLspIpv4InterfaceP2PIngressIpv4Lsp{} - } - return obj -} -func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) clearHolderSlice() RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { - if len(obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice) > 0 { - obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice = []RsvpLspIpv4InterfaceP2PIngressIpv4Lsp{} - } - return obj -} -func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) appendHolderSlice(item RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { - obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice = append(obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice, item) - return obj -} - -func (obj *rsvpLspIpv4Interface) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Ipv4Name is required - if obj.obj.Ipv4Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Ipv4Name is required field on interface RsvpLspIpv4Interface") - } - - if obj.obj.P2PEgressIpv4Lsps != nil { - - obj.P2PEgressIpv4Lsps().validateObj(vObj, set_default) - } - - if len(obj.obj.P2PIngressIpv4Lsps) != 0 { - - if set_default { - obj.P2PIngressIpv4Lsps().clearHolderSlice() - for _, item := range obj.obj.P2PIngressIpv4Lsps { - obj.P2PIngressIpv4Lsps().appendHolderSlice(&rsvpLspIpv4InterfaceP2PIngressIpv4Lsp{obj: item}) - } - } - for _, item := range obj.P2PIngressIpv4Lsps().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *rsvpLspIpv4Interface) setDefault() { - -} - -// ***** DhcpServerV4 ***** -type dhcpServerV4 struct { - validation - obj *otg.DhcpServerV4 - marshaller marshalDhcpServerV4 - unMarshaller unMarshalDhcpServerV4 - addressPoolsHolder DhcpServerV4DhcpServerV4PoolIter -} - -func NewDhcpServerV4() DhcpServerV4 { - obj := dhcpServerV4{obj: &otg.DhcpServerV4{}} - obj.setDefault() - return &obj -} - -func (obj *dhcpServerV4) msg() *otg.DhcpServerV4 { - return obj.obj -} - -func (obj *dhcpServerV4) setMsg(msg *otg.DhcpServerV4) DhcpServerV4 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldhcpServerV4 struct { - obj *dhcpServerV4 -} - -type marshalDhcpServerV4 interface { - // ToProto marshals DhcpServerV4 to protobuf object *otg.DhcpServerV4 - ToProto() (*otg.DhcpServerV4, error) - // ToPbText marshals DhcpServerV4 to protobuf text - ToPbText() (string, error) - // ToYaml marshals DhcpServerV4 to YAML text - ToYaml() (string, error) - // ToJson marshals DhcpServerV4 to JSON text - ToJson() (string, error) -} - -type unMarshaldhcpServerV4 struct { - obj *dhcpServerV4 -} - -type unMarshalDhcpServerV4 interface { - // FromProto unmarshals DhcpServerV4 from protobuf object *otg.DhcpServerV4 - FromProto(msg *otg.DhcpServerV4) (DhcpServerV4, error) - // FromPbText unmarshals DhcpServerV4 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DhcpServerV4 from YAML text - FromYaml(value string) error - // FromJson unmarshals DhcpServerV4 from JSON text - FromJson(value string) error -} - -func (obj *dhcpServerV4) Marshal() marshalDhcpServerV4 { - if obj.marshaller == nil { - obj.marshaller = &marshaldhcpServerV4{obj: obj} - } - return obj.marshaller -} - -func (obj *dhcpServerV4) Unmarshal() unMarshalDhcpServerV4 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldhcpServerV4{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldhcpServerV4) ToProto() (*otg.DhcpServerV4, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldhcpServerV4) FromProto(msg *otg.DhcpServerV4) (DhcpServerV4, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldhcpServerV4) 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 *unMarshaldhcpServerV4) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshaldhcpServerV4) 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 *unMarshaldhcpServerV4) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshaldhcpServerV4) 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 *unMarshaldhcpServerV4) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *dhcpServerV4) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *dhcpServerV4) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *dhcpServerV4) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *dhcpServerV4) Clone() (DhcpServerV4, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDhcpServerV4() - 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 -} - -func (obj *dhcpServerV4) setNil() { - obj.addressPoolsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// DhcpServerV4 is configuration for emulated DHCPv4 Server. -type DhcpServerV4 interface { - Validation - // msg marshals DhcpServerV4 to protobuf object *otg.DhcpServerV4 - // and doesn't set defaults - msg() *otg.DhcpServerV4 - // setMsg unmarshals DhcpServerV4 from protobuf object *otg.DhcpServerV4 - // and doesn't set defaults - setMsg(*otg.DhcpServerV4) DhcpServerV4 - // provides marshal interface - Marshal() marshalDhcpServerV4 - // provides unmarshal interface - Unmarshal() unMarshalDhcpServerV4 - // validate validates DhcpServerV4 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DhcpServerV4, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in DhcpServerV4. - Name() string - // SetName assigns string provided by user to DhcpServerV4 - SetName(value string) DhcpServerV4 - // Ipv4Name returns string, set in DhcpServerV4. - Ipv4Name() string - // SetIpv4Name assigns string provided by user to DhcpServerV4 - SetIpv4Name(value string) DhcpServerV4 - // AddressPools returns DhcpServerV4DhcpServerV4PoolIterIter, set in DhcpServerV4 - AddressPools() DhcpServerV4DhcpServerV4PoolIter - setNil() -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *dhcpServerV4) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the DhcpServerV4 object -func (obj *dhcpServerV4) SetName(value string) DhcpServerV4 { - - obj.obj.Name = &value - return obj -} - -// The unique name of the IPv4 on which DHCPv4 server will run. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// Ipv4Name returns a string -func (obj *dhcpServerV4) Ipv4Name() string { - - return *obj.obj.Ipv4Name - -} - -// The unique name of the IPv4 on which DHCPv4 server will run. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// SetIpv4Name sets the string value in the DhcpServerV4 object -func (obj *dhcpServerV4) SetIpv4Name(value string) DhcpServerV4 { - - obj.obj.Ipv4Name = &value - return obj -} - -// List of DHCPv4 Server Lease parameters -// AddressPools returns a []DhcpServerV4Pool -func (obj *dhcpServerV4) AddressPools() DhcpServerV4DhcpServerV4PoolIter { - if len(obj.obj.AddressPools) == 0 { - obj.obj.AddressPools = []*otg.DhcpServerV4Pool{} - } - if obj.addressPoolsHolder == nil { - obj.addressPoolsHolder = newDhcpServerV4DhcpServerV4PoolIter(&obj.obj.AddressPools).setMsg(obj) - } - return obj.addressPoolsHolder -} - -type dhcpServerV4DhcpServerV4PoolIter struct { - obj *dhcpServerV4 - dhcpServerV4PoolSlice []DhcpServerV4Pool - fieldPtr *[]*otg.DhcpServerV4Pool -} - -func newDhcpServerV4DhcpServerV4PoolIter(ptr *[]*otg.DhcpServerV4Pool) DhcpServerV4DhcpServerV4PoolIter { - return &dhcpServerV4DhcpServerV4PoolIter{fieldPtr: ptr} -} - -type DhcpServerV4DhcpServerV4PoolIter interface { - setMsg(*dhcpServerV4) DhcpServerV4DhcpServerV4PoolIter - Items() []DhcpServerV4Pool - Add() DhcpServerV4Pool - Append(items ...DhcpServerV4Pool) DhcpServerV4DhcpServerV4PoolIter - Set(index int, newObj DhcpServerV4Pool) DhcpServerV4DhcpServerV4PoolIter - Clear() DhcpServerV4DhcpServerV4PoolIter - clearHolderSlice() DhcpServerV4DhcpServerV4PoolIter - appendHolderSlice(item DhcpServerV4Pool) DhcpServerV4DhcpServerV4PoolIter -} - -func (obj *dhcpServerV4DhcpServerV4PoolIter) setMsg(msg *dhcpServerV4) DhcpServerV4DhcpServerV4PoolIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&dhcpServerV4Pool{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *dhcpServerV4DhcpServerV4PoolIter) Items() []DhcpServerV4Pool { - return obj.dhcpServerV4PoolSlice -} - -func (obj *dhcpServerV4DhcpServerV4PoolIter) Add() DhcpServerV4Pool { - newObj := &otg.DhcpServerV4Pool{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &dhcpServerV4Pool{obj: newObj} - newLibObj.setDefault() - obj.dhcpServerV4PoolSlice = append(obj.dhcpServerV4PoolSlice, newLibObj) - return newLibObj -} - -func (obj *dhcpServerV4DhcpServerV4PoolIter) Append(items ...DhcpServerV4Pool) DhcpServerV4DhcpServerV4PoolIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.dhcpServerV4PoolSlice = append(obj.dhcpServerV4PoolSlice, item) - } - return obj -} - -func (obj *dhcpServerV4DhcpServerV4PoolIter) Set(index int, newObj DhcpServerV4Pool) DhcpServerV4DhcpServerV4PoolIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.dhcpServerV4PoolSlice[index] = newObj - return obj -} -func (obj *dhcpServerV4DhcpServerV4PoolIter) Clear() DhcpServerV4DhcpServerV4PoolIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.DhcpServerV4Pool{} - obj.dhcpServerV4PoolSlice = []DhcpServerV4Pool{} - } - return obj -} -func (obj *dhcpServerV4DhcpServerV4PoolIter) clearHolderSlice() DhcpServerV4DhcpServerV4PoolIter { - if len(obj.dhcpServerV4PoolSlice) > 0 { - obj.dhcpServerV4PoolSlice = []DhcpServerV4Pool{} - } - return obj -} -func (obj *dhcpServerV4DhcpServerV4PoolIter) appendHolderSlice(item DhcpServerV4Pool) DhcpServerV4DhcpServerV4PoolIter { - obj.dhcpServerV4PoolSlice = append(obj.dhcpServerV4PoolSlice, item) - return obj -} - -func (obj *dhcpServerV4) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface DhcpServerV4") - } - - // Ipv4Name is required - if obj.obj.Ipv4Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Ipv4Name is required field on interface DhcpServerV4") - } - - if len(obj.obj.AddressPools) != 0 { - - if set_default { - obj.AddressPools().clearHolderSlice() - for _, item := range obj.obj.AddressPools { - obj.AddressPools().appendHolderSlice(&dhcpServerV4Pool{obj: item}) - } - } - for _, item := range obj.AddressPools().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *dhcpServerV4) setDefault() { - -} - -// ***** FlowPort ***** -type flowPort struct { - validation - obj *otg.FlowPort - marshaller marshalFlowPort - unMarshaller unMarshalFlowPort -} - -func NewFlowPort() FlowPort { - obj := flowPort{obj: &otg.FlowPort{}} - obj.setDefault() - return &obj -} - -func (obj *flowPort) msg() *otg.FlowPort { - return obj.obj -} - -func (obj *flowPort) setMsg(msg *otg.FlowPort) FlowPort { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowPort struct { - obj *flowPort -} - -type marshalFlowPort interface { - // ToProto marshals FlowPort to protobuf object *otg.FlowPort - ToProto() (*otg.FlowPort, error) - // ToPbText marshals FlowPort to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowPort to YAML text - ToYaml() (string, error) - // ToJson marshals FlowPort to JSON text - ToJson() (string, error) -} - -type unMarshalflowPort struct { - obj *flowPort -} - -type unMarshalFlowPort interface { - // FromProto unmarshals FlowPort from protobuf object *otg.FlowPort - FromProto(msg *otg.FlowPort) (FlowPort, error) - // FromPbText unmarshals FlowPort from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowPort from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowPort from JSON text - FromJson(value string) error -} - -func (obj *flowPort) Marshal() marshalFlowPort { - if obj.marshaller == nil { - obj.marshaller = &marshalflowPort{obj: obj} - } - return obj.marshaller -} - -func (obj *flowPort) Unmarshal() unMarshalFlowPort { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowPort{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowPort) ToProto() (*otg.FlowPort, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowPort) FromProto(msg *otg.FlowPort) (FlowPort, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowPort) 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 *unMarshalflowPort) 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 *marshalflowPort) 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 *unMarshalflowPort) 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 *marshalflowPort) 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 *unMarshalflowPort) 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 *flowPort) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowPort) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowPort) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowPort) Clone() (FlowPort, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowPort() - 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 -} - -// FlowPort is a container for a transmit port and 0..n intended receive ports. -// When assigning this container to a flow the flows's -// packet headers will not be populated with any address resolution -// information such as source and/or destination addresses. -// For example Flow.Ethernet dst mac address values will be defaulted to 0. -// For full control over the Flow.properties.packet header contents use this -// container. -type FlowPort interface { - Validation - // msg marshals FlowPort to protobuf object *otg.FlowPort - // and doesn't set defaults - msg() *otg.FlowPort - // setMsg unmarshals FlowPort from protobuf object *otg.FlowPort - // and doesn't set defaults - setMsg(*otg.FlowPort) FlowPort - // provides marshal interface - Marshal() marshalFlowPort - // provides unmarshal interface - Unmarshal() unMarshalFlowPort - // validate validates FlowPort - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowPort, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // TxName returns string, set in FlowPort. - TxName() string - // SetTxName assigns string provided by user to FlowPort - SetTxName(value string) FlowPort - // RxName returns string, set in FlowPort. - RxName() string - // SetRxName assigns string provided by user to FlowPort - SetRxName(value string) FlowPort - // HasRxName checks if RxName has been set in FlowPort - HasRxName() bool - // RxNames returns []string, set in FlowPort. - RxNames() []string - // SetRxNames assigns []string provided by user to FlowPort - SetRxNames(value []string) FlowPort -} - -// The unique name of a port that is the transmit port. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// - /components/schemas/Lag/properties/name -// -// TxName returns a string -func (obj *flowPort) TxName() string { - - return *obj.obj.TxName - -} - -// The unique name of a port that is the transmit port. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// - /components/schemas/Lag/properties/name -// -// SetTxName sets the string value in the FlowPort object -func (obj *flowPort) SetTxName(value string) FlowPort { - - obj.obj.TxName = &value - return obj -} - -// Deprecated: This property is deprecated in favor of property rx_names -// -// Deprecated: This property is deprecated in favor of property rx_names -// -// The unique name of a port that is the intended receive port. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// - /components/schemas/Lag/properties/name -// -// RxName returns a string -func (obj *flowPort) RxName() string { - - return *obj.obj.RxName - -} - -// Deprecated: This property is deprecated in favor of property rx_names -// -// Deprecated: This property is deprecated in favor of property rx_names -// -// The unique name of a port that is the intended receive port. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// - /components/schemas/Lag/properties/name -// -// RxName returns a string -func (obj *flowPort) HasRxName() bool { - return obj.obj.RxName != nil -} - -// Deprecated: This property is deprecated in favor of property rx_names -// -// Deprecated: This property is deprecated in favor of property rx_names -// -// The unique name of a port that is the intended receive port. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// - /components/schemas/Lag/properties/name -// -// SetRxName sets the string value in the FlowPort object -func (obj *flowPort) SetRxName(value string) FlowPort { - - obj.obj.RxName = &value - return obj -} - -// Unique name of ports or lags that are intended receive endpoints. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// - /components/schemas/Lag/properties/name -// -// RxNames returns a []string -func (obj *flowPort) RxNames() []string { - if obj.obj.RxNames == nil { - obj.obj.RxNames = make([]string, 0) - } - return obj.obj.RxNames -} - -// Unique name of ports or lags that are intended receive endpoints. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// - /components/schemas/Lag/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// - /components/schemas/Lag/properties/name -// -// SetRxNames sets the []string value in the FlowPort object -func (obj *flowPort) SetRxNames(value []string) FlowPort { - - if obj.obj.RxNames == nil { - obj.obj.RxNames = make([]string, 0) - } - obj.obj.RxNames = value - - return obj -} - -func (obj *flowPort) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // TxName is required - if obj.obj.TxName == nil { - vObj.validationErrors = append(vObj.validationErrors, "TxName is required field on interface FlowPort") - } - - // RxName is deprecated - if obj.obj.RxName != nil { - obj.addWarnings("RxName property in schema FlowPort is deprecated, This property is deprecated in favor of property rx_names") - } - -} - -func (obj *flowPort) setDefault() { - -} - -// ***** FlowRouter ***** -type flowRouter struct { - validation - obj *otg.FlowRouter - marshaller marshalFlowRouter - unMarshaller unMarshalFlowRouter -} - -func NewFlowRouter() FlowRouter { - obj := flowRouter{obj: &otg.FlowRouter{}} - obj.setDefault() - return &obj -} - -func (obj *flowRouter) msg() *otg.FlowRouter { - return obj.obj -} - -func (obj *flowRouter) setMsg(msg *otg.FlowRouter) FlowRouter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRouter struct { - obj *flowRouter -} - -type marshalFlowRouter interface { - // ToProto marshals FlowRouter to protobuf object *otg.FlowRouter - ToProto() (*otg.FlowRouter, error) - // ToPbText marshals FlowRouter to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRouter to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRouter to JSON text - ToJson() (string, error) -} - -type unMarshalflowRouter struct { - obj *flowRouter -} - -type unMarshalFlowRouter interface { - // FromProto unmarshals FlowRouter from protobuf object *otg.FlowRouter - FromProto(msg *otg.FlowRouter) (FlowRouter, error) - // FromPbText unmarshals FlowRouter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRouter from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRouter from JSON text - FromJson(value string) error -} - -func (obj *flowRouter) Marshal() marshalFlowRouter { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRouter{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRouter) Unmarshal() unMarshalFlowRouter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRouter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRouter) ToProto() (*otg.FlowRouter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRouter) FromProto(msg *otg.FlowRouter) (FlowRouter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRouter) 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 *unMarshalflowRouter) 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 *marshalflowRouter) 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 *unMarshalflowRouter) 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 *marshalflowRouter) 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 *unMarshalflowRouter) 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 *flowRouter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRouter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRouter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRouter) Clone() (FlowRouter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRouter() - 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 -} - -// FlowRouter is a container for declaring a map of 1..n transmit devices to 1..n receive devices. This allows for a single flow to have different tx to rx device flows such as a single one to one map or a many to many map. -type FlowRouter interface { - Validation - // msg marshals FlowRouter to protobuf object *otg.FlowRouter - // and doesn't set defaults - msg() *otg.FlowRouter - // setMsg unmarshals FlowRouter from protobuf object *otg.FlowRouter - // and doesn't set defaults - setMsg(*otg.FlowRouter) FlowRouter - // provides marshal interface - Marshal() marshalFlowRouter - // provides unmarshal interface - Unmarshal() unMarshalFlowRouter - // validate validates FlowRouter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRouter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Mode returns FlowRouterModeEnum, set in FlowRouter - Mode() FlowRouterModeEnum - // SetMode assigns FlowRouterModeEnum provided by user to FlowRouter - SetMode(value FlowRouterModeEnum) FlowRouter - // HasMode checks if Mode has been set in FlowRouter - HasMode() bool - // TxNames returns []string, set in FlowRouter. - TxNames() []string - // SetTxNames assigns []string provided by user to FlowRouter - SetTxNames(value []string) FlowRouter - // RxNames returns []string, set in FlowRouter. - RxNames() []string - // SetRxNames assigns []string provided by user to FlowRouter - SetRxNames(value []string) FlowRouter -} - -type FlowRouterModeEnum string - -// Enum of Mode on FlowRouter -var FlowRouterMode = struct { - MESH FlowRouterModeEnum - ONE_TO_ONE FlowRouterModeEnum -}{ - MESH: FlowRouterModeEnum("mesh"), - ONE_TO_ONE: FlowRouterModeEnum("one_to_one"), -} - -func (obj *flowRouter) Mode() FlowRouterModeEnum { - return FlowRouterModeEnum(obj.obj.Mode.Enum().String()) -} - -// Determines the intent of creating traffic sub-flow(s) between the device -// endpoints, from the entities of tx_names to the entities of rx_names -// to derive how auto packet fields can be populated with -// the actual value(s) by the implementation. -// -// The one_to_one mode creates traffic sub-flow(s) between each device endpoint pair in -// tx_names to rx_names by index. -// The length of tx_names and rx_names MUST be the same. -// The same device name can be repeated multiple times in tx_names or rx_names, in any order to create desired meshing between device(s). -// For 2 values in tx_names and 2 values in rx_names, 2 device endpoint pairs would be generated (each pair representing a traffic sub-flow). -// -// The mesh mode creates traffic sub-flow(s) between each value in tx_names to -// every value in rx_names, forming the device endpoint pair(s). -// For 2 values in tx_names and 3 values in rx_names, generated device endpoint pairs would be 2x3=6. -// -// A generated device endpoint pair with same device endpoint name for both transmit & receive device endpoint MUST raise an error. -// -// Packet fields of type auto would be populated with one value for each device endpoint pair (representing the traffic sub-flow). -// The value would be determined considering transmit & receive device of the sub-flow. And the sequence of the populated value(s) -// would be in the order of generated device endpoint pair(s). -// If 2 device endpoint pairs are generated (based on mode, tx_names and rx_names), say (d1 to d3) and (d2 to d3), and ethernet.dst is set as auto, then -// the auto field would be replaced by the implementation with a sequence of 2 values, [v1,v2] where -// v1 is determined using context (d1,d3) and v2 using context (d2,d3). -// The final outcome is that packets generated on the wire will contain the values v1,v2,v1,... for ethernet.dst field. Any non-auto packet fields -// should be configured accordingly. For example, non-auto packet field ethernet.src can be configured with values [u1, u2], where -// u1 & u2 are source MAC of the connected interface of device d1 and d2 respectively. Then packets on the wire will contain correct value pairs -// (u1,v1),(u2,v2),(u1,v1),... for (ethernet.src,ethernet.dst) fields. -// Mode returns a string -func (obj *flowRouter) HasMode() bool { - return obj.obj.Mode != nil -} - -func (obj *flowRouter) SetMode(value FlowRouterModeEnum) FlowRouter { - intValue, ok := otg.FlowRouter_Mode_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRouterModeEnum", string(value))) - return obj - } - enumValue := otg.FlowRouter_Mode_Enum(intValue) - obj.obj.Mode = &enumValue - - return obj -} - -// TBD -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Bgp.V4RouteRange/properties/name -// - /components/schemas/Bgp.V6RouteRange/properties/name -// - /components/schemas/Bgp.CMacIpRange/properties/name -// - /components/schemas/Rsvp.LspIpv4Interface.P2PIngressIpv4Lsp/properties/name -// - /components/schemas/Isis.V4RouteRange/properties/name -// - /components/schemas/Isis.V6RouteRange/properties/name -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Bgp.V4RouteRange/properties/name -// - /components/schemas/Bgp.V6RouteRange/properties/name -// - /components/schemas/Bgp.CMacIpRange/properties/name -// - /components/schemas/Rsvp.LspIpv4Interface.P2PIngressIpv4Lsp/properties/name -// - /components/schemas/Isis.V4RouteRange/properties/name -// - /components/schemas/Isis.V6RouteRange/properties/name -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// TxNames returns a []string -func (obj *flowRouter) TxNames() []string { - if obj.obj.TxNames == nil { - obj.obj.TxNames = make([]string, 0) - } - return obj.obj.TxNames -} - -// TBD -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Bgp.V4RouteRange/properties/name -// - /components/schemas/Bgp.V6RouteRange/properties/name -// - /components/schemas/Bgp.CMacIpRange/properties/name -// - /components/schemas/Rsvp.LspIpv4Interface.P2PIngressIpv4Lsp/properties/name -// - /components/schemas/Isis.V4RouteRange/properties/name -// - /components/schemas/Isis.V6RouteRange/properties/name -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Bgp.V4RouteRange/properties/name -// - /components/schemas/Bgp.V6RouteRange/properties/name -// - /components/schemas/Bgp.CMacIpRange/properties/name -// - /components/schemas/Rsvp.LspIpv4Interface.P2PIngressIpv4Lsp/properties/name -// - /components/schemas/Isis.V4RouteRange/properties/name -// - /components/schemas/Isis.V6RouteRange/properties/name -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// SetTxNames sets the []string value in the FlowRouter object -func (obj *flowRouter) SetTxNames(value []string) FlowRouter { - - if obj.obj.TxNames == nil { - obj.obj.TxNames = make([]string, 0) - } - obj.obj.TxNames = value - - return obj -} - -// TBD -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Bgp.V4RouteRange/properties/name -// - /components/schemas/Bgp.V6RouteRange/properties/name -// - /components/schemas/Bgp.CMacIpRange/properties/name -// - /components/schemas/Rsvp.LspIpv4Interface.P2PEgressIpv4Lsp/properties/name -// - /components/schemas/Isis.V4RouteRange/properties/name -// - /components/schemas/Isis.V6RouteRange/properties/name -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Bgp.V4RouteRange/properties/name -// - /components/schemas/Bgp.V6RouteRange/properties/name -// - /components/schemas/Bgp.CMacIpRange/properties/name -// - /components/schemas/Rsvp.LspIpv4Interface.P2PEgressIpv4Lsp/properties/name -// - /components/schemas/Isis.V4RouteRange/properties/name -// - /components/schemas/Isis.V6RouteRange/properties/name -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// RxNames returns a []string -func (obj *flowRouter) RxNames() []string { - if obj.obj.RxNames == nil { - obj.obj.RxNames = make([]string, 0) - } - return obj.obj.RxNames -} - -// TBD -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Bgp.V4RouteRange/properties/name -// - /components/schemas/Bgp.V6RouteRange/properties/name -// - /components/schemas/Bgp.CMacIpRange/properties/name -// - /components/schemas/Rsvp.LspIpv4Interface.P2PEgressIpv4Lsp/properties/name -// - /components/schemas/Isis.V4RouteRange/properties/name -// - /components/schemas/Isis.V6RouteRange/properties/name -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ethernet/properties/name -// - /components/schemas/Device.Ipv4/properties/name -// - /components/schemas/Device.Ipv6/properties/name -// - /components/schemas/Bgp.V4RouteRange/properties/name -// - /components/schemas/Bgp.V6RouteRange/properties/name -// - /components/schemas/Bgp.CMacIpRange/properties/name -// - /components/schemas/Rsvp.LspIpv4Interface.P2PEgressIpv4Lsp/properties/name -// - /components/schemas/Isis.V4RouteRange/properties/name -// - /components/schemas/Isis.V6RouteRange/properties/name -// - /components/schemas/Device.Dhcpv4client/properties/name -// -// SetRxNames sets the []string value in the FlowRouter object -func (obj *flowRouter) SetRxNames(value []string) FlowRouter { - - if obj.obj.RxNames == nil { - obj.obj.RxNames = make([]string, 0) - } - obj.obj.RxNames = value - - return obj -} - -func (obj *flowRouter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *flowRouter) setDefault() { - if obj.obj.Mode == nil { - obj.SetMode(FlowRouterMode.MESH) - - } - -} - -// ***** FlowCustom ***** -type flowCustom struct { - validation - obj *otg.FlowCustom - marshaller marshalFlowCustom - unMarshaller unMarshalFlowCustom - metricTagsHolder FlowCustomFlowCustomMetricTagIter -} - -func NewFlowCustom() FlowCustom { - obj := flowCustom{obj: &otg.FlowCustom{}} - obj.setDefault() - return &obj -} - -func (obj *flowCustom) msg() *otg.FlowCustom { - return obj.obj -} - -func (obj *flowCustom) setMsg(msg *otg.FlowCustom) FlowCustom { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowCustom struct { - obj *flowCustom -} - -type marshalFlowCustom interface { - // ToProto marshals FlowCustom to protobuf object *otg.FlowCustom - ToProto() (*otg.FlowCustom, error) - // ToPbText marshals FlowCustom to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowCustom to YAML text - ToYaml() (string, error) - // ToJson marshals FlowCustom to JSON text - ToJson() (string, error) -} - -type unMarshalflowCustom struct { - obj *flowCustom -} - -type unMarshalFlowCustom interface { - // FromProto unmarshals FlowCustom from protobuf object *otg.FlowCustom - FromProto(msg *otg.FlowCustom) (FlowCustom, error) - // FromPbText unmarshals FlowCustom from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowCustom from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowCustom from JSON text - FromJson(value string) error -} - -func (obj *flowCustom) Marshal() marshalFlowCustom { - if obj.marshaller == nil { - obj.marshaller = &marshalflowCustom{obj: obj} - } - return obj.marshaller -} - -func (obj *flowCustom) Unmarshal() unMarshalFlowCustom { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowCustom{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowCustom) ToProto() (*otg.FlowCustom, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowCustom) FromProto(msg *otg.FlowCustom) (FlowCustom, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowCustom) 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 *unMarshalflowCustom) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowCustom) 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 *unMarshalflowCustom) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowCustom) 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 *unMarshalflowCustom) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowCustom) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowCustom) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowCustom) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowCustom) Clone() (FlowCustom, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowCustom() - 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 -} - -func (obj *flowCustom) setNil() { - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowCustom is custom packet header -type FlowCustom interface { - Validation - // msg marshals FlowCustom to protobuf object *otg.FlowCustom - // and doesn't set defaults - msg() *otg.FlowCustom - // setMsg unmarshals FlowCustom from protobuf object *otg.FlowCustom - // and doesn't set defaults - setMsg(*otg.FlowCustom) FlowCustom - // provides marshal interface - Marshal() marshalFlowCustom - // provides unmarshal interface - Unmarshal() unMarshalFlowCustom - // validate validates FlowCustom - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowCustom, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Bytes returns string, set in FlowCustom. - Bytes() string - // SetBytes assigns string provided by user to FlowCustom - SetBytes(value string) FlowCustom - // MetricTags returns FlowCustomFlowCustomMetricTagIterIter, set in FlowCustom - MetricTags() FlowCustomFlowCustomMetricTagIter - setNil() -} - -// A custom packet header defined as a string of hex bytes. The string MUST contain sequence of valid hex bytes. Spaces or colons can be part of the bytes but will be discarded. This packet header can be used in multiple places in the packet. -// Bytes returns a string -func (obj *flowCustom) Bytes() string { - - return *obj.obj.Bytes - -} - -// A custom packet header defined as a string of hex bytes. The string MUST contain sequence of valid hex bytes. Spaces or colons can be part of the bytes but will be discarded. This packet header can be used in multiple places in the packet. -// SetBytes sets the string value in the FlowCustom object -func (obj *flowCustom) SetBytes(value string) FlowCustom { - - obj.obj.Bytes = &value - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits -// in a corresponding header field for metrics per each applicable value. -// These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []FlowCustomMetricTag -func (obj *flowCustom) MetricTags() FlowCustomFlowCustomMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.FlowCustomMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newFlowCustomFlowCustomMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type flowCustomFlowCustomMetricTagIter struct { - obj *flowCustom - flowCustomMetricTagSlice []FlowCustomMetricTag - fieldPtr *[]*otg.FlowCustomMetricTag -} - -func newFlowCustomFlowCustomMetricTagIter(ptr *[]*otg.FlowCustomMetricTag) FlowCustomFlowCustomMetricTagIter { - return &flowCustomFlowCustomMetricTagIter{fieldPtr: ptr} -} - -type FlowCustomFlowCustomMetricTagIter interface { - setMsg(*flowCustom) FlowCustomFlowCustomMetricTagIter - Items() []FlowCustomMetricTag - Add() FlowCustomMetricTag - Append(items ...FlowCustomMetricTag) FlowCustomFlowCustomMetricTagIter - Set(index int, newObj FlowCustomMetricTag) FlowCustomFlowCustomMetricTagIter - Clear() FlowCustomFlowCustomMetricTagIter - clearHolderSlice() FlowCustomFlowCustomMetricTagIter - appendHolderSlice(item FlowCustomMetricTag) FlowCustomFlowCustomMetricTagIter -} - -func (obj *flowCustomFlowCustomMetricTagIter) setMsg(msg *flowCustom) FlowCustomFlowCustomMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flowCustomMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *flowCustomFlowCustomMetricTagIter) Items() []FlowCustomMetricTag { - return obj.flowCustomMetricTagSlice -} - -func (obj *flowCustomFlowCustomMetricTagIter) Add() FlowCustomMetricTag { - newObj := &otg.FlowCustomMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flowCustomMetricTag{obj: newObj} - newLibObj.setDefault() - obj.flowCustomMetricTagSlice = append(obj.flowCustomMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *flowCustomFlowCustomMetricTagIter) Append(items ...FlowCustomMetricTag) FlowCustomFlowCustomMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowCustomMetricTagSlice = append(obj.flowCustomMetricTagSlice, item) - } - return obj -} - -func (obj *flowCustomFlowCustomMetricTagIter) Set(index int, newObj FlowCustomMetricTag) FlowCustomFlowCustomMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowCustomMetricTagSlice[index] = newObj - return obj -} -func (obj *flowCustomFlowCustomMetricTagIter) Clear() FlowCustomFlowCustomMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.FlowCustomMetricTag{} - obj.flowCustomMetricTagSlice = []FlowCustomMetricTag{} - } - return obj -} -func (obj *flowCustomFlowCustomMetricTagIter) clearHolderSlice() FlowCustomFlowCustomMetricTagIter { - if len(obj.flowCustomMetricTagSlice) > 0 { - obj.flowCustomMetricTagSlice = []FlowCustomMetricTag{} - } - return obj -} -func (obj *flowCustomFlowCustomMetricTagIter) appendHolderSlice(item FlowCustomMetricTag) FlowCustomFlowCustomMetricTagIter { - obj.flowCustomMetricTagSlice = append(obj.flowCustomMetricTagSlice, item) - return obj -} - -func (obj *flowCustom) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Bytes is required - if obj.obj.Bytes == nil { - vObj.validationErrors = append(vObj.validationErrors, "Bytes is required field on interface FlowCustom") - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&flowCustomMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *flowCustom) setDefault() { - -} - -// ***** FlowEthernet ***** -type flowEthernet struct { - validation - obj *otg.FlowEthernet - marshaller marshalFlowEthernet - unMarshaller unMarshalFlowEthernet - dstHolder PatternFlowEthernetDst - srcHolder PatternFlowEthernetSrc - etherTypeHolder PatternFlowEthernetEtherType - pfcQueueHolder PatternFlowEthernetPfcQueue -} - -func NewFlowEthernet() FlowEthernet { - obj := flowEthernet{obj: &otg.FlowEthernet{}} - obj.setDefault() - return &obj -} - -func (obj *flowEthernet) msg() *otg.FlowEthernet { - return obj.obj -} - -func (obj *flowEthernet) setMsg(msg *otg.FlowEthernet) FlowEthernet { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowEthernet struct { - obj *flowEthernet -} - -type marshalFlowEthernet interface { - // ToProto marshals FlowEthernet to protobuf object *otg.FlowEthernet - ToProto() (*otg.FlowEthernet, error) - // ToPbText marshals FlowEthernet to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowEthernet to YAML text - ToYaml() (string, error) - // ToJson marshals FlowEthernet to JSON text - ToJson() (string, error) -} - -type unMarshalflowEthernet struct { - obj *flowEthernet -} - -type unMarshalFlowEthernet interface { - // FromProto unmarshals FlowEthernet from protobuf object *otg.FlowEthernet - FromProto(msg *otg.FlowEthernet) (FlowEthernet, error) - // FromPbText unmarshals FlowEthernet from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowEthernet from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowEthernet from JSON text - FromJson(value string) error -} - -func (obj *flowEthernet) Marshal() marshalFlowEthernet { - if obj.marshaller == nil { - obj.marshaller = &marshalflowEthernet{obj: obj} - } - return obj.marshaller -} - -func (obj *flowEthernet) Unmarshal() unMarshalFlowEthernet { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowEthernet{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowEthernet) ToProto() (*otg.FlowEthernet, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowEthernet) FromProto(msg *otg.FlowEthernet) (FlowEthernet, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowEthernet) 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 *unMarshalflowEthernet) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowEthernet) 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 *unMarshalflowEthernet) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowEthernet) 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 *unMarshalflowEthernet) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowEthernet) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowEthernet) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowEthernet) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowEthernet) Clone() (FlowEthernet, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowEthernet() - 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 -} - -func (obj *flowEthernet) setNil() { - obj.dstHolder = nil - obj.srcHolder = nil - obj.etherTypeHolder = nil - obj.pfcQueueHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowEthernet is ethernet packet header -type FlowEthernet interface { - Validation - // msg marshals FlowEthernet to protobuf object *otg.FlowEthernet - // and doesn't set defaults - msg() *otg.FlowEthernet - // setMsg unmarshals FlowEthernet from protobuf object *otg.FlowEthernet - // and doesn't set defaults - setMsg(*otg.FlowEthernet) FlowEthernet - // provides marshal interface - Marshal() marshalFlowEthernet - // provides unmarshal interface - Unmarshal() unMarshalFlowEthernet - // validate validates FlowEthernet - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowEthernet, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Dst returns PatternFlowEthernetDst, set in FlowEthernet. - // PatternFlowEthernetDst is destination MAC address - Dst() PatternFlowEthernetDst - // SetDst assigns PatternFlowEthernetDst provided by user to FlowEthernet. - // PatternFlowEthernetDst is destination MAC address - SetDst(value PatternFlowEthernetDst) FlowEthernet - // HasDst checks if Dst has been set in FlowEthernet - HasDst() bool - // Src returns PatternFlowEthernetSrc, set in FlowEthernet. - // PatternFlowEthernetSrc is source MAC address - Src() PatternFlowEthernetSrc - // SetSrc assigns PatternFlowEthernetSrc provided by user to FlowEthernet. - // PatternFlowEthernetSrc is source MAC address - SetSrc(value PatternFlowEthernetSrc) FlowEthernet - // HasSrc checks if Src has been set in FlowEthernet - HasSrc() bool - // EtherType returns PatternFlowEthernetEtherType, set in FlowEthernet. - // PatternFlowEthernetEtherType is ethernet type - EtherType() PatternFlowEthernetEtherType - // SetEtherType assigns PatternFlowEthernetEtherType provided by user to FlowEthernet. - // PatternFlowEthernetEtherType is ethernet type - SetEtherType(value PatternFlowEthernetEtherType) FlowEthernet - // HasEtherType checks if EtherType has been set in FlowEthernet - HasEtherType() bool - // PfcQueue returns PatternFlowEthernetPfcQueue, set in FlowEthernet. - // PatternFlowEthernetPfcQueue is priority flow control queue - PfcQueue() PatternFlowEthernetPfcQueue - // SetPfcQueue assigns PatternFlowEthernetPfcQueue provided by user to FlowEthernet. - // PatternFlowEthernetPfcQueue is priority flow control queue - SetPfcQueue(value PatternFlowEthernetPfcQueue) FlowEthernet - // HasPfcQueue checks if PfcQueue has been set in FlowEthernet - HasPfcQueue() bool - setNil() -} - -// description is TBD -// Dst returns a PatternFlowEthernetDst -func (obj *flowEthernet) Dst() PatternFlowEthernetDst { - if obj.obj.Dst == nil { - obj.obj.Dst = NewPatternFlowEthernetDst().msg() - } - if obj.dstHolder == nil { - obj.dstHolder = &patternFlowEthernetDst{obj: obj.obj.Dst} - } - return obj.dstHolder -} - -// description is TBD -// Dst returns a PatternFlowEthernetDst -func (obj *flowEthernet) HasDst() bool { - return obj.obj.Dst != nil -} - -// description is TBD -// SetDst sets the PatternFlowEthernetDst value in the FlowEthernet object -func (obj *flowEthernet) SetDst(value PatternFlowEthernetDst) FlowEthernet { - - obj.dstHolder = nil - obj.obj.Dst = value.msg() - - return obj -} - -// description is TBD -// Src returns a PatternFlowEthernetSrc -func (obj *flowEthernet) Src() PatternFlowEthernetSrc { - if obj.obj.Src == nil { - obj.obj.Src = NewPatternFlowEthernetSrc().msg() - } - if obj.srcHolder == nil { - obj.srcHolder = &patternFlowEthernetSrc{obj: obj.obj.Src} - } - return obj.srcHolder -} - -// description is TBD -// Src returns a PatternFlowEthernetSrc -func (obj *flowEthernet) HasSrc() bool { - return obj.obj.Src != nil -} - -// description is TBD -// SetSrc sets the PatternFlowEthernetSrc value in the FlowEthernet object -func (obj *flowEthernet) SetSrc(value PatternFlowEthernetSrc) FlowEthernet { - - obj.srcHolder = nil - obj.obj.Src = value.msg() - - return obj -} - -// description is TBD -// EtherType returns a PatternFlowEthernetEtherType -func (obj *flowEthernet) EtherType() PatternFlowEthernetEtherType { - if obj.obj.EtherType == nil { - obj.obj.EtherType = NewPatternFlowEthernetEtherType().msg() - } - if obj.etherTypeHolder == nil { - obj.etherTypeHolder = &patternFlowEthernetEtherType{obj: obj.obj.EtherType} - } - return obj.etherTypeHolder -} - -// description is TBD -// EtherType returns a PatternFlowEthernetEtherType -func (obj *flowEthernet) HasEtherType() bool { - return obj.obj.EtherType != nil -} - -// description is TBD -// SetEtherType sets the PatternFlowEthernetEtherType value in the FlowEthernet object -func (obj *flowEthernet) SetEtherType(value PatternFlowEthernetEtherType) FlowEthernet { - - obj.etherTypeHolder = nil - obj.obj.EtherType = value.msg() - - return obj -} - -// description is TBD -// PfcQueue returns a PatternFlowEthernetPfcQueue -func (obj *flowEthernet) PfcQueue() PatternFlowEthernetPfcQueue { - if obj.obj.PfcQueue == nil { - obj.obj.PfcQueue = NewPatternFlowEthernetPfcQueue().msg() - } - if obj.pfcQueueHolder == nil { - obj.pfcQueueHolder = &patternFlowEthernetPfcQueue{obj: obj.obj.PfcQueue} - } - return obj.pfcQueueHolder -} - -// description is TBD -// PfcQueue returns a PatternFlowEthernetPfcQueue -func (obj *flowEthernet) HasPfcQueue() bool { - return obj.obj.PfcQueue != nil -} - -// description is TBD -// SetPfcQueue sets the PatternFlowEthernetPfcQueue value in the FlowEthernet object -func (obj *flowEthernet) SetPfcQueue(value PatternFlowEthernetPfcQueue) FlowEthernet { - - obj.pfcQueueHolder = nil - obj.obj.PfcQueue = value.msg() - - return obj -} - -func (obj *flowEthernet) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Dst != nil { - - obj.Dst().validateObj(vObj, set_default) - } - - if obj.obj.Src != nil { - - obj.Src().validateObj(vObj, set_default) - } - - if obj.obj.EtherType != nil { - - obj.EtherType().validateObj(vObj, set_default) - } - - if obj.obj.PfcQueue != nil { - - obj.PfcQueue().validateObj(vObj, set_default) - } - -} - -func (obj *flowEthernet) setDefault() { - -} - -// ***** FlowVlan ***** -type flowVlan struct { - validation - obj *otg.FlowVlan - marshaller marshalFlowVlan - unMarshaller unMarshalFlowVlan - priorityHolder PatternFlowVlanPriority - cfiHolder PatternFlowVlanCfi - idHolder PatternFlowVlanId - tpidHolder PatternFlowVlanTpid -} - -func NewFlowVlan() FlowVlan { - obj := flowVlan{obj: &otg.FlowVlan{}} - obj.setDefault() - return &obj -} - -func (obj *flowVlan) msg() *otg.FlowVlan { - return obj.obj -} - -func (obj *flowVlan) setMsg(msg *otg.FlowVlan) FlowVlan { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowVlan struct { - obj *flowVlan -} - -type marshalFlowVlan interface { - // ToProto marshals FlowVlan to protobuf object *otg.FlowVlan - ToProto() (*otg.FlowVlan, error) - // ToPbText marshals FlowVlan to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowVlan to YAML text - ToYaml() (string, error) - // ToJson marshals FlowVlan to JSON text - ToJson() (string, error) -} - -type unMarshalflowVlan struct { - obj *flowVlan -} - -type unMarshalFlowVlan interface { - // FromProto unmarshals FlowVlan from protobuf object *otg.FlowVlan - FromProto(msg *otg.FlowVlan) (FlowVlan, error) - // FromPbText unmarshals FlowVlan from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowVlan from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowVlan from JSON text - FromJson(value string) error -} - -func (obj *flowVlan) Marshal() marshalFlowVlan { - if obj.marshaller == nil { - obj.marshaller = &marshalflowVlan{obj: obj} - } - return obj.marshaller -} - -func (obj *flowVlan) Unmarshal() unMarshalFlowVlan { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowVlan{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowVlan) ToProto() (*otg.FlowVlan, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowVlan) FromProto(msg *otg.FlowVlan) (FlowVlan, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowVlan) 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 *unMarshalflowVlan) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowVlan) 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 *unMarshalflowVlan) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowVlan) 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 *unMarshalflowVlan) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowVlan) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowVlan) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowVlan) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowVlan) Clone() (FlowVlan, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowVlan() - 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 -} - -func (obj *flowVlan) setNil() { - obj.priorityHolder = nil - obj.cfiHolder = nil - obj.idHolder = nil - obj.tpidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowVlan is vLAN packet header -type FlowVlan interface { - Validation - // msg marshals FlowVlan to protobuf object *otg.FlowVlan - // and doesn't set defaults - msg() *otg.FlowVlan - // setMsg unmarshals FlowVlan from protobuf object *otg.FlowVlan - // and doesn't set defaults - setMsg(*otg.FlowVlan) FlowVlan - // provides marshal interface - Marshal() marshalFlowVlan - // provides unmarshal interface - Unmarshal() unMarshalFlowVlan - // validate validates FlowVlan - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowVlan, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Priority returns PatternFlowVlanPriority, set in FlowVlan. - // PatternFlowVlanPriority is priority code point - Priority() PatternFlowVlanPriority - // SetPriority assigns PatternFlowVlanPriority provided by user to FlowVlan. - // PatternFlowVlanPriority is priority code point - SetPriority(value PatternFlowVlanPriority) FlowVlan - // HasPriority checks if Priority has been set in FlowVlan - HasPriority() bool - // Cfi returns PatternFlowVlanCfi, set in FlowVlan. - // PatternFlowVlanCfi is canonical format indicator or drop elegible indicator - Cfi() PatternFlowVlanCfi - // SetCfi assigns PatternFlowVlanCfi provided by user to FlowVlan. - // PatternFlowVlanCfi is canonical format indicator or drop elegible indicator - SetCfi(value PatternFlowVlanCfi) FlowVlan - // HasCfi checks if Cfi has been set in FlowVlan - HasCfi() bool - // Id returns PatternFlowVlanId, set in FlowVlan. - // PatternFlowVlanId is vlan identifier - Id() PatternFlowVlanId - // SetId assigns PatternFlowVlanId provided by user to FlowVlan. - // PatternFlowVlanId is vlan identifier - SetId(value PatternFlowVlanId) FlowVlan - // HasId checks if Id has been set in FlowVlan - HasId() bool - // Tpid returns PatternFlowVlanTpid, set in FlowVlan. - // PatternFlowVlanTpid is protocol identifier - Tpid() PatternFlowVlanTpid - // SetTpid assigns PatternFlowVlanTpid provided by user to FlowVlan. - // PatternFlowVlanTpid is protocol identifier - SetTpid(value PatternFlowVlanTpid) FlowVlan - // HasTpid checks if Tpid has been set in FlowVlan - HasTpid() bool - setNil() -} - -// description is TBD -// Priority returns a PatternFlowVlanPriority -func (obj *flowVlan) Priority() PatternFlowVlanPriority { - if obj.obj.Priority == nil { - obj.obj.Priority = NewPatternFlowVlanPriority().msg() - } - if obj.priorityHolder == nil { - obj.priorityHolder = &patternFlowVlanPriority{obj: obj.obj.Priority} - } - return obj.priorityHolder -} - -// description is TBD -// Priority returns a PatternFlowVlanPriority -func (obj *flowVlan) HasPriority() bool { - return obj.obj.Priority != nil -} - -// description is TBD -// SetPriority sets the PatternFlowVlanPriority value in the FlowVlan object -func (obj *flowVlan) SetPriority(value PatternFlowVlanPriority) FlowVlan { - - obj.priorityHolder = nil - obj.obj.Priority = value.msg() - - return obj -} - -// description is TBD -// Cfi returns a PatternFlowVlanCfi -func (obj *flowVlan) Cfi() PatternFlowVlanCfi { - if obj.obj.Cfi == nil { - obj.obj.Cfi = NewPatternFlowVlanCfi().msg() - } - if obj.cfiHolder == nil { - obj.cfiHolder = &patternFlowVlanCfi{obj: obj.obj.Cfi} - } - return obj.cfiHolder -} - -// description is TBD -// Cfi returns a PatternFlowVlanCfi -func (obj *flowVlan) HasCfi() bool { - return obj.obj.Cfi != nil -} - -// description is TBD -// SetCfi sets the PatternFlowVlanCfi value in the FlowVlan object -func (obj *flowVlan) SetCfi(value PatternFlowVlanCfi) FlowVlan { - - obj.cfiHolder = nil - obj.obj.Cfi = value.msg() - - return obj -} - -// description is TBD -// Id returns a PatternFlowVlanId -func (obj *flowVlan) Id() PatternFlowVlanId { - if obj.obj.Id == nil { - obj.obj.Id = NewPatternFlowVlanId().msg() - } - if obj.idHolder == nil { - obj.idHolder = &patternFlowVlanId{obj: obj.obj.Id} - } - return obj.idHolder -} - -// description is TBD -// Id returns a PatternFlowVlanId -func (obj *flowVlan) HasId() bool { - return obj.obj.Id != nil -} - -// description is TBD -// SetId sets the PatternFlowVlanId value in the FlowVlan object -func (obj *flowVlan) SetId(value PatternFlowVlanId) FlowVlan { - - obj.idHolder = nil - obj.obj.Id = value.msg() - - return obj -} - -// description is TBD -// Tpid returns a PatternFlowVlanTpid -func (obj *flowVlan) Tpid() PatternFlowVlanTpid { - if obj.obj.Tpid == nil { - obj.obj.Tpid = NewPatternFlowVlanTpid().msg() - } - if obj.tpidHolder == nil { - obj.tpidHolder = &patternFlowVlanTpid{obj: obj.obj.Tpid} - } - return obj.tpidHolder -} - -// description is TBD -// Tpid returns a PatternFlowVlanTpid -func (obj *flowVlan) HasTpid() bool { - return obj.obj.Tpid != nil -} - -// description is TBD -// SetTpid sets the PatternFlowVlanTpid value in the FlowVlan object -func (obj *flowVlan) SetTpid(value PatternFlowVlanTpid) FlowVlan { - - obj.tpidHolder = nil - obj.obj.Tpid = value.msg() - - return obj -} - -func (obj *flowVlan) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Priority != nil { - - obj.Priority().validateObj(vObj, set_default) - } - - if obj.obj.Cfi != nil { - - obj.Cfi().validateObj(vObj, set_default) - } - - if obj.obj.Id != nil { - - obj.Id().validateObj(vObj, set_default) - } - - if obj.obj.Tpid != nil { - - obj.Tpid().validateObj(vObj, set_default) - } - -} - -func (obj *flowVlan) setDefault() { - -} - -// ***** FlowVxlan ***** -type flowVxlan struct { - validation - obj *otg.FlowVxlan - marshaller marshalFlowVxlan - unMarshaller unMarshalFlowVxlan - flagsHolder PatternFlowVxlanFlags - reserved0Holder PatternFlowVxlanReserved0 - vniHolder PatternFlowVxlanVni - reserved1Holder PatternFlowVxlanReserved1 -} - -func NewFlowVxlan() FlowVxlan { - obj := flowVxlan{obj: &otg.FlowVxlan{}} - obj.setDefault() - return &obj -} - -func (obj *flowVxlan) msg() *otg.FlowVxlan { - return obj.obj -} - -func (obj *flowVxlan) setMsg(msg *otg.FlowVxlan) FlowVxlan { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowVxlan struct { - obj *flowVxlan -} - -type marshalFlowVxlan interface { - // ToProto marshals FlowVxlan to protobuf object *otg.FlowVxlan - ToProto() (*otg.FlowVxlan, error) - // ToPbText marshals FlowVxlan to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowVxlan to YAML text - ToYaml() (string, error) - // ToJson marshals FlowVxlan to JSON text - ToJson() (string, error) -} - -type unMarshalflowVxlan struct { - obj *flowVxlan -} - -type unMarshalFlowVxlan interface { - // FromProto unmarshals FlowVxlan from protobuf object *otg.FlowVxlan - FromProto(msg *otg.FlowVxlan) (FlowVxlan, error) - // FromPbText unmarshals FlowVxlan from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowVxlan from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowVxlan from JSON text - FromJson(value string) error -} - -func (obj *flowVxlan) Marshal() marshalFlowVxlan { - if obj.marshaller == nil { - obj.marshaller = &marshalflowVxlan{obj: obj} - } - return obj.marshaller -} - -func (obj *flowVxlan) Unmarshal() unMarshalFlowVxlan { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowVxlan{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowVxlan) ToProto() (*otg.FlowVxlan, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowVxlan) FromProto(msg *otg.FlowVxlan) (FlowVxlan, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowVxlan) 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 *unMarshalflowVxlan) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowVxlan) 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 *unMarshalflowVxlan) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowVxlan) 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 *unMarshalflowVxlan) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowVxlan) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowVxlan) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowVxlan) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowVxlan) Clone() (FlowVxlan, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowVxlan() - 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 -} - -func (obj *flowVxlan) setNil() { - obj.flagsHolder = nil - obj.reserved0Holder = nil - obj.vniHolder = nil - obj.reserved1Holder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowVxlan is vXLAN packet header -type FlowVxlan interface { - Validation - // msg marshals FlowVxlan to protobuf object *otg.FlowVxlan - // and doesn't set defaults - msg() *otg.FlowVxlan - // setMsg unmarshals FlowVxlan from protobuf object *otg.FlowVxlan - // and doesn't set defaults - setMsg(*otg.FlowVxlan) FlowVxlan - // provides marshal interface - Marshal() marshalFlowVxlan - // provides unmarshal interface - Unmarshal() unMarshalFlowVxlan - // validate validates FlowVxlan - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowVxlan, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns PatternFlowVxlanFlags, set in FlowVxlan. - // PatternFlowVxlanFlags is flags field with a bit format of RRRRIRRR. The I flag MUST be set to 1 for a valid vxlan network id (VNI). The other 7 bits (designated "R") are reserved fields and MUST be set to zero on transmission and ignored on receipt. - Flags() PatternFlowVxlanFlags - // SetFlags assigns PatternFlowVxlanFlags provided by user to FlowVxlan. - // PatternFlowVxlanFlags is flags field with a bit format of RRRRIRRR. The I flag MUST be set to 1 for a valid vxlan network id (VNI). The other 7 bits (designated "R") are reserved fields and MUST be set to zero on transmission and ignored on receipt. - SetFlags(value PatternFlowVxlanFlags) FlowVxlan - // HasFlags checks if Flags has been set in FlowVxlan - HasFlags() bool - // Reserved0 returns PatternFlowVxlanReserved0, set in FlowVxlan. - // PatternFlowVxlanReserved0 is reserved field - Reserved0() PatternFlowVxlanReserved0 - // SetReserved0 assigns PatternFlowVxlanReserved0 provided by user to FlowVxlan. - // PatternFlowVxlanReserved0 is reserved field - SetReserved0(value PatternFlowVxlanReserved0) FlowVxlan - // HasReserved0 checks if Reserved0 has been set in FlowVxlan - HasReserved0() bool - // Vni returns PatternFlowVxlanVni, set in FlowVxlan. - // PatternFlowVxlanVni is vXLAN network id - Vni() PatternFlowVxlanVni - // SetVni assigns PatternFlowVxlanVni provided by user to FlowVxlan. - // PatternFlowVxlanVni is vXLAN network id - SetVni(value PatternFlowVxlanVni) FlowVxlan - // HasVni checks if Vni has been set in FlowVxlan - HasVni() bool - // Reserved1 returns PatternFlowVxlanReserved1, set in FlowVxlan. - // PatternFlowVxlanReserved1 is reserved field - Reserved1() PatternFlowVxlanReserved1 - // SetReserved1 assigns PatternFlowVxlanReserved1 provided by user to FlowVxlan. - // PatternFlowVxlanReserved1 is reserved field - SetReserved1(value PatternFlowVxlanReserved1) FlowVxlan - // HasReserved1 checks if Reserved1 has been set in FlowVxlan - HasReserved1() bool - setNil() -} - -// description is TBD -// Flags returns a PatternFlowVxlanFlags -func (obj *flowVxlan) Flags() PatternFlowVxlanFlags { - if obj.obj.Flags == nil { - obj.obj.Flags = NewPatternFlowVxlanFlags().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &patternFlowVxlanFlags{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// description is TBD -// Flags returns a PatternFlowVxlanFlags -func (obj *flowVxlan) HasFlags() bool { - return obj.obj.Flags != nil -} - -// description is TBD -// SetFlags sets the PatternFlowVxlanFlags value in the FlowVxlan object -func (obj *flowVxlan) SetFlags(value PatternFlowVxlanFlags) FlowVxlan { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// description is TBD -// Reserved0 returns a PatternFlowVxlanReserved0 -func (obj *flowVxlan) Reserved0() PatternFlowVxlanReserved0 { - if obj.obj.Reserved0 == nil { - obj.obj.Reserved0 = NewPatternFlowVxlanReserved0().msg() - } - if obj.reserved0Holder == nil { - obj.reserved0Holder = &patternFlowVxlanReserved0{obj: obj.obj.Reserved0} - } - return obj.reserved0Holder -} - -// description is TBD -// Reserved0 returns a PatternFlowVxlanReserved0 -func (obj *flowVxlan) HasReserved0() bool { - return obj.obj.Reserved0 != nil -} - -// description is TBD -// SetReserved0 sets the PatternFlowVxlanReserved0 value in the FlowVxlan object -func (obj *flowVxlan) SetReserved0(value PatternFlowVxlanReserved0) FlowVxlan { - - obj.reserved0Holder = nil - obj.obj.Reserved0 = value.msg() - - return obj -} - -// description is TBD -// Vni returns a PatternFlowVxlanVni -func (obj *flowVxlan) Vni() PatternFlowVxlanVni { - if obj.obj.Vni == nil { - obj.obj.Vni = NewPatternFlowVxlanVni().msg() - } - if obj.vniHolder == nil { - obj.vniHolder = &patternFlowVxlanVni{obj: obj.obj.Vni} - } - return obj.vniHolder -} - -// description is TBD -// Vni returns a PatternFlowVxlanVni -func (obj *flowVxlan) HasVni() bool { - return obj.obj.Vni != nil -} - -// description is TBD -// SetVni sets the PatternFlowVxlanVni value in the FlowVxlan object -func (obj *flowVxlan) SetVni(value PatternFlowVxlanVni) FlowVxlan { - - obj.vniHolder = nil - obj.obj.Vni = value.msg() - - return obj -} - -// description is TBD -// Reserved1 returns a PatternFlowVxlanReserved1 -func (obj *flowVxlan) Reserved1() PatternFlowVxlanReserved1 { - if obj.obj.Reserved1 == nil { - obj.obj.Reserved1 = NewPatternFlowVxlanReserved1().msg() - } - if obj.reserved1Holder == nil { - obj.reserved1Holder = &patternFlowVxlanReserved1{obj: obj.obj.Reserved1} - } - return obj.reserved1Holder -} - -// description is TBD -// Reserved1 returns a PatternFlowVxlanReserved1 -func (obj *flowVxlan) HasReserved1() bool { - return obj.obj.Reserved1 != nil -} - -// description is TBD -// SetReserved1 sets the PatternFlowVxlanReserved1 value in the FlowVxlan object -func (obj *flowVxlan) SetReserved1(value PatternFlowVxlanReserved1) FlowVxlan { - - obj.reserved1Holder = nil - obj.obj.Reserved1 = value.msg() - - return obj -} - -func (obj *flowVxlan) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.Reserved0 != nil { - - obj.Reserved0().validateObj(vObj, set_default) - } - - if obj.obj.Vni != nil { - - obj.Vni().validateObj(vObj, set_default) - } - - if obj.obj.Reserved1 != nil { - - obj.Reserved1().validateObj(vObj, set_default) - } - -} - -func (obj *flowVxlan) setDefault() { - -} - -// ***** FlowIpv4 ***** -type flowIpv4 struct { - validation - obj *otg.FlowIpv4 - marshaller marshalFlowIpv4 - unMarshaller unMarshalFlowIpv4 - versionHolder PatternFlowIpv4Version - headerLengthHolder PatternFlowIpv4HeaderLength - priorityHolder FlowIpv4Priority - totalLengthHolder PatternFlowIpv4TotalLength - identificationHolder PatternFlowIpv4Identification - reservedHolder PatternFlowIpv4Reserved - dontFragmentHolder PatternFlowIpv4DontFragment - moreFragmentsHolder PatternFlowIpv4MoreFragments - fragmentOffsetHolder PatternFlowIpv4FragmentOffset - timeToLiveHolder PatternFlowIpv4TimeToLive - protocolHolder PatternFlowIpv4Protocol - headerChecksumHolder PatternFlowIpv4HeaderChecksum - srcHolder PatternFlowIpv4Src - dstHolder PatternFlowIpv4Dst - optionsHolder FlowIpv4FlowIpv4OptionsIter -} - -func NewFlowIpv4() FlowIpv4 { - obj := flowIpv4{obj: &otg.FlowIpv4{}} - obj.setDefault() - return &obj -} - -func (obj *flowIpv4) msg() *otg.FlowIpv4 { - return obj.obj -} - -func (obj *flowIpv4) setMsg(msg *otg.FlowIpv4) FlowIpv4 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIpv4 struct { - obj *flowIpv4 -} - -type marshalFlowIpv4 interface { - // ToProto marshals FlowIpv4 to protobuf object *otg.FlowIpv4 - ToProto() (*otg.FlowIpv4, error) - // ToPbText marshals FlowIpv4 to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIpv4 to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIpv4 to JSON text - ToJson() (string, error) -} - -type unMarshalflowIpv4 struct { - obj *flowIpv4 -} - -type unMarshalFlowIpv4 interface { - // FromProto unmarshals FlowIpv4 from protobuf object *otg.FlowIpv4 - FromProto(msg *otg.FlowIpv4) (FlowIpv4, error) - // FromPbText unmarshals FlowIpv4 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIpv4 from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIpv4 from JSON text - FromJson(value string) error -} - -func (obj *flowIpv4) Marshal() marshalFlowIpv4 { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIpv4{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIpv4) Unmarshal() unMarshalFlowIpv4 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIpv4{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIpv4) ToProto() (*otg.FlowIpv4, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIpv4) FromProto(msg *otg.FlowIpv4) (FlowIpv4, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIpv4) 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 *unMarshalflowIpv4) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowIpv4) 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 *unMarshalflowIpv4) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowIpv4) 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 *unMarshalflowIpv4) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowIpv4) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIpv4) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIpv4) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIpv4) Clone() (FlowIpv4, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIpv4() - 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 -} - -func (obj *flowIpv4) setNil() { - obj.versionHolder = nil - obj.headerLengthHolder = nil - obj.priorityHolder = nil - obj.totalLengthHolder = nil - obj.identificationHolder = nil - obj.reservedHolder = nil - obj.dontFragmentHolder = nil - obj.moreFragmentsHolder = nil - obj.fragmentOffsetHolder = nil - obj.timeToLiveHolder = nil - obj.protocolHolder = nil - obj.headerChecksumHolder = nil - obj.srcHolder = nil - obj.dstHolder = nil - obj.optionsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowIpv4 is iPv4 packet header -type FlowIpv4 interface { - Validation - // msg marshals FlowIpv4 to protobuf object *otg.FlowIpv4 - // and doesn't set defaults - msg() *otg.FlowIpv4 - // setMsg unmarshals FlowIpv4 from protobuf object *otg.FlowIpv4 - // and doesn't set defaults - setMsg(*otg.FlowIpv4) FlowIpv4 - // provides marshal interface - Marshal() marshalFlowIpv4 - // provides unmarshal interface - Unmarshal() unMarshalFlowIpv4 - // validate validates FlowIpv4 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIpv4, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Version returns PatternFlowIpv4Version, set in FlowIpv4. - // PatternFlowIpv4Version is version - Version() PatternFlowIpv4Version - // SetVersion assigns PatternFlowIpv4Version provided by user to FlowIpv4. - // PatternFlowIpv4Version is version - SetVersion(value PatternFlowIpv4Version) FlowIpv4 - // HasVersion checks if Version has been set in FlowIpv4 - HasVersion() bool - // HeaderLength returns PatternFlowIpv4HeaderLength, set in FlowIpv4. - // PatternFlowIpv4HeaderLength is header length - HeaderLength() PatternFlowIpv4HeaderLength - // SetHeaderLength assigns PatternFlowIpv4HeaderLength provided by user to FlowIpv4. - // PatternFlowIpv4HeaderLength is header length - SetHeaderLength(value PatternFlowIpv4HeaderLength) FlowIpv4 - // HasHeaderLength checks if HeaderLength has been set in FlowIpv4 - HasHeaderLength() bool - // Priority returns FlowIpv4Priority, set in FlowIpv4. - // FlowIpv4Priority is a container for ipv4 raw, tos, dscp ip priorities. - Priority() FlowIpv4Priority - // SetPriority assigns FlowIpv4Priority provided by user to FlowIpv4. - // FlowIpv4Priority is a container for ipv4 raw, tos, dscp ip priorities. - SetPriority(value FlowIpv4Priority) FlowIpv4 - // HasPriority checks if Priority has been set in FlowIpv4 - HasPriority() bool - // TotalLength returns PatternFlowIpv4TotalLength, set in FlowIpv4. - // PatternFlowIpv4TotalLength is total length - TotalLength() PatternFlowIpv4TotalLength - // SetTotalLength assigns PatternFlowIpv4TotalLength provided by user to FlowIpv4. - // PatternFlowIpv4TotalLength is total length - SetTotalLength(value PatternFlowIpv4TotalLength) FlowIpv4 - // HasTotalLength checks if TotalLength has been set in FlowIpv4 - HasTotalLength() bool - // Identification returns PatternFlowIpv4Identification, set in FlowIpv4. - // PatternFlowIpv4Identification is identification - Identification() PatternFlowIpv4Identification - // SetIdentification assigns PatternFlowIpv4Identification provided by user to FlowIpv4. - // PatternFlowIpv4Identification is identification - SetIdentification(value PatternFlowIpv4Identification) FlowIpv4 - // HasIdentification checks if Identification has been set in FlowIpv4 - HasIdentification() bool - // Reserved returns PatternFlowIpv4Reserved, set in FlowIpv4. - // PatternFlowIpv4Reserved is reserved flag. - Reserved() PatternFlowIpv4Reserved - // SetReserved assigns PatternFlowIpv4Reserved provided by user to FlowIpv4. - // PatternFlowIpv4Reserved is reserved flag. - SetReserved(value PatternFlowIpv4Reserved) FlowIpv4 - // HasReserved checks if Reserved has been set in FlowIpv4 - HasReserved() bool - // DontFragment returns PatternFlowIpv4DontFragment, set in FlowIpv4. - // PatternFlowIpv4DontFragment is dont fragment flag If the dont_fragment flag is set and fragmentation is required to route the packet then the packet is dropped. - DontFragment() PatternFlowIpv4DontFragment - // SetDontFragment assigns PatternFlowIpv4DontFragment provided by user to FlowIpv4. - // PatternFlowIpv4DontFragment is dont fragment flag If the dont_fragment flag is set and fragmentation is required to route the packet then the packet is dropped. - SetDontFragment(value PatternFlowIpv4DontFragment) FlowIpv4 - // HasDontFragment checks if DontFragment has been set in FlowIpv4 - HasDontFragment() bool - // MoreFragments returns PatternFlowIpv4MoreFragments, set in FlowIpv4. - // PatternFlowIpv4MoreFragments is more fragments flag - MoreFragments() PatternFlowIpv4MoreFragments - // SetMoreFragments assigns PatternFlowIpv4MoreFragments provided by user to FlowIpv4. - // PatternFlowIpv4MoreFragments is more fragments flag - SetMoreFragments(value PatternFlowIpv4MoreFragments) FlowIpv4 - // HasMoreFragments checks if MoreFragments has been set in FlowIpv4 - HasMoreFragments() bool - // FragmentOffset returns PatternFlowIpv4FragmentOffset, set in FlowIpv4. - // PatternFlowIpv4FragmentOffset is fragment offset - FragmentOffset() PatternFlowIpv4FragmentOffset - // SetFragmentOffset assigns PatternFlowIpv4FragmentOffset provided by user to FlowIpv4. - // PatternFlowIpv4FragmentOffset is fragment offset - SetFragmentOffset(value PatternFlowIpv4FragmentOffset) FlowIpv4 - // HasFragmentOffset checks if FragmentOffset has been set in FlowIpv4 - HasFragmentOffset() bool - // TimeToLive returns PatternFlowIpv4TimeToLive, set in FlowIpv4. - // PatternFlowIpv4TimeToLive is time to live - TimeToLive() PatternFlowIpv4TimeToLive - // SetTimeToLive assigns PatternFlowIpv4TimeToLive provided by user to FlowIpv4. - // PatternFlowIpv4TimeToLive is time to live - SetTimeToLive(value PatternFlowIpv4TimeToLive) FlowIpv4 - // HasTimeToLive checks if TimeToLive has been set in FlowIpv4 - HasTimeToLive() bool - // Protocol returns PatternFlowIpv4Protocol, set in FlowIpv4. - // PatternFlowIpv4Protocol is protocol, default is 61 any host internal protocol - Protocol() PatternFlowIpv4Protocol - // SetProtocol assigns PatternFlowIpv4Protocol provided by user to FlowIpv4. - // PatternFlowIpv4Protocol is protocol, default is 61 any host internal protocol - SetProtocol(value PatternFlowIpv4Protocol) FlowIpv4 - // HasProtocol checks if Protocol has been set in FlowIpv4 - HasProtocol() bool - // HeaderChecksum returns PatternFlowIpv4HeaderChecksum, set in FlowIpv4. - // PatternFlowIpv4HeaderChecksum is header checksum - HeaderChecksum() PatternFlowIpv4HeaderChecksum - // SetHeaderChecksum assigns PatternFlowIpv4HeaderChecksum provided by user to FlowIpv4. - // PatternFlowIpv4HeaderChecksum is header checksum - SetHeaderChecksum(value PatternFlowIpv4HeaderChecksum) FlowIpv4 - // HasHeaderChecksum checks if HeaderChecksum has been set in FlowIpv4 - HasHeaderChecksum() bool - // Src returns PatternFlowIpv4Src, set in FlowIpv4. - // PatternFlowIpv4Src is source address - Src() PatternFlowIpv4Src - // SetSrc assigns PatternFlowIpv4Src provided by user to FlowIpv4. - // PatternFlowIpv4Src is source address - SetSrc(value PatternFlowIpv4Src) FlowIpv4 - // HasSrc checks if Src has been set in FlowIpv4 - HasSrc() bool - // Dst returns PatternFlowIpv4Dst, set in FlowIpv4. - // PatternFlowIpv4Dst is destination address - Dst() PatternFlowIpv4Dst - // SetDst assigns PatternFlowIpv4Dst provided by user to FlowIpv4. - // PatternFlowIpv4Dst is destination address - SetDst(value PatternFlowIpv4Dst) FlowIpv4 - // HasDst checks if Dst has been set in FlowIpv4 - HasDst() bool - // Options returns FlowIpv4FlowIpv4OptionsIterIter, set in FlowIpv4 - Options() FlowIpv4FlowIpv4OptionsIter - setNil() -} - -// description is TBD -// Version returns a PatternFlowIpv4Version -func (obj *flowIpv4) Version() PatternFlowIpv4Version { - if obj.obj.Version == nil { - obj.obj.Version = NewPatternFlowIpv4Version().msg() - } - if obj.versionHolder == nil { - obj.versionHolder = &patternFlowIpv4Version{obj: obj.obj.Version} - } - return obj.versionHolder -} - -// description is TBD -// Version returns a PatternFlowIpv4Version -func (obj *flowIpv4) HasVersion() bool { - return obj.obj.Version != nil -} - -// description is TBD -// SetVersion sets the PatternFlowIpv4Version value in the FlowIpv4 object -func (obj *flowIpv4) SetVersion(value PatternFlowIpv4Version) FlowIpv4 { - - obj.versionHolder = nil - obj.obj.Version = value.msg() - - return obj -} - -// description is TBD -// HeaderLength returns a PatternFlowIpv4HeaderLength -func (obj *flowIpv4) HeaderLength() PatternFlowIpv4HeaderLength { - if obj.obj.HeaderLength == nil { - obj.obj.HeaderLength = NewPatternFlowIpv4HeaderLength().msg() - } - if obj.headerLengthHolder == nil { - obj.headerLengthHolder = &patternFlowIpv4HeaderLength{obj: obj.obj.HeaderLength} - } - return obj.headerLengthHolder -} - -// description is TBD -// HeaderLength returns a PatternFlowIpv4HeaderLength -func (obj *flowIpv4) HasHeaderLength() bool { - return obj.obj.HeaderLength != nil -} - -// description is TBD -// SetHeaderLength sets the PatternFlowIpv4HeaderLength value in the FlowIpv4 object -func (obj *flowIpv4) SetHeaderLength(value PatternFlowIpv4HeaderLength) FlowIpv4 { - - obj.headerLengthHolder = nil - obj.obj.HeaderLength = value.msg() - - return obj -} - -// description is TBD -// Priority returns a FlowIpv4Priority -func (obj *flowIpv4) Priority() FlowIpv4Priority { - if obj.obj.Priority == nil { - obj.obj.Priority = NewFlowIpv4Priority().msg() - } - if obj.priorityHolder == nil { - obj.priorityHolder = &flowIpv4Priority{obj: obj.obj.Priority} - } - return obj.priorityHolder -} - -// description is TBD -// Priority returns a FlowIpv4Priority -func (obj *flowIpv4) HasPriority() bool { - return obj.obj.Priority != nil -} - -// description is TBD -// SetPriority sets the FlowIpv4Priority value in the FlowIpv4 object -func (obj *flowIpv4) SetPriority(value FlowIpv4Priority) FlowIpv4 { - - obj.priorityHolder = nil - obj.obj.Priority = value.msg() - - return obj -} - -// description is TBD -// TotalLength returns a PatternFlowIpv4TotalLength -func (obj *flowIpv4) TotalLength() PatternFlowIpv4TotalLength { - if obj.obj.TotalLength == nil { - obj.obj.TotalLength = NewPatternFlowIpv4TotalLength().msg() - } - if obj.totalLengthHolder == nil { - obj.totalLengthHolder = &patternFlowIpv4TotalLength{obj: obj.obj.TotalLength} - } - return obj.totalLengthHolder -} - -// description is TBD -// TotalLength returns a PatternFlowIpv4TotalLength -func (obj *flowIpv4) HasTotalLength() bool { - return obj.obj.TotalLength != nil -} - -// description is TBD -// SetTotalLength sets the PatternFlowIpv4TotalLength value in the FlowIpv4 object -func (obj *flowIpv4) SetTotalLength(value PatternFlowIpv4TotalLength) FlowIpv4 { - - obj.totalLengthHolder = nil - obj.obj.TotalLength = value.msg() - - return obj -} - -// description is TBD -// Identification returns a PatternFlowIpv4Identification -func (obj *flowIpv4) Identification() PatternFlowIpv4Identification { - if obj.obj.Identification == nil { - obj.obj.Identification = NewPatternFlowIpv4Identification().msg() - } - if obj.identificationHolder == nil { - obj.identificationHolder = &patternFlowIpv4Identification{obj: obj.obj.Identification} - } - return obj.identificationHolder -} - -// description is TBD -// Identification returns a PatternFlowIpv4Identification -func (obj *flowIpv4) HasIdentification() bool { - return obj.obj.Identification != nil -} - -// description is TBD -// SetIdentification sets the PatternFlowIpv4Identification value in the FlowIpv4 object -func (obj *flowIpv4) SetIdentification(value PatternFlowIpv4Identification) FlowIpv4 { - - obj.identificationHolder = nil - obj.obj.Identification = value.msg() - - return obj -} - -// description is TBD -// Reserved returns a PatternFlowIpv4Reserved -func (obj *flowIpv4) Reserved() PatternFlowIpv4Reserved { - if obj.obj.Reserved == nil { - obj.obj.Reserved = NewPatternFlowIpv4Reserved().msg() - } - if obj.reservedHolder == nil { - obj.reservedHolder = &patternFlowIpv4Reserved{obj: obj.obj.Reserved} - } - return obj.reservedHolder -} - -// description is TBD -// Reserved returns a PatternFlowIpv4Reserved -func (obj *flowIpv4) HasReserved() bool { - return obj.obj.Reserved != nil -} - -// description is TBD -// SetReserved sets the PatternFlowIpv4Reserved value in the FlowIpv4 object -func (obj *flowIpv4) SetReserved(value PatternFlowIpv4Reserved) FlowIpv4 { - - obj.reservedHolder = nil - obj.obj.Reserved = value.msg() - - return obj -} - -// description is TBD -// DontFragment returns a PatternFlowIpv4DontFragment -func (obj *flowIpv4) DontFragment() PatternFlowIpv4DontFragment { - if obj.obj.DontFragment == nil { - obj.obj.DontFragment = NewPatternFlowIpv4DontFragment().msg() - } - if obj.dontFragmentHolder == nil { - obj.dontFragmentHolder = &patternFlowIpv4DontFragment{obj: obj.obj.DontFragment} - } - return obj.dontFragmentHolder -} - -// description is TBD -// DontFragment returns a PatternFlowIpv4DontFragment -func (obj *flowIpv4) HasDontFragment() bool { - return obj.obj.DontFragment != nil -} - -// description is TBD -// SetDontFragment sets the PatternFlowIpv4DontFragment value in the FlowIpv4 object -func (obj *flowIpv4) SetDontFragment(value PatternFlowIpv4DontFragment) FlowIpv4 { - - obj.dontFragmentHolder = nil - obj.obj.DontFragment = value.msg() - - return obj -} - -// description is TBD -// MoreFragments returns a PatternFlowIpv4MoreFragments -func (obj *flowIpv4) MoreFragments() PatternFlowIpv4MoreFragments { - if obj.obj.MoreFragments == nil { - obj.obj.MoreFragments = NewPatternFlowIpv4MoreFragments().msg() - } - if obj.moreFragmentsHolder == nil { - obj.moreFragmentsHolder = &patternFlowIpv4MoreFragments{obj: obj.obj.MoreFragments} - } - return obj.moreFragmentsHolder -} - -// description is TBD -// MoreFragments returns a PatternFlowIpv4MoreFragments -func (obj *flowIpv4) HasMoreFragments() bool { - return obj.obj.MoreFragments != nil -} - -// description is TBD -// SetMoreFragments sets the PatternFlowIpv4MoreFragments value in the FlowIpv4 object -func (obj *flowIpv4) SetMoreFragments(value PatternFlowIpv4MoreFragments) FlowIpv4 { - - obj.moreFragmentsHolder = nil - obj.obj.MoreFragments = value.msg() - - return obj -} - -// description is TBD -// FragmentOffset returns a PatternFlowIpv4FragmentOffset -func (obj *flowIpv4) FragmentOffset() PatternFlowIpv4FragmentOffset { - if obj.obj.FragmentOffset == nil { - obj.obj.FragmentOffset = NewPatternFlowIpv4FragmentOffset().msg() - } - if obj.fragmentOffsetHolder == nil { - obj.fragmentOffsetHolder = &patternFlowIpv4FragmentOffset{obj: obj.obj.FragmentOffset} - } - return obj.fragmentOffsetHolder -} - -// description is TBD -// FragmentOffset returns a PatternFlowIpv4FragmentOffset -func (obj *flowIpv4) HasFragmentOffset() bool { - return obj.obj.FragmentOffset != nil -} - -// description is TBD -// SetFragmentOffset sets the PatternFlowIpv4FragmentOffset value in the FlowIpv4 object -func (obj *flowIpv4) SetFragmentOffset(value PatternFlowIpv4FragmentOffset) FlowIpv4 { - - obj.fragmentOffsetHolder = nil - obj.obj.FragmentOffset = value.msg() - - return obj -} - -// description is TBD -// TimeToLive returns a PatternFlowIpv4TimeToLive -func (obj *flowIpv4) TimeToLive() PatternFlowIpv4TimeToLive { - if obj.obj.TimeToLive == nil { - obj.obj.TimeToLive = NewPatternFlowIpv4TimeToLive().msg() - } - if obj.timeToLiveHolder == nil { - obj.timeToLiveHolder = &patternFlowIpv4TimeToLive{obj: obj.obj.TimeToLive} - } - return obj.timeToLiveHolder -} - -// description is TBD -// TimeToLive returns a PatternFlowIpv4TimeToLive -func (obj *flowIpv4) HasTimeToLive() bool { - return obj.obj.TimeToLive != nil -} - -// description is TBD -// SetTimeToLive sets the PatternFlowIpv4TimeToLive value in the FlowIpv4 object -func (obj *flowIpv4) SetTimeToLive(value PatternFlowIpv4TimeToLive) FlowIpv4 { - - obj.timeToLiveHolder = nil - obj.obj.TimeToLive = value.msg() - - return obj -} - -// description is TBD -// Protocol returns a PatternFlowIpv4Protocol -func (obj *flowIpv4) Protocol() PatternFlowIpv4Protocol { - if obj.obj.Protocol == nil { - obj.obj.Protocol = NewPatternFlowIpv4Protocol().msg() - } - if obj.protocolHolder == nil { - obj.protocolHolder = &patternFlowIpv4Protocol{obj: obj.obj.Protocol} - } - return obj.protocolHolder -} - -// description is TBD -// Protocol returns a PatternFlowIpv4Protocol -func (obj *flowIpv4) HasProtocol() bool { - return obj.obj.Protocol != nil -} - -// description is TBD -// SetProtocol sets the PatternFlowIpv4Protocol value in the FlowIpv4 object -func (obj *flowIpv4) SetProtocol(value PatternFlowIpv4Protocol) FlowIpv4 { - - obj.protocolHolder = nil - obj.obj.Protocol = value.msg() - - return obj -} - -// description is TBD -// HeaderChecksum returns a PatternFlowIpv4HeaderChecksum -func (obj *flowIpv4) HeaderChecksum() PatternFlowIpv4HeaderChecksum { - if obj.obj.HeaderChecksum == nil { - obj.obj.HeaderChecksum = NewPatternFlowIpv4HeaderChecksum().msg() - } - if obj.headerChecksumHolder == nil { - obj.headerChecksumHolder = &patternFlowIpv4HeaderChecksum{obj: obj.obj.HeaderChecksum} - } - return obj.headerChecksumHolder -} - -// description is TBD -// HeaderChecksum returns a PatternFlowIpv4HeaderChecksum -func (obj *flowIpv4) HasHeaderChecksum() bool { - return obj.obj.HeaderChecksum != nil -} - -// description is TBD -// SetHeaderChecksum sets the PatternFlowIpv4HeaderChecksum value in the FlowIpv4 object -func (obj *flowIpv4) SetHeaderChecksum(value PatternFlowIpv4HeaderChecksum) FlowIpv4 { - - obj.headerChecksumHolder = nil - obj.obj.HeaderChecksum = value.msg() - - return obj -} - -// description is TBD -// Src returns a PatternFlowIpv4Src -func (obj *flowIpv4) Src() PatternFlowIpv4Src { - if obj.obj.Src == nil { - obj.obj.Src = NewPatternFlowIpv4Src().msg() - } - if obj.srcHolder == nil { - obj.srcHolder = &patternFlowIpv4Src{obj: obj.obj.Src} - } - return obj.srcHolder -} - -// description is TBD -// Src returns a PatternFlowIpv4Src -func (obj *flowIpv4) HasSrc() bool { - return obj.obj.Src != nil -} - -// description is TBD -// SetSrc sets the PatternFlowIpv4Src value in the FlowIpv4 object -func (obj *flowIpv4) SetSrc(value PatternFlowIpv4Src) FlowIpv4 { - - obj.srcHolder = nil - obj.obj.Src = value.msg() - - return obj -} - -// description is TBD -// Dst returns a PatternFlowIpv4Dst -func (obj *flowIpv4) Dst() PatternFlowIpv4Dst { - if obj.obj.Dst == nil { - obj.obj.Dst = NewPatternFlowIpv4Dst().msg() - } - if obj.dstHolder == nil { - obj.dstHolder = &patternFlowIpv4Dst{obj: obj.obj.Dst} - } - return obj.dstHolder -} - -// description is TBD -// Dst returns a PatternFlowIpv4Dst -func (obj *flowIpv4) HasDst() bool { - return obj.obj.Dst != nil -} - -// description is TBD -// SetDst sets the PatternFlowIpv4Dst value in the FlowIpv4 object -func (obj *flowIpv4) SetDst(value PatternFlowIpv4Dst) FlowIpv4 { - - obj.dstHolder = nil - obj.obj.Dst = value.msg() - - return obj -} - -// description is TBD -// Options returns a []FlowIpv4Options -func (obj *flowIpv4) Options() FlowIpv4FlowIpv4OptionsIter { - if len(obj.obj.Options) == 0 { - obj.obj.Options = []*otg.FlowIpv4Options{} - } - if obj.optionsHolder == nil { - obj.optionsHolder = newFlowIpv4FlowIpv4OptionsIter(&obj.obj.Options).setMsg(obj) - } - return obj.optionsHolder -} - -type flowIpv4FlowIpv4OptionsIter struct { - obj *flowIpv4 - flowIpv4OptionsSlice []FlowIpv4Options - fieldPtr *[]*otg.FlowIpv4Options -} - -func newFlowIpv4FlowIpv4OptionsIter(ptr *[]*otg.FlowIpv4Options) FlowIpv4FlowIpv4OptionsIter { - return &flowIpv4FlowIpv4OptionsIter{fieldPtr: ptr} -} - -type FlowIpv4FlowIpv4OptionsIter interface { - setMsg(*flowIpv4) FlowIpv4FlowIpv4OptionsIter - Items() []FlowIpv4Options - Add() FlowIpv4Options - Append(items ...FlowIpv4Options) FlowIpv4FlowIpv4OptionsIter - Set(index int, newObj FlowIpv4Options) FlowIpv4FlowIpv4OptionsIter - Clear() FlowIpv4FlowIpv4OptionsIter - clearHolderSlice() FlowIpv4FlowIpv4OptionsIter - appendHolderSlice(item FlowIpv4Options) FlowIpv4FlowIpv4OptionsIter -} - -func (obj *flowIpv4FlowIpv4OptionsIter) setMsg(msg *flowIpv4) FlowIpv4FlowIpv4OptionsIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flowIpv4Options{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *flowIpv4FlowIpv4OptionsIter) Items() []FlowIpv4Options { - return obj.flowIpv4OptionsSlice -} - -func (obj *flowIpv4FlowIpv4OptionsIter) Add() FlowIpv4Options { - newObj := &otg.FlowIpv4Options{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flowIpv4Options{obj: newObj} - newLibObj.setDefault() - obj.flowIpv4OptionsSlice = append(obj.flowIpv4OptionsSlice, newLibObj) - return newLibObj -} - -func (obj *flowIpv4FlowIpv4OptionsIter) Append(items ...FlowIpv4Options) FlowIpv4FlowIpv4OptionsIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowIpv4OptionsSlice = append(obj.flowIpv4OptionsSlice, item) - } - return obj -} - -func (obj *flowIpv4FlowIpv4OptionsIter) Set(index int, newObj FlowIpv4Options) FlowIpv4FlowIpv4OptionsIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowIpv4OptionsSlice[index] = newObj - return obj -} -func (obj *flowIpv4FlowIpv4OptionsIter) Clear() FlowIpv4FlowIpv4OptionsIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.FlowIpv4Options{} - obj.flowIpv4OptionsSlice = []FlowIpv4Options{} - } - return obj -} -func (obj *flowIpv4FlowIpv4OptionsIter) clearHolderSlice() FlowIpv4FlowIpv4OptionsIter { - if len(obj.flowIpv4OptionsSlice) > 0 { - obj.flowIpv4OptionsSlice = []FlowIpv4Options{} - } - return obj -} -func (obj *flowIpv4FlowIpv4OptionsIter) appendHolderSlice(item FlowIpv4Options) FlowIpv4FlowIpv4OptionsIter { - obj.flowIpv4OptionsSlice = append(obj.flowIpv4OptionsSlice, item) - return obj -} - -func (obj *flowIpv4) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Version != nil { - - obj.Version().validateObj(vObj, set_default) - } - - if obj.obj.HeaderLength != nil { - - obj.HeaderLength().validateObj(vObj, set_default) - } - - if obj.obj.Priority != nil { - - obj.Priority().validateObj(vObj, set_default) - } - - if obj.obj.TotalLength != nil { - - obj.TotalLength().validateObj(vObj, set_default) - } - - if obj.obj.Identification != nil { - - obj.Identification().validateObj(vObj, set_default) - } - - if obj.obj.Reserved != nil { - - obj.Reserved().validateObj(vObj, set_default) - } - - if obj.obj.DontFragment != nil { - - obj.DontFragment().validateObj(vObj, set_default) - } - - if obj.obj.MoreFragments != nil { - - obj.MoreFragments().validateObj(vObj, set_default) - } - - if obj.obj.FragmentOffset != nil { - - obj.FragmentOffset().validateObj(vObj, set_default) - } - - if obj.obj.TimeToLive != nil { - - obj.TimeToLive().validateObj(vObj, set_default) - } - - if obj.obj.Protocol != nil { - - obj.Protocol().validateObj(vObj, set_default) - } - - if obj.obj.HeaderChecksum != nil { - - obj.HeaderChecksum().validateObj(vObj, set_default) - } - - if obj.obj.Src != nil { - - obj.Src().validateObj(vObj, set_default) - } - - if obj.obj.Dst != nil { - - obj.Dst().validateObj(vObj, set_default) - } - - if len(obj.obj.Options) != 0 { - - if set_default { - obj.Options().clearHolderSlice() - for _, item := range obj.obj.Options { - obj.Options().appendHolderSlice(&flowIpv4Options{obj: item}) - } - } - for _, item := range obj.Options().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *flowIpv4) setDefault() { - -} - -// ***** FlowIpv6 ***** -type flowIpv6 struct { - validation - obj *otg.FlowIpv6 - marshaller marshalFlowIpv6 - unMarshaller unMarshalFlowIpv6 - versionHolder PatternFlowIpv6Version - trafficClassHolder PatternFlowIpv6TrafficClass - flowLabelHolder PatternFlowIpv6FlowLabel - payloadLengthHolder PatternFlowIpv6PayloadLength - nextHeaderHolder PatternFlowIpv6NextHeader - hopLimitHolder PatternFlowIpv6HopLimit - srcHolder PatternFlowIpv6Src - dstHolder PatternFlowIpv6Dst -} - -func NewFlowIpv6() FlowIpv6 { - obj := flowIpv6{obj: &otg.FlowIpv6{}} - obj.setDefault() - return &obj -} - -func (obj *flowIpv6) msg() *otg.FlowIpv6 { - return obj.obj -} - -func (obj *flowIpv6) setMsg(msg *otg.FlowIpv6) FlowIpv6 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIpv6 struct { - obj *flowIpv6 -} - -type marshalFlowIpv6 interface { - // ToProto marshals FlowIpv6 to protobuf object *otg.FlowIpv6 - ToProto() (*otg.FlowIpv6, error) - // ToPbText marshals FlowIpv6 to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIpv6 to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIpv6 to JSON text - ToJson() (string, error) -} - -type unMarshalflowIpv6 struct { - obj *flowIpv6 -} - -type unMarshalFlowIpv6 interface { - // FromProto unmarshals FlowIpv6 from protobuf object *otg.FlowIpv6 - FromProto(msg *otg.FlowIpv6) (FlowIpv6, error) - // FromPbText unmarshals FlowIpv6 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIpv6 from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIpv6 from JSON text - FromJson(value string) error -} - -func (obj *flowIpv6) Marshal() marshalFlowIpv6 { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIpv6{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIpv6) Unmarshal() unMarshalFlowIpv6 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIpv6{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIpv6) ToProto() (*otg.FlowIpv6, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIpv6) FromProto(msg *otg.FlowIpv6) (FlowIpv6, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIpv6) 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 *unMarshalflowIpv6) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowIpv6) 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 *unMarshalflowIpv6) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowIpv6) 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 *unMarshalflowIpv6) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowIpv6) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIpv6) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIpv6) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIpv6) Clone() (FlowIpv6, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIpv6() - 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 -} - -func (obj *flowIpv6) setNil() { - obj.versionHolder = nil - obj.trafficClassHolder = nil - obj.flowLabelHolder = nil - obj.payloadLengthHolder = nil - obj.nextHeaderHolder = nil - obj.hopLimitHolder = nil - obj.srcHolder = nil - obj.dstHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowIpv6 is iPv6 packet header -type FlowIpv6 interface { - Validation - // msg marshals FlowIpv6 to protobuf object *otg.FlowIpv6 - // and doesn't set defaults - msg() *otg.FlowIpv6 - // setMsg unmarshals FlowIpv6 from protobuf object *otg.FlowIpv6 - // and doesn't set defaults - setMsg(*otg.FlowIpv6) FlowIpv6 - // provides marshal interface - Marshal() marshalFlowIpv6 - // provides unmarshal interface - Unmarshal() unMarshalFlowIpv6 - // validate validates FlowIpv6 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIpv6, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Version returns PatternFlowIpv6Version, set in FlowIpv6. - // PatternFlowIpv6Version is version number - Version() PatternFlowIpv6Version - // SetVersion assigns PatternFlowIpv6Version provided by user to FlowIpv6. - // PatternFlowIpv6Version is version number - SetVersion(value PatternFlowIpv6Version) FlowIpv6 - // HasVersion checks if Version has been set in FlowIpv6 - HasVersion() bool - // TrafficClass returns PatternFlowIpv6TrafficClass, set in FlowIpv6. - // PatternFlowIpv6TrafficClass is traffic class - TrafficClass() PatternFlowIpv6TrafficClass - // SetTrafficClass assigns PatternFlowIpv6TrafficClass provided by user to FlowIpv6. - // PatternFlowIpv6TrafficClass is traffic class - SetTrafficClass(value PatternFlowIpv6TrafficClass) FlowIpv6 - // HasTrafficClass checks if TrafficClass has been set in FlowIpv6 - HasTrafficClass() bool - // FlowLabel returns PatternFlowIpv6FlowLabel, set in FlowIpv6. - // PatternFlowIpv6FlowLabel is flow label - FlowLabel() PatternFlowIpv6FlowLabel - // SetFlowLabel assigns PatternFlowIpv6FlowLabel provided by user to FlowIpv6. - // PatternFlowIpv6FlowLabel is flow label - SetFlowLabel(value PatternFlowIpv6FlowLabel) FlowIpv6 - // HasFlowLabel checks if FlowLabel has been set in FlowIpv6 - HasFlowLabel() bool - // PayloadLength returns PatternFlowIpv6PayloadLength, set in FlowIpv6. - // PatternFlowIpv6PayloadLength is payload length - PayloadLength() PatternFlowIpv6PayloadLength - // SetPayloadLength assigns PatternFlowIpv6PayloadLength provided by user to FlowIpv6. - // PatternFlowIpv6PayloadLength is payload length - SetPayloadLength(value PatternFlowIpv6PayloadLength) FlowIpv6 - // HasPayloadLength checks if PayloadLength has been set in FlowIpv6 - HasPayloadLength() bool - // NextHeader returns PatternFlowIpv6NextHeader, set in FlowIpv6. - // PatternFlowIpv6NextHeader is next header - NextHeader() PatternFlowIpv6NextHeader - // SetNextHeader assigns PatternFlowIpv6NextHeader provided by user to FlowIpv6. - // PatternFlowIpv6NextHeader is next header - SetNextHeader(value PatternFlowIpv6NextHeader) FlowIpv6 - // HasNextHeader checks if NextHeader has been set in FlowIpv6 - HasNextHeader() bool - // HopLimit returns PatternFlowIpv6HopLimit, set in FlowIpv6. - // PatternFlowIpv6HopLimit is hop limit - HopLimit() PatternFlowIpv6HopLimit - // SetHopLimit assigns PatternFlowIpv6HopLimit provided by user to FlowIpv6. - // PatternFlowIpv6HopLimit is hop limit - SetHopLimit(value PatternFlowIpv6HopLimit) FlowIpv6 - // HasHopLimit checks if HopLimit has been set in FlowIpv6 - HasHopLimit() bool - // Src returns PatternFlowIpv6Src, set in FlowIpv6. - // PatternFlowIpv6Src is source address - Src() PatternFlowIpv6Src - // SetSrc assigns PatternFlowIpv6Src provided by user to FlowIpv6. - // PatternFlowIpv6Src is source address - SetSrc(value PatternFlowIpv6Src) FlowIpv6 - // HasSrc checks if Src has been set in FlowIpv6 - HasSrc() bool - // Dst returns PatternFlowIpv6Dst, set in FlowIpv6. - // PatternFlowIpv6Dst is destination address - Dst() PatternFlowIpv6Dst - // SetDst assigns PatternFlowIpv6Dst provided by user to FlowIpv6. - // PatternFlowIpv6Dst is destination address - SetDst(value PatternFlowIpv6Dst) FlowIpv6 - // HasDst checks if Dst has been set in FlowIpv6 - HasDst() bool - setNil() -} - -// description is TBD -// Version returns a PatternFlowIpv6Version -func (obj *flowIpv6) Version() PatternFlowIpv6Version { - if obj.obj.Version == nil { - obj.obj.Version = NewPatternFlowIpv6Version().msg() - } - if obj.versionHolder == nil { - obj.versionHolder = &patternFlowIpv6Version{obj: obj.obj.Version} - } - return obj.versionHolder -} - -// description is TBD -// Version returns a PatternFlowIpv6Version -func (obj *flowIpv6) HasVersion() bool { - return obj.obj.Version != nil -} - -// description is TBD -// SetVersion sets the PatternFlowIpv6Version value in the FlowIpv6 object -func (obj *flowIpv6) SetVersion(value PatternFlowIpv6Version) FlowIpv6 { - - obj.versionHolder = nil - obj.obj.Version = value.msg() - - return obj -} - -// description is TBD -// TrafficClass returns a PatternFlowIpv6TrafficClass -func (obj *flowIpv6) TrafficClass() PatternFlowIpv6TrafficClass { - if obj.obj.TrafficClass == nil { - obj.obj.TrafficClass = NewPatternFlowIpv6TrafficClass().msg() - } - if obj.trafficClassHolder == nil { - obj.trafficClassHolder = &patternFlowIpv6TrafficClass{obj: obj.obj.TrafficClass} - } - return obj.trafficClassHolder -} - -// description is TBD -// TrafficClass returns a PatternFlowIpv6TrafficClass -func (obj *flowIpv6) HasTrafficClass() bool { - return obj.obj.TrafficClass != nil -} - -// description is TBD -// SetTrafficClass sets the PatternFlowIpv6TrafficClass value in the FlowIpv6 object -func (obj *flowIpv6) SetTrafficClass(value PatternFlowIpv6TrafficClass) FlowIpv6 { - - obj.trafficClassHolder = nil - obj.obj.TrafficClass = value.msg() - - return obj -} - -// description is TBD -// FlowLabel returns a PatternFlowIpv6FlowLabel -func (obj *flowIpv6) FlowLabel() PatternFlowIpv6FlowLabel { - if obj.obj.FlowLabel == nil { - obj.obj.FlowLabel = NewPatternFlowIpv6FlowLabel().msg() - } - if obj.flowLabelHolder == nil { - obj.flowLabelHolder = &patternFlowIpv6FlowLabel{obj: obj.obj.FlowLabel} - } - return obj.flowLabelHolder -} - -// description is TBD -// FlowLabel returns a PatternFlowIpv6FlowLabel -func (obj *flowIpv6) HasFlowLabel() bool { - return obj.obj.FlowLabel != nil -} - -// description is TBD -// SetFlowLabel sets the PatternFlowIpv6FlowLabel value in the FlowIpv6 object -func (obj *flowIpv6) SetFlowLabel(value PatternFlowIpv6FlowLabel) FlowIpv6 { - - obj.flowLabelHolder = nil - obj.obj.FlowLabel = value.msg() - - return obj -} - -// description is TBD -// PayloadLength returns a PatternFlowIpv6PayloadLength -func (obj *flowIpv6) PayloadLength() PatternFlowIpv6PayloadLength { - if obj.obj.PayloadLength == nil { - obj.obj.PayloadLength = NewPatternFlowIpv6PayloadLength().msg() - } - if obj.payloadLengthHolder == nil { - obj.payloadLengthHolder = &patternFlowIpv6PayloadLength{obj: obj.obj.PayloadLength} - } - return obj.payloadLengthHolder -} - -// description is TBD -// PayloadLength returns a PatternFlowIpv6PayloadLength -func (obj *flowIpv6) HasPayloadLength() bool { - return obj.obj.PayloadLength != nil -} - -// description is TBD -// SetPayloadLength sets the PatternFlowIpv6PayloadLength value in the FlowIpv6 object -func (obj *flowIpv6) SetPayloadLength(value PatternFlowIpv6PayloadLength) FlowIpv6 { - - obj.payloadLengthHolder = nil - obj.obj.PayloadLength = value.msg() - - return obj -} - -// description is TBD -// NextHeader returns a PatternFlowIpv6NextHeader -func (obj *flowIpv6) NextHeader() PatternFlowIpv6NextHeader { - if obj.obj.NextHeader == nil { - obj.obj.NextHeader = NewPatternFlowIpv6NextHeader().msg() - } - if obj.nextHeaderHolder == nil { - obj.nextHeaderHolder = &patternFlowIpv6NextHeader{obj: obj.obj.NextHeader} - } - return obj.nextHeaderHolder -} - -// description is TBD -// NextHeader returns a PatternFlowIpv6NextHeader -func (obj *flowIpv6) HasNextHeader() bool { - return obj.obj.NextHeader != nil -} - -// description is TBD -// SetNextHeader sets the PatternFlowIpv6NextHeader value in the FlowIpv6 object -func (obj *flowIpv6) SetNextHeader(value PatternFlowIpv6NextHeader) FlowIpv6 { - - obj.nextHeaderHolder = nil - obj.obj.NextHeader = value.msg() - - return obj -} - -// description is TBD -// HopLimit returns a PatternFlowIpv6HopLimit -func (obj *flowIpv6) HopLimit() PatternFlowIpv6HopLimit { - if obj.obj.HopLimit == nil { - obj.obj.HopLimit = NewPatternFlowIpv6HopLimit().msg() - } - if obj.hopLimitHolder == nil { - obj.hopLimitHolder = &patternFlowIpv6HopLimit{obj: obj.obj.HopLimit} - } - return obj.hopLimitHolder -} - -// description is TBD -// HopLimit returns a PatternFlowIpv6HopLimit -func (obj *flowIpv6) HasHopLimit() bool { - return obj.obj.HopLimit != nil -} - -// description is TBD -// SetHopLimit sets the PatternFlowIpv6HopLimit value in the FlowIpv6 object -func (obj *flowIpv6) SetHopLimit(value PatternFlowIpv6HopLimit) FlowIpv6 { - - obj.hopLimitHolder = nil - obj.obj.HopLimit = value.msg() - - return obj -} - -// description is TBD -// Src returns a PatternFlowIpv6Src -func (obj *flowIpv6) Src() PatternFlowIpv6Src { - if obj.obj.Src == nil { - obj.obj.Src = NewPatternFlowIpv6Src().msg() - } - if obj.srcHolder == nil { - obj.srcHolder = &patternFlowIpv6Src{obj: obj.obj.Src} - } - return obj.srcHolder -} - -// description is TBD -// Src returns a PatternFlowIpv6Src -func (obj *flowIpv6) HasSrc() bool { - return obj.obj.Src != nil -} - -// description is TBD -// SetSrc sets the PatternFlowIpv6Src value in the FlowIpv6 object -func (obj *flowIpv6) SetSrc(value PatternFlowIpv6Src) FlowIpv6 { - - obj.srcHolder = nil - obj.obj.Src = value.msg() - - return obj -} - -// description is TBD -// Dst returns a PatternFlowIpv6Dst -func (obj *flowIpv6) Dst() PatternFlowIpv6Dst { - if obj.obj.Dst == nil { - obj.obj.Dst = NewPatternFlowIpv6Dst().msg() - } - if obj.dstHolder == nil { - obj.dstHolder = &patternFlowIpv6Dst{obj: obj.obj.Dst} - } - return obj.dstHolder -} - -// description is TBD -// Dst returns a PatternFlowIpv6Dst -func (obj *flowIpv6) HasDst() bool { - return obj.obj.Dst != nil -} - -// description is TBD -// SetDst sets the PatternFlowIpv6Dst value in the FlowIpv6 object -func (obj *flowIpv6) SetDst(value PatternFlowIpv6Dst) FlowIpv6 { - - obj.dstHolder = nil - obj.obj.Dst = value.msg() - - return obj -} - -func (obj *flowIpv6) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Version != nil { - - obj.Version().validateObj(vObj, set_default) - } - - if obj.obj.TrafficClass != nil { - - obj.TrafficClass().validateObj(vObj, set_default) - } - - if obj.obj.FlowLabel != nil { - - obj.FlowLabel().validateObj(vObj, set_default) - } - - if obj.obj.PayloadLength != nil { - - obj.PayloadLength().validateObj(vObj, set_default) - } - - if obj.obj.NextHeader != nil { - - obj.NextHeader().validateObj(vObj, set_default) - } - - if obj.obj.HopLimit != nil { - - obj.HopLimit().validateObj(vObj, set_default) - } - - if obj.obj.Src != nil { - - obj.Src().validateObj(vObj, set_default) - } - - if obj.obj.Dst != nil { - - obj.Dst().validateObj(vObj, set_default) - } - -} - -func (obj *flowIpv6) setDefault() { - -} - -// ***** FlowPfcPause ***** -type flowPfcPause struct { - validation - obj *otg.FlowPfcPause - marshaller marshalFlowPfcPause - unMarshaller unMarshalFlowPfcPause - dstHolder PatternFlowPfcPauseDst - srcHolder PatternFlowPfcPauseSrc - etherTypeHolder PatternFlowPfcPauseEtherType - controlOpCodeHolder PatternFlowPfcPauseControlOpCode - classEnableVectorHolder PatternFlowPfcPauseClassEnableVector - pauseClass_0Holder PatternFlowPfcPausePauseClass0 - pauseClass_1Holder PatternFlowPfcPausePauseClass1 - pauseClass_2Holder PatternFlowPfcPausePauseClass2 - pauseClass_3Holder PatternFlowPfcPausePauseClass3 - pauseClass_4Holder PatternFlowPfcPausePauseClass4 - pauseClass_5Holder PatternFlowPfcPausePauseClass5 - pauseClass_6Holder PatternFlowPfcPausePauseClass6 - pauseClass_7Holder PatternFlowPfcPausePauseClass7 -} - -func NewFlowPfcPause() FlowPfcPause { - obj := flowPfcPause{obj: &otg.FlowPfcPause{}} - obj.setDefault() - return &obj -} - -func (obj *flowPfcPause) msg() *otg.FlowPfcPause { - return obj.obj -} - -func (obj *flowPfcPause) setMsg(msg *otg.FlowPfcPause) FlowPfcPause { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowPfcPause struct { - obj *flowPfcPause -} - -type marshalFlowPfcPause interface { - // ToProto marshals FlowPfcPause to protobuf object *otg.FlowPfcPause - ToProto() (*otg.FlowPfcPause, error) - // ToPbText marshals FlowPfcPause to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowPfcPause to YAML text - ToYaml() (string, error) - // ToJson marshals FlowPfcPause to JSON text - ToJson() (string, error) -} - -type unMarshalflowPfcPause struct { - obj *flowPfcPause -} - -type unMarshalFlowPfcPause interface { - // FromProto unmarshals FlowPfcPause from protobuf object *otg.FlowPfcPause - FromProto(msg *otg.FlowPfcPause) (FlowPfcPause, error) - // FromPbText unmarshals FlowPfcPause from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowPfcPause from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowPfcPause from JSON text - FromJson(value string) error -} - -func (obj *flowPfcPause) Marshal() marshalFlowPfcPause { - if obj.marshaller == nil { - obj.marshaller = &marshalflowPfcPause{obj: obj} - } - return obj.marshaller -} - -func (obj *flowPfcPause) Unmarshal() unMarshalFlowPfcPause { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowPfcPause{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowPfcPause) ToProto() (*otg.FlowPfcPause, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowPfcPause) FromProto(msg *otg.FlowPfcPause) (FlowPfcPause, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowPfcPause) 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 *unMarshalflowPfcPause) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowPfcPause) 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 *unMarshalflowPfcPause) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowPfcPause) 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 *unMarshalflowPfcPause) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowPfcPause) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowPfcPause) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowPfcPause) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowPfcPause) Clone() (FlowPfcPause, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowPfcPause() - 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 -} - -func (obj *flowPfcPause) setNil() { - obj.dstHolder = nil - obj.srcHolder = nil - obj.etherTypeHolder = nil - obj.controlOpCodeHolder = nil - obj.classEnableVectorHolder = nil - obj.pauseClass_0Holder = nil - obj.pauseClass_1Holder = nil - obj.pauseClass_2Holder = nil - obj.pauseClass_3Holder = nil - obj.pauseClass_4Holder = nil - obj.pauseClass_5Holder = nil - obj.pauseClass_6Holder = nil - obj.pauseClass_7Holder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowPfcPause is iEEE 802.1Qbb PFC Pause packet header. -type FlowPfcPause interface { - Validation - // msg marshals FlowPfcPause to protobuf object *otg.FlowPfcPause - // and doesn't set defaults - msg() *otg.FlowPfcPause - // setMsg unmarshals FlowPfcPause from protobuf object *otg.FlowPfcPause - // and doesn't set defaults - setMsg(*otg.FlowPfcPause) FlowPfcPause - // provides marshal interface - Marshal() marshalFlowPfcPause - // provides unmarshal interface - Unmarshal() unMarshalFlowPfcPause - // validate validates FlowPfcPause - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowPfcPause, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Dst returns PatternFlowPfcPauseDst, set in FlowPfcPause. - // PatternFlowPfcPauseDst is destination MAC address - Dst() PatternFlowPfcPauseDst - // SetDst assigns PatternFlowPfcPauseDst provided by user to FlowPfcPause. - // PatternFlowPfcPauseDst is destination MAC address - SetDst(value PatternFlowPfcPauseDst) FlowPfcPause - // HasDst checks if Dst has been set in FlowPfcPause - HasDst() bool - // Src returns PatternFlowPfcPauseSrc, set in FlowPfcPause. - // PatternFlowPfcPauseSrc is source MAC address - Src() PatternFlowPfcPauseSrc - // SetSrc assigns PatternFlowPfcPauseSrc provided by user to FlowPfcPause. - // PatternFlowPfcPauseSrc is source MAC address - SetSrc(value PatternFlowPfcPauseSrc) FlowPfcPause - // HasSrc checks if Src has been set in FlowPfcPause - HasSrc() bool - // EtherType returns PatternFlowPfcPauseEtherType, set in FlowPfcPause. - // PatternFlowPfcPauseEtherType is ethernet type - EtherType() PatternFlowPfcPauseEtherType - // SetEtherType assigns PatternFlowPfcPauseEtherType provided by user to FlowPfcPause. - // PatternFlowPfcPauseEtherType is ethernet type - SetEtherType(value PatternFlowPfcPauseEtherType) FlowPfcPause - // HasEtherType checks if EtherType has been set in FlowPfcPause - HasEtherType() bool - // ControlOpCode returns PatternFlowPfcPauseControlOpCode, set in FlowPfcPause. - // PatternFlowPfcPauseControlOpCode is control operation code - ControlOpCode() PatternFlowPfcPauseControlOpCode - // SetControlOpCode assigns PatternFlowPfcPauseControlOpCode provided by user to FlowPfcPause. - // PatternFlowPfcPauseControlOpCode is control operation code - SetControlOpCode(value PatternFlowPfcPauseControlOpCode) FlowPfcPause - // HasControlOpCode checks if ControlOpCode has been set in FlowPfcPause - HasControlOpCode() bool - // ClassEnableVector returns PatternFlowPfcPauseClassEnableVector, set in FlowPfcPause. - // PatternFlowPfcPauseClassEnableVector is destination - ClassEnableVector() PatternFlowPfcPauseClassEnableVector - // SetClassEnableVector assigns PatternFlowPfcPauseClassEnableVector provided by user to FlowPfcPause. - // PatternFlowPfcPauseClassEnableVector is destination - SetClassEnableVector(value PatternFlowPfcPauseClassEnableVector) FlowPfcPause - // HasClassEnableVector checks if ClassEnableVector has been set in FlowPfcPause - HasClassEnableVector() bool - // PauseClass0 returns PatternFlowPfcPausePauseClass0, set in FlowPfcPause. - // PatternFlowPfcPausePauseClass0 is pause class 0 - PauseClass0() PatternFlowPfcPausePauseClass0 - // SetPauseClass0 assigns PatternFlowPfcPausePauseClass0 provided by user to FlowPfcPause. - // PatternFlowPfcPausePauseClass0 is pause class 0 - SetPauseClass0(value PatternFlowPfcPausePauseClass0) FlowPfcPause - // HasPauseClass0 checks if PauseClass0 has been set in FlowPfcPause - HasPauseClass0() bool - // PauseClass1 returns PatternFlowPfcPausePauseClass1, set in FlowPfcPause. - // PatternFlowPfcPausePauseClass1 is pause class 1 - PauseClass1() PatternFlowPfcPausePauseClass1 - // SetPauseClass1 assigns PatternFlowPfcPausePauseClass1 provided by user to FlowPfcPause. - // PatternFlowPfcPausePauseClass1 is pause class 1 - SetPauseClass1(value PatternFlowPfcPausePauseClass1) FlowPfcPause - // HasPauseClass1 checks if PauseClass1 has been set in FlowPfcPause - HasPauseClass1() bool - // PauseClass2 returns PatternFlowPfcPausePauseClass2, set in FlowPfcPause. - // PatternFlowPfcPausePauseClass2 is pause class 2 - PauseClass2() PatternFlowPfcPausePauseClass2 - // SetPauseClass2 assigns PatternFlowPfcPausePauseClass2 provided by user to FlowPfcPause. - // PatternFlowPfcPausePauseClass2 is pause class 2 - SetPauseClass2(value PatternFlowPfcPausePauseClass2) FlowPfcPause - // HasPauseClass2 checks if PauseClass2 has been set in FlowPfcPause - HasPauseClass2() bool - // PauseClass3 returns PatternFlowPfcPausePauseClass3, set in FlowPfcPause. - // PatternFlowPfcPausePauseClass3 is pause class 3 - PauseClass3() PatternFlowPfcPausePauseClass3 - // SetPauseClass3 assigns PatternFlowPfcPausePauseClass3 provided by user to FlowPfcPause. - // PatternFlowPfcPausePauseClass3 is pause class 3 - SetPauseClass3(value PatternFlowPfcPausePauseClass3) FlowPfcPause - // HasPauseClass3 checks if PauseClass3 has been set in FlowPfcPause - HasPauseClass3() bool - // PauseClass4 returns PatternFlowPfcPausePauseClass4, set in FlowPfcPause. - // PatternFlowPfcPausePauseClass4 is pause class 4 - PauseClass4() PatternFlowPfcPausePauseClass4 - // SetPauseClass4 assigns PatternFlowPfcPausePauseClass4 provided by user to FlowPfcPause. - // PatternFlowPfcPausePauseClass4 is pause class 4 - SetPauseClass4(value PatternFlowPfcPausePauseClass4) FlowPfcPause - // HasPauseClass4 checks if PauseClass4 has been set in FlowPfcPause - HasPauseClass4() bool - // PauseClass5 returns PatternFlowPfcPausePauseClass5, set in FlowPfcPause. - // PatternFlowPfcPausePauseClass5 is pause class 5 - PauseClass5() PatternFlowPfcPausePauseClass5 - // SetPauseClass5 assigns PatternFlowPfcPausePauseClass5 provided by user to FlowPfcPause. - // PatternFlowPfcPausePauseClass5 is pause class 5 - SetPauseClass5(value PatternFlowPfcPausePauseClass5) FlowPfcPause - // HasPauseClass5 checks if PauseClass5 has been set in FlowPfcPause - HasPauseClass5() bool - // PauseClass6 returns PatternFlowPfcPausePauseClass6, set in FlowPfcPause. - // PatternFlowPfcPausePauseClass6 is pause class 6 - PauseClass6() PatternFlowPfcPausePauseClass6 - // SetPauseClass6 assigns PatternFlowPfcPausePauseClass6 provided by user to FlowPfcPause. - // PatternFlowPfcPausePauseClass6 is pause class 6 - SetPauseClass6(value PatternFlowPfcPausePauseClass6) FlowPfcPause - // HasPauseClass6 checks if PauseClass6 has been set in FlowPfcPause - HasPauseClass6() bool - // PauseClass7 returns PatternFlowPfcPausePauseClass7, set in FlowPfcPause. - // PatternFlowPfcPausePauseClass7 is pause class 7 - PauseClass7() PatternFlowPfcPausePauseClass7 - // SetPauseClass7 assigns PatternFlowPfcPausePauseClass7 provided by user to FlowPfcPause. - // PatternFlowPfcPausePauseClass7 is pause class 7 - SetPauseClass7(value PatternFlowPfcPausePauseClass7) FlowPfcPause - // HasPauseClass7 checks if PauseClass7 has been set in FlowPfcPause - HasPauseClass7() bool - setNil() -} - -// description is TBD -// Dst returns a PatternFlowPfcPauseDst -func (obj *flowPfcPause) Dst() PatternFlowPfcPauseDst { - if obj.obj.Dst == nil { - obj.obj.Dst = NewPatternFlowPfcPauseDst().msg() - } - if obj.dstHolder == nil { - obj.dstHolder = &patternFlowPfcPauseDst{obj: obj.obj.Dst} - } - return obj.dstHolder -} - -// description is TBD -// Dst returns a PatternFlowPfcPauseDst -func (obj *flowPfcPause) HasDst() bool { - return obj.obj.Dst != nil -} - -// description is TBD -// SetDst sets the PatternFlowPfcPauseDst value in the FlowPfcPause object -func (obj *flowPfcPause) SetDst(value PatternFlowPfcPauseDst) FlowPfcPause { - - obj.dstHolder = nil - obj.obj.Dst = value.msg() - - return obj -} - -// description is TBD -// Src returns a PatternFlowPfcPauseSrc -func (obj *flowPfcPause) Src() PatternFlowPfcPauseSrc { - if obj.obj.Src == nil { - obj.obj.Src = NewPatternFlowPfcPauseSrc().msg() - } - if obj.srcHolder == nil { - obj.srcHolder = &patternFlowPfcPauseSrc{obj: obj.obj.Src} - } - return obj.srcHolder -} - -// description is TBD -// Src returns a PatternFlowPfcPauseSrc -func (obj *flowPfcPause) HasSrc() bool { - return obj.obj.Src != nil -} - -// description is TBD -// SetSrc sets the PatternFlowPfcPauseSrc value in the FlowPfcPause object -func (obj *flowPfcPause) SetSrc(value PatternFlowPfcPauseSrc) FlowPfcPause { - - obj.srcHolder = nil - obj.obj.Src = value.msg() - - return obj -} - -// description is TBD -// EtherType returns a PatternFlowPfcPauseEtherType -func (obj *flowPfcPause) EtherType() PatternFlowPfcPauseEtherType { - if obj.obj.EtherType == nil { - obj.obj.EtherType = NewPatternFlowPfcPauseEtherType().msg() - } - if obj.etherTypeHolder == nil { - obj.etherTypeHolder = &patternFlowPfcPauseEtherType{obj: obj.obj.EtherType} - } - return obj.etherTypeHolder -} - -// description is TBD -// EtherType returns a PatternFlowPfcPauseEtherType -func (obj *flowPfcPause) HasEtherType() bool { - return obj.obj.EtherType != nil -} - -// description is TBD -// SetEtherType sets the PatternFlowPfcPauseEtherType value in the FlowPfcPause object -func (obj *flowPfcPause) SetEtherType(value PatternFlowPfcPauseEtherType) FlowPfcPause { - - obj.etherTypeHolder = nil - obj.obj.EtherType = value.msg() - - return obj -} - -// description is TBD -// ControlOpCode returns a PatternFlowPfcPauseControlOpCode -func (obj *flowPfcPause) ControlOpCode() PatternFlowPfcPauseControlOpCode { - if obj.obj.ControlOpCode == nil { - obj.obj.ControlOpCode = NewPatternFlowPfcPauseControlOpCode().msg() - } - if obj.controlOpCodeHolder == nil { - obj.controlOpCodeHolder = &patternFlowPfcPauseControlOpCode{obj: obj.obj.ControlOpCode} - } - return obj.controlOpCodeHolder -} - -// description is TBD -// ControlOpCode returns a PatternFlowPfcPauseControlOpCode -func (obj *flowPfcPause) HasControlOpCode() bool { - return obj.obj.ControlOpCode != nil -} - -// description is TBD -// SetControlOpCode sets the PatternFlowPfcPauseControlOpCode value in the FlowPfcPause object -func (obj *flowPfcPause) SetControlOpCode(value PatternFlowPfcPauseControlOpCode) FlowPfcPause { - - obj.controlOpCodeHolder = nil - obj.obj.ControlOpCode = value.msg() - - return obj -} - -// description is TBD -// ClassEnableVector returns a PatternFlowPfcPauseClassEnableVector -func (obj *flowPfcPause) ClassEnableVector() PatternFlowPfcPauseClassEnableVector { - if obj.obj.ClassEnableVector == nil { - obj.obj.ClassEnableVector = NewPatternFlowPfcPauseClassEnableVector().msg() - } - if obj.classEnableVectorHolder == nil { - obj.classEnableVectorHolder = &patternFlowPfcPauseClassEnableVector{obj: obj.obj.ClassEnableVector} - } - return obj.classEnableVectorHolder -} - -// description is TBD -// ClassEnableVector returns a PatternFlowPfcPauseClassEnableVector -func (obj *flowPfcPause) HasClassEnableVector() bool { - return obj.obj.ClassEnableVector != nil -} - -// description is TBD -// SetClassEnableVector sets the PatternFlowPfcPauseClassEnableVector value in the FlowPfcPause object -func (obj *flowPfcPause) SetClassEnableVector(value PatternFlowPfcPauseClassEnableVector) FlowPfcPause { - - obj.classEnableVectorHolder = nil - obj.obj.ClassEnableVector = value.msg() - - return obj -} - -// description is TBD -// PauseClass0 returns a PatternFlowPfcPausePauseClass0 -func (obj *flowPfcPause) PauseClass0() PatternFlowPfcPausePauseClass0 { - if obj.obj.PauseClass_0 == nil { - obj.obj.PauseClass_0 = NewPatternFlowPfcPausePauseClass0().msg() - } - if obj.pauseClass_0Holder == nil { - obj.pauseClass_0Holder = &patternFlowPfcPausePauseClass0{obj: obj.obj.PauseClass_0} - } - return obj.pauseClass_0Holder -} - -// description is TBD -// PauseClass0 returns a PatternFlowPfcPausePauseClass0 -func (obj *flowPfcPause) HasPauseClass0() bool { - return obj.obj.PauseClass_0 != nil -} - -// description is TBD -// SetPauseClass0 sets the PatternFlowPfcPausePauseClass0 value in the FlowPfcPause object -func (obj *flowPfcPause) SetPauseClass0(value PatternFlowPfcPausePauseClass0) FlowPfcPause { - - obj.pauseClass_0Holder = nil - obj.obj.PauseClass_0 = value.msg() - - return obj -} - -// description is TBD -// PauseClass1 returns a PatternFlowPfcPausePauseClass1 -func (obj *flowPfcPause) PauseClass1() PatternFlowPfcPausePauseClass1 { - if obj.obj.PauseClass_1 == nil { - obj.obj.PauseClass_1 = NewPatternFlowPfcPausePauseClass1().msg() - } - if obj.pauseClass_1Holder == nil { - obj.pauseClass_1Holder = &patternFlowPfcPausePauseClass1{obj: obj.obj.PauseClass_1} - } - return obj.pauseClass_1Holder -} - -// description is TBD -// PauseClass1 returns a PatternFlowPfcPausePauseClass1 -func (obj *flowPfcPause) HasPauseClass1() bool { - return obj.obj.PauseClass_1 != nil -} - -// description is TBD -// SetPauseClass1 sets the PatternFlowPfcPausePauseClass1 value in the FlowPfcPause object -func (obj *flowPfcPause) SetPauseClass1(value PatternFlowPfcPausePauseClass1) FlowPfcPause { - - obj.pauseClass_1Holder = nil - obj.obj.PauseClass_1 = value.msg() - - return obj -} - -// description is TBD -// PauseClass2 returns a PatternFlowPfcPausePauseClass2 -func (obj *flowPfcPause) PauseClass2() PatternFlowPfcPausePauseClass2 { - if obj.obj.PauseClass_2 == nil { - obj.obj.PauseClass_2 = NewPatternFlowPfcPausePauseClass2().msg() - } - if obj.pauseClass_2Holder == nil { - obj.pauseClass_2Holder = &patternFlowPfcPausePauseClass2{obj: obj.obj.PauseClass_2} - } - return obj.pauseClass_2Holder -} - -// description is TBD -// PauseClass2 returns a PatternFlowPfcPausePauseClass2 -func (obj *flowPfcPause) HasPauseClass2() bool { - return obj.obj.PauseClass_2 != nil -} - -// description is TBD -// SetPauseClass2 sets the PatternFlowPfcPausePauseClass2 value in the FlowPfcPause object -func (obj *flowPfcPause) SetPauseClass2(value PatternFlowPfcPausePauseClass2) FlowPfcPause { - - obj.pauseClass_2Holder = nil - obj.obj.PauseClass_2 = value.msg() - - return obj -} - -// description is TBD -// PauseClass3 returns a PatternFlowPfcPausePauseClass3 -func (obj *flowPfcPause) PauseClass3() PatternFlowPfcPausePauseClass3 { - if obj.obj.PauseClass_3 == nil { - obj.obj.PauseClass_3 = NewPatternFlowPfcPausePauseClass3().msg() - } - if obj.pauseClass_3Holder == nil { - obj.pauseClass_3Holder = &patternFlowPfcPausePauseClass3{obj: obj.obj.PauseClass_3} - } - return obj.pauseClass_3Holder -} - -// description is TBD -// PauseClass3 returns a PatternFlowPfcPausePauseClass3 -func (obj *flowPfcPause) HasPauseClass3() bool { - return obj.obj.PauseClass_3 != nil -} - -// description is TBD -// SetPauseClass3 sets the PatternFlowPfcPausePauseClass3 value in the FlowPfcPause object -func (obj *flowPfcPause) SetPauseClass3(value PatternFlowPfcPausePauseClass3) FlowPfcPause { - - obj.pauseClass_3Holder = nil - obj.obj.PauseClass_3 = value.msg() - - return obj -} - -// description is TBD -// PauseClass4 returns a PatternFlowPfcPausePauseClass4 -func (obj *flowPfcPause) PauseClass4() PatternFlowPfcPausePauseClass4 { - if obj.obj.PauseClass_4 == nil { - obj.obj.PauseClass_4 = NewPatternFlowPfcPausePauseClass4().msg() - } - if obj.pauseClass_4Holder == nil { - obj.pauseClass_4Holder = &patternFlowPfcPausePauseClass4{obj: obj.obj.PauseClass_4} - } - return obj.pauseClass_4Holder -} - -// description is TBD -// PauseClass4 returns a PatternFlowPfcPausePauseClass4 -func (obj *flowPfcPause) HasPauseClass4() bool { - return obj.obj.PauseClass_4 != nil -} - -// description is TBD -// SetPauseClass4 sets the PatternFlowPfcPausePauseClass4 value in the FlowPfcPause object -func (obj *flowPfcPause) SetPauseClass4(value PatternFlowPfcPausePauseClass4) FlowPfcPause { - - obj.pauseClass_4Holder = nil - obj.obj.PauseClass_4 = value.msg() - - return obj -} - -// description is TBD -// PauseClass5 returns a PatternFlowPfcPausePauseClass5 -func (obj *flowPfcPause) PauseClass5() PatternFlowPfcPausePauseClass5 { - if obj.obj.PauseClass_5 == nil { - obj.obj.PauseClass_5 = NewPatternFlowPfcPausePauseClass5().msg() - } - if obj.pauseClass_5Holder == nil { - obj.pauseClass_5Holder = &patternFlowPfcPausePauseClass5{obj: obj.obj.PauseClass_5} - } - return obj.pauseClass_5Holder -} - -// description is TBD -// PauseClass5 returns a PatternFlowPfcPausePauseClass5 -func (obj *flowPfcPause) HasPauseClass5() bool { - return obj.obj.PauseClass_5 != nil -} - -// description is TBD -// SetPauseClass5 sets the PatternFlowPfcPausePauseClass5 value in the FlowPfcPause object -func (obj *flowPfcPause) SetPauseClass5(value PatternFlowPfcPausePauseClass5) FlowPfcPause { - - obj.pauseClass_5Holder = nil - obj.obj.PauseClass_5 = value.msg() - - return obj -} - -// description is TBD -// PauseClass6 returns a PatternFlowPfcPausePauseClass6 -func (obj *flowPfcPause) PauseClass6() PatternFlowPfcPausePauseClass6 { - if obj.obj.PauseClass_6 == nil { - obj.obj.PauseClass_6 = NewPatternFlowPfcPausePauseClass6().msg() - } - if obj.pauseClass_6Holder == nil { - obj.pauseClass_6Holder = &patternFlowPfcPausePauseClass6{obj: obj.obj.PauseClass_6} - } - return obj.pauseClass_6Holder -} - -// description is TBD -// PauseClass6 returns a PatternFlowPfcPausePauseClass6 -func (obj *flowPfcPause) HasPauseClass6() bool { - return obj.obj.PauseClass_6 != nil -} - -// description is TBD -// SetPauseClass6 sets the PatternFlowPfcPausePauseClass6 value in the FlowPfcPause object -func (obj *flowPfcPause) SetPauseClass6(value PatternFlowPfcPausePauseClass6) FlowPfcPause { - - obj.pauseClass_6Holder = nil - obj.obj.PauseClass_6 = value.msg() - - return obj -} - -// description is TBD -// PauseClass7 returns a PatternFlowPfcPausePauseClass7 -func (obj *flowPfcPause) PauseClass7() PatternFlowPfcPausePauseClass7 { - if obj.obj.PauseClass_7 == nil { - obj.obj.PauseClass_7 = NewPatternFlowPfcPausePauseClass7().msg() - } - if obj.pauseClass_7Holder == nil { - obj.pauseClass_7Holder = &patternFlowPfcPausePauseClass7{obj: obj.obj.PauseClass_7} - } - return obj.pauseClass_7Holder -} - -// description is TBD -// PauseClass7 returns a PatternFlowPfcPausePauseClass7 -func (obj *flowPfcPause) HasPauseClass7() bool { - return obj.obj.PauseClass_7 != nil -} - -// description is TBD -// SetPauseClass7 sets the PatternFlowPfcPausePauseClass7 value in the FlowPfcPause object -func (obj *flowPfcPause) SetPauseClass7(value PatternFlowPfcPausePauseClass7) FlowPfcPause { - - obj.pauseClass_7Holder = nil - obj.obj.PauseClass_7 = value.msg() - - return obj -} - -func (obj *flowPfcPause) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Dst != nil { - - obj.Dst().validateObj(vObj, set_default) - } - - if obj.obj.Src != nil { - - obj.Src().validateObj(vObj, set_default) - } - - if obj.obj.EtherType != nil { - - obj.EtherType().validateObj(vObj, set_default) - } - - if obj.obj.ControlOpCode != nil { - - obj.ControlOpCode().validateObj(vObj, set_default) - } - - if obj.obj.ClassEnableVector != nil { - - obj.ClassEnableVector().validateObj(vObj, set_default) - } - - if obj.obj.PauseClass_0 != nil { - - obj.PauseClass0().validateObj(vObj, set_default) - } - - if obj.obj.PauseClass_1 != nil { - - obj.PauseClass1().validateObj(vObj, set_default) - } - - if obj.obj.PauseClass_2 != nil { - - obj.PauseClass2().validateObj(vObj, set_default) - } - - if obj.obj.PauseClass_3 != nil { - - obj.PauseClass3().validateObj(vObj, set_default) - } - - if obj.obj.PauseClass_4 != nil { - - obj.PauseClass4().validateObj(vObj, set_default) - } - - if obj.obj.PauseClass_5 != nil { - - obj.PauseClass5().validateObj(vObj, set_default) - } - - if obj.obj.PauseClass_6 != nil { - - obj.PauseClass6().validateObj(vObj, set_default) - } - - if obj.obj.PauseClass_7 != nil { - - obj.PauseClass7().validateObj(vObj, set_default) - } - -} - -func (obj *flowPfcPause) setDefault() { - -} - -// ***** FlowEthernetPause ***** -type flowEthernetPause struct { - validation - obj *otg.FlowEthernetPause - marshaller marshalFlowEthernetPause - unMarshaller unMarshalFlowEthernetPause - dstHolder PatternFlowEthernetPauseDst - srcHolder PatternFlowEthernetPauseSrc - etherTypeHolder PatternFlowEthernetPauseEtherType - controlOpCodeHolder PatternFlowEthernetPauseControlOpCode - timeHolder PatternFlowEthernetPauseTime -} - -func NewFlowEthernetPause() FlowEthernetPause { - obj := flowEthernetPause{obj: &otg.FlowEthernetPause{}} - obj.setDefault() - return &obj -} - -func (obj *flowEthernetPause) msg() *otg.FlowEthernetPause { - return obj.obj -} - -func (obj *flowEthernetPause) setMsg(msg *otg.FlowEthernetPause) FlowEthernetPause { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowEthernetPause struct { - obj *flowEthernetPause -} - -type marshalFlowEthernetPause interface { - // ToProto marshals FlowEthernetPause to protobuf object *otg.FlowEthernetPause - ToProto() (*otg.FlowEthernetPause, error) - // ToPbText marshals FlowEthernetPause to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowEthernetPause to YAML text - ToYaml() (string, error) - // ToJson marshals FlowEthernetPause to JSON text - ToJson() (string, error) -} - -type unMarshalflowEthernetPause struct { - obj *flowEthernetPause -} - -type unMarshalFlowEthernetPause interface { - // FromProto unmarshals FlowEthernetPause from protobuf object *otg.FlowEthernetPause - FromProto(msg *otg.FlowEthernetPause) (FlowEthernetPause, error) - // FromPbText unmarshals FlowEthernetPause from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowEthernetPause from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowEthernetPause from JSON text - FromJson(value string) error -} - -func (obj *flowEthernetPause) Marshal() marshalFlowEthernetPause { - if obj.marshaller == nil { - obj.marshaller = &marshalflowEthernetPause{obj: obj} - } - return obj.marshaller -} - -func (obj *flowEthernetPause) Unmarshal() unMarshalFlowEthernetPause { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowEthernetPause{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowEthernetPause) ToProto() (*otg.FlowEthernetPause, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowEthernetPause) FromProto(msg *otg.FlowEthernetPause) (FlowEthernetPause, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowEthernetPause) 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 *unMarshalflowEthernetPause) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowEthernetPause) 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 *unMarshalflowEthernetPause) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowEthernetPause) 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 *unMarshalflowEthernetPause) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowEthernetPause) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowEthernetPause) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowEthernetPause) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowEthernetPause) Clone() (FlowEthernetPause, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowEthernetPause() - 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 -} - -func (obj *flowEthernetPause) setNil() { - obj.dstHolder = nil - obj.srcHolder = nil - obj.etherTypeHolder = nil - obj.controlOpCodeHolder = nil - obj.timeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowEthernetPause is iEEE 802.3x global ethernet pause packet header -type FlowEthernetPause interface { - Validation - // msg marshals FlowEthernetPause to protobuf object *otg.FlowEthernetPause - // and doesn't set defaults - msg() *otg.FlowEthernetPause - // setMsg unmarshals FlowEthernetPause from protobuf object *otg.FlowEthernetPause - // and doesn't set defaults - setMsg(*otg.FlowEthernetPause) FlowEthernetPause - // provides marshal interface - Marshal() marshalFlowEthernetPause - // provides unmarshal interface - Unmarshal() unMarshalFlowEthernetPause - // validate validates FlowEthernetPause - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowEthernetPause, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Dst returns PatternFlowEthernetPauseDst, set in FlowEthernetPause. - // PatternFlowEthernetPauseDst is destination MAC address - Dst() PatternFlowEthernetPauseDst - // SetDst assigns PatternFlowEthernetPauseDst provided by user to FlowEthernetPause. - // PatternFlowEthernetPauseDst is destination MAC address - SetDst(value PatternFlowEthernetPauseDst) FlowEthernetPause - // HasDst checks if Dst has been set in FlowEthernetPause - HasDst() bool - // Src returns PatternFlowEthernetPauseSrc, set in FlowEthernetPause. - // PatternFlowEthernetPauseSrc is source MAC address - Src() PatternFlowEthernetPauseSrc - // SetSrc assigns PatternFlowEthernetPauseSrc provided by user to FlowEthernetPause. - // PatternFlowEthernetPauseSrc is source MAC address - SetSrc(value PatternFlowEthernetPauseSrc) FlowEthernetPause - // HasSrc checks if Src has been set in FlowEthernetPause - HasSrc() bool - // EtherType returns PatternFlowEthernetPauseEtherType, set in FlowEthernetPause. - // PatternFlowEthernetPauseEtherType is ethernet type - EtherType() PatternFlowEthernetPauseEtherType - // SetEtherType assigns PatternFlowEthernetPauseEtherType provided by user to FlowEthernetPause. - // PatternFlowEthernetPauseEtherType is ethernet type - SetEtherType(value PatternFlowEthernetPauseEtherType) FlowEthernetPause - // HasEtherType checks if EtherType has been set in FlowEthernetPause - HasEtherType() bool - // ControlOpCode returns PatternFlowEthernetPauseControlOpCode, set in FlowEthernetPause. - // PatternFlowEthernetPauseControlOpCode is control operation code - ControlOpCode() PatternFlowEthernetPauseControlOpCode - // SetControlOpCode assigns PatternFlowEthernetPauseControlOpCode provided by user to FlowEthernetPause. - // PatternFlowEthernetPauseControlOpCode is control operation code - SetControlOpCode(value PatternFlowEthernetPauseControlOpCode) FlowEthernetPause - // HasControlOpCode checks if ControlOpCode has been set in FlowEthernetPause - HasControlOpCode() bool - // Time returns PatternFlowEthernetPauseTime, set in FlowEthernetPause. - // PatternFlowEthernetPauseTime is time - Time() PatternFlowEthernetPauseTime - // SetTime assigns PatternFlowEthernetPauseTime provided by user to FlowEthernetPause. - // PatternFlowEthernetPauseTime is time - SetTime(value PatternFlowEthernetPauseTime) FlowEthernetPause - // HasTime checks if Time has been set in FlowEthernetPause - HasTime() bool - setNil() -} - -// description is TBD -// Dst returns a PatternFlowEthernetPauseDst -func (obj *flowEthernetPause) Dst() PatternFlowEthernetPauseDst { - if obj.obj.Dst == nil { - obj.obj.Dst = NewPatternFlowEthernetPauseDst().msg() - } - if obj.dstHolder == nil { - obj.dstHolder = &patternFlowEthernetPauseDst{obj: obj.obj.Dst} - } - return obj.dstHolder -} - -// description is TBD -// Dst returns a PatternFlowEthernetPauseDst -func (obj *flowEthernetPause) HasDst() bool { - return obj.obj.Dst != nil -} - -// description is TBD -// SetDst sets the PatternFlowEthernetPauseDst value in the FlowEthernetPause object -func (obj *flowEthernetPause) SetDst(value PatternFlowEthernetPauseDst) FlowEthernetPause { - - obj.dstHolder = nil - obj.obj.Dst = value.msg() - - return obj -} - -// description is TBD -// Src returns a PatternFlowEthernetPauseSrc -func (obj *flowEthernetPause) Src() PatternFlowEthernetPauseSrc { - if obj.obj.Src == nil { - obj.obj.Src = NewPatternFlowEthernetPauseSrc().msg() - } - if obj.srcHolder == nil { - obj.srcHolder = &patternFlowEthernetPauseSrc{obj: obj.obj.Src} - } - return obj.srcHolder -} - -// description is TBD -// Src returns a PatternFlowEthernetPauseSrc -func (obj *flowEthernetPause) HasSrc() bool { - return obj.obj.Src != nil -} - -// description is TBD -// SetSrc sets the PatternFlowEthernetPauseSrc value in the FlowEthernetPause object -func (obj *flowEthernetPause) SetSrc(value PatternFlowEthernetPauseSrc) FlowEthernetPause { - - obj.srcHolder = nil - obj.obj.Src = value.msg() - - return obj -} - -// description is TBD -// EtherType returns a PatternFlowEthernetPauseEtherType -func (obj *flowEthernetPause) EtherType() PatternFlowEthernetPauseEtherType { - if obj.obj.EtherType == nil { - obj.obj.EtherType = NewPatternFlowEthernetPauseEtherType().msg() - } - if obj.etherTypeHolder == nil { - obj.etherTypeHolder = &patternFlowEthernetPauseEtherType{obj: obj.obj.EtherType} - } - return obj.etherTypeHolder -} - -// description is TBD -// EtherType returns a PatternFlowEthernetPauseEtherType -func (obj *flowEthernetPause) HasEtherType() bool { - return obj.obj.EtherType != nil -} - -// description is TBD -// SetEtherType sets the PatternFlowEthernetPauseEtherType value in the FlowEthernetPause object -func (obj *flowEthernetPause) SetEtherType(value PatternFlowEthernetPauseEtherType) FlowEthernetPause { - - obj.etherTypeHolder = nil - obj.obj.EtherType = value.msg() - - return obj -} - -// description is TBD -// ControlOpCode returns a PatternFlowEthernetPauseControlOpCode -func (obj *flowEthernetPause) ControlOpCode() PatternFlowEthernetPauseControlOpCode { - if obj.obj.ControlOpCode == nil { - obj.obj.ControlOpCode = NewPatternFlowEthernetPauseControlOpCode().msg() - } - if obj.controlOpCodeHolder == nil { - obj.controlOpCodeHolder = &patternFlowEthernetPauseControlOpCode{obj: obj.obj.ControlOpCode} - } - return obj.controlOpCodeHolder -} - -// description is TBD -// ControlOpCode returns a PatternFlowEthernetPauseControlOpCode -func (obj *flowEthernetPause) HasControlOpCode() bool { - return obj.obj.ControlOpCode != nil -} - -// description is TBD -// SetControlOpCode sets the PatternFlowEthernetPauseControlOpCode value in the FlowEthernetPause object -func (obj *flowEthernetPause) SetControlOpCode(value PatternFlowEthernetPauseControlOpCode) FlowEthernetPause { - - obj.controlOpCodeHolder = nil - obj.obj.ControlOpCode = value.msg() - - return obj -} - -// description is TBD -// Time returns a PatternFlowEthernetPauseTime -func (obj *flowEthernetPause) Time() PatternFlowEthernetPauseTime { - if obj.obj.Time == nil { - obj.obj.Time = NewPatternFlowEthernetPauseTime().msg() - } - if obj.timeHolder == nil { - obj.timeHolder = &patternFlowEthernetPauseTime{obj: obj.obj.Time} - } - return obj.timeHolder -} - -// description is TBD -// Time returns a PatternFlowEthernetPauseTime -func (obj *flowEthernetPause) HasTime() bool { - return obj.obj.Time != nil -} - -// description is TBD -// SetTime sets the PatternFlowEthernetPauseTime value in the FlowEthernetPause object -func (obj *flowEthernetPause) SetTime(value PatternFlowEthernetPauseTime) FlowEthernetPause { - - obj.timeHolder = nil - obj.obj.Time = value.msg() - - return obj -} - -func (obj *flowEthernetPause) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Dst != nil { - - obj.Dst().validateObj(vObj, set_default) - } - - if obj.obj.Src != nil { - - obj.Src().validateObj(vObj, set_default) - } - - if obj.obj.EtherType != nil { - - obj.EtherType().validateObj(vObj, set_default) - } - - if obj.obj.ControlOpCode != nil { - - obj.ControlOpCode().validateObj(vObj, set_default) - } - - if obj.obj.Time != nil { - - obj.Time().validateObj(vObj, set_default) - } - -} - -func (obj *flowEthernetPause) setDefault() { - -} - -// ***** FlowTcp ***** -type flowTcp struct { - validation - obj *otg.FlowTcp - marshaller marshalFlowTcp - unMarshaller unMarshalFlowTcp - srcPortHolder PatternFlowTcpSrcPort - dstPortHolder PatternFlowTcpDstPort - seqNumHolder PatternFlowTcpSeqNum - ackNumHolder PatternFlowTcpAckNum - dataOffsetHolder PatternFlowTcpDataOffset - ecnNsHolder PatternFlowTcpEcnNs - ecnCwrHolder PatternFlowTcpEcnCwr - ecnEchoHolder PatternFlowTcpEcnEcho - ctlUrgHolder PatternFlowTcpCtlUrg - ctlAckHolder PatternFlowTcpCtlAck - ctlPshHolder PatternFlowTcpCtlPsh - ctlRstHolder PatternFlowTcpCtlRst - ctlSynHolder PatternFlowTcpCtlSyn - ctlFinHolder PatternFlowTcpCtlFin - windowHolder PatternFlowTcpWindow - checksumHolder PatternFlowTcpChecksum -} - -func NewFlowTcp() FlowTcp { - obj := flowTcp{obj: &otg.FlowTcp{}} - obj.setDefault() - return &obj -} - -func (obj *flowTcp) msg() *otg.FlowTcp { - return obj.obj -} - -func (obj *flowTcp) setMsg(msg *otg.FlowTcp) FlowTcp { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowTcp struct { - obj *flowTcp -} - -type marshalFlowTcp interface { - // ToProto marshals FlowTcp to protobuf object *otg.FlowTcp - ToProto() (*otg.FlowTcp, error) - // ToPbText marshals FlowTcp to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowTcp to YAML text - ToYaml() (string, error) - // ToJson marshals FlowTcp to JSON text - ToJson() (string, error) -} - -type unMarshalflowTcp struct { - obj *flowTcp -} - -type unMarshalFlowTcp interface { - // FromProto unmarshals FlowTcp from protobuf object *otg.FlowTcp - FromProto(msg *otg.FlowTcp) (FlowTcp, error) - // FromPbText unmarshals FlowTcp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowTcp from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowTcp from JSON text - FromJson(value string) error -} - -func (obj *flowTcp) Marshal() marshalFlowTcp { - if obj.marshaller == nil { - obj.marshaller = &marshalflowTcp{obj: obj} - } - return obj.marshaller -} - -func (obj *flowTcp) Unmarshal() unMarshalFlowTcp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowTcp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowTcp) ToProto() (*otg.FlowTcp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowTcp) FromProto(msg *otg.FlowTcp) (FlowTcp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowTcp) 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 *unMarshalflowTcp) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowTcp) 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 *unMarshalflowTcp) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowTcp) 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 *unMarshalflowTcp) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowTcp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowTcp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowTcp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowTcp) Clone() (FlowTcp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowTcp() - 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 -} - -func (obj *flowTcp) setNil() { - obj.srcPortHolder = nil - obj.dstPortHolder = nil - obj.seqNumHolder = nil - obj.ackNumHolder = nil - obj.dataOffsetHolder = nil - obj.ecnNsHolder = nil - obj.ecnCwrHolder = nil - obj.ecnEchoHolder = nil - obj.ctlUrgHolder = nil - obj.ctlAckHolder = nil - obj.ctlPshHolder = nil - obj.ctlRstHolder = nil - obj.ctlSynHolder = nil - obj.ctlFinHolder = nil - obj.windowHolder = nil - obj.checksumHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowTcp is tCP packet header -type FlowTcp interface { - Validation - // msg marshals FlowTcp to protobuf object *otg.FlowTcp - // and doesn't set defaults - msg() *otg.FlowTcp - // setMsg unmarshals FlowTcp from protobuf object *otg.FlowTcp - // and doesn't set defaults - setMsg(*otg.FlowTcp) FlowTcp - // provides marshal interface - Marshal() marshalFlowTcp - // provides unmarshal interface - Unmarshal() unMarshalFlowTcp - // validate validates FlowTcp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowTcp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // SrcPort returns PatternFlowTcpSrcPort, set in FlowTcp. - // PatternFlowTcpSrcPort is source port - SrcPort() PatternFlowTcpSrcPort - // SetSrcPort assigns PatternFlowTcpSrcPort provided by user to FlowTcp. - // PatternFlowTcpSrcPort is source port - SetSrcPort(value PatternFlowTcpSrcPort) FlowTcp - // HasSrcPort checks if SrcPort has been set in FlowTcp - HasSrcPort() bool - // DstPort returns PatternFlowTcpDstPort, set in FlowTcp. - // PatternFlowTcpDstPort is destination port - DstPort() PatternFlowTcpDstPort - // SetDstPort assigns PatternFlowTcpDstPort provided by user to FlowTcp. - // PatternFlowTcpDstPort is destination port - SetDstPort(value PatternFlowTcpDstPort) FlowTcp - // HasDstPort checks if DstPort has been set in FlowTcp - HasDstPort() bool - // SeqNum returns PatternFlowTcpSeqNum, set in FlowTcp. - // PatternFlowTcpSeqNum is sequence number - SeqNum() PatternFlowTcpSeqNum - // SetSeqNum assigns PatternFlowTcpSeqNum provided by user to FlowTcp. - // PatternFlowTcpSeqNum is sequence number - SetSeqNum(value PatternFlowTcpSeqNum) FlowTcp - // HasSeqNum checks if SeqNum has been set in FlowTcp - HasSeqNum() bool - // AckNum returns PatternFlowTcpAckNum, set in FlowTcp. - // PatternFlowTcpAckNum is acknowledgement number - AckNum() PatternFlowTcpAckNum - // SetAckNum assigns PatternFlowTcpAckNum provided by user to FlowTcp. - // PatternFlowTcpAckNum is acknowledgement number - SetAckNum(value PatternFlowTcpAckNum) FlowTcp - // HasAckNum checks if AckNum has been set in FlowTcp - HasAckNum() bool - // DataOffset returns PatternFlowTcpDataOffset, set in FlowTcp. - // PatternFlowTcpDataOffset is the number of 32 bit words in the TCP header. This indicates where the data begins. - DataOffset() PatternFlowTcpDataOffset - // SetDataOffset assigns PatternFlowTcpDataOffset provided by user to FlowTcp. - // PatternFlowTcpDataOffset is the number of 32 bit words in the TCP header. This indicates where the data begins. - SetDataOffset(value PatternFlowTcpDataOffset) FlowTcp - // HasDataOffset checks if DataOffset has been set in FlowTcp - HasDataOffset() bool - // EcnNs returns PatternFlowTcpEcnNs, set in FlowTcp. - // PatternFlowTcpEcnNs is explicit congestion notification, concealment protection. - EcnNs() PatternFlowTcpEcnNs - // SetEcnNs assigns PatternFlowTcpEcnNs provided by user to FlowTcp. - // PatternFlowTcpEcnNs is explicit congestion notification, concealment protection. - SetEcnNs(value PatternFlowTcpEcnNs) FlowTcp - // HasEcnNs checks if EcnNs has been set in FlowTcp - HasEcnNs() bool - // EcnCwr returns PatternFlowTcpEcnCwr, set in FlowTcp. - // PatternFlowTcpEcnCwr is explicit congestion notification, congestion window reduced. - EcnCwr() PatternFlowTcpEcnCwr - // SetEcnCwr assigns PatternFlowTcpEcnCwr provided by user to FlowTcp. - // PatternFlowTcpEcnCwr is explicit congestion notification, congestion window reduced. - SetEcnCwr(value PatternFlowTcpEcnCwr) FlowTcp - // HasEcnCwr checks if EcnCwr has been set in FlowTcp - HasEcnCwr() bool - // EcnEcho returns PatternFlowTcpEcnEcho, set in FlowTcp. - // PatternFlowTcpEcnEcho is explicit congestion notification, echo. 1 indicates the peer is ecn capable. 0 indicates that a packet with ipv4.ecn = 11 in the ip header was received during normal transmission. - EcnEcho() PatternFlowTcpEcnEcho - // SetEcnEcho assigns PatternFlowTcpEcnEcho provided by user to FlowTcp. - // PatternFlowTcpEcnEcho is explicit congestion notification, echo. 1 indicates the peer is ecn capable. 0 indicates that a packet with ipv4.ecn = 11 in the ip header was received during normal transmission. - SetEcnEcho(value PatternFlowTcpEcnEcho) FlowTcp - // HasEcnEcho checks if EcnEcho has been set in FlowTcp - HasEcnEcho() bool - // CtlUrg returns PatternFlowTcpCtlUrg, set in FlowTcp. - // PatternFlowTcpCtlUrg is a value of 1 indicates that the urgent pointer field is significant. - CtlUrg() PatternFlowTcpCtlUrg - // SetCtlUrg assigns PatternFlowTcpCtlUrg provided by user to FlowTcp. - // PatternFlowTcpCtlUrg is a value of 1 indicates that the urgent pointer field is significant. - SetCtlUrg(value PatternFlowTcpCtlUrg) FlowTcp - // HasCtlUrg checks if CtlUrg has been set in FlowTcp - HasCtlUrg() bool - // CtlAck returns PatternFlowTcpCtlAck, set in FlowTcp. - // PatternFlowTcpCtlAck is a value of 1 indicates that the ackknowledgment field is significant. - CtlAck() PatternFlowTcpCtlAck - // SetCtlAck assigns PatternFlowTcpCtlAck provided by user to FlowTcp. - // PatternFlowTcpCtlAck is a value of 1 indicates that the ackknowledgment field is significant. - SetCtlAck(value PatternFlowTcpCtlAck) FlowTcp - // HasCtlAck checks if CtlAck has been set in FlowTcp - HasCtlAck() bool - // CtlPsh returns PatternFlowTcpCtlPsh, set in FlowTcp. - // PatternFlowTcpCtlPsh is asks to push the buffered data to the receiving application. - CtlPsh() PatternFlowTcpCtlPsh - // SetCtlPsh assigns PatternFlowTcpCtlPsh provided by user to FlowTcp. - // PatternFlowTcpCtlPsh is asks to push the buffered data to the receiving application. - SetCtlPsh(value PatternFlowTcpCtlPsh) FlowTcp - // HasCtlPsh checks if CtlPsh has been set in FlowTcp - HasCtlPsh() bool - // CtlRst returns PatternFlowTcpCtlRst, set in FlowTcp. - // PatternFlowTcpCtlRst is reset the connection. - CtlRst() PatternFlowTcpCtlRst - // SetCtlRst assigns PatternFlowTcpCtlRst provided by user to FlowTcp. - // PatternFlowTcpCtlRst is reset the connection. - SetCtlRst(value PatternFlowTcpCtlRst) FlowTcp - // HasCtlRst checks if CtlRst has been set in FlowTcp - HasCtlRst() bool - // CtlSyn returns PatternFlowTcpCtlSyn, set in FlowTcp. - // PatternFlowTcpCtlSyn is synchronize sequenece numbers. - CtlSyn() PatternFlowTcpCtlSyn - // SetCtlSyn assigns PatternFlowTcpCtlSyn provided by user to FlowTcp. - // PatternFlowTcpCtlSyn is synchronize sequenece numbers. - SetCtlSyn(value PatternFlowTcpCtlSyn) FlowTcp - // HasCtlSyn checks if CtlSyn has been set in FlowTcp - HasCtlSyn() bool - // CtlFin returns PatternFlowTcpCtlFin, set in FlowTcp. - // PatternFlowTcpCtlFin is last packet from the sender. - CtlFin() PatternFlowTcpCtlFin - // SetCtlFin assigns PatternFlowTcpCtlFin provided by user to FlowTcp. - // PatternFlowTcpCtlFin is last packet from the sender. - SetCtlFin(value PatternFlowTcpCtlFin) FlowTcp - // HasCtlFin checks if CtlFin has been set in FlowTcp - HasCtlFin() bool - // Window returns PatternFlowTcpWindow, set in FlowTcp. - // PatternFlowTcpWindow is tcp connection window. - Window() PatternFlowTcpWindow - // SetWindow assigns PatternFlowTcpWindow provided by user to FlowTcp. - // PatternFlowTcpWindow is tcp connection window. - SetWindow(value PatternFlowTcpWindow) FlowTcp - // HasWindow checks if Window has been set in FlowTcp - HasWindow() bool - // Checksum returns PatternFlowTcpChecksum, set in FlowTcp. - // PatternFlowTcpChecksum is the one's complement of the one's complement sum of all 16 bit words in header and text. An all-zero value means that no checksum will be transmitted. While computing the checksum, the checksum field itself is replaced with zeros. - Checksum() PatternFlowTcpChecksum - // SetChecksum assigns PatternFlowTcpChecksum provided by user to FlowTcp. - // PatternFlowTcpChecksum is the one's complement of the one's complement sum of all 16 bit words in header and text. An all-zero value means that no checksum will be transmitted. While computing the checksum, the checksum field itself is replaced with zeros. - SetChecksum(value PatternFlowTcpChecksum) FlowTcp - // HasChecksum checks if Checksum has been set in FlowTcp - HasChecksum() bool - setNil() -} - -// description is TBD -// SrcPort returns a PatternFlowTcpSrcPort -func (obj *flowTcp) SrcPort() PatternFlowTcpSrcPort { - if obj.obj.SrcPort == nil { - obj.obj.SrcPort = NewPatternFlowTcpSrcPort().msg() - } - if obj.srcPortHolder == nil { - obj.srcPortHolder = &patternFlowTcpSrcPort{obj: obj.obj.SrcPort} - } - return obj.srcPortHolder -} - -// description is TBD -// SrcPort returns a PatternFlowTcpSrcPort -func (obj *flowTcp) HasSrcPort() bool { - return obj.obj.SrcPort != nil -} - -// description is TBD -// SetSrcPort sets the PatternFlowTcpSrcPort value in the FlowTcp object -func (obj *flowTcp) SetSrcPort(value PatternFlowTcpSrcPort) FlowTcp { - - obj.srcPortHolder = nil - obj.obj.SrcPort = value.msg() - - return obj -} - -// description is TBD -// DstPort returns a PatternFlowTcpDstPort -func (obj *flowTcp) DstPort() PatternFlowTcpDstPort { - if obj.obj.DstPort == nil { - obj.obj.DstPort = NewPatternFlowTcpDstPort().msg() - } - if obj.dstPortHolder == nil { - obj.dstPortHolder = &patternFlowTcpDstPort{obj: obj.obj.DstPort} - } - return obj.dstPortHolder -} - -// description is TBD -// DstPort returns a PatternFlowTcpDstPort -func (obj *flowTcp) HasDstPort() bool { - return obj.obj.DstPort != nil -} - -// description is TBD -// SetDstPort sets the PatternFlowTcpDstPort value in the FlowTcp object -func (obj *flowTcp) SetDstPort(value PatternFlowTcpDstPort) FlowTcp { - - obj.dstPortHolder = nil - obj.obj.DstPort = value.msg() - - return obj -} - -// description is TBD -// SeqNum returns a PatternFlowTcpSeqNum -func (obj *flowTcp) SeqNum() PatternFlowTcpSeqNum { - if obj.obj.SeqNum == nil { - obj.obj.SeqNum = NewPatternFlowTcpSeqNum().msg() - } - if obj.seqNumHolder == nil { - obj.seqNumHolder = &patternFlowTcpSeqNum{obj: obj.obj.SeqNum} - } - return obj.seqNumHolder -} - -// description is TBD -// SeqNum returns a PatternFlowTcpSeqNum -func (obj *flowTcp) HasSeqNum() bool { - return obj.obj.SeqNum != nil -} - -// description is TBD -// SetSeqNum sets the PatternFlowTcpSeqNum value in the FlowTcp object -func (obj *flowTcp) SetSeqNum(value PatternFlowTcpSeqNum) FlowTcp { - - obj.seqNumHolder = nil - obj.obj.SeqNum = value.msg() - - return obj -} - -// description is TBD -// AckNum returns a PatternFlowTcpAckNum -func (obj *flowTcp) AckNum() PatternFlowTcpAckNum { - if obj.obj.AckNum == nil { - obj.obj.AckNum = NewPatternFlowTcpAckNum().msg() - } - if obj.ackNumHolder == nil { - obj.ackNumHolder = &patternFlowTcpAckNum{obj: obj.obj.AckNum} - } - return obj.ackNumHolder -} - -// description is TBD -// AckNum returns a PatternFlowTcpAckNum -func (obj *flowTcp) HasAckNum() bool { - return obj.obj.AckNum != nil -} - -// description is TBD -// SetAckNum sets the PatternFlowTcpAckNum value in the FlowTcp object -func (obj *flowTcp) SetAckNum(value PatternFlowTcpAckNum) FlowTcp { - - obj.ackNumHolder = nil - obj.obj.AckNum = value.msg() - - return obj -} - -// description is TBD -// DataOffset returns a PatternFlowTcpDataOffset -func (obj *flowTcp) DataOffset() PatternFlowTcpDataOffset { - if obj.obj.DataOffset == nil { - obj.obj.DataOffset = NewPatternFlowTcpDataOffset().msg() - } - if obj.dataOffsetHolder == nil { - obj.dataOffsetHolder = &patternFlowTcpDataOffset{obj: obj.obj.DataOffset} - } - return obj.dataOffsetHolder -} - -// description is TBD -// DataOffset returns a PatternFlowTcpDataOffset -func (obj *flowTcp) HasDataOffset() bool { - return obj.obj.DataOffset != nil -} - -// description is TBD -// SetDataOffset sets the PatternFlowTcpDataOffset value in the FlowTcp object -func (obj *flowTcp) SetDataOffset(value PatternFlowTcpDataOffset) FlowTcp { - - obj.dataOffsetHolder = nil - obj.obj.DataOffset = value.msg() - - return obj -} - -// description is TBD -// EcnNs returns a PatternFlowTcpEcnNs -func (obj *flowTcp) EcnNs() PatternFlowTcpEcnNs { - if obj.obj.EcnNs == nil { - obj.obj.EcnNs = NewPatternFlowTcpEcnNs().msg() - } - if obj.ecnNsHolder == nil { - obj.ecnNsHolder = &patternFlowTcpEcnNs{obj: obj.obj.EcnNs} - } - return obj.ecnNsHolder -} - -// description is TBD -// EcnNs returns a PatternFlowTcpEcnNs -func (obj *flowTcp) HasEcnNs() bool { - return obj.obj.EcnNs != nil -} - -// description is TBD -// SetEcnNs sets the PatternFlowTcpEcnNs value in the FlowTcp object -func (obj *flowTcp) SetEcnNs(value PatternFlowTcpEcnNs) FlowTcp { - - obj.ecnNsHolder = nil - obj.obj.EcnNs = value.msg() - - return obj -} - -// description is TBD -// EcnCwr returns a PatternFlowTcpEcnCwr -func (obj *flowTcp) EcnCwr() PatternFlowTcpEcnCwr { - if obj.obj.EcnCwr == nil { - obj.obj.EcnCwr = NewPatternFlowTcpEcnCwr().msg() - } - if obj.ecnCwrHolder == nil { - obj.ecnCwrHolder = &patternFlowTcpEcnCwr{obj: obj.obj.EcnCwr} - } - return obj.ecnCwrHolder -} - -// description is TBD -// EcnCwr returns a PatternFlowTcpEcnCwr -func (obj *flowTcp) HasEcnCwr() bool { - return obj.obj.EcnCwr != nil -} - -// description is TBD -// SetEcnCwr sets the PatternFlowTcpEcnCwr value in the FlowTcp object -func (obj *flowTcp) SetEcnCwr(value PatternFlowTcpEcnCwr) FlowTcp { - - obj.ecnCwrHolder = nil - obj.obj.EcnCwr = value.msg() - - return obj -} - -// description is TBD -// EcnEcho returns a PatternFlowTcpEcnEcho -func (obj *flowTcp) EcnEcho() PatternFlowTcpEcnEcho { - if obj.obj.EcnEcho == nil { - obj.obj.EcnEcho = NewPatternFlowTcpEcnEcho().msg() - } - if obj.ecnEchoHolder == nil { - obj.ecnEchoHolder = &patternFlowTcpEcnEcho{obj: obj.obj.EcnEcho} - } - return obj.ecnEchoHolder -} - -// description is TBD -// EcnEcho returns a PatternFlowTcpEcnEcho -func (obj *flowTcp) HasEcnEcho() bool { - return obj.obj.EcnEcho != nil -} - -// description is TBD -// SetEcnEcho sets the PatternFlowTcpEcnEcho value in the FlowTcp object -func (obj *flowTcp) SetEcnEcho(value PatternFlowTcpEcnEcho) FlowTcp { - - obj.ecnEchoHolder = nil - obj.obj.EcnEcho = value.msg() - - return obj -} - -// description is TBD -// CtlUrg returns a PatternFlowTcpCtlUrg -func (obj *flowTcp) CtlUrg() PatternFlowTcpCtlUrg { - if obj.obj.CtlUrg == nil { - obj.obj.CtlUrg = NewPatternFlowTcpCtlUrg().msg() - } - if obj.ctlUrgHolder == nil { - obj.ctlUrgHolder = &patternFlowTcpCtlUrg{obj: obj.obj.CtlUrg} - } - return obj.ctlUrgHolder -} - -// description is TBD -// CtlUrg returns a PatternFlowTcpCtlUrg -func (obj *flowTcp) HasCtlUrg() bool { - return obj.obj.CtlUrg != nil -} - -// description is TBD -// SetCtlUrg sets the PatternFlowTcpCtlUrg value in the FlowTcp object -func (obj *flowTcp) SetCtlUrg(value PatternFlowTcpCtlUrg) FlowTcp { - - obj.ctlUrgHolder = nil - obj.obj.CtlUrg = value.msg() - - return obj -} - -// description is TBD -// CtlAck returns a PatternFlowTcpCtlAck -func (obj *flowTcp) CtlAck() PatternFlowTcpCtlAck { - if obj.obj.CtlAck == nil { - obj.obj.CtlAck = NewPatternFlowTcpCtlAck().msg() - } - if obj.ctlAckHolder == nil { - obj.ctlAckHolder = &patternFlowTcpCtlAck{obj: obj.obj.CtlAck} - } - return obj.ctlAckHolder -} - -// description is TBD -// CtlAck returns a PatternFlowTcpCtlAck -func (obj *flowTcp) HasCtlAck() bool { - return obj.obj.CtlAck != nil -} - -// description is TBD -// SetCtlAck sets the PatternFlowTcpCtlAck value in the FlowTcp object -func (obj *flowTcp) SetCtlAck(value PatternFlowTcpCtlAck) FlowTcp { - - obj.ctlAckHolder = nil - obj.obj.CtlAck = value.msg() - - return obj -} - -// description is TBD -// CtlPsh returns a PatternFlowTcpCtlPsh -func (obj *flowTcp) CtlPsh() PatternFlowTcpCtlPsh { - if obj.obj.CtlPsh == nil { - obj.obj.CtlPsh = NewPatternFlowTcpCtlPsh().msg() - } - if obj.ctlPshHolder == nil { - obj.ctlPshHolder = &patternFlowTcpCtlPsh{obj: obj.obj.CtlPsh} - } - return obj.ctlPshHolder -} - -// description is TBD -// CtlPsh returns a PatternFlowTcpCtlPsh -func (obj *flowTcp) HasCtlPsh() bool { - return obj.obj.CtlPsh != nil -} - -// description is TBD -// SetCtlPsh sets the PatternFlowTcpCtlPsh value in the FlowTcp object -func (obj *flowTcp) SetCtlPsh(value PatternFlowTcpCtlPsh) FlowTcp { - - obj.ctlPshHolder = nil - obj.obj.CtlPsh = value.msg() - - return obj -} - -// description is TBD -// CtlRst returns a PatternFlowTcpCtlRst -func (obj *flowTcp) CtlRst() PatternFlowTcpCtlRst { - if obj.obj.CtlRst == nil { - obj.obj.CtlRst = NewPatternFlowTcpCtlRst().msg() - } - if obj.ctlRstHolder == nil { - obj.ctlRstHolder = &patternFlowTcpCtlRst{obj: obj.obj.CtlRst} - } - return obj.ctlRstHolder -} - -// description is TBD -// CtlRst returns a PatternFlowTcpCtlRst -func (obj *flowTcp) HasCtlRst() bool { - return obj.obj.CtlRst != nil -} - -// description is TBD -// SetCtlRst sets the PatternFlowTcpCtlRst value in the FlowTcp object -func (obj *flowTcp) SetCtlRst(value PatternFlowTcpCtlRst) FlowTcp { - - obj.ctlRstHolder = nil - obj.obj.CtlRst = value.msg() - - return obj -} - -// description is TBD -// CtlSyn returns a PatternFlowTcpCtlSyn -func (obj *flowTcp) CtlSyn() PatternFlowTcpCtlSyn { - if obj.obj.CtlSyn == nil { - obj.obj.CtlSyn = NewPatternFlowTcpCtlSyn().msg() - } - if obj.ctlSynHolder == nil { - obj.ctlSynHolder = &patternFlowTcpCtlSyn{obj: obj.obj.CtlSyn} - } - return obj.ctlSynHolder -} - -// description is TBD -// CtlSyn returns a PatternFlowTcpCtlSyn -func (obj *flowTcp) HasCtlSyn() bool { - return obj.obj.CtlSyn != nil -} - -// description is TBD -// SetCtlSyn sets the PatternFlowTcpCtlSyn value in the FlowTcp object -func (obj *flowTcp) SetCtlSyn(value PatternFlowTcpCtlSyn) FlowTcp { - - obj.ctlSynHolder = nil - obj.obj.CtlSyn = value.msg() - - return obj -} - -// description is TBD -// CtlFin returns a PatternFlowTcpCtlFin -func (obj *flowTcp) CtlFin() PatternFlowTcpCtlFin { - if obj.obj.CtlFin == nil { - obj.obj.CtlFin = NewPatternFlowTcpCtlFin().msg() - } - if obj.ctlFinHolder == nil { - obj.ctlFinHolder = &patternFlowTcpCtlFin{obj: obj.obj.CtlFin} - } - return obj.ctlFinHolder -} - -// description is TBD -// CtlFin returns a PatternFlowTcpCtlFin -func (obj *flowTcp) HasCtlFin() bool { - return obj.obj.CtlFin != nil -} - -// description is TBD -// SetCtlFin sets the PatternFlowTcpCtlFin value in the FlowTcp object -func (obj *flowTcp) SetCtlFin(value PatternFlowTcpCtlFin) FlowTcp { - - obj.ctlFinHolder = nil - obj.obj.CtlFin = value.msg() - - return obj -} - -// description is TBD -// Window returns a PatternFlowTcpWindow -func (obj *flowTcp) Window() PatternFlowTcpWindow { - if obj.obj.Window == nil { - obj.obj.Window = NewPatternFlowTcpWindow().msg() - } - if obj.windowHolder == nil { - obj.windowHolder = &patternFlowTcpWindow{obj: obj.obj.Window} - } - return obj.windowHolder -} - -// description is TBD -// Window returns a PatternFlowTcpWindow -func (obj *flowTcp) HasWindow() bool { - return obj.obj.Window != nil -} - -// description is TBD -// SetWindow sets the PatternFlowTcpWindow value in the FlowTcp object -func (obj *flowTcp) SetWindow(value PatternFlowTcpWindow) FlowTcp { - - obj.windowHolder = nil - obj.obj.Window = value.msg() - - return obj -} - -// description is TBD -// Checksum returns a PatternFlowTcpChecksum -func (obj *flowTcp) Checksum() PatternFlowTcpChecksum { - if obj.obj.Checksum == nil { - obj.obj.Checksum = NewPatternFlowTcpChecksum().msg() - } - if obj.checksumHolder == nil { - obj.checksumHolder = &patternFlowTcpChecksum{obj: obj.obj.Checksum} - } - return obj.checksumHolder -} - -// description is TBD -// Checksum returns a PatternFlowTcpChecksum -func (obj *flowTcp) HasChecksum() bool { - return obj.obj.Checksum != nil -} - -// description is TBD -// SetChecksum sets the PatternFlowTcpChecksum value in the FlowTcp object -func (obj *flowTcp) SetChecksum(value PatternFlowTcpChecksum) FlowTcp { - - obj.checksumHolder = nil - obj.obj.Checksum = value.msg() - - return obj -} - -func (obj *flowTcp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.SrcPort != nil { - - obj.SrcPort().validateObj(vObj, set_default) - } - - if obj.obj.DstPort != nil { - - obj.DstPort().validateObj(vObj, set_default) - } - - if obj.obj.SeqNum != nil { - - obj.SeqNum().validateObj(vObj, set_default) - } - - if obj.obj.AckNum != nil { - - obj.AckNum().validateObj(vObj, set_default) - } - - if obj.obj.DataOffset != nil { - - obj.DataOffset().validateObj(vObj, set_default) - } - - if obj.obj.EcnNs != nil { - - obj.EcnNs().validateObj(vObj, set_default) - } - - if obj.obj.EcnCwr != nil { - - obj.EcnCwr().validateObj(vObj, set_default) - } - - if obj.obj.EcnEcho != nil { - - obj.EcnEcho().validateObj(vObj, set_default) - } - - if obj.obj.CtlUrg != nil { - - obj.CtlUrg().validateObj(vObj, set_default) - } - - if obj.obj.CtlAck != nil { - - obj.CtlAck().validateObj(vObj, set_default) - } - - if obj.obj.CtlPsh != nil { - - obj.CtlPsh().validateObj(vObj, set_default) - } - - if obj.obj.CtlRst != nil { - - obj.CtlRst().validateObj(vObj, set_default) - } - - if obj.obj.CtlSyn != nil { - - obj.CtlSyn().validateObj(vObj, set_default) - } - - if obj.obj.CtlFin != nil { - - obj.CtlFin().validateObj(vObj, set_default) - } - - if obj.obj.Window != nil { - - obj.Window().validateObj(vObj, set_default) - } - - if obj.obj.Checksum != nil { - - obj.Checksum().validateObj(vObj, set_default) - } - -} - -func (obj *flowTcp) setDefault() { - -} - -// ***** FlowUdp ***** -type flowUdp struct { - validation - obj *otg.FlowUdp - marshaller marshalFlowUdp - unMarshaller unMarshalFlowUdp - srcPortHolder PatternFlowUdpSrcPort - dstPortHolder PatternFlowUdpDstPort - lengthHolder PatternFlowUdpLength - checksumHolder PatternFlowUdpChecksum -} - -func NewFlowUdp() FlowUdp { - obj := flowUdp{obj: &otg.FlowUdp{}} - obj.setDefault() - return &obj -} - -func (obj *flowUdp) msg() *otg.FlowUdp { - return obj.obj -} - -func (obj *flowUdp) setMsg(msg *otg.FlowUdp) FlowUdp { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowUdp struct { - obj *flowUdp -} - -type marshalFlowUdp interface { - // ToProto marshals FlowUdp to protobuf object *otg.FlowUdp - ToProto() (*otg.FlowUdp, error) - // ToPbText marshals FlowUdp to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowUdp to YAML text - ToYaml() (string, error) - // ToJson marshals FlowUdp to JSON text - ToJson() (string, error) -} - -type unMarshalflowUdp struct { - obj *flowUdp -} - -type unMarshalFlowUdp interface { - // FromProto unmarshals FlowUdp from protobuf object *otg.FlowUdp - FromProto(msg *otg.FlowUdp) (FlowUdp, error) - // FromPbText unmarshals FlowUdp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowUdp from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowUdp from JSON text - FromJson(value string) error -} - -func (obj *flowUdp) Marshal() marshalFlowUdp { - if obj.marshaller == nil { - obj.marshaller = &marshalflowUdp{obj: obj} - } - return obj.marshaller -} - -func (obj *flowUdp) Unmarshal() unMarshalFlowUdp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowUdp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowUdp) ToProto() (*otg.FlowUdp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowUdp) FromProto(msg *otg.FlowUdp) (FlowUdp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowUdp) 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 *unMarshalflowUdp) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowUdp) 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 *unMarshalflowUdp) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowUdp) 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 *unMarshalflowUdp) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowUdp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowUdp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowUdp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowUdp) Clone() (FlowUdp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowUdp() - 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 -} - -func (obj *flowUdp) setNil() { - obj.srcPortHolder = nil - obj.dstPortHolder = nil - obj.lengthHolder = nil - obj.checksumHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowUdp is uDP packet header -type FlowUdp interface { - Validation - // msg marshals FlowUdp to protobuf object *otg.FlowUdp - // and doesn't set defaults - msg() *otg.FlowUdp - // setMsg unmarshals FlowUdp from protobuf object *otg.FlowUdp - // and doesn't set defaults - setMsg(*otg.FlowUdp) FlowUdp - // provides marshal interface - Marshal() marshalFlowUdp - // provides unmarshal interface - Unmarshal() unMarshalFlowUdp - // validate validates FlowUdp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowUdp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // SrcPort returns PatternFlowUdpSrcPort, set in FlowUdp. - // PatternFlowUdpSrcPort is source port - SrcPort() PatternFlowUdpSrcPort - // SetSrcPort assigns PatternFlowUdpSrcPort provided by user to FlowUdp. - // PatternFlowUdpSrcPort is source port - SetSrcPort(value PatternFlowUdpSrcPort) FlowUdp - // HasSrcPort checks if SrcPort has been set in FlowUdp - HasSrcPort() bool - // DstPort returns PatternFlowUdpDstPort, set in FlowUdp. - // PatternFlowUdpDstPort is destination port - DstPort() PatternFlowUdpDstPort - // SetDstPort assigns PatternFlowUdpDstPort provided by user to FlowUdp. - // PatternFlowUdpDstPort is destination port - SetDstPort(value PatternFlowUdpDstPort) FlowUdp - // HasDstPort checks if DstPort has been set in FlowUdp - HasDstPort() bool - // Length returns PatternFlowUdpLength, set in FlowUdp. - // PatternFlowUdpLength is length - Length() PatternFlowUdpLength - // SetLength assigns PatternFlowUdpLength provided by user to FlowUdp. - // PatternFlowUdpLength is length - SetLength(value PatternFlowUdpLength) FlowUdp - // HasLength checks if Length has been set in FlowUdp - HasLength() bool - // Checksum returns PatternFlowUdpChecksum, set in FlowUdp. - // PatternFlowUdpChecksum is uDP checksum - Checksum() PatternFlowUdpChecksum - // SetChecksum assigns PatternFlowUdpChecksum provided by user to FlowUdp. - // PatternFlowUdpChecksum is uDP checksum - SetChecksum(value PatternFlowUdpChecksum) FlowUdp - // HasChecksum checks if Checksum has been set in FlowUdp - HasChecksum() bool - setNil() -} - -// description is TBD -// SrcPort returns a PatternFlowUdpSrcPort -func (obj *flowUdp) SrcPort() PatternFlowUdpSrcPort { - if obj.obj.SrcPort == nil { - obj.obj.SrcPort = NewPatternFlowUdpSrcPort().msg() - } - if obj.srcPortHolder == nil { - obj.srcPortHolder = &patternFlowUdpSrcPort{obj: obj.obj.SrcPort} - } - return obj.srcPortHolder -} - -// description is TBD -// SrcPort returns a PatternFlowUdpSrcPort -func (obj *flowUdp) HasSrcPort() bool { - return obj.obj.SrcPort != nil -} - -// description is TBD -// SetSrcPort sets the PatternFlowUdpSrcPort value in the FlowUdp object -func (obj *flowUdp) SetSrcPort(value PatternFlowUdpSrcPort) FlowUdp { - - obj.srcPortHolder = nil - obj.obj.SrcPort = value.msg() - - return obj -} - -// description is TBD -// DstPort returns a PatternFlowUdpDstPort -func (obj *flowUdp) DstPort() PatternFlowUdpDstPort { - if obj.obj.DstPort == nil { - obj.obj.DstPort = NewPatternFlowUdpDstPort().msg() - } - if obj.dstPortHolder == nil { - obj.dstPortHolder = &patternFlowUdpDstPort{obj: obj.obj.DstPort} - } - return obj.dstPortHolder -} - -// description is TBD -// DstPort returns a PatternFlowUdpDstPort -func (obj *flowUdp) HasDstPort() bool { - return obj.obj.DstPort != nil -} - -// description is TBD -// SetDstPort sets the PatternFlowUdpDstPort value in the FlowUdp object -func (obj *flowUdp) SetDstPort(value PatternFlowUdpDstPort) FlowUdp { - - obj.dstPortHolder = nil - obj.obj.DstPort = value.msg() - - return obj -} - -// description is TBD -// Length returns a PatternFlowUdpLength -func (obj *flowUdp) Length() PatternFlowUdpLength { - if obj.obj.Length == nil { - obj.obj.Length = NewPatternFlowUdpLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &patternFlowUdpLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// description is TBD -// Length returns a PatternFlowUdpLength -func (obj *flowUdp) HasLength() bool { - return obj.obj.Length != nil -} - -// description is TBD -// SetLength sets the PatternFlowUdpLength value in the FlowUdp object -func (obj *flowUdp) SetLength(value PatternFlowUdpLength) FlowUdp { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// description is TBD -// Checksum returns a PatternFlowUdpChecksum -func (obj *flowUdp) Checksum() PatternFlowUdpChecksum { - if obj.obj.Checksum == nil { - obj.obj.Checksum = NewPatternFlowUdpChecksum().msg() - } - if obj.checksumHolder == nil { - obj.checksumHolder = &patternFlowUdpChecksum{obj: obj.obj.Checksum} - } - return obj.checksumHolder -} - -// description is TBD -// Checksum returns a PatternFlowUdpChecksum -func (obj *flowUdp) HasChecksum() bool { - return obj.obj.Checksum != nil -} - -// description is TBD -// SetChecksum sets the PatternFlowUdpChecksum value in the FlowUdp object -func (obj *flowUdp) SetChecksum(value PatternFlowUdpChecksum) FlowUdp { - - obj.checksumHolder = nil - obj.obj.Checksum = value.msg() - - return obj -} - -func (obj *flowUdp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.SrcPort != nil { - - obj.SrcPort().validateObj(vObj, set_default) - } - - if obj.obj.DstPort != nil { - - obj.DstPort().validateObj(vObj, set_default) - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.Checksum != nil { - - obj.Checksum().validateObj(vObj, set_default) - } - -} - -func (obj *flowUdp) setDefault() { - -} - -// ***** FlowGre ***** -type flowGre struct { - validation - obj *otg.FlowGre - marshaller marshalFlowGre - unMarshaller unMarshalFlowGre - checksumPresentHolder PatternFlowGreChecksumPresent - reserved0Holder PatternFlowGreReserved0 - versionHolder PatternFlowGreVersion - protocolHolder PatternFlowGreProtocol - checksumHolder PatternFlowGreChecksum - reserved1Holder PatternFlowGreReserved1 -} - -func NewFlowGre() FlowGre { - obj := flowGre{obj: &otg.FlowGre{}} - obj.setDefault() - return &obj -} - -func (obj *flowGre) msg() *otg.FlowGre { - return obj.obj -} - -func (obj *flowGre) setMsg(msg *otg.FlowGre) FlowGre { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowGre struct { - obj *flowGre -} - -type marshalFlowGre interface { - // ToProto marshals FlowGre to protobuf object *otg.FlowGre - ToProto() (*otg.FlowGre, error) - // ToPbText marshals FlowGre to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowGre to YAML text - ToYaml() (string, error) - // ToJson marshals FlowGre to JSON text - ToJson() (string, error) -} - -type unMarshalflowGre struct { - obj *flowGre -} - -type unMarshalFlowGre interface { - // FromProto unmarshals FlowGre from protobuf object *otg.FlowGre - FromProto(msg *otg.FlowGre) (FlowGre, error) - // FromPbText unmarshals FlowGre from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowGre from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowGre from JSON text - FromJson(value string) error -} - -func (obj *flowGre) Marshal() marshalFlowGre { - if obj.marshaller == nil { - obj.marshaller = &marshalflowGre{obj: obj} - } - return obj.marshaller -} - -func (obj *flowGre) Unmarshal() unMarshalFlowGre { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowGre{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowGre) ToProto() (*otg.FlowGre, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowGre) FromProto(msg *otg.FlowGre) (FlowGre, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowGre) 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 *unMarshalflowGre) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowGre) 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 *unMarshalflowGre) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowGre) 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 *unMarshalflowGre) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowGre) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowGre) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowGre) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowGre) Clone() (FlowGre, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowGre() - 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 -} - -func (obj *flowGre) setNil() { - obj.checksumPresentHolder = nil - obj.reserved0Holder = nil - obj.versionHolder = nil - obj.protocolHolder = nil - obj.checksumHolder = nil - obj.reserved1Holder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowGre is standard GRE packet header (RFC2784) -type FlowGre interface { - Validation - // msg marshals FlowGre to protobuf object *otg.FlowGre - // and doesn't set defaults - msg() *otg.FlowGre - // setMsg unmarshals FlowGre from protobuf object *otg.FlowGre - // and doesn't set defaults - setMsg(*otg.FlowGre) FlowGre - // provides marshal interface - Marshal() marshalFlowGre - // provides unmarshal interface - Unmarshal() unMarshalFlowGre - // validate validates FlowGre - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowGre, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ChecksumPresent returns PatternFlowGreChecksumPresent, set in FlowGre. - // PatternFlowGreChecksumPresent is checksum present bit - ChecksumPresent() PatternFlowGreChecksumPresent - // SetChecksumPresent assigns PatternFlowGreChecksumPresent provided by user to FlowGre. - // PatternFlowGreChecksumPresent is checksum present bit - SetChecksumPresent(value PatternFlowGreChecksumPresent) FlowGre - // HasChecksumPresent checks if ChecksumPresent has been set in FlowGre - HasChecksumPresent() bool - // Reserved0 returns PatternFlowGreReserved0, set in FlowGre. - // PatternFlowGreReserved0 is reserved bits - Reserved0() PatternFlowGreReserved0 - // SetReserved0 assigns PatternFlowGreReserved0 provided by user to FlowGre. - // PatternFlowGreReserved0 is reserved bits - SetReserved0(value PatternFlowGreReserved0) FlowGre - // HasReserved0 checks if Reserved0 has been set in FlowGre - HasReserved0() bool - // Version returns PatternFlowGreVersion, set in FlowGre. - // PatternFlowGreVersion is gRE version number - Version() PatternFlowGreVersion - // SetVersion assigns PatternFlowGreVersion provided by user to FlowGre. - // PatternFlowGreVersion is gRE version number - SetVersion(value PatternFlowGreVersion) FlowGre - // HasVersion checks if Version has been set in FlowGre - HasVersion() bool - // Protocol returns PatternFlowGreProtocol, set in FlowGre. - // PatternFlowGreProtocol is protocol type of encapsulated payload - Protocol() PatternFlowGreProtocol - // SetProtocol assigns PatternFlowGreProtocol provided by user to FlowGre. - // PatternFlowGreProtocol is protocol type of encapsulated payload - SetProtocol(value PatternFlowGreProtocol) FlowGre - // HasProtocol checks if Protocol has been set in FlowGre - HasProtocol() bool - // Checksum returns PatternFlowGreChecksum, set in FlowGre. - // PatternFlowGreChecksum is optional checksum of GRE header and payload. Only present if the checksum_present bit is set. - Checksum() PatternFlowGreChecksum - // SetChecksum assigns PatternFlowGreChecksum provided by user to FlowGre. - // PatternFlowGreChecksum is optional checksum of GRE header and payload. Only present if the checksum_present bit is set. - SetChecksum(value PatternFlowGreChecksum) FlowGre - // HasChecksum checks if Checksum has been set in FlowGre - HasChecksum() bool - // Reserved1 returns PatternFlowGreReserved1, set in FlowGre. - // PatternFlowGreReserved1 is optional reserved field. Only present if the checksum_present bit is set. - Reserved1() PatternFlowGreReserved1 - // SetReserved1 assigns PatternFlowGreReserved1 provided by user to FlowGre. - // PatternFlowGreReserved1 is optional reserved field. Only present if the checksum_present bit is set. - SetReserved1(value PatternFlowGreReserved1) FlowGre - // HasReserved1 checks if Reserved1 has been set in FlowGre - HasReserved1() bool - setNil() -} - -// description is TBD -// ChecksumPresent returns a PatternFlowGreChecksumPresent -func (obj *flowGre) ChecksumPresent() PatternFlowGreChecksumPresent { - if obj.obj.ChecksumPresent == nil { - obj.obj.ChecksumPresent = NewPatternFlowGreChecksumPresent().msg() - } - if obj.checksumPresentHolder == nil { - obj.checksumPresentHolder = &patternFlowGreChecksumPresent{obj: obj.obj.ChecksumPresent} - } - return obj.checksumPresentHolder -} - -// description is TBD -// ChecksumPresent returns a PatternFlowGreChecksumPresent -func (obj *flowGre) HasChecksumPresent() bool { - return obj.obj.ChecksumPresent != nil -} - -// description is TBD -// SetChecksumPresent sets the PatternFlowGreChecksumPresent value in the FlowGre object -func (obj *flowGre) SetChecksumPresent(value PatternFlowGreChecksumPresent) FlowGre { - - obj.checksumPresentHolder = nil - obj.obj.ChecksumPresent = value.msg() - - return obj -} - -// description is TBD -// Reserved0 returns a PatternFlowGreReserved0 -func (obj *flowGre) Reserved0() PatternFlowGreReserved0 { - if obj.obj.Reserved0 == nil { - obj.obj.Reserved0 = NewPatternFlowGreReserved0().msg() - } - if obj.reserved0Holder == nil { - obj.reserved0Holder = &patternFlowGreReserved0{obj: obj.obj.Reserved0} - } - return obj.reserved0Holder -} - -// description is TBD -// Reserved0 returns a PatternFlowGreReserved0 -func (obj *flowGre) HasReserved0() bool { - return obj.obj.Reserved0 != nil -} - -// description is TBD -// SetReserved0 sets the PatternFlowGreReserved0 value in the FlowGre object -func (obj *flowGre) SetReserved0(value PatternFlowGreReserved0) FlowGre { - - obj.reserved0Holder = nil - obj.obj.Reserved0 = value.msg() - - return obj -} - -// description is TBD -// Version returns a PatternFlowGreVersion -func (obj *flowGre) Version() PatternFlowGreVersion { - if obj.obj.Version == nil { - obj.obj.Version = NewPatternFlowGreVersion().msg() - } - if obj.versionHolder == nil { - obj.versionHolder = &patternFlowGreVersion{obj: obj.obj.Version} - } - return obj.versionHolder -} - -// description is TBD -// Version returns a PatternFlowGreVersion -func (obj *flowGre) HasVersion() bool { - return obj.obj.Version != nil -} - -// description is TBD -// SetVersion sets the PatternFlowGreVersion value in the FlowGre object -func (obj *flowGre) SetVersion(value PatternFlowGreVersion) FlowGre { - - obj.versionHolder = nil - obj.obj.Version = value.msg() - - return obj -} - -// description is TBD -// Protocol returns a PatternFlowGreProtocol -func (obj *flowGre) Protocol() PatternFlowGreProtocol { - if obj.obj.Protocol == nil { - obj.obj.Protocol = NewPatternFlowGreProtocol().msg() - } - if obj.protocolHolder == nil { - obj.protocolHolder = &patternFlowGreProtocol{obj: obj.obj.Protocol} - } - return obj.protocolHolder -} - -// description is TBD -// Protocol returns a PatternFlowGreProtocol -func (obj *flowGre) HasProtocol() bool { - return obj.obj.Protocol != nil -} - -// description is TBD -// SetProtocol sets the PatternFlowGreProtocol value in the FlowGre object -func (obj *flowGre) SetProtocol(value PatternFlowGreProtocol) FlowGre { - - obj.protocolHolder = nil - obj.obj.Protocol = value.msg() - - return obj -} - -// description is TBD -// Checksum returns a PatternFlowGreChecksum -func (obj *flowGre) Checksum() PatternFlowGreChecksum { - if obj.obj.Checksum == nil { - obj.obj.Checksum = NewPatternFlowGreChecksum().msg() - } - if obj.checksumHolder == nil { - obj.checksumHolder = &patternFlowGreChecksum{obj: obj.obj.Checksum} - } - return obj.checksumHolder -} - -// description is TBD -// Checksum returns a PatternFlowGreChecksum -func (obj *flowGre) HasChecksum() bool { - return obj.obj.Checksum != nil -} - -// description is TBD -// SetChecksum sets the PatternFlowGreChecksum value in the FlowGre object -func (obj *flowGre) SetChecksum(value PatternFlowGreChecksum) FlowGre { - - obj.checksumHolder = nil - obj.obj.Checksum = value.msg() - - return obj -} - -// description is TBD -// Reserved1 returns a PatternFlowGreReserved1 -func (obj *flowGre) Reserved1() PatternFlowGreReserved1 { - if obj.obj.Reserved1 == nil { - obj.obj.Reserved1 = NewPatternFlowGreReserved1().msg() - } - if obj.reserved1Holder == nil { - obj.reserved1Holder = &patternFlowGreReserved1{obj: obj.obj.Reserved1} - } - return obj.reserved1Holder -} - -// description is TBD -// Reserved1 returns a PatternFlowGreReserved1 -func (obj *flowGre) HasReserved1() bool { - return obj.obj.Reserved1 != nil -} - -// description is TBD -// SetReserved1 sets the PatternFlowGreReserved1 value in the FlowGre object -func (obj *flowGre) SetReserved1(value PatternFlowGreReserved1) FlowGre { - - obj.reserved1Holder = nil - obj.obj.Reserved1 = value.msg() - - return obj -} - -func (obj *flowGre) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.ChecksumPresent != nil { - - obj.ChecksumPresent().validateObj(vObj, set_default) - } - - if obj.obj.Reserved0 != nil { - - obj.Reserved0().validateObj(vObj, set_default) - } - - if obj.obj.Version != nil { - - obj.Version().validateObj(vObj, set_default) - } - - if obj.obj.Protocol != nil { - - obj.Protocol().validateObj(vObj, set_default) - } - - if obj.obj.Checksum != nil { - - obj.Checksum().validateObj(vObj, set_default) - } - - if obj.obj.Reserved1 != nil { - - obj.Reserved1().validateObj(vObj, set_default) - } - -} - -func (obj *flowGre) setDefault() { - -} - -// ***** FlowGtpv1 ***** -type flowGtpv1 struct { - validation - obj *otg.FlowGtpv1 - marshaller marshalFlowGtpv1 - unMarshaller unMarshalFlowGtpv1 - versionHolder PatternFlowGtpv1Version - protocolTypeHolder PatternFlowGtpv1ProtocolType - reservedHolder PatternFlowGtpv1Reserved - eFlagHolder PatternFlowGtpv1EFlag - sFlagHolder PatternFlowGtpv1SFlag - pnFlagHolder PatternFlowGtpv1PnFlag - messageTypeHolder PatternFlowGtpv1MessageType - messageLengthHolder PatternFlowGtpv1MessageLength - teidHolder PatternFlowGtpv1Teid - squenceNumberHolder PatternFlowGtpv1SquenceNumber - nPduNumberHolder PatternFlowGtpv1NPduNumber - nextExtensionHeaderTypeHolder PatternFlowGtpv1NextExtensionHeaderType - extensionHeadersHolder FlowGtpv1FlowGtpExtensionIter -} - -func NewFlowGtpv1() FlowGtpv1 { - obj := flowGtpv1{obj: &otg.FlowGtpv1{}} - obj.setDefault() - return &obj -} - -func (obj *flowGtpv1) msg() *otg.FlowGtpv1 { - return obj.obj -} - -func (obj *flowGtpv1) setMsg(msg *otg.FlowGtpv1) FlowGtpv1 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowGtpv1 struct { - obj *flowGtpv1 -} - -type marshalFlowGtpv1 interface { - // ToProto marshals FlowGtpv1 to protobuf object *otg.FlowGtpv1 - ToProto() (*otg.FlowGtpv1, error) - // ToPbText marshals FlowGtpv1 to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowGtpv1 to YAML text - ToYaml() (string, error) - // ToJson marshals FlowGtpv1 to JSON text - ToJson() (string, error) -} - -type unMarshalflowGtpv1 struct { - obj *flowGtpv1 -} - -type unMarshalFlowGtpv1 interface { - // FromProto unmarshals FlowGtpv1 from protobuf object *otg.FlowGtpv1 - FromProto(msg *otg.FlowGtpv1) (FlowGtpv1, error) - // FromPbText unmarshals FlowGtpv1 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowGtpv1 from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowGtpv1 from JSON text - FromJson(value string) error -} - -func (obj *flowGtpv1) Marshal() marshalFlowGtpv1 { - if obj.marshaller == nil { - obj.marshaller = &marshalflowGtpv1{obj: obj} - } - return obj.marshaller -} - -func (obj *flowGtpv1) Unmarshal() unMarshalFlowGtpv1 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowGtpv1{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowGtpv1) ToProto() (*otg.FlowGtpv1, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowGtpv1) FromProto(msg *otg.FlowGtpv1) (FlowGtpv1, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowGtpv1) 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 *unMarshalflowGtpv1) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowGtpv1) 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 *unMarshalflowGtpv1) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowGtpv1) 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 *unMarshalflowGtpv1) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowGtpv1) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowGtpv1) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowGtpv1) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowGtpv1) Clone() (FlowGtpv1, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowGtpv1() - 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 -} - -func (obj *flowGtpv1) setNil() { - obj.versionHolder = nil - obj.protocolTypeHolder = nil - obj.reservedHolder = nil - obj.eFlagHolder = nil - obj.sFlagHolder = nil - obj.pnFlagHolder = nil - obj.messageTypeHolder = nil - obj.messageLengthHolder = nil - obj.teidHolder = nil - obj.squenceNumberHolder = nil - obj.nPduNumberHolder = nil - obj.nextExtensionHeaderTypeHolder = nil - obj.extensionHeadersHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowGtpv1 is gTPv1 packet header -type FlowGtpv1 interface { - Validation - // msg marshals FlowGtpv1 to protobuf object *otg.FlowGtpv1 - // and doesn't set defaults - msg() *otg.FlowGtpv1 - // setMsg unmarshals FlowGtpv1 from protobuf object *otg.FlowGtpv1 - // and doesn't set defaults - setMsg(*otg.FlowGtpv1) FlowGtpv1 - // provides marshal interface - Marshal() marshalFlowGtpv1 - // provides unmarshal interface - Unmarshal() unMarshalFlowGtpv1 - // validate validates FlowGtpv1 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowGtpv1, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Version returns PatternFlowGtpv1Version, set in FlowGtpv1. - // PatternFlowGtpv1Version is gTPv1 version - Version() PatternFlowGtpv1Version - // SetVersion assigns PatternFlowGtpv1Version provided by user to FlowGtpv1. - // PatternFlowGtpv1Version is gTPv1 version - SetVersion(value PatternFlowGtpv1Version) FlowGtpv1 - // HasVersion checks if Version has been set in FlowGtpv1 - HasVersion() bool - // ProtocolType returns PatternFlowGtpv1ProtocolType, set in FlowGtpv1. - // PatternFlowGtpv1ProtocolType is protocol type, GTP is 1, GTP' is 0 - ProtocolType() PatternFlowGtpv1ProtocolType - // SetProtocolType assigns PatternFlowGtpv1ProtocolType provided by user to FlowGtpv1. - // PatternFlowGtpv1ProtocolType is protocol type, GTP is 1, GTP' is 0 - SetProtocolType(value PatternFlowGtpv1ProtocolType) FlowGtpv1 - // HasProtocolType checks if ProtocolType has been set in FlowGtpv1 - HasProtocolType() bool - // Reserved returns PatternFlowGtpv1Reserved, set in FlowGtpv1. - // PatternFlowGtpv1Reserved is reserved field - Reserved() PatternFlowGtpv1Reserved - // SetReserved assigns PatternFlowGtpv1Reserved provided by user to FlowGtpv1. - // PatternFlowGtpv1Reserved is reserved field - SetReserved(value PatternFlowGtpv1Reserved) FlowGtpv1 - // HasReserved checks if Reserved has been set in FlowGtpv1 - HasReserved() bool - // EFlag returns PatternFlowGtpv1EFlag, set in FlowGtpv1. - // PatternFlowGtpv1EFlag is extension header field present - EFlag() PatternFlowGtpv1EFlag - // SetEFlag assigns PatternFlowGtpv1EFlag provided by user to FlowGtpv1. - // PatternFlowGtpv1EFlag is extension header field present - SetEFlag(value PatternFlowGtpv1EFlag) FlowGtpv1 - // HasEFlag checks if EFlag has been set in FlowGtpv1 - HasEFlag() bool - // SFlag returns PatternFlowGtpv1SFlag, set in FlowGtpv1. - // PatternFlowGtpv1SFlag is sequence number field present - SFlag() PatternFlowGtpv1SFlag - // SetSFlag assigns PatternFlowGtpv1SFlag provided by user to FlowGtpv1. - // PatternFlowGtpv1SFlag is sequence number field present - SetSFlag(value PatternFlowGtpv1SFlag) FlowGtpv1 - // HasSFlag checks if SFlag has been set in FlowGtpv1 - HasSFlag() bool - // PnFlag returns PatternFlowGtpv1PnFlag, set in FlowGtpv1. - // PatternFlowGtpv1PnFlag is n-PDU field present - PnFlag() PatternFlowGtpv1PnFlag - // SetPnFlag assigns PatternFlowGtpv1PnFlag provided by user to FlowGtpv1. - // PatternFlowGtpv1PnFlag is n-PDU field present - SetPnFlag(value PatternFlowGtpv1PnFlag) FlowGtpv1 - // HasPnFlag checks if PnFlag has been set in FlowGtpv1 - HasPnFlag() bool - // MessageType returns PatternFlowGtpv1MessageType, set in FlowGtpv1. - // PatternFlowGtpv1MessageType is the type of GTP message Different types of messages are defined in 3GPP TS 29.060 section 7.1 - MessageType() PatternFlowGtpv1MessageType - // SetMessageType assigns PatternFlowGtpv1MessageType provided by user to FlowGtpv1. - // PatternFlowGtpv1MessageType is the type of GTP message Different types of messages are defined in 3GPP TS 29.060 section 7.1 - SetMessageType(value PatternFlowGtpv1MessageType) FlowGtpv1 - // HasMessageType checks if MessageType has been set in FlowGtpv1 - HasMessageType() bool - // MessageLength returns PatternFlowGtpv1MessageLength, set in FlowGtpv1. - // PatternFlowGtpv1MessageLength is the length of the payload (the bytes following the mandatory 8-byte GTP header) in bytes that includes any optional fields - MessageLength() PatternFlowGtpv1MessageLength - // SetMessageLength assigns PatternFlowGtpv1MessageLength provided by user to FlowGtpv1. - // PatternFlowGtpv1MessageLength is the length of the payload (the bytes following the mandatory 8-byte GTP header) in bytes that includes any optional fields - SetMessageLength(value PatternFlowGtpv1MessageLength) FlowGtpv1 - // HasMessageLength checks if MessageLength has been set in FlowGtpv1 - HasMessageLength() bool - // Teid returns PatternFlowGtpv1Teid, set in FlowGtpv1. - // PatternFlowGtpv1Teid is tunnel endpoint identifier (TEID) used to multiplex connections in the same GTP tunnel - Teid() PatternFlowGtpv1Teid - // SetTeid assigns PatternFlowGtpv1Teid provided by user to FlowGtpv1. - // PatternFlowGtpv1Teid is tunnel endpoint identifier (TEID) used to multiplex connections in the same GTP tunnel - SetTeid(value PatternFlowGtpv1Teid) FlowGtpv1 - // HasTeid checks if Teid has been set in FlowGtpv1 - HasTeid() bool - // SquenceNumber returns PatternFlowGtpv1SquenceNumber, set in FlowGtpv1. - // PatternFlowGtpv1SquenceNumber is sequence number. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the s_flag bit is on. - SquenceNumber() PatternFlowGtpv1SquenceNumber - // SetSquenceNumber assigns PatternFlowGtpv1SquenceNumber provided by user to FlowGtpv1. - // PatternFlowGtpv1SquenceNumber is sequence number. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the s_flag bit is on. - SetSquenceNumber(value PatternFlowGtpv1SquenceNumber) FlowGtpv1 - // HasSquenceNumber checks if SquenceNumber has been set in FlowGtpv1 - HasSquenceNumber() bool - // NPduNumber returns PatternFlowGtpv1NPduNumber, set in FlowGtpv1. - // PatternFlowGtpv1NPduNumber is n-PDU number. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the pn_flag bit is on. - NPduNumber() PatternFlowGtpv1NPduNumber - // SetNPduNumber assigns PatternFlowGtpv1NPduNumber provided by user to FlowGtpv1. - // PatternFlowGtpv1NPduNumber is n-PDU number. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the pn_flag bit is on. - SetNPduNumber(value PatternFlowGtpv1NPduNumber) FlowGtpv1 - // HasNPduNumber checks if NPduNumber has been set in FlowGtpv1 - HasNPduNumber() bool - // NextExtensionHeaderType returns PatternFlowGtpv1NextExtensionHeaderType, set in FlowGtpv1. - // PatternFlowGtpv1NextExtensionHeaderType is next extension header. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the e_flag bit is on. - NextExtensionHeaderType() PatternFlowGtpv1NextExtensionHeaderType - // SetNextExtensionHeaderType assigns PatternFlowGtpv1NextExtensionHeaderType provided by user to FlowGtpv1. - // PatternFlowGtpv1NextExtensionHeaderType is next extension header. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the e_flag bit is on. - SetNextExtensionHeaderType(value PatternFlowGtpv1NextExtensionHeaderType) FlowGtpv1 - // HasNextExtensionHeaderType checks if NextExtensionHeaderType has been set in FlowGtpv1 - HasNextExtensionHeaderType() bool - // ExtensionHeaders returns FlowGtpv1FlowGtpExtensionIterIter, set in FlowGtpv1 - ExtensionHeaders() FlowGtpv1FlowGtpExtensionIter - setNil() -} - -// description is TBD -// Version returns a PatternFlowGtpv1Version -func (obj *flowGtpv1) Version() PatternFlowGtpv1Version { - if obj.obj.Version == nil { - obj.obj.Version = NewPatternFlowGtpv1Version().msg() - } - if obj.versionHolder == nil { - obj.versionHolder = &patternFlowGtpv1Version{obj: obj.obj.Version} - } - return obj.versionHolder -} - -// description is TBD -// Version returns a PatternFlowGtpv1Version -func (obj *flowGtpv1) HasVersion() bool { - return obj.obj.Version != nil -} - -// description is TBD -// SetVersion sets the PatternFlowGtpv1Version value in the FlowGtpv1 object -func (obj *flowGtpv1) SetVersion(value PatternFlowGtpv1Version) FlowGtpv1 { - - obj.versionHolder = nil - obj.obj.Version = value.msg() - - return obj -} - -// description is TBD -// ProtocolType returns a PatternFlowGtpv1ProtocolType -func (obj *flowGtpv1) ProtocolType() PatternFlowGtpv1ProtocolType { - if obj.obj.ProtocolType == nil { - obj.obj.ProtocolType = NewPatternFlowGtpv1ProtocolType().msg() - } - if obj.protocolTypeHolder == nil { - obj.protocolTypeHolder = &patternFlowGtpv1ProtocolType{obj: obj.obj.ProtocolType} - } - return obj.protocolTypeHolder -} - -// description is TBD -// ProtocolType returns a PatternFlowGtpv1ProtocolType -func (obj *flowGtpv1) HasProtocolType() bool { - return obj.obj.ProtocolType != nil -} - -// description is TBD -// SetProtocolType sets the PatternFlowGtpv1ProtocolType value in the FlowGtpv1 object -func (obj *flowGtpv1) SetProtocolType(value PatternFlowGtpv1ProtocolType) FlowGtpv1 { - - obj.protocolTypeHolder = nil - obj.obj.ProtocolType = value.msg() - - return obj -} - -// description is TBD -// Reserved returns a PatternFlowGtpv1Reserved -func (obj *flowGtpv1) Reserved() PatternFlowGtpv1Reserved { - if obj.obj.Reserved == nil { - obj.obj.Reserved = NewPatternFlowGtpv1Reserved().msg() - } - if obj.reservedHolder == nil { - obj.reservedHolder = &patternFlowGtpv1Reserved{obj: obj.obj.Reserved} - } - return obj.reservedHolder -} - -// description is TBD -// Reserved returns a PatternFlowGtpv1Reserved -func (obj *flowGtpv1) HasReserved() bool { - return obj.obj.Reserved != nil -} - -// description is TBD -// SetReserved sets the PatternFlowGtpv1Reserved value in the FlowGtpv1 object -func (obj *flowGtpv1) SetReserved(value PatternFlowGtpv1Reserved) FlowGtpv1 { - - obj.reservedHolder = nil - obj.obj.Reserved = value.msg() - - return obj -} - -// description is TBD -// EFlag returns a PatternFlowGtpv1EFlag -func (obj *flowGtpv1) EFlag() PatternFlowGtpv1EFlag { - if obj.obj.EFlag == nil { - obj.obj.EFlag = NewPatternFlowGtpv1EFlag().msg() - } - if obj.eFlagHolder == nil { - obj.eFlagHolder = &patternFlowGtpv1EFlag{obj: obj.obj.EFlag} - } - return obj.eFlagHolder -} - -// description is TBD -// EFlag returns a PatternFlowGtpv1EFlag -func (obj *flowGtpv1) HasEFlag() bool { - return obj.obj.EFlag != nil -} - -// description is TBD -// SetEFlag sets the PatternFlowGtpv1EFlag value in the FlowGtpv1 object -func (obj *flowGtpv1) SetEFlag(value PatternFlowGtpv1EFlag) FlowGtpv1 { - - obj.eFlagHolder = nil - obj.obj.EFlag = value.msg() - - return obj -} - -// description is TBD -// SFlag returns a PatternFlowGtpv1SFlag -func (obj *flowGtpv1) SFlag() PatternFlowGtpv1SFlag { - if obj.obj.SFlag == nil { - obj.obj.SFlag = NewPatternFlowGtpv1SFlag().msg() - } - if obj.sFlagHolder == nil { - obj.sFlagHolder = &patternFlowGtpv1SFlag{obj: obj.obj.SFlag} - } - return obj.sFlagHolder -} - -// description is TBD -// SFlag returns a PatternFlowGtpv1SFlag -func (obj *flowGtpv1) HasSFlag() bool { - return obj.obj.SFlag != nil -} - -// description is TBD -// SetSFlag sets the PatternFlowGtpv1SFlag value in the FlowGtpv1 object -func (obj *flowGtpv1) SetSFlag(value PatternFlowGtpv1SFlag) FlowGtpv1 { - - obj.sFlagHolder = nil - obj.obj.SFlag = value.msg() - - return obj -} - -// description is TBD -// PnFlag returns a PatternFlowGtpv1PnFlag -func (obj *flowGtpv1) PnFlag() PatternFlowGtpv1PnFlag { - if obj.obj.PnFlag == nil { - obj.obj.PnFlag = NewPatternFlowGtpv1PnFlag().msg() - } - if obj.pnFlagHolder == nil { - obj.pnFlagHolder = &patternFlowGtpv1PnFlag{obj: obj.obj.PnFlag} - } - return obj.pnFlagHolder -} - -// description is TBD -// PnFlag returns a PatternFlowGtpv1PnFlag -func (obj *flowGtpv1) HasPnFlag() bool { - return obj.obj.PnFlag != nil -} - -// description is TBD -// SetPnFlag sets the PatternFlowGtpv1PnFlag value in the FlowGtpv1 object -func (obj *flowGtpv1) SetPnFlag(value PatternFlowGtpv1PnFlag) FlowGtpv1 { - - obj.pnFlagHolder = nil - obj.obj.PnFlag = value.msg() - - return obj -} - -// description is TBD -// MessageType returns a PatternFlowGtpv1MessageType -func (obj *flowGtpv1) MessageType() PatternFlowGtpv1MessageType { - if obj.obj.MessageType == nil { - obj.obj.MessageType = NewPatternFlowGtpv1MessageType().msg() - } - if obj.messageTypeHolder == nil { - obj.messageTypeHolder = &patternFlowGtpv1MessageType{obj: obj.obj.MessageType} - } - return obj.messageTypeHolder -} - -// description is TBD -// MessageType returns a PatternFlowGtpv1MessageType -func (obj *flowGtpv1) HasMessageType() bool { - return obj.obj.MessageType != nil -} - -// description is TBD -// SetMessageType sets the PatternFlowGtpv1MessageType value in the FlowGtpv1 object -func (obj *flowGtpv1) SetMessageType(value PatternFlowGtpv1MessageType) FlowGtpv1 { - - obj.messageTypeHolder = nil - obj.obj.MessageType = value.msg() - - return obj -} - -// description is TBD -// MessageLength returns a PatternFlowGtpv1MessageLength -func (obj *flowGtpv1) MessageLength() PatternFlowGtpv1MessageLength { - if obj.obj.MessageLength == nil { - obj.obj.MessageLength = NewPatternFlowGtpv1MessageLength().msg() - } - if obj.messageLengthHolder == nil { - obj.messageLengthHolder = &patternFlowGtpv1MessageLength{obj: obj.obj.MessageLength} - } - return obj.messageLengthHolder -} - -// description is TBD -// MessageLength returns a PatternFlowGtpv1MessageLength -func (obj *flowGtpv1) HasMessageLength() bool { - return obj.obj.MessageLength != nil -} - -// description is TBD -// SetMessageLength sets the PatternFlowGtpv1MessageLength value in the FlowGtpv1 object -func (obj *flowGtpv1) SetMessageLength(value PatternFlowGtpv1MessageLength) FlowGtpv1 { - - obj.messageLengthHolder = nil - obj.obj.MessageLength = value.msg() - - return obj -} - -// description is TBD -// Teid returns a PatternFlowGtpv1Teid -func (obj *flowGtpv1) Teid() PatternFlowGtpv1Teid { - if obj.obj.Teid == nil { - obj.obj.Teid = NewPatternFlowGtpv1Teid().msg() - } - if obj.teidHolder == nil { - obj.teidHolder = &patternFlowGtpv1Teid{obj: obj.obj.Teid} - } - return obj.teidHolder -} - -// description is TBD -// Teid returns a PatternFlowGtpv1Teid -func (obj *flowGtpv1) HasTeid() bool { - return obj.obj.Teid != nil -} - -// description is TBD -// SetTeid sets the PatternFlowGtpv1Teid value in the FlowGtpv1 object -func (obj *flowGtpv1) SetTeid(value PatternFlowGtpv1Teid) FlowGtpv1 { - - obj.teidHolder = nil - obj.obj.Teid = value.msg() - - return obj -} - -// description is TBD -// SquenceNumber returns a PatternFlowGtpv1SquenceNumber -func (obj *flowGtpv1) SquenceNumber() PatternFlowGtpv1SquenceNumber { - if obj.obj.SquenceNumber == nil { - obj.obj.SquenceNumber = NewPatternFlowGtpv1SquenceNumber().msg() - } - if obj.squenceNumberHolder == nil { - obj.squenceNumberHolder = &patternFlowGtpv1SquenceNumber{obj: obj.obj.SquenceNumber} - } - return obj.squenceNumberHolder -} - -// description is TBD -// SquenceNumber returns a PatternFlowGtpv1SquenceNumber -func (obj *flowGtpv1) HasSquenceNumber() bool { - return obj.obj.SquenceNumber != nil -} - -// description is TBD -// SetSquenceNumber sets the PatternFlowGtpv1SquenceNumber value in the FlowGtpv1 object -func (obj *flowGtpv1) SetSquenceNumber(value PatternFlowGtpv1SquenceNumber) FlowGtpv1 { - - obj.squenceNumberHolder = nil - obj.obj.SquenceNumber = value.msg() - - return obj -} - -// description is TBD -// NPduNumber returns a PatternFlowGtpv1NPduNumber -func (obj *flowGtpv1) NPduNumber() PatternFlowGtpv1NPduNumber { - if obj.obj.NPduNumber == nil { - obj.obj.NPduNumber = NewPatternFlowGtpv1NPduNumber().msg() - } - if obj.nPduNumberHolder == nil { - obj.nPduNumberHolder = &patternFlowGtpv1NPduNumber{obj: obj.obj.NPduNumber} - } - return obj.nPduNumberHolder -} - -// description is TBD -// NPduNumber returns a PatternFlowGtpv1NPduNumber -func (obj *flowGtpv1) HasNPduNumber() bool { - return obj.obj.NPduNumber != nil -} - -// description is TBD -// SetNPduNumber sets the PatternFlowGtpv1NPduNumber value in the FlowGtpv1 object -func (obj *flowGtpv1) SetNPduNumber(value PatternFlowGtpv1NPduNumber) FlowGtpv1 { - - obj.nPduNumberHolder = nil - obj.obj.NPduNumber = value.msg() - - return obj -} - -// description is TBD -// NextExtensionHeaderType returns a PatternFlowGtpv1NextExtensionHeaderType -func (obj *flowGtpv1) NextExtensionHeaderType() PatternFlowGtpv1NextExtensionHeaderType { - if obj.obj.NextExtensionHeaderType == nil { - obj.obj.NextExtensionHeaderType = NewPatternFlowGtpv1NextExtensionHeaderType().msg() - } - if obj.nextExtensionHeaderTypeHolder == nil { - obj.nextExtensionHeaderTypeHolder = &patternFlowGtpv1NextExtensionHeaderType{obj: obj.obj.NextExtensionHeaderType} - } - return obj.nextExtensionHeaderTypeHolder -} - -// description is TBD -// NextExtensionHeaderType returns a PatternFlowGtpv1NextExtensionHeaderType -func (obj *flowGtpv1) HasNextExtensionHeaderType() bool { - return obj.obj.NextExtensionHeaderType != nil -} - -// description is TBD -// SetNextExtensionHeaderType sets the PatternFlowGtpv1NextExtensionHeaderType value in the FlowGtpv1 object -func (obj *flowGtpv1) SetNextExtensionHeaderType(value PatternFlowGtpv1NextExtensionHeaderType) FlowGtpv1 { - - obj.nextExtensionHeaderTypeHolder = nil - obj.obj.NextExtensionHeaderType = value.msg() - - return obj -} - -// A list of optional extension headers. -// ExtensionHeaders returns a []FlowGtpExtension -func (obj *flowGtpv1) ExtensionHeaders() FlowGtpv1FlowGtpExtensionIter { - if len(obj.obj.ExtensionHeaders) == 0 { - obj.obj.ExtensionHeaders = []*otg.FlowGtpExtension{} - } - if obj.extensionHeadersHolder == nil { - obj.extensionHeadersHolder = newFlowGtpv1FlowGtpExtensionIter(&obj.obj.ExtensionHeaders).setMsg(obj) - } - return obj.extensionHeadersHolder -} - -type flowGtpv1FlowGtpExtensionIter struct { - obj *flowGtpv1 - flowGtpExtensionSlice []FlowGtpExtension - fieldPtr *[]*otg.FlowGtpExtension -} - -func newFlowGtpv1FlowGtpExtensionIter(ptr *[]*otg.FlowGtpExtension) FlowGtpv1FlowGtpExtensionIter { - return &flowGtpv1FlowGtpExtensionIter{fieldPtr: ptr} -} - -type FlowGtpv1FlowGtpExtensionIter interface { - setMsg(*flowGtpv1) FlowGtpv1FlowGtpExtensionIter - Items() []FlowGtpExtension - Add() FlowGtpExtension - Append(items ...FlowGtpExtension) FlowGtpv1FlowGtpExtensionIter - Set(index int, newObj FlowGtpExtension) FlowGtpv1FlowGtpExtensionIter - Clear() FlowGtpv1FlowGtpExtensionIter - clearHolderSlice() FlowGtpv1FlowGtpExtensionIter - appendHolderSlice(item FlowGtpExtension) FlowGtpv1FlowGtpExtensionIter -} - -func (obj *flowGtpv1FlowGtpExtensionIter) setMsg(msg *flowGtpv1) FlowGtpv1FlowGtpExtensionIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flowGtpExtension{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *flowGtpv1FlowGtpExtensionIter) Items() []FlowGtpExtension { - return obj.flowGtpExtensionSlice -} - -func (obj *flowGtpv1FlowGtpExtensionIter) Add() FlowGtpExtension { - newObj := &otg.FlowGtpExtension{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flowGtpExtension{obj: newObj} - newLibObj.setDefault() - obj.flowGtpExtensionSlice = append(obj.flowGtpExtensionSlice, newLibObj) - return newLibObj -} - -func (obj *flowGtpv1FlowGtpExtensionIter) Append(items ...FlowGtpExtension) FlowGtpv1FlowGtpExtensionIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowGtpExtensionSlice = append(obj.flowGtpExtensionSlice, item) - } - return obj -} - -func (obj *flowGtpv1FlowGtpExtensionIter) Set(index int, newObj FlowGtpExtension) FlowGtpv1FlowGtpExtensionIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowGtpExtensionSlice[index] = newObj - return obj -} -func (obj *flowGtpv1FlowGtpExtensionIter) Clear() FlowGtpv1FlowGtpExtensionIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.FlowGtpExtension{} - obj.flowGtpExtensionSlice = []FlowGtpExtension{} - } - return obj -} -func (obj *flowGtpv1FlowGtpExtensionIter) clearHolderSlice() FlowGtpv1FlowGtpExtensionIter { - if len(obj.flowGtpExtensionSlice) > 0 { - obj.flowGtpExtensionSlice = []FlowGtpExtension{} - } - return obj -} -func (obj *flowGtpv1FlowGtpExtensionIter) appendHolderSlice(item FlowGtpExtension) FlowGtpv1FlowGtpExtensionIter { - obj.flowGtpExtensionSlice = append(obj.flowGtpExtensionSlice, item) - return obj -} - -func (obj *flowGtpv1) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Version != nil { - - obj.Version().validateObj(vObj, set_default) - } - - if obj.obj.ProtocolType != nil { - - obj.ProtocolType().validateObj(vObj, set_default) - } - - if obj.obj.Reserved != nil { - - obj.Reserved().validateObj(vObj, set_default) - } - - if obj.obj.EFlag != nil { - - obj.EFlag().validateObj(vObj, set_default) - } - - if obj.obj.SFlag != nil { - - obj.SFlag().validateObj(vObj, set_default) - } - - if obj.obj.PnFlag != nil { - - obj.PnFlag().validateObj(vObj, set_default) - } - - if obj.obj.MessageType != nil { - - obj.MessageType().validateObj(vObj, set_default) - } - - if obj.obj.MessageLength != nil { - - obj.MessageLength().validateObj(vObj, set_default) - } - - if obj.obj.Teid != nil { - - obj.Teid().validateObj(vObj, set_default) - } - - if obj.obj.SquenceNumber != nil { - - obj.SquenceNumber().validateObj(vObj, set_default) - } - - if obj.obj.NPduNumber != nil { - - obj.NPduNumber().validateObj(vObj, set_default) - } - - if obj.obj.NextExtensionHeaderType != nil { - - obj.NextExtensionHeaderType().validateObj(vObj, set_default) - } - - if len(obj.obj.ExtensionHeaders) != 0 { - - if set_default { - obj.ExtensionHeaders().clearHolderSlice() - for _, item := range obj.obj.ExtensionHeaders { - obj.ExtensionHeaders().appendHolderSlice(&flowGtpExtension{obj: item}) - } - } - for _, item := range obj.ExtensionHeaders().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *flowGtpv1) setDefault() { - -} - -// ***** FlowGtpv2 ***** -type flowGtpv2 struct { - validation - obj *otg.FlowGtpv2 - marshaller marshalFlowGtpv2 - unMarshaller unMarshalFlowGtpv2 - versionHolder PatternFlowGtpv2Version - piggybackingFlagHolder PatternFlowGtpv2PiggybackingFlag - teidFlagHolder PatternFlowGtpv2TeidFlag - spare1Holder PatternFlowGtpv2Spare1 - messageTypeHolder PatternFlowGtpv2MessageType - messageLengthHolder PatternFlowGtpv2MessageLength - teidHolder PatternFlowGtpv2Teid - sequenceNumberHolder PatternFlowGtpv2SequenceNumber - spare2Holder PatternFlowGtpv2Spare2 -} - -func NewFlowGtpv2() FlowGtpv2 { - obj := flowGtpv2{obj: &otg.FlowGtpv2{}} - obj.setDefault() - return &obj -} - -func (obj *flowGtpv2) msg() *otg.FlowGtpv2 { - return obj.obj -} - -func (obj *flowGtpv2) setMsg(msg *otg.FlowGtpv2) FlowGtpv2 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowGtpv2 struct { - obj *flowGtpv2 -} - -type marshalFlowGtpv2 interface { - // ToProto marshals FlowGtpv2 to protobuf object *otg.FlowGtpv2 - ToProto() (*otg.FlowGtpv2, error) - // ToPbText marshals FlowGtpv2 to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowGtpv2 to YAML text - ToYaml() (string, error) - // ToJson marshals FlowGtpv2 to JSON text - ToJson() (string, error) -} - -type unMarshalflowGtpv2 struct { - obj *flowGtpv2 -} - -type unMarshalFlowGtpv2 interface { - // FromProto unmarshals FlowGtpv2 from protobuf object *otg.FlowGtpv2 - FromProto(msg *otg.FlowGtpv2) (FlowGtpv2, error) - // FromPbText unmarshals FlowGtpv2 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowGtpv2 from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowGtpv2 from JSON text - FromJson(value string) error -} - -func (obj *flowGtpv2) Marshal() marshalFlowGtpv2 { - if obj.marshaller == nil { - obj.marshaller = &marshalflowGtpv2{obj: obj} - } - return obj.marshaller -} - -func (obj *flowGtpv2) Unmarshal() unMarshalFlowGtpv2 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowGtpv2{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowGtpv2) ToProto() (*otg.FlowGtpv2, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowGtpv2) FromProto(msg *otg.FlowGtpv2) (FlowGtpv2, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowGtpv2) 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 *unMarshalflowGtpv2) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowGtpv2) 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 *unMarshalflowGtpv2) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowGtpv2) 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 *unMarshalflowGtpv2) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowGtpv2) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowGtpv2) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowGtpv2) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowGtpv2) Clone() (FlowGtpv2, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowGtpv2() - 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 -} - -func (obj *flowGtpv2) setNil() { - obj.versionHolder = nil - obj.piggybackingFlagHolder = nil - obj.teidFlagHolder = nil - obj.spare1Holder = nil - obj.messageTypeHolder = nil - obj.messageLengthHolder = nil - obj.teidHolder = nil - obj.sequenceNumberHolder = nil - obj.spare2Holder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowGtpv2 is gTPv2 packet header -type FlowGtpv2 interface { - Validation - // msg marshals FlowGtpv2 to protobuf object *otg.FlowGtpv2 - // and doesn't set defaults - msg() *otg.FlowGtpv2 - // setMsg unmarshals FlowGtpv2 from protobuf object *otg.FlowGtpv2 - // and doesn't set defaults - setMsg(*otg.FlowGtpv2) FlowGtpv2 - // provides marshal interface - Marshal() marshalFlowGtpv2 - // provides unmarshal interface - Unmarshal() unMarshalFlowGtpv2 - // validate validates FlowGtpv2 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowGtpv2, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Version returns PatternFlowGtpv2Version, set in FlowGtpv2. - // PatternFlowGtpv2Version is version number - Version() PatternFlowGtpv2Version - // SetVersion assigns PatternFlowGtpv2Version provided by user to FlowGtpv2. - // PatternFlowGtpv2Version is version number - SetVersion(value PatternFlowGtpv2Version) FlowGtpv2 - // HasVersion checks if Version has been set in FlowGtpv2 - HasVersion() bool - // PiggybackingFlag returns PatternFlowGtpv2PiggybackingFlag, set in FlowGtpv2. - // PatternFlowGtpv2PiggybackingFlag is if piggybacking_flag is set to 1 then another GTP-C message with its own header shall be present at the end of the current message - PiggybackingFlag() PatternFlowGtpv2PiggybackingFlag - // SetPiggybackingFlag assigns PatternFlowGtpv2PiggybackingFlag provided by user to FlowGtpv2. - // PatternFlowGtpv2PiggybackingFlag is if piggybacking_flag is set to 1 then another GTP-C message with its own header shall be present at the end of the current message - SetPiggybackingFlag(value PatternFlowGtpv2PiggybackingFlag) FlowGtpv2 - // HasPiggybackingFlag checks if PiggybackingFlag has been set in FlowGtpv2 - HasPiggybackingFlag() bool - // TeidFlag returns PatternFlowGtpv2TeidFlag, set in FlowGtpv2. - // PatternFlowGtpv2TeidFlag is if teid_flag is set to 1 then the TEID field will be present between the message length and the sequence number. All messages except Echo and Echo reply require TEID to be present - TeidFlag() PatternFlowGtpv2TeidFlag - // SetTeidFlag assigns PatternFlowGtpv2TeidFlag provided by user to FlowGtpv2. - // PatternFlowGtpv2TeidFlag is if teid_flag is set to 1 then the TEID field will be present between the message length and the sequence number. All messages except Echo and Echo reply require TEID to be present - SetTeidFlag(value PatternFlowGtpv2TeidFlag) FlowGtpv2 - // HasTeidFlag checks if TeidFlag has been set in FlowGtpv2 - HasTeidFlag() bool - // Spare1 returns PatternFlowGtpv2Spare1, set in FlowGtpv2. - // PatternFlowGtpv2Spare1 is a 3-bit reserved field (must be 0). - Spare1() PatternFlowGtpv2Spare1 - // SetSpare1 assigns PatternFlowGtpv2Spare1 provided by user to FlowGtpv2. - // PatternFlowGtpv2Spare1 is a 3-bit reserved field (must be 0). - SetSpare1(value PatternFlowGtpv2Spare1) FlowGtpv2 - // HasSpare1 checks if Spare1 has been set in FlowGtpv2 - HasSpare1() bool - // MessageType returns PatternFlowGtpv2MessageType, set in FlowGtpv2. - // PatternFlowGtpv2MessageType is an 8-bit field that indicates the type of GTP message. Different types of messages are defined in 3GPP TS 29.060 section 7.1 - MessageType() PatternFlowGtpv2MessageType - // SetMessageType assigns PatternFlowGtpv2MessageType provided by user to FlowGtpv2. - // PatternFlowGtpv2MessageType is an 8-bit field that indicates the type of GTP message. Different types of messages are defined in 3GPP TS 29.060 section 7.1 - SetMessageType(value PatternFlowGtpv2MessageType) FlowGtpv2 - // HasMessageType checks if MessageType has been set in FlowGtpv2 - HasMessageType() bool - // MessageLength returns PatternFlowGtpv2MessageLength, set in FlowGtpv2. - // PatternFlowGtpv2MessageLength is a 16-bit field that indicates the length of the payload in bytes, excluding the mandatory GTP-c header (first 4 bytes). Includes the TEID and sequence_number if they are present. - MessageLength() PatternFlowGtpv2MessageLength - // SetMessageLength assigns PatternFlowGtpv2MessageLength provided by user to FlowGtpv2. - // PatternFlowGtpv2MessageLength is a 16-bit field that indicates the length of the payload in bytes, excluding the mandatory GTP-c header (first 4 bytes). Includes the TEID and sequence_number if they are present. - SetMessageLength(value PatternFlowGtpv2MessageLength) FlowGtpv2 - // HasMessageLength checks if MessageLength has been set in FlowGtpv2 - HasMessageLength() bool - // Teid returns PatternFlowGtpv2Teid, set in FlowGtpv2. - // PatternFlowGtpv2Teid is tunnel endpoint identifier. A 32-bit (4-octet) field used to multiplex different connections in the same GTP tunnel. Is present only if the teid_flag is set. - Teid() PatternFlowGtpv2Teid - // SetTeid assigns PatternFlowGtpv2Teid provided by user to FlowGtpv2. - // PatternFlowGtpv2Teid is tunnel endpoint identifier. A 32-bit (4-octet) field used to multiplex different connections in the same GTP tunnel. Is present only if the teid_flag is set. - SetTeid(value PatternFlowGtpv2Teid) FlowGtpv2 - // HasTeid checks if Teid has been set in FlowGtpv2 - HasTeid() bool - // SequenceNumber returns PatternFlowGtpv2SequenceNumber, set in FlowGtpv2. - // PatternFlowGtpv2SequenceNumber is the sequence number - SequenceNumber() PatternFlowGtpv2SequenceNumber - // SetSequenceNumber assigns PatternFlowGtpv2SequenceNumber provided by user to FlowGtpv2. - // PatternFlowGtpv2SequenceNumber is the sequence number - SetSequenceNumber(value PatternFlowGtpv2SequenceNumber) FlowGtpv2 - // HasSequenceNumber checks if SequenceNumber has been set in FlowGtpv2 - HasSequenceNumber() bool - // Spare2 returns PatternFlowGtpv2Spare2, set in FlowGtpv2. - // PatternFlowGtpv2Spare2 is reserved field - Spare2() PatternFlowGtpv2Spare2 - // SetSpare2 assigns PatternFlowGtpv2Spare2 provided by user to FlowGtpv2. - // PatternFlowGtpv2Spare2 is reserved field - SetSpare2(value PatternFlowGtpv2Spare2) FlowGtpv2 - // HasSpare2 checks if Spare2 has been set in FlowGtpv2 - HasSpare2() bool - setNil() -} - -// description is TBD -// Version returns a PatternFlowGtpv2Version -func (obj *flowGtpv2) Version() PatternFlowGtpv2Version { - if obj.obj.Version == nil { - obj.obj.Version = NewPatternFlowGtpv2Version().msg() - } - if obj.versionHolder == nil { - obj.versionHolder = &patternFlowGtpv2Version{obj: obj.obj.Version} - } - return obj.versionHolder -} - -// description is TBD -// Version returns a PatternFlowGtpv2Version -func (obj *flowGtpv2) HasVersion() bool { - return obj.obj.Version != nil -} - -// description is TBD -// SetVersion sets the PatternFlowGtpv2Version value in the FlowGtpv2 object -func (obj *flowGtpv2) SetVersion(value PatternFlowGtpv2Version) FlowGtpv2 { - - obj.versionHolder = nil - obj.obj.Version = value.msg() - - return obj -} - -// description is TBD -// PiggybackingFlag returns a PatternFlowGtpv2PiggybackingFlag -func (obj *flowGtpv2) PiggybackingFlag() PatternFlowGtpv2PiggybackingFlag { - if obj.obj.PiggybackingFlag == nil { - obj.obj.PiggybackingFlag = NewPatternFlowGtpv2PiggybackingFlag().msg() - } - if obj.piggybackingFlagHolder == nil { - obj.piggybackingFlagHolder = &patternFlowGtpv2PiggybackingFlag{obj: obj.obj.PiggybackingFlag} - } - return obj.piggybackingFlagHolder -} - -// description is TBD -// PiggybackingFlag returns a PatternFlowGtpv2PiggybackingFlag -func (obj *flowGtpv2) HasPiggybackingFlag() bool { - return obj.obj.PiggybackingFlag != nil -} - -// description is TBD -// SetPiggybackingFlag sets the PatternFlowGtpv2PiggybackingFlag value in the FlowGtpv2 object -func (obj *flowGtpv2) SetPiggybackingFlag(value PatternFlowGtpv2PiggybackingFlag) FlowGtpv2 { - - obj.piggybackingFlagHolder = nil - obj.obj.PiggybackingFlag = value.msg() - - return obj -} - -// description is TBD -// TeidFlag returns a PatternFlowGtpv2TeidFlag -func (obj *flowGtpv2) TeidFlag() PatternFlowGtpv2TeidFlag { - if obj.obj.TeidFlag == nil { - obj.obj.TeidFlag = NewPatternFlowGtpv2TeidFlag().msg() - } - if obj.teidFlagHolder == nil { - obj.teidFlagHolder = &patternFlowGtpv2TeidFlag{obj: obj.obj.TeidFlag} - } - return obj.teidFlagHolder -} - -// description is TBD -// TeidFlag returns a PatternFlowGtpv2TeidFlag -func (obj *flowGtpv2) HasTeidFlag() bool { - return obj.obj.TeidFlag != nil -} - -// description is TBD -// SetTeidFlag sets the PatternFlowGtpv2TeidFlag value in the FlowGtpv2 object -func (obj *flowGtpv2) SetTeidFlag(value PatternFlowGtpv2TeidFlag) FlowGtpv2 { - - obj.teidFlagHolder = nil - obj.obj.TeidFlag = value.msg() - - return obj -} - -// description is TBD -// Spare1 returns a PatternFlowGtpv2Spare1 -func (obj *flowGtpv2) Spare1() PatternFlowGtpv2Spare1 { - if obj.obj.Spare1 == nil { - obj.obj.Spare1 = NewPatternFlowGtpv2Spare1().msg() - } - if obj.spare1Holder == nil { - obj.spare1Holder = &patternFlowGtpv2Spare1{obj: obj.obj.Spare1} - } - return obj.spare1Holder -} - -// description is TBD -// Spare1 returns a PatternFlowGtpv2Spare1 -func (obj *flowGtpv2) HasSpare1() bool { - return obj.obj.Spare1 != nil -} - -// description is TBD -// SetSpare1 sets the PatternFlowGtpv2Spare1 value in the FlowGtpv2 object -func (obj *flowGtpv2) SetSpare1(value PatternFlowGtpv2Spare1) FlowGtpv2 { - - obj.spare1Holder = nil - obj.obj.Spare1 = value.msg() - - return obj -} - -// description is TBD -// MessageType returns a PatternFlowGtpv2MessageType -func (obj *flowGtpv2) MessageType() PatternFlowGtpv2MessageType { - if obj.obj.MessageType == nil { - obj.obj.MessageType = NewPatternFlowGtpv2MessageType().msg() - } - if obj.messageTypeHolder == nil { - obj.messageTypeHolder = &patternFlowGtpv2MessageType{obj: obj.obj.MessageType} - } - return obj.messageTypeHolder -} - -// description is TBD -// MessageType returns a PatternFlowGtpv2MessageType -func (obj *flowGtpv2) HasMessageType() bool { - return obj.obj.MessageType != nil -} - -// description is TBD -// SetMessageType sets the PatternFlowGtpv2MessageType value in the FlowGtpv2 object -func (obj *flowGtpv2) SetMessageType(value PatternFlowGtpv2MessageType) FlowGtpv2 { - - obj.messageTypeHolder = nil - obj.obj.MessageType = value.msg() - - return obj -} - -// description is TBD -// MessageLength returns a PatternFlowGtpv2MessageLength -func (obj *flowGtpv2) MessageLength() PatternFlowGtpv2MessageLength { - if obj.obj.MessageLength == nil { - obj.obj.MessageLength = NewPatternFlowGtpv2MessageLength().msg() - } - if obj.messageLengthHolder == nil { - obj.messageLengthHolder = &patternFlowGtpv2MessageLength{obj: obj.obj.MessageLength} - } - return obj.messageLengthHolder -} - -// description is TBD -// MessageLength returns a PatternFlowGtpv2MessageLength -func (obj *flowGtpv2) HasMessageLength() bool { - return obj.obj.MessageLength != nil -} - -// description is TBD -// SetMessageLength sets the PatternFlowGtpv2MessageLength value in the FlowGtpv2 object -func (obj *flowGtpv2) SetMessageLength(value PatternFlowGtpv2MessageLength) FlowGtpv2 { - - obj.messageLengthHolder = nil - obj.obj.MessageLength = value.msg() - - return obj -} - -// description is TBD -// Teid returns a PatternFlowGtpv2Teid -func (obj *flowGtpv2) Teid() PatternFlowGtpv2Teid { - if obj.obj.Teid == nil { - obj.obj.Teid = NewPatternFlowGtpv2Teid().msg() - } - if obj.teidHolder == nil { - obj.teidHolder = &patternFlowGtpv2Teid{obj: obj.obj.Teid} - } - return obj.teidHolder -} - -// description is TBD -// Teid returns a PatternFlowGtpv2Teid -func (obj *flowGtpv2) HasTeid() bool { - return obj.obj.Teid != nil -} - -// description is TBD -// SetTeid sets the PatternFlowGtpv2Teid value in the FlowGtpv2 object -func (obj *flowGtpv2) SetTeid(value PatternFlowGtpv2Teid) FlowGtpv2 { - - obj.teidHolder = nil - obj.obj.Teid = value.msg() - - return obj -} - -// description is TBD -// SequenceNumber returns a PatternFlowGtpv2SequenceNumber -func (obj *flowGtpv2) SequenceNumber() PatternFlowGtpv2SequenceNumber { - if obj.obj.SequenceNumber == nil { - obj.obj.SequenceNumber = NewPatternFlowGtpv2SequenceNumber().msg() - } - if obj.sequenceNumberHolder == nil { - obj.sequenceNumberHolder = &patternFlowGtpv2SequenceNumber{obj: obj.obj.SequenceNumber} - } - return obj.sequenceNumberHolder -} - -// description is TBD -// SequenceNumber returns a PatternFlowGtpv2SequenceNumber -func (obj *flowGtpv2) HasSequenceNumber() bool { - return obj.obj.SequenceNumber != nil -} - -// description is TBD -// SetSequenceNumber sets the PatternFlowGtpv2SequenceNumber value in the FlowGtpv2 object -func (obj *flowGtpv2) SetSequenceNumber(value PatternFlowGtpv2SequenceNumber) FlowGtpv2 { - - obj.sequenceNumberHolder = nil - obj.obj.SequenceNumber = value.msg() - - return obj -} - -// description is TBD -// Spare2 returns a PatternFlowGtpv2Spare2 -func (obj *flowGtpv2) Spare2() PatternFlowGtpv2Spare2 { - if obj.obj.Spare2 == nil { - obj.obj.Spare2 = NewPatternFlowGtpv2Spare2().msg() - } - if obj.spare2Holder == nil { - obj.spare2Holder = &patternFlowGtpv2Spare2{obj: obj.obj.Spare2} - } - return obj.spare2Holder -} - -// description is TBD -// Spare2 returns a PatternFlowGtpv2Spare2 -func (obj *flowGtpv2) HasSpare2() bool { - return obj.obj.Spare2 != nil -} - -// description is TBD -// SetSpare2 sets the PatternFlowGtpv2Spare2 value in the FlowGtpv2 object -func (obj *flowGtpv2) SetSpare2(value PatternFlowGtpv2Spare2) FlowGtpv2 { - - obj.spare2Holder = nil - obj.obj.Spare2 = value.msg() - - return obj -} - -func (obj *flowGtpv2) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Version != nil { - - obj.Version().validateObj(vObj, set_default) - } - - if obj.obj.PiggybackingFlag != nil { - - obj.PiggybackingFlag().validateObj(vObj, set_default) - } - - if obj.obj.TeidFlag != nil { - - obj.TeidFlag().validateObj(vObj, set_default) - } - - if obj.obj.Spare1 != nil { - - obj.Spare1().validateObj(vObj, set_default) - } - - if obj.obj.MessageType != nil { - - obj.MessageType().validateObj(vObj, set_default) - } - - if obj.obj.MessageLength != nil { - - obj.MessageLength().validateObj(vObj, set_default) - } - - if obj.obj.Teid != nil { - - obj.Teid().validateObj(vObj, set_default) - } - - if obj.obj.SequenceNumber != nil { - - obj.SequenceNumber().validateObj(vObj, set_default) - } - - if obj.obj.Spare2 != nil { - - obj.Spare2().validateObj(vObj, set_default) - } - -} - -func (obj *flowGtpv2) setDefault() { - -} - -// ***** FlowArp ***** -type flowArp struct { - validation - obj *otg.FlowArp - marshaller marshalFlowArp - unMarshaller unMarshalFlowArp - hardwareTypeHolder PatternFlowArpHardwareType - protocolTypeHolder PatternFlowArpProtocolType - hardwareLengthHolder PatternFlowArpHardwareLength - protocolLengthHolder PatternFlowArpProtocolLength - operationHolder PatternFlowArpOperation - senderHardwareAddrHolder PatternFlowArpSenderHardwareAddr - senderProtocolAddrHolder PatternFlowArpSenderProtocolAddr - targetHardwareAddrHolder PatternFlowArpTargetHardwareAddr - targetProtocolAddrHolder PatternFlowArpTargetProtocolAddr -} - -func NewFlowArp() FlowArp { - obj := flowArp{obj: &otg.FlowArp{}} - obj.setDefault() - return &obj -} - -func (obj *flowArp) msg() *otg.FlowArp { - return obj.obj -} - -func (obj *flowArp) setMsg(msg *otg.FlowArp) FlowArp { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowArp struct { - obj *flowArp -} - -type marshalFlowArp interface { - // ToProto marshals FlowArp to protobuf object *otg.FlowArp - ToProto() (*otg.FlowArp, error) - // ToPbText marshals FlowArp to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowArp to YAML text - ToYaml() (string, error) - // ToJson marshals FlowArp to JSON text - ToJson() (string, error) -} - -type unMarshalflowArp struct { - obj *flowArp -} - -type unMarshalFlowArp interface { - // FromProto unmarshals FlowArp from protobuf object *otg.FlowArp - FromProto(msg *otg.FlowArp) (FlowArp, error) - // FromPbText unmarshals FlowArp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowArp from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowArp from JSON text - FromJson(value string) error -} - -func (obj *flowArp) Marshal() marshalFlowArp { - if obj.marshaller == nil { - obj.marshaller = &marshalflowArp{obj: obj} - } - return obj.marshaller -} - -func (obj *flowArp) Unmarshal() unMarshalFlowArp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowArp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowArp) ToProto() (*otg.FlowArp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowArp) FromProto(msg *otg.FlowArp) (FlowArp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowArp) 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 *unMarshalflowArp) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowArp) 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 *unMarshalflowArp) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowArp) 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 *unMarshalflowArp) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowArp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowArp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowArp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowArp) Clone() (FlowArp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowArp() - 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 -} - -func (obj *flowArp) setNil() { - obj.hardwareTypeHolder = nil - obj.protocolTypeHolder = nil - obj.hardwareLengthHolder = nil - obj.protocolLengthHolder = nil - obj.operationHolder = nil - obj.senderHardwareAddrHolder = nil - obj.senderProtocolAddrHolder = nil - obj.targetHardwareAddrHolder = nil - obj.targetProtocolAddrHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowArp is aRP packet header -type FlowArp interface { - Validation - // msg marshals FlowArp to protobuf object *otg.FlowArp - // and doesn't set defaults - msg() *otg.FlowArp - // setMsg unmarshals FlowArp from protobuf object *otg.FlowArp - // and doesn't set defaults - setMsg(*otg.FlowArp) FlowArp - // provides marshal interface - Marshal() marshalFlowArp - // provides unmarshal interface - Unmarshal() unMarshalFlowArp - // validate validates FlowArp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowArp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // HardwareType returns PatternFlowArpHardwareType, set in FlowArp. - // PatternFlowArpHardwareType is network link protocol type - HardwareType() PatternFlowArpHardwareType - // SetHardwareType assigns PatternFlowArpHardwareType provided by user to FlowArp. - // PatternFlowArpHardwareType is network link protocol type - SetHardwareType(value PatternFlowArpHardwareType) FlowArp - // HasHardwareType checks if HardwareType has been set in FlowArp - HasHardwareType() bool - // ProtocolType returns PatternFlowArpProtocolType, set in FlowArp. - // PatternFlowArpProtocolType is the internetwork protocol for which the ARP request is intended - ProtocolType() PatternFlowArpProtocolType - // SetProtocolType assigns PatternFlowArpProtocolType provided by user to FlowArp. - // PatternFlowArpProtocolType is the internetwork protocol for which the ARP request is intended - SetProtocolType(value PatternFlowArpProtocolType) FlowArp - // HasProtocolType checks if ProtocolType has been set in FlowArp - HasProtocolType() bool - // HardwareLength returns PatternFlowArpHardwareLength, set in FlowArp. - // PatternFlowArpHardwareLength is length (in octets) of a hardware address - HardwareLength() PatternFlowArpHardwareLength - // SetHardwareLength assigns PatternFlowArpHardwareLength provided by user to FlowArp. - // PatternFlowArpHardwareLength is length (in octets) of a hardware address - SetHardwareLength(value PatternFlowArpHardwareLength) FlowArp - // HasHardwareLength checks if HardwareLength has been set in FlowArp - HasHardwareLength() bool - // ProtocolLength returns PatternFlowArpProtocolLength, set in FlowArp. - // PatternFlowArpProtocolLength is length (in octets) of internetwork addresses - ProtocolLength() PatternFlowArpProtocolLength - // SetProtocolLength assigns PatternFlowArpProtocolLength provided by user to FlowArp. - // PatternFlowArpProtocolLength is length (in octets) of internetwork addresses - SetProtocolLength(value PatternFlowArpProtocolLength) FlowArp - // HasProtocolLength checks if ProtocolLength has been set in FlowArp - HasProtocolLength() bool - // Operation returns PatternFlowArpOperation, set in FlowArp. - // PatternFlowArpOperation is the operation that the sender is performing - Operation() PatternFlowArpOperation - // SetOperation assigns PatternFlowArpOperation provided by user to FlowArp. - // PatternFlowArpOperation is the operation that the sender is performing - SetOperation(value PatternFlowArpOperation) FlowArp - // HasOperation checks if Operation has been set in FlowArp - HasOperation() bool - // SenderHardwareAddr returns PatternFlowArpSenderHardwareAddr, set in FlowArp. - // PatternFlowArpSenderHardwareAddr is media address of the sender - SenderHardwareAddr() PatternFlowArpSenderHardwareAddr - // SetSenderHardwareAddr assigns PatternFlowArpSenderHardwareAddr provided by user to FlowArp. - // PatternFlowArpSenderHardwareAddr is media address of the sender - SetSenderHardwareAddr(value PatternFlowArpSenderHardwareAddr) FlowArp - // HasSenderHardwareAddr checks if SenderHardwareAddr has been set in FlowArp - HasSenderHardwareAddr() bool - // SenderProtocolAddr returns PatternFlowArpSenderProtocolAddr, set in FlowArp. - // PatternFlowArpSenderProtocolAddr is internetwork address of the sender - SenderProtocolAddr() PatternFlowArpSenderProtocolAddr - // SetSenderProtocolAddr assigns PatternFlowArpSenderProtocolAddr provided by user to FlowArp. - // PatternFlowArpSenderProtocolAddr is internetwork address of the sender - SetSenderProtocolAddr(value PatternFlowArpSenderProtocolAddr) FlowArp - // HasSenderProtocolAddr checks if SenderProtocolAddr has been set in FlowArp - HasSenderProtocolAddr() bool - // TargetHardwareAddr returns PatternFlowArpTargetHardwareAddr, set in FlowArp. - // PatternFlowArpTargetHardwareAddr is media address of the target - TargetHardwareAddr() PatternFlowArpTargetHardwareAddr - // SetTargetHardwareAddr assigns PatternFlowArpTargetHardwareAddr provided by user to FlowArp. - // PatternFlowArpTargetHardwareAddr is media address of the target - SetTargetHardwareAddr(value PatternFlowArpTargetHardwareAddr) FlowArp - // HasTargetHardwareAddr checks if TargetHardwareAddr has been set in FlowArp - HasTargetHardwareAddr() bool - // TargetProtocolAddr returns PatternFlowArpTargetProtocolAddr, set in FlowArp. - // PatternFlowArpTargetProtocolAddr is internetwork address of the target - TargetProtocolAddr() PatternFlowArpTargetProtocolAddr - // SetTargetProtocolAddr assigns PatternFlowArpTargetProtocolAddr provided by user to FlowArp. - // PatternFlowArpTargetProtocolAddr is internetwork address of the target - SetTargetProtocolAddr(value PatternFlowArpTargetProtocolAddr) FlowArp - // HasTargetProtocolAddr checks if TargetProtocolAddr has been set in FlowArp - HasTargetProtocolAddr() bool - setNil() -} - -// description is TBD -// HardwareType returns a PatternFlowArpHardwareType -func (obj *flowArp) HardwareType() PatternFlowArpHardwareType { - if obj.obj.HardwareType == nil { - obj.obj.HardwareType = NewPatternFlowArpHardwareType().msg() - } - if obj.hardwareTypeHolder == nil { - obj.hardwareTypeHolder = &patternFlowArpHardwareType{obj: obj.obj.HardwareType} - } - return obj.hardwareTypeHolder -} - -// description is TBD -// HardwareType returns a PatternFlowArpHardwareType -func (obj *flowArp) HasHardwareType() bool { - return obj.obj.HardwareType != nil -} - -// description is TBD -// SetHardwareType sets the PatternFlowArpHardwareType value in the FlowArp object -func (obj *flowArp) SetHardwareType(value PatternFlowArpHardwareType) FlowArp { - - obj.hardwareTypeHolder = nil - obj.obj.HardwareType = value.msg() - - return obj -} - -// description is TBD -// ProtocolType returns a PatternFlowArpProtocolType -func (obj *flowArp) ProtocolType() PatternFlowArpProtocolType { - if obj.obj.ProtocolType == nil { - obj.obj.ProtocolType = NewPatternFlowArpProtocolType().msg() - } - if obj.protocolTypeHolder == nil { - obj.protocolTypeHolder = &patternFlowArpProtocolType{obj: obj.obj.ProtocolType} - } - return obj.protocolTypeHolder -} - -// description is TBD -// ProtocolType returns a PatternFlowArpProtocolType -func (obj *flowArp) HasProtocolType() bool { - return obj.obj.ProtocolType != nil -} - -// description is TBD -// SetProtocolType sets the PatternFlowArpProtocolType value in the FlowArp object -func (obj *flowArp) SetProtocolType(value PatternFlowArpProtocolType) FlowArp { - - obj.protocolTypeHolder = nil - obj.obj.ProtocolType = value.msg() - - return obj -} - -// description is TBD -// HardwareLength returns a PatternFlowArpHardwareLength -func (obj *flowArp) HardwareLength() PatternFlowArpHardwareLength { - if obj.obj.HardwareLength == nil { - obj.obj.HardwareLength = NewPatternFlowArpHardwareLength().msg() - } - if obj.hardwareLengthHolder == nil { - obj.hardwareLengthHolder = &patternFlowArpHardwareLength{obj: obj.obj.HardwareLength} - } - return obj.hardwareLengthHolder -} - -// description is TBD -// HardwareLength returns a PatternFlowArpHardwareLength -func (obj *flowArp) HasHardwareLength() bool { - return obj.obj.HardwareLength != nil -} - -// description is TBD -// SetHardwareLength sets the PatternFlowArpHardwareLength value in the FlowArp object -func (obj *flowArp) SetHardwareLength(value PatternFlowArpHardwareLength) FlowArp { - - obj.hardwareLengthHolder = nil - obj.obj.HardwareLength = value.msg() - - return obj -} - -// description is TBD -// ProtocolLength returns a PatternFlowArpProtocolLength -func (obj *flowArp) ProtocolLength() PatternFlowArpProtocolLength { - if obj.obj.ProtocolLength == nil { - obj.obj.ProtocolLength = NewPatternFlowArpProtocolLength().msg() - } - if obj.protocolLengthHolder == nil { - obj.protocolLengthHolder = &patternFlowArpProtocolLength{obj: obj.obj.ProtocolLength} - } - return obj.protocolLengthHolder -} - -// description is TBD -// ProtocolLength returns a PatternFlowArpProtocolLength -func (obj *flowArp) HasProtocolLength() bool { - return obj.obj.ProtocolLength != nil -} - -// description is TBD -// SetProtocolLength sets the PatternFlowArpProtocolLength value in the FlowArp object -func (obj *flowArp) SetProtocolLength(value PatternFlowArpProtocolLength) FlowArp { - - obj.protocolLengthHolder = nil - obj.obj.ProtocolLength = value.msg() - - return obj -} - -// description is TBD -// Operation returns a PatternFlowArpOperation -func (obj *flowArp) Operation() PatternFlowArpOperation { - if obj.obj.Operation == nil { - obj.obj.Operation = NewPatternFlowArpOperation().msg() - } - if obj.operationHolder == nil { - obj.operationHolder = &patternFlowArpOperation{obj: obj.obj.Operation} - } - return obj.operationHolder -} - -// description is TBD -// Operation returns a PatternFlowArpOperation -func (obj *flowArp) HasOperation() bool { - return obj.obj.Operation != nil -} - -// description is TBD -// SetOperation sets the PatternFlowArpOperation value in the FlowArp object -func (obj *flowArp) SetOperation(value PatternFlowArpOperation) FlowArp { - - obj.operationHolder = nil - obj.obj.Operation = value.msg() - - return obj -} - -// description is TBD -// SenderHardwareAddr returns a PatternFlowArpSenderHardwareAddr -func (obj *flowArp) SenderHardwareAddr() PatternFlowArpSenderHardwareAddr { - if obj.obj.SenderHardwareAddr == nil { - obj.obj.SenderHardwareAddr = NewPatternFlowArpSenderHardwareAddr().msg() - } - if obj.senderHardwareAddrHolder == nil { - obj.senderHardwareAddrHolder = &patternFlowArpSenderHardwareAddr{obj: obj.obj.SenderHardwareAddr} - } - return obj.senderHardwareAddrHolder -} - -// description is TBD -// SenderHardwareAddr returns a PatternFlowArpSenderHardwareAddr -func (obj *flowArp) HasSenderHardwareAddr() bool { - return obj.obj.SenderHardwareAddr != nil -} - -// description is TBD -// SetSenderHardwareAddr sets the PatternFlowArpSenderHardwareAddr value in the FlowArp object -func (obj *flowArp) SetSenderHardwareAddr(value PatternFlowArpSenderHardwareAddr) FlowArp { - - obj.senderHardwareAddrHolder = nil - obj.obj.SenderHardwareAddr = value.msg() - - return obj -} - -// description is TBD -// SenderProtocolAddr returns a PatternFlowArpSenderProtocolAddr -func (obj *flowArp) SenderProtocolAddr() PatternFlowArpSenderProtocolAddr { - if obj.obj.SenderProtocolAddr == nil { - obj.obj.SenderProtocolAddr = NewPatternFlowArpSenderProtocolAddr().msg() - } - if obj.senderProtocolAddrHolder == nil { - obj.senderProtocolAddrHolder = &patternFlowArpSenderProtocolAddr{obj: obj.obj.SenderProtocolAddr} - } - return obj.senderProtocolAddrHolder -} - -// description is TBD -// SenderProtocolAddr returns a PatternFlowArpSenderProtocolAddr -func (obj *flowArp) HasSenderProtocolAddr() bool { - return obj.obj.SenderProtocolAddr != nil -} - -// description is TBD -// SetSenderProtocolAddr sets the PatternFlowArpSenderProtocolAddr value in the FlowArp object -func (obj *flowArp) SetSenderProtocolAddr(value PatternFlowArpSenderProtocolAddr) FlowArp { - - obj.senderProtocolAddrHolder = nil - obj.obj.SenderProtocolAddr = value.msg() - - return obj -} - -// description is TBD -// TargetHardwareAddr returns a PatternFlowArpTargetHardwareAddr -func (obj *flowArp) TargetHardwareAddr() PatternFlowArpTargetHardwareAddr { - if obj.obj.TargetHardwareAddr == nil { - obj.obj.TargetHardwareAddr = NewPatternFlowArpTargetHardwareAddr().msg() - } - if obj.targetHardwareAddrHolder == nil { - obj.targetHardwareAddrHolder = &patternFlowArpTargetHardwareAddr{obj: obj.obj.TargetHardwareAddr} - } - return obj.targetHardwareAddrHolder -} - -// description is TBD -// TargetHardwareAddr returns a PatternFlowArpTargetHardwareAddr -func (obj *flowArp) HasTargetHardwareAddr() bool { - return obj.obj.TargetHardwareAddr != nil -} - -// description is TBD -// SetTargetHardwareAddr sets the PatternFlowArpTargetHardwareAddr value in the FlowArp object -func (obj *flowArp) SetTargetHardwareAddr(value PatternFlowArpTargetHardwareAddr) FlowArp { - - obj.targetHardwareAddrHolder = nil - obj.obj.TargetHardwareAddr = value.msg() - - return obj -} - -// description is TBD -// TargetProtocolAddr returns a PatternFlowArpTargetProtocolAddr -func (obj *flowArp) TargetProtocolAddr() PatternFlowArpTargetProtocolAddr { - if obj.obj.TargetProtocolAddr == nil { - obj.obj.TargetProtocolAddr = NewPatternFlowArpTargetProtocolAddr().msg() - } - if obj.targetProtocolAddrHolder == nil { - obj.targetProtocolAddrHolder = &patternFlowArpTargetProtocolAddr{obj: obj.obj.TargetProtocolAddr} - } - return obj.targetProtocolAddrHolder -} - -// description is TBD -// TargetProtocolAddr returns a PatternFlowArpTargetProtocolAddr -func (obj *flowArp) HasTargetProtocolAddr() bool { - return obj.obj.TargetProtocolAddr != nil -} - -// description is TBD -// SetTargetProtocolAddr sets the PatternFlowArpTargetProtocolAddr value in the FlowArp object -func (obj *flowArp) SetTargetProtocolAddr(value PatternFlowArpTargetProtocolAddr) FlowArp { - - obj.targetProtocolAddrHolder = nil - obj.obj.TargetProtocolAddr = value.msg() - - return obj -} - -func (obj *flowArp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.HardwareType != nil { - - obj.HardwareType().validateObj(vObj, set_default) - } - - if obj.obj.ProtocolType != nil { - - obj.ProtocolType().validateObj(vObj, set_default) - } - - if obj.obj.HardwareLength != nil { - - obj.HardwareLength().validateObj(vObj, set_default) - } - - if obj.obj.ProtocolLength != nil { - - obj.ProtocolLength().validateObj(vObj, set_default) - } - - if obj.obj.Operation != nil { - - obj.Operation().validateObj(vObj, set_default) - } - - if obj.obj.SenderHardwareAddr != nil { - - obj.SenderHardwareAddr().validateObj(vObj, set_default) - } - - if obj.obj.SenderProtocolAddr != nil { - - obj.SenderProtocolAddr().validateObj(vObj, set_default) - } - - if obj.obj.TargetHardwareAddr != nil { - - obj.TargetHardwareAddr().validateObj(vObj, set_default) - } - - if obj.obj.TargetProtocolAddr != nil { - - obj.TargetProtocolAddr().validateObj(vObj, set_default) - } - -} - -func (obj *flowArp) setDefault() { - -} - -// ***** FlowIcmp ***** -type flowIcmp struct { - validation - obj *otg.FlowIcmp - marshaller marshalFlowIcmp - unMarshaller unMarshalFlowIcmp - echoHolder FlowIcmpEcho -} - -func NewFlowIcmp() FlowIcmp { - obj := flowIcmp{obj: &otg.FlowIcmp{}} - obj.setDefault() - return &obj -} - -func (obj *flowIcmp) msg() *otg.FlowIcmp { - return obj.obj -} - -func (obj *flowIcmp) setMsg(msg *otg.FlowIcmp) FlowIcmp { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIcmp struct { - obj *flowIcmp -} - -type marshalFlowIcmp interface { - // ToProto marshals FlowIcmp to protobuf object *otg.FlowIcmp - ToProto() (*otg.FlowIcmp, error) - // ToPbText marshals FlowIcmp to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIcmp to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIcmp to JSON text - ToJson() (string, error) -} - -type unMarshalflowIcmp struct { - obj *flowIcmp -} - -type unMarshalFlowIcmp interface { - // FromProto unmarshals FlowIcmp from protobuf object *otg.FlowIcmp - FromProto(msg *otg.FlowIcmp) (FlowIcmp, error) - // FromPbText unmarshals FlowIcmp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIcmp from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIcmp from JSON text - FromJson(value string) error -} - -func (obj *flowIcmp) Marshal() marshalFlowIcmp { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIcmp{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIcmp) Unmarshal() unMarshalFlowIcmp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIcmp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIcmp) ToProto() (*otg.FlowIcmp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIcmp) FromProto(msg *otg.FlowIcmp) (FlowIcmp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIcmp) 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 *unMarshalflowIcmp) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowIcmp) 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 *unMarshalflowIcmp) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowIcmp) 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 *unMarshalflowIcmp) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowIcmp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIcmp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIcmp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIcmp) Clone() (FlowIcmp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIcmp() - 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 -} - -func (obj *flowIcmp) setNil() { - obj.echoHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowIcmp is iCMP packet header -type FlowIcmp interface { - Validation - // msg marshals FlowIcmp to protobuf object *otg.FlowIcmp - // and doesn't set defaults - msg() *otg.FlowIcmp - // setMsg unmarshals FlowIcmp from protobuf object *otg.FlowIcmp - // and doesn't set defaults - setMsg(*otg.FlowIcmp) FlowIcmp - // provides marshal interface - Marshal() marshalFlowIcmp - // provides unmarshal interface - Unmarshal() unMarshalFlowIcmp - // validate validates FlowIcmp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIcmp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowIcmpChoiceEnum, set in FlowIcmp - Choice() FlowIcmpChoiceEnum - // setChoice assigns FlowIcmpChoiceEnum provided by user to FlowIcmp - setChoice(value FlowIcmpChoiceEnum) FlowIcmp - // HasChoice checks if Choice has been set in FlowIcmp - HasChoice() bool - // Echo returns FlowIcmpEcho, set in FlowIcmp. - // FlowIcmpEcho is packet Header for ICMP echo request - Echo() FlowIcmpEcho - // SetEcho assigns FlowIcmpEcho provided by user to FlowIcmp. - // FlowIcmpEcho is packet Header for ICMP echo request - SetEcho(value FlowIcmpEcho) FlowIcmp - // HasEcho checks if Echo has been set in FlowIcmp - HasEcho() bool - setNil() -} - -type FlowIcmpChoiceEnum string - -// Enum of Choice on FlowIcmp -var FlowIcmpChoice = struct { - ECHO FlowIcmpChoiceEnum -}{ - ECHO: FlowIcmpChoiceEnum("echo"), -} - -func (obj *flowIcmp) Choice() FlowIcmpChoiceEnum { - return FlowIcmpChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowIcmp) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowIcmp) setChoice(value FlowIcmpChoiceEnum) FlowIcmp { - intValue, ok := otg.FlowIcmp_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowIcmpChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowIcmp_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Echo = nil - obj.echoHolder = nil - - if value == FlowIcmpChoice.ECHO { - obj.obj.Echo = NewFlowIcmpEcho().msg() - } - - return obj -} - -// description is TBD -// Echo returns a FlowIcmpEcho -func (obj *flowIcmp) Echo() FlowIcmpEcho { - if obj.obj.Echo == nil { - obj.setChoice(FlowIcmpChoice.ECHO) - } - if obj.echoHolder == nil { - obj.echoHolder = &flowIcmpEcho{obj: obj.obj.Echo} - } - return obj.echoHolder -} - -// description is TBD -// Echo returns a FlowIcmpEcho -func (obj *flowIcmp) HasEcho() bool { - return obj.obj.Echo != nil -} - -// description is TBD -// SetEcho sets the FlowIcmpEcho value in the FlowIcmp object -func (obj *flowIcmp) SetEcho(value FlowIcmpEcho) FlowIcmp { - obj.setChoice(FlowIcmpChoice.ECHO) - obj.echoHolder = nil - obj.obj.Echo = value.msg() - - return obj -} - -func (obj *flowIcmp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Echo != nil { - - obj.Echo().validateObj(vObj, set_default) - } - -} - -func (obj *flowIcmp) setDefault() { - var choices_set int = 0 - var choice FlowIcmpChoiceEnum - - if obj.obj.Echo != nil { - choices_set += 1 - choice = FlowIcmpChoice.ECHO - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowIcmpChoice.ECHO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowIcmp") - } - } else { - intVal := otg.FlowIcmp_Choice_Enum_value[string(choice)] - enumValue := otg.FlowIcmp_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowIcmpv6 ***** -type flowIcmpv6 struct { - validation - obj *otg.FlowIcmpv6 - marshaller marshalFlowIcmpv6 - unMarshaller unMarshalFlowIcmpv6 - echoHolder FlowIcmpv6Echo -} - -func NewFlowIcmpv6() FlowIcmpv6 { - obj := flowIcmpv6{obj: &otg.FlowIcmpv6{}} - obj.setDefault() - return &obj -} - -func (obj *flowIcmpv6) msg() *otg.FlowIcmpv6 { - return obj.obj -} - -func (obj *flowIcmpv6) setMsg(msg *otg.FlowIcmpv6) FlowIcmpv6 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIcmpv6 struct { - obj *flowIcmpv6 -} - -type marshalFlowIcmpv6 interface { - // ToProto marshals FlowIcmpv6 to protobuf object *otg.FlowIcmpv6 - ToProto() (*otg.FlowIcmpv6, error) - // ToPbText marshals FlowIcmpv6 to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIcmpv6 to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIcmpv6 to JSON text - ToJson() (string, error) -} - -type unMarshalflowIcmpv6 struct { - obj *flowIcmpv6 -} - -type unMarshalFlowIcmpv6 interface { - // FromProto unmarshals FlowIcmpv6 from protobuf object *otg.FlowIcmpv6 - FromProto(msg *otg.FlowIcmpv6) (FlowIcmpv6, error) - // FromPbText unmarshals FlowIcmpv6 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIcmpv6 from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIcmpv6 from JSON text - FromJson(value string) error -} - -func (obj *flowIcmpv6) Marshal() marshalFlowIcmpv6 { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIcmpv6{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIcmpv6) Unmarshal() unMarshalFlowIcmpv6 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIcmpv6{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIcmpv6) ToProto() (*otg.FlowIcmpv6, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIcmpv6) FromProto(msg *otg.FlowIcmpv6) (FlowIcmpv6, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIcmpv6) 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 *unMarshalflowIcmpv6) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowIcmpv6) 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 *unMarshalflowIcmpv6) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowIcmpv6) 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 *unMarshalflowIcmpv6) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowIcmpv6) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIcmpv6) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIcmpv6) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIcmpv6) Clone() (FlowIcmpv6, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIcmpv6() - 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 -} - -func (obj *flowIcmpv6) setNil() { - obj.echoHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowIcmpv6 is iCMPv6 packet header -type FlowIcmpv6 interface { - Validation - // msg marshals FlowIcmpv6 to protobuf object *otg.FlowIcmpv6 - // and doesn't set defaults - msg() *otg.FlowIcmpv6 - // setMsg unmarshals FlowIcmpv6 from protobuf object *otg.FlowIcmpv6 - // and doesn't set defaults - setMsg(*otg.FlowIcmpv6) FlowIcmpv6 - // provides marshal interface - Marshal() marshalFlowIcmpv6 - // provides unmarshal interface - Unmarshal() unMarshalFlowIcmpv6 - // validate validates FlowIcmpv6 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIcmpv6, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowIcmpv6ChoiceEnum, set in FlowIcmpv6 - Choice() FlowIcmpv6ChoiceEnum - // setChoice assigns FlowIcmpv6ChoiceEnum provided by user to FlowIcmpv6 - setChoice(value FlowIcmpv6ChoiceEnum) FlowIcmpv6 - // HasChoice checks if Choice has been set in FlowIcmpv6 - HasChoice() bool - // Echo returns FlowIcmpv6Echo, set in FlowIcmpv6. - // FlowIcmpv6Echo is packet Header for ICMPv6 Echo - Echo() FlowIcmpv6Echo - // SetEcho assigns FlowIcmpv6Echo provided by user to FlowIcmpv6. - // FlowIcmpv6Echo is packet Header for ICMPv6 Echo - SetEcho(value FlowIcmpv6Echo) FlowIcmpv6 - // HasEcho checks if Echo has been set in FlowIcmpv6 - HasEcho() bool - setNil() -} - -type FlowIcmpv6ChoiceEnum string - -// Enum of Choice on FlowIcmpv6 -var FlowIcmpv6Choice = struct { - ECHO FlowIcmpv6ChoiceEnum -}{ - ECHO: FlowIcmpv6ChoiceEnum("echo"), -} - -func (obj *flowIcmpv6) Choice() FlowIcmpv6ChoiceEnum { - return FlowIcmpv6ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowIcmpv6) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowIcmpv6) setChoice(value FlowIcmpv6ChoiceEnum) FlowIcmpv6 { - intValue, ok := otg.FlowIcmpv6_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowIcmpv6ChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowIcmpv6_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Echo = nil - obj.echoHolder = nil - - if value == FlowIcmpv6Choice.ECHO { - obj.obj.Echo = NewFlowIcmpv6Echo().msg() - } - - return obj -} - -// description is TBD -// Echo returns a FlowIcmpv6Echo -func (obj *flowIcmpv6) Echo() FlowIcmpv6Echo { - if obj.obj.Echo == nil { - obj.setChoice(FlowIcmpv6Choice.ECHO) - } - if obj.echoHolder == nil { - obj.echoHolder = &flowIcmpv6Echo{obj: obj.obj.Echo} - } - return obj.echoHolder -} - -// description is TBD -// Echo returns a FlowIcmpv6Echo -func (obj *flowIcmpv6) HasEcho() bool { - return obj.obj.Echo != nil -} - -// description is TBD -// SetEcho sets the FlowIcmpv6Echo value in the FlowIcmpv6 object -func (obj *flowIcmpv6) SetEcho(value FlowIcmpv6Echo) FlowIcmpv6 { - obj.setChoice(FlowIcmpv6Choice.ECHO) - obj.echoHolder = nil - obj.obj.Echo = value.msg() - - return obj -} - -func (obj *flowIcmpv6) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Echo != nil { - - obj.Echo().validateObj(vObj, set_default) - } - -} - -func (obj *flowIcmpv6) setDefault() { - var choices_set int = 0 - var choice FlowIcmpv6ChoiceEnum - - if obj.obj.Echo != nil { - choices_set += 1 - choice = FlowIcmpv6Choice.ECHO - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowIcmpv6Choice.ECHO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowIcmpv6") - } - } else { - intVal := otg.FlowIcmpv6_Choice_Enum_value[string(choice)] - enumValue := otg.FlowIcmpv6_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowPpp ***** -type flowPpp struct { - validation - obj *otg.FlowPpp - marshaller marshalFlowPpp - unMarshaller unMarshalFlowPpp - addressHolder PatternFlowPppAddress - controlHolder PatternFlowPppControl - protocolTypeHolder PatternFlowPppProtocolType -} - -func NewFlowPpp() FlowPpp { - obj := flowPpp{obj: &otg.FlowPpp{}} - obj.setDefault() - return &obj -} - -func (obj *flowPpp) msg() *otg.FlowPpp { - return obj.obj -} - -func (obj *flowPpp) setMsg(msg *otg.FlowPpp) FlowPpp { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowPpp struct { - obj *flowPpp -} - -type marshalFlowPpp interface { - // ToProto marshals FlowPpp to protobuf object *otg.FlowPpp - ToProto() (*otg.FlowPpp, error) - // ToPbText marshals FlowPpp to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowPpp to YAML text - ToYaml() (string, error) - // ToJson marshals FlowPpp to JSON text - ToJson() (string, error) -} - -type unMarshalflowPpp struct { - obj *flowPpp -} - -type unMarshalFlowPpp interface { - // FromProto unmarshals FlowPpp from protobuf object *otg.FlowPpp - FromProto(msg *otg.FlowPpp) (FlowPpp, error) - // FromPbText unmarshals FlowPpp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowPpp from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowPpp from JSON text - FromJson(value string) error -} - -func (obj *flowPpp) Marshal() marshalFlowPpp { - if obj.marshaller == nil { - obj.marshaller = &marshalflowPpp{obj: obj} - } - return obj.marshaller -} - -func (obj *flowPpp) Unmarshal() unMarshalFlowPpp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowPpp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowPpp) ToProto() (*otg.FlowPpp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowPpp) FromProto(msg *otg.FlowPpp) (FlowPpp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowPpp) 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 *unMarshalflowPpp) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowPpp) 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 *unMarshalflowPpp) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowPpp) 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 *unMarshalflowPpp) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowPpp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowPpp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowPpp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowPpp) Clone() (FlowPpp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowPpp() - 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 -} - -func (obj *flowPpp) setNil() { - obj.addressHolder = nil - obj.controlHolder = nil - obj.protocolTypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowPpp is pPP packet header -type FlowPpp interface { - Validation - // msg marshals FlowPpp to protobuf object *otg.FlowPpp - // and doesn't set defaults - msg() *otg.FlowPpp - // setMsg unmarshals FlowPpp from protobuf object *otg.FlowPpp - // and doesn't set defaults - setMsg(*otg.FlowPpp) FlowPpp - // provides marshal interface - Marshal() marshalFlowPpp - // provides unmarshal interface - Unmarshal() unMarshalFlowPpp - // validate validates FlowPpp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowPpp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Address returns PatternFlowPppAddress, set in FlowPpp. - // PatternFlowPppAddress is pPP address - Address() PatternFlowPppAddress - // SetAddress assigns PatternFlowPppAddress provided by user to FlowPpp. - // PatternFlowPppAddress is pPP address - SetAddress(value PatternFlowPppAddress) FlowPpp - // HasAddress checks if Address has been set in FlowPpp - HasAddress() bool - // Control returns PatternFlowPppControl, set in FlowPpp. - // PatternFlowPppControl is pPP control - Control() PatternFlowPppControl - // SetControl assigns PatternFlowPppControl provided by user to FlowPpp. - // PatternFlowPppControl is pPP control - SetControl(value PatternFlowPppControl) FlowPpp - // HasControl checks if Control has been set in FlowPpp - HasControl() bool - // ProtocolType returns PatternFlowPppProtocolType, set in FlowPpp. - // PatternFlowPppProtocolType is pPP protocol type - ProtocolType() PatternFlowPppProtocolType - // SetProtocolType assigns PatternFlowPppProtocolType provided by user to FlowPpp. - // PatternFlowPppProtocolType is pPP protocol type - SetProtocolType(value PatternFlowPppProtocolType) FlowPpp - // HasProtocolType checks if ProtocolType has been set in FlowPpp - HasProtocolType() bool - setNil() -} - -// description is TBD -// Address returns a PatternFlowPppAddress -func (obj *flowPpp) Address() PatternFlowPppAddress { - if obj.obj.Address == nil { - obj.obj.Address = NewPatternFlowPppAddress().msg() - } - if obj.addressHolder == nil { - obj.addressHolder = &patternFlowPppAddress{obj: obj.obj.Address} - } - return obj.addressHolder -} - -// description is TBD -// Address returns a PatternFlowPppAddress -func (obj *flowPpp) HasAddress() bool { - return obj.obj.Address != nil -} - -// description is TBD -// SetAddress sets the PatternFlowPppAddress value in the FlowPpp object -func (obj *flowPpp) SetAddress(value PatternFlowPppAddress) FlowPpp { - - obj.addressHolder = nil - obj.obj.Address = value.msg() - - return obj -} - -// description is TBD -// Control returns a PatternFlowPppControl -func (obj *flowPpp) Control() PatternFlowPppControl { - if obj.obj.Control == nil { - obj.obj.Control = NewPatternFlowPppControl().msg() - } - if obj.controlHolder == nil { - obj.controlHolder = &patternFlowPppControl{obj: obj.obj.Control} - } - return obj.controlHolder -} - -// description is TBD -// Control returns a PatternFlowPppControl -func (obj *flowPpp) HasControl() bool { - return obj.obj.Control != nil -} - -// description is TBD -// SetControl sets the PatternFlowPppControl value in the FlowPpp object -func (obj *flowPpp) SetControl(value PatternFlowPppControl) FlowPpp { - - obj.controlHolder = nil - obj.obj.Control = value.msg() - - return obj -} - -// description is TBD -// ProtocolType returns a PatternFlowPppProtocolType -func (obj *flowPpp) ProtocolType() PatternFlowPppProtocolType { - if obj.obj.ProtocolType == nil { - obj.obj.ProtocolType = NewPatternFlowPppProtocolType().msg() - } - if obj.protocolTypeHolder == nil { - obj.protocolTypeHolder = &patternFlowPppProtocolType{obj: obj.obj.ProtocolType} - } - return obj.protocolTypeHolder -} - -// description is TBD -// ProtocolType returns a PatternFlowPppProtocolType -func (obj *flowPpp) HasProtocolType() bool { - return obj.obj.ProtocolType != nil -} - -// description is TBD -// SetProtocolType sets the PatternFlowPppProtocolType value in the FlowPpp object -func (obj *flowPpp) SetProtocolType(value PatternFlowPppProtocolType) FlowPpp { - - obj.protocolTypeHolder = nil - obj.obj.ProtocolType = value.msg() - - return obj -} - -func (obj *flowPpp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Address != nil { - - obj.Address().validateObj(vObj, set_default) - } - - if obj.obj.Control != nil { - - obj.Control().validateObj(vObj, set_default) - } - - if obj.obj.ProtocolType != nil { - - obj.ProtocolType().validateObj(vObj, set_default) - } - -} - -func (obj *flowPpp) setDefault() { - -} - -// ***** FlowIgmpv1 ***** -type flowIgmpv1 struct { - validation - obj *otg.FlowIgmpv1 - marshaller marshalFlowIgmpv1 - unMarshaller unMarshalFlowIgmpv1 - versionHolder PatternFlowIgmpv1Version - typeHolder PatternFlowIgmpv1Type - unusedHolder PatternFlowIgmpv1Unused - checksumHolder PatternFlowIgmpv1Checksum - groupAddressHolder PatternFlowIgmpv1GroupAddress -} - -func NewFlowIgmpv1() FlowIgmpv1 { - obj := flowIgmpv1{obj: &otg.FlowIgmpv1{}} - obj.setDefault() - return &obj -} - -func (obj *flowIgmpv1) msg() *otg.FlowIgmpv1 { - return obj.obj -} - -func (obj *flowIgmpv1) setMsg(msg *otg.FlowIgmpv1) FlowIgmpv1 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIgmpv1 struct { - obj *flowIgmpv1 -} - -type marshalFlowIgmpv1 interface { - // ToProto marshals FlowIgmpv1 to protobuf object *otg.FlowIgmpv1 - ToProto() (*otg.FlowIgmpv1, error) - // ToPbText marshals FlowIgmpv1 to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIgmpv1 to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIgmpv1 to JSON text - ToJson() (string, error) -} - -type unMarshalflowIgmpv1 struct { - obj *flowIgmpv1 -} - -type unMarshalFlowIgmpv1 interface { - // FromProto unmarshals FlowIgmpv1 from protobuf object *otg.FlowIgmpv1 - FromProto(msg *otg.FlowIgmpv1) (FlowIgmpv1, error) - // FromPbText unmarshals FlowIgmpv1 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIgmpv1 from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIgmpv1 from JSON text - FromJson(value string) error -} - -func (obj *flowIgmpv1) Marshal() marshalFlowIgmpv1 { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIgmpv1{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIgmpv1) Unmarshal() unMarshalFlowIgmpv1 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIgmpv1{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIgmpv1) ToProto() (*otg.FlowIgmpv1, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIgmpv1) FromProto(msg *otg.FlowIgmpv1) (FlowIgmpv1, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIgmpv1) 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 *unMarshalflowIgmpv1) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowIgmpv1) 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 *unMarshalflowIgmpv1) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowIgmpv1) 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 *unMarshalflowIgmpv1) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowIgmpv1) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIgmpv1) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIgmpv1) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIgmpv1) Clone() (FlowIgmpv1, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIgmpv1() - 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 -} - -func (obj *flowIgmpv1) setNil() { - obj.versionHolder = nil - obj.typeHolder = nil - obj.unusedHolder = nil - obj.checksumHolder = nil - obj.groupAddressHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowIgmpv1 is iGMPv1 packet header -type FlowIgmpv1 interface { - Validation - // msg marshals FlowIgmpv1 to protobuf object *otg.FlowIgmpv1 - // and doesn't set defaults - msg() *otg.FlowIgmpv1 - // setMsg unmarshals FlowIgmpv1 from protobuf object *otg.FlowIgmpv1 - // and doesn't set defaults - setMsg(*otg.FlowIgmpv1) FlowIgmpv1 - // provides marshal interface - Marshal() marshalFlowIgmpv1 - // provides unmarshal interface - Unmarshal() unMarshalFlowIgmpv1 - // validate validates FlowIgmpv1 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIgmpv1, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Version returns PatternFlowIgmpv1Version, set in FlowIgmpv1. - // PatternFlowIgmpv1Version is version number - Version() PatternFlowIgmpv1Version - // SetVersion assigns PatternFlowIgmpv1Version provided by user to FlowIgmpv1. - // PatternFlowIgmpv1Version is version number - SetVersion(value PatternFlowIgmpv1Version) FlowIgmpv1 - // HasVersion checks if Version has been set in FlowIgmpv1 - HasVersion() bool - // Type returns PatternFlowIgmpv1Type, set in FlowIgmpv1. - // PatternFlowIgmpv1Type is type of message - Type() PatternFlowIgmpv1Type - // SetType assigns PatternFlowIgmpv1Type provided by user to FlowIgmpv1. - // PatternFlowIgmpv1Type is type of message - SetType(value PatternFlowIgmpv1Type) FlowIgmpv1 - // HasType checks if Type has been set in FlowIgmpv1 - HasType() bool - // Unused returns PatternFlowIgmpv1Unused, set in FlowIgmpv1. - // PatternFlowIgmpv1Unused is unused - Unused() PatternFlowIgmpv1Unused - // SetUnused assigns PatternFlowIgmpv1Unused provided by user to FlowIgmpv1. - // PatternFlowIgmpv1Unused is unused - SetUnused(value PatternFlowIgmpv1Unused) FlowIgmpv1 - // HasUnused checks if Unused has been set in FlowIgmpv1 - HasUnused() bool - // Checksum returns PatternFlowIgmpv1Checksum, set in FlowIgmpv1. - // PatternFlowIgmpv1Checksum is checksum - Checksum() PatternFlowIgmpv1Checksum - // SetChecksum assigns PatternFlowIgmpv1Checksum provided by user to FlowIgmpv1. - // PatternFlowIgmpv1Checksum is checksum - SetChecksum(value PatternFlowIgmpv1Checksum) FlowIgmpv1 - // HasChecksum checks if Checksum has been set in FlowIgmpv1 - HasChecksum() bool - // GroupAddress returns PatternFlowIgmpv1GroupAddress, set in FlowIgmpv1. - // PatternFlowIgmpv1GroupAddress is group address - GroupAddress() PatternFlowIgmpv1GroupAddress - // SetGroupAddress assigns PatternFlowIgmpv1GroupAddress provided by user to FlowIgmpv1. - // PatternFlowIgmpv1GroupAddress is group address - SetGroupAddress(value PatternFlowIgmpv1GroupAddress) FlowIgmpv1 - // HasGroupAddress checks if GroupAddress has been set in FlowIgmpv1 - HasGroupAddress() bool - setNil() -} - -// description is TBD -// Version returns a PatternFlowIgmpv1Version -func (obj *flowIgmpv1) Version() PatternFlowIgmpv1Version { - if obj.obj.Version == nil { - obj.obj.Version = NewPatternFlowIgmpv1Version().msg() - } - if obj.versionHolder == nil { - obj.versionHolder = &patternFlowIgmpv1Version{obj: obj.obj.Version} - } - return obj.versionHolder -} - -// description is TBD -// Version returns a PatternFlowIgmpv1Version -func (obj *flowIgmpv1) HasVersion() bool { - return obj.obj.Version != nil -} - -// description is TBD -// SetVersion sets the PatternFlowIgmpv1Version value in the FlowIgmpv1 object -func (obj *flowIgmpv1) SetVersion(value PatternFlowIgmpv1Version) FlowIgmpv1 { - - obj.versionHolder = nil - obj.obj.Version = value.msg() - - return obj -} - -// description is TBD -// Type returns a PatternFlowIgmpv1Type -func (obj *flowIgmpv1) Type() PatternFlowIgmpv1Type { - if obj.obj.Type == nil { - obj.obj.Type = NewPatternFlowIgmpv1Type().msg() - } - if obj.typeHolder == nil { - obj.typeHolder = &patternFlowIgmpv1Type{obj: obj.obj.Type} - } - return obj.typeHolder -} - -// description is TBD -// Type returns a PatternFlowIgmpv1Type -func (obj *flowIgmpv1) HasType() bool { - return obj.obj.Type != nil -} - -// description is TBD -// SetType sets the PatternFlowIgmpv1Type value in the FlowIgmpv1 object -func (obj *flowIgmpv1) SetType(value PatternFlowIgmpv1Type) FlowIgmpv1 { - - obj.typeHolder = nil - obj.obj.Type = value.msg() - - return obj -} - -// description is TBD -// Unused returns a PatternFlowIgmpv1Unused -func (obj *flowIgmpv1) Unused() PatternFlowIgmpv1Unused { - if obj.obj.Unused == nil { - obj.obj.Unused = NewPatternFlowIgmpv1Unused().msg() - } - if obj.unusedHolder == nil { - obj.unusedHolder = &patternFlowIgmpv1Unused{obj: obj.obj.Unused} - } - return obj.unusedHolder -} - -// description is TBD -// Unused returns a PatternFlowIgmpv1Unused -func (obj *flowIgmpv1) HasUnused() bool { - return obj.obj.Unused != nil -} - -// description is TBD -// SetUnused sets the PatternFlowIgmpv1Unused value in the FlowIgmpv1 object -func (obj *flowIgmpv1) SetUnused(value PatternFlowIgmpv1Unused) FlowIgmpv1 { - - obj.unusedHolder = nil - obj.obj.Unused = value.msg() - - return obj -} - -// description is TBD -// Checksum returns a PatternFlowIgmpv1Checksum -func (obj *flowIgmpv1) Checksum() PatternFlowIgmpv1Checksum { - if obj.obj.Checksum == nil { - obj.obj.Checksum = NewPatternFlowIgmpv1Checksum().msg() - } - if obj.checksumHolder == nil { - obj.checksumHolder = &patternFlowIgmpv1Checksum{obj: obj.obj.Checksum} - } - return obj.checksumHolder -} - -// description is TBD -// Checksum returns a PatternFlowIgmpv1Checksum -func (obj *flowIgmpv1) HasChecksum() bool { - return obj.obj.Checksum != nil -} - -// description is TBD -// SetChecksum sets the PatternFlowIgmpv1Checksum value in the FlowIgmpv1 object -func (obj *flowIgmpv1) SetChecksum(value PatternFlowIgmpv1Checksum) FlowIgmpv1 { - - obj.checksumHolder = nil - obj.obj.Checksum = value.msg() - - return obj -} - -// description is TBD -// GroupAddress returns a PatternFlowIgmpv1GroupAddress -func (obj *flowIgmpv1) GroupAddress() PatternFlowIgmpv1GroupAddress { - if obj.obj.GroupAddress == nil { - obj.obj.GroupAddress = NewPatternFlowIgmpv1GroupAddress().msg() - } - if obj.groupAddressHolder == nil { - obj.groupAddressHolder = &patternFlowIgmpv1GroupAddress{obj: obj.obj.GroupAddress} - } - return obj.groupAddressHolder -} - -// description is TBD -// GroupAddress returns a PatternFlowIgmpv1GroupAddress -func (obj *flowIgmpv1) HasGroupAddress() bool { - return obj.obj.GroupAddress != nil -} - -// description is TBD -// SetGroupAddress sets the PatternFlowIgmpv1GroupAddress value in the FlowIgmpv1 object -func (obj *flowIgmpv1) SetGroupAddress(value PatternFlowIgmpv1GroupAddress) FlowIgmpv1 { - - obj.groupAddressHolder = nil - obj.obj.GroupAddress = value.msg() - - return obj -} - -func (obj *flowIgmpv1) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Version != nil { - - obj.Version().validateObj(vObj, set_default) - } - - if obj.obj.Type != nil { - - obj.Type().validateObj(vObj, set_default) - } - - if obj.obj.Unused != nil { - - obj.Unused().validateObj(vObj, set_default) - } - - if obj.obj.Checksum != nil { - - obj.Checksum().validateObj(vObj, set_default) - } - - if obj.obj.GroupAddress != nil { - - obj.GroupAddress().validateObj(vObj, set_default) - } - -} - -func (obj *flowIgmpv1) setDefault() { - -} - -// ***** FlowMpls ***** -type flowMpls struct { - validation - obj *otg.FlowMpls - marshaller marshalFlowMpls - unMarshaller unMarshalFlowMpls - labelHolder PatternFlowMplsLabel - trafficClassHolder PatternFlowMplsTrafficClass - bottomOfStackHolder PatternFlowMplsBottomOfStack - timeToLiveHolder PatternFlowMplsTimeToLive -} - -func NewFlowMpls() FlowMpls { - obj := flowMpls{obj: &otg.FlowMpls{}} - obj.setDefault() - return &obj -} - -func (obj *flowMpls) msg() *otg.FlowMpls { - return obj.obj -} - -func (obj *flowMpls) setMsg(msg *otg.FlowMpls) FlowMpls { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowMpls struct { - obj *flowMpls -} - -type marshalFlowMpls interface { - // ToProto marshals FlowMpls to protobuf object *otg.FlowMpls - ToProto() (*otg.FlowMpls, error) - // ToPbText marshals FlowMpls to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowMpls to YAML text - ToYaml() (string, error) - // ToJson marshals FlowMpls to JSON text - ToJson() (string, error) -} - -type unMarshalflowMpls struct { - obj *flowMpls -} - -type unMarshalFlowMpls interface { - // FromProto unmarshals FlowMpls from protobuf object *otg.FlowMpls - FromProto(msg *otg.FlowMpls) (FlowMpls, error) - // FromPbText unmarshals FlowMpls from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowMpls from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowMpls from JSON text - FromJson(value string) error -} - -func (obj *flowMpls) Marshal() marshalFlowMpls { - if obj.marshaller == nil { - obj.marshaller = &marshalflowMpls{obj: obj} - } - return obj.marshaller -} - -func (obj *flowMpls) Unmarshal() unMarshalFlowMpls { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowMpls{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowMpls) ToProto() (*otg.FlowMpls, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowMpls) FromProto(msg *otg.FlowMpls) (FlowMpls, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowMpls) 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 *unMarshalflowMpls) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowMpls) 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 *unMarshalflowMpls) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowMpls) 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 *unMarshalflowMpls) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowMpls) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowMpls) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowMpls) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowMpls) Clone() (FlowMpls, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowMpls() - 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 -} - -func (obj *flowMpls) setNil() { - obj.labelHolder = nil - obj.trafficClassHolder = nil - obj.bottomOfStackHolder = nil - obj.timeToLiveHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowMpls is mPLS packet header; When configuring multiple such headers, the count shall not exceed 20. -type FlowMpls interface { - Validation - // msg marshals FlowMpls to protobuf object *otg.FlowMpls - // and doesn't set defaults - msg() *otg.FlowMpls - // setMsg unmarshals FlowMpls from protobuf object *otg.FlowMpls - // and doesn't set defaults - setMsg(*otg.FlowMpls) FlowMpls - // provides marshal interface - Marshal() marshalFlowMpls - // provides unmarshal interface - Unmarshal() unMarshalFlowMpls - // validate validates FlowMpls - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowMpls, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Label returns PatternFlowMplsLabel, set in FlowMpls. - // PatternFlowMplsLabel is label of routers - Label() PatternFlowMplsLabel - // SetLabel assigns PatternFlowMplsLabel provided by user to FlowMpls. - // PatternFlowMplsLabel is label of routers - SetLabel(value PatternFlowMplsLabel) FlowMpls - // HasLabel checks if Label has been set in FlowMpls - HasLabel() bool - // TrafficClass returns PatternFlowMplsTrafficClass, set in FlowMpls. - // PatternFlowMplsTrafficClass is traffic class - TrafficClass() PatternFlowMplsTrafficClass - // SetTrafficClass assigns PatternFlowMplsTrafficClass provided by user to FlowMpls. - // PatternFlowMplsTrafficClass is traffic class - SetTrafficClass(value PatternFlowMplsTrafficClass) FlowMpls - // HasTrafficClass checks if TrafficClass has been set in FlowMpls - HasTrafficClass() bool - // BottomOfStack returns PatternFlowMplsBottomOfStack, set in FlowMpls. - // PatternFlowMplsBottomOfStack is bottom of stack - BottomOfStack() PatternFlowMplsBottomOfStack - // SetBottomOfStack assigns PatternFlowMplsBottomOfStack provided by user to FlowMpls. - // PatternFlowMplsBottomOfStack is bottom of stack - SetBottomOfStack(value PatternFlowMplsBottomOfStack) FlowMpls - // HasBottomOfStack checks if BottomOfStack has been set in FlowMpls - HasBottomOfStack() bool - // TimeToLive returns PatternFlowMplsTimeToLive, set in FlowMpls. - // PatternFlowMplsTimeToLive is time to live - TimeToLive() PatternFlowMplsTimeToLive - // SetTimeToLive assigns PatternFlowMplsTimeToLive provided by user to FlowMpls. - // PatternFlowMplsTimeToLive is time to live - SetTimeToLive(value PatternFlowMplsTimeToLive) FlowMpls - // HasTimeToLive checks if TimeToLive has been set in FlowMpls - HasTimeToLive() bool - setNil() -} - -// description is TBD -// Label returns a PatternFlowMplsLabel -func (obj *flowMpls) Label() PatternFlowMplsLabel { - if obj.obj.Label == nil { - obj.obj.Label = NewPatternFlowMplsLabel().msg() - } - if obj.labelHolder == nil { - obj.labelHolder = &patternFlowMplsLabel{obj: obj.obj.Label} - } - return obj.labelHolder -} - -// description is TBD -// Label returns a PatternFlowMplsLabel -func (obj *flowMpls) HasLabel() bool { - return obj.obj.Label != nil -} - -// description is TBD -// SetLabel sets the PatternFlowMplsLabel value in the FlowMpls object -func (obj *flowMpls) SetLabel(value PatternFlowMplsLabel) FlowMpls { - - obj.labelHolder = nil - obj.obj.Label = value.msg() - - return obj -} - -// description is TBD -// TrafficClass returns a PatternFlowMplsTrafficClass -func (obj *flowMpls) TrafficClass() PatternFlowMplsTrafficClass { - if obj.obj.TrafficClass == nil { - obj.obj.TrafficClass = NewPatternFlowMplsTrafficClass().msg() - } - if obj.trafficClassHolder == nil { - obj.trafficClassHolder = &patternFlowMplsTrafficClass{obj: obj.obj.TrafficClass} - } - return obj.trafficClassHolder -} - -// description is TBD -// TrafficClass returns a PatternFlowMplsTrafficClass -func (obj *flowMpls) HasTrafficClass() bool { - return obj.obj.TrafficClass != nil -} - -// description is TBD -// SetTrafficClass sets the PatternFlowMplsTrafficClass value in the FlowMpls object -func (obj *flowMpls) SetTrafficClass(value PatternFlowMplsTrafficClass) FlowMpls { - - obj.trafficClassHolder = nil - obj.obj.TrafficClass = value.msg() - - return obj -} - -// description is TBD -// BottomOfStack returns a PatternFlowMplsBottomOfStack -func (obj *flowMpls) BottomOfStack() PatternFlowMplsBottomOfStack { - if obj.obj.BottomOfStack == nil { - obj.obj.BottomOfStack = NewPatternFlowMplsBottomOfStack().msg() - } - if obj.bottomOfStackHolder == nil { - obj.bottomOfStackHolder = &patternFlowMplsBottomOfStack{obj: obj.obj.BottomOfStack} - } - return obj.bottomOfStackHolder -} - -// description is TBD -// BottomOfStack returns a PatternFlowMplsBottomOfStack -func (obj *flowMpls) HasBottomOfStack() bool { - return obj.obj.BottomOfStack != nil -} - -// description is TBD -// SetBottomOfStack sets the PatternFlowMplsBottomOfStack value in the FlowMpls object -func (obj *flowMpls) SetBottomOfStack(value PatternFlowMplsBottomOfStack) FlowMpls { - - obj.bottomOfStackHolder = nil - obj.obj.BottomOfStack = value.msg() - - return obj -} - -// description is TBD -// TimeToLive returns a PatternFlowMplsTimeToLive -func (obj *flowMpls) TimeToLive() PatternFlowMplsTimeToLive { - if obj.obj.TimeToLive == nil { - obj.obj.TimeToLive = NewPatternFlowMplsTimeToLive().msg() - } - if obj.timeToLiveHolder == nil { - obj.timeToLiveHolder = &patternFlowMplsTimeToLive{obj: obj.obj.TimeToLive} - } - return obj.timeToLiveHolder -} - -// description is TBD -// TimeToLive returns a PatternFlowMplsTimeToLive -func (obj *flowMpls) HasTimeToLive() bool { - return obj.obj.TimeToLive != nil -} - -// description is TBD -// SetTimeToLive sets the PatternFlowMplsTimeToLive value in the FlowMpls object -func (obj *flowMpls) SetTimeToLive(value PatternFlowMplsTimeToLive) FlowMpls { - - obj.timeToLiveHolder = nil - obj.obj.TimeToLive = value.msg() - - return obj -} - -func (obj *flowMpls) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Label != nil { - - obj.Label().validateObj(vObj, set_default) - } - - if obj.obj.TrafficClass != nil { - - obj.TrafficClass().validateObj(vObj, set_default) - } - - if obj.obj.BottomOfStack != nil { - - obj.BottomOfStack().validateObj(vObj, set_default) - } - - if obj.obj.TimeToLive != nil { - - obj.TimeToLive().validateObj(vObj, set_default) - } - -} - -func (obj *flowMpls) setDefault() { - -} - -// ***** FlowSnmpv2C ***** -type flowSnmpv2C struct { - validation - obj *otg.FlowSnmpv2C - marshaller marshalFlowSnmpv2C - unMarshaller unMarshalFlowSnmpv2C - versionHolder PatternFlowSnmpv2CVersion - dataHolder FlowSnmpv2CData -} - -func NewFlowSnmpv2C() FlowSnmpv2C { - obj := flowSnmpv2C{obj: &otg.FlowSnmpv2C{}} - obj.setDefault() - return &obj -} - -func (obj *flowSnmpv2C) msg() *otg.FlowSnmpv2C { - return obj.obj -} - -func (obj *flowSnmpv2C) setMsg(msg *otg.FlowSnmpv2C) FlowSnmpv2C { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowSnmpv2C struct { - obj *flowSnmpv2C -} - -type marshalFlowSnmpv2C interface { - // ToProto marshals FlowSnmpv2C to protobuf object *otg.FlowSnmpv2C - ToProto() (*otg.FlowSnmpv2C, error) - // ToPbText marshals FlowSnmpv2C to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowSnmpv2C to YAML text - ToYaml() (string, error) - // ToJson marshals FlowSnmpv2C to JSON text - ToJson() (string, error) -} - -type unMarshalflowSnmpv2C struct { - obj *flowSnmpv2C -} - -type unMarshalFlowSnmpv2C interface { - // FromProto unmarshals FlowSnmpv2C from protobuf object *otg.FlowSnmpv2C - FromProto(msg *otg.FlowSnmpv2C) (FlowSnmpv2C, error) - // FromPbText unmarshals FlowSnmpv2C from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowSnmpv2C from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowSnmpv2C from JSON text - FromJson(value string) error -} - -func (obj *flowSnmpv2C) Marshal() marshalFlowSnmpv2C { - if obj.marshaller == nil { - obj.marshaller = &marshalflowSnmpv2C{obj: obj} - } - return obj.marshaller -} - -func (obj *flowSnmpv2C) Unmarshal() unMarshalFlowSnmpv2C { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowSnmpv2C{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowSnmpv2C) ToProto() (*otg.FlowSnmpv2C, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowSnmpv2C) FromProto(msg *otg.FlowSnmpv2C) (FlowSnmpv2C, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowSnmpv2C) 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 *unMarshalflowSnmpv2C) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowSnmpv2C) 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 *unMarshalflowSnmpv2C) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowSnmpv2C) 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 *unMarshalflowSnmpv2C) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowSnmpv2C) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowSnmpv2C) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowSnmpv2C) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowSnmpv2C) Clone() (FlowSnmpv2C, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowSnmpv2C() - 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 -} - -func (obj *flowSnmpv2C) setNil() { - obj.versionHolder = nil - obj.dataHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowSnmpv2C is sNMPv2C packet header as defined in RFC1901 and RFC3416. -type FlowSnmpv2C interface { - Validation - // msg marshals FlowSnmpv2C to protobuf object *otg.FlowSnmpv2C - // and doesn't set defaults - msg() *otg.FlowSnmpv2C - // setMsg unmarshals FlowSnmpv2C from protobuf object *otg.FlowSnmpv2C - // and doesn't set defaults - setMsg(*otg.FlowSnmpv2C) FlowSnmpv2C - // provides marshal interface - Marshal() marshalFlowSnmpv2C - // provides unmarshal interface - Unmarshal() unMarshalFlowSnmpv2C - // validate validates FlowSnmpv2C - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowSnmpv2C, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Version returns PatternFlowSnmpv2CVersion, set in FlowSnmpv2C. - Version() PatternFlowSnmpv2CVersion - // SetVersion assigns PatternFlowSnmpv2CVersion provided by user to FlowSnmpv2C. - SetVersion(value PatternFlowSnmpv2CVersion) FlowSnmpv2C - // HasVersion checks if Version has been set in FlowSnmpv2C - HasVersion() bool - // Community returns string, set in FlowSnmpv2C. - Community() string - // SetCommunity assigns string provided by user to FlowSnmpv2C - SetCommunity(value string) FlowSnmpv2C - // HasCommunity checks if Community has been set in FlowSnmpv2C - HasCommunity() bool - // Data returns FlowSnmpv2CData, set in FlowSnmpv2C. - Data() FlowSnmpv2CData - // SetData assigns FlowSnmpv2CData provided by user to FlowSnmpv2C. - SetData(value FlowSnmpv2CData) FlowSnmpv2C - setNil() -} - -// description is TBD -// Version returns a PatternFlowSnmpv2CVersion -func (obj *flowSnmpv2C) Version() PatternFlowSnmpv2CVersion { - if obj.obj.Version == nil { - obj.obj.Version = NewPatternFlowSnmpv2CVersion().msg() - } - if obj.versionHolder == nil { - obj.versionHolder = &patternFlowSnmpv2CVersion{obj: obj.obj.Version} - } - return obj.versionHolder -} - -// description is TBD -// Version returns a PatternFlowSnmpv2CVersion -func (obj *flowSnmpv2C) HasVersion() bool { - return obj.obj.Version != nil -} - -// description is TBD -// SetVersion sets the PatternFlowSnmpv2CVersion value in the FlowSnmpv2C object -func (obj *flowSnmpv2C) SetVersion(value PatternFlowSnmpv2CVersion) FlowSnmpv2C { - - obj.versionHolder = nil - obj.obj.Version = value.msg() - - return obj -} - -// It is an ASCII based octet string which identifies the SNMP community in which the sender and recipient of this message are located. It should match the read-only or read-write community string configured on the recipient for the PDU to be accepted. -// Community returns a string -func (obj *flowSnmpv2C) Community() string { - - return *obj.obj.Community - -} - -// It is an ASCII based octet string which identifies the SNMP community in which the sender and recipient of this message are located. It should match the read-only or read-write community string configured on the recipient for the PDU to be accepted. -// Community returns a string -func (obj *flowSnmpv2C) HasCommunity() bool { - return obj.obj.Community != nil -} - -// It is an ASCII based octet string which identifies the SNMP community in which the sender and recipient of this message are located. It should match the read-only or read-write community string configured on the recipient for the PDU to be accepted. -// SetCommunity sets the string value in the FlowSnmpv2C object -func (obj *flowSnmpv2C) SetCommunity(value string) FlowSnmpv2C { - - obj.obj.Community = &value - return obj -} - -// description is TBD -// Data returns a FlowSnmpv2CData -func (obj *flowSnmpv2C) Data() FlowSnmpv2CData { - if obj.obj.Data == nil { - obj.obj.Data = NewFlowSnmpv2CData().msg() - } - if obj.dataHolder == nil { - obj.dataHolder = &flowSnmpv2CData{obj: obj.obj.Data} - } - return obj.dataHolder -} - -// description is TBD -// SetData sets the FlowSnmpv2CData value in the FlowSnmpv2C object -func (obj *flowSnmpv2C) SetData(value FlowSnmpv2CData) FlowSnmpv2C { - - obj.dataHolder = nil - obj.obj.Data = value.msg() - - return obj -} - -func (obj *flowSnmpv2C) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Version != nil { - - obj.Version().validateObj(vObj, set_default) - } - - if obj.obj.Community != nil { - - if len(*obj.obj.Community) > 10000 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "None <= length of FlowSnmpv2C.Community <= 10000 but Got %d", - len(*obj.obj.Community))) - } - - } - - // Data is required - if obj.obj.Data == nil { - vObj.validationErrors = append(vObj.validationErrors, "Data is required field on interface FlowSnmpv2C") - } - - if obj.obj.Data != nil { - - obj.Data().validateObj(vObj, set_default) - } - -} - -func (obj *flowSnmpv2C) setDefault() { - if obj.obj.Community == nil { - obj.SetCommunity("community") - } - -} - -// ***** FlowRsvp ***** -type flowRsvp struct { - validation - obj *otg.FlowRsvp - marshaller marshalFlowRsvp - unMarshaller unMarshalFlowRsvp - rsvpChecksumHolder PatternFlowRsvpRsvpChecksum - timeToLiveHolder PatternFlowRsvpTimeToLive - reservedHolder PatternFlowRsvpReserved - rsvpLengthHolder FlowRSVPLength - messageTypeHolder FlowRSVPMessage -} - -func NewFlowRsvp() FlowRsvp { - obj := flowRsvp{obj: &otg.FlowRsvp{}} - obj.setDefault() - return &obj -} - -func (obj *flowRsvp) msg() *otg.FlowRsvp { - return obj.obj -} - -func (obj *flowRsvp) setMsg(msg *otg.FlowRsvp) FlowRsvp { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRsvp struct { - obj *flowRsvp -} - -type marshalFlowRsvp interface { - // ToProto marshals FlowRsvp to protobuf object *otg.FlowRsvp - ToProto() (*otg.FlowRsvp, error) - // ToPbText marshals FlowRsvp to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRsvp to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRsvp to JSON text - ToJson() (string, error) -} - -type unMarshalflowRsvp struct { - obj *flowRsvp -} - -type unMarshalFlowRsvp interface { - // FromProto unmarshals FlowRsvp from protobuf object *otg.FlowRsvp - FromProto(msg *otg.FlowRsvp) (FlowRsvp, error) - // FromPbText unmarshals FlowRsvp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRsvp from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRsvp from JSON text - FromJson(value string) error -} - -func (obj *flowRsvp) Marshal() marshalFlowRsvp { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRsvp{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRsvp) Unmarshal() unMarshalFlowRsvp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRsvp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRsvp) ToProto() (*otg.FlowRsvp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRsvp) FromProto(msg *otg.FlowRsvp) (FlowRsvp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRsvp) 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 *unMarshalflowRsvp) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRsvp) 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 *unMarshalflowRsvp) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRsvp) 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 *unMarshalflowRsvp) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRsvp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRsvp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRsvp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRsvp) Clone() (FlowRsvp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRsvp() - 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 -} - -func (obj *flowRsvp) setNil() { - obj.rsvpChecksumHolder = nil - obj.timeToLiveHolder = nil - obj.reservedHolder = nil - obj.rsvpLengthHolder = nil - obj.messageTypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRsvp is rSVP packet header as defined in RFC2205 and RFC3209. Currently only supported message type is "Path" with mandatory objects and sub-objects. -type FlowRsvp interface { - Validation - // msg marshals FlowRsvp to protobuf object *otg.FlowRsvp - // and doesn't set defaults - msg() *otg.FlowRsvp - // setMsg unmarshals FlowRsvp from protobuf object *otg.FlowRsvp - // and doesn't set defaults - setMsg(*otg.FlowRsvp) FlowRsvp - // provides marshal interface - Marshal() marshalFlowRsvp - // provides unmarshal interface - Unmarshal() unMarshalFlowRsvp - // validate validates FlowRsvp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRsvp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Version returns uint32, set in FlowRsvp. - Version() uint32 - // SetVersion assigns uint32 provided by user to FlowRsvp - SetVersion(value uint32) FlowRsvp - // HasVersion checks if Version has been set in FlowRsvp - HasVersion() bool - // Flag returns FlowRsvpFlagEnum, set in FlowRsvp - Flag() FlowRsvpFlagEnum - // SetFlag assigns FlowRsvpFlagEnum provided by user to FlowRsvp - SetFlag(value FlowRsvpFlagEnum) FlowRsvp - // HasFlag checks if Flag has been set in FlowRsvp - HasFlag() bool - // RsvpChecksum returns PatternFlowRsvpRsvpChecksum, set in FlowRsvp. - // PatternFlowRsvpRsvpChecksum is the one's complement of the one's complement sum of the message, with the checksum field replaced by zero for the purpose of computing the checksum. An all-zero value means that no checksum was transmitted. - RsvpChecksum() PatternFlowRsvpRsvpChecksum - // SetRsvpChecksum assigns PatternFlowRsvpRsvpChecksum provided by user to FlowRsvp. - // PatternFlowRsvpRsvpChecksum is the one's complement of the one's complement sum of the message, with the checksum field replaced by zero for the purpose of computing the checksum. An all-zero value means that no checksum was transmitted. - SetRsvpChecksum(value PatternFlowRsvpRsvpChecksum) FlowRsvp - // HasRsvpChecksum checks if RsvpChecksum has been set in FlowRsvp - HasRsvpChecksum() bool - // TimeToLive returns PatternFlowRsvpTimeToLive, set in FlowRsvp. - // PatternFlowRsvpTimeToLive is the IP time-to-live(TTL) value with which the message was sent. - TimeToLive() PatternFlowRsvpTimeToLive - // SetTimeToLive assigns PatternFlowRsvpTimeToLive provided by user to FlowRsvp. - // PatternFlowRsvpTimeToLive is the IP time-to-live(TTL) value with which the message was sent. - SetTimeToLive(value PatternFlowRsvpTimeToLive) FlowRsvp - // HasTimeToLive checks if TimeToLive has been set in FlowRsvp - HasTimeToLive() bool - // Reserved returns PatternFlowRsvpReserved, set in FlowRsvp. - // PatternFlowRsvpReserved is reserved - Reserved() PatternFlowRsvpReserved - // SetReserved assigns PatternFlowRsvpReserved provided by user to FlowRsvp. - // PatternFlowRsvpReserved is reserved - SetReserved(value PatternFlowRsvpReserved) FlowRsvp - // HasReserved checks if Reserved has been set in FlowRsvp - HasReserved() bool - // RsvpLength returns FlowRSVPLength, set in FlowRsvp. - // FlowRSVPLength is description is TBD - RsvpLength() FlowRSVPLength - // SetRsvpLength assigns FlowRSVPLength provided by user to FlowRsvp. - // FlowRSVPLength is description is TBD - SetRsvpLength(value FlowRSVPLength) FlowRsvp - // HasRsvpLength checks if RsvpLength has been set in FlowRsvp - HasRsvpLength() bool - // MessageType returns FlowRSVPMessage, set in FlowRsvp. - // FlowRSVPMessage is description is TBD - MessageType() FlowRSVPMessage - // SetMessageType assigns FlowRSVPMessage provided by user to FlowRsvp. - // FlowRSVPMessage is description is TBD - SetMessageType(value FlowRSVPMessage) FlowRsvp - // HasMessageType checks if MessageType has been set in FlowRsvp - HasMessageType() bool - setNil() -} - -// RSVP Protocol Version. -// Version returns a uint32 -func (obj *flowRsvp) Version() uint32 { - - return *obj.obj.Version - -} - -// RSVP Protocol Version. -// Version returns a uint32 -func (obj *flowRsvp) HasVersion() bool { - return obj.obj.Version != nil -} - -// RSVP Protocol Version. -// SetVersion sets the uint32 value in the FlowRsvp object -func (obj *flowRsvp) SetVersion(value uint32) FlowRsvp { - - obj.obj.Version = &value - return obj -} - -type FlowRsvpFlagEnum string - -// Enum of Flag on FlowRsvp -var FlowRsvpFlag = struct { - NOT_REFRESH_REDUCTION_CAPABLE FlowRsvpFlagEnum - REFRESH_REDUCTION_CAPABLE FlowRsvpFlagEnum -}{ - NOT_REFRESH_REDUCTION_CAPABLE: FlowRsvpFlagEnum("not_refresh_reduction_capable"), - REFRESH_REDUCTION_CAPABLE: FlowRsvpFlagEnum("refresh_reduction_capable"), -} - -func (obj *flowRsvp) Flag() FlowRsvpFlagEnum { - return FlowRsvpFlagEnum(obj.obj.Flag.Enum().String()) -} - -// Flag, 0x01-0x08: Reserved. -// Flag returns a string -func (obj *flowRsvp) HasFlag() bool { - return obj.obj.Flag != nil -} - -func (obj *flowRsvp) SetFlag(value FlowRsvpFlagEnum) FlowRsvp { - intValue, ok := otg.FlowRsvp_Flag_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRsvpFlagEnum", string(value))) - return obj - } - enumValue := otg.FlowRsvp_Flag_Enum(intValue) - obj.obj.Flag = &enumValue - - return obj -} - -// description is TBD -// RsvpChecksum returns a PatternFlowRsvpRsvpChecksum -func (obj *flowRsvp) RsvpChecksum() PatternFlowRsvpRsvpChecksum { - if obj.obj.RsvpChecksum == nil { - obj.obj.RsvpChecksum = NewPatternFlowRsvpRsvpChecksum().msg() - } - if obj.rsvpChecksumHolder == nil { - obj.rsvpChecksumHolder = &patternFlowRsvpRsvpChecksum{obj: obj.obj.RsvpChecksum} - } - return obj.rsvpChecksumHolder -} - -// description is TBD -// RsvpChecksum returns a PatternFlowRsvpRsvpChecksum -func (obj *flowRsvp) HasRsvpChecksum() bool { - return obj.obj.RsvpChecksum != nil -} - -// description is TBD -// SetRsvpChecksum sets the PatternFlowRsvpRsvpChecksum value in the FlowRsvp object -func (obj *flowRsvp) SetRsvpChecksum(value PatternFlowRsvpRsvpChecksum) FlowRsvp { - - obj.rsvpChecksumHolder = nil - obj.obj.RsvpChecksum = value.msg() - - return obj -} - -// description is TBD -// TimeToLive returns a PatternFlowRsvpTimeToLive -func (obj *flowRsvp) TimeToLive() PatternFlowRsvpTimeToLive { - if obj.obj.TimeToLive == nil { - obj.obj.TimeToLive = NewPatternFlowRsvpTimeToLive().msg() - } - if obj.timeToLiveHolder == nil { - obj.timeToLiveHolder = &patternFlowRsvpTimeToLive{obj: obj.obj.TimeToLive} - } - return obj.timeToLiveHolder -} - -// description is TBD -// TimeToLive returns a PatternFlowRsvpTimeToLive -func (obj *flowRsvp) HasTimeToLive() bool { - return obj.obj.TimeToLive != nil -} - -// description is TBD -// SetTimeToLive sets the PatternFlowRsvpTimeToLive value in the FlowRsvp object -func (obj *flowRsvp) SetTimeToLive(value PatternFlowRsvpTimeToLive) FlowRsvp { - - obj.timeToLiveHolder = nil - obj.obj.TimeToLive = value.msg() - - return obj -} - -// description is TBD -// Reserved returns a PatternFlowRsvpReserved -func (obj *flowRsvp) Reserved() PatternFlowRsvpReserved { - if obj.obj.Reserved == nil { - obj.obj.Reserved = NewPatternFlowRsvpReserved().msg() - } - if obj.reservedHolder == nil { - obj.reservedHolder = &patternFlowRsvpReserved{obj: obj.obj.Reserved} - } - return obj.reservedHolder -} - -// description is TBD -// Reserved returns a PatternFlowRsvpReserved -func (obj *flowRsvp) HasReserved() bool { - return obj.obj.Reserved != nil -} - -// description is TBD -// SetReserved sets the PatternFlowRsvpReserved value in the FlowRsvp object -func (obj *flowRsvp) SetReserved(value PatternFlowRsvpReserved) FlowRsvp { - - obj.reservedHolder = nil - obj.obj.Reserved = value.msg() - - return obj -} - -// The sum of the lengths of the common header and all objects included in the message. -// RsvpLength returns a FlowRSVPLength -func (obj *flowRsvp) RsvpLength() FlowRSVPLength { - if obj.obj.RsvpLength == nil { - obj.obj.RsvpLength = NewFlowRSVPLength().msg() - } - if obj.rsvpLengthHolder == nil { - obj.rsvpLengthHolder = &flowRSVPLength{obj: obj.obj.RsvpLength} - } - return obj.rsvpLengthHolder -} - -// The sum of the lengths of the common header and all objects included in the message. -// RsvpLength returns a FlowRSVPLength -func (obj *flowRsvp) HasRsvpLength() bool { - return obj.obj.RsvpLength != nil -} - -// The sum of the lengths of the common header and all objects included in the message. -// SetRsvpLength sets the FlowRSVPLength value in the FlowRsvp object -func (obj *flowRsvp) SetRsvpLength(value FlowRSVPLength) FlowRsvp { - - obj.rsvpLengthHolder = nil - obj.obj.RsvpLength = value.msg() - - return obj -} - -// An 8-bit number that identifies the function of the RSVP message. There are aound 20 message types defined in https://www.iana.org/assignments/rsvp-parameters/rsvp-parameters.xhtml#rsvp-parameters-2 . Among these presently supported is "Path"(value: 1) message type. -// MessageType returns a FlowRSVPMessage -func (obj *flowRsvp) MessageType() FlowRSVPMessage { - if obj.obj.MessageType == nil { - obj.obj.MessageType = NewFlowRSVPMessage().msg() - } - if obj.messageTypeHolder == nil { - obj.messageTypeHolder = &flowRSVPMessage{obj: obj.obj.MessageType} - } - return obj.messageTypeHolder -} - -// An 8-bit number that identifies the function of the RSVP message. There are aound 20 message types defined in https://www.iana.org/assignments/rsvp-parameters/rsvp-parameters.xhtml#rsvp-parameters-2 . Among these presently supported is "Path"(value: 1) message type. -// MessageType returns a FlowRSVPMessage -func (obj *flowRsvp) HasMessageType() bool { - return obj.obj.MessageType != nil -} - -// An 8-bit number that identifies the function of the RSVP message. There are aound 20 message types defined in https://www.iana.org/assignments/rsvp-parameters/rsvp-parameters.xhtml#rsvp-parameters-2 . Among these presently supported is "Path"(value: 1) message type. -// SetMessageType sets the FlowRSVPMessage value in the FlowRsvp object -func (obj *flowRsvp) SetMessageType(value FlowRSVPMessage) FlowRsvp { - - obj.messageTypeHolder = nil - obj.obj.MessageType = value.msg() - - return obj -} - -func (obj *flowRsvp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Version != nil { - - if *obj.obj.Version > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowRsvp.Version <= 15 but Got %d", *obj.obj.Version)) - } - - } - - if obj.obj.RsvpChecksum != nil { - - obj.RsvpChecksum().validateObj(vObj, set_default) - } - - if obj.obj.TimeToLive != nil { - - obj.TimeToLive().validateObj(vObj, set_default) - } - - if obj.obj.Reserved != nil { - - obj.Reserved().validateObj(vObj, set_default) - } - - if obj.obj.RsvpLength != nil { - - obj.RsvpLength().validateObj(vObj, set_default) - } - - if obj.obj.MessageType != nil { - - obj.MessageType().validateObj(vObj, set_default) - } - -} - -func (obj *flowRsvp) setDefault() { - if obj.obj.Version == nil { - obj.SetVersion(1) - } - if obj.obj.Flag == nil { - obj.SetFlag(FlowRsvpFlag.NOT_REFRESH_REDUCTION_CAPABLE) - - } - -} - -// ***** FlowSizeIncrement ***** -type flowSizeIncrement struct { - validation - obj *otg.FlowSizeIncrement - marshaller marshalFlowSizeIncrement - unMarshaller unMarshalFlowSizeIncrement -} - -func NewFlowSizeIncrement() FlowSizeIncrement { - obj := flowSizeIncrement{obj: &otg.FlowSizeIncrement{}} - obj.setDefault() - return &obj -} - -func (obj *flowSizeIncrement) msg() *otg.FlowSizeIncrement { - return obj.obj -} - -func (obj *flowSizeIncrement) setMsg(msg *otg.FlowSizeIncrement) FlowSizeIncrement { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowSizeIncrement struct { - obj *flowSizeIncrement -} - -type marshalFlowSizeIncrement interface { - // ToProto marshals FlowSizeIncrement to protobuf object *otg.FlowSizeIncrement - ToProto() (*otg.FlowSizeIncrement, error) - // ToPbText marshals FlowSizeIncrement to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowSizeIncrement to YAML text - ToYaml() (string, error) - // ToJson marshals FlowSizeIncrement to JSON text - ToJson() (string, error) -} - -type unMarshalflowSizeIncrement struct { - obj *flowSizeIncrement -} - -type unMarshalFlowSizeIncrement interface { - // FromProto unmarshals FlowSizeIncrement from protobuf object *otg.FlowSizeIncrement - FromProto(msg *otg.FlowSizeIncrement) (FlowSizeIncrement, error) - // FromPbText unmarshals FlowSizeIncrement from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowSizeIncrement from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowSizeIncrement from JSON text - FromJson(value string) error -} - -func (obj *flowSizeIncrement) Marshal() marshalFlowSizeIncrement { - if obj.marshaller == nil { - obj.marshaller = &marshalflowSizeIncrement{obj: obj} - } - return obj.marshaller -} - -func (obj *flowSizeIncrement) Unmarshal() unMarshalFlowSizeIncrement { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowSizeIncrement{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowSizeIncrement) ToProto() (*otg.FlowSizeIncrement, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowSizeIncrement) FromProto(msg *otg.FlowSizeIncrement) (FlowSizeIncrement, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowSizeIncrement) 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 *unMarshalflowSizeIncrement) 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 *marshalflowSizeIncrement) 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 *unMarshalflowSizeIncrement) 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 *marshalflowSizeIncrement) 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 *unMarshalflowSizeIncrement) 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 *flowSizeIncrement) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowSizeIncrement) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowSizeIncrement) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowSizeIncrement) Clone() (FlowSizeIncrement, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowSizeIncrement() - 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 -} - -// FlowSizeIncrement is frame size that increments from a starting size to -// an ending size incrementing by a step size. -type FlowSizeIncrement interface { - Validation - // msg marshals FlowSizeIncrement to protobuf object *otg.FlowSizeIncrement - // and doesn't set defaults - msg() *otg.FlowSizeIncrement - // setMsg unmarshals FlowSizeIncrement from protobuf object *otg.FlowSizeIncrement - // and doesn't set defaults - setMsg(*otg.FlowSizeIncrement) FlowSizeIncrement - // provides marshal interface - Marshal() marshalFlowSizeIncrement - // provides unmarshal interface - Unmarshal() unMarshalFlowSizeIncrement - // validate validates FlowSizeIncrement - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowSizeIncrement, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in FlowSizeIncrement. - Start() uint32 - // SetStart assigns uint32 provided by user to FlowSizeIncrement - SetStart(value uint32) FlowSizeIncrement - // HasStart checks if Start has been set in FlowSizeIncrement - HasStart() bool - // End returns uint32, set in FlowSizeIncrement. - End() uint32 - // SetEnd assigns uint32 provided by user to FlowSizeIncrement - SetEnd(value uint32) FlowSizeIncrement - // HasEnd checks if End has been set in FlowSizeIncrement - HasEnd() bool - // Step returns uint32, set in FlowSizeIncrement. - Step() uint32 - // SetStep assigns uint32 provided by user to FlowSizeIncrement - SetStep(value uint32) FlowSizeIncrement - // HasStep checks if Step has been set in FlowSizeIncrement - HasStep() bool -} - -// Starting frame size in bytes -// Start returns a uint32 -func (obj *flowSizeIncrement) Start() uint32 { - - return *obj.obj.Start - -} - -// Starting frame size in bytes -// Start returns a uint32 -func (obj *flowSizeIncrement) HasStart() bool { - return obj.obj.Start != nil -} - -// Starting frame size in bytes -// SetStart sets the uint32 value in the FlowSizeIncrement object -func (obj *flowSizeIncrement) SetStart(value uint32) FlowSizeIncrement { - - obj.obj.Start = &value - return obj -} - -// Ending frame size in bytes -// End returns a uint32 -func (obj *flowSizeIncrement) End() uint32 { - - return *obj.obj.End - -} - -// Ending frame size in bytes -// End returns a uint32 -func (obj *flowSizeIncrement) HasEnd() bool { - return obj.obj.End != nil -} - -// Ending frame size in bytes -// SetEnd sets the uint32 value in the FlowSizeIncrement object -func (obj *flowSizeIncrement) SetEnd(value uint32) FlowSizeIncrement { - - obj.obj.End = &value - return obj -} - -// Step frame size in bytes -// Step returns a uint32 -func (obj *flowSizeIncrement) Step() uint32 { - - return *obj.obj.Step - -} - -// Step frame size in bytes -// Step returns a uint32 -func (obj *flowSizeIncrement) HasStep() bool { - return obj.obj.Step != nil -} - -// Step frame size in bytes -// SetStep sets the uint32 value in the FlowSizeIncrement object -func (obj *flowSizeIncrement) SetStep(value uint32) FlowSizeIncrement { - - obj.obj.Step = &value - return obj -} - -func (obj *flowSizeIncrement) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start < 1 || *obj.obj.Start > 4294967295 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= FlowSizeIncrement.Start <= 4294967295 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.End != nil { - - if *obj.obj.End < 64 || *obj.obj.End > 4294967295 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("64 <= FlowSizeIncrement.End <= 4294967295 but Got %d", *obj.obj.End)) - } - - } - -} - -func (obj *flowSizeIncrement) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(64) - } - if obj.obj.End == nil { - obj.SetEnd(1518) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - -} - -// ***** FlowSizeRandom ***** -type flowSizeRandom struct { - validation - obj *otg.FlowSizeRandom - marshaller marshalFlowSizeRandom - unMarshaller unMarshalFlowSizeRandom -} - -func NewFlowSizeRandom() FlowSizeRandom { - obj := flowSizeRandom{obj: &otg.FlowSizeRandom{}} - obj.setDefault() - return &obj -} - -func (obj *flowSizeRandom) msg() *otg.FlowSizeRandom { - return obj.obj -} - -func (obj *flowSizeRandom) setMsg(msg *otg.FlowSizeRandom) FlowSizeRandom { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowSizeRandom struct { - obj *flowSizeRandom -} - -type marshalFlowSizeRandom interface { - // ToProto marshals FlowSizeRandom to protobuf object *otg.FlowSizeRandom - ToProto() (*otg.FlowSizeRandom, error) - // ToPbText marshals FlowSizeRandom to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowSizeRandom to YAML text - ToYaml() (string, error) - // ToJson marshals FlowSizeRandom to JSON text - ToJson() (string, error) -} - -type unMarshalflowSizeRandom struct { - obj *flowSizeRandom -} - -type unMarshalFlowSizeRandom interface { - // FromProto unmarshals FlowSizeRandom from protobuf object *otg.FlowSizeRandom - FromProto(msg *otg.FlowSizeRandom) (FlowSizeRandom, error) - // FromPbText unmarshals FlowSizeRandom from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowSizeRandom from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowSizeRandom from JSON text - FromJson(value string) error -} - -func (obj *flowSizeRandom) Marshal() marshalFlowSizeRandom { - if obj.marshaller == nil { - obj.marshaller = &marshalflowSizeRandom{obj: obj} - } - return obj.marshaller -} - -func (obj *flowSizeRandom) Unmarshal() unMarshalFlowSizeRandom { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowSizeRandom{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowSizeRandom) ToProto() (*otg.FlowSizeRandom, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowSizeRandom) FromProto(msg *otg.FlowSizeRandom) (FlowSizeRandom, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowSizeRandom) 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 *unMarshalflowSizeRandom) 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 *marshalflowSizeRandom) 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 *unMarshalflowSizeRandom) 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 *marshalflowSizeRandom) 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 *unMarshalflowSizeRandom) 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 *flowSizeRandom) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowSizeRandom) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowSizeRandom) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowSizeRandom) Clone() (FlowSizeRandom, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowSizeRandom() - 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 -} - -// FlowSizeRandom is random frame size from a min value to a max value. -type FlowSizeRandom interface { - Validation - // msg marshals FlowSizeRandom to protobuf object *otg.FlowSizeRandom - // and doesn't set defaults - msg() *otg.FlowSizeRandom - // setMsg unmarshals FlowSizeRandom from protobuf object *otg.FlowSizeRandom - // and doesn't set defaults - setMsg(*otg.FlowSizeRandom) FlowSizeRandom - // provides marshal interface - Marshal() marshalFlowSizeRandom - // provides unmarshal interface - Unmarshal() unMarshalFlowSizeRandom - // validate validates FlowSizeRandom - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowSizeRandom, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Min returns uint32, set in FlowSizeRandom. - Min() uint32 - // SetMin assigns uint32 provided by user to FlowSizeRandom - SetMin(value uint32) FlowSizeRandom - // HasMin checks if Min has been set in FlowSizeRandom - HasMin() bool - // Max returns uint32, set in FlowSizeRandom. - Max() uint32 - // SetMax assigns uint32 provided by user to FlowSizeRandom - SetMax(value uint32) FlowSizeRandom - // HasMax checks if Max has been set in FlowSizeRandom - HasMax() bool -} - -// description is TBD -// Min returns a uint32 -func (obj *flowSizeRandom) Min() uint32 { - - return *obj.obj.Min - -} - -// description is TBD -// Min returns a uint32 -func (obj *flowSizeRandom) HasMin() bool { - return obj.obj.Min != nil -} - -// description is TBD -// SetMin sets the uint32 value in the FlowSizeRandom object -func (obj *flowSizeRandom) SetMin(value uint32) FlowSizeRandom { - - obj.obj.Min = &value - return obj -} - -// description is TBD -// Max returns a uint32 -func (obj *flowSizeRandom) Max() uint32 { - - return *obj.obj.Max - -} - -// description is TBD -// Max returns a uint32 -func (obj *flowSizeRandom) HasMax() bool { - return obj.obj.Max != nil -} - -// description is TBD -// SetMax sets the uint32 value in the FlowSizeRandom object -func (obj *flowSizeRandom) SetMax(value uint32) FlowSizeRandom { - - obj.obj.Max = &value - return obj -} - -func (obj *flowSizeRandom) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *flowSizeRandom) setDefault() { - if obj.obj.Min == nil { - obj.SetMin(64) - } - if obj.obj.Max == nil { - obj.SetMax(1518) - } - -} - -// ***** FlowSizeWeightPairs ***** -type flowSizeWeightPairs struct { - validation - obj *otg.FlowSizeWeightPairs - marshaller marshalFlowSizeWeightPairs - unMarshaller unMarshalFlowSizeWeightPairs - customHolder FlowSizeWeightPairsFlowSizeWeightPairsCustomIter -} - -func NewFlowSizeWeightPairs() FlowSizeWeightPairs { - obj := flowSizeWeightPairs{obj: &otg.FlowSizeWeightPairs{}} - obj.setDefault() - return &obj -} - -func (obj *flowSizeWeightPairs) msg() *otg.FlowSizeWeightPairs { - return obj.obj -} - -func (obj *flowSizeWeightPairs) setMsg(msg *otg.FlowSizeWeightPairs) FlowSizeWeightPairs { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowSizeWeightPairs struct { - obj *flowSizeWeightPairs -} - -type marshalFlowSizeWeightPairs interface { - // ToProto marshals FlowSizeWeightPairs to protobuf object *otg.FlowSizeWeightPairs - ToProto() (*otg.FlowSizeWeightPairs, error) - // ToPbText marshals FlowSizeWeightPairs to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowSizeWeightPairs to YAML text - ToYaml() (string, error) - // ToJson marshals FlowSizeWeightPairs to JSON text - ToJson() (string, error) -} - -type unMarshalflowSizeWeightPairs struct { - obj *flowSizeWeightPairs -} - -type unMarshalFlowSizeWeightPairs interface { - // FromProto unmarshals FlowSizeWeightPairs from protobuf object *otg.FlowSizeWeightPairs - FromProto(msg *otg.FlowSizeWeightPairs) (FlowSizeWeightPairs, error) - // FromPbText unmarshals FlowSizeWeightPairs from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowSizeWeightPairs from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowSizeWeightPairs from JSON text - FromJson(value string) error -} - -func (obj *flowSizeWeightPairs) Marshal() marshalFlowSizeWeightPairs { - if obj.marshaller == nil { - obj.marshaller = &marshalflowSizeWeightPairs{obj: obj} - } - return obj.marshaller -} - -func (obj *flowSizeWeightPairs) Unmarshal() unMarshalFlowSizeWeightPairs { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowSizeWeightPairs{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowSizeWeightPairs) ToProto() (*otg.FlowSizeWeightPairs, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowSizeWeightPairs) FromProto(msg *otg.FlowSizeWeightPairs) (FlowSizeWeightPairs, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowSizeWeightPairs) 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 *unMarshalflowSizeWeightPairs) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowSizeWeightPairs) 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 *unMarshalflowSizeWeightPairs) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowSizeWeightPairs) 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 *unMarshalflowSizeWeightPairs) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowSizeWeightPairs) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowSizeWeightPairs) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowSizeWeightPairs) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowSizeWeightPairs) Clone() (FlowSizeWeightPairs, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowSizeWeightPairs() - 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 -} - -func (obj *flowSizeWeightPairs) setNil() { - obj.customHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowSizeWeightPairs is frame size distribution, defined as pairs (including IMIX distribution). -// Frames are randomly generated such that the proportion of each frame size out of the total number of frames -// are matching with the weight value of the pair. However, as with any other probability -// distribution, the sample distribution is close to theoretical value only if the size of the sample is reasonably large. -// When the number of frames is very low the transmitted frames may not come close to the ratio described in the weight. -type FlowSizeWeightPairs interface { - Validation - // msg marshals FlowSizeWeightPairs to protobuf object *otg.FlowSizeWeightPairs - // and doesn't set defaults - msg() *otg.FlowSizeWeightPairs - // setMsg unmarshals FlowSizeWeightPairs from protobuf object *otg.FlowSizeWeightPairs - // and doesn't set defaults - setMsg(*otg.FlowSizeWeightPairs) FlowSizeWeightPairs - // provides marshal interface - Marshal() marshalFlowSizeWeightPairs - // provides unmarshal interface - Unmarshal() unMarshalFlowSizeWeightPairs - // validate validates FlowSizeWeightPairs - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowSizeWeightPairs, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowSizeWeightPairsChoiceEnum, set in FlowSizeWeightPairs - Choice() FlowSizeWeightPairsChoiceEnum - // setChoice assigns FlowSizeWeightPairsChoiceEnum provided by user to FlowSizeWeightPairs - setChoice(value FlowSizeWeightPairsChoiceEnum) FlowSizeWeightPairs - // HasChoice checks if Choice has been set in FlowSizeWeightPairs - HasChoice() bool - // Predefined returns FlowSizeWeightPairsPredefinedEnum, set in FlowSizeWeightPairs - Predefined() FlowSizeWeightPairsPredefinedEnum - // SetPredefined assigns FlowSizeWeightPairsPredefinedEnum provided by user to FlowSizeWeightPairs - SetPredefined(value FlowSizeWeightPairsPredefinedEnum) FlowSizeWeightPairs - // HasPredefined checks if Predefined has been set in FlowSizeWeightPairs - HasPredefined() bool - // Custom returns FlowSizeWeightPairsFlowSizeWeightPairsCustomIterIter, set in FlowSizeWeightPairs - Custom() FlowSizeWeightPairsFlowSizeWeightPairsCustomIter - setNil() -} - -type FlowSizeWeightPairsChoiceEnum string - -// Enum of Choice on FlowSizeWeightPairs -var FlowSizeWeightPairsChoice = struct { - PREDEFINED FlowSizeWeightPairsChoiceEnum - CUSTOM FlowSizeWeightPairsChoiceEnum -}{ - PREDEFINED: FlowSizeWeightPairsChoiceEnum("predefined"), - CUSTOM: FlowSizeWeightPairsChoiceEnum("custom"), -} - -func (obj *flowSizeWeightPairs) Choice() FlowSizeWeightPairsChoiceEnum { - return FlowSizeWeightPairsChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowSizeWeightPairs) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowSizeWeightPairs) setChoice(value FlowSizeWeightPairsChoiceEnum) FlowSizeWeightPairs { - intValue, ok := otg.FlowSizeWeightPairs_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowSizeWeightPairsChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowSizeWeightPairs_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Custom = nil - obj.customHolder = nil - obj.obj.Predefined = otg.FlowSizeWeightPairs_Predefined_unspecified.Enum() - - if value == FlowSizeWeightPairsChoice.CUSTOM { - obj.obj.Custom = []*otg.FlowSizeWeightPairsCustom{} - } - - return obj -} - -type FlowSizeWeightPairsPredefinedEnum string - -// Enum of Predefined on FlowSizeWeightPairs -var FlowSizeWeightPairsPredefined = struct { - IMIX FlowSizeWeightPairsPredefinedEnum - IPSEC_IMIX FlowSizeWeightPairsPredefinedEnum - IPV6_IMIX FlowSizeWeightPairsPredefinedEnum - STANDARD_IMIX FlowSizeWeightPairsPredefinedEnum - TCP_IMIX FlowSizeWeightPairsPredefinedEnum -}{ - IMIX: FlowSizeWeightPairsPredefinedEnum("imix"), - IPSEC_IMIX: FlowSizeWeightPairsPredefinedEnum("ipsec_imix"), - IPV6_IMIX: FlowSizeWeightPairsPredefinedEnum("ipv6_imix"), - STANDARD_IMIX: FlowSizeWeightPairsPredefinedEnum("standard_imix"), - TCP_IMIX: FlowSizeWeightPairsPredefinedEnum("tcp_imix"), -} - -func (obj *flowSizeWeightPairs) Predefined() FlowSizeWeightPairsPredefinedEnum { - return FlowSizeWeightPairsPredefinedEnum(obj.obj.Predefined.Enum().String()) -} - -// Specify predefined frame size distribution pairs (including IMIX distribution). -// The available predefined distribution pairs are: -// - IMIX (64:7, 570:4, and 1518:1) -// - IPSec IMIX (90:58.67, 92:2, 594:23.66 and 1418:15.67) -// - IPv6 IMIX (60:58.67, 496:2, 594:23.66 and 1518:15.67) -// - Standard IMIX (58:58.67, 62:2, 594:23.66 and 1518:15.67) -// - TCP IMIX (90:58.67, 92:2, 594:23.66 and 1518:15.67) -// Predefined returns a string -func (obj *flowSizeWeightPairs) HasPredefined() bool { - return obj.obj.Predefined != nil -} - -func (obj *flowSizeWeightPairs) SetPredefined(value FlowSizeWeightPairsPredefinedEnum) FlowSizeWeightPairs { - intValue, ok := otg.FlowSizeWeightPairs_Predefined_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowSizeWeightPairsPredefinedEnum", string(value))) - return obj - } - enumValue := otg.FlowSizeWeightPairs_Predefined_Enum(intValue) - obj.obj.Predefined = &enumValue - - return obj -} - -// description is TBD -// Custom returns a []FlowSizeWeightPairsCustom -func (obj *flowSizeWeightPairs) Custom() FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { - if len(obj.obj.Custom) == 0 { - obj.setChoice(FlowSizeWeightPairsChoice.CUSTOM) - } - if obj.customHolder == nil { - obj.customHolder = newFlowSizeWeightPairsFlowSizeWeightPairsCustomIter(&obj.obj.Custom).setMsg(obj) - } - return obj.customHolder -} - -type flowSizeWeightPairsFlowSizeWeightPairsCustomIter struct { - obj *flowSizeWeightPairs - flowSizeWeightPairsCustomSlice []FlowSizeWeightPairsCustom - fieldPtr *[]*otg.FlowSizeWeightPairsCustom -} - -func newFlowSizeWeightPairsFlowSizeWeightPairsCustomIter(ptr *[]*otg.FlowSizeWeightPairsCustom) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { - return &flowSizeWeightPairsFlowSizeWeightPairsCustomIter{fieldPtr: ptr} -} - -type FlowSizeWeightPairsFlowSizeWeightPairsCustomIter interface { - setMsg(*flowSizeWeightPairs) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter - Items() []FlowSizeWeightPairsCustom - Add() FlowSizeWeightPairsCustom - Append(items ...FlowSizeWeightPairsCustom) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter - Set(index int, newObj FlowSizeWeightPairsCustom) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter - Clear() FlowSizeWeightPairsFlowSizeWeightPairsCustomIter - clearHolderSlice() FlowSizeWeightPairsFlowSizeWeightPairsCustomIter - appendHolderSlice(item FlowSizeWeightPairsCustom) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter -} - -func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) setMsg(msg *flowSizeWeightPairs) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flowSizeWeightPairsCustom{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) Items() []FlowSizeWeightPairsCustom { - return obj.flowSizeWeightPairsCustomSlice -} - -func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) Add() FlowSizeWeightPairsCustom { - newObj := &otg.FlowSizeWeightPairsCustom{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flowSizeWeightPairsCustom{obj: newObj} - newLibObj.setDefault() - obj.flowSizeWeightPairsCustomSlice = append(obj.flowSizeWeightPairsCustomSlice, newLibObj) - return newLibObj -} - -func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) Append(items ...FlowSizeWeightPairsCustom) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowSizeWeightPairsCustomSlice = append(obj.flowSizeWeightPairsCustomSlice, item) - } - return obj -} - -func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) Set(index int, newObj FlowSizeWeightPairsCustom) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowSizeWeightPairsCustomSlice[index] = newObj - return obj -} -func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) Clear() FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.FlowSizeWeightPairsCustom{} - obj.flowSizeWeightPairsCustomSlice = []FlowSizeWeightPairsCustom{} - } - return obj -} -func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) clearHolderSlice() FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { - if len(obj.flowSizeWeightPairsCustomSlice) > 0 { - obj.flowSizeWeightPairsCustomSlice = []FlowSizeWeightPairsCustom{} - } - return obj -} -func (obj *flowSizeWeightPairsFlowSizeWeightPairsCustomIter) appendHolderSlice(item FlowSizeWeightPairsCustom) FlowSizeWeightPairsFlowSizeWeightPairsCustomIter { - obj.flowSizeWeightPairsCustomSlice = append(obj.flowSizeWeightPairsCustomSlice, item) - return obj -} - -func (obj *flowSizeWeightPairs) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Custom) != 0 { - - if set_default { - obj.Custom().clearHolderSlice() - for _, item := range obj.obj.Custom { - obj.Custom().appendHolderSlice(&flowSizeWeightPairsCustom{obj: item}) - } - } - for _, item := range obj.Custom().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *flowSizeWeightPairs) setDefault() { - var choices_set int = 0 - var choice FlowSizeWeightPairsChoiceEnum - - if obj.obj.Predefined != nil && obj.obj.Predefined.Number() != 0 { - choices_set += 1 - choice = FlowSizeWeightPairsChoice.PREDEFINED - } - - if len(obj.obj.Custom) > 0 { - choices_set += 1 - choice = FlowSizeWeightPairsChoice.CUSTOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowSizeWeightPairsChoice.PREDEFINED) - if obj.obj.Predefined.Number() == 0 { - obj.SetPredefined(FlowSizeWeightPairsPredefined.IMIX) - - } - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowSizeWeightPairs") - } - } else { - intVal := otg.FlowSizeWeightPairs_Choice_Enum_value[string(choice)] - enumValue := otg.FlowSizeWeightPairs_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowFixedPackets ***** -type flowFixedPackets struct { - validation - obj *otg.FlowFixedPackets - marshaller marshalFlowFixedPackets - unMarshaller unMarshalFlowFixedPackets - delayHolder FlowDelay -} - -func NewFlowFixedPackets() FlowFixedPackets { - obj := flowFixedPackets{obj: &otg.FlowFixedPackets{}} - obj.setDefault() - return &obj -} - -func (obj *flowFixedPackets) msg() *otg.FlowFixedPackets { - return obj.obj -} - -func (obj *flowFixedPackets) setMsg(msg *otg.FlowFixedPackets) FlowFixedPackets { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowFixedPackets struct { - obj *flowFixedPackets -} - -type marshalFlowFixedPackets interface { - // ToProto marshals FlowFixedPackets to protobuf object *otg.FlowFixedPackets - ToProto() (*otg.FlowFixedPackets, error) - // ToPbText marshals FlowFixedPackets to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowFixedPackets to YAML text - ToYaml() (string, error) - // ToJson marshals FlowFixedPackets to JSON text - ToJson() (string, error) -} - -type unMarshalflowFixedPackets struct { - obj *flowFixedPackets -} - -type unMarshalFlowFixedPackets interface { - // FromProto unmarshals FlowFixedPackets from protobuf object *otg.FlowFixedPackets - FromProto(msg *otg.FlowFixedPackets) (FlowFixedPackets, error) - // FromPbText unmarshals FlowFixedPackets from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowFixedPackets from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowFixedPackets from JSON text - FromJson(value string) error -} - -func (obj *flowFixedPackets) Marshal() marshalFlowFixedPackets { - if obj.marshaller == nil { - obj.marshaller = &marshalflowFixedPackets{obj: obj} - } - return obj.marshaller -} - -func (obj *flowFixedPackets) Unmarshal() unMarshalFlowFixedPackets { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowFixedPackets{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowFixedPackets) ToProto() (*otg.FlowFixedPackets, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowFixedPackets) FromProto(msg *otg.FlowFixedPackets) (FlowFixedPackets, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowFixedPackets) 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 *unMarshalflowFixedPackets) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowFixedPackets) 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 *unMarshalflowFixedPackets) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowFixedPackets) 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 *unMarshalflowFixedPackets) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowFixedPackets) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowFixedPackets) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowFixedPackets) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowFixedPackets) Clone() (FlowFixedPackets, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowFixedPackets() - 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 -} - -func (obj *flowFixedPackets) setNil() { - obj.delayHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowFixedPackets is transmit a fixed number of packets after which the flow will stop. -type FlowFixedPackets interface { - Validation - // msg marshals FlowFixedPackets to protobuf object *otg.FlowFixedPackets - // and doesn't set defaults - msg() *otg.FlowFixedPackets - // setMsg unmarshals FlowFixedPackets from protobuf object *otg.FlowFixedPackets - // and doesn't set defaults - setMsg(*otg.FlowFixedPackets) FlowFixedPackets - // provides marshal interface - Marshal() marshalFlowFixedPackets - // provides unmarshal interface - Unmarshal() unMarshalFlowFixedPackets - // validate validates FlowFixedPackets - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowFixedPackets, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Packets returns uint32, set in FlowFixedPackets. - Packets() uint32 - // SetPackets assigns uint32 provided by user to FlowFixedPackets - SetPackets(value uint32) FlowFixedPackets - // HasPackets checks if Packets has been set in FlowFixedPackets - HasPackets() bool - // Gap returns uint32, set in FlowFixedPackets. - Gap() uint32 - // SetGap assigns uint32 provided by user to FlowFixedPackets - SetGap(value uint32) FlowFixedPackets - // HasGap checks if Gap has been set in FlowFixedPackets - HasGap() bool - // Delay returns FlowDelay, set in FlowFixedPackets. - // FlowDelay is the optional container to specify the delay before starting - // transmission of packets. - Delay() FlowDelay - // SetDelay assigns FlowDelay provided by user to FlowFixedPackets. - // FlowDelay is the optional container to specify the delay before starting - // transmission of packets. - SetDelay(value FlowDelay) FlowFixedPackets - // HasDelay checks if Delay has been set in FlowFixedPackets - HasDelay() bool - setNil() -} - -// Stop transmit of the flow after this number of packets. -// Packets returns a uint32 -func (obj *flowFixedPackets) Packets() uint32 { - - return *obj.obj.Packets - -} - -// Stop transmit of the flow after this number of packets. -// Packets returns a uint32 -func (obj *flowFixedPackets) HasPackets() bool { - return obj.obj.Packets != nil -} - -// Stop transmit of the flow after this number of packets. -// SetPackets sets the uint32 value in the FlowFixedPackets object -func (obj *flowFixedPackets) SetPackets(value uint32) FlowFixedPackets { - - obj.obj.Packets = &value - return obj -} - -// The minimum gap between packets expressed as bytes. -// Gap returns a uint32 -func (obj *flowFixedPackets) Gap() uint32 { - - return *obj.obj.Gap - -} - -// The minimum gap between packets expressed as bytes. -// Gap returns a uint32 -func (obj *flowFixedPackets) HasGap() bool { - return obj.obj.Gap != nil -} - -// The minimum gap between packets expressed as bytes. -// SetGap sets the uint32 value in the FlowFixedPackets object -func (obj *flowFixedPackets) SetGap(value uint32) FlowFixedPackets { - - obj.obj.Gap = &value - return obj -} - -// description is TBD -// Delay returns a FlowDelay -func (obj *flowFixedPackets) Delay() FlowDelay { - if obj.obj.Delay == nil { - obj.obj.Delay = NewFlowDelay().msg() - } - if obj.delayHolder == nil { - obj.delayHolder = &flowDelay{obj: obj.obj.Delay} - } - return obj.delayHolder -} - -// description is TBD -// Delay returns a FlowDelay -func (obj *flowFixedPackets) HasDelay() bool { - return obj.obj.Delay != nil -} - -// description is TBD -// SetDelay sets the FlowDelay value in the FlowFixedPackets object -func (obj *flowFixedPackets) SetDelay(value FlowDelay) FlowFixedPackets { - - obj.delayHolder = nil - obj.obj.Delay = value.msg() - - return obj -} - -func (obj *flowFixedPackets) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Packets != nil { - - if *obj.obj.Packets < 1 || *obj.obj.Packets > 4294967295 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= FlowFixedPackets.Packets <= 4294967295 but Got %d", *obj.obj.Packets)) - } - - } - - if obj.obj.Delay != nil { - - obj.Delay().validateObj(vObj, set_default) - } - -} - -func (obj *flowFixedPackets) setDefault() { - if obj.obj.Packets == nil { - obj.SetPackets(1) - } - if obj.obj.Gap == nil { - obj.SetGap(12) - } - -} - -// ***** FlowFixedSeconds ***** -type flowFixedSeconds struct { - validation - obj *otg.FlowFixedSeconds - marshaller marshalFlowFixedSeconds - unMarshaller unMarshalFlowFixedSeconds - delayHolder FlowDelay -} - -func NewFlowFixedSeconds() FlowFixedSeconds { - obj := flowFixedSeconds{obj: &otg.FlowFixedSeconds{}} - obj.setDefault() - return &obj -} - -func (obj *flowFixedSeconds) msg() *otg.FlowFixedSeconds { - return obj.obj -} - -func (obj *flowFixedSeconds) setMsg(msg *otg.FlowFixedSeconds) FlowFixedSeconds { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowFixedSeconds struct { - obj *flowFixedSeconds -} - -type marshalFlowFixedSeconds interface { - // ToProto marshals FlowFixedSeconds to protobuf object *otg.FlowFixedSeconds - ToProto() (*otg.FlowFixedSeconds, error) - // ToPbText marshals FlowFixedSeconds to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowFixedSeconds to YAML text - ToYaml() (string, error) - // ToJson marshals FlowFixedSeconds to JSON text - ToJson() (string, error) -} - -type unMarshalflowFixedSeconds struct { - obj *flowFixedSeconds -} - -type unMarshalFlowFixedSeconds interface { - // FromProto unmarshals FlowFixedSeconds from protobuf object *otg.FlowFixedSeconds - FromProto(msg *otg.FlowFixedSeconds) (FlowFixedSeconds, error) - // FromPbText unmarshals FlowFixedSeconds from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowFixedSeconds from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowFixedSeconds from JSON text - FromJson(value string) error -} - -func (obj *flowFixedSeconds) Marshal() marshalFlowFixedSeconds { - if obj.marshaller == nil { - obj.marshaller = &marshalflowFixedSeconds{obj: obj} - } - return obj.marshaller -} - -func (obj *flowFixedSeconds) Unmarshal() unMarshalFlowFixedSeconds { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowFixedSeconds{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowFixedSeconds) ToProto() (*otg.FlowFixedSeconds, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowFixedSeconds) FromProto(msg *otg.FlowFixedSeconds) (FlowFixedSeconds, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowFixedSeconds) 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 *unMarshalflowFixedSeconds) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowFixedSeconds) 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 *unMarshalflowFixedSeconds) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowFixedSeconds) 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 *unMarshalflowFixedSeconds) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowFixedSeconds) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowFixedSeconds) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowFixedSeconds) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowFixedSeconds) Clone() (FlowFixedSeconds, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowFixedSeconds() - 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 -} - -func (obj *flowFixedSeconds) setNil() { - obj.delayHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowFixedSeconds is transmit for a fixed number of seconds after which the flow will stop. -type FlowFixedSeconds interface { - Validation - // msg marshals FlowFixedSeconds to protobuf object *otg.FlowFixedSeconds - // and doesn't set defaults - msg() *otg.FlowFixedSeconds - // setMsg unmarshals FlowFixedSeconds from protobuf object *otg.FlowFixedSeconds - // and doesn't set defaults - setMsg(*otg.FlowFixedSeconds) FlowFixedSeconds - // provides marshal interface - Marshal() marshalFlowFixedSeconds - // provides unmarshal interface - Unmarshal() unMarshalFlowFixedSeconds - // validate validates FlowFixedSeconds - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowFixedSeconds, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Seconds returns float32, set in FlowFixedSeconds. - Seconds() float32 - // SetSeconds assigns float32 provided by user to FlowFixedSeconds - SetSeconds(value float32) FlowFixedSeconds - // HasSeconds checks if Seconds has been set in FlowFixedSeconds - HasSeconds() bool - // Gap returns uint32, set in FlowFixedSeconds. - Gap() uint32 - // SetGap assigns uint32 provided by user to FlowFixedSeconds - SetGap(value uint32) FlowFixedSeconds - // HasGap checks if Gap has been set in FlowFixedSeconds - HasGap() bool - // Delay returns FlowDelay, set in FlowFixedSeconds. - // FlowDelay is the optional container to specify the delay before starting - // transmission of packets. - Delay() FlowDelay - // SetDelay assigns FlowDelay provided by user to FlowFixedSeconds. - // FlowDelay is the optional container to specify the delay before starting - // transmission of packets. - SetDelay(value FlowDelay) FlowFixedSeconds - // HasDelay checks if Delay has been set in FlowFixedSeconds - HasDelay() bool - setNil() -} - -// Stop transmit of the flow after this number of seconds. -// Seconds returns a float32 -func (obj *flowFixedSeconds) Seconds() float32 { - - return *obj.obj.Seconds - -} - -// Stop transmit of the flow after this number of seconds. -// Seconds returns a float32 -func (obj *flowFixedSeconds) HasSeconds() bool { - return obj.obj.Seconds != nil -} - -// Stop transmit of the flow after this number of seconds. -// SetSeconds sets the float32 value in the FlowFixedSeconds object -func (obj *flowFixedSeconds) SetSeconds(value float32) FlowFixedSeconds { - - obj.obj.Seconds = &value - return obj -} - -// The minimum gap between packets expressed as bytes. -// Gap returns a uint32 -func (obj *flowFixedSeconds) Gap() uint32 { - - return *obj.obj.Gap - -} - -// The minimum gap between packets expressed as bytes. -// Gap returns a uint32 -func (obj *flowFixedSeconds) HasGap() bool { - return obj.obj.Gap != nil -} - -// The minimum gap between packets expressed as bytes. -// SetGap sets the uint32 value in the FlowFixedSeconds object -func (obj *flowFixedSeconds) SetGap(value uint32) FlowFixedSeconds { - - obj.obj.Gap = &value - return obj -} - -// description is TBD -// Delay returns a FlowDelay -func (obj *flowFixedSeconds) Delay() FlowDelay { - if obj.obj.Delay == nil { - obj.obj.Delay = NewFlowDelay().msg() - } - if obj.delayHolder == nil { - obj.delayHolder = &flowDelay{obj: obj.obj.Delay} - } - return obj.delayHolder -} - -// description is TBD -// Delay returns a FlowDelay -func (obj *flowFixedSeconds) HasDelay() bool { - return obj.obj.Delay != nil -} - -// description is TBD -// SetDelay sets the FlowDelay value in the FlowFixedSeconds object -func (obj *flowFixedSeconds) SetDelay(value FlowDelay) FlowFixedSeconds { - - obj.delayHolder = nil - obj.obj.Delay = value.msg() - - return obj -} - -func (obj *flowFixedSeconds) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Seconds != nil { - - if *obj.obj.Seconds < 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowFixedSeconds.Seconds <= max(float32) but Got %f", *obj.obj.Seconds)) - } - - } - - if obj.obj.Delay != nil { - - obj.Delay().validateObj(vObj, set_default) - } - -} - -func (obj *flowFixedSeconds) setDefault() { - if obj.obj.Seconds == nil { - obj.SetSeconds(1) - } - if obj.obj.Gap == nil { - obj.SetGap(12) - } - -} - -// ***** FlowBurst ***** -type flowBurst struct { - validation - obj *otg.FlowBurst - marshaller marshalFlowBurst - unMarshaller unMarshalFlowBurst - interBurstGapHolder FlowDurationInterBurstGap -} - -func NewFlowBurst() FlowBurst { - obj := flowBurst{obj: &otg.FlowBurst{}} - obj.setDefault() - return &obj -} - -func (obj *flowBurst) msg() *otg.FlowBurst { - return obj.obj -} - -func (obj *flowBurst) setMsg(msg *otg.FlowBurst) FlowBurst { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowBurst struct { - obj *flowBurst -} - -type marshalFlowBurst interface { - // ToProto marshals FlowBurst to protobuf object *otg.FlowBurst - ToProto() (*otg.FlowBurst, error) - // ToPbText marshals FlowBurst to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowBurst to YAML text - ToYaml() (string, error) - // ToJson marshals FlowBurst to JSON text - ToJson() (string, error) -} - -type unMarshalflowBurst struct { - obj *flowBurst -} - -type unMarshalFlowBurst interface { - // FromProto unmarshals FlowBurst from protobuf object *otg.FlowBurst - FromProto(msg *otg.FlowBurst) (FlowBurst, error) - // FromPbText unmarshals FlowBurst from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowBurst from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowBurst from JSON text - FromJson(value string) error -} - -func (obj *flowBurst) Marshal() marshalFlowBurst { - if obj.marshaller == nil { - obj.marshaller = &marshalflowBurst{obj: obj} - } - return obj.marshaller -} - -func (obj *flowBurst) Unmarshal() unMarshalFlowBurst { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowBurst{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowBurst) ToProto() (*otg.FlowBurst, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowBurst) FromProto(msg *otg.FlowBurst) (FlowBurst, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowBurst) 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 *unMarshalflowBurst) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowBurst) 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 *unMarshalflowBurst) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowBurst) 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 *unMarshalflowBurst) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowBurst) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowBurst) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowBurst) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowBurst) Clone() (FlowBurst, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowBurst() - 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 -} - -func (obj *flowBurst) setNil() { - obj.interBurstGapHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowBurst is transmits continuous or fixed burst of packets. -// For continuous burst of packets, it will not automatically stop. -// For fixed burst of packets, it will stop after transmitting fixed number of bursts. -type FlowBurst interface { - Validation - // msg marshals FlowBurst to protobuf object *otg.FlowBurst - // and doesn't set defaults - msg() *otg.FlowBurst - // setMsg unmarshals FlowBurst from protobuf object *otg.FlowBurst - // and doesn't set defaults - setMsg(*otg.FlowBurst) FlowBurst - // provides marshal interface - Marshal() marshalFlowBurst - // provides unmarshal interface - Unmarshal() unMarshalFlowBurst - // validate validates FlowBurst - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowBurst, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Bursts returns uint32, set in FlowBurst. - Bursts() uint32 - // SetBursts assigns uint32 provided by user to FlowBurst - SetBursts(value uint32) FlowBurst - // HasBursts checks if Bursts has been set in FlowBurst - HasBursts() bool - // Packets returns uint32, set in FlowBurst. - Packets() uint32 - // SetPackets assigns uint32 provided by user to FlowBurst - SetPackets(value uint32) FlowBurst - // HasPackets checks if Packets has been set in FlowBurst - HasPackets() bool - // Gap returns uint32, set in FlowBurst. - Gap() uint32 - // SetGap assigns uint32 provided by user to FlowBurst - SetGap(value uint32) FlowBurst - // HasGap checks if Gap has been set in FlowBurst - HasGap() bool - // InterBurstGap returns FlowDurationInterBurstGap, set in FlowBurst. - // FlowDurationInterBurstGap is the optional container for specifying a gap between bursts. - InterBurstGap() FlowDurationInterBurstGap - // SetInterBurstGap assigns FlowDurationInterBurstGap provided by user to FlowBurst. - // FlowDurationInterBurstGap is the optional container for specifying a gap between bursts. - SetInterBurstGap(value FlowDurationInterBurstGap) FlowBurst - // HasInterBurstGap checks if InterBurstGap has been set in FlowBurst - HasInterBurstGap() bool - setNil() -} - -// The number of packet bursts transmitted per flow. -// A value of 0 implies continuous burst of packets. -// Bursts returns a uint32 -func (obj *flowBurst) Bursts() uint32 { - - return *obj.obj.Bursts - -} - -// The number of packet bursts transmitted per flow. -// A value of 0 implies continuous burst of packets. -// Bursts returns a uint32 -func (obj *flowBurst) HasBursts() bool { - return obj.obj.Bursts != nil -} - -// The number of packet bursts transmitted per flow. -// A value of 0 implies continuous burst of packets. -// SetBursts sets the uint32 value in the FlowBurst object -func (obj *flowBurst) SetBursts(value uint32) FlowBurst { - - obj.obj.Bursts = &value - return obj -} - -// The number of packets transmitted per burst. -// Packets returns a uint32 -func (obj *flowBurst) Packets() uint32 { - - return *obj.obj.Packets - -} - -// The number of packets transmitted per burst. -// Packets returns a uint32 -func (obj *flowBurst) HasPackets() bool { - return obj.obj.Packets != nil -} - -// The number of packets transmitted per burst. -// SetPackets sets the uint32 value in the FlowBurst object -func (obj *flowBurst) SetPackets(value uint32) FlowBurst { - - obj.obj.Packets = &value - return obj -} - -// The minimum gap between packets expressed as bytes. -// Gap returns a uint32 -func (obj *flowBurst) Gap() uint32 { - - return *obj.obj.Gap - -} - -// The minimum gap between packets expressed as bytes. -// Gap returns a uint32 -func (obj *flowBurst) HasGap() bool { - return obj.obj.Gap != nil -} - -// The minimum gap between packets expressed as bytes. -// SetGap sets the uint32 value in the FlowBurst object -func (obj *flowBurst) SetGap(value uint32) FlowBurst { - - obj.obj.Gap = &value - return obj -} - -// description is TBD -// InterBurstGap returns a FlowDurationInterBurstGap -func (obj *flowBurst) InterBurstGap() FlowDurationInterBurstGap { - if obj.obj.InterBurstGap == nil { - obj.obj.InterBurstGap = NewFlowDurationInterBurstGap().msg() - } - if obj.interBurstGapHolder == nil { - obj.interBurstGapHolder = &flowDurationInterBurstGap{obj: obj.obj.InterBurstGap} - } - return obj.interBurstGapHolder -} - -// description is TBD -// InterBurstGap returns a FlowDurationInterBurstGap -func (obj *flowBurst) HasInterBurstGap() bool { - return obj.obj.InterBurstGap != nil -} - -// description is TBD -// SetInterBurstGap sets the FlowDurationInterBurstGap value in the FlowBurst object -func (obj *flowBurst) SetInterBurstGap(value FlowDurationInterBurstGap) FlowBurst { - - obj.interBurstGapHolder = nil - obj.obj.InterBurstGap = value.msg() - - return obj -} - -func (obj *flowBurst) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Packets != nil { - - if *obj.obj.Packets < 1 || *obj.obj.Packets > 4294967295 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= FlowBurst.Packets <= 4294967295 but Got %d", *obj.obj.Packets)) - } - - } - - if obj.obj.InterBurstGap != nil { - - obj.InterBurstGap().validateObj(vObj, set_default) - } - -} - -func (obj *flowBurst) setDefault() { - if obj.obj.Bursts == nil { - obj.SetBursts(0) - } - if obj.obj.Packets == nil { - obj.SetPackets(1) - } - if obj.obj.Gap == nil { - obj.SetGap(12) - } - -} - -// ***** FlowContinuous ***** -type flowContinuous struct { - validation - obj *otg.FlowContinuous - marshaller marshalFlowContinuous - unMarshaller unMarshalFlowContinuous - delayHolder FlowDelay -} - -func NewFlowContinuous() FlowContinuous { - obj := flowContinuous{obj: &otg.FlowContinuous{}} - obj.setDefault() - return &obj -} - -func (obj *flowContinuous) msg() *otg.FlowContinuous { - return obj.obj -} - -func (obj *flowContinuous) setMsg(msg *otg.FlowContinuous) FlowContinuous { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowContinuous struct { - obj *flowContinuous -} - -type marshalFlowContinuous interface { - // ToProto marshals FlowContinuous to protobuf object *otg.FlowContinuous - ToProto() (*otg.FlowContinuous, error) - // ToPbText marshals FlowContinuous to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowContinuous to YAML text - ToYaml() (string, error) - // ToJson marshals FlowContinuous to JSON text - ToJson() (string, error) -} - -type unMarshalflowContinuous struct { - obj *flowContinuous -} - -type unMarshalFlowContinuous interface { - // FromProto unmarshals FlowContinuous from protobuf object *otg.FlowContinuous - FromProto(msg *otg.FlowContinuous) (FlowContinuous, error) - // FromPbText unmarshals FlowContinuous from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowContinuous from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowContinuous from JSON text - FromJson(value string) error -} - -func (obj *flowContinuous) Marshal() marshalFlowContinuous { - if obj.marshaller == nil { - obj.marshaller = &marshalflowContinuous{obj: obj} - } - return obj.marshaller -} - -func (obj *flowContinuous) Unmarshal() unMarshalFlowContinuous { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowContinuous{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowContinuous) ToProto() (*otg.FlowContinuous, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowContinuous) FromProto(msg *otg.FlowContinuous) (FlowContinuous, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowContinuous) 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 *unMarshalflowContinuous) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowContinuous) 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 *unMarshalflowContinuous) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowContinuous) 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 *unMarshalflowContinuous) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowContinuous) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowContinuous) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowContinuous) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowContinuous) Clone() (FlowContinuous, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowContinuous() - 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 -} - -func (obj *flowContinuous) setNil() { - obj.delayHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowContinuous is transmit will be continuous and will not stop automatically. -type FlowContinuous interface { - Validation - // msg marshals FlowContinuous to protobuf object *otg.FlowContinuous - // and doesn't set defaults - msg() *otg.FlowContinuous - // setMsg unmarshals FlowContinuous from protobuf object *otg.FlowContinuous - // and doesn't set defaults - setMsg(*otg.FlowContinuous) FlowContinuous - // provides marshal interface - Marshal() marshalFlowContinuous - // provides unmarshal interface - Unmarshal() unMarshalFlowContinuous - // validate validates FlowContinuous - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowContinuous, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Gap returns uint32, set in FlowContinuous. - Gap() uint32 - // SetGap assigns uint32 provided by user to FlowContinuous - SetGap(value uint32) FlowContinuous - // HasGap checks if Gap has been set in FlowContinuous - HasGap() bool - // Delay returns FlowDelay, set in FlowContinuous. - // FlowDelay is the optional container to specify the delay before starting - // transmission of packets. - Delay() FlowDelay - // SetDelay assigns FlowDelay provided by user to FlowContinuous. - // FlowDelay is the optional container to specify the delay before starting - // transmission of packets. - SetDelay(value FlowDelay) FlowContinuous - // HasDelay checks if Delay has been set in FlowContinuous - HasDelay() bool - setNil() -} - -// The minimum gap between packets expressed as bytes. -// Gap returns a uint32 -func (obj *flowContinuous) Gap() uint32 { - - return *obj.obj.Gap - -} - -// The minimum gap between packets expressed as bytes. -// Gap returns a uint32 -func (obj *flowContinuous) HasGap() bool { - return obj.obj.Gap != nil -} - -// The minimum gap between packets expressed as bytes. -// SetGap sets the uint32 value in the FlowContinuous object -func (obj *flowContinuous) SetGap(value uint32) FlowContinuous { - - obj.obj.Gap = &value - return obj -} - -// description is TBD -// Delay returns a FlowDelay -func (obj *flowContinuous) Delay() FlowDelay { - if obj.obj.Delay == nil { - obj.obj.Delay = NewFlowDelay().msg() - } - if obj.delayHolder == nil { - obj.delayHolder = &flowDelay{obj: obj.obj.Delay} - } - return obj.delayHolder -} - -// description is TBD -// Delay returns a FlowDelay -func (obj *flowContinuous) HasDelay() bool { - return obj.obj.Delay != nil -} - -// description is TBD -// SetDelay sets the FlowDelay value in the FlowContinuous object -func (obj *flowContinuous) SetDelay(value FlowDelay) FlowContinuous { - - obj.delayHolder = nil - obj.obj.Delay = value.msg() - - return obj -} - -func (obj *flowContinuous) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Delay != nil { - - obj.Delay().validateObj(vObj, set_default) - } - -} - -func (obj *flowContinuous) setDefault() { - if obj.obj.Gap == nil { - obj.SetGap(12) - } - -} - -// ***** FlowRxTxRatio ***** -type flowRxTxRatio struct { - validation - obj *otg.FlowRxTxRatio - marshaller marshalFlowRxTxRatio - unMarshaller unMarshalFlowRxTxRatio - rxCountHolder FlowRxTxRatioRxCount -} - -func NewFlowRxTxRatio() FlowRxTxRatio { - obj := flowRxTxRatio{obj: &otg.FlowRxTxRatio{}} - obj.setDefault() - return &obj -} - -func (obj *flowRxTxRatio) msg() *otg.FlowRxTxRatio { - return obj.obj -} - -func (obj *flowRxTxRatio) setMsg(msg *otg.FlowRxTxRatio) FlowRxTxRatio { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRxTxRatio struct { - obj *flowRxTxRatio -} - -type marshalFlowRxTxRatio interface { - // ToProto marshals FlowRxTxRatio to protobuf object *otg.FlowRxTxRatio - ToProto() (*otg.FlowRxTxRatio, error) - // ToPbText marshals FlowRxTxRatio to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRxTxRatio to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRxTxRatio to JSON text - ToJson() (string, error) -} - -type unMarshalflowRxTxRatio struct { - obj *flowRxTxRatio -} - -type unMarshalFlowRxTxRatio interface { - // FromProto unmarshals FlowRxTxRatio from protobuf object *otg.FlowRxTxRatio - FromProto(msg *otg.FlowRxTxRatio) (FlowRxTxRatio, error) - // FromPbText unmarshals FlowRxTxRatio from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRxTxRatio from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRxTxRatio from JSON text - FromJson(value string) error -} - -func (obj *flowRxTxRatio) Marshal() marshalFlowRxTxRatio { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRxTxRatio{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRxTxRatio) Unmarshal() unMarshalFlowRxTxRatio { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRxTxRatio{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRxTxRatio) ToProto() (*otg.FlowRxTxRatio, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRxTxRatio) FromProto(msg *otg.FlowRxTxRatio) (FlowRxTxRatio, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRxTxRatio) 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 *unMarshalflowRxTxRatio) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRxTxRatio) 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 *unMarshalflowRxTxRatio) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRxTxRatio) 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 *unMarshalflowRxTxRatio) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRxTxRatio) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRxTxRatio) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRxTxRatio) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRxTxRatio) Clone() (FlowRxTxRatio, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRxTxRatio() - 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 -} - -func (obj *flowRxTxRatio) setNil() { - obj.rxCountHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRxTxRatio is rx Tx ratio is the ratio of expected number of Rx packets across all Rx ports to the Tx packets -// for the configured flow. It is a factor by which the Tx packet count is multiplied to calculate -// the sum of expected Rx packet count, across all Rx ports. This will be used to calculate loss -// percentage of flow at aggregate level. -type FlowRxTxRatio interface { - Validation - // msg marshals FlowRxTxRatio to protobuf object *otg.FlowRxTxRatio - // and doesn't set defaults - msg() *otg.FlowRxTxRatio - // setMsg unmarshals FlowRxTxRatio from protobuf object *otg.FlowRxTxRatio - // and doesn't set defaults - setMsg(*otg.FlowRxTxRatio) FlowRxTxRatio - // provides marshal interface - Marshal() marshalFlowRxTxRatio - // provides unmarshal interface - Unmarshal() unMarshalFlowRxTxRatio - // validate validates FlowRxTxRatio - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRxTxRatio, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRxTxRatioChoiceEnum, set in FlowRxTxRatio - Choice() FlowRxTxRatioChoiceEnum - // setChoice assigns FlowRxTxRatioChoiceEnum provided by user to FlowRxTxRatio - setChoice(value FlowRxTxRatioChoiceEnum) FlowRxTxRatio - // HasChoice checks if Choice has been set in FlowRxTxRatio - HasChoice() bool - // RxCount returns FlowRxTxRatioRxCount, set in FlowRxTxRatio. - // FlowRxTxRatioRxCount is this is for cases where one copy of Tx packet is received on all Rx ports and so the sum total of Rx packets - // received across all Rx ports is a multiple of Rx port count and Tx packets. - RxCount() FlowRxTxRatioRxCount - // SetRxCount assigns FlowRxTxRatioRxCount provided by user to FlowRxTxRatio. - // FlowRxTxRatioRxCount is this is for cases where one copy of Tx packet is received on all Rx ports and so the sum total of Rx packets - // received across all Rx ports is a multiple of Rx port count and Tx packets. - SetRxCount(value FlowRxTxRatioRxCount) FlowRxTxRatio - // HasRxCount checks if RxCount has been set in FlowRxTxRatio - HasRxCount() bool - // Value returns float32, set in FlowRxTxRatio. - Value() float32 - // SetValue assigns float32 provided by user to FlowRxTxRatio - SetValue(value float32) FlowRxTxRatio - // HasValue checks if Value has been set in FlowRxTxRatio - HasValue() bool - setNil() -} - -type FlowRxTxRatioChoiceEnum string - -// Enum of Choice on FlowRxTxRatio -var FlowRxTxRatioChoice = struct { - RX_COUNT FlowRxTxRatioChoiceEnum - VALUE FlowRxTxRatioChoiceEnum -}{ - RX_COUNT: FlowRxTxRatioChoiceEnum("rx_count"), - VALUE: FlowRxTxRatioChoiceEnum("value"), -} - -func (obj *flowRxTxRatio) Choice() FlowRxTxRatioChoiceEnum { - return FlowRxTxRatioChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowRxTxRatio) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRxTxRatio) setChoice(value FlowRxTxRatioChoiceEnum) FlowRxTxRatio { - intValue, ok := otg.FlowRxTxRatio_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRxTxRatioChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRxTxRatio_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Value = nil - obj.obj.RxCount = nil - obj.rxCountHolder = nil - - if value == FlowRxTxRatioChoice.RX_COUNT { - obj.obj.RxCount = NewFlowRxTxRatioRxCount().msg() - } - - if value == FlowRxTxRatioChoice.VALUE { - defaultValue := float32(1.0) - obj.obj.Value = &defaultValue - } - - return obj -} - -// description is TBD -// RxCount returns a FlowRxTxRatioRxCount -func (obj *flowRxTxRatio) RxCount() FlowRxTxRatioRxCount { - if obj.obj.RxCount == nil { - obj.setChoice(FlowRxTxRatioChoice.RX_COUNT) - } - if obj.rxCountHolder == nil { - obj.rxCountHolder = &flowRxTxRatioRxCount{obj: obj.obj.RxCount} - } - return obj.rxCountHolder -} - -// description is TBD -// RxCount returns a FlowRxTxRatioRxCount -func (obj *flowRxTxRatio) HasRxCount() bool { - return obj.obj.RxCount != nil -} - -// description is TBD -// SetRxCount sets the FlowRxTxRatioRxCount value in the FlowRxTxRatio object -func (obj *flowRxTxRatio) SetRxCount(value FlowRxTxRatioRxCount) FlowRxTxRatio { - obj.setChoice(FlowRxTxRatioChoice.RX_COUNT) - obj.rxCountHolder = nil - obj.obj.RxCount = value.msg() - - return obj -} - -// Should be a positive, non-zero value. The default value of 1, is when the Rx packet count across -// all ports is expected to match the Tx packet count. A custom integer value (>1) can be specified for -// loss calculation for cases when there are multiple destination addresses configured within one flow, -// but DUT is configured to replicate only to a subset of Rx ports. For cases when Tx side generates two -// packets from each source in 1:1 protection mode but only one of the two packets are received by the -// Rx port, we may need to specify a fractional value instead. -// Value returns a float32 -func (obj *flowRxTxRatio) Value() float32 { - - if obj.obj.Value == nil { - obj.setChoice(FlowRxTxRatioChoice.VALUE) - } - - return *obj.obj.Value - -} - -// Should be a positive, non-zero value. The default value of 1, is when the Rx packet count across -// all ports is expected to match the Tx packet count. A custom integer value (>1) can be specified for -// loss calculation for cases when there are multiple destination addresses configured within one flow, -// but DUT is configured to replicate only to a subset of Rx ports. For cases when Tx side generates two -// packets from each source in 1:1 protection mode but only one of the two packets are received by the -// Rx port, we may need to specify a fractional value instead. -// Value returns a float32 -func (obj *flowRxTxRatio) HasValue() bool { - return obj.obj.Value != nil -} - -// Should be a positive, non-zero value. The default value of 1, is when the Rx packet count across -// all ports is expected to match the Tx packet count. A custom integer value (>1) can be specified for -// loss calculation for cases when there are multiple destination addresses configured within one flow, -// but DUT is configured to replicate only to a subset of Rx ports. For cases when Tx side generates two -// packets from each source in 1:1 protection mode but only one of the two packets are received by the -// Rx port, we may need to specify a fractional value instead. -// SetValue sets the float32 value in the FlowRxTxRatio object -func (obj *flowRxTxRatio) SetValue(value float32) FlowRxTxRatio { - obj.setChoice(FlowRxTxRatioChoice.VALUE) - obj.obj.Value = &value - return obj -} - -func (obj *flowRxTxRatio) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RxCount != nil { - - obj.RxCount().validateObj(vObj, set_default) - } - -} - -func (obj *flowRxTxRatio) setDefault() { - var choices_set int = 0 - var choice FlowRxTxRatioChoiceEnum - - if obj.obj.RxCount != nil { - choices_set += 1 - choice = FlowRxTxRatioChoice.RX_COUNT - } - - if obj.obj.Value != nil { - choices_set += 1 - choice = FlowRxTxRatioChoice.VALUE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRxTxRatioChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRxTxRatio") - } - } else { - intVal := otg.FlowRxTxRatio_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRxTxRatio_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowLatencyMetrics ***** -type flowLatencyMetrics struct { - validation - obj *otg.FlowLatencyMetrics - marshaller marshalFlowLatencyMetrics - unMarshaller unMarshalFlowLatencyMetrics -} - -func NewFlowLatencyMetrics() FlowLatencyMetrics { - obj := flowLatencyMetrics{obj: &otg.FlowLatencyMetrics{}} - obj.setDefault() - return &obj -} - -func (obj *flowLatencyMetrics) msg() *otg.FlowLatencyMetrics { - return obj.obj -} - -func (obj *flowLatencyMetrics) setMsg(msg *otg.FlowLatencyMetrics) FlowLatencyMetrics { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowLatencyMetrics struct { - obj *flowLatencyMetrics -} - -type marshalFlowLatencyMetrics interface { - // ToProto marshals FlowLatencyMetrics to protobuf object *otg.FlowLatencyMetrics - ToProto() (*otg.FlowLatencyMetrics, error) - // ToPbText marshals FlowLatencyMetrics to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowLatencyMetrics to YAML text - ToYaml() (string, error) - // ToJson marshals FlowLatencyMetrics to JSON text - ToJson() (string, error) -} - -type unMarshalflowLatencyMetrics struct { - obj *flowLatencyMetrics -} - -type unMarshalFlowLatencyMetrics interface { - // FromProto unmarshals FlowLatencyMetrics from protobuf object *otg.FlowLatencyMetrics - FromProto(msg *otg.FlowLatencyMetrics) (FlowLatencyMetrics, error) - // FromPbText unmarshals FlowLatencyMetrics from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowLatencyMetrics from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowLatencyMetrics from JSON text - FromJson(value string) error -} - -func (obj *flowLatencyMetrics) Marshal() marshalFlowLatencyMetrics { - if obj.marshaller == nil { - obj.marshaller = &marshalflowLatencyMetrics{obj: obj} - } - return obj.marshaller -} - -func (obj *flowLatencyMetrics) Unmarshal() unMarshalFlowLatencyMetrics { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowLatencyMetrics{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowLatencyMetrics) ToProto() (*otg.FlowLatencyMetrics, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowLatencyMetrics) FromProto(msg *otg.FlowLatencyMetrics) (FlowLatencyMetrics, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowLatencyMetrics) 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 *unMarshalflowLatencyMetrics) 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 *marshalflowLatencyMetrics) 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 *unMarshalflowLatencyMetrics) 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 *marshalflowLatencyMetrics) 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 *unMarshalflowLatencyMetrics) 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 *flowLatencyMetrics) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowLatencyMetrics) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowLatencyMetrics) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowLatencyMetrics) Clone() (FlowLatencyMetrics, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowLatencyMetrics() - 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 -} - -// FlowLatencyMetrics is the optional container for per flow latency metric configuration. -type FlowLatencyMetrics interface { - Validation - // msg marshals FlowLatencyMetrics to protobuf object *otg.FlowLatencyMetrics - // and doesn't set defaults - msg() *otg.FlowLatencyMetrics - // setMsg unmarshals FlowLatencyMetrics from protobuf object *otg.FlowLatencyMetrics - // and doesn't set defaults - setMsg(*otg.FlowLatencyMetrics) FlowLatencyMetrics - // provides marshal interface - Marshal() marshalFlowLatencyMetrics - // provides unmarshal interface - Unmarshal() unMarshalFlowLatencyMetrics - // validate validates FlowLatencyMetrics - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowLatencyMetrics, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Enable returns bool, set in FlowLatencyMetrics. - Enable() bool - // SetEnable assigns bool provided by user to FlowLatencyMetrics - SetEnable(value bool) FlowLatencyMetrics - // HasEnable checks if Enable has been set in FlowLatencyMetrics - HasEnable() bool - // Mode returns FlowLatencyMetricsModeEnum, set in FlowLatencyMetrics - Mode() FlowLatencyMetricsModeEnum - // SetMode assigns FlowLatencyMetricsModeEnum provided by user to FlowLatencyMetrics - SetMode(value FlowLatencyMetricsModeEnum) FlowLatencyMetrics - // HasMode checks if Mode has been set in FlowLatencyMetrics - HasMode() bool -} - -// True to enable latency metrics using timestamps. -// -// Enabling this option may affect the resultant packet payload due to -// additional instrumentation data. -// Enable returns a bool -func (obj *flowLatencyMetrics) Enable() bool { - - return *obj.obj.Enable - -} - -// True to enable latency metrics using timestamps. -// -// Enabling this option may affect the resultant packet payload due to -// additional instrumentation data. -// Enable returns a bool -func (obj *flowLatencyMetrics) HasEnable() bool { - return obj.obj.Enable != nil -} - -// True to enable latency metrics using timestamps. -// -// Enabling this option may affect the resultant packet payload due to -// additional instrumentation data. -// SetEnable sets the bool value in the FlowLatencyMetrics object -func (obj *flowLatencyMetrics) SetEnable(value bool) FlowLatencyMetrics { - - obj.obj.Enable = &value - return obj -} - -type FlowLatencyMetricsModeEnum string - -// Enum of Mode on FlowLatencyMetrics -var FlowLatencyMetricsMode = struct { - STORE_FORWARD FlowLatencyMetricsModeEnum - CUT_THROUGH FlowLatencyMetricsModeEnum -}{ - STORE_FORWARD: FlowLatencyMetricsModeEnum("store_forward"), - CUT_THROUGH: FlowLatencyMetricsModeEnum("cut_through"), -} - -func (obj *flowLatencyMetrics) Mode() FlowLatencyMetricsModeEnum { - return FlowLatencyMetricsModeEnum(obj.obj.Mode.Enum().String()) -} - -// Select the type of latency measurement. The different types of -// latency measurements are: -// -// store_forward: -// The time interval starting when the last bit of the frame leaves the -// sending port and ending when the first bit of the frame is seen on -// the receiving port (LIFO). This is based on the RFC 1242 standard. -// -// cut_through: -// The time interval starting when the first bit of the frame leaves -// the sending port and ending when the first bit of the frame is seen -// on the receiving port (FIFO). This is based on the RFC 1242 -// standard. -// Mode returns a string -func (obj *flowLatencyMetrics) HasMode() bool { - return obj.obj.Mode != nil -} - -func (obj *flowLatencyMetrics) SetMode(value FlowLatencyMetricsModeEnum) FlowLatencyMetrics { - intValue, ok := otg.FlowLatencyMetrics_Mode_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowLatencyMetricsModeEnum", string(value))) - return obj - } - enumValue := otg.FlowLatencyMetrics_Mode_Enum(intValue) - obj.obj.Mode = &enumValue - - return obj -} - -func (obj *flowLatencyMetrics) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *flowLatencyMetrics) setDefault() { - if obj.obj.Enable == nil { - obj.SetEnable(false) - } - if obj.obj.Mode == nil { - obj.SetMode(FlowLatencyMetricsMode.STORE_FORWARD) - - } - -} - -// ***** FlowPredefinedTags ***** -type flowPredefinedTags struct { - validation - obj *otg.FlowPredefinedTags - marshaller marshalFlowPredefinedTags - unMarshaller unMarshalFlowPredefinedTags -} - -func NewFlowPredefinedTags() FlowPredefinedTags { - obj := flowPredefinedTags{obj: &otg.FlowPredefinedTags{}} - obj.setDefault() - return &obj -} - -func (obj *flowPredefinedTags) msg() *otg.FlowPredefinedTags { - return obj.obj -} - -func (obj *flowPredefinedTags) setMsg(msg *otg.FlowPredefinedTags) FlowPredefinedTags { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowPredefinedTags struct { - obj *flowPredefinedTags -} - -type marshalFlowPredefinedTags interface { - // ToProto marshals FlowPredefinedTags to protobuf object *otg.FlowPredefinedTags - ToProto() (*otg.FlowPredefinedTags, error) - // ToPbText marshals FlowPredefinedTags to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowPredefinedTags to YAML text - ToYaml() (string, error) - // ToJson marshals FlowPredefinedTags to JSON text - ToJson() (string, error) -} - -type unMarshalflowPredefinedTags struct { - obj *flowPredefinedTags -} - -type unMarshalFlowPredefinedTags interface { - // FromProto unmarshals FlowPredefinedTags from protobuf object *otg.FlowPredefinedTags - FromProto(msg *otg.FlowPredefinedTags) (FlowPredefinedTags, error) - // FromPbText unmarshals FlowPredefinedTags from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowPredefinedTags from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowPredefinedTags from JSON text - FromJson(value string) error -} - -func (obj *flowPredefinedTags) Marshal() marshalFlowPredefinedTags { - if obj.marshaller == nil { - obj.marshaller = &marshalflowPredefinedTags{obj: obj} - } - return obj.marshaller -} - -func (obj *flowPredefinedTags) Unmarshal() unMarshalFlowPredefinedTags { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowPredefinedTags{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowPredefinedTags) ToProto() (*otg.FlowPredefinedTags, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowPredefinedTags) FromProto(msg *otg.FlowPredefinedTags) (FlowPredefinedTags, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowPredefinedTags) 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 *unMarshalflowPredefinedTags) 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 *marshalflowPredefinedTags) 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 *unMarshalflowPredefinedTags) 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 *marshalflowPredefinedTags) 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 *unMarshalflowPredefinedTags) 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 *flowPredefinedTags) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowPredefinedTags) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowPredefinedTags) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowPredefinedTags) Clone() (FlowPredefinedTags, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowPredefinedTags() - 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 -} - -// FlowPredefinedTags is list of predefined flow tracking options, outside packet fields, that can be enabled. -type FlowPredefinedTags interface { - Validation - // msg marshals FlowPredefinedTags to protobuf object *otg.FlowPredefinedTags - // and doesn't set defaults - msg() *otg.FlowPredefinedTags - // setMsg unmarshals FlowPredefinedTags from protobuf object *otg.FlowPredefinedTags - // and doesn't set defaults - setMsg(*otg.FlowPredefinedTags) FlowPredefinedTags - // provides marshal interface - Marshal() marshalFlowPredefinedTags - // provides unmarshal interface - Unmarshal() unMarshalFlowPredefinedTags - // validate validates FlowPredefinedTags - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowPredefinedTags, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RxName returns bool, set in FlowPredefinedTags. - RxName() bool - // SetRxName assigns bool provided by user to FlowPredefinedTags - SetRxName(value bool) FlowPredefinedTags - // HasRxName checks if RxName has been set in FlowPredefinedTags - HasRxName() bool -} - -// Enables Rx port or lag level disaggregation with predefined metrics tag name set as "rx_name". -// The Rx port / lag names can be found under tagged_metrics tag names in flow metrics response. -// RxName returns a bool -func (obj *flowPredefinedTags) RxName() bool { - - return *obj.obj.RxName - -} - -// Enables Rx port or lag level disaggregation with predefined metrics tag name set as "rx_name". -// The Rx port / lag names can be found under tagged_metrics tag names in flow metrics response. -// RxName returns a bool -func (obj *flowPredefinedTags) HasRxName() bool { - return obj.obj.RxName != nil -} - -// Enables Rx port or lag level disaggregation with predefined metrics tag name set as "rx_name". -// The Rx port / lag names can be found under tagged_metrics tag names in flow metrics response. -// SetRxName sets the bool value in the FlowPredefinedTags object -func (obj *flowPredefinedTags) SetRxName(value bool) FlowPredefinedTags { - - obj.obj.RxName = &value - return obj -} - -func (obj *flowPredefinedTags) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *flowPredefinedTags) setDefault() { - if obj.obj.RxName == nil { - obj.SetRxName(false) - } - -} - -// ***** LldpChassisMacSubType ***** -type lldpChassisMacSubType struct { - validation - obj *otg.LldpChassisMacSubType - marshaller marshalLldpChassisMacSubType - unMarshaller unMarshalLldpChassisMacSubType -} - -func NewLldpChassisMacSubType() LldpChassisMacSubType { - obj := lldpChassisMacSubType{obj: &otg.LldpChassisMacSubType{}} - obj.setDefault() - return &obj -} - -func (obj *lldpChassisMacSubType) msg() *otg.LldpChassisMacSubType { - return obj.obj -} - -func (obj *lldpChassisMacSubType) setMsg(msg *otg.LldpChassisMacSubType) LldpChassisMacSubType { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallldpChassisMacSubType struct { - obj *lldpChassisMacSubType -} - -type marshalLldpChassisMacSubType interface { - // ToProto marshals LldpChassisMacSubType to protobuf object *otg.LldpChassisMacSubType - ToProto() (*otg.LldpChassisMacSubType, error) - // ToPbText marshals LldpChassisMacSubType to protobuf text - ToPbText() (string, error) - // ToYaml marshals LldpChassisMacSubType to YAML text - ToYaml() (string, error) - // ToJson marshals LldpChassisMacSubType to JSON text - ToJson() (string, error) -} - -type unMarshallldpChassisMacSubType struct { - obj *lldpChassisMacSubType -} - -type unMarshalLldpChassisMacSubType interface { - // FromProto unmarshals LldpChassisMacSubType from protobuf object *otg.LldpChassisMacSubType - FromProto(msg *otg.LldpChassisMacSubType) (LldpChassisMacSubType, error) - // FromPbText unmarshals LldpChassisMacSubType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LldpChassisMacSubType from YAML text - FromYaml(value string) error - // FromJson unmarshals LldpChassisMacSubType from JSON text - FromJson(value string) error -} - -func (obj *lldpChassisMacSubType) Marshal() marshalLldpChassisMacSubType { - if obj.marshaller == nil { - obj.marshaller = &marshallldpChassisMacSubType{obj: obj} - } - return obj.marshaller -} - -func (obj *lldpChassisMacSubType) Unmarshal() unMarshalLldpChassisMacSubType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallldpChassisMacSubType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallldpChassisMacSubType) ToProto() (*otg.LldpChassisMacSubType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallldpChassisMacSubType) FromProto(msg *otg.LldpChassisMacSubType) (LldpChassisMacSubType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallldpChassisMacSubType) 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 *unMarshallldpChassisMacSubType) 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 *marshallldpChassisMacSubType) 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 *unMarshallldpChassisMacSubType) 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 *marshallldpChassisMacSubType) 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 *unMarshallldpChassisMacSubType) 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 *lldpChassisMacSubType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lldpChassisMacSubType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lldpChassisMacSubType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lldpChassisMacSubType) Clone() (LldpChassisMacSubType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLldpChassisMacSubType() - 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 -} - -// LldpChassisMacSubType is the MAC address configured in the Chassis ID TLV. -type LldpChassisMacSubType interface { - Validation - // msg marshals LldpChassisMacSubType to protobuf object *otg.LldpChassisMacSubType - // and doesn't set defaults - msg() *otg.LldpChassisMacSubType - // setMsg unmarshals LldpChassisMacSubType from protobuf object *otg.LldpChassisMacSubType - // and doesn't set defaults - setMsg(*otg.LldpChassisMacSubType) LldpChassisMacSubType - // provides marshal interface - Marshal() marshalLldpChassisMacSubType - // provides unmarshal interface - Unmarshal() unMarshalLldpChassisMacSubType - // validate validates LldpChassisMacSubType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LldpChassisMacSubType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns LldpChassisMacSubTypeChoiceEnum, set in LldpChassisMacSubType - Choice() LldpChassisMacSubTypeChoiceEnum - // setChoice assigns LldpChassisMacSubTypeChoiceEnum provided by user to LldpChassisMacSubType - setChoice(value LldpChassisMacSubTypeChoiceEnum) LldpChassisMacSubType - // HasChoice checks if Choice has been set in LldpChassisMacSubType - HasChoice() bool - // Auto returns string, set in LldpChassisMacSubType. - Auto() string - // HasAuto checks if Auto has been set in LldpChassisMacSubType - HasAuto() bool - // Value returns string, set in LldpChassisMacSubType. - Value() string - // SetValue assigns string provided by user to LldpChassisMacSubType - SetValue(value string) LldpChassisMacSubType - // HasValue checks if Value has been set in LldpChassisMacSubType - HasValue() bool -} - -type LldpChassisMacSubTypeChoiceEnum string - -// Enum of Choice on LldpChassisMacSubType -var LldpChassisMacSubTypeChoice = struct { - AUTO LldpChassisMacSubTypeChoiceEnum - VALUE LldpChassisMacSubTypeChoiceEnum -}{ - AUTO: LldpChassisMacSubTypeChoiceEnum("auto"), - VALUE: LldpChassisMacSubTypeChoiceEnum("value"), -} - -func (obj *lldpChassisMacSubType) Choice() LldpChassisMacSubTypeChoiceEnum { - return LldpChassisMacSubTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// In auto mode the system generated value is set for this property, while if the choice is selected as value, a user configured value will be used for this property. -// Choice returns a string -func (obj *lldpChassisMacSubType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *lldpChassisMacSubType) setChoice(value LldpChassisMacSubTypeChoiceEnum) LldpChassisMacSubType { - intValue, ok := otg.LldpChassisMacSubType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LldpChassisMacSubTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.LldpChassisMacSubType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Value = nil - obj.obj.Auto = nil - return obj -} - -// The OTG implementation must provide a system generated value for this property. -// Auto returns a string -func (obj *lldpChassisMacSubType) Auto() string { - - if obj.obj.Auto == nil { - obj.setChoice(LldpChassisMacSubTypeChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation must provide a system generated value for this property. -// Auto returns a string -func (obj *lldpChassisMacSubType) HasAuto() bool { - return obj.obj.Auto != nil -} - -// User must specify a value if mode is not auto. -// Value returns a string -func (obj *lldpChassisMacSubType) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(LldpChassisMacSubTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// User must specify a value if mode is not auto. -// Value returns a string -func (obj *lldpChassisMacSubType) HasValue() bool { - return obj.obj.Value != nil -} - -// User must specify a value if mode is not auto. -// SetValue sets the string value in the LldpChassisMacSubType object -func (obj *lldpChassisMacSubType) SetValue(value string) LldpChassisMacSubType { - obj.setChoice(LldpChassisMacSubTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -func (obj *lldpChassisMacSubType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Auto != nil { - - err := obj.validateMac(obj.Auto()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on LldpChassisMacSubType.Auto")) - } - - } - - if obj.obj.Value != nil { - - err := obj.validateMac(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on LldpChassisMacSubType.Value")) - } - - } - -} - -func (obj *lldpChassisMacSubType) setDefault() { - var choices_set int = 0 - var choice LldpChassisMacSubTypeChoiceEnum - - if obj.obj.Auto != nil { - choices_set += 1 - choice = LldpChassisMacSubTypeChoice.AUTO - } - - if obj.obj.Value != nil { - choices_set += 1 - choice = LldpChassisMacSubTypeChoice.VALUE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(LldpChassisMacSubTypeChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in LldpChassisMacSubType") - } - } else { - intVal := otg.LldpChassisMacSubType_Choice_Enum_value[string(choice)] - enumValue := otg.LldpChassisMacSubType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** LldpPortInterfaceNameSubType ***** -type lldpPortInterfaceNameSubType struct { - validation - obj *otg.LldpPortInterfaceNameSubType - marshaller marshalLldpPortInterfaceNameSubType - unMarshaller unMarshalLldpPortInterfaceNameSubType -} - -func NewLldpPortInterfaceNameSubType() LldpPortInterfaceNameSubType { - obj := lldpPortInterfaceNameSubType{obj: &otg.LldpPortInterfaceNameSubType{}} - obj.setDefault() - return &obj -} - -func (obj *lldpPortInterfaceNameSubType) msg() *otg.LldpPortInterfaceNameSubType { - return obj.obj -} - -func (obj *lldpPortInterfaceNameSubType) setMsg(msg *otg.LldpPortInterfaceNameSubType) LldpPortInterfaceNameSubType { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallldpPortInterfaceNameSubType struct { - obj *lldpPortInterfaceNameSubType -} - -type marshalLldpPortInterfaceNameSubType interface { - // ToProto marshals LldpPortInterfaceNameSubType to protobuf object *otg.LldpPortInterfaceNameSubType - ToProto() (*otg.LldpPortInterfaceNameSubType, error) - // ToPbText marshals LldpPortInterfaceNameSubType to protobuf text - ToPbText() (string, error) - // ToYaml marshals LldpPortInterfaceNameSubType to YAML text - ToYaml() (string, error) - // ToJson marshals LldpPortInterfaceNameSubType to JSON text - ToJson() (string, error) -} - -type unMarshallldpPortInterfaceNameSubType struct { - obj *lldpPortInterfaceNameSubType -} - -type unMarshalLldpPortInterfaceNameSubType interface { - // FromProto unmarshals LldpPortInterfaceNameSubType from protobuf object *otg.LldpPortInterfaceNameSubType - FromProto(msg *otg.LldpPortInterfaceNameSubType) (LldpPortInterfaceNameSubType, error) - // FromPbText unmarshals LldpPortInterfaceNameSubType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LldpPortInterfaceNameSubType from YAML text - FromYaml(value string) error - // FromJson unmarshals LldpPortInterfaceNameSubType from JSON text - FromJson(value string) error -} - -func (obj *lldpPortInterfaceNameSubType) Marshal() marshalLldpPortInterfaceNameSubType { - if obj.marshaller == nil { - obj.marshaller = &marshallldpPortInterfaceNameSubType{obj: obj} - } - return obj.marshaller -} - -func (obj *lldpPortInterfaceNameSubType) Unmarshal() unMarshalLldpPortInterfaceNameSubType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallldpPortInterfaceNameSubType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallldpPortInterfaceNameSubType) ToProto() (*otg.LldpPortInterfaceNameSubType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallldpPortInterfaceNameSubType) FromProto(msg *otg.LldpPortInterfaceNameSubType) (LldpPortInterfaceNameSubType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallldpPortInterfaceNameSubType) 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 *unMarshallldpPortInterfaceNameSubType) 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 *marshallldpPortInterfaceNameSubType) 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 *unMarshallldpPortInterfaceNameSubType) 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 *marshallldpPortInterfaceNameSubType) 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 *unMarshallldpPortInterfaceNameSubType) 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 *lldpPortInterfaceNameSubType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lldpPortInterfaceNameSubType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lldpPortInterfaceNameSubType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lldpPortInterfaceNameSubType) Clone() (LldpPortInterfaceNameSubType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLldpPortInterfaceNameSubType() - 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 -} - -// LldpPortInterfaceNameSubType is the interface name configured in the Port ID TLV. -type LldpPortInterfaceNameSubType interface { - Validation - // msg marshals LldpPortInterfaceNameSubType to protobuf object *otg.LldpPortInterfaceNameSubType - // and doesn't set defaults - msg() *otg.LldpPortInterfaceNameSubType - // setMsg unmarshals LldpPortInterfaceNameSubType from protobuf object *otg.LldpPortInterfaceNameSubType - // and doesn't set defaults - setMsg(*otg.LldpPortInterfaceNameSubType) LldpPortInterfaceNameSubType - // provides marshal interface - Marshal() marshalLldpPortInterfaceNameSubType - // provides unmarshal interface - Unmarshal() unMarshalLldpPortInterfaceNameSubType - // validate validates LldpPortInterfaceNameSubType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LldpPortInterfaceNameSubType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns LldpPortInterfaceNameSubTypeChoiceEnum, set in LldpPortInterfaceNameSubType - Choice() LldpPortInterfaceNameSubTypeChoiceEnum - // setChoice assigns LldpPortInterfaceNameSubTypeChoiceEnum provided by user to LldpPortInterfaceNameSubType - setChoice(value LldpPortInterfaceNameSubTypeChoiceEnum) LldpPortInterfaceNameSubType - // HasChoice checks if Choice has been set in LldpPortInterfaceNameSubType - HasChoice() bool - // Auto returns string, set in LldpPortInterfaceNameSubType. - Auto() string - // HasAuto checks if Auto has been set in LldpPortInterfaceNameSubType - HasAuto() bool - // Value returns string, set in LldpPortInterfaceNameSubType. - Value() string - // SetValue assigns string provided by user to LldpPortInterfaceNameSubType - SetValue(value string) LldpPortInterfaceNameSubType - // HasValue checks if Value has been set in LldpPortInterfaceNameSubType - HasValue() bool -} - -type LldpPortInterfaceNameSubTypeChoiceEnum string - -// Enum of Choice on LldpPortInterfaceNameSubType -var LldpPortInterfaceNameSubTypeChoice = struct { - AUTO LldpPortInterfaceNameSubTypeChoiceEnum - VALUE LldpPortInterfaceNameSubTypeChoiceEnum -}{ - AUTO: LldpPortInterfaceNameSubTypeChoiceEnum("auto"), - VALUE: LldpPortInterfaceNameSubTypeChoiceEnum("value"), -} - -func (obj *lldpPortInterfaceNameSubType) Choice() LldpPortInterfaceNameSubTypeChoiceEnum { - return LldpPortInterfaceNameSubTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// In auto mode the system generated value is set for this property, while if the choice is selected as value, a user configured value will be used for this property. -// Choice returns a string -func (obj *lldpPortInterfaceNameSubType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *lldpPortInterfaceNameSubType) setChoice(value LldpPortInterfaceNameSubTypeChoiceEnum) LldpPortInterfaceNameSubType { - intValue, ok := otg.LldpPortInterfaceNameSubType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LldpPortInterfaceNameSubTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.LldpPortInterfaceNameSubType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Value = nil - obj.obj.Auto = nil - return obj -} - -// The OTG implementation must provide a system generated value for this property. -// Auto returns a string -func (obj *lldpPortInterfaceNameSubType) Auto() string { - - if obj.obj.Auto == nil { - obj.setChoice(LldpPortInterfaceNameSubTypeChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation must provide a system generated value for this property. -// Auto returns a string -func (obj *lldpPortInterfaceNameSubType) HasAuto() bool { - return obj.obj.Auto != nil -} - -// User must specify a value if mode is not auto. -// Value returns a string -func (obj *lldpPortInterfaceNameSubType) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(LldpPortInterfaceNameSubTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// User must specify a value if mode is not auto. -// Value returns a string -func (obj *lldpPortInterfaceNameSubType) HasValue() bool { - return obj.obj.Value != nil -} - -// User must specify a value if mode is not auto. -// SetValue sets the string value in the LldpPortInterfaceNameSubType object -func (obj *lldpPortInterfaceNameSubType) SetValue(value string) LldpPortInterfaceNameSubType { - obj.setChoice(LldpPortInterfaceNameSubTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -func (obj *lldpPortInterfaceNameSubType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *lldpPortInterfaceNameSubType) setDefault() { - var choices_set int = 0 - var choice LldpPortInterfaceNameSubTypeChoiceEnum - - if obj.obj.Auto != nil { - choices_set += 1 - choice = LldpPortInterfaceNameSubTypeChoice.AUTO - } - - if obj.obj.Value != nil { - choices_set += 1 - choice = LldpPortInterfaceNameSubTypeChoice.VALUE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(LldpPortInterfaceNameSubTypeChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in LldpPortInterfaceNameSubType") - } - } else { - intVal := otg.LldpPortInterfaceNameSubType_Choice_Enum_value[string(choice)] - enumValue := otg.LldpPortInterfaceNameSubType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** StateProtocolLacpAdmin ***** -type stateProtocolLacpAdmin struct { - validation - obj *otg.StateProtocolLacpAdmin - marshaller marshalStateProtocolLacpAdmin - unMarshaller unMarshalStateProtocolLacpAdmin -} - -func NewStateProtocolLacpAdmin() StateProtocolLacpAdmin { - obj := stateProtocolLacpAdmin{obj: &otg.StateProtocolLacpAdmin{}} - obj.setDefault() - return &obj -} - -func (obj *stateProtocolLacpAdmin) msg() *otg.StateProtocolLacpAdmin { - return obj.obj -} - -func (obj *stateProtocolLacpAdmin) setMsg(msg *otg.StateProtocolLacpAdmin) StateProtocolLacpAdmin { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstateProtocolLacpAdmin struct { - obj *stateProtocolLacpAdmin -} - -type marshalStateProtocolLacpAdmin interface { - // ToProto marshals StateProtocolLacpAdmin to protobuf object *otg.StateProtocolLacpAdmin - ToProto() (*otg.StateProtocolLacpAdmin, error) - // ToPbText marshals StateProtocolLacpAdmin to protobuf text - ToPbText() (string, error) - // ToYaml marshals StateProtocolLacpAdmin to YAML text - ToYaml() (string, error) - // ToJson marshals StateProtocolLacpAdmin to JSON text - ToJson() (string, error) -} - -type unMarshalstateProtocolLacpAdmin struct { - obj *stateProtocolLacpAdmin -} - -type unMarshalStateProtocolLacpAdmin interface { - // FromProto unmarshals StateProtocolLacpAdmin from protobuf object *otg.StateProtocolLacpAdmin - FromProto(msg *otg.StateProtocolLacpAdmin) (StateProtocolLacpAdmin, error) - // FromPbText unmarshals StateProtocolLacpAdmin from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StateProtocolLacpAdmin from YAML text - FromYaml(value string) error - // FromJson unmarshals StateProtocolLacpAdmin from JSON text - FromJson(value string) error -} - -func (obj *stateProtocolLacpAdmin) Marshal() marshalStateProtocolLacpAdmin { - if obj.marshaller == nil { - obj.marshaller = &marshalstateProtocolLacpAdmin{obj: obj} - } - return obj.marshaller -} - -func (obj *stateProtocolLacpAdmin) Unmarshal() unMarshalStateProtocolLacpAdmin { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstateProtocolLacpAdmin{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstateProtocolLacpAdmin) ToProto() (*otg.StateProtocolLacpAdmin, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstateProtocolLacpAdmin) FromProto(msg *otg.StateProtocolLacpAdmin) (StateProtocolLacpAdmin, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstateProtocolLacpAdmin) 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 *unMarshalstateProtocolLacpAdmin) 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 *marshalstateProtocolLacpAdmin) 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 *unMarshalstateProtocolLacpAdmin) 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 *marshalstateProtocolLacpAdmin) 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 *unMarshalstateProtocolLacpAdmin) 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 *stateProtocolLacpAdmin) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *stateProtocolLacpAdmin) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *stateProtocolLacpAdmin) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *stateProtocolLacpAdmin) Clone() (StateProtocolLacpAdmin, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStateProtocolLacpAdmin() - 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 -} - -// StateProtocolLacpAdmin is sets admin state of LACP configured on LAG members -type StateProtocolLacpAdmin interface { - Validation - // msg marshals StateProtocolLacpAdmin to protobuf object *otg.StateProtocolLacpAdmin - // and doesn't set defaults - msg() *otg.StateProtocolLacpAdmin - // setMsg unmarshals StateProtocolLacpAdmin from protobuf object *otg.StateProtocolLacpAdmin - // and doesn't set defaults - setMsg(*otg.StateProtocolLacpAdmin) StateProtocolLacpAdmin - // provides marshal interface - Marshal() marshalStateProtocolLacpAdmin - // provides unmarshal interface - Unmarshal() unMarshalStateProtocolLacpAdmin - // validate validates StateProtocolLacpAdmin - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StateProtocolLacpAdmin, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // LagMemberNames returns []string, set in StateProtocolLacpAdmin. - LagMemberNames() []string - // SetLagMemberNames assigns []string provided by user to StateProtocolLacpAdmin - SetLagMemberNames(value []string) StateProtocolLacpAdmin - // State returns StateProtocolLacpAdminStateEnum, set in StateProtocolLacpAdmin - State() StateProtocolLacpAdminStateEnum - // SetState assigns StateProtocolLacpAdminStateEnum provided by user to StateProtocolLacpAdmin - SetState(value StateProtocolLacpAdminStateEnum) StateProtocolLacpAdmin -} - -// The names of LAG members (ports) for which the state has to be applied. An empty or null list will control all LAG members. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// LagMemberNames returns a []string -func (obj *stateProtocolLacpAdmin) LagMemberNames() []string { - if obj.obj.LagMemberNames == nil { - obj.obj.LagMemberNames = make([]string, 0) - } - return obj.obj.LagMemberNames -} - -// The names of LAG members (ports) for which the state has to be applied. An empty or null list will control all LAG members. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// SetLagMemberNames sets the []string value in the StateProtocolLacpAdmin object -func (obj *stateProtocolLacpAdmin) SetLagMemberNames(value []string) StateProtocolLacpAdmin { - - if obj.obj.LagMemberNames == nil { - obj.obj.LagMemberNames = make([]string, 0) - } - obj.obj.LagMemberNames = value - - return obj -} - -type StateProtocolLacpAdminStateEnum string - -// Enum of State on StateProtocolLacpAdmin -var StateProtocolLacpAdminState = struct { - UP StateProtocolLacpAdminStateEnum - DOWN StateProtocolLacpAdminStateEnum -}{ - UP: StateProtocolLacpAdminStateEnum("up"), - DOWN: StateProtocolLacpAdminStateEnum("down"), -} - -func (obj *stateProtocolLacpAdmin) State() StateProtocolLacpAdminStateEnum { - return StateProtocolLacpAdminStateEnum(obj.obj.State.Enum().String()) -} - -func (obj *stateProtocolLacpAdmin) SetState(value StateProtocolLacpAdminStateEnum) StateProtocolLacpAdmin { - intValue, ok := otg.StateProtocolLacpAdmin_State_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StateProtocolLacpAdminStateEnum", string(value))) - return obj - } - enumValue := otg.StateProtocolLacpAdmin_State_Enum(intValue) - obj.obj.State = &enumValue - - return obj -} - -func (obj *stateProtocolLacpAdmin) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // State is required - if obj.obj.State == nil { - vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StateProtocolLacpAdmin") - } -} - -func (obj *stateProtocolLacpAdmin) setDefault() { - -} - -// ***** StateProtocolLacpMemberPorts ***** -type stateProtocolLacpMemberPorts struct { - validation - obj *otg.StateProtocolLacpMemberPorts - marshaller marshalStateProtocolLacpMemberPorts - unMarshaller unMarshalStateProtocolLacpMemberPorts -} - -func NewStateProtocolLacpMemberPorts() StateProtocolLacpMemberPorts { - obj := stateProtocolLacpMemberPorts{obj: &otg.StateProtocolLacpMemberPorts{}} - obj.setDefault() - return &obj -} - -func (obj *stateProtocolLacpMemberPorts) msg() *otg.StateProtocolLacpMemberPorts { - return obj.obj -} - -func (obj *stateProtocolLacpMemberPorts) setMsg(msg *otg.StateProtocolLacpMemberPorts) StateProtocolLacpMemberPorts { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstateProtocolLacpMemberPorts struct { - obj *stateProtocolLacpMemberPorts -} - -type marshalStateProtocolLacpMemberPorts interface { - // ToProto marshals StateProtocolLacpMemberPorts to protobuf object *otg.StateProtocolLacpMemberPorts - ToProto() (*otg.StateProtocolLacpMemberPorts, error) - // ToPbText marshals StateProtocolLacpMemberPorts to protobuf text - ToPbText() (string, error) - // ToYaml marshals StateProtocolLacpMemberPorts to YAML text - ToYaml() (string, error) - // ToJson marshals StateProtocolLacpMemberPorts to JSON text - ToJson() (string, error) -} - -type unMarshalstateProtocolLacpMemberPorts struct { - obj *stateProtocolLacpMemberPorts -} - -type unMarshalStateProtocolLacpMemberPorts interface { - // FromProto unmarshals StateProtocolLacpMemberPorts from protobuf object *otg.StateProtocolLacpMemberPorts - FromProto(msg *otg.StateProtocolLacpMemberPorts) (StateProtocolLacpMemberPorts, error) - // FromPbText unmarshals StateProtocolLacpMemberPorts from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StateProtocolLacpMemberPorts from YAML text - FromYaml(value string) error - // FromJson unmarshals StateProtocolLacpMemberPorts from JSON text - FromJson(value string) error -} - -func (obj *stateProtocolLacpMemberPorts) Marshal() marshalStateProtocolLacpMemberPorts { - if obj.marshaller == nil { - obj.marshaller = &marshalstateProtocolLacpMemberPorts{obj: obj} - } - return obj.marshaller -} - -func (obj *stateProtocolLacpMemberPorts) Unmarshal() unMarshalStateProtocolLacpMemberPorts { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstateProtocolLacpMemberPorts{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstateProtocolLacpMemberPorts) ToProto() (*otg.StateProtocolLacpMemberPorts, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstateProtocolLacpMemberPorts) FromProto(msg *otg.StateProtocolLacpMemberPorts) (StateProtocolLacpMemberPorts, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstateProtocolLacpMemberPorts) 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 *unMarshalstateProtocolLacpMemberPorts) 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 *marshalstateProtocolLacpMemberPorts) 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 *unMarshalstateProtocolLacpMemberPorts) 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 *marshalstateProtocolLacpMemberPorts) 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 *unMarshalstateProtocolLacpMemberPorts) 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 *stateProtocolLacpMemberPorts) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *stateProtocolLacpMemberPorts) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *stateProtocolLacpMemberPorts) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *stateProtocolLacpMemberPorts) Clone() (StateProtocolLacpMemberPorts, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStateProtocolLacpMemberPorts() - 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 -} - -// StateProtocolLacpMemberPorts is sets state of LACP member ports configured on LAG. -type StateProtocolLacpMemberPorts interface { - Validation - // msg marshals StateProtocolLacpMemberPorts to protobuf object *otg.StateProtocolLacpMemberPorts - // and doesn't set defaults - msg() *otg.StateProtocolLacpMemberPorts - // setMsg unmarshals StateProtocolLacpMemberPorts from protobuf object *otg.StateProtocolLacpMemberPorts - // and doesn't set defaults - setMsg(*otg.StateProtocolLacpMemberPorts) StateProtocolLacpMemberPorts - // provides marshal interface - Marshal() marshalStateProtocolLacpMemberPorts - // provides unmarshal interface - Unmarshal() unMarshalStateProtocolLacpMemberPorts - // validate validates StateProtocolLacpMemberPorts - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StateProtocolLacpMemberPorts, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // LagMemberNames returns []string, set in StateProtocolLacpMemberPorts. - LagMemberNames() []string - // SetLagMemberNames assigns []string provided by user to StateProtocolLacpMemberPorts - SetLagMemberNames(value []string) StateProtocolLacpMemberPorts - // State returns StateProtocolLacpMemberPortsStateEnum, set in StateProtocolLacpMemberPorts - State() StateProtocolLacpMemberPortsStateEnum - // SetState assigns StateProtocolLacpMemberPortsStateEnum provided by user to StateProtocolLacpMemberPorts - SetState(value StateProtocolLacpMemberPortsStateEnum) StateProtocolLacpMemberPorts -} - -// The names of LAG members (ports) for which the state has to be applied. An empty or null list will control all LAG members. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// LagMemberNames returns a []string -func (obj *stateProtocolLacpMemberPorts) LagMemberNames() []string { - if obj.obj.LagMemberNames == nil { - obj.obj.LagMemberNames = make([]string, 0) - } - return obj.obj.LagMemberNames -} - -// The names of LAG members (ports) for which the state has to be applied. An empty or null list will control all LAG members. -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// x-constraint: -// - /components/schemas/Port/properties/name -// -// SetLagMemberNames sets the []string value in the StateProtocolLacpMemberPorts object -func (obj *stateProtocolLacpMemberPorts) SetLagMemberNames(value []string) StateProtocolLacpMemberPorts { - - if obj.obj.LagMemberNames == nil { - obj.obj.LagMemberNames = make([]string, 0) - } - obj.obj.LagMemberNames = value - - return obj -} - -type StateProtocolLacpMemberPortsStateEnum string - -// Enum of State on StateProtocolLacpMemberPorts -var StateProtocolLacpMemberPortsState = struct { - UP StateProtocolLacpMemberPortsStateEnum - DOWN StateProtocolLacpMemberPortsStateEnum -}{ - UP: StateProtocolLacpMemberPortsStateEnum("up"), - DOWN: StateProtocolLacpMemberPortsStateEnum("down"), -} - -func (obj *stateProtocolLacpMemberPorts) State() StateProtocolLacpMemberPortsStateEnum { - return StateProtocolLacpMemberPortsStateEnum(obj.obj.State.Enum().String()) -} - -func (obj *stateProtocolLacpMemberPorts) SetState(value StateProtocolLacpMemberPortsStateEnum) StateProtocolLacpMemberPorts { - intValue, ok := otg.StateProtocolLacpMemberPorts_State_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StateProtocolLacpMemberPortsStateEnum", string(value))) - return obj - } - enumValue := otg.StateProtocolLacpMemberPorts_State_Enum(intValue) - obj.obj.State = &enumValue - - return obj -} - -func (obj *stateProtocolLacpMemberPorts) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // State is required - if obj.obj.State == nil { - vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StateProtocolLacpMemberPorts") - } -} - -func (obj *stateProtocolLacpMemberPorts) setDefault() { - -} - -// ***** StateProtocolBgpPeers ***** -type stateProtocolBgpPeers struct { - validation - obj *otg.StateProtocolBgpPeers - marshaller marshalStateProtocolBgpPeers - unMarshaller unMarshalStateProtocolBgpPeers -} - -func NewStateProtocolBgpPeers() StateProtocolBgpPeers { - obj := stateProtocolBgpPeers{obj: &otg.StateProtocolBgpPeers{}} - obj.setDefault() - return &obj -} - -func (obj *stateProtocolBgpPeers) msg() *otg.StateProtocolBgpPeers { - return obj.obj -} - -func (obj *stateProtocolBgpPeers) setMsg(msg *otg.StateProtocolBgpPeers) StateProtocolBgpPeers { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstateProtocolBgpPeers struct { - obj *stateProtocolBgpPeers -} - -type marshalStateProtocolBgpPeers interface { - // ToProto marshals StateProtocolBgpPeers to protobuf object *otg.StateProtocolBgpPeers - ToProto() (*otg.StateProtocolBgpPeers, error) - // ToPbText marshals StateProtocolBgpPeers to protobuf text - ToPbText() (string, error) - // ToYaml marshals StateProtocolBgpPeers to YAML text - ToYaml() (string, error) - // ToJson marshals StateProtocolBgpPeers to JSON text - ToJson() (string, error) -} - -type unMarshalstateProtocolBgpPeers struct { - obj *stateProtocolBgpPeers -} - -type unMarshalStateProtocolBgpPeers interface { - // FromProto unmarshals StateProtocolBgpPeers from protobuf object *otg.StateProtocolBgpPeers - FromProto(msg *otg.StateProtocolBgpPeers) (StateProtocolBgpPeers, error) - // FromPbText unmarshals StateProtocolBgpPeers from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StateProtocolBgpPeers from YAML text - FromYaml(value string) error - // FromJson unmarshals StateProtocolBgpPeers from JSON text - FromJson(value string) error -} - -func (obj *stateProtocolBgpPeers) Marshal() marshalStateProtocolBgpPeers { - if obj.marshaller == nil { - obj.marshaller = &marshalstateProtocolBgpPeers{obj: obj} - } - return obj.marshaller -} - -func (obj *stateProtocolBgpPeers) Unmarshal() unMarshalStateProtocolBgpPeers { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstateProtocolBgpPeers{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstateProtocolBgpPeers) ToProto() (*otg.StateProtocolBgpPeers, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstateProtocolBgpPeers) FromProto(msg *otg.StateProtocolBgpPeers) (StateProtocolBgpPeers, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstateProtocolBgpPeers) 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 *unMarshalstateProtocolBgpPeers) 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 *marshalstateProtocolBgpPeers) 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 *unMarshalstateProtocolBgpPeers) 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 *marshalstateProtocolBgpPeers) 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 *unMarshalstateProtocolBgpPeers) 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 *stateProtocolBgpPeers) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *stateProtocolBgpPeers) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *stateProtocolBgpPeers) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *stateProtocolBgpPeers) Clone() (StateProtocolBgpPeers, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStateProtocolBgpPeers() - 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 -} - -// StateProtocolBgpPeers is sets state of configured BGP peers. -type StateProtocolBgpPeers interface { - Validation - // msg marshals StateProtocolBgpPeers to protobuf object *otg.StateProtocolBgpPeers - // and doesn't set defaults - msg() *otg.StateProtocolBgpPeers - // setMsg unmarshals StateProtocolBgpPeers from protobuf object *otg.StateProtocolBgpPeers - // and doesn't set defaults - setMsg(*otg.StateProtocolBgpPeers) StateProtocolBgpPeers - // provides marshal interface - Marshal() marshalStateProtocolBgpPeers - // provides unmarshal interface - Unmarshal() unMarshalStateProtocolBgpPeers - // validate validates StateProtocolBgpPeers - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StateProtocolBgpPeers, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PeerNames returns []string, set in StateProtocolBgpPeers. - PeerNames() []string - // SetPeerNames assigns []string provided by user to StateProtocolBgpPeers - SetPeerNames(value []string) StateProtocolBgpPeers - // State returns StateProtocolBgpPeersStateEnum, set in StateProtocolBgpPeers - State() StateProtocolBgpPeersStateEnum - // SetState assigns StateProtocolBgpPeersStateEnum provided by user to StateProtocolBgpPeers - SetState(value StateProtocolBgpPeersStateEnum) StateProtocolBgpPeers -} - -// The names of BGP peers for which the state has to be applied. An empty or null list will control all BGP peers. -// -// x-constraint: -// - /components/schemas/Bgp.V4Peer/properties/name -// - /components/schemas/Bgp.V6Peer/properties/name -// -// x-constraint: -// - /components/schemas/Bgp.V4Peer/properties/name -// - /components/schemas/Bgp.V6Peer/properties/name -// -// PeerNames returns a []string -func (obj *stateProtocolBgpPeers) PeerNames() []string { - if obj.obj.PeerNames == nil { - obj.obj.PeerNames = make([]string, 0) - } - return obj.obj.PeerNames -} - -// The names of BGP peers for which the state has to be applied. An empty or null list will control all BGP peers. -// -// x-constraint: -// - /components/schemas/Bgp.V4Peer/properties/name -// - /components/schemas/Bgp.V6Peer/properties/name -// -// x-constraint: -// - /components/schemas/Bgp.V4Peer/properties/name -// - /components/schemas/Bgp.V6Peer/properties/name -// -// SetPeerNames sets the []string value in the StateProtocolBgpPeers object -func (obj *stateProtocolBgpPeers) SetPeerNames(value []string) StateProtocolBgpPeers { - - if obj.obj.PeerNames == nil { - obj.obj.PeerNames = make([]string, 0) - } - obj.obj.PeerNames = value - - return obj -} - -type StateProtocolBgpPeersStateEnum string - -// Enum of State on StateProtocolBgpPeers -var StateProtocolBgpPeersState = struct { - UP StateProtocolBgpPeersStateEnum - DOWN StateProtocolBgpPeersStateEnum -}{ - UP: StateProtocolBgpPeersStateEnum("up"), - DOWN: StateProtocolBgpPeersStateEnum("down"), -} - -func (obj *stateProtocolBgpPeers) State() StateProtocolBgpPeersStateEnum { - return StateProtocolBgpPeersStateEnum(obj.obj.State.Enum().String()) -} - -func (obj *stateProtocolBgpPeers) SetState(value StateProtocolBgpPeersStateEnum) StateProtocolBgpPeers { - intValue, ok := otg.StateProtocolBgpPeers_State_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StateProtocolBgpPeersStateEnum", string(value))) - return obj - } - enumValue := otg.StateProtocolBgpPeers_State_Enum(intValue) - obj.obj.State = &enumValue - - return obj -} - -func (obj *stateProtocolBgpPeers) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // State is required - if obj.obj.State == nil { - vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StateProtocolBgpPeers") - } -} - -func (obj *stateProtocolBgpPeers) setDefault() { - -} - -// ***** StateProtocolIsisRouters ***** -type stateProtocolIsisRouters struct { - validation - obj *otg.StateProtocolIsisRouters - marshaller marshalStateProtocolIsisRouters - unMarshaller unMarshalStateProtocolIsisRouters -} - -func NewStateProtocolIsisRouters() StateProtocolIsisRouters { - obj := stateProtocolIsisRouters{obj: &otg.StateProtocolIsisRouters{}} - obj.setDefault() - return &obj -} - -func (obj *stateProtocolIsisRouters) msg() *otg.StateProtocolIsisRouters { - return obj.obj -} - -func (obj *stateProtocolIsisRouters) setMsg(msg *otg.StateProtocolIsisRouters) StateProtocolIsisRouters { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalstateProtocolIsisRouters struct { - obj *stateProtocolIsisRouters -} - -type marshalStateProtocolIsisRouters interface { - // ToProto marshals StateProtocolIsisRouters to protobuf object *otg.StateProtocolIsisRouters - ToProto() (*otg.StateProtocolIsisRouters, error) - // ToPbText marshals StateProtocolIsisRouters to protobuf text - ToPbText() (string, error) - // ToYaml marshals StateProtocolIsisRouters to YAML text - ToYaml() (string, error) - // ToJson marshals StateProtocolIsisRouters to JSON text - ToJson() (string, error) -} - -type unMarshalstateProtocolIsisRouters struct { - obj *stateProtocolIsisRouters -} - -type unMarshalStateProtocolIsisRouters interface { - // FromProto unmarshals StateProtocolIsisRouters from protobuf object *otg.StateProtocolIsisRouters - FromProto(msg *otg.StateProtocolIsisRouters) (StateProtocolIsisRouters, error) - // FromPbText unmarshals StateProtocolIsisRouters from protobuf text - FromPbText(value string) error - // FromYaml unmarshals StateProtocolIsisRouters from YAML text - FromYaml(value string) error - // FromJson unmarshals StateProtocolIsisRouters from JSON text - FromJson(value string) error -} - -func (obj *stateProtocolIsisRouters) Marshal() marshalStateProtocolIsisRouters { - if obj.marshaller == nil { - obj.marshaller = &marshalstateProtocolIsisRouters{obj: obj} - } - return obj.marshaller -} - -func (obj *stateProtocolIsisRouters) Unmarshal() unMarshalStateProtocolIsisRouters { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalstateProtocolIsisRouters{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalstateProtocolIsisRouters) ToProto() (*otg.StateProtocolIsisRouters, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalstateProtocolIsisRouters) FromProto(msg *otg.StateProtocolIsisRouters) (StateProtocolIsisRouters, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalstateProtocolIsisRouters) 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 *unMarshalstateProtocolIsisRouters) 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 *marshalstateProtocolIsisRouters) 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 *unMarshalstateProtocolIsisRouters) 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 *marshalstateProtocolIsisRouters) 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 *unMarshalstateProtocolIsisRouters) 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 *stateProtocolIsisRouters) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *stateProtocolIsisRouters) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *stateProtocolIsisRouters) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *stateProtocolIsisRouters) Clone() (StateProtocolIsisRouters, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewStateProtocolIsisRouters() - 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 -} - -// StateProtocolIsisRouters is sets state of configured ISIS routers. -type StateProtocolIsisRouters interface { - Validation - // msg marshals StateProtocolIsisRouters to protobuf object *otg.StateProtocolIsisRouters - // and doesn't set defaults - msg() *otg.StateProtocolIsisRouters - // setMsg unmarshals StateProtocolIsisRouters from protobuf object *otg.StateProtocolIsisRouters - // and doesn't set defaults - setMsg(*otg.StateProtocolIsisRouters) StateProtocolIsisRouters - // provides marshal interface - Marshal() marshalStateProtocolIsisRouters - // provides unmarshal interface - Unmarshal() unMarshalStateProtocolIsisRouters - // validate validates StateProtocolIsisRouters - validate() error - // A stringer function - String() string - // Clones the object - Clone() (StateProtocolIsisRouters, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RouterNames returns []string, set in StateProtocolIsisRouters. - RouterNames() []string - // SetRouterNames assigns []string provided by user to StateProtocolIsisRouters - SetRouterNames(value []string) StateProtocolIsisRouters - // State returns StateProtocolIsisRoutersStateEnum, set in StateProtocolIsisRouters - State() StateProtocolIsisRoutersStateEnum - // SetState assigns StateProtocolIsisRoutersStateEnum provided by user to StateProtocolIsisRouters - SetState(value StateProtocolIsisRoutersStateEnum) StateProtocolIsisRouters -} - -// The names of ISIS routers for which the state has to be applied. An empty or null list will control all ISIS routers. -// -// x-constraint: -// - /components/schemas/Device.IsisRouter/properties/name -// -// x-constraint: -// - /components/schemas/Device.IsisRouter/properties/name -// -// RouterNames returns a []string -func (obj *stateProtocolIsisRouters) RouterNames() []string { - if obj.obj.RouterNames == nil { - obj.obj.RouterNames = make([]string, 0) - } - return obj.obj.RouterNames -} - -// The names of ISIS routers for which the state has to be applied. An empty or null list will control all ISIS routers. -// -// x-constraint: -// - /components/schemas/Device.IsisRouter/properties/name -// -// x-constraint: -// - /components/schemas/Device.IsisRouter/properties/name -// -// SetRouterNames sets the []string value in the StateProtocolIsisRouters object -func (obj *stateProtocolIsisRouters) SetRouterNames(value []string) StateProtocolIsisRouters { - - if obj.obj.RouterNames == nil { - obj.obj.RouterNames = make([]string, 0) - } - obj.obj.RouterNames = value - - return obj -} - -type StateProtocolIsisRoutersStateEnum string - -// Enum of State on StateProtocolIsisRouters -var StateProtocolIsisRoutersState = struct { - UP StateProtocolIsisRoutersStateEnum - DOWN StateProtocolIsisRoutersStateEnum -}{ - UP: StateProtocolIsisRoutersStateEnum("up"), - DOWN: StateProtocolIsisRoutersStateEnum("down"), -} - -func (obj *stateProtocolIsisRouters) State() StateProtocolIsisRoutersStateEnum { - return StateProtocolIsisRoutersStateEnum(obj.obj.State.Enum().String()) -} - -func (obj *stateProtocolIsisRouters) SetState(value StateProtocolIsisRoutersStateEnum) StateProtocolIsisRouters { - intValue, ok := otg.StateProtocolIsisRouters_State_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on StateProtocolIsisRoutersStateEnum", string(value))) - return obj - } - enumValue := otg.StateProtocolIsisRouters_State_Enum(intValue) - obj.obj.State = &enumValue - - return obj -} - -func (obj *stateProtocolIsisRouters) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // State is required - if obj.obj.State == nil { - vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StateProtocolIsisRouters") - } -} - -func (obj *stateProtocolIsisRouters) setDefault() { - -} - -// ***** ActionProtocolIpv4Ping ***** -type actionProtocolIpv4Ping struct { - validation - obj *otg.ActionProtocolIpv4Ping - marshaller marshalActionProtocolIpv4Ping - unMarshaller unMarshalActionProtocolIpv4Ping - requestsHolder ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter -} - -func NewActionProtocolIpv4Ping() ActionProtocolIpv4Ping { - obj := actionProtocolIpv4Ping{obj: &otg.ActionProtocolIpv4Ping{}} - obj.setDefault() - return &obj -} - -func (obj *actionProtocolIpv4Ping) msg() *otg.ActionProtocolIpv4Ping { - return obj.obj -} - -func (obj *actionProtocolIpv4Ping) setMsg(msg *otg.ActionProtocolIpv4Ping) ActionProtocolIpv4Ping { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionProtocolIpv4Ping struct { - obj *actionProtocolIpv4Ping -} - -type marshalActionProtocolIpv4Ping interface { - // ToProto marshals ActionProtocolIpv4Ping to protobuf object *otg.ActionProtocolIpv4Ping - ToProto() (*otg.ActionProtocolIpv4Ping, error) - // ToPbText marshals ActionProtocolIpv4Ping to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionProtocolIpv4Ping to YAML text - ToYaml() (string, error) - // ToJson marshals ActionProtocolIpv4Ping to JSON text - ToJson() (string, error) -} - -type unMarshalactionProtocolIpv4Ping struct { - obj *actionProtocolIpv4Ping -} - -type unMarshalActionProtocolIpv4Ping interface { - // FromProto unmarshals ActionProtocolIpv4Ping from protobuf object *otg.ActionProtocolIpv4Ping - FromProto(msg *otg.ActionProtocolIpv4Ping) (ActionProtocolIpv4Ping, error) - // FromPbText unmarshals ActionProtocolIpv4Ping from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionProtocolIpv4Ping from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionProtocolIpv4Ping from JSON text - FromJson(value string) error -} - -func (obj *actionProtocolIpv4Ping) Marshal() marshalActionProtocolIpv4Ping { - if obj.marshaller == nil { - obj.marshaller = &marshalactionProtocolIpv4Ping{obj: obj} - } - return obj.marshaller -} - -func (obj *actionProtocolIpv4Ping) Unmarshal() unMarshalActionProtocolIpv4Ping { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionProtocolIpv4Ping{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionProtocolIpv4Ping) ToProto() (*otg.ActionProtocolIpv4Ping, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionProtocolIpv4Ping) FromProto(msg *otg.ActionProtocolIpv4Ping) (ActionProtocolIpv4Ping, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionProtocolIpv4Ping) 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 *unMarshalactionProtocolIpv4Ping) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalactionProtocolIpv4Ping) 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 *unMarshalactionProtocolIpv4Ping) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalactionProtocolIpv4Ping) 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 *unMarshalactionProtocolIpv4Ping) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *actionProtocolIpv4Ping) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionProtocolIpv4Ping) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionProtocolIpv4Ping) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionProtocolIpv4Ping) Clone() (ActionProtocolIpv4Ping, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionProtocolIpv4Ping() - 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 -} - -func (obj *actionProtocolIpv4Ping) setNil() { - obj.requestsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ActionProtocolIpv4Ping is request for initiating ping between multiple source and destination pairs. -type ActionProtocolIpv4Ping interface { - Validation - // msg marshals ActionProtocolIpv4Ping to protobuf object *otg.ActionProtocolIpv4Ping - // and doesn't set defaults - msg() *otg.ActionProtocolIpv4Ping - // setMsg unmarshals ActionProtocolIpv4Ping from protobuf object *otg.ActionProtocolIpv4Ping - // and doesn't set defaults - setMsg(*otg.ActionProtocolIpv4Ping) ActionProtocolIpv4Ping - // provides marshal interface - Marshal() marshalActionProtocolIpv4Ping - // provides unmarshal interface - Unmarshal() unMarshalActionProtocolIpv4Ping - // validate validates ActionProtocolIpv4Ping - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionProtocolIpv4Ping, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Requests returns ActionProtocolIpv4PingActionProtocolIpv4PingRequestIterIter, set in ActionProtocolIpv4Ping - Requests() ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter - setNil() -} - -// List of IPv4 ping requests. -// Requests returns a []ActionProtocolIpv4PingRequest -func (obj *actionProtocolIpv4Ping) Requests() ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { - if len(obj.obj.Requests) == 0 { - obj.obj.Requests = []*otg.ActionProtocolIpv4PingRequest{} - } - if obj.requestsHolder == nil { - obj.requestsHolder = newActionProtocolIpv4PingActionProtocolIpv4PingRequestIter(&obj.obj.Requests).setMsg(obj) - } - return obj.requestsHolder -} - -type actionProtocolIpv4PingActionProtocolIpv4PingRequestIter struct { - obj *actionProtocolIpv4Ping - actionProtocolIpv4PingRequestSlice []ActionProtocolIpv4PingRequest - fieldPtr *[]*otg.ActionProtocolIpv4PingRequest -} - -func newActionProtocolIpv4PingActionProtocolIpv4PingRequestIter(ptr *[]*otg.ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { - return &actionProtocolIpv4PingActionProtocolIpv4PingRequestIter{fieldPtr: ptr} -} - -type ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter interface { - setMsg(*actionProtocolIpv4Ping) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter - Items() []ActionProtocolIpv4PingRequest - Add() ActionProtocolIpv4PingRequest - Append(items ...ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter - Set(index int, newObj ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter - Clear() ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter - clearHolderSlice() ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter - appendHolderSlice(item ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter -} - -func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) setMsg(msg *actionProtocolIpv4Ping) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&actionProtocolIpv4PingRequest{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) Items() []ActionProtocolIpv4PingRequest { - return obj.actionProtocolIpv4PingRequestSlice -} - -func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) Add() ActionProtocolIpv4PingRequest { - newObj := &otg.ActionProtocolIpv4PingRequest{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &actionProtocolIpv4PingRequest{obj: newObj} - newLibObj.setDefault() - obj.actionProtocolIpv4PingRequestSlice = append(obj.actionProtocolIpv4PingRequestSlice, newLibObj) - return newLibObj -} - -func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) Append(items ...ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.actionProtocolIpv4PingRequestSlice = append(obj.actionProtocolIpv4PingRequestSlice, item) - } - return obj -} - -func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) Set(index int, newObj ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.actionProtocolIpv4PingRequestSlice[index] = newObj - return obj -} -func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) Clear() ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.ActionProtocolIpv4PingRequest{} - obj.actionProtocolIpv4PingRequestSlice = []ActionProtocolIpv4PingRequest{} - } - return obj -} -func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) clearHolderSlice() ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { - if len(obj.actionProtocolIpv4PingRequestSlice) > 0 { - obj.actionProtocolIpv4PingRequestSlice = []ActionProtocolIpv4PingRequest{} - } - return obj -} -func (obj *actionProtocolIpv4PingActionProtocolIpv4PingRequestIter) appendHolderSlice(item ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingActionProtocolIpv4PingRequestIter { - obj.actionProtocolIpv4PingRequestSlice = append(obj.actionProtocolIpv4PingRequestSlice, item) - return obj -} - -func (obj *actionProtocolIpv4Ping) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Requests) != 0 { - - if set_default { - obj.Requests().clearHolderSlice() - for _, item := range obj.obj.Requests { - obj.Requests().appendHolderSlice(&actionProtocolIpv4PingRequest{obj: item}) - } - } - for _, item := range obj.Requests().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *actionProtocolIpv4Ping) setDefault() { - -} - -// ***** ActionProtocolIpv6Ping ***** -type actionProtocolIpv6Ping struct { - validation - obj *otg.ActionProtocolIpv6Ping - marshaller marshalActionProtocolIpv6Ping - unMarshaller unMarshalActionProtocolIpv6Ping - requestsHolder ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter -} - -func NewActionProtocolIpv6Ping() ActionProtocolIpv6Ping { - obj := actionProtocolIpv6Ping{obj: &otg.ActionProtocolIpv6Ping{}} - obj.setDefault() - return &obj -} - -func (obj *actionProtocolIpv6Ping) msg() *otg.ActionProtocolIpv6Ping { - return obj.obj -} - -func (obj *actionProtocolIpv6Ping) setMsg(msg *otg.ActionProtocolIpv6Ping) ActionProtocolIpv6Ping { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionProtocolIpv6Ping struct { - obj *actionProtocolIpv6Ping -} - -type marshalActionProtocolIpv6Ping interface { - // ToProto marshals ActionProtocolIpv6Ping to protobuf object *otg.ActionProtocolIpv6Ping - ToProto() (*otg.ActionProtocolIpv6Ping, error) - // ToPbText marshals ActionProtocolIpv6Ping to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionProtocolIpv6Ping to YAML text - ToYaml() (string, error) - // ToJson marshals ActionProtocolIpv6Ping to JSON text - ToJson() (string, error) -} - -type unMarshalactionProtocolIpv6Ping struct { - obj *actionProtocolIpv6Ping -} - -type unMarshalActionProtocolIpv6Ping interface { - // FromProto unmarshals ActionProtocolIpv6Ping from protobuf object *otg.ActionProtocolIpv6Ping - FromProto(msg *otg.ActionProtocolIpv6Ping) (ActionProtocolIpv6Ping, error) - // FromPbText unmarshals ActionProtocolIpv6Ping from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionProtocolIpv6Ping from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionProtocolIpv6Ping from JSON text - FromJson(value string) error -} - -func (obj *actionProtocolIpv6Ping) Marshal() marshalActionProtocolIpv6Ping { - if obj.marshaller == nil { - obj.marshaller = &marshalactionProtocolIpv6Ping{obj: obj} - } - return obj.marshaller -} - -func (obj *actionProtocolIpv6Ping) Unmarshal() unMarshalActionProtocolIpv6Ping { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionProtocolIpv6Ping{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionProtocolIpv6Ping) ToProto() (*otg.ActionProtocolIpv6Ping, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionProtocolIpv6Ping) FromProto(msg *otg.ActionProtocolIpv6Ping) (ActionProtocolIpv6Ping, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionProtocolIpv6Ping) 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 *unMarshalactionProtocolIpv6Ping) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalactionProtocolIpv6Ping) 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 *unMarshalactionProtocolIpv6Ping) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalactionProtocolIpv6Ping) 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 *unMarshalactionProtocolIpv6Ping) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *actionProtocolIpv6Ping) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionProtocolIpv6Ping) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionProtocolIpv6Ping) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionProtocolIpv6Ping) Clone() (ActionProtocolIpv6Ping, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionProtocolIpv6Ping() - 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 -} - -func (obj *actionProtocolIpv6Ping) setNil() { - obj.requestsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ActionProtocolIpv6Ping is request for initiating ping between multiple source and destination pairs. -type ActionProtocolIpv6Ping interface { - Validation - // msg marshals ActionProtocolIpv6Ping to protobuf object *otg.ActionProtocolIpv6Ping - // and doesn't set defaults - msg() *otg.ActionProtocolIpv6Ping - // setMsg unmarshals ActionProtocolIpv6Ping from protobuf object *otg.ActionProtocolIpv6Ping - // and doesn't set defaults - setMsg(*otg.ActionProtocolIpv6Ping) ActionProtocolIpv6Ping - // provides marshal interface - Marshal() marshalActionProtocolIpv6Ping - // provides unmarshal interface - Unmarshal() unMarshalActionProtocolIpv6Ping - // validate validates ActionProtocolIpv6Ping - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionProtocolIpv6Ping, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Requests returns ActionProtocolIpv6PingActionProtocolIpv6PingRequestIterIter, set in ActionProtocolIpv6Ping - Requests() ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter - setNil() -} - -// List of IPv6 ping requests. -// Requests returns a []ActionProtocolIpv6PingRequest -func (obj *actionProtocolIpv6Ping) Requests() ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { - if len(obj.obj.Requests) == 0 { - obj.obj.Requests = []*otg.ActionProtocolIpv6PingRequest{} - } - if obj.requestsHolder == nil { - obj.requestsHolder = newActionProtocolIpv6PingActionProtocolIpv6PingRequestIter(&obj.obj.Requests).setMsg(obj) - } - return obj.requestsHolder -} - -type actionProtocolIpv6PingActionProtocolIpv6PingRequestIter struct { - obj *actionProtocolIpv6Ping - actionProtocolIpv6PingRequestSlice []ActionProtocolIpv6PingRequest - fieldPtr *[]*otg.ActionProtocolIpv6PingRequest -} - -func newActionProtocolIpv6PingActionProtocolIpv6PingRequestIter(ptr *[]*otg.ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { - return &actionProtocolIpv6PingActionProtocolIpv6PingRequestIter{fieldPtr: ptr} -} - -type ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter interface { - setMsg(*actionProtocolIpv6Ping) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter - Items() []ActionProtocolIpv6PingRequest - Add() ActionProtocolIpv6PingRequest - Append(items ...ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter - Set(index int, newObj ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter - Clear() ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter - clearHolderSlice() ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter - appendHolderSlice(item ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter -} - -func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) setMsg(msg *actionProtocolIpv6Ping) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&actionProtocolIpv6PingRequest{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) Items() []ActionProtocolIpv6PingRequest { - return obj.actionProtocolIpv6PingRequestSlice -} - -func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) Add() ActionProtocolIpv6PingRequest { - newObj := &otg.ActionProtocolIpv6PingRequest{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &actionProtocolIpv6PingRequest{obj: newObj} - newLibObj.setDefault() - obj.actionProtocolIpv6PingRequestSlice = append(obj.actionProtocolIpv6PingRequestSlice, newLibObj) - return newLibObj -} - -func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) Append(items ...ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.actionProtocolIpv6PingRequestSlice = append(obj.actionProtocolIpv6PingRequestSlice, item) - } - return obj -} - -func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) Set(index int, newObj ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.actionProtocolIpv6PingRequestSlice[index] = newObj - return obj -} -func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) Clear() ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.ActionProtocolIpv6PingRequest{} - obj.actionProtocolIpv6PingRequestSlice = []ActionProtocolIpv6PingRequest{} - } - return obj -} -func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) clearHolderSlice() ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { - if len(obj.actionProtocolIpv6PingRequestSlice) > 0 { - obj.actionProtocolIpv6PingRequestSlice = []ActionProtocolIpv6PingRequest{} - } - return obj -} -func (obj *actionProtocolIpv6PingActionProtocolIpv6PingRequestIter) appendHolderSlice(item ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingActionProtocolIpv6PingRequestIter { - obj.actionProtocolIpv6PingRequestSlice = append(obj.actionProtocolIpv6PingRequestSlice, item) - return obj -} - -func (obj *actionProtocolIpv6Ping) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Requests) != 0 { - - if set_default { - obj.Requests().clearHolderSlice() - for _, item := range obj.obj.Requests { - obj.Requests().appendHolderSlice(&actionProtocolIpv6PingRequest{obj: item}) - } - } - for _, item := range obj.Requests().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *actionProtocolIpv6Ping) setDefault() { - -} - -// ***** ActionProtocolBgpNotification ***** -type actionProtocolBgpNotification struct { - validation - obj *otg.ActionProtocolBgpNotification - marshaller marshalActionProtocolBgpNotification - unMarshaller unMarshalActionProtocolBgpNotification - ceaseHolder DeviceBgpCeaseError - messageHeaderErrorHolder DeviceBgpMessageHeaderError - openMessageErrorHolder DeviceBgpOpenMessageError - updateMessageErrorHolder DeviceBgpUpdateMessageError - holdTimerExpiredHolder DeviceBgpHoldTimerExpired - finiteStateMachineErrorHolder DeviceBgpFiniteStateMachineError - customHolder DeviceBgpCustomError -} - -func NewActionProtocolBgpNotification() ActionProtocolBgpNotification { - obj := actionProtocolBgpNotification{obj: &otg.ActionProtocolBgpNotification{}} - obj.setDefault() - return &obj -} - -func (obj *actionProtocolBgpNotification) msg() *otg.ActionProtocolBgpNotification { - return obj.obj -} - -func (obj *actionProtocolBgpNotification) setMsg(msg *otg.ActionProtocolBgpNotification) ActionProtocolBgpNotification { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionProtocolBgpNotification struct { - obj *actionProtocolBgpNotification -} - -type marshalActionProtocolBgpNotification interface { - // ToProto marshals ActionProtocolBgpNotification to protobuf object *otg.ActionProtocolBgpNotification - ToProto() (*otg.ActionProtocolBgpNotification, error) - // ToPbText marshals ActionProtocolBgpNotification to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionProtocolBgpNotification to YAML text - ToYaml() (string, error) - // ToJson marshals ActionProtocolBgpNotification to JSON text - ToJson() (string, error) -} - -type unMarshalactionProtocolBgpNotification struct { - obj *actionProtocolBgpNotification -} - -type unMarshalActionProtocolBgpNotification interface { - // FromProto unmarshals ActionProtocolBgpNotification from protobuf object *otg.ActionProtocolBgpNotification - FromProto(msg *otg.ActionProtocolBgpNotification) (ActionProtocolBgpNotification, error) - // FromPbText unmarshals ActionProtocolBgpNotification from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionProtocolBgpNotification from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionProtocolBgpNotification from JSON text - FromJson(value string) error -} - -func (obj *actionProtocolBgpNotification) Marshal() marshalActionProtocolBgpNotification { - if obj.marshaller == nil { - obj.marshaller = &marshalactionProtocolBgpNotification{obj: obj} - } - return obj.marshaller -} - -func (obj *actionProtocolBgpNotification) Unmarshal() unMarshalActionProtocolBgpNotification { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionProtocolBgpNotification{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionProtocolBgpNotification) ToProto() (*otg.ActionProtocolBgpNotification, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionProtocolBgpNotification) FromProto(msg *otg.ActionProtocolBgpNotification) (ActionProtocolBgpNotification, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionProtocolBgpNotification) 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 *unMarshalactionProtocolBgpNotification) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalactionProtocolBgpNotification) 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 *unMarshalactionProtocolBgpNotification) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalactionProtocolBgpNotification) 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 *unMarshalactionProtocolBgpNotification) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *actionProtocolBgpNotification) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionProtocolBgpNotification) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionProtocolBgpNotification) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionProtocolBgpNotification) Clone() (ActionProtocolBgpNotification, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionProtocolBgpNotification() - 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 -} - -func (obj *actionProtocolBgpNotification) setNil() { - obj.ceaseHolder = nil - obj.messageHeaderErrorHolder = nil - obj.openMessageErrorHolder = nil - obj.updateMessageErrorHolder = nil - obj.holdTimerExpiredHolder = nil - obj.finiteStateMachineErrorHolder = nil - obj.customHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ActionProtocolBgpNotification is a NOTIFICATION message is sent when an error is detected with the BGP session, such as hold timer expiring, misconfigured AS number or a BGP session reset is requested. This causes the BGP connection to close. Send explicit NOTIFICATIONs for list of specified BGP peers. If a user wants to send custom Error Code and Error Subcode the custom object should be configured. A user can send IANA defined BGP NOTIFICATIONs according to https://www.iana.org/assignments/bgp-parameters/bgp-parameters.xhtml. -type ActionProtocolBgpNotification interface { - Validation - // msg marshals ActionProtocolBgpNotification to protobuf object *otg.ActionProtocolBgpNotification - // and doesn't set defaults - msg() *otg.ActionProtocolBgpNotification - // setMsg unmarshals ActionProtocolBgpNotification from protobuf object *otg.ActionProtocolBgpNotification - // and doesn't set defaults - setMsg(*otg.ActionProtocolBgpNotification) ActionProtocolBgpNotification - // provides marshal interface - Marshal() marshalActionProtocolBgpNotification - // provides unmarshal interface - Unmarshal() unMarshalActionProtocolBgpNotification - // validate validates ActionProtocolBgpNotification - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionProtocolBgpNotification, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Names returns []string, set in ActionProtocolBgpNotification. - Names() []string - // SetNames assigns []string provided by user to ActionProtocolBgpNotification - SetNames(value []string) ActionProtocolBgpNotification - // Choice returns ActionProtocolBgpNotificationChoiceEnum, set in ActionProtocolBgpNotification - Choice() ActionProtocolBgpNotificationChoiceEnum - // setChoice assigns ActionProtocolBgpNotificationChoiceEnum provided by user to ActionProtocolBgpNotification - setChoice(value ActionProtocolBgpNotificationChoiceEnum) ActionProtocolBgpNotification - // HasChoice checks if Choice has been set in ActionProtocolBgpNotification - HasChoice() bool - // Cease returns DeviceBgpCeaseError, set in ActionProtocolBgpNotification. - // DeviceBgpCeaseError is in the absence of any fatal errors, a BGP peer can close its BGP connection by sending the NOTIFICATION message with the Error Code Cease. - Cease() DeviceBgpCeaseError - // SetCease assigns DeviceBgpCeaseError provided by user to ActionProtocolBgpNotification. - // DeviceBgpCeaseError is in the absence of any fatal errors, a BGP peer can close its BGP connection by sending the NOTIFICATION message with the Error Code Cease. - SetCease(value DeviceBgpCeaseError) ActionProtocolBgpNotification - // HasCease checks if Cease has been set in ActionProtocolBgpNotification - HasCease() bool - // MessageHeaderError returns DeviceBgpMessageHeaderError, set in ActionProtocolBgpNotification. - // DeviceBgpMessageHeaderError is all errors detected while processing the Message Header are indicated by sending the NOTIFICATION message with the Error Code-Message Header Error. The Error Subcode elaborates on the specific nature of the error. - MessageHeaderError() DeviceBgpMessageHeaderError - // SetMessageHeaderError assigns DeviceBgpMessageHeaderError provided by user to ActionProtocolBgpNotification. - // DeviceBgpMessageHeaderError is all errors detected while processing the Message Header are indicated by sending the NOTIFICATION message with the Error Code-Message Header Error. The Error Subcode elaborates on the specific nature of the error. - SetMessageHeaderError(value DeviceBgpMessageHeaderError) ActionProtocolBgpNotification - // HasMessageHeaderError checks if MessageHeaderError has been set in ActionProtocolBgpNotification - HasMessageHeaderError() bool - // OpenMessageError returns DeviceBgpOpenMessageError, set in ActionProtocolBgpNotification. - // DeviceBgpOpenMessageError is all errors detected while processing the OPEN message are indicated by sending the NOTIFICATION message with the Error Code-Open Message Error. The Error Subcode elaborates on the specific nature of the error. - OpenMessageError() DeviceBgpOpenMessageError - // SetOpenMessageError assigns DeviceBgpOpenMessageError provided by user to ActionProtocolBgpNotification. - // DeviceBgpOpenMessageError is all errors detected while processing the OPEN message are indicated by sending the NOTIFICATION message with the Error Code-Open Message Error. The Error Subcode elaborates on the specific nature of the error. - SetOpenMessageError(value DeviceBgpOpenMessageError) ActionProtocolBgpNotification - // HasOpenMessageError checks if OpenMessageError has been set in ActionProtocolBgpNotification - HasOpenMessageError() bool - // UpdateMessageError returns DeviceBgpUpdateMessageError, set in ActionProtocolBgpNotification. - // DeviceBgpUpdateMessageError is all errors detected while processing the UPDATE message are indicated by sending the NOTIFICATION message with the Error Code-Update Message Error. The Error Subcode elaborates on the specific nature of the error. - UpdateMessageError() DeviceBgpUpdateMessageError - // SetUpdateMessageError assigns DeviceBgpUpdateMessageError provided by user to ActionProtocolBgpNotification. - // DeviceBgpUpdateMessageError is all errors detected while processing the UPDATE message are indicated by sending the NOTIFICATION message with the Error Code-Update Message Error. The Error Subcode elaborates on the specific nature of the error. - SetUpdateMessageError(value DeviceBgpUpdateMessageError) ActionProtocolBgpNotification - // HasUpdateMessageError checks if UpdateMessageError has been set in ActionProtocolBgpNotification - HasUpdateMessageError() bool - // HoldTimerExpired returns DeviceBgpHoldTimerExpired, set in ActionProtocolBgpNotification. - // DeviceBgpHoldTimerExpired is if a system does not receive successive KEEPALIVE, UPDATE, and/or NOTIFICATION messages within the period specified in the Hold Time field of the OPEN message, then the NOTIFICATION message with the Hold Timer Expired Error Code(Error Code 4) is sent and the BGP connection is closed. The Sub Code used is 0. If a user wants to use non zero Sub Code then CustomError can be used. - HoldTimerExpired() DeviceBgpHoldTimerExpired - // SetHoldTimerExpired assigns DeviceBgpHoldTimerExpired provided by user to ActionProtocolBgpNotification. - // DeviceBgpHoldTimerExpired is if a system does not receive successive KEEPALIVE, UPDATE, and/or NOTIFICATION messages within the period specified in the Hold Time field of the OPEN message, then the NOTIFICATION message with the Hold Timer Expired Error Code(Error Code 4) is sent and the BGP connection is closed. The Sub Code used is 0. If a user wants to use non zero Sub Code then CustomError can be used. - SetHoldTimerExpired(value DeviceBgpHoldTimerExpired) ActionProtocolBgpNotification - // HasHoldTimerExpired checks if HoldTimerExpired has been set in ActionProtocolBgpNotification - HasHoldTimerExpired() bool - // FiniteStateMachineError returns DeviceBgpFiniteStateMachineError, set in ActionProtocolBgpNotification. - // DeviceBgpFiniteStateMachineError is any error detected by the BGP Finite State Machine (e.g., receipt of an unexpected event) is indicated by sending the NOTIFICATION message with the Error Code-Finite State Machine Error(Error Code 5). The Sub Code used is 0. If a user wants to use non zero Sub Code then CustomError can be used. - FiniteStateMachineError() DeviceBgpFiniteStateMachineError - // SetFiniteStateMachineError assigns DeviceBgpFiniteStateMachineError provided by user to ActionProtocolBgpNotification. - // DeviceBgpFiniteStateMachineError is any error detected by the BGP Finite State Machine (e.g., receipt of an unexpected event) is indicated by sending the NOTIFICATION message with the Error Code-Finite State Machine Error(Error Code 5). The Sub Code used is 0. If a user wants to use non zero Sub Code then CustomError can be used. - SetFiniteStateMachineError(value DeviceBgpFiniteStateMachineError) ActionProtocolBgpNotification - // HasFiniteStateMachineError checks if FiniteStateMachineError has been set in ActionProtocolBgpNotification - HasFiniteStateMachineError() bool - // Custom returns DeviceBgpCustomError, set in ActionProtocolBgpNotification. - // DeviceBgpCustomError is a BGP peer can send NOTIFICATION message with user defined Error Code and Error Subcode. - Custom() DeviceBgpCustomError - // SetCustom assigns DeviceBgpCustomError provided by user to ActionProtocolBgpNotification. - // DeviceBgpCustomError is a BGP peer can send NOTIFICATION message with user defined Error Code and Error Subcode. - SetCustom(value DeviceBgpCustomError) ActionProtocolBgpNotification - // HasCustom checks if Custom has been set in ActionProtocolBgpNotification - HasCustom() bool - setNil() -} - -// The names of BGP Peers to send NOTIFICATION to. If no name is specified then NOTIFICATION will be sent to all configured BGP peers. -// -// x-constraint: -// - /components/schemas/Device.Bgp/properties/name -// -// x-constraint: -// - /components/schemas/Device.Bgp/properties/name -// -// Names returns a []string -func (obj *actionProtocolBgpNotification) Names() []string { - if obj.obj.Names == nil { - obj.obj.Names = make([]string, 0) - } - return obj.obj.Names -} - -// The names of BGP Peers to send NOTIFICATION to. If no name is specified then NOTIFICATION will be sent to all configured BGP peers. -// -// x-constraint: -// - /components/schemas/Device.Bgp/properties/name -// -// x-constraint: -// - /components/schemas/Device.Bgp/properties/name -// -// SetNames sets the []string value in the ActionProtocolBgpNotification object -func (obj *actionProtocolBgpNotification) SetNames(value []string) ActionProtocolBgpNotification { - - if obj.obj.Names == nil { - obj.obj.Names = make([]string, 0) - } - obj.obj.Names = value - - return obj -} - -type ActionProtocolBgpNotificationChoiceEnum string - -// Enum of Choice on ActionProtocolBgpNotification -var ActionProtocolBgpNotificationChoice = struct { - CEASE ActionProtocolBgpNotificationChoiceEnum - MESSAGE_HEADER_ERROR ActionProtocolBgpNotificationChoiceEnum - OPEN_MESSAGE_ERROR ActionProtocolBgpNotificationChoiceEnum - UPDATE_MESSAGE_ERROR ActionProtocolBgpNotificationChoiceEnum - HOLD_TIMER_EXPIRED ActionProtocolBgpNotificationChoiceEnum - FINITE_STATE_MACHINE_ERROR ActionProtocolBgpNotificationChoiceEnum - CUSTOM ActionProtocolBgpNotificationChoiceEnum -}{ - CEASE: ActionProtocolBgpNotificationChoiceEnum("cease"), - MESSAGE_HEADER_ERROR: ActionProtocolBgpNotificationChoiceEnum("message_header_error"), - OPEN_MESSAGE_ERROR: ActionProtocolBgpNotificationChoiceEnum("open_message_error"), - UPDATE_MESSAGE_ERROR: ActionProtocolBgpNotificationChoiceEnum("update_message_error"), - HOLD_TIMER_EXPIRED: ActionProtocolBgpNotificationChoiceEnum("hold_timer_expired"), - FINITE_STATE_MACHINE_ERROR: ActionProtocolBgpNotificationChoiceEnum("finite_state_machine_error"), - CUSTOM: ActionProtocolBgpNotificationChoiceEnum("custom"), -} - -func (obj *actionProtocolBgpNotification) Choice() ActionProtocolBgpNotificationChoiceEnum { - return ActionProtocolBgpNotificationChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// Each BGP NOTIFICATION message includes an Error Code field indicating what type of problem occurred. For certain Error Codes, an Error Subcode field provides additional details about the specific nature of the problem. The choice value will provide the Error Code used in NOTIFICATION message. The Subcode can be set for each of the corresponding errors except for Hold Timer Expired error and BGP Finite State Machine error. In both of these cases Subcode 0 will be sent. If a user wants to use non zero Sub Code then custom choice can be used. -// Choice returns a string -func (obj *actionProtocolBgpNotification) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *actionProtocolBgpNotification) setChoice(value ActionProtocolBgpNotificationChoiceEnum) ActionProtocolBgpNotification { - intValue, ok := otg.ActionProtocolBgpNotification_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ActionProtocolBgpNotificationChoiceEnum", string(value))) - return obj - } - enumValue := otg.ActionProtocolBgpNotification_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Custom = nil - obj.customHolder = nil - obj.obj.FiniteStateMachineError = nil - obj.finiteStateMachineErrorHolder = nil - obj.obj.HoldTimerExpired = nil - obj.holdTimerExpiredHolder = nil - obj.obj.UpdateMessageError = nil - obj.updateMessageErrorHolder = nil - obj.obj.OpenMessageError = nil - obj.openMessageErrorHolder = nil - obj.obj.MessageHeaderError = nil - obj.messageHeaderErrorHolder = nil - obj.obj.Cease = nil - obj.ceaseHolder = nil - - if value == ActionProtocolBgpNotificationChoice.CEASE { - obj.obj.Cease = NewDeviceBgpCeaseError().msg() - } - - if value == ActionProtocolBgpNotificationChoice.MESSAGE_HEADER_ERROR { - obj.obj.MessageHeaderError = NewDeviceBgpMessageHeaderError().msg() - } - - if value == ActionProtocolBgpNotificationChoice.OPEN_MESSAGE_ERROR { - obj.obj.OpenMessageError = NewDeviceBgpOpenMessageError().msg() - } - - if value == ActionProtocolBgpNotificationChoice.UPDATE_MESSAGE_ERROR { - obj.obj.UpdateMessageError = NewDeviceBgpUpdateMessageError().msg() - } - - if value == ActionProtocolBgpNotificationChoice.HOLD_TIMER_EXPIRED { - obj.obj.HoldTimerExpired = NewDeviceBgpHoldTimerExpired().msg() - } - - if value == ActionProtocolBgpNotificationChoice.FINITE_STATE_MACHINE_ERROR { - obj.obj.FiniteStateMachineError = NewDeviceBgpFiniteStateMachineError().msg() - } - - if value == ActionProtocolBgpNotificationChoice.CUSTOM { - obj.obj.Custom = NewDeviceBgpCustomError().msg() - } - - return obj -} - -// description is TBD -// Cease returns a DeviceBgpCeaseError -func (obj *actionProtocolBgpNotification) Cease() DeviceBgpCeaseError { - if obj.obj.Cease == nil { - obj.setChoice(ActionProtocolBgpNotificationChoice.CEASE) - } - if obj.ceaseHolder == nil { - obj.ceaseHolder = &deviceBgpCeaseError{obj: obj.obj.Cease} - } - return obj.ceaseHolder -} - -// description is TBD -// Cease returns a DeviceBgpCeaseError -func (obj *actionProtocolBgpNotification) HasCease() bool { - return obj.obj.Cease != nil -} - -// description is TBD -// SetCease sets the DeviceBgpCeaseError value in the ActionProtocolBgpNotification object -func (obj *actionProtocolBgpNotification) SetCease(value DeviceBgpCeaseError) ActionProtocolBgpNotification { - obj.setChoice(ActionProtocolBgpNotificationChoice.CEASE) - obj.ceaseHolder = nil - obj.obj.Cease = value.msg() - - return obj -} - -// description is TBD -// MessageHeaderError returns a DeviceBgpMessageHeaderError -func (obj *actionProtocolBgpNotification) MessageHeaderError() DeviceBgpMessageHeaderError { - if obj.obj.MessageHeaderError == nil { - obj.setChoice(ActionProtocolBgpNotificationChoice.MESSAGE_HEADER_ERROR) - } - if obj.messageHeaderErrorHolder == nil { - obj.messageHeaderErrorHolder = &deviceBgpMessageHeaderError{obj: obj.obj.MessageHeaderError} - } - return obj.messageHeaderErrorHolder -} - -// description is TBD -// MessageHeaderError returns a DeviceBgpMessageHeaderError -func (obj *actionProtocolBgpNotification) HasMessageHeaderError() bool { - return obj.obj.MessageHeaderError != nil -} - -// description is TBD -// SetMessageHeaderError sets the DeviceBgpMessageHeaderError value in the ActionProtocolBgpNotification object -func (obj *actionProtocolBgpNotification) SetMessageHeaderError(value DeviceBgpMessageHeaderError) ActionProtocolBgpNotification { - obj.setChoice(ActionProtocolBgpNotificationChoice.MESSAGE_HEADER_ERROR) - obj.messageHeaderErrorHolder = nil - obj.obj.MessageHeaderError = value.msg() - - return obj -} - -// description is TBD -// OpenMessageError returns a DeviceBgpOpenMessageError -func (obj *actionProtocolBgpNotification) OpenMessageError() DeviceBgpOpenMessageError { - if obj.obj.OpenMessageError == nil { - obj.setChoice(ActionProtocolBgpNotificationChoice.OPEN_MESSAGE_ERROR) - } - if obj.openMessageErrorHolder == nil { - obj.openMessageErrorHolder = &deviceBgpOpenMessageError{obj: obj.obj.OpenMessageError} - } - return obj.openMessageErrorHolder -} - -// description is TBD -// OpenMessageError returns a DeviceBgpOpenMessageError -func (obj *actionProtocolBgpNotification) HasOpenMessageError() bool { - return obj.obj.OpenMessageError != nil -} - -// description is TBD -// SetOpenMessageError sets the DeviceBgpOpenMessageError value in the ActionProtocolBgpNotification object -func (obj *actionProtocolBgpNotification) SetOpenMessageError(value DeviceBgpOpenMessageError) ActionProtocolBgpNotification { - obj.setChoice(ActionProtocolBgpNotificationChoice.OPEN_MESSAGE_ERROR) - obj.openMessageErrorHolder = nil - obj.obj.OpenMessageError = value.msg() - - return obj -} - -// description is TBD -// UpdateMessageError returns a DeviceBgpUpdateMessageError -func (obj *actionProtocolBgpNotification) UpdateMessageError() DeviceBgpUpdateMessageError { - if obj.obj.UpdateMessageError == nil { - obj.setChoice(ActionProtocolBgpNotificationChoice.UPDATE_MESSAGE_ERROR) - } - if obj.updateMessageErrorHolder == nil { - obj.updateMessageErrorHolder = &deviceBgpUpdateMessageError{obj: obj.obj.UpdateMessageError} - } - return obj.updateMessageErrorHolder -} - -// description is TBD -// UpdateMessageError returns a DeviceBgpUpdateMessageError -func (obj *actionProtocolBgpNotification) HasUpdateMessageError() bool { - return obj.obj.UpdateMessageError != nil -} - -// description is TBD -// SetUpdateMessageError sets the DeviceBgpUpdateMessageError value in the ActionProtocolBgpNotification object -func (obj *actionProtocolBgpNotification) SetUpdateMessageError(value DeviceBgpUpdateMessageError) ActionProtocolBgpNotification { - obj.setChoice(ActionProtocolBgpNotificationChoice.UPDATE_MESSAGE_ERROR) - obj.updateMessageErrorHolder = nil - obj.obj.UpdateMessageError = value.msg() - - return obj -} - -// description is TBD -// HoldTimerExpired returns a DeviceBgpHoldTimerExpired -func (obj *actionProtocolBgpNotification) HoldTimerExpired() DeviceBgpHoldTimerExpired { - if obj.obj.HoldTimerExpired == nil { - obj.setChoice(ActionProtocolBgpNotificationChoice.HOLD_TIMER_EXPIRED) - } - if obj.holdTimerExpiredHolder == nil { - obj.holdTimerExpiredHolder = &deviceBgpHoldTimerExpired{obj: obj.obj.HoldTimerExpired} - } - return obj.holdTimerExpiredHolder -} - -// description is TBD -// HoldTimerExpired returns a DeviceBgpHoldTimerExpired -func (obj *actionProtocolBgpNotification) HasHoldTimerExpired() bool { - return obj.obj.HoldTimerExpired != nil -} - -// description is TBD -// SetHoldTimerExpired sets the DeviceBgpHoldTimerExpired value in the ActionProtocolBgpNotification object -func (obj *actionProtocolBgpNotification) SetHoldTimerExpired(value DeviceBgpHoldTimerExpired) ActionProtocolBgpNotification { - obj.setChoice(ActionProtocolBgpNotificationChoice.HOLD_TIMER_EXPIRED) - obj.holdTimerExpiredHolder = nil - obj.obj.HoldTimerExpired = value.msg() - - return obj -} - -// description is TBD -// FiniteStateMachineError returns a DeviceBgpFiniteStateMachineError -func (obj *actionProtocolBgpNotification) FiniteStateMachineError() DeviceBgpFiniteStateMachineError { - if obj.obj.FiniteStateMachineError == nil { - obj.setChoice(ActionProtocolBgpNotificationChoice.FINITE_STATE_MACHINE_ERROR) - } - if obj.finiteStateMachineErrorHolder == nil { - obj.finiteStateMachineErrorHolder = &deviceBgpFiniteStateMachineError{obj: obj.obj.FiniteStateMachineError} - } - return obj.finiteStateMachineErrorHolder -} - -// description is TBD -// FiniteStateMachineError returns a DeviceBgpFiniteStateMachineError -func (obj *actionProtocolBgpNotification) HasFiniteStateMachineError() bool { - return obj.obj.FiniteStateMachineError != nil -} - -// description is TBD -// SetFiniteStateMachineError sets the DeviceBgpFiniteStateMachineError value in the ActionProtocolBgpNotification object -func (obj *actionProtocolBgpNotification) SetFiniteStateMachineError(value DeviceBgpFiniteStateMachineError) ActionProtocolBgpNotification { - obj.setChoice(ActionProtocolBgpNotificationChoice.FINITE_STATE_MACHINE_ERROR) - obj.finiteStateMachineErrorHolder = nil - obj.obj.FiniteStateMachineError = value.msg() - - return obj -} - -// description is TBD -// Custom returns a DeviceBgpCustomError -func (obj *actionProtocolBgpNotification) Custom() DeviceBgpCustomError { - if obj.obj.Custom == nil { - obj.setChoice(ActionProtocolBgpNotificationChoice.CUSTOM) - } - if obj.customHolder == nil { - obj.customHolder = &deviceBgpCustomError{obj: obj.obj.Custom} - } - return obj.customHolder -} - -// description is TBD -// Custom returns a DeviceBgpCustomError -func (obj *actionProtocolBgpNotification) HasCustom() bool { - return obj.obj.Custom != nil -} - -// description is TBD -// SetCustom sets the DeviceBgpCustomError value in the ActionProtocolBgpNotification object -func (obj *actionProtocolBgpNotification) SetCustom(value DeviceBgpCustomError) ActionProtocolBgpNotification { - obj.setChoice(ActionProtocolBgpNotificationChoice.CUSTOM) - obj.customHolder = nil - obj.obj.Custom = value.msg() - - return obj -} - -func (obj *actionProtocolBgpNotification) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Cease != nil { - - obj.Cease().validateObj(vObj, set_default) - } - - if obj.obj.MessageHeaderError != nil { - - obj.MessageHeaderError().validateObj(vObj, set_default) - } - - if obj.obj.OpenMessageError != nil { - - obj.OpenMessageError().validateObj(vObj, set_default) - } - - if obj.obj.UpdateMessageError != nil { - - obj.UpdateMessageError().validateObj(vObj, set_default) - } - - if obj.obj.HoldTimerExpired != nil { - - obj.HoldTimerExpired().validateObj(vObj, set_default) - } - - if obj.obj.FiniteStateMachineError != nil { - - obj.FiniteStateMachineError().validateObj(vObj, set_default) - } - - if obj.obj.Custom != nil { - - obj.Custom().validateObj(vObj, set_default) - } - -} - -func (obj *actionProtocolBgpNotification) setDefault() { - var choices_set int = 0 - var choice ActionProtocolBgpNotificationChoiceEnum - - if obj.obj.Cease != nil { - choices_set += 1 - choice = ActionProtocolBgpNotificationChoice.CEASE - } - - if obj.obj.MessageHeaderError != nil { - choices_set += 1 - choice = ActionProtocolBgpNotificationChoice.MESSAGE_HEADER_ERROR - } - - if obj.obj.OpenMessageError != nil { - choices_set += 1 - choice = ActionProtocolBgpNotificationChoice.OPEN_MESSAGE_ERROR - } - - if obj.obj.UpdateMessageError != nil { - choices_set += 1 - choice = ActionProtocolBgpNotificationChoice.UPDATE_MESSAGE_ERROR - } - - if obj.obj.HoldTimerExpired != nil { - choices_set += 1 - choice = ActionProtocolBgpNotificationChoice.HOLD_TIMER_EXPIRED - } - - if obj.obj.FiniteStateMachineError != nil { - choices_set += 1 - choice = ActionProtocolBgpNotificationChoice.FINITE_STATE_MACHINE_ERROR - } - - if obj.obj.Custom != nil { - choices_set += 1 - choice = ActionProtocolBgpNotificationChoice.CUSTOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(ActionProtocolBgpNotificationChoice.CEASE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionProtocolBgpNotification") - } - } else { - intVal := otg.ActionProtocolBgpNotification_Choice_Enum_value[string(choice)] - enumValue := otg.ActionProtocolBgpNotification_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** ActionProtocolBgpInitiateGracefulRestart ***** -type actionProtocolBgpInitiateGracefulRestart struct { - validation - obj *otg.ActionProtocolBgpInitiateGracefulRestart - marshaller marshalActionProtocolBgpInitiateGracefulRestart - unMarshaller unMarshalActionProtocolBgpInitiateGracefulRestart -} - -func NewActionProtocolBgpInitiateGracefulRestart() ActionProtocolBgpInitiateGracefulRestart { - obj := actionProtocolBgpInitiateGracefulRestart{obj: &otg.ActionProtocolBgpInitiateGracefulRestart{}} - obj.setDefault() - return &obj -} - -func (obj *actionProtocolBgpInitiateGracefulRestart) msg() *otg.ActionProtocolBgpInitiateGracefulRestart { - return obj.obj -} - -func (obj *actionProtocolBgpInitiateGracefulRestart) setMsg(msg *otg.ActionProtocolBgpInitiateGracefulRestart) ActionProtocolBgpInitiateGracefulRestart { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionProtocolBgpInitiateGracefulRestart struct { - obj *actionProtocolBgpInitiateGracefulRestart -} - -type marshalActionProtocolBgpInitiateGracefulRestart interface { - // ToProto marshals ActionProtocolBgpInitiateGracefulRestart to protobuf object *otg.ActionProtocolBgpInitiateGracefulRestart - ToProto() (*otg.ActionProtocolBgpInitiateGracefulRestart, error) - // ToPbText marshals ActionProtocolBgpInitiateGracefulRestart to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionProtocolBgpInitiateGracefulRestart to YAML text - ToYaml() (string, error) - // ToJson marshals ActionProtocolBgpInitiateGracefulRestart to JSON text - ToJson() (string, error) -} - -type unMarshalactionProtocolBgpInitiateGracefulRestart struct { - obj *actionProtocolBgpInitiateGracefulRestart -} - -type unMarshalActionProtocolBgpInitiateGracefulRestart interface { - // FromProto unmarshals ActionProtocolBgpInitiateGracefulRestart from protobuf object *otg.ActionProtocolBgpInitiateGracefulRestart - FromProto(msg *otg.ActionProtocolBgpInitiateGracefulRestart) (ActionProtocolBgpInitiateGracefulRestart, error) - // FromPbText unmarshals ActionProtocolBgpInitiateGracefulRestart from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionProtocolBgpInitiateGracefulRestart from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionProtocolBgpInitiateGracefulRestart from JSON text - FromJson(value string) error -} - -func (obj *actionProtocolBgpInitiateGracefulRestart) Marshal() marshalActionProtocolBgpInitiateGracefulRestart { - if obj.marshaller == nil { - obj.marshaller = &marshalactionProtocolBgpInitiateGracefulRestart{obj: obj} - } - return obj.marshaller -} - -func (obj *actionProtocolBgpInitiateGracefulRestart) Unmarshal() unMarshalActionProtocolBgpInitiateGracefulRestart { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionProtocolBgpInitiateGracefulRestart{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionProtocolBgpInitiateGracefulRestart) ToProto() (*otg.ActionProtocolBgpInitiateGracefulRestart, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionProtocolBgpInitiateGracefulRestart) FromProto(msg *otg.ActionProtocolBgpInitiateGracefulRestart) (ActionProtocolBgpInitiateGracefulRestart, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionProtocolBgpInitiateGracefulRestart) 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 *unMarshalactionProtocolBgpInitiateGracefulRestart) 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 *marshalactionProtocolBgpInitiateGracefulRestart) 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 *unMarshalactionProtocolBgpInitiateGracefulRestart) 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 *marshalactionProtocolBgpInitiateGracefulRestart) 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 *unMarshalactionProtocolBgpInitiateGracefulRestart) 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 *actionProtocolBgpInitiateGracefulRestart) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionProtocolBgpInitiateGracefulRestart) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionProtocolBgpInitiateGracefulRestart) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionProtocolBgpInitiateGracefulRestart) Clone() (ActionProtocolBgpInitiateGracefulRestart, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionProtocolBgpInitiateGracefulRestart() - 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 -} - -// ActionProtocolBgpInitiateGracefulRestart is initiates BGP Graceful Restart process for the selected BGP peers. If no name is specified then Graceful Restart will be sent to all configured BGP peers. -type ActionProtocolBgpInitiateGracefulRestart interface { - Validation - // msg marshals ActionProtocolBgpInitiateGracefulRestart to protobuf object *otg.ActionProtocolBgpInitiateGracefulRestart - // and doesn't set defaults - msg() *otg.ActionProtocolBgpInitiateGracefulRestart - // setMsg unmarshals ActionProtocolBgpInitiateGracefulRestart from protobuf object *otg.ActionProtocolBgpInitiateGracefulRestart - // and doesn't set defaults - setMsg(*otg.ActionProtocolBgpInitiateGracefulRestart) ActionProtocolBgpInitiateGracefulRestart - // provides marshal interface - Marshal() marshalActionProtocolBgpInitiateGracefulRestart - // provides unmarshal interface - Unmarshal() unMarshalActionProtocolBgpInitiateGracefulRestart - // validate validates ActionProtocolBgpInitiateGracefulRestart - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionProtocolBgpInitiateGracefulRestart, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PeerNames returns []string, set in ActionProtocolBgpInitiateGracefulRestart. - PeerNames() []string - // SetPeerNames assigns []string provided by user to ActionProtocolBgpInitiateGracefulRestart - SetPeerNames(value []string) ActionProtocolBgpInitiateGracefulRestart - // RestartDelay returns uint32, set in ActionProtocolBgpInitiateGracefulRestart. - RestartDelay() uint32 - // SetRestartDelay assigns uint32 provided by user to ActionProtocolBgpInitiateGracefulRestart - SetRestartDelay(value uint32) ActionProtocolBgpInitiateGracefulRestart - // HasRestartDelay checks if RestartDelay has been set in ActionProtocolBgpInitiateGracefulRestart - HasRestartDelay() bool -} - -// The names of device BGP peers objects to control. -// -// x-constraint: -// - /components/schemas/Device.Bgp/properties/name -// -// x-constraint: -// - /components/schemas/Device.Bgp/properties/name -// -// PeerNames returns a []string -func (obj *actionProtocolBgpInitiateGracefulRestart) PeerNames() []string { - if obj.obj.PeerNames == nil { - obj.obj.PeerNames = make([]string, 0) - } - return obj.obj.PeerNames -} - -// The names of device BGP peers objects to control. -// -// x-constraint: -// - /components/schemas/Device.Bgp/properties/name -// -// x-constraint: -// - /components/schemas/Device.Bgp/properties/name -// -// SetPeerNames sets the []string value in the ActionProtocolBgpInitiateGracefulRestart object -func (obj *actionProtocolBgpInitiateGracefulRestart) SetPeerNames(value []string) ActionProtocolBgpInitiateGracefulRestart { - - if obj.obj.PeerNames == nil { - obj.obj.PeerNames = make([]string, 0) - } - obj.obj.PeerNames = value - - return obj -} - -// Duration (in seconds) after which selected BGP peers will initiate -// Graceful restart by sending the Open Message with Restart State bit set in the Graceful Restart capability. -// RestartDelay returns a uint32 -func (obj *actionProtocolBgpInitiateGracefulRestart) RestartDelay() uint32 { - - return *obj.obj.RestartDelay - -} - -// Duration (in seconds) after which selected BGP peers will initiate -// Graceful restart by sending the Open Message with Restart State bit set in the Graceful Restart capability. -// RestartDelay returns a uint32 -func (obj *actionProtocolBgpInitiateGracefulRestart) HasRestartDelay() bool { - return obj.obj.RestartDelay != nil -} - -// Duration (in seconds) after which selected BGP peers will initiate -// Graceful restart by sending the Open Message with Restart State bit set in the Graceful Restart capability. -// SetRestartDelay sets the uint32 value in the ActionProtocolBgpInitiateGracefulRestart object -func (obj *actionProtocolBgpInitiateGracefulRestart) SetRestartDelay(value uint32) ActionProtocolBgpInitiateGracefulRestart { - - obj.obj.RestartDelay = &value - return obj -} - -func (obj *actionProtocolBgpInitiateGracefulRestart) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RestartDelay != nil { - - if *obj.obj.RestartDelay > 3600 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= ActionProtocolBgpInitiateGracefulRestart.RestartDelay <= 3600 but Got %d", *obj.obj.RestartDelay)) - } - - } - -} - -func (obj *actionProtocolBgpInitiateGracefulRestart) setDefault() { - if obj.obj.RestartDelay == nil { - obj.SetRestartDelay(30) - } - -} - -// ***** FlowMetricTagFilter ***** -type flowMetricTagFilter struct { - validation - obj *otg.FlowMetricTagFilter - marshaller marshalFlowMetricTagFilter - unMarshaller unMarshalFlowMetricTagFilter -} - -func NewFlowMetricTagFilter() FlowMetricTagFilter { - obj := flowMetricTagFilter{obj: &otg.FlowMetricTagFilter{}} - obj.setDefault() - return &obj -} - -func (obj *flowMetricTagFilter) msg() *otg.FlowMetricTagFilter { - return obj.obj -} - -func (obj *flowMetricTagFilter) setMsg(msg *otg.FlowMetricTagFilter) FlowMetricTagFilter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowMetricTagFilter struct { - obj *flowMetricTagFilter -} - -type marshalFlowMetricTagFilter interface { - // ToProto marshals FlowMetricTagFilter to protobuf object *otg.FlowMetricTagFilter - ToProto() (*otg.FlowMetricTagFilter, error) - // ToPbText marshals FlowMetricTagFilter to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowMetricTagFilter to YAML text - ToYaml() (string, error) - // ToJson marshals FlowMetricTagFilter to JSON text - ToJson() (string, error) -} - -type unMarshalflowMetricTagFilter struct { - obj *flowMetricTagFilter -} - -type unMarshalFlowMetricTagFilter interface { - // FromProto unmarshals FlowMetricTagFilter from protobuf object *otg.FlowMetricTagFilter - FromProto(msg *otg.FlowMetricTagFilter) (FlowMetricTagFilter, error) - // FromPbText unmarshals FlowMetricTagFilter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowMetricTagFilter from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowMetricTagFilter from JSON text - FromJson(value string) error -} - -func (obj *flowMetricTagFilter) Marshal() marshalFlowMetricTagFilter { - if obj.marshaller == nil { - obj.marshaller = &marshalflowMetricTagFilter{obj: obj} - } - return obj.marshaller -} - -func (obj *flowMetricTagFilter) Unmarshal() unMarshalFlowMetricTagFilter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowMetricTagFilter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowMetricTagFilter) ToProto() (*otg.FlowMetricTagFilter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowMetricTagFilter) FromProto(msg *otg.FlowMetricTagFilter) (FlowMetricTagFilter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowMetricTagFilter) 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 *unMarshalflowMetricTagFilter) 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 *marshalflowMetricTagFilter) 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 *unMarshalflowMetricTagFilter) 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 *marshalflowMetricTagFilter) 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 *unMarshalflowMetricTagFilter) 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 *flowMetricTagFilter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowMetricTagFilter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowMetricTagFilter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowMetricTagFilter) Clone() (FlowMetricTagFilter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowMetricTagFilter() - 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 -} - -// FlowMetricTagFilter is a container for filtering ingress and/or egress metric tags. -// The Tx stats may not be applicable in both the request and response filter. -type FlowMetricTagFilter interface { - Validation - // msg marshals FlowMetricTagFilter to protobuf object *otg.FlowMetricTagFilter - // and doesn't set defaults - msg() *otg.FlowMetricTagFilter - // setMsg unmarshals FlowMetricTagFilter from protobuf object *otg.FlowMetricTagFilter - // and doesn't set defaults - setMsg(*otg.FlowMetricTagFilter) FlowMetricTagFilter - // provides marshal interface - Marshal() marshalFlowMetricTagFilter - // provides unmarshal interface - Unmarshal() unMarshalFlowMetricTagFilter - // validate validates FlowMetricTagFilter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowMetricTagFilter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in FlowMetricTagFilter. - Name() string - // SetName assigns string provided by user to FlowMetricTagFilter - SetName(value string) FlowMetricTagFilter - // HasName checks if Name has been set in FlowMetricTagFilter - HasName() bool - // Values returns []string, set in FlowMetricTagFilter. - Values() []string - // SetValues assigns []string provided by user to FlowMetricTagFilter - SetValues(value []string) FlowMetricTagFilter -} - -// A metric tag name that MUST exist in a flow packet or -// flow egress_packet configuration -// Name returns a string -func (obj *flowMetricTagFilter) Name() string { - - return *obj.obj.Name - -} - -// A metric tag name that MUST exist in a flow packet or -// flow egress_packet configuration -// Name returns a string -func (obj *flowMetricTagFilter) HasName() bool { - return obj.obj.Name != nil -} - -// A metric tag name that MUST exist in a flow packet or -// flow egress_packet configuration -// SetName sets the string value in the FlowMetricTagFilter object -func (obj *flowMetricTagFilter) SetName(value string) FlowMetricTagFilter { - - obj.obj.Name = &value - return obj -} - -// A list of filters that can be applied to the metric tag name. -// By default all values will be included in the flow metric results. -// Values returns a []string -func (obj *flowMetricTagFilter) Values() []string { - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - return obj.obj.Values -} - -// A list of filters that can be applied to the metric tag name. -// By default all values will be included in the flow metric results. -// SetValues sets the []string value in the FlowMetricTagFilter object -func (obj *flowMetricTagFilter) SetValues(value []string) FlowMetricTagFilter { - - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -func (obj *flowMetricTagFilter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *flowMetricTagFilter) setDefault() { - -} - -// ***** ActionResponseProtocol ***** -type actionResponseProtocol struct { - validation - obj *otg.ActionResponseProtocol - marshaller marshalActionResponseProtocol - unMarshaller unMarshalActionResponseProtocol - ipv4Holder ActionResponseProtocolIpv4 - ipv6Holder ActionResponseProtocolIpv6 -} - -func NewActionResponseProtocol() ActionResponseProtocol { - obj := actionResponseProtocol{obj: &otg.ActionResponseProtocol{}} - obj.setDefault() - return &obj -} - -func (obj *actionResponseProtocol) msg() *otg.ActionResponseProtocol { - return obj.obj -} - -func (obj *actionResponseProtocol) setMsg(msg *otg.ActionResponseProtocol) ActionResponseProtocol { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionResponseProtocol struct { - obj *actionResponseProtocol -} - -type marshalActionResponseProtocol interface { - // ToProto marshals ActionResponseProtocol to protobuf object *otg.ActionResponseProtocol - ToProto() (*otg.ActionResponseProtocol, error) - // ToPbText marshals ActionResponseProtocol to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionResponseProtocol to YAML text - ToYaml() (string, error) - // ToJson marshals ActionResponseProtocol to JSON text - ToJson() (string, error) -} - -type unMarshalactionResponseProtocol struct { - obj *actionResponseProtocol -} - -type unMarshalActionResponseProtocol interface { - // FromProto unmarshals ActionResponseProtocol from protobuf object *otg.ActionResponseProtocol - FromProto(msg *otg.ActionResponseProtocol) (ActionResponseProtocol, error) - // FromPbText unmarshals ActionResponseProtocol from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionResponseProtocol from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionResponseProtocol from JSON text - FromJson(value string) error -} - -func (obj *actionResponseProtocol) Marshal() marshalActionResponseProtocol { - if obj.marshaller == nil { - obj.marshaller = &marshalactionResponseProtocol{obj: obj} - } - return obj.marshaller -} - -func (obj *actionResponseProtocol) Unmarshal() unMarshalActionResponseProtocol { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionResponseProtocol{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionResponseProtocol) ToProto() (*otg.ActionResponseProtocol, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionResponseProtocol) FromProto(msg *otg.ActionResponseProtocol) (ActionResponseProtocol, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionResponseProtocol) 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 *unMarshalactionResponseProtocol) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalactionResponseProtocol) 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 *unMarshalactionResponseProtocol) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalactionResponseProtocol) 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 *unMarshalactionResponseProtocol) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *actionResponseProtocol) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionResponseProtocol) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionResponseProtocol) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionResponseProtocol) Clone() (ActionResponseProtocol, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionResponseProtocol() - 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 -} - -func (obj *actionResponseProtocol) setNil() { - obj.ipv4Holder = nil - obj.ipv6Holder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ActionResponseProtocol is response for actions associated with protocols on configured resources. -type ActionResponseProtocol interface { - Validation - // msg marshals ActionResponseProtocol to protobuf object *otg.ActionResponseProtocol - // and doesn't set defaults - msg() *otg.ActionResponseProtocol - // setMsg unmarshals ActionResponseProtocol from protobuf object *otg.ActionResponseProtocol - // and doesn't set defaults - setMsg(*otg.ActionResponseProtocol) ActionResponseProtocol - // provides marshal interface - Marshal() marshalActionResponseProtocol - // provides unmarshal interface - Unmarshal() unMarshalActionResponseProtocol - // validate validates ActionResponseProtocol - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionResponseProtocol, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ActionResponseProtocolChoiceEnum, set in ActionResponseProtocol - Choice() ActionResponseProtocolChoiceEnum - // setChoice assigns ActionResponseProtocolChoiceEnum provided by user to ActionResponseProtocol - setChoice(value ActionResponseProtocolChoiceEnum) ActionResponseProtocol - // Ipv4 returns ActionResponseProtocolIpv4, set in ActionResponseProtocol. - // ActionResponseProtocolIpv4 is response for actions associated with IPv4 on configured resources. - Ipv4() ActionResponseProtocolIpv4 - // SetIpv4 assigns ActionResponseProtocolIpv4 provided by user to ActionResponseProtocol. - // ActionResponseProtocolIpv4 is response for actions associated with IPv4 on configured resources. - SetIpv4(value ActionResponseProtocolIpv4) ActionResponseProtocol - // HasIpv4 checks if Ipv4 has been set in ActionResponseProtocol - HasIpv4() bool - // Ipv6 returns ActionResponseProtocolIpv6, set in ActionResponseProtocol. - // ActionResponseProtocolIpv6 is response for actions associated with IPv6 on configured resources. - Ipv6() ActionResponseProtocolIpv6 - // SetIpv6 assigns ActionResponseProtocolIpv6 provided by user to ActionResponseProtocol. - // ActionResponseProtocolIpv6 is response for actions associated with IPv6 on configured resources. - SetIpv6(value ActionResponseProtocolIpv6) ActionResponseProtocol - // HasIpv6 checks if Ipv6 has been set in ActionResponseProtocol - HasIpv6() bool - setNil() -} - -type ActionResponseProtocolChoiceEnum string - -// Enum of Choice on ActionResponseProtocol -var ActionResponseProtocolChoice = struct { - IPV4 ActionResponseProtocolChoiceEnum - IPV6 ActionResponseProtocolChoiceEnum -}{ - IPV4: ActionResponseProtocolChoiceEnum("ipv4"), - IPV6: ActionResponseProtocolChoiceEnum("ipv6"), -} - -func (obj *actionResponseProtocol) Choice() ActionResponseProtocolChoiceEnum { - return ActionResponseProtocolChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *actionResponseProtocol) setChoice(value ActionResponseProtocolChoiceEnum) ActionResponseProtocol { - intValue, ok := otg.ActionResponseProtocol_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ActionResponseProtocolChoiceEnum", string(value))) - return obj - } - enumValue := otg.ActionResponseProtocol_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Ipv6 = nil - obj.ipv6Holder = nil - obj.obj.Ipv4 = nil - obj.ipv4Holder = nil - - if value == ActionResponseProtocolChoice.IPV4 { - obj.obj.Ipv4 = NewActionResponseProtocolIpv4().msg() - } - - if value == ActionResponseProtocolChoice.IPV6 { - obj.obj.Ipv6 = NewActionResponseProtocolIpv6().msg() - } - - return obj -} - -// description is TBD -// Ipv4 returns a ActionResponseProtocolIpv4 -func (obj *actionResponseProtocol) Ipv4() ActionResponseProtocolIpv4 { - if obj.obj.Ipv4 == nil { - obj.setChoice(ActionResponseProtocolChoice.IPV4) - } - if obj.ipv4Holder == nil { - obj.ipv4Holder = &actionResponseProtocolIpv4{obj: obj.obj.Ipv4} - } - return obj.ipv4Holder -} - -// description is TBD -// Ipv4 returns a ActionResponseProtocolIpv4 -func (obj *actionResponseProtocol) HasIpv4() bool { - return obj.obj.Ipv4 != nil -} - -// description is TBD -// SetIpv4 sets the ActionResponseProtocolIpv4 value in the ActionResponseProtocol object -func (obj *actionResponseProtocol) SetIpv4(value ActionResponseProtocolIpv4) ActionResponseProtocol { - obj.setChoice(ActionResponseProtocolChoice.IPV4) - obj.ipv4Holder = nil - obj.obj.Ipv4 = value.msg() - - return obj -} - -// description is TBD -// Ipv6 returns a ActionResponseProtocolIpv6 -func (obj *actionResponseProtocol) Ipv6() ActionResponseProtocolIpv6 { - if obj.obj.Ipv6 == nil { - obj.setChoice(ActionResponseProtocolChoice.IPV6) - } - if obj.ipv6Holder == nil { - obj.ipv6Holder = &actionResponseProtocolIpv6{obj: obj.obj.Ipv6} - } - return obj.ipv6Holder -} - -// description is TBD -// Ipv6 returns a ActionResponseProtocolIpv6 -func (obj *actionResponseProtocol) HasIpv6() bool { - return obj.obj.Ipv6 != nil -} - -// description is TBD -// SetIpv6 sets the ActionResponseProtocolIpv6 value in the ActionResponseProtocol object -func (obj *actionResponseProtocol) SetIpv6(value ActionResponseProtocolIpv6) ActionResponseProtocol { - obj.setChoice(ActionResponseProtocolChoice.IPV6) - obj.ipv6Holder = nil - obj.obj.Ipv6 = value.msg() - - return obj -} - -func (obj *actionResponseProtocol) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionResponseProtocol") - } - - if obj.obj.Ipv4 != nil { - - obj.Ipv4().validateObj(vObj, set_default) - } - - if obj.obj.Ipv6 != nil { - - obj.Ipv6().validateObj(vObj, set_default) - } - -} - -func (obj *actionResponseProtocol) setDefault() { - var choices_set int = 0 - var choice ActionResponseProtocolChoiceEnum - - if obj.obj.Ipv4 != nil { - choices_set += 1 - choice = ActionResponseProtocolChoice.IPV4 - } - - if obj.obj.Ipv6 != nil { - choices_set += 1 - choice = ActionResponseProtocolChoice.IPV6 - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionResponseProtocol") - } - } else { - intVal := otg.ActionResponseProtocol_Choice_Enum_value[string(choice)] - enumValue := otg.ActionResponseProtocol_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** MetricTimestamp ***** -type metricTimestamp struct { - validation - obj *otg.MetricTimestamp - marshaller marshalMetricTimestamp - unMarshaller unMarshalMetricTimestamp -} - -func NewMetricTimestamp() MetricTimestamp { - obj := metricTimestamp{obj: &otg.MetricTimestamp{}} - obj.setDefault() - return &obj -} - -func (obj *metricTimestamp) msg() *otg.MetricTimestamp { - return obj.obj -} - -func (obj *metricTimestamp) setMsg(msg *otg.MetricTimestamp) MetricTimestamp { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalmetricTimestamp struct { - obj *metricTimestamp -} - -type marshalMetricTimestamp interface { - // ToProto marshals MetricTimestamp to protobuf object *otg.MetricTimestamp - ToProto() (*otg.MetricTimestamp, error) - // ToPbText marshals MetricTimestamp to protobuf text - ToPbText() (string, error) - // ToYaml marshals MetricTimestamp to YAML text - ToYaml() (string, error) - // ToJson marshals MetricTimestamp to JSON text - ToJson() (string, error) -} - -type unMarshalmetricTimestamp struct { - obj *metricTimestamp -} - -type unMarshalMetricTimestamp interface { - // FromProto unmarshals MetricTimestamp from protobuf object *otg.MetricTimestamp - FromProto(msg *otg.MetricTimestamp) (MetricTimestamp, error) - // FromPbText unmarshals MetricTimestamp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals MetricTimestamp from YAML text - FromYaml(value string) error - // FromJson unmarshals MetricTimestamp from JSON text - FromJson(value string) error -} - -func (obj *metricTimestamp) Marshal() marshalMetricTimestamp { - if obj.marshaller == nil { - obj.marshaller = &marshalmetricTimestamp{obj: obj} - } - return obj.marshaller -} - -func (obj *metricTimestamp) Unmarshal() unMarshalMetricTimestamp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalmetricTimestamp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalmetricTimestamp) ToProto() (*otg.MetricTimestamp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalmetricTimestamp) FromProto(msg *otg.MetricTimestamp) (MetricTimestamp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalmetricTimestamp) 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 *unMarshalmetricTimestamp) 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 *marshalmetricTimestamp) 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 *unMarshalmetricTimestamp) 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 *marshalmetricTimestamp) 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 *unMarshalmetricTimestamp) 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 *metricTimestamp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *metricTimestamp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *metricTimestamp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *metricTimestamp) Clone() (MetricTimestamp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewMetricTimestamp() - 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 -} - -// MetricTimestamp is the container for timestamp metrics. -// The container will be empty if the timestamp has not been configured for -// the flow. -type MetricTimestamp interface { - Validation - // msg marshals MetricTimestamp to protobuf object *otg.MetricTimestamp - // and doesn't set defaults - msg() *otg.MetricTimestamp - // setMsg unmarshals MetricTimestamp from protobuf object *otg.MetricTimestamp - // and doesn't set defaults - setMsg(*otg.MetricTimestamp) MetricTimestamp - // provides marshal interface - Marshal() marshalMetricTimestamp - // provides unmarshal interface - Unmarshal() unMarshalMetricTimestamp - // validate validates MetricTimestamp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (MetricTimestamp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // FirstTimestampNs returns float64, set in MetricTimestamp. - FirstTimestampNs() float64 - // SetFirstTimestampNs assigns float64 provided by user to MetricTimestamp - SetFirstTimestampNs(value float64) MetricTimestamp - // HasFirstTimestampNs checks if FirstTimestampNs has been set in MetricTimestamp - HasFirstTimestampNs() bool - // LastTimestampNs returns float64, set in MetricTimestamp. - LastTimestampNs() float64 - // SetLastTimestampNs assigns float64 provided by user to MetricTimestamp - SetLastTimestampNs(value float64) MetricTimestamp - // HasLastTimestampNs checks if LastTimestampNs has been set in MetricTimestamp - HasLastTimestampNs() bool -} - -// First timestamp in nanoseconds -// FirstTimestampNs returns a float64 -func (obj *metricTimestamp) FirstTimestampNs() float64 { - - return *obj.obj.FirstTimestampNs - -} - -// First timestamp in nanoseconds -// FirstTimestampNs returns a float64 -func (obj *metricTimestamp) HasFirstTimestampNs() bool { - return obj.obj.FirstTimestampNs != nil -} - -// First timestamp in nanoseconds -// SetFirstTimestampNs sets the float64 value in the MetricTimestamp object -func (obj *metricTimestamp) SetFirstTimestampNs(value float64) MetricTimestamp { - - obj.obj.FirstTimestampNs = &value - return obj -} - -// Last timestamp in nanoseconds -// LastTimestampNs returns a float64 -func (obj *metricTimestamp) LastTimestampNs() float64 { - - return *obj.obj.LastTimestampNs - -} - -// Last timestamp in nanoseconds -// LastTimestampNs returns a float64 -func (obj *metricTimestamp) HasLastTimestampNs() bool { - return obj.obj.LastTimestampNs != nil -} - -// Last timestamp in nanoseconds -// SetLastTimestampNs sets the float64 value in the MetricTimestamp object -func (obj *metricTimestamp) SetLastTimestampNs(value float64) MetricTimestamp { - - obj.obj.LastTimestampNs = &value - return obj -} - -func (obj *metricTimestamp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *metricTimestamp) setDefault() { - -} - -// ***** MetricLatency ***** -type metricLatency struct { - validation - obj *otg.MetricLatency - marshaller marshalMetricLatency - unMarshaller unMarshalMetricLatency -} - -func NewMetricLatency() MetricLatency { - obj := metricLatency{obj: &otg.MetricLatency{}} - obj.setDefault() - return &obj -} - -func (obj *metricLatency) msg() *otg.MetricLatency { - return obj.obj -} - -func (obj *metricLatency) setMsg(msg *otg.MetricLatency) MetricLatency { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalmetricLatency struct { - obj *metricLatency -} - -type marshalMetricLatency interface { - // ToProto marshals MetricLatency to protobuf object *otg.MetricLatency - ToProto() (*otg.MetricLatency, error) - // ToPbText marshals MetricLatency to protobuf text - ToPbText() (string, error) - // ToYaml marshals MetricLatency to YAML text - ToYaml() (string, error) - // ToJson marshals MetricLatency to JSON text - ToJson() (string, error) -} - -type unMarshalmetricLatency struct { - obj *metricLatency -} - -type unMarshalMetricLatency interface { - // FromProto unmarshals MetricLatency from protobuf object *otg.MetricLatency - FromProto(msg *otg.MetricLatency) (MetricLatency, error) - // FromPbText unmarshals MetricLatency from protobuf text - FromPbText(value string) error - // FromYaml unmarshals MetricLatency from YAML text - FromYaml(value string) error - // FromJson unmarshals MetricLatency from JSON text - FromJson(value string) error -} - -func (obj *metricLatency) Marshal() marshalMetricLatency { - if obj.marshaller == nil { - obj.marshaller = &marshalmetricLatency{obj: obj} - } - return obj.marshaller -} - -func (obj *metricLatency) Unmarshal() unMarshalMetricLatency { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalmetricLatency{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalmetricLatency) ToProto() (*otg.MetricLatency, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalmetricLatency) FromProto(msg *otg.MetricLatency) (MetricLatency, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalmetricLatency) 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 *unMarshalmetricLatency) 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 *marshalmetricLatency) 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 *unMarshalmetricLatency) 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 *marshalmetricLatency) 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 *unMarshalmetricLatency) 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 *metricLatency) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *metricLatency) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *metricLatency) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *metricLatency) Clone() (MetricLatency, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewMetricLatency() - 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 -} - -// MetricLatency is the container for latency metrics. -// The min/max/avg values are dependent on the type of latency measurement -// mode that is configured. -// The container will be empty if the latency has not been configured for -// the flow. -type MetricLatency interface { - Validation - // msg marshals MetricLatency to protobuf object *otg.MetricLatency - // and doesn't set defaults - msg() *otg.MetricLatency - // setMsg unmarshals MetricLatency from protobuf object *otg.MetricLatency - // and doesn't set defaults - setMsg(*otg.MetricLatency) MetricLatency - // provides marshal interface - Marshal() marshalMetricLatency - // provides unmarshal interface - Unmarshal() unMarshalMetricLatency - // validate validates MetricLatency - validate() error - // A stringer function - String() string - // Clones the object - Clone() (MetricLatency, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // MinimumNs returns float64, set in MetricLatency. - MinimumNs() float64 - // SetMinimumNs assigns float64 provided by user to MetricLatency - SetMinimumNs(value float64) MetricLatency - // HasMinimumNs checks if MinimumNs has been set in MetricLatency - HasMinimumNs() bool - // MaximumNs returns float64, set in MetricLatency. - MaximumNs() float64 - // SetMaximumNs assigns float64 provided by user to MetricLatency - SetMaximumNs(value float64) MetricLatency - // HasMaximumNs checks if MaximumNs has been set in MetricLatency - HasMaximumNs() bool - // AverageNs returns float64, set in MetricLatency. - AverageNs() float64 - // SetAverageNs assigns float64 provided by user to MetricLatency - SetAverageNs(value float64) MetricLatency - // HasAverageNs checks if AverageNs has been set in MetricLatency - HasAverageNs() bool -} - -// Minimum latency in nanoseconds -// MinimumNs returns a float64 -func (obj *metricLatency) MinimumNs() float64 { - - return *obj.obj.MinimumNs - -} - -// Minimum latency in nanoseconds -// MinimumNs returns a float64 -func (obj *metricLatency) HasMinimumNs() bool { - return obj.obj.MinimumNs != nil -} - -// Minimum latency in nanoseconds -// SetMinimumNs sets the float64 value in the MetricLatency object -func (obj *metricLatency) SetMinimumNs(value float64) MetricLatency { - - obj.obj.MinimumNs = &value - return obj -} - -// Maximum latency in nanoseconds -// MaximumNs returns a float64 -func (obj *metricLatency) MaximumNs() float64 { - - return *obj.obj.MaximumNs - -} - -// Maximum latency in nanoseconds -// MaximumNs returns a float64 -func (obj *metricLatency) HasMaximumNs() bool { - return obj.obj.MaximumNs != nil -} - -// Maximum latency in nanoseconds -// SetMaximumNs sets the float64 value in the MetricLatency object -func (obj *metricLatency) SetMaximumNs(value float64) MetricLatency { - - obj.obj.MaximumNs = &value - return obj -} - -// Average latency in nanoseconds -// AverageNs returns a float64 -func (obj *metricLatency) AverageNs() float64 { - - return *obj.obj.AverageNs - -} - -// Average latency in nanoseconds -// AverageNs returns a float64 -func (obj *metricLatency) HasAverageNs() bool { - return obj.obj.AverageNs != nil -} - -// Average latency in nanoseconds -// SetAverageNs sets the float64 value in the MetricLatency object -func (obj *metricLatency) SetAverageNs(value float64) MetricLatency { - - obj.obj.AverageNs = &value - return obj -} - -func (obj *metricLatency) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *metricLatency) setDefault() { - -} - -// ***** FlowTaggedMetric ***** -type flowTaggedMetric struct { - validation - obj *otg.FlowTaggedMetric - marshaller marshalFlowTaggedMetric - unMarshaller unMarshalFlowTaggedMetric - tagsHolder FlowTaggedMetricFlowMetricTagIter - timestampsHolder MetricTimestamp - latencyHolder MetricLatency -} - -func NewFlowTaggedMetric() FlowTaggedMetric { - obj := flowTaggedMetric{obj: &otg.FlowTaggedMetric{}} - obj.setDefault() - return &obj -} - -func (obj *flowTaggedMetric) msg() *otg.FlowTaggedMetric { - return obj.obj -} - -func (obj *flowTaggedMetric) setMsg(msg *otg.FlowTaggedMetric) FlowTaggedMetric { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowTaggedMetric struct { - obj *flowTaggedMetric -} - -type marshalFlowTaggedMetric interface { - // ToProto marshals FlowTaggedMetric to protobuf object *otg.FlowTaggedMetric - ToProto() (*otg.FlowTaggedMetric, error) - // ToPbText marshals FlowTaggedMetric to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowTaggedMetric to YAML text - ToYaml() (string, error) - // ToJson marshals FlowTaggedMetric to JSON text - ToJson() (string, error) -} - -type unMarshalflowTaggedMetric struct { - obj *flowTaggedMetric -} - -type unMarshalFlowTaggedMetric interface { - // FromProto unmarshals FlowTaggedMetric from protobuf object *otg.FlowTaggedMetric - FromProto(msg *otg.FlowTaggedMetric) (FlowTaggedMetric, error) - // FromPbText unmarshals FlowTaggedMetric from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowTaggedMetric from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowTaggedMetric from JSON text - FromJson(value string) error -} - -func (obj *flowTaggedMetric) Marshal() marshalFlowTaggedMetric { - if obj.marshaller == nil { - obj.marshaller = &marshalflowTaggedMetric{obj: obj} - } - return obj.marshaller -} - -func (obj *flowTaggedMetric) Unmarshal() unMarshalFlowTaggedMetric { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowTaggedMetric{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowTaggedMetric) ToProto() (*otg.FlowTaggedMetric, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowTaggedMetric) FromProto(msg *otg.FlowTaggedMetric) (FlowTaggedMetric, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowTaggedMetric) 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 *unMarshalflowTaggedMetric) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowTaggedMetric) 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 *unMarshalflowTaggedMetric) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowTaggedMetric) 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 *unMarshalflowTaggedMetric) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowTaggedMetric) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowTaggedMetric) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowTaggedMetric) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowTaggedMetric) Clone() (FlowTaggedMetric, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowTaggedMetric() - 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 -} - -func (obj *flowTaggedMetric) setNil() { - obj.tagsHolder = nil - obj.timestampsHolder = nil - obj.latencyHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowTaggedMetric is metrics for each set of values applicable for configured -// metric tags in ingress or egress packet header fields of corresponding flow. -// The container is keyed by list of tag-value pairs. -type FlowTaggedMetric interface { - Validation - // msg marshals FlowTaggedMetric to protobuf object *otg.FlowTaggedMetric - // and doesn't set defaults - msg() *otg.FlowTaggedMetric - // setMsg unmarshals FlowTaggedMetric from protobuf object *otg.FlowTaggedMetric - // and doesn't set defaults - setMsg(*otg.FlowTaggedMetric) FlowTaggedMetric - // provides marshal interface - Marshal() marshalFlowTaggedMetric - // provides unmarshal interface - Unmarshal() unMarshalFlowTaggedMetric - // validate validates FlowTaggedMetric - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowTaggedMetric, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Tags returns FlowTaggedMetricFlowMetricTagIterIter, set in FlowTaggedMetric - Tags() FlowTaggedMetricFlowMetricTagIter - // FramesTx returns uint64, set in FlowTaggedMetric. - FramesTx() uint64 - // SetFramesTx assigns uint64 provided by user to FlowTaggedMetric - SetFramesTx(value uint64) FlowTaggedMetric - // HasFramesTx checks if FramesTx has been set in FlowTaggedMetric - HasFramesTx() bool - // FramesRx returns uint64, set in FlowTaggedMetric. - FramesRx() uint64 - // SetFramesRx assigns uint64 provided by user to FlowTaggedMetric - SetFramesRx(value uint64) FlowTaggedMetric - // HasFramesRx checks if FramesRx has been set in FlowTaggedMetric - HasFramesRx() bool - // BytesTx returns uint64, set in FlowTaggedMetric. - BytesTx() uint64 - // SetBytesTx assigns uint64 provided by user to FlowTaggedMetric - SetBytesTx(value uint64) FlowTaggedMetric - // HasBytesTx checks if BytesTx has been set in FlowTaggedMetric - HasBytesTx() bool - // BytesRx returns uint64, set in FlowTaggedMetric. - BytesRx() uint64 - // SetBytesRx assigns uint64 provided by user to FlowTaggedMetric - SetBytesRx(value uint64) FlowTaggedMetric - // HasBytesRx checks if BytesRx has been set in FlowTaggedMetric - HasBytesRx() bool - // FramesTxRate returns float32, set in FlowTaggedMetric. - FramesTxRate() float32 - // SetFramesTxRate assigns float32 provided by user to FlowTaggedMetric - SetFramesTxRate(value float32) FlowTaggedMetric - // HasFramesTxRate checks if FramesTxRate has been set in FlowTaggedMetric - HasFramesTxRate() bool - // FramesRxRate returns float32, set in FlowTaggedMetric. - FramesRxRate() float32 - // SetFramesRxRate assigns float32 provided by user to FlowTaggedMetric - SetFramesRxRate(value float32) FlowTaggedMetric - // HasFramesRxRate checks if FramesRxRate has been set in FlowTaggedMetric - HasFramesRxRate() bool - // Loss returns float32, set in FlowTaggedMetric. - Loss() float32 - // SetLoss assigns float32 provided by user to FlowTaggedMetric - SetLoss(value float32) FlowTaggedMetric - // HasLoss checks if Loss has been set in FlowTaggedMetric - HasLoss() bool - // Timestamps returns MetricTimestamp, set in FlowTaggedMetric. - // MetricTimestamp is the container for timestamp metrics. - // The container will be empty if the timestamp has not been configured for - // the flow. - Timestamps() MetricTimestamp - // SetTimestamps assigns MetricTimestamp provided by user to FlowTaggedMetric. - // MetricTimestamp is the container for timestamp metrics. - // The container will be empty if the timestamp has not been configured for - // the flow. - SetTimestamps(value MetricTimestamp) FlowTaggedMetric - // HasTimestamps checks if Timestamps has been set in FlowTaggedMetric - HasTimestamps() bool - // Latency returns MetricLatency, set in FlowTaggedMetric. - // MetricLatency is the container for latency metrics. - // The min/max/avg values are dependent on the type of latency measurement - // mode that is configured. - // The container will be empty if the latency has not been configured for - // the flow. - Latency() MetricLatency - // SetLatency assigns MetricLatency provided by user to FlowTaggedMetric. - // MetricLatency is the container for latency metrics. - // The min/max/avg values are dependent on the type of latency measurement - // mode that is configured. - // The container will be empty if the latency has not been configured for - // the flow. - SetLatency(value MetricLatency) FlowTaggedMetric - // HasLatency checks if Latency has been set in FlowTaggedMetric - HasLatency() bool - setNil() -} - -// List of tag and value pairs -// Tags returns a []FlowMetricTag -func (obj *flowTaggedMetric) Tags() FlowTaggedMetricFlowMetricTagIter { - if len(obj.obj.Tags) == 0 { - obj.obj.Tags = []*otg.FlowMetricTag{} - } - if obj.tagsHolder == nil { - obj.tagsHolder = newFlowTaggedMetricFlowMetricTagIter(&obj.obj.Tags).setMsg(obj) - } - return obj.tagsHolder -} - -type flowTaggedMetricFlowMetricTagIter struct { - obj *flowTaggedMetric - flowMetricTagSlice []FlowMetricTag - fieldPtr *[]*otg.FlowMetricTag -} - -func newFlowTaggedMetricFlowMetricTagIter(ptr *[]*otg.FlowMetricTag) FlowTaggedMetricFlowMetricTagIter { - return &flowTaggedMetricFlowMetricTagIter{fieldPtr: ptr} -} - -type FlowTaggedMetricFlowMetricTagIter interface { - setMsg(*flowTaggedMetric) FlowTaggedMetricFlowMetricTagIter - Items() []FlowMetricTag - Add() FlowMetricTag - Append(items ...FlowMetricTag) FlowTaggedMetricFlowMetricTagIter - Set(index int, newObj FlowMetricTag) FlowTaggedMetricFlowMetricTagIter - Clear() FlowTaggedMetricFlowMetricTagIter - clearHolderSlice() FlowTaggedMetricFlowMetricTagIter - appendHolderSlice(item FlowMetricTag) FlowTaggedMetricFlowMetricTagIter -} - -func (obj *flowTaggedMetricFlowMetricTagIter) setMsg(msg *flowTaggedMetric) FlowTaggedMetricFlowMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flowMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *flowTaggedMetricFlowMetricTagIter) Items() []FlowMetricTag { - return obj.flowMetricTagSlice -} - -func (obj *flowTaggedMetricFlowMetricTagIter) Add() FlowMetricTag { - newObj := &otg.FlowMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flowMetricTag{obj: newObj} - newLibObj.setDefault() - obj.flowMetricTagSlice = append(obj.flowMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *flowTaggedMetricFlowMetricTagIter) Append(items ...FlowMetricTag) FlowTaggedMetricFlowMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowMetricTagSlice = append(obj.flowMetricTagSlice, item) - } - return obj -} - -func (obj *flowTaggedMetricFlowMetricTagIter) Set(index int, newObj FlowMetricTag) FlowTaggedMetricFlowMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowMetricTagSlice[index] = newObj - return obj -} -func (obj *flowTaggedMetricFlowMetricTagIter) Clear() FlowTaggedMetricFlowMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.FlowMetricTag{} - obj.flowMetricTagSlice = []FlowMetricTag{} - } - return obj -} -func (obj *flowTaggedMetricFlowMetricTagIter) clearHolderSlice() FlowTaggedMetricFlowMetricTagIter { - if len(obj.flowMetricTagSlice) > 0 { - obj.flowMetricTagSlice = []FlowMetricTag{} - } - return obj -} -func (obj *flowTaggedMetricFlowMetricTagIter) appendHolderSlice(item FlowMetricTag) FlowTaggedMetricFlowMetricTagIter { - obj.flowMetricTagSlice = append(obj.flowMetricTagSlice, item) - return obj -} - -// The current total number of frames transmitted -// FramesTx returns a uint64 -func (obj *flowTaggedMetric) FramesTx() uint64 { - - return *obj.obj.FramesTx - -} - -// The current total number of frames transmitted -// FramesTx returns a uint64 -func (obj *flowTaggedMetric) HasFramesTx() bool { - return obj.obj.FramesTx != nil -} - -// The current total number of frames transmitted -// SetFramesTx sets the uint64 value in the FlowTaggedMetric object -func (obj *flowTaggedMetric) SetFramesTx(value uint64) FlowTaggedMetric { - - obj.obj.FramesTx = &value - return obj -} - -// The current total number of valid frames received -// FramesRx returns a uint64 -func (obj *flowTaggedMetric) FramesRx() uint64 { - - return *obj.obj.FramesRx - -} - -// The current total number of valid frames received -// FramesRx returns a uint64 -func (obj *flowTaggedMetric) HasFramesRx() bool { - return obj.obj.FramesRx != nil -} - -// The current total number of valid frames received -// SetFramesRx sets the uint64 value in the FlowTaggedMetric object -func (obj *flowTaggedMetric) SetFramesRx(value uint64) FlowTaggedMetric { - - obj.obj.FramesRx = &value - return obj -} - -// The current total number of bytes transmitted -// BytesTx returns a uint64 -func (obj *flowTaggedMetric) BytesTx() uint64 { - - return *obj.obj.BytesTx - -} - -// The current total number of bytes transmitted -// BytesTx returns a uint64 -func (obj *flowTaggedMetric) HasBytesTx() bool { - return obj.obj.BytesTx != nil -} - -// The current total number of bytes transmitted -// SetBytesTx sets the uint64 value in the FlowTaggedMetric object -func (obj *flowTaggedMetric) SetBytesTx(value uint64) FlowTaggedMetric { - - obj.obj.BytesTx = &value - return obj -} - -// The current total number of bytes received -// BytesRx returns a uint64 -func (obj *flowTaggedMetric) BytesRx() uint64 { - - return *obj.obj.BytesRx - -} - -// The current total number of bytes received -// BytesRx returns a uint64 -func (obj *flowTaggedMetric) HasBytesRx() bool { - return obj.obj.BytesRx != nil -} - -// The current total number of bytes received -// SetBytesRx sets the uint64 value in the FlowTaggedMetric object -func (obj *flowTaggedMetric) SetBytesRx(value uint64) FlowTaggedMetric { - - obj.obj.BytesRx = &value - return obj -} - -// The current rate of frames transmitted -// FramesTxRate returns a float32 -func (obj *flowTaggedMetric) FramesTxRate() float32 { - - return *obj.obj.FramesTxRate - -} - -// The current rate of frames transmitted -// FramesTxRate returns a float32 -func (obj *flowTaggedMetric) HasFramesTxRate() bool { - return obj.obj.FramesTxRate != nil -} - -// The current rate of frames transmitted -// SetFramesTxRate sets the float32 value in the FlowTaggedMetric object -func (obj *flowTaggedMetric) SetFramesTxRate(value float32) FlowTaggedMetric { - - obj.obj.FramesTxRate = &value - return obj -} - -// The current rate of valid frames received -// FramesRxRate returns a float32 -func (obj *flowTaggedMetric) FramesRxRate() float32 { - - return *obj.obj.FramesRxRate - -} - -// The current rate of valid frames received -// FramesRxRate returns a float32 -func (obj *flowTaggedMetric) HasFramesRxRate() bool { - return obj.obj.FramesRxRate != nil -} - -// The current rate of valid frames received -// SetFramesRxRate sets the float32 value in the FlowTaggedMetric object -func (obj *flowTaggedMetric) SetFramesRxRate(value float32) FlowTaggedMetric { - - obj.obj.FramesRxRate = &value - return obj -} - -// The percentage of lost frames -// Loss returns a float32 -func (obj *flowTaggedMetric) Loss() float32 { - - return *obj.obj.Loss - -} - -// The percentage of lost frames -// Loss returns a float32 -func (obj *flowTaggedMetric) HasLoss() bool { - return obj.obj.Loss != nil -} - -// The percentage of lost frames -// SetLoss sets the float32 value in the FlowTaggedMetric object -func (obj *flowTaggedMetric) SetLoss(value float32) FlowTaggedMetric { - - obj.obj.Loss = &value - return obj -} - -// description is TBD -// Timestamps returns a MetricTimestamp -func (obj *flowTaggedMetric) Timestamps() MetricTimestamp { - if obj.obj.Timestamps == nil { - obj.obj.Timestamps = NewMetricTimestamp().msg() - } - if obj.timestampsHolder == nil { - obj.timestampsHolder = &metricTimestamp{obj: obj.obj.Timestamps} - } - return obj.timestampsHolder -} - -// description is TBD -// Timestamps returns a MetricTimestamp -func (obj *flowTaggedMetric) HasTimestamps() bool { - return obj.obj.Timestamps != nil -} - -// description is TBD -// SetTimestamps sets the MetricTimestamp value in the FlowTaggedMetric object -func (obj *flowTaggedMetric) SetTimestamps(value MetricTimestamp) FlowTaggedMetric { - - obj.timestampsHolder = nil - obj.obj.Timestamps = value.msg() - - return obj -} - -// description is TBD -// Latency returns a MetricLatency -func (obj *flowTaggedMetric) Latency() MetricLatency { - if obj.obj.Latency == nil { - obj.obj.Latency = NewMetricLatency().msg() - } - if obj.latencyHolder == nil { - obj.latencyHolder = &metricLatency{obj: obj.obj.Latency} - } - return obj.latencyHolder -} - -// description is TBD -// Latency returns a MetricLatency -func (obj *flowTaggedMetric) HasLatency() bool { - return obj.obj.Latency != nil -} - -// description is TBD -// SetLatency sets the MetricLatency value in the FlowTaggedMetric object -func (obj *flowTaggedMetric) SetLatency(value MetricLatency) FlowTaggedMetric { - - obj.latencyHolder = nil - obj.obj.Latency = value.msg() - - return obj -} - -func (obj *flowTaggedMetric) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Tags) != 0 { - - if set_default { - obj.Tags().clearHolderSlice() - for _, item := range obj.obj.Tags { - obj.Tags().appendHolderSlice(&flowMetricTag{obj: item}) - } - } - for _, item := range obj.Tags().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Timestamps != nil { - - obj.Timestamps().validateObj(vObj, set_default) - } - - if obj.obj.Latency != nil { - - obj.Latency().validateObj(vObj, set_default) - } - -} - -func (obj *flowTaggedMetric) setDefault() { - -} - -// ***** BgpPrefixIpv4UnicastState ***** -type bgpPrefixIpv4UnicastState struct { - validation - obj *otg.BgpPrefixIpv4UnicastState - marshaller marshalBgpPrefixIpv4UnicastState - unMarshaller unMarshalBgpPrefixIpv4UnicastState - communitiesHolder BgpPrefixIpv4UnicastStateResultBgpCommunityIter - extendedCommunitiesHolder BgpPrefixIpv4UnicastStateResultExtendedCommunityIter - asPathHolder ResultBgpAsPath -} - -func NewBgpPrefixIpv4UnicastState() BgpPrefixIpv4UnicastState { - obj := bgpPrefixIpv4UnicastState{obj: &otg.BgpPrefixIpv4UnicastState{}} - obj.setDefault() - return &obj -} - -func (obj *bgpPrefixIpv4UnicastState) msg() *otg.BgpPrefixIpv4UnicastState { - return obj.obj -} - -func (obj *bgpPrefixIpv4UnicastState) setMsg(msg *otg.BgpPrefixIpv4UnicastState) BgpPrefixIpv4UnicastState { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpPrefixIpv4UnicastState struct { - obj *bgpPrefixIpv4UnicastState -} - -type marshalBgpPrefixIpv4UnicastState interface { - // ToProto marshals BgpPrefixIpv4UnicastState to protobuf object *otg.BgpPrefixIpv4UnicastState - ToProto() (*otg.BgpPrefixIpv4UnicastState, error) - // ToPbText marshals BgpPrefixIpv4UnicastState to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpPrefixIpv4UnicastState to YAML text - ToYaml() (string, error) - // ToJson marshals BgpPrefixIpv4UnicastState to JSON text - ToJson() (string, error) -} - -type unMarshalbgpPrefixIpv4UnicastState struct { - obj *bgpPrefixIpv4UnicastState -} - -type unMarshalBgpPrefixIpv4UnicastState interface { - // FromProto unmarshals BgpPrefixIpv4UnicastState from protobuf object *otg.BgpPrefixIpv4UnicastState - FromProto(msg *otg.BgpPrefixIpv4UnicastState) (BgpPrefixIpv4UnicastState, error) - // FromPbText unmarshals BgpPrefixIpv4UnicastState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpPrefixIpv4UnicastState from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpPrefixIpv4UnicastState from JSON text - FromJson(value string) error -} - -func (obj *bgpPrefixIpv4UnicastState) Marshal() marshalBgpPrefixIpv4UnicastState { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpPrefixIpv4UnicastState{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpPrefixIpv4UnicastState) Unmarshal() unMarshalBgpPrefixIpv4UnicastState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpPrefixIpv4UnicastState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpPrefixIpv4UnicastState) ToProto() (*otg.BgpPrefixIpv4UnicastState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpPrefixIpv4UnicastState) FromProto(msg *otg.BgpPrefixIpv4UnicastState) (BgpPrefixIpv4UnicastState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpPrefixIpv4UnicastState) 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 *unMarshalbgpPrefixIpv4UnicastState) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpPrefixIpv4UnicastState) 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 *unMarshalbgpPrefixIpv4UnicastState) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpPrefixIpv4UnicastState) 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 *unMarshalbgpPrefixIpv4UnicastState) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpPrefixIpv4UnicastState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpPrefixIpv4UnicastState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpPrefixIpv4UnicastState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpPrefixIpv4UnicastState) Clone() (BgpPrefixIpv4UnicastState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpPrefixIpv4UnicastState() - 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 -} - -func (obj *bgpPrefixIpv4UnicastState) setNil() { - obj.communitiesHolder = nil - obj.extendedCommunitiesHolder = nil - obj.asPathHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpPrefixIpv4UnicastState is iPv4 unicast prefix. -type BgpPrefixIpv4UnicastState interface { - Validation - // msg marshals BgpPrefixIpv4UnicastState to protobuf object *otg.BgpPrefixIpv4UnicastState - // and doesn't set defaults - msg() *otg.BgpPrefixIpv4UnicastState - // setMsg unmarshals BgpPrefixIpv4UnicastState from protobuf object *otg.BgpPrefixIpv4UnicastState - // and doesn't set defaults - setMsg(*otg.BgpPrefixIpv4UnicastState) BgpPrefixIpv4UnicastState - // provides marshal interface - Marshal() marshalBgpPrefixIpv4UnicastState - // provides unmarshal interface - Unmarshal() unMarshalBgpPrefixIpv4UnicastState - // validate validates BgpPrefixIpv4UnicastState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpPrefixIpv4UnicastState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv4Address returns string, set in BgpPrefixIpv4UnicastState. - Ipv4Address() string - // SetIpv4Address assigns string provided by user to BgpPrefixIpv4UnicastState - SetIpv4Address(value string) BgpPrefixIpv4UnicastState - // HasIpv4Address checks if Ipv4Address has been set in BgpPrefixIpv4UnicastState - HasIpv4Address() bool - // PrefixLength returns uint32, set in BgpPrefixIpv4UnicastState. - PrefixLength() uint32 - // SetPrefixLength assigns uint32 provided by user to BgpPrefixIpv4UnicastState - SetPrefixLength(value uint32) BgpPrefixIpv4UnicastState - // HasPrefixLength checks if PrefixLength has been set in BgpPrefixIpv4UnicastState - HasPrefixLength() bool - // Origin returns BgpPrefixIpv4UnicastStateOriginEnum, set in BgpPrefixIpv4UnicastState - Origin() BgpPrefixIpv4UnicastStateOriginEnum - // SetOrigin assigns BgpPrefixIpv4UnicastStateOriginEnum provided by user to BgpPrefixIpv4UnicastState - SetOrigin(value BgpPrefixIpv4UnicastStateOriginEnum) BgpPrefixIpv4UnicastState - // HasOrigin checks if Origin has been set in BgpPrefixIpv4UnicastState - HasOrigin() bool - // PathId returns uint32, set in BgpPrefixIpv4UnicastState. - PathId() uint32 - // SetPathId assigns uint32 provided by user to BgpPrefixIpv4UnicastState - SetPathId(value uint32) BgpPrefixIpv4UnicastState - // HasPathId checks if PathId has been set in BgpPrefixIpv4UnicastState - HasPathId() bool - // Ipv4NextHop returns string, set in BgpPrefixIpv4UnicastState. - Ipv4NextHop() string - // SetIpv4NextHop assigns string provided by user to BgpPrefixIpv4UnicastState - SetIpv4NextHop(value string) BgpPrefixIpv4UnicastState - // HasIpv4NextHop checks if Ipv4NextHop has been set in BgpPrefixIpv4UnicastState - HasIpv4NextHop() bool - // Ipv6NextHop returns string, set in BgpPrefixIpv4UnicastState. - Ipv6NextHop() string - // SetIpv6NextHop assigns string provided by user to BgpPrefixIpv4UnicastState - SetIpv6NextHop(value string) BgpPrefixIpv4UnicastState - // HasIpv6NextHop checks if Ipv6NextHop has been set in BgpPrefixIpv4UnicastState - HasIpv6NextHop() bool - // Communities returns BgpPrefixIpv4UnicastStateResultBgpCommunityIterIter, set in BgpPrefixIpv4UnicastState - Communities() BgpPrefixIpv4UnicastStateResultBgpCommunityIter - // ExtendedCommunities returns BgpPrefixIpv4UnicastStateResultExtendedCommunityIterIter, set in BgpPrefixIpv4UnicastState - ExtendedCommunities() BgpPrefixIpv4UnicastStateResultExtendedCommunityIter - // AsPath returns ResultBgpAsPath, set in BgpPrefixIpv4UnicastState. - // ResultBgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. - AsPath() ResultBgpAsPath - // SetAsPath assigns ResultBgpAsPath provided by user to BgpPrefixIpv4UnicastState. - // ResultBgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. - SetAsPath(value ResultBgpAsPath) BgpPrefixIpv4UnicastState - // HasAsPath checks if AsPath has been set in BgpPrefixIpv4UnicastState - HasAsPath() bool - // LocalPreference returns uint32, set in BgpPrefixIpv4UnicastState. - LocalPreference() uint32 - // SetLocalPreference assigns uint32 provided by user to BgpPrefixIpv4UnicastState - SetLocalPreference(value uint32) BgpPrefixIpv4UnicastState - // HasLocalPreference checks if LocalPreference has been set in BgpPrefixIpv4UnicastState - HasLocalPreference() bool - // MultiExitDiscriminator returns uint32, set in BgpPrefixIpv4UnicastState. - MultiExitDiscriminator() uint32 - // SetMultiExitDiscriminator assigns uint32 provided by user to BgpPrefixIpv4UnicastState - SetMultiExitDiscriminator(value uint32) BgpPrefixIpv4UnicastState - // HasMultiExitDiscriminator checks if MultiExitDiscriminator has been set in BgpPrefixIpv4UnicastState - HasMultiExitDiscriminator() bool - setNil() -} - -// An IPv4 unicast address -// Ipv4Address returns a string -func (obj *bgpPrefixIpv4UnicastState) Ipv4Address() string { - - return *obj.obj.Ipv4Address - -} - -// An IPv4 unicast address -// Ipv4Address returns a string -func (obj *bgpPrefixIpv4UnicastState) HasIpv4Address() bool { - return obj.obj.Ipv4Address != nil -} - -// An IPv4 unicast address -// SetIpv4Address sets the string value in the BgpPrefixIpv4UnicastState object -func (obj *bgpPrefixIpv4UnicastState) SetIpv4Address(value string) BgpPrefixIpv4UnicastState { - - obj.obj.Ipv4Address = &value - return obj -} - -// The length of the prefix. -// PrefixLength returns a uint32 -func (obj *bgpPrefixIpv4UnicastState) PrefixLength() uint32 { - - return *obj.obj.PrefixLength - -} - -// The length of the prefix. -// PrefixLength returns a uint32 -func (obj *bgpPrefixIpv4UnicastState) HasPrefixLength() bool { - return obj.obj.PrefixLength != nil -} - -// The length of the prefix. -// SetPrefixLength sets the uint32 value in the BgpPrefixIpv4UnicastState object -func (obj *bgpPrefixIpv4UnicastState) SetPrefixLength(value uint32) BgpPrefixIpv4UnicastState { - - obj.obj.PrefixLength = &value - return obj -} - -type BgpPrefixIpv4UnicastStateOriginEnum string - -// Enum of Origin on BgpPrefixIpv4UnicastState -var BgpPrefixIpv4UnicastStateOrigin = struct { - IGP BgpPrefixIpv4UnicastStateOriginEnum - EGP BgpPrefixIpv4UnicastStateOriginEnum - INCOMPLETE BgpPrefixIpv4UnicastStateOriginEnum -}{ - IGP: BgpPrefixIpv4UnicastStateOriginEnum("igp"), - EGP: BgpPrefixIpv4UnicastStateOriginEnum("egp"), - INCOMPLETE: BgpPrefixIpv4UnicastStateOriginEnum("incomplete"), -} - -func (obj *bgpPrefixIpv4UnicastState) Origin() BgpPrefixIpv4UnicastStateOriginEnum { - return BgpPrefixIpv4UnicastStateOriginEnum(obj.obj.Origin.Enum().String()) -} - -// The origin of the prefix. -// Origin returns a string -func (obj *bgpPrefixIpv4UnicastState) HasOrigin() bool { - return obj.obj.Origin != nil -} - -func (obj *bgpPrefixIpv4UnicastState) SetOrigin(value BgpPrefixIpv4UnicastStateOriginEnum) BgpPrefixIpv4UnicastState { - intValue, ok := otg.BgpPrefixIpv4UnicastState_Origin_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpPrefixIpv4UnicastStateOriginEnum", string(value))) - return obj - } - enumValue := otg.BgpPrefixIpv4UnicastState_Origin_Enum(intValue) - obj.obj.Origin = &enumValue - - return obj -} - -// The path id. -// PathId returns a uint32 -func (obj *bgpPrefixIpv4UnicastState) PathId() uint32 { - - return *obj.obj.PathId - -} - -// The path id. -// PathId returns a uint32 -func (obj *bgpPrefixIpv4UnicastState) HasPathId() bool { - return obj.obj.PathId != nil -} - -// The path id. -// SetPathId sets the uint32 value in the BgpPrefixIpv4UnicastState object -func (obj *bgpPrefixIpv4UnicastState) SetPathId(value uint32) BgpPrefixIpv4UnicastState { - - obj.obj.PathId = &value - return obj -} - -// The IPv4 address of the egress interface. -// Ipv4NextHop returns a string -func (obj *bgpPrefixIpv4UnicastState) Ipv4NextHop() string { - - return *obj.obj.Ipv4NextHop - -} - -// The IPv4 address of the egress interface. -// Ipv4NextHop returns a string -func (obj *bgpPrefixIpv4UnicastState) HasIpv4NextHop() bool { - return obj.obj.Ipv4NextHop != nil -} - -// The IPv4 address of the egress interface. -// SetIpv4NextHop sets the string value in the BgpPrefixIpv4UnicastState object -func (obj *bgpPrefixIpv4UnicastState) SetIpv4NextHop(value string) BgpPrefixIpv4UnicastState { - - obj.obj.Ipv4NextHop = &value - return obj -} - -// The IPv6 address of the egress interface. -// Ipv6NextHop returns a string -func (obj *bgpPrefixIpv4UnicastState) Ipv6NextHop() string { - - return *obj.obj.Ipv6NextHop - -} - -// The IPv6 address of the egress interface. -// Ipv6NextHop returns a string -func (obj *bgpPrefixIpv4UnicastState) HasIpv6NextHop() bool { - return obj.obj.Ipv6NextHop != nil -} - -// The IPv6 address of the egress interface. -// SetIpv6NextHop sets the string value in the BgpPrefixIpv4UnicastState object -func (obj *bgpPrefixIpv4UnicastState) SetIpv6NextHop(value string) BgpPrefixIpv4UnicastState { - - obj.obj.Ipv6NextHop = &value - return obj -} - -// Optional community attributes. -// Communities returns a []ResultBgpCommunity -func (obj *bgpPrefixIpv4UnicastState) Communities() BgpPrefixIpv4UnicastStateResultBgpCommunityIter { - if len(obj.obj.Communities) == 0 { - obj.obj.Communities = []*otg.ResultBgpCommunity{} - } - if obj.communitiesHolder == nil { - obj.communitiesHolder = newBgpPrefixIpv4UnicastStateResultBgpCommunityIter(&obj.obj.Communities).setMsg(obj) - } - return obj.communitiesHolder -} - -type bgpPrefixIpv4UnicastStateResultBgpCommunityIter struct { - obj *bgpPrefixIpv4UnicastState - resultBgpCommunitySlice []ResultBgpCommunity - fieldPtr *[]*otg.ResultBgpCommunity -} - -func newBgpPrefixIpv4UnicastStateResultBgpCommunityIter(ptr *[]*otg.ResultBgpCommunity) BgpPrefixIpv4UnicastStateResultBgpCommunityIter { - return &bgpPrefixIpv4UnicastStateResultBgpCommunityIter{fieldPtr: ptr} -} - -type BgpPrefixIpv4UnicastStateResultBgpCommunityIter interface { - setMsg(*bgpPrefixIpv4UnicastState) BgpPrefixIpv4UnicastStateResultBgpCommunityIter - Items() []ResultBgpCommunity - Add() ResultBgpCommunity - Append(items ...ResultBgpCommunity) BgpPrefixIpv4UnicastStateResultBgpCommunityIter - Set(index int, newObj ResultBgpCommunity) BgpPrefixIpv4UnicastStateResultBgpCommunityIter - Clear() BgpPrefixIpv4UnicastStateResultBgpCommunityIter - clearHolderSlice() BgpPrefixIpv4UnicastStateResultBgpCommunityIter - appendHolderSlice(item ResultBgpCommunity) BgpPrefixIpv4UnicastStateResultBgpCommunityIter -} - -func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) setMsg(msg *bgpPrefixIpv4UnicastState) BgpPrefixIpv4UnicastStateResultBgpCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&resultBgpCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) Items() []ResultBgpCommunity { - return obj.resultBgpCommunitySlice -} - -func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) Add() ResultBgpCommunity { - newObj := &otg.ResultBgpCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &resultBgpCommunity{obj: newObj} - newLibObj.setDefault() - obj.resultBgpCommunitySlice = append(obj.resultBgpCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) Append(items ...ResultBgpCommunity) BgpPrefixIpv4UnicastStateResultBgpCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.resultBgpCommunitySlice = append(obj.resultBgpCommunitySlice, item) - } - return obj -} - -func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) Set(index int, newObj ResultBgpCommunity) BgpPrefixIpv4UnicastStateResultBgpCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.resultBgpCommunitySlice[index] = newObj - return obj -} -func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) Clear() BgpPrefixIpv4UnicastStateResultBgpCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.ResultBgpCommunity{} - obj.resultBgpCommunitySlice = []ResultBgpCommunity{} - } - return obj -} -func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) clearHolderSlice() BgpPrefixIpv4UnicastStateResultBgpCommunityIter { - if len(obj.resultBgpCommunitySlice) > 0 { - obj.resultBgpCommunitySlice = []ResultBgpCommunity{} - } - return obj -} -func (obj *bgpPrefixIpv4UnicastStateResultBgpCommunityIter) appendHolderSlice(item ResultBgpCommunity) BgpPrefixIpv4UnicastStateResultBgpCommunityIter { - obj.resultBgpCommunitySlice = append(obj.resultBgpCommunitySlice, item) - return obj -} - -// Optional received Extended Community attributes. Each received Extended Community attribute is available for retrieval in two forms. Support of the 'raw' format in which all 8 bytes (16 hex characters) is always present and available for use. In addition, if supported by the implementation, the Extended Community attribute may also be retrieved in the 'structured' format which is an optional field. -// ExtendedCommunities returns a []ResultExtendedCommunity -func (obj *bgpPrefixIpv4UnicastState) ExtendedCommunities() BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { - if len(obj.obj.ExtendedCommunities) == 0 { - obj.obj.ExtendedCommunities = []*otg.ResultExtendedCommunity{} - } - if obj.extendedCommunitiesHolder == nil { - obj.extendedCommunitiesHolder = newBgpPrefixIpv4UnicastStateResultExtendedCommunityIter(&obj.obj.ExtendedCommunities).setMsg(obj) - } - return obj.extendedCommunitiesHolder -} - -type bgpPrefixIpv4UnicastStateResultExtendedCommunityIter struct { - obj *bgpPrefixIpv4UnicastState - resultExtendedCommunitySlice []ResultExtendedCommunity - fieldPtr *[]*otg.ResultExtendedCommunity -} - -func newBgpPrefixIpv4UnicastStateResultExtendedCommunityIter(ptr *[]*otg.ResultExtendedCommunity) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { - return &bgpPrefixIpv4UnicastStateResultExtendedCommunityIter{fieldPtr: ptr} -} - -type BgpPrefixIpv4UnicastStateResultExtendedCommunityIter interface { - setMsg(*bgpPrefixIpv4UnicastState) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter - Items() []ResultExtendedCommunity - Add() ResultExtendedCommunity - Append(items ...ResultExtendedCommunity) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter - Set(index int, newObj ResultExtendedCommunity) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter - Clear() BgpPrefixIpv4UnicastStateResultExtendedCommunityIter - clearHolderSlice() BgpPrefixIpv4UnicastStateResultExtendedCommunityIter - appendHolderSlice(item ResultExtendedCommunity) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter -} - -func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) setMsg(msg *bgpPrefixIpv4UnicastState) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&resultExtendedCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) Items() []ResultExtendedCommunity { - return obj.resultExtendedCommunitySlice -} - -func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) Add() ResultExtendedCommunity { - newObj := &otg.ResultExtendedCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &resultExtendedCommunity{obj: newObj} - newLibObj.setDefault() - obj.resultExtendedCommunitySlice = append(obj.resultExtendedCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) Append(items ...ResultExtendedCommunity) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.resultExtendedCommunitySlice = append(obj.resultExtendedCommunitySlice, item) - } - return obj -} - -func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) Set(index int, newObj ResultExtendedCommunity) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.resultExtendedCommunitySlice[index] = newObj - return obj -} -func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) Clear() BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.ResultExtendedCommunity{} - obj.resultExtendedCommunitySlice = []ResultExtendedCommunity{} - } - return obj -} -func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) clearHolderSlice() BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { - if len(obj.resultExtendedCommunitySlice) > 0 { - obj.resultExtendedCommunitySlice = []ResultExtendedCommunity{} - } - return obj -} -func (obj *bgpPrefixIpv4UnicastStateResultExtendedCommunityIter) appendHolderSlice(item ResultExtendedCommunity) BgpPrefixIpv4UnicastStateResultExtendedCommunityIter { - obj.resultExtendedCommunitySlice = append(obj.resultExtendedCommunitySlice, item) - return obj -} - -// description is TBD -// AsPath returns a ResultBgpAsPath -func (obj *bgpPrefixIpv4UnicastState) AsPath() ResultBgpAsPath { - if obj.obj.AsPath == nil { - obj.obj.AsPath = NewResultBgpAsPath().msg() - } - if obj.asPathHolder == nil { - obj.asPathHolder = &resultBgpAsPath{obj: obj.obj.AsPath} - } - return obj.asPathHolder -} - -// description is TBD -// AsPath returns a ResultBgpAsPath -func (obj *bgpPrefixIpv4UnicastState) HasAsPath() bool { - return obj.obj.AsPath != nil -} - -// description is TBD -// SetAsPath sets the ResultBgpAsPath value in the BgpPrefixIpv4UnicastState object -func (obj *bgpPrefixIpv4UnicastState) SetAsPath(value ResultBgpAsPath) BgpPrefixIpv4UnicastState { - - obj.asPathHolder = nil - obj.obj.AsPath = value.msg() - - return obj -} - -// The local preference is a well-known attribute and the value is used for route selection. The route with the highest local preference value is preferred. -// LocalPreference returns a uint32 -func (obj *bgpPrefixIpv4UnicastState) LocalPreference() uint32 { - - return *obj.obj.LocalPreference - -} - -// The local preference is a well-known attribute and the value is used for route selection. The route with the highest local preference value is preferred. -// LocalPreference returns a uint32 -func (obj *bgpPrefixIpv4UnicastState) HasLocalPreference() bool { - return obj.obj.LocalPreference != nil -} - -// The local preference is a well-known attribute and the value is used for route selection. The route with the highest local preference value is preferred. -// SetLocalPreference sets the uint32 value in the BgpPrefixIpv4UnicastState object -func (obj *bgpPrefixIpv4UnicastState) SetLocalPreference(value uint32) BgpPrefixIpv4UnicastState { - - obj.obj.LocalPreference = &value - return obj -} - -// The multi exit discriminator (MED) is an optional non-transitive attribute and the value is used for route selection. The route with the lowest MED value is preferred. -// MultiExitDiscriminator returns a uint32 -func (obj *bgpPrefixIpv4UnicastState) MultiExitDiscriminator() uint32 { - - return *obj.obj.MultiExitDiscriminator - -} - -// The multi exit discriminator (MED) is an optional non-transitive attribute and the value is used for route selection. The route with the lowest MED value is preferred. -// MultiExitDiscriminator returns a uint32 -func (obj *bgpPrefixIpv4UnicastState) HasMultiExitDiscriminator() bool { - return obj.obj.MultiExitDiscriminator != nil -} - -// The multi exit discriminator (MED) is an optional non-transitive attribute and the value is used for route selection. The route with the lowest MED value is preferred. -// SetMultiExitDiscriminator sets the uint32 value in the BgpPrefixIpv4UnicastState object -func (obj *bgpPrefixIpv4UnicastState) SetMultiExitDiscriminator(value uint32) BgpPrefixIpv4UnicastState { - - obj.obj.MultiExitDiscriminator = &value - return obj -} - -func (obj *bgpPrefixIpv4UnicastState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.PrefixLength != nil { - - if *obj.obj.PrefixLength > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpPrefixIpv4UnicastState.PrefixLength <= 128 but Got %d", *obj.obj.PrefixLength)) - } - - } - - if obj.obj.Ipv4NextHop != nil { - - err := obj.validateIpv4(obj.Ipv4NextHop()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpPrefixIpv4UnicastState.Ipv4NextHop")) - } - - } - - if obj.obj.Ipv6NextHop != nil { - - err := obj.validateIpv6(obj.Ipv6NextHop()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpPrefixIpv4UnicastState.Ipv6NextHop")) - } - - } - - if len(obj.obj.Communities) != 0 { - - if set_default { - obj.Communities().clearHolderSlice() - for _, item := range obj.obj.Communities { - obj.Communities().appendHolderSlice(&resultBgpCommunity{obj: item}) - } - } - for _, item := range obj.Communities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.ExtendedCommunities) != 0 { - - if set_default { - obj.ExtendedCommunities().clearHolderSlice() - for _, item := range obj.obj.ExtendedCommunities { - obj.ExtendedCommunities().appendHolderSlice(&resultExtendedCommunity{obj: item}) - } - } - for _, item := range obj.ExtendedCommunities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.AsPath != nil { - - obj.AsPath().validateObj(vObj, set_default) - } - -} - -func (obj *bgpPrefixIpv4UnicastState) setDefault() { - -} - -// ***** BgpPrefixIpv6UnicastState ***** -type bgpPrefixIpv6UnicastState struct { - validation - obj *otg.BgpPrefixIpv6UnicastState - marshaller marshalBgpPrefixIpv6UnicastState - unMarshaller unMarshalBgpPrefixIpv6UnicastState - communitiesHolder BgpPrefixIpv6UnicastStateResultBgpCommunityIter - extendedCommunitiesHolder BgpPrefixIpv6UnicastStateResultExtendedCommunityIter - asPathHolder ResultBgpAsPath -} - -func NewBgpPrefixIpv6UnicastState() BgpPrefixIpv6UnicastState { - obj := bgpPrefixIpv6UnicastState{obj: &otg.BgpPrefixIpv6UnicastState{}} - obj.setDefault() - return &obj -} - -func (obj *bgpPrefixIpv6UnicastState) msg() *otg.BgpPrefixIpv6UnicastState { - return obj.obj -} - -func (obj *bgpPrefixIpv6UnicastState) setMsg(msg *otg.BgpPrefixIpv6UnicastState) BgpPrefixIpv6UnicastState { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpPrefixIpv6UnicastState struct { - obj *bgpPrefixIpv6UnicastState -} - -type marshalBgpPrefixIpv6UnicastState interface { - // ToProto marshals BgpPrefixIpv6UnicastState to protobuf object *otg.BgpPrefixIpv6UnicastState - ToProto() (*otg.BgpPrefixIpv6UnicastState, error) - // ToPbText marshals BgpPrefixIpv6UnicastState to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpPrefixIpv6UnicastState to YAML text - ToYaml() (string, error) - // ToJson marshals BgpPrefixIpv6UnicastState to JSON text - ToJson() (string, error) -} - -type unMarshalbgpPrefixIpv6UnicastState struct { - obj *bgpPrefixIpv6UnicastState -} - -type unMarshalBgpPrefixIpv6UnicastState interface { - // FromProto unmarshals BgpPrefixIpv6UnicastState from protobuf object *otg.BgpPrefixIpv6UnicastState - FromProto(msg *otg.BgpPrefixIpv6UnicastState) (BgpPrefixIpv6UnicastState, error) - // FromPbText unmarshals BgpPrefixIpv6UnicastState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpPrefixIpv6UnicastState from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpPrefixIpv6UnicastState from JSON text - FromJson(value string) error -} - -func (obj *bgpPrefixIpv6UnicastState) Marshal() marshalBgpPrefixIpv6UnicastState { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpPrefixIpv6UnicastState{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpPrefixIpv6UnicastState) Unmarshal() unMarshalBgpPrefixIpv6UnicastState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpPrefixIpv6UnicastState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpPrefixIpv6UnicastState) ToProto() (*otg.BgpPrefixIpv6UnicastState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpPrefixIpv6UnicastState) FromProto(msg *otg.BgpPrefixIpv6UnicastState) (BgpPrefixIpv6UnicastState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpPrefixIpv6UnicastState) 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 *unMarshalbgpPrefixIpv6UnicastState) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpPrefixIpv6UnicastState) 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 *unMarshalbgpPrefixIpv6UnicastState) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpPrefixIpv6UnicastState) 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 *unMarshalbgpPrefixIpv6UnicastState) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpPrefixIpv6UnicastState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpPrefixIpv6UnicastState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpPrefixIpv6UnicastState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpPrefixIpv6UnicastState) Clone() (BgpPrefixIpv6UnicastState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpPrefixIpv6UnicastState() - 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 -} - -func (obj *bgpPrefixIpv6UnicastState) setNil() { - obj.communitiesHolder = nil - obj.extendedCommunitiesHolder = nil - obj.asPathHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpPrefixIpv6UnicastState is iPv6 unicast prefix. -type BgpPrefixIpv6UnicastState interface { - Validation - // msg marshals BgpPrefixIpv6UnicastState to protobuf object *otg.BgpPrefixIpv6UnicastState - // and doesn't set defaults - msg() *otg.BgpPrefixIpv6UnicastState - // setMsg unmarshals BgpPrefixIpv6UnicastState from protobuf object *otg.BgpPrefixIpv6UnicastState - // and doesn't set defaults - setMsg(*otg.BgpPrefixIpv6UnicastState) BgpPrefixIpv6UnicastState - // provides marshal interface - Marshal() marshalBgpPrefixIpv6UnicastState - // provides unmarshal interface - Unmarshal() unMarshalBgpPrefixIpv6UnicastState - // validate validates BgpPrefixIpv6UnicastState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpPrefixIpv6UnicastState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv6Address returns string, set in BgpPrefixIpv6UnicastState. - Ipv6Address() string - // SetIpv6Address assigns string provided by user to BgpPrefixIpv6UnicastState - SetIpv6Address(value string) BgpPrefixIpv6UnicastState - // HasIpv6Address checks if Ipv6Address has been set in BgpPrefixIpv6UnicastState - HasIpv6Address() bool - // PrefixLength returns uint32, set in BgpPrefixIpv6UnicastState. - PrefixLength() uint32 - // SetPrefixLength assigns uint32 provided by user to BgpPrefixIpv6UnicastState - SetPrefixLength(value uint32) BgpPrefixIpv6UnicastState - // HasPrefixLength checks if PrefixLength has been set in BgpPrefixIpv6UnicastState - HasPrefixLength() bool - // Origin returns BgpPrefixIpv6UnicastStateOriginEnum, set in BgpPrefixIpv6UnicastState - Origin() BgpPrefixIpv6UnicastStateOriginEnum - // SetOrigin assigns BgpPrefixIpv6UnicastStateOriginEnum provided by user to BgpPrefixIpv6UnicastState - SetOrigin(value BgpPrefixIpv6UnicastStateOriginEnum) BgpPrefixIpv6UnicastState - // HasOrigin checks if Origin has been set in BgpPrefixIpv6UnicastState - HasOrigin() bool - // PathId returns uint32, set in BgpPrefixIpv6UnicastState. - PathId() uint32 - // SetPathId assigns uint32 provided by user to BgpPrefixIpv6UnicastState - SetPathId(value uint32) BgpPrefixIpv6UnicastState - // HasPathId checks if PathId has been set in BgpPrefixIpv6UnicastState - HasPathId() bool - // Ipv4NextHop returns string, set in BgpPrefixIpv6UnicastState. - Ipv4NextHop() string - // SetIpv4NextHop assigns string provided by user to BgpPrefixIpv6UnicastState - SetIpv4NextHop(value string) BgpPrefixIpv6UnicastState - // HasIpv4NextHop checks if Ipv4NextHop has been set in BgpPrefixIpv6UnicastState - HasIpv4NextHop() bool - // Ipv6NextHop returns string, set in BgpPrefixIpv6UnicastState. - Ipv6NextHop() string - // SetIpv6NextHop assigns string provided by user to BgpPrefixIpv6UnicastState - SetIpv6NextHop(value string) BgpPrefixIpv6UnicastState - // HasIpv6NextHop checks if Ipv6NextHop has been set in BgpPrefixIpv6UnicastState - HasIpv6NextHop() bool - // Communities returns BgpPrefixIpv6UnicastStateResultBgpCommunityIterIter, set in BgpPrefixIpv6UnicastState - Communities() BgpPrefixIpv6UnicastStateResultBgpCommunityIter - // ExtendedCommunities returns BgpPrefixIpv6UnicastStateResultExtendedCommunityIterIter, set in BgpPrefixIpv6UnicastState - ExtendedCommunities() BgpPrefixIpv6UnicastStateResultExtendedCommunityIter - // AsPath returns ResultBgpAsPath, set in BgpPrefixIpv6UnicastState. - // ResultBgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. - AsPath() ResultBgpAsPath - // SetAsPath assigns ResultBgpAsPath provided by user to BgpPrefixIpv6UnicastState. - // ResultBgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. - SetAsPath(value ResultBgpAsPath) BgpPrefixIpv6UnicastState - // HasAsPath checks if AsPath has been set in BgpPrefixIpv6UnicastState - HasAsPath() bool - // LocalPreference returns uint32, set in BgpPrefixIpv6UnicastState. - LocalPreference() uint32 - // SetLocalPreference assigns uint32 provided by user to BgpPrefixIpv6UnicastState - SetLocalPreference(value uint32) BgpPrefixIpv6UnicastState - // HasLocalPreference checks if LocalPreference has been set in BgpPrefixIpv6UnicastState - HasLocalPreference() bool - // MultiExitDiscriminator returns uint32, set in BgpPrefixIpv6UnicastState. - MultiExitDiscriminator() uint32 - // SetMultiExitDiscriminator assigns uint32 provided by user to BgpPrefixIpv6UnicastState - SetMultiExitDiscriminator(value uint32) BgpPrefixIpv6UnicastState - // HasMultiExitDiscriminator checks if MultiExitDiscriminator has been set in BgpPrefixIpv6UnicastState - HasMultiExitDiscriminator() bool - setNil() -} - -// An IPv6 unicast address -// Ipv6Address returns a string -func (obj *bgpPrefixIpv6UnicastState) Ipv6Address() string { - - return *obj.obj.Ipv6Address - -} - -// An IPv6 unicast address -// Ipv6Address returns a string -func (obj *bgpPrefixIpv6UnicastState) HasIpv6Address() bool { - return obj.obj.Ipv6Address != nil -} - -// An IPv6 unicast address -// SetIpv6Address sets the string value in the BgpPrefixIpv6UnicastState object -func (obj *bgpPrefixIpv6UnicastState) SetIpv6Address(value string) BgpPrefixIpv6UnicastState { - - obj.obj.Ipv6Address = &value - return obj -} - -// The length of the prefix. -// PrefixLength returns a uint32 -func (obj *bgpPrefixIpv6UnicastState) PrefixLength() uint32 { - - return *obj.obj.PrefixLength - -} - -// The length of the prefix. -// PrefixLength returns a uint32 -func (obj *bgpPrefixIpv6UnicastState) HasPrefixLength() bool { - return obj.obj.PrefixLength != nil -} - -// The length of the prefix. -// SetPrefixLength sets the uint32 value in the BgpPrefixIpv6UnicastState object -func (obj *bgpPrefixIpv6UnicastState) SetPrefixLength(value uint32) BgpPrefixIpv6UnicastState { - - obj.obj.PrefixLength = &value - return obj -} - -type BgpPrefixIpv6UnicastStateOriginEnum string - -// Enum of Origin on BgpPrefixIpv6UnicastState -var BgpPrefixIpv6UnicastStateOrigin = struct { - IGP BgpPrefixIpv6UnicastStateOriginEnum - EGP BgpPrefixIpv6UnicastStateOriginEnum - INCOMPLETE BgpPrefixIpv6UnicastStateOriginEnum -}{ - IGP: BgpPrefixIpv6UnicastStateOriginEnum("igp"), - EGP: BgpPrefixIpv6UnicastStateOriginEnum("egp"), - INCOMPLETE: BgpPrefixIpv6UnicastStateOriginEnum("incomplete"), -} - -func (obj *bgpPrefixIpv6UnicastState) Origin() BgpPrefixIpv6UnicastStateOriginEnum { - return BgpPrefixIpv6UnicastStateOriginEnum(obj.obj.Origin.Enum().String()) -} - -// The origin of the prefix. -// Origin returns a string -func (obj *bgpPrefixIpv6UnicastState) HasOrigin() bool { - return obj.obj.Origin != nil -} - -func (obj *bgpPrefixIpv6UnicastState) SetOrigin(value BgpPrefixIpv6UnicastStateOriginEnum) BgpPrefixIpv6UnicastState { - intValue, ok := otg.BgpPrefixIpv6UnicastState_Origin_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpPrefixIpv6UnicastStateOriginEnum", string(value))) - return obj - } - enumValue := otg.BgpPrefixIpv6UnicastState_Origin_Enum(intValue) - obj.obj.Origin = &enumValue - - return obj -} - -// The path id. -// PathId returns a uint32 -func (obj *bgpPrefixIpv6UnicastState) PathId() uint32 { - - return *obj.obj.PathId - -} - -// The path id. -// PathId returns a uint32 -func (obj *bgpPrefixIpv6UnicastState) HasPathId() bool { - return obj.obj.PathId != nil -} - -// The path id. -// SetPathId sets the uint32 value in the BgpPrefixIpv6UnicastState object -func (obj *bgpPrefixIpv6UnicastState) SetPathId(value uint32) BgpPrefixIpv6UnicastState { - - obj.obj.PathId = &value - return obj -} - -// The IPv4 address of the egress interface. -// Ipv4NextHop returns a string -func (obj *bgpPrefixIpv6UnicastState) Ipv4NextHop() string { - - return *obj.obj.Ipv4NextHop - -} - -// The IPv4 address of the egress interface. -// Ipv4NextHop returns a string -func (obj *bgpPrefixIpv6UnicastState) HasIpv4NextHop() bool { - return obj.obj.Ipv4NextHop != nil -} - -// The IPv4 address of the egress interface. -// SetIpv4NextHop sets the string value in the BgpPrefixIpv6UnicastState object -func (obj *bgpPrefixIpv6UnicastState) SetIpv4NextHop(value string) BgpPrefixIpv6UnicastState { - - obj.obj.Ipv4NextHop = &value - return obj -} - -// The IPv6 address of the egress interface. -// Ipv6NextHop returns a string -func (obj *bgpPrefixIpv6UnicastState) Ipv6NextHop() string { - - return *obj.obj.Ipv6NextHop - -} - -// The IPv6 address of the egress interface. -// Ipv6NextHop returns a string -func (obj *bgpPrefixIpv6UnicastState) HasIpv6NextHop() bool { - return obj.obj.Ipv6NextHop != nil -} - -// The IPv6 address of the egress interface. -// SetIpv6NextHop sets the string value in the BgpPrefixIpv6UnicastState object -func (obj *bgpPrefixIpv6UnicastState) SetIpv6NextHop(value string) BgpPrefixIpv6UnicastState { - - obj.obj.Ipv6NextHop = &value - return obj -} - -// Optional community attributes. -// Communities returns a []ResultBgpCommunity -func (obj *bgpPrefixIpv6UnicastState) Communities() BgpPrefixIpv6UnicastStateResultBgpCommunityIter { - if len(obj.obj.Communities) == 0 { - obj.obj.Communities = []*otg.ResultBgpCommunity{} - } - if obj.communitiesHolder == nil { - obj.communitiesHolder = newBgpPrefixIpv6UnicastStateResultBgpCommunityIter(&obj.obj.Communities).setMsg(obj) - } - return obj.communitiesHolder -} - -type bgpPrefixIpv6UnicastStateResultBgpCommunityIter struct { - obj *bgpPrefixIpv6UnicastState - resultBgpCommunitySlice []ResultBgpCommunity - fieldPtr *[]*otg.ResultBgpCommunity -} - -func newBgpPrefixIpv6UnicastStateResultBgpCommunityIter(ptr *[]*otg.ResultBgpCommunity) BgpPrefixIpv6UnicastStateResultBgpCommunityIter { - return &bgpPrefixIpv6UnicastStateResultBgpCommunityIter{fieldPtr: ptr} -} - -type BgpPrefixIpv6UnicastStateResultBgpCommunityIter interface { - setMsg(*bgpPrefixIpv6UnicastState) BgpPrefixIpv6UnicastStateResultBgpCommunityIter - Items() []ResultBgpCommunity - Add() ResultBgpCommunity - Append(items ...ResultBgpCommunity) BgpPrefixIpv6UnicastStateResultBgpCommunityIter - Set(index int, newObj ResultBgpCommunity) BgpPrefixIpv6UnicastStateResultBgpCommunityIter - Clear() BgpPrefixIpv6UnicastStateResultBgpCommunityIter - clearHolderSlice() BgpPrefixIpv6UnicastStateResultBgpCommunityIter - appendHolderSlice(item ResultBgpCommunity) BgpPrefixIpv6UnicastStateResultBgpCommunityIter -} - -func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) setMsg(msg *bgpPrefixIpv6UnicastState) BgpPrefixIpv6UnicastStateResultBgpCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&resultBgpCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) Items() []ResultBgpCommunity { - return obj.resultBgpCommunitySlice -} - -func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) Add() ResultBgpCommunity { - newObj := &otg.ResultBgpCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &resultBgpCommunity{obj: newObj} - newLibObj.setDefault() - obj.resultBgpCommunitySlice = append(obj.resultBgpCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) Append(items ...ResultBgpCommunity) BgpPrefixIpv6UnicastStateResultBgpCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.resultBgpCommunitySlice = append(obj.resultBgpCommunitySlice, item) - } - return obj -} - -func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) Set(index int, newObj ResultBgpCommunity) BgpPrefixIpv6UnicastStateResultBgpCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.resultBgpCommunitySlice[index] = newObj - return obj -} -func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) Clear() BgpPrefixIpv6UnicastStateResultBgpCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.ResultBgpCommunity{} - obj.resultBgpCommunitySlice = []ResultBgpCommunity{} - } - return obj -} -func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) clearHolderSlice() BgpPrefixIpv6UnicastStateResultBgpCommunityIter { - if len(obj.resultBgpCommunitySlice) > 0 { - obj.resultBgpCommunitySlice = []ResultBgpCommunity{} - } - return obj -} -func (obj *bgpPrefixIpv6UnicastStateResultBgpCommunityIter) appendHolderSlice(item ResultBgpCommunity) BgpPrefixIpv6UnicastStateResultBgpCommunityIter { - obj.resultBgpCommunitySlice = append(obj.resultBgpCommunitySlice, item) - return obj -} - -// Optional received Extended Community attributes. Each received Extended Community attribute is available for retrieval in two forms. Support of the 'raw' format in which all 8 bytes (16 hex characters) is always present and available for use. In addition, if supported by the implementation, the Extended Community attribute may also be retrieved in the 'structured' format which is an optional field. -// ExtendedCommunities returns a []ResultExtendedCommunity -func (obj *bgpPrefixIpv6UnicastState) ExtendedCommunities() BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { - if len(obj.obj.ExtendedCommunities) == 0 { - obj.obj.ExtendedCommunities = []*otg.ResultExtendedCommunity{} - } - if obj.extendedCommunitiesHolder == nil { - obj.extendedCommunitiesHolder = newBgpPrefixIpv6UnicastStateResultExtendedCommunityIter(&obj.obj.ExtendedCommunities).setMsg(obj) - } - return obj.extendedCommunitiesHolder -} - -type bgpPrefixIpv6UnicastStateResultExtendedCommunityIter struct { - obj *bgpPrefixIpv6UnicastState - resultExtendedCommunitySlice []ResultExtendedCommunity - fieldPtr *[]*otg.ResultExtendedCommunity -} - -func newBgpPrefixIpv6UnicastStateResultExtendedCommunityIter(ptr *[]*otg.ResultExtendedCommunity) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { - return &bgpPrefixIpv6UnicastStateResultExtendedCommunityIter{fieldPtr: ptr} -} - -type BgpPrefixIpv6UnicastStateResultExtendedCommunityIter interface { - setMsg(*bgpPrefixIpv6UnicastState) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter - Items() []ResultExtendedCommunity - Add() ResultExtendedCommunity - Append(items ...ResultExtendedCommunity) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter - Set(index int, newObj ResultExtendedCommunity) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter - Clear() BgpPrefixIpv6UnicastStateResultExtendedCommunityIter - clearHolderSlice() BgpPrefixIpv6UnicastStateResultExtendedCommunityIter - appendHolderSlice(item ResultExtendedCommunity) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter -} - -func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) setMsg(msg *bgpPrefixIpv6UnicastState) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&resultExtendedCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) Items() []ResultExtendedCommunity { - return obj.resultExtendedCommunitySlice -} - -func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) Add() ResultExtendedCommunity { - newObj := &otg.ResultExtendedCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &resultExtendedCommunity{obj: newObj} - newLibObj.setDefault() - obj.resultExtendedCommunitySlice = append(obj.resultExtendedCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) Append(items ...ResultExtendedCommunity) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.resultExtendedCommunitySlice = append(obj.resultExtendedCommunitySlice, item) - } - return obj -} - -func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) Set(index int, newObj ResultExtendedCommunity) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.resultExtendedCommunitySlice[index] = newObj - return obj -} -func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) Clear() BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.ResultExtendedCommunity{} - obj.resultExtendedCommunitySlice = []ResultExtendedCommunity{} - } - return obj -} -func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) clearHolderSlice() BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { - if len(obj.resultExtendedCommunitySlice) > 0 { - obj.resultExtendedCommunitySlice = []ResultExtendedCommunity{} - } - return obj -} -func (obj *bgpPrefixIpv6UnicastStateResultExtendedCommunityIter) appendHolderSlice(item ResultExtendedCommunity) BgpPrefixIpv6UnicastStateResultExtendedCommunityIter { - obj.resultExtendedCommunitySlice = append(obj.resultExtendedCommunitySlice, item) - return obj -} - -// description is TBD -// AsPath returns a ResultBgpAsPath -func (obj *bgpPrefixIpv6UnicastState) AsPath() ResultBgpAsPath { - if obj.obj.AsPath == nil { - obj.obj.AsPath = NewResultBgpAsPath().msg() - } - if obj.asPathHolder == nil { - obj.asPathHolder = &resultBgpAsPath{obj: obj.obj.AsPath} - } - return obj.asPathHolder -} - -// description is TBD -// AsPath returns a ResultBgpAsPath -func (obj *bgpPrefixIpv6UnicastState) HasAsPath() bool { - return obj.obj.AsPath != nil -} - -// description is TBD -// SetAsPath sets the ResultBgpAsPath value in the BgpPrefixIpv6UnicastState object -func (obj *bgpPrefixIpv6UnicastState) SetAsPath(value ResultBgpAsPath) BgpPrefixIpv6UnicastState { - - obj.asPathHolder = nil - obj.obj.AsPath = value.msg() - - return obj -} - -// The local preference is a well-known attribute and the value is used for route selection. The route with the highest local preference value is preferred. -// LocalPreference returns a uint32 -func (obj *bgpPrefixIpv6UnicastState) LocalPreference() uint32 { - - return *obj.obj.LocalPreference - -} - -// The local preference is a well-known attribute and the value is used for route selection. The route with the highest local preference value is preferred. -// LocalPreference returns a uint32 -func (obj *bgpPrefixIpv6UnicastState) HasLocalPreference() bool { - return obj.obj.LocalPreference != nil -} - -// The local preference is a well-known attribute and the value is used for route selection. The route with the highest local preference value is preferred. -// SetLocalPreference sets the uint32 value in the BgpPrefixIpv6UnicastState object -func (obj *bgpPrefixIpv6UnicastState) SetLocalPreference(value uint32) BgpPrefixIpv6UnicastState { - - obj.obj.LocalPreference = &value - return obj -} - -// The multi exit discriminator (MED) is an optional non-transitive attribute and the value is used for route selection. The route with the lowest MED value is preferred. -// MultiExitDiscriminator returns a uint32 -func (obj *bgpPrefixIpv6UnicastState) MultiExitDiscriminator() uint32 { - - return *obj.obj.MultiExitDiscriminator - -} - -// The multi exit discriminator (MED) is an optional non-transitive attribute and the value is used for route selection. The route with the lowest MED value is preferred. -// MultiExitDiscriminator returns a uint32 -func (obj *bgpPrefixIpv6UnicastState) HasMultiExitDiscriminator() bool { - return obj.obj.MultiExitDiscriminator != nil -} - -// The multi exit discriminator (MED) is an optional non-transitive attribute and the value is used for route selection. The route with the lowest MED value is preferred. -// SetMultiExitDiscriminator sets the uint32 value in the BgpPrefixIpv6UnicastState object -func (obj *bgpPrefixIpv6UnicastState) SetMultiExitDiscriminator(value uint32) BgpPrefixIpv6UnicastState { - - obj.obj.MultiExitDiscriminator = &value - return obj -} - -func (obj *bgpPrefixIpv6UnicastState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.PrefixLength != nil { - - if *obj.obj.PrefixLength > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpPrefixIpv6UnicastState.PrefixLength <= 128 but Got %d", *obj.obj.PrefixLength)) - } - - } - - if obj.obj.Ipv4NextHop != nil { - - err := obj.validateIpv4(obj.Ipv4NextHop()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpPrefixIpv6UnicastState.Ipv4NextHop")) - } - - } - - if obj.obj.Ipv6NextHop != nil { - - err := obj.validateIpv6(obj.Ipv6NextHop()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpPrefixIpv6UnicastState.Ipv6NextHop")) - } - - } - - if len(obj.obj.Communities) != 0 { - - if set_default { - obj.Communities().clearHolderSlice() - for _, item := range obj.obj.Communities { - obj.Communities().appendHolderSlice(&resultBgpCommunity{obj: item}) - } - } - for _, item := range obj.Communities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.ExtendedCommunities) != 0 { - - if set_default { - obj.ExtendedCommunities().clearHolderSlice() - for _, item := range obj.obj.ExtendedCommunities { - obj.ExtendedCommunities().appendHolderSlice(&resultExtendedCommunity{obj: item}) - } - } - for _, item := range obj.ExtendedCommunities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.AsPath != nil { - - obj.AsPath().validateObj(vObj, set_default) - } - -} - -func (obj *bgpPrefixIpv6UnicastState) setDefault() { - -} - -// ***** IsisLspState ***** -type isisLspState struct { - validation - obj *otg.IsisLspState - marshaller marshalIsisLspState - unMarshaller unMarshalIsisLspState - flagsHolder IsisLspFlags - tlvsHolder IsisLspTlvs -} - -func NewIsisLspState() IsisLspState { - obj := isisLspState{obj: &otg.IsisLspState{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspState) msg() *otg.IsisLspState { - return obj.obj -} - -func (obj *isisLspState) setMsg(msg *otg.IsisLspState) IsisLspState { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspState struct { - obj *isisLspState -} - -type marshalIsisLspState interface { - // ToProto marshals IsisLspState to protobuf object *otg.IsisLspState - ToProto() (*otg.IsisLspState, error) - // ToPbText marshals IsisLspState to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspState to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspState to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspState struct { - obj *isisLspState -} - -type unMarshalIsisLspState interface { - // FromProto unmarshals IsisLspState from protobuf object *otg.IsisLspState - FromProto(msg *otg.IsisLspState) (IsisLspState, error) - // FromPbText unmarshals IsisLspState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspState from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspState from JSON text - FromJson(value string) error -} - -func (obj *isisLspState) Marshal() marshalIsisLspState { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspState{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspState) Unmarshal() unMarshalIsisLspState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspState) ToProto() (*otg.IsisLspState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspState) FromProto(msg *otg.IsisLspState) (IsisLspState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspState) 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 *unMarshalisisLspState) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisLspState) 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 *unMarshalisisLspState) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisLspState) 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 *unMarshalisisLspState) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisLspState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspState) Clone() (IsisLspState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspState() - 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 -} - -func (obj *isisLspState) setNil() { - obj.flagsHolder = nil - obj.tlvsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisLspState is iSIS LSP. -type IsisLspState interface { - Validation - // msg marshals IsisLspState to protobuf object *otg.IsisLspState - // and doesn't set defaults - msg() *otg.IsisLspState - // setMsg unmarshals IsisLspState from protobuf object *otg.IsisLspState - // and doesn't set defaults - setMsg(*otg.IsisLspState) IsisLspState - // provides marshal interface - Marshal() marshalIsisLspState - // provides unmarshal interface - Unmarshal() unMarshalIsisLspState - // validate validates IsisLspState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // LspId returns string, set in IsisLspState. - LspId() string - // SetLspId assigns string provided by user to IsisLspState - SetLspId(value string) IsisLspState - // PduType returns IsisLspStatePduTypeEnum, set in IsisLspState - PduType() IsisLspStatePduTypeEnum - // SetPduType assigns IsisLspStatePduTypeEnum provided by user to IsisLspState - SetPduType(value IsisLspStatePduTypeEnum) IsisLspState - // HasPduType checks if PduType has been set in IsisLspState - HasPduType() bool - // RemainingLifetime returns uint32, set in IsisLspState. - RemainingLifetime() uint32 - // SetRemainingLifetime assigns uint32 provided by user to IsisLspState - SetRemainingLifetime(value uint32) IsisLspState - // HasRemainingLifetime checks if RemainingLifetime has been set in IsisLspState - HasRemainingLifetime() bool - // SequenceNumber returns uint64, set in IsisLspState. - SequenceNumber() uint64 - // SetSequenceNumber assigns uint64 provided by user to IsisLspState - SetSequenceNumber(value uint64) IsisLspState - // HasSequenceNumber checks if SequenceNumber has been set in IsisLspState - HasSequenceNumber() bool - // PduLength returns uint32, set in IsisLspState. - PduLength() uint32 - // SetPduLength assigns uint32 provided by user to IsisLspState - SetPduLength(value uint32) IsisLspState - // HasPduLength checks if PduLength has been set in IsisLspState - HasPduLength() bool - // Flags returns IsisLspFlags, set in IsisLspState. - // IsisLspFlags is lSP Type flags. - Flags() IsisLspFlags - // SetFlags assigns IsisLspFlags provided by user to IsisLspState. - // IsisLspFlags is lSP Type flags. - SetFlags(value IsisLspFlags) IsisLspState - // HasFlags checks if Flags has been set in IsisLspState - HasFlags() bool - // IsType returns uint32, set in IsisLspState. - IsType() uint32 - // SetIsType assigns uint32 provided by user to IsisLspState - SetIsType(value uint32) IsisLspState - // HasIsType checks if IsType has been set in IsisLspState - HasIsType() bool - // Tlvs returns IsisLspTlvs, set in IsisLspState. - // IsisLspTlvs is this contains the list of TLVs present in one LSP. - Tlvs() IsisLspTlvs - // SetTlvs assigns IsisLspTlvs provided by user to IsisLspState. - // IsisLspTlvs is this contains the list of TLVs present in one LSP. - SetTlvs(value IsisLspTlvs) IsisLspState - // HasTlvs checks if Tlvs has been set in IsisLspState - HasTlvs() bool - setNil() -} - -// LSP ID in the format, e.g. '640000000001-00-00'. LSP ID consists of the System ID of a neighbor, the Pseudonode ID, and the LSP number. The last two bytes represent Pseudonode ID and LSP number respectively. A pseudonode is a logical representation of the LAN which is generated by a Designated Intermediate System (DIS) on a LAN segment. If one LSP exceeds the maximum LSP size then it is sent in another LSP with the LSP number incremented by one. A router's learned LSP gets refreshed by 'remaining_lifetime'. Then the sequence number is incremented by 1. -// LspId returns a string -func (obj *isisLspState) LspId() string { - - return *obj.obj.LspId - -} - -// LSP ID in the format, e.g. '640000000001-00-00'. LSP ID consists of the System ID of a neighbor, the Pseudonode ID, and the LSP number. The last two bytes represent Pseudonode ID and LSP number respectively. A pseudonode is a logical representation of the LAN which is generated by a Designated Intermediate System (DIS) on a LAN segment. If one LSP exceeds the maximum LSP size then it is sent in another LSP with the LSP number incremented by one. A router's learned LSP gets refreshed by 'remaining_lifetime'. Then the sequence number is incremented by 1. -// SetLspId sets the string value in the IsisLspState object -func (obj *isisLspState) SetLspId(value string) IsisLspState { - - obj.obj.LspId = &value - return obj -} - -type IsisLspStatePduTypeEnum string - -// Enum of PduType on IsisLspState -var IsisLspStatePduType = struct { - LEVEL_1 IsisLspStatePduTypeEnum - LEVEL_2 IsisLspStatePduTypeEnum -}{ - LEVEL_1: IsisLspStatePduTypeEnum("level_1"), - LEVEL_2: IsisLspStatePduTypeEnum("level_2"), -} - -func (obj *isisLspState) PduType() IsisLspStatePduTypeEnum { - return IsisLspStatePduTypeEnum(obj.obj.PduType.Enum().String()) -} - -// Link State PDU type. -// PduType returns a string -func (obj *isisLspState) HasPduType() bool { - return obj.obj.PduType != nil -} - -func (obj *isisLspState) SetPduType(value IsisLspStatePduTypeEnum) IsisLspState { - intValue, ok := otg.IsisLspState_PduType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on IsisLspStatePduTypeEnum", string(value))) - return obj - } - enumValue := otg.IsisLspState_PduType_Enum(intValue) - obj.obj.PduType = &enumValue - - return obj -} - -// Remaining lifetime in seconds before LSP expires. -// RemainingLifetime returns a uint32 -func (obj *isisLspState) RemainingLifetime() uint32 { - - return *obj.obj.RemainingLifetime - -} - -// Remaining lifetime in seconds before LSP expires. -// RemainingLifetime returns a uint32 -func (obj *isisLspState) HasRemainingLifetime() bool { - return obj.obj.RemainingLifetime != nil -} - -// Remaining lifetime in seconds before LSP expires. -// SetRemainingLifetime sets the uint32 value in the IsisLspState object -func (obj *isisLspState) SetRemainingLifetime(value uint32) IsisLspState { - - obj.obj.RemainingLifetime = &value - return obj -} - -// Sequence number of the LSP. -// SequenceNumber returns a uint64 -func (obj *isisLspState) SequenceNumber() uint64 { - - return *obj.obj.SequenceNumber - -} - -// Sequence number of the LSP. -// SequenceNumber returns a uint64 -func (obj *isisLspState) HasSequenceNumber() bool { - return obj.obj.SequenceNumber != nil -} - -// Sequence number of the LSP. -// SetSequenceNumber sets the uint64 value in the IsisLspState object -func (obj *isisLspState) SetSequenceNumber(value uint64) IsisLspState { - - obj.obj.SequenceNumber = &value - return obj -} - -// Total length of the LSP. -// PduLength returns a uint32 -func (obj *isisLspState) PduLength() uint32 { - - return *obj.obj.PduLength - -} - -// Total length of the LSP. -// PduLength returns a uint32 -func (obj *isisLspState) HasPduLength() bool { - return obj.obj.PduLength != nil -} - -// Total length of the LSP. -// SetPduLength sets the uint32 value in the IsisLspState object -func (obj *isisLspState) SetPduLength(value uint32) IsisLspState { - - obj.obj.PduLength = &value - return obj -} - -// LSP Type-Block flags. -// Flags returns a IsisLspFlags -func (obj *isisLspState) Flags() IsisLspFlags { - if obj.obj.Flags == nil { - obj.obj.Flags = NewIsisLspFlags().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &isisLspFlags{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// LSP Type-Block flags. -// Flags returns a IsisLspFlags -func (obj *isisLspState) HasFlags() bool { - return obj.obj.Flags != nil -} - -// LSP Type-Block flags. -// SetFlags sets the IsisLspFlags value in the IsisLspState object -func (obj *isisLspState) SetFlags(value IsisLspFlags) IsisLspState { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// IS Type - bits 1 and 2 indicate the type of Intermediate System. -// 1 - ( i.e. bit 1 set) Level 1 Intermediate system. -// 2 - Unused value. -// 3 - (i.e. bits 1 and 2 set) Level 2 Intermediate system. -// IsType returns a uint32 -func (obj *isisLspState) IsType() uint32 { - - return *obj.obj.IsType - -} - -// IS Type - bits 1 and 2 indicate the type of Intermediate System. -// 1 - ( i.e. bit 1 set) Level 1 Intermediate system. -// 2 - Unused value. -// 3 - (i.e. bits 1 and 2 set) Level 2 Intermediate system. -// IsType returns a uint32 -func (obj *isisLspState) HasIsType() bool { - return obj.obj.IsType != nil -} - -// IS Type - bits 1 and 2 indicate the type of Intermediate System. -// 1 - ( i.e. bit 1 set) Level 1 Intermediate system. -// 2 - Unused value. -// 3 - (i.e. bits 1 and 2 set) Level 2 Intermediate system. -// SetIsType sets the uint32 value in the IsisLspState object -func (obj *isisLspState) SetIsType(value uint32) IsisLspState { - - obj.obj.IsType = &value - return obj -} - -// It refers to Link State PDU State TLVs container. -// Tlvs returns a IsisLspTlvs -func (obj *isisLspState) Tlvs() IsisLspTlvs { - if obj.obj.Tlvs == nil { - obj.obj.Tlvs = NewIsisLspTlvs().msg() - } - if obj.tlvsHolder == nil { - obj.tlvsHolder = &isisLspTlvs{obj: obj.obj.Tlvs} - } - return obj.tlvsHolder -} - -// It refers to Link State PDU State TLVs container. -// Tlvs returns a IsisLspTlvs -func (obj *isisLspState) HasTlvs() bool { - return obj.obj.Tlvs != nil -} - -// It refers to Link State PDU State TLVs container. -// SetTlvs sets the IsisLspTlvs value in the IsisLspState object -func (obj *isisLspState) SetTlvs(value IsisLspTlvs) IsisLspState { - - obj.tlvsHolder = nil - obj.obj.Tlvs = value.msg() - - return obj -} - -func (obj *isisLspState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // LspId is required - if obj.obj.LspId == nil { - vObj.validationErrors = append(vObj.validationErrors, "LspId is required field on interface IsisLspState") - } - - if obj.obj.PduLength != nil { - - if *obj.obj.PduLength > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= IsisLspState.PduLength <= 65535 but Got %d", *obj.obj.PduLength)) - } - - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.IsType != nil { - - if *obj.obj.IsType > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= IsisLspState.IsType <= 3 but Got %d", *obj.obj.IsType)) - } - - } - - if obj.obj.Tlvs != nil { - - obj.Tlvs().validateObj(vObj, set_default) - } - -} - -func (obj *isisLspState) setDefault() { - -} - -// ***** LldpCustomTLVState ***** -type lldpCustomTLVState struct { - validation - obj *otg.LldpCustomTLVState - marshaller marshalLldpCustomTLVState - unMarshaller unMarshalLldpCustomTLVState -} - -func NewLldpCustomTLVState() LldpCustomTLVState { - obj := lldpCustomTLVState{obj: &otg.LldpCustomTLVState{}} - obj.setDefault() - return &obj -} - -func (obj *lldpCustomTLVState) msg() *otg.LldpCustomTLVState { - return obj.obj -} - -func (obj *lldpCustomTLVState) setMsg(msg *otg.LldpCustomTLVState) LldpCustomTLVState { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallldpCustomTLVState struct { - obj *lldpCustomTLVState -} - -type marshalLldpCustomTLVState interface { - // ToProto marshals LldpCustomTLVState to protobuf object *otg.LldpCustomTLVState - ToProto() (*otg.LldpCustomTLVState, error) - // ToPbText marshals LldpCustomTLVState to protobuf text - ToPbText() (string, error) - // ToYaml marshals LldpCustomTLVState to YAML text - ToYaml() (string, error) - // ToJson marshals LldpCustomTLVState to JSON text - ToJson() (string, error) -} - -type unMarshallldpCustomTLVState struct { - obj *lldpCustomTLVState -} - -type unMarshalLldpCustomTLVState interface { - // FromProto unmarshals LldpCustomTLVState from protobuf object *otg.LldpCustomTLVState - FromProto(msg *otg.LldpCustomTLVState) (LldpCustomTLVState, error) - // FromPbText unmarshals LldpCustomTLVState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LldpCustomTLVState from YAML text - FromYaml(value string) error - // FromJson unmarshals LldpCustomTLVState from JSON text - FromJson(value string) error -} - -func (obj *lldpCustomTLVState) Marshal() marshalLldpCustomTLVState { - if obj.marshaller == nil { - obj.marshaller = &marshallldpCustomTLVState{obj: obj} - } - return obj.marshaller -} - -func (obj *lldpCustomTLVState) Unmarshal() unMarshalLldpCustomTLVState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallldpCustomTLVState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallldpCustomTLVState) ToProto() (*otg.LldpCustomTLVState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallldpCustomTLVState) FromProto(msg *otg.LldpCustomTLVState) (LldpCustomTLVState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallldpCustomTLVState) 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 *unMarshallldpCustomTLVState) 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 *marshallldpCustomTLVState) 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 *unMarshallldpCustomTLVState) 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 *marshallldpCustomTLVState) 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 *unMarshallldpCustomTLVState) 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 *lldpCustomTLVState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lldpCustomTLVState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lldpCustomTLVState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lldpCustomTLVState) Clone() (LldpCustomTLVState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLldpCustomTLVState() - 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 -} - -// LldpCustomTLVState is custom TLV received from a neighbor.Custom TLVs are organization specific TLVs advertised with TLV type 127. -type LldpCustomTLVState interface { - Validation - // msg marshals LldpCustomTLVState to protobuf object *otg.LldpCustomTLVState - // and doesn't set defaults - msg() *otg.LldpCustomTLVState - // setMsg unmarshals LldpCustomTLVState from protobuf object *otg.LldpCustomTLVState - // and doesn't set defaults - setMsg(*otg.LldpCustomTLVState) LldpCustomTLVState - // provides marshal interface - Marshal() marshalLldpCustomTLVState - // provides unmarshal interface - Unmarshal() unMarshalLldpCustomTLVState - // validate validates LldpCustomTLVState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LldpCustomTLVState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // CustomType returns uint32, set in LldpCustomTLVState. - CustomType() uint32 - // SetCustomType assigns uint32 provided by user to LldpCustomTLVState - SetCustomType(value uint32) LldpCustomTLVState - // HasCustomType checks if CustomType has been set in LldpCustomTLVState - HasCustomType() bool - // Oui returns string, set in LldpCustomTLVState. - Oui() string - // SetOui assigns string provided by user to LldpCustomTLVState - SetOui(value string) LldpCustomTLVState - // HasOui checks if Oui has been set in LldpCustomTLVState - HasOui() bool - // OuiSubtype returns string, set in LldpCustomTLVState. - OuiSubtype() string - // SetOuiSubtype assigns string provided by user to LldpCustomTLVState - SetOuiSubtype(value string) LldpCustomTLVState - // HasOuiSubtype checks if OuiSubtype has been set in LldpCustomTLVState - HasOuiSubtype() bool -} - -// The integer value identifying the type of information contained in the value field. -// CustomType returns a uint32 -func (obj *lldpCustomTLVState) CustomType() uint32 { - - return *obj.obj.CustomType - -} - -// The integer value identifying the type of information contained in the value field. -// CustomType returns a uint32 -func (obj *lldpCustomTLVState) HasCustomType() bool { - return obj.obj.CustomType != nil -} - -// The integer value identifying the type of information contained in the value field. -// SetCustomType sets the uint32 value in the LldpCustomTLVState object -func (obj *lldpCustomTLVState) SetCustomType(value uint32) LldpCustomTLVState { - - obj.obj.CustomType = &value - return obj -} - -// The organizationally unique identifier field shall contain the organization's OUI as defined in Clause 9 of IEEE Std 802. The high-order octet is 0 and the low-order 3 octets are the SMI Network Management Private Enterprise Code of the Vendor in network byte order, as defined in the 'Assigned Numbers' RFC [RFC3232]. -// Oui returns a string -func (obj *lldpCustomTLVState) Oui() string { - - return *obj.obj.Oui - -} - -// The organizationally unique identifier field shall contain the organization's OUI as defined in Clause 9 of IEEE Std 802. The high-order octet is 0 and the low-order 3 octets are the SMI Network Management Private Enterprise Code of the Vendor in network byte order, as defined in the 'Assigned Numbers' RFC [RFC3232]. -// Oui returns a string -func (obj *lldpCustomTLVState) HasOui() bool { - return obj.obj.Oui != nil -} - -// The organizationally unique identifier field shall contain the organization's OUI as defined in Clause 9 of IEEE Std 802. The high-order octet is 0 and the low-order 3 octets are the SMI Network Management Private Enterprise Code of the Vendor in network byte order, as defined in the 'Assigned Numbers' RFC [RFC3232]. -// SetOui sets the string value in the LldpCustomTLVState object -func (obj *lldpCustomTLVState) SetOui(value string) LldpCustomTLVState { - - obj.obj.Oui = &value - return obj -} - -// The organizationally defined subtype field shall contain a unique subtype value assigned by the defining organization. -// OuiSubtype returns a string -func (obj *lldpCustomTLVState) OuiSubtype() string { - - return *obj.obj.OuiSubtype - -} - -// The organizationally defined subtype field shall contain a unique subtype value assigned by the defining organization. -// OuiSubtype returns a string -func (obj *lldpCustomTLVState) HasOuiSubtype() bool { - return obj.obj.OuiSubtype != nil -} - -// The organizationally defined subtype field shall contain a unique subtype value assigned by the defining organization. -// SetOuiSubtype sets the string value in the LldpCustomTLVState object -func (obj *lldpCustomTLVState) SetOuiSubtype(value string) LldpCustomTLVState { - - obj.obj.OuiSubtype = &value - return obj -} - -func (obj *lldpCustomTLVState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *lldpCustomTLVState) setDefault() { - -} - -// ***** LldpCapabilityState ***** -type lldpCapabilityState struct { - validation - obj *otg.LldpCapabilityState - marshaller marshalLldpCapabilityState - unMarshaller unMarshalLldpCapabilityState -} - -func NewLldpCapabilityState() LldpCapabilityState { - obj := lldpCapabilityState{obj: &otg.LldpCapabilityState{}} - obj.setDefault() - return &obj -} - -func (obj *lldpCapabilityState) msg() *otg.LldpCapabilityState { - return obj.obj -} - -func (obj *lldpCapabilityState) setMsg(msg *otg.LldpCapabilityState) LldpCapabilityState { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallldpCapabilityState struct { - obj *lldpCapabilityState -} - -type marshalLldpCapabilityState interface { - // ToProto marshals LldpCapabilityState to protobuf object *otg.LldpCapabilityState - ToProto() (*otg.LldpCapabilityState, error) - // ToPbText marshals LldpCapabilityState to protobuf text - ToPbText() (string, error) - // ToYaml marshals LldpCapabilityState to YAML text - ToYaml() (string, error) - // ToJson marshals LldpCapabilityState to JSON text - ToJson() (string, error) -} - -type unMarshallldpCapabilityState struct { - obj *lldpCapabilityState -} - -type unMarshalLldpCapabilityState interface { - // FromProto unmarshals LldpCapabilityState from protobuf object *otg.LldpCapabilityState - FromProto(msg *otg.LldpCapabilityState) (LldpCapabilityState, error) - // FromPbText unmarshals LldpCapabilityState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LldpCapabilityState from YAML text - FromYaml(value string) error - // FromJson unmarshals LldpCapabilityState from JSON text - FromJson(value string) error -} - -func (obj *lldpCapabilityState) Marshal() marshalLldpCapabilityState { - if obj.marshaller == nil { - obj.marshaller = &marshallldpCapabilityState{obj: obj} - } - return obj.marshaller -} - -func (obj *lldpCapabilityState) Unmarshal() unMarshalLldpCapabilityState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallldpCapabilityState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallldpCapabilityState) ToProto() (*otg.LldpCapabilityState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallldpCapabilityState) FromProto(msg *otg.LldpCapabilityState) (LldpCapabilityState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallldpCapabilityState) 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 *unMarshallldpCapabilityState) 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 *marshallldpCapabilityState) 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 *unMarshallldpCapabilityState) 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 *marshallldpCapabilityState) 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 *unMarshallldpCapabilityState) 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 *lldpCapabilityState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *lldpCapabilityState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *lldpCapabilityState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *lldpCapabilityState) Clone() (LldpCapabilityState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLldpCapabilityState() - 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 -} - -// LldpCapabilityState is lLDP system capability advertised by the neighbor -type LldpCapabilityState interface { - Validation - // msg marshals LldpCapabilityState to protobuf object *otg.LldpCapabilityState - // and doesn't set defaults - msg() *otg.LldpCapabilityState - // setMsg unmarshals LldpCapabilityState from protobuf object *otg.LldpCapabilityState - // and doesn't set defaults - setMsg(*otg.LldpCapabilityState) LldpCapabilityState - // provides marshal interface - Marshal() marshalLldpCapabilityState - // provides unmarshal interface - Unmarshal() unMarshalLldpCapabilityState - // validate validates LldpCapabilityState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LldpCapabilityState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // CapabilityName returns LldpCapabilityStateCapabilityNameEnum, set in LldpCapabilityState - CapabilityName() LldpCapabilityStateCapabilityNameEnum - // SetCapabilityName assigns LldpCapabilityStateCapabilityNameEnum provided by user to LldpCapabilityState - SetCapabilityName(value LldpCapabilityStateCapabilityNameEnum) LldpCapabilityState - // HasCapabilityName checks if CapabilityName has been set in LldpCapabilityState - HasCapabilityName() bool - // CapabilityEnabled returns bool, set in LldpCapabilityState. - CapabilityEnabled() bool - // SetCapabilityEnabled assigns bool provided by user to LldpCapabilityState - SetCapabilityEnabled(value bool) LldpCapabilityState - // HasCapabilityEnabled checks if CapabilityEnabled has been set in LldpCapabilityState - HasCapabilityEnabled() bool -} - -type LldpCapabilityStateCapabilityNameEnum string - -// Enum of CapabilityName on LldpCapabilityState -var LldpCapabilityStateCapabilityName = struct { - MAC_BRIDGE LldpCapabilityStateCapabilityNameEnum - TWO_PORT_MAC_RELAY LldpCapabilityStateCapabilityNameEnum - REPEATER LldpCapabilityStateCapabilityNameEnum - DOCSIS_CABLE_DEVICE LldpCapabilityStateCapabilityNameEnum - S_VLAN LldpCapabilityStateCapabilityNameEnum - TELEPHONE LldpCapabilityStateCapabilityNameEnum - OTHER LldpCapabilityStateCapabilityNameEnum - ROUTER LldpCapabilityStateCapabilityNameEnum - C_VLAN LldpCapabilityStateCapabilityNameEnum - STATION_ONLY LldpCapabilityStateCapabilityNameEnum - WLAN_ACCESS_POINT LldpCapabilityStateCapabilityNameEnum -}{ - MAC_BRIDGE: LldpCapabilityStateCapabilityNameEnum("mac_bridge"), - TWO_PORT_MAC_RELAY: LldpCapabilityStateCapabilityNameEnum("two_port_mac_relay"), - REPEATER: LldpCapabilityStateCapabilityNameEnum("repeater"), - DOCSIS_CABLE_DEVICE: LldpCapabilityStateCapabilityNameEnum("docsis_cable_device"), - S_VLAN: LldpCapabilityStateCapabilityNameEnum("s_vlan"), - TELEPHONE: LldpCapabilityStateCapabilityNameEnum("telephone"), - OTHER: LldpCapabilityStateCapabilityNameEnum("other"), - ROUTER: LldpCapabilityStateCapabilityNameEnum("router"), - C_VLAN: LldpCapabilityStateCapabilityNameEnum("c_vlan"), - STATION_ONLY: LldpCapabilityStateCapabilityNameEnum("station_only"), - WLAN_ACCESS_POINT: LldpCapabilityStateCapabilityNameEnum("wlan_access_point"), -} - -func (obj *lldpCapabilityState) CapabilityName() LldpCapabilityStateCapabilityNameEnum { - return LldpCapabilityStateCapabilityNameEnum(obj.obj.CapabilityName.Enum().String()) -} - -// Name of the system capability advertised by the neighbor. Capabilities are represented in a bitmap that defines the primary functions of the system. The capabilities are defined in IEEE 802.1AB. -// CapabilityName returns a string -func (obj *lldpCapabilityState) HasCapabilityName() bool { - return obj.obj.CapabilityName != nil -} - -func (obj *lldpCapabilityState) SetCapabilityName(value LldpCapabilityStateCapabilityNameEnum) LldpCapabilityState { - intValue, ok := otg.LldpCapabilityState_CapabilityName_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on LldpCapabilityStateCapabilityNameEnum", string(value))) - return obj - } - enumValue := otg.LldpCapabilityState_CapabilityName_Enum(intValue) - obj.obj.CapabilityName = &enumValue - - return obj -} - -// Indicates whether the corresponding system capability is enabled on the neighbor. -// CapabilityEnabled returns a bool -func (obj *lldpCapabilityState) CapabilityEnabled() bool { - - return *obj.obj.CapabilityEnabled - -} - -// Indicates whether the corresponding system capability is enabled on the neighbor. -// CapabilityEnabled returns a bool -func (obj *lldpCapabilityState) HasCapabilityEnabled() bool { - return obj.obj.CapabilityEnabled != nil -} - -// Indicates whether the corresponding system capability is enabled on the neighbor. -// SetCapabilityEnabled sets the bool value in the LldpCapabilityState object -func (obj *lldpCapabilityState) SetCapabilityEnabled(value bool) LldpCapabilityState { - - obj.obj.CapabilityEnabled = &value - return obj -} - -func (obj *lldpCapabilityState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *lldpCapabilityState) setDefault() { - -} - -// ***** RsvpIPv4LspState ***** -type rsvpIPv4LspState struct { - validation - obj *otg.RsvpIPv4LspState - marshaller marshalRsvpIPv4LspState - unMarshaller unMarshalRsvpIPv4LspState - lspHolder RsvpLspState - rrosHolder RsvpIPv4LspStateRsvpLspIpv4RroIter - erosHolder RsvpIPv4LspStateRsvpLspIpv4EroIter -} - -func NewRsvpIPv4LspState() RsvpIPv4LspState { - obj := rsvpIPv4LspState{obj: &otg.RsvpIPv4LspState{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpIPv4LspState) msg() *otg.RsvpIPv4LspState { - return obj.obj -} - -func (obj *rsvpIPv4LspState) setMsg(msg *otg.RsvpIPv4LspState) RsvpIPv4LspState { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpIPv4LspState struct { - obj *rsvpIPv4LspState -} - -type marshalRsvpIPv4LspState interface { - // ToProto marshals RsvpIPv4LspState to protobuf object *otg.RsvpIPv4LspState - ToProto() (*otg.RsvpIPv4LspState, error) - // ToPbText marshals RsvpIPv4LspState to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpIPv4LspState to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpIPv4LspState to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpIPv4LspState struct { - obj *rsvpIPv4LspState -} - -type unMarshalRsvpIPv4LspState interface { - // FromProto unmarshals RsvpIPv4LspState from protobuf object *otg.RsvpIPv4LspState - FromProto(msg *otg.RsvpIPv4LspState) (RsvpIPv4LspState, error) - // FromPbText unmarshals RsvpIPv4LspState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpIPv4LspState from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpIPv4LspState from JSON text - FromJson(value string) error -} - -func (obj *rsvpIPv4LspState) Marshal() marshalRsvpIPv4LspState { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpIPv4LspState{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpIPv4LspState) Unmarshal() unMarshalRsvpIPv4LspState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpIPv4LspState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpIPv4LspState) ToProto() (*otg.RsvpIPv4LspState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpIPv4LspState) FromProto(msg *otg.RsvpIPv4LspState) (RsvpIPv4LspState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpIPv4LspState) 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 *unMarshalrsvpIPv4LspState) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalrsvpIPv4LspState) 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 *unMarshalrsvpIPv4LspState) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalrsvpIPv4LspState) 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 *unMarshalrsvpIPv4LspState) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *rsvpIPv4LspState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpIPv4LspState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpIPv4LspState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpIPv4LspState) Clone() (RsvpIPv4LspState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpIPv4LspState() - 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 -} - -func (obj *rsvpIPv4LspState) setNil() { - obj.lspHolder = nil - obj.rrosHolder = nil - obj.erosHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// RsvpIPv4LspState is iPv4 RSVP-TE Discovered LSPs. -type RsvpIPv4LspState interface { - Validation - // msg marshals RsvpIPv4LspState to protobuf object *otg.RsvpIPv4LspState - // and doesn't set defaults - msg() *otg.RsvpIPv4LspState - // setMsg unmarshals RsvpIPv4LspState from protobuf object *otg.RsvpIPv4LspState - // and doesn't set defaults - setMsg(*otg.RsvpIPv4LspState) RsvpIPv4LspState - // provides marshal interface - Marshal() marshalRsvpIPv4LspState - // provides unmarshal interface - Unmarshal() unMarshalRsvpIPv4LspState - // validate validates RsvpIPv4LspState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpIPv4LspState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // SourceAddress returns string, set in RsvpIPv4LspState. - SourceAddress() string - // SetSourceAddress assigns string provided by user to RsvpIPv4LspState - SetSourceAddress(value string) RsvpIPv4LspState - // HasSourceAddress checks if SourceAddress has been set in RsvpIPv4LspState - HasSourceAddress() bool - // DestinationAddress returns string, set in RsvpIPv4LspState. - DestinationAddress() string - // SetDestinationAddress assigns string provided by user to RsvpIPv4LspState - SetDestinationAddress(value string) RsvpIPv4LspState - // HasDestinationAddress checks if DestinationAddress has been set in RsvpIPv4LspState - HasDestinationAddress() bool - // Lsp returns RsvpLspState, set in RsvpIPv4LspState. - // RsvpLspState is iPv4 RSVP-TE Discovered LSPs. - Lsp() RsvpLspState - // SetLsp assigns RsvpLspState provided by user to RsvpIPv4LspState. - // RsvpLspState is iPv4 RSVP-TE Discovered LSPs. - SetLsp(value RsvpLspState) RsvpIPv4LspState - // HasLsp checks if Lsp has been set in RsvpIPv4LspState - HasLsp() bool - // Rros returns RsvpIPv4LspStateRsvpLspIpv4RroIterIter, set in RsvpIPv4LspState - Rros() RsvpIPv4LspStateRsvpLspIpv4RroIter - // Eros returns RsvpIPv4LspStateRsvpLspIpv4EroIterIter, set in RsvpIPv4LspState - Eros() RsvpIPv4LspStateRsvpLspIpv4EroIter - setNil() -} - -// The origin IPv4 address of RSVP session. -// SourceAddress returns a string -func (obj *rsvpIPv4LspState) SourceAddress() string { - - return *obj.obj.SourceAddress - -} - -// The origin IPv4 address of RSVP session. -// SourceAddress returns a string -func (obj *rsvpIPv4LspState) HasSourceAddress() bool { - return obj.obj.SourceAddress != nil -} - -// The origin IPv4 address of RSVP session. -// SetSourceAddress sets the string value in the RsvpIPv4LspState object -func (obj *rsvpIPv4LspState) SetSourceAddress(value string) RsvpIPv4LspState { - - obj.obj.SourceAddress = &value - return obj -} - -// The IPv4 destination address of RSVP session. -// DestinationAddress returns a string -func (obj *rsvpIPv4LspState) DestinationAddress() string { - - return *obj.obj.DestinationAddress - -} - -// The IPv4 destination address of RSVP session. -// DestinationAddress returns a string -func (obj *rsvpIPv4LspState) HasDestinationAddress() bool { - return obj.obj.DestinationAddress != nil -} - -// The IPv4 destination address of RSVP session. -// SetDestinationAddress sets the string value in the RsvpIPv4LspState object -func (obj *rsvpIPv4LspState) SetDestinationAddress(value string) RsvpIPv4LspState { - - obj.obj.DestinationAddress = &value - return obj -} - -// It refers to the RSVP LSP properties. -// Lsp returns a RsvpLspState -func (obj *rsvpIPv4LspState) Lsp() RsvpLspState { - if obj.obj.Lsp == nil { - obj.obj.Lsp = NewRsvpLspState().msg() - } - if obj.lspHolder == nil { - obj.lspHolder = &rsvpLspState{obj: obj.obj.Lsp} - } - return obj.lspHolder -} - -// It refers to the RSVP LSP properties. -// Lsp returns a RsvpLspState -func (obj *rsvpIPv4LspState) HasLsp() bool { - return obj.obj.Lsp != nil -} - -// It refers to the RSVP LSP properties. -// SetLsp sets the RsvpLspState value in the RsvpIPv4LspState object -func (obj *rsvpIPv4LspState) SetLsp(value RsvpLspState) RsvpIPv4LspState { - - obj.lspHolder = nil - obj.obj.Lsp = value.msg() - - return obj -} - -// It refers to RSVP RRO objects container. -// Rros returns a []RsvpLspIpv4Rro -func (obj *rsvpIPv4LspState) Rros() RsvpIPv4LspStateRsvpLspIpv4RroIter { - if len(obj.obj.Rros) == 0 { - obj.obj.Rros = []*otg.RsvpLspIpv4Rro{} - } - if obj.rrosHolder == nil { - obj.rrosHolder = newRsvpIPv4LspStateRsvpLspIpv4RroIter(&obj.obj.Rros).setMsg(obj) - } - return obj.rrosHolder -} - -type rsvpIPv4LspStateRsvpLspIpv4RroIter struct { - obj *rsvpIPv4LspState - rsvpLspIpv4RroSlice []RsvpLspIpv4Rro - fieldPtr *[]*otg.RsvpLspIpv4Rro -} - -func newRsvpIPv4LspStateRsvpLspIpv4RroIter(ptr *[]*otg.RsvpLspIpv4Rro) RsvpIPv4LspStateRsvpLspIpv4RroIter { - return &rsvpIPv4LspStateRsvpLspIpv4RroIter{fieldPtr: ptr} -} - -type RsvpIPv4LspStateRsvpLspIpv4RroIter interface { - setMsg(*rsvpIPv4LspState) RsvpIPv4LspStateRsvpLspIpv4RroIter - Items() []RsvpLspIpv4Rro - Add() RsvpLspIpv4Rro - Append(items ...RsvpLspIpv4Rro) RsvpIPv4LspStateRsvpLspIpv4RroIter - Set(index int, newObj RsvpLspIpv4Rro) RsvpIPv4LspStateRsvpLspIpv4RroIter - Clear() RsvpIPv4LspStateRsvpLspIpv4RroIter - clearHolderSlice() RsvpIPv4LspStateRsvpLspIpv4RroIter - appendHolderSlice(item RsvpLspIpv4Rro) RsvpIPv4LspStateRsvpLspIpv4RroIter -} - -func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) setMsg(msg *rsvpIPv4LspState) RsvpIPv4LspStateRsvpLspIpv4RroIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&rsvpLspIpv4Rro{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) Items() []RsvpLspIpv4Rro { - return obj.rsvpLspIpv4RroSlice -} - -func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) Add() RsvpLspIpv4Rro { - newObj := &otg.RsvpLspIpv4Rro{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &rsvpLspIpv4Rro{obj: newObj} - newLibObj.setDefault() - obj.rsvpLspIpv4RroSlice = append(obj.rsvpLspIpv4RroSlice, newLibObj) - return newLibObj -} - -func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) Append(items ...RsvpLspIpv4Rro) RsvpIPv4LspStateRsvpLspIpv4RroIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.rsvpLspIpv4RroSlice = append(obj.rsvpLspIpv4RroSlice, item) - } - return obj -} - -func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) Set(index int, newObj RsvpLspIpv4Rro) RsvpIPv4LspStateRsvpLspIpv4RroIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.rsvpLspIpv4RroSlice[index] = newObj - return obj -} -func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) Clear() RsvpIPv4LspStateRsvpLspIpv4RroIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.RsvpLspIpv4Rro{} - obj.rsvpLspIpv4RroSlice = []RsvpLspIpv4Rro{} - } - return obj -} -func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) clearHolderSlice() RsvpIPv4LspStateRsvpLspIpv4RroIter { - if len(obj.rsvpLspIpv4RroSlice) > 0 { - obj.rsvpLspIpv4RroSlice = []RsvpLspIpv4Rro{} - } - return obj -} -func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) appendHolderSlice(item RsvpLspIpv4Rro) RsvpIPv4LspStateRsvpLspIpv4RroIter { - obj.rsvpLspIpv4RroSlice = append(obj.rsvpLspIpv4RroSlice, item) - return obj -} - -// It refers to RSVP ERO objects container. -// Eros returns a []RsvpLspIpv4Ero -func (obj *rsvpIPv4LspState) Eros() RsvpIPv4LspStateRsvpLspIpv4EroIter { - if len(obj.obj.Eros) == 0 { - obj.obj.Eros = []*otg.RsvpLspIpv4Ero{} - } - if obj.erosHolder == nil { - obj.erosHolder = newRsvpIPv4LspStateRsvpLspIpv4EroIter(&obj.obj.Eros).setMsg(obj) - } - return obj.erosHolder -} - -type rsvpIPv4LspStateRsvpLspIpv4EroIter struct { - obj *rsvpIPv4LspState - rsvpLspIpv4EroSlice []RsvpLspIpv4Ero - fieldPtr *[]*otg.RsvpLspIpv4Ero -} - -func newRsvpIPv4LspStateRsvpLspIpv4EroIter(ptr *[]*otg.RsvpLspIpv4Ero) RsvpIPv4LspStateRsvpLspIpv4EroIter { - return &rsvpIPv4LspStateRsvpLspIpv4EroIter{fieldPtr: ptr} -} - -type RsvpIPv4LspStateRsvpLspIpv4EroIter interface { - setMsg(*rsvpIPv4LspState) RsvpIPv4LspStateRsvpLspIpv4EroIter - Items() []RsvpLspIpv4Ero - Add() RsvpLspIpv4Ero - Append(items ...RsvpLspIpv4Ero) RsvpIPv4LspStateRsvpLspIpv4EroIter - Set(index int, newObj RsvpLspIpv4Ero) RsvpIPv4LspStateRsvpLspIpv4EroIter - Clear() RsvpIPv4LspStateRsvpLspIpv4EroIter - clearHolderSlice() RsvpIPv4LspStateRsvpLspIpv4EroIter - appendHolderSlice(item RsvpLspIpv4Ero) RsvpIPv4LspStateRsvpLspIpv4EroIter -} - -func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) setMsg(msg *rsvpIPv4LspState) RsvpIPv4LspStateRsvpLspIpv4EroIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&rsvpLspIpv4Ero{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) Items() []RsvpLspIpv4Ero { - return obj.rsvpLspIpv4EroSlice -} - -func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) Add() RsvpLspIpv4Ero { - newObj := &otg.RsvpLspIpv4Ero{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &rsvpLspIpv4Ero{obj: newObj} - newLibObj.setDefault() - obj.rsvpLspIpv4EroSlice = append(obj.rsvpLspIpv4EroSlice, newLibObj) - return newLibObj -} - -func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) Append(items ...RsvpLspIpv4Ero) RsvpIPv4LspStateRsvpLspIpv4EroIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.rsvpLspIpv4EroSlice = append(obj.rsvpLspIpv4EroSlice, item) - } - return obj -} - -func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) Set(index int, newObj RsvpLspIpv4Ero) RsvpIPv4LspStateRsvpLspIpv4EroIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.rsvpLspIpv4EroSlice[index] = newObj - return obj -} -func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) Clear() RsvpIPv4LspStateRsvpLspIpv4EroIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.RsvpLspIpv4Ero{} - obj.rsvpLspIpv4EroSlice = []RsvpLspIpv4Ero{} - } - return obj -} -func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) clearHolderSlice() RsvpIPv4LspStateRsvpLspIpv4EroIter { - if len(obj.rsvpLspIpv4EroSlice) > 0 { - obj.rsvpLspIpv4EroSlice = []RsvpLspIpv4Ero{} - } - return obj -} -func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) appendHolderSlice(item RsvpLspIpv4Ero) RsvpIPv4LspStateRsvpLspIpv4EroIter { - obj.rsvpLspIpv4EroSlice = append(obj.rsvpLspIpv4EroSlice, item) - return obj -} - -func (obj *rsvpIPv4LspState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.SourceAddress != nil { - - err := obj.validateIpv4(obj.SourceAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on RsvpIPv4LspState.SourceAddress")) - } - - } - - if obj.obj.DestinationAddress != nil { - - err := obj.validateIpv4(obj.DestinationAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on RsvpIPv4LspState.DestinationAddress")) - } - - } - - if obj.obj.Lsp != nil { - - obj.Lsp().validateObj(vObj, set_default) - } - - if len(obj.obj.Rros) != 0 { - - if set_default { - obj.Rros().clearHolderSlice() - for _, item := range obj.obj.Rros { - obj.Rros().appendHolderSlice(&rsvpLspIpv4Rro{obj: item}) - } - } - for _, item := range obj.Rros().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Eros) != 0 { - - if set_default { - obj.Eros().clearHolderSlice() - for _, item := range obj.obj.Eros { - obj.Eros().appendHolderSlice(&rsvpLspIpv4Ero{obj: item}) - } - } - for _, item := range obj.Eros().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *rsvpIPv4LspState) setDefault() { - -} - -// ***** Dhcpv4LeaseState ***** -type dhcpv4LeaseState struct { - validation - obj *otg.Dhcpv4LeaseState - marshaller marshalDhcpv4LeaseState - unMarshaller unMarshalDhcpv4LeaseState -} - -func NewDhcpv4LeaseState() Dhcpv4LeaseState { - obj := dhcpv4LeaseState{obj: &otg.Dhcpv4LeaseState{}} - obj.setDefault() - return &obj -} - -func (obj *dhcpv4LeaseState) msg() *otg.Dhcpv4LeaseState { - return obj.obj -} - -func (obj *dhcpv4LeaseState) setMsg(msg *otg.Dhcpv4LeaseState) Dhcpv4LeaseState { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldhcpv4LeaseState struct { - obj *dhcpv4LeaseState -} - -type marshalDhcpv4LeaseState interface { - // ToProto marshals Dhcpv4LeaseState to protobuf object *otg.Dhcpv4LeaseState - ToProto() (*otg.Dhcpv4LeaseState, error) - // ToPbText marshals Dhcpv4LeaseState to protobuf text - ToPbText() (string, error) - // ToYaml marshals Dhcpv4LeaseState to YAML text - ToYaml() (string, error) - // ToJson marshals Dhcpv4LeaseState to JSON text - ToJson() (string, error) -} - -type unMarshaldhcpv4LeaseState struct { - obj *dhcpv4LeaseState -} - -type unMarshalDhcpv4LeaseState interface { - // FromProto unmarshals Dhcpv4LeaseState from protobuf object *otg.Dhcpv4LeaseState - FromProto(msg *otg.Dhcpv4LeaseState) (Dhcpv4LeaseState, error) - // FromPbText unmarshals Dhcpv4LeaseState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Dhcpv4LeaseState from YAML text - FromYaml(value string) error - // FromJson unmarshals Dhcpv4LeaseState from JSON text - FromJson(value string) error -} - -func (obj *dhcpv4LeaseState) Marshal() marshalDhcpv4LeaseState { - if obj.marshaller == nil { - obj.marshaller = &marshaldhcpv4LeaseState{obj: obj} - } - return obj.marshaller -} - -func (obj *dhcpv4LeaseState) Unmarshal() unMarshalDhcpv4LeaseState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldhcpv4LeaseState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldhcpv4LeaseState) ToProto() (*otg.Dhcpv4LeaseState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldhcpv4LeaseState) FromProto(msg *otg.Dhcpv4LeaseState) (Dhcpv4LeaseState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldhcpv4LeaseState) 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 *unMarshaldhcpv4LeaseState) 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 *marshaldhcpv4LeaseState) 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 *unMarshaldhcpv4LeaseState) 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 *marshaldhcpv4LeaseState) 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 *unMarshaldhcpv4LeaseState) 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 *dhcpv4LeaseState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *dhcpv4LeaseState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *dhcpv4LeaseState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *dhcpv4LeaseState) Clone() (Dhcpv4LeaseState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDhcpv4LeaseState() - 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 -} - -// Dhcpv4LeaseState is iPv4 address lease state. -type Dhcpv4LeaseState interface { - Validation - // msg marshals Dhcpv4LeaseState to protobuf object *otg.Dhcpv4LeaseState - // and doesn't set defaults - msg() *otg.Dhcpv4LeaseState - // setMsg unmarshals Dhcpv4LeaseState from protobuf object *otg.Dhcpv4LeaseState - // and doesn't set defaults - setMsg(*otg.Dhcpv4LeaseState) Dhcpv4LeaseState - // provides marshal interface - Marshal() marshalDhcpv4LeaseState - // provides unmarshal interface - Unmarshal() unMarshalDhcpv4LeaseState - // validate validates Dhcpv4LeaseState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Dhcpv4LeaseState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Address returns string, set in Dhcpv4LeaseState. - Address() string - // SetAddress assigns string provided by user to Dhcpv4LeaseState - SetAddress(value string) Dhcpv4LeaseState - // HasAddress checks if Address has been set in Dhcpv4LeaseState - HasAddress() bool - // ValidTime returns uint32, set in Dhcpv4LeaseState. - ValidTime() uint32 - // SetValidTime assigns uint32 provided by user to Dhcpv4LeaseState - SetValidTime(value uint32) Dhcpv4LeaseState - // HasValidTime checks if ValidTime has been set in Dhcpv4LeaseState - HasValidTime() bool - // PreferredTime returns uint32, set in Dhcpv4LeaseState. - PreferredTime() uint32 - // SetPreferredTime assigns uint32 provided by user to Dhcpv4LeaseState - SetPreferredTime(value uint32) Dhcpv4LeaseState - // HasPreferredTime checks if PreferredTime has been set in Dhcpv4LeaseState - HasPreferredTime() bool - // RenewTime returns uint32, set in Dhcpv4LeaseState. - RenewTime() uint32 - // SetRenewTime assigns uint32 provided by user to Dhcpv4LeaseState - SetRenewTime(value uint32) Dhcpv4LeaseState - // HasRenewTime checks if RenewTime has been set in Dhcpv4LeaseState - HasRenewTime() bool - // RebindTime returns uint32, set in Dhcpv4LeaseState. - RebindTime() uint32 - // SetRebindTime assigns uint32 provided by user to Dhcpv4LeaseState - SetRebindTime(value uint32) Dhcpv4LeaseState - // HasRebindTime checks if RebindTime has been set in Dhcpv4LeaseState - HasRebindTime() bool - // ClientId returns string, set in Dhcpv4LeaseState. - ClientId() string - // SetClientId assigns string provided by user to Dhcpv4LeaseState - SetClientId(value string) Dhcpv4LeaseState - // HasClientId checks if ClientId has been set in Dhcpv4LeaseState - HasClientId() bool - // CircuitId returns string, set in Dhcpv4LeaseState. - CircuitId() string - // SetCircuitId assigns string provided by user to Dhcpv4LeaseState - SetCircuitId(value string) Dhcpv4LeaseState - // HasCircuitId checks if CircuitId has been set in Dhcpv4LeaseState - HasCircuitId() bool - // RemoteId returns string, set in Dhcpv4LeaseState. - RemoteId() string - // SetRemoteId assigns string provided by user to Dhcpv4LeaseState - SetRemoteId(value string) Dhcpv4LeaseState - // HasRemoteId checks if RemoteId has been set in Dhcpv4LeaseState - HasRemoteId() bool -} - -// The IPv4 address associated with this lease. -// Address returns a string -func (obj *dhcpv4LeaseState) Address() string { - - return *obj.obj.Address - -} - -// The IPv4 address associated with this lease. -// Address returns a string -func (obj *dhcpv4LeaseState) HasAddress() bool { - return obj.obj.Address != nil -} - -// The IPv4 address associated with this lease. -// SetAddress sets the string value in the Dhcpv4LeaseState object -func (obj *dhcpv4LeaseState) SetAddress(value string) Dhcpv4LeaseState { - - obj.obj.Address = &value - return obj -} - -// The time in seconds after which the IPv4 address lease will expire. -// ValidTime returns a uint32 -func (obj *dhcpv4LeaseState) ValidTime() uint32 { - - return *obj.obj.ValidTime - -} - -// The time in seconds after which the IPv4 address lease will expire. -// ValidTime returns a uint32 -func (obj *dhcpv4LeaseState) HasValidTime() bool { - return obj.obj.ValidTime != nil -} - -// The time in seconds after which the IPv4 address lease will expire. -// SetValidTime sets the uint32 value in the Dhcpv4LeaseState object -func (obj *dhcpv4LeaseState) SetValidTime(value uint32) Dhcpv4LeaseState { - - obj.obj.ValidTime = &value - return obj -} - -// The elapsed time in seconds since the address has been renewed. -// PreferredTime returns a uint32 -func (obj *dhcpv4LeaseState) PreferredTime() uint32 { - - return *obj.obj.PreferredTime - -} - -// The elapsed time in seconds since the address has been renewed. -// PreferredTime returns a uint32 -func (obj *dhcpv4LeaseState) HasPreferredTime() bool { - return obj.obj.PreferredTime != nil -} - -// The elapsed time in seconds since the address has been renewed. -// SetPreferredTime sets the uint32 value in the Dhcpv4LeaseState object -func (obj *dhcpv4LeaseState) SetPreferredTime(value uint32) Dhcpv4LeaseState { - - obj.obj.PreferredTime = &value - return obj -} - -// Time in seconds until the DHCPv4 client starts renewing the lease. -// RenewTime returns a uint32 -func (obj *dhcpv4LeaseState) RenewTime() uint32 { - - return *obj.obj.RenewTime - -} - -// Time in seconds until the DHCPv4 client starts renewing the lease. -// RenewTime returns a uint32 -func (obj *dhcpv4LeaseState) HasRenewTime() bool { - return obj.obj.RenewTime != nil -} - -// Time in seconds until the DHCPv4 client starts renewing the lease. -// SetRenewTime sets the uint32 value in the Dhcpv4LeaseState object -func (obj *dhcpv4LeaseState) SetRenewTime(value uint32) Dhcpv4LeaseState { - - obj.obj.RenewTime = &value - return obj -} - -// Time in seconds until the DHCPv4 client starts rebinding. -// RebindTime returns a uint32 -func (obj *dhcpv4LeaseState) RebindTime() uint32 { - - return *obj.obj.RebindTime - -} - -// Time in seconds until the DHCPv4 client starts rebinding. -// RebindTime returns a uint32 -func (obj *dhcpv4LeaseState) HasRebindTime() bool { - return obj.obj.RebindTime != nil -} - -// Time in seconds until the DHCPv4 client starts rebinding. -// SetRebindTime sets the uint32 value in the Dhcpv4LeaseState object -func (obj *dhcpv4LeaseState) SetRebindTime(value uint32) Dhcpv4LeaseState { - - obj.obj.RebindTime = &value - return obj -} - -// The ID of the DHCPv4 client holding this lease. -// ClientId returns a string -func (obj *dhcpv4LeaseState) ClientId() string { - - return *obj.obj.ClientId - -} - -// The ID of the DHCPv4 client holding this lease. -// ClientId returns a string -func (obj *dhcpv4LeaseState) HasClientId() bool { - return obj.obj.ClientId != nil -} - -// The ID of the DHCPv4 client holding this lease. -// SetClientId sets the string value in the Dhcpv4LeaseState object -func (obj *dhcpv4LeaseState) SetClientId(value string) Dhcpv4LeaseState { - - obj.obj.ClientId = &value - return obj -} - -// The Circuit ID option found in the last request message. -// CircuitId returns a string -func (obj *dhcpv4LeaseState) CircuitId() string { - - return *obj.obj.CircuitId - -} - -// The Circuit ID option found in the last request message. -// CircuitId returns a string -func (obj *dhcpv4LeaseState) HasCircuitId() bool { - return obj.obj.CircuitId != nil -} - -// The Circuit ID option found in the last request message. -// SetCircuitId sets the string value in the Dhcpv4LeaseState object -func (obj *dhcpv4LeaseState) SetCircuitId(value string) Dhcpv4LeaseState { - - obj.obj.CircuitId = &value - return obj -} - -// The Remote ID option found in the last request message. -// RemoteId returns a string -func (obj *dhcpv4LeaseState) RemoteId() string { - - return *obj.obj.RemoteId - -} - -// The Remote ID option found in the last request message. -// RemoteId returns a string -func (obj *dhcpv4LeaseState) HasRemoteId() bool { - return obj.obj.RemoteId != nil -} - -// The Remote ID option found in the last request message. -// SetRemoteId sets the string value in the Dhcpv4LeaseState object -func (obj *dhcpv4LeaseState) SetRemoteId(value string) Dhcpv4LeaseState { - - obj.obj.RemoteId = &value - return obj -} - -func (obj *dhcpv4LeaseState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *dhcpv4LeaseState) setDefault() { - -} - -// ***** CaptureField ***** -type captureField struct { - validation - obj *otg.CaptureField - marshaller marshalCaptureField - unMarshaller unMarshalCaptureField -} - -func NewCaptureField() CaptureField { - obj := captureField{obj: &otg.CaptureField{}} - obj.setDefault() - return &obj -} - -func (obj *captureField) msg() *otg.CaptureField { - return obj.obj -} - -func (obj *captureField) setMsg(msg *otg.CaptureField) CaptureField { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalcaptureField struct { - obj *captureField -} - -type marshalCaptureField interface { - // ToProto marshals CaptureField to protobuf object *otg.CaptureField - ToProto() (*otg.CaptureField, error) - // ToPbText marshals CaptureField to protobuf text - ToPbText() (string, error) - // ToYaml marshals CaptureField to YAML text - ToYaml() (string, error) - // ToJson marshals CaptureField to JSON text - ToJson() (string, error) -} - -type unMarshalcaptureField struct { - obj *captureField -} - -type unMarshalCaptureField interface { - // FromProto unmarshals CaptureField from protobuf object *otg.CaptureField - FromProto(msg *otg.CaptureField) (CaptureField, error) - // FromPbText unmarshals CaptureField from protobuf text - FromPbText(value string) error - // FromYaml unmarshals CaptureField from YAML text - FromYaml(value string) error - // FromJson unmarshals CaptureField from JSON text - FromJson(value string) error -} - -func (obj *captureField) Marshal() marshalCaptureField { - if obj.marshaller == nil { - obj.marshaller = &marshalcaptureField{obj: obj} - } - return obj.marshaller -} - -func (obj *captureField) Unmarshal() unMarshalCaptureField { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalcaptureField{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalcaptureField) ToProto() (*otg.CaptureField, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalcaptureField) FromProto(msg *otg.CaptureField) (CaptureField, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalcaptureField) 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 *unMarshalcaptureField) 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 *marshalcaptureField) 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 *unMarshalcaptureField) 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 *marshalcaptureField) 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 *unMarshalcaptureField) 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 *captureField) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *captureField) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *captureField) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *captureField) Clone() (CaptureField, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewCaptureField() - 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 -} - -// CaptureField is description is TBD -type CaptureField interface { - Validation - // msg marshals CaptureField to protobuf object *otg.CaptureField - // and doesn't set defaults - msg() *otg.CaptureField - // setMsg unmarshals CaptureField from protobuf object *otg.CaptureField - // and doesn't set defaults - setMsg(*otg.CaptureField) CaptureField - // provides marshal interface - Marshal() marshalCaptureField - // provides unmarshal interface - Unmarshal() unMarshalCaptureField - // validate validates CaptureField - validate() error - // A stringer function - String() string - // Clones the object - Clone() (CaptureField, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Value returns string, set in CaptureField. - Value() string - // SetValue assigns string provided by user to CaptureField - SetValue(value string) CaptureField - // HasValue checks if Value has been set in CaptureField - HasValue() bool - // Mask returns string, set in CaptureField. - Mask() string - // SetMask assigns string provided by user to CaptureField - SetMask(value string) CaptureField - // HasMask checks if Mask has been set in CaptureField - HasMask() bool - // Negate returns bool, set in CaptureField. - Negate() bool - // SetNegate assigns bool provided by user to CaptureField - SetNegate(value bool) CaptureField - // HasNegate checks if Negate has been set in CaptureField - HasNegate() bool -} - -// description is TBD -// Value returns a string -func (obj *captureField) Value() string { - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *captureField) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the CaptureField object -func (obj *captureField) SetValue(value string) CaptureField { - - obj.obj.Value = &value - return obj -} - -// description is TBD -// Mask returns a string -func (obj *captureField) Mask() string { - - return *obj.obj.Mask - -} - -// description is TBD -// Mask returns a string -func (obj *captureField) HasMask() bool { - return obj.obj.Mask != nil -} - -// description is TBD -// SetMask sets the string value in the CaptureField object -func (obj *captureField) SetMask(value string) CaptureField { - - obj.obj.Mask = &value - return obj -} - -// description is TBD -// Negate returns a bool -func (obj *captureField) Negate() bool { - - return *obj.obj.Negate - -} - -// description is TBD -// Negate returns a bool -func (obj *captureField) HasNegate() bool { - return obj.obj.Negate != nil -} - -// description is TBD -// SetNegate sets the bool value in the CaptureField object -func (obj *captureField) SetNegate(value bool) CaptureField { - - obj.obj.Negate = &value - return obj -} - -func (obj *captureField) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateHex(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on CaptureField.Value")) - } - - } - - if obj.obj.Mask != nil { - - err := obj.validateHex(obj.Mask()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on CaptureField.Mask")) - } - - } - -} - -func (obj *captureField) setDefault() { - if obj.obj.Value == nil { - obj.SetValue("00") - } - if obj.obj.Mask == nil { - obj.SetMask("00") - } - if obj.obj.Negate == nil { - obj.SetNegate(false) - } - -} - -// ***** DeviceIpv4GatewayMAC ***** -type deviceIpv4GatewayMAC struct { - validation - obj *otg.DeviceIpv4GatewayMAC - marshaller marshalDeviceIpv4GatewayMAC - unMarshaller unMarshalDeviceIpv4GatewayMAC -} - -func NewDeviceIpv4GatewayMAC() DeviceIpv4GatewayMAC { - obj := deviceIpv4GatewayMAC{obj: &otg.DeviceIpv4GatewayMAC{}} - obj.setDefault() - return &obj -} - -func (obj *deviceIpv4GatewayMAC) msg() *otg.DeviceIpv4GatewayMAC { - return obj.obj -} - -func (obj *deviceIpv4GatewayMAC) setMsg(msg *otg.DeviceIpv4GatewayMAC) DeviceIpv4GatewayMAC { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceIpv4GatewayMAC struct { - obj *deviceIpv4GatewayMAC -} - -type marshalDeviceIpv4GatewayMAC interface { - // ToProto marshals DeviceIpv4GatewayMAC to protobuf object *otg.DeviceIpv4GatewayMAC - ToProto() (*otg.DeviceIpv4GatewayMAC, error) - // ToPbText marshals DeviceIpv4GatewayMAC to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceIpv4GatewayMAC to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceIpv4GatewayMAC to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceIpv4GatewayMAC struct { - obj *deviceIpv4GatewayMAC -} - -type unMarshalDeviceIpv4GatewayMAC interface { - // FromProto unmarshals DeviceIpv4GatewayMAC from protobuf object *otg.DeviceIpv4GatewayMAC - FromProto(msg *otg.DeviceIpv4GatewayMAC) (DeviceIpv4GatewayMAC, error) - // FromPbText unmarshals DeviceIpv4GatewayMAC from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceIpv4GatewayMAC from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceIpv4GatewayMAC from JSON text - FromJson(value string) error -} - -func (obj *deviceIpv4GatewayMAC) Marshal() marshalDeviceIpv4GatewayMAC { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceIpv4GatewayMAC{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceIpv4GatewayMAC) Unmarshal() unMarshalDeviceIpv4GatewayMAC { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceIpv4GatewayMAC{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceIpv4GatewayMAC) ToProto() (*otg.DeviceIpv4GatewayMAC, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceIpv4GatewayMAC) FromProto(msg *otg.DeviceIpv4GatewayMAC) (DeviceIpv4GatewayMAC, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceIpv4GatewayMAC) 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 *unMarshaldeviceIpv4GatewayMAC) 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 *marshaldeviceIpv4GatewayMAC) 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 *unMarshaldeviceIpv4GatewayMAC) 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 *marshaldeviceIpv4GatewayMAC) 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 *unMarshaldeviceIpv4GatewayMAC) 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 *deviceIpv4GatewayMAC) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceIpv4GatewayMAC) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceIpv4GatewayMAC) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceIpv4GatewayMAC) Clone() (DeviceIpv4GatewayMAC, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceIpv4GatewayMAC() - 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 -} - -// DeviceIpv4GatewayMAC is by default auto(resolved gateway mac) is set. Setting a value would mean that ARP will not be used for learning MAC of connected device. The user-configured MAC address will be used for auto-filling the destination -// MAC address in the control and data packets sent from this IPv4 endpoint -// whenever applicable. -type DeviceIpv4GatewayMAC interface { - Validation - // msg marshals DeviceIpv4GatewayMAC to protobuf object *otg.DeviceIpv4GatewayMAC - // and doesn't set defaults - msg() *otg.DeviceIpv4GatewayMAC - // setMsg unmarshals DeviceIpv4GatewayMAC from protobuf object *otg.DeviceIpv4GatewayMAC - // and doesn't set defaults - setMsg(*otg.DeviceIpv4GatewayMAC) DeviceIpv4GatewayMAC - // provides marshal interface - Marshal() marshalDeviceIpv4GatewayMAC - // provides unmarshal interface - Unmarshal() unMarshalDeviceIpv4GatewayMAC - // validate validates DeviceIpv4GatewayMAC - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceIpv4GatewayMAC, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns DeviceIpv4GatewayMACChoiceEnum, set in DeviceIpv4GatewayMAC - Choice() DeviceIpv4GatewayMACChoiceEnum - // setChoice assigns DeviceIpv4GatewayMACChoiceEnum provided by user to DeviceIpv4GatewayMAC - setChoice(value DeviceIpv4GatewayMACChoiceEnum) DeviceIpv4GatewayMAC - // HasChoice checks if Choice has been set in DeviceIpv4GatewayMAC - HasChoice() bool - // Auto returns string, set in DeviceIpv4GatewayMAC. - Auto() string - // HasAuto checks if Auto has been set in DeviceIpv4GatewayMAC - HasAuto() bool - // Value returns string, set in DeviceIpv4GatewayMAC. - Value() string - // SetValue assigns string provided by user to DeviceIpv4GatewayMAC - SetValue(value string) DeviceIpv4GatewayMAC - // HasValue checks if Value has been set in DeviceIpv4GatewayMAC - HasValue() bool -} - -type DeviceIpv4GatewayMACChoiceEnum string - -// Enum of Choice on DeviceIpv4GatewayMAC -var DeviceIpv4GatewayMACChoice = struct { - AUTO DeviceIpv4GatewayMACChoiceEnum - VALUE DeviceIpv4GatewayMACChoiceEnum -}{ - AUTO: DeviceIpv4GatewayMACChoiceEnum("auto"), - VALUE: DeviceIpv4GatewayMACChoiceEnum("value"), -} - -func (obj *deviceIpv4GatewayMAC) Choice() DeviceIpv4GatewayMACChoiceEnum { - return DeviceIpv4GatewayMACChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// auto or configured value. -// Choice returns a string -func (obj *deviceIpv4GatewayMAC) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *deviceIpv4GatewayMAC) setChoice(value DeviceIpv4GatewayMACChoiceEnum) DeviceIpv4GatewayMAC { - intValue, ok := otg.DeviceIpv4GatewayMAC_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on DeviceIpv4GatewayMACChoiceEnum", string(value))) - return obj - } - enumValue := otg.DeviceIpv4GatewayMAC_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Value = nil - obj.obj.Auto = nil - - if value == DeviceIpv4GatewayMACChoice.AUTO { - defaultValue := "00:00:00:00:00:00" - obj.obj.Auto = &defaultValue - } - - if value == DeviceIpv4GatewayMACChoice.VALUE { - defaultValue := "00:00:00:00:00:00" - obj.obj.Value = &defaultValue - } - - return obj -} - -// The OTG implementation can provide a system generated value for this property. If the OTG is unable to generate a value the default value must be used. -// Auto returns a string -func (obj *deviceIpv4GatewayMAC) Auto() string { - - if obj.obj.Auto == nil { - obj.setChoice(DeviceIpv4GatewayMACChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation can provide a system generated value for this property. If the OTG is unable to generate a value the default value must be used. -// Auto returns a string -func (obj *deviceIpv4GatewayMAC) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Value returns a string -func (obj *deviceIpv4GatewayMAC) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(DeviceIpv4GatewayMACChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *deviceIpv4GatewayMAC) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the DeviceIpv4GatewayMAC object -func (obj *deviceIpv4GatewayMAC) SetValue(value string) DeviceIpv4GatewayMAC { - obj.setChoice(DeviceIpv4GatewayMACChoice.VALUE) - obj.obj.Value = &value - return obj -} - -func (obj *deviceIpv4GatewayMAC) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Auto != nil { - - err := obj.validateMac(obj.Auto()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv4GatewayMAC.Auto")) - } - - } - - if obj.obj.Value != nil { - - err := obj.validateMac(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv4GatewayMAC.Value")) - } - - } - -} - -func (obj *deviceIpv4GatewayMAC) setDefault() { - var choices_set int = 0 - var choice DeviceIpv4GatewayMACChoiceEnum - - if obj.obj.Auto != nil { - choices_set += 1 - choice = DeviceIpv4GatewayMACChoice.AUTO - } - - if obj.obj.Value != nil { - choices_set += 1 - choice = DeviceIpv4GatewayMACChoice.VALUE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(DeviceIpv4GatewayMACChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in DeviceIpv4GatewayMAC") - } - } else { - intVal := otg.DeviceIpv4GatewayMAC_Choice_Enum_value[string(choice)] - enumValue := otg.DeviceIpv4GatewayMAC_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** DeviceIpv6GatewayMAC ***** -type deviceIpv6GatewayMAC struct { - validation - obj *otg.DeviceIpv6GatewayMAC - marshaller marshalDeviceIpv6GatewayMAC - unMarshaller unMarshalDeviceIpv6GatewayMAC -} - -func NewDeviceIpv6GatewayMAC() DeviceIpv6GatewayMAC { - obj := deviceIpv6GatewayMAC{obj: &otg.DeviceIpv6GatewayMAC{}} - obj.setDefault() - return &obj -} - -func (obj *deviceIpv6GatewayMAC) msg() *otg.DeviceIpv6GatewayMAC { - return obj.obj -} - -func (obj *deviceIpv6GatewayMAC) setMsg(msg *otg.DeviceIpv6GatewayMAC) DeviceIpv6GatewayMAC { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceIpv6GatewayMAC struct { - obj *deviceIpv6GatewayMAC -} - -type marshalDeviceIpv6GatewayMAC interface { - // ToProto marshals DeviceIpv6GatewayMAC to protobuf object *otg.DeviceIpv6GatewayMAC - ToProto() (*otg.DeviceIpv6GatewayMAC, error) - // ToPbText marshals DeviceIpv6GatewayMAC to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceIpv6GatewayMAC to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceIpv6GatewayMAC to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceIpv6GatewayMAC struct { - obj *deviceIpv6GatewayMAC -} - -type unMarshalDeviceIpv6GatewayMAC interface { - // FromProto unmarshals DeviceIpv6GatewayMAC from protobuf object *otg.DeviceIpv6GatewayMAC - FromProto(msg *otg.DeviceIpv6GatewayMAC) (DeviceIpv6GatewayMAC, error) - // FromPbText unmarshals DeviceIpv6GatewayMAC from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceIpv6GatewayMAC from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceIpv6GatewayMAC from JSON text - FromJson(value string) error -} - -func (obj *deviceIpv6GatewayMAC) Marshal() marshalDeviceIpv6GatewayMAC { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceIpv6GatewayMAC{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceIpv6GatewayMAC) Unmarshal() unMarshalDeviceIpv6GatewayMAC { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceIpv6GatewayMAC{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceIpv6GatewayMAC) ToProto() (*otg.DeviceIpv6GatewayMAC, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceIpv6GatewayMAC) FromProto(msg *otg.DeviceIpv6GatewayMAC) (DeviceIpv6GatewayMAC, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceIpv6GatewayMAC) 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 *unMarshaldeviceIpv6GatewayMAC) 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 *marshaldeviceIpv6GatewayMAC) 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 *unMarshaldeviceIpv6GatewayMAC) 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 *marshaldeviceIpv6GatewayMAC) 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 *unMarshaldeviceIpv6GatewayMAC) 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 *deviceIpv6GatewayMAC) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceIpv6GatewayMAC) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceIpv6GatewayMAC) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceIpv6GatewayMAC) Clone() (DeviceIpv6GatewayMAC, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceIpv6GatewayMAC() - 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 -} - -// DeviceIpv6GatewayMAC is by default auto(resolved gateway mac) is set. Setting a value would mean that ND will not be used for learning MAC of connected device. The user-configured MAC address will be used for auto-filling the destination -// MAC address in the control and data packets sent from this IPv6 endpoint -// whenever applicable. -type DeviceIpv6GatewayMAC interface { - Validation - // msg marshals DeviceIpv6GatewayMAC to protobuf object *otg.DeviceIpv6GatewayMAC - // and doesn't set defaults - msg() *otg.DeviceIpv6GatewayMAC - // setMsg unmarshals DeviceIpv6GatewayMAC from protobuf object *otg.DeviceIpv6GatewayMAC - // and doesn't set defaults - setMsg(*otg.DeviceIpv6GatewayMAC) DeviceIpv6GatewayMAC - // provides marshal interface - Marshal() marshalDeviceIpv6GatewayMAC - // provides unmarshal interface - Unmarshal() unMarshalDeviceIpv6GatewayMAC - // validate validates DeviceIpv6GatewayMAC - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceIpv6GatewayMAC, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns DeviceIpv6GatewayMACChoiceEnum, set in DeviceIpv6GatewayMAC - Choice() DeviceIpv6GatewayMACChoiceEnum - // setChoice assigns DeviceIpv6GatewayMACChoiceEnum provided by user to DeviceIpv6GatewayMAC - setChoice(value DeviceIpv6GatewayMACChoiceEnum) DeviceIpv6GatewayMAC - // HasChoice checks if Choice has been set in DeviceIpv6GatewayMAC - HasChoice() bool - // Auto returns string, set in DeviceIpv6GatewayMAC. - Auto() string - // HasAuto checks if Auto has been set in DeviceIpv6GatewayMAC - HasAuto() bool - // Value returns string, set in DeviceIpv6GatewayMAC. - Value() string - // SetValue assigns string provided by user to DeviceIpv6GatewayMAC - SetValue(value string) DeviceIpv6GatewayMAC - // HasValue checks if Value has been set in DeviceIpv6GatewayMAC - HasValue() bool -} - -type DeviceIpv6GatewayMACChoiceEnum string - -// Enum of Choice on DeviceIpv6GatewayMAC -var DeviceIpv6GatewayMACChoice = struct { - AUTO DeviceIpv6GatewayMACChoiceEnum - VALUE DeviceIpv6GatewayMACChoiceEnum -}{ - AUTO: DeviceIpv6GatewayMACChoiceEnum("auto"), - VALUE: DeviceIpv6GatewayMACChoiceEnum("value"), -} - -func (obj *deviceIpv6GatewayMAC) Choice() DeviceIpv6GatewayMACChoiceEnum { - return DeviceIpv6GatewayMACChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// auto or configured value. -// Choice returns a string -func (obj *deviceIpv6GatewayMAC) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *deviceIpv6GatewayMAC) setChoice(value DeviceIpv6GatewayMACChoiceEnum) DeviceIpv6GatewayMAC { - intValue, ok := otg.DeviceIpv6GatewayMAC_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on DeviceIpv6GatewayMACChoiceEnum", string(value))) - return obj - } - enumValue := otg.DeviceIpv6GatewayMAC_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Value = nil - obj.obj.Auto = nil - - if value == DeviceIpv6GatewayMACChoice.AUTO { - defaultValue := "00:00:00:00:00:00" - obj.obj.Auto = &defaultValue - } - - if value == DeviceIpv6GatewayMACChoice.VALUE { - defaultValue := "00:00:00:00:00:00" - obj.obj.Value = &defaultValue - } - - return obj -} - -// The OTG implementation can provide a system generated value for this property. If the OTG is unable to generate a value the default value must be used. -// Auto returns a string -func (obj *deviceIpv6GatewayMAC) Auto() string { - - if obj.obj.Auto == nil { - obj.setChoice(DeviceIpv6GatewayMACChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation can provide a system generated value for this property. If the OTG is unable to generate a value the default value must be used. -// Auto returns a string -func (obj *deviceIpv6GatewayMAC) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Value returns a string -func (obj *deviceIpv6GatewayMAC) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(DeviceIpv6GatewayMACChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *deviceIpv6GatewayMAC) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the DeviceIpv6GatewayMAC object -func (obj *deviceIpv6GatewayMAC) SetValue(value string) DeviceIpv6GatewayMAC { - obj.setChoice(DeviceIpv6GatewayMACChoice.VALUE) - obj.obj.Value = &value - return obj -} - -func (obj *deviceIpv6GatewayMAC) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Auto != nil { - - err := obj.validateMac(obj.Auto()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv6GatewayMAC.Auto")) - } - - } - - if obj.obj.Value != nil { - - err := obj.validateMac(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DeviceIpv6GatewayMAC.Value")) - } - - } - -} - -func (obj *deviceIpv6GatewayMAC) setDefault() { - var choices_set int = 0 - var choice DeviceIpv6GatewayMACChoiceEnum - - if obj.obj.Auto != nil { - choices_set += 1 - choice = DeviceIpv6GatewayMACChoice.AUTO - } - - if obj.obj.Value != nil { - choices_set += 1 - choice = DeviceIpv6GatewayMACChoice.VALUE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(DeviceIpv6GatewayMACChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in DeviceIpv6GatewayMAC") - } - } else { - intVal := otg.DeviceIpv6GatewayMAC_Choice_Enum_value[string(choice)] - enumValue := otg.DeviceIpv6GatewayMAC_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** Dhcpv4ClientParams ***** -type dhcpv4ClientParams struct { - validation - obj *otg.Dhcpv4ClientParams - marshaller marshalDhcpv4ClientParams - unMarshaller unMarshalDhcpv4ClientParams -} - -func NewDhcpv4ClientParams() Dhcpv4ClientParams { - obj := dhcpv4ClientParams{obj: &otg.Dhcpv4ClientParams{}} - obj.setDefault() - return &obj -} - -func (obj *dhcpv4ClientParams) msg() *otg.Dhcpv4ClientParams { - return obj.obj -} - -func (obj *dhcpv4ClientParams) setMsg(msg *otg.Dhcpv4ClientParams) Dhcpv4ClientParams { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldhcpv4ClientParams struct { - obj *dhcpv4ClientParams -} - -type marshalDhcpv4ClientParams interface { - // ToProto marshals Dhcpv4ClientParams to protobuf object *otg.Dhcpv4ClientParams - ToProto() (*otg.Dhcpv4ClientParams, error) - // ToPbText marshals Dhcpv4ClientParams to protobuf text - ToPbText() (string, error) - // ToYaml marshals Dhcpv4ClientParams to YAML text - ToYaml() (string, error) - // ToJson marshals Dhcpv4ClientParams to JSON text - ToJson() (string, error) -} - -type unMarshaldhcpv4ClientParams struct { - obj *dhcpv4ClientParams -} - -type unMarshalDhcpv4ClientParams interface { - // FromProto unmarshals Dhcpv4ClientParams from protobuf object *otg.Dhcpv4ClientParams - FromProto(msg *otg.Dhcpv4ClientParams) (Dhcpv4ClientParams, error) - // FromPbText unmarshals Dhcpv4ClientParams from protobuf text - FromPbText(value string) error - // FromYaml unmarshals Dhcpv4ClientParams from YAML text - FromYaml(value string) error - // FromJson unmarshals Dhcpv4ClientParams from JSON text - FromJson(value string) error -} - -func (obj *dhcpv4ClientParams) Marshal() marshalDhcpv4ClientParams { - if obj.marshaller == nil { - obj.marshaller = &marshaldhcpv4ClientParams{obj: obj} - } - return obj.marshaller -} - -func (obj *dhcpv4ClientParams) Unmarshal() unMarshalDhcpv4ClientParams { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldhcpv4ClientParams{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldhcpv4ClientParams) ToProto() (*otg.Dhcpv4ClientParams, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldhcpv4ClientParams) FromProto(msg *otg.Dhcpv4ClientParams) (Dhcpv4ClientParams, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldhcpv4ClientParams) 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 *unMarshaldhcpv4ClientParams) 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 *marshaldhcpv4ClientParams) 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 *unMarshaldhcpv4ClientParams) 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 *marshaldhcpv4ClientParams) 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 *unMarshaldhcpv4ClientParams) 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 *dhcpv4ClientParams) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *dhcpv4ClientParams) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *dhcpv4ClientParams) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *dhcpv4ClientParams) Clone() (Dhcpv4ClientParams, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDhcpv4ClientParams() - 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 -} - -// Dhcpv4ClientParams is configuration Parameter request list by emulated DHCPv4 Client. -type Dhcpv4ClientParams interface { - Validation - // msg marshals Dhcpv4ClientParams to protobuf object *otg.Dhcpv4ClientParams - // and doesn't set defaults - msg() *otg.Dhcpv4ClientParams - // setMsg unmarshals Dhcpv4ClientParams from protobuf object *otg.Dhcpv4ClientParams - // and doesn't set defaults - setMsg(*otg.Dhcpv4ClientParams) Dhcpv4ClientParams - // provides marshal interface - Marshal() marshalDhcpv4ClientParams - // provides unmarshal interface - Unmarshal() unMarshalDhcpv4ClientParams - // validate validates Dhcpv4ClientParams - validate() error - // A stringer function - String() string - // Clones the object - Clone() (Dhcpv4ClientParams, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // SubnetMask returns bool, set in Dhcpv4ClientParams. - SubnetMask() bool - // SetSubnetMask assigns bool provided by user to Dhcpv4ClientParams - SetSubnetMask(value bool) Dhcpv4ClientParams - // HasSubnetMask checks if SubnetMask has been set in Dhcpv4ClientParams - HasSubnetMask() bool - // Router returns bool, set in Dhcpv4ClientParams. - Router() bool - // SetRouter assigns bool provided by user to Dhcpv4ClientParams - SetRouter(value bool) Dhcpv4ClientParams - // HasRouter checks if Router has been set in Dhcpv4ClientParams - HasRouter() bool - // RenewalTimer returns bool, set in Dhcpv4ClientParams. - RenewalTimer() bool - // SetRenewalTimer assigns bool provided by user to Dhcpv4ClientParams - SetRenewalTimer(value bool) Dhcpv4ClientParams - // HasRenewalTimer checks if RenewalTimer has been set in Dhcpv4ClientParams - HasRenewalTimer() bool - // RebindingTimer returns bool, set in Dhcpv4ClientParams. - RebindingTimer() bool - // SetRebindingTimer assigns bool provided by user to Dhcpv4ClientParams - SetRebindingTimer(value bool) Dhcpv4ClientParams - // HasRebindingTimer checks if RebindingTimer has been set in Dhcpv4ClientParams - HasRebindingTimer() bool -} - -// Request for the subnet mask option specifies the client's subnet mask as per RFC950. -// SubnetMask returns a bool -func (obj *dhcpv4ClientParams) SubnetMask() bool { - - return *obj.obj.SubnetMask - -} - -// Request for the subnet mask option specifies the client's subnet mask as per RFC950. -// SubnetMask returns a bool -func (obj *dhcpv4ClientParams) HasSubnetMask() bool { - return obj.obj.SubnetMask != nil -} - -// Request for the subnet mask option specifies the client's subnet mask as per RFC950. -// SetSubnetMask sets the bool value in the Dhcpv4ClientParams object -func (obj *dhcpv4ClientParams) SetSubnetMask(value bool) Dhcpv4ClientParams { - - obj.obj.SubnetMask = &value - return obj -} - -// Request for the router option that specifies a list of IP addresses for routers on the client's subnet. -// Router returns a bool -func (obj *dhcpv4ClientParams) Router() bool { - - return *obj.obj.Router - -} - -// Request for the router option that specifies a list of IP addresses for routers on the client's subnet. -// Router returns a bool -func (obj *dhcpv4ClientParams) HasRouter() bool { - return obj.obj.Router != nil -} - -// Request for the router option that specifies a list of IP addresses for routers on the client's subnet. -// SetRouter sets the bool value in the Dhcpv4ClientParams object -func (obj *dhcpv4ClientParams) SetRouter(value bool) Dhcpv4ClientParams { - - obj.obj.Router = &value - return obj -} - -// Request for the renewal timer, T1. When the timer expires, the client transitions from the BOUND state to the RENEWING state. -// RenewalTimer returns a bool -func (obj *dhcpv4ClientParams) RenewalTimer() bool { - - return *obj.obj.RenewalTimer - -} - -// Request for the renewal timer, T1. When the timer expires, the client transitions from the BOUND state to the RENEWING state. -// RenewalTimer returns a bool -func (obj *dhcpv4ClientParams) HasRenewalTimer() bool { - return obj.obj.RenewalTimer != nil -} - -// Request for the renewal timer, T1. When the timer expires, the client transitions from the BOUND state to the RENEWING state. -// SetRenewalTimer sets the bool value in the Dhcpv4ClientParams object -func (obj *dhcpv4ClientParams) SetRenewalTimer(value bool) Dhcpv4ClientParams { - - obj.obj.RenewalTimer = &value - return obj -} - -// Request for the rebinding timer (T2). When expires, the client transitions to the REBINDING state. -// RebindingTimer returns a bool -func (obj *dhcpv4ClientParams) RebindingTimer() bool { - - return *obj.obj.RebindingTimer - -} - -// Request for the rebinding timer (T2). When expires, the client transitions to the REBINDING state. -// RebindingTimer returns a bool -func (obj *dhcpv4ClientParams) HasRebindingTimer() bool { - return obj.obj.RebindingTimer != nil -} - -// Request for the rebinding timer (T2). When expires, the client transitions to the REBINDING state. -// SetRebindingTimer sets the bool value in the Dhcpv4ClientParams object -func (obj *dhcpv4ClientParams) SetRebindingTimer(value bool) Dhcpv4ClientParams { - - obj.obj.RebindingTimer = &value - return obj -} - -func (obj *dhcpv4ClientParams) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *dhcpv4ClientParams) setDefault() { - if obj.obj.SubnetMask == nil { - obj.SetSubnetMask(true) - } - if obj.obj.Router == nil { - obj.SetRouter(true) - } - if obj.obj.RenewalTimer == nil { - obj.SetRenewalTimer(false) - } - if obj.obj.RebindingTimer == nil { - obj.SetRebindingTimer(false) - } - -} - -// ***** IsisInterfaceLevel ***** -type isisInterfaceLevel struct { - validation - obj *otg.IsisInterfaceLevel - marshaller marshalIsisInterfaceLevel - unMarshaller unMarshalIsisInterfaceLevel -} - -func NewIsisInterfaceLevel() IsisInterfaceLevel { - obj := isisInterfaceLevel{obj: &otg.IsisInterfaceLevel{}} - obj.setDefault() - return &obj -} - -func (obj *isisInterfaceLevel) msg() *otg.IsisInterfaceLevel { - return obj.obj -} - -func (obj *isisInterfaceLevel) setMsg(msg *otg.IsisInterfaceLevel) IsisInterfaceLevel { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisInterfaceLevel struct { - obj *isisInterfaceLevel -} - -type marshalIsisInterfaceLevel interface { - // ToProto marshals IsisInterfaceLevel to protobuf object *otg.IsisInterfaceLevel - ToProto() (*otg.IsisInterfaceLevel, error) - // ToPbText marshals IsisInterfaceLevel to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisInterfaceLevel to YAML text - ToYaml() (string, error) - // ToJson marshals IsisInterfaceLevel to JSON text - ToJson() (string, error) -} - -type unMarshalisisInterfaceLevel struct { - obj *isisInterfaceLevel -} - -type unMarshalIsisInterfaceLevel interface { - // FromProto unmarshals IsisInterfaceLevel from protobuf object *otg.IsisInterfaceLevel - FromProto(msg *otg.IsisInterfaceLevel) (IsisInterfaceLevel, error) - // FromPbText unmarshals IsisInterfaceLevel from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisInterfaceLevel from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisInterfaceLevel from JSON text - FromJson(value string) error -} - -func (obj *isisInterfaceLevel) Marshal() marshalIsisInterfaceLevel { - if obj.marshaller == nil { - obj.marshaller = &marshalisisInterfaceLevel{obj: obj} - } - return obj.marshaller -} - -func (obj *isisInterfaceLevel) Unmarshal() unMarshalIsisInterfaceLevel { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisInterfaceLevel{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisInterfaceLevel) ToProto() (*otg.IsisInterfaceLevel, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisInterfaceLevel) FromProto(msg *otg.IsisInterfaceLevel) (IsisInterfaceLevel, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisInterfaceLevel) 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 *unMarshalisisInterfaceLevel) 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 *marshalisisInterfaceLevel) 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 *unMarshalisisInterfaceLevel) 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 *marshalisisInterfaceLevel) 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 *unMarshalisisInterfaceLevel) 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 *isisInterfaceLevel) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisInterfaceLevel) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisInterfaceLevel) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisInterfaceLevel) Clone() (IsisInterfaceLevel, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisInterfaceLevel() - 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 -} - -// IsisInterfaceLevel is configuration for the properties of Level 1 Hello. -type IsisInterfaceLevel interface { - Validation - // msg marshals IsisInterfaceLevel to protobuf object *otg.IsisInterfaceLevel - // and doesn't set defaults - msg() *otg.IsisInterfaceLevel - // setMsg unmarshals IsisInterfaceLevel from protobuf object *otg.IsisInterfaceLevel - // and doesn't set defaults - setMsg(*otg.IsisInterfaceLevel) IsisInterfaceLevel - // provides marshal interface - Marshal() marshalIsisInterfaceLevel - // provides unmarshal interface - Unmarshal() unMarshalIsisInterfaceLevel - // validate validates IsisInterfaceLevel - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisInterfaceLevel, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Priority returns uint32, set in IsisInterfaceLevel. - Priority() uint32 - // SetPriority assigns uint32 provided by user to IsisInterfaceLevel - SetPriority(value uint32) IsisInterfaceLevel - // HasPriority checks if Priority has been set in IsisInterfaceLevel - HasPriority() bool - // HelloInterval returns uint32, set in IsisInterfaceLevel. - HelloInterval() uint32 - // SetHelloInterval assigns uint32 provided by user to IsisInterfaceLevel - SetHelloInterval(value uint32) IsisInterfaceLevel - // HasHelloInterval checks if HelloInterval has been set in IsisInterfaceLevel - HasHelloInterval() bool - // DeadInterval returns uint32, set in IsisInterfaceLevel. - DeadInterval() uint32 - // SetDeadInterval assigns uint32 provided by user to IsisInterfaceLevel - SetDeadInterval(value uint32) IsisInterfaceLevel - // HasDeadInterval checks if DeadInterval has been set in IsisInterfaceLevel - HasDeadInterval() bool -} - -// The Priority setting in Level 1 LAN Hellos for Designated Router election. -// Priority returns a uint32 -func (obj *isisInterfaceLevel) Priority() uint32 { - - return *obj.obj.Priority - -} - -// The Priority setting in Level 1 LAN Hellos for Designated Router election. -// Priority returns a uint32 -func (obj *isisInterfaceLevel) HasPriority() bool { - return obj.obj.Priority != nil -} - -// The Priority setting in Level 1 LAN Hellos for Designated Router election. -// SetPriority sets the uint32 value in the IsisInterfaceLevel object -func (obj *isisInterfaceLevel) SetPriority(value uint32) IsisInterfaceLevel { - - obj.obj.Priority = &value - return obj -} - -// The Hello interval for Level 1 Hello messages, in seconds. -// HelloInterval returns a uint32 -func (obj *isisInterfaceLevel) HelloInterval() uint32 { - - return *obj.obj.HelloInterval - -} - -// The Hello interval for Level 1 Hello messages, in seconds. -// HelloInterval returns a uint32 -func (obj *isisInterfaceLevel) HasHelloInterval() bool { - return obj.obj.HelloInterval != nil -} - -// The Hello interval for Level 1 Hello messages, in seconds. -// SetHelloInterval sets the uint32 value in the IsisInterfaceLevel object -func (obj *isisInterfaceLevel) SetHelloInterval(value uint32) IsisInterfaceLevel { - - obj.obj.HelloInterval = &value - return obj -} - -// The Dead (Holding Time) interval for Level 1 Hello messages, in seconds. -// DeadInterval returns a uint32 -func (obj *isisInterfaceLevel) DeadInterval() uint32 { - - return *obj.obj.DeadInterval - -} - -// The Dead (Holding Time) interval for Level 1 Hello messages, in seconds. -// DeadInterval returns a uint32 -func (obj *isisInterfaceLevel) HasDeadInterval() bool { - return obj.obj.DeadInterval != nil -} - -// The Dead (Holding Time) interval for Level 1 Hello messages, in seconds. -// SetDeadInterval sets the uint32 value in the IsisInterfaceLevel object -func (obj *isisInterfaceLevel) SetDeadInterval(value uint32) IsisInterfaceLevel { - - obj.obj.DeadInterval = &value - return obj -} - -func (obj *isisInterfaceLevel) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *isisInterfaceLevel) setDefault() { - if obj.obj.Priority == nil { - obj.SetPriority(0) - } - if obj.obj.HelloInterval == nil { - obj.SetHelloInterval(10) - } - if obj.obj.DeadInterval == nil { - obj.SetDeadInterval(30) - } - -} - -// ***** IsisMT ***** -type isisMT struct { - validation - obj *otg.IsisMT - marshaller marshalIsisMT - unMarshaller unMarshalIsisMT -} - -func NewIsisMT() IsisMT { - obj := isisMT{obj: &otg.IsisMT{}} - obj.setDefault() - return &obj -} - -func (obj *isisMT) msg() *otg.IsisMT { - return obj.obj -} - -func (obj *isisMT) setMsg(msg *otg.IsisMT) IsisMT { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisMT struct { - obj *isisMT -} - -type marshalIsisMT interface { - // ToProto marshals IsisMT to protobuf object *otg.IsisMT - ToProto() (*otg.IsisMT, error) - // ToPbText marshals IsisMT to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisMT to YAML text - ToYaml() (string, error) - // ToJson marshals IsisMT to JSON text - ToJson() (string, error) -} - -type unMarshalisisMT struct { - obj *isisMT -} - -type unMarshalIsisMT interface { - // FromProto unmarshals IsisMT from protobuf object *otg.IsisMT - FromProto(msg *otg.IsisMT) (IsisMT, error) - // FromPbText unmarshals IsisMT from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisMT from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisMT from JSON text - FromJson(value string) error -} - -func (obj *isisMT) Marshal() marshalIsisMT { - if obj.marshaller == nil { - obj.marshaller = &marshalisisMT{obj: obj} - } - return obj.marshaller -} - -func (obj *isisMT) Unmarshal() unMarshalIsisMT { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisMT{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisMT) ToProto() (*otg.IsisMT, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisMT) FromProto(msg *otg.IsisMT) (IsisMT, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisMT) 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 *unMarshalisisMT) 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 *marshalisisMT) 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 *unMarshalisisMT) 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 *marshalisisMT) 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 *unMarshalisisMT) 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 *isisMT) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisMT) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisMT) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisMT) Clone() (IsisMT, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisMT() - 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 -} - -// IsisMT is configuration of properties per interface per topology when multiple topologies are configured in an ISIS router. -// in a ISIS router. -type IsisMT interface { - Validation - // msg marshals IsisMT to protobuf object *otg.IsisMT - // and doesn't set defaults - msg() *otg.IsisMT - // setMsg unmarshals IsisMT from protobuf object *otg.IsisMT - // and doesn't set defaults - setMsg(*otg.IsisMT) IsisMT - // provides marshal interface - Marshal() marshalIsisMT - // provides unmarshal interface - Unmarshal() unMarshalIsisMT - // validate validates IsisMT - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisMT, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // MtId returns uint32, set in IsisMT. - MtId() uint32 - // SetMtId assigns uint32 provided by user to IsisMT - SetMtId(value uint32) IsisMT - // HasMtId checks if MtId has been set in IsisMT - HasMtId() bool - // LinkMetric returns uint32, set in IsisMT. - LinkMetric() uint32 - // SetLinkMetric assigns uint32 provided by user to IsisMT - SetLinkMetric(value uint32) IsisMT - // HasLinkMetric checks if LinkMetric has been set in IsisMT - HasLinkMetric() bool -} - -// The Multi Topology ID for one of the topologies supported on the ISIS interface. -// MtId returns a uint32 -func (obj *isisMT) MtId() uint32 { - - return *obj.obj.MtId - -} - -// The Multi Topology ID for one of the topologies supported on the ISIS interface. -// MtId returns a uint32 -func (obj *isisMT) HasMtId() bool { - return obj.obj.MtId != nil -} - -// The Multi Topology ID for one of the topologies supported on the ISIS interface. -// SetMtId sets the uint32 value in the IsisMT object -func (obj *isisMT) SetMtId(value uint32) IsisMT { - - obj.obj.MtId = &value - return obj -} - -// Specifies the link metric for this topology on the ISIS interface. -// LinkMetric returns a uint32 -func (obj *isisMT) LinkMetric() uint32 { - - return *obj.obj.LinkMetric - -} - -// Specifies the link metric for this topology on the ISIS interface. -// LinkMetric returns a uint32 -func (obj *isisMT) HasLinkMetric() bool { - return obj.obj.LinkMetric != nil -} - -// Specifies the link metric for this topology on the ISIS interface. -// SetLinkMetric sets the uint32 value in the IsisMT object -func (obj *isisMT) SetLinkMetric(value uint32) IsisMT { - - obj.obj.LinkMetric = &value - return obj -} - -func (obj *isisMT) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.MtId != nil { - - if *obj.obj.MtId > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= IsisMT.MtId <= 65535 but Got %d", *obj.obj.MtId)) - } - - } - - if obj.obj.LinkMetric != nil { - - if *obj.obj.LinkMetric > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= IsisMT.LinkMetric <= 16777215 but Got %d", *obj.obj.LinkMetric)) - } - - } - -} - -func (obj *isisMT) setDefault() { - if obj.obj.MtId == nil { - obj.SetMtId(0) - } - if obj.obj.LinkMetric == nil { - obj.SetLinkMetric(10) - } - -} - -// ***** LinkStateTE ***** -type linkStateTE struct { - validation - obj *otg.LinkStateTE - marshaller marshalLinkStateTE - unMarshaller unMarshalLinkStateTE - priorityBandwidthsHolder LinkStatepriorityBandwidths -} - -func NewLinkStateTE() LinkStateTE { - obj := linkStateTE{obj: &otg.LinkStateTE{}} - obj.setDefault() - return &obj -} - -func (obj *linkStateTE) msg() *otg.LinkStateTE { - return obj.obj -} - -func (obj *linkStateTE) setMsg(msg *otg.LinkStateTE) LinkStateTE { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshallinkStateTE struct { - obj *linkStateTE -} - -type marshalLinkStateTE interface { - // ToProto marshals LinkStateTE to protobuf object *otg.LinkStateTE - ToProto() (*otg.LinkStateTE, error) - // ToPbText marshals LinkStateTE to protobuf text - ToPbText() (string, error) - // ToYaml marshals LinkStateTE to YAML text - ToYaml() (string, error) - // ToJson marshals LinkStateTE to JSON text - ToJson() (string, error) -} - -type unMarshallinkStateTE struct { - obj *linkStateTE -} - -type unMarshalLinkStateTE interface { - // FromProto unmarshals LinkStateTE from protobuf object *otg.LinkStateTE - FromProto(msg *otg.LinkStateTE) (LinkStateTE, error) - // FromPbText unmarshals LinkStateTE from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LinkStateTE from YAML text - FromYaml(value string) error - // FromJson unmarshals LinkStateTE from JSON text - FromJson(value string) error -} - -func (obj *linkStateTE) Marshal() marshalLinkStateTE { - if obj.marshaller == nil { - obj.marshaller = &marshallinkStateTE{obj: obj} - } - return obj.marshaller -} - -func (obj *linkStateTE) Unmarshal() unMarshalLinkStateTE { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallinkStateTE{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallinkStateTE) ToProto() (*otg.LinkStateTE, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallinkStateTE) FromProto(msg *otg.LinkStateTE) (LinkStateTE, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallinkStateTE) 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 *unMarshallinkStateTE) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshallinkStateTE) 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 *unMarshallinkStateTE) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshallinkStateTE) 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 *unMarshallinkStateTE) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *linkStateTE) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *linkStateTE) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *linkStateTE) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *linkStateTE) Clone() (LinkStateTE, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLinkStateTE() - 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 -} - -func (obj *linkStateTE) setNil() { - obj.priorityBandwidthsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// LinkStateTE is a container for Traffic Engineering properties on a interface. -type LinkStateTE interface { - Validation - // msg marshals LinkStateTE to protobuf object *otg.LinkStateTE - // and doesn't set defaults - msg() *otg.LinkStateTE - // setMsg unmarshals LinkStateTE from protobuf object *otg.LinkStateTE - // and doesn't set defaults - setMsg(*otg.LinkStateTE) LinkStateTE - // provides marshal interface - Marshal() marshalLinkStateTE - // provides unmarshal interface - Unmarshal() unMarshalLinkStateTE - // validate validates LinkStateTE - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LinkStateTE, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // AdministrativeGroup returns string, set in LinkStateTE. - AdministrativeGroup() string - // SetAdministrativeGroup assigns string provided by user to LinkStateTE - SetAdministrativeGroup(value string) LinkStateTE - // HasAdministrativeGroup checks if AdministrativeGroup has been set in LinkStateTE - HasAdministrativeGroup() bool - // MetricLevel returns uint32, set in LinkStateTE. - MetricLevel() uint32 - // SetMetricLevel assigns uint32 provided by user to LinkStateTE - SetMetricLevel(value uint32) LinkStateTE - // HasMetricLevel checks if MetricLevel has been set in LinkStateTE - HasMetricLevel() bool - // MaxBandwith returns uint32, set in LinkStateTE. - MaxBandwith() uint32 - // SetMaxBandwith assigns uint32 provided by user to LinkStateTE - SetMaxBandwith(value uint32) LinkStateTE - // HasMaxBandwith checks if MaxBandwith has been set in LinkStateTE - HasMaxBandwith() bool - // MaxReservableBandwidth returns uint32, set in LinkStateTE. - MaxReservableBandwidth() uint32 - // SetMaxReservableBandwidth assigns uint32 provided by user to LinkStateTE - SetMaxReservableBandwidth(value uint32) LinkStateTE - // HasMaxReservableBandwidth checks if MaxReservableBandwidth has been set in LinkStateTE - HasMaxReservableBandwidth() bool - // PriorityBandwidths returns LinkStatepriorityBandwidths, set in LinkStateTE. - // LinkStatepriorityBandwidths is specifies the amount of bandwidth that can be reserved with a setup priority of 0 - // through 7, arranged in increasing order with priority 0 having highest priority. - // In ISIS, this is sent in sub-TLV (11) of Extended IS Reachability TLV. - PriorityBandwidths() LinkStatepriorityBandwidths - // SetPriorityBandwidths assigns LinkStatepriorityBandwidths provided by user to LinkStateTE. - // LinkStatepriorityBandwidths is specifies the amount of bandwidth that can be reserved with a setup priority of 0 - // through 7, arranged in increasing order with priority 0 having highest priority. - // In ISIS, this is sent in sub-TLV (11) of Extended IS Reachability TLV. - SetPriorityBandwidths(value LinkStatepriorityBandwidths) LinkStateTE - // HasPriorityBandwidths checks if PriorityBandwidths has been set in LinkStateTE - HasPriorityBandwidths() bool - setNil() -} - -// The Administrative group sub-TLV (sub-TLV 3). It is a 4-octet -// user-defined bit mask used to assign administrative group numbers -// to the interface, for use in assigning colors and resource classes. -// Each set bit corresponds to a single administrative group for this -// interface. The settings translate into Group numbers, which range -// from 0 to 31 (integers). -// AdministrativeGroup returns a string -func (obj *linkStateTE) AdministrativeGroup() string { - - return *obj.obj.AdministrativeGroup - -} - -// The Administrative group sub-TLV (sub-TLV 3). It is a 4-octet -// user-defined bit mask used to assign administrative group numbers -// to the interface, for use in assigning colors and resource classes. -// Each set bit corresponds to a single administrative group for this -// interface. The settings translate into Group numbers, which range -// from 0 to 31 (integers). -// AdministrativeGroup returns a string -func (obj *linkStateTE) HasAdministrativeGroup() bool { - return obj.obj.AdministrativeGroup != nil -} - -// The Administrative group sub-TLV (sub-TLV 3). It is a 4-octet -// user-defined bit mask used to assign administrative group numbers -// to the interface, for use in assigning colors and resource classes. -// Each set bit corresponds to a single administrative group for this -// interface. The settings translate into Group numbers, which range -// from 0 to 31 (integers). -// SetAdministrativeGroup sets the string value in the LinkStateTE object -func (obj *linkStateTE) SetAdministrativeGroup(value string) LinkStateTE { - - obj.obj.AdministrativeGroup = &value - return obj -} - -// The user-assigned link metric for Traffic Engineering. -// MetricLevel returns a uint32 -func (obj *linkStateTE) MetricLevel() uint32 { - - return *obj.obj.MetricLevel - -} - -// The user-assigned link metric for Traffic Engineering. -// MetricLevel returns a uint32 -func (obj *linkStateTE) HasMetricLevel() bool { - return obj.obj.MetricLevel != nil -} - -// The user-assigned link metric for Traffic Engineering. -// SetMetricLevel sets the uint32 value in the LinkStateTE object -func (obj *linkStateTE) SetMetricLevel(value uint32) LinkStateTE { - - obj.obj.MetricLevel = &value - return obj -} - -// The maximum link bandwidth (sub-TLV 9) in bytes/sec allowed for this -// link for a direction. -// MaxBandwith returns a uint32 -func (obj *linkStateTE) MaxBandwith() uint32 { - - return *obj.obj.MaxBandwith - -} - -// The maximum link bandwidth (sub-TLV 9) in bytes/sec allowed for this -// link for a direction. -// MaxBandwith returns a uint32 -func (obj *linkStateTE) HasMaxBandwith() bool { - return obj.obj.MaxBandwith != nil -} - -// The maximum link bandwidth (sub-TLV 9) in bytes/sec allowed for this -// link for a direction. -// SetMaxBandwith sets the uint32 value in the LinkStateTE object -func (obj *linkStateTE) SetMaxBandwith(value uint32) LinkStateTE { - - obj.obj.MaxBandwith = &value - return obj -} - -// The maximum link bandwidth (sub-TLV 10) in bytes/sec allowed for this -// link in a direction. -// MaxReservableBandwidth returns a uint32 -func (obj *linkStateTE) MaxReservableBandwidth() uint32 { - - return *obj.obj.MaxReservableBandwidth - -} - -// The maximum link bandwidth (sub-TLV 10) in bytes/sec allowed for this -// link in a direction. -// MaxReservableBandwidth returns a uint32 -func (obj *linkStateTE) HasMaxReservableBandwidth() bool { - return obj.obj.MaxReservableBandwidth != nil -} - -// The maximum link bandwidth (sub-TLV 10) in bytes/sec allowed for this -// link in a direction. -// SetMaxReservableBandwidth sets the uint32 value in the LinkStateTE object -func (obj *linkStateTE) SetMaxReservableBandwidth(value uint32) LinkStateTE { - - obj.obj.MaxReservableBandwidth = &value - return obj -} - -// Configuration of bandwidths of priority 0 through priority 7. -// PriorityBandwidths returns a LinkStatepriorityBandwidths -func (obj *linkStateTE) PriorityBandwidths() LinkStatepriorityBandwidths { - if obj.obj.PriorityBandwidths == nil { - obj.obj.PriorityBandwidths = NewLinkStatepriorityBandwidths().msg() - } - if obj.priorityBandwidthsHolder == nil { - obj.priorityBandwidthsHolder = &linkStatepriorityBandwidths{obj: obj.obj.PriorityBandwidths} - } - return obj.priorityBandwidthsHolder -} - -// Configuration of bandwidths of priority 0 through priority 7. -// PriorityBandwidths returns a LinkStatepriorityBandwidths -func (obj *linkStateTE) HasPriorityBandwidths() bool { - return obj.obj.PriorityBandwidths != nil -} - -// Configuration of bandwidths of priority 0 through priority 7. -// SetPriorityBandwidths sets the LinkStatepriorityBandwidths value in the LinkStateTE object -func (obj *linkStateTE) SetPriorityBandwidths(value LinkStatepriorityBandwidths) LinkStateTE { - - obj.priorityBandwidthsHolder = nil - obj.obj.PriorityBandwidths = value.msg() - - return obj -} - -func (obj *linkStateTE) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.AdministrativeGroup != nil { - - err := obj.validateHex(obj.AdministrativeGroup()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on LinkStateTE.AdministrativeGroup")) - } - - } - - if obj.obj.PriorityBandwidths != nil { - - obj.PriorityBandwidths().validateObj(vObj, set_default) - } - -} - -func (obj *linkStateTE) setDefault() { - if obj.obj.AdministrativeGroup == nil { - obj.SetAdministrativeGroup("00000000") - } - if obj.obj.MetricLevel == nil { - obj.SetMetricLevel(0) - } - if obj.obj.MaxBandwith == nil { - obj.SetMaxBandwith(125000000) - } - if obj.obj.MaxReservableBandwidth == nil { - obj.SetMaxReservableBandwidth(125000000) - } - -} - -// ***** IsisInterfaceAuthentication ***** -type isisInterfaceAuthentication struct { - validation - obj *otg.IsisInterfaceAuthentication - marshaller marshalIsisInterfaceAuthentication - unMarshaller unMarshalIsisInterfaceAuthentication -} - -func NewIsisInterfaceAuthentication() IsisInterfaceAuthentication { - obj := isisInterfaceAuthentication{obj: &otg.IsisInterfaceAuthentication{}} - obj.setDefault() - return &obj -} - -func (obj *isisInterfaceAuthentication) msg() *otg.IsisInterfaceAuthentication { - return obj.obj -} - -func (obj *isisInterfaceAuthentication) setMsg(msg *otg.IsisInterfaceAuthentication) IsisInterfaceAuthentication { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisInterfaceAuthentication struct { - obj *isisInterfaceAuthentication -} - -type marshalIsisInterfaceAuthentication interface { - // ToProto marshals IsisInterfaceAuthentication to protobuf object *otg.IsisInterfaceAuthentication - ToProto() (*otg.IsisInterfaceAuthentication, error) - // ToPbText marshals IsisInterfaceAuthentication to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisInterfaceAuthentication to YAML text - ToYaml() (string, error) - // ToJson marshals IsisInterfaceAuthentication to JSON text - ToJson() (string, error) -} - -type unMarshalisisInterfaceAuthentication struct { - obj *isisInterfaceAuthentication -} - -type unMarshalIsisInterfaceAuthentication interface { - // FromProto unmarshals IsisInterfaceAuthentication from protobuf object *otg.IsisInterfaceAuthentication - FromProto(msg *otg.IsisInterfaceAuthentication) (IsisInterfaceAuthentication, error) - // FromPbText unmarshals IsisInterfaceAuthentication from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisInterfaceAuthentication from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisInterfaceAuthentication from JSON text - FromJson(value string) error -} - -func (obj *isisInterfaceAuthentication) Marshal() marshalIsisInterfaceAuthentication { - if obj.marshaller == nil { - obj.marshaller = &marshalisisInterfaceAuthentication{obj: obj} - } - return obj.marshaller -} - -func (obj *isisInterfaceAuthentication) Unmarshal() unMarshalIsisInterfaceAuthentication { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisInterfaceAuthentication{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisInterfaceAuthentication) ToProto() (*otg.IsisInterfaceAuthentication, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisInterfaceAuthentication) FromProto(msg *otg.IsisInterfaceAuthentication) (IsisInterfaceAuthentication, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisInterfaceAuthentication) 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 *unMarshalisisInterfaceAuthentication) 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 *marshalisisInterfaceAuthentication) 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 *unMarshalisisInterfaceAuthentication) 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 *marshalisisInterfaceAuthentication) 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 *unMarshalisisInterfaceAuthentication) 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 *isisInterfaceAuthentication) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisInterfaceAuthentication) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisInterfaceAuthentication) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisInterfaceAuthentication) Clone() (IsisInterfaceAuthentication, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisInterfaceAuthentication() - 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 -} - -// IsisInterfaceAuthentication is optional container for circuit authentication properties. -type IsisInterfaceAuthentication interface { - Validation - // msg marshals IsisInterfaceAuthentication to protobuf object *otg.IsisInterfaceAuthentication - // and doesn't set defaults - msg() *otg.IsisInterfaceAuthentication - // setMsg unmarshals IsisInterfaceAuthentication from protobuf object *otg.IsisInterfaceAuthentication - // and doesn't set defaults - setMsg(*otg.IsisInterfaceAuthentication) IsisInterfaceAuthentication - // provides marshal interface - Marshal() marshalIsisInterfaceAuthentication - // provides unmarshal interface - Unmarshal() unMarshalIsisInterfaceAuthentication - // validate validates IsisInterfaceAuthentication - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisInterfaceAuthentication, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // AuthType returns IsisInterfaceAuthenticationAuthTypeEnum, set in IsisInterfaceAuthentication - AuthType() IsisInterfaceAuthenticationAuthTypeEnum - // SetAuthType assigns IsisInterfaceAuthenticationAuthTypeEnum provided by user to IsisInterfaceAuthentication - SetAuthType(value IsisInterfaceAuthenticationAuthTypeEnum) IsisInterfaceAuthentication - // Md5 returns string, set in IsisInterfaceAuthentication. - Md5() string - // SetMd5 assigns string provided by user to IsisInterfaceAuthentication - SetMd5(value string) IsisInterfaceAuthentication - // HasMd5 checks if Md5 has been set in IsisInterfaceAuthentication - HasMd5() bool - // Password returns string, set in IsisInterfaceAuthentication. - Password() string - // SetPassword assigns string provided by user to IsisInterfaceAuthentication - SetPassword(value string) IsisInterfaceAuthentication - // HasPassword checks if Password has been set in IsisInterfaceAuthentication - HasPassword() bool -} - -type IsisInterfaceAuthenticationAuthTypeEnum string - -// Enum of AuthType on IsisInterfaceAuthentication -var IsisInterfaceAuthenticationAuthType = struct { - MD5 IsisInterfaceAuthenticationAuthTypeEnum - PASSWORD IsisInterfaceAuthenticationAuthTypeEnum -}{ - MD5: IsisInterfaceAuthenticationAuthTypeEnum("md5"), - PASSWORD: IsisInterfaceAuthenticationAuthTypeEnum("password"), -} - -func (obj *isisInterfaceAuthentication) AuthType() IsisInterfaceAuthenticationAuthTypeEnum { - return IsisInterfaceAuthenticationAuthTypeEnum(obj.obj.AuthType.Enum().String()) -} - -func (obj *isisInterfaceAuthentication) SetAuthType(value IsisInterfaceAuthenticationAuthTypeEnum) IsisInterfaceAuthentication { - intValue, ok := otg.IsisInterfaceAuthentication_AuthType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on IsisInterfaceAuthenticationAuthTypeEnum", string(value))) - return obj - } - enumValue := otg.IsisInterfaceAuthentication_AuthType_Enum(intValue) - obj.obj.AuthType = &enumValue - - return obj -} - -// MD5 key to be used for authentication. -// Md5 returns a string -func (obj *isisInterfaceAuthentication) Md5() string { - - return *obj.obj.Md5 - -} - -// MD5 key to be used for authentication. -// Md5 returns a string -func (obj *isisInterfaceAuthentication) HasMd5() bool { - return obj.obj.Md5 != nil -} - -// MD5 key to be used for authentication. -// SetMd5 sets the string value in the IsisInterfaceAuthentication object -func (obj *isisInterfaceAuthentication) SetMd5(value string) IsisInterfaceAuthentication { - - obj.obj.Md5 = &value - return obj -} - -// The password, in clear text, to be used for Authentication. -// Password returns a string -func (obj *isisInterfaceAuthentication) Password() string { - - return *obj.obj.Password - -} - -// The password, in clear text, to be used for Authentication. -// Password returns a string -func (obj *isisInterfaceAuthentication) HasPassword() bool { - return obj.obj.Password != nil -} - -// The password, in clear text, to be used for Authentication. -// SetPassword sets the string value in the IsisInterfaceAuthentication object -func (obj *isisInterfaceAuthentication) SetPassword(value string) IsisInterfaceAuthentication { - - obj.obj.Password = &value - return obj -} - -func (obj *isisInterfaceAuthentication) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // AuthType is required - if obj.obj.AuthType == nil { - vObj.validationErrors = append(vObj.validationErrors, "AuthType is required field on interface IsisInterfaceAuthentication") - } - - if obj.obj.Md5 != nil { - - if len(*obj.obj.Md5) < 0 || len(*obj.obj.Md5) > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of IsisInterfaceAuthentication.Md5 <= 255 but Got %d", - len(*obj.obj.Md5))) - } - - } - - if obj.obj.Password != nil { - - if len(*obj.obj.Password) < 0 || len(*obj.obj.Password) > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of IsisInterfaceAuthentication.Password <= 255 but Got %d", - len(*obj.obj.Password))) - } - - } - -} - -func (obj *isisInterfaceAuthentication) setDefault() { - -} - -// ***** IsisInterfaceAdvanced ***** -type isisInterfaceAdvanced struct { - validation - obj *otg.IsisInterfaceAdvanced - marshaller marshalIsisInterfaceAdvanced - unMarshaller unMarshalIsisInterfaceAdvanced -} - -func NewIsisInterfaceAdvanced() IsisInterfaceAdvanced { - obj := isisInterfaceAdvanced{obj: &otg.IsisInterfaceAdvanced{}} - obj.setDefault() - return &obj -} - -func (obj *isisInterfaceAdvanced) msg() *otg.IsisInterfaceAdvanced { - return obj.obj -} - -func (obj *isisInterfaceAdvanced) setMsg(msg *otg.IsisInterfaceAdvanced) IsisInterfaceAdvanced { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisInterfaceAdvanced struct { - obj *isisInterfaceAdvanced -} - -type marshalIsisInterfaceAdvanced interface { - // ToProto marshals IsisInterfaceAdvanced to protobuf object *otg.IsisInterfaceAdvanced - ToProto() (*otg.IsisInterfaceAdvanced, error) - // ToPbText marshals IsisInterfaceAdvanced to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisInterfaceAdvanced to YAML text - ToYaml() (string, error) - // ToJson marshals IsisInterfaceAdvanced to JSON text - ToJson() (string, error) -} - -type unMarshalisisInterfaceAdvanced struct { - obj *isisInterfaceAdvanced -} - -type unMarshalIsisInterfaceAdvanced interface { - // FromProto unmarshals IsisInterfaceAdvanced from protobuf object *otg.IsisInterfaceAdvanced - FromProto(msg *otg.IsisInterfaceAdvanced) (IsisInterfaceAdvanced, error) - // FromPbText unmarshals IsisInterfaceAdvanced from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisInterfaceAdvanced from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisInterfaceAdvanced from JSON text - FromJson(value string) error -} - -func (obj *isisInterfaceAdvanced) Marshal() marshalIsisInterfaceAdvanced { - if obj.marshaller == nil { - obj.marshaller = &marshalisisInterfaceAdvanced{obj: obj} - } - return obj.marshaller -} - -func (obj *isisInterfaceAdvanced) Unmarshal() unMarshalIsisInterfaceAdvanced { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisInterfaceAdvanced{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisInterfaceAdvanced) ToProto() (*otg.IsisInterfaceAdvanced, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisInterfaceAdvanced) FromProto(msg *otg.IsisInterfaceAdvanced) (IsisInterfaceAdvanced, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisInterfaceAdvanced) 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 *unMarshalisisInterfaceAdvanced) 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 *marshalisisInterfaceAdvanced) 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 *unMarshalisisInterfaceAdvanced) 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 *marshalisisInterfaceAdvanced) 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 *unMarshalisisInterfaceAdvanced) 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 *isisInterfaceAdvanced) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisInterfaceAdvanced) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisInterfaceAdvanced) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisInterfaceAdvanced) Clone() (IsisInterfaceAdvanced, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisInterfaceAdvanced() - 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 -} - -// IsisInterfaceAdvanced is optional container for advanced interface properties. -type IsisInterfaceAdvanced interface { - Validation - // msg marshals IsisInterfaceAdvanced to protobuf object *otg.IsisInterfaceAdvanced - // and doesn't set defaults - msg() *otg.IsisInterfaceAdvanced - // setMsg unmarshals IsisInterfaceAdvanced from protobuf object *otg.IsisInterfaceAdvanced - // and doesn't set defaults - setMsg(*otg.IsisInterfaceAdvanced) IsisInterfaceAdvanced - // provides marshal interface - Marshal() marshalIsisInterfaceAdvanced - // provides unmarshal interface - Unmarshal() unMarshalIsisInterfaceAdvanced - // validate validates IsisInterfaceAdvanced - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisInterfaceAdvanced, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // AutoAdjustMtu returns bool, set in IsisInterfaceAdvanced. - AutoAdjustMtu() bool - // SetAutoAdjustMtu assigns bool provided by user to IsisInterfaceAdvanced - SetAutoAdjustMtu(value bool) IsisInterfaceAdvanced - // HasAutoAdjustMtu checks if AutoAdjustMtu has been set in IsisInterfaceAdvanced - HasAutoAdjustMtu() bool - // AutoAdjustArea returns bool, set in IsisInterfaceAdvanced. - AutoAdjustArea() bool - // SetAutoAdjustArea assigns bool provided by user to IsisInterfaceAdvanced - SetAutoAdjustArea(value bool) IsisInterfaceAdvanced - // HasAutoAdjustArea checks if AutoAdjustArea has been set in IsisInterfaceAdvanced - HasAutoAdjustArea() bool - // AutoAdjustSupportedProtocols returns bool, set in IsisInterfaceAdvanced. - AutoAdjustSupportedProtocols() bool - // SetAutoAdjustSupportedProtocols assigns bool provided by user to IsisInterfaceAdvanced - SetAutoAdjustSupportedProtocols(value bool) IsisInterfaceAdvanced - // HasAutoAdjustSupportedProtocols checks if AutoAdjustSupportedProtocols has been set in IsisInterfaceAdvanced - HasAutoAdjustSupportedProtocols() bool - // Enable3WayHandshake returns bool, set in IsisInterfaceAdvanced. - Enable3WayHandshake() bool - // SetEnable3WayHandshake assigns bool provided by user to IsisInterfaceAdvanced - SetEnable3WayHandshake(value bool) IsisInterfaceAdvanced - // HasEnable3WayHandshake checks if Enable3WayHandshake has been set in IsisInterfaceAdvanced - HasEnable3WayHandshake() bool - // P2PHellosToUnicastMac returns bool, set in IsisInterfaceAdvanced. - P2PHellosToUnicastMac() bool - // SetP2PHellosToUnicastMac assigns bool provided by user to IsisInterfaceAdvanced - SetP2PHellosToUnicastMac(value bool) IsisInterfaceAdvanced - // HasP2PHellosToUnicastMac checks if P2PHellosToUnicastMac has been set in IsisInterfaceAdvanced - HasP2PHellosToUnicastMac() bool -} - -// If a padded Hello message is received on the interface, the length of -// the Hello packets sent out on that interface is adjusted to match. -// AutoAdjustMtu returns a bool -func (obj *isisInterfaceAdvanced) AutoAdjustMtu() bool { - - return *obj.obj.AutoAdjustMtu - -} - -// If a padded Hello message is received on the interface, the length of -// the Hello packets sent out on that interface is adjusted to match. -// AutoAdjustMtu returns a bool -func (obj *isisInterfaceAdvanced) HasAutoAdjustMtu() bool { - return obj.obj.AutoAdjustMtu != nil -} - -// If a padded Hello message is received on the interface, the length of -// the Hello packets sent out on that interface is adjusted to match. -// SetAutoAdjustMtu sets the bool value in the IsisInterfaceAdvanced object -func (obj *isisInterfaceAdvanced) SetAutoAdjustMtu(value bool) IsisInterfaceAdvanced { - - obj.obj.AutoAdjustMtu = &value - return obj -} - -// If a Level 1 Hello is received on this emulated router for an area -// not currently in its area list, an area from the received Hello is -// added to that list. This ensures an area match for all future -// Level 1 Hellos from the source L1 router. -// AutoAdjustArea returns a bool -func (obj *isisInterfaceAdvanced) AutoAdjustArea() bool { - - return *obj.obj.AutoAdjustArea - -} - -// If a Level 1 Hello is received on this emulated router for an area -// not currently in its area list, an area from the received Hello is -// added to that list. This ensures an area match for all future -// Level 1 Hellos from the source L1 router. -// AutoAdjustArea returns a bool -func (obj *isisInterfaceAdvanced) HasAutoAdjustArea() bool { - return obj.obj.AutoAdjustArea != nil -} - -// If a Level 1 Hello is received on this emulated router for an area -// not currently in its area list, an area from the received Hello is -// added to that list. This ensures an area match for all future -// Level 1 Hellos from the source L1 router. -// SetAutoAdjustArea sets the bool value in the IsisInterfaceAdvanced object -func (obj *isisInterfaceAdvanced) SetAutoAdjustArea(value bool) IsisInterfaceAdvanced { - - obj.obj.AutoAdjustArea = &value - return obj -} - -// If a Hello message listing supported protocols is received on this -// emulated router, the supported protocols advertised by this router -// are changed to match exactly. -// AutoAdjustSupportedProtocols returns a bool -func (obj *isisInterfaceAdvanced) AutoAdjustSupportedProtocols() bool { - - return *obj.obj.AutoAdjustSupportedProtocols - -} - -// If a Hello message listing supported protocols is received on this -// emulated router, the supported protocols advertised by this router -// are changed to match exactly. -// AutoAdjustSupportedProtocols returns a bool -func (obj *isisInterfaceAdvanced) HasAutoAdjustSupportedProtocols() bool { - return obj.obj.AutoAdjustSupportedProtocols != nil -} - -// If a Hello message listing supported protocols is received on this -// emulated router, the supported protocols advertised by this router -// are changed to match exactly. -// SetAutoAdjustSupportedProtocols sets the bool value in the IsisInterfaceAdvanced object -func (obj *isisInterfaceAdvanced) SetAutoAdjustSupportedProtocols(value bool) IsisInterfaceAdvanced { - - obj.obj.AutoAdjustSupportedProtocols = &value - return obj -} - -// If it is true, the Point-to-Point circuit will include 3-way TLV in its Point-to-Point IIH and attempt to establish the adjacency as specified in RFC 5303. This field is not applicable if network_type is set to 'broadcast' type in ISIS interface. -// Enable3WayHandshake returns a bool -func (obj *isisInterfaceAdvanced) Enable3WayHandshake() bool { - - return *obj.obj.Enable_3WayHandshake - -} - -// If it is true, the Point-to-Point circuit will include 3-way TLV in its Point-to-Point IIH and attempt to establish the adjacency as specified in RFC 5303. This field is not applicable if network_type is set to 'broadcast' type in ISIS interface. -// Enable3WayHandshake returns a bool -func (obj *isisInterfaceAdvanced) HasEnable3WayHandshake() bool { - return obj.obj.Enable_3WayHandshake != nil -} - -// If it is true, the Point-to-Point circuit will include 3-way TLV in its Point-to-Point IIH and attempt to establish the adjacency as specified in RFC 5303. This field is not applicable if network_type is set to 'broadcast' type in ISIS interface. -// SetEnable3WayHandshake sets the bool value in the IsisInterfaceAdvanced object -func (obj *isisInterfaceAdvanced) SetEnable3WayHandshake(value bool) IsisInterfaceAdvanced { - - obj.obj.Enable_3WayHandshake = &value - return obj -} - -// If it is true, the Point-to-Point Hello messages will be sent to the unicast MAC address. -// P2PHellosToUnicastMac returns a bool -func (obj *isisInterfaceAdvanced) P2PHellosToUnicastMac() bool { - - return *obj.obj.P2PHellosToUnicastMac - -} - -// If it is true, the Point-to-Point Hello messages will be sent to the unicast MAC address. -// P2PHellosToUnicastMac returns a bool -func (obj *isisInterfaceAdvanced) HasP2PHellosToUnicastMac() bool { - return obj.obj.P2PHellosToUnicastMac != nil -} - -// If it is true, the Point-to-Point Hello messages will be sent to the unicast MAC address. -// SetP2PHellosToUnicastMac sets the bool value in the IsisInterfaceAdvanced object -func (obj *isisInterfaceAdvanced) SetP2PHellosToUnicastMac(value bool) IsisInterfaceAdvanced { - - obj.obj.P2PHellosToUnicastMac = &value - return obj -} - -func (obj *isisInterfaceAdvanced) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *isisInterfaceAdvanced) setDefault() { - if obj.obj.AutoAdjustMtu == nil { - obj.SetAutoAdjustMtu(true) - } - if obj.obj.AutoAdjustArea == nil { - obj.SetAutoAdjustArea(true) - } - if obj.obj.AutoAdjustSupportedProtocols == nil { - obj.SetAutoAdjustSupportedProtocols(false) - } - if obj.obj.Enable_3WayHandshake == nil { - obj.SetEnable3WayHandshake(true) - } - if obj.obj.P2PHellosToUnicastMac == nil { - obj.SetP2PHellosToUnicastMac(false) - } - -} - -// ***** IsisInterfaceLinkProtection ***** -type isisInterfaceLinkProtection struct { - validation - obj *otg.IsisInterfaceLinkProtection - marshaller marshalIsisInterfaceLinkProtection - unMarshaller unMarshalIsisInterfaceLinkProtection -} - -func NewIsisInterfaceLinkProtection() IsisInterfaceLinkProtection { - obj := isisInterfaceLinkProtection{obj: &otg.IsisInterfaceLinkProtection{}} - obj.setDefault() - return &obj -} - -func (obj *isisInterfaceLinkProtection) msg() *otg.IsisInterfaceLinkProtection { - return obj.obj -} - -func (obj *isisInterfaceLinkProtection) setMsg(msg *otg.IsisInterfaceLinkProtection) IsisInterfaceLinkProtection { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisInterfaceLinkProtection struct { - obj *isisInterfaceLinkProtection -} - -type marshalIsisInterfaceLinkProtection interface { - // ToProto marshals IsisInterfaceLinkProtection to protobuf object *otg.IsisInterfaceLinkProtection - ToProto() (*otg.IsisInterfaceLinkProtection, error) - // ToPbText marshals IsisInterfaceLinkProtection to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisInterfaceLinkProtection to YAML text - ToYaml() (string, error) - // ToJson marshals IsisInterfaceLinkProtection to JSON text - ToJson() (string, error) -} - -type unMarshalisisInterfaceLinkProtection struct { - obj *isisInterfaceLinkProtection -} - -type unMarshalIsisInterfaceLinkProtection interface { - // FromProto unmarshals IsisInterfaceLinkProtection from protobuf object *otg.IsisInterfaceLinkProtection - FromProto(msg *otg.IsisInterfaceLinkProtection) (IsisInterfaceLinkProtection, error) - // FromPbText unmarshals IsisInterfaceLinkProtection from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisInterfaceLinkProtection from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisInterfaceLinkProtection from JSON text - FromJson(value string) error -} - -func (obj *isisInterfaceLinkProtection) Marshal() marshalIsisInterfaceLinkProtection { - if obj.marshaller == nil { - obj.marshaller = &marshalisisInterfaceLinkProtection{obj: obj} - } - return obj.marshaller -} - -func (obj *isisInterfaceLinkProtection) Unmarshal() unMarshalIsisInterfaceLinkProtection { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisInterfaceLinkProtection{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisInterfaceLinkProtection) ToProto() (*otg.IsisInterfaceLinkProtection, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisInterfaceLinkProtection) FromProto(msg *otg.IsisInterfaceLinkProtection) (IsisInterfaceLinkProtection, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisInterfaceLinkProtection) 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 *unMarshalisisInterfaceLinkProtection) 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 *marshalisisInterfaceLinkProtection) 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 *unMarshalisisInterfaceLinkProtection) 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 *marshalisisInterfaceLinkProtection) 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 *unMarshalisisInterfaceLinkProtection) 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 *isisInterfaceLinkProtection) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisInterfaceLinkProtection) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisInterfaceLinkProtection) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisInterfaceLinkProtection) Clone() (IsisInterfaceLinkProtection, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisInterfaceLinkProtection() - 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 -} - -// IsisInterfaceLinkProtection is optional container for the link protection sub TLV (type 20). -type IsisInterfaceLinkProtection interface { - Validation - // msg marshals IsisInterfaceLinkProtection to protobuf object *otg.IsisInterfaceLinkProtection - // and doesn't set defaults - msg() *otg.IsisInterfaceLinkProtection - // setMsg unmarshals IsisInterfaceLinkProtection from protobuf object *otg.IsisInterfaceLinkProtection - // and doesn't set defaults - setMsg(*otg.IsisInterfaceLinkProtection) IsisInterfaceLinkProtection - // provides marshal interface - Marshal() marshalIsisInterfaceLinkProtection - // provides unmarshal interface - Unmarshal() unMarshalIsisInterfaceLinkProtection - // validate validates IsisInterfaceLinkProtection - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisInterfaceLinkProtection, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ExtraTraffic returns bool, set in IsisInterfaceLinkProtection. - ExtraTraffic() bool - // SetExtraTraffic assigns bool provided by user to IsisInterfaceLinkProtection - SetExtraTraffic(value bool) IsisInterfaceLinkProtection - // HasExtraTraffic checks if ExtraTraffic has been set in IsisInterfaceLinkProtection - HasExtraTraffic() bool - // Unprotected returns bool, set in IsisInterfaceLinkProtection. - Unprotected() bool - // SetUnprotected assigns bool provided by user to IsisInterfaceLinkProtection - SetUnprotected(value bool) IsisInterfaceLinkProtection - // HasUnprotected checks if Unprotected has been set in IsisInterfaceLinkProtection - HasUnprotected() bool - // Shared returns bool, set in IsisInterfaceLinkProtection. - Shared() bool - // SetShared assigns bool provided by user to IsisInterfaceLinkProtection - SetShared(value bool) IsisInterfaceLinkProtection - // HasShared checks if Shared has been set in IsisInterfaceLinkProtection - HasShared() bool - // Dedicated1To1 returns bool, set in IsisInterfaceLinkProtection. - Dedicated1To1() bool - // SetDedicated1To1 assigns bool provided by user to IsisInterfaceLinkProtection - SetDedicated1To1(value bool) IsisInterfaceLinkProtection - // HasDedicated1To1 checks if Dedicated1To1 has been set in IsisInterfaceLinkProtection - HasDedicated1To1() bool - // Dedicated1Plus1 returns bool, set in IsisInterfaceLinkProtection. - Dedicated1Plus1() bool - // SetDedicated1Plus1 assigns bool provided by user to IsisInterfaceLinkProtection - SetDedicated1Plus1(value bool) IsisInterfaceLinkProtection - // HasDedicated1Plus1 checks if Dedicated1Plus1 has been set in IsisInterfaceLinkProtection - HasDedicated1Plus1() bool - // Enhanced returns bool, set in IsisInterfaceLinkProtection. - Enhanced() bool - // SetEnhanced assigns bool provided by user to IsisInterfaceLinkProtection - SetEnhanced(value bool) IsisInterfaceLinkProtection - // HasEnhanced checks if Enhanced has been set in IsisInterfaceLinkProtection - HasEnhanced() bool - // Reserved40 returns bool, set in IsisInterfaceLinkProtection. - Reserved40() bool - // SetReserved40 assigns bool provided by user to IsisInterfaceLinkProtection - SetReserved40(value bool) IsisInterfaceLinkProtection - // HasReserved40 checks if Reserved40 has been set in IsisInterfaceLinkProtection - HasReserved40() bool - // Reserved80 returns bool, set in IsisInterfaceLinkProtection. - Reserved80() bool - // SetReserved80 assigns bool provided by user to IsisInterfaceLinkProtection - SetReserved80(value bool) IsisInterfaceLinkProtection - // HasReserved80 checks if Reserved80 has been set in IsisInterfaceLinkProtection - HasReserved80() bool -} - -// Enable this to protect other link or links. LSPs on a link of this type are lost -// if any of the links fail. -// ExtraTraffic returns a bool -func (obj *isisInterfaceLinkProtection) ExtraTraffic() bool { - - return *obj.obj.ExtraTraffic - -} - -// Enable this to protect other link or links. LSPs on a link of this type are lost -// if any of the links fail. -// ExtraTraffic returns a bool -func (obj *isisInterfaceLinkProtection) HasExtraTraffic() bool { - return obj.obj.ExtraTraffic != nil -} - -// Enable this to protect other link or links. LSPs on a link of this type are lost -// if any of the links fail. -// SetExtraTraffic sets the bool value in the IsisInterfaceLinkProtection object -func (obj *isisInterfaceLinkProtection) SetExtraTraffic(value bool) IsisInterfaceLinkProtection { - - obj.obj.ExtraTraffic = &value - return obj -} - -// Enabling this signifies that there is no other link protecting this -// link. LSPs on a link of this type are lost if the link fails. -// Unprotected returns a bool -func (obj *isisInterfaceLinkProtection) Unprotected() bool { - - return *obj.obj.Unprotected - -} - -// Enabling this signifies that there is no other link protecting this -// link. LSPs on a link of this type are lost if the link fails. -// Unprotected returns a bool -func (obj *isisInterfaceLinkProtection) HasUnprotected() bool { - return obj.obj.Unprotected != nil -} - -// Enabling this signifies that there is no other link protecting this -// link. LSPs on a link of this type are lost if the link fails. -// SetUnprotected sets the bool value in the IsisInterfaceLinkProtection object -func (obj *isisInterfaceLinkProtection) SetUnprotected(value bool) IsisInterfaceLinkProtection { - - obj.obj.Unprotected = &value - return obj -} - -// Enable this to share the Extra Traffic links between one or more -// links of type Shared.There are one or more disjoint links of type -// Extra Traffic that are protecting this link. -// Shared returns a bool -func (obj *isisInterfaceLinkProtection) Shared() bool { - - return *obj.obj.Shared - -} - -// Enable this to share the Extra Traffic links between one or more -// links of type Shared.There are one or more disjoint links of type -// Extra Traffic that are protecting this link. -// Shared returns a bool -func (obj *isisInterfaceLinkProtection) HasShared() bool { - return obj.obj.Shared != nil -} - -// Enable this to share the Extra Traffic links between one or more -// links of type Shared.There are one or more disjoint links of type -// Extra Traffic that are protecting this link. -// SetShared sets the bool value in the IsisInterfaceLinkProtection object -func (obj *isisInterfaceLinkProtection) SetShared(value bool) IsisInterfaceLinkProtection { - - obj.obj.Shared = &value - return obj -} - -// Enabling this signifies that there is one dedicated disjoint link -// of type Extra Traffic that is protecting this link. -// Dedicated1To1 returns a bool -func (obj *isisInterfaceLinkProtection) Dedicated1To1() bool { - - return *obj.obj.Dedicated_1To_1 - -} - -// Enabling this signifies that there is one dedicated disjoint link -// of type Extra Traffic that is protecting this link. -// Dedicated1To1 returns a bool -func (obj *isisInterfaceLinkProtection) HasDedicated1To1() bool { - return obj.obj.Dedicated_1To_1 != nil -} - -// Enabling this signifies that there is one dedicated disjoint link -// of type Extra Traffic that is protecting this link. -// SetDedicated1To1 sets the bool value in the IsisInterfaceLinkProtection object -func (obj *isisInterfaceLinkProtection) SetDedicated1To1(value bool) IsisInterfaceLinkProtection { - - obj.obj.Dedicated_1To_1 = &value - return obj -} - -// Enabling this signifies that a dedicated disjoint link is protecting -// this link. However, the protecting link is not advertised in the -// link state database and is therefore not available for the routing -// of LSPs. -// Dedicated1Plus1 returns a bool -func (obj *isisInterfaceLinkProtection) Dedicated1Plus1() bool { - - return *obj.obj.Dedicated_1Plus_1 - -} - -// Enabling this signifies that a dedicated disjoint link is protecting -// this link. However, the protecting link is not advertised in the -// link state database and is therefore not available for the routing -// of LSPs. -// Dedicated1Plus1 returns a bool -func (obj *isisInterfaceLinkProtection) HasDedicated1Plus1() bool { - return obj.obj.Dedicated_1Plus_1 != nil -} - -// Enabling this signifies that a dedicated disjoint link is protecting -// this link. However, the protecting link is not advertised in the -// link state database and is therefore not available for the routing -// of LSPs. -// SetDedicated1Plus1 sets the bool value in the IsisInterfaceLinkProtection object -func (obj *isisInterfaceLinkProtection) SetDedicated1Plus1(value bool) IsisInterfaceLinkProtection { - - obj.obj.Dedicated_1Plus_1 = &value - return obj -} - -// Enabling this signifies that a protection scheme that is more -// reliable than Dedicated 1+1. -// Enhanced returns a bool -func (obj *isisInterfaceLinkProtection) Enhanced() bool { - - return *obj.obj.Enhanced - -} - -// Enabling this signifies that a protection scheme that is more -// reliable than Dedicated 1+1. -// Enhanced returns a bool -func (obj *isisInterfaceLinkProtection) HasEnhanced() bool { - return obj.obj.Enhanced != nil -} - -// Enabling this signifies that a protection scheme that is more -// reliable than Dedicated 1+1. -// SetEnhanced sets the bool value in the IsisInterfaceLinkProtection object -func (obj *isisInterfaceLinkProtection) SetEnhanced(value bool) IsisInterfaceLinkProtection { - - obj.obj.Enhanced = &value - return obj -} - -// This is a Protection Scheme with value 0x40. -// Reserved40 returns a bool -func (obj *isisInterfaceLinkProtection) Reserved40() bool { - - return *obj.obj.Reserved_40 - -} - -// This is a Protection Scheme with value 0x40. -// Reserved40 returns a bool -func (obj *isisInterfaceLinkProtection) HasReserved40() bool { - return obj.obj.Reserved_40 != nil -} - -// This is a Protection Scheme with value 0x40. -// SetReserved40 sets the bool value in the IsisInterfaceLinkProtection object -func (obj *isisInterfaceLinkProtection) SetReserved40(value bool) IsisInterfaceLinkProtection { - - obj.obj.Reserved_40 = &value - return obj -} - -// This is a Protection Scheme with value 0x80. -// Reserved80 returns a bool -func (obj *isisInterfaceLinkProtection) Reserved80() bool { - - return *obj.obj.Reserved_80 - -} - -// This is a Protection Scheme with value 0x80. -// Reserved80 returns a bool -func (obj *isisInterfaceLinkProtection) HasReserved80() bool { - return obj.obj.Reserved_80 != nil -} - -// This is a Protection Scheme with value 0x80. -// SetReserved80 sets the bool value in the IsisInterfaceLinkProtection object -func (obj *isisInterfaceLinkProtection) SetReserved80(value bool) IsisInterfaceLinkProtection { - - obj.obj.Reserved_80 = &value - return obj -} - -func (obj *isisInterfaceLinkProtection) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *isisInterfaceLinkProtection) setDefault() { - if obj.obj.ExtraTraffic == nil { - obj.SetExtraTraffic(false) - } - if obj.obj.Unprotected == nil { - obj.SetUnprotected(false) - } - if obj.obj.Shared == nil { - obj.SetShared(false) - } - if obj.obj.Dedicated_1To_1 == nil { - obj.SetDedicated1To1(false) - } - if obj.obj.Dedicated_1Plus_1 == nil { - obj.SetDedicated1Plus1(false) - } - if obj.obj.Enhanced == nil { - obj.SetEnhanced(false) - } - if obj.obj.Reserved_40 == nil { - obj.SetReserved40(false) - } - if obj.obj.Reserved_80 == nil { - obj.SetReserved80(false) - } - -} - -// ***** IsisAuthenticationBase ***** -type isisAuthenticationBase struct { - validation - obj *otg.IsisAuthenticationBase - marshaller marshalIsisAuthenticationBase - unMarshaller unMarshalIsisAuthenticationBase -} - -func NewIsisAuthenticationBase() IsisAuthenticationBase { - obj := isisAuthenticationBase{obj: &otg.IsisAuthenticationBase{}} - obj.setDefault() - return &obj -} - -func (obj *isisAuthenticationBase) msg() *otg.IsisAuthenticationBase { - return obj.obj -} - -func (obj *isisAuthenticationBase) setMsg(msg *otg.IsisAuthenticationBase) IsisAuthenticationBase { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisAuthenticationBase struct { - obj *isisAuthenticationBase -} - -type marshalIsisAuthenticationBase interface { - // ToProto marshals IsisAuthenticationBase to protobuf object *otg.IsisAuthenticationBase - ToProto() (*otg.IsisAuthenticationBase, error) - // ToPbText marshals IsisAuthenticationBase to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisAuthenticationBase to YAML text - ToYaml() (string, error) - // ToJson marshals IsisAuthenticationBase to JSON text - ToJson() (string, error) -} - -type unMarshalisisAuthenticationBase struct { - obj *isisAuthenticationBase -} - -type unMarshalIsisAuthenticationBase interface { - // FromProto unmarshals IsisAuthenticationBase from protobuf object *otg.IsisAuthenticationBase - FromProto(msg *otg.IsisAuthenticationBase) (IsisAuthenticationBase, error) - // FromPbText unmarshals IsisAuthenticationBase from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisAuthenticationBase from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisAuthenticationBase from JSON text - FromJson(value string) error -} - -func (obj *isisAuthenticationBase) Marshal() marshalIsisAuthenticationBase { - if obj.marshaller == nil { - obj.marshaller = &marshalisisAuthenticationBase{obj: obj} - } - return obj.marshaller -} - -func (obj *isisAuthenticationBase) Unmarshal() unMarshalIsisAuthenticationBase { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisAuthenticationBase{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisAuthenticationBase) ToProto() (*otg.IsisAuthenticationBase, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisAuthenticationBase) FromProto(msg *otg.IsisAuthenticationBase) (IsisAuthenticationBase, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisAuthenticationBase) 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 *unMarshalisisAuthenticationBase) 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 *marshalisisAuthenticationBase) 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 *unMarshalisisAuthenticationBase) 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 *marshalisisAuthenticationBase) 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 *unMarshalisisAuthenticationBase) 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 *isisAuthenticationBase) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisAuthenticationBase) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisAuthenticationBase) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisAuthenticationBase) Clone() (IsisAuthenticationBase, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisAuthenticationBase() - 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 -} - -// IsisAuthenticationBase is optional container for ISIS authentication properties. -type IsisAuthenticationBase interface { - Validation - // msg marshals IsisAuthenticationBase to protobuf object *otg.IsisAuthenticationBase - // and doesn't set defaults - msg() *otg.IsisAuthenticationBase - // setMsg unmarshals IsisAuthenticationBase from protobuf object *otg.IsisAuthenticationBase - // and doesn't set defaults - setMsg(*otg.IsisAuthenticationBase) IsisAuthenticationBase - // provides marshal interface - Marshal() marshalIsisAuthenticationBase - // provides unmarshal interface - Unmarshal() unMarshalIsisAuthenticationBase - // validate validates IsisAuthenticationBase - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisAuthenticationBase, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // AuthType returns IsisAuthenticationBaseAuthTypeEnum, set in IsisAuthenticationBase - AuthType() IsisAuthenticationBaseAuthTypeEnum - // SetAuthType assigns IsisAuthenticationBaseAuthTypeEnum provided by user to IsisAuthenticationBase - SetAuthType(value IsisAuthenticationBaseAuthTypeEnum) IsisAuthenticationBase - // Md5 returns string, set in IsisAuthenticationBase. - Md5() string - // SetMd5 assigns string provided by user to IsisAuthenticationBase - SetMd5(value string) IsisAuthenticationBase - // HasMd5 checks if Md5 has been set in IsisAuthenticationBase - HasMd5() bool - // Password returns string, set in IsisAuthenticationBase. - Password() string - // SetPassword assigns string provided by user to IsisAuthenticationBase - SetPassword(value string) IsisAuthenticationBase - // HasPassword checks if Password has been set in IsisAuthenticationBase - HasPassword() bool -} - -type IsisAuthenticationBaseAuthTypeEnum string - -// Enum of AuthType on IsisAuthenticationBase -var IsisAuthenticationBaseAuthType = struct { - MD5 IsisAuthenticationBaseAuthTypeEnum - PASSWORD IsisAuthenticationBaseAuthTypeEnum -}{ - MD5: IsisAuthenticationBaseAuthTypeEnum("md5"), - PASSWORD: IsisAuthenticationBaseAuthTypeEnum("password"), -} - -func (obj *isisAuthenticationBase) AuthType() IsisAuthenticationBaseAuthTypeEnum { - return IsisAuthenticationBaseAuthTypeEnum(obj.obj.AuthType.Enum().String()) -} - -func (obj *isisAuthenticationBase) SetAuthType(value IsisAuthenticationBaseAuthTypeEnum) IsisAuthenticationBase { - intValue, ok := otg.IsisAuthenticationBase_AuthType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on IsisAuthenticationBaseAuthTypeEnum", string(value))) - return obj - } - enumValue := otg.IsisAuthenticationBase_AuthType_Enum(intValue) - obj.obj.AuthType = &enumValue - - return obj -} - -// Authentication as an MD5 key. -// Md5 returns a string -func (obj *isisAuthenticationBase) Md5() string { - - return *obj.obj.Md5 - -} - -// Authentication as an MD5 key. -// Md5 returns a string -func (obj *isisAuthenticationBase) HasMd5() bool { - return obj.obj.Md5 != nil -} - -// Authentication as an MD5 key. -// SetMd5 sets the string value in the IsisAuthenticationBase object -func (obj *isisAuthenticationBase) SetMd5(value string) IsisAuthenticationBase { - - obj.obj.Md5 = &value - return obj -} - -// Authentication as a clear text password. -// Password returns a string -func (obj *isisAuthenticationBase) Password() string { - - return *obj.obj.Password - -} - -// Authentication as a clear text password. -// Password returns a string -func (obj *isisAuthenticationBase) HasPassword() bool { - return obj.obj.Password != nil -} - -// Authentication as a clear text password. -// SetPassword sets the string value in the IsisAuthenticationBase object -func (obj *isisAuthenticationBase) SetPassword(value string) IsisAuthenticationBase { - - obj.obj.Password = &value - return obj -} - -func (obj *isisAuthenticationBase) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // AuthType is required - if obj.obj.AuthType == nil { - vObj.validationErrors = append(vObj.validationErrors, "AuthType is required field on interface IsisAuthenticationBase") - } - - if obj.obj.Md5 != nil { - - if len(*obj.obj.Md5) < 0 || len(*obj.obj.Md5) > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of IsisAuthenticationBase.Md5 <= 255 but Got %d", - len(*obj.obj.Md5))) - } - - } - - if obj.obj.Password != nil { - - if len(*obj.obj.Password) < 0 || len(*obj.obj.Password) > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of IsisAuthenticationBase.Password <= 255 but Got %d", - len(*obj.obj.Password))) - } - - } - -} - -func (obj *isisAuthenticationBase) setDefault() { - -} - -// ***** V4RouteAddress ***** -type v4RouteAddress struct { - validation - obj *otg.V4RouteAddress - marshaller marshalV4RouteAddress - unMarshaller unMarshalV4RouteAddress -} - -func NewV4RouteAddress() V4RouteAddress { - obj := v4RouteAddress{obj: &otg.V4RouteAddress{}} - obj.setDefault() - return &obj -} - -func (obj *v4RouteAddress) msg() *otg.V4RouteAddress { - return obj.obj -} - -func (obj *v4RouteAddress) setMsg(msg *otg.V4RouteAddress) V4RouteAddress { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalv4RouteAddress struct { - obj *v4RouteAddress -} - -type marshalV4RouteAddress interface { - // ToProto marshals V4RouteAddress to protobuf object *otg.V4RouteAddress - ToProto() (*otg.V4RouteAddress, error) - // ToPbText marshals V4RouteAddress to protobuf text - ToPbText() (string, error) - // ToYaml marshals V4RouteAddress to YAML text - ToYaml() (string, error) - // ToJson marshals V4RouteAddress to JSON text - ToJson() (string, error) -} - -type unMarshalv4RouteAddress struct { - obj *v4RouteAddress -} - -type unMarshalV4RouteAddress interface { - // FromProto unmarshals V4RouteAddress from protobuf object *otg.V4RouteAddress - FromProto(msg *otg.V4RouteAddress) (V4RouteAddress, error) - // FromPbText unmarshals V4RouteAddress from protobuf text - FromPbText(value string) error - // FromYaml unmarshals V4RouteAddress from YAML text - FromYaml(value string) error - // FromJson unmarshals V4RouteAddress from JSON text - FromJson(value string) error -} - -func (obj *v4RouteAddress) Marshal() marshalV4RouteAddress { - if obj.marshaller == nil { - obj.marshaller = &marshalv4RouteAddress{obj: obj} - } - return obj.marshaller -} - -func (obj *v4RouteAddress) Unmarshal() unMarshalV4RouteAddress { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalv4RouteAddress{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalv4RouteAddress) ToProto() (*otg.V4RouteAddress, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalv4RouteAddress) FromProto(msg *otg.V4RouteAddress) (V4RouteAddress, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalv4RouteAddress) 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 *unMarshalv4RouteAddress) 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 *marshalv4RouteAddress) 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 *unMarshalv4RouteAddress) 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 *marshalv4RouteAddress) 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 *unMarshalv4RouteAddress) 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 *v4RouteAddress) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *v4RouteAddress) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *v4RouteAddress) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *v4RouteAddress) Clone() (V4RouteAddress, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewV4RouteAddress() - 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 -} - -// V4RouteAddress is a container for IPv4 route addresses. -type V4RouteAddress interface { - Validation - // msg marshals V4RouteAddress to protobuf object *otg.V4RouteAddress - // and doesn't set defaults - msg() *otg.V4RouteAddress - // setMsg unmarshals V4RouteAddress from protobuf object *otg.V4RouteAddress - // and doesn't set defaults - setMsg(*otg.V4RouteAddress) V4RouteAddress - // provides marshal interface - Marshal() marshalV4RouteAddress - // provides unmarshal interface - Unmarshal() unMarshalV4RouteAddress - // validate validates V4RouteAddress - validate() error - // A stringer function - String() string - // Clones the object - Clone() (V4RouteAddress, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Address returns string, set in V4RouteAddress. - Address() string - // SetAddress assigns string provided by user to V4RouteAddress - SetAddress(value string) V4RouteAddress - // Prefix returns uint32, set in V4RouteAddress. - Prefix() uint32 - // SetPrefix assigns uint32 provided by user to V4RouteAddress - SetPrefix(value uint32) V4RouteAddress - // HasPrefix checks if Prefix has been set in V4RouteAddress - HasPrefix() bool - // Count returns uint32, set in V4RouteAddress. - Count() uint32 - // SetCount assigns uint32 provided by user to V4RouteAddress - SetCount(value uint32) V4RouteAddress - // HasCount checks if Count has been set in V4RouteAddress - HasCount() bool - // Step returns uint32, set in V4RouteAddress. - Step() uint32 - // SetStep assigns uint32 provided by user to V4RouteAddress - SetStep(value uint32) V4RouteAddress - // HasStep checks if Step has been set in V4RouteAddress - HasStep() bool -} - -// The starting address of the network. -// Address returns a string -func (obj *v4RouteAddress) Address() string { - - return *obj.obj.Address - -} - -// The starting address of the network. -// SetAddress sets the string value in the V4RouteAddress object -func (obj *v4RouteAddress) SetAddress(value string) V4RouteAddress { - - obj.obj.Address = &value - return obj -} - -// The IPv4 network prefix length to be applied to the address. -// Prefix returns a uint32 -func (obj *v4RouteAddress) Prefix() uint32 { - - return *obj.obj.Prefix - -} - -// The IPv4 network prefix length to be applied to the address. -// Prefix returns a uint32 -func (obj *v4RouteAddress) HasPrefix() bool { - return obj.obj.Prefix != nil -} - -// The IPv4 network prefix length to be applied to the address. -// SetPrefix sets the uint32 value in the V4RouteAddress object -func (obj *v4RouteAddress) SetPrefix(value uint32) V4RouteAddress { - - obj.obj.Prefix = &value - return obj -} - -// The total number of addresses in the range. -// Count returns a uint32 -func (obj *v4RouteAddress) Count() uint32 { - - return *obj.obj.Count - -} - -// The total number of addresses in the range. -// Count returns a uint32 -func (obj *v4RouteAddress) HasCount() bool { - return obj.obj.Count != nil -} - -// The total number of addresses in the range. -// SetCount sets the uint32 value in the V4RouteAddress object -func (obj *v4RouteAddress) SetCount(value uint32) V4RouteAddress { - - obj.obj.Count = &value - return obj -} - -// Increments the network address prefixes within a route range where multiple routes are present. The value is incremented according to the Prefix Length and Step. -// Step returns a uint32 -func (obj *v4RouteAddress) Step() uint32 { - - return *obj.obj.Step - -} - -// Increments the network address prefixes within a route range where multiple routes are present. The value is incremented according to the Prefix Length and Step. -// Step returns a uint32 -func (obj *v4RouteAddress) HasStep() bool { - return obj.obj.Step != nil -} - -// Increments the network address prefixes within a route range where multiple routes are present. The value is incremented according to the Prefix Length and Step. -// SetStep sets the uint32 value in the V4RouteAddress object -func (obj *v4RouteAddress) SetStep(value uint32) V4RouteAddress { - - obj.obj.Step = &value - return obj -} - -func (obj *v4RouteAddress) 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 V4RouteAddress") - } - if obj.obj.Address != nil { - - err := obj.validateIpv4(obj.Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on V4RouteAddress.Address")) - } - - } - - if obj.obj.Prefix != nil { - - if *obj.obj.Prefix > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= V4RouteAddress.Prefix <= 32 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 <= V4RouteAddress.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 <= V4RouteAddress.Step <= 4294967295 but Got %d", *obj.obj.Step)) - } - - } - -} - -func (obj *v4RouteAddress) setDefault() { - if obj.obj.Prefix == nil { - obj.SetPrefix(24) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - -} - -// ***** V6RouteAddress ***** -type v6RouteAddress struct { - validation - obj *otg.V6RouteAddress - marshaller marshalV6RouteAddress - unMarshaller unMarshalV6RouteAddress -} - -func NewV6RouteAddress() V6RouteAddress { - obj := v6RouteAddress{obj: &otg.V6RouteAddress{}} - obj.setDefault() - return &obj -} - -func (obj *v6RouteAddress) msg() *otg.V6RouteAddress { - return obj.obj -} - -func (obj *v6RouteAddress) setMsg(msg *otg.V6RouteAddress) V6RouteAddress { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalv6RouteAddress struct { - obj *v6RouteAddress -} - -type marshalV6RouteAddress interface { - // ToProto marshals V6RouteAddress to protobuf object *otg.V6RouteAddress - ToProto() (*otg.V6RouteAddress, error) - // ToPbText marshals V6RouteAddress to protobuf text - ToPbText() (string, error) - // ToYaml marshals V6RouteAddress to YAML text - ToYaml() (string, error) - // ToJson marshals V6RouteAddress to JSON text - ToJson() (string, error) -} - -type unMarshalv6RouteAddress struct { - obj *v6RouteAddress -} - -type unMarshalV6RouteAddress interface { - // FromProto unmarshals V6RouteAddress from protobuf object *otg.V6RouteAddress - FromProto(msg *otg.V6RouteAddress) (V6RouteAddress, error) - // FromPbText unmarshals V6RouteAddress from protobuf text - FromPbText(value string) error - // FromYaml unmarshals V6RouteAddress from YAML text - FromYaml(value string) error - // FromJson unmarshals V6RouteAddress from JSON text - FromJson(value string) error -} - -func (obj *v6RouteAddress) Marshal() marshalV6RouteAddress { - if obj.marshaller == nil { - obj.marshaller = &marshalv6RouteAddress{obj: obj} - } - return obj.marshaller -} - -func (obj *v6RouteAddress) Unmarshal() unMarshalV6RouteAddress { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalv6RouteAddress{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalv6RouteAddress) ToProto() (*otg.V6RouteAddress, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalv6RouteAddress) FromProto(msg *otg.V6RouteAddress) (V6RouteAddress, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalv6RouteAddress) 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 *unMarshalv6RouteAddress) 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 *marshalv6RouteAddress) 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 *unMarshalv6RouteAddress) 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 *marshalv6RouteAddress) 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 *unMarshalv6RouteAddress) 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 *v6RouteAddress) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *v6RouteAddress) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *v6RouteAddress) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *v6RouteAddress) Clone() (V6RouteAddress, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewV6RouteAddress() - 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 -} - -// V6RouteAddress is a container for IPv6 route addresses. -type V6RouteAddress interface { - Validation - // msg marshals V6RouteAddress to protobuf object *otg.V6RouteAddress - // and doesn't set defaults - msg() *otg.V6RouteAddress - // setMsg unmarshals V6RouteAddress from protobuf object *otg.V6RouteAddress - // and doesn't set defaults - setMsg(*otg.V6RouteAddress) V6RouteAddress - // provides marshal interface - Marshal() marshalV6RouteAddress - // provides unmarshal interface - Unmarshal() unMarshalV6RouteAddress - // validate validates V6RouteAddress - validate() error - // A stringer function - String() string - // Clones the object - Clone() (V6RouteAddress, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Address returns string, set in V6RouteAddress. - Address() string - // SetAddress assigns string provided by user to V6RouteAddress - SetAddress(value string) V6RouteAddress - // Prefix returns uint32, set in V6RouteAddress. - Prefix() uint32 - // SetPrefix assigns uint32 provided by user to V6RouteAddress - SetPrefix(value uint32) V6RouteAddress - // HasPrefix checks if Prefix has been set in V6RouteAddress - HasPrefix() bool - // Count returns uint32, set in V6RouteAddress. - Count() uint32 - // SetCount assigns uint32 provided by user to V6RouteAddress - SetCount(value uint32) V6RouteAddress - // HasCount checks if Count has been set in V6RouteAddress - HasCount() bool - // Step returns uint32, set in V6RouteAddress. - Step() uint32 - // SetStep assigns uint32 provided by user to V6RouteAddress - SetStep(value uint32) V6RouteAddress - // HasStep checks if Step has been set in V6RouteAddress - HasStep() bool -} - -// The starting address of the network. -// Address returns a string -func (obj *v6RouteAddress) Address() string { - - return *obj.obj.Address - -} - -// The starting address of the network. -// SetAddress sets the string value in the V6RouteAddress object -func (obj *v6RouteAddress) SetAddress(value string) V6RouteAddress { - - obj.obj.Address = &value - return obj -} - -// The IPv6 network prefix length to be applied to the address. -// Prefix returns a uint32 -func (obj *v6RouteAddress) Prefix() uint32 { - - return *obj.obj.Prefix - -} - -// The IPv6 network prefix length to be applied to the address. -// Prefix returns a uint32 -func (obj *v6RouteAddress) HasPrefix() bool { - return obj.obj.Prefix != nil -} - -// The IPv6 network prefix length to be applied to the address. -// SetPrefix sets the uint32 value in the V6RouteAddress object -func (obj *v6RouteAddress) SetPrefix(value uint32) V6RouteAddress { - - obj.obj.Prefix = &value - return obj -} - -// The total number of addresses in the range. -// Count returns a uint32 -func (obj *v6RouteAddress) Count() uint32 { - - return *obj.obj.Count - -} - -// The total number of addresses in the range. -// Count returns a uint32 -func (obj *v6RouteAddress) HasCount() bool { - return obj.obj.Count != nil -} - -// The total number of addresses in the range. -// SetCount sets the uint32 value in the V6RouteAddress object -func (obj *v6RouteAddress) SetCount(value uint32) V6RouteAddress { - - obj.obj.Count = &value - return obj -} - -// Increments the network address prefixes within a route range where multiple routes are present. The value is incremented according to the Prefix Length and Step. -// Step returns a uint32 -func (obj *v6RouteAddress) Step() uint32 { - - return *obj.obj.Step - -} - -// Increments the network address prefixes within a route range where multiple routes are present. The value is incremented according to the Prefix Length and Step. -// Step returns a uint32 -func (obj *v6RouteAddress) HasStep() bool { - return obj.obj.Step != nil -} - -// Increments the network address prefixes within a route range where multiple routes are present. The value is incremented according to the Prefix Length and Step. -// SetStep sets the uint32 value in the V6RouteAddress object -func (obj *v6RouteAddress) SetStep(value uint32) V6RouteAddress { - - obj.obj.Step = &value - return obj -} - -func (obj *v6RouteAddress) 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 V6RouteAddress") - } - if obj.obj.Address != nil { - - err := obj.validateIpv6(obj.Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on V6RouteAddress.Address")) - } - - } - - if obj.obj.Prefix != nil { - - if *obj.obj.Prefix > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= V6RouteAddress.Prefix <= 128 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 <= V6RouteAddress.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 <= V6RouteAddress.Step <= 4294967295 but Got %d", *obj.obj.Step)) - } - - } - -} - -func (obj *v6RouteAddress) setDefault() { - if obj.obj.Prefix == nil { - obj.SetPrefix(64) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - -} - -// ***** BgpV4Peer ***** -type bgpV4Peer struct { - validation - obj *otg.BgpV4Peer - marshaller marshalBgpV4Peer - unMarshaller unMarshalBgpV4Peer - evpnEthernetSegmentsHolder BgpV4PeerBgpV4EthernetSegmentIter - advancedHolder BgpAdvanced - capabilityHolder BgpCapability - learnedInformationFilterHolder BgpLearnedInformationFilter - v4RoutesHolder BgpV4PeerBgpV4RouteRangeIter - v6RoutesHolder BgpV4PeerBgpV6RouteRangeIter - v4SrtePoliciesHolder BgpV4PeerBgpSrteV4PolicyIter - v6SrtePoliciesHolder BgpV4PeerBgpSrteV6PolicyIter - gracefulRestartHolder BgpGracefulRestart - replayUpdatesHolder BgpUpdateReplay -} - -func NewBgpV4Peer() BgpV4Peer { - obj := bgpV4Peer{obj: &otg.BgpV4Peer{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV4Peer) msg() *otg.BgpV4Peer { - return obj.obj -} - -func (obj *bgpV4Peer) setMsg(msg *otg.BgpV4Peer) BgpV4Peer { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV4Peer struct { - obj *bgpV4Peer -} - -type marshalBgpV4Peer interface { - // ToProto marshals BgpV4Peer to protobuf object *otg.BgpV4Peer - ToProto() (*otg.BgpV4Peer, error) - // ToPbText marshals BgpV4Peer to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV4Peer to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV4Peer to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV4Peer struct { - obj *bgpV4Peer -} - -type unMarshalBgpV4Peer interface { - // FromProto unmarshals BgpV4Peer from protobuf object *otg.BgpV4Peer - FromProto(msg *otg.BgpV4Peer) (BgpV4Peer, error) - // FromPbText unmarshals BgpV4Peer from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV4Peer from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV4Peer from JSON text - FromJson(value string) error -} - -func (obj *bgpV4Peer) Marshal() marshalBgpV4Peer { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV4Peer{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV4Peer) Unmarshal() unMarshalBgpV4Peer { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV4Peer{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV4Peer) ToProto() (*otg.BgpV4Peer, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV4Peer) FromProto(msg *otg.BgpV4Peer) (BgpV4Peer, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV4Peer) 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 *unMarshalbgpV4Peer) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpV4Peer) 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 *unMarshalbgpV4Peer) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpV4Peer) 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 *unMarshalbgpV4Peer) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpV4Peer) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV4Peer) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV4Peer) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV4Peer) Clone() (BgpV4Peer, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV4Peer() - 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 -} - -func (obj *bgpV4Peer) setNil() { - obj.evpnEthernetSegmentsHolder = nil - obj.advancedHolder = nil - obj.capabilityHolder = nil - obj.learnedInformationFilterHolder = nil - obj.v4RoutesHolder = nil - obj.v6RoutesHolder = nil - obj.v4SrtePoliciesHolder = nil - obj.v6SrtePoliciesHolder = nil - obj.gracefulRestartHolder = nil - obj.replayUpdatesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpV4Peer is configuration for emulated BGPv4 peers and routes. -type BgpV4Peer interface { - Validation - // msg marshals BgpV4Peer to protobuf object *otg.BgpV4Peer - // and doesn't set defaults - msg() *otg.BgpV4Peer - // setMsg unmarshals BgpV4Peer from protobuf object *otg.BgpV4Peer - // and doesn't set defaults - setMsg(*otg.BgpV4Peer) BgpV4Peer - // provides marshal interface - Marshal() marshalBgpV4Peer - // provides unmarshal interface - Unmarshal() unMarshalBgpV4Peer - // validate validates BgpV4Peer - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV4Peer, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PeerAddress returns string, set in BgpV4Peer. - PeerAddress() string - // SetPeerAddress assigns string provided by user to BgpV4Peer - SetPeerAddress(value string) BgpV4Peer - // EvpnEthernetSegments returns BgpV4PeerBgpV4EthernetSegmentIterIter, set in BgpV4Peer - EvpnEthernetSegments() BgpV4PeerBgpV4EthernetSegmentIter - // AsType returns BgpV4PeerAsTypeEnum, set in BgpV4Peer - AsType() BgpV4PeerAsTypeEnum - // SetAsType assigns BgpV4PeerAsTypeEnum provided by user to BgpV4Peer - SetAsType(value BgpV4PeerAsTypeEnum) BgpV4Peer - // AsNumber returns uint32, set in BgpV4Peer. - AsNumber() uint32 - // SetAsNumber assigns uint32 provided by user to BgpV4Peer - SetAsNumber(value uint32) BgpV4Peer - // AsNumberWidth returns BgpV4PeerAsNumberWidthEnum, set in BgpV4Peer - AsNumberWidth() BgpV4PeerAsNumberWidthEnum - // SetAsNumberWidth assigns BgpV4PeerAsNumberWidthEnum provided by user to BgpV4Peer - SetAsNumberWidth(value BgpV4PeerAsNumberWidthEnum) BgpV4Peer - // HasAsNumberWidth checks if AsNumberWidth has been set in BgpV4Peer - HasAsNumberWidth() bool - // Advanced returns BgpAdvanced, set in BgpV4Peer. - // BgpAdvanced is configuration for BGP advanced settings. - Advanced() BgpAdvanced - // SetAdvanced assigns BgpAdvanced provided by user to BgpV4Peer. - // BgpAdvanced is configuration for BGP advanced settings. - SetAdvanced(value BgpAdvanced) BgpV4Peer - // HasAdvanced checks if Advanced has been set in BgpV4Peer - HasAdvanced() bool - // Capability returns BgpCapability, set in BgpV4Peer. - // BgpCapability is configuration for BGP capability settings. - Capability() BgpCapability - // SetCapability assigns BgpCapability provided by user to BgpV4Peer. - // BgpCapability is configuration for BGP capability settings. - SetCapability(value BgpCapability) BgpV4Peer - // HasCapability checks if Capability has been set in BgpV4Peer - HasCapability() bool - // LearnedInformationFilter returns BgpLearnedInformationFilter, set in BgpV4Peer. - // BgpLearnedInformationFilter is configuration for controlling storage of BGP learned information recieved from the peer. - LearnedInformationFilter() BgpLearnedInformationFilter - // SetLearnedInformationFilter assigns BgpLearnedInformationFilter provided by user to BgpV4Peer. - // BgpLearnedInformationFilter is configuration for controlling storage of BGP learned information recieved from the peer. - SetLearnedInformationFilter(value BgpLearnedInformationFilter) BgpV4Peer - // HasLearnedInformationFilter checks if LearnedInformationFilter has been set in BgpV4Peer - HasLearnedInformationFilter() bool - // V4Routes returns BgpV4PeerBgpV4RouteRangeIterIter, set in BgpV4Peer - V4Routes() BgpV4PeerBgpV4RouteRangeIter - // V6Routes returns BgpV4PeerBgpV6RouteRangeIterIter, set in BgpV4Peer - V6Routes() BgpV4PeerBgpV6RouteRangeIter - // V4SrtePolicies returns BgpV4PeerBgpSrteV4PolicyIterIter, set in BgpV4Peer - V4SrtePolicies() BgpV4PeerBgpSrteV4PolicyIter - // V6SrtePolicies returns BgpV4PeerBgpSrteV6PolicyIterIter, set in BgpV4Peer - V6SrtePolicies() BgpV4PeerBgpSrteV6PolicyIter - // Name returns string, set in BgpV4Peer. - Name() string - // SetName assigns string provided by user to BgpV4Peer - SetName(value string) BgpV4Peer - // GracefulRestart returns BgpGracefulRestart, set in BgpV4Peer. - // BgpGracefulRestart is the Graceful Restart Capability (RFC 4724) is a BGP capability that can be used by a BGP speaker to indicate its ability to preserve its forwarding state during BGP restart. The Graceful Restart (GR) capability is advertised in OPEN messages sent between BGP peers. After a BGP session has been established, and the initial routing update has been completed, an End-of-RIB (Routing Information Base) marker is sent in an UPDATE message to convey information about routing convergence. - GracefulRestart() BgpGracefulRestart - // SetGracefulRestart assigns BgpGracefulRestart provided by user to BgpV4Peer. - // BgpGracefulRestart is the Graceful Restart Capability (RFC 4724) is a BGP capability that can be used by a BGP speaker to indicate its ability to preserve its forwarding state during BGP restart. The Graceful Restart (GR) capability is advertised in OPEN messages sent between BGP peers. After a BGP session has been established, and the initial routing update has been completed, an End-of-RIB (Routing Information Base) marker is sent in an UPDATE message to convey information about routing convergence. - SetGracefulRestart(value BgpGracefulRestart) BgpV4Peer - // HasGracefulRestart checks if GracefulRestart has been set in BgpV4Peer - HasGracefulRestart() bool - // ReplayUpdates returns BgpUpdateReplay, set in BgpV4Peer. - // BgpUpdateReplay is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. - ReplayUpdates() BgpUpdateReplay - // SetReplayUpdates assigns BgpUpdateReplay provided by user to BgpV4Peer. - // BgpUpdateReplay is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. - SetReplayUpdates(value BgpUpdateReplay) BgpV4Peer - // HasReplayUpdates checks if ReplayUpdates has been set in BgpV4Peer - HasReplayUpdates() bool - setNil() -} - -// IPv4 address of the BGP peer for the session. -// PeerAddress returns a string -func (obj *bgpV4Peer) PeerAddress() string { - - return *obj.obj.PeerAddress - -} - -// IPv4 address of the BGP peer for the session. -// SetPeerAddress sets the string value in the BgpV4Peer object -func (obj *bgpV4Peer) SetPeerAddress(value string) BgpV4Peer { - - obj.obj.PeerAddress = &value - return obj -} - -// This contains the list of Ethernet Virtual Private Network (EVPN) Ethernet Segments (ES) Per BGP Peer for IPv4 Address Family Identifier (AFI). -// -// Each Ethernet Segment contains a list of EVPN Instances (EVIs) . -// Each EVI contains a list of Broadcast Domains. -// Each Broadcast Domain contains a list of MAC/IP Ranges. -// -// is responsible for advertising Ethernet Auto-discovery Route Per EVI (Type 1). -// -// is responsible for advertising Ethernet Auto-discovery Route Per Ethernet Segment (Type 1). -// -// is responsible for advertising MAC/IP Advertisement Route (Type 2). -// -// is responsible for advertising Inclusive Multicast Ethernet Tag Route (Type 3). -// -// Ethernet Segment is responsible for advertising Ethernet Segment Route (Type 4). -// EvpnEthernetSegments returns a []BgpV4EthernetSegment -func (obj *bgpV4Peer) EvpnEthernetSegments() BgpV4PeerBgpV4EthernetSegmentIter { - if len(obj.obj.EvpnEthernetSegments) == 0 { - obj.obj.EvpnEthernetSegments = []*otg.BgpV4EthernetSegment{} - } - if obj.evpnEthernetSegmentsHolder == nil { - obj.evpnEthernetSegmentsHolder = newBgpV4PeerBgpV4EthernetSegmentIter(&obj.obj.EvpnEthernetSegments).setMsg(obj) - } - return obj.evpnEthernetSegmentsHolder -} - -type bgpV4PeerBgpV4EthernetSegmentIter struct { - obj *bgpV4Peer - bgpV4EthernetSegmentSlice []BgpV4EthernetSegment - fieldPtr *[]*otg.BgpV4EthernetSegment -} - -func newBgpV4PeerBgpV4EthernetSegmentIter(ptr *[]*otg.BgpV4EthernetSegment) BgpV4PeerBgpV4EthernetSegmentIter { - return &bgpV4PeerBgpV4EthernetSegmentIter{fieldPtr: ptr} -} - -type BgpV4PeerBgpV4EthernetSegmentIter interface { - setMsg(*bgpV4Peer) BgpV4PeerBgpV4EthernetSegmentIter - Items() []BgpV4EthernetSegment - Add() BgpV4EthernetSegment - Append(items ...BgpV4EthernetSegment) BgpV4PeerBgpV4EthernetSegmentIter - Set(index int, newObj BgpV4EthernetSegment) BgpV4PeerBgpV4EthernetSegmentIter - Clear() BgpV4PeerBgpV4EthernetSegmentIter - clearHolderSlice() BgpV4PeerBgpV4EthernetSegmentIter - appendHolderSlice(item BgpV4EthernetSegment) BgpV4PeerBgpV4EthernetSegmentIter -} - -func (obj *bgpV4PeerBgpV4EthernetSegmentIter) setMsg(msg *bgpV4Peer) BgpV4PeerBgpV4EthernetSegmentIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpV4EthernetSegment{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4PeerBgpV4EthernetSegmentIter) Items() []BgpV4EthernetSegment { - return obj.bgpV4EthernetSegmentSlice -} - -func (obj *bgpV4PeerBgpV4EthernetSegmentIter) Add() BgpV4EthernetSegment { - newObj := &otg.BgpV4EthernetSegment{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpV4EthernetSegment{obj: newObj} - newLibObj.setDefault() - obj.bgpV4EthernetSegmentSlice = append(obj.bgpV4EthernetSegmentSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4PeerBgpV4EthernetSegmentIter) Append(items ...BgpV4EthernetSegment) BgpV4PeerBgpV4EthernetSegmentIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpV4EthernetSegmentSlice = append(obj.bgpV4EthernetSegmentSlice, item) - } - return obj -} - -func (obj *bgpV4PeerBgpV4EthernetSegmentIter) Set(index int, newObj BgpV4EthernetSegment) BgpV4PeerBgpV4EthernetSegmentIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpV4EthernetSegmentSlice[index] = newObj - return obj -} -func (obj *bgpV4PeerBgpV4EthernetSegmentIter) Clear() BgpV4PeerBgpV4EthernetSegmentIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpV4EthernetSegment{} - obj.bgpV4EthernetSegmentSlice = []BgpV4EthernetSegment{} - } - return obj -} -func (obj *bgpV4PeerBgpV4EthernetSegmentIter) clearHolderSlice() BgpV4PeerBgpV4EthernetSegmentIter { - if len(obj.bgpV4EthernetSegmentSlice) > 0 { - obj.bgpV4EthernetSegmentSlice = []BgpV4EthernetSegment{} - } - return obj -} -func (obj *bgpV4PeerBgpV4EthernetSegmentIter) appendHolderSlice(item BgpV4EthernetSegment) BgpV4PeerBgpV4EthernetSegmentIter { - obj.bgpV4EthernetSegmentSlice = append(obj.bgpV4EthernetSegmentSlice, item) - return obj -} - -type BgpV4PeerAsTypeEnum string - -// Enum of AsType on BgpV4Peer -var BgpV4PeerAsType = struct { - IBGP BgpV4PeerAsTypeEnum - EBGP BgpV4PeerAsTypeEnum -}{ - IBGP: BgpV4PeerAsTypeEnum("ibgp"), - EBGP: BgpV4PeerAsTypeEnum("ebgp"), -} - -func (obj *bgpV4Peer) AsType() BgpV4PeerAsTypeEnum { - return BgpV4PeerAsTypeEnum(obj.obj.AsType.Enum().String()) -} - -func (obj *bgpV4Peer) SetAsType(value BgpV4PeerAsTypeEnum) BgpV4Peer { - intValue, ok := otg.BgpV4Peer_AsType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpV4PeerAsTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpV4Peer_AsType_Enum(intValue) - obj.obj.AsType = &enumValue - - return obj -} - -// Autonomous System Number (AS number or ASN) -// AsNumber returns a uint32 -func (obj *bgpV4Peer) AsNumber() uint32 { - - return *obj.obj.AsNumber - -} - -// Autonomous System Number (AS number or ASN) -// SetAsNumber sets the uint32 value in the BgpV4Peer object -func (obj *bgpV4Peer) SetAsNumber(value uint32) BgpV4Peer { - - obj.obj.AsNumber = &value - return obj -} - -type BgpV4PeerAsNumberWidthEnum string - -// Enum of AsNumberWidth on BgpV4Peer -var BgpV4PeerAsNumberWidth = struct { - TWO BgpV4PeerAsNumberWidthEnum - FOUR BgpV4PeerAsNumberWidthEnum -}{ - TWO: BgpV4PeerAsNumberWidthEnum("two"), - FOUR: BgpV4PeerAsNumberWidthEnum("four"), -} - -func (obj *bgpV4Peer) AsNumberWidth() BgpV4PeerAsNumberWidthEnum { - return BgpV4PeerAsNumberWidthEnum(obj.obj.AsNumberWidth.Enum().String()) -} - -// The width in bytes of the as_number values. Any as_number values that exceeds the width MUST result in an error. -// AsNumberWidth returns a string -func (obj *bgpV4Peer) HasAsNumberWidth() bool { - return obj.obj.AsNumberWidth != nil -} - -func (obj *bgpV4Peer) SetAsNumberWidth(value BgpV4PeerAsNumberWidthEnum) BgpV4Peer { - intValue, ok := otg.BgpV4Peer_AsNumberWidth_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpV4PeerAsNumberWidthEnum", string(value))) - return obj - } - enumValue := otg.BgpV4Peer_AsNumberWidth_Enum(intValue) - obj.obj.AsNumberWidth = &enumValue - - return obj -} - -// description is TBD -// Advanced returns a BgpAdvanced -func (obj *bgpV4Peer) Advanced() BgpAdvanced { - if obj.obj.Advanced == nil { - obj.obj.Advanced = NewBgpAdvanced().msg() - } - if obj.advancedHolder == nil { - obj.advancedHolder = &bgpAdvanced{obj: obj.obj.Advanced} - } - return obj.advancedHolder -} - -// description is TBD -// Advanced returns a BgpAdvanced -func (obj *bgpV4Peer) HasAdvanced() bool { - return obj.obj.Advanced != nil -} - -// description is TBD -// SetAdvanced sets the BgpAdvanced value in the BgpV4Peer object -func (obj *bgpV4Peer) SetAdvanced(value BgpAdvanced) BgpV4Peer { - - obj.advancedHolder = nil - obj.obj.Advanced = value.msg() - - return obj -} - -// description is TBD -// Capability returns a BgpCapability -func (obj *bgpV4Peer) Capability() BgpCapability { - if obj.obj.Capability == nil { - obj.obj.Capability = NewBgpCapability().msg() - } - if obj.capabilityHolder == nil { - obj.capabilityHolder = &bgpCapability{obj: obj.obj.Capability} - } - return obj.capabilityHolder -} - -// description is TBD -// Capability returns a BgpCapability -func (obj *bgpV4Peer) HasCapability() bool { - return obj.obj.Capability != nil -} - -// description is TBD -// SetCapability sets the BgpCapability value in the BgpV4Peer object -func (obj *bgpV4Peer) SetCapability(value BgpCapability) BgpV4Peer { - - obj.capabilityHolder = nil - obj.obj.Capability = value.msg() - - return obj -} - -// description is TBD -// LearnedInformationFilter returns a BgpLearnedInformationFilter -func (obj *bgpV4Peer) LearnedInformationFilter() BgpLearnedInformationFilter { - if obj.obj.LearnedInformationFilter == nil { - obj.obj.LearnedInformationFilter = NewBgpLearnedInformationFilter().msg() - } - if obj.learnedInformationFilterHolder == nil { - obj.learnedInformationFilterHolder = &bgpLearnedInformationFilter{obj: obj.obj.LearnedInformationFilter} - } - return obj.learnedInformationFilterHolder -} - -// description is TBD -// LearnedInformationFilter returns a BgpLearnedInformationFilter -func (obj *bgpV4Peer) HasLearnedInformationFilter() bool { - return obj.obj.LearnedInformationFilter != nil -} - -// description is TBD -// SetLearnedInformationFilter sets the BgpLearnedInformationFilter value in the BgpV4Peer object -func (obj *bgpV4Peer) SetLearnedInformationFilter(value BgpLearnedInformationFilter) BgpV4Peer { - - obj.learnedInformationFilterHolder = nil - obj.obj.LearnedInformationFilter = value.msg() - - return obj -} - -// Emulated BGPv4 route ranges. -// V4Routes returns a []BgpV4RouteRange -func (obj *bgpV4Peer) V4Routes() BgpV4PeerBgpV4RouteRangeIter { - if len(obj.obj.V4Routes) == 0 { - obj.obj.V4Routes = []*otg.BgpV4RouteRange{} - } - if obj.v4RoutesHolder == nil { - obj.v4RoutesHolder = newBgpV4PeerBgpV4RouteRangeIter(&obj.obj.V4Routes).setMsg(obj) - } - return obj.v4RoutesHolder -} - -type bgpV4PeerBgpV4RouteRangeIter struct { - obj *bgpV4Peer - bgpV4RouteRangeSlice []BgpV4RouteRange - fieldPtr *[]*otg.BgpV4RouteRange -} - -func newBgpV4PeerBgpV4RouteRangeIter(ptr *[]*otg.BgpV4RouteRange) BgpV4PeerBgpV4RouteRangeIter { - return &bgpV4PeerBgpV4RouteRangeIter{fieldPtr: ptr} -} - -type BgpV4PeerBgpV4RouteRangeIter interface { - setMsg(*bgpV4Peer) BgpV4PeerBgpV4RouteRangeIter - Items() []BgpV4RouteRange - Add() BgpV4RouteRange - Append(items ...BgpV4RouteRange) BgpV4PeerBgpV4RouteRangeIter - Set(index int, newObj BgpV4RouteRange) BgpV4PeerBgpV4RouteRangeIter - Clear() BgpV4PeerBgpV4RouteRangeIter - clearHolderSlice() BgpV4PeerBgpV4RouteRangeIter - appendHolderSlice(item BgpV4RouteRange) BgpV4PeerBgpV4RouteRangeIter -} - -func (obj *bgpV4PeerBgpV4RouteRangeIter) setMsg(msg *bgpV4Peer) BgpV4PeerBgpV4RouteRangeIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpV4RouteRange{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4PeerBgpV4RouteRangeIter) Items() []BgpV4RouteRange { - return obj.bgpV4RouteRangeSlice -} - -func (obj *bgpV4PeerBgpV4RouteRangeIter) Add() BgpV4RouteRange { - newObj := &otg.BgpV4RouteRange{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpV4RouteRange{obj: newObj} - newLibObj.setDefault() - obj.bgpV4RouteRangeSlice = append(obj.bgpV4RouteRangeSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4PeerBgpV4RouteRangeIter) Append(items ...BgpV4RouteRange) BgpV4PeerBgpV4RouteRangeIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpV4RouteRangeSlice = append(obj.bgpV4RouteRangeSlice, item) - } - return obj -} - -func (obj *bgpV4PeerBgpV4RouteRangeIter) Set(index int, newObj BgpV4RouteRange) BgpV4PeerBgpV4RouteRangeIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpV4RouteRangeSlice[index] = newObj - return obj -} -func (obj *bgpV4PeerBgpV4RouteRangeIter) Clear() BgpV4PeerBgpV4RouteRangeIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpV4RouteRange{} - obj.bgpV4RouteRangeSlice = []BgpV4RouteRange{} - } - return obj -} -func (obj *bgpV4PeerBgpV4RouteRangeIter) clearHolderSlice() BgpV4PeerBgpV4RouteRangeIter { - if len(obj.bgpV4RouteRangeSlice) > 0 { - obj.bgpV4RouteRangeSlice = []BgpV4RouteRange{} - } - return obj -} -func (obj *bgpV4PeerBgpV4RouteRangeIter) appendHolderSlice(item BgpV4RouteRange) BgpV4PeerBgpV4RouteRangeIter { - obj.bgpV4RouteRangeSlice = append(obj.bgpV4RouteRangeSlice, item) - return obj -} - -// Emulated BGPv6 route ranges. -// V6Routes returns a []BgpV6RouteRange -func (obj *bgpV4Peer) V6Routes() BgpV4PeerBgpV6RouteRangeIter { - if len(obj.obj.V6Routes) == 0 { - obj.obj.V6Routes = []*otg.BgpV6RouteRange{} - } - if obj.v6RoutesHolder == nil { - obj.v6RoutesHolder = newBgpV4PeerBgpV6RouteRangeIter(&obj.obj.V6Routes).setMsg(obj) - } - return obj.v6RoutesHolder -} - -type bgpV4PeerBgpV6RouteRangeIter struct { - obj *bgpV4Peer - bgpV6RouteRangeSlice []BgpV6RouteRange - fieldPtr *[]*otg.BgpV6RouteRange -} - -func newBgpV4PeerBgpV6RouteRangeIter(ptr *[]*otg.BgpV6RouteRange) BgpV4PeerBgpV6RouteRangeIter { - return &bgpV4PeerBgpV6RouteRangeIter{fieldPtr: ptr} -} - -type BgpV4PeerBgpV6RouteRangeIter interface { - setMsg(*bgpV4Peer) BgpV4PeerBgpV6RouteRangeIter - Items() []BgpV6RouteRange - Add() BgpV6RouteRange - Append(items ...BgpV6RouteRange) BgpV4PeerBgpV6RouteRangeIter - Set(index int, newObj BgpV6RouteRange) BgpV4PeerBgpV6RouteRangeIter - Clear() BgpV4PeerBgpV6RouteRangeIter - clearHolderSlice() BgpV4PeerBgpV6RouteRangeIter - appendHolderSlice(item BgpV6RouteRange) BgpV4PeerBgpV6RouteRangeIter -} - -func (obj *bgpV4PeerBgpV6RouteRangeIter) setMsg(msg *bgpV4Peer) BgpV4PeerBgpV6RouteRangeIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpV6RouteRange{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4PeerBgpV6RouteRangeIter) Items() []BgpV6RouteRange { - return obj.bgpV6RouteRangeSlice -} - -func (obj *bgpV4PeerBgpV6RouteRangeIter) Add() BgpV6RouteRange { - newObj := &otg.BgpV6RouteRange{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpV6RouteRange{obj: newObj} - newLibObj.setDefault() - obj.bgpV6RouteRangeSlice = append(obj.bgpV6RouteRangeSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4PeerBgpV6RouteRangeIter) Append(items ...BgpV6RouteRange) BgpV4PeerBgpV6RouteRangeIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpV6RouteRangeSlice = append(obj.bgpV6RouteRangeSlice, item) - } - return obj -} - -func (obj *bgpV4PeerBgpV6RouteRangeIter) Set(index int, newObj BgpV6RouteRange) BgpV4PeerBgpV6RouteRangeIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpV6RouteRangeSlice[index] = newObj - return obj -} -func (obj *bgpV4PeerBgpV6RouteRangeIter) Clear() BgpV4PeerBgpV6RouteRangeIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpV6RouteRange{} - obj.bgpV6RouteRangeSlice = []BgpV6RouteRange{} - } - return obj -} -func (obj *bgpV4PeerBgpV6RouteRangeIter) clearHolderSlice() BgpV4PeerBgpV6RouteRangeIter { - if len(obj.bgpV6RouteRangeSlice) > 0 { - obj.bgpV6RouteRangeSlice = []BgpV6RouteRange{} - } - return obj -} -func (obj *bgpV4PeerBgpV6RouteRangeIter) appendHolderSlice(item BgpV6RouteRange) BgpV4PeerBgpV6RouteRangeIter { - obj.bgpV6RouteRangeSlice = append(obj.bgpV6RouteRangeSlice, item) - return obj -} - -// Segment Routing Traffic Engineering (SR TE) Policies for IPv4 Address Family Identifier (AFI). -// V4SrtePolicies returns a []BgpSrteV4Policy -func (obj *bgpV4Peer) V4SrtePolicies() BgpV4PeerBgpSrteV4PolicyIter { - if len(obj.obj.V4SrtePolicies) == 0 { - obj.obj.V4SrtePolicies = []*otg.BgpSrteV4Policy{} - } - if obj.v4SrtePoliciesHolder == nil { - obj.v4SrtePoliciesHolder = newBgpV4PeerBgpSrteV4PolicyIter(&obj.obj.V4SrtePolicies).setMsg(obj) - } - return obj.v4SrtePoliciesHolder -} - -type bgpV4PeerBgpSrteV4PolicyIter struct { - obj *bgpV4Peer - bgpSrteV4PolicySlice []BgpSrteV4Policy - fieldPtr *[]*otg.BgpSrteV4Policy -} - -func newBgpV4PeerBgpSrteV4PolicyIter(ptr *[]*otg.BgpSrteV4Policy) BgpV4PeerBgpSrteV4PolicyIter { - return &bgpV4PeerBgpSrteV4PolicyIter{fieldPtr: ptr} -} - -type BgpV4PeerBgpSrteV4PolicyIter interface { - setMsg(*bgpV4Peer) BgpV4PeerBgpSrteV4PolicyIter - Items() []BgpSrteV4Policy - Add() BgpSrteV4Policy - Append(items ...BgpSrteV4Policy) BgpV4PeerBgpSrteV4PolicyIter - Set(index int, newObj BgpSrteV4Policy) BgpV4PeerBgpSrteV4PolicyIter - Clear() BgpV4PeerBgpSrteV4PolicyIter - clearHolderSlice() BgpV4PeerBgpSrteV4PolicyIter - appendHolderSlice(item BgpSrteV4Policy) BgpV4PeerBgpSrteV4PolicyIter -} - -func (obj *bgpV4PeerBgpSrteV4PolicyIter) setMsg(msg *bgpV4Peer) BgpV4PeerBgpSrteV4PolicyIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpSrteV4Policy{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4PeerBgpSrteV4PolicyIter) Items() []BgpSrteV4Policy { - return obj.bgpSrteV4PolicySlice -} - -func (obj *bgpV4PeerBgpSrteV4PolicyIter) Add() BgpSrteV4Policy { - newObj := &otg.BgpSrteV4Policy{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpSrteV4Policy{obj: newObj} - newLibObj.setDefault() - obj.bgpSrteV4PolicySlice = append(obj.bgpSrteV4PolicySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4PeerBgpSrteV4PolicyIter) Append(items ...BgpSrteV4Policy) BgpV4PeerBgpSrteV4PolicyIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpSrteV4PolicySlice = append(obj.bgpSrteV4PolicySlice, item) - } - return obj -} - -func (obj *bgpV4PeerBgpSrteV4PolicyIter) Set(index int, newObj BgpSrteV4Policy) BgpV4PeerBgpSrteV4PolicyIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpSrteV4PolicySlice[index] = newObj - return obj -} -func (obj *bgpV4PeerBgpSrteV4PolicyIter) Clear() BgpV4PeerBgpSrteV4PolicyIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpSrteV4Policy{} - obj.bgpSrteV4PolicySlice = []BgpSrteV4Policy{} - } - return obj -} -func (obj *bgpV4PeerBgpSrteV4PolicyIter) clearHolderSlice() BgpV4PeerBgpSrteV4PolicyIter { - if len(obj.bgpSrteV4PolicySlice) > 0 { - obj.bgpSrteV4PolicySlice = []BgpSrteV4Policy{} - } - return obj -} -func (obj *bgpV4PeerBgpSrteV4PolicyIter) appendHolderSlice(item BgpSrteV4Policy) BgpV4PeerBgpSrteV4PolicyIter { - obj.bgpSrteV4PolicySlice = append(obj.bgpSrteV4PolicySlice, item) - return obj -} - -// Segment Routing Traffic Engineering (SR TE) Policies for IPv6 Address Family Identifier (AFI). -// V6SrtePolicies returns a []BgpSrteV6Policy -func (obj *bgpV4Peer) V6SrtePolicies() BgpV4PeerBgpSrteV6PolicyIter { - if len(obj.obj.V6SrtePolicies) == 0 { - obj.obj.V6SrtePolicies = []*otg.BgpSrteV6Policy{} - } - if obj.v6SrtePoliciesHolder == nil { - obj.v6SrtePoliciesHolder = newBgpV4PeerBgpSrteV6PolicyIter(&obj.obj.V6SrtePolicies).setMsg(obj) - } - return obj.v6SrtePoliciesHolder -} - -type bgpV4PeerBgpSrteV6PolicyIter struct { - obj *bgpV4Peer - bgpSrteV6PolicySlice []BgpSrteV6Policy - fieldPtr *[]*otg.BgpSrteV6Policy -} - -func newBgpV4PeerBgpSrteV6PolicyIter(ptr *[]*otg.BgpSrteV6Policy) BgpV4PeerBgpSrteV6PolicyIter { - return &bgpV4PeerBgpSrteV6PolicyIter{fieldPtr: ptr} -} - -type BgpV4PeerBgpSrteV6PolicyIter interface { - setMsg(*bgpV4Peer) BgpV4PeerBgpSrteV6PolicyIter - Items() []BgpSrteV6Policy - Add() BgpSrteV6Policy - Append(items ...BgpSrteV6Policy) BgpV4PeerBgpSrteV6PolicyIter - Set(index int, newObj BgpSrteV6Policy) BgpV4PeerBgpSrteV6PolicyIter - Clear() BgpV4PeerBgpSrteV6PolicyIter - clearHolderSlice() BgpV4PeerBgpSrteV6PolicyIter - appendHolderSlice(item BgpSrteV6Policy) BgpV4PeerBgpSrteV6PolicyIter -} - -func (obj *bgpV4PeerBgpSrteV6PolicyIter) setMsg(msg *bgpV4Peer) BgpV4PeerBgpSrteV6PolicyIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpSrteV6Policy{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4PeerBgpSrteV6PolicyIter) Items() []BgpSrteV6Policy { - return obj.bgpSrteV6PolicySlice -} - -func (obj *bgpV4PeerBgpSrteV6PolicyIter) Add() BgpSrteV6Policy { - newObj := &otg.BgpSrteV6Policy{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpSrteV6Policy{obj: newObj} - newLibObj.setDefault() - obj.bgpSrteV6PolicySlice = append(obj.bgpSrteV6PolicySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4PeerBgpSrteV6PolicyIter) Append(items ...BgpSrteV6Policy) BgpV4PeerBgpSrteV6PolicyIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpSrteV6PolicySlice = append(obj.bgpSrteV6PolicySlice, item) - } - return obj -} - -func (obj *bgpV4PeerBgpSrteV6PolicyIter) Set(index int, newObj BgpSrteV6Policy) BgpV4PeerBgpSrteV6PolicyIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpSrteV6PolicySlice[index] = newObj - return obj -} -func (obj *bgpV4PeerBgpSrteV6PolicyIter) Clear() BgpV4PeerBgpSrteV6PolicyIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpSrteV6Policy{} - obj.bgpSrteV6PolicySlice = []BgpSrteV6Policy{} - } - return obj -} -func (obj *bgpV4PeerBgpSrteV6PolicyIter) clearHolderSlice() BgpV4PeerBgpSrteV6PolicyIter { - if len(obj.bgpSrteV6PolicySlice) > 0 { - obj.bgpSrteV6PolicySlice = []BgpSrteV6Policy{} - } - return obj -} -func (obj *bgpV4PeerBgpSrteV6PolicyIter) appendHolderSlice(item BgpSrteV6Policy) BgpV4PeerBgpSrteV6PolicyIter { - obj.bgpSrteV6PolicySlice = append(obj.bgpSrteV6PolicySlice, item) - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *bgpV4Peer) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the BgpV4Peer object -func (obj *bgpV4Peer) SetName(value string) BgpV4Peer { - - obj.obj.Name = &value - return obj -} - -// description is TBD -// GracefulRestart returns a BgpGracefulRestart -func (obj *bgpV4Peer) GracefulRestart() BgpGracefulRestart { - if obj.obj.GracefulRestart == nil { - obj.obj.GracefulRestart = NewBgpGracefulRestart().msg() - } - if obj.gracefulRestartHolder == nil { - obj.gracefulRestartHolder = &bgpGracefulRestart{obj: obj.obj.GracefulRestart} - } - return obj.gracefulRestartHolder -} - -// description is TBD -// GracefulRestart returns a BgpGracefulRestart -func (obj *bgpV4Peer) HasGracefulRestart() bool { - return obj.obj.GracefulRestart != nil -} - -// description is TBD -// SetGracefulRestart sets the BgpGracefulRestart value in the BgpV4Peer object -func (obj *bgpV4Peer) SetGracefulRestart(value BgpGracefulRestart) BgpV4Peer { - - obj.gracefulRestartHolder = nil - obj.obj.GracefulRestart = value.msg() - - return obj -} - -// BGP Updates to be sent to the peer as specified after the session is established. -// ReplayUpdates returns a BgpUpdateReplay -func (obj *bgpV4Peer) ReplayUpdates() BgpUpdateReplay { - if obj.obj.ReplayUpdates == nil { - obj.obj.ReplayUpdates = NewBgpUpdateReplay().msg() - } - if obj.replayUpdatesHolder == nil { - obj.replayUpdatesHolder = &bgpUpdateReplay{obj: obj.obj.ReplayUpdates} - } - return obj.replayUpdatesHolder -} - -// BGP Updates to be sent to the peer as specified after the session is established. -// ReplayUpdates returns a BgpUpdateReplay -func (obj *bgpV4Peer) HasReplayUpdates() bool { - return obj.obj.ReplayUpdates != nil -} - -// BGP Updates to be sent to the peer as specified after the session is established. -// SetReplayUpdates sets the BgpUpdateReplay value in the BgpV4Peer object -func (obj *bgpV4Peer) SetReplayUpdates(value BgpUpdateReplay) BgpV4Peer { - - obj.replayUpdatesHolder = nil - obj.obj.ReplayUpdates = value.msg() - - return obj -} - -func (obj *bgpV4Peer) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // PeerAddress is required - if obj.obj.PeerAddress == nil { - vObj.validationErrors = append(vObj.validationErrors, "PeerAddress is required field on interface BgpV4Peer") - } - if obj.obj.PeerAddress != nil { - - err := obj.validateIpv4(obj.PeerAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV4Peer.PeerAddress")) - } - - } - - if len(obj.obj.EvpnEthernetSegments) != 0 { - - if set_default { - obj.EvpnEthernetSegments().clearHolderSlice() - for _, item := range obj.obj.EvpnEthernetSegments { - obj.EvpnEthernetSegments().appendHolderSlice(&bgpV4EthernetSegment{obj: item}) - } - } - for _, item := range obj.EvpnEthernetSegments().Items() { - item.validateObj(vObj, set_default) - } - - } - - // AsType is required - if obj.obj.AsType == nil { - vObj.validationErrors = append(vObj.validationErrors, "AsType is required field on interface BgpV4Peer") - } - - // AsNumber is required - if obj.obj.AsNumber == nil { - vObj.validationErrors = append(vObj.validationErrors, "AsNumber is required field on interface BgpV4Peer") - } - - if obj.obj.Advanced != nil { - - obj.Advanced().validateObj(vObj, set_default) - } - - if obj.obj.Capability != nil { - - obj.Capability().validateObj(vObj, set_default) - } - - if obj.obj.LearnedInformationFilter != nil { - - obj.LearnedInformationFilter().validateObj(vObj, set_default) - } - - if len(obj.obj.V4Routes) != 0 { - - if set_default { - obj.V4Routes().clearHolderSlice() - for _, item := range obj.obj.V4Routes { - obj.V4Routes().appendHolderSlice(&bgpV4RouteRange{obj: item}) - } - } - for _, item := range obj.V4Routes().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.V6Routes) != 0 { - - if set_default { - obj.V6Routes().clearHolderSlice() - for _, item := range obj.obj.V6Routes { - obj.V6Routes().appendHolderSlice(&bgpV6RouteRange{obj: item}) - } - } - for _, item := range obj.V6Routes().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.V4SrtePolicies) != 0 { - - if set_default { - obj.V4SrtePolicies().clearHolderSlice() - for _, item := range obj.obj.V4SrtePolicies { - obj.V4SrtePolicies().appendHolderSlice(&bgpSrteV4Policy{obj: item}) - } - } - for _, item := range obj.V4SrtePolicies().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.V6SrtePolicies) != 0 { - - if set_default { - obj.V6SrtePolicies().clearHolderSlice() - for _, item := range obj.obj.V6SrtePolicies { - obj.V6SrtePolicies().appendHolderSlice(&bgpSrteV6Policy{obj: item}) - } - } - for _, item := range obj.V6SrtePolicies().Items() { - item.validateObj(vObj, set_default) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpV4Peer") - } - - if obj.obj.GracefulRestart != nil { - - obj.GracefulRestart().validateObj(vObj, set_default) - } - - if obj.obj.ReplayUpdates != nil { - - obj.ReplayUpdates().validateObj(vObj, set_default) - } - -} - -func (obj *bgpV4Peer) setDefault() { - if obj.obj.AsNumberWidth == nil { - obj.SetAsNumberWidth(BgpV4PeerAsNumberWidth.FOUR) - - } - -} - -// ***** BgpV6Peer ***** -type bgpV6Peer struct { - validation - obj *otg.BgpV6Peer - marshaller marshalBgpV6Peer - unMarshaller unMarshalBgpV6Peer - segmentRoutingHolder BgpV6SegmentRouting - evpnEthernetSegmentsHolder BgpV6PeerBgpV6EthernetSegmentIter - advancedHolder BgpAdvanced - capabilityHolder BgpCapability - learnedInformationFilterHolder BgpLearnedInformationFilter - v4RoutesHolder BgpV6PeerBgpV4RouteRangeIter - v6RoutesHolder BgpV6PeerBgpV6RouteRangeIter - v4SrtePoliciesHolder BgpV6PeerBgpSrteV4PolicyIter - v6SrtePoliciesHolder BgpV6PeerBgpSrteV6PolicyIter - gracefulRestartHolder BgpGracefulRestart - replayUpdatesHolder BgpUpdateReplay -} - -func NewBgpV6Peer() BgpV6Peer { - obj := bgpV6Peer{obj: &otg.BgpV6Peer{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV6Peer) msg() *otg.BgpV6Peer { - return obj.obj -} - -func (obj *bgpV6Peer) setMsg(msg *otg.BgpV6Peer) BgpV6Peer { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV6Peer struct { - obj *bgpV6Peer -} - -type marshalBgpV6Peer interface { - // ToProto marshals BgpV6Peer to protobuf object *otg.BgpV6Peer - ToProto() (*otg.BgpV6Peer, error) - // ToPbText marshals BgpV6Peer to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV6Peer to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV6Peer to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV6Peer struct { - obj *bgpV6Peer -} - -type unMarshalBgpV6Peer interface { - // FromProto unmarshals BgpV6Peer from protobuf object *otg.BgpV6Peer - FromProto(msg *otg.BgpV6Peer) (BgpV6Peer, error) - // FromPbText unmarshals BgpV6Peer from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV6Peer from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV6Peer from JSON text - FromJson(value string) error -} - -func (obj *bgpV6Peer) Marshal() marshalBgpV6Peer { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV6Peer{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV6Peer) Unmarshal() unMarshalBgpV6Peer { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV6Peer{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV6Peer) ToProto() (*otg.BgpV6Peer, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV6Peer) FromProto(msg *otg.BgpV6Peer) (BgpV6Peer, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV6Peer) 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 *unMarshalbgpV6Peer) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpV6Peer) 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 *unMarshalbgpV6Peer) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpV6Peer) 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 *unMarshalbgpV6Peer) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpV6Peer) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV6Peer) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV6Peer) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV6Peer) Clone() (BgpV6Peer, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV6Peer() - 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 -} - -func (obj *bgpV6Peer) setNil() { - obj.segmentRoutingHolder = nil - obj.evpnEthernetSegmentsHolder = nil - obj.advancedHolder = nil - obj.capabilityHolder = nil - obj.learnedInformationFilterHolder = nil - obj.v4RoutesHolder = nil - obj.v6RoutesHolder = nil - obj.v4SrtePoliciesHolder = nil - obj.v6SrtePoliciesHolder = nil - obj.gracefulRestartHolder = nil - obj.replayUpdatesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpV6Peer is configuration for BGPv6 peer settings and routes. -type BgpV6Peer interface { - Validation - // msg marshals BgpV6Peer to protobuf object *otg.BgpV6Peer - // and doesn't set defaults - msg() *otg.BgpV6Peer - // setMsg unmarshals BgpV6Peer from protobuf object *otg.BgpV6Peer - // and doesn't set defaults - setMsg(*otg.BgpV6Peer) BgpV6Peer - // provides marshal interface - Marshal() marshalBgpV6Peer - // provides unmarshal interface - Unmarshal() unMarshalBgpV6Peer - // validate validates BgpV6Peer - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV6Peer, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PeerAddress returns string, set in BgpV6Peer. - PeerAddress() string - // SetPeerAddress assigns string provided by user to BgpV6Peer - SetPeerAddress(value string) BgpV6Peer - // SegmentRouting returns BgpV6SegmentRouting, set in BgpV6Peer. - // BgpV6SegmentRouting is configuration for BGPv6 segment routing settings. - SegmentRouting() BgpV6SegmentRouting - // SetSegmentRouting assigns BgpV6SegmentRouting provided by user to BgpV6Peer. - // BgpV6SegmentRouting is configuration for BGPv6 segment routing settings. - SetSegmentRouting(value BgpV6SegmentRouting) BgpV6Peer - // HasSegmentRouting checks if SegmentRouting has been set in BgpV6Peer - HasSegmentRouting() bool - // EvpnEthernetSegments returns BgpV6PeerBgpV6EthernetSegmentIterIter, set in BgpV6Peer - EvpnEthernetSegments() BgpV6PeerBgpV6EthernetSegmentIter - // AsType returns BgpV6PeerAsTypeEnum, set in BgpV6Peer - AsType() BgpV6PeerAsTypeEnum - // SetAsType assigns BgpV6PeerAsTypeEnum provided by user to BgpV6Peer - SetAsType(value BgpV6PeerAsTypeEnum) BgpV6Peer - // AsNumber returns uint32, set in BgpV6Peer. - AsNumber() uint32 - // SetAsNumber assigns uint32 provided by user to BgpV6Peer - SetAsNumber(value uint32) BgpV6Peer - // AsNumberWidth returns BgpV6PeerAsNumberWidthEnum, set in BgpV6Peer - AsNumberWidth() BgpV6PeerAsNumberWidthEnum - // SetAsNumberWidth assigns BgpV6PeerAsNumberWidthEnum provided by user to BgpV6Peer - SetAsNumberWidth(value BgpV6PeerAsNumberWidthEnum) BgpV6Peer - // HasAsNumberWidth checks if AsNumberWidth has been set in BgpV6Peer - HasAsNumberWidth() bool - // Advanced returns BgpAdvanced, set in BgpV6Peer. - // BgpAdvanced is configuration for BGP advanced settings. - Advanced() BgpAdvanced - // SetAdvanced assigns BgpAdvanced provided by user to BgpV6Peer. - // BgpAdvanced is configuration for BGP advanced settings. - SetAdvanced(value BgpAdvanced) BgpV6Peer - // HasAdvanced checks if Advanced has been set in BgpV6Peer - HasAdvanced() bool - // Capability returns BgpCapability, set in BgpV6Peer. - // BgpCapability is configuration for BGP capability settings. - Capability() BgpCapability - // SetCapability assigns BgpCapability provided by user to BgpV6Peer. - // BgpCapability is configuration for BGP capability settings. - SetCapability(value BgpCapability) BgpV6Peer - // HasCapability checks if Capability has been set in BgpV6Peer - HasCapability() bool - // LearnedInformationFilter returns BgpLearnedInformationFilter, set in BgpV6Peer. - // BgpLearnedInformationFilter is configuration for controlling storage of BGP learned information recieved from the peer. - LearnedInformationFilter() BgpLearnedInformationFilter - // SetLearnedInformationFilter assigns BgpLearnedInformationFilter provided by user to BgpV6Peer. - // BgpLearnedInformationFilter is configuration for controlling storage of BGP learned information recieved from the peer. - SetLearnedInformationFilter(value BgpLearnedInformationFilter) BgpV6Peer - // HasLearnedInformationFilter checks if LearnedInformationFilter has been set in BgpV6Peer - HasLearnedInformationFilter() bool - // V4Routes returns BgpV6PeerBgpV4RouteRangeIterIter, set in BgpV6Peer - V4Routes() BgpV6PeerBgpV4RouteRangeIter - // V6Routes returns BgpV6PeerBgpV6RouteRangeIterIter, set in BgpV6Peer - V6Routes() BgpV6PeerBgpV6RouteRangeIter - // V4SrtePolicies returns BgpV6PeerBgpSrteV4PolicyIterIter, set in BgpV6Peer - V4SrtePolicies() BgpV6PeerBgpSrteV4PolicyIter - // V6SrtePolicies returns BgpV6PeerBgpSrteV6PolicyIterIter, set in BgpV6Peer - V6SrtePolicies() BgpV6PeerBgpSrteV6PolicyIter - // Name returns string, set in BgpV6Peer. - Name() string - // SetName assigns string provided by user to BgpV6Peer - SetName(value string) BgpV6Peer - // GracefulRestart returns BgpGracefulRestart, set in BgpV6Peer. - // BgpGracefulRestart is the Graceful Restart Capability (RFC 4724) is a BGP capability that can be used by a BGP speaker to indicate its ability to preserve its forwarding state during BGP restart. The Graceful Restart (GR) capability is advertised in OPEN messages sent between BGP peers. After a BGP session has been established, and the initial routing update has been completed, an End-of-RIB (Routing Information Base) marker is sent in an UPDATE message to convey information about routing convergence. - GracefulRestart() BgpGracefulRestart - // SetGracefulRestart assigns BgpGracefulRestart provided by user to BgpV6Peer. - // BgpGracefulRestart is the Graceful Restart Capability (RFC 4724) is a BGP capability that can be used by a BGP speaker to indicate its ability to preserve its forwarding state during BGP restart. The Graceful Restart (GR) capability is advertised in OPEN messages sent between BGP peers. After a BGP session has been established, and the initial routing update has been completed, an End-of-RIB (Routing Information Base) marker is sent in an UPDATE message to convey information about routing convergence. - SetGracefulRestart(value BgpGracefulRestart) BgpV6Peer - // HasGracefulRestart checks if GracefulRestart has been set in BgpV6Peer - HasGracefulRestart() bool - // ReplayUpdates returns BgpUpdateReplay, set in BgpV6Peer. - // BgpUpdateReplay is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. - ReplayUpdates() BgpUpdateReplay - // SetReplayUpdates assigns BgpUpdateReplay provided by user to BgpV6Peer. - // BgpUpdateReplay is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. - SetReplayUpdates(value BgpUpdateReplay) BgpV6Peer - // HasReplayUpdates checks if ReplayUpdates has been set in BgpV6Peer - HasReplayUpdates() bool - setNil() -} - -// IPv6 address of the BGP peer for the session -// PeerAddress returns a string -func (obj *bgpV6Peer) PeerAddress() string { - - return *obj.obj.PeerAddress - -} - -// IPv6 address of the BGP peer for the session -// SetPeerAddress sets the string value in the BgpV6Peer object -func (obj *bgpV6Peer) SetPeerAddress(value string) BgpV6Peer { - - obj.obj.PeerAddress = &value - return obj -} - -// description is TBD -// SegmentRouting returns a BgpV6SegmentRouting -func (obj *bgpV6Peer) SegmentRouting() BgpV6SegmentRouting { - if obj.obj.SegmentRouting == nil { - obj.obj.SegmentRouting = NewBgpV6SegmentRouting().msg() - } - if obj.segmentRoutingHolder == nil { - obj.segmentRoutingHolder = &bgpV6SegmentRouting{obj: obj.obj.SegmentRouting} - } - return obj.segmentRoutingHolder -} - -// description is TBD -// SegmentRouting returns a BgpV6SegmentRouting -func (obj *bgpV6Peer) HasSegmentRouting() bool { - return obj.obj.SegmentRouting != nil -} - -// description is TBD -// SetSegmentRouting sets the BgpV6SegmentRouting value in the BgpV6Peer object -func (obj *bgpV6Peer) SetSegmentRouting(value BgpV6SegmentRouting) BgpV6Peer { - - obj.segmentRoutingHolder = nil - obj.obj.SegmentRouting = value.msg() - - return obj -} - -// This contains the list of Ethernet Virtual Private Network (EVPN) Ethernet Segments (ES) Per BGP Peer for IPv6 Address Family Identifier (AFI). -// -// Each Ethernet Segment contains a list of EVPN Instances (EVIs) . -// Each EVI contains a list of Broadcast Domains. -// Each Broadcast Domain contains a list of MAC/IP Ranges. -// -// is responsible for advertising Ethernet Auto-discovery Route Per EVI (Type 1). -// -// is responsible for advertising Ethernet Auto-discovery Route Per Ethernet Segment (Type 1). -// -// is responsible for advertising MAC/IP Advertisement Route (Type 2). -// -// is responsible for advertising Inclusive Multicast Ethernet Tag Route (Type 3). -// -// Ethernet Segment is responsible for advertising Ethernet Segment Route (Type 4). -// EvpnEthernetSegments returns a []BgpV6EthernetSegment -func (obj *bgpV6Peer) EvpnEthernetSegments() BgpV6PeerBgpV6EthernetSegmentIter { - if len(obj.obj.EvpnEthernetSegments) == 0 { - obj.obj.EvpnEthernetSegments = []*otg.BgpV6EthernetSegment{} - } - if obj.evpnEthernetSegmentsHolder == nil { - obj.evpnEthernetSegmentsHolder = newBgpV6PeerBgpV6EthernetSegmentIter(&obj.obj.EvpnEthernetSegments).setMsg(obj) - } - return obj.evpnEthernetSegmentsHolder -} - -type bgpV6PeerBgpV6EthernetSegmentIter struct { - obj *bgpV6Peer - bgpV6EthernetSegmentSlice []BgpV6EthernetSegment - fieldPtr *[]*otg.BgpV6EthernetSegment -} - -func newBgpV6PeerBgpV6EthernetSegmentIter(ptr *[]*otg.BgpV6EthernetSegment) BgpV6PeerBgpV6EthernetSegmentIter { - return &bgpV6PeerBgpV6EthernetSegmentIter{fieldPtr: ptr} -} - -type BgpV6PeerBgpV6EthernetSegmentIter interface { - setMsg(*bgpV6Peer) BgpV6PeerBgpV6EthernetSegmentIter - Items() []BgpV6EthernetSegment - Add() BgpV6EthernetSegment - Append(items ...BgpV6EthernetSegment) BgpV6PeerBgpV6EthernetSegmentIter - Set(index int, newObj BgpV6EthernetSegment) BgpV6PeerBgpV6EthernetSegmentIter - Clear() BgpV6PeerBgpV6EthernetSegmentIter - clearHolderSlice() BgpV6PeerBgpV6EthernetSegmentIter - appendHolderSlice(item BgpV6EthernetSegment) BgpV6PeerBgpV6EthernetSegmentIter -} - -func (obj *bgpV6PeerBgpV6EthernetSegmentIter) setMsg(msg *bgpV6Peer) BgpV6PeerBgpV6EthernetSegmentIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpV6EthernetSegment{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6PeerBgpV6EthernetSegmentIter) Items() []BgpV6EthernetSegment { - return obj.bgpV6EthernetSegmentSlice -} - -func (obj *bgpV6PeerBgpV6EthernetSegmentIter) Add() BgpV6EthernetSegment { - newObj := &otg.BgpV6EthernetSegment{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpV6EthernetSegment{obj: newObj} - newLibObj.setDefault() - obj.bgpV6EthernetSegmentSlice = append(obj.bgpV6EthernetSegmentSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6PeerBgpV6EthernetSegmentIter) Append(items ...BgpV6EthernetSegment) BgpV6PeerBgpV6EthernetSegmentIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpV6EthernetSegmentSlice = append(obj.bgpV6EthernetSegmentSlice, item) - } - return obj -} - -func (obj *bgpV6PeerBgpV6EthernetSegmentIter) Set(index int, newObj BgpV6EthernetSegment) BgpV6PeerBgpV6EthernetSegmentIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpV6EthernetSegmentSlice[index] = newObj - return obj -} -func (obj *bgpV6PeerBgpV6EthernetSegmentIter) Clear() BgpV6PeerBgpV6EthernetSegmentIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpV6EthernetSegment{} - obj.bgpV6EthernetSegmentSlice = []BgpV6EthernetSegment{} - } - return obj -} -func (obj *bgpV6PeerBgpV6EthernetSegmentIter) clearHolderSlice() BgpV6PeerBgpV6EthernetSegmentIter { - if len(obj.bgpV6EthernetSegmentSlice) > 0 { - obj.bgpV6EthernetSegmentSlice = []BgpV6EthernetSegment{} - } - return obj -} -func (obj *bgpV6PeerBgpV6EthernetSegmentIter) appendHolderSlice(item BgpV6EthernetSegment) BgpV6PeerBgpV6EthernetSegmentIter { - obj.bgpV6EthernetSegmentSlice = append(obj.bgpV6EthernetSegmentSlice, item) - return obj -} - -type BgpV6PeerAsTypeEnum string - -// Enum of AsType on BgpV6Peer -var BgpV6PeerAsType = struct { - IBGP BgpV6PeerAsTypeEnum - EBGP BgpV6PeerAsTypeEnum -}{ - IBGP: BgpV6PeerAsTypeEnum("ibgp"), - EBGP: BgpV6PeerAsTypeEnum("ebgp"), -} - -func (obj *bgpV6Peer) AsType() BgpV6PeerAsTypeEnum { - return BgpV6PeerAsTypeEnum(obj.obj.AsType.Enum().String()) -} - -func (obj *bgpV6Peer) SetAsType(value BgpV6PeerAsTypeEnum) BgpV6Peer { - intValue, ok := otg.BgpV6Peer_AsType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpV6PeerAsTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpV6Peer_AsType_Enum(intValue) - obj.obj.AsType = &enumValue - - return obj -} - -// Autonomous System Number (AS number or ASN) -// AsNumber returns a uint32 -func (obj *bgpV6Peer) AsNumber() uint32 { - - return *obj.obj.AsNumber - -} - -// Autonomous System Number (AS number or ASN) -// SetAsNumber sets the uint32 value in the BgpV6Peer object -func (obj *bgpV6Peer) SetAsNumber(value uint32) BgpV6Peer { - - obj.obj.AsNumber = &value - return obj -} - -type BgpV6PeerAsNumberWidthEnum string - -// Enum of AsNumberWidth on BgpV6Peer -var BgpV6PeerAsNumberWidth = struct { - TWO BgpV6PeerAsNumberWidthEnum - FOUR BgpV6PeerAsNumberWidthEnum -}{ - TWO: BgpV6PeerAsNumberWidthEnum("two"), - FOUR: BgpV6PeerAsNumberWidthEnum("four"), -} - -func (obj *bgpV6Peer) AsNumberWidth() BgpV6PeerAsNumberWidthEnum { - return BgpV6PeerAsNumberWidthEnum(obj.obj.AsNumberWidth.Enum().String()) -} - -// The width in bytes of the as_number values. Any as_number values that exceeds the width MUST result in an error. -// AsNumberWidth returns a string -func (obj *bgpV6Peer) HasAsNumberWidth() bool { - return obj.obj.AsNumberWidth != nil -} - -func (obj *bgpV6Peer) SetAsNumberWidth(value BgpV6PeerAsNumberWidthEnum) BgpV6Peer { - intValue, ok := otg.BgpV6Peer_AsNumberWidth_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpV6PeerAsNumberWidthEnum", string(value))) - return obj - } - enumValue := otg.BgpV6Peer_AsNumberWidth_Enum(intValue) - obj.obj.AsNumberWidth = &enumValue - - return obj -} - -// description is TBD -// Advanced returns a BgpAdvanced -func (obj *bgpV6Peer) Advanced() BgpAdvanced { - if obj.obj.Advanced == nil { - obj.obj.Advanced = NewBgpAdvanced().msg() - } - if obj.advancedHolder == nil { - obj.advancedHolder = &bgpAdvanced{obj: obj.obj.Advanced} - } - return obj.advancedHolder -} - -// description is TBD -// Advanced returns a BgpAdvanced -func (obj *bgpV6Peer) HasAdvanced() bool { - return obj.obj.Advanced != nil -} - -// description is TBD -// SetAdvanced sets the BgpAdvanced value in the BgpV6Peer object -func (obj *bgpV6Peer) SetAdvanced(value BgpAdvanced) BgpV6Peer { - - obj.advancedHolder = nil - obj.obj.Advanced = value.msg() - - return obj -} - -// description is TBD -// Capability returns a BgpCapability -func (obj *bgpV6Peer) Capability() BgpCapability { - if obj.obj.Capability == nil { - obj.obj.Capability = NewBgpCapability().msg() - } - if obj.capabilityHolder == nil { - obj.capabilityHolder = &bgpCapability{obj: obj.obj.Capability} - } - return obj.capabilityHolder -} - -// description is TBD -// Capability returns a BgpCapability -func (obj *bgpV6Peer) HasCapability() bool { - return obj.obj.Capability != nil -} - -// description is TBD -// SetCapability sets the BgpCapability value in the BgpV6Peer object -func (obj *bgpV6Peer) SetCapability(value BgpCapability) BgpV6Peer { - - obj.capabilityHolder = nil - obj.obj.Capability = value.msg() - - return obj -} - -// description is TBD -// LearnedInformationFilter returns a BgpLearnedInformationFilter -func (obj *bgpV6Peer) LearnedInformationFilter() BgpLearnedInformationFilter { - if obj.obj.LearnedInformationFilter == nil { - obj.obj.LearnedInformationFilter = NewBgpLearnedInformationFilter().msg() - } - if obj.learnedInformationFilterHolder == nil { - obj.learnedInformationFilterHolder = &bgpLearnedInformationFilter{obj: obj.obj.LearnedInformationFilter} - } - return obj.learnedInformationFilterHolder -} - -// description is TBD -// LearnedInformationFilter returns a BgpLearnedInformationFilter -func (obj *bgpV6Peer) HasLearnedInformationFilter() bool { - return obj.obj.LearnedInformationFilter != nil -} - -// description is TBD -// SetLearnedInformationFilter sets the BgpLearnedInformationFilter value in the BgpV6Peer object -func (obj *bgpV6Peer) SetLearnedInformationFilter(value BgpLearnedInformationFilter) BgpV6Peer { - - obj.learnedInformationFilterHolder = nil - obj.obj.LearnedInformationFilter = value.msg() - - return obj -} - -// Emulated BGPv4 route ranges. -// V4Routes returns a []BgpV4RouteRange -func (obj *bgpV6Peer) V4Routes() BgpV6PeerBgpV4RouteRangeIter { - if len(obj.obj.V4Routes) == 0 { - obj.obj.V4Routes = []*otg.BgpV4RouteRange{} - } - if obj.v4RoutesHolder == nil { - obj.v4RoutesHolder = newBgpV6PeerBgpV4RouteRangeIter(&obj.obj.V4Routes).setMsg(obj) - } - return obj.v4RoutesHolder -} - -type bgpV6PeerBgpV4RouteRangeIter struct { - obj *bgpV6Peer - bgpV4RouteRangeSlice []BgpV4RouteRange - fieldPtr *[]*otg.BgpV4RouteRange -} - -func newBgpV6PeerBgpV4RouteRangeIter(ptr *[]*otg.BgpV4RouteRange) BgpV6PeerBgpV4RouteRangeIter { - return &bgpV6PeerBgpV4RouteRangeIter{fieldPtr: ptr} -} - -type BgpV6PeerBgpV4RouteRangeIter interface { - setMsg(*bgpV6Peer) BgpV6PeerBgpV4RouteRangeIter - Items() []BgpV4RouteRange - Add() BgpV4RouteRange - Append(items ...BgpV4RouteRange) BgpV6PeerBgpV4RouteRangeIter - Set(index int, newObj BgpV4RouteRange) BgpV6PeerBgpV4RouteRangeIter - Clear() BgpV6PeerBgpV4RouteRangeIter - clearHolderSlice() BgpV6PeerBgpV4RouteRangeIter - appendHolderSlice(item BgpV4RouteRange) BgpV6PeerBgpV4RouteRangeIter -} - -func (obj *bgpV6PeerBgpV4RouteRangeIter) setMsg(msg *bgpV6Peer) BgpV6PeerBgpV4RouteRangeIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpV4RouteRange{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6PeerBgpV4RouteRangeIter) Items() []BgpV4RouteRange { - return obj.bgpV4RouteRangeSlice -} - -func (obj *bgpV6PeerBgpV4RouteRangeIter) Add() BgpV4RouteRange { - newObj := &otg.BgpV4RouteRange{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpV4RouteRange{obj: newObj} - newLibObj.setDefault() - obj.bgpV4RouteRangeSlice = append(obj.bgpV4RouteRangeSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6PeerBgpV4RouteRangeIter) Append(items ...BgpV4RouteRange) BgpV6PeerBgpV4RouteRangeIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpV4RouteRangeSlice = append(obj.bgpV4RouteRangeSlice, item) - } - return obj -} - -func (obj *bgpV6PeerBgpV4RouteRangeIter) Set(index int, newObj BgpV4RouteRange) BgpV6PeerBgpV4RouteRangeIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpV4RouteRangeSlice[index] = newObj - return obj -} -func (obj *bgpV6PeerBgpV4RouteRangeIter) Clear() BgpV6PeerBgpV4RouteRangeIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpV4RouteRange{} - obj.bgpV4RouteRangeSlice = []BgpV4RouteRange{} - } - return obj -} -func (obj *bgpV6PeerBgpV4RouteRangeIter) clearHolderSlice() BgpV6PeerBgpV4RouteRangeIter { - if len(obj.bgpV4RouteRangeSlice) > 0 { - obj.bgpV4RouteRangeSlice = []BgpV4RouteRange{} - } - return obj -} -func (obj *bgpV6PeerBgpV4RouteRangeIter) appendHolderSlice(item BgpV4RouteRange) BgpV6PeerBgpV4RouteRangeIter { - obj.bgpV4RouteRangeSlice = append(obj.bgpV4RouteRangeSlice, item) - return obj -} - -// Emulated BGPv6 route ranges. -// V6Routes returns a []BgpV6RouteRange -func (obj *bgpV6Peer) V6Routes() BgpV6PeerBgpV6RouteRangeIter { - if len(obj.obj.V6Routes) == 0 { - obj.obj.V6Routes = []*otg.BgpV6RouteRange{} - } - if obj.v6RoutesHolder == nil { - obj.v6RoutesHolder = newBgpV6PeerBgpV6RouteRangeIter(&obj.obj.V6Routes).setMsg(obj) - } - return obj.v6RoutesHolder -} - -type bgpV6PeerBgpV6RouteRangeIter struct { - obj *bgpV6Peer - bgpV6RouteRangeSlice []BgpV6RouteRange - fieldPtr *[]*otg.BgpV6RouteRange -} - -func newBgpV6PeerBgpV6RouteRangeIter(ptr *[]*otg.BgpV6RouteRange) BgpV6PeerBgpV6RouteRangeIter { - return &bgpV6PeerBgpV6RouteRangeIter{fieldPtr: ptr} -} - -type BgpV6PeerBgpV6RouteRangeIter interface { - setMsg(*bgpV6Peer) BgpV6PeerBgpV6RouteRangeIter - Items() []BgpV6RouteRange - Add() BgpV6RouteRange - Append(items ...BgpV6RouteRange) BgpV6PeerBgpV6RouteRangeIter - Set(index int, newObj BgpV6RouteRange) BgpV6PeerBgpV6RouteRangeIter - Clear() BgpV6PeerBgpV6RouteRangeIter - clearHolderSlice() BgpV6PeerBgpV6RouteRangeIter - appendHolderSlice(item BgpV6RouteRange) BgpV6PeerBgpV6RouteRangeIter -} - -func (obj *bgpV6PeerBgpV6RouteRangeIter) setMsg(msg *bgpV6Peer) BgpV6PeerBgpV6RouteRangeIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpV6RouteRange{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6PeerBgpV6RouteRangeIter) Items() []BgpV6RouteRange { - return obj.bgpV6RouteRangeSlice -} - -func (obj *bgpV6PeerBgpV6RouteRangeIter) Add() BgpV6RouteRange { - newObj := &otg.BgpV6RouteRange{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpV6RouteRange{obj: newObj} - newLibObj.setDefault() - obj.bgpV6RouteRangeSlice = append(obj.bgpV6RouteRangeSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6PeerBgpV6RouteRangeIter) Append(items ...BgpV6RouteRange) BgpV6PeerBgpV6RouteRangeIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpV6RouteRangeSlice = append(obj.bgpV6RouteRangeSlice, item) - } - return obj -} - -func (obj *bgpV6PeerBgpV6RouteRangeIter) Set(index int, newObj BgpV6RouteRange) BgpV6PeerBgpV6RouteRangeIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpV6RouteRangeSlice[index] = newObj - return obj -} -func (obj *bgpV6PeerBgpV6RouteRangeIter) Clear() BgpV6PeerBgpV6RouteRangeIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpV6RouteRange{} - obj.bgpV6RouteRangeSlice = []BgpV6RouteRange{} - } - return obj -} -func (obj *bgpV6PeerBgpV6RouteRangeIter) clearHolderSlice() BgpV6PeerBgpV6RouteRangeIter { - if len(obj.bgpV6RouteRangeSlice) > 0 { - obj.bgpV6RouteRangeSlice = []BgpV6RouteRange{} - } - return obj -} -func (obj *bgpV6PeerBgpV6RouteRangeIter) appendHolderSlice(item BgpV6RouteRange) BgpV6PeerBgpV6RouteRangeIter { - obj.bgpV6RouteRangeSlice = append(obj.bgpV6RouteRangeSlice, item) - return obj -} - -// Segment Routing Traffic Engineering (SR TE) Policies for IPv4 Address Family Identifier (AFI). -// V4SrtePolicies returns a []BgpSrteV4Policy -func (obj *bgpV6Peer) V4SrtePolicies() BgpV6PeerBgpSrteV4PolicyIter { - if len(obj.obj.V4SrtePolicies) == 0 { - obj.obj.V4SrtePolicies = []*otg.BgpSrteV4Policy{} - } - if obj.v4SrtePoliciesHolder == nil { - obj.v4SrtePoliciesHolder = newBgpV6PeerBgpSrteV4PolicyIter(&obj.obj.V4SrtePolicies).setMsg(obj) - } - return obj.v4SrtePoliciesHolder -} - -type bgpV6PeerBgpSrteV4PolicyIter struct { - obj *bgpV6Peer - bgpSrteV4PolicySlice []BgpSrteV4Policy - fieldPtr *[]*otg.BgpSrteV4Policy -} - -func newBgpV6PeerBgpSrteV4PolicyIter(ptr *[]*otg.BgpSrteV4Policy) BgpV6PeerBgpSrteV4PolicyIter { - return &bgpV6PeerBgpSrteV4PolicyIter{fieldPtr: ptr} -} - -type BgpV6PeerBgpSrteV4PolicyIter interface { - setMsg(*bgpV6Peer) BgpV6PeerBgpSrteV4PolicyIter - Items() []BgpSrteV4Policy - Add() BgpSrteV4Policy - Append(items ...BgpSrteV4Policy) BgpV6PeerBgpSrteV4PolicyIter - Set(index int, newObj BgpSrteV4Policy) BgpV6PeerBgpSrteV4PolicyIter - Clear() BgpV6PeerBgpSrteV4PolicyIter - clearHolderSlice() BgpV6PeerBgpSrteV4PolicyIter - appendHolderSlice(item BgpSrteV4Policy) BgpV6PeerBgpSrteV4PolicyIter -} - -func (obj *bgpV6PeerBgpSrteV4PolicyIter) setMsg(msg *bgpV6Peer) BgpV6PeerBgpSrteV4PolicyIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpSrteV4Policy{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6PeerBgpSrteV4PolicyIter) Items() []BgpSrteV4Policy { - return obj.bgpSrteV4PolicySlice -} - -func (obj *bgpV6PeerBgpSrteV4PolicyIter) Add() BgpSrteV4Policy { - newObj := &otg.BgpSrteV4Policy{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpSrteV4Policy{obj: newObj} - newLibObj.setDefault() - obj.bgpSrteV4PolicySlice = append(obj.bgpSrteV4PolicySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6PeerBgpSrteV4PolicyIter) Append(items ...BgpSrteV4Policy) BgpV6PeerBgpSrteV4PolicyIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpSrteV4PolicySlice = append(obj.bgpSrteV4PolicySlice, item) - } - return obj -} - -func (obj *bgpV6PeerBgpSrteV4PolicyIter) Set(index int, newObj BgpSrteV4Policy) BgpV6PeerBgpSrteV4PolicyIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpSrteV4PolicySlice[index] = newObj - return obj -} -func (obj *bgpV6PeerBgpSrteV4PolicyIter) Clear() BgpV6PeerBgpSrteV4PolicyIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpSrteV4Policy{} - obj.bgpSrteV4PolicySlice = []BgpSrteV4Policy{} - } - return obj -} -func (obj *bgpV6PeerBgpSrteV4PolicyIter) clearHolderSlice() BgpV6PeerBgpSrteV4PolicyIter { - if len(obj.bgpSrteV4PolicySlice) > 0 { - obj.bgpSrteV4PolicySlice = []BgpSrteV4Policy{} - } - return obj -} -func (obj *bgpV6PeerBgpSrteV4PolicyIter) appendHolderSlice(item BgpSrteV4Policy) BgpV6PeerBgpSrteV4PolicyIter { - obj.bgpSrteV4PolicySlice = append(obj.bgpSrteV4PolicySlice, item) - return obj -} - -// Segment Routing Traffic Engineering (SR TE) Policies for IPv6 Address Family Identifier (AFI). -// V6SrtePolicies returns a []BgpSrteV6Policy -func (obj *bgpV6Peer) V6SrtePolicies() BgpV6PeerBgpSrteV6PolicyIter { - if len(obj.obj.V6SrtePolicies) == 0 { - obj.obj.V6SrtePolicies = []*otg.BgpSrteV6Policy{} - } - if obj.v6SrtePoliciesHolder == nil { - obj.v6SrtePoliciesHolder = newBgpV6PeerBgpSrteV6PolicyIter(&obj.obj.V6SrtePolicies).setMsg(obj) - } - return obj.v6SrtePoliciesHolder -} - -type bgpV6PeerBgpSrteV6PolicyIter struct { - obj *bgpV6Peer - bgpSrteV6PolicySlice []BgpSrteV6Policy - fieldPtr *[]*otg.BgpSrteV6Policy -} - -func newBgpV6PeerBgpSrteV6PolicyIter(ptr *[]*otg.BgpSrteV6Policy) BgpV6PeerBgpSrteV6PolicyIter { - return &bgpV6PeerBgpSrteV6PolicyIter{fieldPtr: ptr} -} - -type BgpV6PeerBgpSrteV6PolicyIter interface { - setMsg(*bgpV6Peer) BgpV6PeerBgpSrteV6PolicyIter - Items() []BgpSrteV6Policy - Add() BgpSrteV6Policy - Append(items ...BgpSrteV6Policy) BgpV6PeerBgpSrteV6PolicyIter - Set(index int, newObj BgpSrteV6Policy) BgpV6PeerBgpSrteV6PolicyIter - Clear() BgpV6PeerBgpSrteV6PolicyIter - clearHolderSlice() BgpV6PeerBgpSrteV6PolicyIter - appendHolderSlice(item BgpSrteV6Policy) BgpV6PeerBgpSrteV6PolicyIter -} - -func (obj *bgpV6PeerBgpSrteV6PolicyIter) setMsg(msg *bgpV6Peer) BgpV6PeerBgpSrteV6PolicyIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpSrteV6Policy{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6PeerBgpSrteV6PolicyIter) Items() []BgpSrteV6Policy { - return obj.bgpSrteV6PolicySlice -} - -func (obj *bgpV6PeerBgpSrteV6PolicyIter) Add() BgpSrteV6Policy { - newObj := &otg.BgpSrteV6Policy{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpSrteV6Policy{obj: newObj} - newLibObj.setDefault() - obj.bgpSrteV6PolicySlice = append(obj.bgpSrteV6PolicySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6PeerBgpSrteV6PolicyIter) Append(items ...BgpSrteV6Policy) BgpV6PeerBgpSrteV6PolicyIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpSrteV6PolicySlice = append(obj.bgpSrteV6PolicySlice, item) - } - return obj -} - -func (obj *bgpV6PeerBgpSrteV6PolicyIter) Set(index int, newObj BgpSrteV6Policy) BgpV6PeerBgpSrteV6PolicyIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpSrteV6PolicySlice[index] = newObj - return obj -} -func (obj *bgpV6PeerBgpSrteV6PolicyIter) Clear() BgpV6PeerBgpSrteV6PolicyIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpSrteV6Policy{} - obj.bgpSrteV6PolicySlice = []BgpSrteV6Policy{} - } - return obj -} -func (obj *bgpV6PeerBgpSrteV6PolicyIter) clearHolderSlice() BgpV6PeerBgpSrteV6PolicyIter { - if len(obj.bgpSrteV6PolicySlice) > 0 { - obj.bgpSrteV6PolicySlice = []BgpSrteV6Policy{} - } - return obj -} -func (obj *bgpV6PeerBgpSrteV6PolicyIter) appendHolderSlice(item BgpSrteV6Policy) BgpV6PeerBgpSrteV6PolicyIter { - obj.bgpSrteV6PolicySlice = append(obj.bgpSrteV6PolicySlice, item) - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *bgpV6Peer) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the BgpV6Peer object -func (obj *bgpV6Peer) SetName(value string) BgpV6Peer { - - obj.obj.Name = &value - return obj -} - -// description is TBD -// GracefulRestart returns a BgpGracefulRestart -func (obj *bgpV6Peer) GracefulRestart() BgpGracefulRestart { - if obj.obj.GracefulRestart == nil { - obj.obj.GracefulRestart = NewBgpGracefulRestart().msg() - } - if obj.gracefulRestartHolder == nil { - obj.gracefulRestartHolder = &bgpGracefulRestart{obj: obj.obj.GracefulRestart} - } - return obj.gracefulRestartHolder -} - -// description is TBD -// GracefulRestart returns a BgpGracefulRestart -func (obj *bgpV6Peer) HasGracefulRestart() bool { - return obj.obj.GracefulRestart != nil -} - -// description is TBD -// SetGracefulRestart sets the BgpGracefulRestart value in the BgpV6Peer object -func (obj *bgpV6Peer) SetGracefulRestart(value BgpGracefulRestart) BgpV6Peer { - - obj.gracefulRestartHolder = nil - obj.obj.GracefulRestart = value.msg() - - return obj -} - -// BGP Updates to be sent to the peer as specified after the session is established. -// ReplayUpdates returns a BgpUpdateReplay -func (obj *bgpV6Peer) ReplayUpdates() BgpUpdateReplay { - if obj.obj.ReplayUpdates == nil { - obj.obj.ReplayUpdates = NewBgpUpdateReplay().msg() - } - if obj.replayUpdatesHolder == nil { - obj.replayUpdatesHolder = &bgpUpdateReplay{obj: obj.obj.ReplayUpdates} - } - return obj.replayUpdatesHolder -} - -// BGP Updates to be sent to the peer as specified after the session is established. -// ReplayUpdates returns a BgpUpdateReplay -func (obj *bgpV6Peer) HasReplayUpdates() bool { - return obj.obj.ReplayUpdates != nil -} - -// BGP Updates to be sent to the peer as specified after the session is established. -// SetReplayUpdates sets the BgpUpdateReplay value in the BgpV6Peer object -func (obj *bgpV6Peer) SetReplayUpdates(value BgpUpdateReplay) BgpV6Peer { - - obj.replayUpdatesHolder = nil - obj.obj.ReplayUpdates = value.msg() - - return obj -} - -func (obj *bgpV6Peer) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // PeerAddress is required - if obj.obj.PeerAddress == nil { - vObj.validationErrors = append(vObj.validationErrors, "PeerAddress is required field on interface BgpV6Peer") - } - if obj.obj.PeerAddress != nil { - - err := obj.validateIpv6(obj.PeerAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV6Peer.PeerAddress")) - } - - } - - if obj.obj.SegmentRouting != nil { - - obj.SegmentRouting().validateObj(vObj, set_default) - } - - if len(obj.obj.EvpnEthernetSegments) != 0 { - - if set_default { - obj.EvpnEthernetSegments().clearHolderSlice() - for _, item := range obj.obj.EvpnEthernetSegments { - obj.EvpnEthernetSegments().appendHolderSlice(&bgpV6EthernetSegment{obj: item}) - } - } - for _, item := range obj.EvpnEthernetSegments().Items() { - item.validateObj(vObj, set_default) - } - - } - - // AsType is required - if obj.obj.AsType == nil { - vObj.validationErrors = append(vObj.validationErrors, "AsType is required field on interface BgpV6Peer") - } - - // AsNumber is required - if obj.obj.AsNumber == nil { - vObj.validationErrors = append(vObj.validationErrors, "AsNumber is required field on interface BgpV6Peer") - } - - if obj.obj.Advanced != nil { - - obj.Advanced().validateObj(vObj, set_default) - } - - if obj.obj.Capability != nil { - - obj.Capability().validateObj(vObj, set_default) - } - - if obj.obj.LearnedInformationFilter != nil { - - obj.LearnedInformationFilter().validateObj(vObj, set_default) - } - - if len(obj.obj.V4Routes) != 0 { - - if set_default { - obj.V4Routes().clearHolderSlice() - for _, item := range obj.obj.V4Routes { - obj.V4Routes().appendHolderSlice(&bgpV4RouteRange{obj: item}) - } - } - for _, item := range obj.V4Routes().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.V6Routes) != 0 { - - if set_default { - obj.V6Routes().clearHolderSlice() - for _, item := range obj.obj.V6Routes { - obj.V6Routes().appendHolderSlice(&bgpV6RouteRange{obj: item}) - } - } - for _, item := range obj.V6Routes().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.V4SrtePolicies) != 0 { - - if set_default { - obj.V4SrtePolicies().clearHolderSlice() - for _, item := range obj.obj.V4SrtePolicies { - obj.V4SrtePolicies().appendHolderSlice(&bgpSrteV4Policy{obj: item}) - } - } - for _, item := range obj.V4SrtePolicies().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.V6SrtePolicies) != 0 { - - if set_default { - obj.V6SrtePolicies().clearHolderSlice() - for _, item := range obj.obj.V6SrtePolicies { - obj.V6SrtePolicies().appendHolderSlice(&bgpSrteV6Policy{obj: item}) - } - } - for _, item := range obj.V6SrtePolicies().Items() { - item.validateObj(vObj, set_default) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpV6Peer") - } - - if obj.obj.GracefulRestart != nil { - - obj.GracefulRestart().validateObj(vObj, set_default) - } - - if obj.obj.ReplayUpdates != nil { - - obj.ReplayUpdates().validateObj(vObj, set_default) - } - -} - -func (obj *bgpV6Peer) setDefault() { - if obj.obj.AsNumberWidth == nil { - obj.SetAsNumberWidth(BgpV6PeerAsNumberWidth.FOUR) - - } - -} - -// ***** VxlanV4TunnelDestinationIPMode ***** -type vxlanV4TunnelDestinationIPMode struct { - validation - obj *otg.VxlanV4TunnelDestinationIPMode - marshaller marshalVxlanV4TunnelDestinationIPMode - unMarshaller unMarshalVxlanV4TunnelDestinationIPMode - unicastHolder VxlanV4TunnelDestinationIPModeUnicast - multicastHolder VxlanV4TunnelDestinationIPModeMulticast -} - -func NewVxlanV4TunnelDestinationIPMode() VxlanV4TunnelDestinationIPMode { - obj := vxlanV4TunnelDestinationIPMode{obj: &otg.VxlanV4TunnelDestinationIPMode{}} - obj.setDefault() - return &obj -} - -func (obj *vxlanV4TunnelDestinationIPMode) msg() *otg.VxlanV4TunnelDestinationIPMode { - return obj.obj -} - -func (obj *vxlanV4TunnelDestinationIPMode) setMsg(msg *otg.VxlanV4TunnelDestinationIPMode) VxlanV4TunnelDestinationIPMode { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalvxlanV4TunnelDestinationIPMode struct { - obj *vxlanV4TunnelDestinationIPMode -} - -type marshalVxlanV4TunnelDestinationIPMode interface { - // ToProto marshals VxlanV4TunnelDestinationIPMode to protobuf object *otg.VxlanV4TunnelDestinationIPMode - ToProto() (*otg.VxlanV4TunnelDestinationIPMode, error) - // ToPbText marshals VxlanV4TunnelDestinationIPMode to protobuf text - ToPbText() (string, error) - // ToYaml marshals VxlanV4TunnelDestinationIPMode to YAML text - ToYaml() (string, error) - // ToJson marshals VxlanV4TunnelDestinationIPMode to JSON text - ToJson() (string, error) -} - -type unMarshalvxlanV4TunnelDestinationIPMode struct { - obj *vxlanV4TunnelDestinationIPMode -} - -type unMarshalVxlanV4TunnelDestinationIPMode interface { - // FromProto unmarshals VxlanV4TunnelDestinationIPMode from protobuf object *otg.VxlanV4TunnelDestinationIPMode - FromProto(msg *otg.VxlanV4TunnelDestinationIPMode) (VxlanV4TunnelDestinationIPMode, error) - // FromPbText unmarshals VxlanV4TunnelDestinationIPMode from protobuf text - FromPbText(value string) error - // FromYaml unmarshals VxlanV4TunnelDestinationIPMode from YAML text - FromYaml(value string) error - // FromJson unmarshals VxlanV4TunnelDestinationIPMode from JSON text - FromJson(value string) error -} - -func (obj *vxlanV4TunnelDestinationIPMode) Marshal() marshalVxlanV4TunnelDestinationIPMode { - if obj.marshaller == nil { - obj.marshaller = &marshalvxlanV4TunnelDestinationIPMode{obj: obj} - } - return obj.marshaller -} - -func (obj *vxlanV4TunnelDestinationIPMode) Unmarshal() unMarshalVxlanV4TunnelDestinationIPMode { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalvxlanV4TunnelDestinationIPMode{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalvxlanV4TunnelDestinationIPMode) ToProto() (*otg.VxlanV4TunnelDestinationIPMode, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalvxlanV4TunnelDestinationIPMode) FromProto(msg *otg.VxlanV4TunnelDestinationIPMode) (VxlanV4TunnelDestinationIPMode, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalvxlanV4TunnelDestinationIPMode) 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 *unMarshalvxlanV4TunnelDestinationIPMode) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalvxlanV4TunnelDestinationIPMode) 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 *unMarshalvxlanV4TunnelDestinationIPMode) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalvxlanV4TunnelDestinationIPMode) 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 *unMarshalvxlanV4TunnelDestinationIPMode) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *vxlanV4TunnelDestinationIPMode) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *vxlanV4TunnelDestinationIPMode) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *vxlanV4TunnelDestinationIPMode) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *vxlanV4TunnelDestinationIPMode) Clone() (VxlanV4TunnelDestinationIPMode, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewVxlanV4TunnelDestinationIPMode() - 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 -} - -func (obj *vxlanV4TunnelDestinationIPMode) setNil() { - obj.unicastHolder = nil - obj.multicastHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// VxlanV4TunnelDestinationIPMode is communication mode between the VTEPs, either unicast or multicast. -type VxlanV4TunnelDestinationIPMode interface { - Validation - // msg marshals VxlanV4TunnelDestinationIPMode to protobuf object *otg.VxlanV4TunnelDestinationIPMode - // and doesn't set defaults - msg() *otg.VxlanV4TunnelDestinationIPMode - // setMsg unmarshals VxlanV4TunnelDestinationIPMode from protobuf object *otg.VxlanV4TunnelDestinationIPMode - // and doesn't set defaults - setMsg(*otg.VxlanV4TunnelDestinationIPMode) VxlanV4TunnelDestinationIPMode - // provides marshal interface - Marshal() marshalVxlanV4TunnelDestinationIPMode - // provides unmarshal interface - Unmarshal() unMarshalVxlanV4TunnelDestinationIPMode - // validate validates VxlanV4TunnelDestinationIPMode - validate() error - // A stringer function - String() string - // Clones the object - Clone() (VxlanV4TunnelDestinationIPMode, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns VxlanV4TunnelDestinationIPModeChoiceEnum, set in VxlanV4TunnelDestinationIPMode - Choice() VxlanV4TunnelDestinationIPModeChoiceEnum - // setChoice assigns VxlanV4TunnelDestinationIPModeChoiceEnum provided by user to VxlanV4TunnelDestinationIPMode - setChoice(value VxlanV4TunnelDestinationIPModeChoiceEnum) VxlanV4TunnelDestinationIPMode - // HasChoice checks if Choice has been set in VxlanV4TunnelDestinationIPMode - HasChoice() bool - // Unicast returns VxlanV4TunnelDestinationIPModeUnicast, set in VxlanV4TunnelDestinationIPMode. - // VxlanV4TunnelDestinationIPModeUnicast is description is TBD - Unicast() VxlanV4TunnelDestinationIPModeUnicast - // SetUnicast assigns VxlanV4TunnelDestinationIPModeUnicast provided by user to VxlanV4TunnelDestinationIPMode. - // VxlanV4TunnelDestinationIPModeUnicast is description is TBD - SetUnicast(value VxlanV4TunnelDestinationIPModeUnicast) VxlanV4TunnelDestinationIPMode - // HasUnicast checks if Unicast has been set in VxlanV4TunnelDestinationIPMode - HasUnicast() bool - // Multicast returns VxlanV4TunnelDestinationIPModeMulticast, set in VxlanV4TunnelDestinationIPMode. - // VxlanV4TunnelDestinationIPModeMulticast is multicast Group address for member VNI(VXLAN Network Identifier) - Multicast() VxlanV4TunnelDestinationIPModeMulticast - // SetMulticast assigns VxlanV4TunnelDestinationIPModeMulticast provided by user to VxlanV4TunnelDestinationIPMode. - // VxlanV4TunnelDestinationIPModeMulticast is multicast Group address for member VNI(VXLAN Network Identifier) - SetMulticast(value VxlanV4TunnelDestinationIPModeMulticast) VxlanV4TunnelDestinationIPMode - // HasMulticast checks if Multicast has been set in VxlanV4TunnelDestinationIPMode - HasMulticast() bool - setNil() -} - -type VxlanV4TunnelDestinationIPModeChoiceEnum string - -// Enum of Choice on VxlanV4TunnelDestinationIPMode -var VxlanV4TunnelDestinationIPModeChoice = struct { - UNICAST VxlanV4TunnelDestinationIPModeChoiceEnum - MULTICAST VxlanV4TunnelDestinationIPModeChoiceEnum -}{ - UNICAST: VxlanV4TunnelDestinationIPModeChoiceEnum("unicast"), - MULTICAST: VxlanV4TunnelDestinationIPModeChoiceEnum("multicast"), -} - -func (obj *vxlanV4TunnelDestinationIPMode) Choice() VxlanV4TunnelDestinationIPModeChoiceEnum { - return VxlanV4TunnelDestinationIPModeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// unicast or multicast -// Choice returns a string -func (obj *vxlanV4TunnelDestinationIPMode) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *vxlanV4TunnelDestinationIPMode) setChoice(value VxlanV4TunnelDestinationIPModeChoiceEnum) VxlanV4TunnelDestinationIPMode { - intValue, ok := otg.VxlanV4TunnelDestinationIPMode_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on VxlanV4TunnelDestinationIPModeChoiceEnum", string(value))) - return obj - } - enumValue := otg.VxlanV4TunnelDestinationIPMode_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Multicast = nil - obj.multicastHolder = nil - obj.obj.Unicast = nil - obj.unicastHolder = nil - - if value == VxlanV4TunnelDestinationIPModeChoice.UNICAST { - obj.obj.Unicast = NewVxlanV4TunnelDestinationIPModeUnicast().msg() - } - - if value == VxlanV4TunnelDestinationIPModeChoice.MULTICAST { - obj.obj.Multicast = NewVxlanV4TunnelDestinationIPModeMulticast().msg() - } - - return obj -} - -// description is TBD -// Unicast returns a VxlanV4TunnelDestinationIPModeUnicast -func (obj *vxlanV4TunnelDestinationIPMode) Unicast() VxlanV4TunnelDestinationIPModeUnicast { - if obj.obj.Unicast == nil { - obj.setChoice(VxlanV4TunnelDestinationIPModeChoice.UNICAST) - } - if obj.unicastHolder == nil { - obj.unicastHolder = &vxlanV4TunnelDestinationIPModeUnicast{obj: obj.obj.Unicast} - } - return obj.unicastHolder -} - -// description is TBD -// Unicast returns a VxlanV4TunnelDestinationIPModeUnicast -func (obj *vxlanV4TunnelDestinationIPMode) HasUnicast() bool { - return obj.obj.Unicast != nil -} - -// description is TBD -// SetUnicast sets the VxlanV4TunnelDestinationIPModeUnicast value in the VxlanV4TunnelDestinationIPMode object -func (obj *vxlanV4TunnelDestinationIPMode) SetUnicast(value VxlanV4TunnelDestinationIPModeUnicast) VxlanV4TunnelDestinationIPMode { - obj.setChoice(VxlanV4TunnelDestinationIPModeChoice.UNICAST) - obj.unicastHolder = nil - obj.obj.Unicast = value.msg() - - return obj -} - -// description is TBD -// Multicast returns a VxlanV4TunnelDestinationIPModeMulticast -func (obj *vxlanV4TunnelDestinationIPMode) Multicast() VxlanV4TunnelDestinationIPModeMulticast { - if obj.obj.Multicast == nil { - obj.setChoice(VxlanV4TunnelDestinationIPModeChoice.MULTICAST) - } - if obj.multicastHolder == nil { - obj.multicastHolder = &vxlanV4TunnelDestinationIPModeMulticast{obj: obj.obj.Multicast} - } - return obj.multicastHolder -} - -// description is TBD -// Multicast returns a VxlanV4TunnelDestinationIPModeMulticast -func (obj *vxlanV4TunnelDestinationIPMode) HasMulticast() bool { - return obj.obj.Multicast != nil -} - -// description is TBD -// SetMulticast sets the VxlanV4TunnelDestinationIPModeMulticast value in the VxlanV4TunnelDestinationIPMode object -func (obj *vxlanV4TunnelDestinationIPMode) SetMulticast(value VxlanV4TunnelDestinationIPModeMulticast) VxlanV4TunnelDestinationIPMode { - obj.setChoice(VxlanV4TunnelDestinationIPModeChoice.MULTICAST) - obj.multicastHolder = nil - obj.obj.Multicast = value.msg() - - return obj -} - -func (obj *vxlanV4TunnelDestinationIPMode) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Unicast != nil { - - obj.Unicast().validateObj(vObj, set_default) - } - - if obj.obj.Multicast != nil { - - obj.Multicast().validateObj(vObj, set_default) - } - -} - -func (obj *vxlanV4TunnelDestinationIPMode) setDefault() { - var choices_set int = 0 - var choice VxlanV4TunnelDestinationIPModeChoiceEnum - - if obj.obj.Unicast != nil { - choices_set += 1 - choice = VxlanV4TunnelDestinationIPModeChoice.UNICAST - } - - if obj.obj.Multicast != nil { - choices_set += 1 - choice = VxlanV4TunnelDestinationIPModeChoice.MULTICAST - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(VxlanV4TunnelDestinationIPModeChoice.MULTICAST) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in VxlanV4TunnelDestinationIPMode") - } - } else { - intVal := otg.VxlanV4TunnelDestinationIPMode_Choice_Enum_value[string(choice)] - enumValue := otg.VxlanV4TunnelDestinationIPMode_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** VxlanV6TunnelDestinationIPMode ***** -type vxlanV6TunnelDestinationIPMode struct { - validation - obj *otg.VxlanV6TunnelDestinationIPMode - marshaller marshalVxlanV6TunnelDestinationIPMode - unMarshaller unMarshalVxlanV6TunnelDestinationIPMode - unicastHolder VxlanV6TunnelDestinationIPModeUnicast - multicastHolder VxlanV6TunnelDestinationIPModeMulticast -} - -func NewVxlanV6TunnelDestinationIPMode() VxlanV6TunnelDestinationIPMode { - obj := vxlanV6TunnelDestinationIPMode{obj: &otg.VxlanV6TunnelDestinationIPMode{}} - obj.setDefault() - return &obj -} - -func (obj *vxlanV6TunnelDestinationIPMode) msg() *otg.VxlanV6TunnelDestinationIPMode { - return obj.obj -} - -func (obj *vxlanV6TunnelDestinationIPMode) setMsg(msg *otg.VxlanV6TunnelDestinationIPMode) VxlanV6TunnelDestinationIPMode { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalvxlanV6TunnelDestinationIPMode struct { - obj *vxlanV6TunnelDestinationIPMode -} - -type marshalVxlanV6TunnelDestinationIPMode interface { - // ToProto marshals VxlanV6TunnelDestinationIPMode to protobuf object *otg.VxlanV6TunnelDestinationIPMode - ToProto() (*otg.VxlanV6TunnelDestinationIPMode, error) - // ToPbText marshals VxlanV6TunnelDestinationIPMode to protobuf text - ToPbText() (string, error) - // ToYaml marshals VxlanV6TunnelDestinationIPMode to YAML text - ToYaml() (string, error) - // ToJson marshals VxlanV6TunnelDestinationIPMode to JSON text - ToJson() (string, error) -} - -type unMarshalvxlanV6TunnelDestinationIPMode struct { - obj *vxlanV6TunnelDestinationIPMode -} - -type unMarshalVxlanV6TunnelDestinationIPMode interface { - // FromProto unmarshals VxlanV6TunnelDestinationIPMode from protobuf object *otg.VxlanV6TunnelDestinationIPMode - FromProto(msg *otg.VxlanV6TunnelDestinationIPMode) (VxlanV6TunnelDestinationIPMode, error) - // FromPbText unmarshals VxlanV6TunnelDestinationIPMode from protobuf text - FromPbText(value string) error - // FromYaml unmarshals VxlanV6TunnelDestinationIPMode from YAML text - FromYaml(value string) error - // FromJson unmarshals VxlanV6TunnelDestinationIPMode from JSON text - FromJson(value string) error -} - -func (obj *vxlanV6TunnelDestinationIPMode) Marshal() marshalVxlanV6TunnelDestinationIPMode { - if obj.marshaller == nil { - obj.marshaller = &marshalvxlanV6TunnelDestinationIPMode{obj: obj} - } - return obj.marshaller -} - -func (obj *vxlanV6TunnelDestinationIPMode) Unmarshal() unMarshalVxlanV6TunnelDestinationIPMode { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalvxlanV6TunnelDestinationIPMode{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalvxlanV6TunnelDestinationIPMode) ToProto() (*otg.VxlanV6TunnelDestinationIPMode, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalvxlanV6TunnelDestinationIPMode) FromProto(msg *otg.VxlanV6TunnelDestinationIPMode) (VxlanV6TunnelDestinationIPMode, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalvxlanV6TunnelDestinationIPMode) 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 *unMarshalvxlanV6TunnelDestinationIPMode) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalvxlanV6TunnelDestinationIPMode) 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 *unMarshalvxlanV6TunnelDestinationIPMode) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalvxlanV6TunnelDestinationIPMode) 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 *unMarshalvxlanV6TunnelDestinationIPMode) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *vxlanV6TunnelDestinationIPMode) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *vxlanV6TunnelDestinationIPMode) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *vxlanV6TunnelDestinationIPMode) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *vxlanV6TunnelDestinationIPMode) Clone() (VxlanV6TunnelDestinationIPMode, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewVxlanV6TunnelDestinationIPMode() - 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 -} - -func (obj *vxlanV6TunnelDestinationIPMode) setNil() { - obj.unicastHolder = nil - obj.multicastHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// VxlanV6TunnelDestinationIPMode is communication mode between the VTEPs, either unicast or multicast. -type VxlanV6TunnelDestinationIPMode interface { - Validation - // msg marshals VxlanV6TunnelDestinationIPMode to protobuf object *otg.VxlanV6TunnelDestinationIPMode - // and doesn't set defaults - msg() *otg.VxlanV6TunnelDestinationIPMode - // setMsg unmarshals VxlanV6TunnelDestinationIPMode from protobuf object *otg.VxlanV6TunnelDestinationIPMode - // and doesn't set defaults - setMsg(*otg.VxlanV6TunnelDestinationIPMode) VxlanV6TunnelDestinationIPMode - // provides marshal interface - Marshal() marshalVxlanV6TunnelDestinationIPMode - // provides unmarshal interface - Unmarshal() unMarshalVxlanV6TunnelDestinationIPMode - // validate validates VxlanV6TunnelDestinationIPMode - validate() error - // A stringer function - String() string - // Clones the object - Clone() (VxlanV6TunnelDestinationIPMode, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns VxlanV6TunnelDestinationIPModeChoiceEnum, set in VxlanV6TunnelDestinationIPMode - Choice() VxlanV6TunnelDestinationIPModeChoiceEnum - // setChoice assigns VxlanV6TunnelDestinationIPModeChoiceEnum provided by user to VxlanV6TunnelDestinationIPMode - setChoice(value VxlanV6TunnelDestinationIPModeChoiceEnum) VxlanV6TunnelDestinationIPMode - // HasChoice checks if Choice has been set in VxlanV6TunnelDestinationIPMode - HasChoice() bool - // Unicast returns VxlanV6TunnelDestinationIPModeUnicast, set in VxlanV6TunnelDestinationIPMode. - // VxlanV6TunnelDestinationIPModeUnicast is description is TBD - Unicast() VxlanV6TunnelDestinationIPModeUnicast - // SetUnicast assigns VxlanV6TunnelDestinationIPModeUnicast provided by user to VxlanV6TunnelDestinationIPMode. - // VxlanV6TunnelDestinationIPModeUnicast is description is TBD - SetUnicast(value VxlanV6TunnelDestinationIPModeUnicast) VxlanV6TunnelDestinationIPMode - // HasUnicast checks if Unicast has been set in VxlanV6TunnelDestinationIPMode - HasUnicast() bool - // Multicast returns VxlanV6TunnelDestinationIPModeMulticast, set in VxlanV6TunnelDestinationIPMode. - // VxlanV6TunnelDestinationIPModeMulticast is multicast Group address for member VNI(VXLAN Network Identifier) - Multicast() VxlanV6TunnelDestinationIPModeMulticast - // SetMulticast assigns VxlanV6TunnelDestinationIPModeMulticast provided by user to VxlanV6TunnelDestinationIPMode. - // VxlanV6TunnelDestinationIPModeMulticast is multicast Group address for member VNI(VXLAN Network Identifier) - SetMulticast(value VxlanV6TunnelDestinationIPModeMulticast) VxlanV6TunnelDestinationIPMode - // HasMulticast checks if Multicast has been set in VxlanV6TunnelDestinationIPMode - HasMulticast() bool - setNil() -} - -type VxlanV6TunnelDestinationIPModeChoiceEnum string - -// Enum of Choice on VxlanV6TunnelDestinationIPMode -var VxlanV6TunnelDestinationIPModeChoice = struct { - UNICAST VxlanV6TunnelDestinationIPModeChoiceEnum - MULTICAST VxlanV6TunnelDestinationIPModeChoiceEnum -}{ - UNICAST: VxlanV6TunnelDestinationIPModeChoiceEnum("unicast"), - MULTICAST: VxlanV6TunnelDestinationIPModeChoiceEnum("multicast"), -} - -func (obj *vxlanV6TunnelDestinationIPMode) Choice() VxlanV6TunnelDestinationIPModeChoiceEnum { - return VxlanV6TunnelDestinationIPModeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// unicast or multicast -// Choice returns a string -func (obj *vxlanV6TunnelDestinationIPMode) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *vxlanV6TunnelDestinationIPMode) setChoice(value VxlanV6TunnelDestinationIPModeChoiceEnum) VxlanV6TunnelDestinationIPMode { - intValue, ok := otg.VxlanV6TunnelDestinationIPMode_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on VxlanV6TunnelDestinationIPModeChoiceEnum", string(value))) - return obj - } - enumValue := otg.VxlanV6TunnelDestinationIPMode_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Multicast = nil - obj.multicastHolder = nil - obj.obj.Unicast = nil - obj.unicastHolder = nil - - if value == VxlanV6TunnelDestinationIPModeChoice.UNICAST { - obj.obj.Unicast = NewVxlanV6TunnelDestinationIPModeUnicast().msg() - } - - if value == VxlanV6TunnelDestinationIPModeChoice.MULTICAST { - obj.obj.Multicast = NewVxlanV6TunnelDestinationIPModeMulticast().msg() - } - - return obj -} - -// description is TBD -// Unicast returns a VxlanV6TunnelDestinationIPModeUnicast -func (obj *vxlanV6TunnelDestinationIPMode) Unicast() VxlanV6TunnelDestinationIPModeUnicast { - if obj.obj.Unicast == nil { - obj.setChoice(VxlanV6TunnelDestinationIPModeChoice.UNICAST) - } - if obj.unicastHolder == nil { - obj.unicastHolder = &vxlanV6TunnelDestinationIPModeUnicast{obj: obj.obj.Unicast} - } - return obj.unicastHolder -} - -// description is TBD -// Unicast returns a VxlanV6TunnelDestinationIPModeUnicast -func (obj *vxlanV6TunnelDestinationIPMode) HasUnicast() bool { - return obj.obj.Unicast != nil -} - -// description is TBD -// SetUnicast sets the VxlanV6TunnelDestinationIPModeUnicast value in the VxlanV6TunnelDestinationIPMode object -func (obj *vxlanV6TunnelDestinationIPMode) SetUnicast(value VxlanV6TunnelDestinationIPModeUnicast) VxlanV6TunnelDestinationIPMode { - obj.setChoice(VxlanV6TunnelDestinationIPModeChoice.UNICAST) - obj.unicastHolder = nil - obj.obj.Unicast = value.msg() - - return obj -} - -// description is TBD -// Multicast returns a VxlanV6TunnelDestinationIPModeMulticast -func (obj *vxlanV6TunnelDestinationIPMode) Multicast() VxlanV6TunnelDestinationIPModeMulticast { - if obj.obj.Multicast == nil { - obj.setChoice(VxlanV6TunnelDestinationIPModeChoice.MULTICAST) - } - if obj.multicastHolder == nil { - obj.multicastHolder = &vxlanV6TunnelDestinationIPModeMulticast{obj: obj.obj.Multicast} - } - return obj.multicastHolder -} - -// description is TBD -// Multicast returns a VxlanV6TunnelDestinationIPModeMulticast -func (obj *vxlanV6TunnelDestinationIPMode) HasMulticast() bool { - return obj.obj.Multicast != nil -} - -// description is TBD -// SetMulticast sets the VxlanV6TunnelDestinationIPModeMulticast value in the VxlanV6TunnelDestinationIPMode object -func (obj *vxlanV6TunnelDestinationIPMode) SetMulticast(value VxlanV6TunnelDestinationIPModeMulticast) VxlanV6TunnelDestinationIPMode { - obj.setChoice(VxlanV6TunnelDestinationIPModeChoice.MULTICAST) - obj.multicastHolder = nil - obj.obj.Multicast = value.msg() - - return obj -} - -func (obj *vxlanV6TunnelDestinationIPMode) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Unicast != nil { - - obj.Unicast().validateObj(vObj, set_default) - } - - if obj.obj.Multicast != nil { - - obj.Multicast().validateObj(vObj, set_default) - } - -} - -func (obj *vxlanV6TunnelDestinationIPMode) setDefault() { - var choices_set int = 0 - var choice VxlanV6TunnelDestinationIPModeChoiceEnum - - if obj.obj.Unicast != nil { - choices_set += 1 - choice = VxlanV6TunnelDestinationIPModeChoice.UNICAST - } - - if obj.obj.Multicast != nil { - choices_set += 1 - choice = VxlanV6TunnelDestinationIPModeChoice.MULTICAST - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(VxlanV6TunnelDestinationIPModeChoice.MULTICAST) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in VxlanV6TunnelDestinationIPMode") - } - } else { - intVal := otg.VxlanV6TunnelDestinationIPMode_Choice_Enum_value[string(choice)] - enumValue := otg.VxlanV6TunnelDestinationIPMode_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** RsvpLspIpv4InterfaceP2PEgressIpv4Lsp ***** -type rsvpLspIpv4InterfaceP2PEgressIpv4Lsp struct { - validation - obj *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - marshaller marshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp - unMarshaller unMarshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp -} - -func NewRsvpLspIpv4InterfaceP2PEgressIpv4Lsp() RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { - obj := rsvpLspIpv4InterfaceP2PEgressIpv4Lsp{obj: &otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) msg() *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { - return obj.obj -} - -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) setMsg(msg *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp struct { - obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp -} - -type marshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp interface { - // ToProto marshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp to protobuf object *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - ToProto() (*otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp, error) - // ToPbText marshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp struct { - obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp -} - -type unMarshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp interface { - // FromProto unmarshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp from protobuf object *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - FromProto(msg *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp) (RsvpLspIpv4InterfaceP2PEgressIpv4Lsp, error) - // FromPbText unmarshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp from JSON text - FromJson(value string) error -} - -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) Marshal() marshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) Unmarshal() unMarshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) ToProto() (*otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) FromProto(msg *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp) (RsvpLspIpv4InterfaceP2PEgressIpv4Lsp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) 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 *unMarshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) 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 *marshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) 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 *unMarshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) 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 *marshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) 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 *unMarshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) 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 *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) Clone() (RsvpLspIpv4InterfaceP2PEgressIpv4Lsp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpLspIpv4InterfaceP2PEgressIpv4Lsp() - 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 -} - -// RsvpLspIpv4InterfaceP2PEgressIpv4Lsp is configuration for RSVP Egress Point-to-Point(P2P) IPv4 LSPs. -type RsvpLspIpv4InterfaceP2PEgressIpv4Lsp interface { - Validation - // msg marshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp to protobuf object *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - // and doesn't set defaults - msg() *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - // setMsg unmarshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp from protobuf object *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - // and doesn't set defaults - setMsg(*otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - // provides marshal interface - Marshal() marshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp - // provides unmarshal interface - Unmarshal() unMarshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp - // validate validates RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpLspIpv4InterfaceP2PEgressIpv4Lsp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp. - Name() string - // SetName assigns string provided by user to RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - SetName(value string) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - // RefreshInterval returns uint32, set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp. - RefreshInterval() uint32 - // SetRefreshInterval assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - SetRefreshInterval(value uint32) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - // HasRefreshInterval checks if RefreshInterval has been set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - HasRefreshInterval() bool - // TimeoutMultiplier returns uint32, set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp. - TimeoutMultiplier() uint32 - // SetTimeoutMultiplier assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - SetTimeoutMultiplier(value uint32) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - // HasTimeoutMultiplier checks if TimeoutMultiplier has been set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - HasTimeoutMultiplier() bool - // ReservationStyle returns RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum, set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - ReservationStyle() RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum - // SetReservationStyle assigns RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum provided by user to RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - SetReservationStyle(value RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - // HasReservationStyle checks if ReservationStyle has been set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - HasReservationStyle() bool - // EnableFixedLabel returns bool, set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp. - EnableFixedLabel() bool - // SetEnableFixedLabel assigns bool provided by user to RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - SetEnableFixedLabel(value bool) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - // HasEnableFixedLabel checks if EnableFixedLabel has been set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - HasEnableFixedLabel() bool - // FixedLabelValue returns uint32, set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp. - FixedLabelValue() uint32 - // SetFixedLabelValue assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - SetFixedLabelValue(value uint32) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - // HasFixedLabelValue checks if FixedLabelValue has been set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp - HasFixedLabelValue() bool -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the RsvpLspIpv4InterfaceP2PEgressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) SetName(value string) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { - - obj.obj.Name = &value - return obj -} - -// The time in seconds between successive transmissions of RESV Refreshes. The actual refresh interval is jittered by upto 50%. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. -// RefreshInterval returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) RefreshInterval() uint32 { - - return *obj.obj.RefreshInterval - -} - -// The time in seconds between successive transmissions of RESV Refreshes. The actual refresh interval is jittered by upto 50%. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. -// RefreshInterval returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) HasRefreshInterval() bool { - return obj.obj.RefreshInterval != nil -} - -// The time in seconds between successive transmissions of RESV Refreshes. The actual refresh interval is jittered by upto 50%. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. -// SetRefreshInterval sets the uint32 value in the RsvpLspIpv4InterfaceP2PEgressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) SetRefreshInterval(value uint32) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { - - obj.obj.RefreshInterval = &value - return obj -} - -// The number of missed PATH refreshes after which a recieving node should consider the LSP state to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. -// TimeoutMultiplier returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) TimeoutMultiplier() uint32 { - - return *obj.obj.TimeoutMultiplier - -} - -// The number of missed PATH refreshes after which a recieving node should consider the LSP state to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. -// TimeoutMultiplier returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) HasTimeoutMultiplier() bool { - return obj.obj.TimeoutMultiplier != nil -} - -// The number of missed PATH refreshes after which a recieving node should consider the LSP state to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. -// SetTimeoutMultiplier sets the uint32 value in the RsvpLspIpv4InterfaceP2PEgressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) SetTimeoutMultiplier(value uint32) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { - - obj.obj.TimeoutMultiplier = &value - return obj -} - -type RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum string - -// Enum of ReservationStyle on RsvpLspIpv4InterfaceP2PEgressIpv4Lsp -var RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyle = struct { - SHARED_EXPLICIT RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum - FIXED_FILTER RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum - AUTO RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum -}{ - SHARED_EXPLICIT: RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum("shared_explicit"), - FIXED_FILTER: RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum("fixed_filter"), - AUTO: RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum("auto"), -} - -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) ReservationStyle() RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum { - return RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum(obj.obj.ReservationStyle.Enum().String()) -} - -// It determines how RSVP-TE enabled network devices set up reservations along the path between an end-to-end QOS-enabled connection. If 'auto' is enabled, the style is chosen based on whether the incoming Path has 'SE Desired' flag set. Otherwise, the style is chosen based on the value selected for this attribute. -// ReservationStyle returns a string -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) HasReservationStyle() bool { - return obj.obj.ReservationStyle != nil -} - -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) SetReservationStyle(value RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { - intValue, ok := otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp_ReservationStyle_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum", string(value))) - return obj - } - enumValue := otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp_ReservationStyle_Enum(intValue) - obj.obj.ReservationStyle = &enumValue - - return obj -} - -// If enabled, a specific fixed label will be advertised by the egress or tail end for all Path messages received by this egress. This can be leveraged to advertise Explicit or Implicit null labels. -// EnableFixedLabel returns a bool -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) EnableFixedLabel() bool { - - return *obj.obj.EnableFixedLabel - -} - -// If enabled, a specific fixed label will be advertised by the egress or tail end for all Path messages received by this egress. This can be leveraged to advertise Explicit or Implicit null labels. -// EnableFixedLabel returns a bool -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) HasEnableFixedLabel() bool { - return obj.obj.EnableFixedLabel != nil -} - -// If enabled, a specific fixed label will be advertised by the egress or tail end for all Path messages received by this egress. This can be leveraged to advertise Explicit or Implicit null labels. -// SetEnableFixedLabel sets the bool value in the RsvpLspIpv4InterfaceP2PEgressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) SetEnableFixedLabel(value bool) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { - - obj.obj.EnableFixedLabel = &value - return obj -} - -// The fixed label value as advertised by egress in RESV message. Applicable only if 'fixed_label' is set to 'true'. Special values are '0 - IPv4 Explicit NULL', '2 - IPv6 Explicit NULL' and '3 - Implicit NULL'. Outside of this, labels are expected to have a minimum value of 16. -// FixedLabelValue returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) FixedLabelValue() uint32 { - - return *obj.obj.FixedLabelValue - -} - -// The fixed label value as advertised by egress in RESV message. Applicable only if 'fixed_label' is set to 'true'. Special values are '0 - IPv4 Explicit NULL', '2 - IPv6 Explicit NULL' and '3 - Implicit NULL'. Outside of this, labels are expected to have a minimum value of 16. -// FixedLabelValue returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) HasFixedLabelValue() bool { - return obj.obj.FixedLabelValue != nil -} - -// The fixed label value as advertised by egress in RESV message. Applicable only if 'fixed_label' is set to 'true'. Special values are '0 - IPv4 Explicit NULL', '2 - IPv6 Explicit NULL' and '3 - Implicit NULL'. Outside of this, labels are expected to have a minimum value of 16. -// SetFixedLabelValue sets the uint32 value in the RsvpLspIpv4InterfaceP2PEgressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) SetFixedLabelValue(value uint32) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { - - obj.obj.FixedLabelValue = &value - return obj -} - -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface RsvpLspIpv4InterfaceP2PEgressIpv4Lsp") - } - - if obj.obj.RefreshInterval != nil { - - if *obj.obj.RefreshInterval > 3600 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpLspIpv4InterfaceP2PEgressIpv4Lsp.RefreshInterval <= 3600 but Got %d", *obj.obj.RefreshInterval)) - } - - } - - if obj.obj.TimeoutMultiplier != nil { - - if *obj.obj.TimeoutMultiplier > 10 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpLspIpv4InterfaceP2PEgressIpv4Lsp.TimeoutMultiplier <= 10 but Got %d", *obj.obj.TimeoutMultiplier)) - } - - } - - if obj.obj.FixedLabelValue != nil { - - if *obj.obj.FixedLabelValue > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpLspIpv4InterfaceP2PEgressIpv4Lsp.FixedLabelValue <= 1048575 but Got %d", *obj.obj.FixedLabelValue)) - } - - } - -} - -func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) setDefault() { - if obj.obj.RefreshInterval == nil { - obj.SetRefreshInterval(30) - } - if obj.obj.TimeoutMultiplier == nil { - obj.SetTimeoutMultiplier(3) - } - if obj.obj.ReservationStyle == nil { - obj.SetReservationStyle(RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyle.SHARED_EXPLICIT) - - } - if obj.obj.EnableFixedLabel == nil { - obj.SetEnableFixedLabel(false) - } - if obj.obj.FixedLabelValue == nil { - obj.SetFixedLabelValue(0) - } - -} - -// ***** RsvpLspIpv4InterfaceP2PIngressIpv4Lsp ***** -type rsvpLspIpv4InterfaceP2PIngressIpv4Lsp struct { - validation - obj *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - marshaller marshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp - unMarshaller unMarshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp - sessionAttributeHolder RsvpSessionAttribute - tspecHolder RsvpTspec - fastRerouteHolder RsvpFastReroute - eroHolder RsvpEro -} - -func NewRsvpLspIpv4InterfaceP2PIngressIpv4Lsp() RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - obj := rsvpLspIpv4InterfaceP2PIngressIpv4Lsp{obj: &otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) msg() *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - return obj.obj -} - -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) setMsg(msg *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp struct { - obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp -} - -type marshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp interface { - // ToProto marshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp to protobuf object *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - ToProto() (*otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp, error) - // ToPbText marshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp struct { - obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp -} - -type unMarshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp interface { - // FromProto unmarshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp from protobuf object *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - FromProto(msg *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) (RsvpLspIpv4InterfaceP2PIngressIpv4Lsp, error) - // FromPbText unmarshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp from JSON text - FromJson(value string) error -} - -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) Marshal() marshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) Unmarshal() unMarshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) ToProto() (*otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) FromProto(msg *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) (RsvpLspIpv4InterfaceP2PIngressIpv4Lsp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) 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 *unMarshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) 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 *unMarshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) 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 *unMarshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) Clone() (RsvpLspIpv4InterfaceP2PIngressIpv4Lsp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpLspIpv4InterfaceP2PIngressIpv4Lsp() - 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 -} - -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) setNil() { - obj.sessionAttributeHolder = nil - obj.tspecHolder = nil - obj.fastRerouteHolder = nil - obj.eroHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// RsvpLspIpv4InterfaceP2PIngressIpv4Lsp is configuration for an RSVP Ingress point-to-point LSP. -type RsvpLspIpv4InterfaceP2PIngressIpv4Lsp interface { - Validation - // msg marshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp to protobuf object *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // and doesn't set defaults - msg() *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // setMsg unmarshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp from protobuf object *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // and doesn't set defaults - setMsg(*otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // provides marshal interface - Marshal() marshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // provides unmarshal interface - Unmarshal() unMarshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // validate validates RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpLspIpv4InterfaceP2PIngressIpv4Lsp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - Name() string - // SetName assigns string provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - SetName(value string) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // RemoteAddress returns string, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - RemoteAddress() string - // SetRemoteAddress assigns string provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - SetRemoteAddress(value string) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // TunnelId returns uint32, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - TunnelId() uint32 - // SetTunnelId assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - SetTunnelId(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // HasTunnelId checks if TunnelId has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - HasTunnelId() bool - // LspId returns uint32, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - LspId() uint32 - // SetLspId assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - SetLspId(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // HasLspId checks if LspId has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - HasLspId() bool - // RefreshInterval returns uint32, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - RefreshInterval() uint32 - // SetRefreshInterval assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - SetRefreshInterval(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // HasRefreshInterval checks if RefreshInterval has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - HasRefreshInterval() bool - // TimeoutMultiplier returns uint32, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - TimeoutMultiplier() uint32 - // SetTimeoutMultiplier assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - SetTimeoutMultiplier(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // HasTimeoutMultiplier checks if TimeoutMultiplier has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - HasTimeoutMultiplier() bool - // BackupLspId returns uint32, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - BackupLspId() uint32 - // SetBackupLspId assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - SetBackupLspId(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // HasBackupLspId checks if BackupLspId has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - HasBackupLspId() bool - // LspSwitchoverDelay returns uint32, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - LspSwitchoverDelay() uint32 - // SetLspSwitchoverDelay assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - SetLspSwitchoverDelay(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // HasLspSwitchoverDelay checks if LspSwitchoverDelay has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - HasLspSwitchoverDelay() bool - // SessionAttribute returns RsvpSessionAttribute, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - // RsvpSessionAttribute is configuration for RSVP-TE SESSION_ATTRIBUTE object included in Path Messages as defined in RFC3209. The bandwidth_protection_desired and node_protection_desired flags are defined in RFC4090 (Fast Reroute). - SessionAttribute() RsvpSessionAttribute - // SetSessionAttribute assigns RsvpSessionAttribute provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - // RsvpSessionAttribute is configuration for RSVP-TE SESSION_ATTRIBUTE object included in Path Messages as defined in RFC3209. The bandwidth_protection_desired and node_protection_desired flags are defined in RFC4090 (Fast Reroute). - SetSessionAttribute(value RsvpSessionAttribute) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // HasSessionAttribute checks if SessionAttribute has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - HasSessionAttribute() bool - // Tspec returns RsvpTspec, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - // RsvpTspec is configuration for RSVP-TE TSPEC object included in Path Messages. The usage of these parameters is defined in RFC2215. - Tspec() RsvpTspec - // SetTspec assigns RsvpTspec provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - // RsvpTspec is configuration for RSVP-TE TSPEC object included in Path Messages. The usage of these parameters is defined in RFC2215. - SetTspec(value RsvpTspec) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // HasTspec checks if Tspec has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - HasTspec() bool - // FastReroute returns RsvpFastReroute, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - // RsvpFastReroute is configuration for the optional RSVP-TE FAST_REROUTE object included in Path Messages as defined in RFC4090. - FastReroute() RsvpFastReroute - // SetFastReroute assigns RsvpFastReroute provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - // RsvpFastReroute is configuration for the optional RSVP-TE FAST_REROUTE object included in Path Messages as defined in RFC4090. - SetFastReroute(value RsvpFastReroute) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // HasFastReroute checks if FastReroute has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - HasFastReroute() bool - // Ero returns RsvpEro, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - // RsvpEro is configuration for the optional RSVP-TE explicit route object(ERO) object included in Path Messages. - Ero() RsvpEro - // SetEro assigns RsvpEro provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. - // RsvpEro is configuration for the optional RSVP-TE explicit route object(ERO) object included in Path Messages. - SetEro(value RsvpEro) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - // HasEro checks if Ero has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp - HasEro() bool - setNil() -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetName(value string) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - - obj.obj.Name = &value - return obj -} - -// IPv4 address of the remote endpoint of the LSP. -// RemoteAddress returns a string -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RemoteAddress() string { - - return *obj.obj.RemoteAddress - -} - -// IPv4 address of the remote endpoint of the LSP. -// SetRemoteAddress sets the string value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetRemoteAddress(value string) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - - obj.obj.RemoteAddress = &value - return obj -} - -// The Tunnel ID of the RSVP LSP. Carried in the SESSION object in Path Messages. -// TunnelId returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) TunnelId() uint32 { - - return *obj.obj.TunnelId - -} - -// The Tunnel ID of the RSVP LSP. Carried in the SESSION object in Path Messages. -// TunnelId returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasTunnelId() bool { - return obj.obj.TunnelId != nil -} - -// The Tunnel ID of the RSVP LSP. Carried in the SESSION object in Path Messages. -// SetTunnelId sets the uint32 value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetTunnelId(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - - obj.obj.TunnelId = &value - return obj -} - -// The LSP ID of the RSVP LSP. Carried in the SENDER_TEMPLATE object in Path Messages. -// LspId returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) LspId() uint32 { - - return *obj.obj.LspId - -} - -// The LSP ID of the RSVP LSP. Carried in the SENDER_TEMPLATE object in Path Messages. -// LspId returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasLspId() bool { - return obj.obj.LspId != nil -} - -// The LSP ID of the RSVP LSP. Carried in the SENDER_TEMPLATE object in Path Messages. -// SetLspId sets the uint32 value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetLspId(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - - obj.obj.LspId = &value - return obj -} - -// The time in seconds between successive transmissions of PATH Refreshes. The actual refresh interval is jittered by upto 50%. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. -// RefreshInterval returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RefreshInterval() uint32 { - - return *obj.obj.RefreshInterval - -} - -// The time in seconds between successive transmissions of PATH Refreshes. The actual refresh interval is jittered by upto 50%. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. -// RefreshInterval returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasRefreshInterval() bool { - return obj.obj.RefreshInterval != nil -} - -// The time in seconds between successive transmissions of PATH Refreshes. The actual refresh interval is jittered by upto 50%. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. -// SetRefreshInterval sets the uint32 value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetRefreshInterval(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - - obj.obj.RefreshInterval = &value - return obj -} - -// The number of missed RESV refreshes after which a recieving node should consider the LSP state to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. -// TimeoutMultiplier returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) TimeoutMultiplier() uint32 { - - return *obj.obj.TimeoutMultiplier - -} - -// The number of missed RESV refreshes after which a recieving node should consider the LSP state to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. -// TimeoutMultiplier returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasTimeoutMultiplier() bool { - return obj.obj.TimeoutMultiplier != nil -} - -// The number of missed RESV refreshes after which a recieving node should consider the LSP state to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. -// SetTimeoutMultiplier sets the uint32 value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetTimeoutMultiplier(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - - obj.obj.TimeoutMultiplier = &value - return obj -} - -// The LSP id that will be used when creating a Make-Before-Break LSP when the active LSP is using lsp_id. If the active LSP on which Make-Before-Break is being done is using the backup_lsp_id, the new LSP created will toggle to use the lsp_id instead. -// BackupLspId returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) BackupLspId() uint32 { - - return *obj.obj.BackupLspId - -} - -// The LSP id that will be used when creating a Make-Before-Break LSP when the active LSP is using lsp_id. If the active LSP on which Make-Before-Break is being done is using the backup_lsp_id, the new LSP created will toggle to use the lsp_id instead. -// BackupLspId returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasBackupLspId() bool { - return obj.obj.BackupLspId != nil -} - -// The LSP id that will be used when creating a Make-Before-Break LSP when the active LSP is using lsp_id. If the active LSP on which Make-Before-Break is being done is using the backup_lsp_id, the new LSP created will toggle to use the lsp_id instead. -// SetBackupLspId sets the uint32 value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetBackupLspId(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - - obj.obj.BackupLspId = &value - return obj -} - -// The amount of delay in milliseconds that an implementation should wait for before switching traffic to the new LSP created after a Make-Before-Break is done on an LSP. The default value is 0 which means to switch immediately. An implementation should support a minimum delay value of at least 50ms . There is no specification specified maximum value. Setting maximum allowed value to 1 minute. If a delay value is supplied which is lesser than the minimum delay value supported, a warning should be provided indicating that the minimum value of LSP switchover delay is automatically increased to the supported minimum value. This warning should be included in the list of warnings in the 'Response.Warning' attribute sent in the SetConfig 'Success' Response. -// LspSwitchoverDelay returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) LspSwitchoverDelay() uint32 { - - return *obj.obj.LspSwitchoverDelay - -} - -// The amount of delay in milliseconds that an implementation should wait for before switching traffic to the new LSP created after a Make-Before-Break is done on an LSP. The default value is 0 which means to switch immediately. An implementation should support a minimum delay value of at least 50ms . There is no specification specified maximum value. Setting maximum allowed value to 1 minute. If a delay value is supplied which is lesser than the minimum delay value supported, a warning should be provided indicating that the minimum value of LSP switchover delay is automatically increased to the supported minimum value. This warning should be included in the list of warnings in the 'Response.Warning' attribute sent in the SetConfig 'Success' Response. -// LspSwitchoverDelay returns a uint32 -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasLspSwitchoverDelay() bool { - return obj.obj.LspSwitchoverDelay != nil -} - -// The amount of delay in milliseconds that an implementation should wait for before switching traffic to the new LSP created after a Make-Before-Break is done on an LSP. The default value is 0 which means to switch immediately. An implementation should support a minimum delay value of at least 50ms . There is no specification specified maximum value. Setting maximum allowed value to 1 minute. If a delay value is supplied which is lesser than the minimum delay value supported, a warning should be provided indicating that the minimum value of LSP switchover delay is automatically increased to the supported minimum value. This warning should be included in the list of warnings in the 'Response.Warning' attribute sent in the SetConfig 'Success' Response. -// SetLspSwitchoverDelay sets the uint32 value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetLspSwitchoverDelay(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - - obj.obj.LspSwitchoverDelay = &value - return obj -} - -// This contains the values of the fields to be included in the SESSION_ATTRIBUTE object in the Path Message sent for the LSP. -// SessionAttribute returns a RsvpSessionAttribute -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SessionAttribute() RsvpSessionAttribute { - if obj.obj.SessionAttribute == nil { - obj.obj.SessionAttribute = NewRsvpSessionAttribute().msg() - } - if obj.sessionAttributeHolder == nil { - obj.sessionAttributeHolder = &rsvpSessionAttribute{obj: obj.obj.SessionAttribute} - } - return obj.sessionAttributeHolder -} - -// This contains the values of the fields to be included in the SESSION_ATTRIBUTE object in the Path Message sent for the LSP. -// SessionAttribute returns a RsvpSessionAttribute -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasSessionAttribute() bool { - return obj.obj.SessionAttribute != nil -} - -// This contains the values of the fields to be included in the SESSION_ATTRIBUTE object in the Path Message sent for the LSP. -// SetSessionAttribute sets the RsvpSessionAttribute value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetSessionAttribute(value RsvpSessionAttribute) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - - obj.sessionAttributeHolder = nil - obj.obj.SessionAttribute = value.msg() - - return obj -} - -// This contains the values of the fields to be included in the TSPEC object in the Path Message sent for the LSP. -// Tspec returns a RsvpTspec -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) Tspec() RsvpTspec { - if obj.obj.Tspec == nil { - obj.obj.Tspec = NewRsvpTspec().msg() - } - if obj.tspecHolder == nil { - obj.tspecHolder = &rsvpTspec{obj: obj.obj.Tspec} - } - return obj.tspecHolder -} - -// This contains the values of the fields to be included in the TSPEC object in the Path Message sent for the LSP. -// Tspec returns a RsvpTspec -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasTspec() bool { - return obj.obj.Tspec != nil -} - -// This contains the values of the fields to be included in the TSPEC object in the Path Message sent for the LSP. -// SetTspec sets the RsvpTspec value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetTspec(value RsvpTspec) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - - obj.tspecHolder = nil - obj.obj.Tspec = value.msg() - - return obj -} - -// This contains the values of the fields to be included in the FAST_REROUTE object in the Path Message sent for the LSP. -// This is an optional object . If this attribute is not included , the FAST_REROUTE object will not be included. -// FastReroute returns a RsvpFastReroute -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) FastReroute() RsvpFastReroute { - if obj.obj.FastReroute == nil { - obj.obj.FastReroute = NewRsvpFastReroute().msg() - } - if obj.fastRerouteHolder == nil { - obj.fastRerouteHolder = &rsvpFastReroute{obj: obj.obj.FastReroute} - } - return obj.fastRerouteHolder -} - -// This contains the values of the fields to be included in the FAST_REROUTE object in the Path Message sent for the LSP. -// This is an optional object . If this attribute is not included , the FAST_REROUTE object will not be included. -// FastReroute returns a RsvpFastReroute -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasFastReroute() bool { - return obj.obj.FastReroute != nil -} - -// This contains the values of the fields to be included in the FAST_REROUTE object in the Path Message sent for the LSP. -// This is an optional object . If this attribute is not included , the FAST_REROUTE object will not be included. -// SetFastReroute sets the RsvpFastReroute value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetFastReroute(value RsvpFastReroute) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - - obj.fastRerouteHolder = nil - obj.obj.FastReroute = value.msg() - - return obj -} - -// This contains the values of the fields to be included in the ERO object in the Path Message sent for the LSP. -// This is an optional object . If this attribute is not included , the ERO object will not be included. -// Ero returns a RsvpEro -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) Ero() RsvpEro { - if obj.obj.Ero == nil { - obj.obj.Ero = NewRsvpEro().msg() - } - if obj.eroHolder == nil { - obj.eroHolder = &rsvpEro{obj: obj.obj.Ero} - } - return obj.eroHolder -} - -// This contains the values of the fields to be included in the ERO object in the Path Message sent for the LSP. -// This is an optional object . If this attribute is not included , the ERO object will not be included. -// Ero returns a RsvpEro -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasEro() bool { - return obj.obj.Ero != nil -} - -// This contains the values of the fields to be included in the ERO object in the Path Message sent for the LSP. -// This is an optional object . If this attribute is not included , the ERO object will not be included. -// SetEro sets the RsvpEro value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetEro(value RsvpEro) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { - - obj.eroHolder = nil - obj.obj.Ero = value.msg() - - return obj -} - -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface RsvpLspIpv4InterfaceP2PIngressIpv4Lsp") - } - - // RemoteAddress is required - if obj.obj.RemoteAddress == nil { - vObj.validationErrors = append(vObj.validationErrors, "RemoteAddress is required field on interface RsvpLspIpv4InterfaceP2PIngressIpv4Lsp") - } - if obj.obj.RemoteAddress != nil { - - err := obj.validateIpv4(obj.RemoteAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on RsvpLspIpv4InterfaceP2PIngressIpv4Lsp.RemoteAddress")) - } - - } - - if obj.obj.TunnelId != nil { - - if *obj.obj.TunnelId < 1 || *obj.obj.TunnelId > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= RsvpLspIpv4InterfaceP2PIngressIpv4Lsp.TunnelId <= 65535 but Got %d", *obj.obj.TunnelId)) - } - - } - - if obj.obj.LspId != nil { - - if *obj.obj.LspId < 1 || *obj.obj.LspId > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= RsvpLspIpv4InterfaceP2PIngressIpv4Lsp.LspId <= 65535 but Got %d", *obj.obj.LspId)) - } - - } - - if obj.obj.RefreshInterval != nil { - - if *obj.obj.RefreshInterval < 1 || *obj.obj.RefreshInterval > 3600 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= RsvpLspIpv4InterfaceP2PIngressIpv4Lsp.RefreshInterval <= 3600 but Got %d", *obj.obj.RefreshInterval)) - } - - } - - if obj.obj.TimeoutMultiplier != nil { - - if *obj.obj.TimeoutMultiplier < 1 || *obj.obj.TimeoutMultiplier > 10 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= RsvpLspIpv4InterfaceP2PIngressIpv4Lsp.TimeoutMultiplier <= 10 but Got %d", *obj.obj.TimeoutMultiplier)) - } - - } - - if obj.obj.BackupLspId != nil { - - if *obj.obj.BackupLspId < 1 || *obj.obj.BackupLspId > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= RsvpLspIpv4InterfaceP2PIngressIpv4Lsp.BackupLspId <= 65535 but Got %d", *obj.obj.BackupLspId)) - } - - } - - if obj.obj.LspSwitchoverDelay != nil { - - if *obj.obj.LspSwitchoverDelay > 60000 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpLspIpv4InterfaceP2PIngressIpv4Lsp.LspSwitchoverDelay <= 60000 but Got %d", *obj.obj.LspSwitchoverDelay)) - } - - } - - if obj.obj.SessionAttribute != nil { - - obj.SessionAttribute().validateObj(vObj, set_default) - } - - if obj.obj.Tspec != nil { - - obj.Tspec().validateObj(vObj, set_default) - } - - if obj.obj.FastReroute != nil { - - obj.FastReroute().validateObj(vObj, set_default) - } - - if obj.obj.Ero != nil { - - obj.Ero().validateObj(vObj, set_default) - } - -} - -func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) setDefault() { - if obj.obj.TunnelId == nil { - obj.SetTunnelId(1) - } - if obj.obj.LspId == nil { - obj.SetLspId(1) - } - if obj.obj.RefreshInterval == nil { - obj.SetRefreshInterval(30) - } - if obj.obj.TimeoutMultiplier == nil { - obj.SetTimeoutMultiplier(3) - } - if obj.obj.BackupLspId == nil { - obj.SetBackupLspId(2) - } - if obj.obj.LspSwitchoverDelay == nil { - obj.SetLspSwitchoverDelay(0) - } - -} - -// ***** DhcpServerV4Pool ***** -type dhcpServerV4Pool struct { - validation - obj *otg.DhcpServerV4Pool - marshaller marshalDhcpServerV4Pool - unMarshaller unMarshalDhcpServerV4Pool - optionsHolder DhcpServerV4PoolOption -} - -func NewDhcpServerV4Pool() DhcpServerV4Pool { - obj := dhcpServerV4Pool{obj: &otg.DhcpServerV4Pool{}} - obj.setDefault() - return &obj -} - -func (obj *dhcpServerV4Pool) msg() *otg.DhcpServerV4Pool { - return obj.obj -} - -func (obj *dhcpServerV4Pool) setMsg(msg *otg.DhcpServerV4Pool) DhcpServerV4Pool { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldhcpServerV4Pool struct { - obj *dhcpServerV4Pool -} - -type marshalDhcpServerV4Pool interface { - // ToProto marshals DhcpServerV4Pool to protobuf object *otg.DhcpServerV4Pool - ToProto() (*otg.DhcpServerV4Pool, error) - // ToPbText marshals DhcpServerV4Pool to protobuf text - ToPbText() (string, error) - // ToYaml marshals DhcpServerV4Pool to YAML text - ToYaml() (string, error) - // ToJson marshals DhcpServerV4Pool to JSON text - ToJson() (string, error) -} - -type unMarshaldhcpServerV4Pool struct { - obj *dhcpServerV4Pool -} - -type unMarshalDhcpServerV4Pool interface { - // FromProto unmarshals DhcpServerV4Pool from protobuf object *otg.DhcpServerV4Pool - FromProto(msg *otg.DhcpServerV4Pool) (DhcpServerV4Pool, error) - // FromPbText unmarshals DhcpServerV4Pool from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DhcpServerV4Pool from YAML text - FromYaml(value string) error - // FromJson unmarshals DhcpServerV4Pool from JSON text - FromJson(value string) error -} - -func (obj *dhcpServerV4Pool) Marshal() marshalDhcpServerV4Pool { - if obj.marshaller == nil { - obj.marshaller = &marshaldhcpServerV4Pool{obj: obj} - } - return obj.marshaller -} - -func (obj *dhcpServerV4Pool) Unmarshal() unMarshalDhcpServerV4Pool { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldhcpServerV4Pool{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldhcpServerV4Pool) ToProto() (*otg.DhcpServerV4Pool, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldhcpServerV4Pool) FromProto(msg *otg.DhcpServerV4Pool) (DhcpServerV4Pool, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldhcpServerV4Pool) 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 *unMarshaldhcpServerV4Pool) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshaldhcpServerV4Pool) 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 *unMarshaldhcpServerV4Pool) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshaldhcpServerV4Pool) 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 *unMarshaldhcpServerV4Pool) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *dhcpServerV4Pool) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *dhcpServerV4Pool) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *dhcpServerV4Pool) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *dhcpServerV4Pool) Clone() (DhcpServerV4Pool, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDhcpServerV4Pool() - 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 -} - -func (obj *dhcpServerV4Pool) setNil() { - obj.optionsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// DhcpServerV4Pool is configuration for DHCPv4 address pool for a lease. -type DhcpServerV4Pool interface { - Validation - // msg marshals DhcpServerV4Pool to protobuf object *otg.DhcpServerV4Pool - // and doesn't set defaults - msg() *otg.DhcpServerV4Pool - // setMsg unmarshals DhcpServerV4Pool from protobuf object *otg.DhcpServerV4Pool - // and doesn't set defaults - setMsg(*otg.DhcpServerV4Pool) DhcpServerV4Pool - // provides marshal interface - Marshal() marshalDhcpServerV4Pool - // provides unmarshal interface - Unmarshal() unMarshalDhcpServerV4Pool - // validate validates DhcpServerV4Pool - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DhcpServerV4Pool, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in DhcpServerV4Pool. - Name() string - // SetName assigns string provided by user to DhcpServerV4Pool - SetName(value string) DhcpServerV4Pool - // HasName checks if Name has been set in DhcpServerV4Pool - HasName() bool - // LeaseTime returns uint32, set in DhcpServerV4Pool. - LeaseTime() uint32 - // SetLeaseTime assigns uint32 provided by user to DhcpServerV4Pool - SetLeaseTime(value uint32) DhcpServerV4Pool - // HasLeaseTime checks if LeaseTime has been set in DhcpServerV4Pool - HasLeaseTime() bool - // StartAddress returns string, set in DhcpServerV4Pool. - StartAddress() string - // SetStartAddress assigns string provided by user to DhcpServerV4Pool - SetStartAddress(value string) DhcpServerV4Pool - // PrefixLength returns uint32, set in DhcpServerV4Pool. - PrefixLength() uint32 - // SetPrefixLength assigns uint32 provided by user to DhcpServerV4Pool - SetPrefixLength(value uint32) DhcpServerV4Pool - // HasPrefixLength checks if PrefixLength has been set in DhcpServerV4Pool - HasPrefixLength() bool - // Count returns uint32, set in DhcpServerV4Pool. - Count() uint32 - // SetCount assigns uint32 provided by user to DhcpServerV4Pool - SetCount(value uint32) DhcpServerV4Pool - // HasCount checks if Count has been set in DhcpServerV4Pool - HasCount() bool - // Step returns uint32, set in DhcpServerV4Pool. - Step() uint32 - // SetStep assigns uint32 provided by user to DhcpServerV4Pool - SetStep(value uint32) DhcpServerV4Pool - // HasStep checks if Step has been set in DhcpServerV4Pool - HasStep() bool - // Options returns DhcpServerV4PoolOption, set in DhcpServerV4Pool. - // DhcpServerV4PoolOption is optional configuration for DHCPv4 address pool for the lease. - Options() DhcpServerV4PoolOption - // SetOptions assigns DhcpServerV4PoolOption provided by user to DhcpServerV4Pool. - // DhcpServerV4PoolOption is optional configuration for DHCPv4 address pool for the lease. - SetOptions(value DhcpServerV4PoolOption) DhcpServerV4Pool - // HasOptions checks if Options has been set in DhcpServerV4Pool - HasOptions() bool - setNil() -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *dhcpServerV4Pool) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *dhcpServerV4Pool) HasName() bool { - return obj.obj.Name != nil -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the DhcpServerV4Pool object -func (obj *dhcpServerV4Pool) SetName(value string) DhcpServerV4Pool { - - obj.obj.Name = &value - return obj -} - -// The duration of time in seconds that is assigned to a lease. -// LeaseTime returns a uint32 -func (obj *dhcpServerV4Pool) LeaseTime() uint32 { - - return *obj.obj.LeaseTime - -} - -// The duration of time in seconds that is assigned to a lease. -// LeaseTime returns a uint32 -func (obj *dhcpServerV4Pool) HasLeaseTime() bool { - return obj.obj.LeaseTime != nil -} - -// The duration of time in seconds that is assigned to a lease. -// SetLeaseTime sets the uint32 value in the DhcpServerV4Pool object -func (obj *dhcpServerV4Pool) SetLeaseTime(value uint32) DhcpServerV4Pool { - - obj.obj.LeaseTime = &value - return obj -} - -// The IPv4 address of the first lease pool. -// StartAddress returns a string -func (obj *dhcpServerV4Pool) StartAddress() string { - - return *obj.obj.StartAddress - -} - -// The IPv4 address of the first lease pool. -// SetStartAddress sets the string value in the DhcpServerV4Pool object -func (obj *dhcpServerV4Pool) SetStartAddress(value string) DhcpServerV4Pool { - - obj.obj.StartAddress = &value - return obj -} - -// The IPv4 network prefix length to be applied to the address. -// PrefixLength returns a uint32 -func (obj *dhcpServerV4Pool) PrefixLength() uint32 { - - return *obj.obj.PrefixLength - -} - -// The IPv4 network prefix length to be applied to the address. -// PrefixLength returns a uint32 -func (obj *dhcpServerV4Pool) HasPrefixLength() bool { - return obj.obj.PrefixLength != nil -} - -// The IPv4 network prefix length to be applied to the address. -// SetPrefixLength sets the uint32 value in the DhcpServerV4Pool object -func (obj *dhcpServerV4Pool) SetPrefixLength(value uint32) DhcpServerV4Pool { - - obj.obj.PrefixLength = &value - return obj -} - -// The total number of addresses in the pool. -// Count returns a uint32 -func (obj *dhcpServerV4Pool) Count() uint32 { - - return *obj.obj.Count - -} - -// The total number of addresses in the pool. -// Count returns a uint32 -func (obj *dhcpServerV4Pool) HasCount() bool { - return obj.obj.Count != nil -} - -// The total number of addresses in the pool. -// SetCount sets the uint32 value in the DhcpServerV4Pool object -func (obj *dhcpServerV4Pool) SetCount(value uint32) DhcpServerV4Pool { - - obj.obj.Count = &value - return obj -} - -// The increment value for the lease address within the lease pool. The value is incremented according to the prefix_length and step. -// Step returns a uint32 -func (obj *dhcpServerV4Pool) Step() uint32 { - - return *obj.obj.Step - -} - -// The increment value for the lease address within the lease pool. The value is incremented according to the prefix_length and step. -// Step returns a uint32 -func (obj *dhcpServerV4Pool) HasStep() bool { - return obj.obj.Step != nil -} - -// The increment value for the lease address within the lease pool. The value is incremented according to the prefix_length and step. -// SetStep sets the uint32 value in the DhcpServerV4Pool object -func (obj *dhcpServerV4Pool) SetStep(value uint32) DhcpServerV4Pool { - - obj.obj.Step = &value - return obj -} - -// Optional configuration for DHCPv4 address pool for the lease. -// Options returns a DhcpServerV4PoolOption -func (obj *dhcpServerV4Pool) Options() DhcpServerV4PoolOption { - if obj.obj.Options == nil { - obj.obj.Options = NewDhcpServerV4PoolOption().msg() - } - if obj.optionsHolder == nil { - obj.optionsHolder = &dhcpServerV4PoolOption{obj: obj.obj.Options} - } - return obj.optionsHolder -} - -// Optional configuration for DHCPv4 address pool for the lease. -// Options returns a DhcpServerV4PoolOption -func (obj *dhcpServerV4Pool) HasOptions() bool { - return obj.obj.Options != nil -} - -// Optional configuration for DHCPv4 address pool for the lease. -// SetOptions sets the DhcpServerV4PoolOption value in the DhcpServerV4Pool object -func (obj *dhcpServerV4Pool) SetOptions(value DhcpServerV4PoolOption) DhcpServerV4Pool { - - obj.optionsHolder = nil - obj.obj.Options = value.msg() - - return obj -} - -func (obj *dhcpServerV4Pool) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.LeaseTime != nil { - - if *obj.obj.LeaseTime < 10 || *obj.obj.LeaseTime > 4294967295 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("10 <= DhcpServerV4Pool.LeaseTime <= 4294967295 but Got %d", *obj.obj.LeaseTime)) - } - - } - - // StartAddress is required - if obj.obj.StartAddress == nil { - vObj.validationErrors = append(vObj.validationErrors, "StartAddress is required field on interface DhcpServerV4Pool") - } - if obj.obj.StartAddress != nil { - - err := obj.validateIpv4(obj.StartAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DhcpServerV4Pool.StartAddress")) - } - - } - - if obj.obj.PrefixLength != nil { - - if *obj.obj.PrefixLength > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= DhcpServerV4Pool.PrefixLength <= 32 but Got %d", *obj.obj.PrefixLength)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count < 1 || *obj.obj.Count > 4294967295 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= DhcpServerV4Pool.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 <= DhcpServerV4Pool.Step <= 4294967295 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Options != nil { - - obj.Options().validateObj(vObj, set_default) - } - -} - -func (obj *dhcpServerV4Pool) setDefault() { - if obj.obj.LeaseTime == nil { - obj.SetLeaseTime(86400) - } - if obj.obj.PrefixLength == nil { - obj.SetPrefixLength(24) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - -} - -// ***** FlowCustomMetricTag ***** -type flowCustomMetricTag struct { - validation - obj *otg.FlowCustomMetricTag - marshaller marshalFlowCustomMetricTag - unMarshaller unMarshalFlowCustomMetricTag -} - -func NewFlowCustomMetricTag() FlowCustomMetricTag { - obj := flowCustomMetricTag{obj: &otg.FlowCustomMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *flowCustomMetricTag) msg() *otg.FlowCustomMetricTag { - return obj.obj -} - -func (obj *flowCustomMetricTag) setMsg(msg *otg.FlowCustomMetricTag) FlowCustomMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowCustomMetricTag struct { - obj *flowCustomMetricTag -} - -type marshalFlowCustomMetricTag interface { - // ToProto marshals FlowCustomMetricTag to protobuf object *otg.FlowCustomMetricTag - ToProto() (*otg.FlowCustomMetricTag, error) - // ToPbText marshals FlowCustomMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowCustomMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals FlowCustomMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalflowCustomMetricTag struct { - obj *flowCustomMetricTag -} - -type unMarshalFlowCustomMetricTag interface { - // FromProto unmarshals FlowCustomMetricTag from protobuf object *otg.FlowCustomMetricTag - FromProto(msg *otg.FlowCustomMetricTag) (FlowCustomMetricTag, error) - // FromPbText unmarshals FlowCustomMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowCustomMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowCustomMetricTag from JSON text - FromJson(value string) error -} - -func (obj *flowCustomMetricTag) Marshal() marshalFlowCustomMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalflowCustomMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *flowCustomMetricTag) Unmarshal() unMarshalFlowCustomMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowCustomMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowCustomMetricTag) ToProto() (*otg.FlowCustomMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowCustomMetricTag) FromProto(msg *otg.FlowCustomMetricTag) (FlowCustomMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowCustomMetricTag) 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 *unMarshalflowCustomMetricTag) 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 *marshalflowCustomMetricTag) 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 *unMarshalflowCustomMetricTag) 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 *marshalflowCustomMetricTag) 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 *unMarshalflowCustomMetricTag) 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 *flowCustomMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowCustomMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowCustomMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowCustomMetricTag) Clone() (FlowCustomMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowCustomMetricTag() - 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 -} - -// FlowCustomMetricTag is metric Tag can be used to enable tracking portion of or all bits -// in a corresponding header field for metrics per each applicable value. -// These would appear as tagged metrics in corresponding flow metrics. -type FlowCustomMetricTag interface { - Validation - // msg marshals FlowCustomMetricTag to protobuf object *otg.FlowCustomMetricTag - // and doesn't set defaults - msg() *otg.FlowCustomMetricTag - // setMsg unmarshals FlowCustomMetricTag from protobuf object *otg.FlowCustomMetricTag - // and doesn't set defaults - setMsg(*otg.FlowCustomMetricTag) FlowCustomMetricTag - // provides marshal interface - Marshal() marshalFlowCustomMetricTag - // provides unmarshal interface - Unmarshal() unMarshalFlowCustomMetricTag - // validate validates FlowCustomMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowCustomMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in FlowCustomMetricTag. - Name() string - // SetName assigns string provided by user to FlowCustomMetricTag - SetName(value string) FlowCustomMetricTag - // Offset returns uint32, set in FlowCustomMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to FlowCustomMetricTag - SetOffset(value uint32) FlowCustomMetricTag - // HasOffset checks if Offset has been set in FlowCustomMetricTag - HasOffset() bool - // Length returns uint32, set in FlowCustomMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to FlowCustomMetricTag - SetLength(value uint32) FlowCustomMetricTag - // HasLength checks if Length has been set in FlowCustomMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable -// for configured offset and length inside corresponding header field -// Name returns a string -func (obj *flowCustomMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable -// for configured offset and length inside corresponding header field -// SetName sets the string value in the FlowCustomMetricTag object -func (obj *flowCustomMetricTag) SetName(value string) FlowCustomMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *flowCustomMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *flowCustomMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the FlowCustomMetricTag object -func (obj *flowCustomMetricTag) SetOffset(value uint32) FlowCustomMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset -// of corresponding header field -// Length returns a uint32 -func (obj *flowCustomMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset -// of corresponding header field -// Length returns a uint32 -func (obj *flowCustomMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset -// of corresponding header field -// SetLength sets the uint32 value in the FlowCustomMetricTag object -func (obj *flowCustomMetricTag) SetLength(value uint32) FlowCustomMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *flowCustomMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface FlowCustomMetricTag") - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 4294967295 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= FlowCustomMetricTag.Length <= 4294967295 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *flowCustomMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowEthernetDst ***** -type patternFlowEthernetDst struct { - validation - obj *otg.PatternFlowEthernetDst - marshaller marshalPatternFlowEthernetDst - unMarshaller unMarshalPatternFlowEthernetDst - incrementHolder PatternFlowEthernetDstCounter - decrementHolder PatternFlowEthernetDstCounter - metricTagsHolder PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter -} - -func NewPatternFlowEthernetDst() PatternFlowEthernetDst { - obj := patternFlowEthernetDst{obj: &otg.PatternFlowEthernetDst{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetDst) msg() *otg.PatternFlowEthernetDst { - return obj.obj -} - -func (obj *patternFlowEthernetDst) setMsg(msg *otg.PatternFlowEthernetDst) PatternFlowEthernetDst { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetDst struct { - obj *patternFlowEthernetDst -} - -type marshalPatternFlowEthernetDst interface { - // ToProto marshals PatternFlowEthernetDst to protobuf object *otg.PatternFlowEthernetDst - ToProto() (*otg.PatternFlowEthernetDst, error) - // ToPbText marshals PatternFlowEthernetDst to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetDst to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetDst to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetDst struct { - obj *patternFlowEthernetDst -} - -type unMarshalPatternFlowEthernetDst interface { - // FromProto unmarshals PatternFlowEthernetDst from protobuf object *otg.PatternFlowEthernetDst - FromProto(msg *otg.PatternFlowEthernetDst) (PatternFlowEthernetDst, error) - // FromPbText unmarshals PatternFlowEthernetDst from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetDst from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetDst from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetDst) Marshal() marshalPatternFlowEthernetDst { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetDst{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetDst) Unmarshal() unMarshalPatternFlowEthernetDst { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetDst{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetDst) ToProto() (*otg.PatternFlowEthernetDst, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetDst) FromProto(msg *otg.PatternFlowEthernetDst) (PatternFlowEthernetDst, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetDst) 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 *unMarshalpatternFlowEthernetDst) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowEthernetDst) 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 *unMarshalpatternFlowEthernetDst) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowEthernetDst) 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 *unMarshalpatternFlowEthernetDst) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowEthernetDst) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetDst) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetDst) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetDst) Clone() (PatternFlowEthernetDst, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetDst() - 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 -} - -func (obj *patternFlowEthernetDst) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowEthernetDst is destination MAC address -type PatternFlowEthernetDst interface { - Validation - // msg marshals PatternFlowEthernetDst to protobuf object *otg.PatternFlowEthernetDst - // and doesn't set defaults - msg() *otg.PatternFlowEthernetDst - // setMsg unmarshals PatternFlowEthernetDst from protobuf object *otg.PatternFlowEthernetDst - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetDst) PatternFlowEthernetDst - // provides marshal interface - Marshal() marshalPatternFlowEthernetDst - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetDst - // validate validates PatternFlowEthernetDst - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetDst, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowEthernetDstChoiceEnum, set in PatternFlowEthernetDst - Choice() PatternFlowEthernetDstChoiceEnum - // setChoice assigns PatternFlowEthernetDstChoiceEnum provided by user to PatternFlowEthernetDst - setChoice(value PatternFlowEthernetDstChoiceEnum) PatternFlowEthernetDst - // HasChoice checks if Choice has been set in PatternFlowEthernetDst - HasChoice() bool - // Value returns string, set in PatternFlowEthernetDst. - Value() string - // SetValue assigns string provided by user to PatternFlowEthernetDst - SetValue(value string) PatternFlowEthernetDst - // HasValue checks if Value has been set in PatternFlowEthernetDst - HasValue() bool - // Values returns []string, set in PatternFlowEthernetDst. - Values() []string - // SetValues assigns []string provided by user to PatternFlowEthernetDst - SetValues(value []string) PatternFlowEthernetDst - // Auto returns string, set in PatternFlowEthernetDst. - Auto() string - // HasAuto checks if Auto has been set in PatternFlowEthernetDst - HasAuto() bool - // Increment returns PatternFlowEthernetDstCounter, set in PatternFlowEthernetDst. - // PatternFlowEthernetDstCounter is mac counter pattern - Increment() PatternFlowEthernetDstCounter - // SetIncrement assigns PatternFlowEthernetDstCounter provided by user to PatternFlowEthernetDst. - // PatternFlowEthernetDstCounter is mac counter pattern - SetIncrement(value PatternFlowEthernetDstCounter) PatternFlowEthernetDst - // HasIncrement checks if Increment has been set in PatternFlowEthernetDst - HasIncrement() bool - // Decrement returns PatternFlowEthernetDstCounter, set in PatternFlowEthernetDst. - // PatternFlowEthernetDstCounter is mac counter pattern - Decrement() PatternFlowEthernetDstCounter - // SetDecrement assigns PatternFlowEthernetDstCounter provided by user to PatternFlowEthernetDst. - // PatternFlowEthernetDstCounter is mac counter pattern - SetDecrement(value PatternFlowEthernetDstCounter) PatternFlowEthernetDst - // HasDecrement checks if Decrement has been set in PatternFlowEthernetDst - HasDecrement() bool - // MetricTags returns PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIterIter, set in PatternFlowEthernetDst - MetricTags() PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter - setNil() -} - -type PatternFlowEthernetDstChoiceEnum string - -// Enum of Choice on PatternFlowEthernetDst -var PatternFlowEthernetDstChoice = struct { - VALUE PatternFlowEthernetDstChoiceEnum - VALUES PatternFlowEthernetDstChoiceEnum - AUTO PatternFlowEthernetDstChoiceEnum - INCREMENT PatternFlowEthernetDstChoiceEnum - DECREMENT PatternFlowEthernetDstChoiceEnum -}{ - VALUE: PatternFlowEthernetDstChoiceEnum("value"), - VALUES: PatternFlowEthernetDstChoiceEnum("values"), - AUTO: PatternFlowEthernetDstChoiceEnum("auto"), - INCREMENT: PatternFlowEthernetDstChoiceEnum("increment"), - DECREMENT: PatternFlowEthernetDstChoiceEnum("decrement"), -} - -func (obj *patternFlowEthernetDst) Choice() PatternFlowEthernetDstChoiceEnum { - return PatternFlowEthernetDstChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowEthernetDst) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowEthernetDst) setChoice(value PatternFlowEthernetDstChoiceEnum) PatternFlowEthernetDst { - intValue, ok := otg.PatternFlowEthernetDst_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowEthernetDstChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowEthernetDst_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Auto = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowEthernetDstChoice.VALUE { - defaultValue := "00:00:00:00:00:00" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowEthernetDstChoice.VALUES { - defaultValue := []string{"00:00:00:00:00:00"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowEthernetDstChoice.AUTO { - defaultValue := "00:00:00:00:00:00" - obj.obj.Auto = &defaultValue - } - - if value == PatternFlowEthernetDstChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowEthernetDstCounter().msg() - } - - if value == PatternFlowEthernetDstChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowEthernetDstCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowEthernetDst) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowEthernetDstChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowEthernetDst) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowEthernetDst object -func (obj *patternFlowEthernetDst) SetValue(value string) PatternFlowEthernetDst { - obj.setChoice(PatternFlowEthernetDstChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowEthernetDst) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"00:00:00:00:00:00"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowEthernetDst object -func (obj *patternFlowEthernetDst) SetValues(value []string) PatternFlowEthernetDst { - obj.setChoice(PatternFlowEthernetDstChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a string -func (obj *patternFlowEthernetDst) Auto() string { - - if obj.obj.Auto == nil { - obj.setChoice(PatternFlowEthernetDstChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a string -func (obj *patternFlowEthernetDst) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Increment returns a PatternFlowEthernetDstCounter -func (obj *patternFlowEthernetDst) Increment() PatternFlowEthernetDstCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowEthernetDstChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowEthernetDstCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowEthernetDstCounter -func (obj *patternFlowEthernetDst) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowEthernetDstCounter value in the PatternFlowEthernetDst object -func (obj *patternFlowEthernetDst) SetIncrement(value PatternFlowEthernetDstCounter) PatternFlowEthernetDst { - obj.setChoice(PatternFlowEthernetDstChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowEthernetDstCounter -func (obj *patternFlowEthernetDst) Decrement() PatternFlowEthernetDstCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowEthernetDstChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowEthernetDstCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowEthernetDstCounter -func (obj *patternFlowEthernetDst) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowEthernetDstCounter value in the PatternFlowEthernetDst object -func (obj *patternFlowEthernetDst) SetDecrement(value PatternFlowEthernetDstCounter) PatternFlowEthernetDst { - obj.setChoice(PatternFlowEthernetDstChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowEthernetDstMetricTag -func (obj *patternFlowEthernetDst) MetricTags() PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowEthernetDstMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter struct { - obj *patternFlowEthernetDst - patternFlowEthernetDstMetricTagSlice []PatternFlowEthernetDstMetricTag - fieldPtr *[]*otg.PatternFlowEthernetDstMetricTag -} - -func newPatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter(ptr *[]*otg.PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { - return &patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter interface { - setMsg(*patternFlowEthernetDst) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter - Items() []PatternFlowEthernetDstMetricTag - Add() PatternFlowEthernetDstMetricTag - Append(items ...PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter - Set(index int, newObj PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter - Clear() PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter - clearHolderSlice() PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter - appendHolderSlice(item PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter -} - -func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) setMsg(msg *patternFlowEthernetDst) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowEthernetDstMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) Items() []PatternFlowEthernetDstMetricTag { - return obj.patternFlowEthernetDstMetricTagSlice -} - -func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) Add() PatternFlowEthernetDstMetricTag { - newObj := &otg.PatternFlowEthernetDstMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowEthernetDstMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowEthernetDstMetricTagSlice = append(obj.patternFlowEthernetDstMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) Append(items ...PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowEthernetDstMetricTagSlice = append(obj.patternFlowEthernetDstMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) Set(index int, newObj PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowEthernetDstMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) Clear() PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowEthernetDstMetricTag{} - obj.patternFlowEthernetDstMetricTagSlice = []PatternFlowEthernetDstMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) clearHolderSlice() PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { - if len(obj.patternFlowEthernetDstMetricTagSlice) > 0 { - obj.patternFlowEthernetDstMetricTagSlice = []PatternFlowEthernetDstMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) appendHolderSlice(item PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { - obj.patternFlowEthernetDstMetricTagSlice = append(obj.patternFlowEthernetDstMetricTagSlice, item) - return obj -} - -func (obj *patternFlowEthernetDst) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateMac(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetDst.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateMacSlice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetDst.Values")) - } - - } - - if obj.obj.Auto != nil { - - err := obj.validateMac(obj.Auto()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetDst.Auto")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowEthernetDstMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowEthernetDst) setDefault() { - var choices_set int = 0 - var choice PatternFlowEthernetDstChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowEthernetDstChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowEthernetDstChoice.VALUES - } - - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowEthernetDstChoice.AUTO - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowEthernetDstChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowEthernetDstChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowEthernetDstChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetDst") - } - } else { - intVal := otg.PatternFlowEthernetDst_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowEthernetDst_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowEthernetSrc ***** -type patternFlowEthernetSrc struct { - validation - obj *otg.PatternFlowEthernetSrc - marshaller marshalPatternFlowEthernetSrc - unMarshaller unMarshalPatternFlowEthernetSrc - incrementHolder PatternFlowEthernetSrcCounter - decrementHolder PatternFlowEthernetSrcCounter - metricTagsHolder PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter -} - -func NewPatternFlowEthernetSrc() PatternFlowEthernetSrc { - obj := patternFlowEthernetSrc{obj: &otg.PatternFlowEthernetSrc{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetSrc) msg() *otg.PatternFlowEthernetSrc { - return obj.obj -} - -func (obj *patternFlowEthernetSrc) setMsg(msg *otg.PatternFlowEthernetSrc) PatternFlowEthernetSrc { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetSrc struct { - obj *patternFlowEthernetSrc -} - -type marshalPatternFlowEthernetSrc interface { - // ToProto marshals PatternFlowEthernetSrc to protobuf object *otg.PatternFlowEthernetSrc - ToProto() (*otg.PatternFlowEthernetSrc, error) - // ToPbText marshals PatternFlowEthernetSrc to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetSrc to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetSrc to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetSrc struct { - obj *patternFlowEthernetSrc -} - -type unMarshalPatternFlowEthernetSrc interface { - // FromProto unmarshals PatternFlowEthernetSrc from protobuf object *otg.PatternFlowEthernetSrc - FromProto(msg *otg.PatternFlowEthernetSrc) (PatternFlowEthernetSrc, error) - // FromPbText unmarshals PatternFlowEthernetSrc from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetSrc from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetSrc from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetSrc) Marshal() marshalPatternFlowEthernetSrc { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetSrc{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetSrc) Unmarshal() unMarshalPatternFlowEthernetSrc { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetSrc{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetSrc) ToProto() (*otg.PatternFlowEthernetSrc, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetSrc) FromProto(msg *otg.PatternFlowEthernetSrc) (PatternFlowEthernetSrc, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetSrc) 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 *unMarshalpatternFlowEthernetSrc) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowEthernetSrc) 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 *unMarshalpatternFlowEthernetSrc) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowEthernetSrc) 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 *unMarshalpatternFlowEthernetSrc) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowEthernetSrc) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetSrc) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetSrc) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetSrc) Clone() (PatternFlowEthernetSrc, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetSrc() - 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 -} - -func (obj *patternFlowEthernetSrc) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowEthernetSrc is source MAC address -type PatternFlowEthernetSrc interface { - Validation - // msg marshals PatternFlowEthernetSrc to protobuf object *otg.PatternFlowEthernetSrc - // and doesn't set defaults - msg() *otg.PatternFlowEthernetSrc - // setMsg unmarshals PatternFlowEthernetSrc from protobuf object *otg.PatternFlowEthernetSrc - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetSrc) PatternFlowEthernetSrc - // provides marshal interface - Marshal() marshalPatternFlowEthernetSrc - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetSrc - // validate validates PatternFlowEthernetSrc - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetSrc, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowEthernetSrcChoiceEnum, set in PatternFlowEthernetSrc - Choice() PatternFlowEthernetSrcChoiceEnum - // setChoice assigns PatternFlowEthernetSrcChoiceEnum provided by user to PatternFlowEthernetSrc - setChoice(value PatternFlowEthernetSrcChoiceEnum) PatternFlowEthernetSrc - // HasChoice checks if Choice has been set in PatternFlowEthernetSrc - HasChoice() bool - // Value returns string, set in PatternFlowEthernetSrc. - Value() string - // SetValue assigns string provided by user to PatternFlowEthernetSrc - SetValue(value string) PatternFlowEthernetSrc - // HasValue checks if Value has been set in PatternFlowEthernetSrc - HasValue() bool - // Values returns []string, set in PatternFlowEthernetSrc. - Values() []string - // SetValues assigns []string provided by user to PatternFlowEthernetSrc - SetValues(value []string) PatternFlowEthernetSrc - // Increment returns PatternFlowEthernetSrcCounter, set in PatternFlowEthernetSrc. - // PatternFlowEthernetSrcCounter is mac counter pattern - Increment() PatternFlowEthernetSrcCounter - // SetIncrement assigns PatternFlowEthernetSrcCounter provided by user to PatternFlowEthernetSrc. - // PatternFlowEthernetSrcCounter is mac counter pattern - SetIncrement(value PatternFlowEthernetSrcCounter) PatternFlowEthernetSrc - // HasIncrement checks if Increment has been set in PatternFlowEthernetSrc - HasIncrement() bool - // Decrement returns PatternFlowEthernetSrcCounter, set in PatternFlowEthernetSrc. - // PatternFlowEthernetSrcCounter is mac counter pattern - Decrement() PatternFlowEthernetSrcCounter - // SetDecrement assigns PatternFlowEthernetSrcCounter provided by user to PatternFlowEthernetSrc. - // PatternFlowEthernetSrcCounter is mac counter pattern - SetDecrement(value PatternFlowEthernetSrcCounter) PatternFlowEthernetSrc - // HasDecrement checks if Decrement has been set in PatternFlowEthernetSrc - HasDecrement() bool - // MetricTags returns PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIterIter, set in PatternFlowEthernetSrc - MetricTags() PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter - setNil() -} - -type PatternFlowEthernetSrcChoiceEnum string - -// Enum of Choice on PatternFlowEthernetSrc -var PatternFlowEthernetSrcChoice = struct { - VALUE PatternFlowEthernetSrcChoiceEnum - VALUES PatternFlowEthernetSrcChoiceEnum - INCREMENT PatternFlowEthernetSrcChoiceEnum - DECREMENT PatternFlowEthernetSrcChoiceEnum -}{ - VALUE: PatternFlowEthernetSrcChoiceEnum("value"), - VALUES: PatternFlowEthernetSrcChoiceEnum("values"), - INCREMENT: PatternFlowEthernetSrcChoiceEnum("increment"), - DECREMENT: PatternFlowEthernetSrcChoiceEnum("decrement"), -} - -func (obj *patternFlowEthernetSrc) Choice() PatternFlowEthernetSrcChoiceEnum { - return PatternFlowEthernetSrcChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowEthernetSrc) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowEthernetSrc) setChoice(value PatternFlowEthernetSrcChoiceEnum) PatternFlowEthernetSrc { - intValue, ok := otg.PatternFlowEthernetSrc_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowEthernetSrcChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowEthernetSrc_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowEthernetSrcChoice.VALUE { - defaultValue := "00:00:00:00:00:00" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowEthernetSrcChoice.VALUES { - defaultValue := []string{"00:00:00:00:00:00"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowEthernetSrcChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowEthernetSrcCounter().msg() - } - - if value == PatternFlowEthernetSrcChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowEthernetSrcCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowEthernetSrc) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowEthernetSrcChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowEthernetSrc) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowEthernetSrc object -func (obj *patternFlowEthernetSrc) SetValue(value string) PatternFlowEthernetSrc { - obj.setChoice(PatternFlowEthernetSrcChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowEthernetSrc) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"00:00:00:00:00:00"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowEthernetSrc object -func (obj *patternFlowEthernetSrc) SetValues(value []string) PatternFlowEthernetSrc { - obj.setChoice(PatternFlowEthernetSrcChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowEthernetSrcCounter -func (obj *patternFlowEthernetSrc) Increment() PatternFlowEthernetSrcCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowEthernetSrcChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowEthernetSrcCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowEthernetSrcCounter -func (obj *patternFlowEthernetSrc) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowEthernetSrcCounter value in the PatternFlowEthernetSrc object -func (obj *patternFlowEthernetSrc) SetIncrement(value PatternFlowEthernetSrcCounter) PatternFlowEthernetSrc { - obj.setChoice(PatternFlowEthernetSrcChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowEthernetSrcCounter -func (obj *patternFlowEthernetSrc) Decrement() PatternFlowEthernetSrcCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowEthernetSrcChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowEthernetSrcCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowEthernetSrcCounter -func (obj *patternFlowEthernetSrc) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowEthernetSrcCounter value in the PatternFlowEthernetSrc object -func (obj *patternFlowEthernetSrc) SetDecrement(value PatternFlowEthernetSrcCounter) PatternFlowEthernetSrc { - obj.setChoice(PatternFlowEthernetSrcChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowEthernetSrcMetricTag -func (obj *patternFlowEthernetSrc) MetricTags() PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowEthernetSrcMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter struct { - obj *patternFlowEthernetSrc - patternFlowEthernetSrcMetricTagSlice []PatternFlowEthernetSrcMetricTag - fieldPtr *[]*otg.PatternFlowEthernetSrcMetricTag -} - -func newPatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter(ptr *[]*otg.PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { - return &patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter interface { - setMsg(*patternFlowEthernetSrc) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter - Items() []PatternFlowEthernetSrcMetricTag - Add() PatternFlowEthernetSrcMetricTag - Append(items ...PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter - Set(index int, newObj PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter - Clear() PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter - clearHolderSlice() PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter - appendHolderSlice(item PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter -} - -func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) setMsg(msg *patternFlowEthernetSrc) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowEthernetSrcMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) Items() []PatternFlowEthernetSrcMetricTag { - return obj.patternFlowEthernetSrcMetricTagSlice -} - -func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) Add() PatternFlowEthernetSrcMetricTag { - newObj := &otg.PatternFlowEthernetSrcMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowEthernetSrcMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowEthernetSrcMetricTagSlice = append(obj.patternFlowEthernetSrcMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) Append(items ...PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowEthernetSrcMetricTagSlice = append(obj.patternFlowEthernetSrcMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) Set(index int, newObj PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowEthernetSrcMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) Clear() PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowEthernetSrcMetricTag{} - obj.patternFlowEthernetSrcMetricTagSlice = []PatternFlowEthernetSrcMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) clearHolderSlice() PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { - if len(obj.patternFlowEthernetSrcMetricTagSlice) > 0 { - obj.patternFlowEthernetSrcMetricTagSlice = []PatternFlowEthernetSrcMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) appendHolderSlice(item PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { - obj.patternFlowEthernetSrcMetricTagSlice = append(obj.patternFlowEthernetSrcMetricTagSlice, item) - return obj -} - -func (obj *patternFlowEthernetSrc) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateMac(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetSrc.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateMacSlice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetSrc.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowEthernetSrcMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowEthernetSrc) setDefault() { - var choices_set int = 0 - var choice PatternFlowEthernetSrcChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowEthernetSrcChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowEthernetSrcChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowEthernetSrcChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowEthernetSrcChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowEthernetSrcChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetSrc") - } - } else { - intVal := otg.PatternFlowEthernetSrc_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowEthernetSrc_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowEthernetEtherType ***** -type patternFlowEthernetEtherType struct { - validation - obj *otg.PatternFlowEthernetEtherType - marshaller marshalPatternFlowEthernetEtherType - unMarshaller unMarshalPatternFlowEthernetEtherType - incrementHolder PatternFlowEthernetEtherTypeCounter - decrementHolder PatternFlowEthernetEtherTypeCounter - metricTagsHolder PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter -} - -func NewPatternFlowEthernetEtherType() PatternFlowEthernetEtherType { - obj := patternFlowEthernetEtherType{obj: &otg.PatternFlowEthernetEtherType{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetEtherType) msg() *otg.PatternFlowEthernetEtherType { - return obj.obj -} - -func (obj *patternFlowEthernetEtherType) setMsg(msg *otg.PatternFlowEthernetEtherType) PatternFlowEthernetEtherType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetEtherType struct { - obj *patternFlowEthernetEtherType -} - -type marshalPatternFlowEthernetEtherType interface { - // ToProto marshals PatternFlowEthernetEtherType to protobuf object *otg.PatternFlowEthernetEtherType - ToProto() (*otg.PatternFlowEthernetEtherType, error) - // ToPbText marshals PatternFlowEthernetEtherType to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetEtherType to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetEtherType to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetEtherType struct { - obj *patternFlowEthernetEtherType -} - -type unMarshalPatternFlowEthernetEtherType interface { - // FromProto unmarshals PatternFlowEthernetEtherType from protobuf object *otg.PatternFlowEthernetEtherType - FromProto(msg *otg.PatternFlowEthernetEtherType) (PatternFlowEthernetEtherType, error) - // FromPbText unmarshals PatternFlowEthernetEtherType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetEtherType from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetEtherType from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetEtherType) Marshal() marshalPatternFlowEthernetEtherType { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetEtherType{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetEtherType) Unmarshal() unMarshalPatternFlowEthernetEtherType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetEtherType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetEtherType) ToProto() (*otg.PatternFlowEthernetEtherType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetEtherType) FromProto(msg *otg.PatternFlowEthernetEtherType) (PatternFlowEthernetEtherType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetEtherType) 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 *unMarshalpatternFlowEthernetEtherType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowEthernetEtherType) 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 *unMarshalpatternFlowEthernetEtherType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowEthernetEtherType) 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 *unMarshalpatternFlowEthernetEtherType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowEthernetEtherType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetEtherType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetEtherType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetEtherType) Clone() (PatternFlowEthernetEtherType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetEtherType() - 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 -} - -func (obj *patternFlowEthernetEtherType) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowEthernetEtherType is ethernet type -type PatternFlowEthernetEtherType interface { - Validation - // msg marshals PatternFlowEthernetEtherType to protobuf object *otg.PatternFlowEthernetEtherType - // and doesn't set defaults - msg() *otg.PatternFlowEthernetEtherType - // setMsg unmarshals PatternFlowEthernetEtherType from protobuf object *otg.PatternFlowEthernetEtherType - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetEtherType) PatternFlowEthernetEtherType - // provides marshal interface - Marshal() marshalPatternFlowEthernetEtherType - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetEtherType - // validate validates PatternFlowEthernetEtherType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetEtherType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowEthernetEtherTypeChoiceEnum, set in PatternFlowEthernetEtherType - Choice() PatternFlowEthernetEtherTypeChoiceEnum - // setChoice assigns PatternFlowEthernetEtherTypeChoiceEnum provided by user to PatternFlowEthernetEtherType - setChoice(value PatternFlowEthernetEtherTypeChoiceEnum) PatternFlowEthernetEtherType - // HasChoice checks if Choice has been set in PatternFlowEthernetEtherType - HasChoice() bool - // Value returns uint32, set in PatternFlowEthernetEtherType. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowEthernetEtherType - SetValue(value uint32) PatternFlowEthernetEtherType - // HasValue checks if Value has been set in PatternFlowEthernetEtherType - HasValue() bool - // Values returns []uint32, set in PatternFlowEthernetEtherType. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowEthernetEtherType - SetValues(value []uint32) PatternFlowEthernetEtherType - // Auto returns uint32, set in PatternFlowEthernetEtherType. - Auto() uint32 - // HasAuto checks if Auto has been set in PatternFlowEthernetEtherType - HasAuto() bool - // Increment returns PatternFlowEthernetEtherTypeCounter, set in PatternFlowEthernetEtherType. - // PatternFlowEthernetEtherTypeCounter is integer counter pattern - Increment() PatternFlowEthernetEtherTypeCounter - // SetIncrement assigns PatternFlowEthernetEtherTypeCounter provided by user to PatternFlowEthernetEtherType. - // PatternFlowEthernetEtherTypeCounter is integer counter pattern - SetIncrement(value PatternFlowEthernetEtherTypeCounter) PatternFlowEthernetEtherType - // HasIncrement checks if Increment has been set in PatternFlowEthernetEtherType - HasIncrement() bool - // Decrement returns PatternFlowEthernetEtherTypeCounter, set in PatternFlowEthernetEtherType. - // PatternFlowEthernetEtherTypeCounter is integer counter pattern - Decrement() PatternFlowEthernetEtherTypeCounter - // SetDecrement assigns PatternFlowEthernetEtherTypeCounter provided by user to PatternFlowEthernetEtherType. - // PatternFlowEthernetEtherTypeCounter is integer counter pattern - SetDecrement(value PatternFlowEthernetEtherTypeCounter) PatternFlowEthernetEtherType - // HasDecrement checks if Decrement has been set in PatternFlowEthernetEtherType - HasDecrement() bool - // MetricTags returns PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIterIter, set in PatternFlowEthernetEtherType - MetricTags() PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter - setNil() -} - -type PatternFlowEthernetEtherTypeChoiceEnum string - -// Enum of Choice on PatternFlowEthernetEtherType -var PatternFlowEthernetEtherTypeChoice = struct { - VALUE PatternFlowEthernetEtherTypeChoiceEnum - VALUES PatternFlowEthernetEtherTypeChoiceEnum - AUTO PatternFlowEthernetEtherTypeChoiceEnum - INCREMENT PatternFlowEthernetEtherTypeChoiceEnum - DECREMENT PatternFlowEthernetEtherTypeChoiceEnum -}{ - VALUE: PatternFlowEthernetEtherTypeChoiceEnum("value"), - VALUES: PatternFlowEthernetEtherTypeChoiceEnum("values"), - AUTO: PatternFlowEthernetEtherTypeChoiceEnum("auto"), - INCREMENT: PatternFlowEthernetEtherTypeChoiceEnum("increment"), - DECREMENT: PatternFlowEthernetEtherTypeChoiceEnum("decrement"), -} - -func (obj *patternFlowEthernetEtherType) Choice() PatternFlowEthernetEtherTypeChoiceEnum { - return PatternFlowEthernetEtherTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowEthernetEtherType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowEthernetEtherType) setChoice(value PatternFlowEthernetEtherTypeChoiceEnum) PatternFlowEthernetEtherType { - intValue, ok := otg.PatternFlowEthernetEtherType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowEthernetEtherTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowEthernetEtherType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Auto = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowEthernetEtherTypeChoice.VALUE { - defaultValue := uint32(65535) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowEthernetEtherTypeChoice.VALUES { - defaultValue := []uint32{65535} - obj.obj.Values = defaultValue - } - - if value == PatternFlowEthernetEtherTypeChoice.AUTO { - defaultValue := uint32(65535) - obj.obj.Auto = &defaultValue - } - - if value == PatternFlowEthernetEtherTypeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowEthernetEtherTypeCounter().msg() - } - - if value == PatternFlowEthernetEtherTypeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowEthernetEtherTypeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowEthernetEtherType) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowEthernetEtherTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowEthernetEtherType) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowEthernetEtherType object -func (obj *patternFlowEthernetEtherType) SetValue(value uint32) PatternFlowEthernetEtherType { - obj.setChoice(PatternFlowEthernetEtherTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowEthernetEtherType) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{65535}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowEthernetEtherType object -func (obj *patternFlowEthernetEtherType) SetValues(value []uint32) PatternFlowEthernetEtherType { - obj.setChoice(PatternFlowEthernetEtherTypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowEthernetEtherType) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(PatternFlowEthernetEtherTypeChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowEthernetEtherType) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Increment returns a PatternFlowEthernetEtherTypeCounter -func (obj *patternFlowEthernetEtherType) Increment() PatternFlowEthernetEtherTypeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowEthernetEtherTypeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowEthernetEtherTypeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowEthernetEtherTypeCounter -func (obj *patternFlowEthernetEtherType) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowEthernetEtherTypeCounter value in the PatternFlowEthernetEtherType object -func (obj *patternFlowEthernetEtherType) SetIncrement(value PatternFlowEthernetEtherTypeCounter) PatternFlowEthernetEtherType { - obj.setChoice(PatternFlowEthernetEtherTypeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowEthernetEtherTypeCounter -func (obj *patternFlowEthernetEtherType) Decrement() PatternFlowEthernetEtherTypeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowEthernetEtherTypeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowEthernetEtherTypeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowEthernetEtherTypeCounter -func (obj *patternFlowEthernetEtherType) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowEthernetEtherTypeCounter value in the PatternFlowEthernetEtherType object -func (obj *patternFlowEthernetEtherType) SetDecrement(value PatternFlowEthernetEtherTypeCounter) PatternFlowEthernetEtherType { - obj.setChoice(PatternFlowEthernetEtherTypeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowEthernetEtherTypeMetricTag -func (obj *patternFlowEthernetEtherType) MetricTags() PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowEthernetEtherTypeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter struct { - obj *patternFlowEthernetEtherType - patternFlowEthernetEtherTypeMetricTagSlice []PatternFlowEthernetEtherTypeMetricTag - fieldPtr *[]*otg.PatternFlowEthernetEtherTypeMetricTag -} - -func newPatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter(ptr *[]*otg.PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { - return &patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter interface { - setMsg(*patternFlowEthernetEtherType) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter - Items() []PatternFlowEthernetEtherTypeMetricTag - Add() PatternFlowEthernetEtherTypeMetricTag - Append(items ...PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter - Set(index int, newObj PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter - Clear() PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter - clearHolderSlice() PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter - appendHolderSlice(item PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter -} - -func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) setMsg(msg *patternFlowEthernetEtherType) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowEthernetEtherTypeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) Items() []PatternFlowEthernetEtherTypeMetricTag { - return obj.patternFlowEthernetEtherTypeMetricTagSlice -} - -func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) Add() PatternFlowEthernetEtherTypeMetricTag { - newObj := &otg.PatternFlowEthernetEtherTypeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowEthernetEtherTypeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowEthernetEtherTypeMetricTagSlice = append(obj.patternFlowEthernetEtherTypeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) Append(items ...PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowEthernetEtherTypeMetricTagSlice = append(obj.patternFlowEthernetEtherTypeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) Set(index int, newObj PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowEthernetEtherTypeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) Clear() PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowEthernetEtherTypeMetricTag{} - obj.patternFlowEthernetEtherTypeMetricTagSlice = []PatternFlowEthernetEtherTypeMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) clearHolderSlice() PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { - if len(obj.patternFlowEthernetEtherTypeMetricTagSlice) > 0 { - obj.patternFlowEthernetEtherTypeMetricTagSlice = []PatternFlowEthernetEtherTypeMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) appendHolderSlice(item PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { - obj.patternFlowEthernetEtherTypeMetricTagSlice = append(obj.patternFlowEthernetEtherTypeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowEthernetEtherType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetEtherType.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowEthernetEtherType.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Auto != nil { - - if *obj.obj.Auto > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetEtherType.Auto <= 65535 but Got %d", *obj.obj.Auto)) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowEthernetEtherTypeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowEthernetEtherType) setDefault() { - var choices_set int = 0 - var choice PatternFlowEthernetEtherTypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowEthernetEtherTypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowEthernetEtherTypeChoice.VALUES - } - - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowEthernetEtherTypeChoice.AUTO - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowEthernetEtherTypeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowEthernetEtherTypeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowEthernetEtherTypeChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetEtherType") - } - } else { - intVal := otg.PatternFlowEthernetEtherType_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowEthernetEtherType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowEthernetPfcQueue ***** -type patternFlowEthernetPfcQueue struct { - validation - obj *otg.PatternFlowEthernetPfcQueue - marshaller marshalPatternFlowEthernetPfcQueue - unMarshaller unMarshalPatternFlowEthernetPfcQueue - incrementHolder PatternFlowEthernetPfcQueueCounter - decrementHolder PatternFlowEthernetPfcQueueCounter - metricTagsHolder PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter -} - -func NewPatternFlowEthernetPfcQueue() PatternFlowEthernetPfcQueue { - obj := patternFlowEthernetPfcQueue{obj: &otg.PatternFlowEthernetPfcQueue{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPfcQueue) msg() *otg.PatternFlowEthernetPfcQueue { - return obj.obj -} - -func (obj *patternFlowEthernetPfcQueue) setMsg(msg *otg.PatternFlowEthernetPfcQueue) PatternFlowEthernetPfcQueue { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPfcQueue struct { - obj *patternFlowEthernetPfcQueue -} - -type marshalPatternFlowEthernetPfcQueue interface { - // ToProto marshals PatternFlowEthernetPfcQueue to protobuf object *otg.PatternFlowEthernetPfcQueue - ToProto() (*otg.PatternFlowEthernetPfcQueue, error) - // ToPbText marshals PatternFlowEthernetPfcQueue to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPfcQueue to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPfcQueue to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPfcQueue struct { - obj *patternFlowEthernetPfcQueue -} - -type unMarshalPatternFlowEthernetPfcQueue interface { - // FromProto unmarshals PatternFlowEthernetPfcQueue from protobuf object *otg.PatternFlowEthernetPfcQueue - FromProto(msg *otg.PatternFlowEthernetPfcQueue) (PatternFlowEthernetPfcQueue, error) - // FromPbText unmarshals PatternFlowEthernetPfcQueue from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPfcQueue from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPfcQueue from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPfcQueue) Marshal() marshalPatternFlowEthernetPfcQueue { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPfcQueue{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPfcQueue) Unmarshal() unMarshalPatternFlowEthernetPfcQueue { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPfcQueue{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPfcQueue) ToProto() (*otg.PatternFlowEthernetPfcQueue, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPfcQueue) FromProto(msg *otg.PatternFlowEthernetPfcQueue) (PatternFlowEthernetPfcQueue, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPfcQueue) 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 *unMarshalpatternFlowEthernetPfcQueue) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowEthernetPfcQueue) 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 *unMarshalpatternFlowEthernetPfcQueue) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowEthernetPfcQueue) 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 *unMarshalpatternFlowEthernetPfcQueue) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowEthernetPfcQueue) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPfcQueue) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPfcQueue) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPfcQueue) Clone() (PatternFlowEthernetPfcQueue, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPfcQueue() - 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 -} - -func (obj *patternFlowEthernetPfcQueue) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowEthernetPfcQueue is priority flow control queue -type PatternFlowEthernetPfcQueue interface { - Validation - // msg marshals PatternFlowEthernetPfcQueue to protobuf object *otg.PatternFlowEthernetPfcQueue - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPfcQueue - // setMsg unmarshals PatternFlowEthernetPfcQueue from protobuf object *otg.PatternFlowEthernetPfcQueue - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPfcQueue) PatternFlowEthernetPfcQueue - // provides marshal interface - Marshal() marshalPatternFlowEthernetPfcQueue - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPfcQueue - // validate validates PatternFlowEthernetPfcQueue - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPfcQueue, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowEthernetPfcQueueChoiceEnum, set in PatternFlowEthernetPfcQueue - Choice() PatternFlowEthernetPfcQueueChoiceEnum - // setChoice assigns PatternFlowEthernetPfcQueueChoiceEnum provided by user to PatternFlowEthernetPfcQueue - setChoice(value PatternFlowEthernetPfcQueueChoiceEnum) PatternFlowEthernetPfcQueue - // HasChoice checks if Choice has been set in PatternFlowEthernetPfcQueue - HasChoice() bool - // Value returns uint32, set in PatternFlowEthernetPfcQueue. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowEthernetPfcQueue - SetValue(value uint32) PatternFlowEthernetPfcQueue - // HasValue checks if Value has been set in PatternFlowEthernetPfcQueue - HasValue() bool - // Values returns []uint32, set in PatternFlowEthernetPfcQueue. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowEthernetPfcQueue - SetValues(value []uint32) PatternFlowEthernetPfcQueue - // Increment returns PatternFlowEthernetPfcQueueCounter, set in PatternFlowEthernetPfcQueue. - // PatternFlowEthernetPfcQueueCounter is integer counter pattern - Increment() PatternFlowEthernetPfcQueueCounter - // SetIncrement assigns PatternFlowEthernetPfcQueueCounter provided by user to PatternFlowEthernetPfcQueue. - // PatternFlowEthernetPfcQueueCounter is integer counter pattern - SetIncrement(value PatternFlowEthernetPfcQueueCounter) PatternFlowEthernetPfcQueue - // HasIncrement checks if Increment has been set in PatternFlowEthernetPfcQueue - HasIncrement() bool - // Decrement returns PatternFlowEthernetPfcQueueCounter, set in PatternFlowEthernetPfcQueue. - // PatternFlowEthernetPfcQueueCounter is integer counter pattern - Decrement() PatternFlowEthernetPfcQueueCounter - // SetDecrement assigns PatternFlowEthernetPfcQueueCounter provided by user to PatternFlowEthernetPfcQueue. - // PatternFlowEthernetPfcQueueCounter is integer counter pattern - SetDecrement(value PatternFlowEthernetPfcQueueCounter) PatternFlowEthernetPfcQueue - // HasDecrement checks if Decrement has been set in PatternFlowEthernetPfcQueue - HasDecrement() bool - // MetricTags returns PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIterIter, set in PatternFlowEthernetPfcQueue - MetricTags() PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter - setNil() -} - -type PatternFlowEthernetPfcQueueChoiceEnum string - -// Enum of Choice on PatternFlowEthernetPfcQueue -var PatternFlowEthernetPfcQueueChoice = struct { - VALUE PatternFlowEthernetPfcQueueChoiceEnum - VALUES PatternFlowEthernetPfcQueueChoiceEnum - INCREMENT PatternFlowEthernetPfcQueueChoiceEnum - DECREMENT PatternFlowEthernetPfcQueueChoiceEnum -}{ - VALUE: PatternFlowEthernetPfcQueueChoiceEnum("value"), - VALUES: PatternFlowEthernetPfcQueueChoiceEnum("values"), - INCREMENT: PatternFlowEthernetPfcQueueChoiceEnum("increment"), - DECREMENT: PatternFlowEthernetPfcQueueChoiceEnum("decrement"), -} - -func (obj *patternFlowEthernetPfcQueue) Choice() PatternFlowEthernetPfcQueueChoiceEnum { - return PatternFlowEthernetPfcQueueChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowEthernetPfcQueue) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowEthernetPfcQueue) setChoice(value PatternFlowEthernetPfcQueueChoiceEnum) PatternFlowEthernetPfcQueue { - intValue, ok := otg.PatternFlowEthernetPfcQueue_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowEthernetPfcQueueChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowEthernetPfcQueue_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowEthernetPfcQueueChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowEthernetPfcQueueChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowEthernetPfcQueueChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowEthernetPfcQueueCounter().msg() - } - - if value == PatternFlowEthernetPfcQueueChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowEthernetPfcQueueCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowEthernetPfcQueue) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowEthernetPfcQueueChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowEthernetPfcQueue) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowEthernetPfcQueue object -func (obj *patternFlowEthernetPfcQueue) SetValue(value uint32) PatternFlowEthernetPfcQueue { - obj.setChoice(PatternFlowEthernetPfcQueueChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowEthernetPfcQueue) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowEthernetPfcQueue object -func (obj *patternFlowEthernetPfcQueue) SetValues(value []uint32) PatternFlowEthernetPfcQueue { - obj.setChoice(PatternFlowEthernetPfcQueueChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowEthernetPfcQueueCounter -func (obj *patternFlowEthernetPfcQueue) Increment() PatternFlowEthernetPfcQueueCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowEthernetPfcQueueChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowEthernetPfcQueueCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowEthernetPfcQueueCounter -func (obj *patternFlowEthernetPfcQueue) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowEthernetPfcQueueCounter value in the PatternFlowEthernetPfcQueue object -func (obj *patternFlowEthernetPfcQueue) SetIncrement(value PatternFlowEthernetPfcQueueCounter) PatternFlowEthernetPfcQueue { - obj.setChoice(PatternFlowEthernetPfcQueueChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowEthernetPfcQueueCounter -func (obj *patternFlowEthernetPfcQueue) Decrement() PatternFlowEthernetPfcQueueCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowEthernetPfcQueueChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowEthernetPfcQueueCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowEthernetPfcQueueCounter -func (obj *patternFlowEthernetPfcQueue) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowEthernetPfcQueueCounter value in the PatternFlowEthernetPfcQueue object -func (obj *patternFlowEthernetPfcQueue) SetDecrement(value PatternFlowEthernetPfcQueueCounter) PatternFlowEthernetPfcQueue { - obj.setChoice(PatternFlowEthernetPfcQueueChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowEthernetPfcQueueMetricTag -func (obj *patternFlowEthernetPfcQueue) MetricTags() PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowEthernetPfcQueueMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter struct { - obj *patternFlowEthernetPfcQueue - patternFlowEthernetPfcQueueMetricTagSlice []PatternFlowEthernetPfcQueueMetricTag - fieldPtr *[]*otg.PatternFlowEthernetPfcQueueMetricTag -} - -func newPatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter(ptr *[]*otg.PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { - return &patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter interface { - setMsg(*patternFlowEthernetPfcQueue) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter - Items() []PatternFlowEthernetPfcQueueMetricTag - Add() PatternFlowEthernetPfcQueueMetricTag - Append(items ...PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter - Set(index int, newObj PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter - Clear() PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter - clearHolderSlice() PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter - appendHolderSlice(item PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter -} - -func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) setMsg(msg *patternFlowEthernetPfcQueue) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowEthernetPfcQueueMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) Items() []PatternFlowEthernetPfcQueueMetricTag { - return obj.patternFlowEthernetPfcQueueMetricTagSlice -} - -func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) Add() PatternFlowEthernetPfcQueueMetricTag { - newObj := &otg.PatternFlowEthernetPfcQueueMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowEthernetPfcQueueMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowEthernetPfcQueueMetricTagSlice = append(obj.patternFlowEthernetPfcQueueMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) Append(items ...PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowEthernetPfcQueueMetricTagSlice = append(obj.patternFlowEthernetPfcQueueMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) Set(index int, newObj PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowEthernetPfcQueueMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) Clear() PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowEthernetPfcQueueMetricTag{} - obj.patternFlowEthernetPfcQueueMetricTagSlice = []PatternFlowEthernetPfcQueueMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) clearHolderSlice() PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { - if len(obj.patternFlowEthernetPfcQueueMetricTagSlice) > 0 { - obj.patternFlowEthernetPfcQueueMetricTagSlice = []PatternFlowEthernetPfcQueueMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) appendHolderSlice(item PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { - obj.patternFlowEthernetPfcQueueMetricTagSlice = append(obj.patternFlowEthernetPfcQueueMetricTagSlice, item) - return obj -} - -func (obj *patternFlowEthernetPfcQueue) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPfcQueue.Value <= 7 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowEthernetPfcQueue.Values <= 7 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowEthernetPfcQueueMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowEthernetPfcQueue) setDefault() { - var choices_set int = 0 - var choice PatternFlowEthernetPfcQueueChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowEthernetPfcQueueChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowEthernetPfcQueueChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowEthernetPfcQueueChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowEthernetPfcQueueChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowEthernetPfcQueueChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetPfcQueue") - } - } else { - intVal := otg.PatternFlowEthernetPfcQueue_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowEthernetPfcQueue_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowVlanPriority ***** -type patternFlowVlanPriority struct { - validation - obj *otg.PatternFlowVlanPriority - marshaller marshalPatternFlowVlanPriority - unMarshaller unMarshalPatternFlowVlanPriority - incrementHolder PatternFlowVlanPriorityCounter - decrementHolder PatternFlowVlanPriorityCounter - metricTagsHolder PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter -} - -func NewPatternFlowVlanPriority() PatternFlowVlanPriority { - obj := patternFlowVlanPriority{obj: &otg.PatternFlowVlanPriority{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVlanPriority) msg() *otg.PatternFlowVlanPriority { - return obj.obj -} - -func (obj *patternFlowVlanPriority) setMsg(msg *otg.PatternFlowVlanPriority) PatternFlowVlanPriority { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVlanPriority struct { - obj *patternFlowVlanPriority -} - -type marshalPatternFlowVlanPriority interface { - // ToProto marshals PatternFlowVlanPriority to protobuf object *otg.PatternFlowVlanPriority - ToProto() (*otg.PatternFlowVlanPriority, error) - // ToPbText marshals PatternFlowVlanPriority to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVlanPriority to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVlanPriority to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVlanPriority struct { - obj *patternFlowVlanPriority -} - -type unMarshalPatternFlowVlanPriority interface { - // FromProto unmarshals PatternFlowVlanPriority from protobuf object *otg.PatternFlowVlanPriority - FromProto(msg *otg.PatternFlowVlanPriority) (PatternFlowVlanPriority, error) - // FromPbText unmarshals PatternFlowVlanPriority from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVlanPriority from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVlanPriority from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVlanPriority) Marshal() marshalPatternFlowVlanPriority { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVlanPriority{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVlanPriority) Unmarshal() unMarshalPatternFlowVlanPriority { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVlanPriority{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVlanPriority) ToProto() (*otg.PatternFlowVlanPriority, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVlanPriority) FromProto(msg *otg.PatternFlowVlanPriority) (PatternFlowVlanPriority, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVlanPriority) 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 *unMarshalpatternFlowVlanPriority) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowVlanPriority) 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 *unMarshalpatternFlowVlanPriority) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowVlanPriority) 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 *unMarshalpatternFlowVlanPriority) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowVlanPriority) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVlanPriority) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVlanPriority) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVlanPriority) Clone() (PatternFlowVlanPriority, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVlanPriority() - 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 -} - -func (obj *patternFlowVlanPriority) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowVlanPriority is priority code point -type PatternFlowVlanPriority interface { - Validation - // msg marshals PatternFlowVlanPriority to protobuf object *otg.PatternFlowVlanPriority - // and doesn't set defaults - msg() *otg.PatternFlowVlanPriority - // setMsg unmarshals PatternFlowVlanPriority from protobuf object *otg.PatternFlowVlanPriority - // and doesn't set defaults - setMsg(*otg.PatternFlowVlanPriority) PatternFlowVlanPriority - // provides marshal interface - Marshal() marshalPatternFlowVlanPriority - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVlanPriority - // validate validates PatternFlowVlanPriority - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVlanPriority, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowVlanPriorityChoiceEnum, set in PatternFlowVlanPriority - Choice() PatternFlowVlanPriorityChoiceEnum - // setChoice assigns PatternFlowVlanPriorityChoiceEnum provided by user to PatternFlowVlanPriority - setChoice(value PatternFlowVlanPriorityChoiceEnum) PatternFlowVlanPriority - // HasChoice checks if Choice has been set in PatternFlowVlanPriority - HasChoice() bool - // Value returns uint32, set in PatternFlowVlanPriority. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowVlanPriority - SetValue(value uint32) PatternFlowVlanPriority - // HasValue checks if Value has been set in PatternFlowVlanPriority - HasValue() bool - // Values returns []uint32, set in PatternFlowVlanPriority. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowVlanPriority - SetValues(value []uint32) PatternFlowVlanPriority - // Increment returns PatternFlowVlanPriorityCounter, set in PatternFlowVlanPriority. - // PatternFlowVlanPriorityCounter is integer counter pattern - Increment() PatternFlowVlanPriorityCounter - // SetIncrement assigns PatternFlowVlanPriorityCounter provided by user to PatternFlowVlanPriority. - // PatternFlowVlanPriorityCounter is integer counter pattern - SetIncrement(value PatternFlowVlanPriorityCounter) PatternFlowVlanPriority - // HasIncrement checks if Increment has been set in PatternFlowVlanPriority - HasIncrement() bool - // Decrement returns PatternFlowVlanPriorityCounter, set in PatternFlowVlanPriority. - // PatternFlowVlanPriorityCounter is integer counter pattern - Decrement() PatternFlowVlanPriorityCounter - // SetDecrement assigns PatternFlowVlanPriorityCounter provided by user to PatternFlowVlanPriority. - // PatternFlowVlanPriorityCounter is integer counter pattern - SetDecrement(value PatternFlowVlanPriorityCounter) PatternFlowVlanPriority - // HasDecrement checks if Decrement has been set in PatternFlowVlanPriority - HasDecrement() bool - // MetricTags returns PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIterIter, set in PatternFlowVlanPriority - MetricTags() PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter - setNil() -} - -type PatternFlowVlanPriorityChoiceEnum string - -// Enum of Choice on PatternFlowVlanPriority -var PatternFlowVlanPriorityChoice = struct { - VALUE PatternFlowVlanPriorityChoiceEnum - VALUES PatternFlowVlanPriorityChoiceEnum - INCREMENT PatternFlowVlanPriorityChoiceEnum - DECREMENT PatternFlowVlanPriorityChoiceEnum -}{ - VALUE: PatternFlowVlanPriorityChoiceEnum("value"), - VALUES: PatternFlowVlanPriorityChoiceEnum("values"), - INCREMENT: PatternFlowVlanPriorityChoiceEnum("increment"), - DECREMENT: PatternFlowVlanPriorityChoiceEnum("decrement"), -} - -func (obj *patternFlowVlanPriority) Choice() PatternFlowVlanPriorityChoiceEnum { - return PatternFlowVlanPriorityChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowVlanPriority) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowVlanPriority) setChoice(value PatternFlowVlanPriorityChoiceEnum) PatternFlowVlanPriority { - intValue, ok := otg.PatternFlowVlanPriority_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowVlanPriorityChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowVlanPriority_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowVlanPriorityChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowVlanPriorityChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowVlanPriorityChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowVlanPriorityCounter().msg() - } - - if value == PatternFlowVlanPriorityChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowVlanPriorityCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVlanPriority) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowVlanPriorityChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVlanPriority) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowVlanPriority object -func (obj *patternFlowVlanPriority) SetValue(value uint32) PatternFlowVlanPriority { - obj.setChoice(PatternFlowVlanPriorityChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowVlanPriority) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowVlanPriority object -func (obj *patternFlowVlanPriority) SetValues(value []uint32) PatternFlowVlanPriority { - obj.setChoice(PatternFlowVlanPriorityChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowVlanPriorityCounter -func (obj *patternFlowVlanPriority) Increment() PatternFlowVlanPriorityCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowVlanPriorityChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowVlanPriorityCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowVlanPriorityCounter -func (obj *patternFlowVlanPriority) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowVlanPriorityCounter value in the PatternFlowVlanPriority object -func (obj *patternFlowVlanPriority) SetIncrement(value PatternFlowVlanPriorityCounter) PatternFlowVlanPriority { - obj.setChoice(PatternFlowVlanPriorityChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowVlanPriorityCounter -func (obj *patternFlowVlanPriority) Decrement() PatternFlowVlanPriorityCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowVlanPriorityChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowVlanPriorityCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowVlanPriorityCounter -func (obj *patternFlowVlanPriority) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowVlanPriorityCounter value in the PatternFlowVlanPriority object -func (obj *patternFlowVlanPriority) SetDecrement(value PatternFlowVlanPriorityCounter) PatternFlowVlanPriority { - obj.setChoice(PatternFlowVlanPriorityChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowVlanPriorityMetricTag -func (obj *patternFlowVlanPriority) MetricTags() PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowVlanPriorityMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter struct { - obj *patternFlowVlanPriority - patternFlowVlanPriorityMetricTagSlice []PatternFlowVlanPriorityMetricTag - fieldPtr *[]*otg.PatternFlowVlanPriorityMetricTag -} - -func newPatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter(ptr *[]*otg.PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { - return &patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter interface { - setMsg(*patternFlowVlanPriority) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter - Items() []PatternFlowVlanPriorityMetricTag - Add() PatternFlowVlanPriorityMetricTag - Append(items ...PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter - Set(index int, newObj PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter - Clear() PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter - clearHolderSlice() PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter - appendHolderSlice(item PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter -} - -func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) setMsg(msg *patternFlowVlanPriority) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowVlanPriorityMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) Items() []PatternFlowVlanPriorityMetricTag { - return obj.patternFlowVlanPriorityMetricTagSlice -} - -func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) Add() PatternFlowVlanPriorityMetricTag { - newObj := &otg.PatternFlowVlanPriorityMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowVlanPriorityMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowVlanPriorityMetricTagSlice = append(obj.patternFlowVlanPriorityMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) Append(items ...PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowVlanPriorityMetricTagSlice = append(obj.patternFlowVlanPriorityMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) Set(index int, newObj PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowVlanPriorityMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) Clear() PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowVlanPriorityMetricTag{} - obj.patternFlowVlanPriorityMetricTagSlice = []PatternFlowVlanPriorityMetricTag{} - } - return obj -} -func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) clearHolderSlice() PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { - if len(obj.patternFlowVlanPriorityMetricTagSlice) > 0 { - obj.patternFlowVlanPriorityMetricTagSlice = []PatternFlowVlanPriorityMetricTag{} - } - return obj -} -func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) appendHolderSlice(item PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { - obj.patternFlowVlanPriorityMetricTagSlice = append(obj.patternFlowVlanPriorityMetricTagSlice, item) - return obj -} - -func (obj *patternFlowVlanPriority) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanPriority.Value <= 7 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowVlanPriority.Values <= 7 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowVlanPriorityMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowVlanPriority) setDefault() { - var choices_set int = 0 - var choice PatternFlowVlanPriorityChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowVlanPriorityChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowVlanPriorityChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowVlanPriorityChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowVlanPriorityChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowVlanPriorityChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVlanPriority") - } - } else { - intVal := otg.PatternFlowVlanPriority_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowVlanPriority_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowVlanCfi ***** -type patternFlowVlanCfi struct { - validation - obj *otg.PatternFlowVlanCfi - marshaller marshalPatternFlowVlanCfi - unMarshaller unMarshalPatternFlowVlanCfi - incrementHolder PatternFlowVlanCfiCounter - decrementHolder PatternFlowVlanCfiCounter - metricTagsHolder PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter -} - -func NewPatternFlowVlanCfi() PatternFlowVlanCfi { - obj := patternFlowVlanCfi{obj: &otg.PatternFlowVlanCfi{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVlanCfi) msg() *otg.PatternFlowVlanCfi { - return obj.obj -} - -func (obj *patternFlowVlanCfi) setMsg(msg *otg.PatternFlowVlanCfi) PatternFlowVlanCfi { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVlanCfi struct { - obj *patternFlowVlanCfi -} - -type marshalPatternFlowVlanCfi interface { - // ToProto marshals PatternFlowVlanCfi to protobuf object *otg.PatternFlowVlanCfi - ToProto() (*otg.PatternFlowVlanCfi, error) - // ToPbText marshals PatternFlowVlanCfi to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVlanCfi to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVlanCfi to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVlanCfi struct { - obj *patternFlowVlanCfi -} - -type unMarshalPatternFlowVlanCfi interface { - // FromProto unmarshals PatternFlowVlanCfi from protobuf object *otg.PatternFlowVlanCfi - FromProto(msg *otg.PatternFlowVlanCfi) (PatternFlowVlanCfi, error) - // FromPbText unmarshals PatternFlowVlanCfi from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVlanCfi from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVlanCfi from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVlanCfi) Marshal() marshalPatternFlowVlanCfi { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVlanCfi{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVlanCfi) Unmarshal() unMarshalPatternFlowVlanCfi { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVlanCfi{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVlanCfi) ToProto() (*otg.PatternFlowVlanCfi, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVlanCfi) FromProto(msg *otg.PatternFlowVlanCfi) (PatternFlowVlanCfi, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVlanCfi) 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 *unMarshalpatternFlowVlanCfi) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowVlanCfi) 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 *unMarshalpatternFlowVlanCfi) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowVlanCfi) 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 *unMarshalpatternFlowVlanCfi) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowVlanCfi) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVlanCfi) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVlanCfi) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVlanCfi) Clone() (PatternFlowVlanCfi, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVlanCfi() - 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 -} - -func (obj *patternFlowVlanCfi) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowVlanCfi is canonical format indicator or drop elegible indicator -type PatternFlowVlanCfi interface { - Validation - // msg marshals PatternFlowVlanCfi to protobuf object *otg.PatternFlowVlanCfi - // and doesn't set defaults - msg() *otg.PatternFlowVlanCfi - // setMsg unmarshals PatternFlowVlanCfi from protobuf object *otg.PatternFlowVlanCfi - // and doesn't set defaults - setMsg(*otg.PatternFlowVlanCfi) PatternFlowVlanCfi - // provides marshal interface - Marshal() marshalPatternFlowVlanCfi - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVlanCfi - // validate validates PatternFlowVlanCfi - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVlanCfi, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowVlanCfiChoiceEnum, set in PatternFlowVlanCfi - Choice() PatternFlowVlanCfiChoiceEnum - // setChoice assigns PatternFlowVlanCfiChoiceEnum provided by user to PatternFlowVlanCfi - setChoice(value PatternFlowVlanCfiChoiceEnum) PatternFlowVlanCfi - // HasChoice checks if Choice has been set in PatternFlowVlanCfi - HasChoice() bool - // Value returns uint32, set in PatternFlowVlanCfi. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowVlanCfi - SetValue(value uint32) PatternFlowVlanCfi - // HasValue checks if Value has been set in PatternFlowVlanCfi - HasValue() bool - // Values returns []uint32, set in PatternFlowVlanCfi. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowVlanCfi - SetValues(value []uint32) PatternFlowVlanCfi - // Increment returns PatternFlowVlanCfiCounter, set in PatternFlowVlanCfi. - // PatternFlowVlanCfiCounter is integer counter pattern - Increment() PatternFlowVlanCfiCounter - // SetIncrement assigns PatternFlowVlanCfiCounter provided by user to PatternFlowVlanCfi. - // PatternFlowVlanCfiCounter is integer counter pattern - SetIncrement(value PatternFlowVlanCfiCounter) PatternFlowVlanCfi - // HasIncrement checks if Increment has been set in PatternFlowVlanCfi - HasIncrement() bool - // Decrement returns PatternFlowVlanCfiCounter, set in PatternFlowVlanCfi. - // PatternFlowVlanCfiCounter is integer counter pattern - Decrement() PatternFlowVlanCfiCounter - // SetDecrement assigns PatternFlowVlanCfiCounter provided by user to PatternFlowVlanCfi. - // PatternFlowVlanCfiCounter is integer counter pattern - SetDecrement(value PatternFlowVlanCfiCounter) PatternFlowVlanCfi - // HasDecrement checks if Decrement has been set in PatternFlowVlanCfi - HasDecrement() bool - // MetricTags returns PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIterIter, set in PatternFlowVlanCfi - MetricTags() PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter - setNil() -} - -type PatternFlowVlanCfiChoiceEnum string - -// Enum of Choice on PatternFlowVlanCfi -var PatternFlowVlanCfiChoice = struct { - VALUE PatternFlowVlanCfiChoiceEnum - VALUES PatternFlowVlanCfiChoiceEnum - INCREMENT PatternFlowVlanCfiChoiceEnum - DECREMENT PatternFlowVlanCfiChoiceEnum -}{ - VALUE: PatternFlowVlanCfiChoiceEnum("value"), - VALUES: PatternFlowVlanCfiChoiceEnum("values"), - INCREMENT: PatternFlowVlanCfiChoiceEnum("increment"), - DECREMENT: PatternFlowVlanCfiChoiceEnum("decrement"), -} - -func (obj *patternFlowVlanCfi) Choice() PatternFlowVlanCfiChoiceEnum { - return PatternFlowVlanCfiChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowVlanCfi) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowVlanCfi) setChoice(value PatternFlowVlanCfiChoiceEnum) PatternFlowVlanCfi { - intValue, ok := otg.PatternFlowVlanCfi_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowVlanCfiChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowVlanCfi_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowVlanCfiChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowVlanCfiChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowVlanCfiChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowVlanCfiCounter().msg() - } - - if value == PatternFlowVlanCfiChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowVlanCfiCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVlanCfi) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowVlanCfiChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVlanCfi) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowVlanCfi object -func (obj *patternFlowVlanCfi) SetValue(value uint32) PatternFlowVlanCfi { - obj.setChoice(PatternFlowVlanCfiChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowVlanCfi) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowVlanCfi object -func (obj *patternFlowVlanCfi) SetValues(value []uint32) PatternFlowVlanCfi { - obj.setChoice(PatternFlowVlanCfiChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowVlanCfiCounter -func (obj *patternFlowVlanCfi) Increment() PatternFlowVlanCfiCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowVlanCfiChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowVlanCfiCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowVlanCfiCounter -func (obj *patternFlowVlanCfi) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowVlanCfiCounter value in the PatternFlowVlanCfi object -func (obj *patternFlowVlanCfi) SetIncrement(value PatternFlowVlanCfiCounter) PatternFlowVlanCfi { - obj.setChoice(PatternFlowVlanCfiChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowVlanCfiCounter -func (obj *patternFlowVlanCfi) Decrement() PatternFlowVlanCfiCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowVlanCfiChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowVlanCfiCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowVlanCfiCounter -func (obj *patternFlowVlanCfi) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowVlanCfiCounter value in the PatternFlowVlanCfi object -func (obj *patternFlowVlanCfi) SetDecrement(value PatternFlowVlanCfiCounter) PatternFlowVlanCfi { - obj.setChoice(PatternFlowVlanCfiChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowVlanCfiMetricTag -func (obj *patternFlowVlanCfi) MetricTags() PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowVlanCfiMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter struct { - obj *patternFlowVlanCfi - patternFlowVlanCfiMetricTagSlice []PatternFlowVlanCfiMetricTag - fieldPtr *[]*otg.PatternFlowVlanCfiMetricTag -} - -func newPatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter(ptr *[]*otg.PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { - return &patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter interface { - setMsg(*patternFlowVlanCfi) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter - Items() []PatternFlowVlanCfiMetricTag - Add() PatternFlowVlanCfiMetricTag - Append(items ...PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter - Set(index int, newObj PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter - Clear() PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter - clearHolderSlice() PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter - appendHolderSlice(item PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter -} - -func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) setMsg(msg *patternFlowVlanCfi) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowVlanCfiMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) Items() []PatternFlowVlanCfiMetricTag { - return obj.patternFlowVlanCfiMetricTagSlice -} - -func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) Add() PatternFlowVlanCfiMetricTag { - newObj := &otg.PatternFlowVlanCfiMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowVlanCfiMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowVlanCfiMetricTagSlice = append(obj.patternFlowVlanCfiMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) Append(items ...PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowVlanCfiMetricTagSlice = append(obj.patternFlowVlanCfiMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) Set(index int, newObj PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowVlanCfiMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) Clear() PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowVlanCfiMetricTag{} - obj.patternFlowVlanCfiMetricTagSlice = []PatternFlowVlanCfiMetricTag{} - } - return obj -} -func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) clearHolderSlice() PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { - if len(obj.patternFlowVlanCfiMetricTagSlice) > 0 { - obj.patternFlowVlanCfiMetricTagSlice = []PatternFlowVlanCfiMetricTag{} - } - return obj -} -func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) appendHolderSlice(item PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { - obj.patternFlowVlanCfiMetricTagSlice = append(obj.patternFlowVlanCfiMetricTagSlice, item) - return obj -} - -func (obj *patternFlowVlanCfi) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanCfi.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowVlanCfi.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowVlanCfiMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowVlanCfi) setDefault() { - var choices_set int = 0 - var choice PatternFlowVlanCfiChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowVlanCfiChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowVlanCfiChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowVlanCfiChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowVlanCfiChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowVlanCfiChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVlanCfi") - } - } else { - intVal := otg.PatternFlowVlanCfi_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowVlanCfi_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowVlanId ***** -type patternFlowVlanId struct { - validation - obj *otg.PatternFlowVlanId - marshaller marshalPatternFlowVlanId - unMarshaller unMarshalPatternFlowVlanId - incrementHolder PatternFlowVlanIdCounter - decrementHolder PatternFlowVlanIdCounter - metricTagsHolder PatternFlowVlanIdPatternFlowVlanIdMetricTagIter -} - -func NewPatternFlowVlanId() PatternFlowVlanId { - obj := patternFlowVlanId{obj: &otg.PatternFlowVlanId{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVlanId) msg() *otg.PatternFlowVlanId { - return obj.obj -} - -func (obj *patternFlowVlanId) setMsg(msg *otg.PatternFlowVlanId) PatternFlowVlanId { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVlanId struct { - obj *patternFlowVlanId -} - -type marshalPatternFlowVlanId interface { - // ToProto marshals PatternFlowVlanId to protobuf object *otg.PatternFlowVlanId - ToProto() (*otg.PatternFlowVlanId, error) - // ToPbText marshals PatternFlowVlanId to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVlanId to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVlanId to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVlanId struct { - obj *patternFlowVlanId -} - -type unMarshalPatternFlowVlanId interface { - // FromProto unmarshals PatternFlowVlanId from protobuf object *otg.PatternFlowVlanId - FromProto(msg *otg.PatternFlowVlanId) (PatternFlowVlanId, error) - // FromPbText unmarshals PatternFlowVlanId from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVlanId from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVlanId from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVlanId) Marshal() marshalPatternFlowVlanId { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVlanId{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVlanId) Unmarshal() unMarshalPatternFlowVlanId { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVlanId{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVlanId) ToProto() (*otg.PatternFlowVlanId, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVlanId) FromProto(msg *otg.PatternFlowVlanId) (PatternFlowVlanId, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVlanId) 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 *unMarshalpatternFlowVlanId) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowVlanId) 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 *unMarshalpatternFlowVlanId) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowVlanId) 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 *unMarshalpatternFlowVlanId) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowVlanId) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVlanId) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVlanId) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVlanId) Clone() (PatternFlowVlanId, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVlanId() - 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 -} - -func (obj *patternFlowVlanId) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowVlanId is vlan identifier -type PatternFlowVlanId interface { - Validation - // msg marshals PatternFlowVlanId to protobuf object *otg.PatternFlowVlanId - // and doesn't set defaults - msg() *otg.PatternFlowVlanId - // setMsg unmarshals PatternFlowVlanId from protobuf object *otg.PatternFlowVlanId - // and doesn't set defaults - setMsg(*otg.PatternFlowVlanId) PatternFlowVlanId - // provides marshal interface - Marshal() marshalPatternFlowVlanId - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVlanId - // validate validates PatternFlowVlanId - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVlanId, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowVlanIdChoiceEnum, set in PatternFlowVlanId - Choice() PatternFlowVlanIdChoiceEnum - // setChoice assigns PatternFlowVlanIdChoiceEnum provided by user to PatternFlowVlanId - setChoice(value PatternFlowVlanIdChoiceEnum) PatternFlowVlanId - // HasChoice checks if Choice has been set in PatternFlowVlanId - HasChoice() bool - // Value returns uint32, set in PatternFlowVlanId. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowVlanId - SetValue(value uint32) PatternFlowVlanId - // HasValue checks if Value has been set in PatternFlowVlanId - HasValue() bool - // Values returns []uint32, set in PatternFlowVlanId. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowVlanId - SetValues(value []uint32) PatternFlowVlanId - // Increment returns PatternFlowVlanIdCounter, set in PatternFlowVlanId. - // PatternFlowVlanIdCounter is integer counter pattern - Increment() PatternFlowVlanIdCounter - // SetIncrement assigns PatternFlowVlanIdCounter provided by user to PatternFlowVlanId. - // PatternFlowVlanIdCounter is integer counter pattern - SetIncrement(value PatternFlowVlanIdCounter) PatternFlowVlanId - // HasIncrement checks if Increment has been set in PatternFlowVlanId - HasIncrement() bool - // Decrement returns PatternFlowVlanIdCounter, set in PatternFlowVlanId. - // PatternFlowVlanIdCounter is integer counter pattern - Decrement() PatternFlowVlanIdCounter - // SetDecrement assigns PatternFlowVlanIdCounter provided by user to PatternFlowVlanId. - // PatternFlowVlanIdCounter is integer counter pattern - SetDecrement(value PatternFlowVlanIdCounter) PatternFlowVlanId - // HasDecrement checks if Decrement has been set in PatternFlowVlanId - HasDecrement() bool - // MetricTags returns PatternFlowVlanIdPatternFlowVlanIdMetricTagIterIter, set in PatternFlowVlanId - MetricTags() PatternFlowVlanIdPatternFlowVlanIdMetricTagIter - setNil() -} - -type PatternFlowVlanIdChoiceEnum string - -// Enum of Choice on PatternFlowVlanId -var PatternFlowVlanIdChoice = struct { - VALUE PatternFlowVlanIdChoiceEnum - VALUES PatternFlowVlanIdChoiceEnum - INCREMENT PatternFlowVlanIdChoiceEnum - DECREMENT PatternFlowVlanIdChoiceEnum -}{ - VALUE: PatternFlowVlanIdChoiceEnum("value"), - VALUES: PatternFlowVlanIdChoiceEnum("values"), - INCREMENT: PatternFlowVlanIdChoiceEnum("increment"), - DECREMENT: PatternFlowVlanIdChoiceEnum("decrement"), -} - -func (obj *patternFlowVlanId) Choice() PatternFlowVlanIdChoiceEnum { - return PatternFlowVlanIdChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowVlanId) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowVlanId) setChoice(value PatternFlowVlanIdChoiceEnum) PatternFlowVlanId { - intValue, ok := otg.PatternFlowVlanId_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowVlanIdChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowVlanId_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowVlanIdChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowVlanIdChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowVlanIdChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowVlanIdCounter().msg() - } - - if value == PatternFlowVlanIdChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowVlanIdCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVlanId) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowVlanIdChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVlanId) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowVlanId object -func (obj *patternFlowVlanId) SetValue(value uint32) PatternFlowVlanId { - obj.setChoice(PatternFlowVlanIdChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowVlanId) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowVlanId object -func (obj *patternFlowVlanId) SetValues(value []uint32) PatternFlowVlanId { - obj.setChoice(PatternFlowVlanIdChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowVlanIdCounter -func (obj *patternFlowVlanId) Increment() PatternFlowVlanIdCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowVlanIdChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowVlanIdCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowVlanIdCounter -func (obj *patternFlowVlanId) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowVlanIdCounter value in the PatternFlowVlanId object -func (obj *patternFlowVlanId) SetIncrement(value PatternFlowVlanIdCounter) PatternFlowVlanId { - obj.setChoice(PatternFlowVlanIdChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowVlanIdCounter -func (obj *patternFlowVlanId) Decrement() PatternFlowVlanIdCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowVlanIdChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowVlanIdCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowVlanIdCounter -func (obj *patternFlowVlanId) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowVlanIdCounter value in the PatternFlowVlanId object -func (obj *patternFlowVlanId) SetDecrement(value PatternFlowVlanIdCounter) PatternFlowVlanId { - obj.setChoice(PatternFlowVlanIdChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowVlanIdMetricTag -func (obj *patternFlowVlanId) MetricTags() PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowVlanIdMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowVlanIdPatternFlowVlanIdMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowVlanIdPatternFlowVlanIdMetricTagIter struct { - obj *patternFlowVlanId - patternFlowVlanIdMetricTagSlice []PatternFlowVlanIdMetricTag - fieldPtr *[]*otg.PatternFlowVlanIdMetricTag -} - -func newPatternFlowVlanIdPatternFlowVlanIdMetricTagIter(ptr *[]*otg.PatternFlowVlanIdMetricTag) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { - return &patternFlowVlanIdPatternFlowVlanIdMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowVlanIdPatternFlowVlanIdMetricTagIter interface { - setMsg(*patternFlowVlanId) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter - Items() []PatternFlowVlanIdMetricTag - Add() PatternFlowVlanIdMetricTag - Append(items ...PatternFlowVlanIdMetricTag) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter - Set(index int, newObj PatternFlowVlanIdMetricTag) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter - Clear() PatternFlowVlanIdPatternFlowVlanIdMetricTagIter - clearHolderSlice() PatternFlowVlanIdPatternFlowVlanIdMetricTagIter - appendHolderSlice(item PatternFlowVlanIdMetricTag) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter -} - -func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) setMsg(msg *patternFlowVlanId) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowVlanIdMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) Items() []PatternFlowVlanIdMetricTag { - return obj.patternFlowVlanIdMetricTagSlice -} - -func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) Add() PatternFlowVlanIdMetricTag { - newObj := &otg.PatternFlowVlanIdMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowVlanIdMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowVlanIdMetricTagSlice = append(obj.patternFlowVlanIdMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) Append(items ...PatternFlowVlanIdMetricTag) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowVlanIdMetricTagSlice = append(obj.patternFlowVlanIdMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) Set(index int, newObj PatternFlowVlanIdMetricTag) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowVlanIdMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) Clear() PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowVlanIdMetricTag{} - obj.patternFlowVlanIdMetricTagSlice = []PatternFlowVlanIdMetricTag{} - } - return obj -} -func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) clearHolderSlice() PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { - if len(obj.patternFlowVlanIdMetricTagSlice) > 0 { - obj.patternFlowVlanIdMetricTagSlice = []PatternFlowVlanIdMetricTag{} - } - return obj -} -func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) appendHolderSlice(item PatternFlowVlanIdMetricTag) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { - obj.patternFlowVlanIdMetricTagSlice = append(obj.patternFlowVlanIdMetricTagSlice, item) - return obj -} - -func (obj *patternFlowVlanId) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanId.Value <= 4095 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowVlanId.Values <= 4095 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowVlanIdMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowVlanId) setDefault() { - var choices_set int = 0 - var choice PatternFlowVlanIdChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowVlanIdChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowVlanIdChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowVlanIdChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowVlanIdChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowVlanIdChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVlanId") - } - } else { - intVal := otg.PatternFlowVlanId_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowVlanId_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowVlanTpid ***** -type patternFlowVlanTpid struct { - validation - obj *otg.PatternFlowVlanTpid - marshaller marshalPatternFlowVlanTpid - unMarshaller unMarshalPatternFlowVlanTpid - incrementHolder PatternFlowVlanTpidCounter - decrementHolder PatternFlowVlanTpidCounter - metricTagsHolder PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter -} - -func NewPatternFlowVlanTpid() PatternFlowVlanTpid { - obj := patternFlowVlanTpid{obj: &otg.PatternFlowVlanTpid{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVlanTpid) msg() *otg.PatternFlowVlanTpid { - return obj.obj -} - -func (obj *patternFlowVlanTpid) setMsg(msg *otg.PatternFlowVlanTpid) PatternFlowVlanTpid { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVlanTpid struct { - obj *patternFlowVlanTpid -} - -type marshalPatternFlowVlanTpid interface { - // ToProto marshals PatternFlowVlanTpid to protobuf object *otg.PatternFlowVlanTpid - ToProto() (*otg.PatternFlowVlanTpid, error) - // ToPbText marshals PatternFlowVlanTpid to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVlanTpid to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVlanTpid to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVlanTpid struct { - obj *patternFlowVlanTpid -} - -type unMarshalPatternFlowVlanTpid interface { - // FromProto unmarshals PatternFlowVlanTpid from protobuf object *otg.PatternFlowVlanTpid - FromProto(msg *otg.PatternFlowVlanTpid) (PatternFlowVlanTpid, error) - // FromPbText unmarshals PatternFlowVlanTpid from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVlanTpid from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVlanTpid from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVlanTpid) Marshal() marshalPatternFlowVlanTpid { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVlanTpid{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVlanTpid) Unmarshal() unMarshalPatternFlowVlanTpid { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVlanTpid{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVlanTpid) ToProto() (*otg.PatternFlowVlanTpid, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVlanTpid) FromProto(msg *otg.PatternFlowVlanTpid) (PatternFlowVlanTpid, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVlanTpid) 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 *unMarshalpatternFlowVlanTpid) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowVlanTpid) 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 *unMarshalpatternFlowVlanTpid) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowVlanTpid) 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 *unMarshalpatternFlowVlanTpid) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowVlanTpid) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVlanTpid) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVlanTpid) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVlanTpid) Clone() (PatternFlowVlanTpid, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVlanTpid() - 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 -} - -func (obj *patternFlowVlanTpid) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowVlanTpid is protocol identifier -type PatternFlowVlanTpid interface { - Validation - // msg marshals PatternFlowVlanTpid to protobuf object *otg.PatternFlowVlanTpid - // and doesn't set defaults - msg() *otg.PatternFlowVlanTpid - // setMsg unmarshals PatternFlowVlanTpid from protobuf object *otg.PatternFlowVlanTpid - // and doesn't set defaults - setMsg(*otg.PatternFlowVlanTpid) PatternFlowVlanTpid - // provides marshal interface - Marshal() marshalPatternFlowVlanTpid - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVlanTpid - // validate validates PatternFlowVlanTpid - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVlanTpid, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowVlanTpidChoiceEnum, set in PatternFlowVlanTpid - Choice() PatternFlowVlanTpidChoiceEnum - // setChoice assigns PatternFlowVlanTpidChoiceEnum provided by user to PatternFlowVlanTpid - setChoice(value PatternFlowVlanTpidChoiceEnum) PatternFlowVlanTpid - // HasChoice checks if Choice has been set in PatternFlowVlanTpid - HasChoice() bool - // Value returns uint32, set in PatternFlowVlanTpid. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowVlanTpid - SetValue(value uint32) PatternFlowVlanTpid - // HasValue checks if Value has been set in PatternFlowVlanTpid - HasValue() bool - // Values returns []uint32, set in PatternFlowVlanTpid. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowVlanTpid - SetValues(value []uint32) PatternFlowVlanTpid - // Increment returns PatternFlowVlanTpidCounter, set in PatternFlowVlanTpid. - // PatternFlowVlanTpidCounter is integer counter pattern - Increment() PatternFlowVlanTpidCounter - // SetIncrement assigns PatternFlowVlanTpidCounter provided by user to PatternFlowVlanTpid. - // PatternFlowVlanTpidCounter is integer counter pattern - SetIncrement(value PatternFlowVlanTpidCounter) PatternFlowVlanTpid - // HasIncrement checks if Increment has been set in PatternFlowVlanTpid - HasIncrement() bool - // Decrement returns PatternFlowVlanTpidCounter, set in PatternFlowVlanTpid. - // PatternFlowVlanTpidCounter is integer counter pattern - Decrement() PatternFlowVlanTpidCounter - // SetDecrement assigns PatternFlowVlanTpidCounter provided by user to PatternFlowVlanTpid. - // PatternFlowVlanTpidCounter is integer counter pattern - SetDecrement(value PatternFlowVlanTpidCounter) PatternFlowVlanTpid - // HasDecrement checks if Decrement has been set in PatternFlowVlanTpid - HasDecrement() bool - // MetricTags returns PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIterIter, set in PatternFlowVlanTpid - MetricTags() PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter - setNil() -} - -type PatternFlowVlanTpidChoiceEnum string - -// Enum of Choice on PatternFlowVlanTpid -var PatternFlowVlanTpidChoice = struct { - VALUE PatternFlowVlanTpidChoiceEnum - VALUES PatternFlowVlanTpidChoiceEnum - INCREMENT PatternFlowVlanTpidChoiceEnum - DECREMENT PatternFlowVlanTpidChoiceEnum -}{ - VALUE: PatternFlowVlanTpidChoiceEnum("value"), - VALUES: PatternFlowVlanTpidChoiceEnum("values"), - INCREMENT: PatternFlowVlanTpidChoiceEnum("increment"), - DECREMENT: PatternFlowVlanTpidChoiceEnum("decrement"), -} - -func (obj *patternFlowVlanTpid) Choice() PatternFlowVlanTpidChoiceEnum { - return PatternFlowVlanTpidChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowVlanTpid) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowVlanTpid) setChoice(value PatternFlowVlanTpidChoiceEnum) PatternFlowVlanTpid { - intValue, ok := otg.PatternFlowVlanTpid_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowVlanTpidChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowVlanTpid_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowVlanTpidChoice.VALUE { - defaultValue := uint32(65535) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowVlanTpidChoice.VALUES { - defaultValue := []uint32{65535} - obj.obj.Values = defaultValue - } - - if value == PatternFlowVlanTpidChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowVlanTpidCounter().msg() - } - - if value == PatternFlowVlanTpidChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowVlanTpidCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVlanTpid) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowVlanTpidChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVlanTpid) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowVlanTpid object -func (obj *patternFlowVlanTpid) SetValue(value uint32) PatternFlowVlanTpid { - obj.setChoice(PatternFlowVlanTpidChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowVlanTpid) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{65535}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowVlanTpid object -func (obj *patternFlowVlanTpid) SetValues(value []uint32) PatternFlowVlanTpid { - obj.setChoice(PatternFlowVlanTpidChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowVlanTpidCounter -func (obj *patternFlowVlanTpid) Increment() PatternFlowVlanTpidCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowVlanTpidChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowVlanTpidCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowVlanTpidCounter -func (obj *patternFlowVlanTpid) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowVlanTpidCounter value in the PatternFlowVlanTpid object -func (obj *patternFlowVlanTpid) SetIncrement(value PatternFlowVlanTpidCounter) PatternFlowVlanTpid { - obj.setChoice(PatternFlowVlanTpidChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowVlanTpidCounter -func (obj *patternFlowVlanTpid) Decrement() PatternFlowVlanTpidCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowVlanTpidChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowVlanTpidCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowVlanTpidCounter -func (obj *patternFlowVlanTpid) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowVlanTpidCounter value in the PatternFlowVlanTpid object -func (obj *patternFlowVlanTpid) SetDecrement(value PatternFlowVlanTpidCounter) PatternFlowVlanTpid { - obj.setChoice(PatternFlowVlanTpidChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowVlanTpidMetricTag -func (obj *patternFlowVlanTpid) MetricTags() PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowVlanTpidMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter struct { - obj *patternFlowVlanTpid - patternFlowVlanTpidMetricTagSlice []PatternFlowVlanTpidMetricTag - fieldPtr *[]*otg.PatternFlowVlanTpidMetricTag -} - -func newPatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter(ptr *[]*otg.PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { - return &patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter interface { - setMsg(*patternFlowVlanTpid) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter - Items() []PatternFlowVlanTpidMetricTag - Add() PatternFlowVlanTpidMetricTag - Append(items ...PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter - Set(index int, newObj PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter - Clear() PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter - clearHolderSlice() PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter - appendHolderSlice(item PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter -} - -func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) setMsg(msg *patternFlowVlanTpid) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowVlanTpidMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) Items() []PatternFlowVlanTpidMetricTag { - return obj.patternFlowVlanTpidMetricTagSlice -} - -func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) Add() PatternFlowVlanTpidMetricTag { - newObj := &otg.PatternFlowVlanTpidMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowVlanTpidMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowVlanTpidMetricTagSlice = append(obj.patternFlowVlanTpidMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) Append(items ...PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowVlanTpidMetricTagSlice = append(obj.patternFlowVlanTpidMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) Set(index int, newObj PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowVlanTpidMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) Clear() PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowVlanTpidMetricTag{} - obj.patternFlowVlanTpidMetricTagSlice = []PatternFlowVlanTpidMetricTag{} - } - return obj -} -func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) clearHolderSlice() PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { - if len(obj.patternFlowVlanTpidMetricTagSlice) > 0 { - obj.patternFlowVlanTpidMetricTagSlice = []PatternFlowVlanTpidMetricTag{} - } - return obj -} -func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) appendHolderSlice(item PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { - obj.patternFlowVlanTpidMetricTagSlice = append(obj.patternFlowVlanTpidMetricTagSlice, item) - return obj -} - -func (obj *patternFlowVlanTpid) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanTpid.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowVlanTpid.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowVlanTpidMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowVlanTpid) setDefault() { - var choices_set int = 0 - var choice PatternFlowVlanTpidChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowVlanTpidChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowVlanTpidChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowVlanTpidChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowVlanTpidChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowVlanTpidChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVlanTpid") - } - } else { - intVal := otg.PatternFlowVlanTpid_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowVlanTpid_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowVxlanFlags ***** -type patternFlowVxlanFlags struct { - validation - obj *otg.PatternFlowVxlanFlags - marshaller marshalPatternFlowVxlanFlags - unMarshaller unMarshalPatternFlowVxlanFlags - incrementHolder PatternFlowVxlanFlagsCounter - decrementHolder PatternFlowVxlanFlagsCounter - metricTagsHolder PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter -} - -func NewPatternFlowVxlanFlags() PatternFlowVxlanFlags { - obj := patternFlowVxlanFlags{obj: &otg.PatternFlowVxlanFlags{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVxlanFlags) msg() *otg.PatternFlowVxlanFlags { - return obj.obj -} - -func (obj *patternFlowVxlanFlags) setMsg(msg *otg.PatternFlowVxlanFlags) PatternFlowVxlanFlags { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVxlanFlags struct { - obj *patternFlowVxlanFlags -} - -type marshalPatternFlowVxlanFlags interface { - // ToProto marshals PatternFlowVxlanFlags to protobuf object *otg.PatternFlowVxlanFlags - ToProto() (*otg.PatternFlowVxlanFlags, error) - // ToPbText marshals PatternFlowVxlanFlags to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVxlanFlags to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVxlanFlags to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVxlanFlags struct { - obj *patternFlowVxlanFlags -} - -type unMarshalPatternFlowVxlanFlags interface { - // FromProto unmarshals PatternFlowVxlanFlags from protobuf object *otg.PatternFlowVxlanFlags - FromProto(msg *otg.PatternFlowVxlanFlags) (PatternFlowVxlanFlags, error) - // FromPbText unmarshals PatternFlowVxlanFlags from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVxlanFlags from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVxlanFlags from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVxlanFlags) Marshal() marshalPatternFlowVxlanFlags { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVxlanFlags{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVxlanFlags) Unmarshal() unMarshalPatternFlowVxlanFlags { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVxlanFlags{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVxlanFlags) ToProto() (*otg.PatternFlowVxlanFlags, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVxlanFlags) FromProto(msg *otg.PatternFlowVxlanFlags) (PatternFlowVxlanFlags, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVxlanFlags) 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 *unMarshalpatternFlowVxlanFlags) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowVxlanFlags) 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 *unMarshalpatternFlowVxlanFlags) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowVxlanFlags) 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 *unMarshalpatternFlowVxlanFlags) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowVxlanFlags) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVxlanFlags) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVxlanFlags) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVxlanFlags) Clone() (PatternFlowVxlanFlags, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVxlanFlags() - 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 -} - -func (obj *patternFlowVxlanFlags) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowVxlanFlags is flags field with a bit format of RRRRIRRR. The I flag MUST be set to 1 for a valid vxlan network id (VNI). The other 7 bits (designated "R") are reserved fields and MUST be set to zero on transmission and ignored on receipt. -type PatternFlowVxlanFlags interface { - Validation - // msg marshals PatternFlowVxlanFlags to protobuf object *otg.PatternFlowVxlanFlags - // and doesn't set defaults - msg() *otg.PatternFlowVxlanFlags - // setMsg unmarshals PatternFlowVxlanFlags from protobuf object *otg.PatternFlowVxlanFlags - // and doesn't set defaults - setMsg(*otg.PatternFlowVxlanFlags) PatternFlowVxlanFlags - // provides marshal interface - Marshal() marshalPatternFlowVxlanFlags - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVxlanFlags - // validate validates PatternFlowVxlanFlags - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVxlanFlags, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowVxlanFlagsChoiceEnum, set in PatternFlowVxlanFlags - Choice() PatternFlowVxlanFlagsChoiceEnum - // setChoice assigns PatternFlowVxlanFlagsChoiceEnum provided by user to PatternFlowVxlanFlags - setChoice(value PatternFlowVxlanFlagsChoiceEnum) PatternFlowVxlanFlags - // HasChoice checks if Choice has been set in PatternFlowVxlanFlags - HasChoice() bool - // Value returns uint32, set in PatternFlowVxlanFlags. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowVxlanFlags - SetValue(value uint32) PatternFlowVxlanFlags - // HasValue checks if Value has been set in PatternFlowVxlanFlags - HasValue() bool - // Values returns []uint32, set in PatternFlowVxlanFlags. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowVxlanFlags - SetValues(value []uint32) PatternFlowVxlanFlags - // Increment returns PatternFlowVxlanFlagsCounter, set in PatternFlowVxlanFlags. - // PatternFlowVxlanFlagsCounter is integer counter pattern - Increment() PatternFlowVxlanFlagsCounter - // SetIncrement assigns PatternFlowVxlanFlagsCounter provided by user to PatternFlowVxlanFlags. - // PatternFlowVxlanFlagsCounter is integer counter pattern - SetIncrement(value PatternFlowVxlanFlagsCounter) PatternFlowVxlanFlags - // HasIncrement checks if Increment has been set in PatternFlowVxlanFlags - HasIncrement() bool - // Decrement returns PatternFlowVxlanFlagsCounter, set in PatternFlowVxlanFlags. - // PatternFlowVxlanFlagsCounter is integer counter pattern - Decrement() PatternFlowVxlanFlagsCounter - // SetDecrement assigns PatternFlowVxlanFlagsCounter provided by user to PatternFlowVxlanFlags. - // PatternFlowVxlanFlagsCounter is integer counter pattern - SetDecrement(value PatternFlowVxlanFlagsCounter) PatternFlowVxlanFlags - // HasDecrement checks if Decrement has been set in PatternFlowVxlanFlags - HasDecrement() bool - // MetricTags returns PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIterIter, set in PatternFlowVxlanFlags - MetricTags() PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter - setNil() -} - -type PatternFlowVxlanFlagsChoiceEnum string - -// Enum of Choice on PatternFlowVxlanFlags -var PatternFlowVxlanFlagsChoice = struct { - VALUE PatternFlowVxlanFlagsChoiceEnum - VALUES PatternFlowVxlanFlagsChoiceEnum - INCREMENT PatternFlowVxlanFlagsChoiceEnum - DECREMENT PatternFlowVxlanFlagsChoiceEnum -}{ - VALUE: PatternFlowVxlanFlagsChoiceEnum("value"), - VALUES: PatternFlowVxlanFlagsChoiceEnum("values"), - INCREMENT: PatternFlowVxlanFlagsChoiceEnum("increment"), - DECREMENT: PatternFlowVxlanFlagsChoiceEnum("decrement"), -} - -func (obj *patternFlowVxlanFlags) Choice() PatternFlowVxlanFlagsChoiceEnum { - return PatternFlowVxlanFlagsChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowVxlanFlags) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowVxlanFlags) setChoice(value PatternFlowVxlanFlagsChoiceEnum) PatternFlowVxlanFlags { - intValue, ok := otg.PatternFlowVxlanFlags_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowVxlanFlagsChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowVxlanFlags_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowVxlanFlagsChoice.VALUE { - defaultValue := uint32(8) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowVxlanFlagsChoice.VALUES { - defaultValue := []uint32{8} - obj.obj.Values = defaultValue - } - - if value == PatternFlowVxlanFlagsChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowVxlanFlagsCounter().msg() - } - - if value == PatternFlowVxlanFlagsChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowVxlanFlagsCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVxlanFlags) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowVxlanFlagsChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVxlanFlags) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowVxlanFlags object -func (obj *patternFlowVxlanFlags) SetValue(value uint32) PatternFlowVxlanFlags { - obj.setChoice(PatternFlowVxlanFlagsChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowVxlanFlags) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{8}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowVxlanFlags object -func (obj *patternFlowVxlanFlags) SetValues(value []uint32) PatternFlowVxlanFlags { - obj.setChoice(PatternFlowVxlanFlagsChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowVxlanFlagsCounter -func (obj *patternFlowVxlanFlags) Increment() PatternFlowVxlanFlagsCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowVxlanFlagsChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowVxlanFlagsCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowVxlanFlagsCounter -func (obj *patternFlowVxlanFlags) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowVxlanFlagsCounter value in the PatternFlowVxlanFlags object -func (obj *patternFlowVxlanFlags) SetIncrement(value PatternFlowVxlanFlagsCounter) PatternFlowVxlanFlags { - obj.setChoice(PatternFlowVxlanFlagsChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowVxlanFlagsCounter -func (obj *patternFlowVxlanFlags) Decrement() PatternFlowVxlanFlagsCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowVxlanFlagsChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowVxlanFlagsCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowVxlanFlagsCounter -func (obj *patternFlowVxlanFlags) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowVxlanFlagsCounter value in the PatternFlowVxlanFlags object -func (obj *patternFlowVxlanFlags) SetDecrement(value PatternFlowVxlanFlagsCounter) PatternFlowVxlanFlags { - obj.setChoice(PatternFlowVxlanFlagsChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowVxlanFlagsMetricTag -func (obj *patternFlowVxlanFlags) MetricTags() PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowVxlanFlagsMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter struct { - obj *patternFlowVxlanFlags - patternFlowVxlanFlagsMetricTagSlice []PatternFlowVxlanFlagsMetricTag - fieldPtr *[]*otg.PatternFlowVxlanFlagsMetricTag -} - -func newPatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter(ptr *[]*otg.PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { - return &patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter interface { - setMsg(*patternFlowVxlanFlags) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter - Items() []PatternFlowVxlanFlagsMetricTag - Add() PatternFlowVxlanFlagsMetricTag - Append(items ...PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter - Set(index int, newObj PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter - Clear() PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter - clearHolderSlice() PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter - appendHolderSlice(item PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter -} - -func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) setMsg(msg *patternFlowVxlanFlags) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowVxlanFlagsMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) Items() []PatternFlowVxlanFlagsMetricTag { - return obj.patternFlowVxlanFlagsMetricTagSlice -} - -func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) Add() PatternFlowVxlanFlagsMetricTag { - newObj := &otg.PatternFlowVxlanFlagsMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowVxlanFlagsMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowVxlanFlagsMetricTagSlice = append(obj.patternFlowVxlanFlagsMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) Append(items ...PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowVxlanFlagsMetricTagSlice = append(obj.patternFlowVxlanFlagsMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) Set(index int, newObj PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowVxlanFlagsMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) Clear() PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowVxlanFlagsMetricTag{} - obj.patternFlowVxlanFlagsMetricTagSlice = []PatternFlowVxlanFlagsMetricTag{} - } - return obj -} -func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) clearHolderSlice() PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { - if len(obj.patternFlowVxlanFlagsMetricTagSlice) > 0 { - obj.patternFlowVxlanFlagsMetricTagSlice = []PatternFlowVxlanFlagsMetricTag{} - } - return obj -} -func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) appendHolderSlice(item PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { - obj.patternFlowVxlanFlagsMetricTagSlice = append(obj.patternFlowVxlanFlagsMetricTagSlice, item) - return obj -} - -func (obj *patternFlowVxlanFlags) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanFlags.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowVxlanFlags.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowVxlanFlagsMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowVxlanFlags) setDefault() { - var choices_set int = 0 - var choice PatternFlowVxlanFlagsChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowVxlanFlagsChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowVxlanFlagsChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowVxlanFlagsChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowVxlanFlagsChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowVxlanFlagsChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVxlanFlags") - } - } else { - intVal := otg.PatternFlowVxlanFlags_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowVxlanFlags_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowVxlanReserved0 ***** -type patternFlowVxlanReserved0 struct { - validation - obj *otg.PatternFlowVxlanReserved0 - marshaller marshalPatternFlowVxlanReserved0 - unMarshaller unMarshalPatternFlowVxlanReserved0 - incrementHolder PatternFlowVxlanReserved0Counter - decrementHolder PatternFlowVxlanReserved0Counter - metricTagsHolder PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter -} - -func NewPatternFlowVxlanReserved0() PatternFlowVxlanReserved0 { - obj := patternFlowVxlanReserved0{obj: &otg.PatternFlowVxlanReserved0{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVxlanReserved0) msg() *otg.PatternFlowVxlanReserved0 { - return obj.obj -} - -func (obj *patternFlowVxlanReserved0) setMsg(msg *otg.PatternFlowVxlanReserved0) PatternFlowVxlanReserved0 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVxlanReserved0 struct { - obj *patternFlowVxlanReserved0 -} - -type marshalPatternFlowVxlanReserved0 interface { - // ToProto marshals PatternFlowVxlanReserved0 to protobuf object *otg.PatternFlowVxlanReserved0 - ToProto() (*otg.PatternFlowVxlanReserved0, error) - // ToPbText marshals PatternFlowVxlanReserved0 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVxlanReserved0 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVxlanReserved0 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVxlanReserved0 struct { - obj *patternFlowVxlanReserved0 -} - -type unMarshalPatternFlowVxlanReserved0 interface { - // FromProto unmarshals PatternFlowVxlanReserved0 from protobuf object *otg.PatternFlowVxlanReserved0 - FromProto(msg *otg.PatternFlowVxlanReserved0) (PatternFlowVxlanReserved0, error) - // FromPbText unmarshals PatternFlowVxlanReserved0 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVxlanReserved0 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVxlanReserved0 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVxlanReserved0) Marshal() marshalPatternFlowVxlanReserved0 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVxlanReserved0{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVxlanReserved0) Unmarshal() unMarshalPatternFlowVxlanReserved0 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVxlanReserved0{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVxlanReserved0) ToProto() (*otg.PatternFlowVxlanReserved0, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVxlanReserved0) FromProto(msg *otg.PatternFlowVxlanReserved0) (PatternFlowVxlanReserved0, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVxlanReserved0) 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 *unMarshalpatternFlowVxlanReserved0) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowVxlanReserved0) 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 *unMarshalpatternFlowVxlanReserved0) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowVxlanReserved0) 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 *unMarshalpatternFlowVxlanReserved0) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowVxlanReserved0) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVxlanReserved0) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVxlanReserved0) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVxlanReserved0) Clone() (PatternFlowVxlanReserved0, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVxlanReserved0() - 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 -} - -func (obj *patternFlowVxlanReserved0) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowVxlanReserved0 is reserved field -type PatternFlowVxlanReserved0 interface { - Validation - // msg marshals PatternFlowVxlanReserved0 to protobuf object *otg.PatternFlowVxlanReserved0 - // and doesn't set defaults - msg() *otg.PatternFlowVxlanReserved0 - // setMsg unmarshals PatternFlowVxlanReserved0 from protobuf object *otg.PatternFlowVxlanReserved0 - // and doesn't set defaults - setMsg(*otg.PatternFlowVxlanReserved0) PatternFlowVxlanReserved0 - // provides marshal interface - Marshal() marshalPatternFlowVxlanReserved0 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVxlanReserved0 - // validate validates PatternFlowVxlanReserved0 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVxlanReserved0, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowVxlanReserved0ChoiceEnum, set in PatternFlowVxlanReserved0 - Choice() PatternFlowVxlanReserved0ChoiceEnum - // setChoice assigns PatternFlowVxlanReserved0ChoiceEnum provided by user to PatternFlowVxlanReserved0 - setChoice(value PatternFlowVxlanReserved0ChoiceEnum) PatternFlowVxlanReserved0 - // HasChoice checks if Choice has been set in PatternFlowVxlanReserved0 - HasChoice() bool - // Value returns uint32, set in PatternFlowVxlanReserved0. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowVxlanReserved0 - SetValue(value uint32) PatternFlowVxlanReserved0 - // HasValue checks if Value has been set in PatternFlowVxlanReserved0 - HasValue() bool - // Values returns []uint32, set in PatternFlowVxlanReserved0. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowVxlanReserved0 - SetValues(value []uint32) PatternFlowVxlanReserved0 - // Increment returns PatternFlowVxlanReserved0Counter, set in PatternFlowVxlanReserved0. - // PatternFlowVxlanReserved0Counter is integer counter pattern - Increment() PatternFlowVxlanReserved0Counter - // SetIncrement assigns PatternFlowVxlanReserved0Counter provided by user to PatternFlowVxlanReserved0. - // PatternFlowVxlanReserved0Counter is integer counter pattern - SetIncrement(value PatternFlowVxlanReserved0Counter) PatternFlowVxlanReserved0 - // HasIncrement checks if Increment has been set in PatternFlowVxlanReserved0 - HasIncrement() bool - // Decrement returns PatternFlowVxlanReserved0Counter, set in PatternFlowVxlanReserved0. - // PatternFlowVxlanReserved0Counter is integer counter pattern - Decrement() PatternFlowVxlanReserved0Counter - // SetDecrement assigns PatternFlowVxlanReserved0Counter provided by user to PatternFlowVxlanReserved0. - // PatternFlowVxlanReserved0Counter is integer counter pattern - SetDecrement(value PatternFlowVxlanReserved0Counter) PatternFlowVxlanReserved0 - // HasDecrement checks if Decrement has been set in PatternFlowVxlanReserved0 - HasDecrement() bool - // MetricTags returns PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIterIter, set in PatternFlowVxlanReserved0 - MetricTags() PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter - setNil() -} - -type PatternFlowVxlanReserved0ChoiceEnum string - -// Enum of Choice on PatternFlowVxlanReserved0 -var PatternFlowVxlanReserved0Choice = struct { - VALUE PatternFlowVxlanReserved0ChoiceEnum - VALUES PatternFlowVxlanReserved0ChoiceEnum - INCREMENT PatternFlowVxlanReserved0ChoiceEnum - DECREMENT PatternFlowVxlanReserved0ChoiceEnum -}{ - VALUE: PatternFlowVxlanReserved0ChoiceEnum("value"), - VALUES: PatternFlowVxlanReserved0ChoiceEnum("values"), - INCREMENT: PatternFlowVxlanReserved0ChoiceEnum("increment"), - DECREMENT: PatternFlowVxlanReserved0ChoiceEnum("decrement"), -} - -func (obj *patternFlowVxlanReserved0) Choice() PatternFlowVxlanReserved0ChoiceEnum { - return PatternFlowVxlanReserved0ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowVxlanReserved0) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowVxlanReserved0) setChoice(value PatternFlowVxlanReserved0ChoiceEnum) PatternFlowVxlanReserved0 { - intValue, ok := otg.PatternFlowVxlanReserved0_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowVxlanReserved0ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowVxlanReserved0_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowVxlanReserved0Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowVxlanReserved0Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowVxlanReserved0Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowVxlanReserved0Counter().msg() - } - - if value == PatternFlowVxlanReserved0Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowVxlanReserved0Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVxlanReserved0) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowVxlanReserved0Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVxlanReserved0) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowVxlanReserved0 object -func (obj *patternFlowVxlanReserved0) SetValue(value uint32) PatternFlowVxlanReserved0 { - obj.setChoice(PatternFlowVxlanReserved0Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowVxlanReserved0) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowVxlanReserved0 object -func (obj *patternFlowVxlanReserved0) SetValues(value []uint32) PatternFlowVxlanReserved0 { - obj.setChoice(PatternFlowVxlanReserved0Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowVxlanReserved0Counter -func (obj *patternFlowVxlanReserved0) Increment() PatternFlowVxlanReserved0Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowVxlanReserved0Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowVxlanReserved0Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowVxlanReserved0Counter -func (obj *patternFlowVxlanReserved0) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowVxlanReserved0Counter value in the PatternFlowVxlanReserved0 object -func (obj *patternFlowVxlanReserved0) SetIncrement(value PatternFlowVxlanReserved0Counter) PatternFlowVxlanReserved0 { - obj.setChoice(PatternFlowVxlanReserved0Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowVxlanReserved0Counter -func (obj *patternFlowVxlanReserved0) Decrement() PatternFlowVxlanReserved0Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowVxlanReserved0Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowVxlanReserved0Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowVxlanReserved0Counter -func (obj *patternFlowVxlanReserved0) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowVxlanReserved0Counter value in the PatternFlowVxlanReserved0 object -func (obj *patternFlowVxlanReserved0) SetDecrement(value PatternFlowVxlanReserved0Counter) PatternFlowVxlanReserved0 { - obj.setChoice(PatternFlowVxlanReserved0Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowVxlanReserved0MetricTag -func (obj *patternFlowVxlanReserved0) MetricTags() PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowVxlanReserved0MetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter struct { - obj *patternFlowVxlanReserved0 - patternFlowVxlanReserved0MetricTagSlice []PatternFlowVxlanReserved0MetricTag - fieldPtr *[]*otg.PatternFlowVxlanReserved0MetricTag -} - -func newPatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter(ptr *[]*otg.PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { - return &patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter{fieldPtr: ptr} -} - -type PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter interface { - setMsg(*patternFlowVxlanReserved0) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter - Items() []PatternFlowVxlanReserved0MetricTag - Add() PatternFlowVxlanReserved0MetricTag - Append(items ...PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter - Set(index int, newObj PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter - Clear() PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter - clearHolderSlice() PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter - appendHolderSlice(item PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter -} - -func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) setMsg(msg *patternFlowVxlanReserved0) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowVxlanReserved0MetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) Items() []PatternFlowVxlanReserved0MetricTag { - return obj.patternFlowVxlanReserved0MetricTagSlice -} - -func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) Add() PatternFlowVxlanReserved0MetricTag { - newObj := &otg.PatternFlowVxlanReserved0MetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowVxlanReserved0MetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowVxlanReserved0MetricTagSlice = append(obj.patternFlowVxlanReserved0MetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) Append(items ...PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowVxlanReserved0MetricTagSlice = append(obj.patternFlowVxlanReserved0MetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) Set(index int, newObj PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowVxlanReserved0MetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) Clear() PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowVxlanReserved0MetricTag{} - obj.patternFlowVxlanReserved0MetricTagSlice = []PatternFlowVxlanReserved0MetricTag{} - } - return obj -} -func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) clearHolderSlice() PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { - if len(obj.patternFlowVxlanReserved0MetricTagSlice) > 0 { - obj.patternFlowVxlanReserved0MetricTagSlice = []PatternFlowVxlanReserved0MetricTag{} - } - return obj -} -func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) appendHolderSlice(item PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { - obj.patternFlowVxlanReserved0MetricTagSlice = append(obj.patternFlowVxlanReserved0MetricTagSlice, item) - return obj -} - -func (obj *patternFlowVxlanReserved0) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanReserved0.Value <= 16777215 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowVxlanReserved0.Values <= 16777215 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowVxlanReserved0MetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowVxlanReserved0) setDefault() { - var choices_set int = 0 - var choice PatternFlowVxlanReserved0ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowVxlanReserved0Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowVxlanReserved0Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowVxlanReserved0Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowVxlanReserved0Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowVxlanReserved0Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVxlanReserved0") - } - } else { - intVal := otg.PatternFlowVxlanReserved0_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowVxlanReserved0_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowVxlanVni ***** -type patternFlowVxlanVni struct { - validation - obj *otg.PatternFlowVxlanVni - marshaller marshalPatternFlowVxlanVni - unMarshaller unMarshalPatternFlowVxlanVni - incrementHolder PatternFlowVxlanVniCounter - decrementHolder PatternFlowVxlanVniCounter - metricTagsHolder PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter -} - -func NewPatternFlowVxlanVni() PatternFlowVxlanVni { - obj := patternFlowVxlanVni{obj: &otg.PatternFlowVxlanVni{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVxlanVni) msg() *otg.PatternFlowVxlanVni { - return obj.obj -} - -func (obj *patternFlowVxlanVni) setMsg(msg *otg.PatternFlowVxlanVni) PatternFlowVxlanVni { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVxlanVni struct { - obj *patternFlowVxlanVni -} - -type marshalPatternFlowVxlanVni interface { - // ToProto marshals PatternFlowVxlanVni to protobuf object *otg.PatternFlowVxlanVni - ToProto() (*otg.PatternFlowVxlanVni, error) - // ToPbText marshals PatternFlowVxlanVni to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVxlanVni to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVxlanVni to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVxlanVni struct { - obj *patternFlowVxlanVni -} - -type unMarshalPatternFlowVxlanVni interface { - // FromProto unmarshals PatternFlowVxlanVni from protobuf object *otg.PatternFlowVxlanVni - FromProto(msg *otg.PatternFlowVxlanVni) (PatternFlowVxlanVni, error) - // FromPbText unmarshals PatternFlowVxlanVni from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVxlanVni from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVxlanVni from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVxlanVni) Marshal() marshalPatternFlowVxlanVni { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVxlanVni{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVxlanVni) Unmarshal() unMarshalPatternFlowVxlanVni { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVxlanVni{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVxlanVni) ToProto() (*otg.PatternFlowVxlanVni, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVxlanVni) FromProto(msg *otg.PatternFlowVxlanVni) (PatternFlowVxlanVni, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVxlanVni) 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 *unMarshalpatternFlowVxlanVni) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowVxlanVni) 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 *unMarshalpatternFlowVxlanVni) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowVxlanVni) 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 *unMarshalpatternFlowVxlanVni) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowVxlanVni) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVxlanVni) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVxlanVni) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVxlanVni) Clone() (PatternFlowVxlanVni, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVxlanVni() - 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 -} - -func (obj *patternFlowVxlanVni) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowVxlanVni is vXLAN network id -type PatternFlowVxlanVni interface { - Validation - // msg marshals PatternFlowVxlanVni to protobuf object *otg.PatternFlowVxlanVni - // and doesn't set defaults - msg() *otg.PatternFlowVxlanVni - // setMsg unmarshals PatternFlowVxlanVni from protobuf object *otg.PatternFlowVxlanVni - // and doesn't set defaults - setMsg(*otg.PatternFlowVxlanVni) PatternFlowVxlanVni - // provides marshal interface - Marshal() marshalPatternFlowVxlanVni - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVxlanVni - // validate validates PatternFlowVxlanVni - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVxlanVni, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowVxlanVniChoiceEnum, set in PatternFlowVxlanVni - Choice() PatternFlowVxlanVniChoiceEnum - // setChoice assigns PatternFlowVxlanVniChoiceEnum provided by user to PatternFlowVxlanVni - setChoice(value PatternFlowVxlanVniChoiceEnum) PatternFlowVxlanVni - // HasChoice checks if Choice has been set in PatternFlowVxlanVni - HasChoice() bool - // Value returns uint32, set in PatternFlowVxlanVni. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowVxlanVni - SetValue(value uint32) PatternFlowVxlanVni - // HasValue checks if Value has been set in PatternFlowVxlanVni - HasValue() bool - // Values returns []uint32, set in PatternFlowVxlanVni. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowVxlanVni - SetValues(value []uint32) PatternFlowVxlanVni - // Auto returns uint32, set in PatternFlowVxlanVni. - Auto() uint32 - // HasAuto checks if Auto has been set in PatternFlowVxlanVni - HasAuto() bool - // Increment returns PatternFlowVxlanVniCounter, set in PatternFlowVxlanVni. - // PatternFlowVxlanVniCounter is integer counter pattern - Increment() PatternFlowVxlanVniCounter - // SetIncrement assigns PatternFlowVxlanVniCounter provided by user to PatternFlowVxlanVni. - // PatternFlowVxlanVniCounter is integer counter pattern - SetIncrement(value PatternFlowVxlanVniCounter) PatternFlowVxlanVni - // HasIncrement checks if Increment has been set in PatternFlowVxlanVni - HasIncrement() bool - // Decrement returns PatternFlowVxlanVniCounter, set in PatternFlowVxlanVni. - // PatternFlowVxlanVniCounter is integer counter pattern - Decrement() PatternFlowVxlanVniCounter - // SetDecrement assigns PatternFlowVxlanVniCounter provided by user to PatternFlowVxlanVni. - // PatternFlowVxlanVniCounter is integer counter pattern - SetDecrement(value PatternFlowVxlanVniCounter) PatternFlowVxlanVni - // HasDecrement checks if Decrement has been set in PatternFlowVxlanVni - HasDecrement() bool - // MetricTags returns PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIterIter, set in PatternFlowVxlanVni - MetricTags() PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter - setNil() -} - -type PatternFlowVxlanVniChoiceEnum string - -// Enum of Choice on PatternFlowVxlanVni -var PatternFlowVxlanVniChoice = struct { - VALUE PatternFlowVxlanVniChoiceEnum - VALUES PatternFlowVxlanVniChoiceEnum - AUTO PatternFlowVxlanVniChoiceEnum - INCREMENT PatternFlowVxlanVniChoiceEnum - DECREMENT PatternFlowVxlanVniChoiceEnum -}{ - VALUE: PatternFlowVxlanVniChoiceEnum("value"), - VALUES: PatternFlowVxlanVniChoiceEnum("values"), - AUTO: PatternFlowVxlanVniChoiceEnum("auto"), - INCREMENT: PatternFlowVxlanVniChoiceEnum("increment"), - DECREMENT: PatternFlowVxlanVniChoiceEnum("decrement"), -} - -func (obj *patternFlowVxlanVni) Choice() PatternFlowVxlanVniChoiceEnum { - return PatternFlowVxlanVniChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowVxlanVni) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowVxlanVni) setChoice(value PatternFlowVxlanVniChoiceEnum) PatternFlowVxlanVni { - intValue, ok := otg.PatternFlowVxlanVni_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowVxlanVniChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowVxlanVni_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Auto = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowVxlanVniChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowVxlanVniChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowVxlanVniChoice.AUTO { - defaultValue := uint32(0) - obj.obj.Auto = &defaultValue - } - - if value == PatternFlowVxlanVniChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowVxlanVniCounter().msg() - } - - if value == PatternFlowVxlanVniChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowVxlanVniCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVxlanVni) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowVxlanVniChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVxlanVni) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowVxlanVni object -func (obj *patternFlowVxlanVni) SetValue(value uint32) PatternFlowVxlanVni { - obj.setChoice(PatternFlowVxlanVniChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowVxlanVni) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowVxlanVni object -func (obj *patternFlowVxlanVni) SetValues(value []uint32) PatternFlowVxlanVni { - obj.setChoice(PatternFlowVxlanVniChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowVxlanVni) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(PatternFlowVxlanVniChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowVxlanVni) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Increment returns a PatternFlowVxlanVniCounter -func (obj *patternFlowVxlanVni) Increment() PatternFlowVxlanVniCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowVxlanVniChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowVxlanVniCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowVxlanVniCounter -func (obj *patternFlowVxlanVni) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowVxlanVniCounter value in the PatternFlowVxlanVni object -func (obj *patternFlowVxlanVni) SetIncrement(value PatternFlowVxlanVniCounter) PatternFlowVxlanVni { - obj.setChoice(PatternFlowVxlanVniChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowVxlanVniCounter -func (obj *patternFlowVxlanVni) Decrement() PatternFlowVxlanVniCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowVxlanVniChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowVxlanVniCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowVxlanVniCounter -func (obj *patternFlowVxlanVni) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowVxlanVniCounter value in the PatternFlowVxlanVni object -func (obj *patternFlowVxlanVni) SetDecrement(value PatternFlowVxlanVniCounter) PatternFlowVxlanVni { - obj.setChoice(PatternFlowVxlanVniChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowVxlanVniMetricTag -func (obj *patternFlowVxlanVni) MetricTags() PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowVxlanVniMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter struct { - obj *patternFlowVxlanVni - patternFlowVxlanVniMetricTagSlice []PatternFlowVxlanVniMetricTag - fieldPtr *[]*otg.PatternFlowVxlanVniMetricTag -} - -func newPatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter(ptr *[]*otg.PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { - return &patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter interface { - setMsg(*patternFlowVxlanVni) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter - Items() []PatternFlowVxlanVniMetricTag - Add() PatternFlowVxlanVniMetricTag - Append(items ...PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter - Set(index int, newObj PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter - Clear() PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter - clearHolderSlice() PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter - appendHolderSlice(item PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter -} - -func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) setMsg(msg *patternFlowVxlanVni) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowVxlanVniMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) Items() []PatternFlowVxlanVniMetricTag { - return obj.patternFlowVxlanVniMetricTagSlice -} - -func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) Add() PatternFlowVxlanVniMetricTag { - newObj := &otg.PatternFlowVxlanVniMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowVxlanVniMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowVxlanVniMetricTagSlice = append(obj.patternFlowVxlanVniMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) Append(items ...PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowVxlanVniMetricTagSlice = append(obj.patternFlowVxlanVniMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) Set(index int, newObj PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowVxlanVniMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) Clear() PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowVxlanVniMetricTag{} - obj.patternFlowVxlanVniMetricTagSlice = []PatternFlowVxlanVniMetricTag{} - } - return obj -} -func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) clearHolderSlice() PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { - if len(obj.patternFlowVxlanVniMetricTagSlice) > 0 { - obj.patternFlowVxlanVniMetricTagSlice = []PatternFlowVxlanVniMetricTag{} - } - return obj -} -func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) appendHolderSlice(item PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { - obj.patternFlowVxlanVniMetricTagSlice = append(obj.patternFlowVxlanVniMetricTagSlice, item) - return obj -} - -func (obj *patternFlowVxlanVni) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanVni.Value <= 16777215 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowVxlanVni.Values <= 16777215 but Got %d", item)) - } - - } - - } - - if obj.obj.Auto != nil { - - if *obj.obj.Auto > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanVni.Auto <= 16777215 but Got %d", *obj.obj.Auto)) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowVxlanVniMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowVxlanVni) setDefault() { - var choices_set int = 0 - var choice PatternFlowVxlanVniChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowVxlanVniChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowVxlanVniChoice.VALUES - } - - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowVxlanVniChoice.AUTO - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowVxlanVniChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowVxlanVniChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowVxlanVniChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVxlanVni") - } - } else { - intVal := otg.PatternFlowVxlanVni_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowVxlanVni_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowVxlanReserved1 ***** -type patternFlowVxlanReserved1 struct { - validation - obj *otg.PatternFlowVxlanReserved1 - marshaller marshalPatternFlowVxlanReserved1 - unMarshaller unMarshalPatternFlowVxlanReserved1 - incrementHolder PatternFlowVxlanReserved1Counter - decrementHolder PatternFlowVxlanReserved1Counter - metricTagsHolder PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter -} - -func NewPatternFlowVxlanReserved1() PatternFlowVxlanReserved1 { - obj := patternFlowVxlanReserved1{obj: &otg.PatternFlowVxlanReserved1{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVxlanReserved1) msg() *otg.PatternFlowVxlanReserved1 { - return obj.obj -} - -func (obj *patternFlowVxlanReserved1) setMsg(msg *otg.PatternFlowVxlanReserved1) PatternFlowVxlanReserved1 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVxlanReserved1 struct { - obj *patternFlowVxlanReserved1 -} - -type marshalPatternFlowVxlanReserved1 interface { - // ToProto marshals PatternFlowVxlanReserved1 to protobuf object *otg.PatternFlowVxlanReserved1 - ToProto() (*otg.PatternFlowVxlanReserved1, error) - // ToPbText marshals PatternFlowVxlanReserved1 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVxlanReserved1 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVxlanReserved1 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVxlanReserved1 struct { - obj *patternFlowVxlanReserved1 -} - -type unMarshalPatternFlowVxlanReserved1 interface { - // FromProto unmarshals PatternFlowVxlanReserved1 from protobuf object *otg.PatternFlowVxlanReserved1 - FromProto(msg *otg.PatternFlowVxlanReserved1) (PatternFlowVxlanReserved1, error) - // FromPbText unmarshals PatternFlowVxlanReserved1 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVxlanReserved1 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVxlanReserved1 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVxlanReserved1) Marshal() marshalPatternFlowVxlanReserved1 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVxlanReserved1{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVxlanReserved1) Unmarshal() unMarshalPatternFlowVxlanReserved1 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVxlanReserved1{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVxlanReserved1) ToProto() (*otg.PatternFlowVxlanReserved1, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVxlanReserved1) FromProto(msg *otg.PatternFlowVxlanReserved1) (PatternFlowVxlanReserved1, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVxlanReserved1) 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 *unMarshalpatternFlowVxlanReserved1) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowVxlanReserved1) 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 *unMarshalpatternFlowVxlanReserved1) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowVxlanReserved1) 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 *unMarshalpatternFlowVxlanReserved1) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowVxlanReserved1) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVxlanReserved1) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVxlanReserved1) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVxlanReserved1) Clone() (PatternFlowVxlanReserved1, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVxlanReserved1() - 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 -} - -func (obj *patternFlowVxlanReserved1) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowVxlanReserved1 is reserved field -type PatternFlowVxlanReserved1 interface { - Validation - // msg marshals PatternFlowVxlanReserved1 to protobuf object *otg.PatternFlowVxlanReserved1 - // and doesn't set defaults - msg() *otg.PatternFlowVxlanReserved1 - // setMsg unmarshals PatternFlowVxlanReserved1 from protobuf object *otg.PatternFlowVxlanReserved1 - // and doesn't set defaults - setMsg(*otg.PatternFlowVxlanReserved1) PatternFlowVxlanReserved1 - // provides marshal interface - Marshal() marshalPatternFlowVxlanReserved1 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVxlanReserved1 - // validate validates PatternFlowVxlanReserved1 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVxlanReserved1, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowVxlanReserved1ChoiceEnum, set in PatternFlowVxlanReserved1 - Choice() PatternFlowVxlanReserved1ChoiceEnum - // setChoice assigns PatternFlowVxlanReserved1ChoiceEnum provided by user to PatternFlowVxlanReserved1 - setChoice(value PatternFlowVxlanReserved1ChoiceEnum) PatternFlowVxlanReserved1 - // HasChoice checks if Choice has been set in PatternFlowVxlanReserved1 - HasChoice() bool - // Value returns uint32, set in PatternFlowVxlanReserved1. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowVxlanReserved1 - SetValue(value uint32) PatternFlowVxlanReserved1 - // HasValue checks if Value has been set in PatternFlowVxlanReserved1 - HasValue() bool - // Values returns []uint32, set in PatternFlowVxlanReserved1. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowVxlanReserved1 - SetValues(value []uint32) PatternFlowVxlanReserved1 - // Increment returns PatternFlowVxlanReserved1Counter, set in PatternFlowVxlanReserved1. - // PatternFlowVxlanReserved1Counter is integer counter pattern - Increment() PatternFlowVxlanReserved1Counter - // SetIncrement assigns PatternFlowVxlanReserved1Counter provided by user to PatternFlowVxlanReserved1. - // PatternFlowVxlanReserved1Counter is integer counter pattern - SetIncrement(value PatternFlowVxlanReserved1Counter) PatternFlowVxlanReserved1 - // HasIncrement checks if Increment has been set in PatternFlowVxlanReserved1 - HasIncrement() bool - // Decrement returns PatternFlowVxlanReserved1Counter, set in PatternFlowVxlanReserved1. - // PatternFlowVxlanReserved1Counter is integer counter pattern - Decrement() PatternFlowVxlanReserved1Counter - // SetDecrement assigns PatternFlowVxlanReserved1Counter provided by user to PatternFlowVxlanReserved1. - // PatternFlowVxlanReserved1Counter is integer counter pattern - SetDecrement(value PatternFlowVxlanReserved1Counter) PatternFlowVxlanReserved1 - // HasDecrement checks if Decrement has been set in PatternFlowVxlanReserved1 - HasDecrement() bool - // MetricTags returns PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIterIter, set in PatternFlowVxlanReserved1 - MetricTags() PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter - setNil() -} - -type PatternFlowVxlanReserved1ChoiceEnum string - -// Enum of Choice on PatternFlowVxlanReserved1 -var PatternFlowVxlanReserved1Choice = struct { - VALUE PatternFlowVxlanReserved1ChoiceEnum - VALUES PatternFlowVxlanReserved1ChoiceEnum - INCREMENT PatternFlowVxlanReserved1ChoiceEnum - DECREMENT PatternFlowVxlanReserved1ChoiceEnum -}{ - VALUE: PatternFlowVxlanReserved1ChoiceEnum("value"), - VALUES: PatternFlowVxlanReserved1ChoiceEnum("values"), - INCREMENT: PatternFlowVxlanReserved1ChoiceEnum("increment"), - DECREMENT: PatternFlowVxlanReserved1ChoiceEnum("decrement"), -} - -func (obj *patternFlowVxlanReserved1) Choice() PatternFlowVxlanReserved1ChoiceEnum { - return PatternFlowVxlanReserved1ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowVxlanReserved1) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowVxlanReserved1) setChoice(value PatternFlowVxlanReserved1ChoiceEnum) PatternFlowVxlanReserved1 { - intValue, ok := otg.PatternFlowVxlanReserved1_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowVxlanReserved1ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowVxlanReserved1_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowVxlanReserved1Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowVxlanReserved1Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowVxlanReserved1Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowVxlanReserved1Counter().msg() - } - - if value == PatternFlowVxlanReserved1Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowVxlanReserved1Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVxlanReserved1) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowVxlanReserved1Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowVxlanReserved1) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowVxlanReserved1 object -func (obj *patternFlowVxlanReserved1) SetValue(value uint32) PatternFlowVxlanReserved1 { - obj.setChoice(PatternFlowVxlanReserved1Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowVxlanReserved1) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowVxlanReserved1 object -func (obj *patternFlowVxlanReserved1) SetValues(value []uint32) PatternFlowVxlanReserved1 { - obj.setChoice(PatternFlowVxlanReserved1Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowVxlanReserved1Counter -func (obj *patternFlowVxlanReserved1) Increment() PatternFlowVxlanReserved1Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowVxlanReserved1Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowVxlanReserved1Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowVxlanReserved1Counter -func (obj *patternFlowVxlanReserved1) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowVxlanReserved1Counter value in the PatternFlowVxlanReserved1 object -func (obj *patternFlowVxlanReserved1) SetIncrement(value PatternFlowVxlanReserved1Counter) PatternFlowVxlanReserved1 { - obj.setChoice(PatternFlowVxlanReserved1Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowVxlanReserved1Counter -func (obj *patternFlowVxlanReserved1) Decrement() PatternFlowVxlanReserved1Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowVxlanReserved1Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowVxlanReserved1Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowVxlanReserved1Counter -func (obj *patternFlowVxlanReserved1) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowVxlanReserved1Counter value in the PatternFlowVxlanReserved1 object -func (obj *patternFlowVxlanReserved1) SetDecrement(value PatternFlowVxlanReserved1Counter) PatternFlowVxlanReserved1 { - obj.setChoice(PatternFlowVxlanReserved1Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowVxlanReserved1MetricTag -func (obj *patternFlowVxlanReserved1) MetricTags() PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowVxlanReserved1MetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter struct { - obj *patternFlowVxlanReserved1 - patternFlowVxlanReserved1MetricTagSlice []PatternFlowVxlanReserved1MetricTag - fieldPtr *[]*otg.PatternFlowVxlanReserved1MetricTag -} - -func newPatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter(ptr *[]*otg.PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { - return &patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter{fieldPtr: ptr} -} - -type PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter interface { - setMsg(*patternFlowVxlanReserved1) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter - Items() []PatternFlowVxlanReserved1MetricTag - Add() PatternFlowVxlanReserved1MetricTag - Append(items ...PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter - Set(index int, newObj PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter - Clear() PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter - clearHolderSlice() PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter - appendHolderSlice(item PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter -} - -func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) setMsg(msg *patternFlowVxlanReserved1) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowVxlanReserved1MetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) Items() []PatternFlowVxlanReserved1MetricTag { - return obj.patternFlowVxlanReserved1MetricTagSlice -} - -func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) Add() PatternFlowVxlanReserved1MetricTag { - newObj := &otg.PatternFlowVxlanReserved1MetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowVxlanReserved1MetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowVxlanReserved1MetricTagSlice = append(obj.patternFlowVxlanReserved1MetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) Append(items ...PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowVxlanReserved1MetricTagSlice = append(obj.patternFlowVxlanReserved1MetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) Set(index int, newObj PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowVxlanReserved1MetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) Clear() PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowVxlanReserved1MetricTag{} - obj.patternFlowVxlanReserved1MetricTagSlice = []PatternFlowVxlanReserved1MetricTag{} - } - return obj -} -func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) clearHolderSlice() PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { - if len(obj.patternFlowVxlanReserved1MetricTagSlice) > 0 { - obj.patternFlowVxlanReserved1MetricTagSlice = []PatternFlowVxlanReserved1MetricTag{} - } - return obj -} -func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) appendHolderSlice(item PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { - obj.patternFlowVxlanReserved1MetricTagSlice = append(obj.patternFlowVxlanReserved1MetricTagSlice, item) - return obj -} - -func (obj *patternFlowVxlanReserved1) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanReserved1.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowVxlanReserved1.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowVxlanReserved1MetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowVxlanReserved1) setDefault() { - var choices_set int = 0 - var choice PatternFlowVxlanReserved1ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowVxlanReserved1Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowVxlanReserved1Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowVxlanReserved1Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowVxlanReserved1Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowVxlanReserved1Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVxlanReserved1") - } - } else { - intVal := otg.PatternFlowVxlanReserved1_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowVxlanReserved1_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4Version ***** -type patternFlowIpv4Version struct { - validation - obj *otg.PatternFlowIpv4Version - marshaller marshalPatternFlowIpv4Version - unMarshaller unMarshalPatternFlowIpv4Version - incrementHolder PatternFlowIpv4VersionCounter - decrementHolder PatternFlowIpv4VersionCounter - metricTagsHolder PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter -} - -func NewPatternFlowIpv4Version() PatternFlowIpv4Version { - obj := patternFlowIpv4Version{obj: &otg.PatternFlowIpv4Version{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4Version) msg() *otg.PatternFlowIpv4Version { - return obj.obj -} - -func (obj *patternFlowIpv4Version) setMsg(msg *otg.PatternFlowIpv4Version) PatternFlowIpv4Version { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4Version struct { - obj *patternFlowIpv4Version -} - -type marshalPatternFlowIpv4Version interface { - // ToProto marshals PatternFlowIpv4Version to protobuf object *otg.PatternFlowIpv4Version - ToProto() (*otg.PatternFlowIpv4Version, error) - // ToPbText marshals PatternFlowIpv4Version to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4Version to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4Version to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4Version struct { - obj *patternFlowIpv4Version -} - -type unMarshalPatternFlowIpv4Version interface { - // FromProto unmarshals PatternFlowIpv4Version from protobuf object *otg.PatternFlowIpv4Version - FromProto(msg *otg.PatternFlowIpv4Version) (PatternFlowIpv4Version, error) - // FromPbText unmarshals PatternFlowIpv4Version from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4Version from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4Version from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4Version) Marshal() marshalPatternFlowIpv4Version { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4Version{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4Version) Unmarshal() unMarshalPatternFlowIpv4Version { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4Version{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4Version) ToProto() (*otg.PatternFlowIpv4Version, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4Version) FromProto(msg *otg.PatternFlowIpv4Version) (PatternFlowIpv4Version, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4Version) 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 *unMarshalpatternFlowIpv4Version) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4Version) 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 *unMarshalpatternFlowIpv4Version) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4Version) 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 *unMarshalpatternFlowIpv4Version) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4Version) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4Version) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4Version) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4Version) Clone() (PatternFlowIpv4Version, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4Version() - 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 -} - -func (obj *patternFlowIpv4Version) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4Version is version -type PatternFlowIpv4Version interface { - Validation - // msg marshals PatternFlowIpv4Version to protobuf object *otg.PatternFlowIpv4Version - // and doesn't set defaults - msg() *otg.PatternFlowIpv4Version - // setMsg unmarshals PatternFlowIpv4Version from protobuf object *otg.PatternFlowIpv4Version - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4Version) PatternFlowIpv4Version - // provides marshal interface - Marshal() marshalPatternFlowIpv4Version - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4Version - // validate validates PatternFlowIpv4Version - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4Version, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4VersionChoiceEnum, set in PatternFlowIpv4Version - Choice() PatternFlowIpv4VersionChoiceEnum - // setChoice assigns PatternFlowIpv4VersionChoiceEnum provided by user to PatternFlowIpv4Version - setChoice(value PatternFlowIpv4VersionChoiceEnum) PatternFlowIpv4Version - // HasChoice checks if Choice has been set in PatternFlowIpv4Version - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4Version. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4Version - SetValue(value uint32) PatternFlowIpv4Version - // HasValue checks if Value has been set in PatternFlowIpv4Version - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4Version. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4Version - SetValues(value []uint32) PatternFlowIpv4Version - // Increment returns PatternFlowIpv4VersionCounter, set in PatternFlowIpv4Version. - // PatternFlowIpv4VersionCounter is integer counter pattern - Increment() PatternFlowIpv4VersionCounter - // SetIncrement assigns PatternFlowIpv4VersionCounter provided by user to PatternFlowIpv4Version. - // PatternFlowIpv4VersionCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4VersionCounter) PatternFlowIpv4Version - // HasIncrement checks if Increment has been set in PatternFlowIpv4Version - HasIncrement() bool - // Decrement returns PatternFlowIpv4VersionCounter, set in PatternFlowIpv4Version. - // PatternFlowIpv4VersionCounter is integer counter pattern - Decrement() PatternFlowIpv4VersionCounter - // SetDecrement assigns PatternFlowIpv4VersionCounter provided by user to PatternFlowIpv4Version. - // PatternFlowIpv4VersionCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4VersionCounter) PatternFlowIpv4Version - // HasDecrement checks if Decrement has been set in PatternFlowIpv4Version - HasDecrement() bool - // MetricTags returns PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIterIter, set in PatternFlowIpv4Version - MetricTags() PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter - setNil() -} - -type PatternFlowIpv4VersionChoiceEnum string - -// Enum of Choice on PatternFlowIpv4Version -var PatternFlowIpv4VersionChoice = struct { - VALUE PatternFlowIpv4VersionChoiceEnum - VALUES PatternFlowIpv4VersionChoiceEnum - INCREMENT PatternFlowIpv4VersionChoiceEnum - DECREMENT PatternFlowIpv4VersionChoiceEnum -}{ - VALUE: PatternFlowIpv4VersionChoiceEnum("value"), - VALUES: PatternFlowIpv4VersionChoiceEnum("values"), - INCREMENT: PatternFlowIpv4VersionChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4VersionChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4Version) Choice() PatternFlowIpv4VersionChoiceEnum { - return PatternFlowIpv4VersionChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4Version) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4Version) setChoice(value PatternFlowIpv4VersionChoiceEnum) PatternFlowIpv4Version { - intValue, ok := otg.PatternFlowIpv4Version_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4VersionChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4Version_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4VersionChoice.VALUE { - defaultValue := uint32(4) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4VersionChoice.VALUES { - defaultValue := []uint32{4} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4VersionChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4VersionCounter().msg() - } - - if value == PatternFlowIpv4VersionChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4VersionCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4Version) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4VersionChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4Version) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4Version object -func (obj *patternFlowIpv4Version) SetValue(value uint32) PatternFlowIpv4Version { - obj.setChoice(PatternFlowIpv4VersionChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4Version) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{4}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4Version object -func (obj *patternFlowIpv4Version) SetValues(value []uint32) PatternFlowIpv4Version { - obj.setChoice(PatternFlowIpv4VersionChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4VersionCounter -func (obj *patternFlowIpv4Version) Increment() PatternFlowIpv4VersionCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4VersionChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4VersionCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4VersionCounter -func (obj *patternFlowIpv4Version) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4VersionCounter value in the PatternFlowIpv4Version object -func (obj *patternFlowIpv4Version) SetIncrement(value PatternFlowIpv4VersionCounter) PatternFlowIpv4Version { - obj.setChoice(PatternFlowIpv4VersionChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4VersionCounter -func (obj *patternFlowIpv4Version) Decrement() PatternFlowIpv4VersionCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4VersionChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4VersionCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4VersionCounter -func (obj *patternFlowIpv4Version) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4VersionCounter value in the PatternFlowIpv4Version object -func (obj *patternFlowIpv4Version) SetDecrement(value PatternFlowIpv4VersionCounter) PatternFlowIpv4Version { - obj.setChoice(PatternFlowIpv4VersionChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4VersionMetricTag -func (obj *patternFlowIpv4Version) MetricTags() PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4VersionMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter struct { - obj *patternFlowIpv4Version - patternFlowIpv4VersionMetricTagSlice []PatternFlowIpv4VersionMetricTag - fieldPtr *[]*otg.PatternFlowIpv4VersionMetricTag -} - -func newPatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter(ptr *[]*otg.PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { - return &patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter interface { - setMsg(*patternFlowIpv4Version) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter - Items() []PatternFlowIpv4VersionMetricTag - Add() PatternFlowIpv4VersionMetricTag - Append(items ...PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter - Set(index int, newObj PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter - Clear() PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter - clearHolderSlice() PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter - appendHolderSlice(item PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter -} - -func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) setMsg(msg *patternFlowIpv4Version) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4VersionMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) Items() []PatternFlowIpv4VersionMetricTag { - return obj.patternFlowIpv4VersionMetricTagSlice -} - -func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) Add() PatternFlowIpv4VersionMetricTag { - newObj := &otg.PatternFlowIpv4VersionMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4VersionMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4VersionMetricTagSlice = append(obj.patternFlowIpv4VersionMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) Append(items ...PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4VersionMetricTagSlice = append(obj.patternFlowIpv4VersionMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) Set(index int, newObj PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4VersionMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) Clear() PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4VersionMetricTag{} - obj.patternFlowIpv4VersionMetricTagSlice = []PatternFlowIpv4VersionMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) clearHolderSlice() PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { - if len(obj.patternFlowIpv4VersionMetricTagSlice) > 0 { - obj.patternFlowIpv4VersionMetricTagSlice = []PatternFlowIpv4VersionMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) appendHolderSlice(item PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { - obj.patternFlowIpv4VersionMetricTagSlice = append(obj.patternFlowIpv4VersionMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4Version) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4Version.Value <= 15 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4Version.Values <= 15 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4VersionMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4Version) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4VersionChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4VersionChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4VersionChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4VersionChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4VersionChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4VersionChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4Version") - } - } else { - intVal := otg.PatternFlowIpv4Version_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4Version_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4HeaderLength ***** -type patternFlowIpv4HeaderLength struct { - validation - obj *otg.PatternFlowIpv4HeaderLength - marshaller marshalPatternFlowIpv4HeaderLength - unMarshaller unMarshalPatternFlowIpv4HeaderLength - incrementHolder PatternFlowIpv4HeaderLengthCounter - decrementHolder PatternFlowIpv4HeaderLengthCounter - metricTagsHolder PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter -} - -func NewPatternFlowIpv4HeaderLength() PatternFlowIpv4HeaderLength { - obj := patternFlowIpv4HeaderLength{obj: &otg.PatternFlowIpv4HeaderLength{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4HeaderLength) msg() *otg.PatternFlowIpv4HeaderLength { - return obj.obj -} - -func (obj *patternFlowIpv4HeaderLength) setMsg(msg *otg.PatternFlowIpv4HeaderLength) PatternFlowIpv4HeaderLength { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4HeaderLength struct { - obj *patternFlowIpv4HeaderLength -} - -type marshalPatternFlowIpv4HeaderLength interface { - // ToProto marshals PatternFlowIpv4HeaderLength to protobuf object *otg.PatternFlowIpv4HeaderLength - ToProto() (*otg.PatternFlowIpv4HeaderLength, error) - // ToPbText marshals PatternFlowIpv4HeaderLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4HeaderLength to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4HeaderLength to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4HeaderLength struct { - obj *patternFlowIpv4HeaderLength -} - -type unMarshalPatternFlowIpv4HeaderLength interface { - // FromProto unmarshals PatternFlowIpv4HeaderLength from protobuf object *otg.PatternFlowIpv4HeaderLength - FromProto(msg *otg.PatternFlowIpv4HeaderLength) (PatternFlowIpv4HeaderLength, error) - // FromPbText unmarshals PatternFlowIpv4HeaderLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4HeaderLength from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4HeaderLength from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4HeaderLength) Marshal() marshalPatternFlowIpv4HeaderLength { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4HeaderLength{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4HeaderLength) Unmarshal() unMarshalPatternFlowIpv4HeaderLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4HeaderLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4HeaderLength) ToProto() (*otg.PatternFlowIpv4HeaderLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4HeaderLength) FromProto(msg *otg.PatternFlowIpv4HeaderLength) (PatternFlowIpv4HeaderLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4HeaderLength) 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 *unMarshalpatternFlowIpv4HeaderLength) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4HeaderLength) 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 *unMarshalpatternFlowIpv4HeaderLength) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4HeaderLength) 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 *unMarshalpatternFlowIpv4HeaderLength) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4HeaderLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4HeaderLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4HeaderLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4HeaderLength) Clone() (PatternFlowIpv4HeaderLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4HeaderLength() - 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 -} - -func (obj *patternFlowIpv4HeaderLength) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4HeaderLength is header length -type PatternFlowIpv4HeaderLength interface { - Validation - // msg marshals PatternFlowIpv4HeaderLength to protobuf object *otg.PatternFlowIpv4HeaderLength - // and doesn't set defaults - msg() *otg.PatternFlowIpv4HeaderLength - // setMsg unmarshals PatternFlowIpv4HeaderLength from protobuf object *otg.PatternFlowIpv4HeaderLength - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4HeaderLength) PatternFlowIpv4HeaderLength - // provides marshal interface - Marshal() marshalPatternFlowIpv4HeaderLength - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4HeaderLength - // validate validates PatternFlowIpv4HeaderLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4HeaderLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4HeaderLengthChoiceEnum, set in PatternFlowIpv4HeaderLength - Choice() PatternFlowIpv4HeaderLengthChoiceEnum - // setChoice assigns PatternFlowIpv4HeaderLengthChoiceEnum provided by user to PatternFlowIpv4HeaderLength - setChoice(value PatternFlowIpv4HeaderLengthChoiceEnum) PatternFlowIpv4HeaderLength - // HasChoice checks if Choice has been set in PatternFlowIpv4HeaderLength - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4HeaderLength. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4HeaderLength - SetValue(value uint32) PatternFlowIpv4HeaderLength - // HasValue checks if Value has been set in PatternFlowIpv4HeaderLength - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4HeaderLength. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4HeaderLength - SetValues(value []uint32) PatternFlowIpv4HeaderLength - // Auto returns uint32, set in PatternFlowIpv4HeaderLength. - Auto() uint32 - // HasAuto checks if Auto has been set in PatternFlowIpv4HeaderLength - HasAuto() bool - // Increment returns PatternFlowIpv4HeaderLengthCounter, set in PatternFlowIpv4HeaderLength. - // PatternFlowIpv4HeaderLengthCounter is integer counter pattern - Increment() PatternFlowIpv4HeaderLengthCounter - // SetIncrement assigns PatternFlowIpv4HeaderLengthCounter provided by user to PatternFlowIpv4HeaderLength. - // PatternFlowIpv4HeaderLengthCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4HeaderLengthCounter) PatternFlowIpv4HeaderLength - // HasIncrement checks if Increment has been set in PatternFlowIpv4HeaderLength - HasIncrement() bool - // Decrement returns PatternFlowIpv4HeaderLengthCounter, set in PatternFlowIpv4HeaderLength. - // PatternFlowIpv4HeaderLengthCounter is integer counter pattern - Decrement() PatternFlowIpv4HeaderLengthCounter - // SetDecrement assigns PatternFlowIpv4HeaderLengthCounter provided by user to PatternFlowIpv4HeaderLength. - // PatternFlowIpv4HeaderLengthCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4HeaderLengthCounter) PatternFlowIpv4HeaderLength - // HasDecrement checks if Decrement has been set in PatternFlowIpv4HeaderLength - HasDecrement() bool - // MetricTags returns PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIterIter, set in PatternFlowIpv4HeaderLength - MetricTags() PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter - setNil() -} - -type PatternFlowIpv4HeaderLengthChoiceEnum string - -// Enum of Choice on PatternFlowIpv4HeaderLength -var PatternFlowIpv4HeaderLengthChoice = struct { - VALUE PatternFlowIpv4HeaderLengthChoiceEnum - VALUES PatternFlowIpv4HeaderLengthChoiceEnum - AUTO PatternFlowIpv4HeaderLengthChoiceEnum - INCREMENT PatternFlowIpv4HeaderLengthChoiceEnum - DECREMENT PatternFlowIpv4HeaderLengthChoiceEnum -}{ - VALUE: PatternFlowIpv4HeaderLengthChoiceEnum("value"), - VALUES: PatternFlowIpv4HeaderLengthChoiceEnum("values"), - AUTO: PatternFlowIpv4HeaderLengthChoiceEnum("auto"), - INCREMENT: PatternFlowIpv4HeaderLengthChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4HeaderLengthChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4HeaderLength) Choice() PatternFlowIpv4HeaderLengthChoiceEnum { - return PatternFlowIpv4HeaderLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4HeaderLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4HeaderLength) setChoice(value PatternFlowIpv4HeaderLengthChoiceEnum) PatternFlowIpv4HeaderLength { - intValue, ok := otg.PatternFlowIpv4HeaderLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4HeaderLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4HeaderLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Auto = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4HeaderLengthChoice.VALUE { - defaultValue := uint32(5) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4HeaderLengthChoice.VALUES { - defaultValue := []uint32{5} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4HeaderLengthChoice.AUTO { - defaultValue := uint32(5) - obj.obj.Auto = &defaultValue - } - - if value == PatternFlowIpv4HeaderLengthChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4HeaderLengthCounter().msg() - } - - if value == PatternFlowIpv4HeaderLengthChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4HeaderLengthCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4HeaderLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4HeaderLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4HeaderLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4HeaderLength object -func (obj *patternFlowIpv4HeaderLength) SetValue(value uint32) PatternFlowIpv4HeaderLength { - obj.setChoice(PatternFlowIpv4HeaderLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4HeaderLength) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{5}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4HeaderLength object -func (obj *patternFlowIpv4HeaderLength) SetValues(value []uint32) PatternFlowIpv4HeaderLength { - obj.setChoice(PatternFlowIpv4HeaderLengthChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowIpv4HeaderLength) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(PatternFlowIpv4HeaderLengthChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowIpv4HeaderLength) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Increment returns a PatternFlowIpv4HeaderLengthCounter -func (obj *patternFlowIpv4HeaderLength) Increment() PatternFlowIpv4HeaderLengthCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4HeaderLengthChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4HeaderLengthCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4HeaderLengthCounter -func (obj *patternFlowIpv4HeaderLength) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4HeaderLengthCounter value in the PatternFlowIpv4HeaderLength object -func (obj *patternFlowIpv4HeaderLength) SetIncrement(value PatternFlowIpv4HeaderLengthCounter) PatternFlowIpv4HeaderLength { - obj.setChoice(PatternFlowIpv4HeaderLengthChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4HeaderLengthCounter -func (obj *patternFlowIpv4HeaderLength) Decrement() PatternFlowIpv4HeaderLengthCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4HeaderLengthChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4HeaderLengthCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4HeaderLengthCounter -func (obj *patternFlowIpv4HeaderLength) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4HeaderLengthCounter value in the PatternFlowIpv4HeaderLength object -func (obj *patternFlowIpv4HeaderLength) SetDecrement(value PatternFlowIpv4HeaderLengthCounter) PatternFlowIpv4HeaderLength { - obj.setChoice(PatternFlowIpv4HeaderLengthChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4HeaderLengthMetricTag -func (obj *patternFlowIpv4HeaderLength) MetricTags() PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4HeaderLengthMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter struct { - obj *patternFlowIpv4HeaderLength - patternFlowIpv4HeaderLengthMetricTagSlice []PatternFlowIpv4HeaderLengthMetricTag - fieldPtr *[]*otg.PatternFlowIpv4HeaderLengthMetricTag -} - -func newPatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter(ptr *[]*otg.PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { - return &patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter interface { - setMsg(*patternFlowIpv4HeaderLength) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter - Items() []PatternFlowIpv4HeaderLengthMetricTag - Add() PatternFlowIpv4HeaderLengthMetricTag - Append(items ...PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter - Set(index int, newObj PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter - Clear() PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter - clearHolderSlice() PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter - appendHolderSlice(item PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter -} - -func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) setMsg(msg *patternFlowIpv4HeaderLength) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4HeaderLengthMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) Items() []PatternFlowIpv4HeaderLengthMetricTag { - return obj.patternFlowIpv4HeaderLengthMetricTagSlice -} - -func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) Add() PatternFlowIpv4HeaderLengthMetricTag { - newObj := &otg.PatternFlowIpv4HeaderLengthMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4HeaderLengthMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4HeaderLengthMetricTagSlice = append(obj.patternFlowIpv4HeaderLengthMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) Append(items ...PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4HeaderLengthMetricTagSlice = append(obj.patternFlowIpv4HeaderLengthMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) Set(index int, newObj PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4HeaderLengthMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) Clear() PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4HeaderLengthMetricTag{} - obj.patternFlowIpv4HeaderLengthMetricTagSlice = []PatternFlowIpv4HeaderLengthMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) clearHolderSlice() PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { - if len(obj.patternFlowIpv4HeaderLengthMetricTagSlice) > 0 { - obj.patternFlowIpv4HeaderLengthMetricTagSlice = []PatternFlowIpv4HeaderLengthMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) appendHolderSlice(item PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { - obj.patternFlowIpv4HeaderLengthMetricTagSlice = append(obj.patternFlowIpv4HeaderLengthMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4HeaderLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4HeaderLength.Value <= 15 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4HeaderLength.Values <= 15 but Got %d", item)) - } - - } - - } - - if obj.obj.Auto != nil { - - if *obj.obj.Auto > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4HeaderLength.Auto <= 15 but Got %d", *obj.obj.Auto)) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4HeaderLengthMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4HeaderLength) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4HeaderLengthChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4HeaderLengthChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4HeaderLengthChoice.VALUES - } - - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowIpv4HeaderLengthChoice.AUTO - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4HeaderLengthChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4HeaderLengthChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4HeaderLengthChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4HeaderLength") - } - } else { - intVal := otg.PatternFlowIpv4HeaderLength_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4HeaderLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowIpv4Priority ***** -type flowIpv4Priority struct { - validation - obj *otg.FlowIpv4Priority - marshaller marshalFlowIpv4Priority - unMarshaller unMarshalFlowIpv4Priority - rawHolder PatternFlowIpv4PriorityRaw - tosHolder FlowIpv4Tos - dscpHolder FlowIpv4Dscp -} - -func NewFlowIpv4Priority() FlowIpv4Priority { - obj := flowIpv4Priority{obj: &otg.FlowIpv4Priority{}} - obj.setDefault() - return &obj -} - -func (obj *flowIpv4Priority) msg() *otg.FlowIpv4Priority { - return obj.obj -} - -func (obj *flowIpv4Priority) setMsg(msg *otg.FlowIpv4Priority) FlowIpv4Priority { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIpv4Priority struct { - obj *flowIpv4Priority -} - -type marshalFlowIpv4Priority interface { - // ToProto marshals FlowIpv4Priority to protobuf object *otg.FlowIpv4Priority - ToProto() (*otg.FlowIpv4Priority, error) - // ToPbText marshals FlowIpv4Priority to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIpv4Priority to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIpv4Priority to JSON text - ToJson() (string, error) -} - -type unMarshalflowIpv4Priority struct { - obj *flowIpv4Priority -} - -type unMarshalFlowIpv4Priority interface { - // FromProto unmarshals FlowIpv4Priority from protobuf object *otg.FlowIpv4Priority - FromProto(msg *otg.FlowIpv4Priority) (FlowIpv4Priority, error) - // FromPbText unmarshals FlowIpv4Priority from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIpv4Priority from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIpv4Priority from JSON text - FromJson(value string) error -} - -func (obj *flowIpv4Priority) Marshal() marshalFlowIpv4Priority { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIpv4Priority{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIpv4Priority) Unmarshal() unMarshalFlowIpv4Priority { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIpv4Priority{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIpv4Priority) ToProto() (*otg.FlowIpv4Priority, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIpv4Priority) FromProto(msg *otg.FlowIpv4Priority) (FlowIpv4Priority, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIpv4Priority) 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 *unMarshalflowIpv4Priority) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowIpv4Priority) 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 *unMarshalflowIpv4Priority) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowIpv4Priority) 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 *unMarshalflowIpv4Priority) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowIpv4Priority) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIpv4Priority) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIpv4Priority) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIpv4Priority) Clone() (FlowIpv4Priority, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIpv4Priority() - 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 -} - -func (obj *flowIpv4Priority) setNil() { - obj.rawHolder = nil - obj.tosHolder = nil - obj.dscpHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowIpv4Priority is a container for ipv4 raw, tos, dscp ip priorities. -type FlowIpv4Priority interface { - Validation - // msg marshals FlowIpv4Priority to protobuf object *otg.FlowIpv4Priority - // and doesn't set defaults - msg() *otg.FlowIpv4Priority - // setMsg unmarshals FlowIpv4Priority from protobuf object *otg.FlowIpv4Priority - // and doesn't set defaults - setMsg(*otg.FlowIpv4Priority) FlowIpv4Priority - // provides marshal interface - Marshal() marshalFlowIpv4Priority - // provides unmarshal interface - Unmarshal() unMarshalFlowIpv4Priority - // validate validates FlowIpv4Priority - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIpv4Priority, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowIpv4PriorityChoiceEnum, set in FlowIpv4Priority - Choice() FlowIpv4PriorityChoiceEnum - // setChoice assigns FlowIpv4PriorityChoiceEnum provided by user to FlowIpv4Priority - setChoice(value FlowIpv4PriorityChoiceEnum) FlowIpv4Priority - // HasChoice checks if Choice has been set in FlowIpv4Priority - HasChoice() bool - // Raw returns PatternFlowIpv4PriorityRaw, set in FlowIpv4Priority. - // PatternFlowIpv4PriorityRaw is raw priority - Raw() PatternFlowIpv4PriorityRaw - // SetRaw assigns PatternFlowIpv4PriorityRaw provided by user to FlowIpv4Priority. - // PatternFlowIpv4PriorityRaw is raw priority - SetRaw(value PatternFlowIpv4PriorityRaw) FlowIpv4Priority - // HasRaw checks if Raw has been set in FlowIpv4Priority - HasRaw() bool - // Tos returns FlowIpv4Tos, set in FlowIpv4Priority. - // FlowIpv4Tos is type of service (TOS) packet field. - Tos() FlowIpv4Tos - // SetTos assigns FlowIpv4Tos provided by user to FlowIpv4Priority. - // FlowIpv4Tos is type of service (TOS) packet field. - SetTos(value FlowIpv4Tos) FlowIpv4Priority - // HasTos checks if Tos has been set in FlowIpv4Priority - HasTos() bool - // Dscp returns FlowIpv4Dscp, set in FlowIpv4Priority. - // FlowIpv4Dscp is differentiated services code point (DSCP) packet field. - Dscp() FlowIpv4Dscp - // SetDscp assigns FlowIpv4Dscp provided by user to FlowIpv4Priority. - // FlowIpv4Dscp is differentiated services code point (DSCP) packet field. - SetDscp(value FlowIpv4Dscp) FlowIpv4Priority - // HasDscp checks if Dscp has been set in FlowIpv4Priority - HasDscp() bool - setNil() -} - -type FlowIpv4PriorityChoiceEnum string - -// Enum of Choice on FlowIpv4Priority -var FlowIpv4PriorityChoice = struct { - RAW FlowIpv4PriorityChoiceEnum - TOS FlowIpv4PriorityChoiceEnum - DSCP FlowIpv4PriorityChoiceEnum -}{ - RAW: FlowIpv4PriorityChoiceEnum("raw"), - TOS: FlowIpv4PriorityChoiceEnum("tos"), - DSCP: FlowIpv4PriorityChoiceEnum("dscp"), -} - -func (obj *flowIpv4Priority) Choice() FlowIpv4PriorityChoiceEnum { - return FlowIpv4PriorityChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowIpv4Priority) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowIpv4Priority) setChoice(value FlowIpv4PriorityChoiceEnum) FlowIpv4Priority { - intValue, ok := otg.FlowIpv4Priority_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowIpv4PriorityChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowIpv4Priority_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Dscp = nil - obj.dscpHolder = nil - obj.obj.Tos = nil - obj.tosHolder = nil - obj.obj.Raw = nil - obj.rawHolder = nil - - if value == FlowIpv4PriorityChoice.RAW { - obj.obj.Raw = NewPatternFlowIpv4PriorityRaw().msg() - } - - if value == FlowIpv4PriorityChoice.TOS { - obj.obj.Tos = NewFlowIpv4Tos().msg() - } - - if value == FlowIpv4PriorityChoice.DSCP { - obj.obj.Dscp = NewFlowIpv4Dscp().msg() - } - - return obj -} - -// description is TBD -// Raw returns a PatternFlowIpv4PriorityRaw -func (obj *flowIpv4Priority) Raw() PatternFlowIpv4PriorityRaw { - if obj.obj.Raw == nil { - obj.setChoice(FlowIpv4PriorityChoice.RAW) - } - if obj.rawHolder == nil { - obj.rawHolder = &patternFlowIpv4PriorityRaw{obj: obj.obj.Raw} - } - return obj.rawHolder -} - -// description is TBD -// Raw returns a PatternFlowIpv4PriorityRaw -func (obj *flowIpv4Priority) HasRaw() bool { - return obj.obj.Raw != nil -} - -// description is TBD -// SetRaw sets the PatternFlowIpv4PriorityRaw value in the FlowIpv4Priority object -func (obj *flowIpv4Priority) SetRaw(value PatternFlowIpv4PriorityRaw) FlowIpv4Priority { - obj.setChoice(FlowIpv4PriorityChoice.RAW) - obj.rawHolder = nil - obj.obj.Raw = value.msg() - - return obj -} - -// description is TBD -// Tos returns a FlowIpv4Tos -func (obj *flowIpv4Priority) Tos() FlowIpv4Tos { - if obj.obj.Tos == nil { - obj.setChoice(FlowIpv4PriorityChoice.TOS) - } - if obj.tosHolder == nil { - obj.tosHolder = &flowIpv4Tos{obj: obj.obj.Tos} - } - return obj.tosHolder -} - -// description is TBD -// Tos returns a FlowIpv4Tos -func (obj *flowIpv4Priority) HasTos() bool { - return obj.obj.Tos != nil -} - -// description is TBD -// SetTos sets the FlowIpv4Tos value in the FlowIpv4Priority object -func (obj *flowIpv4Priority) SetTos(value FlowIpv4Tos) FlowIpv4Priority { - obj.setChoice(FlowIpv4PriorityChoice.TOS) - obj.tosHolder = nil - obj.obj.Tos = value.msg() - - return obj -} - -// description is TBD -// Dscp returns a FlowIpv4Dscp -func (obj *flowIpv4Priority) Dscp() FlowIpv4Dscp { - if obj.obj.Dscp == nil { - obj.setChoice(FlowIpv4PriorityChoice.DSCP) - } - if obj.dscpHolder == nil { - obj.dscpHolder = &flowIpv4Dscp{obj: obj.obj.Dscp} - } - return obj.dscpHolder -} - -// description is TBD -// Dscp returns a FlowIpv4Dscp -func (obj *flowIpv4Priority) HasDscp() bool { - return obj.obj.Dscp != nil -} - -// description is TBD -// SetDscp sets the FlowIpv4Dscp value in the FlowIpv4Priority object -func (obj *flowIpv4Priority) SetDscp(value FlowIpv4Dscp) FlowIpv4Priority { - obj.setChoice(FlowIpv4PriorityChoice.DSCP) - obj.dscpHolder = nil - obj.obj.Dscp = value.msg() - - return obj -} - -func (obj *flowIpv4Priority) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Raw != nil { - - obj.Raw().validateObj(vObj, set_default) - } - - if obj.obj.Tos != nil { - - obj.Tos().validateObj(vObj, set_default) - } - - if obj.obj.Dscp != nil { - - obj.Dscp().validateObj(vObj, set_default) - } - -} - -func (obj *flowIpv4Priority) setDefault() { - var choices_set int = 0 - var choice FlowIpv4PriorityChoiceEnum - - if obj.obj.Raw != nil { - choices_set += 1 - choice = FlowIpv4PriorityChoice.RAW - } - - if obj.obj.Tos != nil { - choices_set += 1 - choice = FlowIpv4PriorityChoice.TOS - } - - if obj.obj.Dscp != nil { - choices_set += 1 - choice = FlowIpv4PriorityChoice.DSCP - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowIpv4PriorityChoice.DSCP) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowIpv4Priority") - } - } else { - intVal := otg.FlowIpv4Priority_Choice_Enum_value[string(choice)] - enumValue := otg.FlowIpv4Priority_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4TotalLength ***** -type patternFlowIpv4TotalLength struct { - validation - obj *otg.PatternFlowIpv4TotalLength - marshaller marshalPatternFlowIpv4TotalLength - unMarshaller unMarshalPatternFlowIpv4TotalLength - incrementHolder PatternFlowIpv4TotalLengthCounter - decrementHolder PatternFlowIpv4TotalLengthCounter - metricTagsHolder PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter -} - -func NewPatternFlowIpv4TotalLength() PatternFlowIpv4TotalLength { - obj := patternFlowIpv4TotalLength{obj: &otg.PatternFlowIpv4TotalLength{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TotalLength) msg() *otg.PatternFlowIpv4TotalLength { - return obj.obj -} - -func (obj *patternFlowIpv4TotalLength) setMsg(msg *otg.PatternFlowIpv4TotalLength) PatternFlowIpv4TotalLength { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TotalLength struct { - obj *patternFlowIpv4TotalLength -} - -type marshalPatternFlowIpv4TotalLength interface { - // ToProto marshals PatternFlowIpv4TotalLength to protobuf object *otg.PatternFlowIpv4TotalLength - ToProto() (*otg.PatternFlowIpv4TotalLength, error) - // ToPbText marshals PatternFlowIpv4TotalLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TotalLength to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TotalLength to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TotalLength struct { - obj *patternFlowIpv4TotalLength -} - -type unMarshalPatternFlowIpv4TotalLength interface { - // FromProto unmarshals PatternFlowIpv4TotalLength from protobuf object *otg.PatternFlowIpv4TotalLength - FromProto(msg *otg.PatternFlowIpv4TotalLength) (PatternFlowIpv4TotalLength, error) - // FromPbText unmarshals PatternFlowIpv4TotalLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TotalLength from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TotalLength from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TotalLength) Marshal() marshalPatternFlowIpv4TotalLength { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TotalLength{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TotalLength) Unmarshal() unMarshalPatternFlowIpv4TotalLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TotalLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TotalLength) ToProto() (*otg.PatternFlowIpv4TotalLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TotalLength) FromProto(msg *otg.PatternFlowIpv4TotalLength) (PatternFlowIpv4TotalLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TotalLength) 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 *unMarshalpatternFlowIpv4TotalLength) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4TotalLength) 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 *unMarshalpatternFlowIpv4TotalLength) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4TotalLength) 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 *unMarshalpatternFlowIpv4TotalLength) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4TotalLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TotalLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TotalLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TotalLength) Clone() (PatternFlowIpv4TotalLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TotalLength() - 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 -} - -func (obj *patternFlowIpv4TotalLength) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4TotalLength is total length -type PatternFlowIpv4TotalLength interface { - Validation - // msg marshals PatternFlowIpv4TotalLength to protobuf object *otg.PatternFlowIpv4TotalLength - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TotalLength - // setMsg unmarshals PatternFlowIpv4TotalLength from protobuf object *otg.PatternFlowIpv4TotalLength - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TotalLength) PatternFlowIpv4TotalLength - // provides marshal interface - Marshal() marshalPatternFlowIpv4TotalLength - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TotalLength - // validate validates PatternFlowIpv4TotalLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TotalLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4TotalLengthChoiceEnum, set in PatternFlowIpv4TotalLength - Choice() PatternFlowIpv4TotalLengthChoiceEnum - // setChoice assigns PatternFlowIpv4TotalLengthChoiceEnum provided by user to PatternFlowIpv4TotalLength - setChoice(value PatternFlowIpv4TotalLengthChoiceEnum) PatternFlowIpv4TotalLength - // HasChoice checks if Choice has been set in PatternFlowIpv4TotalLength - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4TotalLength. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4TotalLength - SetValue(value uint32) PatternFlowIpv4TotalLength - // HasValue checks if Value has been set in PatternFlowIpv4TotalLength - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4TotalLength. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4TotalLength - SetValues(value []uint32) PatternFlowIpv4TotalLength - // Auto returns uint32, set in PatternFlowIpv4TotalLength. - Auto() uint32 - // HasAuto checks if Auto has been set in PatternFlowIpv4TotalLength - HasAuto() bool - // Increment returns PatternFlowIpv4TotalLengthCounter, set in PatternFlowIpv4TotalLength. - // PatternFlowIpv4TotalLengthCounter is integer counter pattern - Increment() PatternFlowIpv4TotalLengthCounter - // SetIncrement assigns PatternFlowIpv4TotalLengthCounter provided by user to PatternFlowIpv4TotalLength. - // PatternFlowIpv4TotalLengthCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4TotalLengthCounter) PatternFlowIpv4TotalLength - // HasIncrement checks if Increment has been set in PatternFlowIpv4TotalLength - HasIncrement() bool - // Decrement returns PatternFlowIpv4TotalLengthCounter, set in PatternFlowIpv4TotalLength. - // PatternFlowIpv4TotalLengthCounter is integer counter pattern - Decrement() PatternFlowIpv4TotalLengthCounter - // SetDecrement assigns PatternFlowIpv4TotalLengthCounter provided by user to PatternFlowIpv4TotalLength. - // PatternFlowIpv4TotalLengthCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4TotalLengthCounter) PatternFlowIpv4TotalLength - // HasDecrement checks if Decrement has been set in PatternFlowIpv4TotalLength - HasDecrement() bool - // MetricTags returns PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIterIter, set in PatternFlowIpv4TotalLength - MetricTags() PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter - setNil() -} - -type PatternFlowIpv4TotalLengthChoiceEnum string - -// Enum of Choice on PatternFlowIpv4TotalLength -var PatternFlowIpv4TotalLengthChoice = struct { - VALUE PatternFlowIpv4TotalLengthChoiceEnum - VALUES PatternFlowIpv4TotalLengthChoiceEnum - AUTO PatternFlowIpv4TotalLengthChoiceEnum - INCREMENT PatternFlowIpv4TotalLengthChoiceEnum - DECREMENT PatternFlowIpv4TotalLengthChoiceEnum -}{ - VALUE: PatternFlowIpv4TotalLengthChoiceEnum("value"), - VALUES: PatternFlowIpv4TotalLengthChoiceEnum("values"), - AUTO: PatternFlowIpv4TotalLengthChoiceEnum("auto"), - INCREMENT: PatternFlowIpv4TotalLengthChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4TotalLengthChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4TotalLength) Choice() PatternFlowIpv4TotalLengthChoiceEnum { - return PatternFlowIpv4TotalLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4TotalLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4TotalLength) setChoice(value PatternFlowIpv4TotalLengthChoiceEnum) PatternFlowIpv4TotalLength { - intValue, ok := otg.PatternFlowIpv4TotalLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4TotalLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4TotalLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Auto = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4TotalLengthChoice.VALUE { - defaultValue := uint32(46) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4TotalLengthChoice.VALUES { - defaultValue := []uint32{46} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4TotalLengthChoice.AUTO { - defaultValue := uint32(46) - obj.obj.Auto = &defaultValue - } - - if value == PatternFlowIpv4TotalLengthChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4TotalLengthCounter().msg() - } - - if value == PatternFlowIpv4TotalLengthChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4TotalLengthCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TotalLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4TotalLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TotalLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4TotalLength object -func (obj *patternFlowIpv4TotalLength) SetValue(value uint32) PatternFlowIpv4TotalLength { - obj.setChoice(PatternFlowIpv4TotalLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4TotalLength) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{46}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4TotalLength object -func (obj *patternFlowIpv4TotalLength) SetValues(value []uint32) PatternFlowIpv4TotalLength { - obj.setChoice(PatternFlowIpv4TotalLengthChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowIpv4TotalLength) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(PatternFlowIpv4TotalLengthChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowIpv4TotalLength) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Increment returns a PatternFlowIpv4TotalLengthCounter -func (obj *patternFlowIpv4TotalLength) Increment() PatternFlowIpv4TotalLengthCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4TotalLengthChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4TotalLengthCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4TotalLengthCounter -func (obj *patternFlowIpv4TotalLength) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4TotalLengthCounter value in the PatternFlowIpv4TotalLength object -func (obj *patternFlowIpv4TotalLength) SetIncrement(value PatternFlowIpv4TotalLengthCounter) PatternFlowIpv4TotalLength { - obj.setChoice(PatternFlowIpv4TotalLengthChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TotalLengthCounter -func (obj *patternFlowIpv4TotalLength) Decrement() PatternFlowIpv4TotalLengthCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4TotalLengthChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4TotalLengthCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TotalLengthCounter -func (obj *patternFlowIpv4TotalLength) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4TotalLengthCounter value in the PatternFlowIpv4TotalLength object -func (obj *patternFlowIpv4TotalLength) SetDecrement(value PatternFlowIpv4TotalLengthCounter) PatternFlowIpv4TotalLength { - obj.setChoice(PatternFlowIpv4TotalLengthChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4TotalLengthMetricTag -func (obj *patternFlowIpv4TotalLength) MetricTags() PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4TotalLengthMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter struct { - obj *patternFlowIpv4TotalLength - patternFlowIpv4TotalLengthMetricTagSlice []PatternFlowIpv4TotalLengthMetricTag - fieldPtr *[]*otg.PatternFlowIpv4TotalLengthMetricTag -} - -func newPatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter(ptr *[]*otg.PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { - return &patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter interface { - setMsg(*patternFlowIpv4TotalLength) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter - Items() []PatternFlowIpv4TotalLengthMetricTag - Add() PatternFlowIpv4TotalLengthMetricTag - Append(items ...PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter - Set(index int, newObj PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter - Clear() PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter - clearHolderSlice() PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter - appendHolderSlice(item PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter -} - -func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) setMsg(msg *patternFlowIpv4TotalLength) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4TotalLengthMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) Items() []PatternFlowIpv4TotalLengthMetricTag { - return obj.patternFlowIpv4TotalLengthMetricTagSlice -} - -func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) Add() PatternFlowIpv4TotalLengthMetricTag { - newObj := &otg.PatternFlowIpv4TotalLengthMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4TotalLengthMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4TotalLengthMetricTagSlice = append(obj.patternFlowIpv4TotalLengthMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) Append(items ...PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4TotalLengthMetricTagSlice = append(obj.patternFlowIpv4TotalLengthMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) Set(index int, newObj PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4TotalLengthMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) Clear() PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4TotalLengthMetricTag{} - obj.patternFlowIpv4TotalLengthMetricTagSlice = []PatternFlowIpv4TotalLengthMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) clearHolderSlice() PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { - if len(obj.patternFlowIpv4TotalLengthMetricTagSlice) > 0 { - obj.patternFlowIpv4TotalLengthMetricTagSlice = []PatternFlowIpv4TotalLengthMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) appendHolderSlice(item PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { - obj.patternFlowIpv4TotalLengthMetricTagSlice = append(obj.patternFlowIpv4TotalLengthMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4TotalLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TotalLength.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4TotalLength.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Auto != nil { - - if *obj.obj.Auto > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TotalLength.Auto <= 65535 but Got %d", *obj.obj.Auto)) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4TotalLengthMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4TotalLength) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4TotalLengthChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4TotalLengthChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4TotalLengthChoice.VALUES - } - - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowIpv4TotalLengthChoice.AUTO - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4TotalLengthChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4TotalLengthChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4TotalLengthChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TotalLength") - } - } else { - intVal := otg.PatternFlowIpv4TotalLength_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4TotalLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4Identification ***** -type patternFlowIpv4Identification struct { - validation - obj *otg.PatternFlowIpv4Identification - marshaller marshalPatternFlowIpv4Identification - unMarshaller unMarshalPatternFlowIpv4Identification - incrementHolder PatternFlowIpv4IdentificationCounter - decrementHolder PatternFlowIpv4IdentificationCounter - metricTagsHolder PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter -} - -func NewPatternFlowIpv4Identification() PatternFlowIpv4Identification { - obj := patternFlowIpv4Identification{obj: &otg.PatternFlowIpv4Identification{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4Identification) msg() *otg.PatternFlowIpv4Identification { - return obj.obj -} - -func (obj *patternFlowIpv4Identification) setMsg(msg *otg.PatternFlowIpv4Identification) PatternFlowIpv4Identification { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4Identification struct { - obj *patternFlowIpv4Identification -} - -type marshalPatternFlowIpv4Identification interface { - // ToProto marshals PatternFlowIpv4Identification to protobuf object *otg.PatternFlowIpv4Identification - ToProto() (*otg.PatternFlowIpv4Identification, error) - // ToPbText marshals PatternFlowIpv4Identification to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4Identification to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4Identification to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4Identification struct { - obj *patternFlowIpv4Identification -} - -type unMarshalPatternFlowIpv4Identification interface { - // FromProto unmarshals PatternFlowIpv4Identification from protobuf object *otg.PatternFlowIpv4Identification - FromProto(msg *otg.PatternFlowIpv4Identification) (PatternFlowIpv4Identification, error) - // FromPbText unmarshals PatternFlowIpv4Identification from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4Identification from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4Identification from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4Identification) Marshal() marshalPatternFlowIpv4Identification { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4Identification{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4Identification) Unmarshal() unMarshalPatternFlowIpv4Identification { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4Identification{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4Identification) ToProto() (*otg.PatternFlowIpv4Identification, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4Identification) FromProto(msg *otg.PatternFlowIpv4Identification) (PatternFlowIpv4Identification, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4Identification) 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 *unMarshalpatternFlowIpv4Identification) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4Identification) 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 *unMarshalpatternFlowIpv4Identification) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4Identification) 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 *unMarshalpatternFlowIpv4Identification) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4Identification) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4Identification) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4Identification) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4Identification) Clone() (PatternFlowIpv4Identification, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4Identification() - 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 -} - -func (obj *patternFlowIpv4Identification) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4Identification is identification -type PatternFlowIpv4Identification interface { - Validation - // msg marshals PatternFlowIpv4Identification to protobuf object *otg.PatternFlowIpv4Identification - // and doesn't set defaults - msg() *otg.PatternFlowIpv4Identification - // setMsg unmarshals PatternFlowIpv4Identification from protobuf object *otg.PatternFlowIpv4Identification - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4Identification) PatternFlowIpv4Identification - // provides marshal interface - Marshal() marshalPatternFlowIpv4Identification - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4Identification - // validate validates PatternFlowIpv4Identification - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4Identification, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4IdentificationChoiceEnum, set in PatternFlowIpv4Identification - Choice() PatternFlowIpv4IdentificationChoiceEnum - // setChoice assigns PatternFlowIpv4IdentificationChoiceEnum provided by user to PatternFlowIpv4Identification - setChoice(value PatternFlowIpv4IdentificationChoiceEnum) PatternFlowIpv4Identification - // HasChoice checks if Choice has been set in PatternFlowIpv4Identification - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4Identification. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4Identification - SetValue(value uint32) PatternFlowIpv4Identification - // HasValue checks if Value has been set in PatternFlowIpv4Identification - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4Identification. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4Identification - SetValues(value []uint32) PatternFlowIpv4Identification - // Increment returns PatternFlowIpv4IdentificationCounter, set in PatternFlowIpv4Identification. - // PatternFlowIpv4IdentificationCounter is integer counter pattern - Increment() PatternFlowIpv4IdentificationCounter - // SetIncrement assigns PatternFlowIpv4IdentificationCounter provided by user to PatternFlowIpv4Identification. - // PatternFlowIpv4IdentificationCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4IdentificationCounter) PatternFlowIpv4Identification - // HasIncrement checks if Increment has been set in PatternFlowIpv4Identification - HasIncrement() bool - // Decrement returns PatternFlowIpv4IdentificationCounter, set in PatternFlowIpv4Identification. - // PatternFlowIpv4IdentificationCounter is integer counter pattern - Decrement() PatternFlowIpv4IdentificationCounter - // SetDecrement assigns PatternFlowIpv4IdentificationCounter provided by user to PatternFlowIpv4Identification. - // PatternFlowIpv4IdentificationCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4IdentificationCounter) PatternFlowIpv4Identification - // HasDecrement checks if Decrement has been set in PatternFlowIpv4Identification - HasDecrement() bool - // MetricTags returns PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIterIter, set in PatternFlowIpv4Identification - MetricTags() PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter - setNil() -} - -type PatternFlowIpv4IdentificationChoiceEnum string - -// Enum of Choice on PatternFlowIpv4Identification -var PatternFlowIpv4IdentificationChoice = struct { - VALUE PatternFlowIpv4IdentificationChoiceEnum - VALUES PatternFlowIpv4IdentificationChoiceEnum - INCREMENT PatternFlowIpv4IdentificationChoiceEnum - DECREMENT PatternFlowIpv4IdentificationChoiceEnum -}{ - VALUE: PatternFlowIpv4IdentificationChoiceEnum("value"), - VALUES: PatternFlowIpv4IdentificationChoiceEnum("values"), - INCREMENT: PatternFlowIpv4IdentificationChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4IdentificationChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4Identification) Choice() PatternFlowIpv4IdentificationChoiceEnum { - return PatternFlowIpv4IdentificationChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4Identification) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4Identification) setChoice(value PatternFlowIpv4IdentificationChoiceEnum) PatternFlowIpv4Identification { - intValue, ok := otg.PatternFlowIpv4Identification_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4IdentificationChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4Identification_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4IdentificationChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4IdentificationChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4IdentificationChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4IdentificationCounter().msg() - } - - if value == PatternFlowIpv4IdentificationChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4IdentificationCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4Identification) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4IdentificationChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4Identification) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4Identification object -func (obj *patternFlowIpv4Identification) SetValue(value uint32) PatternFlowIpv4Identification { - obj.setChoice(PatternFlowIpv4IdentificationChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4Identification) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4Identification object -func (obj *patternFlowIpv4Identification) SetValues(value []uint32) PatternFlowIpv4Identification { - obj.setChoice(PatternFlowIpv4IdentificationChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4IdentificationCounter -func (obj *patternFlowIpv4Identification) Increment() PatternFlowIpv4IdentificationCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4IdentificationChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4IdentificationCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4IdentificationCounter -func (obj *patternFlowIpv4Identification) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4IdentificationCounter value in the PatternFlowIpv4Identification object -func (obj *patternFlowIpv4Identification) SetIncrement(value PatternFlowIpv4IdentificationCounter) PatternFlowIpv4Identification { - obj.setChoice(PatternFlowIpv4IdentificationChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4IdentificationCounter -func (obj *patternFlowIpv4Identification) Decrement() PatternFlowIpv4IdentificationCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4IdentificationChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4IdentificationCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4IdentificationCounter -func (obj *patternFlowIpv4Identification) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4IdentificationCounter value in the PatternFlowIpv4Identification object -func (obj *patternFlowIpv4Identification) SetDecrement(value PatternFlowIpv4IdentificationCounter) PatternFlowIpv4Identification { - obj.setChoice(PatternFlowIpv4IdentificationChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4IdentificationMetricTag -func (obj *patternFlowIpv4Identification) MetricTags() PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4IdentificationMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter struct { - obj *patternFlowIpv4Identification - patternFlowIpv4IdentificationMetricTagSlice []PatternFlowIpv4IdentificationMetricTag - fieldPtr *[]*otg.PatternFlowIpv4IdentificationMetricTag -} - -func newPatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter(ptr *[]*otg.PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { - return &patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter interface { - setMsg(*patternFlowIpv4Identification) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter - Items() []PatternFlowIpv4IdentificationMetricTag - Add() PatternFlowIpv4IdentificationMetricTag - Append(items ...PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter - Set(index int, newObj PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter - Clear() PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter - clearHolderSlice() PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter - appendHolderSlice(item PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter -} - -func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) setMsg(msg *patternFlowIpv4Identification) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4IdentificationMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) Items() []PatternFlowIpv4IdentificationMetricTag { - return obj.patternFlowIpv4IdentificationMetricTagSlice -} - -func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) Add() PatternFlowIpv4IdentificationMetricTag { - newObj := &otg.PatternFlowIpv4IdentificationMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4IdentificationMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4IdentificationMetricTagSlice = append(obj.patternFlowIpv4IdentificationMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) Append(items ...PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4IdentificationMetricTagSlice = append(obj.patternFlowIpv4IdentificationMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) Set(index int, newObj PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4IdentificationMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) Clear() PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4IdentificationMetricTag{} - obj.patternFlowIpv4IdentificationMetricTagSlice = []PatternFlowIpv4IdentificationMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) clearHolderSlice() PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { - if len(obj.patternFlowIpv4IdentificationMetricTagSlice) > 0 { - obj.patternFlowIpv4IdentificationMetricTagSlice = []PatternFlowIpv4IdentificationMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) appendHolderSlice(item PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { - obj.patternFlowIpv4IdentificationMetricTagSlice = append(obj.patternFlowIpv4IdentificationMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4Identification) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4Identification.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4Identification.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4IdentificationMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4Identification) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4IdentificationChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4IdentificationChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4IdentificationChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4IdentificationChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4IdentificationChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4IdentificationChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4Identification") - } - } else { - intVal := otg.PatternFlowIpv4Identification_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4Identification_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4Reserved ***** -type patternFlowIpv4Reserved struct { - validation - obj *otg.PatternFlowIpv4Reserved - marshaller marshalPatternFlowIpv4Reserved - unMarshaller unMarshalPatternFlowIpv4Reserved - incrementHolder PatternFlowIpv4ReservedCounter - decrementHolder PatternFlowIpv4ReservedCounter - metricTagsHolder PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter -} - -func NewPatternFlowIpv4Reserved() PatternFlowIpv4Reserved { - obj := patternFlowIpv4Reserved{obj: &otg.PatternFlowIpv4Reserved{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4Reserved) msg() *otg.PatternFlowIpv4Reserved { - return obj.obj -} - -func (obj *patternFlowIpv4Reserved) setMsg(msg *otg.PatternFlowIpv4Reserved) PatternFlowIpv4Reserved { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4Reserved struct { - obj *patternFlowIpv4Reserved -} - -type marshalPatternFlowIpv4Reserved interface { - // ToProto marshals PatternFlowIpv4Reserved to protobuf object *otg.PatternFlowIpv4Reserved - ToProto() (*otg.PatternFlowIpv4Reserved, error) - // ToPbText marshals PatternFlowIpv4Reserved to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4Reserved to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4Reserved to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4Reserved struct { - obj *patternFlowIpv4Reserved -} - -type unMarshalPatternFlowIpv4Reserved interface { - // FromProto unmarshals PatternFlowIpv4Reserved from protobuf object *otg.PatternFlowIpv4Reserved - FromProto(msg *otg.PatternFlowIpv4Reserved) (PatternFlowIpv4Reserved, error) - // FromPbText unmarshals PatternFlowIpv4Reserved from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4Reserved from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4Reserved from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4Reserved) Marshal() marshalPatternFlowIpv4Reserved { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4Reserved{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4Reserved) Unmarshal() unMarshalPatternFlowIpv4Reserved { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4Reserved{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4Reserved) ToProto() (*otg.PatternFlowIpv4Reserved, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4Reserved) FromProto(msg *otg.PatternFlowIpv4Reserved) (PatternFlowIpv4Reserved, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4Reserved) 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 *unMarshalpatternFlowIpv4Reserved) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4Reserved) 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 *unMarshalpatternFlowIpv4Reserved) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4Reserved) 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 *unMarshalpatternFlowIpv4Reserved) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4Reserved) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4Reserved) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4Reserved) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4Reserved) Clone() (PatternFlowIpv4Reserved, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4Reserved() - 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 -} - -func (obj *patternFlowIpv4Reserved) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4Reserved is reserved flag. -type PatternFlowIpv4Reserved interface { - Validation - // msg marshals PatternFlowIpv4Reserved to protobuf object *otg.PatternFlowIpv4Reserved - // and doesn't set defaults - msg() *otg.PatternFlowIpv4Reserved - // setMsg unmarshals PatternFlowIpv4Reserved from protobuf object *otg.PatternFlowIpv4Reserved - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4Reserved) PatternFlowIpv4Reserved - // provides marshal interface - Marshal() marshalPatternFlowIpv4Reserved - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4Reserved - // validate validates PatternFlowIpv4Reserved - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4Reserved, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4ReservedChoiceEnum, set in PatternFlowIpv4Reserved - Choice() PatternFlowIpv4ReservedChoiceEnum - // setChoice assigns PatternFlowIpv4ReservedChoiceEnum provided by user to PatternFlowIpv4Reserved - setChoice(value PatternFlowIpv4ReservedChoiceEnum) PatternFlowIpv4Reserved - // HasChoice checks if Choice has been set in PatternFlowIpv4Reserved - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4Reserved. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4Reserved - SetValue(value uint32) PatternFlowIpv4Reserved - // HasValue checks if Value has been set in PatternFlowIpv4Reserved - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4Reserved. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4Reserved - SetValues(value []uint32) PatternFlowIpv4Reserved - // Increment returns PatternFlowIpv4ReservedCounter, set in PatternFlowIpv4Reserved. - // PatternFlowIpv4ReservedCounter is integer counter pattern - Increment() PatternFlowIpv4ReservedCounter - // SetIncrement assigns PatternFlowIpv4ReservedCounter provided by user to PatternFlowIpv4Reserved. - // PatternFlowIpv4ReservedCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4ReservedCounter) PatternFlowIpv4Reserved - // HasIncrement checks if Increment has been set in PatternFlowIpv4Reserved - HasIncrement() bool - // Decrement returns PatternFlowIpv4ReservedCounter, set in PatternFlowIpv4Reserved. - // PatternFlowIpv4ReservedCounter is integer counter pattern - Decrement() PatternFlowIpv4ReservedCounter - // SetDecrement assigns PatternFlowIpv4ReservedCounter provided by user to PatternFlowIpv4Reserved. - // PatternFlowIpv4ReservedCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4ReservedCounter) PatternFlowIpv4Reserved - // HasDecrement checks if Decrement has been set in PatternFlowIpv4Reserved - HasDecrement() bool - // MetricTags returns PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIterIter, set in PatternFlowIpv4Reserved - MetricTags() PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter - setNil() -} - -type PatternFlowIpv4ReservedChoiceEnum string - -// Enum of Choice on PatternFlowIpv4Reserved -var PatternFlowIpv4ReservedChoice = struct { - VALUE PatternFlowIpv4ReservedChoiceEnum - VALUES PatternFlowIpv4ReservedChoiceEnum - INCREMENT PatternFlowIpv4ReservedChoiceEnum - DECREMENT PatternFlowIpv4ReservedChoiceEnum -}{ - VALUE: PatternFlowIpv4ReservedChoiceEnum("value"), - VALUES: PatternFlowIpv4ReservedChoiceEnum("values"), - INCREMENT: PatternFlowIpv4ReservedChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4ReservedChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4Reserved) Choice() PatternFlowIpv4ReservedChoiceEnum { - return PatternFlowIpv4ReservedChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4Reserved) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4Reserved) setChoice(value PatternFlowIpv4ReservedChoiceEnum) PatternFlowIpv4Reserved { - intValue, ok := otg.PatternFlowIpv4Reserved_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4ReservedChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4Reserved_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4ReservedChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4ReservedChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4ReservedChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4ReservedCounter().msg() - } - - if value == PatternFlowIpv4ReservedChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4ReservedCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4Reserved) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4ReservedChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4Reserved) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4Reserved object -func (obj *patternFlowIpv4Reserved) SetValue(value uint32) PatternFlowIpv4Reserved { - obj.setChoice(PatternFlowIpv4ReservedChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4Reserved) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4Reserved object -func (obj *patternFlowIpv4Reserved) SetValues(value []uint32) PatternFlowIpv4Reserved { - obj.setChoice(PatternFlowIpv4ReservedChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4ReservedCounter -func (obj *patternFlowIpv4Reserved) Increment() PatternFlowIpv4ReservedCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4ReservedChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4ReservedCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4ReservedCounter -func (obj *patternFlowIpv4Reserved) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4ReservedCounter value in the PatternFlowIpv4Reserved object -func (obj *patternFlowIpv4Reserved) SetIncrement(value PatternFlowIpv4ReservedCounter) PatternFlowIpv4Reserved { - obj.setChoice(PatternFlowIpv4ReservedChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4ReservedCounter -func (obj *patternFlowIpv4Reserved) Decrement() PatternFlowIpv4ReservedCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4ReservedChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4ReservedCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4ReservedCounter -func (obj *patternFlowIpv4Reserved) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4ReservedCounter value in the PatternFlowIpv4Reserved object -func (obj *patternFlowIpv4Reserved) SetDecrement(value PatternFlowIpv4ReservedCounter) PatternFlowIpv4Reserved { - obj.setChoice(PatternFlowIpv4ReservedChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4ReservedMetricTag -func (obj *patternFlowIpv4Reserved) MetricTags() PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4ReservedMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter struct { - obj *patternFlowIpv4Reserved - patternFlowIpv4ReservedMetricTagSlice []PatternFlowIpv4ReservedMetricTag - fieldPtr *[]*otg.PatternFlowIpv4ReservedMetricTag -} - -func newPatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter(ptr *[]*otg.PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { - return &patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter interface { - setMsg(*patternFlowIpv4Reserved) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter - Items() []PatternFlowIpv4ReservedMetricTag - Add() PatternFlowIpv4ReservedMetricTag - Append(items ...PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter - Set(index int, newObj PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter - Clear() PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter - clearHolderSlice() PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter - appendHolderSlice(item PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter -} - -func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) setMsg(msg *patternFlowIpv4Reserved) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4ReservedMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) Items() []PatternFlowIpv4ReservedMetricTag { - return obj.patternFlowIpv4ReservedMetricTagSlice -} - -func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) Add() PatternFlowIpv4ReservedMetricTag { - newObj := &otg.PatternFlowIpv4ReservedMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4ReservedMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4ReservedMetricTagSlice = append(obj.patternFlowIpv4ReservedMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) Append(items ...PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4ReservedMetricTagSlice = append(obj.patternFlowIpv4ReservedMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) Set(index int, newObj PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4ReservedMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) Clear() PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4ReservedMetricTag{} - obj.patternFlowIpv4ReservedMetricTagSlice = []PatternFlowIpv4ReservedMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) clearHolderSlice() PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { - if len(obj.patternFlowIpv4ReservedMetricTagSlice) > 0 { - obj.patternFlowIpv4ReservedMetricTagSlice = []PatternFlowIpv4ReservedMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) appendHolderSlice(item PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { - obj.patternFlowIpv4ReservedMetricTagSlice = append(obj.patternFlowIpv4ReservedMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4Reserved) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4Reserved.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4Reserved.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4ReservedMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4Reserved) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4ReservedChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4ReservedChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4ReservedChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4ReservedChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4ReservedChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4ReservedChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4Reserved") - } - } else { - intVal := otg.PatternFlowIpv4Reserved_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4Reserved_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4DontFragment ***** -type patternFlowIpv4DontFragment struct { - validation - obj *otg.PatternFlowIpv4DontFragment - marshaller marshalPatternFlowIpv4DontFragment - unMarshaller unMarshalPatternFlowIpv4DontFragment - incrementHolder PatternFlowIpv4DontFragmentCounter - decrementHolder PatternFlowIpv4DontFragmentCounter - metricTagsHolder PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter -} - -func NewPatternFlowIpv4DontFragment() PatternFlowIpv4DontFragment { - obj := patternFlowIpv4DontFragment{obj: &otg.PatternFlowIpv4DontFragment{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4DontFragment) msg() *otg.PatternFlowIpv4DontFragment { - return obj.obj -} - -func (obj *patternFlowIpv4DontFragment) setMsg(msg *otg.PatternFlowIpv4DontFragment) PatternFlowIpv4DontFragment { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4DontFragment struct { - obj *patternFlowIpv4DontFragment -} - -type marshalPatternFlowIpv4DontFragment interface { - // ToProto marshals PatternFlowIpv4DontFragment to protobuf object *otg.PatternFlowIpv4DontFragment - ToProto() (*otg.PatternFlowIpv4DontFragment, error) - // ToPbText marshals PatternFlowIpv4DontFragment to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4DontFragment to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4DontFragment to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4DontFragment struct { - obj *patternFlowIpv4DontFragment -} - -type unMarshalPatternFlowIpv4DontFragment interface { - // FromProto unmarshals PatternFlowIpv4DontFragment from protobuf object *otg.PatternFlowIpv4DontFragment - FromProto(msg *otg.PatternFlowIpv4DontFragment) (PatternFlowIpv4DontFragment, error) - // FromPbText unmarshals PatternFlowIpv4DontFragment from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4DontFragment from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4DontFragment from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4DontFragment) Marshal() marshalPatternFlowIpv4DontFragment { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4DontFragment{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4DontFragment) Unmarshal() unMarshalPatternFlowIpv4DontFragment { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4DontFragment{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4DontFragment) ToProto() (*otg.PatternFlowIpv4DontFragment, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4DontFragment) FromProto(msg *otg.PatternFlowIpv4DontFragment) (PatternFlowIpv4DontFragment, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4DontFragment) 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 *unMarshalpatternFlowIpv4DontFragment) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4DontFragment) 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 *unMarshalpatternFlowIpv4DontFragment) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4DontFragment) 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 *unMarshalpatternFlowIpv4DontFragment) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4DontFragment) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DontFragment) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DontFragment) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4DontFragment) Clone() (PatternFlowIpv4DontFragment, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4DontFragment() - 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 -} - -func (obj *patternFlowIpv4DontFragment) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4DontFragment is dont fragment flag If the dont_fragment flag is set and fragmentation is required to route the packet then the packet is dropped. -type PatternFlowIpv4DontFragment interface { - Validation - // msg marshals PatternFlowIpv4DontFragment to protobuf object *otg.PatternFlowIpv4DontFragment - // and doesn't set defaults - msg() *otg.PatternFlowIpv4DontFragment - // setMsg unmarshals PatternFlowIpv4DontFragment from protobuf object *otg.PatternFlowIpv4DontFragment - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4DontFragment) PatternFlowIpv4DontFragment - // provides marshal interface - Marshal() marshalPatternFlowIpv4DontFragment - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4DontFragment - // validate validates PatternFlowIpv4DontFragment - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4DontFragment, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4DontFragmentChoiceEnum, set in PatternFlowIpv4DontFragment - Choice() PatternFlowIpv4DontFragmentChoiceEnum - // setChoice assigns PatternFlowIpv4DontFragmentChoiceEnum provided by user to PatternFlowIpv4DontFragment - setChoice(value PatternFlowIpv4DontFragmentChoiceEnum) PatternFlowIpv4DontFragment - // HasChoice checks if Choice has been set in PatternFlowIpv4DontFragment - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4DontFragment. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4DontFragment - SetValue(value uint32) PatternFlowIpv4DontFragment - // HasValue checks if Value has been set in PatternFlowIpv4DontFragment - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4DontFragment. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4DontFragment - SetValues(value []uint32) PatternFlowIpv4DontFragment - // Increment returns PatternFlowIpv4DontFragmentCounter, set in PatternFlowIpv4DontFragment. - // PatternFlowIpv4DontFragmentCounter is integer counter pattern - Increment() PatternFlowIpv4DontFragmentCounter - // SetIncrement assigns PatternFlowIpv4DontFragmentCounter provided by user to PatternFlowIpv4DontFragment. - // PatternFlowIpv4DontFragmentCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4DontFragmentCounter) PatternFlowIpv4DontFragment - // HasIncrement checks if Increment has been set in PatternFlowIpv4DontFragment - HasIncrement() bool - // Decrement returns PatternFlowIpv4DontFragmentCounter, set in PatternFlowIpv4DontFragment. - // PatternFlowIpv4DontFragmentCounter is integer counter pattern - Decrement() PatternFlowIpv4DontFragmentCounter - // SetDecrement assigns PatternFlowIpv4DontFragmentCounter provided by user to PatternFlowIpv4DontFragment. - // PatternFlowIpv4DontFragmentCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4DontFragmentCounter) PatternFlowIpv4DontFragment - // HasDecrement checks if Decrement has been set in PatternFlowIpv4DontFragment - HasDecrement() bool - // MetricTags returns PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIterIter, set in PatternFlowIpv4DontFragment - MetricTags() PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter - setNil() -} - -type PatternFlowIpv4DontFragmentChoiceEnum string - -// Enum of Choice on PatternFlowIpv4DontFragment -var PatternFlowIpv4DontFragmentChoice = struct { - VALUE PatternFlowIpv4DontFragmentChoiceEnum - VALUES PatternFlowIpv4DontFragmentChoiceEnum - INCREMENT PatternFlowIpv4DontFragmentChoiceEnum - DECREMENT PatternFlowIpv4DontFragmentChoiceEnum -}{ - VALUE: PatternFlowIpv4DontFragmentChoiceEnum("value"), - VALUES: PatternFlowIpv4DontFragmentChoiceEnum("values"), - INCREMENT: PatternFlowIpv4DontFragmentChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4DontFragmentChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4DontFragment) Choice() PatternFlowIpv4DontFragmentChoiceEnum { - return PatternFlowIpv4DontFragmentChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4DontFragment) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4DontFragment) setChoice(value PatternFlowIpv4DontFragmentChoiceEnum) PatternFlowIpv4DontFragment { - intValue, ok := otg.PatternFlowIpv4DontFragment_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4DontFragmentChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4DontFragment_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4DontFragmentChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4DontFragmentChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4DontFragmentChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4DontFragmentCounter().msg() - } - - if value == PatternFlowIpv4DontFragmentChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4DontFragmentCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4DontFragment) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4DontFragmentChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4DontFragment) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4DontFragment object -func (obj *patternFlowIpv4DontFragment) SetValue(value uint32) PatternFlowIpv4DontFragment { - obj.setChoice(PatternFlowIpv4DontFragmentChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4DontFragment) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4DontFragment object -func (obj *patternFlowIpv4DontFragment) SetValues(value []uint32) PatternFlowIpv4DontFragment { - obj.setChoice(PatternFlowIpv4DontFragmentChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4DontFragmentCounter -func (obj *patternFlowIpv4DontFragment) Increment() PatternFlowIpv4DontFragmentCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4DontFragmentChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4DontFragmentCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4DontFragmentCounter -func (obj *patternFlowIpv4DontFragment) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4DontFragmentCounter value in the PatternFlowIpv4DontFragment object -func (obj *patternFlowIpv4DontFragment) SetIncrement(value PatternFlowIpv4DontFragmentCounter) PatternFlowIpv4DontFragment { - obj.setChoice(PatternFlowIpv4DontFragmentChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4DontFragmentCounter -func (obj *patternFlowIpv4DontFragment) Decrement() PatternFlowIpv4DontFragmentCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4DontFragmentChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4DontFragmentCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4DontFragmentCounter -func (obj *patternFlowIpv4DontFragment) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4DontFragmentCounter value in the PatternFlowIpv4DontFragment object -func (obj *patternFlowIpv4DontFragment) SetDecrement(value PatternFlowIpv4DontFragmentCounter) PatternFlowIpv4DontFragment { - obj.setChoice(PatternFlowIpv4DontFragmentChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4DontFragmentMetricTag -func (obj *patternFlowIpv4DontFragment) MetricTags() PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4DontFragmentMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter struct { - obj *patternFlowIpv4DontFragment - patternFlowIpv4DontFragmentMetricTagSlice []PatternFlowIpv4DontFragmentMetricTag - fieldPtr *[]*otg.PatternFlowIpv4DontFragmentMetricTag -} - -func newPatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter(ptr *[]*otg.PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { - return &patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter interface { - setMsg(*patternFlowIpv4DontFragment) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter - Items() []PatternFlowIpv4DontFragmentMetricTag - Add() PatternFlowIpv4DontFragmentMetricTag - Append(items ...PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter - Set(index int, newObj PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter - Clear() PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter - clearHolderSlice() PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter - appendHolderSlice(item PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter -} - -func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) setMsg(msg *patternFlowIpv4DontFragment) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4DontFragmentMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) Items() []PatternFlowIpv4DontFragmentMetricTag { - return obj.patternFlowIpv4DontFragmentMetricTagSlice -} - -func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) Add() PatternFlowIpv4DontFragmentMetricTag { - newObj := &otg.PatternFlowIpv4DontFragmentMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4DontFragmentMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4DontFragmentMetricTagSlice = append(obj.patternFlowIpv4DontFragmentMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) Append(items ...PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4DontFragmentMetricTagSlice = append(obj.patternFlowIpv4DontFragmentMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) Set(index int, newObj PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4DontFragmentMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) Clear() PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4DontFragmentMetricTag{} - obj.patternFlowIpv4DontFragmentMetricTagSlice = []PatternFlowIpv4DontFragmentMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) clearHolderSlice() PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { - if len(obj.patternFlowIpv4DontFragmentMetricTagSlice) > 0 { - obj.patternFlowIpv4DontFragmentMetricTagSlice = []PatternFlowIpv4DontFragmentMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) appendHolderSlice(item PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { - obj.patternFlowIpv4DontFragmentMetricTagSlice = append(obj.patternFlowIpv4DontFragmentMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4DontFragment) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DontFragment.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4DontFragment.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4DontFragmentMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4DontFragment) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4DontFragmentChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4DontFragmentChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4DontFragmentChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4DontFragmentChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4DontFragmentChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4DontFragmentChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4DontFragment") - } - } else { - intVal := otg.PatternFlowIpv4DontFragment_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4DontFragment_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4MoreFragments ***** -type patternFlowIpv4MoreFragments struct { - validation - obj *otg.PatternFlowIpv4MoreFragments - marshaller marshalPatternFlowIpv4MoreFragments - unMarshaller unMarshalPatternFlowIpv4MoreFragments - incrementHolder PatternFlowIpv4MoreFragmentsCounter - decrementHolder PatternFlowIpv4MoreFragmentsCounter - metricTagsHolder PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter -} - -func NewPatternFlowIpv4MoreFragments() PatternFlowIpv4MoreFragments { - obj := patternFlowIpv4MoreFragments{obj: &otg.PatternFlowIpv4MoreFragments{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4MoreFragments) msg() *otg.PatternFlowIpv4MoreFragments { - return obj.obj -} - -func (obj *patternFlowIpv4MoreFragments) setMsg(msg *otg.PatternFlowIpv4MoreFragments) PatternFlowIpv4MoreFragments { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4MoreFragments struct { - obj *patternFlowIpv4MoreFragments -} - -type marshalPatternFlowIpv4MoreFragments interface { - // ToProto marshals PatternFlowIpv4MoreFragments to protobuf object *otg.PatternFlowIpv4MoreFragments - ToProto() (*otg.PatternFlowIpv4MoreFragments, error) - // ToPbText marshals PatternFlowIpv4MoreFragments to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4MoreFragments to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4MoreFragments to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4MoreFragments struct { - obj *patternFlowIpv4MoreFragments -} - -type unMarshalPatternFlowIpv4MoreFragments interface { - // FromProto unmarshals PatternFlowIpv4MoreFragments from protobuf object *otg.PatternFlowIpv4MoreFragments - FromProto(msg *otg.PatternFlowIpv4MoreFragments) (PatternFlowIpv4MoreFragments, error) - // FromPbText unmarshals PatternFlowIpv4MoreFragments from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4MoreFragments from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4MoreFragments from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4MoreFragments) Marshal() marshalPatternFlowIpv4MoreFragments { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4MoreFragments{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4MoreFragments) Unmarshal() unMarshalPatternFlowIpv4MoreFragments { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4MoreFragments{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4MoreFragments) ToProto() (*otg.PatternFlowIpv4MoreFragments, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4MoreFragments) FromProto(msg *otg.PatternFlowIpv4MoreFragments) (PatternFlowIpv4MoreFragments, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4MoreFragments) 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 *unMarshalpatternFlowIpv4MoreFragments) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4MoreFragments) 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 *unMarshalpatternFlowIpv4MoreFragments) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4MoreFragments) 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 *unMarshalpatternFlowIpv4MoreFragments) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4MoreFragments) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4MoreFragments) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4MoreFragments) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4MoreFragments) Clone() (PatternFlowIpv4MoreFragments, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4MoreFragments() - 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 -} - -func (obj *patternFlowIpv4MoreFragments) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4MoreFragments is more fragments flag -type PatternFlowIpv4MoreFragments interface { - Validation - // msg marshals PatternFlowIpv4MoreFragments to protobuf object *otg.PatternFlowIpv4MoreFragments - // and doesn't set defaults - msg() *otg.PatternFlowIpv4MoreFragments - // setMsg unmarshals PatternFlowIpv4MoreFragments from protobuf object *otg.PatternFlowIpv4MoreFragments - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4MoreFragments) PatternFlowIpv4MoreFragments - // provides marshal interface - Marshal() marshalPatternFlowIpv4MoreFragments - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4MoreFragments - // validate validates PatternFlowIpv4MoreFragments - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4MoreFragments, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4MoreFragmentsChoiceEnum, set in PatternFlowIpv4MoreFragments - Choice() PatternFlowIpv4MoreFragmentsChoiceEnum - // setChoice assigns PatternFlowIpv4MoreFragmentsChoiceEnum provided by user to PatternFlowIpv4MoreFragments - setChoice(value PatternFlowIpv4MoreFragmentsChoiceEnum) PatternFlowIpv4MoreFragments - // HasChoice checks if Choice has been set in PatternFlowIpv4MoreFragments - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4MoreFragments. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4MoreFragments - SetValue(value uint32) PatternFlowIpv4MoreFragments - // HasValue checks if Value has been set in PatternFlowIpv4MoreFragments - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4MoreFragments. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4MoreFragments - SetValues(value []uint32) PatternFlowIpv4MoreFragments - // Increment returns PatternFlowIpv4MoreFragmentsCounter, set in PatternFlowIpv4MoreFragments. - // PatternFlowIpv4MoreFragmentsCounter is integer counter pattern - Increment() PatternFlowIpv4MoreFragmentsCounter - // SetIncrement assigns PatternFlowIpv4MoreFragmentsCounter provided by user to PatternFlowIpv4MoreFragments. - // PatternFlowIpv4MoreFragmentsCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4MoreFragmentsCounter) PatternFlowIpv4MoreFragments - // HasIncrement checks if Increment has been set in PatternFlowIpv4MoreFragments - HasIncrement() bool - // Decrement returns PatternFlowIpv4MoreFragmentsCounter, set in PatternFlowIpv4MoreFragments. - // PatternFlowIpv4MoreFragmentsCounter is integer counter pattern - Decrement() PatternFlowIpv4MoreFragmentsCounter - // SetDecrement assigns PatternFlowIpv4MoreFragmentsCounter provided by user to PatternFlowIpv4MoreFragments. - // PatternFlowIpv4MoreFragmentsCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4MoreFragmentsCounter) PatternFlowIpv4MoreFragments - // HasDecrement checks if Decrement has been set in PatternFlowIpv4MoreFragments - HasDecrement() bool - // MetricTags returns PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIterIter, set in PatternFlowIpv4MoreFragments - MetricTags() PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter - setNil() -} - -type PatternFlowIpv4MoreFragmentsChoiceEnum string - -// Enum of Choice on PatternFlowIpv4MoreFragments -var PatternFlowIpv4MoreFragmentsChoice = struct { - VALUE PatternFlowIpv4MoreFragmentsChoiceEnum - VALUES PatternFlowIpv4MoreFragmentsChoiceEnum - INCREMENT PatternFlowIpv4MoreFragmentsChoiceEnum - DECREMENT PatternFlowIpv4MoreFragmentsChoiceEnum -}{ - VALUE: PatternFlowIpv4MoreFragmentsChoiceEnum("value"), - VALUES: PatternFlowIpv4MoreFragmentsChoiceEnum("values"), - INCREMENT: PatternFlowIpv4MoreFragmentsChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4MoreFragmentsChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4MoreFragments) Choice() PatternFlowIpv4MoreFragmentsChoiceEnum { - return PatternFlowIpv4MoreFragmentsChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4MoreFragments) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4MoreFragments) setChoice(value PatternFlowIpv4MoreFragmentsChoiceEnum) PatternFlowIpv4MoreFragments { - intValue, ok := otg.PatternFlowIpv4MoreFragments_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4MoreFragmentsChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4MoreFragments_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4MoreFragmentsChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4MoreFragmentsChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4MoreFragmentsChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4MoreFragmentsCounter().msg() - } - - if value == PatternFlowIpv4MoreFragmentsChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4MoreFragmentsCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4MoreFragments) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4MoreFragments) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4MoreFragments object -func (obj *patternFlowIpv4MoreFragments) SetValue(value uint32) PatternFlowIpv4MoreFragments { - obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4MoreFragments) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4MoreFragments object -func (obj *patternFlowIpv4MoreFragments) SetValues(value []uint32) PatternFlowIpv4MoreFragments { - obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4MoreFragmentsCounter -func (obj *patternFlowIpv4MoreFragments) Increment() PatternFlowIpv4MoreFragmentsCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4MoreFragmentsCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4MoreFragmentsCounter -func (obj *patternFlowIpv4MoreFragments) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4MoreFragmentsCounter value in the PatternFlowIpv4MoreFragments object -func (obj *patternFlowIpv4MoreFragments) SetIncrement(value PatternFlowIpv4MoreFragmentsCounter) PatternFlowIpv4MoreFragments { - obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4MoreFragmentsCounter -func (obj *patternFlowIpv4MoreFragments) Decrement() PatternFlowIpv4MoreFragmentsCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4MoreFragmentsCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4MoreFragmentsCounter -func (obj *patternFlowIpv4MoreFragments) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4MoreFragmentsCounter value in the PatternFlowIpv4MoreFragments object -func (obj *patternFlowIpv4MoreFragments) SetDecrement(value PatternFlowIpv4MoreFragmentsCounter) PatternFlowIpv4MoreFragments { - obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4MoreFragmentsMetricTag -func (obj *patternFlowIpv4MoreFragments) MetricTags() PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4MoreFragmentsMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter struct { - obj *patternFlowIpv4MoreFragments - patternFlowIpv4MoreFragmentsMetricTagSlice []PatternFlowIpv4MoreFragmentsMetricTag - fieldPtr *[]*otg.PatternFlowIpv4MoreFragmentsMetricTag -} - -func newPatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter(ptr *[]*otg.PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { - return &patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter interface { - setMsg(*patternFlowIpv4MoreFragments) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter - Items() []PatternFlowIpv4MoreFragmentsMetricTag - Add() PatternFlowIpv4MoreFragmentsMetricTag - Append(items ...PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter - Set(index int, newObj PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter - Clear() PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter - clearHolderSlice() PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter - appendHolderSlice(item PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter -} - -func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) setMsg(msg *patternFlowIpv4MoreFragments) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4MoreFragmentsMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) Items() []PatternFlowIpv4MoreFragmentsMetricTag { - return obj.patternFlowIpv4MoreFragmentsMetricTagSlice -} - -func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) Add() PatternFlowIpv4MoreFragmentsMetricTag { - newObj := &otg.PatternFlowIpv4MoreFragmentsMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4MoreFragmentsMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4MoreFragmentsMetricTagSlice = append(obj.patternFlowIpv4MoreFragmentsMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) Append(items ...PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4MoreFragmentsMetricTagSlice = append(obj.patternFlowIpv4MoreFragmentsMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) Set(index int, newObj PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4MoreFragmentsMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) Clear() PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4MoreFragmentsMetricTag{} - obj.patternFlowIpv4MoreFragmentsMetricTagSlice = []PatternFlowIpv4MoreFragmentsMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) clearHolderSlice() PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { - if len(obj.patternFlowIpv4MoreFragmentsMetricTagSlice) > 0 { - obj.patternFlowIpv4MoreFragmentsMetricTagSlice = []PatternFlowIpv4MoreFragmentsMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) appendHolderSlice(item PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { - obj.patternFlowIpv4MoreFragmentsMetricTagSlice = append(obj.patternFlowIpv4MoreFragmentsMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4MoreFragments) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4MoreFragments.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4MoreFragments.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4MoreFragmentsMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4MoreFragments) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4MoreFragmentsChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4MoreFragmentsChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4MoreFragmentsChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4MoreFragmentsChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4MoreFragmentsChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4MoreFragments") - } - } else { - intVal := otg.PatternFlowIpv4MoreFragments_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4MoreFragments_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4FragmentOffset ***** -type patternFlowIpv4FragmentOffset struct { - validation - obj *otg.PatternFlowIpv4FragmentOffset - marshaller marshalPatternFlowIpv4FragmentOffset - unMarshaller unMarshalPatternFlowIpv4FragmentOffset - incrementHolder PatternFlowIpv4FragmentOffsetCounter - decrementHolder PatternFlowIpv4FragmentOffsetCounter - metricTagsHolder PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter -} - -func NewPatternFlowIpv4FragmentOffset() PatternFlowIpv4FragmentOffset { - obj := patternFlowIpv4FragmentOffset{obj: &otg.PatternFlowIpv4FragmentOffset{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4FragmentOffset) msg() *otg.PatternFlowIpv4FragmentOffset { - return obj.obj -} - -func (obj *patternFlowIpv4FragmentOffset) setMsg(msg *otg.PatternFlowIpv4FragmentOffset) PatternFlowIpv4FragmentOffset { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4FragmentOffset struct { - obj *patternFlowIpv4FragmentOffset -} - -type marshalPatternFlowIpv4FragmentOffset interface { - // ToProto marshals PatternFlowIpv4FragmentOffset to protobuf object *otg.PatternFlowIpv4FragmentOffset - ToProto() (*otg.PatternFlowIpv4FragmentOffset, error) - // ToPbText marshals PatternFlowIpv4FragmentOffset to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4FragmentOffset to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4FragmentOffset to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4FragmentOffset struct { - obj *patternFlowIpv4FragmentOffset -} - -type unMarshalPatternFlowIpv4FragmentOffset interface { - // FromProto unmarshals PatternFlowIpv4FragmentOffset from protobuf object *otg.PatternFlowIpv4FragmentOffset - FromProto(msg *otg.PatternFlowIpv4FragmentOffset) (PatternFlowIpv4FragmentOffset, error) - // FromPbText unmarshals PatternFlowIpv4FragmentOffset from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4FragmentOffset from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4FragmentOffset from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4FragmentOffset) Marshal() marshalPatternFlowIpv4FragmentOffset { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4FragmentOffset{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4FragmentOffset) Unmarshal() unMarshalPatternFlowIpv4FragmentOffset { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4FragmentOffset{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4FragmentOffset) ToProto() (*otg.PatternFlowIpv4FragmentOffset, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4FragmentOffset) FromProto(msg *otg.PatternFlowIpv4FragmentOffset) (PatternFlowIpv4FragmentOffset, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4FragmentOffset) 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 *unMarshalpatternFlowIpv4FragmentOffset) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4FragmentOffset) 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 *unMarshalpatternFlowIpv4FragmentOffset) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4FragmentOffset) 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 *unMarshalpatternFlowIpv4FragmentOffset) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4FragmentOffset) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4FragmentOffset) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4FragmentOffset) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4FragmentOffset) Clone() (PatternFlowIpv4FragmentOffset, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4FragmentOffset() - 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 -} - -func (obj *patternFlowIpv4FragmentOffset) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4FragmentOffset is fragment offset -type PatternFlowIpv4FragmentOffset interface { - Validation - // msg marshals PatternFlowIpv4FragmentOffset to protobuf object *otg.PatternFlowIpv4FragmentOffset - // and doesn't set defaults - msg() *otg.PatternFlowIpv4FragmentOffset - // setMsg unmarshals PatternFlowIpv4FragmentOffset from protobuf object *otg.PatternFlowIpv4FragmentOffset - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4FragmentOffset) PatternFlowIpv4FragmentOffset - // provides marshal interface - Marshal() marshalPatternFlowIpv4FragmentOffset - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4FragmentOffset - // validate validates PatternFlowIpv4FragmentOffset - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4FragmentOffset, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4FragmentOffsetChoiceEnum, set in PatternFlowIpv4FragmentOffset - Choice() PatternFlowIpv4FragmentOffsetChoiceEnum - // setChoice assigns PatternFlowIpv4FragmentOffsetChoiceEnum provided by user to PatternFlowIpv4FragmentOffset - setChoice(value PatternFlowIpv4FragmentOffsetChoiceEnum) PatternFlowIpv4FragmentOffset - // HasChoice checks if Choice has been set in PatternFlowIpv4FragmentOffset - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4FragmentOffset. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4FragmentOffset - SetValue(value uint32) PatternFlowIpv4FragmentOffset - // HasValue checks if Value has been set in PatternFlowIpv4FragmentOffset - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4FragmentOffset. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4FragmentOffset - SetValues(value []uint32) PatternFlowIpv4FragmentOffset - // Increment returns PatternFlowIpv4FragmentOffsetCounter, set in PatternFlowIpv4FragmentOffset. - // PatternFlowIpv4FragmentOffsetCounter is integer counter pattern - Increment() PatternFlowIpv4FragmentOffsetCounter - // SetIncrement assigns PatternFlowIpv4FragmentOffsetCounter provided by user to PatternFlowIpv4FragmentOffset. - // PatternFlowIpv4FragmentOffsetCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4FragmentOffsetCounter) PatternFlowIpv4FragmentOffset - // HasIncrement checks if Increment has been set in PatternFlowIpv4FragmentOffset - HasIncrement() bool - // Decrement returns PatternFlowIpv4FragmentOffsetCounter, set in PatternFlowIpv4FragmentOffset. - // PatternFlowIpv4FragmentOffsetCounter is integer counter pattern - Decrement() PatternFlowIpv4FragmentOffsetCounter - // SetDecrement assigns PatternFlowIpv4FragmentOffsetCounter provided by user to PatternFlowIpv4FragmentOffset. - // PatternFlowIpv4FragmentOffsetCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4FragmentOffsetCounter) PatternFlowIpv4FragmentOffset - // HasDecrement checks if Decrement has been set in PatternFlowIpv4FragmentOffset - HasDecrement() bool - // MetricTags returns PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIterIter, set in PatternFlowIpv4FragmentOffset - MetricTags() PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter - setNil() -} - -type PatternFlowIpv4FragmentOffsetChoiceEnum string - -// Enum of Choice on PatternFlowIpv4FragmentOffset -var PatternFlowIpv4FragmentOffsetChoice = struct { - VALUE PatternFlowIpv4FragmentOffsetChoiceEnum - VALUES PatternFlowIpv4FragmentOffsetChoiceEnum - INCREMENT PatternFlowIpv4FragmentOffsetChoiceEnum - DECREMENT PatternFlowIpv4FragmentOffsetChoiceEnum -}{ - VALUE: PatternFlowIpv4FragmentOffsetChoiceEnum("value"), - VALUES: PatternFlowIpv4FragmentOffsetChoiceEnum("values"), - INCREMENT: PatternFlowIpv4FragmentOffsetChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4FragmentOffsetChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4FragmentOffset) Choice() PatternFlowIpv4FragmentOffsetChoiceEnum { - return PatternFlowIpv4FragmentOffsetChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4FragmentOffset) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4FragmentOffset) setChoice(value PatternFlowIpv4FragmentOffsetChoiceEnum) PatternFlowIpv4FragmentOffset { - intValue, ok := otg.PatternFlowIpv4FragmentOffset_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4FragmentOffsetChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4FragmentOffset_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4FragmentOffsetChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4FragmentOffsetChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4FragmentOffsetChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4FragmentOffsetCounter().msg() - } - - if value == PatternFlowIpv4FragmentOffsetChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4FragmentOffsetCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4FragmentOffset) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4FragmentOffset) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4FragmentOffset object -func (obj *patternFlowIpv4FragmentOffset) SetValue(value uint32) PatternFlowIpv4FragmentOffset { - obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4FragmentOffset) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4FragmentOffset object -func (obj *patternFlowIpv4FragmentOffset) SetValues(value []uint32) PatternFlowIpv4FragmentOffset { - obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4FragmentOffsetCounter -func (obj *patternFlowIpv4FragmentOffset) Increment() PatternFlowIpv4FragmentOffsetCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4FragmentOffsetCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4FragmentOffsetCounter -func (obj *patternFlowIpv4FragmentOffset) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4FragmentOffsetCounter value in the PatternFlowIpv4FragmentOffset object -func (obj *patternFlowIpv4FragmentOffset) SetIncrement(value PatternFlowIpv4FragmentOffsetCounter) PatternFlowIpv4FragmentOffset { - obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4FragmentOffsetCounter -func (obj *patternFlowIpv4FragmentOffset) Decrement() PatternFlowIpv4FragmentOffsetCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4FragmentOffsetCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4FragmentOffsetCounter -func (obj *patternFlowIpv4FragmentOffset) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4FragmentOffsetCounter value in the PatternFlowIpv4FragmentOffset object -func (obj *patternFlowIpv4FragmentOffset) SetDecrement(value PatternFlowIpv4FragmentOffsetCounter) PatternFlowIpv4FragmentOffset { - obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4FragmentOffsetMetricTag -func (obj *patternFlowIpv4FragmentOffset) MetricTags() PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4FragmentOffsetMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter struct { - obj *patternFlowIpv4FragmentOffset - patternFlowIpv4FragmentOffsetMetricTagSlice []PatternFlowIpv4FragmentOffsetMetricTag - fieldPtr *[]*otg.PatternFlowIpv4FragmentOffsetMetricTag -} - -func newPatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter(ptr *[]*otg.PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { - return &patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter interface { - setMsg(*patternFlowIpv4FragmentOffset) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter - Items() []PatternFlowIpv4FragmentOffsetMetricTag - Add() PatternFlowIpv4FragmentOffsetMetricTag - Append(items ...PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter - Set(index int, newObj PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter - Clear() PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter - clearHolderSlice() PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter - appendHolderSlice(item PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter -} - -func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) setMsg(msg *patternFlowIpv4FragmentOffset) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4FragmentOffsetMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) Items() []PatternFlowIpv4FragmentOffsetMetricTag { - return obj.patternFlowIpv4FragmentOffsetMetricTagSlice -} - -func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) Add() PatternFlowIpv4FragmentOffsetMetricTag { - newObj := &otg.PatternFlowIpv4FragmentOffsetMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4FragmentOffsetMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4FragmentOffsetMetricTagSlice = append(obj.patternFlowIpv4FragmentOffsetMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) Append(items ...PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4FragmentOffsetMetricTagSlice = append(obj.patternFlowIpv4FragmentOffsetMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) Set(index int, newObj PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4FragmentOffsetMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) Clear() PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4FragmentOffsetMetricTag{} - obj.patternFlowIpv4FragmentOffsetMetricTagSlice = []PatternFlowIpv4FragmentOffsetMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) clearHolderSlice() PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { - if len(obj.patternFlowIpv4FragmentOffsetMetricTagSlice) > 0 { - obj.patternFlowIpv4FragmentOffsetMetricTagSlice = []PatternFlowIpv4FragmentOffsetMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) appendHolderSlice(item PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { - obj.patternFlowIpv4FragmentOffsetMetricTagSlice = append(obj.patternFlowIpv4FragmentOffsetMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4FragmentOffset) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4FragmentOffset.Value <= 31 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4FragmentOffset.Values <= 31 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4FragmentOffsetMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4FragmentOffset) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4FragmentOffsetChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4FragmentOffsetChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4FragmentOffsetChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4FragmentOffsetChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4FragmentOffsetChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4FragmentOffset") - } - } else { - intVal := otg.PatternFlowIpv4FragmentOffset_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4FragmentOffset_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4TimeToLive ***** -type patternFlowIpv4TimeToLive struct { - validation - obj *otg.PatternFlowIpv4TimeToLive - marshaller marshalPatternFlowIpv4TimeToLive - unMarshaller unMarshalPatternFlowIpv4TimeToLive - incrementHolder PatternFlowIpv4TimeToLiveCounter - decrementHolder PatternFlowIpv4TimeToLiveCounter - metricTagsHolder PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter -} - -func NewPatternFlowIpv4TimeToLive() PatternFlowIpv4TimeToLive { - obj := patternFlowIpv4TimeToLive{obj: &otg.PatternFlowIpv4TimeToLive{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TimeToLive) msg() *otg.PatternFlowIpv4TimeToLive { - return obj.obj -} - -func (obj *patternFlowIpv4TimeToLive) setMsg(msg *otg.PatternFlowIpv4TimeToLive) PatternFlowIpv4TimeToLive { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TimeToLive struct { - obj *patternFlowIpv4TimeToLive -} - -type marshalPatternFlowIpv4TimeToLive interface { - // ToProto marshals PatternFlowIpv4TimeToLive to protobuf object *otg.PatternFlowIpv4TimeToLive - ToProto() (*otg.PatternFlowIpv4TimeToLive, error) - // ToPbText marshals PatternFlowIpv4TimeToLive to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TimeToLive to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TimeToLive to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TimeToLive struct { - obj *patternFlowIpv4TimeToLive -} - -type unMarshalPatternFlowIpv4TimeToLive interface { - // FromProto unmarshals PatternFlowIpv4TimeToLive from protobuf object *otg.PatternFlowIpv4TimeToLive - FromProto(msg *otg.PatternFlowIpv4TimeToLive) (PatternFlowIpv4TimeToLive, error) - // FromPbText unmarshals PatternFlowIpv4TimeToLive from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TimeToLive from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TimeToLive from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TimeToLive) Marshal() marshalPatternFlowIpv4TimeToLive { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TimeToLive{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TimeToLive) Unmarshal() unMarshalPatternFlowIpv4TimeToLive { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TimeToLive{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TimeToLive) ToProto() (*otg.PatternFlowIpv4TimeToLive, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TimeToLive) FromProto(msg *otg.PatternFlowIpv4TimeToLive) (PatternFlowIpv4TimeToLive, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TimeToLive) 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 *unMarshalpatternFlowIpv4TimeToLive) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4TimeToLive) 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 *unMarshalpatternFlowIpv4TimeToLive) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4TimeToLive) 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 *unMarshalpatternFlowIpv4TimeToLive) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4TimeToLive) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TimeToLive) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TimeToLive) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TimeToLive) Clone() (PatternFlowIpv4TimeToLive, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TimeToLive() - 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 -} - -func (obj *patternFlowIpv4TimeToLive) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4TimeToLive is time to live -type PatternFlowIpv4TimeToLive interface { - Validation - // msg marshals PatternFlowIpv4TimeToLive to protobuf object *otg.PatternFlowIpv4TimeToLive - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TimeToLive - // setMsg unmarshals PatternFlowIpv4TimeToLive from protobuf object *otg.PatternFlowIpv4TimeToLive - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TimeToLive) PatternFlowIpv4TimeToLive - // provides marshal interface - Marshal() marshalPatternFlowIpv4TimeToLive - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TimeToLive - // validate validates PatternFlowIpv4TimeToLive - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TimeToLive, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4TimeToLiveChoiceEnum, set in PatternFlowIpv4TimeToLive - Choice() PatternFlowIpv4TimeToLiveChoiceEnum - // setChoice assigns PatternFlowIpv4TimeToLiveChoiceEnum provided by user to PatternFlowIpv4TimeToLive - setChoice(value PatternFlowIpv4TimeToLiveChoiceEnum) PatternFlowIpv4TimeToLive - // HasChoice checks if Choice has been set in PatternFlowIpv4TimeToLive - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4TimeToLive. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4TimeToLive - SetValue(value uint32) PatternFlowIpv4TimeToLive - // HasValue checks if Value has been set in PatternFlowIpv4TimeToLive - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4TimeToLive. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4TimeToLive - SetValues(value []uint32) PatternFlowIpv4TimeToLive - // Increment returns PatternFlowIpv4TimeToLiveCounter, set in PatternFlowIpv4TimeToLive. - // PatternFlowIpv4TimeToLiveCounter is integer counter pattern - Increment() PatternFlowIpv4TimeToLiveCounter - // SetIncrement assigns PatternFlowIpv4TimeToLiveCounter provided by user to PatternFlowIpv4TimeToLive. - // PatternFlowIpv4TimeToLiveCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4TimeToLiveCounter) PatternFlowIpv4TimeToLive - // HasIncrement checks if Increment has been set in PatternFlowIpv4TimeToLive - HasIncrement() bool - // Decrement returns PatternFlowIpv4TimeToLiveCounter, set in PatternFlowIpv4TimeToLive. - // PatternFlowIpv4TimeToLiveCounter is integer counter pattern - Decrement() PatternFlowIpv4TimeToLiveCounter - // SetDecrement assigns PatternFlowIpv4TimeToLiveCounter provided by user to PatternFlowIpv4TimeToLive. - // PatternFlowIpv4TimeToLiveCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4TimeToLiveCounter) PatternFlowIpv4TimeToLive - // HasDecrement checks if Decrement has been set in PatternFlowIpv4TimeToLive - HasDecrement() bool - // MetricTags returns PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIterIter, set in PatternFlowIpv4TimeToLive - MetricTags() PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter - setNil() -} - -type PatternFlowIpv4TimeToLiveChoiceEnum string - -// Enum of Choice on PatternFlowIpv4TimeToLive -var PatternFlowIpv4TimeToLiveChoice = struct { - VALUE PatternFlowIpv4TimeToLiveChoiceEnum - VALUES PatternFlowIpv4TimeToLiveChoiceEnum - INCREMENT PatternFlowIpv4TimeToLiveChoiceEnum - DECREMENT PatternFlowIpv4TimeToLiveChoiceEnum -}{ - VALUE: PatternFlowIpv4TimeToLiveChoiceEnum("value"), - VALUES: PatternFlowIpv4TimeToLiveChoiceEnum("values"), - INCREMENT: PatternFlowIpv4TimeToLiveChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4TimeToLiveChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4TimeToLive) Choice() PatternFlowIpv4TimeToLiveChoiceEnum { - return PatternFlowIpv4TimeToLiveChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4TimeToLive) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4TimeToLive) setChoice(value PatternFlowIpv4TimeToLiveChoiceEnum) PatternFlowIpv4TimeToLive { - intValue, ok := otg.PatternFlowIpv4TimeToLive_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4TimeToLiveChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4TimeToLive_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4TimeToLiveChoice.VALUE { - defaultValue := uint32(64) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4TimeToLiveChoice.VALUES { - defaultValue := []uint32{64} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4TimeToLiveChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4TimeToLiveCounter().msg() - } - - if value == PatternFlowIpv4TimeToLiveChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4TimeToLiveCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TimeToLive) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4TimeToLiveChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TimeToLive) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4TimeToLive object -func (obj *patternFlowIpv4TimeToLive) SetValue(value uint32) PatternFlowIpv4TimeToLive { - obj.setChoice(PatternFlowIpv4TimeToLiveChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4TimeToLive) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{64}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4TimeToLive object -func (obj *patternFlowIpv4TimeToLive) SetValues(value []uint32) PatternFlowIpv4TimeToLive { - obj.setChoice(PatternFlowIpv4TimeToLiveChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4TimeToLiveCounter -func (obj *patternFlowIpv4TimeToLive) Increment() PatternFlowIpv4TimeToLiveCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4TimeToLiveChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4TimeToLiveCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4TimeToLiveCounter -func (obj *patternFlowIpv4TimeToLive) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4TimeToLiveCounter value in the PatternFlowIpv4TimeToLive object -func (obj *patternFlowIpv4TimeToLive) SetIncrement(value PatternFlowIpv4TimeToLiveCounter) PatternFlowIpv4TimeToLive { - obj.setChoice(PatternFlowIpv4TimeToLiveChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TimeToLiveCounter -func (obj *patternFlowIpv4TimeToLive) Decrement() PatternFlowIpv4TimeToLiveCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4TimeToLiveChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4TimeToLiveCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TimeToLiveCounter -func (obj *patternFlowIpv4TimeToLive) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4TimeToLiveCounter value in the PatternFlowIpv4TimeToLive object -func (obj *patternFlowIpv4TimeToLive) SetDecrement(value PatternFlowIpv4TimeToLiveCounter) PatternFlowIpv4TimeToLive { - obj.setChoice(PatternFlowIpv4TimeToLiveChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4TimeToLiveMetricTag -func (obj *patternFlowIpv4TimeToLive) MetricTags() PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4TimeToLiveMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter struct { - obj *patternFlowIpv4TimeToLive - patternFlowIpv4TimeToLiveMetricTagSlice []PatternFlowIpv4TimeToLiveMetricTag - fieldPtr *[]*otg.PatternFlowIpv4TimeToLiveMetricTag -} - -func newPatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter(ptr *[]*otg.PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { - return &patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter interface { - setMsg(*patternFlowIpv4TimeToLive) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter - Items() []PatternFlowIpv4TimeToLiveMetricTag - Add() PatternFlowIpv4TimeToLiveMetricTag - Append(items ...PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter - Set(index int, newObj PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter - Clear() PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter - clearHolderSlice() PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter - appendHolderSlice(item PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter -} - -func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) setMsg(msg *patternFlowIpv4TimeToLive) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4TimeToLiveMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) Items() []PatternFlowIpv4TimeToLiveMetricTag { - return obj.patternFlowIpv4TimeToLiveMetricTagSlice -} - -func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) Add() PatternFlowIpv4TimeToLiveMetricTag { - newObj := &otg.PatternFlowIpv4TimeToLiveMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4TimeToLiveMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4TimeToLiveMetricTagSlice = append(obj.patternFlowIpv4TimeToLiveMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) Append(items ...PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4TimeToLiveMetricTagSlice = append(obj.patternFlowIpv4TimeToLiveMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) Set(index int, newObj PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4TimeToLiveMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) Clear() PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4TimeToLiveMetricTag{} - obj.patternFlowIpv4TimeToLiveMetricTagSlice = []PatternFlowIpv4TimeToLiveMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) clearHolderSlice() PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { - if len(obj.patternFlowIpv4TimeToLiveMetricTagSlice) > 0 { - obj.patternFlowIpv4TimeToLiveMetricTagSlice = []PatternFlowIpv4TimeToLiveMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) appendHolderSlice(item PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { - obj.patternFlowIpv4TimeToLiveMetricTagSlice = append(obj.patternFlowIpv4TimeToLiveMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4TimeToLive) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TimeToLive.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4TimeToLive.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4TimeToLiveMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4TimeToLive) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4TimeToLiveChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4TimeToLiveChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4TimeToLiveChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4TimeToLiveChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4TimeToLiveChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4TimeToLiveChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TimeToLive") - } - } else { - intVal := otg.PatternFlowIpv4TimeToLive_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4TimeToLive_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4Protocol ***** -type patternFlowIpv4Protocol struct { - validation - obj *otg.PatternFlowIpv4Protocol - marshaller marshalPatternFlowIpv4Protocol - unMarshaller unMarshalPatternFlowIpv4Protocol - incrementHolder PatternFlowIpv4ProtocolCounter - decrementHolder PatternFlowIpv4ProtocolCounter - metricTagsHolder PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter -} - -func NewPatternFlowIpv4Protocol() PatternFlowIpv4Protocol { - obj := patternFlowIpv4Protocol{obj: &otg.PatternFlowIpv4Protocol{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4Protocol) msg() *otg.PatternFlowIpv4Protocol { - return obj.obj -} - -func (obj *patternFlowIpv4Protocol) setMsg(msg *otg.PatternFlowIpv4Protocol) PatternFlowIpv4Protocol { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4Protocol struct { - obj *patternFlowIpv4Protocol -} - -type marshalPatternFlowIpv4Protocol interface { - // ToProto marshals PatternFlowIpv4Protocol to protobuf object *otg.PatternFlowIpv4Protocol - ToProto() (*otg.PatternFlowIpv4Protocol, error) - // ToPbText marshals PatternFlowIpv4Protocol to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4Protocol to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4Protocol to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4Protocol struct { - obj *patternFlowIpv4Protocol -} - -type unMarshalPatternFlowIpv4Protocol interface { - // FromProto unmarshals PatternFlowIpv4Protocol from protobuf object *otg.PatternFlowIpv4Protocol - FromProto(msg *otg.PatternFlowIpv4Protocol) (PatternFlowIpv4Protocol, error) - // FromPbText unmarshals PatternFlowIpv4Protocol from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4Protocol from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4Protocol from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4Protocol) Marshal() marshalPatternFlowIpv4Protocol { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4Protocol{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4Protocol) Unmarshal() unMarshalPatternFlowIpv4Protocol { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4Protocol{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4Protocol) ToProto() (*otg.PatternFlowIpv4Protocol, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4Protocol) FromProto(msg *otg.PatternFlowIpv4Protocol) (PatternFlowIpv4Protocol, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4Protocol) 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 *unMarshalpatternFlowIpv4Protocol) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4Protocol) 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 *unMarshalpatternFlowIpv4Protocol) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4Protocol) 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 *unMarshalpatternFlowIpv4Protocol) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4Protocol) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4Protocol) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4Protocol) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4Protocol) Clone() (PatternFlowIpv4Protocol, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4Protocol() - 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 -} - -func (obj *patternFlowIpv4Protocol) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4Protocol is protocol, default is 61 any host internal protocol -type PatternFlowIpv4Protocol interface { - Validation - // msg marshals PatternFlowIpv4Protocol to protobuf object *otg.PatternFlowIpv4Protocol - // and doesn't set defaults - msg() *otg.PatternFlowIpv4Protocol - // setMsg unmarshals PatternFlowIpv4Protocol from protobuf object *otg.PatternFlowIpv4Protocol - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4Protocol) PatternFlowIpv4Protocol - // provides marshal interface - Marshal() marshalPatternFlowIpv4Protocol - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4Protocol - // validate validates PatternFlowIpv4Protocol - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4Protocol, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4ProtocolChoiceEnum, set in PatternFlowIpv4Protocol - Choice() PatternFlowIpv4ProtocolChoiceEnum - // setChoice assigns PatternFlowIpv4ProtocolChoiceEnum provided by user to PatternFlowIpv4Protocol - setChoice(value PatternFlowIpv4ProtocolChoiceEnum) PatternFlowIpv4Protocol - // HasChoice checks if Choice has been set in PatternFlowIpv4Protocol - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4Protocol. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4Protocol - SetValue(value uint32) PatternFlowIpv4Protocol - // HasValue checks if Value has been set in PatternFlowIpv4Protocol - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4Protocol. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4Protocol - SetValues(value []uint32) PatternFlowIpv4Protocol - // Auto returns uint32, set in PatternFlowIpv4Protocol. - Auto() uint32 - // HasAuto checks if Auto has been set in PatternFlowIpv4Protocol - HasAuto() bool - // Increment returns PatternFlowIpv4ProtocolCounter, set in PatternFlowIpv4Protocol. - // PatternFlowIpv4ProtocolCounter is integer counter pattern - Increment() PatternFlowIpv4ProtocolCounter - // SetIncrement assigns PatternFlowIpv4ProtocolCounter provided by user to PatternFlowIpv4Protocol. - // PatternFlowIpv4ProtocolCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4ProtocolCounter) PatternFlowIpv4Protocol - // HasIncrement checks if Increment has been set in PatternFlowIpv4Protocol - HasIncrement() bool - // Decrement returns PatternFlowIpv4ProtocolCounter, set in PatternFlowIpv4Protocol. - // PatternFlowIpv4ProtocolCounter is integer counter pattern - Decrement() PatternFlowIpv4ProtocolCounter - // SetDecrement assigns PatternFlowIpv4ProtocolCounter provided by user to PatternFlowIpv4Protocol. - // PatternFlowIpv4ProtocolCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4ProtocolCounter) PatternFlowIpv4Protocol - // HasDecrement checks if Decrement has been set in PatternFlowIpv4Protocol - HasDecrement() bool - // MetricTags returns PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIterIter, set in PatternFlowIpv4Protocol - MetricTags() PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter - setNil() -} - -type PatternFlowIpv4ProtocolChoiceEnum string - -// Enum of Choice on PatternFlowIpv4Protocol -var PatternFlowIpv4ProtocolChoice = struct { - VALUE PatternFlowIpv4ProtocolChoiceEnum - VALUES PatternFlowIpv4ProtocolChoiceEnum - AUTO PatternFlowIpv4ProtocolChoiceEnum - INCREMENT PatternFlowIpv4ProtocolChoiceEnum - DECREMENT PatternFlowIpv4ProtocolChoiceEnum -}{ - VALUE: PatternFlowIpv4ProtocolChoiceEnum("value"), - VALUES: PatternFlowIpv4ProtocolChoiceEnum("values"), - AUTO: PatternFlowIpv4ProtocolChoiceEnum("auto"), - INCREMENT: PatternFlowIpv4ProtocolChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4ProtocolChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4Protocol) Choice() PatternFlowIpv4ProtocolChoiceEnum { - return PatternFlowIpv4ProtocolChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4Protocol) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4Protocol) setChoice(value PatternFlowIpv4ProtocolChoiceEnum) PatternFlowIpv4Protocol { - intValue, ok := otg.PatternFlowIpv4Protocol_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4ProtocolChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4Protocol_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Auto = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4ProtocolChoice.VALUE { - defaultValue := uint32(61) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4ProtocolChoice.VALUES { - defaultValue := []uint32{61} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4ProtocolChoice.AUTO { - defaultValue := uint32(61) - obj.obj.Auto = &defaultValue - } - - if value == PatternFlowIpv4ProtocolChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4ProtocolCounter().msg() - } - - if value == PatternFlowIpv4ProtocolChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4ProtocolCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4Protocol) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4ProtocolChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4Protocol) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4Protocol object -func (obj *patternFlowIpv4Protocol) SetValue(value uint32) PatternFlowIpv4Protocol { - obj.setChoice(PatternFlowIpv4ProtocolChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4Protocol) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{61}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4Protocol object -func (obj *patternFlowIpv4Protocol) SetValues(value []uint32) PatternFlowIpv4Protocol { - obj.setChoice(PatternFlowIpv4ProtocolChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowIpv4Protocol) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(PatternFlowIpv4ProtocolChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowIpv4Protocol) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Increment returns a PatternFlowIpv4ProtocolCounter -func (obj *patternFlowIpv4Protocol) Increment() PatternFlowIpv4ProtocolCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4ProtocolChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4ProtocolCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4ProtocolCounter -func (obj *patternFlowIpv4Protocol) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4ProtocolCounter value in the PatternFlowIpv4Protocol object -func (obj *patternFlowIpv4Protocol) SetIncrement(value PatternFlowIpv4ProtocolCounter) PatternFlowIpv4Protocol { - obj.setChoice(PatternFlowIpv4ProtocolChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4ProtocolCounter -func (obj *patternFlowIpv4Protocol) Decrement() PatternFlowIpv4ProtocolCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4ProtocolChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4ProtocolCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4ProtocolCounter -func (obj *patternFlowIpv4Protocol) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4ProtocolCounter value in the PatternFlowIpv4Protocol object -func (obj *patternFlowIpv4Protocol) SetDecrement(value PatternFlowIpv4ProtocolCounter) PatternFlowIpv4Protocol { - obj.setChoice(PatternFlowIpv4ProtocolChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4ProtocolMetricTag -func (obj *patternFlowIpv4Protocol) MetricTags() PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4ProtocolMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter struct { - obj *patternFlowIpv4Protocol - patternFlowIpv4ProtocolMetricTagSlice []PatternFlowIpv4ProtocolMetricTag - fieldPtr *[]*otg.PatternFlowIpv4ProtocolMetricTag -} - -func newPatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter(ptr *[]*otg.PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { - return &patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter interface { - setMsg(*patternFlowIpv4Protocol) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter - Items() []PatternFlowIpv4ProtocolMetricTag - Add() PatternFlowIpv4ProtocolMetricTag - Append(items ...PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter - Set(index int, newObj PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter - Clear() PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter - clearHolderSlice() PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter - appendHolderSlice(item PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter -} - -func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) setMsg(msg *patternFlowIpv4Protocol) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4ProtocolMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) Items() []PatternFlowIpv4ProtocolMetricTag { - return obj.patternFlowIpv4ProtocolMetricTagSlice -} - -func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) Add() PatternFlowIpv4ProtocolMetricTag { - newObj := &otg.PatternFlowIpv4ProtocolMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4ProtocolMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4ProtocolMetricTagSlice = append(obj.patternFlowIpv4ProtocolMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) Append(items ...PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4ProtocolMetricTagSlice = append(obj.patternFlowIpv4ProtocolMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) Set(index int, newObj PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4ProtocolMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) Clear() PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4ProtocolMetricTag{} - obj.patternFlowIpv4ProtocolMetricTagSlice = []PatternFlowIpv4ProtocolMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) clearHolderSlice() PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { - if len(obj.patternFlowIpv4ProtocolMetricTagSlice) > 0 { - obj.patternFlowIpv4ProtocolMetricTagSlice = []PatternFlowIpv4ProtocolMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) appendHolderSlice(item PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { - obj.patternFlowIpv4ProtocolMetricTagSlice = append(obj.patternFlowIpv4ProtocolMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4Protocol) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4Protocol.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4Protocol.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Auto != nil { - - if *obj.obj.Auto > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4Protocol.Auto <= 255 but Got %d", *obj.obj.Auto)) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4ProtocolMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4Protocol) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4ProtocolChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4ProtocolChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4ProtocolChoice.VALUES - } - - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowIpv4ProtocolChoice.AUTO - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4ProtocolChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4ProtocolChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4ProtocolChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4Protocol") - } - } else { - intVal := otg.PatternFlowIpv4Protocol_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4Protocol_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4HeaderChecksum ***** -type patternFlowIpv4HeaderChecksum struct { - validation - obj *otg.PatternFlowIpv4HeaderChecksum - marshaller marshalPatternFlowIpv4HeaderChecksum - unMarshaller unMarshalPatternFlowIpv4HeaderChecksum -} - -func NewPatternFlowIpv4HeaderChecksum() PatternFlowIpv4HeaderChecksum { - obj := patternFlowIpv4HeaderChecksum{obj: &otg.PatternFlowIpv4HeaderChecksum{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4HeaderChecksum) msg() *otg.PatternFlowIpv4HeaderChecksum { - return obj.obj -} - -func (obj *patternFlowIpv4HeaderChecksum) setMsg(msg *otg.PatternFlowIpv4HeaderChecksum) PatternFlowIpv4HeaderChecksum { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4HeaderChecksum struct { - obj *patternFlowIpv4HeaderChecksum -} - -type marshalPatternFlowIpv4HeaderChecksum interface { - // ToProto marshals PatternFlowIpv4HeaderChecksum to protobuf object *otg.PatternFlowIpv4HeaderChecksum - ToProto() (*otg.PatternFlowIpv4HeaderChecksum, error) - // ToPbText marshals PatternFlowIpv4HeaderChecksum to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4HeaderChecksum to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4HeaderChecksum to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4HeaderChecksum struct { - obj *patternFlowIpv4HeaderChecksum -} - -type unMarshalPatternFlowIpv4HeaderChecksum interface { - // FromProto unmarshals PatternFlowIpv4HeaderChecksum from protobuf object *otg.PatternFlowIpv4HeaderChecksum - FromProto(msg *otg.PatternFlowIpv4HeaderChecksum) (PatternFlowIpv4HeaderChecksum, error) - // FromPbText unmarshals PatternFlowIpv4HeaderChecksum from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4HeaderChecksum from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4HeaderChecksum from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4HeaderChecksum) Marshal() marshalPatternFlowIpv4HeaderChecksum { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4HeaderChecksum{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4HeaderChecksum) Unmarshal() unMarshalPatternFlowIpv4HeaderChecksum { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4HeaderChecksum{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4HeaderChecksum) ToProto() (*otg.PatternFlowIpv4HeaderChecksum, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4HeaderChecksum) FromProto(msg *otg.PatternFlowIpv4HeaderChecksum) (PatternFlowIpv4HeaderChecksum, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4HeaderChecksum) 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 *unMarshalpatternFlowIpv4HeaderChecksum) 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 *marshalpatternFlowIpv4HeaderChecksum) 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 *unMarshalpatternFlowIpv4HeaderChecksum) 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 *marshalpatternFlowIpv4HeaderChecksum) 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 *unMarshalpatternFlowIpv4HeaderChecksum) 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 *patternFlowIpv4HeaderChecksum) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4HeaderChecksum) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4HeaderChecksum) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4HeaderChecksum) Clone() (PatternFlowIpv4HeaderChecksum, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4HeaderChecksum() - 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 -} - -// PatternFlowIpv4HeaderChecksum is header checksum -type PatternFlowIpv4HeaderChecksum interface { - Validation - // msg marshals PatternFlowIpv4HeaderChecksum to protobuf object *otg.PatternFlowIpv4HeaderChecksum - // and doesn't set defaults - msg() *otg.PatternFlowIpv4HeaderChecksum - // setMsg unmarshals PatternFlowIpv4HeaderChecksum from protobuf object *otg.PatternFlowIpv4HeaderChecksum - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4HeaderChecksum) PatternFlowIpv4HeaderChecksum - // provides marshal interface - Marshal() marshalPatternFlowIpv4HeaderChecksum - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4HeaderChecksum - // validate validates PatternFlowIpv4HeaderChecksum - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4HeaderChecksum, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4HeaderChecksumChoiceEnum, set in PatternFlowIpv4HeaderChecksum - Choice() PatternFlowIpv4HeaderChecksumChoiceEnum - // setChoice assigns PatternFlowIpv4HeaderChecksumChoiceEnum provided by user to PatternFlowIpv4HeaderChecksum - setChoice(value PatternFlowIpv4HeaderChecksumChoiceEnum) PatternFlowIpv4HeaderChecksum - // HasChoice checks if Choice has been set in PatternFlowIpv4HeaderChecksum - HasChoice() bool - // Generated returns PatternFlowIpv4HeaderChecksumGeneratedEnum, set in PatternFlowIpv4HeaderChecksum - Generated() PatternFlowIpv4HeaderChecksumGeneratedEnum - // SetGenerated assigns PatternFlowIpv4HeaderChecksumGeneratedEnum provided by user to PatternFlowIpv4HeaderChecksum - SetGenerated(value PatternFlowIpv4HeaderChecksumGeneratedEnum) PatternFlowIpv4HeaderChecksum - // HasGenerated checks if Generated has been set in PatternFlowIpv4HeaderChecksum - HasGenerated() bool - // Custom returns uint32, set in PatternFlowIpv4HeaderChecksum. - Custom() uint32 - // SetCustom assigns uint32 provided by user to PatternFlowIpv4HeaderChecksum - SetCustom(value uint32) PatternFlowIpv4HeaderChecksum - // HasCustom checks if Custom has been set in PatternFlowIpv4HeaderChecksum - HasCustom() bool -} - -type PatternFlowIpv4HeaderChecksumChoiceEnum string - -// Enum of Choice on PatternFlowIpv4HeaderChecksum -var PatternFlowIpv4HeaderChecksumChoice = struct { - GENERATED PatternFlowIpv4HeaderChecksumChoiceEnum - CUSTOM PatternFlowIpv4HeaderChecksumChoiceEnum -}{ - GENERATED: PatternFlowIpv4HeaderChecksumChoiceEnum("generated"), - CUSTOM: PatternFlowIpv4HeaderChecksumChoiceEnum("custom"), -} - -func (obj *patternFlowIpv4HeaderChecksum) Choice() PatternFlowIpv4HeaderChecksumChoiceEnum { - return PatternFlowIpv4HeaderChecksumChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The type of checksum -// Choice returns a string -func (obj *patternFlowIpv4HeaderChecksum) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4HeaderChecksum) setChoice(value PatternFlowIpv4HeaderChecksumChoiceEnum) PatternFlowIpv4HeaderChecksum { - intValue, ok := otg.PatternFlowIpv4HeaderChecksum_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4HeaderChecksumChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4HeaderChecksum_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Custom = nil - obj.obj.Generated = otg.PatternFlowIpv4HeaderChecksum_Generated_unspecified.Enum() - return obj -} - -type PatternFlowIpv4HeaderChecksumGeneratedEnum string - -// Enum of Generated on PatternFlowIpv4HeaderChecksum -var PatternFlowIpv4HeaderChecksumGenerated = struct { - GOOD PatternFlowIpv4HeaderChecksumGeneratedEnum - BAD PatternFlowIpv4HeaderChecksumGeneratedEnum -}{ - GOOD: PatternFlowIpv4HeaderChecksumGeneratedEnum("good"), - BAD: PatternFlowIpv4HeaderChecksumGeneratedEnum("bad"), -} - -func (obj *patternFlowIpv4HeaderChecksum) Generated() PatternFlowIpv4HeaderChecksumGeneratedEnum { - return PatternFlowIpv4HeaderChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) -} - -// A system generated checksum value -// Generated returns a string -func (obj *patternFlowIpv4HeaderChecksum) HasGenerated() bool { - return obj.obj.Generated != nil -} - -func (obj *patternFlowIpv4HeaderChecksum) SetGenerated(value PatternFlowIpv4HeaderChecksumGeneratedEnum) PatternFlowIpv4HeaderChecksum { - intValue, ok := otg.PatternFlowIpv4HeaderChecksum_Generated_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4HeaderChecksumGeneratedEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4HeaderChecksum_Generated_Enum(intValue) - obj.obj.Generated = &enumValue - - return obj -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowIpv4HeaderChecksum) Custom() uint32 { - - if obj.obj.Custom == nil { - obj.setChoice(PatternFlowIpv4HeaderChecksumChoice.CUSTOM) - } - - return *obj.obj.Custom - -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowIpv4HeaderChecksum) HasCustom() bool { - return obj.obj.Custom != nil -} - -// A custom checksum value -// SetCustom sets the uint32 value in the PatternFlowIpv4HeaderChecksum object -func (obj *patternFlowIpv4HeaderChecksum) SetCustom(value uint32) PatternFlowIpv4HeaderChecksum { - obj.setChoice(PatternFlowIpv4HeaderChecksumChoice.CUSTOM) - obj.obj.Custom = &value - return obj -} - -func (obj *patternFlowIpv4HeaderChecksum) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Custom != nil { - - if *obj.obj.Custom > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4HeaderChecksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) - } - - } - -} - -func (obj *patternFlowIpv4HeaderChecksum) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4HeaderChecksumChoiceEnum - - if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { - choices_set += 1 - choice = PatternFlowIpv4HeaderChecksumChoice.GENERATED - } - - if obj.obj.Custom != nil { - choices_set += 1 - choice = PatternFlowIpv4HeaderChecksumChoice.CUSTOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4HeaderChecksumChoice.GENERATED) - if obj.obj.Generated.Number() == 0 { - obj.SetGenerated(PatternFlowIpv4HeaderChecksumGenerated.GOOD) - - } - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4HeaderChecksum") - } - } else { - intVal := otg.PatternFlowIpv4HeaderChecksum_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4HeaderChecksum_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4Src ***** -type patternFlowIpv4Src struct { - validation - obj *otg.PatternFlowIpv4Src - marshaller marshalPatternFlowIpv4Src - unMarshaller unMarshalPatternFlowIpv4Src - incrementHolder PatternFlowIpv4SrcCounter - decrementHolder PatternFlowIpv4SrcCounter - metricTagsHolder PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter - autoHolder FlowIpv4Auto - randomHolder PatternFlowIpv4SrcRandom -} - -func NewPatternFlowIpv4Src() PatternFlowIpv4Src { - obj := patternFlowIpv4Src{obj: &otg.PatternFlowIpv4Src{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4Src) msg() *otg.PatternFlowIpv4Src { - return obj.obj -} - -func (obj *patternFlowIpv4Src) setMsg(msg *otg.PatternFlowIpv4Src) PatternFlowIpv4Src { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4Src struct { - obj *patternFlowIpv4Src -} - -type marshalPatternFlowIpv4Src interface { - // ToProto marshals PatternFlowIpv4Src to protobuf object *otg.PatternFlowIpv4Src - ToProto() (*otg.PatternFlowIpv4Src, error) - // ToPbText marshals PatternFlowIpv4Src to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4Src to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4Src to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4Src struct { - obj *patternFlowIpv4Src -} - -type unMarshalPatternFlowIpv4Src interface { - // FromProto unmarshals PatternFlowIpv4Src from protobuf object *otg.PatternFlowIpv4Src - FromProto(msg *otg.PatternFlowIpv4Src) (PatternFlowIpv4Src, error) - // FromPbText unmarshals PatternFlowIpv4Src from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4Src from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4Src from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4Src) Marshal() marshalPatternFlowIpv4Src { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4Src{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4Src) Unmarshal() unMarshalPatternFlowIpv4Src { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4Src{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4Src) ToProto() (*otg.PatternFlowIpv4Src, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4Src) FromProto(msg *otg.PatternFlowIpv4Src) (PatternFlowIpv4Src, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4Src) 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 *unMarshalpatternFlowIpv4Src) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4Src) 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 *unMarshalpatternFlowIpv4Src) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4Src) 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 *unMarshalpatternFlowIpv4Src) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4Src) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4Src) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4Src) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4Src) Clone() (PatternFlowIpv4Src, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4Src() - 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 -} - -func (obj *patternFlowIpv4Src) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.autoHolder = nil - obj.randomHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4Src is source address -type PatternFlowIpv4Src interface { - Validation - // msg marshals PatternFlowIpv4Src to protobuf object *otg.PatternFlowIpv4Src - // and doesn't set defaults - msg() *otg.PatternFlowIpv4Src - // setMsg unmarshals PatternFlowIpv4Src from protobuf object *otg.PatternFlowIpv4Src - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4Src) PatternFlowIpv4Src - // provides marshal interface - Marshal() marshalPatternFlowIpv4Src - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4Src - // validate validates PatternFlowIpv4Src - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4Src, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4SrcChoiceEnum, set in PatternFlowIpv4Src - Choice() PatternFlowIpv4SrcChoiceEnum - // setChoice assigns PatternFlowIpv4SrcChoiceEnum provided by user to PatternFlowIpv4Src - setChoice(value PatternFlowIpv4SrcChoiceEnum) PatternFlowIpv4Src - // HasChoice checks if Choice has been set in PatternFlowIpv4Src - HasChoice() bool - // Value returns string, set in PatternFlowIpv4Src. - Value() string - // SetValue assigns string provided by user to PatternFlowIpv4Src - SetValue(value string) PatternFlowIpv4Src - // HasValue checks if Value has been set in PatternFlowIpv4Src - HasValue() bool - // Values returns []string, set in PatternFlowIpv4Src. - Values() []string - // SetValues assigns []string provided by user to PatternFlowIpv4Src - SetValues(value []string) PatternFlowIpv4Src - // Increment returns PatternFlowIpv4SrcCounter, set in PatternFlowIpv4Src. - // PatternFlowIpv4SrcCounter is ipv4 counter pattern - Increment() PatternFlowIpv4SrcCounter - // SetIncrement assigns PatternFlowIpv4SrcCounter provided by user to PatternFlowIpv4Src. - // PatternFlowIpv4SrcCounter is ipv4 counter pattern - SetIncrement(value PatternFlowIpv4SrcCounter) PatternFlowIpv4Src - // HasIncrement checks if Increment has been set in PatternFlowIpv4Src - HasIncrement() bool - // Decrement returns PatternFlowIpv4SrcCounter, set in PatternFlowIpv4Src. - // PatternFlowIpv4SrcCounter is ipv4 counter pattern - Decrement() PatternFlowIpv4SrcCounter - // SetDecrement assigns PatternFlowIpv4SrcCounter provided by user to PatternFlowIpv4Src. - // PatternFlowIpv4SrcCounter is ipv4 counter pattern - SetDecrement(value PatternFlowIpv4SrcCounter) PatternFlowIpv4Src - // HasDecrement checks if Decrement has been set in PatternFlowIpv4Src - HasDecrement() bool - // MetricTags returns PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIterIter, set in PatternFlowIpv4Src - MetricTags() PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter - // Auto returns FlowIpv4Auto, set in PatternFlowIpv4Src. - // FlowIpv4Auto is the OTG implementation can provide a system generated, value for this property. - Auto() FlowIpv4Auto - // HasAuto checks if Auto has been set in PatternFlowIpv4Src - HasAuto() bool - // Random returns PatternFlowIpv4SrcRandom, set in PatternFlowIpv4Src. - // PatternFlowIpv4SrcRandom is ipv4 random pattern - Random() PatternFlowIpv4SrcRandom - // SetRandom assigns PatternFlowIpv4SrcRandom provided by user to PatternFlowIpv4Src. - // PatternFlowIpv4SrcRandom is ipv4 random pattern - SetRandom(value PatternFlowIpv4SrcRandom) PatternFlowIpv4Src - // HasRandom checks if Random has been set in PatternFlowIpv4Src - HasRandom() bool - setNil() -} - -type PatternFlowIpv4SrcChoiceEnum string - -// Enum of Choice on PatternFlowIpv4Src -var PatternFlowIpv4SrcChoice = struct { - VALUE PatternFlowIpv4SrcChoiceEnum - VALUES PatternFlowIpv4SrcChoiceEnum - INCREMENT PatternFlowIpv4SrcChoiceEnum - DECREMENT PatternFlowIpv4SrcChoiceEnum - AUTO PatternFlowIpv4SrcChoiceEnum - RANDOM PatternFlowIpv4SrcChoiceEnum -}{ - VALUE: PatternFlowIpv4SrcChoiceEnum("value"), - VALUES: PatternFlowIpv4SrcChoiceEnum("values"), - INCREMENT: PatternFlowIpv4SrcChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4SrcChoiceEnum("decrement"), - AUTO: PatternFlowIpv4SrcChoiceEnum("auto"), - RANDOM: PatternFlowIpv4SrcChoiceEnum("random"), -} - -func (obj *patternFlowIpv4Src) Choice() PatternFlowIpv4SrcChoiceEnum { - return PatternFlowIpv4SrcChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4Src) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4Src) setChoice(value PatternFlowIpv4SrcChoiceEnum) PatternFlowIpv4Src { - intValue, ok := otg.PatternFlowIpv4Src_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4SrcChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4Src_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Random = nil - obj.randomHolder = nil - obj.obj.Auto = nil - obj.autoHolder = nil - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4SrcChoice.VALUE { - defaultValue := "0.0.0.0" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4SrcChoice.VALUES { - defaultValue := []string{"0.0.0.0"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4SrcChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4SrcCounter().msg() - } - - if value == PatternFlowIpv4SrcChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4SrcCounter().msg() - } - - if value == PatternFlowIpv4SrcChoice.AUTO { - obj.obj.Auto = NewFlowIpv4Auto().msg() - } - - if value == PatternFlowIpv4SrcChoice.RANDOM { - obj.obj.Random = NewPatternFlowIpv4SrcRandom().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowIpv4Src) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4SrcChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowIpv4Src) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowIpv4Src object -func (obj *patternFlowIpv4Src) SetValue(value string) PatternFlowIpv4Src { - obj.setChoice(PatternFlowIpv4SrcChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowIpv4Src) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"0.0.0.0"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowIpv4Src object -func (obj *patternFlowIpv4Src) SetValues(value []string) PatternFlowIpv4Src { - obj.setChoice(PatternFlowIpv4SrcChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4SrcCounter -func (obj *patternFlowIpv4Src) Increment() PatternFlowIpv4SrcCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4SrcChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4SrcCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4SrcCounter -func (obj *patternFlowIpv4Src) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4SrcCounter value in the PatternFlowIpv4Src object -func (obj *patternFlowIpv4Src) SetIncrement(value PatternFlowIpv4SrcCounter) PatternFlowIpv4Src { - obj.setChoice(PatternFlowIpv4SrcChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4SrcCounter -func (obj *patternFlowIpv4Src) Decrement() PatternFlowIpv4SrcCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4SrcChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4SrcCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4SrcCounter -func (obj *patternFlowIpv4Src) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4SrcCounter value in the PatternFlowIpv4Src object -func (obj *patternFlowIpv4Src) SetDecrement(value PatternFlowIpv4SrcCounter) PatternFlowIpv4Src { - obj.setChoice(PatternFlowIpv4SrcChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4SrcMetricTag -func (obj *patternFlowIpv4Src) MetricTags() PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4SrcMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter struct { - obj *patternFlowIpv4Src - patternFlowIpv4SrcMetricTagSlice []PatternFlowIpv4SrcMetricTag - fieldPtr *[]*otg.PatternFlowIpv4SrcMetricTag -} - -func newPatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter(ptr *[]*otg.PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { - return &patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter interface { - setMsg(*patternFlowIpv4Src) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter - Items() []PatternFlowIpv4SrcMetricTag - Add() PatternFlowIpv4SrcMetricTag - Append(items ...PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter - Set(index int, newObj PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter - Clear() PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter - clearHolderSlice() PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter - appendHolderSlice(item PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter -} - -func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) setMsg(msg *patternFlowIpv4Src) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4SrcMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) Items() []PatternFlowIpv4SrcMetricTag { - return obj.patternFlowIpv4SrcMetricTagSlice -} - -func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) Add() PatternFlowIpv4SrcMetricTag { - newObj := &otg.PatternFlowIpv4SrcMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4SrcMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4SrcMetricTagSlice = append(obj.patternFlowIpv4SrcMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) Append(items ...PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4SrcMetricTagSlice = append(obj.patternFlowIpv4SrcMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) Set(index int, newObj PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4SrcMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) Clear() PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4SrcMetricTag{} - obj.patternFlowIpv4SrcMetricTagSlice = []PatternFlowIpv4SrcMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) clearHolderSlice() PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { - if len(obj.patternFlowIpv4SrcMetricTagSlice) > 0 { - obj.patternFlowIpv4SrcMetricTagSlice = []PatternFlowIpv4SrcMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) appendHolderSlice(item PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { - obj.patternFlowIpv4SrcMetricTagSlice = append(obj.patternFlowIpv4SrcMetricTagSlice, item) - return obj -} - -// description is TBD -// Auto returns a FlowIpv4Auto -func (obj *patternFlowIpv4Src) Auto() FlowIpv4Auto { - if obj.obj.Auto == nil { - obj.setChoice(PatternFlowIpv4SrcChoice.AUTO) - } - if obj.autoHolder == nil { - obj.autoHolder = &flowIpv4Auto{obj: obj.obj.Auto} - } - return obj.autoHolder -} - -// description is TBD -// Auto returns a FlowIpv4Auto -func (obj *patternFlowIpv4Src) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Random returns a PatternFlowIpv4SrcRandom -func (obj *patternFlowIpv4Src) Random() PatternFlowIpv4SrcRandom { - if obj.obj.Random == nil { - obj.setChoice(PatternFlowIpv4SrcChoice.RANDOM) - } - if obj.randomHolder == nil { - obj.randomHolder = &patternFlowIpv4SrcRandom{obj: obj.obj.Random} - } - return obj.randomHolder -} - -// description is TBD -// Random returns a PatternFlowIpv4SrcRandom -func (obj *patternFlowIpv4Src) HasRandom() bool { - return obj.obj.Random != nil -} - -// description is TBD -// SetRandom sets the PatternFlowIpv4SrcRandom value in the PatternFlowIpv4Src object -func (obj *patternFlowIpv4Src) SetRandom(value PatternFlowIpv4SrcRandom) PatternFlowIpv4Src { - obj.setChoice(PatternFlowIpv4SrcChoice.RANDOM) - obj.randomHolder = nil - obj.obj.Random = value.msg() - - return obj -} - -func (obj *patternFlowIpv4Src) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv4(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4Src.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateIpv4Slice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4Src.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4SrcMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Auto != nil { - - obj.Auto().validateObj(vObj, set_default) - } - - if obj.obj.Random != nil { - - obj.Random().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowIpv4Src) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4SrcChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4SrcChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4SrcChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4SrcChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4SrcChoice.DECREMENT - } - - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowIpv4SrcChoice.AUTO - } - - if obj.obj.Random != nil { - choices_set += 1 - choice = PatternFlowIpv4SrcChoice.RANDOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4SrcChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4Src") - } - } else { - intVal := otg.PatternFlowIpv4Src_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4Src_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4Dst ***** -type patternFlowIpv4Dst struct { - validation - obj *otg.PatternFlowIpv4Dst - marshaller marshalPatternFlowIpv4Dst - unMarshaller unMarshalPatternFlowIpv4Dst - incrementHolder PatternFlowIpv4DstCounter - decrementHolder PatternFlowIpv4DstCounter - metricTagsHolder PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter - autoHolder FlowIpv4Auto - randomHolder PatternFlowIpv4DstRandom -} - -func NewPatternFlowIpv4Dst() PatternFlowIpv4Dst { - obj := patternFlowIpv4Dst{obj: &otg.PatternFlowIpv4Dst{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4Dst) msg() *otg.PatternFlowIpv4Dst { - return obj.obj -} - -func (obj *patternFlowIpv4Dst) setMsg(msg *otg.PatternFlowIpv4Dst) PatternFlowIpv4Dst { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4Dst struct { - obj *patternFlowIpv4Dst -} - -type marshalPatternFlowIpv4Dst interface { - // ToProto marshals PatternFlowIpv4Dst to protobuf object *otg.PatternFlowIpv4Dst - ToProto() (*otg.PatternFlowIpv4Dst, error) - // ToPbText marshals PatternFlowIpv4Dst to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4Dst to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4Dst to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4Dst struct { - obj *patternFlowIpv4Dst -} - -type unMarshalPatternFlowIpv4Dst interface { - // FromProto unmarshals PatternFlowIpv4Dst from protobuf object *otg.PatternFlowIpv4Dst - FromProto(msg *otg.PatternFlowIpv4Dst) (PatternFlowIpv4Dst, error) - // FromPbText unmarshals PatternFlowIpv4Dst from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4Dst from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4Dst from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4Dst) Marshal() marshalPatternFlowIpv4Dst { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4Dst{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4Dst) Unmarshal() unMarshalPatternFlowIpv4Dst { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4Dst{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4Dst) ToProto() (*otg.PatternFlowIpv4Dst, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4Dst) FromProto(msg *otg.PatternFlowIpv4Dst) (PatternFlowIpv4Dst, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4Dst) 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 *unMarshalpatternFlowIpv4Dst) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4Dst) 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 *unMarshalpatternFlowIpv4Dst) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4Dst) 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 *unMarshalpatternFlowIpv4Dst) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4Dst) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4Dst) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4Dst) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4Dst) Clone() (PatternFlowIpv4Dst, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4Dst() - 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 -} - -func (obj *patternFlowIpv4Dst) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.autoHolder = nil - obj.randomHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4Dst is destination address -type PatternFlowIpv4Dst interface { - Validation - // msg marshals PatternFlowIpv4Dst to protobuf object *otg.PatternFlowIpv4Dst - // and doesn't set defaults - msg() *otg.PatternFlowIpv4Dst - // setMsg unmarshals PatternFlowIpv4Dst from protobuf object *otg.PatternFlowIpv4Dst - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4Dst) PatternFlowIpv4Dst - // provides marshal interface - Marshal() marshalPatternFlowIpv4Dst - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4Dst - // validate validates PatternFlowIpv4Dst - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4Dst, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4DstChoiceEnum, set in PatternFlowIpv4Dst - Choice() PatternFlowIpv4DstChoiceEnum - // setChoice assigns PatternFlowIpv4DstChoiceEnum provided by user to PatternFlowIpv4Dst - setChoice(value PatternFlowIpv4DstChoiceEnum) PatternFlowIpv4Dst - // HasChoice checks if Choice has been set in PatternFlowIpv4Dst - HasChoice() bool - // Value returns string, set in PatternFlowIpv4Dst. - Value() string - // SetValue assigns string provided by user to PatternFlowIpv4Dst - SetValue(value string) PatternFlowIpv4Dst - // HasValue checks if Value has been set in PatternFlowIpv4Dst - HasValue() bool - // Values returns []string, set in PatternFlowIpv4Dst. - Values() []string - // SetValues assigns []string provided by user to PatternFlowIpv4Dst - SetValues(value []string) PatternFlowIpv4Dst - // Increment returns PatternFlowIpv4DstCounter, set in PatternFlowIpv4Dst. - // PatternFlowIpv4DstCounter is ipv4 counter pattern - Increment() PatternFlowIpv4DstCounter - // SetIncrement assigns PatternFlowIpv4DstCounter provided by user to PatternFlowIpv4Dst. - // PatternFlowIpv4DstCounter is ipv4 counter pattern - SetIncrement(value PatternFlowIpv4DstCounter) PatternFlowIpv4Dst - // HasIncrement checks if Increment has been set in PatternFlowIpv4Dst - HasIncrement() bool - // Decrement returns PatternFlowIpv4DstCounter, set in PatternFlowIpv4Dst. - // PatternFlowIpv4DstCounter is ipv4 counter pattern - Decrement() PatternFlowIpv4DstCounter - // SetDecrement assigns PatternFlowIpv4DstCounter provided by user to PatternFlowIpv4Dst. - // PatternFlowIpv4DstCounter is ipv4 counter pattern - SetDecrement(value PatternFlowIpv4DstCounter) PatternFlowIpv4Dst - // HasDecrement checks if Decrement has been set in PatternFlowIpv4Dst - HasDecrement() bool - // MetricTags returns PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIterIter, set in PatternFlowIpv4Dst - MetricTags() PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter - // Auto returns FlowIpv4Auto, set in PatternFlowIpv4Dst. - // FlowIpv4Auto is the OTG implementation can provide a system generated, value for this property. - Auto() FlowIpv4Auto - // HasAuto checks if Auto has been set in PatternFlowIpv4Dst - HasAuto() bool - // Random returns PatternFlowIpv4DstRandom, set in PatternFlowIpv4Dst. - // PatternFlowIpv4DstRandom is ipv4 random pattern - Random() PatternFlowIpv4DstRandom - // SetRandom assigns PatternFlowIpv4DstRandom provided by user to PatternFlowIpv4Dst. - // PatternFlowIpv4DstRandom is ipv4 random pattern - SetRandom(value PatternFlowIpv4DstRandom) PatternFlowIpv4Dst - // HasRandom checks if Random has been set in PatternFlowIpv4Dst - HasRandom() bool - setNil() -} - -type PatternFlowIpv4DstChoiceEnum string - -// Enum of Choice on PatternFlowIpv4Dst -var PatternFlowIpv4DstChoice = struct { - VALUE PatternFlowIpv4DstChoiceEnum - VALUES PatternFlowIpv4DstChoiceEnum - INCREMENT PatternFlowIpv4DstChoiceEnum - DECREMENT PatternFlowIpv4DstChoiceEnum - AUTO PatternFlowIpv4DstChoiceEnum - RANDOM PatternFlowIpv4DstChoiceEnum -}{ - VALUE: PatternFlowIpv4DstChoiceEnum("value"), - VALUES: PatternFlowIpv4DstChoiceEnum("values"), - INCREMENT: PatternFlowIpv4DstChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4DstChoiceEnum("decrement"), - AUTO: PatternFlowIpv4DstChoiceEnum("auto"), - RANDOM: PatternFlowIpv4DstChoiceEnum("random"), -} - -func (obj *patternFlowIpv4Dst) Choice() PatternFlowIpv4DstChoiceEnum { - return PatternFlowIpv4DstChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4Dst) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4Dst) setChoice(value PatternFlowIpv4DstChoiceEnum) PatternFlowIpv4Dst { - intValue, ok := otg.PatternFlowIpv4Dst_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4DstChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4Dst_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Random = nil - obj.randomHolder = nil - obj.obj.Auto = nil - obj.autoHolder = nil - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4DstChoice.VALUE { - defaultValue := "0.0.0.0" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4DstChoice.VALUES { - defaultValue := []string{"0.0.0.0"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4DstChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4DstCounter().msg() - } - - if value == PatternFlowIpv4DstChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4DstCounter().msg() - } - - if value == PatternFlowIpv4DstChoice.AUTO { - obj.obj.Auto = NewFlowIpv4Auto().msg() - } - - if value == PatternFlowIpv4DstChoice.RANDOM { - obj.obj.Random = NewPatternFlowIpv4DstRandom().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowIpv4Dst) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4DstChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowIpv4Dst) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowIpv4Dst object -func (obj *patternFlowIpv4Dst) SetValue(value string) PatternFlowIpv4Dst { - obj.setChoice(PatternFlowIpv4DstChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowIpv4Dst) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"0.0.0.0"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowIpv4Dst object -func (obj *patternFlowIpv4Dst) SetValues(value []string) PatternFlowIpv4Dst { - obj.setChoice(PatternFlowIpv4DstChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4DstCounter -func (obj *patternFlowIpv4Dst) Increment() PatternFlowIpv4DstCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4DstChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4DstCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4DstCounter -func (obj *patternFlowIpv4Dst) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4DstCounter value in the PatternFlowIpv4Dst object -func (obj *patternFlowIpv4Dst) SetIncrement(value PatternFlowIpv4DstCounter) PatternFlowIpv4Dst { - obj.setChoice(PatternFlowIpv4DstChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4DstCounter -func (obj *patternFlowIpv4Dst) Decrement() PatternFlowIpv4DstCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4DstChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4DstCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4DstCounter -func (obj *patternFlowIpv4Dst) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4DstCounter value in the PatternFlowIpv4Dst object -func (obj *patternFlowIpv4Dst) SetDecrement(value PatternFlowIpv4DstCounter) PatternFlowIpv4Dst { - obj.setChoice(PatternFlowIpv4DstChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4DstMetricTag -func (obj *patternFlowIpv4Dst) MetricTags() PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4DstMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter struct { - obj *patternFlowIpv4Dst - patternFlowIpv4DstMetricTagSlice []PatternFlowIpv4DstMetricTag - fieldPtr *[]*otg.PatternFlowIpv4DstMetricTag -} - -func newPatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter(ptr *[]*otg.PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { - return &patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter interface { - setMsg(*patternFlowIpv4Dst) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter - Items() []PatternFlowIpv4DstMetricTag - Add() PatternFlowIpv4DstMetricTag - Append(items ...PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter - Set(index int, newObj PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter - Clear() PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter - clearHolderSlice() PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter - appendHolderSlice(item PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter -} - -func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) setMsg(msg *patternFlowIpv4Dst) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4DstMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) Items() []PatternFlowIpv4DstMetricTag { - return obj.patternFlowIpv4DstMetricTagSlice -} - -func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) Add() PatternFlowIpv4DstMetricTag { - newObj := &otg.PatternFlowIpv4DstMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4DstMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4DstMetricTagSlice = append(obj.patternFlowIpv4DstMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) Append(items ...PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4DstMetricTagSlice = append(obj.patternFlowIpv4DstMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) Set(index int, newObj PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4DstMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) Clear() PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4DstMetricTag{} - obj.patternFlowIpv4DstMetricTagSlice = []PatternFlowIpv4DstMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) clearHolderSlice() PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { - if len(obj.patternFlowIpv4DstMetricTagSlice) > 0 { - obj.patternFlowIpv4DstMetricTagSlice = []PatternFlowIpv4DstMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) appendHolderSlice(item PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { - obj.patternFlowIpv4DstMetricTagSlice = append(obj.patternFlowIpv4DstMetricTagSlice, item) - return obj -} - -// description is TBD -// Auto returns a FlowIpv4Auto -func (obj *patternFlowIpv4Dst) Auto() FlowIpv4Auto { - if obj.obj.Auto == nil { - obj.setChoice(PatternFlowIpv4DstChoice.AUTO) - } - if obj.autoHolder == nil { - obj.autoHolder = &flowIpv4Auto{obj: obj.obj.Auto} - } - return obj.autoHolder -} - -// description is TBD -// Auto returns a FlowIpv4Auto -func (obj *patternFlowIpv4Dst) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Random returns a PatternFlowIpv4DstRandom -func (obj *patternFlowIpv4Dst) Random() PatternFlowIpv4DstRandom { - if obj.obj.Random == nil { - obj.setChoice(PatternFlowIpv4DstChoice.RANDOM) - } - if obj.randomHolder == nil { - obj.randomHolder = &patternFlowIpv4DstRandom{obj: obj.obj.Random} - } - return obj.randomHolder -} - -// description is TBD -// Random returns a PatternFlowIpv4DstRandom -func (obj *patternFlowIpv4Dst) HasRandom() bool { - return obj.obj.Random != nil -} - -// description is TBD -// SetRandom sets the PatternFlowIpv4DstRandom value in the PatternFlowIpv4Dst object -func (obj *patternFlowIpv4Dst) SetRandom(value PatternFlowIpv4DstRandom) PatternFlowIpv4Dst { - obj.setChoice(PatternFlowIpv4DstChoice.RANDOM) - obj.randomHolder = nil - obj.obj.Random = value.msg() - - return obj -} - -func (obj *patternFlowIpv4Dst) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv4(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4Dst.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateIpv4Slice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4Dst.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4DstMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Auto != nil { - - obj.Auto().validateObj(vObj, set_default) - } - - if obj.obj.Random != nil { - - obj.Random().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowIpv4Dst) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4DstChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4DstChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4DstChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4DstChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4DstChoice.DECREMENT - } - - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowIpv4DstChoice.AUTO - } - - if obj.obj.Random != nil { - choices_set += 1 - choice = PatternFlowIpv4DstChoice.RANDOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4DstChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4Dst") - } - } else { - intVal := otg.PatternFlowIpv4Dst_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4Dst_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowIpv4Options ***** -type flowIpv4Options struct { - validation - obj *otg.FlowIpv4Options - marshaller marshalFlowIpv4Options - unMarshaller unMarshalFlowIpv4Options - customHolder FlowIpv4OptionsCustom -} - -func NewFlowIpv4Options() FlowIpv4Options { - obj := flowIpv4Options{obj: &otg.FlowIpv4Options{}} - obj.setDefault() - return &obj -} - -func (obj *flowIpv4Options) msg() *otg.FlowIpv4Options { - return obj.obj -} - -func (obj *flowIpv4Options) setMsg(msg *otg.FlowIpv4Options) FlowIpv4Options { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIpv4Options struct { - obj *flowIpv4Options -} - -type marshalFlowIpv4Options interface { - // ToProto marshals FlowIpv4Options to protobuf object *otg.FlowIpv4Options - ToProto() (*otg.FlowIpv4Options, error) - // ToPbText marshals FlowIpv4Options to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIpv4Options to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIpv4Options to JSON text - ToJson() (string, error) -} - -type unMarshalflowIpv4Options struct { - obj *flowIpv4Options -} - -type unMarshalFlowIpv4Options interface { - // FromProto unmarshals FlowIpv4Options from protobuf object *otg.FlowIpv4Options - FromProto(msg *otg.FlowIpv4Options) (FlowIpv4Options, error) - // FromPbText unmarshals FlowIpv4Options from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIpv4Options from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIpv4Options from JSON text - FromJson(value string) error -} - -func (obj *flowIpv4Options) Marshal() marshalFlowIpv4Options { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIpv4Options{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIpv4Options) Unmarshal() unMarshalFlowIpv4Options { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIpv4Options{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIpv4Options) ToProto() (*otg.FlowIpv4Options, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIpv4Options) FromProto(msg *otg.FlowIpv4Options) (FlowIpv4Options, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIpv4Options) 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 *unMarshalflowIpv4Options) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowIpv4Options) 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 *unMarshalflowIpv4Options) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowIpv4Options) 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 *unMarshalflowIpv4Options) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowIpv4Options) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIpv4Options) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIpv4Options) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIpv4Options) Clone() (FlowIpv4Options, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIpv4Options() - 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 -} - -func (obj *flowIpv4Options) setNil() { - obj.customHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowIpv4Options is iPv4 options are optional extensions for the IPv4 header that can be utilised to provide additional information about the IPv4 datagram. It is encoded as a series of type, length and value attributes. The IP header length MUST be increased to accommodate the extra bytes needed to encode the IP options. The length of the all options included to a IPv4 header should not exceed 40 bytes since IPv4 Header length (4 bits) can at max specify 15 4-word octets for a total of 60 bytes which includes 20 bytes needed for mandatory attributes of the IPv4 header. If the user adds multiples IPv4 options that exceeds 40 bytes and specify header length as "auto", implementation should throw error. Currently IP options supported are: 1. router_alert option allows devices to intercept packets not addressed to them directly as defined in RFC2113. 2. custom option is provided to configure user defined IP options as needed. -type FlowIpv4Options interface { - Validation - // msg marshals FlowIpv4Options to protobuf object *otg.FlowIpv4Options - // and doesn't set defaults - msg() *otg.FlowIpv4Options - // setMsg unmarshals FlowIpv4Options from protobuf object *otg.FlowIpv4Options - // and doesn't set defaults - setMsg(*otg.FlowIpv4Options) FlowIpv4Options - // provides marshal interface - Marshal() marshalFlowIpv4Options - // provides unmarshal interface - Unmarshal() unMarshalFlowIpv4Options - // validate validates FlowIpv4Options - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIpv4Options, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowIpv4OptionsChoiceEnum, set in FlowIpv4Options - Choice() FlowIpv4OptionsChoiceEnum - // setChoice assigns FlowIpv4OptionsChoiceEnum provided by user to FlowIpv4Options - setChoice(value FlowIpv4OptionsChoiceEnum) FlowIpv4Options - // HasChoice checks if Choice has been set in FlowIpv4Options - HasChoice() bool - // getter for RouterAlert to set choice. - RouterAlert() - // Custom returns FlowIpv4OptionsCustom, set in FlowIpv4Options. - // FlowIpv4OptionsCustom is user defined IP options to be appended to the IPv4 header. - Custom() FlowIpv4OptionsCustom - // SetCustom assigns FlowIpv4OptionsCustom provided by user to FlowIpv4Options. - // FlowIpv4OptionsCustom is user defined IP options to be appended to the IPv4 header. - SetCustom(value FlowIpv4OptionsCustom) FlowIpv4Options - // HasCustom checks if Custom has been set in FlowIpv4Options - HasCustom() bool - setNil() -} - -type FlowIpv4OptionsChoiceEnum string - -// Enum of Choice on FlowIpv4Options -var FlowIpv4OptionsChoice = struct { - ROUTER_ALERT FlowIpv4OptionsChoiceEnum - CUSTOM FlowIpv4OptionsChoiceEnum -}{ - ROUTER_ALERT: FlowIpv4OptionsChoiceEnum("router_alert"), - CUSTOM: FlowIpv4OptionsChoiceEnum("custom"), -} - -func (obj *flowIpv4Options) Choice() FlowIpv4OptionsChoiceEnum { - return FlowIpv4OptionsChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// getter for RouterAlert to set choice -func (obj *flowIpv4Options) RouterAlert() { - obj.setChoice(FlowIpv4OptionsChoice.ROUTER_ALERT) -} - -// description is TBD -// Choice returns a string -func (obj *flowIpv4Options) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowIpv4Options) setChoice(value FlowIpv4OptionsChoiceEnum) FlowIpv4Options { - intValue, ok := otg.FlowIpv4Options_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowIpv4OptionsChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowIpv4Options_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Custom = nil - obj.customHolder = nil - - if value == FlowIpv4OptionsChoice.CUSTOM { - obj.obj.Custom = NewFlowIpv4OptionsCustom().msg() - } - - return obj -} - -// description is TBD -// Custom returns a FlowIpv4OptionsCustom -func (obj *flowIpv4Options) Custom() FlowIpv4OptionsCustom { - if obj.obj.Custom == nil { - obj.setChoice(FlowIpv4OptionsChoice.CUSTOM) - } - if obj.customHolder == nil { - obj.customHolder = &flowIpv4OptionsCustom{obj: obj.obj.Custom} - } - return obj.customHolder -} - -// description is TBD -// Custom returns a FlowIpv4OptionsCustom -func (obj *flowIpv4Options) HasCustom() bool { - return obj.obj.Custom != nil -} - -// description is TBD -// SetCustom sets the FlowIpv4OptionsCustom value in the FlowIpv4Options object -func (obj *flowIpv4Options) SetCustom(value FlowIpv4OptionsCustom) FlowIpv4Options { - obj.setChoice(FlowIpv4OptionsChoice.CUSTOM) - obj.customHolder = nil - obj.obj.Custom = value.msg() - - return obj -} - -func (obj *flowIpv4Options) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Custom != nil { - - obj.Custom().validateObj(vObj, set_default) - } - -} - -func (obj *flowIpv4Options) setDefault() { - var choices_set int = 0 - var choice FlowIpv4OptionsChoiceEnum - - if obj.obj.Custom != nil { - choices_set += 1 - choice = FlowIpv4OptionsChoice.CUSTOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowIpv4OptionsChoice.ROUTER_ALERT) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowIpv4Options") - } - } else { - intVal := otg.FlowIpv4Options_Choice_Enum_value[string(choice)] - enumValue := otg.FlowIpv4Options_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv6Version ***** -type patternFlowIpv6Version struct { - validation - obj *otg.PatternFlowIpv6Version - marshaller marshalPatternFlowIpv6Version - unMarshaller unMarshalPatternFlowIpv6Version - incrementHolder PatternFlowIpv6VersionCounter - decrementHolder PatternFlowIpv6VersionCounter - metricTagsHolder PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter -} - -func NewPatternFlowIpv6Version() PatternFlowIpv6Version { - obj := patternFlowIpv6Version{obj: &otg.PatternFlowIpv6Version{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6Version) msg() *otg.PatternFlowIpv6Version { - return obj.obj -} - -func (obj *patternFlowIpv6Version) setMsg(msg *otg.PatternFlowIpv6Version) PatternFlowIpv6Version { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6Version struct { - obj *patternFlowIpv6Version -} - -type marshalPatternFlowIpv6Version interface { - // ToProto marshals PatternFlowIpv6Version to protobuf object *otg.PatternFlowIpv6Version - ToProto() (*otg.PatternFlowIpv6Version, error) - // ToPbText marshals PatternFlowIpv6Version to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6Version to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6Version to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6Version struct { - obj *patternFlowIpv6Version -} - -type unMarshalPatternFlowIpv6Version interface { - // FromProto unmarshals PatternFlowIpv6Version from protobuf object *otg.PatternFlowIpv6Version - FromProto(msg *otg.PatternFlowIpv6Version) (PatternFlowIpv6Version, error) - // FromPbText unmarshals PatternFlowIpv6Version from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6Version from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6Version from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6Version) Marshal() marshalPatternFlowIpv6Version { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6Version{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6Version) Unmarshal() unMarshalPatternFlowIpv6Version { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6Version{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6Version) ToProto() (*otg.PatternFlowIpv6Version, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6Version) FromProto(msg *otg.PatternFlowIpv6Version) (PatternFlowIpv6Version, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6Version) 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 *unMarshalpatternFlowIpv6Version) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv6Version) 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 *unMarshalpatternFlowIpv6Version) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv6Version) 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 *unMarshalpatternFlowIpv6Version) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv6Version) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6Version) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6Version) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6Version) Clone() (PatternFlowIpv6Version, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6Version() - 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 -} - -func (obj *patternFlowIpv6Version) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv6Version is version number -type PatternFlowIpv6Version interface { - Validation - // msg marshals PatternFlowIpv6Version to protobuf object *otg.PatternFlowIpv6Version - // and doesn't set defaults - msg() *otg.PatternFlowIpv6Version - // setMsg unmarshals PatternFlowIpv6Version from protobuf object *otg.PatternFlowIpv6Version - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6Version) PatternFlowIpv6Version - // provides marshal interface - Marshal() marshalPatternFlowIpv6Version - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6Version - // validate validates PatternFlowIpv6Version - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6Version, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv6VersionChoiceEnum, set in PatternFlowIpv6Version - Choice() PatternFlowIpv6VersionChoiceEnum - // setChoice assigns PatternFlowIpv6VersionChoiceEnum provided by user to PatternFlowIpv6Version - setChoice(value PatternFlowIpv6VersionChoiceEnum) PatternFlowIpv6Version - // HasChoice checks if Choice has been set in PatternFlowIpv6Version - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv6Version. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv6Version - SetValue(value uint32) PatternFlowIpv6Version - // HasValue checks if Value has been set in PatternFlowIpv6Version - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv6Version. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv6Version - SetValues(value []uint32) PatternFlowIpv6Version - // Increment returns PatternFlowIpv6VersionCounter, set in PatternFlowIpv6Version. - // PatternFlowIpv6VersionCounter is integer counter pattern - Increment() PatternFlowIpv6VersionCounter - // SetIncrement assigns PatternFlowIpv6VersionCounter provided by user to PatternFlowIpv6Version. - // PatternFlowIpv6VersionCounter is integer counter pattern - SetIncrement(value PatternFlowIpv6VersionCounter) PatternFlowIpv6Version - // HasIncrement checks if Increment has been set in PatternFlowIpv6Version - HasIncrement() bool - // Decrement returns PatternFlowIpv6VersionCounter, set in PatternFlowIpv6Version. - // PatternFlowIpv6VersionCounter is integer counter pattern - Decrement() PatternFlowIpv6VersionCounter - // SetDecrement assigns PatternFlowIpv6VersionCounter provided by user to PatternFlowIpv6Version. - // PatternFlowIpv6VersionCounter is integer counter pattern - SetDecrement(value PatternFlowIpv6VersionCounter) PatternFlowIpv6Version - // HasDecrement checks if Decrement has been set in PatternFlowIpv6Version - HasDecrement() bool - // MetricTags returns PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIterIter, set in PatternFlowIpv6Version - MetricTags() PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter - setNil() -} - -type PatternFlowIpv6VersionChoiceEnum string - -// Enum of Choice on PatternFlowIpv6Version -var PatternFlowIpv6VersionChoice = struct { - VALUE PatternFlowIpv6VersionChoiceEnum - VALUES PatternFlowIpv6VersionChoiceEnum - INCREMENT PatternFlowIpv6VersionChoiceEnum - DECREMENT PatternFlowIpv6VersionChoiceEnum -}{ - VALUE: PatternFlowIpv6VersionChoiceEnum("value"), - VALUES: PatternFlowIpv6VersionChoiceEnum("values"), - INCREMENT: PatternFlowIpv6VersionChoiceEnum("increment"), - DECREMENT: PatternFlowIpv6VersionChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv6Version) Choice() PatternFlowIpv6VersionChoiceEnum { - return PatternFlowIpv6VersionChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv6Version) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv6Version) setChoice(value PatternFlowIpv6VersionChoiceEnum) PatternFlowIpv6Version { - intValue, ok := otg.PatternFlowIpv6Version_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv6VersionChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv6Version_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv6VersionChoice.VALUE { - defaultValue := uint32(6) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv6VersionChoice.VALUES { - defaultValue := []uint32{6} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv6VersionChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv6VersionCounter().msg() - } - - if value == PatternFlowIpv6VersionChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv6VersionCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv6Version) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv6VersionChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv6Version) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv6Version object -func (obj *patternFlowIpv6Version) SetValue(value uint32) PatternFlowIpv6Version { - obj.setChoice(PatternFlowIpv6VersionChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv6Version) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{6}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv6Version object -func (obj *patternFlowIpv6Version) SetValues(value []uint32) PatternFlowIpv6Version { - obj.setChoice(PatternFlowIpv6VersionChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv6VersionCounter -func (obj *patternFlowIpv6Version) Increment() PatternFlowIpv6VersionCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv6VersionChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv6VersionCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv6VersionCounter -func (obj *patternFlowIpv6Version) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv6VersionCounter value in the PatternFlowIpv6Version object -func (obj *patternFlowIpv6Version) SetIncrement(value PatternFlowIpv6VersionCounter) PatternFlowIpv6Version { - obj.setChoice(PatternFlowIpv6VersionChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv6VersionCounter -func (obj *patternFlowIpv6Version) Decrement() PatternFlowIpv6VersionCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv6VersionChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv6VersionCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv6VersionCounter -func (obj *patternFlowIpv6Version) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv6VersionCounter value in the PatternFlowIpv6Version object -func (obj *patternFlowIpv6Version) SetDecrement(value PatternFlowIpv6VersionCounter) PatternFlowIpv6Version { - obj.setChoice(PatternFlowIpv6VersionChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv6VersionMetricTag -func (obj *patternFlowIpv6Version) MetricTags() PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv6VersionMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter struct { - obj *patternFlowIpv6Version - patternFlowIpv6VersionMetricTagSlice []PatternFlowIpv6VersionMetricTag - fieldPtr *[]*otg.PatternFlowIpv6VersionMetricTag -} - -func newPatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter(ptr *[]*otg.PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { - return &patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter interface { - setMsg(*patternFlowIpv6Version) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter - Items() []PatternFlowIpv6VersionMetricTag - Add() PatternFlowIpv6VersionMetricTag - Append(items ...PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter - Set(index int, newObj PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter - Clear() PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter - clearHolderSlice() PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter - appendHolderSlice(item PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter -} - -func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) setMsg(msg *patternFlowIpv6Version) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv6VersionMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) Items() []PatternFlowIpv6VersionMetricTag { - return obj.patternFlowIpv6VersionMetricTagSlice -} - -func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) Add() PatternFlowIpv6VersionMetricTag { - newObj := &otg.PatternFlowIpv6VersionMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv6VersionMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv6VersionMetricTagSlice = append(obj.patternFlowIpv6VersionMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) Append(items ...PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv6VersionMetricTagSlice = append(obj.patternFlowIpv6VersionMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) Set(index int, newObj PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv6VersionMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) Clear() PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv6VersionMetricTag{} - obj.patternFlowIpv6VersionMetricTagSlice = []PatternFlowIpv6VersionMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) clearHolderSlice() PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { - if len(obj.patternFlowIpv6VersionMetricTagSlice) > 0 { - obj.patternFlowIpv6VersionMetricTagSlice = []PatternFlowIpv6VersionMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) appendHolderSlice(item PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { - obj.patternFlowIpv6VersionMetricTagSlice = append(obj.patternFlowIpv6VersionMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv6Version) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6Version.Value <= 15 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv6Version.Values <= 15 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv6VersionMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv6Version) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv6VersionChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv6VersionChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv6VersionChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv6VersionChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv6VersionChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv6VersionChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6Version") - } - } else { - intVal := otg.PatternFlowIpv6Version_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv6Version_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv6TrafficClass ***** -type patternFlowIpv6TrafficClass struct { - validation - obj *otg.PatternFlowIpv6TrafficClass - marshaller marshalPatternFlowIpv6TrafficClass - unMarshaller unMarshalPatternFlowIpv6TrafficClass - incrementHolder PatternFlowIpv6TrafficClassCounter - decrementHolder PatternFlowIpv6TrafficClassCounter - metricTagsHolder PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter -} - -func NewPatternFlowIpv6TrafficClass() PatternFlowIpv6TrafficClass { - obj := patternFlowIpv6TrafficClass{obj: &otg.PatternFlowIpv6TrafficClass{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6TrafficClass) msg() *otg.PatternFlowIpv6TrafficClass { - return obj.obj -} - -func (obj *patternFlowIpv6TrafficClass) setMsg(msg *otg.PatternFlowIpv6TrafficClass) PatternFlowIpv6TrafficClass { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6TrafficClass struct { - obj *patternFlowIpv6TrafficClass -} - -type marshalPatternFlowIpv6TrafficClass interface { - // ToProto marshals PatternFlowIpv6TrafficClass to protobuf object *otg.PatternFlowIpv6TrafficClass - ToProto() (*otg.PatternFlowIpv6TrafficClass, error) - // ToPbText marshals PatternFlowIpv6TrafficClass to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6TrafficClass to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6TrafficClass to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6TrafficClass struct { - obj *patternFlowIpv6TrafficClass -} - -type unMarshalPatternFlowIpv6TrafficClass interface { - // FromProto unmarshals PatternFlowIpv6TrafficClass from protobuf object *otg.PatternFlowIpv6TrafficClass - FromProto(msg *otg.PatternFlowIpv6TrafficClass) (PatternFlowIpv6TrafficClass, error) - // FromPbText unmarshals PatternFlowIpv6TrafficClass from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6TrafficClass from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6TrafficClass from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6TrafficClass) Marshal() marshalPatternFlowIpv6TrafficClass { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6TrafficClass{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6TrafficClass) Unmarshal() unMarshalPatternFlowIpv6TrafficClass { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6TrafficClass{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6TrafficClass) ToProto() (*otg.PatternFlowIpv6TrafficClass, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6TrafficClass) FromProto(msg *otg.PatternFlowIpv6TrafficClass) (PatternFlowIpv6TrafficClass, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6TrafficClass) 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 *unMarshalpatternFlowIpv6TrafficClass) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv6TrafficClass) 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 *unMarshalpatternFlowIpv6TrafficClass) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv6TrafficClass) 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 *unMarshalpatternFlowIpv6TrafficClass) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv6TrafficClass) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6TrafficClass) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6TrafficClass) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6TrafficClass) Clone() (PatternFlowIpv6TrafficClass, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6TrafficClass() - 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 -} - -func (obj *patternFlowIpv6TrafficClass) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv6TrafficClass is traffic class -type PatternFlowIpv6TrafficClass interface { - Validation - // msg marshals PatternFlowIpv6TrafficClass to protobuf object *otg.PatternFlowIpv6TrafficClass - // and doesn't set defaults - msg() *otg.PatternFlowIpv6TrafficClass - // setMsg unmarshals PatternFlowIpv6TrafficClass from protobuf object *otg.PatternFlowIpv6TrafficClass - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6TrafficClass) PatternFlowIpv6TrafficClass - // provides marshal interface - Marshal() marshalPatternFlowIpv6TrafficClass - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6TrafficClass - // validate validates PatternFlowIpv6TrafficClass - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6TrafficClass, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv6TrafficClassChoiceEnum, set in PatternFlowIpv6TrafficClass - Choice() PatternFlowIpv6TrafficClassChoiceEnum - // setChoice assigns PatternFlowIpv6TrafficClassChoiceEnum provided by user to PatternFlowIpv6TrafficClass - setChoice(value PatternFlowIpv6TrafficClassChoiceEnum) PatternFlowIpv6TrafficClass - // HasChoice checks if Choice has been set in PatternFlowIpv6TrafficClass - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv6TrafficClass. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv6TrafficClass - SetValue(value uint32) PatternFlowIpv6TrafficClass - // HasValue checks if Value has been set in PatternFlowIpv6TrafficClass - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv6TrafficClass. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv6TrafficClass - SetValues(value []uint32) PatternFlowIpv6TrafficClass - // Increment returns PatternFlowIpv6TrafficClassCounter, set in PatternFlowIpv6TrafficClass. - // PatternFlowIpv6TrafficClassCounter is integer counter pattern - Increment() PatternFlowIpv6TrafficClassCounter - // SetIncrement assigns PatternFlowIpv6TrafficClassCounter provided by user to PatternFlowIpv6TrafficClass. - // PatternFlowIpv6TrafficClassCounter is integer counter pattern - SetIncrement(value PatternFlowIpv6TrafficClassCounter) PatternFlowIpv6TrafficClass - // HasIncrement checks if Increment has been set in PatternFlowIpv6TrafficClass - HasIncrement() bool - // Decrement returns PatternFlowIpv6TrafficClassCounter, set in PatternFlowIpv6TrafficClass. - // PatternFlowIpv6TrafficClassCounter is integer counter pattern - Decrement() PatternFlowIpv6TrafficClassCounter - // SetDecrement assigns PatternFlowIpv6TrafficClassCounter provided by user to PatternFlowIpv6TrafficClass. - // PatternFlowIpv6TrafficClassCounter is integer counter pattern - SetDecrement(value PatternFlowIpv6TrafficClassCounter) PatternFlowIpv6TrafficClass - // HasDecrement checks if Decrement has been set in PatternFlowIpv6TrafficClass - HasDecrement() bool - // MetricTags returns PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIterIter, set in PatternFlowIpv6TrafficClass - MetricTags() PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter - setNil() -} - -type PatternFlowIpv6TrafficClassChoiceEnum string - -// Enum of Choice on PatternFlowIpv6TrafficClass -var PatternFlowIpv6TrafficClassChoice = struct { - VALUE PatternFlowIpv6TrafficClassChoiceEnum - VALUES PatternFlowIpv6TrafficClassChoiceEnum - INCREMENT PatternFlowIpv6TrafficClassChoiceEnum - DECREMENT PatternFlowIpv6TrafficClassChoiceEnum -}{ - VALUE: PatternFlowIpv6TrafficClassChoiceEnum("value"), - VALUES: PatternFlowIpv6TrafficClassChoiceEnum("values"), - INCREMENT: PatternFlowIpv6TrafficClassChoiceEnum("increment"), - DECREMENT: PatternFlowIpv6TrafficClassChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv6TrafficClass) Choice() PatternFlowIpv6TrafficClassChoiceEnum { - return PatternFlowIpv6TrafficClassChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv6TrafficClass) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv6TrafficClass) setChoice(value PatternFlowIpv6TrafficClassChoiceEnum) PatternFlowIpv6TrafficClass { - intValue, ok := otg.PatternFlowIpv6TrafficClass_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv6TrafficClassChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv6TrafficClass_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv6TrafficClassChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv6TrafficClassChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv6TrafficClassChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv6TrafficClassCounter().msg() - } - - if value == PatternFlowIpv6TrafficClassChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv6TrafficClassCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv6TrafficClass) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv6TrafficClassChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv6TrafficClass) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv6TrafficClass object -func (obj *patternFlowIpv6TrafficClass) SetValue(value uint32) PatternFlowIpv6TrafficClass { - obj.setChoice(PatternFlowIpv6TrafficClassChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv6TrafficClass) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv6TrafficClass object -func (obj *patternFlowIpv6TrafficClass) SetValues(value []uint32) PatternFlowIpv6TrafficClass { - obj.setChoice(PatternFlowIpv6TrafficClassChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv6TrafficClassCounter -func (obj *patternFlowIpv6TrafficClass) Increment() PatternFlowIpv6TrafficClassCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv6TrafficClassChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv6TrafficClassCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv6TrafficClassCounter -func (obj *patternFlowIpv6TrafficClass) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv6TrafficClassCounter value in the PatternFlowIpv6TrafficClass object -func (obj *patternFlowIpv6TrafficClass) SetIncrement(value PatternFlowIpv6TrafficClassCounter) PatternFlowIpv6TrafficClass { - obj.setChoice(PatternFlowIpv6TrafficClassChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv6TrafficClassCounter -func (obj *patternFlowIpv6TrafficClass) Decrement() PatternFlowIpv6TrafficClassCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv6TrafficClassChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv6TrafficClassCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv6TrafficClassCounter -func (obj *patternFlowIpv6TrafficClass) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv6TrafficClassCounter value in the PatternFlowIpv6TrafficClass object -func (obj *patternFlowIpv6TrafficClass) SetDecrement(value PatternFlowIpv6TrafficClassCounter) PatternFlowIpv6TrafficClass { - obj.setChoice(PatternFlowIpv6TrafficClassChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv6TrafficClassMetricTag -func (obj *patternFlowIpv6TrafficClass) MetricTags() PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv6TrafficClassMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter struct { - obj *patternFlowIpv6TrafficClass - patternFlowIpv6TrafficClassMetricTagSlice []PatternFlowIpv6TrafficClassMetricTag - fieldPtr *[]*otg.PatternFlowIpv6TrafficClassMetricTag -} - -func newPatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter(ptr *[]*otg.PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { - return &patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter interface { - setMsg(*patternFlowIpv6TrafficClass) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter - Items() []PatternFlowIpv6TrafficClassMetricTag - Add() PatternFlowIpv6TrafficClassMetricTag - Append(items ...PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter - Set(index int, newObj PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter - Clear() PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter - clearHolderSlice() PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter - appendHolderSlice(item PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter -} - -func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) setMsg(msg *patternFlowIpv6TrafficClass) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv6TrafficClassMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) Items() []PatternFlowIpv6TrafficClassMetricTag { - return obj.patternFlowIpv6TrafficClassMetricTagSlice -} - -func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) Add() PatternFlowIpv6TrafficClassMetricTag { - newObj := &otg.PatternFlowIpv6TrafficClassMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv6TrafficClassMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv6TrafficClassMetricTagSlice = append(obj.patternFlowIpv6TrafficClassMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) Append(items ...PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv6TrafficClassMetricTagSlice = append(obj.patternFlowIpv6TrafficClassMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) Set(index int, newObj PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv6TrafficClassMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) Clear() PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv6TrafficClassMetricTag{} - obj.patternFlowIpv6TrafficClassMetricTagSlice = []PatternFlowIpv6TrafficClassMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) clearHolderSlice() PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { - if len(obj.patternFlowIpv6TrafficClassMetricTagSlice) > 0 { - obj.patternFlowIpv6TrafficClassMetricTagSlice = []PatternFlowIpv6TrafficClassMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) appendHolderSlice(item PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { - obj.patternFlowIpv6TrafficClassMetricTagSlice = append(obj.patternFlowIpv6TrafficClassMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv6TrafficClass) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6TrafficClass.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv6TrafficClass.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv6TrafficClassMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv6TrafficClass) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv6TrafficClassChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv6TrafficClassChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv6TrafficClassChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv6TrafficClassChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv6TrafficClassChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv6TrafficClassChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6TrafficClass") - } - } else { - intVal := otg.PatternFlowIpv6TrafficClass_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv6TrafficClass_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv6FlowLabel ***** -type patternFlowIpv6FlowLabel struct { - validation - obj *otg.PatternFlowIpv6FlowLabel - marshaller marshalPatternFlowIpv6FlowLabel - unMarshaller unMarshalPatternFlowIpv6FlowLabel - incrementHolder PatternFlowIpv6FlowLabelCounter - decrementHolder PatternFlowIpv6FlowLabelCounter - metricTagsHolder PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter - randomHolder PatternFlowIpv6FlowLabelRandom -} - -func NewPatternFlowIpv6FlowLabel() PatternFlowIpv6FlowLabel { - obj := patternFlowIpv6FlowLabel{obj: &otg.PatternFlowIpv6FlowLabel{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6FlowLabel) msg() *otg.PatternFlowIpv6FlowLabel { - return obj.obj -} - -func (obj *patternFlowIpv6FlowLabel) setMsg(msg *otg.PatternFlowIpv6FlowLabel) PatternFlowIpv6FlowLabel { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6FlowLabel struct { - obj *patternFlowIpv6FlowLabel -} - -type marshalPatternFlowIpv6FlowLabel interface { - // ToProto marshals PatternFlowIpv6FlowLabel to protobuf object *otg.PatternFlowIpv6FlowLabel - ToProto() (*otg.PatternFlowIpv6FlowLabel, error) - // ToPbText marshals PatternFlowIpv6FlowLabel to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6FlowLabel to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6FlowLabel to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6FlowLabel struct { - obj *patternFlowIpv6FlowLabel -} - -type unMarshalPatternFlowIpv6FlowLabel interface { - // FromProto unmarshals PatternFlowIpv6FlowLabel from protobuf object *otg.PatternFlowIpv6FlowLabel - FromProto(msg *otg.PatternFlowIpv6FlowLabel) (PatternFlowIpv6FlowLabel, error) - // FromPbText unmarshals PatternFlowIpv6FlowLabel from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6FlowLabel from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6FlowLabel from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6FlowLabel) Marshal() marshalPatternFlowIpv6FlowLabel { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6FlowLabel{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6FlowLabel) Unmarshal() unMarshalPatternFlowIpv6FlowLabel { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6FlowLabel{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6FlowLabel) ToProto() (*otg.PatternFlowIpv6FlowLabel, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6FlowLabel) FromProto(msg *otg.PatternFlowIpv6FlowLabel) (PatternFlowIpv6FlowLabel, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6FlowLabel) 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 *unMarshalpatternFlowIpv6FlowLabel) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv6FlowLabel) 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 *unMarshalpatternFlowIpv6FlowLabel) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv6FlowLabel) 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 *unMarshalpatternFlowIpv6FlowLabel) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv6FlowLabel) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6FlowLabel) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6FlowLabel) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6FlowLabel) Clone() (PatternFlowIpv6FlowLabel, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6FlowLabel() - 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 -} - -func (obj *patternFlowIpv6FlowLabel) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.randomHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv6FlowLabel is flow label -type PatternFlowIpv6FlowLabel interface { - Validation - // msg marshals PatternFlowIpv6FlowLabel to protobuf object *otg.PatternFlowIpv6FlowLabel - // and doesn't set defaults - msg() *otg.PatternFlowIpv6FlowLabel - // setMsg unmarshals PatternFlowIpv6FlowLabel from protobuf object *otg.PatternFlowIpv6FlowLabel - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6FlowLabel) PatternFlowIpv6FlowLabel - // provides marshal interface - Marshal() marshalPatternFlowIpv6FlowLabel - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6FlowLabel - // validate validates PatternFlowIpv6FlowLabel - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6FlowLabel, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv6FlowLabelChoiceEnum, set in PatternFlowIpv6FlowLabel - Choice() PatternFlowIpv6FlowLabelChoiceEnum - // setChoice assigns PatternFlowIpv6FlowLabelChoiceEnum provided by user to PatternFlowIpv6FlowLabel - setChoice(value PatternFlowIpv6FlowLabelChoiceEnum) PatternFlowIpv6FlowLabel - // HasChoice checks if Choice has been set in PatternFlowIpv6FlowLabel - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv6FlowLabel. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv6FlowLabel - SetValue(value uint32) PatternFlowIpv6FlowLabel - // HasValue checks if Value has been set in PatternFlowIpv6FlowLabel - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv6FlowLabel. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv6FlowLabel - SetValues(value []uint32) PatternFlowIpv6FlowLabel - // Increment returns PatternFlowIpv6FlowLabelCounter, set in PatternFlowIpv6FlowLabel. - // PatternFlowIpv6FlowLabelCounter is integer counter pattern - Increment() PatternFlowIpv6FlowLabelCounter - // SetIncrement assigns PatternFlowIpv6FlowLabelCounter provided by user to PatternFlowIpv6FlowLabel. - // PatternFlowIpv6FlowLabelCounter is integer counter pattern - SetIncrement(value PatternFlowIpv6FlowLabelCounter) PatternFlowIpv6FlowLabel - // HasIncrement checks if Increment has been set in PatternFlowIpv6FlowLabel - HasIncrement() bool - // Decrement returns PatternFlowIpv6FlowLabelCounter, set in PatternFlowIpv6FlowLabel. - // PatternFlowIpv6FlowLabelCounter is integer counter pattern - Decrement() PatternFlowIpv6FlowLabelCounter - // SetDecrement assigns PatternFlowIpv6FlowLabelCounter provided by user to PatternFlowIpv6FlowLabel. - // PatternFlowIpv6FlowLabelCounter is integer counter pattern - SetDecrement(value PatternFlowIpv6FlowLabelCounter) PatternFlowIpv6FlowLabel - // HasDecrement checks if Decrement has been set in PatternFlowIpv6FlowLabel - HasDecrement() bool - // MetricTags returns PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIterIter, set in PatternFlowIpv6FlowLabel - MetricTags() PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter - // Random returns PatternFlowIpv6FlowLabelRandom, set in PatternFlowIpv6FlowLabel. - // PatternFlowIpv6FlowLabelRandom is integer random pattern - Random() PatternFlowIpv6FlowLabelRandom - // SetRandom assigns PatternFlowIpv6FlowLabelRandom provided by user to PatternFlowIpv6FlowLabel. - // PatternFlowIpv6FlowLabelRandom is integer random pattern - SetRandom(value PatternFlowIpv6FlowLabelRandom) PatternFlowIpv6FlowLabel - // HasRandom checks if Random has been set in PatternFlowIpv6FlowLabel - HasRandom() bool - setNil() -} - -type PatternFlowIpv6FlowLabelChoiceEnum string - -// Enum of Choice on PatternFlowIpv6FlowLabel -var PatternFlowIpv6FlowLabelChoice = struct { - VALUE PatternFlowIpv6FlowLabelChoiceEnum - VALUES PatternFlowIpv6FlowLabelChoiceEnum - INCREMENT PatternFlowIpv6FlowLabelChoiceEnum - DECREMENT PatternFlowIpv6FlowLabelChoiceEnum - RANDOM PatternFlowIpv6FlowLabelChoiceEnum -}{ - VALUE: PatternFlowIpv6FlowLabelChoiceEnum("value"), - VALUES: PatternFlowIpv6FlowLabelChoiceEnum("values"), - INCREMENT: PatternFlowIpv6FlowLabelChoiceEnum("increment"), - DECREMENT: PatternFlowIpv6FlowLabelChoiceEnum("decrement"), - RANDOM: PatternFlowIpv6FlowLabelChoiceEnum("random"), -} - -func (obj *patternFlowIpv6FlowLabel) Choice() PatternFlowIpv6FlowLabelChoiceEnum { - return PatternFlowIpv6FlowLabelChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv6FlowLabel) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv6FlowLabel) setChoice(value PatternFlowIpv6FlowLabelChoiceEnum) PatternFlowIpv6FlowLabel { - intValue, ok := otg.PatternFlowIpv6FlowLabel_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv6FlowLabelChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv6FlowLabel_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Random = nil - obj.randomHolder = nil - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv6FlowLabelChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv6FlowLabelChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv6FlowLabelChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv6FlowLabelCounter().msg() - } - - if value == PatternFlowIpv6FlowLabelChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv6FlowLabelCounter().msg() - } - - if value == PatternFlowIpv6FlowLabelChoice.RANDOM { - obj.obj.Random = NewPatternFlowIpv6FlowLabelRandom().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv6FlowLabel) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv6FlowLabelChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv6FlowLabel) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv6FlowLabel object -func (obj *patternFlowIpv6FlowLabel) SetValue(value uint32) PatternFlowIpv6FlowLabel { - obj.setChoice(PatternFlowIpv6FlowLabelChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv6FlowLabel) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv6FlowLabel object -func (obj *patternFlowIpv6FlowLabel) SetValues(value []uint32) PatternFlowIpv6FlowLabel { - obj.setChoice(PatternFlowIpv6FlowLabelChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv6FlowLabelCounter -func (obj *patternFlowIpv6FlowLabel) Increment() PatternFlowIpv6FlowLabelCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv6FlowLabelChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv6FlowLabelCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv6FlowLabelCounter -func (obj *patternFlowIpv6FlowLabel) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv6FlowLabelCounter value in the PatternFlowIpv6FlowLabel object -func (obj *patternFlowIpv6FlowLabel) SetIncrement(value PatternFlowIpv6FlowLabelCounter) PatternFlowIpv6FlowLabel { - obj.setChoice(PatternFlowIpv6FlowLabelChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv6FlowLabelCounter -func (obj *patternFlowIpv6FlowLabel) Decrement() PatternFlowIpv6FlowLabelCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv6FlowLabelChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv6FlowLabelCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv6FlowLabelCounter -func (obj *patternFlowIpv6FlowLabel) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv6FlowLabelCounter value in the PatternFlowIpv6FlowLabel object -func (obj *patternFlowIpv6FlowLabel) SetDecrement(value PatternFlowIpv6FlowLabelCounter) PatternFlowIpv6FlowLabel { - obj.setChoice(PatternFlowIpv6FlowLabelChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv6FlowLabelMetricTag -func (obj *patternFlowIpv6FlowLabel) MetricTags() PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv6FlowLabelMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter struct { - obj *patternFlowIpv6FlowLabel - patternFlowIpv6FlowLabelMetricTagSlice []PatternFlowIpv6FlowLabelMetricTag - fieldPtr *[]*otg.PatternFlowIpv6FlowLabelMetricTag -} - -func newPatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter(ptr *[]*otg.PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { - return &patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter interface { - setMsg(*patternFlowIpv6FlowLabel) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter - Items() []PatternFlowIpv6FlowLabelMetricTag - Add() PatternFlowIpv6FlowLabelMetricTag - Append(items ...PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter - Set(index int, newObj PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter - Clear() PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter - clearHolderSlice() PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter - appendHolderSlice(item PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter -} - -func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) setMsg(msg *patternFlowIpv6FlowLabel) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv6FlowLabelMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) Items() []PatternFlowIpv6FlowLabelMetricTag { - return obj.patternFlowIpv6FlowLabelMetricTagSlice -} - -func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) Add() PatternFlowIpv6FlowLabelMetricTag { - newObj := &otg.PatternFlowIpv6FlowLabelMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv6FlowLabelMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv6FlowLabelMetricTagSlice = append(obj.patternFlowIpv6FlowLabelMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) Append(items ...PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv6FlowLabelMetricTagSlice = append(obj.patternFlowIpv6FlowLabelMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) Set(index int, newObj PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv6FlowLabelMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) Clear() PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv6FlowLabelMetricTag{} - obj.patternFlowIpv6FlowLabelMetricTagSlice = []PatternFlowIpv6FlowLabelMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) clearHolderSlice() PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { - if len(obj.patternFlowIpv6FlowLabelMetricTagSlice) > 0 { - obj.patternFlowIpv6FlowLabelMetricTagSlice = []PatternFlowIpv6FlowLabelMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) appendHolderSlice(item PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { - obj.patternFlowIpv6FlowLabelMetricTagSlice = append(obj.patternFlowIpv6FlowLabelMetricTagSlice, item) - return obj -} - -// description is TBD -// Random returns a PatternFlowIpv6FlowLabelRandom -func (obj *patternFlowIpv6FlowLabel) Random() PatternFlowIpv6FlowLabelRandom { - if obj.obj.Random == nil { - obj.setChoice(PatternFlowIpv6FlowLabelChoice.RANDOM) - } - if obj.randomHolder == nil { - obj.randomHolder = &patternFlowIpv6FlowLabelRandom{obj: obj.obj.Random} - } - return obj.randomHolder -} - -// description is TBD -// Random returns a PatternFlowIpv6FlowLabelRandom -func (obj *patternFlowIpv6FlowLabel) HasRandom() bool { - return obj.obj.Random != nil -} - -// description is TBD -// SetRandom sets the PatternFlowIpv6FlowLabelRandom value in the PatternFlowIpv6FlowLabel object -func (obj *patternFlowIpv6FlowLabel) SetRandom(value PatternFlowIpv6FlowLabelRandom) PatternFlowIpv6FlowLabel { - obj.setChoice(PatternFlowIpv6FlowLabelChoice.RANDOM) - obj.randomHolder = nil - obj.obj.Random = value.msg() - - return obj -} - -func (obj *patternFlowIpv6FlowLabel) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6FlowLabel.Value <= 1048575 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv6FlowLabel.Values <= 1048575 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv6FlowLabelMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Random != nil { - - obj.Random().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowIpv6FlowLabel) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv6FlowLabelChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv6FlowLabelChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv6FlowLabelChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv6FlowLabelChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv6FlowLabelChoice.DECREMENT - } - - if obj.obj.Random != nil { - choices_set += 1 - choice = PatternFlowIpv6FlowLabelChoice.RANDOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv6FlowLabelChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6FlowLabel") - } - } else { - intVal := otg.PatternFlowIpv6FlowLabel_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv6FlowLabel_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv6PayloadLength ***** -type patternFlowIpv6PayloadLength struct { - validation - obj *otg.PatternFlowIpv6PayloadLength - marshaller marshalPatternFlowIpv6PayloadLength - unMarshaller unMarshalPatternFlowIpv6PayloadLength - incrementHolder PatternFlowIpv6PayloadLengthCounter - decrementHolder PatternFlowIpv6PayloadLengthCounter - metricTagsHolder PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter -} - -func NewPatternFlowIpv6PayloadLength() PatternFlowIpv6PayloadLength { - obj := patternFlowIpv6PayloadLength{obj: &otg.PatternFlowIpv6PayloadLength{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6PayloadLength) msg() *otg.PatternFlowIpv6PayloadLength { - return obj.obj -} - -func (obj *patternFlowIpv6PayloadLength) setMsg(msg *otg.PatternFlowIpv6PayloadLength) PatternFlowIpv6PayloadLength { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6PayloadLength struct { - obj *patternFlowIpv6PayloadLength -} - -type marshalPatternFlowIpv6PayloadLength interface { - // ToProto marshals PatternFlowIpv6PayloadLength to protobuf object *otg.PatternFlowIpv6PayloadLength - ToProto() (*otg.PatternFlowIpv6PayloadLength, error) - // ToPbText marshals PatternFlowIpv6PayloadLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6PayloadLength to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6PayloadLength to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6PayloadLength struct { - obj *patternFlowIpv6PayloadLength -} - -type unMarshalPatternFlowIpv6PayloadLength interface { - // FromProto unmarshals PatternFlowIpv6PayloadLength from protobuf object *otg.PatternFlowIpv6PayloadLength - FromProto(msg *otg.PatternFlowIpv6PayloadLength) (PatternFlowIpv6PayloadLength, error) - // FromPbText unmarshals PatternFlowIpv6PayloadLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6PayloadLength from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6PayloadLength from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6PayloadLength) Marshal() marshalPatternFlowIpv6PayloadLength { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6PayloadLength{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6PayloadLength) Unmarshal() unMarshalPatternFlowIpv6PayloadLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6PayloadLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6PayloadLength) ToProto() (*otg.PatternFlowIpv6PayloadLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6PayloadLength) FromProto(msg *otg.PatternFlowIpv6PayloadLength) (PatternFlowIpv6PayloadLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6PayloadLength) 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 *unMarshalpatternFlowIpv6PayloadLength) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv6PayloadLength) 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 *unMarshalpatternFlowIpv6PayloadLength) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv6PayloadLength) 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 *unMarshalpatternFlowIpv6PayloadLength) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv6PayloadLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6PayloadLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6PayloadLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6PayloadLength) Clone() (PatternFlowIpv6PayloadLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6PayloadLength() - 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 -} - -func (obj *patternFlowIpv6PayloadLength) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv6PayloadLength is payload length -type PatternFlowIpv6PayloadLength interface { - Validation - // msg marshals PatternFlowIpv6PayloadLength to protobuf object *otg.PatternFlowIpv6PayloadLength - // and doesn't set defaults - msg() *otg.PatternFlowIpv6PayloadLength - // setMsg unmarshals PatternFlowIpv6PayloadLength from protobuf object *otg.PatternFlowIpv6PayloadLength - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6PayloadLength) PatternFlowIpv6PayloadLength - // provides marshal interface - Marshal() marshalPatternFlowIpv6PayloadLength - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6PayloadLength - // validate validates PatternFlowIpv6PayloadLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6PayloadLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv6PayloadLengthChoiceEnum, set in PatternFlowIpv6PayloadLength - Choice() PatternFlowIpv6PayloadLengthChoiceEnum - // setChoice assigns PatternFlowIpv6PayloadLengthChoiceEnum provided by user to PatternFlowIpv6PayloadLength - setChoice(value PatternFlowIpv6PayloadLengthChoiceEnum) PatternFlowIpv6PayloadLength - // HasChoice checks if Choice has been set in PatternFlowIpv6PayloadLength - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv6PayloadLength. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv6PayloadLength - SetValue(value uint32) PatternFlowIpv6PayloadLength - // HasValue checks if Value has been set in PatternFlowIpv6PayloadLength - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv6PayloadLength. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv6PayloadLength - SetValues(value []uint32) PatternFlowIpv6PayloadLength - // Auto returns uint32, set in PatternFlowIpv6PayloadLength. - Auto() uint32 - // HasAuto checks if Auto has been set in PatternFlowIpv6PayloadLength - HasAuto() bool - // Increment returns PatternFlowIpv6PayloadLengthCounter, set in PatternFlowIpv6PayloadLength. - // PatternFlowIpv6PayloadLengthCounter is integer counter pattern - Increment() PatternFlowIpv6PayloadLengthCounter - // SetIncrement assigns PatternFlowIpv6PayloadLengthCounter provided by user to PatternFlowIpv6PayloadLength. - // PatternFlowIpv6PayloadLengthCounter is integer counter pattern - SetIncrement(value PatternFlowIpv6PayloadLengthCounter) PatternFlowIpv6PayloadLength - // HasIncrement checks if Increment has been set in PatternFlowIpv6PayloadLength - HasIncrement() bool - // Decrement returns PatternFlowIpv6PayloadLengthCounter, set in PatternFlowIpv6PayloadLength. - // PatternFlowIpv6PayloadLengthCounter is integer counter pattern - Decrement() PatternFlowIpv6PayloadLengthCounter - // SetDecrement assigns PatternFlowIpv6PayloadLengthCounter provided by user to PatternFlowIpv6PayloadLength. - // PatternFlowIpv6PayloadLengthCounter is integer counter pattern - SetDecrement(value PatternFlowIpv6PayloadLengthCounter) PatternFlowIpv6PayloadLength - // HasDecrement checks if Decrement has been set in PatternFlowIpv6PayloadLength - HasDecrement() bool - // MetricTags returns PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIterIter, set in PatternFlowIpv6PayloadLength - MetricTags() PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter - setNil() -} - -type PatternFlowIpv6PayloadLengthChoiceEnum string - -// Enum of Choice on PatternFlowIpv6PayloadLength -var PatternFlowIpv6PayloadLengthChoice = struct { - VALUE PatternFlowIpv6PayloadLengthChoiceEnum - VALUES PatternFlowIpv6PayloadLengthChoiceEnum - AUTO PatternFlowIpv6PayloadLengthChoiceEnum - INCREMENT PatternFlowIpv6PayloadLengthChoiceEnum - DECREMENT PatternFlowIpv6PayloadLengthChoiceEnum -}{ - VALUE: PatternFlowIpv6PayloadLengthChoiceEnum("value"), - VALUES: PatternFlowIpv6PayloadLengthChoiceEnum("values"), - AUTO: PatternFlowIpv6PayloadLengthChoiceEnum("auto"), - INCREMENT: PatternFlowIpv6PayloadLengthChoiceEnum("increment"), - DECREMENT: PatternFlowIpv6PayloadLengthChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv6PayloadLength) Choice() PatternFlowIpv6PayloadLengthChoiceEnum { - return PatternFlowIpv6PayloadLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv6PayloadLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv6PayloadLength) setChoice(value PatternFlowIpv6PayloadLengthChoiceEnum) PatternFlowIpv6PayloadLength { - intValue, ok := otg.PatternFlowIpv6PayloadLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv6PayloadLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv6PayloadLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Auto = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv6PayloadLengthChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv6PayloadLengthChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv6PayloadLengthChoice.AUTO { - defaultValue := uint32(0) - obj.obj.Auto = &defaultValue - } - - if value == PatternFlowIpv6PayloadLengthChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv6PayloadLengthCounter().msg() - } - - if value == PatternFlowIpv6PayloadLengthChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv6PayloadLengthCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv6PayloadLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv6PayloadLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv6PayloadLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv6PayloadLength object -func (obj *patternFlowIpv6PayloadLength) SetValue(value uint32) PatternFlowIpv6PayloadLength { - obj.setChoice(PatternFlowIpv6PayloadLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv6PayloadLength) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv6PayloadLength object -func (obj *patternFlowIpv6PayloadLength) SetValues(value []uint32) PatternFlowIpv6PayloadLength { - obj.setChoice(PatternFlowIpv6PayloadLengthChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowIpv6PayloadLength) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(PatternFlowIpv6PayloadLengthChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowIpv6PayloadLength) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Increment returns a PatternFlowIpv6PayloadLengthCounter -func (obj *patternFlowIpv6PayloadLength) Increment() PatternFlowIpv6PayloadLengthCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv6PayloadLengthChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv6PayloadLengthCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv6PayloadLengthCounter -func (obj *patternFlowIpv6PayloadLength) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv6PayloadLengthCounter value in the PatternFlowIpv6PayloadLength object -func (obj *patternFlowIpv6PayloadLength) SetIncrement(value PatternFlowIpv6PayloadLengthCounter) PatternFlowIpv6PayloadLength { - obj.setChoice(PatternFlowIpv6PayloadLengthChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv6PayloadLengthCounter -func (obj *patternFlowIpv6PayloadLength) Decrement() PatternFlowIpv6PayloadLengthCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv6PayloadLengthChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv6PayloadLengthCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv6PayloadLengthCounter -func (obj *patternFlowIpv6PayloadLength) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv6PayloadLengthCounter value in the PatternFlowIpv6PayloadLength object -func (obj *patternFlowIpv6PayloadLength) SetDecrement(value PatternFlowIpv6PayloadLengthCounter) PatternFlowIpv6PayloadLength { - obj.setChoice(PatternFlowIpv6PayloadLengthChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv6PayloadLengthMetricTag -func (obj *patternFlowIpv6PayloadLength) MetricTags() PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv6PayloadLengthMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter struct { - obj *patternFlowIpv6PayloadLength - patternFlowIpv6PayloadLengthMetricTagSlice []PatternFlowIpv6PayloadLengthMetricTag - fieldPtr *[]*otg.PatternFlowIpv6PayloadLengthMetricTag -} - -func newPatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter(ptr *[]*otg.PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { - return &patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter interface { - setMsg(*patternFlowIpv6PayloadLength) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter - Items() []PatternFlowIpv6PayloadLengthMetricTag - Add() PatternFlowIpv6PayloadLengthMetricTag - Append(items ...PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter - Set(index int, newObj PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter - Clear() PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter - clearHolderSlice() PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter - appendHolderSlice(item PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter -} - -func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) setMsg(msg *patternFlowIpv6PayloadLength) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv6PayloadLengthMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) Items() []PatternFlowIpv6PayloadLengthMetricTag { - return obj.patternFlowIpv6PayloadLengthMetricTagSlice -} - -func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) Add() PatternFlowIpv6PayloadLengthMetricTag { - newObj := &otg.PatternFlowIpv6PayloadLengthMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv6PayloadLengthMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv6PayloadLengthMetricTagSlice = append(obj.patternFlowIpv6PayloadLengthMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) Append(items ...PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv6PayloadLengthMetricTagSlice = append(obj.patternFlowIpv6PayloadLengthMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) Set(index int, newObj PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv6PayloadLengthMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) Clear() PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv6PayloadLengthMetricTag{} - obj.patternFlowIpv6PayloadLengthMetricTagSlice = []PatternFlowIpv6PayloadLengthMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) clearHolderSlice() PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { - if len(obj.patternFlowIpv6PayloadLengthMetricTagSlice) > 0 { - obj.patternFlowIpv6PayloadLengthMetricTagSlice = []PatternFlowIpv6PayloadLengthMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) appendHolderSlice(item PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { - obj.patternFlowIpv6PayloadLengthMetricTagSlice = append(obj.patternFlowIpv6PayloadLengthMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv6PayloadLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6PayloadLength.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv6PayloadLength.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Auto != nil { - - if *obj.obj.Auto > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6PayloadLength.Auto <= 65535 but Got %d", *obj.obj.Auto)) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv6PayloadLengthMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv6PayloadLength) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv6PayloadLengthChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv6PayloadLengthChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv6PayloadLengthChoice.VALUES - } - - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowIpv6PayloadLengthChoice.AUTO - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv6PayloadLengthChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv6PayloadLengthChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv6PayloadLengthChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6PayloadLength") - } - } else { - intVal := otg.PatternFlowIpv6PayloadLength_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv6PayloadLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv6NextHeader ***** -type patternFlowIpv6NextHeader struct { - validation - obj *otg.PatternFlowIpv6NextHeader - marshaller marshalPatternFlowIpv6NextHeader - unMarshaller unMarshalPatternFlowIpv6NextHeader - incrementHolder PatternFlowIpv6NextHeaderCounter - decrementHolder PatternFlowIpv6NextHeaderCounter - metricTagsHolder PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter -} - -func NewPatternFlowIpv6NextHeader() PatternFlowIpv6NextHeader { - obj := patternFlowIpv6NextHeader{obj: &otg.PatternFlowIpv6NextHeader{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6NextHeader) msg() *otg.PatternFlowIpv6NextHeader { - return obj.obj -} - -func (obj *patternFlowIpv6NextHeader) setMsg(msg *otg.PatternFlowIpv6NextHeader) PatternFlowIpv6NextHeader { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6NextHeader struct { - obj *patternFlowIpv6NextHeader -} - -type marshalPatternFlowIpv6NextHeader interface { - // ToProto marshals PatternFlowIpv6NextHeader to protobuf object *otg.PatternFlowIpv6NextHeader - ToProto() (*otg.PatternFlowIpv6NextHeader, error) - // ToPbText marshals PatternFlowIpv6NextHeader to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6NextHeader to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6NextHeader to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6NextHeader struct { - obj *patternFlowIpv6NextHeader -} - -type unMarshalPatternFlowIpv6NextHeader interface { - // FromProto unmarshals PatternFlowIpv6NextHeader from protobuf object *otg.PatternFlowIpv6NextHeader - FromProto(msg *otg.PatternFlowIpv6NextHeader) (PatternFlowIpv6NextHeader, error) - // FromPbText unmarshals PatternFlowIpv6NextHeader from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6NextHeader from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6NextHeader from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6NextHeader) Marshal() marshalPatternFlowIpv6NextHeader { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6NextHeader{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6NextHeader) Unmarshal() unMarshalPatternFlowIpv6NextHeader { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6NextHeader{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6NextHeader) ToProto() (*otg.PatternFlowIpv6NextHeader, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6NextHeader) FromProto(msg *otg.PatternFlowIpv6NextHeader) (PatternFlowIpv6NextHeader, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6NextHeader) 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 *unMarshalpatternFlowIpv6NextHeader) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv6NextHeader) 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 *unMarshalpatternFlowIpv6NextHeader) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv6NextHeader) 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 *unMarshalpatternFlowIpv6NextHeader) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv6NextHeader) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6NextHeader) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6NextHeader) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6NextHeader) Clone() (PatternFlowIpv6NextHeader, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6NextHeader() - 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 -} - -func (obj *patternFlowIpv6NextHeader) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv6NextHeader is next header -type PatternFlowIpv6NextHeader interface { - Validation - // msg marshals PatternFlowIpv6NextHeader to protobuf object *otg.PatternFlowIpv6NextHeader - // and doesn't set defaults - msg() *otg.PatternFlowIpv6NextHeader - // setMsg unmarshals PatternFlowIpv6NextHeader from protobuf object *otg.PatternFlowIpv6NextHeader - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6NextHeader) PatternFlowIpv6NextHeader - // provides marshal interface - Marshal() marshalPatternFlowIpv6NextHeader - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6NextHeader - // validate validates PatternFlowIpv6NextHeader - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6NextHeader, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv6NextHeaderChoiceEnum, set in PatternFlowIpv6NextHeader - Choice() PatternFlowIpv6NextHeaderChoiceEnum - // setChoice assigns PatternFlowIpv6NextHeaderChoiceEnum provided by user to PatternFlowIpv6NextHeader - setChoice(value PatternFlowIpv6NextHeaderChoiceEnum) PatternFlowIpv6NextHeader - // HasChoice checks if Choice has been set in PatternFlowIpv6NextHeader - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv6NextHeader. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv6NextHeader - SetValue(value uint32) PatternFlowIpv6NextHeader - // HasValue checks if Value has been set in PatternFlowIpv6NextHeader - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv6NextHeader. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv6NextHeader - SetValues(value []uint32) PatternFlowIpv6NextHeader - // Auto returns uint32, set in PatternFlowIpv6NextHeader. - Auto() uint32 - // HasAuto checks if Auto has been set in PatternFlowIpv6NextHeader - HasAuto() bool - // Increment returns PatternFlowIpv6NextHeaderCounter, set in PatternFlowIpv6NextHeader. - // PatternFlowIpv6NextHeaderCounter is integer counter pattern - Increment() PatternFlowIpv6NextHeaderCounter - // SetIncrement assigns PatternFlowIpv6NextHeaderCounter provided by user to PatternFlowIpv6NextHeader. - // PatternFlowIpv6NextHeaderCounter is integer counter pattern - SetIncrement(value PatternFlowIpv6NextHeaderCounter) PatternFlowIpv6NextHeader - // HasIncrement checks if Increment has been set in PatternFlowIpv6NextHeader - HasIncrement() bool - // Decrement returns PatternFlowIpv6NextHeaderCounter, set in PatternFlowIpv6NextHeader. - // PatternFlowIpv6NextHeaderCounter is integer counter pattern - Decrement() PatternFlowIpv6NextHeaderCounter - // SetDecrement assigns PatternFlowIpv6NextHeaderCounter provided by user to PatternFlowIpv6NextHeader. - // PatternFlowIpv6NextHeaderCounter is integer counter pattern - SetDecrement(value PatternFlowIpv6NextHeaderCounter) PatternFlowIpv6NextHeader - // HasDecrement checks if Decrement has been set in PatternFlowIpv6NextHeader - HasDecrement() bool - // MetricTags returns PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIterIter, set in PatternFlowIpv6NextHeader - MetricTags() PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter - setNil() -} - -type PatternFlowIpv6NextHeaderChoiceEnum string - -// Enum of Choice on PatternFlowIpv6NextHeader -var PatternFlowIpv6NextHeaderChoice = struct { - VALUE PatternFlowIpv6NextHeaderChoiceEnum - VALUES PatternFlowIpv6NextHeaderChoiceEnum - AUTO PatternFlowIpv6NextHeaderChoiceEnum - INCREMENT PatternFlowIpv6NextHeaderChoiceEnum - DECREMENT PatternFlowIpv6NextHeaderChoiceEnum -}{ - VALUE: PatternFlowIpv6NextHeaderChoiceEnum("value"), - VALUES: PatternFlowIpv6NextHeaderChoiceEnum("values"), - AUTO: PatternFlowIpv6NextHeaderChoiceEnum("auto"), - INCREMENT: PatternFlowIpv6NextHeaderChoiceEnum("increment"), - DECREMENT: PatternFlowIpv6NextHeaderChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv6NextHeader) Choice() PatternFlowIpv6NextHeaderChoiceEnum { - return PatternFlowIpv6NextHeaderChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv6NextHeader) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv6NextHeader) setChoice(value PatternFlowIpv6NextHeaderChoiceEnum) PatternFlowIpv6NextHeader { - intValue, ok := otg.PatternFlowIpv6NextHeader_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv6NextHeaderChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv6NextHeader_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Auto = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv6NextHeaderChoice.VALUE { - defaultValue := uint32(59) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv6NextHeaderChoice.VALUES { - defaultValue := []uint32{59} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv6NextHeaderChoice.AUTO { - defaultValue := uint32(59) - obj.obj.Auto = &defaultValue - } - - if value == PatternFlowIpv6NextHeaderChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv6NextHeaderCounter().msg() - } - - if value == PatternFlowIpv6NextHeaderChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv6NextHeaderCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv6NextHeader) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv6NextHeaderChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv6NextHeader) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv6NextHeader object -func (obj *patternFlowIpv6NextHeader) SetValue(value uint32) PatternFlowIpv6NextHeader { - obj.setChoice(PatternFlowIpv6NextHeaderChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv6NextHeader) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{59}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv6NextHeader object -func (obj *patternFlowIpv6NextHeader) SetValues(value []uint32) PatternFlowIpv6NextHeader { - obj.setChoice(PatternFlowIpv6NextHeaderChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowIpv6NextHeader) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(PatternFlowIpv6NextHeaderChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowIpv6NextHeader) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Increment returns a PatternFlowIpv6NextHeaderCounter -func (obj *patternFlowIpv6NextHeader) Increment() PatternFlowIpv6NextHeaderCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv6NextHeaderChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv6NextHeaderCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv6NextHeaderCounter -func (obj *patternFlowIpv6NextHeader) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv6NextHeaderCounter value in the PatternFlowIpv6NextHeader object -func (obj *patternFlowIpv6NextHeader) SetIncrement(value PatternFlowIpv6NextHeaderCounter) PatternFlowIpv6NextHeader { - obj.setChoice(PatternFlowIpv6NextHeaderChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv6NextHeaderCounter -func (obj *patternFlowIpv6NextHeader) Decrement() PatternFlowIpv6NextHeaderCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv6NextHeaderChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv6NextHeaderCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv6NextHeaderCounter -func (obj *patternFlowIpv6NextHeader) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv6NextHeaderCounter value in the PatternFlowIpv6NextHeader object -func (obj *patternFlowIpv6NextHeader) SetDecrement(value PatternFlowIpv6NextHeaderCounter) PatternFlowIpv6NextHeader { - obj.setChoice(PatternFlowIpv6NextHeaderChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv6NextHeaderMetricTag -func (obj *patternFlowIpv6NextHeader) MetricTags() PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv6NextHeaderMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter struct { - obj *patternFlowIpv6NextHeader - patternFlowIpv6NextHeaderMetricTagSlice []PatternFlowIpv6NextHeaderMetricTag - fieldPtr *[]*otg.PatternFlowIpv6NextHeaderMetricTag -} - -func newPatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter(ptr *[]*otg.PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { - return &patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter interface { - setMsg(*patternFlowIpv6NextHeader) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter - Items() []PatternFlowIpv6NextHeaderMetricTag - Add() PatternFlowIpv6NextHeaderMetricTag - Append(items ...PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter - Set(index int, newObj PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter - Clear() PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter - clearHolderSlice() PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter - appendHolderSlice(item PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter -} - -func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) setMsg(msg *patternFlowIpv6NextHeader) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv6NextHeaderMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) Items() []PatternFlowIpv6NextHeaderMetricTag { - return obj.patternFlowIpv6NextHeaderMetricTagSlice -} - -func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) Add() PatternFlowIpv6NextHeaderMetricTag { - newObj := &otg.PatternFlowIpv6NextHeaderMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv6NextHeaderMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv6NextHeaderMetricTagSlice = append(obj.patternFlowIpv6NextHeaderMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) Append(items ...PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv6NextHeaderMetricTagSlice = append(obj.patternFlowIpv6NextHeaderMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) Set(index int, newObj PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv6NextHeaderMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) Clear() PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv6NextHeaderMetricTag{} - obj.patternFlowIpv6NextHeaderMetricTagSlice = []PatternFlowIpv6NextHeaderMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) clearHolderSlice() PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { - if len(obj.patternFlowIpv6NextHeaderMetricTagSlice) > 0 { - obj.patternFlowIpv6NextHeaderMetricTagSlice = []PatternFlowIpv6NextHeaderMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) appendHolderSlice(item PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { - obj.patternFlowIpv6NextHeaderMetricTagSlice = append(obj.patternFlowIpv6NextHeaderMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv6NextHeader) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6NextHeader.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv6NextHeader.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Auto != nil { - - if *obj.obj.Auto > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6NextHeader.Auto <= 255 but Got %d", *obj.obj.Auto)) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv6NextHeaderMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv6NextHeader) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv6NextHeaderChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv6NextHeaderChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv6NextHeaderChoice.VALUES - } - - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowIpv6NextHeaderChoice.AUTO - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv6NextHeaderChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv6NextHeaderChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv6NextHeaderChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6NextHeader") - } - } else { - intVal := otg.PatternFlowIpv6NextHeader_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv6NextHeader_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv6HopLimit ***** -type patternFlowIpv6HopLimit struct { - validation - obj *otg.PatternFlowIpv6HopLimit - marshaller marshalPatternFlowIpv6HopLimit - unMarshaller unMarshalPatternFlowIpv6HopLimit - incrementHolder PatternFlowIpv6HopLimitCounter - decrementHolder PatternFlowIpv6HopLimitCounter - metricTagsHolder PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter -} - -func NewPatternFlowIpv6HopLimit() PatternFlowIpv6HopLimit { - obj := patternFlowIpv6HopLimit{obj: &otg.PatternFlowIpv6HopLimit{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6HopLimit) msg() *otg.PatternFlowIpv6HopLimit { - return obj.obj -} - -func (obj *patternFlowIpv6HopLimit) setMsg(msg *otg.PatternFlowIpv6HopLimit) PatternFlowIpv6HopLimit { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6HopLimit struct { - obj *patternFlowIpv6HopLimit -} - -type marshalPatternFlowIpv6HopLimit interface { - // ToProto marshals PatternFlowIpv6HopLimit to protobuf object *otg.PatternFlowIpv6HopLimit - ToProto() (*otg.PatternFlowIpv6HopLimit, error) - // ToPbText marshals PatternFlowIpv6HopLimit to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6HopLimit to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6HopLimit to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6HopLimit struct { - obj *patternFlowIpv6HopLimit -} - -type unMarshalPatternFlowIpv6HopLimit interface { - // FromProto unmarshals PatternFlowIpv6HopLimit from protobuf object *otg.PatternFlowIpv6HopLimit - FromProto(msg *otg.PatternFlowIpv6HopLimit) (PatternFlowIpv6HopLimit, error) - // FromPbText unmarshals PatternFlowIpv6HopLimit from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6HopLimit from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6HopLimit from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6HopLimit) Marshal() marshalPatternFlowIpv6HopLimit { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6HopLimit{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6HopLimit) Unmarshal() unMarshalPatternFlowIpv6HopLimit { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6HopLimit{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6HopLimit) ToProto() (*otg.PatternFlowIpv6HopLimit, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6HopLimit) FromProto(msg *otg.PatternFlowIpv6HopLimit) (PatternFlowIpv6HopLimit, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6HopLimit) 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 *unMarshalpatternFlowIpv6HopLimit) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv6HopLimit) 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 *unMarshalpatternFlowIpv6HopLimit) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv6HopLimit) 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 *unMarshalpatternFlowIpv6HopLimit) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv6HopLimit) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6HopLimit) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6HopLimit) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6HopLimit) Clone() (PatternFlowIpv6HopLimit, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6HopLimit() - 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 -} - -func (obj *patternFlowIpv6HopLimit) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv6HopLimit is hop limit -type PatternFlowIpv6HopLimit interface { - Validation - // msg marshals PatternFlowIpv6HopLimit to protobuf object *otg.PatternFlowIpv6HopLimit - // and doesn't set defaults - msg() *otg.PatternFlowIpv6HopLimit - // setMsg unmarshals PatternFlowIpv6HopLimit from protobuf object *otg.PatternFlowIpv6HopLimit - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6HopLimit) PatternFlowIpv6HopLimit - // provides marshal interface - Marshal() marshalPatternFlowIpv6HopLimit - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6HopLimit - // validate validates PatternFlowIpv6HopLimit - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6HopLimit, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv6HopLimitChoiceEnum, set in PatternFlowIpv6HopLimit - Choice() PatternFlowIpv6HopLimitChoiceEnum - // setChoice assigns PatternFlowIpv6HopLimitChoiceEnum provided by user to PatternFlowIpv6HopLimit - setChoice(value PatternFlowIpv6HopLimitChoiceEnum) PatternFlowIpv6HopLimit - // HasChoice checks if Choice has been set in PatternFlowIpv6HopLimit - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv6HopLimit. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv6HopLimit - SetValue(value uint32) PatternFlowIpv6HopLimit - // HasValue checks if Value has been set in PatternFlowIpv6HopLimit - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv6HopLimit. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv6HopLimit - SetValues(value []uint32) PatternFlowIpv6HopLimit - // Increment returns PatternFlowIpv6HopLimitCounter, set in PatternFlowIpv6HopLimit. - // PatternFlowIpv6HopLimitCounter is integer counter pattern - Increment() PatternFlowIpv6HopLimitCounter - // SetIncrement assigns PatternFlowIpv6HopLimitCounter provided by user to PatternFlowIpv6HopLimit. - // PatternFlowIpv6HopLimitCounter is integer counter pattern - SetIncrement(value PatternFlowIpv6HopLimitCounter) PatternFlowIpv6HopLimit - // HasIncrement checks if Increment has been set in PatternFlowIpv6HopLimit - HasIncrement() bool - // Decrement returns PatternFlowIpv6HopLimitCounter, set in PatternFlowIpv6HopLimit. - // PatternFlowIpv6HopLimitCounter is integer counter pattern - Decrement() PatternFlowIpv6HopLimitCounter - // SetDecrement assigns PatternFlowIpv6HopLimitCounter provided by user to PatternFlowIpv6HopLimit. - // PatternFlowIpv6HopLimitCounter is integer counter pattern - SetDecrement(value PatternFlowIpv6HopLimitCounter) PatternFlowIpv6HopLimit - // HasDecrement checks if Decrement has been set in PatternFlowIpv6HopLimit - HasDecrement() bool - // MetricTags returns PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIterIter, set in PatternFlowIpv6HopLimit - MetricTags() PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter - setNil() -} - -type PatternFlowIpv6HopLimitChoiceEnum string - -// Enum of Choice on PatternFlowIpv6HopLimit -var PatternFlowIpv6HopLimitChoice = struct { - VALUE PatternFlowIpv6HopLimitChoiceEnum - VALUES PatternFlowIpv6HopLimitChoiceEnum - INCREMENT PatternFlowIpv6HopLimitChoiceEnum - DECREMENT PatternFlowIpv6HopLimitChoiceEnum -}{ - VALUE: PatternFlowIpv6HopLimitChoiceEnum("value"), - VALUES: PatternFlowIpv6HopLimitChoiceEnum("values"), - INCREMENT: PatternFlowIpv6HopLimitChoiceEnum("increment"), - DECREMENT: PatternFlowIpv6HopLimitChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv6HopLimit) Choice() PatternFlowIpv6HopLimitChoiceEnum { - return PatternFlowIpv6HopLimitChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv6HopLimit) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv6HopLimit) setChoice(value PatternFlowIpv6HopLimitChoiceEnum) PatternFlowIpv6HopLimit { - intValue, ok := otg.PatternFlowIpv6HopLimit_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv6HopLimitChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv6HopLimit_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv6HopLimitChoice.VALUE { - defaultValue := uint32(64) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv6HopLimitChoice.VALUES { - defaultValue := []uint32{64} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv6HopLimitChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv6HopLimitCounter().msg() - } - - if value == PatternFlowIpv6HopLimitChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv6HopLimitCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv6HopLimit) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv6HopLimitChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv6HopLimit) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv6HopLimit object -func (obj *patternFlowIpv6HopLimit) SetValue(value uint32) PatternFlowIpv6HopLimit { - obj.setChoice(PatternFlowIpv6HopLimitChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv6HopLimit) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{64}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv6HopLimit object -func (obj *patternFlowIpv6HopLimit) SetValues(value []uint32) PatternFlowIpv6HopLimit { - obj.setChoice(PatternFlowIpv6HopLimitChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv6HopLimitCounter -func (obj *patternFlowIpv6HopLimit) Increment() PatternFlowIpv6HopLimitCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv6HopLimitChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv6HopLimitCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv6HopLimitCounter -func (obj *patternFlowIpv6HopLimit) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv6HopLimitCounter value in the PatternFlowIpv6HopLimit object -func (obj *patternFlowIpv6HopLimit) SetIncrement(value PatternFlowIpv6HopLimitCounter) PatternFlowIpv6HopLimit { - obj.setChoice(PatternFlowIpv6HopLimitChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv6HopLimitCounter -func (obj *patternFlowIpv6HopLimit) Decrement() PatternFlowIpv6HopLimitCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv6HopLimitChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv6HopLimitCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv6HopLimitCounter -func (obj *patternFlowIpv6HopLimit) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv6HopLimitCounter value in the PatternFlowIpv6HopLimit object -func (obj *patternFlowIpv6HopLimit) SetDecrement(value PatternFlowIpv6HopLimitCounter) PatternFlowIpv6HopLimit { - obj.setChoice(PatternFlowIpv6HopLimitChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv6HopLimitMetricTag -func (obj *patternFlowIpv6HopLimit) MetricTags() PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv6HopLimitMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter struct { - obj *patternFlowIpv6HopLimit - patternFlowIpv6HopLimitMetricTagSlice []PatternFlowIpv6HopLimitMetricTag - fieldPtr *[]*otg.PatternFlowIpv6HopLimitMetricTag -} - -func newPatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter(ptr *[]*otg.PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { - return &patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter interface { - setMsg(*patternFlowIpv6HopLimit) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter - Items() []PatternFlowIpv6HopLimitMetricTag - Add() PatternFlowIpv6HopLimitMetricTag - Append(items ...PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter - Set(index int, newObj PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter - Clear() PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter - clearHolderSlice() PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter - appendHolderSlice(item PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter -} - -func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) setMsg(msg *patternFlowIpv6HopLimit) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv6HopLimitMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) Items() []PatternFlowIpv6HopLimitMetricTag { - return obj.patternFlowIpv6HopLimitMetricTagSlice -} - -func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) Add() PatternFlowIpv6HopLimitMetricTag { - newObj := &otg.PatternFlowIpv6HopLimitMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv6HopLimitMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv6HopLimitMetricTagSlice = append(obj.patternFlowIpv6HopLimitMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) Append(items ...PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv6HopLimitMetricTagSlice = append(obj.patternFlowIpv6HopLimitMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) Set(index int, newObj PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv6HopLimitMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) Clear() PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv6HopLimitMetricTag{} - obj.patternFlowIpv6HopLimitMetricTagSlice = []PatternFlowIpv6HopLimitMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) clearHolderSlice() PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { - if len(obj.patternFlowIpv6HopLimitMetricTagSlice) > 0 { - obj.patternFlowIpv6HopLimitMetricTagSlice = []PatternFlowIpv6HopLimitMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) appendHolderSlice(item PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { - obj.patternFlowIpv6HopLimitMetricTagSlice = append(obj.patternFlowIpv6HopLimitMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv6HopLimit) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6HopLimit.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv6HopLimit.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv6HopLimitMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv6HopLimit) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv6HopLimitChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv6HopLimitChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv6HopLimitChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv6HopLimitChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv6HopLimitChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv6HopLimitChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6HopLimit") - } - } else { - intVal := otg.PatternFlowIpv6HopLimit_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv6HopLimit_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv6Src ***** -type patternFlowIpv6Src struct { - validation - obj *otg.PatternFlowIpv6Src - marshaller marshalPatternFlowIpv6Src - unMarshaller unMarshalPatternFlowIpv6Src - incrementHolder PatternFlowIpv6SrcCounter - decrementHolder PatternFlowIpv6SrcCounter - metricTagsHolder PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter -} - -func NewPatternFlowIpv6Src() PatternFlowIpv6Src { - obj := patternFlowIpv6Src{obj: &otg.PatternFlowIpv6Src{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6Src) msg() *otg.PatternFlowIpv6Src { - return obj.obj -} - -func (obj *patternFlowIpv6Src) setMsg(msg *otg.PatternFlowIpv6Src) PatternFlowIpv6Src { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6Src struct { - obj *patternFlowIpv6Src -} - -type marshalPatternFlowIpv6Src interface { - // ToProto marshals PatternFlowIpv6Src to protobuf object *otg.PatternFlowIpv6Src - ToProto() (*otg.PatternFlowIpv6Src, error) - // ToPbText marshals PatternFlowIpv6Src to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6Src to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6Src to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6Src struct { - obj *patternFlowIpv6Src -} - -type unMarshalPatternFlowIpv6Src interface { - // FromProto unmarshals PatternFlowIpv6Src from protobuf object *otg.PatternFlowIpv6Src - FromProto(msg *otg.PatternFlowIpv6Src) (PatternFlowIpv6Src, error) - // FromPbText unmarshals PatternFlowIpv6Src from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6Src from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6Src from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6Src) Marshal() marshalPatternFlowIpv6Src { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6Src{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6Src) Unmarshal() unMarshalPatternFlowIpv6Src { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6Src{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6Src) ToProto() (*otg.PatternFlowIpv6Src, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6Src) FromProto(msg *otg.PatternFlowIpv6Src) (PatternFlowIpv6Src, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6Src) 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 *unMarshalpatternFlowIpv6Src) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv6Src) 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 *unMarshalpatternFlowIpv6Src) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv6Src) 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 *unMarshalpatternFlowIpv6Src) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv6Src) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6Src) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6Src) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6Src) Clone() (PatternFlowIpv6Src, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6Src() - 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 -} - -func (obj *patternFlowIpv6Src) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv6Src is source address -type PatternFlowIpv6Src interface { - Validation - // msg marshals PatternFlowIpv6Src to protobuf object *otg.PatternFlowIpv6Src - // and doesn't set defaults - msg() *otg.PatternFlowIpv6Src - // setMsg unmarshals PatternFlowIpv6Src from protobuf object *otg.PatternFlowIpv6Src - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6Src) PatternFlowIpv6Src - // provides marshal interface - Marshal() marshalPatternFlowIpv6Src - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6Src - // validate validates PatternFlowIpv6Src - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6Src, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv6SrcChoiceEnum, set in PatternFlowIpv6Src - Choice() PatternFlowIpv6SrcChoiceEnum - // setChoice assigns PatternFlowIpv6SrcChoiceEnum provided by user to PatternFlowIpv6Src - setChoice(value PatternFlowIpv6SrcChoiceEnum) PatternFlowIpv6Src - // HasChoice checks if Choice has been set in PatternFlowIpv6Src - HasChoice() bool - // Value returns string, set in PatternFlowIpv6Src. - Value() string - // SetValue assigns string provided by user to PatternFlowIpv6Src - SetValue(value string) PatternFlowIpv6Src - // HasValue checks if Value has been set in PatternFlowIpv6Src - HasValue() bool - // Values returns []string, set in PatternFlowIpv6Src. - Values() []string - // SetValues assigns []string provided by user to PatternFlowIpv6Src - SetValues(value []string) PatternFlowIpv6Src - // Increment returns PatternFlowIpv6SrcCounter, set in PatternFlowIpv6Src. - // PatternFlowIpv6SrcCounter is ipv6 counter pattern - Increment() PatternFlowIpv6SrcCounter - // SetIncrement assigns PatternFlowIpv6SrcCounter provided by user to PatternFlowIpv6Src. - // PatternFlowIpv6SrcCounter is ipv6 counter pattern - SetIncrement(value PatternFlowIpv6SrcCounter) PatternFlowIpv6Src - // HasIncrement checks if Increment has been set in PatternFlowIpv6Src - HasIncrement() bool - // Decrement returns PatternFlowIpv6SrcCounter, set in PatternFlowIpv6Src. - // PatternFlowIpv6SrcCounter is ipv6 counter pattern - Decrement() PatternFlowIpv6SrcCounter - // SetDecrement assigns PatternFlowIpv6SrcCounter provided by user to PatternFlowIpv6Src. - // PatternFlowIpv6SrcCounter is ipv6 counter pattern - SetDecrement(value PatternFlowIpv6SrcCounter) PatternFlowIpv6Src - // HasDecrement checks if Decrement has been set in PatternFlowIpv6Src - HasDecrement() bool - // MetricTags returns PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIterIter, set in PatternFlowIpv6Src - MetricTags() PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter - setNil() -} - -type PatternFlowIpv6SrcChoiceEnum string - -// Enum of Choice on PatternFlowIpv6Src -var PatternFlowIpv6SrcChoice = struct { - VALUE PatternFlowIpv6SrcChoiceEnum - VALUES PatternFlowIpv6SrcChoiceEnum - INCREMENT PatternFlowIpv6SrcChoiceEnum - DECREMENT PatternFlowIpv6SrcChoiceEnum -}{ - VALUE: PatternFlowIpv6SrcChoiceEnum("value"), - VALUES: PatternFlowIpv6SrcChoiceEnum("values"), - INCREMENT: PatternFlowIpv6SrcChoiceEnum("increment"), - DECREMENT: PatternFlowIpv6SrcChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv6Src) Choice() PatternFlowIpv6SrcChoiceEnum { - return PatternFlowIpv6SrcChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv6Src) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv6Src) setChoice(value PatternFlowIpv6SrcChoiceEnum) PatternFlowIpv6Src { - intValue, ok := otg.PatternFlowIpv6Src_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv6SrcChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv6Src_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv6SrcChoice.VALUE { - defaultValue := "::0" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv6SrcChoice.VALUES { - defaultValue := []string{"::0"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv6SrcChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv6SrcCounter().msg() - } - - if value == PatternFlowIpv6SrcChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv6SrcCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowIpv6Src) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv6SrcChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowIpv6Src) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowIpv6Src object -func (obj *patternFlowIpv6Src) SetValue(value string) PatternFlowIpv6Src { - obj.setChoice(PatternFlowIpv6SrcChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowIpv6Src) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"::0"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowIpv6Src object -func (obj *patternFlowIpv6Src) SetValues(value []string) PatternFlowIpv6Src { - obj.setChoice(PatternFlowIpv6SrcChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv6SrcCounter -func (obj *patternFlowIpv6Src) Increment() PatternFlowIpv6SrcCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv6SrcChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv6SrcCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv6SrcCounter -func (obj *patternFlowIpv6Src) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv6SrcCounter value in the PatternFlowIpv6Src object -func (obj *patternFlowIpv6Src) SetIncrement(value PatternFlowIpv6SrcCounter) PatternFlowIpv6Src { - obj.setChoice(PatternFlowIpv6SrcChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv6SrcCounter -func (obj *patternFlowIpv6Src) Decrement() PatternFlowIpv6SrcCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv6SrcChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv6SrcCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv6SrcCounter -func (obj *patternFlowIpv6Src) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv6SrcCounter value in the PatternFlowIpv6Src object -func (obj *patternFlowIpv6Src) SetDecrement(value PatternFlowIpv6SrcCounter) PatternFlowIpv6Src { - obj.setChoice(PatternFlowIpv6SrcChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv6SrcMetricTag -func (obj *patternFlowIpv6Src) MetricTags() PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv6SrcMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter struct { - obj *patternFlowIpv6Src - patternFlowIpv6SrcMetricTagSlice []PatternFlowIpv6SrcMetricTag - fieldPtr *[]*otg.PatternFlowIpv6SrcMetricTag -} - -func newPatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter(ptr *[]*otg.PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { - return &patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter interface { - setMsg(*patternFlowIpv6Src) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter - Items() []PatternFlowIpv6SrcMetricTag - Add() PatternFlowIpv6SrcMetricTag - Append(items ...PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter - Set(index int, newObj PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter - Clear() PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter - clearHolderSlice() PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter - appendHolderSlice(item PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter -} - -func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) setMsg(msg *patternFlowIpv6Src) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv6SrcMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) Items() []PatternFlowIpv6SrcMetricTag { - return obj.patternFlowIpv6SrcMetricTagSlice -} - -func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) Add() PatternFlowIpv6SrcMetricTag { - newObj := &otg.PatternFlowIpv6SrcMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv6SrcMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv6SrcMetricTagSlice = append(obj.patternFlowIpv6SrcMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) Append(items ...PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv6SrcMetricTagSlice = append(obj.patternFlowIpv6SrcMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) Set(index int, newObj PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv6SrcMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) Clear() PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv6SrcMetricTag{} - obj.patternFlowIpv6SrcMetricTagSlice = []PatternFlowIpv6SrcMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) clearHolderSlice() PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { - if len(obj.patternFlowIpv6SrcMetricTagSlice) > 0 { - obj.patternFlowIpv6SrcMetricTagSlice = []PatternFlowIpv6SrcMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) appendHolderSlice(item PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { - obj.patternFlowIpv6SrcMetricTagSlice = append(obj.patternFlowIpv6SrcMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv6Src) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv6(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6Src.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateIpv6Slice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6Src.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv6SrcMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv6Src) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv6SrcChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv6SrcChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv6SrcChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv6SrcChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv6SrcChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv6SrcChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6Src") - } - } else { - intVal := otg.PatternFlowIpv6Src_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv6Src_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv6Dst ***** -type patternFlowIpv6Dst struct { - validation - obj *otg.PatternFlowIpv6Dst - marshaller marshalPatternFlowIpv6Dst - unMarshaller unMarshalPatternFlowIpv6Dst - incrementHolder PatternFlowIpv6DstCounter - decrementHolder PatternFlowIpv6DstCounter - metricTagsHolder PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter -} - -func NewPatternFlowIpv6Dst() PatternFlowIpv6Dst { - obj := patternFlowIpv6Dst{obj: &otg.PatternFlowIpv6Dst{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6Dst) msg() *otg.PatternFlowIpv6Dst { - return obj.obj -} - -func (obj *patternFlowIpv6Dst) setMsg(msg *otg.PatternFlowIpv6Dst) PatternFlowIpv6Dst { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6Dst struct { - obj *patternFlowIpv6Dst -} - -type marshalPatternFlowIpv6Dst interface { - // ToProto marshals PatternFlowIpv6Dst to protobuf object *otg.PatternFlowIpv6Dst - ToProto() (*otg.PatternFlowIpv6Dst, error) - // ToPbText marshals PatternFlowIpv6Dst to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6Dst to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6Dst to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6Dst struct { - obj *patternFlowIpv6Dst -} - -type unMarshalPatternFlowIpv6Dst interface { - // FromProto unmarshals PatternFlowIpv6Dst from protobuf object *otg.PatternFlowIpv6Dst - FromProto(msg *otg.PatternFlowIpv6Dst) (PatternFlowIpv6Dst, error) - // FromPbText unmarshals PatternFlowIpv6Dst from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6Dst from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6Dst from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6Dst) Marshal() marshalPatternFlowIpv6Dst { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6Dst{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6Dst) Unmarshal() unMarshalPatternFlowIpv6Dst { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6Dst{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6Dst) ToProto() (*otg.PatternFlowIpv6Dst, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6Dst) FromProto(msg *otg.PatternFlowIpv6Dst) (PatternFlowIpv6Dst, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6Dst) 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 *unMarshalpatternFlowIpv6Dst) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv6Dst) 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 *unMarshalpatternFlowIpv6Dst) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv6Dst) 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 *unMarshalpatternFlowIpv6Dst) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv6Dst) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6Dst) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6Dst) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6Dst) Clone() (PatternFlowIpv6Dst, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6Dst() - 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 -} - -func (obj *patternFlowIpv6Dst) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv6Dst is destination address -type PatternFlowIpv6Dst interface { - Validation - // msg marshals PatternFlowIpv6Dst to protobuf object *otg.PatternFlowIpv6Dst - // and doesn't set defaults - msg() *otg.PatternFlowIpv6Dst - // setMsg unmarshals PatternFlowIpv6Dst from protobuf object *otg.PatternFlowIpv6Dst - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6Dst) PatternFlowIpv6Dst - // provides marshal interface - Marshal() marshalPatternFlowIpv6Dst - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6Dst - // validate validates PatternFlowIpv6Dst - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6Dst, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv6DstChoiceEnum, set in PatternFlowIpv6Dst - Choice() PatternFlowIpv6DstChoiceEnum - // setChoice assigns PatternFlowIpv6DstChoiceEnum provided by user to PatternFlowIpv6Dst - setChoice(value PatternFlowIpv6DstChoiceEnum) PatternFlowIpv6Dst - // HasChoice checks if Choice has been set in PatternFlowIpv6Dst - HasChoice() bool - // Value returns string, set in PatternFlowIpv6Dst. - Value() string - // SetValue assigns string provided by user to PatternFlowIpv6Dst - SetValue(value string) PatternFlowIpv6Dst - // HasValue checks if Value has been set in PatternFlowIpv6Dst - HasValue() bool - // Values returns []string, set in PatternFlowIpv6Dst. - Values() []string - // SetValues assigns []string provided by user to PatternFlowIpv6Dst - SetValues(value []string) PatternFlowIpv6Dst - // Increment returns PatternFlowIpv6DstCounter, set in PatternFlowIpv6Dst. - // PatternFlowIpv6DstCounter is ipv6 counter pattern - Increment() PatternFlowIpv6DstCounter - // SetIncrement assigns PatternFlowIpv6DstCounter provided by user to PatternFlowIpv6Dst. - // PatternFlowIpv6DstCounter is ipv6 counter pattern - SetIncrement(value PatternFlowIpv6DstCounter) PatternFlowIpv6Dst - // HasIncrement checks if Increment has been set in PatternFlowIpv6Dst - HasIncrement() bool - // Decrement returns PatternFlowIpv6DstCounter, set in PatternFlowIpv6Dst. - // PatternFlowIpv6DstCounter is ipv6 counter pattern - Decrement() PatternFlowIpv6DstCounter - // SetDecrement assigns PatternFlowIpv6DstCounter provided by user to PatternFlowIpv6Dst. - // PatternFlowIpv6DstCounter is ipv6 counter pattern - SetDecrement(value PatternFlowIpv6DstCounter) PatternFlowIpv6Dst - // HasDecrement checks if Decrement has been set in PatternFlowIpv6Dst - HasDecrement() bool - // MetricTags returns PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIterIter, set in PatternFlowIpv6Dst - MetricTags() PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter - setNil() -} - -type PatternFlowIpv6DstChoiceEnum string - -// Enum of Choice on PatternFlowIpv6Dst -var PatternFlowIpv6DstChoice = struct { - VALUE PatternFlowIpv6DstChoiceEnum - VALUES PatternFlowIpv6DstChoiceEnum - INCREMENT PatternFlowIpv6DstChoiceEnum - DECREMENT PatternFlowIpv6DstChoiceEnum -}{ - VALUE: PatternFlowIpv6DstChoiceEnum("value"), - VALUES: PatternFlowIpv6DstChoiceEnum("values"), - INCREMENT: PatternFlowIpv6DstChoiceEnum("increment"), - DECREMENT: PatternFlowIpv6DstChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv6Dst) Choice() PatternFlowIpv6DstChoiceEnum { - return PatternFlowIpv6DstChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv6Dst) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv6Dst) setChoice(value PatternFlowIpv6DstChoiceEnum) PatternFlowIpv6Dst { - intValue, ok := otg.PatternFlowIpv6Dst_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv6DstChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv6Dst_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv6DstChoice.VALUE { - defaultValue := "::0" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv6DstChoice.VALUES { - defaultValue := []string{"::0"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv6DstChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv6DstCounter().msg() - } - - if value == PatternFlowIpv6DstChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv6DstCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowIpv6Dst) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv6DstChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowIpv6Dst) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowIpv6Dst object -func (obj *patternFlowIpv6Dst) SetValue(value string) PatternFlowIpv6Dst { - obj.setChoice(PatternFlowIpv6DstChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowIpv6Dst) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"::0"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowIpv6Dst object -func (obj *patternFlowIpv6Dst) SetValues(value []string) PatternFlowIpv6Dst { - obj.setChoice(PatternFlowIpv6DstChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv6DstCounter -func (obj *patternFlowIpv6Dst) Increment() PatternFlowIpv6DstCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv6DstChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv6DstCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv6DstCounter -func (obj *patternFlowIpv6Dst) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv6DstCounter value in the PatternFlowIpv6Dst object -func (obj *patternFlowIpv6Dst) SetIncrement(value PatternFlowIpv6DstCounter) PatternFlowIpv6Dst { - obj.setChoice(PatternFlowIpv6DstChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv6DstCounter -func (obj *patternFlowIpv6Dst) Decrement() PatternFlowIpv6DstCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv6DstChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv6DstCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv6DstCounter -func (obj *patternFlowIpv6Dst) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv6DstCounter value in the PatternFlowIpv6Dst object -func (obj *patternFlowIpv6Dst) SetDecrement(value PatternFlowIpv6DstCounter) PatternFlowIpv6Dst { - obj.setChoice(PatternFlowIpv6DstChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv6DstMetricTag -func (obj *patternFlowIpv6Dst) MetricTags() PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv6DstMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter struct { - obj *patternFlowIpv6Dst - patternFlowIpv6DstMetricTagSlice []PatternFlowIpv6DstMetricTag - fieldPtr *[]*otg.PatternFlowIpv6DstMetricTag -} - -func newPatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter(ptr *[]*otg.PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { - return &patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter interface { - setMsg(*patternFlowIpv6Dst) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter - Items() []PatternFlowIpv6DstMetricTag - Add() PatternFlowIpv6DstMetricTag - Append(items ...PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter - Set(index int, newObj PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter - Clear() PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter - clearHolderSlice() PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter - appendHolderSlice(item PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter -} - -func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) setMsg(msg *patternFlowIpv6Dst) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv6DstMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) Items() []PatternFlowIpv6DstMetricTag { - return obj.patternFlowIpv6DstMetricTagSlice -} - -func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) Add() PatternFlowIpv6DstMetricTag { - newObj := &otg.PatternFlowIpv6DstMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv6DstMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv6DstMetricTagSlice = append(obj.patternFlowIpv6DstMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) Append(items ...PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv6DstMetricTagSlice = append(obj.patternFlowIpv6DstMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) Set(index int, newObj PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv6DstMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) Clear() PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv6DstMetricTag{} - obj.patternFlowIpv6DstMetricTagSlice = []PatternFlowIpv6DstMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) clearHolderSlice() PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { - if len(obj.patternFlowIpv6DstMetricTagSlice) > 0 { - obj.patternFlowIpv6DstMetricTagSlice = []PatternFlowIpv6DstMetricTag{} - } - return obj -} -func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) appendHolderSlice(item PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { - obj.patternFlowIpv6DstMetricTagSlice = append(obj.patternFlowIpv6DstMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv6Dst) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv6(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6Dst.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateIpv6Slice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6Dst.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv6DstMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv6Dst) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv6DstChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv6DstChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv6DstChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv6DstChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv6DstChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv6DstChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6Dst") - } - } else { - intVal := otg.PatternFlowIpv6Dst_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv6Dst_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPfcPauseDst ***** -type patternFlowPfcPauseDst struct { - validation - obj *otg.PatternFlowPfcPauseDst - marshaller marshalPatternFlowPfcPauseDst - unMarshaller unMarshalPatternFlowPfcPauseDst - incrementHolder PatternFlowPfcPauseDstCounter - decrementHolder PatternFlowPfcPauseDstCounter - metricTagsHolder PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter -} - -func NewPatternFlowPfcPauseDst() PatternFlowPfcPauseDst { - obj := patternFlowPfcPauseDst{obj: &otg.PatternFlowPfcPauseDst{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseDst) msg() *otg.PatternFlowPfcPauseDst { - return obj.obj -} - -func (obj *patternFlowPfcPauseDst) setMsg(msg *otg.PatternFlowPfcPauseDst) PatternFlowPfcPauseDst { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseDst struct { - obj *patternFlowPfcPauseDst -} - -type marshalPatternFlowPfcPauseDst interface { - // ToProto marshals PatternFlowPfcPauseDst to protobuf object *otg.PatternFlowPfcPauseDst - ToProto() (*otg.PatternFlowPfcPauseDst, error) - // ToPbText marshals PatternFlowPfcPauseDst to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseDst to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseDst to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseDst struct { - obj *patternFlowPfcPauseDst -} - -type unMarshalPatternFlowPfcPauseDst interface { - // FromProto unmarshals PatternFlowPfcPauseDst from protobuf object *otg.PatternFlowPfcPauseDst - FromProto(msg *otg.PatternFlowPfcPauseDst) (PatternFlowPfcPauseDst, error) - // FromPbText unmarshals PatternFlowPfcPauseDst from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseDst from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseDst from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseDst) Marshal() marshalPatternFlowPfcPauseDst { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseDst{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseDst) Unmarshal() unMarshalPatternFlowPfcPauseDst { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseDst{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseDst) ToProto() (*otg.PatternFlowPfcPauseDst, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseDst) FromProto(msg *otg.PatternFlowPfcPauseDst) (PatternFlowPfcPauseDst, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseDst) 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 *unMarshalpatternFlowPfcPauseDst) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPfcPauseDst) 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 *unMarshalpatternFlowPfcPauseDst) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPfcPauseDst) 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 *unMarshalpatternFlowPfcPauseDst) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPfcPauseDst) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseDst) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseDst) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseDst) Clone() (PatternFlowPfcPauseDst, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseDst() - 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 -} - -func (obj *patternFlowPfcPauseDst) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPfcPauseDst is destination MAC address -type PatternFlowPfcPauseDst interface { - Validation - // msg marshals PatternFlowPfcPauseDst to protobuf object *otg.PatternFlowPfcPauseDst - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseDst - // setMsg unmarshals PatternFlowPfcPauseDst from protobuf object *otg.PatternFlowPfcPauseDst - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseDst) PatternFlowPfcPauseDst - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseDst - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseDst - // validate validates PatternFlowPfcPauseDst - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseDst, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPfcPauseDstChoiceEnum, set in PatternFlowPfcPauseDst - Choice() PatternFlowPfcPauseDstChoiceEnum - // setChoice assigns PatternFlowPfcPauseDstChoiceEnum provided by user to PatternFlowPfcPauseDst - setChoice(value PatternFlowPfcPauseDstChoiceEnum) PatternFlowPfcPauseDst - // HasChoice checks if Choice has been set in PatternFlowPfcPauseDst - HasChoice() bool - // Value returns string, set in PatternFlowPfcPauseDst. - Value() string - // SetValue assigns string provided by user to PatternFlowPfcPauseDst - SetValue(value string) PatternFlowPfcPauseDst - // HasValue checks if Value has been set in PatternFlowPfcPauseDst - HasValue() bool - // Values returns []string, set in PatternFlowPfcPauseDst. - Values() []string - // SetValues assigns []string provided by user to PatternFlowPfcPauseDst - SetValues(value []string) PatternFlowPfcPauseDst - // Increment returns PatternFlowPfcPauseDstCounter, set in PatternFlowPfcPauseDst. - // PatternFlowPfcPauseDstCounter is mac counter pattern - Increment() PatternFlowPfcPauseDstCounter - // SetIncrement assigns PatternFlowPfcPauseDstCounter provided by user to PatternFlowPfcPauseDst. - // PatternFlowPfcPauseDstCounter is mac counter pattern - SetIncrement(value PatternFlowPfcPauseDstCounter) PatternFlowPfcPauseDst - // HasIncrement checks if Increment has been set in PatternFlowPfcPauseDst - HasIncrement() bool - // Decrement returns PatternFlowPfcPauseDstCounter, set in PatternFlowPfcPauseDst. - // PatternFlowPfcPauseDstCounter is mac counter pattern - Decrement() PatternFlowPfcPauseDstCounter - // SetDecrement assigns PatternFlowPfcPauseDstCounter provided by user to PatternFlowPfcPauseDst. - // PatternFlowPfcPauseDstCounter is mac counter pattern - SetDecrement(value PatternFlowPfcPauseDstCounter) PatternFlowPfcPauseDst - // HasDecrement checks if Decrement has been set in PatternFlowPfcPauseDst - HasDecrement() bool - // MetricTags returns PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIterIter, set in PatternFlowPfcPauseDst - MetricTags() PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter - setNil() -} - -type PatternFlowPfcPauseDstChoiceEnum string - -// Enum of Choice on PatternFlowPfcPauseDst -var PatternFlowPfcPauseDstChoice = struct { - VALUE PatternFlowPfcPauseDstChoiceEnum - VALUES PatternFlowPfcPauseDstChoiceEnum - INCREMENT PatternFlowPfcPauseDstChoiceEnum - DECREMENT PatternFlowPfcPauseDstChoiceEnum -}{ - VALUE: PatternFlowPfcPauseDstChoiceEnum("value"), - VALUES: PatternFlowPfcPauseDstChoiceEnum("values"), - INCREMENT: PatternFlowPfcPauseDstChoiceEnum("increment"), - DECREMENT: PatternFlowPfcPauseDstChoiceEnum("decrement"), -} - -func (obj *patternFlowPfcPauseDst) Choice() PatternFlowPfcPauseDstChoiceEnum { - return PatternFlowPfcPauseDstChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPfcPauseDst) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPfcPauseDst) setChoice(value PatternFlowPfcPauseDstChoiceEnum) PatternFlowPfcPauseDst { - intValue, ok := otg.PatternFlowPfcPauseDst_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPfcPauseDstChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPfcPauseDst_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPfcPauseDstChoice.VALUE { - defaultValue := "01:80:c2:00:00:01" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPfcPauseDstChoice.VALUES { - defaultValue := []string{"01:80:c2:00:00:01"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPfcPauseDstChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowPfcPauseDstCounter().msg() - } - - if value == PatternFlowPfcPauseDstChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPfcPauseDstCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowPfcPauseDst) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPfcPauseDstChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowPfcPauseDst) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowPfcPauseDst object -func (obj *patternFlowPfcPauseDst) SetValue(value string) PatternFlowPfcPauseDst { - obj.setChoice(PatternFlowPfcPauseDstChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowPfcPauseDst) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"01:80:c2:00:00:01"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowPfcPauseDst object -func (obj *patternFlowPfcPauseDst) SetValues(value []string) PatternFlowPfcPauseDst { - obj.setChoice(PatternFlowPfcPauseDstChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPfcPauseDstCounter -func (obj *patternFlowPfcPauseDst) Increment() PatternFlowPfcPauseDstCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPfcPauseDstChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPfcPauseDstCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPfcPauseDstCounter -func (obj *patternFlowPfcPauseDst) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPfcPauseDstCounter value in the PatternFlowPfcPauseDst object -func (obj *patternFlowPfcPauseDst) SetIncrement(value PatternFlowPfcPauseDstCounter) PatternFlowPfcPauseDst { - obj.setChoice(PatternFlowPfcPauseDstChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPfcPauseDstCounter -func (obj *patternFlowPfcPauseDst) Decrement() PatternFlowPfcPauseDstCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPfcPauseDstChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPfcPauseDstCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPfcPauseDstCounter -func (obj *patternFlowPfcPauseDst) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPfcPauseDstCounter value in the PatternFlowPfcPauseDst object -func (obj *patternFlowPfcPauseDst) SetDecrement(value PatternFlowPfcPauseDstCounter) PatternFlowPfcPauseDst { - obj.setChoice(PatternFlowPfcPauseDstChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPfcPauseDstMetricTag -func (obj *patternFlowPfcPauseDst) MetricTags() PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPfcPauseDstMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter struct { - obj *patternFlowPfcPauseDst - patternFlowPfcPauseDstMetricTagSlice []PatternFlowPfcPauseDstMetricTag - fieldPtr *[]*otg.PatternFlowPfcPauseDstMetricTag -} - -func newPatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter(ptr *[]*otg.PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { - return &patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter interface { - setMsg(*patternFlowPfcPauseDst) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter - Items() []PatternFlowPfcPauseDstMetricTag - Add() PatternFlowPfcPauseDstMetricTag - Append(items ...PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter - Set(index int, newObj PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter - Clear() PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter - clearHolderSlice() PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter - appendHolderSlice(item PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter -} - -func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) setMsg(msg *patternFlowPfcPauseDst) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPfcPauseDstMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) Items() []PatternFlowPfcPauseDstMetricTag { - return obj.patternFlowPfcPauseDstMetricTagSlice -} - -func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) Add() PatternFlowPfcPauseDstMetricTag { - newObj := &otg.PatternFlowPfcPauseDstMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPfcPauseDstMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPfcPauseDstMetricTagSlice = append(obj.patternFlowPfcPauseDstMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) Append(items ...PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPfcPauseDstMetricTagSlice = append(obj.patternFlowPfcPauseDstMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) Set(index int, newObj PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPfcPauseDstMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) Clear() PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPfcPauseDstMetricTag{} - obj.patternFlowPfcPauseDstMetricTagSlice = []PatternFlowPfcPauseDstMetricTag{} - } - return obj -} -func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) clearHolderSlice() PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { - if len(obj.patternFlowPfcPauseDstMetricTagSlice) > 0 { - obj.patternFlowPfcPauseDstMetricTagSlice = []PatternFlowPfcPauseDstMetricTag{} - } - return obj -} -func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) appendHolderSlice(item PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { - obj.patternFlowPfcPauseDstMetricTagSlice = append(obj.patternFlowPfcPauseDstMetricTagSlice, item) - return obj -} - -func (obj *patternFlowPfcPauseDst) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateMac(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseDst.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateMacSlice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseDst.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPfcPauseDstMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPfcPauseDst) setDefault() { - var choices_set int = 0 - var choice PatternFlowPfcPauseDstChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPfcPauseDstChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPfcPauseDstChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPfcPauseDstChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPfcPauseDstChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPfcPauseDstChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPauseDst") - } - } else { - intVal := otg.PatternFlowPfcPauseDst_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPfcPauseDst_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPfcPauseSrc ***** -type patternFlowPfcPauseSrc struct { - validation - obj *otg.PatternFlowPfcPauseSrc - marshaller marshalPatternFlowPfcPauseSrc - unMarshaller unMarshalPatternFlowPfcPauseSrc - incrementHolder PatternFlowPfcPauseSrcCounter - decrementHolder PatternFlowPfcPauseSrcCounter - metricTagsHolder PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter -} - -func NewPatternFlowPfcPauseSrc() PatternFlowPfcPauseSrc { - obj := patternFlowPfcPauseSrc{obj: &otg.PatternFlowPfcPauseSrc{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseSrc) msg() *otg.PatternFlowPfcPauseSrc { - return obj.obj -} - -func (obj *patternFlowPfcPauseSrc) setMsg(msg *otg.PatternFlowPfcPauseSrc) PatternFlowPfcPauseSrc { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseSrc struct { - obj *patternFlowPfcPauseSrc -} - -type marshalPatternFlowPfcPauseSrc interface { - // ToProto marshals PatternFlowPfcPauseSrc to protobuf object *otg.PatternFlowPfcPauseSrc - ToProto() (*otg.PatternFlowPfcPauseSrc, error) - // ToPbText marshals PatternFlowPfcPauseSrc to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseSrc to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseSrc to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseSrc struct { - obj *patternFlowPfcPauseSrc -} - -type unMarshalPatternFlowPfcPauseSrc interface { - // FromProto unmarshals PatternFlowPfcPauseSrc from protobuf object *otg.PatternFlowPfcPauseSrc - FromProto(msg *otg.PatternFlowPfcPauseSrc) (PatternFlowPfcPauseSrc, error) - // FromPbText unmarshals PatternFlowPfcPauseSrc from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseSrc from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseSrc from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseSrc) Marshal() marshalPatternFlowPfcPauseSrc { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseSrc{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseSrc) Unmarshal() unMarshalPatternFlowPfcPauseSrc { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseSrc{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseSrc) ToProto() (*otg.PatternFlowPfcPauseSrc, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseSrc) FromProto(msg *otg.PatternFlowPfcPauseSrc) (PatternFlowPfcPauseSrc, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseSrc) 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 *unMarshalpatternFlowPfcPauseSrc) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPfcPauseSrc) 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 *unMarshalpatternFlowPfcPauseSrc) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPfcPauseSrc) 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 *unMarshalpatternFlowPfcPauseSrc) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPfcPauseSrc) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseSrc) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseSrc) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseSrc) Clone() (PatternFlowPfcPauseSrc, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseSrc() - 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 -} - -func (obj *patternFlowPfcPauseSrc) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPfcPauseSrc is source MAC address -type PatternFlowPfcPauseSrc interface { - Validation - // msg marshals PatternFlowPfcPauseSrc to protobuf object *otg.PatternFlowPfcPauseSrc - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseSrc - // setMsg unmarshals PatternFlowPfcPauseSrc from protobuf object *otg.PatternFlowPfcPauseSrc - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseSrc) PatternFlowPfcPauseSrc - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseSrc - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseSrc - // validate validates PatternFlowPfcPauseSrc - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseSrc, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPfcPauseSrcChoiceEnum, set in PatternFlowPfcPauseSrc - Choice() PatternFlowPfcPauseSrcChoiceEnum - // setChoice assigns PatternFlowPfcPauseSrcChoiceEnum provided by user to PatternFlowPfcPauseSrc - setChoice(value PatternFlowPfcPauseSrcChoiceEnum) PatternFlowPfcPauseSrc - // HasChoice checks if Choice has been set in PatternFlowPfcPauseSrc - HasChoice() bool - // Value returns string, set in PatternFlowPfcPauseSrc. - Value() string - // SetValue assigns string provided by user to PatternFlowPfcPauseSrc - SetValue(value string) PatternFlowPfcPauseSrc - // HasValue checks if Value has been set in PatternFlowPfcPauseSrc - HasValue() bool - // Values returns []string, set in PatternFlowPfcPauseSrc. - Values() []string - // SetValues assigns []string provided by user to PatternFlowPfcPauseSrc - SetValues(value []string) PatternFlowPfcPauseSrc - // Increment returns PatternFlowPfcPauseSrcCounter, set in PatternFlowPfcPauseSrc. - // PatternFlowPfcPauseSrcCounter is mac counter pattern - Increment() PatternFlowPfcPauseSrcCounter - // SetIncrement assigns PatternFlowPfcPauseSrcCounter provided by user to PatternFlowPfcPauseSrc. - // PatternFlowPfcPauseSrcCounter is mac counter pattern - SetIncrement(value PatternFlowPfcPauseSrcCounter) PatternFlowPfcPauseSrc - // HasIncrement checks if Increment has been set in PatternFlowPfcPauseSrc - HasIncrement() bool - // Decrement returns PatternFlowPfcPauseSrcCounter, set in PatternFlowPfcPauseSrc. - // PatternFlowPfcPauseSrcCounter is mac counter pattern - Decrement() PatternFlowPfcPauseSrcCounter - // SetDecrement assigns PatternFlowPfcPauseSrcCounter provided by user to PatternFlowPfcPauseSrc. - // PatternFlowPfcPauseSrcCounter is mac counter pattern - SetDecrement(value PatternFlowPfcPauseSrcCounter) PatternFlowPfcPauseSrc - // HasDecrement checks if Decrement has been set in PatternFlowPfcPauseSrc - HasDecrement() bool - // MetricTags returns PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIterIter, set in PatternFlowPfcPauseSrc - MetricTags() PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter - setNil() -} - -type PatternFlowPfcPauseSrcChoiceEnum string - -// Enum of Choice on PatternFlowPfcPauseSrc -var PatternFlowPfcPauseSrcChoice = struct { - VALUE PatternFlowPfcPauseSrcChoiceEnum - VALUES PatternFlowPfcPauseSrcChoiceEnum - INCREMENT PatternFlowPfcPauseSrcChoiceEnum - DECREMENT PatternFlowPfcPauseSrcChoiceEnum -}{ - VALUE: PatternFlowPfcPauseSrcChoiceEnum("value"), - VALUES: PatternFlowPfcPauseSrcChoiceEnum("values"), - INCREMENT: PatternFlowPfcPauseSrcChoiceEnum("increment"), - DECREMENT: PatternFlowPfcPauseSrcChoiceEnum("decrement"), -} - -func (obj *patternFlowPfcPauseSrc) Choice() PatternFlowPfcPauseSrcChoiceEnum { - return PatternFlowPfcPauseSrcChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPfcPauseSrc) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPfcPauseSrc) setChoice(value PatternFlowPfcPauseSrcChoiceEnum) PatternFlowPfcPauseSrc { - intValue, ok := otg.PatternFlowPfcPauseSrc_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPfcPauseSrcChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPfcPauseSrc_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPfcPauseSrcChoice.VALUE { - defaultValue := "00:00:00:00:00:00" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPfcPauseSrcChoice.VALUES { - defaultValue := []string{"00:00:00:00:00:00"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPfcPauseSrcChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowPfcPauseSrcCounter().msg() - } - - if value == PatternFlowPfcPauseSrcChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPfcPauseSrcCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowPfcPauseSrc) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPfcPauseSrcChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowPfcPauseSrc) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowPfcPauseSrc object -func (obj *patternFlowPfcPauseSrc) SetValue(value string) PatternFlowPfcPauseSrc { - obj.setChoice(PatternFlowPfcPauseSrcChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowPfcPauseSrc) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"00:00:00:00:00:00"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowPfcPauseSrc object -func (obj *patternFlowPfcPauseSrc) SetValues(value []string) PatternFlowPfcPauseSrc { - obj.setChoice(PatternFlowPfcPauseSrcChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPfcPauseSrcCounter -func (obj *patternFlowPfcPauseSrc) Increment() PatternFlowPfcPauseSrcCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPfcPauseSrcChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPfcPauseSrcCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPfcPauseSrcCounter -func (obj *patternFlowPfcPauseSrc) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPfcPauseSrcCounter value in the PatternFlowPfcPauseSrc object -func (obj *patternFlowPfcPauseSrc) SetIncrement(value PatternFlowPfcPauseSrcCounter) PatternFlowPfcPauseSrc { - obj.setChoice(PatternFlowPfcPauseSrcChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPfcPauseSrcCounter -func (obj *patternFlowPfcPauseSrc) Decrement() PatternFlowPfcPauseSrcCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPfcPauseSrcChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPfcPauseSrcCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPfcPauseSrcCounter -func (obj *patternFlowPfcPauseSrc) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPfcPauseSrcCounter value in the PatternFlowPfcPauseSrc object -func (obj *patternFlowPfcPauseSrc) SetDecrement(value PatternFlowPfcPauseSrcCounter) PatternFlowPfcPauseSrc { - obj.setChoice(PatternFlowPfcPauseSrcChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPfcPauseSrcMetricTag -func (obj *patternFlowPfcPauseSrc) MetricTags() PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPfcPauseSrcMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter struct { - obj *patternFlowPfcPauseSrc - patternFlowPfcPauseSrcMetricTagSlice []PatternFlowPfcPauseSrcMetricTag - fieldPtr *[]*otg.PatternFlowPfcPauseSrcMetricTag -} - -func newPatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter(ptr *[]*otg.PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { - return &patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter interface { - setMsg(*patternFlowPfcPauseSrc) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter - Items() []PatternFlowPfcPauseSrcMetricTag - Add() PatternFlowPfcPauseSrcMetricTag - Append(items ...PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter - Set(index int, newObj PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter - Clear() PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter - clearHolderSlice() PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter - appendHolderSlice(item PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter -} - -func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) setMsg(msg *patternFlowPfcPauseSrc) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPfcPauseSrcMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) Items() []PatternFlowPfcPauseSrcMetricTag { - return obj.patternFlowPfcPauseSrcMetricTagSlice -} - -func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) Add() PatternFlowPfcPauseSrcMetricTag { - newObj := &otg.PatternFlowPfcPauseSrcMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPfcPauseSrcMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPfcPauseSrcMetricTagSlice = append(obj.patternFlowPfcPauseSrcMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) Append(items ...PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPfcPauseSrcMetricTagSlice = append(obj.patternFlowPfcPauseSrcMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) Set(index int, newObj PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPfcPauseSrcMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) Clear() PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPfcPauseSrcMetricTag{} - obj.patternFlowPfcPauseSrcMetricTagSlice = []PatternFlowPfcPauseSrcMetricTag{} - } - return obj -} -func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) clearHolderSlice() PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { - if len(obj.patternFlowPfcPauseSrcMetricTagSlice) > 0 { - obj.patternFlowPfcPauseSrcMetricTagSlice = []PatternFlowPfcPauseSrcMetricTag{} - } - return obj -} -func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) appendHolderSlice(item PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { - obj.patternFlowPfcPauseSrcMetricTagSlice = append(obj.patternFlowPfcPauseSrcMetricTagSlice, item) - return obj -} - -func (obj *patternFlowPfcPauseSrc) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateMac(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseSrc.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateMacSlice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseSrc.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPfcPauseSrcMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPfcPauseSrc) setDefault() { - var choices_set int = 0 - var choice PatternFlowPfcPauseSrcChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPfcPauseSrcChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPfcPauseSrcChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPfcPauseSrcChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPfcPauseSrcChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPfcPauseSrcChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPauseSrc") - } - } else { - intVal := otg.PatternFlowPfcPauseSrc_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPfcPauseSrc_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPfcPauseEtherType ***** -type patternFlowPfcPauseEtherType struct { - validation - obj *otg.PatternFlowPfcPauseEtherType - marshaller marshalPatternFlowPfcPauseEtherType - unMarshaller unMarshalPatternFlowPfcPauseEtherType - incrementHolder PatternFlowPfcPauseEtherTypeCounter - decrementHolder PatternFlowPfcPauseEtherTypeCounter - metricTagsHolder PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter -} - -func NewPatternFlowPfcPauseEtherType() PatternFlowPfcPauseEtherType { - obj := patternFlowPfcPauseEtherType{obj: &otg.PatternFlowPfcPauseEtherType{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseEtherType) msg() *otg.PatternFlowPfcPauseEtherType { - return obj.obj -} - -func (obj *patternFlowPfcPauseEtherType) setMsg(msg *otg.PatternFlowPfcPauseEtherType) PatternFlowPfcPauseEtherType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseEtherType struct { - obj *patternFlowPfcPauseEtherType -} - -type marshalPatternFlowPfcPauseEtherType interface { - // ToProto marshals PatternFlowPfcPauseEtherType to protobuf object *otg.PatternFlowPfcPauseEtherType - ToProto() (*otg.PatternFlowPfcPauseEtherType, error) - // ToPbText marshals PatternFlowPfcPauseEtherType to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseEtherType to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseEtherType to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseEtherType struct { - obj *patternFlowPfcPauseEtherType -} - -type unMarshalPatternFlowPfcPauseEtherType interface { - // FromProto unmarshals PatternFlowPfcPauseEtherType from protobuf object *otg.PatternFlowPfcPauseEtherType - FromProto(msg *otg.PatternFlowPfcPauseEtherType) (PatternFlowPfcPauseEtherType, error) - // FromPbText unmarshals PatternFlowPfcPauseEtherType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseEtherType from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseEtherType from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseEtherType) Marshal() marshalPatternFlowPfcPauseEtherType { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseEtherType{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseEtherType) Unmarshal() unMarshalPatternFlowPfcPauseEtherType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseEtherType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseEtherType) ToProto() (*otg.PatternFlowPfcPauseEtherType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseEtherType) FromProto(msg *otg.PatternFlowPfcPauseEtherType) (PatternFlowPfcPauseEtherType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseEtherType) 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 *unMarshalpatternFlowPfcPauseEtherType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPfcPauseEtherType) 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 *unMarshalpatternFlowPfcPauseEtherType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPfcPauseEtherType) 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 *unMarshalpatternFlowPfcPauseEtherType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPfcPauseEtherType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseEtherType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseEtherType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseEtherType) Clone() (PatternFlowPfcPauseEtherType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseEtherType() - 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 -} - -func (obj *patternFlowPfcPauseEtherType) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPfcPauseEtherType is ethernet type -type PatternFlowPfcPauseEtherType interface { - Validation - // msg marshals PatternFlowPfcPauseEtherType to protobuf object *otg.PatternFlowPfcPauseEtherType - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseEtherType - // setMsg unmarshals PatternFlowPfcPauseEtherType from protobuf object *otg.PatternFlowPfcPauseEtherType - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseEtherType) PatternFlowPfcPauseEtherType - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseEtherType - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseEtherType - // validate validates PatternFlowPfcPauseEtherType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseEtherType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPfcPauseEtherTypeChoiceEnum, set in PatternFlowPfcPauseEtherType - Choice() PatternFlowPfcPauseEtherTypeChoiceEnum - // setChoice assigns PatternFlowPfcPauseEtherTypeChoiceEnum provided by user to PatternFlowPfcPauseEtherType - setChoice(value PatternFlowPfcPauseEtherTypeChoiceEnum) PatternFlowPfcPauseEtherType - // HasChoice checks if Choice has been set in PatternFlowPfcPauseEtherType - HasChoice() bool - // Value returns uint32, set in PatternFlowPfcPauseEtherType. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowPfcPauseEtherType - SetValue(value uint32) PatternFlowPfcPauseEtherType - // HasValue checks if Value has been set in PatternFlowPfcPauseEtherType - HasValue() bool - // Values returns []uint32, set in PatternFlowPfcPauseEtherType. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowPfcPauseEtherType - SetValues(value []uint32) PatternFlowPfcPauseEtherType - // Increment returns PatternFlowPfcPauseEtherTypeCounter, set in PatternFlowPfcPauseEtherType. - // PatternFlowPfcPauseEtherTypeCounter is integer counter pattern - Increment() PatternFlowPfcPauseEtherTypeCounter - // SetIncrement assigns PatternFlowPfcPauseEtherTypeCounter provided by user to PatternFlowPfcPauseEtherType. - // PatternFlowPfcPauseEtherTypeCounter is integer counter pattern - SetIncrement(value PatternFlowPfcPauseEtherTypeCounter) PatternFlowPfcPauseEtherType - // HasIncrement checks if Increment has been set in PatternFlowPfcPauseEtherType - HasIncrement() bool - // Decrement returns PatternFlowPfcPauseEtherTypeCounter, set in PatternFlowPfcPauseEtherType. - // PatternFlowPfcPauseEtherTypeCounter is integer counter pattern - Decrement() PatternFlowPfcPauseEtherTypeCounter - // SetDecrement assigns PatternFlowPfcPauseEtherTypeCounter provided by user to PatternFlowPfcPauseEtherType. - // PatternFlowPfcPauseEtherTypeCounter is integer counter pattern - SetDecrement(value PatternFlowPfcPauseEtherTypeCounter) PatternFlowPfcPauseEtherType - // HasDecrement checks if Decrement has been set in PatternFlowPfcPauseEtherType - HasDecrement() bool - // MetricTags returns PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIterIter, set in PatternFlowPfcPauseEtherType - MetricTags() PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter - setNil() -} - -type PatternFlowPfcPauseEtherTypeChoiceEnum string - -// Enum of Choice on PatternFlowPfcPauseEtherType -var PatternFlowPfcPauseEtherTypeChoice = struct { - VALUE PatternFlowPfcPauseEtherTypeChoiceEnum - VALUES PatternFlowPfcPauseEtherTypeChoiceEnum - INCREMENT PatternFlowPfcPauseEtherTypeChoiceEnum - DECREMENT PatternFlowPfcPauseEtherTypeChoiceEnum -}{ - VALUE: PatternFlowPfcPauseEtherTypeChoiceEnum("value"), - VALUES: PatternFlowPfcPauseEtherTypeChoiceEnum("values"), - INCREMENT: PatternFlowPfcPauseEtherTypeChoiceEnum("increment"), - DECREMENT: PatternFlowPfcPauseEtherTypeChoiceEnum("decrement"), -} - -func (obj *patternFlowPfcPauseEtherType) Choice() PatternFlowPfcPauseEtherTypeChoiceEnum { - return PatternFlowPfcPauseEtherTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPfcPauseEtherType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPfcPauseEtherType) setChoice(value PatternFlowPfcPauseEtherTypeChoiceEnum) PatternFlowPfcPauseEtherType { - intValue, ok := otg.PatternFlowPfcPauseEtherType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPfcPauseEtherTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPfcPauseEtherType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPfcPauseEtherTypeChoice.VALUE { - defaultValue := uint32(34824) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPfcPauseEtherTypeChoice.VALUES { - defaultValue := []uint32{34824} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPfcPauseEtherTypeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowPfcPauseEtherTypeCounter().msg() - } - - if value == PatternFlowPfcPauseEtherTypeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPfcPauseEtherTypeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPauseEtherType) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPauseEtherType) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowPfcPauseEtherType object -func (obj *patternFlowPfcPauseEtherType) SetValue(value uint32) PatternFlowPfcPauseEtherType { - obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowPfcPauseEtherType) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{34824}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowPfcPauseEtherType object -func (obj *patternFlowPfcPauseEtherType) SetValues(value []uint32) PatternFlowPfcPauseEtherType { - obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPfcPauseEtherTypeCounter -func (obj *patternFlowPfcPauseEtherType) Increment() PatternFlowPfcPauseEtherTypeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPfcPauseEtherTypeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPfcPauseEtherTypeCounter -func (obj *patternFlowPfcPauseEtherType) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPfcPauseEtherTypeCounter value in the PatternFlowPfcPauseEtherType object -func (obj *patternFlowPfcPauseEtherType) SetIncrement(value PatternFlowPfcPauseEtherTypeCounter) PatternFlowPfcPauseEtherType { - obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPfcPauseEtherTypeCounter -func (obj *patternFlowPfcPauseEtherType) Decrement() PatternFlowPfcPauseEtherTypeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPfcPauseEtherTypeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPfcPauseEtherTypeCounter -func (obj *patternFlowPfcPauseEtherType) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPfcPauseEtherTypeCounter value in the PatternFlowPfcPauseEtherType object -func (obj *patternFlowPfcPauseEtherType) SetDecrement(value PatternFlowPfcPauseEtherTypeCounter) PatternFlowPfcPauseEtherType { - obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPfcPauseEtherTypeMetricTag -func (obj *patternFlowPfcPauseEtherType) MetricTags() PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPfcPauseEtherTypeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter struct { - obj *patternFlowPfcPauseEtherType - patternFlowPfcPauseEtherTypeMetricTagSlice []PatternFlowPfcPauseEtherTypeMetricTag - fieldPtr *[]*otg.PatternFlowPfcPauseEtherTypeMetricTag -} - -func newPatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter(ptr *[]*otg.PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { - return &patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter interface { - setMsg(*patternFlowPfcPauseEtherType) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter - Items() []PatternFlowPfcPauseEtherTypeMetricTag - Add() PatternFlowPfcPauseEtherTypeMetricTag - Append(items ...PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter - Set(index int, newObj PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter - Clear() PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter - clearHolderSlice() PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter - appendHolderSlice(item PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter -} - -func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) setMsg(msg *patternFlowPfcPauseEtherType) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPfcPauseEtherTypeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) Items() []PatternFlowPfcPauseEtherTypeMetricTag { - return obj.patternFlowPfcPauseEtherTypeMetricTagSlice -} - -func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) Add() PatternFlowPfcPauseEtherTypeMetricTag { - newObj := &otg.PatternFlowPfcPauseEtherTypeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPfcPauseEtherTypeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPfcPauseEtherTypeMetricTagSlice = append(obj.patternFlowPfcPauseEtherTypeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) Append(items ...PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPfcPauseEtherTypeMetricTagSlice = append(obj.patternFlowPfcPauseEtherTypeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) Set(index int, newObj PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPfcPauseEtherTypeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) Clear() PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPfcPauseEtherTypeMetricTag{} - obj.patternFlowPfcPauseEtherTypeMetricTagSlice = []PatternFlowPfcPauseEtherTypeMetricTag{} - } - return obj -} -func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) clearHolderSlice() PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { - if len(obj.patternFlowPfcPauseEtherTypeMetricTagSlice) > 0 { - obj.patternFlowPfcPauseEtherTypeMetricTagSlice = []PatternFlowPfcPauseEtherTypeMetricTag{} - } - return obj -} -func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) appendHolderSlice(item PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { - obj.patternFlowPfcPauseEtherTypeMetricTagSlice = append(obj.patternFlowPfcPauseEtherTypeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowPfcPauseEtherType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseEtherType.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowPfcPauseEtherType.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPfcPauseEtherTypeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPfcPauseEtherType) setDefault() { - var choices_set int = 0 - var choice PatternFlowPfcPauseEtherTypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPfcPauseEtherTypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPfcPauseEtherTypeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPfcPauseEtherTypeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPfcPauseEtherTypeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPauseEtherType") - } - } else { - intVal := otg.PatternFlowPfcPauseEtherType_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPfcPauseEtherType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPfcPauseControlOpCode ***** -type patternFlowPfcPauseControlOpCode struct { - validation - obj *otg.PatternFlowPfcPauseControlOpCode - marshaller marshalPatternFlowPfcPauseControlOpCode - unMarshaller unMarshalPatternFlowPfcPauseControlOpCode - incrementHolder PatternFlowPfcPauseControlOpCodeCounter - decrementHolder PatternFlowPfcPauseControlOpCodeCounter - metricTagsHolder PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter -} - -func NewPatternFlowPfcPauseControlOpCode() PatternFlowPfcPauseControlOpCode { - obj := patternFlowPfcPauseControlOpCode{obj: &otg.PatternFlowPfcPauseControlOpCode{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseControlOpCode) msg() *otg.PatternFlowPfcPauseControlOpCode { - return obj.obj -} - -func (obj *patternFlowPfcPauseControlOpCode) setMsg(msg *otg.PatternFlowPfcPauseControlOpCode) PatternFlowPfcPauseControlOpCode { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseControlOpCode struct { - obj *patternFlowPfcPauseControlOpCode -} - -type marshalPatternFlowPfcPauseControlOpCode interface { - // ToProto marshals PatternFlowPfcPauseControlOpCode to protobuf object *otg.PatternFlowPfcPauseControlOpCode - ToProto() (*otg.PatternFlowPfcPauseControlOpCode, error) - // ToPbText marshals PatternFlowPfcPauseControlOpCode to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseControlOpCode to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseControlOpCode to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseControlOpCode struct { - obj *patternFlowPfcPauseControlOpCode -} - -type unMarshalPatternFlowPfcPauseControlOpCode interface { - // FromProto unmarshals PatternFlowPfcPauseControlOpCode from protobuf object *otg.PatternFlowPfcPauseControlOpCode - FromProto(msg *otg.PatternFlowPfcPauseControlOpCode) (PatternFlowPfcPauseControlOpCode, error) - // FromPbText unmarshals PatternFlowPfcPauseControlOpCode from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseControlOpCode from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseControlOpCode from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseControlOpCode) Marshal() marshalPatternFlowPfcPauseControlOpCode { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseControlOpCode{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseControlOpCode) Unmarshal() unMarshalPatternFlowPfcPauseControlOpCode { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseControlOpCode{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseControlOpCode) ToProto() (*otg.PatternFlowPfcPauseControlOpCode, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseControlOpCode) FromProto(msg *otg.PatternFlowPfcPauseControlOpCode) (PatternFlowPfcPauseControlOpCode, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseControlOpCode) 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 *unMarshalpatternFlowPfcPauseControlOpCode) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPfcPauseControlOpCode) 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 *unMarshalpatternFlowPfcPauseControlOpCode) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPfcPauseControlOpCode) 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 *unMarshalpatternFlowPfcPauseControlOpCode) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPfcPauseControlOpCode) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseControlOpCode) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseControlOpCode) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseControlOpCode) Clone() (PatternFlowPfcPauseControlOpCode, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseControlOpCode() - 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 -} - -func (obj *patternFlowPfcPauseControlOpCode) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPfcPauseControlOpCode is control operation code -type PatternFlowPfcPauseControlOpCode interface { - Validation - // msg marshals PatternFlowPfcPauseControlOpCode to protobuf object *otg.PatternFlowPfcPauseControlOpCode - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseControlOpCode - // setMsg unmarshals PatternFlowPfcPauseControlOpCode from protobuf object *otg.PatternFlowPfcPauseControlOpCode - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseControlOpCode) PatternFlowPfcPauseControlOpCode - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseControlOpCode - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseControlOpCode - // validate validates PatternFlowPfcPauseControlOpCode - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseControlOpCode, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPfcPauseControlOpCodeChoiceEnum, set in PatternFlowPfcPauseControlOpCode - Choice() PatternFlowPfcPauseControlOpCodeChoiceEnum - // setChoice assigns PatternFlowPfcPauseControlOpCodeChoiceEnum provided by user to PatternFlowPfcPauseControlOpCode - setChoice(value PatternFlowPfcPauseControlOpCodeChoiceEnum) PatternFlowPfcPauseControlOpCode - // HasChoice checks if Choice has been set in PatternFlowPfcPauseControlOpCode - HasChoice() bool - // Value returns uint32, set in PatternFlowPfcPauseControlOpCode. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowPfcPauseControlOpCode - SetValue(value uint32) PatternFlowPfcPauseControlOpCode - // HasValue checks if Value has been set in PatternFlowPfcPauseControlOpCode - HasValue() bool - // Values returns []uint32, set in PatternFlowPfcPauseControlOpCode. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowPfcPauseControlOpCode - SetValues(value []uint32) PatternFlowPfcPauseControlOpCode - // Increment returns PatternFlowPfcPauseControlOpCodeCounter, set in PatternFlowPfcPauseControlOpCode. - // PatternFlowPfcPauseControlOpCodeCounter is integer counter pattern - Increment() PatternFlowPfcPauseControlOpCodeCounter - // SetIncrement assigns PatternFlowPfcPauseControlOpCodeCounter provided by user to PatternFlowPfcPauseControlOpCode. - // PatternFlowPfcPauseControlOpCodeCounter is integer counter pattern - SetIncrement(value PatternFlowPfcPauseControlOpCodeCounter) PatternFlowPfcPauseControlOpCode - // HasIncrement checks if Increment has been set in PatternFlowPfcPauseControlOpCode - HasIncrement() bool - // Decrement returns PatternFlowPfcPauseControlOpCodeCounter, set in PatternFlowPfcPauseControlOpCode. - // PatternFlowPfcPauseControlOpCodeCounter is integer counter pattern - Decrement() PatternFlowPfcPauseControlOpCodeCounter - // SetDecrement assigns PatternFlowPfcPauseControlOpCodeCounter provided by user to PatternFlowPfcPauseControlOpCode. - // PatternFlowPfcPauseControlOpCodeCounter is integer counter pattern - SetDecrement(value PatternFlowPfcPauseControlOpCodeCounter) PatternFlowPfcPauseControlOpCode - // HasDecrement checks if Decrement has been set in PatternFlowPfcPauseControlOpCode - HasDecrement() bool - // MetricTags returns PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIterIter, set in PatternFlowPfcPauseControlOpCode - MetricTags() PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter - setNil() -} - -type PatternFlowPfcPauseControlOpCodeChoiceEnum string - -// Enum of Choice on PatternFlowPfcPauseControlOpCode -var PatternFlowPfcPauseControlOpCodeChoice = struct { - VALUE PatternFlowPfcPauseControlOpCodeChoiceEnum - VALUES PatternFlowPfcPauseControlOpCodeChoiceEnum - INCREMENT PatternFlowPfcPauseControlOpCodeChoiceEnum - DECREMENT PatternFlowPfcPauseControlOpCodeChoiceEnum -}{ - VALUE: PatternFlowPfcPauseControlOpCodeChoiceEnum("value"), - VALUES: PatternFlowPfcPauseControlOpCodeChoiceEnum("values"), - INCREMENT: PatternFlowPfcPauseControlOpCodeChoiceEnum("increment"), - DECREMENT: PatternFlowPfcPauseControlOpCodeChoiceEnum("decrement"), -} - -func (obj *patternFlowPfcPauseControlOpCode) Choice() PatternFlowPfcPauseControlOpCodeChoiceEnum { - return PatternFlowPfcPauseControlOpCodeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPfcPauseControlOpCode) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPfcPauseControlOpCode) setChoice(value PatternFlowPfcPauseControlOpCodeChoiceEnum) PatternFlowPfcPauseControlOpCode { - intValue, ok := otg.PatternFlowPfcPauseControlOpCode_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPfcPauseControlOpCodeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPfcPauseControlOpCode_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPfcPauseControlOpCodeChoice.VALUE { - defaultValue := uint32(257) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPfcPauseControlOpCodeChoice.VALUES { - defaultValue := []uint32{257} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPfcPauseControlOpCodeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowPfcPauseControlOpCodeCounter().msg() - } - - if value == PatternFlowPfcPauseControlOpCodeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPfcPauseControlOpCodeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPauseControlOpCode) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPauseControlOpCode) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowPfcPauseControlOpCode object -func (obj *patternFlowPfcPauseControlOpCode) SetValue(value uint32) PatternFlowPfcPauseControlOpCode { - obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowPfcPauseControlOpCode) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{257}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowPfcPauseControlOpCode object -func (obj *patternFlowPfcPauseControlOpCode) SetValues(value []uint32) PatternFlowPfcPauseControlOpCode { - obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPfcPauseControlOpCodeCounter -func (obj *patternFlowPfcPauseControlOpCode) Increment() PatternFlowPfcPauseControlOpCodeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPfcPauseControlOpCodeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPfcPauseControlOpCodeCounter -func (obj *patternFlowPfcPauseControlOpCode) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPfcPauseControlOpCodeCounter value in the PatternFlowPfcPauseControlOpCode object -func (obj *patternFlowPfcPauseControlOpCode) SetIncrement(value PatternFlowPfcPauseControlOpCodeCounter) PatternFlowPfcPauseControlOpCode { - obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPfcPauseControlOpCodeCounter -func (obj *patternFlowPfcPauseControlOpCode) Decrement() PatternFlowPfcPauseControlOpCodeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPfcPauseControlOpCodeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPfcPauseControlOpCodeCounter -func (obj *patternFlowPfcPauseControlOpCode) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPfcPauseControlOpCodeCounter value in the PatternFlowPfcPauseControlOpCode object -func (obj *patternFlowPfcPauseControlOpCode) SetDecrement(value PatternFlowPfcPauseControlOpCodeCounter) PatternFlowPfcPauseControlOpCode { - obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPfcPauseControlOpCodeMetricTag -func (obj *patternFlowPfcPauseControlOpCode) MetricTags() PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPfcPauseControlOpCodeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter struct { - obj *patternFlowPfcPauseControlOpCode - patternFlowPfcPauseControlOpCodeMetricTagSlice []PatternFlowPfcPauseControlOpCodeMetricTag - fieldPtr *[]*otg.PatternFlowPfcPauseControlOpCodeMetricTag -} - -func newPatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter(ptr *[]*otg.PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { - return &patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter interface { - setMsg(*patternFlowPfcPauseControlOpCode) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter - Items() []PatternFlowPfcPauseControlOpCodeMetricTag - Add() PatternFlowPfcPauseControlOpCodeMetricTag - Append(items ...PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter - Set(index int, newObj PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter - Clear() PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter - clearHolderSlice() PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter - appendHolderSlice(item PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter -} - -func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) setMsg(msg *patternFlowPfcPauseControlOpCode) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPfcPauseControlOpCodeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) Items() []PatternFlowPfcPauseControlOpCodeMetricTag { - return obj.patternFlowPfcPauseControlOpCodeMetricTagSlice -} - -func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) Add() PatternFlowPfcPauseControlOpCodeMetricTag { - newObj := &otg.PatternFlowPfcPauseControlOpCodeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPfcPauseControlOpCodeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPfcPauseControlOpCodeMetricTagSlice = append(obj.patternFlowPfcPauseControlOpCodeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) Append(items ...PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPfcPauseControlOpCodeMetricTagSlice = append(obj.patternFlowPfcPauseControlOpCodeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) Set(index int, newObj PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPfcPauseControlOpCodeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) Clear() PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPfcPauseControlOpCodeMetricTag{} - obj.patternFlowPfcPauseControlOpCodeMetricTagSlice = []PatternFlowPfcPauseControlOpCodeMetricTag{} - } - return obj -} -func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) clearHolderSlice() PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { - if len(obj.patternFlowPfcPauseControlOpCodeMetricTagSlice) > 0 { - obj.patternFlowPfcPauseControlOpCodeMetricTagSlice = []PatternFlowPfcPauseControlOpCodeMetricTag{} - } - return obj -} -func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) appendHolderSlice(item PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { - obj.patternFlowPfcPauseControlOpCodeMetricTagSlice = append(obj.patternFlowPfcPauseControlOpCodeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowPfcPauseControlOpCode) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseControlOpCode.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowPfcPauseControlOpCode.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPfcPauseControlOpCodeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPfcPauseControlOpCode) setDefault() { - var choices_set int = 0 - var choice PatternFlowPfcPauseControlOpCodeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPfcPauseControlOpCodeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPfcPauseControlOpCodeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPfcPauseControlOpCodeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPfcPauseControlOpCodeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPauseControlOpCode") - } - } else { - intVal := otg.PatternFlowPfcPauseControlOpCode_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPfcPauseControlOpCode_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPfcPauseClassEnableVector ***** -type patternFlowPfcPauseClassEnableVector struct { - validation - obj *otg.PatternFlowPfcPauseClassEnableVector - marshaller marshalPatternFlowPfcPauseClassEnableVector - unMarshaller unMarshalPatternFlowPfcPauseClassEnableVector - incrementHolder PatternFlowPfcPauseClassEnableVectorCounter - decrementHolder PatternFlowPfcPauseClassEnableVectorCounter - metricTagsHolder PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter -} - -func NewPatternFlowPfcPauseClassEnableVector() PatternFlowPfcPauseClassEnableVector { - obj := patternFlowPfcPauseClassEnableVector{obj: &otg.PatternFlowPfcPauseClassEnableVector{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseClassEnableVector) msg() *otg.PatternFlowPfcPauseClassEnableVector { - return obj.obj -} - -func (obj *patternFlowPfcPauseClassEnableVector) setMsg(msg *otg.PatternFlowPfcPauseClassEnableVector) PatternFlowPfcPauseClassEnableVector { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseClassEnableVector struct { - obj *patternFlowPfcPauseClassEnableVector -} - -type marshalPatternFlowPfcPauseClassEnableVector interface { - // ToProto marshals PatternFlowPfcPauseClassEnableVector to protobuf object *otg.PatternFlowPfcPauseClassEnableVector - ToProto() (*otg.PatternFlowPfcPauseClassEnableVector, error) - // ToPbText marshals PatternFlowPfcPauseClassEnableVector to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseClassEnableVector to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseClassEnableVector to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseClassEnableVector struct { - obj *patternFlowPfcPauseClassEnableVector -} - -type unMarshalPatternFlowPfcPauseClassEnableVector interface { - // FromProto unmarshals PatternFlowPfcPauseClassEnableVector from protobuf object *otg.PatternFlowPfcPauseClassEnableVector - FromProto(msg *otg.PatternFlowPfcPauseClassEnableVector) (PatternFlowPfcPauseClassEnableVector, error) - // FromPbText unmarshals PatternFlowPfcPauseClassEnableVector from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseClassEnableVector from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseClassEnableVector from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseClassEnableVector) Marshal() marshalPatternFlowPfcPauseClassEnableVector { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseClassEnableVector{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseClassEnableVector) Unmarshal() unMarshalPatternFlowPfcPauseClassEnableVector { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseClassEnableVector{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseClassEnableVector) ToProto() (*otg.PatternFlowPfcPauseClassEnableVector, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseClassEnableVector) FromProto(msg *otg.PatternFlowPfcPauseClassEnableVector) (PatternFlowPfcPauseClassEnableVector, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseClassEnableVector) 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 *unMarshalpatternFlowPfcPauseClassEnableVector) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPfcPauseClassEnableVector) 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 *unMarshalpatternFlowPfcPauseClassEnableVector) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPfcPauseClassEnableVector) 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 *unMarshalpatternFlowPfcPauseClassEnableVector) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPfcPauseClassEnableVector) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseClassEnableVector) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseClassEnableVector) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseClassEnableVector) Clone() (PatternFlowPfcPauseClassEnableVector, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseClassEnableVector() - 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 -} - -func (obj *patternFlowPfcPauseClassEnableVector) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPfcPauseClassEnableVector is destination -type PatternFlowPfcPauseClassEnableVector interface { - Validation - // msg marshals PatternFlowPfcPauseClassEnableVector to protobuf object *otg.PatternFlowPfcPauseClassEnableVector - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseClassEnableVector - // setMsg unmarshals PatternFlowPfcPauseClassEnableVector from protobuf object *otg.PatternFlowPfcPauseClassEnableVector - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseClassEnableVector) PatternFlowPfcPauseClassEnableVector - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseClassEnableVector - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseClassEnableVector - // validate validates PatternFlowPfcPauseClassEnableVector - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseClassEnableVector, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPfcPauseClassEnableVectorChoiceEnum, set in PatternFlowPfcPauseClassEnableVector - Choice() PatternFlowPfcPauseClassEnableVectorChoiceEnum - // setChoice assigns PatternFlowPfcPauseClassEnableVectorChoiceEnum provided by user to PatternFlowPfcPauseClassEnableVector - setChoice(value PatternFlowPfcPauseClassEnableVectorChoiceEnum) PatternFlowPfcPauseClassEnableVector - // HasChoice checks if Choice has been set in PatternFlowPfcPauseClassEnableVector - HasChoice() bool - // Value returns uint32, set in PatternFlowPfcPauseClassEnableVector. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowPfcPauseClassEnableVector - SetValue(value uint32) PatternFlowPfcPauseClassEnableVector - // HasValue checks if Value has been set in PatternFlowPfcPauseClassEnableVector - HasValue() bool - // Values returns []uint32, set in PatternFlowPfcPauseClassEnableVector. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowPfcPauseClassEnableVector - SetValues(value []uint32) PatternFlowPfcPauseClassEnableVector - // Increment returns PatternFlowPfcPauseClassEnableVectorCounter, set in PatternFlowPfcPauseClassEnableVector. - // PatternFlowPfcPauseClassEnableVectorCounter is integer counter pattern - Increment() PatternFlowPfcPauseClassEnableVectorCounter - // SetIncrement assigns PatternFlowPfcPauseClassEnableVectorCounter provided by user to PatternFlowPfcPauseClassEnableVector. - // PatternFlowPfcPauseClassEnableVectorCounter is integer counter pattern - SetIncrement(value PatternFlowPfcPauseClassEnableVectorCounter) PatternFlowPfcPauseClassEnableVector - // HasIncrement checks if Increment has been set in PatternFlowPfcPauseClassEnableVector - HasIncrement() bool - // Decrement returns PatternFlowPfcPauseClassEnableVectorCounter, set in PatternFlowPfcPauseClassEnableVector. - // PatternFlowPfcPauseClassEnableVectorCounter is integer counter pattern - Decrement() PatternFlowPfcPauseClassEnableVectorCounter - // SetDecrement assigns PatternFlowPfcPauseClassEnableVectorCounter provided by user to PatternFlowPfcPauseClassEnableVector. - // PatternFlowPfcPauseClassEnableVectorCounter is integer counter pattern - SetDecrement(value PatternFlowPfcPauseClassEnableVectorCounter) PatternFlowPfcPauseClassEnableVector - // HasDecrement checks if Decrement has been set in PatternFlowPfcPauseClassEnableVector - HasDecrement() bool - // MetricTags returns PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIterIter, set in PatternFlowPfcPauseClassEnableVector - MetricTags() PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter - setNil() -} - -type PatternFlowPfcPauseClassEnableVectorChoiceEnum string - -// Enum of Choice on PatternFlowPfcPauseClassEnableVector -var PatternFlowPfcPauseClassEnableVectorChoice = struct { - VALUE PatternFlowPfcPauseClassEnableVectorChoiceEnum - VALUES PatternFlowPfcPauseClassEnableVectorChoiceEnum - INCREMENT PatternFlowPfcPauseClassEnableVectorChoiceEnum - DECREMENT PatternFlowPfcPauseClassEnableVectorChoiceEnum -}{ - VALUE: PatternFlowPfcPauseClassEnableVectorChoiceEnum("value"), - VALUES: PatternFlowPfcPauseClassEnableVectorChoiceEnum("values"), - INCREMENT: PatternFlowPfcPauseClassEnableVectorChoiceEnum("increment"), - DECREMENT: PatternFlowPfcPauseClassEnableVectorChoiceEnum("decrement"), -} - -func (obj *patternFlowPfcPauseClassEnableVector) Choice() PatternFlowPfcPauseClassEnableVectorChoiceEnum { - return PatternFlowPfcPauseClassEnableVectorChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPfcPauseClassEnableVector) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPfcPauseClassEnableVector) setChoice(value PatternFlowPfcPauseClassEnableVectorChoiceEnum) PatternFlowPfcPauseClassEnableVector { - intValue, ok := otg.PatternFlowPfcPauseClassEnableVector_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPfcPauseClassEnableVectorChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPfcPauseClassEnableVector_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPfcPauseClassEnableVectorChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPfcPauseClassEnableVectorChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPfcPauseClassEnableVectorChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowPfcPauseClassEnableVectorCounter().msg() - } - - if value == PatternFlowPfcPauseClassEnableVectorChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPfcPauseClassEnableVectorCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPauseClassEnableVector) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPauseClassEnableVector) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowPfcPauseClassEnableVector object -func (obj *patternFlowPfcPauseClassEnableVector) SetValue(value uint32) PatternFlowPfcPauseClassEnableVector { - obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowPfcPauseClassEnableVector) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowPfcPauseClassEnableVector object -func (obj *patternFlowPfcPauseClassEnableVector) SetValues(value []uint32) PatternFlowPfcPauseClassEnableVector { - obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPfcPauseClassEnableVectorCounter -func (obj *patternFlowPfcPauseClassEnableVector) Increment() PatternFlowPfcPauseClassEnableVectorCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPfcPauseClassEnableVectorCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPfcPauseClassEnableVectorCounter -func (obj *patternFlowPfcPauseClassEnableVector) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPfcPauseClassEnableVectorCounter value in the PatternFlowPfcPauseClassEnableVector object -func (obj *patternFlowPfcPauseClassEnableVector) SetIncrement(value PatternFlowPfcPauseClassEnableVectorCounter) PatternFlowPfcPauseClassEnableVector { - obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPfcPauseClassEnableVectorCounter -func (obj *patternFlowPfcPauseClassEnableVector) Decrement() PatternFlowPfcPauseClassEnableVectorCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPfcPauseClassEnableVectorCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPfcPauseClassEnableVectorCounter -func (obj *patternFlowPfcPauseClassEnableVector) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPfcPauseClassEnableVectorCounter value in the PatternFlowPfcPauseClassEnableVector object -func (obj *patternFlowPfcPauseClassEnableVector) SetDecrement(value PatternFlowPfcPauseClassEnableVectorCounter) PatternFlowPfcPauseClassEnableVector { - obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPfcPauseClassEnableVectorMetricTag -func (obj *patternFlowPfcPauseClassEnableVector) MetricTags() PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPfcPauseClassEnableVectorMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter struct { - obj *patternFlowPfcPauseClassEnableVector - patternFlowPfcPauseClassEnableVectorMetricTagSlice []PatternFlowPfcPauseClassEnableVectorMetricTag - fieldPtr *[]*otg.PatternFlowPfcPauseClassEnableVectorMetricTag -} - -func newPatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter(ptr *[]*otg.PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { - return &patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter interface { - setMsg(*patternFlowPfcPauseClassEnableVector) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter - Items() []PatternFlowPfcPauseClassEnableVectorMetricTag - Add() PatternFlowPfcPauseClassEnableVectorMetricTag - Append(items ...PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter - Set(index int, newObj PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter - Clear() PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter - clearHolderSlice() PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter - appendHolderSlice(item PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter -} - -func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) setMsg(msg *patternFlowPfcPauseClassEnableVector) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPfcPauseClassEnableVectorMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) Items() []PatternFlowPfcPauseClassEnableVectorMetricTag { - return obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice -} - -func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) Add() PatternFlowPfcPauseClassEnableVectorMetricTag { - newObj := &otg.PatternFlowPfcPauseClassEnableVectorMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPfcPauseClassEnableVectorMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice = append(obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) Append(items ...PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice = append(obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) Set(index int, newObj PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) Clear() PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPfcPauseClassEnableVectorMetricTag{} - obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice = []PatternFlowPfcPauseClassEnableVectorMetricTag{} - } - return obj -} -func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) clearHolderSlice() PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { - if len(obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice) > 0 { - obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice = []PatternFlowPfcPauseClassEnableVectorMetricTag{} - } - return obj -} -func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) appendHolderSlice(item PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { - obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice = append(obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice, item) - return obj -} - -func (obj *patternFlowPfcPauseClassEnableVector) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseClassEnableVector.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowPfcPauseClassEnableVector.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPfcPauseClassEnableVectorMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPfcPauseClassEnableVector) setDefault() { - var choices_set int = 0 - var choice PatternFlowPfcPauseClassEnableVectorChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPfcPauseClassEnableVectorChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPfcPauseClassEnableVectorChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPfcPauseClassEnableVectorChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPfcPauseClassEnableVectorChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPauseClassEnableVector") - } - } else { - intVal := otg.PatternFlowPfcPauseClassEnableVector_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPfcPauseClassEnableVector_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPfcPausePauseClass0 ***** -type patternFlowPfcPausePauseClass0 struct { - validation - obj *otg.PatternFlowPfcPausePauseClass0 - marshaller marshalPatternFlowPfcPausePauseClass0 - unMarshaller unMarshalPatternFlowPfcPausePauseClass0 - incrementHolder PatternFlowPfcPausePauseClass0Counter - decrementHolder PatternFlowPfcPausePauseClass0Counter - metricTagsHolder PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter -} - -func NewPatternFlowPfcPausePauseClass0() PatternFlowPfcPausePauseClass0 { - obj := patternFlowPfcPausePauseClass0{obj: &otg.PatternFlowPfcPausePauseClass0{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass0) msg() *otg.PatternFlowPfcPausePauseClass0 { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass0) setMsg(msg *otg.PatternFlowPfcPausePauseClass0) PatternFlowPfcPausePauseClass0 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass0 struct { - obj *patternFlowPfcPausePauseClass0 -} - -type marshalPatternFlowPfcPausePauseClass0 interface { - // ToProto marshals PatternFlowPfcPausePauseClass0 to protobuf object *otg.PatternFlowPfcPausePauseClass0 - ToProto() (*otg.PatternFlowPfcPausePauseClass0, error) - // ToPbText marshals PatternFlowPfcPausePauseClass0 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass0 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass0 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass0 struct { - obj *patternFlowPfcPausePauseClass0 -} - -type unMarshalPatternFlowPfcPausePauseClass0 interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass0 from protobuf object *otg.PatternFlowPfcPausePauseClass0 - FromProto(msg *otg.PatternFlowPfcPausePauseClass0) (PatternFlowPfcPausePauseClass0, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass0 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass0 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass0 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass0) Marshal() marshalPatternFlowPfcPausePauseClass0 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass0{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass0) Unmarshal() unMarshalPatternFlowPfcPausePauseClass0 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass0{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass0) ToProto() (*otg.PatternFlowPfcPausePauseClass0, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass0) FromProto(msg *otg.PatternFlowPfcPausePauseClass0) (PatternFlowPfcPausePauseClass0, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass0) 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 *unMarshalpatternFlowPfcPausePauseClass0) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPfcPausePauseClass0) 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 *unMarshalpatternFlowPfcPausePauseClass0) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPfcPausePauseClass0) 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 *unMarshalpatternFlowPfcPausePauseClass0) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPfcPausePauseClass0) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass0) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass0) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass0) Clone() (PatternFlowPfcPausePauseClass0, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass0() - 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 -} - -func (obj *patternFlowPfcPausePauseClass0) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPfcPausePauseClass0 is pause class 0 -type PatternFlowPfcPausePauseClass0 interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass0 to protobuf object *otg.PatternFlowPfcPausePauseClass0 - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass0 - // setMsg unmarshals PatternFlowPfcPausePauseClass0 from protobuf object *otg.PatternFlowPfcPausePauseClass0 - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass0) PatternFlowPfcPausePauseClass0 - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass0 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass0 - // validate validates PatternFlowPfcPausePauseClass0 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass0, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPfcPausePauseClass0ChoiceEnum, set in PatternFlowPfcPausePauseClass0 - Choice() PatternFlowPfcPausePauseClass0ChoiceEnum - // setChoice assigns PatternFlowPfcPausePauseClass0ChoiceEnum provided by user to PatternFlowPfcPausePauseClass0 - setChoice(value PatternFlowPfcPausePauseClass0ChoiceEnum) PatternFlowPfcPausePauseClass0 - // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass0 - HasChoice() bool - // Value returns uint32, set in PatternFlowPfcPausePauseClass0. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass0 - SetValue(value uint32) PatternFlowPfcPausePauseClass0 - // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass0 - HasValue() bool - // Values returns []uint32, set in PatternFlowPfcPausePauseClass0. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass0 - SetValues(value []uint32) PatternFlowPfcPausePauseClass0 - // Increment returns PatternFlowPfcPausePauseClass0Counter, set in PatternFlowPfcPausePauseClass0. - // PatternFlowPfcPausePauseClass0Counter is integer counter pattern - Increment() PatternFlowPfcPausePauseClass0Counter - // SetIncrement assigns PatternFlowPfcPausePauseClass0Counter provided by user to PatternFlowPfcPausePauseClass0. - // PatternFlowPfcPausePauseClass0Counter is integer counter pattern - SetIncrement(value PatternFlowPfcPausePauseClass0Counter) PatternFlowPfcPausePauseClass0 - // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass0 - HasIncrement() bool - // Decrement returns PatternFlowPfcPausePauseClass0Counter, set in PatternFlowPfcPausePauseClass0. - // PatternFlowPfcPausePauseClass0Counter is integer counter pattern - Decrement() PatternFlowPfcPausePauseClass0Counter - // SetDecrement assigns PatternFlowPfcPausePauseClass0Counter provided by user to PatternFlowPfcPausePauseClass0. - // PatternFlowPfcPausePauseClass0Counter is integer counter pattern - SetDecrement(value PatternFlowPfcPausePauseClass0Counter) PatternFlowPfcPausePauseClass0 - // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass0 - HasDecrement() bool - // MetricTags returns PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIterIter, set in PatternFlowPfcPausePauseClass0 - MetricTags() PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter - setNil() -} - -type PatternFlowPfcPausePauseClass0ChoiceEnum string - -// Enum of Choice on PatternFlowPfcPausePauseClass0 -var PatternFlowPfcPausePauseClass0Choice = struct { - VALUE PatternFlowPfcPausePauseClass0ChoiceEnum - VALUES PatternFlowPfcPausePauseClass0ChoiceEnum - INCREMENT PatternFlowPfcPausePauseClass0ChoiceEnum - DECREMENT PatternFlowPfcPausePauseClass0ChoiceEnum -}{ - VALUE: PatternFlowPfcPausePauseClass0ChoiceEnum("value"), - VALUES: PatternFlowPfcPausePauseClass0ChoiceEnum("values"), - INCREMENT: PatternFlowPfcPausePauseClass0ChoiceEnum("increment"), - DECREMENT: PatternFlowPfcPausePauseClass0ChoiceEnum("decrement"), -} - -func (obj *patternFlowPfcPausePauseClass0) Choice() PatternFlowPfcPausePauseClass0ChoiceEnum { - return PatternFlowPfcPausePauseClass0ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPfcPausePauseClass0) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPfcPausePauseClass0) setChoice(value PatternFlowPfcPausePauseClass0ChoiceEnum) PatternFlowPfcPausePauseClass0 { - intValue, ok := otg.PatternFlowPfcPausePauseClass0_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPfcPausePauseClass0ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPfcPausePauseClass0_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPfcPausePauseClass0Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPfcPausePauseClass0Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPfcPausePauseClass0Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowPfcPausePauseClass0Counter().msg() - } - - if value == PatternFlowPfcPausePauseClass0Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPfcPausePauseClass0Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass0) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPfcPausePauseClass0Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass0) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass0 object -func (obj *patternFlowPfcPausePauseClass0) SetValue(value uint32) PatternFlowPfcPausePauseClass0 { - obj.setChoice(PatternFlowPfcPausePauseClass0Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowPfcPausePauseClass0) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass0 object -func (obj *patternFlowPfcPausePauseClass0) SetValues(value []uint32) PatternFlowPfcPausePauseClass0 { - obj.setChoice(PatternFlowPfcPausePauseClass0Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass0Counter -func (obj *patternFlowPfcPausePauseClass0) Increment() PatternFlowPfcPausePauseClass0Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPfcPausePauseClass0Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPfcPausePauseClass0Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass0Counter -func (obj *patternFlowPfcPausePauseClass0) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPfcPausePauseClass0Counter value in the PatternFlowPfcPausePauseClass0 object -func (obj *patternFlowPfcPausePauseClass0) SetIncrement(value PatternFlowPfcPausePauseClass0Counter) PatternFlowPfcPausePauseClass0 { - obj.setChoice(PatternFlowPfcPausePauseClass0Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass0Counter -func (obj *patternFlowPfcPausePauseClass0) Decrement() PatternFlowPfcPausePauseClass0Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPfcPausePauseClass0Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPfcPausePauseClass0Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass0Counter -func (obj *patternFlowPfcPausePauseClass0) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPfcPausePauseClass0Counter value in the PatternFlowPfcPausePauseClass0 object -func (obj *patternFlowPfcPausePauseClass0) SetDecrement(value PatternFlowPfcPausePauseClass0Counter) PatternFlowPfcPausePauseClass0 { - obj.setChoice(PatternFlowPfcPausePauseClass0Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPfcPausePauseClass0MetricTag -func (obj *patternFlowPfcPausePauseClass0) MetricTags() PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass0MetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter struct { - obj *patternFlowPfcPausePauseClass0 - patternFlowPfcPausePauseClass0MetricTagSlice []PatternFlowPfcPausePauseClass0MetricTag - fieldPtr *[]*otg.PatternFlowPfcPausePauseClass0MetricTag -} - -func newPatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { - return &patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter interface { - setMsg(*patternFlowPfcPausePauseClass0) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter - Items() []PatternFlowPfcPausePauseClass0MetricTag - Add() PatternFlowPfcPausePauseClass0MetricTag - Append(items ...PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter - Set(index int, newObj PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter - Clear() PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter - clearHolderSlice() PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter - appendHolderSlice(item PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter -} - -func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass0) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPfcPausePauseClass0MetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) Items() []PatternFlowPfcPausePauseClass0MetricTag { - return obj.patternFlowPfcPausePauseClass0MetricTagSlice -} - -func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) Add() PatternFlowPfcPausePauseClass0MetricTag { - newObj := &otg.PatternFlowPfcPausePauseClass0MetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPfcPausePauseClass0MetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPfcPausePauseClass0MetricTagSlice = append(obj.patternFlowPfcPausePauseClass0MetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPfcPausePauseClass0MetricTagSlice = append(obj.patternFlowPfcPausePauseClass0MetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPfcPausePauseClass0MetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) Clear() PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass0MetricTag{} - obj.patternFlowPfcPausePauseClass0MetricTagSlice = []PatternFlowPfcPausePauseClass0MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { - if len(obj.patternFlowPfcPausePauseClass0MetricTagSlice) > 0 { - obj.patternFlowPfcPausePauseClass0MetricTagSlice = []PatternFlowPfcPausePauseClass0MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { - obj.patternFlowPfcPausePauseClass0MetricTagSlice = append(obj.patternFlowPfcPausePauseClass0MetricTagSlice, item) - return obj -} - -func (obj *patternFlowPfcPausePauseClass0) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass0.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass0.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass0MetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass0) setDefault() { - var choices_set int = 0 - var choice PatternFlowPfcPausePauseClass0ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass0Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass0Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass0Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass0Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPfcPausePauseClass0Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass0") - } - } else { - intVal := otg.PatternFlowPfcPausePauseClass0_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPfcPausePauseClass0_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPfcPausePauseClass1 ***** -type patternFlowPfcPausePauseClass1 struct { - validation - obj *otg.PatternFlowPfcPausePauseClass1 - marshaller marshalPatternFlowPfcPausePauseClass1 - unMarshaller unMarshalPatternFlowPfcPausePauseClass1 - incrementHolder PatternFlowPfcPausePauseClass1Counter - decrementHolder PatternFlowPfcPausePauseClass1Counter - metricTagsHolder PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter -} - -func NewPatternFlowPfcPausePauseClass1() PatternFlowPfcPausePauseClass1 { - obj := patternFlowPfcPausePauseClass1{obj: &otg.PatternFlowPfcPausePauseClass1{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass1) msg() *otg.PatternFlowPfcPausePauseClass1 { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass1) setMsg(msg *otg.PatternFlowPfcPausePauseClass1) PatternFlowPfcPausePauseClass1 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass1 struct { - obj *patternFlowPfcPausePauseClass1 -} - -type marshalPatternFlowPfcPausePauseClass1 interface { - // ToProto marshals PatternFlowPfcPausePauseClass1 to protobuf object *otg.PatternFlowPfcPausePauseClass1 - ToProto() (*otg.PatternFlowPfcPausePauseClass1, error) - // ToPbText marshals PatternFlowPfcPausePauseClass1 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass1 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass1 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass1 struct { - obj *patternFlowPfcPausePauseClass1 -} - -type unMarshalPatternFlowPfcPausePauseClass1 interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass1 from protobuf object *otg.PatternFlowPfcPausePauseClass1 - FromProto(msg *otg.PatternFlowPfcPausePauseClass1) (PatternFlowPfcPausePauseClass1, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass1 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass1 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass1 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass1) Marshal() marshalPatternFlowPfcPausePauseClass1 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass1{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass1) Unmarshal() unMarshalPatternFlowPfcPausePauseClass1 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass1{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass1) ToProto() (*otg.PatternFlowPfcPausePauseClass1, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass1) FromProto(msg *otg.PatternFlowPfcPausePauseClass1) (PatternFlowPfcPausePauseClass1, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass1) 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 *unMarshalpatternFlowPfcPausePauseClass1) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPfcPausePauseClass1) 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 *unMarshalpatternFlowPfcPausePauseClass1) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPfcPausePauseClass1) 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 *unMarshalpatternFlowPfcPausePauseClass1) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPfcPausePauseClass1) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass1) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass1) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass1) Clone() (PatternFlowPfcPausePauseClass1, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass1() - 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 -} - -func (obj *patternFlowPfcPausePauseClass1) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPfcPausePauseClass1 is pause class 1 -type PatternFlowPfcPausePauseClass1 interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass1 to protobuf object *otg.PatternFlowPfcPausePauseClass1 - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass1 - // setMsg unmarshals PatternFlowPfcPausePauseClass1 from protobuf object *otg.PatternFlowPfcPausePauseClass1 - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass1) PatternFlowPfcPausePauseClass1 - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass1 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass1 - // validate validates PatternFlowPfcPausePauseClass1 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass1, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPfcPausePauseClass1ChoiceEnum, set in PatternFlowPfcPausePauseClass1 - Choice() PatternFlowPfcPausePauseClass1ChoiceEnum - // setChoice assigns PatternFlowPfcPausePauseClass1ChoiceEnum provided by user to PatternFlowPfcPausePauseClass1 - setChoice(value PatternFlowPfcPausePauseClass1ChoiceEnum) PatternFlowPfcPausePauseClass1 - // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass1 - HasChoice() bool - // Value returns uint32, set in PatternFlowPfcPausePauseClass1. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass1 - SetValue(value uint32) PatternFlowPfcPausePauseClass1 - // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass1 - HasValue() bool - // Values returns []uint32, set in PatternFlowPfcPausePauseClass1. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass1 - SetValues(value []uint32) PatternFlowPfcPausePauseClass1 - // Increment returns PatternFlowPfcPausePauseClass1Counter, set in PatternFlowPfcPausePauseClass1. - // PatternFlowPfcPausePauseClass1Counter is integer counter pattern - Increment() PatternFlowPfcPausePauseClass1Counter - // SetIncrement assigns PatternFlowPfcPausePauseClass1Counter provided by user to PatternFlowPfcPausePauseClass1. - // PatternFlowPfcPausePauseClass1Counter is integer counter pattern - SetIncrement(value PatternFlowPfcPausePauseClass1Counter) PatternFlowPfcPausePauseClass1 - // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass1 - HasIncrement() bool - // Decrement returns PatternFlowPfcPausePauseClass1Counter, set in PatternFlowPfcPausePauseClass1. - // PatternFlowPfcPausePauseClass1Counter is integer counter pattern - Decrement() PatternFlowPfcPausePauseClass1Counter - // SetDecrement assigns PatternFlowPfcPausePauseClass1Counter provided by user to PatternFlowPfcPausePauseClass1. - // PatternFlowPfcPausePauseClass1Counter is integer counter pattern - SetDecrement(value PatternFlowPfcPausePauseClass1Counter) PatternFlowPfcPausePauseClass1 - // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass1 - HasDecrement() bool - // MetricTags returns PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIterIter, set in PatternFlowPfcPausePauseClass1 - MetricTags() PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter - setNil() -} - -type PatternFlowPfcPausePauseClass1ChoiceEnum string - -// Enum of Choice on PatternFlowPfcPausePauseClass1 -var PatternFlowPfcPausePauseClass1Choice = struct { - VALUE PatternFlowPfcPausePauseClass1ChoiceEnum - VALUES PatternFlowPfcPausePauseClass1ChoiceEnum - INCREMENT PatternFlowPfcPausePauseClass1ChoiceEnum - DECREMENT PatternFlowPfcPausePauseClass1ChoiceEnum -}{ - VALUE: PatternFlowPfcPausePauseClass1ChoiceEnum("value"), - VALUES: PatternFlowPfcPausePauseClass1ChoiceEnum("values"), - INCREMENT: PatternFlowPfcPausePauseClass1ChoiceEnum("increment"), - DECREMENT: PatternFlowPfcPausePauseClass1ChoiceEnum("decrement"), -} - -func (obj *patternFlowPfcPausePauseClass1) Choice() PatternFlowPfcPausePauseClass1ChoiceEnum { - return PatternFlowPfcPausePauseClass1ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPfcPausePauseClass1) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPfcPausePauseClass1) setChoice(value PatternFlowPfcPausePauseClass1ChoiceEnum) PatternFlowPfcPausePauseClass1 { - intValue, ok := otg.PatternFlowPfcPausePauseClass1_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPfcPausePauseClass1ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPfcPausePauseClass1_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPfcPausePauseClass1Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPfcPausePauseClass1Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPfcPausePauseClass1Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowPfcPausePauseClass1Counter().msg() - } - - if value == PatternFlowPfcPausePauseClass1Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPfcPausePauseClass1Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass1) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPfcPausePauseClass1Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass1) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass1 object -func (obj *patternFlowPfcPausePauseClass1) SetValue(value uint32) PatternFlowPfcPausePauseClass1 { - obj.setChoice(PatternFlowPfcPausePauseClass1Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowPfcPausePauseClass1) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass1 object -func (obj *patternFlowPfcPausePauseClass1) SetValues(value []uint32) PatternFlowPfcPausePauseClass1 { - obj.setChoice(PatternFlowPfcPausePauseClass1Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass1Counter -func (obj *patternFlowPfcPausePauseClass1) Increment() PatternFlowPfcPausePauseClass1Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPfcPausePauseClass1Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPfcPausePauseClass1Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass1Counter -func (obj *patternFlowPfcPausePauseClass1) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPfcPausePauseClass1Counter value in the PatternFlowPfcPausePauseClass1 object -func (obj *patternFlowPfcPausePauseClass1) SetIncrement(value PatternFlowPfcPausePauseClass1Counter) PatternFlowPfcPausePauseClass1 { - obj.setChoice(PatternFlowPfcPausePauseClass1Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass1Counter -func (obj *patternFlowPfcPausePauseClass1) Decrement() PatternFlowPfcPausePauseClass1Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPfcPausePauseClass1Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPfcPausePauseClass1Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass1Counter -func (obj *patternFlowPfcPausePauseClass1) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPfcPausePauseClass1Counter value in the PatternFlowPfcPausePauseClass1 object -func (obj *patternFlowPfcPausePauseClass1) SetDecrement(value PatternFlowPfcPausePauseClass1Counter) PatternFlowPfcPausePauseClass1 { - obj.setChoice(PatternFlowPfcPausePauseClass1Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPfcPausePauseClass1MetricTag -func (obj *patternFlowPfcPausePauseClass1) MetricTags() PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass1MetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter struct { - obj *patternFlowPfcPausePauseClass1 - patternFlowPfcPausePauseClass1MetricTagSlice []PatternFlowPfcPausePauseClass1MetricTag - fieldPtr *[]*otg.PatternFlowPfcPausePauseClass1MetricTag -} - -func newPatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { - return &patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter interface { - setMsg(*patternFlowPfcPausePauseClass1) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter - Items() []PatternFlowPfcPausePauseClass1MetricTag - Add() PatternFlowPfcPausePauseClass1MetricTag - Append(items ...PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter - Set(index int, newObj PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter - Clear() PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter - clearHolderSlice() PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter - appendHolderSlice(item PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter -} - -func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass1) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPfcPausePauseClass1MetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) Items() []PatternFlowPfcPausePauseClass1MetricTag { - return obj.patternFlowPfcPausePauseClass1MetricTagSlice -} - -func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) Add() PatternFlowPfcPausePauseClass1MetricTag { - newObj := &otg.PatternFlowPfcPausePauseClass1MetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPfcPausePauseClass1MetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPfcPausePauseClass1MetricTagSlice = append(obj.patternFlowPfcPausePauseClass1MetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPfcPausePauseClass1MetricTagSlice = append(obj.patternFlowPfcPausePauseClass1MetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPfcPausePauseClass1MetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) Clear() PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass1MetricTag{} - obj.patternFlowPfcPausePauseClass1MetricTagSlice = []PatternFlowPfcPausePauseClass1MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { - if len(obj.patternFlowPfcPausePauseClass1MetricTagSlice) > 0 { - obj.patternFlowPfcPausePauseClass1MetricTagSlice = []PatternFlowPfcPausePauseClass1MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { - obj.patternFlowPfcPausePauseClass1MetricTagSlice = append(obj.patternFlowPfcPausePauseClass1MetricTagSlice, item) - return obj -} - -func (obj *patternFlowPfcPausePauseClass1) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass1.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass1.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass1MetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass1) setDefault() { - var choices_set int = 0 - var choice PatternFlowPfcPausePauseClass1ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass1Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass1Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass1Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass1Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPfcPausePauseClass1Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass1") - } - } else { - intVal := otg.PatternFlowPfcPausePauseClass1_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPfcPausePauseClass1_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPfcPausePauseClass2 ***** -type patternFlowPfcPausePauseClass2 struct { - validation - obj *otg.PatternFlowPfcPausePauseClass2 - marshaller marshalPatternFlowPfcPausePauseClass2 - unMarshaller unMarshalPatternFlowPfcPausePauseClass2 - incrementHolder PatternFlowPfcPausePauseClass2Counter - decrementHolder PatternFlowPfcPausePauseClass2Counter - metricTagsHolder PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter -} - -func NewPatternFlowPfcPausePauseClass2() PatternFlowPfcPausePauseClass2 { - obj := patternFlowPfcPausePauseClass2{obj: &otg.PatternFlowPfcPausePauseClass2{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass2) msg() *otg.PatternFlowPfcPausePauseClass2 { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass2) setMsg(msg *otg.PatternFlowPfcPausePauseClass2) PatternFlowPfcPausePauseClass2 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass2 struct { - obj *patternFlowPfcPausePauseClass2 -} - -type marshalPatternFlowPfcPausePauseClass2 interface { - // ToProto marshals PatternFlowPfcPausePauseClass2 to protobuf object *otg.PatternFlowPfcPausePauseClass2 - ToProto() (*otg.PatternFlowPfcPausePauseClass2, error) - // ToPbText marshals PatternFlowPfcPausePauseClass2 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass2 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass2 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass2 struct { - obj *patternFlowPfcPausePauseClass2 -} - -type unMarshalPatternFlowPfcPausePauseClass2 interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass2 from protobuf object *otg.PatternFlowPfcPausePauseClass2 - FromProto(msg *otg.PatternFlowPfcPausePauseClass2) (PatternFlowPfcPausePauseClass2, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass2 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass2 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass2 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass2) Marshal() marshalPatternFlowPfcPausePauseClass2 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass2{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass2) Unmarshal() unMarshalPatternFlowPfcPausePauseClass2 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass2{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass2) ToProto() (*otg.PatternFlowPfcPausePauseClass2, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass2) FromProto(msg *otg.PatternFlowPfcPausePauseClass2) (PatternFlowPfcPausePauseClass2, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass2) 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 *unMarshalpatternFlowPfcPausePauseClass2) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPfcPausePauseClass2) 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 *unMarshalpatternFlowPfcPausePauseClass2) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPfcPausePauseClass2) 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 *unMarshalpatternFlowPfcPausePauseClass2) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPfcPausePauseClass2) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass2) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass2) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass2) Clone() (PatternFlowPfcPausePauseClass2, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass2() - 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 -} - -func (obj *patternFlowPfcPausePauseClass2) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPfcPausePauseClass2 is pause class 2 -type PatternFlowPfcPausePauseClass2 interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass2 to protobuf object *otg.PatternFlowPfcPausePauseClass2 - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass2 - // setMsg unmarshals PatternFlowPfcPausePauseClass2 from protobuf object *otg.PatternFlowPfcPausePauseClass2 - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass2) PatternFlowPfcPausePauseClass2 - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass2 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass2 - // validate validates PatternFlowPfcPausePauseClass2 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass2, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPfcPausePauseClass2ChoiceEnum, set in PatternFlowPfcPausePauseClass2 - Choice() PatternFlowPfcPausePauseClass2ChoiceEnum - // setChoice assigns PatternFlowPfcPausePauseClass2ChoiceEnum provided by user to PatternFlowPfcPausePauseClass2 - setChoice(value PatternFlowPfcPausePauseClass2ChoiceEnum) PatternFlowPfcPausePauseClass2 - // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass2 - HasChoice() bool - // Value returns uint32, set in PatternFlowPfcPausePauseClass2. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass2 - SetValue(value uint32) PatternFlowPfcPausePauseClass2 - // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass2 - HasValue() bool - // Values returns []uint32, set in PatternFlowPfcPausePauseClass2. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass2 - SetValues(value []uint32) PatternFlowPfcPausePauseClass2 - // Increment returns PatternFlowPfcPausePauseClass2Counter, set in PatternFlowPfcPausePauseClass2. - // PatternFlowPfcPausePauseClass2Counter is integer counter pattern - Increment() PatternFlowPfcPausePauseClass2Counter - // SetIncrement assigns PatternFlowPfcPausePauseClass2Counter provided by user to PatternFlowPfcPausePauseClass2. - // PatternFlowPfcPausePauseClass2Counter is integer counter pattern - SetIncrement(value PatternFlowPfcPausePauseClass2Counter) PatternFlowPfcPausePauseClass2 - // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass2 - HasIncrement() bool - // Decrement returns PatternFlowPfcPausePauseClass2Counter, set in PatternFlowPfcPausePauseClass2. - // PatternFlowPfcPausePauseClass2Counter is integer counter pattern - Decrement() PatternFlowPfcPausePauseClass2Counter - // SetDecrement assigns PatternFlowPfcPausePauseClass2Counter provided by user to PatternFlowPfcPausePauseClass2. - // PatternFlowPfcPausePauseClass2Counter is integer counter pattern - SetDecrement(value PatternFlowPfcPausePauseClass2Counter) PatternFlowPfcPausePauseClass2 - // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass2 - HasDecrement() bool - // MetricTags returns PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIterIter, set in PatternFlowPfcPausePauseClass2 - MetricTags() PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter - setNil() -} - -type PatternFlowPfcPausePauseClass2ChoiceEnum string - -// Enum of Choice on PatternFlowPfcPausePauseClass2 -var PatternFlowPfcPausePauseClass2Choice = struct { - VALUE PatternFlowPfcPausePauseClass2ChoiceEnum - VALUES PatternFlowPfcPausePauseClass2ChoiceEnum - INCREMENT PatternFlowPfcPausePauseClass2ChoiceEnum - DECREMENT PatternFlowPfcPausePauseClass2ChoiceEnum -}{ - VALUE: PatternFlowPfcPausePauseClass2ChoiceEnum("value"), - VALUES: PatternFlowPfcPausePauseClass2ChoiceEnum("values"), - INCREMENT: PatternFlowPfcPausePauseClass2ChoiceEnum("increment"), - DECREMENT: PatternFlowPfcPausePauseClass2ChoiceEnum("decrement"), -} - -func (obj *patternFlowPfcPausePauseClass2) Choice() PatternFlowPfcPausePauseClass2ChoiceEnum { - return PatternFlowPfcPausePauseClass2ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPfcPausePauseClass2) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPfcPausePauseClass2) setChoice(value PatternFlowPfcPausePauseClass2ChoiceEnum) PatternFlowPfcPausePauseClass2 { - intValue, ok := otg.PatternFlowPfcPausePauseClass2_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPfcPausePauseClass2ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPfcPausePauseClass2_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPfcPausePauseClass2Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPfcPausePauseClass2Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPfcPausePauseClass2Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowPfcPausePauseClass2Counter().msg() - } - - if value == PatternFlowPfcPausePauseClass2Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPfcPausePauseClass2Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass2) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPfcPausePauseClass2Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass2) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass2 object -func (obj *patternFlowPfcPausePauseClass2) SetValue(value uint32) PatternFlowPfcPausePauseClass2 { - obj.setChoice(PatternFlowPfcPausePauseClass2Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowPfcPausePauseClass2) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass2 object -func (obj *patternFlowPfcPausePauseClass2) SetValues(value []uint32) PatternFlowPfcPausePauseClass2 { - obj.setChoice(PatternFlowPfcPausePauseClass2Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass2Counter -func (obj *patternFlowPfcPausePauseClass2) Increment() PatternFlowPfcPausePauseClass2Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPfcPausePauseClass2Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPfcPausePauseClass2Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass2Counter -func (obj *patternFlowPfcPausePauseClass2) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPfcPausePauseClass2Counter value in the PatternFlowPfcPausePauseClass2 object -func (obj *patternFlowPfcPausePauseClass2) SetIncrement(value PatternFlowPfcPausePauseClass2Counter) PatternFlowPfcPausePauseClass2 { - obj.setChoice(PatternFlowPfcPausePauseClass2Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass2Counter -func (obj *patternFlowPfcPausePauseClass2) Decrement() PatternFlowPfcPausePauseClass2Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPfcPausePauseClass2Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPfcPausePauseClass2Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass2Counter -func (obj *patternFlowPfcPausePauseClass2) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPfcPausePauseClass2Counter value in the PatternFlowPfcPausePauseClass2 object -func (obj *patternFlowPfcPausePauseClass2) SetDecrement(value PatternFlowPfcPausePauseClass2Counter) PatternFlowPfcPausePauseClass2 { - obj.setChoice(PatternFlowPfcPausePauseClass2Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPfcPausePauseClass2MetricTag -func (obj *patternFlowPfcPausePauseClass2) MetricTags() PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass2MetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter struct { - obj *patternFlowPfcPausePauseClass2 - patternFlowPfcPausePauseClass2MetricTagSlice []PatternFlowPfcPausePauseClass2MetricTag - fieldPtr *[]*otg.PatternFlowPfcPausePauseClass2MetricTag -} - -func newPatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { - return &patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter interface { - setMsg(*patternFlowPfcPausePauseClass2) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter - Items() []PatternFlowPfcPausePauseClass2MetricTag - Add() PatternFlowPfcPausePauseClass2MetricTag - Append(items ...PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter - Set(index int, newObj PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter - Clear() PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter - clearHolderSlice() PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter - appendHolderSlice(item PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter -} - -func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass2) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPfcPausePauseClass2MetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) Items() []PatternFlowPfcPausePauseClass2MetricTag { - return obj.patternFlowPfcPausePauseClass2MetricTagSlice -} - -func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) Add() PatternFlowPfcPausePauseClass2MetricTag { - newObj := &otg.PatternFlowPfcPausePauseClass2MetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPfcPausePauseClass2MetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPfcPausePauseClass2MetricTagSlice = append(obj.patternFlowPfcPausePauseClass2MetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPfcPausePauseClass2MetricTagSlice = append(obj.patternFlowPfcPausePauseClass2MetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPfcPausePauseClass2MetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) Clear() PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass2MetricTag{} - obj.patternFlowPfcPausePauseClass2MetricTagSlice = []PatternFlowPfcPausePauseClass2MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { - if len(obj.patternFlowPfcPausePauseClass2MetricTagSlice) > 0 { - obj.patternFlowPfcPausePauseClass2MetricTagSlice = []PatternFlowPfcPausePauseClass2MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { - obj.patternFlowPfcPausePauseClass2MetricTagSlice = append(obj.patternFlowPfcPausePauseClass2MetricTagSlice, item) - return obj -} - -func (obj *patternFlowPfcPausePauseClass2) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass2.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass2.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass2MetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass2) setDefault() { - var choices_set int = 0 - var choice PatternFlowPfcPausePauseClass2ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass2Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass2Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass2Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass2Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPfcPausePauseClass2Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass2") - } - } else { - intVal := otg.PatternFlowPfcPausePauseClass2_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPfcPausePauseClass2_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPfcPausePauseClass3 ***** -type patternFlowPfcPausePauseClass3 struct { - validation - obj *otg.PatternFlowPfcPausePauseClass3 - marshaller marshalPatternFlowPfcPausePauseClass3 - unMarshaller unMarshalPatternFlowPfcPausePauseClass3 - incrementHolder PatternFlowPfcPausePauseClass3Counter - decrementHolder PatternFlowPfcPausePauseClass3Counter - metricTagsHolder PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter -} - -func NewPatternFlowPfcPausePauseClass3() PatternFlowPfcPausePauseClass3 { - obj := patternFlowPfcPausePauseClass3{obj: &otg.PatternFlowPfcPausePauseClass3{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass3) msg() *otg.PatternFlowPfcPausePauseClass3 { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass3) setMsg(msg *otg.PatternFlowPfcPausePauseClass3) PatternFlowPfcPausePauseClass3 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass3 struct { - obj *patternFlowPfcPausePauseClass3 -} - -type marshalPatternFlowPfcPausePauseClass3 interface { - // ToProto marshals PatternFlowPfcPausePauseClass3 to protobuf object *otg.PatternFlowPfcPausePauseClass3 - ToProto() (*otg.PatternFlowPfcPausePauseClass3, error) - // ToPbText marshals PatternFlowPfcPausePauseClass3 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass3 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass3 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass3 struct { - obj *patternFlowPfcPausePauseClass3 -} - -type unMarshalPatternFlowPfcPausePauseClass3 interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass3 from protobuf object *otg.PatternFlowPfcPausePauseClass3 - FromProto(msg *otg.PatternFlowPfcPausePauseClass3) (PatternFlowPfcPausePauseClass3, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass3 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass3 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass3 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass3) Marshal() marshalPatternFlowPfcPausePauseClass3 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass3{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass3) Unmarshal() unMarshalPatternFlowPfcPausePauseClass3 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass3{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass3) ToProto() (*otg.PatternFlowPfcPausePauseClass3, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass3) FromProto(msg *otg.PatternFlowPfcPausePauseClass3) (PatternFlowPfcPausePauseClass3, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass3) 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 *unMarshalpatternFlowPfcPausePauseClass3) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPfcPausePauseClass3) 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 *unMarshalpatternFlowPfcPausePauseClass3) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPfcPausePauseClass3) 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 *unMarshalpatternFlowPfcPausePauseClass3) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPfcPausePauseClass3) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass3) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass3) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass3) Clone() (PatternFlowPfcPausePauseClass3, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass3() - 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 -} - -func (obj *patternFlowPfcPausePauseClass3) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPfcPausePauseClass3 is pause class 3 -type PatternFlowPfcPausePauseClass3 interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass3 to protobuf object *otg.PatternFlowPfcPausePauseClass3 - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass3 - // setMsg unmarshals PatternFlowPfcPausePauseClass3 from protobuf object *otg.PatternFlowPfcPausePauseClass3 - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass3) PatternFlowPfcPausePauseClass3 - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass3 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass3 - // validate validates PatternFlowPfcPausePauseClass3 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass3, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPfcPausePauseClass3ChoiceEnum, set in PatternFlowPfcPausePauseClass3 - Choice() PatternFlowPfcPausePauseClass3ChoiceEnum - // setChoice assigns PatternFlowPfcPausePauseClass3ChoiceEnum provided by user to PatternFlowPfcPausePauseClass3 - setChoice(value PatternFlowPfcPausePauseClass3ChoiceEnum) PatternFlowPfcPausePauseClass3 - // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass3 - HasChoice() bool - // Value returns uint32, set in PatternFlowPfcPausePauseClass3. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass3 - SetValue(value uint32) PatternFlowPfcPausePauseClass3 - // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass3 - HasValue() bool - // Values returns []uint32, set in PatternFlowPfcPausePauseClass3. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass3 - SetValues(value []uint32) PatternFlowPfcPausePauseClass3 - // Increment returns PatternFlowPfcPausePauseClass3Counter, set in PatternFlowPfcPausePauseClass3. - // PatternFlowPfcPausePauseClass3Counter is integer counter pattern - Increment() PatternFlowPfcPausePauseClass3Counter - // SetIncrement assigns PatternFlowPfcPausePauseClass3Counter provided by user to PatternFlowPfcPausePauseClass3. - // PatternFlowPfcPausePauseClass3Counter is integer counter pattern - SetIncrement(value PatternFlowPfcPausePauseClass3Counter) PatternFlowPfcPausePauseClass3 - // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass3 - HasIncrement() bool - // Decrement returns PatternFlowPfcPausePauseClass3Counter, set in PatternFlowPfcPausePauseClass3. - // PatternFlowPfcPausePauseClass3Counter is integer counter pattern - Decrement() PatternFlowPfcPausePauseClass3Counter - // SetDecrement assigns PatternFlowPfcPausePauseClass3Counter provided by user to PatternFlowPfcPausePauseClass3. - // PatternFlowPfcPausePauseClass3Counter is integer counter pattern - SetDecrement(value PatternFlowPfcPausePauseClass3Counter) PatternFlowPfcPausePauseClass3 - // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass3 - HasDecrement() bool - // MetricTags returns PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIterIter, set in PatternFlowPfcPausePauseClass3 - MetricTags() PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter - setNil() -} - -type PatternFlowPfcPausePauseClass3ChoiceEnum string - -// Enum of Choice on PatternFlowPfcPausePauseClass3 -var PatternFlowPfcPausePauseClass3Choice = struct { - VALUE PatternFlowPfcPausePauseClass3ChoiceEnum - VALUES PatternFlowPfcPausePauseClass3ChoiceEnum - INCREMENT PatternFlowPfcPausePauseClass3ChoiceEnum - DECREMENT PatternFlowPfcPausePauseClass3ChoiceEnum -}{ - VALUE: PatternFlowPfcPausePauseClass3ChoiceEnum("value"), - VALUES: PatternFlowPfcPausePauseClass3ChoiceEnum("values"), - INCREMENT: PatternFlowPfcPausePauseClass3ChoiceEnum("increment"), - DECREMENT: PatternFlowPfcPausePauseClass3ChoiceEnum("decrement"), -} - -func (obj *patternFlowPfcPausePauseClass3) Choice() PatternFlowPfcPausePauseClass3ChoiceEnum { - return PatternFlowPfcPausePauseClass3ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPfcPausePauseClass3) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPfcPausePauseClass3) setChoice(value PatternFlowPfcPausePauseClass3ChoiceEnum) PatternFlowPfcPausePauseClass3 { - intValue, ok := otg.PatternFlowPfcPausePauseClass3_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPfcPausePauseClass3ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPfcPausePauseClass3_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPfcPausePauseClass3Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPfcPausePauseClass3Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPfcPausePauseClass3Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowPfcPausePauseClass3Counter().msg() - } - - if value == PatternFlowPfcPausePauseClass3Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPfcPausePauseClass3Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass3) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPfcPausePauseClass3Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass3) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass3 object -func (obj *patternFlowPfcPausePauseClass3) SetValue(value uint32) PatternFlowPfcPausePauseClass3 { - obj.setChoice(PatternFlowPfcPausePauseClass3Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowPfcPausePauseClass3) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass3 object -func (obj *patternFlowPfcPausePauseClass3) SetValues(value []uint32) PatternFlowPfcPausePauseClass3 { - obj.setChoice(PatternFlowPfcPausePauseClass3Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass3Counter -func (obj *patternFlowPfcPausePauseClass3) Increment() PatternFlowPfcPausePauseClass3Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPfcPausePauseClass3Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPfcPausePauseClass3Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass3Counter -func (obj *patternFlowPfcPausePauseClass3) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPfcPausePauseClass3Counter value in the PatternFlowPfcPausePauseClass3 object -func (obj *patternFlowPfcPausePauseClass3) SetIncrement(value PatternFlowPfcPausePauseClass3Counter) PatternFlowPfcPausePauseClass3 { - obj.setChoice(PatternFlowPfcPausePauseClass3Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass3Counter -func (obj *patternFlowPfcPausePauseClass3) Decrement() PatternFlowPfcPausePauseClass3Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPfcPausePauseClass3Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPfcPausePauseClass3Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass3Counter -func (obj *patternFlowPfcPausePauseClass3) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPfcPausePauseClass3Counter value in the PatternFlowPfcPausePauseClass3 object -func (obj *patternFlowPfcPausePauseClass3) SetDecrement(value PatternFlowPfcPausePauseClass3Counter) PatternFlowPfcPausePauseClass3 { - obj.setChoice(PatternFlowPfcPausePauseClass3Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPfcPausePauseClass3MetricTag -func (obj *patternFlowPfcPausePauseClass3) MetricTags() PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass3MetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter struct { - obj *patternFlowPfcPausePauseClass3 - patternFlowPfcPausePauseClass3MetricTagSlice []PatternFlowPfcPausePauseClass3MetricTag - fieldPtr *[]*otg.PatternFlowPfcPausePauseClass3MetricTag -} - -func newPatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { - return &patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter interface { - setMsg(*patternFlowPfcPausePauseClass3) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter - Items() []PatternFlowPfcPausePauseClass3MetricTag - Add() PatternFlowPfcPausePauseClass3MetricTag - Append(items ...PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter - Set(index int, newObj PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter - Clear() PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter - clearHolderSlice() PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter - appendHolderSlice(item PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter -} - -func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass3) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPfcPausePauseClass3MetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) Items() []PatternFlowPfcPausePauseClass3MetricTag { - return obj.patternFlowPfcPausePauseClass3MetricTagSlice -} - -func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) Add() PatternFlowPfcPausePauseClass3MetricTag { - newObj := &otg.PatternFlowPfcPausePauseClass3MetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPfcPausePauseClass3MetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPfcPausePauseClass3MetricTagSlice = append(obj.patternFlowPfcPausePauseClass3MetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPfcPausePauseClass3MetricTagSlice = append(obj.patternFlowPfcPausePauseClass3MetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPfcPausePauseClass3MetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) Clear() PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass3MetricTag{} - obj.patternFlowPfcPausePauseClass3MetricTagSlice = []PatternFlowPfcPausePauseClass3MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { - if len(obj.patternFlowPfcPausePauseClass3MetricTagSlice) > 0 { - obj.patternFlowPfcPausePauseClass3MetricTagSlice = []PatternFlowPfcPausePauseClass3MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { - obj.patternFlowPfcPausePauseClass3MetricTagSlice = append(obj.patternFlowPfcPausePauseClass3MetricTagSlice, item) - return obj -} - -func (obj *patternFlowPfcPausePauseClass3) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass3.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass3.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass3MetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass3) setDefault() { - var choices_set int = 0 - var choice PatternFlowPfcPausePauseClass3ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass3Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass3Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass3Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass3Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPfcPausePauseClass3Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass3") - } - } else { - intVal := otg.PatternFlowPfcPausePauseClass3_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPfcPausePauseClass3_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPfcPausePauseClass4 ***** -type patternFlowPfcPausePauseClass4 struct { - validation - obj *otg.PatternFlowPfcPausePauseClass4 - marshaller marshalPatternFlowPfcPausePauseClass4 - unMarshaller unMarshalPatternFlowPfcPausePauseClass4 - incrementHolder PatternFlowPfcPausePauseClass4Counter - decrementHolder PatternFlowPfcPausePauseClass4Counter - metricTagsHolder PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter -} - -func NewPatternFlowPfcPausePauseClass4() PatternFlowPfcPausePauseClass4 { - obj := patternFlowPfcPausePauseClass4{obj: &otg.PatternFlowPfcPausePauseClass4{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass4) msg() *otg.PatternFlowPfcPausePauseClass4 { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass4) setMsg(msg *otg.PatternFlowPfcPausePauseClass4) PatternFlowPfcPausePauseClass4 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass4 struct { - obj *patternFlowPfcPausePauseClass4 -} - -type marshalPatternFlowPfcPausePauseClass4 interface { - // ToProto marshals PatternFlowPfcPausePauseClass4 to protobuf object *otg.PatternFlowPfcPausePauseClass4 - ToProto() (*otg.PatternFlowPfcPausePauseClass4, error) - // ToPbText marshals PatternFlowPfcPausePauseClass4 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass4 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass4 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass4 struct { - obj *patternFlowPfcPausePauseClass4 -} - -type unMarshalPatternFlowPfcPausePauseClass4 interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass4 from protobuf object *otg.PatternFlowPfcPausePauseClass4 - FromProto(msg *otg.PatternFlowPfcPausePauseClass4) (PatternFlowPfcPausePauseClass4, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass4 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass4 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass4 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass4) Marshal() marshalPatternFlowPfcPausePauseClass4 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass4{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass4) Unmarshal() unMarshalPatternFlowPfcPausePauseClass4 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass4{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass4) ToProto() (*otg.PatternFlowPfcPausePauseClass4, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass4) FromProto(msg *otg.PatternFlowPfcPausePauseClass4) (PatternFlowPfcPausePauseClass4, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass4) 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 *unMarshalpatternFlowPfcPausePauseClass4) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPfcPausePauseClass4) 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 *unMarshalpatternFlowPfcPausePauseClass4) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPfcPausePauseClass4) 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 *unMarshalpatternFlowPfcPausePauseClass4) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPfcPausePauseClass4) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass4) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass4) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass4) Clone() (PatternFlowPfcPausePauseClass4, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass4() - 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 -} - -func (obj *patternFlowPfcPausePauseClass4) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPfcPausePauseClass4 is pause class 4 -type PatternFlowPfcPausePauseClass4 interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass4 to protobuf object *otg.PatternFlowPfcPausePauseClass4 - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass4 - // setMsg unmarshals PatternFlowPfcPausePauseClass4 from protobuf object *otg.PatternFlowPfcPausePauseClass4 - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass4) PatternFlowPfcPausePauseClass4 - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass4 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass4 - // validate validates PatternFlowPfcPausePauseClass4 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass4, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPfcPausePauseClass4ChoiceEnum, set in PatternFlowPfcPausePauseClass4 - Choice() PatternFlowPfcPausePauseClass4ChoiceEnum - // setChoice assigns PatternFlowPfcPausePauseClass4ChoiceEnum provided by user to PatternFlowPfcPausePauseClass4 - setChoice(value PatternFlowPfcPausePauseClass4ChoiceEnum) PatternFlowPfcPausePauseClass4 - // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass4 - HasChoice() bool - // Value returns uint32, set in PatternFlowPfcPausePauseClass4. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass4 - SetValue(value uint32) PatternFlowPfcPausePauseClass4 - // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass4 - HasValue() bool - // Values returns []uint32, set in PatternFlowPfcPausePauseClass4. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass4 - SetValues(value []uint32) PatternFlowPfcPausePauseClass4 - // Increment returns PatternFlowPfcPausePauseClass4Counter, set in PatternFlowPfcPausePauseClass4. - // PatternFlowPfcPausePauseClass4Counter is integer counter pattern - Increment() PatternFlowPfcPausePauseClass4Counter - // SetIncrement assigns PatternFlowPfcPausePauseClass4Counter provided by user to PatternFlowPfcPausePauseClass4. - // PatternFlowPfcPausePauseClass4Counter is integer counter pattern - SetIncrement(value PatternFlowPfcPausePauseClass4Counter) PatternFlowPfcPausePauseClass4 - // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass4 - HasIncrement() bool - // Decrement returns PatternFlowPfcPausePauseClass4Counter, set in PatternFlowPfcPausePauseClass4. - // PatternFlowPfcPausePauseClass4Counter is integer counter pattern - Decrement() PatternFlowPfcPausePauseClass4Counter - // SetDecrement assigns PatternFlowPfcPausePauseClass4Counter provided by user to PatternFlowPfcPausePauseClass4. - // PatternFlowPfcPausePauseClass4Counter is integer counter pattern - SetDecrement(value PatternFlowPfcPausePauseClass4Counter) PatternFlowPfcPausePauseClass4 - // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass4 - HasDecrement() bool - // MetricTags returns PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIterIter, set in PatternFlowPfcPausePauseClass4 - MetricTags() PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter - setNil() -} - -type PatternFlowPfcPausePauseClass4ChoiceEnum string - -// Enum of Choice on PatternFlowPfcPausePauseClass4 -var PatternFlowPfcPausePauseClass4Choice = struct { - VALUE PatternFlowPfcPausePauseClass4ChoiceEnum - VALUES PatternFlowPfcPausePauseClass4ChoiceEnum - INCREMENT PatternFlowPfcPausePauseClass4ChoiceEnum - DECREMENT PatternFlowPfcPausePauseClass4ChoiceEnum -}{ - VALUE: PatternFlowPfcPausePauseClass4ChoiceEnum("value"), - VALUES: PatternFlowPfcPausePauseClass4ChoiceEnum("values"), - INCREMENT: PatternFlowPfcPausePauseClass4ChoiceEnum("increment"), - DECREMENT: PatternFlowPfcPausePauseClass4ChoiceEnum("decrement"), -} - -func (obj *patternFlowPfcPausePauseClass4) Choice() PatternFlowPfcPausePauseClass4ChoiceEnum { - return PatternFlowPfcPausePauseClass4ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPfcPausePauseClass4) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPfcPausePauseClass4) setChoice(value PatternFlowPfcPausePauseClass4ChoiceEnum) PatternFlowPfcPausePauseClass4 { - intValue, ok := otg.PatternFlowPfcPausePauseClass4_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPfcPausePauseClass4ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPfcPausePauseClass4_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPfcPausePauseClass4Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPfcPausePauseClass4Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPfcPausePauseClass4Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowPfcPausePauseClass4Counter().msg() - } - - if value == PatternFlowPfcPausePauseClass4Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPfcPausePauseClass4Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass4) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPfcPausePauseClass4Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass4) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass4 object -func (obj *patternFlowPfcPausePauseClass4) SetValue(value uint32) PatternFlowPfcPausePauseClass4 { - obj.setChoice(PatternFlowPfcPausePauseClass4Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowPfcPausePauseClass4) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass4 object -func (obj *patternFlowPfcPausePauseClass4) SetValues(value []uint32) PatternFlowPfcPausePauseClass4 { - obj.setChoice(PatternFlowPfcPausePauseClass4Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass4Counter -func (obj *patternFlowPfcPausePauseClass4) Increment() PatternFlowPfcPausePauseClass4Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPfcPausePauseClass4Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPfcPausePauseClass4Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass4Counter -func (obj *patternFlowPfcPausePauseClass4) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPfcPausePauseClass4Counter value in the PatternFlowPfcPausePauseClass4 object -func (obj *patternFlowPfcPausePauseClass4) SetIncrement(value PatternFlowPfcPausePauseClass4Counter) PatternFlowPfcPausePauseClass4 { - obj.setChoice(PatternFlowPfcPausePauseClass4Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass4Counter -func (obj *patternFlowPfcPausePauseClass4) Decrement() PatternFlowPfcPausePauseClass4Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPfcPausePauseClass4Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPfcPausePauseClass4Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass4Counter -func (obj *patternFlowPfcPausePauseClass4) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPfcPausePauseClass4Counter value in the PatternFlowPfcPausePauseClass4 object -func (obj *patternFlowPfcPausePauseClass4) SetDecrement(value PatternFlowPfcPausePauseClass4Counter) PatternFlowPfcPausePauseClass4 { - obj.setChoice(PatternFlowPfcPausePauseClass4Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPfcPausePauseClass4MetricTag -func (obj *patternFlowPfcPausePauseClass4) MetricTags() PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass4MetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter struct { - obj *patternFlowPfcPausePauseClass4 - patternFlowPfcPausePauseClass4MetricTagSlice []PatternFlowPfcPausePauseClass4MetricTag - fieldPtr *[]*otg.PatternFlowPfcPausePauseClass4MetricTag -} - -func newPatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { - return &patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter interface { - setMsg(*patternFlowPfcPausePauseClass4) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter - Items() []PatternFlowPfcPausePauseClass4MetricTag - Add() PatternFlowPfcPausePauseClass4MetricTag - Append(items ...PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter - Set(index int, newObj PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter - Clear() PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter - clearHolderSlice() PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter - appendHolderSlice(item PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter -} - -func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass4) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPfcPausePauseClass4MetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) Items() []PatternFlowPfcPausePauseClass4MetricTag { - return obj.patternFlowPfcPausePauseClass4MetricTagSlice -} - -func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) Add() PatternFlowPfcPausePauseClass4MetricTag { - newObj := &otg.PatternFlowPfcPausePauseClass4MetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPfcPausePauseClass4MetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPfcPausePauseClass4MetricTagSlice = append(obj.patternFlowPfcPausePauseClass4MetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPfcPausePauseClass4MetricTagSlice = append(obj.patternFlowPfcPausePauseClass4MetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPfcPausePauseClass4MetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) Clear() PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass4MetricTag{} - obj.patternFlowPfcPausePauseClass4MetricTagSlice = []PatternFlowPfcPausePauseClass4MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { - if len(obj.patternFlowPfcPausePauseClass4MetricTagSlice) > 0 { - obj.patternFlowPfcPausePauseClass4MetricTagSlice = []PatternFlowPfcPausePauseClass4MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { - obj.patternFlowPfcPausePauseClass4MetricTagSlice = append(obj.patternFlowPfcPausePauseClass4MetricTagSlice, item) - return obj -} - -func (obj *patternFlowPfcPausePauseClass4) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass4.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass4.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass4MetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass4) setDefault() { - var choices_set int = 0 - var choice PatternFlowPfcPausePauseClass4ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass4Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass4Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass4Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass4Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPfcPausePauseClass4Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass4") - } - } else { - intVal := otg.PatternFlowPfcPausePauseClass4_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPfcPausePauseClass4_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPfcPausePauseClass5 ***** -type patternFlowPfcPausePauseClass5 struct { - validation - obj *otg.PatternFlowPfcPausePauseClass5 - marshaller marshalPatternFlowPfcPausePauseClass5 - unMarshaller unMarshalPatternFlowPfcPausePauseClass5 - incrementHolder PatternFlowPfcPausePauseClass5Counter - decrementHolder PatternFlowPfcPausePauseClass5Counter - metricTagsHolder PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter -} - -func NewPatternFlowPfcPausePauseClass5() PatternFlowPfcPausePauseClass5 { - obj := patternFlowPfcPausePauseClass5{obj: &otg.PatternFlowPfcPausePauseClass5{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass5) msg() *otg.PatternFlowPfcPausePauseClass5 { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass5) setMsg(msg *otg.PatternFlowPfcPausePauseClass5) PatternFlowPfcPausePauseClass5 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass5 struct { - obj *patternFlowPfcPausePauseClass5 -} - -type marshalPatternFlowPfcPausePauseClass5 interface { - // ToProto marshals PatternFlowPfcPausePauseClass5 to protobuf object *otg.PatternFlowPfcPausePauseClass5 - ToProto() (*otg.PatternFlowPfcPausePauseClass5, error) - // ToPbText marshals PatternFlowPfcPausePauseClass5 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass5 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass5 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass5 struct { - obj *patternFlowPfcPausePauseClass5 -} - -type unMarshalPatternFlowPfcPausePauseClass5 interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass5 from protobuf object *otg.PatternFlowPfcPausePauseClass5 - FromProto(msg *otg.PatternFlowPfcPausePauseClass5) (PatternFlowPfcPausePauseClass5, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass5 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass5 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass5 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass5) Marshal() marshalPatternFlowPfcPausePauseClass5 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass5{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass5) Unmarshal() unMarshalPatternFlowPfcPausePauseClass5 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass5{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass5) ToProto() (*otg.PatternFlowPfcPausePauseClass5, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass5) FromProto(msg *otg.PatternFlowPfcPausePauseClass5) (PatternFlowPfcPausePauseClass5, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass5) 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 *unMarshalpatternFlowPfcPausePauseClass5) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPfcPausePauseClass5) 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 *unMarshalpatternFlowPfcPausePauseClass5) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPfcPausePauseClass5) 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 *unMarshalpatternFlowPfcPausePauseClass5) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPfcPausePauseClass5) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass5) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass5) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass5) Clone() (PatternFlowPfcPausePauseClass5, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass5() - 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 -} - -func (obj *patternFlowPfcPausePauseClass5) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPfcPausePauseClass5 is pause class 5 -type PatternFlowPfcPausePauseClass5 interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass5 to protobuf object *otg.PatternFlowPfcPausePauseClass5 - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass5 - // setMsg unmarshals PatternFlowPfcPausePauseClass5 from protobuf object *otg.PatternFlowPfcPausePauseClass5 - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass5) PatternFlowPfcPausePauseClass5 - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass5 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass5 - // validate validates PatternFlowPfcPausePauseClass5 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass5, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPfcPausePauseClass5ChoiceEnum, set in PatternFlowPfcPausePauseClass5 - Choice() PatternFlowPfcPausePauseClass5ChoiceEnum - // setChoice assigns PatternFlowPfcPausePauseClass5ChoiceEnum provided by user to PatternFlowPfcPausePauseClass5 - setChoice(value PatternFlowPfcPausePauseClass5ChoiceEnum) PatternFlowPfcPausePauseClass5 - // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass5 - HasChoice() bool - // Value returns uint32, set in PatternFlowPfcPausePauseClass5. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass5 - SetValue(value uint32) PatternFlowPfcPausePauseClass5 - // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass5 - HasValue() bool - // Values returns []uint32, set in PatternFlowPfcPausePauseClass5. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass5 - SetValues(value []uint32) PatternFlowPfcPausePauseClass5 - // Increment returns PatternFlowPfcPausePauseClass5Counter, set in PatternFlowPfcPausePauseClass5. - // PatternFlowPfcPausePauseClass5Counter is integer counter pattern - Increment() PatternFlowPfcPausePauseClass5Counter - // SetIncrement assigns PatternFlowPfcPausePauseClass5Counter provided by user to PatternFlowPfcPausePauseClass5. - // PatternFlowPfcPausePauseClass5Counter is integer counter pattern - SetIncrement(value PatternFlowPfcPausePauseClass5Counter) PatternFlowPfcPausePauseClass5 - // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass5 - HasIncrement() bool - // Decrement returns PatternFlowPfcPausePauseClass5Counter, set in PatternFlowPfcPausePauseClass5. - // PatternFlowPfcPausePauseClass5Counter is integer counter pattern - Decrement() PatternFlowPfcPausePauseClass5Counter - // SetDecrement assigns PatternFlowPfcPausePauseClass5Counter provided by user to PatternFlowPfcPausePauseClass5. - // PatternFlowPfcPausePauseClass5Counter is integer counter pattern - SetDecrement(value PatternFlowPfcPausePauseClass5Counter) PatternFlowPfcPausePauseClass5 - // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass5 - HasDecrement() bool - // MetricTags returns PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIterIter, set in PatternFlowPfcPausePauseClass5 - MetricTags() PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter - setNil() -} - -type PatternFlowPfcPausePauseClass5ChoiceEnum string - -// Enum of Choice on PatternFlowPfcPausePauseClass5 -var PatternFlowPfcPausePauseClass5Choice = struct { - VALUE PatternFlowPfcPausePauseClass5ChoiceEnum - VALUES PatternFlowPfcPausePauseClass5ChoiceEnum - INCREMENT PatternFlowPfcPausePauseClass5ChoiceEnum - DECREMENT PatternFlowPfcPausePauseClass5ChoiceEnum -}{ - VALUE: PatternFlowPfcPausePauseClass5ChoiceEnum("value"), - VALUES: PatternFlowPfcPausePauseClass5ChoiceEnum("values"), - INCREMENT: PatternFlowPfcPausePauseClass5ChoiceEnum("increment"), - DECREMENT: PatternFlowPfcPausePauseClass5ChoiceEnum("decrement"), -} - -func (obj *patternFlowPfcPausePauseClass5) Choice() PatternFlowPfcPausePauseClass5ChoiceEnum { - return PatternFlowPfcPausePauseClass5ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPfcPausePauseClass5) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPfcPausePauseClass5) setChoice(value PatternFlowPfcPausePauseClass5ChoiceEnum) PatternFlowPfcPausePauseClass5 { - intValue, ok := otg.PatternFlowPfcPausePauseClass5_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPfcPausePauseClass5ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPfcPausePauseClass5_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPfcPausePauseClass5Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPfcPausePauseClass5Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPfcPausePauseClass5Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowPfcPausePauseClass5Counter().msg() - } - - if value == PatternFlowPfcPausePauseClass5Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPfcPausePauseClass5Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass5) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPfcPausePauseClass5Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass5) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass5 object -func (obj *patternFlowPfcPausePauseClass5) SetValue(value uint32) PatternFlowPfcPausePauseClass5 { - obj.setChoice(PatternFlowPfcPausePauseClass5Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowPfcPausePauseClass5) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass5 object -func (obj *patternFlowPfcPausePauseClass5) SetValues(value []uint32) PatternFlowPfcPausePauseClass5 { - obj.setChoice(PatternFlowPfcPausePauseClass5Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass5Counter -func (obj *patternFlowPfcPausePauseClass5) Increment() PatternFlowPfcPausePauseClass5Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPfcPausePauseClass5Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPfcPausePauseClass5Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass5Counter -func (obj *patternFlowPfcPausePauseClass5) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPfcPausePauseClass5Counter value in the PatternFlowPfcPausePauseClass5 object -func (obj *patternFlowPfcPausePauseClass5) SetIncrement(value PatternFlowPfcPausePauseClass5Counter) PatternFlowPfcPausePauseClass5 { - obj.setChoice(PatternFlowPfcPausePauseClass5Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass5Counter -func (obj *patternFlowPfcPausePauseClass5) Decrement() PatternFlowPfcPausePauseClass5Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPfcPausePauseClass5Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPfcPausePauseClass5Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass5Counter -func (obj *patternFlowPfcPausePauseClass5) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPfcPausePauseClass5Counter value in the PatternFlowPfcPausePauseClass5 object -func (obj *patternFlowPfcPausePauseClass5) SetDecrement(value PatternFlowPfcPausePauseClass5Counter) PatternFlowPfcPausePauseClass5 { - obj.setChoice(PatternFlowPfcPausePauseClass5Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPfcPausePauseClass5MetricTag -func (obj *patternFlowPfcPausePauseClass5) MetricTags() PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass5MetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter struct { - obj *patternFlowPfcPausePauseClass5 - patternFlowPfcPausePauseClass5MetricTagSlice []PatternFlowPfcPausePauseClass5MetricTag - fieldPtr *[]*otg.PatternFlowPfcPausePauseClass5MetricTag -} - -func newPatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { - return &patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter interface { - setMsg(*patternFlowPfcPausePauseClass5) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter - Items() []PatternFlowPfcPausePauseClass5MetricTag - Add() PatternFlowPfcPausePauseClass5MetricTag - Append(items ...PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter - Set(index int, newObj PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter - Clear() PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter - clearHolderSlice() PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter - appendHolderSlice(item PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter -} - -func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass5) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPfcPausePauseClass5MetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) Items() []PatternFlowPfcPausePauseClass5MetricTag { - return obj.patternFlowPfcPausePauseClass5MetricTagSlice -} - -func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) Add() PatternFlowPfcPausePauseClass5MetricTag { - newObj := &otg.PatternFlowPfcPausePauseClass5MetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPfcPausePauseClass5MetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPfcPausePauseClass5MetricTagSlice = append(obj.patternFlowPfcPausePauseClass5MetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPfcPausePauseClass5MetricTagSlice = append(obj.patternFlowPfcPausePauseClass5MetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPfcPausePauseClass5MetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) Clear() PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass5MetricTag{} - obj.patternFlowPfcPausePauseClass5MetricTagSlice = []PatternFlowPfcPausePauseClass5MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { - if len(obj.patternFlowPfcPausePauseClass5MetricTagSlice) > 0 { - obj.patternFlowPfcPausePauseClass5MetricTagSlice = []PatternFlowPfcPausePauseClass5MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { - obj.patternFlowPfcPausePauseClass5MetricTagSlice = append(obj.patternFlowPfcPausePauseClass5MetricTagSlice, item) - return obj -} - -func (obj *patternFlowPfcPausePauseClass5) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass5.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass5.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass5MetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass5) setDefault() { - var choices_set int = 0 - var choice PatternFlowPfcPausePauseClass5ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass5Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass5Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass5Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass5Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPfcPausePauseClass5Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass5") - } - } else { - intVal := otg.PatternFlowPfcPausePauseClass5_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPfcPausePauseClass5_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPfcPausePauseClass6 ***** -type patternFlowPfcPausePauseClass6 struct { - validation - obj *otg.PatternFlowPfcPausePauseClass6 - marshaller marshalPatternFlowPfcPausePauseClass6 - unMarshaller unMarshalPatternFlowPfcPausePauseClass6 - incrementHolder PatternFlowPfcPausePauseClass6Counter - decrementHolder PatternFlowPfcPausePauseClass6Counter - metricTagsHolder PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter -} - -func NewPatternFlowPfcPausePauseClass6() PatternFlowPfcPausePauseClass6 { - obj := patternFlowPfcPausePauseClass6{obj: &otg.PatternFlowPfcPausePauseClass6{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass6) msg() *otg.PatternFlowPfcPausePauseClass6 { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass6) setMsg(msg *otg.PatternFlowPfcPausePauseClass6) PatternFlowPfcPausePauseClass6 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass6 struct { - obj *patternFlowPfcPausePauseClass6 -} - -type marshalPatternFlowPfcPausePauseClass6 interface { - // ToProto marshals PatternFlowPfcPausePauseClass6 to protobuf object *otg.PatternFlowPfcPausePauseClass6 - ToProto() (*otg.PatternFlowPfcPausePauseClass6, error) - // ToPbText marshals PatternFlowPfcPausePauseClass6 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass6 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass6 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass6 struct { - obj *patternFlowPfcPausePauseClass6 -} - -type unMarshalPatternFlowPfcPausePauseClass6 interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass6 from protobuf object *otg.PatternFlowPfcPausePauseClass6 - FromProto(msg *otg.PatternFlowPfcPausePauseClass6) (PatternFlowPfcPausePauseClass6, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass6 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass6 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass6 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass6) Marshal() marshalPatternFlowPfcPausePauseClass6 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass6{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass6) Unmarshal() unMarshalPatternFlowPfcPausePauseClass6 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass6{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass6) ToProto() (*otg.PatternFlowPfcPausePauseClass6, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass6) FromProto(msg *otg.PatternFlowPfcPausePauseClass6) (PatternFlowPfcPausePauseClass6, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass6) 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 *unMarshalpatternFlowPfcPausePauseClass6) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPfcPausePauseClass6) 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 *unMarshalpatternFlowPfcPausePauseClass6) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPfcPausePauseClass6) 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 *unMarshalpatternFlowPfcPausePauseClass6) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPfcPausePauseClass6) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass6) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass6) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass6) Clone() (PatternFlowPfcPausePauseClass6, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass6() - 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 -} - -func (obj *patternFlowPfcPausePauseClass6) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPfcPausePauseClass6 is pause class 6 -type PatternFlowPfcPausePauseClass6 interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass6 to protobuf object *otg.PatternFlowPfcPausePauseClass6 - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass6 - // setMsg unmarshals PatternFlowPfcPausePauseClass6 from protobuf object *otg.PatternFlowPfcPausePauseClass6 - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass6) PatternFlowPfcPausePauseClass6 - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass6 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass6 - // validate validates PatternFlowPfcPausePauseClass6 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass6, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPfcPausePauseClass6ChoiceEnum, set in PatternFlowPfcPausePauseClass6 - Choice() PatternFlowPfcPausePauseClass6ChoiceEnum - // setChoice assigns PatternFlowPfcPausePauseClass6ChoiceEnum provided by user to PatternFlowPfcPausePauseClass6 - setChoice(value PatternFlowPfcPausePauseClass6ChoiceEnum) PatternFlowPfcPausePauseClass6 - // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass6 - HasChoice() bool - // Value returns uint32, set in PatternFlowPfcPausePauseClass6. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass6 - SetValue(value uint32) PatternFlowPfcPausePauseClass6 - // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass6 - HasValue() bool - // Values returns []uint32, set in PatternFlowPfcPausePauseClass6. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass6 - SetValues(value []uint32) PatternFlowPfcPausePauseClass6 - // Increment returns PatternFlowPfcPausePauseClass6Counter, set in PatternFlowPfcPausePauseClass6. - // PatternFlowPfcPausePauseClass6Counter is integer counter pattern - Increment() PatternFlowPfcPausePauseClass6Counter - // SetIncrement assigns PatternFlowPfcPausePauseClass6Counter provided by user to PatternFlowPfcPausePauseClass6. - // PatternFlowPfcPausePauseClass6Counter is integer counter pattern - SetIncrement(value PatternFlowPfcPausePauseClass6Counter) PatternFlowPfcPausePauseClass6 - // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass6 - HasIncrement() bool - // Decrement returns PatternFlowPfcPausePauseClass6Counter, set in PatternFlowPfcPausePauseClass6. - // PatternFlowPfcPausePauseClass6Counter is integer counter pattern - Decrement() PatternFlowPfcPausePauseClass6Counter - // SetDecrement assigns PatternFlowPfcPausePauseClass6Counter provided by user to PatternFlowPfcPausePauseClass6. - // PatternFlowPfcPausePauseClass6Counter is integer counter pattern - SetDecrement(value PatternFlowPfcPausePauseClass6Counter) PatternFlowPfcPausePauseClass6 - // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass6 - HasDecrement() bool - // MetricTags returns PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIterIter, set in PatternFlowPfcPausePauseClass6 - MetricTags() PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter - setNil() -} - -type PatternFlowPfcPausePauseClass6ChoiceEnum string - -// Enum of Choice on PatternFlowPfcPausePauseClass6 -var PatternFlowPfcPausePauseClass6Choice = struct { - VALUE PatternFlowPfcPausePauseClass6ChoiceEnum - VALUES PatternFlowPfcPausePauseClass6ChoiceEnum - INCREMENT PatternFlowPfcPausePauseClass6ChoiceEnum - DECREMENT PatternFlowPfcPausePauseClass6ChoiceEnum -}{ - VALUE: PatternFlowPfcPausePauseClass6ChoiceEnum("value"), - VALUES: PatternFlowPfcPausePauseClass6ChoiceEnum("values"), - INCREMENT: PatternFlowPfcPausePauseClass6ChoiceEnum("increment"), - DECREMENT: PatternFlowPfcPausePauseClass6ChoiceEnum("decrement"), -} - -func (obj *patternFlowPfcPausePauseClass6) Choice() PatternFlowPfcPausePauseClass6ChoiceEnum { - return PatternFlowPfcPausePauseClass6ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPfcPausePauseClass6) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPfcPausePauseClass6) setChoice(value PatternFlowPfcPausePauseClass6ChoiceEnum) PatternFlowPfcPausePauseClass6 { - intValue, ok := otg.PatternFlowPfcPausePauseClass6_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPfcPausePauseClass6ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPfcPausePauseClass6_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPfcPausePauseClass6Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPfcPausePauseClass6Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPfcPausePauseClass6Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowPfcPausePauseClass6Counter().msg() - } - - if value == PatternFlowPfcPausePauseClass6Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPfcPausePauseClass6Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass6) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPfcPausePauseClass6Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass6) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass6 object -func (obj *patternFlowPfcPausePauseClass6) SetValue(value uint32) PatternFlowPfcPausePauseClass6 { - obj.setChoice(PatternFlowPfcPausePauseClass6Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowPfcPausePauseClass6) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass6 object -func (obj *patternFlowPfcPausePauseClass6) SetValues(value []uint32) PatternFlowPfcPausePauseClass6 { - obj.setChoice(PatternFlowPfcPausePauseClass6Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass6Counter -func (obj *patternFlowPfcPausePauseClass6) Increment() PatternFlowPfcPausePauseClass6Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPfcPausePauseClass6Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPfcPausePauseClass6Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass6Counter -func (obj *patternFlowPfcPausePauseClass6) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPfcPausePauseClass6Counter value in the PatternFlowPfcPausePauseClass6 object -func (obj *patternFlowPfcPausePauseClass6) SetIncrement(value PatternFlowPfcPausePauseClass6Counter) PatternFlowPfcPausePauseClass6 { - obj.setChoice(PatternFlowPfcPausePauseClass6Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass6Counter -func (obj *patternFlowPfcPausePauseClass6) Decrement() PatternFlowPfcPausePauseClass6Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPfcPausePauseClass6Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPfcPausePauseClass6Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass6Counter -func (obj *patternFlowPfcPausePauseClass6) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPfcPausePauseClass6Counter value in the PatternFlowPfcPausePauseClass6 object -func (obj *patternFlowPfcPausePauseClass6) SetDecrement(value PatternFlowPfcPausePauseClass6Counter) PatternFlowPfcPausePauseClass6 { - obj.setChoice(PatternFlowPfcPausePauseClass6Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPfcPausePauseClass6MetricTag -func (obj *patternFlowPfcPausePauseClass6) MetricTags() PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass6MetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter struct { - obj *patternFlowPfcPausePauseClass6 - patternFlowPfcPausePauseClass6MetricTagSlice []PatternFlowPfcPausePauseClass6MetricTag - fieldPtr *[]*otg.PatternFlowPfcPausePauseClass6MetricTag -} - -func newPatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { - return &patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter interface { - setMsg(*patternFlowPfcPausePauseClass6) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter - Items() []PatternFlowPfcPausePauseClass6MetricTag - Add() PatternFlowPfcPausePauseClass6MetricTag - Append(items ...PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter - Set(index int, newObj PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter - Clear() PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter - clearHolderSlice() PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter - appendHolderSlice(item PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter -} - -func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass6) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPfcPausePauseClass6MetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) Items() []PatternFlowPfcPausePauseClass6MetricTag { - return obj.patternFlowPfcPausePauseClass6MetricTagSlice -} - -func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) Add() PatternFlowPfcPausePauseClass6MetricTag { - newObj := &otg.PatternFlowPfcPausePauseClass6MetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPfcPausePauseClass6MetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPfcPausePauseClass6MetricTagSlice = append(obj.patternFlowPfcPausePauseClass6MetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPfcPausePauseClass6MetricTagSlice = append(obj.patternFlowPfcPausePauseClass6MetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPfcPausePauseClass6MetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) Clear() PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass6MetricTag{} - obj.patternFlowPfcPausePauseClass6MetricTagSlice = []PatternFlowPfcPausePauseClass6MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { - if len(obj.patternFlowPfcPausePauseClass6MetricTagSlice) > 0 { - obj.patternFlowPfcPausePauseClass6MetricTagSlice = []PatternFlowPfcPausePauseClass6MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { - obj.patternFlowPfcPausePauseClass6MetricTagSlice = append(obj.patternFlowPfcPausePauseClass6MetricTagSlice, item) - return obj -} - -func (obj *patternFlowPfcPausePauseClass6) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass6.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass6.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass6MetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass6) setDefault() { - var choices_set int = 0 - var choice PatternFlowPfcPausePauseClass6ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass6Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass6Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass6Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass6Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPfcPausePauseClass6Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass6") - } - } else { - intVal := otg.PatternFlowPfcPausePauseClass6_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPfcPausePauseClass6_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPfcPausePauseClass7 ***** -type patternFlowPfcPausePauseClass7 struct { - validation - obj *otg.PatternFlowPfcPausePauseClass7 - marshaller marshalPatternFlowPfcPausePauseClass7 - unMarshaller unMarshalPatternFlowPfcPausePauseClass7 - incrementHolder PatternFlowPfcPausePauseClass7Counter - decrementHolder PatternFlowPfcPausePauseClass7Counter - metricTagsHolder PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter -} - -func NewPatternFlowPfcPausePauseClass7() PatternFlowPfcPausePauseClass7 { - obj := patternFlowPfcPausePauseClass7{obj: &otg.PatternFlowPfcPausePauseClass7{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass7) msg() *otg.PatternFlowPfcPausePauseClass7 { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass7) setMsg(msg *otg.PatternFlowPfcPausePauseClass7) PatternFlowPfcPausePauseClass7 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass7 struct { - obj *patternFlowPfcPausePauseClass7 -} - -type marshalPatternFlowPfcPausePauseClass7 interface { - // ToProto marshals PatternFlowPfcPausePauseClass7 to protobuf object *otg.PatternFlowPfcPausePauseClass7 - ToProto() (*otg.PatternFlowPfcPausePauseClass7, error) - // ToPbText marshals PatternFlowPfcPausePauseClass7 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass7 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass7 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass7 struct { - obj *patternFlowPfcPausePauseClass7 -} - -type unMarshalPatternFlowPfcPausePauseClass7 interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass7 from protobuf object *otg.PatternFlowPfcPausePauseClass7 - FromProto(msg *otg.PatternFlowPfcPausePauseClass7) (PatternFlowPfcPausePauseClass7, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass7 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass7 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass7 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass7) Marshal() marshalPatternFlowPfcPausePauseClass7 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass7{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass7) Unmarshal() unMarshalPatternFlowPfcPausePauseClass7 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass7{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass7) ToProto() (*otg.PatternFlowPfcPausePauseClass7, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass7) FromProto(msg *otg.PatternFlowPfcPausePauseClass7) (PatternFlowPfcPausePauseClass7, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass7) 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 *unMarshalpatternFlowPfcPausePauseClass7) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPfcPausePauseClass7) 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 *unMarshalpatternFlowPfcPausePauseClass7) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPfcPausePauseClass7) 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 *unMarshalpatternFlowPfcPausePauseClass7) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPfcPausePauseClass7) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass7) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass7) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass7) Clone() (PatternFlowPfcPausePauseClass7, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass7() - 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 -} - -func (obj *patternFlowPfcPausePauseClass7) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPfcPausePauseClass7 is pause class 7 -type PatternFlowPfcPausePauseClass7 interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass7 to protobuf object *otg.PatternFlowPfcPausePauseClass7 - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass7 - // setMsg unmarshals PatternFlowPfcPausePauseClass7 from protobuf object *otg.PatternFlowPfcPausePauseClass7 - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass7) PatternFlowPfcPausePauseClass7 - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass7 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass7 - // validate validates PatternFlowPfcPausePauseClass7 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass7, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPfcPausePauseClass7ChoiceEnum, set in PatternFlowPfcPausePauseClass7 - Choice() PatternFlowPfcPausePauseClass7ChoiceEnum - // setChoice assigns PatternFlowPfcPausePauseClass7ChoiceEnum provided by user to PatternFlowPfcPausePauseClass7 - setChoice(value PatternFlowPfcPausePauseClass7ChoiceEnum) PatternFlowPfcPausePauseClass7 - // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass7 - HasChoice() bool - // Value returns uint32, set in PatternFlowPfcPausePauseClass7. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass7 - SetValue(value uint32) PatternFlowPfcPausePauseClass7 - // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass7 - HasValue() bool - // Values returns []uint32, set in PatternFlowPfcPausePauseClass7. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass7 - SetValues(value []uint32) PatternFlowPfcPausePauseClass7 - // Increment returns PatternFlowPfcPausePauseClass7Counter, set in PatternFlowPfcPausePauseClass7. - // PatternFlowPfcPausePauseClass7Counter is integer counter pattern - Increment() PatternFlowPfcPausePauseClass7Counter - // SetIncrement assigns PatternFlowPfcPausePauseClass7Counter provided by user to PatternFlowPfcPausePauseClass7. - // PatternFlowPfcPausePauseClass7Counter is integer counter pattern - SetIncrement(value PatternFlowPfcPausePauseClass7Counter) PatternFlowPfcPausePauseClass7 - // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass7 - HasIncrement() bool - // Decrement returns PatternFlowPfcPausePauseClass7Counter, set in PatternFlowPfcPausePauseClass7. - // PatternFlowPfcPausePauseClass7Counter is integer counter pattern - Decrement() PatternFlowPfcPausePauseClass7Counter - // SetDecrement assigns PatternFlowPfcPausePauseClass7Counter provided by user to PatternFlowPfcPausePauseClass7. - // PatternFlowPfcPausePauseClass7Counter is integer counter pattern - SetDecrement(value PatternFlowPfcPausePauseClass7Counter) PatternFlowPfcPausePauseClass7 - // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass7 - HasDecrement() bool - // MetricTags returns PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIterIter, set in PatternFlowPfcPausePauseClass7 - MetricTags() PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter - setNil() -} - -type PatternFlowPfcPausePauseClass7ChoiceEnum string - -// Enum of Choice on PatternFlowPfcPausePauseClass7 -var PatternFlowPfcPausePauseClass7Choice = struct { - VALUE PatternFlowPfcPausePauseClass7ChoiceEnum - VALUES PatternFlowPfcPausePauseClass7ChoiceEnum - INCREMENT PatternFlowPfcPausePauseClass7ChoiceEnum - DECREMENT PatternFlowPfcPausePauseClass7ChoiceEnum -}{ - VALUE: PatternFlowPfcPausePauseClass7ChoiceEnum("value"), - VALUES: PatternFlowPfcPausePauseClass7ChoiceEnum("values"), - INCREMENT: PatternFlowPfcPausePauseClass7ChoiceEnum("increment"), - DECREMENT: PatternFlowPfcPausePauseClass7ChoiceEnum("decrement"), -} - -func (obj *patternFlowPfcPausePauseClass7) Choice() PatternFlowPfcPausePauseClass7ChoiceEnum { - return PatternFlowPfcPausePauseClass7ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPfcPausePauseClass7) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPfcPausePauseClass7) setChoice(value PatternFlowPfcPausePauseClass7ChoiceEnum) PatternFlowPfcPausePauseClass7 { - intValue, ok := otg.PatternFlowPfcPausePauseClass7_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPfcPausePauseClass7ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPfcPausePauseClass7_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPfcPausePauseClass7Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPfcPausePauseClass7Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPfcPausePauseClass7Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowPfcPausePauseClass7Counter().msg() - } - - if value == PatternFlowPfcPausePauseClass7Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPfcPausePauseClass7Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass7) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPfcPausePauseClass7Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPfcPausePauseClass7) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass7 object -func (obj *patternFlowPfcPausePauseClass7) SetValue(value uint32) PatternFlowPfcPausePauseClass7 { - obj.setChoice(PatternFlowPfcPausePauseClass7Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowPfcPausePauseClass7) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass7 object -func (obj *patternFlowPfcPausePauseClass7) SetValues(value []uint32) PatternFlowPfcPausePauseClass7 { - obj.setChoice(PatternFlowPfcPausePauseClass7Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass7Counter -func (obj *patternFlowPfcPausePauseClass7) Increment() PatternFlowPfcPausePauseClass7Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPfcPausePauseClass7Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPfcPausePauseClass7Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPfcPausePauseClass7Counter -func (obj *patternFlowPfcPausePauseClass7) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPfcPausePauseClass7Counter value in the PatternFlowPfcPausePauseClass7 object -func (obj *patternFlowPfcPausePauseClass7) SetIncrement(value PatternFlowPfcPausePauseClass7Counter) PatternFlowPfcPausePauseClass7 { - obj.setChoice(PatternFlowPfcPausePauseClass7Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass7Counter -func (obj *patternFlowPfcPausePauseClass7) Decrement() PatternFlowPfcPausePauseClass7Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPfcPausePauseClass7Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPfcPausePauseClass7Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPfcPausePauseClass7Counter -func (obj *patternFlowPfcPausePauseClass7) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPfcPausePauseClass7Counter value in the PatternFlowPfcPausePauseClass7 object -func (obj *patternFlowPfcPausePauseClass7) SetDecrement(value PatternFlowPfcPausePauseClass7Counter) PatternFlowPfcPausePauseClass7 { - obj.setChoice(PatternFlowPfcPausePauseClass7Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPfcPausePauseClass7MetricTag -func (obj *patternFlowPfcPausePauseClass7) MetricTags() PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass7MetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter struct { - obj *patternFlowPfcPausePauseClass7 - patternFlowPfcPausePauseClass7MetricTagSlice []PatternFlowPfcPausePauseClass7MetricTag - fieldPtr *[]*otg.PatternFlowPfcPausePauseClass7MetricTag -} - -func newPatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { - return &patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter interface { - setMsg(*patternFlowPfcPausePauseClass7) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter - Items() []PatternFlowPfcPausePauseClass7MetricTag - Add() PatternFlowPfcPausePauseClass7MetricTag - Append(items ...PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter - Set(index int, newObj PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter - Clear() PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter - clearHolderSlice() PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter - appendHolderSlice(item PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter -} - -func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass7) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPfcPausePauseClass7MetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) Items() []PatternFlowPfcPausePauseClass7MetricTag { - return obj.patternFlowPfcPausePauseClass7MetricTagSlice -} - -func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) Add() PatternFlowPfcPausePauseClass7MetricTag { - newObj := &otg.PatternFlowPfcPausePauseClass7MetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPfcPausePauseClass7MetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPfcPausePauseClass7MetricTagSlice = append(obj.patternFlowPfcPausePauseClass7MetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPfcPausePauseClass7MetricTagSlice = append(obj.patternFlowPfcPausePauseClass7MetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPfcPausePauseClass7MetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) Clear() PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass7MetricTag{} - obj.patternFlowPfcPausePauseClass7MetricTagSlice = []PatternFlowPfcPausePauseClass7MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { - if len(obj.patternFlowPfcPausePauseClass7MetricTagSlice) > 0 { - obj.patternFlowPfcPausePauseClass7MetricTagSlice = []PatternFlowPfcPausePauseClass7MetricTag{} - } - return obj -} -func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { - obj.patternFlowPfcPausePauseClass7MetricTagSlice = append(obj.patternFlowPfcPausePauseClass7MetricTagSlice, item) - return obj -} - -func (obj *patternFlowPfcPausePauseClass7) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass7.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass7.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass7MetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass7) setDefault() { - var choices_set int = 0 - var choice PatternFlowPfcPausePauseClass7ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass7Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass7Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass7Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPfcPausePauseClass7Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPfcPausePauseClass7Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass7") - } - } else { - intVal := otg.PatternFlowPfcPausePauseClass7_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPfcPausePauseClass7_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowEthernetPauseDst ***** -type patternFlowEthernetPauseDst struct { - validation - obj *otg.PatternFlowEthernetPauseDst - marshaller marshalPatternFlowEthernetPauseDst - unMarshaller unMarshalPatternFlowEthernetPauseDst - incrementHolder PatternFlowEthernetPauseDstCounter - decrementHolder PatternFlowEthernetPauseDstCounter - metricTagsHolder PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter -} - -func NewPatternFlowEthernetPauseDst() PatternFlowEthernetPauseDst { - obj := patternFlowEthernetPauseDst{obj: &otg.PatternFlowEthernetPauseDst{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseDst) msg() *otg.PatternFlowEthernetPauseDst { - return obj.obj -} - -func (obj *patternFlowEthernetPauseDst) setMsg(msg *otg.PatternFlowEthernetPauseDst) PatternFlowEthernetPauseDst { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseDst struct { - obj *patternFlowEthernetPauseDst -} - -type marshalPatternFlowEthernetPauseDst interface { - // ToProto marshals PatternFlowEthernetPauseDst to protobuf object *otg.PatternFlowEthernetPauseDst - ToProto() (*otg.PatternFlowEthernetPauseDst, error) - // ToPbText marshals PatternFlowEthernetPauseDst to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseDst to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseDst to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseDst struct { - obj *patternFlowEthernetPauseDst -} - -type unMarshalPatternFlowEthernetPauseDst interface { - // FromProto unmarshals PatternFlowEthernetPauseDst from protobuf object *otg.PatternFlowEthernetPauseDst - FromProto(msg *otg.PatternFlowEthernetPauseDst) (PatternFlowEthernetPauseDst, error) - // FromPbText unmarshals PatternFlowEthernetPauseDst from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseDst from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseDst from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseDst) Marshal() marshalPatternFlowEthernetPauseDst { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseDst{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseDst) Unmarshal() unMarshalPatternFlowEthernetPauseDst { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseDst{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseDst) ToProto() (*otg.PatternFlowEthernetPauseDst, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseDst) FromProto(msg *otg.PatternFlowEthernetPauseDst) (PatternFlowEthernetPauseDst, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseDst) 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 *unMarshalpatternFlowEthernetPauseDst) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowEthernetPauseDst) 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 *unMarshalpatternFlowEthernetPauseDst) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowEthernetPauseDst) 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 *unMarshalpatternFlowEthernetPauseDst) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowEthernetPauseDst) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseDst) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseDst) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseDst) Clone() (PatternFlowEthernetPauseDst, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseDst() - 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 -} - -func (obj *patternFlowEthernetPauseDst) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowEthernetPauseDst is destination MAC address -type PatternFlowEthernetPauseDst interface { - Validation - // msg marshals PatternFlowEthernetPauseDst to protobuf object *otg.PatternFlowEthernetPauseDst - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseDst - // setMsg unmarshals PatternFlowEthernetPauseDst from protobuf object *otg.PatternFlowEthernetPauseDst - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseDst) PatternFlowEthernetPauseDst - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseDst - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseDst - // validate validates PatternFlowEthernetPauseDst - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseDst, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowEthernetPauseDstChoiceEnum, set in PatternFlowEthernetPauseDst - Choice() PatternFlowEthernetPauseDstChoiceEnum - // setChoice assigns PatternFlowEthernetPauseDstChoiceEnum provided by user to PatternFlowEthernetPauseDst - setChoice(value PatternFlowEthernetPauseDstChoiceEnum) PatternFlowEthernetPauseDst - // HasChoice checks if Choice has been set in PatternFlowEthernetPauseDst - HasChoice() bool - // Value returns string, set in PatternFlowEthernetPauseDst. - Value() string - // SetValue assigns string provided by user to PatternFlowEthernetPauseDst - SetValue(value string) PatternFlowEthernetPauseDst - // HasValue checks if Value has been set in PatternFlowEthernetPauseDst - HasValue() bool - // Values returns []string, set in PatternFlowEthernetPauseDst. - Values() []string - // SetValues assigns []string provided by user to PatternFlowEthernetPauseDst - SetValues(value []string) PatternFlowEthernetPauseDst - // Increment returns PatternFlowEthernetPauseDstCounter, set in PatternFlowEthernetPauseDst. - // PatternFlowEthernetPauseDstCounter is mac counter pattern - Increment() PatternFlowEthernetPauseDstCounter - // SetIncrement assigns PatternFlowEthernetPauseDstCounter provided by user to PatternFlowEthernetPauseDst. - // PatternFlowEthernetPauseDstCounter is mac counter pattern - SetIncrement(value PatternFlowEthernetPauseDstCounter) PatternFlowEthernetPauseDst - // HasIncrement checks if Increment has been set in PatternFlowEthernetPauseDst - HasIncrement() bool - // Decrement returns PatternFlowEthernetPauseDstCounter, set in PatternFlowEthernetPauseDst. - // PatternFlowEthernetPauseDstCounter is mac counter pattern - Decrement() PatternFlowEthernetPauseDstCounter - // SetDecrement assigns PatternFlowEthernetPauseDstCounter provided by user to PatternFlowEthernetPauseDst. - // PatternFlowEthernetPauseDstCounter is mac counter pattern - SetDecrement(value PatternFlowEthernetPauseDstCounter) PatternFlowEthernetPauseDst - // HasDecrement checks if Decrement has been set in PatternFlowEthernetPauseDst - HasDecrement() bool - // MetricTags returns PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIterIter, set in PatternFlowEthernetPauseDst - MetricTags() PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter - setNil() -} - -type PatternFlowEthernetPauseDstChoiceEnum string - -// Enum of Choice on PatternFlowEthernetPauseDst -var PatternFlowEthernetPauseDstChoice = struct { - VALUE PatternFlowEthernetPauseDstChoiceEnum - VALUES PatternFlowEthernetPauseDstChoiceEnum - INCREMENT PatternFlowEthernetPauseDstChoiceEnum - DECREMENT PatternFlowEthernetPauseDstChoiceEnum -}{ - VALUE: PatternFlowEthernetPauseDstChoiceEnum("value"), - VALUES: PatternFlowEthernetPauseDstChoiceEnum("values"), - INCREMENT: PatternFlowEthernetPauseDstChoiceEnum("increment"), - DECREMENT: PatternFlowEthernetPauseDstChoiceEnum("decrement"), -} - -func (obj *patternFlowEthernetPauseDst) Choice() PatternFlowEthernetPauseDstChoiceEnum { - return PatternFlowEthernetPauseDstChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowEthernetPauseDst) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowEthernetPauseDst) setChoice(value PatternFlowEthernetPauseDstChoiceEnum) PatternFlowEthernetPauseDst { - intValue, ok := otg.PatternFlowEthernetPauseDst_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowEthernetPauseDstChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowEthernetPauseDst_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowEthernetPauseDstChoice.VALUE { - defaultValue := "01:80:c2:00:00:01" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowEthernetPauseDstChoice.VALUES { - defaultValue := []string{"01:80:c2:00:00:01"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowEthernetPauseDstChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowEthernetPauseDstCounter().msg() - } - - if value == PatternFlowEthernetPauseDstChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowEthernetPauseDstCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowEthernetPauseDst) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowEthernetPauseDstChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowEthernetPauseDst) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowEthernetPauseDst object -func (obj *patternFlowEthernetPauseDst) SetValue(value string) PatternFlowEthernetPauseDst { - obj.setChoice(PatternFlowEthernetPauseDstChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowEthernetPauseDst) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"01:80:c2:00:00:01"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowEthernetPauseDst object -func (obj *patternFlowEthernetPauseDst) SetValues(value []string) PatternFlowEthernetPauseDst { - obj.setChoice(PatternFlowEthernetPauseDstChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowEthernetPauseDstCounter -func (obj *patternFlowEthernetPauseDst) Increment() PatternFlowEthernetPauseDstCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowEthernetPauseDstChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowEthernetPauseDstCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowEthernetPauseDstCounter -func (obj *patternFlowEthernetPauseDst) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowEthernetPauseDstCounter value in the PatternFlowEthernetPauseDst object -func (obj *patternFlowEthernetPauseDst) SetIncrement(value PatternFlowEthernetPauseDstCounter) PatternFlowEthernetPauseDst { - obj.setChoice(PatternFlowEthernetPauseDstChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowEthernetPauseDstCounter -func (obj *patternFlowEthernetPauseDst) Decrement() PatternFlowEthernetPauseDstCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowEthernetPauseDstChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowEthernetPauseDstCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowEthernetPauseDstCounter -func (obj *patternFlowEthernetPauseDst) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowEthernetPauseDstCounter value in the PatternFlowEthernetPauseDst object -func (obj *patternFlowEthernetPauseDst) SetDecrement(value PatternFlowEthernetPauseDstCounter) PatternFlowEthernetPauseDst { - obj.setChoice(PatternFlowEthernetPauseDstChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowEthernetPauseDstMetricTag -func (obj *patternFlowEthernetPauseDst) MetricTags() PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowEthernetPauseDstMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter struct { - obj *patternFlowEthernetPauseDst - patternFlowEthernetPauseDstMetricTagSlice []PatternFlowEthernetPauseDstMetricTag - fieldPtr *[]*otg.PatternFlowEthernetPauseDstMetricTag -} - -func newPatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter(ptr *[]*otg.PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { - return &patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter interface { - setMsg(*patternFlowEthernetPauseDst) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter - Items() []PatternFlowEthernetPauseDstMetricTag - Add() PatternFlowEthernetPauseDstMetricTag - Append(items ...PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter - Set(index int, newObj PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter - Clear() PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter - clearHolderSlice() PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter - appendHolderSlice(item PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter -} - -func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) setMsg(msg *patternFlowEthernetPauseDst) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowEthernetPauseDstMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) Items() []PatternFlowEthernetPauseDstMetricTag { - return obj.patternFlowEthernetPauseDstMetricTagSlice -} - -func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) Add() PatternFlowEthernetPauseDstMetricTag { - newObj := &otg.PatternFlowEthernetPauseDstMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowEthernetPauseDstMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowEthernetPauseDstMetricTagSlice = append(obj.patternFlowEthernetPauseDstMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) Append(items ...PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowEthernetPauseDstMetricTagSlice = append(obj.patternFlowEthernetPauseDstMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) Set(index int, newObj PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowEthernetPauseDstMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) Clear() PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowEthernetPauseDstMetricTag{} - obj.patternFlowEthernetPauseDstMetricTagSlice = []PatternFlowEthernetPauseDstMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) clearHolderSlice() PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { - if len(obj.patternFlowEthernetPauseDstMetricTagSlice) > 0 { - obj.patternFlowEthernetPauseDstMetricTagSlice = []PatternFlowEthernetPauseDstMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) appendHolderSlice(item PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { - obj.patternFlowEthernetPauseDstMetricTagSlice = append(obj.patternFlowEthernetPauseDstMetricTagSlice, item) - return obj -} - -func (obj *patternFlowEthernetPauseDst) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateMac(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseDst.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateMacSlice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseDst.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowEthernetPauseDstMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowEthernetPauseDst) setDefault() { - var choices_set int = 0 - var choice PatternFlowEthernetPauseDstChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseDstChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowEthernetPauseDstChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseDstChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseDstChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowEthernetPauseDstChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetPauseDst") - } - } else { - intVal := otg.PatternFlowEthernetPauseDst_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowEthernetPauseDst_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowEthernetPauseSrc ***** -type patternFlowEthernetPauseSrc struct { - validation - obj *otg.PatternFlowEthernetPauseSrc - marshaller marshalPatternFlowEthernetPauseSrc - unMarshaller unMarshalPatternFlowEthernetPauseSrc - incrementHolder PatternFlowEthernetPauseSrcCounter - decrementHolder PatternFlowEthernetPauseSrcCounter - metricTagsHolder PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter -} - -func NewPatternFlowEthernetPauseSrc() PatternFlowEthernetPauseSrc { - obj := patternFlowEthernetPauseSrc{obj: &otg.PatternFlowEthernetPauseSrc{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseSrc) msg() *otg.PatternFlowEthernetPauseSrc { - return obj.obj -} - -func (obj *patternFlowEthernetPauseSrc) setMsg(msg *otg.PatternFlowEthernetPauseSrc) PatternFlowEthernetPauseSrc { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseSrc struct { - obj *patternFlowEthernetPauseSrc -} - -type marshalPatternFlowEthernetPauseSrc interface { - // ToProto marshals PatternFlowEthernetPauseSrc to protobuf object *otg.PatternFlowEthernetPauseSrc - ToProto() (*otg.PatternFlowEthernetPauseSrc, error) - // ToPbText marshals PatternFlowEthernetPauseSrc to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseSrc to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseSrc to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseSrc struct { - obj *patternFlowEthernetPauseSrc -} - -type unMarshalPatternFlowEthernetPauseSrc interface { - // FromProto unmarshals PatternFlowEthernetPauseSrc from protobuf object *otg.PatternFlowEthernetPauseSrc - FromProto(msg *otg.PatternFlowEthernetPauseSrc) (PatternFlowEthernetPauseSrc, error) - // FromPbText unmarshals PatternFlowEthernetPauseSrc from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseSrc from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseSrc from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseSrc) Marshal() marshalPatternFlowEthernetPauseSrc { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseSrc{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseSrc) Unmarshal() unMarshalPatternFlowEthernetPauseSrc { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseSrc{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseSrc) ToProto() (*otg.PatternFlowEthernetPauseSrc, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseSrc) FromProto(msg *otg.PatternFlowEthernetPauseSrc) (PatternFlowEthernetPauseSrc, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseSrc) 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 *unMarshalpatternFlowEthernetPauseSrc) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowEthernetPauseSrc) 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 *unMarshalpatternFlowEthernetPauseSrc) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowEthernetPauseSrc) 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 *unMarshalpatternFlowEthernetPauseSrc) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowEthernetPauseSrc) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseSrc) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseSrc) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseSrc) Clone() (PatternFlowEthernetPauseSrc, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseSrc() - 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 -} - -func (obj *patternFlowEthernetPauseSrc) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowEthernetPauseSrc is source MAC address -type PatternFlowEthernetPauseSrc interface { - Validation - // msg marshals PatternFlowEthernetPauseSrc to protobuf object *otg.PatternFlowEthernetPauseSrc - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseSrc - // setMsg unmarshals PatternFlowEthernetPauseSrc from protobuf object *otg.PatternFlowEthernetPauseSrc - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseSrc) PatternFlowEthernetPauseSrc - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseSrc - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseSrc - // validate validates PatternFlowEthernetPauseSrc - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseSrc, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowEthernetPauseSrcChoiceEnum, set in PatternFlowEthernetPauseSrc - Choice() PatternFlowEthernetPauseSrcChoiceEnum - // setChoice assigns PatternFlowEthernetPauseSrcChoiceEnum provided by user to PatternFlowEthernetPauseSrc - setChoice(value PatternFlowEthernetPauseSrcChoiceEnum) PatternFlowEthernetPauseSrc - // HasChoice checks if Choice has been set in PatternFlowEthernetPauseSrc - HasChoice() bool - // Value returns string, set in PatternFlowEthernetPauseSrc. - Value() string - // SetValue assigns string provided by user to PatternFlowEthernetPauseSrc - SetValue(value string) PatternFlowEthernetPauseSrc - // HasValue checks if Value has been set in PatternFlowEthernetPauseSrc - HasValue() bool - // Values returns []string, set in PatternFlowEthernetPauseSrc. - Values() []string - // SetValues assigns []string provided by user to PatternFlowEthernetPauseSrc - SetValues(value []string) PatternFlowEthernetPauseSrc - // Increment returns PatternFlowEthernetPauseSrcCounter, set in PatternFlowEthernetPauseSrc. - // PatternFlowEthernetPauseSrcCounter is mac counter pattern - Increment() PatternFlowEthernetPauseSrcCounter - // SetIncrement assigns PatternFlowEthernetPauseSrcCounter provided by user to PatternFlowEthernetPauseSrc. - // PatternFlowEthernetPauseSrcCounter is mac counter pattern - SetIncrement(value PatternFlowEthernetPauseSrcCounter) PatternFlowEthernetPauseSrc - // HasIncrement checks if Increment has been set in PatternFlowEthernetPauseSrc - HasIncrement() bool - // Decrement returns PatternFlowEthernetPauseSrcCounter, set in PatternFlowEthernetPauseSrc. - // PatternFlowEthernetPauseSrcCounter is mac counter pattern - Decrement() PatternFlowEthernetPauseSrcCounter - // SetDecrement assigns PatternFlowEthernetPauseSrcCounter provided by user to PatternFlowEthernetPauseSrc. - // PatternFlowEthernetPauseSrcCounter is mac counter pattern - SetDecrement(value PatternFlowEthernetPauseSrcCounter) PatternFlowEthernetPauseSrc - // HasDecrement checks if Decrement has been set in PatternFlowEthernetPauseSrc - HasDecrement() bool - // MetricTags returns PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIterIter, set in PatternFlowEthernetPauseSrc - MetricTags() PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter - setNil() -} - -type PatternFlowEthernetPauseSrcChoiceEnum string - -// Enum of Choice on PatternFlowEthernetPauseSrc -var PatternFlowEthernetPauseSrcChoice = struct { - VALUE PatternFlowEthernetPauseSrcChoiceEnum - VALUES PatternFlowEthernetPauseSrcChoiceEnum - INCREMENT PatternFlowEthernetPauseSrcChoiceEnum - DECREMENT PatternFlowEthernetPauseSrcChoiceEnum -}{ - VALUE: PatternFlowEthernetPauseSrcChoiceEnum("value"), - VALUES: PatternFlowEthernetPauseSrcChoiceEnum("values"), - INCREMENT: PatternFlowEthernetPauseSrcChoiceEnum("increment"), - DECREMENT: PatternFlowEthernetPauseSrcChoiceEnum("decrement"), -} - -func (obj *patternFlowEthernetPauseSrc) Choice() PatternFlowEthernetPauseSrcChoiceEnum { - return PatternFlowEthernetPauseSrcChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowEthernetPauseSrc) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowEthernetPauseSrc) setChoice(value PatternFlowEthernetPauseSrcChoiceEnum) PatternFlowEthernetPauseSrc { - intValue, ok := otg.PatternFlowEthernetPauseSrc_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowEthernetPauseSrcChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowEthernetPauseSrc_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowEthernetPauseSrcChoice.VALUE { - defaultValue := "00:00:00:00:00:00" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowEthernetPauseSrcChoice.VALUES { - defaultValue := []string{"00:00:00:00:00:00"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowEthernetPauseSrcChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowEthernetPauseSrcCounter().msg() - } - - if value == PatternFlowEthernetPauseSrcChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowEthernetPauseSrcCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowEthernetPauseSrc) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowEthernetPauseSrcChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowEthernetPauseSrc) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowEthernetPauseSrc object -func (obj *patternFlowEthernetPauseSrc) SetValue(value string) PatternFlowEthernetPauseSrc { - obj.setChoice(PatternFlowEthernetPauseSrcChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowEthernetPauseSrc) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"00:00:00:00:00:00"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowEthernetPauseSrc object -func (obj *patternFlowEthernetPauseSrc) SetValues(value []string) PatternFlowEthernetPauseSrc { - obj.setChoice(PatternFlowEthernetPauseSrcChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowEthernetPauseSrcCounter -func (obj *patternFlowEthernetPauseSrc) Increment() PatternFlowEthernetPauseSrcCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowEthernetPauseSrcChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowEthernetPauseSrcCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowEthernetPauseSrcCounter -func (obj *patternFlowEthernetPauseSrc) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowEthernetPauseSrcCounter value in the PatternFlowEthernetPauseSrc object -func (obj *patternFlowEthernetPauseSrc) SetIncrement(value PatternFlowEthernetPauseSrcCounter) PatternFlowEthernetPauseSrc { - obj.setChoice(PatternFlowEthernetPauseSrcChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowEthernetPauseSrcCounter -func (obj *patternFlowEthernetPauseSrc) Decrement() PatternFlowEthernetPauseSrcCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowEthernetPauseSrcChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowEthernetPauseSrcCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowEthernetPauseSrcCounter -func (obj *patternFlowEthernetPauseSrc) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowEthernetPauseSrcCounter value in the PatternFlowEthernetPauseSrc object -func (obj *patternFlowEthernetPauseSrc) SetDecrement(value PatternFlowEthernetPauseSrcCounter) PatternFlowEthernetPauseSrc { - obj.setChoice(PatternFlowEthernetPauseSrcChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowEthernetPauseSrcMetricTag -func (obj *patternFlowEthernetPauseSrc) MetricTags() PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowEthernetPauseSrcMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter struct { - obj *patternFlowEthernetPauseSrc - patternFlowEthernetPauseSrcMetricTagSlice []PatternFlowEthernetPauseSrcMetricTag - fieldPtr *[]*otg.PatternFlowEthernetPauseSrcMetricTag -} - -func newPatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter(ptr *[]*otg.PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { - return &patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter interface { - setMsg(*patternFlowEthernetPauseSrc) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter - Items() []PatternFlowEthernetPauseSrcMetricTag - Add() PatternFlowEthernetPauseSrcMetricTag - Append(items ...PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter - Set(index int, newObj PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter - Clear() PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter - clearHolderSlice() PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter - appendHolderSlice(item PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter -} - -func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) setMsg(msg *patternFlowEthernetPauseSrc) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowEthernetPauseSrcMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) Items() []PatternFlowEthernetPauseSrcMetricTag { - return obj.patternFlowEthernetPauseSrcMetricTagSlice -} - -func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) Add() PatternFlowEthernetPauseSrcMetricTag { - newObj := &otg.PatternFlowEthernetPauseSrcMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowEthernetPauseSrcMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowEthernetPauseSrcMetricTagSlice = append(obj.patternFlowEthernetPauseSrcMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) Append(items ...PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowEthernetPauseSrcMetricTagSlice = append(obj.patternFlowEthernetPauseSrcMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) Set(index int, newObj PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowEthernetPauseSrcMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) Clear() PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowEthernetPauseSrcMetricTag{} - obj.patternFlowEthernetPauseSrcMetricTagSlice = []PatternFlowEthernetPauseSrcMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) clearHolderSlice() PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { - if len(obj.patternFlowEthernetPauseSrcMetricTagSlice) > 0 { - obj.patternFlowEthernetPauseSrcMetricTagSlice = []PatternFlowEthernetPauseSrcMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) appendHolderSlice(item PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { - obj.patternFlowEthernetPauseSrcMetricTagSlice = append(obj.patternFlowEthernetPauseSrcMetricTagSlice, item) - return obj -} - -func (obj *patternFlowEthernetPauseSrc) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateMac(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseSrc.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateMacSlice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseSrc.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowEthernetPauseSrcMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowEthernetPauseSrc) setDefault() { - var choices_set int = 0 - var choice PatternFlowEthernetPauseSrcChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseSrcChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowEthernetPauseSrcChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseSrcChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseSrcChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowEthernetPauseSrcChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetPauseSrc") - } - } else { - intVal := otg.PatternFlowEthernetPauseSrc_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowEthernetPauseSrc_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowEthernetPauseEtherType ***** -type patternFlowEthernetPauseEtherType struct { - validation - obj *otg.PatternFlowEthernetPauseEtherType - marshaller marshalPatternFlowEthernetPauseEtherType - unMarshaller unMarshalPatternFlowEthernetPauseEtherType - incrementHolder PatternFlowEthernetPauseEtherTypeCounter - decrementHolder PatternFlowEthernetPauseEtherTypeCounter - metricTagsHolder PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter -} - -func NewPatternFlowEthernetPauseEtherType() PatternFlowEthernetPauseEtherType { - obj := patternFlowEthernetPauseEtherType{obj: &otg.PatternFlowEthernetPauseEtherType{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseEtherType) msg() *otg.PatternFlowEthernetPauseEtherType { - return obj.obj -} - -func (obj *patternFlowEthernetPauseEtherType) setMsg(msg *otg.PatternFlowEthernetPauseEtherType) PatternFlowEthernetPauseEtherType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseEtherType struct { - obj *patternFlowEthernetPauseEtherType -} - -type marshalPatternFlowEthernetPauseEtherType interface { - // ToProto marshals PatternFlowEthernetPauseEtherType to protobuf object *otg.PatternFlowEthernetPauseEtherType - ToProto() (*otg.PatternFlowEthernetPauseEtherType, error) - // ToPbText marshals PatternFlowEthernetPauseEtherType to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseEtherType to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseEtherType to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseEtherType struct { - obj *patternFlowEthernetPauseEtherType -} - -type unMarshalPatternFlowEthernetPauseEtherType interface { - // FromProto unmarshals PatternFlowEthernetPauseEtherType from protobuf object *otg.PatternFlowEthernetPauseEtherType - FromProto(msg *otg.PatternFlowEthernetPauseEtherType) (PatternFlowEthernetPauseEtherType, error) - // FromPbText unmarshals PatternFlowEthernetPauseEtherType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseEtherType from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseEtherType from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseEtherType) Marshal() marshalPatternFlowEthernetPauseEtherType { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseEtherType{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseEtherType) Unmarshal() unMarshalPatternFlowEthernetPauseEtherType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseEtherType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseEtherType) ToProto() (*otg.PatternFlowEthernetPauseEtherType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseEtherType) FromProto(msg *otg.PatternFlowEthernetPauseEtherType) (PatternFlowEthernetPauseEtherType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseEtherType) 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 *unMarshalpatternFlowEthernetPauseEtherType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowEthernetPauseEtherType) 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 *unMarshalpatternFlowEthernetPauseEtherType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowEthernetPauseEtherType) 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 *unMarshalpatternFlowEthernetPauseEtherType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowEthernetPauseEtherType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseEtherType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseEtherType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseEtherType) Clone() (PatternFlowEthernetPauseEtherType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseEtherType() - 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 -} - -func (obj *patternFlowEthernetPauseEtherType) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowEthernetPauseEtherType is ethernet type -type PatternFlowEthernetPauseEtherType interface { - Validation - // msg marshals PatternFlowEthernetPauseEtherType to protobuf object *otg.PatternFlowEthernetPauseEtherType - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseEtherType - // setMsg unmarshals PatternFlowEthernetPauseEtherType from protobuf object *otg.PatternFlowEthernetPauseEtherType - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseEtherType) PatternFlowEthernetPauseEtherType - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseEtherType - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseEtherType - // validate validates PatternFlowEthernetPauseEtherType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseEtherType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowEthernetPauseEtherTypeChoiceEnum, set in PatternFlowEthernetPauseEtherType - Choice() PatternFlowEthernetPauseEtherTypeChoiceEnum - // setChoice assigns PatternFlowEthernetPauseEtherTypeChoiceEnum provided by user to PatternFlowEthernetPauseEtherType - setChoice(value PatternFlowEthernetPauseEtherTypeChoiceEnum) PatternFlowEthernetPauseEtherType - // HasChoice checks if Choice has been set in PatternFlowEthernetPauseEtherType - HasChoice() bool - // Value returns uint32, set in PatternFlowEthernetPauseEtherType. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowEthernetPauseEtherType - SetValue(value uint32) PatternFlowEthernetPauseEtherType - // HasValue checks if Value has been set in PatternFlowEthernetPauseEtherType - HasValue() bool - // Values returns []uint32, set in PatternFlowEthernetPauseEtherType. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowEthernetPauseEtherType - SetValues(value []uint32) PatternFlowEthernetPauseEtherType - // Increment returns PatternFlowEthernetPauseEtherTypeCounter, set in PatternFlowEthernetPauseEtherType. - // PatternFlowEthernetPauseEtherTypeCounter is integer counter pattern - Increment() PatternFlowEthernetPauseEtherTypeCounter - // SetIncrement assigns PatternFlowEthernetPauseEtherTypeCounter provided by user to PatternFlowEthernetPauseEtherType. - // PatternFlowEthernetPauseEtherTypeCounter is integer counter pattern - SetIncrement(value PatternFlowEthernetPauseEtherTypeCounter) PatternFlowEthernetPauseEtherType - // HasIncrement checks if Increment has been set in PatternFlowEthernetPauseEtherType - HasIncrement() bool - // Decrement returns PatternFlowEthernetPauseEtherTypeCounter, set in PatternFlowEthernetPauseEtherType. - // PatternFlowEthernetPauseEtherTypeCounter is integer counter pattern - Decrement() PatternFlowEthernetPauseEtherTypeCounter - // SetDecrement assigns PatternFlowEthernetPauseEtherTypeCounter provided by user to PatternFlowEthernetPauseEtherType. - // PatternFlowEthernetPauseEtherTypeCounter is integer counter pattern - SetDecrement(value PatternFlowEthernetPauseEtherTypeCounter) PatternFlowEthernetPauseEtherType - // HasDecrement checks if Decrement has been set in PatternFlowEthernetPauseEtherType - HasDecrement() bool - // MetricTags returns PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIterIter, set in PatternFlowEthernetPauseEtherType - MetricTags() PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter - setNil() -} - -type PatternFlowEthernetPauseEtherTypeChoiceEnum string - -// Enum of Choice on PatternFlowEthernetPauseEtherType -var PatternFlowEthernetPauseEtherTypeChoice = struct { - VALUE PatternFlowEthernetPauseEtherTypeChoiceEnum - VALUES PatternFlowEthernetPauseEtherTypeChoiceEnum - INCREMENT PatternFlowEthernetPauseEtherTypeChoiceEnum - DECREMENT PatternFlowEthernetPauseEtherTypeChoiceEnum -}{ - VALUE: PatternFlowEthernetPauseEtherTypeChoiceEnum("value"), - VALUES: PatternFlowEthernetPauseEtherTypeChoiceEnum("values"), - INCREMENT: PatternFlowEthernetPauseEtherTypeChoiceEnum("increment"), - DECREMENT: PatternFlowEthernetPauseEtherTypeChoiceEnum("decrement"), -} - -func (obj *patternFlowEthernetPauseEtherType) Choice() PatternFlowEthernetPauseEtherTypeChoiceEnum { - return PatternFlowEthernetPauseEtherTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowEthernetPauseEtherType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowEthernetPauseEtherType) setChoice(value PatternFlowEthernetPauseEtherTypeChoiceEnum) PatternFlowEthernetPauseEtherType { - intValue, ok := otg.PatternFlowEthernetPauseEtherType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowEthernetPauseEtherTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowEthernetPauseEtherType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowEthernetPauseEtherTypeChoice.VALUE { - defaultValue := uint32(34824) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowEthernetPauseEtherTypeChoice.VALUES { - defaultValue := []uint32{34824} - obj.obj.Values = defaultValue - } - - if value == PatternFlowEthernetPauseEtherTypeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowEthernetPauseEtherTypeCounter().msg() - } - - if value == PatternFlowEthernetPauseEtherTypeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowEthernetPauseEtherTypeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowEthernetPauseEtherType) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowEthernetPauseEtherType) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowEthernetPauseEtherType object -func (obj *patternFlowEthernetPauseEtherType) SetValue(value uint32) PatternFlowEthernetPauseEtherType { - obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowEthernetPauseEtherType) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{34824}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowEthernetPauseEtherType object -func (obj *patternFlowEthernetPauseEtherType) SetValues(value []uint32) PatternFlowEthernetPauseEtherType { - obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowEthernetPauseEtherTypeCounter -func (obj *patternFlowEthernetPauseEtherType) Increment() PatternFlowEthernetPauseEtherTypeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowEthernetPauseEtherTypeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowEthernetPauseEtherTypeCounter -func (obj *patternFlowEthernetPauseEtherType) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowEthernetPauseEtherTypeCounter value in the PatternFlowEthernetPauseEtherType object -func (obj *patternFlowEthernetPauseEtherType) SetIncrement(value PatternFlowEthernetPauseEtherTypeCounter) PatternFlowEthernetPauseEtherType { - obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowEthernetPauseEtherTypeCounter -func (obj *patternFlowEthernetPauseEtherType) Decrement() PatternFlowEthernetPauseEtherTypeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowEthernetPauseEtherTypeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowEthernetPauseEtherTypeCounter -func (obj *patternFlowEthernetPauseEtherType) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowEthernetPauseEtherTypeCounter value in the PatternFlowEthernetPauseEtherType object -func (obj *patternFlowEthernetPauseEtherType) SetDecrement(value PatternFlowEthernetPauseEtherTypeCounter) PatternFlowEthernetPauseEtherType { - obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowEthernetPauseEtherTypeMetricTag -func (obj *patternFlowEthernetPauseEtherType) MetricTags() PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowEthernetPauseEtherTypeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter struct { - obj *patternFlowEthernetPauseEtherType - patternFlowEthernetPauseEtherTypeMetricTagSlice []PatternFlowEthernetPauseEtherTypeMetricTag - fieldPtr *[]*otg.PatternFlowEthernetPauseEtherTypeMetricTag -} - -func newPatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter(ptr *[]*otg.PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { - return &patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter interface { - setMsg(*patternFlowEthernetPauseEtherType) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter - Items() []PatternFlowEthernetPauseEtherTypeMetricTag - Add() PatternFlowEthernetPauseEtherTypeMetricTag - Append(items ...PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter - Set(index int, newObj PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter - Clear() PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter - clearHolderSlice() PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter - appendHolderSlice(item PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter -} - -func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) setMsg(msg *patternFlowEthernetPauseEtherType) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowEthernetPauseEtherTypeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) Items() []PatternFlowEthernetPauseEtherTypeMetricTag { - return obj.patternFlowEthernetPauseEtherTypeMetricTagSlice -} - -func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) Add() PatternFlowEthernetPauseEtherTypeMetricTag { - newObj := &otg.PatternFlowEthernetPauseEtherTypeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowEthernetPauseEtherTypeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowEthernetPauseEtherTypeMetricTagSlice = append(obj.patternFlowEthernetPauseEtherTypeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) Append(items ...PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowEthernetPauseEtherTypeMetricTagSlice = append(obj.patternFlowEthernetPauseEtherTypeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) Set(index int, newObj PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowEthernetPauseEtherTypeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) Clear() PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowEthernetPauseEtherTypeMetricTag{} - obj.patternFlowEthernetPauseEtherTypeMetricTagSlice = []PatternFlowEthernetPauseEtherTypeMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) clearHolderSlice() PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { - if len(obj.patternFlowEthernetPauseEtherTypeMetricTagSlice) > 0 { - obj.patternFlowEthernetPauseEtherTypeMetricTagSlice = []PatternFlowEthernetPauseEtherTypeMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) appendHolderSlice(item PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { - obj.patternFlowEthernetPauseEtherTypeMetricTagSlice = append(obj.patternFlowEthernetPauseEtherTypeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowEthernetPauseEtherType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseEtherType.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowEthernetPauseEtherType.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowEthernetPauseEtherTypeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowEthernetPauseEtherType) setDefault() { - var choices_set int = 0 - var choice PatternFlowEthernetPauseEtherTypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseEtherTypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowEthernetPauseEtherTypeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseEtherTypeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseEtherTypeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetPauseEtherType") - } - } else { - intVal := otg.PatternFlowEthernetPauseEtherType_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowEthernetPauseEtherType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowEthernetPauseControlOpCode ***** -type patternFlowEthernetPauseControlOpCode struct { - validation - obj *otg.PatternFlowEthernetPauseControlOpCode - marshaller marshalPatternFlowEthernetPauseControlOpCode - unMarshaller unMarshalPatternFlowEthernetPauseControlOpCode - incrementHolder PatternFlowEthernetPauseControlOpCodeCounter - decrementHolder PatternFlowEthernetPauseControlOpCodeCounter - metricTagsHolder PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter -} - -func NewPatternFlowEthernetPauseControlOpCode() PatternFlowEthernetPauseControlOpCode { - obj := patternFlowEthernetPauseControlOpCode{obj: &otg.PatternFlowEthernetPauseControlOpCode{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseControlOpCode) msg() *otg.PatternFlowEthernetPauseControlOpCode { - return obj.obj -} - -func (obj *patternFlowEthernetPauseControlOpCode) setMsg(msg *otg.PatternFlowEthernetPauseControlOpCode) PatternFlowEthernetPauseControlOpCode { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseControlOpCode struct { - obj *patternFlowEthernetPauseControlOpCode -} - -type marshalPatternFlowEthernetPauseControlOpCode interface { - // ToProto marshals PatternFlowEthernetPauseControlOpCode to protobuf object *otg.PatternFlowEthernetPauseControlOpCode - ToProto() (*otg.PatternFlowEthernetPauseControlOpCode, error) - // ToPbText marshals PatternFlowEthernetPauseControlOpCode to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseControlOpCode to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseControlOpCode to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseControlOpCode struct { - obj *patternFlowEthernetPauseControlOpCode -} - -type unMarshalPatternFlowEthernetPauseControlOpCode interface { - // FromProto unmarshals PatternFlowEthernetPauseControlOpCode from protobuf object *otg.PatternFlowEthernetPauseControlOpCode - FromProto(msg *otg.PatternFlowEthernetPauseControlOpCode) (PatternFlowEthernetPauseControlOpCode, error) - // FromPbText unmarshals PatternFlowEthernetPauseControlOpCode from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseControlOpCode from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseControlOpCode from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseControlOpCode) Marshal() marshalPatternFlowEthernetPauseControlOpCode { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseControlOpCode{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseControlOpCode) Unmarshal() unMarshalPatternFlowEthernetPauseControlOpCode { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseControlOpCode{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseControlOpCode) ToProto() (*otg.PatternFlowEthernetPauseControlOpCode, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseControlOpCode) FromProto(msg *otg.PatternFlowEthernetPauseControlOpCode) (PatternFlowEthernetPauseControlOpCode, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseControlOpCode) 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 *unMarshalpatternFlowEthernetPauseControlOpCode) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowEthernetPauseControlOpCode) 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 *unMarshalpatternFlowEthernetPauseControlOpCode) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowEthernetPauseControlOpCode) 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 *unMarshalpatternFlowEthernetPauseControlOpCode) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowEthernetPauseControlOpCode) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseControlOpCode) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseControlOpCode) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseControlOpCode) Clone() (PatternFlowEthernetPauseControlOpCode, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseControlOpCode() - 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 -} - -func (obj *patternFlowEthernetPauseControlOpCode) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowEthernetPauseControlOpCode is control operation code -type PatternFlowEthernetPauseControlOpCode interface { - Validation - // msg marshals PatternFlowEthernetPauseControlOpCode to protobuf object *otg.PatternFlowEthernetPauseControlOpCode - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseControlOpCode - // setMsg unmarshals PatternFlowEthernetPauseControlOpCode from protobuf object *otg.PatternFlowEthernetPauseControlOpCode - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseControlOpCode) PatternFlowEthernetPauseControlOpCode - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseControlOpCode - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseControlOpCode - // validate validates PatternFlowEthernetPauseControlOpCode - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseControlOpCode, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowEthernetPauseControlOpCodeChoiceEnum, set in PatternFlowEthernetPauseControlOpCode - Choice() PatternFlowEthernetPauseControlOpCodeChoiceEnum - // setChoice assigns PatternFlowEthernetPauseControlOpCodeChoiceEnum provided by user to PatternFlowEthernetPauseControlOpCode - setChoice(value PatternFlowEthernetPauseControlOpCodeChoiceEnum) PatternFlowEthernetPauseControlOpCode - // HasChoice checks if Choice has been set in PatternFlowEthernetPauseControlOpCode - HasChoice() bool - // Value returns uint32, set in PatternFlowEthernetPauseControlOpCode. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowEthernetPauseControlOpCode - SetValue(value uint32) PatternFlowEthernetPauseControlOpCode - // HasValue checks if Value has been set in PatternFlowEthernetPauseControlOpCode - HasValue() bool - // Values returns []uint32, set in PatternFlowEthernetPauseControlOpCode. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowEthernetPauseControlOpCode - SetValues(value []uint32) PatternFlowEthernetPauseControlOpCode - // Increment returns PatternFlowEthernetPauseControlOpCodeCounter, set in PatternFlowEthernetPauseControlOpCode. - // PatternFlowEthernetPauseControlOpCodeCounter is integer counter pattern - Increment() PatternFlowEthernetPauseControlOpCodeCounter - // SetIncrement assigns PatternFlowEthernetPauseControlOpCodeCounter provided by user to PatternFlowEthernetPauseControlOpCode. - // PatternFlowEthernetPauseControlOpCodeCounter is integer counter pattern - SetIncrement(value PatternFlowEthernetPauseControlOpCodeCounter) PatternFlowEthernetPauseControlOpCode - // HasIncrement checks if Increment has been set in PatternFlowEthernetPauseControlOpCode - HasIncrement() bool - // Decrement returns PatternFlowEthernetPauseControlOpCodeCounter, set in PatternFlowEthernetPauseControlOpCode. - // PatternFlowEthernetPauseControlOpCodeCounter is integer counter pattern - Decrement() PatternFlowEthernetPauseControlOpCodeCounter - // SetDecrement assigns PatternFlowEthernetPauseControlOpCodeCounter provided by user to PatternFlowEthernetPauseControlOpCode. - // PatternFlowEthernetPauseControlOpCodeCounter is integer counter pattern - SetDecrement(value PatternFlowEthernetPauseControlOpCodeCounter) PatternFlowEthernetPauseControlOpCode - // HasDecrement checks if Decrement has been set in PatternFlowEthernetPauseControlOpCode - HasDecrement() bool - // MetricTags returns PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIterIter, set in PatternFlowEthernetPauseControlOpCode - MetricTags() PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter - setNil() -} - -type PatternFlowEthernetPauseControlOpCodeChoiceEnum string - -// Enum of Choice on PatternFlowEthernetPauseControlOpCode -var PatternFlowEthernetPauseControlOpCodeChoice = struct { - VALUE PatternFlowEthernetPauseControlOpCodeChoiceEnum - VALUES PatternFlowEthernetPauseControlOpCodeChoiceEnum - INCREMENT PatternFlowEthernetPauseControlOpCodeChoiceEnum - DECREMENT PatternFlowEthernetPauseControlOpCodeChoiceEnum -}{ - VALUE: PatternFlowEthernetPauseControlOpCodeChoiceEnum("value"), - VALUES: PatternFlowEthernetPauseControlOpCodeChoiceEnum("values"), - INCREMENT: PatternFlowEthernetPauseControlOpCodeChoiceEnum("increment"), - DECREMENT: PatternFlowEthernetPauseControlOpCodeChoiceEnum("decrement"), -} - -func (obj *patternFlowEthernetPauseControlOpCode) Choice() PatternFlowEthernetPauseControlOpCodeChoiceEnum { - return PatternFlowEthernetPauseControlOpCodeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowEthernetPauseControlOpCode) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowEthernetPauseControlOpCode) setChoice(value PatternFlowEthernetPauseControlOpCodeChoiceEnum) PatternFlowEthernetPauseControlOpCode { - intValue, ok := otg.PatternFlowEthernetPauseControlOpCode_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowEthernetPauseControlOpCodeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowEthernetPauseControlOpCode_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowEthernetPauseControlOpCodeChoice.VALUE { - defaultValue := uint32(1) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowEthernetPauseControlOpCodeChoice.VALUES { - defaultValue := []uint32{1} - obj.obj.Values = defaultValue - } - - if value == PatternFlowEthernetPauseControlOpCodeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowEthernetPauseControlOpCodeCounter().msg() - } - - if value == PatternFlowEthernetPauseControlOpCodeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowEthernetPauseControlOpCodeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowEthernetPauseControlOpCode) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowEthernetPauseControlOpCode) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowEthernetPauseControlOpCode object -func (obj *patternFlowEthernetPauseControlOpCode) SetValue(value uint32) PatternFlowEthernetPauseControlOpCode { - obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowEthernetPauseControlOpCode) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{1}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowEthernetPauseControlOpCode object -func (obj *patternFlowEthernetPauseControlOpCode) SetValues(value []uint32) PatternFlowEthernetPauseControlOpCode { - obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowEthernetPauseControlOpCodeCounter -func (obj *patternFlowEthernetPauseControlOpCode) Increment() PatternFlowEthernetPauseControlOpCodeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowEthernetPauseControlOpCodeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowEthernetPauseControlOpCodeCounter -func (obj *patternFlowEthernetPauseControlOpCode) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowEthernetPauseControlOpCodeCounter value in the PatternFlowEthernetPauseControlOpCode object -func (obj *patternFlowEthernetPauseControlOpCode) SetIncrement(value PatternFlowEthernetPauseControlOpCodeCounter) PatternFlowEthernetPauseControlOpCode { - obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowEthernetPauseControlOpCodeCounter -func (obj *patternFlowEthernetPauseControlOpCode) Decrement() PatternFlowEthernetPauseControlOpCodeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowEthernetPauseControlOpCodeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowEthernetPauseControlOpCodeCounter -func (obj *patternFlowEthernetPauseControlOpCode) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowEthernetPauseControlOpCodeCounter value in the PatternFlowEthernetPauseControlOpCode object -func (obj *patternFlowEthernetPauseControlOpCode) SetDecrement(value PatternFlowEthernetPauseControlOpCodeCounter) PatternFlowEthernetPauseControlOpCode { - obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowEthernetPauseControlOpCodeMetricTag -func (obj *patternFlowEthernetPauseControlOpCode) MetricTags() PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowEthernetPauseControlOpCodeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter struct { - obj *patternFlowEthernetPauseControlOpCode - patternFlowEthernetPauseControlOpCodeMetricTagSlice []PatternFlowEthernetPauseControlOpCodeMetricTag - fieldPtr *[]*otg.PatternFlowEthernetPauseControlOpCodeMetricTag -} - -func newPatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter(ptr *[]*otg.PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { - return &patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter interface { - setMsg(*patternFlowEthernetPauseControlOpCode) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter - Items() []PatternFlowEthernetPauseControlOpCodeMetricTag - Add() PatternFlowEthernetPauseControlOpCodeMetricTag - Append(items ...PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter - Set(index int, newObj PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter - Clear() PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter - clearHolderSlice() PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter - appendHolderSlice(item PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter -} - -func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) setMsg(msg *patternFlowEthernetPauseControlOpCode) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowEthernetPauseControlOpCodeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) Items() []PatternFlowEthernetPauseControlOpCodeMetricTag { - return obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice -} - -func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) Add() PatternFlowEthernetPauseControlOpCodeMetricTag { - newObj := &otg.PatternFlowEthernetPauseControlOpCodeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowEthernetPauseControlOpCodeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice = append(obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) Append(items ...PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice = append(obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) Set(index int, newObj PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) Clear() PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowEthernetPauseControlOpCodeMetricTag{} - obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice = []PatternFlowEthernetPauseControlOpCodeMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) clearHolderSlice() PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { - if len(obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice) > 0 { - obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice = []PatternFlowEthernetPauseControlOpCodeMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) appendHolderSlice(item PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { - obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice = append(obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowEthernetPauseControlOpCode) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseControlOpCode.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowEthernetPauseControlOpCode.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowEthernetPauseControlOpCodeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowEthernetPauseControlOpCode) setDefault() { - var choices_set int = 0 - var choice PatternFlowEthernetPauseControlOpCodeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseControlOpCodeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowEthernetPauseControlOpCodeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseControlOpCodeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseControlOpCodeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetPauseControlOpCode") - } - } else { - intVal := otg.PatternFlowEthernetPauseControlOpCode_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowEthernetPauseControlOpCode_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowEthernetPauseTime ***** -type patternFlowEthernetPauseTime struct { - validation - obj *otg.PatternFlowEthernetPauseTime - marshaller marshalPatternFlowEthernetPauseTime - unMarshaller unMarshalPatternFlowEthernetPauseTime - incrementHolder PatternFlowEthernetPauseTimeCounter - decrementHolder PatternFlowEthernetPauseTimeCounter - metricTagsHolder PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter -} - -func NewPatternFlowEthernetPauseTime() PatternFlowEthernetPauseTime { - obj := patternFlowEthernetPauseTime{obj: &otg.PatternFlowEthernetPauseTime{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseTime) msg() *otg.PatternFlowEthernetPauseTime { - return obj.obj -} - -func (obj *patternFlowEthernetPauseTime) setMsg(msg *otg.PatternFlowEthernetPauseTime) PatternFlowEthernetPauseTime { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseTime struct { - obj *patternFlowEthernetPauseTime -} - -type marshalPatternFlowEthernetPauseTime interface { - // ToProto marshals PatternFlowEthernetPauseTime to protobuf object *otg.PatternFlowEthernetPauseTime - ToProto() (*otg.PatternFlowEthernetPauseTime, error) - // ToPbText marshals PatternFlowEthernetPauseTime to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseTime to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseTime to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseTime struct { - obj *patternFlowEthernetPauseTime -} - -type unMarshalPatternFlowEthernetPauseTime interface { - // FromProto unmarshals PatternFlowEthernetPauseTime from protobuf object *otg.PatternFlowEthernetPauseTime - FromProto(msg *otg.PatternFlowEthernetPauseTime) (PatternFlowEthernetPauseTime, error) - // FromPbText unmarshals PatternFlowEthernetPauseTime from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseTime from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseTime from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseTime) Marshal() marshalPatternFlowEthernetPauseTime { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseTime{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseTime) Unmarshal() unMarshalPatternFlowEthernetPauseTime { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseTime{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseTime) ToProto() (*otg.PatternFlowEthernetPauseTime, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseTime) FromProto(msg *otg.PatternFlowEthernetPauseTime) (PatternFlowEthernetPauseTime, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseTime) 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 *unMarshalpatternFlowEthernetPauseTime) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowEthernetPauseTime) 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 *unMarshalpatternFlowEthernetPauseTime) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowEthernetPauseTime) 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 *unMarshalpatternFlowEthernetPauseTime) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowEthernetPauseTime) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseTime) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseTime) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseTime) Clone() (PatternFlowEthernetPauseTime, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseTime() - 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 -} - -func (obj *patternFlowEthernetPauseTime) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowEthernetPauseTime is time -type PatternFlowEthernetPauseTime interface { - Validation - // msg marshals PatternFlowEthernetPauseTime to protobuf object *otg.PatternFlowEthernetPauseTime - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseTime - // setMsg unmarshals PatternFlowEthernetPauseTime from protobuf object *otg.PatternFlowEthernetPauseTime - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseTime) PatternFlowEthernetPauseTime - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseTime - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseTime - // validate validates PatternFlowEthernetPauseTime - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseTime, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowEthernetPauseTimeChoiceEnum, set in PatternFlowEthernetPauseTime - Choice() PatternFlowEthernetPauseTimeChoiceEnum - // setChoice assigns PatternFlowEthernetPauseTimeChoiceEnum provided by user to PatternFlowEthernetPauseTime - setChoice(value PatternFlowEthernetPauseTimeChoiceEnum) PatternFlowEthernetPauseTime - // HasChoice checks if Choice has been set in PatternFlowEthernetPauseTime - HasChoice() bool - // Value returns uint32, set in PatternFlowEthernetPauseTime. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowEthernetPauseTime - SetValue(value uint32) PatternFlowEthernetPauseTime - // HasValue checks if Value has been set in PatternFlowEthernetPauseTime - HasValue() bool - // Values returns []uint32, set in PatternFlowEthernetPauseTime. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowEthernetPauseTime - SetValues(value []uint32) PatternFlowEthernetPauseTime - // Increment returns PatternFlowEthernetPauseTimeCounter, set in PatternFlowEthernetPauseTime. - // PatternFlowEthernetPauseTimeCounter is integer counter pattern - Increment() PatternFlowEthernetPauseTimeCounter - // SetIncrement assigns PatternFlowEthernetPauseTimeCounter provided by user to PatternFlowEthernetPauseTime. - // PatternFlowEthernetPauseTimeCounter is integer counter pattern - SetIncrement(value PatternFlowEthernetPauseTimeCounter) PatternFlowEthernetPauseTime - // HasIncrement checks if Increment has been set in PatternFlowEthernetPauseTime - HasIncrement() bool - // Decrement returns PatternFlowEthernetPauseTimeCounter, set in PatternFlowEthernetPauseTime. - // PatternFlowEthernetPauseTimeCounter is integer counter pattern - Decrement() PatternFlowEthernetPauseTimeCounter - // SetDecrement assigns PatternFlowEthernetPauseTimeCounter provided by user to PatternFlowEthernetPauseTime. - // PatternFlowEthernetPauseTimeCounter is integer counter pattern - SetDecrement(value PatternFlowEthernetPauseTimeCounter) PatternFlowEthernetPauseTime - // HasDecrement checks if Decrement has been set in PatternFlowEthernetPauseTime - HasDecrement() bool - // MetricTags returns PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIterIter, set in PatternFlowEthernetPauseTime - MetricTags() PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter - setNil() -} - -type PatternFlowEthernetPauseTimeChoiceEnum string - -// Enum of Choice on PatternFlowEthernetPauseTime -var PatternFlowEthernetPauseTimeChoice = struct { - VALUE PatternFlowEthernetPauseTimeChoiceEnum - VALUES PatternFlowEthernetPauseTimeChoiceEnum - INCREMENT PatternFlowEthernetPauseTimeChoiceEnum - DECREMENT PatternFlowEthernetPauseTimeChoiceEnum -}{ - VALUE: PatternFlowEthernetPauseTimeChoiceEnum("value"), - VALUES: PatternFlowEthernetPauseTimeChoiceEnum("values"), - INCREMENT: PatternFlowEthernetPauseTimeChoiceEnum("increment"), - DECREMENT: PatternFlowEthernetPauseTimeChoiceEnum("decrement"), -} - -func (obj *patternFlowEthernetPauseTime) Choice() PatternFlowEthernetPauseTimeChoiceEnum { - return PatternFlowEthernetPauseTimeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowEthernetPauseTime) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowEthernetPauseTime) setChoice(value PatternFlowEthernetPauseTimeChoiceEnum) PatternFlowEthernetPauseTime { - intValue, ok := otg.PatternFlowEthernetPauseTime_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowEthernetPauseTimeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowEthernetPauseTime_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowEthernetPauseTimeChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowEthernetPauseTimeChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowEthernetPauseTimeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowEthernetPauseTimeCounter().msg() - } - - if value == PatternFlowEthernetPauseTimeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowEthernetPauseTimeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowEthernetPauseTime) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowEthernetPauseTimeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowEthernetPauseTime) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowEthernetPauseTime object -func (obj *patternFlowEthernetPauseTime) SetValue(value uint32) PatternFlowEthernetPauseTime { - obj.setChoice(PatternFlowEthernetPauseTimeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowEthernetPauseTime) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowEthernetPauseTime object -func (obj *patternFlowEthernetPauseTime) SetValues(value []uint32) PatternFlowEthernetPauseTime { - obj.setChoice(PatternFlowEthernetPauseTimeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowEthernetPauseTimeCounter -func (obj *patternFlowEthernetPauseTime) Increment() PatternFlowEthernetPauseTimeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowEthernetPauseTimeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowEthernetPauseTimeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowEthernetPauseTimeCounter -func (obj *patternFlowEthernetPauseTime) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowEthernetPauseTimeCounter value in the PatternFlowEthernetPauseTime object -func (obj *patternFlowEthernetPauseTime) SetIncrement(value PatternFlowEthernetPauseTimeCounter) PatternFlowEthernetPauseTime { - obj.setChoice(PatternFlowEthernetPauseTimeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowEthernetPauseTimeCounter -func (obj *patternFlowEthernetPauseTime) Decrement() PatternFlowEthernetPauseTimeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowEthernetPauseTimeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowEthernetPauseTimeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowEthernetPauseTimeCounter -func (obj *patternFlowEthernetPauseTime) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowEthernetPauseTimeCounter value in the PatternFlowEthernetPauseTime object -func (obj *patternFlowEthernetPauseTime) SetDecrement(value PatternFlowEthernetPauseTimeCounter) PatternFlowEthernetPauseTime { - obj.setChoice(PatternFlowEthernetPauseTimeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowEthernetPauseTimeMetricTag -func (obj *patternFlowEthernetPauseTime) MetricTags() PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowEthernetPauseTimeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter struct { - obj *patternFlowEthernetPauseTime - patternFlowEthernetPauseTimeMetricTagSlice []PatternFlowEthernetPauseTimeMetricTag - fieldPtr *[]*otg.PatternFlowEthernetPauseTimeMetricTag -} - -func newPatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter(ptr *[]*otg.PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { - return &patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter interface { - setMsg(*patternFlowEthernetPauseTime) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter - Items() []PatternFlowEthernetPauseTimeMetricTag - Add() PatternFlowEthernetPauseTimeMetricTag - Append(items ...PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter - Set(index int, newObj PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter - Clear() PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter - clearHolderSlice() PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter - appendHolderSlice(item PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter -} - -func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) setMsg(msg *patternFlowEthernetPauseTime) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowEthernetPauseTimeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) Items() []PatternFlowEthernetPauseTimeMetricTag { - return obj.patternFlowEthernetPauseTimeMetricTagSlice -} - -func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) Add() PatternFlowEthernetPauseTimeMetricTag { - newObj := &otg.PatternFlowEthernetPauseTimeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowEthernetPauseTimeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowEthernetPauseTimeMetricTagSlice = append(obj.patternFlowEthernetPauseTimeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) Append(items ...PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowEthernetPauseTimeMetricTagSlice = append(obj.patternFlowEthernetPauseTimeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) Set(index int, newObj PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowEthernetPauseTimeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) Clear() PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowEthernetPauseTimeMetricTag{} - obj.patternFlowEthernetPauseTimeMetricTagSlice = []PatternFlowEthernetPauseTimeMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) clearHolderSlice() PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { - if len(obj.patternFlowEthernetPauseTimeMetricTagSlice) > 0 { - obj.patternFlowEthernetPauseTimeMetricTagSlice = []PatternFlowEthernetPauseTimeMetricTag{} - } - return obj -} -func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) appendHolderSlice(item PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { - obj.patternFlowEthernetPauseTimeMetricTagSlice = append(obj.patternFlowEthernetPauseTimeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowEthernetPauseTime) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseTime.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowEthernetPauseTime.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowEthernetPauseTimeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowEthernetPauseTime) setDefault() { - var choices_set int = 0 - var choice PatternFlowEthernetPauseTimeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseTimeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowEthernetPauseTimeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseTimeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowEthernetPauseTimeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowEthernetPauseTimeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetPauseTime") - } - } else { - intVal := otg.PatternFlowEthernetPauseTime_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowEthernetPauseTime_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpSrcPort ***** -type patternFlowTcpSrcPort struct { - validation - obj *otg.PatternFlowTcpSrcPort - marshaller marshalPatternFlowTcpSrcPort - unMarshaller unMarshalPatternFlowTcpSrcPort - incrementHolder PatternFlowTcpSrcPortCounter - decrementHolder PatternFlowTcpSrcPortCounter - metricTagsHolder PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter - randomHolder PatternFlowTcpSrcPortRandom -} - -func NewPatternFlowTcpSrcPort() PatternFlowTcpSrcPort { - obj := patternFlowTcpSrcPort{obj: &otg.PatternFlowTcpSrcPort{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpSrcPort) msg() *otg.PatternFlowTcpSrcPort { - return obj.obj -} - -func (obj *patternFlowTcpSrcPort) setMsg(msg *otg.PatternFlowTcpSrcPort) PatternFlowTcpSrcPort { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpSrcPort struct { - obj *patternFlowTcpSrcPort -} - -type marshalPatternFlowTcpSrcPort interface { - // ToProto marshals PatternFlowTcpSrcPort to protobuf object *otg.PatternFlowTcpSrcPort - ToProto() (*otg.PatternFlowTcpSrcPort, error) - // ToPbText marshals PatternFlowTcpSrcPort to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpSrcPort to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpSrcPort to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpSrcPort struct { - obj *patternFlowTcpSrcPort -} - -type unMarshalPatternFlowTcpSrcPort interface { - // FromProto unmarshals PatternFlowTcpSrcPort from protobuf object *otg.PatternFlowTcpSrcPort - FromProto(msg *otg.PatternFlowTcpSrcPort) (PatternFlowTcpSrcPort, error) - // FromPbText unmarshals PatternFlowTcpSrcPort from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpSrcPort from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpSrcPort from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpSrcPort) Marshal() marshalPatternFlowTcpSrcPort { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpSrcPort{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpSrcPort) Unmarshal() unMarshalPatternFlowTcpSrcPort { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpSrcPort{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpSrcPort) ToProto() (*otg.PatternFlowTcpSrcPort, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpSrcPort) FromProto(msg *otg.PatternFlowTcpSrcPort) (PatternFlowTcpSrcPort, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpSrcPort) 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 *unMarshalpatternFlowTcpSrcPort) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpSrcPort) 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 *unMarshalpatternFlowTcpSrcPort) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpSrcPort) 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 *unMarshalpatternFlowTcpSrcPort) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpSrcPort) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpSrcPort) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpSrcPort) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpSrcPort) Clone() (PatternFlowTcpSrcPort, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpSrcPort() - 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 -} - -func (obj *patternFlowTcpSrcPort) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.randomHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpSrcPort is source port -type PatternFlowTcpSrcPort interface { - Validation - // msg marshals PatternFlowTcpSrcPort to protobuf object *otg.PatternFlowTcpSrcPort - // and doesn't set defaults - msg() *otg.PatternFlowTcpSrcPort - // setMsg unmarshals PatternFlowTcpSrcPort from protobuf object *otg.PatternFlowTcpSrcPort - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpSrcPort) PatternFlowTcpSrcPort - // provides marshal interface - Marshal() marshalPatternFlowTcpSrcPort - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpSrcPort - // validate validates PatternFlowTcpSrcPort - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpSrcPort, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpSrcPortChoiceEnum, set in PatternFlowTcpSrcPort - Choice() PatternFlowTcpSrcPortChoiceEnum - // setChoice assigns PatternFlowTcpSrcPortChoiceEnum provided by user to PatternFlowTcpSrcPort - setChoice(value PatternFlowTcpSrcPortChoiceEnum) PatternFlowTcpSrcPort - // HasChoice checks if Choice has been set in PatternFlowTcpSrcPort - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpSrcPort. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpSrcPort - SetValue(value uint32) PatternFlowTcpSrcPort - // HasValue checks if Value has been set in PatternFlowTcpSrcPort - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpSrcPort. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpSrcPort - SetValues(value []uint32) PatternFlowTcpSrcPort - // Increment returns PatternFlowTcpSrcPortCounter, set in PatternFlowTcpSrcPort. - // PatternFlowTcpSrcPortCounter is integer counter pattern - Increment() PatternFlowTcpSrcPortCounter - // SetIncrement assigns PatternFlowTcpSrcPortCounter provided by user to PatternFlowTcpSrcPort. - // PatternFlowTcpSrcPortCounter is integer counter pattern - SetIncrement(value PatternFlowTcpSrcPortCounter) PatternFlowTcpSrcPort - // HasIncrement checks if Increment has been set in PatternFlowTcpSrcPort - HasIncrement() bool - // Decrement returns PatternFlowTcpSrcPortCounter, set in PatternFlowTcpSrcPort. - // PatternFlowTcpSrcPortCounter is integer counter pattern - Decrement() PatternFlowTcpSrcPortCounter - // SetDecrement assigns PatternFlowTcpSrcPortCounter provided by user to PatternFlowTcpSrcPort. - // PatternFlowTcpSrcPortCounter is integer counter pattern - SetDecrement(value PatternFlowTcpSrcPortCounter) PatternFlowTcpSrcPort - // HasDecrement checks if Decrement has been set in PatternFlowTcpSrcPort - HasDecrement() bool - // MetricTags returns PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIterIter, set in PatternFlowTcpSrcPort - MetricTags() PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter - // Random returns PatternFlowTcpSrcPortRandom, set in PatternFlowTcpSrcPort. - // PatternFlowTcpSrcPortRandom is integer random pattern - Random() PatternFlowTcpSrcPortRandom - // SetRandom assigns PatternFlowTcpSrcPortRandom provided by user to PatternFlowTcpSrcPort. - // PatternFlowTcpSrcPortRandom is integer random pattern - SetRandom(value PatternFlowTcpSrcPortRandom) PatternFlowTcpSrcPort - // HasRandom checks if Random has been set in PatternFlowTcpSrcPort - HasRandom() bool - setNil() -} - -type PatternFlowTcpSrcPortChoiceEnum string - -// Enum of Choice on PatternFlowTcpSrcPort -var PatternFlowTcpSrcPortChoice = struct { - VALUE PatternFlowTcpSrcPortChoiceEnum - VALUES PatternFlowTcpSrcPortChoiceEnum - INCREMENT PatternFlowTcpSrcPortChoiceEnum - DECREMENT PatternFlowTcpSrcPortChoiceEnum - RANDOM PatternFlowTcpSrcPortChoiceEnum -}{ - VALUE: PatternFlowTcpSrcPortChoiceEnum("value"), - VALUES: PatternFlowTcpSrcPortChoiceEnum("values"), - INCREMENT: PatternFlowTcpSrcPortChoiceEnum("increment"), - DECREMENT: PatternFlowTcpSrcPortChoiceEnum("decrement"), - RANDOM: PatternFlowTcpSrcPortChoiceEnum("random"), -} - -func (obj *patternFlowTcpSrcPort) Choice() PatternFlowTcpSrcPortChoiceEnum { - return PatternFlowTcpSrcPortChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpSrcPort) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpSrcPort) setChoice(value PatternFlowTcpSrcPortChoiceEnum) PatternFlowTcpSrcPort { - intValue, ok := otg.PatternFlowTcpSrcPort_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpSrcPortChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpSrcPort_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Random = nil - obj.randomHolder = nil - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpSrcPortChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpSrcPortChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpSrcPortChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpSrcPortCounter().msg() - } - - if value == PatternFlowTcpSrcPortChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpSrcPortCounter().msg() - } - - if value == PatternFlowTcpSrcPortChoice.RANDOM { - obj.obj.Random = NewPatternFlowTcpSrcPortRandom().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpSrcPort) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpSrcPortChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpSrcPort) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpSrcPort object -func (obj *patternFlowTcpSrcPort) SetValue(value uint32) PatternFlowTcpSrcPort { - obj.setChoice(PatternFlowTcpSrcPortChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpSrcPort) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpSrcPort object -func (obj *patternFlowTcpSrcPort) SetValues(value []uint32) PatternFlowTcpSrcPort { - obj.setChoice(PatternFlowTcpSrcPortChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpSrcPortCounter -func (obj *patternFlowTcpSrcPort) Increment() PatternFlowTcpSrcPortCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpSrcPortChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpSrcPortCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpSrcPortCounter -func (obj *patternFlowTcpSrcPort) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpSrcPortCounter value in the PatternFlowTcpSrcPort object -func (obj *patternFlowTcpSrcPort) SetIncrement(value PatternFlowTcpSrcPortCounter) PatternFlowTcpSrcPort { - obj.setChoice(PatternFlowTcpSrcPortChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpSrcPortCounter -func (obj *patternFlowTcpSrcPort) Decrement() PatternFlowTcpSrcPortCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpSrcPortChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpSrcPortCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpSrcPortCounter -func (obj *patternFlowTcpSrcPort) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpSrcPortCounter value in the PatternFlowTcpSrcPort object -func (obj *patternFlowTcpSrcPort) SetDecrement(value PatternFlowTcpSrcPortCounter) PatternFlowTcpSrcPort { - obj.setChoice(PatternFlowTcpSrcPortChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpSrcPortMetricTag -func (obj *patternFlowTcpSrcPort) MetricTags() PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpSrcPortMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter struct { - obj *patternFlowTcpSrcPort - patternFlowTcpSrcPortMetricTagSlice []PatternFlowTcpSrcPortMetricTag - fieldPtr *[]*otg.PatternFlowTcpSrcPortMetricTag -} - -func newPatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter(ptr *[]*otg.PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { - return &patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter interface { - setMsg(*patternFlowTcpSrcPort) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter - Items() []PatternFlowTcpSrcPortMetricTag - Add() PatternFlowTcpSrcPortMetricTag - Append(items ...PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter - Set(index int, newObj PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter - Clear() PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter - clearHolderSlice() PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter - appendHolderSlice(item PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter -} - -func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) setMsg(msg *patternFlowTcpSrcPort) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpSrcPortMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) Items() []PatternFlowTcpSrcPortMetricTag { - return obj.patternFlowTcpSrcPortMetricTagSlice -} - -func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) Add() PatternFlowTcpSrcPortMetricTag { - newObj := &otg.PatternFlowTcpSrcPortMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpSrcPortMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpSrcPortMetricTagSlice = append(obj.patternFlowTcpSrcPortMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) Append(items ...PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpSrcPortMetricTagSlice = append(obj.patternFlowTcpSrcPortMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) Set(index int, newObj PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpSrcPortMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) Clear() PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpSrcPortMetricTag{} - obj.patternFlowTcpSrcPortMetricTagSlice = []PatternFlowTcpSrcPortMetricTag{} - } - return obj -} -func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) clearHolderSlice() PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { - if len(obj.patternFlowTcpSrcPortMetricTagSlice) > 0 { - obj.patternFlowTcpSrcPortMetricTagSlice = []PatternFlowTcpSrcPortMetricTag{} - } - return obj -} -func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) appendHolderSlice(item PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { - obj.patternFlowTcpSrcPortMetricTagSlice = append(obj.patternFlowTcpSrcPortMetricTagSlice, item) - return obj -} - -// description is TBD -// Random returns a PatternFlowTcpSrcPortRandom -func (obj *patternFlowTcpSrcPort) Random() PatternFlowTcpSrcPortRandom { - if obj.obj.Random == nil { - obj.setChoice(PatternFlowTcpSrcPortChoice.RANDOM) - } - if obj.randomHolder == nil { - obj.randomHolder = &patternFlowTcpSrcPortRandom{obj: obj.obj.Random} - } - return obj.randomHolder -} - -// description is TBD -// Random returns a PatternFlowTcpSrcPortRandom -func (obj *patternFlowTcpSrcPort) HasRandom() bool { - return obj.obj.Random != nil -} - -// description is TBD -// SetRandom sets the PatternFlowTcpSrcPortRandom value in the PatternFlowTcpSrcPort object -func (obj *patternFlowTcpSrcPort) SetRandom(value PatternFlowTcpSrcPortRandom) PatternFlowTcpSrcPort { - obj.setChoice(PatternFlowTcpSrcPortChoice.RANDOM) - obj.randomHolder = nil - obj.obj.Random = value.msg() - - return obj -} - -func (obj *patternFlowTcpSrcPort) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpSrcPort.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowTcpSrcPort.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpSrcPortMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Random != nil { - - obj.Random().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowTcpSrcPort) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpSrcPortChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpSrcPortChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpSrcPortChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpSrcPortChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpSrcPortChoice.DECREMENT - } - - if obj.obj.Random != nil { - choices_set += 1 - choice = PatternFlowTcpSrcPortChoice.RANDOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpSrcPortChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpSrcPort") - } - } else { - intVal := otg.PatternFlowTcpSrcPort_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpSrcPort_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpDstPort ***** -type patternFlowTcpDstPort struct { - validation - obj *otg.PatternFlowTcpDstPort - marshaller marshalPatternFlowTcpDstPort - unMarshaller unMarshalPatternFlowTcpDstPort - incrementHolder PatternFlowTcpDstPortCounter - decrementHolder PatternFlowTcpDstPortCounter - metricTagsHolder PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter - randomHolder PatternFlowTcpDstPortRandom -} - -func NewPatternFlowTcpDstPort() PatternFlowTcpDstPort { - obj := patternFlowTcpDstPort{obj: &otg.PatternFlowTcpDstPort{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpDstPort) msg() *otg.PatternFlowTcpDstPort { - return obj.obj -} - -func (obj *patternFlowTcpDstPort) setMsg(msg *otg.PatternFlowTcpDstPort) PatternFlowTcpDstPort { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpDstPort struct { - obj *patternFlowTcpDstPort -} - -type marshalPatternFlowTcpDstPort interface { - // ToProto marshals PatternFlowTcpDstPort to protobuf object *otg.PatternFlowTcpDstPort - ToProto() (*otg.PatternFlowTcpDstPort, error) - // ToPbText marshals PatternFlowTcpDstPort to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpDstPort to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpDstPort to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpDstPort struct { - obj *patternFlowTcpDstPort -} - -type unMarshalPatternFlowTcpDstPort interface { - // FromProto unmarshals PatternFlowTcpDstPort from protobuf object *otg.PatternFlowTcpDstPort - FromProto(msg *otg.PatternFlowTcpDstPort) (PatternFlowTcpDstPort, error) - // FromPbText unmarshals PatternFlowTcpDstPort from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpDstPort from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpDstPort from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpDstPort) Marshal() marshalPatternFlowTcpDstPort { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpDstPort{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpDstPort) Unmarshal() unMarshalPatternFlowTcpDstPort { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpDstPort{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpDstPort) ToProto() (*otg.PatternFlowTcpDstPort, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpDstPort) FromProto(msg *otg.PatternFlowTcpDstPort) (PatternFlowTcpDstPort, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpDstPort) 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 *unMarshalpatternFlowTcpDstPort) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpDstPort) 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 *unMarshalpatternFlowTcpDstPort) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpDstPort) 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 *unMarshalpatternFlowTcpDstPort) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpDstPort) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpDstPort) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpDstPort) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpDstPort) Clone() (PatternFlowTcpDstPort, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpDstPort() - 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 -} - -func (obj *patternFlowTcpDstPort) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.randomHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpDstPort is destination port -type PatternFlowTcpDstPort interface { - Validation - // msg marshals PatternFlowTcpDstPort to protobuf object *otg.PatternFlowTcpDstPort - // and doesn't set defaults - msg() *otg.PatternFlowTcpDstPort - // setMsg unmarshals PatternFlowTcpDstPort from protobuf object *otg.PatternFlowTcpDstPort - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpDstPort) PatternFlowTcpDstPort - // provides marshal interface - Marshal() marshalPatternFlowTcpDstPort - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpDstPort - // validate validates PatternFlowTcpDstPort - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpDstPort, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpDstPortChoiceEnum, set in PatternFlowTcpDstPort - Choice() PatternFlowTcpDstPortChoiceEnum - // setChoice assigns PatternFlowTcpDstPortChoiceEnum provided by user to PatternFlowTcpDstPort - setChoice(value PatternFlowTcpDstPortChoiceEnum) PatternFlowTcpDstPort - // HasChoice checks if Choice has been set in PatternFlowTcpDstPort - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpDstPort. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpDstPort - SetValue(value uint32) PatternFlowTcpDstPort - // HasValue checks if Value has been set in PatternFlowTcpDstPort - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpDstPort. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpDstPort - SetValues(value []uint32) PatternFlowTcpDstPort - // Increment returns PatternFlowTcpDstPortCounter, set in PatternFlowTcpDstPort. - // PatternFlowTcpDstPortCounter is integer counter pattern - Increment() PatternFlowTcpDstPortCounter - // SetIncrement assigns PatternFlowTcpDstPortCounter provided by user to PatternFlowTcpDstPort. - // PatternFlowTcpDstPortCounter is integer counter pattern - SetIncrement(value PatternFlowTcpDstPortCounter) PatternFlowTcpDstPort - // HasIncrement checks if Increment has been set in PatternFlowTcpDstPort - HasIncrement() bool - // Decrement returns PatternFlowTcpDstPortCounter, set in PatternFlowTcpDstPort. - // PatternFlowTcpDstPortCounter is integer counter pattern - Decrement() PatternFlowTcpDstPortCounter - // SetDecrement assigns PatternFlowTcpDstPortCounter provided by user to PatternFlowTcpDstPort. - // PatternFlowTcpDstPortCounter is integer counter pattern - SetDecrement(value PatternFlowTcpDstPortCounter) PatternFlowTcpDstPort - // HasDecrement checks if Decrement has been set in PatternFlowTcpDstPort - HasDecrement() bool - // MetricTags returns PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIterIter, set in PatternFlowTcpDstPort - MetricTags() PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter - // Random returns PatternFlowTcpDstPortRandom, set in PatternFlowTcpDstPort. - // PatternFlowTcpDstPortRandom is integer random pattern - Random() PatternFlowTcpDstPortRandom - // SetRandom assigns PatternFlowTcpDstPortRandom provided by user to PatternFlowTcpDstPort. - // PatternFlowTcpDstPortRandom is integer random pattern - SetRandom(value PatternFlowTcpDstPortRandom) PatternFlowTcpDstPort - // HasRandom checks if Random has been set in PatternFlowTcpDstPort - HasRandom() bool - setNil() -} - -type PatternFlowTcpDstPortChoiceEnum string - -// Enum of Choice on PatternFlowTcpDstPort -var PatternFlowTcpDstPortChoice = struct { - VALUE PatternFlowTcpDstPortChoiceEnum - VALUES PatternFlowTcpDstPortChoiceEnum - INCREMENT PatternFlowTcpDstPortChoiceEnum - DECREMENT PatternFlowTcpDstPortChoiceEnum - RANDOM PatternFlowTcpDstPortChoiceEnum -}{ - VALUE: PatternFlowTcpDstPortChoiceEnum("value"), - VALUES: PatternFlowTcpDstPortChoiceEnum("values"), - INCREMENT: PatternFlowTcpDstPortChoiceEnum("increment"), - DECREMENT: PatternFlowTcpDstPortChoiceEnum("decrement"), - RANDOM: PatternFlowTcpDstPortChoiceEnum("random"), -} - -func (obj *patternFlowTcpDstPort) Choice() PatternFlowTcpDstPortChoiceEnum { - return PatternFlowTcpDstPortChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpDstPort) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpDstPort) setChoice(value PatternFlowTcpDstPortChoiceEnum) PatternFlowTcpDstPort { - intValue, ok := otg.PatternFlowTcpDstPort_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpDstPortChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpDstPort_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Random = nil - obj.randomHolder = nil - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpDstPortChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpDstPortChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpDstPortChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpDstPortCounter().msg() - } - - if value == PatternFlowTcpDstPortChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpDstPortCounter().msg() - } - - if value == PatternFlowTcpDstPortChoice.RANDOM { - obj.obj.Random = NewPatternFlowTcpDstPortRandom().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpDstPort) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpDstPortChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpDstPort) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpDstPort object -func (obj *patternFlowTcpDstPort) SetValue(value uint32) PatternFlowTcpDstPort { - obj.setChoice(PatternFlowTcpDstPortChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpDstPort) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpDstPort object -func (obj *patternFlowTcpDstPort) SetValues(value []uint32) PatternFlowTcpDstPort { - obj.setChoice(PatternFlowTcpDstPortChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpDstPortCounter -func (obj *patternFlowTcpDstPort) Increment() PatternFlowTcpDstPortCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpDstPortChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpDstPortCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpDstPortCounter -func (obj *patternFlowTcpDstPort) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpDstPortCounter value in the PatternFlowTcpDstPort object -func (obj *patternFlowTcpDstPort) SetIncrement(value PatternFlowTcpDstPortCounter) PatternFlowTcpDstPort { - obj.setChoice(PatternFlowTcpDstPortChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpDstPortCounter -func (obj *patternFlowTcpDstPort) Decrement() PatternFlowTcpDstPortCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpDstPortChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpDstPortCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpDstPortCounter -func (obj *patternFlowTcpDstPort) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpDstPortCounter value in the PatternFlowTcpDstPort object -func (obj *patternFlowTcpDstPort) SetDecrement(value PatternFlowTcpDstPortCounter) PatternFlowTcpDstPort { - obj.setChoice(PatternFlowTcpDstPortChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpDstPortMetricTag -func (obj *patternFlowTcpDstPort) MetricTags() PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpDstPortMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter struct { - obj *patternFlowTcpDstPort - patternFlowTcpDstPortMetricTagSlice []PatternFlowTcpDstPortMetricTag - fieldPtr *[]*otg.PatternFlowTcpDstPortMetricTag -} - -func newPatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter(ptr *[]*otg.PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { - return &patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter interface { - setMsg(*patternFlowTcpDstPort) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter - Items() []PatternFlowTcpDstPortMetricTag - Add() PatternFlowTcpDstPortMetricTag - Append(items ...PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter - Set(index int, newObj PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter - Clear() PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter - clearHolderSlice() PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter - appendHolderSlice(item PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter -} - -func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) setMsg(msg *patternFlowTcpDstPort) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpDstPortMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) Items() []PatternFlowTcpDstPortMetricTag { - return obj.patternFlowTcpDstPortMetricTagSlice -} - -func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) Add() PatternFlowTcpDstPortMetricTag { - newObj := &otg.PatternFlowTcpDstPortMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpDstPortMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpDstPortMetricTagSlice = append(obj.patternFlowTcpDstPortMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) Append(items ...PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpDstPortMetricTagSlice = append(obj.patternFlowTcpDstPortMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) Set(index int, newObj PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpDstPortMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) Clear() PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpDstPortMetricTag{} - obj.patternFlowTcpDstPortMetricTagSlice = []PatternFlowTcpDstPortMetricTag{} - } - return obj -} -func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) clearHolderSlice() PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { - if len(obj.patternFlowTcpDstPortMetricTagSlice) > 0 { - obj.patternFlowTcpDstPortMetricTagSlice = []PatternFlowTcpDstPortMetricTag{} - } - return obj -} -func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) appendHolderSlice(item PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { - obj.patternFlowTcpDstPortMetricTagSlice = append(obj.patternFlowTcpDstPortMetricTagSlice, item) - return obj -} - -// description is TBD -// Random returns a PatternFlowTcpDstPortRandom -func (obj *patternFlowTcpDstPort) Random() PatternFlowTcpDstPortRandom { - if obj.obj.Random == nil { - obj.setChoice(PatternFlowTcpDstPortChoice.RANDOM) - } - if obj.randomHolder == nil { - obj.randomHolder = &patternFlowTcpDstPortRandom{obj: obj.obj.Random} - } - return obj.randomHolder -} - -// description is TBD -// Random returns a PatternFlowTcpDstPortRandom -func (obj *patternFlowTcpDstPort) HasRandom() bool { - return obj.obj.Random != nil -} - -// description is TBD -// SetRandom sets the PatternFlowTcpDstPortRandom value in the PatternFlowTcpDstPort object -func (obj *patternFlowTcpDstPort) SetRandom(value PatternFlowTcpDstPortRandom) PatternFlowTcpDstPort { - obj.setChoice(PatternFlowTcpDstPortChoice.RANDOM) - obj.randomHolder = nil - obj.obj.Random = value.msg() - - return obj -} - -func (obj *patternFlowTcpDstPort) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpDstPort.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowTcpDstPort.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpDstPortMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Random != nil { - - obj.Random().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowTcpDstPort) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpDstPortChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpDstPortChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpDstPortChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpDstPortChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpDstPortChoice.DECREMENT - } - - if obj.obj.Random != nil { - choices_set += 1 - choice = PatternFlowTcpDstPortChoice.RANDOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpDstPortChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpDstPort") - } - } else { - intVal := otg.PatternFlowTcpDstPort_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpDstPort_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpSeqNum ***** -type patternFlowTcpSeqNum struct { - validation - obj *otg.PatternFlowTcpSeqNum - marshaller marshalPatternFlowTcpSeqNum - unMarshaller unMarshalPatternFlowTcpSeqNum - incrementHolder PatternFlowTcpSeqNumCounter - decrementHolder PatternFlowTcpSeqNumCounter - metricTagsHolder PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter -} - -func NewPatternFlowTcpSeqNum() PatternFlowTcpSeqNum { - obj := patternFlowTcpSeqNum{obj: &otg.PatternFlowTcpSeqNum{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpSeqNum) msg() *otg.PatternFlowTcpSeqNum { - return obj.obj -} - -func (obj *patternFlowTcpSeqNum) setMsg(msg *otg.PatternFlowTcpSeqNum) PatternFlowTcpSeqNum { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpSeqNum struct { - obj *patternFlowTcpSeqNum -} - -type marshalPatternFlowTcpSeqNum interface { - // ToProto marshals PatternFlowTcpSeqNum to protobuf object *otg.PatternFlowTcpSeqNum - ToProto() (*otg.PatternFlowTcpSeqNum, error) - // ToPbText marshals PatternFlowTcpSeqNum to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpSeqNum to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpSeqNum to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpSeqNum struct { - obj *patternFlowTcpSeqNum -} - -type unMarshalPatternFlowTcpSeqNum interface { - // FromProto unmarshals PatternFlowTcpSeqNum from protobuf object *otg.PatternFlowTcpSeqNum - FromProto(msg *otg.PatternFlowTcpSeqNum) (PatternFlowTcpSeqNum, error) - // FromPbText unmarshals PatternFlowTcpSeqNum from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpSeqNum from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpSeqNum from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpSeqNum) Marshal() marshalPatternFlowTcpSeqNum { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpSeqNum{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpSeqNum) Unmarshal() unMarshalPatternFlowTcpSeqNum { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpSeqNum{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpSeqNum) ToProto() (*otg.PatternFlowTcpSeqNum, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpSeqNum) FromProto(msg *otg.PatternFlowTcpSeqNum) (PatternFlowTcpSeqNum, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpSeqNum) 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 *unMarshalpatternFlowTcpSeqNum) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpSeqNum) 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 *unMarshalpatternFlowTcpSeqNum) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpSeqNum) 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 *unMarshalpatternFlowTcpSeqNum) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpSeqNum) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpSeqNum) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpSeqNum) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpSeqNum) Clone() (PatternFlowTcpSeqNum, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpSeqNum() - 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 -} - -func (obj *patternFlowTcpSeqNum) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpSeqNum is sequence number -type PatternFlowTcpSeqNum interface { - Validation - // msg marshals PatternFlowTcpSeqNum to protobuf object *otg.PatternFlowTcpSeqNum - // and doesn't set defaults - msg() *otg.PatternFlowTcpSeqNum - // setMsg unmarshals PatternFlowTcpSeqNum from protobuf object *otg.PatternFlowTcpSeqNum - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpSeqNum) PatternFlowTcpSeqNum - // provides marshal interface - Marshal() marshalPatternFlowTcpSeqNum - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpSeqNum - // validate validates PatternFlowTcpSeqNum - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpSeqNum, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpSeqNumChoiceEnum, set in PatternFlowTcpSeqNum - Choice() PatternFlowTcpSeqNumChoiceEnum - // setChoice assigns PatternFlowTcpSeqNumChoiceEnum provided by user to PatternFlowTcpSeqNum - setChoice(value PatternFlowTcpSeqNumChoiceEnum) PatternFlowTcpSeqNum - // HasChoice checks if Choice has been set in PatternFlowTcpSeqNum - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpSeqNum. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpSeqNum - SetValue(value uint32) PatternFlowTcpSeqNum - // HasValue checks if Value has been set in PatternFlowTcpSeqNum - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpSeqNum. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpSeqNum - SetValues(value []uint32) PatternFlowTcpSeqNum - // Increment returns PatternFlowTcpSeqNumCounter, set in PatternFlowTcpSeqNum. - // PatternFlowTcpSeqNumCounter is integer counter pattern - Increment() PatternFlowTcpSeqNumCounter - // SetIncrement assigns PatternFlowTcpSeqNumCounter provided by user to PatternFlowTcpSeqNum. - // PatternFlowTcpSeqNumCounter is integer counter pattern - SetIncrement(value PatternFlowTcpSeqNumCounter) PatternFlowTcpSeqNum - // HasIncrement checks if Increment has been set in PatternFlowTcpSeqNum - HasIncrement() bool - // Decrement returns PatternFlowTcpSeqNumCounter, set in PatternFlowTcpSeqNum. - // PatternFlowTcpSeqNumCounter is integer counter pattern - Decrement() PatternFlowTcpSeqNumCounter - // SetDecrement assigns PatternFlowTcpSeqNumCounter provided by user to PatternFlowTcpSeqNum. - // PatternFlowTcpSeqNumCounter is integer counter pattern - SetDecrement(value PatternFlowTcpSeqNumCounter) PatternFlowTcpSeqNum - // HasDecrement checks if Decrement has been set in PatternFlowTcpSeqNum - HasDecrement() bool - // MetricTags returns PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIterIter, set in PatternFlowTcpSeqNum - MetricTags() PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter - setNil() -} - -type PatternFlowTcpSeqNumChoiceEnum string - -// Enum of Choice on PatternFlowTcpSeqNum -var PatternFlowTcpSeqNumChoice = struct { - VALUE PatternFlowTcpSeqNumChoiceEnum - VALUES PatternFlowTcpSeqNumChoiceEnum - INCREMENT PatternFlowTcpSeqNumChoiceEnum - DECREMENT PatternFlowTcpSeqNumChoiceEnum -}{ - VALUE: PatternFlowTcpSeqNumChoiceEnum("value"), - VALUES: PatternFlowTcpSeqNumChoiceEnum("values"), - INCREMENT: PatternFlowTcpSeqNumChoiceEnum("increment"), - DECREMENT: PatternFlowTcpSeqNumChoiceEnum("decrement"), -} - -func (obj *patternFlowTcpSeqNum) Choice() PatternFlowTcpSeqNumChoiceEnum { - return PatternFlowTcpSeqNumChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpSeqNum) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpSeqNum) setChoice(value PatternFlowTcpSeqNumChoiceEnum) PatternFlowTcpSeqNum { - intValue, ok := otg.PatternFlowTcpSeqNum_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpSeqNumChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpSeqNum_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpSeqNumChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpSeqNumChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpSeqNumChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpSeqNumCounter().msg() - } - - if value == PatternFlowTcpSeqNumChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpSeqNumCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpSeqNum) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpSeqNumChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpSeqNum) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpSeqNum object -func (obj *patternFlowTcpSeqNum) SetValue(value uint32) PatternFlowTcpSeqNum { - obj.setChoice(PatternFlowTcpSeqNumChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpSeqNum) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpSeqNum object -func (obj *patternFlowTcpSeqNum) SetValues(value []uint32) PatternFlowTcpSeqNum { - obj.setChoice(PatternFlowTcpSeqNumChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpSeqNumCounter -func (obj *patternFlowTcpSeqNum) Increment() PatternFlowTcpSeqNumCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpSeqNumChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpSeqNumCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpSeqNumCounter -func (obj *patternFlowTcpSeqNum) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpSeqNumCounter value in the PatternFlowTcpSeqNum object -func (obj *patternFlowTcpSeqNum) SetIncrement(value PatternFlowTcpSeqNumCounter) PatternFlowTcpSeqNum { - obj.setChoice(PatternFlowTcpSeqNumChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpSeqNumCounter -func (obj *patternFlowTcpSeqNum) Decrement() PatternFlowTcpSeqNumCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpSeqNumChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpSeqNumCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpSeqNumCounter -func (obj *patternFlowTcpSeqNum) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpSeqNumCounter value in the PatternFlowTcpSeqNum object -func (obj *patternFlowTcpSeqNum) SetDecrement(value PatternFlowTcpSeqNumCounter) PatternFlowTcpSeqNum { - obj.setChoice(PatternFlowTcpSeqNumChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpSeqNumMetricTag -func (obj *patternFlowTcpSeqNum) MetricTags() PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpSeqNumMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter struct { - obj *patternFlowTcpSeqNum - patternFlowTcpSeqNumMetricTagSlice []PatternFlowTcpSeqNumMetricTag - fieldPtr *[]*otg.PatternFlowTcpSeqNumMetricTag -} - -func newPatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter(ptr *[]*otg.PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { - return &patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter interface { - setMsg(*patternFlowTcpSeqNum) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter - Items() []PatternFlowTcpSeqNumMetricTag - Add() PatternFlowTcpSeqNumMetricTag - Append(items ...PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter - Set(index int, newObj PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter - Clear() PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter - clearHolderSlice() PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter - appendHolderSlice(item PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter -} - -func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) setMsg(msg *patternFlowTcpSeqNum) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpSeqNumMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) Items() []PatternFlowTcpSeqNumMetricTag { - return obj.patternFlowTcpSeqNumMetricTagSlice -} - -func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) Add() PatternFlowTcpSeqNumMetricTag { - newObj := &otg.PatternFlowTcpSeqNumMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpSeqNumMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpSeqNumMetricTagSlice = append(obj.patternFlowTcpSeqNumMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) Append(items ...PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpSeqNumMetricTagSlice = append(obj.patternFlowTcpSeqNumMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) Set(index int, newObj PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpSeqNumMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) Clear() PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpSeqNumMetricTag{} - obj.patternFlowTcpSeqNumMetricTagSlice = []PatternFlowTcpSeqNumMetricTag{} - } - return obj -} -func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) clearHolderSlice() PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { - if len(obj.patternFlowTcpSeqNumMetricTagSlice) > 0 { - obj.patternFlowTcpSeqNumMetricTagSlice = []PatternFlowTcpSeqNumMetricTag{} - } - return obj -} -func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) appendHolderSlice(item PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { - obj.patternFlowTcpSeqNumMetricTagSlice = append(obj.patternFlowTcpSeqNumMetricTagSlice, item) - return obj -} - -func (obj *patternFlowTcpSeqNum) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpSeqNumMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowTcpSeqNum) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpSeqNumChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpSeqNumChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpSeqNumChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpSeqNumChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpSeqNumChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpSeqNumChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpSeqNum") - } - } else { - intVal := otg.PatternFlowTcpSeqNum_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpSeqNum_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpAckNum ***** -type patternFlowTcpAckNum struct { - validation - obj *otg.PatternFlowTcpAckNum - marshaller marshalPatternFlowTcpAckNum - unMarshaller unMarshalPatternFlowTcpAckNum - incrementHolder PatternFlowTcpAckNumCounter - decrementHolder PatternFlowTcpAckNumCounter - metricTagsHolder PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter -} - -func NewPatternFlowTcpAckNum() PatternFlowTcpAckNum { - obj := patternFlowTcpAckNum{obj: &otg.PatternFlowTcpAckNum{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpAckNum) msg() *otg.PatternFlowTcpAckNum { - return obj.obj -} - -func (obj *patternFlowTcpAckNum) setMsg(msg *otg.PatternFlowTcpAckNum) PatternFlowTcpAckNum { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpAckNum struct { - obj *patternFlowTcpAckNum -} - -type marshalPatternFlowTcpAckNum interface { - // ToProto marshals PatternFlowTcpAckNum to protobuf object *otg.PatternFlowTcpAckNum - ToProto() (*otg.PatternFlowTcpAckNum, error) - // ToPbText marshals PatternFlowTcpAckNum to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpAckNum to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpAckNum to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpAckNum struct { - obj *patternFlowTcpAckNum -} - -type unMarshalPatternFlowTcpAckNum interface { - // FromProto unmarshals PatternFlowTcpAckNum from protobuf object *otg.PatternFlowTcpAckNum - FromProto(msg *otg.PatternFlowTcpAckNum) (PatternFlowTcpAckNum, error) - // FromPbText unmarshals PatternFlowTcpAckNum from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpAckNum from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpAckNum from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpAckNum) Marshal() marshalPatternFlowTcpAckNum { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpAckNum{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpAckNum) Unmarshal() unMarshalPatternFlowTcpAckNum { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpAckNum{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpAckNum) ToProto() (*otg.PatternFlowTcpAckNum, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpAckNum) FromProto(msg *otg.PatternFlowTcpAckNum) (PatternFlowTcpAckNum, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpAckNum) 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 *unMarshalpatternFlowTcpAckNum) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpAckNum) 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 *unMarshalpatternFlowTcpAckNum) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpAckNum) 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 *unMarshalpatternFlowTcpAckNum) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpAckNum) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpAckNum) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpAckNum) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpAckNum) Clone() (PatternFlowTcpAckNum, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpAckNum() - 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 -} - -func (obj *patternFlowTcpAckNum) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpAckNum is acknowledgement number -type PatternFlowTcpAckNum interface { - Validation - // msg marshals PatternFlowTcpAckNum to protobuf object *otg.PatternFlowTcpAckNum - // and doesn't set defaults - msg() *otg.PatternFlowTcpAckNum - // setMsg unmarshals PatternFlowTcpAckNum from protobuf object *otg.PatternFlowTcpAckNum - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpAckNum) PatternFlowTcpAckNum - // provides marshal interface - Marshal() marshalPatternFlowTcpAckNum - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpAckNum - // validate validates PatternFlowTcpAckNum - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpAckNum, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpAckNumChoiceEnum, set in PatternFlowTcpAckNum - Choice() PatternFlowTcpAckNumChoiceEnum - // setChoice assigns PatternFlowTcpAckNumChoiceEnum provided by user to PatternFlowTcpAckNum - setChoice(value PatternFlowTcpAckNumChoiceEnum) PatternFlowTcpAckNum - // HasChoice checks if Choice has been set in PatternFlowTcpAckNum - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpAckNum. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpAckNum - SetValue(value uint32) PatternFlowTcpAckNum - // HasValue checks if Value has been set in PatternFlowTcpAckNum - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpAckNum. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpAckNum - SetValues(value []uint32) PatternFlowTcpAckNum - // Increment returns PatternFlowTcpAckNumCounter, set in PatternFlowTcpAckNum. - // PatternFlowTcpAckNumCounter is integer counter pattern - Increment() PatternFlowTcpAckNumCounter - // SetIncrement assigns PatternFlowTcpAckNumCounter provided by user to PatternFlowTcpAckNum. - // PatternFlowTcpAckNumCounter is integer counter pattern - SetIncrement(value PatternFlowTcpAckNumCounter) PatternFlowTcpAckNum - // HasIncrement checks if Increment has been set in PatternFlowTcpAckNum - HasIncrement() bool - // Decrement returns PatternFlowTcpAckNumCounter, set in PatternFlowTcpAckNum. - // PatternFlowTcpAckNumCounter is integer counter pattern - Decrement() PatternFlowTcpAckNumCounter - // SetDecrement assigns PatternFlowTcpAckNumCounter provided by user to PatternFlowTcpAckNum. - // PatternFlowTcpAckNumCounter is integer counter pattern - SetDecrement(value PatternFlowTcpAckNumCounter) PatternFlowTcpAckNum - // HasDecrement checks if Decrement has been set in PatternFlowTcpAckNum - HasDecrement() bool - // MetricTags returns PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIterIter, set in PatternFlowTcpAckNum - MetricTags() PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter - setNil() -} - -type PatternFlowTcpAckNumChoiceEnum string - -// Enum of Choice on PatternFlowTcpAckNum -var PatternFlowTcpAckNumChoice = struct { - VALUE PatternFlowTcpAckNumChoiceEnum - VALUES PatternFlowTcpAckNumChoiceEnum - INCREMENT PatternFlowTcpAckNumChoiceEnum - DECREMENT PatternFlowTcpAckNumChoiceEnum -}{ - VALUE: PatternFlowTcpAckNumChoiceEnum("value"), - VALUES: PatternFlowTcpAckNumChoiceEnum("values"), - INCREMENT: PatternFlowTcpAckNumChoiceEnum("increment"), - DECREMENT: PatternFlowTcpAckNumChoiceEnum("decrement"), -} - -func (obj *patternFlowTcpAckNum) Choice() PatternFlowTcpAckNumChoiceEnum { - return PatternFlowTcpAckNumChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpAckNum) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpAckNum) setChoice(value PatternFlowTcpAckNumChoiceEnum) PatternFlowTcpAckNum { - intValue, ok := otg.PatternFlowTcpAckNum_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpAckNumChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpAckNum_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpAckNumChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpAckNumChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpAckNumChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpAckNumCounter().msg() - } - - if value == PatternFlowTcpAckNumChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpAckNumCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpAckNum) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpAckNumChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpAckNum) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpAckNum object -func (obj *patternFlowTcpAckNum) SetValue(value uint32) PatternFlowTcpAckNum { - obj.setChoice(PatternFlowTcpAckNumChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpAckNum) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpAckNum object -func (obj *patternFlowTcpAckNum) SetValues(value []uint32) PatternFlowTcpAckNum { - obj.setChoice(PatternFlowTcpAckNumChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpAckNumCounter -func (obj *patternFlowTcpAckNum) Increment() PatternFlowTcpAckNumCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpAckNumChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpAckNumCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpAckNumCounter -func (obj *patternFlowTcpAckNum) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpAckNumCounter value in the PatternFlowTcpAckNum object -func (obj *patternFlowTcpAckNum) SetIncrement(value PatternFlowTcpAckNumCounter) PatternFlowTcpAckNum { - obj.setChoice(PatternFlowTcpAckNumChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpAckNumCounter -func (obj *patternFlowTcpAckNum) Decrement() PatternFlowTcpAckNumCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpAckNumChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpAckNumCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpAckNumCounter -func (obj *patternFlowTcpAckNum) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpAckNumCounter value in the PatternFlowTcpAckNum object -func (obj *patternFlowTcpAckNum) SetDecrement(value PatternFlowTcpAckNumCounter) PatternFlowTcpAckNum { - obj.setChoice(PatternFlowTcpAckNumChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpAckNumMetricTag -func (obj *patternFlowTcpAckNum) MetricTags() PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpAckNumMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter struct { - obj *patternFlowTcpAckNum - patternFlowTcpAckNumMetricTagSlice []PatternFlowTcpAckNumMetricTag - fieldPtr *[]*otg.PatternFlowTcpAckNumMetricTag -} - -func newPatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter(ptr *[]*otg.PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { - return &patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter interface { - setMsg(*patternFlowTcpAckNum) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter - Items() []PatternFlowTcpAckNumMetricTag - Add() PatternFlowTcpAckNumMetricTag - Append(items ...PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter - Set(index int, newObj PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter - Clear() PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter - clearHolderSlice() PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter - appendHolderSlice(item PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter -} - -func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) setMsg(msg *patternFlowTcpAckNum) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpAckNumMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) Items() []PatternFlowTcpAckNumMetricTag { - return obj.patternFlowTcpAckNumMetricTagSlice -} - -func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) Add() PatternFlowTcpAckNumMetricTag { - newObj := &otg.PatternFlowTcpAckNumMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpAckNumMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpAckNumMetricTagSlice = append(obj.patternFlowTcpAckNumMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) Append(items ...PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpAckNumMetricTagSlice = append(obj.patternFlowTcpAckNumMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) Set(index int, newObj PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpAckNumMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) Clear() PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpAckNumMetricTag{} - obj.patternFlowTcpAckNumMetricTagSlice = []PatternFlowTcpAckNumMetricTag{} - } - return obj -} -func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) clearHolderSlice() PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { - if len(obj.patternFlowTcpAckNumMetricTagSlice) > 0 { - obj.patternFlowTcpAckNumMetricTagSlice = []PatternFlowTcpAckNumMetricTag{} - } - return obj -} -func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) appendHolderSlice(item PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { - obj.patternFlowTcpAckNumMetricTagSlice = append(obj.patternFlowTcpAckNumMetricTagSlice, item) - return obj -} - -func (obj *patternFlowTcpAckNum) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpAckNumMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowTcpAckNum) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpAckNumChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpAckNumChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpAckNumChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpAckNumChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpAckNumChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpAckNumChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpAckNum") - } - } else { - intVal := otg.PatternFlowTcpAckNum_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpAckNum_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpDataOffset ***** -type patternFlowTcpDataOffset struct { - validation - obj *otg.PatternFlowTcpDataOffset - marshaller marshalPatternFlowTcpDataOffset - unMarshaller unMarshalPatternFlowTcpDataOffset - incrementHolder PatternFlowTcpDataOffsetCounter - decrementHolder PatternFlowTcpDataOffsetCounter - metricTagsHolder PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter -} - -func NewPatternFlowTcpDataOffset() PatternFlowTcpDataOffset { - obj := patternFlowTcpDataOffset{obj: &otg.PatternFlowTcpDataOffset{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpDataOffset) msg() *otg.PatternFlowTcpDataOffset { - return obj.obj -} - -func (obj *patternFlowTcpDataOffset) setMsg(msg *otg.PatternFlowTcpDataOffset) PatternFlowTcpDataOffset { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpDataOffset struct { - obj *patternFlowTcpDataOffset -} - -type marshalPatternFlowTcpDataOffset interface { - // ToProto marshals PatternFlowTcpDataOffset to protobuf object *otg.PatternFlowTcpDataOffset - ToProto() (*otg.PatternFlowTcpDataOffset, error) - // ToPbText marshals PatternFlowTcpDataOffset to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpDataOffset to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpDataOffset to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpDataOffset struct { - obj *patternFlowTcpDataOffset -} - -type unMarshalPatternFlowTcpDataOffset interface { - // FromProto unmarshals PatternFlowTcpDataOffset from protobuf object *otg.PatternFlowTcpDataOffset - FromProto(msg *otg.PatternFlowTcpDataOffset) (PatternFlowTcpDataOffset, error) - // FromPbText unmarshals PatternFlowTcpDataOffset from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpDataOffset from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpDataOffset from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpDataOffset) Marshal() marshalPatternFlowTcpDataOffset { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpDataOffset{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpDataOffset) Unmarshal() unMarshalPatternFlowTcpDataOffset { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpDataOffset{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpDataOffset) ToProto() (*otg.PatternFlowTcpDataOffset, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpDataOffset) FromProto(msg *otg.PatternFlowTcpDataOffset) (PatternFlowTcpDataOffset, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpDataOffset) 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 *unMarshalpatternFlowTcpDataOffset) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpDataOffset) 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 *unMarshalpatternFlowTcpDataOffset) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpDataOffset) 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 *unMarshalpatternFlowTcpDataOffset) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpDataOffset) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpDataOffset) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpDataOffset) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpDataOffset) Clone() (PatternFlowTcpDataOffset, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpDataOffset() - 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 -} - -func (obj *patternFlowTcpDataOffset) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpDataOffset is the number of 32 bit words in the TCP header. This indicates where the data begins. -type PatternFlowTcpDataOffset interface { - Validation - // msg marshals PatternFlowTcpDataOffset to protobuf object *otg.PatternFlowTcpDataOffset - // and doesn't set defaults - msg() *otg.PatternFlowTcpDataOffset - // setMsg unmarshals PatternFlowTcpDataOffset from protobuf object *otg.PatternFlowTcpDataOffset - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpDataOffset) PatternFlowTcpDataOffset - // provides marshal interface - Marshal() marshalPatternFlowTcpDataOffset - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpDataOffset - // validate validates PatternFlowTcpDataOffset - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpDataOffset, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpDataOffsetChoiceEnum, set in PatternFlowTcpDataOffset - Choice() PatternFlowTcpDataOffsetChoiceEnum - // setChoice assigns PatternFlowTcpDataOffsetChoiceEnum provided by user to PatternFlowTcpDataOffset - setChoice(value PatternFlowTcpDataOffsetChoiceEnum) PatternFlowTcpDataOffset - // HasChoice checks if Choice has been set in PatternFlowTcpDataOffset - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpDataOffset. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpDataOffset - SetValue(value uint32) PatternFlowTcpDataOffset - // HasValue checks if Value has been set in PatternFlowTcpDataOffset - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpDataOffset. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpDataOffset - SetValues(value []uint32) PatternFlowTcpDataOffset - // Increment returns PatternFlowTcpDataOffsetCounter, set in PatternFlowTcpDataOffset. - // PatternFlowTcpDataOffsetCounter is integer counter pattern - Increment() PatternFlowTcpDataOffsetCounter - // SetIncrement assigns PatternFlowTcpDataOffsetCounter provided by user to PatternFlowTcpDataOffset. - // PatternFlowTcpDataOffsetCounter is integer counter pattern - SetIncrement(value PatternFlowTcpDataOffsetCounter) PatternFlowTcpDataOffset - // HasIncrement checks if Increment has been set in PatternFlowTcpDataOffset - HasIncrement() bool - // Decrement returns PatternFlowTcpDataOffsetCounter, set in PatternFlowTcpDataOffset. - // PatternFlowTcpDataOffsetCounter is integer counter pattern - Decrement() PatternFlowTcpDataOffsetCounter - // SetDecrement assigns PatternFlowTcpDataOffsetCounter provided by user to PatternFlowTcpDataOffset. - // PatternFlowTcpDataOffsetCounter is integer counter pattern - SetDecrement(value PatternFlowTcpDataOffsetCounter) PatternFlowTcpDataOffset - // HasDecrement checks if Decrement has been set in PatternFlowTcpDataOffset - HasDecrement() bool - // MetricTags returns PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIterIter, set in PatternFlowTcpDataOffset - MetricTags() PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter - setNil() -} - -type PatternFlowTcpDataOffsetChoiceEnum string - -// Enum of Choice on PatternFlowTcpDataOffset -var PatternFlowTcpDataOffsetChoice = struct { - VALUE PatternFlowTcpDataOffsetChoiceEnum - VALUES PatternFlowTcpDataOffsetChoiceEnum - INCREMENT PatternFlowTcpDataOffsetChoiceEnum - DECREMENT PatternFlowTcpDataOffsetChoiceEnum -}{ - VALUE: PatternFlowTcpDataOffsetChoiceEnum("value"), - VALUES: PatternFlowTcpDataOffsetChoiceEnum("values"), - INCREMENT: PatternFlowTcpDataOffsetChoiceEnum("increment"), - DECREMENT: PatternFlowTcpDataOffsetChoiceEnum("decrement"), -} - -func (obj *patternFlowTcpDataOffset) Choice() PatternFlowTcpDataOffsetChoiceEnum { - return PatternFlowTcpDataOffsetChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpDataOffset) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpDataOffset) setChoice(value PatternFlowTcpDataOffsetChoiceEnum) PatternFlowTcpDataOffset { - intValue, ok := otg.PatternFlowTcpDataOffset_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpDataOffsetChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpDataOffset_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpDataOffsetChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpDataOffsetChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpDataOffsetChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpDataOffsetCounter().msg() - } - - if value == PatternFlowTcpDataOffsetChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpDataOffsetCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpDataOffset) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpDataOffsetChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpDataOffset) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpDataOffset object -func (obj *patternFlowTcpDataOffset) SetValue(value uint32) PatternFlowTcpDataOffset { - obj.setChoice(PatternFlowTcpDataOffsetChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpDataOffset) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpDataOffset object -func (obj *patternFlowTcpDataOffset) SetValues(value []uint32) PatternFlowTcpDataOffset { - obj.setChoice(PatternFlowTcpDataOffsetChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpDataOffsetCounter -func (obj *patternFlowTcpDataOffset) Increment() PatternFlowTcpDataOffsetCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpDataOffsetChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpDataOffsetCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpDataOffsetCounter -func (obj *patternFlowTcpDataOffset) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpDataOffsetCounter value in the PatternFlowTcpDataOffset object -func (obj *patternFlowTcpDataOffset) SetIncrement(value PatternFlowTcpDataOffsetCounter) PatternFlowTcpDataOffset { - obj.setChoice(PatternFlowTcpDataOffsetChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpDataOffsetCounter -func (obj *patternFlowTcpDataOffset) Decrement() PatternFlowTcpDataOffsetCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpDataOffsetChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpDataOffsetCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpDataOffsetCounter -func (obj *patternFlowTcpDataOffset) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpDataOffsetCounter value in the PatternFlowTcpDataOffset object -func (obj *patternFlowTcpDataOffset) SetDecrement(value PatternFlowTcpDataOffsetCounter) PatternFlowTcpDataOffset { - obj.setChoice(PatternFlowTcpDataOffsetChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpDataOffsetMetricTag -func (obj *patternFlowTcpDataOffset) MetricTags() PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpDataOffsetMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter struct { - obj *patternFlowTcpDataOffset - patternFlowTcpDataOffsetMetricTagSlice []PatternFlowTcpDataOffsetMetricTag - fieldPtr *[]*otg.PatternFlowTcpDataOffsetMetricTag -} - -func newPatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter(ptr *[]*otg.PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { - return &patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter interface { - setMsg(*patternFlowTcpDataOffset) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter - Items() []PatternFlowTcpDataOffsetMetricTag - Add() PatternFlowTcpDataOffsetMetricTag - Append(items ...PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter - Set(index int, newObj PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter - Clear() PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter - clearHolderSlice() PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter - appendHolderSlice(item PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter -} - -func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) setMsg(msg *patternFlowTcpDataOffset) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpDataOffsetMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) Items() []PatternFlowTcpDataOffsetMetricTag { - return obj.patternFlowTcpDataOffsetMetricTagSlice -} - -func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) Add() PatternFlowTcpDataOffsetMetricTag { - newObj := &otg.PatternFlowTcpDataOffsetMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpDataOffsetMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpDataOffsetMetricTagSlice = append(obj.patternFlowTcpDataOffsetMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) Append(items ...PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpDataOffsetMetricTagSlice = append(obj.patternFlowTcpDataOffsetMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) Set(index int, newObj PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpDataOffsetMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) Clear() PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpDataOffsetMetricTag{} - obj.patternFlowTcpDataOffsetMetricTagSlice = []PatternFlowTcpDataOffsetMetricTag{} - } - return obj -} -func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) clearHolderSlice() PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { - if len(obj.patternFlowTcpDataOffsetMetricTagSlice) > 0 { - obj.patternFlowTcpDataOffsetMetricTagSlice = []PatternFlowTcpDataOffsetMetricTag{} - } - return obj -} -func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) appendHolderSlice(item PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { - obj.patternFlowTcpDataOffsetMetricTagSlice = append(obj.patternFlowTcpDataOffsetMetricTagSlice, item) - return obj -} - -func (obj *patternFlowTcpDataOffset) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpDataOffset.Value <= 15 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowTcpDataOffset.Values <= 15 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpDataOffsetMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowTcpDataOffset) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpDataOffsetChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpDataOffsetChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpDataOffsetChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpDataOffsetChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpDataOffsetChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpDataOffsetChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpDataOffset") - } - } else { - intVal := otg.PatternFlowTcpDataOffset_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpDataOffset_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpEcnNs ***** -type patternFlowTcpEcnNs struct { - validation - obj *otg.PatternFlowTcpEcnNs - marshaller marshalPatternFlowTcpEcnNs - unMarshaller unMarshalPatternFlowTcpEcnNs - incrementHolder PatternFlowTcpEcnNsCounter - decrementHolder PatternFlowTcpEcnNsCounter - metricTagsHolder PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter -} - -func NewPatternFlowTcpEcnNs() PatternFlowTcpEcnNs { - obj := patternFlowTcpEcnNs{obj: &otg.PatternFlowTcpEcnNs{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpEcnNs) msg() *otg.PatternFlowTcpEcnNs { - return obj.obj -} - -func (obj *patternFlowTcpEcnNs) setMsg(msg *otg.PatternFlowTcpEcnNs) PatternFlowTcpEcnNs { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpEcnNs struct { - obj *patternFlowTcpEcnNs -} - -type marshalPatternFlowTcpEcnNs interface { - // ToProto marshals PatternFlowTcpEcnNs to protobuf object *otg.PatternFlowTcpEcnNs - ToProto() (*otg.PatternFlowTcpEcnNs, error) - // ToPbText marshals PatternFlowTcpEcnNs to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpEcnNs to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpEcnNs to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpEcnNs struct { - obj *patternFlowTcpEcnNs -} - -type unMarshalPatternFlowTcpEcnNs interface { - // FromProto unmarshals PatternFlowTcpEcnNs from protobuf object *otg.PatternFlowTcpEcnNs - FromProto(msg *otg.PatternFlowTcpEcnNs) (PatternFlowTcpEcnNs, error) - // FromPbText unmarshals PatternFlowTcpEcnNs from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpEcnNs from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpEcnNs from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpEcnNs) Marshal() marshalPatternFlowTcpEcnNs { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpEcnNs{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpEcnNs) Unmarshal() unMarshalPatternFlowTcpEcnNs { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpEcnNs{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpEcnNs) ToProto() (*otg.PatternFlowTcpEcnNs, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpEcnNs) FromProto(msg *otg.PatternFlowTcpEcnNs) (PatternFlowTcpEcnNs, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpEcnNs) 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 *unMarshalpatternFlowTcpEcnNs) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpEcnNs) 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 *unMarshalpatternFlowTcpEcnNs) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpEcnNs) 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 *unMarshalpatternFlowTcpEcnNs) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpEcnNs) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnNs) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnNs) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpEcnNs) Clone() (PatternFlowTcpEcnNs, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpEcnNs() - 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 -} - -func (obj *patternFlowTcpEcnNs) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpEcnNs is explicit congestion notification, concealment protection. -type PatternFlowTcpEcnNs interface { - Validation - // msg marshals PatternFlowTcpEcnNs to protobuf object *otg.PatternFlowTcpEcnNs - // and doesn't set defaults - msg() *otg.PatternFlowTcpEcnNs - // setMsg unmarshals PatternFlowTcpEcnNs from protobuf object *otg.PatternFlowTcpEcnNs - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpEcnNs) PatternFlowTcpEcnNs - // provides marshal interface - Marshal() marshalPatternFlowTcpEcnNs - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpEcnNs - // validate validates PatternFlowTcpEcnNs - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpEcnNs, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpEcnNsChoiceEnum, set in PatternFlowTcpEcnNs - Choice() PatternFlowTcpEcnNsChoiceEnum - // setChoice assigns PatternFlowTcpEcnNsChoiceEnum provided by user to PatternFlowTcpEcnNs - setChoice(value PatternFlowTcpEcnNsChoiceEnum) PatternFlowTcpEcnNs - // HasChoice checks if Choice has been set in PatternFlowTcpEcnNs - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpEcnNs. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpEcnNs - SetValue(value uint32) PatternFlowTcpEcnNs - // HasValue checks if Value has been set in PatternFlowTcpEcnNs - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpEcnNs. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpEcnNs - SetValues(value []uint32) PatternFlowTcpEcnNs - // Increment returns PatternFlowTcpEcnNsCounter, set in PatternFlowTcpEcnNs. - // PatternFlowTcpEcnNsCounter is integer counter pattern - Increment() PatternFlowTcpEcnNsCounter - // SetIncrement assigns PatternFlowTcpEcnNsCounter provided by user to PatternFlowTcpEcnNs. - // PatternFlowTcpEcnNsCounter is integer counter pattern - SetIncrement(value PatternFlowTcpEcnNsCounter) PatternFlowTcpEcnNs - // HasIncrement checks if Increment has been set in PatternFlowTcpEcnNs - HasIncrement() bool - // Decrement returns PatternFlowTcpEcnNsCounter, set in PatternFlowTcpEcnNs. - // PatternFlowTcpEcnNsCounter is integer counter pattern - Decrement() PatternFlowTcpEcnNsCounter - // SetDecrement assigns PatternFlowTcpEcnNsCounter provided by user to PatternFlowTcpEcnNs. - // PatternFlowTcpEcnNsCounter is integer counter pattern - SetDecrement(value PatternFlowTcpEcnNsCounter) PatternFlowTcpEcnNs - // HasDecrement checks if Decrement has been set in PatternFlowTcpEcnNs - HasDecrement() bool - // MetricTags returns PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIterIter, set in PatternFlowTcpEcnNs - MetricTags() PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter - setNil() -} - -type PatternFlowTcpEcnNsChoiceEnum string - -// Enum of Choice on PatternFlowTcpEcnNs -var PatternFlowTcpEcnNsChoice = struct { - VALUE PatternFlowTcpEcnNsChoiceEnum - VALUES PatternFlowTcpEcnNsChoiceEnum - INCREMENT PatternFlowTcpEcnNsChoiceEnum - DECREMENT PatternFlowTcpEcnNsChoiceEnum -}{ - VALUE: PatternFlowTcpEcnNsChoiceEnum("value"), - VALUES: PatternFlowTcpEcnNsChoiceEnum("values"), - INCREMENT: PatternFlowTcpEcnNsChoiceEnum("increment"), - DECREMENT: PatternFlowTcpEcnNsChoiceEnum("decrement"), -} - -func (obj *patternFlowTcpEcnNs) Choice() PatternFlowTcpEcnNsChoiceEnum { - return PatternFlowTcpEcnNsChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpEcnNs) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpEcnNs) setChoice(value PatternFlowTcpEcnNsChoiceEnum) PatternFlowTcpEcnNs { - intValue, ok := otg.PatternFlowTcpEcnNs_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpEcnNsChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpEcnNs_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpEcnNsChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpEcnNsChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpEcnNsChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpEcnNsCounter().msg() - } - - if value == PatternFlowTcpEcnNsChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpEcnNsCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpEcnNs) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpEcnNsChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpEcnNs) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpEcnNs object -func (obj *patternFlowTcpEcnNs) SetValue(value uint32) PatternFlowTcpEcnNs { - obj.setChoice(PatternFlowTcpEcnNsChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpEcnNs) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpEcnNs object -func (obj *patternFlowTcpEcnNs) SetValues(value []uint32) PatternFlowTcpEcnNs { - obj.setChoice(PatternFlowTcpEcnNsChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpEcnNsCounter -func (obj *patternFlowTcpEcnNs) Increment() PatternFlowTcpEcnNsCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpEcnNsChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpEcnNsCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpEcnNsCounter -func (obj *patternFlowTcpEcnNs) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpEcnNsCounter value in the PatternFlowTcpEcnNs object -func (obj *patternFlowTcpEcnNs) SetIncrement(value PatternFlowTcpEcnNsCounter) PatternFlowTcpEcnNs { - obj.setChoice(PatternFlowTcpEcnNsChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpEcnNsCounter -func (obj *patternFlowTcpEcnNs) Decrement() PatternFlowTcpEcnNsCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpEcnNsChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpEcnNsCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpEcnNsCounter -func (obj *patternFlowTcpEcnNs) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpEcnNsCounter value in the PatternFlowTcpEcnNs object -func (obj *patternFlowTcpEcnNs) SetDecrement(value PatternFlowTcpEcnNsCounter) PatternFlowTcpEcnNs { - obj.setChoice(PatternFlowTcpEcnNsChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpEcnNsMetricTag -func (obj *patternFlowTcpEcnNs) MetricTags() PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpEcnNsMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter struct { - obj *patternFlowTcpEcnNs - patternFlowTcpEcnNsMetricTagSlice []PatternFlowTcpEcnNsMetricTag - fieldPtr *[]*otg.PatternFlowTcpEcnNsMetricTag -} - -func newPatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter(ptr *[]*otg.PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { - return &patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter interface { - setMsg(*patternFlowTcpEcnNs) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter - Items() []PatternFlowTcpEcnNsMetricTag - Add() PatternFlowTcpEcnNsMetricTag - Append(items ...PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter - Set(index int, newObj PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter - Clear() PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter - clearHolderSlice() PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter - appendHolderSlice(item PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter -} - -func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) setMsg(msg *patternFlowTcpEcnNs) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpEcnNsMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) Items() []PatternFlowTcpEcnNsMetricTag { - return obj.patternFlowTcpEcnNsMetricTagSlice -} - -func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) Add() PatternFlowTcpEcnNsMetricTag { - newObj := &otg.PatternFlowTcpEcnNsMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpEcnNsMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpEcnNsMetricTagSlice = append(obj.patternFlowTcpEcnNsMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) Append(items ...PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpEcnNsMetricTagSlice = append(obj.patternFlowTcpEcnNsMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) Set(index int, newObj PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpEcnNsMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) Clear() PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpEcnNsMetricTag{} - obj.patternFlowTcpEcnNsMetricTagSlice = []PatternFlowTcpEcnNsMetricTag{} - } - return obj -} -func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) clearHolderSlice() PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { - if len(obj.patternFlowTcpEcnNsMetricTagSlice) > 0 { - obj.patternFlowTcpEcnNsMetricTagSlice = []PatternFlowTcpEcnNsMetricTag{} - } - return obj -} -func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) appendHolderSlice(item PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { - obj.patternFlowTcpEcnNsMetricTagSlice = append(obj.patternFlowTcpEcnNsMetricTagSlice, item) - return obj -} - -func (obj *patternFlowTcpEcnNs) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnNs.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowTcpEcnNs.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpEcnNsMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowTcpEcnNs) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpEcnNsChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpEcnNsChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpEcnNsChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpEcnNsChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpEcnNsChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpEcnNsChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpEcnNs") - } - } else { - intVal := otg.PatternFlowTcpEcnNs_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpEcnNs_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpEcnCwr ***** -type patternFlowTcpEcnCwr struct { - validation - obj *otg.PatternFlowTcpEcnCwr - marshaller marshalPatternFlowTcpEcnCwr - unMarshaller unMarshalPatternFlowTcpEcnCwr - incrementHolder PatternFlowTcpEcnCwrCounter - decrementHolder PatternFlowTcpEcnCwrCounter - metricTagsHolder PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter -} - -func NewPatternFlowTcpEcnCwr() PatternFlowTcpEcnCwr { - obj := patternFlowTcpEcnCwr{obj: &otg.PatternFlowTcpEcnCwr{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpEcnCwr) msg() *otg.PatternFlowTcpEcnCwr { - return obj.obj -} - -func (obj *patternFlowTcpEcnCwr) setMsg(msg *otg.PatternFlowTcpEcnCwr) PatternFlowTcpEcnCwr { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpEcnCwr struct { - obj *patternFlowTcpEcnCwr -} - -type marshalPatternFlowTcpEcnCwr interface { - // ToProto marshals PatternFlowTcpEcnCwr to protobuf object *otg.PatternFlowTcpEcnCwr - ToProto() (*otg.PatternFlowTcpEcnCwr, error) - // ToPbText marshals PatternFlowTcpEcnCwr to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpEcnCwr to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpEcnCwr to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpEcnCwr struct { - obj *patternFlowTcpEcnCwr -} - -type unMarshalPatternFlowTcpEcnCwr interface { - // FromProto unmarshals PatternFlowTcpEcnCwr from protobuf object *otg.PatternFlowTcpEcnCwr - FromProto(msg *otg.PatternFlowTcpEcnCwr) (PatternFlowTcpEcnCwr, error) - // FromPbText unmarshals PatternFlowTcpEcnCwr from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpEcnCwr from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpEcnCwr from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpEcnCwr) Marshal() marshalPatternFlowTcpEcnCwr { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpEcnCwr{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpEcnCwr) Unmarshal() unMarshalPatternFlowTcpEcnCwr { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpEcnCwr{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpEcnCwr) ToProto() (*otg.PatternFlowTcpEcnCwr, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpEcnCwr) FromProto(msg *otg.PatternFlowTcpEcnCwr) (PatternFlowTcpEcnCwr, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpEcnCwr) 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 *unMarshalpatternFlowTcpEcnCwr) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpEcnCwr) 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 *unMarshalpatternFlowTcpEcnCwr) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpEcnCwr) 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 *unMarshalpatternFlowTcpEcnCwr) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpEcnCwr) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnCwr) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnCwr) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpEcnCwr) Clone() (PatternFlowTcpEcnCwr, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpEcnCwr() - 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 -} - -func (obj *patternFlowTcpEcnCwr) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpEcnCwr is explicit congestion notification, congestion window reduced. -type PatternFlowTcpEcnCwr interface { - Validation - // msg marshals PatternFlowTcpEcnCwr to protobuf object *otg.PatternFlowTcpEcnCwr - // and doesn't set defaults - msg() *otg.PatternFlowTcpEcnCwr - // setMsg unmarshals PatternFlowTcpEcnCwr from protobuf object *otg.PatternFlowTcpEcnCwr - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpEcnCwr) PatternFlowTcpEcnCwr - // provides marshal interface - Marshal() marshalPatternFlowTcpEcnCwr - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpEcnCwr - // validate validates PatternFlowTcpEcnCwr - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpEcnCwr, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpEcnCwrChoiceEnum, set in PatternFlowTcpEcnCwr - Choice() PatternFlowTcpEcnCwrChoiceEnum - // setChoice assigns PatternFlowTcpEcnCwrChoiceEnum provided by user to PatternFlowTcpEcnCwr - setChoice(value PatternFlowTcpEcnCwrChoiceEnum) PatternFlowTcpEcnCwr - // HasChoice checks if Choice has been set in PatternFlowTcpEcnCwr - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpEcnCwr. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpEcnCwr - SetValue(value uint32) PatternFlowTcpEcnCwr - // HasValue checks if Value has been set in PatternFlowTcpEcnCwr - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpEcnCwr. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpEcnCwr - SetValues(value []uint32) PatternFlowTcpEcnCwr - // Increment returns PatternFlowTcpEcnCwrCounter, set in PatternFlowTcpEcnCwr. - // PatternFlowTcpEcnCwrCounter is integer counter pattern - Increment() PatternFlowTcpEcnCwrCounter - // SetIncrement assigns PatternFlowTcpEcnCwrCounter provided by user to PatternFlowTcpEcnCwr. - // PatternFlowTcpEcnCwrCounter is integer counter pattern - SetIncrement(value PatternFlowTcpEcnCwrCounter) PatternFlowTcpEcnCwr - // HasIncrement checks if Increment has been set in PatternFlowTcpEcnCwr - HasIncrement() bool - // Decrement returns PatternFlowTcpEcnCwrCounter, set in PatternFlowTcpEcnCwr. - // PatternFlowTcpEcnCwrCounter is integer counter pattern - Decrement() PatternFlowTcpEcnCwrCounter - // SetDecrement assigns PatternFlowTcpEcnCwrCounter provided by user to PatternFlowTcpEcnCwr. - // PatternFlowTcpEcnCwrCounter is integer counter pattern - SetDecrement(value PatternFlowTcpEcnCwrCounter) PatternFlowTcpEcnCwr - // HasDecrement checks if Decrement has been set in PatternFlowTcpEcnCwr - HasDecrement() bool - // MetricTags returns PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIterIter, set in PatternFlowTcpEcnCwr - MetricTags() PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter - setNil() -} - -type PatternFlowTcpEcnCwrChoiceEnum string - -// Enum of Choice on PatternFlowTcpEcnCwr -var PatternFlowTcpEcnCwrChoice = struct { - VALUE PatternFlowTcpEcnCwrChoiceEnum - VALUES PatternFlowTcpEcnCwrChoiceEnum - INCREMENT PatternFlowTcpEcnCwrChoiceEnum - DECREMENT PatternFlowTcpEcnCwrChoiceEnum -}{ - VALUE: PatternFlowTcpEcnCwrChoiceEnum("value"), - VALUES: PatternFlowTcpEcnCwrChoiceEnum("values"), - INCREMENT: PatternFlowTcpEcnCwrChoiceEnum("increment"), - DECREMENT: PatternFlowTcpEcnCwrChoiceEnum("decrement"), -} - -func (obj *patternFlowTcpEcnCwr) Choice() PatternFlowTcpEcnCwrChoiceEnum { - return PatternFlowTcpEcnCwrChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpEcnCwr) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpEcnCwr) setChoice(value PatternFlowTcpEcnCwrChoiceEnum) PatternFlowTcpEcnCwr { - intValue, ok := otg.PatternFlowTcpEcnCwr_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpEcnCwrChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpEcnCwr_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpEcnCwrChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpEcnCwrChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpEcnCwrChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpEcnCwrCounter().msg() - } - - if value == PatternFlowTcpEcnCwrChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpEcnCwrCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpEcnCwr) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpEcnCwrChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpEcnCwr) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpEcnCwr object -func (obj *patternFlowTcpEcnCwr) SetValue(value uint32) PatternFlowTcpEcnCwr { - obj.setChoice(PatternFlowTcpEcnCwrChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpEcnCwr) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpEcnCwr object -func (obj *patternFlowTcpEcnCwr) SetValues(value []uint32) PatternFlowTcpEcnCwr { - obj.setChoice(PatternFlowTcpEcnCwrChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpEcnCwrCounter -func (obj *patternFlowTcpEcnCwr) Increment() PatternFlowTcpEcnCwrCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpEcnCwrChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpEcnCwrCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpEcnCwrCounter -func (obj *patternFlowTcpEcnCwr) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpEcnCwrCounter value in the PatternFlowTcpEcnCwr object -func (obj *patternFlowTcpEcnCwr) SetIncrement(value PatternFlowTcpEcnCwrCounter) PatternFlowTcpEcnCwr { - obj.setChoice(PatternFlowTcpEcnCwrChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpEcnCwrCounter -func (obj *patternFlowTcpEcnCwr) Decrement() PatternFlowTcpEcnCwrCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpEcnCwrChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpEcnCwrCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpEcnCwrCounter -func (obj *patternFlowTcpEcnCwr) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpEcnCwrCounter value in the PatternFlowTcpEcnCwr object -func (obj *patternFlowTcpEcnCwr) SetDecrement(value PatternFlowTcpEcnCwrCounter) PatternFlowTcpEcnCwr { - obj.setChoice(PatternFlowTcpEcnCwrChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpEcnCwrMetricTag -func (obj *patternFlowTcpEcnCwr) MetricTags() PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpEcnCwrMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter struct { - obj *patternFlowTcpEcnCwr - patternFlowTcpEcnCwrMetricTagSlice []PatternFlowTcpEcnCwrMetricTag - fieldPtr *[]*otg.PatternFlowTcpEcnCwrMetricTag -} - -func newPatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter(ptr *[]*otg.PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { - return &patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter interface { - setMsg(*patternFlowTcpEcnCwr) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter - Items() []PatternFlowTcpEcnCwrMetricTag - Add() PatternFlowTcpEcnCwrMetricTag - Append(items ...PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter - Set(index int, newObj PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter - Clear() PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter - clearHolderSlice() PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter - appendHolderSlice(item PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter -} - -func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) setMsg(msg *patternFlowTcpEcnCwr) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpEcnCwrMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) Items() []PatternFlowTcpEcnCwrMetricTag { - return obj.patternFlowTcpEcnCwrMetricTagSlice -} - -func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) Add() PatternFlowTcpEcnCwrMetricTag { - newObj := &otg.PatternFlowTcpEcnCwrMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpEcnCwrMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpEcnCwrMetricTagSlice = append(obj.patternFlowTcpEcnCwrMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) Append(items ...PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpEcnCwrMetricTagSlice = append(obj.patternFlowTcpEcnCwrMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) Set(index int, newObj PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpEcnCwrMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) Clear() PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpEcnCwrMetricTag{} - obj.patternFlowTcpEcnCwrMetricTagSlice = []PatternFlowTcpEcnCwrMetricTag{} - } - return obj -} -func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) clearHolderSlice() PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { - if len(obj.patternFlowTcpEcnCwrMetricTagSlice) > 0 { - obj.patternFlowTcpEcnCwrMetricTagSlice = []PatternFlowTcpEcnCwrMetricTag{} - } - return obj -} -func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) appendHolderSlice(item PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { - obj.patternFlowTcpEcnCwrMetricTagSlice = append(obj.patternFlowTcpEcnCwrMetricTagSlice, item) - return obj -} - -func (obj *patternFlowTcpEcnCwr) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnCwr.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowTcpEcnCwr.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpEcnCwrMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowTcpEcnCwr) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpEcnCwrChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpEcnCwrChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpEcnCwrChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpEcnCwrChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpEcnCwrChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpEcnCwrChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpEcnCwr") - } - } else { - intVal := otg.PatternFlowTcpEcnCwr_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpEcnCwr_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpEcnEcho ***** -type patternFlowTcpEcnEcho struct { - validation - obj *otg.PatternFlowTcpEcnEcho - marshaller marshalPatternFlowTcpEcnEcho - unMarshaller unMarshalPatternFlowTcpEcnEcho - incrementHolder PatternFlowTcpEcnEchoCounter - decrementHolder PatternFlowTcpEcnEchoCounter - metricTagsHolder PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter -} - -func NewPatternFlowTcpEcnEcho() PatternFlowTcpEcnEcho { - obj := patternFlowTcpEcnEcho{obj: &otg.PatternFlowTcpEcnEcho{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpEcnEcho) msg() *otg.PatternFlowTcpEcnEcho { - return obj.obj -} - -func (obj *patternFlowTcpEcnEcho) setMsg(msg *otg.PatternFlowTcpEcnEcho) PatternFlowTcpEcnEcho { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpEcnEcho struct { - obj *patternFlowTcpEcnEcho -} - -type marshalPatternFlowTcpEcnEcho interface { - // ToProto marshals PatternFlowTcpEcnEcho to protobuf object *otg.PatternFlowTcpEcnEcho - ToProto() (*otg.PatternFlowTcpEcnEcho, error) - // ToPbText marshals PatternFlowTcpEcnEcho to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpEcnEcho to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpEcnEcho to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpEcnEcho struct { - obj *patternFlowTcpEcnEcho -} - -type unMarshalPatternFlowTcpEcnEcho interface { - // FromProto unmarshals PatternFlowTcpEcnEcho from protobuf object *otg.PatternFlowTcpEcnEcho - FromProto(msg *otg.PatternFlowTcpEcnEcho) (PatternFlowTcpEcnEcho, error) - // FromPbText unmarshals PatternFlowTcpEcnEcho from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpEcnEcho from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpEcnEcho from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpEcnEcho) Marshal() marshalPatternFlowTcpEcnEcho { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpEcnEcho{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpEcnEcho) Unmarshal() unMarshalPatternFlowTcpEcnEcho { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpEcnEcho{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpEcnEcho) ToProto() (*otg.PatternFlowTcpEcnEcho, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpEcnEcho) FromProto(msg *otg.PatternFlowTcpEcnEcho) (PatternFlowTcpEcnEcho, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpEcnEcho) 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 *unMarshalpatternFlowTcpEcnEcho) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpEcnEcho) 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 *unMarshalpatternFlowTcpEcnEcho) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpEcnEcho) 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 *unMarshalpatternFlowTcpEcnEcho) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpEcnEcho) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnEcho) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnEcho) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpEcnEcho) Clone() (PatternFlowTcpEcnEcho, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpEcnEcho() - 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 -} - -func (obj *patternFlowTcpEcnEcho) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpEcnEcho is explicit congestion notification, echo. 1 indicates the peer is ecn capable. 0 indicates that a packet with ipv4.ecn = 11 in the ip header was received during normal transmission. -type PatternFlowTcpEcnEcho interface { - Validation - // msg marshals PatternFlowTcpEcnEcho to protobuf object *otg.PatternFlowTcpEcnEcho - // and doesn't set defaults - msg() *otg.PatternFlowTcpEcnEcho - // setMsg unmarshals PatternFlowTcpEcnEcho from protobuf object *otg.PatternFlowTcpEcnEcho - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpEcnEcho) PatternFlowTcpEcnEcho - // provides marshal interface - Marshal() marshalPatternFlowTcpEcnEcho - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpEcnEcho - // validate validates PatternFlowTcpEcnEcho - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpEcnEcho, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpEcnEchoChoiceEnum, set in PatternFlowTcpEcnEcho - Choice() PatternFlowTcpEcnEchoChoiceEnum - // setChoice assigns PatternFlowTcpEcnEchoChoiceEnum provided by user to PatternFlowTcpEcnEcho - setChoice(value PatternFlowTcpEcnEchoChoiceEnum) PatternFlowTcpEcnEcho - // HasChoice checks if Choice has been set in PatternFlowTcpEcnEcho - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpEcnEcho. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpEcnEcho - SetValue(value uint32) PatternFlowTcpEcnEcho - // HasValue checks if Value has been set in PatternFlowTcpEcnEcho - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpEcnEcho. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpEcnEcho - SetValues(value []uint32) PatternFlowTcpEcnEcho - // Increment returns PatternFlowTcpEcnEchoCounter, set in PatternFlowTcpEcnEcho. - // PatternFlowTcpEcnEchoCounter is integer counter pattern - Increment() PatternFlowTcpEcnEchoCounter - // SetIncrement assigns PatternFlowTcpEcnEchoCounter provided by user to PatternFlowTcpEcnEcho. - // PatternFlowTcpEcnEchoCounter is integer counter pattern - SetIncrement(value PatternFlowTcpEcnEchoCounter) PatternFlowTcpEcnEcho - // HasIncrement checks if Increment has been set in PatternFlowTcpEcnEcho - HasIncrement() bool - // Decrement returns PatternFlowTcpEcnEchoCounter, set in PatternFlowTcpEcnEcho. - // PatternFlowTcpEcnEchoCounter is integer counter pattern - Decrement() PatternFlowTcpEcnEchoCounter - // SetDecrement assigns PatternFlowTcpEcnEchoCounter provided by user to PatternFlowTcpEcnEcho. - // PatternFlowTcpEcnEchoCounter is integer counter pattern - SetDecrement(value PatternFlowTcpEcnEchoCounter) PatternFlowTcpEcnEcho - // HasDecrement checks if Decrement has been set in PatternFlowTcpEcnEcho - HasDecrement() bool - // MetricTags returns PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIterIter, set in PatternFlowTcpEcnEcho - MetricTags() PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter - setNil() -} - -type PatternFlowTcpEcnEchoChoiceEnum string - -// Enum of Choice on PatternFlowTcpEcnEcho -var PatternFlowTcpEcnEchoChoice = struct { - VALUE PatternFlowTcpEcnEchoChoiceEnum - VALUES PatternFlowTcpEcnEchoChoiceEnum - INCREMENT PatternFlowTcpEcnEchoChoiceEnum - DECREMENT PatternFlowTcpEcnEchoChoiceEnum -}{ - VALUE: PatternFlowTcpEcnEchoChoiceEnum("value"), - VALUES: PatternFlowTcpEcnEchoChoiceEnum("values"), - INCREMENT: PatternFlowTcpEcnEchoChoiceEnum("increment"), - DECREMENT: PatternFlowTcpEcnEchoChoiceEnum("decrement"), -} - -func (obj *patternFlowTcpEcnEcho) Choice() PatternFlowTcpEcnEchoChoiceEnum { - return PatternFlowTcpEcnEchoChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpEcnEcho) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpEcnEcho) setChoice(value PatternFlowTcpEcnEchoChoiceEnum) PatternFlowTcpEcnEcho { - intValue, ok := otg.PatternFlowTcpEcnEcho_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpEcnEchoChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpEcnEcho_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpEcnEchoChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpEcnEchoChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpEcnEchoChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpEcnEchoCounter().msg() - } - - if value == PatternFlowTcpEcnEchoChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpEcnEchoCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpEcnEcho) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpEcnEchoChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpEcnEcho) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpEcnEcho object -func (obj *patternFlowTcpEcnEcho) SetValue(value uint32) PatternFlowTcpEcnEcho { - obj.setChoice(PatternFlowTcpEcnEchoChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpEcnEcho) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpEcnEcho object -func (obj *patternFlowTcpEcnEcho) SetValues(value []uint32) PatternFlowTcpEcnEcho { - obj.setChoice(PatternFlowTcpEcnEchoChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpEcnEchoCounter -func (obj *patternFlowTcpEcnEcho) Increment() PatternFlowTcpEcnEchoCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpEcnEchoChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpEcnEchoCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpEcnEchoCounter -func (obj *patternFlowTcpEcnEcho) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpEcnEchoCounter value in the PatternFlowTcpEcnEcho object -func (obj *patternFlowTcpEcnEcho) SetIncrement(value PatternFlowTcpEcnEchoCounter) PatternFlowTcpEcnEcho { - obj.setChoice(PatternFlowTcpEcnEchoChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpEcnEchoCounter -func (obj *patternFlowTcpEcnEcho) Decrement() PatternFlowTcpEcnEchoCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpEcnEchoChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpEcnEchoCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpEcnEchoCounter -func (obj *patternFlowTcpEcnEcho) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpEcnEchoCounter value in the PatternFlowTcpEcnEcho object -func (obj *patternFlowTcpEcnEcho) SetDecrement(value PatternFlowTcpEcnEchoCounter) PatternFlowTcpEcnEcho { - obj.setChoice(PatternFlowTcpEcnEchoChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpEcnEchoMetricTag -func (obj *patternFlowTcpEcnEcho) MetricTags() PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpEcnEchoMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter struct { - obj *patternFlowTcpEcnEcho - patternFlowTcpEcnEchoMetricTagSlice []PatternFlowTcpEcnEchoMetricTag - fieldPtr *[]*otg.PatternFlowTcpEcnEchoMetricTag -} - -func newPatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter(ptr *[]*otg.PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { - return &patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter interface { - setMsg(*patternFlowTcpEcnEcho) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter - Items() []PatternFlowTcpEcnEchoMetricTag - Add() PatternFlowTcpEcnEchoMetricTag - Append(items ...PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter - Set(index int, newObj PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter - Clear() PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter - clearHolderSlice() PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter - appendHolderSlice(item PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter -} - -func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) setMsg(msg *patternFlowTcpEcnEcho) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpEcnEchoMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) Items() []PatternFlowTcpEcnEchoMetricTag { - return obj.patternFlowTcpEcnEchoMetricTagSlice -} - -func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) Add() PatternFlowTcpEcnEchoMetricTag { - newObj := &otg.PatternFlowTcpEcnEchoMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpEcnEchoMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpEcnEchoMetricTagSlice = append(obj.patternFlowTcpEcnEchoMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) Append(items ...PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpEcnEchoMetricTagSlice = append(obj.patternFlowTcpEcnEchoMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) Set(index int, newObj PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpEcnEchoMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) Clear() PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpEcnEchoMetricTag{} - obj.patternFlowTcpEcnEchoMetricTagSlice = []PatternFlowTcpEcnEchoMetricTag{} - } - return obj -} -func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) clearHolderSlice() PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { - if len(obj.patternFlowTcpEcnEchoMetricTagSlice) > 0 { - obj.patternFlowTcpEcnEchoMetricTagSlice = []PatternFlowTcpEcnEchoMetricTag{} - } - return obj -} -func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) appendHolderSlice(item PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { - obj.patternFlowTcpEcnEchoMetricTagSlice = append(obj.patternFlowTcpEcnEchoMetricTagSlice, item) - return obj -} - -func (obj *patternFlowTcpEcnEcho) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnEcho.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowTcpEcnEcho.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpEcnEchoMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowTcpEcnEcho) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpEcnEchoChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpEcnEchoChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpEcnEchoChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpEcnEchoChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpEcnEchoChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpEcnEchoChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpEcnEcho") - } - } else { - intVal := otg.PatternFlowTcpEcnEcho_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpEcnEcho_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpCtlUrg ***** -type patternFlowTcpCtlUrg struct { - validation - obj *otg.PatternFlowTcpCtlUrg - marshaller marshalPatternFlowTcpCtlUrg - unMarshaller unMarshalPatternFlowTcpCtlUrg - incrementHolder PatternFlowTcpCtlUrgCounter - decrementHolder PatternFlowTcpCtlUrgCounter - metricTagsHolder PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter -} - -func NewPatternFlowTcpCtlUrg() PatternFlowTcpCtlUrg { - obj := patternFlowTcpCtlUrg{obj: &otg.PatternFlowTcpCtlUrg{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlUrg) msg() *otg.PatternFlowTcpCtlUrg { - return obj.obj -} - -func (obj *patternFlowTcpCtlUrg) setMsg(msg *otg.PatternFlowTcpCtlUrg) PatternFlowTcpCtlUrg { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlUrg struct { - obj *patternFlowTcpCtlUrg -} - -type marshalPatternFlowTcpCtlUrg interface { - // ToProto marshals PatternFlowTcpCtlUrg to protobuf object *otg.PatternFlowTcpCtlUrg - ToProto() (*otg.PatternFlowTcpCtlUrg, error) - // ToPbText marshals PatternFlowTcpCtlUrg to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlUrg to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlUrg to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlUrg struct { - obj *patternFlowTcpCtlUrg -} - -type unMarshalPatternFlowTcpCtlUrg interface { - // FromProto unmarshals PatternFlowTcpCtlUrg from protobuf object *otg.PatternFlowTcpCtlUrg - FromProto(msg *otg.PatternFlowTcpCtlUrg) (PatternFlowTcpCtlUrg, error) - // FromPbText unmarshals PatternFlowTcpCtlUrg from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlUrg from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlUrg from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlUrg) Marshal() marshalPatternFlowTcpCtlUrg { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlUrg{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlUrg) Unmarshal() unMarshalPatternFlowTcpCtlUrg { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlUrg{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlUrg) ToProto() (*otg.PatternFlowTcpCtlUrg, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlUrg) FromProto(msg *otg.PatternFlowTcpCtlUrg) (PatternFlowTcpCtlUrg, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlUrg) 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 *unMarshalpatternFlowTcpCtlUrg) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpCtlUrg) 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 *unMarshalpatternFlowTcpCtlUrg) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpCtlUrg) 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 *unMarshalpatternFlowTcpCtlUrg) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpCtlUrg) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlUrg) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlUrg) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlUrg) Clone() (PatternFlowTcpCtlUrg, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlUrg() - 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 -} - -func (obj *patternFlowTcpCtlUrg) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpCtlUrg is a value of 1 indicates that the urgent pointer field is significant. -type PatternFlowTcpCtlUrg interface { - Validation - // msg marshals PatternFlowTcpCtlUrg to protobuf object *otg.PatternFlowTcpCtlUrg - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlUrg - // setMsg unmarshals PatternFlowTcpCtlUrg from protobuf object *otg.PatternFlowTcpCtlUrg - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlUrg) PatternFlowTcpCtlUrg - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlUrg - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlUrg - // validate validates PatternFlowTcpCtlUrg - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlUrg, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpCtlUrgChoiceEnum, set in PatternFlowTcpCtlUrg - Choice() PatternFlowTcpCtlUrgChoiceEnum - // setChoice assigns PatternFlowTcpCtlUrgChoiceEnum provided by user to PatternFlowTcpCtlUrg - setChoice(value PatternFlowTcpCtlUrgChoiceEnum) PatternFlowTcpCtlUrg - // HasChoice checks if Choice has been set in PatternFlowTcpCtlUrg - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpCtlUrg. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpCtlUrg - SetValue(value uint32) PatternFlowTcpCtlUrg - // HasValue checks if Value has been set in PatternFlowTcpCtlUrg - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpCtlUrg. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpCtlUrg - SetValues(value []uint32) PatternFlowTcpCtlUrg - // Increment returns PatternFlowTcpCtlUrgCounter, set in PatternFlowTcpCtlUrg. - // PatternFlowTcpCtlUrgCounter is integer counter pattern - Increment() PatternFlowTcpCtlUrgCounter - // SetIncrement assigns PatternFlowTcpCtlUrgCounter provided by user to PatternFlowTcpCtlUrg. - // PatternFlowTcpCtlUrgCounter is integer counter pattern - SetIncrement(value PatternFlowTcpCtlUrgCounter) PatternFlowTcpCtlUrg - // HasIncrement checks if Increment has been set in PatternFlowTcpCtlUrg - HasIncrement() bool - // Decrement returns PatternFlowTcpCtlUrgCounter, set in PatternFlowTcpCtlUrg. - // PatternFlowTcpCtlUrgCounter is integer counter pattern - Decrement() PatternFlowTcpCtlUrgCounter - // SetDecrement assigns PatternFlowTcpCtlUrgCounter provided by user to PatternFlowTcpCtlUrg. - // PatternFlowTcpCtlUrgCounter is integer counter pattern - SetDecrement(value PatternFlowTcpCtlUrgCounter) PatternFlowTcpCtlUrg - // HasDecrement checks if Decrement has been set in PatternFlowTcpCtlUrg - HasDecrement() bool - // MetricTags returns PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIterIter, set in PatternFlowTcpCtlUrg - MetricTags() PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter - setNil() -} - -type PatternFlowTcpCtlUrgChoiceEnum string - -// Enum of Choice on PatternFlowTcpCtlUrg -var PatternFlowTcpCtlUrgChoice = struct { - VALUE PatternFlowTcpCtlUrgChoiceEnum - VALUES PatternFlowTcpCtlUrgChoiceEnum - INCREMENT PatternFlowTcpCtlUrgChoiceEnum - DECREMENT PatternFlowTcpCtlUrgChoiceEnum -}{ - VALUE: PatternFlowTcpCtlUrgChoiceEnum("value"), - VALUES: PatternFlowTcpCtlUrgChoiceEnum("values"), - INCREMENT: PatternFlowTcpCtlUrgChoiceEnum("increment"), - DECREMENT: PatternFlowTcpCtlUrgChoiceEnum("decrement"), -} - -func (obj *patternFlowTcpCtlUrg) Choice() PatternFlowTcpCtlUrgChoiceEnum { - return PatternFlowTcpCtlUrgChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpCtlUrg) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpCtlUrg) setChoice(value PatternFlowTcpCtlUrgChoiceEnum) PatternFlowTcpCtlUrg { - intValue, ok := otg.PatternFlowTcpCtlUrg_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpCtlUrgChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpCtlUrg_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpCtlUrgChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpCtlUrgChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpCtlUrgChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpCtlUrgCounter().msg() - } - - if value == PatternFlowTcpCtlUrgChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpCtlUrgCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpCtlUrg) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpCtlUrgChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpCtlUrg) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpCtlUrg object -func (obj *patternFlowTcpCtlUrg) SetValue(value uint32) PatternFlowTcpCtlUrg { - obj.setChoice(PatternFlowTcpCtlUrgChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpCtlUrg) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpCtlUrg object -func (obj *patternFlowTcpCtlUrg) SetValues(value []uint32) PatternFlowTcpCtlUrg { - obj.setChoice(PatternFlowTcpCtlUrgChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpCtlUrgCounter -func (obj *patternFlowTcpCtlUrg) Increment() PatternFlowTcpCtlUrgCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpCtlUrgChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpCtlUrgCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpCtlUrgCounter -func (obj *patternFlowTcpCtlUrg) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpCtlUrgCounter value in the PatternFlowTcpCtlUrg object -func (obj *patternFlowTcpCtlUrg) SetIncrement(value PatternFlowTcpCtlUrgCounter) PatternFlowTcpCtlUrg { - obj.setChoice(PatternFlowTcpCtlUrgChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpCtlUrgCounter -func (obj *patternFlowTcpCtlUrg) Decrement() PatternFlowTcpCtlUrgCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpCtlUrgChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpCtlUrgCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpCtlUrgCounter -func (obj *patternFlowTcpCtlUrg) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpCtlUrgCounter value in the PatternFlowTcpCtlUrg object -func (obj *patternFlowTcpCtlUrg) SetDecrement(value PatternFlowTcpCtlUrgCounter) PatternFlowTcpCtlUrg { - obj.setChoice(PatternFlowTcpCtlUrgChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpCtlUrgMetricTag -func (obj *patternFlowTcpCtlUrg) MetricTags() PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpCtlUrgMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter struct { - obj *patternFlowTcpCtlUrg - patternFlowTcpCtlUrgMetricTagSlice []PatternFlowTcpCtlUrgMetricTag - fieldPtr *[]*otg.PatternFlowTcpCtlUrgMetricTag -} - -func newPatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter(ptr *[]*otg.PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { - return &patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter interface { - setMsg(*patternFlowTcpCtlUrg) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter - Items() []PatternFlowTcpCtlUrgMetricTag - Add() PatternFlowTcpCtlUrgMetricTag - Append(items ...PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter - Set(index int, newObj PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter - Clear() PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter - clearHolderSlice() PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter - appendHolderSlice(item PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter -} - -func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) setMsg(msg *patternFlowTcpCtlUrg) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpCtlUrgMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) Items() []PatternFlowTcpCtlUrgMetricTag { - return obj.patternFlowTcpCtlUrgMetricTagSlice -} - -func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) Add() PatternFlowTcpCtlUrgMetricTag { - newObj := &otg.PatternFlowTcpCtlUrgMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpCtlUrgMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpCtlUrgMetricTagSlice = append(obj.patternFlowTcpCtlUrgMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) Append(items ...PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpCtlUrgMetricTagSlice = append(obj.patternFlowTcpCtlUrgMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) Set(index int, newObj PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpCtlUrgMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) Clear() PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpCtlUrgMetricTag{} - obj.patternFlowTcpCtlUrgMetricTagSlice = []PatternFlowTcpCtlUrgMetricTag{} - } - return obj -} -func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) clearHolderSlice() PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { - if len(obj.patternFlowTcpCtlUrgMetricTagSlice) > 0 { - obj.patternFlowTcpCtlUrgMetricTagSlice = []PatternFlowTcpCtlUrgMetricTag{} - } - return obj -} -func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) appendHolderSlice(item PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { - obj.patternFlowTcpCtlUrgMetricTagSlice = append(obj.patternFlowTcpCtlUrgMetricTagSlice, item) - return obj -} - -func (obj *patternFlowTcpCtlUrg) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlUrg.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowTcpCtlUrg.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpCtlUrgMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowTcpCtlUrg) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpCtlUrgChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpCtlUrgChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpCtlUrgChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpCtlUrgChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpCtlUrgChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpCtlUrgChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpCtlUrg") - } - } else { - intVal := otg.PatternFlowTcpCtlUrg_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpCtlUrg_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpCtlAck ***** -type patternFlowTcpCtlAck struct { - validation - obj *otg.PatternFlowTcpCtlAck - marshaller marshalPatternFlowTcpCtlAck - unMarshaller unMarshalPatternFlowTcpCtlAck - incrementHolder PatternFlowTcpCtlAckCounter - decrementHolder PatternFlowTcpCtlAckCounter - metricTagsHolder PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter -} - -func NewPatternFlowTcpCtlAck() PatternFlowTcpCtlAck { - obj := patternFlowTcpCtlAck{obj: &otg.PatternFlowTcpCtlAck{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlAck) msg() *otg.PatternFlowTcpCtlAck { - return obj.obj -} - -func (obj *patternFlowTcpCtlAck) setMsg(msg *otg.PatternFlowTcpCtlAck) PatternFlowTcpCtlAck { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlAck struct { - obj *patternFlowTcpCtlAck -} - -type marshalPatternFlowTcpCtlAck interface { - // ToProto marshals PatternFlowTcpCtlAck to protobuf object *otg.PatternFlowTcpCtlAck - ToProto() (*otg.PatternFlowTcpCtlAck, error) - // ToPbText marshals PatternFlowTcpCtlAck to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlAck to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlAck to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlAck struct { - obj *patternFlowTcpCtlAck -} - -type unMarshalPatternFlowTcpCtlAck interface { - // FromProto unmarshals PatternFlowTcpCtlAck from protobuf object *otg.PatternFlowTcpCtlAck - FromProto(msg *otg.PatternFlowTcpCtlAck) (PatternFlowTcpCtlAck, error) - // FromPbText unmarshals PatternFlowTcpCtlAck from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlAck from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlAck from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlAck) Marshal() marshalPatternFlowTcpCtlAck { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlAck{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlAck) Unmarshal() unMarshalPatternFlowTcpCtlAck { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlAck{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlAck) ToProto() (*otg.PatternFlowTcpCtlAck, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlAck) FromProto(msg *otg.PatternFlowTcpCtlAck) (PatternFlowTcpCtlAck, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlAck) 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 *unMarshalpatternFlowTcpCtlAck) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpCtlAck) 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 *unMarshalpatternFlowTcpCtlAck) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpCtlAck) 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 *unMarshalpatternFlowTcpCtlAck) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpCtlAck) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlAck) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlAck) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlAck) Clone() (PatternFlowTcpCtlAck, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlAck() - 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 -} - -func (obj *patternFlowTcpCtlAck) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpCtlAck is a value of 1 indicates that the ackknowledgment field is significant. -type PatternFlowTcpCtlAck interface { - Validation - // msg marshals PatternFlowTcpCtlAck to protobuf object *otg.PatternFlowTcpCtlAck - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlAck - // setMsg unmarshals PatternFlowTcpCtlAck from protobuf object *otg.PatternFlowTcpCtlAck - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlAck) PatternFlowTcpCtlAck - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlAck - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlAck - // validate validates PatternFlowTcpCtlAck - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlAck, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpCtlAckChoiceEnum, set in PatternFlowTcpCtlAck - Choice() PatternFlowTcpCtlAckChoiceEnum - // setChoice assigns PatternFlowTcpCtlAckChoiceEnum provided by user to PatternFlowTcpCtlAck - setChoice(value PatternFlowTcpCtlAckChoiceEnum) PatternFlowTcpCtlAck - // HasChoice checks if Choice has been set in PatternFlowTcpCtlAck - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpCtlAck. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpCtlAck - SetValue(value uint32) PatternFlowTcpCtlAck - // HasValue checks if Value has been set in PatternFlowTcpCtlAck - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpCtlAck. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpCtlAck - SetValues(value []uint32) PatternFlowTcpCtlAck - // Increment returns PatternFlowTcpCtlAckCounter, set in PatternFlowTcpCtlAck. - // PatternFlowTcpCtlAckCounter is integer counter pattern - Increment() PatternFlowTcpCtlAckCounter - // SetIncrement assigns PatternFlowTcpCtlAckCounter provided by user to PatternFlowTcpCtlAck. - // PatternFlowTcpCtlAckCounter is integer counter pattern - SetIncrement(value PatternFlowTcpCtlAckCounter) PatternFlowTcpCtlAck - // HasIncrement checks if Increment has been set in PatternFlowTcpCtlAck - HasIncrement() bool - // Decrement returns PatternFlowTcpCtlAckCounter, set in PatternFlowTcpCtlAck. - // PatternFlowTcpCtlAckCounter is integer counter pattern - Decrement() PatternFlowTcpCtlAckCounter - // SetDecrement assigns PatternFlowTcpCtlAckCounter provided by user to PatternFlowTcpCtlAck. - // PatternFlowTcpCtlAckCounter is integer counter pattern - SetDecrement(value PatternFlowTcpCtlAckCounter) PatternFlowTcpCtlAck - // HasDecrement checks if Decrement has been set in PatternFlowTcpCtlAck - HasDecrement() bool - // MetricTags returns PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIterIter, set in PatternFlowTcpCtlAck - MetricTags() PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter - setNil() -} - -type PatternFlowTcpCtlAckChoiceEnum string - -// Enum of Choice on PatternFlowTcpCtlAck -var PatternFlowTcpCtlAckChoice = struct { - VALUE PatternFlowTcpCtlAckChoiceEnum - VALUES PatternFlowTcpCtlAckChoiceEnum - INCREMENT PatternFlowTcpCtlAckChoiceEnum - DECREMENT PatternFlowTcpCtlAckChoiceEnum -}{ - VALUE: PatternFlowTcpCtlAckChoiceEnum("value"), - VALUES: PatternFlowTcpCtlAckChoiceEnum("values"), - INCREMENT: PatternFlowTcpCtlAckChoiceEnum("increment"), - DECREMENT: PatternFlowTcpCtlAckChoiceEnum("decrement"), -} - -func (obj *patternFlowTcpCtlAck) Choice() PatternFlowTcpCtlAckChoiceEnum { - return PatternFlowTcpCtlAckChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpCtlAck) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpCtlAck) setChoice(value PatternFlowTcpCtlAckChoiceEnum) PatternFlowTcpCtlAck { - intValue, ok := otg.PatternFlowTcpCtlAck_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpCtlAckChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpCtlAck_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpCtlAckChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpCtlAckChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpCtlAckChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpCtlAckCounter().msg() - } - - if value == PatternFlowTcpCtlAckChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpCtlAckCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpCtlAck) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpCtlAckChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpCtlAck) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpCtlAck object -func (obj *patternFlowTcpCtlAck) SetValue(value uint32) PatternFlowTcpCtlAck { - obj.setChoice(PatternFlowTcpCtlAckChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpCtlAck) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpCtlAck object -func (obj *patternFlowTcpCtlAck) SetValues(value []uint32) PatternFlowTcpCtlAck { - obj.setChoice(PatternFlowTcpCtlAckChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpCtlAckCounter -func (obj *patternFlowTcpCtlAck) Increment() PatternFlowTcpCtlAckCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpCtlAckChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpCtlAckCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpCtlAckCounter -func (obj *patternFlowTcpCtlAck) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpCtlAckCounter value in the PatternFlowTcpCtlAck object -func (obj *patternFlowTcpCtlAck) SetIncrement(value PatternFlowTcpCtlAckCounter) PatternFlowTcpCtlAck { - obj.setChoice(PatternFlowTcpCtlAckChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpCtlAckCounter -func (obj *patternFlowTcpCtlAck) Decrement() PatternFlowTcpCtlAckCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpCtlAckChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpCtlAckCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpCtlAckCounter -func (obj *patternFlowTcpCtlAck) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpCtlAckCounter value in the PatternFlowTcpCtlAck object -func (obj *patternFlowTcpCtlAck) SetDecrement(value PatternFlowTcpCtlAckCounter) PatternFlowTcpCtlAck { - obj.setChoice(PatternFlowTcpCtlAckChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpCtlAckMetricTag -func (obj *patternFlowTcpCtlAck) MetricTags() PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpCtlAckMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter struct { - obj *patternFlowTcpCtlAck - patternFlowTcpCtlAckMetricTagSlice []PatternFlowTcpCtlAckMetricTag - fieldPtr *[]*otg.PatternFlowTcpCtlAckMetricTag -} - -func newPatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter(ptr *[]*otg.PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { - return &patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter interface { - setMsg(*patternFlowTcpCtlAck) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter - Items() []PatternFlowTcpCtlAckMetricTag - Add() PatternFlowTcpCtlAckMetricTag - Append(items ...PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter - Set(index int, newObj PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter - Clear() PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter - clearHolderSlice() PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter - appendHolderSlice(item PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter -} - -func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) setMsg(msg *patternFlowTcpCtlAck) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpCtlAckMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) Items() []PatternFlowTcpCtlAckMetricTag { - return obj.patternFlowTcpCtlAckMetricTagSlice -} - -func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) Add() PatternFlowTcpCtlAckMetricTag { - newObj := &otg.PatternFlowTcpCtlAckMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpCtlAckMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpCtlAckMetricTagSlice = append(obj.patternFlowTcpCtlAckMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) Append(items ...PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpCtlAckMetricTagSlice = append(obj.patternFlowTcpCtlAckMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) Set(index int, newObj PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpCtlAckMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) Clear() PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpCtlAckMetricTag{} - obj.patternFlowTcpCtlAckMetricTagSlice = []PatternFlowTcpCtlAckMetricTag{} - } - return obj -} -func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) clearHolderSlice() PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { - if len(obj.patternFlowTcpCtlAckMetricTagSlice) > 0 { - obj.patternFlowTcpCtlAckMetricTagSlice = []PatternFlowTcpCtlAckMetricTag{} - } - return obj -} -func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) appendHolderSlice(item PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { - obj.patternFlowTcpCtlAckMetricTagSlice = append(obj.patternFlowTcpCtlAckMetricTagSlice, item) - return obj -} - -func (obj *patternFlowTcpCtlAck) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlAck.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowTcpCtlAck.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpCtlAckMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowTcpCtlAck) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpCtlAckChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpCtlAckChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpCtlAckChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpCtlAckChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpCtlAckChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpCtlAckChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpCtlAck") - } - } else { - intVal := otg.PatternFlowTcpCtlAck_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpCtlAck_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpCtlPsh ***** -type patternFlowTcpCtlPsh struct { - validation - obj *otg.PatternFlowTcpCtlPsh - marshaller marshalPatternFlowTcpCtlPsh - unMarshaller unMarshalPatternFlowTcpCtlPsh - incrementHolder PatternFlowTcpCtlPshCounter - decrementHolder PatternFlowTcpCtlPshCounter - metricTagsHolder PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter -} - -func NewPatternFlowTcpCtlPsh() PatternFlowTcpCtlPsh { - obj := patternFlowTcpCtlPsh{obj: &otg.PatternFlowTcpCtlPsh{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlPsh) msg() *otg.PatternFlowTcpCtlPsh { - return obj.obj -} - -func (obj *patternFlowTcpCtlPsh) setMsg(msg *otg.PatternFlowTcpCtlPsh) PatternFlowTcpCtlPsh { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlPsh struct { - obj *patternFlowTcpCtlPsh -} - -type marshalPatternFlowTcpCtlPsh interface { - // ToProto marshals PatternFlowTcpCtlPsh to protobuf object *otg.PatternFlowTcpCtlPsh - ToProto() (*otg.PatternFlowTcpCtlPsh, error) - // ToPbText marshals PatternFlowTcpCtlPsh to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlPsh to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlPsh to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlPsh struct { - obj *patternFlowTcpCtlPsh -} - -type unMarshalPatternFlowTcpCtlPsh interface { - // FromProto unmarshals PatternFlowTcpCtlPsh from protobuf object *otg.PatternFlowTcpCtlPsh - FromProto(msg *otg.PatternFlowTcpCtlPsh) (PatternFlowTcpCtlPsh, error) - // FromPbText unmarshals PatternFlowTcpCtlPsh from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlPsh from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlPsh from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlPsh) Marshal() marshalPatternFlowTcpCtlPsh { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlPsh{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlPsh) Unmarshal() unMarshalPatternFlowTcpCtlPsh { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlPsh{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlPsh) ToProto() (*otg.PatternFlowTcpCtlPsh, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlPsh) FromProto(msg *otg.PatternFlowTcpCtlPsh) (PatternFlowTcpCtlPsh, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlPsh) 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 *unMarshalpatternFlowTcpCtlPsh) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpCtlPsh) 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 *unMarshalpatternFlowTcpCtlPsh) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpCtlPsh) 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 *unMarshalpatternFlowTcpCtlPsh) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpCtlPsh) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlPsh) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlPsh) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlPsh) Clone() (PatternFlowTcpCtlPsh, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlPsh() - 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 -} - -func (obj *patternFlowTcpCtlPsh) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpCtlPsh is asks to push the buffered data to the receiving application. -type PatternFlowTcpCtlPsh interface { - Validation - // msg marshals PatternFlowTcpCtlPsh to protobuf object *otg.PatternFlowTcpCtlPsh - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlPsh - // setMsg unmarshals PatternFlowTcpCtlPsh from protobuf object *otg.PatternFlowTcpCtlPsh - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlPsh) PatternFlowTcpCtlPsh - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlPsh - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlPsh - // validate validates PatternFlowTcpCtlPsh - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlPsh, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpCtlPshChoiceEnum, set in PatternFlowTcpCtlPsh - Choice() PatternFlowTcpCtlPshChoiceEnum - // setChoice assigns PatternFlowTcpCtlPshChoiceEnum provided by user to PatternFlowTcpCtlPsh - setChoice(value PatternFlowTcpCtlPshChoiceEnum) PatternFlowTcpCtlPsh - // HasChoice checks if Choice has been set in PatternFlowTcpCtlPsh - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpCtlPsh. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpCtlPsh - SetValue(value uint32) PatternFlowTcpCtlPsh - // HasValue checks if Value has been set in PatternFlowTcpCtlPsh - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpCtlPsh. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpCtlPsh - SetValues(value []uint32) PatternFlowTcpCtlPsh - // Increment returns PatternFlowTcpCtlPshCounter, set in PatternFlowTcpCtlPsh. - // PatternFlowTcpCtlPshCounter is integer counter pattern - Increment() PatternFlowTcpCtlPshCounter - // SetIncrement assigns PatternFlowTcpCtlPshCounter provided by user to PatternFlowTcpCtlPsh. - // PatternFlowTcpCtlPshCounter is integer counter pattern - SetIncrement(value PatternFlowTcpCtlPshCounter) PatternFlowTcpCtlPsh - // HasIncrement checks if Increment has been set in PatternFlowTcpCtlPsh - HasIncrement() bool - // Decrement returns PatternFlowTcpCtlPshCounter, set in PatternFlowTcpCtlPsh. - // PatternFlowTcpCtlPshCounter is integer counter pattern - Decrement() PatternFlowTcpCtlPshCounter - // SetDecrement assigns PatternFlowTcpCtlPshCounter provided by user to PatternFlowTcpCtlPsh. - // PatternFlowTcpCtlPshCounter is integer counter pattern - SetDecrement(value PatternFlowTcpCtlPshCounter) PatternFlowTcpCtlPsh - // HasDecrement checks if Decrement has been set in PatternFlowTcpCtlPsh - HasDecrement() bool - // MetricTags returns PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIterIter, set in PatternFlowTcpCtlPsh - MetricTags() PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter - setNil() -} - -type PatternFlowTcpCtlPshChoiceEnum string - -// Enum of Choice on PatternFlowTcpCtlPsh -var PatternFlowTcpCtlPshChoice = struct { - VALUE PatternFlowTcpCtlPshChoiceEnum - VALUES PatternFlowTcpCtlPshChoiceEnum - INCREMENT PatternFlowTcpCtlPshChoiceEnum - DECREMENT PatternFlowTcpCtlPshChoiceEnum -}{ - VALUE: PatternFlowTcpCtlPshChoiceEnum("value"), - VALUES: PatternFlowTcpCtlPshChoiceEnum("values"), - INCREMENT: PatternFlowTcpCtlPshChoiceEnum("increment"), - DECREMENT: PatternFlowTcpCtlPshChoiceEnum("decrement"), -} - -func (obj *patternFlowTcpCtlPsh) Choice() PatternFlowTcpCtlPshChoiceEnum { - return PatternFlowTcpCtlPshChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpCtlPsh) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpCtlPsh) setChoice(value PatternFlowTcpCtlPshChoiceEnum) PatternFlowTcpCtlPsh { - intValue, ok := otg.PatternFlowTcpCtlPsh_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpCtlPshChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpCtlPsh_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpCtlPshChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpCtlPshChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpCtlPshChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpCtlPshCounter().msg() - } - - if value == PatternFlowTcpCtlPshChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpCtlPshCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpCtlPsh) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpCtlPshChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpCtlPsh) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpCtlPsh object -func (obj *patternFlowTcpCtlPsh) SetValue(value uint32) PatternFlowTcpCtlPsh { - obj.setChoice(PatternFlowTcpCtlPshChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpCtlPsh) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpCtlPsh object -func (obj *patternFlowTcpCtlPsh) SetValues(value []uint32) PatternFlowTcpCtlPsh { - obj.setChoice(PatternFlowTcpCtlPshChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpCtlPshCounter -func (obj *patternFlowTcpCtlPsh) Increment() PatternFlowTcpCtlPshCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpCtlPshChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpCtlPshCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpCtlPshCounter -func (obj *patternFlowTcpCtlPsh) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpCtlPshCounter value in the PatternFlowTcpCtlPsh object -func (obj *patternFlowTcpCtlPsh) SetIncrement(value PatternFlowTcpCtlPshCounter) PatternFlowTcpCtlPsh { - obj.setChoice(PatternFlowTcpCtlPshChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpCtlPshCounter -func (obj *patternFlowTcpCtlPsh) Decrement() PatternFlowTcpCtlPshCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpCtlPshChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpCtlPshCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpCtlPshCounter -func (obj *patternFlowTcpCtlPsh) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpCtlPshCounter value in the PatternFlowTcpCtlPsh object -func (obj *patternFlowTcpCtlPsh) SetDecrement(value PatternFlowTcpCtlPshCounter) PatternFlowTcpCtlPsh { - obj.setChoice(PatternFlowTcpCtlPshChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpCtlPshMetricTag -func (obj *patternFlowTcpCtlPsh) MetricTags() PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpCtlPshMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter struct { - obj *patternFlowTcpCtlPsh - patternFlowTcpCtlPshMetricTagSlice []PatternFlowTcpCtlPshMetricTag - fieldPtr *[]*otg.PatternFlowTcpCtlPshMetricTag -} - -func newPatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter(ptr *[]*otg.PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { - return &patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter interface { - setMsg(*patternFlowTcpCtlPsh) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter - Items() []PatternFlowTcpCtlPshMetricTag - Add() PatternFlowTcpCtlPshMetricTag - Append(items ...PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter - Set(index int, newObj PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter - Clear() PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter - clearHolderSlice() PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter - appendHolderSlice(item PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter -} - -func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) setMsg(msg *patternFlowTcpCtlPsh) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpCtlPshMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) Items() []PatternFlowTcpCtlPshMetricTag { - return obj.patternFlowTcpCtlPshMetricTagSlice -} - -func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) Add() PatternFlowTcpCtlPshMetricTag { - newObj := &otg.PatternFlowTcpCtlPshMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpCtlPshMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpCtlPshMetricTagSlice = append(obj.patternFlowTcpCtlPshMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) Append(items ...PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpCtlPshMetricTagSlice = append(obj.patternFlowTcpCtlPshMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) Set(index int, newObj PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpCtlPshMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) Clear() PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpCtlPshMetricTag{} - obj.patternFlowTcpCtlPshMetricTagSlice = []PatternFlowTcpCtlPshMetricTag{} - } - return obj -} -func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) clearHolderSlice() PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { - if len(obj.patternFlowTcpCtlPshMetricTagSlice) > 0 { - obj.patternFlowTcpCtlPshMetricTagSlice = []PatternFlowTcpCtlPshMetricTag{} - } - return obj -} -func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) appendHolderSlice(item PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { - obj.patternFlowTcpCtlPshMetricTagSlice = append(obj.patternFlowTcpCtlPshMetricTagSlice, item) - return obj -} - -func (obj *patternFlowTcpCtlPsh) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlPsh.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowTcpCtlPsh.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpCtlPshMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowTcpCtlPsh) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpCtlPshChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpCtlPshChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpCtlPshChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpCtlPshChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpCtlPshChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpCtlPshChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpCtlPsh") - } - } else { - intVal := otg.PatternFlowTcpCtlPsh_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpCtlPsh_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpCtlRst ***** -type patternFlowTcpCtlRst struct { - validation - obj *otg.PatternFlowTcpCtlRst - marshaller marshalPatternFlowTcpCtlRst - unMarshaller unMarshalPatternFlowTcpCtlRst - incrementHolder PatternFlowTcpCtlRstCounter - decrementHolder PatternFlowTcpCtlRstCounter - metricTagsHolder PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter -} - -func NewPatternFlowTcpCtlRst() PatternFlowTcpCtlRst { - obj := patternFlowTcpCtlRst{obj: &otg.PatternFlowTcpCtlRst{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlRst) msg() *otg.PatternFlowTcpCtlRst { - return obj.obj -} - -func (obj *patternFlowTcpCtlRst) setMsg(msg *otg.PatternFlowTcpCtlRst) PatternFlowTcpCtlRst { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlRst struct { - obj *patternFlowTcpCtlRst -} - -type marshalPatternFlowTcpCtlRst interface { - // ToProto marshals PatternFlowTcpCtlRst to protobuf object *otg.PatternFlowTcpCtlRst - ToProto() (*otg.PatternFlowTcpCtlRst, error) - // ToPbText marshals PatternFlowTcpCtlRst to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlRst to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlRst to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlRst struct { - obj *patternFlowTcpCtlRst -} - -type unMarshalPatternFlowTcpCtlRst interface { - // FromProto unmarshals PatternFlowTcpCtlRst from protobuf object *otg.PatternFlowTcpCtlRst - FromProto(msg *otg.PatternFlowTcpCtlRst) (PatternFlowTcpCtlRst, error) - // FromPbText unmarshals PatternFlowTcpCtlRst from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlRst from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlRst from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlRst) Marshal() marshalPatternFlowTcpCtlRst { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlRst{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlRst) Unmarshal() unMarshalPatternFlowTcpCtlRst { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlRst{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlRst) ToProto() (*otg.PatternFlowTcpCtlRst, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlRst) FromProto(msg *otg.PatternFlowTcpCtlRst) (PatternFlowTcpCtlRst, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlRst) 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 *unMarshalpatternFlowTcpCtlRst) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpCtlRst) 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 *unMarshalpatternFlowTcpCtlRst) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpCtlRst) 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 *unMarshalpatternFlowTcpCtlRst) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpCtlRst) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlRst) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlRst) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlRst) Clone() (PatternFlowTcpCtlRst, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlRst() - 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 -} - -func (obj *patternFlowTcpCtlRst) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpCtlRst is reset the connection. -type PatternFlowTcpCtlRst interface { - Validation - // msg marshals PatternFlowTcpCtlRst to protobuf object *otg.PatternFlowTcpCtlRst - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlRst - // setMsg unmarshals PatternFlowTcpCtlRst from protobuf object *otg.PatternFlowTcpCtlRst - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlRst) PatternFlowTcpCtlRst - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlRst - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlRst - // validate validates PatternFlowTcpCtlRst - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlRst, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpCtlRstChoiceEnum, set in PatternFlowTcpCtlRst - Choice() PatternFlowTcpCtlRstChoiceEnum - // setChoice assigns PatternFlowTcpCtlRstChoiceEnum provided by user to PatternFlowTcpCtlRst - setChoice(value PatternFlowTcpCtlRstChoiceEnum) PatternFlowTcpCtlRst - // HasChoice checks if Choice has been set in PatternFlowTcpCtlRst - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpCtlRst. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpCtlRst - SetValue(value uint32) PatternFlowTcpCtlRst - // HasValue checks if Value has been set in PatternFlowTcpCtlRst - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpCtlRst. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpCtlRst - SetValues(value []uint32) PatternFlowTcpCtlRst - // Increment returns PatternFlowTcpCtlRstCounter, set in PatternFlowTcpCtlRst. - // PatternFlowTcpCtlRstCounter is integer counter pattern - Increment() PatternFlowTcpCtlRstCounter - // SetIncrement assigns PatternFlowTcpCtlRstCounter provided by user to PatternFlowTcpCtlRst. - // PatternFlowTcpCtlRstCounter is integer counter pattern - SetIncrement(value PatternFlowTcpCtlRstCounter) PatternFlowTcpCtlRst - // HasIncrement checks if Increment has been set in PatternFlowTcpCtlRst - HasIncrement() bool - // Decrement returns PatternFlowTcpCtlRstCounter, set in PatternFlowTcpCtlRst. - // PatternFlowTcpCtlRstCounter is integer counter pattern - Decrement() PatternFlowTcpCtlRstCounter - // SetDecrement assigns PatternFlowTcpCtlRstCounter provided by user to PatternFlowTcpCtlRst. - // PatternFlowTcpCtlRstCounter is integer counter pattern - SetDecrement(value PatternFlowTcpCtlRstCounter) PatternFlowTcpCtlRst - // HasDecrement checks if Decrement has been set in PatternFlowTcpCtlRst - HasDecrement() bool - // MetricTags returns PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIterIter, set in PatternFlowTcpCtlRst - MetricTags() PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter - setNil() -} - -type PatternFlowTcpCtlRstChoiceEnum string - -// Enum of Choice on PatternFlowTcpCtlRst -var PatternFlowTcpCtlRstChoice = struct { - VALUE PatternFlowTcpCtlRstChoiceEnum - VALUES PatternFlowTcpCtlRstChoiceEnum - INCREMENT PatternFlowTcpCtlRstChoiceEnum - DECREMENT PatternFlowTcpCtlRstChoiceEnum -}{ - VALUE: PatternFlowTcpCtlRstChoiceEnum("value"), - VALUES: PatternFlowTcpCtlRstChoiceEnum("values"), - INCREMENT: PatternFlowTcpCtlRstChoiceEnum("increment"), - DECREMENT: PatternFlowTcpCtlRstChoiceEnum("decrement"), -} - -func (obj *patternFlowTcpCtlRst) Choice() PatternFlowTcpCtlRstChoiceEnum { - return PatternFlowTcpCtlRstChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpCtlRst) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpCtlRst) setChoice(value PatternFlowTcpCtlRstChoiceEnum) PatternFlowTcpCtlRst { - intValue, ok := otg.PatternFlowTcpCtlRst_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpCtlRstChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpCtlRst_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpCtlRstChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpCtlRstChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpCtlRstChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpCtlRstCounter().msg() - } - - if value == PatternFlowTcpCtlRstChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpCtlRstCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpCtlRst) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpCtlRstChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpCtlRst) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpCtlRst object -func (obj *patternFlowTcpCtlRst) SetValue(value uint32) PatternFlowTcpCtlRst { - obj.setChoice(PatternFlowTcpCtlRstChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpCtlRst) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpCtlRst object -func (obj *patternFlowTcpCtlRst) SetValues(value []uint32) PatternFlowTcpCtlRst { - obj.setChoice(PatternFlowTcpCtlRstChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpCtlRstCounter -func (obj *patternFlowTcpCtlRst) Increment() PatternFlowTcpCtlRstCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpCtlRstChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpCtlRstCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpCtlRstCounter -func (obj *patternFlowTcpCtlRst) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpCtlRstCounter value in the PatternFlowTcpCtlRst object -func (obj *patternFlowTcpCtlRst) SetIncrement(value PatternFlowTcpCtlRstCounter) PatternFlowTcpCtlRst { - obj.setChoice(PatternFlowTcpCtlRstChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpCtlRstCounter -func (obj *patternFlowTcpCtlRst) Decrement() PatternFlowTcpCtlRstCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpCtlRstChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpCtlRstCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpCtlRstCounter -func (obj *patternFlowTcpCtlRst) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpCtlRstCounter value in the PatternFlowTcpCtlRst object -func (obj *patternFlowTcpCtlRst) SetDecrement(value PatternFlowTcpCtlRstCounter) PatternFlowTcpCtlRst { - obj.setChoice(PatternFlowTcpCtlRstChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpCtlRstMetricTag -func (obj *patternFlowTcpCtlRst) MetricTags() PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpCtlRstMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter struct { - obj *patternFlowTcpCtlRst - patternFlowTcpCtlRstMetricTagSlice []PatternFlowTcpCtlRstMetricTag - fieldPtr *[]*otg.PatternFlowTcpCtlRstMetricTag -} - -func newPatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter(ptr *[]*otg.PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { - return &patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter interface { - setMsg(*patternFlowTcpCtlRst) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter - Items() []PatternFlowTcpCtlRstMetricTag - Add() PatternFlowTcpCtlRstMetricTag - Append(items ...PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter - Set(index int, newObj PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter - Clear() PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter - clearHolderSlice() PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter - appendHolderSlice(item PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter -} - -func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) setMsg(msg *patternFlowTcpCtlRst) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpCtlRstMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) Items() []PatternFlowTcpCtlRstMetricTag { - return obj.patternFlowTcpCtlRstMetricTagSlice -} - -func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) Add() PatternFlowTcpCtlRstMetricTag { - newObj := &otg.PatternFlowTcpCtlRstMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpCtlRstMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpCtlRstMetricTagSlice = append(obj.patternFlowTcpCtlRstMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) Append(items ...PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpCtlRstMetricTagSlice = append(obj.patternFlowTcpCtlRstMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) Set(index int, newObj PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpCtlRstMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) Clear() PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpCtlRstMetricTag{} - obj.patternFlowTcpCtlRstMetricTagSlice = []PatternFlowTcpCtlRstMetricTag{} - } - return obj -} -func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) clearHolderSlice() PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { - if len(obj.patternFlowTcpCtlRstMetricTagSlice) > 0 { - obj.patternFlowTcpCtlRstMetricTagSlice = []PatternFlowTcpCtlRstMetricTag{} - } - return obj -} -func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) appendHolderSlice(item PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { - obj.patternFlowTcpCtlRstMetricTagSlice = append(obj.patternFlowTcpCtlRstMetricTagSlice, item) - return obj -} - -func (obj *patternFlowTcpCtlRst) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlRst.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowTcpCtlRst.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpCtlRstMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowTcpCtlRst) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpCtlRstChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpCtlRstChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpCtlRstChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpCtlRstChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpCtlRstChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpCtlRstChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpCtlRst") - } - } else { - intVal := otg.PatternFlowTcpCtlRst_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpCtlRst_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpCtlSyn ***** -type patternFlowTcpCtlSyn struct { - validation - obj *otg.PatternFlowTcpCtlSyn - marshaller marshalPatternFlowTcpCtlSyn - unMarshaller unMarshalPatternFlowTcpCtlSyn - incrementHolder PatternFlowTcpCtlSynCounter - decrementHolder PatternFlowTcpCtlSynCounter - metricTagsHolder PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter -} - -func NewPatternFlowTcpCtlSyn() PatternFlowTcpCtlSyn { - obj := patternFlowTcpCtlSyn{obj: &otg.PatternFlowTcpCtlSyn{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlSyn) msg() *otg.PatternFlowTcpCtlSyn { - return obj.obj -} - -func (obj *patternFlowTcpCtlSyn) setMsg(msg *otg.PatternFlowTcpCtlSyn) PatternFlowTcpCtlSyn { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlSyn struct { - obj *patternFlowTcpCtlSyn -} - -type marshalPatternFlowTcpCtlSyn interface { - // ToProto marshals PatternFlowTcpCtlSyn to protobuf object *otg.PatternFlowTcpCtlSyn - ToProto() (*otg.PatternFlowTcpCtlSyn, error) - // ToPbText marshals PatternFlowTcpCtlSyn to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlSyn to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlSyn to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlSyn struct { - obj *patternFlowTcpCtlSyn -} - -type unMarshalPatternFlowTcpCtlSyn interface { - // FromProto unmarshals PatternFlowTcpCtlSyn from protobuf object *otg.PatternFlowTcpCtlSyn - FromProto(msg *otg.PatternFlowTcpCtlSyn) (PatternFlowTcpCtlSyn, error) - // FromPbText unmarshals PatternFlowTcpCtlSyn from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlSyn from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlSyn from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlSyn) Marshal() marshalPatternFlowTcpCtlSyn { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlSyn{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlSyn) Unmarshal() unMarshalPatternFlowTcpCtlSyn { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlSyn{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlSyn) ToProto() (*otg.PatternFlowTcpCtlSyn, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlSyn) FromProto(msg *otg.PatternFlowTcpCtlSyn) (PatternFlowTcpCtlSyn, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlSyn) 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 *unMarshalpatternFlowTcpCtlSyn) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpCtlSyn) 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 *unMarshalpatternFlowTcpCtlSyn) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpCtlSyn) 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 *unMarshalpatternFlowTcpCtlSyn) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpCtlSyn) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlSyn) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlSyn) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlSyn) Clone() (PatternFlowTcpCtlSyn, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlSyn() - 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 -} - -func (obj *patternFlowTcpCtlSyn) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpCtlSyn is synchronize sequenece numbers. -type PatternFlowTcpCtlSyn interface { - Validation - // msg marshals PatternFlowTcpCtlSyn to protobuf object *otg.PatternFlowTcpCtlSyn - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlSyn - // setMsg unmarshals PatternFlowTcpCtlSyn from protobuf object *otg.PatternFlowTcpCtlSyn - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlSyn) PatternFlowTcpCtlSyn - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlSyn - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlSyn - // validate validates PatternFlowTcpCtlSyn - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlSyn, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpCtlSynChoiceEnum, set in PatternFlowTcpCtlSyn - Choice() PatternFlowTcpCtlSynChoiceEnum - // setChoice assigns PatternFlowTcpCtlSynChoiceEnum provided by user to PatternFlowTcpCtlSyn - setChoice(value PatternFlowTcpCtlSynChoiceEnum) PatternFlowTcpCtlSyn - // HasChoice checks if Choice has been set in PatternFlowTcpCtlSyn - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpCtlSyn. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpCtlSyn - SetValue(value uint32) PatternFlowTcpCtlSyn - // HasValue checks if Value has been set in PatternFlowTcpCtlSyn - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpCtlSyn. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpCtlSyn - SetValues(value []uint32) PatternFlowTcpCtlSyn - // Increment returns PatternFlowTcpCtlSynCounter, set in PatternFlowTcpCtlSyn. - // PatternFlowTcpCtlSynCounter is integer counter pattern - Increment() PatternFlowTcpCtlSynCounter - // SetIncrement assigns PatternFlowTcpCtlSynCounter provided by user to PatternFlowTcpCtlSyn. - // PatternFlowTcpCtlSynCounter is integer counter pattern - SetIncrement(value PatternFlowTcpCtlSynCounter) PatternFlowTcpCtlSyn - // HasIncrement checks if Increment has been set in PatternFlowTcpCtlSyn - HasIncrement() bool - // Decrement returns PatternFlowTcpCtlSynCounter, set in PatternFlowTcpCtlSyn. - // PatternFlowTcpCtlSynCounter is integer counter pattern - Decrement() PatternFlowTcpCtlSynCounter - // SetDecrement assigns PatternFlowTcpCtlSynCounter provided by user to PatternFlowTcpCtlSyn. - // PatternFlowTcpCtlSynCounter is integer counter pattern - SetDecrement(value PatternFlowTcpCtlSynCounter) PatternFlowTcpCtlSyn - // HasDecrement checks if Decrement has been set in PatternFlowTcpCtlSyn - HasDecrement() bool - // MetricTags returns PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIterIter, set in PatternFlowTcpCtlSyn - MetricTags() PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter - setNil() -} - -type PatternFlowTcpCtlSynChoiceEnum string - -// Enum of Choice on PatternFlowTcpCtlSyn -var PatternFlowTcpCtlSynChoice = struct { - VALUE PatternFlowTcpCtlSynChoiceEnum - VALUES PatternFlowTcpCtlSynChoiceEnum - INCREMENT PatternFlowTcpCtlSynChoiceEnum - DECREMENT PatternFlowTcpCtlSynChoiceEnum -}{ - VALUE: PatternFlowTcpCtlSynChoiceEnum("value"), - VALUES: PatternFlowTcpCtlSynChoiceEnum("values"), - INCREMENT: PatternFlowTcpCtlSynChoiceEnum("increment"), - DECREMENT: PatternFlowTcpCtlSynChoiceEnum("decrement"), -} - -func (obj *patternFlowTcpCtlSyn) Choice() PatternFlowTcpCtlSynChoiceEnum { - return PatternFlowTcpCtlSynChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpCtlSyn) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpCtlSyn) setChoice(value PatternFlowTcpCtlSynChoiceEnum) PatternFlowTcpCtlSyn { - intValue, ok := otg.PatternFlowTcpCtlSyn_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpCtlSynChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpCtlSyn_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpCtlSynChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpCtlSynChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpCtlSynChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpCtlSynCounter().msg() - } - - if value == PatternFlowTcpCtlSynChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpCtlSynCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpCtlSyn) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpCtlSynChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpCtlSyn) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpCtlSyn object -func (obj *patternFlowTcpCtlSyn) SetValue(value uint32) PatternFlowTcpCtlSyn { - obj.setChoice(PatternFlowTcpCtlSynChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpCtlSyn) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpCtlSyn object -func (obj *patternFlowTcpCtlSyn) SetValues(value []uint32) PatternFlowTcpCtlSyn { - obj.setChoice(PatternFlowTcpCtlSynChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpCtlSynCounter -func (obj *patternFlowTcpCtlSyn) Increment() PatternFlowTcpCtlSynCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpCtlSynChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpCtlSynCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpCtlSynCounter -func (obj *patternFlowTcpCtlSyn) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpCtlSynCounter value in the PatternFlowTcpCtlSyn object -func (obj *patternFlowTcpCtlSyn) SetIncrement(value PatternFlowTcpCtlSynCounter) PatternFlowTcpCtlSyn { - obj.setChoice(PatternFlowTcpCtlSynChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpCtlSynCounter -func (obj *patternFlowTcpCtlSyn) Decrement() PatternFlowTcpCtlSynCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpCtlSynChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpCtlSynCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpCtlSynCounter -func (obj *patternFlowTcpCtlSyn) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpCtlSynCounter value in the PatternFlowTcpCtlSyn object -func (obj *patternFlowTcpCtlSyn) SetDecrement(value PatternFlowTcpCtlSynCounter) PatternFlowTcpCtlSyn { - obj.setChoice(PatternFlowTcpCtlSynChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpCtlSynMetricTag -func (obj *patternFlowTcpCtlSyn) MetricTags() PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpCtlSynMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter struct { - obj *patternFlowTcpCtlSyn - patternFlowTcpCtlSynMetricTagSlice []PatternFlowTcpCtlSynMetricTag - fieldPtr *[]*otg.PatternFlowTcpCtlSynMetricTag -} - -func newPatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter(ptr *[]*otg.PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { - return &patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter interface { - setMsg(*patternFlowTcpCtlSyn) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter - Items() []PatternFlowTcpCtlSynMetricTag - Add() PatternFlowTcpCtlSynMetricTag - Append(items ...PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter - Set(index int, newObj PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter - Clear() PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter - clearHolderSlice() PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter - appendHolderSlice(item PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter -} - -func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) setMsg(msg *patternFlowTcpCtlSyn) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpCtlSynMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) Items() []PatternFlowTcpCtlSynMetricTag { - return obj.patternFlowTcpCtlSynMetricTagSlice -} - -func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) Add() PatternFlowTcpCtlSynMetricTag { - newObj := &otg.PatternFlowTcpCtlSynMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpCtlSynMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpCtlSynMetricTagSlice = append(obj.patternFlowTcpCtlSynMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) Append(items ...PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpCtlSynMetricTagSlice = append(obj.patternFlowTcpCtlSynMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) Set(index int, newObj PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpCtlSynMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) Clear() PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpCtlSynMetricTag{} - obj.patternFlowTcpCtlSynMetricTagSlice = []PatternFlowTcpCtlSynMetricTag{} - } - return obj -} -func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) clearHolderSlice() PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { - if len(obj.patternFlowTcpCtlSynMetricTagSlice) > 0 { - obj.patternFlowTcpCtlSynMetricTagSlice = []PatternFlowTcpCtlSynMetricTag{} - } - return obj -} -func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) appendHolderSlice(item PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { - obj.patternFlowTcpCtlSynMetricTagSlice = append(obj.patternFlowTcpCtlSynMetricTagSlice, item) - return obj -} - -func (obj *patternFlowTcpCtlSyn) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlSyn.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowTcpCtlSyn.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpCtlSynMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowTcpCtlSyn) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpCtlSynChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpCtlSynChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpCtlSynChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpCtlSynChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpCtlSynChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpCtlSynChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpCtlSyn") - } - } else { - intVal := otg.PatternFlowTcpCtlSyn_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpCtlSyn_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpCtlFin ***** -type patternFlowTcpCtlFin struct { - validation - obj *otg.PatternFlowTcpCtlFin - marshaller marshalPatternFlowTcpCtlFin - unMarshaller unMarshalPatternFlowTcpCtlFin - incrementHolder PatternFlowTcpCtlFinCounter - decrementHolder PatternFlowTcpCtlFinCounter - metricTagsHolder PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter -} - -func NewPatternFlowTcpCtlFin() PatternFlowTcpCtlFin { - obj := patternFlowTcpCtlFin{obj: &otg.PatternFlowTcpCtlFin{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlFin) msg() *otg.PatternFlowTcpCtlFin { - return obj.obj -} - -func (obj *patternFlowTcpCtlFin) setMsg(msg *otg.PatternFlowTcpCtlFin) PatternFlowTcpCtlFin { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlFin struct { - obj *patternFlowTcpCtlFin -} - -type marshalPatternFlowTcpCtlFin interface { - // ToProto marshals PatternFlowTcpCtlFin to protobuf object *otg.PatternFlowTcpCtlFin - ToProto() (*otg.PatternFlowTcpCtlFin, error) - // ToPbText marshals PatternFlowTcpCtlFin to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlFin to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlFin to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlFin struct { - obj *patternFlowTcpCtlFin -} - -type unMarshalPatternFlowTcpCtlFin interface { - // FromProto unmarshals PatternFlowTcpCtlFin from protobuf object *otg.PatternFlowTcpCtlFin - FromProto(msg *otg.PatternFlowTcpCtlFin) (PatternFlowTcpCtlFin, error) - // FromPbText unmarshals PatternFlowTcpCtlFin from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlFin from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlFin from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlFin) Marshal() marshalPatternFlowTcpCtlFin { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlFin{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlFin) Unmarshal() unMarshalPatternFlowTcpCtlFin { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlFin{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlFin) ToProto() (*otg.PatternFlowTcpCtlFin, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlFin) FromProto(msg *otg.PatternFlowTcpCtlFin) (PatternFlowTcpCtlFin, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlFin) 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 *unMarshalpatternFlowTcpCtlFin) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpCtlFin) 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 *unMarshalpatternFlowTcpCtlFin) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpCtlFin) 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 *unMarshalpatternFlowTcpCtlFin) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpCtlFin) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlFin) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlFin) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlFin) Clone() (PatternFlowTcpCtlFin, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlFin() - 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 -} - -func (obj *patternFlowTcpCtlFin) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpCtlFin is last packet from the sender. -type PatternFlowTcpCtlFin interface { - Validation - // msg marshals PatternFlowTcpCtlFin to protobuf object *otg.PatternFlowTcpCtlFin - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlFin - // setMsg unmarshals PatternFlowTcpCtlFin from protobuf object *otg.PatternFlowTcpCtlFin - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlFin) PatternFlowTcpCtlFin - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlFin - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlFin - // validate validates PatternFlowTcpCtlFin - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlFin, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpCtlFinChoiceEnum, set in PatternFlowTcpCtlFin - Choice() PatternFlowTcpCtlFinChoiceEnum - // setChoice assigns PatternFlowTcpCtlFinChoiceEnum provided by user to PatternFlowTcpCtlFin - setChoice(value PatternFlowTcpCtlFinChoiceEnum) PatternFlowTcpCtlFin - // HasChoice checks if Choice has been set in PatternFlowTcpCtlFin - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpCtlFin. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpCtlFin - SetValue(value uint32) PatternFlowTcpCtlFin - // HasValue checks if Value has been set in PatternFlowTcpCtlFin - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpCtlFin. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpCtlFin - SetValues(value []uint32) PatternFlowTcpCtlFin - // Increment returns PatternFlowTcpCtlFinCounter, set in PatternFlowTcpCtlFin. - // PatternFlowTcpCtlFinCounter is integer counter pattern - Increment() PatternFlowTcpCtlFinCounter - // SetIncrement assigns PatternFlowTcpCtlFinCounter provided by user to PatternFlowTcpCtlFin. - // PatternFlowTcpCtlFinCounter is integer counter pattern - SetIncrement(value PatternFlowTcpCtlFinCounter) PatternFlowTcpCtlFin - // HasIncrement checks if Increment has been set in PatternFlowTcpCtlFin - HasIncrement() bool - // Decrement returns PatternFlowTcpCtlFinCounter, set in PatternFlowTcpCtlFin. - // PatternFlowTcpCtlFinCounter is integer counter pattern - Decrement() PatternFlowTcpCtlFinCounter - // SetDecrement assigns PatternFlowTcpCtlFinCounter provided by user to PatternFlowTcpCtlFin. - // PatternFlowTcpCtlFinCounter is integer counter pattern - SetDecrement(value PatternFlowTcpCtlFinCounter) PatternFlowTcpCtlFin - // HasDecrement checks if Decrement has been set in PatternFlowTcpCtlFin - HasDecrement() bool - // MetricTags returns PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIterIter, set in PatternFlowTcpCtlFin - MetricTags() PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter - setNil() -} - -type PatternFlowTcpCtlFinChoiceEnum string - -// Enum of Choice on PatternFlowTcpCtlFin -var PatternFlowTcpCtlFinChoice = struct { - VALUE PatternFlowTcpCtlFinChoiceEnum - VALUES PatternFlowTcpCtlFinChoiceEnum - INCREMENT PatternFlowTcpCtlFinChoiceEnum - DECREMENT PatternFlowTcpCtlFinChoiceEnum -}{ - VALUE: PatternFlowTcpCtlFinChoiceEnum("value"), - VALUES: PatternFlowTcpCtlFinChoiceEnum("values"), - INCREMENT: PatternFlowTcpCtlFinChoiceEnum("increment"), - DECREMENT: PatternFlowTcpCtlFinChoiceEnum("decrement"), -} - -func (obj *patternFlowTcpCtlFin) Choice() PatternFlowTcpCtlFinChoiceEnum { - return PatternFlowTcpCtlFinChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpCtlFin) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpCtlFin) setChoice(value PatternFlowTcpCtlFinChoiceEnum) PatternFlowTcpCtlFin { - intValue, ok := otg.PatternFlowTcpCtlFin_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpCtlFinChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpCtlFin_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpCtlFinChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpCtlFinChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpCtlFinChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpCtlFinCounter().msg() - } - - if value == PatternFlowTcpCtlFinChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpCtlFinCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpCtlFin) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpCtlFinChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpCtlFin) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpCtlFin object -func (obj *patternFlowTcpCtlFin) SetValue(value uint32) PatternFlowTcpCtlFin { - obj.setChoice(PatternFlowTcpCtlFinChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpCtlFin) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpCtlFin object -func (obj *patternFlowTcpCtlFin) SetValues(value []uint32) PatternFlowTcpCtlFin { - obj.setChoice(PatternFlowTcpCtlFinChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpCtlFinCounter -func (obj *patternFlowTcpCtlFin) Increment() PatternFlowTcpCtlFinCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpCtlFinChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpCtlFinCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpCtlFinCounter -func (obj *patternFlowTcpCtlFin) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpCtlFinCounter value in the PatternFlowTcpCtlFin object -func (obj *patternFlowTcpCtlFin) SetIncrement(value PatternFlowTcpCtlFinCounter) PatternFlowTcpCtlFin { - obj.setChoice(PatternFlowTcpCtlFinChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpCtlFinCounter -func (obj *patternFlowTcpCtlFin) Decrement() PatternFlowTcpCtlFinCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpCtlFinChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpCtlFinCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpCtlFinCounter -func (obj *patternFlowTcpCtlFin) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpCtlFinCounter value in the PatternFlowTcpCtlFin object -func (obj *patternFlowTcpCtlFin) SetDecrement(value PatternFlowTcpCtlFinCounter) PatternFlowTcpCtlFin { - obj.setChoice(PatternFlowTcpCtlFinChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpCtlFinMetricTag -func (obj *patternFlowTcpCtlFin) MetricTags() PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpCtlFinMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter struct { - obj *patternFlowTcpCtlFin - patternFlowTcpCtlFinMetricTagSlice []PatternFlowTcpCtlFinMetricTag - fieldPtr *[]*otg.PatternFlowTcpCtlFinMetricTag -} - -func newPatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter(ptr *[]*otg.PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { - return &patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter interface { - setMsg(*patternFlowTcpCtlFin) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter - Items() []PatternFlowTcpCtlFinMetricTag - Add() PatternFlowTcpCtlFinMetricTag - Append(items ...PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter - Set(index int, newObj PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter - Clear() PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter - clearHolderSlice() PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter - appendHolderSlice(item PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter -} - -func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) setMsg(msg *patternFlowTcpCtlFin) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpCtlFinMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) Items() []PatternFlowTcpCtlFinMetricTag { - return obj.patternFlowTcpCtlFinMetricTagSlice -} - -func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) Add() PatternFlowTcpCtlFinMetricTag { - newObj := &otg.PatternFlowTcpCtlFinMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpCtlFinMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpCtlFinMetricTagSlice = append(obj.patternFlowTcpCtlFinMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) Append(items ...PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpCtlFinMetricTagSlice = append(obj.patternFlowTcpCtlFinMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) Set(index int, newObj PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpCtlFinMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) Clear() PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpCtlFinMetricTag{} - obj.patternFlowTcpCtlFinMetricTagSlice = []PatternFlowTcpCtlFinMetricTag{} - } - return obj -} -func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) clearHolderSlice() PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { - if len(obj.patternFlowTcpCtlFinMetricTagSlice) > 0 { - obj.patternFlowTcpCtlFinMetricTagSlice = []PatternFlowTcpCtlFinMetricTag{} - } - return obj -} -func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) appendHolderSlice(item PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { - obj.patternFlowTcpCtlFinMetricTagSlice = append(obj.patternFlowTcpCtlFinMetricTagSlice, item) - return obj -} - -func (obj *patternFlowTcpCtlFin) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlFin.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowTcpCtlFin.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpCtlFinMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowTcpCtlFin) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpCtlFinChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpCtlFinChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpCtlFinChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpCtlFinChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpCtlFinChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpCtlFinChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpCtlFin") - } - } else { - intVal := otg.PatternFlowTcpCtlFin_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpCtlFin_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpWindow ***** -type patternFlowTcpWindow struct { - validation - obj *otg.PatternFlowTcpWindow - marshaller marshalPatternFlowTcpWindow - unMarshaller unMarshalPatternFlowTcpWindow - incrementHolder PatternFlowTcpWindowCounter - decrementHolder PatternFlowTcpWindowCounter - metricTagsHolder PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter -} - -func NewPatternFlowTcpWindow() PatternFlowTcpWindow { - obj := patternFlowTcpWindow{obj: &otg.PatternFlowTcpWindow{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpWindow) msg() *otg.PatternFlowTcpWindow { - return obj.obj -} - -func (obj *patternFlowTcpWindow) setMsg(msg *otg.PatternFlowTcpWindow) PatternFlowTcpWindow { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpWindow struct { - obj *patternFlowTcpWindow -} - -type marshalPatternFlowTcpWindow interface { - // ToProto marshals PatternFlowTcpWindow to protobuf object *otg.PatternFlowTcpWindow - ToProto() (*otg.PatternFlowTcpWindow, error) - // ToPbText marshals PatternFlowTcpWindow to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpWindow to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpWindow to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpWindow struct { - obj *patternFlowTcpWindow -} - -type unMarshalPatternFlowTcpWindow interface { - // FromProto unmarshals PatternFlowTcpWindow from protobuf object *otg.PatternFlowTcpWindow - FromProto(msg *otg.PatternFlowTcpWindow) (PatternFlowTcpWindow, error) - // FromPbText unmarshals PatternFlowTcpWindow from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpWindow from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpWindow from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpWindow) Marshal() marshalPatternFlowTcpWindow { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpWindow{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpWindow) Unmarshal() unMarshalPatternFlowTcpWindow { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpWindow{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpWindow) ToProto() (*otg.PatternFlowTcpWindow, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpWindow) FromProto(msg *otg.PatternFlowTcpWindow) (PatternFlowTcpWindow, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpWindow) 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 *unMarshalpatternFlowTcpWindow) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowTcpWindow) 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 *unMarshalpatternFlowTcpWindow) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowTcpWindow) 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 *unMarshalpatternFlowTcpWindow) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowTcpWindow) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpWindow) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpWindow) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpWindow) Clone() (PatternFlowTcpWindow, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpWindow() - 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 -} - -func (obj *patternFlowTcpWindow) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowTcpWindow is tcp connection window. -type PatternFlowTcpWindow interface { - Validation - // msg marshals PatternFlowTcpWindow to protobuf object *otg.PatternFlowTcpWindow - // and doesn't set defaults - msg() *otg.PatternFlowTcpWindow - // setMsg unmarshals PatternFlowTcpWindow from protobuf object *otg.PatternFlowTcpWindow - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpWindow) PatternFlowTcpWindow - // provides marshal interface - Marshal() marshalPatternFlowTcpWindow - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpWindow - // validate validates PatternFlowTcpWindow - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpWindow, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpWindowChoiceEnum, set in PatternFlowTcpWindow - Choice() PatternFlowTcpWindowChoiceEnum - // setChoice assigns PatternFlowTcpWindowChoiceEnum provided by user to PatternFlowTcpWindow - setChoice(value PatternFlowTcpWindowChoiceEnum) PatternFlowTcpWindow - // HasChoice checks if Choice has been set in PatternFlowTcpWindow - HasChoice() bool - // Value returns uint32, set in PatternFlowTcpWindow. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowTcpWindow - SetValue(value uint32) PatternFlowTcpWindow - // HasValue checks if Value has been set in PatternFlowTcpWindow - HasValue() bool - // Values returns []uint32, set in PatternFlowTcpWindow. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowTcpWindow - SetValues(value []uint32) PatternFlowTcpWindow - // Increment returns PatternFlowTcpWindowCounter, set in PatternFlowTcpWindow. - // PatternFlowTcpWindowCounter is integer counter pattern - Increment() PatternFlowTcpWindowCounter - // SetIncrement assigns PatternFlowTcpWindowCounter provided by user to PatternFlowTcpWindow. - // PatternFlowTcpWindowCounter is integer counter pattern - SetIncrement(value PatternFlowTcpWindowCounter) PatternFlowTcpWindow - // HasIncrement checks if Increment has been set in PatternFlowTcpWindow - HasIncrement() bool - // Decrement returns PatternFlowTcpWindowCounter, set in PatternFlowTcpWindow. - // PatternFlowTcpWindowCounter is integer counter pattern - Decrement() PatternFlowTcpWindowCounter - // SetDecrement assigns PatternFlowTcpWindowCounter provided by user to PatternFlowTcpWindow. - // PatternFlowTcpWindowCounter is integer counter pattern - SetDecrement(value PatternFlowTcpWindowCounter) PatternFlowTcpWindow - // HasDecrement checks if Decrement has been set in PatternFlowTcpWindow - HasDecrement() bool - // MetricTags returns PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIterIter, set in PatternFlowTcpWindow - MetricTags() PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter - setNil() -} - -type PatternFlowTcpWindowChoiceEnum string - -// Enum of Choice on PatternFlowTcpWindow -var PatternFlowTcpWindowChoice = struct { - VALUE PatternFlowTcpWindowChoiceEnum - VALUES PatternFlowTcpWindowChoiceEnum - INCREMENT PatternFlowTcpWindowChoiceEnum - DECREMENT PatternFlowTcpWindowChoiceEnum -}{ - VALUE: PatternFlowTcpWindowChoiceEnum("value"), - VALUES: PatternFlowTcpWindowChoiceEnum("values"), - INCREMENT: PatternFlowTcpWindowChoiceEnum("increment"), - DECREMENT: PatternFlowTcpWindowChoiceEnum("decrement"), -} - -func (obj *patternFlowTcpWindow) Choice() PatternFlowTcpWindowChoiceEnum { - return PatternFlowTcpWindowChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowTcpWindow) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpWindow) setChoice(value PatternFlowTcpWindowChoiceEnum) PatternFlowTcpWindow { - intValue, ok := otg.PatternFlowTcpWindow_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpWindowChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpWindow_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowTcpWindowChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowTcpWindowChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowTcpWindowChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowTcpWindowCounter().msg() - } - - if value == PatternFlowTcpWindowChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowTcpWindowCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpWindow) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowTcpWindowChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowTcpWindow) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowTcpWindow object -func (obj *patternFlowTcpWindow) SetValue(value uint32) PatternFlowTcpWindow { - obj.setChoice(PatternFlowTcpWindowChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowTcpWindow) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowTcpWindow object -func (obj *patternFlowTcpWindow) SetValues(value []uint32) PatternFlowTcpWindow { - obj.setChoice(PatternFlowTcpWindowChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowTcpWindowCounter -func (obj *patternFlowTcpWindow) Increment() PatternFlowTcpWindowCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowTcpWindowChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowTcpWindowCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowTcpWindowCounter -func (obj *patternFlowTcpWindow) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowTcpWindowCounter value in the PatternFlowTcpWindow object -func (obj *patternFlowTcpWindow) SetIncrement(value PatternFlowTcpWindowCounter) PatternFlowTcpWindow { - obj.setChoice(PatternFlowTcpWindowChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowTcpWindowCounter -func (obj *patternFlowTcpWindow) Decrement() PatternFlowTcpWindowCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowTcpWindowChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowTcpWindowCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowTcpWindowCounter -func (obj *patternFlowTcpWindow) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowTcpWindowCounter value in the PatternFlowTcpWindow object -func (obj *patternFlowTcpWindow) SetDecrement(value PatternFlowTcpWindowCounter) PatternFlowTcpWindow { - obj.setChoice(PatternFlowTcpWindowChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowTcpWindowMetricTag -func (obj *patternFlowTcpWindow) MetricTags() PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowTcpWindowMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter struct { - obj *patternFlowTcpWindow - patternFlowTcpWindowMetricTagSlice []PatternFlowTcpWindowMetricTag - fieldPtr *[]*otg.PatternFlowTcpWindowMetricTag -} - -func newPatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter(ptr *[]*otg.PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { - return &patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter interface { - setMsg(*patternFlowTcpWindow) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter - Items() []PatternFlowTcpWindowMetricTag - Add() PatternFlowTcpWindowMetricTag - Append(items ...PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter - Set(index int, newObj PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter - Clear() PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter - clearHolderSlice() PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter - appendHolderSlice(item PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter -} - -func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) setMsg(msg *patternFlowTcpWindow) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowTcpWindowMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) Items() []PatternFlowTcpWindowMetricTag { - return obj.patternFlowTcpWindowMetricTagSlice -} - -func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) Add() PatternFlowTcpWindowMetricTag { - newObj := &otg.PatternFlowTcpWindowMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowTcpWindowMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowTcpWindowMetricTagSlice = append(obj.patternFlowTcpWindowMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) Append(items ...PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowTcpWindowMetricTagSlice = append(obj.patternFlowTcpWindowMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) Set(index int, newObj PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowTcpWindowMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) Clear() PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowTcpWindowMetricTag{} - obj.patternFlowTcpWindowMetricTagSlice = []PatternFlowTcpWindowMetricTag{} - } - return obj -} -func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) clearHolderSlice() PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { - if len(obj.patternFlowTcpWindowMetricTagSlice) > 0 { - obj.patternFlowTcpWindowMetricTagSlice = []PatternFlowTcpWindowMetricTag{} - } - return obj -} -func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) appendHolderSlice(item PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { - obj.patternFlowTcpWindowMetricTagSlice = append(obj.patternFlowTcpWindowMetricTagSlice, item) - return obj -} - -func (obj *patternFlowTcpWindow) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpWindow.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowTcpWindow.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowTcpWindowMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowTcpWindow) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpWindowChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowTcpWindowChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowTcpWindowChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowTcpWindowChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowTcpWindowChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpWindowChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpWindow") - } - } else { - intVal := otg.PatternFlowTcpWindow_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpWindow_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowTcpChecksum ***** -type patternFlowTcpChecksum struct { - validation - obj *otg.PatternFlowTcpChecksum - marshaller marshalPatternFlowTcpChecksum - unMarshaller unMarshalPatternFlowTcpChecksum -} - -func NewPatternFlowTcpChecksum() PatternFlowTcpChecksum { - obj := patternFlowTcpChecksum{obj: &otg.PatternFlowTcpChecksum{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpChecksum) msg() *otg.PatternFlowTcpChecksum { - return obj.obj -} - -func (obj *patternFlowTcpChecksum) setMsg(msg *otg.PatternFlowTcpChecksum) PatternFlowTcpChecksum { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpChecksum struct { - obj *patternFlowTcpChecksum -} - -type marshalPatternFlowTcpChecksum interface { - // ToProto marshals PatternFlowTcpChecksum to protobuf object *otg.PatternFlowTcpChecksum - ToProto() (*otg.PatternFlowTcpChecksum, error) - // ToPbText marshals PatternFlowTcpChecksum to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpChecksum to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpChecksum to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpChecksum struct { - obj *patternFlowTcpChecksum -} - -type unMarshalPatternFlowTcpChecksum interface { - // FromProto unmarshals PatternFlowTcpChecksum from protobuf object *otg.PatternFlowTcpChecksum - FromProto(msg *otg.PatternFlowTcpChecksum) (PatternFlowTcpChecksum, error) - // FromPbText unmarshals PatternFlowTcpChecksum from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpChecksum from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpChecksum from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpChecksum) Marshal() marshalPatternFlowTcpChecksum { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpChecksum{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpChecksum) Unmarshal() unMarshalPatternFlowTcpChecksum { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpChecksum{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpChecksum) ToProto() (*otg.PatternFlowTcpChecksum, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpChecksum) FromProto(msg *otg.PatternFlowTcpChecksum) (PatternFlowTcpChecksum, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpChecksum) 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 *unMarshalpatternFlowTcpChecksum) 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 *marshalpatternFlowTcpChecksum) 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 *unMarshalpatternFlowTcpChecksum) 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 *marshalpatternFlowTcpChecksum) 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 *unMarshalpatternFlowTcpChecksum) 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 *patternFlowTcpChecksum) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpChecksum) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpChecksum) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpChecksum) Clone() (PatternFlowTcpChecksum, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpChecksum() - 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 -} - -// PatternFlowTcpChecksum is the one's complement of the one's complement sum of all 16 bit words in header and text. An all-zero value means that no checksum will be transmitted. While computing the checksum, the checksum field itself is replaced with zeros. -type PatternFlowTcpChecksum interface { - Validation - // msg marshals PatternFlowTcpChecksum to protobuf object *otg.PatternFlowTcpChecksum - // and doesn't set defaults - msg() *otg.PatternFlowTcpChecksum - // setMsg unmarshals PatternFlowTcpChecksum from protobuf object *otg.PatternFlowTcpChecksum - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpChecksum) PatternFlowTcpChecksum - // provides marshal interface - Marshal() marshalPatternFlowTcpChecksum - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpChecksum - // validate validates PatternFlowTcpChecksum - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpChecksum, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowTcpChecksumChoiceEnum, set in PatternFlowTcpChecksum - Choice() PatternFlowTcpChecksumChoiceEnum - // setChoice assigns PatternFlowTcpChecksumChoiceEnum provided by user to PatternFlowTcpChecksum - setChoice(value PatternFlowTcpChecksumChoiceEnum) PatternFlowTcpChecksum - // HasChoice checks if Choice has been set in PatternFlowTcpChecksum - HasChoice() bool - // Generated returns PatternFlowTcpChecksumGeneratedEnum, set in PatternFlowTcpChecksum - Generated() PatternFlowTcpChecksumGeneratedEnum - // SetGenerated assigns PatternFlowTcpChecksumGeneratedEnum provided by user to PatternFlowTcpChecksum - SetGenerated(value PatternFlowTcpChecksumGeneratedEnum) PatternFlowTcpChecksum - // HasGenerated checks if Generated has been set in PatternFlowTcpChecksum - HasGenerated() bool - // Custom returns uint32, set in PatternFlowTcpChecksum. - Custom() uint32 - // SetCustom assigns uint32 provided by user to PatternFlowTcpChecksum - SetCustom(value uint32) PatternFlowTcpChecksum - // HasCustom checks if Custom has been set in PatternFlowTcpChecksum - HasCustom() bool -} - -type PatternFlowTcpChecksumChoiceEnum string - -// Enum of Choice on PatternFlowTcpChecksum -var PatternFlowTcpChecksumChoice = struct { - GENERATED PatternFlowTcpChecksumChoiceEnum - CUSTOM PatternFlowTcpChecksumChoiceEnum -}{ - GENERATED: PatternFlowTcpChecksumChoiceEnum("generated"), - CUSTOM: PatternFlowTcpChecksumChoiceEnum("custom"), -} - -func (obj *patternFlowTcpChecksum) Choice() PatternFlowTcpChecksumChoiceEnum { - return PatternFlowTcpChecksumChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The type of checksum -// Choice returns a string -func (obj *patternFlowTcpChecksum) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowTcpChecksum) setChoice(value PatternFlowTcpChecksumChoiceEnum) PatternFlowTcpChecksum { - intValue, ok := otg.PatternFlowTcpChecksum_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpChecksumChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpChecksum_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Custom = nil - obj.obj.Generated = otg.PatternFlowTcpChecksum_Generated_unspecified.Enum() - return obj -} - -type PatternFlowTcpChecksumGeneratedEnum string - -// Enum of Generated on PatternFlowTcpChecksum -var PatternFlowTcpChecksumGenerated = struct { - GOOD PatternFlowTcpChecksumGeneratedEnum - BAD PatternFlowTcpChecksumGeneratedEnum -}{ - GOOD: PatternFlowTcpChecksumGeneratedEnum("good"), - BAD: PatternFlowTcpChecksumGeneratedEnum("bad"), -} - -func (obj *patternFlowTcpChecksum) Generated() PatternFlowTcpChecksumGeneratedEnum { - return PatternFlowTcpChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) -} - -// A system generated checksum value -// Generated returns a string -func (obj *patternFlowTcpChecksum) HasGenerated() bool { - return obj.obj.Generated != nil -} - -func (obj *patternFlowTcpChecksum) SetGenerated(value PatternFlowTcpChecksumGeneratedEnum) PatternFlowTcpChecksum { - intValue, ok := otg.PatternFlowTcpChecksum_Generated_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowTcpChecksumGeneratedEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowTcpChecksum_Generated_Enum(intValue) - obj.obj.Generated = &enumValue - - return obj -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowTcpChecksum) Custom() uint32 { - - if obj.obj.Custom == nil { - obj.setChoice(PatternFlowTcpChecksumChoice.CUSTOM) - } - - return *obj.obj.Custom - -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowTcpChecksum) HasCustom() bool { - return obj.obj.Custom != nil -} - -// A custom checksum value -// SetCustom sets the uint32 value in the PatternFlowTcpChecksum object -func (obj *patternFlowTcpChecksum) SetCustom(value uint32) PatternFlowTcpChecksum { - obj.setChoice(PatternFlowTcpChecksumChoice.CUSTOM) - obj.obj.Custom = &value - return obj -} - -func (obj *patternFlowTcpChecksum) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Custom != nil { - - if *obj.obj.Custom > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpChecksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) - } - - } - -} - -func (obj *patternFlowTcpChecksum) setDefault() { - var choices_set int = 0 - var choice PatternFlowTcpChecksumChoiceEnum - - if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { - choices_set += 1 - choice = PatternFlowTcpChecksumChoice.GENERATED - } - - if obj.obj.Custom != nil { - choices_set += 1 - choice = PatternFlowTcpChecksumChoice.CUSTOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowTcpChecksumChoice.GENERATED) - if obj.obj.Generated.Number() == 0 { - obj.SetGenerated(PatternFlowTcpChecksumGenerated.GOOD) - - } - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpChecksum") - } - } else { - intVal := otg.PatternFlowTcpChecksum_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowTcpChecksum_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowUdpSrcPort ***** -type patternFlowUdpSrcPort struct { - validation - obj *otg.PatternFlowUdpSrcPort - marshaller marshalPatternFlowUdpSrcPort - unMarshaller unMarshalPatternFlowUdpSrcPort - incrementHolder PatternFlowUdpSrcPortCounter - decrementHolder PatternFlowUdpSrcPortCounter - metricTagsHolder PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter - randomHolder PatternFlowUdpSrcPortRandom -} - -func NewPatternFlowUdpSrcPort() PatternFlowUdpSrcPort { - obj := patternFlowUdpSrcPort{obj: &otg.PatternFlowUdpSrcPort{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowUdpSrcPort) msg() *otg.PatternFlowUdpSrcPort { - return obj.obj -} - -func (obj *patternFlowUdpSrcPort) setMsg(msg *otg.PatternFlowUdpSrcPort) PatternFlowUdpSrcPort { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowUdpSrcPort struct { - obj *patternFlowUdpSrcPort -} - -type marshalPatternFlowUdpSrcPort interface { - // ToProto marshals PatternFlowUdpSrcPort to protobuf object *otg.PatternFlowUdpSrcPort - ToProto() (*otg.PatternFlowUdpSrcPort, error) - // ToPbText marshals PatternFlowUdpSrcPort to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowUdpSrcPort to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowUdpSrcPort to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowUdpSrcPort struct { - obj *patternFlowUdpSrcPort -} - -type unMarshalPatternFlowUdpSrcPort interface { - // FromProto unmarshals PatternFlowUdpSrcPort from protobuf object *otg.PatternFlowUdpSrcPort - FromProto(msg *otg.PatternFlowUdpSrcPort) (PatternFlowUdpSrcPort, error) - // FromPbText unmarshals PatternFlowUdpSrcPort from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowUdpSrcPort from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowUdpSrcPort from JSON text - FromJson(value string) error -} - -func (obj *patternFlowUdpSrcPort) Marshal() marshalPatternFlowUdpSrcPort { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowUdpSrcPort{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowUdpSrcPort) Unmarshal() unMarshalPatternFlowUdpSrcPort { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowUdpSrcPort{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowUdpSrcPort) ToProto() (*otg.PatternFlowUdpSrcPort, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowUdpSrcPort) FromProto(msg *otg.PatternFlowUdpSrcPort) (PatternFlowUdpSrcPort, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowUdpSrcPort) 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 *unMarshalpatternFlowUdpSrcPort) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowUdpSrcPort) 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 *unMarshalpatternFlowUdpSrcPort) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowUdpSrcPort) 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 *unMarshalpatternFlowUdpSrcPort) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowUdpSrcPort) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowUdpSrcPort) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowUdpSrcPort) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowUdpSrcPort) Clone() (PatternFlowUdpSrcPort, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowUdpSrcPort() - 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 -} - -func (obj *patternFlowUdpSrcPort) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.randomHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowUdpSrcPort is source port -type PatternFlowUdpSrcPort interface { - Validation - // msg marshals PatternFlowUdpSrcPort to protobuf object *otg.PatternFlowUdpSrcPort - // and doesn't set defaults - msg() *otg.PatternFlowUdpSrcPort - // setMsg unmarshals PatternFlowUdpSrcPort from protobuf object *otg.PatternFlowUdpSrcPort - // and doesn't set defaults - setMsg(*otg.PatternFlowUdpSrcPort) PatternFlowUdpSrcPort - // provides marshal interface - Marshal() marshalPatternFlowUdpSrcPort - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowUdpSrcPort - // validate validates PatternFlowUdpSrcPort - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowUdpSrcPort, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowUdpSrcPortChoiceEnum, set in PatternFlowUdpSrcPort - Choice() PatternFlowUdpSrcPortChoiceEnum - // setChoice assigns PatternFlowUdpSrcPortChoiceEnum provided by user to PatternFlowUdpSrcPort - setChoice(value PatternFlowUdpSrcPortChoiceEnum) PatternFlowUdpSrcPort - // HasChoice checks if Choice has been set in PatternFlowUdpSrcPort - HasChoice() bool - // Value returns uint32, set in PatternFlowUdpSrcPort. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowUdpSrcPort - SetValue(value uint32) PatternFlowUdpSrcPort - // HasValue checks if Value has been set in PatternFlowUdpSrcPort - HasValue() bool - // Values returns []uint32, set in PatternFlowUdpSrcPort. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowUdpSrcPort - SetValues(value []uint32) PatternFlowUdpSrcPort - // Increment returns PatternFlowUdpSrcPortCounter, set in PatternFlowUdpSrcPort. - // PatternFlowUdpSrcPortCounter is integer counter pattern - Increment() PatternFlowUdpSrcPortCounter - // SetIncrement assigns PatternFlowUdpSrcPortCounter provided by user to PatternFlowUdpSrcPort. - // PatternFlowUdpSrcPortCounter is integer counter pattern - SetIncrement(value PatternFlowUdpSrcPortCounter) PatternFlowUdpSrcPort - // HasIncrement checks if Increment has been set in PatternFlowUdpSrcPort - HasIncrement() bool - // Decrement returns PatternFlowUdpSrcPortCounter, set in PatternFlowUdpSrcPort. - // PatternFlowUdpSrcPortCounter is integer counter pattern - Decrement() PatternFlowUdpSrcPortCounter - // SetDecrement assigns PatternFlowUdpSrcPortCounter provided by user to PatternFlowUdpSrcPort. - // PatternFlowUdpSrcPortCounter is integer counter pattern - SetDecrement(value PatternFlowUdpSrcPortCounter) PatternFlowUdpSrcPort - // HasDecrement checks if Decrement has been set in PatternFlowUdpSrcPort - HasDecrement() bool - // MetricTags returns PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIterIter, set in PatternFlowUdpSrcPort - MetricTags() PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter - // Random returns PatternFlowUdpSrcPortRandom, set in PatternFlowUdpSrcPort. - // PatternFlowUdpSrcPortRandom is integer random pattern - Random() PatternFlowUdpSrcPortRandom - // SetRandom assigns PatternFlowUdpSrcPortRandom provided by user to PatternFlowUdpSrcPort. - // PatternFlowUdpSrcPortRandom is integer random pattern - SetRandom(value PatternFlowUdpSrcPortRandom) PatternFlowUdpSrcPort - // HasRandom checks if Random has been set in PatternFlowUdpSrcPort - HasRandom() bool - setNil() -} - -type PatternFlowUdpSrcPortChoiceEnum string - -// Enum of Choice on PatternFlowUdpSrcPort -var PatternFlowUdpSrcPortChoice = struct { - VALUE PatternFlowUdpSrcPortChoiceEnum - VALUES PatternFlowUdpSrcPortChoiceEnum - INCREMENT PatternFlowUdpSrcPortChoiceEnum - DECREMENT PatternFlowUdpSrcPortChoiceEnum - RANDOM PatternFlowUdpSrcPortChoiceEnum -}{ - VALUE: PatternFlowUdpSrcPortChoiceEnum("value"), - VALUES: PatternFlowUdpSrcPortChoiceEnum("values"), - INCREMENT: PatternFlowUdpSrcPortChoiceEnum("increment"), - DECREMENT: PatternFlowUdpSrcPortChoiceEnum("decrement"), - RANDOM: PatternFlowUdpSrcPortChoiceEnum("random"), -} - -func (obj *patternFlowUdpSrcPort) Choice() PatternFlowUdpSrcPortChoiceEnum { - return PatternFlowUdpSrcPortChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowUdpSrcPort) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowUdpSrcPort) setChoice(value PatternFlowUdpSrcPortChoiceEnum) PatternFlowUdpSrcPort { - intValue, ok := otg.PatternFlowUdpSrcPort_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowUdpSrcPortChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowUdpSrcPort_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Random = nil - obj.randomHolder = nil - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowUdpSrcPortChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowUdpSrcPortChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowUdpSrcPortChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowUdpSrcPortCounter().msg() - } - - if value == PatternFlowUdpSrcPortChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowUdpSrcPortCounter().msg() - } - - if value == PatternFlowUdpSrcPortChoice.RANDOM { - obj.obj.Random = NewPatternFlowUdpSrcPortRandom().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowUdpSrcPort) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowUdpSrcPortChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowUdpSrcPort) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowUdpSrcPort object -func (obj *patternFlowUdpSrcPort) SetValue(value uint32) PatternFlowUdpSrcPort { - obj.setChoice(PatternFlowUdpSrcPortChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowUdpSrcPort) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowUdpSrcPort object -func (obj *patternFlowUdpSrcPort) SetValues(value []uint32) PatternFlowUdpSrcPort { - obj.setChoice(PatternFlowUdpSrcPortChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowUdpSrcPortCounter -func (obj *patternFlowUdpSrcPort) Increment() PatternFlowUdpSrcPortCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowUdpSrcPortChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowUdpSrcPortCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowUdpSrcPortCounter -func (obj *patternFlowUdpSrcPort) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowUdpSrcPortCounter value in the PatternFlowUdpSrcPort object -func (obj *patternFlowUdpSrcPort) SetIncrement(value PatternFlowUdpSrcPortCounter) PatternFlowUdpSrcPort { - obj.setChoice(PatternFlowUdpSrcPortChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowUdpSrcPortCounter -func (obj *patternFlowUdpSrcPort) Decrement() PatternFlowUdpSrcPortCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowUdpSrcPortChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowUdpSrcPortCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowUdpSrcPortCounter -func (obj *patternFlowUdpSrcPort) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowUdpSrcPortCounter value in the PatternFlowUdpSrcPort object -func (obj *patternFlowUdpSrcPort) SetDecrement(value PatternFlowUdpSrcPortCounter) PatternFlowUdpSrcPort { - obj.setChoice(PatternFlowUdpSrcPortChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowUdpSrcPortMetricTag -func (obj *patternFlowUdpSrcPort) MetricTags() PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowUdpSrcPortMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter struct { - obj *patternFlowUdpSrcPort - patternFlowUdpSrcPortMetricTagSlice []PatternFlowUdpSrcPortMetricTag - fieldPtr *[]*otg.PatternFlowUdpSrcPortMetricTag -} - -func newPatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter(ptr *[]*otg.PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { - return &patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter interface { - setMsg(*patternFlowUdpSrcPort) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter - Items() []PatternFlowUdpSrcPortMetricTag - Add() PatternFlowUdpSrcPortMetricTag - Append(items ...PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter - Set(index int, newObj PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter - Clear() PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter - clearHolderSlice() PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter - appendHolderSlice(item PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter -} - -func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) setMsg(msg *patternFlowUdpSrcPort) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowUdpSrcPortMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) Items() []PatternFlowUdpSrcPortMetricTag { - return obj.patternFlowUdpSrcPortMetricTagSlice -} - -func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) Add() PatternFlowUdpSrcPortMetricTag { - newObj := &otg.PatternFlowUdpSrcPortMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowUdpSrcPortMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowUdpSrcPortMetricTagSlice = append(obj.patternFlowUdpSrcPortMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) Append(items ...PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowUdpSrcPortMetricTagSlice = append(obj.patternFlowUdpSrcPortMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) Set(index int, newObj PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowUdpSrcPortMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) Clear() PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowUdpSrcPortMetricTag{} - obj.patternFlowUdpSrcPortMetricTagSlice = []PatternFlowUdpSrcPortMetricTag{} - } - return obj -} -func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) clearHolderSlice() PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { - if len(obj.patternFlowUdpSrcPortMetricTagSlice) > 0 { - obj.patternFlowUdpSrcPortMetricTagSlice = []PatternFlowUdpSrcPortMetricTag{} - } - return obj -} -func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) appendHolderSlice(item PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { - obj.patternFlowUdpSrcPortMetricTagSlice = append(obj.patternFlowUdpSrcPortMetricTagSlice, item) - return obj -} - -// description is TBD -// Random returns a PatternFlowUdpSrcPortRandom -func (obj *patternFlowUdpSrcPort) Random() PatternFlowUdpSrcPortRandom { - if obj.obj.Random == nil { - obj.setChoice(PatternFlowUdpSrcPortChoice.RANDOM) - } - if obj.randomHolder == nil { - obj.randomHolder = &patternFlowUdpSrcPortRandom{obj: obj.obj.Random} - } - return obj.randomHolder -} - -// description is TBD -// Random returns a PatternFlowUdpSrcPortRandom -func (obj *patternFlowUdpSrcPort) HasRandom() bool { - return obj.obj.Random != nil -} - -// description is TBD -// SetRandom sets the PatternFlowUdpSrcPortRandom value in the PatternFlowUdpSrcPort object -func (obj *patternFlowUdpSrcPort) SetRandom(value PatternFlowUdpSrcPortRandom) PatternFlowUdpSrcPort { - obj.setChoice(PatternFlowUdpSrcPortChoice.RANDOM) - obj.randomHolder = nil - obj.obj.Random = value.msg() - - return obj -} - -func (obj *patternFlowUdpSrcPort) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpSrcPort.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowUdpSrcPort.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowUdpSrcPortMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Random != nil { - - obj.Random().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowUdpSrcPort) setDefault() { - var choices_set int = 0 - var choice PatternFlowUdpSrcPortChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowUdpSrcPortChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowUdpSrcPortChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowUdpSrcPortChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowUdpSrcPortChoice.DECREMENT - } - - if obj.obj.Random != nil { - choices_set += 1 - choice = PatternFlowUdpSrcPortChoice.RANDOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowUdpSrcPortChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowUdpSrcPort") - } - } else { - intVal := otg.PatternFlowUdpSrcPort_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowUdpSrcPort_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowUdpDstPort ***** -type patternFlowUdpDstPort struct { - validation - obj *otg.PatternFlowUdpDstPort - marshaller marshalPatternFlowUdpDstPort - unMarshaller unMarshalPatternFlowUdpDstPort - incrementHolder PatternFlowUdpDstPortCounter - decrementHolder PatternFlowUdpDstPortCounter - metricTagsHolder PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter - randomHolder PatternFlowUdpDstPortRandom -} - -func NewPatternFlowUdpDstPort() PatternFlowUdpDstPort { - obj := patternFlowUdpDstPort{obj: &otg.PatternFlowUdpDstPort{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowUdpDstPort) msg() *otg.PatternFlowUdpDstPort { - return obj.obj -} - -func (obj *patternFlowUdpDstPort) setMsg(msg *otg.PatternFlowUdpDstPort) PatternFlowUdpDstPort { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowUdpDstPort struct { - obj *patternFlowUdpDstPort -} - -type marshalPatternFlowUdpDstPort interface { - // ToProto marshals PatternFlowUdpDstPort to protobuf object *otg.PatternFlowUdpDstPort - ToProto() (*otg.PatternFlowUdpDstPort, error) - // ToPbText marshals PatternFlowUdpDstPort to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowUdpDstPort to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowUdpDstPort to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowUdpDstPort struct { - obj *patternFlowUdpDstPort -} - -type unMarshalPatternFlowUdpDstPort interface { - // FromProto unmarshals PatternFlowUdpDstPort from protobuf object *otg.PatternFlowUdpDstPort - FromProto(msg *otg.PatternFlowUdpDstPort) (PatternFlowUdpDstPort, error) - // FromPbText unmarshals PatternFlowUdpDstPort from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowUdpDstPort from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowUdpDstPort from JSON text - FromJson(value string) error -} - -func (obj *patternFlowUdpDstPort) Marshal() marshalPatternFlowUdpDstPort { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowUdpDstPort{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowUdpDstPort) Unmarshal() unMarshalPatternFlowUdpDstPort { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowUdpDstPort{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowUdpDstPort) ToProto() (*otg.PatternFlowUdpDstPort, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowUdpDstPort) FromProto(msg *otg.PatternFlowUdpDstPort) (PatternFlowUdpDstPort, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowUdpDstPort) 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 *unMarshalpatternFlowUdpDstPort) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowUdpDstPort) 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 *unMarshalpatternFlowUdpDstPort) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowUdpDstPort) 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 *unMarshalpatternFlowUdpDstPort) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowUdpDstPort) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowUdpDstPort) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowUdpDstPort) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowUdpDstPort) Clone() (PatternFlowUdpDstPort, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowUdpDstPort() - 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 -} - -func (obj *patternFlowUdpDstPort) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.randomHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowUdpDstPort is destination port -type PatternFlowUdpDstPort interface { - Validation - // msg marshals PatternFlowUdpDstPort to protobuf object *otg.PatternFlowUdpDstPort - // and doesn't set defaults - msg() *otg.PatternFlowUdpDstPort - // setMsg unmarshals PatternFlowUdpDstPort from protobuf object *otg.PatternFlowUdpDstPort - // and doesn't set defaults - setMsg(*otg.PatternFlowUdpDstPort) PatternFlowUdpDstPort - // provides marshal interface - Marshal() marshalPatternFlowUdpDstPort - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowUdpDstPort - // validate validates PatternFlowUdpDstPort - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowUdpDstPort, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowUdpDstPortChoiceEnum, set in PatternFlowUdpDstPort - Choice() PatternFlowUdpDstPortChoiceEnum - // setChoice assigns PatternFlowUdpDstPortChoiceEnum provided by user to PatternFlowUdpDstPort - setChoice(value PatternFlowUdpDstPortChoiceEnum) PatternFlowUdpDstPort - // HasChoice checks if Choice has been set in PatternFlowUdpDstPort - HasChoice() bool - // Value returns uint32, set in PatternFlowUdpDstPort. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowUdpDstPort - SetValue(value uint32) PatternFlowUdpDstPort - // HasValue checks if Value has been set in PatternFlowUdpDstPort - HasValue() bool - // Values returns []uint32, set in PatternFlowUdpDstPort. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowUdpDstPort - SetValues(value []uint32) PatternFlowUdpDstPort - // Increment returns PatternFlowUdpDstPortCounter, set in PatternFlowUdpDstPort. - // PatternFlowUdpDstPortCounter is integer counter pattern - Increment() PatternFlowUdpDstPortCounter - // SetIncrement assigns PatternFlowUdpDstPortCounter provided by user to PatternFlowUdpDstPort. - // PatternFlowUdpDstPortCounter is integer counter pattern - SetIncrement(value PatternFlowUdpDstPortCounter) PatternFlowUdpDstPort - // HasIncrement checks if Increment has been set in PatternFlowUdpDstPort - HasIncrement() bool - // Decrement returns PatternFlowUdpDstPortCounter, set in PatternFlowUdpDstPort. - // PatternFlowUdpDstPortCounter is integer counter pattern - Decrement() PatternFlowUdpDstPortCounter - // SetDecrement assigns PatternFlowUdpDstPortCounter provided by user to PatternFlowUdpDstPort. - // PatternFlowUdpDstPortCounter is integer counter pattern - SetDecrement(value PatternFlowUdpDstPortCounter) PatternFlowUdpDstPort - // HasDecrement checks if Decrement has been set in PatternFlowUdpDstPort - HasDecrement() bool - // MetricTags returns PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIterIter, set in PatternFlowUdpDstPort - MetricTags() PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter - // Random returns PatternFlowUdpDstPortRandom, set in PatternFlowUdpDstPort. - // PatternFlowUdpDstPortRandom is integer random pattern - Random() PatternFlowUdpDstPortRandom - // SetRandom assigns PatternFlowUdpDstPortRandom provided by user to PatternFlowUdpDstPort. - // PatternFlowUdpDstPortRandom is integer random pattern - SetRandom(value PatternFlowUdpDstPortRandom) PatternFlowUdpDstPort - // HasRandom checks if Random has been set in PatternFlowUdpDstPort - HasRandom() bool - setNil() -} - -type PatternFlowUdpDstPortChoiceEnum string - -// Enum of Choice on PatternFlowUdpDstPort -var PatternFlowUdpDstPortChoice = struct { - VALUE PatternFlowUdpDstPortChoiceEnum - VALUES PatternFlowUdpDstPortChoiceEnum - INCREMENT PatternFlowUdpDstPortChoiceEnum - DECREMENT PatternFlowUdpDstPortChoiceEnum - RANDOM PatternFlowUdpDstPortChoiceEnum -}{ - VALUE: PatternFlowUdpDstPortChoiceEnum("value"), - VALUES: PatternFlowUdpDstPortChoiceEnum("values"), - INCREMENT: PatternFlowUdpDstPortChoiceEnum("increment"), - DECREMENT: PatternFlowUdpDstPortChoiceEnum("decrement"), - RANDOM: PatternFlowUdpDstPortChoiceEnum("random"), -} - -func (obj *patternFlowUdpDstPort) Choice() PatternFlowUdpDstPortChoiceEnum { - return PatternFlowUdpDstPortChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowUdpDstPort) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowUdpDstPort) setChoice(value PatternFlowUdpDstPortChoiceEnum) PatternFlowUdpDstPort { - intValue, ok := otg.PatternFlowUdpDstPort_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowUdpDstPortChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowUdpDstPort_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Random = nil - obj.randomHolder = nil - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowUdpDstPortChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowUdpDstPortChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowUdpDstPortChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowUdpDstPortCounter().msg() - } - - if value == PatternFlowUdpDstPortChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowUdpDstPortCounter().msg() - } - - if value == PatternFlowUdpDstPortChoice.RANDOM { - obj.obj.Random = NewPatternFlowUdpDstPortRandom().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowUdpDstPort) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowUdpDstPortChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowUdpDstPort) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowUdpDstPort object -func (obj *patternFlowUdpDstPort) SetValue(value uint32) PatternFlowUdpDstPort { - obj.setChoice(PatternFlowUdpDstPortChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowUdpDstPort) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowUdpDstPort object -func (obj *patternFlowUdpDstPort) SetValues(value []uint32) PatternFlowUdpDstPort { - obj.setChoice(PatternFlowUdpDstPortChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowUdpDstPortCounter -func (obj *patternFlowUdpDstPort) Increment() PatternFlowUdpDstPortCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowUdpDstPortChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowUdpDstPortCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowUdpDstPortCounter -func (obj *patternFlowUdpDstPort) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowUdpDstPortCounter value in the PatternFlowUdpDstPort object -func (obj *patternFlowUdpDstPort) SetIncrement(value PatternFlowUdpDstPortCounter) PatternFlowUdpDstPort { - obj.setChoice(PatternFlowUdpDstPortChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowUdpDstPortCounter -func (obj *patternFlowUdpDstPort) Decrement() PatternFlowUdpDstPortCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowUdpDstPortChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowUdpDstPortCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowUdpDstPortCounter -func (obj *patternFlowUdpDstPort) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowUdpDstPortCounter value in the PatternFlowUdpDstPort object -func (obj *patternFlowUdpDstPort) SetDecrement(value PatternFlowUdpDstPortCounter) PatternFlowUdpDstPort { - obj.setChoice(PatternFlowUdpDstPortChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowUdpDstPortMetricTag -func (obj *patternFlowUdpDstPort) MetricTags() PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowUdpDstPortMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter struct { - obj *patternFlowUdpDstPort - patternFlowUdpDstPortMetricTagSlice []PatternFlowUdpDstPortMetricTag - fieldPtr *[]*otg.PatternFlowUdpDstPortMetricTag -} - -func newPatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter(ptr *[]*otg.PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { - return &patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter interface { - setMsg(*patternFlowUdpDstPort) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter - Items() []PatternFlowUdpDstPortMetricTag - Add() PatternFlowUdpDstPortMetricTag - Append(items ...PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter - Set(index int, newObj PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter - Clear() PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter - clearHolderSlice() PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter - appendHolderSlice(item PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter -} - -func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) setMsg(msg *patternFlowUdpDstPort) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowUdpDstPortMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) Items() []PatternFlowUdpDstPortMetricTag { - return obj.patternFlowUdpDstPortMetricTagSlice -} - -func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) Add() PatternFlowUdpDstPortMetricTag { - newObj := &otg.PatternFlowUdpDstPortMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowUdpDstPortMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowUdpDstPortMetricTagSlice = append(obj.patternFlowUdpDstPortMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) Append(items ...PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowUdpDstPortMetricTagSlice = append(obj.patternFlowUdpDstPortMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) Set(index int, newObj PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowUdpDstPortMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) Clear() PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowUdpDstPortMetricTag{} - obj.patternFlowUdpDstPortMetricTagSlice = []PatternFlowUdpDstPortMetricTag{} - } - return obj -} -func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) clearHolderSlice() PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { - if len(obj.patternFlowUdpDstPortMetricTagSlice) > 0 { - obj.patternFlowUdpDstPortMetricTagSlice = []PatternFlowUdpDstPortMetricTag{} - } - return obj -} -func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) appendHolderSlice(item PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { - obj.patternFlowUdpDstPortMetricTagSlice = append(obj.patternFlowUdpDstPortMetricTagSlice, item) - return obj -} - -// description is TBD -// Random returns a PatternFlowUdpDstPortRandom -func (obj *patternFlowUdpDstPort) Random() PatternFlowUdpDstPortRandom { - if obj.obj.Random == nil { - obj.setChoice(PatternFlowUdpDstPortChoice.RANDOM) - } - if obj.randomHolder == nil { - obj.randomHolder = &patternFlowUdpDstPortRandom{obj: obj.obj.Random} - } - return obj.randomHolder -} - -// description is TBD -// Random returns a PatternFlowUdpDstPortRandom -func (obj *patternFlowUdpDstPort) HasRandom() bool { - return obj.obj.Random != nil -} - -// description is TBD -// SetRandom sets the PatternFlowUdpDstPortRandom value in the PatternFlowUdpDstPort object -func (obj *patternFlowUdpDstPort) SetRandom(value PatternFlowUdpDstPortRandom) PatternFlowUdpDstPort { - obj.setChoice(PatternFlowUdpDstPortChoice.RANDOM) - obj.randomHolder = nil - obj.obj.Random = value.msg() - - return obj -} - -func (obj *patternFlowUdpDstPort) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpDstPort.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowUdpDstPort.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowUdpDstPortMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Random != nil { - - obj.Random().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowUdpDstPort) setDefault() { - var choices_set int = 0 - var choice PatternFlowUdpDstPortChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowUdpDstPortChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowUdpDstPortChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowUdpDstPortChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowUdpDstPortChoice.DECREMENT - } - - if obj.obj.Random != nil { - choices_set += 1 - choice = PatternFlowUdpDstPortChoice.RANDOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowUdpDstPortChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowUdpDstPort") - } - } else { - intVal := otg.PatternFlowUdpDstPort_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowUdpDstPort_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowUdpLength ***** -type patternFlowUdpLength struct { - validation - obj *otg.PatternFlowUdpLength - marshaller marshalPatternFlowUdpLength - unMarshaller unMarshalPatternFlowUdpLength - incrementHolder PatternFlowUdpLengthCounter - decrementHolder PatternFlowUdpLengthCounter - metricTagsHolder PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter -} - -func NewPatternFlowUdpLength() PatternFlowUdpLength { - obj := patternFlowUdpLength{obj: &otg.PatternFlowUdpLength{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowUdpLength) msg() *otg.PatternFlowUdpLength { - return obj.obj -} - -func (obj *patternFlowUdpLength) setMsg(msg *otg.PatternFlowUdpLength) PatternFlowUdpLength { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowUdpLength struct { - obj *patternFlowUdpLength -} - -type marshalPatternFlowUdpLength interface { - // ToProto marshals PatternFlowUdpLength to protobuf object *otg.PatternFlowUdpLength - ToProto() (*otg.PatternFlowUdpLength, error) - // ToPbText marshals PatternFlowUdpLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowUdpLength to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowUdpLength to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowUdpLength struct { - obj *patternFlowUdpLength -} - -type unMarshalPatternFlowUdpLength interface { - // FromProto unmarshals PatternFlowUdpLength from protobuf object *otg.PatternFlowUdpLength - FromProto(msg *otg.PatternFlowUdpLength) (PatternFlowUdpLength, error) - // FromPbText unmarshals PatternFlowUdpLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowUdpLength from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowUdpLength from JSON text - FromJson(value string) error -} - -func (obj *patternFlowUdpLength) Marshal() marshalPatternFlowUdpLength { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowUdpLength{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowUdpLength) Unmarshal() unMarshalPatternFlowUdpLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowUdpLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowUdpLength) ToProto() (*otg.PatternFlowUdpLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowUdpLength) FromProto(msg *otg.PatternFlowUdpLength) (PatternFlowUdpLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowUdpLength) 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 *unMarshalpatternFlowUdpLength) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowUdpLength) 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 *unMarshalpatternFlowUdpLength) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowUdpLength) 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 *unMarshalpatternFlowUdpLength) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowUdpLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowUdpLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowUdpLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowUdpLength) Clone() (PatternFlowUdpLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowUdpLength() - 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 -} - -func (obj *patternFlowUdpLength) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowUdpLength is length -type PatternFlowUdpLength interface { - Validation - // msg marshals PatternFlowUdpLength to protobuf object *otg.PatternFlowUdpLength - // and doesn't set defaults - msg() *otg.PatternFlowUdpLength - // setMsg unmarshals PatternFlowUdpLength from protobuf object *otg.PatternFlowUdpLength - // and doesn't set defaults - setMsg(*otg.PatternFlowUdpLength) PatternFlowUdpLength - // provides marshal interface - Marshal() marshalPatternFlowUdpLength - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowUdpLength - // validate validates PatternFlowUdpLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowUdpLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowUdpLengthChoiceEnum, set in PatternFlowUdpLength - Choice() PatternFlowUdpLengthChoiceEnum - // setChoice assigns PatternFlowUdpLengthChoiceEnum provided by user to PatternFlowUdpLength - setChoice(value PatternFlowUdpLengthChoiceEnum) PatternFlowUdpLength - // HasChoice checks if Choice has been set in PatternFlowUdpLength - HasChoice() bool - // Value returns uint32, set in PatternFlowUdpLength. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowUdpLength - SetValue(value uint32) PatternFlowUdpLength - // HasValue checks if Value has been set in PatternFlowUdpLength - HasValue() bool - // Values returns []uint32, set in PatternFlowUdpLength. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowUdpLength - SetValues(value []uint32) PatternFlowUdpLength - // Increment returns PatternFlowUdpLengthCounter, set in PatternFlowUdpLength. - // PatternFlowUdpLengthCounter is integer counter pattern - Increment() PatternFlowUdpLengthCounter - // SetIncrement assigns PatternFlowUdpLengthCounter provided by user to PatternFlowUdpLength. - // PatternFlowUdpLengthCounter is integer counter pattern - SetIncrement(value PatternFlowUdpLengthCounter) PatternFlowUdpLength - // HasIncrement checks if Increment has been set in PatternFlowUdpLength - HasIncrement() bool - // Decrement returns PatternFlowUdpLengthCounter, set in PatternFlowUdpLength. - // PatternFlowUdpLengthCounter is integer counter pattern - Decrement() PatternFlowUdpLengthCounter - // SetDecrement assigns PatternFlowUdpLengthCounter provided by user to PatternFlowUdpLength. - // PatternFlowUdpLengthCounter is integer counter pattern - SetDecrement(value PatternFlowUdpLengthCounter) PatternFlowUdpLength - // HasDecrement checks if Decrement has been set in PatternFlowUdpLength - HasDecrement() bool - // MetricTags returns PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIterIter, set in PatternFlowUdpLength - MetricTags() PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter - setNil() -} - -type PatternFlowUdpLengthChoiceEnum string - -// Enum of Choice on PatternFlowUdpLength -var PatternFlowUdpLengthChoice = struct { - VALUE PatternFlowUdpLengthChoiceEnum - VALUES PatternFlowUdpLengthChoiceEnum - INCREMENT PatternFlowUdpLengthChoiceEnum - DECREMENT PatternFlowUdpLengthChoiceEnum -}{ - VALUE: PatternFlowUdpLengthChoiceEnum("value"), - VALUES: PatternFlowUdpLengthChoiceEnum("values"), - INCREMENT: PatternFlowUdpLengthChoiceEnum("increment"), - DECREMENT: PatternFlowUdpLengthChoiceEnum("decrement"), -} - -func (obj *patternFlowUdpLength) Choice() PatternFlowUdpLengthChoiceEnum { - return PatternFlowUdpLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowUdpLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowUdpLength) setChoice(value PatternFlowUdpLengthChoiceEnum) PatternFlowUdpLength { - intValue, ok := otg.PatternFlowUdpLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowUdpLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowUdpLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowUdpLengthChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowUdpLengthChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowUdpLengthChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowUdpLengthCounter().msg() - } - - if value == PatternFlowUdpLengthChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowUdpLengthCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowUdpLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowUdpLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowUdpLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowUdpLength object -func (obj *patternFlowUdpLength) SetValue(value uint32) PatternFlowUdpLength { - obj.setChoice(PatternFlowUdpLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowUdpLength) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowUdpLength object -func (obj *patternFlowUdpLength) SetValues(value []uint32) PatternFlowUdpLength { - obj.setChoice(PatternFlowUdpLengthChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowUdpLengthCounter -func (obj *patternFlowUdpLength) Increment() PatternFlowUdpLengthCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowUdpLengthChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowUdpLengthCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowUdpLengthCounter -func (obj *patternFlowUdpLength) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowUdpLengthCounter value in the PatternFlowUdpLength object -func (obj *patternFlowUdpLength) SetIncrement(value PatternFlowUdpLengthCounter) PatternFlowUdpLength { - obj.setChoice(PatternFlowUdpLengthChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowUdpLengthCounter -func (obj *patternFlowUdpLength) Decrement() PatternFlowUdpLengthCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowUdpLengthChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowUdpLengthCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowUdpLengthCounter -func (obj *patternFlowUdpLength) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowUdpLengthCounter value in the PatternFlowUdpLength object -func (obj *patternFlowUdpLength) SetDecrement(value PatternFlowUdpLengthCounter) PatternFlowUdpLength { - obj.setChoice(PatternFlowUdpLengthChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowUdpLengthMetricTag -func (obj *patternFlowUdpLength) MetricTags() PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowUdpLengthMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter struct { - obj *patternFlowUdpLength - patternFlowUdpLengthMetricTagSlice []PatternFlowUdpLengthMetricTag - fieldPtr *[]*otg.PatternFlowUdpLengthMetricTag -} - -func newPatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter(ptr *[]*otg.PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { - return &patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter interface { - setMsg(*patternFlowUdpLength) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter - Items() []PatternFlowUdpLengthMetricTag - Add() PatternFlowUdpLengthMetricTag - Append(items ...PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter - Set(index int, newObj PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter - Clear() PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter - clearHolderSlice() PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter - appendHolderSlice(item PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter -} - -func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) setMsg(msg *patternFlowUdpLength) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowUdpLengthMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) Items() []PatternFlowUdpLengthMetricTag { - return obj.patternFlowUdpLengthMetricTagSlice -} - -func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) Add() PatternFlowUdpLengthMetricTag { - newObj := &otg.PatternFlowUdpLengthMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowUdpLengthMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowUdpLengthMetricTagSlice = append(obj.patternFlowUdpLengthMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) Append(items ...PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowUdpLengthMetricTagSlice = append(obj.patternFlowUdpLengthMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) Set(index int, newObj PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowUdpLengthMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) Clear() PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowUdpLengthMetricTag{} - obj.patternFlowUdpLengthMetricTagSlice = []PatternFlowUdpLengthMetricTag{} - } - return obj -} -func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) clearHolderSlice() PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { - if len(obj.patternFlowUdpLengthMetricTagSlice) > 0 { - obj.patternFlowUdpLengthMetricTagSlice = []PatternFlowUdpLengthMetricTag{} - } - return obj -} -func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) appendHolderSlice(item PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { - obj.patternFlowUdpLengthMetricTagSlice = append(obj.patternFlowUdpLengthMetricTagSlice, item) - return obj -} - -func (obj *patternFlowUdpLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpLength.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowUdpLength.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowUdpLengthMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowUdpLength) setDefault() { - var choices_set int = 0 - var choice PatternFlowUdpLengthChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowUdpLengthChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowUdpLengthChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowUdpLengthChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowUdpLengthChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowUdpLengthChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowUdpLength") - } - } else { - intVal := otg.PatternFlowUdpLength_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowUdpLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowUdpChecksum ***** -type patternFlowUdpChecksum struct { - validation - obj *otg.PatternFlowUdpChecksum - marshaller marshalPatternFlowUdpChecksum - unMarshaller unMarshalPatternFlowUdpChecksum -} - -func NewPatternFlowUdpChecksum() PatternFlowUdpChecksum { - obj := patternFlowUdpChecksum{obj: &otg.PatternFlowUdpChecksum{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowUdpChecksum) msg() *otg.PatternFlowUdpChecksum { - return obj.obj -} - -func (obj *patternFlowUdpChecksum) setMsg(msg *otg.PatternFlowUdpChecksum) PatternFlowUdpChecksum { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowUdpChecksum struct { - obj *patternFlowUdpChecksum -} - -type marshalPatternFlowUdpChecksum interface { - // ToProto marshals PatternFlowUdpChecksum to protobuf object *otg.PatternFlowUdpChecksum - ToProto() (*otg.PatternFlowUdpChecksum, error) - // ToPbText marshals PatternFlowUdpChecksum to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowUdpChecksum to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowUdpChecksum to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowUdpChecksum struct { - obj *patternFlowUdpChecksum -} - -type unMarshalPatternFlowUdpChecksum interface { - // FromProto unmarshals PatternFlowUdpChecksum from protobuf object *otg.PatternFlowUdpChecksum - FromProto(msg *otg.PatternFlowUdpChecksum) (PatternFlowUdpChecksum, error) - // FromPbText unmarshals PatternFlowUdpChecksum from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowUdpChecksum from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowUdpChecksum from JSON text - FromJson(value string) error -} - -func (obj *patternFlowUdpChecksum) Marshal() marshalPatternFlowUdpChecksum { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowUdpChecksum{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowUdpChecksum) Unmarshal() unMarshalPatternFlowUdpChecksum { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowUdpChecksum{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowUdpChecksum) ToProto() (*otg.PatternFlowUdpChecksum, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowUdpChecksum) FromProto(msg *otg.PatternFlowUdpChecksum) (PatternFlowUdpChecksum, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowUdpChecksum) 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 *unMarshalpatternFlowUdpChecksum) 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 *marshalpatternFlowUdpChecksum) 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 *unMarshalpatternFlowUdpChecksum) 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 *marshalpatternFlowUdpChecksum) 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 *unMarshalpatternFlowUdpChecksum) 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 *patternFlowUdpChecksum) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowUdpChecksum) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowUdpChecksum) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowUdpChecksum) Clone() (PatternFlowUdpChecksum, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowUdpChecksum() - 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 -} - -// PatternFlowUdpChecksum is uDP checksum -type PatternFlowUdpChecksum interface { - Validation - // msg marshals PatternFlowUdpChecksum to protobuf object *otg.PatternFlowUdpChecksum - // and doesn't set defaults - msg() *otg.PatternFlowUdpChecksum - // setMsg unmarshals PatternFlowUdpChecksum from protobuf object *otg.PatternFlowUdpChecksum - // and doesn't set defaults - setMsg(*otg.PatternFlowUdpChecksum) PatternFlowUdpChecksum - // provides marshal interface - Marshal() marshalPatternFlowUdpChecksum - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowUdpChecksum - // validate validates PatternFlowUdpChecksum - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowUdpChecksum, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowUdpChecksumChoiceEnum, set in PatternFlowUdpChecksum - Choice() PatternFlowUdpChecksumChoiceEnum - // setChoice assigns PatternFlowUdpChecksumChoiceEnum provided by user to PatternFlowUdpChecksum - setChoice(value PatternFlowUdpChecksumChoiceEnum) PatternFlowUdpChecksum - // HasChoice checks if Choice has been set in PatternFlowUdpChecksum - HasChoice() bool - // Generated returns PatternFlowUdpChecksumGeneratedEnum, set in PatternFlowUdpChecksum - Generated() PatternFlowUdpChecksumGeneratedEnum - // SetGenerated assigns PatternFlowUdpChecksumGeneratedEnum provided by user to PatternFlowUdpChecksum - SetGenerated(value PatternFlowUdpChecksumGeneratedEnum) PatternFlowUdpChecksum - // HasGenerated checks if Generated has been set in PatternFlowUdpChecksum - HasGenerated() bool - // Custom returns uint32, set in PatternFlowUdpChecksum. - Custom() uint32 - // SetCustom assigns uint32 provided by user to PatternFlowUdpChecksum - SetCustom(value uint32) PatternFlowUdpChecksum - // HasCustom checks if Custom has been set in PatternFlowUdpChecksum - HasCustom() bool -} - -type PatternFlowUdpChecksumChoiceEnum string - -// Enum of Choice on PatternFlowUdpChecksum -var PatternFlowUdpChecksumChoice = struct { - GENERATED PatternFlowUdpChecksumChoiceEnum - CUSTOM PatternFlowUdpChecksumChoiceEnum -}{ - GENERATED: PatternFlowUdpChecksumChoiceEnum("generated"), - CUSTOM: PatternFlowUdpChecksumChoiceEnum("custom"), -} - -func (obj *patternFlowUdpChecksum) Choice() PatternFlowUdpChecksumChoiceEnum { - return PatternFlowUdpChecksumChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The type of checksum -// Choice returns a string -func (obj *patternFlowUdpChecksum) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowUdpChecksum) setChoice(value PatternFlowUdpChecksumChoiceEnum) PatternFlowUdpChecksum { - intValue, ok := otg.PatternFlowUdpChecksum_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowUdpChecksumChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowUdpChecksum_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Custom = nil - obj.obj.Generated = otg.PatternFlowUdpChecksum_Generated_unspecified.Enum() - return obj -} - -type PatternFlowUdpChecksumGeneratedEnum string - -// Enum of Generated on PatternFlowUdpChecksum -var PatternFlowUdpChecksumGenerated = struct { - GOOD PatternFlowUdpChecksumGeneratedEnum - BAD PatternFlowUdpChecksumGeneratedEnum -}{ - GOOD: PatternFlowUdpChecksumGeneratedEnum("good"), - BAD: PatternFlowUdpChecksumGeneratedEnum("bad"), -} - -func (obj *patternFlowUdpChecksum) Generated() PatternFlowUdpChecksumGeneratedEnum { - return PatternFlowUdpChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) -} - -// A system generated checksum value -// Generated returns a string -func (obj *patternFlowUdpChecksum) HasGenerated() bool { - return obj.obj.Generated != nil -} - -func (obj *patternFlowUdpChecksum) SetGenerated(value PatternFlowUdpChecksumGeneratedEnum) PatternFlowUdpChecksum { - intValue, ok := otg.PatternFlowUdpChecksum_Generated_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowUdpChecksumGeneratedEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowUdpChecksum_Generated_Enum(intValue) - obj.obj.Generated = &enumValue - - return obj -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowUdpChecksum) Custom() uint32 { - - if obj.obj.Custom == nil { - obj.setChoice(PatternFlowUdpChecksumChoice.CUSTOM) - } - - return *obj.obj.Custom - -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowUdpChecksum) HasCustom() bool { - return obj.obj.Custom != nil -} - -// A custom checksum value -// SetCustom sets the uint32 value in the PatternFlowUdpChecksum object -func (obj *patternFlowUdpChecksum) SetCustom(value uint32) PatternFlowUdpChecksum { - obj.setChoice(PatternFlowUdpChecksumChoice.CUSTOM) - obj.obj.Custom = &value - return obj -} - -func (obj *patternFlowUdpChecksum) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Custom != nil { - - if *obj.obj.Custom > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpChecksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) - } - - } - -} - -func (obj *patternFlowUdpChecksum) setDefault() { - var choices_set int = 0 - var choice PatternFlowUdpChecksumChoiceEnum - - if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { - choices_set += 1 - choice = PatternFlowUdpChecksumChoice.GENERATED - } - - if obj.obj.Custom != nil { - choices_set += 1 - choice = PatternFlowUdpChecksumChoice.CUSTOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowUdpChecksumChoice.GENERATED) - if obj.obj.Generated.Number() == 0 { - obj.SetGenerated(PatternFlowUdpChecksumGenerated.GOOD) - - } - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowUdpChecksum") - } - } else { - intVal := otg.PatternFlowUdpChecksum_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowUdpChecksum_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGreChecksumPresent ***** -type patternFlowGreChecksumPresent struct { - validation - obj *otg.PatternFlowGreChecksumPresent - marshaller marshalPatternFlowGreChecksumPresent - unMarshaller unMarshalPatternFlowGreChecksumPresent - incrementHolder PatternFlowGreChecksumPresentCounter - decrementHolder PatternFlowGreChecksumPresentCounter - metricTagsHolder PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter -} - -func NewPatternFlowGreChecksumPresent() PatternFlowGreChecksumPresent { - obj := patternFlowGreChecksumPresent{obj: &otg.PatternFlowGreChecksumPresent{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreChecksumPresent) msg() *otg.PatternFlowGreChecksumPresent { - return obj.obj -} - -func (obj *patternFlowGreChecksumPresent) setMsg(msg *otg.PatternFlowGreChecksumPresent) PatternFlowGreChecksumPresent { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreChecksumPresent struct { - obj *patternFlowGreChecksumPresent -} - -type marshalPatternFlowGreChecksumPresent interface { - // ToProto marshals PatternFlowGreChecksumPresent to protobuf object *otg.PatternFlowGreChecksumPresent - ToProto() (*otg.PatternFlowGreChecksumPresent, error) - // ToPbText marshals PatternFlowGreChecksumPresent to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreChecksumPresent to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreChecksumPresent to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreChecksumPresent struct { - obj *patternFlowGreChecksumPresent -} - -type unMarshalPatternFlowGreChecksumPresent interface { - // FromProto unmarshals PatternFlowGreChecksumPresent from protobuf object *otg.PatternFlowGreChecksumPresent - FromProto(msg *otg.PatternFlowGreChecksumPresent) (PatternFlowGreChecksumPresent, error) - // FromPbText unmarshals PatternFlowGreChecksumPresent from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreChecksumPresent from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreChecksumPresent from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreChecksumPresent) Marshal() marshalPatternFlowGreChecksumPresent { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreChecksumPresent{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreChecksumPresent) Unmarshal() unMarshalPatternFlowGreChecksumPresent { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreChecksumPresent{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreChecksumPresent) ToProto() (*otg.PatternFlowGreChecksumPresent, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreChecksumPresent) FromProto(msg *otg.PatternFlowGreChecksumPresent) (PatternFlowGreChecksumPresent, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreChecksumPresent) 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 *unMarshalpatternFlowGreChecksumPresent) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGreChecksumPresent) 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 *unMarshalpatternFlowGreChecksumPresent) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGreChecksumPresent) 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 *unMarshalpatternFlowGreChecksumPresent) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGreChecksumPresent) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreChecksumPresent) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreChecksumPresent) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreChecksumPresent) Clone() (PatternFlowGreChecksumPresent, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreChecksumPresent() - 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 -} - -func (obj *patternFlowGreChecksumPresent) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGreChecksumPresent is checksum present bit -type PatternFlowGreChecksumPresent interface { - Validation - // msg marshals PatternFlowGreChecksumPresent to protobuf object *otg.PatternFlowGreChecksumPresent - // and doesn't set defaults - msg() *otg.PatternFlowGreChecksumPresent - // setMsg unmarshals PatternFlowGreChecksumPresent from protobuf object *otg.PatternFlowGreChecksumPresent - // and doesn't set defaults - setMsg(*otg.PatternFlowGreChecksumPresent) PatternFlowGreChecksumPresent - // provides marshal interface - Marshal() marshalPatternFlowGreChecksumPresent - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreChecksumPresent - // validate validates PatternFlowGreChecksumPresent - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreChecksumPresent, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGreChecksumPresentChoiceEnum, set in PatternFlowGreChecksumPresent - Choice() PatternFlowGreChecksumPresentChoiceEnum - // setChoice assigns PatternFlowGreChecksumPresentChoiceEnum provided by user to PatternFlowGreChecksumPresent - setChoice(value PatternFlowGreChecksumPresentChoiceEnum) PatternFlowGreChecksumPresent - // HasChoice checks if Choice has been set in PatternFlowGreChecksumPresent - HasChoice() bool - // Value returns uint32, set in PatternFlowGreChecksumPresent. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGreChecksumPresent - SetValue(value uint32) PatternFlowGreChecksumPresent - // HasValue checks if Value has been set in PatternFlowGreChecksumPresent - HasValue() bool - // Values returns []uint32, set in PatternFlowGreChecksumPresent. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGreChecksumPresent - SetValues(value []uint32) PatternFlowGreChecksumPresent - // Increment returns PatternFlowGreChecksumPresentCounter, set in PatternFlowGreChecksumPresent. - // PatternFlowGreChecksumPresentCounter is integer counter pattern - Increment() PatternFlowGreChecksumPresentCounter - // SetIncrement assigns PatternFlowGreChecksumPresentCounter provided by user to PatternFlowGreChecksumPresent. - // PatternFlowGreChecksumPresentCounter is integer counter pattern - SetIncrement(value PatternFlowGreChecksumPresentCounter) PatternFlowGreChecksumPresent - // HasIncrement checks if Increment has been set in PatternFlowGreChecksumPresent - HasIncrement() bool - // Decrement returns PatternFlowGreChecksumPresentCounter, set in PatternFlowGreChecksumPresent. - // PatternFlowGreChecksumPresentCounter is integer counter pattern - Decrement() PatternFlowGreChecksumPresentCounter - // SetDecrement assigns PatternFlowGreChecksumPresentCounter provided by user to PatternFlowGreChecksumPresent. - // PatternFlowGreChecksumPresentCounter is integer counter pattern - SetDecrement(value PatternFlowGreChecksumPresentCounter) PatternFlowGreChecksumPresent - // HasDecrement checks if Decrement has been set in PatternFlowGreChecksumPresent - HasDecrement() bool - // MetricTags returns PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIterIter, set in PatternFlowGreChecksumPresent - MetricTags() PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter - setNil() -} - -type PatternFlowGreChecksumPresentChoiceEnum string - -// Enum of Choice on PatternFlowGreChecksumPresent -var PatternFlowGreChecksumPresentChoice = struct { - VALUE PatternFlowGreChecksumPresentChoiceEnum - VALUES PatternFlowGreChecksumPresentChoiceEnum - INCREMENT PatternFlowGreChecksumPresentChoiceEnum - DECREMENT PatternFlowGreChecksumPresentChoiceEnum -}{ - VALUE: PatternFlowGreChecksumPresentChoiceEnum("value"), - VALUES: PatternFlowGreChecksumPresentChoiceEnum("values"), - INCREMENT: PatternFlowGreChecksumPresentChoiceEnum("increment"), - DECREMENT: PatternFlowGreChecksumPresentChoiceEnum("decrement"), -} - -func (obj *patternFlowGreChecksumPresent) Choice() PatternFlowGreChecksumPresentChoiceEnum { - return PatternFlowGreChecksumPresentChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGreChecksumPresent) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGreChecksumPresent) setChoice(value PatternFlowGreChecksumPresentChoiceEnum) PatternFlowGreChecksumPresent { - intValue, ok := otg.PatternFlowGreChecksumPresent_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGreChecksumPresentChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGreChecksumPresent_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGreChecksumPresentChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGreChecksumPresentChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGreChecksumPresentChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGreChecksumPresentCounter().msg() - } - - if value == PatternFlowGreChecksumPresentChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGreChecksumPresentCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGreChecksumPresent) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGreChecksumPresentChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGreChecksumPresent) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGreChecksumPresent object -func (obj *patternFlowGreChecksumPresent) SetValue(value uint32) PatternFlowGreChecksumPresent { - obj.setChoice(PatternFlowGreChecksumPresentChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGreChecksumPresent) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGreChecksumPresent object -func (obj *patternFlowGreChecksumPresent) SetValues(value []uint32) PatternFlowGreChecksumPresent { - obj.setChoice(PatternFlowGreChecksumPresentChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGreChecksumPresentCounter -func (obj *patternFlowGreChecksumPresent) Increment() PatternFlowGreChecksumPresentCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGreChecksumPresentChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGreChecksumPresentCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGreChecksumPresentCounter -func (obj *patternFlowGreChecksumPresent) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGreChecksumPresentCounter value in the PatternFlowGreChecksumPresent object -func (obj *patternFlowGreChecksumPresent) SetIncrement(value PatternFlowGreChecksumPresentCounter) PatternFlowGreChecksumPresent { - obj.setChoice(PatternFlowGreChecksumPresentChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGreChecksumPresentCounter -func (obj *patternFlowGreChecksumPresent) Decrement() PatternFlowGreChecksumPresentCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGreChecksumPresentChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGreChecksumPresentCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGreChecksumPresentCounter -func (obj *patternFlowGreChecksumPresent) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGreChecksumPresentCounter value in the PatternFlowGreChecksumPresent object -func (obj *patternFlowGreChecksumPresent) SetDecrement(value PatternFlowGreChecksumPresentCounter) PatternFlowGreChecksumPresent { - obj.setChoice(PatternFlowGreChecksumPresentChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGreChecksumPresentMetricTag -func (obj *patternFlowGreChecksumPresent) MetricTags() PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGreChecksumPresentMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter struct { - obj *patternFlowGreChecksumPresent - patternFlowGreChecksumPresentMetricTagSlice []PatternFlowGreChecksumPresentMetricTag - fieldPtr *[]*otg.PatternFlowGreChecksumPresentMetricTag -} - -func newPatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter(ptr *[]*otg.PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { - return &patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter interface { - setMsg(*patternFlowGreChecksumPresent) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter - Items() []PatternFlowGreChecksumPresentMetricTag - Add() PatternFlowGreChecksumPresentMetricTag - Append(items ...PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter - Set(index int, newObj PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter - Clear() PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter - clearHolderSlice() PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter - appendHolderSlice(item PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter -} - -func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) setMsg(msg *patternFlowGreChecksumPresent) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGreChecksumPresentMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) Items() []PatternFlowGreChecksumPresentMetricTag { - return obj.patternFlowGreChecksumPresentMetricTagSlice -} - -func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) Add() PatternFlowGreChecksumPresentMetricTag { - newObj := &otg.PatternFlowGreChecksumPresentMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGreChecksumPresentMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGreChecksumPresentMetricTagSlice = append(obj.patternFlowGreChecksumPresentMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) Append(items ...PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGreChecksumPresentMetricTagSlice = append(obj.patternFlowGreChecksumPresentMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) Set(index int, newObj PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGreChecksumPresentMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) Clear() PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGreChecksumPresentMetricTag{} - obj.patternFlowGreChecksumPresentMetricTagSlice = []PatternFlowGreChecksumPresentMetricTag{} - } - return obj -} -func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) clearHolderSlice() PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { - if len(obj.patternFlowGreChecksumPresentMetricTagSlice) > 0 { - obj.patternFlowGreChecksumPresentMetricTagSlice = []PatternFlowGreChecksumPresentMetricTag{} - } - return obj -} -func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) appendHolderSlice(item PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { - obj.patternFlowGreChecksumPresentMetricTagSlice = append(obj.patternFlowGreChecksumPresentMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGreChecksumPresent) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreChecksumPresent.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGreChecksumPresent.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGreChecksumPresentMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGreChecksumPresent) setDefault() { - var choices_set int = 0 - var choice PatternFlowGreChecksumPresentChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGreChecksumPresentChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGreChecksumPresentChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGreChecksumPresentChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGreChecksumPresentChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGreChecksumPresentChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGreChecksumPresent") - } - } else { - intVal := otg.PatternFlowGreChecksumPresent_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGreChecksumPresent_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGreReserved0 ***** -type patternFlowGreReserved0 struct { - validation - obj *otg.PatternFlowGreReserved0 - marshaller marshalPatternFlowGreReserved0 - unMarshaller unMarshalPatternFlowGreReserved0 - incrementHolder PatternFlowGreReserved0Counter - decrementHolder PatternFlowGreReserved0Counter - metricTagsHolder PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter -} - -func NewPatternFlowGreReserved0() PatternFlowGreReserved0 { - obj := patternFlowGreReserved0{obj: &otg.PatternFlowGreReserved0{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreReserved0) msg() *otg.PatternFlowGreReserved0 { - return obj.obj -} - -func (obj *patternFlowGreReserved0) setMsg(msg *otg.PatternFlowGreReserved0) PatternFlowGreReserved0 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreReserved0 struct { - obj *patternFlowGreReserved0 -} - -type marshalPatternFlowGreReserved0 interface { - // ToProto marshals PatternFlowGreReserved0 to protobuf object *otg.PatternFlowGreReserved0 - ToProto() (*otg.PatternFlowGreReserved0, error) - // ToPbText marshals PatternFlowGreReserved0 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreReserved0 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreReserved0 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreReserved0 struct { - obj *patternFlowGreReserved0 -} - -type unMarshalPatternFlowGreReserved0 interface { - // FromProto unmarshals PatternFlowGreReserved0 from protobuf object *otg.PatternFlowGreReserved0 - FromProto(msg *otg.PatternFlowGreReserved0) (PatternFlowGreReserved0, error) - // FromPbText unmarshals PatternFlowGreReserved0 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreReserved0 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreReserved0 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreReserved0) Marshal() marshalPatternFlowGreReserved0 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreReserved0{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreReserved0) Unmarshal() unMarshalPatternFlowGreReserved0 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreReserved0{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreReserved0) ToProto() (*otg.PatternFlowGreReserved0, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreReserved0) FromProto(msg *otg.PatternFlowGreReserved0) (PatternFlowGreReserved0, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreReserved0) 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 *unMarshalpatternFlowGreReserved0) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGreReserved0) 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 *unMarshalpatternFlowGreReserved0) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGreReserved0) 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 *unMarshalpatternFlowGreReserved0) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGreReserved0) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreReserved0) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreReserved0) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreReserved0) Clone() (PatternFlowGreReserved0, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreReserved0() - 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 -} - -func (obj *patternFlowGreReserved0) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGreReserved0 is reserved bits -type PatternFlowGreReserved0 interface { - Validation - // msg marshals PatternFlowGreReserved0 to protobuf object *otg.PatternFlowGreReserved0 - // and doesn't set defaults - msg() *otg.PatternFlowGreReserved0 - // setMsg unmarshals PatternFlowGreReserved0 from protobuf object *otg.PatternFlowGreReserved0 - // and doesn't set defaults - setMsg(*otg.PatternFlowGreReserved0) PatternFlowGreReserved0 - // provides marshal interface - Marshal() marshalPatternFlowGreReserved0 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreReserved0 - // validate validates PatternFlowGreReserved0 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreReserved0, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGreReserved0ChoiceEnum, set in PatternFlowGreReserved0 - Choice() PatternFlowGreReserved0ChoiceEnum - // setChoice assigns PatternFlowGreReserved0ChoiceEnum provided by user to PatternFlowGreReserved0 - setChoice(value PatternFlowGreReserved0ChoiceEnum) PatternFlowGreReserved0 - // HasChoice checks if Choice has been set in PatternFlowGreReserved0 - HasChoice() bool - // Value returns uint32, set in PatternFlowGreReserved0. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGreReserved0 - SetValue(value uint32) PatternFlowGreReserved0 - // HasValue checks if Value has been set in PatternFlowGreReserved0 - HasValue() bool - // Values returns []uint32, set in PatternFlowGreReserved0. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGreReserved0 - SetValues(value []uint32) PatternFlowGreReserved0 - // Increment returns PatternFlowGreReserved0Counter, set in PatternFlowGreReserved0. - // PatternFlowGreReserved0Counter is integer counter pattern - Increment() PatternFlowGreReserved0Counter - // SetIncrement assigns PatternFlowGreReserved0Counter provided by user to PatternFlowGreReserved0. - // PatternFlowGreReserved0Counter is integer counter pattern - SetIncrement(value PatternFlowGreReserved0Counter) PatternFlowGreReserved0 - // HasIncrement checks if Increment has been set in PatternFlowGreReserved0 - HasIncrement() bool - // Decrement returns PatternFlowGreReserved0Counter, set in PatternFlowGreReserved0. - // PatternFlowGreReserved0Counter is integer counter pattern - Decrement() PatternFlowGreReserved0Counter - // SetDecrement assigns PatternFlowGreReserved0Counter provided by user to PatternFlowGreReserved0. - // PatternFlowGreReserved0Counter is integer counter pattern - SetDecrement(value PatternFlowGreReserved0Counter) PatternFlowGreReserved0 - // HasDecrement checks if Decrement has been set in PatternFlowGreReserved0 - HasDecrement() bool - // MetricTags returns PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIterIter, set in PatternFlowGreReserved0 - MetricTags() PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter - setNil() -} - -type PatternFlowGreReserved0ChoiceEnum string - -// Enum of Choice on PatternFlowGreReserved0 -var PatternFlowGreReserved0Choice = struct { - VALUE PatternFlowGreReserved0ChoiceEnum - VALUES PatternFlowGreReserved0ChoiceEnum - INCREMENT PatternFlowGreReserved0ChoiceEnum - DECREMENT PatternFlowGreReserved0ChoiceEnum -}{ - VALUE: PatternFlowGreReserved0ChoiceEnum("value"), - VALUES: PatternFlowGreReserved0ChoiceEnum("values"), - INCREMENT: PatternFlowGreReserved0ChoiceEnum("increment"), - DECREMENT: PatternFlowGreReserved0ChoiceEnum("decrement"), -} - -func (obj *patternFlowGreReserved0) Choice() PatternFlowGreReserved0ChoiceEnum { - return PatternFlowGreReserved0ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGreReserved0) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGreReserved0) setChoice(value PatternFlowGreReserved0ChoiceEnum) PatternFlowGreReserved0 { - intValue, ok := otg.PatternFlowGreReserved0_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGreReserved0ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGreReserved0_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGreReserved0Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGreReserved0Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGreReserved0Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowGreReserved0Counter().msg() - } - - if value == PatternFlowGreReserved0Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGreReserved0Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGreReserved0) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGreReserved0Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGreReserved0) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGreReserved0 object -func (obj *patternFlowGreReserved0) SetValue(value uint32) PatternFlowGreReserved0 { - obj.setChoice(PatternFlowGreReserved0Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGreReserved0) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGreReserved0 object -func (obj *patternFlowGreReserved0) SetValues(value []uint32) PatternFlowGreReserved0 { - obj.setChoice(PatternFlowGreReserved0Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGreReserved0Counter -func (obj *patternFlowGreReserved0) Increment() PatternFlowGreReserved0Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGreReserved0Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGreReserved0Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGreReserved0Counter -func (obj *patternFlowGreReserved0) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGreReserved0Counter value in the PatternFlowGreReserved0 object -func (obj *patternFlowGreReserved0) SetIncrement(value PatternFlowGreReserved0Counter) PatternFlowGreReserved0 { - obj.setChoice(PatternFlowGreReserved0Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGreReserved0Counter -func (obj *patternFlowGreReserved0) Decrement() PatternFlowGreReserved0Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGreReserved0Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGreReserved0Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGreReserved0Counter -func (obj *patternFlowGreReserved0) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGreReserved0Counter value in the PatternFlowGreReserved0 object -func (obj *patternFlowGreReserved0) SetDecrement(value PatternFlowGreReserved0Counter) PatternFlowGreReserved0 { - obj.setChoice(PatternFlowGreReserved0Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGreReserved0MetricTag -func (obj *patternFlowGreReserved0) MetricTags() PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGreReserved0MetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter struct { - obj *patternFlowGreReserved0 - patternFlowGreReserved0MetricTagSlice []PatternFlowGreReserved0MetricTag - fieldPtr *[]*otg.PatternFlowGreReserved0MetricTag -} - -func newPatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter(ptr *[]*otg.PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { - return &patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter interface { - setMsg(*patternFlowGreReserved0) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter - Items() []PatternFlowGreReserved0MetricTag - Add() PatternFlowGreReserved0MetricTag - Append(items ...PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter - Set(index int, newObj PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter - Clear() PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter - clearHolderSlice() PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter - appendHolderSlice(item PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter -} - -func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) setMsg(msg *patternFlowGreReserved0) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGreReserved0MetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) Items() []PatternFlowGreReserved0MetricTag { - return obj.patternFlowGreReserved0MetricTagSlice -} - -func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) Add() PatternFlowGreReserved0MetricTag { - newObj := &otg.PatternFlowGreReserved0MetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGreReserved0MetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGreReserved0MetricTagSlice = append(obj.patternFlowGreReserved0MetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) Append(items ...PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGreReserved0MetricTagSlice = append(obj.patternFlowGreReserved0MetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) Set(index int, newObj PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGreReserved0MetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) Clear() PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGreReserved0MetricTag{} - obj.patternFlowGreReserved0MetricTagSlice = []PatternFlowGreReserved0MetricTag{} - } - return obj -} -func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) clearHolderSlice() PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { - if len(obj.patternFlowGreReserved0MetricTagSlice) > 0 { - obj.patternFlowGreReserved0MetricTagSlice = []PatternFlowGreReserved0MetricTag{} - } - return obj -} -func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) appendHolderSlice(item PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { - obj.patternFlowGreReserved0MetricTagSlice = append(obj.patternFlowGreReserved0MetricTagSlice, item) - return obj -} - -func (obj *patternFlowGreReserved0) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreReserved0.Value <= 4095 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGreReserved0.Values <= 4095 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGreReserved0MetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGreReserved0) setDefault() { - var choices_set int = 0 - var choice PatternFlowGreReserved0ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGreReserved0Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGreReserved0Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGreReserved0Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGreReserved0Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGreReserved0Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGreReserved0") - } - } else { - intVal := otg.PatternFlowGreReserved0_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGreReserved0_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGreVersion ***** -type patternFlowGreVersion struct { - validation - obj *otg.PatternFlowGreVersion - marshaller marshalPatternFlowGreVersion - unMarshaller unMarshalPatternFlowGreVersion - incrementHolder PatternFlowGreVersionCounter - decrementHolder PatternFlowGreVersionCounter - metricTagsHolder PatternFlowGreVersionPatternFlowGreVersionMetricTagIter -} - -func NewPatternFlowGreVersion() PatternFlowGreVersion { - obj := patternFlowGreVersion{obj: &otg.PatternFlowGreVersion{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreVersion) msg() *otg.PatternFlowGreVersion { - return obj.obj -} - -func (obj *patternFlowGreVersion) setMsg(msg *otg.PatternFlowGreVersion) PatternFlowGreVersion { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreVersion struct { - obj *patternFlowGreVersion -} - -type marshalPatternFlowGreVersion interface { - // ToProto marshals PatternFlowGreVersion to protobuf object *otg.PatternFlowGreVersion - ToProto() (*otg.PatternFlowGreVersion, error) - // ToPbText marshals PatternFlowGreVersion to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreVersion to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreVersion to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreVersion struct { - obj *patternFlowGreVersion -} - -type unMarshalPatternFlowGreVersion interface { - // FromProto unmarshals PatternFlowGreVersion from protobuf object *otg.PatternFlowGreVersion - FromProto(msg *otg.PatternFlowGreVersion) (PatternFlowGreVersion, error) - // FromPbText unmarshals PatternFlowGreVersion from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreVersion from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreVersion from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreVersion) Marshal() marshalPatternFlowGreVersion { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreVersion{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreVersion) Unmarshal() unMarshalPatternFlowGreVersion { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreVersion{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreVersion) ToProto() (*otg.PatternFlowGreVersion, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreVersion) FromProto(msg *otg.PatternFlowGreVersion) (PatternFlowGreVersion, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreVersion) 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 *unMarshalpatternFlowGreVersion) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGreVersion) 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 *unMarshalpatternFlowGreVersion) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGreVersion) 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 *unMarshalpatternFlowGreVersion) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGreVersion) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreVersion) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreVersion) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreVersion) Clone() (PatternFlowGreVersion, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreVersion() - 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 -} - -func (obj *patternFlowGreVersion) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGreVersion is gRE version number -type PatternFlowGreVersion interface { - Validation - // msg marshals PatternFlowGreVersion to protobuf object *otg.PatternFlowGreVersion - // and doesn't set defaults - msg() *otg.PatternFlowGreVersion - // setMsg unmarshals PatternFlowGreVersion from protobuf object *otg.PatternFlowGreVersion - // and doesn't set defaults - setMsg(*otg.PatternFlowGreVersion) PatternFlowGreVersion - // provides marshal interface - Marshal() marshalPatternFlowGreVersion - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreVersion - // validate validates PatternFlowGreVersion - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreVersion, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGreVersionChoiceEnum, set in PatternFlowGreVersion - Choice() PatternFlowGreVersionChoiceEnum - // setChoice assigns PatternFlowGreVersionChoiceEnum provided by user to PatternFlowGreVersion - setChoice(value PatternFlowGreVersionChoiceEnum) PatternFlowGreVersion - // HasChoice checks if Choice has been set in PatternFlowGreVersion - HasChoice() bool - // Value returns uint32, set in PatternFlowGreVersion. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGreVersion - SetValue(value uint32) PatternFlowGreVersion - // HasValue checks if Value has been set in PatternFlowGreVersion - HasValue() bool - // Values returns []uint32, set in PatternFlowGreVersion. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGreVersion - SetValues(value []uint32) PatternFlowGreVersion - // Increment returns PatternFlowGreVersionCounter, set in PatternFlowGreVersion. - // PatternFlowGreVersionCounter is integer counter pattern - Increment() PatternFlowGreVersionCounter - // SetIncrement assigns PatternFlowGreVersionCounter provided by user to PatternFlowGreVersion. - // PatternFlowGreVersionCounter is integer counter pattern - SetIncrement(value PatternFlowGreVersionCounter) PatternFlowGreVersion - // HasIncrement checks if Increment has been set in PatternFlowGreVersion - HasIncrement() bool - // Decrement returns PatternFlowGreVersionCounter, set in PatternFlowGreVersion. - // PatternFlowGreVersionCounter is integer counter pattern - Decrement() PatternFlowGreVersionCounter - // SetDecrement assigns PatternFlowGreVersionCounter provided by user to PatternFlowGreVersion. - // PatternFlowGreVersionCounter is integer counter pattern - SetDecrement(value PatternFlowGreVersionCounter) PatternFlowGreVersion - // HasDecrement checks if Decrement has been set in PatternFlowGreVersion - HasDecrement() bool - // MetricTags returns PatternFlowGreVersionPatternFlowGreVersionMetricTagIterIter, set in PatternFlowGreVersion - MetricTags() PatternFlowGreVersionPatternFlowGreVersionMetricTagIter - setNil() -} - -type PatternFlowGreVersionChoiceEnum string - -// Enum of Choice on PatternFlowGreVersion -var PatternFlowGreVersionChoice = struct { - VALUE PatternFlowGreVersionChoiceEnum - VALUES PatternFlowGreVersionChoiceEnum - INCREMENT PatternFlowGreVersionChoiceEnum - DECREMENT PatternFlowGreVersionChoiceEnum -}{ - VALUE: PatternFlowGreVersionChoiceEnum("value"), - VALUES: PatternFlowGreVersionChoiceEnum("values"), - INCREMENT: PatternFlowGreVersionChoiceEnum("increment"), - DECREMENT: PatternFlowGreVersionChoiceEnum("decrement"), -} - -func (obj *patternFlowGreVersion) Choice() PatternFlowGreVersionChoiceEnum { - return PatternFlowGreVersionChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGreVersion) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGreVersion) setChoice(value PatternFlowGreVersionChoiceEnum) PatternFlowGreVersion { - intValue, ok := otg.PatternFlowGreVersion_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGreVersionChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGreVersion_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGreVersionChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGreVersionChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGreVersionChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGreVersionCounter().msg() - } - - if value == PatternFlowGreVersionChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGreVersionCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGreVersion) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGreVersionChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGreVersion) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGreVersion object -func (obj *patternFlowGreVersion) SetValue(value uint32) PatternFlowGreVersion { - obj.setChoice(PatternFlowGreVersionChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGreVersion) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGreVersion object -func (obj *patternFlowGreVersion) SetValues(value []uint32) PatternFlowGreVersion { - obj.setChoice(PatternFlowGreVersionChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGreVersionCounter -func (obj *patternFlowGreVersion) Increment() PatternFlowGreVersionCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGreVersionChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGreVersionCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGreVersionCounter -func (obj *patternFlowGreVersion) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGreVersionCounter value in the PatternFlowGreVersion object -func (obj *patternFlowGreVersion) SetIncrement(value PatternFlowGreVersionCounter) PatternFlowGreVersion { - obj.setChoice(PatternFlowGreVersionChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGreVersionCounter -func (obj *patternFlowGreVersion) Decrement() PatternFlowGreVersionCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGreVersionChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGreVersionCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGreVersionCounter -func (obj *patternFlowGreVersion) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGreVersionCounter value in the PatternFlowGreVersion object -func (obj *patternFlowGreVersion) SetDecrement(value PatternFlowGreVersionCounter) PatternFlowGreVersion { - obj.setChoice(PatternFlowGreVersionChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGreVersionMetricTag -func (obj *patternFlowGreVersion) MetricTags() PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGreVersionMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGreVersionPatternFlowGreVersionMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGreVersionPatternFlowGreVersionMetricTagIter struct { - obj *patternFlowGreVersion - patternFlowGreVersionMetricTagSlice []PatternFlowGreVersionMetricTag - fieldPtr *[]*otg.PatternFlowGreVersionMetricTag -} - -func newPatternFlowGreVersionPatternFlowGreVersionMetricTagIter(ptr *[]*otg.PatternFlowGreVersionMetricTag) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { - return &patternFlowGreVersionPatternFlowGreVersionMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGreVersionPatternFlowGreVersionMetricTagIter interface { - setMsg(*patternFlowGreVersion) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter - Items() []PatternFlowGreVersionMetricTag - Add() PatternFlowGreVersionMetricTag - Append(items ...PatternFlowGreVersionMetricTag) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter - Set(index int, newObj PatternFlowGreVersionMetricTag) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter - Clear() PatternFlowGreVersionPatternFlowGreVersionMetricTagIter - clearHolderSlice() PatternFlowGreVersionPatternFlowGreVersionMetricTagIter - appendHolderSlice(item PatternFlowGreVersionMetricTag) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter -} - -func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) setMsg(msg *patternFlowGreVersion) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGreVersionMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) Items() []PatternFlowGreVersionMetricTag { - return obj.patternFlowGreVersionMetricTagSlice -} - -func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) Add() PatternFlowGreVersionMetricTag { - newObj := &otg.PatternFlowGreVersionMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGreVersionMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGreVersionMetricTagSlice = append(obj.patternFlowGreVersionMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) Append(items ...PatternFlowGreVersionMetricTag) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGreVersionMetricTagSlice = append(obj.patternFlowGreVersionMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) Set(index int, newObj PatternFlowGreVersionMetricTag) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGreVersionMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) Clear() PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGreVersionMetricTag{} - obj.patternFlowGreVersionMetricTagSlice = []PatternFlowGreVersionMetricTag{} - } - return obj -} -func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) clearHolderSlice() PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { - if len(obj.patternFlowGreVersionMetricTagSlice) > 0 { - obj.patternFlowGreVersionMetricTagSlice = []PatternFlowGreVersionMetricTag{} - } - return obj -} -func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) appendHolderSlice(item PatternFlowGreVersionMetricTag) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { - obj.patternFlowGreVersionMetricTagSlice = append(obj.patternFlowGreVersionMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGreVersion) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreVersion.Value <= 7 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGreVersion.Values <= 7 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGreVersionMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGreVersion) setDefault() { - var choices_set int = 0 - var choice PatternFlowGreVersionChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGreVersionChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGreVersionChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGreVersionChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGreVersionChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGreVersionChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGreVersion") - } - } else { - intVal := otg.PatternFlowGreVersion_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGreVersion_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGreProtocol ***** -type patternFlowGreProtocol struct { - validation - obj *otg.PatternFlowGreProtocol - marshaller marshalPatternFlowGreProtocol - unMarshaller unMarshalPatternFlowGreProtocol - incrementHolder PatternFlowGreProtocolCounter - decrementHolder PatternFlowGreProtocolCounter - metricTagsHolder PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter -} - -func NewPatternFlowGreProtocol() PatternFlowGreProtocol { - obj := patternFlowGreProtocol{obj: &otg.PatternFlowGreProtocol{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreProtocol) msg() *otg.PatternFlowGreProtocol { - return obj.obj -} - -func (obj *patternFlowGreProtocol) setMsg(msg *otg.PatternFlowGreProtocol) PatternFlowGreProtocol { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreProtocol struct { - obj *patternFlowGreProtocol -} - -type marshalPatternFlowGreProtocol interface { - // ToProto marshals PatternFlowGreProtocol to protobuf object *otg.PatternFlowGreProtocol - ToProto() (*otg.PatternFlowGreProtocol, error) - // ToPbText marshals PatternFlowGreProtocol to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreProtocol to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreProtocol to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreProtocol struct { - obj *patternFlowGreProtocol -} - -type unMarshalPatternFlowGreProtocol interface { - // FromProto unmarshals PatternFlowGreProtocol from protobuf object *otg.PatternFlowGreProtocol - FromProto(msg *otg.PatternFlowGreProtocol) (PatternFlowGreProtocol, error) - // FromPbText unmarshals PatternFlowGreProtocol from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreProtocol from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreProtocol from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreProtocol) Marshal() marshalPatternFlowGreProtocol { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreProtocol{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreProtocol) Unmarshal() unMarshalPatternFlowGreProtocol { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreProtocol{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreProtocol) ToProto() (*otg.PatternFlowGreProtocol, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreProtocol) FromProto(msg *otg.PatternFlowGreProtocol) (PatternFlowGreProtocol, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreProtocol) 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 *unMarshalpatternFlowGreProtocol) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGreProtocol) 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 *unMarshalpatternFlowGreProtocol) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGreProtocol) 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 *unMarshalpatternFlowGreProtocol) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGreProtocol) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreProtocol) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreProtocol) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreProtocol) Clone() (PatternFlowGreProtocol, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreProtocol() - 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 -} - -func (obj *patternFlowGreProtocol) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGreProtocol is protocol type of encapsulated payload -type PatternFlowGreProtocol interface { - Validation - // msg marshals PatternFlowGreProtocol to protobuf object *otg.PatternFlowGreProtocol - // and doesn't set defaults - msg() *otg.PatternFlowGreProtocol - // setMsg unmarshals PatternFlowGreProtocol from protobuf object *otg.PatternFlowGreProtocol - // and doesn't set defaults - setMsg(*otg.PatternFlowGreProtocol) PatternFlowGreProtocol - // provides marshal interface - Marshal() marshalPatternFlowGreProtocol - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreProtocol - // validate validates PatternFlowGreProtocol - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreProtocol, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGreProtocolChoiceEnum, set in PatternFlowGreProtocol - Choice() PatternFlowGreProtocolChoiceEnum - // setChoice assigns PatternFlowGreProtocolChoiceEnum provided by user to PatternFlowGreProtocol - setChoice(value PatternFlowGreProtocolChoiceEnum) PatternFlowGreProtocol - // HasChoice checks if Choice has been set in PatternFlowGreProtocol - HasChoice() bool - // Value returns uint32, set in PatternFlowGreProtocol. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGreProtocol - SetValue(value uint32) PatternFlowGreProtocol - // HasValue checks if Value has been set in PatternFlowGreProtocol - HasValue() bool - // Values returns []uint32, set in PatternFlowGreProtocol. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGreProtocol - SetValues(value []uint32) PatternFlowGreProtocol - // Increment returns PatternFlowGreProtocolCounter, set in PatternFlowGreProtocol. - // PatternFlowGreProtocolCounter is integer counter pattern - Increment() PatternFlowGreProtocolCounter - // SetIncrement assigns PatternFlowGreProtocolCounter provided by user to PatternFlowGreProtocol. - // PatternFlowGreProtocolCounter is integer counter pattern - SetIncrement(value PatternFlowGreProtocolCounter) PatternFlowGreProtocol - // HasIncrement checks if Increment has been set in PatternFlowGreProtocol - HasIncrement() bool - // Decrement returns PatternFlowGreProtocolCounter, set in PatternFlowGreProtocol. - // PatternFlowGreProtocolCounter is integer counter pattern - Decrement() PatternFlowGreProtocolCounter - // SetDecrement assigns PatternFlowGreProtocolCounter provided by user to PatternFlowGreProtocol. - // PatternFlowGreProtocolCounter is integer counter pattern - SetDecrement(value PatternFlowGreProtocolCounter) PatternFlowGreProtocol - // HasDecrement checks if Decrement has been set in PatternFlowGreProtocol - HasDecrement() bool - // MetricTags returns PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIterIter, set in PatternFlowGreProtocol - MetricTags() PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter - setNil() -} - -type PatternFlowGreProtocolChoiceEnum string - -// Enum of Choice on PatternFlowGreProtocol -var PatternFlowGreProtocolChoice = struct { - VALUE PatternFlowGreProtocolChoiceEnum - VALUES PatternFlowGreProtocolChoiceEnum - INCREMENT PatternFlowGreProtocolChoiceEnum - DECREMENT PatternFlowGreProtocolChoiceEnum -}{ - VALUE: PatternFlowGreProtocolChoiceEnum("value"), - VALUES: PatternFlowGreProtocolChoiceEnum("values"), - INCREMENT: PatternFlowGreProtocolChoiceEnum("increment"), - DECREMENT: PatternFlowGreProtocolChoiceEnum("decrement"), -} - -func (obj *patternFlowGreProtocol) Choice() PatternFlowGreProtocolChoiceEnum { - return PatternFlowGreProtocolChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGreProtocol) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGreProtocol) setChoice(value PatternFlowGreProtocolChoiceEnum) PatternFlowGreProtocol { - intValue, ok := otg.PatternFlowGreProtocol_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGreProtocolChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGreProtocol_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGreProtocolChoice.VALUE { - defaultValue := uint32(2048) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGreProtocolChoice.VALUES { - defaultValue := []uint32{2048} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGreProtocolChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGreProtocolCounter().msg() - } - - if value == PatternFlowGreProtocolChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGreProtocolCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGreProtocol) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGreProtocolChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGreProtocol) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGreProtocol object -func (obj *patternFlowGreProtocol) SetValue(value uint32) PatternFlowGreProtocol { - obj.setChoice(PatternFlowGreProtocolChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGreProtocol) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{2048}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGreProtocol object -func (obj *patternFlowGreProtocol) SetValues(value []uint32) PatternFlowGreProtocol { - obj.setChoice(PatternFlowGreProtocolChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGreProtocolCounter -func (obj *patternFlowGreProtocol) Increment() PatternFlowGreProtocolCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGreProtocolChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGreProtocolCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGreProtocolCounter -func (obj *patternFlowGreProtocol) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGreProtocolCounter value in the PatternFlowGreProtocol object -func (obj *patternFlowGreProtocol) SetIncrement(value PatternFlowGreProtocolCounter) PatternFlowGreProtocol { - obj.setChoice(PatternFlowGreProtocolChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGreProtocolCounter -func (obj *patternFlowGreProtocol) Decrement() PatternFlowGreProtocolCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGreProtocolChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGreProtocolCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGreProtocolCounter -func (obj *patternFlowGreProtocol) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGreProtocolCounter value in the PatternFlowGreProtocol object -func (obj *patternFlowGreProtocol) SetDecrement(value PatternFlowGreProtocolCounter) PatternFlowGreProtocol { - obj.setChoice(PatternFlowGreProtocolChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGreProtocolMetricTag -func (obj *patternFlowGreProtocol) MetricTags() PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGreProtocolMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter struct { - obj *patternFlowGreProtocol - patternFlowGreProtocolMetricTagSlice []PatternFlowGreProtocolMetricTag - fieldPtr *[]*otg.PatternFlowGreProtocolMetricTag -} - -func newPatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter(ptr *[]*otg.PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { - return &patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter interface { - setMsg(*patternFlowGreProtocol) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter - Items() []PatternFlowGreProtocolMetricTag - Add() PatternFlowGreProtocolMetricTag - Append(items ...PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter - Set(index int, newObj PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter - Clear() PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter - clearHolderSlice() PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter - appendHolderSlice(item PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter -} - -func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) setMsg(msg *patternFlowGreProtocol) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGreProtocolMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) Items() []PatternFlowGreProtocolMetricTag { - return obj.patternFlowGreProtocolMetricTagSlice -} - -func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) Add() PatternFlowGreProtocolMetricTag { - newObj := &otg.PatternFlowGreProtocolMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGreProtocolMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGreProtocolMetricTagSlice = append(obj.patternFlowGreProtocolMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) Append(items ...PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGreProtocolMetricTagSlice = append(obj.patternFlowGreProtocolMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) Set(index int, newObj PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGreProtocolMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) Clear() PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGreProtocolMetricTag{} - obj.patternFlowGreProtocolMetricTagSlice = []PatternFlowGreProtocolMetricTag{} - } - return obj -} -func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) clearHolderSlice() PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { - if len(obj.patternFlowGreProtocolMetricTagSlice) > 0 { - obj.patternFlowGreProtocolMetricTagSlice = []PatternFlowGreProtocolMetricTag{} - } - return obj -} -func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) appendHolderSlice(item PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { - obj.patternFlowGreProtocolMetricTagSlice = append(obj.patternFlowGreProtocolMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGreProtocol) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreProtocol.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGreProtocol.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGreProtocolMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGreProtocol) setDefault() { - var choices_set int = 0 - var choice PatternFlowGreProtocolChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGreProtocolChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGreProtocolChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGreProtocolChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGreProtocolChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGreProtocolChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGreProtocol") - } - } else { - intVal := otg.PatternFlowGreProtocol_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGreProtocol_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGreChecksum ***** -type patternFlowGreChecksum struct { - validation - obj *otg.PatternFlowGreChecksum - marshaller marshalPatternFlowGreChecksum - unMarshaller unMarshalPatternFlowGreChecksum -} - -func NewPatternFlowGreChecksum() PatternFlowGreChecksum { - obj := patternFlowGreChecksum{obj: &otg.PatternFlowGreChecksum{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreChecksum) msg() *otg.PatternFlowGreChecksum { - return obj.obj -} - -func (obj *patternFlowGreChecksum) setMsg(msg *otg.PatternFlowGreChecksum) PatternFlowGreChecksum { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreChecksum struct { - obj *patternFlowGreChecksum -} - -type marshalPatternFlowGreChecksum interface { - // ToProto marshals PatternFlowGreChecksum to protobuf object *otg.PatternFlowGreChecksum - ToProto() (*otg.PatternFlowGreChecksum, error) - // ToPbText marshals PatternFlowGreChecksum to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreChecksum to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreChecksum to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreChecksum struct { - obj *patternFlowGreChecksum -} - -type unMarshalPatternFlowGreChecksum interface { - // FromProto unmarshals PatternFlowGreChecksum from protobuf object *otg.PatternFlowGreChecksum - FromProto(msg *otg.PatternFlowGreChecksum) (PatternFlowGreChecksum, error) - // FromPbText unmarshals PatternFlowGreChecksum from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreChecksum from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreChecksum from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreChecksum) Marshal() marshalPatternFlowGreChecksum { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreChecksum{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreChecksum) Unmarshal() unMarshalPatternFlowGreChecksum { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreChecksum{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreChecksum) ToProto() (*otg.PatternFlowGreChecksum, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreChecksum) FromProto(msg *otg.PatternFlowGreChecksum) (PatternFlowGreChecksum, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreChecksum) 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 *unMarshalpatternFlowGreChecksum) 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 *marshalpatternFlowGreChecksum) 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 *unMarshalpatternFlowGreChecksum) 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 *marshalpatternFlowGreChecksum) 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 *unMarshalpatternFlowGreChecksum) 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 *patternFlowGreChecksum) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreChecksum) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreChecksum) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreChecksum) Clone() (PatternFlowGreChecksum, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreChecksum() - 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 -} - -// PatternFlowGreChecksum is optional checksum of GRE header and payload. Only present if the checksum_present bit is set. -type PatternFlowGreChecksum interface { - Validation - // msg marshals PatternFlowGreChecksum to protobuf object *otg.PatternFlowGreChecksum - // and doesn't set defaults - msg() *otg.PatternFlowGreChecksum - // setMsg unmarshals PatternFlowGreChecksum from protobuf object *otg.PatternFlowGreChecksum - // and doesn't set defaults - setMsg(*otg.PatternFlowGreChecksum) PatternFlowGreChecksum - // provides marshal interface - Marshal() marshalPatternFlowGreChecksum - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreChecksum - // validate validates PatternFlowGreChecksum - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreChecksum, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGreChecksumChoiceEnum, set in PatternFlowGreChecksum - Choice() PatternFlowGreChecksumChoiceEnum - // setChoice assigns PatternFlowGreChecksumChoiceEnum provided by user to PatternFlowGreChecksum - setChoice(value PatternFlowGreChecksumChoiceEnum) PatternFlowGreChecksum - // HasChoice checks if Choice has been set in PatternFlowGreChecksum - HasChoice() bool - // Generated returns PatternFlowGreChecksumGeneratedEnum, set in PatternFlowGreChecksum - Generated() PatternFlowGreChecksumGeneratedEnum - // SetGenerated assigns PatternFlowGreChecksumGeneratedEnum provided by user to PatternFlowGreChecksum - SetGenerated(value PatternFlowGreChecksumGeneratedEnum) PatternFlowGreChecksum - // HasGenerated checks if Generated has been set in PatternFlowGreChecksum - HasGenerated() bool - // Custom returns uint32, set in PatternFlowGreChecksum. - Custom() uint32 - // SetCustom assigns uint32 provided by user to PatternFlowGreChecksum - SetCustom(value uint32) PatternFlowGreChecksum - // HasCustom checks if Custom has been set in PatternFlowGreChecksum - HasCustom() bool -} - -type PatternFlowGreChecksumChoiceEnum string - -// Enum of Choice on PatternFlowGreChecksum -var PatternFlowGreChecksumChoice = struct { - GENERATED PatternFlowGreChecksumChoiceEnum - CUSTOM PatternFlowGreChecksumChoiceEnum -}{ - GENERATED: PatternFlowGreChecksumChoiceEnum("generated"), - CUSTOM: PatternFlowGreChecksumChoiceEnum("custom"), -} - -func (obj *patternFlowGreChecksum) Choice() PatternFlowGreChecksumChoiceEnum { - return PatternFlowGreChecksumChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The type of checksum -// Choice returns a string -func (obj *patternFlowGreChecksum) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGreChecksum) setChoice(value PatternFlowGreChecksumChoiceEnum) PatternFlowGreChecksum { - intValue, ok := otg.PatternFlowGreChecksum_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGreChecksumChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGreChecksum_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Custom = nil - obj.obj.Generated = otg.PatternFlowGreChecksum_Generated_unspecified.Enum() - return obj -} - -type PatternFlowGreChecksumGeneratedEnum string - -// Enum of Generated on PatternFlowGreChecksum -var PatternFlowGreChecksumGenerated = struct { - GOOD PatternFlowGreChecksumGeneratedEnum - BAD PatternFlowGreChecksumGeneratedEnum -}{ - GOOD: PatternFlowGreChecksumGeneratedEnum("good"), - BAD: PatternFlowGreChecksumGeneratedEnum("bad"), -} - -func (obj *patternFlowGreChecksum) Generated() PatternFlowGreChecksumGeneratedEnum { - return PatternFlowGreChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) -} - -// A system generated checksum value -// Generated returns a string -func (obj *patternFlowGreChecksum) HasGenerated() bool { - return obj.obj.Generated != nil -} - -func (obj *patternFlowGreChecksum) SetGenerated(value PatternFlowGreChecksumGeneratedEnum) PatternFlowGreChecksum { - intValue, ok := otg.PatternFlowGreChecksum_Generated_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGreChecksumGeneratedEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGreChecksum_Generated_Enum(intValue) - obj.obj.Generated = &enumValue - - return obj -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowGreChecksum) Custom() uint32 { - - if obj.obj.Custom == nil { - obj.setChoice(PatternFlowGreChecksumChoice.CUSTOM) - } - - return *obj.obj.Custom - -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowGreChecksum) HasCustom() bool { - return obj.obj.Custom != nil -} - -// A custom checksum value -// SetCustom sets the uint32 value in the PatternFlowGreChecksum object -func (obj *patternFlowGreChecksum) SetCustom(value uint32) PatternFlowGreChecksum { - obj.setChoice(PatternFlowGreChecksumChoice.CUSTOM) - obj.obj.Custom = &value - return obj -} - -func (obj *patternFlowGreChecksum) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Custom != nil { - - if *obj.obj.Custom > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreChecksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) - } - - } - -} - -func (obj *patternFlowGreChecksum) setDefault() { - var choices_set int = 0 - var choice PatternFlowGreChecksumChoiceEnum - - if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { - choices_set += 1 - choice = PatternFlowGreChecksumChoice.GENERATED - } - - if obj.obj.Custom != nil { - choices_set += 1 - choice = PatternFlowGreChecksumChoice.CUSTOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGreChecksumChoice.GENERATED) - if obj.obj.Generated.Number() == 0 { - obj.SetGenerated(PatternFlowGreChecksumGenerated.GOOD) - - } - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGreChecksum") - } - } else { - intVal := otg.PatternFlowGreChecksum_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGreChecksum_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGreReserved1 ***** -type patternFlowGreReserved1 struct { - validation - obj *otg.PatternFlowGreReserved1 - marshaller marshalPatternFlowGreReserved1 - unMarshaller unMarshalPatternFlowGreReserved1 - incrementHolder PatternFlowGreReserved1Counter - decrementHolder PatternFlowGreReserved1Counter - metricTagsHolder PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter -} - -func NewPatternFlowGreReserved1() PatternFlowGreReserved1 { - obj := patternFlowGreReserved1{obj: &otg.PatternFlowGreReserved1{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreReserved1) msg() *otg.PatternFlowGreReserved1 { - return obj.obj -} - -func (obj *patternFlowGreReserved1) setMsg(msg *otg.PatternFlowGreReserved1) PatternFlowGreReserved1 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreReserved1 struct { - obj *patternFlowGreReserved1 -} - -type marshalPatternFlowGreReserved1 interface { - // ToProto marshals PatternFlowGreReserved1 to protobuf object *otg.PatternFlowGreReserved1 - ToProto() (*otg.PatternFlowGreReserved1, error) - // ToPbText marshals PatternFlowGreReserved1 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreReserved1 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreReserved1 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreReserved1 struct { - obj *patternFlowGreReserved1 -} - -type unMarshalPatternFlowGreReserved1 interface { - // FromProto unmarshals PatternFlowGreReserved1 from protobuf object *otg.PatternFlowGreReserved1 - FromProto(msg *otg.PatternFlowGreReserved1) (PatternFlowGreReserved1, error) - // FromPbText unmarshals PatternFlowGreReserved1 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreReserved1 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreReserved1 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreReserved1) Marshal() marshalPatternFlowGreReserved1 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreReserved1{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreReserved1) Unmarshal() unMarshalPatternFlowGreReserved1 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreReserved1{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreReserved1) ToProto() (*otg.PatternFlowGreReserved1, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreReserved1) FromProto(msg *otg.PatternFlowGreReserved1) (PatternFlowGreReserved1, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreReserved1) 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 *unMarshalpatternFlowGreReserved1) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGreReserved1) 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 *unMarshalpatternFlowGreReserved1) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGreReserved1) 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 *unMarshalpatternFlowGreReserved1) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGreReserved1) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreReserved1) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreReserved1) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreReserved1) Clone() (PatternFlowGreReserved1, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreReserved1() - 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 -} - -func (obj *patternFlowGreReserved1) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGreReserved1 is optional reserved field. Only present if the checksum_present bit is set. -type PatternFlowGreReserved1 interface { - Validation - // msg marshals PatternFlowGreReserved1 to protobuf object *otg.PatternFlowGreReserved1 - // and doesn't set defaults - msg() *otg.PatternFlowGreReserved1 - // setMsg unmarshals PatternFlowGreReserved1 from protobuf object *otg.PatternFlowGreReserved1 - // and doesn't set defaults - setMsg(*otg.PatternFlowGreReserved1) PatternFlowGreReserved1 - // provides marshal interface - Marshal() marshalPatternFlowGreReserved1 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreReserved1 - // validate validates PatternFlowGreReserved1 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreReserved1, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGreReserved1ChoiceEnum, set in PatternFlowGreReserved1 - Choice() PatternFlowGreReserved1ChoiceEnum - // setChoice assigns PatternFlowGreReserved1ChoiceEnum provided by user to PatternFlowGreReserved1 - setChoice(value PatternFlowGreReserved1ChoiceEnum) PatternFlowGreReserved1 - // HasChoice checks if Choice has been set in PatternFlowGreReserved1 - HasChoice() bool - // Value returns uint32, set in PatternFlowGreReserved1. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGreReserved1 - SetValue(value uint32) PatternFlowGreReserved1 - // HasValue checks if Value has been set in PatternFlowGreReserved1 - HasValue() bool - // Values returns []uint32, set in PatternFlowGreReserved1. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGreReserved1 - SetValues(value []uint32) PatternFlowGreReserved1 - // Increment returns PatternFlowGreReserved1Counter, set in PatternFlowGreReserved1. - // PatternFlowGreReserved1Counter is integer counter pattern - Increment() PatternFlowGreReserved1Counter - // SetIncrement assigns PatternFlowGreReserved1Counter provided by user to PatternFlowGreReserved1. - // PatternFlowGreReserved1Counter is integer counter pattern - SetIncrement(value PatternFlowGreReserved1Counter) PatternFlowGreReserved1 - // HasIncrement checks if Increment has been set in PatternFlowGreReserved1 - HasIncrement() bool - // Decrement returns PatternFlowGreReserved1Counter, set in PatternFlowGreReserved1. - // PatternFlowGreReserved1Counter is integer counter pattern - Decrement() PatternFlowGreReserved1Counter - // SetDecrement assigns PatternFlowGreReserved1Counter provided by user to PatternFlowGreReserved1. - // PatternFlowGreReserved1Counter is integer counter pattern - SetDecrement(value PatternFlowGreReserved1Counter) PatternFlowGreReserved1 - // HasDecrement checks if Decrement has been set in PatternFlowGreReserved1 - HasDecrement() bool - // MetricTags returns PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIterIter, set in PatternFlowGreReserved1 - MetricTags() PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter - setNil() -} - -type PatternFlowGreReserved1ChoiceEnum string - -// Enum of Choice on PatternFlowGreReserved1 -var PatternFlowGreReserved1Choice = struct { - VALUE PatternFlowGreReserved1ChoiceEnum - VALUES PatternFlowGreReserved1ChoiceEnum - INCREMENT PatternFlowGreReserved1ChoiceEnum - DECREMENT PatternFlowGreReserved1ChoiceEnum -}{ - VALUE: PatternFlowGreReserved1ChoiceEnum("value"), - VALUES: PatternFlowGreReserved1ChoiceEnum("values"), - INCREMENT: PatternFlowGreReserved1ChoiceEnum("increment"), - DECREMENT: PatternFlowGreReserved1ChoiceEnum("decrement"), -} - -func (obj *patternFlowGreReserved1) Choice() PatternFlowGreReserved1ChoiceEnum { - return PatternFlowGreReserved1ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGreReserved1) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGreReserved1) setChoice(value PatternFlowGreReserved1ChoiceEnum) PatternFlowGreReserved1 { - intValue, ok := otg.PatternFlowGreReserved1_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGreReserved1ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGreReserved1_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGreReserved1Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGreReserved1Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGreReserved1Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowGreReserved1Counter().msg() - } - - if value == PatternFlowGreReserved1Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGreReserved1Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGreReserved1) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGreReserved1Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGreReserved1) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGreReserved1 object -func (obj *patternFlowGreReserved1) SetValue(value uint32) PatternFlowGreReserved1 { - obj.setChoice(PatternFlowGreReserved1Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGreReserved1) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGreReserved1 object -func (obj *patternFlowGreReserved1) SetValues(value []uint32) PatternFlowGreReserved1 { - obj.setChoice(PatternFlowGreReserved1Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGreReserved1Counter -func (obj *patternFlowGreReserved1) Increment() PatternFlowGreReserved1Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGreReserved1Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGreReserved1Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGreReserved1Counter -func (obj *patternFlowGreReserved1) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGreReserved1Counter value in the PatternFlowGreReserved1 object -func (obj *patternFlowGreReserved1) SetIncrement(value PatternFlowGreReserved1Counter) PatternFlowGreReserved1 { - obj.setChoice(PatternFlowGreReserved1Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGreReserved1Counter -func (obj *patternFlowGreReserved1) Decrement() PatternFlowGreReserved1Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGreReserved1Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGreReserved1Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGreReserved1Counter -func (obj *patternFlowGreReserved1) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGreReserved1Counter value in the PatternFlowGreReserved1 object -func (obj *patternFlowGreReserved1) SetDecrement(value PatternFlowGreReserved1Counter) PatternFlowGreReserved1 { - obj.setChoice(PatternFlowGreReserved1Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGreReserved1MetricTag -func (obj *patternFlowGreReserved1) MetricTags() PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGreReserved1MetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter struct { - obj *patternFlowGreReserved1 - patternFlowGreReserved1MetricTagSlice []PatternFlowGreReserved1MetricTag - fieldPtr *[]*otg.PatternFlowGreReserved1MetricTag -} - -func newPatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter(ptr *[]*otg.PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { - return &patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter interface { - setMsg(*patternFlowGreReserved1) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter - Items() []PatternFlowGreReserved1MetricTag - Add() PatternFlowGreReserved1MetricTag - Append(items ...PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter - Set(index int, newObj PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter - Clear() PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter - clearHolderSlice() PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter - appendHolderSlice(item PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter -} - -func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) setMsg(msg *patternFlowGreReserved1) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGreReserved1MetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) Items() []PatternFlowGreReserved1MetricTag { - return obj.patternFlowGreReserved1MetricTagSlice -} - -func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) Add() PatternFlowGreReserved1MetricTag { - newObj := &otg.PatternFlowGreReserved1MetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGreReserved1MetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGreReserved1MetricTagSlice = append(obj.patternFlowGreReserved1MetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) Append(items ...PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGreReserved1MetricTagSlice = append(obj.patternFlowGreReserved1MetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) Set(index int, newObj PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGreReserved1MetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) Clear() PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGreReserved1MetricTag{} - obj.patternFlowGreReserved1MetricTagSlice = []PatternFlowGreReserved1MetricTag{} - } - return obj -} -func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) clearHolderSlice() PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { - if len(obj.patternFlowGreReserved1MetricTagSlice) > 0 { - obj.patternFlowGreReserved1MetricTagSlice = []PatternFlowGreReserved1MetricTag{} - } - return obj -} -func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) appendHolderSlice(item PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { - obj.patternFlowGreReserved1MetricTagSlice = append(obj.patternFlowGreReserved1MetricTagSlice, item) - return obj -} - -func (obj *patternFlowGreReserved1) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreReserved1.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGreReserved1.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGreReserved1MetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGreReserved1) setDefault() { - var choices_set int = 0 - var choice PatternFlowGreReserved1ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGreReserved1Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGreReserved1Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGreReserved1Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGreReserved1Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGreReserved1Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGreReserved1") - } - } else { - intVal := otg.PatternFlowGreReserved1_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGreReserved1_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv1Version ***** -type patternFlowGtpv1Version struct { - validation - obj *otg.PatternFlowGtpv1Version - marshaller marshalPatternFlowGtpv1Version - unMarshaller unMarshalPatternFlowGtpv1Version - incrementHolder PatternFlowGtpv1VersionCounter - decrementHolder PatternFlowGtpv1VersionCounter - metricTagsHolder PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter -} - -func NewPatternFlowGtpv1Version() PatternFlowGtpv1Version { - obj := patternFlowGtpv1Version{obj: &otg.PatternFlowGtpv1Version{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1Version) msg() *otg.PatternFlowGtpv1Version { - return obj.obj -} - -func (obj *patternFlowGtpv1Version) setMsg(msg *otg.PatternFlowGtpv1Version) PatternFlowGtpv1Version { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1Version struct { - obj *patternFlowGtpv1Version -} - -type marshalPatternFlowGtpv1Version interface { - // ToProto marshals PatternFlowGtpv1Version to protobuf object *otg.PatternFlowGtpv1Version - ToProto() (*otg.PatternFlowGtpv1Version, error) - // ToPbText marshals PatternFlowGtpv1Version to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1Version to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1Version to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1Version struct { - obj *patternFlowGtpv1Version -} - -type unMarshalPatternFlowGtpv1Version interface { - // FromProto unmarshals PatternFlowGtpv1Version from protobuf object *otg.PatternFlowGtpv1Version - FromProto(msg *otg.PatternFlowGtpv1Version) (PatternFlowGtpv1Version, error) - // FromPbText unmarshals PatternFlowGtpv1Version from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1Version from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1Version from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1Version) Marshal() marshalPatternFlowGtpv1Version { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1Version{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1Version) Unmarshal() unMarshalPatternFlowGtpv1Version { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1Version{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1Version) ToProto() (*otg.PatternFlowGtpv1Version, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1Version) FromProto(msg *otg.PatternFlowGtpv1Version) (PatternFlowGtpv1Version, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1Version) 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 *unMarshalpatternFlowGtpv1Version) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv1Version) 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 *unMarshalpatternFlowGtpv1Version) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv1Version) 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 *unMarshalpatternFlowGtpv1Version) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv1Version) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1Version) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1Version) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1Version) Clone() (PatternFlowGtpv1Version, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1Version() - 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 -} - -func (obj *patternFlowGtpv1Version) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv1Version is gTPv1 version -type PatternFlowGtpv1Version interface { - Validation - // msg marshals PatternFlowGtpv1Version to protobuf object *otg.PatternFlowGtpv1Version - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1Version - // setMsg unmarshals PatternFlowGtpv1Version from protobuf object *otg.PatternFlowGtpv1Version - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1Version) PatternFlowGtpv1Version - // provides marshal interface - Marshal() marshalPatternFlowGtpv1Version - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1Version - // validate validates PatternFlowGtpv1Version - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1Version, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv1VersionChoiceEnum, set in PatternFlowGtpv1Version - Choice() PatternFlowGtpv1VersionChoiceEnum - // setChoice assigns PatternFlowGtpv1VersionChoiceEnum provided by user to PatternFlowGtpv1Version - setChoice(value PatternFlowGtpv1VersionChoiceEnum) PatternFlowGtpv1Version - // HasChoice checks if Choice has been set in PatternFlowGtpv1Version - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv1Version. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv1Version - SetValue(value uint32) PatternFlowGtpv1Version - // HasValue checks if Value has been set in PatternFlowGtpv1Version - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv1Version. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv1Version - SetValues(value []uint32) PatternFlowGtpv1Version - // Increment returns PatternFlowGtpv1VersionCounter, set in PatternFlowGtpv1Version. - // PatternFlowGtpv1VersionCounter is integer counter pattern - Increment() PatternFlowGtpv1VersionCounter - // SetIncrement assigns PatternFlowGtpv1VersionCounter provided by user to PatternFlowGtpv1Version. - // PatternFlowGtpv1VersionCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv1VersionCounter) PatternFlowGtpv1Version - // HasIncrement checks if Increment has been set in PatternFlowGtpv1Version - HasIncrement() bool - // Decrement returns PatternFlowGtpv1VersionCounter, set in PatternFlowGtpv1Version. - // PatternFlowGtpv1VersionCounter is integer counter pattern - Decrement() PatternFlowGtpv1VersionCounter - // SetDecrement assigns PatternFlowGtpv1VersionCounter provided by user to PatternFlowGtpv1Version. - // PatternFlowGtpv1VersionCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv1VersionCounter) PatternFlowGtpv1Version - // HasDecrement checks if Decrement has been set in PatternFlowGtpv1Version - HasDecrement() bool - // MetricTags returns PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIterIter, set in PatternFlowGtpv1Version - MetricTags() PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter - setNil() -} - -type PatternFlowGtpv1VersionChoiceEnum string - -// Enum of Choice on PatternFlowGtpv1Version -var PatternFlowGtpv1VersionChoice = struct { - VALUE PatternFlowGtpv1VersionChoiceEnum - VALUES PatternFlowGtpv1VersionChoiceEnum - INCREMENT PatternFlowGtpv1VersionChoiceEnum - DECREMENT PatternFlowGtpv1VersionChoiceEnum -}{ - VALUE: PatternFlowGtpv1VersionChoiceEnum("value"), - VALUES: PatternFlowGtpv1VersionChoiceEnum("values"), - INCREMENT: PatternFlowGtpv1VersionChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv1VersionChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv1Version) Choice() PatternFlowGtpv1VersionChoiceEnum { - return PatternFlowGtpv1VersionChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv1Version) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv1Version) setChoice(value PatternFlowGtpv1VersionChoiceEnum) PatternFlowGtpv1Version { - intValue, ok := otg.PatternFlowGtpv1Version_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv1VersionChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv1Version_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv1VersionChoice.VALUE { - defaultValue := uint32(1) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv1VersionChoice.VALUES { - defaultValue := []uint32{1} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv1VersionChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv1VersionCounter().msg() - } - - if value == PatternFlowGtpv1VersionChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv1VersionCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1Version) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv1VersionChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1Version) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv1Version object -func (obj *patternFlowGtpv1Version) SetValue(value uint32) PatternFlowGtpv1Version { - obj.setChoice(PatternFlowGtpv1VersionChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv1Version) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{1}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv1Version object -func (obj *patternFlowGtpv1Version) SetValues(value []uint32) PatternFlowGtpv1Version { - obj.setChoice(PatternFlowGtpv1VersionChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv1VersionCounter -func (obj *patternFlowGtpv1Version) Increment() PatternFlowGtpv1VersionCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv1VersionChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv1VersionCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv1VersionCounter -func (obj *patternFlowGtpv1Version) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv1VersionCounter value in the PatternFlowGtpv1Version object -func (obj *patternFlowGtpv1Version) SetIncrement(value PatternFlowGtpv1VersionCounter) PatternFlowGtpv1Version { - obj.setChoice(PatternFlowGtpv1VersionChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1VersionCounter -func (obj *patternFlowGtpv1Version) Decrement() PatternFlowGtpv1VersionCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv1VersionChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv1VersionCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1VersionCounter -func (obj *patternFlowGtpv1Version) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv1VersionCounter value in the PatternFlowGtpv1Version object -func (obj *patternFlowGtpv1Version) SetDecrement(value PatternFlowGtpv1VersionCounter) PatternFlowGtpv1Version { - obj.setChoice(PatternFlowGtpv1VersionChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv1VersionMetricTag -func (obj *patternFlowGtpv1Version) MetricTags() PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv1VersionMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter struct { - obj *patternFlowGtpv1Version - patternFlowGtpv1VersionMetricTagSlice []PatternFlowGtpv1VersionMetricTag - fieldPtr *[]*otg.PatternFlowGtpv1VersionMetricTag -} - -func newPatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter(ptr *[]*otg.PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { - return &patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter interface { - setMsg(*patternFlowGtpv1Version) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter - Items() []PatternFlowGtpv1VersionMetricTag - Add() PatternFlowGtpv1VersionMetricTag - Append(items ...PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter - Set(index int, newObj PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter - Clear() PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter - clearHolderSlice() PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter - appendHolderSlice(item PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter -} - -func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) setMsg(msg *patternFlowGtpv1Version) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv1VersionMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) Items() []PatternFlowGtpv1VersionMetricTag { - return obj.patternFlowGtpv1VersionMetricTagSlice -} - -func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) Add() PatternFlowGtpv1VersionMetricTag { - newObj := &otg.PatternFlowGtpv1VersionMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv1VersionMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv1VersionMetricTagSlice = append(obj.patternFlowGtpv1VersionMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) Append(items ...PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv1VersionMetricTagSlice = append(obj.patternFlowGtpv1VersionMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) Set(index int, newObj PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv1VersionMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) Clear() PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv1VersionMetricTag{} - obj.patternFlowGtpv1VersionMetricTagSlice = []PatternFlowGtpv1VersionMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) clearHolderSlice() PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { - if len(obj.patternFlowGtpv1VersionMetricTagSlice) > 0 { - obj.patternFlowGtpv1VersionMetricTagSlice = []PatternFlowGtpv1VersionMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) appendHolderSlice(item PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { - obj.patternFlowGtpv1VersionMetricTagSlice = append(obj.patternFlowGtpv1VersionMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv1Version) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1Version.Value <= 7 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv1Version.Values <= 7 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv1VersionMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv1Version) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv1VersionChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv1VersionChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv1VersionChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv1VersionChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv1VersionChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv1VersionChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1Version") - } - } else { - intVal := otg.PatternFlowGtpv1Version_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv1Version_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv1ProtocolType ***** -type patternFlowGtpv1ProtocolType struct { - validation - obj *otg.PatternFlowGtpv1ProtocolType - marshaller marshalPatternFlowGtpv1ProtocolType - unMarshaller unMarshalPatternFlowGtpv1ProtocolType - incrementHolder PatternFlowGtpv1ProtocolTypeCounter - decrementHolder PatternFlowGtpv1ProtocolTypeCounter - metricTagsHolder PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter -} - -func NewPatternFlowGtpv1ProtocolType() PatternFlowGtpv1ProtocolType { - obj := patternFlowGtpv1ProtocolType{obj: &otg.PatternFlowGtpv1ProtocolType{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1ProtocolType) msg() *otg.PatternFlowGtpv1ProtocolType { - return obj.obj -} - -func (obj *patternFlowGtpv1ProtocolType) setMsg(msg *otg.PatternFlowGtpv1ProtocolType) PatternFlowGtpv1ProtocolType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1ProtocolType struct { - obj *patternFlowGtpv1ProtocolType -} - -type marshalPatternFlowGtpv1ProtocolType interface { - // ToProto marshals PatternFlowGtpv1ProtocolType to protobuf object *otg.PatternFlowGtpv1ProtocolType - ToProto() (*otg.PatternFlowGtpv1ProtocolType, error) - // ToPbText marshals PatternFlowGtpv1ProtocolType to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1ProtocolType to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1ProtocolType to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1ProtocolType struct { - obj *patternFlowGtpv1ProtocolType -} - -type unMarshalPatternFlowGtpv1ProtocolType interface { - // FromProto unmarshals PatternFlowGtpv1ProtocolType from protobuf object *otg.PatternFlowGtpv1ProtocolType - FromProto(msg *otg.PatternFlowGtpv1ProtocolType) (PatternFlowGtpv1ProtocolType, error) - // FromPbText unmarshals PatternFlowGtpv1ProtocolType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1ProtocolType from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1ProtocolType from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1ProtocolType) Marshal() marshalPatternFlowGtpv1ProtocolType { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1ProtocolType{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1ProtocolType) Unmarshal() unMarshalPatternFlowGtpv1ProtocolType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1ProtocolType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1ProtocolType) ToProto() (*otg.PatternFlowGtpv1ProtocolType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1ProtocolType) FromProto(msg *otg.PatternFlowGtpv1ProtocolType) (PatternFlowGtpv1ProtocolType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1ProtocolType) 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 *unMarshalpatternFlowGtpv1ProtocolType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv1ProtocolType) 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 *unMarshalpatternFlowGtpv1ProtocolType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv1ProtocolType) 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 *unMarshalpatternFlowGtpv1ProtocolType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv1ProtocolType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1ProtocolType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1ProtocolType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1ProtocolType) Clone() (PatternFlowGtpv1ProtocolType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1ProtocolType() - 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 -} - -func (obj *patternFlowGtpv1ProtocolType) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv1ProtocolType is protocol type, GTP is 1, GTP' is 0 -type PatternFlowGtpv1ProtocolType interface { - Validation - // msg marshals PatternFlowGtpv1ProtocolType to protobuf object *otg.PatternFlowGtpv1ProtocolType - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1ProtocolType - // setMsg unmarshals PatternFlowGtpv1ProtocolType from protobuf object *otg.PatternFlowGtpv1ProtocolType - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1ProtocolType) PatternFlowGtpv1ProtocolType - // provides marshal interface - Marshal() marshalPatternFlowGtpv1ProtocolType - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1ProtocolType - // validate validates PatternFlowGtpv1ProtocolType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1ProtocolType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv1ProtocolTypeChoiceEnum, set in PatternFlowGtpv1ProtocolType - Choice() PatternFlowGtpv1ProtocolTypeChoiceEnum - // setChoice assigns PatternFlowGtpv1ProtocolTypeChoiceEnum provided by user to PatternFlowGtpv1ProtocolType - setChoice(value PatternFlowGtpv1ProtocolTypeChoiceEnum) PatternFlowGtpv1ProtocolType - // HasChoice checks if Choice has been set in PatternFlowGtpv1ProtocolType - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv1ProtocolType. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv1ProtocolType - SetValue(value uint32) PatternFlowGtpv1ProtocolType - // HasValue checks if Value has been set in PatternFlowGtpv1ProtocolType - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv1ProtocolType. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv1ProtocolType - SetValues(value []uint32) PatternFlowGtpv1ProtocolType - // Increment returns PatternFlowGtpv1ProtocolTypeCounter, set in PatternFlowGtpv1ProtocolType. - // PatternFlowGtpv1ProtocolTypeCounter is integer counter pattern - Increment() PatternFlowGtpv1ProtocolTypeCounter - // SetIncrement assigns PatternFlowGtpv1ProtocolTypeCounter provided by user to PatternFlowGtpv1ProtocolType. - // PatternFlowGtpv1ProtocolTypeCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv1ProtocolTypeCounter) PatternFlowGtpv1ProtocolType - // HasIncrement checks if Increment has been set in PatternFlowGtpv1ProtocolType - HasIncrement() bool - // Decrement returns PatternFlowGtpv1ProtocolTypeCounter, set in PatternFlowGtpv1ProtocolType. - // PatternFlowGtpv1ProtocolTypeCounter is integer counter pattern - Decrement() PatternFlowGtpv1ProtocolTypeCounter - // SetDecrement assigns PatternFlowGtpv1ProtocolTypeCounter provided by user to PatternFlowGtpv1ProtocolType. - // PatternFlowGtpv1ProtocolTypeCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv1ProtocolTypeCounter) PatternFlowGtpv1ProtocolType - // HasDecrement checks if Decrement has been set in PatternFlowGtpv1ProtocolType - HasDecrement() bool - // MetricTags returns PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIterIter, set in PatternFlowGtpv1ProtocolType - MetricTags() PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter - setNil() -} - -type PatternFlowGtpv1ProtocolTypeChoiceEnum string - -// Enum of Choice on PatternFlowGtpv1ProtocolType -var PatternFlowGtpv1ProtocolTypeChoice = struct { - VALUE PatternFlowGtpv1ProtocolTypeChoiceEnum - VALUES PatternFlowGtpv1ProtocolTypeChoiceEnum - INCREMENT PatternFlowGtpv1ProtocolTypeChoiceEnum - DECREMENT PatternFlowGtpv1ProtocolTypeChoiceEnum -}{ - VALUE: PatternFlowGtpv1ProtocolTypeChoiceEnum("value"), - VALUES: PatternFlowGtpv1ProtocolTypeChoiceEnum("values"), - INCREMENT: PatternFlowGtpv1ProtocolTypeChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv1ProtocolTypeChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv1ProtocolType) Choice() PatternFlowGtpv1ProtocolTypeChoiceEnum { - return PatternFlowGtpv1ProtocolTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv1ProtocolType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv1ProtocolType) setChoice(value PatternFlowGtpv1ProtocolTypeChoiceEnum) PatternFlowGtpv1ProtocolType { - intValue, ok := otg.PatternFlowGtpv1ProtocolType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv1ProtocolTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv1ProtocolType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv1ProtocolTypeChoice.VALUE { - defaultValue := uint32(1) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv1ProtocolTypeChoice.VALUES { - defaultValue := []uint32{1} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv1ProtocolTypeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv1ProtocolTypeCounter().msg() - } - - if value == PatternFlowGtpv1ProtocolTypeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv1ProtocolTypeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1ProtocolType) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1ProtocolType) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv1ProtocolType object -func (obj *patternFlowGtpv1ProtocolType) SetValue(value uint32) PatternFlowGtpv1ProtocolType { - obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv1ProtocolType) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{1}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv1ProtocolType object -func (obj *patternFlowGtpv1ProtocolType) SetValues(value []uint32) PatternFlowGtpv1ProtocolType { - obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv1ProtocolTypeCounter -func (obj *patternFlowGtpv1ProtocolType) Increment() PatternFlowGtpv1ProtocolTypeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv1ProtocolTypeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv1ProtocolTypeCounter -func (obj *patternFlowGtpv1ProtocolType) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv1ProtocolTypeCounter value in the PatternFlowGtpv1ProtocolType object -func (obj *patternFlowGtpv1ProtocolType) SetIncrement(value PatternFlowGtpv1ProtocolTypeCounter) PatternFlowGtpv1ProtocolType { - obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1ProtocolTypeCounter -func (obj *patternFlowGtpv1ProtocolType) Decrement() PatternFlowGtpv1ProtocolTypeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv1ProtocolTypeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1ProtocolTypeCounter -func (obj *patternFlowGtpv1ProtocolType) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv1ProtocolTypeCounter value in the PatternFlowGtpv1ProtocolType object -func (obj *patternFlowGtpv1ProtocolType) SetDecrement(value PatternFlowGtpv1ProtocolTypeCounter) PatternFlowGtpv1ProtocolType { - obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv1ProtocolTypeMetricTag -func (obj *patternFlowGtpv1ProtocolType) MetricTags() PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv1ProtocolTypeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter struct { - obj *patternFlowGtpv1ProtocolType - patternFlowGtpv1ProtocolTypeMetricTagSlice []PatternFlowGtpv1ProtocolTypeMetricTag - fieldPtr *[]*otg.PatternFlowGtpv1ProtocolTypeMetricTag -} - -func newPatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter(ptr *[]*otg.PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { - return &patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter interface { - setMsg(*patternFlowGtpv1ProtocolType) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter - Items() []PatternFlowGtpv1ProtocolTypeMetricTag - Add() PatternFlowGtpv1ProtocolTypeMetricTag - Append(items ...PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter - Set(index int, newObj PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter - Clear() PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter - clearHolderSlice() PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter - appendHolderSlice(item PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter -} - -func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) setMsg(msg *patternFlowGtpv1ProtocolType) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv1ProtocolTypeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) Items() []PatternFlowGtpv1ProtocolTypeMetricTag { - return obj.patternFlowGtpv1ProtocolTypeMetricTagSlice -} - -func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) Add() PatternFlowGtpv1ProtocolTypeMetricTag { - newObj := &otg.PatternFlowGtpv1ProtocolTypeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv1ProtocolTypeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv1ProtocolTypeMetricTagSlice = append(obj.patternFlowGtpv1ProtocolTypeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) Append(items ...PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv1ProtocolTypeMetricTagSlice = append(obj.patternFlowGtpv1ProtocolTypeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) Set(index int, newObj PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv1ProtocolTypeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) Clear() PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv1ProtocolTypeMetricTag{} - obj.patternFlowGtpv1ProtocolTypeMetricTagSlice = []PatternFlowGtpv1ProtocolTypeMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) clearHolderSlice() PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { - if len(obj.patternFlowGtpv1ProtocolTypeMetricTagSlice) > 0 { - obj.patternFlowGtpv1ProtocolTypeMetricTagSlice = []PatternFlowGtpv1ProtocolTypeMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) appendHolderSlice(item PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { - obj.patternFlowGtpv1ProtocolTypeMetricTagSlice = append(obj.patternFlowGtpv1ProtocolTypeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv1ProtocolType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1ProtocolType.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv1ProtocolType.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv1ProtocolTypeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv1ProtocolType) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv1ProtocolTypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv1ProtocolTypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv1ProtocolTypeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv1ProtocolTypeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv1ProtocolTypeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1ProtocolType") - } - } else { - intVal := otg.PatternFlowGtpv1ProtocolType_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv1ProtocolType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv1Reserved ***** -type patternFlowGtpv1Reserved struct { - validation - obj *otg.PatternFlowGtpv1Reserved - marshaller marshalPatternFlowGtpv1Reserved - unMarshaller unMarshalPatternFlowGtpv1Reserved - incrementHolder PatternFlowGtpv1ReservedCounter - decrementHolder PatternFlowGtpv1ReservedCounter - metricTagsHolder PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter -} - -func NewPatternFlowGtpv1Reserved() PatternFlowGtpv1Reserved { - obj := patternFlowGtpv1Reserved{obj: &otg.PatternFlowGtpv1Reserved{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1Reserved) msg() *otg.PatternFlowGtpv1Reserved { - return obj.obj -} - -func (obj *patternFlowGtpv1Reserved) setMsg(msg *otg.PatternFlowGtpv1Reserved) PatternFlowGtpv1Reserved { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1Reserved struct { - obj *patternFlowGtpv1Reserved -} - -type marshalPatternFlowGtpv1Reserved interface { - // ToProto marshals PatternFlowGtpv1Reserved to protobuf object *otg.PatternFlowGtpv1Reserved - ToProto() (*otg.PatternFlowGtpv1Reserved, error) - // ToPbText marshals PatternFlowGtpv1Reserved to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1Reserved to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1Reserved to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1Reserved struct { - obj *patternFlowGtpv1Reserved -} - -type unMarshalPatternFlowGtpv1Reserved interface { - // FromProto unmarshals PatternFlowGtpv1Reserved from protobuf object *otg.PatternFlowGtpv1Reserved - FromProto(msg *otg.PatternFlowGtpv1Reserved) (PatternFlowGtpv1Reserved, error) - // FromPbText unmarshals PatternFlowGtpv1Reserved from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1Reserved from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1Reserved from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1Reserved) Marshal() marshalPatternFlowGtpv1Reserved { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1Reserved{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1Reserved) Unmarshal() unMarshalPatternFlowGtpv1Reserved { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1Reserved{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1Reserved) ToProto() (*otg.PatternFlowGtpv1Reserved, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1Reserved) FromProto(msg *otg.PatternFlowGtpv1Reserved) (PatternFlowGtpv1Reserved, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1Reserved) 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 *unMarshalpatternFlowGtpv1Reserved) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv1Reserved) 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 *unMarshalpatternFlowGtpv1Reserved) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv1Reserved) 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 *unMarshalpatternFlowGtpv1Reserved) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv1Reserved) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1Reserved) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1Reserved) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1Reserved) Clone() (PatternFlowGtpv1Reserved, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1Reserved() - 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 -} - -func (obj *patternFlowGtpv1Reserved) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv1Reserved is reserved field -type PatternFlowGtpv1Reserved interface { - Validation - // msg marshals PatternFlowGtpv1Reserved to protobuf object *otg.PatternFlowGtpv1Reserved - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1Reserved - // setMsg unmarshals PatternFlowGtpv1Reserved from protobuf object *otg.PatternFlowGtpv1Reserved - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1Reserved) PatternFlowGtpv1Reserved - // provides marshal interface - Marshal() marshalPatternFlowGtpv1Reserved - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1Reserved - // validate validates PatternFlowGtpv1Reserved - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1Reserved, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv1ReservedChoiceEnum, set in PatternFlowGtpv1Reserved - Choice() PatternFlowGtpv1ReservedChoiceEnum - // setChoice assigns PatternFlowGtpv1ReservedChoiceEnum provided by user to PatternFlowGtpv1Reserved - setChoice(value PatternFlowGtpv1ReservedChoiceEnum) PatternFlowGtpv1Reserved - // HasChoice checks if Choice has been set in PatternFlowGtpv1Reserved - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv1Reserved. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv1Reserved - SetValue(value uint32) PatternFlowGtpv1Reserved - // HasValue checks if Value has been set in PatternFlowGtpv1Reserved - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv1Reserved. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv1Reserved - SetValues(value []uint32) PatternFlowGtpv1Reserved - // Increment returns PatternFlowGtpv1ReservedCounter, set in PatternFlowGtpv1Reserved. - // PatternFlowGtpv1ReservedCounter is integer counter pattern - Increment() PatternFlowGtpv1ReservedCounter - // SetIncrement assigns PatternFlowGtpv1ReservedCounter provided by user to PatternFlowGtpv1Reserved. - // PatternFlowGtpv1ReservedCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv1ReservedCounter) PatternFlowGtpv1Reserved - // HasIncrement checks if Increment has been set in PatternFlowGtpv1Reserved - HasIncrement() bool - // Decrement returns PatternFlowGtpv1ReservedCounter, set in PatternFlowGtpv1Reserved. - // PatternFlowGtpv1ReservedCounter is integer counter pattern - Decrement() PatternFlowGtpv1ReservedCounter - // SetDecrement assigns PatternFlowGtpv1ReservedCounter provided by user to PatternFlowGtpv1Reserved. - // PatternFlowGtpv1ReservedCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv1ReservedCounter) PatternFlowGtpv1Reserved - // HasDecrement checks if Decrement has been set in PatternFlowGtpv1Reserved - HasDecrement() bool - // MetricTags returns PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIterIter, set in PatternFlowGtpv1Reserved - MetricTags() PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter - setNil() -} - -type PatternFlowGtpv1ReservedChoiceEnum string - -// Enum of Choice on PatternFlowGtpv1Reserved -var PatternFlowGtpv1ReservedChoice = struct { - VALUE PatternFlowGtpv1ReservedChoiceEnum - VALUES PatternFlowGtpv1ReservedChoiceEnum - INCREMENT PatternFlowGtpv1ReservedChoiceEnum - DECREMENT PatternFlowGtpv1ReservedChoiceEnum -}{ - VALUE: PatternFlowGtpv1ReservedChoiceEnum("value"), - VALUES: PatternFlowGtpv1ReservedChoiceEnum("values"), - INCREMENT: PatternFlowGtpv1ReservedChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv1ReservedChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv1Reserved) Choice() PatternFlowGtpv1ReservedChoiceEnum { - return PatternFlowGtpv1ReservedChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv1Reserved) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv1Reserved) setChoice(value PatternFlowGtpv1ReservedChoiceEnum) PatternFlowGtpv1Reserved { - intValue, ok := otg.PatternFlowGtpv1Reserved_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv1ReservedChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv1Reserved_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv1ReservedChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv1ReservedChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv1ReservedChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv1ReservedCounter().msg() - } - - if value == PatternFlowGtpv1ReservedChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv1ReservedCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1Reserved) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv1ReservedChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1Reserved) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv1Reserved object -func (obj *patternFlowGtpv1Reserved) SetValue(value uint32) PatternFlowGtpv1Reserved { - obj.setChoice(PatternFlowGtpv1ReservedChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv1Reserved) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv1Reserved object -func (obj *patternFlowGtpv1Reserved) SetValues(value []uint32) PatternFlowGtpv1Reserved { - obj.setChoice(PatternFlowGtpv1ReservedChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv1ReservedCounter -func (obj *patternFlowGtpv1Reserved) Increment() PatternFlowGtpv1ReservedCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv1ReservedChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv1ReservedCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv1ReservedCounter -func (obj *patternFlowGtpv1Reserved) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv1ReservedCounter value in the PatternFlowGtpv1Reserved object -func (obj *patternFlowGtpv1Reserved) SetIncrement(value PatternFlowGtpv1ReservedCounter) PatternFlowGtpv1Reserved { - obj.setChoice(PatternFlowGtpv1ReservedChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1ReservedCounter -func (obj *patternFlowGtpv1Reserved) Decrement() PatternFlowGtpv1ReservedCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv1ReservedChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv1ReservedCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1ReservedCounter -func (obj *patternFlowGtpv1Reserved) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv1ReservedCounter value in the PatternFlowGtpv1Reserved object -func (obj *patternFlowGtpv1Reserved) SetDecrement(value PatternFlowGtpv1ReservedCounter) PatternFlowGtpv1Reserved { - obj.setChoice(PatternFlowGtpv1ReservedChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv1ReservedMetricTag -func (obj *patternFlowGtpv1Reserved) MetricTags() PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv1ReservedMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter struct { - obj *patternFlowGtpv1Reserved - patternFlowGtpv1ReservedMetricTagSlice []PatternFlowGtpv1ReservedMetricTag - fieldPtr *[]*otg.PatternFlowGtpv1ReservedMetricTag -} - -func newPatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter(ptr *[]*otg.PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { - return &patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter interface { - setMsg(*patternFlowGtpv1Reserved) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter - Items() []PatternFlowGtpv1ReservedMetricTag - Add() PatternFlowGtpv1ReservedMetricTag - Append(items ...PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter - Set(index int, newObj PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter - Clear() PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter - clearHolderSlice() PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter - appendHolderSlice(item PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter -} - -func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) setMsg(msg *patternFlowGtpv1Reserved) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv1ReservedMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) Items() []PatternFlowGtpv1ReservedMetricTag { - return obj.patternFlowGtpv1ReservedMetricTagSlice -} - -func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) Add() PatternFlowGtpv1ReservedMetricTag { - newObj := &otg.PatternFlowGtpv1ReservedMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv1ReservedMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv1ReservedMetricTagSlice = append(obj.patternFlowGtpv1ReservedMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) Append(items ...PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv1ReservedMetricTagSlice = append(obj.patternFlowGtpv1ReservedMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) Set(index int, newObj PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv1ReservedMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) Clear() PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv1ReservedMetricTag{} - obj.patternFlowGtpv1ReservedMetricTagSlice = []PatternFlowGtpv1ReservedMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) clearHolderSlice() PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { - if len(obj.patternFlowGtpv1ReservedMetricTagSlice) > 0 { - obj.patternFlowGtpv1ReservedMetricTagSlice = []PatternFlowGtpv1ReservedMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) appendHolderSlice(item PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { - obj.patternFlowGtpv1ReservedMetricTagSlice = append(obj.patternFlowGtpv1ReservedMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv1Reserved) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1Reserved.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv1Reserved.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv1ReservedMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv1Reserved) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv1ReservedChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv1ReservedChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv1ReservedChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv1ReservedChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv1ReservedChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv1ReservedChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1Reserved") - } - } else { - intVal := otg.PatternFlowGtpv1Reserved_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv1Reserved_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv1EFlag ***** -type patternFlowGtpv1EFlag struct { - validation - obj *otg.PatternFlowGtpv1EFlag - marshaller marshalPatternFlowGtpv1EFlag - unMarshaller unMarshalPatternFlowGtpv1EFlag - incrementHolder PatternFlowGtpv1EFlagCounter - decrementHolder PatternFlowGtpv1EFlagCounter - metricTagsHolder PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter -} - -func NewPatternFlowGtpv1EFlag() PatternFlowGtpv1EFlag { - obj := patternFlowGtpv1EFlag{obj: &otg.PatternFlowGtpv1EFlag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1EFlag) msg() *otg.PatternFlowGtpv1EFlag { - return obj.obj -} - -func (obj *patternFlowGtpv1EFlag) setMsg(msg *otg.PatternFlowGtpv1EFlag) PatternFlowGtpv1EFlag { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1EFlag struct { - obj *patternFlowGtpv1EFlag -} - -type marshalPatternFlowGtpv1EFlag interface { - // ToProto marshals PatternFlowGtpv1EFlag to protobuf object *otg.PatternFlowGtpv1EFlag - ToProto() (*otg.PatternFlowGtpv1EFlag, error) - // ToPbText marshals PatternFlowGtpv1EFlag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1EFlag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1EFlag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1EFlag struct { - obj *patternFlowGtpv1EFlag -} - -type unMarshalPatternFlowGtpv1EFlag interface { - // FromProto unmarshals PatternFlowGtpv1EFlag from protobuf object *otg.PatternFlowGtpv1EFlag - FromProto(msg *otg.PatternFlowGtpv1EFlag) (PatternFlowGtpv1EFlag, error) - // FromPbText unmarshals PatternFlowGtpv1EFlag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1EFlag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1EFlag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1EFlag) Marshal() marshalPatternFlowGtpv1EFlag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1EFlag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1EFlag) Unmarshal() unMarshalPatternFlowGtpv1EFlag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1EFlag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1EFlag) ToProto() (*otg.PatternFlowGtpv1EFlag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1EFlag) FromProto(msg *otg.PatternFlowGtpv1EFlag) (PatternFlowGtpv1EFlag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1EFlag) 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 *unMarshalpatternFlowGtpv1EFlag) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv1EFlag) 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 *unMarshalpatternFlowGtpv1EFlag) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv1EFlag) 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 *unMarshalpatternFlowGtpv1EFlag) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv1EFlag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1EFlag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1EFlag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1EFlag) Clone() (PatternFlowGtpv1EFlag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1EFlag() - 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 -} - -func (obj *patternFlowGtpv1EFlag) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv1EFlag is extension header field present -type PatternFlowGtpv1EFlag interface { - Validation - // msg marshals PatternFlowGtpv1EFlag to protobuf object *otg.PatternFlowGtpv1EFlag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1EFlag - // setMsg unmarshals PatternFlowGtpv1EFlag from protobuf object *otg.PatternFlowGtpv1EFlag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1EFlag) PatternFlowGtpv1EFlag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1EFlag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1EFlag - // validate validates PatternFlowGtpv1EFlag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1EFlag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv1EFlagChoiceEnum, set in PatternFlowGtpv1EFlag - Choice() PatternFlowGtpv1EFlagChoiceEnum - // setChoice assigns PatternFlowGtpv1EFlagChoiceEnum provided by user to PatternFlowGtpv1EFlag - setChoice(value PatternFlowGtpv1EFlagChoiceEnum) PatternFlowGtpv1EFlag - // HasChoice checks if Choice has been set in PatternFlowGtpv1EFlag - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv1EFlag. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv1EFlag - SetValue(value uint32) PatternFlowGtpv1EFlag - // HasValue checks if Value has been set in PatternFlowGtpv1EFlag - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv1EFlag. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv1EFlag - SetValues(value []uint32) PatternFlowGtpv1EFlag - // Increment returns PatternFlowGtpv1EFlagCounter, set in PatternFlowGtpv1EFlag. - // PatternFlowGtpv1EFlagCounter is integer counter pattern - Increment() PatternFlowGtpv1EFlagCounter - // SetIncrement assigns PatternFlowGtpv1EFlagCounter provided by user to PatternFlowGtpv1EFlag. - // PatternFlowGtpv1EFlagCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv1EFlagCounter) PatternFlowGtpv1EFlag - // HasIncrement checks if Increment has been set in PatternFlowGtpv1EFlag - HasIncrement() bool - // Decrement returns PatternFlowGtpv1EFlagCounter, set in PatternFlowGtpv1EFlag. - // PatternFlowGtpv1EFlagCounter is integer counter pattern - Decrement() PatternFlowGtpv1EFlagCounter - // SetDecrement assigns PatternFlowGtpv1EFlagCounter provided by user to PatternFlowGtpv1EFlag. - // PatternFlowGtpv1EFlagCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv1EFlagCounter) PatternFlowGtpv1EFlag - // HasDecrement checks if Decrement has been set in PatternFlowGtpv1EFlag - HasDecrement() bool - // MetricTags returns PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIterIter, set in PatternFlowGtpv1EFlag - MetricTags() PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter - setNil() -} - -type PatternFlowGtpv1EFlagChoiceEnum string - -// Enum of Choice on PatternFlowGtpv1EFlag -var PatternFlowGtpv1EFlagChoice = struct { - VALUE PatternFlowGtpv1EFlagChoiceEnum - VALUES PatternFlowGtpv1EFlagChoiceEnum - INCREMENT PatternFlowGtpv1EFlagChoiceEnum - DECREMENT PatternFlowGtpv1EFlagChoiceEnum -}{ - VALUE: PatternFlowGtpv1EFlagChoiceEnum("value"), - VALUES: PatternFlowGtpv1EFlagChoiceEnum("values"), - INCREMENT: PatternFlowGtpv1EFlagChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv1EFlagChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv1EFlag) Choice() PatternFlowGtpv1EFlagChoiceEnum { - return PatternFlowGtpv1EFlagChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv1EFlag) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv1EFlag) setChoice(value PatternFlowGtpv1EFlagChoiceEnum) PatternFlowGtpv1EFlag { - intValue, ok := otg.PatternFlowGtpv1EFlag_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv1EFlagChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv1EFlag_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv1EFlagChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv1EFlagChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv1EFlagChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv1EFlagCounter().msg() - } - - if value == PatternFlowGtpv1EFlagChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv1EFlagCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1EFlag) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv1EFlagChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1EFlag) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv1EFlag object -func (obj *patternFlowGtpv1EFlag) SetValue(value uint32) PatternFlowGtpv1EFlag { - obj.setChoice(PatternFlowGtpv1EFlagChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv1EFlag) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv1EFlag object -func (obj *patternFlowGtpv1EFlag) SetValues(value []uint32) PatternFlowGtpv1EFlag { - obj.setChoice(PatternFlowGtpv1EFlagChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv1EFlagCounter -func (obj *patternFlowGtpv1EFlag) Increment() PatternFlowGtpv1EFlagCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv1EFlagChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv1EFlagCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv1EFlagCounter -func (obj *patternFlowGtpv1EFlag) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv1EFlagCounter value in the PatternFlowGtpv1EFlag object -func (obj *patternFlowGtpv1EFlag) SetIncrement(value PatternFlowGtpv1EFlagCounter) PatternFlowGtpv1EFlag { - obj.setChoice(PatternFlowGtpv1EFlagChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1EFlagCounter -func (obj *patternFlowGtpv1EFlag) Decrement() PatternFlowGtpv1EFlagCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv1EFlagChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv1EFlagCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1EFlagCounter -func (obj *patternFlowGtpv1EFlag) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv1EFlagCounter value in the PatternFlowGtpv1EFlag object -func (obj *patternFlowGtpv1EFlag) SetDecrement(value PatternFlowGtpv1EFlagCounter) PatternFlowGtpv1EFlag { - obj.setChoice(PatternFlowGtpv1EFlagChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv1EFlagMetricTag -func (obj *patternFlowGtpv1EFlag) MetricTags() PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv1EFlagMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter struct { - obj *patternFlowGtpv1EFlag - patternFlowGtpv1EFlagMetricTagSlice []PatternFlowGtpv1EFlagMetricTag - fieldPtr *[]*otg.PatternFlowGtpv1EFlagMetricTag -} - -func newPatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter(ptr *[]*otg.PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { - return &patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter interface { - setMsg(*patternFlowGtpv1EFlag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter - Items() []PatternFlowGtpv1EFlagMetricTag - Add() PatternFlowGtpv1EFlagMetricTag - Append(items ...PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter - Set(index int, newObj PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter - Clear() PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter - clearHolderSlice() PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter - appendHolderSlice(item PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter -} - -func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) setMsg(msg *patternFlowGtpv1EFlag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv1EFlagMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) Items() []PatternFlowGtpv1EFlagMetricTag { - return obj.patternFlowGtpv1EFlagMetricTagSlice -} - -func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) Add() PatternFlowGtpv1EFlagMetricTag { - newObj := &otg.PatternFlowGtpv1EFlagMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv1EFlagMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv1EFlagMetricTagSlice = append(obj.patternFlowGtpv1EFlagMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) Append(items ...PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv1EFlagMetricTagSlice = append(obj.patternFlowGtpv1EFlagMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) Set(index int, newObj PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv1EFlagMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) Clear() PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv1EFlagMetricTag{} - obj.patternFlowGtpv1EFlagMetricTagSlice = []PatternFlowGtpv1EFlagMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) clearHolderSlice() PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { - if len(obj.patternFlowGtpv1EFlagMetricTagSlice) > 0 { - obj.patternFlowGtpv1EFlagMetricTagSlice = []PatternFlowGtpv1EFlagMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) appendHolderSlice(item PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { - obj.patternFlowGtpv1EFlagMetricTagSlice = append(obj.patternFlowGtpv1EFlagMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv1EFlag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1EFlag.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv1EFlag.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv1EFlagMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv1EFlag) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv1EFlagChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv1EFlagChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv1EFlagChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv1EFlagChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv1EFlagChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv1EFlagChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1EFlag") - } - } else { - intVal := otg.PatternFlowGtpv1EFlag_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv1EFlag_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv1SFlag ***** -type patternFlowGtpv1SFlag struct { - validation - obj *otg.PatternFlowGtpv1SFlag - marshaller marshalPatternFlowGtpv1SFlag - unMarshaller unMarshalPatternFlowGtpv1SFlag - incrementHolder PatternFlowGtpv1SFlagCounter - decrementHolder PatternFlowGtpv1SFlagCounter - metricTagsHolder PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter -} - -func NewPatternFlowGtpv1SFlag() PatternFlowGtpv1SFlag { - obj := patternFlowGtpv1SFlag{obj: &otg.PatternFlowGtpv1SFlag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1SFlag) msg() *otg.PatternFlowGtpv1SFlag { - return obj.obj -} - -func (obj *patternFlowGtpv1SFlag) setMsg(msg *otg.PatternFlowGtpv1SFlag) PatternFlowGtpv1SFlag { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1SFlag struct { - obj *patternFlowGtpv1SFlag -} - -type marshalPatternFlowGtpv1SFlag interface { - // ToProto marshals PatternFlowGtpv1SFlag to protobuf object *otg.PatternFlowGtpv1SFlag - ToProto() (*otg.PatternFlowGtpv1SFlag, error) - // ToPbText marshals PatternFlowGtpv1SFlag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1SFlag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1SFlag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1SFlag struct { - obj *patternFlowGtpv1SFlag -} - -type unMarshalPatternFlowGtpv1SFlag interface { - // FromProto unmarshals PatternFlowGtpv1SFlag from protobuf object *otg.PatternFlowGtpv1SFlag - FromProto(msg *otg.PatternFlowGtpv1SFlag) (PatternFlowGtpv1SFlag, error) - // FromPbText unmarshals PatternFlowGtpv1SFlag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1SFlag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1SFlag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1SFlag) Marshal() marshalPatternFlowGtpv1SFlag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1SFlag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1SFlag) Unmarshal() unMarshalPatternFlowGtpv1SFlag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1SFlag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1SFlag) ToProto() (*otg.PatternFlowGtpv1SFlag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1SFlag) FromProto(msg *otg.PatternFlowGtpv1SFlag) (PatternFlowGtpv1SFlag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1SFlag) 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 *unMarshalpatternFlowGtpv1SFlag) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv1SFlag) 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 *unMarshalpatternFlowGtpv1SFlag) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv1SFlag) 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 *unMarshalpatternFlowGtpv1SFlag) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv1SFlag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1SFlag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1SFlag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1SFlag) Clone() (PatternFlowGtpv1SFlag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1SFlag() - 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 -} - -func (obj *patternFlowGtpv1SFlag) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv1SFlag is sequence number field present -type PatternFlowGtpv1SFlag interface { - Validation - // msg marshals PatternFlowGtpv1SFlag to protobuf object *otg.PatternFlowGtpv1SFlag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1SFlag - // setMsg unmarshals PatternFlowGtpv1SFlag from protobuf object *otg.PatternFlowGtpv1SFlag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1SFlag) PatternFlowGtpv1SFlag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1SFlag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1SFlag - // validate validates PatternFlowGtpv1SFlag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1SFlag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv1SFlagChoiceEnum, set in PatternFlowGtpv1SFlag - Choice() PatternFlowGtpv1SFlagChoiceEnum - // setChoice assigns PatternFlowGtpv1SFlagChoiceEnum provided by user to PatternFlowGtpv1SFlag - setChoice(value PatternFlowGtpv1SFlagChoiceEnum) PatternFlowGtpv1SFlag - // HasChoice checks if Choice has been set in PatternFlowGtpv1SFlag - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv1SFlag. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv1SFlag - SetValue(value uint32) PatternFlowGtpv1SFlag - // HasValue checks if Value has been set in PatternFlowGtpv1SFlag - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv1SFlag. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv1SFlag - SetValues(value []uint32) PatternFlowGtpv1SFlag - // Increment returns PatternFlowGtpv1SFlagCounter, set in PatternFlowGtpv1SFlag. - // PatternFlowGtpv1SFlagCounter is integer counter pattern - Increment() PatternFlowGtpv1SFlagCounter - // SetIncrement assigns PatternFlowGtpv1SFlagCounter provided by user to PatternFlowGtpv1SFlag. - // PatternFlowGtpv1SFlagCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv1SFlagCounter) PatternFlowGtpv1SFlag - // HasIncrement checks if Increment has been set in PatternFlowGtpv1SFlag - HasIncrement() bool - // Decrement returns PatternFlowGtpv1SFlagCounter, set in PatternFlowGtpv1SFlag. - // PatternFlowGtpv1SFlagCounter is integer counter pattern - Decrement() PatternFlowGtpv1SFlagCounter - // SetDecrement assigns PatternFlowGtpv1SFlagCounter provided by user to PatternFlowGtpv1SFlag. - // PatternFlowGtpv1SFlagCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv1SFlagCounter) PatternFlowGtpv1SFlag - // HasDecrement checks if Decrement has been set in PatternFlowGtpv1SFlag - HasDecrement() bool - // MetricTags returns PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIterIter, set in PatternFlowGtpv1SFlag - MetricTags() PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter - setNil() -} - -type PatternFlowGtpv1SFlagChoiceEnum string - -// Enum of Choice on PatternFlowGtpv1SFlag -var PatternFlowGtpv1SFlagChoice = struct { - VALUE PatternFlowGtpv1SFlagChoiceEnum - VALUES PatternFlowGtpv1SFlagChoiceEnum - INCREMENT PatternFlowGtpv1SFlagChoiceEnum - DECREMENT PatternFlowGtpv1SFlagChoiceEnum -}{ - VALUE: PatternFlowGtpv1SFlagChoiceEnum("value"), - VALUES: PatternFlowGtpv1SFlagChoiceEnum("values"), - INCREMENT: PatternFlowGtpv1SFlagChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv1SFlagChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv1SFlag) Choice() PatternFlowGtpv1SFlagChoiceEnum { - return PatternFlowGtpv1SFlagChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv1SFlag) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv1SFlag) setChoice(value PatternFlowGtpv1SFlagChoiceEnum) PatternFlowGtpv1SFlag { - intValue, ok := otg.PatternFlowGtpv1SFlag_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv1SFlagChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv1SFlag_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv1SFlagChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv1SFlagChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv1SFlagChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv1SFlagCounter().msg() - } - - if value == PatternFlowGtpv1SFlagChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv1SFlagCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1SFlag) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv1SFlagChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1SFlag) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv1SFlag object -func (obj *patternFlowGtpv1SFlag) SetValue(value uint32) PatternFlowGtpv1SFlag { - obj.setChoice(PatternFlowGtpv1SFlagChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv1SFlag) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv1SFlag object -func (obj *patternFlowGtpv1SFlag) SetValues(value []uint32) PatternFlowGtpv1SFlag { - obj.setChoice(PatternFlowGtpv1SFlagChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv1SFlagCounter -func (obj *patternFlowGtpv1SFlag) Increment() PatternFlowGtpv1SFlagCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv1SFlagChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv1SFlagCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv1SFlagCounter -func (obj *patternFlowGtpv1SFlag) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv1SFlagCounter value in the PatternFlowGtpv1SFlag object -func (obj *patternFlowGtpv1SFlag) SetIncrement(value PatternFlowGtpv1SFlagCounter) PatternFlowGtpv1SFlag { - obj.setChoice(PatternFlowGtpv1SFlagChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1SFlagCounter -func (obj *patternFlowGtpv1SFlag) Decrement() PatternFlowGtpv1SFlagCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv1SFlagChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv1SFlagCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1SFlagCounter -func (obj *patternFlowGtpv1SFlag) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv1SFlagCounter value in the PatternFlowGtpv1SFlag object -func (obj *patternFlowGtpv1SFlag) SetDecrement(value PatternFlowGtpv1SFlagCounter) PatternFlowGtpv1SFlag { - obj.setChoice(PatternFlowGtpv1SFlagChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv1SFlagMetricTag -func (obj *patternFlowGtpv1SFlag) MetricTags() PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv1SFlagMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter struct { - obj *patternFlowGtpv1SFlag - patternFlowGtpv1SFlagMetricTagSlice []PatternFlowGtpv1SFlagMetricTag - fieldPtr *[]*otg.PatternFlowGtpv1SFlagMetricTag -} - -func newPatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter(ptr *[]*otg.PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { - return &patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter interface { - setMsg(*patternFlowGtpv1SFlag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter - Items() []PatternFlowGtpv1SFlagMetricTag - Add() PatternFlowGtpv1SFlagMetricTag - Append(items ...PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter - Set(index int, newObj PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter - Clear() PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter - clearHolderSlice() PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter - appendHolderSlice(item PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter -} - -func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) setMsg(msg *patternFlowGtpv1SFlag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv1SFlagMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) Items() []PatternFlowGtpv1SFlagMetricTag { - return obj.patternFlowGtpv1SFlagMetricTagSlice -} - -func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) Add() PatternFlowGtpv1SFlagMetricTag { - newObj := &otg.PatternFlowGtpv1SFlagMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv1SFlagMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv1SFlagMetricTagSlice = append(obj.patternFlowGtpv1SFlagMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) Append(items ...PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv1SFlagMetricTagSlice = append(obj.patternFlowGtpv1SFlagMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) Set(index int, newObj PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv1SFlagMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) Clear() PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv1SFlagMetricTag{} - obj.patternFlowGtpv1SFlagMetricTagSlice = []PatternFlowGtpv1SFlagMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) clearHolderSlice() PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { - if len(obj.patternFlowGtpv1SFlagMetricTagSlice) > 0 { - obj.patternFlowGtpv1SFlagMetricTagSlice = []PatternFlowGtpv1SFlagMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) appendHolderSlice(item PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { - obj.patternFlowGtpv1SFlagMetricTagSlice = append(obj.patternFlowGtpv1SFlagMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv1SFlag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1SFlag.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv1SFlag.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv1SFlagMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv1SFlag) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv1SFlagChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv1SFlagChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv1SFlagChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv1SFlagChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv1SFlagChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv1SFlagChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1SFlag") - } - } else { - intVal := otg.PatternFlowGtpv1SFlag_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv1SFlag_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv1PnFlag ***** -type patternFlowGtpv1PnFlag struct { - validation - obj *otg.PatternFlowGtpv1PnFlag - marshaller marshalPatternFlowGtpv1PnFlag - unMarshaller unMarshalPatternFlowGtpv1PnFlag - incrementHolder PatternFlowGtpv1PnFlagCounter - decrementHolder PatternFlowGtpv1PnFlagCounter - metricTagsHolder PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter -} - -func NewPatternFlowGtpv1PnFlag() PatternFlowGtpv1PnFlag { - obj := patternFlowGtpv1PnFlag{obj: &otg.PatternFlowGtpv1PnFlag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1PnFlag) msg() *otg.PatternFlowGtpv1PnFlag { - return obj.obj -} - -func (obj *patternFlowGtpv1PnFlag) setMsg(msg *otg.PatternFlowGtpv1PnFlag) PatternFlowGtpv1PnFlag { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1PnFlag struct { - obj *patternFlowGtpv1PnFlag -} - -type marshalPatternFlowGtpv1PnFlag interface { - // ToProto marshals PatternFlowGtpv1PnFlag to protobuf object *otg.PatternFlowGtpv1PnFlag - ToProto() (*otg.PatternFlowGtpv1PnFlag, error) - // ToPbText marshals PatternFlowGtpv1PnFlag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1PnFlag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1PnFlag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1PnFlag struct { - obj *patternFlowGtpv1PnFlag -} - -type unMarshalPatternFlowGtpv1PnFlag interface { - // FromProto unmarshals PatternFlowGtpv1PnFlag from protobuf object *otg.PatternFlowGtpv1PnFlag - FromProto(msg *otg.PatternFlowGtpv1PnFlag) (PatternFlowGtpv1PnFlag, error) - // FromPbText unmarshals PatternFlowGtpv1PnFlag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1PnFlag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1PnFlag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1PnFlag) Marshal() marshalPatternFlowGtpv1PnFlag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1PnFlag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1PnFlag) Unmarshal() unMarshalPatternFlowGtpv1PnFlag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1PnFlag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1PnFlag) ToProto() (*otg.PatternFlowGtpv1PnFlag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1PnFlag) FromProto(msg *otg.PatternFlowGtpv1PnFlag) (PatternFlowGtpv1PnFlag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1PnFlag) 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 *unMarshalpatternFlowGtpv1PnFlag) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv1PnFlag) 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 *unMarshalpatternFlowGtpv1PnFlag) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv1PnFlag) 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 *unMarshalpatternFlowGtpv1PnFlag) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv1PnFlag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1PnFlag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1PnFlag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1PnFlag) Clone() (PatternFlowGtpv1PnFlag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1PnFlag() - 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 -} - -func (obj *patternFlowGtpv1PnFlag) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv1PnFlag is n-PDU field present -type PatternFlowGtpv1PnFlag interface { - Validation - // msg marshals PatternFlowGtpv1PnFlag to protobuf object *otg.PatternFlowGtpv1PnFlag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1PnFlag - // setMsg unmarshals PatternFlowGtpv1PnFlag from protobuf object *otg.PatternFlowGtpv1PnFlag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1PnFlag) PatternFlowGtpv1PnFlag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1PnFlag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1PnFlag - // validate validates PatternFlowGtpv1PnFlag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1PnFlag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv1PnFlagChoiceEnum, set in PatternFlowGtpv1PnFlag - Choice() PatternFlowGtpv1PnFlagChoiceEnum - // setChoice assigns PatternFlowGtpv1PnFlagChoiceEnum provided by user to PatternFlowGtpv1PnFlag - setChoice(value PatternFlowGtpv1PnFlagChoiceEnum) PatternFlowGtpv1PnFlag - // HasChoice checks if Choice has been set in PatternFlowGtpv1PnFlag - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv1PnFlag. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv1PnFlag - SetValue(value uint32) PatternFlowGtpv1PnFlag - // HasValue checks if Value has been set in PatternFlowGtpv1PnFlag - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv1PnFlag. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv1PnFlag - SetValues(value []uint32) PatternFlowGtpv1PnFlag - // Increment returns PatternFlowGtpv1PnFlagCounter, set in PatternFlowGtpv1PnFlag. - // PatternFlowGtpv1PnFlagCounter is integer counter pattern - Increment() PatternFlowGtpv1PnFlagCounter - // SetIncrement assigns PatternFlowGtpv1PnFlagCounter provided by user to PatternFlowGtpv1PnFlag. - // PatternFlowGtpv1PnFlagCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv1PnFlagCounter) PatternFlowGtpv1PnFlag - // HasIncrement checks if Increment has been set in PatternFlowGtpv1PnFlag - HasIncrement() bool - // Decrement returns PatternFlowGtpv1PnFlagCounter, set in PatternFlowGtpv1PnFlag. - // PatternFlowGtpv1PnFlagCounter is integer counter pattern - Decrement() PatternFlowGtpv1PnFlagCounter - // SetDecrement assigns PatternFlowGtpv1PnFlagCounter provided by user to PatternFlowGtpv1PnFlag. - // PatternFlowGtpv1PnFlagCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv1PnFlagCounter) PatternFlowGtpv1PnFlag - // HasDecrement checks if Decrement has been set in PatternFlowGtpv1PnFlag - HasDecrement() bool - // MetricTags returns PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIterIter, set in PatternFlowGtpv1PnFlag - MetricTags() PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter - setNil() -} - -type PatternFlowGtpv1PnFlagChoiceEnum string - -// Enum of Choice on PatternFlowGtpv1PnFlag -var PatternFlowGtpv1PnFlagChoice = struct { - VALUE PatternFlowGtpv1PnFlagChoiceEnum - VALUES PatternFlowGtpv1PnFlagChoiceEnum - INCREMENT PatternFlowGtpv1PnFlagChoiceEnum - DECREMENT PatternFlowGtpv1PnFlagChoiceEnum -}{ - VALUE: PatternFlowGtpv1PnFlagChoiceEnum("value"), - VALUES: PatternFlowGtpv1PnFlagChoiceEnum("values"), - INCREMENT: PatternFlowGtpv1PnFlagChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv1PnFlagChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv1PnFlag) Choice() PatternFlowGtpv1PnFlagChoiceEnum { - return PatternFlowGtpv1PnFlagChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv1PnFlag) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv1PnFlag) setChoice(value PatternFlowGtpv1PnFlagChoiceEnum) PatternFlowGtpv1PnFlag { - intValue, ok := otg.PatternFlowGtpv1PnFlag_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv1PnFlagChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv1PnFlag_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv1PnFlagChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv1PnFlagChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv1PnFlagChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv1PnFlagCounter().msg() - } - - if value == PatternFlowGtpv1PnFlagChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv1PnFlagCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1PnFlag) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv1PnFlagChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1PnFlag) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv1PnFlag object -func (obj *patternFlowGtpv1PnFlag) SetValue(value uint32) PatternFlowGtpv1PnFlag { - obj.setChoice(PatternFlowGtpv1PnFlagChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv1PnFlag) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv1PnFlag object -func (obj *patternFlowGtpv1PnFlag) SetValues(value []uint32) PatternFlowGtpv1PnFlag { - obj.setChoice(PatternFlowGtpv1PnFlagChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv1PnFlagCounter -func (obj *patternFlowGtpv1PnFlag) Increment() PatternFlowGtpv1PnFlagCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv1PnFlagChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv1PnFlagCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv1PnFlagCounter -func (obj *patternFlowGtpv1PnFlag) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv1PnFlagCounter value in the PatternFlowGtpv1PnFlag object -func (obj *patternFlowGtpv1PnFlag) SetIncrement(value PatternFlowGtpv1PnFlagCounter) PatternFlowGtpv1PnFlag { - obj.setChoice(PatternFlowGtpv1PnFlagChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1PnFlagCounter -func (obj *patternFlowGtpv1PnFlag) Decrement() PatternFlowGtpv1PnFlagCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv1PnFlagChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv1PnFlagCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1PnFlagCounter -func (obj *patternFlowGtpv1PnFlag) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv1PnFlagCounter value in the PatternFlowGtpv1PnFlag object -func (obj *patternFlowGtpv1PnFlag) SetDecrement(value PatternFlowGtpv1PnFlagCounter) PatternFlowGtpv1PnFlag { - obj.setChoice(PatternFlowGtpv1PnFlagChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv1PnFlagMetricTag -func (obj *patternFlowGtpv1PnFlag) MetricTags() PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv1PnFlagMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter struct { - obj *patternFlowGtpv1PnFlag - patternFlowGtpv1PnFlagMetricTagSlice []PatternFlowGtpv1PnFlagMetricTag - fieldPtr *[]*otg.PatternFlowGtpv1PnFlagMetricTag -} - -func newPatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter(ptr *[]*otg.PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { - return &patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter interface { - setMsg(*patternFlowGtpv1PnFlag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter - Items() []PatternFlowGtpv1PnFlagMetricTag - Add() PatternFlowGtpv1PnFlagMetricTag - Append(items ...PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter - Set(index int, newObj PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter - Clear() PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter - clearHolderSlice() PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter - appendHolderSlice(item PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter -} - -func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) setMsg(msg *patternFlowGtpv1PnFlag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv1PnFlagMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) Items() []PatternFlowGtpv1PnFlagMetricTag { - return obj.patternFlowGtpv1PnFlagMetricTagSlice -} - -func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) Add() PatternFlowGtpv1PnFlagMetricTag { - newObj := &otg.PatternFlowGtpv1PnFlagMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv1PnFlagMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv1PnFlagMetricTagSlice = append(obj.patternFlowGtpv1PnFlagMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) Append(items ...PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv1PnFlagMetricTagSlice = append(obj.patternFlowGtpv1PnFlagMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) Set(index int, newObj PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv1PnFlagMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) Clear() PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv1PnFlagMetricTag{} - obj.patternFlowGtpv1PnFlagMetricTagSlice = []PatternFlowGtpv1PnFlagMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) clearHolderSlice() PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { - if len(obj.patternFlowGtpv1PnFlagMetricTagSlice) > 0 { - obj.patternFlowGtpv1PnFlagMetricTagSlice = []PatternFlowGtpv1PnFlagMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) appendHolderSlice(item PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { - obj.patternFlowGtpv1PnFlagMetricTagSlice = append(obj.patternFlowGtpv1PnFlagMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv1PnFlag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1PnFlag.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv1PnFlag.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv1PnFlagMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv1PnFlag) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv1PnFlagChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv1PnFlagChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv1PnFlagChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv1PnFlagChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv1PnFlagChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv1PnFlagChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1PnFlag") - } - } else { - intVal := otg.PatternFlowGtpv1PnFlag_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv1PnFlag_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv1MessageType ***** -type patternFlowGtpv1MessageType struct { - validation - obj *otg.PatternFlowGtpv1MessageType - marshaller marshalPatternFlowGtpv1MessageType - unMarshaller unMarshalPatternFlowGtpv1MessageType - incrementHolder PatternFlowGtpv1MessageTypeCounter - decrementHolder PatternFlowGtpv1MessageTypeCounter - metricTagsHolder PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter -} - -func NewPatternFlowGtpv1MessageType() PatternFlowGtpv1MessageType { - obj := patternFlowGtpv1MessageType{obj: &otg.PatternFlowGtpv1MessageType{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1MessageType) msg() *otg.PatternFlowGtpv1MessageType { - return obj.obj -} - -func (obj *patternFlowGtpv1MessageType) setMsg(msg *otg.PatternFlowGtpv1MessageType) PatternFlowGtpv1MessageType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1MessageType struct { - obj *patternFlowGtpv1MessageType -} - -type marshalPatternFlowGtpv1MessageType interface { - // ToProto marshals PatternFlowGtpv1MessageType to protobuf object *otg.PatternFlowGtpv1MessageType - ToProto() (*otg.PatternFlowGtpv1MessageType, error) - // ToPbText marshals PatternFlowGtpv1MessageType to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1MessageType to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1MessageType to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1MessageType struct { - obj *patternFlowGtpv1MessageType -} - -type unMarshalPatternFlowGtpv1MessageType interface { - // FromProto unmarshals PatternFlowGtpv1MessageType from protobuf object *otg.PatternFlowGtpv1MessageType - FromProto(msg *otg.PatternFlowGtpv1MessageType) (PatternFlowGtpv1MessageType, error) - // FromPbText unmarshals PatternFlowGtpv1MessageType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1MessageType from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1MessageType from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1MessageType) Marshal() marshalPatternFlowGtpv1MessageType { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1MessageType{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1MessageType) Unmarshal() unMarshalPatternFlowGtpv1MessageType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1MessageType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1MessageType) ToProto() (*otg.PatternFlowGtpv1MessageType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1MessageType) FromProto(msg *otg.PatternFlowGtpv1MessageType) (PatternFlowGtpv1MessageType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1MessageType) 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 *unMarshalpatternFlowGtpv1MessageType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv1MessageType) 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 *unMarshalpatternFlowGtpv1MessageType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv1MessageType) 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 *unMarshalpatternFlowGtpv1MessageType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv1MessageType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1MessageType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1MessageType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1MessageType) Clone() (PatternFlowGtpv1MessageType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1MessageType() - 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 -} - -func (obj *patternFlowGtpv1MessageType) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv1MessageType is the type of GTP message Different types of messages are defined in 3GPP TS 29.060 section 7.1 -type PatternFlowGtpv1MessageType interface { - Validation - // msg marshals PatternFlowGtpv1MessageType to protobuf object *otg.PatternFlowGtpv1MessageType - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1MessageType - // setMsg unmarshals PatternFlowGtpv1MessageType from protobuf object *otg.PatternFlowGtpv1MessageType - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1MessageType) PatternFlowGtpv1MessageType - // provides marshal interface - Marshal() marshalPatternFlowGtpv1MessageType - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1MessageType - // validate validates PatternFlowGtpv1MessageType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1MessageType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv1MessageTypeChoiceEnum, set in PatternFlowGtpv1MessageType - Choice() PatternFlowGtpv1MessageTypeChoiceEnum - // setChoice assigns PatternFlowGtpv1MessageTypeChoiceEnum provided by user to PatternFlowGtpv1MessageType - setChoice(value PatternFlowGtpv1MessageTypeChoiceEnum) PatternFlowGtpv1MessageType - // HasChoice checks if Choice has been set in PatternFlowGtpv1MessageType - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv1MessageType. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv1MessageType - SetValue(value uint32) PatternFlowGtpv1MessageType - // HasValue checks if Value has been set in PatternFlowGtpv1MessageType - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv1MessageType. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv1MessageType - SetValues(value []uint32) PatternFlowGtpv1MessageType - // Increment returns PatternFlowGtpv1MessageTypeCounter, set in PatternFlowGtpv1MessageType. - // PatternFlowGtpv1MessageTypeCounter is integer counter pattern - Increment() PatternFlowGtpv1MessageTypeCounter - // SetIncrement assigns PatternFlowGtpv1MessageTypeCounter provided by user to PatternFlowGtpv1MessageType. - // PatternFlowGtpv1MessageTypeCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv1MessageTypeCounter) PatternFlowGtpv1MessageType - // HasIncrement checks if Increment has been set in PatternFlowGtpv1MessageType - HasIncrement() bool - // Decrement returns PatternFlowGtpv1MessageTypeCounter, set in PatternFlowGtpv1MessageType. - // PatternFlowGtpv1MessageTypeCounter is integer counter pattern - Decrement() PatternFlowGtpv1MessageTypeCounter - // SetDecrement assigns PatternFlowGtpv1MessageTypeCounter provided by user to PatternFlowGtpv1MessageType. - // PatternFlowGtpv1MessageTypeCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv1MessageTypeCounter) PatternFlowGtpv1MessageType - // HasDecrement checks if Decrement has been set in PatternFlowGtpv1MessageType - HasDecrement() bool - // MetricTags returns PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIterIter, set in PatternFlowGtpv1MessageType - MetricTags() PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter - setNil() -} - -type PatternFlowGtpv1MessageTypeChoiceEnum string - -// Enum of Choice on PatternFlowGtpv1MessageType -var PatternFlowGtpv1MessageTypeChoice = struct { - VALUE PatternFlowGtpv1MessageTypeChoiceEnum - VALUES PatternFlowGtpv1MessageTypeChoiceEnum - INCREMENT PatternFlowGtpv1MessageTypeChoiceEnum - DECREMENT PatternFlowGtpv1MessageTypeChoiceEnum -}{ - VALUE: PatternFlowGtpv1MessageTypeChoiceEnum("value"), - VALUES: PatternFlowGtpv1MessageTypeChoiceEnum("values"), - INCREMENT: PatternFlowGtpv1MessageTypeChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv1MessageTypeChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv1MessageType) Choice() PatternFlowGtpv1MessageTypeChoiceEnum { - return PatternFlowGtpv1MessageTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv1MessageType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv1MessageType) setChoice(value PatternFlowGtpv1MessageTypeChoiceEnum) PatternFlowGtpv1MessageType { - intValue, ok := otg.PatternFlowGtpv1MessageType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv1MessageTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv1MessageType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv1MessageTypeChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv1MessageTypeChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv1MessageTypeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv1MessageTypeCounter().msg() - } - - if value == PatternFlowGtpv1MessageTypeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv1MessageTypeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1MessageType) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv1MessageTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1MessageType) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv1MessageType object -func (obj *patternFlowGtpv1MessageType) SetValue(value uint32) PatternFlowGtpv1MessageType { - obj.setChoice(PatternFlowGtpv1MessageTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv1MessageType) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv1MessageType object -func (obj *patternFlowGtpv1MessageType) SetValues(value []uint32) PatternFlowGtpv1MessageType { - obj.setChoice(PatternFlowGtpv1MessageTypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv1MessageTypeCounter -func (obj *patternFlowGtpv1MessageType) Increment() PatternFlowGtpv1MessageTypeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv1MessageTypeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv1MessageTypeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv1MessageTypeCounter -func (obj *patternFlowGtpv1MessageType) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv1MessageTypeCounter value in the PatternFlowGtpv1MessageType object -func (obj *patternFlowGtpv1MessageType) SetIncrement(value PatternFlowGtpv1MessageTypeCounter) PatternFlowGtpv1MessageType { - obj.setChoice(PatternFlowGtpv1MessageTypeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1MessageTypeCounter -func (obj *patternFlowGtpv1MessageType) Decrement() PatternFlowGtpv1MessageTypeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv1MessageTypeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv1MessageTypeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1MessageTypeCounter -func (obj *patternFlowGtpv1MessageType) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv1MessageTypeCounter value in the PatternFlowGtpv1MessageType object -func (obj *patternFlowGtpv1MessageType) SetDecrement(value PatternFlowGtpv1MessageTypeCounter) PatternFlowGtpv1MessageType { - obj.setChoice(PatternFlowGtpv1MessageTypeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv1MessageTypeMetricTag -func (obj *patternFlowGtpv1MessageType) MetricTags() PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv1MessageTypeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter struct { - obj *patternFlowGtpv1MessageType - patternFlowGtpv1MessageTypeMetricTagSlice []PatternFlowGtpv1MessageTypeMetricTag - fieldPtr *[]*otg.PatternFlowGtpv1MessageTypeMetricTag -} - -func newPatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter(ptr *[]*otg.PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { - return &patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter interface { - setMsg(*patternFlowGtpv1MessageType) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter - Items() []PatternFlowGtpv1MessageTypeMetricTag - Add() PatternFlowGtpv1MessageTypeMetricTag - Append(items ...PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter - Set(index int, newObj PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter - Clear() PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter - clearHolderSlice() PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter - appendHolderSlice(item PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter -} - -func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) setMsg(msg *patternFlowGtpv1MessageType) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv1MessageTypeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) Items() []PatternFlowGtpv1MessageTypeMetricTag { - return obj.patternFlowGtpv1MessageTypeMetricTagSlice -} - -func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) Add() PatternFlowGtpv1MessageTypeMetricTag { - newObj := &otg.PatternFlowGtpv1MessageTypeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv1MessageTypeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv1MessageTypeMetricTagSlice = append(obj.patternFlowGtpv1MessageTypeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) Append(items ...PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv1MessageTypeMetricTagSlice = append(obj.patternFlowGtpv1MessageTypeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) Set(index int, newObj PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv1MessageTypeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) Clear() PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv1MessageTypeMetricTag{} - obj.patternFlowGtpv1MessageTypeMetricTagSlice = []PatternFlowGtpv1MessageTypeMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) clearHolderSlice() PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { - if len(obj.patternFlowGtpv1MessageTypeMetricTagSlice) > 0 { - obj.patternFlowGtpv1MessageTypeMetricTagSlice = []PatternFlowGtpv1MessageTypeMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) appendHolderSlice(item PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { - obj.patternFlowGtpv1MessageTypeMetricTagSlice = append(obj.patternFlowGtpv1MessageTypeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv1MessageType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1MessageType.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv1MessageType.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv1MessageTypeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv1MessageType) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv1MessageTypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv1MessageTypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv1MessageTypeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv1MessageTypeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv1MessageTypeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv1MessageTypeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1MessageType") - } - } else { - intVal := otg.PatternFlowGtpv1MessageType_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv1MessageType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv1MessageLength ***** -type patternFlowGtpv1MessageLength struct { - validation - obj *otg.PatternFlowGtpv1MessageLength - marshaller marshalPatternFlowGtpv1MessageLength - unMarshaller unMarshalPatternFlowGtpv1MessageLength - incrementHolder PatternFlowGtpv1MessageLengthCounter - decrementHolder PatternFlowGtpv1MessageLengthCounter - metricTagsHolder PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter -} - -func NewPatternFlowGtpv1MessageLength() PatternFlowGtpv1MessageLength { - obj := patternFlowGtpv1MessageLength{obj: &otg.PatternFlowGtpv1MessageLength{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1MessageLength) msg() *otg.PatternFlowGtpv1MessageLength { - return obj.obj -} - -func (obj *patternFlowGtpv1MessageLength) setMsg(msg *otg.PatternFlowGtpv1MessageLength) PatternFlowGtpv1MessageLength { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1MessageLength struct { - obj *patternFlowGtpv1MessageLength -} - -type marshalPatternFlowGtpv1MessageLength interface { - // ToProto marshals PatternFlowGtpv1MessageLength to protobuf object *otg.PatternFlowGtpv1MessageLength - ToProto() (*otg.PatternFlowGtpv1MessageLength, error) - // ToPbText marshals PatternFlowGtpv1MessageLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1MessageLength to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1MessageLength to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1MessageLength struct { - obj *patternFlowGtpv1MessageLength -} - -type unMarshalPatternFlowGtpv1MessageLength interface { - // FromProto unmarshals PatternFlowGtpv1MessageLength from protobuf object *otg.PatternFlowGtpv1MessageLength - FromProto(msg *otg.PatternFlowGtpv1MessageLength) (PatternFlowGtpv1MessageLength, error) - // FromPbText unmarshals PatternFlowGtpv1MessageLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1MessageLength from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1MessageLength from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1MessageLength) Marshal() marshalPatternFlowGtpv1MessageLength { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1MessageLength{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1MessageLength) Unmarshal() unMarshalPatternFlowGtpv1MessageLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1MessageLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1MessageLength) ToProto() (*otg.PatternFlowGtpv1MessageLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1MessageLength) FromProto(msg *otg.PatternFlowGtpv1MessageLength) (PatternFlowGtpv1MessageLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1MessageLength) 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 *unMarshalpatternFlowGtpv1MessageLength) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv1MessageLength) 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 *unMarshalpatternFlowGtpv1MessageLength) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv1MessageLength) 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 *unMarshalpatternFlowGtpv1MessageLength) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv1MessageLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1MessageLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1MessageLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1MessageLength) Clone() (PatternFlowGtpv1MessageLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1MessageLength() - 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 -} - -func (obj *patternFlowGtpv1MessageLength) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv1MessageLength is the length of the payload (the bytes following the mandatory 8-byte GTP header) in bytes that includes any optional fields -type PatternFlowGtpv1MessageLength interface { - Validation - // msg marshals PatternFlowGtpv1MessageLength to protobuf object *otg.PatternFlowGtpv1MessageLength - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1MessageLength - // setMsg unmarshals PatternFlowGtpv1MessageLength from protobuf object *otg.PatternFlowGtpv1MessageLength - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1MessageLength) PatternFlowGtpv1MessageLength - // provides marshal interface - Marshal() marshalPatternFlowGtpv1MessageLength - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1MessageLength - // validate validates PatternFlowGtpv1MessageLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1MessageLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv1MessageLengthChoiceEnum, set in PatternFlowGtpv1MessageLength - Choice() PatternFlowGtpv1MessageLengthChoiceEnum - // setChoice assigns PatternFlowGtpv1MessageLengthChoiceEnum provided by user to PatternFlowGtpv1MessageLength - setChoice(value PatternFlowGtpv1MessageLengthChoiceEnum) PatternFlowGtpv1MessageLength - // HasChoice checks if Choice has been set in PatternFlowGtpv1MessageLength - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv1MessageLength. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv1MessageLength - SetValue(value uint32) PatternFlowGtpv1MessageLength - // HasValue checks if Value has been set in PatternFlowGtpv1MessageLength - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv1MessageLength. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv1MessageLength - SetValues(value []uint32) PatternFlowGtpv1MessageLength - // Increment returns PatternFlowGtpv1MessageLengthCounter, set in PatternFlowGtpv1MessageLength. - // PatternFlowGtpv1MessageLengthCounter is integer counter pattern - Increment() PatternFlowGtpv1MessageLengthCounter - // SetIncrement assigns PatternFlowGtpv1MessageLengthCounter provided by user to PatternFlowGtpv1MessageLength. - // PatternFlowGtpv1MessageLengthCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv1MessageLengthCounter) PatternFlowGtpv1MessageLength - // HasIncrement checks if Increment has been set in PatternFlowGtpv1MessageLength - HasIncrement() bool - // Decrement returns PatternFlowGtpv1MessageLengthCounter, set in PatternFlowGtpv1MessageLength. - // PatternFlowGtpv1MessageLengthCounter is integer counter pattern - Decrement() PatternFlowGtpv1MessageLengthCounter - // SetDecrement assigns PatternFlowGtpv1MessageLengthCounter provided by user to PatternFlowGtpv1MessageLength. - // PatternFlowGtpv1MessageLengthCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv1MessageLengthCounter) PatternFlowGtpv1MessageLength - // HasDecrement checks if Decrement has been set in PatternFlowGtpv1MessageLength - HasDecrement() bool - // MetricTags returns PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIterIter, set in PatternFlowGtpv1MessageLength - MetricTags() PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter - setNil() -} - -type PatternFlowGtpv1MessageLengthChoiceEnum string - -// Enum of Choice on PatternFlowGtpv1MessageLength -var PatternFlowGtpv1MessageLengthChoice = struct { - VALUE PatternFlowGtpv1MessageLengthChoiceEnum - VALUES PatternFlowGtpv1MessageLengthChoiceEnum - INCREMENT PatternFlowGtpv1MessageLengthChoiceEnum - DECREMENT PatternFlowGtpv1MessageLengthChoiceEnum -}{ - VALUE: PatternFlowGtpv1MessageLengthChoiceEnum("value"), - VALUES: PatternFlowGtpv1MessageLengthChoiceEnum("values"), - INCREMENT: PatternFlowGtpv1MessageLengthChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv1MessageLengthChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv1MessageLength) Choice() PatternFlowGtpv1MessageLengthChoiceEnum { - return PatternFlowGtpv1MessageLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv1MessageLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv1MessageLength) setChoice(value PatternFlowGtpv1MessageLengthChoiceEnum) PatternFlowGtpv1MessageLength { - intValue, ok := otg.PatternFlowGtpv1MessageLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv1MessageLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv1MessageLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv1MessageLengthChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv1MessageLengthChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv1MessageLengthChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv1MessageLengthCounter().msg() - } - - if value == PatternFlowGtpv1MessageLengthChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv1MessageLengthCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1MessageLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv1MessageLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1MessageLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv1MessageLength object -func (obj *patternFlowGtpv1MessageLength) SetValue(value uint32) PatternFlowGtpv1MessageLength { - obj.setChoice(PatternFlowGtpv1MessageLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv1MessageLength) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv1MessageLength object -func (obj *patternFlowGtpv1MessageLength) SetValues(value []uint32) PatternFlowGtpv1MessageLength { - obj.setChoice(PatternFlowGtpv1MessageLengthChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv1MessageLengthCounter -func (obj *patternFlowGtpv1MessageLength) Increment() PatternFlowGtpv1MessageLengthCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv1MessageLengthChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv1MessageLengthCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv1MessageLengthCounter -func (obj *patternFlowGtpv1MessageLength) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv1MessageLengthCounter value in the PatternFlowGtpv1MessageLength object -func (obj *patternFlowGtpv1MessageLength) SetIncrement(value PatternFlowGtpv1MessageLengthCounter) PatternFlowGtpv1MessageLength { - obj.setChoice(PatternFlowGtpv1MessageLengthChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1MessageLengthCounter -func (obj *patternFlowGtpv1MessageLength) Decrement() PatternFlowGtpv1MessageLengthCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv1MessageLengthChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv1MessageLengthCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1MessageLengthCounter -func (obj *patternFlowGtpv1MessageLength) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv1MessageLengthCounter value in the PatternFlowGtpv1MessageLength object -func (obj *patternFlowGtpv1MessageLength) SetDecrement(value PatternFlowGtpv1MessageLengthCounter) PatternFlowGtpv1MessageLength { - obj.setChoice(PatternFlowGtpv1MessageLengthChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv1MessageLengthMetricTag -func (obj *patternFlowGtpv1MessageLength) MetricTags() PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv1MessageLengthMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter struct { - obj *patternFlowGtpv1MessageLength - patternFlowGtpv1MessageLengthMetricTagSlice []PatternFlowGtpv1MessageLengthMetricTag - fieldPtr *[]*otg.PatternFlowGtpv1MessageLengthMetricTag -} - -func newPatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter(ptr *[]*otg.PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { - return &patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter interface { - setMsg(*patternFlowGtpv1MessageLength) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter - Items() []PatternFlowGtpv1MessageLengthMetricTag - Add() PatternFlowGtpv1MessageLengthMetricTag - Append(items ...PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter - Set(index int, newObj PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter - Clear() PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter - clearHolderSlice() PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter - appendHolderSlice(item PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter -} - -func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) setMsg(msg *patternFlowGtpv1MessageLength) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv1MessageLengthMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) Items() []PatternFlowGtpv1MessageLengthMetricTag { - return obj.patternFlowGtpv1MessageLengthMetricTagSlice -} - -func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) Add() PatternFlowGtpv1MessageLengthMetricTag { - newObj := &otg.PatternFlowGtpv1MessageLengthMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv1MessageLengthMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv1MessageLengthMetricTagSlice = append(obj.patternFlowGtpv1MessageLengthMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) Append(items ...PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv1MessageLengthMetricTagSlice = append(obj.patternFlowGtpv1MessageLengthMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) Set(index int, newObj PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv1MessageLengthMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) Clear() PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv1MessageLengthMetricTag{} - obj.patternFlowGtpv1MessageLengthMetricTagSlice = []PatternFlowGtpv1MessageLengthMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) clearHolderSlice() PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { - if len(obj.patternFlowGtpv1MessageLengthMetricTagSlice) > 0 { - obj.patternFlowGtpv1MessageLengthMetricTagSlice = []PatternFlowGtpv1MessageLengthMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) appendHolderSlice(item PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { - obj.patternFlowGtpv1MessageLengthMetricTagSlice = append(obj.patternFlowGtpv1MessageLengthMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv1MessageLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1MessageLength.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv1MessageLength.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv1MessageLengthMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv1MessageLength) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv1MessageLengthChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv1MessageLengthChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv1MessageLengthChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv1MessageLengthChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv1MessageLengthChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv1MessageLengthChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1MessageLength") - } - } else { - intVal := otg.PatternFlowGtpv1MessageLength_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv1MessageLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv1Teid ***** -type patternFlowGtpv1Teid struct { - validation - obj *otg.PatternFlowGtpv1Teid - marshaller marshalPatternFlowGtpv1Teid - unMarshaller unMarshalPatternFlowGtpv1Teid - incrementHolder PatternFlowGtpv1TeidCounter - decrementHolder PatternFlowGtpv1TeidCounter - metricTagsHolder PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter -} - -func NewPatternFlowGtpv1Teid() PatternFlowGtpv1Teid { - obj := patternFlowGtpv1Teid{obj: &otg.PatternFlowGtpv1Teid{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1Teid) msg() *otg.PatternFlowGtpv1Teid { - return obj.obj -} - -func (obj *patternFlowGtpv1Teid) setMsg(msg *otg.PatternFlowGtpv1Teid) PatternFlowGtpv1Teid { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1Teid struct { - obj *patternFlowGtpv1Teid -} - -type marshalPatternFlowGtpv1Teid interface { - // ToProto marshals PatternFlowGtpv1Teid to protobuf object *otg.PatternFlowGtpv1Teid - ToProto() (*otg.PatternFlowGtpv1Teid, error) - // ToPbText marshals PatternFlowGtpv1Teid to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1Teid to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1Teid to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1Teid struct { - obj *patternFlowGtpv1Teid -} - -type unMarshalPatternFlowGtpv1Teid interface { - // FromProto unmarshals PatternFlowGtpv1Teid from protobuf object *otg.PatternFlowGtpv1Teid - FromProto(msg *otg.PatternFlowGtpv1Teid) (PatternFlowGtpv1Teid, error) - // FromPbText unmarshals PatternFlowGtpv1Teid from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1Teid from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1Teid from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1Teid) Marshal() marshalPatternFlowGtpv1Teid { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1Teid{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1Teid) Unmarshal() unMarshalPatternFlowGtpv1Teid { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1Teid{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1Teid) ToProto() (*otg.PatternFlowGtpv1Teid, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1Teid) FromProto(msg *otg.PatternFlowGtpv1Teid) (PatternFlowGtpv1Teid, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1Teid) 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 *unMarshalpatternFlowGtpv1Teid) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv1Teid) 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 *unMarshalpatternFlowGtpv1Teid) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv1Teid) 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 *unMarshalpatternFlowGtpv1Teid) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv1Teid) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1Teid) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1Teid) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1Teid) Clone() (PatternFlowGtpv1Teid, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1Teid() - 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 -} - -func (obj *patternFlowGtpv1Teid) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv1Teid is tunnel endpoint identifier (TEID) used to multiplex connections in the same GTP tunnel -type PatternFlowGtpv1Teid interface { - Validation - // msg marshals PatternFlowGtpv1Teid to protobuf object *otg.PatternFlowGtpv1Teid - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1Teid - // setMsg unmarshals PatternFlowGtpv1Teid from protobuf object *otg.PatternFlowGtpv1Teid - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1Teid) PatternFlowGtpv1Teid - // provides marshal interface - Marshal() marshalPatternFlowGtpv1Teid - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1Teid - // validate validates PatternFlowGtpv1Teid - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1Teid, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv1TeidChoiceEnum, set in PatternFlowGtpv1Teid - Choice() PatternFlowGtpv1TeidChoiceEnum - // setChoice assigns PatternFlowGtpv1TeidChoiceEnum provided by user to PatternFlowGtpv1Teid - setChoice(value PatternFlowGtpv1TeidChoiceEnum) PatternFlowGtpv1Teid - // HasChoice checks if Choice has been set in PatternFlowGtpv1Teid - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv1Teid. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv1Teid - SetValue(value uint32) PatternFlowGtpv1Teid - // HasValue checks if Value has been set in PatternFlowGtpv1Teid - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv1Teid. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv1Teid - SetValues(value []uint32) PatternFlowGtpv1Teid - // Increment returns PatternFlowGtpv1TeidCounter, set in PatternFlowGtpv1Teid. - // PatternFlowGtpv1TeidCounter is integer counter pattern - Increment() PatternFlowGtpv1TeidCounter - // SetIncrement assigns PatternFlowGtpv1TeidCounter provided by user to PatternFlowGtpv1Teid. - // PatternFlowGtpv1TeidCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv1TeidCounter) PatternFlowGtpv1Teid - // HasIncrement checks if Increment has been set in PatternFlowGtpv1Teid - HasIncrement() bool - // Decrement returns PatternFlowGtpv1TeidCounter, set in PatternFlowGtpv1Teid. - // PatternFlowGtpv1TeidCounter is integer counter pattern - Decrement() PatternFlowGtpv1TeidCounter - // SetDecrement assigns PatternFlowGtpv1TeidCounter provided by user to PatternFlowGtpv1Teid. - // PatternFlowGtpv1TeidCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv1TeidCounter) PatternFlowGtpv1Teid - // HasDecrement checks if Decrement has been set in PatternFlowGtpv1Teid - HasDecrement() bool - // MetricTags returns PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIterIter, set in PatternFlowGtpv1Teid - MetricTags() PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter - setNil() -} - -type PatternFlowGtpv1TeidChoiceEnum string - -// Enum of Choice on PatternFlowGtpv1Teid -var PatternFlowGtpv1TeidChoice = struct { - VALUE PatternFlowGtpv1TeidChoiceEnum - VALUES PatternFlowGtpv1TeidChoiceEnum - INCREMENT PatternFlowGtpv1TeidChoiceEnum - DECREMENT PatternFlowGtpv1TeidChoiceEnum -}{ - VALUE: PatternFlowGtpv1TeidChoiceEnum("value"), - VALUES: PatternFlowGtpv1TeidChoiceEnum("values"), - INCREMENT: PatternFlowGtpv1TeidChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv1TeidChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv1Teid) Choice() PatternFlowGtpv1TeidChoiceEnum { - return PatternFlowGtpv1TeidChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv1Teid) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv1Teid) setChoice(value PatternFlowGtpv1TeidChoiceEnum) PatternFlowGtpv1Teid { - intValue, ok := otg.PatternFlowGtpv1Teid_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv1TeidChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv1Teid_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv1TeidChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv1TeidChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv1TeidChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv1TeidCounter().msg() - } - - if value == PatternFlowGtpv1TeidChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv1TeidCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1Teid) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv1TeidChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1Teid) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv1Teid object -func (obj *patternFlowGtpv1Teid) SetValue(value uint32) PatternFlowGtpv1Teid { - obj.setChoice(PatternFlowGtpv1TeidChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv1Teid) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv1Teid object -func (obj *patternFlowGtpv1Teid) SetValues(value []uint32) PatternFlowGtpv1Teid { - obj.setChoice(PatternFlowGtpv1TeidChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv1TeidCounter -func (obj *patternFlowGtpv1Teid) Increment() PatternFlowGtpv1TeidCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv1TeidChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv1TeidCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv1TeidCounter -func (obj *patternFlowGtpv1Teid) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv1TeidCounter value in the PatternFlowGtpv1Teid object -func (obj *patternFlowGtpv1Teid) SetIncrement(value PatternFlowGtpv1TeidCounter) PatternFlowGtpv1Teid { - obj.setChoice(PatternFlowGtpv1TeidChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1TeidCounter -func (obj *patternFlowGtpv1Teid) Decrement() PatternFlowGtpv1TeidCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv1TeidChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv1TeidCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1TeidCounter -func (obj *patternFlowGtpv1Teid) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv1TeidCounter value in the PatternFlowGtpv1Teid object -func (obj *patternFlowGtpv1Teid) SetDecrement(value PatternFlowGtpv1TeidCounter) PatternFlowGtpv1Teid { - obj.setChoice(PatternFlowGtpv1TeidChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv1TeidMetricTag -func (obj *patternFlowGtpv1Teid) MetricTags() PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv1TeidMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter struct { - obj *patternFlowGtpv1Teid - patternFlowGtpv1TeidMetricTagSlice []PatternFlowGtpv1TeidMetricTag - fieldPtr *[]*otg.PatternFlowGtpv1TeidMetricTag -} - -func newPatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter(ptr *[]*otg.PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { - return &patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter interface { - setMsg(*patternFlowGtpv1Teid) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter - Items() []PatternFlowGtpv1TeidMetricTag - Add() PatternFlowGtpv1TeidMetricTag - Append(items ...PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter - Set(index int, newObj PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter - Clear() PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter - clearHolderSlice() PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter - appendHolderSlice(item PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter -} - -func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) setMsg(msg *patternFlowGtpv1Teid) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv1TeidMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) Items() []PatternFlowGtpv1TeidMetricTag { - return obj.patternFlowGtpv1TeidMetricTagSlice -} - -func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) Add() PatternFlowGtpv1TeidMetricTag { - newObj := &otg.PatternFlowGtpv1TeidMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv1TeidMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv1TeidMetricTagSlice = append(obj.patternFlowGtpv1TeidMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) Append(items ...PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv1TeidMetricTagSlice = append(obj.patternFlowGtpv1TeidMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) Set(index int, newObj PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv1TeidMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) Clear() PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv1TeidMetricTag{} - obj.patternFlowGtpv1TeidMetricTagSlice = []PatternFlowGtpv1TeidMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) clearHolderSlice() PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { - if len(obj.patternFlowGtpv1TeidMetricTagSlice) > 0 { - obj.patternFlowGtpv1TeidMetricTagSlice = []PatternFlowGtpv1TeidMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) appendHolderSlice(item PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { - obj.patternFlowGtpv1TeidMetricTagSlice = append(obj.patternFlowGtpv1TeidMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv1Teid) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv1TeidMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv1Teid) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv1TeidChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv1TeidChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv1TeidChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv1TeidChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv1TeidChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv1TeidChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1Teid") - } - } else { - intVal := otg.PatternFlowGtpv1Teid_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv1Teid_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv1SquenceNumber ***** -type patternFlowGtpv1SquenceNumber struct { - validation - obj *otg.PatternFlowGtpv1SquenceNumber - marshaller marshalPatternFlowGtpv1SquenceNumber - unMarshaller unMarshalPatternFlowGtpv1SquenceNumber - incrementHolder PatternFlowGtpv1SquenceNumberCounter - decrementHolder PatternFlowGtpv1SquenceNumberCounter - metricTagsHolder PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter -} - -func NewPatternFlowGtpv1SquenceNumber() PatternFlowGtpv1SquenceNumber { - obj := patternFlowGtpv1SquenceNumber{obj: &otg.PatternFlowGtpv1SquenceNumber{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1SquenceNumber) msg() *otg.PatternFlowGtpv1SquenceNumber { - return obj.obj -} - -func (obj *patternFlowGtpv1SquenceNumber) setMsg(msg *otg.PatternFlowGtpv1SquenceNumber) PatternFlowGtpv1SquenceNumber { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1SquenceNumber struct { - obj *patternFlowGtpv1SquenceNumber -} - -type marshalPatternFlowGtpv1SquenceNumber interface { - // ToProto marshals PatternFlowGtpv1SquenceNumber to protobuf object *otg.PatternFlowGtpv1SquenceNumber - ToProto() (*otg.PatternFlowGtpv1SquenceNumber, error) - // ToPbText marshals PatternFlowGtpv1SquenceNumber to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1SquenceNumber to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1SquenceNumber to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1SquenceNumber struct { - obj *patternFlowGtpv1SquenceNumber -} - -type unMarshalPatternFlowGtpv1SquenceNumber interface { - // FromProto unmarshals PatternFlowGtpv1SquenceNumber from protobuf object *otg.PatternFlowGtpv1SquenceNumber - FromProto(msg *otg.PatternFlowGtpv1SquenceNumber) (PatternFlowGtpv1SquenceNumber, error) - // FromPbText unmarshals PatternFlowGtpv1SquenceNumber from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1SquenceNumber from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1SquenceNumber from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1SquenceNumber) Marshal() marshalPatternFlowGtpv1SquenceNumber { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1SquenceNumber{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1SquenceNumber) Unmarshal() unMarshalPatternFlowGtpv1SquenceNumber { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1SquenceNumber{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1SquenceNumber) ToProto() (*otg.PatternFlowGtpv1SquenceNumber, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1SquenceNumber) FromProto(msg *otg.PatternFlowGtpv1SquenceNumber) (PatternFlowGtpv1SquenceNumber, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1SquenceNumber) 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 *unMarshalpatternFlowGtpv1SquenceNumber) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv1SquenceNumber) 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 *unMarshalpatternFlowGtpv1SquenceNumber) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv1SquenceNumber) 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 *unMarshalpatternFlowGtpv1SquenceNumber) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv1SquenceNumber) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1SquenceNumber) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1SquenceNumber) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1SquenceNumber) Clone() (PatternFlowGtpv1SquenceNumber, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1SquenceNumber() - 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 -} - -func (obj *patternFlowGtpv1SquenceNumber) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv1SquenceNumber is sequence number. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the s_flag bit is on. -type PatternFlowGtpv1SquenceNumber interface { - Validation - // msg marshals PatternFlowGtpv1SquenceNumber to protobuf object *otg.PatternFlowGtpv1SquenceNumber - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1SquenceNumber - // setMsg unmarshals PatternFlowGtpv1SquenceNumber from protobuf object *otg.PatternFlowGtpv1SquenceNumber - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1SquenceNumber) PatternFlowGtpv1SquenceNumber - // provides marshal interface - Marshal() marshalPatternFlowGtpv1SquenceNumber - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1SquenceNumber - // validate validates PatternFlowGtpv1SquenceNumber - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1SquenceNumber, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv1SquenceNumberChoiceEnum, set in PatternFlowGtpv1SquenceNumber - Choice() PatternFlowGtpv1SquenceNumberChoiceEnum - // setChoice assigns PatternFlowGtpv1SquenceNumberChoiceEnum provided by user to PatternFlowGtpv1SquenceNumber - setChoice(value PatternFlowGtpv1SquenceNumberChoiceEnum) PatternFlowGtpv1SquenceNumber - // HasChoice checks if Choice has been set in PatternFlowGtpv1SquenceNumber - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv1SquenceNumber. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv1SquenceNumber - SetValue(value uint32) PatternFlowGtpv1SquenceNumber - // HasValue checks if Value has been set in PatternFlowGtpv1SquenceNumber - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv1SquenceNumber. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv1SquenceNumber - SetValues(value []uint32) PatternFlowGtpv1SquenceNumber - // Increment returns PatternFlowGtpv1SquenceNumberCounter, set in PatternFlowGtpv1SquenceNumber. - // PatternFlowGtpv1SquenceNumberCounter is integer counter pattern - Increment() PatternFlowGtpv1SquenceNumberCounter - // SetIncrement assigns PatternFlowGtpv1SquenceNumberCounter provided by user to PatternFlowGtpv1SquenceNumber. - // PatternFlowGtpv1SquenceNumberCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv1SquenceNumberCounter) PatternFlowGtpv1SquenceNumber - // HasIncrement checks if Increment has been set in PatternFlowGtpv1SquenceNumber - HasIncrement() bool - // Decrement returns PatternFlowGtpv1SquenceNumberCounter, set in PatternFlowGtpv1SquenceNumber. - // PatternFlowGtpv1SquenceNumberCounter is integer counter pattern - Decrement() PatternFlowGtpv1SquenceNumberCounter - // SetDecrement assigns PatternFlowGtpv1SquenceNumberCounter provided by user to PatternFlowGtpv1SquenceNumber. - // PatternFlowGtpv1SquenceNumberCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv1SquenceNumberCounter) PatternFlowGtpv1SquenceNumber - // HasDecrement checks if Decrement has been set in PatternFlowGtpv1SquenceNumber - HasDecrement() bool - // MetricTags returns PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIterIter, set in PatternFlowGtpv1SquenceNumber - MetricTags() PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter - setNil() -} - -type PatternFlowGtpv1SquenceNumberChoiceEnum string - -// Enum of Choice on PatternFlowGtpv1SquenceNumber -var PatternFlowGtpv1SquenceNumberChoice = struct { - VALUE PatternFlowGtpv1SquenceNumberChoiceEnum - VALUES PatternFlowGtpv1SquenceNumberChoiceEnum - INCREMENT PatternFlowGtpv1SquenceNumberChoiceEnum - DECREMENT PatternFlowGtpv1SquenceNumberChoiceEnum -}{ - VALUE: PatternFlowGtpv1SquenceNumberChoiceEnum("value"), - VALUES: PatternFlowGtpv1SquenceNumberChoiceEnum("values"), - INCREMENT: PatternFlowGtpv1SquenceNumberChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv1SquenceNumberChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv1SquenceNumber) Choice() PatternFlowGtpv1SquenceNumberChoiceEnum { - return PatternFlowGtpv1SquenceNumberChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv1SquenceNumber) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv1SquenceNumber) setChoice(value PatternFlowGtpv1SquenceNumberChoiceEnum) PatternFlowGtpv1SquenceNumber { - intValue, ok := otg.PatternFlowGtpv1SquenceNumber_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv1SquenceNumberChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv1SquenceNumber_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv1SquenceNumberChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv1SquenceNumberChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv1SquenceNumberChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv1SquenceNumberCounter().msg() - } - - if value == PatternFlowGtpv1SquenceNumberChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv1SquenceNumberCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1SquenceNumber) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1SquenceNumber) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv1SquenceNumber object -func (obj *patternFlowGtpv1SquenceNumber) SetValue(value uint32) PatternFlowGtpv1SquenceNumber { - obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv1SquenceNumber) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv1SquenceNumber object -func (obj *patternFlowGtpv1SquenceNumber) SetValues(value []uint32) PatternFlowGtpv1SquenceNumber { - obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv1SquenceNumberCounter -func (obj *patternFlowGtpv1SquenceNumber) Increment() PatternFlowGtpv1SquenceNumberCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv1SquenceNumberCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv1SquenceNumberCounter -func (obj *patternFlowGtpv1SquenceNumber) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv1SquenceNumberCounter value in the PatternFlowGtpv1SquenceNumber object -func (obj *patternFlowGtpv1SquenceNumber) SetIncrement(value PatternFlowGtpv1SquenceNumberCounter) PatternFlowGtpv1SquenceNumber { - obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1SquenceNumberCounter -func (obj *patternFlowGtpv1SquenceNumber) Decrement() PatternFlowGtpv1SquenceNumberCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv1SquenceNumberCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1SquenceNumberCounter -func (obj *patternFlowGtpv1SquenceNumber) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv1SquenceNumberCounter value in the PatternFlowGtpv1SquenceNumber object -func (obj *patternFlowGtpv1SquenceNumber) SetDecrement(value PatternFlowGtpv1SquenceNumberCounter) PatternFlowGtpv1SquenceNumber { - obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv1SquenceNumberMetricTag -func (obj *patternFlowGtpv1SquenceNumber) MetricTags() PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv1SquenceNumberMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter struct { - obj *patternFlowGtpv1SquenceNumber - patternFlowGtpv1SquenceNumberMetricTagSlice []PatternFlowGtpv1SquenceNumberMetricTag - fieldPtr *[]*otg.PatternFlowGtpv1SquenceNumberMetricTag -} - -func newPatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter(ptr *[]*otg.PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { - return &patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter interface { - setMsg(*patternFlowGtpv1SquenceNumber) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter - Items() []PatternFlowGtpv1SquenceNumberMetricTag - Add() PatternFlowGtpv1SquenceNumberMetricTag - Append(items ...PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter - Set(index int, newObj PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter - Clear() PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter - clearHolderSlice() PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter - appendHolderSlice(item PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter -} - -func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) setMsg(msg *patternFlowGtpv1SquenceNumber) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv1SquenceNumberMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) Items() []PatternFlowGtpv1SquenceNumberMetricTag { - return obj.patternFlowGtpv1SquenceNumberMetricTagSlice -} - -func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) Add() PatternFlowGtpv1SquenceNumberMetricTag { - newObj := &otg.PatternFlowGtpv1SquenceNumberMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv1SquenceNumberMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv1SquenceNumberMetricTagSlice = append(obj.patternFlowGtpv1SquenceNumberMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) Append(items ...PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv1SquenceNumberMetricTagSlice = append(obj.patternFlowGtpv1SquenceNumberMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) Set(index int, newObj PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv1SquenceNumberMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) Clear() PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv1SquenceNumberMetricTag{} - obj.patternFlowGtpv1SquenceNumberMetricTagSlice = []PatternFlowGtpv1SquenceNumberMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) clearHolderSlice() PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { - if len(obj.patternFlowGtpv1SquenceNumberMetricTagSlice) > 0 { - obj.patternFlowGtpv1SquenceNumberMetricTagSlice = []PatternFlowGtpv1SquenceNumberMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) appendHolderSlice(item PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { - obj.patternFlowGtpv1SquenceNumberMetricTagSlice = append(obj.patternFlowGtpv1SquenceNumberMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv1SquenceNumber) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1SquenceNumber.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv1SquenceNumber.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv1SquenceNumberMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv1SquenceNumber) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv1SquenceNumberChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv1SquenceNumberChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv1SquenceNumberChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv1SquenceNumberChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv1SquenceNumberChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1SquenceNumber") - } - } else { - intVal := otg.PatternFlowGtpv1SquenceNumber_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv1SquenceNumber_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv1NPduNumber ***** -type patternFlowGtpv1NPduNumber struct { - validation - obj *otg.PatternFlowGtpv1NPduNumber - marshaller marshalPatternFlowGtpv1NPduNumber - unMarshaller unMarshalPatternFlowGtpv1NPduNumber - incrementHolder PatternFlowGtpv1NPduNumberCounter - decrementHolder PatternFlowGtpv1NPduNumberCounter - metricTagsHolder PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter -} - -func NewPatternFlowGtpv1NPduNumber() PatternFlowGtpv1NPduNumber { - obj := patternFlowGtpv1NPduNumber{obj: &otg.PatternFlowGtpv1NPduNumber{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1NPduNumber) msg() *otg.PatternFlowGtpv1NPduNumber { - return obj.obj -} - -func (obj *patternFlowGtpv1NPduNumber) setMsg(msg *otg.PatternFlowGtpv1NPduNumber) PatternFlowGtpv1NPduNumber { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1NPduNumber struct { - obj *patternFlowGtpv1NPduNumber -} - -type marshalPatternFlowGtpv1NPduNumber interface { - // ToProto marshals PatternFlowGtpv1NPduNumber to protobuf object *otg.PatternFlowGtpv1NPduNumber - ToProto() (*otg.PatternFlowGtpv1NPduNumber, error) - // ToPbText marshals PatternFlowGtpv1NPduNumber to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1NPduNumber to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1NPduNumber to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1NPduNumber struct { - obj *patternFlowGtpv1NPduNumber -} - -type unMarshalPatternFlowGtpv1NPduNumber interface { - // FromProto unmarshals PatternFlowGtpv1NPduNumber from protobuf object *otg.PatternFlowGtpv1NPduNumber - FromProto(msg *otg.PatternFlowGtpv1NPduNumber) (PatternFlowGtpv1NPduNumber, error) - // FromPbText unmarshals PatternFlowGtpv1NPduNumber from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1NPduNumber from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1NPduNumber from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1NPduNumber) Marshal() marshalPatternFlowGtpv1NPduNumber { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1NPduNumber{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1NPduNumber) Unmarshal() unMarshalPatternFlowGtpv1NPduNumber { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1NPduNumber{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1NPduNumber) ToProto() (*otg.PatternFlowGtpv1NPduNumber, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1NPduNumber) FromProto(msg *otg.PatternFlowGtpv1NPduNumber) (PatternFlowGtpv1NPduNumber, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1NPduNumber) 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 *unMarshalpatternFlowGtpv1NPduNumber) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv1NPduNumber) 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 *unMarshalpatternFlowGtpv1NPduNumber) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv1NPduNumber) 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 *unMarshalpatternFlowGtpv1NPduNumber) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv1NPduNumber) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1NPduNumber) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1NPduNumber) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1NPduNumber) Clone() (PatternFlowGtpv1NPduNumber, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1NPduNumber() - 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 -} - -func (obj *patternFlowGtpv1NPduNumber) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv1NPduNumber is n-PDU number. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the pn_flag bit is on. -type PatternFlowGtpv1NPduNumber interface { - Validation - // msg marshals PatternFlowGtpv1NPduNumber to protobuf object *otg.PatternFlowGtpv1NPduNumber - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1NPduNumber - // setMsg unmarshals PatternFlowGtpv1NPduNumber from protobuf object *otg.PatternFlowGtpv1NPduNumber - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1NPduNumber) PatternFlowGtpv1NPduNumber - // provides marshal interface - Marshal() marshalPatternFlowGtpv1NPduNumber - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1NPduNumber - // validate validates PatternFlowGtpv1NPduNumber - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1NPduNumber, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv1NPduNumberChoiceEnum, set in PatternFlowGtpv1NPduNumber - Choice() PatternFlowGtpv1NPduNumberChoiceEnum - // setChoice assigns PatternFlowGtpv1NPduNumberChoiceEnum provided by user to PatternFlowGtpv1NPduNumber - setChoice(value PatternFlowGtpv1NPduNumberChoiceEnum) PatternFlowGtpv1NPduNumber - // HasChoice checks if Choice has been set in PatternFlowGtpv1NPduNumber - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv1NPduNumber. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv1NPduNumber - SetValue(value uint32) PatternFlowGtpv1NPduNumber - // HasValue checks if Value has been set in PatternFlowGtpv1NPduNumber - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv1NPduNumber. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv1NPduNumber - SetValues(value []uint32) PatternFlowGtpv1NPduNumber - // Increment returns PatternFlowGtpv1NPduNumberCounter, set in PatternFlowGtpv1NPduNumber. - // PatternFlowGtpv1NPduNumberCounter is integer counter pattern - Increment() PatternFlowGtpv1NPduNumberCounter - // SetIncrement assigns PatternFlowGtpv1NPduNumberCounter provided by user to PatternFlowGtpv1NPduNumber. - // PatternFlowGtpv1NPduNumberCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv1NPduNumberCounter) PatternFlowGtpv1NPduNumber - // HasIncrement checks if Increment has been set in PatternFlowGtpv1NPduNumber - HasIncrement() bool - // Decrement returns PatternFlowGtpv1NPduNumberCounter, set in PatternFlowGtpv1NPduNumber. - // PatternFlowGtpv1NPduNumberCounter is integer counter pattern - Decrement() PatternFlowGtpv1NPduNumberCounter - // SetDecrement assigns PatternFlowGtpv1NPduNumberCounter provided by user to PatternFlowGtpv1NPduNumber. - // PatternFlowGtpv1NPduNumberCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv1NPduNumberCounter) PatternFlowGtpv1NPduNumber - // HasDecrement checks if Decrement has been set in PatternFlowGtpv1NPduNumber - HasDecrement() bool - // MetricTags returns PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIterIter, set in PatternFlowGtpv1NPduNumber - MetricTags() PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter - setNil() -} - -type PatternFlowGtpv1NPduNumberChoiceEnum string - -// Enum of Choice on PatternFlowGtpv1NPduNumber -var PatternFlowGtpv1NPduNumberChoice = struct { - VALUE PatternFlowGtpv1NPduNumberChoiceEnum - VALUES PatternFlowGtpv1NPduNumberChoiceEnum - INCREMENT PatternFlowGtpv1NPduNumberChoiceEnum - DECREMENT PatternFlowGtpv1NPduNumberChoiceEnum -}{ - VALUE: PatternFlowGtpv1NPduNumberChoiceEnum("value"), - VALUES: PatternFlowGtpv1NPduNumberChoiceEnum("values"), - INCREMENT: PatternFlowGtpv1NPduNumberChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv1NPduNumberChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv1NPduNumber) Choice() PatternFlowGtpv1NPduNumberChoiceEnum { - return PatternFlowGtpv1NPduNumberChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv1NPduNumber) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv1NPduNumber) setChoice(value PatternFlowGtpv1NPduNumberChoiceEnum) PatternFlowGtpv1NPduNumber { - intValue, ok := otg.PatternFlowGtpv1NPduNumber_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv1NPduNumberChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv1NPduNumber_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv1NPduNumberChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv1NPduNumberChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv1NPduNumberChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv1NPduNumberCounter().msg() - } - - if value == PatternFlowGtpv1NPduNumberChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv1NPduNumberCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1NPduNumber) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv1NPduNumberChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1NPduNumber) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv1NPduNumber object -func (obj *patternFlowGtpv1NPduNumber) SetValue(value uint32) PatternFlowGtpv1NPduNumber { - obj.setChoice(PatternFlowGtpv1NPduNumberChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv1NPduNumber) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv1NPduNumber object -func (obj *patternFlowGtpv1NPduNumber) SetValues(value []uint32) PatternFlowGtpv1NPduNumber { - obj.setChoice(PatternFlowGtpv1NPduNumberChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv1NPduNumberCounter -func (obj *patternFlowGtpv1NPduNumber) Increment() PatternFlowGtpv1NPduNumberCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv1NPduNumberChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv1NPduNumberCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv1NPduNumberCounter -func (obj *patternFlowGtpv1NPduNumber) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv1NPduNumberCounter value in the PatternFlowGtpv1NPduNumber object -func (obj *patternFlowGtpv1NPduNumber) SetIncrement(value PatternFlowGtpv1NPduNumberCounter) PatternFlowGtpv1NPduNumber { - obj.setChoice(PatternFlowGtpv1NPduNumberChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1NPduNumberCounter -func (obj *patternFlowGtpv1NPduNumber) Decrement() PatternFlowGtpv1NPduNumberCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv1NPduNumberChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv1NPduNumberCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1NPduNumberCounter -func (obj *patternFlowGtpv1NPduNumber) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv1NPduNumberCounter value in the PatternFlowGtpv1NPduNumber object -func (obj *patternFlowGtpv1NPduNumber) SetDecrement(value PatternFlowGtpv1NPduNumberCounter) PatternFlowGtpv1NPduNumber { - obj.setChoice(PatternFlowGtpv1NPduNumberChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv1NPduNumberMetricTag -func (obj *patternFlowGtpv1NPduNumber) MetricTags() PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv1NPduNumberMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter struct { - obj *patternFlowGtpv1NPduNumber - patternFlowGtpv1NPduNumberMetricTagSlice []PatternFlowGtpv1NPduNumberMetricTag - fieldPtr *[]*otg.PatternFlowGtpv1NPduNumberMetricTag -} - -func newPatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter(ptr *[]*otg.PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { - return &patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter interface { - setMsg(*patternFlowGtpv1NPduNumber) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter - Items() []PatternFlowGtpv1NPduNumberMetricTag - Add() PatternFlowGtpv1NPduNumberMetricTag - Append(items ...PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter - Set(index int, newObj PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter - Clear() PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter - clearHolderSlice() PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter - appendHolderSlice(item PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter -} - -func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) setMsg(msg *patternFlowGtpv1NPduNumber) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv1NPduNumberMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) Items() []PatternFlowGtpv1NPduNumberMetricTag { - return obj.patternFlowGtpv1NPduNumberMetricTagSlice -} - -func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) Add() PatternFlowGtpv1NPduNumberMetricTag { - newObj := &otg.PatternFlowGtpv1NPduNumberMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv1NPduNumberMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv1NPduNumberMetricTagSlice = append(obj.patternFlowGtpv1NPduNumberMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) Append(items ...PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv1NPduNumberMetricTagSlice = append(obj.patternFlowGtpv1NPduNumberMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) Set(index int, newObj PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv1NPduNumberMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) Clear() PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv1NPduNumberMetricTag{} - obj.patternFlowGtpv1NPduNumberMetricTagSlice = []PatternFlowGtpv1NPduNumberMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) clearHolderSlice() PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { - if len(obj.patternFlowGtpv1NPduNumberMetricTagSlice) > 0 { - obj.patternFlowGtpv1NPduNumberMetricTagSlice = []PatternFlowGtpv1NPduNumberMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) appendHolderSlice(item PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { - obj.patternFlowGtpv1NPduNumberMetricTagSlice = append(obj.patternFlowGtpv1NPduNumberMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv1NPduNumber) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1NPduNumber.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv1NPduNumber.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv1NPduNumberMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv1NPduNumber) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv1NPduNumberChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv1NPduNumberChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv1NPduNumberChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv1NPduNumberChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv1NPduNumberChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv1NPduNumberChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1NPduNumber") - } - } else { - intVal := otg.PatternFlowGtpv1NPduNumber_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv1NPduNumber_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv1NextExtensionHeaderType ***** -type patternFlowGtpv1NextExtensionHeaderType struct { - validation - obj *otg.PatternFlowGtpv1NextExtensionHeaderType - marshaller marshalPatternFlowGtpv1NextExtensionHeaderType - unMarshaller unMarshalPatternFlowGtpv1NextExtensionHeaderType - incrementHolder PatternFlowGtpv1NextExtensionHeaderTypeCounter - decrementHolder PatternFlowGtpv1NextExtensionHeaderTypeCounter - metricTagsHolder PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter -} - -func NewPatternFlowGtpv1NextExtensionHeaderType() PatternFlowGtpv1NextExtensionHeaderType { - obj := patternFlowGtpv1NextExtensionHeaderType{obj: &otg.PatternFlowGtpv1NextExtensionHeaderType{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1NextExtensionHeaderType) msg() *otg.PatternFlowGtpv1NextExtensionHeaderType { - return obj.obj -} - -func (obj *patternFlowGtpv1NextExtensionHeaderType) setMsg(msg *otg.PatternFlowGtpv1NextExtensionHeaderType) PatternFlowGtpv1NextExtensionHeaderType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1NextExtensionHeaderType struct { - obj *patternFlowGtpv1NextExtensionHeaderType -} - -type marshalPatternFlowGtpv1NextExtensionHeaderType interface { - // ToProto marshals PatternFlowGtpv1NextExtensionHeaderType to protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderType - ToProto() (*otg.PatternFlowGtpv1NextExtensionHeaderType, error) - // ToPbText marshals PatternFlowGtpv1NextExtensionHeaderType to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1NextExtensionHeaderType to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1NextExtensionHeaderType to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1NextExtensionHeaderType struct { - obj *patternFlowGtpv1NextExtensionHeaderType -} - -type unMarshalPatternFlowGtpv1NextExtensionHeaderType interface { - // FromProto unmarshals PatternFlowGtpv1NextExtensionHeaderType from protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderType - FromProto(msg *otg.PatternFlowGtpv1NextExtensionHeaderType) (PatternFlowGtpv1NextExtensionHeaderType, error) - // FromPbText unmarshals PatternFlowGtpv1NextExtensionHeaderType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1NextExtensionHeaderType from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1NextExtensionHeaderType from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1NextExtensionHeaderType) Marshal() marshalPatternFlowGtpv1NextExtensionHeaderType { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1NextExtensionHeaderType{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1NextExtensionHeaderType) Unmarshal() unMarshalPatternFlowGtpv1NextExtensionHeaderType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1NextExtensionHeaderType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1NextExtensionHeaderType) ToProto() (*otg.PatternFlowGtpv1NextExtensionHeaderType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1NextExtensionHeaderType) FromProto(msg *otg.PatternFlowGtpv1NextExtensionHeaderType) (PatternFlowGtpv1NextExtensionHeaderType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1NextExtensionHeaderType) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv1NextExtensionHeaderType) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv1NextExtensionHeaderType) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv1NextExtensionHeaderType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1NextExtensionHeaderType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1NextExtensionHeaderType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1NextExtensionHeaderType) Clone() (PatternFlowGtpv1NextExtensionHeaderType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1NextExtensionHeaderType() - 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 -} - -func (obj *patternFlowGtpv1NextExtensionHeaderType) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv1NextExtensionHeaderType is next extension header. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the e_flag bit is on. -type PatternFlowGtpv1NextExtensionHeaderType interface { - Validation - // msg marshals PatternFlowGtpv1NextExtensionHeaderType to protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderType - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1NextExtensionHeaderType - // setMsg unmarshals PatternFlowGtpv1NextExtensionHeaderType from protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderType - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1NextExtensionHeaderType) PatternFlowGtpv1NextExtensionHeaderType - // provides marshal interface - Marshal() marshalPatternFlowGtpv1NextExtensionHeaderType - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1NextExtensionHeaderType - // validate validates PatternFlowGtpv1NextExtensionHeaderType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1NextExtensionHeaderType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum, set in PatternFlowGtpv1NextExtensionHeaderType - Choice() PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum - // setChoice assigns PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum provided by user to PatternFlowGtpv1NextExtensionHeaderType - setChoice(value PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum) PatternFlowGtpv1NextExtensionHeaderType - // HasChoice checks if Choice has been set in PatternFlowGtpv1NextExtensionHeaderType - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv1NextExtensionHeaderType. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv1NextExtensionHeaderType - SetValue(value uint32) PatternFlowGtpv1NextExtensionHeaderType - // HasValue checks if Value has been set in PatternFlowGtpv1NextExtensionHeaderType - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv1NextExtensionHeaderType. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv1NextExtensionHeaderType - SetValues(value []uint32) PatternFlowGtpv1NextExtensionHeaderType - // Increment returns PatternFlowGtpv1NextExtensionHeaderTypeCounter, set in PatternFlowGtpv1NextExtensionHeaderType. - // PatternFlowGtpv1NextExtensionHeaderTypeCounter is integer counter pattern - Increment() PatternFlowGtpv1NextExtensionHeaderTypeCounter - // SetIncrement assigns PatternFlowGtpv1NextExtensionHeaderTypeCounter provided by user to PatternFlowGtpv1NextExtensionHeaderType. - // PatternFlowGtpv1NextExtensionHeaderTypeCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv1NextExtensionHeaderTypeCounter) PatternFlowGtpv1NextExtensionHeaderType - // HasIncrement checks if Increment has been set in PatternFlowGtpv1NextExtensionHeaderType - HasIncrement() bool - // Decrement returns PatternFlowGtpv1NextExtensionHeaderTypeCounter, set in PatternFlowGtpv1NextExtensionHeaderType. - // PatternFlowGtpv1NextExtensionHeaderTypeCounter is integer counter pattern - Decrement() PatternFlowGtpv1NextExtensionHeaderTypeCounter - // SetDecrement assigns PatternFlowGtpv1NextExtensionHeaderTypeCounter provided by user to PatternFlowGtpv1NextExtensionHeaderType. - // PatternFlowGtpv1NextExtensionHeaderTypeCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv1NextExtensionHeaderTypeCounter) PatternFlowGtpv1NextExtensionHeaderType - // HasDecrement checks if Decrement has been set in PatternFlowGtpv1NextExtensionHeaderType - HasDecrement() bool - // MetricTags returns PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIterIter, set in PatternFlowGtpv1NextExtensionHeaderType - MetricTags() PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter - setNil() -} - -type PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum string - -// Enum of Choice on PatternFlowGtpv1NextExtensionHeaderType -var PatternFlowGtpv1NextExtensionHeaderTypeChoice = struct { - VALUE PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum - VALUES PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum - INCREMENT PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum - DECREMENT PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum -}{ - VALUE: PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum("value"), - VALUES: PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum("values"), - INCREMENT: PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv1NextExtensionHeaderType) Choice() PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum { - return PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv1NextExtensionHeaderType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv1NextExtensionHeaderType) setChoice(value PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum) PatternFlowGtpv1NextExtensionHeaderType { - intValue, ok := otg.PatternFlowGtpv1NextExtensionHeaderType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv1NextExtensionHeaderType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv1NextExtensionHeaderTypeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv1NextExtensionHeaderTypeCounter().msg() - } - - if value == PatternFlowGtpv1NextExtensionHeaderTypeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv1NextExtensionHeaderTypeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1NextExtensionHeaderType) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv1NextExtensionHeaderType) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv1NextExtensionHeaderType object -func (obj *patternFlowGtpv1NextExtensionHeaderType) SetValue(value uint32) PatternFlowGtpv1NextExtensionHeaderType { - obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv1NextExtensionHeaderType) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv1NextExtensionHeaderType object -func (obj *patternFlowGtpv1NextExtensionHeaderType) SetValues(value []uint32) PatternFlowGtpv1NextExtensionHeaderType { - obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv1NextExtensionHeaderTypeCounter -func (obj *patternFlowGtpv1NextExtensionHeaderType) Increment() PatternFlowGtpv1NextExtensionHeaderTypeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv1NextExtensionHeaderTypeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv1NextExtensionHeaderTypeCounter -func (obj *patternFlowGtpv1NextExtensionHeaderType) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv1NextExtensionHeaderTypeCounter value in the PatternFlowGtpv1NextExtensionHeaderType object -func (obj *patternFlowGtpv1NextExtensionHeaderType) SetIncrement(value PatternFlowGtpv1NextExtensionHeaderTypeCounter) PatternFlowGtpv1NextExtensionHeaderType { - obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1NextExtensionHeaderTypeCounter -func (obj *patternFlowGtpv1NextExtensionHeaderType) Decrement() PatternFlowGtpv1NextExtensionHeaderTypeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv1NextExtensionHeaderTypeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv1NextExtensionHeaderTypeCounter -func (obj *patternFlowGtpv1NextExtensionHeaderType) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv1NextExtensionHeaderTypeCounter value in the PatternFlowGtpv1NextExtensionHeaderType object -func (obj *patternFlowGtpv1NextExtensionHeaderType) SetDecrement(value PatternFlowGtpv1NextExtensionHeaderTypeCounter) PatternFlowGtpv1NextExtensionHeaderType { - obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv1NextExtensionHeaderTypeMetricTag -func (obj *patternFlowGtpv1NextExtensionHeaderType) MetricTags() PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter struct { - obj *patternFlowGtpv1NextExtensionHeaderType - patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice []PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - fieldPtr *[]*otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag -} - -func newPatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter(ptr *[]*otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { - return &patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter interface { - setMsg(*patternFlowGtpv1NextExtensionHeaderType) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter - Items() []PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - Add() PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - Append(items ...PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter - Set(index int, newObj PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter - Clear() PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter - clearHolderSlice() PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter - appendHolderSlice(item PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) setMsg(msg *patternFlowGtpv1NextExtensionHeaderType) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv1NextExtensionHeaderTypeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) Items() []PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { - return obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) Add() PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { - newObj := &otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv1NextExtensionHeaderTypeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice = append(obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) Append(items ...PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice = append(obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) Set(index int, newObj PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) Clear() PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag{} - obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice = []PatternFlowGtpv1NextExtensionHeaderTypeMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) clearHolderSlice() PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { - if len(obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice) > 0 { - obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice = []PatternFlowGtpv1NextExtensionHeaderTypeMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) appendHolderSlice(item PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { - obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice = append(obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv1NextExtensionHeaderType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1NextExtensionHeaderType.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv1NextExtensionHeaderType.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv1NextExtensionHeaderTypeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv1NextExtensionHeaderType) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv1NextExtensionHeaderTypeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv1NextExtensionHeaderTypeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1NextExtensionHeaderType") - } - } else { - intVal := otg.PatternFlowGtpv1NextExtensionHeaderType_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv1NextExtensionHeaderType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowGtpExtension ***** -type flowGtpExtension struct { - validation - obj *otg.FlowGtpExtension - marshaller marshalFlowGtpExtension - unMarshaller unMarshalFlowGtpExtension - extensionLengthHolder PatternFlowGtpExtensionExtensionLength - contentsHolder PatternFlowGtpExtensionContents - nextExtensionHeaderHolder PatternFlowGtpExtensionNextExtensionHeader -} - -func NewFlowGtpExtension() FlowGtpExtension { - obj := flowGtpExtension{obj: &otg.FlowGtpExtension{}} - obj.setDefault() - return &obj -} - -func (obj *flowGtpExtension) msg() *otg.FlowGtpExtension { - return obj.obj -} - -func (obj *flowGtpExtension) setMsg(msg *otg.FlowGtpExtension) FlowGtpExtension { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowGtpExtension struct { - obj *flowGtpExtension -} - -type marshalFlowGtpExtension interface { - // ToProto marshals FlowGtpExtension to protobuf object *otg.FlowGtpExtension - ToProto() (*otg.FlowGtpExtension, error) - // ToPbText marshals FlowGtpExtension to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowGtpExtension to YAML text - ToYaml() (string, error) - // ToJson marshals FlowGtpExtension to JSON text - ToJson() (string, error) -} - -type unMarshalflowGtpExtension struct { - obj *flowGtpExtension -} - -type unMarshalFlowGtpExtension interface { - // FromProto unmarshals FlowGtpExtension from protobuf object *otg.FlowGtpExtension - FromProto(msg *otg.FlowGtpExtension) (FlowGtpExtension, error) - // FromPbText unmarshals FlowGtpExtension from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowGtpExtension from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowGtpExtension from JSON text - FromJson(value string) error -} - -func (obj *flowGtpExtension) Marshal() marshalFlowGtpExtension { - if obj.marshaller == nil { - obj.marshaller = &marshalflowGtpExtension{obj: obj} - } - return obj.marshaller -} - -func (obj *flowGtpExtension) Unmarshal() unMarshalFlowGtpExtension { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowGtpExtension{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowGtpExtension) ToProto() (*otg.FlowGtpExtension, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowGtpExtension) FromProto(msg *otg.FlowGtpExtension) (FlowGtpExtension, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowGtpExtension) 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 *unMarshalflowGtpExtension) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowGtpExtension) 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 *unMarshalflowGtpExtension) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowGtpExtension) 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 *unMarshalflowGtpExtension) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowGtpExtension) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowGtpExtension) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowGtpExtension) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowGtpExtension) Clone() (FlowGtpExtension, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowGtpExtension() - 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 -} - -func (obj *flowGtpExtension) setNil() { - obj.extensionLengthHolder = nil - obj.contentsHolder = nil - obj.nextExtensionHeaderHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowGtpExtension is description is TBD -type FlowGtpExtension interface { - Validation - // msg marshals FlowGtpExtension to protobuf object *otg.FlowGtpExtension - // and doesn't set defaults - msg() *otg.FlowGtpExtension - // setMsg unmarshals FlowGtpExtension from protobuf object *otg.FlowGtpExtension - // and doesn't set defaults - setMsg(*otg.FlowGtpExtension) FlowGtpExtension - // provides marshal interface - Marshal() marshalFlowGtpExtension - // provides unmarshal interface - Unmarshal() unMarshalFlowGtpExtension - // validate validates FlowGtpExtension - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowGtpExtension, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ExtensionLength returns PatternFlowGtpExtensionExtensionLength, set in FlowGtpExtension. - // PatternFlowGtpExtensionExtensionLength is this field states the length of this extension header, including the length, the contents, and the next extension header field, in 4-octet units, so the length of the extension must always be a multiple of 4. - ExtensionLength() PatternFlowGtpExtensionExtensionLength - // SetExtensionLength assigns PatternFlowGtpExtensionExtensionLength provided by user to FlowGtpExtension. - // PatternFlowGtpExtensionExtensionLength is this field states the length of this extension header, including the length, the contents, and the next extension header field, in 4-octet units, so the length of the extension must always be a multiple of 4. - SetExtensionLength(value PatternFlowGtpExtensionExtensionLength) FlowGtpExtension - // HasExtensionLength checks if ExtensionLength has been set in FlowGtpExtension - HasExtensionLength() bool - // Contents returns PatternFlowGtpExtensionContents, set in FlowGtpExtension. - // PatternFlowGtpExtensionContents is the extension header contents - Contents() PatternFlowGtpExtensionContents - // SetContents assigns PatternFlowGtpExtensionContents provided by user to FlowGtpExtension. - // PatternFlowGtpExtensionContents is the extension header contents - SetContents(value PatternFlowGtpExtensionContents) FlowGtpExtension - // HasContents checks if Contents has been set in FlowGtpExtension - HasContents() bool - // NextExtensionHeader returns PatternFlowGtpExtensionNextExtensionHeader, set in FlowGtpExtension. - // PatternFlowGtpExtensionNextExtensionHeader is it states the type of the next extension, or 0 if no next extension exists. This permits chaining several next extension headers. - NextExtensionHeader() PatternFlowGtpExtensionNextExtensionHeader - // SetNextExtensionHeader assigns PatternFlowGtpExtensionNextExtensionHeader provided by user to FlowGtpExtension. - // PatternFlowGtpExtensionNextExtensionHeader is it states the type of the next extension, or 0 if no next extension exists. This permits chaining several next extension headers. - SetNextExtensionHeader(value PatternFlowGtpExtensionNextExtensionHeader) FlowGtpExtension - // HasNextExtensionHeader checks if NextExtensionHeader has been set in FlowGtpExtension - HasNextExtensionHeader() bool - setNil() -} - -// description is TBD -// ExtensionLength returns a PatternFlowGtpExtensionExtensionLength -func (obj *flowGtpExtension) ExtensionLength() PatternFlowGtpExtensionExtensionLength { - if obj.obj.ExtensionLength == nil { - obj.obj.ExtensionLength = NewPatternFlowGtpExtensionExtensionLength().msg() - } - if obj.extensionLengthHolder == nil { - obj.extensionLengthHolder = &patternFlowGtpExtensionExtensionLength{obj: obj.obj.ExtensionLength} - } - return obj.extensionLengthHolder -} - -// description is TBD -// ExtensionLength returns a PatternFlowGtpExtensionExtensionLength -func (obj *flowGtpExtension) HasExtensionLength() bool { - return obj.obj.ExtensionLength != nil -} - -// description is TBD -// SetExtensionLength sets the PatternFlowGtpExtensionExtensionLength value in the FlowGtpExtension object -func (obj *flowGtpExtension) SetExtensionLength(value PatternFlowGtpExtensionExtensionLength) FlowGtpExtension { - - obj.extensionLengthHolder = nil - obj.obj.ExtensionLength = value.msg() - - return obj -} - -// description is TBD -// Contents returns a PatternFlowGtpExtensionContents -func (obj *flowGtpExtension) Contents() PatternFlowGtpExtensionContents { - if obj.obj.Contents == nil { - obj.obj.Contents = NewPatternFlowGtpExtensionContents().msg() - } - if obj.contentsHolder == nil { - obj.contentsHolder = &patternFlowGtpExtensionContents{obj: obj.obj.Contents} - } - return obj.contentsHolder -} - -// description is TBD -// Contents returns a PatternFlowGtpExtensionContents -func (obj *flowGtpExtension) HasContents() bool { - return obj.obj.Contents != nil -} - -// description is TBD -// SetContents sets the PatternFlowGtpExtensionContents value in the FlowGtpExtension object -func (obj *flowGtpExtension) SetContents(value PatternFlowGtpExtensionContents) FlowGtpExtension { - - obj.contentsHolder = nil - obj.obj.Contents = value.msg() - - return obj -} - -// description is TBD -// NextExtensionHeader returns a PatternFlowGtpExtensionNextExtensionHeader -func (obj *flowGtpExtension) NextExtensionHeader() PatternFlowGtpExtensionNextExtensionHeader { - if obj.obj.NextExtensionHeader == nil { - obj.obj.NextExtensionHeader = NewPatternFlowGtpExtensionNextExtensionHeader().msg() - } - if obj.nextExtensionHeaderHolder == nil { - obj.nextExtensionHeaderHolder = &patternFlowGtpExtensionNextExtensionHeader{obj: obj.obj.NextExtensionHeader} - } - return obj.nextExtensionHeaderHolder -} - -// description is TBD -// NextExtensionHeader returns a PatternFlowGtpExtensionNextExtensionHeader -func (obj *flowGtpExtension) HasNextExtensionHeader() bool { - return obj.obj.NextExtensionHeader != nil -} - -// description is TBD -// SetNextExtensionHeader sets the PatternFlowGtpExtensionNextExtensionHeader value in the FlowGtpExtension object -func (obj *flowGtpExtension) SetNextExtensionHeader(value PatternFlowGtpExtensionNextExtensionHeader) FlowGtpExtension { - - obj.nextExtensionHeaderHolder = nil - obj.obj.NextExtensionHeader = value.msg() - - return obj -} - -func (obj *flowGtpExtension) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.ExtensionLength != nil { - - obj.ExtensionLength().validateObj(vObj, set_default) - } - - if obj.obj.Contents != nil { - - obj.Contents().validateObj(vObj, set_default) - } - - if obj.obj.NextExtensionHeader != nil { - - obj.NextExtensionHeader().validateObj(vObj, set_default) - } - -} - -func (obj *flowGtpExtension) setDefault() { - -} - -// ***** PatternFlowGtpv2Version ***** -type patternFlowGtpv2Version struct { - validation - obj *otg.PatternFlowGtpv2Version - marshaller marshalPatternFlowGtpv2Version - unMarshaller unMarshalPatternFlowGtpv2Version - incrementHolder PatternFlowGtpv2VersionCounter - decrementHolder PatternFlowGtpv2VersionCounter - metricTagsHolder PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter -} - -func NewPatternFlowGtpv2Version() PatternFlowGtpv2Version { - obj := patternFlowGtpv2Version{obj: &otg.PatternFlowGtpv2Version{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2Version) msg() *otg.PatternFlowGtpv2Version { - return obj.obj -} - -func (obj *patternFlowGtpv2Version) setMsg(msg *otg.PatternFlowGtpv2Version) PatternFlowGtpv2Version { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2Version struct { - obj *patternFlowGtpv2Version -} - -type marshalPatternFlowGtpv2Version interface { - // ToProto marshals PatternFlowGtpv2Version to protobuf object *otg.PatternFlowGtpv2Version - ToProto() (*otg.PatternFlowGtpv2Version, error) - // ToPbText marshals PatternFlowGtpv2Version to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2Version to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2Version to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2Version struct { - obj *patternFlowGtpv2Version -} - -type unMarshalPatternFlowGtpv2Version interface { - // FromProto unmarshals PatternFlowGtpv2Version from protobuf object *otg.PatternFlowGtpv2Version - FromProto(msg *otg.PatternFlowGtpv2Version) (PatternFlowGtpv2Version, error) - // FromPbText unmarshals PatternFlowGtpv2Version from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2Version from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2Version from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2Version) Marshal() marshalPatternFlowGtpv2Version { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2Version{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2Version) Unmarshal() unMarshalPatternFlowGtpv2Version { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2Version{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2Version) ToProto() (*otg.PatternFlowGtpv2Version, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2Version) FromProto(msg *otg.PatternFlowGtpv2Version) (PatternFlowGtpv2Version, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2Version) 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 *unMarshalpatternFlowGtpv2Version) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv2Version) 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 *unMarshalpatternFlowGtpv2Version) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv2Version) 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 *unMarshalpatternFlowGtpv2Version) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv2Version) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Version) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Version) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2Version) Clone() (PatternFlowGtpv2Version, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2Version() - 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 -} - -func (obj *patternFlowGtpv2Version) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv2Version is version number -type PatternFlowGtpv2Version interface { - Validation - // msg marshals PatternFlowGtpv2Version to protobuf object *otg.PatternFlowGtpv2Version - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2Version - // setMsg unmarshals PatternFlowGtpv2Version from protobuf object *otg.PatternFlowGtpv2Version - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2Version) PatternFlowGtpv2Version - // provides marshal interface - Marshal() marshalPatternFlowGtpv2Version - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2Version - // validate validates PatternFlowGtpv2Version - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2Version, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv2VersionChoiceEnum, set in PatternFlowGtpv2Version - Choice() PatternFlowGtpv2VersionChoiceEnum - // setChoice assigns PatternFlowGtpv2VersionChoiceEnum provided by user to PatternFlowGtpv2Version - setChoice(value PatternFlowGtpv2VersionChoiceEnum) PatternFlowGtpv2Version - // HasChoice checks if Choice has been set in PatternFlowGtpv2Version - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv2Version. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv2Version - SetValue(value uint32) PatternFlowGtpv2Version - // HasValue checks if Value has been set in PatternFlowGtpv2Version - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv2Version. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv2Version - SetValues(value []uint32) PatternFlowGtpv2Version - // Increment returns PatternFlowGtpv2VersionCounter, set in PatternFlowGtpv2Version. - // PatternFlowGtpv2VersionCounter is integer counter pattern - Increment() PatternFlowGtpv2VersionCounter - // SetIncrement assigns PatternFlowGtpv2VersionCounter provided by user to PatternFlowGtpv2Version. - // PatternFlowGtpv2VersionCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv2VersionCounter) PatternFlowGtpv2Version - // HasIncrement checks if Increment has been set in PatternFlowGtpv2Version - HasIncrement() bool - // Decrement returns PatternFlowGtpv2VersionCounter, set in PatternFlowGtpv2Version. - // PatternFlowGtpv2VersionCounter is integer counter pattern - Decrement() PatternFlowGtpv2VersionCounter - // SetDecrement assigns PatternFlowGtpv2VersionCounter provided by user to PatternFlowGtpv2Version. - // PatternFlowGtpv2VersionCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv2VersionCounter) PatternFlowGtpv2Version - // HasDecrement checks if Decrement has been set in PatternFlowGtpv2Version - HasDecrement() bool - // MetricTags returns PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIterIter, set in PatternFlowGtpv2Version - MetricTags() PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter - setNil() -} - -type PatternFlowGtpv2VersionChoiceEnum string - -// Enum of Choice on PatternFlowGtpv2Version -var PatternFlowGtpv2VersionChoice = struct { - VALUE PatternFlowGtpv2VersionChoiceEnum - VALUES PatternFlowGtpv2VersionChoiceEnum - INCREMENT PatternFlowGtpv2VersionChoiceEnum - DECREMENT PatternFlowGtpv2VersionChoiceEnum -}{ - VALUE: PatternFlowGtpv2VersionChoiceEnum("value"), - VALUES: PatternFlowGtpv2VersionChoiceEnum("values"), - INCREMENT: PatternFlowGtpv2VersionChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv2VersionChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv2Version) Choice() PatternFlowGtpv2VersionChoiceEnum { - return PatternFlowGtpv2VersionChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv2Version) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv2Version) setChoice(value PatternFlowGtpv2VersionChoiceEnum) PatternFlowGtpv2Version { - intValue, ok := otg.PatternFlowGtpv2Version_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv2VersionChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv2Version_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv2VersionChoice.VALUE { - defaultValue := uint32(2) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv2VersionChoice.VALUES { - defaultValue := []uint32{2} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv2VersionChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv2VersionCounter().msg() - } - - if value == PatternFlowGtpv2VersionChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv2VersionCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2Version) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv2VersionChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2Version) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv2Version object -func (obj *patternFlowGtpv2Version) SetValue(value uint32) PatternFlowGtpv2Version { - obj.setChoice(PatternFlowGtpv2VersionChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv2Version) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{2}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv2Version object -func (obj *patternFlowGtpv2Version) SetValues(value []uint32) PatternFlowGtpv2Version { - obj.setChoice(PatternFlowGtpv2VersionChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv2VersionCounter -func (obj *patternFlowGtpv2Version) Increment() PatternFlowGtpv2VersionCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv2VersionChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv2VersionCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv2VersionCounter -func (obj *patternFlowGtpv2Version) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv2VersionCounter value in the PatternFlowGtpv2Version object -func (obj *patternFlowGtpv2Version) SetIncrement(value PatternFlowGtpv2VersionCounter) PatternFlowGtpv2Version { - obj.setChoice(PatternFlowGtpv2VersionChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2VersionCounter -func (obj *patternFlowGtpv2Version) Decrement() PatternFlowGtpv2VersionCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv2VersionChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv2VersionCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2VersionCounter -func (obj *patternFlowGtpv2Version) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv2VersionCounter value in the PatternFlowGtpv2Version object -func (obj *patternFlowGtpv2Version) SetDecrement(value PatternFlowGtpv2VersionCounter) PatternFlowGtpv2Version { - obj.setChoice(PatternFlowGtpv2VersionChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv2VersionMetricTag -func (obj *patternFlowGtpv2Version) MetricTags() PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv2VersionMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter struct { - obj *patternFlowGtpv2Version - patternFlowGtpv2VersionMetricTagSlice []PatternFlowGtpv2VersionMetricTag - fieldPtr *[]*otg.PatternFlowGtpv2VersionMetricTag -} - -func newPatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter(ptr *[]*otg.PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { - return &patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter interface { - setMsg(*patternFlowGtpv2Version) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter - Items() []PatternFlowGtpv2VersionMetricTag - Add() PatternFlowGtpv2VersionMetricTag - Append(items ...PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter - Set(index int, newObj PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter - Clear() PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter - clearHolderSlice() PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter - appendHolderSlice(item PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter -} - -func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) setMsg(msg *patternFlowGtpv2Version) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv2VersionMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) Items() []PatternFlowGtpv2VersionMetricTag { - return obj.patternFlowGtpv2VersionMetricTagSlice -} - -func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) Add() PatternFlowGtpv2VersionMetricTag { - newObj := &otg.PatternFlowGtpv2VersionMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv2VersionMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv2VersionMetricTagSlice = append(obj.patternFlowGtpv2VersionMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) Append(items ...PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv2VersionMetricTagSlice = append(obj.patternFlowGtpv2VersionMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) Set(index int, newObj PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv2VersionMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) Clear() PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv2VersionMetricTag{} - obj.patternFlowGtpv2VersionMetricTagSlice = []PatternFlowGtpv2VersionMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) clearHolderSlice() PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { - if len(obj.patternFlowGtpv2VersionMetricTagSlice) > 0 { - obj.patternFlowGtpv2VersionMetricTagSlice = []PatternFlowGtpv2VersionMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) appendHolderSlice(item PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { - obj.patternFlowGtpv2VersionMetricTagSlice = append(obj.patternFlowGtpv2VersionMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv2Version) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2Version.Value <= 7 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv2Version.Values <= 7 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv2VersionMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv2Version) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv2VersionChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv2VersionChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv2VersionChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv2VersionChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv2VersionChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv2VersionChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2Version") - } - } else { - intVal := otg.PatternFlowGtpv2Version_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv2Version_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv2PiggybackingFlag ***** -type patternFlowGtpv2PiggybackingFlag struct { - validation - obj *otg.PatternFlowGtpv2PiggybackingFlag - marshaller marshalPatternFlowGtpv2PiggybackingFlag - unMarshaller unMarshalPatternFlowGtpv2PiggybackingFlag - incrementHolder PatternFlowGtpv2PiggybackingFlagCounter - decrementHolder PatternFlowGtpv2PiggybackingFlagCounter - metricTagsHolder PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter -} - -func NewPatternFlowGtpv2PiggybackingFlag() PatternFlowGtpv2PiggybackingFlag { - obj := patternFlowGtpv2PiggybackingFlag{obj: &otg.PatternFlowGtpv2PiggybackingFlag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2PiggybackingFlag) msg() *otg.PatternFlowGtpv2PiggybackingFlag { - return obj.obj -} - -func (obj *patternFlowGtpv2PiggybackingFlag) setMsg(msg *otg.PatternFlowGtpv2PiggybackingFlag) PatternFlowGtpv2PiggybackingFlag { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2PiggybackingFlag struct { - obj *patternFlowGtpv2PiggybackingFlag -} - -type marshalPatternFlowGtpv2PiggybackingFlag interface { - // ToProto marshals PatternFlowGtpv2PiggybackingFlag to protobuf object *otg.PatternFlowGtpv2PiggybackingFlag - ToProto() (*otg.PatternFlowGtpv2PiggybackingFlag, error) - // ToPbText marshals PatternFlowGtpv2PiggybackingFlag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2PiggybackingFlag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2PiggybackingFlag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2PiggybackingFlag struct { - obj *patternFlowGtpv2PiggybackingFlag -} - -type unMarshalPatternFlowGtpv2PiggybackingFlag interface { - // FromProto unmarshals PatternFlowGtpv2PiggybackingFlag from protobuf object *otg.PatternFlowGtpv2PiggybackingFlag - FromProto(msg *otg.PatternFlowGtpv2PiggybackingFlag) (PatternFlowGtpv2PiggybackingFlag, error) - // FromPbText unmarshals PatternFlowGtpv2PiggybackingFlag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2PiggybackingFlag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2PiggybackingFlag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2PiggybackingFlag) Marshal() marshalPatternFlowGtpv2PiggybackingFlag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2PiggybackingFlag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2PiggybackingFlag) Unmarshal() unMarshalPatternFlowGtpv2PiggybackingFlag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2PiggybackingFlag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2PiggybackingFlag) ToProto() (*otg.PatternFlowGtpv2PiggybackingFlag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2PiggybackingFlag) FromProto(msg *otg.PatternFlowGtpv2PiggybackingFlag) (PatternFlowGtpv2PiggybackingFlag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2PiggybackingFlag) 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 *unMarshalpatternFlowGtpv2PiggybackingFlag) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv2PiggybackingFlag) 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 *unMarshalpatternFlowGtpv2PiggybackingFlag) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv2PiggybackingFlag) 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 *unMarshalpatternFlowGtpv2PiggybackingFlag) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv2PiggybackingFlag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2PiggybackingFlag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2PiggybackingFlag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2PiggybackingFlag) Clone() (PatternFlowGtpv2PiggybackingFlag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2PiggybackingFlag() - 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 -} - -func (obj *patternFlowGtpv2PiggybackingFlag) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv2PiggybackingFlag is if piggybacking_flag is set to 1 then another GTP-C message with its own header shall be present at the end of the current message -type PatternFlowGtpv2PiggybackingFlag interface { - Validation - // msg marshals PatternFlowGtpv2PiggybackingFlag to protobuf object *otg.PatternFlowGtpv2PiggybackingFlag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2PiggybackingFlag - // setMsg unmarshals PatternFlowGtpv2PiggybackingFlag from protobuf object *otg.PatternFlowGtpv2PiggybackingFlag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2PiggybackingFlag) PatternFlowGtpv2PiggybackingFlag - // provides marshal interface - Marshal() marshalPatternFlowGtpv2PiggybackingFlag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2PiggybackingFlag - // validate validates PatternFlowGtpv2PiggybackingFlag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2PiggybackingFlag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv2PiggybackingFlagChoiceEnum, set in PatternFlowGtpv2PiggybackingFlag - Choice() PatternFlowGtpv2PiggybackingFlagChoiceEnum - // setChoice assigns PatternFlowGtpv2PiggybackingFlagChoiceEnum provided by user to PatternFlowGtpv2PiggybackingFlag - setChoice(value PatternFlowGtpv2PiggybackingFlagChoiceEnum) PatternFlowGtpv2PiggybackingFlag - // HasChoice checks if Choice has been set in PatternFlowGtpv2PiggybackingFlag - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv2PiggybackingFlag. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv2PiggybackingFlag - SetValue(value uint32) PatternFlowGtpv2PiggybackingFlag - // HasValue checks if Value has been set in PatternFlowGtpv2PiggybackingFlag - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv2PiggybackingFlag. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv2PiggybackingFlag - SetValues(value []uint32) PatternFlowGtpv2PiggybackingFlag - // Increment returns PatternFlowGtpv2PiggybackingFlagCounter, set in PatternFlowGtpv2PiggybackingFlag. - // PatternFlowGtpv2PiggybackingFlagCounter is integer counter pattern - Increment() PatternFlowGtpv2PiggybackingFlagCounter - // SetIncrement assigns PatternFlowGtpv2PiggybackingFlagCounter provided by user to PatternFlowGtpv2PiggybackingFlag. - // PatternFlowGtpv2PiggybackingFlagCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv2PiggybackingFlagCounter) PatternFlowGtpv2PiggybackingFlag - // HasIncrement checks if Increment has been set in PatternFlowGtpv2PiggybackingFlag - HasIncrement() bool - // Decrement returns PatternFlowGtpv2PiggybackingFlagCounter, set in PatternFlowGtpv2PiggybackingFlag. - // PatternFlowGtpv2PiggybackingFlagCounter is integer counter pattern - Decrement() PatternFlowGtpv2PiggybackingFlagCounter - // SetDecrement assigns PatternFlowGtpv2PiggybackingFlagCounter provided by user to PatternFlowGtpv2PiggybackingFlag. - // PatternFlowGtpv2PiggybackingFlagCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv2PiggybackingFlagCounter) PatternFlowGtpv2PiggybackingFlag - // HasDecrement checks if Decrement has been set in PatternFlowGtpv2PiggybackingFlag - HasDecrement() bool - // MetricTags returns PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIterIter, set in PatternFlowGtpv2PiggybackingFlag - MetricTags() PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter - setNil() -} - -type PatternFlowGtpv2PiggybackingFlagChoiceEnum string - -// Enum of Choice on PatternFlowGtpv2PiggybackingFlag -var PatternFlowGtpv2PiggybackingFlagChoice = struct { - VALUE PatternFlowGtpv2PiggybackingFlagChoiceEnum - VALUES PatternFlowGtpv2PiggybackingFlagChoiceEnum - INCREMENT PatternFlowGtpv2PiggybackingFlagChoiceEnum - DECREMENT PatternFlowGtpv2PiggybackingFlagChoiceEnum -}{ - VALUE: PatternFlowGtpv2PiggybackingFlagChoiceEnum("value"), - VALUES: PatternFlowGtpv2PiggybackingFlagChoiceEnum("values"), - INCREMENT: PatternFlowGtpv2PiggybackingFlagChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv2PiggybackingFlagChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv2PiggybackingFlag) Choice() PatternFlowGtpv2PiggybackingFlagChoiceEnum { - return PatternFlowGtpv2PiggybackingFlagChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv2PiggybackingFlag) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv2PiggybackingFlag) setChoice(value PatternFlowGtpv2PiggybackingFlagChoiceEnum) PatternFlowGtpv2PiggybackingFlag { - intValue, ok := otg.PatternFlowGtpv2PiggybackingFlag_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv2PiggybackingFlagChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv2PiggybackingFlag_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv2PiggybackingFlagChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv2PiggybackingFlagChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv2PiggybackingFlagChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv2PiggybackingFlagCounter().msg() - } - - if value == PatternFlowGtpv2PiggybackingFlagChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv2PiggybackingFlagCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2PiggybackingFlag) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2PiggybackingFlag) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv2PiggybackingFlag object -func (obj *patternFlowGtpv2PiggybackingFlag) SetValue(value uint32) PatternFlowGtpv2PiggybackingFlag { - obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv2PiggybackingFlag) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv2PiggybackingFlag object -func (obj *patternFlowGtpv2PiggybackingFlag) SetValues(value []uint32) PatternFlowGtpv2PiggybackingFlag { - obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv2PiggybackingFlagCounter -func (obj *patternFlowGtpv2PiggybackingFlag) Increment() PatternFlowGtpv2PiggybackingFlagCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv2PiggybackingFlagCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv2PiggybackingFlagCounter -func (obj *patternFlowGtpv2PiggybackingFlag) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv2PiggybackingFlagCounter value in the PatternFlowGtpv2PiggybackingFlag object -func (obj *patternFlowGtpv2PiggybackingFlag) SetIncrement(value PatternFlowGtpv2PiggybackingFlagCounter) PatternFlowGtpv2PiggybackingFlag { - obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2PiggybackingFlagCounter -func (obj *patternFlowGtpv2PiggybackingFlag) Decrement() PatternFlowGtpv2PiggybackingFlagCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv2PiggybackingFlagCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2PiggybackingFlagCounter -func (obj *patternFlowGtpv2PiggybackingFlag) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv2PiggybackingFlagCounter value in the PatternFlowGtpv2PiggybackingFlag object -func (obj *patternFlowGtpv2PiggybackingFlag) SetDecrement(value PatternFlowGtpv2PiggybackingFlagCounter) PatternFlowGtpv2PiggybackingFlag { - obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv2PiggybackingFlagMetricTag -func (obj *patternFlowGtpv2PiggybackingFlag) MetricTags() PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv2PiggybackingFlagMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter struct { - obj *patternFlowGtpv2PiggybackingFlag - patternFlowGtpv2PiggybackingFlagMetricTagSlice []PatternFlowGtpv2PiggybackingFlagMetricTag - fieldPtr *[]*otg.PatternFlowGtpv2PiggybackingFlagMetricTag -} - -func newPatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter(ptr *[]*otg.PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { - return &patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter interface { - setMsg(*patternFlowGtpv2PiggybackingFlag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter - Items() []PatternFlowGtpv2PiggybackingFlagMetricTag - Add() PatternFlowGtpv2PiggybackingFlagMetricTag - Append(items ...PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter - Set(index int, newObj PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter - Clear() PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter - clearHolderSlice() PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter - appendHolderSlice(item PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter -} - -func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) setMsg(msg *patternFlowGtpv2PiggybackingFlag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv2PiggybackingFlagMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) Items() []PatternFlowGtpv2PiggybackingFlagMetricTag { - return obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice -} - -func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) Add() PatternFlowGtpv2PiggybackingFlagMetricTag { - newObj := &otg.PatternFlowGtpv2PiggybackingFlagMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv2PiggybackingFlagMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice = append(obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) Append(items ...PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice = append(obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) Set(index int, newObj PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) Clear() PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv2PiggybackingFlagMetricTag{} - obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice = []PatternFlowGtpv2PiggybackingFlagMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) clearHolderSlice() PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { - if len(obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice) > 0 { - obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice = []PatternFlowGtpv2PiggybackingFlagMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) appendHolderSlice(item PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { - obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice = append(obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv2PiggybackingFlag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2PiggybackingFlag.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv2PiggybackingFlag.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv2PiggybackingFlagMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv2PiggybackingFlag) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv2PiggybackingFlagChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv2PiggybackingFlagChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv2PiggybackingFlagChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv2PiggybackingFlagChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv2PiggybackingFlagChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2PiggybackingFlag") - } - } else { - intVal := otg.PatternFlowGtpv2PiggybackingFlag_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv2PiggybackingFlag_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv2TeidFlag ***** -type patternFlowGtpv2TeidFlag struct { - validation - obj *otg.PatternFlowGtpv2TeidFlag - marshaller marshalPatternFlowGtpv2TeidFlag - unMarshaller unMarshalPatternFlowGtpv2TeidFlag - incrementHolder PatternFlowGtpv2TeidFlagCounter - decrementHolder PatternFlowGtpv2TeidFlagCounter - metricTagsHolder PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter -} - -func NewPatternFlowGtpv2TeidFlag() PatternFlowGtpv2TeidFlag { - obj := patternFlowGtpv2TeidFlag{obj: &otg.PatternFlowGtpv2TeidFlag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2TeidFlag) msg() *otg.PatternFlowGtpv2TeidFlag { - return obj.obj -} - -func (obj *patternFlowGtpv2TeidFlag) setMsg(msg *otg.PatternFlowGtpv2TeidFlag) PatternFlowGtpv2TeidFlag { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2TeidFlag struct { - obj *patternFlowGtpv2TeidFlag -} - -type marshalPatternFlowGtpv2TeidFlag interface { - // ToProto marshals PatternFlowGtpv2TeidFlag to protobuf object *otg.PatternFlowGtpv2TeidFlag - ToProto() (*otg.PatternFlowGtpv2TeidFlag, error) - // ToPbText marshals PatternFlowGtpv2TeidFlag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2TeidFlag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2TeidFlag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2TeidFlag struct { - obj *patternFlowGtpv2TeidFlag -} - -type unMarshalPatternFlowGtpv2TeidFlag interface { - // FromProto unmarshals PatternFlowGtpv2TeidFlag from protobuf object *otg.PatternFlowGtpv2TeidFlag - FromProto(msg *otg.PatternFlowGtpv2TeidFlag) (PatternFlowGtpv2TeidFlag, error) - // FromPbText unmarshals PatternFlowGtpv2TeidFlag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2TeidFlag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2TeidFlag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2TeidFlag) Marshal() marshalPatternFlowGtpv2TeidFlag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2TeidFlag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2TeidFlag) Unmarshal() unMarshalPatternFlowGtpv2TeidFlag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2TeidFlag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2TeidFlag) ToProto() (*otg.PatternFlowGtpv2TeidFlag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2TeidFlag) FromProto(msg *otg.PatternFlowGtpv2TeidFlag) (PatternFlowGtpv2TeidFlag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2TeidFlag) 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 *unMarshalpatternFlowGtpv2TeidFlag) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv2TeidFlag) 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 *unMarshalpatternFlowGtpv2TeidFlag) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv2TeidFlag) 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 *unMarshalpatternFlowGtpv2TeidFlag) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv2TeidFlag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2TeidFlag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2TeidFlag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2TeidFlag) Clone() (PatternFlowGtpv2TeidFlag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2TeidFlag() - 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 -} - -func (obj *patternFlowGtpv2TeidFlag) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv2TeidFlag is if teid_flag is set to 1 then the TEID field will be present between the message length and the sequence number. All messages except Echo and Echo reply require TEID to be present -type PatternFlowGtpv2TeidFlag interface { - Validation - // msg marshals PatternFlowGtpv2TeidFlag to protobuf object *otg.PatternFlowGtpv2TeidFlag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2TeidFlag - // setMsg unmarshals PatternFlowGtpv2TeidFlag from protobuf object *otg.PatternFlowGtpv2TeidFlag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2TeidFlag) PatternFlowGtpv2TeidFlag - // provides marshal interface - Marshal() marshalPatternFlowGtpv2TeidFlag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2TeidFlag - // validate validates PatternFlowGtpv2TeidFlag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2TeidFlag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv2TeidFlagChoiceEnum, set in PatternFlowGtpv2TeidFlag - Choice() PatternFlowGtpv2TeidFlagChoiceEnum - // setChoice assigns PatternFlowGtpv2TeidFlagChoiceEnum provided by user to PatternFlowGtpv2TeidFlag - setChoice(value PatternFlowGtpv2TeidFlagChoiceEnum) PatternFlowGtpv2TeidFlag - // HasChoice checks if Choice has been set in PatternFlowGtpv2TeidFlag - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv2TeidFlag. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv2TeidFlag - SetValue(value uint32) PatternFlowGtpv2TeidFlag - // HasValue checks if Value has been set in PatternFlowGtpv2TeidFlag - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv2TeidFlag. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv2TeidFlag - SetValues(value []uint32) PatternFlowGtpv2TeidFlag - // Increment returns PatternFlowGtpv2TeidFlagCounter, set in PatternFlowGtpv2TeidFlag. - // PatternFlowGtpv2TeidFlagCounter is integer counter pattern - Increment() PatternFlowGtpv2TeidFlagCounter - // SetIncrement assigns PatternFlowGtpv2TeidFlagCounter provided by user to PatternFlowGtpv2TeidFlag. - // PatternFlowGtpv2TeidFlagCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv2TeidFlagCounter) PatternFlowGtpv2TeidFlag - // HasIncrement checks if Increment has been set in PatternFlowGtpv2TeidFlag - HasIncrement() bool - // Decrement returns PatternFlowGtpv2TeidFlagCounter, set in PatternFlowGtpv2TeidFlag. - // PatternFlowGtpv2TeidFlagCounter is integer counter pattern - Decrement() PatternFlowGtpv2TeidFlagCounter - // SetDecrement assigns PatternFlowGtpv2TeidFlagCounter provided by user to PatternFlowGtpv2TeidFlag. - // PatternFlowGtpv2TeidFlagCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv2TeidFlagCounter) PatternFlowGtpv2TeidFlag - // HasDecrement checks if Decrement has been set in PatternFlowGtpv2TeidFlag - HasDecrement() bool - // MetricTags returns PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIterIter, set in PatternFlowGtpv2TeidFlag - MetricTags() PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter - setNil() -} - -type PatternFlowGtpv2TeidFlagChoiceEnum string - -// Enum of Choice on PatternFlowGtpv2TeidFlag -var PatternFlowGtpv2TeidFlagChoice = struct { - VALUE PatternFlowGtpv2TeidFlagChoiceEnum - VALUES PatternFlowGtpv2TeidFlagChoiceEnum - INCREMENT PatternFlowGtpv2TeidFlagChoiceEnum - DECREMENT PatternFlowGtpv2TeidFlagChoiceEnum -}{ - VALUE: PatternFlowGtpv2TeidFlagChoiceEnum("value"), - VALUES: PatternFlowGtpv2TeidFlagChoiceEnum("values"), - INCREMENT: PatternFlowGtpv2TeidFlagChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv2TeidFlagChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv2TeidFlag) Choice() PatternFlowGtpv2TeidFlagChoiceEnum { - return PatternFlowGtpv2TeidFlagChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv2TeidFlag) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv2TeidFlag) setChoice(value PatternFlowGtpv2TeidFlagChoiceEnum) PatternFlowGtpv2TeidFlag { - intValue, ok := otg.PatternFlowGtpv2TeidFlag_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv2TeidFlagChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv2TeidFlag_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv2TeidFlagChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv2TeidFlagChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv2TeidFlagChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv2TeidFlagCounter().msg() - } - - if value == PatternFlowGtpv2TeidFlagChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv2TeidFlagCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2TeidFlag) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv2TeidFlagChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2TeidFlag) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv2TeidFlag object -func (obj *patternFlowGtpv2TeidFlag) SetValue(value uint32) PatternFlowGtpv2TeidFlag { - obj.setChoice(PatternFlowGtpv2TeidFlagChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv2TeidFlag) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv2TeidFlag object -func (obj *patternFlowGtpv2TeidFlag) SetValues(value []uint32) PatternFlowGtpv2TeidFlag { - obj.setChoice(PatternFlowGtpv2TeidFlagChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv2TeidFlagCounter -func (obj *patternFlowGtpv2TeidFlag) Increment() PatternFlowGtpv2TeidFlagCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv2TeidFlagChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv2TeidFlagCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv2TeidFlagCounter -func (obj *patternFlowGtpv2TeidFlag) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv2TeidFlagCounter value in the PatternFlowGtpv2TeidFlag object -func (obj *patternFlowGtpv2TeidFlag) SetIncrement(value PatternFlowGtpv2TeidFlagCounter) PatternFlowGtpv2TeidFlag { - obj.setChoice(PatternFlowGtpv2TeidFlagChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2TeidFlagCounter -func (obj *patternFlowGtpv2TeidFlag) Decrement() PatternFlowGtpv2TeidFlagCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv2TeidFlagChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv2TeidFlagCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2TeidFlagCounter -func (obj *patternFlowGtpv2TeidFlag) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv2TeidFlagCounter value in the PatternFlowGtpv2TeidFlag object -func (obj *patternFlowGtpv2TeidFlag) SetDecrement(value PatternFlowGtpv2TeidFlagCounter) PatternFlowGtpv2TeidFlag { - obj.setChoice(PatternFlowGtpv2TeidFlagChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv2TeidFlagMetricTag -func (obj *patternFlowGtpv2TeidFlag) MetricTags() PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv2TeidFlagMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter struct { - obj *patternFlowGtpv2TeidFlag - patternFlowGtpv2TeidFlagMetricTagSlice []PatternFlowGtpv2TeidFlagMetricTag - fieldPtr *[]*otg.PatternFlowGtpv2TeidFlagMetricTag -} - -func newPatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter(ptr *[]*otg.PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { - return &patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter interface { - setMsg(*patternFlowGtpv2TeidFlag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter - Items() []PatternFlowGtpv2TeidFlagMetricTag - Add() PatternFlowGtpv2TeidFlagMetricTag - Append(items ...PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter - Set(index int, newObj PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter - Clear() PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter - clearHolderSlice() PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter - appendHolderSlice(item PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter -} - -func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) setMsg(msg *patternFlowGtpv2TeidFlag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv2TeidFlagMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) Items() []PatternFlowGtpv2TeidFlagMetricTag { - return obj.patternFlowGtpv2TeidFlagMetricTagSlice -} - -func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) Add() PatternFlowGtpv2TeidFlagMetricTag { - newObj := &otg.PatternFlowGtpv2TeidFlagMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv2TeidFlagMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv2TeidFlagMetricTagSlice = append(obj.patternFlowGtpv2TeidFlagMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) Append(items ...PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv2TeidFlagMetricTagSlice = append(obj.patternFlowGtpv2TeidFlagMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) Set(index int, newObj PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv2TeidFlagMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) Clear() PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv2TeidFlagMetricTag{} - obj.patternFlowGtpv2TeidFlagMetricTagSlice = []PatternFlowGtpv2TeidFlagMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) clearHolderSlice() PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { - if len(obj.patternFlowGtpv2TeidFlagMetricTagSlice) > 0 { - obj.patternFlowGtpv2TeidFlagMetricTagSlice = []PatternFlowGtpv2TeidFlagMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) appendHolderSlice(item PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { - obj.patternFlowGtpv2TeidFlagMetricTagSlice = append(obj.patternFlowGtpv2TeidFlagMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv2TeidFlag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2TeidFlag.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv2TeidFlag.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv2TeidFlagMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv2TeidFlag) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv2TeidFlagChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv2TeidFlagChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv2TeidFlagChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv2TeidFlagChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv2TeidFlagChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv2TeidFlagChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2TeidFlag") - } - } else { - intVal := otg.PatternFlowGtpv2TeidFlag_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv2TeidFlag_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv2Spare1 ***** -type patternFlowGtpv2Spare1 struct { - validation - obj *otg.PatternFlowGtpv2Spare1 - marshaller marshalPatternFlowGtpv2Spare1 - unMarshaller unMarshalPatternFlowGtpv2Spare1 - incrementHolder PatternFlowGtpv2Spare1Counter - decrementHolder PatternFlowGtpv2Spare1Counter - metricTagsHolder PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter -} - -func NewPatternFlowGtpv2Spare1() PatternFlowGtpv2Spare1 { - obj := patternFlowGtpv2Spare1{obj: &otg.PatternFlowGtpv2Spare1{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2Spare1) msg() *otg.PatternFlowGtpv2Spare1 { - return obj.obj -} - -func (obj *patternFlowGtpv2Spare1) setMsg(msg *otg.PatternFlowGtpv2Spare1) PatternFlowGtpv2Spare1 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2Spare1 struct { - obj *patternFlowGtpv2Spare1 -} - -type marshalPatternFlowGtpv2Spare1 interface { - // ToProto marshals PatternFlowGtpv2Spare1 to protobuf object *otg.PatternFlowGtpv2Spare1 - ToProto() (*otg.PatternFlowGtpv2Spare1, error) - // ToPbText marshals PatternFlowGtpv2Spare1 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2Spare1 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2Spare1 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2Spare1 struct { - obj *patternFlowGtpv2Spare1 -} - -type unMarshalPatternFlowGtpv2Spare1 interface { - // FromProto unmarshals PatternFlowGtpv2Spare1 from protobuf object *otg.PatternFlowGtpv2Spare1 - FromProto(msg *otg.PatternFlowGtpv2Spare1) (PatternFlowGtpv2Spare1, error) - // FromPbText unmarshals PatternFlowGtpv2Spare1 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2Spare1 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2Spare1 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2Spare1) Marshal() marshalPatternFlowGtpv2Spare1 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2Spare1{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2Spare1) Unmarshal() unMarshalPatternFlowGtpv2Spare1 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2Spare1{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2Spare1) ToProto() (*otg.PatternFlowGtpv2Spare1, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2Spare1) FromProto(msg *otg.PatternFlowGtpv2Spare1) (PatternFlowGtpv2Spare1, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2Spare1) 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 *unMarshalpatternFlowGtpv2Spare1) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv2Spare1) 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 *unMarshalpatternFlowGtpv2Spare1) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv2Spare1) 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 *unMarshalpatternFlowGtpv2Spare1) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv2Spare1) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Spare1) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Spare1) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2Spare1) Clone() (PatternFlowGtpv2Spare1, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2Spare1() - 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 -} - -func (obj *patternFlowGtpv2Spare1) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv2Spare1 is a 3-bit reserved field (must be 0). -type PatternFlowGtpv2Spare1 interface { - Validation - // msg marshals PatternFlowGtpv2Spare1 to protobuf object *otg.PatternFlowGtpv2Spare1 - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2Spare1 - // setMsg unmarshals PatternFlowGtpv2Spare1 from protobuf object *otg.PatternFlowGtpv2Spare1 - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2Spare1) PatternFlowGtpv2Spare1 - // provides marshal interface - Marshal() marshalPatternFlowGtpv2Spare1 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2Spare1 - // validate validates PatternFlowGtpv2Spare1 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2Spare1, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv2Spare1ChoiceEnum, set in PatternFlowGtpv2Spare1 - Choice() PatternFlowGtpv2Spare1ChoiceEnum - // setChoice assigns PatternFlowGtpv2Spare1ChoiceEnum provided by user to PatternFlowGtpv2Spare1 - setChoice(value PatternFlowGtpv2Spare1ChoiceEnum) PatternFlowGtpv2Spare1 - // HasChoice checks if Choice has been set in PatternFlowGtpv2Spare1 - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv2Spare1. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv2Spare1 - SetValue(value uint32) PatternFlowGtpv2Spare1 - // HasValue checks if Value has been set in PatternFlowGtpv2Spare1 - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv2Spare1. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv2Spare1 - SetValues(value []uint32) PatternFlowGtpv2Spare1 - // Increment returns PatternFlowGtpv2Spare1Counter, set in PatternFlowGtpv2Spare1. - // PatternFlowGtpv2Spare1Counter is integer counter pattern - Increment() PatternFlowGtpv2Spare1Counter - // SetIncrement assigns PatternFlowGtpv2Spare1Counter provided by user to PatternFlowGtpv2Spare1. - // PatternFlowGtpv2Spare1Counter is integer counter pattern - SetIncrement(value PatternFlowGtpv2Spare1Counter) PatternFlowGtpv2Spare1 - // HasIncrement checks if Increment has been set in PatternFlowGtpv2Spare1 - HasIncrement() bool - // Decrement returns PatternFlowGtpv2Spare1Counter, set in PatternFlowGtpv2Spare1. - // PatternFlowGtpv2Spare1Counter is integer counter pattern - Decrement() PatternFlowGtpv2Spare1Counter - // SetDecrement assigns PatternFlowGtpv2Spare1Counter provided by user to PatternFlowGtpv2Spare1. - // PatternFlowGtpv2Spare1Counter is integer counter pattern - SetDecrement(value PatternFlowGtpv2Spare1Counter) PatternFlowGtpv2Spare1 - // HasDecrement checks if Decrement has been set in PatternFlowGtpv2Spare1 - HasDecrement() bool - // MetricTags returns PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIterIter, set in PatternFlowGtpv2Spare1 - MetricTags() PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter - setNil() -} - -type PatternFlowGtpv2Spare1ChoiceEnum string - -// Enum of Choice on PatternFlowGtpv2Spare1 -var PatternFlowGtpv2Spare1Choice = struct { - VALUE PatternFlowGtpv2Spare1ChoiceEnum - VALUES PatternFlowGtpv2Spare1ChoiceEnum - INCREMENT PatternFlowGtpv2Spare1ChoiceEnum - DECREMENT PatternFlowGtpv2Spare1ChoiceEnum -}{ - VALUE: PatternFlowGtpv2Spare1ChoiceEnum("value"), - VALUES: PatternFlowGtpv2Spare1ChoiceEnum("values"), - INCREMENT: PatternFlowGtpv2Spare1ChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv2Spare1ChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv2Spare1) Choice() PatternFlowGtpv2Spare1ChoiceEnum { - return PatternFlowGtpv2Spare1ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv2Spare1) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv2Spare1) setChoice(value PatternFlowGtpv2Spare1ChoiceEnum) PatternFlowGtpv2Spare1 { - intValue, ok := otg.PatternFlowGtpv2Spare1_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv2Spare1ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv2Spare1_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv2Spare1Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv2Spare1Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv2Spare1Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv2Spare1Counter().msg() - } - - if value == PatternFlowGtpv2Spare1Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv2Spare1Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2Spare1) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv2Spare1Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2Spare1) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv2Spare1 object -func (obj *patternFlowGtpv2Spare1) SetValue(value uint32) PatternFlowGtpv2Spare1 { - obj.setChoice(PatternFlowGtpv2Spare1Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv2Spare1) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv2Spare1 object -func (obj *patternFlowGtpv2Spare1) SetValues(value []uint32) PatternFlowGtpv2Spare1 { - obj.setChoice(PatternFlowGtpv2Spare1Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv2Spare1Counter -func (obj *patternFlowGtpv2Spare1) Increment() PatternFlowGtpv2Spare1Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv2Spare1Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv2Spare1Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv2Spare1Counter -func (obj *patternFlowGtpv2Spare1) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv2Spare1Counter value in the PatternFlowGtpv2Spare1 object -func (obj *patternFlowGtpv2Spare1) SetIncrement(value PatternFlowGtpv2Spare1Counter) PatternFlowGtpv2Spare1 { - obj.setChoice(PatternFlowGtpv2Spare1Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2Spare1Counter -func (obj *patternFlowGtpv2Spare1) Decrement() PatternFlowGtpv2Spare1Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv2Spare1Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv2Spare1Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2Spare1Counter -func (obj *patternFlowGtpv2Spare1) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv2Spare1Counter value in the PatternFlowGtpv2Spare1 object -func (obj *patternFlowGtpv2Spare1) SetDecrement(value PatternFlowGtpv2Spare1Counter) PatternFlowGtpv2Spare1 { - obj.setChoice(PatternFlowGtpv2Spare1Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv2Spare1MetricTag -func (obj *patternFlowGtpv2Spare1) MetricTags() PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv2Spare1MetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter struct { - obj *patternFlowGtpv2Spare1 - patternFlowGtpv2Spare1MetricTagSlice []PatternFlowGtpv2Spare1MetricTag - fieldPtr *[]*otg.PatternFlowGtpv2Spare1MetricTag -} - -func newPatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter(ptr *[]*otg.PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { - return &patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter interface { - setMsg(*patternFlowGtpv2Spare1) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter - Items() []PatternFlowGtpv2Spare1MetricTag - Add() PatternFlowGtpv2Spare1MetricTag - Append(items ...PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter - Set(index int, newObj PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter - Clear() PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter - clearHolderSlice() PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter - appendHolderSlice(item PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter -} - -func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) setMsg(msg *patternFlowGtpv2Spare1) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv2Spare1MetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) Items() []PatternFlowGtpv2Spare1MetricTag { - return obj.patternFlowGtpv2Spare1MetricTagSlice -} - -func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) Add() PatternFlowGtpv2Spare1MetricTag { - newObj := &otg.PatternFlowGtpv2Spare1MetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv2Spare1MetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv2Spare1MetricTagSlice = append(obj.patternFlowGtpv2Spare1MetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) Append(items ...PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv2Spare1MetricTagSlice = append(obj.patternFlowGtpv2Spare1MetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) Set(index int, newObj PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv2Spare1MetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) Clear() PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv2Spare1MetricTag{} - obj.patternFlowGtpv2Spare1MetricTagSlice = []PatternFlowGtpv2Spare1MetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) clearHolderSlice() PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { - if len(obj.patternFlowGtpv2Spare1MetricTagSlice) > 0 { - obj.patternFlowGtpv2Spare1MetricTagSlice = []PatternFlowGtpv2Spare1MetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) appendHolderSlice(item PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { - obj.patternFlowGtpv2Spare1MetricTagSlice = append(obj.patternFlowGtpv2Spare1MetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv2Spare1) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2Spare1.Value <= 7 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv2Spare1.Values <= 7 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv2Spare1MetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv2Spare1) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv2Spare1ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv2Spare1Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv2Spare1Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv2Spare1Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv2Spare1Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv2Spare1Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2Spare1") - } - } else { - intVal := otg.PatternFlowGtpv2Spare1_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv2Spare1_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv2MessageType ***** -type patternFlowGtpv2MessageType struct { - validation - obj *otg.PatternFlowGtpv2MessageType - marshaller marshalPatternFlowGtpv2MessageType - unMarshaller unMarshalPatternFlowGtpv2MessageType - incrementHolder PatternFlowGtpv2MessageTypeCounter - decrementHolder PatternFlowGtpv2MessageTypeCounter - metricTagsHolder PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter -} - -func NewPatternFlowGtpv2MessageType() PatternFlowGtpv2MessageType { - obj := patternFlowGtpv2MessageType{obj: &otg.PatternFlowGtpv2MessageType{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2MessageType) msg() *otg.PatternFlowGtpv2MessageType { - return obj.obj -} - -func (obj *patternFlowGtpv2MessageType) setMsg(msg *otg.PatternFlowGtpv2MessageType) PatternFlowGtpv2MessageType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2MessageType struct { - obj *patternFlowGtpv2MessageType -} - -type marshalPatternFlowGtpv2MessageType interface { - // ToProto marshals PatternFlowGtpv2MessageType to protobuf object *otg.PatternFlowGtpv2MessageType - ToProto() (*otg.PatternFlowGtpv2MessageType, error) - // ToPbText marshals PatternFlowGtpv2MessageType to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2MessageType to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2MessageType to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2MessageType struct { - obj *patternFlowGtpv2MessageType -} - -type unMarshalPatternFlowGtpv2MessageType interface { - // FromProto unmarshals PatternFlowGtpv2MessageType from protobuf object *otg.PatternFlowGtpv2MessageType - FromProto(msg *otg.PatternFlowGtpv2MessageType) (PatternFlowGtpv2MessageType, error) - // FromPbText unmarshals PatternFlowGtpv2MessageType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2MessageType from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2MessageType from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2MessageType) Marshal() marshalPatternFlowGtpv2MessageType { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2MessageType{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2MessageType) Unmarshal() unMarshalPatternFlowGtpv2MessageType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2MessageType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2MessageType) ToProto() (*otg.PatternFlowGtpv2MessageType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2MessageType) FromProto(msg *otg.PatternFlowGtpv2MessageType) (PatternFlowGtpv2MessageType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2MessageType) 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 *unMarshalpatternFlowGtpv2MessageType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv2MessageType) 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 *unMarshalpatternFlowGtpv2MessageType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv2MessageType) 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 *unMarshalpatternFlowGtpv2MessageType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv2MessageType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2MessageType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2MessageType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2MessageType) Clone() (PatternFlowGtpv2MessageType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2MessageType() - 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 -} - -func (obj *patternFlowGtpv2MessageType) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv2MessageType is an 8-bit field that indicates the type of GTP message. Different types of messages are defined in 3GPP TS 29.060 section 7.1 -type PatternFlowGtpv2MessageType interface { - Validation - // msg marshals PatternFlowGtpv2MessageType to protobuf object *otg.PatternFlowGtpv2MessageType - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2MessageType - // setMsg unmarshals PatternFlowGtpv2MessageType from protobuf object *otg.PatternFlowGtpv2MessageType - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2MessageType) PatternFlowGtpv2MessageType - // provides marshal interface - Marshal() marshalPatternFlowGtpv2MessageType - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2MessageType - // validate validates PatternFlowGtpv2MessageType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2MessageType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv2MessageTypeChoiceEnum, set in PatternFlowGtpv2MessageType - Choice() PatternFlowGtpv2MessageTypeChoiceEnum - // setChoice assigns PatternFlowGtpv2MessageTypeChoiceEnum provided by user to PatternFlowGtpv2MessageType - setChoice(value PatternFlowGtpv2MessageTypeChoiceEnum) PatternFlowGtpv2MessageType - // HasChoice checks if Choice has been set in PatternFlowGtpv2MessageType - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv2MessageType. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv2MessageType - SetValue(value uint32) PatternFlowGtpv2MessageType - // HasValue checks if Value has been set in PatternFlowGtpv2MessageType - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv2MessageType. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv2MessageType - SetValues(value []uint32) PatternFlowGtpv2MessageType - // Increment returns PatternFlowGtpv2MessageTypeCounter, set in PatternFlowGtpv2MessageType. - // PatternFlowGtpv2MessageTypeCounter is integer counter pattern - Increment() PatternFlowGtpv2MessageTypeCounter - // SetIncrement assigns PatternFlowGtpv2MessageTypeCounter provided by user to PatternFlowGtpv2MessageType. - // PatternFlowGtpv2MessageTypeCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv2MessageTypeCounter) PatternFlowGtpv2MessageType - // HasIncrement checks if Increment has been set in PatternFlowGtpv2MessageType - HasIncrement() bool - // Decrement returns PatternFlowGtpv2MessageTypeCounter, set in PatternFlowGtpv2MessageType. - // PatternFlowGtpv2MessageTypeCounter is integer counter pattern - Decrement() PatternFlowGtpv2MessageTypeCounter - // SetDecrement assigns PatternFlowGtpv2MessageTypeCounter provided by user to PatternFlowGtpv2MessageType. - // PatternFlowGtpv2MessageTypeCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv2MessageTypeCounter) PatternFlowGtpv2MessageType - // HasDecrement checks if Decrement has been set in PatternFlowGtpv2MessageType - HasDecrement() bool - // MetricTags returns PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIterIter, set in PatternFlowGtpv2MessageType - MetricTags() PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter - setNil() -} - -type PatternFlowGtpv2MessageTypeChoiceEnum string - -// Enum of Choice on PatternFlowGtpv2MessageType -var PatternFlowGtpv2MessageTypeChoice = struct { - VALUE PatternFlowGtpv2MessageTypeChoiceEnum - VALUES PatternFlowGtpv2MessageTypeChoiceEnum - INCREMENT PatternFlowGtpv2MessageTypeChoiceEnum - DECREMENT PatternFlowGtpv2MessageTypeChoiceEnum -}{ - VALUE: PatternFlowGtpv2MessageTypeChoiceEnum("value"), - VALUES: PatternFlowGtpv2MessageTypeChoiceEnum("values"), - INCREMENT: PatternFlowGtpv2MessageTypeChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv2MessageTypeChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv2MessageType) Choice() PatternFlowGtpv2MessageTypeChoiceEnum { - return PatternFlowGtpv2MessageTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv2MessageType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv2MessageType) setChoice(value PatternFlowGtpv2MessageTypeChoiceEnum) PatternFlowGtpv2MessageType { - intValue, ok := otg.PatternFlowGtpv2MessageType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv2MessageTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv2MessageType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv2MessageTypeChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv2MessageTypeChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv2MessageTypeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv2MessageTypeCounter().msg() - } - - if value == PatternFlowGtpv2MessageTypeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv2MessageTypeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2MessageType) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv2MessageTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2MessageType) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv2MessageType object -func (obj *patternFlowGtpv2MessageType) SetValue(value uint32) PatternFlowGtpv2MessageType { - obj.setChoice(PatternFlowGtpv2MessageTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv2MessageType) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv2MessageType object -func (obj *patternFlowGtpv2MessageType) SetValues(value []uint32) PatternFlowGtpv2MessageType { - obj.setChoice(PatternFlowGtpv2MessageTypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv2MessageTypeCounter -func (obj *patternFlowGtpv2MessageType) Increment() PatternFlowGtpv2MessageTypeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv2MessageTypeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv2MessageTypeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv2MessageTypeCounter -func (obj *patternFlowGtpv2MessageType) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv2MessageTypeCounter value in the PatternFlowGtpv2MessageType object -func (obj *patternFlowGtpv2MessageType) SetIncrement(value PatternFlowGtpv2MessageTypeCounter) PatternFlowGtpv2MessageType { - obj.setChoice(PatternFlowGtpv2MessageTypeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2MessageTypeCounter -func (obj *patternFlowGtpv2MessageType) Decrement() PatternFlowGtpv2MessageTypeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv2MessageTypeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv2MessageTypeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2MessageTypeCounter -func (obj *patternFlowGtpv2MessageType) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv2MessageTypeCounter value in the PatternFlowGtpv2MessageType object -func (obj *patternFlowGtpv2MessageType) SetDecrement(value PatternFlowGtpv2MessageTypeCounter) PatternFlowGtpv2MessageType { - obj.setChoice(PatternFlowGtpv2MessageTypeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv2MessageTypeMetricTag -func (obj *patternFlowGtpv2MessageType) MetricTags() PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv2MessageTypeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter struct { - obj *patternFlowGtpv2MessageType - patternFlowGtpv2MessageTypeMetricTagSlice []PatternFlowGtpv2MessageTypeMetricTag - fieldPtr *[]*otg.PatternFlowGtpv2MessageTypeMetricTag -} - -func newPatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter(ptr *[]*otg.PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { - return &patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter interface { - setMsg(*patternFlowGtpv2MessageType) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter - Items() []PatternFlowGtpv2MessageTypeMetricTag - Add() PatternFlowGtpv2MessageTypeMetricTag - Append(items ...PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter - Set(index int, newObj PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter - Clear() PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter - clearHolderSlice() PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter - appendHolderSlice(item PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter -} - -func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) setMsg(msg *patternFlowGtpv2MessageType) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv2MessageTypeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) Items() []PatternFlowGtpv2MessageTypeMetricTag { - return obj.patternFlowGtpv2MessageTypeMetricTagSlice -} - -func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) Add() PatternFlowGtpv2MessageTypeMetricTag { - newObj := &otg.PatternFlowGtpv2MessageTypeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv2MessageTypeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv2MessageTypeMetricTagSlice = append(obj.patternFlowGtpv2MessageTypeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) Append(items ...PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv2MessageTypeMetricTagSlice = append(obj.patternFlowGtpv2MessageTypeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) Set(index int, newObj PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv2MessageTypeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) Clear() PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv2MessageTypeMetricTag{} - obj.patternFlowGtpv2MessageTypeMetricTagSlice = []PatternFlowGtpv2MessageTypeMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) clearHolderSlice() PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { - if len(obj.patternFlowGtpv2MessageTypeMetricTagSlice) > 0 { - obj.patternFlowGtpv2MessageTypeMetricTagSlice = []PatternFlowGtpv2MessageTypeMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) appendHolderSlice(item PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { - obj.patternFlowGtpv2MessageTypeMetricTagSlice = append(obj.patternFlowGtpv2MessageTypeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv2MessageType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2MessageType.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv2MessageType.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv2MessageTypeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv2MessageType) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv2MessageTypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv2MessageTypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv2MessageTypeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv2MessageTypeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv2MessageTypeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv2MessageTypeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2MessageType") - } - } else { - intVal := otg.PatternFlowGtpv2MessageType_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv2MessageType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv2MessageLength ***** -type patternFlowGtpv2MessageLength struct { - validation - obj *otg.PatternFlowGtpv2MessageLength - marshaller marshalPatternFlowGtpv2MessageLength - unMarshaller unMarshalPatternFlowGtpv2MessageLength - incrementHolder PatternFlowGtpv2MessageLengthCounter - decrementHolder PatternFlowGtpv2MessageLengthCounter - metricTagsHolder PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter -} - -func NewPatternFlowGtpv2MessageLength() PatternFlowGtpv2MessageLength { - obj := patternFlowGtpv2MessageLength{obj: &otg.PatternFlowGtpv2MessageLength{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2MessageLength) msg() *otg.PatternFlowGtpv2MessageLength { - return obj.obj -} - -func (obj *patternFlowGtpv2MessageLength) setMsg(msg *otg.PatternFlowGtpv2MessageLength) PatternFlowGtpv2MessageLength { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2MessageLength struct { - obj *patternFlowGtpv2MessageLength -} - -type marshalPatternFlowGtpv2MessageLength interface { - // ToProto marshals PatternFlowGtpv2MessageLength to protobuf object *otg.PatternFlowGtpv2MessageLength - ToProto() (*otg.PatternFlowGtpv2MessageLength, error) - // ToPbText marshals PatternFlowGtpv2MessageLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2MessageLength to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2MessageLength to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2MessageLength struct { - obj *patternFlowGtpv2MessageLength -} - -type unMarshalPatternFlowGtpv2MessageLength interface { - // FromProto unmarshals PatternFlowGtpv2MessageLength from protobuf object *otg.PatternFlowGtpv2MessageLength - FromProto(msg *otg.PatternFlowGtpv2MessageLength) (PatternFlowGtpv2MessageLength, error) - // FromPbText unmarshals PatternFlowGtpv2MessageLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2MessageLength from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2MessageLength from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2MessageLength) Marshal() marshalPatternFlowGtpv2MessageLength { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2MessageLength{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2MessageLength) Unmarshal() unMarshalPatternFlowGtpv2MessageLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2MessageLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2MessageLength) ToProto() (*otg.PatternFlowGtpv2MessageLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2MessageLength) FromProto(msg *otg.PatternFlowGtpv2MessageLength) (PatternFlowGtpv2MessageLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2MessageLength) 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 *unMarshalpatternFlowGtpv2MessageLength) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv2MessageLength) 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 *unMarshalpatternFlowGtpv2MessageLength) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv2MessageLength) 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 *unMarshalpatternFlowGtpv2MessageLength) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv2MessageLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2MessageLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2MessageLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2MessageLength) Clone() (PatternFlowGtpv2MessageLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2MessageLength() - 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 -} - -func (obj *patternFlowGtpv2MessageLength) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv2MessageLength is a 16-bit field that indicates the length of the payload in bytes, excluding the mandatory GTP-c header (first 4 bytes). Includes the TEID and sequence_number if they are present. -type PatternFlowGtpv2MessageLength interface { - Validation - // msg marshals PatternFlowGtpv2MessageLength to protobuf object *otg.PatternFlowGtpv2MessageLength - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2MessageLength - // setMsg unmarshals PatternFlowGtpv2MessageLength from protobuf object *otg.PatternFlowGtpv2MessageLength - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2MessageLength) PatternFlowGtpv2MessageLength - // provides marshal interface - Marshal() marshalPatternFlowGtpv2MessageLength - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2MessageLength - // validate validates PatternFlowGtpv2MessageLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2MessageLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv2MessageLengthChoiceEnum, set in PatternFlowGtpv2MessageLength - Choice() PatternFlowGtpv2MessageLengthChoiceEnum - // setChoice assigns PatternFlowGtpv2MessageLengthChoiceEnum provided by user to PatternFlowGtpv2MessageLength - setChoice(value PatternFlowGtpv2MessageLengthChoiceEnum) PatternFlowGtpv2MessageLength - // HasChoice checks if Choice has been set in PatternFlowGtpv2MessageLength - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv2MessageLength. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv2MessageLength - SetValue(value uint32) PatternFlowGtpv2MessageLength - // HasValue checks if Value has been set in PatternFlowGtpv2MessageLength - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv2MessageLength. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv2MessageLength - SetValues(value []uint32) PatternFlowGtpv2MessageLength - // Increment returns PatternFlowGtpv2MessageLengthCounter, set in PatternFlowGtpv2MessageLength. - // PatternFlowGtpv2MessageLengthCounter is integer counter pattern - Increment() PatternFlowGtpv2MessageLengthCounter - // SetIncrement assigns PatternFlowGtpv2MessageLengthCounter provided by user to PatternFlowGtpv2MessageLength. - // PatternFlowGtpv2MessageLengthCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv2MessageLengthCounter) PatternFlowGtpv2MessageLength - // HasIncrement checks if Increment has been set in PatternFlowGtpv2MessageLength - HasIncrement() bool - // Decrement returns PatternFlowGtpv2MessageLengthCounter, set in PatternFlowGtpv2MessageLength. - // PatternFlowGtpv2MessageLengthCounter is integer counter pattern - Decrement() PatternFlowGtpv2MessageLengthCounter - // SetDecrement assigns PatternFlowGtpv2MessageLengthCounter provided by user to PatternFlowGtpv2MessageLength. - // PatternFlowGtpv2MessageLengthCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv2MessageLengthCounter) PatternFlowGtpv2MessageLength - // HasDecrement checks if Decrement has been set in PatternFlowGtpv2MessageLength - HasDecrement() bool - // MetricTags returns PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIterIter, set in PatternFlowGtpv2MessageLength - MetricTags() PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter - setNil() -} - -type PatternFlowGtpv2MessageLengthChoiceEnum string - -// Enum of Choice on PatternFlowGtpv2MessageLength -var PatternFlowGtpv2MessageLengthChoice = struct { - VALUE PatternFlowGtpv2MessageLengthChoiceEnum - VALUES PatternFlowGtpv2MessageLengthChoiceEnum - INCREMENT PatternFlowGtpv2MessageLengthChoiceEnum - DECREMENT PatternFlowGtpv2MessageLengthChoiceEnum -}{ - VALUE: PatternFlowGtpv2MessageLengthChoiceEnum("value"), - VALUES: PatternFlowGtpv2MessageLengthChoiceEnum("values"), - INCREMENT: PatternFlowGtpv2MessageLengthChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv2MessageLengthChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv2MessageLength) Choice() PatternFlowGtpv2MessageLengthChoiceEnum { - return PatternFlowGtpv2MessageLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv2MessageLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv2MessageLength) setChoice(value PatternFlowGtpv2MessageLengthChoiceEnum) PatternFlowGtpv2MessageLength { - intValue, ok := otg.PatternFlowGtpv2MessageLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv2MessageLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv2MessageLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv2MessageLengthChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv2MessageLengthChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv2MessageLengthChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv2MessageLengthCounter().msg() - } - - if value == PatternFlowGtpv2MessageLengthChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv2MessageLengthCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2MessageLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv2MessageLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2MessageLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv2MessageLength object -func (obj *patternFlowGtpv2MessageLength) SetValue(value uint32) PatternFlowGtpv2MessageLength { - obj.setChoice(PatternFlowGtpv2MessageLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv2MessageLength) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv2MessageLength object -func (obj *patternFlowGtpv2MessageLength) SetValues(value []uint32) PatternFlowGtpv2MessageLength { - obj.setChoice(PatternFlowGtpv2MessageLengthChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv2MessageLengthCounter -func (obj *patternFlowGtpv2MessageLength) Increment() PatternFlowGtpv2MessageLengthCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv2MessageLengthChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv2MessageLengthCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv2MessageLengthCounter -func (obj *patternFlowGtpv2MessageLength) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv2MessageLengthCounter value in the PatternFlowGtpv2MessageLength object -func (obj *patternFlowGtpv2MessageLength) SetIncrement(value PatternFlowGtpv2MessageLengthCounter) PatternFlowGtpv2MessageLength { - obj.setChoice(PatternFlowGtpv2MessageLengthChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2MessageLengthCounter -func (obj *patternFlowGtpv2MessageLength) Decrement() PatternFlowGtpv2MessageLengthCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv2MessageLengthChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv2MessageLengthCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2MessageLengthCounter -func (obj *patternFlowGtpv2MessageLength) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv2MessageLengthCounter value in the PatternFlowGtpv2MessageLength object -func (obj *patternFlowGtpv2MessageLength) SetDecrement(value PatternFlowGtpv2MessageLengthCounter) PatternFlowGtpv2MessageLength { - obj.setChoice(PatternFlowGtpv2MessageLengthChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv2MessageLengthMetricTag -func (obj *patternFlowGtpv2MessageLength) MetricTags() PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv2MessageLengthMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter struct { - obj *patternFlowGtpv2MessageLength - patternFlowGtpv2MessageLengthMetricTagSlice []PatternFlowGtpv2MessageLengthMetricTag - fieldPtr *[]*otg.PatternFlowGtpv2MessageLengthMetricTag -} - -func newPatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter(ptr *[]*otg.PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { - return &patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter interface { - setMsg(*patternFlowGtpv2MessageLength) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter - Items() []PatternFlowGtpv2MessageLengthMetricTag - Add() PatternFlowGtpv2MessageLengthMetricTag - Append(items ...PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter - Set(index int, newObj PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter - Clear() PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter - clearHolderSlice() PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter - appendHolderSlice(item PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter -} - -func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) setMsg(msg *patternFlowGtpv2MessageLength) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv2MessageLengthMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) Items() []PatternFlowGtpv2MessageLengthMetricTag { - return obj.patternFlowGtpv2MessageLengthMetricTagSlice -} - -func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) Add() PatternFlowGtpv2MessageLengthMetricTag { - newObj := &otg.PatternFlowGtpv2MessageLengthMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv2MessageLengthMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv2MessageLengthMetricTagSlice = append(obj.patternFlowGtpv2MessageLengthMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) Append(items ...PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv2MessageLengthMetricTagSlice = append(obj.patternFlowGtpv2MessageLengthMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) Set(index int, newObj PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv2MessageLengthMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) Clear() PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv2MessageLengthMetricTag{} - obj.patternFlowGtpv2MessageLengthMetricTagSlice = []PatternFlowGtpv2MessageLengthMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) clearHolderSlice() PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { - if len(obj.patternFlowGtpv2MessageLengthMetricTagSlice) > 0 { - obj.patternFlowGtpv2MessageLengthMetricTagSlice = []PatternFlowGtpv2MessageLengthMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) appendHolderSlice(item PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { - obj.patternFlowGtpv2MessageLengthMetricTagSlice = append(obj.patternFlowGtpv2MessageLengthMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv2MessageLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2MessageLength.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv2MessageLength.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv2MessageLengthMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv2MessageLength) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv2MessageLengthChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv2MessageLengthChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv2MessageLengthChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv2MessageLengthChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv2MessageLengthChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv2MessageLengthChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2MessageLength") - } - } else { - intVal := otg.PatternFlowGtpv2MessageLength_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv2MessageLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv2Teid ***** -type patternFlowGtpv2Teid struct { - validation - obj *otg.PatternFlowGtpv2Teid - marshaller marshalPatternFlowGtpv2Teid - unMarshaller unMarshalPatternFlowGtpv2Teid - incrementHolder PatternFlowGtpv2TeidCounter - decrementHolder PatternFlowGtpv2TeidCounter - metricTagsHolder PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter -} - -func NewPatternFlowGtpv2Teid() PatternFlowGtpv2Teid { - obj := patternFlowGtpv2Teid{obj: &otg.PatternFlowGtpv2Teid{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2Teid) msg() *otg.PatternFlowGtpv2Teid { - return obj.obj -} - -func (obj *patternFlowGtpv2Teid) setMsg(msg *otg.PatternFlowGtpv2Teid) PatternFlowGtpv2Teid { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2Teid struct { - obj *patternFlowGtpv2Teid -} - -type marshalPatternFlowGtpv2Teid interface { - // ToProto marshals PatternFlowGtpv2Teid to protobuf object *otg.PatternFlowGtpv2Teid - ToProto() (*otg.PatternFlowGtpv2Teid, error) - // ToPbText marshals PatternFlowGtpv2Teid to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2Teid to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2Teid to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2Teid struct { - obj *patternFlowGtpv2Teid -} - -type unMarshalPatternFlowGtpv2Teid interface { - // FromProto unmarshals PatternFlowGtpv2Teid from protobuf object *otg.PatternFlowGtpv2Teid - FromProto(msg *otg.PatternFlowGtpv2Teid) (PatternFlowGtpv2Teid, error) - // FromPbText unmarshals PatternFlowGtpv2Teid from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2Teid from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2Teid from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2Teid) Marshal() marshalPatternFlowGtpv2Teid { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2Teid{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2Teid) Unmarshal() unMarshalPatternFlowGtpv2Teid { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2Teid{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2Teid) ToProto() (*otg.PatternFlowGtpv2Teid, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2Teid) FromProto(msg *otg.PatternFlowGtpv2Teid) (PatternFlowGtpv2Teid, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2Teid) 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 *unMarshalpatternFlowGtpv2Teid) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv2Teid) 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 *unMarshalpatternFlowGtpv2Teid) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv2Teid) 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 *unMarshalpatternFlowGtpv2Teid) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv2Teid) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Teid) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Teid) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2Teid) Clone() (PatternFlowGtpv2Teid, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2Teid() - 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 -} - -func (obj *patternFlowGtpv2Teid) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv2Teid is tunnel endpoint identifier. A 32-bit (4-octet) field used to multiplex different connections in the same GTP tunnel. Is present only if the teid_flag is set. -type PatternFlowGtpv2Teid interface { - Validation - // msg marshals PatternFlowGtpv2Teid to protobuf object *otg.PatternFlowGtpv2Teid - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2Teid - // setMsg unmarshals PatternFlowGtpv2Teid from protobuf object *otg.PatternFlowGtpv2Teid - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2Teid) PatternFlowGtpv2Teid - // provides marshal interface - Marshal() marshalPatternFlowGtpv2Teid - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2Teid - // validate validates PatternFlowGtpv2Teid - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2Teid, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv2TeidChoiceEnum, set in PatternFlowGtpv2Teid - Choice() PatternFlowGtpv2TeidChoiceEnum - // setChoice assigns PatternFlowGtpv2TeidChoiceEnum provided by user to PatternFlowGtpv2Teid - setChoice(value PatternFlowGtpv2TeidChoiceEnum) PatternFlowGtpv2Teid - // HasChoice checks if Choice has been set in PatternFlowGtpv2Teid - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv2Teid. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv2Teid - SetValue(value uint32) PatternFlowGtpv2Teid - // HasValue checks if Value has been set in PatternFlowGtpv2Teid - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv2Teid. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv2Teid - SetValues(value []uint32) PatternFlowGtpv2Teid - // Increment returns PatternFlowGtpv2TeidCounter, set in PatternFlowGtpv2Teid. - // PatternFlowGtpv2TeidCounter is integer counter pattern - Increment() PatternFlowGtpv2TeidCounter - // SetIncrement assigns PatternFlowGtpv2TeidCounter provided by user to PatternFlowGtpv2Teid. - // PatternFlowGtpv2TeidCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv2TeidCounter) PatternFlowGtpv2Teid - // HasIncrement checks if Increment has been set in PatternFlowGtpv2Teid - HasIncrement() bool - // Decrement returns PatternFlowGtpv2TeidCounter, set in PatternFlowGtpv2Teid. - // PatternFlowGtpv2TeidCounter is integer counter pattern - Decrement() PatternFlowGtpv2TeidCounter - // SetDecrement assigns PatternFlowGtpv2TeidCounter provided by user to PatternFlowGtpv2Teid. - // PatternFlowGtpv2TeidCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv2TeidCounter) PatternFlowGtpv2Teid - // HasDecrement checks if Decrement has been set in PatternFlowGtpv2Teid - HasDecrement() bool - // MetricTags returns PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIterIter, set in PatternFlowGtpv2Teid - MetricTags() PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter - setNil() -} - -type PatternFlowGtpv2TeidChoiceEnum string - -// Enum of Choice on PatternFlowGtpv2Teid -var PatternFlowGtpv2TeidChoice = struct { - VALUE PatternFlowGtpv2TeidChoiceEnum - VALUES PatternFlowGtpv2TeidChoiceEnum - INCREMENT PatternFlowGtpv2TeidChoiceEnum - DECREMENT PatternFlowGtpv2TeidChoiceEnum -}{ - VALUE: PatternFlowGtpv2TeidChoiceEnum("value"), - VALUES: PatternFlowGtpv2TeidChoiceEnum("values"), - INCREMENT: PatternFlowGtpv2TeidChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv2TeidChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv2Teid) Choice() PatternFlowGtpv2TeidChoiceEnum { - return PatternFlowGtpv2TeidChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv2Teid) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv2Teid) setChoice(value PatternFlowGtpv2TeidChoiceEnum) PatternFlowGtpv2Teid { - intValue, ok := otg.PatternFlowGtpv2Teid_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv2TeidChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv2Teid_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv2TeidChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv2TeidChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv2TeidChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv2TeidCounter().msg() - } - - if value == PatternFlowGtpv2TeidChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv2TeidCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2Teid) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv2TeidChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2Teid) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv2Teid object -func (obj *patternFlowGtpv2Teid) SetValue(value uint32) PatternFlowGtpv2Teid { - obj.setChoice(PatternFlowGtpv2TeidChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv2Teid) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv2Teid object -func (obj *patternFlowGtpv2Teid) SetValues(value []uint32) PatternFlowGtpv2Teid { - obj.setChoice(PatternFlowGtpv2TeidChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv2TeidCounter -func (obj *patternFlowGtpv2Teid) Increment() PatternFlowGtpv2TeidCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv2TeidChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv2TeidCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv2TeidCounter -func (obj *patternFlowGtpv2Teid) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv2TeidCounter value in the PatternFlowGtpv2Teid object -func (obj *patternFlowGtpv2Teid) SetIncrement(value PatternFlowGtpv2TeidCounter) PatternFlowGtpv2Teid { - obj.setChoice(PatternFlowGtpv2TeidChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2TeidCounter -func (obj *patternFlowGtpv2Teid) Decrement() PatternFlowGtpv2TeidCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv2TeidChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv2TeidCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2TeidCounter -func (obj *patternFlowGtpv2Teid) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv2TeidCounter value in the PatternFlowGtpv2Teid object -func (obj *patternFlowGtpv2Teid) SetDecrement(value PatternFlowGtpv2TeidCounter) PatternFlowGtpv2Teid { - obj.setChoice(PatternFlowGtpv2TeidChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv2TeidMetricTag -func (obj *patternFlowGtpv2Teid) MetricTags() PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv2TeidMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter struct { - obj *patternFlowGtpv2Teid - patternFlowGtpv2TeidMetricTagSlice []PatternFlowGtpv2TeidMetricTag - fieldPtr *[]*otg.PatternFlowGtpv2TeidMetricTag -} - -func newPatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter(ptr *[]*otg.PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { - return &patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter interface { - setMsg(*patternFlowGtpv2Teid) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter - Items() []PatternFlowGtpv2TeidMetricTag - Add() PatternFlowGtpv2TeidMetricTag - Append(items ...PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter - Set(index int, newObj PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter - Clear() PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter - clearHolderSlice() PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter - appendHolderSlice(item PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter -} - -func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) setMsg(msg *patternFlowGtpv2Teid) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv2TeidMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) Items() []PatternFlowGtpv2TeidMetricTag { - return obj.patternFlowGtpv2TeidMetricTagSlice -} - -func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) Add() PatternFlowGtpv2TeidMetricTag { - newObj := &otg.PatternFlowGtpv2TeidMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv2TeidMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv2TeidMetricTagSlice = append(obj.patternFlowGtpv2TeidMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) Append(items ...PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv2TeidMetricTagSlice = append(obj.patternFlowGtpv2TeidMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) Set(index int, newObj PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv2TeidMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) Clear() PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv2TeidMetricTag{} - obj.patternFlowGtpv2TeidMetricTagSlice = []PatternFlowGtpv2TeidMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) clearHolderSlice() PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { - if len(obj.patternFlowGtpv2TeidMetricTagSlice) > 0 { - obj.patternFlowGtpv2TeidMetricTagSlice = []PatternFlowGtpv2TeidMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) appendHolderSlice(item PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { - obj.patternFlowGtpv2TeidMetricTagSlice = append(obj.patternFlowGtpv2TeidMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv2Teid) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv2TeidMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv2Teid) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv2TeidChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv2TeidChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv2TeidChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv2TeidChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv2TeidChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv2TeidChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2Teid") - } - } else { - intVal := otg.PatternFlowGtpv2Teid_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv2Teid_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv2SequenceNumber ***** -type patternFlowGtpv2SequenceNumber struct { - validation - obj *otg.PatternFlowGtpv2SequenceNumber - marshaller marshalPatternFlowGtpv2SequenceNumber - unMarshaller unMarshalPatternFlowGtpv2SequenceNumber - incrementHolder PatternFlowGtpv2SequenceNumberCounter - decrementHolder PatternFlowGtpv2SequenceNumberCounter - metricTagsHolder PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter -} - -func NewPatternFlowGtpv2SequenceNumber() PatternFlowGtpv2SequenceNumber { - obj := patternFlowGtpv2SequenceNumber{obj: &otg.PatternFlowGtpv2SequenceNumber{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2SequenceNumber) msg() *otg.PatternFlowGtpv2SequenceNumber { - return obj.obj -} - -func (obj *patternFlowGtpv2SequenceNumber) setMsg(msg *otg.PatternFlowGtpv2SequenceNumber) PatternFlowGtpv2SequenceNumber { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2SequenceNumber struct { - obj *patternFlowGtpv2SequenceNumber -} - -type marshalPatternFlowGtpv2SequenceNumber interface { - // ToProto marshals PatternFlowGtpv2SequenceNumber to protobuf object *otg.PatternFlowGtpv2SequenceNumber - ToProto() (*otg.PatternFlowGtpv2SequenceNumber, error) - // ToPbText marshals PatternFlowGtpv2SequenceNumber to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2SequenceNumber to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2SequenceNumber to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2SequenceNumber struct { - obj *patternFlowGtpv2SequenceNumber -} - -type unMarshalPatternFlowGtpv2SequenceNumber interface { - // FromProto unmarshals PatternFlowGtpv2SequenceNumber from protobuf object *otg.PatternFlowGtpv2SequenceNumber - FromProto(msg *otg.PatternFlowGtpv2SequenceNumber) (PatternFlowGtpv2SequenceNumber, error) - // FromPbText unmarshals PatternFlowGtpv2SequenceNumber from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2SequenceNumber from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2SequenceNumber from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2SequenceNumber) Marshal() marshalPatternFlowGtpv2SequenceNumber { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2SequenceNumber{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2SequenceNumber) Unmarshal() unMarshalPatternFlowGtpv2SequenceNumber { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2SequenceNumber{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2SequenceNumber) ToProto() (*otg.PatternFlowGtpv2SequenceNumber, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2SequenceNumber) FromProto(msg *otg.PatternFlowGtpv2SequenceNumber) (PatternFlowGtpv2SequenceNumber, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2SequenceNumber) 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 *unMarshalpatternFlowGtpv2SequenceNumber) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv2SequenceNumber) 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 *unMarshalpatternFlowGtpv2SequenceNumber) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv2SequenceNumber) 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 *unMarshalpatternFlowGtpv2SequenceNumber) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv2SequenceNumber) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2SequenceNumber) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2SequenceNumber) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2SequenceNumber) Clone() (PatternFlowGtpv2SequenceNumber, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2SequenceNumber() - 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 -} - -func (obj *patternFlowGtpv2SequenceNumber) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv2SequenceNumber is the sequence number -type PatternFlowGtpv2SequenceNumber interface { - Validation - // msg marshals PatternFlowGtpv2SequenceNumber to protobuf object *otg.PatternFlowGtpv2SequenceNumber - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2SequenceNumber - // setMsg unmarshals PatternFlowGtpv2SequenceNumber from protobuf object *otg.PatternFlowGtpv2SequenceNumber - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2SequenceNumber) PatternFlowGtpv2SequenceNumber - // provides marshal interface - Marshal() marshalPatternFlowGtpv2SequenceNumber - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2SequenceNumber - // validate validates PatternFlowGtpv2SequenceNumber - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2SequenceNumber, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv2SequenceNumberChoiceEnum, set in PatternFlowGtpv2SequenceNumber - Choice() PatternFlowGtpv2SequenceNumberChoiceEnum - // setChoice assigns PatternFlowGtpv2SequenceNumberChoiceEnum provided by user to PatternFlowGtpv2SequenceNumber - setChoice(value PatternFlowGtpv2SequenceNumberChoiceEnum) PatternFlowGtpv2SequenceNumber - // HasChoice checks if Choice has been set in PatternFlowGtpv2SequenceNumber - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv2SequenceNumber. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv2SequenceNumber - SetValue(value uint32) PatternFlowGtpv2SequenceNumber - // HasValue checks if Value has been set in PatternFlowGtpv2SequenceNumber - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv2SequenceNumber. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv2SequenceNumber - SetValues(value []uint32) PatternFlowGtpv2SequenceNumber - // Increment returns PatternFlowGtpv2SequenceNumberCounter, set in PatternFlowGtpv2SequenceNumber. - // PatternFlowGtpv2SequenceNumberCounter is integer counter pattern - Increment() PatternFlowGtpv2SequenceNumberCounter - // SetIncrement assigns PatternFlowGtpv2SequenceNumberCounter provided by user to PatternFlowGtpv2SequenceNumber. - // PatternFlowGtpv2SequenceNumberCounter is integer counter pattern - SetIncrement(value PatternFlowGtpv2SequenceNumberCounter) PatternFlowGtpv2SequenceNumber - // HasIncrement checks if Increment has been set in PatternFlowGtpv2SequenceNumber - HasIncrement() bool - // Decrement returns PatternFlowGtpv2SequenceNumberCounter, set in PatternFlowGtpv2SequenceNumber. - // PatternFlowGtpv2SequenceNumberCounter is integer counter pattern - Decrement() PatternFlowGtpv2SequenceNumberCounter - // SetDecrement assigns PatternFlowGtpv2SequenceNumberCounter provided by user to PatternFlowGtpv2SequenceNumber. - // PatternFlowGtpv2SequenceNumberCounter is integer counter pattern - SetDecrement(value PatternFlowGtpv2SequenceNumberCounter) PatternFlowGtpv2SequenceNumber - // HasDecrement checks if Decrement has been set in PatternFlowGtpv2SequenceNumber - HasDecrement() bool - // MetricTags returns PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIterIter, set in PatternFlowGtpv2SequenceNumber - MetricTags() PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter - setNil() -} - -type PatternFlowGtpv2SequenceNumberChoiceEnum string - -// Enum of Choice on PatternFlowGtpv2SequenceNumber -var PatternFlowGtpv2SequenceNumberChoice = struct { - VALUE PatternFlowGtpv2SequenceNumberChoiceEnum - VALUES PatternFlowGtpv2SequenceNumberChoiceEnum - INCREMENT PatternFlowGtpv2SequenceNumberChoiceEnum - DECREMENT PatternFlowGtpv2SequenceNumberChoiceEnum -}{ - VALUE: PatternFlowGtpv2SequenceNumberChoiceEnum("value"), - VALUES: PatternFlowGtpv2SequenceNumberChoiceEnum("values"), - INCREMENT: PatternFlowGtpv2SequenceNumberChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv2SequenceNumberChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv2SequenceNumber) Choice() PatternFlowGtpv2SequenceNumberChoiceEnum { - return PatternFlowGtpv2SequenceNumberChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv2SequenceNumber) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv2SequenceNumber) setChoice(value PatternFlowGtpv2SequenceNumberChoiceEnum) PatternFlowGtpv2SequenceNumber { - intValue, ok := otg.PatternFlowGtpv2SequenceNumber_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv2SequenceNumberChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv2SequenceNumber_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv2SequenceNumberChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv2SequenceNumberChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv2SequenceNumberChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv2SequenceNumberCounter().msg() - } - - if value == PatternFlowGtpv2SequenceNumberChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv2SequenceNumberCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2SequenceNumber) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2SequenceNumber) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv2SequenceNumber object -func (obj *patternFlowGtpv2SequenceNumber) SetValue(value uint32) PatternFlowGtpv2SequenceNumber { - obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv2SequenceNumber) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv2SequenceNumber object -func (obj *patternFlowGtpv2SequenceNumber) SetValues(value []uint32) PatternFlowGtpv2SequenceNumber { - obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv2SequenceNumberCounter -func (obj *patternFlowGtpv2SequenceNumber) Increment() PatternFlowGtpv2SequenceNumberCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv2SequenceNumberCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv2SequenceNumberCounter -func (obj *patternFlowGtpv2SequenceNumber) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv2SequenceNumberCounter value in the PatternFlowGtpv2SequenceNumber object -func (obj *patternFlowGtpv2SequenceNumber) SetIncrement(value PatternFlowGtpv2SequenceNumberCounter) PatternFlowGtpv2SequenceNumber { - obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2SequenceNumberCounter -func (obj *patternFlowGtpv2SequenceNumber) Decrement() PatternFlowGtpv2SequenceNumberCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv2SequenceNumberCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2SequenceNumberCounter -func (obj *patternFlowGtpv2SequenceNumber) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv2SequenceNumberCounter value in the PatternFlowGtpv2SequenceNumber object -func (obj *patternFlowGtpv2SequenceNumber) SetDecrement(value PatternFlowGtpv2SequenceNumberCounter) PatternFlowGtpv2SequenceNumber { - obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv2SequenceNumberMetricTag -func (obj *patternFlowGtpv2SequenceNumber) MetricTags() PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv2SequenceNumberMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter struct { - obj *patternFlowGtpv2SequenceNumber - patternFlowGtpv2SequenceNumberMetricTagSlice []PatternFlowGtpv2SequenceNumberMetricTag - fieldPtr *[]*otg.PatternFlowGtpv2SequenceNumberMetricTag -} - -func newPatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter(ptr *[]*otg.PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { - return &patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter interface { - setMsg(*patternFlowGtpv2SequenceNumber) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter - Items() []PatternFlowGtpv2SequenceNumberMetricTag - Add() PatternFlowGtpv2SequenceNumberMetricTag - Append(items ...PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter - Set(index int, newObj PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter - Clear() PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter - clearHolderSlice() PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter - appendHolderSlice(item PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter -} - -func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) setMsg(msg *patternFlowGtpv2SequenceNumber) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv2SequenceNumberMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) Items() []PatternFlowGtpv2SequenceNumberMetricTag { - return obj.patternFlowGtpv2SequenceNumberMetricTagSlice -} - -func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) Add() PatternFlowGtpv2SequenceNumberMetricTag { - newObj := &otg.PatternFlowGtpv2SequenceNumberMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv2SequenceNumberMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv2SequenceNumberMetricTagSlice = append(obj.patternFlowGtpv2SequenceNumberMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) Append(items ...PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv2SequenceNumberMetricTagSlice = append(obj.patternFlowGtpv2SequenceNumberMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) Set(index int, newObj PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv2SequenceNumberMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) Clear() PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv2SequenceNumberMetricTag{} - obj.patternFlowGtpv2SequenceNumberMetricTagSlice = []PatternFlowGtpv2SequenceNumberMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) clearHolderSlice() PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { - if len(obj.patternFlowGtpv2SequenceNumberMetricTagSlice) > 0 { - obj.patternFlowGtpv2SequenceNumberMetricTagSlice = []PatternFlowGtpv2SequenceNumberMetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) appendHolderSlice(item PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { - obj.patternFlowGtpv2SequenceNumberMetricTagSlice = append(obj.patternFlowGtpv2SequenceNumberMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv2SequenceNumber) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2SequenceNumber.Value <= 16777215 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv2SequenceNumber.Values <= 16777215 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv2SequenceNumberMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv2SequenceNumber) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv2SequenceNumberChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv2SequenceNumberChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv2SequenceNumberChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv2SequenceNumberChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv2SequenceNumberChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2SequenceNumber") - } - } else { - intVal := otg.PatternFlowGtpv2SequenceNumber_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv2SequenceNumber_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv2Spare2 ***** -type patternFlowGtpv2Spare2 struct { - validation - obj *otg.PatternFlowGtpv2Spare2 - marshaller marshalPatternFlowGtpv2Spare2 - unMarshaller unMarshalPatternFlowGtpv2Spare2 - incrementHolder PatternFlowGtpv2Spare2Counter - decrementHolder PatternFlowGtpv2Spare2Counter - metricTagsHolder PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter -} - -func NewPatternFlowGtpv2Spare2() PatternFlowGtpv2Spare2 { - obj := patternFlowGtpv2Spare2{obj: &otg.PatternFlowGtpv2Spare2{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2Spare2) msg() *otg.PatternFlowGtpv2Spare2 { - return obj.obj -} - -func (obj *patternFlowGtpv2Spare2) setMsg(msg *otg.PatternFlowGtpv2Spare2) PatternFlowGtpv2Spare2 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2Spare2 struct { - obj *patternFlowGtpv2Spare2 -} - -type marshalPatternFlowGtpv2Spare2 interface { - // ToProto marshals PatternFlowGtpv2Spare2 to protobuf object *otg.PatternFlowGtpv2Spare2 - ToProto() (*otg.PatternFlowGtpv2Spare2, error) - // ToPbText marshals PatternFlowGtpv2Spare2 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2Spare2 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2Spare2 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2Spare2 struct { - obj *patternFlowGtpv2Spare2 -} - -type unMarshalPatternFlowGtpv2Spare2 interface { - // FromProto unmarshals PatternFlowGtpv2Spare2 from protobuf object *otg.PatternFlowGtpv2Spare2 - FromProto(msg *otg.PatternFlowGtpv2Spare2) (PatternFlowGtpv2Spare2, error) - // FromPbText unmarshals PatternFlowGtpv2Spare2 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2Spare2 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2Spare2 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2Spare2) Marshal() marshalPatternFlowGtpv2Spare2 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2Spare2{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2Spare2) Unmarshal() unMarshalPatternFlowGtpv2Spare2 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2Spare2{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2Spare2) ToProto() (*otg.PatternFlowGtpv2Spare2, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2Spare2) FromProto(msg *otg.PatternFlowGtpv2Spare2) (PatternFlowGtpv2Spare2, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2Spare2) 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 *unMarshalpatternFlowGtpv2Spare2) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpv2Spare2) 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 *unMarshalpatternFlowGtpv2Spare2) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpv2Spare2) 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 *unMarshalpatternFlowGtpv2Spare2) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpv2Spare2) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Spare2) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Spare2) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2Spare2) Clone() (PatternFlowGtpv2Spare2, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2Spare2() - 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 -} - -func (obj *patternFlowGtpv2Spare2) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpv2Spare2 is reserved field -type PatternFlowGtpv2Spare2 interface { - Validation - // msg marshals PatternFlowGtpv2Spare2 to protobuf object *otg.PatternFlowGtpv2Spare2 - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2Spare2 - // setMsg unmarshals PatternFlowGtpv2Spare2 from protobuf object *otg.PatternFlowGtpv2Spare2 - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2Spare2) PatternFlowGtpv2Spare2 - // provides marshal interface - Marshal() marshalPatternFlowGtpv2Spare2 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2Spare2 - // validate validates PatternFlowGtpv2Spare2 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2Spare2, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpv2Spare2ChoiceEnum, set in PatternFlowGtpv2Spare2 - Choice() PatternFlowGtpv2Spare2ChoiceEnum - // setChoice assigns PatternFlowGtpv2Spare2ChoiceEnum provided by user to PatternFlowGtpv2Spare2 - setChoice(value PatternFlowGtpv2Spare2ChoiceEnum) PatternFlowGtpv2Spare2 - // HasChoice checks if Choice has been set in PatternFlowGtpv2Spare2 - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpv2Spare2. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpv2Spare2 - SetValue(value uint32) PatternFlowGtpv2Spare2 - // HasValue checks if Value has been set in PatternFlowGtpv2Spare2 - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpv2Spare2. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpv2Spare2 - SetValues(value []uint32) PatternFlowGtpv2Spare2 - // Increment returns PatternFlowGtpv2Spare2Counter, set in PatternFlowGtpv2Spare2. - // PatternFlowGtpv2Spare2Counter is integer counter pattern - Increment() PatternFlowGtpv2Spare2Counter - // SetIncrement assigns PatternFlowGtpv2Spare2Counter provided by user to PatternFlowGtpv2Spare2. - // PatternFlowGtpv2Spare2Counter is integer counter pattern - SetIncrement(value PatternFlowGtpv2Spare2Counter) PatternFlowGtpv2Spare2 - // HasIncrement checks if Increment has been set in PatternFlowGtpv2Spare2 - HasIncrement() bool - // Decrement returns PatternFlowGtpv2Spare2Counter, set in PatternFlowGtpv2Spare2. - // PatternFlowGtpv2Spare2Counter is integer counter pattern - Decrement() PatternFlowGtpv2Spare2Counter - // SetDecrement assigns PatternFlowGtpv2Spare2Counter provided by user to PatternFlowGtpv2Spare2. - // PatternFlowGtpv2Spare2Counter is integer counter pattern - SetDecrement(value PatternFlowGtpv2Spare2Counter) PatternFlowGtpv2Spare2 - // HasDecrement checks if Decrement has been set in PatternFlowGtpv2Spare2 - HasDecrement() bool - // MetricTags returns PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIterIter, set in PatternFlowGtpv2Spare2 - MetricTags() PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter - setNil() -} - -type PatternFlowGtpv2Spare2ChoiceEnum string - -// Enum of Choice on PatternFlowGtpv2Spare2 -var PatternFlowGtpv2Spare2Choice = struct { - VALUE PatternFlowGtpv2Spare2ChoiceEnum - VALUES PatternFlowGtpv2Spare2ChoiceEnum - INCREMENT PatternFlowGtpv2Spare2ChoiceEnum - DECREMENT PatternFlowGtpv2Spare2ChoiceEnum -}{ - VALUE: PatternFlowGtpv2Spare2ChoiceEnum("value"), - VALUES: PatternFlowGtpv2Spare2ChoiceEnum("values"), - INCREMENT: PatternFlowGtpv2Spare2ChoiceEnum("increment"), - DECREMENT: PatternFlowGtpv2Spare2ChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpv2Spare2) Choice() PatternFlowGtpv2Spare2ChoiceEnum { - return PatternFlowGtpv2Spare2ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpv2Spare2) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpv2Spare2) setChoice(value PatternFlowGtpv2Spare2ChoiceEnum) PatternFlowGtpv2Spare2 { - intValue, ok := otg.PatternFlowGtpv2Spare2_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpv2Spare2ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpv2Spare2_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpv2Spare2Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpv2Spare2Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpv2Spare2Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpv2Spare2Counter().msg() - } - - if value == PatternFlowGtpv2Spare2Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpv2Spare2Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2Spare2) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpv2Spare2Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpv2Spare2) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpv2Spare2 object -func (obj *patternFlowGtpv2Spare2) SetValue(value uint32) PatternFlowGtpv2Spare2 { - obj.setChoice(PatternFlowGtpv2Spare2Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpv2Spare2) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpv2Spare2 object -func (obj *patternFlowGtpv2Spare2) SetValues(value []uint32) PatternFlowGtpv2Spare2 { - obj.setChoice(PatternFlowGtpv2Spare2Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpv2Spare2Counter -func (obj *patternFlowGtpv2Spare2) Increment() PatternFlowGtpv2Spare2Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpv2Spare2Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpv2Spare2Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpv2Spare2Counter -func (obj *patternFlowGtpv2Spare2) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpv2Spare2Counter value in the PatternFlowGtpv2Spare2 object -func (obj *patternFlowGtpv2Spare2) SetIncrement(value PatternFlowGtpv2Spare2Counter) PatternFlowGtpv2Spare2 { - obj.setChoice(PatternFlowGtpv2Spare2Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2Spare2Counter -func (obj *patternFlowGtpv2Spare2) Decrement() PatternFlowGtpv2Spare2Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpv2Spare2Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpv2Spare2Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpv2Spare2Counter -func (obj *patternFlowGtpv2Spare2) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpv2Spare2Counter value in the PatternFlowGtpv2Spare2 object -func (obj *patternFlowGtpv2Spare2) SetDecrement(value PatternFlowGtpv2Spare2Counter) PatternFlowGtpv2Spare2 { - obj.setChoice(PatternFlowGtpv2Spare2Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpv2Spare2MetricTag -func (obj *patternFlowGtpv2Spare2) MetricTags() PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpv2Spare2MetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter struct { - obj *patternFlowGtpv2Spare2 - patternFlowGtpv2Spare2MetricTagSlice []PatternFlowGtpv2Spare2MetricTag - fieldPtr *[]*otg.PatternFlowGtpv2Spare2MetricTag -} - -func newPatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter(ptr *[]*otg.PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { - return &patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter interface { - setMsg(*patternFlowGtpv2Spare2) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter - Items() []PatternFlowGtpv2Spare2MetricTag - Add() PatternFlowGtpv2Spare2MetricTag - Append(items ...PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter - Set(index int, newObj PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter - Clear() PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter - clearHolderSlice() PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter - appendHolderSlice(item PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter -} - -func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) setMsg(msg *patternFlowGtpv2Spare2) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpv2Spare2MetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) Items() []PatternFlowGtpv2Spare2MetricTag { - return obj.patternFlowGtpv2Spare2MetricTagSlice -} - -func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) Add() PatternFlowGtpv2Spare2MetricTag { - newObj := &otg.PatternFlowGtpv2Spare2MetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpv2Spare2MetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpv2Spare2MetricTagSlice = append(obj.patternFlowGtpv2Spare2MetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) Append(items ...PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpv2Spare2MetricTagSlice = append(obj.patternFlowGtpv2Spare2MetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) Set(index int, newObj PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpv2Spare2MetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) Clear() PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpv2Spare2MetricTag{} - obj.patternFlowGtpv2Spare2MetricTagSlice = []PatternFlowGtpv2Spare2MetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) clearHolderSlice() PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { - if len(obj.patternFlowGtpv2Spare2MetricTagSlice) > 0 { - obj.patternFlowGtpv2Spare2MetricTagSlice = []PatternFlowGtpv2Spare2MetricTag{} - } - return obj -} -func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) appendHolderSlice(item PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { - obj.patternFlowGtpv2Spare2MetricTagSlice = append(obj.patternFlowGtpv2Spare2MetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpv2Spare2) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2Spare2.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpv2Spare2.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpv2Spare2MetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpv2Spare2) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpv2Spare2ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpv2Spare2Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpv2Spare2Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpv2Spare2Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpv2Spare2Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpv2Spare2Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2Spare2") - } - } else { - intVal := otg.PatternFlowGtpv2Spare2_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpv2Spare2_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowArpHardwareType ***** -type patternFlowArpHardwareType struct { - validation - obj *otg.PatternFlowArpHardwareType - marshaller marshalPatternFlowArpHardwareType - unMarshaller unMarshalPatternFlowArpHardwareType - incrementHolder PatternFlowArpHardwareTypeCounter - decrementHolder PatternFlowArpHardwareTypeCounter - metricTagsHolder PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter -} - -func NewPatternFlowArpHardwareType() PatternFlowArpHardwareType { - obj := patternFlowArpHardwareType{obj: &otg.PatternFlowArpHardwareType{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpHardwareType) msg() *otg.PatternFlowArpHardwareType { - return obj.obj -} - -func (obj *patternFlowArpHardwareType) setMsg(msg *otg.PatternFlowArpHardwareType) PatternFlowArpHardwareType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpHardwareType struct { - obj *patternFlowArpHardwareType -} - -type marshalPatternFlowArpHardwareType interface { - // ToProto marshals PatternFlowArpHardwareType to protobuf object *otg.PatternFlowArpHardwareType - ToProto() (*otg.PatternFlowArpHardwareType, error) - // ToPbText marshals PatternFlowArpHardwareType to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpHardwareType to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpHardwareType to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpHardwareType struct { - obj *patternFlowArpHardwareType -} - -type unMarshalPatternFlowArpHardwareType interface { - // FromProto unmarshals PatternFlowArpHardwareType from protobuf object *otg.PatternFlowArpHardwareType - FromProto(msg *otg.PatternFlowArpHardwareType) (PatternFlowArpHardwareType, error) - // FromPbText unmarshals PatternFlowArpHardwareType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpHardwareType from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpHardwareType from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpHardwareType) Marshal() marshalPatternFlowArpHardwareType { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpHardwareType{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpHardwareType) Unmarshal() unMarshalPatternFlowArpHardwareType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpHardwareType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpHardwareType) ToProto() (*otg.PatternFlowArpHardwareType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpHardwareType) FromProto(msg *otg.PatternFlowArpHardwareType) (PatternFlowArpHardwareType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpHardwareType) 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 *unMarshalpatternFlowArpHardwareType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowArpHardwareType) 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 *unMarshalpatternFlowArpHardwareType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowArpHardwareType) 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 *unMarshalpatternFlowArpHardwareType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowArpHardwareType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpHardwareType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpHardwareType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpHardwareType) Clone() (PatternFlowArpHardwareType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpHardwareType() - 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 -} - -func (obj *patternFlowArpHardwareType) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowArpHardwareType is network link protocol type -type PatternFlowArpHardwareType interface { - Validation - // msg marshals PatternFlowArpHardwareType to protobuf object *otg.PatternFlowArpHardwareType - // and doesn't set defaults - msg() *otg.PatternFlowArpHardwareType - // setMsg unmarshals PatternFlowArpHardwareType from protobuf object *otg.PatternFlowArpHardwareType - // and doesn't set defaults - setMsg(*otg.PatternFlowArpHardwareType) PatternFlowArpHardwareType - // provides marshal interface - Marshal() marshalPatternFlowArpHardwareType - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpHardwareType - // validate validates PatternFlowArpHardwareType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpHardwareType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowArpHardwareTypeChoiceEnum, set in PatternFlowArpHardwareType - Choice() PatternFlowArpHardwareTypeChoiceEnum - // setChoice assigns PatternFlowArpHardwareTypeChoiceEnum provided by user to PatternFlowArpHardwareType - setChoice(value PatternFlowArpHardwareTypeChoiceEnum) PatternFlowArpHardwareType - // HasChoice checks if Choice has been set in PatternFlowArpHardwareType - HasChoice() bool - // Value returns uint32, set in PatternFlowArpHardwareType. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowArpHardwareType - SetValue(value uint32) PatternFlowArpHardwareType - // HasValue checks if Value has been set in PatternFlowArpHardwareType - HasValue() bool - // Values returns []uint32, set in PatternFlowArpHardwareType. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowArpHardwareType - SetValues(value []uint32) PatternFlowArpHardwareType - // Increment returns PatternFlowArpHardwareTypeCounter, set in PatternFlowArpHardwareType. - // PatternFlowArpHardwareTypeCounter is integer counter pattern - Increment() PatternFlowArpHardwareTypeCounter - // SetIncrement assigns PatternFlowArpHardwareTypeCounter provided by user to PatternFlowArpHardwareType. - // PatternFlowArpHardwareTypeCounter is integer counter pattern - SetIncrement(value PatternFlowArpHardwareTypeCounter) PatternFlowArpHardwareType - // HasIncrement checks if Increment has been set in PatternFlowArpHardwareType - HasIncrement() bool - // Decrement returns PatternFlowArpHardwareTypeCounter, set in PatternFlowArpHardwareType. - // PatternFlowArpHardwareTypeCounter is integer counter pattern - Decrement() PatternFlowArpHardwareTypeCounter - // SetDecrement assigns PatternFlowArpHardwareTypeCounter provided by user to PatternFlowArpHardwareType. - // PatternFlowArpHardwareTypeCounter is integer counter pattern - SetDecrement(value PatternFlowArpHardwareTypeCounter) PatternFlowArpHardwareType - // HasDecrement checks if Decrement has been set in PatternFlowArpHardwareType - HasDecrement() bool - // MetricTags returns PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIterIter, set in PatternFlowArpHardwareType - MetricTags() PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter - setNil() -} - -type PatternFlowArpHardwareTypeChoiceEnum string - -// Enum of Choice on PatternFlowArpHardwareType -var PatternFlowArpHardwareTypeChoice = struct { - VALUE PatternFlowArpHardwareTypeChoiceEnum - VALUES PatternFlowArpHardwareTypeChoiceEnum - INCREMENT PatternFlowArpHardwareTypeChoiceEnum - DECREMENT PatternFlowArpHardwareTypeChoiceEnum -}{ - VALUE: PatternFlowArpHardwareTypeChoiceEnum("value"), - VALUES: PatternFlowArpHardwareTypeChoiceEnum("values"), - INCREMENT: PatternFlowArpHardwareTypeChoiceEnum("increment"), - DECREMENT: PatternFlowArpHardwareTypeChoiceEnum("decrement"), -} - -func (obj *patternFlowArpHardwareType) Choice() PatternFlowArpHardwareTypeChoiceEnum { - return PatternFlowArpHardwareTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowArpHardwareType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowArpHardwareType) setChoice(value PatternFlowArpHardwareTypeChoiceEnum) PatternFlowArpHardwareType { - intValue, ok := otg.PatternFlowArpHardwareType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowArpHardwareTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowArpHardwareType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowArpHardwareTypeChoice.VALUE { - defaultValue := uint32(1) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowArpHardwareTypeChoice.VALUES { - defaultValue := []uint32{1} - obj.obj.Values = defaultValue - } - - if value == PatternFlowArpHardwareTypeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowArpHardwareTypeCounter().msg() - } - - if value == PatternFlowArpHardwareTypeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowArpHardwareTypeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowArpHardwareType) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowArpHardwareTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowArpHardwareType) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowArpHardwareType object -func (obj *patternFlowArpHardwareType) SetValue(value uint32) PatternFlowArpHardwareType { - obj.setChoice(PatternFlowArpHardwareTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowArpHardwareType) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{1}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowArpHardwareType object -func (obj *patternFlowArpHardwareType) SetValues(value []uint32) PatternFlowArpHardwareType { - obj.setChoice(PatternFlowArpHardwareTypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowArpHardwareTypeCounter -func (obj *patternFlowArpHardwareType) Increment() PatternFlowArpHardwareTypeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowArpHardwareTypeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowArpHardwareTypeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowArpHardwareTypeCounter -func (obj *patternFlowArpHardwareType) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowArpHardwareTypeCounter value in the PatternFlowArpHardwareType object -func (obj *patternFlowArpHardwareType) SetIncrement(value PatternFlowArpHardwareTypeCounter) PatternFlowArpHardwareType { - obj.setChoice(PatternFlowArpHardwareTypeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowArpHardwareTypeCounter -func (obj *patternFlowArpHardwareType) Decrement() PatternFlowArpHardwareTypeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowArpHardwareTypeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowArpHardwareTypeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowArpHardwareTypeCounter -func (obj *patternFlowArpHardwareType) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowArpHardwareTypeCounter value in the PatternFlowArpHardwareType object -func (obj *patternFlowArpHardwareType) SetDecrement(value PatternFlowArpHardwareTypeCounter) PatternFlowArpHardwareType { - obj.setChoice(PatternFlowArpHardwareTypeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowArpHardwareTypeMetricTag -func (obj *patternFlowArpHardwareType) MetricTags() PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowArpHardwareTypeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter struct { - obj *patternFlowArpHardwareType - patternFlowArpHardwareTypeMetricTagSlice []PatternFlowArpHardwareTypeMetricTag - fieldPtr *[]*otg.PatternFlowArpHardwareTypeMetricTag -} - -func newPatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter(ptr *[]*otg.PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { - return &patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter interface { - setMsg(*patternFlowArpHardwareType) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter - Items() []PatternFlowArpHardwareTypeMetricTag - Add() PatternFlowArpHardwareTypeMetricTag - Append(items ...PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter - Set(index int, newObj PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter - Clear() PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter - clearHolderSlice() PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter - appendHolderSlice(item PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter -} - -func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) setMsg(msg *patternFlowArpHardwareType) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowArpHardwareTypeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) Items() []PatternFlowArpHardwareTypeMetricTag { - return obj.patternFlowArpHardwareTypeMetricTagSlice -} - -func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) Add() PatternFlowArpHardwareTypeMetricTag { - newObj := &otg.PatternFlowArpHardwareTypeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowArpHardwareTypeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowArpHardwareTypeMetricTagSlice = append(obj.patternFlowArpHardwareTypeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) Append(items ...PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowArpHardwareTypeMetricTagSlice = append(obj.patternFlowArpHardwareTypeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) Set(index int, newObj PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowArpHardwareTypeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) Clear() PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowArpHardwareTypeMetricTag{} - obj.patternFlowArpHardwareTypeMetricTagSlice = []PatternFlowArpHardwareTypeMetricTag{} - } - return obj -} -func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) clearHolderSlice() PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { - if len(obj.patternFlowArpHardwareTypeMetricTagSlice) > 0 { - obj.patternFlowArpHardwareTypeMetricTagSlice = []PatternFlowArpHardwareTypeMetricTag{} - } - return obj -} -func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) appendHolderSlice(item PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { - obj.patternFlowArpHardwareTypeMetricTagSlice = append(obj.patternFlowArpHardwareTypeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowArpHardwareType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpHardwareType.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowArpHardwareType.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowArpHardwareTypeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowArpHardwareType) setDefault() { - var choices_set int = 0 - var choice PatternFlowArpHardwareTypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowArpHardwareTypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowArpHardwareTypeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowArpHardwareTypeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowArpHardwareTypeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowArpHardwareTypeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpHardwareType") - } - } else { - intVal := otg.PatternFlowArpHardwareType_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowArpHardwareType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowArpProtocolType ***** -type patternFlowArpProtocolType struct { - validation - obj *otg.PatternFlowArpProtocolType - marshaller marshalPatternFlowArpProtocolType - unMarshaller unMarshalPatternFlowArpProtocolType - incrementHolder PatternFlowArpProtocolTypeCounter - decrementHolder PatternFlowArpProtocolTypeCounter - metricTagsHolder PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter -} - -func NewPatternFlowArpProtocolType() PatternFlowArpProtocolType { - obj := patternFlowArpProtocolType{obj: &otg.PatternFlowArpProtocolType{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpProtocolType) msg() *otg.PatternFlowArpProtocolType { - return obj.obj -} - -func (obj *patternFlowArpProtocolType) setMsg(msg *otg.PatternFlowArpProtocolType) PatternFlowArpProtocolType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpProtocolType struct { - obj *patternFlowArpProtocolType -} - -type marshalPatternFlowArpProtocolType interface { - // ToProto marshals PatternFlowArpProtocolType to protobuf object *otg.PatternFlowArpProtocolType - ToProto() (*otg.PatternFlowArpProtocolType, error) - // ToPbText marshals PatternFlowArpProtocolType to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpProtocolType to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpProtocolType to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpProtocolType struct { - obj *patternFlowArpProtocolType -} - -type unMarshalPatternFlowArpProtocolType interface { - // FromProto unmarshals PatternFlowArpProtocolType from protobuf object *otg.PatternFlowArpProtocolType - FromProto(msg *otg.PatternFlowArpProtocolType) (PatternFlowArpProtocolType, error) - // FromPbText unmarshals PatternFlowArpProtocolType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpProtocolType from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpProtocolType from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpProtocolType) Marshal() marshalPatternFlowArpProtocolType { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpProtocolType{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpProtocolType) Unmarshal() unMarshalPatternFlowArpProtocolType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpProtocolType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpProtocolType) ToProto() (*otg.PatternFlowArpProtocolType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpProtocolType) FromProto(msg *otg.PatternFlowArpProtocolType) (PatternFlowArpProtocolType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpProtocolType) 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 *unMarshalpatternFlowArpProtocolType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowArpProtocolType) 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 *unMarshalpatternFlowArpProtocolType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowArpProtocolType) 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 *unMarshalpatternFlowArpProtocolType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowArpProtocolType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpProtocolType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpProtocolType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpProtocolType) Clone() (PatternFlowArpProtocolType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpProtocolType() - 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 -} - -func (obj *patternFlowArpProtocolType) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowArpProtocolType is the internetwork protocol for which the ARP request is intended -type PatternFlowArpProtocolType interface { - Validation - // msg marshals PatternFlowArpProtocolType to protobuf object *otg.PatternFlowArpProtocolType - // and doesn't set defaults - msg() *otg.PatternFlowArpProtocolType - // setMsg unmarshals PatternFlowArpProtocolType from protobuf object *otg.PatternFlowArpProtocolType - // and doesn't set defaults - setMsg(*otg.PatternFlowArpProtocolType) PatternFlowArpProtocolType - // provides marshal interface - Marshal() marshalPatternFlowArpProtocolType - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpProtocolType - // validate validates PatternFlowArpProtocolType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpProtocolType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowArpProtocolTypeChoiceEnum, set in PatternFlowArpProtocolType - Choice() PatternFlowArpProtocolTypeChoiceEnum - // setChoice assigns PatternFlowArpProtocolTypeChoiceEnum provided by user to PatternFlowArpProtocolType - setChoice(value PatternFlowArpProtocolTypeChoiceEnum) PatternFlowArpProtocolType - // HasChoice checks if Choice has been set in PatternFlowArpProtocolType - HasChoice() bool - // Value returns uint32, set in PatternFlowArpProtocolType. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowArpProtocolType - SetValue(value uint32) PatternFlowArpProtocolType - // HasValue checks if Value has been set in PatternFlowArpProtocolType - HasValue() bool - // Values returns []uint32, set in PatternFlowArpProtocolType. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowArpProtocolType - SetValues(value []uint32) PatternFlowArpProtocolType - // Increment returns PatternFlowArpProtocolTypeCounter, set in PatternFlowArpProtocolType. - // PatternFlowArpProtocolTypeCounter is integer counter pattern - Increment() PatternFlowArpProtocolTypeCounter - // SetIncrement assigns PatternFlowArpProtocolTypeCounter provided by user to PatternFlowArpProtocolType. - // PatternFlowArpProtocolTypeCounter is integer counter pattern - SetIncrement(value PatternFlowArpProtocolTypeCounter) PatternFlowArpProtocolType - // HasIncrement checks if Increment has been set in PatternFlowArpProtocolType - HasIncrement() bool - // Decrement returns PatternFlowArpProtocolTypeCounter, set in PatternFlowArpProtocolType. - // PatternFlowArpProtocolTypeCounter is integer counter pattern - Decrement() PatternFlowArpProtocolTypeCounter - // SetDecrement assigns PatternFlowArpProtocolTypeCounter provided by user to PatternFlowArpProtocolType. - // PatternFlowArpProtocolTypeCounter is integer counter pattern - SetDecrement(value PatternFlowArpProtocolTypeCounter) PatternFlowArpProtocolType - // HasDecrement checks if Decrement has been set in PatternFlowArpProtocolType - HasDecrement() bool - // MetricTags returns PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIterIter, set in PatternFlowArpProtocolType - MetricTags() PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter - setNil() -} - -type PatternFlowArpProtocolTypeChoiceEnum string - -// Enum of Choice on PatternFlowArpProtocolType -var PatternFlowArpProtocolTypeChoice = struct { - VALUE PatternFlowArpProtocolTypeChoiceEnum - VALUES PatternFlowArpProtocolTypeChoiceEnum - INCREMENT PatternFlowArpProtocolTypeChoiceEnum - DECREMENT PatternFlowArpProtocolTypeChoiceEnum -}{ - VALUE: PatternFlowArpProtocolTypeChoiceEnum("value"), - VALUES: PatternFlowArpProtocolTypeChoiceEnum("values"), - INCREMENT: PatternFlowArpProtocolTypeChoiceEnum("increment"), - DECREMENT: PatternFlowArpProtocolTypeChoiceEnum("decrement"), -} - -func (obj *patternFlowArpProtocolType) Choice() PatternFlowArpProtocolTypeChoiceEnum { - return PatternFlowArpProtocolTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowArpProtocolType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowArpProtocolType) setChoice(value PatternFlowArpProtocolTypeChoiceEnum) PatternFlowArpProtocolType { - intValue, ok := otg.PatternFlowArpProtocolType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowArpProtocolTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowArpProtocolType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowArpProtocolTypeChoice.VALUE { - defaultValue := uint32(2048) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowArpProtocolTypeChoice.VALUES { - defaultValue := []uint32{2048} - obj.obj.Values = defaultValue - } - - if value == PatternFlowArpProtocolTypeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowArpProtocolTypeCounter().msg() - } - - if value == PatternFlowArpProtocolTypeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowArpProtocolTypeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowArpProtocolType) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowArpProtocolTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowArpProtocolType) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowArpProtocolType object -func (obj *patternFlowArpProtocolType) SetValue(value uint32) PatternFlowArpProtocolType { - obj.setChoice(PatternFlowArpProtocolTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowArpProtocolType) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{2048}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowArpProtocolType object -func (obj *patternFlowArpProtocolType) SetValues(value []uint32) PatternFlowArpProtocolType { - obj.setChoice(PatternFlowArpProtocolTypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowArpProtocolTypeCounter -func (obj *patternFlowArpProtocolType) Increment() PatternFlowArpProtocolTypeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowArpProtocolTypeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowArpProtocolTypeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowArpProtocolTypeCounter -func (obj *patternFlowArpProtocolType) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowArpProtocolTypeCounter value in the PatternFlowArpProtocolType object -func (obj *patternFlowArpProtocolType) SetIncrement(value PatternFlowArpProtocolTypeCounter) PatternFlowArpProtocolType { - obj.setChoice(PatternFlowArpProtocolTypeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowArpProtocolTypeCounter -func (obj *patternFlowArpProtocolType) Decrement() PatternFlowArpProtocolTypeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowArpProtocolTypeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowArpProtocolTypeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowArpProtocolTypeCounter -func (obj *patternFlowArpProtocolType) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowArpProtocolTypeCounter value in the PatternFlowArpProtocolType object -func (obj *patternFlowArpProtocolType) SetDecrement(value PatternFlowArpProtocolTypeCounter) PatternFlowArpProtocolType { - obj.setChoice(PatternFlowArpProtocolTypeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowArpProtocolTypeMetricTag -func (obj *patternFlowArpProtocolType) MetricTags() PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowArpProtocolTypeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter struct { - obj *patternFlowArpProtocolType - patternFlowArpProtocolTypeMetricTagSlice []PatternFlowArpProtocolTypeMetricTag - fieldPtr *[]*otg.PatternFlowArpProtocolTypeMetricTag -} - -func newPatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter(ptr *[]*otg.PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { - return &patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter interface { - setMsg(*patternFlowArpProtocolType) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter - Items() []PatternFlowArpProtocolTypeMetricTag - Add() PatternFlowArpProtocolTypeMetricTag - Append(items ...PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter - Set(index int, newObj PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter - Clear() PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter - clearHolderSlice() PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter - appendHolderSlice(item PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter -} - -func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) setMsg(msg *patternFlowArpProtocolType) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowArpProtocolTypeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) Items() []PatternFlowArpProtocolTypeMetricTag { - return obj.patternFlowArpProtocolTypeMetricTagSlice -} - -func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) Add() PatternFlowArpProtocolTypeMetricTag { - newObj := &otg.PatternFlowArpProtocolTypeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowArpProtocolTypeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowArpProtocolTypeMetricTagSlice = append(obj.patternFlowArpProtocolTypeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) Append(items ...PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowArpProtocolTypeMetricTagSlice = append(obj.patternFlowArpProtocolTypeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) Set(index int, newObj PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowArpProtocolTypeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) Clear() PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowArpProtocolTypeMetricTag{} - obj.patternFlowArpProtocolTypeMetricTagSlice = []PatternFlowArpProtocolTypeMetricTag{} - } - return obj -} -func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) clearHolderSlice() PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { - if len(obj.patternFlowArpProtocolTypeMetricTagSlice) > 0 { - obj.patternFlowArpProtocolTypeMetricTagSlice = []PatternFlowArpProtocolTypeMetricTag{} - } - return obj -} -func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) appendHolderSlice(item PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { - obj.patternFlowArpProtocolTypeMetricTagSlice = append(obj.patternFlowArpProtocolTypeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowArpProtocolType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpProtocolType.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowArpProtocolType.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowArpProtocolTypeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowArpProtocolType) setDefault() { - var choices_set int = 0 - var choice PatternFlowArpProtocolTypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowArpProtocolTypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowArpProtocolTypeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowArpProtocolTypeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowArpProtocolTypeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowArpProtocolTypeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpProtocolType") - } - } else { - intVal := otg.PatternFlowArpProtocolType_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowArpProtocolType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowArpHardwareLength ***** -type patternFlowArpHardwareLength struct { - validation - obj *otg.PatternFlowArpHardwareLength - marshaller marshalPatternFlowArpHardwareLength - unMarshaller unMarshalPatternFlowArpHardwareLength - incrementHolder PatternFlowArpHardwareLengthCounter - decrementHolder PatternFlowArpHardwareLengthCounter - metricTagsHolder PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter -} - -func NewPatternFlowArpHardwareLength() PatternFlowArpHardwareLength { - obj := patternFlowArpHardwareLength{obj: &otg.PatternFlowArpHardwareLength{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpHardwareLength) msg() *otg.PatternFlowArpHardwareLength { - return obj.obj -} - -func (obj *patternFlowArpHardwareLength) setMsg(msg *otg.PatternFlowArpHardwareLength) PatternFlowArpHardwareLength { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpHardwareLength struct { - obj *patternFlowArpHardwareLength -} - -type marshalPatternFlowArpHardwareLength interface { - // ToProto marshals PatternFlowArpHardwareLength to protobuf object *otg.PatternFlowArpHardwareLength - ToProto() (*otg.PatternFlowArpHardwareLength, error) - // ToPbText marshals PatternFlowArpHardwareLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpHardwareLength to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpHardwareLength to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpHardwareLength struct { - obj *patternFlowArpHardwareLength -} - -type unMarshalPatternFlowArpHardwareLength interface { - // FromProto unmarshals PatternFlowArpHardwareLength from protobuf object *otg.PatternFlowArpHardwareLength - FromProto(msg *otg.PatternFlowArpHardwareLength) (PatternFlowArpHardwareLength, error) - // FromPbText unmarshals PatternFlowArpHardwareLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpHardwareLength from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpHardwareLength from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpHardwareLength) Marshal() marshalPatternFlowArpHardwareLength { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpHardwareLength{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpHardwareLength) Unmarshal() unMarshalPatternFlowArpHardwareLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpHardwareLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpHardwareLength) ToProto() (*otg.PatternFlowArpHardwareLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpHardwareLength) FromProto(msg *otg.PatternFlowArpHardwareLength) (PatternFlowArpHardwareLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpHardwareLength) 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 *unMarshalpatternFlowArpHardwareLength) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowArpHardwareLength) 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 *unMarshalpatternFlowArpHardwareLength) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowArpHardwareLength) 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 *unMarshalpatternFlowArpHardwareLength) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowArpHardwareLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpHardwareLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpHardwareLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpHardwareLength) Clone() (PatternFlowArpHardwareLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpHardwareLength() - 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 -} - -func (obj *patternFlowArpHardwareLength) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowArpHardwareLength is length (in octets) of a hardware address -type PatternFlowArpHardwareLength interface { - Validation - // msg marshals PatternFlowArpHardwareLength to protobuf object *otg.PatternFlowArpHardwareLength - // and doesn't set defaults - msg() *otg.PatternFlowArpHardwareLength - // setMsg unmarshals PatternFlowArpHardwareLength from protobuf object *otg.PatternFlowArpHardwareLength - // and doesn't set defaults - setMsg(*otg.PatternFlowArpHardwareLength) PatternFlowArpHardwareLength - // provides marshal interface - Marshal() marshalPatternFlowArpHardwareLength - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpHardwareLength - // validate validates PatternFlowArpHardwareLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpHardwareLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowArpHardwareLengthChoiceEnum, set in PatternFlowArpHardwareLength - Choice() PatternFlowArpHardwareLengthChoiceEnum - // setChoice assigns PatternFlowArpHardwareLengthChoiceEnum provided by user to PatternFlowArpHardwareLength - setChoice(value PatternFlowArpHardwareLengthChoiceEnum) PatternFlowArpHardwareLength - // HasChoice checks if Choice has been set in PatternFlowArpHardwareLength - HasChoice() bool - // Value returns uint32, set in PatternFlowArpHardwareLength. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowArpHardwareLength - SetValue(value uint32) PatternFlowArpHardwareLength - // HasValue checks if Value has been set in PatternFlowArpHardwareLength - HasValue() bool - // Values returns []uint32, set in PatternFlowArpHardwareLength. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowArpHardwareLength - SetValues(value []uint32) PatternFlowArpHardwareLength - // Increment returns PatternFlowArpHardwareLengthCounter, set in PatternFlowArpHardwareLength. - // PatternFlowArpHardwareLengthCounter is integer counter pattern - Increment() PatternFlowArpHardwareLengthCounter - // SetIncrement assigns PatternFlowArpHardwareLengthCounter provided by user to PatternFlowArpHardwareLength. - // PatternFlowArpHardwareLengthCounter is integer counter pattern - SetIncrement(value PatternFlowArpHardwareLengthCounter) PatternFlowArpHardwareLength - // HasIncrement checks if Increment has been set in PatternFlowArpHardwareLength - HasIncrement() bool - // Decrement returns PatternFlowArpHardwareLengthCounter, set in PatternFlowArpHardwareLength. - // PatternFlowArpHardwareLengthCounter is integer counter pattern - Decrement() PatternFlowArpHardwareLengthCounter - // SetDecrement assigns PatternFlowArpHardwareLengthCounter provided by user to PatternFlowArpHardwareLength. - // PatternFlowArpHardwareLengthCounter is integer counter pattern - SetDecrement(value PatternFlowArpHardwareLengthCounter) PatternFlowArpHardwareLength - // HasDecrement checks if Decrement has been set in PatternFlowArpHardwareLength - HasDecrement() bool - // MetricTags returns PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIterIter, set in PatternFlowArpHardwareLength - MetricTags() PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter - setNil() -} - -type PatternFlowArpHardwareLengthChoiceEnum string - -// Enum of Choice on PatternFlowArpHardwareLength -var PatternFlowArpHardwareLengthChoice = struct { - VALUE PatternFlowArpHardwareLengthChoiceEnum - VALUES PatternFlowArpHardwareLengthChoiceEnum - INCREMENT PatternFlowArpHardwareLengthChoiceEnum - DECREMENT PatternFlowArpHardwareLengthChoiceEnum -}{ - VALUE: PatternFlowArpHardwareLengthChoiceEnum("value"), - VALUES: PatternFlowArpHardwareLengthChoiceEnum("values"), - INCREMENT: PatternFlowArpHardwareLengthChoiceEnum("increment"), - DECREMENT: PatternFlowArpHardwareLengthChoiceEnum("decrement"), -} - -func (obj *patternFlowArpHardwareLength) Choice() PatternFlowArpHardwareLengthChoiceEnum { - return PatternFlowArpHardwareLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowArpHardwareLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowArpHardwareLength) setChoice(value PatternFlowArpHardwareLengthChoiceEnum) PatternFlowArpHardwareLength { - intValue, ok := otg.PatternFlowArpHardwareLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowArpHardwareLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowArpHardwareLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowArpHardwareLengthChoice.VALUE { - defaultValue := uint32(6) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowArpHardwareLengthChoice.VALUES { - defaultValue := []uint32{6} - obj.obj.Values = defaultValue - } - - if value == PatternFlowArpHardwareLengthChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowArpHardwareLengthCounter().msg() - } - - if value == PatternFlowArpHardwareLengthChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowArpHardwareLengthCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowArpHardwareLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowArpHardwareLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowArpHardwareLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowArpHardwareLength object -func (obj *patternFlowArpHardwareLength) SetValue(value uint32) PatternFlowArpHardwareLength { - obj.setChoice(PatternFlowArpHardwareLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowArpHardwareLength) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{6}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowArpHardwareLength object -func (obj *patternFlowArpHardwareLength) SetValues(value []uint32) PatternFlowArpHardwareLength { - obj.setChoice(PatternFlowArpHardwareLengthChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowArpHardwareLengthCounter -func (obj *patternFlowArpHardwareLength) Increment() PatternFlowArpHardwareLengthCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowArpHardwareLengthChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowArpHardwareLengthCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowArpHardwareLengthCounter -func (obj *patternFlowArpHardwareLength) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowArpHardwareLengthCounter value in the PatternFlowArpHardwareLength object -func (obj *patternFlowArpHardwareLength) SetIncrement(value PatternFlowArpHardwareLengthCounter) PatternFlowArpHardwareLength { - obj.setChoice(PatternFlowArpHardwareLengthChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowArpHardwareLengthCounter -func (obj *patternFlowArpHardwareLength) Decrement() PatternFlowArpHardwareLengthCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowArpHardwareLengthChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowArpHardwareLengthCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowArpHardwareLengthCounter -func (obj *patternFlowArpHardwareLength) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowArpHardwareLengthCounter value in the PatternFlowArpHardwareLength object -func (obj *patternFlowArpHardwareLength) SetDecrement(value PatternFlowArpHardwareLengthCounter) PatternFlowArpHardwareLength { - obj.setChoice(PatternFlowArpHardwareLengthChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowArpHardwareLengthMetricTag -func (obj *patternFlowArpHardwareLength) MetricTags() PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowArpHardwareLengthMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter struct { - obj *patternFlowArpHardwareLength - patternFlowArpHardwareLengthMetricTagSlice []PatternFlowArpHardwareLengthMetricTag - fieldPtr *[]*otg.PatternFlowArpHardwareLengthMetricTag -} - -func newPatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter(ptr *[]*otg.PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { - return &patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter interface { - setMsg(*patternFlowArpHardwareLength) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter - Items() []PatternFlowArpHardwareLengthMetricTag - Add() PatternFlowArpHardwareLengthMetricTag - Append(items ...PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter - Set(index int, newObj PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter - Clear() PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter - clearHolderSlice() PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter - appendHolderSlice(item PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter -} - -func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) setMsg(msg *patternFlowArpHardwareLength) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowArpHardwareLengthMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) Items() []PatternFlowArpHardwareLengthMetricTag { - return obj.patternFlowArpHardwareLengthMetricTagSlice -} - -func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) Add() PatternFlowArpHardwareLengthMetricTag { - newObj := &otg.PatternFlowArpHardwareLengthMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowArpHardwareLengthMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowArpHardwareLengthMetricTagSlice = append(obj.patternFlowArpHardwareLengthMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) Append(items ...PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowArpHardwareLengthMetricTagSlice = append(obj.patternFlowArpHardwareLengthMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) Set(index int, newObj PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowArpHardwareLengthMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) Clear() PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowArpHardwareLengthMetricTag{} - obj.patternFlowArpHardwareLengthMetricTagSlice = []PatternFlowArpHardwareLengthMetricTag{} - } - return obj -} -func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) clearHolderSlice() PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { - if len(obj.patternFlowArpHardwareLengthMetricTagSlice) > 0 { - obj.patternFlowArpHardwareLengthMetricTagSlice = []PatternFlowArpHardwareLengthMetricTag{} - } - return obj -} -func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) appendHolderSlice(item PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { - obj.patternFlowArpHardwareLengthMetricTagSlice = append(obj.patternFlowArpHardwareLengthMetricTagSlice, item) - return obj -} - -func (obj *patternFlowArpHardwareLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpHardwareLength.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowArpHardwareLength.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowArpHardwareLengthMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowArpHardwareLength) setDefault() { - var choices_set int = 0 - var choice PatternFlowArpHardwareLengthChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowArpHardwareLengthChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowArpHardwareLengthChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowArpHardwareLengthChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowArpHardwareLengthChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowArpHardwareLengthChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpHardwareLength") - } - } else { - intVal := otg.PatternFlowArpHardwareLength_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowArpHardwareLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowArpProtocolLength ***** -type patternFlowArpProtocolLength struct { - validation - obj *otg.PatternFlowArpProtocolLength - marshaller marshalPatternFlowArpProtocolLength - unMarshaller unMarshalPatternFlowArpProtocolLength - incrementHolder PatternFlowArpProtocolLengthCounter - decrementHolder PatternFlowArpProtocolLengthCounter - metricTagsHolder PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter -} - -func NewPatternFlowArpProtocolLength() PatternFlowArpProtocolLength { - obj := patternFlowArpProtocolLength{obj: &otg.PatternFlowArpProtocolLength{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpProtocolLength) msg() *otg.PatternFlowArpProtocolLength { - return obj.obj -} - -func (obj *patternFlowArpProtocolLength) setMsg(msg *otg.PatternFlowArpProtocolLength) PatternFlowArpProtocolLength { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpProtocolLength struct { - obj *patternFlowArpProtocolLength -} - -type marshalPatternFlowArpProtocolLength interface { - // ToProto marshals PatternFlowArpProtocolLength to protobuf object *otg.PatternFlowArpProtocolLength - ToProto() (*otg.PatternFlowArpProtocolLength, error) - // ToPbText marshals PatternFlowArpProtocolLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpProtocolLength to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpProtocolLength to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpProtocolLength struct { - obj *patternFlowArpProtocolLength -} - -type unMarshalPatternFlowArpProtocolLength interface { - // FromProto unmarshals PatternFlowArpProtocolLength from protobuf object *otg.PatternFlowArpProtocolLength - FromProto(msg *otg.PatternFlowArpProtocolLength) (PatternFlowArpProtocolLength, error) - // FromPbText unmarshals PatternFlowArpProtocolLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpProtocolLength from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpProtocolLength from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpProtocolLength) Marshal() marshalPatternFlowArpProtocolLength { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpProtocolLength{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpProtocolLength) Unmarshal() unMarshalPatternFlowArpProtocolLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpProtocolLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpProtocolLength) ToProto() (*otg.PatternFlowArpProtocolLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpProtocolLength) FromProto(msg *otg.PatternFlowArpProtocolLength) (PatternFlowArpProtocolLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpProtocolLength) 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 *unMarshalpatternFlowArpProtocolLength) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowArpProtocolLength) 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 *unMarshalpatternFlowArpProtocolLength) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowArpProtocolLength) 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 *unMarshalpatternFlowArpProtocolLength) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowArpProtocolLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpProtocolLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpProtocolLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpProtocolLength) Clone() (PatternFlowArpProtocolLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpProtocolLength() - 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 -} - -func (obj *patternFlowArpProtocolLength) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowArpProtocolLength is length (in octets) of internetwork addresses -type PatternFlowArpProtocolLength interface { - Validation - // msg marshals PatternFlowArpProtocolLength to protobuf object *otg.PatternFlowArpProtocolLength - // and doesn't set defaults - msg() *otg.PatternFlowArpProtocolLength - // setMsg unmarshals PatternFlowArpProtocolLength from protobuf object *otg.PatternFlowArpProtocolLength - // and doesn't set defaults - setMsg(*otg.PatternFlowArpProtocolLength) PatternFlowArpProtocolLength - // provides marshal interface - Marshal() marshalPatternFlowArpProtocolLength - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpProtocolLength - // validate validates PatternFlowArpProtocolLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpProtocolLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowArpProtocolLengthChoiceEnum, set in PatternFlowArpProtocolLength - Choice() PatternFlowArpProtocolLengthChoiceEnum - // setChoice assigns PatternFlowArpProtocolLengthChoiceEnum provided by user to PatternFlowArpProtocolLength - setChoice(value PatternFlowArpProtocolLengthChoiceEnum) PatternFlowArpProtocolLength - // HasChoice checks if Choice has been set in PatternFlowArpProtocolLength - HasChoice() bool - // Value returns uint32, set in PatternFlowArpProtocolLength. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowArpProtocolLength - SetValue(value uint32) PatternFlowArpProtocolLength - // HasValue checks if Value has been set in PatternFlowArpProtocolLength - HasValue() bool - // Values returns []uint32, set in PatternFlowArpProtocolLength. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowArpProtocolLength - SetValues(value []uint32) PatternFlowArpProtocolLength - // Increment returns PatternFlowArpProtocolLengthCounter, set in PatternFlowArpProtocolLength. - // PatternFlowArpProtocolLengthCounter is integer counter pattern - Increment() PatternFlowArpProtocolLengthCounter - // SetIncrement assigns PatternFlowArpProtocolLengthCounter provided by user to PatternFlowArpProtocolLength. - // PatternFlowArpProtocolLengthCounter is integer counter pattern - SetIncrement(value PatternFlowArpProtocolLengthCounter) PatternFlowArpProtocolLength - // HasIncrement checks if Increment has been set in PatternFlowArpProtocolLength - HasIncrement() bool - // Decrement returns PatternFlowArpProtocolLengthCounter, set in PatternFlowArpProtocolLength. - // PatternFlowArpProtocolLengthCounter is integer counter pattern - Decrement() PatternFlowArpProtocolLengthCounter - // SetDecrement assigns PatternFlowArpProtocolLengthCounter provided by user to PatternFlowArpProtocolLength. - // PatternFlowArpProtocolLengthCounter is integer counter pattern - SetDecrement(value PatternFlowArpProtocolLengthCounter) PatternFlowArpProtocolLength - // HasDecrement checks if Decrement has been set in PatternFlowArpProtocolLength - HasDecrement() bool - // MetricTags returns PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIterIter, set in PatternFlowArpProtocolLength - MetricTags() PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter - setNil() -} - -type PatternFlowArpProtocolLengthChoiceEnum string - -// Enum of Choice on PatternFlowArpProtocolLength -var PatternFlowArpProtocolLengthChoice = struct { - VALUE PatternFlowArpProtocolLengthChoiceEnum - VALUES PatternFlowArpProtocolLengthChoiceEnum - INCREMENT PatternFlowArpProtocolLengthChoiceEnum - DECREMENT PatternFlowArpProtocolLengthChoiceEnum -}{ - VALUE: PatternFlowArpProtocolLengthChoiceEnum("value"), - VALUES: PatternFlowArpProtocolLengthChoiceEnum("values"), - INCREMENT: PatternFlowArpProtocolLengthChoiceEnum("increment"), - DECREMENT: PatternFlowArpProtocolLengthChoiceEnum("decrement"), -} - -func (obj *patternFlowArpProtocolLength) Choice() PatternFlowArpProtocolLengthChoiceEnum { - return PatternFlowArpProtocolLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowArpProtocolLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowArpProtocolLength) setChoice(value PatternFlowArpProtocolLengthChoiceEnum) PatternFlowArpProtocolLength { - intValue, ok := otg.PatternFlowArpProtocolLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowArpProtocolLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowArpProtocolLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowArpProtocolLengthChoice.VALUE { - defaultValue := uint32(4) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowArpProtocolLengthChoice.VALUES { - defaultValue := []uint32{4} - obj.obj.Values = defaultValue - } - - if value == PatternFlowArpProtocolLengthChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowArpProtocolLengthCounter().msg() - } - - if value == PatternFlowArpProtocolLengthChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowArpProtocolLengthCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowArpProtocolLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowArpProtocolLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowArpProtocolLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowArpProtocolLength object -func (obj *patternFlowArpProtocolLength) SetValue(value uint32) PatternFlowArpProtocolLength { - obj.setChoice(PatternFlowArpProtocolLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowArpProtocolLength) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{4}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowArpProtocolLength object -func (obj *patternFlowArpProtocolLength) SetValues(value []uint32) PatternFlowArpProtocolLength { - obj.setChoice(PatternFlowArpProtocolLengthChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowArpProtocolLengthCounter -func (obj *patternFlowArpProtocolLength) Increment() PatternFlowArpProtocolLengthCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowArpProtocolLengthChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowArpProtocolLengthCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowArpProtocolLengthCounter -func (obj *patternFlowArpProtocolLength) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowArpProtocolLengthCounter value in the PatternFlowArpProtocolLength object -func (obj *patternFlowArpProtocolLength) SetIncrement(value PatternFlowArpProtocolLengthCounter) PatternFlowArpProtocolLength { - obj.setChoice(PatternFlowArpProtocolLengthChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowArpProtocolLengthCounter -func (obj *patternFlowArpProtocolLength) Decrement() PatternFlowArpProtocolLengthCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowArpProtocolLengthChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowArpProtocolLengthCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowArpProtocolLengthCounter -func (obj *patternFlowArpProtocolLength) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowArpProtocolLengthCounter value in the PatternFlowArpProtocolLength object -func (obj *patternFlowArpProtocolLength) SetDecrement(value PatternFlowArpProtocolLengthCounter) PatternFlowArpProtocolLength { - obj.setChoice(PatternFlowArpProtocolLengthChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowArpProtocolLengthMetricTag -func (obj *patternFlowArpProtocolLength) MetricTags() PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowArpProtocolLengthMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter struct { - obj *patternFlowArpProtocolLength - patternFlowArpProtocolLengthMetricTagSlice []PatternFlowArpProtocolLengthMetricTag - fieldPtr *[]*otg.PatternFlowArpProtocolLengthMetricTag -} - -func newPatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter(ptr *[]*otg.PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { - return &patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter interface { - setMsg(*patternFlowArpProtocolLength) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter - Items() []PatternFlowArpProtocolLengthMetricTag - Add() PatternFlowArpProtocolLengthMetricTag - Append(items ...PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter - Set(index int, newObj PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter - Clear() PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter - clearHolderSlice() PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter - appendHolderSlice(item PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter -} - -func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) setMsg(msg *patternFlowArpProtocolLength) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowArpProtocolLengthMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) Items() []PatternFlowArpProtocolLengthMetricTag { - return obj.patternFlowArpProtocolLengthMetricTagSlice -} - -func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) Add() PatternFlowArpProtocolLengthMetricTag { - newObj := &otg.PatternFlowArpProtocolLengthMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowArpProtocolLengthMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowArpProtocolLengthMetricTagSlice = append(obj.patternFlowArpProtocolLengthMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) Append(items ...PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowArpProtocolLengthMetricTagSlice = append(obj.patternFlowArpProtocolLengthMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) Set(index int, newObj PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowArpProtocolLengthMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) Clear() PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowArpProtocolLengthMetricTag{} - obj.patternFlowArpProtocolLengthMetricTagSlice = []PatternFlowArpProtocolLengthMetricTag{} - } - return obj -} -func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) clearHolderSlice() PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { - if len(obj.patternFlowArpProtocolLengthMetricTagSlice) > 0 { - obj.patternFlowArpProtocolLengthMetricTagSlice = []PatternFlowArpProtocolLengthMetricTag{} - } - return obj -} -func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) appendHolderSlice(item PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { - obj.patternFlowArpProtocolLengthMetricTagSlice = append(obj.patternFlowArpProtocolLengthMetricTagSlice, item) - return obj -} - -func (obj *patternFlowArpProtocolLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpProtocolLength.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowArpProtocolLength.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowArpProtocolLengthMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowArpProtocolLength) setDefault() { - var choices_set int = 0 - var choice PatternFlowArpProtocolLengthChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowArpProtocolLengthChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowArpProtocolLengthChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowArpProtocolLengthChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowArpProtocolLengthChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowArpProtocolLengthChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpProtocolLength") - } - } else { - intVal := otg.PatternFlowArpProtocolLength_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowArpProtocolLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowArpOperation ***** -type patternFlowArpOperation struct { - validation - obj *otg.PatternFlowArpOperation - marshaller marshalPatternFlowArpOperation - unMarshaller unMarshalPatternFlowArpOperation - incrementHolder PatternFlowArpOperationCounter - decrementHolder PatternFlowArpOperationCounter - metricTagsHolder PatternFlowArpOperationPatternFlowArpOperationMetricTagIter -} - -func NewPatternFlowArpOperation() PatternFlowArpOperation { - obj := patternFlowArpOperation{obj: &otg.PatternFlowArpOperation{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpOperation) msg() *otg.PatternFlowArpOperation { - return obj.obj -} - -func (obj *patternFlowArpOperation) setMsg(msg *otg.PatternFlowArpOperation) PatternFlowArpOperation { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpOperation struct { - obj *patternFlowArpOperation -} - -type marshalPatternFlowArpOperation interface { - // ToProto marshals PatternFlowArpOperation to protobuf object *otg.PatternFlowArpOperation - ToProto() (*otg.PatternFlowArpOperation, error) - // ToPbText marshals PatternFlowArpOperation to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpOperation to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpOperation to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpOperation struct { - obj *patternFlowArpOperation -} - -type unMarshalPatternFlowArpOperation interface { - // FromProto unmarshals PatternFlowArpOperation from protobuf object *otg.PatternFlowArpOperation - FromProto(msg *otg.PatternFlowArpOperation) (PatternFlowArpOperation, error) - // FromPbText unmarshals PatternFlowArpOperation from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpOperation from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpOperation from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpOperation) Marshal() marshalPatternFlowArpOperation { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpOperation{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpOperation) Unmarshal() unMarshalPatternFlowArpOperation { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpOperation{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpOperation) ToProto() (*otg.PatternFlowArpOperation, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpOperation) FromProto(msg *otg.PatternFlowArpOperation) (PatternFlowArpOperation, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpOperation) 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 *unMarshalpatternFlowArpOperation) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowArpOperation) 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 *unMarshalpatternFlowArpOperation) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowArpOperation) 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 *unMarshalpatternFlowArpOperation) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowArpOperation) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpOperation) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpOperation) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpOperation) Clone() (PatternFlowArpOperation, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpOperation() - 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 -} - -func (obj *patternFlowArpOperation) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowArpOperation is the operation that the sender is performing -type PatternFlowArpOperation interface { - Validation - // msg marshals PatternFlowArpOperation to protobuf object *otg.PatternFlowArpOperation - // and doesn't set defaults - msg() *otg.PatternFlowArpOperation - // setMsg unmarshals PatternFlowArpOperation from protobuf object *otg.PatternFlowArpOperation - // and doesn't set defaults - setMsg(*otg.PatternFlowArpOperation) PatternFlowArpOperation - // provides marshal interface - Marshal() marshalPatternFlowArpOperation - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpOperation - // validate validates PatternFlowArpOperation - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpOperation, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowArpOperationChoiceEnum, set in PatternFlowArpOperation - Choice() PatternFlowArpOperationChoiceEnum - // setChoice assigns PatternFlowArpOperationChoiceEnum provided by user to PatternFlowArpOperation - setChoice(value PatternFlowArpOperationChoiceEnum) PatternFlowArpOperation - // HasChoice checks if Choice has been set in PatternFlowArpOperation - HasChoice() bool - // Value returns uint32, set in PatternFlowArpOperation. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowArpOperation - SetValue(value uint32) PatternFlowArpOperation - // HasValue checks if Value has been set in PatternFlowArpOperation - HasValue() bool - // Values returns []uint32, set in PatternFlowArpOperation. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowArpOperation - SetValues(value []uint32) PatternFlowArpOperation - // Increment returns PatternFlowArpOperationCounter, set in PatternFlowArpOperation. - // PatternFlowArpOperationCounter is integer counter pattern - Increment() PatternFlowArpOperationCounter - // SetIncrement assigns PatternFlowArpOperationCounter provided by user to PatternFlowArpOperation. - // PatternFlowArpOperationCounter is integer counter pattern - SetIncrement(value PatternFlowArpOperationCounter) PatternFlowArpOperation - // HasIncrement checks if Increment has been set in PatternFlowArpOperation - HasIncrement() bool - // Decrement returns PatternFlowArpOperationCounter, set in PatternFlowArpOperation. - // PatternFlowArpOperationCounter is integer counter pattern - Decrement() PatternFlowArpOperationCounter - // SetDecrement assigns PatternFlowArpOperationCounter provided by user to PatternFlowArpOperation. - // PatternFlowArpOperationCounter is integer counter pattern - SetDecrement(value PatternFlowArpOperationCounter) PatternFlowArpOperation - // HasDecrement checks if Decrement has been set in PatternFlowArpOperation - HasDecrement() bool - // MetricTags returns PatternFlowArpOperationPatternFlowArpOperationMetricTagIterIter, set in PatternFlowArpOperation - MetricTags() PatternFlowArpOperationPatternFlowArpOperationMetricTagIter - setNil() -} - -type PatternFlowArpOperationChoiceEnum string - -// Enum of Choice on PatternFlowArpOperation -var PatternFlowArpOperationChoice = struct { - VALUE PatternFlowArpOperationChoiceEnum - VALUES PatternFlowArpOperationChoiceEnum - INCREMENT PatternFlowArpOperationChoiceEnum - DECREMENT PatternFlowArpOperationChoiceEnum -}{ - VALUE: PatternFlowArpOperationChoiceEnum("value"), - VALUES: PatternFlowArpOperationChoiceEnum("values"), - INCREMENT: PatternFlowArpOperationChoiceEnum("increment"), - DECREMENT: PatternFlowArpOperationChoiceEnum("decrement"), -} - -func (obj *patternFlowArpOperation) Choice() PatternFlowArpOperationChoiceEnum { - return PatternFlowArpOperationChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowArpOperation) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowArpOperation) setChoice(value PatternFlowArpOperationChoiceEnum) PatternFlowArpOperation { - intValue, ok := otg.PatternFlowArpOperation_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowArpOperationChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowArpOperation_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowArpOperationChoice.VALUE { - defaultValue := uint32(1) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowArpOperationChoice.VALUES { - defaultValue := []uint32{1} - obj.obj.Values = defaultValue - } - - if value == PatternFlowArpOperationChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowArpOperationCounter().msg() - } - - if value == PatternFlowArpOperationChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowArpOperationCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowArpOperation) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowArpOperationChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowArpOperation) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowArpOperation object -func (obj *patternFlowArpOperation) SetValue(value uint32) PatternFlowArpOperation { - obj.setChoice(PatternFlowArpOperationChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowArpOperation) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{1}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowArpOperation object -func (obj *patternFlowArpOperation) SetValues(value []uint32) PatternFlowArpOperation { - obj.setChoice(PatternFlowArpOperationChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowArpOperationCounter -func (obj *patternFlowArpOperation) Increment() PatternFlowArpOperationCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowArpOperationChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowArpOperationCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowArpOperationCounter -func (obj *patternFlowArpOperation) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowArpOperationCounter value in the PatternFlowArpOperation object -func (obj *patternFlowArpOperation) SetIncrement(value PatternFlowArpOperationCounter) PatternFlowArpOperation { - obj.setChoice(PatternFlowArpOperationChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowArpOperationCounter -func (obj *patternFlowArpOperation) Decrement() PatternFlowArpOperationCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowArpOperationChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowArpOperationCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowArpOperationCounter -func (obj *patternFlowArpOperation) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowArpOperationCounter value in the PatternFlowArpOperation object -func (obj *patternFlowArpOperation) SetDecrement(value PatternFlowArpOperationCounter) PatternFlowArpOperation { - obj.setChoice(PatternFlowArpOperationChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowArpOperationMetricTag -func (obj *patternFlowArpOperation) MetricTags() PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowArpOperationMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowArpOperationPatternFlowArpOperationMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowArpOperationPatternFlowArpOperationMetricTagIter struct { - obj *patternFlowArpOperation - patternFlowArpOperationMetricTagSlice []PatternFlowArpOperationMetricTag - fieldPtr *[]*otg.PatternFlowArpOperationMetricTag -} - -func newPatternFlowArpOperationPatternFlowArpOperationMetricTagIter(ptr *[]*otg.PatternFlowArpOperationMetricTag) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { - return &patternFlowArpOperationPatternFlowArpOperationMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowArpOperationPatternFlowArpOperationMetricTagIter interface { - setMsg(*patternFlowArpOperation) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter - Items() []PatternFlowArpOperationMetricTag - Add() PatternFlowArpOperationMetricTag - Append(items ...PatternFlowArpOperationMetricTag) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter - Set(index int, newObj PatternFlowArpOperationMetricTag) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter - Clear() PatternFlowArpOperationPatternFlowArpOperationMetricTagIter - clearHolderSlice() PatternFlowArpOperationPatternFlowArpOperationMetricTagIter - appendHolderSlice(item PatternFlowArpOperationMetricTag) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter -} - -func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) setMsg(msg *patternFlowArpOperation) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowArpOperationMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) Items() []PatternFlowArpOperationMetricTag { - return obj.patternFlowArpOperationMetricTagSlice -} - -func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) Add() PatternFlowArpOperationMetricTag { - newObj := &otg.PatternFlowArpOperationMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowArpOperationMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowArpOperationMetricTagSlice = append(obj.patternFlowArpOperationMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) Append(items ...PatternFlowArpOperationMetricTag) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowArpOperationMetricTagSlice = append(obj.patternFlowArpOperationMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) Set(index int, newObj PatternFlowArpOperationMetricTag) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowArpOperationMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) Clear() PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowArpOperationMetricTag{} - obj.patternFlowArpOperationMetricTagSlice = []PatternFlowArpOperationMetricTag{} - } - return obj -} -func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) clearHolderSlice() PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { - if len(obj.patternFlowArpOperationMetricTagSlice) > 0 { - obj.patternFlowArpOperationMetricTagSlice = []PatternFlowArpOperationMetricTag{} - } - return obj -} -func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) appendHolderSlice(item PatternFlowArpOperationMetricTag) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { - obj.patternFlowArpOperationMetricTagSlice = append(obj.patternFlowArpOperationMetricTagSlice, item) - return obj -} - -func (obj *patternFlowArpOperation) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpOperation.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowArpOperation.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowArpOperationMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowArpOperation) setDefault() { - var choices_set int = 0 - var choice PatternFlowArpOperationChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowArpOperationChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowArpOperationChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowArpOperationChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowArpOperationChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowArpOperationChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpOperation") - } - } else { - intVal := otg.PatternFlowArpOperation_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowArpOperation_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowArpSenderHardwareAddr ***** -type patternFlowArpSenderHardwareAddr struct { - validation - obj *otg.PatternFlowArpSenderHardwareAddr - marshaller marshalPatternFlowArpSenderHardwareAddr - unMarshaller unMarshalPatternFlowArpSenderHardwareAddr - incrementHolder PatternFlowArpSenderHardwareAddrCounter - decrementHolder PatternFlowArpSenderHardwareAddrCounter - metricTagsHolder PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter -} - -func NewPatternFlowArpSenderHardwareAddr() PatternFlowArpSenderHardwareAddr { - obj := patternFlowArpSenderHardwareAddr{obj: &otg.PatternFlowArpSenderHardwareAddr{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpSenderHardwareAddr) msg() *otg.PatternFlowArpSenderHardwareAddr { - return obj.obj -} - -func (obj *patternFlowArpSenderHardwareAddr) setMsg(msg *otg.PatternFlowArpSenderHardwareAddr) PatternFlowArpSenderHardwareAddr { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpSenderHardwareAddr struct { - obj *patternFlowArpSenderHardwareAddr -} - -type marshalPatternFlowArpSenderHardwareAddr interface { - // ToProto marshals PatternFlowArpSenderHardwareAddr to protobuf object *otg.PatternFlowArpSenderHardwareAddr - ToProto() (*otg.PatternFlowArpSenderHardwareAddr, error) - // ToPbText marshals PatternFlowArpSenderHardwareAddr to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpSenderHardwareAddr to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpSenderHardwareAddr to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpSenderHardwareAddr struct { - obj *patternFlowArpSenderHardwareAddr -} - -type unMarshalPatternFlowArpSenderHardwareAddr interface { - // FromProto unmarshals PatternFlowArpSenderHardwareAddr from protobuf object *otg.PatternFlowArpSenderHardwareAddr - FromProto(msg *otg.PatternFlowArpSenderHardwareAddr) (PatternFlowArpSenderHardwareAddr, error) - // FromPbText unmarshals PatternFlowArpSenderHardwareAddr from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpSenderHardwareAddr from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpSenderHardwareAddr from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpSenderHardwareAddr) Marshal() marshalPatternFlowArpSenderHardwareAddr { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpSenderHardwareAddr{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpSenderHardwareAddr) Unmarshal() unMarshalPatternFlowArpSenderHardwareAddr { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpSenderHardwareAddr{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpSenderHardwareAddr) ToProto() (*otg.PatternFlowArpSenderHardwareAddr, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpSenderHardwareAddr) FromProto(msg *otg.PatternFlowArpSenderHardwareAddr) (PatternFlowArpSenderHardwareAddr, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpSenderHardwareAddr) 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 *unMarshalpatternFlowArpSenderHardwareAddr) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowArpSenderHardwareAddr) 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 *unMarshalpatternFlowArpSenderHardwareAddr) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowArpSenderHardwareAddr) 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 *unMarshalpatternFlowArpSenderHardwareAddr) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowArpSenderHardwareAddr) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpSenderHardwareAddr) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpSenderHardwareAddr) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpSenderHardwareAddr) Clone() (PatternFlowArpSenderHardwareAddr, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpSenderHardwareAddr() - 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 -} - -func (obj *patternFlowArpSenderHardwareAddr) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowArpSenderHardwareAddr is media address of the sender -type PatternFlowArpSenderHardwareAddr interface { - Validation - // msg marshals PatternFlowArpSenderHardwareAddr to protobuf object *otg.PatternFlowArpSenderHardwareAddr - // and doesn't set defaults - msg() *otg.PatternFlowArpSenderHardwareAddr - // setMsg unmarshals PatternFlowArpSenderHardwareAddr from protobuf object *otg.PatternFlowArpSenderHardwareAddr - // and doesn't set defaults - setMsg(*otg.PatternFlowArpSenderHardwareAddr) PatternFlowArpSenderHardwareAddr - // provides marshal interface - Marshal() marshalPatternFlowArpSenderHardwareAddr - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpSenderHardwareAddr - // validate validates PatternFlowArpSenderHardwareAddr - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpSenderHardwareAddr, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowArpSenderHardwareAddrChoiceEnum, set in PatternFlowArpSenderHardwareAddr - Choice() PatternFlowArpSenderHardwareAddrChoiceEnum - // setChoice assigns PatternFlowArpSenderHardwareAddrChoiceEnum provided by user to PatternFlowArpSenderHardwareAddr - setChoice(value PatternFlowArpSenderHardwareAddrChoiceEnum) PatternFlowArpSenderHardwareAddr - // HasChoice checks if Choice has been set in PatternFlowArpSenderHardwareAddr - HasChoice() bool - // Value returns string, set in PatternFlowArpSenderHardwareAddr. - Value() string - // SetValue assigns string provided by user to PatternFlowArpSenderHardwareAddr - SetValue(value string) PatternFlowArpSenderHardwareAddr - // HasValue checks if Value has been set in PatternFlowArpSenderHardwareAddr - HasValue() bool - // Values returns []string, set in PatternFlowArpSenderHardwareAddr. - Values() []string - // SetValues assigns []string provided by user to PatternFlowArpSenderHardwareAddr - SetValues(value []string) PatternFlowArpSenderHardwareAddr - // Increment returns PatternFlowArpSenderHardwareAddrCounter, set in PatternFlowArpSenderHardwareAddr. - // PatternFlowArpSenderHardwareAddrCounter is mac counter pattern - Increment() PatternFlowArpSenderHardwareAddrCounter - // SetIncrement assigns PatternFlowArpSenderHardwareAddrCounter provided by user to PatternFlowArpSenderHardwareAddr. - // PatternFlowArpSenderHardwareAddrCounter is mac counter pattern - SetIncrement(value PatternFlowArpSenderHardwareAddrCounter) PatternFlowArpSenderHardwareAddr - // HasIncrement checks if Increment has been set in PatternFlowArpSenderHardwareAddr - HasIncrement() bool - // Decrement returns PatternFlowArpSenderHardwareAddrCounter, set in PatternFlowArpSenderHardwareAddr. - // PatternFlowArpSenderHardwareAddrCounter is mac counter pattern - Decrement() PatternFlowArpSenderHardwareAddrCounter - // SetDecrement assigns PatternFlowArpSenderHardwareAddrCounter provided by user to PatternFlowArpSenderHardwareAddr. - // PatternFlowArpSenderHardwareAddrCounter is mac counter pattern - SetDecrement(value PatternFlowArpSenderHardwareAddrCounter) PatternFlowArpSenderHardwareAddr - // HasDecrement checks if Decrement has been set in PatternFlowArpSenderHardwareAddr - HasDecrement() bool - // MetricTags returns PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIterIter, set in PatternFlowArpSenderHardwareAddr - MetricTags() PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter - setNil() -} - -type PatternFlowArpSenderHardwareAddrChoiceEnum string - -// Enum of Choice on PatternFlowArpSenderHardwareAddr -var PatternFlowArpSenderHardwareAddrChoice = struct { - VALUE PatternFlowArpSenderHardwareAddrChoiceEnum - VALUES PatternFlowArpSenderHardwareAddrChoiceEnum - INCREMENT PatternFlowArpSenderHardwareAddrChoiceEnum - DECREMENT PatternFlowArpSenderHardwareAddrChoiceEnum -}{ - VALUE: PatternFlowArpSenderHardwareAddrChoiceEnum("value"), - VALUES: PatternFlowArpSenderHardwareAddrChoiceEnum("values"), - INCREMENT: PatternFlowArpSenderHardwareAddrChoiceEnum("increment"), - DECREMENT: PatternFlowArpSenderHardwareAddrChoiceEnum("decrement"), -} - -func (obj *patternFlowArpSenderHardwareAddr) Choice() PatternFlowArpSenderHardwareAddrChoiceEnum { - return PatternFlowArpSenderHardwareAddrChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowArpSenderHardwareAddr) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowArpSenderHardwareAddr) setChoice(value PatternFlowArpSenderHardwareAddrChoiceEnum) PatternFlowArpSenderHardwareAddr { - intValue, ok := otg.PatternFlowArpSenderHardwareAddr_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowArpSenderHardwareAddrChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowArpSenderHardwareAddr_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowArpSenderHardwareAddrChoice.VALUE { - defaultValue := "00:00:00:00:00:00" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowArpSenderHardwareAddrChoice.VALUES { - defaultValue := []string{"00:00:00:00:00:00"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowArpSenderHardwareAddrChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowArpSenderHardwareAddrCounter().msg() - } - - if value == PatternFlowArpSenderHardwareAddrChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowArpSenderHardwareAddrCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowArpSenderHardwareAddr) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowArpSenderHardwareAddr) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowArpSenderHardwareAddr object -func (obj *patternFlowArpSenderHardwareAddr) SetValue(value string) PatternFlowArpSenderHardwareAddr { - obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowArpSenderHardwareAddr) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"00:00:00:00:00:00"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowArpSenderHardwareAddr object -func (obj *patternFlowArpSenderHardwareAddr) SetValues(value []string) PatternFlowArpSenderHardwareAddr { - obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowArpSenderHardwareAddrCounter -func (obj *patternFlowArpSenderHardwareAddr) Increment() PatternFlowArpSenderHardwareAddrCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowArpSenderHardwareAddrCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowArpSenderHardwareAddrCounter -func (obj *patternFlowArpSenderHardwareAddr) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowArpSenderHardwareAddrCounter value in the PatternFlowArpSenderHardwareAddr object -func (obj *patternFlowArpSenderHardwareAddr) SetIncrement(value PatternFlowArpSenderHardwareAddrCounter) PatternFlowArpSenderHardwareAddr { - obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowArpSenderHardwareAddrCounter -func (obj *patternFlowArpSenderHardwareAddr) Decrement() PatternFlowArpSenderHardwareAddrCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowArpSenderHardwareAddrCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowArpSenderHardwareAddrCounter -func (obj *patternFlowArpSenderHardwareAddr) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowArpSenderHardwareAddrCounter value in the PatternFlowArpSenderHardwareAddr object -func (obj *patternFlowArpSenderHardwareAddr) SetDecrement(value PatternFlowArpSenderHardwareAddrCounter) PatternFlowArpSenderHardwareAddr { - obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowArpSenderHardwareAddrMetricTag -func (obj *patternFlowArpSenderHardwareAddr) MetricTags() PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowArpSenderHardwareAddrMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter struct { - obj *patternFlowArpSenderHardwareAddr - patternFlowArpSenderHardwareAddrMetricTagSlice []PatternFlowArpSenderHardwareAddrMetricTag - fieldPtr *[]*otg.PatternFlowArpSenderHardwareAddrMetricTag -} - -func newPatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter(ptr *[]*otg.PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { - return &patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter interface { - setMsg(*patternFlowArpSenderHardwareAddr) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter - Items() []PatternFlowArpSenderHardwareAddrMetricTag - Add() PatternFlowArpSenderHardwareAddrMetricTag - Append(items ...PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter - Set(index int, newObj PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter - Clear() PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter - clearHolderSlice() PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter - appendHolderSlice(item PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter -} - -func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) setMsg(msg *patternFlowArpSenderHardwareAddr) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowArpSenderHardwareAddrMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) Items() []PatternFlowArpSenderHardwareAddrMetricTag { - return obj.patternFlowArpSenderHardwareAddrMetricTagSlice -} - -func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) Add() PatternFlowArpSenderHardwareAddrMetricTag { - newObj := &otg.PatternFlowArpSenderHardwareAddrMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowArpSenderHardwareAddrMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowArpSenderHardwareAddrMetricTagSlice = append(obj.patternFlowArpSenderHardwareAddrMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) Append(items ...PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowArpSenderHardwareAddrMetricTagSlice = append(obj.patternFlowArpSenderHardwareAddrMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) Set(index int, newObj PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowArpSenderHardwareAddrMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) Clear() PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowArpSenderHardwareAddrMetricTag{} - obj.patternFlowArpSenderHardwareAddrMetricTagSlice = []PatternFlowArpSenderHardwareAddrMetricTag{} - } - return obj -} -func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) clearHolderSlice() PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { - if len(obj.patternFlowArpSenderHardwareAddrMetricTagSlice) > 0 { - obj.patternFlowArpSenderHardwareAddrMetricTagSlice = []PatternFlowArpSenderHardwareAddrMetricTag{} - } - return obj -} -func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) appendHolderSlice(item PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { - obj.patternFlowArpSenderHardwareAddrMetricTagSlice = append(obj.patternFlowArpSenderHardwareAddrMetricTagSlice, item) - return obj -} - -func (obj *patternFlowArpSenderHardwareAddr) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateMac(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderHardwareAddr.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateMacSlice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderHardwareAddr.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowArpSenderHardwareAddrMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowArpSenderHardwareAddr) setDefault() { - var choices_set int = 0 - var choice PatternFlowArpSenderHardwareAddrChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowArpSenderHardwareAddrChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowArpSenderHardwareAddrChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowArpSenderHardwareAddrChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowArpSenderHardwareAddrChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpSenderHardwareAddr") - } - } else { - intVal := otg.PatternFlowArpSenderHardwareAddr_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowArpSenderHardwareAddr_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowArpSenderProtocolAddr ***** -type patternFlowArpSenderProtocolAddr struct { - validation - obj *otg.PatternFlowArpSenderProtocolAddr - marshaller marshalPatternFlowArpSenderProtocolAddr - unMarshaller unMarshalPatternFlowArpSenderProtocolAddr - incrementHolder PatternFlowArpSenderProtocolAddrCounter - decrementHolder PatternFlowArpSenderProtocolAddrCounter - metricTagsHolder PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter -} - -func NewPatternFlowArpSenderProtocolAddr() PatternFlowArpSenderProtocolAddr { - obj := patternFlowArpSenderProtocolAddr{obj: &otg.PatternFlowArpSenderProtocolAddr{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpSenderProtocolAddr) msg() *otg.PatternFlowArpSenderProtocolAddr { - return obj.obj -} - -func (obj *patternFlowArpSenderProtocolAddr) setMsg(msg *otg.PatternFlowArpSenderProtocolAddr) PatternFlowArpSenderProtocolAddr { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpSenderProtocolAddr struct { - obj *patternFlowArpSenderProtocolAddr -} - -type marshalPatternFlowArpSenderProtocolAddr interface { - // ToProto marshals PatternFlowArpSenderProtocolAddr to protobuf object *otg.PatternFlowArpSenderProtocolAddr - ToProto() (*otg.PatternFlowArpSenderProtocolAddr, error) - // ToPbText marshals PatternFlowArpSenderProtocolAddr to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpSenderProtocolAddr to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpSenderProtocolAddr to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpSenderProtocolAddr struct { - obj *patternFlowArpSenderProtocolAddr -} - -type unMarshalPatternFlowArpSenderProtocolAddr interface { - // FromProto unmarshals PatternFlowArpSenderProtocolAddr from protobuf object *otg.PatternFlowArpSenderProtocolAddr - FromProto(msg *otg.PatternFlowArpSenderProtocolAddr) (PatternFlowArpSenderProtocolAddr, error) - // FromPbText unmarshals PatternFlowArpSenderProtocolAddr from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpSenderProtocolAddr from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpSenderProtocolAddr from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpSenderProtocolAddr) Marshal() marshalPatternFlowArpSenderProtocolAddr { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpSenderProtocolAddr{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpSenderProtocolAddr) Unmarshal() unMarshalPatternFlowArpSenderProtocolAddr { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpSenderProtocolAddr{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpSenderProtocolAddr) ToProto() (*otg.PatternFlowArpSenderProtocolAddr, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpSenderProtocolAddr) FromProto(msg *otg.PatternFlowArpSenderProtocolAddr) (PatternFlowArpSenderProtocolAddr, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpSenderProtocolAddr) 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 *unMarshalpatternFlowArpSenderProtocolAddr) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowArpSenderProtocolAddr) 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 *unMarshalpatternFlowArpSenderProtocolAddr) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowArpSenderProtocolAddr) 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 *unMarshalpatternFlowArpSenderProtocolAddr) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowArpSenderProtocolAddr) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpSenderProtocolAddr) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpSenderProtocolAddr) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpSenderProtocolAddr) Clone() (PatternFlowArpSenderProtocolAddr, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpSenderProtocolAddr() - 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 -} - -func (obj *patternFlowArpSenderProtocolAddr) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowArpSenderProtocolAddr is internetwork address of the sender -type PatternFlowArpSenderProtocolAddr interface { - Validation - // msg marshals PatternFlowArpSenderProtocolAddr to protobuf object *otg.PatternFlowArpSenderProtocolAddr - // and doesn't set defaults - msg() *otg.PatternFlowArpSenderProtocolAddr - // setMsg unmarshals PatternFlowArpSenderProtocolAddr from protobuf object *otg.PatternFlowArpSenderProtocolAddr - // and doesn't set defaults - setMsg(*otg.PatternFlowArpSenderProtocolAddr) PatternFlowArpSenderProtocolAddr - // provides marshal interface - Marshal() marshalPatternFlowArpSenderProtocolAddr - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpSenderProtocolAddr - // validate validates PatternFlowArpSenderProtocolAddr - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpSenderProtocolAddr, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowArpSenderProtocolAddrChoiceEnum, set in PatternFlowArpSenderProtocolAddr - Choice() PatternFlowArpSenderProtocolAddrChoiceEnum - // setChoice assigns PatternFlowArpSenderProtocolAddrChoiceEnum provided by user to PatternFlowArpSenderProtocolAddr - setChoice(value PatternFlowArpSenderProtocolAddrChoiceEnum) PatternFlowArpSenderProtocolAddr - // HasChoice checks if Choice has been set in PatternFlowArpSenderProtocolAddr - HasChoice() bool - // Value returns string, set in PatternFlowArpSenderProtocolAddr. - Value() string - // SetValue assigns string provided by user to PatternFlowArpSenderProtocolAddr - SetValue(value string) PatternFlowArpSenderProtocolAddr - // HasValue checks if Value has been set in PatternFlowArpSenderProtocolAddr - HasValue() bool - // Values returns []string, set in PatternFlowArpSenderProtocolAddr. - Values() []string - // SetValues assigns []string provided by user to PatternFlowArpSenderProtocolAddr - SetValues(value []string) PatternFlowArpSenderProtocolAddr - // Increment returns PatternFlowArpSenderProtocolAddrCounter, set in PatternFlowArpSenderProtocolAddr. - // PatternFlowArpSenderProtocolAddrCounter is ipv4 counter pattern - Increment() PatternFlowArpSenderProtocolAddrCounter - // SetIncrement assigns PatternFlowArpSenderProtocolAddrCounter provided by user to PatternFlowArpSenderProtocolAddr. - // PatternFlowArpSenderProtocolAddrCounter is ipv4 counter pattern - SetIncrement(value PatternFlowArpSenderProtocolAddrCounter) PatternFlowArpSenderProtocolAddr - // HasIncrement checks if Increment has been set in PatternFlowArpSenderProtocolAddr - HasIncrement() bool - // Decrement returns PatternFlowArpSenderProtocolAddrCounter, set in PatternFlowArpSenderProtocolAddr. - // PatternFlowArpSenderProtocolAddrCounter is ipv4 counter pattern - Decrement() PatternFlowArpSenderProtocolAddrCounter - // SetDecrement assigns PatternFlowArpSenderProtocolAddrCounter provided by user to PatternFlowArpSenderProtocolAddr. - // PatternFlowArpSenderProtocolAddrCounter is ipv4 counter pattern - SetDecrement(value PatternFlowArpSenderProtocolAddrCounter) PatternFlowArpSenderProtocolAddr - // HasDecrement checks if Decrement has been set in PatternFlowArpSenderProtocolAddr - HasDecrement() bool - // MetricTags returns PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIterIter, set in PatternFlowArpSenderProtocolAddr - MetricTags() PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter - setNil() -} - -type PatternFlowArpSenderProtocolAddrChoiceEnum string - -// Enum of Choice on PatternFlowArpSenderProtocolAddr -var PatternFlowArpSenderProtocolAddrChoice = struct { - VALUE PatternFlowArpSenderProtocolAddrChoiceEnum - VALUES PatternFlowArpSenderProtocolAddrChoiceEnum - INCREMENT PatternFlowArpSenderProtocolAddrChoiceEnum - DECREMENT PatternFlowArpSenderProtocolAddrChoiceEnum -}{ - VALUE: PatternFlowArpSenderProtocolAddrChoiceEnum("value"), - VALUES: PatternFlowArpSenderProtocolAddrChoiceEnum("values"), - INCREMENT: PatternFlowArpSenderProtocolAddrChoiceEnum("increment"), - DECREMENT: PatternFlowArpSenderProtocolAddrChoiceEnum("decrement"), -} - -func (obj *patternFlowArpSenderProtocolAddr) Choice() PatternFlowArpSenderProtocolAddrChoiceEnum { - return PatternFlowArpSenderProtocolAddrChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowArpSenderProtocolAddr) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowArpSenderProtocolAddr) setChoice(value PatternFlowArpSenderProtocolAddrChoiceEnum) PatternFlowArpSenderProtocolAddr { - intValue, ok := otg.PatternFlowArpSenderProtocolAddr_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowArpSenderProtocolAddrChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowArpSenderProtocolAddr_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowArpSenderProtocolAddrChoice.VALUE { - defaultValue := "0.0.0.0" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowArpSenderProtocolAddrChoice.VALUES { - defaultValue := []string{"0.0.0.0"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowArpSenderProtocolAddrChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowArpSenderProtocolAddrCounter().msg() - } - - if value == PatternFlowArpSenderProtocolAddrChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowArpSenderProtocolAddrCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowArpSenderProtocolAddr) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowArpSenderProtocolAddr) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowArpSenderProtocolAddr object -func (obj *patternFlowArpSenderProtocolAddr) SetValue(value string) PatternFlowArpSenderProtocolAddr { - obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowArpSenderProtocolAddr) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"0.0.0.0"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowArpSenderProtocolAddr object -func (obj *patternFlowArpSenderProtocolAddr) SetValues(value []string) PatternFlowArpSenderProtocolAddr { - obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowArpSenderProtocolAddrCounter -func (obj *patternFlowArpSenderProtocolAddr) Increment() PatternFlowArpSenderProtocolAddrCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowArpSenderProtocolAddrCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowArpSenderProtocolAddrCounter -func (obj *patternFlowArpSenderProtocolAddr) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowArpSenderProtocolAddrCounter value in the PatternFlowArpSenderProtocolAddr object -func (obj *patternFlowArpSenderProtocolAddr) SetIncrement(value PatternFlowArpSenderProtocolAddrCounter) PatternFlowArpSenderProtocolAddr { - obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowArpSenderProtocolAddrCounter -func (obj *patternFlowArpSenderProtocolAddr) Decrement() PatternFlowArpSenderProtocolAddrCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowArpSenderProtocolAddrCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowArpSenderProtocolAddrCounter -func (obj *patternFlowArpSenderProtocolAddr) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowArpSenderProtocolAddrCounter value in the PatternFlowArpSenderProtocolAddr object -func (obj *patternFlowArpSenderProtocolAddr) SetDecrement(value PatternFlowArpSenderProtocolAddrCounter) PatternFlowArpSenderProtocolAddr { - obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowArpSenderProtocolAddrMetricTag -func (obj *patternFlowArpSenderProtocolAddr) MetricTags() PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowArpSenderProtocolAddrMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter struct { - obj *patternFlowArpSenderProtocolAddr - patternFlowArpSenderProtocolAddrMetricTagSlice []PatternFlowArpSenderProtocolAddrMetricTag - fieldPtr *[]*otg.PatternFlowArpSenderProtocolAddrMetricTag -} - -func newPatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter(ptr *[]*otg.PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { - return &patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter interface { - setMsg(*patternFlowArpSenderProtocolAddr) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter - Items() []PatternFlowArpSenderProtocolAddrMetricTag - Add() PatternFlowArpSenderProtocolAddrMetricTag - Append(items ...PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter - Set(index int, newObj PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter - Clear() PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter - clearHolderSlice() PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter - appendHolderSlice(item PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter -} - -func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) setMsg(msg *patternFlowArpSenderProtocolAddr) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowArpSenderProtocolAddrMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) Items() []PatternFlowArpSenderProtocolAddrMetricTag { - return obj.patternFlowArpSenderProtocolAddrMetricTagSlice -} - -func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) Add() PatternFlowArpSenderProtocolAddrMetricTag { - newObj := &otg.PatternFlowArpSenderProtocolAddrMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowArpSenderProtocolAddrMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowArpSenderProtocolAddrMetricTagSlice = append(obj.patternFlowArpSenderProtocolAddrMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) Append(items ...PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowArpSenderProtocolAddrMetricTagSlice = append(obj.patternFlowArpSenderProtocolAddrMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) Set(index int, newObj PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowArpSenderProtocolAddrMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) Clear() PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowArpSenderProtocolAddrMetricTag{} - obj.patternFlowArpSenderProtocolAddrMetricTagSlice = []PatternFlowArpSenderProtocolAddrMetricTag{} - } - return obj -} -func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) clearHolderSlice() PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { - if len(obj.patternFlowArpSenderProtocolAddrMetricTagSlice) > 0 { - obj.patternFlowArpSenderProtocolAddrMetricTagSlice = []PatternFlowArpSenderProtocolAddrMetricTag{} - } - return obj -} -func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) appendHolderSlice(item PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { - obj.patternFlowArpSenderProtocolAddrMetricTagSlice = append(obj.patternFlowArpSenderProtocolAddrMetricTagSlice, item) - return obj -} - -func (obj *patternFlowArpSenderProtocolAddr) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv4(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderProtocolAddr.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateIpv4Slice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderProtocolAddr.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowArpSenderProtocolAddrMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowArpSenderProtocolAddr) setDefault() { - var choices_set int = 0 - var choice PatternFlowArpSenderProtocolAddrChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowArpSenderProtocolAddrChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowArpSenderProtocolAddrChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowArpSenderProtocolAddrChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowArpSenderProtocolAddrChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpSenderProtocolAddr") - } - } else { - intVal := otg.PatternFlowArpSenderProtocolAddr_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowArpSenderProtocolAddr_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowArpTargetHardwareAddr ***** -type patternFlowArpTargetHardwareAddr struct { - validation - obj *otg.PatternFlowArpTargetHardwareAddr - marshaller marshalPatternFlowArpTargetHardwareAddr - unMarshaller unMarshalPatternFlowArpTargetHardwareAddr - incrementHolder PatternFlowArpTargetHardwareAddrCounter - decrementHolder PatternFlowArpTargetHardwareAddrCounter - metricTagsHolder PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter -} - -func NewPatternFlowArpTargetHardwareAddr() PatternFlowArpTargetHardwareAddr { - obj := patternFlowArpTargetHardwareAddr{obj: &otg.PatternFlowArpTargetHardwareAddr{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpTargetHardwareAddr) msg() *otg.PatternFlowArpTargetHardwareAddr { - return obj.obj -} - -func (obj *patternFlowArpTargetHardwareAddr) setMsg(msg *otg.PatternFlowArpTargetHardwareAddr) PatternFlowArpTargetHardwareAddr { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpTargetHardwareAddr struct { - obj *patternFlowArpTargetHardwareAddr -} - -type marshalPatternFlowArpTargetHardwareAddr interface { - // ToProto marshals PatternFlowArpTargetHardwareAddr to protobuf object *otg.PatternFlowArpTargetHardwareAddr - ToProto() (*otg.PatternFlowArpTargetHardwareAddr, error) - // ToPbText marshals PatternFlowArpTargetHardwareAddr to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpTargetHardwareAddr to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpTargetHardwareAddr to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpTargetHardwareAddr struct { - obj *patternFlowArpTargetHardwareAddr -} - -type unMarshalPatternFlowArpTargetHardwareAddr interface { - // FromProto unmarshals PatternFlowArpTargetHardwareAddr from protobuf object *otg.PatternFlowArpTargetHardwareAddr - FromProto(msg *otg.PatternFlowArpTargetHardwareAddr) (PatternFlowArpTargetHardwareAddr, error) - // FromPbText unmarshals PatternFlowArpTargetHardwareAddr from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpTargetHardwareAddr from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpTargetHardwareAddr from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpTargetHardwareAddr) Marshal() marshalPatternFlowArpTargetHardwareAddr { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpTargetHardwareAddr{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpTargetHardwareAddr) Unmarshal() unMarshalPatternFlowArpTargetHardwareAddr { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpTargetHardwareAddr{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpTargetHardwareAddr) ToProto() (*otg.PatternFlowArpTargetHardwareAddr, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpTargetHardwareAddr) FromProto(msg *otg.PatternFlowArpTargetHardwareAddr) (PatternFlowArpTargetHardwareAddr, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpTargetHardwareAddr) 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 *unMarshalpatternFlowArpTargetHardwareAddr) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowArpTargetHardwareAddr) 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 *unMarshalpatternFlowArpTargetHardwareAddr) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowArpTargetHardwareAddr) 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 *unMarshalpatternFlowArpTargetHardwareAddr) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowArpTargetHardwareAddr) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpTargetHardwareAddr) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpTargetHardwareAddr) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpTargetHardwareAddr) Clone() (PatternFlowArpTargetHardwareAddr, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpTargetHardwareAddr() - 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 -} - -func (obj *patternFlowArpTargetHardwareAddr) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowArpTargetHardwareAddr is media address of the target -type PatternFlowArpTargetHardwareAddr interface { - Validation - // msg marshals PatternFlowArpTargetHardwareAddr to protobuf object *otg.PatternFlowArpTargetHardwareAddr - // and doesn't set defaults - msg() *otg.PatternFlowArpTargetHardwareAddr - // setMsg unmarshals PatternFlowArpTargetHardwareAddr from protobuf object *otg.PatternFlowArpTargetHardwareAddr - // and doesn't set defaults - setMsg(*otg.PatternFlowArpTargetHardwareAddr) PatternFlowArpTargetHardwareAddr - // provides marshal interface - Marshal() marshalPatternFlowArpTargetHardwareAddr - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpTargetHardwareAddr - // validate validates PatternFlowArpTargetHardwareAddr - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpTargetHardwareAddr, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowArpTargetHardwareAddrChoiceEnum, set in PatternFlowArpTargetHardwareAddr - Choice() PatternFlowArpTargetHardwareAddrChoiceEnum - // setChoice assigns PatternFlowArpTargetHardwareAddrChoiceEnum provided by user to PatternFlowArpTargetHardwareAddr - setChoice(value PatternFlowArpTargetHardwareAddrChoiceEnum) PatternFlowArpTargetHardwareAddr - // HasChoice checks if Choice has been set in PatternFlowArpTargetHardwareAddr - HasChoice() bool - // Value returns string, set in PatternFlowArpTargetHardwareAddr. - Value() string - // SetValue assigns string provided by user to PatternFlowArpTargetHardwareAddr - SetValue(value string) PatternFlowArpTargetHardwareAddr - // HasValue checks if Value has been set in PatternFlowArpTargetHardwareAddr - HasValue() bool - // Values returns []string, set in PatternFlowArpTargetHardwareAddr. - Values() []string - // SetValues assigns []string provided by user to PatternFlowArpTargetHardwareAddr - SetValues(value []string) PatternFlowArpTargetHardwareAddr - // Increment returns PatternFlowArpTargetHardwareAddrCounter, set in PatternFlowArpTargetHardwareAddr. - // PatternFlowArpTargetHardwareAddrCounter is mac counter pattern - Increment() PatternFlowArpTargetHardwareAddrCounter - // SetIncrement assigns PatternFlowArpTargetHardwareAddrCounter provided by user to PatternFlowArpTargetHardwareAddr. - // PatternFlowArpTargetHardwareAddrCounter is mac counter pattern - SetIncrement(value PatternFlowArpTargetHardwareAddrCounter) PatternFlowArpTargetHardwareAddr - // HasIncrement checks if Increment has been set in PatternFlowArpTargetHardwareAddr - HasIncrement() bool - // Decrement returns PatternFlowArpTargetHardwareAddrCounter, set in PatternFlowArpTargetHardwareAddr. - // PatternFlowArpTargetHardwareAddrCounter is mac counter pattern - Decrement() PatternFlowArpTargetHardwareAddrCounter - // SetDecrement assigns PatternFlowArpTargetHardwareAddrCounter provided by user to PatternFlowArpTargetHardwareAddr. - // PatternFlowArpTargetHardwareAddrCounter is mac counter pattern - SetDecrement(value PatternFlowArpTargetHardwareAddrCounter) PatternFlowArpTargetHardwareAddr - // HasDecrement checks if Decrement has been set in PatternFlowArpTargetHardwareAddr - HasDecrement() bool - // MetricTags returns PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIterIter, set in PatternFlowArpTargetHardwareAddr - MetricTags() PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter - setNil() -} - -type PatternFlowArpTargetHardwareAddrChoiceEnum string - -// Enum of Choice on PatternFlowArpTargetHardwareAddr -var PatternFlowArpTargetHardwareAddrChoice = struct { - VALUE PatternFlowArpTargetHardwareAddrChoiceEnum - VALUES PatternFlowArpTargetHardwareAddrChoiceEnum - INCREMENT PatternFlowArpTargetHardwareAddrChoiceEnum - DECREMENT PatternFlowArpTargetHardwareAddrChoiceEnum -}{ - VALUE: PatternFlowArpTargetHardwareAddrChoiceEnum("value"), - VALUES: PatternFlowArpTargetHardwareAddrChoiceEnum("values"), - INCREMENT: PatternFlowArpTargetHardwareAddrChoiceEnum("increment"), - DECREMENT: PatternFlowArpTargetHardwareAddrChoiceEnum("decrement"), -} - -func (obj *patternFlowArpTargetHardwareAddr) Choice() PatternFlowArpTargetHardwareAddrChoiceEnum { - return PatternFlowArpTargetHardwareAddrChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowArpTargetHardwareAddr) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowArpTargetHardwareAddr) setChoice(value PatternFlowArpTargetHardwareAddrChoiceEnum) PatternFlowArpTargetHardwareAddr { - intValue, ok := otg.PatternFlowArpTargetHardwareAddr_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowArpTargetHardwareAddrChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowArpTargetHardwareAddr_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowArpTargetHardwareAddrChoice.VALUE { - defaultValue := "00:00:00:00:00:00" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowArpTargetHardwareAddrChoice.VALUES { - defaultValue := []string{"00:00:00:00:00:00"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowArpTargetHardwareAddrChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowArpTargetHardwareAddrCounter().msg() - } - - if value == PatternFlowArpTargetHardwareAddrChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowArpTargetHardwareAddrCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowArpTargetHardwareAddr) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowArpTargetHardwareAddr) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowArpTargetHardwareAddr object -func (obj *patternFlowArpTargetHardwareAddr) SetValue(value string) PatternFlowArpTargetHardwareAddr { - obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowArpTargetHardwareAddr) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"00:00:00:00:00:00"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowArpTargetHardwareAddr object -func (obj *patternFlowArpTargetHardwareAddr) SetValues(value []string) PatternFlowArpTargetHardwareAddr { - obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowArpTargetHardwareAddrCounter -func (obj *patternFlowArpTargetHardwareAddr) Increment() PatternFlowArpTargetHardwareAddrCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowArpTargetHardwareAddrCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowArpTargetHardwareAddrCounter -func (obj *patternFlowArpTargetHardwareAddr) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowArpTargetHardwareAddrCounter value in the PatternFlowArpTargetHardwareAddr object -func (obj *patternFlowArpTargetHardwareAddr) SetIncrement(value PatternFlowArpTargetHardwareAddrCounter) PatternFlowArpTargetHardwareAddr { - obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowArpTargetHardwareAddrCounter -func (obj *patternFlowArpTargetHardwareAddr) Decrement() PatternFlowArpTargetHardwareAddrCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowArpTargetHardwareAddrCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowArpTargetHardwareAddrCounter -func (obj *patternFlowArpTargetHardwareAddr) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowArpTargetHardwareAddrCounter value in the PatternFlowArpTargetHardwareAddr object -func (obj *patternFlowArpTargetHardwareAddr) SetDecrement(value PatternFlowArpTargetHardwareAddrCounter) PatternFlowArpTargetHardwareAddr { - obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowArpTargetHardwareAddrMetricTag -func (obj *patternFlowArpTargetHardwareAddr) MetricTags() PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowArpTargetHardwareAddrMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter struct { - obj *patternFlowArpTargetHardwareAddr - patternFlowArpTargetHardwareAddrMetricTagSlice []PatternFlowArpTargetHardwareAddrMetricTag - fieldPtr *[]*otg.PatternFlowArpTargetHardwareAddrMetricTag -} - -func newPatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter(ptr *[]*otg.PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { - return &patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter interface { - setMsg(*patternFlowArpTargetHardwareAddr) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter - Items() []PatternFlowArpTargetHardwareAddrMetricTag - Add() PatternFlowArpTargetHardwareAddrMetricTag - Append(items ...PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter - Set(index int, newObj PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter - Clear() PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter - clearHolderSlice() PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter - appendHolderSlice(item PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter -} - -func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) setMsg(msg *patternFlowArpTargetHardwareAddr) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowArpTargetHardwareAddrMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) Items() []PatternFlowArpTargetHardwareAddrMetricTag { - return obj.patternFlowArpTargetHardwareAddrMetricTagSlice -} - -func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) Add() PatternFlowArpTargetHardwareAddrMetricTag { - newObj := &otg.PatternFlowArpTargetHardwareAddrMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowArpTargetHardwareAddrMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowArpTargetHardwareAddrMetricTagSlice = append(obj.patternFlowArpTargetHardwareAddrMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) Append(items ...PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowArpTargetHardwareAddrMetricTagSlice = append(obj.patternFlowArpTargetHardwareAddrMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) Set(index int, newObj PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowArpTargetHardwareAddrMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) Clear() PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowArpTargetHardwareAddrMetricTag{} - obj.patternFlowArpTargetHardwareAddrMetricTagSlice = []PatternFlowArpTargetHardwareAddrMetricTag{} - } - return obj -} -func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) clearHolderSlice() PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { - if len(obj.patternFlowArpTargetHardwareAddrMetricTagSlice) > 0 { - obj.patternFlowArpTargetHardwareAddrMetricTagSlice = []PatternFlowArpTargetHardwareAddrMetricTag{} - } - return obj -} -func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) appendHolderSlice(item PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { - obj.patternFlowArpTargetHardwareAddrMetricTagSlice = append(obj.patternFlowArpTargetHardwareAddrMetricTagSlice, item) - return obj -} - -func (obj *patternFlowArpTargetHardwareAddr) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateMac(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetHardwareAddr.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateMacSlice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetHardwareAddr.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowArpTargetHardwareAddrMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowArpTargetHardwareAddr) setDefault() { - var choices_set int = 0 - var choice PatternFlowArpTargetHardwareAddrChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowArpTargetHardwareAddrChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowArpTargetHardwareAddrChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowArpTargetHardwareAddrChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowArpTargetHardwareAddrChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpTargetHardwareAddr") - } - } else { - intVal := otg.PatternFlowArpTargetHardwareAddr_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowArpTargetHardwareAddr_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowArpTargetProtocolAddr ***** -type patternFlowArpTargetProtocolAddr struct { - validation - obj *otg.PatternFlowArpTargetProtocolAddr - marshaller marshalPatternFlowArpTargetProtocolAddr - unMarshaller unMarshalPatternFlowArpTargetProtocolAddr - incrementHolder PatternFlowArpTargetProtocolAddrCounter - decrementHolder PatternFlowArpTargetProtocolAddrCounter - metricTagsHolder PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter -} - -func NewPatternFlowArpTargetProtocolAddr() PatternFlowArpTargetProtocolAddr { - obj := patternFlowArpTargetProtocolAddr{obj: &otg.PatternFlowArpTargetProtocolAddr{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpTargetProtocolAddr) msg() *otg.PatternFlowArpTargetProtocolAddr { - return obj.obj -} - -func (obj *patternFlowArpTargetProtocolAddr) setMsg(msg *otg.PatternFlowArpTargetProtocolAddr) PatternFlowArpTargetProtocolAddr { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpTargetProtocolAddr struct { - obj *patternFlowArpTargetProtocolAddr -} - -type marshalPatternFlowArpTargetProtocolAddr interface { - // ToProto marshals PatternFlowArpTargetProtocolAddr to protobuf object *otg.PatternFlowArpTargetProtocolAddr - ToProto() (*otg.PatternFlowArpTargetProtocolAddr, error) - // ToPbText marshals PatternFlowArpTargetProtocolAddr to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpTargetProtocolAddr to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpTargetProtocolAddr to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpTargetProtocolAddr struct { - obj *patternFlowArpTargetProtocolAddr -} - -type unMarshalPatternFlowArpTargetProtocolAddr interface { - // FromProto unmarshals PatternFlowArpTargetProtocolAddr from protobuf object *otg.PatternFlowArpTargetProtocolAddr - FromProto(msg *otg.PatternFlowArpTargetProtocolAddr) (PatternFlowArpTargetProtocolAddr, error) - // FromPbText unmarshals PatternFlowArpTargetProtocolAddr from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpTargetProtocolAddr from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpTargetProtocolAddr from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpTargetProtocolAddr) Marshal() marshalPatternFlowArpTargetProtocolAddr { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpTargetProtocolAddr{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpTargetProtocolAddr) Unmarshal() unMarshalPatternFlowArpTargetProtocolAddr { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpTargetProtocolAddr{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpTargetProtocolAddr) ToProto() (*otg.PatternFlowArpTargetProtocolAddr, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpTargetProtocolAddr) FromProto(msg *otg.PatternFlowArpTargetProtocolAddr) (PatternFlowArpTargetProtocolAddr, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpTargetProtocolAddr) 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 *unMarshalpatternFlowArpTargetProtocolAddr) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowArpTargetProtocolAddr) 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 *unMarshalpatternFlowArpTargetProtocolAddr) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowArpTargetProtocolAddr) 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 *unMarshalpatternFlowArpTargetProtocolAddr) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowArpTargetProtocolAddr) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpTargetProtocolAddr) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpTargetProtocolAddr) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpTargetProtocolAddr) Clone() (PatternFlowArpTargetProtocolAddr, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpTargetProtocolAddr() - 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 -} - -func (obj *patternFlowArpTargetProtocolAddr) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowArpTargetProtocolAddr is internetwork address of the target -type PatternFlowArpTargetProtocolAddr interface { - Validation - // msg marshals PatternFlowArpTargetProtocolAddr to protobuf object *otg.PatternFlowArpTargetProtocolAddr - // and doesn't set defaults - msg() *otg.PatternFlowArpTargetProtocolAddr - // setMsg unmarshals PatternFlowArpTargetProtocolAddr from protobuf object *otg.PatternFlowArpTargetProtocolAddr - // and doesn't set defaults - setMsg(*otg.PatternFlowArpTargetProtocolAddr) PatternFlowArpTargetProtocolAddr - // provides marshal interface - Marshal() marshalPatternFlowArpTargetProtocolAddr - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpTargetProtocolAddr - // validate validates PatternFlowArpTargetProtocolAddr - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpTargetProtocolAddr, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowArpTargetProtocolAddrChoiceEnum, set in PatternFlowArpTargetProtocolAddr - Choice() PatternFlowArpTargetProtocolAddrChoiceEnum - // setChoice assigns PatternFlowArpTargetProtocolAddrChoiceEnum provided by user to PatternFlowArpTargetProtocolAddr - setChoice(value PatternFlowArpTargetProtocolAddrChoiceEnum) PatternFlowArpTargetProtocolAddr - // HasChoice checks if Choice has been set in PatternFlowArpTargetProtocolAddr - HasChoice() bool - // Value returns string, set in PatternFlowArpTargetProtocolAddr. - Value() string - // SetValue assigns string provided by user to PatternFlowArpTargetProtocolAddr - SetValue(value string) PatternFlowArpTargetProtocolAddr - // HasValue checks if Value has been set in PatternFlowArpTargetProtocolAddr - HasValue() bool - // Values returns []string, set in PatternFlowArpTargetProtocolAddr. - Values() []string - // SetValues assigns []string provided by user to PatternFlowArpTargetProtocolAddr - SetValues(value []string) PatternFlowArpTargetProtocolAddr - // Increment returns PatternFlowArpTargetProtocolAddrCounter, set in PatternFlowArpTargetProtocolAddr. - // PatternFlowArpTargetProtocolAddrCounter is ipv4 counter pattern - Increment() PatternFlowArpTargetProtocolAddrCounter - // SetIncrement assigns PatternFlowArpTargetProtocolAddrCounter provided by user to PatternFlowArpTargetProtocolAddr. - // PatternFlowArpTargetProtocolAddrCounter is ipv4 counter pattern - SetIncrement(value PatternFlowArpTargetProtocolAddrCounter) PatternFlowArpTargetProtocolAddr - // HasIncrement checks if Increment has been set in PatternFlowArpTargetProtocolAddr - HasIncrement() bool - // Decrement returns PatternFlowArpTargetProtocolAddrCounter, set in PatternFlowArpTargetProtocolAddr. - // PatternFlowArpTargetProtocolAddrCounter is ipv4 counter pattern - Decrement() PatternFlowArpTargetProtocolAddrCounter - // SetDecrement assigns PatternFlowArpTargetProtocolAddrCounter provided by user to PatternFlowArpTargetProtocolAddr. - // PatternFlowArpTargetProtocolAddrCounter is ipv4 counter pattern - SetDecrement(value PatternFlowArpTargetProtocolAddrCounter) PatternFlowArpTargetProtocolAddr - // HasDecrement checks if Decrement has been set in PatternFlowArpTargetProtocolAddr - HasDecrement() bool - // MetricTags returns PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIterIter, set in PatternFlowArpTargetProtocolAddr - MetricTags() PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter - setNil() -} - -type PatternFlowArpTargetProtocolAddrChoiceEnum string - -// Enum of Choice on PatternFlowArpTargetProtocolAddr -var PatternFlowArpTargetProtocolAddrChoice = struct { - VALUE PatternFlowArpTargetProtocolAddrChoiceEnum - VALUES PatternFlowArpTargetProtocolAddrChoiceEnum - INCREMENT PatternFlowArpTargetProtocolAddrChoiceEnum - DECREMENT PatternFlowArpTargetProtocolAddrChoiceEnum -}{ - VALUE: PatternFlowArpTargetProtocolAddrChoiceEnum("value"), - VALUES: PatternFlowArpTargetProtocolAddrChoiceEnum("values"), - INCREMENT: PatternFlowArpTargetProtocolAddrChoiceEnum("increment"), - DECREMENT: PatternFlowArpTargetProtocolAddrChoiceEnum("decrement"), -} - -func (obj *patternFlowArpTargetProtocolAddr) Choice() PatternFlowArpTargetProtocolAddrChoiceEnum { - return PatternFlowArpTargetProtocolAddrChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowArpTargetProtocolAddr) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowArpTargetProtocolAddr) setChoice(value PatternFlowArpTargetProtocolAddrChoiceEnum) PatternFlowArpTargetProtocolAddr { - intValue, ok := otg.PatternFlowArpTargetProtocolAddr_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowArpTargetProtocolAddrChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowArpTargetProtocolAddr_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowArpTargetProtocolAddrChoice.VALUE { - defaultValue := "0.0.0.0" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowArpTargetProtocolAddrChoice.VALUES { - defaultValue := []string{"0.0.0.0"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowArpTargetProtocolAddrChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowArpTargetProtocolAddrCounter().msg() - } - - if value == PatternFlowArpTargetProtocolAddrChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowArpTargetProtocolAddrCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowArpTargetProtocolAddr) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowArpTargetProtocolAddr) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowArpTargetProtocolAddr object -func (obj *patternFlowArpTargetProtocolAddr) SetValue(value string) PatternFlowArpTargetProtocolAddr { - obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowArpTargetProtocolAddr) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"0.0.0.0"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowArpTargetProtocolAddr object -func (obj *patternFlowArpTargetProtocolAddr) SetValues(value []string) PatternFlowArpTargetProtocolAddr { - obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowArpTargetProtocolAddrCounter -func (obj *patternFlowArpTargetProtocolAddr) Increment() PatternFlowArpTargetProtocolAddrCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowArpTargetProtocolAddrCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowArpTargetProtocolAddrCounter -func (obj *patternFlowArpTargetProtocolAddr) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowArpTargetProtocolAddrCounter value in the PatternFlowArpTargetProtocolAddr object -func (obj *patternFlowArpTargetProtocolAddr) SetIncrement(value PatternFlowArpTargetProtocolAddrCounter) PatternFlowArpTargetProtocolAddr { - obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowArpTargetProtocolAddrCounter -func (obj *patternFlowArpTargetProtocolAddr) Decrement() PatternFlowArpTargetProtocolAddrCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowArpTargetProtocolAddrCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowArpTargetProtocolAddrCounter -func (obj *patternFlowArpTargetProtocolAddr) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowArpTargetProtocolAddrCounter value in the PatternFlowArpTargetProtocolAddr object -func (obj *patternFlowArpTargetProtocolAddr) SetDecrement(value PatternFlowArpTargetProtocolAddrCounter) PatternFlowArpTargetProtocolAddr { - obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowArpTargetProtocolAddrMetricTag -func (obj *patternFlowArpTargetProtocolAddr) MetricTags() PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowArpTargetProtocolAddrMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter struct { - obj *patternFlowArpTargetProtocolAddr - patternFlowArpTargetProtocolAddrMetricTagSlice []PatternFlowArpTargetProtocolAddrMetricTag - fieldPtr *[]*otg.PatternFlowArpTargetProtocolAddrMetricTag -} - -func newPatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter(ptr *[]*otg.PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { - return &patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter interface { - setMsg(*patternFlowArpTargetProtocolAddr) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter - Items() []PatternFlowArpTargetProtocolAddrMetricTag - Add() PatternFlowArpTargetProtocolAddrMetricTag - Append(items ...PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter - Set(index int, newObj PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter - Clear() PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter - clearHolderSlice() PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter - appendHolderSlice(item PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter -} - -func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) setMsg(msg *patternFlowArpTargetProtocolAddr) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowArpTargetProtocolAddrMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) Items() []PatternFlowArpTargetProtocolAddrMetricTag { - return obj.patternFlowArpTargetProtocolAddrMetricTagSlice -} - -func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) Add() PatternFlowArpTargetProtocolAddrMetricTag { - newObj := &otg.PatternFlowArpTargetProtocolAddrMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowArpTargetProtocolAddrMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowArpTargetProtocolAddrMetricTagSlice = append(obj.patternFlowArpTargetProtocolAddrMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) Append(items ...PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowArpTargetProtocolAddrMetricTagSlice = append(obj.patternFlowArpTargetProtocolAddrMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) Set(index int, newObj PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowArpTargetProtocolAddrMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) Clear() PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowArpTargetProtocolAddrMetricTag{} - obj.patternFlowArpTargetProtocolAddrMetricTagSlice = []PatternFlowArpTargetProtocolAddrMetricTag{} - } - return obj -} -func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) clearHolderSlice() PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { - if len(obj.patternFlowArpTargetProtocolAddrMetricTagSlice) > 0 { - obj.patternFlowArpTargetProtocolAddrMetricTagSlice = []PatternFlowArpTargetProtocolAddrMetricTag{} - } - return obj -} -func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) appendHolderSlice(item PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { - obj.patternFlowArpTargetProtocolAddrMetricTagSlice = append(obj.patternFlowArpTargetProtocolAddrMetricTagSlice, item) - return obj -} - -func (obj *patternFlowArpTargetProtocolAddr) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv4(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetProtocolAddr.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateIpv4Slice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetProtocolAddr.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowArpTargetProtocolAddrMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowArpTargetProtocolAddr) setDefault() { - var choices_set int = 0 - var choice PatternFlowArpTargetProtocolAddrChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowArpTargetProtocolAddrChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowArpTargetProtocolAddrChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowArpTargetProtocolAddrChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowArpTargetProtocolAddrChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpTargetProtocolAddr") - } - } else { - intVal := otg.PatternFlowArpTargetProtocolAddr_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowArpTargetProtocolAddr_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowIcmpEcho ***** -type flowIcmpEcho struct { - validation - obj *otg.FlowIcmpEcho - marshaller marshalFlowIcmpEcho - unMarshaller unMarshalFlowIcmpEcho - typeHolder PatternFlowIcmpEchoType - codeHolder PatternFlowIcmpEchoCode - checksumHolder PatternFlowIcmpEchoChecksum - identifierHolder PatternFlowIcmpEchoIdentifier - sequenceNumberHolder PatternFlowIcmpEchoSequenceNumber -} - -func NewFlowIcmpEcho() FlowIcmpEcho { - obj := flowIcmpEcho{obj: &otg.FlowIcmpEcho{}} - obj.setDefault() - return &obj -} - -func (obj *flowIcmpEcho) msg() *otg.FlowIcmpEcho { - return obj.obj -} - -func (obj *flowIcmpEcho) setMsg(msg *otg.FlowIcmpEcho) FlowIcmpEcho { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIcmpEcho struct { - obj *flowIcmpEcho -} - -type marshalFlowIcmpEcho interface { - // ToProto marshals FlowIcmpEcho to protobuf object *otg.FlowIcmpEcho - ToProto() (*otg.FlowIcmpEcho, error) - // ToPbText marshals FlowIcmpEcho to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIcmpEcho to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIcmpEcho to JSON text - ToJson() (string, error) -} - -type unMarshalflowIcmpEcho struct { - obj *flowIcmpEcho -} - -type unMarshalFlowIcmpEcho interface { - // FromProto unmarshals FlowIcmpEcho from protobuf object *otg.FlowIcmpEcho - FromProto(msg *otg.FlowIcmpEcho) (FlowIcmpEcho, error) - // FromPbText unmarshals FlowIcmpEcho from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIcmpEcho from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIcmpEcho from JSON text - FromJson(value string) error -} - -func (obj *flowIcmpEcho) Marshal() marshalFlowIcmpEcho { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIcmpEcho{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIcmpEcho) Unmarshal() unMarshalFlowIcmpEcho { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIcmpEcho{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIcmpEcho) ToProto() (*otg.FlowIcmpEcho, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIcmpEcho) FromProto(msg *otg.FlowIcmpEcho) (FlowIcmpEcho, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIcmpEcho) 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 *unMarshalflowIcmpEcho) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowIcmpEcho) 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 *unMarshalflowIcmpEcho) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowIcmpEcho) 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 *unMarshalflowIcmpEcho) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowIcmpEcho) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIcmpEcho) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIcmpEcho) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIcmpEcho) Clone() (FlowIcmpEcho, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIcmpEcho() - 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 -} - -func (obj *flowIcmpEcho) setNil() { - obj.typeHolder = nil - obj.codeHolder = nil - obj.checksumHolder = nil - obj.identifierHolder = nil - obj.sequenceNumberHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowIcmpEcho is packet Header for ICMP echo request -type FlowIcmpEcho interface { - Validation - // msg marshals FlowIcmpEcho to protobuf object *otg.FlowIcmpEcho - // and doesn't set defaults - msg() *otg.FlowIcmpEcho - // setMsg unmarshals FlowIcmpEcho from protobuf object *otg.FlowIcmpEcho - // and doesn't set defaults - setMsg(*otg.FlowIcmpEcho) FlowIcmpEcho - // provides marshal interface - Marshal() marshalFlowIcmpEcho - // provides unmarshal interface - Unmarshal() unMarshalFlowIcmpEcho - // validate validates FlowIcmpEcho - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIcmpEcho, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Type returns PatternFlowIcmpEchoType, set in FlowIcmpEcho. - // PatternFlowIcmpEchoType is the type of ICMP echo packet - Type() PatternFlowIcmpEchoType - // SetType assigns PatternFlowIcmpEchoType provided by user to FlowIcmpEcho. - // PatternFlowIcmpEchoType is the type of ICMP echo packet - SetType(value PatternFlowIcmpEchoType) FlowIcmpEcho - // HasType checks if Type has been set in FlowIcmpEcho - HasType() bool - // Code returns PatternFlowIcmpEchoCode, set in FlowIcmpEcho. - // PatternFlowIcmpEchoCode is the ICMP subtype. The default code for ICMP echo request and reply is 0. - Code() PatternFlowIcmpEchoCode - // SetCode assigns PatternFlowIcmpEchoCode provided by user to FlowIcmpEcho. - // PatternFlowIcmpEchoCode is the ICMP subtype. The default code for ICMP echo request and reply is 0. - SetCode(value PatternFlowIcmpEchoCode) FlowIcmpEcho - // HasCode checks if Code has been set in FlowIcmpEcho - HasCode() bool - // Checksum returns PatternFlowIcmpEchoChecksum, set in FlowIcmpEcho. - // PatternFlowIcmpEchoChecksum is iCMP checksum - Checksum() PatternFlowIcmpEchoChecksum - // SetChecksum assigns PatternFlowIcmpEchoChecksum provided by user to FlowIcmpEcho. - // PatternFlowIcmpEchoChecksum is iCMP checksum - SetChecksum(value PatternFlowIcmpEchoChecksum) FlowIcmpEcho - // HasChecksum checks if Checksum has been set in FlowIcmpEcho - HasChecksum() bool - // Identifier returns PatternFlowIcmpEchoIdentifier, set in FlowIcmpEcho. - // PatternFlowIcmpEchoIdentifier is iCMP identifier - Identifier() PatternFlowIcmpEchoIdentifier - // SetIdentifier assigns PatternFlowIcmpEchoIdentifier provided by user to FlowIcmpEcho. - // PatternFlowIcmpEchoIdentifier is iCMP identifier - SetIdentifier(value PatternFlowIcmpEchoIdentifier) FlowIcmpEcho - // HasIdentifier checks if Identifier has been set in FlowIcmpEcho - HasIdentifier() bool - // SequenceNumber returns PatternFlowIcmpEchoSequenceNumber, set in FlowIcmpEcho. - // PatternFlowIcmpEchoSequenceNumber is iCMP sequence number - SequenceNumber() PatternFlowIcmpEchoSequenceNumber - // SetSequenceNumber assigns PatternFlowIcmpEchoSequenceNumber provided by user to FlowIcmpEcho. - // PatternFlowIcmpEchoSequenceNumber is iCMP sequence number - SetSequenceNumber(value PatternFlowIcmpEchoSequenceNumber) FlowIcmpEcho - // HasSequenceNumber checks if SequenceNumber has been set in FlowIcmpEcho - HasSequenceNumber() bool - setNil() -} - -// description is TBD -// Type returns a PatternFlowIcmpEchoType -func (obj *flowIcmpEcho) Type() PatternFlowIcmpEchoType { - if obj.obj.Type == nil { - obj.obj.Type = NewPatternFlowIcmpEchoType().msg() - } - if obj.typeHolder == nil { - obj.typeHolder = &patternFlowIcmpEchoType{obj: obj.obj.Type} - } - return obj.typeHolder -} - -// description is TBD -// Type returns a PatternFlowIcmpEchoType -func (obj *flowIcmpEcho) HasType() bool { - return obj.obj.Type != nil -} - -// description is TBD -// SetType sets the PatternFlowIcmpEchoType value in the FlowIcmpEcho object -func (obj *flowIcmpEcho) SetType(value PatternFlowIcmpEchoType) FlowIcmpEcho { - - obj.typeHolder = nil - obj.obj.Type = value.msg() - - return obj -} - -// description is TBD -// Code returns a PatternFlowIcmpEchoCode -func (obj *flowIcmpEcho) Code() PatternFlowIcmpEchoCode { - if obj.obj.Code == nil { - obj.obj.Code = NewPatternFlowIcmpEchoCode().msg() - } - if obj.codeHolder == nil { - obj.codeHolder = &patternFlowIcmpEchoCode{obj: obj.obj.Code} - } - return obj.codeHolder -} - -// description is TBD -// Code returns a PatternFlowIcmpEchoCode -func (obj *flowIcmpEcho) HasCode() bool { - return obj.obj.Code != nil -} - -// description is TBD -// SetCode sets the PatternFlowIcmpEchoCode value in the FlowIcmpEcho object -func (obj *flowIcmpEcho) SetCode(value PatternFlowIcmpEchoCode) FlowIcmpEcho { - - obj.codeHolder = nil - obj.obj.Code = value.msg() - - return obj -} - -// description is TBD -// Checksum returns a PatternFlowIcmpEchoChecksum -func (obj *flowIcmpEcho) Checksum() PatternFlowIcmpEchoChecksum { - if obj.obj.Checksum == nil { - obj.obj.Checksum = NewPatternFlowIcmpEchoChecksum().msg() - } - if obj.checksumHolder == nil { - obj.checksumHolder = &patternFlowIcmpEchoChecksum{obj: obj.obj.Checksum} - } - return obj.checksumHolder -} - -// description is TBD -// Checksum returns a PatternFlowIcmpEchoChecksum -func (obj *flowIcmpEcho) HasChecksum() bool { - return obj.obj.Checksum != nil -} - -// description is TBD -// SetChecksum sets the PatternFlowIcmpEchoChecksum value in the FlowIcmpEcho object -func (obj *flowIcmpEcho) SetChecksum(value PatternFlowIcmpEchoChecksum) FlowIcmpEcho { - - obj.checksumHolder = nil - obj.obj.Checksum = value.msg() - - return obj -} - -// description is TBD -// Identifier returns a PatternFlowIcmpEchoIdentifier -func (obj *flowIcmpEcho) Identifier() PatternFlowIcmpEchoIdentifier { - if obj.obj.Identifier == nil { - obj.obj.Identifier = NewPatternFlowIcmpEchoIdentifier().msg() - } - if obj.identifierHolder == nil { - obj.identifierHolder = &patternFlowIcmpEchoIdentifier{obj: obj.obj.Identifier} - } - return obj.identifierHolder -} - -// description is TBD -// Identifier returns a PatternFlowIcmpEchoIdentifier -func (obj *flowIcmpEcho) HasIdentifier() bool { - return obj.obj.Identifier != nil -} - -// description is TBD -// SetIdentifier sets the PatternFlowIcmpEchoIdentifier value in the FlowIcmpEcho object -func (obj *flowIcmpEcho) SetIdentifier(value PatternFlowIcmpEchoIdentifier) FlowIcmpEcho { - - obj.identifierHolder = nil - obj.obj.Identifier = value.msg() - - return obj -} - -// description is TBD -// SequenceNumber returns a PatternFlowIcmpEchoSequenceNumber -func (obj *flowIcmpEcho) SequenceNumber() PatternFlowIcmpEchoSequenceNumber { - if obj.obj.SequenceNumber == nil { - obj.obj.SequenceNumber = NewPatternFlowIcmpEchoSequenceNumber().msg() - } - if obj.sequenceNumberHolder == nil { - obj.sequenceNumberHolder = &patternFlowIcmpEchoSequenceNumber{obj: obj.obj.SequenceNumber} - } - return obj.sequenceNumberHolder -} - -// description is TBD -// SequenceNumber returns a PatternFlowIcmpEchoSequenceNumber -func (obj *flowIcmpEcho) HasSequenceNumber() bool { - return obj.obj.SequenceNumber != nil -} - -// description is TBD -// SetSequenceNumber sets the PatternFlowIcmpEchoSequenceNumber value in the FlowIcmpEcho object -func (obj *flowIcmpEcho) SetSequenceNumber(value PatternFlowIcmpEchoSequenceNumber) FlowIcmpEcho { - - obj.sequenceNumberHolder = nil - obj.obj.SequenceNumber = value.msg() - - return obj -} - -func (obj *flowIcmpEcho) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Type != nil { - - obj.Type().validateObj(vObj, set_default) - } - - if obj.obj.Code != nil { - - obj.Code().validateObj(vObj, set_default) - } - - if obj.obj.Checksum != nil { - - obj.Checksum().validateObj(vObj, set_default) - } - - if obj.obj.Identifier != nil { - - obj.Identifier().validateObj(vObj, set_default) - } - - if obj.obj.SequenceNumber != nil { - - obj.SequenceNumber().validateObj(vObj, set_default) - } - -} - -func (obj *flowIcmpEcho) setDefault() { - -} - -// ***** FlowIcmpv6Echo ***** -type flowIcmpv6Echo struct { - validation - obj *otg.FlowIcmpv6Echo - marshaller marshalFlowIcmpv6Echo - unMarshaller unMarshalFlowIcmpv6Echo - typeHolder PatternFlowIcmpv6EchoType - codeHolder PatternFlowIcmpv6EchoCode - identifierHolder PatternFlowIcmpv6EchoIdentifier - sequenceNumberHolder PatternFlowIcmpv6EchoSequenceNumber - checksumHolder PatternFlowIcmpv6EchoChecksum -} - -func NewFlowIcmpv6Echo() FlowIcmpv6Echo { - obj := flowIcmpv6Echo{obj: &otg.FlowIcmpv6Echo{}} - obj.setDefault() - return &obj -} - -func (obj *flowIcmpv6Echo) msg() *otg.FlowIcmpv6Echo { - return obj.obj -} - -func (obj *flowIcmpv6Echo) setMsg(msg *otg.FlowIcmpv6Echo) FlowIcmpv6Echo { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIcmpv6Echo struct { - obj *flowIcmpv6Echo -} - -type marshalFlowIcmpv6Echo interface { - // ToProto marshals FlowIcmpv6Echo to protobuf object *otg.FlowIcmpv6Echo - ToProto() (*otg.FlowIcmpv6Echo, error) - // ToPbText marshals FlowIcmpv6Echo to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIcmpv6Echo to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIcmpv6Echo to JSON text - ToJson() (string, error) -} - -type unMarshalflowIcmpv6Echo struct { - obj *flowIcmpv6Echo -} - -type unMarshalFlowIcmpv6Echo interface { - // FromProto unmarshals FlowIcmpv6Echo from protobuf object *otg.FlowIcmpv6Echo - FromProto(msg *otg.FlowIcmpv6Echo) (FlowIcmpv6Echo, error) - // FromPbText unmarshals FlowIcmpv6Echo from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIcmpv6Echo from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIcmpv6Echo from JSON text - FromJson(value string) error -} - -func (obj *flowIcmpv6Echo) Marshal() marshalFlowIcmpv6Echo { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIcmpv6Echo{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIcmpv6Echo) Unmarshal() unMarshalFlowIcmpv6Echo { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIcmpv6Echo{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIcmpv6Echo) ToProto() (*otg.FlowIcmpv6Echo, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIcmpv6Echo) FromProto(msg *otg.FlowIcmpv6Echo) (FlowIcmpv6Echo, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIcmpv6Echo) 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 *unMarshalflowIcmpv6Echo) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowIcmpv6Echo) 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 *unMarshalflowIcmpv6Echo) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowIcmpv6Echo) 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 *unMarshalflowIcmpv6Echo) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowIcmpv6Echo) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIcmpv6Echo) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIcmpv6Echo) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIcmpv6Echo) Clone() (FlowIcmpv6Echo, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIcmpv6Echo() - 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 -} - -func (obj *flowIcmpv6Echo) setNil() { - obj.typeHolder = nil - obj.codeHolder = nil - obj.identifierHolder = nil - obj.sequenceNumberHolder = nil - obj.checksumHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowIcmpv6Echo is packet Header for ICMPv6 Echo -type FlowIcmpv6Echo interface { - Validation - // msg marshals FlowIcmpv6Echo to protobuf object *otg.FlowIcmpv6Echo - // and doesn't set defaults - msg() *otg.FlowIcmpv6Echo - // setMsg unmarshals FlowIcmpv6Echo from protobuf object *otg.FlowIcmpv6Echo - // and doesn't set defaults - setMsg(*otg.FlowIcmpv6Echo) FlowIcmpv6Echo - // provides marshal interface - Marshal() marshalFlowIcmpv6Echo - // provides unmarshal interface - Unmarshal() unMarshalFlowIcmpv6Echo - // validate validates FlowIcmpv6Echo - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIcmpv6Echo, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Type returns PatternFlowIcmpv6EchoType, set in FlowIcmpv6Echo. - // PatternFlowIcmpv6EchoType is iCMPv6 echo type - Type() PatternFlowIcmpv6EchoType - // SetType assigns PatternFlowIcmpv6EchoType provided by user to FlowIcmpv6Echo. - // PatternFlowIcmpv6EchoType is iCMPv6 echo type - SetType(value PatternFlowIcmpv6EchoType) FlowIcmpv6Echo - // HasType checks if Type has been set in FlowIcmpv6Echo - HasType() bool - // Code returns PatternFlowIcmpv6EchoCode, set in FlowIcmpv6Echo. - // PatternFlowIcmpv6EchoCode is iCMPv6 echo sub type - Code() PatternFlowIcmpv6EchoCode - // SetCode assigns PatternFlowIcmpv6EchoCode provided by user to FlowIcmpv6Echo. - // PatternFlowIcmpv6EchoCode is iCMPv6 echo sub type - SetCode(value PatternFlowIcmpv6EchoCode) FlowIcmpv6Echo - // HasCode checks if Code has been set in FlowIcmpv6Echo - HasCode() bool - // Identifier returns PatternFlowIcmpv6EchoIdentifier, set in FlowIcmpv6Echo. - // PatternFlowIcmpv6EchoIdentifier is iCMPv6 echo identifier - Identifier() PatternFlowIcmpv6EchoIdentifier - // SetIdentifier assigns PatternFlowIcmpv6EchoIdentifier provided by user to FlowIcmpv6Echo. - // PatternFlowIcmpv6EchoIdentifier is iCMPv6 echo identifier - SetIdentifier(value PatternFlowIcmpv6EchoIdentifier) FlowIcmpv6Echo - // HasIdentifier checks if Identifier has been set in FlowIcmpv6Echo - HasIdentifier() bool - // SequenceNumber returns PatternFlowIcmpv6EchoSequenceNumber, set in FlowIcmpv6Echo. - // PatternFlowIcmpv6EchoSequenceNumber is iCMPv6 echo sequence number - SequenceNumber() PatternFlowIcmpv6EchoSequenceNumber - // SetSequenceNumber assigns PatternFlowIcmpv6EchoSequenceNumber provided by user to FlowIcmpv6Echo. - // PatternFlowIcmpv6EchoSequenceNumber is iCMPv6 echo sequence number - SetSequenceNumber(value PatternFlowIcmpv6EchoSequenceNumber) FlowIcmpv6Echo - // HasSequenceNumber checks if SequenceNumber has been set in FlowIcmpv6Echo - HasSequenceNumber() bool - // Checksum returns PatternFlowIcmpv6EchoChecksum, set in FlowIcmpv6Echo. - // PatternFlowIcmpv6EchoChecksum is iCMPv6 checksum - Checksum() PatternFlowIcmpv6EchoChecksum - // SetChecksum assigns PatternFlowIcmpv6EchoChecksum provided by user to FlowIcmpv6Echo. - // PatternFlowIcmpv6EchoChecksum is iCMPv6 checksum - SetChecksum(value PatternFlowIcmpv6EchoChecksum) FlowIcmpv6Echo - // HasChecksum checks if Checksum has been set in FlowIcmpv6Echo - HasChecksum() bool - setNil() -} - -// description is TBD -// Type returns a PatternFlowIcmpv6EchoType -func (obj *flowIcmpv6Echo) Type() PatternFlowIcmpv6EchoType { - if obj.obj.Type == nil { - obj.obj.Type = NewPatternFlowIcmpv6EchoType().msg() - } - if obj.typeHolder == nil { - obj.typeHolder = &patternFlowIcmpv6EchoType{obj: obj.obj.Type} - } - return obj.typeHolder -} - -// description is TBD -// Type returns a PatternFlowIcmpv6EchoType -func (obj *flowIcmpv6Echo) HasType() bool { - return obj.obj.Type != nil -} - -// description is TBD -// SetType sets the PatternFlowIcmpv6EchoType value in the FlowIcmpv6Echo object -func (obj *flowIcmpv6Echo) SetType(value PatternFlowIcmpv6EchoType) FlowIcmpv6Echo { - - obj.typeHolder = nil - obj.obj.Type = value.msg() - - return obj -} - -// description is TBD -// Code returns a PatternFlowIcmpv6EchoCode -func (obj *flowIcmpv6Echo) Code() PatternFlowIcmpv6EchoCode { - if obj.obj.Code == nil { - obj.obj.Code = NewPatternFlowIcmpv6EchoCode().msg() - } - if obj.codeHolder == nil { - obj.codeHolder = &patternFlowIcmpv6EchoCode{obj: obj.obj.Code} - } - return obj.codeHolder -} - -// description is TBD -// Code returns a PatternFlowIcmpv6EchoCode -func (obj *flowIcmpv6Echo) HasCode() bool { - return obj.obj.Code != nil -} - -// description is TBD -// SetCode sets the PatternFlowIcmpv6EchoCode value in the FlowIcmpv6Echo object -func (obj *flowIcmpv6Echo) SetCode(value PatternFlowIcmpv6EchoCode) FlowIcmpv6Echo { - - obj.codeHolder = nil - obj.obj.Code = value.msg() - - return obj -} - -// description is TBD -// Identifier returns a PatternFlowIcmpv6EchoIdentifier -func (obj *flowIcmpv6Echo) Identifier() PatternFlowIcmpv6EchoIdentifier { - if obj.obj.Identifier == nil { - obj.obj.Identifier = NewPatternFlowIcmpv6EchoIdentifier().msg() - } - if obj.identifierHolder == nil { - obj.identifierHolder = &patternFlowIcmpv6EchoIdentifier{obj: obj.obj.Identifier} - } - return obj.identifierHolder -} - -// description is TBD -// Identifier returns a PatternFlowIcmpv6EchoIdentifier -func (obj *flowIcmpv6Echo) HasIdentifier() bool { - return obj.obj.Identifier != nil -} - -// description is TBD -// SetIdentifier sets the PatternFlowIcmpv6EchoIdentifier value in the FlowIcmpv6Echo object -func (obj *flowIcmpv6Echo) SetIdentifier(value PatternFlowIcmpv6EchoIdentifier) FlowIcmpv6Echo { - - obj.identifierHolder = nil - obj.obj.Identifier = value.msg() - - return obj -} - -// description is TBD -// SequenceNumber returns a PatternFlowIcmpv6EchoSequenceNumber -func (obj *flowIcmpv6Echo) SequenceNumber() PatternFlowIcmpv6EchoSequenceNumber { - if obj.obj.SequenceNumber == nil { - obj.obj.SequenceNumber = NewPatternFlowIcmpv6EchoSequenceNumber().msg() - } - if obj.sequenceNumberHolder == nil { - obj.sequenceNumberHolder = &patternFlowIcmpv6EchoSequenceNumber{obj: obj.obj.SequenceNumber} - } - return obj.sequenceNumberHolder -} - -// description is TBD -// SequenceNumber returns a PatternFlowIcmpv6EchoSequenceNumber -func (obj *flowIcmpv6Echo) HasSequenceNumber() bool { - return obj.obj.SequenceNumber != nil -} - -// description is TBD -// SetSequenceNumber sets the PatternFlowIcmpv6EchoSequenceNumber value in the FlowIcmpv6Echo object -func (obj *flowIcmpv6Echo) SetSequenceNumber(value PatternFlowIcmpv6EchoSequenceNumber) FlowIcmpv6Echo { - - obj.sequenceNumberHolder = nil - obj.obj.SequenceNumber = value.msg() - - return obj -} - -// description is TBD -// Checksum returns a PatternFlowIcmpv6EchoChecksum -func (obj *flowIcmpv6Echo) Checksum() PatternFlowIcmpv6EchoChecksum { - if obj.obj.Checksum == nil { - obj.obj.Checksum = NewPatternFlowIcmpv6EchoChecksum().msg() - } - if obj.checksumHolder == nil { - obj.checksumHolder = &patternFlowIcmpv6EchoChecksum{obj: obj.obj.Checksum} - } - return obj.checksumHolder -} - -// description is TBD -// Checksum returns a PatternFlowIcmpv6EchoChecksum -func (obj *flowIcmpv6Echo) HasChecksum() bool { - return obj.obj.Checksum != nil -} - -// description is TBD -// SetChecksum sets the PatternFlowIcmpv6EchoChecksum value in the FlowIcmpv6Echo object -func (obj *flowIcmpv6Echo) SetChecksum(value PatternFlowIcmpv6EchoChecksum) FlowIcmpv6Echo { - - obj.checksumHolder = nil - obj.obj.Checksum = value.msg() - - return obj -} - -func (obj *flowIcmpv6Echo) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Type != nil { - - obj.Type().validateObj(vObj, set_default) - } - - if obj.obj.Code != nil { - - obj.Code().validateObj(vObj, set_default) - } - - if obj.obj.Identifier != nil { - - obj.Identifier().validateObj(vObj, set_default) - } - - if obj.obj.SequenceNumber != nil { - - obj.SequenceNumber().validateObj(vObj, set_default) - } - - if obj.obj.Checksum != nil { - - obj.Checksum().validateObj(vObj, set_default) - } - -} - -func (obj *flowIcmpv6Echo) setDefault() { - -} - -// ***** PatternFlowPppAddress ***** -type patternFlowPppAddress struct { - validation - obj *otg.PatternFlowPppAddress - marshaller marshalPatternFlowPppAddress - unMarshaller unMarshalPatternFlowPppAddress - incrementHolder PatternFlowPppAddressCounter - decrementHolder PatternFlowPppAddressCounter - metricTagsHolder PatternFlowPppAddressPatternFlowPppAddressMetricTagIter -} - -func NewPatternFlowPppAddress() PatternFlowPppAddress { - obj := patternFlowPppAddress{obj: &otg.PatternFlowPppAddress{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPppAddress) msg() *otg.PatternFlowPppAddress { - return obj.obj -} - -func (obj *patternFlowPppAddress) setMsg(msg *otg.PatternFlowPppAddress) PatternFlowPppAddress { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPppAddress struct { - obj *patternFlowPppAddress -} - -type marshalPatternFlowPppAddress interface { - // ToProto marshals PatternFlowPppAddress to protobuf object *otg.PatternFlowPppAddress - ToProto() (*otg.PatternFlowPppAddress, error) - // ToPbText marshals PatternFlowPppAddress to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPppAddress to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPppAddress to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPppAddress struct { - obj *patternFlowPppAddress -} - -type unMarshalPatternFlowPppAddress interface { - // FromProto unmarshals PatternFlowPppAddress from protobuf object *otg.PatternFlowPppAddress - FromProto(msg *otg.PatternFlowPppAddress) (PatternFlowPppAddress, error) - // FromPbText unmarshals PatternFlowPppAddress from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPppAddress from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPppAddress from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPppAddress) Marshal() marshalPatternFlowPppAddress { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPppAddress{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPppAddress) Unmarshal() unMarshalPatternFlowPppAddress { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPppAddress{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPppAddress) ToProto() (*otg.PatternFlowPppAddress, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPppAddress) FromProto(msg *otg.PatternFlowPppAddress) (PatternFlowPppAddress, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPppAddress) 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 *unMarshalpatternFlowPppAddress) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPppAddress) 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 *unMarshalpatternFlowPppAddress) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPppAddress) 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 *unMarshalpatternFlowPppAddress) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPppAddress) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPppAddress) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPppAddress) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPppAddress) Clone() (PatternFlowPppAddress, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPppAddress() - 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 -} - -func (obj *patternFlowPppAddress) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPppAddress is pPP address -type PatternFlowPppAddress interface { - Validation - // msg marshals PatternFlowPppAddress to protobuf object *otg.PatternFlowPppAddress - // and doesn't set defaults - msg() *otg.PatternFlowPppAddress - // setMsg unmarshals PatternFlowPppAddress from protobuf object *otg.PatternFlowPppAddress - // and doesn't set defaults - setMsg(*otg.PatternFlowPppAddress) PatternFlowPppAddress - // provides marshal interface - Marshal() marshalPatternFlowPppAddress - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPppAddress - // validate validates PatternFlowPppAddress - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPppAddress, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPppAddressChoiceEnum, set in PatternFlowPppAddress - Choice() PatternFlowPppAddressChoiceEnum - // setChoice assigns PatternFlowPppAddressChoiceEnum provided by user to PatternFlowPppAddress - setChoice(value PatternFlowPppAddressChoiceEnum) PatternFlowPppAddress - // HasChoice checks if Choice has been set in PatternFlowPppAddress - HasChoice() bool - // Value returns uint32, set in PatternFlowPppAddress. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowPppAddress - SetValue(value uint32) PatternFlowPppAddress - // HasValue checks if Value has been set in PatternFlowPppAddress - HasValue() bool - // Values returns []uint32, set in PatternFlowPppAddress. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowPppAddress - SetValues(value []uint32) PatternFlowPppAddress - // Increment returns PatternFlowPppAddressCounter, set in PatternFlowPppAddress. - // PatternFlowPppAddressCounter is integer counter pattern - Increment() PatternFlowPppAddressCounter - // SetIncrement assigns PatternFlowPppAddressCounter provided by user to PatternFlowPppAddress. - // PatternFlowPppAddressCounter is integer counter pattern - SetIncrement(value PatternFlowPppAddressCounter) PatternFlowPppAddress - // HasIncrement checks if Increment has been set in PatternFlowPppAddress - HasIncrement() bool - // Decrement returns PatternFlowPppAddressCounter, set in PatternFlowPppAddress. - // PatternFlowPppAddressCounter is integer counter pattern - Decrement() PatternFlowPppAddressCounter - // SetDecrement assigns PatternFlowPppAddressCounter provided by user to PatternFlowPppAddress. - // PatternFlowPppAddressCounter is integer counter pattern - SetDecrement(value PatternFlowPppAddressCounter) PatternFlowPppAddress - // HasDecrement checks if Decrement has been set in PatternFlowPppAddress - HasDecrement() bool - // MetricTags returns PatternFlowPppAddressPatternFlowPppAddressMetricTagIterIter, set in PatternFlowPppAddress - MetricTags() PatternFlowPppAddressPatternFlowPppAddressMetricTagIter - setNil() -} - -type PatternFlowPppAddressChoiceEnum string - -// Enum of Choice on PatternFlowPppAddress -var PatternFlowPppAddressChoice = struct { - VALUE PatternFlowPppAddressChoiceEnum - VALUES PatternFlowPppAddressChoiceEnum - INCREMENT PatternFlowPppAddressChoiceEnum - DECREMENT PatternFlowPppAddressChoiceEnum -}{ - VALUE: PatternFlowPppAddressChoiceEnum("value"), - VALUES: PatternFlowPppAddressChoiceEnum("values"), - INCREMENT: PatternFlowPppAddressChoiceEnum("increment"), - DECREMENT: PatternFlowPppAddressChoiceEnum("decrement"), -} - -func (obj *patternFlowPppAddress) Choice() PatternFlowPppAddressChoiceEnum { - return PatternFlowPppAddressChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPppAddress) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPppAddress) setChoice(value PatternFlowPppAddressChoiceEnum) PatternFlowPppAddress { - intValue, ok := otg.PatternFlowPppAddress_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPppAddressChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPppAddress_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPppAddressChoice.VALUE { - defaultValue := uint32(255) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPppAddressChoice.VALUES { - defaultValue := []uint32{255} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPppAddressChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowPppAddressCounter().msg() - } - - if value == PatternFlowPppAddressChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPppAddressCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPppAddress) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPppAddressChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPppAddress) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowPppAddress object -func (obj *patternFlowPppAddress) SetValue(value uint32) PatternFlowPppAddress { - obj.setChoice(PatternFlowPppAddressChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowPppAddress) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{255}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowPppAddress object -func (obj *patternFlowPppAddress) SetValues(value []uint32) PatternFlowPppAddress { - obj.setChoice(PatternFlowPppAddressChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPppAddressCounter -func (obj *patternFlowPppAddress) Increment() PatternFlowPppAddressCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPppAddressChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPppAddressCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPppAddressCounter -func (obj *patternFlowPppAddress) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPppAddressCounter value in the PatternFlowPppAddress object -func (obj *patternFlowPppAddress) SetIncrement(value PatternFlowPppAddressCounter) PatternFlowPppAddress { - obj.setChoice(PatternFlowPppAddressChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPppAddressCounter -func (obj *patternFlowPppAddress) Decrement() PatternFlowPppAddressCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPppAddressChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPppAddressCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPppAddressCounter -func (obj *patternFlowPppAddress) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPppAddressCounter value in the PatternFlowPppAddress object -func (obj *patternFlowPppAddress) SetDecrement(value PatternFlowPppAddressCounter) PatternFlowPppAddress { - obj.setChoice(PatternFlowPppAddressChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPppAddressMetricTag -func (obj *patternFlowPppAddress) MetricTags() PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPppAddressMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPppAddressPatternFlowPppAddressMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPppAddressPatternFlowPppAddressMetricTagIter struct { - obj *patternFlowPppAddress - patternFlowPppAddressMetricTagSlice []PatternFlowPppAddressMetricTag - fieldPtr *[]*otg.PatternFlowPppAddressMetricTag -} - -func newPatternFlowPppAddressPatternFlowPppAddressMetricTagIter(ptr *[]*otg.PatternFlowPppAddressMetricTag) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { - return &patternFlowPppAddressPatternFlowPppAddressMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPppAddressPatternFlowPppAddressMetricTagIter interface { - setMsg(*patternFlowPppAddress) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter - Items() []PatternFlowPppAddressMetricTag - Add() PatternFlowPppAddressMetricTag - Append(items ...PatternFlowPppAddressMetricTag) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter - Set(index int, newObj PatternFlowPppAddressMetricTag) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter - Clear() PatternFlowPppAddressPatternFlowPppAddressMetricTagIter - clearHolderSlice() PatternFlowPppAddressPatternFlowPppAddressMetricTagIter - appendHolderSlice(item PatternFlowPppAddressMetricTag) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter -} - -func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) setMsg(msg *patternFlowPppAddress) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPppAddressMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) Items() []PatternFlowPppAddressMetricTag { - return obj.patternFlowPppAddressMetricTagSlice -} - -func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) Add() PatternFlowPppAddressMetricTag { - newObj := &otg.PatternFlowPppAddressMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPppAddressMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPppAddressMetricTagSlice = append(obj.patternFlowPppAddressMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) Append(items ...PatternFlowPppAddressMetricTag) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPppAddressMetricTagSlice = append(obj.patternFlowPppAddressMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) Set(index int, newObj PatternFlowPppAddressMetricTag) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPppAddressMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) Clear() PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPppAddressMetricTag{} - obj.patternFlowPppAddressMetricTagSlice = []PatternFlowPppAddressMetricTag{} - } - return obj -} -func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) clearHolderSlice() PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { - if len(obj.patternFlowPppAddressMetricTagSlice) > 0 { - obj.patternFlowPppAddressMetricTagSlice = []PatternFlowPppAddressMetricTag{} - } - return obj -} -func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) appendHolderSlice(item PatternFlowPppAddressMetricTag) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { - obj.patternFlowPppAddressMetricTagSlice = append(obj.patternFlowPppAddressMetricTagSlice, item) - return obj -} - -func (obj *patternFlowPppAddress) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppAddress.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowPppAddress.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPppAddressMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPppAddress) setDefault() { - var choices_set int = 0 - var choice PatternFlowPppAddressChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPppAddressChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPppAddressChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPppAddressChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPppAddressChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPppAddressChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPppAddress") - } - } else { - intVal := otg.PatternFlowPppAddress_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPppAddress_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPppControl ***** -type patternFlowPppControl struct { - validation - obj *otg.PatternFlowPppControl - marshaller marshalPatternFlowPppControl - unMarshaller unMarshalPatternFlowPppControl - incrementHolder PatternFlowPppControlCounter - decrementHolder PatternFlowPppControlCounter - metricTagsHolder PatternFlowPppControlPatternFlowPppControlMetricTagIter -} - -func NewPatternFlowPppControl() PatternFlowPppControl { - obj := patternFlowPppControl{obj: &otg.PatternFlowPppControl{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPppControl) msg() *otg.PatternFlowPppControl { - return obj.obj -} - -func (obj *patternFlowPppControl) setMsg(msg *otg.PatternFlowPppControl) PatternFlowPppControl { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPppControl struct { - obj *patternFlowPppControl -} - -type marshalPatternFlowPppControl interface { - // ToProto marshals PatternFlowPppControl to protobuf object *otg.PatternFlowPppControl - ToProto() (*otg.PatternFlowPppControl, error) - // ToPbText marshals PatternFlowPppControl to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPppControl to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPppControl to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPppControl struct { - obj *patternFlowPppControl -} - -type unMarshalPatternFlowPppControl interface { - // FromProto unmarshals PatternFlowPppControl from protobuf object *otg.PatternFlowPppControl - FromProto(msg *otg.PatternFlowPppControl) (PatternFlowPppControl, error) - // FromPbText unmarshals PatternFlowPppControl from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPppControl from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPppControl from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPppControl) Marshal() marshalPatternFlowPppControl { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPppControl{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPppControl) Unmarshal() unMarshalPatternFlowPppControl { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPppControl{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPppControl) ToProto() (*otg.PatternFlowPppControl, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPppControl) FromProto(msg *otg.PatternFlowPppControl) (PatternFlowPppControl, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPppControl) 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 *unMarshalpatternFlowPppControl) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPppControl) 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 *unMarshalpatternFlowPppControl) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPppControl) 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 *unMarshalpatternFlowPppControl) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPppControl) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPppControl) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPppControl) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPppControl) Clone() (PatternFlowPppControl, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPppControl() - 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 -} - -func (obj *patternFlowPppControl) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPppControl is pPP control -type PatternFlowPppControl interface { - Validation - // msg marshals PatternFlowPppControl to protobuf object *otg.PatternFlowPppControl - // and doesn't set defaults - msg() *otg.PatternFlowPppControl - // setMsg unmarshals PatternFlowPppControl from protobuf object *otg.PatternFlowPppControl - // and doesn't set defaults - setMsg(*otg.PatternFlowPppControl) PatternFlowPppControl - // provides marshal interface - Marshal() marshalPatternFlowPppControl - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPppControl - // validate validates PatternFlowPppControl - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPppControl, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPppControlChoiceEnum, set in PatternFlowPppControl - Choice() PatternFlowPppControlChoiceEnum - // setChoice assigns PatternFlowPppControlChoiceEnum provided by user to PatternFlowPppControl - setChoice(value PatternFlowPppControlChoiceEnum) PatternFlowPppControl - // HasChoice checks if Choice has been set in PatternFlowPppControl - HasChoice() bool - // Value returns uint32, set in PatternFlowPppControl. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowPppControl - SetValue(value uint32) PatternFlowPppControl - // HasValue checks if Value has been set in PatternFlowPppControl - HasValue() bool - // Values returns []uint32, set in PatternFlowPppControl. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowPppControl - SetValues(value []uint32) PatternFlowPppControl - // Increment returns PatternFlowPppControlCounter, set in PatternFlowPppControl. - // PatternFlowPppControlCounter is integer counter pattern - Increment() PatternFlowPppControlCounter - // SetIncrement assigns PatternFlowPppControlCounter provided by user to PatternFlowPppControl. - // PatternFlowPppControlCounter is integer counter pattern - SetIncrement(value PatternFlowPppControlCounter) PatternFlowPppControl - // HasIncrement checks if Increment has been set in PatternFlowPppControl - HasIncrement() bool - // Decrement returns PatternFlowPppControlCounter, set in PatternFlowPppControl. - // PatternFlowPppControlCounter is integer counter pattern - Decrement() PatternFlowPppControlCounter - // SetDecrement assigns PatternFlowPppControlCounter provided by user to PatternFlowPppControl. - // PatternFlowPppControlCounter is integer counter pattern - SetDecrement(value PatternFlowPppControlCounter) PatternFlowPppControl - // HasDecrement checks if Decrement has been set in PatternFlowPppControl - HasDecrement() bool - // MetricTags returns PatternFlowPppControlPatternFlowPppControlMetricTagIterIter, set in PatternFlowPppControl - MetricTags() PatternFlowPppControlPatternFlowPppControlMetricTagIter - setNil() -} - -type PatternFlowPppControlChoiceEnum string - -// Enum of Choice on PatternFlowPppControl -var PatternFlowPppControlChoice = struct { - VALUE PatternFlowPppControlChoiceEnum - VALUES PatternFlowPppControlChoiceEnum - INCREMENT PatternFlowPppControlChoiceEnum - DECREMENT PatternFlowPppControlChoiceEnum -}{ - VALUE: PatternFlowPppControlChoiceEnum("value"), - VALUES: PatternFlowPppControlChoiceEnum("values"), - INCREMENT: PatternFlowPppControlChoiceEnum("increment"), - DECREMENT: PatternFlowPppControlChoiceEnum("decrement"), -} - -func (obj *patternFlowPppControl) Choice() PatternFlowPppControlChoiceEnum { - return PatternFlowPppControlChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPppControl) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPppControl) setChoice(value PatternFlowPppControlChoiceEnum) PatternFlowPppControl { - intValue, ok := otg.PatternFlowPppControl_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPppControlChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPppControl_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPppControlChoice.VALUE { - defaultValue := uint32(3) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPppControlChoice.VALUES { - defaultValue := []uint32{3} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPppControlChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowPppControlCounter().msg() - } - - if value == PatternFlowPppControlChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPppControlCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPppControl) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPppControlChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPppControl) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowPppControl object -func (obj *patternFlowPppControl) SetValue(value uint32) PatternFlowPppControl { - obj.setChoice(PatternFlowPppControlChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowPppControl) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{3}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowPppControl object -func (obj *patternFlowPppControl) SetValues(value []uint32) PatternFlowPppControl { - obj.setChoice(PatternFlowPppControlChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowPppControlCounter -func (obj *patternFlowPppControl) Increment() PatternFlowPppControlCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPppControlChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPppControlCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPppControlCounter -func (obj *patternFlowPppControl) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPppControlCounter value in the PatternFlowPppControl object -func (obj *patternFlowPppControl) SetIncrement(value PatternFlowPppControlCounter) PatternFlowPppControl { - obj.setChoice(PatternFlowPppControlChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPppControlCounter -func (obj *patternFlowPppControl) Decrement() PatternFlowPppControlCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPppControlChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPppControlCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPppControlCounter -func (obj *patternFlowPppControl) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPppControlCounter value in the PatternFlowPppControl object -func (obj *patternFlowPppControl) SetDecrement(value PatternFlowPppControlCounter) PatternFlowPppControl { - obj.setChoice(PatternFlowPppControlChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPppControlMetricTag -func (obj *patternFlowPppControl) MetricTags() PatternFlowPppControlPatternFlowPppControlMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPppControlMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPppControlPatternFlowPppControlMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPppControlPatternFlowPppControlMetricTagIter struct { - obj *patternFlowPppControl - patternFlowPppControlMetricTagSlice []PatternFlowPppControlMetricTag - fieldPtr *[]*otg.PatternFlowPppControlMetricTag -} - -func newPatternFlowPppControlPatternFlowPppControlMetricTagIter(ptr *[]*otg.PatternFlowPppControlMetricTag) PatternFlowPppControlPatternFlowPppControlMetricTagIter { - return &patternFlowPppControlPatternFlowPppControlMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPppControlPatternFlowPppControlMetricTagIter interface { - setMsg(*patternFlowPppControl) PatternFlowPppControlPatternFlowPppControlMetricTagIter - Items() []PatternFlowPppControlMetricTag - Add() PatternFlowPppControlMetricTag - Append(items ...PatternFlowPppControlMetricTag) PatternFlowPppControlPatternFlowPppControlMetricTagIter - Set(index int, newObj PatternFlowPppControlMetricTag) PatternFlowPppControlPatternFlowPppControlMetricTagIter - Clear() PatternFlowPppControlPatternFlowPppControlMetricTagIter - clearHolderSlice() PatternFlowPppControlPatternFlowPppControlMetricTagIter - appendHolderSlice(item PatternFlowPppControlMetricTag) PatternFlowPppControlPatternFlowPppControlMetricTagIter -} - -func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) setMsg(msg *patternFlowPppControl) PatternFlowPppControlPatternFlowPppControlMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPppControlMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) Items() []PatternFlowPppControlMetricTag { - return obj.patternFlowPppControlMetricTagSlice -} - -func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) Add() PatternFlowPppControlMetricTag { - newObj := &otg.PatternFlowPppControlMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPppControlMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPppControlMetricTagSlice = append(obj.patternFlowPppControlMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) Append(items ...PatternFlowPppControlMetricTag) PatternFlowPppControlPatternFlowPppControlMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPppControlMetricTagSlice = append(obj.patternFlowPppControlMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) Set(index int, newObj PatternFlowPppControlMetricTag) PatternFlowPppControlPatternFlowPppControlMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPppControlMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) Clear() PatternFlowPppControlPatternFlowPppControlMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPppControlMetricTag{} - obj.patternFlowPppControlMetricTagSlice = []PatternFlowPppControlMetricTag{} - } - return obj -} -func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) clearHolderSlice() PatternFlowPppControlPatternFlowPppControlMetricTagIter { - if len(obj.patternFlowPppControlMetricTagSlice) > 0 { - obj.patternFlowPppControlMetricTagSlice = []PatternFlowPppControlMetricTag{} - } - return obj -} -func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) appendHolderSlice(item PatternFlowPppControlMetricTag) PatternFlowPppControlPatternFlowPppControlMetricTagIter { - obj.patternFlowPppControlMetricTagSlice = append(obj.patternFlowPppControlMetricTagSlice, item) - return obj -} - -func (obj *patternFlowPppControl) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppControl.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowPppControl.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPppControlMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPppControl) setDefault() { - var choices_set int = 0 - var choice PatternFlowPppControlChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPppControlChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPppControlChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPppControlChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPppControlChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPppControlChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPppControl") - } - } else { - intVal := otg.PatternFlowPppControl_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPppControl_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPppProtocolType ***** -type patternFlowPppProtocolType struct { - validation - obj *otg.PatternFlowPppProtocolType - marshaller marshalPatternFlowPppProtocolType - unMarshaller unMarshalPatternFlowPppProtocolType - incrementHolder PatternFlowPppProtocolTypeCounter - decrementHolder PatternFlowPppProtocolTypeCounter - metricTagsHolder PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter -} - -func NewPatternFlowPppProtocolType() PatternFlowPppProtocolType { - obj := patternFlowPppProtocolType{obj: &otg.PatternFlowPppProtocolType{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPppProtocolType) msg() *otg.PatternFlowPppProtocolType { - return obj.obj -} - -func (obj *patternFlowPppProtocolType) setMsg(msg *otg.PatternFlowPppProtocolType) PatternFlowPppProtocolType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPppProtocolType struct { - obj *patternFlowPppProtocolType -} - -type marshalPatternFlowPppProtocolType interface { - // ToProto marshals PatternFlowPppProtocolType to protobuf object *otg.PatternFlowPppProtocolType - ToProto() (*otg.PatternFlowPppProtocolType, error) - // ToPbText marshals PatternFlowPppProtocolType to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPppProtocolType to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPppProtocolType to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPppProtocolType struct { - obj *patternFlowPppProtocolType -} - -type unMarshalPatternFlowPppProtocolType interface { - // FromProto unmarshals PatternFlowPppProtocolType from protobuf object *otg.PatternFlowPppProtocolType - FromProto(msg *otg.PatternFlowPppProtocolType) (PatternFlowPppProtocolType, error) - // FromPbText unmarshals PatternFlowPppProtocolType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPppProtocolType from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPppProtocolType from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPppProtocolType) Marshal() marshalPatternFlowPppProtocolType { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPppProtocolType{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPppProtocolType) Unmarshal() unMarshalPatternFlowPppProtocolType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPppProtocolType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPppProtocolType) ToProto() (*otg.PatternFlowPppProtocolType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPppProtocolType) FromProto(msg *otg.PatternFlowPppProtocolType) (PatternFlowPppProtocolType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPppProtocolType) 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 *unMarshalpatternFlowPppProtocolType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowPppProtocolType) 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 *unMarshalpatternFlowPppProtocolType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowPppProtocolType) 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 *unMarshalpatternFlowPppProtocolType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowPppProtocolType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPppProtocolType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPppProtocolType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPppProtocolType) Clone() (PatternFlowPppProtocolType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPppProtocolType() - 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 -} - -func (obj *patternFlowPppProtocolType) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowPppProtocolType is pPP protocol type -type PatternFlowPppProtocolType interface { - Validation - // msg marshals PatternFlowPppProtocolType to protobuf object *otg.PatternFlowPppProtocolType - // and doesn't set defaults - msg() *otg.PatternFlowPppProtocolType - // setMsg unmarshals PatternFlowPppProtocolType from protobuf object *otg.PatternFlowPppProtocolType - // and doesn't set defaults - setMsg(*otg.PatternFlowPppProtocolType) PatternFlowPppProtocolType - // provides marshal interface - Marshal() marshalPatternFlowPppProtocolType - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPppProtocolType - // validate validates PatternFlowPppProtocolType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPppProtocolType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowPppProtocolTypeChoiceEnum, set in PatternFlowPppProtocolType - Choice() PatternFlowPppProtocolTypeChoiceEnum - // setChoice assigns PatternFlowPppProtocolTypeChoiceEnum provided by user to PatternFlowPppProtocolType - setChoice(value PatternFlowPppProtocolTypeChoiceEnum) PatternFlowPppProtocolType - // HasChoice checks if Choice has been set in PatternFlowPppProtocolType - HasChoice() bool - // Value returns uint32, set in PatternFlowPppProtocolType. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowPppProtocolType - SetValue(value uint32) PatternFlowPppProtocolType - // HasValue checks if Value has been set in PatternFlowPppProtocolType - HasValue() bool - // Values returns []uint32, set in PatternFlowPppProtocolType. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowPppProtocolType - SetValues(value []uint32) PatternFlowPppProtocolType - // Auto returns uint32, set in PatternFlowPppProtocolType. - Auto() uint32 - // HasAuto checks if Auto has been set in PatternFlowPppProtocolType - HasAuto() bool - // Increment returns PatternFlowPppProtocolTypeCounter, set in PatternFlowPppProtocolType. - // PatternFlowPppProtocolTypeCounter is integer counter pattern - Increment() PatternFlowPppProtocolTypeCounter - // SetIncrement assigns PatternFlowPppProtocolTypeCounter provided by user to PatternFlowPppProtocolType. - // PatternFlowPppProtocolTypeCounter is integer counter pattern - SetIncrement(value PatternFlowPppProtocolTypeCounter) PatternFlowPppProtocolType - // HasIncrement checks if Increment has been set in PatternFlowPppProtocolType - HasIncrement() bool - // Decrement returns PatternFlowPppProtocolTypeCounter, set in PatternFlowPppProtocolType. - // PatternFlowPppProtocolTypeCounter is integer counter pattern - Decrement() PatternFlowPppProtocolTypeCounter - // SetDecrement assigns PatternFlowPppProtocolTypeCounter provided by user to PatternFlowPppProtocolType. - // PatternFlowPppProtocolTypeCounter is integer counter pattern - SetDecrement(value PatternFlowPppProtocolTypeCounter) PatternFlowPppProtocolType - // HasDecrement checks if Decrement has been set in PatternFlowPppProtocolType - HasDecrement() bool - // MetricTags returns PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIterIter, set in PatternFlowPppProtocolType - MetricTags() PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter - setNil() -} - -type PatternFlowPppProtocolTypeChoiceEnum string - -// Enum of Choice on PatternFlowPppProtocolType -var PatternFlowPppProtocolTypeChoice = struct { - VALUE PatternFlowPppProtocolTypeChoiceEnum - VALUES PatternFlowPppProtocolTypeChoiceEnum - AUTO PatternFlowPppProtocolTypeChoiceEnum - INCREMENT PatternFlowPppProtocolTypeChoiceEnum - DECREMENT PatternFlowPppProtocolTypeChoiceEnum -}{ - VALUE: PatternFlowPppProtocolTypeChoiceEnum("value"), - VALUES: PatternFlowPppProtocolTypeChoiceEnum("values"), - AUTO: PatternFlowPppProtocolTypeChoiceEnum("auto"), - INCREMENT: PatternFlowPppProtocolTypeChoiceEnum("increment"), - DECREMENT: PatternFlowPppProtocolTypeChoiceEnum("decrement"), -} - -func (obj *patternFlowPppProtocolType) Choice() PatternFlowPppProtocolTypeChoiceEnum { - return PatternFlowPppProtocolTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowPppProtocolType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowPppProtocolType) setChoice(value PatternFlowPppProtocolTypeChoiceEnum) PatternFlowPppProtocolType { - intValue, ok := otg.PatternFlowPppProtocolType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowPppProtocolTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowPppProtocolType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Auto = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowPppProtocolTypeChoice.VALUE { - defaultValue := uint32(33) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowPppProtocolTypeChoice.VALUES { - defaultValue := []uint32{33} - obj.obj.Values = defaultValue - } - - if value == PatternFlowPppProtocolTypeChoice.AUTO { - defaultValue := uint32(33) - obj.obj.Auto = &defaultValue - } - - if value == PatternFlowPppProtocolTypeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowPppProtocolTypeCounter().msg() - } - - if value == PatternFlowPppProtocolTypeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowPppProtocolTypeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPppProtocolType) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowPppProtocolTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowPppProtocolType) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowPppProtocolType object -func (obj *patternFlowPppProtocolType) SetValue(value uint32) PatternFlowPppProtocolType { - obj.setChoice(PatternFlowPppProtocolTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowPppProtocolType) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{33}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowPppProtocolType object -func (obj *patternFlowPppProtocolType) SetValues(value []uint32) PatternFlowPppProtocolType { - obj.setChoice(PatternFlowPppProtocolTypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowPppProtocolType) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(PatternFlowPppProtocolTypeChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowPppProtocolType) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Increment returns a PatternFlowPppProtocolTypeCounter -func (obj *patternFlowPppProtocolType) Increment() PatternFlowPppProtocolTypeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowPppProtocolTypeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowPppProtocolTypeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowPppProtocolTypeCounter -func (obj *patternFlowPppProtocolType) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowPppProtocolTypeCounter value in the PatternFlowPppProtocolType object -func (obj *patternFlowPppProtocolType) SetIncrement(value PatternFlowPppProtocolTypeCounter) PatternFlowPppProtocolType { - obj.setChoice(PatternFlowPppProtocolTypeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowPppProtocolTypeCounter -func (obj *patternFlowPppProtocolType) Decrement() PatternFlowPppProtocolTypeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowPppProtocolTypeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowPppProtocolTypeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowPppProtocolTypeCounter -func (obj *patternFlowPppProtocolType) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowPppProtocolTypeCounter value in the PatternFlowPppProtocolType object -func (obj *patternFlowPppProtocolType) SetDecrement(value PatternFlowPppProtocolTypeCounter) PatternFlowPppProtocolType { - obj.setChoice(PatternFlowPppProtocolTypeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowPppProtocolTypeMetricTag -func (obj *patternFlowPppProtocolType) MetricTags() PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowPppProtocolTypeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter struct { - obj *patternFlowPppProtocolType - patternFlowPppProtocolTypeMetricTagSlice []PatternFlowPppProtocolTypeMetricTag - fieldPtr *[]*otg.PatternFlowPppProtocolTypeMetricTag -} - -func newPatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter(ptr *[]*otg.PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { - return &patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter interface { - setMsg(*patternFlowPppProtocolType) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter - Items() []PatternFlowPppProtocolTypeMetricTag - Add() PatternFlowPppProtocolTypeMetricTag - Append(items ...PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter - Set(index int, newObj PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter - Clear() PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter - clearHolderSlice() PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter - appendHolderSlice(item PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter -} - -func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) setMsg(msg *patternFlowPppProtocolType) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowPppProtocolTypeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) Items() []PatternFlowPppProtocolTypeMetricTag { - return obj.patternFlowPppProtocolTypeMetricTagSlice -} - -func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) Add() PatternFlowPppProtocolTypeMetricTag { - newObj := &otg.PatternFlowPppProtocolTypeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowPppProtocolTypeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowPppProtocolTypeMetricTagSlice = append(obj.patternFlowPppProtocolTypeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) Append(items ...PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowPppProtocolTypeMetricTagSlice = append(obj.patternFlowPppProtocolTypeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) Set(index int, newObj PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowPppProtocolTypeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) Clear() PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowPppProtocolTypeMetricTag{} - obj.patternFlowPppProtocolTypeMetricTagSlice = []PatternFlowPppProtocolTypeMetricTag{} - } - return obj -} -func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) clearHolderSlice() PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { - if len(obj.patternFlowPppProtocolTypeMetricTagSlice) > 0 { - obj.patternFlowPppProtocolTypeMetricTagSlice = []PatternFlowPppProtocolTypeMetricTag{} - } - return obj -} -func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) appendHolderSlice(item PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { - obj.patternFlowPppProtocolTypeMetricTagSlice = append(obj.patternFlowPppProtocolTypeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowPppProtocolType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppProtocolType.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowPppProtocolType.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Auto != nil { - - if *obj.obj.Auto > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppProtocolType.Auto <= 65535 but Got %d", *obj.obj.Auto)) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowPppProtocolTypeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowPppProtocolType) setDefault() { - var choices_set int = 0 - var choice PatternFlowPppProtocolTypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowPppProtocolTypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowPppProtocolTypeChoice.VALUES - } - - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowPppProtocolTypeChoice.AUTO - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowPppProtocolTypeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowPppProtocolTypeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowPppProtocolTypeChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPppProtocolType") - } - } else { - intVal := otg.PatternFlowPppProtocolType_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowPppProtocolType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIgmpv1Version ***** -type patternFlowIgmpv1Version struct { - validation - obj *otg.PatternFlowIgmpv1Version - marshaller marshalPatternFlowIgmpv1Version - unMarshaller unMarshalPatternFlowIgmpv1Version - incrementHolder PatternFlowIgmpv1VersionCounter - decrementHolder PatternFlowIgmpv1VersionCounter - metricTagsHolder PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter -} - -func NewPatternFlowIgmpv1Version() PatternFlowIgmpv1Version { - obj := patternFlowIgmpv1Version{obj: &otg.PatternFlowIgmpv1Version{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIgmpv1Version) msg() *otg.PatternFlowIgmpv1Version { - return obj.obj -} - -func (obj *patternFlowIgmpv1Version) setMsg(msg *otg.PatternFlowIgmpv1Version) PatternFlowIgmpv1Version { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIgmpv1Version struct { - obj *patternFlowIgmpv1Version -} - -type marshalPatternFlowIgmpv1Version interface { - // ToProto marshals PatternFlowIgmpv1Version to protobuf object *otg.PatternFlowIgmpv1Version - ToProto() (*otg.PatternFlowIgmpv1Version, error) - // ToPbText marshals PatternFlowIgmpv1Version to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIgmpv1Version to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIgmpv1Version to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIgmpv1Version struct { - obj *patternFlowIgmpv1Version -} - -type unMarshalPatternFlowIgmpv1Version interface { - // FromProto unmarshals PatternFlowIgmpv1Version from protobuf object *otg.PatternFlowIgmpv1Version - FromProto(msg *otg.PatternFlowIgmpv1Version) (PatternFlowIgmpv1Version, error) - // FromPbText unmarshals PatternFlowIgmpv1Version from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIgmpv1Version from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIgmpv1Version from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIgmpv1Version) Marshal() marshalPatternFlowIgmpv1Version { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIgmpv1Version{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIgmpv1Version) Unmarshal() unMarshalPatternFlowIgmpv1Version { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIgmpv1Version{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIgmpv1Version) ToProto() (*otg.PatternFlowIgmpv1Version, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIgmpv1Version) FromProto(msg *otg.PatternFlowIgmpv1Version) (PatternFlowIgmpv1Version, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIgmpv1Version) 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 *unMarshalpatternFlowIgmpv1Version) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIgmpv1Version) 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 *unMarshalpatternFlowIgmpv1Version) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIgmpv1Version) 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 *unMarshalpatternFlowIgmpv1Version) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIgmpv1Version) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1Version) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1Version) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIgmpv1Version) Clone() (PatternFlowIgmpv1Version, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIgmpv1Version() - 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 -} - -func (obj *patternFlowIgmpv1Version) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIgmpv1Version is version number -type PatternFlowIgmpv1Version interface { - Validation - // msg marshals PatternFlowIgmpv1Version to protobuf object *otg.PatternFlowIgmpv1Version - // and doesn't set defaults - msg() *otg.PatternFlowIgmpv1Version - // setMsg unmarshals PatternFlowIgmpv1Version from protobuf object *otg.PatternFlowIgmpv1Version - // and doesn't set defaults - setMsg(*otg.PatternFlowIgmpv1Version) PatternFlowIgmpv1Version - // provides marshal interface - Marshal() marshalPatternFlowIgmpv1Version - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIgmpv1Version - // validate validates PatternFlowIgmpv1Version - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIgmpv1Version, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIgmpv1VersionChoiceEnum, set in PatternFlowIgmpv1Version - Choice() PatternFlowIgmpv1VersionChoiceEnum - // setChoice assigns PatternFlowIgmpv1VersionChoiceEnum provided by user to PatternFlowIgmpv1Version - setChoice(value PatternFlowIgmpv1VersionChoiceEnum) PatternFlowIgmpv1Version - // HasChoice checks if Choice has been set in PatternFlowIgmpv1Version - HasChoice() bool - // Value returns uint32, set in PatternFlowIgmpv1Version. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIgmpv1Version - SetValue(value uint32) PatternFlowIgmpv1Version - // HasValue checks if Value has been set in PatternFlowIgmpv1Version - HasValue() bool - // Values returns []uint32, set in PatternFlowIgmpv1Version. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIgmpv1Version - SetValues(value []uint32) PatternFlowIgmpv1Version - // Increment returns PatternFlowIgmpv1VersionCounter, set in PatternFlowIgmpv1Version. - // PatternFlowIgmpv1VersionCounter is integer counter pattern - Increment() PatternFlowIgmpv1VersionCounter - // SetIncrement assigns PatternFlowIgmpv1VersionCounter provided by user to PatternFlowIgmpv1Version. - // PatternFlowIgmpv1VersionCounter is integer counter pattern - SetIncrement(value PatternFlowIgmpv1VersionCounter) PatternFlowIgmpv1Version - // HasIncrement checks if Increment has been set in PatternFlowIgmpv1Version - HasIncrement() bool - // Decrement returns PatternFlowIgmpv1VersionCounter, set in PatternFlowIgmpv1Version. - // PatternFlowIgmpv1VersionCounter is integer counter pattern - Decrement() PatternFlowIgmpv1VersionCounter - // SetDecrement assigns PatternFlowIgmpv1VersionCounter provided by user to PatternFlowIgmpv1Version. - // PatternFlowIgmpv1VersionCounter is integer counter pattern - SetDecrement(value PatternFlowIgmpv1VersionCounter) PatternFlowIgmpv1Version - // HasDecrement checks if Decrement has been set in PatternFlowIgmpv1Version - HasDecrement() bool - // MetricTags returns PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIterIter, set in PatternFlowIgmpv1Version - MetricTags() PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter - setNil() -} - -type PatternFlowIgmpv1VersionChoiceEnum string - -// Enum of Choice on PatternFlowIgmpv1Version -var PatternFlowIgmpv1VersionChoice = struct { - VALUE PatternFlowIgmpv1VersionChoiceEnum - VALUES PatternFlowIgmpv1VersionChoiceEnum - INCREMENT PatternFlowIgmpv1VersionChoiceEnum - DECREMENT PatternFlowIgmpv1VersionChoiceEnum -}{ - VALUE: PatternFlowIgmpv1VersionChoiceEnum("value"), - VALUES: PatternFlowIgmpv1VersionChoiceEnum("values"), - INCREMENT: PatternFlowIgmpv1VersionChoiceEnum("increment"), - DECREMENT: PatternFlowIgmpv1VersionChoiceEnum("decrement"), -} - -func (obj *patternFlowIgmpv1Version) Choice() PatternFlowIgmpv1VersionChoiceEnum { - return PatternFlowIgmpv1VersionChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIgmpv1Version) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIgmpv1Version) setChoice(value PatternFlowIgmpv1VersionChoiceEnum) PatternFlowIgmpv1Version { - intValue, ok := otg.PatternFlowIgmpv1Version_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIgmpv1VersionChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIgmpv1Version_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIgmpv1VersionChoice.VALUE { - defaultValue := uint32(1) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIgmpv1VersionChoice.VALUES { - defaultValue := []uint32{1} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIgmpv1VersionChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIgmpv1VersionCounter().msg() - } - - if value == PatternFlowIgmpv1VersionChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIgmpv1VersionCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIgmpv1Version) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIgmpv1VersionChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIgmpv1Version) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIgmpv1Version object -func (obj *patternFlowIgmpv1Version) SetValue(value uint32) PatternFlowIgmpv1Version { - obj.setChoice(PatternFlowIgmpv1VersionChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIgmpv1Version) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{1}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIgmpv1Version object -func (obj *patternFlowIgmpv1Version) SetValues(value []uint32) PatternFlowIgmpv1Version { - obj.setChoice(PatternFlowIgmpv1VersionChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIgmpv1VersionCounter -func (obj *patternFlowIgmpv1Version) Increment() PatternFlowIgmpv1VersionCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIgmpv1VersionChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIgmpv1VersionCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIgmpv1VersionCounter -func (obj *patternFlowIgmpv1Version) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIgmpv1VersionCounter value in the PatternFlowIgmpv1Version object -func (obj *patternFlowIgmpv1Version) SetIncrement(value PatternFlowIgmpv1VersionCounter) PatternFlowIgmpv1Version { - obj.setChoice(PatternFlowIgmpv1VersionChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIgmpv1VersionCounter -func (obj *patternFlowIgmpv1Version) Decrement() PatternFlowIgmpv1VersionCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIgmpv1VersionChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIgmpv1VersionCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIgmpv1VersionCounter -func (obj *patternFlowIgmpv1Version) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIgmpv1VersionCounter value in the PatternFlowIgmpv1Version object -func (obj *patternFlowIgmpv1Version) SetDecrement(value PatternFlowIgmpv1VersionCounter) PatternFlowIgmpv1Version { - obj.setChoice(PatternFlowIgmpv1VersionChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIgmpv1VersionMetricTag -func (obj *patternFlowIgmpv1Version) MetricTags() PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIgmpv1VersionMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter struct { - obj *patternFlowIgmpv1Version - patternFlowIgmpv1VersionMetricTagSlice []PatternFlowIgmpv1VersionMetricTag - fieldPtr *[]*otg.PatternFlowIgmpv1VersionMetricTag -} - -func newPatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter(ptr *[]*otg.PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { - return &patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter interface { - setMsg(*patternFlowIgmpv1Version) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter - Items() []PatternFlowIgmpv1VersionMetricTag - Add() PatternFlowIgmpv1VersionMetricTag - Append(items ...PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter - Set(index int, newObj PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter - Clear() PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter - clearHolderSlice() PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter - appendHolderSlice(item PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter -} - -func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) setMsg(msg *patternFlowIgmpv1Version) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIgmpv1VersionMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) Items() []PatternFlowIgmpv1VersionMetricTag { - return obj.patternFlowIgmpv1VersionMetricTagSlice -} - -func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) Add() PatternFlowIgmpv1VersionMetricTag { - newObj := &otg.PatternFlowIgmpv1VersionMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIgmpv1VersionMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIgmpv1VersionMetricTagSlice = append(obj.patternFlowIgmpv1VersionMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) Append(items ...PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIgmpv1VersionMetricTagSlice = append(obj.patternFlowIgmpv1VersionMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) Set(index int, newObj PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIgmpv1VersionMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) Clear() PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIgmpv1VersionMetricTag{} - obj.patternFlowIgmpv1VersionMetricTagSlice = []PatternFlowIgmpv1VersionMetricTag{} - } - return obj -} -func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) clearHolderSlice() PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { - if len(obj.patternFlowIgmpv1VersionMetricTagSlice) > 0 { - obj.patternFlowIgmpv1VersionMetricTagSlice = []PatternFlowIgmpv1VersionMetricTag{} - } - return obj -} -func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) appendHolderSlice(item PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { - obj.patternFlowIgmpv1VersionMetricTagSlice = append(obj.patternFlowIgmpv1VersionMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIgmpv1Version) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1Version.Value <= 15 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIgmpv1Version.Values <= 15 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIgmpv1VersionMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIgmpv1Version) setDefault() { - var choices_set int = 0 - var choice PatternFlowIgmpv1VersionChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIgmpv1VersionChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIgmpv1VersionChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIgmpv1VersionChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIgmpv1VersionChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIgmpv1VersionChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIgmpv1Version") - } - } else { - intVal := otg.PatternFlowIgmpv1Version_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIgmpv1Version_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIgmpv1Type ***** -type patternFlowIgmpv1Type struct { - validation - obj *otg.PatternFlowIgmpv1Type - marshaller marshalPatternFlowIgmpv1Type - unMarshaller unMarshalPatternFlowIgmpv1Type - incrementHolder PatternFlowIgmpv1TypeCounter - decrementHolder PatternFlowIgmpv1TypeCounter - metricTagsHolder PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter -} - -func NewPatternFlowIgmpv1Type() PatternFlowIgmpv1Type { - obj := patternFlowIgmpv1Type{obj: &otg.PatternFlowIgmpv1Type{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIgmpv1Type) msg() *otg.PatternFlowIgmpv1Type { - return obj.obj -} - -func (obj *patternFlowIgmpv1Type) setMsg(msg *otg.PatternFlowIgmpv1Type) PatternFlowIgmpv1Type { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIgmpv1Type struct { - obj *patternFlowIgmpv1Type -} - -type marshalPatternFlowIgmpv1Type interface { - // ToProto marshals PatternFlowIgmpv1Type to protobuf object *otg.PatternFlowIgmpv1Type - ToProto() (*otg.PatternFlowIgmpv1Type, error) - // ToPbText marshals PatternFlowIgmpv1Type to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIgmpv1Type to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIgmpv1Type to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIgmpv1Type struct { - obj *patternFlowIgmpv1Type -} - -type unMarshalPatternFlowIgmpv1Type interface { - // FromProto unmarshals PatternFlowIgmpv1Type from protobuf object *otg.PatternFlowIgmpv1Type - FromProto(msg *otg.PatternFlowIgmpv1Type) (PatternFlowIgmpv1Type, error) - // FromPbText unmarshals PatternFlowIgmpv1Type from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIgmpv1Type from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIgmpv1Type from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIgmpv1Type) Marshal() marshalPatternFlowIgmpv1Type { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIgmpv1Type{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIgmpv1Type) Unmarshal() unMarshalPatternFlowIgmpv1Type { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIgmpv1Type{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIgmpv1Type) ToProto() (*otg.PatternFlowIgmpv1Type, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIgmpv1Type) FromProto(msg *otg.PatternFlowIgmpv1Type) (PatternFlowIgmpv1Type, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIgmpv1Type) 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 *unMarshalpatternFlowIgmpv1Type) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIgmpv1Type) 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 *unMarshalpatternFlowIgmpv1Type) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIgmpv1Type) 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 *unMarshalpatternFlowIgmpv1Type) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIgmpv1Type) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1Type) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1Type) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIgmpv1Type) Clone() (PatternFlowIgmpv1Type, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIgmpv1Type() - 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 -} - -func (obj *patternFlowIgmpv1Type) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIgmpv1Type is type of message -type PatternFlowIgmpv1Type interface { - Validation - // msg marshals PatternFlowIgmpv1Type to protobuf object *otg.PatternFlowIgmpv1Type - // and doesn't set defaults - msg() *otg.PatternFlowIgmpv1Type - // setMsg unmarshals PatternFlowIgmpv1Type from protobuf object *otg.PatternFlowIgmpv1Type - // and doesn't set defaults - setMsg(*otg.PatternFlowIgmpv1Type) PatternFlowIgmpv1Type - // provides marshal interface - Marshal() marshalPatternFlowIgmpv1Type - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIgmpv1Type - // validate validates PatternFlowIgmpv1Type - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIgmpv1Type, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIgmpv1TypeChoiceEnum, set in PatternFlowIgmpv1Type - Choice() PatternFlowIgmpv1TypeChoiceEnum - // setChoice assigns PatternFlowIgmpv1TypeChoiceEnum provided by user to PatternFlowIgmpv1Type - setChoice(value PatternFlowIgmpv1TypeChoiceEnum) PatternFlowIgmpv1Type - // HasChoice checks if Choice has been set in PatternFlowIgmpv1Type - HasChoice() bool - // Value returns uint32, set in PatternFlowIgmpv1Type. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIgmpv1Type - SetValue(value uint32) PatternFlowIgmpv1Type - // HasValue checks if Value has been set in PatternFlowIgmpv1Type - HasValue() bool - // Values returns []uint32, set in PatternFlowIgmpv1Type. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIgmpv1Type - SetValues(value []uint32) PatternFlowIgmpv1Type - // Increment returns PatternFlowIgmpv1TypeCounter, set in PatternFlowIgmpv1Type. - // PatternFlowIgmpv1TypeCounter is integer counter pattern - Increment() PatternFlowIgmpv1TypeCounter - // SetIncrement assigns PatternFlowIgmpv1TypeCounter provided by user to PatternFlowIgmpv1Type. - // PatternFlowIgmpv1TypeCounter is integer counter pattern - SetIncrement(value PatternFlowIgmpv1TypeCounter) PatternFlowIgmpv1Type - // HasIncrement checks if Increment has been set in PatternFlowIgmpv1Type - HasIncrement() bool - // Decrement returns PatternFlowIgmpv1TypeCounter, set in PatternFlowIgmpv1Type. - // PatternFlowIgmpv1TypeCounter is integer counter pattern - Decrement() PatternFlowIgmpv1TypeCounter - // SetDecrement assigns PatternFlowIgmpv1TypeCounter provided by user to PatternFlowIgmpv1Type. - // PatternFlowIgmpv1TypeCounter is integer counter pattern - SetDecrement(value PatternFlowIgmpv1TypeCounter) PatternFlowIgmpv1Type - // HasDecrement checks if Decrement has been set in PatternFlowIgmpv1Type - HasDecrement() bool - // MetricTags returns PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIterIter, set in PatternFlowIgmpv1Type - MetricTags() PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter - setNil() -} - -type PatternFlowIgmpv1TypeChoiceEnum string - -// Enum of Choice on PatternFlowIgmpv1Type -var PatternFlowIgmpv1TypeChoice = struct { - VALUE PatternFlowIgmpv1TypeChoiceEnum - VALUES PatternFlowIgmpv1TypeChoiceEnum - INCREMENT PatternFlowIgmpv1TypeChoiceEnum - DECREMENT PatternFlowIgmpv1TypeChoiceEnum -}{ - VALUE: PatternFlowIgmpv1TypeChoiceEnum("value"), - VALUES: PatternFlowIgmpv1TypeChoiceEnum("values"), - INCREMENT: PatternFlowIgmpv1TypeChoiceEnum("increment"), - DECREMENT: PatternFlowIgmpv1TypeChoiceEnum("decrement"), -} - -func (obj *patternFlowIgmpv1Type) Choice() PatternFlowIgmpv1TypeChoiceEnum { - return PatternFlowIgmpv1TypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIgmpv1Type) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIgmpv1Type) setChoice(value PatternFlowIgmpv1TypeChoiceEnum) PatternFlowIgmpv1Type { - intValue, ok := otg.PatternFlowIgmpv1Type_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIgmpv1TypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIgmpv1Type_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIgmpv1TypeChoice.VALUE { - defaultValue := uint32(1) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIgmpv1TypeChoice.VALUES { - defaultValue := []uint32{1} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIgmpv1TypeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIgmpv1TypeCounter().msg() - } - - if value == PatternFlowIgmpv1TypeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIgmpv1TypeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIgmpv1Type) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIgmpv1TypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIgmpv1Type) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIgmpv1Type object -func (obj *patternFlowIgmpv1Type) SetValue(value uint32) PatternFlowIgmpv1Type { - obj.setChoice(PatternFlowIgmpv1TypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIgmpv1Type) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{1}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIgmpv1Type object -func (obj *patternFlowIgmpv1Type) SetValues(value []uint32) PatternFlowIgmpv1Type { - obj.setChoice(PatternFlowIgmpv1TypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIgmpv1TypeCounter -func (obj *patternFlowIgmpv1Type) Increment() PatternFlowIgmpv1TypeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIgmpv1TypeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIgmpv1TypeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIgmpv1TypeCounter -func (obj *patternFlowIgmpv1Type) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIgmpv1TypeCounter value in the PatternFlowIgmpv1Type object -func (obj *patternFlowIgmpv1Type) SetIncrement(value PatternFlowIgmpv1TypeCounter) PatternFlowIgmpv1Type { - obj.setChoice(PatternFlowIgmpv1TypeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIgmpv1TypeCounter -func (obj *patternFlowIgmpv1Type) Decrement() PatternFlowIgmpv1TypeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIgmpv1TypeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIgmpv1TypeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIgmpv1TypeCounter -func (obj *patternFlowIgmpv1Type) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIgmpv1TypeCounter value in the PatternFlowIgmpv1Type object -func (obj *patternFlowIgmpv1Type) SetDecrement(value PatternFlowIgmpv1TypeCounter) PatternFlowIgmpv1Type { - obj.setChoice(PatternFlowIgmpv1TypeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIgmpv1TypeMetricTag -func (obj *patternFlowIgmpv1Type) MetricTags() PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIgmpv1TypeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter struct { - obj *patternFlowIgmpv1Type - patternFlowIgmpv1TypeMetricTagSlice []PatternFlowIgmpv1TypeMetricTag - fieldPtr *[]*otg.PatternFlowIgmpv1TypeMetricTag -} - -func newPatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter(ptr *[]*otg.PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { - return &patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter interface { - setMsg(*patternFlowIgmpv1Type) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter - Items() []PatternFlowIgmpv1TypeMetricTag - Add() PatternFlowIgmpv1TypeMetricTag - Append(items ...PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter - Set(index int, newObj PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter - Clear() PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter - clearHolderSlice() PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter - appendHolderSlice(item PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter -} - -func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) setMsg(msg *patternFlowIgmpv1Type) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIgmpv1TypeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) Items() []PatternFlowIgmpv1TypeMetricTag { - return obj.patternFlowIgmpv1TypeMetricTagSlice -} - -func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) Add() PatternFlowIgmpv1TypeMetricTag { - newObj := &otg.PatternFlowIgmpv1TypeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIgmpv1TypeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIgmpv1TypeMetricTagSlice = append(obj.patternFlowIgmpv1TypeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) Append(items ...PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIgmpv1TypeMetricTagSlice = append(obj.patternFlowIgmpv1TypeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) Set(index int, newObj PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIgmpv1TypeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) Clear() PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIgmpv1TypeMetricTag{} - obj.patternFlowIgmpv1TypeMetricTagSlice = []PatternFlowIgmpv1TypeMetricTag{} - } - return obj -} -func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) clearHolderSlice() PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { - if len(obj.patternFlowIgmpv1TypeMetricTagSlice) > 0 { - obj.patternFlowIgmpv1TypeMetricTagSlice = []PatternFlowIgmpv1TypeMetricTag{} - } - return obj -} -func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) appendHolderSlice(item PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { - obj.patternFlowIgmpv1TypeMetricTagSlice = append(obj.patternFlowIgmpv1TypeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIgmpv1Type) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1Type.Value <= 15 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIgmpv1Type.Values <= 15 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIgmpv1TypeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIgmpv1Type) setDefault() { - var choices_set int = 0 - var choice PatternFlowIgmpv1TypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIgmpv1TypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIgmpv1TypeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIgmpv1TypeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIgmpv1TypeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIgmpv1TypeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIgmpv1Type") - } - } else { - intVal := otg.PatternFlowIgmpv1Type_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIgmpv1Type_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIgmpv1Unused ***** -type patternFlowIgmpv1Unused struct { - validation - obj *otg.PatternFlowIgmpv1Unused - marshaller marshalPatternFlowIgmpv1Unused - unMarshaller unMarshalPatternFlowIgmpv1Unused - incrementHolder PatternFlowIgmpv1UnusedCounter - decrementHolder PatternFlowIgmpv1UnusedCounter - metricTagsHolder PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter -} - -func NewPatternFlowIgmpv1Unused() PatternFlowIgmpv1Unused { - obj := patternFlowIgmpv1Unused{obj: &otg.PatternFlowIgmpv1Unused{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIgmpv1Unused) msg() *otg.PatternFlowIgmpv1Unused { - return obj.obj -} - -func (obj *patternFlowIgmpv1Unused) setMsg(msg *otg.PatternFlowIgmpv1Unused) PatternFlowIgmpv1Unused { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIgmpv1Unused struct { - obj *patternFlowIgmpv1Unused -} - -type marshalPatternFlowIgmpv1Unused interface { - // ToProto marshals PatternFlowIgmpv1Unused to protobuf object *otg.PatternFlowIgmpv1Unused - ToProto() (*otg.PatternFlowIgmpv1Unused, error) - // ToPbText marshals PatternFlowIgmpv1Unused to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIgmpv1Unused to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIgmpv1Unused to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIgmpv1Unused struct { - obj *patternFlowIgmpv1Unused -} - -type unMarshalPatternFlowIgmpv1Unused interface { - // FromProto unmarshals PatternFlowIgmpv1Unused from protobuf object *otg.PatternFlowIgmpv1Unused - FromProto(msg *otg.PatternFlowIgmpv1Unused) (PatternFlowIgmpv1Unused, error) - // FromPbText unmarshals PatternFlowIgmpv1Unused from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIgmpv1Unused from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIgmpv1Unused from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIgmpv1Unused) Marshal() marshalPatternFlowIgmpv1Unused { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIgmpv1Unused{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIgmpv1Unused) Unmarshal() unMarshalPatternFlowIgmpv1Unused { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIgmpv1Unused{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIgmpv1Unused) ToProto() (*otg.PatternFlowIgmpv1Unused, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIgmpv1Unused) FromProto(msg *otg.PatternFlowIgmpv1Unused) (PatternFlowIgmpv1Unused, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIgmpv1Unused) 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 *unMarshalpatternFlowIgmpv1Unused) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIgmpv1Unused) 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 *unMarshalpatternFlowIgmpv1Unused) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIgmpv1Unused) 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 *unMarshalpatternFlowIgmpv1Unused) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIgmpv1Unused) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1Unused) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1Unused) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIgmpv1Unused) Clone() (PatternFlowIgmpv1Unused, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIgmpv1Unused() - 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 -} - -func (obj *patternFlowIgmpv1Unused) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIgmpv1Unused is unused -type PatternFlowIgmpv1Unused interface { - Validation - // msg marshals PatternFlowIgmpv1Unused to protobuf object *otg.PatternFlowIgmpv1Unused - // and doesn't set defaults - msg() *otg.PatternFlowIgmpv1Unused - // setMsg unmarshals PatternFlowIgmpv1Unused from protobuf object *otg.PatternFlowIgmpv1Unused - // and doesn't set defaults - setMsg(*otg.PatternFlowIgmpv1Unused) PatternFlowIgmpv1Unused - // provides marshal interface - Marshal() marshalPatternFlowIgmpv1Unused - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIgmpv1Unused - // validate validates PatternFlowIgmpv1Unused - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIgmpv1Unused, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIgmpv1UnusedChoiceEnum, set in PatternFlowIgmpv1Unused - Choice() PatternFlowIgmpv1UnusedChoiceEnum - // setChoice assigns PatternFlowIgmpv1UnusedChoiceEnum provided by user to PatternFlowIgmpv1Unused - setChoice(value PatternFlowIgmpv1UnusedChoiceEnum) PatternFlowIgmpv1Unused - // HasChoice checks if Choice has been set in PatternFlowIgmpv1Unused - HasChoice() bool - // Value returns uint32, set in PatternFlowIgmpv1Unused. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIgmpv1Unused - SetValue(value uint32) PatternFlowIgmpv1Unused - // HasValue checks if Value has been set in PatternFlowIgmpv1Unused - HasValue() bool - // Values returns []uint32, set in PatternFlowIgmpv1Unused. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIgmpv1Unused - SetValues(value []uint32) PatternFlowIgmpv1Unused - // Increment returns PatternFlowIgmpv1UnusedCounter, set in PatternFlowIgmpv1Unused. - // PatternFlowIgmpv1UnusedCounter is integer counter pattern - Increment() PatternFlowIgmpv1UnusedCounter - // SetIncrement assigns PatternFlowIgmpv1UnusedCounter provided by user to PatternFlowIgmpv1Unused. - // PatternFlowIgmpv1UnusedCounter is integer counter pattern - SetIncrement(value PatternFlowIgmpv1UnusedCounter) PatternFlowIgmpv1Unused - // HasIncrement checks if Increment has been set in PatternFlowIgmpv1Unused - HasIncrement() bool - // Decrement returns PatternFlowIgmpv1UnusedCounter, set in PatternFlowIgmpv1Unused. - // PatternFlowIgmpv1UnusedCounter is integer counter pattern - Decrement() PatternFlowIgmpv1UnusedCounter - // SetDecrement assigns PatternFlowIgmpv1UnusedCounter provided by user to PatternFlowIgmpv1Unused. - // PatternFlowIgmpv1UnusedCounter is integer counter pattern - SetDecrement(value PatternFlowIgmpv1UnusedCounter) PatternFlowIgmpv1Unused - // HasDecrement checks if Decrement has been set in PatternFlowIgmpv1Unused - HasDecrement() bool - // MetricTags returns PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIterIter, set in PatternFlowIgmpv1Unused - MetricTags() PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter - setNil() -} - -type PatternFlowIgmpv1UnusedChoiceEnum string - -// Enum of Choice on PatternFlowIgmpv1Unused -var PatternFlowIgmpv1UnusedChoice = struct { - VALUE PatternFlowIgmpv1UnusedChoiceEnum - VALUES PatternFlowIgmpv1UnusedChoiceEnum - INCREMENT PatternFlowIgmpv1UnusedChoiceEnum - DECREMENT PatternFlowIgmpv1UnusedChoiceEnum -}{ - VALUE: PatternFlowIgmpv1UnusedChoiceEnum("value"), - VALUES: PatternFlowIgmpv1UnusedChoiceEnum("values"), - INCREMENT: PatternFlowIgmpv1UnusedChoiceEnum("increment"), - DECREMENT: PatternFlowIgmpv1UnusedChoiceEnum("decrement"), -} - -func (obj *patternFlowIgmpv1Unused) Choice() PatternFlowIgmpv1UnusedChoiceEnum { - return PatternFlowIgmpv1UnusedChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIgmpv1Unused) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIgmpv1Unused) setChoice(value PatternFlowIgmpv1UnusedChoiceEnum) PatternFlowIgmpv1Unused { - intValue, ok := otg.PatternFlowIgmpv1Unused_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIgmpv1UnusedChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIgmpv1Unused_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIgmpv1UnusedChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIgmpv1UnusedChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIgmpv1UnusedChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIgmpv1UnusedCounter().msg() - } - - if value == PatternFlowIgmpv1UnusedChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIgmpv1UnusedCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIgmpv1Unused) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIgmpv1UnusedChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIgmpv1Unused) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIgmpv1Unused object -func (obj *patternFlowIgmpv1Unused) SetValue(value uint32) PatternFlowIgmpv1Unused { - obj.setChoice(PatternFlowIgmpv1UnusedChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIgmpv1Unused) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIgmpv1Unused object -func (obj *patternFlowIgmpv1Unused) SetValues(value []uint32) PatternFlowIgmpv1Unused { - obj.setChoice(PatternFlowIgmpv1UnusedChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIgmpv1UnusedCounter -func (obj *patternFlowIgmpv1Unused) Increment() PatternFlowIgmpv1UnusedCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIgmpv1UnusedChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIgmpv1UnusedCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIgmpv1UnusedCounter -func (obj *patternFlowIgmpv1Unused) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIgmpv1UnusedCounter value in the PatternFlowIgmpv1Unused object -func (obj *patternFlowIgmpv1Unused) SetIncrement(value PatternFlowIgmpv1UnusedCounter) PatternFlowIgmpv1Unused { - obj.setChoice(PatternFlowIgmpv1UnusedChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIgmpv1UnusedCounter -func (obj *patternFlowIgmpv1Unused) Decrement() PatternFlowIgmpv1UnusedCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIgmpv1UnusedChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIgmpv1UnusedCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIgmpv1UnusedCounter -func (obj *patternFlowIgmpv1Unused) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIgmpv1UnusedCounter value in the PatternFlowIgmpv1Unused object -func (obj *patternFlowIgmpv1Unused) SetDecrement(value PatternFlowIgmpv1UnusedCounter) PatternFlowIgmpv1Unused { - obj.setChoice(PatternFlowIgmpv1UnusedChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIgmpv1UnusedMetricTag -func (obj *patternFlowIgmpv1Unused) MetricTags() PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIgmpv1UnusedMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter struct { - obj *patternFlowIgmpv1Unused - patternFlowIgmpv1UnusedMetricTagSlice []PatternFlowIgmpv1UnusedMetricTag - fieldPtr *[]*otg.PatternFlowIgmpv1UnusedMetricTag -} - -func newPatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter(ptr *[]*otg.PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { - return &patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter interface { - setMsg(*patternFlowIgmpv1Unused) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter - Items() []PatternFlowIgmpv1UnusedMetricTag - Add() PatternFlowIgmpv1UnusedMetricTag - Append(items ...PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter - Set(index int, newObj PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter - Clear() PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter - clearHolderSlice() PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter - appendHolderSlice(item PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter -} - -func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) setMsg(msg *patternFlowIgmpv1Unused) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIgmpv1UnusedMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) Items() []PatternFlowIgmpv1UnusedMetricTag { - return obj.patternFlowIgmpv1UnusedMetricTagSlice -} - -func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) Add() PatternFlowIgmpv1UnusedMetricTag { - newObj := &otg.PatternFlowIgmpv1UnusedMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIgmpv1UnusedMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIgmpv1UnusedMetricTagSlice = append(obj.patternFlowIgmpv1UnusedMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) Append(items ...PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIgmpv1UnusedMetricTagSlice = append(obj.patternFlowIgmpv1UnusedMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) Set(index int, newObj PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIgmpv1UnusedMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) Clear() PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIgmpv1UnusedMetricTag{} - obj.patternFlowIgmpv1UnusedMetricTagSlice = []PatternFlowIgmpv1UnusedMetricTag{} - } - return obj -} -func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) clearHolderSlice() PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { - if len(obj.patternFlowIgmpv1UnusedMetricTagSlice) > 0 { - obj.patternFlowIgmpv1UnusedMetricTagSlice = []PatternFlowIgmpv1UnusedMetricTag{} - } - return obj -} -func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) appendHolderSlice(item PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { - obj.patternFlowIgmpv1UnusedMetricTagSlice = append(obj.patternFlowIgmpv1UnusedMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIgmpv1Unused) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1Unused.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIgmpv1Unused.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIgmpv1UnusedMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIgmpv1Unused) setDefault() { - var choices_set int = 0 - var choice PatternFlowIgmpv1UnusedChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIgmpv1UnusedChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIgmpv1UnusedChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIgmpv1UnusedChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIgmpv1UnusedChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIgmpv1UnusedChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIgmpv1Unused") - } - } else { - intVal := otg.PatternFlowIgmpv1Unused_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIgmpv1Unused_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIgmpv1Checksum ***** -type patternFlowIgmpv1Checksum struct { - validation - obj *otg.PatternFlowIgmpv1Checksum - marshaller marshalPatternFlowIgmpv1Checksum - unMarshaller unMarshalPatternFlowIgmpv1Checksum -} - -func NewPatternFlowIgmpv1Checksum() PatternFlowIgmpv1Checksum { - obj := patternFlowIgmpv1Checksum{obj: &otg.PatternFlowIgmpv1Checksum{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIgmpv1Checksum) msg() *otg.PatternFlowIgmpv1Checksum { - return obj.obj -} - -func (obj *patternFlowIgmpv1Checksum) setMsg(msg *otg.PatternFlowIgmpv1Checksum) PatternFlowIgmpv1Checksum { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIgmpv1Checksum struct { - obj *patternFlowIgmpv1Checksum -} - -type marshalPatternFlowIgmpv1Checksum interface { - // ToProto marshals PatternFlowIgmpv1Checksum to protobuf object *otg.PatternFlowIgmpv1Checksum - ToProto() (*otg.PatternFlowIgmpv1Checksum, error) - // ToPbText marshals PatternFlowIgmpv1Checksum to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIgmpv1Checksum to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIgmpv1Checksum to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIgmpv1Checksum struct { - obj *patternFlowIgmpv1Checksum -} - -type unMarshalPatternFlowIgmpv1Checksum interface { - // FromProto unmarshals PatternFlowIgmpv1Checksum from protobuf object *otg.PatternFlowIgmpv1Checksum - FromProto(msg *otg.PatternFlowIgmpv1Checksum) (PatternFlowIgmpv1Checksum, error) - // FromPbText unmarshals PatternFlowIgmpv1Checksum from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIgmpv1Checksum from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIgmpv1Checksum from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIgmpv1Checksum) Marshal() marshalPatternFlowIgmpv1Checksum { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIgmpv1Checksum{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIgmpv1Checksum) Unmarshal() unMarshalPatternFlowIgmpv1Checksum { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIgmpv1Checksum{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIgmpv1Checksum) ToProto() (*otg.PatternFlowIgmpv1Checksum, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIgmpv1Checksum) FromProto(msg *otg.PatternFlowIgmpv1Checksum) (PatternFlowIgmpv1Checksum, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIgmpv1Checksum) 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 *unMarshalpatternFlowIgmpv1Checksum) 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 *marshalpatternFlowIgmpv1Checksum) 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 *unMarshalpatternFlowIgmpv1Checksum) 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 *marshalpatternFlowIgmpv1Checksum) 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 *unMarshalpatternFlowIgmpv1Checksum) 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 *patternFlowIgmpv1Checksum) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1Checksum) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1Checksum) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIgmpv1Checksum) Clone() (PatternFlowIgmpv1Checksum, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIgmpv1Checksum() - 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 -} - -// PatternFlowIgmpv1Checksum is checksum -type PatternFlowIgmpv1Checksum interface { - Validation - // msg marshals PatternFlowIgmpv1Checksum to protobuf object *otg.PatternFlowIgmpv1Checksum - // and doesn't set defaults - msg() *otg.PatternFlowIgmpv1Checksum - // setMsg unmarshals PatternFlowIgmpv1Checksum from protobuf object *otg.PatternFlowIgmpv1Checksum - // and doesn't set defaults - setMsg(*otg.PatternFlowIgmpv1Checksum) PatternFlowIgmpv1Checksum - // provides marshal interface - Marshal() marshalPatternFlowIgmpv1Checksum - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIgmpv1Checksum - // validate validates PatternFlowIgmpv1Checksum - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIgmpv1Checksum, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIgmpv1ChecksumChoiceEnum, set in PatternFlowIgmpv1Checksum - Choice() PatternFlowIgmpv1ChecksumChoiceEnum - // setChoice assigns PatternFlowIgmpv1ChecksumChoiceEnum provided by user to PatternFlowIgmpv1Checksum - setChoice(value PatternFlowIgmpv1ChecksumChoiceEnum) PatternFlowIgmpv1Checksum - // HasChoice checks if Choice has been set in PatternFlowIgmpv1Checksum - HasChoice() bool - // Generated returns PatternFlowIgmpv1ChecksumGeneratedEnum, set in PatternFlowIgmpv1Checksum - Generated() PatternFlowIgmpv1ChecksumGeneratedEnum - // SetGenerated assigns PatternFlowIgmpv1ChecksumGeneratedEnum provided by user to PatternFlowIgmpv1Checksum - SetGenerated(value PatternFlowIgmpv1ChecksumGeneratedEnum) PatternFlowIgmpv1Checksum - // HasGenerated checks if Generated has been set in PatternFlowIgmpv1Checksum - HasGenerated() bool - // Custom returns uint32, set in PatternFlowIgmpv1Checksum. - Custom() uint32 - // SetCustom assigns uint32 provided by user to PatternFlowIgmpv1Checksum - SetCustom(value uint32) PatternFlowIgmpv1Checksum - // HasCustom checks if Custom has been set in PatternFlowIgmpv1Checksum - HasCustom() bool -} - -type PatternFlowIgmpv1ChecksumChoiceEnum string - -// Enum of Choice on PatternFlowIgmpv1Checksum -var PatternFlowIgmpv1ChecksumChoice = struct { - GENERATED PatternFlowIgmpv1ChecksumChoiceEnum - CUSTOM PatternFlowIgmpv1ChecksumChoiceEnum -}{ - GENERATED: PatternFlowIgmpv1ChecksumChoiceEnum("generated"), - CUSTOM: PatternFlowIgmpv1ChecksumChoiceEnum("custom"), -} - -func (obj *patternFlowIgmpv1Checksum) Choice() PatternFlowIgmpv1ChecksumChoiceEnum { - return PatternFlowIgmpv1ChecksumChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The type of checksum -// Choice returns a string -func (obj *patternFlowIgmpv1Checksum) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIgmpv1Checksum) setChoice(value PatternFlowIgmpv1ChecksumChoiceEnum) PatternFlowIgmpv1Checksum { - intValue, ok := otg.PatternFlowIgmpv1Checksum_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIgmpv1ChecksumChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIgmpv1Checksum_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Custom = nil - obj.obj.Generated = otg.PatternFlowIgmpv1Checksum_Generated_unspecified.Enum() - return obj -} - -type PatternFlowIgmpv1ChecksumGeneratedEnum string - -// Enum of Generated on PatternFlowIgmpv1Checksum -var PatternFlowIgmpv1ChecksumGenerated = struct { - GOOD PatternFlowIgmpv1ChecksumGeneratedEnum - BAD PatternFlowIgmpv1ChecksumGeneratedEnum -}{ - GOOD: PatternFlowIgmpv1ChecksumGeneratedEnum("good"), - BAD: PatternFlowIgmpv1ChecksumGeneratedEnum("bad"), -} - -func (obj *patternFlowIgmpv1Checksum) Generated() PatternFlowIgmpv1ChecksumGeneratedEnum { - return PatternFlowIgmpv1ChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) -} - -// A system generated checksum value -// Generated returns a string -func (obj *patternFlowIgmpv1Checksum) HasGenerated() bool { - return obj.obj.Generated != nil -} - -func (obj *patternFlowIgmpv1Checksum) SetGenerated(value PatternFlowIgmpv1ChecksumGeneratedEnum) PatternFlowIgmpv1Checksum { - intValue, ok := otg.PatternFlowIgmpv1Checksum_Generated_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIgmpv1ChecksumGeneratedEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIgmpv1Checksum_Generated_Enum(intValue) - obj.obj.Generated = &enumValue - - return obj -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowIgmpv1Checksum) Custom() uint32 { - - if obj.obj.Custom == nil { - obj.setChoice(PatternFlowIgmpv1ChecksumChoice.CUSTOM) - } - - return *obj.obj.Custom - -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowIgmpv1Checksum) HasCustom() bool { - return obj.obj.Custom != nil -} - -// A custom checksum value -// SetCustom sets the uint32 value in the PatternFlowIgmpv1Checksum object -func (obj *patternFlowIgmpv1Checksum) SetCustom(value uint32) PatternFlowIgmpv1Checksum { - obj.setChoice(PatternFlowIgmpv1ChecksumChoice.CUSTOM) - obj.obj.Custom = &value - return obj -} - -func (obj *patternFlowIgmpv1Checksum) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Custom != nil { - - if *obj.obj.Custom > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1Checksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) - } - - } - -} - -func (obj *patternFlowIgmpv1Checksum) setDefault() { - var choices_set int = 0 - var choice PatternFlowIgmpv1ChecksumChoiceEnum - - if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { - choices_set += 1 - choice = PatternFlowIgmpv1ChecksumChoice.GENERATED - } - - if obj.obj.Custom != nil { - choices_set += 1 - choice = PatternFlowIgmpv1ChecksumChoice.CUSTOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIgmpv1ChecksumChoice.GENERATED) - if obj.obj.Generated.Number() == 0 { - obj.SetGenerated(PatternFlowIgmpv1ChecksumGenerated.GOOD) - - } - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIgmpv1Checksum") - } - } else { - intVal := otg.PatternFlowIgmpv1Checksum_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIgmpv1Checksum_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIgmpv1GroupAddress ***** -type patternFlowIgmpv1GroupAddress struct { - validation - obj *otg.PatternFlowIgmpv1GroupAddress - marshaller marshalPatternFlowIgmpv1GroupAddress - unMarshaller unMarshalPatternFlowIgmpv1GroupAddress - incrementHolder PatternFlowIgmpv1GroupAddressCounter - decrementHolder PatternFlowIgmpv1GroupAddressCounter - metricTagsHolder PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter -} - -func NewPatternFlowIgmpv1GroupAddress() PatternFlowIgmpv1GroupAddress { - obj := patternFlowIgmpv1GroupAddress{obj: &otg.PatternFlowIgmpv1GroupAddress{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIgmpv1GroupAddress) msg() *otg.PatternFlowIgmpv1GroupAddress { - return obj.obj -} - -func (obj *patternFlowIgmpv1GroupAddress) setMsg(msg *otg.PatternFlowIgmpv1GroupAddress) PatternFlowIgmpv1GroupAddress { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIgmpv1GroupAddress struct { - obj *patternFlowIgmpv1GroupAddress -} - -type marshalPatternFlowIgmpv1GroupAddress interface { - // ToProto marshals PatternFlowIgmpv1GroupAddress to protobuf object *otg.PatternFlowIgmpv1GroupAddress - ToProto() (*otg.PatternFlowIgmpv1GroupAddress, error) - // ToPbText marshals PatternFlowIgmpv1GroupAddress to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIgmpv1GroupAddress to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIgmpv1GroupAddress to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIgmpv1GroupAddress struct { - obj *patternFlowIgmpv1GroupAddress -} - -type unMarshalPatternFlowIgmpv1GroupAddress interface { - // FromProto unmarshals PatternFlowIgmpv1GroupAddress from protobuf object *otg.PatternFlowIgmpv1GroupAddress - FromProto(msg *otg.PatternFlowIgmpv1GroupAddress) (PatternFlowIgmpv1GroupAddress, error) - // FromPbText unmarshals PatternFlowIgmpv1GroupAddress from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIgmpv1GroupAddress from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIgmpv1GroupAddress from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIgmpv1GroupAddress) Marshal() marshalPatternFlowIgmpv1GroupAddress { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIgmpv1GroupAddress{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIgmpv1GroupAddress) Unmarshal() unMarshalPatternFlowIgmpv1GroupAddress { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIgmpv1GroupAddress{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIgmpv1GroupAddress) ToProto() (*otg.PatternFlowIgmpv1GroupAddress, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIgmpv1GroupAddress) FromProto(msg *otg.PatternFlowIgmpv1GroupAddress) (PatternFlowIgmpv1GroupAddress, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIgmpv1GroupAddress) 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 *unMarshalpatternFlowIgmpv1GroupAddress) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIgmpv1GroupAddress) 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 *unMarshalpatternFlowIgmpv1GroupAddress) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIgmpv1GroupAddress) 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 *unMarshalpatternFlowIgmpv1GroupAddress) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIgmpv1GroupAddress) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1GroupAddress) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1GroupAddress) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIgmpv1GroupAddress) Clone() (PatternFlowIgmpv1GroupAddress, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIgmpv1GroupAddress() - 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 -} - -func (obj *patternFlowIgmpv1GroupAddress) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIgmpv1GroupAddress is group address -type PatternFlowIgmpv1GroupAddress interface { - Validation - // msg marshals PatternFlowIgmpv1GroupAddress to protobuf object *otg.PatternFlowIgmpv1GroupAddress - // and doesn't set defaults - msg() *otg.PatternFlowIgmpv1GroupAddress - // setMsg unmarshals PatternFlowIgmpv1GroupAddress from protobuf object *otg.PatternFlowIgmpv1GroupAddress - // and doesn't set defaults - setMsg(*otg.PatternFlowIgmpv1GroupAddress) PatternFlowIgmpv1GroupAddress - // provides marshal interface - Marshal() marshalPatternFlowIgmpv1GroupAddress - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIgmpv1GroupAddress - // validate validates PatternFlowIgmpv1GroupAddress - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIgmpv1GroupAddress, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIgmpv1GroupAddressChoiceEnum, set in PatternFlowIgmpv1GroupAddress - Choice() PatternFlowIgmpv1GroupAddressChoiceEnum - // setChoice assigns PatternFlowIgmpv1GroupAddressChoiceEnum provided by user to PatternFlowIgmpv1GroupAddress - setChoice(value PatternFlowIgmpv1GroupAddressChoiceEnum) PatternFlowIgmpv1GroupAddress - // HasChoice checks if Choice has been set in PatternFlowIgmpv1GroupAddress - HasChoice() bool - // Value returns string, set in PatternFlowIgmpv1GroupAddress. - Value() string - // SetValue assigns string provided by user to PatternFlowIgmpv1GroupAddress - SetValue(value string) PatternFlowIgmpv1GroupAddress - // HasValue checks if Value has been set in PatternFlowIgmpv1GroupAddress - HasValue() bool - // Values returns []string, set in PatternFlowIgmpv1GroupAddress. - Values() []string - // SetValues assigns []string provided by user to PatternFlowIgmpv1GroupAddress - SetValues(value []string) PatternFlowIgmpv1GroupAddress - // Increment returns PatternFlowIgmpv1GroupAddressCounter, set in PatternFlowIgmpv1GroupAddress. - // PatternFlowIgmpv1GroupAddressCounter is ipv4 counter pattern - Increment() PatternFlowIgmpv1GroupAddressCounter - // SetIncrement assigns PatternFlowIgmpv1GroupAddressCounter provided by user to PatternFlowIgmpv1GroupAddress. - // PatternFlowIgmpv1GroupAddressCounter is ipv4 counter pattern - SetIncrement(value PatternFlowIgmpv1GroupAddressCounter) PatternFlowIgmpv1GroupAddress - // HasIncrement checks if Increment has been set in PatternFlowIgmpv1GroupAddress - HasIncrement() bool - // Decrement returns PatternFlowIgmpv1GroupAddressCounter, set in PatternFlowIgmpv1GroupAddress. - // PatternFlowIgmpv1GroupAddressCounter is ipv4 counter pattern - Decrement() PatternFlowIgmpv1GroupAddressCounter - // SetDecrement assigns PatternFlowIgmpv1GroupAddressCounter provided by user to PatternFlowIgmpv1GroupAddress. - // PatternFlowIgmpv1GroupAddressCounter is ipv4 counter pattern - SetDecrement(value PatternFlowIgmpv1GroupAddressCounter) PatternFlowIgmpv1GroupAddress - // HasDecrement checks if Decrement has been set in PatternFlowIgmpv1GroupAddress - HasDecrement() bool - // MetricTags returns PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIterIter, set in PatternFlowIgmpv1GroupAddress - MetricTags() PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter - setNil() -} - -type PatternFlowIgmpv1GroupAddressChoiceEnum string - -// Enum of Choice on PatternFlowIgmpv1GroupAddress -var PatternFlowIgmpv1GroupAddressChoice = struct { - VALUE PatternFlowIgmpv1GroupAddressChoiceEnum - VALUES PatternFlowIgmpv1GroupAddressChoiceEnum - INCREMENT PatternFlowIgmpv1GroupAddressChoiceEnum - DECREMENT PatternFlowIgmpv1GroupAddressChoiceEnum -}{ - VALUE: PatternFlowIgmpv1GroupAddressChoiceEnum("value"), - VALUES: PatternFlowIgmpv1GroupAddressChoiceEnum("values"), - INCREMENT: PatternFlowIgmpv1GroupAddressChoiceEnum("increment"), - DECREMENT: PatternFlowIgmpv1GroupAddressChoiceEnum("decrement"), -} - -func (obj *patternFlowIgmpv1GroupAddress) Choice() PatternFlowIgmpv1GroupAddressChoiceEnum { - return PatternFlowIgmpv1GroupAddressChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIgmpv1GroupAddress) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIgmpv1GroupAddress) setChoice(value PatternFlowIgmpv1GroupAddressChoiceEnum) PatternFlowIgmpv1GroupAddress { - intValue, ok := otg.PatternFlowIgmpv1GroupAddress_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIgmpv1GroupAddressChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIgmpv1GroupAddress_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIgmpv1GroupAddressChoice.VALUE { - defaultValue := "0.0.0.0" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIgmpv1GroupAddressChoice.VALUES { - defaultValue := []string{"0.0.0.0"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIgmpv1GroupAddressChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIgmpv1GroupAddressCounter().msg() - } - - if value == PatternFlowIgmpv1GroupAddressChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIgmpv1GroupAddressCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowIgmpv1GroupAddress) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowIgmpv1GroupAddress) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowIgmpv1GroupAddress object -func (obj *patternFlowIgmpv1GroupAddress) SetValue(value string) PatternFlowIgmpv1GroupAddress { - obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowIgmpv1GroupAddress) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"0.0.0.0"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowIgmpv1GroupAddress object -func (obj *patternFlowIgmpv1GroupAddress) SetValues(value []string) PatternFlowIgmpv1GroupAddress { - obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIgmpv1GroupAddressCounter -func (obj *patternFlowIgmpv1GroupAddress) Increment() PatternFlowIgmpv1GroupAddressCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIgmpv1GroupAddressCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIgmpv1GroupAddressCounter -func (obj *patternFlowIgmpv1GroupAddress) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIgmpv1GroupAddressCounter value in the PatternFlowIgmpv1GroupAddress object -func (obj *patternFlowIgmpv1GroupAddress) SetIncrement(value PatternFlowIgmpv1GroupAddressCounter) PatternFlowIgmpv1GroupAddress { - obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIgmpv1GroupAddressCounter -func (obj *patternFlowIgmpv1GroupAddress) Decrement() PatternFlowIgmpv1GroupAddressCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIgmpv1GroupAddressCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIgmpv1GroupAddressCounter -func (obj *patternFlowIgmpv1GroupAddress) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIgmpv1GroupAddressCounter value in the PatternFlowIgmpv1GroupAddress object -func (obj *patternFlowIgmpv1GroupAddress) SetDecrement(value PatternFlowIgmpv1GroupAddressCounter) PatternFlowIgmpv1GroupAddress { - obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIgmpv1GroupAddressMetricTag -func (obj *patternFlowIgmpv1GroupAddress) MetricTags() PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIgmpv1GroupAddressMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter struct { - obj *patternFlowIgmpv1GroupAddress - patternFlowIgmpv1GroupAddressMetricTagSlice []PatternFlowIgmpv1GroupAddressMetricTag - fieldPtr *[]*otg.PatternFlowIgmpv1GroupAddressMetricTag -} - -func newPatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter(ptr *[]*otg.PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { - return &patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter interface { - setMsg(*patternFlowIgmpv1GroupAddress) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter - Items() []PatternFlowIgmpv1GroupAddressMetricTag - Add() PatternFlowIgmpv1GroupAddressMetricTag - Append(items ...PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter - Set(index int, newObj PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter - Clear() PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter - clearHolderSlice() PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter - appendHolderSlice(item PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter -} - -func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) setMsg(msg *patternFlowIgmpv1GroupAddress) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIgmpv1GroupAddressMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) Items() []PatternFlowIgmpv1GroupAddressMetricTag { - return obj.patternFlowIgmpv1GroupAddressMetricTagSlice -} - -func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) Add() PatternFlowIgmpv1GroupAddressMetricTag { - newObj := &otg.PatternFlowIgmpv1GroupAddressMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIgmpv1GroupAddressMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIgmpv1GroupAddressMetricTagSlice = append(obj.patternFlowIgmpv1GroupAddressMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) Append(items ...PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIgmpv1GroupAddressMetricTagSlice = append(obj.patternFlowIgmpv1GroupAddressMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) Set(index int, newObj PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIgmpv1GroupAddressMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) Clear() PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIgmpv1GroupAddressMetricTag{} - obj.patternFlowIgmpv1GroupAddressMetricTagSlice = []PatternFlowIgmpv1GroupAddressMetricTag{} - } - return obj -} -func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) clearHolderSlice() PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { - if len(obj.patternFlowIgmpv1GroupAddressMetricTagSlice) > 0 { - obj.patternFlowIgmpv1GroupAddressMetricTagSlice = []PatternFlowIgmpv1GroupAddressMetricTag{} - } - return obj -} -func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) appendHolderSlice(item PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { - obj.patternFlowIgmpv1GroupAddressMetricTagSlice = append(obj.patternFlowIgmpv1GroupAddressMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIgmpv1GroupAddress) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv4(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIgmpv1GroupAddress.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateIpv4Slice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIgmpv1GroupAddress.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIgmpv1GroupAddressMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIgmpv1GroupAddress) setDefault() { - var choices_set int = 0 - var choice PatternFlowIgmpv1GroupAddressChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIgmpv1GroupAddressChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIgmpv1GroupAddressChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIgmpv1GroupAddressChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIgmpv1GroupAddressChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIgmpv1GroupAddress") - } - } else { - intVal := otg.PatternFlowIgmpv1GroupAddress_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIgmpv1GroupAddress_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowMplsLabel ***** -type patternFlowMplsLabel struct { - validation - obj *otg.PatternFlowMplsLabel - marshaller marshalPatternFlowMplsLabel - unMarshaller unMarshalPatternFlowMplsLabel - incrementHolder PatternFlowMplsLabelCounter - decrementHolder PatternFlowMplsLabelCounter - metricTagsHolder PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter -} - -func NewPatternFlowMplsLabel() PatternFlowMplsLabel { - obj := patternFlowMplsLabel{obj: &otg.PatternFlowMplsLabel{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowMplsLabel) msg() *otg.PatternFlowMplsLabel { - return obj.obj -} - -func (obj *patternFlowMplsLabel) setMsg(msg *otg.PatternFlowMplsLabel) PatternFlowMplsLabel { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowMplsLabel struct { - obj *patternFlowMplsLabel -} - -type marshalPatternFlowMplsLabel interface { - // ToProto marshals PatternFlowMplsLabel to protobuf object *otg.PatternFlowMplsLabel - ToProto() (*otg.PatternFlowMplsLabel, error) - // ToPbText marshals PatternFlowMplsLabel to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowMplsLabel to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowMplsLabel to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowMplsLabel struct { - obj *patternFlowMplsLabel -} - -type unMarshalPatternFlowMplsLabel interface { - // FromProto unmarshals PatternFlowMplsLabel from protobuf object *otg.PatternFlowMplsLabel - FromProto(msg *otg.PatternFlowMplsLabel) (PatternFlowMplsLabel, error) - // FromPbText unmarshals PatternFlowMplsLabel from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowMplsLabel from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowMplsLabel from JSON text - FromJson(value string) error -} - -func (obj *patternFlowMplsLabel) Marshal() marshalPatternFlowMplsLabel { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowMplsLabel{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowMplsLabel) Unmarshal() unMarshalPatternFlowMplsLabel { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowMplsLabel{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowMplsLabel) ToProto() (*otg.PatternFlowMplsLabel, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowMplsLabel) FromProto(msg *otg.PatternFlowMplsLabel) (PatternFlowMplsLabel, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowMplsLabel) 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 *unMarshalpatternFlowMplsLabel) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowMplsLabel) 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 *unMarshalpatternFlowMplsLabel) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowMplsLabel) 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 *unMarshalpatternFlowMplsLabel) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowMplsLabel) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowMplsLabel) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowMplsLabel) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowMplsLabel) Clone() (PatternFlowMplsLabel, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowMplsLabel() - 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 -} - -func (obj *patternFlowMplsLabel) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowMplsLabel is label of routers -type PatternFlowMplsLabel interface { - Validation - // msg marshals PatternFlowMplsLabel to protobuf object *otg.PatternFlowMplsLabel - // and doesn't set defaults - msg() *otg.PatternFlowMplsLabel - // setMsg unmarshals PatternFlowMplsLabel from protobuf object *otg.PatternFlowMplsLabel - // and doesn't set defaults - setMsg(*otg.PatternFlowMplsLabel) PatternFlowMplsLabel - // provides marshal interface - Marshal() marshalPatternFlowMplsLabel - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowMplsLabel - // validate validates PatternFlowMplsLabel - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowMplsLabel, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowMplsLabelChoiceEnum, set in PatternFlowMplsLabel - Choice() PatternFlowMplsLabelChoiceEnum - // setChoice assigns PatternFlowMplsLabelChoiceEnum provided by user to PatternFlowMplsLabel - setChoice(value PatternFlowMplsLabelChoiceEnum) PatternFlowMplsLabel - // HasChoice checks if Choice has been set in PatternFlowMplsLabel - HasChoice() bool - // Value returns uint32, set in PatternFlowMplsLabel. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowMplsLabel - SetValue(value uint32) PatternFlowMplsLabel - // HasValue checks if Value has been set in PatternFlowMplsLabel - HasValue() bool - // Values returns []uint32, set in PatternFlowMplsLabel. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowMplsLabel - SetValues(value []uint32) PatternFlowMplsLabel - // Auto returns uint32, set in PatternFlowMplsLabel. - Auto() uint32 - // HasAuto checks if Auto has been set in PatternFlowMplsLabel - HasAuto() bool - // Increment returns PatternFlowMplsLabelCounter, set in PatternFlowMplsLabel. - // PatternFlowMplsLabelCounter is integer counter pattern - Increment() PatternFlowMplsLabelCounter - // SetIncrement assigns PatternFlowMplsLabelCounter provided by user to PatternFlowMplsLabel. - // PatternFlowMplsLabelCounter is integer counter pattern - SetIncrement(value PatternFlowMplsLabelCounter) PatternFlowMplsLabel - // HasIncrement checks if Increment has been set in PatternFlowMplsLabel - HasIncrement() bool - // Decrement returns PatternFlowMplsLabelCounter, set in PatternFlowMplsLabel. - // PatternFlowMplsLabelCounter is integer counter pattern - Decrement() PatternFlowMplsLabelCounter - // SetDecrement assigns PatternFlowMplsLabelCounter provided by user to PatternFlowMplsLabel. - // PatternFlowMplsLabelCounter is integer counter pattern - SetDecrement(value PatternFlowMplsLabelCounter) PatternFlowMplsLabel - // HasDecrement checks if Decrement has been set in PatternFlowMplsLabel - HasDecrement() bool - // MetricTags returns PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIterIter, set in PatternFlowMplsLabel - MetricTags() PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter - setNil() -} - -type PatternFlowMplsLabelChoiceEnum string - -// Enum of Choice on PatternFlowMplsLabel -var PatternFlowMplsLabelChoice = struct { - VALUE PatternFlowMplsLabelChoiceEnum - VALUES PatternFlowMplsLabelChoiceEnum - AUTO PatternFlowMplsLabelChoiceEnum - INCREMENT PatternFlowMplsLabelChoiceEnum - DECREMENT PatternFlowMplsLabelChoiceEnum -}{ - VALUE: PatternFlowMplsLabelChoiceEnum("value"), - VALUES: PatternFlowMplsLabelChoiceEnum("values"), - AUTO: PatternFlowMplsLabelChoiceEnum("auto"), - INCREMENT: PatternFlowMplsLabelChoiceEnum("increment"), - DECREMENT: PatternFlowMplsLabelChoiceEnum("decrement"), -} - -func (obj *patternFlowMplsLabel) Choice() PatternFlowMplsLabelChoiceEnum { - return PatternFlowMplsLabelChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowMplsLabel) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowMplsLabel) setChoice(value PatternFlowMplsLabelChoiceEnum) PatternFlowMplsLabel { - intValue, ok := otg.PatternFlowMplsLabel_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowMplsLabelChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowMplsLabel_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Auto = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowMplsLabelChoice.VALUE { - defaultValue := uint32(16) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowMplsLabelChoice.VALUES { - defaultValue := []uint32{16} - obj.obj.Values = defaultValue - } - - if value == PatternFlowMplsLabelChoice.AUTO { - defaultValue := uint32(16) - obj.obj.Auto = &defaultValue - } - - if value == PatternFlowMplsLabelChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowMplsLabelCounter().msg() - } - - if value == PatternFlowMplsLabelChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowMplsLabelCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowMplsLabel) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowMplsLabelChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowMplsLabel) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowMplsLabel object -func (obj *patternFlowMplsLabel) SetValue(value uint32) PatternFlowMplsLabel { - obj.setChoice(PatternFlowMplsLabelChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowMplsLabel) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{16}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowMplsLabel object -func (obj *patternFlowMplsLabel) SetValues(value []uint32) PatternFlowMplsLabel { - obj.setChoice(PatternFlowMplsLabelChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowMplsLabel) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(PatternFlowMplsLabelChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowMplsLabel) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Increment returns a PatternFlowMplsLabelCounter -func (obj *patternFlowMplsLabel) Increment() PatternFlowMplsLabelCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowMplsLabelChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowMplsLabelCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowMplsLabelCounter -func (obj *patternFlowMplsLabel) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowMplsLabelCounter value in the PatternFlowMplsLabel object -func (obj *patternFlowMplsLabel) SetIncrement(value PatternFlowMplsLabelCounter) PatternFlowMplsLabel { - obj.setChoice(PatternFlowMplsLabelChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowMplsLabelCounter -func (obj *patternFlowMplsLabel) Decrement() PatternFlowMplsLabelCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowMplsLabelChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowMplsLabelCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowMplsLabelCounter -func (obj *patternFlowMplsLabel) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowMplsLabelCounter value in the PatternFlowMplsLabel object -func (obj *patternFlowMplsLabel) SetDecrement(value PatternFlowMplsLabelCounter) PatternFlowMplsLabel { - obj.setChoice(PatternFlowMplsLabelChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowMplsLabelMetricTag -func (obj *patternFlowMplsLabel) MetricTags() PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowMplsLabelMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter struct { - obj *patternFlowMplsLabel - patternFlowMplsLabelMetricTagSlice []PatternFlowMplsLabelMetricTag - fieldPtr *[]*otg.PatternFlowMplsLabelMetricTag -} - -func newPatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter(ptr *[]*otg.PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { - return &patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter interface { - setMsg(*patternFlowMplsLabel) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter - Items() []PatternFlowMplsLabelMetricTag - Add() PatternFlowMplsLabelMetricTag - Append(items ...PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter - Set(index int, newObj PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter - Clear() PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter - clearHolderSlice() PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter - appendHolderSlice(item PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter -} - -func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) setMsg(msg *patternFlowMplsLabel) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowMplsLabelMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) Items() []PatternFlowMplsLabelMetricTag { - return obj.patternFlowMplsLabelMetricTagSlice -} - -func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) Add() PatternFlowMplsLabelMetricTag { - newObj := &otg.PatternFlowMplsLabelMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowMplsLabelMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowMplsLabelMetricTagSlice = append(obj.patternFlowMplsLabelMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) Append(items ...PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowMplsLabelMetricTagSlice = append(obj.patternFlowMplsLabelMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) Set(index int, newObj PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowMplsLabelMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) Clear() PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowMplsLabelMetricTag{} - obj.patternFlowMplsLabelMetricTagSlice = []PatternFlowMplsLabelMetricTag{} - } - return obj -} -func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) clearHolderSlice() PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { - if len(obj.patternFlowMplsLabelMetricTagSlice) > 0 { - obj.patternFlowMplsLabelMetricTagSlice = []PatternFlowMplsLabelMetricTag{} - } - return obj -} -func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) appendHolderSlice(item PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { - obj.patternFlowMplsLabelMetricTagSlice = append(obj.patternFlowMplsLabelMetricTagSlice, item) - return obj -} - -func (obj *patternFlowMplsLabel) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsLabel.Value <= 1048575 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowMplsLabel.Values <= 1048575 but Got %d", item)) - } - - } - - } - - if obj.obj.Auto != nil { - - if *obj.obj.Auto > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsLabel.Auto <= 1048575 but Got %d", *obj.obj.Auto)) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowMplsLabelMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowMplsLabel) setDefault() { - var choices_set int = 0 - var choice PatternFlowMplsLabelChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowMplsLabelChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowMplsLabelChoice.VALUES - } - - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowMplsLabelChoice.AUTO - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowMplsLabelChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowMplsLabelChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowMplsLabelChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowMplsLabel") - } - } else { - intVal := otg.PatternFlowMplsLabel_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowMplsLabel_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowMplsTrafficClass ***** -type patternFlowMplsTrafficClass struct { - validation - obj *otg.PatternFlowMplsTrafficClass - marshaller marshalPatternFlowMplsTrafficClass - unMarshaller unMarshalPatternFlowMplsTrafficClass - incrementHolder PatternFlowMplsTrafficClassCounter - decrementHolder PatternFlowMplsTrafficClassCounter - metricTagsHolder PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter -} - -func NewPatternFlowMplsTrafficClass() PatternFlowMplsTrafficClass { - obj := patternFlowMplsTrafficClass{obj: &otg.PatternFlowMplsTrafficClass{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowMplsTrafficClass) msg() *otg.PatternFlowMplsTrafficClass { - return obj.obj -} - -func (obj *patternFlowMplsTrafficClass) setMsg(msg *otg.PatternFlowMplsTrafficClass) PatternFlowMplsTrafficClass { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowMplsTrafficClass struct { - obj *patternFlowMplsTrafficClass -} - -type marshalPatternFlowMplsTrafficClass interface { - // ToProto marshals PatternFlowMplsTrafficClass to protobuf object *otg.PatternFlowMplsTrafficClass - ToProto() (*otg.PatternFlowMplsTrafficClass, error) - // ToPbText marshals PatternFlowMplsTrafficClass to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowMplsTrafficClass to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowMplsTrafficClass to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowMplsTrafficClass struct { - obj *patternFlowMplsTrafficClass -} - -type unMarshalPatternFlowMplsTrafficClass interface { - // FromProto unmarshals PatternFlowMplsTrafficClass from protobuf object *otg.PatternFlowMplsTrafficClass - FromProto(msg *otg.PatternFlowMplsTrafficClass) (PatternFlowMplsTrafficClass, error) - // FromPbText unmarshals PatternFlowMplsTrafficClass from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowMplsTrafficClass from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowMplsTrafficClass from JSON text - FromJson(value string) error -} - -func (obj *patternFlowMplsTrafficClass) Marshal() marshalPatternFlowMplsTrafficClass { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowMplsTrafficClass{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowMplsTrafficClass) Unmarshal() unMarshalPatternFlowMplsTrafficClass { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowMplsTrafficClass{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowMplsTrafficClass) ToProto() (*otg.PatternFlowMplsTrafficClass, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowMplsTrafficClass) FromProto(msg *otg.PatternFlowMplsTrafficClass) (PatternFlowMplsTrafficClass, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowMplsTrafficClass) 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 *unMarshalpatternFlowMplsTrafficClass) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowMplsTrafficClass) 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 *unMarshalpatternFlowMplsTrafficClass) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowMplsTrafficClass) 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 *unMarshalpatternFlowMplsTrafficClass) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowMplsTrafficClass) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowMplsTrafficClass) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowMplsTrafficClass) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowMplsTrafficClass) Clone() (PatternFlowMplsTrafficClass, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowMplsTrafficClass() - 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 -} - -func (obj *patternFlowMplsTrafficClass) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowMplsTrafficClass is traffic class -type PatternFlowMplsTrafficClass interface { - Validation - // msg marshals PatternFlowMplsTrafficClass to protobuf object *otg.PatternFlowMplsTrafficClass - // and doesn't set defaults - msg() *otg.PatternFlowMplsTrafficClass - // setMsg unmarshals PatternFlowMplsTrafficClass from protobuf object *otg.PatternFlowMplsTrafficClass - // and doesn't set defaults - setMsg(*otg.PatternFlowMplsTrafficClass) PatternFlowMplsTrafficClass - // provides marshal interface - Marshal() marshalPatternFlowMplsTrafficClass - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowMplsTrafficClass - // validate validates PatternFlowMplsTrafficClass - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowMplsTrafficClass, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowMplsTrafficClassChoiceEnum, set in PatternFlowMplsTrafficClass - Choice() PatternFlowMplsTrafficClassChoiceEnum - // setChoice assigns PatternFlowMplsTrafficClassChoiceEnum provided by user to PatternFlowMplsTrafficClass - setChoice(value PatternFlowMplsTrafficClassChoiceEnum) PatternFlowMplsTrafficClass - // HasChoice checks if Choice has been set in PatternFlowMplsTrafficClass - HasChoice() bool - // Value returns uint32, set in PatternFlowMplsTrafficClass. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowMplsTrafficClass - SetValue(value uint32) PatternFlowMplsTrafficClass - // HasValue checks if Value has been set in PatternFlowMplsTrafficClass - HasValue() bool - // Values returns []uint32, set in PatternFlowMplsTrafficClass. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowMplsTrafficClass - SetValues(value []uint32) PatternFlowMplsTrafficClass - // Increment returns PatternFlowMplsTrafficClassCounter, set in PatternFlowMplsTrafficClass. - // PatternFlowMplsTrafficClassCounter is integer counter pattern - Increment() PatternFlowMplsTrafficClassCounter - // SetIncrement assigns PatternFlowMplsTrafficClassCounter provided by user to PatternFlowMplsTrafficClass. - // PatternFlowMplsTrafficClassCounter is integer counter pattern - SetIncrement(value PatternFlowMplsTrafficClassCounter) PatternFlowMplsTrafficClass - // HasIncrement checks if Increment has been set in PatternFlowMplsTrafficClass - HasIncrement() bool - // Decrement returns PatternFlowMplsTrafficClassCounter, set in PatternFlowMplsTrafficClass. - // PatternFlowMplsTrafficClassCounter is integer counter pattern - Decrement() PatternFlowMplsTrafficClassCounter - // SetDecrement assigns PatternFlowMplsTrafficClassCounter provided by user to PatternFlowMplsTrafficClass. - // PatternFlowMplsTrafficClassCounter is integer counter pattern - SetDecrement(value PatternFlowMplsTrafficClassCounter) PatternFlowMplsTrafficClass - // HasDecrement checks if Decrement has been set in PatternFlowMplsTrafficClass - HasDecrement() bool - // MetricTags returns PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIterIter, set in PatternFlowMplsTrafficClass - MetricTags() PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter - setNil() -} - -type PatternFlowMplsTrafficClassChoiceEnum string - -// Enum of Choice on PatternFlowMplsTrafficClass -var PatternFlowMplsTrafficClassChoice = struct { - VALUE PatternFlowMplsTrafficClassChoiceEnum - VALUES PatternFlowMplsTrafficClassChoiceEnum - INCREMENT PatternFlowMplsTrafficClassChoiceEnum - DECREMENT PatternFlowMplsTrafficClassChoiceEnum -}{ - VALUE: PatternFlowMplsTrafficClassChoiceEnum("value"), - VALUES: PatternFlowMplsTrafficClassChoiceEnum("values"), - INCREMENT: PatternFlowMplsTrafficClassChoiceEnum("increment"), - DECREMENT: PatternFlowMplsTrafficClassChoiceEnum("decrement"), -} - -func (obj *patternFlowMplsTrafficClass) Choice() PatternFlowMplsTrafficClassChoiceEnum { - return PatternFlowMplsTrafficClassChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowMplsTrafficClass) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowMplsTrafficClass) setChoice(value PatternFlowMplsTrafficClassChoiceEnum) PatternFlowMplsTrafficClass { - intValue, ok := otg.PatternFlowMplsTrafficClass_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowMplsTrafficClassChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowMplsTrafficClass_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowMplsTrafficClassChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowMplsTrafficClassChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowMplsTrafficClassChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowMplsTrafficClassCounter().msg() - } - - if value == PatternFlowMplsTrafficClassChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowMplsTrafficClassCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowMplsTrafficClass) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowMplsTrafficClassChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowMplsTrafficClass) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowMplsTrafficClass object -func (obj *patternFlowMplsTrafficClass) SetValue(value uint32) PatternFlowMplsTrafficClass { - obj.setChoice(PatternFlowMplsTrafficClassChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowMplsTrafficClass) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowMplsTrafficClass object -func (obj *patternFlowMplsTrafficClass) SetValues(value []uint32) PatternFlowMplsTrafficClass { - obj.setChoice(PatternFlowMplsTrafficClassChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowMplsTrafficClassCounter -func (obj *patternFlowMplsTrafficClass) Increment() PatternFlowMplsTrafficClassCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowMplsTrafficClassChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowMplsTrafficClassCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowMplsTrafficClassCounter -func (obj *patternFlowMplsTrafficClass) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowMplsTrafficClassCounter value in the PatternFlowMplsTrafficClass object -func (obj *patternFlowMplsTrafficClass) SetIncrement(value PatternFlowMplsTrafficClassCounter) PatternFlowMplsTrafficClass { - obj.setChoice(PatternFlowMplsTrafficClassChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowMplsTrafficClassCounter -func (obj *patternFlowMplsTrafficClass) Decrement() PatternFlowMplsTrafficClassCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowMplsTrafficClassChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowMplsTrafficClassCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowMplsTrafficClassCounter -func (obj *patternFlowMplsTrafficClass) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowMplsTrafficClassCounter value in the PatternFlowMplsTrafficClass object -func (obj *patternFlowMplsTrafficClass) SetDecrement(value PatternFlowMplsTrafficClassCounter) PatternFlowMplsTrafficClass { - obj.setChoice(PatternFlowMplsTrafficClassChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowMplsTrafficClassMetricTag -func (obj *patternFlowMplsTrafficClass) MetricTags() PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowMplsTrafficClassMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter struct { - obj *patternFlowMplsTrafficClass - patternFlowMplsTrafficClassMetricTagSlice []PatternFlowMplsTrafficClassMetricTag - fieldPtr *[]*otg.PatternFlowMplsTrafficClassMetricTag -} - -func newPatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter(ptr *[]*otg.PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { - return &patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter interface { - setMsg(*patternFlowMplsTrafficClass) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter - Items() []PatternFlowMplsTrafficClassMetricTag - Add() PatternFlowMplsTrafficClassMetricTag - Append(items ...PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter - Set(index int, newObj PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter - Clear() PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter - clearHolderSlice() PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter - appendHolderSlice(item PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter -} - -func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) setMsg(msg *patternFlowMplsTrafficClass) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowMplsTrafficClassMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) Items() []PatternFlowMplsTrafficClassMetricTag { - return obj.patternFlowMplsTrafficClassMetricTagSlice -} - -func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) Add() PatternFlowMplsTrafficClassMetricTag { - newObj := &otg.PatternFlowMplsTrafficClassMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowMplsTrafficClassMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowMplsTrafficClassMetricTagSlice = append(obj.patternFlowMplsTrafficClassMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) Append(items ...PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowMplsTrafficClassMetricTagSlice = append(obj.patternFlowMplsTrafficClassMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) Set(index int, newObj PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowMplsTrafficClassMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) Clear() PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowMplsTrafficClassMetricTag{} - obj.patternFlowMplsTrafficClassMetricTagSlice = []PatternFlowMplsTrafficClassMetricTag{} - } - return obj -} -func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) clearHolderSlice() PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { - if len(obj.patternFlowMplsTrafficClassMetricTagSlice) > 0 { - obj.patternFlowMplsTrafficClassMetricTagSlice = []PatternFlowMplsTrafficClassMetricTag{} - } - return obj -} -func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) appendHolderSlice(item PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { - obj.patternFlowMplsTrafficClassMetricTagSlice = append(obj.patternFlowMplsTrafficClassMetricTagSlice, item) - return obj -} - -func (obj *patternFlowMplsTrafficClass) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsTrafficClass.Value <= 7 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowMplsTrafficClass.Values <= 7 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowMplsTrafficClassMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowMplsTrafficClass) setDefault() { - var choices_set int = 0 - var choice PatternFlowMplsTrafficClassChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowMplsTrafficClassChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowMplsTrafficClassChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowMplsTrafficClassChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowMplsTrafficClassChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowMplsTrafficClassChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowMplsTrafficClass") - } - } else { - intVal := otg.PatternFlowMplsTrafficClass_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowMplsTrafficClass_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowMplsBottomOfStack ***** -type patternFlowMplsBottomOfStack struct { - validation - obj *otg.PatternFlowMplsBottomOfStack - marshaller marshalPatternFlowMplsBottomOfStack - unMarshaller unMarshalPatternFlowMplsBottomOfStack - incrementHolder PatternFlowMplsBottomOfStackCounter - decrementHolder PatternFlowMplsBottomOfStackCounter - metricTagsHolder PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter -} - -func NewPatternFlowMplsBottomOfStack() PatternFlowMplsBottomOfStack { - obj := patternFlowMplsBottomOfStack{obj: &otg.PatternFlowMplsBottomOfStack{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowMplsBottomOfStack) msg() *otg.PatternFlowMplsBottomOfStack { - return obj.obj -} - -func (obj *patternFlowMplsBottomOfStack) setMsg(msg *otg.PatternFlowMplsBottomOfStack) PatternFlowMplsBottomOfStack { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowMplsBottomOfStack struct { - obj *patternFlowMplsBottomOfStack -} - -type marshalPatternFlowMplsBottomOfStack interface { - // ToProto marshals PatternFlowMplsBottomOfStack to protobuf object *otg.PatternFlowMplsBottomOfStack - ToProto() (*otg.PatternFlowMplsBottomOfStack, error) - // ToPbText marshals PatternFlowMplsBottomOfStack to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowMplsBottomOfStack to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowMplsBottomOfStack to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowMplsBottomOfStack struct { - obj *patternFlowMplsBottomOfStack -} - -type unMarshalPatternFlowMplsBottomOfStack interface { - // FromProto unmarshals PatternFlowMplsBottomOfStack from protobuf object *otg.PatternFlowMplsBottomOfStack - FromProto(msg *otg.PatternFlowMplsBottomOfStack) (PatternFlowMplsBottomOfStack, error) - // FromPbText unmarshals PatternFlowMplsBottomOfStack from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowMplsBottomOfStack from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowMplsBottomOfStack from JSON text - FromJson(value string) error -} - -func (obj *patternFlowMplsBottomOfStack) Marshal() marshalPatternFlowMplsBottomOfStack { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowMplsBottomOfStack{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowMplsBottomOfStack) Unmarshal() unMarshalPatternFlowMplsBottomOfStack { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowMplsBottomOfStack{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowMplsBottomOfStack) ToProto() (*otg.PatternFlowMplsBottomOfStack, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowMplsBottomOfStack) FromProto(msg *otg.PatternFlowMplsBottomOfStack) (PatternFlowMplsBottomOfStack, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowMplsBottomOfStack) 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 *unMarshalpatternFlowMplsBottomOfStack) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowMplsBottomOfStack) 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 *unMarshalpatternFlowMplsBottomOfStack) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowMplsBottomOfStack) 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 *unMarshalpatternFlowMplsBottomOfStack) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowMplsBottomOfStack) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowMplsBottomOfStack) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowMplsBottomOfStack) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowMplsBottomOfStack) Clone() (PatternFlowMplsBottomOfStack, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowMplsBottomOfStack() - 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 -} - -func (obj *patternFlowMplsBottomOfStack) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowMplsBottomOfStack is bottom of stack -type PatternFlowMplsBottomOfStack interface { - Validation - // msg marshals PatternFlowMplsBottomOfStack to protobuf object *otg.PatternFlowMplsBottomOfStack - // and doesn't set defaults - msg() *otg.PatternFlowMplsBottomOfStack - // setMsg unmarshals PatternFlowMplsBottomOfStack from protobuf object *otg.PatternFlowMplsBottomOfStack - // and doesn't set defaults - setMsg(*otg.PatternFlowMplsBottomOfStack) PatternFlowMplsBottomOfStack - // provides marshal interface - Marshal() marshalPatternFlowMplsBottomOfStack - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowMplsBottomOfStack - // validate validates PatternFlowMplsBottomOfStack - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowMplsBottomOfStack, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowMplsBottomOfStackChoiceEnum, set in PatternFlowMplsBottomOfStack - Choice() PatternFlowMplsBottomOfStackChoiceEnum - // setChoice assigns PatternFlowMplsBottomOfStackChoiceEnum provided by user to PatternFlowMplsBottomOfStack - setChoice(value PatternFlowMplsBottomOfStackChoiceEnum) PatternFlowMplsBottomOfStack - // HasChoice checks if Choice has been set in PatternFlowMplsBottomOfStack - HasChoice() bool - // Value returns uint32, set in PatternFlowMplsBottomOfStack. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowMplsBottomOfStack - SetValue(value uint32) PatternFlowMplsBottomOfStack - // HasValue checks if Value has been set in PatternFlowMplsBottomOfStack - HasValue() bool - // Values returns []uint32, set in PatternFlowMplsBottomOfStack. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowMplsBottomOfStack - SetValues(value []uint32) PatternFlowMplsBottomOfStack - // Auto returns uint32, set in PatternFlowMplsBottomOfStack. - Auto() uint32 - // HasAuto checks if Auto has been set in PatternFlowMplsBottomOfStack - HasAuto() bool - // Increment returns PatternFlowMplsBottomOfStackCounter, set in PatternFlowMplsBottomOfStack. - // PatternFlowMplsBottomOfStackCounter is integer counter pattern - Increment() PatternFlowMplsBottomOfStackCounter - // SetIncrement assigns PatternFlowMplsBottomOfStackCounter provided by user to PatternFlowMplsBottomOfStack. - // PatternFlowMplsBottomOfStackCounter is integer counter pattern - SetIncrement(value PatternFlowMplsBottomOfStackCounter) PatternFlowMplsBottomOfStack - // HasIncrement checks if Increment has been set in PatternFlowMplsBottomOfStack - HasIncrement() bool - // Decrement returns PatternFlowMplsBottomOfStackCounter, set in PatternFlowMplsBottomOfStack. - // PatternFlowMplsBottomOfStackCounter is integer counter pattern - Decrement() PatternFlowMplsBottomOfStackCounter - // SetDecrement assigns PatternFlowMplsBottomOfStackCounter provided by user to PatternFlowMplsBottomOfStack. - // PatternFlowMplsBottomOfStackCounter is integer counter pattern - SetDecrement(value PatternFlowMplsBottomOfStackCounter) PatternFlowMplsBottomOfStack - // HasDecrement checks if Decrement has been set in PatternFlowMplsBottomOfStack - HasDecrement() bool - // MetricTags returns PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIterIter, set in PatternFlowMplsBottomOfStack - MetricTags() PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter - setNil() -} - -type PatternFlowMplsBottomOfStackChoiceEnum string - -// Enum of Choice on PatternFlowMplsBottomOfStack -var PatternFlowMplsBottomOfStackChoice = struct { - VALUE PatternFlowMplsBottomOfStackChoiceEnum - VALUES PatternFlowMplsBottomOfStackChoiceEnum - AUTO PatternFlowMplsBottomOfStackChoiceEnum - INCREMENT PatternFlowMplsBottomOfStackChoiceEnum - DECREMENT PatternFlowMplsBottomOfStackChoiceEnum -}{ - VALUE: PatternFlowMplsBottomOfStackChoiceEnum("value"), - VALUES: PatternFlowMplsBottomOfStackChoiceEnum("values"), - AUTO: PatternFlowMplsBottomOfStackChoiceEnum("auto"), - INCREMENT: PatternFlowMplsBottomOfStackChoiceEnum("increment"), - DECREMENT: PatternFlowMplsBottomOfStackChoiceEnum("decrement"), -} - -func (obj *patternFlowMplsBottomOfStack) Choice() PatternFlowMplsBottomOfStackChoiceEnum { - return PatternFlowMplsBottomOfStackChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowMplsBottomOfStack) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowMplsBottomOfStack) setChoice(value PatternFlowMplsBottomOfStackChoiceEnum) PatternFlowMplsBottomOfStack { - intValue, ok := otg.PatternFlowMplsBottomOfStack_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowMplsBottomOfStackChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowMplsBottomOfStack_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Auto = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowMplsBottomOfStackChoice.VALUE { - defaultValue := uint32(1) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowMplsBottomOfStackChoice.VALUES { - defaultValue := []uint32{1} - obj.obj.Values = defaultValue - } - - if value == PatternFlowMplsBottomOfStackChoice.AUTO { - defaultValue := uint32(1) - obj.obj.Auto = &defaultValue - } - - if value == PatternFlowMplsBottomOfStackChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowMplsBottomOfStackCounter().msg() - } - - if value == PatternFlowMplsBottomOfStackChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowMplsBottomOfStackCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowMplsBottomOfStack) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowMplsBottomOfStackChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowMplsBottomOfStack) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowMplsBottomOfStack object -func (obj *patternFlowMplsBottomOfStack) SetValue(value uint32) PatternFlowMplsBottomOfStack { - obj.setChoice(PatternFlowMplsBottomOfStackChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowMplsBottomOfStack) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{1}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowMplsBottomOfStack object -func (obj *patternFlowMplsBottomOfStack) SetValues(value []uint32) PatternFlowMplsBottomOfStack { - obj.setChoice(PatternFlowMplsBottomOfStackChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowMplsBottomOfStack) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(PatternFlowMplsBottomOfStackChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation can provide a system generated -// value for this property. If the OTG is unable to generate a value -// the default value must be used. -// Auto returns a uint32 -func (obj *patternFlowMplsBottomOfStack) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Increment returns a PatternFlowMplsBottomOfStackCounter -func (obj *patternFlowMplsBottomOfStack) Increment() PatternFlowMplsBottomOfStackCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowMplsBottomOfStackChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowMplsBottomOfStackCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowMplsBottomOfStackCounter -func (obj *patternFlowMplsBottomOfStack) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowMplsBottomOfStackCounter value in the PatternFlowMplsBottomOfStack object -func (obj *patternFlowMplsBottomOfStack) SetIncrement(value PatternFlowMplsBottomOfStackCounter) PatternFlowMplsBottomOfStack { - obj.setChoice(PatternFlowMplsBottomOfStackChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowMplsBottomOfStackCounter -func (obj *patternFlowMplsBottomOfStack) Decrement() PatternFlowMplsBottomOfStackCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowMplsBottomOfStackChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowMplsBottomOfStackCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowMplsBottomOfStackCounter -func (obj *patternFlowMplsBottomOfStack) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowMplsBottomOfStackCounter value in the PatternFlowMplsBottomOfStack object -func (obj *patternFlowMplsBottomOfStack) SetDecrement(value PatternFlowMplsBottomOfStackCounter) PatternFlowMplsBottomOfStack { - obj.setChoice(PatternFlowMplsBottomOfStackChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowMplsBottomOfStackMetricTag -func (obj *patternFlowMplsBottomOfStack) MetricTags() PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowMplsBottomOfStackMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter struct { - obj *patternFlowMplsBottomOfStack - patternFlowMplsBottomOfStackMetricTagSlice []PatternFlowMplsBottomOfStackMetricTag - fieldPtr *[]*otg.PatternFlowMplsBottomOfStackMetricTag -} - -func newPatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter(ptr *[]*otg.PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { - return &patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter interface { - setMsg(*patternFlowMplsBottomOfStack) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter - Items() []PatternFlowMplsBottomOfStackMetricTag - Add() PatternFlowMplsBottomOfStackMetricTag - Append(items ...PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter - Set(index int, newObj PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter - Clear() PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter - clearHolderSlice() PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter - appendHolderSlice(item PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter -} - -func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) setMsg(msg *patternFlowMplsBottomOfStack) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowMplsBottomOfStackMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) Items() []PatternFlowMplsBottomOfStackMetricTag { - return obj.patternFlowMplsBottomOfStackMetricTagSlice -} - -func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) Add() PatternFlowMplsBottomOfStackMetricTag { - newObj := &otg.PatternFlowMplsBottomOfStackMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowMplsBottomOfStackMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowMplsBottomOfStackMetricTagSlice = append(obj.patternFlowMplsBottomOfStackMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) Append(items ...PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowMplsBottomOfStackMetricTagSlice = append(obj.patternFlowMplsBottomOfStackMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) Set(index int, newObj PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowMplsBottomOfStackMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) Clear() PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowMplsBottomOfStackMetricTag{} - obj.patternFlowMplsBottomOfStackMetricTagSlice = []PatternFlowMplsBottomOfStackMetricTag{} - } - return obj -} -func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) clearHolderSlice() PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { - if len(obj.patternFlowMplsBottomOfStackMetricTagSlice) > 0 { - obj.patternFlowMplsBottomOfStackMetricTagSlice = []PatternFlowMplsBottomOfStackMetricTag{} - } - return obj -} -func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) appendHolderSlice(item PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { - obj.patternFlowMplsBottomOfStackMetricTagSlice = append(obj.patternFlowMplsBottomOfStackMetricTagSlice, item) - return obj -} - -func (obj *patternFlowMplsBottomOfStack) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsBottomOfStack.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowMplsBottomOfStack.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Auto != nil { - - if *obj.obj.Auto > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsBottomOfStack.Auto <= 1 but Got %d", *obj.obj.Auto)) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowMplsBottomOfStackMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowMplsBottomOfStack) setDefault() { - var choices_set int = 0 - var choice PatternFlowMplsBottomOfStackChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowMplsBottomOfStackChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowMplsBottomOfStackChoice.VALUES - } - - if obj.obj.Auto != nil { - choices_set += 1 - choice = PatternFlowMplsBottomOfStackChoice.AUTO - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowMplsBottomOfStackChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowMplsBottomOfStackChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowMplsBottomOfStackChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowMplsBottomOfStack") - } - } else { - intVal := otg.PatternFlowMplsBottomOfStack_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowMplsBottomOfStack_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowMplsTimeToLive ***** -type patternFlowMplsTimeToLive struct { - validation - obj *otg.PatternFlowMplsTimeToLive - marshaller marshalPatternFlowMplsTimeToLive - unMarshaller unMarshalPatternFlowMplsTimeToLive - incrementHolder PatternFlowMplsTimeToLiveCounter - decrementHolder PatternFlowMplsTimeToLiveCounter - metricTagsHolder PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter -} - -func NewPatternFlowMplsTimeToLive() PatternFlowMplsTimeToLive { - obj := patternFlowMplsTimeToLive{obj: &otg.PatternFlowMplsTimeToLive{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowMplsTimeToLive) msg() *otg.PatternFlowMplsTimeToLive { - return obj.obj -} - -func (obj *patternFlowMplsTimeToLive) setMsg(msg *otg.PatternFlowMplsTimeToLive) PatternFlowMplsTimeToLive { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowMplsTimeToLive struct { - obj *patternFlowMplsTimeToLive -} - -type marshalPatternFlowMplsTimeToLive interface { - // ToProto marshals PatternFlowMplsTimeToLive to protobuf object *otg.PatternFlowMplsTimeToLive - ToProto() (*otg.PatternFlowMplsTimeToLive, error) - // ToPbText marshals PatternFlowMplsTimeToLive to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowMplsTimeToLive to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowMplsTimeToLive to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowMplsTimeToLive struct { - obj *patternFlowMplsTimeToLive -} - -type unMarshalPatternFlowMplsTimeToLive interface { - // FromProto unmarshals PatternFlowMplsTimeToLive from protobuf object *otg.PatternFlowMplsTimeToLive - FromProto(msg *otg.PatternFlowMplsTimeToLive) (PatternFlowMplsTimeToLive, error) - // FromPbText unmarshals PatternFlowMplsTimeToLive from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowMplsTimeToLive from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowMplsTimeToLive from JSON text - FromJson(value string) error -} - -func (obj *patternFlowMplsTimeToLive) Marshal() marshalPatternFlowMplsTimeToLive { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowMplsTimeToLive{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowMplsTimeToLive) Unmarshal() unMarshalPatternFlowMplsTimeToLive { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowMplsTimeToLive{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowMplsTimeToLive) ToProto() (*otg.PatternFlowMplsTimeToLive, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowMplsTimeToLive) FromProto(msg *otg.PatternFlowMplsTimeToLive) (PatternFlowMplsTimeToLive, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowMplsTimeToLive) 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 *unMarshalpatternFlowMplsTimeToLive) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowMplsTimeToLive) 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 *unMarshalpatternFlowMplsTimeToLive) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowMplsTimeToLive) 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 *unMarshalpatternFlowMplsTimeToLive) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowMplsTimeToLive) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowMplsTimeToLive) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowMplsTimeToLive) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowMplsTimeToLive) Clone() (PatternFlowMplsTimeToLive, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowMplsTimeToLive() - 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 -} - -func (obj *patternFlowMplsTimeToLive) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowMplsTimeToLive is time to live -type PatternFlowMplsTimeToLive interface { - Validation - // msg marshals PatternFlowMplsTimeToLive to protobuf object *otg.PatternFlowMplsTimeToLive - // and doesn't set defaults - msg() *otg.PatternFlowMplsTimeToLive - // setMsg unmarshals PatternFlowMplsTimeToLive from protobuf object *otg.PatternFlowMplsTimeToLive - // and doesn't set defaults - setMsg(*otg.PatternFlowMplsTimeToLive) PatternFlowMplsTimeToLive - // provides marshal interface - Marshal() marshalPatternFlowMplsTimeToLive - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowMplsTimeToLive - // validate validates PatternFlowMplsTimeToLive - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowMplsTimeToLive, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowMplsTimeToLiveChoiceEnum, set in PatternFlowMplsTimeToLive - Choice() PatternFlowMplsTimeToLiveChoiceEnum - // setChoice assigns PatternFlowMplsTimeToLiveChoiceEnum provided by user to PatternFlowMplsTimeToLive - setChoice(value PatternFlowMplsTimeToLiveChoiceEnum) PatternFlowMplsTimeToLive - // HasChoice checks if Choice has been set in PatternFlowMplsTimeToLive - HasChoice() bool - // Value returns uint32, set in PatternFlowMplsTimeToLive. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowMplsTimeToLive - SetValue(value uint32) PatternFlowMplsTimeToLive - // HasValue checks if Value has been set in PatternFlowMplsTimeToLive - HasValue() bool - // Values returns []uint32, set in PatternFlowMplsTimeToLive. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowMplsTimeToLive - SetValues(value []uint32) PatternFlowMplsTimeToLive - // Increment returns PatternFlowMplsTimeToLiveCounter, set in PatternFlowMplsTimeToLive. - // PatternFlowMplsTimeToLiveCounter is integer counter pattern - Increment() PatternFlowMplsTimeToLiveCounter - // SetIncrement assigns PatternFlowMplsTimeToLiveCounter provided by user to PatternFlowMplsTimeToLive. - // PatternFlowMplsTimeToLiveCounter is integer counter pattern - SetIncrement(value PatternFlowMplsTimeToLiveCounter) PatternFlowMplsTimeToLive - // HasIncrement checks if Increment has been set in PatternFlowMplsTimeToLive - HasIncrement() bool - // Decrement returns PatternFlowMplsTimeToLiveCounter, set in PatternFlowMplsTimeToLive. - // PatternFlowMplsTimeToLiveCounter is integer counter pattern - Decrement() PatternFlowMplsTimeToLiveCounter - // SetDecrement assigns PatternFlowMplsTimeToLiveCounter provided by user to PatternFlowMplsTimeToLive. - // PatternFlowMplsTimeToLiveCounter is integer counter pattern - SetDecrement(value PatternFlowMplsTimeToLiveCounter) PatternFlowMplsTimeToLive - // HasDecrement checks if Decrement has been set in PatternFlowMplsTimeToLive - HasDecrement() bool - // MetricTags returns PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIterIter, set in PatternFlowMplsTimeToLive - MetricTags() PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter - setNil() -} - -type PatternFlowMplsTimeToLiveChoiceEnum string - -// Enum of Choice on PatternFlowMplsTimeToLive -var PatternFlowMplsTimeToLiveChoice = struct { - VALUE PatternFlowMplsTimeToLiveChoiceEnum - VALUES PatternFlowMplsTimeToLiveChoiceEnum - INCREMENT PatternFlowMplsTimeToLiveChoiceEnum - DECREMENT PatternFlowMplsTimeToLiveChoiceEnum -}{ - VALUE: PatternFlowMplsTimeToLiveChoiceEnum("value"), - VALUES: PatternFlowMplsTimeToLiveChoiceEnum("values"), - INCREMENT: PatternFlowMplsTimeToLiveChoiceEnum("increment"), - DECREMENT: PatternFlowMplsTimeToLiveChoiceEnum("decrement"), -} - -func (obj *patternFlowMplsTimeToLive) Choice() PatternFlowMplsTimeToLiveChoiceEnum { - return PatternFlowMplsTimeToLiveChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowMplsTimeToLive) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowMplsTimeToLive) setChoice(value PatternFlowMplsTimeToLiveChoiceEnum) PatternFlowMplsTimeToLive { - intValue, ok := otg.PatternFlowMplsTimeToLive_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowMplsTimeToLiveChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowMplsTimeToLive_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowMplsTimeToLiveChoice.VALUE { - defaultValue := uint32(64) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowMplsTimeToLiveChoice.VALUES { - defaultValue := []uint32{64} - obj.obj.Values = defaultValue - } - - if value == PatternFlowMplsTimeToLiveChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowMplsTimeToLiveCounter().msg() - } - - if value == PatternFlowMplsTimeToLiveChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowMplsTimeToLiveCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowMplsTimeToLive) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowMplsTimeToLiveChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowMplsTimeToLive) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowMplsTimeToLive object -func (obj *patternFlowMplsTimeToLive) SetValue(value uint32) PatternFlowMplsTimeToLive { - obj.setChoice(PatternFlowMplsTimeToLiveChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowMplsTimeToLive) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{64}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowMplsTimeToLive object -func (obj *patternFlowMplsTimeToLive) SetValues(value []uint32) PatternFlowMplsTimeToLive { - obj.setChoice(PatternFlowMplsTimeToLiveChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowMplsTimeToLiveCounter -func (obj *patternFlowMplsTimeToLive) Increment() PatternFlowMplsTimeToLiveCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowMplsTimeToLiveChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowMplsTimeToLiveCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowMplsTimeToLiveCounter -func (obj *patternFlowMplsTimeToLive) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowMplsTimeToLiveCounter value in the PatternFlowMplsTimeToLive object -func (obj *patternFlowMplsTimeToLive) SetIncrement(value PatternFlowMplsTimeToLiveCounter) PatternFlowMplsTimeToLive { - obj.setChoice(PatternFlowMplsTimeToLiveChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowMplsTimeToLiveCounter -func (obj *patternFlowMplsTimeToLive) Decrement() PatternFlowMplsTimeToLiveCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowMplsTimeToLiveChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowMplsTimeToLiveCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowMplsTimeToLiveCounter -func (obj *patternFlowMplsTimeToLive) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowMplsTimeToLiveCounter value in the PatternFlowMplsTimeToLive object -func (obj *patternFlowMplsTimeToLive) SetDecrement(value PatternFlowMplsTimeToLiveCounter) PatternFlowMplsTimeToLive { - obj.setChoice(PatternFlowMplsTimeToLiveChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowMplsTimeToLiveMetricTag -func (obj *patternFlowMplsTimeToLive) MetricTags() PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowMplsTimeToLiveMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter struct { - obj *patternFlowMplsTimeToLive - patternFlowMplsTimeToLiveMetricTagSlice []PatternFlowMplsTimeToLiveMetricTag - fieldPtr *[]*otg.PatternFlowMplsTimeToLiveMetricTag -} - -func newPatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter(ptr *[]*otg.PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { - return &patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter interface { - setMsg(*patternFlowMplsTimeToLive) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter - Items() []PatternFlowMplsTimeToLiveMetricTag - Add() PatternFlowMplsTimeToLiveMetricTag - Append(items ...PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter - Set(index int, newObj PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter - Clear() PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter - clearHolderSlice() PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter - appendHolderSlice(item PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter -} - -func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) setMsg(msg *patternFlowMplsTimeToLive) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowMplsTimeToLiveMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) Items() []PatternFlowMplsTimeToLiveMetricTag { - return obj.patternFlowMplsTimeToLiveMetricTagSlice -} - -func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) Add() PatternFlowMplsTimeToLiveMetricTag { - newObj := &otg.PatternFlowMplsTimeToLiveMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowMplsTimeToLiveMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowMplsTimeToLiveMetricTagSlice = append(obj.patternFlowMplsTimeToLiveMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) Append(items ...PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowMplsTimeToLiveMetricTagSlice = append(obj.patternFlowMplsTimeToLiveMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) Set(index int, newObj PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowMplsTimeToLiveMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) Clear() PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowMplsTimeToLiveMetricTag{} - obj.patternFlowMplsTimeToLiveMetricTagSlice = []PatternFlowMplsTimeToLiveMetricTag{} - } - return obj -} -func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) clearHolderSlice() PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { - if len(obj.patternFlowMplsTimeToLiveMetricTagSlice) > 0 { - obj.patternFlowMplsTimeToLiveMetricTagSlice = []PatternFlowMplsTimeToLiveMetricTag{} - } - return obj -} -func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) appendHolderSlice(item PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { - obj.patternFlowMplsTimeToLiveMetricTagSlice = append(obj.patternFlowMplsTimeToLiveMetricTagSlice, item) - return obj -} - -func (obj *patternFlowMplsTimeToLive) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsTimeToLive.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowMplsTimeToLive.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowMplsTimeToLiveMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowMplsTimeToLive) setDefault() { - var choices_set int = 0 - var choice PatternFlowMplsTimeToLiveChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowMplsTimeToLiveChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowMplsTimeToLiveChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowMplsTimeToLiveChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowMplsTimeToLiveChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowMplsTimeToLiveChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowMplsTimeToLive") - } - } else { - intVal := otg.PatternFlowMplsTimeToLive_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowMplsTimeToLive_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowSnmpv2CVersion ***** -type patternFlowSnmpv2CVersion struct { - validation - obj *otg.PatternFlowSnmpv2CVersion - marshaller marshalPatternFlowSnmpv2CVersion - unMarshaller unMarshalPatternFlowSnmpv2CVersion - incrementHolder PatternFlowSnmpv2CVersionCounter - decrementHolder PatternFlowSnmpv2CVersionCounter -} - -func NewPatternFlowSnmpv2CVersion() PatternFlowSnmpv2CVersion { - obj := patternFlowSnmpv2CVersion{obj: &otg.PatternFlowSnmpv2CVersion{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CVersion) msg() *otg.PatternFlowSnmpv2CVersion { - return obj.obj -} - -func (obj *patternFlowSnmpv2CVersion) setMsg(msg *otg.PatternFlowSnmpv2CVersion) PatternFlowSnmpv2CVersion { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CVersion struct { - obj *patternFlowSnmpv2CVersion -} - -type marshalPatternFlowSnmpv2CVersion interface { - // ToProto marshals PatternFlowSnmpv2CVersion to protobuf object *otg.PatternFlowSnmpv2CVersion - ToProto() (*otg.PatternFlowSnmpv2CVersion, error) - // ToPbText marshals PatternFlowSnmpv2CVersion to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CVersion to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CVersion to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CVersion struct { - obj *patternFlowSnmpv2CVersion -} - -type unMarshalPatternFlowSnmpv2CVersion interface { - // FromProto unmarshals PatternFlowSnmpv2CVersion from protobuf object *otg.PatternFlowSnmpv2CVersion - FromProto(msg *otg.PatternFlowSnmpv2CVersion) (PatternFlowSnmpv2CVersion, error) - // FromPbText unmarshals PatternFlowSnmpv2CVersion from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CVersion from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CVersion from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CVersion) Marshal() marshalPatternFlowSnmpv2CVersion { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CVersion{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CVersion) Unmarshal() unMarshalPatternFlowSnmpv2CVersion { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVersion{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CVersion) ToProto() (*otg.PatternFlowSnmpv2CVersion, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CVersion) FromProto(msg *otg.PatternFlowSnmpv2CVersion) (PatternFlowSnmpv2CVersion, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CVersion) 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 *unMarshalpatternFlowSnmpv2CVersion) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowSnmpv2CVersion) 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 *unMarshalpatternFlowSnmpv2CVersion) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowSnmpv2CVersion) 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 *unMarshalpatternFlowSnmpv2CVersion) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowSnmpv2CVersion) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVersion) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVersion) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CVersion) Clone() (PatternFlowSnmpv2CVersion, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CVersion() - 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 -} - -func (obj *patternFlowSnmpv2CVersion) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowSnmpv2CVersion is version -type PatternFlowSnmpv2CVersion interface { - Validation - // msg marshals PatternFlowSnmpv2CVersion to protobuf object *otg.PatternFlowSnmpv2CVersion - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CVersion - // setMsg unmarshals PatternFlowSnmpv2CVersion from protobuf object *otg.PatternFlowSnmpv2CVersion - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CVersion) PatternFlowSnmpv2CVersion - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CVersion - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CVersion - // validate validates PatternFlowSnmpv2CVersion - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CVersion, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowSnmpv2CVersionChoiceEnum, set in PatternFlowSnmpv2CVersion - Choice() PatternFlowSnmpv2CVersionChoiceEnum - // setChoice assigns PatternFlowSnmpv2CVersionChoiceEnum provided by user to PatternFlowSnmpv2CVersion - setChoice(value PatternFlowSnmpv2CVersionChoiceEnum) PatternFlowSnmpv2CVersion - // HasChoice checks if Choice has been set in PatternFlowSnmpv2CVersion - HasChoice() bool - // Value returns uint32, set in PatternFlowSnmpv2CVersion. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowSnmpv2CVersion - SetValue(value uint32) PatternFlowSnmpv2CVersion - // HasValue checks if Value has been set in PatternFlowSnmpv2CVersion - HasValue() bool - // Values returns []uint32, set in PatternFlowSnmpv2CVersion. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowSnmpv2CVersion - SetValues(value []uint32) PatternFlowSnmpv2CVersion - // Increment returns PatternFlowSnmpv2CVersionCounter, set in PatternFlowSnmpv2CVersion. - Increment() PatternFlowSnmpv2CVersionCounter - // SetIncrement assigns PatternFlowSnmpv2CVersionCounter provided by user to PatternFlowSnmpv2CVersion. - SetIncrement(value PatternFlowSnmpv2CVersionCounter) PatternFlowSnmpv2CVersion - // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CVersion - HasIncrement() bool - // Decrement returns PatternFlowSnmpv2CVersionCounter, set in PatternFlowSnmpv2CVersion. - Decrement() PatternFlowSnmpv2CVersionCounter - // SetDecrement assigns PatternFlowSnmpv2CVersionCounter provided by user to PatternFlowSnmpv2CVersion. - SetDecrement(value PatternFlowSnmpv2CVersionCounter) PatternFlowSnmpv2CVersion - // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CVersion - HasDecrement() bool - setNil() -} - -type PatternFlowSnmpv2CVersionChoiceEnum string - -// Enum of Choice on PatternFlowSnmpv2CVersion -var PatternFlowSnmpv2CVersionChoice = struct { - VALUE PatternFlowSnmpv2CVersionChoiceEnum - VALUES PatternFlowSnmpv2CVersionChoiceEnum - INCREMENT PatternFlowSnmpv2CVersionChoiceEnum - DECREMENT PatternFlowSnmpv2CVersionChoiceEnum -}{ - VALUE: PatternFlowSnmpv2CVersionChoiceEnum("value"), - VALUES: PatternFlowSnmpv2CVersionChoiceEnum("values"), - INCREMENT: PatternFlowSnmpv2CVersionChoiceEnum("increment"), - DECREMENT: PatternFlowSnmpv2CVersionChoiceEnum("decrement"), -} - -func (obj *patternFlowSnmpv2CVersion) Choice() PatternFlowSnmpv2CVersionChoiceEnum { - return PatternFlowSnmpv2CVersionChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowSnmpv2CVersion) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowSnmpv2CVersion) setChoice(value PatternFlowSnmpv2CVersionChoiceEnum) PatternFlowSnmpv2CVersion { - intValue, ok := otg.PatternFlowSnmpv2CVersion_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowSnmpv2CVersionChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowSnmpv2CVersion_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowSnmpv2CVersionChoice.VALUE { - defaultValue := uint32(1) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowSnmpv2CVersionChoice.VALUES { - defaultValue := []uint32{1} - obj.obj.Values = defaultValue - } - - if value == PatternFlowSnmpv2CVersionChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowSnmpv2CVersionCounter().msg() - } - - if value == PatternFlowSnmpv2CVersionChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowSnmpv2CVersionCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowSnmpv2CVersion) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowSnmpv2CVersionChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowSnmpv2CVersion) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowSnmpv2CVersion object -func (obj *patternFlowSnmpv2CVersion) SetValue(value uint32) PatternFlowSnmpv2CVersion { - obj.setChoice(PatternFlowSnmpv2CVersionChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowSnmpv2CVersion) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{1}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowSnmpv2CVersion object -func (obj *patternFlowSnmpv2CVersion) SetValues(value []uint32) PatternFlowSnmpv2CVersion { - obj.setChoice(PatternFlowSnmpv2CVersionChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CVersionCounter -func (obj *patternFlowSnmpv2CVersion) Increment() PatternFlowSnmpv2CVersionCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowSnmpv2CVersionChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowSnmpv2CVersionCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CVersionCounter -func (obj *patternFlowSnmpv2CVersion) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowSnmpv2CVersionCounter value in the PatternFlowSnmpv2CVersion object -func (obj *patternFlowSnmpv2CVersion) SetIncrement(value PatternFlowSnmpv2CVersionCounter) PatternFlowSnmpv2CVersion { - obj.setChoice(PatternFlowSnmpv2CVersionChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CVersionCounter -func (obj *patternFlowSnmpv2CVersion) Decrement() PatternFlowSnmpv2CVersionCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowSnmpv2CVersionChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowSnmpv2CVersionCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CVersionCounter -func (obj *patternFlowSnmpv2CVersion) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowSnmpv2CVersionCounter value in the PatternFlowSnmpv2CVersion object -func (obj *patternFlowSnmpv2CVersion) SetDecrement(value PatternFlowSnmpv2CVersionCounter) PatternFlowSnmpv2CVersion { - obj.setChoice(PatternFlowSnmpv2CVersionChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowSnmpv2CVersion) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowSnmpv2CVersion.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowSnmpv2CVersion.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowSnmpv2CVersion) setDefault() { - var choices_set int = 0 - var choice PatternFlowSnmpv2CVersionChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVersionChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowSnmpv2CVersionChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVersionChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVersionChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowSnmpv2CVersionChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CVersion") - } - } else { - intVal := otg.PatternFlowSnmpv2CVersion_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowSnmpv2CVersion_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowSnmpv2CData ***** -type flowSnmpv2CData struct { - validation - obj *otg.FlowSnmpv2CData - marshaller marshalFlowSnmpv2CData - unMarshaller unMarshalFlowSnmpv2CData - getRequestHolder FlowSnmpv2CPDU - getNextRequestHolder FlowSnmpv2CPDU - responseHolder FlowSnmpv2CPDU - setRequestHolder FlowSnmpv2CPDU - getBulkRequestHolder FlowSnmpv2CBulkPDU - informRequestHolder FlowSnmpv2CPDU - snmpv2TrapHolder FlowSnmpv2CPDU - reportHolder FlowSnmpv2CPDU -} - -func NewFlowSnmpv2CData() FlowSnmpv2CData { - obj := flowSnmpv2CData{obj: &otg.FlowSnmpv2CData{}} - obj.setDefault() - return &obj -} - -func (obj *flowSnmpv2CData) msg() *otg.FlowSnmpv2CData { - return obj.obj -} - -func (obj *flowSnmpv2CData) setMsg(msg *otg.FlowSnmpv2CData) FlowSnmpv2CData { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowSnmpv2CData struct { - obj *flowSnmpv2CData -} - -type marshalFlowSnmpv2CData interface { - // ToProto marshals FlowSnmpv2CData to protobuf object *otg.FlowSnmpv2CData - ToProto() (*otg.FlowSnmpv2CData, error) - // ToPbText marshals FlowSnmpv2CData to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowSnmpv2CData to YAML text - ToYaml() (string, error) - // ToJson marshals FlowSnmpv2CData to JSON text - ToJson() (string, error) -} - -type unMarshalflowSnmpv2CData struct { - obj *flowSnmpv2CData -} - -type unMarshalFlowSnmpv2CData interface { - // FromProto unmarshals FlowSnmpv2CData from protobuf object *otg.FlowSnmpv2CData - FromProto(msg *otg.FlowSnmpv2CData) (FlowSnmpv2CData, error) - // FromPbText unmarshals FlowSnmpv2CData from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowSnmpv2CData from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowSnmpv2CData from JSON text - FromJson(value string) error -} - -func (obj *flowSnmpv2CData) Marshal() marshalFlowSnmpv2CData { - if obj.marshaller == nil { - obj.marshaller = &marshalflowSnmpv2CData{obj: obj} - } - return obj.marshaller -} - -func (obj *flowSnmpv2CData) Unmarshal() unMarshalFlowSnmpv2CData { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowSnmpv2CData{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowSnmpv2CData) ToProto() (*otg.FlowSnmpv2CData, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowSnmpv2CData) FromProto(msg *otg.FlowSnmpv2CData) (FlowSnmpv2CData, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowSnmpv2CData) 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 *unMarshalflowSnmpv2CData) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowSnmpv2CData) 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 *unMarshalflowSnmpv2CData) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowSnmpv2CData) 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 *unMarshalflowSnmpv2CData) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowSnmpv2CData) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowSnmpv2CData) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowSnmpv2CData) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowSnmpv2CData) Clone() (FlowSnmpv2CData, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowSnmpv2CData() - 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 -} - -func (obj *flowSnmpv2CData) setNil() { - obj.getRequestHolder = nil - obj.getNextRequestHolder = nil - obj.responseHolder = nil - obj.setRequestHolder = nil - obj.getBulkRequestHolder = nil - obj.informRequestHolder = nil - obj.snmpv2TrapHolder = nil - obj.reportHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowSnmpv2CData is this contains the body of the SNMPv2C message. -// -// - Encoding of subsequent fields follow ASN.1 specification. -// Refer: http://www.itu.int/ITU-T/asn1 -type FlowSnmpv2CData interface { - Validation - // msg marshals FlowSnmpv2CData to protobuf object *otg.FlowSnmpv2CData - // and doesn't set defaults - msg() *otg.FlowSnmpv2CData - // setMsg unmarshals FlowSnmpv2CData from protobuf object *otg.FlowSnmpv2CData - // and doesn't set defaults - setMsg(*otg.FlowSnmpv2CData) FlowSnmpv2CData - // provides marshal interface - Marshal() marshalFlowSnmpv2CData - // provides unmarshal interface - Unmarshal() unMarshalFlowSnmpv2CData - // validate validates FlowSnmpv2CData - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowSnmpv2CData, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowSnmpv2CDataChoiceEnum, set in FlowSnmpv2CData - Choice() FlowSnmpv2CDataChoiceEnum - // setChoice assigns FlowSnmpv2CDataChoiceEnum provided by user to FlowSnmpv2CData - setChoice(value FlowSnmpv2CDataChoiceEnum) FlowSnmpv2CData - // GetRequest returns FlowSnmpv2CPDU, set in FlowSnmpv2CData. - GetRequest() FlowSnmpv2CPDU - // SetGetRequest assigns FlowSnmpv2CPDU provided by user to FlowSnmpv2CData. - SetGetRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData - // HasGetRequest checks if GetRequest has been set in FlowSnmpv2CData - HasGetRequest() bool - // GetNextRequest returns FlowSnmpv2CPDU, set in FlowSnmpv2CData. - GetNextRequest() FlowSnmpv2CPDU - // SetGetNextRequest assigns FlowSnmpv2CPDU provided by user to FlowSnmpv2CData. - SetGetNextRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData - // HasGetNextRequest checks if GetNextRequest has been set in FlowSnmpv2CData - HasGetNextRequest() bool - // Response returns FlowSnmpv2CPDU, set in FlowSnmpv2CData. - Response() FlowSnmpv2CPDU - // SetResponse assigns FlowSnmpv2CPDU provided by user to FlowSnmpv2CData. - SetResponse(value FlowSnmpv2CPDU) FlowSnmpv2CData - // HasResponse checks if Response has been set in FlowSnmpv2CData - HasResponse() bool - // SetRequest returns FlowSnmpv2CPDU, set in FlowSnmpv2CData. - SetRequest() FlowSnmpv2CPDU - // SetSetRequest assigns FlowSnmpv2CPDU provided by user to FlowSnmpv2CData. - SetSetRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData - // HasSetRequest checks if SetRequest has been set in FlowSnmpv2CData - HasSetRequest() bool - // GetBulkRequest returns FlowSnmpv2CBulkPDU, set in FlowSnmpv2CData. - GetBulkRequest() FlowSnmpv2CBulkPDU - // SetGetBulkRequest assigns FlowSnmpv2CBulkPDU provided by user to FlowSnmpv2CData. - SetGetBulkRequest(value FlowSnmpv2CBulkPDU) FlowSnmpv2CData - // HasGetBulkRequest checks if GetBulkRequest has been set in FlowSnmpv2CData - HasGetBulkRequest() bool - // InformRequest returns FlowSnmpv2CPDU, set in FlowSnmpv2CData. - InformRequest() FlowSnmpv2CPDU - // SetInformRequest assigns FlowSnmpv2CPDU provided by user to FlowSnmpv2CData. - SetInformRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData - // HasInformRequest checks if InformRequest has been set in FlowSnmpv2CData - HasInformRequest() bool - // Snmpv2Trap returns FlowSnmpv2CPDU, set in FlowSnmpv2CData. - Snmpv2Trap() FlowSnmpv2CPDU - // SetSnmpv2Trap assigns FlowSnmpv2CPDU provided by user to FlowSnmpv2CData. - SetSnmpv2Trap(value FlowSnmpv2CPDU) FlowSnmpv2CData - // HasSnmpv2Trap checks if Snmpv2Trap has been set in FlowSnmpv2CData - HasSnmpv2Trap() bool - // Report returns FlowSnmpv2CPDU, set in FlowSnmpv2CData. - Report() FlowSnmpv2CPDU - // SetReport assigns FlowSnmpv2CPDU provided by user to FlowSnmpv2CData. - SetReport(value FlowSnmpv2CPDU) FlowSnmpv2CData - // HasReport checks if Report has been set in FlowSnmpv2CData - HasReport() bool - setNil() -} - -type FlowSnmpv2CDataChoiceEnum string - -// Enum of Choice on FlowSnmpv2CData -var FlowSnmpv2CDataChoice = struct { - GET_REQUEST FlowSnmpv2CDataChoiceEnum - GET_NEXT_REQUEST FlowSnmpv2CDataChoiceEnum - RESPONSE FlowSnmpv2CDataChoiceEnum - SET_REQUEST FlowSnmpv2CDataChoiceEnum - GET_BULK_REQUEST FlowSnmpv2CDataChoiceEnum - INFORM_REQUEST FlowSnmpv2CDataChoiceEnum - SNMPV2_TRAP FlowSnmpv2CDataChoiceEnum - REPORT FlowSnmpv2CDataChoiceEnum -}{ - GET_REQUEST: FlowSnmpv2CDataChoiceEnum("get_request"), - GET_NEXT_REQUEST: FlowSnmpv2CDataChoiceEnum("get_next_request"), - RESPONSE: FlowSnmpv2CDataChoiceEnum("response"), - SET_REQUEST: FlowSnmpv2CDataChoiceEnum("set_request"), - GET_BULK_REQUEST: FlowSnmpv2CDataChoiceEnum("get_bulk_request"), - INFORM_REQUEST: FlowSnmpv2CDataChoiceEnum("inform_request"), - SNMPV2_TRAP: FlowSnmpv2CDataChoiceEnum("snmpv2_trap"), - REPORT: FlowSnmpv2CDataChoiceEnum("report"), -} - -func (obj *flowSnmpv2CData) Choice() FlowSnmpv2CDataChoiceEnum { - return FlowSnmpv2CDataChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *flowSnmpv2CData) setChoice(value FlowSnmpv2CDataChoiceEnum) FlowSnmpv2CData { - intValue, ok := otg.FlowSnmpv2CData_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowSnmpv2CDataChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowSnmpv2CData_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Report = nil - obj.reportHolder = nil - obj.obj.Snmpv2Trap = nil - obj.snmpv2TrapHolder = nil - obj.obj.InformRequest = nil - obj.informRequestHolder = nil - obj.obj.GetBulkRequest = nil - obj.getBulkRequestHolder = nil - obj.obj.SetRequest = nil - obj.setRequestHolder = nil - obj.obj.Response = nil - obj.responseHolder = nil - obj.obj.GetNextRequest = nil - obj.getNextRequestHolder = nil - obj.obj.GetRequest = nil - obj.getRequestHolder = nil - - if value == FlowSnmpv2CDataChoice.GET_REQUEST { - obj.obj.GetRequest = NewFlowSnmpv2CPDU().msg() - } - - if value == FlowSnmpv2CDataChoice.GET_NEXT_REQUEST { - obj.obj.GetNextRequest = NewFlowSnmpv2CPDU().msg() - } - - if value == FlowSnmpv2CDataChoice.RESPONSE { - obj.obj.Response = NewFlowSnmpv2CPDU().msg() - } - - if value == FlowSnmpv2CDataChoice.SET_REQUEST { - obj.obj.SetRequest = NewFlowSnmpv2CPDU().msg() - } - - if value == FlowSnmpv2CDataChoice.GET_BULK_REQUEST { - obj.obj.GetBulkRequest = NewFlowSnmpv2CBulkPDU().msg() - } - - if value == FlowSnmpv2CDataChoice.INFORM_REQUEST { - obj.obj.InformRequest = NewFlowSnmpv2CPDU().msg() - } - - if value == FlowSnmpv2CDataChoice.SNMPV2_TRAP { - obj.obj.Snmpv2Trap = NewFlowSnmpv2CPDU().msg() - } - - if value == FlowSnmpv2CDataChoice.REPORT { - obj.obj.Report = NewFlowSnmpv2CPDU().msg() - } - - return obj -} - -// description is TBD -// GetRequest returns a FlowSnmpv2CPDU -func (obj *flowSnmpv2CData) GetRequest() FlowSnmpv2CPDU { - if obj.obj.GetRequest == nil { - obj.setChoice(FlowSnmpv2CDataChoice.GET_REQUEST) - } - if obj.getRequestHolder == nil { - obj.getRequestHolder = &flowSnmpv2CPDU{obj: obj.obj.GetRequest} - } - return obj.getRequestHolder -} - -// description is TBD -// GetRequest returns a FlowSnmpv2CPDU -func (obj *flowSnmpv2CData) HasGetRequest() bool { - return obj.obj.GetRequest != nil -} - -// description is TBD -// SetGetRequest sets the FlowSnmpv2CPDU value in the FlowSnmpv2CData object -func (obj *flowSnmpv2CData) SetGetRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData { - obj.setChoice(FlowSnmpv2CDataChoice.GET_REQUEST) - obj.getRequestHolder = nil - obj.obj.GetRequest = value.msg() - - return obj -} - -// description is TBD -// GetNextRequest returns a FlowSnmpv2CPDU -func (obj *flowSnmpv2CData) GetNextRequest() FlowSnmpv2CPDU { - if obj.obj.GetNextRequest == nil { - obj.setChoice(FlowSnmpv2CDataChoice.GET_NEXT_REQUEST) - } - if obj.getNextRequestHolder == nil { - obj.getNextRequestHolder = &flowSnmpv2CPDU{obj: obj.obj.GetNextRequest} - } - return obj.getNextRequestHolder -} - -// description is TBD -// GetNextRequest returns a FlowSnmpv2CPDU -func (obj *flowSnmpv2CData) HasGetNextRequest() bool { - return obj.obj.GetNextRequest != nil -} - -// description is TBD -// SetGetNextRequest sets the FlowSnmpv2CPDU value in the FlowSnmpv2CData object -func (obj *flowSnmpv2CData) SetGetNextRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData { - obj.setChoice(FlowSnmpv2CDataChoice.GET_NEXT_REQUEST) - obj.getNextRequestHolder = nil - obj.obj.GetNextRequest = value.msg() - - return obj -} - -// description is TBD -// Response returns a FlowSnmpv2CPDU -func (obj *flowSnmpv2CData) Response() FlowSnmpv2CPDU { - if obj.obj.Response == nil { - obj.setChoice(FlowSnmpv2CDataChoice.RESPONSE) - } - if obj.responseHolder == nil { - obj.responseHolder = &flowSnmpv2CPDU{obj: obj.obj.Response} - } - return obj.responseHolder -} - -// description is TBD -// Response returns a FlowSnmpv2CPDU -func (obj *flowSnmpv2CData) HasResponse() bool { - return obj.obj.Response != nil -} - -// description is TBD -// SetResponse sets the FlowSnmpv2CPDU value in the FlowSnmpv2CData object -func (obj *flowSnmpv2CData) SetResponse(value FlowSnmpv2CPDU) FlowSnmpv2CData { - obj.setChoice(FlowSnmpv2CDataChoice.RESPONSE) - obj.responseHolder = nil - obj.obj.Response = value.msg() - - return obj -} - -// description is TBD -// SetRequest returns a FlowSnmpv2CPDU -func (obj *flowSnmpv2CData) SetRequest() FlowSnmpv2CPDU { - if obj.obj.SetRequest == nil { - obj.setChoice(FlowSnmpv2CDataChoice.SET_REQUEST) - } - if obj.setRequestHolder == nil { - obj.setRequestHolder = &flowSnmpv2CPDU{obj: obj.obj.SetRequest} - } - return obj.setRequestHolder -} - -// description is TBD -// SetRequest returns a FlowSnmpv2CPDU -func (obj *flowSnmpv2CData) HasSetRequest() bool { - return obj.obj.SetRequest != nil -} - -// description is TBD -// SetSetRequest sets the FlowSnmpv2CPDU value in the FlowSnmpv2CData object -func (obj *flowSnmpv2CData) SetSetRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData { - obj.setChoice(FlowSnmpv2CDataChoice.SET_REQUEST) - obj.setRequestHolder = nil - obj.obj.SetRequest = value.msg() - - return obj -} - -// description is TBD -// GetBulkRequest returns a FlowSnmpv2CBulkPDU -func (obj *flowSnmpv2CData) GetBulkRequest() FlowSnmpv2CBulkPDU { - if obj.obj.GetBulkRequest == nil { - obj.setChoice(FlowSnmpv2CDataChoice.GET_BULK_REQUEST) - } - if obj.getBulkRequestHolder == nil { - obj.getBulkRequestHolder = &flowSnmpv2CBulkPDU{obj: obj.obj.GetBulkRequest} - } - return obj.getBulkRequestHolder -} - -// description is TBD -// GetBulkRequest returns a FlowSnmpv2CBulkPDU -func (obj *flowSnmpv2CData) HasGetBulkRequest() bool { - return obj.obj.GetBulkRequest != nil -} - -// description is TBD -// SetGetBulkRequest sets the FlowSnmpv2CBulkPDU value in the FlowSnmpv2CData object -func (obj *flowSnmpv2CData) SetGetBulkRequest(value FlowSnmpv2CBulkPDU) FlowSnmpv2CData { - obj.setChoice(FlowSnmpv2CDataChoice.GET_BULK_REQUEST) - obj.getBulkRequestHolder = nil - obj.obj.GetBulkRequest = value.msg() - - return obj -} - -// description is TBD -// InformRequest returns a FlowSnmpv2CPDU -func (obj *flowSnmpv2CData) InformRequest() FlowSnmpv2CPDU { - if obj.obj.InformRequest == nil { - obj.setChoice(FlowSnmpv2CDataChoice.INFORM_REQUEST) - } - if obj.informRequestHolder == nil { - obj.informRequestHolder = &flowSnmpv2CPDU{obj: obj.obj.InformRequest} - } - return obj.informRequestHolder -} - -// description is TBD -// InformRequest returns a FlowSnmpv2CPDU -func (obj *flowSnmpv2CData) HasInformRequest() bool { - return obj.obj.InformRequest != nil -} - -// description is TBD -// SetInformRequest sets the FlowSnmpv2CPDU value in the FlowSnmpv2CData object -func (obj *flowSnmpv2CData) SetInformRequest(value FlowSnmpv2CPDU) FlowSnmpv2CData { - obj.setChoice(FlowSnmpv2CDataChoice.INFORM_REQUEST) - obj.informRequestHolder = nil - obj.obj.InformRequest = value.msg() - - return obj -} - -// description is TBD -// Snmpv2Trap returns a FlowSnmpv2CPDU -func (obj *flowSnmpv2CData) Snmpv2Trap() FlowSnmpv2CPDU { - if obj.obj.Snmpv2Trap == nil { - obj.setChoice(FlowSnmpv2CDataChoice.SNMPV2_TRAP) - } - if obj.snmpv2TrapHolder == nil { - obj.snmpv2TrapHolder = &flowSnmpv2CPDU{obj: obj.obj.Snmpv2Trap} - } - return obj.snmpv2TrapHolder -} - -// description is TBD -// Snmpv2Trap returns a FlowSnmpv2CPDU -func (obj *flowSnmpv2CData) HasSnmpv2Trap() bool { - return obj.obj.Snmpv2Trap != nil -} - -// description is TBD -// SetSnmpv2Trap sets the FlowSnmpv2CPDU value in the FlowSnmpv2CData object -func (obj *flowSnmpv2CData) SetSnmpv2Trap(value FlowSnmpv2CPDU) FlowSnmpv2CData { - obj.setChoice(FlowSnmpv2CDataChoice.SNMPV2_TRAP) - obj.snmpv2TrapHolder = nil - obj.obj.Snmpv2Trap = value.msg() - - return obj -} - -// description is TBD -// Report returns a FlowSnmpv2CPDU -func (obj *flowSnmpv2CData) Report() FlowSnmpv2CPDU { - if obj.obj.Report == nil { - obj.setChoice(FlowSnmpv2CDataChoice.REPORT) - } - if obj.reportHolder == nil { - obj.reportHolder = &flowSnmpv2CPDU{obj: obj.obj.Report} - } - return obj.reportHolder -} - -// description is TBD -// Report returns a FlowSnmpv2CPDU -func (obj *flowSnmpv2CData) HasReport() bool { - return obj.obj.Report != nil -} - -// description is TBD -// SetReport sets the FlowSnmpv2CPDU value in the FlowSnmpv2CData object -func (obj *flowSnmpv2CData) SetReport(value FlowSnmpv2CPDU) FlowSnmpv2CData { - obj.setChoice(FlowSnmpv2CDataChoice.REPORT) - obj.reportHolder = nil - obj.obj.Report = value.msg() - - return obj -} - -func (obj *flowSnmpv2CData) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface FlowSnmpv2CData") - } - - if obj.obj.GetRequest != nil { - - obj.GetRequest().validateObj(vObj, set_default) - } - - if obj.obj.GetNextRequest != nil { - - obj.GetNextRequest().validateObj(vObj, set_default) - } - - if obj.obj.Response != nil { - - obj.Response().validateObj(vObj, set_default) - } - - if obj.obj.SetRequest != nil { - - obj.SetRequest().validateObj(vObj, set_default) - } - - if obj.obj.GetBulkRequest != nil { - - obj.GetBulkRequest().validateObj(vObj, set_default) - } - - if obj.obj.InformRequest != nil { - - obj.InformRequest().validateObj(vObj, set_default) - } - - if obj.obj.Snmpv2Trap != nil { - - obj.Snmpv2Trap().validateObj(vObj, set_default) - } - - if obj.obj.Report != nil { - - obj.Report().validateObj(vObj, set_default) - } - -} - -func (obj *flowSnmpv2CData) setDefault() { - var choices_set int = 0 - var choice FlowSnmpv2CDataChoiceEnum - - if obj.obj.GetRequest != nil { - choices_set += 1 - choice = FlowSnmpv2CDataChoice.GET_REQUEST - } - - if obj.obj.GetNextRequest != nil { - choices_set += 1 - choice = FlowSnmpv2CDataChoice.GET_NEXT_REQUEST - } - - if obj.obj.Response != nil { - choices_set += 1 - choice = FlowSnmpv2CDataChoice.RESPONSE - } - - if obj.obj.SetRequest != nil { - choices_set += 1 - choice = FlowSnmpv2CDataChoice.SET_REQUEST - } - - if obj.obj.GetBulkRequest != nil { - choices_set += 1 - choice = FlowSnmpv2CDataChoice.GET_BULK_REQUEST - } - - if obj.obj.InformRequest != nil { - choices_set += 1 - choice = FlowSnmpv2CDataChoice.INFORM_REQUEST - } - - if obj.obj.Snmpv2Trap != nil { - choices_set += 1 - choice = FlowSnmpv2CDataChoice.SNMPV2_TRAP - } - - if obj.obj.Report != nil { - choices_set += 1 - choice = FlowSnmpv2CDataChoice.REPORT - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowSnmpv2CData") - } - } else { - intVal := otg.FlowSnmpv2CData_Choice_Enum_value[string(choice)] - enumValue := otg.FlowSnmpv2CData_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRsvpRsvpChecksum ***** -type patternFlowRsvpRsvpChecksum struct { - validation - obj *otg.PatternFlowRsvpRsvpChecksum - marshaller marshalPatternFlowRsvpRsvpChecksum - unMarshaller unMarshalPatternFlowRsvpRsvpChecksum -} - -func NewPatternFlowRsvpRsvpChecksum() PatternFlowRsvpRsvpChecksum { - obj := patternFlowRsvpRsvpChecksum{obj: &otg.PatternFlowRsvpRsvpChecksum{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRsvpRsvpChecksum) msg() *otg.PatternFlowRsvpRsvpChecksum { - return obj.obj -} - -func (obj *patternFlowRsvpRsvpChecksum) setMsg(msg *otg.PatternFlowRsvpRsvpChecksum) PatternFlowRsvpRsvpChecksum { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRsvpRsvpChecksum struct { - obj *patternFlowRsvpRsvpChecksum -} - -type marshalPatternFlowRsvpRsvpChecksum interface { - // ToProto marshals PatternFlowRsvpRsvpChecksum to protobuf object *otg.PatternFlowRsvpRsvpChecksum - ToProto() (*otg.PatternFlowRsvpRsvpChecksum, error) - // ToPbText marshals PatternFlowRsvpRsvpChecksum to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRsvpRsvpChecksum to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRsvpRsvpChecksum to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRsvpRsvpChecksum struct { - obj *patternFlowRsvpRsvpChecksum -} - -type unMarshalPatternFlowRsvpRsvpChecksum interface { - // FromProto unmarshals PatternFlowRsvpRsvpChecksum from protobuf object *otg.PatternFlowRsvpRsvpChecksum - FromProto(msg *otg.PatternFlowRsvpRsvpChecksum) (PatternFlowRsvpRsvpChecksum, error) - // FromPbText unmarshals PatternFlowRsvpRsvpChecksum from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRsvpRsvpChecksum from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRsvpRsvpChecksum from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRsvpRsvpChecksum) Marshal() marshalPatternFlowRsvpRsvpChecksum { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRsvpRsvpChecksum{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRsvpRsvpChecksum) Unmarshal() unMarshalPatternFlowRsvpRsvpChecksum { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRsvpRsvpChecksum{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRsvpRsvpChecksum) ToProto() (*otg.PatternFlowRsvpRsvpChecksum, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRsvpRsvpChecksum) FromProto(msg *otg.PatternFlowRsvpRsvpChecksum) (PatternFlowRsvpRsvpChecksum, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRsvpRsvpChecksum) 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 *unMarshalpatternFlowRsvpRsvpChecksum) 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 *marshalpatternFlowRsvpRsvpChecksum) 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 *unMarshalpatternFlowRsvpRsvpChecksum) 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 *marshalpatternFlowRsvpRsvpChecksum) 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 *unMarshalpatternFlowRsvpRsvpChecksum) 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 *patternFlowRsvpRsvpChecksum) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRsvpRsvpChecksum) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRsvpRsvpChecksum) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRsvpRsvpChecksum) Clone() (PatternFlowRsvpRsvpChecksum, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRsvpRsvpChecksum() - 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 -} - -// PatternFlowRsvpRsvpChecksum is the one's complement of the one's complement sum of the message, with the checksum field replaced by zero for the purpose of computing the checksum. An all-zero value means that no checksum was transmitted. -type PatternFlowRsvpRsvpChecksum interface { - Validation - // msg marshals PatternFlowRsvpRsvpChecksum to protobuf object *otg.PatternFlowRsvpRsvpChecksum - // and doesn't set defaults - msg() *otg.PatternFlowRsvpRsvpChecksum - // setMsg unmarshals PatternFlowRsvpRsvpChecksum from protobuf object *otg.PatternFlowRsvpRsvpChecksum - // and doesn't set defaults - setMsg(*otg.PatternFlowRsvpRsvpChecksum) PatternFlowRsvpRsvpChecksum - // provides marshal interface - Marshal() marshalPatternFlowRsvpRsvpChecksum - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRsvpRsvpChecksum - // validate validates PatternFlowRsvpRsvpChecksum - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRsvpRsvpChecksum, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRsvpRsvpChecksumChoiceEnum, set in PatternFlowRsvpRsvpChecksum - Choice() PatternFlowRsvpRsvpChecksumChoiceEnum - // setChoice assigns PatternFlowRsvpRsvpChecksumChoiceEnum provided by user to PatternFlowRsvpRsvpChecksum - setChoice(value PatternFlowRsvpRsvpChecksumChoiceEnum) PatternFlowRsvpRsvpChecksum - // HasChoice checks if Choice has been set in PatternFlowRsvpRsvpChecksum - HasChoice() bool - // Generated returns PatternFlowRsvpRsvpChecksumGeneratedEnum, set in PatternFlowRsvpRsvpChecksum - Generated() PatternFlowRsvpRsvpChecksumGeneratedEnum - // SetGenerated assigns PatternFlowRsvpRsvpChecksumGeneratedEnum provided by user to PatternFlowRsvpRsvpChecksum - SetGenerated(value PatternFlowRsvpRsvpChecksumGeneratedEnum) PatternFlowRsvpRsvpChecksum - // HasGenerated checks if Generated has been set in PatternFlowRsvpRsvpChecksum - HasGenerated() bool - // Custom returns uint32, set in PatternFlowRsvpRsvpChecksum. - Custom() uint32 - // SetCustom assigns uint32 provided by user to PatternFlowRsvpRsvpChecksum - SetCustom(value uint32) PatternFlowRsvpRsvpChecksum - // HasCustom checks if Custom has been set in PatternFlowRsvpRsvpChecksum - HasCustom() bool -} - -type PatternFlowRsvpRsvpChecksumChoiceEnum string - -// Enum of Choice on PatternFlowRsvpRsvpChecksum -var PatternFlowRsvpRsvpChecksumChoice = struct { - GENERATED PatternFlowRsvpRsvpChecksumChoiceEnum - CUSTOM PatternFlowRsvpRsvpChecksumChoiceEnum -}{ - GENERATED: PatternFlowRsvpRsvpChecksumChoiceEnum("generated"), - CUSTOM: PatternFlowRsvpRsvpChecksumChoiceEnum("custom"), -} - -func (obj *patternFlowRsvpRsvpChecksum) Choice() PatternFlowRsvpRsvpChecksumChoiceEnum { - return PatternFlowRsvpRsvpChecksumChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The type of checksum -// Choice returns a string -func (obj *patternFlowRsvpRsvpChecksum) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRsvpRsvpChecksum) setChoice(value PatternFlowRsvpRsvpChecksumChoiceEnum) PatternFlowRsvpRsvpChecksum { - intValue, ok := otg.PatternFlowRsvpRsvpChecksum_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRsvpRsvpChecksumChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRsvpRsvpChecksum_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Custom = nil - obj.obj.Generated = otg.PatternFlowRsvpRsvpChecksum_Generated_unspecified.Enum() - return obj -} - -type PatternFlowRsvpRsvpChecksumGeneratedEnum string - -// Enum of Generated on PatternFlowRsvpRsvpChecksum -var PatternFlowRsvpRsvpChecksumGenerated = struct { - GOOD PatternFlowRsvpRsvpChecksumGeneratedEnum - BAD PatternFlowRsvpRsvpChecksumGeneratedEnum -}{ - GOOD: PatternFlowRsvpRsvpChecksumGeneratedEnum("good"), - BAD: PatternFlowRsvpRsvpChecksumGeneratedEnum("bad"), -} - -func (obj *patternFlowRsvpRsvpChecksum) Generated() PatternFlowRsvpRsvpChecksumGeneratedEnum { - return PatternFlowRsvpRsvpChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) -} - -// A system generated checksum value -// Generated returns a string -func (obj *patternFlowRsvpRsvpChecksum) HasGenerated() bool { - return obj.obj.Generated != nil -} - -func (obj *patternFlowRsvpRsvpChecksum) SetGenerated(value PatternFlowRsvpRsvpChecksumGeneratedEnum) PatternFlowRsvpRsvpChecksum { - intValue, ok := otg.PatternFlowRsvpRsvpChecksum_Generated_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRsvpRsvpChecksumGeneratedEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRsvpRsvpChecksum_Generated_Enum(intValue) - obj.obj.Generated = &enumValue - - return obj -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowRsvpRsvpChecksum) Custom() uint32 { - - if obj.obj.Custom == nil { - obj.setChoice(PatternFlowRsvpRsvpChecksumChoice.CUSTOM) - } - - return *obj.obj.Custom - -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowRsvpRsvpChecksum) HasCustom() bool { - return obj.obj.Custom != nil -} - -// A custom checksum value -// SetCustom sets the uint32 value in the PatternFlowRsvpRsvpChecksum object -func (obj *patternFlowRsvpRsvpChecksum) SetCustom(value uint32) PatternFlowRsvpRsvpChecksum { - obj.setChoice(PatternFlowRsvpRsvpChecksumChoice.CUSTOM) - obj.obj.Custom = &value - return obj -} - -func (obj *patternFlowRsvpRsvpChecksum) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Custom != nil { - - if *obj.obj.Custom > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRsvpRsvpChecksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) - } - - } - -} - -func (obj *patternFlowRsvpRsvpChecksum) setDefault() { - var choices_set int = 0 - var choice PatternFlowRsvpRsvpChecksumChoiceEnum - - if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { - choices_set += 1 - choice = PatternFlowRsvpRsvpChecksumChoice.GENERATED - } - - if obj.obj.Custom != nil { - choices_set += 1 - choice = PatternFlowRsvpRsvpChecksumChoice.CUSTOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRsvpRsvpChecksumChoice.GENERATED) - if obj.obj.Generated.Number() == 0 { - obj.SetGenerated(PatternFlowRsvpRsvpChecksumGenerated.GOOD) - - } - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRsvpRsvpChecksum") - } - } else { - intVal := otg.PatternFlowRsvpRsvpChecksum_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRsvpRsvpChecksum_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRsvpTimeToLive ***** -type patternFlowRsvpTimeToLive struct { - validation - obj *otg.PatternFlowRsvpTimeToLive - marshaller marshalPatternFlowRsvpTimeToLive - unMarshaller unMarshalPatternFlowRsvpTimeToLive - incrementHolder PatternFlowRsvpTimeToLiveCounter - decrementHolder PatternFlowRsvpTimeToLiveCounter -} - -func NewPatternFlowRsvpTimeToLive() PatternFlowRsvpTimeToLive { - obj := patternFlowRsvpTimeToLive{obj: &otg.PatternFlowRsvpTimeToLive{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRsvpTimeToLive) msg() *otg.PatternFlowRsvpTimeToLive { - return obj.obj -} - -func (obj *patternFlowRsvpTimeToLive) setMsg(msg *otg.PatternFlowRsvpTimeToLive) PatternFlowRsvpTimeToLive { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRsvpTimeToLive struct { - obj *patternFlowRsvpTimeToLive -} - -type marshalPatternFlowRsvpTimeToLive interface { - // ToProto marshals PatternFlowRsvpTimeToLive to protobuf object *otg.PatternFlowRsvpTimeToLive - ToProto() (*otg.PatternFlowRsvpTimeToLive, error) - // ToPbText marshals PatternFlowRsvpTimeToLive to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRsvpTimeToLive to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRsvpTimeToLive to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRsvpTimeToLive struct { - obj *patternFlowRsvpTimeToLive -} - -type unMarshalPatternFlowRsvpTimeToLive interface { - // FromProto unmarshals PatternFlowRsvpTimeToLive from protobuf object *otg.PatternFlowRsvpTimeToLive - FromProto(msg *otg.PatternFlowRsvpTimeToLive) (PatternFlowRsvpTimeToLive, error) - // FromPbText unmarshals PatternFlowRsvpTimeToLive from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRsvpTimeToLive from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRsvpTimeToLive from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRsvpTimeToLive) Marshal() marshalPatternFlowRsvpTimeToLive { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRsvpTimeToLive{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRsvpTimeToLive) Unmarshal() unMarshalPatternFlowRsvpTimeToLive { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRsvpTimeToLive{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRsvpTimeToLive) ToProto() (*otg.PatternFlowRsvpTimeToLive, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRsvpTimeToLive) FromProto(msg *otg.PatternFlowRsvpTimeToLive) (PatternFlowRsvpTimeToLive, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRsvpTimeToLive) 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 *unMarshalpatternFlowRsvpTimeToLive) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRsvpTimeToLive) 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 *unMarshalpatternFlowRsvpTimeToLive) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRsvpTimeToLive) 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 *unMarshalpatternFlowRsvpTimeToLive) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRsvpTimeToLive) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRsvpTimeToLive) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRsvpTimeToLive) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRsvpTimeToLive) Clone() (PatternFlowRsvpTimeToLive, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRsvpTimeToLive() - 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 -} - -func (obj *patternFlowRsvpTimeToLive) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRsvpTimeToLive is the IP time-to-live(TTL) value with which the message was sent. -type PatternFlowRsvpTimeToLive interface { - Validation - // msg marshals PatternFlowRsvpTimeToLive to protobuf object *otg.PatternFlowRsvpTimeToLive - // and doesn't set defaults - msg() *otg.PatternFlowRsvpTimeToLive - // setMsg unmarshals PatternFlowRsvpTimeToLive from protobuf object *otg.PatternFlowRsvpTimeToLive - // and doesn't set defaults - setMsg(*otg.PatternFlowRsvpTimeToLive) PatternFlowRsvpTimeToLive - // provides marshal interface - Marshal() marshalPatternFlowRsvpTimeToLive - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRsvpTimeToLive - // validate validates PatternFlowRsvpTimeToLive - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRsvpTimeToLive, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRsvpTimeToLiveChoiceEnum, set in PatternFlowRsvpTimeToLive - Choice() PatternFlowRsvpTimeToLiveChoiceEnum - // setChoice assigns PatternFlowRsvpTimeToLiveChoiceEnum provided by user to PatternFlowRsvpTimeToLive - setChoice(value PatternFlowRsvpTimeToLiveChoiceEnum) PatternFlowRsvpTimeToLive - // HasChoice checks if Choice has been set in PatternFlowRsvpTimeToLive - HasChoice() bool - // Value returns uint32, set in PatternFlowRsvpTimeToLive. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRsvpTimeToLive - SetValue(value uint32) PatternFlowRsvpTimeToLive - // HasValue checks if Value has been set in PatternFlowRsvpTimeToLive - HasValue() bool - // Values returns []uint32, set in PatternFlowRsvpTimeToLive. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRsvpTimeToLive - SetValues(value []uint32) PatternFlowRsvpTimeToLive - // Increment returns PatternFlowRsvpTimeToLiveCounter, set in PatternFlowRsvpTimeToLive. - // PatternFlowRsvpTimeToLiveCounter is integer counter pattern - Increment() PatternFlowRsvpTimeToLiveCounter - // SetIncrement assigns PatternFlowRsvpTimeToLiveCounter provided by user to PatternFlowRsvpTimeToLive. - // PatternFlowRsvpTimeToLiveCounter is integer counter pattern - SetIncrement(value PatternFlowRsvpTimeToLiveCounter) PatternFlowRsvpTimeToLive - // HasIncrement checks if Increment has been set in PatternFlowRsvpTimeToLive - HasIncrement() bool - // Decrement returns PatternFlowRsvpTimeToLiveCounter, set in PatternFlowRsvpTimeToLive. - // PatternFlowRsvpTimeToLiveCounter is integer counter pattern - Decrement() PatternFlowRsvpTimeToLiveCounter - // SetDecrement assigns PatternFlowRsvpTimeToLiveCounter provided by user to PatternFlowRsvpTimeToLive. - // PatternFlowRsvpTimeToLiveCounter is integer counter pattern - SetDecrement(value PatternFlowRsvpTimeToLiveCounter) PatternFlowRsvpTimeToLive - // HasDecrement checks if Decrement has been set in PatternFlowRsvpTimeToLive - HasDecrement() bool - setNil() -} - -type PatternFlowRsvpTimeToLiveChoiceEnum string - -// Enum of Choice on PatternFlowRsvpTimeToLive -var PatternFlowRsvpTimeToLiveChoice = struct { - VALUE PatternFlowRsvpTimeToLiveChoiceEnum - VALUES PatternFlowRsvpTimeToLiveChoiceEnum - INCREMENT PatternFlowRsvpTimeToLiveChoiceEnum - DECREMENT PatternFlowRsvpTimeToLiveChoiceEnum -}{ - VALUE: PatternFlowRsvpTimeToLiveChoiceEnum("value"), - VALUES: PatternFlowRsvpTimeToLiveChoiceEnum("values"), - INCREMENT: PatternFlowRsvpTimeToLiveChoiceEnum("increment"), - DECREMENT: PatternFlowRsvpTimeToLiveChoiceEnum("decrement"), -} - -func (obj *patternFlowRsvpTimeToLive) Choice() PatternFlowRsvpTimeToLiveChoiceEnum { - return PatternFlowRsvpTimeToLiveChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRsvpTimeToLive) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRsvpTimeToLive) setChoice(value PatternFlowRsvpTimeToLiveChoiceEnum) PatternFlowRsvpTimeToLive { - intValue, ok := otg.PatternFlowRsvpTimeToLive_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRsvpTimeToLiveChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRsvpTimeToLive_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRsvpTimeToLiveChoice.VALUE { - defaultValue := uint32(64) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRsvpTimeToLiveChoice.VALUES { - defaultValue := []uint32{64} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRsvpTimeToLiveChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRsvpTimeToLiveCounter().msg() - } - - if value == PatternFlowRsvpTimeToLiveChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRsvpTimeToLiveCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRsvpTimeToLive) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRsvpTimeToLiveChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRsvpTimeToLive) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRsvpTimeToLive object -func (obj *patternFlowRsvpTimeToLive) SetValue(value uint32) PatternFlowRsvpTimeToLive { - obj.setChoice(PatternFlowRsvpTimeToLiveChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRsvpTimeToLive) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{64}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRsvpTimeToLive object -func (obj *patternFlowRsvpTimeToLive) SetValues(value []uint32) PatternFlowRsvpTimeToLive { - obj.setChoice(PatternFlowRsvpTimeToLiveChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRsvpTimeToLiveCounter -func (obj *patternFlowRsvpTimeToLive) Increment() PatternFlowRsvpTimeToLiveCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRsvpTimeToLiveChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRsvpTimeToLiveCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRsvpTimeToLiveCounter -func (obj *patternFlowRsvpTimeToLive) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRsvpTimeToLiveCounter value in the PatternFlowRsvpTimeToLive object -func (obj *patternFlowRsvpTimeToLive) SetIncrement(value PatternFlowRsvpTimeToLiveCounter) PatternFlowRsvpTimeToLive { - obj.setChoice(PatternFlowRsvpTimeToLiveChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRsvpTimeToLiveCounter -func (obj *patternFlowRsvpTimeToLive) Decrement() PatternFlowRsvpTimeToLiveCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRsvpTimeToLiveChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRsvpTimeToLiveCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRsvpTimeToLiveCounter -func (obj *patternFlowRsvpTimeToLive) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRsvpTimeToLiveCounter value in the PatternFlowRsvpTimeToLive object -func (obj *patternFlowRsvpTimeToLive) SetDecrement(value PatternFlowRsvpTimeToLiveCounter) PatternFlowRsvpTimeToLive { - obj.setChoice(PatternFlowRsvpTimeToLiveChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRsvpTimeToLive) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRsvpTimeToLive.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRsvpTimeToLive.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRsvpTimeToLive) setDefault() { - var choices_set int = 0 - var choice PatternFlowRsvpTimeToLiveChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRsvpTimeToLiveChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRsvpTimeToLiveChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRsvpTimeToLiveChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRsvpTimeToLiveChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRsvpTimeToLiveChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRsvpTimeToLive") - } - } else { - intVal := otg.PatternFlowRsvpTimeToLive_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRsvpTimeToLive_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRsvpReserved ***** -type patternFlowRsvpReserved struct { - validation - obj *otg.PatternFlowRsvpReserved - marshaller marshalPatternFlowRsvpReserved - unMarshaller unMarshalPatternFlowRsvpReserved - incrementHolder PatternFlowRsvpReservedCounter - decrementHolder PatternFlowRsvpReservedCounter -} - -func NewPatternFlowRsvpReserved() PatternFlowRsvpReserved { - obj := patternFlowRsvpReserved{obj: &otg.PatternFlowRsvpReserved{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRsvpReserved) msg() *otg.PatternFlowRsvpReserved { - return obj.obj -} - -func (obj *patternFlowRsvpReserved) setMsg(msg *otg.PatternFlowRsvpReserved) PatternFlowRsvpReserved { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRsvpReserved struct { - obj *patternFlowRsvpReserved -} - -type marshalPatternFlowRsvpReserved interface { - // ToProto marshals PatternFlowRsvpReserved to protobuf object *otg.PatternFlowRsvpReserved - ToProto() (*otg.PatternFlowRsvpReserved, error) - // ToPbText marshals PatternFlowRsvpReserved to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRsvpReserved to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRsvpReserved to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRsvpReserved struct { - obj *patternFlowRsvpReserved -} - -type unMarshalPatternFlowRsvpReserved interface { - // FromProto unmarshals PatternFlowRsvpReserved from protobuf object *otg.PatternFlowRsvpReserved - FromProto(msg *otg.PatternFlowRsvpReserved) (PatternFlowRsvpReserved, error) - // FromPbText unmarshals PatternFlowRsvpReserved from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRsvpReserved from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRsvpReserved from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRsvpReserved) Marshal() marshalPatternFlowRsvpReserved { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRsvpReserved{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRsvpReserved) Unmarshal() unMarshalPatternFlowRsvpReserved { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRsvpReserved{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRsvpReserved) ToProto() (*otg.PatternFlowRsvpReserved, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRsvpReserved) FromProto(msg *otg.PatternFlowRsvpReserved) (PatternFlowRsvpReserved, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRsvpReserved) 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 *unMarshalpatternFlowRsvpReserved) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRsvpReserved) 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 *unMarshalpatternFlowRsvpReserved) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRsvpReserved) 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 *unMarshalpatternFlowRsvpReserved) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRsvpReserved) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRsvpReserved) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRsvpReserved) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRsvpReserved) Clone() (PatternFlowRsvpReserved, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRsvpReserved() - 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 -} - -func (obj *patternFlowRsvpReserved) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRsvpReserved is reserved -type PatternFlowRsvpReserved interface { - Validation - // msg marshals PatternFlowRsvpReserved to protobuf object *otg.PatternFlowRsvpReserved - // and doesn't set defaults - msg() *otg.PatternFlowRsvpReserved - // setMsg unmarshals PatternFlowRsvpReserved from protobuf object *otg.PatternFlowRsvpReserved - // and doesn't set defaults - setMsg(*otg.PatternFlowRsvpReserved) PatternFlowRsvpReserved - // provides marshal interface - Marshal() marshalPatternFlowRsvpReserved - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRsvpReserved - // validate validates PatternFlowRsvpReserved - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRsvpReserved, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRsvpReservedChoiceEnum, set in PatternFlowRsvpReserved - Choice() PatternFlowRsvpReservedChoiceEnum - // setChoice assigns PatternFlowRsvpReservedChoiceEnum provided by user to PatternFlowRsvpReserved - setChoice(value PatternFlowRsvpReservedChoiceEnum) PatternFlowRsvpReserved - // HasChoice checks if Choice has been set in PatternFlowRsvpReserved - HasChoice() bool - // Value returns uint32, set in PatternFlowRsvpReserved. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRsvpReserved - SetValue(value uint32) PatternFlowRsvpReserved - // HasValue checks if Value has been set in PatternFlowRsvpReserved - HasValue() bool - // Values returns []uint32, set in PatternFlowRsvpReserved. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRsvpReserved - SetValues(value []uint32) PatternFlowRsvpReserved - // Increment returns PatternFlowRsvpReservedCounter, set in PatternFlowRsvpReserved. - // PatternFlowRsvpReservedCounter is integer counter pattern - Increment() PatternFlowRsvpReservedCounter - // SetIncrement assigns PatternFlowRsvpReservedCounter provided by user to PatternFlowRsvpReserved. - // PatternFlowRsvpReservedCounter is integer counter pattern - SetIncrement(value PatternFlowRsvpReservedCounter) PatternFlowRsvpReserved - // HasIncrement checks if Increment has been set in PatternFlowRsvpReserved - HasIncrement() bool - // Decrement returns PatternFlowRsvpReservedCounter, set in PatternFlowRsvpReserved. - // PatternFlowRsvpReservedCounter is integer counter pattern - Decrement() PatternFlowRsvpReservedCounter - // SetDecrement assigns PatternFlowRsvpReservedCounter provided by user to PatternFlowRsvpReserved. - // PatternFlowRsvpReservedCounter is integer counter pattern - SetDecrement(value PatternFlowRsvpReservedCounter) PatternFlowRsvpReserved - // HasDecrement checks if Decrement has been set in PatternFlowRsvpReserved - HasDecrement() bool - setNil() -} - -type PatternFlowRsvpReservedChoiceEnum string - -// Enum of Choice on PatternFlowRsvpReserved -var PatternFlowRsvpReservedChoice = struct { - VALUE PatternFlowRsvpReservedChoiceEnum - VALUES PatternFlowRsvpReservedChoiceEnum - INCREMENT PatternFlowRsvpReservedChoiceEnum - DECREMENT PatternFlowRsvpReservedChoiceEnum -}{ - VALUE: PatternFlowRsvpReservedChoiceEnum("value"), - VALUES: PatternFlowRsvpReservedChoiceEnum("values"), - INCREMENT: PatternFlowRsvpReservedChoiceEnum("increment"), - DECREMENT: PatternFlowRsvpReservedChoiceEnum("decrement"), -} - -func (obj *patternFlowRsvpReserved) Choice() PatternFlowRsvpReservedChoiceEnum { - return PatternFlowRsvpReservedChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRsvpReserved) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRsvpReserved) setChoice(value PatternFlowRsvpReservedChoiceEnum) PatternFlowRsvpReserved { - intValue, ok := otg.PatternFlowRsvpReserved_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRsvpReservedChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRsvpReserved_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRsvpReservedChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRsvpReservedChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRsvpReservedChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRsvpReservedCounter().msg() - } - - if value == PatternFlowRsvpReservedChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRsvpReservedCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRsvpReserved) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRsvpReservedChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRsvpReserved) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRsvpReserved object -func (obj *patternFlowRsvpReserved) SetValue(value uint32) PatternFlowRsvpReserved { - obj.setChoice(PatternFlowRsvpReservedChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRsvpReserved) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRsvpReserved object -func (obj *patternFlowRsvpReserved) SetValues(value []uint32) PatternFlowRsvpReserved { - obj.setChoice(PatternFlowRsvpReservedChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRsvpReservedCounter -func (obj *patternFlowRsvpReserved) Increment() PatternFlowRsvpReservedCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRsvpReservedChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRsvpReservedCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRsvpReservedCounter -func (obj *patternFlowRsvpReserved) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRsvpReservedCounter value in the PatternFlowRsvpReserved object -func (obj *patternFlowRsvpReserved) SetIncrement(value PatternFlowRsvpReservedCounter) PatternFlowRsvpReserved { - obj.setChoice(PatternFlowRsvpReservedChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRsvpReservedCounter -func (obj *patternFlowRsvpReserved) Decrement() PatternFlowRsvpReservedCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRsvpReservedChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRsvpReservedCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRsvpReservedCounter -func (obj *patternFlowRsvpReserved) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRsvpReservedCounter value in the PatternFlowRsvpReserved object -func (obj *patternFlowRsvpReserved) SetDecrement(value PatternFlowRsvpReservedCounter) PatternFlowRsvpReserved { - obj.setChoice(PatternFlowRsvpReservedChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRsvpReserved) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRsvpReserved.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRsvpReserved.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRsvpReserved) setDefault() { - var choices_set int = 0 - var choice PatternFlowRsvpReservedChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRsvpReservedChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRsvpReservedChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRsvpReservedChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRsvpReservedChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRsvpReservedChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRsvpReserved") - } - } else { - intVal := otg.PatternFlowRsvpReserved_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRsvpReserved_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPLength ***** -type flowRSVPLength struct { - validation - obj *otg.FlowRSVPLength - marshaller marshalFlowRSVPLength - unMarshaller unMarshalFlowRSVPLength -} - -func NewFlowRSVPLength() FlowRSVPLength { - obj := flowRSVPLength{obj: &otg.FlowRSVPLength{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPLength) msg() *otg.FlowRSVPLength { - return obj.obj -} - -func (obj *flowRSVPLength) setMsg(msg *otg.FlowRSVPLength) FlowRSVPLength { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPLength struct { - obj *flowRSVPLength -} - -type marshalFlowRSVPLength interface { - // ToProto marshals FlowRSVPLength to protobuf object *otg.FlowRSVPLength - ToProto() (*otg.FlowRSVPLength, error) - // ToPbText marshals FlowRSVPLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPLength to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPLength to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPLength struct { - obj *flowRSVPLength -} - -type unMarshalFlowRSVPLength interface { - // FromProto unmarshals FlowRSVPLength from protobuf object *otg.FlowRSVPLength - FromProto(msg *otg.FlowRSVPLength) (FlowRSVPLength, error) - // FromPbText unmarshals FlowRSVPLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPLength from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPLength from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPLength) Marshal() marshalFlowRSVPLength { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPLength{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPLength) Unmarshal() unMarshalFlowRSVPLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPLength) ToProto() (*otg.FlowRSVPLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPLength) FromProto(msg *otg.FlowRSVPLength) (FlowRSVPLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPLength) 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 *unMarshalflowRSVPLength) 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 *marshalflowRSVPLength) 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 *unMarshalflowRSVPLength) 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 *marshalflowRSVPLength) 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 *unMarshalflowRSVPLength) 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 *flowRSVPLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPLength) Clone() (FlowRSVPLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPLength() - 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 -} - -// FlowRSVPLength is description is TBD -type FlowRSVPLength interface { - Validation - // msg marshals FlowRSVPLength to protobuf object *otg.FlowRSVPLength - // and doesn't set defaults - msg() *otg.FlowRSVPLength - // setMsg unmarshals FlowRSVPLength from protobuf object *otg.FlowRSVPLength - // and doesn't set defaults - setMsg(*otg.FlowRSVPLength) FlowRSVPLength - // provides marshal interface - Marshal() marshalFlowRSVPLength - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPLength - // validate validates FlowRSVPLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPLengthChoiceEnum, set in FlowRSVPLength - Choice() FlowRSVPLengthChoiceEnum - // setChoice assigns FlowRSVPLengthChoiceEnum provided by user to FlowRSVPLength - setChoice(value FlowRSVPLengthChoiceEnum) FlowRSVPLength - // HasChoice checks if Choice has been set in FlowRSVPLength - HasChoice() bool - // Auto returns uint32, set in FlowRSVPLength. - Auto() uint32 - // HasAuto checks if Auto has been set in FlowRSVPLength - HasAuto() bool - // Value returns uint32, set in FlowRSVPLength. - Value() uint32 - // SetValue assigns uint32 provided by user to FlowRSVPLength - SetValue(value uint32) FlowRSVPLength - // HasValue checks if Value has been set in FlowRSVPLength - HasValue() bool -} - -type FlowRSVPLengthChoiceEnum string - -// Enum of Choice on FlowRSVPLength -var FlowRSVPLengthChoice = struct { - AUTO FlowRSVPLengthChoiceEnum - VALUE FlowRSVPLengthChoiceEnum -}{ - AUTO: FlowRSVPLengthChoiceEnum("auto"), - VALUE: FlowRSVPLengthChoiceEnum("value"), -} - -func (obj *flowRSVPLength) Choice() FlowRSVPLengthChoiceEnum { - return FlowRSVPLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// auto or configured value. -// Choice returns a string -func (obj *flowRSVPLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPLength) setChoice(value FlowRSVPLengthChoiceEnum) FlowRSVPLength { - intValue, ok := otg.FlowRSVPLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Value = nil - obj.obj.Auto = nil - - if value == FlowRSVPLengthChoice.AUTO { - defaultValue := uint32(0) - obj.obj.Auto = &defaultValue - } - - if value == FlowRSVPLengthChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - return obj -} - -// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. -// Auto returns a uint32 -func (obj *flowRSVPLength) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(FlowRSVPLengthChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. -// Auto returns a uint32 -func (obj *flowRSVPLength) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Value returns a uint32 -func (obj *flowRSVPLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(FlowRSVPLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *flowRSVPLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the FlowRSVPLength object -func (obj *flowRSVPLength) SetValue(value uint32) FlowRSVPLength { - obj.setChoice(FlowRSVPLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -func (obj *flowRSVPLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowRSVPLength.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - -} - -func (obj *flowRSVPLength) setDefault() { - var choices_set int = 0 - var choice FlowRSVPLengthChoiceEnum - - if obj.obj.Auto != nil { - choices_set += 1 - choice = FlowRSVPLengthChoice.AUTO - } - - if obj.obj.Value != nil { - choices_set += 1 - choice = FlowRSVPLengthChoice.VALUE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPLengthChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPLength") - } - } else { - intVal := otg.FlowRSVPLength_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPMessage ***** -type flowRSVPMessage struct { - validation - obj *otg.FlowRSVPMessage - marshaller marshalFlowRSVPMessage - unMarshaller unMarshalFlowRSVPMessage - pathHolder FlowRSVPPathMessage -} - -func NewFlowRSVPMessage() FlowRSVPMessage { - obj := flowRSVPMessage{obj: &otg.FlowRSVPMessage{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPMessage) msg() *otg.FlowRSVPMessage { - return obj.obj -} - -func (obj *flowRSVPMessage) setMsg(msg *otg.FlowRSVPMessage) FlowRSVPMessage { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPMessage struct { - obj *flowRSVPMessage -} - -type marshalFlowRSVPMessage interface { - // ToProto marshals FlowRSVPMessage to protobuf object *otg.FlowRSVPMessage - ToProto() (*otg.FlowRSVPMessage, error) - // ToPbText marshals FlowRSVPMessage to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPMessage to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPMessage to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPMessage struct { - obj *flowRSVPMessage -} - -type unMarshalFlowRSVPMessage interface { - // FromProto unmarshals FlowRSVPMessage from protobuf object *otg.FlowRSVPMessage - FromProto(msg *otg.FlowRSVPMessage) (FlowRSVPMessage, error) - // FromPbText unmarshals FlowRSVPMessage from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPMessage from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPMessage from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPMessage) Marshal() marshalFlowRSVPMessage { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPMessage{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPMessage) Unmarshal() unMarshalFlowRSVPMessage { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPMessage{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPMessage) ToProto() (*otg.FlowRSVPMessage, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPMessage) FromProto(msg *otg.FlowRSVPMessage) (FlowRSVPMessage, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPMessage) 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 *unMarshalflowRSVPMessage) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPMessage) 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 *unMarshalflowRSVPMessage) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPMessage) 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 *unMarshalflowRSVPMessage) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPMessage) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPMessage) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPMessage) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPMessage) Clone() (FlowRSVPMessage, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPMessage() - 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 -} - -func (obj *flowRSVPMessage) setNil() { - obj.pathHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPMessage is description is TBD -type FlowRSVPMessage interface { - Validation - // msg marshals FlowRSVPMessage to protobuf object *otg.FlowRSVPMessage - // and doesn't set defaults - msg() *otg.FlowRSVPMessage - // setMsg unmarshals FlowRSVPMessage from protobuf object *otg.FlowRSVPMessage - // and doesn't set defaults - setMsg(*otg.FlowRSVPMessage) FlowRSVPMessage - // provides marshal interface - Marshal() marshalFlowRSVPMessage - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPMessage - // validate validates FlowRSVPMessage - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPMessage, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPMessageChoiceEnum, set in FlowRSVPMessage - Choice() FlowRSVPMessageChoiceEnum - // setChoice assigns FlowRSVPMessageChoiceEnum provided by user to FlowRSVPMessage - setChoice(value FlowRSVPMessageChoiceEnum) FlowRSVPMessage - // HasChoice checks if Choice has been set in FlowRSVPMessage - HasChoice() bool - // Path returns FlowRSVPPathMessage, set in FlowRSVPMessage. - // FlowRSVPPathMessage is "Path" message requires the following list of objects in order as defined in https://www.rfc-editor.org/rfc/rfc3209.html#page-15: 1. SESSION 2. RSVP_HOP 3. TIME_VALUES 4. EXPLICIT_ROUTE [optional] 5. LABEL_REQUEST 6. SESSION_ATTRIBUTE [optional] 7. SENDER_TEMPLATE 8. SENDER_TSPEC 9. RECORD_ROUTE [optional] - Path() FlowRSVPPathMessage - // SetPath assigns FlowRSVPPathMessage provided by user to FlowRSVPMessage. - // FlowRSVPPathMessage is "Path" message requires the following list of objects in order as defined in https://www.rfc-editor.org/rfc/rfc3209.html#page-15: 1. SESSION 2. RSVP_HOP 3. TIME_VALUES 4. EXPLICIT_ROUTE [optional] 5. LABEL_REQUEST 6. SESSION_ATTRIBUTE [optional] 7. SENDER_TEMPLATE 8. SENDER_TSPEC 9. RECORD_ROUTE [optional] - SetPath(value FlowRSVPPathMessage) FlowRSVPMessage - // HasPath checks if Path has been set in FlowRSVPMessage - HasPath() bool - setNil() -} - -type FlowRSVPMessageChoiceEnum string - -// Enum of Choice on FlowRSVPMessage -var FlowRSVPMessageChoice = struct { - PATH FlowRSVPMessageChoiceEnum -}{ - PATH: FlowRSVPMessageChoiceEnum("path"), -} - -func (obj *flowRSVPMessage) Choice() FlowRSVPMessageChoiceEnum { - return FlowRSVPMessageChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowRSVPMessage) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPMessage) setChoice(value FlowRSVPMessageChoiceEnum) FlowRSVPMessage { - intValue, ok := otg.FlowRSVPMessage_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPMessageChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPMessage_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Path = nil - obj.pathHolder = nil - - if value == FlowRSVPMessageChoice.PATH { - obj.obj.Path = NewFlowRSVPPathMessage().msg() - } - - return obj -} - -// description is TBD -// Path returns a FlowRSVPPathMessage -func (obj *flowRSVPMessage) Path() FlowRSVPPathMessage { - if obj.obj.Path == nil { - obj.setChoice(FlowRSVPMessageChoice.PATH) - } - if obj.pathHolder == nil { - obj.pathHolder = &flowRSVPPathMessage{obj: obj.obj.Path} - } - return obj.pathHolder -} - -// description is TBD -// Path returns a FlowRSVPPathMessage -func (obj *flowRSVPMessage) HasPath() bool { - return obj.obj.Path != nil -} - -// description is TBD -// SetPath sets the FlowRSVPPathMessage value in the FlowRSVPMessage object -func (obj *flowRSVPMessage) SetPath(value FlowRSVPPathMessage) FlowRSVPMessage { - obj.setChoice(FlowRSVPMessageChoice.PATH) - obj.pathHolder = nil - obj.obj.Path = value.msg() - - return obj -} - -func (obj *flowRSVPMessage) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Path != nil { - - obj.Path().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPMessage) setDefault() { - var choices_set int = 0 - var choice FlowRSVPMessageChoiceEnum - - if obj.obj.Path != nil { - choices_set += 1 - choice = FlowRSVPMessageChoice.PATH - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPMessageChoice.PATH) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPMessage") - } - } else { - intVal := otg.FlowRSVPMessage_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPMessage_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowSizeWeightPairsCustom ***** -type flowSizeWeightPairsCustom struct { - validation - obj *otg.FlowSizeWeightPairsCustom - marshaller marshalFlowSizeWeightPairsCustom - unMarshaller unMarshalFlowSizeWeightPairsCustom -} - -func NewFlowSizeWeightPairsCustom() FlowSizeWeightPairsCustom { - obj := flowSizeWeightPairsCustom{obj: &otg.FlowSizeWeightPairsCustom{}} - obj.setDefault() - return &obj -} - -func (obj *flowSizeWeightPairsCustom) msg() *otg.FlowSizeWeightPairsCustom { - return obj.obj -} - -func (obj *flowSizeWeightPairsCustom) setMsg(msg *otg.FlowSizeWeightPairsCustom) FlowSizeWeightPairsCustom { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowSizeWeightPairsCustom struct { - obj *flowSizeWeightPairsCustom -} - -type marshalFlowSizeWeightPairsCustom interface { - // ToProto marshals FlowSizeWeightPairsCustom to protobuf object *otg.FlowSizeWeightPairsCustom - ToProto() (*otg.FlowSizeWeightPairsCustom, error) - // ToPbText marshals FlowSizeWeightPairsCustom to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowSizeWeightPairsCustom to YAML text - ToYaml() (string, error) - // ToJson marshals FlowSizeWeightPairsCustom to JSON text - ToJson() (string, error) -} - -type unMarshalflowSizeWeightPairsCustom struct { - obj *flowSizeWeightPairsCustom -} - -type unMarshalFlowSizeWeightPairsCustom interface { - // FromProto unmarshals FlowSizeWeightPairsCustom from protobuf object *otg.FlowSizeWeightPairsCustom - FromProto(msg *otg.FlowSizeWeightPairsCustom) (FlowSizeWeightPairsCustom, error) - // FromPbText unmarshals FlowSizeWeightPairsCustom from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowSizeWeightPairsCustom from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowSizeWeightPairsCustom from JSON text - FromJson(value string) error -} - -func (obj *flowSizeWeightPairsCustom) Marshal() marshalFlowSizeWeightPairsCustom { - if obj.marshaller == nil { - obj.marshaller = &marshalflowSizeWeightPairsCustom{obj: obj} - } - return obj.marshaller -} - -func (obj *flowSizeWeightPairsCustom) Unmarshal() unMarshalFlowSizeWeightPairsCustom { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowSizeWeightPairsCustom{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowSizeWeightPairsCustom) ToProto() (*otg.FlowSizeWeightPairsCustom, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowSizeWeightPairsCustom) FromProto(msg *otg.FlowSizeWeightPairsCustom) (FlowSizeWeightPairsCustom, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowSizeWeightPairsCustom) 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 *unMarshalflowSizeWeightPairsCustom) 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 *marshalflowSizeWeightPairsCustom) 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 *unMarshalflowSizeWeightPairsCustom) 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 *marshalflowSizeWeightPairsCustom) 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 *unMarshalflowSizeWeightPairsCustom) 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 *flowSizeWeightPairsCustom) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowSizeWeightPairsCustom) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowSizeWeightPairsCustom) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowSizeWeightPairsCustom) Clone() (FlowSizeWeightPairsCustom, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowSizeWeightPairsCustom() - 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 -} - -// FlowSizeWeightPairsCustom is custom frame size distribution pair. -type FlowSizeWeightPairsCustom interface { - Validation - // msg marshals FlowSizeWeightPairsCustom to protobuf object *otg.FlowSizeWeightPairsCustom - // and doesn't set defaults - msg() *otg.FlowSizeWeightPairsCustom - // setMsg unmarshals FlowSizeWeightPairsCustom from protobuf object *otg.FlowSizeWeightPairsCustom - // and doesn't set defaults - setMsg(*otg.FlowSizeWeightPairsCustom) FlowSizeWeightPairsCustom - // provides marshal interface - Marshal() marshalFlowSizeWeightPairsCustom - // provides unmarshal interface - Unmarshal() unMarshalFlowSizeWeightPairsCustom - // validate validates FlowSizeWeightPairsCustom - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowSizeWeightPairsCustom, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Size returns uint32, set in FlowSizeWeightPairsCustom. - Size() uint32 - // SetSize assigns uint32 provided by user to FlowSizeWeightPairsCustom - SetSize(value uint32) FlowSizeWeightPairsCustom - // HasSize checks if Size has been set in FlowSizeWeightPairsCustom - HasSize() bool - // Weight returns float32, set in FlowSizeWeightPairsCustom. - Weight() float32 - // SetWeight assigns float32 provided by user to FlowSizeWeightPairsCustom - SetWeight(value float32) FlowSizeWeightPairsCustom - // HasWeight checks if Weight has been set in FlowSizeWeightPairsCustom - HasWeight() bool -} - -// The size of the frame (in bytes) for this weight pair. -// Size returns a uint32 -func (obj *flowSizeWeightPairsCustom) Size() uint32 { - - return *obj.obj.Size - -} - -// The size of the frame (in bytes) for this weight pair. -// Size returns a uint32 -func (obj *flowSizeWeightPairsCustom) HasSize() bool { - return obj.obj.Size != nil -} - -// The size of the frame (in bytes) for this weight pair. -// SetSize sets the uint32 value in the FlowSizeWeightPairsCustom object -func (obj *flowSizeWeightPairsCustom) SetSize(value uint32) FlowSizeWeightPairsCustom { - - obj.obj.Size = &value - return obj -} - -// Weight assigned to the corresponding frame size in this weight pair. -// Higher weight means more packets. -// Weight returns a float32 -func (obj *flowSizeWeightPairsCustom) Weight() float32 { - - return *obj.obj.Weight - -} - -// Weight assigned to the corresponding frame size in this weight pair. -// Higher weight means more packets. -// Weight returns a float32 -func (obj *flowSizeWeightPairsCustom) HasWeight() bool { - return obj.obj.Weight != nil -} - -// Weight assigned to the corresponding frame size in this weight pair. -// Higher weight means more packets. -// SetWeight sets the float32 value in the FlowSizeWeightPairsCustom object -func (obj *flowSizeWeightPairsCustom) SetWeight(value float32) FlowSizeWeightPairsCustom { - - obj.obj.Weight = &value - return obj -} - -func (obj *flowSizeWeightPairsCustom) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Size != nil { - - if *obj.obj.Size < 12 || *obj.obj.Size > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("12 <= FlowSizeWeightPairsCustom.Size <= 65535 but Got %d", *obj.obj.Size)) - } - - } - -} - -func (obj *flowSizeWeightPairsCustom) setDefault() { - if obj.obj.Size == nil { - obj.SetSize(64) - } - if obj.obj.Weight == nil { - obj.SetWeight(1) - } - -} - -// ***** FlowDelay ***** -type flowDelay struct { - validation - obj *otg.FlowDelay - marshaller marshalFlowDelay - unMarshaller unMarshalFlowDelay -} - -func NewFlowDelay() FlowDelay { - obj := flowDelay{obj: &otg.FlowDelay{}} - obj.setDefault() - return &obj -} - -func (obj *flowDelay) msg() *otg.FlowDelay { - return obj.obj -} - -func (obj *flowDelay) setMsg(msg *otg.FlowDelay) FlowDelay { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowDelay struct { - obj *flowDelay -} - -type marshalFlowDelay interface { - // ToProto marshals FlowDelay to protobuf object *otg.FlowDelay - ToProto() (*otg.FlowDelay, error) - // ToPbText marshals FlowDelay to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowDelay to YAML text - ToYaml() (string, error) - // ToJson marshals FlowDelay to JSON text - ToJson() (string, error) -} - -type unMarshalflowDelay struct { - obj *flowDelay -} - -type unMarshalFlowDelay interface { - // FromProto unmarshals FlowDelay from protobuf object *otg.FlowDelay - FromProto(msg *otg.FlowDelay) (FlowDelay, error) - // FromPbText unmarshals FlowDelay from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowDelay from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowDelay from JSON text - FromJson(value string) error -} - -func (obj *flowDelay) Marshal() marshalFlowDelay { - if obj.marshaller == nil { - obj.marshaller = &marshalflowDelay{obj: obj} - } - return obj.marshaller -} - -func (obj *flowDelay) Unmarshal() unMarshalFlowDelay { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowDelay{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowDelay) ToProto() (*otg.FlowDelay, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowDelay) FromProto(msg *otg.FlowDelay) (FlowDelay, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowDelay) 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 *unMarshalflowDelay) 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 *marshalflowDelay) 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 *unMarshalflowDelay) 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 *marshalflowDelay) 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 *unMarshalflowDelay) 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 *flowDelay) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowDelay) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowDelay) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowDelay) Clone() (FlowDelay, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowDelay() - 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 -} - -// FlowDelay is the optional container to specify the delay before starting -// transmission of packets. -type FlowDelay interface { - Validation - // msg marshals FlowDelay to protobuf object *otg.FlowDelay - // and doesn't set defaults - msg() *otg.FlowDelay - // setMsg unmarshals FlowDelay from protobuf object *otg.FlowDelay - // and doesn't set defaults - setMsg(*otg.FlowDelay) FlowDelay - // provides marshal interface - Marshal() marshalFlowDelay - // provides unmarshal interface - Unmarshal() unMarshalFlowDelay - // validate validates FlowDelay - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowDelay, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowDelayChoiceEnum, set in FlowDelay - Choice() FlowDelayChoiceEnum - // setChoice assigns FlowDelayChoiceEnum provided by user to FlowDelay - setChoice(value FlowDelayChoiceEnum) FlowDelay - // HasChoice checks if Choice has been set in FlowDelay - HasChoice() bool - // Bytes returns float32, set in FlowDelay. - Bytes() float32 - // SetBytes assigns float32 provided by user to FlowDelay - SetBytes(value float32) FlowDelay - // HasBytes checks if Bytes has been set in FlowDelay - HasBytes() bool - // Nanoseconds returns float32, set in FlowDelay. - Nanoseconds() float32 - // SetNanoseconds assigns float32 provided by user to FlowDelay - SetNanoseconds(value float32) FlowDelay - // HasNanoseconds checks if Nanoseconds has been set in FlowDelay - HasNanoseconds() bool - // Microseconds returns float32, set in FlowDelay. - Microseconds() float32 - // SetMicroseconds assigns float32 provided by user to FlowDelay - SetMicroseconds(value float32) FlowDelay - // HasMicroseconds checks if Microseconds has been set in FlowDelay - HasMicroseconds() bool -} - -type FlowDelayChoiceEnum string - -// Enum of Choice on FlowDelay -var FlowDelayChoice = struct { - BYTES FlowDelayChoiceEnum - NANOSECONDS FlowDelayChoiceEnum - MICROSECONDS FlowDelayChoiceEnum -}{ - BYTES: FlowDelayChoiceEnum("bytes"), - NANOSECONDS: FlowDelayChoiceEnum("nanoseconds"), - MICROSECONDS: FlowDelayChoiceEnum("microseconds"), -} - -func (obj *flowDelay) Choice() FlowDelayChoiceEnum { - return FlowDelayChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowDelay) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowDelay) setChoice(value FlowDelayChoiceEnum) FlowDelay { - intValue, ok := otg.FlowDelay_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowDelayChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowDelay_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Microseconds = nil - obj.obj.Nanoseconds = nil - obj.obj.Bytes = nil - - if value == FlowDelayChoice.BYTES { - defaultValue := float32(0) - obj.obj.Bytes = &defaultValue - } - - if value == FlowDelayChoice.NANOSECONDS { - defaultValue := float32(0) - obj.obj.Nanoseconds = &defaultValue - } - - if value == FlowDelayChoice.MICROSECONDS { - defaultValue := float32(0) - obj.obj.Microseconds = &defaultValue - } - - return obj -} - -// The delay before starting transmission of packets. -// A value of 0 indicates no delay. -// Bytes returns a float32 -func (obj *flowDelay) Bytes() float32 { - - if obj.obj.Bytes == nil { - obj.setChoice(FlowDelayChoice.BYTES) - } - - return *obj.obj.Bytes - -} - -// The delay before starting transmission of packets. -// A value of 0 indicates no delay. -// Bytes returns a float32 -func (obj *flowDelay) HasBytes() bool { - return obj.obj.Bytes != nil -} - -// The delay before starting transmission of packets. -// A value of 0 indicates no delay. -// SetBytes sets the float32 value in the FlowDelay object -func (obj *flowDelay) SetBytes(value float32) FlowDelay { - obj.setChoice(FlowDelayChoice.BYTES) - obj.obj.Bytes = &value - return obj -} - -// The delay before starting transmission of packets. -// A value of 0 indicates no delay. -// Nanoseconds returns a float32 -func (obj *flowDelay) Nanoseconds() float32 { - - if obj.obj.Nanoseconds == nil { - obj.setChoice(FlowDelayChoice.NANOSECONDS) - } - - return *obj.obj.Nanoseconds - -} - -// The delay before starting transmission of packets. -// A value of 0 indicates no delay. -// Nanoseconds returns a float32 -func (obj *flowDelay) HasNanoseconds() bool { - return obj.obj.Nanoseconds != nil -} - -// The delay before starting transmission of packets. -// A value of 0 indicates no delay. -// SetNanoseconds sets the float32 value in the FlowDelay object -func (obj *flowDelay) SetNanoseconds(value float32) FlowDelay { - obj.setChoice(FlowDelayChoice.NANOSECONDS) - obj.obj.Nanoseconds = &value - return obj -} - -// The delay before starting transmission of packets. -// A value of 0 indicates no delay. -// Microseconds returns a float32 -func (obj *flowDelay) Microseconds() float32 { - - if obj.obj.Microseconds == nil { - obj.setChoice(FlowDelayChoice.MICROSECONDS) - } - - return *obj.obj.Microseconds - -} - -// The delay before starting transmission of packets. -// A value of 0 indicates no delay. -// Microseconds returns a float32 -func (obj *flowDelay) HasMicroseconds() bool { - return obj.obj.Microseconds != nil -} - -// The delay before starting transmission of packets. -// A value of 0 indicates no delay. -// SetMicroseconds sets the float32 value in the FlowDelay object -func (obj *flowDelay) SetMicroseconds(value float32) FlowDelay { - obj.setChoice(FlowDelayChoice.MICROSECONDS) - obj.obj.Microseconds = &value - return obj -} - -func (obj *flowDelay) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Bytes != nil { - - if *obj.obj.Bytes < 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowDelay.Bytes <= max(float32) but Got %f", *obj.obj.Bytes)) - } - - } - - if obj.obj.Nanoseconds != nil { - - if *obj.obj.Nanoseconds < 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowDelay.Nanoseconds <= max(float32) but Got %f", *obj.obj.Nanoseconds)) - } - - } - - if obj.obj.Microseconds != nil { - - if *obj.obj.Microseconds < 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowDelay.Microseconds <= max(float32) but Got %f", *obj.obj.Microseconds)) - } - - } - -} - -func (obj *flowDelay) setDefault() { - var choices_set int = 0 - var choice FlowDelayChoiceEnum - - if obj.obj.Bytes != nil { - choices_set += 1 - choice = FlowDelayChoice.BYTES - } - - if obj.obj.Nanoseconds != nil { - choices_set += 1 - choice = FlowDelayChoice.NANOSECONDS - } - - if obj.obj.Microseconds != nil { - choices_set += 1 - choice = FlowDelayChoice.MICROSECONDS - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowDelayChoice.BYTES) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowDelay") - } - } else { - intVal := otg.FlowDelay_Choice_Enum_value[string(choice)] - enumValue := otg.FlowDelay_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowDurationInterBurstGap ***** -type flowDurationInterBurstGap struct { - validation - obj *otg.FlowDurationInterBurstGap - marshaller marshalFlowDurationInterBurstGap - unMarshaller unMarshalFlowDurationInterBurstGap -} - -func NewFlowDurationInterBurstGap() FlowDurationInterBurstGap { - obj := flowDurationInterBurstGap{obj: &otg.FlowDurationInterBurstGap{}} - obj.setDefault() - return &obj -} - -func (obj *flowDurationInterBurstGap) msg() *otg.FlowDurationInterBurstGap { - return obj.obj -} - -func (obj *flowDurationInterBurstGap) setMsg(msg *otg.FlowDurationInterBurstGap) FlowDurationInterBurstGap { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowDurationInterBurstGap struct { - obj *flowDurationInterBurstGap -} - -type marshalFlowDurationInterBurstGap interface { - // ToProto marshals FlowDurationInterBurstGap to protobuf object *otg.FlowDurationInterBurstGap - ToProto() (*otg.FlowDurationInterBurstGap, error) - // ToPbText marshals FlowDurationInterBurstGap to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowDurationInterBurstGap to YAML text - ToYaml() (string, error) - // ToJson marshals FlowDurationInterBurstGap to JSON text - ToJson() (string, error) -} - -type unMarshalflowDurationInterBurstGap struct { - obj *flowDurationInterBurstGap -} - -type unMarshalFlowDurationInterBurstGap interface { - // FromProto unmarshals FlowDurationInterBurstGap from protobuf object *otg.FlowDurationInterBurstGap - FromProto(msg *otg.FlowDurationInterBurstGap) (FlowDurationInterBurstGap, error) - // FromPbText unmarshals FlowDurationInterBurstGap from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowDurationInterBurstGap from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowDurationInterBurstGap from JSON text - FromJson(value string) error -} - -func (obj *flowDurationInterBurstGap) Marshal() marshalFlowDurationInterBurstGap { - if obj.marshaller == nil { - obj.marshaller = &marshalflowDurationInterBurstGap{obj: obj} - } - return obj.marshaller -} - -func (obj *flowDurationInterBurstGap) Unmarshal() unMarshalFlowDurationInterBurstGap { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowDurationInterBurstGap{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowDurationInterBurstGap) ToProto() (*otg.FlowDurationInterBurstGap, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowDurationInterBurstGap) FromProto(msg *otg.FlowDurationInterBurstGap) (FlowDurationInterBurstGap, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowDurationInterBurstGap) 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 *unMarshalflowDurationInterBurstGap) 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 *marshalflowDurationInterBurstGap) 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 *unMarshalflowDurationInterBurstGap) 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 *marshalflowDurationInterBurstGap) 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 *unMarshalflowDurationInterBurstGap) 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 *flowDurationInterBurstGap) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowDurationInterBurstGap) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowDurationInterBurstGap) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowDurationInterBurstGap) Clone() (FlowDurationInterBurstGap, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowDurationInterBurstGap() - 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 -} - -// FlowDurationInterBurstGap is the optional container for specifying a gap between bursts. -type FlowDurationInterBurstGap interface { - Validation - // msg marshals FlowDurationInterBurstGap to protobuf object *otg.FlowDurationInterBurstGap - // and doesn't set defaults - msg() *otg.FlowDurationInterBurstGap - // setMsg unmarshals FlowDurationInterBurstGap from protobuf object *otg.FlowDurationInterBurstGap - // and doesn't set defaults - setMsg(*otg.FlowDurationInterBurstGap) FlowDurationInterBurstGap - // provides marshal interface - Marshal() marshalFlowDurationInterBurstGap - // provides unmarshal interface - Unmarshal() unMarshalFlowDurationInterBurstGap - // validate validates FlowDurationInterBurstGap - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowDurationInterBurstGap, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowDurationInterBurstGapChoiceEnum, set in FlowDurationInterBurstGap - Choice() FlowDurationInterBurstGapChoiceEnum - // setChoice assigns FlowDurationInterBurstGapChoiceEnum provided by user to FlowDurationInterBurstGap - setChoice(value FlowDurationInterBurstGapChoiceEnum) FlowDurationInterBurstGap - // HasChoice checks if Choice has been set in FlowDurationInterBurstGap - HasChoice() bool - // Bytes returns float64, set in FlowDurationInterBurstGap. - Bytes() float64 - // SetBytes assigns float64 provided by user to FlowDurationInterBurstGap - SetBytes(value float64) FlowDurationInterBurstGap - // HasBytes checks if Bytes has been set in FlowDurationInterBurstGap - HasBytes() bool - // Nanoseconds returns float64, set in FlowDurationInterBurstGap. - Nanoseconds() float64 - // SetNanoseconds assigns float64 provided by user to FlowDurationInterBurstGap - SetNanoseconds(value float64) FlowDurationInterBurstGap - // HasNanoseconds checks if Nanoseconds has been set in FlowDurationInterBurstGap - HasNanoseconds() bool - // Microseconds returns float64, set in FlowDurationInterBurstGap. - Microseconds() float64 - // SetMicroseconds assigns float64 provided by user to FlowDurationInterBurstGap - SetMicroseconds(value float64) FlowDurationInterBurstGap - // HasMicroseconds checks if Microseconds has been set in FlowDurationInterBurstGap - HasMicroseconds() bool -} - -type FlowDurationInterBurstGapChoiceEnum string - -// Enum of Choice on FlowDurationInterBurstGap -var FlowDurationInterBurstGapChoice = struct { - BYTES FlowDurationInterBurstGapChoiceEnum - NANOSECONDS FlowDurationInterBurstGapChoiceEnum - MICROSECONDS FlowDurationInterBurstGapChoiceEnum -}{ - BYTES: FlowDurationInterBurstGapChoiceEnum("bytes"), - NANOSECONDS: FlowDurationInterBurstGapChoiceEnum("nanoseconds"), - MICROSECONDS: FlowDurationInterBurstGapChoiceEnum("microseconds"), -} - -func (obj *flowDurationInterBurstGap) Choice() FlowDurationInterBurstGapChoiceEnum { - return FlowDurationInterBurstGapChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The type of inter burst gap units. -// Choice returns a string -func (obj *flowDurationInterBurstGap) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowDurationInterBurstGap) setChoice(value FlowDurationInterBurstGapChoiceEnum) FlowDurationInterBurstGap { - intValue, ok := otg.FlowDurationInterBurstGap_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowDurationInterBurstGapChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowDurationInterBurstGap_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Microseconds = nil - obj.obj.Nanoseconds = nil - obj.obj.Bytes = nil - - if value == FlowDurationInterBurstGapChoice.BYTES { - defaultValue := float64(12) - obj.obj.Bytes = &defaultValue - } - - if value == FlowDurationInterBurstGapChoice.NANOSECONDS { - defaultValue := float64(96) - obj.obj.Nanoseconds = &defaultValue - } - - if value == FlowDurationInterBurstGapChoice.MICROSECONDS { - defaultValue := float64(0.096) - obj.obj.Microseconds = &defaultValue - } - - return obj -} - -// The amount of time between bursts expressed in bytes. -// A value of 0 indicates no gap between bursts. -// Bytes returns a float64 -func (obj *flowDurationInterBurstGap) Bytes() float64 { - - if obj.obj.Bytes == nil { - obj.setChoice(FlowDurationInterBurstGapChoice.BYTES) - } - - return *obj.obj.Bytes - -} - -// The amount of time between bursts expressed in bytes. -// A value of 0 indicates no gap between bursts. -// Bytes returns a float64 -func (obj *flowDurationInterBurstGap) HasBytes() bool { - return obj.obj.Bytes != nil -} - -// The amount of time between bursts expressed in bytes. -// A value of 0 indicates no gap between bursts. -// SetBytes sets the float64 value in the FlowDurationInterBurstGap object -func (obj *flowDurationInterBurstGap) SetBytes(value float64) FlowDurationInterBurstGap { - obj.setChoice(FlowDurationInterBurstGapChoice.BYTES) - obj.obj.Bytes = &value - return obj -} - -// The amount of time between bursts expressed in nanoseconds. -// A value of 0 indicates no gap between bursts. -// Nanoseconds returns a float64 -func (obj *flowDurationInterBurstGap) Nanoseconds() float64 { - - if obj.obj.Nanoseconds == nil { - obj.setChoice(FlowDurationInterBurstGapChoice.NANOSECONDS) - } - - return *obj.obj.Nanoseconds - -} - -// The amount of time between bursts expressed in nanoseconds. -// A value of 0 indicates no gap between bursts. -// Nanoseconds returns a float64 -func (obj *flowDurationInterBurstGap) HasNanoseconds() bool { - return obj.obj.Nanoseconds != nil -} - -// The amount of time between bursts expressed in nanoseconds. -// A value of 0 indicates no gap between bursts. -// SetNanoseconds sets the float64 value in the FlowDurationInterBurstGap object -func (obj *flowDurationInterBurstGap) SetNanoseconds(value float64) FlowDurationInterBurstGap { - obj.setChoice(FlowDurationInterBurstGapChoice.NANOSECONDS) - obj.obj.Nanoseconds = &value - return obj -} - -// The amount of time between bursts expressed in microseconds. -// A value of 0 indicates no gap between bursts. -// Microseconds returns a float64 -func (obj *flowDurationInterBurstGap) Microseconds() float64 { - - if obj.obj.Microseconds == nil { - obj.setChoice(FlowDurationInterBurstGapChoice.MICROSECONDS) - } - - return *obj.obj.Microseconds - -} - -// The amount of time between bursts expressed in microseconds. -// A value of 0 indicates no gap between bursts. -// Microseconds returns a float64 -func (obj *flowDurationInterBurstGap) HasMicroseconds() bool { - return obj.obj.Microseconds != nil -} - -// The amount of time between bursts expressed in microseconds. -// A value of 0 indicates no gap between bursts. -// SetMicroseconds sets the float64 value in the FlowDurationInterBurstGap object -func (obj *flowDurationInterBurstGap) SetMicroseconds(value float64) FlowDurationInterBurstGap { - obj.setChoice(FlowDurationInterBurstGapChoice.MICROSECONDS) - obj.obj.Microseconds = &value - return obj -} - -func (obj *flowDurationInterBurstGap) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Bytes != nil { - - if *obj.obj.Bytes < 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowDurationInterBurstGap.Bytes <= max(float64) but Got %f", *obj.obj.Bytes)) - } - - } - - if obj.obj.Nanoseconds != nil { - - if *obj.obj.Nanoseconds < 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowDurationInterBurstGap.Nanoseconds <= max(float64) but Got %f", *obj.obj.Nanoseconds)) - } - - } - - if obj.obj.Microseconds != nil { - - if *obj.obj.Microseconds < 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowDurationInterBurstGap.Microseconds <= max(float64) but Got %f", *obj.obj.Microseconds)) - } - - } - -} - -func (obj *flowDurationInterBurstGap) setDefault() { - var choices_set int = 0 - var choice FlowDurationInterBurstGapChoiceEnum - - if obj.obj.Bytes != nil { - choices_set += 1 - choice = FlowDurationInterBurstGapChoice.BYTES - } - - if obj.obj.Nanoseconds != nil { - choices_set += 1 - choice = FlowDurationInterBurstGapChoice.NANOSECONDS - } - - if obj.obj.Microseconds != nil { - choices_set += 1 - choice = FlowDurationInterBurstGapChoice.MICROSECONDS - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowDurationInterBurstGapChoice.BYTES) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowDurationInterBurstGap") - } - } else { - intVal := otg.FlowDurationInterBurstGap_Choice_Enum_value[string(choice)] - enumValue := otg.FlowDurationInterBurstGap_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRxTxRatioRxCount ***** -type flowRxTxRatioRxCount struct { - validation - obj *otg.FlowRxTxRatioRxCount - marshaller marshalFlowRxTxRatioRxCount - unMarshaller unMarshalFlowRxTxRatioRxCount -} - -func NewFlowRxTxRatioRxCount() FlowRxTxRatioRxCount { - obj := flowRxTxRatioRxCount{obj: &otg.FlowRxTxRatioRxCount{}} - obj.setDefault() - return &obj -} - -func (obj *flowRxTxRatioRxCount) msg() *otg.FlowRxTxRatioRxCount { - return obj.obj -} - -func (obj *flowRxTxRatioRxCount) setMsg(msg *otg.FlowRxTxRatioRxCount) FlowRxTxRatioRxCount { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRxTxRatioRxCount struct { - obj *flowRxTxRatioRxCount -} - -type marshalFlowRxTxRatioRxCount interface { - // ToProto marshals FlowRxTxRatioRxCount to protobuf object *otg.FlowRxTxRatioRxCount - ToProto() (*otg.FlowRxTxRatioRxCount, error) - // ToPbText marshals FlowRxTxRatioRxCount to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRxTxRatioRxCount to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRxTxRatioRxCount to JSON text - ToJson() (string, error) -} - -type unMarshalflowRxTxRatioRxCount struct { - obj *flowRxTxRatioRxCount -} - -type unMarshalFlowRxTxRatioRxCount interface { - // FromProto unmarshals FlowRxTxRatioRxCount from protobuf object *otg.FlowRxTxRatioRxCount - FromProto(msg *otg.FlowRxTxRatioRxCount) (FlowRxTxRatioRxCount, error) - // FromPbText unmarshals FlowRxTxRatioRxCount from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRxTxRatioRxCount from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRxTxRatioRxCount from JSON text - FromJson(value string) error -} - -func (obj *flowRxTxRatioRxCount) Marshal() marshalFlowRxTxRatioRxCount { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRxTxRatioRxCount{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRxTxRatioRxCount) Unmarshal() unMarshalFlowRxTxRatioRxCount { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRxTxRatioRxCount{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRxTxRatioRxCount) ToProto() (*otg.FlowRxTxRatioRxCount, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRxTxRatioRxCount) FromProto(msg *otg.FlowRxTxRatioRxCount) (FlowRxTxRatioRxCount, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRxTxRatioRxCount) 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 *unMarshalflowRxTxRatioRxCount) 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 *marshalflowRxTxRatioRxCount) 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 *unMarshalflowRxTxRatioRxCount) 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 *marshalflowRxTxRatioRxCount) 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 *unMarshalflowRxTxRatioRxCount) 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 *flowRxTxRatioRxCount) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRxTxRatioRxCount) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRxTxRatioRxCount) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRxTxRatioRxCount) Clone() (FlowRxTxRatioRxCount, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRxTxRatioRxCount() - 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 -} - -// FlowRxTxRatioRxCount is this is for cases where one copy of Tx packet is received on all Rx ports and so the sum total of Rx packets -// received across all Rx ports is a multiple of Rx port count and Tx packets. -type FlowRxTxRatioRxCount interface { - Validation - // msg marshals FlowRxTxRatioRxCount to protobuf object *otg.FlowRxTxRatioRxCount - // and doesn't set defaults - msg() *otg.FlowRxTxRatioRxCount - // setMsg unmarshals FlowRxTxRatioRxCount from protobuf object *otg.FlowRxTxRatioRxCount - // and doesn't set defaults - setMsg(*otg.FlowRxTxRatioRxCount) FlowRxTxRatioRxCount - // provides marshal interface - Marshal() marshalFlowRxTxRatioRxCount - // provides unmarshal interface - Unmarshal() unMarshalFlowRxTxRatioRxCount - // validate validates FlowRxTxRatioRxCount - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRxTxRatioRxCount, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() -} - -func (obj *flowRxTxRatioRxCount) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *flowRxTxRatioRxCount) setDefault() { - -} - -// ***** ActionProtocolIpv4PingRequest ***** -type actionProtocolIpv4PingRequest struct { - validation - obj *otg.ActionProtocolIpv4PingRequest - marshaller marshalActionProtocolIpv4PingRequest - unMarshaller unMarshalActionProtocolIpv4PingRequest -} - -func NewActionProtocolIpv4PingRequest() ActionProtocolIpv4PingRequest { - obj := actionProtocolIpv4PingRequest{obj: &otg.ActionProtocolIpv4PingRequest{}} - obj.setDefault() - return &obj -} - -func (obj *actionProtocolIpv4PingRequest) msg() *otg.ActionProtocolIpv4PingRequest { - return obj.obj -} - -func (obj *actionProtocolIpv4PingRequest) setMsg(msg *otg.ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionProtocolIpv4PingRequest struct { - obj *actionProtocolIpv4PingRequest -} - -type marshalActionProtocolIpv4PingRequest interface { - // ToProto marshals ActionProtocolIpv4PingRequest to protobuf object *otg.ActionProtocolIpv4PingRequest - ToProto() (*otg.ActionProtocolIpv4PingRequest, error) - // ToPbText marshals ActionProtocolIpv4PingRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionProtocolIpv4PingRequest to YAML text - ToYaml() (string, error) - // ToJson marshals ActionProtocolIpv4PingRequest to JSON text - ToJson() (string, error) -} - -type unMarshalactionProtocolIpv4PingRequest struct { - obj *actionProtocolIpv4PingRequest -} - -type unMarshalActionProtocolIpv4PingRequest interface { - // FromProto unmarshals ActionProtocolIpv4PingRequest from protobuf object *otg.ActionProtocolIpv4PingRequest - FromProto(msg *otg.ActionProtocolIpv4PingRequest) (ActionProtocolIpv4PingRequest, error) - // FromPbText unmarshals ActionProtocolIpv4PingRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionProtocolIpv4PingRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionProtocolIpv4PingRequest from JSON text - FromJson(value string) error -} - -func (obj *actionProtocolIpv4PingRequest) Marshal() marshalActionProtocolIpv4PingRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalactionProtocolIpv4PingRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *actionProtocolIpv4PingRequest) Unmarshal() unMarshalActionProtocolIpv4PingRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionProtocolIpv4PingRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionProtocolIpv4PingRequest) ToProto() (*otg.ActionProtocolIpv4PingRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionProtocolIpv4PingRequest) FromProto(msg *otg.ActionProtocolIpv4PingRequest) (ActionProtocolIpv4PingRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionProtocolIpv4PingRequest) 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 *unMarshalactionProtocolIpv4PingRequest) 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 *marshalactionProtocolIpv4PingRequest) 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 *unMarshalactionProtocolIpv4PingRequest) 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 *marshalactionProtocolIpv4PingRequest) 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 *unMarshalactionProtocolIpv4PingRequest) 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 *actionProtocolIpv4PingRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionProtocolIpv4PingRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionProtocolIpv4PingRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionProtocolIpv4PingRequest) Clone() (ActionProtocolIpv4PingRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionProtocolIpv4PingRequest() - 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 -} - -// ActionProtocolIpv4PingRequest is under Review: Most ping request parameters are still TBD. -// -// Under Review: Most ping request parameters are still TBD. -// -// Request for initiating ping between a single source and destination pair. -// For ping request, 1 IPv4 ICMP Echo Request shall be sent and wait for ping response to either succeed or time out. The API wait timeout for each request shall be 300ms. -type ActionProtocolIpv4PingRequest interface { - Validation - // msg marshals ActionProtocolIpv4PingRequest to protobuf object *otg.ActionProtocolIpv4PingRequest - // and doesn't set defaults - msg() *otg.ActionProtocolIpv4PingRequest - // setMsg unmarshals ActionProtocolIpv4PingRequest from protobuf object *otg.ActionProtocolIpv4PingRequest - // and doesn't set defaults - setMsg(*otg.ActionProtocolIpv4PingRequest) ActionProtocolIpv4PingRequest - // provides marshal interface - Marshal() marshalActionProtocolIpv4PingRequest - // provides unmarshal interface - Unmarshal() unMarshalActionProtocolIpv4PingRequest - // validate validates ActionProtocolIpv4PingRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionProtocolIpv4PingRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // SrcName returns string, set in ActionProtocolIpv4PingRequest. - SrcName() string - // SetSrcName assigns string provided by user to ActionProtocolIpv4PingRequest - SetSrcName(value string) ActionProtocolIpv4PingRequest - // HasSrcName checks if SrcName has been set in ActionProtocolIpv4PingRequest - HasSrcName() bool - // DstIp returns string, set in ActionProtocolIpv4PingRequest. - DstIp() string - // SetDstIp assigns string provided by user to ActionProtocolIpv4PingRequest - SetDstIp(value string) ActionProtocolIpv4PingRequest - // HasDstIp checks if DstIp has been set in ActionProtocolIpv4PingRequest - HasDstIp() bool -} - -// Name of source IPv4 interface to be used. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// SrcName returns a string -func (obj *actionProtocolIpv4PingRequest) SrcName() string { - - return *obj.obj.SrcName - -} - -// Name of source IPv4 interface to be used. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// SrcName returns a string -func (obj *actionProtocolIpv4PingRequest) HasSrcName() bool { - return obj.obj.SrcName != nil -} - -// Name of source IPv4 interface to be used. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// SetSrcName sets the string value in the ActionProtocolIpv4PingRequest object -func (obj *actionProtocolIpv4PingRequest) SetSrcName(value string) ActionProtocolIpv4PingRequest { - - obj.obj.SrcName = &value - return obj -} - -// Destination IPv4 address to ping. -// DstIp returns a string -func (obj *actionProtocolIpv4PingRequest) DstIp() string { - - return *obj.obj.DstIp - -} - -// Destination IPv4 address to ping. -// DstIp returns a string -func (obj *actionProtocolIpv4PingRequest) HasDstIp() bool { - return obj.obj.DstIp != nil -} - -// Destination IPv4 address to ping. -// SetDstIp sets the string value in the ActionProtocolIpv4PingRequest object -func (obj *actionProtocolIpv4PingRequest) SetDstIp(value string) ActionProtocolIpv4PingRequest { - - obj.obj.DstIp = &value - return obj -} - -func (obj *actionProtocolIpv4PingRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - obj.addWarnings("ActionProtocolIpv4PingRequest is under review, Most ping request parameters are still TBD.") - - if obj.obj.DstIp != nil { - - err := obj.validateIpv4(obj.DstIp()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on ActionProtocolIpv4PingRequest.DstIp")) - } - - } - -} - -func (obj *actionProtocolIpv4PingRequest) setDefault() { - -} - -// ***** ActionProtocolIpv6PingRequest ***** -type actionProtocolIpv6PingRequest struct { - validation - obj *otg.ActionProtocolIpv6PingRequest - marshaller marshalActionProtocolIpv6PingRequest - unMarshaller unMarshalActionProtocolIpv6PingRequest -} - -func NewActionProtocolIpv6PingRequest() ActionProtocolIpv6PingRequest { - obj := actionProtocolIpv6PingRequest{obj: &otg.ActionProtocolIpv6PingRequest{}} - obj.setDefault() - return &obj -} - -func (obj *actionProtocolIpv6PingRequest) msg() *otg.ActionProtocolIpv6PingRequest { - return obj.obj -} - -func (obj *actionProtocolIpv6PingRequest) setMsg(msg *otg.ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingRequest { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionProtocolIpv6PingRequest struct { - obj *actionProtocolIpv6PingRequest -} - -type marshalActionProtocolIpv6PingRequest interface { - // ToProto marshals ActionProtocolIpv6PingRequest to protobuf object *otg.ActionProtocolIpv6PingRequest - ToProto() (*otg.ActionProtocolIpv6PingRequest, error) - // ToPbText marshals ActionProtocolIpv6PingRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionProtocolIpv6PingRequest to YAML text - ToYaml() (string, error) - // ToJson marshals ActionProtocolIpv6PingRequest to JSON text - ToJson() (string, error) -} - -type unMarshalactionProtocolIpv6PingRequest struct { - obj *actionProtocolIpv6PingRequest -} - -type unMarshalActionProtocolIpv6PingRequest interface { - // FromProto unmarshals ActionProtocolIpv6PingRequest from protobuf object *otg.ActionProtocolIpv6PingRequest - FromProto(msg *otg.ActionProtocolIpv6PingRequest) (ActionProtocolIpv6PingRequest, error) - // FromPbText unmarshals ActionProtocolIpv6PingRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionProtocolIpv6PingRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionProtocolIpv6PingRequest from JSON text - FromJson(value string) error -} - -func (obj *actionProtocolIpv6PingRequest) Marshal() marshalActionProtocolIpv6PingRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalactionProtocolIpv6PingRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *actionProtocolIpv6PingRequest) Unmarshal() unMarshalActionProtocolIpv6PingRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionProtocolIpv6PingRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionProtocolIpv6PingRequest) ToProto() (*otg.ActionProtocolIpv6PingRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionProtocolIpv6PingRequest) FromProto(msg *otg.ActionProtocolIpv6PingRequest) (ActionProtocolIpv6PingRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionProtocolIpv6PingRequest) 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 *unMarshalactionProtocolIpv6PingRequest) 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 *marshalactionProtocolIpv6PingRequest) 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 *unMarshalactionProtocolIpv6PingRequest) 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 *marshalactionProtocolIpv6PingRequest) 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 *unMarshalactionProtocolIpv6PingRequest) 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 *actionProtocolIpv6PingRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionProtocolIpv6PingRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionProtocolIpv6PingRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionProtocolIpv6PingRequest) Clone() (ActionProtocolIpv6PingRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionProtocolIpv6PingRequest() - 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 -} - -// ActionProtocolIpv6PingRequest is under Review: Most ping request parameters are still TBD. -// -// Under Review: Most ping request parameters are still TBD. -// -// Request for initiating ping between a single source and destination pair. -// For ping request, 1 IPv6 ICMP Echo Request shall be sent and wait for ping response to either succeed or time out. The API wait timeout for each request shall be 300ms. -type ActionProtocolIpv6PingRequest interface { - Validation - // msg marshals ActionProtocolIpv6PingRequest to protobuf object *otg.ActionProtocolIpv6PingRequest - // and doesn't set defaults - msg() *otg.ActionProtocolIpv6PingRequest - // setMsg unmarshals ActionProtocolIpv6PingRequest from protobuf object *otg.ActionProtocolIpv6PingRequest - // and doesn't set defaults - setMsg(*otg.ActionProtocolIpv6PingRequest) ActionProtocolIpv6PingRequest - // provides marshal interface - Marshal() marshalActionProtocolIpv6PingRequest - // provides unmarshal interface - Unmarshal() unMarshalActionProtocolIpv6PingRequest - // validate validates ActionProtocolIpv6PingRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionProtocolIpv6PingRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // SrcName returns string, set in ActionProtocolIpv6PingRequest. - SrcName() string - // SetSrcName assigns string provided by user to ActionProtocolIpv6PingRequest - SetSrcName(value string) ActionProtocolIpv6PingRequest - // HasSrcName checks if SrcName has been set in ActionProtocolIpv6PingRequest - HasSrcName() bool - // DstIp returns string, set in ActionProtocolIpv6PingRequest. - DstIp() string - // SetDstIp assigns string provided by user to ActionProtocolIpv6PingRequest - SetDstIp(value string) ActionProtocolIpv6PingRequest - // HasDstIp checks if DstIp has been set in ActionProtocolIpv6PingRequest - HasDstIp() bool -} - -// Name of source IPv6 interface to be used. -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// -// SrcName returns a string -func (obj *actionProtocolIpv6PingRequest) SrcName() string { - - return *obj.obj.SrcName - -} - -// Name of source IPv6 interface to be used. -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// -// SrcName returns a string -func (obj *actionProtocolIpv6PingRequest) HasSrcName() bool { - return obj.obj.SrcName != nil -} - -// Name of source IPv6 interface to be used. -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// -// SetSrcName sets the string value in the ActionProtocolIpv6PingRequest object -func (obj *actionProtocolIpv6PingRequest) SetSrcName(value string) ActionProtocolIpv6PingRequest { - - obj.obj.SrcName = &value - return obj -} - -// Destination IPv6 address to ping. -// DstIp returns a string -func (obj *actionProtocolIpv6PingRequest) DstIp() string { - - return *obj.obj.DstIp - -} - -// Destination IPv6 address to ping. -// DstIp returns a string -func (obj *actionProtocolIpv6PingRequest) HasDstIp() bool { - return obj.obj.DstIp != nil -} - -// Destination IPv6 address to ping. -// SetDstIp sets the string value in the ActionProtocolIpv6PingRequest object -func (obj *actionProtocolIpv6PingRequest) SetDstIp(value string) ActionProtocolIpv6PingRequest { - - obj.obj.DstIp = &value - return obj -} - -func (obj *actionProtocolIpv6PingRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - obj.addWarnings("ActionProtocolIpv6PingRequest is under review, Most ping request parameters are still TBD.") - - if obj.obj.DstIp != nil { - - err := obj.validateIpv6(obj.DstIp()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on ActionProtocolIpv6PingRequest.DstIp")) - } - - } - -} - -func (obj *actionProtocolIpv6PingRequest) setDefault() { - -} - -// ***** DeviceBgpCeaseError ***** -type deviceBgpCeaseError struct { - validation - obj *otg.DeviceBgpCeaseError - marshaller marshalDeviceBgpCeaseError - unMarshaller unMarshalDeviceBgpCeaseError -} - -func NewDeviceBgpCeaseError() DeviceBgpCeaseError { - obj := deviceBgpCeaseError{obj: &otg.DeviceBgpCeaseError{}} - obj.setDefault() - return &obj -} - -func (obj *deviceBgpCeaseError) msg() *otg.DeviceBgpCeaseError { - return obj.obj -} - -func (obj *deviceBgpCeaseError) setMsg(msg *otg.DeviceBgpCeaseError) DeviceBgpCeaseError { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceBgpCeaseError struct { - obj *deviceBgpCeaseError -} - -type marshalDeviceBgpCeaseError interface { - // ToProto marshals DeviceBgpCeaseError to protobuf object *otg.DeviceBgpCeaseError - ToProto() (*otg.DeviceBgpCeaseError, error) - // ToPbText marshals DeviceBgpCeaseError to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceBgpCeaseError to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceBgpCeaseError to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceBgpCeaseError struct { - obj *deviceBgpCeaseError -} - -type unMarshalDeviceBgpCeaseError interface { - // FromProto unmarshals DeviceBgpCeaseError from protobuf object *otg.DeviceBgpCeaseError - FromProto(msg *otg.DeviceBgpCeaseError) (DeviceBgpCeaseError, error) - // FromPbText unmarshals DeviceBgpCeaseError from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceBgpCeaseError from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceBgpCeaseError from JSON text - FromJson(value string) error -} - -func (obj *deviceBgpCeaseError) Marshal() marshalDeviceBgpCeaseError { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceBgpCeaseError{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceBgpCeaseError) Unmarshal() unMarshalDeviceBgpCeaseError { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceBgpCeaseError{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceBgpCeaseError) ToProto() (*otg.DeviceBgpCeaseError, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceBgpCeaseError) FromProto(msg *otg.DeviceBgpCeaseError) (DeviceBgpCeaseError, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceBgpCeaseError) 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 *unMarshaldeviceBgpCeaseError) 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 *marshaldeviceBgpCeaseError) 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 *unMarshaldeviceBgpCeaseError) 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 *marshaldeviceBgpCeaseError) 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 *unMarshaldeviceBgpCeaseError) 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 *deviceBgpCeaseError) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceBgpCeaseError) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceBgpCeaseError) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceBgpCeaseError) Clone() (DeviceBgpCeaseError, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceBgpCeaseError() - 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 -} - -// DeviceBgpCeaseError is in the absence of any fatal errors, a BGP peer can close its BGP connection by sending the NOTIFICATION message with the Error Code Cease. -type DeviceBgpCeaseError interface { - Validation - // msg marshals DeviceBgpCeaseError to protobuf object *otg.DeviceBgpCeaseError - // and doesn't set defaults - msg() *otg.DeviceBgpCeaseError - // setMsg unmarshals DeviceBgpCeaseError from protobuf object *otg.DeviceBgpCeaseError - // and doesn't set defaults - setMsg(*otg.DeviceBgpCeaseError) DeviceBgpCeaseError - // provides marshal interface - Marshal() marshalDeviceBgpCeaseError - // provides unmarshal interface - Unmarshal() unMarshalDeviceBgpCeaseError - // validate validates DeviceBgpCeaseError - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceBgpCeaseError, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Subcode returns DeviceBgpCeaseErrorSubcodeEnum, set in DeviceBgpCeaseError - Subcode() DeviceBgpCeaseErrorSubcodeEnum - // SetSubcode assigns DeviceBgpCeaseErrorSubcodeEnum provided by user to DeviceBgpCeaseError - SetSubcode(value DeviceBgpCeaseErrorSubcodeEnum) DeviceBgpCeaseError - // HasSubcode checks if Subcode has been set in DeviceBgpCeaseError - HasSubcode() bool -} - -type DeviceBgpCeaseErrorSubcodeEnum string - -// Enum of Subcode on DeviceBgpCeaseError -var DeviceBgpCeaseErrorSubcode = struct { - MAX_NUMBER_PREFIX_REACHED_CODE6_SUBCODE1 DeviceBgpCeaseErrorSubcodeEnum - ADMIN_SHUTDOWN_CODE6_SUBCODE2 DeviceBgpCeaseErrorSubcodeEnum - PEER_DELETED_CODE6_SUBCODE3 DeviceBgpCeaseErrorSubcodeEnum - ADMIN_RESET_CODE6_SUBCODE4 DeviceBgpCeaseErrorSubcodeEnum - CONNECTION_REJECT_CODE6_SUBCODE5 DeviceBgpCeaseErrorSubcodeEnum - OTHER_CONFIG_CHANGES_CODE6_SUBCODE6 DeviceBgpCeaseErrorSubcodeEnum - CONNECTION_COLLISION_RESOLUTION_CODE6_SUBCODE7 DeviceBgpCeaseErrorSubcodeEnum - OUT_OF_RESOURCES_CODE6_SUBCODE8 DeviceBgpCeaseErrorSubcodeEnum - BFD_SESSION_DOWN_CODE6_SUBCODE9 DeviceBgpCeaseErrorSubcodeEnum -}{ - MAX_NUMBER_PREFIX_REACHED_CODE6_SUBCODE1: DeviceBgpCeaseErrorSubcodeEnum("max_number_prefix_reached_code6_subcode1"), - ADMIN_SHUTDOWN_CODE6_SUBCODE2: DeviceBgpCeaseErrorSubcodeEnum("admin_shutdown_code6_subcode2"), - PEER_DELETED_CODE6_SUBCODE3: DeviceBgpCeaseErrorSubcodeEnum("peer_deleted_code6_subcode3"), - ADMIN_RESET_CODE6_SUBCODE4: DeviceBgpCeaseErrorSubcodeEnum("admin_reset_code6_subcode4"), - CONNECTION_REJECT_CODE6_SUBCODE5: DeviceBgpCeaseErrorSubcodeEnum("connection_reject_code6_subcode5"), - OTHER_CONFIG_CHANGES_CODE6_SUBCODE6: DeviceBgpCeaseErrorSubcodeEnum("other_config_changes_code6_subcode6"), - CONNECTION_COLLISION_RESOLUTION_CODE6_SUBCODE7: DeviceBgpCeaseErrorSubcodeEnum("connection_collision_resolution_code6_subcode7"), - OUT_OF_RESOURCES_CODE6_SUBCODE8: DeviceBgpCeaseErrorSubcodeEnum("out_of_resources_code6_subcode8"), - BFD_SESSION_DOWN_CODE6_SUBCODE9: DeviceBgpCeaseErrorSubcodeEnum("bfd_session_down_code6_subcode9"), -} - -func (obj *deviceBgpCeaseError) Subcode() DeviceBgpCeaseErrorSubcodeEnum { - return DeviceBgpCeaseErrorSubcodeEnum(obj.obj.Subcode.Enum().String()) -} - -// The Error Subcode to be sent to the peer in the Cease NOTIFICATION. -// Subcode returns a string -func (obj *deviceBgpCeaseError) HasSubcode() bool { - return obj.obj.Subcode != nil -} - -func (obj *deviceBgpCeaseError) SetSubcode(value DeviceBgpCeaseErrorSubcodeEnum) DeviceBgpCeaseError { - intValue, ok := otg.DeviceBgpCeaseError_Subcode_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on DeviceBgpCeaseErrorSubcodeEnum", string(value))) - return obj - } - enumValue := otg.DeviceBgpCeaseError_Subcode_Enum(intValue) - obj.obj.Subcode = &enumValue - - return obj -} - -func (obj *deviceBgpCeaseError) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *deviceBgpCeaseError) setDefault() { - if obj.obj.Subcode == nil { - obj.SetSubcode(DeviceBgpCeaseErrorSubcode.ADMIN_SHUTDOWN_CODE6_SUBCODE2) - - } - -} - -// ***** DeviceBgpMessageHeaderError ***** -type deviceBgpMessageHeaderError struct { - validation - obj *otg.DeviceBgpMessageHeaderError - marshaller marshalDeviceBgpMessageHeaderError - unMarshaller unMarshalDeviceBgpMessageHeaderError -} - -func NewDeviceBgpMessageHeaderError() DeviceBgpMessageHeaderError { - obj := deviceBgpMessageHeaderError{obj: &otg.DeviceBgpMessageHeaderError{}} - obj.setDefault() - return &obj -} - -func (obj *deviceBgpMessageHeaderError) msg() *otg.DeviceBgpMessageHeaderError { - return obj.obj -} - -func (obj *deviceBgpMessageHeaderError) setMsg(msg *otg.DeviceBgpMessageHeaderError) DeviceBgpMessageHeaderError { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceBgpMessageHeaderError struct { - obj *deviceBgpMessageHeaderError -} - -type marshalDeviceBgpMessageHeaderError interface { - // ToProto marshals DeviceBgpMessageHeaderError to protobuf object *otg.DeviceBgpMessageHeaderError - ToProto() (*otg.DeviceBgpMessageHeaderError, error) - // ToPbText marshals DeviceBgpMessageHeaderError to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceBgpMessageHeaderError to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceBgpMessageHeaderError to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceBgpMessageHeaderError struct { - obj *deviceBgpMessageHeaderError -} - -type unMarshalDeviceBgpMessageHeaderError interface { - // FromProto unmarshals DeviceBgpMessageHeaderError from protobuf object *otg.DeviceBgpMessageHeaderError - FromProto(msg *otg.DeviceBgpMessageHeaderError) (DeviceBgpMessageHeaderError, error) - // FromPbText unmarshals DeviceBgpMessageHeaderError from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceBgpMessageHeaderError from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceBgpMessageHeaderError from JSON text - FromJson(value string) error -} - -func (obj *deviceBgpMessageHeaderError) Marshal() marshalDeviceBgpMessageHeaderError { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceBgpMessageHeaderError{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceBgpMessageHeaderError) Unmarshal() unMarshalDeviceBgpMessageHeaderError { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceBgpMessageHeaderError{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceBgpMessageHeaderError) ToProto() (*otg.DeviceBgpMessageHeaderError, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceBgpMessageHeaderError) FromProto(msg *otg.DeviceBgpMessageHeaderError) (DeviceBgpMessageHeaderError, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceBgpMessageHeaderError) 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 *unMarshaldeviceBgpMessageHeaderError) 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 *marshaldeviceBgpMessageHeaderError) 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 *unMarshaldeviceBgpMessageHeaderError) 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 *marshaldeviceBgpMessageHeaderError) 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 *unMarshaldeviceBgpMessageHeaderError) 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 *deviceBgpMessageHeaderError) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceBgpMessageHeaderError) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceBgpMessageHeaderError) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceBgpMessageHeaderError) Clone() (DeviceBgpMessageHeaderError, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceBgpMessageHeaderError() - 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 -} - -// DeviceBgpMessageHeaderError is all errors detected while processing the Message Header are indicated by sending the NOTIFICATION message with the Error Code-Message Header Error. The Error Subcode elaborates on the specific nature of the error. -type DeviceBgpMessageHeaderError interface { - Validation - // msg marshals DeviceBgpMessageHeaderError to protobuf object *otg.DeviceBgpMessageHeaderError - // and doesn't set defaults - msg() *otg.DeviceBgpMessageHeaderError - // setMsg unmarshals DeviceBgpMessageHeaderError from protobuf object *otg.DeviceBgpMessageHeaderError - // and doesn't set defaults - setMsg(*otg.DeviceBgpMessageHeaderError) DeviceBgpMessageHeaderError - // provides marshal interface - Marshal() marshalDeviceBgpMessageHeaderError - // provides unmarshal interface - Unmarshal() unMarshalDeviceBgpMessageHeaderError - // validate validates DeviceBgpMessageHeaderError - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceBgpMessageHeaderError, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Subcode returns DeviceBgpMessageHeaderErrorSubcodeEnum, set in DeviceBgpMessageHeaderError - Subcode() DeviceBgpMessageHeaderErrorSubcodeEnum - // SetSubcode assigns DeviceBgpMessageHeaderErrorSubcodeEnum provided by user to DeviceBgpMessageHeaderError - SetSubcode(value DeviceBgpMessageHeaderErrorSubcodeEnum) DeviceBgpMessageHeaderError - // HasSubcode checks if Subcode has been set in DeviceBgpMessageHeaderError - HasSubcode() bool -} - -type DeviceBgpMessageHeaderErrorSubcodeEnum string - -// Enum of Subcode on DeviceBgpMessageHeaderError -var DeviceBgpMessageHeaderErrorSubcode = struct { - CONNECTION_NOT_SYNCHRONIZED_CODE1_SUBCODE1 DeviceBgpMessageHeaderErrorSubcodeEnum - BAD_MESSAGE_LENGTH_CODE1_SUBCODE2 DeviceBgpMessageHeaderErrorSubcodeEnum - BAD_MESSAGE_TYPE_CODE1_SUBCODE3 DeviceBgpMessageHeaderErrorSubcodeEnum -}{ - CONNECTION_NOT_SYNCHRONIZED_CODE1_SUBCODE1: DeviceBgpMessageHeaderErrorSubcodeEnum("connection_not_synchronized_code1_subcode1"), - BAD_MESSAGE_LENGTH_CODE1_SUBCODE2: DeviceBgpMessageHeaderErrorSubcodeEnum("bad_message_length_code1_subcode2"), - BAD_MESSAGE_TYPE_CODE1_SUBCODE3: DeviceBgpMessageHeaderErrorSubcodeEnum("bad_message_type_code1_subcode3"), -} - -func (obj *deviceBgpMessageHeaderError) Subcode() DeviceBgpMessageHeaderErrorSubcodeEnum { - return DeviceBgpMessageHeaderErrorSubcodeEnum(obj.obj.Subcode.Enum().String()) -} - -// The Error Subcode indicates the specific type of error encountered during Message Header processing. -// Subcode returns a string -func (obj *deviceBgpMessageHeaderError) HasSubcode() bool { - return obj.obj.Subcode != nil -} - -func (obj *deviceBgpMessageHeaderError) SetSubcode(value DeviceBgpMessageHeaderErrorSubcodeEnum) DeviceBgpMessageHeaderError { - intValue, ok := otg.DeviceBgpMessageHeaderError_Subcode_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on DeviceBgpMessageHeaderErrorSubcodeEnum", string(value))) - return obj - } - enumValue := otg.DeviceBgpMessageHeaderError_Subcode_Enum(intValue) - obj.obj.Subcode = &enumValue - - return obj -} - -func (obj *deviceBgpMessageHeaderError) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *deviceBgpMessageHeaderError) setDefault() { - if obj.obj.Subcode == nil { - obj.SetSubcode(DeviceBgpMessageHeaderErrorSubcode.CONNECTION_NOT_SYNCHRONIZED_CODE1_SUBCODE1) - - } - -} - -// ***** DeviceBgpOpenMessageError ***** -type deviceBgpOpenMessageError struct { - validation - obj *otg.DeviceBgpOpenMessageError - marshaller marshalDeviceBgpOpenMessageError - unMarshaller unMarshalDeviceBgpOpenMessageError -} - -func NewDeviceBgpOpenMessageError() DeviceBgpOpenMessageError { - obj := deviceBgpOpenMessageError{obj: &otg.DeviceBgpOpenMessageError{}} - obj.setDefault() - return &obj -} - -func (obj *deviceBgpOpenMessageError) msg() *otg.DeviceBgpOpenMessageError { - return obj.obj -} - -func (obj *deviceBgpOpenMessageError) setMsg(msg *otg.DeviceBgpOpenMessageError) DeviceBgpOpenMessageError { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceBgpOpenMessageError struct { - obj *deviceBgpOpenMessageError -} - -type marshalDeviceBgpOpenMessageError interface { - // ToProto marshals DeviceBgpOpenMessageError to protobuf object *otg.DeviceBgpOpenMessageError - ToProto() (*otg.DeviceBgpOpenMessageError, error) - // ToPbText marshals DeviceBgpOpenMessageError to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceBgpOpenMessageError to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceBgpOpenMessageError to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceBgpOpenMessageError struct { - obj *deviceBgpOpenMessageError -} - -type unMarshalDeviceBgpOpenMessageError interface { - // FromProto unmarshals DeviceBgpOpenMessageError from protobuf object *otg.DeviceBgpOpenMessageError - FromProto(msg *otg.DeviceBgpOpenMessageError) (DeviceBgpOpenMessageError, error) - // FromPbText unmarshals DeviceBgpOpenMessageError from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceBgpOpenMessageError from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceBgpOpenMessageError from JSON text - FromJson(value string) error -} - -func (obj *deviceBgpOpenMessageError) Marshal() marshalDeviceBgpOpenMessageError { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceBgpOpenMessageError{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceBgpOpenMessageError) Unmarshal() unMarshalDeviceBgpOpenMessageError { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceBgpOpenMessageError{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceBgpOpenMessageError) ToProto() (*otg.DeviceBgpOpenMessageError, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceBgpOpenMessageError) FromProto(msg *otg.DeviceBgpOpenMessageError) (DeviceBgpOpenMessageError, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceBgpOpenMessageError) 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 *unMarshaldeviceBgpOpenMessageError) 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 *marshaldeviceBgpOpenMessageError) 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 *unMarshaldeviceBgpOpenMessageError) 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 *marshaldeviceBgpOpenMessageError) 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 *unMarshaldeviceBgpOpenMessageError) 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 *deviceBgpOpenMessageError) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceBgpOpenMessageError) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceBgpOpenMessageError) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceBgpOpenMessageError) Clone() (DeviceBgpOpenMessageError, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceBgpOpenMessageError() - 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 -} - -// DeviceBgpOpenMessageError is all errors detected while processing the OPEN message are indicated by sending the NOTIFICATION message with the Error Code-Open Message Error. The Error Subcode elaborates on the specific nature of the error. -type DeviceBgpOpenMessageError interface { - Validation - // msg marshals DeviceBgpOpenMessageError to protobuf object *otg.DeviceBgpOpenMessageError - // and doesn't set defaults - msg() *otg.DeviceBgpOpenMessageError - // setMsg unmarshals DeviceBgpOpenMessageError from protobuf object *otg.DeviceBgpOpenMessageError - // and doesn't set defaults - setMsg(*otg.DeviceBgpOpenMessageError) DeviceBgpOpenMessageError - // provides marshal interface - Marshal() marshalDeviceBgpOpenMessageError - // provides unmarshal interface - Unmarshal() unMarshalDeviceBgpOpenMessageError - // validate validates DeviceBgpOpenMessageError - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceBgpOpenMessageError, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Subcode returns DeviceBgpOpenMessageErrorSubcodeEnum, set in DeviceBgpOpenMessageError - Subcode() DeviceBgpOpenMessageErrorSubcodeEnum - // SetSubcode assigns DeviceBgpOpenMessageErrorSubcodeEnum provided by user to DeviceBgpOpenMessageError - SetSubcode(value DeviceBgpOpenMessageErrorSubcodeEnum) DeviceBgpOpenMessageError - // HasSubcode checks if Subcode has been set in DeviceBgpOpenMessageError - HasSubcode() bool -} - -type DeviceBgpOpenMessageErrorSubcodeEnum string - -// Enum of Subcode on DeviceBgpOpenMessageError -var DeviceBgpOpenMessageErrorSubcode = struct { - UNSUPPORTED_VERSION_NUMBER_CODE2_SUBCODE1 DeviceBgpOpenMessageErrorSubcodeEnum - ERROR_PEER_AS_CODE2_SUBCODE2 DeviceBgpOpenMessageErrorSubcodeEnum - ERROR_BGP_ID_CODE2_SUBCODE3 DeviceBgpOpenMessageErrorSubcodeEnum - UNSUPPORTED_OPTIONAL_PARAMETER_CODE2_SUBCODE4 DeviceBgpOpenMessageErrorSubcodeEnum - AUTH_FAILED_CODE2_SUBCODE5 DeviceBgpOpenMessageErrorSubcodeEnum - UNSUPPORTED_HOLD_TIME_CODE2_SUBCODE6 DeviceBgpOpenMessageErrorSubcodeEnum - UNSUPPORTED_CAPABILITY_CODE2_SUBCODE7 DeviceBgpOpenMessageErrorSubcodeEnum -}{ - UNSUPPORTED_VERSION_NUMBER_CODE2_SUBCODE1: DeviceBgpOpenMessageErrorSubcodeEnum("unsupported_version_number_code2_subcode1"), - ERROR_PEER_AS_CODE2_SUBCODE2: DeviceBgpOpenMessageErrorSubcodeEnum("error_peer_as_code2_subcode2"), - ERROR_BGP_ID_CODE2_SUBCODE3: DeviceBgpOpenMessageErrorSubcodeEnum("error_bgp_id_code2_subcode3"), - UNSUPPORTED_OPTIONAL_PARAMETER_CODE2_SUBCODE4: DeviceBgpOpenMessageErrorSubcodeEnum("unsupported_optional_parameter_code2_subcode4"), - AUTH_FAILED_CODE2_SUBCODE5: DeviceBgpOpenMessageErrorSubcodeEnum("auth_failed_code2_subcode5"), - UNSUPPORTED_HOLD_TIME_CODE2_SUBCODE6: DeviceBgpOpenMessageErrorSubcodeEnum("unsupported_hold_time_code2_subcode6"), - UNSUPPORTED_CAPABILITY_CODE2_SUBCODE7: DeviceBgpOpenMessageErrorSubcodeEnum("unsupported_capability_code2_subcode7"), -} - -func (obj *deviceBgpOpenMessageError) Subcode() DeviceBgpOpenMessageErrorSubcodeEnum { - return DeviceBgpOpenMessageErrorSubcodeEnum(obj.obj.Subcode.Enum().String()) -} - -// The Error Subcode indicates the specific type of error encountered during OPEN message processing. -// Subcode returns a string -func (obj *deviceBgpOpenMessageError) HasSubcode() bool { - return obj.obj.Subcode != nil -} - -func (obj *deviceBgpOpenMessageError) SetSubcode(value DeviceBgpOpenMessageErrorSubcodeEnum) DeviceBgpOpenMessageError { - intValue, ok := otg.DeviceBgpOpenMessageError_Subcode_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on DeviceBgpOpenMessageErrorSubcodeEnum", string(value))) - return obj - } - enumValue := otg.DeviceBgpOpenMessageError_Subcode_Enum(intValue) - obj.obj.Subcode = &enumValue - - return obj -} - -func (obj *deviceBgpOpenMessageError) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *deviceBgpOpenMessageError) setDefault() { - if obj.obj.Subcode == nil { - obj.SetSubcode(DeviceBgpOpenMessageErrorSubcode.UNSUPPORTED_VERSION_NUMBER_CODE2_SUBCODE1) - - } - -} - -// ***** DeviceBgpUpdateMessageError ***** -type deviceBgpUpdateMessageError struct { - validation - obj *otg.DeviceBgpUpdateMessageError - marshaller marshalDeviceBgpUpdateMessageError - unMarshaller unMarshalDeviceBgpUpdateMessageError -} - -func NewDeviceBgpUpdateMessageError() DeviceBgpUpdateMessageError { - obj := deviceBgpUpdateMessageError{obj: &otg.DeviceBgpUpdateMessageError{}} - obj.setDefault() - return &obj -} - -func (obj *deviceBgpUpdateMessageError) msg() *otg.DeviceBgpUpdateMessageError { - return obj.obj -} - -func (obj *deviceBgpUpdateMessageError) setMsg(msg *otg.DeviceBgpUpdateMessageError) DeviceBgpUpdateMessageError { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceBgpUpdateMessageError struct { - obj *deviceBgpUpdateMessageError -} - -type marshalDeviceBgpUpdateMessageError interface { - // ToProto marshals DeviceBgpUpdateMessageError to protobuf object *otg.DeviceBgpUpdateMessageError - ToProto() (*otg.DeviceBgpUpdateMessageError, error) - // ToPbText marshals DeviceBgpUpdateMessageError to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceBgpUpdateMessageError to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceBgpUpdateMessageError to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceBgpUpdateMessageError struct { - obj *deviceBgpUpdateMessageError -} - -type unMarshalDeviceBgpUpdateMessageError interface { - // FromProto unmarshals DeviceBgpUpdateMessageError from protobuf object *otg.DeviceBgpUpdateMessageError - FromProto(msg *otg.DeviceBgpUpdateMessageError) (DeviceBgpUpdateMessageError, error) - // FromPbText unmarshals DeviceBgpUpdateMessageError from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceBgpUpdateMessageError from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceBgpUpdateMessageError from JSON text - FromJson(value string) error -} - -func (obj *deviceBgpUpdateMessageError) Marshal() marshalDeviceBgpUpdateMessageError { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceBgpUpdateMessageError{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceBgpUpdateMessageError) Unmarshal() unMarshalDeviceBgpUpdateMessageError { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceBgpUpdateMessageError{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceBgpUpdateMessageError) ToProto() (*otg.DeviceBgpUpdateMessageError, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceBgpUpdateMessageError) FromProto(msg *otg.DeviceBgpUpdateMessageError) (DeviceBgpUpdateMessageError, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceBgpUpdateMessageError) 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 *unMarshaldeviceBgpUpdateMessageError) 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 *marshaldeviceBgpUpdateMessageError) 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 *unMarshaldeviceBgpUpdateMessageError) 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 *marshaldeviceBgpUpdateMessageError) 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 *unMarshaldeviceBgpUpdateMessageError) 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 *deviceBgpUpdateMessageError) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceBgpUpdateMessageError) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceBgpUpdateMessageError) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceBgpUpdateMessageError) Clone() (DeviceBgpUpdateMessageError, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceBgpUpdateMessageError() - 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 -} - -// DeviceBgpUpdateMessageError is all errors detected while processing the UPDATE message are indicated by sending the NOTIFICATION message with the Error Code-Update Message Error. The Error Subcode elaborates on the specific nature of the error. -type DeviceBgpUpdateMessageError interface { - Validation - // msg marshals DeviceBgpUpdateMessageError to protobuf object *otg.DeviceBgpUpdateMessageError - // and doesn't set defaults - msg() *otg.DeviceBgpUpdateMessageError - // setMsg unmarshals DeviceBgpUpdateMessageError from protobuf object *otg.DeviceBgpUpdateMessageError - // and doesn't set defaults - setMsg(*otg.DeviceBgpUpdateMessageError) DeviceBgpUpdateMessageError - // provides marshal interface - Marshal() marshalDeviceBgpUpdateMessageError - // provides unmarshal interface - Unmarshal() unMarshalDeviceBgpUpdateMessageError - // validate validates DeviceBgpUpdateMessageError - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceBgpUpdateMessageError, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Subcode returns DeviceBgpUpdateMessageErrorSubcodeEnum, set in DeviceBgpUpdateMessageError - Subcode() DeviceBgpUpdateMessageErrorSubcodeEnum - // SetSubcode assigns DeviceBgpUpdateMessageErrorSubcodeEnum provided by user to DeviceBgpUpdateMessageError - SetSubcode(value DeviceBgpUpdateMessageErrorSubcodeEnum) DeviceBgpUpdateMessageError - // HasSubcode checks if Subcode has been set in DeviceBgpUpdateMessageError - HasSubcode() bool -} - -type DeviceBgpUpdateMessageErrorSubcodeEnum string - -// Enum of Subcode on DeviceBgpUpdateMessageError -var DeviceBgpUpdateMessageErrorSubcode = struct { - MALFORMED_ATTRIB_LIST_CODE3_SUBCODE1 DeviceBgpUpdateMessageErrorSubcodeEnum - UNRECOGNIZED_WELLKNOWN_ATTRIB_CODE3_SUBCODE2 DeviceBgpUpdateMessageErrorSubcodeEnum - WELLKNOWN_ATTRIB_MISSING_CODE3_SUBCODE3 DeviceBgpUpdateMessageErrorSubcodeEnum - ATTRIB_FLAGS_ERROR_CODE3_SUBCODE4 DeviceBgpUpdateMessageErrorSubcodeEnum - ATTRIB_LENGTH_ERROR_CODE3_SUBCODE5 DeviceBgpUpdateMessageErrorSubcodeEnum - INVALID_ORIGIN_ATTRIB_CODE3_SUBCODE6 DeviceBgpUpdateMessageErrorSubcodeEnum - AS_ROUTING_LOOP_CODE3_SUBCODE7 DeviceBgpUpdateMessageErrorSubcodeEnum - INVALID_NHOP_ATTRIB_CODE3_SUBCODE8 DeviceBgpUpdateMessageErrorSubcodeEnum - ERROR_OPTIONAL_ATTRIB_CODE3_SUBCODE9 DeviceBgpUpdateMessageErrorSubcodeEnum - INVALID_NETWORK_FIELD_CODE3_SUBCODE10 DeviceBgpUpdateMessageErrorSubcodeEnum - ABNORMAL_ASPATH_CODE3_SUBCODE11 DeviceBgpUpdateMessageErrorSubcodeEnum -}{ - MALFORMED_ATTRIB_LIST_CODE3_SUBCODE1: DeviceBgpUpdateMessageErrorSubcodeEnum("malformed_attrib_list_code3_subcode1"), - UNRECOGNIZED_WELLKNOWN_ATTRIB_CODE3_SUBCODE2: DeviceBgpUpdateMessageErrorSubcodeEnum("unrecognized_wellknown_attrib_code3_subcode2"), - WELLKNOWN_ATTRIB_MISSING_CODE3_SUBCODE3: DeviceBgpUpdateMessageErrorSubcodeEnum("wellknown_attrib_missing_code3_subcode3"), - ATTRIB_FLAGS_ERROR_CODE3_SUBCODE4: DeviceBgpUpdateMessageErrorSubcodeEnum("attrib_flags_error_code3_subcode4"), - ATTRIB_LENGTH_ERROR_CODE3_SUBCODE5: DeviceBgpUpdateMessageErrorSubcodeEnum("attrib_length_error_code3_subcode5"), - INVALID_ORIGIN_ATTRIB_CODE3_SUBCODE6: DeviceBgpUpdateMessageErrorSubcodeEnum("invalid_origin_attrib_code3_subcode6"), - AS_ROUTING_LOOP_CODE3_SUBCODE7: DeviceBgpUpdateMessageErrorSubcodeEnum("as_routing_loop_code3_subcode7"), - INVALID_NHOP_ATTRIB_CODE3_SUBCODE8: DeviceBgpUpdateMessageErrorSubcodeEnum("invalid_nhop_attrib_code3_subcode8"), - ERROR_OPTIONAL_ATTRIB_CODE3_SUBCODE9: DeviceBgpUpdateMessageErrorSubcodeEnum("error_optional_attrib_code3_subcode9"), - INVALID_NETWORK_FIELD_CODE3_SUBCODE10: DeviceBgpUpdateMessageErrorSubcodeEnum("invalid_network_field_code3_subcode10"), - ABNORMAL_ASPATH_CODE3_SUBCODE11: DeviceBgpUpdateMessageErrorSubcodeEnum("abnormal_aspath_code3_subcode11"), -} - -func (obj *deviceBgpUpdateMessageError) Subcode() DeviceBgpUpdateMessageErrorSubcodeEnum { - return DeviceBgpUpdateMessageErrorSubcodeEnum(obj.obj.Subcode.Enum().String()) -} - -// The Error Subcode, the specific type of error encountered during UPDATE processing. -// Subcode returns a string -func (obj *deviceBgpUpdateMessageError) HasSubcode() bool { - return obj.obj.Subcode != nil -} - -func (obj *deviceBgpUpdateMessageError) SetSubcode(value DeviceBgpUpdateMessageErrorSubcodeEnum) DeviceBgpUpdateMessageError { - intValue, ok := otg.DeviceBgpUpdateMessageError_Subcode_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on DeviceBgpUpdateMessageErrorSubcodeEnum", string(value))) - return obj - } - enumValue := otg.DeviceBgpUpdateMessageError_Subcode_Enum(intValue) - obj.obj.Subcode = &enumValue - - return obj -} - -func (obj *deviceBgpUpdateMessageError) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *deviceBgpUpdateMessageError) setDefault() { - if obj.obj.Subcode == nil { - obj.SetSubcode(DeviceBgpUpdateMessageErrorSubcode.MALFORMED_ATTRIB_LIST_CODE3_SUBCODE1) - - } - -} - -// ***** DeviceBgpHoldTimerExpired ***** -type deviceBgpHoldTimerExpired struct { - validation - obj *otg.DeviceBgpHoldTimerExpired - marshaller marshalDeviceBgpHoldTimerExpired - unMarshaller unMarshalDeviceBgpHoldTimerExpired -} - -func NewDeviceBgpHoldTimerExpired() DeviceBgpHoldTimerExpired { - obj := deviceBgpHoldTimerExpired{obj: &otg.DeviceBgpHoldTimerExpired{}} - obj.setDefault() - return &obj -} - -func (obj *deviceBgpHoldTimerExpired) msg() *otg.DeviceBgpHoldTimerExpired { - return obj.obj -} - -func (obj *deviceBgpHoldTimerExpired) setMsg(msg *otg.DeviceBgpHoldTimerExpired) DeviceBgpHoldTimerExpired { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceBgpHoldTimerExpired struct { - obj *deviceBgpHoldTimerExpired -} - -type marshalDeviceBgpHoldTimerExpired interface { - // ToProto marshals DeviceBgpHoldTimerExpired to protobuf object *otg.DeviceBgpHoldTimerExpired - ToProto() (*otg.DeviceBgpHoldTimerExpired, error) - // ToPbText marshals DeviceBgpHoldTimerExpired to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceBgpHoldTimerExpired to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceBgpHoldTimerExpired to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceBgpHoldTimerExpired struct { - obj *deviceBgpHoldTimerExpired -} - -type unMarshalDeviceBgpHoldTimerExpired interface { - // FromProto unmarshals DeviceBgpHoldTimerExpired from protobuf object *otg.DeviceBgpHoldTimerExpired - FromProto(msg *otg.DeviceBgpHoldTimerExpired) (DeviceBgpHoldTimerExpired, error) - // FromPbText unmarshals DeviceBgpHoldTimerExpired from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceBgpHoldTimerExpired from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceBgpHoldTimerExpired from JSON text - FromJson(value string) error -} - -func (obj *deviceBgpHoldTimerExpired) Marshal() marshalDeviceBgpHoldTimerExpired { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceBgpHoldTimerExpired{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceBgpHoldTimerExpired) Unmarshal() unMarshalDeviceBgpHoldTimerExpired { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceBgpHoldTimerExpired{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceBgpHoldTimerExpired) ToProto() (*otg.DeviceBgpHoldTimerExpired, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceBgpHoldTimerExpired) FromProto(msg *otg.DeviceBgpHoldTimerExpired) (DeviceBgpHoldTimerExpired, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceBgpHoldTimerExpired) 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 *unMarshaldeviceBgpHoldTimerExpired) 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 *marshaldeviceBgpHoldTimerExpired) 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 *unMarshaldeviceBgpHoldTimerExpired) 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 *marshaldeviceBgpHoldTimerExpired) 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 *unMarshaldeviceBgpHoldTimerExpired) 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 *deviceBgpHoldTimerExpired) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceBgpHoldTimerExpired) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceBgpHoldTimerExpired) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceBgpHoldTimerExpired) Clone() (DeviceBgpHoldTimerExpired, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceBgpHoldTimerExpired() - 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 -} - -// DeviceBgpHoldTimerExpired is if a system does not receive successive KEEPALIVE, UPDATE, and/or NOTIFICATION messages within the period specified in the Hold Time field of the OPEN message, then the NOTIFICATION message with the Hold Timer Expired Error Code(Error Code 4) is sent and the BGP connection is closed. The Sub Code used is 0. If a user wants to use non zero Sub Code then CustomError can be used. -type DeviceBgpHoldTimerExpired interface { - Validation - // msg marshals DeviceBgpHoldTimerExpired to protobuf object *otg.DeviceBgpHoldTimerExpired - // and doesn't set defaults - msg() *otg.DeviceBgpHoldTimerExpired - // setMsg unmarshals DeviceBgpHoldTimerExpired from protobuf object *otg.DeviceBgpHoldTimerExpired - // and doesn't set defaults - setMsg(*otg.DeviceBgpHoldTimerExpired) DeviceBgpHoldTimerExpired - // provides marshal interface - Marshal() marshalDeviceBgpHoldTimerExpired - // provides unmarshal interface - Unmarshal() unMarshalDeviceBgpHoldTimerExpired - // validate validates DeviceBgpHoldTimerExpired - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceBgpHoldTimerExpired, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() -} - -func (obj *deviceBgpHoldTimerExpired) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *deviceBgpHoldTimerExpired) setDefault() { - -} - -// ***** DeviceBgpFiniteStateMachineError ***** -type deviceBgpFiniteStateMachineError struct { - validation - obj *otg.DeviceBgpFiniteStateMachineError - marshaller marshalDeviceBgpFiniteStateMachineError - unMarshaller unMarshalDeviceBgpFiniteStateMachineError -} - -func NewDeviceBgpFiniteStateMachineError() DeviceBgpFiniteStateMachineError { - obj := deviceBgpFiniteStateMachineError{obj: &otg.DeviceBgpFiniteStateMachineError{}} - obj.setDefault() - return &obj -} - -func (obj *deviceBgpFiniteStateMachineError) msg() *otg.DeviceBgpFiniteStateMachineError { - return obj.obj -} - -func (obj *deviceBgpFiniteStateMachineError) setMsg(msg *otg.DeviceBgpFiniteStateMachineError) DeviceBgpFiniteStateMachineError { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceBgpFiniteStateMachineError struct { - obj *deviceBgpFiniteStateMachineError -} - -type marshalDeviceBgpFiniteStateMachineError interface { - // ToProto marshals DeviceBgpFiniteStateMachineError to protobuf object *otg.DeviceBgpFiniteStateMachineError - ToProto() (*otg.DeviceBgpFiniteStateMachineError, error) - // ToPbText marshals DeviceBgpFiniteStateMachineError to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceBgpFiniteStateMachineError to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceBgpFiniteStateMachineError to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceBgpFiniteStateMachineError struct { - obj *deviceBgpFiniteStateMachineError -} - -type unMarshalDeviceBgpFiniteStateMachineError interface { - // FromProto unmarshals DeviceBgpFiniteStateMachineError from protobuf object *otg.DeviceBgpFiniteStateMachineError - FromProto(msg *otg.DeviceBgpFiniteStateMachineError) (DeviceBgpFiniteStateMachineError, error) - // FromPbText unmarshals DeviceBgpFiniteStateMachineError from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceBgpFiniteStateMachineError from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceBgpFiniteStateMachineError from JSON text - FromJson(value string) error -} - -func (obj *deviceBgpFiniteStateMachineError) Marshal() marshalDeviceBgpFiniteStateMachineError { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceBgpFiniteStateMachineError{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceBgpFiniteStateMachineError) Unmarshal() unMarshalDeviceBgpFiniteStateMachineError { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceBgpFiniteStateMachineError{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceBgpFiniteStateMachineError) ToProto() (*otg.DeviceBgpFiniteStateMachineError, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceBgpFiniteStateMachineError) FromProto(msg *otg.DeviceBgpFiniteStateMachineError) (DeviceBgpFiniteStateMachineError, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceBgpFiniteStateMachineError) 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 *unMarshaldeviceBgpFiniteStateMachineError) 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 *marshaldeviceBgpFiniteStateMachineError) 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 *unMarshaldeviceBgpFiniteStateMachineError) 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 *marshaldeviceBgpFiniteStateMachineError) 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 *unMarshaldeviceBgpFiniteStateMachineError) 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 *deviceBgpFiniteStateMachineError) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceBgpFiniteStateMachineError) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceBgpFiniteStateMachineError) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceBgpFiniteStateMachineError) Clone() (DeviceBgpFiniteStateMachineError, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceBgpFiniteStateMachineError() - 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 -} - -// DeviceBgpFiniteStateMachineError is any error detected by the BGP Finite State Machine (e.g., receipt of an unexpected event) is indicated by sending the NOTIFICATION message with the Error Code-Finite State Machine Error(Error Code 5). The Sub Code used is 0. If a user wants to use non zero Sub Code then CustomError can be used. -type DeviceBgpFiniteStateMachineError interface { - Validation - // msg marshals DeviceBgpFiniteStateMachineError to protobuf object *otg.DeviceBgpFiniteStateMachineError - // and doesn't set defaults - msg() *otg.DeviceBgpFiniteStateMachineError - // setMsg unmarshals DeviceBgpFiniteStateMachineError from protobuf object *otg.DeviceBgpFiniteStateMachineError - // and doesn't set defaults - setMsg(*otg.DeviceBgpFiniteStateMachineError) DeviceBgpFiniteStateMachineError - // provides marshal interface - Marshal() marshalDeviceBgpFiniteStateMachineError - // provides unmarshal interface - Unmarshal() unMarshalDeviceBgpFiniteStateMachineError - // validate validates DeviceBgpFiniteStateMachineError - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceBgpFiniteStateMachineError, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() -} - -func (obj *deviceBgpFiniteStateMachineError) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *deviceBgpFiniteStateMachineError) setDefault() { - -} - -// ***** DeviceBgpCustomError ***** -type deviceBgpCustomError struct { - validation - obj *otg.DeviceBgpCustomError - marshaller marshalDeviceBgpCustomError - unMarshaller unMarshalDeviceBgpCustomError -} - -func NewDeviceBgpCustomError() DeviceBgpCustomError { - obj := deviceBgpCustomError{obj: &otg.DeviceBgpCustomError{}} - obj.setDefault() - return &obj -} - -func (obj *deviceBgpCustomError) msg() *otg.DeviceBgpCustomError { - return obj.obj -} - -func (obj *deviceBgpCustomError) setMsg(msg *otg.DeviceBgpCustomError) DeviceBgpCustomError { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldeviceBgpCustomError struct { - obj *deviceBgpCustomError -} - -type marshalDeviceBgpCustomError interface { - // ToProto marshals DeviceBgpCustomError to protobuf object *otg.DeviceBgpCustomError - ToProto() (*otg.DeviceBgpCustomError, error) - // ToPbText marshals DeviceBgpCustomError to protobuf text - ToPbText() (string, error) - // ToYaml marshals DeviceBgpCustomError to YAML text - ToYaml() (string, error) - // ToJson marshals DeviceBgpCustomError to JSON text - ToJson() (string, error) -} - -type unMarshaldeviceBgpCustomError struct { - obj *deviceBgpCustomError -} - -type unMarshalDeviceBgpCustomError interface { - // FromProto unmarshals DeviceBgpCustomError from protobuf object *otg.DeviceBgpCustomError - FromProto(msg *otg.DeviceBgpCustomError) (DeviceBgpCustomError, error) - // FromPbText unmarshals DeviceBgpCustomError from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DeviceBgpCustomError from YAML text - FromYaml(value string) error - // FromJson unmarshals DeviceBgpCustomError from JSON text - FromJson(value string) error -} - -func (obj *deviceBgpCustomError) Marshal() marshalDeviceBgpCustomError { - if obj.marshaller == nil { - obj.marshaller = &marshaldeviceBgpCustomError{obj: obj} - } - return obj.marshaller -} - -func (obj *deviceBgpCustomError) Unmarshal() unMarshalDeviceBgpCustomError { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldeviceBgpCustomError{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldeviceBgpCustomError) ToProto() (*otg.DeviceBgpCustomError, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldeviceBgpCustomError) FromProto(msg *otg.DeviceBgpCustomError) (DeviceBgpCustomError, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldeviceBgpCustomError) 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 *unMarshaldeviceBgpCustomError) 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 *marshaldeviceBgpCustomError) 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 *unMarshaldeviceBgpCustomError) 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 *marshaldeviceBgpCustomError) 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 *unMarshaldeviceBgpCustomError) 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 *deviceBgpCustomError) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *deviceBgpCustomError) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *deviceBgpCustomError) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *deviceBgpCustomError) Clone() (DeviceBgpCustomError, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDeviceBgpCustomError() - 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 -} - -// DeviceBgpCustomError is a BGP peer can send NOTIFICATION message with user defined Error Code and Error Subcode. -type DeviceBgpCustomError interface { - Validation - // msg marshals DeviceBgpCustomError to protobuf object *otg.DeviceBgpCustomError - // and doesn't set defaults - msg() *otg.DeviceBgpCustomError - // setMsg unmarshals DeviceBgpCustomError from protobuf object *otg.DeviceBgpCustomError - // and doesn't set defaults - setMsg(*otg.DeviceBgpCustomError) DeviceBgpCustomError - // provides marshal interface - Marshal() marshalDeviceBgpCustomError - // provides unmarshal interface - Unmarshal() unMarshalDeviceBgpCustomError - // validate validates DeviceBgpCustomError - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DeviceBgpCustomError, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Code returns uint32, set in DeviceBgpCustomError. - Code() uint32 - // SetCode assigns uint32 provided by user to DeviceBgpCustomError - SetCode(value uint32) DeviceBgpCustomError - // HasCode checks if Code has been set in DeviceBgpCustomError - HasCode() bool - // Subcode returns uint32, set in DeviceBgpCustomError. - Subcode() uint32 - // SetSubcode assigns uint32 provided by user to DeviceBgpCustomError - SetSubcode(value uint32) DeviceBgpCustomError - // HasSubcode checks if Subcode has been set in DeviceBgpCustomError - HasSubcode() bool -} - -// The Error code to be sent in the NOTIFICATION message to peer. -// Code returns a uint32 -func (obj *deviceBgpCustomError) Code() uint32 { - - return *obj.obj.Code - -} - -// The Error code to be sent in the NOTIFICATION message to peer. -// Code returns a uint32 -func (obj *deviceBgpCustomError) HasCode() bool { - return obj.obj.Code != nil -} - -// The Error code to be sent in the NOTIFICATION message to peer. -// SetCode sets the uint32 value in the DeviceBgpCustomError object -func (obj *deviceBgpCustomError) SetCode(value uint32) DeviceBgpCustomError { - - obj.obj.Code = &value - return obj -} - -// The Error Subcode to be sent in the NOTIFICATION message to peer. -// Subcode returns a uint32 -func (obj *deviceBgpCustomError) Subcode() uint32 { - - return *obj.obj.Subcode - -} - -// The Error Subcode to be sent in the NOTIFICATION message to peer. -// Subcode returns a uint32 -func (obj *deviceBgpCustomError) HasSubcode() bool { - return obj.obj.Subcode != nil -} - -// The Error Subcode to be sent in the NOTIFICATION message to peer. -// SetSubcode sets the uint32 value in the DeviceBgpCustomError object -func (obj *deviceBgpCustomError) SetSubcode(value uint32) DeviceBgpCustomError { - - obj.obj.Subcode = &value - return obj -} - -func (obj *deviceBgpCustomError) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *deviceBgpCustomError) setDefault() { - -} - -// ***** ActionResponseProtocolIpv4 ***** -type actionResponseProtocolIpv4 struct { - validation - obj *otg.ActionResponseProtocolIpv4 - marshaller marshalActionResponseProtocolIpv4 - unMarshaller unMarshalActionResponseProtocolIpv4 - pingHolder ActionResponseProtocolIpv4Ping -} - -func NewActionResponseProtocolIpv4() ActionResponseProtocolIpv4 { - obj := actionResponseProtocolIpv4{obj: &otg.ActionResponseProtocolIpv4{}} - obj.setDefault() - return &obj -} - -func (obj *actionResponseProtocolIpv4) msg() *otg.ActionResponseProtocolIpv4 { - return obj.obj -} - -func (obj *actionResponseProtocolIpv4) setMsg(msg *otg.ActionResponseProtocolIpv4) ActionResponseProtocolIpv4 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionResponseProtocolIpv4 struct { - obj *actionResponseProtocolIpv4 -} - -type marshalActionResponseProtocolIpv4 interface { - // ToProto marshals ActionResponseProtocolIpv4 to protobuf object *otg.ActionResponseProtocolIpv4 - ToProto() (*otg.ActionResponseProtocolIpv4, error) - // ToPbText marshals ActionResponseProtocolIpv4 to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionResponseProtocolIpv4 to YAML text - ToYaml() (string, error) - // ToJson marshals ActionResponseProtocolIpv4 to JSON text - ToJson() (string, error) -} - -type unMarshalactionResponseProtocolIpv4 struct { - obj *actionResponseProtocolIpv4 -} - -type unMarshalActionResponseProtocolIpv4 interface { - // FromProto unmarshals ActionResponseProtocolIpv4 from protobuf object *otg.ActionResponseProtocolIpv4 - FromProto(msg *otg.ActionResponseProtocolIpv4) (ActionResponseProtocolIpv4, error) - // FromPbText unmarshals ActionResponseProtocolIpv4 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionResponseProtocolIpv4 from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionResponseProtocolIpv4 from JSON text - FromJson(value string) error -} - -func (obj *actionResponseProtocolIpv4) Marshal() marshalActionResponseProtocolIpv4 { - if obj.marshaller == nil { - obj.marshaller = &marshalactionResponseProtocolIpv4{obj: obj} - } - return obj.marshaller -} - -func (obj *actionResponseProtocolIpv4) Unmarshal() unMarshalActionResponseProtocolIpv4 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionResponseProtocolIpv4{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionResponseProtocolIpv4) ToProto() (*otg.ActionResponseProtocolIpv4, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionResponseProtocolIpv4) FromProto(msg *otg.ActionResponseProtocolIpv4) (ActionResponseProtocolIpv4, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionResponseProtocolIpv4) 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 *unMarshalactionResponseProtocolIpv4) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalactionResponseProtocolIpv4) 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 *unMarshalactionResponseProtocolIpv4) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalactionResponseProtocolIpv4) 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 *unMarshalactionResponseProtocolIpv4) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *actionResponseProtocolIpv4) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionResponseProtocolIpv4) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionResponseProtocolIpv4) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionResponseProtocolIpv4) Clone() (ActionResponseProtocolIpv4, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionResponseProtocolIpv4() - 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 -} - -func (obj *actionResponseProtocolIpv4) setNil() { - obj.pingHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ActionResponseProtocolIpv4 is response for actions associated with IPv4 on configured resources. -type ActionResponseProtocolIpv4 interface { - Validation - // msg marshals ActionResponseProtocolIpv4 to protobuf object *otg.ActionResponseProtocolIpv4 - // and doesn't set defaults - msg() *otg.ActionResponseProtocolIpv4 - // setMsg unmarshals ActionResponseProtocolIpv4 from protobuf object *otg.ActionResponseProtocolIpv4 - // and doesn't set defaults - setMsg(*otg.ActionResponseProtocolIpv4) ActionResponseProtocolIpv4 - // provides marshal interface - Marshal() marshalActionResponseProtocolIpv4 - // provides unmarshal interface - Unmarshal() unMarshalActionResponseProtocolIpv4 - // validate validates ActionResponseProtocolIpv4 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionResponseProtocolIpv4, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ActionResponseProtocolIpv4ChoiceEnum, set in ActionResponseProtocolIpv4 - Choice() ActionResponseProtocolIpv4ChoiceEnum - // setChoice assigns ActionResponseProtocolIpv4ChoiceEnum provided by user to ActionResponseProtocolIpv4 - setChoice(value ActionResponseProtocolIpv4ChoiceEnum) ActionResponseProtocolIpv4 - // Ping returns ActionResponseProtocolIpv4Ping, set in ActionResponseProtocolIpv4. - // ActionResponseProtocolIpv4Ping is response for ping initiated between multiple source and destination pairs. - Ping() ActionResponseProtocolIpv4Ping - // SetPing assigns ActionResponseProtocolIpv4Ping provided by user to ActionResponseProtocolIpv4. - // ActionResponseProtocolIpv4Ping is response for ping initiated between multiple source and destination pairs. - SetPing(value ActionResponseProtocolIpv4Ping) ActionResponseProtocolIpv4 - // HasPing checks if Ping has been set in ActionResponseProtocolIpv4 - HasPing() bool - setNil() -} - -type ActionResponseProtocolIpv4ChoiceEnum string - -// Enum of Choice on ActionResponseProtocolIpv4 -var ActionResponseProtocolIpv4Choice = struct { - PING ActionResponseProtocolIpv4ChoiceEnum -}{ - PING: ActionResponseProtocolIpv4ChoiceEnum("ping"), -} - -func (obj *actionResponseProtocolIpv4) Choice() ActionResponseProtocolIpv4ChoiceEnum { - return ActionResponseProtocolIpv4ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *actionResponseProtocolIpv4) setChoice(value ActionResponseProtocolIpv4ChoiceEnum) ActionResponseProtocolIpv4 { - intValue, ok := otg.ActionResponseProtocolIpv4_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ActionResponseProtocolIpv4ChoiceEnum", string(value))) - return obj - } - enumValue := otg.ActionResponseProtocolIpv4_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Ping = nil - obj.pingHolder = nil - - if value == ActionResponseProtocolIpv4Choice.PING { - obj.obj.Ping = NewActionResponseProtocolIpv4Ping().msg() - } - - return obj -} - -// description is TBD -// Ping returns a ActionResponseProtocolIpv4Ping -func (obj *actionResponseProtocolIpv4) Ping() ActionResponseProtocolIpv4Ping { - if obj.obj.Ping == nil { - obj.setChoice(ActionResponseProtocolIpv4Choice.PING) - } - if obj.pingHolder == nil { - obj.pingHolder = &actionResponseProtocolIpv4Ping{obj: obj.obj.Ping} - } - return obj.pingHolder -} - -// description is TBD -// Ping returns a ActionResponseProtocolIpv4Ping -func (obj *actionResponseProtocolIpv4) HasPing() bool { - return obj.obj.Ping != nil -} - -// description is TBD -// SetPing sets the ActionResponseProtocolIpv4Ping value in the ActionResponseProtocolIpv4 object -func (obj *actionResponseProtocolIpv4) SetPing(value ActionResponseProtocolIpv4Ping) ActionResponseProtocolIpv4 { - obj.setChoice(ActionResponseProtocolIpv4Choice.PING) - obj.pingHolder = nil - obj.obj.Ping = value.msg() - - return obj -} - -func (obj *actionResponseProtocolIpv4) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionResponseProtocolIpv4") - } - - if obj.obj.Ping != nil { - - obj.Ping().validateObj(vObj, set_default) - } - -} - -func (obj *actionResponseProtocolIpv4) setDefault() { - var choices_set int = 0 - var choice ActionResponseProtocolIpv4ChoiceEnum - - if obj.obj.Ping != nil { - choices_set += 1 - choice = ActionResponseProtocolIpv4Choice.PING - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionResponseProtocolIpv4") - } - } else { - intVal := otg.ActionResponseProtocolIpv4_Choice_Enum_value[string(choice)] - enumValue := otg.ActionResponseProtocolIpv4_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** ActionResponseProtocolIpv6 ***** -type actionResponseProtocolIpv6 struct { - validation - obj *otg.ActionResponseProtocolIpv6 - marshaller marshalActionResponseProtocolIpv6 - unMarshaller unMarshalActionResponseProtocolIpv6 - pingHolder ActionResponseProtocolIpv6Ping -} - -func NewActionResponseProtocolIpv6() ActionResponseProtocolIpv6 { - obj := actionResponseProtocolIpv6{obj: &otg.ActionResponseProtocolIpv6{}} - obj.setDefault() - return &obj -} - -func (obj *actionResponseProtocolIpv6) msg() *otg.ActionResponseProtocolIpv6 { - return obj.obj -} - -func (obj *actionResponseProtocolIpv6) setMsg(msg *otg.ActionResponseProtocolIpv6) ActionResponseProtocolIpv6 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionResponseProtocolIpv6 struct { - obj *actionResponseProtocolIpv6 -} - -type marshalActionResponseProtocolIpv6 interface { - // ToProto marshals ActionResponseProtocolIpv6 to protobuf object *otg.ActionResponseProtocolIpv6 - ToProto() (*otg.ActionResponseProtocolIpv6, error) - // ToPbText marshals ActionResponseProtocolIpv6 to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionResponseProtocolIpv6 to YAML text - ToYaml() (string, error) - // ToJson marshals ActionResponseProtocolIpv6 to JSON text - ToJson() (string, error) -} - -type unMarshalactionResponseProtocolIpv6 struct { - obj *actionResponseProtocolIpv6 -} - -type unMarshalActionResponseProtocolIpv6 interface { - // FromProto unmarshals ActionResponseProtocolIpv6 from protobuf object *otg.ActionResponseProtocolIpv6 - FromProto(msg *otg.ActionResponseProtocolIpv6) (ActionResponseProtocolIpv6, error) - // FromPbText unmarshals ActionResponseProtocolIpv6 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionResponseProtocolIpv6 from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionResponseProtocolIpv6 from JSON text - FromJson(value string) error -} - -func (obj *actionResponseProtocolIpv6) Marshal() marshalActionResponseProtocolIpv6 { - if obj.marshaller == nil { - obj.marshaller = &marshalactionResponseProtocolIpv6{obj: obj} - } - return obj.marshaller -} - -func (obj *actionResponseProtocolIpv6) Unmarshal() unMarshalActionResponseProtocolIpv6 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionResponseProtocolIpv6{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionResponseProtocolIpv6) ToProto() (*otg.ActionResponseProtocolIpv6, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionResponseProtocolIpv6) FromProto(msg *otg.ActionResponseProtocolIpv6) (ActionResponseProtocolIpv6, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionResponseProtocolIpv6) 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 *unMarshalactionResponseProtocolIpv6) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalactionResponseProtocolIpv6) 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 *unMarshalactionResponseProtocolIpv6) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalactionResponseProtocolIpv6) 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 *unMarshalactionResponseProtocolIpv6) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *actionResponseProtocolIpv6) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionResponseProtocolIpv6) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionResponseProtocolIpv6) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionResponseProtocolIpv6) Clone() (ActionResponseProtocolIpv6, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionResponseProtocolIpv6() - 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 -} - -func (obj *actionResponseProtocolIpv6) setNil() { - obj.pingHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ActionResponseProtocolIpv6 is response for actions associated with IPv6 on configured resources. -type ActionResponseProtocolIpv6 interface { - Validation - // msg marshals ActionResponseProtocolIpv6 to protobuf object *otg.ActionResponseProtocolIpv6 - // and doesn't set defaults - msg() *otg.ActionResponseProtocolIpv6 - // setMsg unmarshals ActionResponseProtocolIpv6 from protobuf object *otg.ActionResponseProtocolIpv6 - // and doesn't set defaults - setMsg(*otg.ActionResponseProtocolIpv6) ActionResponseProtocolIpv6 - // provides marshal interface - Marshal() marshalActionResponseProtocolIpv6 - // provides unmarshal interface - Unmarshal() unMarshalActionResponseProtocolIpv6 - // validate validates ActionResponseProtocolIpv6 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionResponseProtocolIpv6, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ActionResponseProtocolIpv6ChoiceEnum, set in ActionResponseProtocolIpv6 - Choice() ActionResponseProtocolIpv6ChoiceEnum - // setChoice assigns ActionResponseProtocolIpv6ChoiceEnum provided by user to ActionResponseProtocolIpv6 - setChoice(value ActionResponseProtocolIpv6ChoiceEnum) ActionResponseProtocolIpv6 - // Ping returns ActionResponseProtocolIpv6Ping, set in ActionResponseProtocolIpv6. - // ActionResponseProtocolIpv6Ping is response for ping initiated between multiple source and destination pairs. - Ping() ActionResponseProtocolIpv6Ping - // SetPing assigns ActionResponseProtocolIpv6Ping provided by user to ActionResponseProtocolIpv6. - // ActionResponseProtocolIpv6Ping is response for ping initiated between multiple source and destination pairs. - SetPing(value ActionResponseProtocolIpv6Ping) ActionResponseProtocolIpv6 - // HasPing checks if Ping has been set in ActionResponseProtocolIpv6 - HasPing() bool - setNil() -} - -type ActionResponseProtocolIpv6ChoiceEnum string - -// Enum of Choice on ActionResponseProtocolIpv6 -var ActionResponseProtocolIpv6Choice = struct { - PING ActionResponseProtocolIpv6ChoiceEnum -}{ - PING: ActionResponseProtocolIpv6ChoiceEnum("ping"), -} - -func (obj *actionResponseProtocolIpv6) Choice() ActionResponseProtocolIpv6ChoiceEnum { - return ActionResponseProtocolIpv6ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *actionResponseProtocolIpv6) setChoice(value ActionResponseProtocolIpv6ChoiceEnum) ActionResponseProtocolIpv6 { - intValue, ok := otg.ActionResponseProtocolIpv6_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ActionResponseProtocolIpv6ChoiceEnum", string(value))) - return obj - } - enumValue := otg.ActionResponseProtocolIpv6_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Ping = nil - obj.pingHolder = nil - - if value == ActionResponseProtocolIpv6Choice.PING { - obj.obj.Ping = NewActionResponseProtocolIpv6Ping().msg() - } - - return obj -} - -// description is TBD -// Ping returns a ActionResponseProtocolIpv6Ping -func (obj *actionResponseProtocolIpv6) Ping() ActionResponseProtocolIpv6Ping { - if obj.obj.Ping == nil { - obj.setChoice(ActionResponseProtocolIpv6Choice.PING) - } - if obj.pingHolder == nil { - obj.pingHolder = &actionResponseProtocolIpv6Ping{obj: obj.obj.Ping} - } - return obj.pingHolder -} - -// description is TBD -// Ping returns a ActionResponseProtocolIpv6Ping -func (obj *actionResponseProtocolIpv6) HasPing() bool { - return obj.obj.Ping != nil -} - -// description is TBD -// SetPing sets the ActionResponseProtocolIpv6Ping value in the ActionResponseProtocolIpv6 object -func (obj *actionResponseProtocolIpv6) SetPing(value ActionResponseProtocolIpv6Ping) ActionResponseProtocolIpv6 { - obj.setChoice(ActionResponseProtocolIpv6Choice.PING) - obj.pingHolder = nil - obj.obj.Ping = value.msg() - - return obj -} - -func (obj *actionResponseProtocolIpv6) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface ActionResponseProtocolIpv6") - } - - if obj.obj.Ping != nil { - - obj.Ping().validateObj(vObj, set_default) - } - -} - -func (obj *actionResponseProtocolIpv6) setDefault() { - var choices_set int = 0 - var choice ActionResponseProtocolIpv6ChoiceEnum - - if obj.obj.Ping != nil { - choices_set += 1 - choice = ActionResponseProtocolIpv6Choice.PING - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ActionResponseProtocolIpv6") - } - } else { - intVal := otg.ActionResponseProtocolIpv6_Choice_Enum_value[string(choice)] - enumValue := otg.ActionResponseProtocolIpv6_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowMetricTag ***** -type flowMetricTag struct { - validation - obj *otg.FlowMetricTag - marshaller marshalFlowMetricTag - unMarshaller unMarshalFlowMetricTag - valueHolder FlowMetricTagValue -} - -func NewFlowMetricTag() FlowMetricTag { - obj := flowMetricTag{obj: &otg.FlowMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *flowMetricTag) msg() *otg.FlowMetricTag { - return obj.obj -} - -func (obj *flowMetricTag) setMsg(msg *otg.FlowMetricTag) FlowMetricTag { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowMetricTag struct { - obj *flowMetricTag -} - -type marshalFlowMetricTag interface { - // ToProto marshals FlowMetricTag to protobuf object *otg.FlowMetricTag - ToProto() (*otg.FlowMetricTag, error) - // ToPbText marshals FlowMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals FlowMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalflowMetricTag struct { - obj *flowMetricTag -} - -type unMarshalFlowMetricTag interface { - // FromProto unmarshals FlowMetricTag from protobuf object *otg.FlowMetricTag - FromProto(msg *otg.FlowMetricTag) (FlowMetricTag, error) - // FromPbText unmarshals FlowMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowMetricTag from JSON text - FromJson(value string) error -} - -func (obj *flowMetricTag) Marshal() marshalFlowMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalflowMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *flowMetricTag) Unmarshal() unMarshalFlowMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowMetricTag) ToProto() (*otg.FlowMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowMetricTag) FromProto(msg *otg.FlowMetricTag) (FlowMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowMetricTag) 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 *unMarshalflowMetricTag) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowMetricTag) 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 *unMarshalflowMetricTag) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowMetricTag) 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 *unMarshalflowMetricTag) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowMetricTag) Clone() (FlowMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowMetricTag() - 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 -} - -func (obj *flowMetricTag) setNil() { - obj.valueHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowMetricTag is description is TBD -type FlowMetricTag interface { - Validation - // msg marshals FlowMetricTag to protobuf object *otg.FlowMetricTag - // and doesn't set defaults - msg() *otg.FlowMetricTag - // setMsg unmarshals FlowMetricTag from protobuf object *otg.FlowMetricTag - // and doesn't set defaults - setMsg(*otg.FlowMetricTag) FlowMetricTag - // provides marshal interface - Marshal() marshalFlowMetricTag - // provides unmarshal interface - Unmarshal() unMarshalFlowMetricTag - // validate validates FlowMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in FlowMetricTag. - Name() string - // SetName assigns string provided by user to FlowMetricTag - SetName(value string) FlowMetricTag - // HasName checks if Name has been set in FlowMetricTag - HasName() bool - // Value returns FlowMetricTagValue, set in FlowMetricTag. - // FlowMetricTagValue is a container for metric tag value - Value() FlowMetricTagValue - // SetValue assigns FlowMetricTagValue provided by user to FlowMetricTag. - // FlowMetricTagValue is a container for metric tag value - SetValue(value FlowMetricTagValue) FlowMetricTag - // HasValue checks if Value has been set in FlowMetricTag - HasValue() bool - setNil() -} - -// Name of packet field metric tag -// Name returns a string -func (obj *flowMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name of packet field metric tag -// Name returns a string -func (obj *flowMetricTag) HasName() bool { - return obj.obj.Name != nil -} - -// Name of packet field metric tag -// SetName sets the string value in the FlowMetricTag object -func (obj *flowMetricTag) SetName(value string) FlowMetricTag { - - obj.obj.Name = &value - return obj -} - -// description is TBD -// Value returns a FlowMetricTagValue -func (obj *flowMetricTag) Value() FlowMetricTagValue { - if obj.obj.Value == nil { - obj.obj.Value = NewFlowMetricTagValue().msg() - } - if obj.valueHolder == nil { - obj.valueHolder = &flowMetricTagValue{obj: obj.obj.Value} - } - return obj.valueHolder -} - -// description is TBD -// Value returns a FlowMetricTagValue -func (obj *flowMetricTag) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the FlowMetricTagValue value in the FlowMetricTag object -func (obj *flowMetricTag) SetValue(value FlowMetricTagValue) FlowMetricTag { - - obj.valueHolder = nil - obj.obj.Value = value.msg() - - return obj -} - -func (obj *flowMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - obj.Value().validateObj(vObj, set_default) - } - -} - -func (obj *flowMetricTag) setDefault() { - -} - -// ***** ResultBgpCommunity ***** -type resultBgpCommunity struct { - validation - obj *otg.ResultBgpCommunity - marshaller marshalResultBgpCommunity - unMarshaller unMarshalResultBgpCommunity -} - -func NewResultBgpCommunity() ResultBgpCommunity { - obj := resultBgpCommunity{obj: &otg.ResultBgpCommunity{}} - obj.setDefault() - return &obj -} - -func (obj *resultBgpCommunity) msg() *otg.ResultBgpCommunity { - return obj.obj -} - -func (obj *resultBgpCommunity) setMsg(msg *otg.ResultBgpCommunity) ResultBgpCommunity { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultBgpCommunity struct { - obj *resultBgpCommunity -} - -type marshalResultBgpCommunity interface { - // ToProto marshals ResultBgpCommunity to protobuf object *otg.ResultBgpCommunity - ToProto() (*otg.ResultBgpCommunity, error) - // ToPbText marshals ResultBgpCommunity to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultBgpCommunity to YAML text - ToYaml() (string, error) - // ToJson marshals ResultBgpCommunity to JSON text - ToJson() (string, error) -} - -type unMarshalresultBgpCommunity struct { - obj *resultBgpCommunity -} - -type unMarshalResultBgpCommunity interface { - // FromProto unmarshals ResultBgpCommunity from protobuf object *otg.ResultBgpCommunity - FromProto(msg *otg.ResultBgpCommunity) (ResultBgpCommunity, error) - // FromPbText unmarshals ResultBgpCommunity from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultBgpCommunity from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultBgpCommunity from JSON text - FromJson(value string) error -} - -func (obj *resultBgpCommunity) Marshal() marshalResultBgpCommunity { - if obj.marshaller == nil { - obj.marshaller = &marshalresultBgpCommunity{obj: obj} - } - return obj.marshaller -} - -func (obj *resultBgpCommunity) Unmarshal() unMarshalResultBgpCommunity { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultBgpCommunity{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultBgpCommunity) ToProto() (*otg.ResultBgpCommunity, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultBgpCommunity) FromProto(msg *otg.ResultBgpCommunity) (ResultBgpCommunity, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultBgpCommunity) 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 *unMarshalresultBgpCommunity) 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 *marshalresultBgpCommunity) 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 *unMarshalresultBgpCommunity) 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 *marshalresultBgpCommunity) 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 *unMarshalresultBgpCommunity) 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 *resultBgpCommunity) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultBgpCommunity) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultBgpCommunity) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultBgpCommunity) Clone() (ResultBgpCommunity, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultBgpCommunity() - 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 -} - -// ResultBgpCommunity is bGP communities provide additional capability for tagging routes and for modifying BGP routing policy on upstream and downstream routers. BGP community is a 32-bit number which is broken into 16-bit AS number and a 16-bit custom value. -type ResultBgpCommunity interface { - Validation - // msg marshals ResultBgpCommunity to protobuf object *otg.ResultBgpCommunity - // and doesn't set defaults - msg() *otg.ResultBgpCommunity - // setMsg unmarshals ResultBgpCommunity from protobuf object *otg.ResultBgpCommunity - // and doesn't set defaults - setMsg(*otg.ResultBgpCommunity) ResultBgpCommunity - // provides marshal interface - Marshal() marshalResultBgpCommunity - // provides unmarshal interface - Unmarshal() unMarshalResultBgpCommunity - // validate validates ResultBgpCommunity - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultBgpCommunity, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Type returns ResultBgpCommunityTypeEnum, set in ResultBgpCommunity - Type() ResultBgpCommunityTypeEnum - // SetType assigns ResultBgpCommunityTypeEnum provided by user to ResultBgpCommunity - SetType(value ResultBgpCommunityTypeEnum) ResultBgpCommunity - // HasType checks if Type has been set in ResultBgpCommunity - HasType() bool - // AsNumber returns uint32, set in ResultBgpCommunity. - AsNumber() uint32 - // SetAsNumber assigns uint32 provided by user to ResultBgpCommunity - SetAsNumber(value uint32) ResultBgpCommunity - // HasAsNumber checks if AsNumber has been set in ResultBgpCommunity - HasAsNumber() bool - // AsCustom returns uint32, set in ResultBgpCommunity. - AsCustom() uint32 - // SetAsCustom assigns uint32 provided by user to ResultBgpCommunity - SetAsCustom(value uint32) ResultBgpCommunity - // HasAsCustom checks if AsCustom has been set in ResultBgpCommunity - HasAsCustom() bool -} - -type ResultBgpCommunityTypeEnum string - -// Enum of Type on ResultBgpCommunity -var ResultBgpCommunityType = struct { - MANUAL_AS_NUMBER ResultBgpCommunityTypeEnum - NO_EXPORT ResultBgpCommunityTypeEnum - NO_ADVERTISED ResultBgpCommunityTypeEnum - NO_EXPORT_SUBCONFED ResultBgpCommunityTypeEnum - LLGR_STALE ResultBgpCommunityTypeEnum - NO_LLGR ResultBgpCommunityTypeEnum -}{ - MANUAL_AS_NUMBER: ResultBgpCommunityTypeEnum("manual_as_number"), - NO_EXPORT: ResultBgpCommunityTypeEnum("no_export"), - NO_ADVERTISED: ResultBgpCommunityTypeEnum("no_advertised"), - NO_EXPORT_SUBCONFED: ResultBgpCommunityTypeEnum("no_export_subconfed"), - LLGR_STALE: ResultBgpCommunityTypeEnum("llgr_stale"), - NO_LLGR: ResultBgpCommunityTypeEnum("no_llgr"), -} - -func (obj *resultBgpCommunity) Type() ResultBgpCommunityTypeEnum { - return ResultBgpCommunityTypeEnum(obj.obj.Type.Enum().String()) -} - -// The type of community AS number. If community type is manual_as_number then as_number and as_custom will be available. -// Type returns a string -func (obj *resultBgpCommunity) HasType() bool { - return obj.obj.Type != nil -} - -func (obj *resultBgpCommunity) SetType(value ResultBgpCommunityTypeEnum) ResultBgpCommunity { - intValue, ok := otg.ResultBgpCommunity_Type_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ResultBgpCommunityTypeEnum", string(value))) - return obj - } - enumValue := otg.ResultBgpCommunity_Type_Enum(intValue) - obj.obj.Type = &enumValue - - return obj -} - -// First two octets of 32 bit community AS number. -// AsNumber returns a uint32 -func (obj *resultBgpCommunity) AsNumber() uint32 { - - return *obj.obj.AsNumber - -} - -// First two octets of 32 bit community AS number. -// AsNumber returns a uint32 -func (obj *resultBgpCommunity) HasAsNumber() bool { - return obj.obj.AsNumber != nil -} - -// First two octets of 32 bit community AS number. -// SetAsNumber sets the uint32 value in the ResultBgpCommunity object -func (obj *resultBgpCommunity) SetAsNumber(value uint32) ResultBgpCommunity { - - obj.obj.AsNumber = &value - return obj -} - -// Last two octets of the community value. -// AsCustom returns a uint32 -func (obj *resultBgpCommunity) AsCustom() uint32 { - - return *obj.obj.AsCustom - -} - -// Last two octets of the community value. -// AsCustom returns a uint32 -func (obj *resultBgpCommunity) HasAsCustom() bool { - return obj.obj.AsCustom != nil -} - -// Last two octets of the community value. -// SetAsCustom sets the uint32 value in the ResultBgpCommunity object -func (obj *resultBgpCommunity) SetAsCustom(value uint32) ResultBgpCommunity { - - obj.obj.AsCustom = &value - return obj -} - -func (obj *resultBgpCommunity) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.AsNumber != nil { - - if *obj.obj.AsNumber > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= ResultBgpCommunity.AsNumber <= 65535 but Got %d", *obj.obj.AsNumber)) - } - - } - - if obj.obj.AsCustom != nil { - - if *obj.obj.AsCustom > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= ResultBgpCommunity.AsCustom <= 65535 but Got %d", *obj.obj.AsCustom)) - } - - } - -} - -func (obj *resultBgpCommunity) setDefault() { - -} - -// ***** ResultExtendedCommunity ***** -type resultExtendedCommunity struct { - validation - obj *otg.ResultExtendedCommunity - marshaller marshalResultExtendedCommunity - unMarshaller unMarshalResultExtendedCommunity - structuredHolder ResultExtendedCommunityStructured -} - -func NewResultExtendedCommunity() ResultExtendedCommunity { - obj := resultExtendedCommunity{obj: &otg.ResultExtendedCommunity{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunity) msg() *otg.ResultExtendedCommunity { - return obj.obj -} - -func (obj *resultExtendedCommunity) setMsg(msg *otg.ResultExtendedCommunity) ResultExtendedCommunity { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunity struct { - obj *resultExtendedCommunity -} - -type marshalResultExtendedCommunity interface { - // ToProto marshals ResultExtendedCommunity to protobuf object *otg.ResultExtendedCommunity - ToProto() (*otg.ResultExtendedCommunity, error) - // ToPbText marshals ResultExtendedCommunity to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunity to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunity to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunity struct { - obj *resultExtendedCommunity -} - -type unMarshalResultExtendedCommunity interface { - // FromProto unmarshals ResultExtendedCommunity from protobuf object *otg.ResultExtendedCommunity - FromProto(msg *otg.ResultExtendedCommunity) (ResultExtendedCommunity, error) - // FromPbText unmarshals ResultExtendedCommunity from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunity from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunity from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunity) Marshal() marshalResultExtendedCommunity { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunity{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunity) Unmarshal() unMarshalResultExtendedCommunity { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunity{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunity) ToProto() (*otg.ResultExtendedCommunity, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunity) FromProto(msg *otg.ResultExtendedCommunity) (ResultExtendedCommunity, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunity) 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 *unMarshalresultExtendedCommunity) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalresultExtendedCommunity) 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 *unMarshalresultExtendedCommunity) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalresultExtendedCommunity) 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 *unMarshalresultExtendedCommunity) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *resultExtendedCommunity) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunity) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunity) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunity) Clone() (ResultExtendedCommunity, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunity() - 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 -} - -func (obj *resultExtendedCommunity) setNil() { - obj.structuredHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ResultExtendedCommunity is each received Extended Community attribute is available for retrieval in two forms. Support of the 'raw' format in which all 8 bytes (16 hex characters) is always present and available for use. In addition, if supported by the implementation, the Extended Community attribute may also be retrieved in the 'structured' format which is an optional field. -type ResultExtendedCommunity interface { - Validation - // msg marshals ResultExtendedCommunity to protobuf object *otg.ResultExtendedCommunity - // and doesn't set defaults - msg() *otg.ResultExtendedCommunity - // setMsg unmarshals ResultExtendedCommunity from protobuf object *otg.ResultExtendedCommunity - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunity) ResultExtendedCommunity - // provides marshal interface - Marshal() marshalResultExtendedCommunity - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunity - // validate validates ResultExtendedCommunity - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunity, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Raw returns string, set in ResultExtendedCommunity. - Raw() string - // SetRaw assigns string provided by user to ResultExtendedCommunity - SetRaw(value string) ResultExtendedCommunity - // HasRaw checks if Raw has been set in ResultExtendedCommunity - HasRaw() bool - // Structured returns ResultExtendedCommunityStructured, set in ResultExtendedCommunity. - // ResultExtendedCommunityStructured is the Extended Communities Attribute is a optional BGP attribute,defined in RFC4360 with the Type Code 16. - // Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. - // An extended community is an 8-bytes value. It is divided into two main parts. The first 2 bytes of the community encode a type and optonal sub-type field. - // The last 6 bytes (or 7 bytes for types without a sub-type) carry a unique set of data in a format defined by the type and optional sub-type field. - // Extended communities provide a larger range for grouping or categorizing communities. - Structured() ResultExtendedCommunityStructured - // SetStructured assigns ResultExtendedCommunityStructured provided by user to ResultExtendedCommunity. - // ResultExtendedCommunityStructured is the Extended Communities Attribute is a optional BGP attribute,defined in RFC4360 with the Type Code 16. - // Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. - // An extended community is an 8-bytes value. It is divided into two main parts. The first 2 bytes of the community encode a type and optonal sub-type field. - // The last 6 bytes (or 7 bytes for types without a sub-type) carry a unique set of data in a format defined by the type and optional sub-type field. - // Extended communities provide a larger range for grouping or categorizing communities. - SetStructured(value ResultExtendedCommunityStructured) ResultExtendedCommunity - // HasStructured checks if Structured has been set in ResultExtendedCommunity - HasStructured() bool - setNil() -} - -// The raw byte contents of the 8 bytes received in the Extended Community as 16 hex characters. -// Raw returns a string -func (obj *resultExtendedCommunity) Raw() string { - - return *obj.obj.Raw - -} - -// The raw byte contents of the 8 bytes received in the Extended Community as 16 hex characters. -// Raw returns a string -func (obj *resultExtendedCommunity) HasRaw() bool { - return obj.obj.Raw != nil -} - -// The raw byte contents of the 8 bytes received in the Extended Community as 16 hex characters. -// SetRaw sets the string value in the ResultExtendedCommunity object -func (obj *resultExtendedCommunity) SetRaw(value string) ResultExtendedCommunity { - - obj.obj.Raw = &value - return obj -} - -// description is TBD -// Structured returns a ResultExtendedCommunityStructured -func (obj *resultExtendedCommunity) Structured() ResultExtendedCommunityStructured { - if obj.obj.Structured == nil { - obj.obj.Structured = NewResultExtendedCommunityStructured().msg() - } - if obj.structuredHolder == nil { - obj.structuredHolder = &resultExtendedCommunityStructured{obj: obj.obj.Structured} - } - return obj.structuredHolder -} - -// description is TBD -// Structured returns a ResultExtendedCommunityStructured -func (obj *resultExtendedCommunity) HasStructured() bool { - return obj.obj.Structured != nil -} - -// description is TBD -// SetStructured sets the ResultExtendedCommunityStructured value in the ResultExtendedCommunity object -func (obj *resultExtendedCommunity) SetStructured(value ResultExtendedCommunityStructured) ResultExtendedCommunity { - - obj.structuredHolder = nil - obj.obj.Structured = value.msg() - - return obj -} - -func (obj *resultExtendedCommunity) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Raw != nil { - - if len(*obj.obj.Raw) > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "None <= length of ResultExtendedCommunity.Raw <= 16 but Got %d", - len(*obj.obj.Raw))) - } - - } - - if obj.obj.Structured != nil { - - obj.Structured().validateObj(vObj, set_default) - } - -} - -func (obj *resultExtendedCommunity) setDefault() { - -} - -// ***** ResultBgpAsPath ***** -type resultBgpAsPath struct { - validation - obj *otg.ResultBgpAsPath - marshaller marshalResultBgpAsPath - unMarshaller unMarshalResultBgpAsPath - segmentsHolder ResultBgpAsPathResultBgpAsPathSegmentIter -} - -func NewResultBgpAsPath() ResultBgpAsPath { - obj := resultBgpAsPath{obj: &otg.ResultBgpAsPath{}} - obj.setDefault() - return &obj -} - -func (obj *resultBgpAsPath) msg() *otg.ResultBgpAsPath { - return obj.obj -} - -func (obj *resultBgpAsPath) setMsg(msg *otg.ResultBgpAsPath) ResultBgpAsPath { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultBgpAsPath struct { - obj *resultBgpAsPath -} - -type marshalResultBgpAsPath interface { - // ToProto marshals ResultBgpAsPath to protobuf object *otg.ResultBgpAsPath - ToProto() (*otg.ResultBgpAsPath, error) - // ToPbText marshals ResultBgpAsPath to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultBgpAsPath to YAML text - ToYaml() (string, error) - // ToJson marshals ResultBgpAsPath to JSON text - ToJson() (string, error) -} - -type unMarshalresultBgpAsPath struct { - obj *resultBgpAsPath -} - -type unMarshalResultBgpAsPath interface { - // FromProto unmarshals ResultBgpAsPath from protobuf object *otg.ResultBgpAsPath - FromProto(msg *otg.ResultBgpAsPath) (ResultBgpAsPath, error) - // FromPbText unmarshals ResultBgpAsPath from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultBgpAsPath from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultBgpAsPath from JSON text - FromJson(value string) error -} - -func (obj *resultBgpAsPath) Marshal() marshalResultBgpAsPath { - if obj.marshaller == nil { - obj.marshaller = &marshalresultBgpAsPath{obj: obj} - } - return obj.marshaller -} - -func (obj *resultBgpAsPath) Unmarshal() unMarshalResultBgpAsPath { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultBgpAsPath{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultBgpAsPath) ToProto() (*otg.ResultBgpAsPath, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultBgpAsPath) FromProto(msg *otg.ResultBgpAsPath) (ResultBgpAsPath, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultBgpAsPath) 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 *unMarshalresultBgpAsPath) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalresultBgpAsPath) 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 *unMarshalresultBgpAsPath) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalresultBgpAsPath) 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 *unMarshalresultBgpAsPath) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *resultBgpAsPath) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultBgpAsPath) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultBgpAsPath) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultBgpAsPath) Clone() (ResultBgpAsPath, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultBgpAsPath() - 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 -} - -func (obj *resultBgpAsPath) setNil() { - obj.segmentsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ResultBgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. -type ResultBgpAsPath interface { - Validation - // msg marshals ResultBgpAsPath to protobuf object *otg.ResultBgpAsPath - // and doesn't set defaults - msg() *otg.ResultBgpAsPath - // setMsg unmarshals ResultBgpAsPath from protobuf object *otg.ResultBgpAsPath - // and doesn't set defaults - setMsg(*otg.ResultBgpAsPath) ResultBgpAsPath - // provides marshal interface - Marshal() marshalResultBgpAsPath - // provides unmarshal interface - Unmarshal() unMarshalResultBgpAsPath - // validate validates ResultBgpAsPath - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultBgpAsPath, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Segments returns ResultBgpAsPathResultBgpAsPathSegmentIterIter, set in ResultBgpAsPath - Segments() ResultBgpAsPathResultBgpAsPathSegmentIter - setNil() -} - -// AS Path segments present in the received AS Path attribute. -// Segments returns a []ResultBgpAsPathSegment -func (obj *resultBgpAsPath) Segments() ResultBgpAsPathResultBgpAsPathSegmentIter { - if len(obj.obj.Segments) == 0 { - obj.obj.Segments = []*otg.ResultBgpAsPathSegment{} - } - if obj.segmentsHolder == nil { - obj.segmentsHolder = newResultBgpAsPathResultBgpAsPathSegmentIter(&obj.obj.Segments).setMsg(obj) - } - return obj.segmentsHolder -} - -type resultBgpAsPathResultBgpAsPathSegmentIter struct { - obj *resultBgpAsPath - resultBgpAsPathSegmentSlice []ResultBgpAsPathSegment - fieldPtr *[]*otg.ResultBgpAsPathSegment -} - -func newResultBgpAsPathResultBgpAsPathSegmentIter(ptr *[]*otg.ResultBgpAsPathSegment) ResultBgpAsPathResultBgpAsPathSegmentIter { - return &resultBgpAsPathResultBgpAsPathSegmentIter{fieldPtr: ptr} -} - -type ResultBgpAsPathResultBgpAsPathSegmentIter interface { - setMsg(*resultBgpAsPath) ResultBgpAsPathResultBgpAsPathSegmentIter - Items() []ResultBgpAsPathSegment - Add() ResultBgpAsPathSegment - Append(items ...ResultBgpAsPathSegment) ResultBgpAsPathResultBgpAsPathSegmentIter - Set(index int, newObj ResultBgpAsPathSegment) ResultBgpAsPathResultBgpAsPathSegmentIter - Clear() ResultBgpAsPathResultBgpAsPathSegmentIter - clearHolderSlice() ResultBgpAsPathResultBgpAsPathSegmentIter - appendHolderSlice(item ResultBgpAsPathSegment) ResultBgpAsPathResultBgpAsPathSegmentIter -} - -func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) setMsg(msg *resultBgpAsPath) ResultBgpAsPathResultBgpAsPathSegmentIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&resultBgpAsPathSegment{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) Items() []ResultBgpAsPathSegment { - return obj.resultBgpAsPathSegmentSlice -} - -func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) Add() ResultBgpAsPathSegment { - newObj := &otg.ResultBgpAsPathSegment{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &resultBgpAsPathSegment{obj: newObj} - newLibObj.setDefault() - obj.resultBgpAsPathSegmentSlice = append(obj.resultBgpAsPathSegmentSlice, newLibObj) - return newLibObj -} - -func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) Append(items ...ResultBgpAsPathSegment) ResultBgpAsPathResultBgpAsPathSegmentIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.resultBgpAsPathSegmentSlice = append(obj.resultBgpAsPathSegmentSlice, item) - } - return obj -} - -func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) Set(index int, newObj ResultBgpAsPathSegment) ResultBgpAsPathResultBgpAsPathSegmentIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.resultBgpAsPathSegmentSlice[index] = newObj - return obj -} -func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) Clear() ResultBgpAsPathResultBgpAsPathSegmentIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.ResultBgpAsPathSegment{} - obj.resultBgpAsPathSegmentSlice = []ResultBgpAsPathSegment{} - } - return obj -} -func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) clearHolderSlice() ResultBgpAsPathResultBgpAsPathSegmentIter { - if len(obj.resultBgpAsPathSegmentSlice) > 0 { - obj.resultBgpAsPathSegmentSlice = []ResultBgpAsPathSegment{} - } - return obj -} -func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) appendHolderSlice(item ResultBgpAsPathSegment) ResultBgpAsPathResultBgpAsPathSegmentIter { - obj.resultBgpAsPathSegmentSlice = append(obj.resultBgpAsPathSegmentSlice, item) - return obj -} - -func (obj *resultBgpAsPath) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Segments) != 0 { - - if set_default { - obj.Segments().clearHolderSlice() - for _, item := range obj.obj.Segments { - obj.Segments().appendHolderSlice(&resultBgpAsPathSegment{obj: item}) - } - } - for _, item := range obj.Segments().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *resultBgpAsPath) setDefault() { - -} - -// ***** IsisLspFlags ***** -type isisLspFlags struct { - validation - obj *otg.IsisLspFlags - marshaller marshalIsisLspFlags - unMarshaller unMarshalIsisLspFlags -} - -func NewIsisLspFlags() IsisLspFlags { - obj := isisLspFlags{obj: &otg.IsisLspFlags{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspFlags) msg() *otg.IsisLspFlags { - return obj.obj -} - -func (obj *isisLspFlags) setMsg(msg *otg.IsisLspFlags) IsisLspFlags { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspFlags struct { - obj *isisLspFlags -} - -type marshalIsisLspFlags interface { - // ToProto marshals IsisLspFlags to protobuf object *otg.IsisLspFlags - ToProto() (*otg.IsisLspFlags, error) - // ToPbText marshals IsisLspFlags to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspFlags to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspFlags to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspFlags struct { - obj *isisLspFlags -} - -type unMarshalIsisLspFlags interface { - // FromProto unmarshals IsisLspFlags from protobuf object *otg.IsisLspFlags - FromProto(msg *otg.IsisLspFlags) (IsisLspFlags, error) - // FromPbText unmarshals IsisLspFlags from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspFlags from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspFlags from JSON text - FromJson(value string) error -} - -func (obj *isisLspFlags) Marshal() marshalIsisLspFlags { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspFlags{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspFlags) Unmarshal() unMarshalIsisLspFlags { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspFlags{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspFlags) ToProto() (*otg.IsisLspFlags, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspFlags) FromProto(msg *otg.IsisLspFlags) (IsisLspFlags, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspFlags) 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 *unMarshalisisLspFlags) 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 *marshalisisLspFlags) 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 *unMarshalisisLspFlags) 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 *marshalisisLspFlags) 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 *unMarshalisisLspFlags) 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 *isisLspFlags) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspFlags) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspFlags) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspFlags) Clone() (IsisLspFlags, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspFlags() - 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 -} - -// IsisLspFlags is lSP Type flags. -type IsisLspFlags interface { - Validation - // msg marshals IsisLspFlags to protobuf object *otg.IsisLspFlags - // and doesn't set defaults - msg() *otg.IsisLspFlags - // setMsg unmarshals IsisLspFlags from protobuf object *otg.IsisLspFlags - // and doesn't set defaults - setMsg(*otg.IsisLspFlags) IsisLspFlags - // provides marshal interface - Marshal() marshalIsisLspFlags - // provides unmarshal interface - Unmarshal() unMarshalIsisLspFlags - // validate validates IsisLspFlags - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspFlags, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PartitionRepair returns bool, set in IsisLspFlags. - PartitionRepair() bool - // SetPartitionRepair assigns bool provided by user to IsisLspFlags - SetPartitionRepair(value bool) IsisLspFlags - // HasPartitionRepair checks if PartitionRepair has been set in IsisLspFlags - HasPartitionRepair() bool - // AttachedError returns bool, set in IsisLspFlags. - AttachedError() bool - // SetAttachedError assigns bool provided by user to IsisLspFlags - SetAttachedError(value bool) IsisLspFlags - // HasAttachedError checks if AttachedError has been set in IsisLspFlags - HasAttachedError() bool - // AttachedExpense returns bool, set in IsisLspFlags. - AttachedExpense() bool - // SetAttachedExpense assigns bool provided by user to IsisLspFlags - SetAttachedExpense(value bool) IsisLspFlags - // HasAttachedExpense checks if AttachedExpense has been set in IsisLspFlags - HasAttachedExpense() bool - // AttachedDelay returns bool, set in IsisLspFlags. - AttachedDelay() bool - // SetAttachedDelay assigns bool provided by user to IsisLspFlags - SetAttachedDelay(value bool) IsisLspFlags - // HasAttachedDelay checks if AttachedDelay has been set in IsisLspFlags - HasAttachedDelay() bool - // AttachedDefault returns bool, set in IsisLspFlags. - AttachedDefault() bool - // SetAttachedDefault assigns bool provided by user to IsisLspFlags - SetAttachedDefault(value bool) IsisLspFlags - // HasAttachedDefault checks if AttachedDefault has been set in IsisLspFlags - HasAttachedDefault() bool - // Overload returns bool, set in IsisLspFlags. - Overload() bool - // SetOverload assigns bool provided by user to IsisLspFlags - SetOverload(value bool) IsisLspFlags - // HasOverload checks if Overload has been set in IsisLspFlags - HasOverload() bool -} - -// When set, the originator supports partition repair. -// PartitionRepair returns a bool -func (obj *isisLspFlags) PartitionRepair() bool { - - return *obj.obj.PartitionRepair - -} - -// When set, the originator supports partition repair. -// PartitionRepair returns a bool -func (obj *isisLspFlags) HasPartitionRepair() bool { - return obj.obj.PartitionRepair != nil -} - -// When set, the originator supports partition repair. -// SetPartitionRepair sets the bool value in the IsisLspFlags object -func (obj *isisLspFlags) SetPartitionRepair(value bool) IsisLspFlags { - - obj.obj.PartitionRepair = &value - return obj -} - -// When set, the originator is attached to another area using the referred metric. -// AttachedError returns a bool -func (obj *isisLspFlags) AttachedError() bool { - - return *obj.obj.AttachedError - -} - -// When set, the originator is attached to another area using the referred metric. -// AttachedError returns a bool -func (obj *isisLspFlags) HasAttachedError() bool { - return obj.obj.AttachedError != nil -} - -// When set, the originator is attached to another area using the referred metric. -// SetAttachedError sets the bool value in the IsisLspFlags object -func (obj *isisLspFlags) SetAttachedError(value bool) IsisLspFlags { - - obj.obj.AttachedError = &value - return obj -} - -// When set, the originator is attached to another -// area using the referred metric. -// AttachedExpense returns a bool -func (obj *isisLspFlags) AttachedExpense() bool { - - return *obj.obj.AttachedExpense - -} - -// When set, the originator is attached to another -// area using the referred metric. -// AttachedExpense returns a bool -func (obj *isisLspFlags) HasAttachedExpense() bool { - return obj.obj.AttachedExpense != nil -} - -// When set, the originator is attached to another -// area using the referred metric. -// SetAttachedExpense sets the bool value in the IsisLspFlags object -func (obj *isisLspFlags) SetAttachedExpense(value bool) IsisLspFlags { - - obj.obj.AttachedExpense = &value - return obj -} - -// Delay Metric - when set, the originator is attached to another -// area using the referred metric. -// AttachedDelay returns a bool -func (obj *isisLspFlags) AttachedDelay() bool { - - return *obj.obj.AttachedDelay - -} - -// Delay Metric - when set, the originator is attached to another -// area using the referred metric. -// AttachedDelay returns a bool -func (obj *isisLspFlags) HasAttachedDelay() bool { - return obj.obj.AttachedDelay != nil -} - -// Delay Metric - when set, the originator is attached to another -// area using the referred metric. -// SetAttachedDelay sets the bool value in the IsisLspFlags object -func (obj *isisLspFlags) SetAttachedDelay(value bool) IsisLspFlags { - - obj.obj.AttachedDelay = &value - return obj -} - -// Default Metric - when set, the originator is attached to another -// area using the referred metric. -// AttachedDefault returns a bool -func (obj *isisLspFlags) AttachedDefault() bool { - - return *obj.obj.AttachedDefault - -} - -// Default Metric - when set, the originator is attached to another -// area using the referred metric. -// AttachedDefault returns a bool -func (obj *isisLspFlags) HasAttachedDefault() bool { - return obj.obj.AttachedDefault != nil -} - -// Default Metric - when set, the originator is attached to another -// area using the referred metric. -// SetAttachedDefault sets the bool value in the IsisLspFlags object -func (obj *isisLspFlags) SetAttachedDefault(value bool) IsisLspFlags { - - obj.obj.AttachedDefault = &value - return obj -} - -// Overload bit - when set, the originator is overloaded, and must -// be avoided in path calculation. -// Overload returns a bool -func (obj *isisLspFlags) Overload() bool { - - return *obj.obj.Overload - -} - -// Overload bit - when set, the originator is overloaded, and must -// be avoided in path calculation. -// Overload returns a bool -func (obj *isisLspFlags) HasOverload() bool { - return obj.obj.Overload != nil -} - -// Overload bit - when set, the originator is overloaded, and must -// be avoided in path calculation. -// SetOverload sets the bool value in the IsisLspFlags object -func (obj *isisLspFlags) SetOverload(value bool) IsisLspFlags { - - obj.obj.Overload = &value - return obj -} - -func (obj *isisLspFlags) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *isisLspFlags) setDefault() { - -} - -// ***** IsisLspTlvs ***** -type isisLspTlvs struct { - validation - obj *otg.IsisLspTlvs - marshaller marshalIsisLspTlvs - unMarshaller unMarshalIsisLspTlvs - hostnameTlvsHolder IsisLspTlvsIsisLspHostnameIter - isReachabilityTlvsHolder IsisLspTlvsIsisLspIsReachabilityTlvIter - extendedIsReachabilityTlvsHolder IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter - ipv4InternalReachabilityTlvsHolder IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter - ipv4ExternalReachabilityTlvsHolder IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter - extendedIpv4ReachabilityTlvsHolder IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter - ipv6ReachabilityTlvsHolder IsisLspTlvsIsisLspIpv6ReachabilityTlvIter -} - -func NewIsisLspTlvs() IsisLspTlvs { - obj := isisLspTlvs{obj: &otg.IsisLspTlvs{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspTlvs) msg() *otg.IsisLspTlvs { - return obj.obj -} - -func (obj *isisLspTlvs) setMsg(msg *otg.IsisLspTlvs) IsisLspTlvs { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspTlvs struct { - obj *isisLspTlvs -} - -type marshalIsisLspTlvs interface { - // ToProto marshals IsisLspTlvs to protobuf object *otg.IsisLspTlvs - ToProto() (*otg.IsisLspTlvs, error) - // ToPbText marshals IsisLspTlvs to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspTlvs to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspTlvs to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspTlvs struct { - obj *isisLspTlvs -} - -type unMarshalIsisLspTlvs interface { - // FromProto unmarshals IsisLspTlvs from protobuf object *otg.IsisLspTlvs - FromProto(msg *otg.IsisLspTlvs) (IsisLspTlvs, error) - // FromPbText unmarshals IsisLspTlvs from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspTlvs from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspTlvs from JSON text - FromJson(value string) error -} - -func (obj *isisLspTlvs) Marshal() marshalIsisLspTlvs { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspTlvs{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspTlvs) Unmarshal() unMarshalIsisLspTlvs { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspTlvs{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspTlvs) ToProto() (*otg.IsisLspTlvs, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspTlvs) FromProto(msg *otg.IsisLspTlvs) (IsisLspTlvs, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspTlvs) 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 *unMarshalisisLspTlvs) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisLspTlvs) 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 *unMarshalisisLspTlvs) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisLspTlvs) 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 *unMarshalisisLspTlvs) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisLspTlvs) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspTlvs) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspTlvs) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspTlvs) Clone() (IsisLspTlvs, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspTlvs() - 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 -} - -func (obj *isisLspTlvs) setNil() { - obj.hostnameTlvsHolder = nil - obj.isReachabilityTlvsHolder = nil - obj.extendedIsReachabilityTlvsHolder = nil - obj.ipv4InternalReachabilityTlvsHolder = nil - obj.ipv4ExternalReachabilityTlvsHolder = nil - obj.extendedIpv4ReachabilityTlvsHolder = nil - obj.ipv6ReachabilityTlvsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisLspTlvs is this contains the list of TLVs present in one LSP. -type IsisLspTlvs interface { - Validation - // msg marshals IsisLspTlvs to protobuf object *otg.IsisLspTlvs - // and doesn't set defaults - msg() *otg.IsisLspTlvs - // setMsg unmarshals IsisLspTlvs from protobuf object *otg.IsisLspTlvs - // and doesn't set defaults - setMsg(*otg.IsisLspTlvs) IsisLspTlvs - // provides marshal interface - Marshal() marshalIsisLspTlvs - // provides unmarshal interface - Unmarshal() unMarshalIsisLspTlvs - // validate validates IsisLspTlvs - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspTlvs, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // HostnameTlvs returns IsisLspTlvsIsisLspHostnameIterIter, set in IsisLspTlvs - HostnameTlvs() IsisLspTlvsIsisLspHostnameIter - // IsReachabilityTlvs returns IsisLspTlvsIsisLspIsReachabilityTlvIterIter, set in IsisLspTlvs - IsReachabilityTlvs() IsisLspTlvsIsisLspIsReachabilityTlvIter - // ExtendedIsReachabilityTlvs returns IsisLspTlvsIsisLspExtendedIsReachabilityTlvIterIter, set in IsisLspTlvs - ExtendedIsReachabilityTlvs() IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter - // Ipv4InternalReachabilityTlvs returns IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIterIter, set in IsisLspTlvs - Ipv4InternalReachabilityTlvs() IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter - // Ipv4ExternalReachabilityTlvs returns IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIterIter, set in IsisLspTlvs - Ipv4ExternalReachabilityTlvs() IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter - // ExtendedIpv4ReachabilityTlvs returns IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIterIter, set in IsisLspTlvs - ExtendedIpv4ReachabilityTlvs() IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter - // Ipv6ReachabilityTlvs returns IsisLspTlvsIsisLspIpv6ReachabilityTlvIterIter, set in IsisLspTlvs - Ipv6ReachabilityTlvs() IsisLspTlvsIsisLspIpv6ReachabilityTlvIter - setNil() -} - -// Array of Hostname TLVs ( type 137) present in this LSP. -// HostnameTlvs returns a []IsisLspHostname -func (obj *isisLspTlvs) HostnameTlvs() IsisLspTlvsIsisLspHostnameIter { - if len(obj.obj.HostnameTlvs) == 0 { - obj.obj.HostnameTlvs = []*otg.IsisLspHostname{} - } - if obj.hostnameTlvsHolder == nil { - obj.hostnameTlvsHolder = newIsisLspTlvsIsisLspHostnameIter(&obj.obj.HostnameTlvs).setMsg(obj) - } - return obj.hostnameTlvsHolder -} - -type isisLspTlvsIsisLspHostnameIter struct { - obj *isisLspTlvs - isisLspHostnameSlice []IsisLspHostname - fieldPtr *[]*otg.IsisLspHostname -} - -func newIsisLspTlvsIsisLspHostnameIter(ptr *[]*otg.IsisLspHostname) IsisLspTlvsIsisLspHostnameIter { - return &isisLspTlvsIsisLspHostnameIter{fieldPtr: ptr} -} - -type IsisLspTlvsIsisLspHostnameIter interface { - setMsg(*isisLspTlvs) IsisLspTlvsIsisLspHostnameIter - Items() []IsisLspHostname - Add() IsisLspHostname - Append(items ...IsisLspHostname) IsisLspTlvsIsisLspHostnameIter - Set(index int, newObj IsisLspHostname) IsisLspTlvsIsisLspHostnameIter - Clear() IsisLspTlvsIsisLspHostnameIter - clearHolderSlice() IsisLspTlvsIsisLspHostnameIter - appendHolderSlice(item IsisLspHostname) IsisLspTlvsIsisLspHostnameIter -} - -func (obj *isisLspTlvsIsisLspHostnameIter) setMsg(msg *isisLspTlvs) IsisLspTlvsIsisLspHostnameIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspHostname{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisLspTlvsIsisLspHostnameIter) Items() []IsisLspHostname { - return obj.isisLspHostnameSlice -} - -func (obj *isisLspTlvsIsisLspHostnameIter) Add() IsisLspHostname { - newObj := &otg.IsisLspHostname{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspHostname{obj: newObj} - newLibObj.setDefault() - obj.isisLspHostnameSlice = append(obj.isisLspHostnameSlice, newLibObj) - return newLibObj -} - -func (obj *isisLspTlvsIsisLspHostnameIter) Append(items ...IsisLspHostname) IsisLspTlvsIsisLspHostnameIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspHostnameSlice = append(obj.isisLspHostnameSlice, item) - } - return obj -} - -func (obj *isisLspTlvsIsisLspHostnameIter) Set(index int, newObj IsisLspHostname) IsisLspTlvsIsisLspHostnameIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspHostnameSlice[index] = newObj - return obj -} -func (obj *isisLspTlvsIsisLspHostnameIter) Clear() IsisLspTlvsIsisLspHostnameIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspHostname{} - obj.isisLspHostnameSlice = []IsisLspHostname{} - } - return obj -} -func (obj *isisLspTlvsIsisLspHostnameIter) clearHolderSlice() IsisLspTlvsIsisLspHostnameIter { - if len(obj.isisLspHostnameSlice) > 0 { - obj.isisLspHostnameSlice = []IsisLspHostname{} - } - return obj -} -func (obj *isisLspTlvsIsisLspHostnameIter) appendHolderSlice(item IsisLspHostname) IsisLspTlvsIsisLspHostnameIter { - obj.isisLspHostnameSlice = append(obj.isisLspHostnameSlice, item) - return obj -} - -// Array of IS-Reachability TLVs (type 2) present in this LSP. -// IsReachabilityTlvs returns a []IsisLspIsReachabilityTlv -func (obj *isisLspTlvs) IsReachabilityTlvs() IsisLspTlvsIsisLspIsReachabilityTlvIter { - if len(obj.obj.IsReachabilityTlvs) == 0 { - obj.obj.IsReachabilityTlvs = []*otg.IsisLspIsReachabilityTlv{} - } - if obj.isReachabilityTlvsHolder == nil { - obj.isReachabilityTlvsHolder = newIsisLspTlvsIsisLspIsReachabilityTlvIter(&obj.obj.IsReachabilityTlvs).setMsg(obj) - } - return obj.isReachabilityTlvsHolder -} - -type isisLspTlvsIsisLspIsReachabilityTlvIter struct { - obj *isisLspTlvs - isisLspIsReachabilityTlvSlice []IsisLspIsReachabilityTlv - fieldPtr *[]*otg.IsisLspIsReachabilityTlv -} - -func newIsisLspTlvsIsisLspIsReachabilityTlvIter(ptr *[]*otg.IsisLspIsReachabilityTlv) IsisLspTlvsIsisLspIsReachabilityTlvIter { - return &isisLspTlvsIsisLspIsReachabilityTlvIter{fieldPtr: ptr} -} - -type IsisLspTlvsIsisLspIsReachabilityTlvIter interface { - setMsg(*isisLspTlvs) IsisLspTlvsIsisLspIsReachabilityTlvIter - Items() []IsisLspIsReachabilityTlv - Add() IsisLspIsReachabilityTlv - Append(items ...IsisLspIsReachabilityTlv) IsisLspTlvsIsisLspIsReachabilityTlvIter - Set(index int, newObj IsisLspIsReachabilityTlv) IsisLspTlvsIsisLspIsReachabilityTlvIter - Clear() IsisLspTlvsIsisLspIsReachabilityTlvIter - clearHolderSlice() IsisLspTlvsIsisLspIsReachabilityTlvIter - appendHolderSlice(item IsisLspIsReachabilityTlv) IsisLspTlvsIsisLspIsReachabilityTlvIter -} - -func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) setMsg(msg *isisLspTlvs) IsisLspTlvsIsisLspIsReachabilityTlvIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspIsReachabilityTlv{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) Items() []IsisLspIsReachabilityTlv { - return obj.isisLspIsReachabilityTlvSlice -} - -func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) Add() IsisLspIsReachabilityTlv { - newObj := &otg.IsisLspIsReachabilityTlv{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspIsReachabilityTlv{obj: newObj} - newLibObj.setDefault() - obj.isisLspIsReachabilityTlvSlice = append(obj.isisLspIsReachabilityTlvSlice, newLibObj) - return newLibObj -} - -func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) Append(items ...IsisLspIsReachabilityTlv) IsisLspTlvsIsisLspIsReachabilityTlvIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspIsReachabilityTlvSlice = append(obj.isisLspIsReachabilityTlvSlice, item) - } - return obj -} - -func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) Set(index int, newObj IsisLspIsReachabilityTlv) IsisLspTlvsIsisLspIsReachabilityTlvIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspIsReachabilityTlvSlice[index] = newObj - return obj -} -func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) Clear() IsisLspTlvsIsisLspIsReachabilityTlvIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspIsReachabilityTlv{} - obj.isisLspIsReachabilityTlvSlice = []IsisLspIsReachabilityTlv{} - } - return obj -} -func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) clearHolderSlice() IsisLspTlvsIsisLspIsReachabilityTlvIter { - if len(obj.isisLspIsReachabilityTlvSlice) > 0 { - obj.isisLspIsReachabilityTlvSlice = []IsisLspIsReachabilityTlv{} - } - return obj -} -func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) appendHolderSlice(item IsisLspIsReachabilityTlv) IsisLspTlvsIsisLspIsReachabilityTlvIter { - obj.isisLspIsReachabilityTlvSlice = append(obj.isisLspIsReachabilityTlvSlice, item) - return obj -} - -// Array of Extended IS-Reachability TLVs (type 22) present in this LSP. -// ExtendedIsReachabilityTlvs returns a []IsisLspExtendedIsReachabilityTlv -func (obj *isisLspTlvs) ExtendedIsReachabilityTlvs() IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { - if len(obj.obj.ExtendedIsReachabilityTlvs) == 0 { - obj.obj.ExtendedIsReachabilityTlvs = []*otg.IsisLspExtendedIsReachabilityTlv{} - } - if obj.extendedIsReachabilityTlvsHolder == nil { - obj.extendedIsReachabilityTlvsHolder = newIsisLspTlvsIsisLspExtendedIsReachabilityTlvIter(&obj.obj.ExtendedIsReachabilityTlvs).setMsg(obj) - } - return obj.extendedIsReachabilityTlvsHolder -} - -type isisLspTlvsIsisLspExtendedIsReachabilityTlvIter struct { - obj *isisLspTlvs - isisLspExtendedIsReachabilityTlvSlice []IsisLspExtendedIsReachabilityTlv - fieldPtr *[]*otg.IsisLspExtendedIsReachabilityTlv -} - -func newIsisLspTlvsIsisLspExtendedIsReachabilityTlvIter(ptr *[]*otg.IsisLspExtendedIsReachabilityTlv) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { - return &isisLspTlvsIsisLspExtendedIsReachabilityTlvIter{fieldPtr: ptr} -} - -type IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter interface { - setMsg(*isisLspTlvs) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter - Items() []IsisLspExtendedIsReachabilityTlv - Add() IsisLspExtendedIsReachabilityTlv - Append(items ...IsisLspExtendedIsReachabilityTlv) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter - Set(index int, newObj IsisLspExtendedIsReachabilityTlv) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter - Clear() IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter - clearHolderSlice() IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter - appendHolderSlice(item IsisLspExtendedIsReachabilityTlv) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter -} - -func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) setMsg(msg *isisLspTlvs) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspExtendedIsReachabilityTlv{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) Items() []IsisLspExtendedIsReachabilityTlv { - return obj.isisLspExtendedIsReachabilityTlvSlice -} - -func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) Add() IsisLspExtendedIsReachabilityTlv { - newObj := &otg.IsisLspExtendedIsReachabilityTlv{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspExtendedIsReachabilityTlv{obj: newObj} - newLibObj.setDefault() - obj.isisLspExtendedIsReachabilityTlvSlice = append(obj.isisLspExtendedIsReachabilityTlvSlice, newLibObj) - return newLibObj -} - -func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) Append(items ...IsisLspExtendedIsReachabilityTlv) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspExtendedIsReachabilityTlvSlice = append(obj.isisLspExtendedIsReachabilityTlvSlice, item) - } - return obj -} - -func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) Set(index int, newObj IsisLspExtendedIsReachabilityTlv) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspExtendedIsReachabilityTlvSlice[index] = newObj - return obj -} -func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) Clear() IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspExtendedIsReachabilityTlv{} - obj.isisLspExtendedIsReachabilityTlvSlice = []IsisLspExtendedIsReachabilityTlv{} - } - return obj -} -func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) clearHolderSlice() IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { - if len(obj.isisLspExtendedIsReachabilityTlvSlice) > 0 { - obj.isisLspExtendedIsReachabilityTlvSlice = []IsisLspExtendedIsReachabilityTlv{} - } - return obj -} -func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) appendHolderSlice(item IsisLspExtendedIsReachabilityTlv) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { - obj.isisLspExtendedIsReachabilityTlvSlice = append(obj.isisLspExtendedIsReachabilityTlvSlice, item) - return obj -} - -// Array of IPv4 Internal Reachability TLVs (type 128) present in this LSP. -// Ipv4InternalReachabilityTlvs returns a []IsisLspIpv4InternalReachabilityTlv -func (obj *isisLspTlvs) Ipv4InternalReachabilityTlvs() IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { - if len(obj.obj.Ipv4InternalReachabilityTlvs) == 0 { - obj.obj.Ipv4InternalReachabilityTlvs = []*otg.IsisLspIpv4InternalReachabilityTlv{} - } - if obj.ipv4InternalReachabilityTlvsHolder == nil { - obj.ipv4InternalReachabilityTlvsHolder = newIsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter(&obj.obj.Ipv4InternalReachabilityTlvs).setMsg(obj) - } - return obj.ipv4InternalReachabilityTlvsHolder -} - -type isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter struct { - obj *isisLspTlvs - isisLspIpv4InternalReachabilityTlvSlice []IsisLspIpv4InternalReachabilityTlv - fieldPtr *[]*otg.IsisLspIpv4InternalReachabilityTlv -} - -func newIsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter(ptr *[]*otg.IsisLspIpv4InternalReachabilityTlv) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { - return &isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter{fieldPtr: ptr} -} - -type IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter interface { - setMsg(*isisLspTlvs) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter - Items() []IsisLspIpv4InternalReachabilityTlv - Add() IsisLspIpv4InternalReachabilityTlv - Append(items ...IsisLspIpv4InternalReachabilityTlv) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter - Set(index int, newObj IsisLspIpv4InternalReachabilityTlv) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter - Clear() IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter - clearHolderSlice() IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter - appendHolderSlice(item IsisLspIpv4InternalReachabilityTlv) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter -} - -func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) setMsg(msg *isisLspTlvs) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspIpv4InternalReachabilityTlv{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) Items() []IsisLspIpv4InternalReachabilityTlv { - return obj.isisLspIpv4InternalReachabilityTlvSlice -} - -func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) Add() IsisLspIpv4InternalReachabilityTlv { - newObj := &otg.IsisLspIpv4InternalReachabilityTlv{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspIpv4InternalReachabilityTlv{obj: newObj} - newLibObj.setDefault() - obj.isisLspIpv4InternalReachabilityTlvSlice = append(obj.isisLspIpv4InternalReachabilityTlvSlice, newLibObj) - return newLibObj -} - -func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) Append(items ...IsisLspIpv4InternalReachabilityTlv) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspIpv4InternalReachabilityTlvSlice = append(obj.isisLspIpv4InternalReachabilityTlvSlice, item) - } - return obj -} - -func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) Set(index int, newObj IsisLspIpv4InternalReachabilityTlv) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspIpv4InternalReachabilityTlvSlice[index] = newObj - return obj -} -func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) Clear() IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspIpv4InternalReachabilityTlv{} - obj.isisLspIpv4InternalReachabilityTlvSlice = []IsisLspIpv4InternalReachabilityTlv{} - } - return obj -} -func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) clearHolderSlice() IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { - if len(obj.isisLspIpv4InternalReachabilityTlvSlice) > 0 { - obj.isisLspIpv4InternalReachabilityTlvSlice = []IsisLspIpv4InternalReachabilityTlv{} - } - return obj -} -func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) appendHolderSlice(item IsisLspIpv4InternalReachabilityTlv) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { - obj.isisLspIpv4InternalReachabilityTlvSlice = append(obj.isisLspIpv4InternalReachabilityTlvSlice, item) - return obj -} - -// Array of IPv4 External Reachability TLVs (type 130) present in this LSP. -// Ipv4ExternalReachabilityTlvs returns a []IsisLspIpv4ExternalReachabilityTlv -func (obj *isisLspTlvs) Ipv4ExternalReachabilityTlvs() IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { - if len(obj.obj.Ipv4ExternalReachabilityTlvs) == 0 { - obj.obj.Ipv4ExternalReachabilityTlvs = []*otg.IsisLspIpv4ExternalReachabilityTlv{} - } - if obj.ipv4ExternalReachabilityTlvsHolder == nil { - obj.ipv4ExternalReachabilityTlvsHolder = newIsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter(&obj.obj.Ipv4ExternalReachabilityTlvs).setMsg(obj) - } - return obj.ipv4ExternalReachabilityTlvsHolder -} - -type isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter struct { - obj *isisLspTlvs - isisLspIpv4ExternalReachabilityTlvSlice []IsisLspIpv4ExternalReachabilityTlv - fieldPtr *[]*otg.IsisLspIpv4ExternalReachabilityTlv -} - -func newIsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter(ptr *[]*otg.IsisLspIpv4ExternalReachabilityTlv) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { - return &isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter{fieldPtr: ptr} -} - -type IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter interface { - setMsg(*isisLspTlvs) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter - Items() []IsisLspIpv4ExternalReachabilityTlv - Add() IsisLspIpv4ExternalReachabilityTlv - Append(items ...IsisLspIpv4ExternalReachabilityTlv) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter - Set(index int, newObj IsisLspIpv4ExternalReachabilityTlv) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter - Clear() IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter - clearHolderSlice() IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter - appendHolderSlice(item IsisLspIpv4ExternalReachabilityTlv) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter -} - -func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) setMsg(msg *isisLspTlvs) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspIpv4ExternalReachabilityTlv{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) Items() []IsisLspIpv4ExternalReachabilityTlv { - return obj.isisLspIpv4ExternalReachabilityTlvSlice -} - -func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) Add() IsisLspIpv4ExternalReachabilityTlv { - newObj := &otg.IsisLspIpv4ExternalReachabilityTlv{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspIpv4ExternalReachabilityTlv{obj: newObj} - newLibObj.setDefault() - obj.isisLspIpv4ExternalReachabilityTlvSlice = append(obj.isisLspIpv4ExternalReachabilityTlvSlice, newLibObj) - return newLibObj -} - -func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) Append(items ...IsisLspIpv4ExternalReachabilityTlv) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspIpv4ExternalReachabilityTlvSlice = append(obj.isisLspIpv4ExternalReachabilityTlvSlice, item) - } - return obj -} - -func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) Set(index int, newObj IsisLspIpv4ExternalReachabilityTlv) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspIpv4ExternalReachabilityTlvSlice[index] = newObj - return obj -} -func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) Clear() IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspIpv4ExternalReachabilityTlv{} - obj.isisLspIpv4ExternalReachabilityTlvSlice = []IsisLspIpv4ExternalReachabilityTlv{} - } - return obj -} -func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) clearHolderSlice() IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { - if len(obj.isisLspIpv4ExternalReachabilityTlvSlice) > 0 { - obj.isisLspIpv4ExternalReachabilityTlvSlice = []IsisLspIpv4ExternalReachabilityTlv{} - } - return obj -} -func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) appendHolderSlice(item IsisLspIpv4ExternalReachabilityTlv) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { - obj.isisLspIpv4ExternalReachabilityTlvSlice = append(obj.isisLspIpv4ExternalReachabilityTlvSlice, item) - return obj -} - -// Array of IPv4 Extended Reachability TLVs (type 135) present in this LSP. -// ExtendedIpv4ReachabilityTlvs returns a []IsisLspExtendedIpv4ReachabilityTlv -func (obj *isisLspTlvs) ExtendedIpv4ReachabilityTlvs() IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { - if len(obj.obj.ExtendedIpv4ReachabilityTlvs) == 0 { - obj.obj.ExtendedIpv4ReachabilityTlvs = []*otg.IsisLspExtendedIpv4ReachabilityTlv{} - } - if obj.extendedIpv4ReachabilityTlvsHolder == nil { - obj.extendedIpv4ReachabilityTlvsHolder = newIsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter(&obj.obj.ExtendedIpv4ReachabilityTlvs).setMsg(obj) - } - return obj.extendedIpv4ReachabilityTlvsHolder -} - -type isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter struct { - obj *isisLspTlvs - isisLspExtendedIpv4ReachabilityTlvSlice []IsisLspExtendedIpv4ReachabilityTlv - fieldPtr *[]*otg.IsisLspExtendedIpv4ReachabilityTlv -} - -func newIsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter(ptr *[]*otg.IsisLspExtendedIpv4ReachabilityTlv) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { - return &isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter{fieldPtr: ptr} -} - -type IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter interface { - setMsg(*isisLspTlvs) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter - Items() []IsisLspExtendedIpv4ReachabilityTlv - Add() IsisLspExtendedIpv4ReachabilityTlv - Append(items ...IsisLspExtendedIpv4ReachabilityTlv) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter - Set(index int, newObj IsisLspExtendedIpv4ReachabilityTlv) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter - Clear() IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter - clearHolderSlice() IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter - appendHolderSlice(item IsisLspExtendedIpv4ReachabilityTlv) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter -} - -func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) setMsg(msg *isisLspTlvs) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspExtendedIpv4ReachabilityTlv{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) Items() []IsisLspExtendedIpv4ReachabilityTlv { - return obj.isisLspExtendedIpv4ReachabilityTlvSlice -} - -func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) Add() IsisLspExtendedIpv4ReachabilityTlv { - newObj := &otg.IsisLspExtendedIpv4ReachabilityTlv{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspExtendedIpv4ReachabilityTlv{obj: newObj} - newLibObj.setDefault() - obj.isisLspExtendedIpv4ReachabilityTlvSlice = append(obj.isisLspExtendedIpv4ReachabilityTlvSlice, newLibObj) - return newLibObj -} - -func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) Append(items ...IsisLspExtendedIpv4ReachabilityTlv) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspExtendedIpv4ReachabilityTlvSlice = append(obj.isisLspExtendedIpv4ReachabilityTlvSlice, item) - } - return obj -} - -func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) Set(index int, newObj IsisLspExtendedIpv4ReachabilityTlv) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspExtendedIpv4ReachabilityTlvSlice[index] = newObj - return obj -} -func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) Clear() IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspExtendedIpv4ReachabilityTlv{} - obj.isisLspExtendedIpv4ReachabilityTlvSlice = []IsisLspExtendedIpv4ReachabilityTlv{} - } - return obj -} -func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) clearHolderSlice() IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { - if len(obj.isisLspExtendedIpv4ReachabilityTlvSlice) > 0 { - obj.isisLspExtendedIpv4ReachabilityTlvSlice = []IsisLspExtendedIpv4ReachabilityTlv{} - } - return obj -} -func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) appendHolderSlice(item IsisLspExtendedIpv4ReachabilityTlv) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { - obj.isisLspExtendedIpv4ReachabilityTlvSlice = append(obj.isisLspExtendedIpv4ReachabilityTlvSlice, item) - return obj -} - -// Array of IPv6 Reachability TLVs (type 236) present in this LSP. -// Ipv6ReachabilityTlvs returns a []IsisLspIpv6ReachabilityTlv -func (obj *isisLspTlvs) Ipv6ReachabilityTlvs() IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { - if len(obj.obj.Ipv6ReachabilityTlvs) == 0 { - obj.obj.Ipv6ReachabilityTlvs = []*otg.IsisLspIpv6ReachabilityTlv{} - } - if obj.ipv6ReachabilityTlvsHolder == nil { - obj.ipv6ReachabilityTlvsHolder = newIsisLspTlvsIsisLspIpv6ReachabilityTlvIter(&obj.obj.Ipv6ReachabilityTlvs).setMsg(obj) - } - return obj.ipv6ReachabilityTlvsHolder -} - -type isisLspTlvsIsisLspIpv6ReachabilityTlvIter struct { - obj *isisLspTlvs - isisLspIpv6ReachabilityTlvSlice []IsisLspIpv6ReachabilityTlv - fieldPtr *[]*otg.IsisLspIpv6ReachabilityTlv -} - -func newIsisLspTlvsIsisLspIpv6ReachabilityTlvIter(ptr *[]*otg.IsisLspIpv6ReachabilityTlv) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { - return &isisLspTlvsIsisLspIpv6ReachabilityTlvIter{fieldPtr: ptr} -} - -type IsisLspTlvsIsisLspIpv6ReachabilityTlvIter interface { - setMsg(*isisLspTlvs) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter - Items() []IsisLspIpv6ReachabilityTlv - Add() IsisLspIpv6ReachabilityTlv - Append(items ...IsisLspIpv6ReachabilityTlv) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter - Set(index int, newObj IsisLspIpv6ReachabilityTlv) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter - Clear() IsisLspTlvsIsisLspIpv6ReachabilityTlvIter - clearHolderSlice() IsisLspTlvsIsisLspIpv6ReachabilityTlvIter - appendHolderSlice(item IsisLspIpv6ReachabilityTlv) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter -} - -func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) setMsg(msg *isisLspTlvs) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspIpv6ReachabilityTlv{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) Items() []IsisLspIpv6ReachabilityTlv { - return obj.isisLspIpv6ReachabilityTlvSlice -} - -func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) Add() IsisLspIpv6ReachabilityTlv { - newObj := &otg.IsisLspIpv6ReachabilityTlv{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspIpv6ReachabilityTlv{obj: newObj} - newLibObj.setDefault() - obj.isisLspIpv6ReachabilityTlvSlice = append(obj.isisLspIpv6ReachabilityTlvSlice, newLibObj) - return newLibObj -} - -func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) Append(items ...IsisLspIpv6ReachabilityTlv) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspIpv6ReachabilityTlvSlice = append(obj.isisLspIpv6ReachabilityTlvSlice, item) - } - return obj -} - -func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) Set(index int, newObj IsisLspIpv6ReachabilityTlv) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspIpv6ReachabilityTlvSlice[index] = newObj - return obj -} -func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) Clear() IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspIpv6ReachabilityTlv{} - obj.isisLspIpv6ReachabilityTlvSlice = []IsisLspIpv6ReachabilityTlv{} - } - return obj -} -func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) clearHolderSlice() IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { - if len(obj.isisLspIpv6ReachabilityTlvSlice) > 0 { - obj.isisLspIpv6ReachabilityTlvSlice = []IsisLspIpv6ReachabilityTlv{} - } - return obj -} -func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) appendHolderSlice(item IsisLspIpv6ReachabilityTlv) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { - obj.isisLspIpv6ReachabilityTlvSlice = append(obj.isisLspIpv6ReachabilityTlvSlice, item) - return obj -} - -func (obj *isisLspTlvs) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.HostnameTlvs) != 0 { - - if set_default { - obj.HostnameTlvs().clearHolderSlice() - for _, item := range obj.obj.HostnameTlvs { - obj.HostnameTlvs().appendHolderSlice(&isisLspHostname{obj: item}) - } - } - for _, item := range obj.HostnameTlvs().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.IsReachabilityTlvs) != 0 { - - if set_default { - obj.IsReachabilityTlvs().clearHolderSlice() - for _, item := range obj.obj.IsReachabilityTlvs { - obj.IsReachabilityTlvs().appendHolderSlice(&isisLspIsReachabilityTlv{obj: item}) - } - } - for _, item := range obj.IsReachabilityTlvs().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.ExtendedIsReachabilityTlvs) != 0 { - - if set_default { - obj.ExtendedIsReachabilityTlvs().clearHolderSlice() - for _, item := range obj.obj.ExtendedIsReachabilityTlvs { - obj.ExtendedIsReachabilityTlvs().appendHolderSlice(&isisLspExtendedIsReachabilityTlv{obj: item}) - } - } - for _, item := range obj.ExtendedIsReachabilityTlvs().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Ipv4InternalReachabilityTlvs) != 0 { - - if set_default { - obj.Ipv4InternalReachabilityTlvs().clearHolderSlice() - for _, item := range obj.obj.Ipv4InternalReachabilityTlvs { - obj.Ipv4InternalReachabilityTlvs().appendHolderSlice(&isisLspIpv4InternalReachabilityTlv{obj: item}) - } - } - for _, item := range obj.Ipv4InternalReachabilityTlvs().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Ipv4ExternalReachabilityTlvs) != 0 { - - if set_default { - obj.Ipv4ExternalReachabilityTlvs().clearHolderSlice() - for _, item := range obj.obj.Ipv4ExternalReachabilityTlvs { - obj.Ipv4ExternalReachabilityTlvs().appendHolderSlice(&isisLspIpv4ExternalReachabilityTlv{obj: item}) - } - } - for _, item := range obj.Ipv4ExternalReachabilityTlvs().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.ExtendedIpv4ReachabilityTlvs) != 0 { - - if set_default { - obj.ExtendedIpv4ReachabilityTlvs().clearHolderSlice() - for _, item := range obj.obj.ExtendedIpv4ReachabilityTlvs { - obj.ExtendedIpv4ReachabilityTlvs().appendHolderSlice(&isisLspExtendedIpv4ReachabilityTlv{obj: item}) - } - } - for _, item := range obj.ExtendedIpv4ReachabilityTlvs().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Ipv6ReachabilityTlvs) != 0 { - - if set_default { - obj.Ipv6ReachabilityTlvs().clearHolderSlice() - for _, item := range obj.obj.Ipv6ReachabilityTlvs { - obj.Ipv6ReachabilityTlvs().appendHolderSlice(&isisLspIpv6ReachabilityTlv{obj: item}) - } - } - for _, item := range obj.Ipv6ReachabilityTlvs().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *isisLspTlvs) setDefault() { - -} - -// ***** RsvpLspState ***** -type rsvpLspState struct { - validation - obj *otg.RsvpLspState - marshaller marshalRsvpLspState - unMarshaller unMarshalRsvpLspState -} - -func NewRsvpLspState() RsvpLspState { - obj := rsvpLspState{obj: &otg.RsvpLspState{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpLspState) msg() *otg.RsvpLspState { - return obj.obj -} - -func (obj *rsvpLspState) setMsg(msg *otg.RsvpLspState) RsvpLspState { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpLspState struct { - obj *rsvpLspState -} - -type marshalRsvpLspState interface { - // ToProto marshals RsvpLspState to protobuf object *otg.RsvpLspState - ToProto() (*otg.RsvpLspState, error) - // ToPbText marshals RsvpLspState to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpLspState to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpLspState to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpLspState struct { - obj *rsvpLspState -} - -type unMarshalRsvpLspState interface { - // FromProto unmarshals RsvpLspState from protobuf object *otg.RsvpLspState - FromProto(msg *otg.RsvpLspState) (RsvpLspState, error) - // FromPbText unmarshals RsvpLspState from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpLspState from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpLspState from JSON text - FromJson(value string) error -} - -func (obj *rsvpLspState) Marshal() marshalRsvpLspState { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpLspState{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpLspState) Unmarshal() unMarshalRsvpLspState { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpLspState{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpLspState) ToProto() (*otg.RsvpLspState, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpLspState) FromProto(msg *otg.RsvpLspState) (RsvpLspState, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpLspState) 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 *unMarshalrsvpLspState) 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 *marshalrsvpLspState) 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 *unMarshalrsvpLspState) 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 *marshalrsvpLspState) 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 *unMarshalrsvpLspState) 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 *rsvpLspState) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpLspState) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpLspState) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpLspState) Clone() (RsvpLspState, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpLspState() - 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 -} - -// RsvpLspState is iPv4 RSVP-TE Discovered LSPs. -type RsvpLspState interface { - Validation - // msg marshals RsvpLspState to protobuf object *otg.RsvpLspState - // and doesn't set defaults - msg() *otg.RsvpLspState - // setMsg unmarshals RsvpLspState from protobuf object *otg.RsvpLspState - // and doesn't set defaults - setMsg(*otg.RsvpLspState) RsvpLspState - // provides marshal interface - Marshal() marshalRsvpLspState - // provides unmarshal interface - Unmarshal() unMarshalRsvpLspState - // validate validates RsvpLspState - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpLspState, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // TunnelId returns uint32, set in RsvpLspState. - TunnelId() uint32 - // SetTunnelId assigns uint32 provided by user to RsvpLspState - SetTunnelId(value uint32) RsvpLspState - // HasTunnelId checks if TunnelId has been set in RsvpLspState - HasTunnelId() bool - // LspId returns uint32, set in RsvpLspState. - LspId() uint32 - // SetLspId assigns uint32 provided by user to RsvpLspState - SetLspId(value uint32) RsvpLspState - // HasLspId checks if LspId has been set in RsvpLspState - HasLspId() bool - // SessionName returns string, set in RsvpLspState. - SessionName() string - // SetSessionName assigns string provided by user to RsvpLspState - SetSessionName(value string) RsvpLspState - // HasSessionName checks if SessionName has been set in RsvpLspState - HasSessionName() bool - // LabelIn returns uint32, set in RsvpLspState. - LabelIn() uint32 - // SetLabelIn assigns uint32 provided by user to RsvpLspState - SetLabelIn(value uint32) RsvpLspState - // HasLabelIn checks if LabelIn has been set in RsvpLspState - HasLabelIn() bool - // LabelOut returns uint32, set in RsvpLspState. - LabelOut() uint32 - // SetLabelOut assigns uint32 provided by user to RsvpLspState - SetLabelOut(value uint32) RsvpLspState - // HasLabelOut checks if LabelOut has been set in RsvpLspState - HasLabelOut() bool - // SessionStatus returns RsvpLspStateSessionStatusEnum, set in RsvpLspState - SessionStatus() RsvpLspStateSessionStatusEnum - // SetSessionStatus assigns RsvpLspStateSessionStatusEnum provided by user to RsvpLspState - SetSessionStatus(value RsvpLspStateSessionStatusEnum) RsvpLspState - // HasSessionStatus checks if SessionStatus has been set in RsvpLspState - HasSessionStatus() bool - // LastFlapReason returns RsvpLspStateLastFlapReasonEnum, set in RsvpLspState - LastFlapReason() RsvpLspStateLastFlapReasonEnum - // SetLastFlapReason assigns RsvpLspStateLastFlapReasonEnum provided by user to RsvpLspState - SetLastFlapReason(value RsvpLspStateLastFlapReasonEnum) RsvpLspState - // HasLastFlapReason checks if LastFlapReason has been set in RsvpLspState - HasLastFlapReason() bool - // UpTime returns uint64, set in RsvpLspState. - UpTime() uint64 - // SetUpTime assigns uint64 provided by user to RsvpLspState - SetUpTime(value uint64) RsvpLspState - // HasUpTime checks if UpTime has been set in RsvpLspState - HasUpTime() bool -} - -// The tunnel id of RSVP session which acts as an identifier that remains constant over the life of the tunnel. -// TunnelId returns a uint32 -func (obj *rsvpLspState) TunnelId() uint32 { - - return *obj.obj.TunnelId - -} - -// The tunnel id of RSVP session which acts as an identifier that remains constant over the life of the tunnel. -// TunnelId returns a uint32 -func (obj *rsvpLspState) HasTunnelId() bool { - return obj.obj.TunnelId != nil -} - -// The tunnel id of RSVP session which acts as an identifier that remains constant over the life of the tunnel. -// SetTunnelId sets the uint32 value in the RsvpLspState object -func (obj *rsvpLspState) SetTunnelId(value uint32) RsvpLspState { - - obj.obj.TunnelId = &value - return obj -} - -// The lsp-id of RSVP session which acts as a differentiator for two lsps originating from the same headend, commonly used to distinguish RSVP sessions during make before break operations. -// LspId returns a uint32 -func (obj *rsvpLspState) LspId() uint32 { - - return *obj.obj.LspId - -} - -// The lsp-id of RSVP session which acts as a differentiator for two lsps originating from the same headend, commonly used to distinguish RSVP sessions during make before break operations. -// LspId returns a uint32 -func (obj *rsvpLspState) HasLspId() bool { - return obj.obj.LspId != nil -} - -// The lsp-id of RSVP session which acts as a differentiator for two lsps originating from the same headend, commonly used to distinguish RSVP sessions during make before break operations. -// SetLspId sets the uint32 value in the RsvpLspState object -func (obj *rsvpLspState) SetLspId(value uint32) RsvpLspState { - - obj.obj.LspId = &value - return obj -} - -// The value of RSVP-TE Session Name field of the Session Attribute object. -// SessionName returns a string -func (obj *rsvpLspState) SessionName() string { - - return *obj.obj.SessionName - -} - -// The value of RSVP-TE Session Name field of the Session Attribute object. -// SessionName returns a string -func (obj *rsvpLspState) HasSessionName() bool { - return obj.obj.SessionName != nil -} - -// The value of RSVP-TE Session Name field of the Session Attribute object. -// SetSessionName sets the string value in the RsvpLspState object -func (obj *rsvpLspState) SetSessionName(value string) RsvpLspState { - - obj.obj.SessionName = &value - return obj -} - -// The label received by RSVP-TE ingress. -// LabelIn returns a uint32 -func (obj *rsvpLspState) LabelIn() uint32 { - - return *obj.obj.LabelIn - -} - -// The label received by RSVP-TE ingress. -// LabelIn returns a uint32 -func (obj *rsvpLspState) HasLabelIn() bool { - return obj.obj.LabelIn != nil -} - -// The label received by RSVP-TE ingress. -// SetLabelIn sets the uint32 value in the RsvpLspState object -func (obj *rsvpLspState) SetLabelIn(value uint32) RsvpLspState { - - obj.obj.LabelIn = &value - return obj -} - -// The label assigned by RSVP-TE egress. -// LabelOut returns a uint32 -func (obj *rsvpLspState) LabelOut() uint32 { - - return *obj.obj.LabelOut - -} - -// The label assigned by RSVP-TE egress. -// LabelOut returns a uint32 -func (obj *rsvpLspState) HasLabelOut() bool { - return obj.obj.LabelOut != nil -} - -// The label assigned by RSVP-TE egress. -// SetLabelOut sets the uint32 value in the RsvpLspState object -func (obj *rsvpLspState) SetLabelOut(value uint32) RsvpLspState { - - obj.obj.LabelOut = &value - return obj -} - -type RsvpLspStateSessionStatusEnum string - -// Enum of SessionStatus on RsvpLspState -var RsvpLspStateSessionStatus = struct { - UP RsvpLspStateSessionStatusEnum - DOWN RsvpLspStateSessionStatusEnum -}{ - UP: RsvpLspStateSessionStatusEnum("up"), - DOWN: RsvpLspStateSessionStatusEnum("down"), -} - -func (obj *rsvpLspState) SessionStatus() RsvpLspStateSessionStatusEnum { - return RsvpLspStateSessionStatusEnum(obj.obj.SessionStatus.Enum().String()) -} - -// Operational state of the RSVP LSP. -// SessionStatus returns a string -func (obj *rsvpLspState) HasSessionStatus() bool { - return obj.obj.SessionStatus != nil -} - -func (obj *rsvpLspState) SetSessionStatus(value RsvpLspStateSessionStatusEnum) RsvpLspState { - intValue, ok := otg.RsvpLspState_SessionStatus_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on RsvpLspStateSessionStatusEnum", string(value))) - return obj - } - enumValue := otg.RsvpLspState_SessionStatus_Enum(intValue) - obj.obj.SessionStatus = &enumValue - - return obj -} - -type RsvpLspStateLastFlapReasonEnum string - -// Enum of LastFlapReason on RsvpLspState -var RsvpLspStateLastFlapReason = struct { - RESV_TEAR RsvpLspStateLastFlapReasonEnum - PATH_TEAR RsvpLspStateLastFlapReasonEnum - PATH_TIMEOUT RsvpLspStateLastFlapReasonEnum -}{ - RESV_TEAR: RsvpLspStateLastFlapReasonEnum("resv_tear"), - PATH_TEAR: RsvpLspStateLastFlapReasonEnum("path_tear"), - PATH_TIMEOUT: RsvpLspStateLastFlapReasonEnum("path_timeout"), -} - -func (obj *rsvpLspState) LastFlapReason() RsvpLspStateLastFlapReasonEnum { - return RsvpLspStateLastFlapReasonEnum(obj.obj.LastFlapReason.Enum().String()) -} - -// The reason for the last flap of this RSVP session. -// LastFlapReason returns a string -func (obj *rsvpLspState) HasLastFlapReason() bool { - return obj.obj.LastFlapReason != nil -} - -func (obj *rsvpLspState) SetLastFlapReason(value RsvpLspStateLastFlapReasonEnum) RsvpLspState { - intValue, ok := otg.RsvpLspState_LastFlapReason_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on RsvpLspStateLastFlapReasonEnum", string(value))) - return obj - } - enumValue := otg.RsvpLspState_LastFlapReason_Enum(intValue) - obj.obj.LastFlapReason = &enumValue - - return obj -} - -// The tunnel UP time in milli seconds. If the tunnel is DOWN the UP time will be zero. -// UpTime returns a uint64 -func (obj *rsvpLspState) UpTime() uint64 { - - return *obj.obj.UpTime - -} - -// The tunnel UP time in milli seconds. If the tunnel is DOWN the UP time will be zero. -// UpTime returns a uint64 -func (obj *rsvpLspState) HasUpTime() bool { - return obj.obj.UpTime != nil -} - -// The tunnel UP time in milli seconds. If the tunnel is DOWN the UP time will be zero. -// SetUpTime sets the uint64 value in the RsvpLspState object -func (obj *rsvpLspState) SetUpTime(value uint64) RsvpLspState { - - obj.obj.UpTime = &value - return obj -} - -func (obj *rsvpLspState) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *rsvpLspState) setDefault() { - -} - -// ***** RsvpLspIpv4Rro ***** -type rsvpLspIpv4Rro struct { - validation - obj *otg.RsvpLspIpv4Rro - marshaller marshalRsvpLspIpv4Rro - unMarshaller unMarshalRsvpLspIpv4Rro -} - -func NewRsvpLspIpv4Rro() RsvpLspIpv4Rro { - obj := rsvpLspIpv4Rro{obj: &otg.RsvpLspIpv4Rro{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpLspIpv4Rro) msg() *otg.RsvpLspIpv4Rro { - return obj.obj -} - -func (obj *rsvpLspIpv4Rro) setMsg(msg *otg.RsvpLspIpv4Rro) RsvpLspIpv4Rro { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpLspIpv4Rro struct { - obj *rsvpLspIpv4Rro -} - -type marshalRsvpLspIpv4Rro interface { - // ToProto marshals RsvpLspIpv4Rro to protobuf object *otg.RsvpLspIpv4Rro - ToProto() (*otg.RsvpLspIpv4Rro, error) - // ToPbText marshals RsvpLspIpv4Rro to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpLspIpv4Rro to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpLspIpv4Rro to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpLspIpv4Rro struct { - obj *rsvpLspIpv4Rro -} - -type unMarshalRsvpLspIpv4Rro interface { - // FromProto unmarshals RsvpLspIpv4Rro from protobuf object *otg.RsvpLspIpv4Rro - FromProto(msg *otg.RsvpLspIpv4Rro) (RsvpLspIpv4Rro, error) - // FromPbText unmarshals RsvpLspIpv4Rro from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpLspIpv4Rro from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpLspIpv4Rro from JSON text - FromJson(value string) error -} - -func (obj *rsvpLspIpv4Rro) Marshal() marshalRsvpLspIpv4Rro { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpLspIpv4Rro{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpLspIpv4Rro) Unmarshal() unMarshalRsvpLspIpv4Rro { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpLspIpv4Rro{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpLspIpv4Rro) ToProto() (*otg.RsvpLspIpv4Rro, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpLspIpv4Rro) FromProto(msg *otg.RsvpLspIpv4Rro) (RsvpLspIpv4Rro, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpLspIpv4Rro) 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 *unMarshalrsvpLspIpv4Rro) 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 *marshalrsvpLspIpv4Rro) 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 *unMarshalrsvpLspIpv4Rro) 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 *marshalrsvpLspIpv4Rro) 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 *unMarshalrsvpLspIpv4Rro) 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 *rsvpLspIpv4Rro) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpLspIpv4Rro) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpLspIpv4Rro) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpLspIpv4Rro) Clone() (RsvpLspIpv4Rro, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpLspIpv4Rro() - 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 -} - -// RsvpLspIpv4Rro is this contains the list of Record Route Object(RRO) objects associated with the traffic engineering tunnel. The Record Route Object(RRO) is used in RSVP-TE to record the route traversed by the LSP. The RRO might be present in both Path message and Resv message, the RRO stores the IP addresses of the routers that the traffic engineering tunnel traversed and also the label generated and distributed by the routers. The RROs in the Resv message mirrors that of the Path message, the only difference is that the RRO in a Resv message records the path information in the reverse direction. -type RsvpLspIpv4Rro interface { - Validation - // msg marshals RsvpLspIpv4Rro to protobuf object *otg.RsvpLspIpv4Rro - // and doesn't set defaults - msg() *otg.RsvpLspIpv4Rro - // setMsg unmarshals RsvpLspIpv4Rro from protobuf object *otg.RsvpLspIpv4Rro - // and doesn't set defaults - setMsg(*otg.RsvpLspIpv4Rro) RsvpLspIpv4Rro - // provides marshal interface - Marshal() marshalRsvpLspIpv4Rro - // provides unmarshal interface - Unmarshal() unMarshalRsvpLspIpv4Rro - // validate validates RsvpLspIpv4Rro - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpLspIpv4Rro, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Address returns string, set in RsvpLspIpv4Rro. - Address() string - // SetAddress assigns string provided by user to RsvpLspIpv4Rro - SetAddress(value string) RsvpLspIpv4Rro - // HasAddress checks if Address has been set in RsvpLspIpv4Rro - HasAddress() bool - // ReportedLabel returns uint32, set in RsvpLspIpv4Rro. - ReportedLabel() uint32 - // SetReportedLabel assigns uint32 provided by user to RsvpLspIpv4Rro - SetReportedLabel(value uint32) RsvpLspIpv4Rro - // HasReportedLabel checks if ReportedLabel has been set in RsvpLspIpv4Rro - HasReportedLabel() bool -} - -// The IPv4 addresses of the routers that the traffic engineering tunnel traversed. -// Address returns a string -func (obj *rsvpLspIpv4Rro) Address() string { - - return *obj.obj.Address - -} - -// The IPv4 addresses of the routers that the traffic engineering tunnel traversed. -// Address returns a string -func (obj *rsvpLspIpv4Rro) HasAddress() bool { - return obj.obj.Address != nil -} - -// The IPv4 addresses of the routers that the traffic engineering tunnel traversed. -// SetAddress sets the string value in the RsvpLspIpv4Rro object -func (obj *rsvpLspIpv4Rro) SetAddress(value string) RsvpLspIpv4Rro { - - obj.obj.Address = &value - return obj -} - -// Label reported for RRO hop. When the Label_Recording flag is set in the Session Attribute object, nodes doing route recording should include the Label Record subobject containing the reported label. -// ReportedLabel returns a uint32 -func (obj *rsvpLspIpv4Rro) ReportedLabel() uint32 { - - return *obj.obj.ReportedLabel - -} - -// Label reported for RRO hop. When the Label_Recording flag is set in the Session Attribute object, nodes doing route recording should include the Label Record subobject containing the reported label. -// ReportedLabel returns a uint32 -func (obj *rsvpLspIpv4Rro) HasReportedLabel() bool { - return obj.obj.ReportedLabel != nil -} - -// Label reported for RRO hop. When the Label_Recording flag is set in the Session Attribute object, nodes doing route recording should include the Label Record subobject containing the reported label. -// SetReportedLabel sets the uint32 value in the RsvpLspIpv4Rro object -func (obj *rsvpLspIpv4Rro) SetReportedLabel(value uint32) RsvpLspIpv4Rro { - - obj.obj.ReportedLabel = &value - return obj -} - -func (obj *rsvpLspIpv4Rro) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Address != nil { - - err := obj.validateIpv4(obj.Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on RsvpLspIpv4Rro.Address")) - } - - } - -} - -func (obj *rsvpLspIpv4Rro) setDefault() { - -} - -// ***** RsvpLspIpv4Ero ***** -type rsvpLspIpv4Ero struct { - validation - obj *otg.RsvpLspIpv4Ero - marshaller marshalRsvpLspIpv4Ero - unMarshaller unMarshalRsvpLspIpv4Ero -} - -func NewRsvpLspIpv4Ero() RsvpLspIpv4Ero { - obj := rsvpLspIpv4Ero{obj: &otg.RsvpLspIpv4Ero{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpLspIpv4Ero) msg() *otg.RsvpLspIpv4Ero { - return obj.obj -} - -func (obj *rsvpLspIpv4Ero) setMsg(msg *otg.RsvpLspIpv4Ero) RsvpLspIpv4Ero { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpLspIpv4Ero struct { - obj *rsvpLspIpv4Ero -} - -type marshalRsvpLspIpv4Ero interface { - // ToProto marshals RsvpLspIpv4Ero to protobuf object *otg.RsvpLspIpv4Ero - ToProto() (*otg.RsvpLspIpv4Ero, error) - // ToPbText marshals RsvpLspIpv4Ero to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpLspIpv4Ero to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpLspIpv4Ero to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpLspIpv4Ero struct { - obj *rsvpLspIpv4Ero -} - -type unMarshalRsvpLspIpv4Ero interface { - // FromProto unmarshals RsvpLspIpv4Ero from protobuf object *otg.RsvpLspIpv4Ero - FromProto(msg *otg.RsvpLspIpv4Ero) (RsvpLspIpv4Ero, error) - // FromPbText unmarshals RsvpLspIpv4Ero from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpLspIpv4Ero from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpLspIpv4Ero from JSON text - FromJson(value string) error -} - -func (obj *rsvpLspIpv4Ero) Marshal() marshalRsvpLspIpv4Ero { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpLspIpv4Ero{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpLspIpv4Ero) Unmarshal() unMarshalRsvpLspIpv4Ero { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpLspIpv4Ero{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpLspIpv4Ero) ToProto() (*otg.RsvpLspIpv4Ero, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpLspIpv4Ero) FromProto(msg *otg.RsvpLspIpv4Ero) (RsvpLspIpv4Ero, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpLspIpv4Ero) 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 *unMarshalrsvpLspIpv4Ero) 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 *marshalrsvpLspIpv4Ero) 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 *unMarshalrsvpLspIpv4Ero) 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 *marshalrsvpLspIpv4Ero) 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 *unMarshalrsvpLspIpv4Ero) 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 *rsvpLspIpv4Ero) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpLspIpv4Ero) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpLspIpv4Ero) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpLspIpv4Ero) Clone() (RsvpLspIpv4Ero, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpLspIpv4Ero() - 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 -} - -// RsvpLspIpv4Ero is this contains the list of sub-objects included in the Explicit Route Object(ERO) object send in the PATH message from the ingress. These sub-objects contain the intermediate hops to be traversed by the LSP while being forwarded towards the egress endpoint. -type RsvpLspIpv4Ero interface { - Validation - // msg marshals RsvpLspIpv4Ero to protobuf object *otg.RsvpLspIpv4Ero - // and doesn't set defaults - msg() *otg.RsvpLspIpv4Ero - // setMsg unmarshals RsvpLspIpv4Ero from protobuf object *otg.RsvpLspIpv4Ero - // and doesn't set defaults - setMsg(*otg.RsvpLspIpv4Ero) RsvpLspIpv4Ero - // provides marshal interface - Marshal() marshalRsvpLspIpv4Ero - // provides unmarshal interface - Unmarshal() unMarshalRsvpLspIpv4Ero - // validate validates RsvpLspIpv4Ero - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpLspIpv4Ero, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Prefix returns string, set in RsvpLspIpv4Ero. - Prefix() string - // SetPrefix assigns string provided by user to RsvpLspIpv4Ero - SetPrefix(value string) RsvpLspIpv4Ero - // HasPrefix checks if Prefix has been set in RsvpLspIpv4Ero - HasPrefix() bool - // Asn returns uint32, set in RsvpLspIpv4Ero. - Asn() uint32 - // SetAsn assigns uint32 provided by user to RsvpLspIpv4Ero - SetAsn(value uint32) RsvpLspIpv4Ero - // HasAsn checks if Asn has been set in RsvpLspIpv4Ero - HasAsn() bool - // Type returns RsvpLspIpv4EroTypeEnum, set in RsvpLspIpv4Ero - Type() RsvpLspIpv4EroTypeEnum - // SetType assigns RsvpLspIpv4EroTypeEnum provided by user to RsvpLspIpv4Ero - SetType(value RsvpLspIpv4EroTypeEnum) RsvpLspIpv4Ero - // HasType checks if Type has been set in RsvpLspIpv4Ero - HasType() bool -} - -// The IPv4 prefix indicated by the ERO. Specified only when the ERO hop is an IPv4 prefix. -// Prefix returns a string -func (obj *rsvpLspIpv4Ero) Prefix() string { - - return *obj.obj.Prefix - -} - -// The IPv4 prefix indicated by the ERO. Specified only when the ERO hop is an IPv4 prefix. -// Prefix returns a string -func (obj *rsvpLspIpv4Ero) HasPrefix() bool { - return obj.obj.Prefix != nil -} - -// The IPv4 prefix indicated by the ERO. Specified only when the ERO hop is an IPv4 prefix. -// SetPrefix sets the string value in the RsvpLspIpv4Ero object -func (obj *rsvpLspIpv4Ero) SetPrefix(value string) RsvpLspIpv4Ero { - - obj.obj.Prefix = &value - return obj -} - -// The autonomous system number indicated by the ERO. Specified only when the ERO hop is an 2 or 4-byte AS number. -// Asn returns a uint32 -func (obj *rsvpLspIpv4Ero) Asn() uint32 { - - return *obj.obj.Asn - -} - -// The autonomous system number indicated by the ERO. Specified only when the ERO hop is an 2 or 4-byte AS number. -// Asn returns a uint32 -func (obj *rsvpLspIpv4Ero) HasAsn() bool { - return obj.obj.Asn != nil -} - -// The autonomous system number indicated by the ERO. Specified only when the ERO hop is an 2 or 4-byte AS number. -// SetAsn sets the uint32 value in the RsvpLspIpv4Ero object -func (obj *rsvpLspIpv4Ero) SetAsn(value uint32) RsvpLspIpv4Ero { - - obj.obj.Asn = &value - return obj -} - -type RsvpLspIpv4EroTypeEnum string - -// Enum of Type on RsvpLspIpv4Ero -var RsvpLspIpv4EroType = struct { - IPV4 RsvpLspIpv4EroTypeEnum - IPV6 RsvpLspIpv4EroTypeEnum - ASN RsvpLspIpv4EroTypeEnum - ASN4 RsvpLspIpv4EroTypeEnum - LABEL RsvpLspIpv4EroTypeEnum - UNNUMBERED_INTERFACE RsvpLspIpv4EroTypeEnum -}{ - IPV4: RsvpLspIpv4EroTypeEnum("ipv4"), - IPV6: RsvpLspIpv4EroTypeEnum("ipv6"), - ASN: RsvpLspIpv4EroTypeEnum("asn"), - ASN4: RsvpLspIpv4EroTypeEnum("asn4"), - LABEL: RsvpLspIpv4EroTypeEnum("label"), - UNNUMBERED_INTERFACE: RsvpLspIpv4EroTypeEnum("unnumbered_interface"), -} - -func (obj *rsvpLspIpv4Ero) Type() RsvpLspIpv4EroTypeEnum { - return RsvpLspIpv4EroTypeEnum(obj.obj.Type.Enum().String()) -} - -// The type indicated by the ERO. -// Type returns a string -func (obj *rsvpLspIpv4Ero) HasType() bool { - return obj.obj.Type != nil -} - -func (obj *rsvpLspIpv4Ero) SetType(value RsvpLspIpv4EroTypeEnum) RsvpLspIpv4Ero { - intValue, ok := otg.RsvpLspIpv4Ero_Type_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on RsvpLspIpv4EroTypeEnum", string(value))) - return obj - } - enumValue := otg.RsvpLspIpv4Ero_Type_Enum(intValue) - obj.obj.Type = &enumValue - - return obj -} - -func (obj *rsvpLspIpv4Ero) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Prefix != nil { - - err := obj.validateIpv4(obj.Prefix()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on RsvpLspIpv4Ero.Prefix")) - } - - } - -} - -func (obj *rsvpLspIpv4Ero) setDefault() { - -} - -// ***** LinkStatepriorityBandwidths ***** -type linkStatepriorityBandwidths struct { - validation - obj *otg.LinkStatepriorityBandwidths - marshaller marshalLinkStatepriorityBandwidths - unMarshaller unMarshalLinkStatepriorityBandwidths -} - -func NewLinkStatepriorityBandwidths() LinkStatepriorityBandwidths { - obj := linkStatepriorityBandwidths{obj: &otg.LinkStatepriorityBandwidths{}} - obj.setDefault() - return &obj -} - -func (obj *linkStatepriorityBandwidths) msg() *otg.LinkStatepriorityBandwidths { - return obj.obj -} - -func (obj *linkStatepriorityBandwidths) setMsg(msg *otg.LinkStatepriorityBandwidths) LinkStatepriorityBandwidths { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshallinkStatepriorityBandwidths struct { - obj *linkStatepriorityBandwidths -} - -type marshalLinkStatepriorityBandwidths interface { - // ToProto marshals LinkStatepriorityBandwidths to protobuf object *otg.LinkStatepriorityBandwidths - ToProto() (*otg.LinkStatepriorityBandwidths, error) - // ToPbText marshals LinkStatepriorityBandwidths to protobuf text - ToPbText() (string, error) - // ToYaml marshals LinkStatepriorityBandwidths to YAML text - ToYaml() (string, error) - // ToJson marshals LinkStatepriorityBandwidths to JSON text - ToJson() (string, error) -} - -type unMarshallinkStatepriorityBandwidths struct { - obj *linkStatepriorityBandwidths -} - -type unMarshalLinkStatepriorityBandwidths interface { - // FromProto unmarshals LinkStatepriorityBandwidths from protobuf object *otg.LinkStatepriorityBandwidths - FromProto(msg *otg.LinkStatepriorityBandwidths) (LinkStatepriorityBandwidths, error) - // FromPbText unmarshals LinkStatepriorityBandwidths from protobuf text - FromPbText(value string) error - // FromYaml unmarshals LinkStatepriorityBandwidths from YAML text - FromYaml(value string) error - // FromJson unmarshals LinkStatepriorityBandwidths from JSON text - FromJson(value string) error -} - -func (obj *linkStatepriorityBandwidths) Marshal() marshalLinkStatepriorityBandwidths { - if obj.marshaller == nil { - obj.marshaller = &marshallinkStatepriorityBandwidths{obj: obj} - } - return obj.marshaller -} - -func (obj *linkStatepriorityBandwidths) Unmarshal() unMarshalLinkStatepriorityBandwidths { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshallinkStatepriorityBandwidths{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshallinkStatepriorityBandwidths) ToProto() (*otg.LinkStatepriorityBandwidths, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshallinkStatepriorityBandwidths) FromProto(msg *otg.LinkStatepriorityBandwidths) (LinkStatepriorityBandwidths, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshallinkStatepriorityBandwidths) 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 *unMarshallinkStatepriorityBandwidths) 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 *marshallinkStatepriorityBandwidths) 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 *unMarshallinkStatepriorityBandwidths) 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 *marshallinkStatepriorityBandwidths) 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 *unMarshallinkStatepriorityBandwidths) 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 *linkStatepriorityBandwidths) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *linkStatepriorityBandwidths) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *linkStatepriorityBandwidths) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *linkStatepriorityBandwidths) Clone() (LinkStatepriorityBandwidths, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewLinkStatepriorityBandwidths() - 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 -} - -// LinkStatepriorityBandwidths is specifies the amount of bandwidth that can be reserved with a setup priority of 0 -// through 7, arranged in increasing order with priority 0 having highest priority. -// In ISIS, this is sent in sub-TLV (11) of Extended IS Reachability TLV. -type LinkStatepriorityBandwidths interface { - Validation - // msg marshals LinkStatepriorityBandwidths to protobuf object *otg.LinkStatepriorityBandwidths - // and doesn't set defaults - msg() *otg.LinkStatepriorityBandwidths - // setMsg unmarshals LinkStatepriorityBandwidths from protobuf object *otg.LinkStatepriorityBandwidths - // and doesn't set defaults - setMsg(*otg.LinkStatepriorityBandwidths) LinkStatepriorityBandwidths - // provides marshal interface - Marshal() marshalLinkStatepriorityBandwidths - // provides unmarshal interface - Unmarshal() unMarshalLinkStatepriorityBandwidths - // validate validates LinkStatepriorityBandwidths - validate() error - // A stringer function - String() string - // Clones the object - Clone() (LinkStatepriorityBandwidths, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Pb0 returns uint32, set in LinkStatepriorityBandwidths. - Pb0() uint32 - // SetPb0 assigns uint32 provided by user to LinkStatepriorityBandwidths - SetPb0(value uint32) LinkStatepriorityBandwidths - // HasPb0 checks if Pb0 has been set in LinkStatepriorityBandwidths - HasPb0() bool - // Pb1 returns uint32, set in LinkStatepriorityBandwidths. - Pb1() uint32 - // SetPb1 assigns uint32 provided by user to LinkStatepriorityBandwidths - SetPb1(value uint32) LinkStatepriorityBandwidths - // HasPb1 checks if Pb1 has been set in LinkStatepriorityBandwidths - HasPb1() bool - // Pb2 returns uint32, set in LinkStatepriorityBandwidths. - Pb2() uint32 - // SetPb2 assigns uint32 provided by user to LinkStatepriorityBandwidths - SetPb2(value uint32) LinkStatepriorityBandwidths - // HasPb2 checks if Pb2 has been set in LinkStatepriorityBandwidths - HasPb2() bool - // Pb3 returns uint32, set in LinkStatepriorityBandwidths. - Pb3() uint32 - // SetPb3 assigns uint32 provided by user to LinkStatepriorityBandwidths - SetPb3(value uint32) LinkStatepriorityBandwidths - // HasPb3 checks if Pb3 has been set in LinkStatepriorityBandwidths - HasPb3() bool - // Pb4 returns uint32, set in LinkStatepriorityBandwidths. - Pb4() uint32 - // SetPb4 assigns uint32 provided by user to LinkStatepriorityBandwidths - SetPb4(value uint32) LinkStatepriorityBandwidths - // HasPb4 checks if Pb4 has been set in LinkStatepriorityBandwidths - HasPb4() bool - // Pb5 returns uint32, set in LinkStatepriorityBandwidths. - Pb5() uint32 - // SetPb5 assigns uint32 provided by user to LinkStatepriorityBandwidths - SetPb5(value uint32) LinkStatepriorityBandwidths - // HasPb5 checks if Pb5 has been set in LinkStatepriorityBandwidths - HasPb5() bool - // Pb6 returns uint32, set in LinkStatepriorityBandwidths. - Pb6() uint32 - // SetPb6 assigns uint32 provided by user to LinkStatepriorityBandwidths - SetPb6(value uint32) LinkStatepriorityBandwidths - // HasPb6 checks if Pb6 has been set in LinkStatepriorityBandwidths - HasPb6() bool - // Pb7 returns uint32, set in LinkStatepriorityBandwidths. - Pb7() uint32 - // SetPb7 assigns uint32 provided by user to LinkStatepriorityBandwidths - SetPb7(value uint32) LinkStatepriorityBandwidths - // HasPb7 checks if Pb7 has been set in LinkStatepriorityBandwidths - HasPb7() bool -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 0. -// Pb0 returns a uint32 -func (obj *linkStatepriorityBandwidths) Pb0() uint32 { - - return *obj.obj.Pb0 - -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 0. -// Pb0 returns a uint32 -func (obj *linkStatepriorityBandwidths) HasPb0() bool { - return obj.obj.Pb0 != nil -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 0. -// SetPb0 sets the uint32 value in the LinkStatepriorityBandwidths object -func (obj *linkStatepriorityBandwidths) SetPb0(value uint32) LinkStatepriorityBandwidths { - - obj.obj.Pb0 = &value - return obj -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 1. -// Pb1 returns a uint32 -func (obj *linkStatepriorityBandwidths) Pb1() uint32 { - - return *obj.obj.Pb1 - -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 1. -// Pb1 returns a uint32 -func (obj *linkStatepriorityBandwidths) HasPb1() bool { - return obj.obj.Pb1 != nil -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 1. -// SetPb1 sets the uint32 value in the LinkStatepriorityBandwidths object -func (obj *linkStatepriorityBandwidths) SetPb1(value uint32) LinkStatepriorityBandwidths { - - obj.obj.Pb1 = &value - return obj -} - -// Specify the amount of bandwidth that can be reserved for the Priority 2. -// Pb2 returns a uint32 -func (obj *linkStatepriorityBandwidths) Pb2() uint32 { - - return *obj.obj.Pb2 - -} - -// Specify the amount of bandwidth that can be reserved for the Priority 2. -// Pb2 returns a uint32 -func (obj *linkStatepriorityBandwidths) HasPb2() bool { - return obj.obj.Pb2 != nil -} - -// Specify the amount of bandwidth that can be reserved for the Priority 2. -// SetPb2 sets the uint32 value in the LinkStatepriorityBandwidths object -func (obj *linkStatepriorityBandwidths) SetPb2(value uint32) LinkStatepriorityBandwidths { - - obj.obj.Pb2 = &value - return obj -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 3. -// Pb3 returns a uint32 -func (obj *linkStatepriorityBandwidths) Pb3() uint32 { - - return *obj.obj.Pb3 - -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 3. -// Pb3 returns a uint32 -func (obj *linkStatepriorityBandwidths) HasPb3() bool { - return obj.obj.Pb3 != nil -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 3. -// SetPb3 sets the uint32 value in the LinkStatepriorityBandwidths object -func (obj *linkStatepriorityBandwidths) SetPb3(value uint32) LinkStatepriorityBandwidths { - - obj.obj.Pb3 = &value - return obj -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 4. -// Pb4 returns a uint32 -func (obj *linkStatepriorityBandwidths) Pb4() uint32 { - - return *obj.obj.Pb4 - -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 4. -// Pb4 returns a uint32 -func (obj *linkStatepriorityBandwidths) HasPb4() bool { - return obj.obj.Pb4 != nil -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 4. -// SetPb4 sets the uint32 value in the LinkStatepriorityBandwidths object -func (obj *linkStatepriorityBandwidths) SetPb4(value uint32) LinkStatepriorityBandwidths { - - obj.obj.Pb4 = &value - return obj -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 5. -// Pb5 returns a uint32 -func (obj *linkStatepriorityBandwidths) Pb5() uint32 { - - return *obj.obj.Pb5 - -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 5. -// Pb5 returns a uint32 -func (obj *linkStatepriorityBandwidths) HasPb5() bool { - return obj.obj.Pb5 != nil -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 5. -// SetPb5 sets the uint32 value in the LinkStatepriorityBandwidths object -func (obj *linkStatepriorityBandwidths) SetPb5(value uint32) LinkStatepriorityBandwidths { - - obj.obj.Pb5 = &value - return obj -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 6. -// Pb6 returns a uint32 -func (obj *linkStatepriorityBandwidths) Pb6() uint32 { - - return *obj.obj.Pb6 - -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 6. -// Pb6 returns a uint32 -func (obj *linkStatepriorityBandwidths) HasPb6() bool { - return obj.obj.Pb6 != nil -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 6. -// SetPb6 sets the uint32 value in the LinkStatepriorityBandwidths object -func (obj *linkStatepriorityBandwidths) SetPb6(value uint32) LinkStatepriorityBandwidths { - - obj.obj.Pb6 = &value - return obj -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 7. -// Pb7 returns a uint32 -func (obj *linkStatepriorityBandwidths) Pb7() uint32 { - - return *obj.obj.Pb7 - -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 7. -// Pb7 returns a uint32 -func (obj *linkStatepriorityBandwidths) HasPb7() bool { - return obj.obj.Pb7 != nil -} - -// Specifies the amount of bandwidth that can be reserved for the Priority 7. -// SetPb7 sets the uint32 value in the LinkStatepriorityBandwidths object -func (obj *linkStatepriorityBandwidths) SetPb7(value uint32) LinkStatepriorityBandwidths { - - obj.obj.Pb7 = &value - return obj -} - -func (obj *linkStatepriorityBandwidths) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *linkStatepriorityBandwidths) setDefault() { - if obj.obj.Pb0 == nil { - obj.SetPb0(125000000) - } - if obj.obj.Pb1 == nil { - obj.SetPb1(125000000) - } - if obj.obj.Pb2 == nil { - obj.SetPb2(125000000) - } - if obj.obj.Pb3 == nil { - obj.SetPb3(125000000) - } - if obj.obj.Pb4 == nil { - obj.SetPb4(125000000) - } - if obj.obj.Pb5 == nil { - obj.SetPb5(125000000) - } - if obj.obj.Pb6 == nil { - obj.SetPb6(125000000) - } - if obj.obj.Pb7 == nil { - obj.SetPb7(125000000) - } - -} - -// ***** BgpV4EthernetSegment ***** -type bgpV4EthernetSegment struct { - validation - obj *otg.BgpV4EthernetSegment - marshaller marshalBgpV4EthernetSegment - unMarshaller unMarshalBgpV4EthernetSegment - dfElectionHolder BgpEthernetSegmentDfElection - evisHolder BgpV4EthernetSegmentBgpV4EvpnEvisIter - advancedHolder BgpRouteAdvanced - communitiesHolder BgpV4EthernetSegmentBgpCommunityIter - extCommunitiesHolder BgpV4EthernetSegmentBgpExtCommunityIter - asPathHolder BgpAsPath -} - -func NewBgpV4EthernetSegment() BgpV4EthernetSegment { - obj := bgpV4EthernetSegment{obj: &otg.BgpV4EthernetSegment{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV4EthernetSegment) msg() *otg.BgpV4EthernetSegment { - return obj.obj -} - -func (obj *bgpV4EthernetSegment) setMsg(msg *otg.BgpV4EthernetSegment) BgpV4EthernetSegment { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV4EthernetSegment struct { - obj *bgpV4EthernetSegment -} - -type marshalBgpV4EthernetSegment interface { - // ToProto marshals BgpV4EthernetSegment to protobuf object *otg.BgpV4EthernetSegment - ToProto() (*otg.BgpV4EthernetSegment, error) - // ToPbText marshals BgpV4EthernetSegment to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV4EthernetSegment to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV4EthernetSegment to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV4EthernetSegment struct { - obj *bgpV4EthernetSegment -} - -type unMarshalBgpV4EthernetSegment interface { - // FromProto unmarshals BgpV4EthernetSegment from protobuf object *otg.BgpV4EthernetSegment - FromProto(msg *otg.BgpV4EthernetSegment) (BgpV4EthernetSegment, error) - // FromPbText unmarshals BgpV4EthernetSegment from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV4EthernetSegment from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV4EthernetSegment from JSON text - FromJson(value string) error -} - -func (obj *bgpV4EthernetSegment) Marshal() marshalBgpV4EthernetSegment { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV4EthernetSegment{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV4EthernetSegment) Unmarshal() unMarshalBgpV4EthernetSegment { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV4EthernetSegment{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV4EthernetSegment) ToProto() (*otg.BgpV4EthernetSegment, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV4EthernetSegment) FromProto(msg *otg.BgpV4EthernetSegment) (BgpV4EthernetSegment, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV4EthernetSegment) 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 *unMarshalbgpV4EthernetSegment) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpV4EthernetSegment) 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 *unMarshalbgpV4EthernetSegment) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpV4EthernetSegment) 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 *unMarshalbgpV4EthernetSegment) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpV4EthernetSegment) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV4EthernetSegment) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV4EthernetSegment) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV4EthernetSegment) Clone() (BgpV4EthernetSegment, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV4EthernetSegment() - 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 -} - -func (obj *bgpV4EthernetSegment) setNil() { - obj.dfElectionHolder = nil - obj.evisHolder = nil - obj.advancedHolder = nil - obj.communitiesHolder = nil - obj.extCommunitiesHolder = nil - obj.asPathHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpV4EthernetSegment is configuration for BGP Ethernet Segment ranges. Advertises following routes - -// -// Type 4 - Ethernet Segment Route -type BgpV4EthernetSegment interface { - Validation - // msg marshals BgpV4EthernetSegment to protobuf object *otg.BgpV4EthernetSegment - // and doesn't set defaults - msg() *otg.BgpV4EthernetSegment - // setMsg unmarshals BgpV4EthernetSegment from protobuf object *otg.BgpV4EthernetSegment - // and doesn't set defaults - setMsg(*otg.BgpV4EthernetSegment) BgpV4EthernetSegment - // provides marshal interface - Marshal() marshalBgpV4EthernetSegment - // provides unmarshal interface - Unmarshal() unMarshalBgpV4EthernetSegment - // validate validates BgpV4EthernetSegment - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV4EthernetSegment, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // DfElection returns BgpEthernetSegmentDfElection, set in BgpV4EthernetSegment. - // BgpEthernetSegmentDfElection is configuration for Designated Forwarder (DF) election among the Provider Edge (PE) routers on the same Ethernet Segment. - DfElection() BgpEthernetSegmentDfElection - // SetDfElection assigns BgpEthernetSegmentDfElection provided by user to BgpV4EthernetSegment. - // BgpEthernetSegmentDfElection is configuration for Designated Forwarder (DF) election among the Provider Edge (PE) routers on the same Ethernet Segment. - SetDfElection(value BgpEthernetSegmentDfElection) BgpV4EthernetSegment - // HasDfElection checks if DfElection has been set in BgpV4EthernetSegment - HasDfElection() bool - // Evis returns BgpV4EthernetSegmentBgpV4EvpnEvisIterIter, set in BgpV4EthernetSegment - Evis() BgpV4EthernetSegmentBgpV4EvpnEvisIter - // Esi returns string, set in BgpV4EthernetSegment. - Esi() string - // SetEsi assigns string provided by user to BgpV4EthernetSegment - SetEsi(value string) BgpV4EthernetSegment - // HasEsi checks if Esi has been set in BgpV4EthernetSegment - HasEsi() bool - // ActiveMode returns BgpV4EthernetSegmentActiveModeEnum, set in BgpV4EthernetSegment - ActiveMode() BgpV4EthernetSegmentActiveModeEnum - // SetActiveMode assigns BgpV4EthernetSegmentActiveModeEnum provided by user to BgpV4EthernetSegment - SetActiveMode(value BgpV4EthernetSegmentActiveModeEnum) BgpV4EthernetSegment - // HasActiveMode checks if ActiveMode has been set in BgpV4EthernetSegment - HasActiveMode() bool - // EsiLabel returns uint32, set in BgpV4EthernetSegment. - EsiLabel() uint32 - // SetEsiLabel assigns uint32 provided by user to BgpV4EthernetSegment - SetEsiLabel(value uint32) BgpV4EthernetSegment - // HasEsiLabel checks if EsiLabel has been set in BgpV4EthernetSegment - HasEsiLabel() bool - // Advanced returns BgpRouteAdvanced, set in BgpV4EthernetSegment. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - Advanced() BgpRouteAdvanced - // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpV4EthernetSegment. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - SetAdvanced(value BgpRouteAdvanced) BgpV4EthernetSegment - // HasAdvanced checks if Advanced has been set in BgpV4EthernetSegment - HasAdvanced() bool - // Communities returns BgpV4EthernetSegmentBgpCommunityIterIter, set in BgpV4EthernetSegment - Communities() BgpV4EthernetSegmentBgpCommunityIter - // ExtCommunities returns BgpV4EthernetSegmentBgpExtCommunityIterIter, set in BgpV4EthernetSegment - ExtCommunities() BgpV4EthernetSegmentBgpExtCommunityIter - // AsPath returns BgpAsPath, set in BgpV4EthernetSegment. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - AsPath() BgpAsPath - // SetAsPath assigns BgpAsPath provided by user to BgpV4EthernetSegment. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - SetAsPath(value BgpAsPath) BgpV4EthernetSegment - // HasAsPath checks if AsPath has been set in BgpV4EthernetSegment - HasAsPath() bool - setNil() -} - -// Designated Forwarder (DF) election configuration. -// DfElection returns a BgpEthernetSegmentDfElection -func (obj *bgpV4EthernetSegment) DfElection() BgpEthernetSegmentDfElection { - if obj.obj.DfElection == nil { - obj.obj.DfElection = NewBgpEthernetSegmentDfElection().msg() - } - if obj.dfElectionHolder == nil { - obj.dfElectionHolder = &bgpEthernetSegmentDfElection{obj: obj.obj.DfElection} - } - return obj.dfElectionHolder -} - -// Designated Forwarder (DF) election configuration. -// DfElection returns a BgpEthernetSegmentDfElection -func (obj *bgpV4EthernetSegment) HasDfElection() bool { - return obj.obj.DfElection != nil -} - -// Designated Forwarder (DF) election configuration. -// SetDfElection sets the BgpEthernetSegmentDfElection value in the BgpV4EthernetSegment object -func (obj *bgpV4EthernetSegment) SetDfElection(value BgpEthernetSegmentDfElection) BgpV4EthernetSegment { - - obj.dfElectionHolder = nil - obj.obj.DfElection = value.msg() - - return obj -} - -// This contains the list of EVIs. -// Evis returns a []BgpV4EvpnEvis -func (obj *bgpV4EthernetSegment) Evis() BgpV4EthernetSegmentBgpV4EvpnEvisIter { - if len(obj.obj.Evis) == 0 { - obj.obj.Evis = []*otg.BgpV4EvpnEvis{} - } - if obj.evisHolder == nil { - obj.evisHolder = newBgpV4EthernetSegmentBgpV4EvpnEvisIter(&obj.obj.Evis).setMsg(obj) - } - return obj.evisHolder -} - -type bgpV4EthernetSegmentBgpV4EvpnEvisIter struct { - obj *bgpV4EthernetSegment - bgpV4EvpnEvisSlice []BgpV4EvpnEvis - fieldPtr *[]*otg.BgpV4EvpnEvis -} - -func newBgpV4EthernetSegmentBgpV4EvpnEvisIter(ptr *[]*otg.BgpV4EvpnEvis) BgpV4EthernetSegmentBgpV4EvpnEvisIter { - return &bgpV4EthernetSegmentBgpV4EvpnEvisIter{fieldPtr: ptr} -} - -type BgpV4EthernetSegmentBgpV4EvpnEvisIter interface { - setMsg(*bgpV4EthernetSegment) BgpV4EthernetSegmentBgpV4EvpnEvisIter - Items() []BgpV4EvpnEvis - Add() BgpV4EvpnEvis - Append(items ...BgpV4EvpnEvis) BgpV4EthernetSegmentBgpV4EvpnEvisIter - Set(index int, newObj BgpV4EvpnEvis) BgpV4EthernetSegmentBgpV4EvpnEvisIter - Clear() BgpV4EthernetSegmentBgpV4EvpnEvisIter - clearHolderSlice() BgpV4EthernetSegmentBgpV4EvpnEvisIter - appendHolderSlice(item BgpV4EvpnEvis) BgpV4EthernetSegmentBgpV4EvpnEvisIter -} - -func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) setMsg(msg *bgpV4EthernetSegment) BgpV4EthernetSegmentBgpV4EvpnEvisIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpV4EvpnEvis{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) Items() []BgpV4EvpnEvis { - return obj.bgpV4EvpnEvisSlice -} - -func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) Add() BgpV4EvpnEvis { - newObj := &otg.BgpV4EvpnEvis{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpV4EvpnEvis{obj: newObj} - newLibObj.setDefault() - obj.bgpV4EvpnEvisSlice = append(obj.bgpV4EvpnEvisSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) Append(items ...BgpV4EvpnEvis) BgpV4EthernetSegmentBgpV4EvpnEvisIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpV4EvpnEvisSlice = append(obj.bgpV4EvpnEvisSlice, item) - } - return obj -} - -func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) Set(index int, newObj BgpV4EvpnEvis) BgpV4EthernetSegmentBgpV4EvpnEvisIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpV4EvpnEvisSlice[index] = newObj - return obj -} -func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) Clear() BgpV4EthernetSegmentBgpV4EvpnEvisIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpV4EvpnEvis{} - obj.bgpV4EvpnEvisSlice = []BgpV4EvpnEvis{} - } - return obj -} -func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) clearHolderSlice() BgpV4EthernetSegmentBgpV4EvpnEvisIter { - if len(obj.bgpV4EvpnEvisSlice) > 0 { - obj.bgpV4EvpnEvisSlice = []BgpV4EvpnEvis{} - } - return obj -} -func (obj *bgpV4EthernetSegmentBgpV4EvpnEvisIter) appendHolderSlice(item BgpV4EvpnEvis) BgpV4EthernetSegmentBgpV4EvpnEvisIter { - obj.bgpV4EvpnEvisSlice = append(obj.bgpV4EvpnEvisSlice, item) - return obj -} - -// 10-octet Ethernet Segment Identifier (ESI) Example - For multi-home scenario nonZero ESI is '10000000000000000000' . -// Esi returns a string -func (obj *bgpV4EthernetSegment) Esi() string { - - return *obj.obj.Esi - -} - -// 10-octet Ethernet Segment Identifier (ESI) Example - For multi-home scenario nonZero ESI is '10000000000000000000' . -// Esi returns a string -func (obj *bgpV4EthernetSegment) HasEsi() bool { - return obj.obj.Esi != nil -} - -// 10-octet Ethernet Segment Identifier (ESI) Example - For multi-home scenario nonZero ESI is '10000000000000000000' . -// SetEsi sets the string value in the BgpV4EthernetSegment object -func (obj *bgpV4EthernetSegment) SetEsi(value string) BgpV4EthernetSegment { - - obj.obj.Esi = &value - return obj -} - -type BgpV4EthernetSegmentActiveModeEnum string - -// Enum of ActiveMode on BgpV4EthernetSegment -var BgpV4EthernetSegmentActiveMode = struct { - SINGLE_ACTIVE BgpV4EthernetSegmentActiveModeEnum - ALL_ACTIVE BgpV4EthernetSegmentActiveModeEnum -}{ - SINGLE_ACTIVE: BgpV4EthernetSegmentActiveModeEnum("single_active"), - ALL_ACTIVE: BgpV4EthernetSegmentActiveModeEnum("all_active"), -} - -func (obj *bgpV4EthernetSegment) ActiveMode() BgpV4EthernetSegmentActiveModeEnum { - return BgpV4EthernetSegmentActiveModeEnum(obj.obj.ActiveMode.Enum().String()) -} - -// Single Active or All Active mode Redundancy mode selection for Multi-home. -// ActiveMode returns a string -func (obj *bgpV4EthernetSegment) HasActiveMode() bool { - return obj.obj.ActiveMode != nil -} - -func (obj *bgpV4EthernetSegment) SetActiveMode(value BgpV4EthernetSegmentActiveModeEnum) BgpV4EthernetSegment { - intValue, ok := otg.BgpV4EthernetSegment_ActiveMode_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpV4EthernetSegmentActiveModeEnum", string(value))) - return obj - } - enumValue := otg.BgpV4EthernetSegment_ActiveMode_Enum(intValue) - obj.obj.ActiveMode = &enumValue - - return obj -} - -// The label value to be advertised as ESI Label in ESI Label Extended Community. This is included in Ethernet Auto-discovery per ES Routes advertised by a router. -// EsiLabel returns a uint32 -func (obj *bgpV4EthernetSegment) EsiLabel() uint32 { - - return *obj.obj.EsiLabel - -} - -// The label value to be advertised as ESI Label in ESI Label Extended Community. This is included in Ethernet Auto-discovery per ES Routes advertised by a router. -// EsiLabel returns a uint32 -func (obj *bgpV4EthernetSegment) HasEsiLabel() bool { - return obj.obj.EsiLabel != nil -} - -// The label value to be advertised as ESI Label in ESI Label Extended Community. This is included in Ethernet Auto-discovery per ES Routes advertised by a router. -// SetEsiLabel sets the uint32 value in the BgpV4EthernetSegment object -func (obj *bgpV4EthernetSegment) SetEsiLabel(value uint32) BgpV4EthernetSegment { - - obj.obj.EsiLabel = &value - return obj -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpV4EthernetSegment) Advanced() BgpRouteAdvanced { - if obj.obj.Advanced == nil { - obj.obj.Advanced = NewBgpRouteAdvanced().msg() - } - if obj.advancedHolder == nil { - obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} - } - return obj.advancedHolder -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpV4EthernetSegment) HasAdvanced() bool { - return obj.obj.Advanced != nil -} - -// description is TBD -// SetAdvanced sets the BgpRouteAdvanced value in the BgpV4EthernetSegment object -func (obj *bgpV4EthernetSegment) SetAdvanced(value BgpRouteAdvanced) BgpV4EthernetSegment { - - obj.advancedHolder = nil - obj.obj.Advanced = value.msg() - - return obj -} - -// Optional community settings. -// Communities returns a []BgpCommunity -func (obj *bgpV4EthernetSegment) Communities() BgpV4EthernetSegmentBgpCommunityIter { - if len(obj.obj.Communities) == 0 { - obj.obj.Communities = []*otg.BgpCommunity{} - } - if obj.communitiesHolder == nil { - obj.communitiesHolder = newBgpV4EthernetSegmentBgpCommunityIter(&obj.obj.Communities).setMsg(obj) - } - return obj.communitiesHolder -} - -type bgpV4EthernetSegmentBgpCommunityIter struct { - obj *bgpV4EthernetSegment - bgpCommunitySlice []BgpCommunity - fieldPtr *[]*otg.BgpCommunity -} - -func newBgpV4EthernetSegmentBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpV4EthernetSegmentBgpCommunityIter { - return &bgpV4EthernetSegmentBgpCommunityIter{fieldPtr: ptr} -} - -type BgpV4EthernetSegmentBgpCommunityIter interface { - setMsg(*bgpV4EthernetSegment) BgpV4EthernetSegmentBgpCommunityIter - Items() []BgpCommunity - Add() BgpCommunity - Append(items ...BgpCommunity) BgpV4EthernetSegmentBgpCommunityIter - Set(index int, newObj BgpCommunity) BgpV4EthernetSegmentBgpCommunityIter - Clear() BgpV4EthernetSegmentBgpCommunityIter - clearHolderSlice() BgpV4EthernetSegmentBgpCommunityIter - appendHolderSlice(item BgpCommunity) BgpV4EthernetSegmentBgpCommunityIter -} - -func (obj *bgpV4EthernetSegmentBgpCommunityIter) setMsg(msg *bgpV4EthernetSegment) BgpV4EthernetSegmentBgpCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4EthernetSegmentBgpCommunityIter) Items() []BgpCommunity { - return obj.bgpCommunitySlice -} - -func (obj *bgpV4EthernetSegmentBgpCommunityIter) Add() BgpCommunity { - newObj := &otg.BgpCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4EthernetSegmentBgpCommunityIter) Append(items ...BgpCommunity) BgpV4EthernetSegmentBgpCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - } - return obj -} - -func (obj *bgpV4EthernetSegmentBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpV4EthernetSegmentBgpCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpCommunitySlice[index] = newObj - return obj -} -func (obj *bgpV4EthernetSegmentBgpCommunityIter) Clear() BgpV4EthernetSegmentBgpCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpCommunity{} - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpV4EthernetSegmentBgpCommunityIter) clearHolderSlice() BgpV4EthernetSegmentBgpCommunityIter { - if len(obj.bgpCommunitySlice) > 0 { - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpV4EthernetSegmentBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpV4EthernetSegmentBgpCommunityIter { - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - return obj -} - -// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. -// ExtCommunities returns a []BgpExtCommunity -func (obj *bgpV4EthernetSegment) ExtCommunities() BgpV4EthernetSegmentBgpExtCommunityIter { - if len(obj.obj.ExtCommunities) == 0 { - obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} - } - if obj.extCommunitiesHolder == nil { - obj.extCommunitiesHolder = newBgpV4EthernetSegmentBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) - } - return obj.extCommunitiesHolder -} - -type bgpV4EthernetSegmentBgpExtCommunityIter struct { - obj *bgpV4EthernetSegment - bgpExtCommunitySlice []BgpExtCommunity - fieldPtr *[]*otg.BgpExtCommunity -} - -func newBgpV4EthernetSegmentBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpV4EthernetSegmentBgpExtCommunityIter { - return &bgpV4EthernetSegmentBgpExtCommunityIter{fieldPtr: ptr} -} - -type BgpV4EthernetSegmentBgpExtCommunityIter interface { - setMsg(*bgpV4EthernetSegment) BgpV4EthernetSegmentBgpExtCommunityIter - Items() []BgpExtCommunity - Add() BgpExtCommunity - Append(items ...BgpExtCommunity) BgpV4EthernetSegmentBgpExtCommunityIter - Set(index int, newObj BgpExtCommunity) BgpV4EthernetSegmentBgpExtCommunityIter - Clear() BgpV4EthernetSegmentBgpExtCommunityIter - clearHolderSlice() BgpV4EthernetSegmentBgpExtCommunityIter - appendHolderSlice(item BgpExtCommunity) BgpV4EthernetSegmentBgpExtCommunityIter -} - -func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) setMsg(msg *bgpV4EthernetSegment) BgpV4EthernetSegmentBgpExtCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpExtCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) Items() []BgpExtCommunity { - return obj.bgpExtCommunitySlice -} - -func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) Add() BgpExtCommunity { - newObj := &otg.BgpExtCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpExtCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpV4EthernetSegmentBgpExtCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - } - return obj -} - -func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpV4EthernetSegmentBgpExtCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpExtCommunitySlice[index] = newObj - return obj -} -func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) Clear() BgpV4EthernetSegmentBgpExtCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpExtCommunity{} - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) clearHolderSlice() BgpV4EthernetSegmentBgpExtCommunityIter { - if len(obj.bgpExtCommunitySlice) > 0 { - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpV4EthernetSegmentBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpV4EthernetSegmentBgpExtCommunityIter { - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - return obj -} - -// Optional AS PATH settings. -// AsPath returns a BgpAsPath -func (obj *bgpV4EthernetSegment) AsPath() BgpAsPath { - if obj.obj.AsPath == nil { - obj.obj.AsPath = NewBgpAsPath().msg() - } - if obj.asPathHolder == nil { - obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} - } - return obj.asPathHolder -} - -// Optional AS PATH settings. -// AsPath returns a BgpAsPath -func (obj *bgpV4EthernetSegment) HasAsPath() bool { - return obj.obj.AsPath != nil -} - -// Optional AS PATH settings. -// SetAsPath sets the BgpAsPath value in the BgpV4EthernetSegment object -func (obj *bgpV4EthernetSegment) SetAsPath(value BgpAsPath) BgpV4EthernetSegment { - - obj.asPathHolder = nil - obj.obj.AsPath = value.msg() - - return obj -} - -func (obj *bgpV4EthernetSegment) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.DfElection != nil { - - obj.DfElection().validateObj(vObj, set_default) - } - - if len(obj.obj.Evis) != 0 { - - if set_default { - obj.Evis().clearHolderSlice() - for _, item := range obj.obj.Evis { - obj.Evis().appendHolderSlice(&bgpV4EvpnEvis{obj: item}) - } - } - for _, item := range obj.Evis().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Esi != nil { - - err := obj.validateHex(obj.Esi()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV4EthernetSegment.Esi")) - } - - } - - if obj.obj.EsiLabel != nil { - - if *obj.obj.EsiLabel > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpV4EthernetSegment.EsiLabel <= 16777215 but Got %d", *obj.obj.EsiLabel)) - } - - } - - if obj.obj.Advanced != nil { - - obj.Advanced().validateObj(vObj, set_default) - } - - if len(obj.obj.Communities) != 0 { - - if set_default { - obj.Communities().clearHolderSlice() - for _, item := range obj.obj.Communities { - obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) - } - } - for _, item := range obj.Communities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.ExtCommunities) != 0 { - - if set_default { - obj.ExtCommunities().clearHolderSlice() - for _, item := range obj.obj.ExtCommunities { - obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) - } - } - for _, item := range obj.ExtCommunities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.AsPath != nil { - - obj.AsPath().validateObj(vObj, set_default) - } - -} - -func (obj *bgpV4EthernetSegment) setDefault() { - if obj.obj.Esi == nil { - obj.SetEsi("00000000000000000000") - } - if obj.obj.ActiveMode == nil { - obj.SetActiveMode(BgpV4EthernetSegmentActiveMode.ALL_ACTIVE) - - } - if obj.obj.EsiLabel == nil { - obj.SetEsiLabel(0) - } - -} - -// ***** BgpAdvanced ***** -type bgpAdvanced struct { - validation - obj *otg.BgpAdvanced - marshaller marshalBgpAdvanced - unMarshaller unMarshalBgpAdvanced -} - -func NewBgpAdvanced() BgpAdvanced { - obj := bgpAdvanced{obj: &otg.BgpAdvanced{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAdvanced) msg() *otg.BgpAdvanced { - return obj.obj -} - -func (obj *bgpAdvanced) setMsg(msg *otg.BgpAdvanced) BgpAdvanced { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAdvanced struct { - obj *bgpAdvanced -} - -type marshalBgpAdvanced interface { - // ToProto marshals BgpAdvanced to protobuf object *otg.BgpAdvanced - ToProto() (*otg.BgpAdvanced, error) - // ToPbText marshals BgpAdvanced to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAdvanced to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAdvanced to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAdvanced struct { - obj *bgpAdvanced -} - -type unMarshalBgpAdvanced interface { - // FromProto unmarshals BgpAdvanced from protobuf object *otg.BgpAdvanced - FromProto(msg *otg.BgpAdvanced) (BgpAdvanced, error) - // FromPbText unmarshals BgpAdvanced from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAdvanced from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAdvanced from JSON text - FromJson(value string) error -} - -func (obj *bgpAdvanced) Marshal() marshalBgpAdvanced { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAdvanced{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAdvanced) Unmarshal() unMarshalBgpAdvanced { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAdvanced{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAdvanced) ToProto() (*otg.BgpAdvanced, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAdvanced) FromProto(msg *otg.BgpAdvanced) (BgpAdvanced, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAdvanced) 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 *unMarshalbgpAdvanced) 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 *marshalbgpAdvanced) 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 *unMarshalbgpAdvanced) 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 *marshalbgpAdvanced) 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 *unMarshalbgpAdvanced) 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 *bgpAdvanced) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAdvanced) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAdvanced) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAdvanced) Clone() (BgpAdvanced, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAdvanced() - 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 -} - -// BgpAdvanced is configuration for BGP advanced settings. -type BgpAdvanced interface { - Validation - // msg marshals BgpAdvanced to protobuf object *otg.BgpAdvanced - // and doesn't set defaults - msg() *otg.BgpAdvanced - // setMsg unmarshals BgpAdvanced from protobuf object *otg.BgpAdvanced - // and doesn't set defaults - setMsg(*otg.BgpAdvanced) BgpAdvanced - // provides marshal interface - Marshal() marshalBgpAdvanced - // provides unmarshal interface - Unmarshal() unMarshalBgpAdvanced - // validate validates BgpAdvanced - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAdvanced, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // HoldTimeInterval returns uint32, set in BgpAdvanced. - HoldTimeInterval() uint32 - // SetHoldTimeInterval assigns uint32 provided by user to BgpAdvanced - SetHoldTimeInterval(value uint32) BgpAdvanced - // HasHoldTimeInterval checks if HoldTimeInterval has been set in BgpAdvanced - HasHoldTimeInterval() bool - // KeepAliveInterval returns uint32, set in BgpAdvanced. - KeepAliveInterval() uint32 - // SetKeepAliveInterval assigns uint32 provided by user to BgpAdvanced - SetKeepAliveInterval(value uint32) BgpAdvanced - // HasKeepAliveInterval checks if KeepAliveInterval has been set in BgpAdvanced - HasKeepAliveInterval() bool - // UpdateInterval returns uint32, set in BgpAdvanced. - UpdateInterval() uint32 - // SetUpdateInterval assigns uint32 provided by user to BgpAdvanced - SetUpdateInterval(value uint32) BgpAdvanced - // HasUpdateInterval checks if UpdateInterval has been set in BgpAdvanced - HasUpdateInterval() bool - // TimeToLive returns uint32, set in BgpAdvanced. - TimeToLive() uint32 - // SetTimeToLive assigns uint32 provided by user to BgpAdvanced - SetTimeToLive(value uint32) BgpAdvanced - // HasTimeToLive checks if TimeToLive has been set in BgpAdvanced - HasTimeToLive() bool - // Md5Key returns string, set in BgpAdvanced. - Md5Key() string - // SetMd5Key assigns string provided by user to BgpAdvanced - SetMd5Key(value string) BgpAdvanced - // HasMd5Key checks if Md5Key has been set in BgpAdvanced - HasMd5Key() bool - // PassiveMode returns bool, set in BgpAdvanced. - PassiveMode() bool - // SetPassiveMode assigns bool provided by user to BgpAdvanced - SetPassiveMode(value bool) BgpAdvanced - // HasPassiveMode checks if PassiveMode has been set in BgpAdvanced - HasPassiveMode() bool - // ListenPort returns uint32, set in BgpAdvanced. - ListenPort() uint32 - // SetListenPort assigns uint32 provided by user to BgpAdvanced - SetListenPort(value uint32) BgpAdvanced - // HasListenPort checks if ListenPort has been set in BgpAdvanced - HasListenPort() bool - // NeighborPort returns uint32, set in BgpAdvanced. - NeighborPort() uint32 - // SetNeighborPort assigns uint32 provided by user to BgpAdvanced - SetNeighborPort(value uint32) BgpAdvanced - // HasNeighborPort checks if NeighborPort has been set in BgpAdvanced - HasNeighborPort() bool -} - -// Number of seconds the sender proposes for the value of the Hold Timer. -// HoldTimeInterval returns a uint32 -func (obj *bgpAdvanced) HoldTimeInterval() uint32 { - - return *obj.obj.HoldTimeInterval - -} - -// Number of seconds the sender proposes for the value of the Hold Timer. -// HoldTimeInterval returns a uint32 -func (obj *bgpAdvanced) HasHoldTimeInterval() bool { - return obj.obj.HoldTimeInterval != nil -} - -// Number of seconds the sender proposes for the value of the Hold Timer. -// SetHoldTimeInterval sets the uint32 value in the BgpAdvanced object -func (obj *bgpAdvanced) SetHoldTimeInterval(value uint32) BgpAdvanced { - - obj.obj.HoldTimeInterval = &value - return obj -} - -// Number of seconds between transmissions of Keepalive messages by this peer. -// KeepAliveInterval returns a uint32 -func (obj *bgpAdvanced) KeepAliveInterval() uint32 { - - return *obj.obj.KeepAliveInterval - -} - -// Number of seconds between transmissions of Keepalive messages by this peer. -// KeepAliveInterval returns a uint32 -func (obj *bgpAdvanced) HasKeepAliveInterval() bool { - return obj.obj.KeepAliveInterval != nil -} - -// Number of seconds between transmissions of Keepalive messages by this peer. -// SetKeepAliveInterval sets the uint32 value in the BgpAdvanced object -func (obj *bgpAdvanced) SetKeepAliveInterval(value uint32) BgpAdvanced { - - obj.obj.KeepAliveInterval = &value - return obj -} - -// The time interval at which Update messages are sent to the DUT, expressed as the number of milliseconds between Update messages. The update interval 0 implies to send all the updates as fast as possible. -// UpdateInterval returns a uint32 -func (obj *bgpAdvanced) UpdateInterval() uint32 { - - return *obj.obj.UpdateInterval - -} - -// The time interval at which Update messages are sent to the DUT, expressed as the number of milliseconds between Update messages. The update interval 0 implies to send all the updates as fast as possible. -// UpdateInterval returns a uint32 -func (obj *bgpAdvanced) HasUpdateInterval() bool { - return obj.obj.UpdateInterval != nil -} - -// The time interval at which Update messages are sent to the DUT, expressed as the number of milliseconds between Update messages. The update interval 0 implies to send all the updates as fast as possible. -// SetUpdateInterval sets the uint32 value in the BgpAdvanced object -func (obj *bgpAdvanced) SetUpdateInterval(value uint32) BgpAdvanced { - - obj.obj.UpdateInterval = &value - return obj -} - -// The limited number of iterations that a unit of data can experience before the data is discarded. This is placed in the TTL field in the IP header of the transmitted packets. -// TimeToLive returns a uint32 -func (obj *bgpAdvanced) TimeToLive() uint32 { - - return *obj.obj.TimeToLive - -} - -// The limited number of iterations that a unit of data can experience before the data is discarded. This is placed in the TTL field in the IP header of the transmitted packets. -// TimeToLive returns a uint32 -func (obj *bgpAdvanced) HasTimeToLive() bool { - return obj.obj.TimeToLive != nil -} - -// The limited number of iterations that a unit of data can experience before the data is discarded. This is placed in the TTL field in the IP header of the transmitted packets. -// SetTimeToLive sets the uint32 value in the BgpAdvanced object -func (obj *bgpAdvanced) SetTimeToLive(value uint32) BgpAdvanced { - - obj.obj.TimeToLive = &value - return obj -} - -// The value to be used as a secret MD5 key for authentication. If not configured, MD5 authentication will not be enabled. -// Md5Key returns a string -func (obj *bgpAdvanced) Md5Key() string { - - return *obj.obj.Md5Key - -} - -// The value to be used as a secret MD5 key for authentication. If not configured, MD5 authentication will not be enabled. -// Md5Key returns a string -func (obj *bgpAdvanced) HasMd5Key() bool { - return obj.obj.Md5Key != nil -} - -// The value to be used as a secret MD5 key for authentication. If not configured, MD5 authentication will not be enabled. -// SetMd5Key sets the string value in the BgpAdvanced object -func (obj *bgpAdvanced) SetMd5Key(value string) BgpAdvanced { - - obj.obj.Md5Key = &value - return obj -} - -// If set to true, the local BGP peer will wait for the remote peer to initiate the BGP session -// by establishing the TCP connection, rather than initiating sessions from the local peer. -// PassiveMode returns a bool -func (obj *bgpAdvanced) PassiveMode() bool { - - return *obj.obj.PassiveMode - -} - -// If set to true, the local BGP peer will wait for the remote peer to initiate the BGP session -// by establishing the TCP connection, rather than initiating sessions from the local peer. -// PassiveMode returns a bool -func (obj *bgpAdvanced) HasPassiveMode() bool { - return obj.obj.PassiveMode != nil -} - -// If set to true, the local BGP peer will wait for the remote peer to initiate the BGP session -// by establishing the TCP connection, rather than initiating sessions from the local peer. -// SetPassiveMode sets the bool value in the BgpAdvanced object -func (obj *bgpAdvanced) SetPassiveMode(value bool) BgpAdvanced { - - obj.obj.PassiveMode = &value - return obj -} - -// The TCP port number on which to accept BGP connections from the remote peer. -// ListenPort returns a uint32 -func (obj *bgpAdvanced) ListenPort() uint32 { - - return *obj.obj.ListenPort - -} - -// The TCP port number on which to accept BGP connections from the remote peer. -// ListenPort returns a uint32 -func (obj *bgpAdvanced) HasListenPort() bool { - return obj.obj.ListenPort != nil -} - -// The TCP port number on which to accept BGP connections from the remote peer. -// SetListenPort sets the uint32 value in the BgpAdvanced object -func (obj *bgpAdvanced) SetListenPort(value uint32) BgpAdvanced { - - obj.obj.ListenPort = &value - return obj -} - -// Destination TCP port number of the BGP peer when initiating a -// session from the local BGP peer. -// NeighborPort returns a uint32 -func (obj *bgpAdvanced) NeighborPort() uint32 { - - return *obj.obj.NeighborPort - -} - -// Destination TCP port number of the BGP peer when initiating a -// session from the local BGP peer. -// NeighborPort returns a uint32 -func (obj *bgpAdvanced) HasNeighborPort() bool { - return obj.obj.NeighborPort != nil -} - -// Destination TCP port number of the BGP peer when initiating a -// session from the local BGP peer. -// SetNeighborPort sets the uint32 value in the BgpAdvanced object -func (obj *bgpAdvanced) SetNeighborPort(value uint32) BgpAdvanced { - - obj.obj.NeighborPort = &value - return obj -} - -func (obj *bgpAdvanced) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.TimeToLive != nil { - - if *obj.obj.TimeToLive > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAdvanced.TimeToLive <= 255 but Got %d", *obj.obj.TimeToLive)) - } - - } - - if obj.obj.ListenPort != nil { - - if *obj.obj.ListenPort > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAdvanced.ListenPort <= 65535 but Got %d", *obj.obj.ListenPort)) - } - - } - - if obj.obj.NeighborPort != nil { - - if *obj.obj.NeighborPort > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAdvanced.NeighborPort <= 65535 but Got %d", *obj.obj.NeighborPort)) - } - - } - -} - -func (obj *bgpAdvanced) setDefault() { - if obj.obj.HoldTimeInterval == nil { - obj.SetHoldTimeInterval(90) - } - if obj.obj.KeepAliveInterval == nil { - obj.SetKeepAliveInterval(30) - } - if obj.obj.UpdateInterval == nil { - obj.SetUpdateInterval(0) - } - if obj.obj.TimeToLive == nil { - obj.SetTimeToLive(64) - } - if obj.obj.PassiveMode == nil { - obj.SetPassiveMode(false) - } - if obj.obj.ListenPort == nil { - obj.SetListenPort(179) - } - if obj.obj.NeighborPort == nil { - obj.SetNeighborPort(179) - } - -} - -// ***** BgpCapability ***** -type bgpCapability struct { - validation - obj *otg.BgpCapability - marshaller marshalBgpCapability - unMarshaller unMarshalBgpCapability -} - -func NewBgpCapability() BgpCapability { - obj := bgpCapability{obj: &otg.BgpCapability{}} - obj.setDefault() - return &obj -} - -func (obj *bgpCapability) msg() *otg.BgpCapability { - return obj.obj -} - -func (obj *bgpCapability) setMsg(msg *otg.BgpCapability) BgpCapability { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpCapability struct { - obj *bgpCapability -} - -type marshalBgpCapability interface { - // ToProto marshals BgpCapability to protobuf object *otg.BgpCapability - ToProto() (*otg.BgpCapability, error) - // ToPbText marshals BgpCapability to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpCapability to YAML text - ToYaml() (string, error) - // ToJson marshals BgpCapability to JSON text - ToJson() (string, error) -} - -type unMarshalbgpCapability struct { - obj *bgpCapability -} - -type unMarshalBgpCapability interface { - // FromProto unmarshals BgpCapability from protobuf object *otg.BgpCapability - FromProto(msg *otg.BgpCapability) (BgpCapability, error) - // FromPbText unmarshals BgpCapability from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpCapability from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpCapability from JSON text - FromJson(value string) error -} - -func (obj *bgpCapability) Marshal() marshalBgpCapability { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpCapability{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpCapability) Unmarshal() unMarshalBgpCapability { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpCapability{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpCapability) ToProto() (*otg.BgpCapability, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpCapability) FromProto(msg *otg.BgpCapability) (BgpCapability, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpCapability) 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 *unMarshalbgpCapability) 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 *marshalbgpCapability) 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 *unMarshalbgpCapability) 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 *marshalbgpCapability) 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 *unMarshalbgpCapability) 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 *bgpCapability) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpCapability) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpCapability) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpCapability) Clone() (BgpCapability, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpCapability() - 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 -} - -// BgpCapability is configuration for BGP capability settings. -type BgpCapability interface { - Validation - // msg marshals BgpCapability to protobuf object *otg.BgpCapability - // and doesn't set defaults - msg() *otg.BgpCapability - // setMsg unmarshals BgpCapability from protobuf object *otg.BgpCapability - // and doesn't set defaults - setMsg(*otg.BgpCapability) BgpCapability - // provides marshal interface - Marshal() marshalBgpCapability - // provides unmarshal interface - Unmarshal() unMarshalBgpCapability - // validate validates BgpCapability - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpCapability, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv4Unicast returns bool, set in BgpCapability. - Ipv4Unicast() bool - // SetIpv4Unicast assigns bool provided by user to BgpCapability - SetIpv4Unicast(value bool) BgpCapability - // HasIpv4Unicast checks if Ipv4Unicast has been set in BgpCapability - HasIpv4Unicast() bool - // Ipv4Multicast returns bool, set in BgpCapability. - Ipv4Multicast() bool - // SetIpv4Multicast assigns bool provided by user to BgpCapability - SetIpv4Multicast(value bool) BgpCapability - // HasIpv4Multicast checks if Ipv4Multicast has been set in BgpCapability - HasIpv4Multicast() bool - // Ipv6Unicast returns bool, set in BgpCapability. - Ipv6Unicast() bool - // SetIpv6Unicast assigns bool provided by user to BgpCapability - SetIpv6Unicast(value bool) BgpCapability - // HasIpv6Unicast checks if Ipv6Unicast has been set in BgpCapability - HasIpv6Unicast() bool - // Ipv6Multicast returns bool, set in BgpCapability. - Ipv6Multicast() bool - // SetIpv6Multicast assigns bool provided by user to BgpCapability - SetIpv6Multicast(value bool) BgpCapability - // HasIpv6Multicast checks if Ipv6Multicast has been set in BgpCapability - HasIpv6Multicast() bool - // Vpls returns bool, set in BgpCapability. - Vpls() bool - // SetVpls assigns bool provided by user to BgpCapability - SetVpls(value bool) BgpCapability - // HasVpls checks if Vpls has been set in BgpCapability - HasVpls() bool - // RouteRefresh returns bool, set in BgpCapability. - RouteRefresh() bool - // SetRouteRefresh assigns bool provided by user to BgpCapability - SetRouteRefresh(value bool) BgpCapability - // HasRouteRefresh checks if RouteRefresh has been set in BgpCapability - HasRouteRefresh() bool - // RouteConstraint returns bool, set in BgpCapability. - RouteConstraint() bool - // SetRouteConstraint assigns bool provided by user to BgpCapability - SetRouteConstraint(value bool) BgpCapability - // HasRouteConstraint checks if RouteConstraint has been set in BgpCapability - HasRouteConstraint() bool - // LinkStateNonVpn returns bool, set in BgpCapability. - LinkStateNonVpn() bool - // SetLinkStateNonVpn assigns bool provided by user to BgpCapability - SetLinkStateNonVpn(value bool) BgpCapability - // HasLinkStateNonVpn checks if LinkStateNonVpn has been set in BgpCapability - HasLinkStateNonVpn() bool - // LinkStateVpn returns bool, set in BgpCapability. - LinkStateVpn() bool - // SetLinkStateVpn assigns bool provided by user to BgpCapability - SetLinkStateVpn(value bool) BgpCapability - // HasLinkStateVpn checks if LinkStateVpn has been set in BgpCapability - HasLinkStateVpn() bool - // Evpn returns bool, set in BgpCapability. - Evpn() bool - // SetEvpn assigns bool provided by user to BgpCapability - SetEvpn(value bool) BgpCapability - // HasEvpn checks if Evpn has been set in BgpCapability - HasEvpn() bool - // ExtendedNextHopEncoding returns bool, set in BgpCapability. - ExtendedNextHopEncoding() bool - // SetExtendedNextHopEncoding assigns bool provided by user to BgpCapability - SetExtendedNextHopEncoding(value bool) BgpCapability - // HasExtendedNextHopEncoding checks if ExtendedNextHopEncoding has been set in BgpCapability - HasExtendedNextHopEncoding() bool - // Ipv4MulticastVpn returns bool, set in BgpCapability. - Ipv4MulticastVpn() bool - // SetIpv4MulticastVpn assigns bool provided by user to BgpCapability - SetIpv4MulticastVpn(value bool) BgpCapability - // HasIpv4MulticastVpn checks if Ipv4MulticastVpn has been set in BgpCapability - HasIpv4MulticastVpn() bool - // Ipv4MplsVpn returns bool, set in BgpCapability. - Ipv4MplsVpn() bool - // SetIpv4MplsVpn assigns bool provided by user to BgpCapability - SetIpv4MplsVpn(value bool) BgpCapability - // HasIpv4MplsVpn checks if Ipv4MplsVpn has been set in BgpCapability - HasIpv4MplsVpn() bool - // Ipv4Mdt returns bool, set in BgpCapability. - Ipv4Mdt() bool - // SetIpv4Mdt assigns bool provided by user to BgpCapability - SetIpv4Mdt(value bool) BgpCapability - // HasIpv4Mdt checks if Ipv4Mdt has been set in BgpCapability - HasIpv4Mdt() bool - // Ipv4MulticastMplsVpn returns bool, set in BgpCapability. - Ipv4MulticastMplsVpn() bool - // SetIpv4MulticastMplsVpn assigns bool provided by user to BgpCapability - SetIpv4MulticastMplsVpn(value bool) BgpCapability - // HasIpv4MulticastMplsVpn checks if Ipv4MulticastMplsVpn has been set in BgpCapability - HasIpv4MulticastMplsVpn() bool - // Ipv4UnicastFlowSpec returns bool, set in BgpCapability. - Ipv4UnicastFlowSpec() bool - // SetIpv4UnicastFlowSpec assigns bool provided by user to BgpCapability - SetIpv4UnicastFlowSpec(value bool) BgpCapability - // HasIpv4UnicastFlowSpec checks if Ipv4UnicastFlowSpec has been set in BgpCapability - HasIpv4UnicastFlowSpec() bool - // Ipv4SrTePolicy returns bool, set in BgpCapability. - Ipv4SrTePolicy() bool - // SetIpv4SrTePolicy assigns bool provided by user to BgpCapability - SetIpv4SrTePolicy(value bool) BgpCapability - // HasIpv4SrTePolicy checks if Ipv4SrTePolicy has been set in BgpCapability - HasIpv4SrTePolicy() bool - // Ipv4UnicastAddPath returns bool, set in BgpCapability. - Ipv4UnicastAddPath() bool - // SetIpv4UnicastAddPath assigns bool provided by user to BgpCapability - SetIpv4UnicastAddPath(value bool) BgpCapability - // HasIpv4UnicastAddPath checks if Ipv4UnicastAddPath has been set in BgpCapability - HasIpv4UnicastAddPath() bool - // Ipv6MulticastVpn returns bool, set in BgpCapability. - Ipv6MulticastVpn() bool - // SetIpv6MulticastVpn assigns bool provided by user to BgpCapability - SetIpv6MulticastVpn(value bool) BgpCapability - // HasIpv6MulticastVpn checks if Ipv6MulticastVpn has been set in BgpCapability - HasIpv6MulticastVpn() bool - // Ipv6MplsVpn returns bool, set in BgpCapability. - Ipv6MplsVpn() bool - // SetIpv6MplsVpn assigns bool provided by user to BgpCapability - SetIpv6MplsVpn(value bool) BgpCapability - // HasIpv6MplsVpn checks if Ipv6MplsVpn has been set in BgpCapability - HasIpv6MplsVpn() bool - // Ipv6Mdt returns bool, set in BgpCapability. - Ipv6Mdt() bool - // SetIpv6Mdt assigns bool provided by user to BgpCapability - SetIpv6Mdt(value bool) BgpCapability - // HasIpv6Mdt checks if Ipv6Mdt has been set in BgpCapability - HasIpv6Mdt() bool - // Ipv6MulticastMplsVpn returns bool, set in BgpCapability. - Ipv6MulticastMplsVpn() bool - // SetIpv6MulticastMplsVpn assigns bool provided by user to BgpCapability - SetIpv6MulticastMplsVpn(value bool) BgpCapability - // HasIpv6MulticastMplsVpn checks if Ipv6MulticastMplsVpn has been set in BgpCapability - HasIpv6MulticastMplsVpn() bool - // Ipv6UnicastFlowSpec returns bool, set in BgpCapability. - Ipv6UnicastFlowSpec() bool - // SetIpv6UnicastFlowSpec assigns bool provided by user to BgpCapability - SetIpv6UnicastFlowSpec(value bool) BgpCapability - // HasIpv6UnicastFlowSpec checks if Ipv6UnicastFlowSpec has been set in BgpCapability - HasIpv6UnicastFlowSpec() bool - // Ipv6SrTePolicy returns bool, set in BgpCapability. - Ipv6SrTePolicy() bool - // SetIpv6SrTePolicy assigns bool provided by user to BgpCapability - SetIpv6SrTePolicy(value bool) BgpCapability - // HasIpv6SrTePolicy checks if Ipv6SrTePolicy has been set in BgpCapability - HasIpv6SrTePolicy() bool - // Ipv6UnicastAddPath returns bool, set in BgpCapability. - Ipv6UnicastAddPath() bool - // SetIpv6UnicastAddPath assigns bool provided by user to BgpCapability - SetIpv6UnicastAddPath(value bool) BgpCapability - // HasIpv6UnicastAddPath checks if Ipv6UnicastAddPath has been set in BgpCapability - HasIpv6UnicastAddPath() bool -} - -// Support for the IPv4 Unicast address family. -// Ipv4Unicast returns a bool -func (obj *bgpCapability) Ipv4Unicast() bool { - - return *obj.obj.Ipv4Unicast - -} - -// Support for the IPv4 Unicast address family. -// Ipv4Unicast returns a bool -func (obj *bgpCapability) HasIpv4Unicast() bool { - return obj.obj.Ipv4Unicast != nil -} - -// Support for the IPv4 Unicast address family. -// SetIpv4Unicast sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv4Unicast(value bool) BgpCapability { - - obj.obj.Ipv4Unicast = &value - return obj -} - -// Support for the IPv4 Multicast address family. -// Ipv4Multicast returns a bool -func (obj *bgpCapability) Ipv4Multicast() bool { - - return *obj.obj.Ipv4Multicast - -} - -// Support for the IPv4 Multicast address family. -// Ipv4Multicast returns a bool -func (obj *bgpCapability) HasIpv4Multicast() bool { - return obj.obj.Ipv4Multicast != nil -} - -// Support for the IPv4 Multicast address family. -// SetIpv4Multicast sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv4Multicast(value bool) BgpCapability { - - obj.obj.Ipv4Multicast = &value - return obj -} - -// Support for the IPv4 Unicast address family. -// Ipv6Unicast returns a bool -func (obj *bgpCapability) Ipv6Unicast() bool { - - return *obj.obj.Ipv6Unicast - -} - -// Support for the IPv4 Unicast address family. -// Ipv6Unicast returns a bool -func (obj *bgpCapability) HasIpv6Unicast() bool { - return obj.obj.Ipv6Unicast != nil -} - -// Support for the IPv4 Unicast address family. -// SetIpv6Unicast sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv6Unicast(value bool) BgpCapability { - - obj.obj.Ipv6Unicast = &value - return obj -} - -// Support for the IPv6 Multicast address family. -// Ipv6Multicast returns a bool -func (obj *bgpCapability) Ipv6Multicast() bool { - - return *obj.obj.Ipv6Multicast - -} - -// Support for the IPv6 Multicast address family. -// Ipv6Multicast returns a bool -func (obj *bgpCapability) HasIpv6Multicast() bool { - return obj.obj.Ipv6Multicast != nil -} - -// Support for the IPv6 Multicast address family. -// SetIpv6Multicast sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv6Multicast(value bool) BgpCapability { - - obj.obj.Ipv6Multicast = &value - return obj -} - -// Support for VPLS as below. -// RFC4761 - Virtual Private LAN Service (VPLS) using BGP for Auto-Discovery -// and Signaling. -// RFC6624 - Layer 2 Virtual Private Networks using BGP for Auto-Discovery -// and Signaling. -// Vpls returns a bool -func (obj *bgpCapability) Vpls() bool { - - return *obj.obj.Vpls - -} - -// Support for VPLS as below. -// RFC4761 - Virtual Private LAN Service (VPLS) using BGP for Auto-Discovery -// and Signaling. -// RFC6624 - Layer 2 Virtual Private Networks using BGP for Auto-Discovery -// and Signaling. -// Vpls returns a bool -func (obj *bgpCapability) HasVpls() bool { - return obj.obj.Vpls != nil -} - -// Support for VPLS as below. -// RFC4761 - Virtual Private LAN Service (VPLS) using BGP for Auto-Discovery -// and Signaling. -// RFC6624 - Layer 2 Virtual Private Networks using BGP for Auto-Discovery -// and Signaling. -// SetVpls sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetVpls(value bool) BgpCapability { - - obj.obj.Vpls = &value - return obj -} - -// Support for the route refresh capabilities. Route Refresh allows the dynamic exchange of route refresh requests and routing information between BGP peers and the subsequent re-advertisement of the outbound or inbound routing table. -// RouteRefresh returns a bool -func (obj *bgpCapability) RouteRefresh() bool { - - return *obj.obj.RouteRefresh - -} - -// Support for the route refresh capabilities. Route Refresh allows the dynamic exchange of route refresh requests and routing information between BGP peers and the subsequent re-advertisement of the outbound or inbound routing table. -// RouteRefresh returns a bool -func (obj *bgpCapability) HasRouteRefresh() bool { - return obj.obj.RouteRefresh != nil -} - -// Support for the route refresh capabilities. Route Refresh allows the dynamic exchange of route refresh requests and routing information between BGP peers and the subsequent re-advertisement of the outbound or inbound routing table. -// SetRouteRefresh sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetRouteRefresh(value bool) BgpCapability { - - obj.obj.RouteRefresh = &value - return obj -} - -// Supports for the route constraint capabilities. Route Constraint allows the advertisement of Route Target Membership information. The BGP peers exchange Route Target Reachability Information, which is used to build a route distribution graph. This limits the propagation of VPN Network Layer Reachability Information (NLRI) between different autonomous systems or distinct clusters of the same autonomous system. This is supported for Layer 3 Virtual Private Network scenario. -// RouteConstraint returns a bool -func (obj *bgpCapability) RouteConstraint() bool { - - return *obj.obj.RouteConstraint - -} - -// Supports for the route constraint capabilities. Route Constraint allows the advertisement of Route Target Membership information. The BGP peers exchange Route Target Reachability Information, which is used to build a route distribution graph. This limits the propagation of VPN Network Layer Reachability Information (NLRI) between different autonomous systems or distinct clusters of the same autonomous system. This is supported for Layer 3 Virtual Private Network scenario. -// RouteConstraint returns a bool -func (obj *bgpCapability) HasRouteConstraint() bool { - return obj.obj.RouteConstraint != nil -} - -// Supports for the route constraint capabilities. Route Constraint allows the advertisement of Route Target Membership information. The BGP peers exchange Route Target Reachability Information, which is used to build a route distribution graph. This limits the propagation of VPN Network Layer Reachability Information (NLRI) between different autonomous systems or distinct clusters of the same autonomous system. This is supported for Layer 3 Virtual Private Network scenario. -// SetRouteConstraint sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetRouteConstraint(value bool) BgpCapability { - - obj.obj.RouteConstraint = &value - return obj -} - -// Support for BGP Link State for ISIS and OSPF. -// LinkStateNonVpn returns a bool -func (obj *bgpCapability) LinkStateNonVpn() bool { - - return *obj.obj.LinkStateNonVpn - -} - -// Support for BGP Link State for ISIS and OSPF. -// LinkStateNonVpn returns a bool -func (obj *bgpCapability) HasLinkStateNonVpn() bool { - return obj.obj.LinkStateNonVpn != nil -} - -// Support for BGP Link State for ISIS and OSPF. -// SetLinkStateNonVpn sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetLinkStateNonVpn(value bool) BgpCapability { - - obj.obj.LinkStateNonVpn = &value - return obj -} - -// Capability advertisement of BGP Link State for VPNs. -// LinkStateVpn returns a bool -func (obj *bgpCapability) LinkStateVpn() bool { - - return *obj.obj.LinkStateVpn - -} - -// Capability advertisement of BGP Link State for VPNs. -// LinkStateVpn returns a bool -func (obj *bgpCapability) HasLinkStateVpn() bool { - return obj.obj.LinkStateVpn != nil -} - -// Capability advertisement of BGP Link State for VPNs. -// SetLinkStateVpn sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetLinkStateVpn(value bool) BgpCapability { - - obj.obj.LinkStateVpn = &value - return obj -} - -// Support for the EVPN address family. -// Evpn returns a bool -func (obj *bgpCapability) Evpn() bool { - - return *obj.obj.Evpn - -} - -// Support for the EVPN address family. -// Evpn returns a bool -func (obj *bgpCapability) HasEvpn() bool { - return obj.obj.Evpn != nil -} - -// Support for the EVPN address family. -// SetEvpn sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetEvpn(value bool) BgpCapability { - - obj.obj.Evpn = &value - return obj -} - -// Support for extended Next Hop Encoding for Nexthop field in IPv4 routes advertisement. This allows IPv4 routes being advertised by IPv6 peers to include an IPv6 Nexthop. -// ExtendedNextHopEncoding returns a bool -func (obj *bgpCapability) ExtendedNextHopEncoding() bool { - - return *obj.obj.ExtendedNextHopEncoding - -} - -// Support for extended Next Hop Encoding for Nexthop field in IPv4 routes advertisement. This allows IPv4 routes being advertised by IPv6 peers to include an IPv6 Nexthop. -// ExtendedNextHopEncoding returns a bool -func (obj *bgpCapability) HasExtendedNextHopEncoding() bool { - return obj.obj.ExtendedNextHopEncoding != nil -} - -// Support for extended Next Hop Encoding for Nexthop field in IPv4 routes advertisement. This allows IPv4 routes being advertised by IPv6 peers to include an IPv6 Nexthop. -// SetExtendedNextHopEncoding sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetExtendedNextHopEncoding(value bool) BgpCapability { - - obj.obj.ExtendedNextHopEncoding = &value - return obj -} - -// Support for the IPv4 Multicast VPN address family. -// Ipv4MulticastVpn returns a bool -func (obj *bgpCapability) Ipv4MulticastVpn() bool { - - return *obj.obj.Ipv4MulticastVpn - -} - -// Support for the IPv4 Multicast VPN address family. -// Ipv4MulticastVpn returns a bool -func (obj *bgpCapability) HasIpv4MulticastVpn() bool { - return obj.obj.Ipv4MulticastVpn != nil -} - -// Support for the IPv4 Multicast VPN address family. -// SetIpv4MulticastVpn sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv4MulticastVpn(value bool) BgpCapability { - - obj.obj.Ipv4MulticastVpn = &value - return obj -} - -// Support for the IPv4 MPLS L3VPN address family. -// Ipv4MplsVpn returns a bool -func (obj *bgpCapability) Ipv4MplsVpn() bool { - - return *obj.obj.Ipv4MplsVpn - -} - -// Support for the IPv4 MPLS L3VPN address family. -// Ipv4MplsVpn returns a bool -func (obj *bgpCapability) HasIpv4MplsVpn() bool { - return obj.obj.Ipv4MplsVpn != nil -} - -// Support for the IPv4 MPLS L3VPN address family. -// SetIpv4MplsVpn sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv4MplsVpn(value bool) BgpCapability { - - obj.obj.Ipv4MplsVpn = &value - return obj -} - -// Supports for IPv4 MDT address family messages. -// Ipv4Mdt returns a bool -func (obj *bgpCapability) Ipv4Mdt() bool { - - return *obj.obj.Ipv4Mdt - -} - -// Supports for IPv4 MDT address family messages. -// Ipv4Mdt returns a bool -func (obj *bgpCapability) HasIpv4Mdt() bool { - return obj.obj.Ipv4Mdt != nil -} - -// Supports for IPv4 MDT address family messages. -// SetIpv4Mdt sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv4Mdt(value bool) BgpCapability { - - obj.obj.Ipv4Mdt = &value - return obj -} - -// Support for the IPv4 Multicast VPN address family. -// Ipv4MulticastMplsVpn returns a bool -func (obj *bgpCapability) Ipv4MulticastMplsVpn() bool { - - return *obj.obj.Ipv4MulticastMplsVpn - -} - -// Support for the IPv4 Multicast VPN address family. -// Ipv4MulticastMplsVpn returns a bool -func (obj *bgpCapability) HasIpv4MulticastMplsVpn() bool { - return obj.obj.Ipv4MulticastMplsVpn != nil -} - -// Support for the IPv4 Multicast VPN address family. -// SetIpv4MulticastMplsVpn sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv4MulticastMplsVpn(value bool) BgpCapability { - - obj.obj.Ipv4MulticastMplsVpn = &value - return obj -} - -// Support for propagation of IPv4 unicast flow specification rules. -// Ipv4UnicastFlowSpec returns a bool -func (obj *bgpCapability) Ipv4UnicastFlowSpec() bool { - - return *obj.obj.Ipv4UnicastFlowSpec - -} - -// Support for propagation of IPv4 unicast flow specification rules. -// Ipv4UnicastFlowSpec returns a bool -func (obj *bgpCapability) HasIpv4UnicastFlowSpec() bool { - return obj.obj.Ipv4UnicastFlowSpec != nil -} - -// Support for propagation of IPv4 unicast flow specification rules. -// SetIpv4UnicastFlowSpec sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv4UnicastFlowSpec(value bool) BgpCapability { - - obj.obj.Ipv4UnicastFlowSpec = &value - return obj -} - -// Support for IPv4 SRTE policy. -// Ipv4SrTePolicy returns a bool -func (obj *bgpCapability) Ipv4SrTePolicy() bool { - - return *obj.obj.Ipv4SrTePolicy - -} - -// Support for IPv4 SRTE policy. -// Ipv4SrTePolicy returns a bool -func (obj *bgpCapability) HasIpv4SrTePolicy() bool { - return obj.obj.Ipv4SrTePolicy != nil -} - -// Support for IPv4 SRTE policy. -// SetIpv4SrTePolicy sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv4SrTePolicy(value bool) BgpCapability { - - obj.obj.Ipv4SrTePolicy = &value - return obj -} - -// Support for IPv4 Unicast Add Path Capability. -// Ipv4UnicastAddPath returns a bool -func (obj *bgpCapability) Ipv4UnicastAddPath() bool { - - return *obj.obj.Ipv4UnicastAddPath - -} - -// Support for IPv4 Unicast Add Path Capability. -// Ipv4UnicastAddPath returns a bool -func (obj *bgpCapability) HasIpv4UnicastAddPath() bool { - return obj.obj.Ipv4UnicastAddPath != nil -} - -// Support for IPv4 Unicast Add Path Capability. -// SetIpv4UnicastAddPath sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv4UnicastAddPath(value bool) BgpCapability { - - obj.obj.Ipv4UnicastAddPath = &value - return obj -} - -// Support for the IPv6 Multicast VPN address family. -// Ipv6MulticastVpn returns a bool -func (obj *bgpCapability) Ipv6MulticastVpn() bool { - - return *obj.obj.Ipv6MulticastVpn - -} - -// Support for the IPv6 Multicast VPN address family. -// Ipv6MulticastVpn returns a bool -func (obj *bgpCapability) HasIpv6MulticastVpn() bool { - return obj.obj.Ipv6MulticastVpn != nil -} - -// Support for the IPv6 Multicast VPN address family. -// SetIpv6MulticastVpn sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv6MulticastVpn(value bool) BgpCapability { - - obj.obj.Ipv6MulticastVpn = &value - return obj -} - -// Support for the IPv6 MPLS L3VPN address family. -// Ipv6MplsVpn returns a bool -func (obj *bgpCapability) Ipv6MplsVpn() bool { - - return *obj.obj.Ipv6MplsVpn - -} - -// Support for the IPv6 MPLS L3VPN address family. -// Ipv6MplsVpn returns a bool -func (obj *bgpCapability) HasIpv6MplsVpn() bool { - return obj.obj.Ipv6MplsVpn != nil -} - -// Support for the IPv6 MPLS L3VPN address family. -// SetIpv6MplsVpn sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv6MplsVpn(value bool) BgpCapability { - - obj.obj.Ipv6MplsVpn = &value - return obj -} - -// Support for IPv6 MDT address family messages. -// Ipv6Mdt returns a bool -func (obj *bgpCapability) Ipv6Mdt() bool { - - return *obj.obj.Ipv6Mdt - -} - -// Support for IPv6 MDT address family messages. -// Ipv6Mdt returns a bool -func (obj *bgpCapability) HasIpv6Mdt() bool { - return obj.obj.Ipv6Mdt != nil -} - -// Support for IPv6 MDT address family messages. -// SetIpv6Mdt sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv6Mdt(value bool) BgpCapability { - - obj.obj.Ipv6Mdt = &value - return obj -} - -// Support for the IPv6 Multicast VPN address family. -// Ipv6MulticastMplsVpn returns a bool -func (obj *bgpCapability) Ipv6MulticastMplsVpn() bool { - - return *obj.obj.Ipv6MulticastMplsVpn - -} - -// Support for the IPv6 Multicast VPN address family. -// Ipv6MulticastMplsVpn returns a bool -func (obj *bgpCapability) HasIpv6MulticastMplsVpn() bool { - return obj.obj.Ipv6MulticastMplsVpn != nil -} - -// Support for the IPv6 Multicast VPN address family. -// SetIpv6MulticastMplsVpn sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv6MulticastMplsVpn(value bool) BgpCapability { - - obj.obj.Ipv6MulticastMplsVpn = &value - return obj -} - -// Support for propagation of IPv6 unicast flow specification rules. -// Ipv6UnicastFlowSpec returns a bool -func (obj *bgpCapability) Ipv6UnicastFlowSpec() bool { - - return *obj.obj.Ipv6UnicastFlowSpec - -} - -// Support for propagation of IPv6 unicast flow specification rules. -// Ipv6UnicastFlowSpec returns a bool -func (obj *bgpCapability) HasIpv6UnicastFlowSpec() bool { - return obj.obj.Ipv6UnicastFlowSpec != nil -} - -// Support for propagation of IPv6 unicast flow specification rules. -// SetIpv6UnicastFlowSpec sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv6UnicastFlowSpec(value bool) BgpCapability { - - obj.obj.Ipv6UnicastFlowSpec = &value - return obj -} - -// Support for IPv6 SRTE policy. -// Ipv6SrTePolicy returns a bool -func (obj *bgpCapability) Ipv6SrTePolicy() bool { - - return *obj.obj.Ipv6SrTePolicy - -} - -// Support for IPv6 SRTE policy. -// Ipv6SrTePolicy returns a bool -func (obj *bgpCapability) HasIpv6SrTePolicy() bool { - return obj.obj.Ipv6SrTePolicy != nil -} - -// Support for IPv6 SRTE policy. -// SetIpv6SrTePolicy sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv6SrTePolicy(value bool) BgpCapability { - - obj.obj.Ipv6SrTePolicy = &value - return obj -} - -// Support for IPv6 Unicast Add Path Capability. -// Ipv6UnicastAddPath returns a bool -func (obj *bgpCapability) Ipv6UnicastAddPath() bool { - - return *obj.obj.Ipv6UnicastAddPath - -} - -// Support for IPv6 Unicast Add Path Capability. -// Ipv6UnicastAddPath returns a bool -func (obj *bgpCapability) HasIpv6UnicastAddPath() bool { - return obj.obj.Ipv6UnicastAddPath != nil -} - -// Support for IPv6 Unicast Add Path Capability. -// SetIpv6UnicastAddPath sets the bool value in the BgpCapability object -func (obj *bgpCapability) SetIpv6UnicastAddPath(value bool) BgpCapability { - - obj.obj.Ipv6UnicastAddPath = &value - return obj -} - -func (obj *bgpCapability) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpCapability) setDefault() { - if obj.obj.Ipv4Unicast == nil { - obj.SetIpv4Unicast(true) - } - if obj.obj.Ipv4Multicast == nil { - obj.SetIpv4Multicast(false) - } - if obj.obj.Ipv6Unicast == nil { - obj.SetIpv6Unicast(true) - } - if obj.obj.Ipv6Multicast == nil { - obj.SetIpv6Multicast(false) - } - if obj.obj.Vpls == nil { - obj.SetVpls(false) - } - if obj.obj.RouteRefresh == nil { - obj.SetRouteRefresh(true) - } - if obj.obj.RouteConstraint == nil { - obj.SetRouteConstraint(false) - } - if obj.obj.LinkStateNonVpn == nil { - obj.SetLinkStateNonVpn(false) - } - if obj.obj.LinkStateVpn == nil { - obj.SetLinkStateVpn(false) - } - if obj.obj.Evpn == nil { - obj.SetEvpn(false) - } - if obj.obj.ExtendedNextHopEncoding == nil { - obj.SetExtendedNextHopEncoding(false) - } - if obj.obj.Ipv4MulticastVpn == nil { - obj.SetIpv4MulticastVpn(false) - } - if obj.obj.Ipv4MplsVpn == nil { - obj.SetIpv4MplsVpn(false) - } - if obj.obj.Ipv4Mdt == nil { - obj.SetIpv4Mdt(false) - } - if obj.obj.Ipv4MulticastMplsVpn == nil { - obj.SetIpv4MulticastMplsVpn(false) - } - if obj.obj.Ipv4UnicastFlowSpec == nil { - obj.SetIpv4UnicastFlowSpec(false) - } - if obj.obj.Ipv4SrTePolicy == nil { - obj.SetIpv4SrTePolicy(false) - } - if obj.obj.Ipv4UnicastAddPath == nil { - obj.SetIpv4UnicastAddPath(false) - } - if obj.obj.Ipv6MulticastVpn == nil { - obj.SetIpv6MulticastVpn(false) - } - if obj.obj.Ipv6MplsVpn == nil { - obj.SetIpv6MplsVpn(false) - } - if obj.obj.Ipv6Mdt == nil { - obj.SetIpv6Mdt(false) - } - if obj.obj.Ipv6MulticastMplsVpn == nil { - obj.SetIpv6MulticastMplsVpn(false) - } - if obj.obj.Ipv6UnicastFlowSpec == nil { - obj.SetIpv6UnicastFlowSpec(false) - } - if obj.obj.Ipv6SrTePolicy == nil { - obj.SetIpv6SrTePolicy(false) - } - if obj.obj.Ipv6UnicastAddPath == nil { - obj.SetIpv6UnicastAddPath(false) - } - -} - -// ***** BgpLearnedInformationFilter ***** -type bgpLearnedInformationFilter struct { - validation - obj *otg.BgpLearnedInformationFilter - marshaller marshalBgpLearnedInformationFilter - unMarshaller unMarshalBgpLearnedInformationFilter -} - -func NewBgpLearnedInformationFilter() BgpLearnedInformationFilter { - obj := bgpLearnedInformationFilter{obj: &otg.BgpLearnedInformationFilter{}} - obj.setDefault() - return &obj -} - -func (obj *bgpLearnedInformationFilter) msg() *otg.BgpLearnedInformationFilter { - return obj.obj -} - -func (obj *bgpLearnedInformationFilter) setMsg(msg *otg.BgpLearnedInformationFilter) BgpLearnedInformationFilter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpLearnedInformationFilter struct { - obj *bgpLearnedInformationFilter -} - -type marshalBgpLearnedInformationFilter interface { - // ToProto marshals BgpLearnedInformationFilter to protobuf object *otg.BgpLearnedInformationFilter - ToProto() (*otg.BgpLearnedInformationFilter, error) - // ToPbText marshals BgpLearnedInformationFilter to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpLearnedInformationFilter to YAML text - ToYaml() (string, error) - // ToJson marshals BgpLearnedInformationFilter to JSON text - ToJson() (string, error) -} - -type unMarshalbgpLearnedInformationFilter struct { - obj *bgpLearnedInformationFilter -} - -type unMarshalBgpLearnedInformationFilter interface { - // FromProto unmarshals BgpLearnedInformationFilter from protobuf object *otg.BgpLearnedInformationFilter - FromProto(msg *otg.BgpLearnedInformationFilter) (BgpLearnedInformationFilter, error) - // FromPbText unmarshals BgpLearnedInformationFilter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpLearnedInformationFilter from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpLearnedInformationFilter from JSON text - FromJson(value string) error -} - -func (obj *bgpLearnedInformationFilter) Marshal() marshalBgpLearnedInformationFilter { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpLearnedInformationFilter{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpLearnedInformationFilter) Unmarshal() unMarshalBgpLearnedInformationFilter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpLearnedInformationFilter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpLearnedInformationFilter) ToProto() (*otg.BgpLearnedInformationFilter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpLearnedInformationFilter) FromProto(msg *otg.BgpLearnedInformationFilter) (BgpLearnedInformationFilter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpLearnedInformationFilter) 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 *unMarshalbgpLearnedInformationFilter) 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 *marshalbgpLearnedInformationFilter) 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 *unMarshalbgpLearnedInformationFilter) 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 *marshalbgpLearnedInformationFilter) 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 *unMarshalbgpLearnedInformationFilter) 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 *bgpLearnedInformationFilter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpLearnedInformationFilter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpLearnedInformationFilter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpLearnedInformationFilter) Clone() (BgpLearnedInformationFilter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpLearnedInformationFilter() - 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 -} - -// BgpLearnedInformationFilter is configuration for controlling storage of BGP learned information recieved from the peer. -type BgpLearnedInformationFilter interface { - Validation - // msg marshals BgpLearnedInformationFilter to protobuf object *otg.BgpLearnedInformationFilter - // and doesn't set defaults - msg() *otg.BgpLearnedInformationFilter - // setMsg unmarshals BgpLearnedInformationFilter from protobuf object *otg.BgpLearnedInformationFilter - // and doesn't set defaults - setMsg(*otg.BgpLearnedInformationFilter) BgpLearnedInformationFilter - // provides marshal interface - Marshal() marshalBgpLearnedInformationFilter - // provides unmarshal interface - Unmarshal() unMarshalBgpLearnedInformationFilter - // validate validates BgpLearnedInformationFilter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpLearnedInformationFilter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // UnicastIpv4Prefix returns bool, set in BgpLearnedInformationFilter. - UnicastIpv4Prefix() bool - // SetUnicastIpv4Prefix assigns bool provided by user to BgpLearnedInformationFilter - SetUnicastIpv4Prefix(value bool) BgpLearnedInformationFilter - // HasUnicastIpv4Prefix checks if UnicastIpv4Prefix has been set in BgpLearnedInformationFilter - HasUnicastIpv4Prefix() bool - // UnicastIpv6Prefix returns bool, set in BgpLearnedInformationFilter. - UnicastIpv6Prefix() bool - // SetUnicastIpv6Prefix assigns bool provided by user to BgpLearnedInformationFilter - SetUnicastIpv6Prefix(value bool) BgpLearnedInformationFilter - // HasUnicastIpv6Prefix checks if UnicastIpv6Prefix has been set in BgpLearnedInformationFilter - HasUnicastIpv6Prefix() bool -} - -// If enabled, will store the information related to Unicast IPv4 Prefixes recieved from the peer. -// UnicastIpv4Prefix returns a bool -func (obj *bgpLearnedInformationFilter) UnicastIpv4Prefix() bool { - - return *obj.obj.UnicastIpv4Prefix - -} - -// If enabled, will store the information related to Unicast IPv4 Prefixes recieved from the peer. -// UnicastIpv4Prefix returns a bool -func (obj *bgpLearnedInformationFilter) HasUnicastIpv4Prefix() bool { - return obj.obj.UnicastIpv4Prefix != nil -} - -// If enabled, will store the information related to Unicast IPv4 Prefixes recieved from the peer. -// SetUnicastIpv4Prefix sets the bool value in the BgpLearnedInformationFilter object -func (obj *bgpLearnedInformationFilter) SetUnicastIpv4Prefix(value bool) BgpLearnedInformationFilter { - - obj.obj.UnicastIpv4Prefix = &value - return obj -} - -// If enabled, will store the information related to Unicast IPv6 Prefixes recieved from the peer. -// UnicastIpv6Prefix returns a bool -func (obj *bgpLearnedInformationFilter) UnicastIpv6Prefix() bool { - - return *obj.obj.UnicastIpv6Prefix - -} - -// If enabled, will store the information related to Unicast IPv6 Prefixes recieved from the peer. -// UnicastIpv6Prefix returns a bool -func (obj *bgpLearnedInformationFilter) HasUnicastIpv6Prefix() bool { - return obj.obj.UnicastIpv6Prefix != nil -} - -// If enabled, will store the information related to Unicast IPv6 Prefixes recieved from the peer. -// SetUnicastIpv6Prefix sets the bool value in the BgpLearnedInformationFilter object -func (obj *bgpLearnedInformationFilter) SetUnicastIpv6Prefix(value bool) BgpLearnedInformationFilter { - - obj.obj.UnicastIpv6Prefix = &value - return obj -} - -func (obj *bgpLearnedInformationFilter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpLearnedInformationFilter) setDefault() { - if obj.obj.UnicastIpv4Prefix == nil { - obj.SetUnicastIpv4Prefix(false) - } - if obj.obj.UnicastIpv6Prefix == nil { - obj.SetUnicastIpv6Prefix(false) - } - -} - -// ***** BgpV4RouteRange ***** -type bgpV4RouteRange struct { - validation - obj *otg.BgpV4RouteRange - marshaller marshalBgpV4RouteRange - unMarshaller unMarshalBgpV4RouteRange - addressesHolder BgpV4RouteRangeV4RouteAddressIter - advancedHolder BgpRouteAdvanced - communitiesHolder BgpV4RouteRangeBgpCommunityIter - asPathHolder BgpAsPath - addPathHolder BgpAddPath - extCommunitiesHolder BgpV4RouteRangeBgpExtCommunityIter - extendedCommunitiesHolder BgpV4RouteRangeBgpExtendedCommunityIter -} - -func NewBgpV4RouteRange() BgpV4RouteRange { - obj := bgpV4RouteRange{obj: &otg.BgpV4RouteRange{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV4RouteRange) msg() *otg.BgpV4RouteRange { - return obj.obj -} - -func (obj *bgpV4RouteRange) setMsg(msg *otg.BgpV4RouteRange) BgpV4RouteRange { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV4RouteRange struct { - obj *bgpV4RouteRange -} - -type marshalBgpV4RouteRange interface { - // ToProto marshals BgpV4RouteRange to protobuf object *otg.BgpV4RouteRange - ToProto() (*otg.BgpV4RouteRange, error) - // ToPbText marshals BgpV4RouteRange to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV4RouteRange to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV4RouteRange to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV4RouteRange struct { - obj *bgpV4RouteRange -} - -type unMarshalBgpV4RouteRange interface { - // FromProto unmarshals BgpV4RouteRange from protobuf object *otg.BgpV4RouteRange - FromProto(msg *otg.BgpV4RouteRange) (BgpV4RouteRange, error) - // FromPbText unmarshals BgpV4RouteRange from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV4RouteRange from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV4RouteRange from JSON text - FromJson(value string) error -} - -func (obj *bgpV4RouteRange) Marshal() marshalBgpV4RouteRange { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV4RouteRange{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV4RouteRange) Unmarshal() unMarshalBgpV4RouteRange { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV4RouteRange{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV4RouteRange) ToProto() (*otg.BgpV4RouteRange, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV4RouteRange) FromProto(msg *otg.BgpV4RouteRange) (BgpV4RouteRange, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV4RouteRange) 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 *unMarshalbgpV4RouteRange) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpV4RouteRange) 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 *unMarshalbgpV4RouteRange) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpV4RouteRange) 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 *unMarshalbgpV4RouteRange) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpV4RouteRange) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV4RouteRange) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV4RouteRange) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV4RouteRange) Clone() (BgpV4RouteRange, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV4RouteRange() - 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 -} - -func (obj *bgpV4RouteRange) setNil() { - obj.addressesHolder = nil - obj.advancedHolder = nil - obj.communitiesHolder = nil - obj.asPathHolder = nil - obj.addPathHolder = nil - obj.extCommunitiesHolder = nil - obj.extendedCommunitiesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpV4RouteRange is emulated BGPv4 route range. -type BgpV4RouteRange interface { - Validation - // msg marshals BgpV4RouteRange to protobuf object *otg.BgpV4RouteRange - // and doesn't set defaults - msg() *otg.BgpV4RouteRange - // setMsg unmarshals BgpV4RouteRange from protobuf object *otg.BgpV4RouteRange - // and doesn't set defaults - setMsg(*otg.BgpV4RouteRange) BgpV4RouteRange - // provides marshal interface - Marshal() marshalBgpV4RouteRange - // provides unmarshal interface - Unmarshal() unMarshalBgpV4RouteRange - // validate validates BgpV4RouteRange - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV4RouteRange, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Addresses returns BgpV4RouteRangeV4RouteAddressIterIter, set in BgpV4RouteRange - Addresses() BgpV4RouteRangeV4RouteAddressIter - // NextHopMode returns BgpV4RouteRangeNextHopModeEnum, set in BgpV4RouteRange - NextHopMode() BgpV4RouteRangeNextHopModeEnum - // SetNextHopMode assigns BgpV4RouteRangeNextHopModeEnum provided by user to BgpV4RouteRange - SetNextHopMode(value BgpV4RouteRangeNextHopModeEnum) BgpV4RouteRange - // HasNextHopMode checks if NextHopMode has been set in BgpV4RouteRange - HasNextHopMode() bool - // NextHopAddressType returns BgpV4RouteRangeNextHopAddressTypeEnum, set in BgpV4RouteRange - NextHopAddressType() BgpV4RouteRangeNextHopAddressTypeEnum - // SetNextHopAddressType assigns BgpV4RouteRangeNextHopAddressTypeEnum provided by user to BgpV4RouteRange - SetNextHopAddressType(value BgpV4RouteRangeNextHopAddressTypeEnum) BgpV4RouteRange - // HasNextHopAddressType checks if NextHopAddressType has been set in BgpV4RouteRange - HasNextHopAddressType() bool - // NextHopIpv4Address returns string, set in BgpV4RouteRange. - NextHopIpv4Address() string - // SetNextHopIpv4Address assigns string provided by user to BgpV4RouteRange - SetNextHopIpv4Address(value string) BgpV4RouteRange - // HasNextHopIpv4Address checks if NextHopIpv4Address has been set in BgpV4RouteRange - HasNextHopIpv4Address() bool - // NextHopIpv6Address returns string, set in BgpV4RouteRange. - NextHopIpv6Address() string - // SetNextHopIpv6Address assigns string provided by user to BgpV4RouteRange - SetNextHopIpv6Address(value string) BgpV4RouteRange - // HasNextHopIpv6Address checks if NextHopIpv6Address has been set in BgpV4RouteRange - HasNextHopIpv6Address() bool - // Advanced returns BgpRouteAdvanced, set in BgpV4RouteRange. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - Advanced() BgpRouteAdvanced - // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpV4RouteRange. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - SetAdvanced(value BgpRouteAdvanced) BgpV4RouteRange - // HasAdvanced checks if Advanced has been set in BgpV4RouteRange - HasAdvanced() bool - // Communities returns BgpV4RouteRangeBgpCommunityIterIter, set in BgpV4RouteRange - Communities() BgpV4RouteRangeBgpCommunityIter - // AsPath returns BgpAsPath, set in BgpV4RouteRange. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - AsPath() BgpAsPath - // SetAsPath assigns BgpAsPath provided by user to BgpV4RouteRange. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - SetAsPath(value BgpAsPath) BgpV4RouteRange - // HasAsPath checks if AsPath has been set in BgpV4RouteRange - HasAsPath() bool - // AddPath returns BgpAddPath, set in BgpV4RouteRange. - // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. - AddPath() BgpAddPath - // SetAddPath assigns BgpAddPath provided by user to BgpV4RouteRange. - // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. - SetAddPath(value BgpAddPath) BgpV4RouteRange - // HasAddPath checks if AddPath has been set in BgpV4RouteRange - HasAddPath() bool - // Name returns string, set in BgpV4RouteRange. - Name() string - // SetName assigns string provided by user to BgpV4RouteRange - SetName(value string) BgpV4RouteRange - // ExtCommunities returns BgpV4RouteRangeBgpExtCommunityIterIter, set in BgpV4RouteRange - ExtCommunities() BgpV4RouteRangeBgpExtCommunityIter - // ExtendedCommunities returns BgpV4RouteRangeBgpExtendedCommunityIterIter, set in BgpV4RouteRange - ExtendedCommunities() BgpV4RouteRangeBgpExtendedCommunityIter - setNil() -} - -// A list of group of IPv4 route addresses. -// Addresses returns a []V4RouteAddress -func (obj *bgpV4RouteRange) Addresses() BgpV4RouteRangeV4RouteAddressIter { - if len(obj.obj.Addresses) == 0 { - obj.obj.Addresses = []*otg.V4RouteAddress{} - } - if obj.addressesHolder == nil { - obj.addressesHolder = newBgpV4RouteRangeV4RouteAddressIter(&obj.obj.Addresses).setMsg(obj) - } - return obj.addressesHolder -} - -type bgpV4RouteRangeV4RouteAddressIter struct { - obj *bgpV4RouteRange - v4RouteAddressSlice []V4RouteAddress - fieldPtr *[]*otg.V4RouteAddress -} - -func newBgpV4RouteRangeV4RouteAddressIter(ptr *[]*otg.V4RouteAddress) BgpV4RouteRangeV4RouteAddressIter { - return &bgpV4RouteRangeV4RouteAddressIter{fieldPtr: ptr} -} - -type BgpV4RouteRangeV4RouteAddressIter interface { - setMsg(*bgpV4RouteRange) BgpV4RouteRangeV4RouteAddressIter - Items() []V4RouteAddress - Add() V4RouteAddress - Append(items ...V4RouteAddress) BgpV4RouteRangeV4RouteAddressIter - Set(index int, newObj V4RouteAddress) BgpV4RouteRangeV4RouteAddressIter - Clear() BgpV4RouteRangeV4RouteAddressIter - clearHolderSlice() BgpV4RouteRangeV4RouteAddressIter - appendHolderSlice(item V4RouteAddress) BgpV4RouteRangeV4RouteAddressIter -} - -func (obj *bgpV4RouteRangeV4RouteAddressIter) setMsg(msg *bgpV4RouteRange) BgpV4RouteRangeV4RouteAddressIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&v4RouteAddress{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4RouteRangeV4RouteAddressIter) Items() []V4RouteAddress { - return obj.v4RouteAddressSlice -} - -func (obj *bgpV4RouteRangeV4RouteAddressIter) Add() V4RouteAddress { - newObj := &otg.V4RouteAddress{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &v4RouteAddress{obj: newObj} - newLibObj.setDefault() - obj.v4RouteAddressSlice = append(obj.v4RouteAddressSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4RouteRangeV4RouteAddressIter) Append(items ...V4RouteAddress) BgpV4RouteRangeV4RouteAddressIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.v4RouteAddressSlice = append(obj.v4RouteAddressSlice, item) - } - return obj -} - -func (obj *bgpV4RouteRangeV4RouteAddressIter) Set(index int, newObj V4RouteAddress) BgpV4RouteRangeV4RouteAddressIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.v4RouteAddressSlice[index] = newObj - return obj -} -func (obj *bgpV4RouteRangeV4RouteAddressIter) Clear() BgpV4RouteRangeV4RouteAddressIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.V4RouteAddress{} - obj.v4RouteAddressSlice = []V4RouteAddress{} - } - return obj -} -func (obj *bgpV4RouteRangeV4RouteAddressIter) clearHolderSlice() BgpV4RouteRangeV4RouteAddressIter { - if len(obj.v4RouteAddressSlice) > 0 { - obj.v4RouteAddressSlice = []V4RouteAddress{} - } - return obj -} -func (obj *bgpV4RouteRangeV4RouteAddressIter) appendHolderSlice(item V4RouteAddress) BgpV4RouteRangeV4RouteAddressIter { - obj.v4RouteAddressSlice = append(obj.v4RouteAddressSlice, item) - return obj -} - -type BgpV4RouteRangeNextHopModeEnum string - -// Enum of NextHopMode on BgpV4RouteRange -var BgpV4RouteRangeNextHopMode = struct { - LOCAL_IP BgpV4RouteRangeNextHopModeEnum - MANUAL BgpV4RouteRangeNextHopModeEnum -}{ - LOCAL_IP: BgpV4RouteRangeNextHopModeEnum("local_ip"), - MANUAL: BgpV4RouteRangeNextHopModeEnum("manual"), -} - -func (obj *bgpV4RouteRange) NextHopMode() BgpV4RouteRangeNextHopModeEnum { - return BgpV4RouteRangeNextHopModeEnum(obj.obj.NextHopMode.Enum().String()) -} - -// Specify the NextHop in MP REACH NLRI. The mode for setting the IP address of the NextHop in the MP REACH NLRI can be one of the following: -// Local IP: Automatically fills the Nexthop with the Local IP of the BGP -// peer. -// If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. -// Manual: Override the Nexthop with any arbitrary IPv4/IPv6 address. -// NextHopMode returns a string -func (obj *bgpV4RouteRange) HasNextHopMode() bool { - return obj.obj.NextHopMode != nil -} - -func (obj *bgpV4RouteRange) SetNextHopMode(value BgpV4RouteRangeNextHopModeEnum) BgpV4RouteRange { - intValue, ok := otg.BgpV4RouteRange_NextHopMode_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpV4RouteRangeNextHopModeEnum", string(value))) - return obj - } - enumValue := otg.BgpV4RouteRange_NextHopMode_Enum(intValue) - obj.obj.NextHopMode = &enumValue - - return obj -} - -type BgpV4RouteRangeNextHopAddressTypeEnum string - -// Enum of NextHopAddressType on BgpV4RouteRange -var BgpV4RouteRangeNextHopAddressType = struct { - IPV4 BgpV4RouteRangeNextHopAddressTypeEnum - IPV6 BgpV4RouteRangeNextHopAddressTypeEnum -}{ - IPV4: BgpV4RouteRangeNextHopAddressTypeEnum("ipv4"), - IPV6: BgpV4RouteRangeNextHopAddressTypeEnum("ipv6"), -} - -func (obj *bgpV4RouteRange) NextHopAddressType() BgpV4RouteRangeNextHopAddressTypeEnum { - return BgpV4RouteRangeNextHopAddressTypeEnum(obj.obj.NextHopAddressType.Enum().String()) -} - -// If the Nexthop Mode is Manual, it sets the type of the NextHop IP address. -// NextHopAddressType returns a string -func (obj *bgpV4RouteRange) HasNextHopAddressType() bool { - return obj.obj.NextHopAddressType != nil -} - -func (obj *bgpV4RouteRange) SetNextHopAddressType(value BgpV4RouteRangeNextHopAddressTypeEnum) BgpV4RouteRange { - intValue, ok := otg.BgpV4RouteRange_NextHopAddressType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpV4RouteRangeNextHopAddressTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpV4RouteRange_NextHopAddressType_Enum(intValue) - obj.obj.NextHopAddressType = &enumValue - - return obj -} - -// The IPv4 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. -// NextHopIpv4Address returns a string -func (obj *bgpV4RouteRange) NextHopIpv4Address() string { - - return *obj.obj.NextHopIpv4Address - -} - -// The IPv4 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. -// NextHopIpv4Address returns a string -func (obj *bgpV4RouteRange) HasNextHopIpv4Address() bool { - return obj.obj.NextHopIpv4Address != nil -} - -// The IPv4 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. -// SetNextHopIpv4Address sets the string value in the BgpV4RouteRange object -func (obj *bgpV4RouteRange) SetNextHopIpv4Address(value string) BgpV4RouteRange { - - obj.obj.NextHopIpv4Address = &value - return obj -} - -// The IPv6 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv6. -// NextHopIpv6Address returns a string -func (obj *bgpV4RouteRange) NextHopIpv6Address() string { - - return *obj.obj.NextHopIpv6Address - -} - -// The IPv6 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv6. -// NextHopIpv6Address returns a string -func (obj *bgpV4RouteRange) HasNextHopIpv6Address() bool { - return obj.obj.NextHopIpv6Address != nil -} - -// The IPv6 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv6. -// SetNextHopIpv6Address sets the string value in the BgpV4RouteRange object -func (obj *bgpV4RouteRange) SetNextHopIpv6Address(value string) BgpV4RouteRange { - - obj.obj.NextHopIpv6Address = &value - return obj -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpV4RouteRange) Advanced() BgpRouteAdvanced { - if obj.obj.Advanced == nil { - obj.obj.Advanced = NewBgpRouteAdvanced().msg() - } - if obj.advancedHolder == nil { - obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} - } - return obj.advancedHolder -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpV4RouteRange) HasAdvanced() bool { - return obj.obj.Advanced != nil -} - -// description is TBD -// SetAdvanced sets the BgpRouteAdvanced value in the BgpV4RouteRange object -func (obj *bgpV4RouteRange) SetAdvanced(value BgpRouteAdvanced) BgpV4RouteRange { - - obj.advancedHolder = nil - obj.obj.Advanced = value.msg() - - return obj -} - -// Optional community settings. -// Communities returns a []BgpCommunity -func (obj *bgpV4RouteRange) Communities() BgpV4RouteRangeBgpCommunityIter { - if len(obj.obj.Communities) == 0 { - obj.obj.Communities = []*otg.BgpCommunity{} - } - if obj.communitiesHolder == nil { - obj.communitiesHolder = newBgpV4RouteRangeBgpCommunityIter(&obj.obj.Communities).setMsg(obj) - } - return obj.communitiesHolder -} - -type bgpV4RouteRangeBgpCommunityIter struct { - obj *bgpV4RouteRange - bgpCommunitySlice []BgpCommunity - fieldPtr *[]*otg.BgpCommunity -} - -func newBgpV4RouteRangeBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpV4RouteRangeBgpCommunityIter { - return &bgpV4RouteRangeBgpCommunityIter{fieldPtr: ptr} -} - -type BgpV4RouteRangeBgpCommunityIter interface { - setMsg(*bgpV4RouteRange) BgpV4RouteRangeBgpCommunityIter - Items() []BgpCommunity - Add() BgpCommunity - Append(items ...BgpCommunity) BgpV4RouteRangeBgpCommunityIter - Set(index int, newObj BgpCommunity) BgpV4RouteRangeBgpCommunityIter - Clear() BgpV4RouteRangeBgpCommunityIter - clearHolderSlice() BgpV4RouteRangeBgpCommunityIter - appendHolderSlice(item BgpCommunity) BgpV4RouteRangeBgpCommunityIter -} - -func (obj *bgpV4RouteRangeBgpCommunityIter) setMsg(msg *bgpV4RouteRange) BgpV4RouteRangeBgpCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4RouteRangeBgpCommunityIter) Items() []BgpCommunity { - return obj.bgpCommunitySlice -} - -func (obj *bgpV4RouteRangeBgpCommunityIter) Add() BgpCommunity { - newObj := &otg.BgpCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4RouteRangeBgpCommunityIter) Append(items ...BgpCommunity) BgpV4RouteRangeBgpCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - } - return obj -} - -func (obj *bgpV4RouteRangeBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpV4RouteRangeBgpCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpCommunitySlice[index] = newObj - return obj -} -func (obj *bgpV4RouteRangeBgpCommunityIter) Clear() BgpV4RouteRangeBgpCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpCommunity{} - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpV4RouteRangeBgpCommunityIter) clearHolderSlice() BgpV4RouteRangeBgpCommunityIter { - if len(obj.bgpCommunitySlice) > 0 { - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpV4RouteRangeBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpV4RouteRangeBgpCommunityIter { - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - return obj -} - -// description is TBD -// AsPath returns a BgpAsPath -func (obj *bgpV4RouteRange) AsPath() BgpAsPath { - if obj.obj.AsPath == nil { - obj.obj.AsPath = NewBgpAsPath().msg() - } - if obj.asPathHolder == nil { - obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} - } - return obj.asPathHolder -} - -// description is TBD -// AsPath returns a BgpAsPath -func (obj *bgpV4RouteRange) HasAsPath() bool { - return obj.obj.AsPath != nil -} - -// description is TBD -// SetAsPath sets the BgpAsPath value in the BgpV4RouteRange object -func (obj *bgpV4RouteRange) SetAsPath(value BgpAsPath) BgpV4RouteRange { - - obj.asPathHolder = nil - obj.obj.AsPath = value.msg() - - return obj -} - -// description is TBD -// AddPath returns a BgpAddPath -func (obj *bgpV4RouteRange) AddPath() BgpAddPath { - if obj.obj.AddPath == nil { - obj.obj.AddPath = NewBgpAddPath().msg() - } - if obj.addPathHolder == nil { - obj.addPathHolder = &bgpAddPath{obj: obj.obj.AddPath} - } - return obj.addPathHolder -} - -// description is TBD -// AddPath returns a BgpAddPath -func (obj *bgpV4RouteRange) HasAddPath() bool { - return obj.obj.AddPath != nil -} - -// description is TBD -// SetAddPath sets the BgpAddPath value in the BgpV4RouteRange object -func (obj *bgpV4RouteRange) SetAddPath(value BgpAddPath) BgpV4RouteRange { - - obj.addPathHolder = nil - obj.obj.AddPath = value.msg() - - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *bgpV4RouteRange) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the BgpV4RouteRange object -func (obj *bgpV4RouteRange) SetName(value string) BgpV4RouteRange { - - obj.obj.Name = &value - return obj -} - -// Deprecated: This property is deprecated in favor of property extended_communities -// -// Deprecated: This property is deprecated in favor of property extended_communities -// -// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. Note evpn type is defined mainly for use with evpn route updates and not for IPv4 and IPv6 route updates. -// ExtCommunities returns a []BgpExtCommunity -func (obj *bgpV4RouteRange) ExtCommunities() BgpV4RouteRangeBgpExtCommunityIter { - if len(obj.obj.ExtCommunities) == 0 { - obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} - } - if obj.extCommunitiesHolder == nil { - obj.extCommunitiesHolder = newBgpV4RouteRangeBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) - } - return obj.extCommunitiesHolder -} - -type bgpV4RouteRangeBgpExtCommunityIter struct { - obj *bgpV4RouteRange - bgpExtCommunitySlice []BgpExtCommunity - fieldPtr *[]*otg.BgpExtCommunity -} - -func newBgpV4RouteRangeBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpV4RouteRangeBgpExtCommunityIter { - return &bgpV4RouteRangeBgpExtCommunityIter{fieldPtr: ptr} -} - -type BgpV4RouteRangeBgpExtCommunityIter interface { - setMsg(*bgpV4RouteRange) BgpV4RouteRangeBgpExtCommunityIter - Items() []BgpExtCommunity - Add() BgpExtCommunity - Append(items ...BgpExtCommunity) BgpV4RouteRangeBgpExtCommunityIter - Set(index int, newObj BgpExtCommunity) BgpV4RouteRangeBgpExtCommunityIter - Clear() BgpV4RouteRangeBgpExtCommunityIter - clearHolderSlice() BgpV4RouteRangeBgpExtCommunityIter - appendHolderSlice(item BgpExtCommunity) BgpV4RouteRangeBgpExtCommunityIter -} - -func (obj *bgpV4RouteRangeBgpExtCommunityIter) setMsg(msg *bgpV4RouteRange) BgpV4RouteRangeBgpExtCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpExtCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4RouteRangeBgpExtCommunityIter) Items() []BgpExtCommunity { - return obj.bgpExtCommunitySlice -} - -func (obj *bgpV4RouteRangeBgpExtCommunityIter) Add() BgpExtCommunity { - newObj := &otg.BgpExtCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpExtCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4RouteRangeBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpV4RouteRangeBgpExtCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - } - return obj -} - -func (obj *bgpV4RouteRangeBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpV4RouteRangeBgpExtCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpExtCommunitySlice[index] = newObj - return obj -} -func (obj *bgpV4RouteRangeBgpExtCommunityIter) Clear() BgpV4RouteRangeBgpExtCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpExtCommunity{} - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpV4RouteRangeBgpExtCommunityIter) clearHolderSlice() BgpV4RouteRangeBgpExtCommunityIter { - if len(obj.bgpExtCommunitySlice) > 0 { - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpV4RouteRangeBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpV4RouteRangeBgpExtCommunityIter { - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - return obj -} - -// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an eight byte value. It is divided into two main parts. The first two bytes of the community encode a type and sub-type fields and the last six bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. -// ExtendedCommunities returns a []BgpExtendedCommunity -func (obj *bgpV4RouteRange) ExtendedCommunities() BgpV4RouteRangeBgpExtendedCommunityIter { - if len(obj.obj.ExtendedCommunities) == 0 { - obj.obj.ExtendedCommunities = []*otg.BgpExtendedCommunity{} - } - if obj.extendedCommunitiesHolder == nil { - obj.extendedCommunitiesHolder = newBgpV4RouteRangeBgpExtendedCommunityIter(&obj.obj.ExtendedCommunities).setMsg(obj) - } - return obj.extendedCommunitiesHolder -} - -type bgpV4RouteRangeBgpExtendedCommunityIter struct { - obj *bgpV4RouteRange - bgpExtendedCommunitySlice []BgpExtendedCommunity - fieldPtr *[]*otg.BgpExtendedCommunity -} - -func newBgpV4RouteRangeBgpExtendedCommunityIter(ptr *[]*otg.BgpExtendedCommunity) BgpV4RouteRangeBgpExtendedCommunityIter { - return &bgpV4RouteRangeBgpExtendedCommunityIter{fieldPtr: ptr} -} - -type BgpV4RouteRangeBgpExtendedCommunityIter interface { - setMsg(*bgpV4RouteRange) BgpV4RouteRangeBgpExtendedCommunityIter - Items() []BgpExtendedCommunity - Add() BgpExtendedCommunity - Append(items ...BgpExtendedCommunity) BgpV4RouteRangeBgpExtendedCommunityIter - Set(index int, newObj BgpExtendedCommunity) BgpV4RouteRangeBgpExtendedCommunityIter - Clear() BgpV4RouteRangeBgpExtendedCommunityIter - clearHolderSlice() BgpV4RouteRangeBgpExtendedCommunityIter - appendHolderSlice(item BgpExtendedCommunity) BgpV4RouteRangeBgpExtendedCommunityIter -} - -func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) setMsg(msg *bgpV4RouteRange) BgpV4RouteRangeBgpExtendedCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpExtendedCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) Items() []BgpExtendedCommunity { - return obj.bgpExtendedCommunitySlice -} - -func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) Add() BgpExtendedCommunity { - newObj := &otg.BgpExtendedCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpExtendedCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) Append(items ...BgpExtendedCommunity) BgpV4RouteRangeBgpExtendedCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, item) - } - return obj -} - -func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) Set(index int, newObj BgpExtendedCommunity) BgpV4RouteRangeBgpExtendedCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpExtendedCommunitySlice[index] = newObj - return obj -} -func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) Clear() BgpV4RouteRangeBgpExtendedCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpExtendedCommunity{} - obj.bgpExtendedCommunitySlice = []BgpExtendedCommunity{} - } - return obj -} -func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) clearHolderSlice() BgpV4RouteRangeBgpExtendedCommunityIter { - if len(obj.bgpExtendedCommunitySlice) > 0 { - obj.bgpExtendedCommunitySlice = []BgpExtendedCommunity{} - } - return obj -} -func (obj *bgpV4RouteRangeBgpExtendedCommunityIter) appendHolderSlice(item BgpExtendedCommunity) BgpV4RouteRangeBgpExtendedCommunityIter { - obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, item) - return obj -} - -func (obj *bgpV4RouteRange) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Addresses) != 0 { - - if set_default { - obj.Addresses().clearHolderSlice() - for _, item := range obj.obj.Addresses { - obj.Addresses().appendHolderSlice(&v4RouteAddress{obj: item}) - } - } - for _, item := range obj.Addresses().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.NextHopIpv4Address != nil { - - err := obj.validateIpv4(obj.NextHopIpv4Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV4RouteRange.NextHopIpv4Address")) - } - - } - - if obj.obj.NextHopIpv6Address != nil { - - err := obj.validateIpv6(obj.NextHopIpv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV4RouteRange.NextHopIpv6Address")) - } - - } - - if obj.obj.Advanced != nil { - - obj.Advanced().validateObj(vObj, set_default) - } - - if len(obj.obj.Communities) != 0 { - - if set_default { - obj.Communities().clearHolderSlice() - for _, item := range obj.obj.Communities { - obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) - } - } - for _, item := range obj.Communities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.AsPath != nil { - - obj.AsPath().validateObj(vObj, set_default) - } - - if obj.obj.AddPath != nil { - - obj.AddPath().validateObj(vObj, set_default) - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpV4RouteRange") - } - - if len(obj.obj.ExtCommunities) != 0 { - obj.addWarnings("ExtCommunities property in schema BgpV4RouteRange is deprecated, This property is deprecated in favor of property extended_communities") - - if set_default { - obj.ExtCommunities().clearHolderSlice() - for _, item := range obj.obj.ExtCommunities { - obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) - } - } - for _, item := range obj.ExtCommunities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.ExtendedCommunities) != 0 { - - if set_default { - obj.ExtendedCommunities().clearHolderSlice() - for _, item := range obj.obj.ExtendedCommunities { - obj.ExtendedCommunities().appendHolderSlice(&bgpExtendedCommunity{obj: item}) - } - } - for _, item := range obj.ExtendedCommunities().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpV4RouteRange) setDefault() { - if obj.obj.NextHopMode == nil { - obj.SetNextHopMode(BgpV4RouteRangeNextHopMode.LOCAL_IP) - - } - if obj.obj.NextHopAddressType == nil { - obj.SetNextHopAddressType(BgpV4RouteRangeNextHopAddressType.IPV4) - - } - if obj.obj.NextHopIpv4Address == nil { - obj.SetNextHopIpv4Address("0.0.0.0") - } - if obj.obj.NextHopIpv6Address == nil { - obj.SetNextHopIpv6Address("::0") - } - -} - -// ***** BgpV6RouteRange ***** -type bgpV6RouteRange struct { - validation - obj *otg.BgpV6RouteRange - marshaller marshalBgpV6RouteRange - unMarshaller unMarshalBgpV6RouteRange - addressesHolder BgpV6RouteRangeV6RouteAddressIter - advancedHolder BgpRouteAdvanced - communitiesHolder BgpV6RouteRangeBgpCommunityIter - asPathHolder BgpAsPath - addPathHolder BgpAddPath - extCommunitiesHolder BgpV6RouteRangeBgpExtCommunityIter - extendedCommunitiesHolder BgpV6RouteRangeBgpExtendedCommunityIter -} - -func NewBgpV6RouteRange() BgpV6RouteRange { - obj := bgpV6RouteRange{obj: &otg.BgpV6RouteRange{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV6RouteRange) msg() *otg.BgpV6RouteRange { - return obj.obj -} - -func (obj *bgpV6RouteRange) setMsg(msg *otg.BgpV6RouteRange) BgpV6RouteRange { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV6RouteRange struct { - obj *bgpV6RouteRange -} - -type marshalBgpV6RouteRange interface { - // ToProto marshals BgpV6RouteRange to protobuf object *otg.BgpV6RouteRange - ToProto() (*otg.BgpV6RouteRange, error) - // ToPbText marshals BgpV6RouteRange to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV6RouteRange to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV6RouteRange to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV6RouteRange struct { - obj *bgpV6RouteRange -} - -type unMarshalBgpV6RouteRange interface { - // FromProto unmarshals BgpV6RouteRange from protobuf object *otg.BgpV6RouteRange - FromProto(msg *otg.BgpV6RouteRange) (BgpV6RouteRange, error) - // FromPbText unmarshals BgpV6RouteRange from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV6RouteRange from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV6RouteRange from JSON text - FromJson(value string) error -} - -func (obj *bgpV6RouteRange) Marshal() marshalBgpV6RouteRange { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV6RouteRange{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV6RouteRange) Unmarshal() unMarshalBgpV6RouteRange { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV6RouteRange{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV6RouteRange) ToProto() (*otg.BgpV6RouteRange, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV6RouteRange) FromProto(msg *otg.BgpV6RouteRange) (BgpV6RouteRange, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV6RouteRange) 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 *unMarshalbgpV6RouteRange) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpV6RouteRange) 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 *unMarshalbgpV6RouteRange) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpV6RouteRange) 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 *unMarshalbgpV6RouteRange) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpV6RouteRange) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV6RouteRange) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV6RouteRange) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV6RouteRange) Clone() (BgpV6RouteRange, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV6RouteRange() - 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 -} - -func (obj *bgpV6RouteRange) setNil() { - obj.addressesHolder = nil - obj.advancedHolder = nil - obj.communitiesHolder = nil - obj.asPathHolder = nil - obj.addPathHolder = nil - obj.extCommunitiesHolder = nil - obj.extendedCommunitiesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpV6RouteRange is emulated BGPv6 route range. -type BgpV6RouteRange interface { - Validation - // msg marshals BgpV6RouteRange to protobuf object *otg.BgpV6RouteRange - // and doesn't set defaults - msg() *otg.BgpV6RouteRange - // setMsg unmarshals BgpV6RouteRange from protobuf object *otg.BgpV6RouteRange - // and doesn't set defaults - setMsg(*otg.BgpV6RouteRange) BgpV6RouteRange - // provides marshal interface - Marshal() marshalBgpV6RouteRange - // provides unmarshal interface - Unmarshal() unMarshalBgpV6RouteRange - // validate validates BgpV6RouteRange - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV6RouteRange, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Addresses returns BgpV6RouteRangeV6RouteAddressIterIter, set in BgpV6RouteRange - Addresses() BgpV6RouteRangeV6RouteAddressIter - // NextHopMode returns BgpV6RouteRangeNextHopModeEnum, set in BgpV6RouteRange - NextHopMode() BgpV6RouteRangeNextHopModeEnum - // SetNextHopMode assigns BgpV6RouteRangeNextHopModeEnum provided by user to BgpV6RouteRange - SetNextHopMode(value BgpV6RouteRangeNextHopModeEnum) BgpV6RouteRange - // HasNextHopMode checks if NextHopMode has been set in BgpV6RouteRange - HasNextHopMode() bool - // NextHopAddressType returns BgpV6RouteRangeNextHopAddressTypeEnum, set in BgpV6RouteRange - NextHopAddressType() BgpV6RouteRangeNextHopAddressTypeEnum - // SetNextHopAddressType assigns BgpV6RouteRangeNextHopAddressTypeEnum provided by user to BgpV6RouteRange - SetNextHopAddressType(value BgpV6RouteRangeNextHopAddressTypeEnum) BgpV6RouteRange - // HasNextHopAddressType checks if NextHopAddressType has been set in BgpV6RouteRange - HasNextHopAddressType() bool - // NextHopIpv4Address returns string, set in BgpV6RouteRange. - NextHopIpv4Address() string - // SetNextHopIpv4Address assigns string provided by user to BgpV6RouteRange - SetNextHopIpv4Address(value string) BgpV6RouteRange - // HasNextHopIpv4Address checks if NextHopIpv4Address has been set in BgpV6RouteRange - HasNextHopIpv4Address() bool - // NextHopIpv6Address returns string, set in BgpV6RouteRange. - NextHopIpv6Address() string - // SetNextHopIpv6Address assigns string provided by user to BgpV6RouteRange - SetNextHopIpv6Address(value string) BgpV6RouteRange - // HasNextHopIpv6Address checks if NextHopIpv6Address has been set in BgpV6RouteRange - HasNextHopIpv6Address() bool - // Advanced returns BgpRouteAdvanced, set in BgpV6RouteRange. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - Advanced() BgpRouteAdvanced - // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpV6RouteRange. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - SetAdvanced(value BgpRouteAdvanced) BgpV6RouteRange - // HasAdvanced checks if Advanced has been set in BgpV6RouteRange - HasAdvanced() bool - // Communities returns BgpV6RouteRangeBgpCommunityIterIter, set in BgpV6RouteRange - Communities() BgpV6RouteRangeBgpCommunityIter - // AsPath returns BgpAsPath, set in BgpV6RouteRange. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - AsPath() BgpAsPath - // SetAsPath assigns BgpAsPath provided by user to BgpV6RouteRange. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - SetAsPath(value BgpAsPath) BgpV6RouteRange - // HasAsPath checks if AsPath has been set in BgpV6RouteRange - HasAsPath() bool - // AddPath returns BgpAddPath, set in BgpV6RouteRange. - // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. - AddPath() BgpAddPath - // SetAddPath assigns BgpAddPath provided by user to BgpV6RouteRange. - // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. - SetAddPath(value BgpAddPath) BgpV6RouteRange - // HasAddPath checks if AddPath has been set in BgpV6RouteRange - HasAddPath() bool - // Name returns string, set in BgpV6RouteRange. - Name() string - // SetName assigns string provided by user to BgpV6RouteRange - SetName(value string) BgpV6RouteRange - // ExtCommunities returns BgpV6RouteRangeBgpExtCommunityIterIter, set in BgpV6RouteRange - ExtCommunities() BgpV6RouteRangeBgpExtCommunityIter - // ExtendedCommunities returns BgpV6RouteRangeBgpExtendedCommunityIterIter, set in BgpV6RouteRange - ExtendedCommunities() BgpV6RouteRangeBgpExtendedCommunityIter - setNil() -} - -// A list of group of IPv6 route addresses. -// Addresses returns a []V6RouteAddress -func (obj *bgpV6RouteRange) Addresses() BgpV6RouteRangeV6RouteAddressIter { - if len(obj.obj.Addresses) == 0 { - obj.obj.Addresses = []*otg.V6RouteAddress{} - } - if obj.addressesHolder == nil { - obj.addressesHolder = newBgpV6RouteRangeV6RouteAddressIter(&obj.obj.Addresses).setMsg(obj) - } - return obj.addressesHolder -} - -type bgpV6RouteRangeV6RouteAddressIter struct { - obj *bgpV6RouteRange - v6RouteAddressSlice []V6RouteAddress - fieldPtr *[]*otg.V6RouteAddress -} - -func newBgpV6RouteRangeV6RouteAddressIter(ptr *[]*otg.V6RouteAddress) BgpV6RouteRangeV6RouteAddressIter { - return &bgpV6RouteRangeV6RouteAddressIter{fieldPtr: ptr} -} - -type BgpV6RouteRangeV6RouteAddressIter interface { - setMsg(*bgpV6RouteRange) BgpV6RouteRangeV6RouteAddressIter - Items() []V6RouteAddress - Add() V6RouteAddress - Append(items ...V6RouteAddress) BgpV6RouteRangeV6RouteAddressIter - Set(index int, newObj V6RouteAddress) BgpV6RouteRangeV6RouteAddressIter - Clear() BgpV6RouteRangeV6RouteAddressIter - clearHolderSlice() BgpV6RouteRangeV6RouteAddressIter - appendHolderSlice(item V6RouteAddress) BgpV6RouteRangeV6RouteAddressIter -} - -func (obj *bgpV6RouteRangeV6RouteAddressIter) setMsg(msg *bgpV6RouteRange) BgpV6RouteRangeV6RouteAddressIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&v6RouteAddress{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6RouteRangeV6RouteAddressIter) Items() []V6RouteAddress { - return obj.v6RouteAddressSlice -} - -func (obj *bgpV6RouteRangeV6RouteAddressIter) Add() V6RouteAddress { - newObj := &otg.V6RouteAddress{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &v6RouteAddress{obj: newObj} - newLibObj.setDefault() - obj.v6RouteAddressSlice = append(obj.v6RouteAddressSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6RouteRangeV6RouteAddressIter) Append(items ...V6RouteAddress) BgpV6RouteRangeV6RouteAddressIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.v6RouteAddressSlice = append(obj.v6RouteAddressSlice, item) - } - return obj -} - -func (obj *bgpV6RouteRangeV6RouteAddressIter) Set(index int, newObj V6RouteAddress) BgpV6RouteRangeV6RouteAddressIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.v6RouteAddressSlice[index] = newObj - return obj -} -func (obj *bgpV6RouteRangeV6RouteAddressIter) Clear() BgpV6RouteRangeV6RouteAddressIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.V6RouteAddress{} - obj.v6RouteAddressSlice = []V6RouteAddress{} - } - return obj -} -func (obj *bgpV6RouteRangeV6RouteAddressIter) clearHolderSlice() BgpV6RouteRangeV6RouteAddressIter { - if len(obj.v6RouteAddressSlice) > 0 { - obj.v6RouteAddressSlice = []V6RouteAddress{} - } - return obj -} -func (obj *bgpV6RouteRangeV6RouteAddressIter) appendHolderSlice(item V6RouteAddress) BgpV6RouteRangeV6RouteAddressIter { - obj.v6RouteAddressSlice = append(obj.v6RouteAddressSlice, item) - return obj -} - -type BgpV6RouteRangeNextHopModeEnum string - -// Enum of NextHopMode on BgpV6RouteRange -var BgpV6RouteRangeNextHopMode = struct { - LOCAL_IP BgpV6RouteRangeNextHopModeEnum - MANUAL BgpV6RouteRangeNextHopModeEnum -}{ - LOCAL_IP: BgpV6RouteRangeNextHopModeEnum("local_ip"), - MANUAL: BgpV6RouteRangeNextHopModeEnum("manual"), -} - -func (obj *bgpV6RouteRange) NextHopMode() BgpV6RouteRangeNextHopModeEnum { - return BgpV6RouteRangeNextHopModeEnum(obj.obj.NextHopMode.Enum().String()) -} - -// Specify the NextHop in MP REACH NLRI. The mode for setting the IP address of the NextHop in the MP REACH NLRI can be one of the following: -// Local IP: Automatically fills the Nexthop with the Local IP of the BGP -// peer. -// If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. -// Manual: Override the Nexthop with any arbitrary IPv4/IPv6 address. -// NextHopMode returns a string -func (obj *bgpV6RouteRange) HasNextHopMode() bool { - return obj.obj.NextHopMode != nil -} - -func (obj *bgpV6RouteRange) SetNextHopMode(value BgpV6RouteRangeNextHopModeEnum) BgpV6RouteRange { - intValue, ok := otg.BgpV6RouteRange_NextHopMode_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpV6RouteRangeNextHopModeEnum", string(value))) - return obj - } - enumValue := otg.BgpV6RouteRange_NextHopMode_Enum(intValue) - obj.obj.NextHopMode = &enumValue - - return obj -} - -type BgpV6RouteRangeNextHopAddressTypeEnum string - -// Enum of NextHopAddressType on BgpV6RouteRange -var BgpV6RouteRangeNextHopAddressType = struct { - IPV4 BgpV6RouteRangeNextHopAddressTypeEnum - IPV6 BgpV6RouteRangeNextHopAddressTypeEnum -}{ - IPV4: BgpV6RouteRangeNextHopAddressTypeEnum("ipv4"), - IPV6: BgpV6RouteRangeNextHopAddressTypeEnum("ipv6"), -} - -func (obj *bgpV6RouteRange) NextHopAddressType() BgpV6RouteRangeNextHopAddressTypeEnum { - return BgpV6RouteRangeNextHopAddressTypeEnum(obj.obj.NextHopAddressType.Enum().String()) -} - -// If the Nexthop Mode is Manual, it sets the type of the NextHop IP address. -// NextHopAddressType returns a string -func (obj *bgpV6RouteRange) HasNextHopAddressType() bool { - return obj.obj.NextHopAddressType != nil -} - -func (obj *bgpV6RouteRange) SetNextHopAddressType(value BgpV6RouteRangeNextHopAddressTypeEnum) BgpV6RouteRange { - intValue, ok := otg.BgpV6RouteRange_NextHopAddressType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpV6RouteRangeNextHopAddressTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpV6RouteRange_NextHopAddressType_Enum(intValue) - obj.obj.NextHopAddressType = &enumValue - - return obj -} - -// The IPv4 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. -// NextHopIpv4Address returns a string -func (obj *bgpV6RouteRange) NextHopIpv4Address() string { - - return *obj.obj.NextHopIpv4Address - -} - -// The IPv4 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. -// NextHopIpv4Address returns a string -func (obj *bgpV6RouteRange) HasNextHopIpv4Address() bool { - return obj.obj.NextHopIpv4Address != nil -} - -// The IPv4 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability should be enabled. -// SetNextHopIpv4Address sets the string value in the BgpV6RouteRange object -func (obj *bgpV6RouteRange) SetNextHopIpv4Address(value string) BgpV6RouteRange { - - obj.obj.NextHopIpv4Address = &value - return obj -} - -// The IPv6 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv6. -// NextHopIpv6Address returns a string -func (obj *bgpV6RouteRange) NextHopIpv6Address() string { - - return *obj.obj.NextHopIpv6Address - -} - -// The IPv6 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv6. -// NextHopIpv6Address returns a string -func (obj *bgpV6RouteRange) HasNextHopIpv6Address() bool { - return obj.obj.NextHopIpv6Address != nil -} - -// The IPv6 address of the next hop if the Nexthop Mode is manual and the Nexthop type is IPv6. -// SetNextHopIpv6Address sets the string value in the BgpV6RouteRange object -func (obj *bgpV6RouteRange) SetNextHopIpv6Address(value string) BgpV6RouteRange { - - obj.obj.NextHopIpv6Address = &value - return obj -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpV6RouteRange) Advanced() BgpRouteAdvanced { - if obj.obj.Advanced == nil { - obj.obj.Advanced = NewBgpRouteAdvanced().msg() - } - if obj.advancedHolder == nil { - obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} - } - return obj.advancedHolder -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpV6RouteRange) HasAdvanced() bool { - return obj.obj.Advanced != nil -} - -// description is TBD -// SetAdvanced sets the BgpRouteAdvanced value in the BgpV6RouteRange object -func (obj *bgpV6RouteRange) SetAdvanced(value BgpRouteAdvanced) BgpV6RouteRange { - - obj.advancedHolder = nil - obj.obj.Advanced = value.msg() - - return obj -} - -// Optional community settings. -// Communities returns a []BgpCommunity -func (obj *bgpV6RouteRange) Communities() BgpV6RouteRangeBgpCommunityIter { - if len(obj.obj.Communities) == 0 { - obj.obj.Communities = []*otg.BgpCommunity{} - } - if obj.communitiesHolder == nil { - obj.communitiesHolder = newBgpV6RouteRangeBgpCommunityIter(&obj.obj.Communities).setMsg(obj) - } - return obj.communitiesHolder -} - -type bgpV6RouteRangeBgpCommunityIter struct { - obj *bgpV6RouteRange - bgpCommunitySlice []BgpCommunity - fieldPtr *[]*otg.BgpCommunity -} - -func newBgpV6RouteRangeBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpV6RouteRangeBgpCommunityIter { - return &bgpV6RouteRangeBgpCommunityIter{fieldPtr: ptr} -} - -type BgpV6RouteRangeBgpCommunityIter interface { - setMsg(*bgpV6RouteRange) BgpV6RouteRangeBgpCommunityIter - Items() []BgpCommunity - Add() BgpCommunity - Append(items ...BgpCommunity) BgpV6RouteRangeBgpCommunityIter - Set(index int, newObj BgpCommunity) BgpV6RouteRangeBgpCommunityIter - Clear() BgpV6RouteRangeBgpCommunityIter - clearHolderSlice() BgpV6RouteRangeBgpCommunityIter - appendHolderSlice(item BgpCommunity) BgpV6RouteRangeBgpCommunityIter -} - -func (obj *bgpV6RouteRangeBgpCommunityIter) setMsg(msg *bgpV6RouteRange) BgpV6RouteRangeBgpCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6RouteRangeBgpCommunityIter) Items() []BgpCommunity { - return obj.bgpCommunitySlice -} - -func (obj *bgpV6RouteRangeBgpCommunityIter) Add() BgpCommunity { - newObj := &otg.BgpCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6RouteRangeBgpCommunityIter) Append(items ...BgpCommunity) BgpV6RouteRangeBgpCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - } - return obj -} - -func (obj *bgpV6RouteRangeBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpV6RouteRangeBgpCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpCommunitySlice[index] = newObj - return obj -} -func (obj *bgpV6RouteRangeBgpCommunityIter) Clear() BgpV6RouteRangeBgpCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpCommunity{} - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpV6RouteRangeBgpCommunityIter) clearHolderSlice() BgpV6RouteRangeBgpCommunityIter { - if len(obj.bgpCommunitySlice) > 0 { - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpV6RouteRangeBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpV6RouteRangeBgpCommunityIter { - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - return obj -} - -// description is TBD -// AsPath returns a BgpAsPath -func (obj *bgpV6RouteRange) AsPath() BgpAsPath { - if obj.obj.AsPath == nil { - obj.obj.AsPath = NewBgpAsPath().msg() - } - if obj.asPathHolder == nil { - obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} - } - return obj.asPathHolder -} - -// description is TBD -// AsPath returns a BgpAsPath -func (obj *bgpV6RouteRange) HasAsPath() bool { - return obj.obj.AsPath != nil -} - -// description is TBD -// SetAsPath sets the BgpAsPath value in the BgpV6RouteRange object -func (obj *bgpV6RouteRange) SetAsPath(value BgpAsPath) BgpV6RouteRange { - - obj.asPathHolder = nil - obj.obj.AsPath = value.msg() - - return obj -} - -// description is TBD -// AddPath returns a BgpAddPath -func (obj *bgpV6RouteRange) AddPath() BgpAddPath { - if obj.obj.AddPath == nil { - obj.obj.AddPath = NewBgpAddPath().msg() - } - if obj.addPathHolder == nil { - obj.addPathHolder = &bgpAddPath{obj: obj.obj.AddPath} - } - return obj.addPathHolder -} - -// description is TBD -// AddPath returns a BgpAddPath -func (obj *bgpV6RouteRange) HasAddPath() bool { - return obj.obj.AddPath != nil -} - -// description is TBD -// SetAddPath sets the BgpAddPath value in the BgpV6RouteRange object -func (obj *bgpV6RouteRange) SetAddPath(value BgpAddPath) BgpV6RouteRange { - - obj.addPathHolder = nil - obj.obj.AddPath = value.msg() - - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *bgpV6RouteRange) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the BgpV6RouteRange object -func (obj *bgpV6RouteRange) SetName(value string) BgpV6RouteRange { - - obj.obj.Name = &value - return obj -} - -// Deprecated: This property is deprecated in favor of property extended_communities -// -// Deprecated: This property is deprecated in favor of property extended_communities -// -// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. Note evpn type is defined mainly for use with evpn route updates and not for IPv4 and IPv6 route updates. -// ExtCommunities returns a []BgpExtCommunity -func (obj *bgpV6RouteRange) ExtCommunities() BgpV6RouteRangeBgpExtCommunityIter { - if len(obj.obj.ExtCommunities) == 0 { - obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} - } - if obj.extCommunitiesHolder == nil { - obj.extCommunitiesHolder = newBgpV6RouteRangeBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) - } - return obj.extCommunitiesHolder -} - -type bgpV6RouteRangeBgpExtCommunityIter struct { - obj *bgpV6RouteRange - bgpExtCommunitySlice []BgpExtCommunity - fieldPtr *[]*otg.BgpExtCommunity -} - -func newBgpV6RouteRangeBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpV6RouteRangeBgpExtCommunityIter { - return &bgpV6RouteRangeBgpExtCommunityIter{fieldPtr: ptr} -} - -type BgpV6RouteRangeBgpExtCommunityIter interface { - setMsg(*bgpV6RouteRange) BgpV6RouteRangeBgpExtCommunityIter - Items() []BgpExtCommunity - Add() BgpExtCommunity - Append(items ...BgpExtCommunity) BgpV6RouteRangeBgpExtCommunityIter - Set(index int, newObj BgpExtCommunity) BgpV6RouteRangeBgpExtCommunityIter - Clear() BgpV6RouteRangeBgpExtCommunityIter - clearHolderSlice() BgpV6RouteRangeBgpExtCommunityIter - appendHolderSlice(item BgpExtCommunity) BgpV6RouteRangeBgpExtCommunityIter -} - -func (obj *bgpV6RouteRangeBgpExtCommunityIter) setMsg(msg *bgpV6RouteRange) BgpV6RouteRangeBgpExtCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpExtCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6RouteRangeBgpExtCommunityIter) Items() []BgpExtCommunity { - return obj.bgpExtCommunitySlice -} - -func (obj *bgpV6RouteRangeBgpExtCommunityIter) Add() BgpExtCommunity { - newObj := &otg.BgpExtCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpExtCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6RouteRangeBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpV6RouteRangeBgpExtCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - } - return obj -} - -func (obj *bgpV6RouteRangeBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpV6RouteRangeBgpExtCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpExtCommunitySlice[index] = newObj - return obj -} -func (obj *bgpV6RouteRangeBgpExtCommunityIter) Clear() BgpV6RouteRangeBgpExtCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpExtCommunity{} - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpV6RouteRangeBgpExtCommunityIter) clearHolderSlice() BgpV6RouteRangeBgpExtCommunityIter { - if len(obj.bgpExtCommunitySlice) > 0 { - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpV6RouteRangeBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpV6RouteRangeBgpExtCommunityIter { - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - return obj -} - -// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an eight byte value. It is divided into two main parts. The first two bytes of the community encode a type and sub-type fields and the last six bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. -// ExtendedCommunities returns a []BgpExtendedCommunity -func (obj *bgpV6RouteRange) ExtendedCommunities() BgpV6RouteRangeBgpExtendedCommunityIter { - if len(obj.obj.ExtendedCommunities) == 0 { - obj.obj.ExtendedCommunities = []*otg.BgpExtendedCommunity{} - } - if obj.extendedCommunitiesHolder == nil { - obj.extendedCommunitiesHolder = newBgpV6RouteRangeBgpExtendedCommunityIter(&obj.obj.ExtendedCommunities).setMsg(obj) - } - return obj.extendedCommunitiesHolder -} - -type bgpV6RouteRangeBgpExtendedCommunityIter struct { - obj *bgpV6RouteRange - bgpExtendedCommunitySlice []BgpExtendedCommunity - fieldPtr *[]*otg.BgpExtendedCommunity -} - -func newBgpV6RouteRangeBgpExtendedCommunityIter(ptr *[]*otg.BgpExtendedCommunity) BgpV6RouteRangeBgpExtendedCommunityIter { - return &bgpV6RouteRangeBgpExtendedCommunityIter{fieldPtr: ptr} -} - -type BgpV6RouteRangeBgpExtendedCommunityIter interface { - setMsg(*bgpV6RouteRange) BgpV6RouteRangeBgpExtendedCommunityIter - Items() []BgpExtendedCommunity - Add() BgpExtendedCommunity - Append(items ...BgpExtendedCommunity) BgpV6RouteRangeBgpExtendedCommunityIter - Set(index int, newObj BgpExtendedCommunity) BgpV6RouteRangeBgpExtendedCommunityIter - Clear() BgpV6RouteRangeBgpExtendedCommunityIter - clearHolderSlice() BgpV6RouteRangeBgpExtendedCommunityIter - appendHolderSlice(item BgpExtendedCommunity) BgpV6RouteRangeBgpExtendedCommunityIter -} - -func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) setMsg(msg *bgpV6RouteRange) BgpV6RouteRangeBgpExtendedCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpExtendedCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) Items() []BgpExtendedCommunity { - return obj.bgpExtendedCommunitySlice -} - -func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) Add() BgpExtendedCommunity { - newObj := &otg.BgpExtendedCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpExtendedCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) Append(items ...BgpExtendedCommunity) BgpV6RouteRangeBgpExtendedCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, item) - } - return obj -} - -func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) Set(index int, newObj BgpExtendedCommunity) BgpV6RouteRangeBgpExtendedCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpExtendedCommunitySlice[index] = newObj - return obj -} -func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) Clear() BgpV6RouteRangeBgpExtendedCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpExtendedCommunity{} - obj.bgpExtendedCommunitySlice = []BgpExtendedCommunity{} - } - return obj -} -func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) clearHolderSlice() BgpV6RouteRangeBgpExtendedCommunityIter { - if len(obj.bgpExtendedCommunitySlice) > 0 { - obj.bgpExtendedCommunitySlice = []BgpExtendedCommunity{} - } - return obj -} -func (obj *bgpV6RouteRangeBgpExtendedCommunityIter) appendHolderSlice(item BgpExtendedCommunity) BgpV6RouteRangeBgpExtendedCommunityIter { - obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, item) - return obj -} - -func (obj *bgpV6RouteRange) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Addresses) != 0 { - - if set_default { - obj.Addresses().clearHolderSlice() - for _, item := range obj.obj.Addresses { - obj.Addresses().appendHolderSlice(&v6RouteAddress{obj: item}) - } - } - for _, item := range obj.Addresses().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.NextHopIpv4Address != nil { - - err := obj.validateIpv4(obj.NextHopIpv4Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV6RouteRange.NextHopIpv4Address")) - } - - } - - if obj.obj.NextHopIpv6Address != nil { - - err := obj.validateIpv6(obj.NextHopIpv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV6RouteRange.NextHopIpv6Address")) - } - - } - - if obj.obj.Advanced != nil { - - obj.Advanced().validateObj(vObj, set_default) - } - - if len(obj.obj.Communities) != 0 { - - if set_default { - obj.Communities().clearHolderSlice() - for _, item := range obj.obj.Communities { - obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) - } - } - for _, item := range obj.Communities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.AsPath != nil { - - obj.AsPath().validateObj(vObj, set_default) - } - - if obj.obj.AddPath != nil { - - obj.AddPath().validateObj(vObj, set_default) - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpV6RouteRange") - } - - if len(obj.obj.ExtCommunities) != 0 { - obj.addWarnings("ExtCommunities property in schema BgpV6RouteRange is deprecated, This property is deprecated in favor of property extended_communities") - - if set_default { - obj.ExtCommunities().clearHolderSlice() - for _, item := range obj.obj.ExtCommunities { - obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) - } - } - for _, item := range obj.ExtCommunities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.ExtendedCommunities) != 0 { - - if set_default { - obj.ExtendedCommunities().clearHolderSlice() - for _, item := range obj.obj.ExtendedCommunities { - obj.ExtendedCommunities().appendHolderSlice(&bgpExtendedCommunity{obj: item}) - } - } - for _, item := range obj.ExtendedCommunities().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpV6RouteRange) setDefault() { - if obj.obj.NextHopMode == nil { - obj.SetNextHopMode(BgpV6RouteRangeNextHopMode.LOCAL_IP) - - } - if obj.obj.NextHopAddressType == nil { - obj.SetNextHopAddressType(BgpV6RouteRangeNextHopAddressType.IPV6) - - } - if obj.obj.NextHopIpv4Address == nil { - obj.SetNextHopIpv4Address("0.0.0.0") - } - if obj.obj.NextHopIpv6Address == nil { - obj.SetNextHopIpv6Address("::0") - } - -} - -// ***** BgpSrteV4Policy ***** -type bgpSrteV4Policy struct { - validation - obj *otg.BgpSrteV4Policy - marshaller marshalBgpSrteV4Policy - unMarshaller unMarshalBgpSrteV4Policy - advancedHolder BgpRouteAdvanced - addPathHolder BgpAddPath - asPathHolder BgpAsPath - communitiesHolder BgpSrteV4PolicyBgpCommunityIter - extCommunitiesHolder BgpSrteV4PolicyBgpExtCommunityIter - tunnelTlvsHolder BgpSrteV4PolicyBgpSrteV4TunnelTlvIter -} - -func NewBgpSrteV4Policy() BgpSrteV4Policy { - obj := bgpSrteV4Policy{obj: &otg.BgpSrteV4Policy{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteV4Policy) msg() *otg.BgpSrteV4Policy { - return obj.obj -} - -func (obj *bgpSrteV4Policy) setMsg(msg *otg.BgpSrteV4Policy) BgpSrteV4Policy { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteV4Policy struct { - obj *bgpSrteV4Policy -} - -type marshalBgpSrteV4Policy interface { - // ToProto marshals BgpSrteV4Policy to protobuf object *otg.BgpSrteV4Policy - ToProto() (*otg.BgpSrteV4Policy, error) - // ToPbText marshals BgpSrteV4Policy to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteV4Policy to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteV4Policy to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteV4Policy struct { - obj *bgpSrteV4Policy -} - -type unMarshalBgpSrteV4Policy interface { - // FromProto unmarshals BgpSrteV4Policy from protobuf object *otg.BgpSrteV4Policy - FromProto(msg *otg.BgpSrteV4Policy) (BgpSrteV4Policy, error) - // FromPbText unmarshals BgpSrteV4Policy from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteV4Policy from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteV4Policy from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteV4Policy) Marshal() marshalBgpSrteV4Policy { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteV4Policy{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteV4Policy) Unmarshal() unMarshalBgpSrteV4Policy { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteV4Policy{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteV4Policy) ToProto() (*otg.BgpSrteV4Policy, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteV4Policy) FromProto(msg *otg.BgpSrteV4Policy) (BgpSrteV4Policy, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteV4Policy) 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 *unMarshalbgpSrteV4Policy) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteV4Policy) 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 *unMarshalbgpSrteV4Policy) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteV4Policy) 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 *unMarshalbgpSrteV4Policy) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteV4Policy) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteV4Policy) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteV4Policy) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteV4Policy) Clone() (BgpSrteV4Policy, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteV4Policy() - 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 -} - -func (obj *bgpSrteV4Policy) setNil() { - obj.advancedHolder = nil - obj.addPathHolder = nil - obj.asPathHolder = nil - obj.communitiesHolder = nil - obj.extCommunitiesHolder = nil - obj.tunnelTlvsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteV4Policy is configuration for BGP Segment Routing Traffic Engineering(SRTE) -// policy. - -type BgpSrteV4Policy interface { - Validation - // msg marshals BgpSrteV4Policy to protobuf object *otg.BgpSrteV4Policy - // and doesn't set defaults - msg() *otg.BgpSrteV4Policy - // setMsg unmarshals BgpSrteV4Policy from protobuf object *otg.BgpSrteV4Policy - // and doesn't set defaults - setMsg(*otg.BgpSrteV4Policy) BgpSrteV4Policy - // provides marshal interface - Marshal() marshalBgpSrteV4Policy - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteV4Policy - // validate validates BgpSrteV4Policy - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteV4Policy, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Distinguisher returns uint32, set in BgpSrteV4Policy. - Distinguisher() uint32 - // SetDistinguisher assigns uint32 provided by user to BgpSrteV4Policy - SetDistinguisher(value uint32) BgpSrteV4Policy - // HasDistinguisher checks if Distinguisher has been set in BgpSrteV4Policy - HasDistinguisher() bool - // Color returns uint32, set in BgpSrteV4Policy. - Color() uint32 - // SetColor assigns uint32 provided by user to BgpSrteV4Policy - SetColor(value uint32) BgpSrteV4Policy - // HasColor checks if Color has been set in BgpSrteV4Policy - HasColor() bool - // Ipv4Endpoint returns string, set in BgpSrteV4Policy. - Ipv4Endpoint() string - // SetIpv4Endpoint assigns string provided by user to BgpSrteV4Policy - SetIpv4Endpoint(value string) BgpSrteV4Policy - // NextHopMode returns BgpSrteV4PolicyNextHopModeEnum, set in BgpSrteV4Policy - NextHopMode() BgpSrteV4PolicyNextHopModeEnum - // SetNextHopMode assigns BgpSrteV4PolicyNextHopModeEnum provided by user to BgpSrteV4Policy - SetNextHopMode(value BgpSrteV4PolicyNextHopModeEnum) BgpSrteV4Policy - // HasNextHopMode checks if NextHopMode has been set in BgpSrteV4Policy - HasNextHopMode() bool - // NextHopAddressType returns BgpSrteV4PolicyNextHopAddressTypeEnum, set in BgpSrteV4Policy - NextHopAddressType() BgpSrteV4PolicyNextHopAddressTypeEnum - // SetNextHopAddressType assigns BgpSrteV4PolicyNextHopAddressTypeEnum provided by user to BgpSrteV4Policy - SetNextHopAddressType(value BgpSrteV4PolicyNextHopAddressTypeEnum) BgpSrteV4Policy - // HasNextHopAddressType checks if NextHopAddressType has been set in BgpSrteV4Policy - HasNextHopAddressType() bool - // NextHopIpv4Address returns string, set in BgpSrteV4Policy. - NextHopIpv4Address() string - // SetNextHopIpv4Address assigns string provided by user to BgpSrteV4Policy - SetNextHopIpv4Address(value string) BgpSrteV4Policy - // HasNextHopIpv4Address checks if NextHopIpv4Address has been set in BgpSrteV4Policy - HasNextHopIpv4Address() bool - // NextHopIpv6Address returns string, set in BgpSrteV4Policy. - NextHopIpv6Address() string - // SetNextHopIpv6Address assigns string provided by user to BgpSrteV4Policy - SetNextHopIpv6Address(value string) BgpSrteV4Policy - // HasNextHopIpv6Address checks if NextHopIpv6Address has been set in BgpSrteV4Policy - HasNextHopIpv6Address() bool - // Advanced returns BgpRouteAdvanced, set in BgpSrteV4Policy. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - Advanced() BgpRouteAdvanced - // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpSrteV4Policy. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - SetAdvanced(value BgpRouteAdvanced) BgpSrteV4Policy - // HasAdvanced checks if Advanced has been set in BgpSrteV4Policy - HasAdvanced() bool - // AddPath returns BgpAddPath, set in BgpSrteV4Policy. - // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. - AddPath() BgpAddPath - // SetAddPath assigns BgpAddPath provided by user to BgpSrteV4Policy. - // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. - SetAddPath(value BgpAddPath) BgpSrteV4Policy - // HasAddPath checks if AddPath has been set in BgpSrteV4Policy - HasAddPath() bool - // AsPath returns BgpAsPath, set in BgpSrteV4Policy. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - AsPath() BgpAsPath - // SetAsPath assigns BgpAsPath provided by user to BgpSrteV4Policy. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - SetAsPath(value BgpAsPath) BgpSrteV4Policy - // HasAsPath checks if AsPath has been set in BgpSrteV4Policy - HasAsPath() bool - // Communities returns BgpSrteV4PolicyBgpCommunityIterIter, set in BgpSrteV4Policy - Communities() BgpSrteV4PolicyBgpCommunityIter - // ExtCommunities returns BgpSrteV4PolicyBgpExtCommunityIterIter, set in BgpSrteV4Policy - ExtCommunities() BgpSrteV4PolicyBgpExtCommunityIter - // TunnelTlvs returns BgpSrteV4PolicyBgpSrteV4TunnelTlvIterIter, set in BgpSrteV4Policy - TunnelTlvs() BgpSrteV4PolicyBgpSrteV4TunnelTlvIter - // Name returns string, set in BgpSrteV4Policy. - Name() string - // SetName assigns string provided by user to BgpSrteV4Policy - SetName(value string) BgpSrteV4Policy - // Active returns bool, set in BgpSrteV4Policy. - Active() bool - // SetActive assigns bool provided by user to BgpSrteV4Policy - SetActive(value bool) BgpSrteV4Policy - // HasActive checks if Active has been set in BgpSrteV4Policy - HasActive() bool - setNil() -} - -// 4-octet value uniquely identifying the policy in the context of (color, endpoint) tuple. It is used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment list) with the same Color and Endpoint but meant for different head-ends. -// Distinguisher returns a uint32 -func (obj *bgpSrteV4Policy) Distinguisher() uint32 { - - return *obj.obj.Distinguisher - -} - -// 4-octet value uniquely identifying the policy in the context of (color, endpoint) tuple. It is used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment list) with the same Color and Endpoint but meant for different head-ends. -// Distinguisher returns a uint32 -func (obj *bgpSrteV4Policy) HasDistinguisher() bool { - return obj.obj.Distinguisher != nil -} - -// 4-octet value uniquely identifying the policy in the context of (color, endpoint) tuple. It is used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment list) with the same Color and Endpoint but meant for different head-ends. -// SetDistinguisher sets the uint32 value in the BgpSrteV4Policy object -func (obj *bgpSrteV4Policy) SetDistinguisher(value uint32) BgpSrteV4Policy { - - obj.obj.Distinguisher = &value - return obj -} - -// Policy color is used to match the color of the destination prefixes to steer traffic into the SR Policy. -// Color returns a uint32 -func (obj *bgpSrteV4Policy) Color() uint32 { - - return *obj.obj.Color - -} - -// Policy color is used to match the color of the destination prefixes to steer traffic into the SR Policy. -// Color returns a uint32 -func (obj *bgpSrteV4Policy) HasColor() bool { - return obj.obj.Color != nil -} - -// Policy color is used to match the color of the destination prefixes to steer traffic into the SR Policy. -// SetColor sets the uint32 value in the BgpSrteV4Policy object -func (obj *bgpSrteV4Policy) SetColor(value uint32) BgpSrteV4Policy { - - obj.obj.Color = &value - return obj -} - -// Specifies a single node or a set of nodes (e.g. an anycast address). It is selected on the basis of the SR Policy type (AFI). -// Ipv4Endpoint returns a string -func (obj *bgpSrteV4Policy) Ipv4Endpoint() string { - - return *obj.obj.Ipv4Endpoint - -} - -// Specifies a single node or a set of nodes (e.g. an anycast address). It is selected on the basis of the SR Policy type (AFI). -// SetIpv4Endpoint sets the string value in the BgpSrteV4Policy object -func (obj *bgpSrteV4Policy) SetIpv4Endpoint(value string) BgpSrteV4Policy { - - obj.obj.Ipv4Endpoint = &value - return obj -} - -type BgpSrteV4PolicyNextHopModeEnum string - -// Enum of NextHopMode on BgpSrteV4Policy -var BgpSrteV4PolicyNextHopMode = struct { - LOCAL_IP BgpSrteV4PolicyNextHopModeEnum - MANUAL BgpSrteV4PolicyNextHopModeEnum -}{ - LOCAL_IP: BgpSrteV4PolicyNextHopModeEnum("local_ip"), - MANUAL: BgpSrteV4PolicyNextHopModeEnum("manual"), -} - -func (obj *bgpSrteV4Policy) NextHopMode() BgpSrteV4PolicyNextHopModeEnum { - return BgpSrteV4PolicyNextHopModeEnum(obj.obj.NextHopMode.Enum().String()) -} - -// Mode for choosing the NextHop in MP REACH NLRI. Available modes are : Local IP: Automatically fills the Nexthop with the Local IP of the BGP peer. For IPv6 BGP peer the Nexthop Encoding capability should be enabled. Manual: Override the Nexthop with any arbitrary IPv4/IPv6 address. -// NextHopMode returns a string -func (obj *bgpSrteV4Policy) HasNextHopMode() bool { - return obj.obj.NextHopMode != nil -} - -func (obj *bgpSrteV4Policy) SetNextHopMode(value BgpSrteV4PolicyNextHopModeEnum) BgpSrteV4Policy { - intValue, ok := otg.BgpSrteV4Policy_NextHopMode_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpSrteV4PolicyNextHopModeEnum", string(value))) - return obj - } - enumValue := otg.BgpSrteV4Policy_NextHopMode_Enum(intValue) - obj.obj.NextHopMode = &enumValue - - return obj -} - -type BgpSrteV4PolicyNextHopAddressTypeEnum string - -// Enum of NextHopAddressType on BgpSrteV4Policy -var BgpSrteV4PolicyNextHopAddressType = struct { - IPV4 BgpSrteV4PolicyNextHopAddressTypeEnum - IPV6 BgpSrteV4PolicyNextHopAddressTypeEnum -}{ - IPV4: BgpSrteV4PolicyNextHopAddressTypeEnum("ipv4"), - IPV6: BgpSrteV4PolicyNextHopAddressTypeEnum("ipv6"), -} - -func (obj *bgpSrteV4Policy) NextHopAddressType() BgpSrteV4PolicyNextHopAddressTypeEnum { - return BgpSrteV4PolicyNextHopAddressTypeEnum(obj.obj.NextHopAddressType.Enum().String()) -} - -// Type of next hop IP address to be used when 'next_hop_mode' is set to 'manual'. -// NextHopAddressType returns a string -func (obj *bgpSrteV4Policy) HasNextHopAddressType() bool { - return obj.obj.NextHopAddressType != nil -} - -func (obj *bgpSrteV4Policy) SetNextHopAddressType(value BgpSrteV4PolicyNextHopAddressTypeEnum) BgpSrteV4Policy { - intValue, ok := otg.BgpSrteV4Policy_NextHopAddressType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpSrteV4PolicyNextHopAddressTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpSrteV4Policy_NextHopAddressType_Enum(intValue) - obj.obj.NextHopAddressType = &enumValue - - return obj -} - -// The IPv4 address of the next hop if the Nexthop type 'next_hop_mode' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability extended_next_hop_encoding should be enabled. -// NextHopIpv4Address returns a string -func (obj *bgpSrteV4Policy) NextHopIpv4Address() string { - - return *obj.obj.NextHopIpv4Address - -} - -// The IPv4 address of the next hop if the Nexthop type 'next_hop_mode' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability extended_next_hop_encoding should be enabled. -// NextHopIpv4Address returns a string -func (obj *bgpSrteV4Policy) HasNextHopIpv4Address() bool { - return obj.obj.NextHopIpv4Address != nil -} - -// The IPv4 address of the next hop if the Nexthop type 'next_hop_mode' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability extended_next_hop_encoding should be enabled. -// SetNextHopIpv4Address sets the string value in the BgpSrteV4Policy object -func (obj *bgpSrteV4Policy) SetNextHopIpv4Address(value string) BgpSrteV4Policy { - - obj.obj.NextHopIpv4Address = &value - return obj -} - -// The IPv6 address of the next hop if the Nexthop Mode 'next_hop_address_type' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv6. -// NextHopIpv6Address returns a string -func (obj *bgpSrteV4Policy) NextHopIpv6Address() string { - - return *obj.obj.NextHopIpv6Address - -} - -// The IPv6 address of the next hop if the Nexthop Mode 'next_hop_address_type' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv6. -// NextHopIpv6Address returns a string -func (obj *bgpSrteV4Policy) HasNextHopIpv6Address() bool { - return obj.obj.NextHopIpv6Address != nil -} - -// The IPv6 address of the next hop if the Nexthop Mode 'next_hop_address_type' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv6. -// SetNextHopIpv6Address sets the string value in the BgpSrteV4Policy object -func (obj *bgpSrteV4Policy) SetNextHopIpv6Address(value string) BgpSrteV4Policy { - - obj.obj.NextHopIpv6Address = &value - return obj -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpSrteV4Policy) Advanced() BgpRouteAdvanced { - if obj.obj.Advanced == nil { - obj.obj.Advanced = NewBgpRouteAdvanced().msg() - } - if obj.advancedHolder == nil { - obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} - } - return obj.advancedHolder -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpSrteV4Policy) HasAdvanced() bool { - return obj.obj.Advanced != nil -} - -// description is TBD -// SetAdvanced sets the BgpRouteAdvanced value in the BgpSrteV4Policy object -func (obj *bgpSrteV4Policy) SetAdvanced(value BgpRouteAdvanced) BgpSrteV4Policy { - - obj.advancedHolder = nil - obj.obj.Advanced = value.msg() - - return obj -} - -// description is TBD -// AddPath returns a BgpAddPath -func (obj *bgpSrteV4Policy) AddPath() BgpAddPath { - if obj.obj.AddPath == nil { - obj.obj.AddPath = NewBgpAddPath().msg() - } - if obj.addPathHolder == nil { - obj.addPathHolder = &bgpAddPath{obj: obj.obj.AddPath} - } - return obj.addPathHolder -} - -// description is TBD -// AddPath returns a BgpAddPath -func (obj *bgpSrteV4Policy) HasAddPath() bool { - return obj.obj.AddPath != nil -} - -// description is TBD -// SetAddPath sets the BgpAddPath value in the BgpSrteV4Policy object -func (obj *bgpSrteV4Policy) SetAddPath(value BgpAddPath) BgpSrteV4Policy { - - obj.addPathHolder = nil - obj.obj.AddPath = value.msg() - - return obj -} - -// description is TBD -// AsPath returns a BgpAsPath -func (obj *bgpSrteV4Policy) AsPath() BgpAsPath { - if obj.obj.AsPath == nil { - obj.obj.AsPath = NewBgpAsPath().msg() - } - if obj.asPathHolder == nil { - obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} - } - return obj.asPathHolder -} - -// description is TBD -// AsPath returns a BgpAsPath -func (obj *bgpSrteV4Policy) HasAsPath() bool { - return obj.obj.AsPath != nil -} - -// description is TBD -// SetAsPath sets the BgpAsPath value in the BgpSrteV4Policy object -func (obj *bgpSrteV4Policy) SetAsPath(value BgpAsPath) BgpSrteV4Policy { - - obj.asPathHolder = nil - obj.obj.AsPath = value.msg() - - return obj -} - -// Optional Community settings. -// Communities returns a []BgpCommunity -func (obj *bgpSrteV4Policy) Communities() BgpSrteV4PolicyBgpCommunityIter { - if len(obj.obj.Communities) == 0 { - obj.obj.Communities = []*otg.BgpCommunity{} - } - if obj.communitiesHolder == nil { - obj.communitiesHolder = newBgpSrteV4PolicyBgpCommunityIter(&obj.obj.Communities).setMsg(obj) - } - return obj.communitiesHolder -} - -type bgpSrteV4PolicyBgpCommunityIter struct { - obj *bgpSrteV4Policy - bgpCommunitySlice []BgpCommunity - fieldPtr *[]*otg.BgpCommunity -} - -func newBgpSrteV4PolicyBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpSrteV4PolicyBgpCommunityIter { - return &bgpSrteV4PolicyBgpCommunityIter{fieldPtr: ptr} -} - -type BgpSrteV4PolicyBgpCommunityIter interface { - setMsg(*bgpSrteV4Policy) BgpSrteV4PolicyBgpCommunityIter - Items() []BgpCommunity - Add() BgpCommunity - Append(items ...BgpCommunity) BgpSrteV4PolicyBgpCommunityIter - Set(index int, newObj BgpCommunity) BgpSrteV4PolicyBgpCommunityIter - Clear() BgpSrteV4PolicyBgpCommunityIter - clearHolderSlice() BgpSrteV4PolicyBgpCommunityIter - appendHolderSlice(item BgpCommunity) BgpSrteV4PolicyBgpCommunityIter -} - -func (obj *bgpSrteV4PolicyBgpCommunityIter) setMsg(msg *bgpSrteV4Policy) BgpSrteV4PolicyBgpCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpSrteV4PolicyBgpCommunityIter) Items() []BgpCommunity { - return obj.bgpCommunitySlice -} - -func (obj *bgpSrteV4PolicyBgpCommunityIter) Add() BgpCommunity { - newObj := &otg.BgpCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpSrteV4PolicyBgpCommunityIter) Append(items ...BgpCommunity) BgpSrteV4PolicyBgpCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - } - return obj -} - -func (obj *bgpSrteV4PolicyBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpSrteV4PolicyBgpCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpCommunitySlice[index] = newObj - return obj -} -func (obj *bgpSrteV4PolicyBgpCommunityIter) Clear() BgpSrteV4PolicyBgpCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpCommunity{} - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpSrteV4PolicyBgpCommunityIter) clearHolderSlice() BgpSrteV4PolicyBgpCommunityIter { - if len(obj.bgpCommunitySlice) > 0 { - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpSrteV4PolicyBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpSrteV4PolicyBgpCommunityIter { - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - return obj -} - -// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. -// ExtCommunities returns a []BgpExtCommunity -func (obj *bgpSrteV4Policy) ExtCommunities() BgpSrteV4PolicyBgpExtCommunityIter { - if len(obj.obj.ExtCommunities) == 0 { - obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} - } - if obj.extCommunitiesHolder == nil { - obj.extCommunitiesHolder = newBgpSrteV4PolicyBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) - } - return obj.extCommunitiesHolder -} - -type bgpSrteV4PolicyBgpExtCommunityIter struct { - obj *bgpSrteV4Policy - bgpExtCommunitySlice []BgpExtCommunity - fieldPtr *[]*otg.BgpExtCommunity -} - -func newBgpSrteV4PolicyBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpSrteV4PolicyBgpExtCommunityIter { - return &bgpSrteV4PolicyBgpExtCommunityIter{fieldPtr: ptr} -} - -type BgpSrteV4PolicyBgpExtCommunityIter interface { - setMsg(*bgpSrteV4Policy) BgpSrteV4PolicyBgpExtCommunityIter - Items() []BgpExtCommunity - Add() BgpExtCommunity - Append(items ...BgpExtCommunity) BgpSrteV4PolicyBgpExtCommunityIter - Set(index int, newObj BgpExtCommunity) BgpSrteV4PolicyBgpExtCommunityIter - Clear() BgpSrteV4PolicyBgpExtCommunityIter - clearHolderSlice() BgpSrteV4PolicyBgpExtCommunityIter - appendHolderSlice(item BgpExtCommunity) BgpSrteV4PolicyBgpExtCommunityIter -} - -func (obj *bgpSrteV4PolicyBgpExtCommunityIter) setMsg(msg *bgpSrteV4Policy) BgpSrteV4PolicyBgpExtCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpExtCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpSrteV4PolicyBgpExtCommunityIter) Items() []BgpExtCommunity { - return obj.bgpExtCommunitySlice -} - -func (obj *bgpSrteV4PolicyBgpExtCommunityIter) Add() BgpExtCommunity { - newObj := &otg.BgpExtCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpExtCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpSrteV4PolicyBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpSrteV4PolicyBgpExtCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - } - return obj -} - -func (obj *bgpSrteV4PolicyBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpSrteV4PolicyBgpExtCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpExtCommunitySlice[index] = newObj - return obj -} -func (obj *bgpSrteV4PolicyBgpExtCommunityIter) Clear() BgpSrteV4PolicyBgpExtCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpExtCommunity{} - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpSrteV4PolicyBgpExtCommunityIter) clearHolderSlice() BgpSrteV4PolicyBgpExtCommunityIter { - if len(obj.bgpExtCommunitySlice) > 0 { - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpSrteV4PolicyBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpSrteV4PolicyBgpExtCommunityIter { - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - return obj -} - -// List Tunnel Encapsulation Attributes. -// TunnelTlvs returns a []BgpSrteV4TunnelTlv -func (obj *bgpSrteV4Policy) TunnelTlvs() BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { - if len(obj.obj.TunnelTlvs) == 0 { - obj.obj.TunnelTlvs = []*otg.BgpSrteV4TunnelTlv{} - } - if obj.tunnelTlvsHolder == nil { - obj.tunnelTlvsHolder = newBgpSrteV4PolicyBgpSrteV4TunnelTlvIter(&obj.obj.TunnelTlvs).setMsg(obj) - } - return obj.tunnelTlvsHolder -} - -type bgpSrteV4PolicyBgpSrteV4TunnelTlvIter struct { - obj *bgpSrteV4Policy - bgpSrteV4TunnelTlvSlice []BgpSrteV4TunnelTlv - fieldPtr *[]*otg.BgpSrteV4TunnelTlv -} - -func newBgpSrteV4PolicyBgpSrteV4TunnelTlvIter(ptr *[]*otg.BgpSrteV4TunnelTlv) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { - return &bgpSrteV4PolicyBgpSrteV4TunnelTlvIter{fieldPtr: ptr} -} - -type BgpSrteV4PolicyBgpSrteV4TunnelTlvIter interface { - setMsg(*bgpSrteV4Policy) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter - Items() []BgpSrteV4TunnelTlv - Add() BgpSrteV4TunnelTlv - Append(items ...BgpSrteV4TunnelTlv) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter - Set(index int, newObj BgpSrteV4TunnelTlv) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter - Clear() BgpSrteV4PolicyBgpSrteV4TunnelTlvIter - clearHolderSlice() BgpSrteV4PolicyBgpSrteV4TunnelTlvIter - appendHolderSlice(item BgpSrteV4TunnelTlv) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter -} - -func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) setMsg(msg *bgpSrteV4Policy) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpSrteV4TunnelTlv{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) Items() []BgpSrteV4TunnelTlv { - return obj.bgpSrteV4TunnelTlvSlice -} - -func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) Add() BgpSrteV4TunnelTlv { - newObj := &otg.BgpSrteV4TunnelTlv{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpSrteV4TunnelTlv{obj: newObj} - newLibObj.setDefault() - obj.bgpSrteV4TunnelTlvSlice = append(obj.bgpSrteV4TunnelTlvSlice, newLibObj) - return newLibObj -} - -func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) Append(items ...BgpSrteV4TunnelTlv) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpSrteV4TunnelTlvSlice = append(obj.bgpSrteV4TunnelTlvSlice, item) - } - return obj -} - -func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) Set(index int, newObj BgpSrteV4TunnelTlv) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpSrteV4TunnelTlvSlice[index] = newObj - return obj -} -func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) Clear() BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpSrteV4TunnelTlv{} - obj.bgpSrteV4TunnelTlvSlice = []BgpSrteV4TunnelTlv{} - } - return obj -} -func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) clearHolderSlice() BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { - if len(obj.bgpSrteV4TunnelTlvSlice) > 0 { - obj.bgpSrteV4TunnelTlvSlice = []BgpSrteV4TunnelTlv{} - } - return obj -} -func (obj *bgpSrteV4PolicyBgpSrteV4TunnelTlvIter) appendHolderSlice(item BgpSrteV4TunnelTlv) BgpSrteV4PolicyBgpSrteV4TunnelTlvIter { - obj.bgpSrteV4TunnelTlvSlice = append(obj.bgpSrteV4TunnelTlvSlice, item) - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *bgpSrteV4Policy) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the BgpSrteV4Policy object -func (obj *bgpSrteV4Policy) SetName(value string) BgpSrteV4Policy { - - obj.obj.Name = &value - return obj -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// Active returns a bool -func (obj *bgpSrteV4Policy) Active() bool { - - return *obj.obj.Active - -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// Active returns a bool -func (obj *bgpSrteV4Policy) HasActive() bool { - return obj.obj.Active != nil -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// SetActive sets the bool value in the BgpSrteV4Policy object -func (obj *bgpSrteV4Policy) SetActive(value bool) BgpSrteV4Policy { - - obj.obj.Active = &value - return obj -} - -func (obj *bgpSrteV4Policy) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Ipv4Endpoint is required - if obj.obj.Ipv4Endpoint == nil { - vObj.validationErrors = append(vObj.validationErrors, "Ipv4Endpoint is required field on interface BgpSrteV4Policy") - } - if obj.obj.Ipv4Endpoint != nil { - - err := obj.validateIpv4(obj.Ipv4Endpoint()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteV4Policy.Ipv4Endpoint")) - } - - } - - if obj.obj.NextHopIpv4Address != nil { - - err := obj.validateIpv4(obj.NextHopIpv4Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteV4Policy.NextHopIpv4Address")) - } - - } - - if obj.obj.NextHopIpv6Address != nil { - - err := obj.validateIpv6(obj.NextHopIpv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteV4Policy.NextHopIpv6Address")) - } - - } - - if obj.obj.Advanced != nil { - - obj.Advanced().validateObj(vObj, set_default) - } - - if obj.obj.AddPath != nil { - - obj.AddPath().validateObj(vObj, set_default) - } - - if obj.obj.AsPath != nil { - - obj.AsPath().validateObj(vObj, set_default) - } - - if len(obj.obj.Communities) != 0 { - - if set_default { - obj.Communities().clearHolderSlice() - for _, item := range obj.obj.Communities { - obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) - } - } - for _, item := range obj.Communities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.ExtCommunities) != 0 { - - if set_default { - obj.ExtCommunities().clearHolderSlice() - for _, item := range obj.obj.ExtCommunities { - obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) - } - } - for _, item := range obj.ExtCommunities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.TunnelTlvs) != 0 { - - if set_default { - obj.TunnelTlvs().clearHolderSlice() - for _, item := range obj.obj.TunnelTlvs { - obj.TunnelTlvs().appendHolderSlice(&bgpSrteV4TunnelTlv{obj: item}) - } - } - for _, item := range obj.TunnelTlvs().Items() { - item.validateObj(vObj, set_default) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpSrteV4Policy") - } -} - -func (obj *bgpSrteV4Policy) setDefault() { - if obj.obj.Distinguisher == nil { - obj.SetDistinguisher(1) - } - if obj.obj.Color == nil { - obj.SetColor(100) - } - if obj.obj.NextHopMode == nil { - obj.SetNextHopMode(BgpSrteV4PolicyNextHopMode.LOCAL_IP) - - } - if obj.obj.NextHopAddressType == nil { - obj.SetNextHopAddressType(BgpSrteV4PolicyNextHopAddressType.IPV4) - - } - if obj.obj.Active == nil { - obj.SetActive(true) - } - -} - -// ***** BgpSrteV6Policy ***** -type bgpSrteV6Policy struct { - validation - obj *otg.BgpSrteV6Policy - marshaller marshalBgpSrteV6Policy - unMarshaller unMarshalBgpSrteV6Policy - advancedHolder BgpRouteAdvanced - addPathHolder BgpAddPath - asPathHolder BgpAsPath - communitiesHolder BgpSrteV6PolicyBgpCommunityIter - extcommunitiesHolder BgpSrteV6PolicyBgpExtCommunityIter - tunnelTlvsHolder BgpSrteV6PolicyBgpSrteV6TunnelTlvIter -} - -func NewBgpSrteV6Policy() BgpSrteV6Policy { - obj := bgpSrteV6Policy{obj: &otg.BgpSrteV6Policy{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteV6Policy) msg() *otg.BgpSrteV6Policy { - return obj.obj -} - -func (obj *bgpSrteV6Policy) setMsg(msg *otg.BgpSrteV6Policy) BgpSrteV6Policy { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteV6Policy struct { - obj *bgpSrteV6Policy -} - -type marshalBgpSrteV6Policy interface { - // ToProto marshals BgpSrteV6Policy to protobuf object *otg.BgpSrteV6Policy - ToProto() (*otg.BgpSrteV6Policy, error) - // ToPbText marshals BgpSrteV6Policy to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteV6Policy to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteV6Policy to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteV6Policy struct { - obj *bgpSrteV6Policy -} - -type unMarshalBgpSrteV6Policy interface { - // FromProto unmarshals BgpSrteV6Policy from protobuf object *otg.BgpSrteV6Policy - FromProto(msg *otg.BgpSrteV6Policy) (BgpSrteV6Policy, error) - // FromPbText unmarshals BgpSrteV6Policy from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteV6Policy from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteV6Policy from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteV6Policy) Marshal() marshalBgpSrteV6Policy { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteV6Policy{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteV6Policy) Unmarshal() unMarshalBgpSrteV6Policy { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteV6Policy{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteV6Policy) ToProto() (*otg.BgpSrteV6Policy, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteV6Policy) FromProto(msg *otg.BgpSrteV6Policy) (BgpSrteV6Policy, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteV6Policy) 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 *unMarshalbgpSrteV6Policy) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteV6Policy) 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 *unMarshalbgpSrteV6Policy) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteV6Policy) 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 *unMarshalbgpSrteV6Policy) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteV6Policy) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteV6Policy) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteV6Policy) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteV6Policy) Clone() (BgpSrteV6Policy, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteV6Policy() - 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 -} - -func (obj *bgpSrteV6Policy) setNil() { - obj.advancedHolder = nil - obj.addPathHolder = nil - obj.asPathHolder = nil - obj.communitiesHolder = nil - obj.extcommunitiesHolder = nil - obj.tunnelTlvsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteV6Policy is configuration for BGP Segment Routing Traffic Engineering policy. - -type BgpSrteV6Policy interface { - Validation - // msg marshals BgpSrteV6Policy to protobuf object *otg.BgpSrteV6Policy - // and doesn't set defaults - msg() *otg.BgpSrteV6Policy - // setMsg unmarshals BgpSrteV6Policy from protobuf object *otg.BgpSrteV6Policy - // and doesn't set defaults - setMsg(*otg.BgpSrteV6Policy) BgpSrteV6Policy - // provides marshal interface - Marshal() marshalBgpSrteV6Policy - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteV6Policy - // validate validates BgpSrteV6Policy - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteV6Policy, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Distinguisher returns uint32, set in BgpSrteV6Policy. - Distinguisher() uint32 - // SetDistinguisher assigns uint32 provided by user to BgpSrteV6Policy - SetDistinguisher(value uint32) BgpSrteV6Policy - // HasDistinguisher checks if Distinguisher has been set in BgpSrteV6Policy - HasDistinguisher() bool - // Color returns uint32, set in BgpSrteV6Policy. - Color() uint32 - // SetColor assigns uint32 provided by user to BgpSrteV6Policy - SetColor(value uint32) BgpSrteV6Policy - // HasColor checks if Color has been set in BgpSrteV6Policy - HasColor() bool - // Ipv6Endpoint returns string, set in BgpSrteV6Policy. - Ipv6Endpoint() string - // SetIpv6Endpoint assigns string provided by user to BgpSrteV6Policy - SetIpv6Endpoint(value string) BgpSrteV6Policy - // NextHopMode returns BgpSrteV6PolicyNextHopModeEnum, set in BgpSrteV6Policy - NextHopMode() BgpSrteV6PolicyNextHopModeEnum - // SetNextHopMode assigns BgpSrteV6PolicyNextHopModeEnum provided by user to BgpSrteV6Policy - SetNextHopMode(value BgpSrteV6PolicyNextHopModeEnum) BgpSrteV6Policy - // HasNextHopMode checks if NextHopMode has been set in BgpSrteV6Policy - HasNextHopMode() bool - // NextHopAddressType returns BgpSrteV6PolicyNextHopAddressTypeEnum, set in BgpSrteV6Policy - NextHopAddressType() BgpSrteV6PolicyNextHopAddressTypeEnum - // SetNextHopAddressType assigns BgpSrteV6PolicyNextHopAddressTypeEnum provided by user to BgpSrteV6Policy - SetNextHopAddressType(value BgpSrteV6PolicyNextHopAddressTypeEnum) BgpSrteV6Policy - // HasNextHopAddressType checks if NextHopAddressType has been set in BgpSrteV6Policy - HasNextHopAddressType() bool - // NextHopIpv4Address returns string, set in BgpSrteV6Policy. - NextHopIpv4Address() string - // SetNextHopIpv4Address assigns string provided by user to BgpSrteV6Policy - SetNextHopIpv4Address(value string) BgpSrteV6Policy - // HasNextHopIpv4Address checks if NextHopIpv4Address has been set in BgpSrteV6Policy - HasNextHopIpv4Address() bool - // NextHopIpv6Address returns string, set in BgpSrteV6Policy. - NextHopIpv6Address() string - // SetNextHopIpv6Address assigns string provided by user to BgpSrteV6Policy - SetNextHopIpv6Address(value string) BgpSrteV6Policy - // HasNextHopIpv6Address checks if NextHopIpv6Address has been set in BgpSrteV6Policy - HasNextHopIpv6Address() bool - // Advanced returns BgpRouteAdvanced, set in BgpSrteV6Policy. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - Advanced() BgpRouteAdvanced - // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpSrteV6Policy. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - SetAdvanced(value BgpRouteAdvanced) BgpSrteV6Policy - // HasAdvanced checks if Advanced has been set in BgpSrteV6Policy - HasAdvanced() bool - // AddPath returns BgpAddPath, set in BgpSrteV6Policy. - // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. - AddPath() BgpAddPath - // SetAddPath assigns BgpAddPath provided by user to BgpSrteV6Policy. - // BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. - SetAddPath(value BgpAddPath) BgpSrteV6Policy - // HasAddPath checks if AddPath has been set in BgpSrteV6Policy - HasAddPath() bool - // AsPath returns BgpAsPath, set in BgpSrteV6Policy. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - AsPath() BgpAsPath - // SetAsPath assigns BgpAsPath provided by user to BgpSrteV6Policy. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - SetAsPath(value BgpAsPath) BgpSrteV6Policy - // HasAsPath checks if AsPath has been set in BgpSrteV6Policy - HasAsPath() bool - // Communities returns BgpSrteV6PolicyBgpCommunityIterIter, set in BgpSrteV6Policy - Communities() BgpSrteV6PolicyBgpCommunityIter - // Extcommunities returns BgpSrteV6PolicyBgpExtCommunityIterIter, set in BgpSrteV6Policy - Extcommunities() BgpSrteV6PolicyBgpExtCommunityIter - // TunnelTlvs returns BgpSrteV6PolicyBgpSrteV6TunnelTlvIterIter, set in BgpSrteV6Policy - TunnelTlvs() BgpSrteV6PolicyBgpSrteV6TunnelTlvIter - // Name returns string, set in BgpSrteV6Policy. - Name() string - // SetName assigns string provided by user to BgpSrteV6Policy - SetName(value string) BgpSrteV6Policy - // Active returns bool, set in BgpSrteV6Policy. - Active() bool - // SetActive assigns bool provided by user to BgpSrteV6Policy - SetActive(value bool) BgpSrteV6Policy - // HasActive checks if Active has been set in BgpSrteV6Policy - HasActive() bool - setNil() -} - -// Identifies the policy in the context of (color and endpoint) tuple. It is used by the SR Policy originator to make unique multiple occurrences of the same SR Policy. -// Distinguisher returns a uint32 -func (obj *bgpSrteV6Policy) Distinguisher() uint32 { - - return *obj.obj.Distinguisher - -} - -// Identifies the policy in the context of (color and endpoint) tuple. It is used by the SR Policy originator to make unique multiple occurrences of the same SR Policy. -// Distinguisher returns a uint32 -func (obj *bgpSrteV6Policy) HasDistinguisher() bool { - return obj.obj.Distinguisher != nil -} - -// Identifies the policy in the context of (color and endpoint) tuple. It is used by the SR Policy originator to make unique multiple occurrences of the same SR Policy. -// SetDistinguisher sets the uint32 value in the BgpSrteV6Policy object -func (obj *bgpSrteV6Policy) SetDistinguisher(value uint32) BgpSrteV6Policy { - - obj.obj.Distinguisher = &value - return obj -} - -// Identifies the policy. It is used to match the color of the destination prefixes to steer traffic into the SR Policy. -// Color returns a uint32 -func (obj *bgpSrteV6Policy) Color() uint32 { - - return *obj.obj.Color - -} - -// Identifies the policy. It is used to match the color of the destination prefixes to steer traffic into the SR Policy. -// Color returns a uint32 -func (obj *bgpSrteV6Policy) HasColor() bool { - return obj.obj.Color != nil -} - -// Identifies the policy. It is used to match the color of the destination prefixes to steer traffic into the SR Policy. -// SetColor sets the uint32 value in the BgpSrteV6Policy object -func (obj *bgpSrteV6Policy) SetColor(value uint32) BgpSrteV6Policy { - - obj.obj.Color = &value - return obj -} - -// Specifies a single node or a set of nodes (e.g., an anycast address). It is selected on the basis of the SR Policy type (AFI). -// Ipv6Endpoint returns a string -func (obj *bgpSrteV6Policy) Ipv6Endpoint() string { - - return *obj.obj.Ipv6Endpoint - -} - -// Specifies a single node or a set of nodes (e.g., an anycast address). It is selected on the basis of the SR Policy type (AFI). -// SetIpv6Endpoint sets the string value in the BgpSrteV6Policy object -func (obj *bgpSrteV6Policy) SetIpv6Endpoint(value string) BgpSrteV6Policy { - - obj.obj.Ipv6Endpoint = &value - return obj -} - -type BgpSrteV6PolicyNextHopModeEnum string - -// Enum of NextHopMode on BgpSrteV6Policy -var BgpSrteV6PolicyNextHopMode = struct { - LOCAL_IP BgpSrteV6PolicyNextHopModeEnum - MANUAL BgpSrteV6PolicyNextHopModeEnum -}{ - LOCAL_IP: BgpSrteV6PolicyNextHopModeEnum("local_ip"), - MANUAL: BgpSrteV6PolicyNextHopModeEnum("manual"), -} - -func (obj *bgpSrteV6Policy) NextHopMode() BgpSrteV6PolicyNextHopModeEnum { - return BgpSrteV6PolicyNextHopModeEnum(obj.obj.NextHopMode.Enum().String()) -} - -// Mode for choosing the NextHop in MP REACH NLRI. Available modes are : Local IP: Automatically fills the Nexthop with the Local IP of the BGP peer. For IPv6 BGP peer the Nexthop Encoding capability should be enabled. Manual: Override the Nexthop with any arbitrary IPv4/IPv6 address. -// NextHopMode returns a string -func (obj *bgpSrteV6Policy) HasNextHopMode() bool { - return obj.obj.NextHopMode != nil -} - -func (obj *bgpSrteV6Policy) SetNextHopMode(value BgpSrteV6PolicyNextHopModeEnum) BgpSrteV6Policy { - intValue, ok := otg.BgpSrteV6Policy_NextHopMode_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpSrteV6PolicyNextHopModeEnum", string(value))) - return obj - } - enumValue := otg.BgpSrteV6Policy_NextHopMode_Enum(intValue) - obj.obj.NextHopMode = &enumValue - - return obj -} - -type BgpSrteV6PolicyNextHopAddressTypeEnum string - -// Enum of NextHopAddressType on BgpSrteV6Policy -var BgpSrteV6PolicyNextHopAddressType = struct { - IPV4 BgpSrteV6PolicyNextHopAddressTypeEnum - IPV6 BgpSrteV6PolicyNextHopAddressTypeEnum -}{ - IPV4: BgpSrteV6PolicyNextHopAddressTypeEnum("ipv4"), - IPV6: BgpSrteV6PolicyNextHopAddressTypeEnum("ipv6"), -} - -func (obj *bgpSrteV6Policy) NextHopAddressType() BgpSrteV6PolicyNextHopAddressTypeEnum { - return BgpSrteV6PolicyNextHopAddressTypeEnum(obj.obj.NextHopAddressType.Enum().String()) -} - -// Type of next hop IP address to be used when 'next_hop_mode' is set to 'manual'. -// NextHopAddressType returns a string -func (obj *bgpSrteV6Policy) HasNextHopAddressType() bool { - return obj.obj.NextHopAddressType != nil -} - -func (obj *bgpSrteV6Policy) SetNextHopAddressType(value BgpSrteV6PolicyNextHopAddressTypeEnum) BgpSrteV6Policy { - intValue, ok := otg.BgpSrteV6Policy_NextHopAddressType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpSrteV6PolicyNextHopAddressTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpSrteV6Policy_NextHopAddressType_Enum(intValue) - obj.obj.NextHopAddressType = &enumValue - - return obj -} - -// The IPv4 address of the Nexthop if the 'next_hop_mode' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability extended_next_hop_encoding should be enabled. -// NextHopIpv4Address returns a string -func (obj *bgpSrteV6Policy) NextHopIpv4Address() string { - - return *obj.obj.NextHopIpv4Address - -} - -// The IPv4 address of the Nexthop if the 'next_hop_mode' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability extended_next_hop_encoding should be enabled. -// NextHopIpv4Address returns a string -func (obj *bgpSrteV6Policy) HasNextHopIpv4Address() bool { - return obj.obj.NextHopIpv4Address != nil -} - -// The IPv4 address of the Nexthop if the 'next_hop_mode' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv4. If BGP peer is of type IPv6, Nexthop Encoding capability extended_next_hop_encoding should be enabled. -// SetNextHopIpv4Address sets the string value in the BgpSrteV6Policy object -func (obj *bgpSrteV6Policy) SetNextHopIpv4Address(value string) BgpSrteV6Policy { - - obj.obj.NextHopIpv4Address = &value - return obj -} - -// The IPv6 address of the next hop if the Nexthop Mode 'next_hop_address_type' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv6. -// NextHopIpv6Address returns a string -func (obj *bgpSrteV6Policy) NextHopIpv6Address() string { - - return *obj.obj.NextHopIpv6Address - -} - -// The IPv6 address of the next hop if the Nexthop Mode 'next_hop_address_type' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv6. -// NextHopIpv6Address returns a string -func (obj *bgpSrteV6Policy) HasNextHopIpv6Address() bool { - return obj.obj.NextHopIpv6Address != nil -} - -// The IPv6 address of the next hop if the Nexthop Mode 'next_hop_address_type' is 'manual' and the Nexthop type 'next_hop_address_type' is IPv6. -// SetNextHopIpv6Address sets the string value in the BgpSrteV6Policy object -func (obj *bgpSrteV6Policy) SetNextHopIpv6Address(value string) BgpSrteV6Policy { - - obj.obj.NextHopIpv6Address = &value - return obj -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpSrteV6Policy) Advanced() BgpRouteAdvanced { - if obj.obj.Advanced == nil { - obj.obj.Advanced = NewBgpRouteAdvanced().msg() - } - if obj.advancedHolder == nil { - obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} - } - return obj.advancedHolder -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpSrteV6Policy) HasAdvanced() bool { - return obj.obj.Advanced != nil -} - -// description is TBD -// SetAdvanced sets the BgpRouteAdvanced value in the BgpSrteV6Policy object -func (obj *bgpSrteV6Policy) SetAdvanced(value BgpRouteAdvanced) BgpSrteV6Policy { - - obj.advancedHolder = nil - obj.obj.Advanced = value.msg() - - return obj -} - -// description is TBD -// AddPath returns a BgpAddPath -func (obj *bgpSrteV6Policy) AddPath() BgpAddPath { - if obj.obj.AddPath == nil { - obj.obj.AddPath = NewBgpAddPath().msg() - } - if obj.addPathHolder == nil { - obj.addPathHolder = &bgpAddPath{obj: obj.obj.AddPath} - } - return obj.addPathHolder -} - -// description is TBD -// AddPath returns a BgpAddPath -func (obj *bgpSrteV6Policy) HasAddPath() bool { - return obj.obj.AddPath != nil -} - -// description is TBD -// SetAddPath sets the BgpAddPath value in the BgpSrteV6Policy object -func (obj *bgpSrteV6Policy) SetAddPath(value BgpAddPath) BgpSrteV6Policy { - - obj.addPathHolder = nil - obj.obj.AddPath = value.msg() - - return obj -} - -// description is TBD -// AsPath returns a BgpAsPath -func (obj *bgpSrteV6Policy) AsPath() BgpAsPath { - if obj.obj.AsPath == nil { - obj.obj.AsPath = NewBgpAsPath().msg() - } - if obj.asPathHolder == nil { - obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} - } - return obj.asPathHolder -} - -// description is TBD -// AsPath returns a BgpAsPath -func (obj *bgpSrteV6Policy) HasAsPath() bool { - return obj.obj.AsPath != nil -} - -// description is TBD -// SetAsPath sets the BgpAsPath value in the BgpSrteV6Policy object -func (obj *bgpSrteV6Policy) SetAsPath(value BgpAsPath) BgpSrteV6Policy { - - obj.asPathHolder = nil - obj.obj.AsPath = value.msg() - - return obj -} - -// Optional community settings. -// Communities returns a []BgpCommunity -func (obj *bgpSrteV6Policy) Communities() BgpSrteV6PolicyBgpCommunityIter { - if len(obj.obj.Communities) == 0 { - obj.obj.Communities = []*otg.BgpCommunity{} - } - if obj.communitiesHolder == nil { - obj.communitiesHolder = newBgpSrteV6PolicyBgpCommunityIter(&obj.obj.Communities).setMsg(obj) - } - return obj.communitiesHolder -} - -type bgpSrteV6PolicyBgpCommunityIter struct { - obj *bgpSrteV6Policy - bgpCommunitySlice []BgpCommunity - fieldPtr *[]*otg.BgpCommunity -} - -func newBgpSrteV6PolicyBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpSrteV6PolicyBgpCommunityIter { - return &bgpSrteV6PolicyBgpCommunityIter{fieldPtr: ptr} -} - -type BgpSrteV6PolicyBgpCommunityIter interface { - setMsg(*bgpSrteV6Policy) BgpSrteV6PolicyBgpCommunityIter - Items() []BgpCommunity - Add() BgpCommunity - Append(items ...BgpCommunity) BgpSrteV6PolicyBgpCommunityIter - Set(index int, newObj BgpCommunity) BgpSrteV6PolicyBgpCommunityIter - Clear() BgpSrteV6PolicyBgpCommunityIter - clearHolderSlice() BgpSrteV6PolicyBgpCommunityIter - appendHolderSlice(item BgpCommunity) BgpSrteV6PolicyBgpCommunityIter -} - -func (obj *bgpSrteV6PolicyBgpCommunityIter) setMsg(msg *bgpSrteV6Policy) BgpSrteV6PolicyBgpCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpSrteV6PolicyBgpCommunityIter) Items() []BgpCommunity { - return obj.bgpCommunitySlice -} - -func (obj *bgpSrteV6PolicyBgpCommunityIter) Add() BgpCommunity { - newObj := &otg.BgpCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpSrteV6PolicyBgpCommunityIter) Append(items ...BgpCommunity) BgpSrteV6PolicyBgpCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - } - return obj -} - -func (obj *bgpSrteV6PolicyBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpSrteV6PolicyBgpCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpCommunitySlice[index] = newObj - return obj -} -func (obj *bgpSrteV6PolicyBgpCommunityIter) Clear() BgpSrteV6PolicyBgpCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpCommunity{} - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpSrteV6PolicyBgpCommunityIter) clearHolderSlice() BgpSrteV6PolicyBgpCommunityIter { - if len(obj.bgpCommunitySlice) > 0 { - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpSrteV6PolicyBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpSrteV6PolicyBgpCommunityIter { - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - return obj -} - -// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. -// Extcommunities returns a []BgpExtCommunity -func (obj *bgpSrteV6Policy) Extcommunities() BgpSrteV6PolicyBgpExtCommunityIter { - if len(obj.obj.Extcommunities) == 0 { - obj.obj.Extcommunities = []*otg.BgpExtCommunity{} - } - if obj.extcommunitiesHolder == nil { - obj.extcommunitiesHolder = newBgpSrteV6PolicyBgpExtCommunityIter(&obj.obj.Extcommunities).setMsg(obj) - } - return obj.extcommunitiesHolder -} - -type bgpSrteV6PolicyBgpExtCommunityIter struct { - obj *bgpSrteV6Policy - bgpExtCommunitySlice []BgpExtCommunity - fieldPtr *[]*otg.BgpExtCommunity -} - -func newBgpSrteV6PolicyBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpSrteV6PolicyBgpExtCommunityIter { - return &bgpSrteV6PolicyBgpExtCommunityIter{fieldPtr: ptr} -} - -type BgpSrteV6PolicyBgpExtCommunityIter interface { - setMsg(*bgpSrteV6Policy) BgpSrteV6PolicyBgpExtCommunityIter - Items() []BgpExtCommunity - Add() BgpExtCommunity - Append(items ...BgpExtCommunity) BgpSrteV6PolicyBgpExtCommunityIter - Set(index int, newObj BgpExtCommunity) BgpSrteV6PolicyBgpExtCommunityIter - Clear() BgpSrteV6PolicyBgpExtCommunityIter - clearHolderSlice() BgpSrteV6PolicyBgpExtCommunityIter - appendHolderSlice(item BgpExtCommunity) BgpSrteV6PolicyBgpExtCommunityIter -} - -func (obj *bgpSrteV6PolicyBgpExtCommunityIter) setMsg(msg *bgpSrteV6Policy) BgpSrteV6PolicyBgpExtCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpExtCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpSrteV6PolicyBgpExtCommunityIter) Items() []BgpExtCommunity { - return obj.bgpExtCommunitySlice -} - -func (obj *bgpSrteV6PolicyBgpExtCommunityIter) Add() BgpExtCommunity { - newObj := &otg.BgpExtCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpExtCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpSrteV6PolicyBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpSrteV6PolicyBgpExtCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - } - return obj -} - -func (obj *bgpSrteV6PolicyBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpSrteV6PolicyBgpExtCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpExtCommunitySlice[index] = newObj - return obj -} -func (obj *bgpSrteV6PolicyBgpExtCommunityIter) Clear() BgpSrteV6PolicyBgpExtCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpExtCommunity{} - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpSrteV6PolicyBgpExtCommunityIter) clearHolderSlice() BgpSrteV6PolicyBgpExtCommunityIter { - if len(obj.bgpExtCommunitySlice) > 0 { - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpSrteV6PolicyBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpSrteV6PolicyBgpExtCommunityIter { - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - return obj -} - -// List of optional tunnel TLV settings. -// TunnelTlvs returns a []BgpSrteV6TunnelTlv -func (obj *bgpSrteV6Policy) TunnelTlvs() BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { - if len(obj.obj.TunnelTlvs) == 0 { - obj.obj.TunnelTlvs = []*otg.BgpSrteV6TunnelTlv{} - } - if obj.tunnelTlvsHolder == nil { - obj.tunnelTlvsHolder = newBgpSrteV6PolicyBgpSrteV6TunnelTlvIter(&obj.obj.TunnelTlvs).setMsg(obj) - } - return obj.tunnelTlvsHolder -} - -type bgpSrteV6PolicyBgpSrteV6TunnelTlvIter struct { - obj *bgpSrteV6Policy - bgpSrteV6TunnelTlvSlice []BgpSrteV6TunnelTlv - fieldPtr *[]*otg.BgpSrteV6TunnelTlv -} - -func newBgpSrteV6PolicyBgpSrteV6TunnelTlvIter(ptr *[]*otg.BgpSrteV6TunnelTlv) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { - return &bgpSrteV6PolicyBgpSrteV6TunnelTlvIter{fieldPtr: ptr} -} - -type BgpSrteV6PolicyBgpSrteV6TunnelTlvIter interface { - setMsg(*bgpSrteV6Policy) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter - Items() []BgpSrteV6TunnelTlv - Add() BgpSrteV6TunnelTlv - Append(items ...BgpSrteV6TunnelTlv) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter - Set(index int, newObj BgpSrteV6TunnelTlv) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter - Clear() BgpSrteV6PolicyBgpSrteV6TunnelTlvIter - clearHolderSlice() BgpSrteV6PolicyBgpSrteV6TunnelTlvIter - appendHolderSlice(item BgpSrteV6TunnelTlv) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter -} - -func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) setMsg(msg *bgpSrteV6Policy) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpSrteV6TunnelTlv{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) Items() []BgpSrteV6TunnelTlv { - return obj.bgpSrteV6TunnelTlvSlice -} - -func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) Add() BgpSrteV6TunnelTlv { - newObj := &otg.BgpSrteV6TunnelTlv{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpSrteV6TunnelTlv{obj: newObj} - newLibObj.setDefault() - obj.bgpSrteV6TunnelTlvSlice = append(obj.bgpSrteV6TunnelTlvSlice, newLibObj) - return newLibObj -} - -func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) Append(items ...BgpSrteV6TunnelTlv) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpSrteV6TunnelTlvSlice = append(obj.bgpSrteV6TunnelTlvSlice, item) - } - return obj -} - -func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) Set(index int, newObj BgpSrteV6TunnelTlv) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpSrteV6TunnelTlvSlice[index] = newObj - return obj -} -func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) Clear() BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpSrteV6TunnelTlv{} - obj.bgpSrteV6TunnelTlvSlice = []BgpSrteV6TunnelTlv{} - } - return obj -} -func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) clearHolderSlice() BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { - if len(obj.bgpSrteV6TunnelTlvSlice) > 0 { - obj.bgpSrteV6TunnelTlvSlice = []BgpSrteV6TunnelTlv{} - } - return obj -} -func (obj *bgpSrteV6PolicyBgpSrteV6TunnelTlvIter) appendHolderSlice(item BgpSrteV6TunnelTlv) BgpSrteV6PolicyBgpSrteV6TunnelTlvIter { - obj.bgpSrteV6TunnelTlvSlice = append(obj.bgpSrteV6TunnelTlvSlice, item) - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *bgpSrteV6Policy) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the BgpSrteV6Policy object -func (obj *bgpSrteV6Policy) SetName(value string) BgpSrteV6Policy { - - obj.obj.Name = &value - return obj -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// Active returns a bool -func (obj *bgpSrteV6Policy) Active() bool { - - return *obj.obj.Active - -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// Active returns a bool -func (obj *bgpSrteV6Policy) HasActive() bool { - return obj.obj.Active != nil -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// SetActive sets the bool value in the BgpSrteV6Policy object -func (obj *bgpSrteV6Policy) SetActive(value bool) BgpSrteV6Policy { - - obj.obj.Active = &value - return obj -} - -func (obj *bgpSrteV6Policy) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Ipv6Endpoint is required - if obj.obj.Ipv6Endpoint == nil { - vObj.validationErrors = append(vObj.validationErrors, "Ipv6Endpoint is required field on interface BgpSrteV6Policy") - } - if obj.obj.Ipv6Endpoint != nil { - - err := obj.validateIpv6(obj.Ipv6Endpoint()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteV6Policy.Ipv6Endpoint")) - } - - } - - if obj.obj.NextHopIpv4Address != nil { - - err := obj.validateIpv4(obj.NextHopIpv4Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteV6Policy.NextHopIpv4Address")) - } - - } - - if obj.obj.NextHopIpv6Address != nil { - - err := obj.validateIpv6(obj.NextHopIpv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteV6Policy.NextHopIpv6Address")) - } - - } - - if obj.obj.Advanced != nil { - - obj.Advanced().validateObj(vObj, set_default) - } - - if obj.obj.AddPath != nil { - - obj.AddPath().validateObj(vObj, set_default) - } - - if obj.obj.AsPath != nil { - - obj.AsPath().validateObj(vObj, set_default) - } - - if len(obj.obj.Communities) != 0 { - - if set_default { - obj.Communities().clearHolderSlice() - for _, item := range obj.obj.Communities { - obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) - } - } - for _, item := range obj.Communities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Extcommunities) != 0 { - - if set_default { - obj.Extcommunities().clearHolderSlice() - for _, item := range obj.obj.Extcommunities { - obj.Extcommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) - } - } - for _, item := range obj.Extcommunities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.TunnelTlvs) != 0 { - - if set_default { - obj.TunnelTlvs().clearHolderSlice() - for _, item := range obj.obj.TunnelTlvs { - obj.TunnelTlvs().appendHolderSlice(&bgpSrteV6TunnelTlv{obj: item}) - } - } - for _, item := range obj.TunnelTlvs().Items() { - item.validateObj(vObj, set_default) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpSrteV6Policy") - } -} - -func (obj *bgpSrteV6Policy) setDefault() { - if obj.obj.Distinguisher == nil { - obj.SetDistinguisher(1) - } - if obj.obj.Color == nil { - obj.SetColor(100) - } - if obj.obj.NextHopMode == nil { - obj.SetNextHopMode(BgpSrteV6PolicyNextHopMode.LOCAL_IP) - - } - if obj.obj.NextHopAddressType == nil { - obj.SetNextHopAddressType(BgpSrteV6PolicyNextHopAddressType.IPV6) - - } - if obj.obj.NextHopIpv4Address == nil { - obj.SetNextHopIpv4Address("0.0.0.0") - } - if obj.obj.NextHopIpv6Address == nil { - obj.SetNextHopIpv6Address("::0") - } - if obj.obj.Active == nil { - obj.SetActive(true) - } - -} - -// ***** BgpGracefulRestart ***** -type bgpGracefulRestart struct { - validation - obj *otg.BgpGracefulRestart - marshaller marshalBgpGracefulRestart - unMarshaller unMarshalBgpGracefulRestart -} - -func NewBgpGracefulRestart() BgpGracefulRestart { - obj := bgpGracefulRestart{obj: &otg.BgpGracefulRestart{}} - obj.setDefault() - return &obj -} - -func (obj *bgpGracefulRestart) msg() *otg.BgpGracefulRestart { - return obj.obj -} - -func (obj *bgpGracefulRestart) setMsg(msg *otg.BgpGracefulRestart) BgpGracefulRestart { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpGracefulRestart struct { - obj *bgpGracefulRestart -} - -type marshalBgpGracefulRestart interface { - // ToProto marshals BgpGracefulRestart to protobuf object *otg.BgpGracefulRestart - ToProto() (*otg.BgpGracefulRestart, error) - // ToPbText marshals BgpGracefulRestart to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpGracefulRestart to YAML text - ToYaml() (string, error) - // ToJson marshals BgpGracefulRestart to JSON text - ToJson() (string, error) -} - -type unMarshalbgpGracefulRestart struct { - obj *bgpGracefulRestart -} - -type unMarshalBgpGracefulRestart interface { - // FromProto unmarshals BgpGracefulRestart from protobuf object *otg.BgpGracefulRestart - FromProto(msg *otg.BgpGracefulRestart) (BgpGracefulRestart, error) - // FromPbText unmarshals BgpGracefulRestart from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpGracefulRestart from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpGracefulRestart from JSON text - FromJson(value string) error -} - -func (obj *bgpGracefulRestart) Marshal() marshalBgpGracefulRestart { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpGracefulRestart{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpGracefulRestart) Unmarshal() unMarshalBgpGracefulRestart { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpGracefulRestart{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpGracefulRestart) ToProto() (*otg.BgpGracefulRestart, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpGracefulRestart) FromProto(msg *otg.BgpGracefulRestart) (BgpGracefulRestart, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpGracefulRestart) 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 *unMarshalbgpGracefulRestart) 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 *marshalbgpGracefulRestart) 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 *unMarshalbgpGracefulRestart) 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 *marshalbgpGracefulRestart) 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 *unMarshalbgpGracefulRestart) 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 *bgpGracefulRestart) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpGracefulRestart) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpGracefulRestart) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpGracefulRestart) Clone() (BgpGracefulRestart, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpGracefulRestart() - 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 -} - -// BgpGracefulRestart is the Graceful Restart Capability (RFC 4724) is a BGP capability that can be used by a BGP speaker to indicate its ability to preserve its forwarding state during BGP restart. The Graceful Restart (GR) capability is advertised in OPEN messages sent between BGP peers. After a BGP session has been established, and the initial routing update has been completed, an End-of-RIB (Routing Information Base) marker is sent in an UPDATE message to convey information about routing convergence. -type BgpGracefulRestart interface { - Validation - // msg marshals BgpGracefulRestart to protobuf object *otg.BgpGracefulRestart - // and doesn't set defaults - msg() *otg.BgpGracefulRestart - // setMsg unmarshals BgpGracefulRestart from protobuf object *otg.BgpGracefulRestart - // and doesn't set defaults - setMsg(*otg.BgpGracefulRestart) BgpGracefulRestart - // provides marshal interface - Marshal() marshalBgpGracefulRestart - // provides unmarshal interface - Unmarshal() unMarshalBgpGracefulRestart - // validate validates BgpGracefulRestart - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpGracefulRestart, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // EnableGr returns bool, set in BgpGracefulRestart. - EnableGr() bool - // SetEnableGr assigns bool provided by user to BgpGracefulRestart - SetEnableGr(value bool) BgpGracefulRestart - // HasEnableGr checks if EnableGr has been set in BgpGracefulRestart - HasEnableGr() bool - // RestartTime returns uint32, set in BgpGracefulRestart. - RestartTime() uint32 - // SetRestartTime assigns uint32 provided by user to BgpGracefulRestart - SetRestartTime(value uint32) BgpGracefulRestart - // HasRestartTime checks if RestartTime has been set in BgpGracefulRestart - HasRestartTime() bool - // EnableLlgr returns bool, set in BgpGracefulRestart. - EnableLlgr() bool - // SetEnableLlgr assigns bool provided by user to BgpGracefulRestart - SetEnableLlgr(value bool) BgpGracefulRestart - // HasEnableLlgr checks if EnableLlgr has been set in BgpGracefulRestart - HasEnableLlgr() bool - // StaleTime returns uint32, set in BgpGracefulRestart. - StaleTime() uint32 - // SetStaleTime assigns uint32 provided by user to BgpGracefulRestart - SetStaleTime(value uint32) BgpGracefulRestart - // HasStaleTime checks if StaleTime has been set in BgpGracefulRestart - HasStaleTime() bool -} - -// If enabled, Graceful Restart capability is advertised in BGP OPEN messages. -// EnableGr returns a bool -func (obj *bgpGracefulRestart) EnableGr() bool { - - return *obj.obj.EnableGr - -} - -// If enabled, Graceful Restart capability is advertised in BGP OPEN messages. -// EnableGr returns a bool -func (obj *bgpGracefulRestart) HasEnableGr() bool { - return obj.obj.EnableGr != nil -} - -// If enabled, Graceful Restart capability is advertised in BGP OPEN messages. -// SetEnableGr sets the bool value in the BgpGracefulRestart object -func (obj *bgpGracefulRestart) SetEnableGr(value bool) BgpGracefulRestart { - - obj.obj.EnableGr = &value - return obj -} - -// This is the estimated duration (in seconds) it will take for the BGP session to be re-established after a restart. This can be used to speed up routing convergence by its peer in case the BGP speaker does not come back after a restart. -// RestartTime returns a uint32 -func (obj *bgpGracefulRestart) RestartTime() uint32 { - - return *obj.obj.RestartTime - -} - -// This is the estimated duration (in seconds) it will take for the BGP session to be re-established after a restart. This can be used to speed up routing convergence by its peer in case the BGP speaker does not come back after a restart. -// RestartTime returns a uint32 -func (obj *bgpGracefulRestart) HasRestartTime() bool { - return obj.obj.RestartTime != nil -} - -// This is the estimated duration (in seconds) it will take for the BGP session to be re-established after a restart. This can be used to speed up routing convergence by its peer in case the BGP speaker does not come back after a restart. -// SetRestartTime sets the uint32 value in the BgpGracefulRestart object -func (obj *bgpGracefulRestart) SetRestartTime(value uint32) BgpGracefulRestart { - - obj.obj.RestartTime = &value - return obj -} - -// If enabled, the "Long-lived Graceful Restart Capability", or "LLGR Capability" -// will be advertised. -// This capability MUST be advertised in conjunction with the Graceful Restart -// capability. -// EnableLlgr returns a bool -func (obj *bgpGracefulRestart) EnableLlgr() bool { - - return *obj.obj.EnableLlgr - -} - -// If enabled, the "Long-lived Graceful Restart Capability", or "LLGR Capability" -// will be advertised. -// This capability MUST be advertised in conjunction with the Graceful Restart -// capability. -// EnableLlgr returns a bool -func (obj *bgpGracefulRestart) HasEnableLlgr() bool { - return obj.obj.EnableLlgr != nil -} - -// If enabled, the "Long-lived Graceful Restart Capability", or "LLGR Capability" -// will be advertised. -// This capability MUST be advertised in conjunction with the Graceful Restart -// capability. -// SetEnableLlgr sets the bool value in the BgpGracefulRestart object -func (obj *bgpGracefulRestart) SetEnableLlgr(value bool) BgpGracefulRestart { - - obj.obj.EnableLlgr = &value - return obj -} - -// Duration (in seconds) specifying how long stale information (for the AFI/SAFI) -// may be retained. This is a three byte field and is applicable -// only if 'enable_llgr' is set to 'true'. -// StaleTime returns a uint32 -func (obj *bgpGracefulRestart) StaleTime() uint32 { - - return *obj.obj.StaleTime - -} - -// Duration (in seconds) specifying how long stale information (for the AFI/SAFI) -// may be retained. This is a three byte field and is applicable -// only if 'enable_llgr' is set to 'true'. -// StaleTime returns a uint32 -func (obj *bgpGracefulRestart) HasStaleTime() bool { - return obj.obj.StaleTime != nil -} - -// Duration (in seconds) specifying how long stale information (for the AFI/SAFI) -// may be retained. This is a three byte field and is applicable -// only if 'enable_llgr' is set to 'true'. -// SetStaleTime sets the uint32 value in the BgpGracefulRestart object -func (obj *bgpGracefulRestart) SetStaleTime(value uint32) BgpGracefulRestart { - - obj.obj.StaleTime = &value - return obj -} - -func (obj *bgpGracefulRestart) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RestartTime != nil { - - if *obj.obj.RestartTime > 4096 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpGracefulRestart.RestartTime <= 4096 but Got %d", *obj.obj.RestartTime)) - } - - } - - if obj.obj.StaleTime != nil { - - if *obj.obj.StaleTime > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpGracefulRestart.StaleTime <= 16777215 but Got %d", *obj.obj.StaleTime)) - } - - } - -} - -func (obj *bgpGracefulRestart) setDefault() { - if obj.obj.EnableGr == nil { - obj.SetEnableGr(false) - } - if obj.obj.RestartTime == nil { - obj.SetRestartTime(45) - } - if obj.obj.EnableLlgr == nil { - obj.SetEnableLlgr(false) - } - if obj.obj.StaleTime == nil { - obj.SetStaleTime(10) - } - -} - -// ***** BgpUpdateReplay ***** -type bgpUpdateReplay struct { - validation - obj *otg.BgpUpdateReplay - marshaller marshalBgpUpdateReplay - unMarshaller unMarshalBgpUpdateReplay - structuredPdusHolder BgpStructuredPdus - rawBytesHolder BgpRawBytes -} - -func NewBgpUpdateReplay() BgpUpdateReplay { - obj := bgpUpdateReplay{obj: &otg.BgpUpdateReplay{}} - obj.setDefault() - return &obj -} - -func (obj *bgpUpdateReplay) msg() *otg.BgpUpdateReplay { - return obj.obj -} - -func (obj *bgpUpdateReplay) setMsg(msg *otg.BgpUpdateReplay) BgpUpdateReplay { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpUpdateReplay struct { - obj *bgpUpdateReplay -} - -type marshalBgpUpdateReplay interface { - // ToProto marshals BgpUpdateReplay to protobuf object *otg.BgpUpdateReplay - ToProto() (*otg.BgpUpdateReplay, error) - // ToPbText marshals BgpUpdateReplay to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpUpdateReplay to YAML text - ToYaml() (string, error) - // ToJson marshals BgpUpdateReplay to JSON text - ToJson() (string, error) -} - -type unMarshalbgpUpdateReplay struct { - obj *bgpUpdateReplay -} - -type unMarshalBgpUpdateReplay interface { - // FromProto unmarshals BgpUpdateReplay from protobuf object *otg.BgpUpdateReplay - FromProto(msg *otg.BgpUpdateReplay) (BgpUpdateReplay, error) - // FromPbText unmarshals BgpUpdateReplay from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpUpdateReplay from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpUpdateReplay from JSON text - FromJson(value string) error -} - -func (obj *bgpUpdateReplay) Marshal() marshalBgpUpdateReplay { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpUpdateReplay{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpUpdateReplay) Unmarshal() unMarshalBgpUpdateReplay { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpUpdateReplay{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpUpdateReplay) ToProto() (*otg.BgpUpdateReplay, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpUpdateReplay) FromProto(msg *otg.BgpUpdateReplay) (BgpUpdateReplay, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpUpdateReplay) 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 *unMarshalbgpUpdateReplay) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpUpdateReplay) 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 *unMarshalbgpUpdateReplay) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpUpdateReplay) 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 *unMarshalbgpUpdateReplay) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpUpdateReplay) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpUpdateReplay) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpUpdateReplay) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpUpdateReplay) Clone() (BgpUpdateReplay, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpUpdateReplay() - 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 -} - -func (obj *bgpUpdateReplay) setNil() { - obj.structuredPdusHolder = nil - obj.rawBytesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpUpdateReplay is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. -type BgpUpdateReplay interface { - Validation - // msg marshals BgpUpdateReplay to protobuf object *otg.BgpUpdateReplay - // and doesn't set defaults - msg() *otg.BgpUpdateReplay - // setMsg unmarshals BgpUpdateReplay from protobuf object *otg.BgpUpdateReplay - // and doesn't set defaults - setMsg(*otg.BgpUpdateReplay) BgpUpdateReplay - // provides marshal interface - Marshal() marshalBgpUpdateReplay - // provides unmarshal interface - Unmarshal() unMarshalBgpUpdateReplay - // validate validates BgpUpdateReplay - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpUpdateReplay, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpUpdateReplayChoiceEnum, set in BgpUpdateReplay - Choice() BgpUpdateReplayChoiceEnum - // setChoice assigns BgpUpdateReplayChoiceEnum provided by user to BgpUpdateReplay - setChoice(value BgpUpdateReplayChoiceEnum) BgpUpdateReplay - // HasChoice checks if Choice has been set in BgpUpdateReplay - HasChoice() bool - // StructuredPdus returns BgpStructuredPdus, set in BgpUpdateReplay. - // BgpStructuredPdus is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. - StructuredPdus() BgpStructuredPdus - // SetStructuredPdus assigns BgpStructuredPdus provided by user to BgpUpdateReplay. - // BgpStructuredPdus is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. - SetStructuredPdus(value BgpStructuredPdus) BgpUpdateReplay - // HasStructuredPdus checks if StructuredPdus has been set in BgpUpdateReplay - HasStructuredPdus() bool - // RawBytes returns BgpRawBytes, set in BgpUpdateReplay. - // BgpRawBytes is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. - RawBytes() BgpRawBytes - // SetRawBytes assigns BgpRawBytes provided by user to BgpUpdateReplay. - // BgpRawBytes is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. - SetRawBytes(value BgpRawBytes) BgpUpdateReplay - // HasRawBytes checks if RawBytes has been set in BgpUpdateReplay - HasRawBytes() bool - setNil() -} - -type BgpUpdateReplayChoiceEnum string - -// Enum of Choice on BgpUpdateReplay -var BgpUpdateReplayChoice = struct { - STRUCTURED_PDUS BgpUpdateReplayChoiceEnum - RAW_BYTES BgpUpdateReplayChoiceEnum -}{ - STRUCTURED_PDUS: BgpUpdateReplayChoiceEnum("structured_pdus"), - RAW_BYTES: BgpUpdateReplayChoiceEnum("raw_bytes"), -} - -func (obj *bgpUpdateReplay) Choice() BgpUpdateReplayChoiceEnum { - return BgpUpdateReplayChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *bgpUpdateReplay) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpUpdateReplay) setChoice(value BgpUpdateReplayChoiceEnum) BgpUpdateReplay { - intValue, ok := otg.BgpUpdateReplay_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpUpdateReplayChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpUpdateReplay_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.RawBytes = nil - obj.rawBytesHolder = nil - obj.obj.StructuredPdus = nil - obj.structuredPdusHolder = nil - - if value == BgpUpdateReplayChoice.STRUCTURED_PDUS { - obj.obj.StructuredPdus = NewBgpStructuredPdus().msg() - } - - if value == BgpUpdateReplayChoice.RAW_BYTES { - obj.obj.RawBytes = NewBgpRawBytes().msg() - } - - return obj -} - -// description is TBD -// StructuredPdus returns a BgpStructuredPdus -func (obj *bgpUpdateReplay) StructuredPdus() BgpStructuredPdus { - if obj.obj.StructuredPdus == nil { - obj.setChoice(BgpUpdateReplayChoice.STRUCTURED_PDUS) - } - if obj.structuredPdusHolder == nil { - obj.structuredPdusHolder = &bgpStructuredPdus{obj: obj.obj.StructuredPdus} - } - return obj.structuredPdusHolder -} - -// description is TBD -// StructuredPdus returns a BgpStructuredPdus -func (obj *bgpUpdateReplay) HasStructuredPdus() bool { - return obj.obj.StructuredPdus != nil -} - -// description is TBD -// SetStructuredPdus sets the BgpStructuredPdus value in the BgpUpdateReplay object -func (obj *bgpUpdateReplay) SetStructuredPdus(value BgpStructuredPdus) BgpUpdateReplay { - obj.setChoice(BgpUpdateReplayChoice.STRUCTURED_PDUS) - obj.structuredPdusHolder = nil - obj.obj.StructuredPdus = value.msg() - - return obj -} - -// description is TBD -// RawBytes returns a BgpRawBytes -func (obj *bgpUpdateReplay) RawBytes() BgpRawBytes { - if obj.obj.RawBytes == nil { - obj.setChoice(BgpUpdateReplayChoice.RAW_BYTES) - } - if obj.rawBytesHolder == nil { - obj.rawBytesHolder = &bgpRawBytes{obj: obj.obj.RawBytes} - } - return obj.rawBytesHolder -} - -// description is TBD -// RawBytes returns a BgpRawBytes -func (obj *bgpUpdateReplay) HasRawBytes() bool { - return obj.obj.RawBytes != nil -} - -// description is TBD -// SetRawBytes sets the BgpRawBytes value in the BgpUpdateReplay object -func (obj *bgpUpdateReplay) SetRawBytes(value BgpRawBytes) BgpUpdateReplay { - obj.setChoice(BgpUpdateReplayChoice.RAW_BYTES) - obj.rawBytesHolder = nil - obj.obj.RawBytes = value.msg() - - return obj -} - -func (obj *bgpUpdateReplay) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.StructuredPdus != nil { - - obj.StructuredPdus().validateObj(vObj, set_default) - } - - if obj.obj.RawBytes != nil { - - obj.RawBytes().validateObj(vObj, set_default) - } - -} - -func (obj *bgpUpdateReplay) setDefault() { - var choices_set int = 0 - var choice BgpUpdateReplayChoiceEnum - - if obj.obj.StructuredPdus != nil { - choices_set += 1 - choice = BgpUpdateReplayChoice.STRUCTURED_PDUS - } - - if obj.obj.RawBytes != nil { - choices_set += 1 - choice = BgpUpdateReplayChoice.RAW_BYTES - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(BgpUpdateReplayChoice.STRUCTURED_PDUS) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpUpdateReplay") - } - } else { - intVal := otg.BgpUpdateReplay_Choice_Enum_value[string(choice)] - enumValue := otg.BgpUpdateReplay_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpV6SegmentRouting ***** -type bgpV6SegmentRouting struct { - validation - obj *otg.BgpV6SegmentRouting - marshaller marshalBgpV6SegmentRouting - unMarshaller unMarshalBgpV6SegmentRouting -} - -func NewBgpV6SegmentRouting() BgpV6SegmentRouting { - obj := bgpV6SegmentRouting{obj: &otg.BgpV6SegmentRouting{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV6SegmentRouting) msg() *otg.BgpV6SegmentRouting { - return obj.obj -} - -func (obj *bgpV6SegmentRouting) setMsg(msg *otg.BgpV6SegmentRouting) BgpV6SegmentRouting { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV6SegmentRouting struct { - obj *bgpV6SegmentRouting -} - -type marshalBgpV6SegmentRouting interface { - // ToProto marshals BgpV6SegmentRouting to protobuf object *otg.BgpV6SegmentRouting - ToProto() (*otg.BgpV6SegmentRouting, error) - // ToPbText marshals BgpV6SegmentRouting to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV6SegmentRouting to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV6SegmentRouting to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV6SegmentRouting struct { - obj *bgpV6SegmentRouting -} - -type unMarshalBgpV6SegmentRouting interface { - // FromProto unmarshals BgpV6SegmentRouting from protobuf object *otg.BgpV6SegmentRouting - FromProto(msg *otg.BgpV6SegmentRouting) (BgpV6SegmentRouting, error) - // FromPbText unmarshals BgpV6SegmentRouting from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV6SegmentRouting from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV6SegmentRouting from JSON text - FromJson(value string) error -} - -func (obj *bgpV6SegmentRouting) Marshal() marshalBgpV6SegmentRouting { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV6SegmentRouting{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV6SegmentRouting) Unmarshal() unMarshalBgpV6SegmentRouting { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV6SegmentRouting{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV6SegmentRouting) ToProto() (*otg.BgpV6SegmentRouting, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV6SegmentRouting) FromProto(msg *otg.BgpV6SegmentRouting) (BgpV6SegmentRouting, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV6SegmentRouting) 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 *unMarshalbgpV6SegmentRouting) 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 *marshalbgpV6SegmentRouting) 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 *unMarshalbgpV6SegmentRouting) 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 *marshalbgpV6SegmentRouting) 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 *unMarshalbgpV6SegmentRouting) 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 *bgpV6SegmentRouting) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV6SegmentRouting) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV6SegmentRouting) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV6SegmentRouting) Clone() (BgpV6SegmentRouting, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV6SegmentRouting() - 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 -} - -// BgpV6SegmentRouting is configuration for BGPv6 segment routing settings. -type BgpV6SegmentRouting interface { - Validation - // msg marshals BgpV6SegmentRouting to protobuf object *otg.BgpV6SegmentRouting - // and doesn't set defaults - msg() *otg.BgpV6SegmentRouting - // setMsg unmarshals BgpV6SegmentRouting from protobuf object *otg.BgpV6SegmentRouting - // and doesn't set defaults - setMsg(*otg.BgpV6SegmentRouting) BgpV6SegmentRouting - // provides marshal interface - Marshal() marshalBgpV6SegmentRouting - // provides unmarshal interface - Unmarshal() unMarshalBgpV6SegmentRouting - // validate validates BgpV6SegmentRouting - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV6SegmentRouting, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // IngressSupportsVpn returns bool, set in BgpV6SegmentRouting. - IngressSupportsVpn() bool - // SetIngressSupportsVpn assigns bool provided by user to BgpV6SegmentRouting - SetIngressSupportsVpn(value bool) BgpV6SegmentRouting - // HasIngressSupportsVpn checks if IngressSupportsVpn has been set in BgpV6SegmentRouting - HasIngressSupportsVpn() bool - // ReducedEncapsulation returns bool, set in BgpV6SegmentRouting. - ReducedEncapsulation() bool - // SetReducedEncapsulation assigns bool provided by user to BgpV6SegmentRouting - SetReducedEncapsulation(value bool) BgpV6SegmentRouting - // HasReducedEncapsulation checks if ReducedEncapsulation has been set in BgpV6SegmentRouting - HasReducedEncapsulation() bool - // CopyTimeToLive returns bool, set in BgpV6SegmentRouting. - CopyTimeToLive() bool - // SetCopyTimeToLive assigns bool provided by user to BgpV6SegmentRouting - SetCopyTimeToLive(value bool) BgpV6SegmentRouting - // HasCopyTimeToLive checks if CopyTimeToLive has been set in BgpV6SegmentRouting - HasCopyTimeToLive() bool - // TimeToLive returns uint32, set in BgpV6SegmentRouting. - TimeToLive() uint32 - // SetTimeToLive assigns uint32 provided by user to BgpV6SegmentRouting - SetTimeToLive(value uint32) BgpV6SegmentRouting - // HasTimeToLive checks if TimeToLive has been set in BgpV6SegmentRouting - HasTimeToLive() bool - // MaxSidsPerSrh returns uint32, set in BgpV6SegmentRouting. - MaxSidsPerSrh() uint32 - // SetMaxSidsPerSrh assigns uint32 provided by user to BgpV6SegmentRouting - SetMaxSidsPerSrh(value uint32) BgpV6SegmentRouting - // HasMaxSidsPerSrh checks if MaxSidsPerSrh has been set in BgpV6SegmentRouting - HasMaxSidsPerSrh() bool - // AutoGenerateSegmentLeftValue returns bool, set in BgpV6SegmentRouting. - AutoGenerateSegmentLeftValue() bool - // SetAutoGenerateSegmentLeftValue assigns bool provided by user to BgpV6SegmentRouting - SetAutoGenerateSegmentLeftValue(value bool) BgpV6SegmentRouting - // HasAutoGenerateSegmentLeftValue checks if AutoGenerateSegmentLeftValue has been set in BgpV6SegmentRouting - HasAutoGenerateSegmentLeftValue() bool - // SegmentLeftValue returns uint32, set in BgpV6SegmentRouting. - SegmentLeftValue() uint32 - // SetSegmentLeftValue assigns uint32 provided by user to BgpV6SegmentRouting - SetSegmentLeftValue(value uint32) BgpV6SegmentRouting - // HasSegmentLeftValue checks if SegmentLeftValue has been set in BgpV6SegmentRouting - HasSegmentLeftValue() bool - // AdvertiseSrTePolicy returns bool, set in BgpV6SegmentRouting. - AdvertiseSrTePolicy() bool - // SetAdvertiseSrTePolicy assigns bool provided by user to BgpV6SegmentRouting - SetAdvertiseSrTePolicy(value bool) BgpV6SegmentRouting - // HasAdvertiseSrTePolicy checks if AdvertiseSrTePolicy has been set in BgpV6SegmentRouting - HasAdvertiseSrTePolicy() bool -} - -// TBD -// IngressSupportsVpn returns a bool -func (obj *bgpV6SegmentRouting) IngressSupportsVpn() bool { - - return *obj.obj.IngressSupportsVpn - -} - -// TBD -// IngressSupportsVpn returns a bool -func (obj *bgpV6SegmentRouting) HasIngressSupportsVpn() bool { - return obj.obj.IngressSupportsVpn != nil -} - -// TBD -// SetIngressSupportsVpn sets the bool value in the BgpV6SegmentRouting object -func (obj *bgpV6SegmentRouting) SetIngressSupportsVpn(value bool) BgpV6SegmentRouting { - - obj.obj.IngressSupportsVpn = &value - return obj -} - -// TBD -// ReducedEncapsulation returns a bool -func (obj *bgpV6SegmentRouting) ReducedEncapsulation() bool { - - return *obj.obj.ReducedEncapsulation - -} - -// TBD -// ReducedEncapsulation returns a bool -func (obj *bgpV6SegmentRouting) HasReducedEncapsulation() bool { - return obj.obj.ReducedEncapsulation != nil -} - -// TBD -// SetReducedEncapsulation sets the bool value in the BgpV6SegmentRouting object -func (obj *bgpV6SegmentRouting) SetReducedEncapsulation(value bool) BgpV6SegmentRouting { - - obj.obj.ReducedEncapsulation = &value - return obj -} - -// TBD -// CopyTimeToLive returns a bool -func (obj *bgpV6SegmentRouting) CopyTimeToLive() bool { - - return *obj.obj.CopyTimeToLive - -} - -// TBD -// CopyTimeToLive returns a bool -func (obj *bgpV6SegmentRouting) HasCopyTimeToLive() bool { - return obj.obj.CopyTimeToLive != nil -} - -// TBD -// SetCopyTimeToLive sets the bool value in the BgpV6SegmentRouting object -func (obj *bgpV6SegmentRouting) SetCopyTimeToLive(value bool) BgpV6SegmentRouting { - - obj.obj.CopyTimeToLive = &value - return obj -} - -// TBD -// TimeToLive returns a uint32 -func (obj *bgpV6SegmentRouting) TimeToLive() uint32 { - - return *obj.obj.TimeToLive - -} - -// TBD -// TimeToLive returns a uint32 -func (obj *bgpV6SegmentRouting) HasTimeToLive() bool { - return obj.obj.TimeToLive != nil -} - -// TBD -// SetTimeToLive sets the uint32 value in the BgpV6SegmentRouting object -func (obj *bgpV6SegmentRouting) SetTimeToLive(value uint32) BgpV6SegmentRouting { - - obj.obj.TimeToLive = &value - return obj -} - -// TBD -// MaxSidsPerSrh returns a uint32 -func (obj *bgpV6SegmentRouting) MaxSidsPerSrh() uint32 { - - return *obj.obj.MaxSidsPerSrh - -} - -// TBD -// MaxSidsPerSrh returns a uint32 -func (obj *bgpV6SegmentRouting) HasMaxSidsPerSrh() bool { - return obj.obj.MaxSidsPerSrh != nil -} - -// TBD -// SetMaxSidsPerSrh sets the uint32 value in the BgpV6SegmentRouting object -func (obj *bgpV6SegmentRouting) SetMaxSidsPerSrh(value uint32) BgpV6SegmentRouting { - - obj.obj.MaxSidsPerSrh = &value - return obj -} - -// TBD -// AutoGenerateSegmentLeftValue returns a bool -func (obj *bgpV6SegmentRouting) AutoGenerateSegmentLeftValue() bool { - - return *obj.obj.AutoGenerateSegmentLeftValue - -} - -// TBD -// AutoGenerateSegmentLeftValue returns a bool -func (obj *bgpV6SegmentRouting) HasAutoGenerateSegmentLeftValue() bool { - return obj.obj.AutoGenerateSegmentLeftValue != nil -} - -// TBD -// SetAutoGenerateSegmentLeftValue sets the bool value in the BgpV6SegmentRouting object -func (obj *bgpV6SegmentRouting) SetAutoGenerateSegmentLeftValue(value bool) BgpV6SegmentRouting { - - obj.obj.AutoGenerateSegmentLeftValue = &value - return obj -} - -// TBD -// SegmentLeftValue returns a uint32 -func (obj *bgpV6SegmentRouting) SegmentLeftValue() uint32 { - - return *obj.obj.SegmentLeftValue - -} - -// TBD -// SegmentLeftValue returns a uint32 -func (obj *bgpV6SegmentRouting) HasSegmentLeftValue() bool { - return obj.obj.SegmentLeftValue != nil -} - -// TBD -// SetSegmentLeftValue sets the uint32 value in the BgpV6SegmentRouting object -func (obj *bgpV6SegmentRouting) SetSegmentLeftValue(value uint32) BgpV6SegmentRouting { - - obj.obj.SegmentLeftValue = &value - return obj -} - -// TBD -// AdvertiseSrTePolicy returns a bool -func (obj *bgpV6SegmentRouting) AdvertiseSrTePolicy() bool { - - return *obj.obj.AdvertiseSrTePolicy - -} - -// TBD -// AdvertiseSrTePolicy returns a bool -func (obj *bgpV6SegmentRouting) HasAdvertiseSrTePolicy() bool { - return obj.obj.AdvertiseSrTePolicy != nil -} - -// TBD -// SetAdvertiseSrTePolicy sets the bool value in the BgpV6SegmentRouting object -func (obj *bgpV6SegmentRouting) SetAdvertiseSrTePolicy(value bool) BgpV6SegmentRouting { - - obj.obj.AdvertiseSrTePolicy = &value - return obj -} - -func (obj *bgpV6SegmentRouting) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.MaxSidsPerSrh != nil { - - if *obj.obj.MaxSidsPerSrh > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpV6SegmentRouting.MaxSidsPerSrh <= 255 but Got %d", *obj.obj.MaxSidsPerSrh)) - } - - } - -} - -func (obj *bgpV6SegmentRouting) setDefault() { - if obj.obj.IngressSupportsVpn == nil { - obj.SetIngressSupportsVpn(false) - } - if obj.obj.ReducedEncapsulation == nil { - obj.SetReducedEncapsulation(false) - } - if obj.obj.CopyTimeToLive == nil { - obj.SetCopyTimeToLive(false) - } - if obj.obj.TimeToLive == nil { - obj.SetTimeToLive(0) - } - if obj.obj.MaxSidsPerSrh == nil { - obj.SetMaxSidsPerSrh(0) - } - if obj.obj.AutoGenerateSegmentLeftValue == nil { - obj.SetAutoGenerateSegmentLeftValue(false) - } - if obj.obj.SegmentLeftValue == nil { - obj.SetSegmentLeftValue(0) - } - if obj.obj.AdvertiseSrTePolicy == nil { - obj.SetAdvertiseSrTePolicy(false) - } - -} - -// ***** BgpV6EthernetSegment ***** -type bgpV6EthernetSegment struct { - validation - obj *otg.BgpV6EthernetSegment - marshaller marshalBgpV6EthernetSegment - unMarshaller unMarshalBgpV6EthernetSegment - dfElectionHolder BgpEthernetSegmentDfElection - evisHolder BgpV6EthernetSegmentBgpV6EvpnEvisIter - advancedHolder BgpRouteAdvanced - communitiesHolder BgpV6EthernetSegmentBgpCommunityIter - extCommunitiesHolder BgpV6EthernetSegmentBgpExtCommunityIter - asPathHolder BgpAsPath -} - -func NewBgpV6EthernetSegment() BgpV6EthernetSegment { - obj := bgpV6EthernetSegment{obj: &otg.BgpV6EthernetSegment{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV6EthernetSegment) msg() *otg.BgpV6EthernetSegment { - return obj.obj -} - -func (obj *bgpV6EthernetSegment) setMsg(msg *otg.BgpV6EthernetSegment) BgpV6EthernetSegment { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV6EthernetSegment struct { - obj *bgpV6EthernetSegment -} - -type marshalBgpV6EthernetSegment interface { - // ToProto marshals BgpV6EthernetSegment to protobuf object *otg.BgpV6EthernetSegment - ToProto() (*otg.BgpV6EthernetSegment, error) - // ToPbText marshals BgpV6EthernetSegment to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV6EthernetSegment to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV6EthernetSegment to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV6EthernetSegment struct { - obj *bgpV6EthernetSegment -} - -type unMarshalBgpV6EthernetSegment interface { - // FromProto unmarshals BgpV6EthernetSegment from protobuf object *otg.BgpV6EthernetSegment - FromProto(msg *otg.BgpV6EthernetSegment) (BgpV6EthernetSegment, error) - // FromPbText unmarshals BgpV6EthernetSegment from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV6EthernetSegment from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV6EthernetSegment from JSON text - FromJson(value string) error -} - -func (obj *bgpV6EthernetSegment) Marshal() marshalBgpV6EthernetSegment { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV6EthernetSegment{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV6EthernetSegment) Unmarshal() unMarshalBgpV6EthernetSegment { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV6EthernetSegment{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV6EthernetSegment) ToProto() (*otg.BgpV6EthernetSegment, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV6EthernetSegment) FromProto(msg *otg.BgpV6EthernetSegment) (BgpV6EthernetSegment, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV6EthernetSegment) 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 *unMarshalbgpV6EthernetSegment) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpV6EthernetSegment) 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 *unMarshalbgpV6EthernetSegment) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpV6EthernetSegment) 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 *unMarshalbgpV6EthernetSegment) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpV6EthernetSegment) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV6EthernetSegment) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV6EthernetSegment) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV6EthernetSegment) Clone() (BgpV6EthernetSegment, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV6EthernetSegment() - 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 -} - -func (obj *bgpV6EthernetSegment) setNil() { - obj.dfElectionHolder = nil - obj.evisHolder = nil - obj.advancedHolder = nil - obj.communitiesHolder = nil - obj.extCommunitiesHolder = nil - obj.asPathHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpV6EthernetSegment is configuration for BGP Ethernet Segment ranges. Advertises following routes - -// -// Type 4 - Ethernet Segment Route -type BgpV6EthernetSegment interface { - Validation - // msg marshals BgpV6EthernetSegment to protobuf object *otg.BgpV6EthernetSegment - // and doesn't set defaults - msg() *otg.BgpV6EthernetSegment - // setMsg unmarshals BgpV6EthernetSegment from protobuf object *otg.BgpV6EthernetSegment - // and doesn't set defaults - setMsg(*otg.BgpV6EthernetSegment) BgpV6EthernetSegment - // provides marshal interface - Marshal() marshalBgpV6EthernetSegment - // provides unmarshal interface - Unmarshal() unMarshalBgpV6EthernetSegment - // validate validates BgpV6EthernetSegment - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV6EthernetSegment, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // DfElection returns BgpEthernetSegmentDfElection, set in BgpV6EthernetSegment. - // BgpEthernetSegmentDfElection is configuration for Designated Forwarder (DF) election among the Provider Edge (PE) routers on the same Ethernet Segment. - DfElection() BgpEthernetSegmentDfElection - // SetDfElection assigns BgpEthernetSegmentDfElection provided by user to BgpV6EthernetSegment. - // BgpEthernetSegmentDfElection is configuration for Designated Forwarder (DF) election among the Provider Edge (PE) routers on the same Ethernet Segment. - SetDfElection(value BgpEthernetSegmentDfElection) BgpV6EthernetSegment - // HasDfElection checks if DfElection has been set in BgpV6EthernetSegment - HasDfElection() bool - // Evis returns BgpV6EthernetSegmentBgpV6EvpnEvisIterIter, set in BgpV6EthernetSegment - Evis() BgpV6EthernetSegmentBgpV6EvpnEvisIter - // Esi returns string, set in BgpV6EthernetSegment. - Esi() string - // SetEsi assigns string provided by user to BgpV6EthernetSegment - SetEsi(value string) BgpV6EthernetSegment - // HasEsi checks if Esi has been set in BgpV6EthernetSegment - HasEsi() bool - // ActiveMode returns BgpV6EthernetSegmentActiveModeEnum, set in BgpV6EthernetSegment - ActiveMode() BgpV6EthernetSegmentActiveModeEnum - // SetActiveMode assigns BgpV6EthernetSegmentActiveModeEnum provided by user to BgpV6EthernetSegment - SetActiveMode(value BgpV6EthernetSegmentActiveModeEnum) BgpV6EthernetSegment - // HasActiveMode checks if ActiveMode has been set in BgpV6EthernetSegment - HasActiveMode() bool - // EsiLabel returns uint32, set in BgpV6EthernetSegment. - EsiLabel() uint32 - // SetEsiLabel assigns uint32 provided by user to BgpV6EthernetSegment - SetEsiLabel(value uint32) BgpV6EthernetSegment - // HasEsiLabel checks if EsiLabel has been set in BgpV6EthernetSegment - HasEsiLabel() bool - // Advanced returns BgpRouteAdvanced, set in BgpV6EthernetSegment. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - Advanced() BgpRouteAdvanced - // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpV6EthernetSegment. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - SetAdvanced(value BgpRouteAdvanced) BgpV6EthernetSegment - // HasAdvanced checks if Advanced has been set in BgpV6EthernetSegment - HasAdvanced() bool - // Communities returns BgpV6EthernetSegmentBgpCommunityIterIter, set in BgpV6EthernetSegment - Communities() BgpV6EthernetSegmentBgpCommunityIter - // ExtCommunities returns BgpV6EthernetSegmentBgpExtCommunityIterIter, set in BgpV6EthernetSegment - ExtCommunities() BgpV6EthernetSegmentBgpExtCommunityIter - // AsPath returns BgpAsPath, set in BgpV6EthernetSegment. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - AsPath() BgpAsPath - // SetAsPath assigns BgpAsPath provided by user to BgpV6EthernetSegment. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - SetAsPath(value BgpAsPath) BgpV6EthernetSegment - // HasAsPath checks if AsPath has been set in BgpV6EthernetSegment - HasAsPath() bool - setNil() -} - -// Designated Forwarder (DF) election configuration. -// DfElection returns a BgpEthernetSegmentDfElection -func (obj *bgpV6EthernetSegment) DfElection() BgpEthernetSegmentDfElection { - if obj.obj.DfElection == nil { - obj.obj.DfElection = NewBgpEthernetSegmentDfElection().msg() - } - if obj.dfElectionHolder == nil { - obj.dfElectionHolder = &bgpEthernetSegmentDfElection{obj: obj.obj.DfElection} - } - return obj.dfElectionHolder -} - -// Designated Forwarder (DF) election configuration. -// DfElection returns a BgpEthernetSegmentDfElection -func (obj *bgpV6EthernetSegment) HasDfElection() bool { - return obj.obj.DfElection != nil -} - -// Designated Forwarder (DF) election configuration. -// SetDfElection sets the BgpEthernetSegmentDfElection value in the BgpV6EthernetSegment object -func (obj *bgpV6EthernetSegment) SetDfElection(value BgpEthernetSegmentDfElection) BgpV6EthernetSegment { - - obj.dfElectionHolder = nil - obj.obj.DfElection = value.msg() - - return obj -} - -// This contains the list of EVIs. -// Evis returns a []BgpV6EvpnEvis -func (obj *bgpV6EthernetSegment) Evis() BgpV6EthernetSegmentBgpV6EvpnEvisIter { - if len(obj.obj.Evis) == 0 { - obj.obj.Evis = []*otg.BgpV6EvpnEvis{} - } - if obj.evisHolder == nil { - obj.evisHolder = newBgpV6EthernetSegmentBgpV6EvpnEvisIter(&obj.obj.Evis).setMsg(obj) - } - return obj.evisHolder -} - -type bgpV6EthernetSegmentBgpV6EvpnEvisIter struct { - obj *bgpV6EthernetSegment - bgpV6EvpnEvisSlice []BgpV6EvpnEvis - fieldPtr *[]*otg.BgpV6EvpnEvis -} - -func newBgpV6EthernetSegmentBgpV6EvpnEvisIter(ptr *[]*otg.BgpV6EvpnEvis) BgpV6EthernetSegmentBgpV6EvpnEvisIter { - return &bgpV6EthernetSegmentBgpV6EvpnEvisIter{fieldPtr: ptr} -} - -type BgpV6EthernetSegmentBgpV6EvpnEvisIter interface { - setMsg(*bgpV6EthernetSegment) BgpV6EthernetSegmentBgpV6EvpnEvisIter - Items() []BgpV6EvpnEvis - Add() BgpV6EvpnEvis - Append(items ...BgpV6EvpnEvis) BgpV6EthernetSegmentBgpV6EvpnEvisIter - Set(index int, newObj BgpV6EvpnEvis) BgpV6EthernetSegmentBgpV6EvpnEvisIter - Clear() BgpV6EthernetSegmentBgpV6EvpnEvisIter - clearHolderSlice() BgpV6EthernetSegmentBgpV6EvpnEvisIter - appendHolderSlice(item BgpV6EvpnEvis) BgpV6EthernetSegmentBgpV6EvpnEvisIter -} - -func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) setMsg(msg *bgpV6EthernetSegment) BgpV6EthernetSegmentBgpV6EvpnEvisIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpV6EvpnEvis{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) Items() []BgpV6EvpnEvis { - return obj.bgpV6EvpnEvisSlice -} - -func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) Add() BgpV6EvpnEvis { - newObj := &otg.BgpV6EvpnEvis{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpV6EvpnEvis{obj: newObj} - newLibObj.setDefault() - obj.bgpV6EvpnEvisSlice = append(obj.bgpV6EvpnEvisSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) Append(items ...BgpV6EvpnEvis) BgpV6EthernetSegmentBgpV6EvpnEvisIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpV6EvpnEvisSlice = append(obj.bgpV6EvpnEvisSlice, item) - } - return obj -} - -func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) Set(index int, newObj BgpV6EvpnEvis) BgpV6EthernetSegmentBgpV6EvpnEvisIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpV6EvpnEvisSlice[index] = newObj - return obj -} -func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) Clear() BgpV6EthernetSegmentBgpV6EvpnEvisIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpV6EvpnEvis{} - obj.bgpV6EvpnEvisSlice = []BgpV6EvpnEvis{} - } - return obj -} -func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) clearHolderSlice() BgpV6EthernetSegmentBgpV6EvpnEvisIter { - if len(obj.bgpV6EvpnEvisSlice) > 0 { - obj.bgpV6EvpnEvisSlice = []BgpV6EvpnEvis{} - } - return obj -} -func (obj *bgpV6EthernetSegmentBgpV6EvpnEvisIter) appendHolderSlice(item BgpV6EvpnEvis) BgpV6EthernetSegmentBgpV6EvpnEvisIter { - obj.bgpV6EvpnEvisSlice = append(obj.bgpV6EvpnEvisSlice, item) - return obj -} - -// 10-octet Ethernet Segment Identifier (ESI) Example - For multi-home scenario nonZero ESI is '10000000000000000000' . -// Esi returns a string -func (obj *bgpV6EthernetSegment) Esi() string { - - return *obj.obj.Esi - -} - -// 10-octet Ethernet Segment Identifier (ESI) Example - For multi-home scenario nonZero ESI is '10000000000000000000' . -// Esi returns a string -func (obj *bgpV6EthernetSegment) HasEsi() bool { - return obj.obj.Esi != nil -} - -// 10-octet Ethernet Segment Identifier (ESI) Example - For multi-home scenario nonZero ESI is '10000000000000000000' . -// SetEsi sets the string value in the BgpV6EthernetSegment object -func (obj *bgpV6EthernetSegment) SetEsi(value string) BgpV6EthernetSegment { - - obj.obj.Esi = &value - return obj -} - -type BgpV6EthernetSegmentActiveModeEnum string - -// Enum of ActiveMode on BgpV6EthernetSegment -var BgpV6EthernetSegmentActiveMode = struct { - SINGLE_ACTIVE BgpV6EthernetSegmentActiveModeEnum - ALL_ACTIVE BgpV6EthernetSegmentActiveModeEnum -}{ - SINGLE_ACTIVE: BgpV6EthernetSegmentActiveModeEnum("single_active"), - ALL_ACTIVE: BgpV6EthernetSegmentActiveModeEnum("all_active"), -} - -func (obj *bgpV6EthernetSegment) ActiveMode() BgpV6EthernetSegmentActiveModeEnum { - return BgpV6EthernetSegmentActiveModeEnum(obj.obj.ActiveMode.Enum().String()) -} - -// Single Active or All Active mode Redundancy mode selection for Multi-home. -// ActiveMode returns a string -func (obj *bgpV6EthernetSegment) HasActiveMode() bool { - return obj.obj.ActiveMode != nil -} - -func (obj *bgpV6EthernetSegment) SetActiveMode(value BgpV6EthernetSegmentActiveModeEnum) BgpV6EthernetSegment { - intValue, ok := otg.BgpV6EthernetSegment_ActiveMode_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpV6EthernetSegmentActiveModeEnum", string(value))) - return obj - } - enumValue := otg.BgpV6EthernetSegment_ActiveMode_Enum(intValue) - obj.obj.ActiveMode = &enumValue - - return obj -} - -// The label value to be advertised as ESI Label in ESI Label Extended Community. This is included in Ethernet Auto-discovery per ES Routes advertised by a router. -// EsiLabel returns a uint32 -func (obj *bgpV6EthernetSegment) EsiLabel() uint32 { - - return *obj.obj.EsiLabel - -} - -// The label value to be advertised as ESI Label in ESI Label Extended Community. This is included in Ethernet Auto-discovery per ES Routes advertised by a router. -// EsiLabel returns a uint32 -func (obj *bgpV6EthernetSegment) HasEsiLabel() bool { - return obj.obj.EsiLabel != nil -} - -// The label value to be advertised as ESI Label in ESI Label Extended Community. This is included in Ethernet Auto-discovery per ES Routes advertised by a router. -// SetEsiLabel sets the uint32 value in the BgpV6EthernetSegment object -func (obj *bgpV6EthernetSegment) SetEsiLabel(value uint32) BgpV6EthernetSegment { - - obj.obj.EsiLabel = &value - return obj -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpV6EthernetSegment) Advanced() BgpRouteAdvanced { - if obj.obj.Advanced == nil { - obj.obj.Advanced = NewBgpRouteAdvanced().msg() - } - if obj.advancedHolder == nil { - obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} - } - return obj.advancedHolder -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpV6EthernetSegment) HasAdvanced() bool { - return obj.obj.Advanced != nil -} - -// description is TBD -// SetAdvanced sets the BgpRouteAdvanced value in the BgpV6EthernetSegment object -func (obj *bgpV6EthernetSegment) SetAdvanced(value BgpRouteAdvanced) BgpV6EthernetSegment { - - obj.advancedHolder = nil - obj.obj.Advanced = value.msg() - - return obj -} - -// Optional community settings. -// Communities returns a []BgpCommunity -func (obj *bgpV6EthernetSegment) Communities() BgpV6EthernetSegmentBgpCommunityIter { - if len(obj.obj.Communities) == 0 { - obj.obj.Communities = []*otg.BgpCommunity{} - } - if obj.communitiesHolder == nil { - obj.communitiesHolder = newBgpV6EthernetSegmentBgpCommunityIter(&obj.obj.Communities).setMsg(obj) - } - return obj.communitiesHolder -} - -type bgpV6EthernetSegmentBgpCommunityIter struct { - obj *bgpV6EthernetSegment - bgpCommunitySlice []BgpCommunity - fieldPtr *[]*otg.BgpCommunity -} - -func newBgpV6EthernetSegmentBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpV6EthernetSegmentBgpCommunityIter { - return &bgpV6EthernetSegmentBgpCommunityIter{fieldPtr: ptr} -} - -type BgpV6EthernetSegmentBgpCommunityIter interface { - setMsg(*bgpV6EthernetSegment) BgpV6EthernetSegmentBgpCommunityIter - Items() []BgpCommunity - Add() BgpCommunity - Append(items ...BgpCommunity) BgpV6EthernetSegmentBgpCommunityIter - Set(index int, newObj BgpCommunity) BgpV6EthernetSegmentBgpCommunityIter - Clear() BgpV6EthernetSegmentBgpCommunityIter - clearHolderSlice() BgpV6EthernetSegmentBgpCommunityIter - appendHolderSlice(item BgpCommunity) BgpV6EthernetSegmentBgpCommunityIter -} - -func (obj *bgpV6EthernetSegmentBgpCommunityIter) setMsg(msg *bgpV6EthernetSegment) BgpV6EthernetSegmentBgpCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6EthernetSegmentBgpCommunityIter) Items() []BgpCommunity { - return obj.bgpCommunitySlice -} - -func (obj *bgpV6EthernetSegmentBgpCommunityIter) Add() BgpCommunity { - newObj := &otg.BgpCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6EthernetSegmentBgpCommunityIter) Append(items ...BgpCommunity) BgpV6EthernetSegmentBgpCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - } - return obj -} - -func (obj *bgpV6EthernetSegmentBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpV6EthernetSegmentBgpCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpCommunitySlice[index] = newObj - return obj -} -func (obj *bgpV6EthernetSegmentBgpCommunityIter) Clear() BgpV6EthernetSegmentBgpCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpCommunity{} - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpV6EthernetSegmentBgpCommunityIter) clearHolderSlice() BgpV6EthernetSegmentBgpCommunityIter { - if len(obj.bgpCommunitySlice) > 0 { - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpV6EthernetSegmentBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpV6EthernetSegmentBgpCommunityIter { - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - return obj -} - -// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. -// ExtCommunities returns a []BgpExtCommunity -func (obj *bgpV6EthernetSegment) ExtCommunities() BgpV6EthernetSegmentBgpExtCommunityIter { - if len(obj.obj.ExtCommunities) == 0 { - obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} - } - if obj.extCommunitiesHolder == nil { - obj.extCommunitiesHolder = newBgpV6EthernetSegmentBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) - } - return obj.extCommunitiesHolder -} - -type bgpV6EthernetSegmentBgpExtCommunityIter struct { - obj *bgpV6EthernetSegment - bgpExtCommunitySlice []BgpExtCommunity - fieldPtr *[]*otg.BgpExtCommunity -} - -func newBgpV6EthernetSegmentBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpV6EthernetSegmentBgpExtCommunityIter { - return &bgpV6EthernetSegmentBgpExtCommunityIter{fieldPtr: ptr} -} - -type BgpV6EthernetSegmentBgpExtCommunityIter interface { - setMsg(*bgpV6EthernetSegment) BgpV6EthernetSegmentBgpExtCommunityIter - Items() []BgpExtCommunity - Add() BgpExtCommunity - Append(items ...BgpExtCommunity) BgpV6EthernetSegmentBgpExtCommunityIter - Set(index int, newObj BgpExtCommunity) BgpV6EthernetSegmentBgpExtCommunityIter - Clear() BgpV6EthernetSegmentBgpExtCommunityIter - clearHolderSlice() BgpV6EthernetSegmentBgpExtCommunityIter - appendHolderSlice(item BgpExtCommunity) BgpV6EthernetSegmentBgpExtCommunityIter -} - -func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) setMsg(msg *bgpV6EthernetSegment) BgpV6EthernetSegmentBgpExtCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpExtCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) Items() []BgpExtCommunity { - return obj.bgpExtCommunitySlice -} - -func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) Add() BgpExtCommunity { - newObj := &otg.BgpExtCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpExtCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpV6EthernetSegmentBgpExtCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - } - return obj -} - -func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpV6EthernetSegmentBgpExtCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpExtCommunitySlice[index] = newObj - return obj -} -func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) Clear() BgpV6EthernetSegmentBgpExtCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpExtCommunity{} - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) clearHolderSlice() BgpV6EthernetSegmentBgpExtCommunityIter { - if len(obj.bgpExtCommunitySlice) > 0 { - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpV6EthernetSegmentBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpV6EthernetSegmentBgpExtCommunityIter { - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - return obj -} - -// Optional AS PATH settings. -// AsPath returns a BgpAsPath -func (obj *bgpV6EthernetSegment) AsPath() BgpAsPath { - if obj.obj.AsPath == nil { - obj.obj.AsPath = NewBgpAsPath().msg() - } - if obj.asPathHolder == nil { - obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} - } - return obj.asPathHolder -} - -// Optional AS PATH settings. -// AsPath returns a BgpAsPath -func (obj *bgpV6EthernetSegment) HasAsPath() bool { - return obj.obj.AsPath != nil -} - -// Optional AS PATH settings. -// SetAsPath sets the BgpAsPath value in the BgpV6EthernetSegment object -func (obj *bgpV6EthernetSegment) SetAsPath(value BgpAsPath) BgpV6EthernetSegment { - - obj.asPathHolder = nil - obj.obj.AsPath = value.msg() - - return obj -} - -func (obj *bgpV6EthernetSegment) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.DfElection != nil { - - obj.DfElection().validateObj(vObj, set_default) - } - - if len(obj.obj.Evis) != 0 { - - if set_default { - obj.Evis().clearHolderSlice() - for _, item := range obj.obj.Evis { - obj.Evis().appendHolderSlice(&bgpV6EvpnEvis{obj: item}) - } - } - for _, item := range obj.Evis().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Esi != nil { - - err := obj.validateHex(obj.Esi()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpV6EthernetSegment.Esi")) - } - - } - - if obj.obj.EsiLabel != nil { - - if *obj.obj.EsiLabel > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpV6EthernetSegment.EsiLabel <= 16777215 but Got %d", *obj.obj.EsiLabel)) - } - - } - - if obj.obj.Advanced != nil { - - obj.Advanced().validateObj(vObj, set_default) - } - - if len(obj.obj.Communities) != 0 { - - if set_default { - obj.Communities().clearHolderSlice() - for _, item := range obj.obj.Communities { - obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) - } - } - for _, item := range obj.Communities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.ExtCommunities) != 0 { - - if set_default { - obj.ExtCommunities().clearHolderSlice() - for _, item := range obj.obj.ExtCommunities { - obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) - } - } - for _, item := range obj.ExtCommunities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.AsPath != nil { - - obj.AsPath().validateObj(vObj, set_default) - } - -} - -func (obj *bgpV6EthernetSegment) setDefault() { - if obj.obj.Esi == nil { - obj.SetEsi("00000000000000000000") - } - if obj.obj.ActiveMode == nil { - obj.SetActiveMode(BgpV6EthernetSegmentActiveMode.ALL_ACTIVE) - - } - if obj.obj.EsiLabel == nil { - obj.SetEsiLabel(0) - } - -} - -// ***** VxlanV4TunnelDestinationIPModeUnicast ***** -type vxlanV4TunnelDestinationIPModeUnicast struct { - validation - obj *otg.VxlanV4TunnelDestinationIPModeUnicast - marshaller marshalVxlanV4TunnelDestinationIPModeUnicast - unMarshaller unMarshalVxlanV4TunnelDestinationIPModeUnicast - vtepsHolder VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter -} - -func NewVxlanV4TunnelDestinationIPModeUnicast() VxlanV4TunnelDestinationIPModeUnicast { - obj := vxlanV4TunnelDestinationIPModeUnicast{obj: &otg.VxlanV4TunnelDestinationIPModeUnicast{}} - obj.setDefault() - return &obj -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicast) msg() *otg.VxlanV4TunnelDestinationIPModeUnicast { - return obj.obj -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicast) setMsg(msg *otg.VxlanV4TunnelDestinationIPModeUnicast) VxlanV4TunnelDestinationIPModeUnicast { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalvxlanV4TunnelDestinationIPModeUnicast struct { - obj *vxlanV4TunnelDestinationIPModeUnicast -} - -type marshalVxlanV4TunnelDestinationIPModeUnicast interface { - // ToProto marshals VxlanV4TunnelDestinationIPModeUnicast to protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicast - ToProto() (*otg.VxlanV4TunnelDestinationIPModeUnicast, error) - // ToPbText marshals VxlanV4TunnelDestinationIPModeUnicast to protobuf text - ToPbText() (string, error) - // ToYaml marshals VxlanV4TunnelDestinationIPModeUnicast to YAML text - ToYaml() (string, error) - // ToJson marshals VxlanV4TunnelDestinationIPModeUnicast to JSON text - ToJson() (string, error) -} - -type unMarshalvxlanV4TunnelDestinationIPModeUnicast struct { - obj *vxlanV4TunnelDestinationIPModeUnicast -} - -type unMarshalVxlanV4TunnelDestinationIPModeUnicast interface { - // FromProto unmarshals VxlanV4TunnelDestinationIPModeUnicast from protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicast - FromProto(msg *otg.VxlanV4TunnelDestinationIPModeUnicast) (VxlanV4TunnelDestinationIPModeUnicast, error) - // FromPbText unmarshals VxlanV4TunnelDestinationIPModeUnicast from protobuf text - FromPbText(value string) error - // FromYaml unmarshals VxlanV4TunnelDestinationIPModeUnicast from YAML text - FromYaml(value string) error - // FromJson unmarshals VxlanV4TunnelDestinationIPModeUnicast from JSON text - FromJson(value string) error -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicast) Marshal() marshalVxlanV4TunnelDestinationIPModeUnicast { - if obj.marshaller == nil { - obj.marshaller = &marshalvxlanV4TunnelDestinationIPModeUnicast{obj: obj} - } - return obj.marshaller -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicast) Unmarshal() unMarshalVxlanV4TunnelDestinationIPModeUnicast { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalvxlanV4TunnelDestinationIPModeUnicast{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalvxlanV4TunnelDestinationIPModeUnicast) ToProto() (*otg.VxlanV4TunnelDestinationIPModeUnicast, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalvxlanV4TunnelDestinationIPModeUnicast) FromProto(msg *otg.VxlanV4TunnelDestinationIPModeUnicast) (VxlanV4TunnelDestinationIPModeUnicast, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalvxlanV4TunnelDestinationIPModeUnicast) 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 *unMarshalvxlanV4TunnelDestinationIPModeUnicast) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalvxlanV4TunnelDestinationIPModeUnicast) 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 *unMarshalvxlanV4TunnelDestinationIPModeUnicast) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalvxlanV4TunnelDestinationIPModeUnicast) 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 *unMarshalvxlanV4TunnelDestinationIPModeUnicast) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicast) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicast) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicast) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicast) Clone() (VxlanV4TunnelDestinationIPModeUnicast, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewVxlanV4TunnelDestinationIPModeUnicast() - 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 -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicast) setNil() { - obj.vtepsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// VxlanV4TunnelDestinationIPModeUnicast is description is TBD -type VxlanV4TunnelDestinationIPModeUnicast interface { - Validation - // msg marshals VxlanV4TunnelDestinationIPModeUnicast to protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicast - // and doesn't set defaults - msg() *otg.VxlanV4TunnelDestinationIPModeUnicast - // setMsg unmarshals VxlanV4TunnelDestinationIPModeUnicast from protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicast - // and doesn't set defaults - setMsg(*otg.VxlanV4TunnelDestinationIPModeUnicast) VxlanV4TunnelDestinationIPModeUnicast - // provides marshal interface - Marshal() marshalVxlanV4TunnelDestinationIPModeUnicast - // provides unmarshal interface - Unmarshal() unMarshalVxlanV4TunnelDestinationIPModeUnicast - // validate validates VxlanV4TunnelDestinationIPModeUnicast - validate() error - // A stringer function - String() string - // Clones the object - Clone() (VxlanV4TunnelDestinationIPModeUnicast, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Vteps returns VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIterIter, set in VxlanV4TunnelDestinationIPModeUnicast - Vteps() VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter - setNil() -} - -// List of VTEPs for member VNI(VXLAN Network Identifier) -// Vteps returns a []VxlanV4TunnelDestinationIPModeUnicastVtep -func (obj *vxlanV4TunnelDestinationIPModeUnicast) Vteps() VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { - if len(obj.obj.Vteps) == 0 { - obj.obj.Vteps = []*otg.VxlanV4TunnelDestinationIPModeUnicastVtep{} - } - if obj.vtepsHolder == nil { - obj.vtepsHolder = newVxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter(&obj.obj.Vteps).setMsg(obj) - } - return obj.vtepsHolder -} - -type vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter struct { - obj *vxlanV4TunnelDestinationIPModeUnicast - vxlanV4TunnelDestinationIPModeUnicastVtepSlice []VxlanV4TunnelDestinationIPModeUnicastVtep - fieldPtr *[]*otg.VxlanV4TunnelDestinationIPModeUnicastVtep -} - -func newVxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter(ptr *[]*otg.VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { - return &vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter{fieldPtr: ptr} -} - -type VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter interface { - setMsg(*vxlanV4TunnelDestinationIPModeUnicast) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter - Items() []VxlanV4TunnelDestinationIPModeUnicastVtep - Add() VxlanV4TunnelDestinationIPModeUnicastVtep - Append(items ...VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter - Set(index int, newObj VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter - Clear() VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter - clearHolderSlice() VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter - appendHolderSlice(item VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) setMsg(msg *vxlanV4TunnelDestinationIPModeUnicast) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&vxlanV4TunnelDestinationIPModeUnicastVtep{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) Items() []VxlanV4TunnelDestinationIPModeUnicastVtep { - return obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) Add() VxlanV4TunnelDestinationIPModeUnicastVtep { - newObj := &otg.VxlanV4TunnelDestinationIPModeUnicastVtep{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &vxlanV4TunnelDestinationIPModeUnicastVtep{obj: newObj} - newLibObj.setDefault() - obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice = append(obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice, newLibObj) - return newLibObj -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) Append(items ...VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice = append(obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice, item) - } - return obj -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) Set(index int, newObj VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice[index] = newObj - return obj -} -func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) Clear() VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.VxlanV4TunnelDestinationIPModeUnicastVtep{} - obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice = []VxlanV4TunnelDestinationIPModeUnicastVtep{} - } - return obj -} -func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) clearHolderSlice() VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { - if len(obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice) > 0 { - obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice = []VxlanV4TunnelDestinationIPModeUnicastVtep{} - } - return obj -} -func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) appendHolderSlice(item VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { - obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice = append(obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice, item) - return obj -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicast) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Vteps) != 0 { - - if set_default { - obj.Vteps().clearHolderSlice() - for _, item := range obj.obj.Vteps { - obj.Vteps().appendHolderSlice(&vxlanV4TunnelDestinationIPModeUnicastVtep{obj: item}) - } - } - for _, item := range obj.Vteps().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicast) setDefault() { - -} - -// ***** VxlanV4TunnelDestinationIPModeMulticast ***** -type vxlanV4TunnelDestinationIPModeMulticast struct { - validation - obj *otg.VxlanV4TunnelDestinationIPModeMulticast - marshaller marshalVxlanV4TunnelDestinationIPModeMulticast - unMarshaller unMarshalVxlanV4TunnelDestinationIPModeMulticast -} - -func NewVxlanV4TunnelDestinationIPModeMulticast() VxlanV4TunnelDestinationIPModeMulticast { - obj := vxlanV4TunnelDestinationIPModeMulticast{obj: &otg.VxlanV4TunnelDestinationIPModeMulticast{}} - obj.setDefault() - return &obj -} - -func (obj *vxlanV4TunnelDestinationIPModeMulticast) msg() *otg.VxlanV4TunnelDestinationIPModeMulticast { - return obj.obj -} - -func (obj *vxlanV4TunnelDestinationIPModeMulticast) setMsg(msg *otg.VxlanV4TunnelDestinationIPModeMulticast) VxlanV4TunnelDestinationIPModeMulticast { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalvxlanV4TunnelDestinationIPModeMulticast struct { - obj *vxlanV4TunnelDestinationIPModeMulticast -} - -type marshalVxlanV4TunnelDestinationIPModeMulticast interface { - // ToProto marshals VxlanV4TunnelDestinationIPModeMulticast to protobuf object *otg.VxlanV4TunnelDestinationIPModeMulticast - ToProto() (*otg.VxlanV4TunnelDestinationIPModeMulticast, error) - // ToPbText marshals VxlanV4TunnelDestinationIPModeMulticast to protobuf text - ToPbText() (string, error) - // ToYaml marshals VxlanV4TunnelDestinationIPModeMulticast to YAML text - ToYaml() (string, error) - // ToJson marshals VxlanV4TunnelDestinationIPModeMulticast to JSON text - ToJson() (string, error) -} - -type unMarshalvxlanV4TunnelDestinationIPModeMulticast struct { - obj *vxlanV4TunnelDestinationIPModeMulticast -} - -type unMarshalVxlanV4TunnelDestinationIPModeMulticast interface { - // FromProto unmarshals VxlanV4TunnelDestinationIPModeMulticast from protobuf object *otg.VxlanV4TunnelDestinationIPModeMulticast - FromProto(msg *otg.VxlanV4TunnelDestinationIPModeMulticast) (VxlanV4TunnelDestinationIPModeMulticast, error) - // FromPbText unmarshals VxlanV4TunnelDestinationIPModeMulticast from protobuf text - FromPbText(value string) error - // FromYaml unmarshals VxlanV4TunnelDestinationIPModeMulticast from YAML text - FromYaml(value string) error - // FromJson unmarshals VxlanV4TunnelDestinationIPModeMulticast from JSON text - FromJson(value string) error -} - -func (obj *vxlanV4TunnelDestinationIPModeMulticast) Marshal() marshalVxlanV4TunnelDestinationIPModeMulticast { - if obj.marshaller == nil { - obj.marshaller = &marshalvxlanV4TunnelDestinationIPModeMulticast{obj: obj} - } - return obj.marshaller -} - -func (obj *vxlanV4TunnelDestinationIPModeMulticast) Unmarshal() unMarshalVxlanV4TunnelDestinationIPModeMulticast { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalvxlanV4TunnelDestinationIPModeMulticast{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalvxlanV4TunnelDestinationIPModeMulticast) ToProto() (*otg.VxlanV4TunnelDestinationIPModeMulticast, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalvxlanV4TunnelDestinationIPModeMulticast) FromProto(msg *otg.VxlanV4TunnelDestinationIPModeMulticast) (VxlanV4TunnelDestinationIPModeMulticast, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalvxlanV4TunnelDestinationIPModeMulticast) 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 *unMarshalvxlanV4TunnelDestinationIPModeMulticast) 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 *marshalvxlanV4TunnelDestinationIPModeMulticast) 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 *unMarshalvxlanV4TunnelDestinationIPModeMulticast) 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 *marshalvxlanV4TunnelDestinationIPModeMulticast) 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 *unMarshalvxlanV4TunnelDestinationIPModeMulticast) 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 *vxlanV4TunnelDestinationIPModeMulticast) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *vxlanV4TunnelDestinationIPModeMulticast) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *vxlanV4TunnelDestinationIPModeMulticast) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *vxlanV4TunnelDestinationIPModeMulticast) Clone() (VxlanV4TunnelDestinationIPModeMulticast, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewVxlanV4TunnelDestinationIPModeMulticast() - 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 -} - -// VxlanV4TunnelDestinationIPModeMulticast is multicast Group address for member VNI(VXLAN Network Identifier) -type VxlanV4TunnelDestinationIPModeMulticast interface { - Validation - // msg marshals VxlanV4TunnelDestinationIPModeMulticast to protobuf object *otg.VxlanV4TunnelDestinationIPModeMulticast - // and doesn't set defaults - msg() *otg.VxlanV4TunnelDestinationIPModeMulticast - // setMsg unmarshals VxlanV4TunnelDestinationIPModeMulticast from protobuf object *otg.VxlanV4TunnelDestinationIPModeMulticast - // and doesn't set defaults - setMsg(*otg.VxlanV4TunnelDestinationIPModeMulticast) VxlanV4TunnelDestinationIPModeMulticast - // provides marshal interface - Marshal() marshalVxlanV4TunnelDestinationIPModeMulticast - // provides unmarshal interface - Unmarshal() unMarshalVxlanV4TunnelDestinationIPModeMulticast - // validate validates VxlanV4TunnelDestinationIPModeMulticast - validate() error - // A stringer function - String() string - // Clones the object - Clone() (VxlanV4TunnelDestinationIPModeMulticast, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Address returns string, set in VxlanV4TunnelDestinationIPModeMulticast. - Address() string - // SetAddress assigns string provided by user to VxlanV4TunnelDestinationIPModeMulticast - SetAddress(value string) VxlanV4TunnelDestinationIPModeMulticast - // HasAddress checks if Address has been set in VxlanV4TunnelDestinationIPModeMulticast - HasAddress() bool -} - -// IPv4 Multicast address -// Address returns a string -func (obj *vxlanV4TunnelDestinationIPModeMulticast) Address() string { - - return *obj.obj.Address - -} - -// IPv4 Multicast address -// Address returns a string -func (obj *vxlanV4TunnelDestinationIPModeMulticast) HasAddress() bool { - return obj.obj.Address != nil -} - -// IPv4 Multicast address -// SetAddress sets the string value in the VxlanV4TunnelDestinationIPModeMulticast object -func (obj *vxlanV4TunnelDestinationIPModeMulticast) SetAddress(value string) VxlanV4TunnelDestinationIPModeMulticast { - - obj.obj.Address = &value - return obj -} - -func (obj *vxlanV4TunnelDestinationIPModeMulticast) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Address != nil { - - err := obj.validateIpv4(obj.Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on VxlanV4TunnelDestinationIPModeMulticast.Address")) - } - - } - -} - -func (obj *vxlanV4TunnelDestinationIPModeMulticast) setDefault() { - -} - -// ***** VxlanV6TunnelDestinationIPModeUnicast ***** -type vxlanV6TunnelDestinationIPModeUnicast struct { - validation - obj *otg.VxlanV6TunnelDestinationIPModeUnicast - marshaller marshalVxlanV6TunnelDestinationIPModeUnicast - unMarshaller unMarshalVxlanV6TunnelDestinationIPModeUnicast - vtepsHolder VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter -} - -func NewVxlanV6TunnelDestinationIPModeUnicast() VxlanV6TunnelDestinationIPModeUnicast { - obj := vxlanV6TunnelDestinationIPModeUnicast{obj: &otg.VxlanV6TunnelDestinationIPModeUnicast{}} - obj.setDefault() - return &obj -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicast) msg() *otg.VxlanV6TunnelDestinationIPModeUnicast { - return obj.obj -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicast) setMsg(msg *otg.VxlanV6TunnelDestinationIPModeUnicast) VxlanV6TunnelDestinationIPModeUnicast { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalvxlanV6TunnelDestinationIPModeUnicast struct { - obj *vxlanV6TunnelDestinationIPModeUnicast -} - -type marshalVxlanV6TunnelDestinationIPModeUnicast interface { - // ToProto marshals VxlanV6TunnelDestinationIPModeUnicast to protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicast - ToProto() (*otg.VxlanV6TunnelDestinationIPModeUnicast, error) - // ToPbText marshals VxlanV6TunnelDestinationIPModeUnicast to protobuf text - ToPbText() (string, error) - // ToYaml marshals VxlanV6TunnelDestinationIPModeUnicast to YAML text - ToYaml() (string, error) - // ToJson marshals VxlanV6TunnelDestinationIPModeUnicast to JSON text - ToJson() (string, error) -} - -type unMarshalvxlanV6TunnelDestinationIPModeUnicast struct { - obj *vxlanV6TunnelDestinationIPModeUnicast -} - -type unMarshalVxlanV6TunnelDestinationIPModeUnicast interface { - // FromProto unmarshals VxlanV6TunnelDestinationIPModeUnicast from protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicast - FromProto(msg *otg.VxlanV6TunnelDestinationIPModeUnicast) (VxlanV6TunnelDestinationIPModeUnicast, error) - // FromPbText unmarshals VxlanV6TunnelDestinationIPModeUnicast from protobuf text - FromPbText(value string) error - // FromYaml unmarshals VxlanV6TunnelDestinationIPModeUnicast from YAML text - FromYaml(value string) error - // FromJson unmarshals VxlanV6TunnelDestinationIPModeUnicast from JSON text - FromJson(value string) error -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicast) Marshal() marshalVxlanV6TunnelDestinationIPModeUnicast { - if obj.marshaller == nil { - obj.marshaller = &marshalvxlanV6TunnelDestinationIPModeUnicast{obj: obj} - } - return obj.marshaller -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicast) Unmarshal() unMarshalVxlanV6TunnelDestinationIPModeUnicast { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalvxlanV6TunnelDestinationIPModeUnicast{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalvxlanV6TunnelDestinationIPModeUnicast) ToProto() (*otg.VxlanV6TunnelDestinationIPModeUnicast, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalvxlanV6TunnelDestinationIPModeUnicast) FromProto(msg *otg.VxlanV6TunnelDestinationIPModeUnicast) (VxlanV6TunnelDestinationIPModeUnicast, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalvxlanV6TunnelDestinationIPModeUnicast) 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 *unMarshalvxlanV6TunnelDestinationIPModeUnicast) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalvxlanV6TunnelDestinationIPModeUnicast) 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 *unMarshalvxlanV6TunnelDestinationIPModeUnicast) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalvxlanV6TunnelDestinationIPModeUnicast) 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 *unMarshalvxlanV6TunnelDestinationIPModeUnicast) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicast) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicast) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicast) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicast) Clone() (VxlanV6TunnelDestinationIPModeUnicast, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewVxlanV6TunnelDestinationIPModeUnicast() - 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 -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicast) setNil() { - obj.vtepsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// VxlanV6TunnelDestinationIPModeUnicast is description is TBD -type VxlanV6TunnelDestinationIPModeUnicast interface { - Validation - // msg marshals VxlanV6TunnelDestinationIPModeUnicast to protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicast - // and doesn't set defaults - msg() *otg.VxlanV6TunnelDestinationIPModeUnicast - // setMsg unmarshals VxlanV6TunnelDestinationIPModeUnicast from protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicast - // and doesn't set defaults - setMsg(*otg.VxlanV6TunnelDestinationIPModeUnicast) VxlanV6TunnelDestinationIPModeUnicast - // provides marshal interface - Marshal() marshalVxlanV6TunnelDestinationIPModeUnicast - // provides unmarshal interface - Unmarshal() unMarshalVxlanV6TunnelDestinationIPModeUnicast - // validate validates VxlanV6TunnelDestinationIPModeUnicast - validate() error - // A stringer function - String() string - // Clones the object - Clone() (VxlanV6TunnelDestinationIPModeUnicast, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Vteps returns VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIterIter, set in VxlanV6TunnelDestinationIPModeUnicast - Vteps() VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter - setNil() -} - -// List of VTEPs for member VNI(VXLAN Network Identifier) -// Vteps returns a []VxlanV6TunnelDestinationIPModeUnicastVtep -func (obj *vxlanV6TunnelDestinationIPModeUnicast) Vteps() VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { - if len(obj.obj.Vteps) == 0 { - obj.obj.Vteps = []*otg.VxlanV6TunnelDestinationIPModeUnicastVtep{} - } - if obj.vtepsHolder == nil { - obj.vtepsHolder = newVxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter(&obj.obj.Vteps).setMsg(obj) - } - return obj.vtepsHolder -} - -type vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter struct { - obj *vxlanV6TunnelDestinationIPModeUnicast - vxlanV6TunnelDestinationIPModeUnicastVtepSlice []VxlanV6TunnelDestinationIPModeUnicastVtep - fieldPtr *[]*otg.VxlanV6TunnelDestinationIPModeUnicastVtep -} - -func newVxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter(ptr *[]*otg.VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { - return &vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter{fieldPtr: ptr} -} - -type VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter interface { - setMsg(*vxlanV6TunnelDestinationIPModeUnicast) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter - Items() []VxlanV6TunnelDestinationIPModeUnicastVtep - Add() VxlanV6TunnelDestinationIPModeUnicastVtep - Append(items ...VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter - Set(index int, newObj VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter - Clear() VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter - clearHolderSlice() VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter - appendHolderSlice(item VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) setMsg(msg *vxlanV6TunnelDestinationIPModeUnicast) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&vxlanV6TunnelDestinationIPModeUnicastVtep{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) Items() []VxlanV6TunnelDestinationIPModeUnicastVtep { - return obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) Add() VxlanV6TunnelDestinationIPModeUnicastVtep { - newObj := &otg.VxlanV6TunnelDestinationIPModeUnicastVtep{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &vxlanV6TunnelDestinationIPModeUnicastVtep{obj: newObj} - newLibObj.setDefault() - obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice = append(obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice, newLibObj) - return newLibObj -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) Append(items ...VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice = append(obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice, item) - } - return obj -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) Set(index int, newObj VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice[index] = newObj - return obj -} -func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) Clear() VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.VxlanV6TunnelDestinationIPModeUnicastVtep{} - obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice = []VxlanV6TunnelDestinationIPModeUnicastVtep{} - } - return obj -} -func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) clearHolderSlice() VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { - if len(obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice) > 0 { - obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice = []VxlanV6TunnelDestinationIPModeUnicastVtep{} - } - return obj -} -func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) appendHolderSlice(item VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { - obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice = append(obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice, item) - return obj -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicast) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Vteps) != 0 { - - if set_default { - obj.Vteps().clearHolderSlice() - for _, item := range obj.obj.Vteps { - obj.Vteps().appendHolderSlice(&vxlanV6TunnelDestinationIPModeUnicastVtep{obj: item}) - } - } - for _, item := range obj.Vteps().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicast) setDefault() { - -} - -// ***** VxlanV6TunnelDestinationIPModeMulticast ***** -type vxlanV6TunnelDestinationIPModeMulticast struct { - validation - obj *otg.VxlanV6TunnelDestinationIPModeMulticast - marshaller marshalVxlanV6TunnelDestinationIPModeMulticast - unMarshaller unMarshalVxlanV6TunnelDestinationIPModeMulticast -} - -func NewVxlanV6TunnelDestinationIPModeMulticast() VxlanV6TunnelDestinationIPModeMulticast { - obj := vxlanV6TunnelDestinationIPModeMulticast{obj: &otg.VxlanV6TunnelDestinationIPModeMulticast{}} - obj.setDefault() - return &obj -} - -func (obj *vxlanV6TunnelDestinationIPModeMulticast) msg() *otg.VxlanV6TunnelDestinationIPModeMulticast { - return obj.obj -} - -func (obj *vxlanV6TunnelDestinationIPModeMulticast) setMsg(msg *otg.VxlanV6TunnelDestinationIPModeMulticast) VxlanV6TunnelDestinationIPModeMulticast { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalvxlanV6TunnelDestinationIPModeMulticast struct { - obj *vxlanV6TunnelDestinationIPModeMulticast -} - -type marshalVxlanV6TunnelDestinationIPModeMulticast interface { - // ToProto marshals VxlanV6TunnelDestinationIPModeMulticast to protobuf object *otg.VxlanV6TunnelDestinationIPModeMulticast - ToProto() (*otg.VxlanV6TunnelDestinationIPModeMulticast, error) - // ToPbText marshals VxlanV6TunnelDestinationIPModeMulticast to protobuf text - ToPbText() (string, error) - // ToYaml marshals VxlanV6TunnelDestinationIPModeMulticast to YAML text - ToYaml() (string, error) - // ToJson marshals VxlanV6TunnelDestinationIPModeMulticast to JSON text - ToJson() (string, error) -} - -type unMarshalvxlanV6TunnelDestinationIPModeMulticast struct { - obj *vxlanV6TunnelDestinationIPModeMulticast -} - -type unMarshalVxlanV6TunnelDestinationIPModeMulticast interface { - // FromProto unmarshals VxlanV6TunnelDestinationIPModeMulticast from protobuf object *otg.VxlanV6TunnelDestinationIPModeMulticast - FromProto(msg *otg.VxlanV6TunnelDestinationIPModeMulticast) (VxlanV6TunnelDestinationIPModeMulticast, error) - // FromPbText unmarshals VxlanV6TunnelDestinationIPModeMulticast from protobuf text - FromPbText(value string) error - // FromYaml unmarshals VxlanV6TunnelDestinationIPModeMulticast from YAML text - FromYaml(value string) error - // FromJson unmarshals VxlanV6TunnelDestinationIPModeMulticast from JSON text - FromJson(value string) error -} - -func (obj *vxlanV6TunnelDestinationIPModeMulticast) Marshal() marshalVxlanV6TunnelDestinationIPModeMulticast { - if obj.marshaller == nil { - obj.marshaller = &marshalvxlanV6TunnelDestinationIPModeMulticast{obj: obj} - } - return obj.marshaller -} - -func (obj *vxlanV6TunnelDestinationIPModeMulticast) Unmarshal() unMarshalVxlanV6TunnelDestinationIPModeMulticast { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalvxlanV6TunnelDestinationIPModeMulticast{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalvxlanV6TunnelDestinationIPModeMulticast) ToProto() (*otg.VxlanV6TunnelDestinationIPModeMulticast, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalvxlanV6TunnelDestinationIPModeMulticast) FromProto(msg *otg.VxlanV6TunnelDestinationIPModeMulticast) (VxlanV6TunnelDestinationIPModeMulticast, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalvxlanV6TunnelDestinationIPModeMulticast) 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 *unMarshalvxlanV6TunnelDestinationIPModeMulticast) 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 *marshalvxlanV6TunnelDestinationIPModeMulticast) 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 *unMarshalvxlanV6TunnelDestinationIPModeMulticast) 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 *marshalvxlanV6TunnelDestinationIPModeMulticast) 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 *unMarshalvxlanV6TunnelDestinationIPModeMulticast) 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 *vxlanV6TunnelDestinationIPModeMulticast) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *vxlanV6TunnelDestinationIPModeMulticast) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *vxlanV6TunnelDestinationIPModeMulticast) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *vxlanV6TunnelDestinationIPModeMulticast) Clone() (VxlanV6TunnelDestinationIPModeMulticast, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewVxlanV6TunnelDestinationIPModeMulticast() - 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 -} - -// VxlanV6TunnelDestinationIPModeMulticast is multicast Group address for member VNI(VXLAN Network Identifier) -type VxlanV6TunnelDestinationIPModeMulticast interface { - Validation - // msg marshals VxlanV6TunnelDestinationIPModeMulticast to protobuf object *otg.VxlanV6TunnelDestinationIPModeMulticast - // and doesn't set defaults - msg() *otg.VxlanV6TunnelDestinationIPModeMulticast - // setMsg unmarshals VxlanV6TunnelDestinationIPModeMulticast from protobuf object *otg.VxlanV6TunnelDestinationIPModeMulticast - // and doesn't set defaults - setMsg(*otg.VxlanV6TunnelDestinationIPModeMulticast) VxlanV6TunnelDestinationIPModeMulticast - // provides marshal interface - Marshal() marshalVxlanV6TunnelDestinationIPModeMulticast - // provides unmarshal interface - Unmarshal() unMarshalVxlanV6TunnelDestinationIPModeMulticast - // validate validates VxlanV6TunnelDestinationIPModeMulticast - validate() error - // A stringer function - String() string - // Clones the object - Clone() (VxlanV6TunnelDestinationIPModeMulticast, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Address returns string, set in VxlanV6TunnelDestinationIPModeMulticast. - Address() string - // SetAddress assigns string provided by user to VxlanV6TunnelDestinationIPModeMulticast - SetAddress(value string) VxlanV6TunnelDestinationIPModeMulticast - // HasAddress checks if Address has been set in VxlanV6TunnelDestinationIPModeMulticast - HasAddress() bool -} - -// IPv6 Multicast address -// Address returns a string -func (obj *vxlanV6TunnelDestinationIPModeMulticast) Address() string { - - return *obj.obj.Address - -} - -// IPv6 Multicast address -// Address returns a string -func (obj *vxlanV6TunnelDestinationIPModeMulticast) HasAddress() bool { - return obj.obj.Address != nil -} - -// IPv6 Multicast address -// SetAddress sets the string value in the VxlanV6TunnelDestinationIPModeMulticast object -func (obj *vxlanV6TunnelDestinationIPModeMulticast) SetAddress(value string) VxlanV6TunnelDestinationIPModeMulticast { - - obj.obj.Address = &value - return obj -} - -func (obj *vxlanV6TunnelDestinationIPModeMulticast) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Address != nil { - - err := obj.validateIpv6(obj.Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on VxlanV6TunnelDestinationIPModeMulticast.Address")) - } - - } - -} - -func (obj *vxlanV6TunnelDestinationIPModeMulticast) setDefault() { - -} - -// ***** RsvpSessionAttribute ***** -type rsvpSessionAttribute struct { - validation - obj *otg.RsvpSessionAttribute - marshaller marshalRsvpSessionAttribute - unMarshaller unMarshalRsvpSessionAttribute - resourceAffinitiesHolder RsvpResourceAffinities -} - -func NewRsvpSessionAttribute() RsvpSessionAttribute { - obj := rsvpSessionAttribute{obj: &otg.RsvpSessionAttribute{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpSessionAttribute) msg() *otg.RsvpSessionAttribute { - return obj.obj -} - -func (obj *rsvpSessionAttribute) setMsg(msg *otg.RsvpSessionAttribute) RsvpSessionAttribute { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpSessionAttribute struct { - obj *rsvpSessionAttribute -} - -type marshalRsvpSessionAttribute interface { - // ToProto marshals RsvpSessionAttribute to protobuf object *otg.RsvpSessionAttribute - ToProto() (*otg.RsvpSessionAttribute, error) - // ToPbText marshals RsvpSessionAttribute to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpSessionAttribute to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpSessionAttribute to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpSessionAttribute struct { - obj *rsvpSessionAttribute -} - -type unMarshalRsvpSessionAttribute interface { - // FromProto unmarshals RsvpSessionAttribute from protobuf object *otg.RsvpSessionAttribute - FromProto(msg *otg.RsvpSessionAttribute) (RsvpSessionAttribute, error) - // FromPbText unmarshals RsvpSessionAttribute from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpSessionAttribute from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpSessionAttribute from JSON text - FromJson(value string) error -} - -func (obj *rsvpSessionAttribute) Marshal() marshalRsvpSessionAttribute { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpSessionAttribute{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpSessionAttribute) Unmarshal() unMarshalRsvpSessionAttribute { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpSessionAttribute{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpSessionAttribute) ToProto() (*otg.RsvpSessionAttribute, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpSessionAttribute) FromProto(msg *otg.RsvpSessionAttribute) (RsvpSessionAttribute, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpSessionAttribute) 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 *unMarshalrsvpSessionAttribute) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalrsvpSessionAttribute) 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 *unMarshalrsvpSessionAttribute) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalrsvpSessionAttribute) 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 *unMarshalrsvpSessionAttribute) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *rsvpSessionAttribute) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpSessionAttribute) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpSessionAttribute) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpSessionAttribute) Clone() (RsvpSessionAttribute, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpSessionAttribute() - 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 -} - -func (obj *rsvpSessionAttribute) setNil() { - obj.resourceAffinitiesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// RsvpSessionAttribute is configuration for RSVP-TE SESSION_ATTRIBUTE object included in Path Messages as defined in RFC3209. The bandwidth_protection_desired and node_protection_desired flags are defined in RFC4090 (Fast Reroute). -type RsvpSessionAttribute interface { - Validation - // msg marshals RsvpSessionAttribute to protobuf object *otg.RsvpSessionAttribute - // and doesn't set defaults - msg() *otg.RsvpSessionAttribute - // setMsg unmarshals RsvpSessionAttribute from protobuf object *otg.RsvpSessionAttribute - // and doesn't set defaults - setMsg(*otg.RsvpSessionAttribute) RsvpSessionAttribute - // provides marshal interface - Marshal() marshalRsvpSessionAttribute - // provides unmarshal interface - Unmarshal() unMarshalRsvpSessionAttribute - // validate validates RsvpSessionAttribute - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpSessionAttribute, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // AutoGenerateSessionName returns bool, set in RsvpSessionAttribute. - AutoGenerateSessionName() bool - // SetAutoGenerateSessionName assigns bool provided by user to RsvpSessionAttribute - SetAutoGenerateSessionName(value bool) RsvpSessionAttribute - // HasAutoGenerateSessionName checks if AutoGenerateSessionName has been set in RsvpSessionAttribute - HasAutoGenerateSessionName() bool - // SessionName returns string, set in RsvpSessionAttribute. - SessionName() string - // SetSessionName assigns string provided by user to RsvpSessionAttribute - SetSessionName(value string) RsvpSessionAttribute - // HasSessionName checks if SessionName has been set in RsvpSessionAttribute - HasSessionName() bool - // SetupPriority returns uint32, set in RsvpSessionAttribute. - SetupPriority() uint32 - // SetSetupPriority assigns uint32 provided by user to RsvpSessionAttribute - SetSetupPriority(value uint32) RsvpSessionAttribute - // HasSetupPriority checks if SetupPriority has been set in RsvpSessionAttribute - HasSetupPriority() bool - // HoldingPriority returns uint32, set in RsvpSessionAttribute. - HoldingPriority() uint32 - // SetHoldingPriority assigns uint32 provided by user to RsvpSessionAttribute - SetHoldingPriority(value uint32) RsvpSessionAttribute - // HasHoldingPriority checks if HoldingPriority has been set in RsvpSessionAttribute - HasHoldingPriority() bool - // LocalProtectionDesired returns bool, set in RsvpSessionAttribute. - LocalProtectionDesired() bool - // SetLocalProtectionDesired assigns bool provided by user to RsvpSessionAttribute - SetLocalProtectionDesired(value bool) RsvpSessionAttribute - // HasLocalProtectionDesired checks if LocalProtectionDesired has been set in RsvpSessionAttribute - HasLocalProtectionDesired() bool - // LabelRecordingDesired returns bool, set in RsvpSessionAttribute. - LabelRecordingDesired() bool - // SetLabelRecordingDesired assigns bool provided by user to RsvpSessionAttribute - SetLabelRecordingDesired(value bool) RsvpSessionAttribute - // HasLabelRecordingDesired checks if LabelRecordingDesired has been set in RsvpSessionAttribute - HasLabelRecordingDesired() bool - // SeStyleDesired returns bool, set in RsvpSessionAttribute. - SeStyleDesired() bool - // SetSeStyleDesired assigns bool provided by user to RsvpSessionAttribute - SetSeStyleDesired(value bool) RsvpSessionAttribute - // HasSeStyleDesired checks if SeStyleDesired has been set in RsvpSessionAttribute - HasSeStyleDesired() bool - // BandwidthProtectionDesired returns bool, set in RsvpSessionAttribute. - BandwidthProtectionDesired() bool - // SetBandwidthProtectionDesired assigns bool provided by user to RsvpSessionAttribute - SetBandwidthProtectionDesired(value bool) RsvpSessionAttribute - // HasBandwidthProtectionDesired checks if BandwidthProtectionDesired has been set in RsvpSessionAttribute - HasBandwidthProtectionDesired() bool - // NodeProtectionDesired returns bool, set in RsvpSessionAttribute. - NodeProtectionDesired() bool - // SetNodeProtectionDesired assigns bool provided by user to RsvpSessionAttribute - SetNodeProtectionDesired(value bool) RsvpSessionAttribute - // HasNodeProtectionDesired checks if NodeProtectionDesired has been set in RsvpSessionAttribute - HasNodeProtectionDesired() bool - // ResourceAffinities returns RsvpResourceAffinities, set in RsvpSessionAttribute. - // RsvpResourceAffinities is this is an optional object. If included, the extended SESSION_ATTRIBUTE object is sent in the Path message containing - // the additional fields included in this object. This contains a set of three bitmaps using which further constraints can be - // set on the path calculated for the LSP based on the Admin Group settings in the IGP (e.g ISIS or OSPF interface). - ResourceAffinities() RsvpResourceAffinities - // SetResourceAffinities assigns RsvpResourceAffinities provided by user to RsvpSessionAttribute. - // RsvpResourceAffinities is this is an optional object. If included, the extended SESSION_ATTRIBUTE object is sent in the Path message containing - // the additional fields included in this object. This contains a set of three bitmaps using which further constraints can be - // set on the path calculated for the LSP based on the Admin Group settings in the IGP (e.g ISIS or OSPF interface). - SetResourceAffinities(value RsvpResourceAffinities) RsvpSessionAttribute - // HasResourceAffinities checks if ResourceAffinities has been set in RsvpSessionAttribute - HasResourceAffinities() bool - setNil() -} - -// If this is enabled, an auto-generated Session Name is included in the SESSION_ATTRIBUTE object in the Path Message for this LSP. -// AutoGenerateSessionName returns a bool -func (obj *rsvpSessionAttribute) AutoGenerateSessionName() bool { - - return *obj.obj.AutoGenerateSessionName - -} - -// If this is enabled, an auto-generated Session Name is included in the SESSION_ATTRIBUTE object in the Path Message for this LSP. -// AutoGenerateSessionName returns a bool -func (obj *rsvpSessionAttribute) HasAutoGenerateSessionName() bool { - return obj.obj.AutoGenerateSessionName != nil -} - -// If this is enabled, an auto-generated Session Name is included in the SESSION_ATTRIBUTE object in the Path Message for this LSP. -// SetAutoGenerateSessionName sets the bool value in the RsvpSessionAttribute object -func (obj *rsvpSessionAttribute) SetAutoGenerateSessionName(value bool) RsvpSessionAttribute { - - obj.obj.AutoGenerateSessionName = &value - return obj -} - -// If auto_generate_session_name is set to 'false', then the value of this field is used to fill the Session Name field of the SESSION_ATTRIBUTE object in the Path Message for this LSP. It is suggested to include the Local IP, Remote IP, Tunnel ID and LSP ID in the auto-generated Session Name to ensure uniqueness of the name in the test. The maximum length of session name is 254 bytes. -// SessionName returns a string -func (obj *rsvpSessionAttribute) SessionName() string { - - return *obj.obj.SessionName - -} - -// If auto_generate_session_name is set to 'false', then the value of this field is used to fill the Session Name field of the SESSION_ATTRIBUTE object in the Path Message for this LSP. It is suggested to include the Local IP, Remote IP, Tunnel ID and LSP ID in the auto-generated Session Name to ensure uniqueness of the name in the test. The maximum length of session name is 254 bytes. -// SessionName returns a string -func (obj *rsvpSessionAttribute) HasSessionName() bool { - return obj.obj.SessionName != nil -} - -// If auto_generate_session_name is set to 'false', then the value of this field is used to fill the Session Name field of the SESSION_ATTRIBUTE object in the Path Message for this LSP. It is suggested to include the Local IP, Remote IP, Tunnel ID and LSP ID in the auto-generated Session Name to ensure uniqueness of the name in the test. The maximum length of session name is 254 bytes. -// SetSessionName sets the string value in the RsvpSessionAttribute object -func (obj *rsvpSessionAttribute) SetSessionName(value string) RsvpSessionAttribute { - - obj.obj.SessionName = &value - return obj -} - -// Specifies the value of the Setup Priority field. This controls whether the LSP should pre-empt existing LSP setup with certain Holding Priority if resource limitation is encountered when setting up the LSP. (e.g. bandwidth availability). The value 0 is the highest priority while 7 is the lowest. -// SetupPriority returns a uint32 -func (obj *rsvpSessionAttribute) SetupPriority() uint32 { - - return *obj.obj.SetupPriority - -} - -// Specifies the value of the Setup Priority field. This controls whether the LSP should pre-empt existing LSP setup with certain Holding Priority if resource limitation is encountered when setting up the LSP. (e.g. bandwidth availability). The value 0 is the highest priority while 7 is the lowest. -// SetupPriority returns a uint32 -func (obj *rsvpSessionAttribute) HasSetupPriority() bool { - return obj.obj.SetupPriority != nil -} - -// Specifies the value of the Setup Priority field. This controls whether the LSP should pre-empt existing LSP setup with certain Holding Priority if resource limitation is encountered when setting up the LSP. (e.g. bandwidth availability). The value 0 is the highest priority while 7 is the lowest. -// SetSetupPriority sets the uint32 value in the RsvpSessionAttribute object -func (obj *rsvpSessionAttribute) SetSetupPriority(value uint32) RsvpSessionAttribute { - - obj.obj.SetupPriority = &value - return obj -} - -// Specifies the value of the Holding Priority field. This controls whether a new LSP being created with certain Setup Priority should pre-empt this LSP if resource limitation is encountered when setting up the LSP. (e.g. bandwidth availability). The value 0 is the highest priority while 7 is the lowest. -// HoldingPriority returns a uint32 -func (obj *rsvpSessionAttribute) HoldingPriority() uint32 { - - return *obj.obj.HoldingPriority - -} - -// Specifies the value of the Holding Priority field. This controls whether a new LSP being created with certain Setup Priority should pre-empt this LSP if resource limitation is encountered when setting up the LSP. (e.g. bandwidth availability). The value 0 is the highest priority while 7 is the lowest. -// HoldingPriority returns a uint32 -func (obj *rsvpSessionAttribute) HasHoldingPriority() bool { - return obj.obj.HoldingPriority != nil -} - -// Specifies the value of the Holding Priority field. This controls whether a new LSP being created with certain Setup Priority should pre-empt this LSP if resource limitation is encountered when setting up the LSP. (e.g. bandwidth availability). The value 0 is the highest priority while 7 is the lowest. -// SetHoldingPriority sets the uint32 value in the RsvpSessionAttribute object -func (obj *rsvpSessionAttribute) SetHoldingPriority(value uint32) RsvpSessionAttribute { - - obj.obj.HoldingPriority = &value - return obj -} - -// This flag permits transit routers to use a local repair mechanism which may result in violation of the explicit route object. When a fault is detected on an adjacent downstream link or node, a transit router can reroute traffic for fast service restoration. -// LocalProtectionDesired returns a bool -func (obj *rsvpSessionAttribute) LocalProtectionDesired() bool { - - return *obj.obj.LocalProtectionDesired - -} - -// This flag permits transit routers to use a local repair mechanism which may result in violation of the explicit route object. When a fault is detected on an adjacent downstream link or node, a transit router can reroute traffic for fast service restoration. -// LocalProtectionDesired returns a bool -func (obj *rsvpSessionAttribute) HasLocalProtectionDesired() bool { - return obj.obj.LocalProtectionDesired != nil -} - -// This flag permits transit routers to use a local repair mechanism which may result in violation of the explicit route object. When a fault is detected on an adjacent downstream link or node, a transit router can reroute traffic for fast service restoration. -// SetLocalProtectionDesired sets the bool value in the RsvpSessionAttribute object -func (obj *rsvpSessionAttribute) SetLocalProtectionDesired(value bool) RsvpSessionAttribute { - - obj.obj.LocalProtectionDesired = &value - return obj -} - -// This flag indicates that label information should be included when doing a route record. -// LabelRecordingDesired returns a bool -func (obj *rsvpSessionAttribute) LabelRecordingDesired() bool { - - return *obj.obj.LabelRecordingDesired - -} - -// This flag indicates that label information should be included when doing a route record. -// LabelRecordingDesired returns a bool -func (obj *rsvpSessionAttribute) HasLabelRecordingDesired() bool { - return obj.obj.LabelRecordingDesired != nil -} - -// This flag indicates that label information should be included when doing a route record. -// SetLabelRecordingDesired sets the bool value in the RsvpSessionAttribute object -func (obj *rsvpSessionAttribute) SetLabelRecordingDesired(value bool) RsvpSessionAttribute { - - obj.obj.LabelRecordingDesired = &value - return obj -} - -// This flag indicates that the tunnel ingress node may choose to reroute this tunnel without tearing it down. A tunnel egress node SHOULD use the Shared Explicit(SE) Style when responding with a Resv message. -// SeStyleDesired returns a bool -func (obj *rsvpSessionAttribute) SeStyleDesired() bool { - - return *obj.obj.SeStyleDesired - -} - -// This flag indicates that the tunnel ingress node may choose to reroute this tunnel without tearing it down. A tunnel egress node SHOULD use the Shared Explicit(SE) Style when responding with a Resv message. -// SeStyleDesired returns a bool -func (obj *rsvpSessionAttribute) HasSeStyleDesired() bool { - return obj.obj.SeStyleDesired != nil -} - -// This flag indicates that the tunnel ingress node may choose to reroute this tunnel without tearing it down. A tunnel egress node SHOULD use the Shared Explicit(SE) Style when responding with a Resv message. -// SetSeStyleDesired sets the bool value in the RsvpSessionAttribute object -func (obj *rsvpSessionAttribute) SetSeStyleDesired(value bool) RsvpSessionAttribute { - - obj.obj.SeStyleDesired = &value - return obj -} - -// This flag in the SESSION_ATTRIBUTE object in the Path Message indicates to the PLRs along the protected LSP path that a backup path with a bandwidth guarantee is desired. This bandwidth has to be guaranteed for the protected LSP, if no FAST_REROUTE object is included in the PATH message. If a FAST_REROUTE object is present in the Path message, then the bandwidth specified therein is to be guaranteed. -// BandwidthProtectionDesired returns a bool -func (obj *rsvpSessionAttribute) BandwidthProtectionDesired() bool { - - return *obj.obj.BandwidthProtectionDesired - -} - -// This flag in the SESSION_ATTRIBUTE object in the Path Message indicates to the PLRs along the protected LSP path that a backup path with a bandwidth guarantee is desired. This bandwidth has to be guaranteed for the protected LSP, if no FAST_REROUTE object is included in the PATH message. If a FAST_REROUTE object is present in the Path message, then the bandwidth specified therein is to be guaranteed. -// BandwidthProtectionDesired returns a bool -func (obj *rsvpSessionAttribute) HasBandwidthProtectionDesired() bool { - return obj.obj.BandwidthProtectionDesired != nil -} - -// This flag in the SESSION_ATTRIBUTE object in the Path Message indicates to the PLRs along the protected LSP path that a backup path with a bandwidth guarantee is desired. This bandwidth has to be guaranteed for the protected LSP, if no FAST_REROUTE object is included in the PATH message. If a FAST_REROUTE object is present in the Path message, then the bandwidth specified therein is to be guaranteed. -// SetBandwidthProtectionDesired sets the bool value in the RsvpSessionAttribute object -func (obj *rsvpSessionAttribute) SetBandwidthProtectionDesired(value bool) RsvpSessionAttribute { - - obj.obj.BandwidthProtectionDesired = &value - return obj -} - -// This flag in the SESSION_ATTRIBUTE object in the Path Message indicates to the PLRs along a protected LSP path that it is desired to have a backup path that bypasses at least the next node of the protected LSP. -// NodeProtectionDesired returns a bool -func (obj *rsvpSessionAttribute) NodeProtectionDesired() bool { - - return *obj.obj.NodeProtectionDesired - -} - -// This flag in the SESSION_ATTRIBUTE object in the Path Message indicates to the PLRs along a protected LSP path that it is desired to have a backup path that bypasses at least the next node of the protected LSP. -// NodeProtectionDesired returns a bool -func (obj *rsvpSessionAttribute) HasNodeProtectionDesired() bool { - return obj.obj.NodeProtectionDesired != nil -} - -// This flag in the SESSION_ATTRIBUTE object in the Path Message indicates to the PLRs along a protected LSP path that it is desired to have a backup path that bypasses at least the next node of the protected LSP. -// SetNodeProtectionDesired sets the bool value in the RsvpSessionAttribute object -func (obj *rsvpSessionAttribute) SetNodeProtectionDesired(value bool) RsvpSessionAttribute { - - obj.obj.NodeProtectionDesired = &value - return obj -} - -// This is an optional object. If included the extended SESSION_ATTRIBUTE object is sent in the Path message containing -// the additional fields included in this object. This contains a set of three bitmaps using which further constraints can be -// set on the path calculated for the LSP based on the Admin Group settings in the IGP (e.g ISIS or OSPF interface). -// ResourceAffinities returns a RsvpResourceAffinities -func (obj *rsvpSessionAttribute) ResourceAffinities() RsvpResourceAffinities { - if obj.obj.ResourceAffinities == nil { - obj.obj.ResourceAffinities = NewRsvpResourceAffinities().msg() - } - if obj.resourceAffinitiesHolder == nil { - obj.resourceAffinitiesHolder = &rsvpResourceAffinities{obj: obj.obj.ResourceAffinities} - } - return obj.resourceAffinitiesHolder -} - -// This is an optional object. If included the extended SESSION_ATTRIBUTE object is sent in the Path message containing -// the additional fields included in this object. This contains a set of three bitmaps using which further constraints can be -// set on the path calculated for the LSP based on the Admin Group settings in the IGP (e.g ISIS or OSPF interface). -// ResourceAffinities returns a RsvpResourceAffinities -func (obj *rsvpSessionAttribute) HasResourceAffinities() bool { - return obj.obj.ResourceAffinities != nil -} - -// This is an optional object. If included the extended SESSION_ATTRIBUTE object is sent in the Path message containing -// the additional fields included in this object. This contains a set of three bitmaps using which further constraints can be -// set on the path calculated for the LSP based on the Admin Group settings in the IGP (e.g ISIS or OSPF interface). -// SetResourceAffinities sets the RsvpResourceAffinities value in the RsvpSessionAttribute object -func (obj *rsvpSessionAttribute) SetResourceAffinities(value RsvpResourceAffinities) RsvpSessionAttribute { - - obj.resourceAffinitiesHolder = nil - obj.obj.ResourceAffinities = value.msg() - - return obj -} - -func (obj *rsvpSessionAttribute) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.SessionName != nil { - - if len(*obj.obj.SessionName) < 0 || len(*obj.obj.SessionName) > 254 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of RsvpSessionAttribute.SessionName <= 254 but Got %d", - len(*obj.obj.SessionName))) - } - - } - - if obj.obj.SetupPriority != nil { - - if *obj.obj.SetupPriority > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpSessionAttribute.SetupPriority <= 7 but Got %d", *obj.obj.SetupPriority)) - } - - } - - if obj.obj.HoldingPriority != nil { - - if *obj.obj.HoldingPriority > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpSessionAttribute.HoldingPriority <= 7 but Got %d", *obj.obj.HoldingPriority)) - } - - } - - if obj.obj.ResourceAffinities != nil { - - obj.ResourceAffinities().validateObj(vObj, set_default) - } - -} - -func (obj *rsvpSessionAttribute) setDefault() { - if obj.obj.AutoGenerateSessionName == nil { - obj.SetAutoGenerateSessionName(true) - } - if obj.obj.SetupPriority == nil { - obj.SetSetupPriority(7) - } - if obj.obj.HoldingPriority == nil { - obj.SetHoldingPriority(7) - } - if obj.obj.LocalProtectionDesired == nil { - obj.SetLocalProtectionDesired(false) - } - if obj.obj.LabelRecordingDesired == nil { - obj.SetLabelRecordingDesired(false) - } - if obj.obj.SeStyleDesired == nil { - obj.SetSeStyleDesired(false) - } - if obj.obj.BandwidthProtectionDesired == nil { - obj.SetBandwidthProtectionDesired(false) - } - if obj.obj.NodeProtectionDesired == nil { - obj.SetNodeProtectionDesired(false) - } - -} - -// ***** RsvpTspec ***** -type rsvpTspec struct { - validation - obj *otg.RsvpTspec - marshaller marshalRsvpTspec - unMarshaller unMarshalRsvpTspec -} - -func NewRsvpTspec() RsvpTspec { - obj := rsvpTspec{obj: &otg.RsvpTspec{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpTspec) msg() *otg.RsvpTspec { - return obj.obj -} - -func (obj *rsvpTspec) setMsg(msg *otg.RsvpTspec) RsvpTspec { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpTspec struct { - obj *rsvpTspec -} - -type marshalRsvpTspec interface { - // ToProto marshals RsvpTspec to protobuf object *otg.RsvpTspec - ToProto() (*otg.RsvpTspec, error) - // ToPbText marshals RsvpTspec to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpTspec to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpTspec to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpTspec struct { - obj *rsvpTspec -} - -type unMarshalRsvpTspec interface { - // FromProto unmarshals RsvpTspec from protobuf object *otg.RsvpTspec - FromProto(msg *otg.RsvpTspec) (RsvpTspec, error) - // FromPbText unmarshals RsvpTspec from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpTspec from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpTspec from JSON text - FromJson(value string) error -} - -func (obj *rsvpTspec) Marshal() marshalRsvpTspec { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpTspec{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpTspec) Unmarshal() unMarshalRsvpTspec { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpTspec{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpTspec) ToProto() (*otg.RsvpTspec, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpTspec) FromProto(msg *otg.RsvpTspec) (RsvpTspec, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpTspec) 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 *unMarshalrsvpTspec) 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 *marshalrsvpTspec) 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 *unMarshalrsvpTspec) 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 *marshalrsvpTspec) 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 *unMarshalrsvpTspec) 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 *rsvpTspec) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpTspec) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpTspec) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpTspec) Clone() (RsvpTspec, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpTspec() - 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 -} - -// RsvpTspec is configuration for RSVP-TE TSPEC object included in Path Messages. The usage of these parameters is defined in RFC2215. -type RsvpTspec interface { - Validation - // msg marshals RsvpTspec to protobuf object *otg.RsvpTspec - // and doesn't set defaults - msg() *otg.RsvpTspec - // setMsg unmarshals RsvpTspec from protobuf object *otg.RsvpTspec - // and doesn't set defaults - setMsg(*otg.RsvpTspec) RsvpTspec - // provides marshal interface - Marshal() marshalRsvpTspec - // provides unmarshal interface - Unmarshal() unMarshalRsvpTspec - // validate validates RsvpTspec - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpTspec, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // TokenBucketRate returns float32, set in RsvpTspec. - TokenBucketRate() float32 - // SetTokenBucketRate assigns float32 provided by user to RsvpTspec - SetTokenBucketRate(value float32) RsvpTspec - // HasTokenBucketRate checks if TokenBucketRate has been set in RsvpTspec - HasTokenBucketRate() bool - // TokenBucketSize returns float32, set in RsvpTspec. - TokenBucketSize() float32 - // SetTokenBucketSize assigns float32 provided by user to RsvpTspec - SetTokenBucketSize(value float32) RsvpTspec - // HasTokenBucketSize checks if TokenBucketSize has been set in RsvpTspec - HasTokenBucketSize() bool - // PeakDataRate returns float32, set in RsvpTspec. - PeakDataRate() float32 - // SetPeakDataRate assigns float32 provided by user to RsvpTspec - SetPeakDataRate(value float32) RsvpTspec - // HasPeakDataRate checks if PeakDataRate has been set in RsvpTspec - HasPeakDataRate() bool - // MinimumPolicedUnit returns uint32, set in RsvpTspec. - MinimumPolicedUnit() uint32 - // SetMinimumPolicedUnit assigns uint32 provided by user to RsvpTspec - SetMinimumPolicedUnit(value uint32) RsvpTspec - // HasMinimumPolicedUnit checks if MinimumPolicedUnit has been set in RsvpTspec - HasMinimumPolicedUnit() bool - // MaximumPolicedUnit returns uint32, set in RsvpTspec. - MaximumPolicedUnit() uint32 - // SetMaximumPolicedUnit assigns uint32 provided by user to RsvpTspec - SetMaximumPolicedUnit(value uint32) RsvpTspec - // HasMaximumPolicedUnit checks if MaximumPolicedUnit has been set in RsvpTspec - HasMaximumPolicedUnit() bool -} - -// The rate of the traffic to be carried in this LSP in bytes per second. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. -// TokenBucketRate returns a float32 -func (obj *rsvpTspec) TokenBucketRate() float32 { - - return *obj.obj.TokenBucketRate - -} - -// The rate of the traffic to be carried in this LSP in bytes per second. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. -// TokenBucketRate returns a float32 -func (obj *rsvpTspec) HasTokenBucketRate() bool { - return obj.obj.TokenBucketRate != nil -} - -// The rate of the traffic to be carried in this LSP in bytes per second. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. -// SetTokenBucketRate sets the float32 value in the RsvpTspec object -func (obj *rsvpTspec) SetTokenBucketRate(value float32) RsvpTspec { - - obj.obj.TokenBucketRate = &value - return obj -} - -// The depth of the token bucket in bytes used to specify the Token Bucket characteristics of the traffic to be carried in the LSP. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. -// TokenBucketSize returns a float32 -func (obj *rsvpTspec) TokenBucketSize() float32 { - - return *obj.obj.TokenBucketSize - -} - -// The depth of the token bucket in bytes used to specify the Token Bucket characteristics of the traffic to be carried in the LSP. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. -// TokenBucketSize returns a float32 -func (obj *rsvpTspec) HasTokenBucketSize() bool { - return obj.obj.TokenBucketSize != nil -} - -// The depth of the token bucket in bytes used to specify the Token Bucket characteristics of the traffic to be carried in the LSP. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. -// SetTokenBucketSize sets the float32 value in the RsvpTspec object -func (obj *rsvpTspec) SetTokenBucketSize(value float32) RsvpTspec { - - obj.obj.TokenBucketSize = &value - return obj -} - -// The peak data rate of the traffic in bytes per second used to specify the Token Bucket characteristics of the traffic to be carried in the LSP. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. -// PeakDataRate returns a float32 -func (obj *rsvpTspec) PeakDataRate() float32 { - - return *obj.obj.PeakDataRate - -} - -// The peak data rate of the traffic in bytes per second used to specify the Token Bucket characteristics of the traffic to be carried in the LSP. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. -// PeakDataRate returns a float32 -func (obj *rsvpTspec) HasPeakDataRate() bool { - return obj.obj.PeakDataRate != nil -} - -// The peak data rate of the traffic in bytes per second used to specify the Token Bucket characteristics of the traffic to be carried in the LSP. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. -// SetPeakDataRate sets the float32 value in the RsvpTspec object -func (obj *rsvpTspec) SetPeakDataRate(value float32) RsvpTspec { - - obj.obj.PeakDataRate = &value - return obj -} - -// Specifies the minium length of packet frames that will be policed. -// MinimumPolicedUnit returns a uint32 -func (obj *rsvpTspec) MinimumPolicedUnit() uint32 { - - return *obj.obj.MinimumPolicedUnit - -} - -// Specifies the minium length of packet frames that will be policed. -// MinimumPolicedUnit returns a uint32 -func (obj *rsvpTspec) HasMinimumPolicedUnit() bool { - return obj.obj.MinimumPolicedUnit != nil -} - -// Specifies the minium length of packet frames that will be policed. -// SetMinimumPolicedUnit sets the uint32 value in the RsvpTspec object -func (obj *rsvpTspec) SetMinimumPolicedUnit(value uint32) RsvpTspec { - - obj.obj.MinimumPolicedUnit = &value - return obj -} - -// Specifies the maximum length of packet frames that will be policed. -// MaximumPolicedUnit returns a uint32 -func (obj *rsvpTspec) MaximumPolicedUnit() uint32 { - - return *obj.obj.MaximumPolicedUnit - -} - -// Specifies the maximum length of packet frames that will be policed. -// MaximumPolicedUnit returns a uint32 -func (obj *rsvpTspec) HasMaximumPolicedUnit() bool { - return obj.obj.MaximumPolicedUnit != nil -} - -// Specifies the maximum length of packet frames that will be policed. -// SetMaximumPolicedUnit sets the uint32 value in the RsvpTspec object -func (obj *rsvpTspec) SetMaximumPolicedUnit(value uint32) RsvpTspec { - - obj.obj.MaximumPolicedUnit = &value - return obj -} - -func (obj *rsvpTspec) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.MinimumPolicedUnit != nil { - - if *obj.obj.MinimumPolicedUnit > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpTspec.MinimumPolicedUnit <= 65535 but Got %d", *obj.obj.MinimumPolicedUnit)) - } - - } - - if obj.obj.MaximumPolicedUnit != nil { - - if *obj.obj.MaximumPolicedUnit > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpTspec.MaximumPolicedUnit <= 65535 but Got %d", *obj.obj.MaximumPolicedUnit)) - } - - } - -} - -func (obj *rsvpTspec) setDefault() { - if obj.obj.TokenBucketRate == nil { - obj.SetTokenBucketRate(0) - } - if obj.obj.TokenBucketSize == nil { - obj.SetTokenBucketSize(0) - } - if obj.obj.PeakDataRate == nil { - obj.SetPeakDataRate(0) - } - if obj.obj.MinimumPolicedUnit == nil { - obj.SetMinimumPolicedUnit(0) - } - if obj.obj.MaximumPolicedUnit == nil { - obj.SetMaximumPolicedUnit(0) - } - -} - -// ***** RsvpFastReroute ***** -type rsvpFastReroute struct { - validation - obj *otg.RsvpFastReroute - marshaller marshalRsvpFastReroute - unMarshaller unMarshalRsvpFastReroute -} - -func NewRsvpFastReroute() RsvpFastReroute { - obj := rsvpFastReroute{obj: &otg.RsvpFastReroute{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpFastReroute) msg() *otg.RsvpFastReroute { - return obj.obj -} - -func (obj *rsvpFastReroute) setMsg(msg *otg.RsvpFastReroute) RsvpFastReroute { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpFastReroute struct { - obj *rsvpFastReroute -} - -type marshalRsvpFastReroute interface { - // ToProto marshals RsvpFastReroute to protobuf object *otg.RsvpFastReroute - ToProto() (*otg.RsvpFastReroute, error) - // ToPbText marshals RsvpFastReroute to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpFastReroute to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpFastReroute to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpFastReroute struct { - obj *rsvpFastReroute -} - -type unMarshalRsvpFastReroute interface { - // FromProto unmarshals RsvpFastReroute from protobuf object *otg.RsvpFastReroute - FromProto(msg *otg.RsvpFastReroute) (RsvpFastReroute, error) - // FromPbText unmarshals RsvpFastReroute from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpFastReroute from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpFastReroute from JSON text - FromJson(value string) error -} - -func (obj *rsvpFastReroute) Marshal() marshalRsvpFastReroute { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpFastReroute{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpFastReroute) Unmarshal() unMarshalRsvpFastReroute { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpFastReroute{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpFastReroute) ToProto() (*otg.RsvpFastReroute, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpFastReroute) FromProto(msg *otg.RsvpFastReroute) (RsvpFastReroute, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpFastReroute) 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 *unMarshalrsvpFastReroute) 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 *marshalrsvpFastReroute) 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 *unMarshalrsvpFastReroute) 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 *marshalrsvpFastReroute) 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 *unMarshalrsvpFastReroute) 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 *rsvpFastReroute) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpFastReroute) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpFastReroute) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpFastReroute) Clone() (RsvpFastReroute, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpFastReroute() - 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 -} - -// RsvpFastReroute is configuration for the optional RSVP-TE FAST_REROUTE object included in Path Messages as defined in RFC4090. -type RsvpFastReroute interface { - Validation - // msg marshals RsvpFastReroute to protobuf object *otg.RsvpFastReroute - // and doesn't set defaults - msg() *otg.RsvpFastReroute - // setMsg unmarshals RsvpFastReroute from protobuf object *otg.RsvpFastReroute - // and doesn't set defaults - setMsg(*otg.RsvpFastReroute) RsvpFastReroute - // provides marshal interface - Marshal() marshalRsvpFastReroute - // provides unmarshal interface - Unmarshal() unMarshalRsvpFastReroute - // validate validates RsvpFastReroute - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpFastReroute, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // SetupPriority returns uint32, set in RsvpFastReroute. - SetupPriority() uint32 - // SetSetupPriority assigns uint32 provided by user to RsvpFastReroute - SetSetupPriority(value uint32) RsvpFastReroute - // HasSetupPriority checks if SetupPriority has been set in RsvpFastReroute - HasSetupPriority() bool - // HoldingPriority returns uint32, set in RsvpFastReroute. - HoldingPriority() uint32 - // SetHoldingPriority assigns uint32 provided by user to RsvpFastReroute - SetHoldingPriority(value uint32) RsvpFastReroute - // HasHoldingPriority checks if HoldingPriority has been set in RsvpFastReroute - HasHoldingPriority() bool - // HopLimit returns uint32, set in RsvpFastReroute. - HopLimit() uint32 - // SetHopLimit assigns uint32 provided by user to RsvpFastReroute - SetHopLimit(value uint32) RsvpFastReroute - // HasHopLimit checks if HopLimit has been set in RsvpFastReroute - HasHopLimit() bool - // Bandwidth returns float32, set in RsvpFastReroute. - Bandwidth() float32 - // SetBandwidth assigns float32 provided by user to RsvpFastReroute - SetBandwidth(value float32) RsvpFastReroute - // HasBandwidth checks if Bandwidth has been set in RsvpFastReroute - HasBandwidth() bool - // ExcludeAny returns string, set in RsvpFastReroute. - ExcludeAny() string - // SetExcludeAny assigns string provided by user to RsvpFastReroute - SetExcludeAny(value string) RsvpFastReroute - // HasExcludeAny checks if ExcludeAny has been set in RsvpFastReroute - HasExcludeAny() bool - // IncludeAny returns string, set in RsvpFastReroute. - IncludeAny() string - // SetIncludeAny assigns string provided by user to RsvpFastReroute - SetIncludeAny(value string) RsvpFastReroute - // HasIncludeAny checks if IncludeAny has been set in RsvpFastReroute - HasIncludeAny() bool - // IncludeAll returns string, set in RsvpFastReroute. - IncludeAll() string - // SetIncludeAll assigns string provided by user to RsvpFastReroute - SetIncludeAll(value string) RsvpFastReroute - // HasIncludeAll checks if IncludeAll has been set in RsvpFastReroute - HasIncludeAll() bool - // OneToOneBackupDesired returns bool, set in RsvpFastReroute. - OneToOneBackupDesired() bool - // SetOneToOneBackupDesired assigns bool provided by user to RsvpFastReroute - SetOneToOneBackupDesired(value bool) RsvpFastReroute - // HasOneToOneBackupDesired checks if OneToOneBackupDesired has been set in RsvpFastReroute - HasOneToOneBackupDesired() bool - // FacilityBackupDesired returns bool, set in RsvpFastReroute. - FacilityBackupDesired() bool - // SetFacilityBackupDesired assigns bool provided by user to RsvpFastReroute - SetFacilityBackupDesired(value bool) RsvpFastReroute - // HasFacilityBackupDesired checks if FacilityBackupDesired has been set in RsvpFastReroute - HasFacilityBackupDesired() bool -} - -// Specifies the value of the Setup Priority field. This controls whether the backup LSP should pre-empt existing LSP that is setup with certain Holding Priority. While setting up a backup LSP, preemption of existing LSP can happen if resource limitation is encountered (e.g bandwidth availability). -// SetupPriority returns a uint32 -func (obj *rsvpFastReroute) SetupPriority() uint32 { - - return *obj.obj.SetupPriority - -} - -// Specifies the value of the Setup Priority field. This controls whether the backup LSP should pre-empt existing LSP that is setup with certain Holding Priority. While setting up a backup LSP, preemption of existing LSP can happen if resource limitation is encountered (e.g bandwidth availability). -// SetupPriority returns a uint32 -func (obj *rsvpFastReroute) HasSetupPriority() bool { - return obj.obj.SetupPriority != nil -} - -// Specifies the value of the Setup Priority field. This controls whether the backup LSP should pre-empt existing LSP that is setup with certain Holding Priority. While setting up a backup LSP, preemption of existing LSP can happen if resource limitation is encountered (e.g bandwidth availability). -// SetSetupPriority sets the uint32 value in the RsvpFastReroute object -func (obj *rsvpFastReroute) SetSetupPriority(value uint32) RsvpFastReroute { - - obj.obj.SetupPriority = &value - return obj -} - -// Specifies the value of the Holding Priority field. This controls whether a new LSP being created with certain Setup Priority should pre-empt this LSP set up with this Holding Priority. While setting up a new LSP, preemption of existing LSP can happen if resource limitation is encountered (e.g bandwidth availability). -// HoldingPriority returns a uint32 -func (obj *rsvpFastReroute) HoldingPriority() uint32 { - - return *obj.obj.HoldingPriority - -} - -// Specifies the value of the Holding Priority field. This controls whether a new LSP being created with certain Setup Priority should pre-empt this LSP set up with this Holding Priority. While setting up a new LSP, preemption of existing LSP can happen if resource limitation is encountered (e.g bandwidth availability). -// HoldingPriority returns a uint32 -func (obj *rsvpFastReroute) HasHoldingPriority() bool { - return obj.obj.HoldingPriority != nil -} - -// Specifies the value of the Holding Priority field. This controls whether a new LSP being created with certain Setup Priority should pre-empt this LSP set up with this Holding Priority. While setting up a new LSP, preemption of existing LSP can happen if resource limitation is encountered (e.g bandwidth availability). -// SetHoldingPriority sets the uint32 value in the RsvpFastReroute object -func (obj *rsvpFastReroute) SetHoldingPriority(value uint32) RsvpFastReroute { - - obj.obj.HoldingPriority = &value - return obj -} - -// Specifies the value of the Hop Limit field. This controls the maximum number of hops the LSP should traverse to reach the LSP end-point. -// HopLimit returns a uint32 -func (obj *rsvpFastReroute) HopLimit() uint32 { - - return *obj.obj.HopLimit - -} - -// Specifies the value of the Hop Limit field. This controls the maximum number of hops the LSP should traverse to reach the LSP end-point. -// HopLimit returns a uint32 -func (obj *rsvpFastReroute) HasHopLimit() bool { - return obj.obj.HopLimit != nil -} - -// Specifies the value of the Hop Limit field. This controls the maximum number of hops the LSP should traverse to reach the LSP end-point. -// SetHopLimit sets the uint32 value in the RsvpFastReroute object -func (obj *rsvpFastReroute) SetHopLimit(value uint32) RsvpFastReroute { - - obj.obj.HopLimit = &value - return obj -} - -// Specifies the value of the Bandwidth field as a 32-bit IEEE floating point integer, in bytes per second, as desired for the LSP. -// Bandwidth returns a float32 -func (obj *rsvpFastReroute) Bandwidth() float32 { - - return *obj.obj.Bandwidth - -} - -// Specifies the value of the Bandwidth field as a 32-bit IEEE floating point integer, in bytes per second, as desired for the LSP. -// Bandwidth returns a float32 -func (obj *rsvpFastReroute) HasBandwidth() bool { - return obj.obj.Bandwidth != nil -} - -// Specifies the value of the Bandwidth field as a 32-bit IEEE floating point integer, in bytes per second, as desired for the LSP. -// SetBandwidth sets the float32 value in the RsvpFastReroute object -func (obj *rsvpFastReroute) SetBandwidth(value float32) RsvpFastReroute { - - obj.obj.Bandwidth = &value - return obj -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// ExcludeAny returns a string -func (obj *rsvpFastReroute) ExcludeAny() string { - - return *obj.obj.ExcludeAny - -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// ExcludeAny returns a string -func (obj *rsvpFastReroute) HasExcludeAny() bool { - return obj.obj.ExcludeAny != nil -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// SetExcludeAny sets the string value in the RsvpFastReroute object -func (obj *rsvpFastReroute) SetExcludeAny(value string) RsvpFastReroute { - - obj.obj.ExcludeAny = &value - return obj -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// IncludeAny returns a string -func (obj *rsvpFastReroute) IncludeAny() string { - - return *obj.obj.IncludeAny - -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// IncludeAny returns a string -func (obj *rsvpFastReroute) HasIncludeAny() bool { - return obj.obj.IncludeAny != nil -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// SetIncludeAny sets the string value in the RsvpFastReroute object -func (obj *rsvpFastReroute) SetIncludeAny(value string) RsvpFastReroute { - - obj.obj.IncludeAny = &value - return obj -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// IncludeAll returns a string -func (obj *rsvpFastReroute) IncludeAll() string { - - return *obj.obj.IncludeAll - -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// IncludeAll returns a string -func (obj *rsvpFastReroute) HasIncludeAll() bool { - return obj.obj.IncludeAll != nil -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// SetIncludeAll sets the string value in the RsvpFastReroute object -func (obj *rsvpFastReroute) SetIncludeAll(value string) RsvpFastReroute { - - obj.obj.IncludeAll = &value - return obj -} - -// Requests protection via the one-to-one backup method. -// OneToOneBackupDesired returns a bool -func (obj *rsvpFastReroute) OneToOneBackupDesired() bool { - - return *obj.obj.OneToOneBackupDesired - -} - -// Requests protection via the one-to-one backup method. -// OneToOneBackupDesired returns a bool -func (obj *rsvpFastReroute) HasOneToOneBackupDesired() bool { - return obj.obj.OneToOneBackupDesired != nil -} - -// Requests protection via the one-to-one backup method. -// SetOneToOneBackupDesired sets the bool value in the RsvpFastReroute object -func (obj *rsvpFastReroute) SetOneToOneBackupDesired(value bool) RsvpFastReroute { - - obj.obj.OneToOneBackupDesired = &value - return obj -} - -// Requests protection via the facility backup method. -// FacilityBackupDesired returns a bool -func (obj *rsvpFastReroute) FacilityBackupDesired() bool { - - return *obj.obj.FacilityBackupDesired - -} - -// Requests protection via the facility backup method. -// FacilityBackupDesired returns a bool -func (obj *rsvpFastReroute) HasFacilityBackupDesired() bool { - return obj.obj.FacilityBackupDesired != nil -} - -// Requests protection via the facility backup method. -// SetFacilityBackupDesired sets the bool value in the RsvpFastReroute object -func (obj *rsvpFastReroute) SetFacilityBackupDesired(value bool) RsvpFastReroute { - - obj.obj.FacilityBackupDesired = &value - return obj -} - -func (obj *rsvpFastReroute) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.SetupPriority != nil { - - if *obj.obj.SetupPriority > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpFastReroute.SetupPriority <= 7 but Got %d", *obj.obj.SetupPriority)) - } - - } - - if obj.obj.HoldingPriority != nil { - - if *obj.obj.HoldingPriority > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpFastReroute.HoldingPriority <= 7 but Got %d", *obj.obj.HoldingPriority)) - } - - } - - if obj.obj.HopLimit != nil { - - if *obj.obj.HopLimit > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpFastReroute.HopLimit <= 255 but Got %d", *obj.obj.HopLimit)) - } - - } - - if obj.obj.ExcludeAny != nil { - - if len(*obj.obj.ExcludeAny) < 0 || len(*obj.obj.ExcludeAny) > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of RsvpFastReroute.ExcludeAny <= 8 but Got %d", - len(*obj.obj.ExcludeAny))) - } - - } - - if obj.obj.IncludeAny != nil { - - if len(*obj.obj.IncludeAny) < 0 || len(*obj.obj.IncludeAny) > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of RsvpFastReroute.IncludeAny <= 8 but Got %d", - len(*obj.obj.IncludeAny))) - } - - } - - if obj.obj.IncludeAll != nil { - - if len(*obj.obj.IncludeAll) < 0 || len(*obj.obj.IncludeAll) > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of RsvpFastReroute.IncludeAll <= 8 but Got %d", - len(*obj.obj.IncludeAll))) - } - - } - -} - -func (obj *rsvpFastReroute) setDefault() { - if obj.obj.SetupPriority == nil { - obj.SetSetupPriority(7) - } - if obj.obj.HoldingPriority == nil { - obj.SetHoldingPriority(7) - } - if obj.obj.HopLimit == nil { - obj.SetHopLimit(3) - } - if obj.obj.Bandwidth == nil { - obj.SetBandwidth(0) - } - if obj.obj.ExcludeAny == nil { - obj.SetExcludeAny("0") - } - if obj.obj.IncludeAny == nil { - obj.SetIncludeAny("0") - } - if obj.obj.IncludeAll == nil { - obj.SetIncludeAll("0") - } - if obj.obj.OneToOneBackupDesired == nil { - obj.SetOneToOneBackupDesired(false) - } - if obj.obj.FacilityBackupDesired == nil { - obj.SetFacilityBackupDesired(false) - } - -} - -// ***** RsvpEro ***** -type rsvpEro struct { - validation - obj *otg.RsvpEro - marshaller marshalRsvpEro - unMarshaller unMarshalRsvpEro - subobjectsHolder RsvpEroRsvpEroSubobjectIter -} - -func NewRsvpEro() RsvpEro { - obj := rsvpEro{obj: &otg.RsvpEro{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpEro) msg() *otg.RsvpEro { - return obj.obj -} - -func (obj *rsvpEro) setMsg(msg *otg.RsvpEro) RsvpEro { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpEro struct { - obj *rsvpEro -} - -type marshalRsvpEro interface { - // ToProto marshals RsvpEro to protobuf object *otg.RsvpEro - ToProto() (*otg.RsvpEro, error) - // ToPbText marshals RsvpEro to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpEro to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpEro to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpEro struct { - obj *rsvpEro -} - -type unMarshalRsvpEro interface { - // FromProto unmarshals RsvpEro from protobuf object *otg.RsvpEro - FromProto(msg *otg.RsvpEro) (RsvpEro, error) - // FromPbText unmarshals RsvpEro from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpEro from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpEro from JSON text - FromJson(value string) error -} - -func (obj *rsvpEro) Marshal() marshalRsvpEro { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpEro{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpEro) Unmarshal() unMarshalRsvpEro { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpEro{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpEro) ToProto() (*otg.RsvpEro, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpEro) FromProto(msg *otg.RsvpEro) (RsvpEro, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpEro) 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 *unMarshalrsvpEro) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalrsvpEro) 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 *unMarshalrsvpEro) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalrsvpEro) 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 *unMarshalrsvpEro) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *rsvpEro) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpEro) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpEro) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpEro) Clone() (RsvpEro, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpEro() - 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 -} - -func (obj *rsvpEro) setNil() { - obj.subobjectsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// RsvpEro is configuration for the optional RSVP-TE explicit route object(ERO) object included in Path Messages. -type RsvpEro interface { - Validation - // msg marshals RsvpEro to protobuf object *otg.RsvpEro - // and doesn't set defaults - msg() *otg.RsvpEro - // setMsg unmarshals RsvpEro from protobuf object *otg.RsvpEro - // and doesn't set defaults - setMsg(*otg.RsvpEro) RsvpEro - // provides marshal interface - Marshal() marshalRsvpEro - // provides unmarshal interface - Unmarshal() unMarshalRsvpEro - // validate validates RsvpEro - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpEro, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PrependNeighborIp returns RsvpEroPrependNeighborIpEnum, set in RsvpEro - PrependNeighborIp() RsvpEroPrependNeighborIpEnum - // SetPrependNeighborIp assigns RsvpEroPrependNeighborIpEnum provided by user to RsvpEro - SetPrependNeighborIp(value RsvpEroPrependNeighborIpEnum) RsvpEro - // HasPrependNeighborIp checks if PrependNeighborIp has been set in RsvpEro - HasPrependNeighborIp() bool - // PrefixLength returns uint32, set in RsvpEro. - PrefixLength() uint32 - // SetPrefixLength assigns uint32 provided by user to RsvpEro - SetPrefixLength(value uint32) RsvpEro - // HasPrefixLength checks if PrefixLength has been set in RsvpEro - HasPrefixLength() bool - // Subobjects returns RsvpEroRsvpEroSubobjectIterIter, set in RsvpEro - Subobjects() RsvpEroRsvpEroSubobjectIter - setNil() -} - -type RsvpEroPrependNeighborIpEnum string - -// Enum of PrependNeighborIp on RsvpEro -var RsvpEroPrependNeighborIp = struct { - DONT_PREPEND RsvpEroPrependNeighborIpEnum - PREPEND_LOOSE RsvpEroPrependNeighborIpEnum - PREPEND_STRICT RsvpEroPrependNeighborIpEnum -}{ - DONT_PREPEND: RsvpEroPrependNeighborIpEnum("dont_prepend"), - PREPEND_LOOSE: RsvpEroPrependNeighborIpEnum("prepend_loose"), - PREPEND_STRICT: RsvpEroPrependNeighborIpEnum("prepend_strict"), -} - -func (obj *rsvpEro) PrependNeighborIp() RsvpEroPrependNeighborIpEnum { - return RsvpEroPrependNeighborIpEnum(obj.obj.PrependNeighborIp.Enum().String()) -} - -// Determines whether the IP address of the RSVP neighbor should be added as an ERO sub-object. If it is to be included, it can be included as a Loose hop or as a Strict hop. -// PrependNeighborIp returns a string -func (obj *rsvpEro) HasPrependNeighborIp() bool { - return obj.obj.PrependNeighborIp != nil -} - -func (obj *rsvpEro) SetPrependNeighborIp(value RsvpEroPrependNeighborIpEnum) RsvpEro { - intValue, ok := otg.RsvpEro_PrependNeighborIp_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on RsvpEroPrependNeighborIpEnum", string(value))) - return obj - } - enumValue := otg.RsvpEro_PrependNeighborIp_Enum(intValue) - obj.obj.PrependNeighborIp = &enumValue - - return obj -} - -// If prepend_egress_ip is set to one of 'prepend_loose' or 'prepend_strict', then set this value as the prefix length of the ERO sub-object containing egress IP address. -// PrefixLength returns a uint32 -func (obj *rsvpEro) PrefixLength() uint32 { - - return *obj.obj.PrefixLength - -} - -// If prepend_egress_ip is set to one of 'prepend_loose' or 'prepend_strict', then set this value as the prefix length of the ERO sub-object containing egress IP address. -// PrefixLength returns a uint32 -func (obj *rsvpEro) HasPrefixLength() bool { - return obj.obj.PrefixLength != nil -} - -// If prepend_egress_ip is set to one of 'prepend_loose' or 'prepend_strict', then set this value as the prefix length of the ERO sub-object containing egress IP address. -// SetPrefixLength sets the uint32 value in the RsvpEro object -func (obj *rsvpEro) SetPrefixLength(value uint32) RsvpEro { - - obj.obj.PrefixLength = &value - return obj -} - -// Array of sub-objects to be included in the ERO. These sub-objects contain the intermediate hops to be traversed by the LSP while being forwarded towards the egress endpoint. These sub-objects are included after the optional sub-object containing IP address of egress endpoint of the LSP (when present). -// Subobjects returns a []RsvpEroSubobject -func (obj *rsvpEro) Subobjects() RsvpEroRsvpEroSubobjectIter { - if len(obj.obj.Subobjects) == 0 { - obj.obj.Subobjects = []*otg.RsvpEroSubobject{} - } - if obj.subobjectsHolder == nil { - obj.subobjectsHolder = newRsvpEroRsvpEroSubobjectIter(&obj.obj.Subobjects).setMsg(obj) - } - return obj.subobjectsHolder -} - -type rsvpEroRsvpEroSubobjectIter struct { - obj *rsvpEro - rsvpEroSubobjectSlice []RsvpEroSubobject - fieldPtr *[]*otg.RsvpEroSubobject -} - -func newRsvpEroRsvpEroSubobjectIter(ptr *[]*otg.RsvpEroSubobject) RsvpEroRsvpEroSubobjectIter { - return &rsvpEroRsvpEroSubobjectIter{fieldPtr: ptr} -} - -type RsvpEroRsvpEroSubobjectIter interface { - setMsg(*rsvpEro) RsvpEroRsvpEroSubobjectIter - Items() []RsvpEroSubobject - Add() RsvpEroSubobject - Append(items ...RsvpEroSubobject) RsvpEroRsvpEroSubobjectIter - Set(index int, newObj RsvpEroSubobject) RsvpEroRsvpEroSubobjectIter - Clear() RsvpEroRsvpEroSubobjectIter - clearHolderSlice() RsvpEroRsvpEroSubobjectIter - appendHolderSlice(item RsvpEroSubobject) RsvpEroRsvpEroSubobjectIter -} - -func (obj *rsvpEroRsvpEroSubobjectIter) setMsg(msg *rsvpEro) RsvpEroRsvpEroSubobjectIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&rsvpEroSubobject{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *rsvpEroRsvpEroSubobjectIter) Items() []RsvpEroSubobject { - return obj.rsvpEroSubobjectSlice -} - -func (obj *rsvpEroRsvpEroSubobjectIter) Add() RsvpEroSubobject { - newObj := &otg.RsvpEroSubobject{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &rsvpEroSubobject{obj: newObj} - newLibObj.setDefault() - obj.rsvpEroSubobjectSlice = append(obj.rsvpEroSubobjectSlice, newLibObj) - return newLibObj -} - -func (obj *rsvpEroRsvpEroSubobjectIter) Append(items ...RsvpEroSubobject) RsvpEroRsvpEroSubobjectIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.rsvpEroSubobjectSlice = append(obj.rsvpEroSubobjectSlice, item) - } - return obj -} - -func (obj *rsvpEroRsvpEroSubobjectIter) Set(index int, newObj RsvpEroSubobject) RsvpEroRsvpEroSubobjectIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.rsvpEroSubobjectSlice[index] = newObj - return obj -} -func (obj *rsvpEroRsvpEroSubobjectIter) Clear() RsvpEroRsvpEroSubobjectIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.RsvpEroSubobject{} - obj.rsvpEroSubobjectSlice = []RsvpEroSubobject{} - } - return obj -} -func (obj *rsvpEroRsvpEroSubobjectIter) clearHolderSlice() RsvpEroRsvpEroSubobjectIter { - if len(obj.rsvpEroSubobjectSlice) > 0 { - obj.rsvpEroSubobjectSlice = []RsvpEroSubobject{} - } - return obj -} -func (obj *rsvpEroRsvpEroSubobjectIter) appendHolderSlice(item RsvpEroSubobject) RsvpEroRsvpEroSubobjectIter { - obj.rsvpEroSubobjectSlice = append(obj.rsvpEroSubobjectSlice, item) - return obj -} - -func (obj *rsvpEro) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.PrefixLength != nil { - - if *obj.obj.PrefixLength > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpEro.PrefixLength <= 32 but Got %d", *obj.obj.PrefixLength)) - } - - } - - if len(obj.obj.Subobjects) != 0 { - - if set_default { - obj.Subobjects().clearHolderSlice() - for _, item := range obj.obj.Subobjects { - obj.Subobjects().appendHolderSlice(&rsvpEroSubobject{obj: item}) - } - } - for _, item := range obj.Subobjects().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *rsvpEro) setDefault() { - if obj.obj.PrependNeighborIp == nil { - obj.SetPrependNeighborIp(RsvpEroPrependNeighborIp.PREPEND_LOOSE) - - } - if obj.obj.PrefixLength == nil { - obj.SetPrefixLength(32) - } - -} - -// ***** DhcpServerV4PoolOption ***** -type dhcpServerV4PoolOption struct { - validation - obj *otg.DhcpServerV4PoolOption - marshaller marshalDhcpServerV4PoolOption - unMarshaller unMarshalDhcpServerV4PoolOption -} - -func NewDhcpServerV4PoolOption() DhcpServerV4PoolOption { - obj := dhcpServerV4PoolOption{obj: &otg.DhcpServerV4PoolOption{}} - obj.setDefault() - return &obj -} - -func (obj *dhcpServerV4PoolOption) msg() *otg.DhcpServerV4PoolOption { - return obj.obj -} - -func (obj *dhcpServerV4PoolOption) setMsg(msg *otg.DhcpServerV4PoolOption) DhcpServerV4PoolOption { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshaldhcpServerV4PoolOption struct { - obj *dhcpServerV4PoolOption -} - -type marshalDhcpServerV4PoolOption interface { - // ToProto marshals DhcpServerV4PoolOption to protobuf object *otg.DhcpServerV4PoolOption - ToProto() (*otg.DhcpServerV4PoolOption, error) - // ToPbText marshals DhcpServerV4PoolOption to protobuf text - ToPbText() (string, error) - // ToYaml marshals DhcpServerV4PoolOption to YAML text - ToYaml() (string, error) - // ToJson marshals DhcpServerV4PoolOption to JSON text - ToJson() (string, error) -} - -type unMarshaldhcpServerV4PoolOption struct { - obj *dhcpServerV4PoolOption -} - -type unMarshalDhcpServerV4PoolOption interface { - // FromProto unmarshals DhcpServerV4PoolOption from protobuf object *otg.DhcpServerV4PoolOption - FromProto(msg *otg.DhcpServerV4PoolOption) (DhcpServerV4PoolOption, error) - // FromPbText unmarshals DhcpServerV4PoolOption from protobuf text - FromPbText(value string) error - // FromYaml unmarshals DhcpServerV4PoolOption from YAML text - FromYaml(value string) error - // FromJson unmarshals DhcpServerV4PoolOption from JSON text - FromJson(value string) error -} - -func (obj *dhcpServerV4PoolOption) Marshal() marshalDhcpServerV4PoolOption { - if obj.marshaller == nil { - obj.marshaller = &marshaldhcpServerV4PoolOption{obj: obj} - } - return obj.marshaller -} - -func (obj *dhcpServerV4PoolOption) Unmarshal() unMarshalDhcpServerV4PoolOption { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshaldhcpServerV4PoolOption{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshaldhcpServerV4PoolOption) ToProto() (*otg.DhcpServerV4PoolOption, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshaldhcpServerV4PoolOption) FromProto(msg *otg.DhcpServerV4PoolOption) (DhcpServerV4PoolOption, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshaldhcpServerV4PoolOption) 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 *unMarshaldhcpServerV4PoolOption) 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 *marshaldhcpServerV4PoolOption) 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 *unMarshaldhcpServerV4PoolOption) 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 *marshaldhcpServerV4PoolOption) 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 *unMarshaldhcpServerV4PoolOption) 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 *dhcpServerV4PoolOption) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *dhcpServerV4PoolOption) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *dhcpServerV4PoolOption) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *dhcpServerV4PoolOption) Clone() (DhcpServerV4PoolOption, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewDhcpServerV4PoolOption() - 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 -} - -// DhcpServerV4PoolOption is optional configuration for DHCPv4 address pool for the lease. -type DhcpServerV4PoolOption interface { - Validation - // msg marshals DhcpServerV4PoolOption to protobuf object *otg.DhcpServerV4PoolOption - // and doesn't set defaults - msg() *otg.DhcpServerV4PoolOption - // setMsg unmarshals DhcpServerV4PoolOption from protobuf object *otg.DhcpServerV4PoolOption - // and doesn't set defaults - setMsg(*otg.DhcpServerV4PoolOption) DhcpServerV4PoolOption - // provides marshal interface - Marshal() marshalDhcpServerV4PoolOption - // provides unmarshal interface - Unmarshal() unMarshalDhcpServerV4PoolOption - // validate validates DhcpServerV4PoolOption - validate() error - // A stringer function - String() string - // Clones the object - Clone() (DhcpServerV4PoolOption, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RouterAddress returns string, set in DhcpServerV4PoolOption. - RouterAddress() string - // SetRouterAddress assigns string provided by user to DhcpServerV4PoolOption - SetRouterAddress(value string) DhcpServerV4PoolOption - // HasRouterAddress checks if RouterAddress has been set in DhcpServerV4PoolOption - HasRouterAddress() bool - // PrimaryDnsServer returns string, set in DhcpServerV4PoolOption. - PrimaryDnsServer() string - // SetPrimaryDnsServer assigns string provided by user to DhcpServerV4PoolOption - SetPrimaryDnsServer(value string) DhcpServerV4PoolOption - // HasPrimaryDnsServer checks if PrimaryDnsServer has been set in DhcpServerV4PoolOption - HasPrimaryDnsServer() bool - // SecondaryDnsServer returns string, set in DhcpServerV4PoolOption. - SecondaryDnsServer() string - // SetSecondaryDnsServer assigns string provided by user to DhcpServerV4PoolOption - SetSecondaryDnsServer(value string) DhcpServerV4PoolOption - // HasSecondaryDnsServer checks if SecondaryDnsServer has been set in DhcpServerV4PoolOption - HasSecondaryDnsServer() bool - // EchoRelayWithTlv82 returns bool, set in DhcpServerV4PoolOption. - EchoRelayWithTlv82() bool - // SetEchoRelayWithTlv82 assigns bool provided by user to DhcpServerV4PoolOption - SetEchoRelayWithTlv82(value bool) DhcpServerV4PoolOption - // HasEchoRelayWithTlv82 checks if EchoRelayWithTlv82 has been set in DhcpServerV4PoolOption - HasEchoRelayWithTlv82() bool -} - -// The Router address advertised by the DHCPv4 server in Offer and Ack messages. -// RouterAddress returns a string -func (obj *dhcpServerV4PoolOption) RouterAddress() string { - - return *obj.obj.RouterAddress - -} - -// The Router address advertised by the DHCPv4 server in Offer and Ack messages. -// RouterAddress returns a string -func (obj *dhcpServerV4PoolOption) HasRouterAddress() bool { - return obj.obj.RouterAddress != nil -} - -// The Router address advertised by the DHCPv4 server in Offer and Ack messages. -// SetRouterAddress sets the string value in the DhcpServerV4PoolOption object -func (obj *dhcpServerV4PoolOption) SetRouterAddress(value string) DhcpServerV4PoolOption { - - obj.obj.RouterAddress = &value - return obj -} - -// The primary DNS server address that is offered to DHCP clients that request this information through a TLV option. -// PrimaryDnsServer returns a string -func (obj *dhcpServerV4PoolOption) PrimaryDnsServer() string { - - return *obj.obj.PrimaryDnsServer - -} - -// The primary DNS server address that is offered to DHCP clients that request this information through a TLV option. -// PrimaryDnsServer returns a string -func (obj *dhcpServerV4PoolOption) HasPrimaryDnsServer() bool { - return obj.obj.PrimaryDnsServer != nil -} - -// The primary DNS server address that is offered to DHCP clients that request this information through a TLV option. -// SetPrimaryDnsServer sets the string value in the DhcpServerV4PoolOption object -func (obj *dhcpServerV4PoolOption) SetPrimaryDnsServer(value string) DhcpServerV4PoolOption { - - obj.obj.PrimaryDnsServer = &value - return obj -} - -// The primary DNS server address that is offered to DHCP clients that request this information through a TLV option. -// SecondaryDnsServer returns a string -func (obj *dhcpServerV4PoolOption) SecondaryDnsServer() string { - - return *obj.obj.SecondaryDnsServer - -} - -// The primary DNS server address that is offered to DHCP clients that request this information through a TLV option. -// SecondaryDnsServer returns a string -func (obj *dhcpServerV4PoolOption) HasSecondaryDnsServer() bool { - return obj.obj.SecondaryDnsServer != nil -} - -// The primary DNS server address that is offered to DHCP clients that request this information through a TLV option. -// SetSecondaryDnsServer sets the string value in the DhcpServerV4PoolOption object -func (obj *dhcpServerV4PoolOption) SetSecondaryDnsServer(value string) DhcpServerV4PoolOption { - - obj.obj.SecondaryDnsServer = &value - return obj -} - -// If selected, the DHCP server includes in its replies the TLV information for the DHCPv4 Relay Agent Option 82 and the corresponding sub-TLVs that it receives from a DHCP relay agent, otherwise it replies without including this TLV. -// EchoRelayWithTlv82 returns a bool -func (obj *dhcpServerV4PoolOption) EchoRelayWithTlv82() bool { - - return *obj.obj.EchoRelayWithTlv_82 - -} - -// If selected, the DHCP server includes in its replies the TLV information for the DHCPv4 Relay Agent Option 82 and the corresponding sub-TLVs that it receives from a DHCP relay agent, otherwise it replies without including this TLV. -// EchoRelayWithTlv82 returns a bool -func (obj *dhcpServerV4PoolOption) HasEchoRelayWithTlv82() bool { - return obj.obj.EchoRelayWithTlv_82 != nil -} - -// If selected, the DHCP server includes in its replies the TLV information for the DHCPv4 Relay Agent Option 82 and the corresponding sub-TLVs that it receives from a DHCP relay agent, otherwise it replies without including this TLV. -// SetEchoRelayWithTlv82 sets the bool value in the DhcpServerV4PoolOption object -func (obj *dhcpServerV4PoolOption) SetEchoRelayWithTlv82(value bool) DhcpServerV4PoolOption { - - obj.obj.EchoRelayWithTlv_82 = &value - return obj -} - -func (obj *dhcpServerV4PoolOption) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RouterAddress != nil { - - err := obj.validateIpv4(obj.RouterAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DhcpServerV4PoolOption.RouterAddress")) - } - - } - - if obj.obj.PrimaryDnsServer != nil { - - err := obj.validateIpv4(obj.PrimaryDnsServer()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DhcpServerV4PoolOption.PrimaryDnsServer")) - } - - } - - if obj.obj.SecondaryDnsServer != nil { - - err := obj.validateIpv4(obj.SecondaryDnsServer()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on DhcpServerV4PoolOption.SecondaryDnsServer")) - } - - } - -} - -func (obj *dhcpServerV4PoolOption) setDefault() { - if obj.obj.RouterAddress == nil { - obj.SetRouterAddress("0.0.0.0") - } - if obj.obj.PrimaryDnsServer == nil { - obj.SetPrimaryDnsServer("0.0.0.0") - } - if obj.obj.SecondaryDnsServer == nil { - obj.SetSecondaryDnsServer("0.0.0.0") - } - if obj.obj.EchoRelayWithTlv_82 == nil { - obj.SetEchoRelayWithTlv82(true) - } - -} - -// ***** PatternFlowEthernetDstCounter ***** -type patternFlowEthernetDstCounter struct { - validation - obj *otg.PatternFlowEthernetDstCounter - marshaller marshalPatternFlowEthernetDstCounter - unMarshaller unMarshalPatternFlowEthernetDstCounter -} - -func NewPatternFlowEthernetDstCounter() PatternFlowEthernetDstCounter { - obj := patternFlowEthernetDstCounter{obj: &otg.PatternFlowEthernetDstCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetDstCounter) msg() *otg.PatternFlowEthernetDstCounter { - return obj.obj -} - -func (obj *patternFlowEthernetDstCounter) setMsg(msg *otg.PatternFlowEthernetDstCounter) PatternFlowEthernetDstCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetDstCounter struct { - obj *patternFlowEthernetDstCounter -} - -type marshalPatternFlowEthernetDstCounter interface { - // ToProto marshals PatternFlowEthernetDstCounter to protobuf object *otg.PatternFlowEthernetDstCounter - ToProto() (*otg.PatternFlowEthernetDstCounter, error) - // ToPbText marshals PatternFlowEthernetDstCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetDstCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetDstCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetDstCounter struct { - obj *patternFlowEthernetDstCounter -} - -type unMarshalPatternFlowEthernetDstCounter interface { - // FromProto unmarshals PatternFlowEthernetDstCounter from protobuf object *otg.PatternFlowEthernetDstCounter - FromProto(msg *otg.PatternFlowEthernetDstCounter) (PatternFlowEthernetDstCounter, error) - // FromPbText unmarshals PatternFlowEthernetDstCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetDstCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetDstCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetDstCounter) Marshal() marshalPatternFlowEthernetDstCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetDstCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetDstCounter) Unmarshal() unMarshalPatternFlowEthernetDstCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetDstCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetDstCounter) ToProto() (*otg.PatternFlowEthernetDstCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetDstCounter) FromProto(msg *otg.PatternFlowEthernetDstCounter) (PatternFlowEthernetDstCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetDstCounter) 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 *unMarshalpatternFlowEthernetDstCounter) 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 *marshalpatternFlowEthernetDstCounter) 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 *unMarshalpatternFlowEthernetDstCounter) 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 *marshalpatternFlowEthernetDstCounter) 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 *unMarshalpatternFlowEthernetDstCounter) 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 *patternFlowEthernetDstCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetDstCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetDstCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetDstCounter) Clone() (PatternFlowEthernetDstCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetDstCounter() - 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 -} - -// PatternFlowEthernetDstCounter is mac counter pattern -type PatternFlowEthernetDstCounter interface { - Validation - // msg marshals PatternFlowEthernetDstCounter to protobuf object *otg.PatternFlowEthernetDstCounter - // and doesn't set defaults - msg() *otg.PatternFlowEthernetDstCounter - // setMsg unmarshals PatternFlowEthernetDstCounter from protobuf object *otg.PatternFlowEthernetDstCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetDstCounter) PatternFlowEthernetDstCounter - // provides marshal interface - Marshal() marshalPatternFlowEthernetDstCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetDstCounter - // validate validates PatternFlowEthernetDstCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetDstCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowEthernetDstCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowEthernetDstCounter - SetStart(value string) PatternFlowEthernetDstCounter - // HasStart checks if Start has been set in PatternFlowEthernetDstCounter - HasStart() bool - // Step returns string, set in PatternFlowEthernetDstCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowEthernetDstCounter - SetStep(value string) PatternFlowEthernetDstCounter - // HasStep checks if Step has been set in PatternFlowEthernetDstCounter - HasStep() bool - // Count returns uint32, set in PatternFlowEthernetDstCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowEthernetDstCounter - SetCount(value uint32) PatternFlowEthernetDstCounter - // HasCount checks if Count has been set in PatternFlowEthernetDstCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowEthernetDstCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowEthernetDstCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowEthernetDstCounter object -func (obj *patternFlowEthernetDstCounter) SetStart(value string) PatternFlowEthernetDstCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowEthernetDstCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowEthernetDstCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowEthernetDstCounter object -func (obj *patternFlowEthernetDstCounter) SetStep(value string) PatternFlowEthernetDstCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetDstCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetDstCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowEthernetDstCounter object -func (obj *patternFlowEthernetDstCounter) SetCount(value uint32) PatternFlowEthernetDstCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowEthernetDstCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateMac(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetDstCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateMac(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetDstCounter.Step")) - } - - } - -} - -func (obj *patternFlowEthernetDstCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("00:00:00:00:00:00") - } - if obj.obj.Step == nil { - obj.SetStep("00:00:00:00:00:01") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowEthernetDstMetricTag ***** -type patternFlowEthernetDstMetricTag struct { - validation - obj *otg.PatternFlowEthernetDstMetricTag - marshaller marshalPatternFlowEthernetDstMetricTag - unMarshaller unMarshalPatternFlowEthernetDstMetricTag -} - -func NewPatternFlowEthernetDstMetricTag() PatternFlowEthernetDstMetricTag { - obj := patternFlowEthernetDstMetricTag{obj: &otg.PatternFlowEthernetDstMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetDstMetricTag) msg() *otg.PatternFlowEthernetDstMetricTag { - return obj.obj -} - -func (obj *patternFlowEthernetDstMetricTag) setMsg(msg *otg.PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetDstMetricTag struct { - obj *patternFlowEthernetDstMetricTag -} - -type marshalPatternFlowEthernetDstMetricTag interface { - // ToProto marshals PatternFlowEthernetDstMetricTag to protobuf object *otg.PatternFlowEthernetDstMetricTag - ToProto() (*otg.PatternFlowEthernetDstMetricTag, error) - // ToPbText marshals PatternFlowEthernetDstMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetDstMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetDstMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetDstMetricTag struct { - obj *patternFlowEthernetDstMetricTag -} - -type unMarshalPatternFlowEthernetDstMetricTag interface { - // FromProto unmarshals PatternFlowEthernetDstMetricTag from protobuf object *otg.PatternFlowEthernetDstMetricTag - FromProto(msg *otg.PatternFlowEthernetDstMetricTag) (PatternFlowEthernetDstMetricTag, error) - // FromPbText unmarshals PatternFlowEthernetDstMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetDstMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetDstMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetDstMetricTag) Marshal() marshalPatternFlowEthernetDstMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetDstMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetDstMetricTag) Unmarshal() unMarshalPatternFlowEthernetDstMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetDstMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetDstMetricTag) ToProto() (*otg.PatternFlowEthernetDstMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetDstMetricTag) FromProto(msg *otg.PatternFlowEthernetDstMetricTag) (PatternFlowEthernetDstMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetDstMetricTag) 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 *unMarshalpatternFlowEthernetDstMetricTag) 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 *marshalpatternFlowEthernetDstMetricTag) 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 *unMarshalpatternFlowEthernetDstMetricTag) 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 *marshalpatternFlowEthernetDstMetricTag) 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 *unMarshalpatternFlowEthernetDstMetricTag) 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 *patternFlowEthernetDstMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetDstMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetDstMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetDstMetricTag) Clone() (PatternFlowEthernetDstMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetDstMetricTag() - 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 -} - -// PatternFlowEthernetDstMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowEthernetDstMetricTag interface { - Validation - // msg marshals PatternFlowEthernetDstMetricTag to protobuf object *otg.PatternFlowEthernetDstMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowEthernetDstMetricTag - // setMsg unmarshals PatternFlowEthernetDstMetricTag from protobuf object *otg.PatternFlowEthernetDstMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstMetricTag - // provides marshal interface - Marshal() marshalPatternFlowEthernetDstMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetDstMetricTag - // validate validates PatternFlowEthernetDstMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetDstMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowEthernetDstMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowEthernetDstMetricTag - SetName(value string) PatternFlowEthernetDstMetricTag - // Offset returns uint32, set in PatternFlowEthernetDstMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowEthernetDstMetricTag - SetOffset(value uint32) PatternFlowEthernetDstMetricTag - // HasOffset checks if Offset has been set in PatternFlowEthernetDstMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowEthernetDstMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowEthernetDstMetricTag - SetLength(value uint32) PatternFlowEthernetDstMetricTag - // HasLength checks if Length has been set in PatternFlowEthernetDstMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowEthernetDstMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowEthernetDstMetricTag object -func (obj *patternFlowEthernetDstMetricTag) SetName(value string) PatternFlowEthernetDstMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetDstMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetDstMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowEthernetDstMetricTag object -func (obj *patternFlowEthernetDstMetricTag) SetOffset(value uint32) PatternFlowEthernetDstMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetDstMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetDstMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowEthernetDstMetricTag object -func (obj *patternFlowEthernetDstMetricTag) SetLength(value uint32) PatternFlowEthernetDstMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowEthernetDstMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetDstMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 47 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetDstMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 48 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowEthernetDstMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowEthernetDstMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(48) - } - -} - -// ***** PatternFlowEthernetSrcCounter ***** -type patternFlowEthernetSrcCounter struct { - validation - obj *otg.PatternFlowEthernetSrcCounter - marshaller marshalPatternFlowEthernetSrcCounter - unMarshaller unMarshalPatternFlowEthernetSrcCounter -} - -func NewPatternFlowEthernetSrcCounter() PatternFlowEthernetSrcCounter { - obj := patternFlowEthernetSrcCounter{obj: &otg.PatternFlowEthernetSrcCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetSrcCounter) msg() *otg.PatternFlowEthernetSrcCounter { - return obj.obj -} - -func (obj *patternFlowEthernetSrcCounter) setMsg(msg *otg.PatternFlowEthernetSrcCounter) PatternFlowEthernetSrcCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetSrcCounter struct { - obj *patternFlowEthernetSrcCounter -} - -type marshalPatternFlowEthernetSrcCounter interface { - // ToProto marshals PatternFlowEthernetSrcCounter to protobuf object *otg.PatternFlowEthernetSrcCounter - ToProto() (*otg.PatternFlowEthernetSrcCounter, error) - // ToPbText marshals PatternFlowEthernetSrcCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetSrcCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetSrcCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetSrcCounter struct { - obj *patternFlowEthernetSrcCounter -} - -type unMarshalPatternFlowEthernetSrcCounter interface { - // FromProto unmarshals PatternFlowEthernetSrcCounter from protobuf object *otg.PatternFlowEthernetSrcCounter - FromProto(msg *otg.PatternFlowEthernetSrcCounter) (PatternFlowEthernetSrcCounter, error) - // FromPbText unmarshals PatternFlowEthernetSrcCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetSrcCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetSrcCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetSrcCounter) Marshal() marshalPatternFlowEthernetSrcCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetSrcCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetSrcCounter) Unmarshal() unMarshalPatternFlowEthernetSrcCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetSrcCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetSrcCounter) ToProto() (*otg.PatternFlowEthernetSrcCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetSrcCounter) FromProto(msg *otg.PatternFlowEthernetSrcCounter) (PatternFlowEthernetSrcCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetSrcCounter) 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 *unMarshalpatternFlowEthernetSrcCounter) 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 *marshalpatternFlowEthernetSrcCounter) 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 *unMarshalpatternFlowEthernetSrcCounter) 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 *marshalpatternFlowEthernetSrcCounter) 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 *unMarshalpatternFlowEthernetSrcCounter) 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 *patternFlowEthernetSrcCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetSrcCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetSrcCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetSrcCounter) Clone() (PatternFlowEthernetSrcCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetSrcCounter() - 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 -} - -// PatternFlowEthernetSrcCounter is mac counter pattern -type PatternFlowEthernetSrcCounter interface { - Validation - // msg marshals PatternFlowEthernetSrcCounter to protobuf object *otg.PatternFlowEthernetSrcCounter - // and doesn't set defaults - msg() *otg.PatternFlowEthernetSrcCounter - // setMsg unmarshals PatternFlowEthernetSrcCounter from protobuf object *otg.PatternFlowEthernetSrcCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetSrcCounter) PatternFlowEthernetSrcCounter - // provides marshal interface - Marshal() marshalPatternFlowEthernetSrcCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetSrcCounter - // validate validates PatternFlowEthernetSrcCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetSrcCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowEthernetSrcCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowEthernetSrcCounter - SetStart(value string) PatternFlowEthernetSrcCounter - // HasStart checks if Start has been set in PatternFlowEthernetSrcCounter - HasStart() bool - // Step returns string, set in PatternFlowEthernetSrcCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowEthernetSrcCounter - SetStep(value string) PatternFlowEthernetSrcCounter - // HasStep checks if Step has been set in PatternFlowEthernetSrcCounter - HasStep() bool - // Count returns uint32, set in PatternFlowEthernetSrcCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowEthernetSrcCounter - SetCount(value uint32) PatternFlowEthernetSrcCounter - // HasCount checks if Count has been set in PatternFlowEthernetSrcCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowEthernetSrcCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowEthernetSrcCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowEthernetSrcCounter object -func (obj *patternFlowEthernetSrcCounter) SetStart(value string) PatternFlowEthernetSrcCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowEthernetSrcCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowEthernetSrcCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowEthernetSrcCounter object -func (obj *patternFlowEthernetSrcCounter) SetStep(value string) PatternFlowEthernetSrcCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetSrcCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetSrcCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowEthernetSrcCounter object -func (obj *patternFlowEthernetSrcCounter) SetCount(value uint32) PatternFlowEthernetSrcCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowEthernetSrcCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateMac(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetSrcCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateMac(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetSrcCounter.Step")) - } - - } - -} - -func (obj *patternFlowEthernetSrcCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("00:00:00:00:00:00") - } - if obj.obj.Step == nil { - obj.SetStep("00:00:00:00:00:01") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowEthernetSrcMetricTag ***** -type patternFlowEthernetSrcMetricTag struct { - validation - obj *otg.PatternFlowEthernetSrcMetricTag - marshaller marshalPatternFlowEthernetSrcMetricTag - unMarshaller unMarshalPatternFlowEthernetSrcMetricTag -} - -func NewPatternFlowEthernetSrcMetricTag() PatternFlowEthernetSrcMetricTag { - obj := patternFlowEthernetSrcMetricTag{obj: &otg.PatternFlowEthernetSrcMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetSrcMetricTag) msg() *otg.PatternFlowEthernetSrcMetricTag { - return obj.obj -} - -func (obj *patternFlowEthernetSrcMetricTag) setMsg(msg *otg.PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetSrcMetricTag struct { - obj *patternFlowEthernetSrcMetricTag -} - -type marshalPatternFlowEthernetSrcMetricTag interface { - // ToProto marshals PatternFlowEthernetSrcMetricTag to protobuf object *otg.PatternFlowEthernetSrcMetricTag - ToProto() (*otg.PatternFlowEthernetSrcMetricTag, error) - // ToPbText marshals PatternFlowEthernetSrcMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetSrcMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetSrcMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetSrcMetricTag struct { - obj *patternFlowEthernetSrcMetricTag -} - -type unMarshalPatternFlowEthernetSrcMetricTag interface { - // FromProto unmarshals PatternFlowEthernetSrcMetricTag from protobuf object *otg.PatternFlowEthernetSrcMetricTag - FromProto(msg *otg.PatternFlowEthernetSrcMetricTag) (PatternFlowEthernetSrcMetricTag, error) - // FromPbText unmarshals PatternFlowEthernetSrcMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetSrcMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetSrcMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetSrcMetricTag) Marshal() marshalPatternFlowEthernetSrcMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetSrcMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetSrcMetricTag) Unmarshal() unMarshalPatternFlowEthernetSrcMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetSrcMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetSrcMetricTag) ToProto() (*otg.PatternFlowEthernetSrcMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetSrcMetricTag) FromProto(msg *otg.PatternFlowEthernetSrcMetricTag) (PatternFlowEthernetSrcMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetSrcMetricTag) 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 *unMarshalpatternFlowEthernetSrcMetricTag) 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 *marshalpatternFlowEthernetSrcMetricTag) 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 *unMarshalpatternFlowEthernetSrcMetricTag) 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 *marshalpatternFlowEthernetSrcMetricTag) 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 *unMarshalpatternFlowEthernetSrcMetricTag) 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 *patternFlowEthernetSrcMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetSrcMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetSrcMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetSrcMetricTag) Clone() (PatternFlowEthernetSrcMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetSrcMetricTag() - 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 -} - -// PatternFlowEthernetSrcMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowEthernetSrcMetricTag interface { - Validation - // msg marshals PatternFlowEthernetSrcMetricTag to protobuf object *otg.PatternFlowEthernetSrcMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowEthernetSrcMetricTag - // setMsg unmarshals PatternFlowEthernetSrcMetricTag from protobuf object *otg.PatternFlowEthernetSrcMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcMetricTag - // provides marshal interface - Marshal() marshalPatternFlowEthernetSrcMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetSrcMetricTag - // validate validates PatternFlowEthernetSrcMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetSrcMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowEthernetSrcMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowEthernetSrcMetricTag - SetName(value string) PatternFlowEthernetSrcMetricTag - // Offset returns uint32, set in PatternFlowEthernetSrcMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowEthernetSrcMetricTag - SetOffset(value uint32) PatternFlowEthernetSrcMetricTag - // HasOffset checks if Offset has been set in PatternFlowEthernetSrcMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowEthernetSrcMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowEthernetSrcMetricTag - SetLength(value uint32) PatternFlowEthernetSrcMetricTag - // HasLength checks if Length has been set in PatternFlowEthernetSrcMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowEthernetSrcMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowEthernetSrcMetricTag object -func (obj *patternFlowEthernetSrcMetricTag) SetName(value string) PatternFlowEthernetSrcMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetSrcMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetSrcMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowEthernetSrcMetricTag object -func (obj *patternFlowEthernetSrcMetricTag) SetOffset(value uint32) PatternFlowEthernetSrcMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetSrcMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetSrcMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowEthernetSrcMetricTag object -func (obj *patternFlowEthernetSrcMetricTag) SetLength(value uint32) PatternFlowEthernetSrcMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowEthernetSrcMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetSrcMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 47 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetSrcMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 48 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowEthernetSrcMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowEthernetSrcMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(48) - } - -} - -// ***** PatternFlowEthernetEtherTypeCounter ***** -type patternFlowEthernetEtherTypeCounter struct { - validation - obj *otg.PatternFlowEthernetEtherTypeCounter - marshaller marshalPatternFlowEthernetEtherTypeCounter - unMarshaller unMarshalPatternFlowEthernetEtherTypeCounter -} - -func NewPatternFlowEthernetEtherTypeCounter() PatternFlowEthernetEtherTypeCounter { - obj := patternFlowEthernetEtherTypeCounter{obj: &otg.PatternFlowEthernetEtherTypeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetEtherTypeCounter) msg() *otg.PatternFlowEthernetEtherTypeCounter { - return obj.obj -} - -func (obj *patternFlowEthernetEtherTypeCounter) setMsg(msg *otg.PatternFlowEthernetEtherTypeCounter) PatternFlowEthernetEtherTypeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetEtherTypeCounter struct { - obj *patternFlowEthernetEtherTypeCounter -} - -type marshalPatternFlowEthernetEtherTypeCounter interface { - // ToProto marshals PatternFlowEthernetEtherTypeCounter to protobuf object *otg.PatternFlowEthernetEtherTypeCounter - ToProto() (*otg.PatternFlowEthernetEtherTypeCounter, error) - // ToPbText marshals PatternFlowEthernetEtherTypeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetEtherTypeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetEtherTypeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetEtherTypeCounter struct { - obj *patternFlowEthernetEtherTypeCounter -} - -type unMarshalPatternFlowEthernetEtherTypeCounter interface { - // FromProto unmarshals PatternFlowEthernetEtherTypeCounter from protobuf object *otg.PatternFlowEthernetEtherTypeCounter - FromProto(msg *otg.PatternFlowEthernetEtherTypeCounter) (PatternFlowEthernetEtherTypeCounter, error) - // FromPbText unmarshals PatternFlowEthernetEtherTypeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetEtherTypeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetEtherTypeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetEtherTypeCounter) Marshal() marshalPatternFlowEthernetEtherTypeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetEtherTypeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetEtherTypeCounter) Unmarshal() unMarshalPatternFlowEthernetEtherTypeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetEtherTypeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetEtherTypeCounter) ToProto() (*otg.PatternFlowEthernetEtherTypeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetEtherTypeCounter) FromProto(msg *otg.PatternFlowEthernetEtherTypeCounter) (PatternFlowEthernetEtherTypeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetEtherTypeCounter) 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 *unMarshalpatternFlowEthernetEtherTypeCounter) 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 *marshalpatternFlowEthernetEtherTypeCounter) 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 *unMarshalpatternFlowEthernetEtherTypeCounter) 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 *marshalpatternFlowEthernetEtherTypeCounter) 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 *unMarshalpatternFlowEthernetEtherTypeCounter) 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 *patternFlowEthernetEtherTypeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetEtherTypeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetEtherTypeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetEtherTypeCounter) Clone() (PatternFlowEthernetEtherTypeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetEtherTypeCounter() - 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 -} - -// PatternFlowEthernetEtherTypeCounter is integer counter pattern -type PatternFlowEthernetEtherTypeCounter interface { - Validation - // msg marshals PatternFlowEthernetEtherTypeCounter to protobuf object *otg.PatternFlowEthernetEtherTypeCounter - // and doesn't set defaults - msg() *otg.PatternFlowEthernetEtherTypeCounter - // setMsg unmarshals PatternFlowEthernetEtherTypeCounter from protobuf object *otg.PatternFlowEthernetEtherTypeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetEtherTypeCounter) PatternFlowEthernetEtherTypeCounter - // provides marshal interface - Marshal() marshalPatternFlowEthernetEtherTypeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetEtherTypeCounter - // validate validates PatternFlowEthernetEtherTypeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetEtherTypeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowEthernetEtherTypeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowEthernetEtherTypeCounter - SetStart(value uint32) PatternFlowEthernetEtherTypeCounter - // HasStart checks if Start has been set in PatternFlowEthernetEtherTypeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowEthernetEtherTypeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowEthernetEtherTypeCounter - SetStep(value uint32) PatternFlowEthernetEtherTypeCounter - // HasStep checks if Step has been set in PatternFlowEthernetEtherTypeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowEthernetEtherTypeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowEthernetEtherTypeCounter - SetCount(value uint32) PatternFlowEthernetEtherTypeCounter - // HasCount checks if Count has been set in PatternFlowEthernetEtherTypeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowEthernetEtherTypeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowEthernetEtherTypeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowEthernetEtherTypeCounter object -func (obj *patternFlowEthernetEtherTypeCounter) SetStart(value uint32) PatternFlowEthernetEtherTypeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowEthernetEtherTypeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowEthernetEtherTypeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowEthernetEtherTypeCounter object -func (obj *patternFlowEthernetEtherTypeCounter) SetStep(value uint32) PatternFlowEthernetEtherTypeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetEtherTypeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetEtherTypeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowEthernetEtherTypeCounter object -func (obj *patternFlowEthernetEtherTypeCounter) SetCount(value uint32) PatternFlowEthernetEtherTypeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowEthernetEtherTypeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetEtherTypeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetEtherTypeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetEtherTypeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowEthernetEtherTypeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(65535) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowEthernetEtherTypeMetricTag ***** -type patternFlowEthernetEtherTypeMetricTag struct { - validation - obj *otg.PatternFlowEthernetEtherTypeMetricTag - marshaller marshalPatternFlowEthernetEtherTypeMetricTag - unMarshaller unMarshalPatternFlowEthernetEtherTypeMetricTag -} - -func NewPatternFlowEthernetEtherTypeMetricTag() PatternFlowEthernetEtherTypeMetricTag { - obj := patternFlowEthernetEtherTypeMetricTag{obj: &otg.PatternFlowEthernetEtherTypeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetEtherTypeMetricTag) msg() *otg.PatternFlowEthernetEtherTypeMetricTag { - return obj.obj -} - -func (obj *patternFlowEthernetEtherTypeMetricTag) setMsg(msg *otg.PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetEtherTypeMetricTag struct { - obj *patternFlowEthernetEtherTypeMetricTag -} - -type marshalPatternFlowEthernetEtherTypeMetricTag interface { - // ToProto marshals PatternFlowEthernetEtherTypeMetricTag to protobuf object *otg.PatternFlowEthernetEtherTypeMetricTag - ToProto() (*otg.PatternFlowEthernetEtherTypeMetricTag, error) - // ToPbText marshals PatternFlowEthernetEtherTypeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetEtherTypeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetEtherTypeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetEtherTypeMetricTag struct { - obj *patternFlowEthernetEtherTypeMetricTag -} - -type unMarshalPatternFlowEthernetEtherTypeMetricTag interface { - // FromProto unmarshals PatternFlowEthernetEtherTypeMetricTag from protobuf object *otg.PatternFlowEthernetEtherTypeMetricTag - FromProto(msg *otg.PatternFlowEthernetEtherTypeMetricTag) (PatternFlowEthernetEtherTypeMetricTag, error) - // FromPbText unmarshals PatternFlowEthernetEtherTypeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetEtherTypeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetEtherTypeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetEtherTypeMetricTag) Marshal() marshalPatternFlowEthernetEtherTypeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetEtherTypeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetEtherTypeMetricTag) Unmarshal() unMarshalPatternFlowEthernetEtherTypeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetEtherTypeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetEtherTypeMetricTag) ToProto() (*otg.PatternFlowEthernetEtherTypeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetEtherTypeMetricTag) FromProto(msg *otg.PatternFlowEthernetEtherTypeMetricTag) (PatternFlowEthernetEtherTypeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetEtherTypeMetricTag) 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 *unMarshalpatternFlowEthernetEtherTypeMetricTag) 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 *marshalpatternFlowEthernetEtherTypeMetricTag) 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 *unMarshalpatternFlowEthernetEtherTypeMetricTag) 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 *marshalpatternFlowEthernetEtherTypeMetricTag) 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 *unMarshalpatternFlowEthernetEtherTypeMetricTag) 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 *patternFlowEthernetEtherTypeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetEtherTypeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetEtherTypeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetEtherTypeMetricTag) Clone() (PatternFlowEthernetEtherTypeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetEtherTypeMetricTag() - 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 -} - -// PatternFlowEthernetEtherTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowEthernetEtherTypeMetricTag interface { - Validation - // msg marshals PatternFlowEthernetEtherTypeMetricTag to protobuf object *otg.PatternFlowEthernetEtherTypeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowEthernetEtherTypeMetricTag - // setMsg unmarshals PatternFlowEthernetEtherTypeMetricTag from protobuf object *otg.PatternFlowEthernetEtherTypeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowEthernetEtherTypeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetEtherTypeMetricTag - // validate validates PatternFlowEthernetEtherTypeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetEtherTypeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowEthernetEtherTypeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowEthernetEtherTypeMetricTag - SetName(value string) PatternFlowEthernetEtherTypeMetricTag - // Offset returns uint32, set in PatternFlowEthernetEtherTypeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowEthernetEtherTypeMetricTag - SetOffset(value uint32) PatternFlowEthernetEtherTypeMetricTag - // HasOffset checks if Offset has been set in PatternFlowEthernetEtherTypeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowEthernetEtherTypeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowEthernetEtherTypeMetricTag - SetLength(value uint32) PatternFlowEthernetEtherTypeMetricTag - // HasLength checks if Length has been set in PatternFlowEthernetEtherTypeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowEthernetEtherTypeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowEthernetEtherTypeMetricTag object -func (obj *patternFlowEthernetEtherTypeMetricTag) SetName(value string) PatternFlowEthernetEtherTypeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetEtherTypeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetEtherTypeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowEthernetEtherTypeMetricTag object -func (obj *patternFlowEthernetEtherTypeMetricTag) SetOffset(value uint32) PatternFlowEthernetEtherTypeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetEtherTypeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetEtherTypeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowEthernetEtherTypeMetricTag object -func (obj *patternFlowEthernetEtherTypeMetricTag) SetLength(value uint32) PatternFlowEthernetEtherTypeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowEthernetEtherTypeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetEtherTypeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetEtherTypeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowEthernetEtherTypeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowEthernetEtherTypeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowEthernetPfcQueueCounter ***** -type patternFlowEthernetPfcQueueCounter struct { - validation - obj *otg.PatternFlowEthernetPfcQueueCounter - marshaller marshalPatternFlowEthernetPfcQueueCounter - unMarshaller unMarshalPatternFlowEthernetPfcQueueCounter -} - -func NewPatternFlowEthernetPfcQueueCounter() PatternFlowEthernetPfcQueueCounter { - obj := patternFlowEthernetPfcQueueCounter{obj: &otg.PatternFlowEthernetPfcQueueCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPfcQueueCounter) msg() *otg.PatternFlowEthernetPfcQueueCounter { - return obj.obj -} - -func (obj *patternFlowEthernetPfcQueueCounter) setMsg(msg *otg.PatternFlowEthernetPfcQueueCounter) PatternFlowEthernetPfcQueueCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPfcQueueCounter struct { - obj *patternFlowEthernetPfcQueueCounter -} - -type marshalPatternFlowEthernetPfcQueueCounter interface { - // ToProto marshals PatternFlowEthernetPfcQueueCounter to protobuf object *otg.PatternFlowEthernetPfcQueueCounter - ToProto() (*otg.PatternFlowEthernetPfcQueueCounter, error) - // ToPbText marshals PatternFlowEthernetPfcQueueCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPfcQueueCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPfcQueueCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPfcQueueCounter struct { - obj *patternFlowEthernetPfcQueueCounter -} - -type unMarshalPatternFlowEthernetPfcQueueCounter interface { - // FromProto unmarshals PatternFlowEthernetPfcQueueCounter from protobuf object *otg.PatternFlowEthernetPfcQueueCounter - FromProto(msg *otg.PatternFlowEthernetPfcQueueCounter) (PatternFlowEthernetPfcQueueCounter, error) - // FromPbText unmarshals PatternFlowEthernetPfcQueueCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPfcQueueCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPfcQueueCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPfcQueueCounter) Marshal() marshalPatternFlowEthernetPfcQueueCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPfcQueueCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPfcQueueCounter) Unmarshal() unMarshalPatternFlowEthernetPfcQueueCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPfcQueueCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPfcQueueCounter) ToProto() (*otg.PatternFlowEthernetPfcQueueCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPfcQueueCounter) FromProto(msg *otg.PatternFlowEthernetPfcQueueCounter) (PatternFlowEthernetPfcQueueCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPfcQueueCounter) 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 *unMarshalpatternFlowEthernetPfcQueueCounter) 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 *marshalpatternFlowEthernetPfcQueueCounter) 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 *unMarshalpatternFlowEthernetPfcQueueCounter) 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 *marshalpatternFlowEthernetPfcQueueCounter) 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 *unMarshalpatternFlowEthernetPfcQueueCounter) 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 *patternFlowEthernetPfcQueueCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPfcQueueCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPfcQueueCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPfcQueueCounter) Clone() (PatternFlowEthernetPfcQueueCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPfcQueueCounter() - 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 -} - -// PatternFlowEthernetPfcQueueCounter is integer counter pattern -type PatternFlowEthernetPfcQueueCounter interface { - Validation - // msg marshals PatternFlowEthernetPfcQueueCounter to protobuf object *otg.PatternFlowEthernetPfcQueueCounter - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPfcQueueCounter - // setMsg unmarshals PatternFlowEthernetPfcQueueCounter from protobuf object *otg.PatternFlowEthernetPfcQueueCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPfcQueueCounter) PatternFlowEthernetPfcQueueCounter - // provides marshal interface - Marshal() marshalPatternFlowEthernetPfcQueueCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPfcQueueCounter - // validate validates PatternFlowEthernetPfcQueueCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPfcQueueCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowEthernetPfcQueueCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowEthernetPfcQueueCounter - SetStart(value uint32) PatternFlowEthernetPfcQueueCounter - // HasStart checks if Start has been set in PatternFlowEthernetPfcQueueCounter - HasStart() bool - // Step returns uint32, set in PatternFlowEthernetPfcQueueCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowEthernetPfcQueueCounter - SetStep(value uint32) PatternFlowEthernetPfcQueueCounter - // HasStep checks if Step has been set in PatternFlowEthernetPfcQueueCounter - HasStep() bool - // Count returns uint32, set in PatternFlowEthernetPfcQueueCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowEthernetPfcQueueCounter - SetCount(value uint32) PatternFlowEthernetPfcQueueCounter - // HasCount checks if Count has been set in PatternFlowEthernetPfcQueueCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowEthernetPfcQueueCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowEthernetPfcQueueCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowEthernetPfcQueueCounter object -func (obj *patternFlowEthernetPfcQueueCounter) SetStart(value uint32) PatternFlowEthernetPfcQueueCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowEthernetPfcQueueCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowEthernetPfcQueueCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowEthernetPfcQueueCounter object -func (obj *patternFlowEthernetPfcQueueCounter) SetStep(value uint32) PatternFlowEthernetPfcQueueCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetPfcQueueCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetPfcQueueCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowEthernetPfcQueueCounter object -func (obj *patternFlowEthernetPfcQueueCounter) SetCount(value uint32) PatternFlowEthernetPfcQueueCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowEthernetPfcQueueCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPfcQueueCounter.Start <= 7 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPfcQueueCounter.Step <= 7 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPfcQueueCounter.Count <= 7 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowEthernetPfcQueueCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowEthernetPfcQueueMetricTag ***** -type patternFlowEthernetPfcQueueMetricTag struct { - validation - obj *otg.PatternFlowEthernetPfcQueueMetricTag - marshaller marshalPatternFlowEthernetPfcQueueMetricTag - unMarshaller unMarshalPatternFlowEthernetPfcQueueMetricTag -} - -func NewPatternFlowEthernetPfcQueueMetricTag() PatternFlowEthernetPfcQueueMetricTag { - obj := patternFlowEthernetPfcQueueMetricTag{obj: &otg.PatternFlowEthernetPfcQueueMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPfcQueueMetricTag) msg() *otg.PatternFlowEthernetPfcQueueMetricTag { - return obj.obj -} - -func (obj *patternFlowEthernetPfcQueueMetricTag) setMsg(msg *otg.PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueueMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPfcQueueMetricTag struct { - obj *patternFlowEthernetPfcQueueMetricTag -} - -type marshalPatternFlowEthernetPfcQueueMetricTag interface { - // ToProto marshals PatternFlowEthernetPfcQueueMetricTag to protobuf object *otg.PatternFlowEthernetPfcQueueMetricTag - ToProto() (*otg.PatternFlowEthernetPfcQueueMetricTag, error) - // ToPbText marshals PatternFlowEthernetPfcQueueMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPfcQueueMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPfcQueueMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPfcQueueMetricTag struct { - obj *patternFlowEthernetPfcQueueMetricTag -} - -type unMarshalPatternFlowEthernetPfcQueueMetricTag interface { - // FromProto unmarshals PatternFlowEthernetPfcQueueMetricTag from protobuf object *otg.PatternFlowEthernetPfcQueueMetricTag - FromProto(msg *otg.PatternFlowEthernetPfcQueueMetricTag) (PatternFlowEthernetPfcQueueMetricTag, error) - // FromPbText unmarshals PatternFlowEthernetPfcQueueMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPfcQueueMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPfcQueueMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPfcQueueMetricTag) Marshal() marshalPatternFlowEthernetPfcQueueMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPfcQueueMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPfcQueueMetricTag) Unmarshal() unMarshalPatternFlowEthernetPfcQueueMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPfcQueueMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPfcQueueMetricTag) ToProto() (*otg.PatternFlowEthernetPfcQueueMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPfcQueueMetricTag) FromProto(msg *otg.PatternFlowEthernetPfcQueueMetricTag) (PatternFlowEthernetPfcQueueMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPfcQueueMetricTag) 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 *unMarshalpatternFlowEthernetPfcQueueMetricTag) 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 *marshalpatternFlowEthernetPfcQueueMetricTag) 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 *unMarshalpatternFlowEthernetPfcQueueMetricTag) 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 *marshalpatternFlowEthernetPfcQueueMetricTag) 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 *unMarshalpatternFlowEthernetPfcQueueMetricTag) 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 *patternFlowEthernetPfcQueueMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPfcQueueMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPfcQueueMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPfcQueueMetricTag) Clone() (PatternFlowEthernetPfcQueueMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPfcQueueMetricTag() - 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 -} - -// PatternFlowEthernetPfcQueueMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowEthernetPfcQueueMetricTag interface { - Validation - // msg marshals PatternFlowEthernetPfcQueueMetricTag to protobuf object *otg.PatternFlowEthernetPfcQueueMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPfcQueueMetricTag - // setMsg unmarshals PatternFlowEthernetPfcQueueMetricTag from protobuf object *otg.PatternFlowEthernetPfcQueueMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueueMetricTag - // provides marshal interface - Marshal() marshalPatternFlowEthernetPfcQueueMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPfcQueueMetricTag - // validate validates PatternFlowEthernetPfcQueueMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPfcQueueMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowEthernetPfcQueueMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowEthernetPfcQueueMetricTag - SetName(value string) PatternFlowEthernetPfcQueueMetricTag - // Offset returns uint32, set in PatternFlowEthernetPfcQueueMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowEthernetPfcQueueMetricTag - SetOffset(value uint32) PatternFlowEthernetPfcQueueMetricTag - // HasOffset checks if Offset has been set in PatternFlowEthernetPfcQueueMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowEthernetPfcQueueMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowEthernetPfcQueueMetricTag - SetLength(value uint32) PatternFlowEthernetPfcQueueMetricTag - // HasLength checks if Length has been set in PatternFlowEthernetPfcQueueMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowEthernetPfcQueueMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowEthernetPfcQueueMetricTag object -func (obj *patternFlowEthernetPfcQueueMetricTag) SetName(value string) PatternFlowEthernetPfcQueueMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetPfcQueueMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetPfcQueueMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowEthernetPfcQueueMetricTag object -func (obj *patternFlowEthernetPfcQueueMetricTag) SetOffset(value uint32) PatternFlowEthernetPfcQueueMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetPfcQueueMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetPfcQueueMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowEthernetPfcQueueMetricTag object -func (obj *patternFlowEthernetPfcQueueMetricTag) SetLength(value uint32) PatternFlowEthernetPfcQueueMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowEthernetPfcQueueMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetPfcQueueMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 2 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPfcQueueMetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowEthernetPfcQueueMetricTag.Length <= 3 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowEthernetPfcQueueMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(3) - } - -} - -// ***** PatternFlowVlanPriorityCounter ***** -type patternFlowVlanPriorityCounter struct { - validation - obj *otg.PatternFlowVlanPriorityCounter - marshaller marshalPatternFlowVlanPriorityCounter - unMarshaller unMarshalPatternFlowVlanPriorityCounter -} - -func NewPatternFlowVlanPriorityCounter() PatternFlowVlanPriorityCounter { - obj := patternFlowVlanPriorityCounter{obj: &otg.PatternFlowVlanPriorityCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVlanPriorityCounter) msg() *otg.PatternFlowVlanPriorityCounter { - return obj.obj -} - -func (obj *patternFlowVlanPriorityCounter) setMsg(msg *otg.PatternFlowVlanPriorityCounter) PatternFlowVlanPriorityCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVlanPriorityCounter struct { - obj *patternFlowVlanPriorityCounter -} - -type marshalPatternFlowVlanPriorityCounter interface { - // ToProto marshals PatternFlowVlanPriorityCounter to protobuf object *otg.PatternFlowVlanPriorityCounter - ToProto() (*otg.PatternFlowVlanPriorityCounter, error) - // ToPbText marshals PatternFlowVlanPriorityCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVlanPriorityCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVlanPriorityCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVlanPriorityCounter struct { - obj *patternFlowVlanPriorityCounter -} - -type unMarshalPatternFlowVlanPriorityCounter interface { - // FromProto unmarshals PatternFlowVlanPriorityCounter from protobuf object *otg.PatternFlowVlanPriorityCounter - FromProto(msg *otg.PatternFlowVlanPriorityCounter) (PatternFlowVlanPriorityCounter, error) - // FromPbText unmarshals PatternFlowVlanPriorityCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVlanPriorityCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVlanPriorityCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVlanPriorityCounter) Marshal() marshalPatternFlowVlanPriorityCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVlanPriorityCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVlanPriorityCounter) Unmarshal() unMarshalPatternFlowVlanPriorityCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVlanPriorityCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVlanPriorityCounter) ToProto() (*otg.PatternFlowVlanPriorityCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVlanPriorityCounter) FromProto(msg *otg.PatternFlowVlanPriorityCounter) (PatternFlowVlanPriorityCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVlanPriorityCounter) 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 *unMarshalpatternFlowVlanPriorityCounter) 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 *marshalpatternFlowVlanPriorityCounter) 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 *unMarshalpatternFlowVlanPriorityCounter) 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 *marshalpatternFlowVlanPriorityCounter) 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 *unMarshalpatternFlowVlanPriorityCounter) 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 *patternFlowVlanPriorityCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVlanPriorityCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVlanPriorityCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVlanPriorityCounter) Clone() (PatternFlowVlanPriorityCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVlanPriorityCounter() - 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 -} - -// PatternFlowVlanPriorityCounter is integer counter pattern -type PatternFlowVlanPriorityCounter interface { - Validation - // msg marshals PatternFlowVlanPriorityCounter to protobuf object *otg.PatternFlowVlanPriorityCounter - // and doesn't set defaults - msg() *otg.PatternFlowVlanPriorityCounter - // setMsg unmarshals PatternFlowVlanPriorityCounter from protobuf object *otg.PatternFlowVlanPriorityCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowVlanPriorityCounter) PatternFlowVlanPriorityCounter - // provides marshal interface - Marshal() marshalPatternFlowVlanPriorityCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVlanPriorityCounter - // validate validates PatternFlowVlanPriorityCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVlanPriorityCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowVlanPriorityCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowVlanPriorityCounter - SetStart(value uint32) PatternFlowVlanPriorityCounter - // HasStart checks if Start has been set in PatternFlowVlanPriorityCounter - HasStart() bool - // Step returns uint32, set in PatternFlowVlanPriorityCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowVlanPriorityCounter - SetStep(value uint32) PatternFlowVlanPriorityCounter - // HasStep checks if Step has been set in PatternFlowVlanPriorityCounter - HasStep() bool - // Count returns uint32, set in PatternFlowVlanPriorityCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowVlanPriorityCounter - SetCount(value uint32) PatternFlowVlanPriorityCounter - // HasCount checks if Count has been set in PatternFlowVlanPriorityCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVlanPriorityCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVlanPriorityCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowVlanPriorityCounter object -func (obj *patternFlowVlanPriorityCounter) SetStart(value uint32) PatternFlowVlanPriorityCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVlanPriorityCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVlanPriorityCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowVlanPriorityCounter object -func (obj *patternFlowVlanPriorityCounter) SetStep(value uint32) PatternFlowVlanPriorityCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVlanPriorityCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVlanPriorityCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowVlanPriorityCounter object -func (obj *patternFlowVlanPriorityCounter) SetCount(value uint32) PatternFlowVlanPriorityCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowVlanPriorityCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanPriorityCounter.Start <= 7 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanPriorityCounter.Step <= 7 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanPriorityCounter.Count <= 7 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowVlanPriorityCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowVlanPriorityMetricTag ***** -type patternFlowVlanPriorityMetricTag struct { - validation - obj *otg.PatternFlowVlanPriorityMetricTag - marshaller marshalPatternFlowVlanPriorityMetricTag - unMarshaller unMarshalPatternFlowVlanPriorityMetricTag -} - -func NewPatternFlowVlanPriorityMetricTag() PatternFlowVlanPriorityMetricTag { - obj := patternFlowVlanPriorityMetricTag{obj: &otg.PatternFlowVlanPriorityMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVlanPriorityMetricTag) msg() *otg.PatternFlowVlanPriorityMetricTag { - return obj.obj -} - -func (obj *patternFlowVlanPriorityMetricTag) setMsg(msg *otg.PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVlanPriorityMetricTag struct { - obj *patternFlowVlanPriorityMetricTag -} - -type marshalPatternFlowVlanPriorityMetricTag interface { - // ToProto marshals PatternFlowVlanPriorityMetricTag to protobuf object *otg.PatternFlowVlanPriorityMetricTag - ToProto() (*otg.PatternFlowVlanPriorityMetricTag, error) - // ToPbText marshals PatternFlowVlanPriorityMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVlanPriorityMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVlanPriorityMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVlanPriorityMetricTag struct { - obj *patternFlowVlanPriorityMetricTag -} - -type unMarshalPatternFlowVlanPriorityMetricTag interface { - // FromProto unmarshals PatternFlowVlanPriorityMetricTag from protobuf object *otg.PatternFlowVlanPriorityMetricTag - FromProto(msg *otg.PatternFlowVlanPriorityMetricTag) (PatternFlowVlanPriorityMetricTag, error) - // FromPbText unmarshals PatternFlowVlanPriorityMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVlanPriorityMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVlanPriorityMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVlanPriorityMetricTag) Marshal() marshalPatternFlowVlanPriorityMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVlanPriorityMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVlanPriorityMetricTag) Unmarshal() unMarshalPatternFlowVlanPriorityMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVlanPriorityMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVlanPriorityMetricTag) ToProto() (*otg.PatternFlowVlanPriorityMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVlanPriorityMetricTag) FromProto(msg *otg.PatternFlowVlanPriorityMetricTag) (PatternFlowVlanPriorityMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVlanPriorityMetricTag) 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 *unMarshalpatternFlowVlanPriorityMetricTag) 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 *marshalpatternFlowVlanPriorityMetricTag) 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 *unMarshalpatternFlowVlanPriorityMetricTag) 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 *marshalpatternFlowVlanPriorityMetricTag) 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 *unMarshalpatternFlowVlanPriorityMetricTag) 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 *patternFlowVlanPriorityMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVlanPriorityMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVlanPriorityMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVlanPriorityMetricTag) Clone() (PatternFlowVlanPriorityMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVlanPriorityMetricTag() - 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 -} - -// PatternFlowVlanPriorityMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowVlanPriorityMetricTag interface { - Validation - // msg marshals PatternFlowVlanPriorityMetricTag to protobuf object *otg.PatternFlowVlanPriorityMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowVlanPriorityMetricTag - // setMsg unmarshals PatternFlowVlanPriorityMetricTag from protobuf object *otg.PatternFlowVlanPriorityMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityMetricTag - // provides marshal interface - Marshal() marshalPatternFlowVlanPriorityMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVlanPriorityMetricTag - // validate validates PatternFlowVlanPriorityMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVlanPriorityMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowVlanPriorityMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowVlanPriorityMetricTag - SetName(value string) PatternFlowVlanPriorityMetricTag - // Offset returns uint32, set in PatternFlowVlanPriorityMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowVlanPriorityMetricTag - SetOffset(value uint32) PatternFlowVlanPriorityMetricTag - // HasOffset checks if Offset has been set in PatternFlowVlanPriorityMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowVlanPriorityMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowVlanPriorityMetricTag - SetLength(value uint32) PatternFlowVlanPriorityMetricTag - // HasLength checks if Length has been set in PatternFlowVlanPriorityMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowVlanPriorityMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowVlanPriorityMetricTag object -func (obj *patternFlowVlanPriorityMetricTag) SetName(value string) PatternFlowVlanPriorityMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVlanPriorityMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVlanPriorityMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowVlanPriorityMetricTag object -func (obj *patternFlowVlanPriorityMetricTag) SetOffset(value uint32) PatternFlowVlanPriorityMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVlanPriorityMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVlanPriorityMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowVlanPriorityMetricTag object -func (obj *patternFlowVlanPriorityMetricTag) SetLength(value uint32) PatternFlowVlanPriorityMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowVlanPriorityMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVlanPriorityMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 2 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanPriorityMetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowVlanPriorityMetricTag.Length <= 3 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowVlanPriorityMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(3) - } - -} - -// ***** PatternFlowVlanCfiCounter ***** -type patternFlowVlanCfiCounter struct { - validation - obj *otg.PatternFlowVlanCfiCounter - marshaller marshalPatternFlowVlanCfiCounter - unMarshaller unMarshalPatternFlowVlanCfiCounter -} - -func NewPatternFlowVlanCfiCounter() PatternFlowVlanCfiCounter { - obj := patternFlowVlanCfiCounter{obj: &otg.PatternFlowVlanCfiCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVlanCfiCounter) msg() *otg.PatternFlowVlanCfiCounter { - return obj.obj -} - -func (obj *patternFlowVlanCfiCounter) setMsg(msg *otg.PatternFlowVlanCfiCounter) PatternFlowVlanCfiCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVlanCfiCounter struct { - obj *patternFlowVlanCfiCounter -} - -type marshalPatternFlowVlanCfiCounter interface { - // ToProto marshals PatternFlowVlanCfiCounter to protobuf object *otg.PatternFlowVlanCfiCounter - ToProto() (*otg.PatternFlowVlanCfiCounter, error) - // ToPbText marshals PatternFlowVlanCfiCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVlanCfiCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVlanCfiCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVlanCfiCounter struct { - obj *patternFlowVlanCfiCounter -} - -type unMarshalPatternFlowVlanCfiCounter interface { - // FromProto unmarshals PatternFlowVlanCfiCounter from protobuf object *otg.PatternFlowVlanCfiCounter - FromProto(msg *otg.PatternFlowVlanCfiCounter) (PatternFlowVlanCfiCounter, error) - // FromPbText unmarshals PatternFlowVlanCfiCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVlanCfiCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVlanCfiCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVlanCfiCounter) Marshal() marshalPatternFlowVlanCfiCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVlanCfiCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVlanCfiCounter) Unmarshal() unMarshalPatternFlowVlanCfiCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVlanCfiCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVlanCfiCounter) ToProto() (*otg.PatternFlowVlanCfiCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVlanCfiCounter) FromProto(msg *otg.PatternFlowVlanCfiCounter) (PatternFlowVlanCfiCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVlanCfiCounter) 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 *unMarshalpatternFlowVlanCfiCounter) 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 *marshalpatternFlowVlanCfiCounter) 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 *unMarshalpatternFlowVlanCfiCounter) 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 *marshalpatternFlowVlanCfiCounter) 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 *unMarshalpatternFlowVlanCfiCounter) 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 *patternFlowVlanCfiCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVlanCfiCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVlanCfiCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVlanCfiCounter) Clone() (PatternFlowVlanCfiCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVlanCfiCounter() - 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 -} - -// PatternFlowVlanCfiCounter is integer counter pattern -type PatternFlowVlanCfiCounter interface { - Validation - // msg marshals PatternFlowVlanCfiCounter to protobuf object *otg.PatternFlowVlanCfiCounter - // and doesn't set defaults - msg() *otg.PatternFlowVlanCfiCounter - // setMsg unmarshals PatternFlowVlanCfiCounter from protobuf object *otg.PatternFlowVlanCfiCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowVlanCfiCounter) PatternFlowVlanCfiCounter - // provides marshal interface - Marshal() marshalPatternFlowVlanCfiCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVlanCfiCounter - // validate validates PatternFlowVlanCfiCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVlanCfiCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowVlanCfiCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowVlanCfiCounter - SetStart(value uint32) PatternFlowVlanCfiCounter - // HasStart checks if Start has been set in PatternFlowVlanCfiCounter - HasStart() bool - // Step returns uint32, set in PatternFlowVlanCfiCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowVlanCfiCounter - SetStep(value uint32) PatternFlowVlanCfiCounter - // HasStep checks if Step has been set in PatternFlowVlanCfiCounter - HasStep() bool - // Count returns uint32, set in PatternFlowVlanCfiCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowVlanCfiCounter - SetCount(value uint32) PatternFlowVlanCfiCounter - // HasCount checks if Count has been set in PatternFlowVlanCfiCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVlanCfiCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVlanCfiCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowVlanCfiCounter object -func (obj *patternFlowVlanCfiCounter) SetStart(value uint32) PatternFlowVlanCfiCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVlanCfiCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVlanCfiCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowVlanCfiCounter object -func (obj *patternFlowVlanCfiCounter) SetStep(value uint32) PatternFlowVlanCfiCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVlanCfiCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVlanCfiCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowVlanCfiCounter object -func (obj *patternFlowVlanCfiCounter) SetCount(value uint32) PatternFlowVlanCfiCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowVlanCfiCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanCfiCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanCfiCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanCfiCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowVlanCfiCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowVlanCfiMetricTag ***** -type patternFlowVlanCfiMetricTag struct { - validation - obj *otg.PatternFlowVlanCfiMetricTag - marshaller marshalPatternFlowVlanCfiMetricTag - unMarshaller unMarshalPatternFlowVlanCfiMetricTag -} - -func NewPatternFlowVlanCfiMetricTag() PatternFlowVlanCfiMetricTag { - obj := patternFlowVlanCfiMetricTag{obj: &otg.PatternFlowVlanCfiMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVlanCfiMetricTag) msg() *otg.PatternFlowVlanCfiMetricTag { - return obj.obj -} - -func (obj *patternFlowVlanCfiMetricTag) setMsg(msg *otg.PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVlanCfiMetricTag struct { - obj *patternFlowVlanCfiMetricTag -} - -type marshalPatternFlowVlanCfiMetricTag interface { - // ToProto marshals PatternFlowVlanCfiMetricTag to protobuf object *otg.PatternFlowVlanCfiMetricTag - ToProto() (*otg.PatternFlowVlanCfiMetricTag, error) - // ToPbText marshals PatternFlowVlanCfiMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVlanCfiMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVlanCfiMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVlanCfiMetricTag struct { - obj *patternFlowVlanCfiMetricTag -} - -type unMarshalPatternFlowVlanCfiMetricTag interface { - // FromProto unmarshals PatternFlowVlanCfiMetricTag from protobuf object *otg.PatternFlowVlanCfiMetricTag - FromProto(msg *otg.PatternFlowVlanCfiMetricTag) (PatternFlowVlanCfiMetricTag, error) - // FromPbText unmarshals PatternFlowVlanCfiMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVlanCfiMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVlanCfiMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVlanCfiMetricTag) Marshal() marshalPatternFlowVlanCfiMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVlanCfiMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVlanCfiMetricTag) Unmarshal() unMarshalPatternFlowVlanCfiMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVlanCfiMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVlanCfiMetricTag) ToProto() (*otg.PatternFlowVlanCfiMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVlanCfiMetricTag) FromProto(msg *otg.PatternFlowVlanCfiMetricTag) (PatternFlowVlanCfiMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVlanCfiMetricTag) 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 *unMarshalpatternFlowVlanCfiMetricTag) 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 *marshalpatternFlowVlanCfiMetricTag) 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 *unMarshalpatternFlowVlanCfiMetricTag) 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 *marshalpatternFlowVlanCfiMetricTag) 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 *unMarshalpatternFlowVlanCfiMetricTag) 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 *patternFlowVlanCfiMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVlanCfiMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVlanCfiMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVlanCfiMetricTag) Clone() (PatternFlowVlanCfiMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVlanCfiMetricTag() - 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 -} - -// PatternFlowVlanCfiMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowVlanCfiMetricTag interface { - Validation - // msg marshals PatternFlowVlanCfiMetricTag to protobuf object *otg.PatternFlowVlanCfiMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowVlanCfiMetricTag - // setMsg unmarshals PatternFlowVlanCfiMetricTag from protobuf object *otg.PatternFlowVlanCfiMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiMetricTag - // provides marshal interface - Marshal() marshalPatternFlowVlanCfiMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVlanCfiMetricTag - // validate validates PatternFlowVlanCfiMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVlanCfiMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowVlanCfiMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowVlanCfiMetricTag - SetName(value string) PatternFlowVlanCfiMetricTag - // Offset returns uint32, set in PatternFlowVlanCfiMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowVlanCfiMetricTag - SetOffset(value uint32) PatternFlowVlanCfiMetricTag - // HasOffset checks if Offset has been set in PatternFlowVlanCfiMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowVlanCfiMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowVlanCfiMetricTag - SetLength(value uint32) PatternFlowVlanCfiMetricTag - // HasLength checks if Length has been set in PatternFlowVlanCfiMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowVlanCfiMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowVlanCfiMetricTag object -func (obj *patternFlowVlanCfiMetricTag) SetName(value string) PatternFlowVlanCfiMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVlanCfiMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVlanCfiMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowVlanCfiMetricTag object -func (obj *patternFlowVlanCfiMetricTag) SetOffset(value uint32) PatternFlowVlanCfiMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVlanCfiMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVlanCfiMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowVlanCfiMetricTag object -func (obj *patternFlowVlanCfiMetricTag) SetLength(value uint32) PatternFlowVlanCfiMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowVlanCfiMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVlanCfiMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanCfiMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowVlanCfiMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowVlanCfiMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowVlanIdCounter ***** -type patternFlowVlanIdCounter struct { - validation - obj *otg.PatternFlowVlanIdCounter - marshaller marshalPatternFlowVlanIdCounter - unMarshaller unMarshalPatternFlowVlanIdCounter -} - -func NewPatternFlowVlanIdCounter() PatternFlowVlanIdCounter { - obj := patternFlowVlanIdCounter{obj: &otg.PatternFlowVlanIdCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVlanIdCounter) msg() *otg.PatternFlowVlanIdCounter { - return obj.obj -} - -func (obj *patternFlowVlanIdCounter) setMsg(msg *otg.PatternFlowVlanIdCounter) PatternFlowVlanIdCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVlanIdCounter struct { - obj *patternFlowVlanIdCounter -} - -type marshalPatternFlowVlanIdCounter interface { - // ToProto marshals PatternFlowVlanIdCounter to protobuf object *otg.PatternFlowVlanIdCounter - ToProto() (*otg.PatternFlowVlanIdCounter, error) - // ToPbText marshals PatternFlowVlanIdCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVlanIdCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVlanIdCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVlanIdCounter struct { - obj *patternFlowVlanIdCounter -} - -type unMarshalPatternFlowVlanIdCounter interface { - // FromProto unmarshals PatternFlowVlanIdCounter from protobuf object *otg.PatternFlowVlanIdCounter - FromProto(msg *otg.PatternFlowVlanIdCounter) (PatternFlowVlanIdCounter, error) - // FromPbText unmarshals PatternFlowVlanIdCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVlanIdCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVlanIdCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVlanIdCounter) Marshal() marshalPatternFlowVlanIdCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVlanIdCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVlanIdCounter) Unmarshal() unMarshalPatternFlowVlanIdCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVlanIdCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVlanIdCounter) ToProto() (*otg.PatternFlowVlanIdCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVlanIdCounter) FromProto(msg *otg.PatternFlowVlanIdCounter) (PatternFlowVlanIdCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVlanIdCounter) 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 *unMarshalpatternFlowVlanIdCounter) 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 *marshalpatternFlowVlanIdCounter) 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 *unMarshalpatternFlowVlanIdCounter) 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 *marshalpatternFlowVlanIdCounter) 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 *unMarshalpatternFlowVlanIdCounter) 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 *patternFlowVlanIdCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVlanIdCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVlanIdCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVlanIdCounter) Clone() (PatternFlowVlanIdCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVlanIdCounter() - 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 -} - -// PatternFlowVlanIdCounter is integer counter pattern -type PatternFlowVlanIdCounter interface { - Validation - // msg marshals PatternFlowVlanIdCounter to protobuf object *otg.PatternFlowVlanIdCounter - // and doesn't set defaults - msg() *otg.PatternFlowVlanIdCounter - // setMsg unmarshals PatternFlowVlanIdCounter from protobuf object *otg.PatternFlowVlanIdCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowVlanIdCounter) PatternFlowVlanIdCounter - // provides marshal interface - Marshal() marshalPatternFlowVlanIdCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVlanIdCounter - // validate validates PatternFlowVlanIdCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVlanIdCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowVlanIdCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowVlanIdCounter - SetStart(value uint32) PatternFlowVlanIdCounter - // HasStart checks if Start has been set in PatternFlowVlanIdCounter - HasStart() bool - // Step returns uint32, set in PatternFlowVlanIdCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowVlanIdCounter - SetStep(value uint32) PatternFlowVlanIdCounter - // HasStep checks if Step has been set in PatternFlowVlanIdCounter - HasStep() bool - // Count returns uint32, set in PatternFlowVlanIdCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowVlanIdCounter - SetCount(value uint32) PatternFlowVlanIdCounter - // HasCount checks if Count has been set in PatternFlowVlanIdCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVlanIdCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVlanIdCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowVlanIdCounter object -func (obj *patternFlowVlanIdCounter) SetStart(value uint32) PatternFlowVlanIdCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVlanIdCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVlanIdCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowVlanIdCounter object -func (obj *patternFlowVlanIdCounter) SetStep(value uint32) PatternFlowVlanIdCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVlanIdCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVlanIdCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowVlanIdCounter object -func (obj *patternFlowVlanIdCounter) SetCount(value uint32) PatternFlowVlanIdCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowVlanIdCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanIdCounter.Start <= 4095 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanIdCounter.Step <= 4095 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanIdCounter.Count <= 4095 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowVlanIdCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowVlanIdMetricTag ***** -type patternFlowVlanIdMetricTag struct { - validation - obj *otg.PatternFlowVlanIdMetricTag - marshaller marshalPatternFlowVlanIdMetricTag - unMarshaller unMarshalPatternFlowVlanIdMetricTag -} - -func NewPatternFlowVlanIdMetricTag() PatternFlowVlanIdMetricTag { - obj := patternFlowVlanIdMetricTag{obj: &otg.PatternFlowVlanIdMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVlanIdMetricTag) msg() *otg.PatternFlowVlanIdMetricTag { - return obj.obj -} - -func (obj *patternFlowVlanIdMetricTag) setMsg(msg *otg.PatternFlowVlanIdMetricTag) PatternFlowVlanIdMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVlanIdMetricTag struct { - obj *patternFlowVlanIdMetricTag -} - -type marshalPatternFlowVlanIdMetricTag interface { - // ToProto marshals PatternFlowVlanIdMetricTag to protobuf object *otg.PatternFlowVlanIdMetricTag - ToProto() (*otg.PatternFlowVlanIdMetricTag, error) - // ToPbText marshals PatternFlowVlanIdMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVlanIdMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVlanIdMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVlanIdMetricTag struct { - obj *patternFlowVlanIdMetricTag -} - -type unMarshalPatternFlowVlanIdMetricTag interface { - // FromProto unmarshals PatternFlowVlanIdMetricTag from protobuf object *otg.PatternFlowVlanIdMetricTag - FromProto(msg *otg.PatternFlowVlanIdMetricTag) (PatternFlowVlanIdMetricTag, error) - // FromPbText unmarshals PatternFlowVlanIdMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVlanIdMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVlanIdMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVlanIdMetricTag) Marshal() marshalPatternFlowVlanIdMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVlanIdMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVlanIdMetricTag) Unmarshal() unMarshalPatternFlowVlanIdMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVlanIdMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVlanIdMetricTag) ToProto() (*otg.PatternFlowVlanIdMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVlanIdMetricTag) FromProto(msg *otg.PatternFlowVlanIdMetricTag) (PatternFlowVlanIdMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVlanIdMetricTag) 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 *unMarshalpatternFlowVlanIdMetricTag) 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 *marshalpatternFlowVlanIdMetricTag) 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 *unMarshalpatternFlowVlanIdMetricTag) 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 *marshalpatternFlowVlanIdMetricTag) 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 *unMarshalpatternFlowVlanIdMetricTag) 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 *patternFlowVlanIdMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVlanIdMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVlanIdMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVlanIdMetricTag) Clone() (PatternFlowVlanIdMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVlanIdMetricTag() - 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 -} - -// PatternFlowVlanIdMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowVlanIdMetricTag interface { - Validation - // msg marshals PatternFlowVlanIdMetricTag to protobuf object *otg.PatternFlowVlanIdMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowVlanIdMetricTag - // setMsg unmarshals PatternFlowVlanIdMetricTag from protobuf object *otg.PatternFlowVlanIdMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowVlanIdMetricTag) PatternFlowVlanIdMetricTag - // provides marshal interface - Marshal() marshalPatternFlowVlanIdMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVlanIdMetricTag - // validate validates PatternFlowVlanIdMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVlanIdMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowVlanIdMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowVlanIdMetricTag - SetName(value string) PatternFlowVlanIdMetricTag - // Offset returns uint32, set in PatternFlowVlanIdMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowVlanIdMetricTag - SetOffset(value uint32) PatternFlowVlanIdMetricTag - // HasOffset checks if Offset has been set in PatternFlowVlanIdMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowVlanIdMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowVlanIdMetricTag - SetLength(value uint32) PatternFlowVlanIdMetricTag - // HasLength checks if Length has been set in PatternFlowVlanIdMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowVlanIdMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowVlanIdMetricTag object -func (obj *patternFlowVlanIdMetricTag) SetName(value string) PatternFlowVlanIdMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVlanIdMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVlanIdMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowVlanIdMetricTag object -func (obj *patternFlowVlanIdMetricTag) SetOffset(value uint32) PatternFlowVlanIdMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVlanIdMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVlanIdMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowVlanIdMetricTag object -func (obj *patternFlowVlanIdMetricTag) SetLength(value uint32) PatternFlowVlanIdMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowVlanIdMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVlanIdMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 11 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanIdMetricTag.Offset <= 11 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 12 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowVlanIdMetricTag.Length <= 12 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowVlanIdMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(12) - } - -} - -// ***** PatternFlowVlanTpidCounter ***** -type patternFlowVlanTpidCounter struct { - validation - obj *otg.PatternFlowVlanTpidCounter - marshaller marshalPatternFlowVlanTpidCounter - unMarshaller unMarshalPatternFlowVlanTpidCounter -} - -func NewPatternFlowVlanTpidCounter() PatternFlowVlanTpidCounter { - obj := patternFlowVlanTpidCounter{obj: &otg.PatternFlowVlanTpidCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVlanTpidCounter) msg() *otg.PatternFlowVlanTpidCounter { - return obj.obj -} - -func (obj *patternFlowVlanTpidCounter) setMsg(msg *otg.PatternFlowVlanTpidCounter) PatternFlowVlanTpidCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVlanTpidCounter struct { - obj *patternFlowVlanTpidCounter -} - -type marshalPatternFlowVlanTpidCounter interface { - // ToProto marshals PatternFlowVlanTpidCounter to protobuf object *otg.PatternFlowVlanTpidCounter - ToProto() (*otg.PatternFlowVlanTpidCounter, error) - // ToPbText marshals PatternFlowVlanTpidCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVlanTpidCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVlanTpidCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVlanTpidCounter struct { - obj *patternFlowVlanTpidCounter -} - -type unMarshalPatternFlowVlanTpidCounter interface { - // FromProto unmarshals PatternFlowVlanTpidCounter from protobuf object *otg.PatternFlowVlanTpidCounter - FromProto(msg *otg.PatternFlowVlanTpidCounter) (PatternFlowVlanTpidCounter, error) - // FromPbText unmarshals PatternFlowVlanTpidCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVlanTpidCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVlanTpidCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVlanTpidCounter) Marshal() marshalPatternFlowVlanTpidCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVlanTpidCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVlanTpidCounter) Unmarshal() unMarshalPatternFlowVlanTpidCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVlanTpidCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVlanTpidCounter) ToProto() (*otg.PatternFlowVlanTpidCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVlanTpidCounter) FromProto(msg *otg.PatternFlowVlanTpidCounter) (PatternFlowVlanTpidCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVlanTpidCounter) 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 *unMarshalpatternFlowVlanTpidCounter) 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 *marshalpatternFlowVlanTpidCounter) 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 *unMarshalpatternFlowVlanTpidCounter) 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 *marshalpatternFlowVlanTpidCounter) 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 *unMarshalpatternFlowVlanTpidCounter) 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 *patternFlowVlanTpidCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVlanTpidCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVlanTpidCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVlanTpidCounter) Clone() (PatternFlowVlanTpidCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVlanTpidCounter() - 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 -} - -// PatternFlowVlanTpidCounter is integer counter pattern -type PatternFlowVlanTpidCounter interface { - Validation - // msg marshals PatternFlowVlanTpidCounter to protobuf object *otg.PatternFlowVlanTpidCounter - // and doesn't set defaults - msg() *otg.PatternFlowVlanTpidCounter - // setMsg unmarshals PatternFlowVlanTpidCounter from protobuf object *otg.PatternFlowVlanTpidCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowVlanTpidCounter) PatternFlowVlanTpidCounter - // provides marshal interface - Marshal() marshalPatternFlowVlanTpidCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVlanTpidCounter - // validate validates PatternFlowVlanTpidCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVlanTpidCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowVlanTpidCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowVlanTpidCounter - SetStart(value uint32) PatternFlowVlanTpidCounter - // HasStart checks if Start has been set in PatternFlowVlanTpidCounter - HasStart() bool - // Step returns uint32, set in PatternFlowVlanTpidCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowVlanTpidCounter - SetStep(value uint32) PatternFlowVlanTpidCounter - // HasStep checks if Step has been set in PatternFlowVlanTpidCounter - HasStep() bool - // Count returns uint32, set in PatternFlowVlanTpidCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowVlanTpidCounter - SetCount(value uint32) PatternFlowVlanTpidCounter - // HasCount checks if Count has been set in PatternFlowVlanTpidCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVlanTpidCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVlanTpidCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowVlanTpidCounter object -func (obj *patternFlowVlanTpidCounter) SetStart(value uint32) PatternFlowVlanTpidCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVlanTpidCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVlanTpidCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowVlanTpidCounter object -func (obj *patternFlowVlanTpidCounter) SetStep(value uint32) PatternFlowVlanTpidCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVlanTpidCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVlanTpidCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowVlanTpidCounter object -func (obj *patternFlowVlanTpidCounter) SetCount(value uint32) PatternFlowVlanTpidCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowVlanTpidCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanTpidCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanTpidCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanTpidCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowVlanTpidCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(65535) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowVlanTpidMetricTag ***** -type patternFlowVlanTpidMetricTag struct { - validation - obj *otg.PatternFlowVlanTpidMetricTag - marshaller marshalPatternFlowVlanTpidMetricTag - unMarshaller unMarshalPatternFlowVlanTpidMetricTag -} - -func NewPatternFlowVlanTpidMetricTag() PatternFlowVlanTpidMetricTag { - obj := patternFlowVlanTpidMetricTag{obj: &otg.PatternFlowVlanTpidMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVlanTpidMetricTag) msg() *otg.PatternFlowVlanTpidMetricTag { - return obj.obj -} - -func (obj *patternFlowVlanTpidMetricTag) setMsg(msg *otg.PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVlanTpidMetricTag struct { - obj *patternFlowVlanTpidMetricTag -} - -type marshalPatternFlowVlanTpidMetricTag interface { - // ToProto marshals PatternFlowVlanTpidMetricTag to protobuf object *otg.PatternFlowVlanTpidMetricTag - ToProto() (*otg.PatternFlowVlanTpidMetricTag, error) - // ToPbText marshals PatternFlowVlanTpidMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVlanTpidMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVlanTpidMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVlanTpidMetricTag struct { - obj *patternFlowVlanTpidMetricTag -} - -type unMarshalPatternFlowVlanTpidMetricTag interface { - // FromProto unmarshals PatternFlowVlanTpidMetricTag from protobuf object *otg.PatternFlowVlanTpidMetricTag - FromProto(msg *otg.PatternFlowVlanTpidMetricTag) (PatternFlowVlanTpidMetricTag, error) - // FromPbText unmarshals PatternFlowVlanTpidMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVlanTpidMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVlanTpidMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVlanTpidMetricTag) Marshal() marshalPatternFlowVlanTpidMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVlanTpidMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVlanTpidMetricTag) Unmarshal() unMarshalPatternFlowVlanTpidMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVlanTpidMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVlanTpidMetricTag) ToProto() (*otg.PatternFlowVlanTpidMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVlanTpidMetricTag) FromProto(msg *otg.PatternFlowVlanTpidMetricTag) (PatternFlowVlanTpidMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVlanTpidMetricTag) 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 *unMarshalpatternFlowVlanTpidMetricTag) 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 *marshalpatternFlowVlanTpidMetricTag) 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 *unMarshalpatternFlowVlanTpidMetricTag) 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 *marshalpatternFlowVlanTpidMetricTag) 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 *unMarshalpatternFlowVlanTpidMetricTag) 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 *patternFlowVlanTpidMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVlanTpidMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVlanTpidMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVlanTpidMetricTag) Clone() (PatternFlowVlanTpidMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVlanTpidMetricTag() - 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 -} - -// PatternFlowVlanTpidMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowVlanTpidMetricTag interface { - Validation - // msg marshals PatternFlowVlanTpidMetricTag to protobuf object *otg.PatternFlowVlanTpidMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowVlanTpidMetricTag - // setMsg unmarshals PatternFlowVlanTpidMetricTag from protobuf object *otg.PatternFlowVlanTpidMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidMetricTag - // provides marshal interface - Marshal() marshalPatternFlowVlanTpidMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVlanTpidMetricTag - // validate validates PatternFlowVlanTpidMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVlanTpidMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowVlanTpidMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowVlanTpidMetricTag - SetName(value string) PatternFlowVlanTpidMetricTag - // Offset returns uint32, set in PatternFlowVlanTpidMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowVlanTpidMetricTag - SetOffset(value uint32) PatternFlowVlanTpidMetricTag - // HasOffset checks if Offset has been set in PatternFlowVlanTpidMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowVlanTpidMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowVlanTpidMetricTag - SetLength(value uint32) PatternFlowVlanTpidMetricTag - // HasLength checks if Length has been set in PatternFlowVlanTpidMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowVlanTpidMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowVlanTpidMetricTag object -func (obj *patternFlowVlanTpidMetricTag) SetName(value string) PatternFlowVlanTpidMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVlanTpidMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVlanTpidMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowVlanTpidMetricTag object -func (obj *patternFlowVlanTpidMetricTag) SetOffset(value uint32) PatternFlowVlanTpidMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVlanTpidMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVlanTpidMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowVlanTpidMetricTag object -func (obj *patternFlowVlanTpidMetricTag) SetLength(value uint32) PatternFlowVlanTpidMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowVlanTpidMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVlanTpidMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVlanTpidMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowVlanTpidMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowVlanTpidMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowVxlanFlagsCounter ***** -type patternFlowVxlanFlagsCounter struct { - validation - obj *otg.PatternFlowVxlanFlagsCounter - marshaller marshalPatternFlowVxlanFlagsCounter - unMarshaller unMarshalPatternFlowVxlanFlagsCounter -} - -func NewPatternFlowVxlanFlagsCounter() PatternFlowVxlanFlagsCounter { - obj := patternFlowVxlanFlagsCounter{obj: &otg.PatternFlowVxlanFlagsCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVxlanFlagsCounter) msg() *otg.PatternFlowVxlanFlagsCounter { - return obj.obj -} - -func (obj *patternFlowVxlanFlagsCounter) setMsg(msg *otg.PatternFlowVxlanFlagsCounter) PatternFlowVxlanFlagsCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVxlanFlagsCounter struct { - obj *patternFlowVxlanFlagsCounter -} - -type marshalPatternFlowVxlanFlagsCounter interface { - // ToProto marshals PatternFlowVxlanFlagsCounter to protobuf object *otg.PatternFlowVxlanFlagsCounter - ToProto() (*otg.PatternFlowVxlanFlagsCounter, error) - // ToPbText marshals PatternFlowVxlanFlagsCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVxlanFlagsCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVxlanFlagsCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVxlanFlagsCounter struct { - obj *patternFlowVxlanFlagsCounter -} - -type unMarshalPatternFlowVxlanFlagsCounter interface { - // FromProto unmarshals PatternFlowVxlanFlagsCounter from protobuf object *otg.PatternFlowVxlanFlagsCounter - FromProto(msg *otg.PatternFlowVxlanFlagsCounter) (PatternFlowVxlanFlagsCounter, error) - // FromPbText unmarshals PatternFlowVxlanFlagsCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVxlanFlagsCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVxlanFlagsCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVxlanFlagsCounter) Marshal() marshalPatternFlowVxlanFlagsCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVxlanFlagsCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVxlanFlagsCounter) Unmarshal() unMarshalPatternFlowVxlanFlagsCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVxlanFlagsCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVxlanFlagsCounter) ToProto() (*otg.PatternFlowVxlanFlagsCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVxlanFlagsCounter) FromProto(msg *otg.PatternFlowVxlanFlagsCounter) (PatternFlowVxlanFlagsCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVxlanFlagsCounter) 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 *unMarshalpatternFlowVxlanFlagsCounter) 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 *marshalpatternFlowVxlanFlagsCounter) 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 *unMarshalpatternFlowVxlanFlagsCounter) 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 *marshalpatternFlowVxlanFlagsCounter) 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 *unMarshalpatternFlowVxlanFlagsCounter) 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 *patternFlowVxlanFlagsCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVxlanFlagsCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVxlanFlagsCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVxlanFlagsCounter) Clone() (PatternFlowVxlanFlagsCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVxlanFlagsCounter() - 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 -} - -// PatternFlowVxlanFlagsCounter is integer counter pattern -type PatternFlowVxlanFlagsCounter interface { - Validation - // msg marshals PatternFlowVxlanFlagsCounter to protobuf object *otg.PatternFlowVxlanFlagsCounter - // and doesn't set defaults - msg() *otg.PatternFlowVxlanFlagsCounter - // setMsg unmarshals PatternFlowVxlanFlagsCounter from protobuf object *otg.PatternFlowVxlanFlagsCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowVxlanFlagsCounter) PatternFlowVxlanFlagsCounter - // provides marshal interface - Marshal() marshalPatternFlowVxlanFlagsCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVxlanFlagsCounter - // validate validates PatternFlowVxlanFlagsCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVxlanFlagsCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowVxlanFlagsCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowVxlanFlagsCounter - SetStart(value uint32) PatternFlowVxlanFlagsCounter - // HasStart checks if Start has been set in PatternFlowVxlanFlagsCounter - HasStart() bool - // Step returns uint32, set in PatternFlowVxlanFlagsCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowVxlanFlagsCounter - SetStep(value uint32) PatternFlowVxlanFlagsCounter - // HasStep checks if Step has been set in PatternFlowVxlanFlagsCounter - HasStep() bool - // Count returns uint32, set in PatternFlowVxlanFlagsCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowVxlanFlagsCounter - SetCount(value uint32) PatternFlowVxlanFlagsCounter - // HasCount checks if Count has been set in PatternFlowVxlanFlagsCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVxlanFlagsCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVxlanFlagsCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowVxlanFlagsCounter object -func (obj *patternFlowVxlanFlagsCounter) SetStart(value uint32) PatternFlowVxlanFlagsCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVxlanFlagsCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVxlanFlagsCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowVxlanFlagsCounter object -func (obj *patternFlowVxlanFlagsCounter) SetStep(value uint32) PatternFlowVxlanFlagsCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVxlanFlagsCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVxlanFlagsCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowVxlanFlagsCounter object -func (obj *patternFlowVxlanFlagsCounter) SetCount(value uint32) PatternFlowVxlanFlagsCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowVxlanFlagsCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanFlagsCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanFlagsCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanFlagsCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowVxlanFlagsCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(8) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowVxlanFlagsMetricTag ***** -type patternFlowVxlanFlagsMetricTag struct { - validation - obj *otg.PatternFlowVxlanFlagsMetricTag - marshaller marshalPatternFlowVxlanFlagsMetricTag - unMarshaller unMarshalPatternFlowVxlanFlagsMetricTag -} - -func NewPatternFlowVxlanFlagsMetricTag() PatternFlowVxlanFlagsMetricTag { - obj := patternFlowVxlanFlagsMetricTag{obj: &otg.PatternFlowVxlanFlagsMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVxlanFlagsMetricTag) msg() *otg.PatternFlowVxlanFlagsMetricTag { - return obj.obj -} - -func (obj *patternFlowVxlanFlagsMetricTag) setMsg(msg *otg.PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVxlanFlagsMetricTag struct { - obj *patternFlowVxlanFlagsMetricTag -} - -type marshalPatternFlowVxlanFlagsMetricTag interface { - // ToProto marshals PatternFlowVxlanFlagsMetricTag to protobuf object *otg.PatternFlowVxlanFlagsMetricTag - ToProto() (*otg.PatternFlowVxlanFlagsMetricTag, error) - // ToPbText marshals PatternFlowVxlanFlagsMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVxlanFlagsMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVxlanFlagsMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVxlanFlagsMetricTag struct { - obj *patternFlowVxlanFlagsMetricTag -} - -type unMarshalPatternFlowVxlanFlagsMetricTag interface { - // FromProto unmarshals PatternFlowVxlanFlagsMetricTag from protobuf object *otg.PatternFlowVxlanFlagsMetricTag - FromProto(msg *otg.PatternFlowVxlanFlagsMetricTag) (PatternFlowVxlanFlagsMetricTag, error) - // FromPbText unmarshals PatternFlowVxlanFlagsMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVxlanFlagsMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVxlanFlagsMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVxlanFlagsMetricTag) Marshal() marshalPatternFlowVxlanFlagsMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVxlanFlagsMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVxlanFlagsMetricTag) Unmarshal() unMarshalPatternFlowVxlanFlagsMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVxlanFlagsMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVxlanFlagsMetricTag) ToProto() (*otg.PatternFlowVxlanFlagsMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVxlanFlagsMetricTag) FromProto(msg *otg.PatternFlowVxlanFlagsMetricTag) (PatternFlowVxlanFlagsMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVxlanFlagsMetricTag) 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 *unMarshalpatternFlowVxlanFlagsMetricTag) 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 *marshalpatternFlowVxlanFlagsMetricTag) 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 *unMarshalpatternFlowVxlanFlagsMetricTag) 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 *marshalpatternFlowVxlanFlagsMetricTag) 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 *unMarshalpatternFlowVxlanFlagsMetricTag) 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 *patternFlowVxlanFlagsMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVxlanFlagsMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVxlanFlagsMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVxlanFlagsMetricTag) Clone() (PatternFlowVxlanFlagsMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVxlanFlagsMetricTag() - 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 -} - -// PatternFlowVxlanFlagsMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowVxlanFlagsMetricTag interface { - Validation - // msg marshals PatternFlowVxlanFlagsMetricTag to protobuf object *otg.PatternFlowVxlanFlagsMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowVxlanFlagsMetricTag - // setMsg unmarshals PatternFlowVxlanFlagsMetricTag from protobuf object *otg.PatternFlowVxlanFlagsMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsMetricTag - // provides marshal interface - Marshal() marshalPatternFlowVxlanFlagsMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVxlanFlagsMetricTag - // validate validates PatternFlowVxlanFlagsMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVxlanFlagsMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowVxlanFlagsMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowVxlanFlagsMetricTag - SetName(value string) PatternFlowVxlanFlagsMetricTag - // Offset returns uint32, set in PatternFlowVxlanFlagsMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowVxlanFlagsMetricTag - SetOffset(value uint32) PatternFlowVxlanFlagsMetricTag - // HasOffset checks if Offset has been set in PatternFlowVxlanFlagsMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowVxlanFlagsMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowVxlanFlagsMetricTag - SetLength(value uint32) PatternFlowVxlanFlagsMetricTag - // HasLength checks if Length has been set in PatternFlowVxlanFlagsMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowVxlanFlagsMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowVxlanFlagsMetricTag object -func (obj *patternFlowVxlanFlagsMetricTag) SetName(value string) PatternFlowVxlanFlagsMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVxlanFlagsMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVxlanFlagsMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowVxlanFlagsMetricTag object -func (obj *patternFlowVxlanFlagsMetricTag) SetOffset(value uint32) PatternFlowVxlanFlagsMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVxlanFlagsMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVxlanFlagsMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowVxlanFlagsMetricTag object -func (obj *patternFlowVxlanFlagsMetricTag) SetLength(value uint32) PatternFlowVxlanFlagsMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowVxlanFlagsMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVxlanFlagsMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanFlagsMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowVxlanFlagsMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowVxlanFlagsMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowVxlanReserved0Counter ***** -type patternFlowVxlanReserved0Counter struct { - validation - obj *otg.PatternFlowVxlanReserved0Counter - marshaller marshalPatternFlowVxlanReserved0Counter - unMarshaller unMarshalPatternFlowVxlanReserved0Counter -} - -func NewPatternFlowVxlanReserved0Counter() PatternFlowVxlanReserved0Counter { - obj := patternFlowVxlanReserved0Counter{obj: &otg.PatternFlowVxlanReserved0Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVxlanReserved0Counter) msg() *otg.PatternFlowVxlanReserved0Counter { - return obj.obj -} - -func (obj *patternFlowVxlanReserved0Counter) setMsg(msg *otg.PatternFlowVxlanReserved0Counter) PatternFlowVxlanReserved0Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVxlanReserved0Counter struct { - obj *patternFlowVxlanReserved0Counter -} - -type marshalPatternFlowVxlanReserved0Counter interface { - // ToProto marshals PatternFlowVxlanReserved0Counter to protobuf object *otg.PatternFlowVxlanReserved0Counter - ToProto() (*otg.PatternFlowVxlanReserved0Counter, error) - // ToPbText marshals PatternFlowVxlanReserved0Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVxlanReserved0Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVxlanReserved0Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVxlanReserved0Counter struct { - obj *patternFlowVxlanReserved0Counter -} - -type unMarshalPatternFlowVxlanReserved0Counter interface { - // FromProto unmarshals PatternFlowVxlanReserved0Counter from protobuf object *otg.PatternFlowVxlanReserved0Counter - FromProto(msg *otg.PatternFlowVxlanReserved0Counter) (PatternFlowVxlanReserved0Counter, error) - // FromPbText unmarshals PatternFlowVxlanReserved0Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVxlanReserved0Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVxlanReserved0Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVxlanReserved0Counter) Marshal() marshalPatternFlowVxlanReserved0Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVxlanReserved0Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVxlanReserved0Counter) Unmarshal() unMarshalPatternFlowVxlanReserved0Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVxlanReserved0Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVxlanReserved0Counter) ToProto() (*otg.PatternFlowVxlanReserved0Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVxlanReserved0Counter) FromProto(msg *otg.PatternFlowVxlanReserved0Counter) (PatternFlowVxlanReserved0Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVxlanReserved0Counter) 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 *unMarshalpatternFlowVxlanReserved0Counter) 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 *marshalpatternFlowVxlanReserved0Counter) 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 *unMarshalpatternFlowVxlanReserved0Counter) 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 *marshalpatternFlowVxlanReserved0Counter) 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 *unMarshalpatternFlowVxlanReserved0Counter) 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 *patternFlowVxlanReserved0Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVxlanReserved0Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVxlanReserved0Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVxlanReserved0Counter) Clone() (PatternFlowVxlanReserved0Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVxlanReserved0Counter() - 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 -} - -// PatternFlowVxlanReserved0Counter is integer counter pattern -type PatternFlowVxlanReserved0Counter interface { - Validation - // msg marshals PatternFlowVxlanReserved0Counter to protobuf object *otg.PatternFlowVxlanReserved0Counter - // and doesn't set defaults - msg() *otg.PatternFlowVxlanReserved0Counter - // setMsg unmarshals PatternFlowVxlanReserved0Counter from protobuf object *otg.PatternFlowVxlanReserved0Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowVxlanReserved0Counter) PatternFlowVxlanReserved0Counter - // provides marshal interface - Marshal() marshalPatternFlowVxlanReserved0Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVxlanReserved0Counter - // validate validates PatternFlowVxlanReserved0Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVxlanReserved0Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowVxlanReserved0Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowVxlanReserved0Counter - SetStart(value uint32) PatternFlowVxlanReserved0Counter - // HasStart checks if Start has been set in PatternFlowVxlanReserved0Counter - HasStart() bool - // Step returns uint32, set in PatternFlowVxlanReserved0Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowVxlanReserved0Counter - SetStep(value uint32) PatternFlowVxlanReserved0Counter - // HasStep checks if Step has been set in PatternFlowVxlanReserved0Counter - HasStep() bool - // Count returns uint32, set in PatternFlowVxlanReserved0Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowVxlanReserved0Counter - SetCount(value uint32) PatternFlowVxlanReserved0Counter - // HasCount checks if Count has been set in PatternFlowVxlanReserved0Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVxlanReserved0Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVxlanReserved0Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowVxlanReserved0Counter object -func (obj *patternFlowVxlanReserved0Counter) SetStart(value uint32) PatternFlowVxlanReserved0Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVxlanReserved0Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVxlanReserved0Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowVxlanReserved0Counter object -func (obj *patternFlowVxlanReserved0Counter) SetStep(value uint32) PatternFlowVxlanReserved0Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVxlanReserved0Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVxlanReserved0Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowVxlanReserved0Counter object -func (obj *patternFlowVxlanReserved0Counter) SetCount(value uint32) PatternFlowVxlanReserved0Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowVxlanReserved0Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanReserved0Counter.Start <= 16777215 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanReserved0Counter.Step <= 16777215 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanReserved0Counter.Count <= 16777215 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowVxlanReserved0Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowVxlanReserved0MetricTag ***** -type patternFlowVxlanReserved0MetricTag struct { - validation - obj *otg.PatternFlowVxlanReserved0MetricTag - marshaller marshalPatternFlowVxlanReserved0MetricTag - unMarshaller unMarshalPatternFlowVxlanReserved0MetricTag -} - -func NewPatternFlowVxlanReserved0MetricTag() PatternFlowVxlanReserved0MetricTag { - obj := patternFlowVxlanReserved0MetricTag{obj: &otg.PatternFlowVxlanReserved0MetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVxlanReserved0MetricTag) msg() *otg.PatternFlowVxlanReserved0MetricTag { - return obj.obj -} - -func (obj *patternFlowVxlanReserved0MetricTag) setMsg(msg *otg.PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0MetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVxlanReserved0MetricTag struct { - obj *patternFlowVxlanReserved0MetricTag -} - -type marshalPatternFlowVxlanReserved0MetricTag interface { - // ToProto marshals PatternFlowVxlanReserved0MetricTag to protobuf object *otg.PatternFlowVxlanReserved0MetricTag - ToProto() (*otg.PatternFlowVxlanReserved0MetricTag, error) - // ToPbText marshals PatternFlowVxlanReserved0MetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVxlanReserved0MetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVxlanReserved0MetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVxlanReserved0MetricTag struct { - obj *patternFlowVxlanReserved0MetricTag -} - -type unMarshalPatternFlowVxlanReserved0MetricTag interface { - // FromProto unmarshals PatternFlowVxlanReserved0MetricTag from protobuf object *otg.PatternFlowVxlanReserved0MetricTag - FromProto(msg *otg.PatternFlowVxlanReserved0MetricTag) (PatternFlowVxlanReserved0MetricTag, error) - // FromPbText unmarshals PatternFlowVxlanReserved0MetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVxlanReserved0MetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVxlanReserved0MetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVxlanReserved0MetricTag) Marshal() marshalPatternFlowVxlanReserved0MetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVxlanReserved0MetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVxlanReserved0MetricTag) Unmarshal() unMarshalPatternFlowVxlanReserved0MetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVxlanReserved0MetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVxlanReserved0MetricTag) ToProto() (*otg.PatternFlowVxlanReserved0MetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVxlanReserved0MetricTag) FromProto(msg *otg.PatternFlowVxlanReserved0MetricTag) (PatternFlowVxlanReserved0MetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVxlanReserved0MetricTag) 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 *unMarshalpatternFlowVxlanReserved0MetricTag) 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 *marshalpatternFlowVxlanReserved0MetricTag) 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 *unMarshalpatternFlowVxlanReserved0MetricTag) 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 *marshalpatternFlowVxlanReserved0MetricTag) 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 *unMarshalpatternFlowVxlanReserved0MetricTag) 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 *patternFlowVxlanReserved0MetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVxlanReserved0MetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVxlanReserved0MetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVxlanReserved0MetricTag) Clone() (PatternFlowVxlanReserved0MetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVxlanReserved0MetricTag() - 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 -} - -// PatternFlowVxlanReserved0MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowVxlanReserved0MetricTag interface { - Validation - // msg marshals PatternFlowVxlanReserved0MetricTag to protobuf object *otg.PatternFlowVxlanReserved0MetricTag - // and doesn't set defaults - msg() *otg.PatternFlowVxlanReserved0MetricTag - // setMsg unmarshals PatternFlowVxlanReserved0MetricTag from protobuf object *otg.PatternFlowVxlanReserved0MetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0MetricTag - // provides marshal interface - Marshal() marshalPatternFlowVxlanReserved0MetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVxlanReserved0MetricTag - // validate validates PatternFlowVxlanReserved0MetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVxlanReserved0MetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowVxlanReserved0MetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowVxlanReserved0MetricTag - SetName(value string) PatternFlowVxlanReserved0MetricTag - // Offset returns uint32, set in PatternFlowVxlanReserved0MetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowVxlanReserved0MetricTag - SetOffset(value uint32) PatternFlowVxlanReserved0MetricTag - // HasOffset checks if Offset has been set in PatternFlowVxlanReserved0MetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowVxlanReserved0MetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowVxlanReserved0MetricTag - SetLength(value uint32) PatternFlowVxlanReserved0MetricTag - // HasLength checks if Length has been set in PatternFlowVxlanReserved0MetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowVxlanReserved0MetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowVxlanReserved0MetricTag object -func (obj *patternFlowVxlanReserved0MetricTag) SetName(value string) PatternFlowVxlanReserved0MetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVxlanReserved0MetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVxlanReserved0MetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowVxlanReserved0MetricTag object -func (obj *patternFlowVxlanReserved0MetricTag) SetOffset(value uint32) PatternFlowVxlanReserved0MetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVxlanReserved0MetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVxlanReserved0MetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowVxlanReserved0MetricTag object -func (obj *patternFlowVxlanReserved0MetricTag) SetLength(value uint32) PatternFlowVxlanReserved0MetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowVxlanReserved0MetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVxlanReserved0MetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 23 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanReserved0MetricTag.Offset <= 23 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 24 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowVxlanReserved0MetricTag.Length <= 24 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowVxlanReserved0MetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(24) - } - -} - -// ***** PatternFlowVxlanVniCounter ***** -type patternFlowVxlanVniCounter struct { - validation - obj *otg.PatternFlowVxlanVniCounter - marshaller marshalPatternFlowVxlanVniCounter - unMarshaller unMarshalPatternFlowVxlanVniCounter -} - -func NewPatternFlowVxlanVniCounter() PatternFlowVxlanVniCounter { - obj := patternFlowVxlanVniCounter{obj: &otg.PatternFlowVxlanVniCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVxlanVniCounter) msg() *otg.PatternFlowVxlanVniCounter { - return obj.obj -} - -func (obj *patternFlowVxlanVniCounter) setMsg(msg *otg.PatternFlowVxlanVniCounter) PatternFlowVxlanVniCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVxlanVniCounter struct { - obj *patternFlowVxlanVniCounter -} - -type marshalPatternFlowVxlanVniCounter interface { - // ToProto marshals PatternFlowVxlanVniCounter to protobuf object *otg.PatternFlowVxlanVniCounter - ToProto() (*otg.PatternFlowVxlanVniCounter, error) - // ToPbText marshals PatternFlowVxlanVniCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVxlanVniCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVxlanVniCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVxlanVniCounter struct { - obj *patternFlowVxlanVniCounter -} - -type unMarshalPatternFlowVxlanVniCounter interface { - // FromProto unmarshals PatternFlowVxlanVniCounter from protobuf object *otg.PatternFlowVxlanVniCounter - FromProto(msg *otg.PatternFlowVxlanVniCounter) (PatternFlowVxlanVniCounter, error) - // FromPbText unmarshals PatternFlowVxlanVniCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVxlanVniCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVxlanVniCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVxlanVniCounter) Marshal() marshalPatternFlowVxlanVniCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVxlanVniCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVxlanVniCounter) Unmarshal() unMarshalPatternFlowVxlanVniCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVxlanVniCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVxlanVniCounter) ToProto() (*otg.PatternFlowVxlanVniCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVxlanVniCounter) FromProto(msg *otg.PatternFlowVxlanVniCounter) (PatternFlowVxlanVniCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVxlanVniCounter) 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 *unMarshalpatternFlowVxlanVniCounter) 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 *marshalpatternFlowVxlanVniCounter) 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 *unMarshalpatternFlowVxlanVniCounter) 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 *marshalpatternFlowVxlanVniCounter) 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 *unMarshalpatternFlowVxlanVniCounter) 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 *patternFlowVxlanVniCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVxlanVniCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVxlanVniCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVxlanVniCounter) Clone() (PatternFlowVxlanVniCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVxlanVniCounter() - 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 -} - -// PatternFlowVxlanVniCounter is integer counter pattern -type PatternFlowVxlanVniCounter interface { - Validation - // msg marshals PatternFlowVxlanVniCounter to protobuf object *otg.PatternFlowVxlanVniCounter - // and doesn't set defaults - msg() *otg.PatternFlowVxlanVniCounter - // setMsg unmarshals PatternFlowVxlanVniCounter from protobuf object *otg.PatternFlowVxlanVniCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowVxlanVniCounter) PatternFlowVxlanVniCounter - // provides marshal interface - Marshal() marshalPatternFlowVxlanVniCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVxlanVniCounter - // validate validates PatternFlowVxlanVniCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVxlanVniCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowVxlanVniCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowVxlanVniCounter - SetStart(value uint32) PatternFlowVxlanVniCounter - // HasStart checks if Start has been set in PatternFlowVxlanVniCounter - HasStart() bool - // Step returns uint32, set in PatternFlowVxlanVniCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowVxlanVniCounter - SetStep(value uint32) PatternFlowVxlanVniCounter - // HasStep checks if Step has been set in PatternFlowVxlanVniCounter - HasStep() bool - // Count returns uint32, set in PatternFlowVxlanVniCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowVxlanVniCounter - SetCount(value uint32) PatternFlowVxlanVniCounter - // HasCount checks if Count has been set in PatternFlowVxlanVniCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVxlanVniCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVxlanVniCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowVxlanVniCounter object -func (obj *patternFlowVxlanVniCounter) SetStart(value uint32) PatternFlowVxlanVniCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVxlanVniCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVxlanVniCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowVxlanVniCounter object -func (obj *patternFlowVxlanVniCounter) SetStep(value uint32) PatternFlowVxlanVniCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVxlanVniCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVxlanVniCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowVxlanVniCounter object -func (obj *patternFlowVxlanVniCounter) SetCount(value uint32) PatternFlowVxlanVniCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowVxlanVniCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanVniCounter.Start <= 16777215 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanVniCounter.Step <= 16777215 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanVniCounter.Count <= 16777215 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowVxlanVniCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowVxlanVniMetricTag ***** -type patternFlowVxlanVniMetricTag struct { - validation - obj *otg.PatternFlowVxlanVniMetricTag - marshaller marshalPatternFlowVxlanVniMetricTag - unMarshaller unMarshalPatternFlowVxlanVniMetricTag -} - -func NewPatternFlowVxlanVniMetricTag() PatternFlowVxlanVniMetricTag { - obj := patternFlowVxlanVniMetricTag{obj: &otg.PatternFlowVxlanVniMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVxlanVniMetricTag) msg() *otg.PatternFlowVxlanVniMetricTag { - return obj.obj -} - -func (obj *patternFlowVxlanVniMetricTag) setMsg(msg *otg.PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVxlanVniMetricTag struct { - obj *patternFlowVxlanVniMetricTag -} - -type marshalPatternFlowVxlanVniMetricTag interface { - // ToProto marshals PatternFlowVxlanVniMetricTag to protobuf object *otg.PatternFlowVxlanVniMetricTag - ToProto() (*otg.PatternFlowVxlanVniMetricTag, error) - // ToPbText marshals PatternFlowVxlanVniMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVxlanVniMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVxlanVniMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVxlanVniMetricTag struct { - obj *patternFlowVxlanVniMetricTag -} - -type unMarshalPatternFlowVxlanVniMetricTag interface { - // FromProto unmarshals PatternFlowVxlanVniMetricTag from protobuf object *otg.PatternFlowVxlanVniMetricTag - FromProto(msg *otg.PatternFlowVxlanVniMetricTag) (PatternFlowVxlanVniMetricTag, error) - // FromPbText unmarshals PatternFlowVxlanVniMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVxlanVniMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVxlanVniMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVxlanVniMetricTag) Marshal() marshalPatternFlowVxlanVniMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVxlanVniMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVxlanVniMetricTag) Unmarshal() unMarshalPatternFlowVxlanVniMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVxlanVniMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVxlanVniMetricTag) ToProto() (*otg.PatternFlowVxlanVniMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVxlanVniMetricTag) FromProto(msg *otg.PatternFlowVxlanVniMetricTag) (PatternFlowVxlanVniMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVxlanVniMetricTag) 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 *unMarshalpatternFlowVxlanVniMetricTag) 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 *marshalpatternFlowVxlanVniMetricTag) 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 *unMarshalpatternFlowVxlanVniMetricTag) 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 *marshalpatternFlowVxlanVniMetricTag) 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 *unMarshalpatternFlowVxlanVniMetricTag) 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 *patternFlowVxlanVniMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVxlanVniMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVxlanVniMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVxlanVniMetricTag) Clone() (PatternFlowVxlanVniMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVxlanVniMetricTag() - 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 -} - -// PatternFlowVxlanVniMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowVxlanVniMetricTag interface { - Validation - // msg marshals PatternFlowVxlanVniMetricTag to protobuf object *otg.PatternFlowVxlanVniMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowVxlanVniMetricTag - // setMsg unmarshals PatternFlowVxlanVniMetricTag from protobuf object *otg.PatternFlowVxlanVniMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniMetricTag - // provides marshal interface - Marshal() marshalPatternFlowVxlanVniMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVxlanVniMetricTag - // validate validates PatternFlowVxlanVniMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVxlanVniMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowVxlanVniMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowVxlanVniMetricTag - SetName(value string) PatternFlowVxlanVniMetricTag - // Offset returns uint32, set in PatternFlowVxlanVniMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowVxlanVniMetricTag - SetOffset(value uint32) PatternFlowVxlanVniMetricTag - // HasOffset checks if Offset has been set in PatternFlowVxlanVniMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowVxlanVniMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowVxlanVniMetricTag - SetLength(value uint32) PatternFlowVxlanVniMetricTag - // HasLength checks if Length has been set in PatternFlowVxlanVniMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowVxlanVniMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowVxlanVniMetricTag object -func (obj *patternFlowVxlanVniMetricTag) SetName(value string) PatternFlowVxlanVniMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVxlanVniMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVxlanVniMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowVxlanVniMetricTag object -func (obj *patternFlowVxlanVniMetricTag) SetOffset(value uint32) PatternFlowVxlanVniMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVxlanVniMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVxlanVniMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowVxlanVniMetricTag object -func (obj *patternFlowVxlanVniMetricTag) SetLength(value uint32) PatternFlowVxlanVniMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowVxlanVniMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVxlanVniMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 23 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanVniMetricTag.Offset <= 23 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 24 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowVxlanVniMetricTag.Length <= 24 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowVxlanVniMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(24) - } - -} - -// ***** PatternFlowVxlanReserved1Counter ***** -type patternFlowVxlanReserved1Counter struct { - validation - obj *otg.PatternFlowVxlanReserved1Counter - marshaller marshalPatternFlowVxlanReserved1Counter - unMarshaller unMarshalPatternFlowVxlanReserved1Counter -} - -func NewPatternFlowVxlanReserved1Counter() PatternFlowVxlanReserved1Counter { - obj := patternFlowVxlanReserved1Counter{obj: &otg.PatternFlowVxlanReserved1Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVxlanReserved1Counter) msg() *otg.PatternFlowVxlanReserved1Counter { - return obj.obj -} - -func (obj *patternFlowVxlanReserved1Counter) setMsg(msg *otg.PatternFlowVxlanReserved1Counter) PatternFlowVxlanReserved1Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVxlanReserved1Counter struct { - obj *patternFlowVxlanReserved1Counter -} - -type marshalPatternFlowVxlanReserved1Counter interface { - // ToProto marshals PatternFlowVxlanReserved1Counter to protobuf object *otg.PatternFlowVxlanReserved1Counter - ToProto() (*otg.PatternFlowVxlanReserved1Counter, error) - // ToPbText marshals PatternFlowVxlanReserved1Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVxlanReserved1Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVxlanReserved1Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVxlanReserved1Counter struct { - obj *patternFlowVxlanReserved1Counter -} - -type unMarshalPatternFlowVxlanReserved1Counter interface { - // FromProto unmarshals PatternFlowVxlanReserved1Counter from protobuf object *otg.PatternFlowVxlanReserved1Counter - FromProto(msg *otg.PatternFlowVxlanReserved1Counter) (PatternFlowVxlanReserved1Counter, error) - // FromPbText unmarshals PatternFlowVxlanReserved1Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVxlanReserved1Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVxlanReserved1Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVxlanReserved1Counter) Marshal() marshalPatternFlowVxlanReserved1Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVxlanReserved1Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVxlanReserved1Counter) Unmarshal() unMarshalPatternFlowVxlanReserved1Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVxlanReserved1Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVxlanReserved1Counter) ToProto() (*otg.PatternFlowVxlanReserved1Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVxlanReserved1Counter) FromProto(msg *otg.PatternFlowVxlanReserved1Counter) (PatternFlowVxlanReserved1Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVxlanReserved1Counter) 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 *unMarshalpatternFlowVxlanReserved1Counter) 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 *marshalpatternFlowVxlanReserved1Counter) 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 *unMarshalpatternFlowVxlanReserved1Counter) 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 *marshalpatternFlowVxlanReserved1Counter) 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 *unMarshalpatternFlowVxlanReserved1Counter) 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 *patternFlowVxlanReserved1Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVxlanReserved1Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVxlanReserved1Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVxlanReserved1Counter) Clone() (PatternFlowVxlanReserved1Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVxlanReserved1Counter() - 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 -} - -// PatternFlowVxlanReserved1Counter is integer counter pattern -type PatternFlowVxlanReserved1Counter interface { - Validation - // msg marshals PatternFlowVxlanReserved1Counter to protobuf object *otg.PatternFlowVxlanReserved1Counter - // and doesn't set defaults - msg() *otg.PatternFlowVxlanReserved1Counter - // setMsg unmarshals PatternFlowVxlanReserved1Counter from protobuf object *otg.PatternFlowVxlanReserved1Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowVxlanReserved1Counter) PatternFlowVxlanReserved1Counter - // provides marshal interface - Marshal() marshalPatternFlowVxlanReserved1Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVxlanReserved1Counter - // validate validates PatternFlowVxlanReserved1Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVxlanReserved1Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowVxlanReserved1Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowVxlanReserved1Counter - SetStart(value uint32) PatternFlowVxlanReserved1Counter - // HasStart checks if Start has been set in PatternFlowVxlanReserved1Counter - HasStart() bool - // Step returns uint32, set in PatternFlowVxlanReserved1Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowVxlanReserved1Counter - SetStep(value uint32) PatternFlowVxlanReserved1Counter - // HasStep checks if Step has been set in PatternFlowVxlanReserved1Counter - HasStep() bool - // Count returns uint32, set in PatternFlowVxlanReserved1Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowVxlanReserved1Counter - SetCount(value uint32) PatternFlowVxlanReserved1Counter - // HasCount checks if Count has been set in PatternFlowVxlanReserved1Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVxlanReserved1Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowVxlanReserved1Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowVxlanReserved1Counter object -func (obj *patternFlowVxlanReserved1Counter) SetStart(value uint32) PatternFlowVxlanReserved1Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVxlanReserved1Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowVxlanReserved1Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowVxlanReserved1Counter object -func (obj *patternFlowVxlanReserved1Counter) SetStep(value uint32) PatternFlowVxlanReserved1Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVxlanReserved1Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowVxlanReserved1Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowVxlanReserved1Counter object -func (obj *patternFlowVxlanReserved1Counter) SetCount(value uint32) PatternFlowVxlanReserved1Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowVxlanReserved1Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanReserved1Counter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanReserved1Counter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanReserved1Counter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowVxlanReserved1Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowVxlanReserved1MetricTag ***** -type patternFlowVxlanReserved1MetricTag struct { - validation - obj *otg.PatternFlowVxlanReserved1MetricTag - marshaller marshalPatternFlowVxlanReserved1MetricTag - unMarshaller unMarshalPatternFlowVxlanReserved1MetricTag -} - -func NewPatternFlowVxlanReserved1MetricTag() PatternFlowVxlanReserved1MetricTag { - obj := patternFlowVxlanReserved1MetricTag{obj: &otg.PatternFlowVxlanReserved1MetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowVxlanReserved1MetricTag) msg() *otg.PatternFlowVxlanReserved1MetricTag { - return obj.obj -} - -func (obj *patternFlowVxlanReserved1MetricTag) setMsg(msg *otg.PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1MetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowVxlanReserved1MetricTag struct { - obj *patternFlowVxlanReserved1MetricTag -} - -type marshalPatternFlowVxlanReserved1MetricTag interface { - // ToProto marshals PatternFlowVxlanReserved1MetricTag to protobuf object *otg.PatternFlowVxlanReserved1MetricTag - ToProto() (*otg.PatternFlowVxlanReserved1MetricTag, error) - // ToPbText marshals PatternFlowVxlanReserved1MetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowVxlanReserved1MetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowVxlanReserved1MetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowVxlanReserved1MetricTag struct { - obj *patternFlowVxlanReserved1MetricTag -} - -type unMarshalPatternFlowVxlanReserved1MetricTag interface { - // FromProto unmarshals PatternFlowVxlanReserved1MetricTag from protobuf object *otg.PatternFlowVxlanReserved1MetricTag - FromProto(msg *otg.PatternFlowVxlanReserved1MetricTag) (PatternFlowVxlanReserved1MetricTag, error) - // FromPbText unmarshals PatternFlowVxlanReserved1MetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowVxlanReserved1MetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowVxlanReserved1MetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowVxlanReserved1MetricTag) Marshal() marshalPatternFlowVxlanReserved1MetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowVxlanReserved1MetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowVxlanReserved1MetricTag) Unmarshal() unMarshalPatternFlowVxlanReserved1MetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowVxlanReserved1MetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowVxlanReserved1MetricTag) ToProto() (*otg.PatternFlowVxlanReserved1MetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowVxlanReserved1MetricTag) FromProto(msg *otg.PatternFlowVxlanReserved1MetricTag) (PatternFlowVxlanReserved1MetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowVxlanReserved1MetricTag) 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 *unMarshalpatternFlowVxlanReserved1MetricTag) 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 *marshalpatternFlowVxlanReserved1MetricTag) 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 *unMarshalpatternFlowVxlanReserved1MetricTag) 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 *marshalpatternFlowVxlanReserved1MetricTag) 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 *unMarshalpatternFlowVxlanReserved1MetricTag) 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 *patternFlowVxlanReserved1MetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowVxlanReserved1MetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowVxlanReserved1MetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowVxlanReserved1MetricTag) Clone() (PatternFlowVxlanReserved1MetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowVxlanReserved1MetricTag() - 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 -} - -// PatternFlowVxlanReserved1MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowVxlanReserved1MetricTag interface { - Validation - // msg marshals PatternFlowVxlanReserved1MetricTag to protobuf object *otg.PatternFlowVxlanReserved1MetricTag - // and doesn't set defaults - msg() *otg.PatternFlowVxlanReserved1MetricTag - // setMsg unmarshals PatternFlowVxlanReserved1MetricTag from protobuf object *otg.PatternFlowVxlanReserved1MetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1MetricTag - // provides marshal interface - Marshal() marshalPatternFlowVxlanReserved1MetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowVxlanReserved1MetricTag - // validate validates PatternFlowVxlanReserved1MetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowVxlanReserved1MetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowVxlanReserved1MetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowVxlanReserved1MetricTag - SetName(value string) PatternFlowVxlanReserved1MetricTag - // Offset returns uint32, set in PatternFlowVxlanReserved1MetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowVxlanReserved1MetricTag - SetOffset(value uint32) PatternFlowVxlanReserved1MetricTag - // HasOffset checks if Offset has been set in PatternFlowVxlanReserved1MetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowVxlanReserved1MetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowVxlanReserved1MetricTag - SetLength(value uint32) PatternFlowVxlanReserved1MetricTag - // HasLength checks if Length has been set in PatternFlowVxlanReserved1MetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowVxlanReserved1MetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowVxlanReserved1MetricTag object -func (obj *patternFlowVxlanReserved1MetricTag) SetName(value string) PatternFlowVxlanReserved1MetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVxlanReserved1MetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowVxlanReserved1MetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowVxlanReserved1MetricTag object -func (obj *patternFlowVxlanReserved1MetricTag) SetOffset(value uint32) PatternFlowVxlanReserved1MetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVxlanReserved1MetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowVxlanReserved1MetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowVxlanReserved1MetricTag object -func (obj *patternFlowVxlanReserved1MetricTag) SetLength(value uint32) PatternFlowVxlanReserved1MetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowVxlanReserved1MetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVxlanReserved1MetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowVxlanReserved1MetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowVxlanReserved1MetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowVxlanReserved1MetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowIpv4VersionCounter ***** -type patternFlowIpv4VersionCounter struct { - validation - obj *otg.PatternFlowIpv4VersionCounter - marshaller marshalPatternFlowIpv4VersionCounter - unMarshaller unMarshalPatternFlowIpv4VersionCounter -} - -func NewPatternFlowIpv4VersionCounter() PatternFlowIpv4VersionCounter { - obj := patternFlowIpv4VersionCounter{obj: &otg.PatternFlowIpv4VersionCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4VersionCounter) msg() *otg.PatternFlowIpv4VersionCounter { - return obj.obj -} - -func (obj *patternFlowIpv4VersionCounter) setMsg(msg *otg.PatternFlowIpv4VersionCounter) PatternFlowIpv4VersionCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4VersionCounter struct { - obj *patternFlowIpv4VersionCounter -} - -type marshalPatternFlowIpv4VersionCounter interface { - // ToProto marshals PatternFlowIpv4VersionCounter to protobuf object *otg.PatternFlowIpv4VersionCounter - ToProto() (*otg.PatternFlowIpv4VersionCounter, error) - // ToPbText marshals PatternFlowIpv4VersionCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4VersionCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4VersionCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4VersionCounter struct { - obj *patternFlowIpv4VersionCounter -} - -type unMarshalPatternFlowIpv4VersionCounter interface { - // FromProto unmarshals PatternFlowIpv4VersionCounter from protobuf object *otg.PatternFlowIpv4VersionCounter - FromProto(msg *otg.PatternFlowIpv4VersionCounter) (PatternFlowIpv4VersionCounter, error) - // FromPbText unmarshals PatternFlowIpv4VersionCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4VersionCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4VersionCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4VersionCounter) Marshal() marshalPatternFlowIpv4VersionCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4VersionCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4VersionCounter) Unmarshal() unMarshalPatternFlowIpv4VersionCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4VersionCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4VersionCounter) ToProto() (*otg.PatternFlowIpv4VersionCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4VersionCounter) FromProto(msg *otg.PatternFlowIpv4VersionCounter) (PatternFlowIpv4VersionCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4VersionCounter) 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 *unMarshalpatternFlowIpv4VersionCounter) 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 *marshalpatternFlowIpv4VersionCounter) 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 *unMarshalpatternFlowIpv4VersionCounter) 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 *marshalpatternFlowIpv4VersionCounter) 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 *unMarshalpatternFlowIpv4VersionCounter) 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 *patternFlowIpv4VersionCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4VersionCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4VersionCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4VersionCounter) Clone() (PatternFlowIpv4VersionCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4VersionCounter() - 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 -} - -// PatternFlowIpv4VersionCounter is integer counter pattern -type PatternFlowIpv4VersionCounter interface { - Validation - // msg marshals PatternFlowIpv4VersionCounter to protobuf object *otg.PatternFlowIpv4VersionCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4VersionCounter - // setMsg unmarshals PatternFlowIpv4VersionCounter from protobuf object *otg.PatternFlowIpv4VersionCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4VersionCounter) PatternFlowIpv4VersionCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4VersionCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4VersionCounter - // validate validates PatternFlowIpv4VersionCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4VersionCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4VersionCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4VersionCounter - SetStart(value uint32) PatternFlowIpv4VersionCounter - // HasStart checks if Start has been set in PatternFlowIpv4VersionCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4VersionCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4VersionCounter - SetStep(value uint32) PatternFlowIpv4VersionCounter - // HasStep checks if Step has been set in PatternFlowIpv4VersionCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4VersionCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4VersionCounter - SetCount(value uint32) PatternFlowIpv4VersionCounter - // HasCount checks if Count has been set in PatternFlowIpv4VersionCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4VersionCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4VersionCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4VersionCounter object -func (obj *patternFlowIpv4VersionCounter) SetStart(value uint32) PatternFlowIpv4VersionCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4VersionCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4VersionCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4VersionCounter object -func (obj *patternFlowIpv4VersionCounter) SetStep(value uint32) PatternFlowIpv4VersionCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4VersionCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4VersionCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4VersionCounter object -func (obj *patternFlowIpv4VersionCounter) SetCount(value uint32) PatternFlowIpv4VersionCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4VersionCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4VersionCounter.Start <= 15 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4VersionCounter.Step <= 15 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4VersionCounter.Count <= 15 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4VersionCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(4) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4VersionMetricTag ***** -type patternFlowIpv4VersionMetricTag struct { - validation - obj *otg.PatternFlowIpv4VersionMetricTag - marshaller marshalPatternFlowIpv4VersionMetricTag - unMarshaller unMarshalPatternFlowIpv4VersionMetricTag -} - -func NewPatternFlowIpv4VersionMetricTag() PatternFlowIpv4VersionMetricTag { - obj := patternFlowIpv4VersionMetricTag{obj: &otg.PatternFlowIpv4VersionMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4VersionMetricTag) msg() *otg.PatternFlowIpv4VersionMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4VersionMetricTag) setMsg(msg *otg.PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4VersionMetricTag struct { - obj *patternFlowIpv4VersionMetricTag -} - -type marshalPatternFlowIpv4VersionMetricTag interface { - // ToProto marshals PatternFlowIpv4VersionMetricTag to protobuf object *otg.PatternFlowIpv4VersionMetricTag - ToProto() (*otg.PatternFlowIpv4VersionMetricTag, error) - // ToPbText marshals PatternFlowIpv4VersionMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4VersionMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4VersionMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4VersionMetricTag struct { - obj *patternFlowIpv4VersionMetricTag -} - -type unMarshalPatternFlowIpv4VersionMetricTag interface { - // FromProto unmarshals PatternFlowIpv4VersionMetricTag from protobuf object *otg.PatternFlowIpv4VersionMetricTag - FromProto(msg *otg.PatternFlowIpv4VersionMetricTag) (PatternFlowIpv4VersionMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4VersionMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4VersionMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4VersionMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4VersionMetricTag) Marshal() marshalPatternFlowIpv4VersionMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4VersionMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4VersionMetricTag) Unmarshal() unMarshalPatternFlowIpv4VersionMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4VersionMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4VersionMetricTag) ToProto() (*otg.PatternFlowIpv4VersionMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4VersionMetricTag) FromProto(msg *otg.PatternFlowIpv4VersionMetricTag) (PatternFlowIpv4VersionMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4VersionMetricTag) 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 *unMarshalpatternFlowIpv4VersionMetricTag) 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 *marshalpatternFlowIpv4VersionMetricTag) 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 *unMarshalpatternFlowIpv4VersionMetricTag) 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 *marshalpatternFlowIpv4VersionMetricTag) 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 *unMarshalpatternFlowIpv4VersionMetricTag) 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 *patternFlowIpv4VersionMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4VersionMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4VersionMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4VersionMetricTag) Clone() (PatternFlowIpv4VersionMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4VersionMetricTag() - 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 -} - -// PatternFlowIpv4VersionMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4VersionMetricTag interface { - Validation - // msg marshals PatternFlowIpv4VersionMetricTag to protobuf object *otg.PatternFlowIpv4VersionMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4VersionMetricTag - // setMsg unmarshals PatternFlowIpv4VersionMetricTag from protobuf object *otg.PatternFlowIpv4VersionMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4VersionMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4VersionMetricTag - // validate validates PatternFlowIpv4VersionMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4VersionMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4VersionMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4VersionMetricTag - SetName(value string) PatternFlowIpv4VersionMetricTag - // Offset returns uint32, set in PatternFlowIpv4VersionMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4VersionMetricTag - SetOffset(value uint32) PatternFlowIpv4VersionMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4VersionMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4VersionMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4VersionMetricTag - SetLength(value uint32) PatternFlowIpv4VersionMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4VersionMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4VersionMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4VersionMetricTag object -func (obj *patternFlowIpv4VersionMetricTag) SetName(value string) PatternFlowIpv4VersionMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4VersionMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4VersionMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4VersionMetricTag object -func (obj *patternFlowIpv4VersionMetricTag) SetOffset(value uint32) PatternFlowIpv4VersionMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4VersionMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4VersionMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4VersionMetricTag object -func (obj *patternFlowIpv4VersionMetricTag) SetLength(value uint32) PatternFlowIpv4VersionMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4VersionMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4VersionMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4VersionMetricTag.Offset <= 3 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 4 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4VersionMetricTag.Length <= 4 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4VersionMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(4) - } - -} - -// ***** PatternFlowIpv4HeaderLengthCounter ***** -type patternFlowIpv4HeaderLengthCounter struct { - validation - obj *otg.PatternFlowIpv4HeaderLengthCounter - marshaller marshalPatternFlowIpv4HeaderLengthCounter - unMarshaller unMarshalPatternFlowIpv4HeaderLengthCounter -} - -func NewPatternFlowIpv4HeaderLengthCounter() PatternFlowIpv4HeaderLengthCounter { - obj := patternFlowIpv4HeaderLengthCounter{obj: &otg.PatternFlowIpv4HeaderLengthCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4HeaderLengthCounter) msg() *otg.PatternFlowIpv4HeaderLengthCounter { - return obj.obj -} - -func (obj *patternFlowIpv4HeaderLengthCounter) setMsg(msg *otg.PatternFlowIpv4HeaderLengthCounter) PatternFlowIpv4HeaderLengthCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4HeaderLengthCounter struct { - obj *patternFlowIpv4HeaderLengthCounter -} - -type marshalPatternFlowIpv4HeaderLengthCounter interface { - // ToProto marshals PatternFlowIpv4HeaderLengthCounter to protobuf object *otg.PatternFlowIpv4HeaderLengthCounter - ToProto() (*otg.PatternFlowIpv4HeaderLengthCounter, error) - // ToPbText marshals PatternFlowIpv4HeaderLengthCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4HeaderLengthCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4HeaderLengthCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4HeaderLengthCounter struct { - obj *patternFlowIpv4HeaderLengthCounter -} - -type unMarshalPatternFlowIpv4HeaderLengthCounter interface { - // FromProto unmarshals PatternFlowIpv4HeaderLengthCounter from protobuf object *otg.PatternFlowIpv4HeaderLengthCounter - FromProto(msg *otg.PatternFlowIpv4HeaderLengthCounter) (PatternFlowIpv4HeaderLengthCounter, error) - // FromPbText unmarshals PatternFlowIpv4HeaderLengthCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4HeaderLengthCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4HeaderLengthCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4HeaderLengthCounter) Marshal() marshalPatternFlowIpv4HeaderLengthCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4HeaderLengthCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4HeaderLengthCounter) Unmarshal() unMarshalPatternFlowIpv4HeaderLengthCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4HeaderLengthCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4HeaderLengthCounter) ToProto() (*otg.PatternFlowIpv4HeaderLengthCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4HeaderLengthCounter) FromProto(msg *otg.PatternFlowIpv4HeaderLengthCounter) (PatternFlowIpv4HeaderLengthCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4HeaderLengthCounter) 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 *unMarshalpatternFlowIpv4HeaderLengthCounter) 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 *marshalpatternFlowIpv4HeaderLengthCounter) 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 *unMarshalpatternFlowIpv4HeaderLengthCounter) 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 *marshalpatternFlowIpv4HeaderLengthCounter) 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 *unMarshalpatternFlowIpv4HeaderLengthCounter) 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 *patternFlowIpv4HeaderLengthCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4HeaderLengthCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4HeaderLengthCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4HeaderLengthCounter) Clone() (PatternFlowIpv4HeaderLengthCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4HeaderLengthCounter() - 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 -} - -// PatternFlowIpv4HeaderLengthCounter is integer counter pattern -type PatternFlowIpv4HeaderLengthCounter interface { - Validation - // msg marshals PatternFlowIpv4HeaderLengthCounter to protobuf object *otg.PatternFlowIpv4HeaderLengthCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4HeaderLengthCounter - // setMsg unmarshals PatternFlowIpv4HeaderLengthCounter from protobuf object *otg.PatternFlowIpv4HeaderLengthCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4HeaderLengthCounter) PatternFlowIpv4HeaderLengthCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4HeaderLengthCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4HeaderLengthCounter - // validate validates PatternFlowIpv4HeaderLengthCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4HeaderLengthCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4HeaderLengthCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4HeaderLengthCounter - SetStart(value uint32) PatternFlowIpv4HeaderLengthCounter - // HasStart checks if Start has been set in PatternFlowIpv4HeaderLengthCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4HeaderLengthCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4HeaderLengthCounter - SetStep(value uint32) PatternFlowIpv4HeaderLengthCounter - // HasStep checks if Step has been set in PatternFlowIpv4HeaderLengthCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4HeaderLengthCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4HeaderLengthCounter - SetCount(value uint32) PatternFlowIpv4HeaderLengthCounter - // HasCount checks if Count has been set in PatternFlowIpv4HeaderLengthCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4HeaderLengthCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4HeaderLengthCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4HeaderLengthCounter object -func (obj *patternFlowIpv4HeaderLengthCounter) SetStart(value uint32) PatternFlowIpv4HeaderLengthCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4HeaderLengthCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4HeaderLengthCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4HeaderLengthCounter object -func (obj *patternFlowIpv4HeaderLengthCounter) SetStep(value uint32) PatternFlowIpv4HeaderLengthCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4HeaderLengthCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4HeaderLengthCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4HeaderLengthCounter object -func (obj *patternFlowIpv4HeaderLengthCounter) SetCount(value uint32) PatternFlowIpv4HeaderLengthCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4HeaderLengthCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4HeaderLengthCounter.Start <= 15 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4HeaderLengthCounter.Step <= 15 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4HeaderLengthCounter.Count <= 15 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4HeaderLengthCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(5) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4HeaderLengthMetricTag ***** -type patternFlowIpv4HeaderLengthMetricTag struct { - validation - obj *otg.PatternFlowIpv4HeaderLengthMetricTag - marshaller marshalPatternFlowIpv4HeaderLengthMetricTag - unMarshaller unMarshalPatternFlowIpv4HeaderLengthMetricTag -} - -func NewPatternFlowIpv4HeaderLengthMetricTag() PatternFlowIpv4HeaderLengthMetricTag { - obj := patternFlowIpv4HeaderLengthMetricTag{obj: &otg.PatternFlowIpv4HeaderLengthMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4HeaderLengthMetricTag) msg() *otg.PatternFlowIpv4HeaderLengthMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4HeaderLengthMetricTag) setMsg(msg *otg.PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4HeaderLengthMetricTag struct { - obj *patternFlowIpv4HeaderLengthMetricTag -} - -type marshalPatternFlowIpv4HeaderLengthMetricTag interface { - // ToProto marshals PatternFlowIpv4HeaderLengthMetricTag to protobuf object *otg.PatternFlowIpv4HeaderLengthMetricTag - ToProto() (*otg.PatternFlowIpv4HeaderLengthMetricTag, error) - // ToPbText marshals PatternFlowIpv4HeaderLengthMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4HeaderLengthMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4HeaderLengthMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4HeaderLengthMetricTag struct { - obj *patternFlowIpv4HeaderLengthMetricTag -} - -type unMarshalPatternFlowIpv4HeaderLengthMetricTag interface { - // FromProto unmarshals PatternFlowIpv4HeaderLengthMetricTag from protobuf object *otg.PatternFlowIpv4HeaderLengthMetricTag - FromProto(msg *otg.PatternFlowIpv4HeaderLengthMetricTag) (PatternFlowIpv4HeaderLengthMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4HeaderLengthMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4HeaderLengthMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4HeaderLengthMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4HeaderLengthMetricTag) Marshal() marshalPatternFlowIpv4HeaderLengthMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4HeaderLengthMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4HeaderLengthMetricTag) Unmarshal() unMarshalPatternFlowIpv4HeaderLengthMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4HeaderLengthMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4HeaderLengthMetricTag) ToProto() (*otg.PatternFlowIpv4HeaderLengthMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4HeaderLengthMetricTag) FromProto(msg *otg.PatternFlowIpv4HeaderLengthMetricTag) (PatternFlowIpv4HeaderLengthMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4HeaderLengthMetricTag) 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 *unMarshalpatternFlowIpv4HeaderLengthMetricTag) 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 *marshalpatternFlowIpv4HeaderLengthMetricTag) 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 *unMarshalpatternFlowIpv4HeaderLengthMetricTag) 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 *marshalpatternFlowIpv4HeaderLengthMetricTag) 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 *unMarshalpatternFlowIpv4HeaderLengthMetricTag) 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 *patternFlowIpv4HeaderLengthMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4HeaderLengthMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4HeaderLengthMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4HeaderLengthMetricTag) Clone() (PatternFlowIpv4HeaderLengthMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4HeaderLengthMetricTag() - 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 -} - -// PatternFlowIpv4HeaderLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4HeaderLengthMetricTag interface { - Validation - // msg marshals PatternFlowIpv4HeaderLengthMetricTag to protobuf object *otg.PatternFlowIpv4HeaderLengthMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4HeaderLengthMetricTag - // setMsg unmarshals PatternFlowIpv4HeaderLengthMetricTag from protobuf object *otg.PatternFlowIpv4HeaderLengthMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4HeaderLengthMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4HeaderLengthMetricTag - // validate validates PatternFlowIpv4HeaderLengthMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4HeaderLengthMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4HeaderLengthMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4HeaderLengthMetricTag - SetName(value string) PatternFlowIpv4HeaderLengthMetricTag - // Offset returns uint32, set in PatternFlowIpv4HeaderLengthMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4HeaderLengthMetricTag - SetOffset(value uint32) PatternFlowIpv4HeaderLengthMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4HeaderLengthMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4HeaderLengthMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4HeaderLengthMetricTag - SetLength(value uint32) PatternFlowIpv4HeaderLengthMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4HeaderLengthMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4HeaderLengthMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4HeaderLengthMetricTag object -func (obj *patternFlowIpv4HeaderLengthMetricTag) SetName(value string) PatternFlowIpv4HeaderLengthMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4HeaderLengthMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4HeaderLengthMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4HeaderLengthMetricTag object -func (obj *patternFlowIpv4HeaderLengthMetricTag) SetOffset(value uint32) PatternFlowIpv4HeaderLengthMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4HeaderLengthMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4HeaderLengthMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4HeaderLengthMetricTag object -func (obj *patternFlowIpv4HeaderLengthMetricTag) SetLength(value uint32) PatternFlowIpv4HeaderLengthMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4HeaderLengthMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4HeaderLengthMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4HeaderLengthMetricTag.Offset <= 3 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 4 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4HeaderLengthMetricTag.Length <= 4 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4HeaderLengthMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(4) - } - -} - -// ***** PatternFlowIpv4PriorityRaw ***** -type patternFlowIpv4PriorityRaw struct { - validation - obj *otg.PatternFlowIpv4PriorityRaw - marshaller marshalPatternFlowIpv4PriorityRaw - unMarshaller unMarshalPatternFlowIpv4PriorityRaw - incrementHolder PatternFlowIpv4PriorityRawCounter - decrementHolder PatternFlowIpv4PriorityRawCounter - metricTagsHolder PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter -} - -func NewPatternFlowIpv4PriorityRaw() PatternFlowIpv4PriorityRaw { - obj := patternFlowIpv4PriorityRaw{obj: &otg.PatternFlowIpv4PriorityRaw{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4PriorityRaw) msg() *otg.PatternFlowIpv4PriorityRaw { - return obj.obj -} - -func (obj *patternFlowIpv4PriorityRaw) setMsg(msg *otg.PatternFlowIpv4PriorityRaw) PatternFlowIpv4PriorityRaw { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4PriorityRaw struct { - obj *patternFlowIpv4PriorityRaw -} - -type marshalPatternFlowIpv4PriorityRaw interface { - // ToProto marshals PatternFlowIpv4PriorityRaw to protobuf object *otg.PatternFlowIpv4PriorityRaw - ToProto() (*otg.PatternFlowIpv4PriorityRaw, error) - // ToPbText marshals PatternFlowIpv4PriorityRaw to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4PriorityRaw to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4PriorityRaw to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4PriorityRaw struct { - obj *patternFlowIpv4PriorityRaw -} - -type unMarshalPatternFlowIpv4PriorityRaw interface { - // FromProto unmarshals PatternFlowIpv4PriorityRaw from protobuf object *otg.PatternFlowIpv4PriorityRaw - FromProto(msg *otg.PatternFlowIpv4PriorityRaw) (PatternFlowIpv4PriorityRaw, error) - // FromPbText unmarshals PatternFlowIpv4PriorityRaw from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4PriorityRaw from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4PriorityRaw from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4PriorityRaw) Marshal() marshalPatternFlowIpv4PriorityRaw { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4PriorityRaw{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4PriorityRaw) Unmarshal() unMarshalPatternFlowIpv4PriorityRaw { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4PriorityRaw{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4PriorityRaw) ToProto() (*otg.PatternFlowIpv4PriorityRaw, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4PriorityRaw) FromProto(msg *otg.PatternFlowIpv4PriorityRaw) (PatternFlowIpv4PriorityRaw, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4PriorityRaw) 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 *unMarshalpatternFlowIpv4PriorityRaw) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4PriorityRaw) 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 *unMarshalpatternFlowIpv4PriorityRaw) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4PriorityRaw) 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 *unMarshalpatternFlowIpv4PriorityRaw) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4PriorityRaw) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4PriorityRaw) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4PriorityRaw) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4PriorityRaw) Clone() (PatternFlowIpv4PriorityRaw, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4PriorityRaw() - 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 -} - -func (obj *patternFlowIpv4PriorityRaw) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4PriorityRaw is raw priority -type PatternFlowIpv4PriorityRaw interface { - Validation - // msg marshals PatternFlowIpv4PriorityRaw to protobuf object *otg.PatternFlowIpv4PriorityRaw - // and doesn't set defaults - msg() *otg.PatternFlowIpv4PriorityRaw - // setMsg unmarshals PatternFlowIpv4PriorityRaw from protobuf object *otg.PatternFlowIpv4PriorityRaw - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4PriorityRaw) PatternFlowIpv4PriorityRaw - // provides marshal interface - Marshal() marshalPatternFlowIpv4PriorityRaw - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4PriorityRaw - // validate validates PatternFlowIpv4PriorityRaw - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4PriorityRaw, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4PriorityRawChoiceEnum, set in PatternFlowIpv4PriorityRaw - Choice() PatternFlowIpv4PriorityRawChoiceEnum - // setChoice assigns PatternFlowIpv4PriorityRawChoiceEnum provided by user to PatternFlowIpv4PriorityRaw - setChoice(value PatternFlowIpv4PriorityRawChoiceEnum) PatternFlowIpv4PriorityRaw - // HasChoice checks if Choice has been set in PatternFlowIpv4PriorityRaw - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4PriorityRaw. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4PriorityRaw - SetValue(value uint32) PatternFlowIpv4PriorityRaw - // HasValue checks if Value has been set in PatternFlowIpv4PriorityRaw - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4PriorityRaw. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4PriorityRaw - SetValues(value []uint32) PatternFlowIpv4PriorityRaw - // Increment returns PatternFlowIpv4PriorityRawCounter, set in PatternFlowIpv4PriorityRaw. - // PatternFlowIpv4PriorityRawCounter is integer counter pattern - Increment() PatternFlowIpv4PriorityRawCounter - // SetIncrement assigns PatternFlowIpv4PriorityRawCounter provided by user to PatternFlowIpv4PriorityRaw. - // PatternFlowIpv4PriorityRawCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4PriorityRawCounter) PatternFlowIpv4PriorityRaw - // HasIncrement checks if Increment has been set in PatternFlowIpv4PriorityRaw - HasIncrement() bool - // Decrement returns PatternFlowIpv4PriorityRawCounter, set in PatternFlowIpv4PriorityRaw. - // PatternFlowIpv4PriorityRawCounter is integer counter pattern - Decrement() PatternFlowIpv4PriorityRawCounter - // SetDecrement assigns PatternFlowIpv4PriorityRawCounter provided by user to PatternFlowIpv4PriorityRaw. - // PatternFlowIpv4PriorityRawCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4PriorityRawCounter) PatternFlowIpv4PriorityRaw - // HasDecrement checks if Decrement has been set in PatternFlowIpv4PriorityRaw - HasDecrement() bool - // MetricTags returns PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIterIter, set in PatternFlowIpv4PriorityRaw - MetricTags() PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter - setNil() -} - -type PatternFlowIpv4PriorityRawChoiceEnum string - -// Enum of Choice on PatternFlowIpv4PriorityRaw -var PatternFlowIpv4PriorityRawChoice = struct { - VALUE PatternFlowIpv4PriorityRawChoiceEnum - VALUES PatternFlowIpv4PriorityRawChoiceEnum - INCREMENT PatternFlowIpv4PriorityRawChoiceEnum - DECREMENT PatternFlowIpv4PriorityRawChoiceEnum -}{ - VALUE: PatternFlowIpv4PriorityRawChoiceEnum("value"), - VALUES: PatternFlowIpv4PriorityRawChoiceEnum("values"), - INCREMENT: PatternFlowIpv4PriorityRawChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4PriorityRawChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4PriorityRaw) Choice() PatternFlowIpv4PriorityRawChoiceEnum { - return PatternFlowIpv4PriorityRawChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4PriorityRaw) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4PriorityRaw) setChoice(value PatternFlowIpv4PriorityRawChoiceEnum) PatternFlowIpv4PriorityRaw { - intValue, ok := otg.PatternFlowIpv4PriorityRaw_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4PriorityRawChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4PriorityRaw_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4PriorityRawChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4PriorityRawChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4PriorityRawChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4PriorityRawCounter().msg() - } - - if value == PatternFlowIpv4PriorityRawChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4PriorityRawCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4PriorityRaw) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4PriorityRawChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4PriorityRaw) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4PriorityRaw object -func (obj *patternFlowIpv4PriorityRaw) SetValue(value uint32) PatternFlowIpv4PriorityRaw { - obj.setChoice(PatternFlowIpv4PriorityRawChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4PriorityRaw) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4PriorityRaw object -func (obj *patternFlowIpv4PriorityRaw) SetValues(value []uint32) PatternFlowIpv4PriorityRaw { - obj.setChoice(PatternFlowIpv4PriorityRawChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4PriorityRawCounter -func (obj *patternFlowIpv4PriorityRaw) Increment() PatternFlowIpv4PriorityRawCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4PriorityRawChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4PriorityRawCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4PriorityRawCounter -func (obj *patternFlowIpv4PriorityRaw) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4PriorityRawCounter value in the PatternFlowIpv4PriorityRaw object -func (obj *patternFlowIpv4PriorityRaw) SetIncrement(value PatternFlowIpv4PriorityRawCounter) PatternFlowIpv4PriorityRaw { - obj.setChoice(PatternFlowIpv4PriorityRawChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4PriorityRawCounter -func (obj *patternFlowIpv4PriorityRaw) Decrement() PatternFlowIpv4PriorityRawCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4PriorityRawChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4PriorityRawCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4PriorityRawCounter -func (obj *patternFlowIpv4PriorityRaw) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4PriorityRawCounter value in the PatternFlowIpv4PriorityRaw object -func (obj *patternFlowIpv4PriorityRaw) SetDecrement(value PatternFlowIpv4PriorityRawCounter) PatternFlowIpv4PriorityRaw { - obj.setChoice(PatternFlowIpv4PriorityRawChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4PriorityRawMetricTag -func (obj *patternFlowIpv4PriorityRaw) MetricTags() PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4PriorityRawMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter struct { - obj *patternFlowIpv4PriorityRaw - patternFlowIpv4PriorityRawMetricTagSlice []PatternFlowIpv4PriorityRawMetricTag - fieldPtr *[]*otg.PatternFlowIpv4PriorityRawMetricTag -} - -func newPatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter(ptr *[]*otg.PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { - return &patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter interface { - setMsg(*patternFlowIpv4PriorityRaw) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter - Items() []PatternFlowIpv4PriorityRawMetricTag - Add() PatternFlowIpv4PriorityRawMetricTag - Append(items ...PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter - Set(index int, newObj PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter - Clear() PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter - clearHolderSlice() PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter - appendHolderSlice(item PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter -} - -func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) setMsg(msg *patternFlowIpv4PriorityRaw) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4PriorityRawMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) Items() []PatternFlowIpv4PriorityRawMetricTag { - return obj.patternFlowIpv4PriorityRawMetricTagSlice -} - -func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) Add() PatternFlowIpv4PriorityRawMetricTag { - newObj := &otg.PatternFlowIpv4PriorityRawMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4PriorityRawMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4PriorityRawMetricTagSlice = append(obj.patternFlowIpv4PriorityRawMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) Append(items ...PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4PriorityRawMetricTagSlice = append(obj.patternFlowIpv4PriorityRawMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) Set(index int, newObj PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4PriorityRawMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) Clear() PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4PriorityRawMetricTag{} - obj.patternFlowIpv4PriorityRawMetricTagSlice = []PatternFlowIpv4PriorityRawMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) clearHolderSlice() PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { - if len(obj.patternFlowIpv4PriorityRawMetricTagSlice) > 0 { - obj.patternFlowIpv4PriorityRawMetricTagSlice = []PatternFlowIpv4PriorityRawMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) appendHolderSlice(item PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { - obj.patternFlowIpv4PriorityRawMetricTagSlice = append(obj.patternFlowIpv4PriorityRawMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4PriorityRaw) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4PriorityRaw.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4PriorityRaw.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4PriorityRawMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4PriorityRaw) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4PriorityRawChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4PriorityRawChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4PriorityRawChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4PriorityRawChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4PriorityRawChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4PriorityRawChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4PriorityRaw") - } - } else { - intVal := otg.PatternFlowIpv4PriorityRaw_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4PriorityRaw_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowIpv4Tos ***** -type flowIpv4Tos struct { - validation - obj *otg.FlowIpv4Tos - marshaller marshalFlowIpv4Tos - unMarshaller unMarshalFlowIpv4Tos - precedenceHolder PatternFlowIpv4TosPrecedence - delayHolder PatternFlowIpv4TosDelay - throughputHolder PatternFlowIpv4TosThroughput - reliabilityHolder PatternFlowIpv4TosReliability - monetaryHolder PatternFlowIpv4TosMonetary - unusedHolder PatternFlowIpv4TosUnused -} - -func NewFlowIpv4Tos() FlowIpv4Tos { - obj := flowIpv4Tos{obj: &otg.FlowIpv4Tos{}} - obj.setDefault() - return &obj -} - -func (obj *flowIpv4Tos) msg() *otg.FlowIpv4Tos { - return obj.obj -} - -func (obj *flowIpv4Tos) setMsg(msg *otg.FlowIpv4Tos) FlowIpv4Tos { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIpv4Tos struct { - obj *flowIpv4Tos -} - -type marshalFlowIpv4Tos interface { - // ToProto marshals FlowIpv4Tos to protobuf object *otg.FlowIpv4Tos - ToProto() (*otg.FlowIpv4Tos, error) - // ToPbText marshals FlowIpv4Tos to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIpv4Tos to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIpv4Tos to JSON text - ToJson() (string, error) -} - -type unMarshalflowIpv4Tos struct { - obj *flowIpv4Tos -} - -type unMarshalFlowIpv4Tos interface { - // FromProto unmarshals FlowIpv4Tos from protobuf object *otg.FlowIpv4Tos - FromProto(msg *otg.FlowIpv4Tos) (FlowIpv4Tos, error) - // FromPbText unmarshals FlowIpv4Tos from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIpv4Tos from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIpv4Tos from JSON text - FromJson(value string) error -} - -func (obj *flowIpv4Tos) Marshal() marshalFlowIpv4Tos { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIpv4Tos{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIpv4Tos) Unmarshal() unMarshalFlowIpv4Tos { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIpv4Tos{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIpv4Tos) ToProto() (*otg.FlowIpv4Tos, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIpv4Tos) FromProto(msg *otg.FlowIpv4Tos) (FlowIpv4Tos, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIpv4Tos) 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 *unMarshalflowIpv4Tos) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowIpv4Tos) 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 *unMarshalflowIpv4Tos) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowIpv4Tos) 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 *unMarshalflowIpv4Tos) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowIpv4Tos) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIpv4Tos) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIpv4Tos) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIpv4Tos) Clone() (FlowIpv4Tos, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIpv4Tos() - 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 -} - -func (obj *flowIpv4Tos) setNil() { - obj.precedenceHolder = nil - obj.delayHolder = nil - obj.throughputHolder = nil - obj.reliabilityHolder = nil - obj.monetaryHolder = nil - obj.unusedHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowIpv4Tos is type of service (TOS) packet field. -type FlowIpv4Tos interface { - Validation - // msg marshals FlowIpv4Tos to protobuf object *otg.FlowIpv4Tos - // and doesn't set defaults - msg() *otg.FlowIpv4Tos - // setMsg unmarshals FlowIpv4Tos from protobuf object *otg.FlowIpv4Tos - // and doesn't set defaults - setMsg(*otg.FlowIpv4Tos) FlowIpv4Tos - // provides marshal interface - Marshal() marshalFlowIpv4Tos - // provides unmarshal interface - Unmarshal() unMarshalFlowIpv4Tos - // validate validates FlowIpv4Tos - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIpv4Tos, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Precedence returns PatternFlowIpv4TosPrecedence, set in FlowIpv4Tos. - // PatternFlowIpv4TosPrecedence is precedence - Precedence() PatternFlowIpv4TosPrecedence - // SetPrecedence assigns PatternFlowIpv4TosPrecedence provided by user to FlowIpv4Tos. - // PatternFlowIpv4TosPrecedence is precedence - SetPrecedence(value PatternFlowIpv4TosPrecedence) FlowIpv4Tos - // HasPrecedence checks if Precedence has been set in FlowIpv4Tos - HasPrecedence() bool - // Delay returns PatternFlowIpv4TosDelay, set in FlowIpv4Tos. - // PatternFlowIpv4TosDelay is delay - Delay() PatternFlowIpv4TosDelay - // SetDelay assigns PatternFlowIpv4TosDelay provided by user to FlowIpv4Tos. - // PatternFlowIpv4TosDelay is delay - SetDelay(value PatternFlowIpv4TosDelay) FlowIpv4Tos - // HasDelay checks if Delay has been set in FlowIpv4Tos - HasDelay() bool - // Throughput returns PatternFlowIpv4TosThroughput, set in FlowIpv4Tos. - // PatternFlowIpv4TosThroughput is throughput - Throughput() PatternFlowIpv4TosThroughput - // SetThroughput assigns PatternFlowIpv4TosThroughput provided by user to FlowIpv4Tos. - // PatternFlowIpv4TosThroughput is throughput - SetThroughput(value PatternFlowIpv4TosThroughput) FlowIpv4Tos - // HasThroughput checks if Throughput has been set in FlowIpv4Tos - HasThroughput() bool - // Reliability returns PatternFlowIpv4TosReliability, set in FlowIpv4Tos. - // PatternFlowIpv4TosReliability is reliability - Reliability() PatternFlowIpv4TosReliability - // SetReliability assigns PatternFlowIpv4TosReliability provided by user to FlowIpv4Tos. - // PatternFlowIpv4TosReliability is reliability - SetReliability(value PatternFlowIpv4TosReliability) FlowIpv4Tos - // HasReliability checks if Reliability has been set in FlowIpv4Tos - HasReliability() bool - // Monetary returns PatternFlowIpv4TosMonetary, set in FlowIpv4Tos. - // PatternFlowIpv4TosMonetary is monetary - Monetary() PatternFlowIpv4TosMonetary - // SetMonetary assigns PatternFlowIpv4TosMonetary provided by user to FlowIpv4Tos. - // PatternFlowIpv4TosMonetary is monetary - SetMonetary(value PatternFlowIpv4TosMonetary) FlowIpv4Tos - // HasMonetary checks if Monetary has been set in FlowIpv4Tos - HasMonetary() bool - // Unused returns PatternFlowIpv4TosUnused, set in FlowIpv4Tos. - // PatternFlowIpv4TosUnused is unused - Unused() PatternFlowIpv4TosUnused - // SetUnused assigns PatternFlowIpv4TosUnused provided by user to FlowIpv4Tos. - // PatternFlowIpv4TosUnused is unused - SetUnused(value PatternFlowIpv4TosUnused) FlowIpv4Tos - // HasUnused checks if Unused has been set in FlowIpv4Tos - HasUnused() bool - setNil() -} - -// description is TBD -// Precedence returns a PatternFlowIpv4TosPrecedence -func (obj *flowIpv4Tos) Precedence() PatternFlowIpv4TosPrecedence { - if obj.obj.Precedence == nil { - obj.obj.Precedence = NewPatternFlowIpv4TosPrecedence().msg() - } - if obj.precedenceHolder == nil { - obj.precedenceHolder = &patternFlowIpv4TosPrecedence{obj: obj.obj.Precedence} - } - return obj.precedenceHolder -} - -// description is TBD -// Precedence returns a PatternFlowIpv4TosPrecedence -func (obj *flowIpv4Tos) HasPrecedence() bool { - return obj.obj.Precedence != nil -} - -// description is TBD -// SetPrecedence sets the PatternFlowIpv4TosPrecedence value in the FlowIpv4Tos object -func (obj *flowIpv4Tos) SetPrecedence(value PatternFlowIpv4TosPrecedence) FlowIpv4Tos { - - obj.precedenceHolder = nil - obj.obj.Precedence = value.msg() - - return obj -} - -// description is TBD -// Delay returns a PatternFlowIpv4TosDelay -func (obj *flowIpv4Tos) Delay() PatternFlowIpv4TosDelay { - if obj.obj.Delay == nil { - obj.obj.Delay = NewPatternFlowIpv4TosDelay().msg() - } - if obj.delayHolder == nil { - obj.delayHolder = &patternFlowIpv4TosDelay{obj: obj.obj.Delay} - } - return obj.delayHolder -} - -// description is TBD -// Delay returns a PatternFlowIpv4TosDelay -func (obj *flowIpv4Tos) HasDelay() bool { - return obj.obj.Delay != nil -} - -// description is TBD -// SetDelay sets the PatternFlowIpv4TosDelay value in the FlowIpv4Tos object -func (obj *flowIpv4Tos) SetDelay(value PatternFlowIpv4TosDelay) FlowIpv4Tos { - - obj.delayHolder = nil - obj.obj.Delay = value.msg() - - return obj -} - -// description is TBD -// Throughput returns a PatternFlowIpv4TosThroughput -func (obj *flowIpv4Tos) Throughput() PatternFlowIpv4TosThroughput { - if obj.obj.Throughput == nil { - obj.obj.Throughput = NewPatternFlowIpv4TosThroughput().msg() - } - if obj.throughputHolder == nil { - obj.throughputHolder = &patternFlowIpv4TosThroughput{obj: obj.obj.Throughput} - } - return obj.throughputHolder -} - -// description is TBD -// Throughput returns a PatternFlowIpv4TosThroughput -func (obj *flowIpv4Tos) HasThroughput() bool { - return obj.obj.Throughput != nil -} - -// description is TBD -// SetThroughput sets the PatternFlowIpv4TosThroughput value in the FlowIpv4Tos object -func (obj *flowIpv4Tos) SetThroughput(value PatternFlowIpv4TosThroughput) FlowIpv4Tos { - - obj.throughputHolder = nil - obj.obj.Throughput = value.msg() - - return obj -} - -// description is TBD -// Reliability returns a PatternFlowIpv4TosReliability -func (obj *flowIpv4Tos) Reliability() PatternFlowIpv4TosReliability { - if obj.obj.Reliability == nil { - obj.obj.Reliability = NewPatternFlowIpv4TosReliability().msg() - } - if obj.reliabilityHolder == nil { - obj.reliabilityHolder = &patternFlowIpv4TosReliability{obj: obj.obj.Reliability} - } - return obj.reliabilityHolder -} - -// description is TBD -// Reliability returns a PatternFlowIpv4TosReliability -func (obj *flowIpv4Tos) HasReliability() bool { - return obj.obj.Reliability != nil -} - -// description is TBD -// SetReliability sets the PatternFlowIpv4TosReliability value in the FlowIpv4Tos object -func (obj *flowIpv4Tos) SetReliability(value PatternFlowIpv4TosReliability) FlowIpv4Tos { - - obj.reliabilityHolder = nil - obj.obj.Reliability = value.msg() - - return obj -} - -// description is TBD -// Monetary returns a PatternFlowIpv4TosMonetary -func (obj *flowIpv4Tos) Monetary() PatternFlowIpv4TosMonetary { - if obj.obj.Monetary == nil { - obj.obj.Monetary = NewPatternFlowIpv4TosMonetary().msg() - } - if obj.monetaryHolder == nil { - obj.monetaryHolder = &patternFlowIpv4TosMonetary{obj: obj.obj.Monetary} - } - return obj.monetaryHolder -} - -// description is TBD -// Monetary returns a PatternFlowIpv4TosMonetary -func (obj *flowIpv4Tos) HasMonetary() bool { - return obj.obj.Monetary != nil -} - -// description is TBD -// SetMonetary sets the PatternFlowIpv4TosMonetary value in the FlowIpv4Tos object -func (obj *flowIpv4Tos) SetMonetary(value PatternFlowIpv4TosMonetary) FlowIpv4Tos { - - obj.monetaryHolder = nil - obj.obj.Monetary = value.msg() - - return obj -} - -// description is TBD -// Unused returns a PatternFlowIpv4TosUnused -func (obj *flowIpv4Tos) Unused() PatternFlowIpv4TosUnused { - if obj.obj.Unused == nil { - obj.obj.Unused = NewPatternFlowIpv4TosUnused().msg() - } - if obj.unusedHolder == nil { - obj.unusedHolder = &patternFlowIpv4TosUnused{obj: obj.obj.Unused} - } - return obj.unusedHolder -} - -// description is TBD -// Unused returns a PatternFlowIpv4TosUnused -func (obj *flowIpv4Tos) HasUnused() bool { - return obj.obj.Unused != nil -} - -// description is TBD -// SetUnused sets the PatternFlowIpv4TosUnused value in the FlowIpv4Tos object -func (obj *flowIpv4Tos) SetUnused(value PatternFlowIpv4TosUnused) FlowIpv4Tos { - - obj.unusedHolder = nil - obj.obj.Unused = value.msg() - - return obj -} - -func (obj *flowIpv4Tos) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Precedence != nil { - - obj.Precedence().validateObj(vObj, set_default) - } - - if obj.obj.Delay != nil { - - obj.Delay().validateObj(vObj, set_default) - } - - if obj.obj.Throughput != nil { - - obj.Throughput().validateObj(vObj, set_default) - } - - if obj.obj.Reliability != nil { - - obj.Reliability().validateObj(vObj, set_default) - } - - if obj.obj.Monetary != nil { - - obj.Monetary().validateObj(vObj, set_default) - } - - if obj.obj.Unused != nil { - - obj.Unused().validateObj(vObj, set_default) - } - -} - -func (obj *flowIpv4Tos) setDefault() { - -} - -// ***** FlowIpv4Dscp ***** -type flowIpv4Dscp struct { - validation - obj *otg.FlowIpv4Dscp - marshaller marshalFlowIpv4Dscp - unMarshaller unMarshalFlowIpv4Dscp - phbHolder PatternFlowIpv4DscpPhb - ecnHolder PatternFlowIpv4DscpEcn -} - -func NewFlowIpv4Dscp() FlowIpv4Dscp { - obj := flowIpv4Dscp{obj: &otg.FlowIpv4Dscp{}} - obj.setDefault() - return &obj -} - -func (obj *flowIpv4Dscp) msg() *otg.FlowIpv4Dscp { - return obj.obj -} - -func (obj *flowIpv4Dscp) setMsg(msg *otg.FlowIpv4Dscp) FlowIpv4Dscp { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIpv4Dscp struct { - obj *flowIpv4Dscp -} - -type marshalFlowIpv4Dscp interface { - // ToProto marshals FlowIpv4Dscp to protobuf object *otg.FlowIpv4Dscp - ToProto() (*otg.FlowIpv4Dscp, error) - // ToPbText marshals FlowIpv4Dscp to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIpv4Dscp to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIpv4Dscp to JSON text - ToJson() (string, error) -} - -type unMarshalflowIpv4Dscp struct { - obj *flowIpv4Dscp -} - -type unMarshalFlowIpv4Dscp interface { - // FromProto unmarshals FlowIpv4Dscp from protobuf object *otg.FlowIpv4Dscp - FromProto(msg *otg.FlowIpv4Dscp) (FlowIpv4Dscp, error) - // FromPbText unmarshals FlowIpv4Dscp from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIpv4Dscp from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIpv4Dscp from JSON text - FromJson(value string) error -} - -func (obj *flowIpv4Dscp) Marshal() marshalFlowIpv4Dscp { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIpv4Dscp{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIpv4Dscp) Unmarshal() unMarshalFlowIpv4Dscp { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIpv4Dscp{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIpv4Dscp) ToProto() (*otg.FlowIpv4Dscp, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIpv4Dscp) FromProto(msg *otg.FlowIpv4Dscp) (FlowIpv4Dscp, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIpv4Dscp) 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 *unMarshalflowIpv4Dscp) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowIpv4Dscp) 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 *unMarshalflowIpv4Dscp) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowIpv4Dscp) 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 *unMarshalflowIpv4Dscp) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowIpv4Dscp) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIpv4Dscp) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIpv4Dscp) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIpv4Dscp) Clone() (FlowIpv4Dscp, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIpv4Dscp() - 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 -} - -func (obj *flowIpv4Dscp) setNil() { - obj.phbHolder = nil - obj.ecnHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowIpv4Dscp is differentiated services code point (DSCP) packet field. -type FlowIpv4Dscp interface { - Validation - // msg marshals FlowIpv4Dscp to protobuf object *otg.FlowIpv4Dscp - // and doesn't set defaults - msg() *otg.FlowIpv4Dscp - // setMsg unmarshals FlowIpv4Dscp from protobuf object *otg.FlowIpv4Dscp - // and doesn't set defaults - setMsg(*otg.FlowIpv4Dscp) FlowIpv4Dscp - // provides marshal interface - Marshal() marshalFlowIpv4Dscp - // provides unmarshal interface - Unmarshal() unMarshalFlowIpv4Dscp - // validate validates FlowIpv4Dscp - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIpv4Dscp, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Phb returns PatternFlowIpv4DscpPhb, set in FlowIpv4Dscp. - // PatternFlowIpv4DscpPhb is per hop behavior - Phb() PatternFlowIpv4DscpPhb - // SetPhb assigns PatternFlowIpv4DscpPhb provided by user to FlowIpv4Dscp. - // PatternFlowIpv4DscpPhb is per hop behavior - SetPhb(value PatternFlowIpv4DscpPhb) FlowIpv4Dscp - // HasPhb checks if Phb has been set in FlowIpv4Dscp - HasPhb() bool - // Ecn returns PatternFlowIpv4DscpEcn, set in FlowIpv4Dscp. - // PatternFlowIpv4DscpEcn is explicit congestion notification - Ecn() PatternFlowIpv4DscpEcn - // SetEcn assigns PatternFlowIpv4DscpEcn provided by user to FlowIpv4Dscp. - // PatternFlowIpv4DscpEcn is explicit congestion notification - SetEcn(value PatternFlowIpv4DscpEcn) FlowIpv4Dscp - // HasEcn checks if Ecn has been set in FlowIpv4Dscp - HasEcn() bool - setNil() -} - -// description is TBD -// Phb returns a PatternFlowIpv4DscpPhb -func (obj *flowIpv4Dscp) Phb() PatternFlowIpv4DscpPhb { - if obj.obj.Phb == nil { - obj.obj.Phb = NewPatternFlowIpv4DscpPhb().msg() - } - if obj.phbHolder == nil { - obj.phbHolder = &patternFlowIpv4DscpPhb{obj: obj.obj.Phb} - } - return obj.phbHolder -} - -// description is TBD -// Phb returns a PatternFlowIpv4DscpPhb -func (obj *flowIpv4Dscp) HasPhb() bool { - return obj.obj.Phb != nil -} - -// description is TBD -// SetPhb sets the PatternFlowIpv4DscpPhb value in the FlowIpv4Dscp object -func (obj *flowIpv4Dscp) SetPhb(value PatternFlowIpv4DscpPhb) FlowIpv4Dscp { - - obj.phbHolder = nil - obj.obj.Phb = value.msg() - - return obj -} - -// description is TBD -// Ecn returns a PatternFlowIpv4DscpEcn -func (obj *flowIpv4Dscp) Ecn() PatternFlowIpv4DscpEcn { - if obj.obj.Ecn == nil { - obj.obj.Ecn = NewPatternFlowIpv4DscpEcn().msg() - } - if obj.ecnHolder == nil { - obj.ecnHolder = &patternFlowIpv4DscpEcn{obj: obj.obj.Ecn} - } - return obj.ecnHolder -} - -// description is TBD -// Ecn returns a PatternFlowIpv4DscpEcn -func (obj *flowIpv4Dscp) HasEcn() bool { - return obj.obj.Ecn != nil -} - -// description is TBD -// SetEcn sets the PatternFlowIpv4DscpEcn value in the FlowIpv4Dscp object -func (obj *flowIpv4Dscp) SetEcn(value PatternFlowIpv4DscpEcn) FlowIpv4Dscp { - - obj.ecnHolder = nil - obj.obj.Ecn = value.msg() - - return obj -} - -func (obj *flowIpv4Dscp) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Phb != nil { - - obj.Phb().validateObj(vObj, set_default) - } - - if obj.obj.Ecn != nil { - - obj.Ecn().validateObj(vObj, set_default) - } - -} - -func (obj *flowIpv4Dscp) setDefault() { - -} - -// ***** PatternFlowIpv4TotalLengthCounter ***** -type patternFlowIpv4TotalLengthCounter struct { - validation - obj *otg.PatternFlowIpv4TotalLengthCounter - marshaller marshalPatternFlowIpv4TotalLengthCounter - unMarshaller unMarshalPatternFlowIpv4TotalLengthCounter -} - -func NewPatternFlowIpv4TotalLengthCounter() PatternFlowIpv4TotalLengthCounter { - obj := patternFlowIpv4TotalLengthCounter{obj: &otg.PatternFlowIpv4TotalLengthCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TotalLengthCounter) msg() *otg.PatternFlowIpv4TotalLengthCounter { - return obj.obj -} - -func (obj *patternFlowIpv4TotalLengthCounter) setMsg(msg *otg.PatternFlowIpv4TotalLengthCounter) PatternFlowIpv4TotalLengthCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TotalLengthCounter struct { - obj *patternFlowIpv4TotalLengthCounter -} - -type marshalPatternFlowIpv4TotalLengthCounter interface { - // ToProto marshals PatternFlowIpv4TotalLengthCounter to protobuf object *otg.PatternFlowIpv4TotalLengthCounter - ToProto() (*otg.PatternFlowIpv4TotalLengthCounter, error) - // ToPbText marshals PatternFlowIpv4TotalLengthCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TotalLengthCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TotalLengthCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TotalLengthCounter struct { - obj *patternFlowIpv4TotalLengthCounter -} - -type unMarshalPatternFlowIpv4TotalLengthCounter interface { - // FromProto unmarshals PatternFlowIpv4TotalLengthCounter from protobuf object *otg.PatternFlowIpv4TotalLengthCounter - FromProto(msg *otg.PatternFlowIpv4TotalLengthCounter) (PatternFlowIpv4TotalLengthCounter, error) - // FromPbText unmarshals PatternFlowIpv4TotalLengthCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TotalLengthCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TotalLengthCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TotalLengthCounter) Marshal() marshalPatternFlowIpv4TotalLengthCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TotalLengthCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TotalLengthCounter) Unmarshal() unMarshalPatternFlowIpv4TotalLengthCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TotalLengthCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TotalLengthCounter) ToProto() (*otg.PatternFlowIpv4TotalLengthCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TotalLengthCounter) FromProto(msg *otg.PatternFlowIpv4TotalLengthCounter) (PatternFlowIpv4TotalLengthCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TotalLengthCounter) 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 *unMarshalpatternFlowIpv4TotalLengthCounter) 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 *marshalpatternFlowIpv4TotalLengthCounter) 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 *unMarshalpatternFlowIpv4TotalLengthCounter) 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 *marshalpatternFlowIpv4TotalLengthCounter) 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 *unMarshalpatternFlowIpv4TotalLengthCounter) 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 *patternFlowIpv4TotalLengthCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TotalLengthCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TotalLengthCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TotalLengthCounter) Clone() (PatternFlowIpv4TotalLengthCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TotalLengthCounter() - 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 -} - -// PatternFlowIpv4TotalLengthCounter is integer counter pattern -type PatternFlowIpv4TotalLengthCounter interface { - Validation - // msg marshals PatternFlowIpv4TotalLengthCounter to protobuf object *otg.PatternFlowIpv4TotalLengthCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TotalLengthCounter - // setMsg unmarshals PatternFlowIpv4TotalLengthCounter from protobuf object *otg.PatternFlowIpv4TotalLengthCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TotalLengthCounter) PatternFlowIpv4TotalLengthCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4TotalLengthCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TotalLengthCounter - // validate validates PatternFlowIpv4TotalLengthCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TotalLengthCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4TotalLengthCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4TotalLengthCounter - SetStart(value uint32) PatternFlowIpv4TotalLengthCounter - // HasStart checks if Start has been set in PatternFlowIpv4TotalLengthCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4TotalLengthCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4TotalLengthCounter - SetStep(value uint32) PatternFlowIpv4TotalLengthCounter - // HasStep checks if Step has been set in PatternFlowIpv4TotalLengthCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4TotalLengthCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4TotalLengthCounter - SetCount(value uint32) PatternFlowIpv4TotalLengthCounter - // HasCount checks if Count has been set in PatternFlowIpv4TotalLengthCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TotalLengthCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TotalLengthCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4TotalLengthCounter object -func (obj *patternFlowIpv4TotalLengthCounter) SetStart(value uint32) PatternFlowIpv4TotalLengthCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TotalLengthCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TotalLengthCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4TotalLengthCounter object -func (obj *patternFlowIpv4TotalLengthCounter) SetStep(value uint32) PatternFlowIpv4TotalLengthCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TotalLengthCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TotalLengthCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4TotalLengthCounter object -func (obj *patternFlowIpv4TotalLengthCounter) SetCount(value uint32) PatternFlowIpv4TotalLengthCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4TotalLengthCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TotalLengthCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TotalLengthCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TotalLengthCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4TotalLengthCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(46) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4TotalLengthMetricTag ***** -type patternFlowIpv4TotalLengthMetricTag struct { - validation - obj *otg.PatternFlowIpv4TotalLengthMetricTag - marshaller marshalPatternFlowIpv4TotalLengthMetricTag - unMarshaller unMarshalPatternFlowIpv4TotalLengthMetricTag -} - -func NewPatternFlowIpv4TotalLengthMetricTag() PatternFlowIpv4TotalLengthMetricTag { - obj := patternFlowIpv4TotalLengthMetricTag{obj: &otg.PatternFlowIpv4TotalLengthMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TotalLengthMetricTag) msg() *otg.PatternFlowIpv4TotalLengthMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4TotalLengthMetricTag) setMsg(msg *otg.PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TotalLengthMetricTag struct { - obj *patternFlowIpv4TotalLengthMetricTag -} - -type marshalPatternFlowIpv4TotalLengthMetricTag interface { - // ToProto marshals PatternFlowIpv4TotalLengthMetricTag to protobuf object *otg.PatternFlowIpv4TotalLengthMetricTag - ToProto() (*otg.PatternFlowIpv4TotalLengthMetricTag, error) - // ToPbText marshals PatternFlowIpv4TotalLengthMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TotalLengthMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TotalLengthMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TotalLengthMetricTag struct { - obj *patternFlowIpv4TotalLengthMetricTag -} - -type unMarshalPatternFlowIpv4TotalLengthMetricTag interface { - // FromProto unmarshals PatternFlowIpv4TotalLengthMetricTag from protobuf object *otg.PatternFlowIpv4TotalLengthMetricTag - FromProto(msg *otg.PatternFlowIpv4TotalLengthMetricTag) (PatternFlowIpv4TotalLengthMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4TotalLengthMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TotalLengthMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TotalLengthMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TotalLengthMetricTag) Marshal() marshalPatternFlowIpv4TotalLengthMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TotalLengthMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TotalLengthMetricTag) Unmarshal() unMarshalPatternFlowIpv4TotalLengthMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TotalLengthMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TotalLengthMetricTag) ToProto() (*otg.PatternFlowIpv4TotalLengthMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TotalLengthMetricTag) FromProto(msg *otg.PatternFlowIpv4TotalLengthMetricTag) (PatternFlowIpv4TotalLengthMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TotalLengthMetricTag) 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 *unMarshalpatternFlowIpv4TotalLengthMetricTag) 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 *marshalpatternFlowIpv4TotalLengthMetricTag) 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 *unMarshalpatternFlowIpv4TotalLengthMetricTag) 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 *marshalpatternFlowIpv4TotalLengthMetricTag) 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 *unMarshalpatternFlowIpv4TotalLengthMetricTag) 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 *patternFlowIpv4TotalLengthMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TotalLengthMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TotalLengthMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TotalLengthMetricTag) Clone() (PatternFlowIpv4TotalLengthMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TotalLengthMetricTag() - 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 -} - -// PatternFlowIpv4TotalLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4TotalLengthMetricTag interface { - Validation - // msg marshals PatternFlowIpv4TotalLengthMetricTag to protobuf object *otg.PatternFlowIpv4TotalLengthMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TotalLengthMetricTag - // setMsg unmarshals PatternFlowIpv4TotalLengthMetricTag from protobuf object *otg.PatternFlowIpv4TotalLengthMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4TotalLengthMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TotalLengthMetricTag - // validate validates PatternFlowIpv4TotalLengthMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TotalLengthMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4TotalLengthMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4TotalLengthMetricTag - SetName(value string) PatternFlowIpv4TotalLengthMetricTag - // Offset returns uint32, set in PatternFlowIpv4TotalLengthMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4TotalLengthMetricTag - SetOffset(value uint32) PatternFlowIpv4TotalLengthMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4TotalLengthMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4TotalLengthMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4TotalLengthMetricTag - SetLength(value uint32) PatternFlowIpv4TotalLengthMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4TotalLengthMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4TotalLengthMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4TotalLengthMetricTag object -func (obj *patternFlowIpv4TotalLengthMetricTag) SetName(value string) PatternFlowIpv4TotalLengthMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TotalLengthMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TotalLengthMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4TotalLengthMetricTag object -func (obj *patternFlowIpv4TotalLengthMetricTag) SetOffset(value uint32) PatternFlowIpv4TotalLengthMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TotalLengthMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TotalLengthMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4TotalLengthMetricTag object -func (obj *patternFlowIpv4TotalLengthMetricTag) SetLength(value uint32) PatternFlowIpv4TotalLengthMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4TotalLengthMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TotalLengthMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TotalLengthMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4TotalLengthMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4TotalLengthMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowIpv4IdentificationCounter ***** -type patternFlowIpv4IdentificationCounter struct { - validation - obj *otg.PatternFlowIpv4IdentificationCounter - marshaller marshalPatternFlowIpv4IdentificationCounter - unMarshaller unMarshalPatternFlowIpv4IdentificationCounter -} - -func NewPatternFlowIpv4IdentificationCounter() PatternFlowIpv4IdentificationCounter { - obj := patternFlowIpv4IdentificationCounter{obj: &otg.PatternFlowIpv4IdentificationCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4IdentificationCounter) msg() *otg.PatternFlowIpv4IdentificationCounter { - return obj.obj -} - -func (obj *patternFlowIpv4IdentificationCounter) setMsg(msg *otg.PatternFlowIpv4IdentificationCounter) PatternFlowIpv4IdentificationCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4IdentificationCounter struct { - obj *patternFlowIpv4IdentificationCounter -} - -type marshalPatternFlowIpv4IdentificationCounter interface { - // ToProto marshals PatternFlowIpv4IdentificationCounter to protobuf object *otg.PatternFlowIpv4IdentificationCounter - ToProto() (*otg.PatternFlowIpv4IdentificationCounter, error) - // ToPbText marshals PatternFlowIpv4IdentificationCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4IdentificationCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4IdentificationCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4IdentificationCounter struct { - obj *patternFlowIpv4IdentificationCounter -} - -type unMarshalPatternFlowIpv4IdentificationCounter interface { - // FromProto unmarshals PatternFlowIpv4IdentificationCounter from protobuf object *otg.PatternFlowIpv4IdentificationCounter - FromProto(msg *otg.PatternFlowIpv4IdentificationCounter) (PatternFlowIpv4IdentificationCounter, error) - // FromPbText unmarshals PatternFlowIpv4IdentificationCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4IdentificationCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4IdentificationCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4IdentificationCounter) Marshal() marshalPatternFlowIpv4IdentificationCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4IdentificationCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4IdentificationCounter) Unmarshal() unMarshalPatternFlowIpv4IdentificationCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4IdentificationCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4IdentificationCounter) ToProto() (*otg.PatternFlowIpv4IdentificationCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4IdentificationCounter) FromProto(msg *otg.PatternFlowIpv4IdentificationCounter) (PatternFlowIpv4IdentificationCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4IdentificationCounter) 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 *unMarshalpatternFlowIpv4IdentificationCounter) 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 *marshalpatternFlowIpv4IdentificationCounter) 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 *unMarshalpatternFlowIpv4IdentificationCounter) 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 *marshalpatternFlowIpv4IdentificationCounter) 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 *unMarshalpatternFlowIpv4IdentificationCounter) 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 *patternFlowIpv4IdentificationCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4IdentificationCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4IdentificationCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4IdentificationCounter) Clone() (PatternFlowIpv4IdentificationCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4IdentificationCounter() - 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 -} - -// PatternFlowIpv4IdentificationCounter is integer counter pattern -type PatternFlowIpv4IdentificationCounter interface { - Validation - // msg marshals PatternFlowIpv4IdentificationCounter to protobuf object *otg.PatternFlowIpv4IdentificationCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4IdentificationCounter - // setMsg unmarshals PatternFlowIpv4IdentificationCounter from protobuf object *otg.PatternFlowIpv4IdentificationCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4IdentificationCounter) PatternFlowIpv4IdentificationCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4IdentificationCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4IdentificationCounter - // validate validates PatternFlowIpv4IdentificationCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4IdentificationCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4IdentificationCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4IdentificationCounter - SetStart(value uint32) PatternFlowIpv4IdentificationCounter - // HasStart checks if Start has been set in PatternFlowIpv4IdentificationCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4IdentificationCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4IdentificationCounter - SetStep(value uint32) PatternFlowIpv4IdentificationCounter - // HasStep checks if Step has been set in PatternFlowIpv4IdentificationCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4IdentificationCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4IdentificationCounter - SetCount(value uint32) PatternFlowIpv4IdentificationCounter - // HasCount checks if Count has been set in PatternFlowIpv4IdentificationCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4IdentificationCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4IdentificationCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4IdentificationCounter object -func (obj *patternFlowIpv4IdentificationCounter) SetStart(value uint32) PatternFlowIpv4IdentificationCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4IdentificationCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4IdentificationCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4IdentificationCounter object -func (obj *patternFlowIpv4IdentificationCounter) SetStep(value uint32) PatternFlowIpv4IdentificationCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4IdentificationCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4IdentificationCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4IdentificationCounter object -func (obj *patternFlowIpv4IdentificationCounter) SetCount(value uint32) PatternFlowIpv4IdentificationCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4IdentificationCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4IdentificationCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4IdentificationCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4IdentificationCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4IdentificationCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4IdentificationMetricTag ***** -type patternFlowIpv4IdentificationMetricTag struct { - validation - obj *otg.PatternFlowIpv4IdentificationMetricTag - marshaller marshalPatternFlowIpv4IdentificationMetricTag - unMarshaller unMarshalPatternFlowIpv4IdentificationMetricTag -} - -func NewPatternFlowIpv4IdentificationMetricTag() PatternFlowIpv4IdentificationMetricTag { - obj := patternFlowIpv4IdentificationMetricTag{obj: &otg.PatternFlowIpv4IdentificationMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4IdentificationMetricTag) msg() *otg.PatternFlowIpv4IdentificationMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4IdentificationMetricTag) setMsg(msg *otg.PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4IdentificationMetricTag struct { - obj *patternFlowIpv4IdentificationMetricTag -} - -type marshalPatternFlowIpv4IdentificationMetricTag interface { - // ToProto marshals PatternFlowIpv4IdentificationMetricTag to protobuf object *otg.PatternFlowIpv4IdentificationMetricTag - ToProto() (*otg.PatternFlowIpv4IdentificationMetricTag, error) - // ToPbText marshals PatternFlowIpv4IdentificationMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4IdentificationMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4IdentificationMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4IdentificationMetricTag struct { - obj *patternFlowIpv4IdentificationMetricTag -} - -type unMarshalPatternFlowIpv4IdentificationMetricTag interface { - // FromProto unmarshals PatternFlowIpv4IdentificationMetricTag from protobuf object *otg.PatternFlowIpv4IdentificationMetricTag - FromProto(msg *otg.PatternFlowIpv4IdentificationMetricTag) (PatternFlowIpv4IdentificationMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4IdentificationMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4IdentificationMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4IdentificationMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4IdentificationMetricTag) Marshal() marshalPatternFlowIpv4IdentificationMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4IdentificationMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4IdentificationMetricTag) Unmarshal() unMarshalPatternFlowIpv4IdentificationMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4IdentificationMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4IdentificationMetricTag) ToProto() (*otg.PatternFlowIpv4IdentificationMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4IdentificationMetricTag) FromProto(msg *otg.PatternFlowIpv4IdentificationMetricTag) (PatternFlowIpv4IdentificationMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4IdentificationMetricTag) 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 *unMarshalpatternFlowIpv4IdentificationMetricTag) 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 *marshalpatternFlowIpv4IdentificationMetricTag) 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 *unMarshalpatternFlowIpv4IdentificationMetricTag) 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 *marshalpatternFlowIpv4IdentificationMetricTag) 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 *unMarshalpatternFlowIpv4IdentificationMetricTag) 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 *patternFlowIpv4IdentificationMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4IdentificationMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4IdentificationMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4IdentificationMetricTag) Clone() (PatternFlowIpv4IdentificationMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4IdentificationMetricTag() - 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 -} - -// PatternFlowIpv4IdentificationMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4IdentificationMetricTag interface { - Validation - // msg marshals PatternFlowIpv4IdentificationMetricTag to protobuf object *otg.PatternFlowIpv4IdentificationMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4IdentificationMetricTag - // setMsg unmarshals PatternFlowIpv4IdentificationMetricTag from protobuf object *otg.PatternFlowIpv4IdentificationMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4IdentificationMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4IdentificationMetricTag - // validate validates PatternFlowIpv4IdentificationMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4IdentificationMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4IdentificationMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4IdentificationMetricTag - SetName(value string) PatternFlowIpv4IdentificationMetricTag - // Offset returns uint32, set in PatternFlowIpv4IdentificationMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4IdentificationMetricTag - SetOffset(value uint32) PatternFlowIpv4IdentificationMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4IdentificationMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4IdentificationMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4IdentificationMetricTag - SetLength(value uint32) PatternFlowIpv4IdentificationMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4IdentificationMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4IdentificationMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4IdentificationMetricTag object -func (obj *patternFlowIpv4IdentificationMetricTag) SetName(value string) PatternFlowIpv4IdentificationMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4IdentificationMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4IdentificationMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4IdentificationMetricTag object -func (obj *patternFlowIpv4IdentificationMetricTag) SetOffset(value uint32) PatternFlowIpv4IdentificationMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4IdentificationMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4IdentificationMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4IdentificationMetricTag object -func (obj *patternFlowIpv4IdentificationMetricTag) SetLength(value uint32) PatternFlowIpv4IdentificationMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4IdentificationMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4IdentificationMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4IdentificationMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4IdentificationMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4IdentificationMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowIpv4ReservedCounter ***** -type patternFlowIpv4ReservedCounter struct { - validation - obj *otg.PatternFlowIpv4ReservedCounter - marshaller marshalPatternFlowIpv4ReservedCounter - unMarshaller unMarshalPatternFlowIpv4ReservedCounter -} - -func NewPatternFlowIpv4ReservedCounter() PatternFlowIpv4ReservedCounter { - obj := patternFlowIpv4ReservedCounter{obj: &otg.PatternFlowIpv4ReservedCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4ReservedCounter) msg() *otg.PatternFlowIpv4ReservedCounter { - return obj.obj -} - -func (obj *patternFlowIpv4ReservedCounter) setMsg(msg *otg.PatternFlowIpv4ReservedCounter) PatternFlowIpv4ReservedCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4ReservedCounter struct { - obj *patternFlowIpv4ReservedCounter -} - -type marshalPatternFlowIpv4ReservedCounter interface { - // ToProto marshals PatternFlowIpv4ReservedCounter to protobuf object *otg.PatternFlowIpv4ReservedCounter - ToProto() (*otg.PatternFlowIpv4ReservedCounter, error) - // ToPbText marshals PatternFlowIpv4ReservedCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4ReservedCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4ReservedCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4ReservedCounter struct { - obj *patternFlowIpv4ReservedCounter -} - -type unMarshalPatternFlowIpv4ReservedCounter interface { - // FromProto unmarshals PatternFlowIpv4ReservedCounter from protobuf object *otg.PatternFlowIpv4ReservedCounter - FromProto(msg *otg.PatternFlowIpv4ReservedCounter) (PatternFlowIpv4ReservedCounter, error) - // FromPbText unmarshals PatternFlowIpv4ReservedCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4ReservedCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4ReservedCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4ReservedCounter) Marshal() marshalPatternFlowIpv4ReservedCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4ReservedCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4ReservedCounter) Unmarshal() unMarshalPatternFlowIpv4ReservedCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4ReservedCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4ReservedCounter) ToProto() (*otg.PatternFlowIpv4ReservedCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4ReservedCounter) FromProto(msg *otg.PatternFlowIpv4ReservedCounter) (PatternFlowIpv4ReservedCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4ReservedCounter) 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 *unMarshalpatternFlowIpv4ReservedCounter) 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 *marshalpatternFlowIpv4ReservedCounter) 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 *unMarshalpatternFlowIpv4ReservedCounter) 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 *marshalpatternFlowIpv4ReservedCounter) 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 *unMarshalpatternFlowIpv4ReservedCounter) 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 *patternFlowIpv4ReservedCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4ReservedCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4ReservedCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4ReservedCounter) Clone() (PatternFlowIpv4ReservedCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4ReservedCounter() - 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 -} - -// PatternFlowIpv4ReservedCounter is integer counter pattern -type PatternFlowIpv4ReservedCounter interface { - Validation - // msg marshals PatternFlowIpv4ReservedCounter to protobuf object *otg.PatternFlowIpv4ReservedCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4ReservedCounter - // setMsg unmarshals PatternFlowIpv4ReservedCounter from protobuf object *otg.PatternFlowIpv4ReservedCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4ReservedCounter) PatternFlowIpv4ReservedCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4ReservedCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4ReservedCounter - // validate validates PatternFlowIpv4ReservedCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4ReservedCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4ReservedCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4ReservedCounter - SetStart(value uint32) PatternFlowIpv4ReservedCounter - // HasStart checks if Start has been set in PatternFlowIpv4ReservedCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4ReservedCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4ReservedCounter - SetStep(value uint32) PatternFlowIpv4ReservedCounter - // HasStep checks if Step has been set in PatternFlowIpv4ReservedCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4ReservedCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4ReservedCounter - SetCount(value uint32) PatternFlowIpv4ReservedCounter - // HasCount checks if Count has been set in PatternFlowIpv4ReservedCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4ReservedCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4ReservedCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4ReservedCounter object -func (obj *patternFlowIpv4ReservedCounter) SetStart(value uint32) PatternFlowIpv4ReservedCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4ReservedCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4ReservedCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4ReservedCounter object -func (obj *patternFlowIpv4ReservedCounter) SetStep(value uint32) PatternFlowIpv4ReservedCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4ReservedCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4ReservedCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4ReservedCounter object -func (obj *patternFlowIpv4ReservedCounter) SetCount(value uint32) PatternFlowIpv4ReservedCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4ReservedCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4ReservedCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4ReservedCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4ReservedCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4ReservedCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4ReservedMetricTag ***** -type patternFlowIpv4ReservedMetricTag struct { - validation - obj *otg.PatternFlowIpv4ReservedMetricTag - marshaller marshalPatternFlowIpv4ReservedMetricTag - unMarshaller unMarshalPatternFlowIpv4ReservedMetricTag -} - -func NewPatternFlowIpv4ReservedMetricTag() PatternFlowIpv4ReservedMetricTag { - obj := patternFlowIpv4ReservedMetricTag{obj: &otg.PatternFlowIpv4ReservedMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4ReservedMetricTag) msg() *otg.PatternFlowIpv4ReservedMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4ReservedMetricTag) setMsg(msg *otg.PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4ReservedMetricTag struct { - obj *patternFlowIpv4ReservedMetricTag -} - -type marshalPatternFlowIpv4ReservedMetricTag interface { - // ToProto marshals PatternFlowIpv4ReservedMetricTag to protobuf object *otg.PatternFlowIpv4ReservedMetricTag - ToProto() (*otg.PatternFlowIpv4ReservedMetricTag, error) - // ToPbText marshals PatternFlowIpv4ReservedMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4ReservedMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4ReservedMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4ReservedMetricTag struct { - obj *patternFlowIpv4ReservedMetricTag -} - -type unMarshalPatternFlowIpv4ReservedMetricTag interface { - // FromProto unmarshals PatternFlowIpv4ReservedMetricTag from protobuf object *otg.PatternFlowIpv4ReservedMetricTag - FromProto(msg *otg.PatternFlowIpv4ReservedMetricTag) (PatternFlowIpv4ReservedMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4ReservedMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4ReservedMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4ReservedMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4ReservedMetricTag) Marshal() marshalPatternFlowIpv4ReservedMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4ReservedMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4ReservedMetricTag) Unmarshal() unMarshalPatternFlowIpv4ReservedMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4ReservedMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4ReservedMetricTag) ToProto() (*otg.PatternFlowIpv4ReservedMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4ReservedMetricTag) FromProto(msg *otg.PatternFlowIpv4ReservedMetricTag) (PatternFlowIpv4ReservedMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4ReservedMetricTag) 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 *unMarshalpatternFlowIpv4ReservedMetricTag) 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 *marshalpatternFlowIpv4ReservedMetricTag) 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 *unMarshalpatternFlowIpv4ReservedMetricTag) 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 *marshalpatternFlowIpv4ReservedMetricTag) 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 *unMarshalpatternFlowIpv4ReservedMetricTag) 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 *patternFlowIpv4ReservedMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4ReservedMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4ReservedMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4ReservedMetricTag) Clone() (PatternFlowIpv4ReservedMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4ReservedMetricTag() - 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 -} - -// PatternFlowIpv4ReservedMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4ReservedMetricTag interface { - Validation - // msg marshals PatternFlowIpv4ReservedMetricTag to protobuf object *otg.PatternFlowIpv4ReservedMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4ReservedMetricTag - // setMsg unmarshals PatternFlowIpv4ReservedMetricTag from protobuf object *otg.PatternFlowIpv4ReservedMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4ReservedMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4ReservedMetricTag - // validate validates PatternFlowIpv4ReservedMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4ReservedMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4ReservedMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4ReservedMetricTag - SetName(value string) PatternFlowIpv4ReservedMetricTag - // Offset returns uint32, set in PatternFlowIpv4ReservedMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4ReservedMetricTag - SetOffset(value uint32) PatternFlowIpv4ReservedMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4ReservedMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4ReservedMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4ReservedMetricTag - SetLength(value uint32) PatternFlowIpv4ReservedMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4ReservedMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4ReservedMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4ReservedMetricTag object -func (obj *patternFlowIpv4ReservedMetricTag) SetName(value string) PatternFlowIpv4ReservedMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4ReservedMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4ReservedMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4ReservedMetricTag object -func (obj *patternFlowIpv4ReservedMetricTag) SetOffset(value uint32) PatternFlowIpv4ReservedMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4ReservedMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4ReservedMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4ReservedMetricTag object -func (obj *patternFlowIpv4ReservedMetricTag) SetLength(value uint32) PatternFlowIpv4ReservedMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4ReservedMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4ReservedMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4ReservedMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4ReservedMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4ReservedMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowIpv4DontFragmentCounter ***** -type patternFlowIpv4DontFragmentCounter struct { - validation - obj *otg.PatternFlowIpv4DontFragmentCounter - marshaller marshalPatternFlowIpv4DontFragmentCounter - unMarshaller unMarshalPatternFlowIpv4DontFragmentCounter -} - -func NewPatternFlowIpv4DontFragmentCounter() PatternFlowIpv4DontFragmentCounter { - obj := patternFlowIpv4DontFragmentCounter{obj: &otg.PatternFlowIpv4DontFragmentCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4DontFragmentCounter) msg() *otg.PatternFlowIpv4DontFragmentCounter { - return obj.obj -} - -func (obj *patternFlowIpv4DontFragmentCounter) setMsg(msg *otg.PatternFlowIpv4DontFragmentCounter) PatternFlowIpv4DontFragmentCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4DontFragmentCounter struct { - obj *patternFlowIpv4DontFragmentCounter -} - -type marshalPatternFlowIpv4DontFragmentCounter interface { - // ToProto marshals PatternFlowIpv4DontFragmentCounter to protobuf object *otg.PatternFlowIpv4DontFragmentCounter - ToProto() (*otg.PatternFlowIpv4DontFragmentCounter, error) - // ToPbText marshals PatternFlowIpv4DontFragmentCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4DontFragmentCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4DontFragmentCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4DontFragmentCounter struct { - obj *patternFlowIpv4DontFragmentCounter -} - -type unMarshalPatternFlowIpv4DontFragmentCounter interface { - // FromProto unmarshals PatternFlowIpv4DontFragmentCounter from protobuf object *otg.PatternFlowIpv4DontFragmentCounter - FromProto(msg *otg.PatternFlowIpv4DontFragmentCounter) (PatternFlowIpv4DontFragmentCounter, error) - // FromPbText unmarshals PatternFlowIpv4DontFragmentCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4DontFragmentCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4DontFragmentCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4DontFragmentCounter) Marshal() marshalPatternFlowIpv4DontFragmentCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4DontFragmentCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4DontFragmentCounter) Unmarshal() unMarshalPatternFlowIpv4DontFragmentCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4DontFragmentCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4DontFragmentCounter) ToProto() (*otg.PatternFlowIpv4DontFragmentCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4DontFragmentCounter) FromProto(msg *otg.PatternFlowIpv4DontFragmentCounter) (PatternFlowIpv4DontFragmentCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4DontFragmentCounter) 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 *unMarshalpatternFlowIpv4DontFragmentCounter) 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 *marshalpatternFlowIpv4DontFragmentCounter) 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 *unMarshalpatternFlowIpv4DontFragmentCounter) 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 *marshalpatternFlowIpv4DontFragmentCounter) 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 *unMarshalpatternFlowIpv4DontFragmentCounter) 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 *patternFlowIpv4DontFragmentCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DontFragmentCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DontFragmentCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4DontFragmentCounter) Clone() (PatternFlowIpv4DontFragmentCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4DontFragmentCounter() - 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 -} - -// PatternFlowIpv4DontFragmentCounter is integer counter pattern -type PatternFlowIpv4DontFragmentCounter interface { - Validation - // msg marshals PatternFlowIpv4DontFragmentCounter to protobuf object *otg.PatternFlowIpv4DontFragmentCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4DontFragmentCounter - // setMsg unmarshals PatternFlowIpv4DontFragmentCounter from protobuf object *otg.PatternFlowIpv4DontFragmentCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4DontFragmentCounter) PatternFlowIpv4DontFragmentCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4DontFragmentCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4DontFragmentCounter - // validate validates PatternFlowIpv4DontFragmentCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4DontFragmentCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4DontFragmentCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4DontFragmentCounter - SetStart(value uint32) PatternFlowIpv4DontFragmentCounter - // HasStart checks if Start has been set in PatternFlowIpv4DontFragmentCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4DontFragmentCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4DontFragmentCounter - SetStep(value uint32) PatternFlowIpv4DontFragmentCounter - // HasStep checks if Step has been set in PatternFlowIpv4DontFragmentCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4DontFragmentCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4DontFragmentCounter - SetCount(value uint32) PatternFlowIpv4DontFragmentCounter - // HasCount checks if Count has been set in PatternFlowIpv4DontFragmentCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4DontFragmentCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4DontFragmentCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4DontFragmentCounter object -func (obj *patternFlowIpv4DontFragmentCounter) SetStart(value uint32) PatternFlowIpv4DontFragmentCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4DontFragmentCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4DontFragmentCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4DontFragmentCounter object -func (obj *patternFlowIpv4DontFragmentCounter) SetStep(value uint32) PatternFlowIpv4DontFragmentCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4DontFragmentCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4DontFragmentCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4DontFragmentCounter object -func (obj *patternFlowIpv4DontFragmentCounter) SetCount(value uint32) PatternFlowIpv4DontFragmentCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4DontFragmentCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DontFragmentCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DontFragmentCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DontFragmentCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4DontFragmentCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4DontFragmentMetricTag ***** -type patternFlowIpv4DontFragmentMetricTag struct { - validation - obj *otg.PatternFlowIpv4DontFragmentMetricTag - marshaller marshalPatternFlowIpv4DontFragmentMetricTag - unMarshaller unMarshalPatternFlowIpv4DontFragmentMetricTag -} - -func NewPatternFlowIpv4DontFragmentMetricTag() PatternFlowIpv4DontFragmentMetricTag { - obj := patternFlowIpv4DontFragmentMetricTag{obj: &otg.PatternFlowIpv4DontFragmentMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4DontFragmentMetricTag) msg() *otg.PatternFlowIpv4DontFragmentMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4DontFragmentMetricTag) setMsg(msg *otg.PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4DontFragmentMetricTag struct { - obj *patternFlowIpv4DontFragmentMetricTag -} - -type marshalPatternFlowIpv4DontFragmentMetricTag interface { - // ToProto marshals PatternFlowIpv4DontFragmentMetricTag to protobuf object *otg.PatternFlowIpv4DontFragmentMetricTag - ToProto() (*otg.PatternFlowIpv4DontFragmentMetricTag, error) - // ToPbText marshals PatternFlowIpv4DontFragmentMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4DontFragmentMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4DontFragmentMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4DontFragmentMetricTag struct { - obj *patternFlowIpv4DontFragmentMetricTag -} - -type unMarshalPatternFlowIpv4DontFragmentMetricTag interface { - // FromProto unmarshals PatternFlowIpv4DontFragmentMetricTag from protobuf object *otg.PatternFlowIpv4DontFragmentMetricTag - FromProto(msg *otg.PatternFlowIpv4DontFragmentMetricTag) (PatternFlowIpv4DontFragmentMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4DontFragmentMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4DontFragmentMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4DontFragmentMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4DontFragmentMetricTag) Marshal() marshalPatternFlowIpv4DontFragmentMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4DontFragmentMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4DontFragmentMetricTag) Unmarshal() unMarshalPatternFlowIpv4DontFragmentMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4DontFragmentMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4DontFragmentMetricTag) ToProto() (*otg.PatternFlowIpv4DontFragmentMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4DontFragmentMetricTag) FromProto(msg *otg.PatternFlowIpv4DontFragmentMetricTag) (PatternFlowIpv4DontFragmentMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4DontFragmentMetricTag) 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 *unMarshalpatternFlowIpv4DontFragmentMetricTag) 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 *marshalpatternFlowIpv4DontFragmentMetricTag) 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 *unMarshalpatternFlowIpv4DontFragmentMetricTag) 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 *marshalpatternFlowIpv4DontFragmentMetricTag) 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 *unMarshalpatternFlowIpv4DontFragmentMetricTag) 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 *patternFlowIpv4DontFragmentMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DontFragmentMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DontFragmentMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4DontFragmentMetricTag) Clone() (PatternFlowIpv4DontFragmentMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4DontFragmentMetricTag() - 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 -} - -// PatternFlowIpv4DontFragmentMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4DontFragmentMetricTag interface { - Validation - // msg marshals PatternFlowIpv4DontFragmentMetricTag to protobuf object *otg.PatternFlowIpv4DontFragmentMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4DontFragmentMetricTag - // setMsg unmarshals PatternFlowIpv4DontFragmentMetricTag from protobuf object *otg.PatternFlowIpv4DontFragmentMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4DontFragmentMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4DontFragmentMetricTag - // validate validates PatternFlowIpv4DontFragmentMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4DontFragmentMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4DontFragmentMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4DontFragmentMetricTag - SetName(value string) PatternFlowIpv4DontFragmentMetricTag - // Offset returns uint32, set in PatternFlowIpv4DontFragmentMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4DontFragmentMetricTag - SetOffset(value uint32) PatternFlowIpv4DontFragmentMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4DontFragmentMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4DontFragmentMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4DontFragmentMetricTag - SetLength(value uint32) PatternFlowIpv4DontFragmentMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4DontFragmentMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4DontFragmentMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4DontFragmentMetricTag object -func (obj *patternFlowIpv4DontFragmentMetricTag) SetName(value string) PatternFlowIpv4DontFragmentMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4DontFragmentMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4DontFragmentMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4DontFragmentMetricTag object -func (obj *patternFlowIpv4DontFragmentMetricTag) SetOffset(value uint32) PatternFlowIpv4DontFragmentMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4DontFragmentMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4DontFragmentMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4DontFragmentMetricTag object -func (obj *patternFlowIpv4DontFragmentMetricTag) SetLength(value uint32) PatternFlowIpv4DontFragmentMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4DontFragmentMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4DontFragmentMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DontFragmentMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4DontFragmentMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4DontFragmentMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowIpv4MoreFragmentsCounter ***** -type patternFlowIpv4MoreFragmentsCounter struct { - validation - obj *otg.PatternFlowIpv4MoreFragmentsCounter - marshaller marshalPatternFlowIpv4MoreFragmentsCounter - unMarshaller unMarshalPatternFlowIpv4MoreFragmentsCounter -} - -func NewPatternFlowIpv4MoreFragmentsCounter() PatternFlowIpv4MoreFragmentsCounter { - obj := patternFlowIpv4MoreFragmentsCounter{obj: &otg.PatternFlowIpv4MoreFragmentsCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4MoreFragmentsCounter) msg() *otg.PatternFlowIpv4MoreFragmentsCounter { - return obj.obj -} - -func (obj *patternFlowIpv4MoreFragmentsCounter) setMsg(msg *otg.PatternFlowIpv4MoreFragmentsCounter) PatternFlowIpv4MoreFragmentsCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4MoreFragmentsCounter struct { - obj *patternFlowIpv4MoreFragmentsCounter -} - -type marshalPatternFlowIpv4MoreFragmentsCounter interface { - // ToProto marshals PatternFlowIpv4MoreFragmentsCounter to protobuf object *otg.PatternFlowIpv4MoreFragmentsCounter - ToProto() (*otg.PatternFlowIpv4MoreFragmentsCounter, error) - // ToPbText marshals PatternFlowIpv4MoreFragmentsCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4MoreFragmentsCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4MoreFragmentsCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4MoreFragmentsCounter struct { - obj *patternFlowIpv4MoreFragmentsCounter -} - -type unMarshalPatternFlowIpv4MoreFragmentsCounter interface { - // FromProto unmarshals PatternFlowIpv4MoreFragmentsCounter from protobuf object *otg.PatternFlowIpv4MoreFragmentsCounter - FromProto(msg *otg.PatternFlowIpv4MoreFragmentsCounter) (PatternFlowIpv4MoreFragmentsCounter, error) - // FromPbText unmarshals PatternFlowIpv4MoreFragmentsCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4MoreFragmentsCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4MoreFragmentsCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4MoreFragmentsCounter) Marshal() marshalPatternFlowIpv4MoreFragmentsCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4MoreFragmentsCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4MoreFragmentsCounter) Unmarshal() unMarshalPatternFlowIpv4MoreFragmentsCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4MoreFragmentsCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4MoreFragmentsCounter) ToProto() (*otg.PatternFlowIpv4MoreFragmentsCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4MoreFragmentsCounter) FromProto(msg *otg.PatternFlowIpv4MoreFragmentsCounter) (PatternFlowIpv4MoreFragmentsCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4MoreFragmentsCounter) 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 *unMarshalpatternFlowIpv4MoreFragmentsCounter) 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 *marshalpatternFlowIpv4MoreFragmentsCounter) 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 *unMarshalpatternFlowIpv4MoreFragmentsCounter) 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 *marshalpatternFlowIpv4MoreFragmentsCounter) 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 *unMarshalpatternFlowIpv4MoreFragmentsCounter) 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 *patternFlowIpv4MoreFragmentsCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4MoreFragmentsCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4MoreFragmentsCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4MoreFragmentsCounter) Clone() (PatternFlowIpv4MoreFragmentsCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4MoreFragmentsCounter() - 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 -} - -// PatternFlowIpv4MoreFragmentsCounter is integer counter pattern -type PatternFlowIpv4MoreFragmentsCounter interface { - Validation - // msg marshals PatternFlowIpv4MoreFragmentsCounter to protobuf object *otg.PatternFlowIpv4MoreFragmentsCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4MoreFragmentsCounter - // setMsg unmarshals PatternFlowIpv4MoreFragmentsCounter from protobuf object *otg.PatternFlowIpv4MoreFragmentsCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4MoreFragmentsCounter) PatternFlowIpv4MoreFragmentsCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4MoreFragmentsCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4MoreFragmentsCounter - // validate validates PatternFlowIpv4MoreFragmentsCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4MoreFragmentsCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4MoreFragmentsCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4MoreFragmentsCounter - SetStart(value uint32) PatternFlowIpv4MoreFragmentsCounter - // HasStart checks if Start has been set in PatternFlowIpv4MoreFragmentsCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4MoreFragmentsCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4MoreFragmentsCounter - SetStep(value uint32) PatternFlowIpv4MoreFragmentsCounter - // HasStep checks if Step has been set in PatternFlowIpv4MoreFragmentsCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4MoreFragmentsCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4MoreFragmentsCounter - SetCount(value uint32) PatternFlowIpv4MoreFragmentsCounter - // HasCount checks if Count has been set in PatternFlowIpv4MoreFragmentsCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4MoreFragmentsCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4MoreFragmentsCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4MoreFragmentsCounter object -func (obj *patternFlowIpv4MoreFragmentsCounter) SetStart(value uint32) PatternFlowIpv4MoreFragmentsCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4MoreFragmentsCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4MoreFragmentsCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4MoreFragmentsCounter object -func (obj *patternFlowIpv4MoreFragmentsCounter) SetStep(value uint32) PatternFlowIpv4MoreFragmentsCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4MoreFragmentsCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4MoreFragmentsCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4MoreFragmentsCounter object -func (obj *patternFlowIpv4MoreFragmentsCounter) SetCount(value uint32) PatternFlowIpv4MoreFragmentsCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4MoreFragmentsCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4MoreFragmentsCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4MoreFragmentsCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4MoreFragmentsCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4MoreFragmentsCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4MoreFragmentsMetricTag ***** -type patternFlowIpv4MoreFragmentsMetricTag struct { - validation - obj *otg.PatternFlowIpv4MoreFragmentsMetricTag - marshaller marshalPatternFlowIpv4MoreFragmentsMetricTag - unMarshaller unMarshalPatternFlowIpv4MoreFragmentsMetricTag -} - -func NewPatternFlowIpv4MoreFragmentsMetricTag() PatternFlowIpv4MoreFragmentsMetricTag { - obj := patternFlowIpv4MoreFragmentsMetricTag{obj: &otg.PatternFlowIpv4MoreFragmentsMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4MoreFragmentsMetricTag) msg() *otg.PatternFlowIpv4MoreFragmentsMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4MoreFragmentsMetricTag) setMsg(msg *otg.PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4MoreFragmentsMetricTag struct { - obj *patternFlowIpv4MoreFragmentsMetricTag -} - -type marshalPatternFlowIpv4MoreFragmentsMetricTag interface { - // ToProto marshals PatternFlowIpv4MoreFragmentsMetricTag to protobuf object *otg.PatternFlowIpv4MoreFragmentsMetricTag - ToProto() (*otg.PatternFlowIpv4MoreFragmentsMetricTag, error) - // ToPbText marshals PatternFlowIpv4MoreFragmentsMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4MoreFragmentsMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4MoreFragmentsMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4MoreFragmentsMetricTag struct { - obj *patternFlowIpv4MoreFragmentsMetricTag -} - -type unMarshalPatternFlowIpv4MoreFragmentsMetricTag interface { - // FromProto unmarshals PatternFlowIpv4MoreFragmentsMetricTag from protobuf object *otg.PatternFlowIpv4MoreFragmentsMetricTag - FromProto(msg *otg.PatternFlowIpv4MoreFragmentsMetricTag) (PatternFlowIpv4MoreFragmentsMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4MoreFragmentsMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4MoreFragmentsMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4MoreFragmentsMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4MoreFragmentsMetricTag) Marshal() marshalPatternFlowIpv4MoreFragmentsMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4MoreFragmentsMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4MoreFragmentsMetricTag) Unmarshal() unMarshalPatternFlowIpv4MoreFragmentsMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4MoreFragmentsMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4MoreFragmentsMetricTag) ToProto() (*otg.PatternFlowIpv4MoreFragmentsMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4MoreFragmentsMetricTag) FromProto(msg *otg.PatternFlowIpv4MoreFragmentsMetricTag) (PatternFlowIpv4MoreFragmentsMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4MoreFragmentsMetricTag) 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 *unMarshalpatternFlowIpv4MoreFragmentsMetricTag) 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 *marshalpatternFlowIpv4MoreFragmentsMetricTag) 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 *unMarshalpatternFlowIpv4MoreFragmentsMetricTag) 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 *marshalpatternFlowIpv4MoreFragmentsMetricTag) 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 *unMarshalpatternFlowIpv4MoreFragmentsMetricTag) 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 *patternFlowIpv4MoreFragmentsMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4MoreFragmentsMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4MoreFragmentsMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4MoreFragmentsMetricTag) Clone() (PatternFlowIpv4MoreFragmentsMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4MoreFragmentsMetricTag() - 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 -} - -// PatternFlowIpv4MoreFragmentsMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4MoreFragmentsMetricTag interface { - Validation - // msg marshals PatternFlowIpv4MoreFragmentsMetricTag to protobuf object *otg.PatternFlowIpv4MoreFragmentsMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4MoreFragmentsMetricTag - // setMsg unmarshals PatternFlowIpv4MoreFragmentsMetricTag from protobuf object *otg.PatternFlowIpv4MoreFragmentsMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4MoreFragmentsMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4MoreFragmentsMetricTag - // validate validates PatternFlowIpv4MoreFragmentsMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4MoreFragmentsMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4MoreFragmentsMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4MoreFragmentsMetricTag - SetName(value string) PatternFlowIpv4MoreFragmentsMetricTag - // Offset returns uint32, set in PatternFlowIpv4MoreFragmentsMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4MoreFragmentsMetricTag - SetOffset(value uint32) PatternFlowIpv4MoreFragmentsMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4MoreFragmentsMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4MoreFragmentsMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4MoreFragmentsMetricTag - SetLength(value uint32) PatternFlowIpv4MoreFragmentsMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4MoreFragmentsMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4MoreFragmentsMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4MoreFragmentsMetricTag object -func (obj *patternFlowIpv4MoreFragmentsMetricTag) SetName(value string) PatternFlowIpv4MoreFragmentsMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4MoreFragmentsMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4MoreFragmentsMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4MoreFragmentsMetricTag object -func (obj *patternFlowIpv4MoreFragmentsMetricTag) SetOffset(value uint32) PatternFlowIpv4MoreFragmentsMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4MoreFragmentsMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4MoreFragmentsMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4MoreFragmentsMetricTag object -func (obj *patternFlowIpv4MoreFragmentsMetricTag) SetLength(value uint32) PatternFlowIpv4MoreFragmentsMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4MoreFragmentsMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4MoreFragmentsMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4MoreFragmentsMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4MoreFragmentsMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4MoreFragmentsMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowIpv4FragmentOffsetCounter ***** -type patternFlowIpv4FragmentOffsetCounter struct { - validation - obj *otg.PatternFlowIpv4FragmentOffsetCounter - marshaller marshalPatternFlowIpv4FragmentOffsetCounter - unMarshaller unMarshalPatternFlowIpv4FragmentOffsetCounter -} - -func NewPatternFlowIpv4FragmentOffsetCounter() PatternFlowIpv4FragmentOffsetCounter { - obj := patternFlowIpv4FragmentOffsetCounter{obj: &otg.PatternFlowIpv4FragmentOffsetCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4FragmentOffsetCounter) msg() *otg.PatternFlowIpv4FragmentOffsetCounter { - return obj.obj -} - -func (obj *patternFlowIpv4FragmentOffsetCounter) setMsg(msg *otg.PatternFlowIpv4FragmentOffsetCounter) PatternFlowIpv4FragmentOffsetCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4FragmentOffsetCounter struct { - obj *patternFlowIpv4FragmentOffsetCounter -} - -type marshalPatternFlowIpv4FragmentOffsetCounter interface { - // ToProto marshals PatternFlowIpv4FragmentOffsetCounter to protobuf object *otg.PatternFlowIpv4FragmentOffsetCounter - ToProto() (*otg.PatternFlowIpv4FragmentOffsetCounter, error) - // ToPbText marshals PatternFlowIpv4FragmentOffsetCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4FragmentOffsetCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4FragmentOffsetCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4FragmentOffsetCounter struct { - obj *patternFlowIpv4FragmentOffsetCounter -} - -type unMarshalPatternFlowIpv4FragmentOffsetCounter interface { - // FromProto unmarshals PatternFlowIpv4FragmentOffsetCounter from protobuf object *otg.PatternFlowIpv4FragmentOffsetCounter - FromProto(msg *otg.PatternFlowIpv4FragmentOffsetCounter) (PatternFlowIpv4FragmentOffsetCounter, error) - // FromPbText unmarshals PatternFlowIpv4FragmentOffsetCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4FragmentOffsetCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4FragmentOffsetCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4FragmentOffsetCounter) Marshal() marshalPatternFlowIpv4FragmentOffsetCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4FragmentOffsetCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4FragmentOffsetCounter) Unmarshal() unMarshalPatternFlowIpv4FragmentOffsetCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4FragmentOffsetCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4FragmentOffsetCounter) ToProto() (*otg.PatternFlowIpv4FragmentOffsetCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4FragmentOffsetCounter) FromProto(msg *otg.PatternFlowIpv4FragmentOffsetCounter) (PatternFlowIpv4FragmentOffsetCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4FragmentOffsetCounter) 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 *unMarshalpatternFlowIpv4FragmentOffsetCounter) 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 *marshalpatternFlowIpv4FragmentOffsetCounter) 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 *unMarshalpatternFlowIpv4FragmentOffsetCounter) 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 *marshalpatternFlowIpv4FragmentOffsetCounter) 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 *unMarshalpatternFlowIpv4FragmentOffsetCounter) 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 *patternFlowIpv4FragmentOffsetCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4FragmentOffsetCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4FragmentOffsetCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4FragmentOffsetCounter) Clone() (PatternFlowIpv4FragmentOffsetCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4FragmentOffsetCounter() - 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 -} - -// PatternFlowIpv4FragmentOffsetCounter is integer counter pattern -type PatternFlowIpv4FragmentOffsetCounter interface { - Validation - // msg marshals PatternFlowIpv4FragmentOffsetCounter to protobuf object *otg.PatternFlowIpv4FragmentOffsetCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4FragmentOffsetCounter - // setMsg unmarshals PatternFlowIpv4FragmentOffsetCounter from protobuf object *otg.PatternFlowIpv4FragmentOffsetCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4FragmentOffsetCounter) PatternFlowIpv4FragmentOffsetCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4FragmentOffsetCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4FragmentOffsetCounter - // validate validates PatternFlowIpv4FragmentOffsetCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4FragmentOffsetCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4FragmentOffsetCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4FragmentOffsetCounter - SetStart(value uint32) PatternFlowIpv4FragmentOffsetCounter - // HasStart checks if Start has been set in PatternFlowIpv4FragmentOffsetCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4FragmentOffsetCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4FragmentOffsetCounter - SetStep(value uint32) PatternFlowIpv4FragmentOffsetCounter - // HasStep checks if Step has been set in PatternFlowIpv4FragmentOffsetCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4FragmentOffsetCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4FragmentOffsetCounter - SetCount(value uint32) PatternFlowIpv4FragmentOffsetCounter - // HasCount checks if Count has been set in PatternFlowIpv4FragmentOffsetCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4FragmentOffsetCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4FragmentOffsetCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4FragmentOffsetCounter object -func (obj *patternFlowIpv4FragmentOffsetCounter) SetStart(value uint32) PatternFlowIpv4FragmentOffsetCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4FragmentOffsetCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4FragmentOffsetCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4FragmentOffsetCounter object -func (obj *patternFlowIpv4FragmentOffsetCounter) SetStep(value uint32) PatternFlowIpv4FragmentOffsetCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4FragmentOffsetCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4FragmentOffsetCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4FragmentOffsetCounter object -func (obj *patternFlowIpv4FragmentOffsetCounter) SetCount(value uint32) PatternFlowIpv4FragmentOffsetCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4FragmentOffsetCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4FragmentOffsetCounter.Start <= 31 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4FragmentOffsetCounter.Step <= 31 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4FragmentOffsetCounter.Count <= 31 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4FragmentOffsetCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4FragmentOffsetMetricTag ***** -type patternFlowIpv4FragmentOffsetMetricTag struct { - validation - obj *otg.PatternFlowIpv4FragmentOffsetMetricTag - marshaller marshalPatternFlowIpv4FragmentOffsetMetricTag - unMarshaller unMarshalPatternFlowIpv4FragmentOffsetMetricTag -} - -func NewPatternFlowIpv4FragmentOffsetMetricTag() PatternFlowIpv4FragmentOffsetMetricTag { - obj := patternFlowIpv4FragmentOffsetMetricTag{obj: &otg.PatternFlowIpv4FragmentOffsetMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4FragmentOffsetMetricTag) msg() *otg.PatternFlowIpv4FragmentOffsetMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4FragmentOffsetMetricTag) setMsg(msg *otg.PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4FragmentOffsetMetricTag struct { - obj *patternFlowIpv4FragmentOffsetMetricTag -} - -type marshalPatternFlowIpv4FragmentOffsetMetricTag interface { - // ToProto marshals PatternFlowIpv4FragmentOffsetMetricTag to protobuf object *otg.PatternFlowIpv4FragmentOffsetMetricTag - ToProto() (*otg.PatternFlowIpv4FragmentOffsetMetricTag, error) - // ToPbText marshals PatternFlowIpv4FragmentOffsetMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4FragmentOffsetMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4FragmentOffsetMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4FragmentOffsetMetricTag struct { - obj *patternFlowIpv4FragmentOffsetMetricTag -} - -type unMarshalPatternFlowIpv4FragmentOffsetMetricTag interface { - // FromProto unmarshals PatternFlowIpv4FragmentOffsetMetricTag from protobuf object *otg.PatternFlowIpv4FragmentOffsetMetricTag - FromProto(msg *otg.PatternFlowIpv4FragmentOffsetMetricTag) (PatternFlowIpv4FragmentOffsetMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4FragmentOffsetMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4FragmentOffsetMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4FragmentOffsetMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4FragmentOffsetMetricTag) Marshal() marshalPatternFlowIpv4FragmentOffsetMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4FragmentOffsetMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4FragmentOffsetMetricTag) Unmarshal() unMarshalPatternFlowIpv4FragmentOffsetMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4FragmentOffsetMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4FragmentOffsetMetricTag) ToProto() (*otg.PatternFlowIpv4FragmentOffsetMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4FragmentOffsetMetricTag) FromProto(msg *otg.PatternFlowIpv4FragmentOffsetMetricTag) (PatternFlowIpv4FragmentOffsetMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4FragmentOffsetMetricTag) 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 *unMarshalpatternFlowIpv4FragmentOffsetMetricTag) 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 *marshalpatternFlowIpv4FragmentOffsetMetricTag) 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 *unMarshalpatternFlowIpv4FragmentOffsetMetricTag) 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 *marshalpatternFlowIpv4FragmentOffsetMetricTag) 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 *unMarshalpatternFlowIpv4FragmentOffsetMetricTag) 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 *patternFlowIpv4FragmentOffsetMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4FragmentOffsetMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4FragmentOffsetMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4FragmentOffsetMetricTag) Clone() (PatternFlowIpv4FragmentOffsetMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4FragmentOffsetMetricTag() - 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 -} - -// PatternFlowIpv4FragmentOffsetMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4FragmentOffsetMetricTag interface { - Validation - // msg marshals PatternFlowIpv4FragmentOffsetMetricTag to protobuf object *otg.PatternFlowIpv4FragmentOffsetMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4FragmentOffsetMetricTag - // setMsg unmarshals PatternFlowIpv4FragmentOffsetMetricTag from protobuf object *otg.PatternFlowIpv4FragmentOffsetMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4FragmentOffsetMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4FragmentOffsetMetricTag - // validate validates PatternFlowIpv4FragmentOffsetMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4FragmentOffsetMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4FragmentOffsetMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4FragmentOffsetMetricTag - SetName(value string) PatternFlowIpv4FragmentOffsetMetricTag - // Offset returns uint32, set in PatternFlowIpv4FragmentOffsetMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4FragmentOffsetMetricTag - SetOffset(value uint32) PatternFlowIpv4FragmentOffsetMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4FragmentOffsetMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4FragmentOffsetMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4FragmentOffsetMetricTag - SetLength(value uint32) PatternFlowIpv4FragmentOffsetMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4FragmentOffsetMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4FragmentOffsetMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4FragmentOffsetMetricTag object -func (obj *patternFlowIpv4FragmentOffsetMetricTag) SetName(value string) PatternFlowIpv4FragmentOffsetMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4FragmentOffsetMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4FragmentOffsetMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4FragmentOffsetMetricTag object -func (obj *patternFlowIpv4FragmentOffsetMetricTag) SetOffset(value uint32) PatternFlowIpv4FragmentOffsetMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4FragmentOffsetMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4FragmentOffsetMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4FragmentOffsetMetricTag object -func (obj *patternFlowIpv4FragmentOffsetMetricTag) SetLength(value uint32) PatternFlowIpv4FragmentOffsetMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4FragmentOffsetMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4FragmentOffsetMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 4 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4FragmentOffsetMetricTag.Offset <= 4 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 5 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4FragmentOffsetMetricTag.Length <= 5 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4FragmentOffsetMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(5) - } - -} - -// ***** PatternFlowIpv4TimeToLiveCounter ***** -type patternFlowIpv4TimeToLiveCounter struct { - validation - obj *otg.PatternFlowIpv4TimeToLiveCounter - marshaller marshalPatternFlowIpv4TimeToLiveCounter - unMarshaller unMarshalPatternFlowIpv4TimeToLiveCounter -} - -func NewPatternFlowIpv4TimeToLiveCounter() PatternFlowIpv4TimeToLiveCounter { - obj := patternFlowIpv4TimeToLiveCounter{obj: &otg.PatternFlowIpv4TimeToLiveCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TimeToLiveCounter) msg() *otg.PatternFlowIpv4TimeToLiveCounter { - return obj.obj -} - -func (obj *patternFlowIpv4TimeToLiveCounter) setMsg(msg *otg.PatternFlowIpv4TimeToLiveCounter) PatternFlowIpv4TimeToLiveCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TimeToLiveCounter struct { - obj *patternFlowIpv4TimeToLiveCounter -} - -type marshalPatternFlowIpv4TimeToLiveCounter interface { - // ToProto marshals PatternFlowIpv4TimeToLiveCounter to protobuf object *otg.PatternFlowIpv4TimeToLiveCounter - ToProto() (*otg.PatternFlowIpv4TimeToLiveCounter, error) - // ToPbText marshals PatternFlowIpv4TimeToLiveCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TimeToLiveCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TimeToLiveCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TimeToLiveCounter struct { - obj *patternFlowIpv4TimeToLiveCounter -} - -type unMarshalPatternFlowIpv4TimeToLiveCounter interface { - // FromProto unmarshals PatternFlowIpv4TimeToLiveCounter from protobuf object *otg.PatternFlowIpv4TimeToLiveCounter - FromProto(msg *otg.PatternFlowIpv4TimeToLiveCounter) (PatternFlowIpv4TimeToLiveCounter, error) - // FromPbText unmarshals PatternFlowIpv4TimeToLiveCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TimeToLiveCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TimeToLiveCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TimeToLiveCounter) Marshal() marshalPatternFlowIpv4TimeToLiveCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TimeToLiveCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TimeToLiveCounter) Unmarshal() unMarshalPatternFlowIpv4TimeToLiveCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TimeToLiveCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TimeToLiveCounter) ToProto() (*otg.PatternFlowIpv4TimeToLiveCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TimeToLiveCounter) FromProto(msg *otg.PatternFlowIpv4TimeToLiveCounter) (PatternFlowIpv4TimeToLiveCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TimeToLiveCounter) 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 *unMarshalpatternFlowIpv4TimeToLiveCounter) 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 *marshalpatternFlowIpv4TimeToLiveCounter) 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 *unMarshalpatternFlowIpv4TimeToLiveCounter) 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 *marshalpatternFlowIpv4TimeToLiveCounter) 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 *unMarshalpatternFlowIpv4TimeToLiveCounter) 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 *patternFlowIpv4TimeToLiveCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TimeToLiveCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TimeToLiveCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TimeToLiveCounter) Clone() (PatternFlowIpv4TimeToLiveCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TimeToLiveCounter() - 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 -} - -// PatternFlowIpv4TimeToLiveCounter is integer counter pattern -type PatternFlowIpv4TimeToLiveCounter interface { - Validation - // msg marshals PatternFlowIpv4TimeToLiveCounter to protobuf object *otg.PatternFlowIpv4TimeToLiveCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TimeToLiveCounter - // setMsg unmarshals PatternFlowIpv4TimeToLiveCounter from protobuf object *otg.PatternFlowIpv4TimeToLiveCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TimeToLiveCounter) PatternFlowIpv4TimeToLiveCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4TimeToLiveCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TimeToLiveCounter - // validate validates PatternFlowIpv4TimeToLiveCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TimeToLiveCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4TimeToLiveCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4TimeToLiveCounter - SetStart(value uint32) PatternFlowIpv4TimeToLiveCounter - // HasStart checks if Start has been set in PatternFlowIpv4TimeToLiveCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4TimeToLiveCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4TimeToLiveCounter - SetStep(value uint32) PatternFlowIpv4TimeToLiveCounter - // HasStep checks if Step has been set in PatternFlowIpv4TimeToLiveCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4TimeToLiveCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4TimeToLiveCounter - SetCount(value uint32) PatternFlowIpv4TimeToLiveCounter - // HasCount checks if Count has been set in PatternFlowIpv4TimeToLiveCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TimeToLiveCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TimeToLiveCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4TimeToLiveCounter object -func (obj *patternFlowIpv4TimeToLiveCounter) SetStart(value uint32) PatternFlowIpv4TimeToLiveCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TimeToLiveCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TimeToLiveCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4TimeToLiveCounter object -func (obj *patternFlowIpv4TimeToLiveCounter) SetStep(value uint32) PatternFlowIpv4TimeToLiveCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TimeToLiveCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TimeToLiveCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4TimeToLiveCounter object -func (obj *patternFlowIpv4TimeToLiveCounter) SetCount(value uint32) PatternFlowIpv4TimeToLiveCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4TimeToLiveCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TimeToLiveCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TimeToLiveCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TimeToLiveCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4TimeToLiveCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(64) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4TimeToLiveMetricTag ***** -type patternFlowIpv4TimeToLiveMetricTag struct { - validation - obj *otg.PatternFlowIpv4TimeToLiveMetricTag - marshaller marshalPatternFlowIpv4TimeToLiveMetricTag - unMarshaller unMarshalPatternFlowIpv4TimeToLiveMetricTag -} - -func NewPatternFlowIpv4TimeToLiveMetricTag() PatternFlowIpv4TimeToLiveMetricTag { - obj := patternFlowIpv4TimeToLiveMetricTag{obj: &otg.PatternFlowIpv4TimeToLiveMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TimeToLiveMetricTag) msg() *otg.PatternFlowIpv4TimeToLiveMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4TimeToLiveMetricTag) setMsg(msg *otg.PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLiveMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TimeToLiveMetricTag struct { - obj *patternFlowIpv4TimeToLiveMetricTag -} - -type marshalPatternFlowIpv4TimeToLiveMetricTag interface { - // ToProto marshals PatternFlowIpv4TimeToLiveMetricTag to protobuf object *otg.PatternFlowIpv4TimeToLiveMetricTag - ToProto() (*otg.PatternFlowIpv4TimeToLiveMetricTag, error) - // ToPbText marshals PatternFlowIpv4TimeToLiveMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TimeToLiveMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TimeToLiveMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TimeToLiveMetricTag struct { - obj *patternFlowIpv4TimeToLiveMetricTag -} - -type unMarshalPatternFlowIpv4TimeToLiveMetricTag interface { - // FromProto unmarshals PatternFlowIpv4TimeToLiveMetricTag from protobuf object *otg.PatternFlowIpv4TimeToLiveMetricTag - FromProto(msg *otg.PatternFlowIpv4TimeToLiveMetricTag) (PatternFlowIpv4TimeToLiveMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4TimeToLiveMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TimeToLiveMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TimeToLiveMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TimeToLiveMetricTag) Marshal() marshalPatternFlowIpv4TimeToLiveMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TimeToLiveMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TimeToLiveMetricTag) Unmarshal() unMarshalPatternFlowIpv4TimeToLiveMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TimeToLiveMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TimeToLiveMetricTag) ToProto() (*otg.PatternFlowIpv4TimeToLiveMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TimeToLiveMetricTag) FromProto(msg *otg.PatternFlowIpv4TimeToLiveMetricTag) (PatternFlowIpv4TimeToLiveMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TimeToLiveMetricTag) 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 *unMarshalpatternFlowIpv4TimeToLiveMetricTag) 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 *marshalpatternFlowIpv4TimeToLiveMetricTag) 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 *unMarshalpatternFlowIpv4TimeToLiveMetricTag) 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 *marshalpatternFlowIpv4TimeToLiveMetricTag) 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 *unMarshalpatternFlowIpv4TimeToLiveMetricTag) 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 *patternFlowIpv4TimeToLiveMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TimeToLiveMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TimeToLiveMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TimeToLiveMetricTag) Clone() (PatternFlowIpv4TimeToLiveMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TimeToLiveMetricTag() - 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 -} - -// PatternFlowIpv4TimeToLiveMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4TimeToLiveMetricTag interface { - Validation - // msg marshals PatternFlowIpv4TimeToLiveMetricTag to protobuf object *otg.PatternFlowIpv4TimeToLiveMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TimeToLiveMetricTag - // setMsg unmarshals PatternFlowIpv4TimeToLiveMetricTag from protobuf object *otg.PatternFlowIpv4TimeToLiveMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLiveMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4TimeToLiveMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TimeToLiveMetricTag - // validate validates PatternFlowIpv4TimeToLiveMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TimeToLiveMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4TimeToLiveMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4TimeToLiveMetricTag - SetName(value string) PatternFlowIpv4TimeToLiveMetricTag - // Offset returns uint32, set in PatternFlowIpv4TimeToLiveMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4TimeToLiveMetricTag - SetOffset(value uint32) PatternFlowIpv4TimeToLiveMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4TimeToLiveMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4TimeToLiveMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4TimeToLiveMetricTag - SetLength(value uint32) PatternFlowIpv4TimeToLiveMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4TimeToLiveMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4TimeToLiveMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4TimeToLiveMetricTag object -func (obj *patternFlowIpv4TimeToLiveMetricTag) SetName(value string) PatternFlowIpv4TimeToLiveMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TimeToLiveMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TimeToLiveMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4TimeToLiveMetricTag object -func (obj *patternFlowIpv4TimeToLiveMetricTag) SetOffset(value uint32) PatternFlowIpv4TimeToLiveMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TimeToLiveMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TimeToLiveMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4TimeToLiveMetricTag object -func (obj *patternFlowIpv4TimeToLiveMetricTag) SetLength(value uint32) PatternFlowIpv4TimeToLiveMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4TimeToLiveMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TimeToLiveMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TimeToLiveMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4TimeToLiveMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4TimeToLiveMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowIpv4ProtocolCounter ***** -type patternFlowIpv4ProtocolCounter struct { - validation - obj *otg.PatternFlowIpv4ProtocolCounter - marshaller marshalPatternFlowIpv4ProtocolCounter - unMarshaller unMarshalPatternFlowIpv4ProtocolCounter -} - -func NewPatternFlowIpv4ProtocolCounter() PatternFlowIpv4ProtocolCounter { - obj := patternFlowIpv4ProtocolCounter{obj: &otg.PatternFlowIpv4ProtocolCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4ProtocolCounter) msg() *otg.PatternFlowIpv4ProtocolCounter { - return obj.obj -} - -func (obj *patternFlowIpv4ProtocolCounter) setMsg(msg *otg.PatternFlowIpv4ProtocolCounter) PatternFlowIpv4ProtocolCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4ProtocolCounter struct { - obj *patternFlowIpv4ProtocolCounter -} - -type marshalPatternFlowIpv4ProtocolCounter interface { - // ToProto marshals PatternFlowIpv4ProtocolCounter to protobuf object *otg.PatternFlowIpv4ProtocolCounter - ToProto() (*otg.PatternFlowIpv4ProtocolCounter, error) - // ToPbText marshals PatternFlowIpv4ProtocolCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4ProtocolCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4ProtocolCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4ProtocolCounter struct { - obj *patternFlowIpv4ProtocolCounter -} - -type unMarshalPatternFlowIpv4ProtocolCounter interface { - // FromProto unmarshals PatternFlowIpv4ProtocolCounter from protobuf object *otg.PatternFlowIpv4ProtocolCounter - FromProto(msg *otg.PatternFlowIpv4ProtocolCounter) (PatternFlowIpv4ProtocolCounter, error) - // FromPbText unmarshals PatternFlowIpv4ProtocolCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4ProtocolCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4ProtocolCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4ProtocolCounter) Marshal() marshalPatternFlowIpv4ProtocolCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4ProtocolCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4ProtocolCounter) Unmarshal() unMarshalPatternFlowIpv4ProtocolCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4ProtocolCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4ProtocolCounter) ToProto() (*otg.PatternFlowIpv4ProtocolCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4ProtocolCounter) FromProto(msg *otg.PatternFlowIpv4ProtocolCounter) (PatternFlowIpv4ProtocolCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4ProtocolCounter) 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 *unMarshalpatternFlowIpv4ProtocolCounter) 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 *marshalpatternFlowIpv4ProtocolCounter) 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 *unMarshalpatternFlowIpv4ProtocolCounter) 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 *marshalpatternFlowIpv4ProtocolCounter) 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 *unMarshalpatternFlowIpv4ProtocolCounter) 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 *patternFlowIpv4ProtocolCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4ProtocolCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4ProtocolCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4ProtocolCounter) Clone() (PatternFlowIpv4ProtocolCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4ProtocolCounter() - 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 -} - -// PatternFlowIpv4ProtocolCounter is integer counter pattern -type PatternFlowIpv4ProtocolCounter interface { - Validation - // msg marshals PatternFlowIpv4ProtocolCounter to protobuf object *otg.PatternFlowIpv4ProtocolCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4ProtocolCounter - // setMsg unmarshals PatternFlowIpv4ProtocolCounter from protobuf object *otg.PatternFlowIpv4ProtocolCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4ProtocolCounter) PatternFlowIpv4ProtocolCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4ProtocolCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4ProtocolCounter - // validate validates PatternFlowIpv4ProtocolCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4ProtocolCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4ProtocolCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4ProtocolCounter - SetStart(value uint32) PatternFlowIpv4ProtocolCounter - // HasStart checks if Start has been set in PatternFlowIpv4ProtocolCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4ProtocolCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4ProtocolCounter - SetStep(value uint32) PatternFlowIpv4ProtocolCounter - // HasStep checks if Step has been set in PatternFlowIpv4ProtocolCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4ProtocolCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4ProtocolCounter - SetCount(value uint32) PatternFlowIpv4ProtocolCounter - // HasCount checks if Count has been set in PatternFlowIpv4ProtocolCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4ProtocolCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4ProtocolCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4ProtocolCounter object -func (obj *patternFlowIpv4ProtocolCounter) SetStart(value uint32) PatternFlowIpv4ProtocolCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4ProtocolCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4ProtocolCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4ProtocolCounter object -func (obj *patternFlowIpv4ProtocolCounter) SetStep(value uint32) PatternFlowIpv4ProtocolCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4ProtocolCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4ProtocolCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4ProtocolCounter object -func (obj *patternFlowIpv4ProtocolCounter) SetCount(value uint32) PatternFlowIpv4ProtocolCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4ProtocolCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4ProtocolCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4ProtocolCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4ProtocolCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4ProtocolCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(61) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4ProtocolMetricTag ***** -type patternFlowIpv4ProtocolMetricTag struct { - validation - obj *otg.PatternFlowIpv4ProtocolMetricTag - marshaller marshalPatternFlowIpv4ProtocolMetricTag - unMarshaller unMarshalPatternFlowIpv4ProtocolMetricTag -} - -func NewPatternFlowIpv4ProtocolMetricTag() PatternFlowIpv4ProtocolMetricTag { - obj := patternFlowIpv4ProtocolMetricTag{obj: &otg.PatternFlowIpv4ProtocolMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4ProtocolMetricTag) msg() *otg.PatternFlowIpv4ProtocolMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4ProtocolMetricTag) setMsg(msg *otg.PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4ProtocolMetricTag struct { - obj *patternFlowIpv4ProtocolMetricTag -} - -type marshalPatternFlowIpv4ProtocolMetricTag interface { - // ToProto marshals PatternFlowIpv4ProtocolMetricTag to protobuf object *otg.PatternFlowIpv4ProtocolMetricTag - ToProto() (*otg.PatternFlowIpv4ProtocolMetricTag, error) - // ToPbText marshals PatternFlowIpv4ProtocolMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4ProtocolMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4ProtocolMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4ProtocolMetricTag struct { - obj *patternFlowIpv4ProtocolMetricTag -} - -type unMarshalPatternFlowIpv4ProtocolMetricTag interface { - // FromProto unmarshals PatternFlowIpv4ProtocolMetricTag from protobuf object *otg.PatternFlowIpv4ProtocolMetricTag - FromProto(msg *otg.PatternFlowIpv4ProtocolMetricTag) (PatternFlowIpv4ProtocolMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4ProtocolMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4ProtocolMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4ProtocolMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4ProtocolMetricTag) Marshal() marshalPatternFlowIpv4ProtocolMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4ProtocolMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4ProtocolMetricTag) Unmarshal() unMarshalPatternFlowIpv4ProtocolMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4ProtocolMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4ProtocolMetricTag) ToProto() (*otg.PatternFlowIpv4ProtocolMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4ProtocolMetricTag) FromProto(msg *otg.PatternFlowIpv4ProtocolMetricTag) (PatternFlowIpv4ProtocolMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4ProtocolMetricTag) 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 *unMarshalpatternFlowIpv4ProtocolMetricTag) 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 *marshalpatternFlowIpv4ProtocolMetricTag) 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 *unMarshalpatternFlowIpv4ProtocolMetricTag) 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 *marshalpatternFlowIpv4ProtocolMetricTag) 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 *unMarshalpatternFlowIpv4ProtocolMetricTag) 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 *patternFlowIpv4ProtocolMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4ProtocolMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4ProtocolMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4ProtocolMetricTag) Clone() (PatternFlowIpv4ProtocolMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4ProtocolMetricTag() - 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 -} - -// PatternFlowIpv4ProtocolMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4ProtocolMetricTag interface { - Validation - // msg marshals PatternFlowIpv4ProtocolMetricTag to protobuf object *otg.PatternFlowIpv4ProtocolMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4ProtocolMetricTag - // setMsg unmarshals PatternFlowIpv4ProtocolMetricTag from protobuf object *otg.PatternFlowIpv4ProtocolMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4ProtocolMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4ProtocolMetricTag - // validate validates PatternFlowIpv4ProtocolMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4ProtocolMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4ProtocolMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4ProtocolMetricTag - SetName(value string) PatternFlowIpv4ProtocolMetricTag - // Offset returns uint32, set in PatternFlowIpv4ProtocolMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4ProtocolMetricTag - SetOffset(value uint32) PatternFlowIpv4ProtocolMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4ProtocolMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4ProtocolMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4ProtocolMetricTag - SetLength(value uint32) PatternFlowIpv4ProtocolMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4ProtocolMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4ProtocolMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4ProtocolMetricTag object -func (obj *patternFlowIpv4ProtocolMetricTag) SetName(value string) PatternFlowIpv4ProtocolMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4ProtocolMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4ProtocolMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4ProtocolMetricTag object -func (obj *patternFlowIpv4ProtocolMetricTag) SetOffset(value uint32) PatternFlowIpv4ProtocolMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4ProtocolMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4ProtocolMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4ProtocolMetricTag object -func (obj *patternFlowIpv4ProtocolMetricTag) SetLength(value uint32) PatternFlowIpv4ProtocolMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4ProtocolMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4ProtocolMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4ProtocolMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4ProtocolMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4ProtocolMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowIpv4SrcCounter ***** -type patternFlowIpv4SrcCounter struct { - validation - obj *otg.PatternFlowIpv4SrcCounter - marshaller marshalPatternFlowIpv4SrcCounter - unMarshaller unMarshalPatternFlowIpv4SrcCounter -} - -func NewPatternFlowIpv4SrcCounter() PatternFlowIpv4SrcCounter { - obj := patternFlowIpv4SrcCounter{obj: &otg.PatternFlowIpv4SrcCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4SrcCounter) msg() *otg.PatternFlowIpv4SrcCounter { - return obj.obj -} - -func (obj *patternFlowIpv4SrcCounter) setMsg(msg *otg.PatternFlowIpv4SrcCounter) PatternFlowIpv4SrcCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4SrcCounter struct { - obj *patternFlowIpv4SrcCounter -} - -type marshalPatternFlowIpv4SrcCounter interface { - // ToProto marshals PatternFlowIpv4SrcCounter to protobuf object *otg.PatternFlowIpv4SrcCounter - ToProto() (*otg.PatternFlowIpv4SrcCounter, error) - // ToPbText marshals PatternFlowIpv4SrcCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4SrcCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4SrcCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4SrcCounter struct { - obj *patternFlowIpv4SrcCounter -} - -type unMarshalPatternFlowIpv4SrcCounter interface { - // FromProto unmarshals PatternFlowIpv4SrcCounter from protobuf object *otg.PatternFlowIpv4SrcCounter - FromProto(msg *otg.PatternFlowIpv4SrcCounter) (PatternFlowIpv4SrcCounter, error) - // FromPbText unmarshals PatternFlowIpv4SrcCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4SrcCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4SrcCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4SrcCounter) Marshal() marshalPatternFlowIpv4SrcCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4SrcCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4SrcCounter) Unmarshal() unMarshalPatternFlowIpv4SrcCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4SrcCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4SrcCounter) ToProto() (*otg.PatternFlowIpv4SrcCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4SrcCounter) FromProto(msg *otg.PatternFlowIpv4SrcCounter) (PatternFlowIpv4SrcCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4SrcCounter) 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 *unMarshalpatternFlowIpv4SrcCounter) 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 *marshalpatternFlowIpv4SrcCounter) 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 *unMarshalpatternFlowIpv4SrcCounter) 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 *marshalpatternFlowIpv4SrcCounter) 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 *unMarshalpatternFlowIpv4SrcCounter) 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 *patternFlowIpv4SrcCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4SrcCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4SrcCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4SrcCounter) Clone() (PatternFlowIpv4SrcCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4SrcCounter() - 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 -} - -// PatternFlowIpv4SrcCounter is ipv4 counter pattern -type PatternFlowIpv4SrcCounter interface { - Validation - // msg marshals PatternFlowIpv4SrcCounter to protobuf object *otg.PatternFlowIpv4SrcCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4SrcCounter - // setMsg unmarshals PatternFlowIpv4SrcCounter from protobuf object *otg.PatternFlowIpv4SrcCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4SrcCounter) PatternFlowIpv4SrcCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4SrcCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4SrcCounter - // validate validates PatternFlowIpv4SrcCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4SrcCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowIpv4SrcCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowIpv4SrcCounter - SetStart(value string) PatternFlowIpv4SrcCounter - // HasStart checks if Start has been set in PatternFlowIpv4SrcCounter - HasStart() bool - // Step returns string, set in PatternFlowIpv4SrcCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowIpv4SrcCounter - SetStep(value string) PatternFlowIpv4SrcCounter - // HasStep checks if Step has been set in PatternFlowIpv4SrcCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4SrcCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4SrcCounter - SetCount(value uint32) PatternFlowIpv4SrcCounter - // HasCount checks if Count has been set in PatternFlowIpv4SrcCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowIpv4SrcCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowIpv4SrcCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowIpv4SrcCounter object -func (obj *patternFlowIpv4SrcCounter) SetStart(value string) PatternFlowIpv4SrcCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowIpv4SrcCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowIpv4SrcCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowIpv4SrcCounter object -func (obj *patternFlowIpv4SrcCounter) SetStep(value string) PatternFlowIpv4SrcCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4SrcCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4SrcCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4SrcCounter object -func (obj *patternFlowIpv4SrcCounter) SetCount(value uint32) PatternFlowIpv4SrcCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4SrcCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateIpv4(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4SrcCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateIpv4(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4SrcCounter.Step")) - } - - } - -} - -func (obj *patternFlowIpv4SrcCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("0.0.0.0") - } - if obj.obj.Step == nil { - obj.SetStep("0.0.0.1") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4SrcMetricTag ***** -type patternFlowIpv4SrcMetricTag struct { - validation - obj *otg.PatternFlowIpv4SrcMetricTag - marshaller marshalPatternFlowIpv4SrcMetricTag - unMarshaller unMarshalPatternFlowIpv4SrcMetricTag -} - -func NewPatternFlowIpv4SrcMetricTag() PatternFlowIpv4SrcMetricTag { - obj := patternFlowIpv4SrcMetricTag{obj: &otg.PatternFlowIpv4SrcMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4SrcMetricTag) msg() *otg.PatternFlowIpv4SrcMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4SrcMetricTag) setMsg(msg *otg.PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4SrcMetricTag struct { - obj *patternFlowIpv4SrcMetricTag -} - -type marshalPatternFlowIpv4SrcMetricTag interface { - // ToProto marshals PatternFlowIpv4SrcMetricTag to protobuf object *otg.PatternFlowIpv4SrcMetricTag - ToProto() (*otg.PatternFlowIpv4SrcMetricTag, error) - // ToPbText marshals PatternFlowIpv4SrcMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4SrcMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4SrcMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4SrcMetricTag struct { - obj *patternFlowIpv4SrcMetricTag -} - -type unMarshalPatternFlowIpv4SrcMetricTag interface { - // FromProto unmarshals PatternFlowIpv4SrcMetricTag from protobuf object *otg.PatternFlowIpv4SrcMetricTag - FromProto(msg *otg.PatternFlowIpv4SrcMetricTag) (PatternFlowIpv4SrcMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4SrcMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4SrcMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4SrcMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4SrcMetricTag) Marshal() marshalPatternFlowIpv4SrcMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4SrcMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4SrcMetricTag) Unmarshal() unMarshalPatternFlowIpv4SrcMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4SrcMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4SrcMetricTag) ToProto() (*otg.PatternFlowIpv4SrcMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4SrcMetricTag) FromProto(msg *otg.PatternFlowIpv4SrcMetricTag) (PatternFlowIpv4SrcMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4SrcMetricTag) 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 *unMarshalpatternFlowIpv4SrcMetricTag) 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 *marshalpatternFlowIpv4SrcMetricTag) 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 *unMarshalpatternFlowIpv4SrcMetricTag) 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 *marshalpatternFlowIpv4SrcMetricTag) 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 *unMarshalpatternFlowIpv4SrcMetricTag) 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 *patternFlowIpv4SrcMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4SrcMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4SrcMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4SrcMetricTag) Clone() (PatternFlowIpv4SrcMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4SrcMetricTag() - 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 -} - -// PatternFlowIpv4SrcMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4SrcMetricTag interface { - Validation - // msg marshals PatternFlowIpv4SrcMetricTag to protobuf object *otg.PatternFlowIpv4SrcMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4SrcMetricTag - // setMsg unmarshals PatternFlowIpv4SrcMetricTag from protobuf object *otg.PatternFlowIpv4SrcMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4SrcMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4SrcMetricTag - // validate validates PatternFlowIpv4SrcMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4SrcMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4SrcMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4SrcMetricTag - SetName(value string) PatternFlowIpv4SrcMetricTag - // Offset returns uint32, set in PatternFlowIpv4SrcMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4SrcMetricTag - SetOffset(value uint32) PatternFlowIpv4SrcMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4SrcMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4SrcMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4SrcMetricTag - SetLength(value uint32) PatternFlowIpv4SrcMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4SrcMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4SrcMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4SrcMetricTag object -func (obj *patternFlowIpv4SrcMetricTag) SetName(value string) PatternFlowIpv4SrcMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4SrcMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4SrcMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4SrcMetricTag object -func (obj *patternFlowIpv4SrcMetricTag) SetOffset(value uint32) PatternFlowIpv4SrcMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4SrcMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4SrcMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4SrcMetricTag object -func (obj *patternFlowIpv4SrcMetricTag) SetLength(value uint32) PatternFlowIpv4SrcMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4SrcMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4SrcMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4SrcMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4SrcMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4SrcMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(32) - } - -} - -// ***** FlowIpv4Auto ***** -type flowIpv4Auto struct { - validation - obj *otg.FlowIpv4Auto - marshaller marshalFlowIpv4Auto - unMarshaller unMarshalFlowIpv4Auto -} - -func NewFlowIpv4Auto() FlowIpv4Auto { - obj := flowIpv4Auto{obj: &otg.FlowIpv4Auto{}} - obj.setDefault() - return &obj -} - -func (obj *flowIpv4Auto) msg() *otg.FlowIpv4Auto { - return obj.obj -} - -func (obj *flowIpv4Auto) setMsg(msg *otg.FlowIpv4Auto) FlowIpv4Auto { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIpv4Auto struct { - obj *flowIpv4Auto -} - -type marshalFlowIpv4Auto interface { - // ToProto marshals FlowIpv4Auto to protobuf object *otg.FlowIpv4Auto - ToProto() (*otg.FlowIpv4Auto, error) - // ToPbText marshals FlowIpv4Auto to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIpv4Auto to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIpv4Auto to JSON text - ToJson() (string, error) -} - -type unMarshalflowIpv4Auto struct { - obj *flowIpv4Auto -} - -type unMarshalFlowIpv4Auto interface { - // FromProto unmarshals FlowIpv4Auto from protobuf object *otg.FlowIpv4Auto - FromProto(msg *otg.FlowIpv4Auto) (FlowIpv4Auto, error) - // FromPbText unmarshals FlowIpv4Auto from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIpv4Auto from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIpv4Auto from JSON text - FromJson(value string) error -} - -func (obj *flowIpv4Auto) Marshal() marshalFlowIpv4Auto { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIpv4Auto{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIpv4Auto) Unmarshal() unMarshalFlowIpv4Auto { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIpv4Auto{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIpv4Auto) ToProto() (*otg.FlowIpv4Auto, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIpv4Auto) FromProto(msg *otg.FlowIpv4Auto) (FlowIpv4Auto, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIpv4Auto) 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 *unMarshalflowIpv4Auto) 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 *marshalflowIpv4Auto) 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 *unMarshalflowIpv4Auto) 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 *marshalflowIpv4Auto) 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 *unMarshalflowIpv4Auto) 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 *flowIpv4Auto) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIpv4Auto) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIpv4Auto) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIpv4Auto) Clone() (FlowIpv4Auto, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIpv4Auto() - 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 -} - -// FlowIpv4Auto is the OTG implementation can provide a system generated, value for this property. -type FlowIpv4Auto interface { - Validation - // msg marshals FlowIpv4Auto to protobuf object *otg.FlowIpv4Auto - // and doesn't set defaults - msg() *otg.FlowIpv4Auto - // setMsg unmarshals FlowIpv4Auto from protobuf object *otg.FlowIpv4Auto - // and doesn't set defaults - setMsg(*otg.FlowIpv4Auto) FlowIpv4Auto - // provides marshal interface - Marshal() marshalFlowIpv4Auto - // provides unmarshal interface - Unmarshal() unMarshalFlowIpv4Auto - // validate validates FlowIpv4Auto - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIpv4Auto, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowIpv4AutoChoiceEnum, set in FlowIpv4Auto - Choice() FlowIpv4AutoChoiceEnum - // setChoice assigns FlowIpv4AutoChoiceEnum provided by user to FlowIpv4Auto - setChoice(value FlowIpv4AutoChoiceEnum) FlowIpv4Auto - // getter for Dhcp to set choice. - Dhcp() -} - -type FlowIpv4AutoChoiceEnum string - -// Enum of Choice on FlowIpv4Auto -var FlowIpv4AutoChoice = struct { - DHCP FlowIpv4AutoChoiceEnum -}{ - DHCP: FlowIpv4AutoChoiceEnum("dhcp"), -} - -func (obj *flowIpv4Auto) Choice() FlowIpv4AutoChoiceEnum { - return FlowIpv4AutoChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// getter for Dhcp to set choice -func (obj *flowIpv4Auto) Dhcp() { - obj.setChoice(FlowIpv4AutoChoice.DHCP) -} - -func (obj *flowIpv4Auto) setChoice(value FlowIpv4AutoChoiceEnum) FlowIpv4Auto { - intValue, ok := otg.FlowIpv4Auto_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowIpv4AutoChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowIpv4Auto_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - - return obj -} - -func (obj *flowIpv4Auto) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface FlowIpv4Auto") - } -} - -func (obj *flowIpv4Auto) setDefault() { - var choices_set int = 0 - var choice FlowIpv4AutoChoiceEnum - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowIpv4Auto") - } - } else { - intVal := otg.FlowIpv4Auto_Choice_Enum_value[string(choice)] - enumValue := otg.FlowIpv4Auto_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4SrcRandom ***** -type patternFlowIpv4SrcRandom struct { - validation - obj *otg.PatternFlowIpv4SrcRandom - marshaller marshalPatternFlowIpv4SrcRandom - unMarshaller unMarshalPatternFlowIpv4SrcRandom -} - -func NewPatternFlowIpv4SrcRandom() PatternFlowIpv4SrcRandom { - obj := patternFlowIpv4SrcRandom{obj: &otg.PatternFlowIpv4SrcRandom{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4SrcRandom) msg() *otg.PatternFlowIpv4SrcRandom { - return obj.obj -} - -func (obj *patternFlowIpv4SrcRandom) setMsg(msg *otg.PatternFlowIpv4SrcRandom) PatternFlowIpv4SrcRandom { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4SrcRandom struct { - obj *patternFlowIpv4SrcRandom -} - -type marshalPatternFlowIpv4SrcRandom interface { - // ToProto marshals PatternFlowIpv4SrcRandom to protobuf object *otg.PatternFlowIpv4SrcRandom - ToProto() (*otg.PatternFlowIpv4SrcRandom, error) - // ToPbText marshals PatternFlowIpv4SrcRandom to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4SrcRandom to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4SrcRandom to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4SrcRandom struct { - obj *patternFlowIpv4SrcRandom -} - -type unMarshalPatternFlowIpv4SrcRandom interface { - // FromProto unmarshals PatternFlowIpv4SrcRandom from protobuf object *otg.PatternFlowIpv4SrcRandom - FromProto(msg *otg.PatternFlowIpv4SrcRandom) (PatternFlowIpv4SrcRandom, error) - // FromPbText unmarshals PatternFlowIpv4SrcRandom from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4SrcRandom from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4SrcRandom from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4SrcRandom) Marshal() marshalPatternFlowIpv4SrcRandom { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4SrcRandom{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4SrcRandom) Unmarshal() unMarshalPatternFlowIpv4SrcRandom { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4SrcRandom{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4SrcRandom) ToProto() (*otg.PatternFlowIpv4SrcRandom, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4SrcRandom) FromProto(msg *otg.PatternFlowIpv4SrcRandom) (PatternFlowIpv4SrcRandom, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4SrcRandom) 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 *unMarshalpatternFlowIpv4SrcRandom) 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 *marshalpatternFlowIpv4SrcRandom) 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 *unMarshalpatternFlowIpv4SrcRandom) 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 *marshalpatternFlowIpv4SrcRandom) 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 *unMarshalpatternFlowIpv4SrcRandom) 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 *patternFlowIpv4SrcRandom) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4SrcRandom) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4SrcRandom) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4SrcRandom) Clone() (PatternFlowIpv4SrcRandom, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4SrcRandom() - 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 -} - -// PatternFlowIpv4SrcRandom is ipv4 random pattern -type PatternFlowIpv4SrcRandom interface { - Validation - // msg marshals PatternFlowIpv4SrcRandom to protobuf object *otg.PatternFlowIpv4SrcRandom - // and doesn't set defaults - msg() *otg.PatternFlowIpv4SrcRandom - // setMsg unmarshals PatternFlowIpv4SrcRandom from protobuf object *otg.PatternFlowIpv4SrcRandom - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4SrcRandom) PatternFlowIpv4SrcRandom - // provides marshal interface - Marshal() marshalPatternFlowIpv4SrcRandom - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4SrcRandom - // validate validates PatternFlowIpv4SrcRandom - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4SrcRandom, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Min returns string, set in PatternFlowIpv4SrcRandom. - Min() string - // SetMin assigns string provided by user to PatternFlowIpv4SrcRandom - SetMin(value string) PatternFlowIpv4SrcRandom - // HasMin checks if Min has been set in PatternFlowIpv4SrcRandom - HasMin() bool - // Max returns string, set in PatternFlowIpv4SrcRandom. - Max() string - // SetMax assigns string provided by user to PatternFlowIpv4SrcRandom - SetMax(value string) PatternFlowIpv4SrcRandom - // HasMax checks if Max has been set in PatternFlowIpv4SrcRandom - HasMax() bool - // Seed returns uint32, set in PatternFlowIpv4SrcRandom. - Seed() uint32 - // SetSeed assigns uint32 provided by user to PatternFlowIpv4SrcRandom - SetSeed(value uint32) PatternFlowIpv4SrcRandom - // HasSeed checks if Seed has been set in PatternFlowIpv4SrcRandom - HasSeed() bool - // Count returns uint32, set in PatternFlowIpv4SrcRandom. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4SrcRandom - SetCount(value uint32) PatternFlowIpv4SrcRandom - // HasCount checks if Count has been set in PatternFlowIpv4SrcRandom - HasCount() bool -} - -// The minimum possible value generated by the random value generator. -// Min returns a string -func (obj *patternFlowIpv4SrcRandom) Min() string { - - return *obj.obj.Min - -} - -// The minimum possible value generated by the random value generator. -// Min returns a string -func (obj *patternFlowIpv4SrcRandom) HasMin() bool { - return obj.obj.Min != nil -} - -// The minimum possible value generated by the random value generator. -// SetMin sets the string value in the PatternFlowIpv4SrcRandom object -func (obj *patternFlowIpv4SrcRandom) SetMin(value string) PatternFlowIpv4SrcRandom { - - obj.obj.Min = &value - return obj -} - -// The maximum possible value generated by the random value generator. -// Max returns a string -func (obj *patternFlowIpv4SrcRandom) Max() string { - - return *obj.obj.Max - -} - -// The maximum possible value generated by the random value generator. -// Max returns a string -func (obj *patternFlowIpv4SrcRandom) HasMax() bool { - return obj.obj.Max != nil -} - -// The maximum possible value generated by the random value generator. -// SetMax sets the string value in the PatternFlowIpv4SrcRandom object -func (obj *patternFlowIpv4SrcRandom) SetMax(value string) PatternFlowIpv4SrcRandom { - - obj.obj.Max = &value - return obj -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// Seed returns a uint32 -func (obj *patternFlowIpv4SrcRandom) Seed() uint32 { - - return *obj.obj.Seed - -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// Seed returns a uint32 -func (obj *patternFlowIpv4SrcRandom) HasSeed() bool { - return obj.obj.Seed != nil -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// SetSeed sets the uint32 value in the PatternFlowIpv4SrcRandom object -func (obj *patternFlowIpv4SrcRandom) SetSeed(value uint32) PatternFlowIpv4SrcRandom { - - obj.obj.Seed = &value - return obj -} - -// The total number of values to be generated by the random value generator. -// Count returns a uint32 -func (obj *patternFlowIpv4SrcRandom) Count() uint32 { - - return *obj.obj.Count - -} - -// The total number of values to be generated by the random value generator. -// Count returns a uint32 -func (obj *patternFlowIpv4SrcRandom) HasCount() bool { - return obj.obj.Count != nil -} - -// The total number of values to be generated by the random value generator. -// SetCount sets the uint32 value in the PatternFlowIpv4SrcRandom object -func (obj *patternFlowIpv4SrcRandom) SetCount(value uint32) PatternFlowIpv4SrcRandom { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4SrcRandom) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Min != nil { - - err := obj.validateIpv4(obj.Min()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4SrcRandom.Min")) - } - - } - - if obj.obj.Max != nil { - - err := obj.validateIpv4(obj.Max()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4SrcRandom.Max")) - } - - } - -} - -func (obj *patternFlowIpv4SrcRandom) setDefault() { - if obj.obj.Min == nil { - obj.SetMin("0.0.0.0") - } - if obj.obj.Max == nil { - obj.SetMax("255.255.255.255") - } - if obj.obj.Seed == nil { - obj.SetSeed(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4DstCounter ***** -type patternFlowIpv4DstCounter struct { - validation - obj *otg.PatternFlowIpv4DstCounter - marshaller marshalPatternFlowIpv4DstCounter - unMarshaller unMarshalPatternFlowIpv4DstCounter -} - -func NewPatternFlowIpv4DstCounter() PatternFlowIpv4DstCounter { - obj := patternFlowIpv4DstCounter{obj: &otg.PatternFlowIpv4DstCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4DstCounter) msg() *otg.PatternFlowIpv4DstCounter { - return obj.obj -} - -func (obj *patternFlowIpv4DstCounter) setMsg(msg *otg.PatternFlowIpv4DstCounter) PatternFlowIpv4DstCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4DstCounter struct { - obj *patternFlowIpv4DstCounter -} - -type marshalPatternFlowIpv4DstCounter interface { - // ToProto marshals PatternFlowIpv4DstCounter to protobuf object *otg.PatternFlowIpv4DstCounter - ToProto() (*otg.PatternFlowIpv4DstCounter, error) - // ToPbText marshals PatternFlowIpv4DstCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4DstCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4DstCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4DstCounter struct { - obj *patternFlowIpv4DstCounter -} - -type unMarshalPatternFlowIpv4DstCounter interface { - // FromProto unmarshals PatternFlowIpv4DstCounter from protobuf object *otg.PatternFlowIpv4DstCounter - FromProto(msg *otg.PatternFlowIpv4DstCounter) (PatternFlowIpv4DstCounter, error) - // FromPbText unmarshals PatternFlowIpv4DstCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4DstCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4DstCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4DstCounter) Marshal() marshalPatternFlowIpv4DstCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4DstCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4DstCounter) Unmarshal() unMarshalPatternFlowIpv4DstCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4DstCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4DstCounter) ToProto() (*otg.PatternFlowIpv4DstCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4DstCounter) FromProto(msg *otg.PatternFlowIpv4DstCounter) (PatternFlowIpv4DstCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4DstCounter) 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 *unMarshalpatternFlowIpv4DstCounter) 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 *marshalpatternFlowIpv4DstCounter) 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 *unMarshalpatternFlowIpv4DstCounter) 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 *marshalpatternFlowIpv4DstCounter) 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 *unMarshalpatternFlowIpv4DstCounter) 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 *patternFlowIpv4DstCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DstCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DstCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4DstCounter) Clone() (PatternFlowIpv4DstCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4DstCounter() - 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 -} - -// PatternFlowIpv4DstCounter is ipv4 counter pattern -type PatternFlowIpv4DstCounter interface { - Validation - // msg marshals PatternFlowIpv4DstCounter to protobuf object *otg.PatternFlowIpv4DstCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4DstCounter - // setMsg unmarshals PatternFlowIpv4DstCounter from protobuf object *otg.PatternFlowIpv4DstCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4DstCounter) PatternFlowIpv4DstCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4DstCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4DstCounter - // validate validates PatternFlowIpv4DstCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4DstCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowIpv4DstCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowIpv4DstCounter - SetStart(value string) PatternFlowIpv4DstCounter - // HasStart checks if Start has been set in PatternFlowIpv4DstCounter - HasStart() bool - // Step returns string, set in PatternFlowIpv4DstCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowIpv4DstCounter - SetStep(value string) PatternFlowIpv4DstCounter - // HasStep checks if Step has been set in PatternFlowIpv4DstCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4DstCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4DstCounter - SetCount(value uint32) PatternFlowIpv4DstCounter - // HasCount checks if Count has been set in PatternFlowIpv4DstCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowIpv4DstCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowIpv4DstCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowIpv4DstCounter object -func (obj *patternFlowIpv4DstCounter) SetStart(value string) PatternFlowIpv4DstCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowIpv4DstCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowIpv4DstCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowIpv4DstCounter object -func (obj *patternFlowIpv4DstCounter) SetStep(value string) PatternFlowIpv4DstCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4DstCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4DstCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4DstCounter object -func (obj *patternFlowIpv4DstCounter) SetCount(value uint32) PatternFlowIpv4DstCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4DstCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateIpv4(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4DstCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateIpv4(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4DstCounter.Step")) - } - - } - -} - -func (obj *patternFlowIpv4DstCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("0.0.0.0") - } - if obj.obj.Step == nil { - obj.SetStep("0.0.0.1") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4DstMetricTag ***** -type patternFlowIpv4DstMetricTag struct { - validation - obj *otg.PatternFlowIpv4DstMetricTag - marshaller marshalPatternFlowIpv4DstMetricTag - unMarshaller unMarshalPatternFlowIpv4DstMetricTag -} - -func NewPatternFlowIpv4DstMetricTag() PatternFlowIpv4DstMetricTag { - obj := patternFlowIpv4DstMetricTag{obj: &otg.PatternFlowIpv4DstMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4DstMetricTag) msg() *otg.PatternFlowIpv4DstMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4DstMetricTag) setMsg(msg *otg.PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4DstMetricTag struct { - obj *patternFlowIpv4DstMetricTag -} - -type marshalPatternFlowIpv4DstMetricTag interface { - // ToProto marshals PatternFlowIpv4DstMetricTag to protobuf object *otg.PatternFlowIpv4DstMetricTag - ToProto() (*otg.PatternFlowIpv4DstMetricTag, error) - // ToPbText marshals PatternFlowIpv4DstMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4DstMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4DstMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4DstMetricTag struct { - obj *patternFlowIpv4DstMetricTag -} - -type unMarshalPatternFlowIpv4DstMetricTag interface { - // FromProto unmarshals PatternFlowIpv4DstMetricTag from protobuf object *otg.PatternFlowIpv4DstMetricTag - FromProto(msg *otg.PatternFlowIpv4DstMetricTag) (PatternFlowIpv4DstMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4DstMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4DstMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4DstMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4DstMetricTag) Marshal() marshalPatternFlowIpv4DstMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4DstMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4DstMetricTag) Unmarshal() unMarshalPatternFlowIpv4DstMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4DstMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4DstMetricTag) ToProto() (*otg.PatternFlowIpv4DstMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4DstMetricTag) FromProto(msg *otg.PatternFlowIpv4DstMetricTag) (PatternFlowIpv4DstMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4DstMetricTag) 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 *unMarshalpatternFlowIpv4DstMetricTag) 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 *marshalpatternFlowIpv4DstMetricTag) 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 *unMarshalpatternFlowIpv4DstMetricTag) 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 *marshalpatternFlowIpv4DstMetricTag) 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 *unMarshalpatternFlowIpv4DstMetricTag) 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 *patternFlowIpv4DstMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DstMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DstMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4DstMetricTag) Clone() (PatternFlowIpv4DstMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4DstMetricTag() - 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 -} - -// PatternFlowIpv4DstMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4DstMetricTag interface { - Validation - // msg marshals PatternFlowIpv4DstMetricTag to protobuf object *otg.PatternFlowIpv4DstMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4DstMetricTag - // setMsg unmarshals PatternFlowIpv4DstMetricTag from protobuf object *otg.PatternFlowIpv4DstMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4DstMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4DstMetricTag - // validate validates PatternFlowIpv4DstMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4DstMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4DstMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4DstMetricTag - SetName(value string) PatternFlowIpv4DstMetricTag - // Offset returns uint32, set in PatternFlowIpv4DstMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4DstMetricTag - SetOffset(value uint32) PatternFlowIpv4DstMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4DstMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4DstMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4DstMetricTag - SetLength(value uint32) PatternFlowIpv4DstMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4DstMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4DstMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4DstMetricTag object -func (obj *patternFlowIpv4DstMetricTag) SetName(value string) PatternFlowIpv4DstMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4DstMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4DstMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4DstMetricTag object -func (obj *patternFlowIpv4DstMetricTag) SetOffset(value uint32) PatternFlowIpv4DstMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4DstMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4DstMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4DstMetricTag object -func (obj *patternFlowIpv4DstMetricTag) SetLength(value uint32) PatternFlowIpv4DstMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4DstMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4DstMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DstMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4DstMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4DstMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(32) - } - -} - -// ***** PatternFlowIpv4DstRandom ***** -type patternFlowIpv4DstRandom struct { - validation - obj *otg.PatternFlowIpv4DstRandom - marshaller marshalPatternFlowIpv4DstRandom - unMarshaller unMarshalPatternFlowIpv4DstRandom -} - -func NewPatternFlowIpv4DstRandom() PatternFlowIpv4DstRandom { - obj := patternFlowIpv4DstRandom{obj: &otg.PatternFlowIpv4DstRandom{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4DstRandom) msg() *otg.PatternFlowIpv4DstRandom { - return obj.obj -} - -func (obj *patternFlowIpv4DstRandom) setMsg(msg *otg.PatternFlowIpv4DstRandom) PatternFlowIpv4DstRandom { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4DstRandom struct { - obj *patternFlowIpv4DstRandom -} - -type marshalPatternFlowIpv4DstRandom interface { - // ToProto marshals PatternFlowIpv4DstRandom to protobuf object *otg.PatternFlowIpv4DstRandom - ToProto() (*otg.PatternFlowIpv4DstRandom, error) - // ToPbText marshals PatternFlowIpv4DstRandom to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4DstRandom to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4DstRandom to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4DstRandom struct { - obj *patternFlowIpv4DstRandom -} - -type unMarshalPatternFlowIpv4DstRandom interface { - // FromProto unmarshals PatternFlowIpv4DstRandom from protobuf object *otg.PatternFlowIpv4DstRandom - FromProto(msg *otg.PatternFlowIpv4DstRandom) (PatternFlowIpv4DstRandom, error) - // FromPbText unmarshals PatternFlowIpv4DstRandom from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4DstRandom from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4DstRandom from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4DstRandom) Marshal() marshalPatternFlowIpv4DstRandom { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4DstRandom{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4DstRandom) Unmarshal() unMarshalPatternFlowIpv4DstRandom { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4DstRandom{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4DstRandom) ToProto() (*otg.PatternFlowIpv4DstRandom, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4DstRandom) FromProto(msg *otg.PatternFlowIpv4DstRandom) (PatternFlowIpv4DstRandom, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4DstRandom) 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 *unMarshalpatternFlowIpv4DstRandom) 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 *marshalpatternFlowIpv4DstRandom) 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 *unMarshalpatternFlowIpv4DstRandom) 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 *marshalpatternFlowIpv4DstRandom) 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 *unMarshalpatternFlowIpv4DstRandom) 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 *patternFlowIpv4DstRandom) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DstRandom) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DstRandom) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4DstRandom) Clone() (PatternFlowIpv4DstRandom, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4DstRandom() - 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 -} - -// PatternFlowIpv4DstRandom is ipv4 random pattern -type PatternFlowIpv4DstRandom interface { - Validation - // msg marshals PatternFlowIpv4DstRandom to protobuf object *otg.PatternFlowIpv4DstRandom - // and doesn't set defaults - msg() *otg.PatternFlowIpv4DstRandom - // setMsg unmarshals PatternFlowIpv4DstRandom from protobuf object *otg.PatternFlowIpv4DstRandom - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4DstRandom) PatternFlowIpv4DstRandom - // provides marshal interface - Marshal() marshalPatternFlowIpv4DstRandom - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4DstRandom - // validate validates PatternFlowIpv4DstRandom - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4DstRandom, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Min returns string, set in PatternFlowIpv4DstRandom. - Min() string - // SetMin assigns string provided by user to PatternFlowIpv4DstRandom - SetMin(value string) PatternFlowIpv4DstRandom - // HasMin checks if Min has been set in PatternFlowIpv4DstRandom - HasMin() bool - // Max returns string, set in PatternFlowIpv4DstRandom. - Max() string - // SetMax assigns string provided by user to PatternFlowIpv4DstRandom - SetMax(value string) PatternFlowIpv4DstRandom - // HasMax checks if Max has been set in PatternFlowIpv4DstRandom - HasMax() bool - // Seed returns uint32, set in PatternFlowIpv4DstRandom. - Seed() uint32 - // SetSeed assigns uint32 provided by user to PatternFlowIpv4DstRandom - SetSeed(value uint32) PatternFlowIpv4DstRandom - // HasSeed checks if Seed has been set in PatternFlowIpv4DstRandom - HasSeed() bool - // Count returns uint32, set in PatternFlowIpv4DstRandom. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4DstRandom - SetCount(value uint32) PatternFlowIpv4DstRandom - // HasCount checks if Count has been set in PatternFlowIpv4DstRandom - HasCount() bool -} - -// The minimum possible value generated by the random value generator. -// Min returns a string -func (obj *patternFlowIpv4DstRandom) Min() string { - - return *obj.obj.Min - -} - -// The minimum possible value generated by the random value generator. -// Min returns a string -func (obj *patternFlowIpv4DstRandom) HasMin() bool { - return obj.obj.Min != nil -} - -// The minimum possible value generated by the random value generator. -// SetMin sets the string value in the PatternFlowIpv4DstRandom object -func (obj *patternFlowIpv4DstRandom) SetMin(value string) PatternFlowIpv4DstRandom { - - obj.obj.Min = &value - return obj -} - -// The maximum possible value generated by the random value generator. -// Max returns a string -func (obj *patternFlowIpv4DstRandom) Max() string { - - return *obj.obj.Max - -} - -// The maximum possible value generated by the random value generator. -// Max returns a string -func (obj *patternFlowIpv4DstRandom) HasMax() bool { - return obj.obj.Max != nil -} - -// The maximum possible value generated by the random value generator. -// SetMax sets the string value in the PatternFlowIpv4DstRandom object -func (obj *patternFlowIpv4DstRandom) SetMax(value string) PatternFlowIpv4DstRandom { - - obj.obj.Max = &value - return obj -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// Seed returns a uint32 -func (obj *patternFlowIpv4DstRandom) Seed() uint32 { - - return *obj.obj.Seed - -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// Seed returns a uint32 -func (obj *patternFlowIpv4DstRandom) HasSeed() bool { - return obj.obj.Seed != nil -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// SetSeed sets the uint32 value in the PatternFlowIpv4DstRandom object -func (obj *patternFlowIpv4DstRandom) SetSeed(value uint32) PatternFlowIpv4DstRandom { - - obj.obj.Seed = &value - return obj -} - -// The total number of values to be generated by the random value generator. -// Count returns a uint32 -func (obj *patternFlowIpv4DstRandom) Count() uint32 { - - return *obj.obj.Count - -} - -// The total number of values to be generated by the random value generator. -// Count returns a uint32 -func (obj *patternFlowIpv4DstRandom) HasCount() bool { - return obj.obj.Count != nil -} - -// The total number of values to be generated by the random value generator. -// SetCount sets the uint32 value in the PatternFlowIpv4DstRandom object -func (obj *patternFlowIpv4DstRandom) SetCount(value uint32) PatternFlowIpv4DstRandom { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4DstRandom) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Min != nil { - - err := obj.validateIpv4(obj.Min()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4DstRandom.Min")) - } - - } - - if obj.obj.Max != nil { - - err := obj.validateIpv4(obj.Max()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4DstRandom.Max")) - } - - } - -} - -func (obj *patternFlowIpv4DstRandom) setDefault() { - if obj.obj.Min == nil { - obj.SetMin("0.0.0.0") - } - if obj.obj.Max == nil { - obj.SetMax("255.255.255.255") - } - if obj.obj.Seed == nil { - obj.SetSeed(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** FlowIpv4OptionsCustom ***** -type flowIpv4OptionsCustom struct { - validation - obj *otg.FlowIpv4OptionsCustom - marshaller marshalFlowIpv4OptionsCustom - unMarshaller unMarshalFlowIpv4OptionsCustom - typeHolder FlowIpv4OptionsCustomType - lengthHolder FlowIpv4OptionsCustomLength -} - -func NewFlowIpv4OptionsCustom() FlowIpv4OptionsCustom { - obj := flowIpv4OptionsCustom{obj: &otg.FlowIpv4OptionsCustom{}} - obj.setDefault() - return &obj -} - -func (obj *flowIpv4OptionsCustom) msg() *otg.FlowIpv4OptionsCustom { - return obj.obj -} - -func (obj *flowIpv4OptionsCustom) setMsg(msg *otg.FlowIpv4OptionsCustom) FlowIpv4OptionsCustom { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIpv4OptionsCustom struct { - obj *flowIpv4OptionsCustom -} - -type marshalFlowIpv4OptionsCustom interface { - // ToProto marshals FlowIpv4OptionsCustom to protobuf object *otg.FlowIpv4OptionsCustom - ToProto() (*otg.FlowIpv4OptionsCustom, error) - // ToPbText marshals FlowIpv4OptionsCustom to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIpv4OptionsCustom to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIpv4OptionsCustom to JSON text - ToJson() (string, error) -} - -type unMarshalflowIpv4OptionsCustom struct { - obj *flowIpv4OptionsCustom -} - -type unMarshalFlowIpv4OptionsCustom interface { - // FromProto unmarshals FlowIpv4OptionsCustom from protobuf object *otg.FlowIpv4OptionsCustom - FromProto(msg *otg.FlowIpv4OptionsCustom) (FlowIpv4OptionsCustom, error) - // FromPbText unmarshals FlowIpv4OptionsCustom from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIpv4OptionsCustom from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIpv4OptionsCustom from JSON text - FromJson(value string) error -} - -func (obj *flowIpv4OptionsCustom) Marshal() marshalFlowIpv4OptionsCustom { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIpv4OptionsCustom{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIpv4OptionsCustom) Unmarshal() unMarshalFlowIpv4OptionsCustom { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIpv4OptionsCustom{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIpv4OptionsCustom) ToProto() (*otg.FlowIpv4OptionsCustom, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIpv4OptionsCustom) FromProto(msg *otg.FlowIpv4OptionsCustom) (FlowIpv4OptionsCustom, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIpv4OptionsCustom) 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 *unMarshalflowIpv4OptionsCustom) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowIpv4OptionsCustom) 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 *unMarshalflowIpv4OptionsCustom) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowIpv4OptionsCustom) 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 *unMarshalflowIpv4OptionsCustom) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowIpv4OptionsCustom) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIpv4OptionsCustom) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIpv4OptionsCustom) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIpv4OptionsCustom) Clone() (FlowIpv4OptionsCustom, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIpv4OptionsCustom() - 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 -} - -func (obj *flowIpv4OptionsCustom) setNil() { - obj.typeHolder = nil - obj.lengthHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowIpv4OptionsCustom is user defined IP options to be appended to the IPv4 header. -type FlowIpv4OptionsCustom interface { - Validation - // msg marshals FlowIpv4OptionsCustom to protobuf object *otg.FlowIpv4OptionsCustom - // and doesn't set defaults - msg() *otg.FlowIpv4OptionsCustom - // setMsg unmarshals FlowIpv4OptionsCustom from protobuf object *otg.FlowIpv4OptionsCustom - // and doesn't set defaults - setMsg(*otg.FlowIpv4OptionsCustom) FlowIpv4OptionsCustom - // provides marshal interface - Marshal() marshalFlowIpv4OptionsCustom - // provides unmarshal interface - Unmarshal() unMarshalFlowIpv4OptionsCustom - // validate validates FlowIpv4OptionsCustom - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIpv4OptionsCustom, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Type returns FlowIpv4OptionsCustomType, set in FlowIpv4OptionsCustom. - // FlowIpv4OptionsCustomType is type options for custom options. - Type() FlowIpv4OptionsCustomType - // SetType assigns FlowIpv4OptionsCustomType provided by user to FlowIpv4OptionsCustom. - // FlowIpv4OptionsCustomType is type options for custom options. - SetType(value FlowIpv4OptionsCustomType) FlowIpv4OptionsCustom - // HasType checks if Type has been set in FlowIpv4OptionsCustom - HasType() bool - // Length returns FlowIpv4OptionsCustomLength, set in FlowIpv4OptionsCustom. - // FlowIpv4OptionsCustomLength is length for custom options. - Length() FlowIpv4OptionsCustomLength - // SetLength assigns FlowIpv4OptionsCustomLength provided by user to FlowIpv4OptionsCustom. - // FlowIpv4OptionsCustomLength is length for custom options. - SetLength(value FlowIpv4OptionsCustomLength) FlowIpv4OptionsCustom - // HasLength checks if Length has been set in FlowIpv4OptionsCustom - HasLength() bool - // Value returns string, set in FlowIpv4OptionsCustom. - Value() string - // SetValue assigns string provided by user to FlowIpv4OptionsCustom - SetValue(value string) FlowIpv4OptionsCustom - // HasValue checks if Value has been set in FlowIpv4OptionsCustom - HasValue() bool - setNil() -} - -// description is TBD -// Type returns a FlowIpv4OptionsCustomType -func (obj *flowIpv4OptionsCustom) Type() FlowIpv4OptionsCustomType { - if obj.obj.Type == nil { - obj.obj.Type = NewFlowIpv4OptionsCustomType().msg() - } - if obj.typeHolder == nil { - obj.typeHolder = &flowIpv4OptionsCustomType{obj: obj.obj.Type} - } - return obj.typeHolder -} - -// description is TBD -// Type returns a FlowIpv4OptionsCustomType -func (obj *flowIpv4OptionsCustom) HasType() bool { - return obj.obj.Type != nil -} - -// description is TBD -// SetType sets the FlowIpv4OptionsCustomType value in the FlowIpv4OptionsCustom object -func (obj *flowIpv4OptionsCustom) SetType(value FlowIpv4OptionsCustomType) FlowIpv4OptionsCustom { - - obj.typeHolder = nil - obj.obj.Type = value.msg() - - return obj -} - -// description is TBD -// Length returns a FlowIpv4OptionsCustomLength -func (obj *flowIpv4OptionsCustom) Length() FlowIpv4OptionsCustomLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowIpv4OptionsCustomLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowIpv4OptionsCustomLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// description is TBD -// Length returns a FlowIpv4OptionsCustomLength -func (obj *flowIpv4OptionsCustom) HasLength() bool { - return obj.obj.Length != nil -} - -// description is TBD -// SetLength sets the FlowIpv4OptionsCustomLength value in the FlowIpv4OptionsCustom object -func (obj *flowIpv4OptionsCustom) SetLength(value FlowIpv4OptionsCustomLength) FlowIpv4OptionsCustom { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// Value of the option field should not excced 38 bytes since maximum 40 bytes can be added as options in IPv4 header. For type and length requires 2 bytes, hence maximum of 38 bytes are expected. Maximum length of this attribute is 76 (38 * 2 hex character per byte). -// Value returns a string -func (obj *flowIpv4OptionsCustom) Value() string { - - return *obj.obj.Value - -} - -// Value of the option field should not excced 38 bytes since maximum 40 bytes can be added as options in IPv4 header. For type and length requires 2 bytes, hence maximum of 38 bytes are expected. Maximum length of this attribute is 76 (38 * 2 hex character per byte). -// Value returns a string -func (obj *flowIpv4OptionsCustom) HasValue() bool { - return obj.obj.Value != nil -} - -// Value of the option field should not excced 38 bytes since maximum 40 bytes can be added as options in IPv4 header. For type and length requires 2 bytes, hence maximum of 38 bytes are expected. Maximum length of this attribute is 76 (38 * 2 hex character per byte). -// SetValue sets the string value in the FlowIpv4OptionsCustom object -func (obj *flowIpv4OptionsCustom) SetValue(value string) FlowIpv4OptionsCustom { - - obj.obj.Value = &value - return obj -} - -func (obj *flowIpv4OptionsCustom) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Type != nil { - - obj.Type().validateObj(vObj, set_default) - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.Value != nil { - - if len(*obj.obj.Value) < 0 || len(*obj.obj.Value) > 76 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of FlowIpv4OptionsCustom.Value <= 76 but Got %d", - len(*obj.obj.Value))) - } - - } - -} - -func (obj *flowIpv4OptionsCustom) setDefault() { - if obj.obj.Value == nil { - obj.SetValue("0000") - } - -} - -// ***** PatternFlowIpv6VersionCounter ***** -type patternFlowIpv6VersionCounter struct { - validation - obj *otg.PatternFlowIpv6VersionCounter - marshaller marshalPatternFlowIpv6VersionCounter - unMarshaller unMarshalPatternFlowIpv6VersionCounter -} - -func NewPatternFlowIpv6VersionCounter() PatternFlowIpv6VersionCounter { - obj := patternFlowIpv6VersionCounter{obj: &otg.PatternFlowIpv6VersionCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6VersionCounter) msg() *otg.PatternFlowIpv6VersionCounter { - return obj.obj -} - -func (obj *patternFlowIpv6VersionCounter) setMsg(msg *otg.PatternFlowIpv6VersionCounter) PatternFlowIpv6VersionCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6VersionCounter struct { - obj *patternFlowIpv6VersionCounter -} - -type marshalPatternFlowIpv6VersionCounter interface { - // ToProto marshals PatternFlowIpv6VersionCounter to protobuf object *otg.PatternFlowIpv6VersionCounter - ToProto() (*otg.PatternFlowIpv6VersionCounter, error) - // ToPbText marshals PatternFlowIpv6VersionCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6VersionCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6VersionCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6VersionCounter struct { - obj *patternFlowIpv6VersionCounter -} - -type unMarshalPatternFlowIpv6VersionCounter interface { - // FromProto unmarshals PatternFlowIpv6VersionCounter from protobuf object *otg.PatternFlowIpv6VersionCounter - FromProto(msg *otg.PatternFlowIpv6VersionCounter) (PatternFlowIpv6VersionCounter, error) - // FromPbText unmarshals PatternFlowIpv6VersionCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6VersionCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6VersionCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6VersionCounter) Marshal() marshalPatternFlowIpv6VersionCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6VersionCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6VersionCounter) Unmarshal() unMarshalPatternFlowIpv6VersionCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6VersionCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6VersionCounter) ToProto() (*otg.PatternFlowIpv6VersionCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6VersionCounter) FromProto(msg *otg.PatternFlowIpv6VersionCounter) (PatternFlowIpv6VersionCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6VersionCounter) 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 *unMarshalpatternFlowIpv6VersionCounter) 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 *marshalpatternFlowIpv6VersionCounter) 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 *unMarshalpatternFlowIpv6VersionCounter) 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 *marshalpatternFlowIpv6VersionCounter) 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 *unMarshalpatternFlowIpv6VersionCounter) 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 *patternFlowIpv6VersionCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6VersionCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6VersionCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6VersionCounter) Clone() (PatternFlowIpv6VersionCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6VersionCounter() - 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 -} - -// PatternFlowIpv6VersionCounter is integer counter pattern -type PatternFlowIpv6VersionCounter interface { - Validation - // msg marshals PatternFlowIpv6VersionCounter to protobuf object *otg.PatternFlowIpv6VersionCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv6VersionCounter - // setMsg unmarshals PatternFlowIpv6VersionCounter from protobuf object *otg.PatternFlowIpv6VersionCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6VersionCounter) PatternFlowIpv6VersionCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv6VersionCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6VersionCounter - // validate validates PatternFlowIpv6VersionCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6VersionCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv6VersionCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv6VersionCounter - SetStart(value uint32) PatternFlowIpv6VersionCounter - // HasStart checks if Start has been set in PatternFlowIpv6VersionCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv6VersionCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv6VersionCounter - SetStep(value uint32) PatternFlowIpv6VersionCounter - // HasStep checks if Step has been set in PatternFlowIpv6VersionCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv6VersionCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv6VersionCounter - SetCount(value uint32) PatternFlowIpv6VersionCounter - // HasCount checks if Count has been set in PatternFlowIpv6VersionCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv6VersionCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv6VersionCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv6VersionCounter object -func (obj *patternFlowIpv6VersionCounter) SetStart(value uint32) PatternFlowIpv6VersionCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv6VersionCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv6VersionCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv6VersionCounter object -func (obj *patternFlowIpv6VersionCounter) SetStep(value uint32) PatternFlowIpv6VersionCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6VersionCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6VersionCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv6VersionCounter object -func (obj *patternFlowIpv6VersionCounter) SetCount(value uint32) PatternFlowIpv6VersionCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv6VersionCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6VersionCounter.Start <= 15 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6VersionCounter.Step <= 15 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6VersionCounter.Count <= 15 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv6VersionCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(6) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv6VersionMetricTag ***** -type patternFlowIpv6VersionMetricTag struct { - validation - obj *otg.PatternFlowIpv6VersionMetricTag - marshaller marshalPatternFlowIpv6VersionMetricTag - unMarshaller unMarshalPatternFlowIpv6VersionMetricTag -} - -func NewPatternFlowIpv6VersionMetricTag() PatternFlowIpv6VersionMetricTag { - obj := patternFlowIpv6VersionMetricTag{obj: &otg.PatternFlowIpv6VersionMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6VersionMetricTag) msg() *otg.PatternFlowIpv6VersionMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv6VersionMetricTag) setMsg(msg *otg.PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6VersionMetricTag struct { - obj *patternFlowIpv6VersionMetricTag -} - -type marshalPatternFlowIpv6VersionMetricTag interface { - // ToProto marshals PatternFlowIpv6VersionMetricTag to protobuf object *otg.PatternFlowIpv6VersionMetricTag - ToProto() (*otg.PatternFlowIpv6VersionMetricTag, error) - // ToPbText marshals PatternFlowIpv6VersionMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6VersionMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6VersionMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6VersionMetricTag struct { - obj *patternFlowIpv6VersionMetricTag -} - -type unMarshalPatternFlowIpv6VersionMetricTag interface { - // FromProto unmarshals PatternFlowIpv6VersionMetricTag from protobuf object *otg.PatternFlowIpv6VersionMetricTag - FromProto(msg *otg.PatternFlowIpv6VersionMetricTag) (PatternFlowIpv6VersionMetricTag, error) - // FromPbText unmarshals PatternFlowIpv6VersionMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6VersionMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6VersionMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6VersionMetricTag) Marshal() marshalPatternFlowIpv6VersionMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6VersionMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6VersionMetricTag) Unmarshal() unMarshalPatternFlowIpv6VersionMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6VersionMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6VersionMetricTag) ToProto() (*otg.PatternFlowIpv6VersionMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6VersionMetricTag) FromProto(msg *otg.PatternFlowIpv6VersionMetricTag) (PatternFlowIpv6VersionMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6VersionMetricTag) 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 *unMarshalpatternFlowIpv6VersionMetricTag) 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 *marshalpatternFlowIpv6VersionMetricTag) 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 *unMarshalpatternFlowIpv6VersionMetricTag) 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 *marshalpatternFlowIpv6VersionMetricTag) 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 *unMarshalpatternFlowIpv6VersionMetricTag) 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 *patternFlowIpv6VersionMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6VersionMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6VersionMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6VersionMetricTag) Clone() (PatternFlowIpv6VersionMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6VersionMetricTag() - 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 -} - -// PatternFlowIpv6VersionMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv6VersionMetricTag interface { - Validation - // msg marshals PatternFlowIpv6VersionMetricTag to protobuf object *otg.PatternFlowIpv6VersionMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv6VersionMetricTag - // setMsg unmarshals PatternFlowIpv6VersionMetricTag from protobuf object *otg.PatternFlowIpv6VersionMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv6VersionMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6VersionMetricTag - // validate validates PatternFlowIpv6VersionMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6VersionMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv6VersionMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv6VersionMetricTag - SetName(value string) PatternFlowIpv6VersionMetricTag - // Offset returns uint32, set in PatternFlowIpv6VersionMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv6VersionMetricTag - SetOffset(value uint32) PatternFlowIpv6VersionMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv6VersionMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv6VersionMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv6VersionMetricTag - SetLength(value uint32) PatternFlowIpv6VersionMetricTag - // HasLength checks if Length has been set in PatternFlowIpv6VersionMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv6VersionMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv6VersionMetricTag object -func (obj *patternFlowIpv6VersionMetricTag) SetName(value string) PatternFlowIpv6VersionMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6VersionMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6VersionMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv6VersionMetricTag object -func (obj *patternFlowIpv6VersionMetricTag) SetOffset(value uint32) PatternFlowIpv6VersionMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6VersionMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6VersionMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv6VersionMetricTag object -func (obj *patternFlowIpv6VersionMetricTag) SetLength(value uint32) PatternFlowIpv6VersionMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv6VersionMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6VersionMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6VersionMetricTag.Offset <= 3 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 4 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv6VersionMetricTag.Length <= 4 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv6VersionMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(4) - } - -} - -// ***** PatternFlowIpv6TrafficClassCounter ***** -type patternFlowIpv6TrafficClassCounter struct { - validation - obj *otg.PatternFlowIpv6TrafficClassCounter - marshaller marshalPatternFlowIpv6TrafficClassCounter - unMarshaller unMarshalPatternFlowIpv6TrafficClassCounter -} - -func NewPatternFlowIpv6TrafficClassCounter() PatternFlowIpv6TrafficClassCounter { - obj := patternFlowIpv6TrafficClassCounter{obj: &otg.PatternFlowIpv6TrafficClassCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6TrafficClassCounter) msg() *otg.PatternFlowIpv6TrafficClassCounter { - return obj.obj -} - -func (obj *patternFlowIpv6TrafficClassCounter) setMsg(msg *otg.PatternFlowIpv6TrafficClassCounter) PatternFlowIpv6TrafficClassCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6TrafficClassCounter struct { - obj *patternFlowIpv6TrafficClassCounter -} - -type marshalPatternFlowIpv6TrafficClassCounter interface { - // ToProto marshals PatternFlowIpv6TrafficClassCounter to protobuf object *otg.PatternFlowIpv6TrafficClassCounter - ToProto() (*otg.PatternFlowIpv6TrafficClassCounter, error) - // ToPbText marshals PatternFlowIpv6TrafficClassCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6TrafficClassCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6TrafficClassCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6TrafficClassCounter struct { - obj *patternFlowIpv6TrafficClassCounter -} - -type unMarshalPatternFlowIpv6TrafficClassCounter interface { - // FromProto unmarshals PatternFlowIpv6TrafficClassCounter from protobuf object *otg.PatternFlowIpv6TrafficClassCounter - FromProto(msg *otg.PatternFlowIpv6TrafficClassCounter) (PatternFlowIpv6TrafficClassCounter, error) - // FromPbText unmarshals PatternFlowIpv6TrafficClassCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6TrafficClassCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6TrafficClassCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6TrafficClassCounter) Marshal() marshalPatternFlowIpv6TrafficClassCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6TrafficClassCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6TrafficClassCounter) Unmarshal() unMarshalPatternFlowIpv6TrafficClassCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6TrafficClassCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6TrafficClassCounter) ToProto() (*otg.PatternFlowIpv6TrafficClassCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6TrafficClassCounter) FromProto(msg *otg.PatternFlowIpv6TrafficClassCounter) (PatternFlowIpv6TrafficClassCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6TrafficClassCounter) 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 *unMarshalpatternFlowIpv6TrafficClassCounter) 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 *marshalpatternFlowIpv6TrafficClassCounter) 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 *unMarshalpatternFlowIpv6TrafficClassCounter) 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 *marshalpatternFlowIpv6TrafficClassCounter) 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 *unMarshalpatternFlowIpv6TrafficClassCounter) 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 *patternFlowIpv6TrafficClassCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6TrafficClassCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6TrafficClassCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6TrafficClassCounter) Clone() (PatternFlowIpv6TrafficClassCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6TrafficClassCounter() - 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 -} - -// PatternFlowIpv6TrafficClassCounter is integer counter pattern -type PatternFlowIpv6TrafficClassCounter interface { - Validation - // msg marshals PatternFlowIpv6TrafficClassCounter to protobuf object *otg.PatternFlowIpv6TrafficClassCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv6TrafficClassCounter - // setMsg unmarshals PatternFlowIpv6TrafficClassCounter from protobuf object *otg.PatternFlowIpv6TrafficClassCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6TrafficClassCounter) PatternFlowIpv6TrafficClassCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv6TrafficClassCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6TrafficClassCounter - // validate validates PatternFlowIpv6TrafficClassCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6TrafficClassCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv6TrafficClassCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv6TrafficClassCounter - SetStart(value uint32) PatternFlowIpv6TrafficClassCounter - // HasStart checks if Start has been set in PatternFlowIpv6TrafficClassCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv6TrafficClassCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv6TrafficClassCounter - SetStep(value uint32) PatternFlowIpv6TrafficClassCounter - // HasStep checks if Step has been set in PatternFlowIpv6TrafficClassCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv6TrafficClassCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv6TrafficClassCounter - SetCount(value uint32) PatternFlowIpv6TrafficClassCounter - // HasCount checks if Count has been set in PatternFlowIpv6TrafficClassCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv6TrafficClassCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv6TrafficClassCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv6TrafficClassCounter object -func (obj *patternFlowIpv6TrafficClassCounter) SetStart(value uint32) PatternFlowIpv6TrafficClassCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv6TrafficClassCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv6TrafficClassCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv6TrafficClassCounter object -func (obj *patternFlowIpv6TrafficClassCounter) SetStep(value uint32) PatternFlowIpv6TrafficClassCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6TrafficClassCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6TrafficClassCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv6TrafficClassCounter object -func (obj *patternFlowIpv6TrafficClassCounter) SetCount(value uint32) PatternFlowIpv6TrafficClassCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv6TrafficClassCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6TrafficClassCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6TrafficClassCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6TrafficClassCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv6TrafficClassCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv6TrafficClassMetricTag ***** -type patternFlowIpv6TrafficClassMetricTag struct { - validation - obj *otg.PatternFlowIpv6TrafficClassMetricTag - marshaller marshalPatternFlowIpv6TrafficClassMetricTag - unMarshaller unMarshalPatternFlowIpv6TrafficClassMetricTag -} - -func NewPatternFlowIpv6TrafficClassMetricTag() PatternFlowIpv6TrafficClassMetricTag { - obj := patternFlowIpv6TrafficClassMetricTag{obj: &otg.PatternFlowIpv6TrafficClassMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6TrafficClassMetricTag) msg() *otg.PatternFlowIpv6TrafficClassMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv6TrafficClassMetricTag) setMsg(msg *otg.PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6TrafficClassMetricTag struct { - obj *patternFlowIpv6TrafficClassMetricTag -} - -type marshalPatternFlowIpv6TrafficClassMetricTag interface { - // ToProto marshals PatternFlowIpv6TrafficClassMetricTag to protobuf object *otg.PatternFlowIpv6TrafficClassMetricTag - ToProto() (*otg.PatternFlowIpv6TrafficClassMetricTag, error) - // ToPbText marshals PatternFlowIpv6TrafficClassMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6TrafficClassMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6TrafficClassMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6TrafficClassMetricTag struct { - obj *patternFlowIpv6TrafficClassMetricTag -} - -type unMarshalPatternFlowIpv6TrafficClassMetricTag interface { - // FromProto unmarshals PatternFlowIpv6TrafficClassMetricTag from protobuf object *otg.PatternFlowIpv6TrafficClassMetricTag - FromProto(msg *otg.PatternFlowIpv6TrafficClassMetricTag) (PatternFlowIpv6TrafficClassMetricTag, error) - // FromPbText unmarshals PatternFlowIpv6TrafficClassMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6TrafficClassMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6TrafficClassMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6TrafficClassMetricTag) Marshal() marshalPatternFlowIpv6TrafficClassMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6TrafficClassMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6TrafficClassMetricTag) Unmarshal() unMarshalPatternFlowIpv6TrafficClassMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6TrafficClassMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6TrafficClassMetricTag) ToProto() (*otg.PatternFlowIpv6TrafficClassMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6TrafficClassMetricTag) FromProto(msg *otg.PatternFlowIpv6TrafficClassMetricTag) (PatternFlowIpv6TrafficClassMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6TrafficClassMetricTag) 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 *unMarshalpatternFlowIpv6TrafficClassMetricTag) 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 *marshalpatternFlowIpv6TrafficClassMetricTag) 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 *unMarshalpatternFlowIpv6TrafficClassMetricTag) 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 *marshalpatternFlowIpv6TrafficClassMetricTag) 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 *unMarshalpatternFlowIpv6TrafficClassMetricTag) 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 *patternFlowIpv6TrafficClassMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6TrafficClassMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6TrafficClassMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6TrafficClassMetricTag) Clone() (PatternFlowIpv6TrafficClassMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6TrafficClassMetricTag() - 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 -} - -// PatternFlowIpv6TrafficClassMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv6TrafficClassMetricTag interface { - Validation - // msg marshals PatternFlowIpv6TrafficClassMetricTag to protobuf object *otg.PatternFlowIpv6TrafficClassMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv6TrafficClassMetricTag - // setMsg unmarshals PatternFlowIpv6TrafficClassMetricTag from protobuf object *otg.PatternFlowIpv6TrafficClassMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv6TrafficClassMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6TrafficClassMetricTag - // validate validates PatternFlowIpv6TrafficClassMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6TrafficClassMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv6TrafficClassMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv6TrafficClassMetricTag - SetName(value string) PatternFlowIpv6TrafficClassMetricTag - // Offset returns uint32, set in PatternFlowIpv6TrafficClassMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv6TrafficClassMetricTag - SetOffset(value uint32) PatternFlowIpv6TrafficClassMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv6TrafficClassMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv6TrafficClassMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv6TrafficClassMetricTag - SetLength(value uint32) PatternFlowIpv6TrafficClassMetricTag - // HasLength checks if Length has been set in PatternFlowIpv6TrafficClassMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv6TrafficClassMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv6TrafficClassMetricTag object -func (obj *patternFlowIpv6TrafficClassMetricTag) SetName(value string) PatternFlowIpv6TrafficClassMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6TrafficClassMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6TrafficClassMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv6TrafficClassMetricTag object -func (obj *patternFlowIpv6TrafficClassMetricTag) SetOffset(value uint32) PatternFlowIpv6TrafficClassMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6TrafficClassMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6TrafficClassMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv6TrafficClassMetricTag object -func (obj *patternFlowIpv6TrafficClassMetricTag) SetLength(value uint32) PatternFlowIpv6TrafficClassMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv6TrafficClassMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6TrafficClassMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6TrafficClassMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv6TrafficClassMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv6TrafficClassMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowIpv6FlowLabelCounter ***** -type patternFlowIpv6FlowLabelCounter struct { - validation - obj *otg.PatternFlowIpv6FlowLabelCounter - marshaller marshalPatternFlowIpv6FlowLabelCounter - unMarshaller unMarshalPatternFlowIpv6FlowLabelCounter -} - -func NewPatternFlowIpv6FlowLabelCounter() PatternFlowIpv6FlowLabelCounter { - obj := patternFlowIpv6FlowLabelCounter{obj: &otg.PatternFlowIpv6FlowLabelCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6FlowLabelCounter) msg() *otg.PatternFlowIpv6FlowLabelCounter { - return obj.obj -} - -func (obj *patternFlowIpv6FlowLabelCounter) setMsg(msg *otg.PatternFlowIpv6FlowLabelCounter) PatternFlowIpv6FlowLabelCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6FlowLabelCounter struct { - obj *patternFlowIpv6FlowLabelCounter -} - -type marshalPatternFlowIpv6FlowLabelCounter interface { - // ToProto marshals PatternFlowIpv6FlowLabelCounter to protobuf object *otg.PatternFlowIpv6FlowLabelCounter - ToProto() (*otg.PatternFlowIpv6FlowLabelCounter, error) - // ToPbText marshals PatternFlowIpv6FlowLabelCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6FlowLabelCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6FlowLabelCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6FlowLabelCounter struct { - obj *patternFlowIpv6FlowLabelCounter -} - -type unMarshalPatternFlowIpv6FlowLabelCounter interface { - // FromProto unmarshals PatternFlowIpv6FlowLabelCounter from protobuf object *otg.PatternFlowIpv6FlowLabelCounter - FromProto(msg *otg.PatternFlowIpv6FlowLabelCounter) (PatternFlowIpv6FlowLabelCounter, error) - // FromPbText unmarshals PatternFlowIpv6FlowLabelCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6FlowLabelCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6FlowLabelCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6FlowLabelCounter) Marshal() marshalPatternFlowIpv6FlowLabelCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6FlowLabelCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6FlowLabelCounter) Unmarshal() unMarshalPatternFlowIpv6FlowLabelCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6FlowLabelCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6FlowLabelCounter) ToProto() (*otg.PatternFlowIpv6FlowLabelCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6FlowLabelCounter) FromProto(msg *otg.PatternFlowIpv6FlowLabelCounter) (PatternFlowIpv6FlowLabelCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6FlowLabelCounter) 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 *unMarshalpatternFlowIpv6FlowLabelCounter) 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 *marshalpatternFlowIpv6FlowLabelCounter) 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 *unMarshalpatternFlowIpv6FlowLabelCounter) 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 *marshalpatternFlowIpv6FlowLabelCounter) 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 *unMarshalpatternFlowIpv6FlowLabelCounter) 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 *patternFlowIpv6FlowLabelCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6FlowLabelCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6FlowLabelCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6FlowLabelCounter) Clone() (PatternFlowIpv6FlowLabelCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6FlowLabelCounter() - 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 -} - -// PatternFlowIpv6FlowLabelCounter is integer counter pattern -type PatternFlowIpv6FlowLabelCounter interface { - Validation - // msg marshals PatternFlowIpv6FlowLabelCounter to protobuf object *otg.PatternFlowIpv6FlowLabelCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv6FlowLabelCounter - // setMsg unmarshals PatternFlowIpv6FlowLabelCounter from protobuf object *otg.PatternFlowIpv6FlowLabelCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6FlowLabelCounter) PatternFlowIpv6FlowLabelCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv6FlowLabelCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6FlowLabelCounter - // validate validates PatternFlowIpv6FlowLabelCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6FlowLabelCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv6FlowLabelCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv6FlowLabelCounter - SetStart(value uint32) PatternFlowIpv6FlowLabelCounter - // HasStart checks if Start has been set in PatternFlowIpv6FlowLabelCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv6FlowLabelCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv6FlowLabelCounter - SetStep(value uint32) PatternFlowIpv6FlowLabelCounter - // HasStep checks if Step has been set in PatternFlowIpv6FlowLabelCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv6FlowLabelCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv6FlowLabelCounter - SetCount(value uint32) PatternFlowIpv6FlowLabelCounter - // HasCount checks if Count has been set in PatternFlowIpv6FlowLabelCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv6FlowLabelCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv6FlowLabelCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv6FlowLabelCounter object -func (obj *patternFlowIpv6FlowLabelCounter) SetStart(value uint32) PatternFlowIpv6FlowLabelCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv6FlowLabelCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv6FlowLabelCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv6FlowLabelCounter object -func (obj *patternFlowIpv6FlowLabelCounter) SetStep(value uint32) PatternFlowIpv6FlowLabelCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6FlowLabelCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6FlowLabelCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv6FlowLabelCounter object -func (obj *patternFlowIpv6FlowLabelCounter) SetCount(value uint32) PatternFlowIpv6FlowLabelCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv6FlowLabelCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6FlowLabelCounter.Start <= 1048575 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6FlowLabelCounter.Step <= 1048575 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6FlowLabelCounter.Count <= 1048575 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv6FlowLabelCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv6FlowLabelMetricTag ***** -type patternFlowIpv6FlowLabelMetricTag struct { - validation - obj *otg.PatternFlowIpv6FlowLabelMetricTag - marshaller marshalPatternFlowIpv6FlowLabelMetricTag - unMarshaller unMarshalPatternFlowIpv6FlowLabelMetricTag -} - -func NewPatternFlowIpv6FlowLabelMetricTag() PatternFlowIpv6FlowLabelMetricTag { - obj := patternFlowIpv6FlowLabelMetricTag{obj: &otg.PatternFlowIpv6FlowLabelMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6FlowLabelMetricTag) msg() *otg.PatternFlowIpv6FlowLabelMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv6FlowLabelMetricTag) setMsg(msg *otg.PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6FlowLabelMetricTag struct { - obj *patternFlowIpv6FlowLabelMetricTag -} - -type marshalPatternFlowIpv6FlowLabelMetricTag interface { - // ToProto marshals PatternFlowIpv6FlowLabelMetricTag to protobuf object *otg.PatternFlowIpv6FlowLabelMetricTag - ToProto() (*otg.PatternFlowIpv6FlowLabelMetricTag, error) - // ToPbText marshals PatternFlowIpv6FlowLabelMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6FlowLabelMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6FlowLabelMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6FlowLabelMetricTag struct { - obj *patternFlowIpv6FlowLabelMetricTag -} - -type unMarshalPatternFlowIpv6FlowLabelMetricTag interface { - // FromProto unmarshals PatternFlowIpv6FlowLabelMetricTag from protobuf object *otg.PatternFlowIpv6FlowLabelMetricTag - FromProto(msg *otg.PatternFlowIpv6FlowLabelMetricTag) (PatternFlowIpv6FlowLabelMetricTag, error) - // FromPbText unmarshals PatternFlowIpv6FlowLabelMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6FlowLabelMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6FlowLabelMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6FlowLabelMetricTag) Marshal() marshalPatternFlowIpv6FlowLabelMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6FlowLabelMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6FlowLabelMetricTag) Unmarshal() unMarshalPatternFlowIpv6FlowLabelMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6FlowLabelMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6FlowLabelMetricTag) ToProto() (*otg.PatternFlowIpv6FlowLabelMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6FlowLabelMetricTag) FromProto(msg *otg.PatternFlowIpv6FlowLabelMetricTag) (PatternFlowIpv6FlowLabelMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6FlowLabelMetricTag) 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 *unMarshalpatternFlowIpv6FlowLabelMetricTag) 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 *marshalpatternFlowIpv6FlowLabelMetricTag) 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 *unMarshalpatternFlowIpv6FlowLabelMetricTag) 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 *marshalpatternFlowIpv6FlowLabelMetricTag) 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 *unMarshalpatternFlowIpv6FlowLabelMetricTag) 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 *patternFlowIpv6FlowLabelMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6FlowLabelMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6FlowLabelMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6FlowLabelMetricTag) Clone() (PatternFlowIpv6FlowLabelMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6FlowLabelMetricTag() - 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 -} - -// PatternFlowIpv6FlowLabelMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv6FlowLabelMetricTag interface { - Validation - // msg marshals PatternFlowIpv6FlowLabelMetricTag to protobuf object *otg.PatternFlowIpv6FlowLabelMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv6FlowLabelMetricTag - // setMsg unmarshals PatternFlowIpv6FlowLabelMetricTag from protobuf object *otg.PatternFlowIpv6FlowLabelMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv6FlowLabelMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6FlowLabelMetricTag - // validate validates PatternFlowIpv6FlowLabelMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6FlowLabelMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv6FlowLabelMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv6FlowLabelMetricTag - SetName(value string) PatternFlowIpv6FlowLabelMetricTag - // Offset returns uint32, set in PatternFlowIpv6FlowLabelMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv6FlowLabelMetricTag - SetOffset(value uint32) PatternFlowIpv6FlowLabelMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv6FlowLabelMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv6FlowLabelMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv6FlowLabelMetricTag - SetLength(value uint32) PatternFlowIpv6FlowLabelMetricTag - // HasLength checks if Length has been set in PatternFlowIpv6FlowLabelMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv6FlowLabelMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv6FlowLabelMetricTag object -func (obj *patternFlowIpv6FlowLabelMetricTag) SetName(value string) PatternFlowIpv6FlowLabelMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6FlowLabelMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6FlowLabelMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv6FlowLabelMetricTag object -func (obj *patternFlowIpv6FlowLabelMetricTag) SetOffset(value uint32) PatternFlowIpv6FlowLabelMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6FlowLabelMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6FlowLabelMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv6FlowLabelMetricTag object -func (obj *patternFlowIpv6FlowLabelMetricTag) SetLength(value uint32) PatternFlowIpv6FlowLabelMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv6FlowLabelMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6FlowLabelMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 19 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6FlowLabelMetricTag.Offset <= 19 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 20 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv6FlowLabelMetricTag.Length <= 20 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv6FlowLabelMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(20) - } - -} - -// ***** PatternFlowIpv6FlowLabelRandom ***** -type patternFlowIpv6FlowLabelRandom struct { - validation - obj *otg.PatternFlowIpv6FlowLabelRandom - marshaller marshalPatternFlowIpv6FlowLabelRandom - unMarshaller unMarshalPatternFlowIpv6FlowLabelRandom -} - -func NewPatternFlowIpv6FlowLabelRandom() PatternFlowIpv6FlowLabelRandom { - obj := patternFlowIpv6FlowLabelRandom{obj: &otg.PatternFlowIpv6FlowLabelRandom{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6FlowLabelRandom) msg() *otg.PatternFlowIpv6FlowLabelRandom { - return obj.obj -} - -func (obj *patternFlowIpv6FlowLabelRandom) setMsg(msg *otg.PatternFlowIpv6FlowLabelRandom) PatternFlowIpv6FlowLabelRandom { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6FlowLabelRandom struct { - obj *patternFlowIpv6FlowLabelRandom -} - -type marshalPatternFlowIpv6FlowLabelRandom interface { - // ToProto marshals PatternFlowIpv6FlowLabelRandom to protobuf object *otg.PatternFlowIpv6FlowLabelRandom - ToProto() (*otg.PatternFlowIpv6FlowLabelRandom, error) - // ToPbText marshals PatternFlowIpv6FlowLabelRandom to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6FlowLabelRandom to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6FlowLabelRandom to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6FlowLabelRandom struct { - obj *patternFlowIpv6FlowLabelRandom -} - -type unMarshalPatternFlowIpv6FlowLabelRandom interface { - // FromProto unmarshals PatternFlowIpv6FlowLabelRandom from protobuf object *otg.PatternFlowIpv6FlowLabelRandom - FromProto(msg *otg.PatternFlowIpv6FlowLabelRandom) (PatternFlowIpv6FlowLabelRandom, error) - // FromPbText unmarshals PatternFlowIpv6FlowLabelRandom from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6FlowLabelRandom from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6FlowLabelRandom from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6FlowLabelRandom) Marshal() marshalPatternFlowIpv6FlowLabelRandom { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6FlowLabelRandom{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6FlowLabelRandom) Unmarshal() unMarshalPatternFlowIpv6FlowLabelRandom { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6FlowLabelRandom{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6FlowLabelRandom) ToProto() (*otg.PatternFlowIpv6FlowLabelRandom, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6FlowLabelRandom) FromProto(msg *otg.PatternFlowIpv6FlowLabelRandom) (PatternFlowIpv6FlowLabelRandom, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6FlowLabelRandom) 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 *unMarshalpatternFlowIpv6FlowLabelRandom) 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 *marshalpatternFlowIpv6FlowLabelRandom) 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 *unMarshalpatternFlowIpv6FlowLabelRandom) 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 *marshalpatternFlowIpv6FlowLabelRandom) 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 *unMarshalpatternFlowIpv6FlowLabelRandom) 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 *patternFlowIpv6FlowLabelRandom) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6FlowLabelRandom) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6FlowLabelRandom) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6FlowLabelRandom) Clone() (PatternFlowIpv6FlowLabelRandom, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6FlowLabelRandom() - 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 -} - -// PatternFlowIpv6FlowLabelRandom is integer random pattern -type PatternFlowIpv6FlowLabelRandom interface { - Validation - // msg marshals PatternFlowIpv6FlowLabelRandom to protobuf object *otg.PatternFlowIpv6FlowLabelRandom - // and doesn't set defaults - msg() *otg.PatternFlowIpv6FlowLabelRandom - // setMsg unmarshals PatternFlowIpv6FlowLabelRandom from protobuf object *otg.PatternFlowIpv6FlowLabelRandom - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6FlowLabelRandom) PatternFlowIpv6FlowLabelRandom - // provides marshal interface - Marshal() marshalPatternFlowIpv6FlowLabelRandom - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6FlowLabelRandom - // validate validates PatternFlowIpv6FlowLabelRandom - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6FlowLabelRandom, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Min returns uint32, set in PatternFlowIpv6FlowLabelRandom. - Min() uint32 - // SetMin assigns uint32 provided by user to PatternFlowIpv6FlowLabelRandom - SetMin(value uint32) PatternFlowIpv6FlowLabelRandom - // HasMin checks if Min has been set in PatternFlowIpv6FlowLabelRandom - HasMin() bool - // Max returns uint32, set in PatternFlowIpv6FlowLabelRandom. - Max() uint32 - // SetMax assigns uint32 provided by user to PatternFlowIpv6FlowLabelRandom - SetMax(value uint32) PatternFlowIpv6FlowLabelRandom - // HasMax checks if Max has been set in PatternFlowIpv6FlowLabelRandom - HasMax() bool - // Seed returns uint32, set in PatternFlowIpv6FlowLabelRandom. - Seed() uint32 - // SetSeed assigns uint32 provided by user to PatternFlowIpv6FlowLabelRandom - SetSeed(value uint32) PatternFlowIpv6FlowLabelRandom - // HasSeed checks if Seed has been set in PatternFlowIpv6FlowLabelRandom - HasSeed() bool - // Count returns uint32, set in PatternFlowIpv6FlowLabelRandom. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv6FlowLabelRandom - SetCount(value uint32) PatternFlowIpv6FlowLabelRandom - // HasCount checks if Count has been set in PatternFlowIpv6FlowLabelRandom - HasCount() bool -} - -// The minimum possible value generated by the random value generator. -// Min returns a uint32 -func (obj *patternFlowIpv6FlowLabelRandom) Min() uint32 { - - return *obj.obj.Min - -} - -// The minimum possible value generated by the random value generator. -// Min returns a uint32 -func (obj *patternFlowIpv6FlowLabelRandom) HasMin() bool { - return obj.obj.Min != nil -} - -// The minimum possible value generated by the random value generator. -// SetMin sets the uint32 value in the PatternFlowIpv6FlowLabelRandom object -func (obj *patternFlowIpv6FlowLabelRandom) SetMin(value uint32) PatternFlowIpv6FlowLabelRandom { - - obj.obj.Min = &value - return obj -} - -// The maximum possible value generated by the random value generator. -// Max returns a uint32 -func (obj *patternFlowIpv6FlowLabelRandom) Max() uint32 { - - return *obj.obj.Max - -} - -// The maximum possible value generated by the random value generator. -// Max returns a uint32 -func (obj *patternFlowIpv6FlowLabelRandom) HasMax() bool { - return obj.obj.Max != nil -} - -// The maximum possible value generated by the random value generator. -// SetMax sets the uint32 value in the PatternFlowIpv6FlowLabelRandom object -func (obj *patternFlowIpv6FlowLabelRandom) SetMax(value uint32) PatternFlowIpv6FlowLabelRandom { - - obj.obj.Max = &value - return obj -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// Seed returns a uint32 -func (obj *patternFlowIpv6FlowLabelRandom) Seed() uint32 { - - return *obj.obj.Seed - -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// Seed returns a uint32 -func (obj *patternFlowIpv6FlowLabelRandom) HasSeed() bool { - return obj.obj.Seed != nil -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// SetSeed sets the uint32 value in the PatternFlowIpv6FlowLabelRandom object -func (obj *patternFlowIpv6FlowLabelRandom) SetSeed(value uint32) PatternFlowIpv6FlowLabelRandom { - - obj.obj.Seed = &value - return obj -} - -// The total number of values to be generated by the random value generator. -// Count returns a uint32 -func (obj *patternFlowIpv6FlowLabelRandom) Count() uint32 { - - return *obj.obj.Count - -} - -// The total number of values to be generated by the random value generator. -// Count returns a uint32 -func (obj *patternFlowIpv6FlowLabelRandom) HasCount() bool { - return obj.obj.Count != nil -} - -// The total number of values to be generated by the random value generator. -// SetCount sets the uint32 value in the PatternFlowIpv6FlowLabelRandom object -func (obj *patternFlowIpv6FlowLabelRandom) SetCount(value uint32) PatternFlowIpv6FlowLabelRandom { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv6FlowLabelRandom) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Min != nil { - - if *obj.obj.Min > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6FlowLabelRandom.Min <= 1048575 but Got %d", *obj.obj.Min)) - } - - } - - if obj.obj.Max != nil { - - if *obj.obj.Max > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6FlowLabelRandom.Max <= 1048575 but Got %d", *obj.obj.Max)) - } - - } - -} - -func (obj *patternFlowIpv6FlowLabelRandom) setDefault() { - if obj.obj.Min == nil { - obj.SetMin(0) - } - if obj.obj.Max == nil { - obj.SetMax(1048575) - } - if obj.obj.Seed == nil { - obj.SetSeed(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv6PayloadLengthCounter ***** -type patternFlowIpv6PayloadLengthCounter struct { - validation - obj *otg.PatternFlowIpv6PayloadLengthCounter - marshaller marshalPatternFlowIpv6PayloadLengthCounter - unMarshaller unMarshalPatternFlowIpv6PayloadLengthCounter -} - -func NewPatternFlowIpv6PayloadLengthCounter() PatternFlowIpv6PayloadLengthCounter { - obj := patternFlowIpv6PayloadLengthCounter{obj: &otg.PatternFlowIpv6PayloadLengthCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6PayloadLengthCounter) msg() *otg.PatternFlowIpv6PayloadLengthCounter { - return obj.obj -} - -func (obj *patternFlowIpv6PayloadLengthCounter) setMsg(msg *otg.PatternFlowIpv6PayloadLengthCounter) PatternFlowIpv6PayloadLengthCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6PayloadLengthCounter struct { - obj *patternFlowIpv6PayloadLengthCounter -} - -type marshalPatternFlowIpv6PayloadLengthCounter interface { - // ToProto marshals PatternFlowIpv6PayloadLengthCounter to protobuf object *otg.PatternFlowIpv6PayloadLengthCounter - ToProto() (*otg.PatternFlowIpv6PayloadLengthCounter, error) - // ToPbText marshals PatternFlowIpv6PayloadLengthCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6PayloadLengthCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6PayloadLengthCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6PayloadLengthCounter struct { - obj *patternFlowIpv6PayloadLengthCounter -} - -type unMarshalPatternFlowIpv6PayloadLengthCounter interface { - // FromProto unmarshals PatternFlowIpv6PayloadLengthCounter from protobuf object *otg.PatternFlowIpv6PayloadLengthCounter - FromProto(msg *otg.PatternFlowIpv6PayloadLengthCounter) (PatternFlowIpv6PayloadLengthCounter, error) - // FromPbText unmarshals PatternFlowIpv6PayloadLengthCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6PayloadLengthCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6PayloadLengthCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6PayloadLengthCounter) Marshal() marshalPatternFlowIpv6PayloadLengthCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6PayloadLengthCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6PayloadLengthCounter) Unmarshal() unMarshalPatternFlowIpv6PayloadLengthCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6PayloadLengthCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6PayloadLengthCounter) ToProto() (*otg.PatternFlowIpv6PayloadLengthCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6PayloadLengthCounter) FromProto(msg *otg.PatternFlowIpv6PayloadLengthCounter) (PatternFlowIpv6PayloadLengthCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6PayloadLengthCounter) 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 *unMarshalpatternFlowIpv6PayloadLengthCounter) 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 *marshalpatternFlowIpv6PayloadLengthCounter) 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 *unMarshalpatternFlowIpv6PayloadLengthCounter) 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 *marshalpatternFlowIpv6PayloadLengthCounter) 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 *unMarshalpatternFlowIpv6PayloadLengthCounter) 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 *patternFlowIpv6PayloadLengthCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6PayloadLengthCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6PayloadLengthCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6PayloadLengthCounter) Clone() (PatternFlowIpv6PayloadLengthCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6PayloadLengthCounter() - 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 -} - -// PatternFlowIpv6PayloadLengthCounter is integer counter pattern -type PatternFlowIpv6PayloadLengthCounter interface { - Validation - // msg marshals PatternFlowIpv6PayloadLengthCounter to protobuf object *otg.PatternFlowIpv6PayloadLengthCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv6PayloadLengthCounter - // setMsg unmarshals PatternFlowIpv6PayloadLengthCounter from protobuf object *otg.PatternFlowIpv6PayloadLengthCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6PayloadLengthCounter) PatternFlowIpv6PayloadLengthCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv6PayloadLengthCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6PayloadLengthCounter - // validate validates PatternFlowIpv6PayloadLengthCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6PayloadLengthCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv6PayloadLengthCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv6PayloadLengthCounter - SetStart(value uint32) PatternFlowIpv6PayloadLengthCounter - // HasStart checks if Start has been set in PatternFlowIpv6PayloadLengthCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv6PayloadLengthCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv6PayloadLengthCounter - SetStep(value uint32) PatternFlowIpv6PayloadLengthCounter - // HasStep checks if Step has been set in PatternFlowIpv6PayloadLengthCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv6PayloadLengthCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv6PayloadLengthCounter - SetCount(value uint32) PatternFlowIpv6PayloadLengthCounter - // HasCount checks if Count has been set in PatternFlowIpv6PayloadLengthCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv6PayloadLengthCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv6PayloadLengthCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv6PayloadLengthCounter object -func (obj *patternFlowIpv6PayloadLengthCounter) SetStart(value uint32) PatternFlowIpv6PayloadLengthCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv6PayloadLengthCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv6PayloadLengthCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv6PayloadLengthCounter object -func (obj *patternFlowIpv6PayloadLengthCounter) SetStep(value uint32) PatternFlowIpv6PayloadLengthCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6PayloadLengthCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6PayloadLengthCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv6PayloadLengthCounter object -func (obj *patternFlowIpv6PayloadLengthCounter) SetCount(value uint32) PatternFlowIpv6PayloadLengthCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv6PayloadLengthCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6PayloadLengthCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6PayloadLengthCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6PayloadLengthCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv6PayloadLengthCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv6PayloadLengthMetricTag ***** -type patternFlowIpv6PayloadLengthMetricTag struct { - validation - obj *otg.PatternFlowIpv6PayloadLengthMetricTag - marshaller marshalPatternFlowIpv6PayloadLengthMetricTag - unMarshaller unMarshalPatternFlowIpv6PayloadLengthMetricTag -} - -func NewPatternFlowIpv6PayloadLengthMetricTag() PatternFlowIpv6PayloadLengthMetricTag { - obj := patternFlowIpv6PayloadLengthMetricTag{obj: &otg.PatternFlowIpv6PayloadLengthMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6PayloadLengthMetricTag) msg() *otg.PatternFlowIpv6PayloadLengthMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv6PayloadLengthMetricTag) setMsg(msg *otg.PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6PayloadLengthMetricTag struct { - obj *patternFlowIpv6PayloadLengthMetricTag -} - -type marshalPatternFlowIpv6PayloadLengthMetricTag interface { - // ToProto marshals PatternFlowIpv6PayloadLengthMetricTag to protobuf object *otg.PatternFlowIpv6PayloadLengthMetricTag - ToProto() (*otg.PatternFlowIpv6PayloadLengthMetricTag, error) - // ToPbText marshals PatternFlowIpv6PayloadLengthMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6PayloadLengthMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6PayloadLengthMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6PayloadLengthMetricTag struct { - obj *patternFlowIpv6PayloadLengthMetricTag -} - -type unMarshalPatternFlowIpv6PayloadLengthMetricTag interface { - // FromProto unmarshals PatternFlowIpv6PayloadLengthMetricTag from protobuf object *otg.PatternFlowIpv6PayloadLengthMetricTag - FromProto(msg *otg.PatternFlowIpv6PayloadLengthMetricTag) (PatternFlowIpv6PayloadLengthMetricTag, error) - // FromPbText unmarshals PatternFlowIpv6PayloadLengthMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6PayloadLengthMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6PayloadLengthMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6PayloadLengthMetricTag) Marshal() marshalPatternFlowIpv6PayloadLengthMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6PayloadLengthMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6PayloadLengthMetricTag) Unmarshal() unMarshalPatternFlowIpv6PayloadLengthMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6PayloadLengthMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6PayloadLengthMetricTag) ToProto() (*otg.PatternFlowIpv6PayloadLengthMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6PayloadLengthMetricTag) FromProto(msg *otg.PatternFlowIpv6PayloadLengthMetricTag) (PatternFlowIpv6PayloadLengthMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6PayloadLengthMetricTag) 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 *unMarshalpatternFlowIpv6PayloadLengthMetricTag) 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 *marshalpatternFlowIpv6PayloadLengthMetricTag) 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 *unMarshalpatternFlowIpv6PayloadLengthMetricTag) 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 *marshalpatternFlowIpv6PayloadLengthMetricTag) 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 *unMarshalpatternFlowIpv6PayloadLengthMetricTag) 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 *patternFlowIpv6PayloadLengthMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6PayloadLengthMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6PayloadLengthMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6PayloadLengthMetricTag) Clone() (PatternFlowIpv6PayloadLengthMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6PayloadLengthMetricTag() - 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 -} - -// PatternFlowIpv6PayloadLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv6PayloadLengthMetricTag interface { - Validation - // msg marshals PatternFlowIpv6PayloadLengthMetricTag to protobuf object *otg.PatternFlowIpv6PayloadLengthMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv6PayloadLengthMetricTag - // setMsg unmarshals PatternFlowIpv6PayloadLengthMetricTag from protobuf object *otg.PatternFlowIpv6PayloadLengthMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv6PayloadLengthMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6PayloadLengthMetricTag - // validate validates PatternFlowIpv6PayloadLengthMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6PayloadLengthMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv6PayloadLengthMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv6PayloadLengthMetricTag - SetName(value string) PatternFlowIpv6PayloadLengthMetricTag - // Offset returns uint32, set in PatternFlowIpv6PayloadLengthMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv6PayloadLengthMetricTag - SetOffset(value uint32) PatternFlowIpv6PayloadLengthMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv6PayloadLengthMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv6PayloadLengthMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv6PayloadLengthMetricTag - SetLength(value uint32) PatternFlowIpv6PayloadLengthMetricTag - // HasLength checks if Length has been set in PatternFlowIpv6PayloadLengthMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv6PayloadLengthMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv6PayloadLengthMetricTag object -func (obj *patternFlowIpv6PayloadLengthMetricTag) SetName(value string) PatternFlowIpv6PayloadLengthMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6PayloadLengthMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6PayloadLengthMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv6PayloadLengthMetricTag object -func (obj *patternFlowIpv6PayloadLengthMetricTag) SetOffset(value uint32) PatternFlowIpv6PayloadLengthMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6PayloadLengthMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6PayloadLengthMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv6PayloadLengthMetricTag object -func (obj *patternFlowIpv6PayloadLengthMetricTag) SetLength(value uint32) PatternFlowIpv6PayloadLengthMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv6PayloadLengthMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6PayloadLengthMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6PayloadLengthMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv6PayloadLengthMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv6PayloadLengthMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowIpv6NextHeaderCounter ***** -type patternFlowIpv6NextHeaderCounter struct { - validation - obj *otg.PatternFlowIpv6NextHeaderCounter - marshaller marshalPatternFlowIpv6NextHeaderCounter - unMarshaller unMarshalPatternFlowIpv6NextHeaderCounter -} - -func NewPatternFlowIpv6NextHeaderCounter() PatternFlowIpv6NextHeaderCounter { - obj := patternFlowIpv6NextHeaderCounter{obj: &otg.PatternFlowIpv6NextHeaderCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6NextHeaderCounter) msg() *otg.PatternFlowIpv6NextHeaderCounter { - return obj.obj -} - -func (obj *patternFlowIpv6NextHeaderCounter) setMsg(msg *otg.PatternFlowIpv6NextHeaderCounter) PatternFlowIpv6NextHeaderCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6NextHeaderCounter struct { - obj *patternFlowIpv6NextHeaderCounter -} - -type marshalPatternFlowIpv6NextHeaderCounter interface { - // ToProto marshals PatternFlowIpv6NextHeaderCounter to protobuf object *otg.PatternFlowIpv6NextHeaderCounter - ToProto() (*otg.PatternFlowIpv6NextHeaderCounter, error) - // ToPbText marshals PatternFlowIpv6NextHeaderCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6NextHeaderCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6NextHeaderCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6NextHeaderCounter struct { - obj *patternFlowIpv6NextHeaderCounter -} - -type unMarshalPatternFlowIpv6NextHeaderCounter interface { - // FromProto unmarshals PatternFlowIpv6NextHeaderCounter from protobuf object *otg.PatternFlowIpv6NextHeaderCounter - FromProto(msg *otg.PatternFlowIpv6NextHeaderCounter) (PatternFlowIpv6NextHeaderCounter, error) - // FromPbText unmarshals PatternFlowIpv6NextHeaderCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6NextHeaderCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6NextHeaderCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6NextHeaderCounter) Marshal() marshalPatternFlowIpv6NextHeaderCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6NextHeaderCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6NextHeaderCounter) Unmarshal() unMarshalPatternFlowIpv6NextHeaderCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6NextHeaderCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6NextHeaderCounter) ToProto() (*otg.PatternFlowIpv6NextHeaderCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6NextHeaderCounter) FromProto(msg *otg.PatternFlowIpv6NextHeaderCounter) (PatternFlowIpv6NextHeaderCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6NextHeaderCounter) 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 *unMarshalpatternFlowIpv6NextHeaderCounter) 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 *marshalpatternFlowIpv6NextHeaderCounter) 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 *unMarshalpatternFlowIpv6NextHeaderCounter) 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 *marshalpatternFlowIpv6NextHeaderCounter) 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 *unMarshalpatternFlowIpv6NextHeaderCounter) 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 *patternFlowIpv6NextHeaderCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6NextHeaderCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6NextHeaderCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6NextHeaderCounter) Clone() (PatternFlowIpv6NextHeaderCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6NextHeaderCounter() - 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 -} - -// PatternFlowIpv6NextHeaderCounter is integer counter pattern -type PatternFlowIpv6NextHeaderCounter interface { - Validation - // msg marshals PatternFlowIpv6NextHeaderCounter to protobuf object *otg.PatternFlowIpv6NextHeaderCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv6NextHeaderCounter - // setMsg unmarshals PatternFlowIpv6NextHeaderCounter from protobuf object *otg.PatternFlowIpv6NextHeaderCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6NextHeaderCounter) PatternFlowIpv6NextHeaderCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv6NextHeaderCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6NextHeaderCounter - // validate validates PatternFlowIpv6NextHeaderCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6NextHeaderCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv6NextHeaderCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv6NextHeaderCounter - SetStart(value uint32) PatternFlowIpv6NextHeaderCounter - // HasStart checks if Start has been set in PatternFlowIpv6NextHeaderCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv6NextHeaderCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv6NextHeaderCounter - SetStep(value uint32) PatternFlowIpv6NextHeaderCounter - // HasStep checks if Step has been set in PatternFlowIpv6NextHeaderCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv6NextHeaderCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv6NextHeaderCounter - SetCount(value uint32) PatternFlowIpv6NextHeaderCounter - // HasCount checks if Count has been set in PatternFlowIpv6NextHeaderCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv6NextHeaderCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv6NextHeaderCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv6NextHeaderCounter object -func (obj *patternFlowIpv6NextHeaderCounter) SetStart(value uint32) PatternFlowIpv6NextHeaderCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv6NextHeaderCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv6NextHeaderCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv6NextHeaderCounter object -func (obj *patternFlowIpv6NextHeaderCounter) SetStep(value uint32) PatternFlowIpv6NextHeaderCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6NextHeaderCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6NextHeaderCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv6NextHeaderCounter object -func (obj *patternFlowIpv6NextHeaderCounter) SetCount(value uint32) PatternFlowIpv6NextHeaderCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv6NextHeaderCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6NextHeaderCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6NextHeaderCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6NextHeaderCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv6NextHeaderCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(59) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv6NextHeaderMetricTag ***** -type patternFlowIpv6NextHeaderMetricTag struct { - validation - obj *otg.PatternFlowIpv6NextHeaderMetricTag - marshaller marshalPatternFlowIpv6NextHeaderMetricTag - unMarshaller unMarshalPatternFlowIpv6NextHeaderMetricTag -} - -func NewPatternFlowIpv6NextHeaderMetricTag() PatternFlowIpv6NextHeaderMetricTag { - obj := patternFlowIpv6NextHeaderMetricTag{obj: &otg.PatternFlowIpv6NextHeaderMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6NextHeaderMetricTag) msg() *otg.PatternFlowIpv6NextHeaderMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv6NextHeaderMetricTag) setMsg(msg *otg.PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6NextHeaderMetricTag struct { - obj *patternFlowIpv6NextHeaderMetricTag -} - -type marshalPatternFlowIpv6NextHeaderMetricTag interface { - // ToProto marshals PatternFlowIpv6NextHeaderMetricTag to protobuf object *otg.PatternFlowIpv6NextHeaderMetricTag - ToProto() (*otg.PatternFlowIpv6NextHeaderMetricTag, error) - // ToPbText marshals PatternFlowIpv6NextHeaderMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6NextHeaderMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6NextHeaderMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6NextHeaderMetricTag struct { - obj *patternFlowIpv6NextHeaderMetricTag -} - -type unMarshalPatternFlowIpv6NextHeaderMetricTag interface { - // FromProto unmarshals PatternFlowIpv6NextHeaderMetricTag from protobuf object *otg.PatternFlowIpv6NextHeaderMetricTag - FromProto(msg *otg.PatternFlowIpv6NextHeaderMetricTag) (PatternFlowIpv6NextHeaderMetricTag, error) - // FromPbText unmarshals PatternFlowIpv6NextHeaderMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6NextHeaderMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6NextHeaderMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6NextHeaderMetricTag) Marshal() marshalPatternFlowIpv6NextHeaderMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6NextHeaderMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6NextHeaderMetricTag) Unmarshal() unMarshalPatternFlowIpv6NextHeaderMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6NextHeaderMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6NextHeaderMetricTag) ToProto() (*otg.PatternFlowIpv6NextHeaderMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6NextHeaderMetricTag) FromProto(msg *otg.PatternFlowIpv6NextHeaderMetricTag) (PatternFlowIpv6NextHeaderMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6NextHeaderMetricTag) 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 *unMarshalpatternFlowIpv6NextHeaderMetricTag) 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 *marshalpatternFlowIpv6NextHeaderMetricTag) 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 *unMarshalpatternFlowIpv6NextHeaderMetricTag) 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 *marshalpatternFlowIpv6NextHeaderMetricTag) 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 *unMarshalpatternFlowIpv6NextHeaderMetricTag) 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 *patternFlowIpv6NextHeaderMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6NextHeaderMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6NextHeaderMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6NextHeaderMetricTag) Clone() (PatternFlowIpv6NextHeaderMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6NextHeaderMetricTag() - 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 -} - -// PatternFlowIpv6NextHeaderMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv6NextHeaderMetricTag interface { - Validation - // msg marshals PatternFlowIpv6NextHeaderMetricTag to protobuf object *otg.PatternFlowIpv6NextHeaderMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv6NextHeaderMetricTag - // setMsg unmarshals PatternFlowIpv6NextHeaderMetricTag from protobuf object *otg.PatternFlowIpv6NextHeaderMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv6NextHeaderMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6NextHeaderMetricTag - // validate validates PatternFlowIpv6NextHeaderMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6NextHeaderMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv6NextHeaderMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv6NextHeaderMetricTag - SetName(value string) PatternFlowIpv6NextHeaderMetricTag - // Offset returns uint32, set in PatternFlowIpv6NextHeaderMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv6NextHeaderMetricTag - SetOffset(value uint32) PatternFlowIpv6NextHeaderMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv6NextHeaderMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv6NextHeaderMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv6NextHeaderMetricTag - SetLength(value uint32) PatternFlowIpv6NextHeaderMetricTag - // HasLength checks if Length has been set in PatternFlowIpv6NextHeaderMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv6NextHeaderMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv6NextHeaderMetricTag object -func (obj *patternFlowIpv6NextHeaderMetricTag) SetName(value string) PatternFlowIpv6NextHeaderMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6NextHeaderMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6NextHeaderMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv6NextHeaderMetricTag object -func (obj *patternFlowIpv6NextHeaderMetricTag) SetOffset(value uint32) PatternFlowIpv6NextHeaderMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6NextHeaderMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6NextHeaderMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv6NextHeaderMetricTag object -func (obj *patternFlowIpv6NextHeaderMetricTag) SetLength(value uint32) PatternFlowIpv6NextHeaderMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv6NextHeaderMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6NextHeaderMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6NextHeaderMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv6NextHeaderMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv6NextHeaderMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowIpv6HopLimitCounter ***** -type patternFlowIpv6HopLimitCounter struct { - validation - obj *otg.PatternFlowIpv6HopLimitCounter - marshaller marshalPatternFlowIpv6HopLimitCounter - unMarshaller unMarshalPatternFlowIpv6HopLimitCounter -} - -func NewPatternFlowIpv6HopLimitCounter() PatternFlowIpv6HopLimitCounter { - obj := patternFlowIpv6HopLimitCounter{obj: &otg.PatternFlowIpv6HopLimitCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6HopLimitCounter) msg() *otg.PatternFlowIpv6HopLimitCounter { - return obj.obj -} - -func (obj *patternFlowIpv6HopLimitCounter) setMsg(msg *otg.PatternFlowIpv6HopLimitCounter) PatternFlowIpv6HopLimitCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6HopLimitCounter struct { - obj *patternFlowIpv6HopLimitCounter -} - -type marshalPatternFlowIpv6HopLimitCounter interface { - // ToProto marshals PatternFlowIpv6HopLimitCounter to protobuf object *otg.PatternFlowIpv6HopLimitCounter - ToProto() (*otg.PatternFlowIpv6HopLimitCounter, error) - // ToPbText marshals PatternFlowIpv6HopLimitCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6HopLimitCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6HopLimitCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6HopLimitCounter struct { - obj *patternFlowIpv6HopLimitCounter -} - -type unMarshalPatternFlowIpv6HopLimitCounter interface { - // FromProto unmarshals PatternFlowIpv6HopLimitCounter from protobuf object *otg.PatternFlowIpv6HopLimitCounter - FromProto(msg *otg.PatternFlowIpv6HopLimitCounter) (PatternFlowIpv6HopLimitCounter, error) - // FromPbText unmarshals PatternFlowIpv6HopLimitCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6HopLimitCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6HopLimitCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6HopLimitCounter) Marshal() marshalPatternFlowIpv6HopLimitCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6HopLimitCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6HopLimitCounter) Unmarshal() unMarshalPatternFlowIpv6HopLimitCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6HopLimitCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6HopLimitCounter) ToProto() (*otg.PatternFlowIpv6HopLimitCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6HopLimitCounter) FromProto(msg *otg.PatternFlowIpv6HopLimitCounter) (PatternFlowIpv6HopLimitCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6HopLimitCounter) 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 *unMarshalpatternFlowIpv6HopLimitCounter) 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 *marshalpatternFlowIpv6HopLimitCounter) 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 *unMarshalpatternFlowIpv6HopLimitCounter) 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 *marshalpatternFlowIpv6HopLimitCounter) 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 *unMarshalpatternFlowIpv6HopLimitCounter) 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 *patternFlowIpv6HopLimitCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6HopLimitCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6HopLimitCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6HopLimitCounter) Clone() (PatternFlowIpv6HopLimitCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6HopLimitCounter() - 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 -} - -// PatternFlowIpv6HopLimitCounter is integer counter pattern -type PatternFlowIpv6HopLimitCounter interface { - Validation - // msg marshals PatternFlowIpv6HopLimitCounter to protobuf object *otg.PatternFlowIpv6HopLimitCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv6HopLimitCounter - // setMsg unmarshals PatternFlowIpv6HopLimitCounter from protobuf object *otg.PatternFlowIpv6HopLimitCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6HopLimitCounter) PatternFlowIpv6HopLimitCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv6HopLimitCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6HopLimitCounter - // validate validates PatternFlowIpv6HopLimitCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6HopLimitCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv6HopLimitCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv6HopLimitCounter - SetStart(value uint32) PatternFlowIpv6HopLimitCounter - // HasStart checks if Start has been set in PatternFlowIpv6HopLimitCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv6HopLimitCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv6HopLimitCounter - SetStep(value uint32) PatternFlowIpv6HopLimitCounter - // HasStep checks if Step has been set in PatternFlowIpv6HopLimitCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv6HopLimitCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv6HopLimitCounter - SetCount(value uint32) PatternFlowIpv6HopLimitCounter - // HasCount checks if Count has been set in PatternFlowIpv6HopLimitCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv6HopLimitCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv6HopLimitCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv6HopLimitCounter object -func (obj *patternFlowIpv6HopLimitCounter) SetStart(value uint32) PatternFlowIpv6HopLimitCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv6HopLimitCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv6HopLimitCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv6HopLimitCounter object -func (obj *patternFlowIpv6HopLimitCounter) SetStep(value uint32) PatternFlowIpv6HopLimitCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6HopLimitCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6HopLimitCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv6HopLimitCounter object -func (obj *patternFlowIpv6HopLimitCounter) SetCount(value uint32) PatternFlowIpv6HopLimitCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv6HopLimitCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6HopLimitCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6HopLimitCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6HopLimitCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv6HopLimitCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(64) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv6HopLimitMetricTag ***** -type patternFlowIpv6HopLimitMetricTag struct { - validation - obj *otg.PatternFlowIpv6HopLimitMetricTag - marshaller marshalPatternFlowIpv6HopLimitMetricTag - unMarshaller unMarshalPatternFlowIpv6HopLimitMetricTag -} - -func NewPatternFlowIpv6HopLimitMetricTag() PatternFlowIpv6HopLimitMetricTag { - obj := patternFlowIpv6HopLimitMetricTag{obj: &otg.PatternFlowIpv6HopLimitMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6HopLimitMetricTag) msg() *otg.PatternFlowIpv6HopLimitMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv6HopLimitMetricTag) setMsg(msg *otg.PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6HopLimitMetricTag struct { - obj *patternFlowIpv6HopLimitMetricTag -} - -type marshalPatternFlowIpv6HopLimitMetricTag interface { - // ToProto marshals PatternFlowIpv6HopLimitMetricTag to protobuf object *otg.PatternFlowIpv6HopLimitMetricTag - ToProto() (*otg.PatternFlowIpv6HopLimitMetricTag, error) - // ToPbText marshals PatternFlowIpv6HopLimitMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6HopLimitMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6HopLimitMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6HopLimitMetricTag struct { - obj *patternFlowIpv6HopLimitMetricTag -} - -type unMarshalPatternFlowIpv6HopLimitMetricTag interface { - // FromProto unmarshals PatternFlowIpv6HopLimitMetricTag from protobuf object *otg.PatternFlowIpv6HopLimitMetricTag - FromProto(msg *otg.PatternFlowIpv6HopLimitMetricTag) (PatternFlowIpv6HopLimitMetricTag, error) - // FromPbText unmarshals PatternFlowIpv6HopLimitMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6HopLimitMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6HopLimitMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6HopLimitMetricTag) Marshal() marshalPatternFlowIpv6HopLimitMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6HopLimitMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6HopLimitMetricTag) Unmarshal() unMarshalPatternFlowIpv6HopLimitMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6HopLimitMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6HopLimitMetricTag) ToProto() (*otg.PatternFlowIpv6HopLimitMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6HopLimitMetricTag) FromProto(msg *otg.PatternFlowIpv6HopLimitMetricTag) (PatternFlowIpv6HopLimitMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6HopLimitMetricTag) 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 *unMarshalpatternFlowIpv6HopLimitMetricTag) 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 *marshalpatternFlowIpv6HopLimitMetricTag) 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 *unMarshalpatternFlowIpv6HopLimitMetricTag) 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 *marshalpatternFlowIpv6HopLimitMetricTag) 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 *unMarshalpatternFlowIpv6HopLimitMetricTag) 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 *patternFlowIpv6HopLimitMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6HopLimitMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6HopLimitMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6HopLimitMetricTag) Clone() (PatternFlowIpv6HopLimitMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6HopLimitMetricTag() - 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 -} - -// PatternFlowIpv6HopLimitMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv6HopLimitMetricTag interface { - Validation - // msg marshals PatternFlowIpv6HopLimitMetricTag to protobuf object *otg.PatternFlowIpv6HopLimitMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv6HopLimitMetricTag - // setMsg unmarshals PatternFlowIpv6HopLimitMetricTag from protobuf object *otg.PatternFlowIpv6HopLimitMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv6HopLimitMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6HopLimitMetricTag - // validate validates PatternFlowIpv6HopLimitMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6HopLimitMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv6HopLimitMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv6HopLimitMetricTag - SetName(value string) PatternFlowIpv6HopLimitMetricTag - // Offset returns uint32, set in PatternFlowIpv6HopLimitMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv6HopLimitMetricTag - SetOffset(value uint32) PatternFlowIpv6HopLimitMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv6HopLimitMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv6HopLimitMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv6HopLimitMetricTag - SetLength(value uint32) PatternFlowIpv6HopLimitMetricTag - // HasLength checks if Length has been set in PatternFlowIpv6HopLimitMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv6HopLimitMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv6HopLimitMetricTag object -func (obj *patternFlowIpv6HopLimitMetricTag) SetName(value string) PatternFlowIpv6HopLimitMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6HopLimitMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6HopLimitMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv6HopLimitMetricTag object -func (obj *patternFlowIpv6HopLimitMetricTag) SetOffset(value uint32) PatternFlowIpv6HopLimitMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6HopLimitMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6HopLimitMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv6HopLimitMetricTag object -func (obj *patternFlowIpv6HopLimitMetricTag) SetLength(value uint32) PatternFlowIpv6HopLimitMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv6HopLimitMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6HopLimitMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6HopLimitMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv6HopLimitMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv6HopLimitMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowIpv6SrcCounter ***** -type patternFlowIpv6SrcCounter struct { - validation - obj *otg.PatternFlowIpv6SrcCounter - marshaller marshalPatternFlowIpv6SrcCounter - unMarshaller unMarshalPatternFlowIpv6SrcCounter -} - -func NewPatternFlowIpv6SrcCounter() PatternFlowIpv6SrcCounter { - obj := patternFlowIpv6SrcCounter{obj: &otg.PatternFlowIpv6SrcCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6SrcCounter) msg() *otg.PatternFlowIpv6SrcCounter { - return obj.obj -} - -func (obj *patternFlowIpv6SrcCounter) setMsg(msg *otg.PatternFlowIpv6SrcCounter) PatternFlowIpv6SrcCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6SrcCounter struct { - obj *patternFlowIpv6SrcCounter -} - -type marshalPatternFlowIpv6SrcCounter interface { - // ToProto marshals PatternFlowIpv6SrcCounter to protobuf object *otg.PatternFlowIpv6SrcCounter - ToProto() (*otg.PatternFlowIpv6SrcCounter, error) - // ToPbText marshals PatternFlowIpv6SrcCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6SrcCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6SrcCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6SrcCounter struct { - obj *patternFlowIpv6SrcCounter -} - -type unMarshalPatternFlowIpv6SrcCounter interface { - // FromProto unmarshals PatternFlowIpv6SrcCounter from protobuf object *otg.PatternFlowIpv6SrcCounter - FromProto(msg *otg.PatternFlowIpv6SrcCounter) (PatternFlowIpv6SrcCounter, error) - // FromPbText unmarshals PatternFlowIpv6SrcCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6SrcCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6SrcCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6SrcCounter) Marshal() marshalPatternFlowIpv6SrcCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6SrcCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6SrcCounter) Unmarshal() unMarshalPatternFlowIpv6SrcCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6SrcCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6SrcCounter) ToProto() (*otg.PatternFlowIpv6SrcCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6SrcCounter) FromProto(msg *otg.PatternFlowIpv6SrcCounter) (PatternFlowIpv6SrcCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6SrcCounter) 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 *unMarshalpatternFlowIpv6SrcCounter) 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 *marshalpatternFlowIpv6SrcCounter) 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 *unMarshalpatternFlowIpv6SrcCounter) 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 *marshalpatternFlowIpv6SrcCounter) 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 *unMarshalpatternFlowIpv6SrcCounter) 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 *patternFlowIpv6SrcCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6SrcCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6SrcCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6SrcCounter) Clone() (PatternFlowIpv6SrcCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6SrcCounter() - 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 -} - -// PatternFlowIpv6SrcCounter is ipv6 counter pattern -type PatternFlowIpv6SrcCounter interface { - Validation - // msg marshals PatternFlowIpv6SrcCounter to protobuf object *otg.PatternFlowIpv6SrcCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv6SrcCounter - // setMsg unmarshals PatternFlowIpv6SrcCounter from protobuf object *otg.PatternFlowIpv6SrcCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6SrcCounter) PatternFlowIpv6SrcCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv6SrcCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6SrcCounter - // validate validates PatternFlowIpv6SrcCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6SrcCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowIpv6SrcCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowIpv6SrcCounter - SetStart(value string) PatternFlowIpv6SrcCounter - // HasStart checks if Start has been set in PatternFlowIpv6SrcCounter - HasStart() bool - // Step returns string, set in PatternFlowIpv6SrcCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowIpv6SrcCounter - SetStep(value string) PatternFlowIpv6SrcCounter - // HasStep checks if Step has been set in PatternFlowIpv6SrcCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv6SrcCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv6SrcCounter - SetCount(value uint32) PatternFlowIpv6SrcCounter - // HasCount checks if Count has been set in PatternFlowIpv6SrcCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowIpv6SrcCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowIpv6SrcCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowIpv6SrcCounter object -func (obj *patternFlowIpv6SrcCounter) SetStart(value string) PatternFlowIpv6SrcCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowIpv6SrcCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowIpv6SrcCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowIpv6SrcCounter object -func (obj *patternFlowIpv6SrcCounter) SetStep(value string) PatternFlowIpv6SrcCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6SrcCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6SrcCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv6SrcCounter object -func (obj *patternFlowIpv6SrcCounter) SetCount(value uint32) PatternFlowIpv6SrcCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv6SrcCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateIpv6(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6SrcCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateIpv6(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6SrcCounter.Step")) - } - - } - -} - -func (obj *patternFlowIpv6SrcCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("::0") - } - if obj.obj.Step == nil { - obj.SetStep("::1") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv6SrcMetricTag ***** -type patternFlowIpv6SrcMetricTag struct { - validation - obj *otg.PatternFlowIpv6SrcMetricTag - marshaller marshalPatternFlowIpv6SrcMetricTag - unMarshaller unMarshalPatternFlowIpv6SrcMetricTag -} - -func NewPatternFlowIpv6SrcMetricTag() PatternFlowIpv6SrcMetricTag { - obj := patternFlowIpv6SrcMetricTag{obj: &otg.PatternFlowIpv6SrcMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6SrcMetricTag) msg() *otg.PatternFlowIpv6SrcMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv6SrcMetricTag) setMsg(msg *otg.PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6SrcMetricTag struct { - obj *patternFlowIpv6SrcMetricTag -} - -type marshalPatternFlowIpv6SrcMetricTag interface { - // ToProto marshals PatternFlowIpv6SrcMetricTag to protobuf object *otg.PatternFlowIpv6SrcMetricTag - ToProto() (*otg.PatternFlowIpv6SrcMetricTag, error) - // ToPbText marshals PatternFlowIpv6SrcMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6SrcMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6SrcMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6SrcMetricTag struct { - obj *patternFlowIpv6SrcMetricTag -} - -type unMarshalPatternFlowIpv6SrcMetricTag interface { - // FromProto unmarshals PatternFlowIpv6SrcMetricTag from protobuf object *otg.PatternFlowIpv6SrcMetricTag - FromProto(msg *otg.PatternFlowIpv6SrcMetricTag) (PatternFlowIpv6SrcMetricTag, error) - // FromPbText unmarshals PatternFlowIpv6SrcMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6SrcMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6SrcMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6SrcMetricTag) Marshal() marshalPatternFlowIpv6SrcMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6SrcMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6SrcMetricTag) Unmarshal() unMarshalPatternFlowIpv6SrcMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6SrcMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6SrcMetricTag) ToProto() (*otg.PatternFlowIpv6SrcMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6SrcMetricTag) FromProto(msg *otg.PatternFlowIpv6SrcMetricTag) (PatternFlowIpv6SrcMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6SrcMetricTag) 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 *unMarshalpatternFlowIpv6SrcMetricTag) 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 *marshalpatternFlowIpv6SrcMetricTag) 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 *unMarshalpatternFlowIpv6SrcMetricTag) 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 *marshalpatternFlowIpv6SrcMetricTag) 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 *unMarshalpatternFlowIpv6SrcMetricTag) 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 *patternFlowIpv6SrcMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6SrcMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6SrcMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6SrcMetricTag) Clone() (PatternFlowIpv6SrcMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6SrcMetricTag() - 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 -} - -// PatternFlowIpv6SrcMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv6SrcMetricTag interface { - Validation - // msg marshals PatternFlowIpv6SrcMetricTag to protobuf object *otg.PatternFlowIpv6SrcMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv6SrcMetricTag - // setMsg unmarshals PatternFlowIpv6SrcMetricTag from protobuf object *otg.PatternFlowIpv6SrcMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv6SrcMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6SrcMetricTag - // validate validates PatternFlowIpv6SrcMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6SrcMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv6SrcMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv6SrcMetricTag - SetName(value string) PatternFlowIpv6SrcMetricTag - // Offset returns uint32, set in PatternFlowIpv6SrcMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv6SrcMetricTag - SetOffset(value uint32) PatternFlowIpv6SrcMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv6SrcMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv6SrcMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv6SrcMetricTag - SetLength(value uint32) PatternFlowIpv6SrcMetricTag - // HasLength checks if Length has been set in PatternFlowIpv6SrcMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv6SrcMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv6SrcMetricTag object -func (obj *patternFlowIpv6SrcMetricTag) SetName(value string) PatternFlowIpv6SrcMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6SrcMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6SrcMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv6SrcMetricTag object -func (obj *patternFlowIpv6SrcMetricTag) SetOffset(value uint32) PatternFlowIpv6SrcMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6SrcMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6SrcMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv6SrcMetricTag object -func (obj *patternFlowIpv6SrcMetricTag) SetLength(value uint32) PatternFlowIpv6SrcMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv6SrcMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6SrcMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 127 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6SrcMetricTag.Offset <= 127 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv6SrcMetricTag.Length <= 128 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv6SrcMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(128) - } - -} - -// ***** PatternFlowIpv6DstCounter ***** -type patternFlowIpv6DstCounter struct { - validation - obj *otg.PatternFlowIpv6DstCounter - marshaller marshalPatternFlowIpv6DstCounter - unMarshaller unMarshalPatternFlowIpv6DstCounter -} - -func NewPatternFlowIpv6DstCounter() PatternFlowIpv6DstCounter { - obj := patternFlowIpv6DstCounter{obj: &otg.PatternFlowIpv6DstCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6DstCounter) msg() *otg.PatternFlowIpv6DstCounter { - return obj.obj -} - -func (obj *patternFlowIpv6DstCounter) setMsg(msg *otg.PatternFlowIpv6DstCounter) PatternFlowIpv6DstCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6DstCounter struct { - obj *patternFlowIpv6DstCounter -} - -type marshalPatternFlowIpv6DstCounter interface { - // ToProto marshals PatternFlowIpv6DstCounter to protobuf object *otg.PatternFlowIpv6DstCounter - ToProto() (*otg.PatternFlowIpv6DstCounter, error) - // ToPbText marshals PatternFlowIpv6DstCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6DstCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6DstCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6DstCounter struct { - obj *patternFlowIpv6DstCounter -} - -type unMarshalPatternFlowIpv6DstCounter interface { - // FromProto unmarshals PatternFlowIpv6DstCounter from protobuf object *otg.PatternFlowIpv6DstCounter - FromProto(msg *otg.PatternFlowIpv6DstCounter) (PatternFlowIpv6DstCounter, error) - // FromPbText unmarshals PatternFlowIpv6DstCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6DstCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6DstCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6DstCounter) Marshal() marshalPatternFlowIpv6DstCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6DstCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6DstCounter) Unmarshal() unMarshalPatternFlowIpv6DstCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6DstCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6DstCounter) ToProto() (*otg.PatternFlowIpv6DstCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6DstCounter) FromProto(msg *otg.PatternFlowIpv6DstCounter) (PatternFlowIpv6DstCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6DstCounter) 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 *unMarshalpatternFlowIpv6DstCounter) 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 *marshalpatternFlowIpv6DstCounter) 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 *unMarshalpatternFlowIpv6DstCounter) 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 *marshalpatternFlowIpv6DstCounter) 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 *unMarshalpatternFlowIpv6DstCounter) 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 *patternFlowIpv6DstCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6DstCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6DstCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6DstCounter) Clone() (PatternFlowIpv6DstCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6DstCounter() - 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 -} - -// PatternFlowIpv6DstCounter is ipv6 counter pattern -type PatternFlowIpv6DstCounter interface { - Validation - // msg marshals PatternFlowIpv6DstCounter to protobuf object *otg.PatternFlowIpv6DstCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv6DstCounter - // setMsg unmarshals PatternFlowIpv6DstCounter from protobuf object *otg.PatternFlowIpv6DstCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6DstCounter) PatternFlowIpv6DstCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv6DstCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6DstCounter - // validate validates PatternFlowIpv6DstCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6DstCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowIpv6DstCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowIpv6DstCounter - SetStart(value string) PatternFlowIpv6DstCounter - // HasStart checks if Start has been set in PatternFlowIpv6DstCounter - HasStart() bool - // Step returns string, set in PatternFlowIpv6DstCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowIpv6DstCounter - SetStep(value string) PatternFlowIpv6DstCounter - // HasStep checks if Step has been set in PatternFlowIpv6DstCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv6DstCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv6DstCounter - SetCount(value uint32) PatternFlowIpv6DstCounter - // HasCount checks if Count has been set in PatternFlowIpv6DstCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowIpv6DstCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowIpv6DstCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowIpv6DstCounter object -func (obj *patternFlowIpv6DstCounter) SetStart(value string) PatternFlowIpv6DstCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowIpv6DstCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowIpv6DstCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowIpv6DstCounter object -func (obj *patternFlowIpv6DstCounter) SetStep(value string) PatternFlowIpv6DstCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6DstCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv6DstCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv6DstCounter object -func (obj *patternFlowIpv6DstCounter) SetCount(value uint32) PatternFlowIpv6DstCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv6DstCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateIpv6(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6DstCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateIpv6(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6DstCounter.Step")) - } - - } - -} - -func (obj *patternFlowIpv6DstCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("::0") - } - if obj.obj.Step == nil { - obj.SetStep("::1") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv6DstMetricTag ***** -type patternFlowIpv6DstMetricTag struct { - validation - obj *otg.PatternFlowIpv6DstMetricTag - marshaller marshalPatternFlowIpv6DstMetricTag - unMarshaller unMarshalPatternFlowIpv6DstMetricTag -} - -func NewPatternFlowIpv6DstMetricTag() PatternFlowIpv6DstMetricTag { - obj := patternFlowIpv6DstMetricTag{obj: &otg.PatternFlowIpv6DstMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv6DstMetricTag) msg() *otg.PatternFlowIpv6DstMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv6DstMetricTag) setMsg(msg *otg.PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv6DstMetricTag struct { - obj *patternFlowIpv6DstMetricTag -} - -type marshalPatternFlowIpv6DstMetricTag interface { - // ToProto marshals PatternFlowIpv6DstMetricTag to protobuf object *otg.PatternFlowIpv6DstMetricTag - ToProto() (*otg.PatternFlowIpv6DstMetricTag, error) - // ToPbText marshals PatternFlowIpv6DstMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv6DstMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv6DstMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv6DstMetricTag struct { - obj *patternFlowIpv6DstMetricTag -} - -type unMarshalPatternFlowIpv6DstMetricTag interface { - // FromProto unmarshals PatternFlowIpv6DstMetricTag from protobuf object *otg.PatternFlowIpv6DstMetricTag - FromProto(msg *otg.PatternFlowIpv6DstMetricTag) (PatternFlowIpv6DstMetricTag, error) - // FromPbText unmarshals PatternFlowIpv6DstMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv6DstMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv6DstMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv6DstMetricTag) Marshal() marshalPatternFlowIpv6DstMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv6DstMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv6DstMetricTag) Unmarshal() unMarshalPatternFlowIpv6DstMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv6DstMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv6DstMetricTag) ToProto() (*otg.PatternFlowIpv6DstMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv6DstMetricTag) FromProto(msg *otg.PatternFlowIpv6DstMetricTag) (PatternFlowIpv6DstMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv6DstMetricTag) 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 *unMarshalpatternFlowIpv6DstMetricTag) 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 *marshalpatternFlowIpv6DstMetricTag) 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 *unMarshalpatternFlowIpv6DstMetricTag) 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 *marshalpatternFlowIpv6DstMetricTag) 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 *unMarshalpatternFlowIpv6DstMetricTag) 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 *patternFlowIpv6DstMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv6DstMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv6DstMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv6DstMetricTag) Clone() (PatternFlowIpv6DstMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv6DstMetricTag() - 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 -} - -// PatternFlowIpv6DstMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv6DstMetricTag interface { - Validation - // msg marshals PatternFlowIpv6DstMetricTag to protobuf object *otg.PatternFlowIpv6DstMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv6DstMetricTag - // setMsg unmarshals PatternFlowIpv6DstMetricTag from protobuf object *otg.PatternFlowIpv6DstMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv6DstMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv6DstMetricTag - // validate validates PatternFlowIpv6DstMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv6DstMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv6DstMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv6DstMetricTag - SetName(value string) PatternFlowIpv6DstMetricTag - // Offset returns uint32, set in PatternFlowIpv6DstMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv6DstMetricTag - SetOffset(value uint32) PatternFlowIpv6DstMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv6DstMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv6DstMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv6DstMetricTag - SetLength(value uint32) PatternFlowIpv6DstMetricTag - // HasLength checks if Length has been set in PatternFlowIpv6DstMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv6DstMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv6DstMetricTag object -func (obj *patternFlowIpv6DstMetricTag) SetName(value string) PatternFlowIpv6DstMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6DstMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv6DstMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv6DstMetricTag object -func (obj *patternFlowIpv6DstMetricTag) SetOffset(value uint32) PatternFlowIpv6DstMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6DstMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv6DstMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv6DstMetricTag object -func (obj *patternFlowIpv6DstMetricTag) SetLength(value uint32) PatternFlowIpv6DstMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv6DstMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6DstMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 127 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv6DstMetricTag.Offset <= 127 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv6DstMetricTag.Length <= 128 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv6DstMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(128) - } - -} - -// ***** PatternFlowPfcPauseDstCounter ***** -type patternFlowPfcPauseDstCounter struct { - validation - obj *otg.PatternFlowPfcPauseDstCounter - marshaller marshalPatternFlowPfcPauseDstCounter - unMarshaller unMarshalPatternFlowPfcPauseDstCounter -} - -func NewPatternFlowPfcPauseDstCounter() PatternFlowPfcPauseDstCounter { - obj := patternFlowPfcPauseDstCounter{obj: &otg.PatternFlowPfcPauseDstCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseDstCounter) msg() *otg.PatternFlowPfcPauseDstCounter { - return obj.obj -} - -func (obj *patternFlowPfcPauseDstCounter) setMsg(msg *otg.PatternFlowPfcPauseDstCounter) PatternFlowPfcPauseDstCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseDstCounter struct { - obj *patternFlowPfcPauseDstCounter -} - -type marshalPatternFlowPfcPauseDstCounter interface { - // ToProto marshals PatternFlowPfcPauseDstCounter to protobuf object *otg.PatternFlowPfcPauseDstCounter - ToProto() (*otg.PatternFlowPfcPauseDstCounter, error) - // ToPbText marshals PatternFlowPfcPauseDstCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseDstCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseDstCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseDstCounter struct { - obj *patternFlowPfcPauseDstCounter -} - -type unMarshalPatternFlowPfcPauseDstCounter interface { - // FromProto unmarshals PatternFlowPfcPauseDstCounter from protobuf object *otg.PatternFlowPfcPauseDstCounter - FromProto(msg *otg.PatternFlowPfcPauseDstCounter) (PatternFlowPfcPauseDstCounter, error) - // FromPbText unmarshals PatternFlowPfcPauseDstCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseDstCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseDstCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseDstCounter) Marshal() marshalPatternFlowPfcPauseDstCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseDstCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseDstCounter) Unmarshal() unMarshalPatternFlowPfcPauseDstCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseDstCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseDstCounter) ToProto() (*otg.PatternFlowPfcPauseDstCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseDstCounter) FromProto(msg *otg.PatternFlowPfcPauseDstCounter) (PatternFlowPfcPauseDstCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseDstCounter) 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 *unMarshalpatternFlowPfcPauseDstCounter) 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 *marshalpatternFlowPfcPauseDstCounter) 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 *unMarshalpatternFlowPfcPauseDstCounter) 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 *marshalpatternFlowPfcPauseDstCounter) 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 *unMarshalpatternFlowPfcPauseDstCounter) 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 *patternFlowPfcPauseDstCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseDstCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseDstCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseDstCounter) Clone() (PatternFlowPfcPauseDstCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseDstCounter() - 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 -} - -// PatternFlowPfcPauseDstCounter is mac counter pattern -type PatternFlowPfcPauseDstCounter interface { - Validation - // msg marshals PatternFlowPfcPauseDstCounter to protobuf object *otg.PatternFlowPfcPauseDstCounter - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseDstCounter - // setMsg unmarshals PatternFlowPfcPauseDstCounter from protobuf object *otg.PatternFlowPfcPauseDstCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseDstCounter) PatternFlowPfcPauseDstCounter - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseDstCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseDstCounter - // validate validates PatternFlowPfcPauseDstCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseDstCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowPfcPauseDstCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowPfcPauseDstCounter - SetStart(value string) PatternFlowPfcPauseDstCounter - // HasStart checks if Start has been set in PatternFlowPfcPauseDstCounter - HasStart() bool - // Step returns string, set in PatternFlowPfcPauseDstCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowPfcPauseDstCounter - SetStep(value string) PatternFlowPfcPauseDstCounter - // HasStep checks if Step has been set in PatternFlowPfcPauseDstCounter - HasStep() bool - // Count returns uint32, set in PatternFlowPfcPauseDstCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPfcPauseDstCounter - SetCount(value uint32) PatternFlowPfcPauseDstCounter - // HasCount checks if Count has been set in PatternFlowPfcPauseDstCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowPfcPauseDstCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowPfcPauseDstCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowPfcPauseDstCounter object -func (obj *patternFlowPfcPauseDstCounter) SetStart(value string) PatternFlowPfcPauseDstCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowPfcPauseDstCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowPfcPauseDstCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowPfcPauseDstCounter object -func (obj *patternFlowPfcPauseDstCounter) SetStep(value string) PatternFlowPfcPauseDstCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPauseDstCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPauseDstCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPfcPauseDstCounter object -func (obj *patternFlowPfcPauseDstCounter) SetCount(value uint32) PatternFlowPfcPauseDstCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPfcPauseDstCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateMac(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseDstCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateMac(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseDstCounter.Step")) - } - - } - -} - -func (obj *patternFlowPfcPauseDstCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("01:80:c2:00:00:01") - } - if obj.obj.Step == nil { - obj.SetStep("00:00:00:00:00:01") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPfcPauseDstMetricTag ***** -type patternFlowPfcPauseDstMetricTag struct { - validation - obj *otg.PatternFlowPfcPauseDstMetricTag - marshaller marshalPatternFlowPfcPauseDstMetricTag - unMarshaller unMarshalPatternFlowPfcPauseDstMetricTag -} - -func NewPatternFlowPfcPauseDstMetricTag() PatternFlowPfcPauseDstMetricTag { - obj := patternFlowPfcPauseDstMetricTag{obj: &otg.PatternFlowPfcPauseDstMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseDstMetricTag) msg() *otg.PatternFlowPfcPauseDstMetricTag { - return obj.obj -} - -func (obj *patternFlowPfcPauseDstMetricTag) setMsg(msg *otg.PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseDstMetricTag struct { - obj *patternFlowPfcPauseDstMetricTag -} - -type marshalPatternFlowPfcPauseDstMetricTag interface { - // ToProto marshals PatternFlowPfcPauseDstMetricTag to protobuf object *otg.PatternFlowPfcPauseDstMetricTag - ToProto() (*otg.PatternFlowPfcPauseDstMetricTag, error) - // ToPbText marshals PatternFlowPfcPauseDstMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseDstMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseDstMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseDstMetricTag struct { - obj *patternFlowPfcPauseDstMetricTag -} - -type unMarshalPatternFlowPfcPauseDstMetricTag interface { - // FromProto unmarshals PatternFlowPfcPauseDstMetricTag from protobuf object *otg.PatternFlowPfcPauseDstMetricTag - FromProto(msg *otg.PatternFlowPfcPauseDstMetricTag) (PatternFlowPfcPauseDstMetricTag, error) - // FromPbText unmarshals PatternFlowPfcPauseDstMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseDstMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseDstMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseDstMetricTag) Marshal() marshalPatternFlowPfcPauseDstMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseDstMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseDstMetricTag) Unmarshal() unMarshalPatternFlowPfcPauseDstMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseDstMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseDstMetricTag) ToProto() (*otg.PatternFlowPfcPauseDstMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseDstMetricTag) FromProto(msg *otg.PatternFlowPfcPauseDstMetricTag) (PatternFlowPfcPauseDstMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseDstMetricTag) 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 *unMarshalpatternFlowPfcPauseDstMetricTag) 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 *marshalpatternFlowPfcPauseDstMetricTag) 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 *unMarshalpatternFlowPfcPauseDstMetricTag) 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 *marshalpatternFlowPfcPauseDstMetricTag) 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 *unMarshalpatternFlowPfcPauseDstMetricTag) 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 *patternFlowPfcPauseDstMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseDstMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseDstMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseDstMetricTag) Clone() (PatternFlowPfcPauseDstMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseDstMetricTag() - 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 -} - -// PatternFlowPfcPauseDstMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPfcPauseDstMetricTag interface { - Validation - // msg marshals PatternFlowPfcPauseDstMetricTag to protobuf object *otg.PatternFlowPfcPauseDstMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseDstMetricTag - // setMsg unmarshals PatternFlowPfcPauseDstMetricTag from protobuf object *otg.PatternFlowPfcPauseDstMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstMetricTag - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseDstMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseDstMetricTag - // validate validates PatternFlowPfcPauseDstMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseDstMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPfcPauseDstMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPfcPauseDstMetricTag - SetName(value string) PatternFlowPfcPauseDstMetricTag - // Offset returns uint32, set in PatternFlowPfcPauseDstMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPfcPauseDstMetricTag - SetOffset(value uint32) PatternFlowPfcPauseDstMetricTag - // HasOffset checks if Offset has been set in PatternFlowPfcPauseDstMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPfcPauseDstMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPfcPauseDstMetricTag - SetLength(value uint32) PatternFlowPfcPauseDstMetricTag - // HasLength checks if Length has been set in PatternFlowPfcPauseDstMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPfcPauseDstMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPfcPauseDstMetricTag object -func (obj *patternFlowPfcPauseDstMetricTag) SetName(value string) PatternFlowPfcPauseDstMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPauseDstMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPauseDstMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPfcPauseDstMetricTag object -func (obj *patternFlowPfcPauseDstMetricTag) SetOffset(value uint32) PatternFlowPfcPauseDstMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPauseDstMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPauseDstMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPfcPauseDstMetricTag object -func (obj *patternFlowPfcPauseDstMetricTag) SetLength(value uint32) PatternFlowPfcPauseDstMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPfcPauseDstMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPauseDstMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 47 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseDstMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 48 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPfcPauseDstMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPfcPauseDstMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(48) - } - -} - -// ***** PatternFlowPfcPauseSrcCounter ***** -type patternFlowPfcPauseSrcCounter struct { - validation - obj *otg.PatternFlowPfcPauseSrcCounter - marshaller marshalPatternFlowPfcPauseSrcCounter - unMarshaller unMarshalPatternFlowPfcPauseSrcCounter -} - -func NewPatternFlowPfcPauseSrcCounter() PatternFlowPfcPauseSrcCounter { - obj := patternFlowPfcPauseSrcCounter{obj: &otg.PatternFlowPfcPauseSrcCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseSrcCounter) msg() *otg.PatternFlowPfcPauseSrcCounter { - return obj.obj -} - -func (obj *patternFlowPfcPauseSrcCounter) setMsg(msg *otg.PatternFlowPfcPauseSrcCounter) PatternFlowPfcPauseSrcCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseSrcCounter struct { - obj *patternFlowPfcPauseSrcCounter -} - -type marshalPatternFlowPfcPauseSrcCounter interface { - // ToProto marshals PatternFlowPfcPauseSrcCounter to protobuf object *otg.PatternFlowPfcPauseSrcCounter - ToProto() (*otg.PatternFlowPfcPauseSrcCounter, error) - // ToPbText marshals PatternFlowPfcPauseSrcCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseSrcCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseSrcCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseSrcCounter struct { - obj *patternFlowPfcPauseSrcCounter -} - -type unMarshalPatternFlowPfcPauseSrcCounter interface { - // FromProto unmarshals PatternFlowPfcPauseSrcCounter from protobuf object *otg.PatternFlowPfcPauseSrcCounter - FromProto(msg *otg.PatternFlowPfcPauseSrcCounter) (PatternFlowPfcPauseSrcCounter, error) - // FromPbText unmarshals PatternFlowPfcPauseSrcCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseSrcCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseSrcCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseSrcCounter) Marshal() marshalPatternFlowPfcPauseSrcCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseSrcCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseSrcCounter) Unmarshal() unMarshalPatternFlowPfcPauseSrcCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseSrcCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseSrcCounter) ToProto() (*otg.PatternFlowPfcPauseSrcCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseSrcCounter) FromProto(msg *otg.PatternFlowPfcPauseSrcCounter) (PatternFlowPfcPauseSrcCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseSrcCounter) 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 *unMarshalpatternFlowPfcPauseSrcCounter) 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 *marshalpatternFlowPfcPauseSrcCounter) 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 *unMarshalpatternFlowPfcPauseSrcCounter) 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 *marshalpatternFlowPfcPauseSrcCounter) 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 *unMarshalpatternFlowPfcPauseSrcCounter) 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 *patternFlowPfcPauseSrcCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseSrcCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseSrcCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseSrcCounter) Clone() (PatternFlowPfcPauseSrcCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseSrcCounter() - 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 -} - -// PatternFlowPfcPauseSrcCounter is mac counter pattern -type PatternFlowPfcPauseSrcCounter interface { - Validation - // msg marshals PatternFlowPfcPauseSrcCounter to protobuf object *otg.PatternFlowPfcPauseSrcCounter - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseSrcCounter - // setMsg unmarshals PatternFlowPfcPauseSrcCounter from protobuf object *otg.PatternFlowPfcPauseSrcCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseSrcCounter) PatternFlowPfcPauseSrcCounter - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseSrcCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseSrcCounter - // validate validates PatternFlowPfcPauseSrcCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseSrcCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowPfcPauseSrcCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowPfcPauseSrcCounter - SetStart(value string) PatternFlowPfcPauseSrcCounter - // HasStart checks if Start has been set in PatternFlowPfcPauseSrcCounter - HasStart() bool - // Step returns string, set in PatternFlowPfcPauseSrcCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowPfcPauseSrcCounter - SetStep(value string) PatternFlowPfcPauseSrcCounter - // HasStep checks if Step has been set in PatternFlowPfcPauseSrcCounter - HasStep() bool - // Count returns uint32, set in PatternFlowPfcPauseSrcCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPfcPauseSrcCounter - SetCount(value uint32) PatternFlowPfcPauseSrcCounter - // HasCount checks if Count has been set in PatternFlowPfcPauseSrcCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowPfcPauseSrcCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowPfcPauseSrcCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowPfcPauseSrcCounter object -func (obj *patternFlowPfcPauseSrcCounter) SetStart(value string) PatternFlowPfcPauseSrcCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowPfcPauseSrcCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowPfcPauseSrcCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowPfcPauseSrcCounter object -func (obj *patternFlowPfcPauseSrcCounter) SetStep(value string) PatternFlowPfcPauseSrcCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPauseSrcCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPauseSrcCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPfcPauseSrcCounter object -func (obj *patternFlowPfcPauseSrcCounter) SetCount(value uint32) PatternFlowPfcPauseSrcCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPfcPauseSrcCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateMac(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseSrcCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateMac(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseSrcCounter.Step")) - } - - } - -} - -func (obj *patternFlowPfcPauseSrcCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("00:00:00:00:00:00") - } - if obj.obj.Step == nil { - obj.SetStep("00:00:00:00:00:01") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPfcPauseSrcMetricTag ***** -type patternFlowPfcPauseSrcMetricTag struct { - validation - obj *otg.PatternFlowPfcPauseSrcMetricTag - marshaller marshalPatternFlowPfcPauseSrcMetricTag - unMarshaller unMarshalPatternFlowPfcPauseSrcMetricTag -} - -func NewPatternFlowPfcPauseSrcMetricTag() PatternFlowPfcPauseSrcMetricTag { - obj := patternFlowPfcPauseSrcMetricTag{obj: &otg.PatternFlowPfcPauseSrcMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseSrcMetricTag) msg() *otg.PatternFlowPfcPauseSrcMetricTag { - return obj.obj -} - -func (obj *patternFlowPfcPauseSrcMetricTag) setMsg(msg *otg.PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseSrcMetricTag struct { - obj *patternFlowPfcPauseSrcMetricTag -} - -type marshalPatternFlowPfcPauseSrcMetricTag interface { - // ToProto marshals PatternFlowPfcPauseSrcMetricTag to protobuf object *otg.PatternFlowPfcPauseSrcMetricTag - ToProto() (*otg.PatternFlowPfcPauseSrcMetricTag, error) - // ToPbText marshals PatternFlowPfcPauseSrcMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseSrcMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseSrcMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseSrcMetricTag struct { - obj *patternFlowPfcPauseSrcMetricTag -} - -type unMarshalPatternFlowPfcPauseSrcMetricTag interface { - // FromProto unmarshals PatternFlowPfcPauseSrcMetricTag from protobuf object *otg.PatternFlowPfcPauseSrcMetricTag - FromProto(msg *otg.PatternFlowPfcPauseSrcMetricTag) (PatternFlowPfcPauseSrcMetricTag, error) - // FromPbText unmarshals PatternFlowPfcPauseSrcMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseSrcMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseSrcMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseSrcMetricTag) Marshal() marshalPatternFlowPfcPauseSrcMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseSrcMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseSrcMetricTag) Unmarshal() unMarshalPatternFlowPfcPauseSrcMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseSrcMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseSrcMetricTag) ToProto() (*otg.PatternFlowPfcPauseSrcMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseSrcMetricTag) FromProto(msg *otg.PatternFlowPfcPauseSrcMetricTag) (PatternFlowPfcPauseSrcMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseSrcMetricTag) 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 *unMarshalpatternFlowPfcPauseSrcMetricTag) 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 *marshalpatternFlowPfcPauseSrcMetricTag) 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 *unMarshalpatternFlowPfcPauseSrcMetricTag) 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 *marshalpatternFlowPfcPauseSrcMetricTag) 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 *unMarshalpatternFlowPfcPauseSrcMetricTag) 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 *patternFlowPfcPauseSrcMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseSrcMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseSrcMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseSrcMetricTag) Clone() (PatternFlowPfcPauseSrcMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseSrcMetricTag() - 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 -} - -// PatternFlowPfcPauseSrcMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPfcPauseSrcMetricTag interface { - Validation - // msg marshals PatternFlowPfcPauseSrcMetricTag to protobuf object *otg.PatternFlowPfcPauseSrcMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseSrcMetricTag - // setMsg unmarshals PatternFlowPfcPauseSrcMetricTag from protobuf object *otg.PatternFlowPfcPauseSrcMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcMetricTag - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseSrcMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseSrcMetricTag - // validate validates PatternFlowPfcPauseSrcMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseSrcMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPfcPauseSrcMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPfcPauseSrcMetricTag - SetName(value string) PatternFlowPfcPauseSrcMetricTag - // Offset returns uint32, set in PatternFlowPfcPauseSrcMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPfcPauseSrcMetricTag - SetOffset(value uint32) PatternFlowPfcPauseSrcMetricTag - // HasOffset checks if Offset has been set in PatternFlowPfcPauseSrcMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPfcPauseSrcMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPfcPauseSrcMetricTag - SetLength(value uint32) PatternFlowPfcPauseSrcMetricTag - // HasLength checks if Length has been set in PatternFlowPfcPauseSrcMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPfcPauseSrcMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPfcPauseSrcMetricTag object -func (obj *patternFlowPfcPauseSrcMetricTag) SetName(value string) PatternFlowPfcPauseSrcMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPauseSrcMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPauseSrcMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPfcPauseSrcMetricTag object -func (obj *patternFlowPfcPauseSrcMetricTag) SetOffset(value uint32) PatternFlowPfcPauseSrcMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPauseSrcMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPauseSrcMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPfcPauseSrcMetricTag object -func (obj *patternFlowPfcPauseSrcMetricTag) SetLength(value uint32) PatternFlowPfcPauseSrcMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPfcPauseSrcMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPauseSrcMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 47 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseSrcMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 48 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPfcPauseSrcMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPfcPauseSrcMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(48) - } - -} - -// ***** PatternFlowPfcPauseEtherTypeCounter ***** -type patternFlowPfcPauseEtherTypeCounter struct { - validation - obj *otg.PatternFlowPfcPauseEtherTypeCounter - marshaller marshalPatternFlowPfcPauseEtherTypeCounter - unMarshaller unMarshalPatternFlowPfcPauseEtherTypeCounter -} - -func NewPatternFlowPfcPauseEtherTypeCounter() PatternFlowPfcPauseEtherTypeCounter { - obj := patternFlowPfcPauseEtherTypeCounter{obj: &otg.PatternFlowPfcPauseEtherTypeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseEtherTypeCounter) msg() *otg.PatternFlowPfcPauseEtherTypeCounter { - return obj.obj -} - -func (obj *patternFlowPfcPauseEtherTypeCounter) setMsg(msg *otg.PatternFlowPfcPauseEtherTypeCounter) PatternFlowPfcPauseEtherTypeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseEtherTypeCounter struct { - obj *patternFlowPfcPauseEtherTypeCounter -} - -type marshalPatternFlowPfcPauseEtherTypeCounter interface { - // ToProto marshals PatternFlowPfcPauseEtherTypeCounter to protobuf object *otg.PatternFlowPfcPauseEtherTypeCounter - ToProto() (*otg.PatternFlowPfcPauseEtherTypeCounter, error) - // ToPbText marshals PatternFlowPfcPauseEtherTypeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseEtherTypeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseEtherTypeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseEtherTypeCounter struct { - obj *patternFlowPfcPauseEtherTypeCounter -} - -type unMarshalPatternFlowPfcPauseEtherTypeCounter interface { - // FromProto unmarshals PatternFlowPfcPauseEtherTypeCounter from protobuf object *otg.PatternFlowPfcPauseEtherTypeCounter - FromProto(msg *otg.PatternFlowPfcPauseEtherTypeCounter) (PatternFlowPfcPauseEtherTypeCounter, error) - // FromPbText unmarshals PatternFlowPfcPauseEtherTypeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseEtherTypeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseEtherTypeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseEtherTypeCounter) Marshal() marshalPatternFlowPfcPauseEtherTypeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseEtherTypeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseEtherTypeCounter) Unmarshal() unMarshalPatternFlowPfcPauseEtherTypeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseEtherTypeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseEtherTypeCounter) ToProto() (*otg.PatternFlowPfcPauseEtherTypeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseEtherTypeCounter) FromProto(msg *otg.PatternFlowPfcPauseEtherTypeCounter) (PatternFlowPfcPauseEtherTypeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseEtherTypeCounter) 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 *unMarshalpatternFlowPfcPauseEtherTypeCounter) 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 *marshalpatternFlowPfcPauseEtherTypeCounter) 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 *unMarshalpatternFlowPfcPauseEtherTypeCounter) 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 *marshalpatternFlowPfcPauseEtherTypeCounter) 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 *unMarshalpatternFlowPfcPauseEtherTypeCounter) 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 *patternFlowPfcPauseEtherTypeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseEtherTypeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseEtherTypeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseEtherTypeCounter) Clone() (PatternFlowPfcPauseEtherTypeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseEtherTypeCounter() - 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 -} - -// PatternFlowPfcPauseEtherTypeCounter is integer counter pattern -type PatternFlowPfcPauseEtherTypeCounter interface { - Validation - // msg marshals PatternFlowPfcPauseEtherTypeCounter to protobuf object *otg.PatternFlowPfcPauseEtherTypeCounter - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseEtherTypeCounter - // setMsg unmarshals PatternFlowPfcPauseEtherTypeCounter from protobuf object *otg.PatternFlowPfcPauseEtherTypeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseEtherTypeCounter) PatternFlowPfcPauseEtherTypeCounter - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseEtherTypeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseEtherTypeCounter - // validate validates PatternFlowPfcPauseEtherTypeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseEtherTypeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowPfcPauseEtherTypeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowPfcPauseEtherTypeCounter - SetStart(value uint32) PatternFlowPfcPauseEtherTypeCounter - // HasStart checks if Start has been set in PatternFlowPfcPauseEtherTypeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowPfcPauseEtherTypeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowPfcPauseEtherTypeCounter - SetStep(value uint32) PatternFlowPfcPauseEtherTypeCounter - // HasStep checks if Step has been set in PatternFlowPfcPauseEtherTypeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowPfcPauseEtherTypeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPfcPauseEtherTypeCounter - SetCount(value uint32) PatternFlowPfcPauseEtherTypeCounter - // HasCount checks if Count has been set in PatternFlowPfcPauseEtherTypeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPauseEtherTypeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPauseEtherTypeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowPfcPauseEtherTypeCounter object -func (obj *patternFlowPfcPauseEtherTypeCounter) SetStart(value uint32) PatternFlowPfcPauseEtherTypeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPauseEtherTypeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPauseEtherTypeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowPfcPauseEtherTypeCounter object -func (obj *patternFlowPfcPauseEtherTypeCounter) SetStep(value uint32) PatternFlowPfcPauseEtherTypeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPauseEtherTypeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPauseEtherTypeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPfcPauseEtherTypeCounter object -func (obj *patternFlowPfcPauseEtherTypeCounter) SetCount(value uint32) PatternFlowPfcPauseEtherTypeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPfcPauseEtherTypeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseEtherTypeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseEtherTypeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseEtherTypeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowPfcPauseEtherTypeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(34824) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPfcPauseEtherTypeMetricTag ***** -type patternFlowPfcPauseEtherTypeMetricTag struct { - validation - obj *otg.PatternFlowPfcPauseEtherTypeMetricTag - marshaller marshalPatternFlowPfcPauseEtherTypeMetricTag - unMarshaller unMarshalPatternFlowPfcPauseEtherTypeMetricTag -} - -func NewPatternFlowPfcPauseEtherTypeMetricTag() PatternFlowPfcPauseEtherTypeMetricTag { - obj := patternFlowPfcPauseEtherTypeMetricTag{obj: &otg.PatternFlowPfcPauseEtherTypeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseEtherTypeMetricTag) msg() *otg.PatternFlowPfcPauseEtherTypeMetricTag { - return obj.obj -} - -func (obj *patternFlowPfcPauseEtherTypeMetricTag) setMsg(msg *otg.PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseEtherTypeMetricTag struct { - obj *patternFlowPfcPauseEtherTypeMetricTag -} - -type marshalPatternFlowPfcPauseEtherTypeMetricTag interface { - // ToProto marshals PatternFlowPfcPauseEtherTypeMetricTag to protobuf object *otg.PatternFlowPfcPauseEtherTypeMetricTag - ToProto() (*otg.PatternFlowPfcPauseEtherTypeMetricTag, error) - // ToPbText marshals PatternFlowPfcPauseEtherTypeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseEtherTypeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseEtherTypeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseEtherTypeMetricTag struct { - obj *patternFlowPfcPauseEtherTypeMetricTag -} - -type unMarshalPatternFlowPfcPauseEtherTypeMetricTag interface { - // FromProto unmarshals PatternFlowPfcPauseEtherTypeMetricTag from protobuf object *otg.PatternFlowPfcPauseEtherTypeMetricTag - FromProto(msg *otg.PatternFlowPfcPauseEtherTypeMetricTag) (PatternFlowPfcPauseEtherTypeMetricTag, error) - // FromPbText unmarshals PatternFlowPfcPauseEtherTypeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseEtherTypeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseEtherTypeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseEtherTypeMetricTag) Marshal() marshalPatternFlowPfcPauseEtherTypeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseEtherTypeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseEtherTypeMetricTag) Unmarshal() unMarshalPatternFlowPfcPauseEtherTypeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseEtherTypeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseEtherTypeMetricTag) ToProto() (*otg.PatternFlowPfcPauseEtherTypeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseEtherTypeMetricTag) FromProto(msg *otg.PatternFlowPfcPauseEtherTypeMetricTag) (PatternFlowPfcPauseEtherTypeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseEtherTypeMetricTag) 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 *unMarshalpatternFlowPfcPauseEtherTypeMetricTag) 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 *marshalpatternFlowPfcPauseEtherTypeMetricTag) 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 *unMarshalpatternFlowPfcPauseEtherTypeMetricTag) 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 *marshalpatternFlowPfcPauseEtherTypeMetricTag) 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 *unMarshalpatternFlowPfcPauseEtherTypeMetricTag) 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 *patternFlowPfcPauseEtherTypeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseEtherTypeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseEtherTypeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseEtherTypeMetricTag) Clone() (PatternFlowPfcPauseEtherTypeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseEtherTypeMetricTag() - 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 -} - -// PatternFlowPfcPauseEtherTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPfcPauseEtherTypeMetricTag interface { - Validation - // msg marshals PatternFlowPfcPauseEtherTypeMetricTag to protobuf object *otg.PatternFlowPfcPauseEtherTypeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseEtherTypeMetricTag - // setMsg unmarshals PatternFlowPfcPauseEtherTypeMetricTag from protobuf object *otg.PatternFlowPfcPauseEtherTypeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseEtherTypeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseEtherTypeMetricTag - // validate validates PatternFlowPfcPauseEtherTypeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseEtherTypeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPfcPauseEtherTypeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPfcPauseEtherTypeMetricTag - SetName(value string) PatternFlowPfcPauseEtherTypeMetricTag - // Offset returns uint32, set in PatternFlowPfcPauseEtherTypeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPfcPauseEtherTypeMetricTag - SetOffset(value uint32) PatternFlowPfcPauseEtherTypeMetricTag - // HasOffset checks if Offset has been set in PatternFlowPfcPauseEtherTypeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPfcPauseEtherTypeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPfcPauseEtherTypeMetricTag - SetLength(value uint32) PatternFlowPfcPauseEtherTypeMetricTag - // HasLength checks if Length has been set in PatternFlowPfcPauseEtherTypeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPfcPauseEtherTypeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPfcPauseEtherTypeMetricTag object -func (obj *patternFlowPfcPauseEtherTypeMetricTag) SetName(value string) PatternFlowPfcPauseEtherTypeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPauseEtherTypeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPauseEtherTypeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPfcPauseEtherTypeMetricTag object -func (obj *patternFlowPfcPauseEtherTypeMetricTag) SetOffset(value uint32) PatternFlowPfcPauseEtherTypeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPauseEtherTypeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPauseEtherTypeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPfcPauseEtherTypeMetricTag object -func (obj *patternFlowPfcPauseEtherTypeMetricTag) SetLength(value uint32) PatternFlowPfcPauseEtherTypeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPfcPauseEtherTypeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPauseEtherTypeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseEtherTypeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPfcPauseEtherTypeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPfcPauseEtherTypeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowPfcPauseControlOpCodeCounter ***** -type patternFlowPfcPauseControlOpCodeCounter struct { - validation - obj *otg.PatternFlowPfcPauseControlOpCodeCounter - marshaller marshalPatternFlowPfcPauseControlOpCodeCounter - unMarshaller unMarshalPatternFlowPfcPauseControlOpCodeCounter -} - -func NewPatternFlowPfcPauseControlOpCodeCounter() PatternFlowPfcPauseControlOpCodeCounter { - obj := patternFlowPfcPauseControlOpCodeCounter{obj: &otg.PatternFlowPfcPauseControlOpCodeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseControlOpCodeCounter) msg() *otg.PatternFlowPfcPauseControlOpCodeCounter { - return obj.obj -} - -func (obj *patternFlowPfcPauseControlOpCodeCounter) setMsg(msg *otg.PatternFlowPfcPauseControlOpCodeCounter) PatternFlowPfcPauseControlOpCodeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseControlOpCodeCounter struct { - obj *patternFlowPfcPauseControlOpCodeCounter -} - -type marshalPatternFlowPfcPauseControlOpCodeCounter interface { - // ToProto marshals PatternFlowPfcPauseControlOpCodeCounter to protobuf object *otg.PatternFlowPfcPauseControlOpCodeCounter - ToProto() (*otg.PatternFlowPfcPauseControlOpCodeCounter, error) - // ToPbText marshals PatternFlowPfcPauseControlOpCodeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseControlOpCodeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseControlOpCodeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseControlOpCodeCounter struct { - obj *patternFlowPfcPauseControlOpCodeCounter -} - -type unMarshalPatternFlowPfcPauseControlOpCodeCounter interface { - // FromProto unmarshals PatternFlowPfcPauseControlOpCodeCounter from protobuf object *otg.PatternFlowPfcPauseControlOpCodeCounter - FromProto(msg *otg.PatternFlowPfcPauseControlOpCodeCounter) (PatternFlowPfcPauseControlOpCodeCounter, error) - // FromPbText unmarshals PatternFlowPfcPauseControlOpCodeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseControlOpCodeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseControlOpCodeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseControlOpCodeCounter) Marshal() marshalPatternFlowPfcPauseControlOpCodeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseControlOpCodeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseControlOpCodeCounter) Unmarshal() unMarshalPatternFlowPfcPauseControlOpCodeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseControlOpCodeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseControlOpCodeCounter) ToProto() (*otg.PatternFlowPfcPauseControlOpCodeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseControlOpCodeCounter) FromProto(msg *otg.PatternFlowPfcPauseControlOpCodeCounter) (PatternFlowPfcPauseControlOpCodeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseControlOpCodeCounter) 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 *unMarshalpatternFlowPfcPauseControlOpCodeCounter) 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 *marshalpatternFlowPfcPauseControlOpCodeCounter) 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 *unMarshalpatternFlowPfcPauseControlOpCodeCounter) 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 *marshalpatternFlowPfcPauseControlOpCodeCounter) 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 *unMarshalpatternFlowPfcPauseControlOpCodeCounter) 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 *patternFlowPfcPauseControlOpCodeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseControlOpCodeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseControlOpCodeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseControlOpCodeCounter) Clone() (PatternFlowPfcPauseControlOpCodeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseControlOpCodeCounter() - 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 -} - -// PatternFlowPfcPauseControlOpCodeCounter is integer counter pattern -type PatternFlowPfcPauseControlOpCodeCounter interface { - Validation - // msg marshals PatternFlowPfcPauseControlOpCodeCounter to protobuf object *otg.PatternFlowPfcPauseControlOpCodeCounter - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseControlOpCodeCounter - // setMsg unmarshals PatternFlowPfcPauseControlOpCodeCounter from protobuf object *otg.PatternFlowPfcPauseControlOpCodeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseControlOpCodeCounter) PatternFlowPfcPauseControlOpCodeCounter - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseControlOpCodeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseControlOpCodeCounter - // validate validates PatternFlowPfcPauseControlOpCodeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseControlOpCodeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowPfcPauseControlOpCodeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowPfcPauseControlOpCodeCounter - SetStart(value uint32) PatternFlowPfcPauseControlOpCodeCounter - // HasStart checks if Start has been set in PatternFlowPfcPauseControlOpCodeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowPfcPauseControlOpCodeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowPfcPauseControlOpCodeCounter - SetStep(value uint32) PatternFlowPfcPauseControlOpCodeCounter - // HasStep checks if Step has been set in PatternFlowPfcPauseControlOpCodeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowPfcPauseControlOpCodeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPfcPauseControlOpCodeCounter - SetCount(value uint32) PatternFlowPfcPauseControlOpCodeCounter - // HasCount checks if Count has been set in PatternFlowPfcPauseControlOpCodeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPauseControlOpCodeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPauseControlOpCodeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowPfcPauseControlOpCodeCounter object -func (obj *patternFlowPfcPauseControlOpCodeCounter) SetStart(value uint32) PatternFlowPfcPauseControlOpCodeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPauseControlOpCodeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPauseControlOpCodeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowPfcPauseControlOpCodeCounter object -func (obj *patternFlowPfcPauseControlOpCodeCounter) SetStep(value uint32) PatternFlowPfcPauseControlOpCodeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPauseControlOpCodeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPauseControlOpCodeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPfcPauseControlOpCodeCounter object -func (obj *patternFlowPfcPauseControlOpCodeCounter) SetCount(value uint32) PatternFlowPfcPauseControlOpCodeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPfcPauseControlOpCodeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseControlOpCodeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseControlOpCodeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseControlOpCodeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowPfcPauseControlOpCodeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(257) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPfcPauseControlOpCodeMetricTag ***** -type patternFlowPfcPauseControlOpCodeMetricTag struct { - validation - obj *otg.PatternFlowPfcPauseControlOpCodeMetricTag - marshaller marshalPatternFlowPfcPauseControlOpCodeMetricTag - unMarshaller unMarshalPatternFlowPfcPauseControlOpCodeMetricTag -} - -func NewPatternFlowPfcPauseControlOpCodeMetricTag() PatternFlowPfcPauseControlOpCodeMetricTag { - obj := patternFlowPfcPauseControlOpCodeMetricTag{obj: &otg.PatternFlowPfcPauseControlOpCodeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) msg() *otg.PatternFlowPfcPauseControlOpCodeMetricTag { - return obj.obj -} - -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) setMsg(msg *otg.PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseControlOpCodeMetricTag struct { - obj *patternFlowPfcPauseControlOpCodeMetricTag -} - -type marshalPatternFlowPfcPauseControlOpCodeMetricTag interface { - // ToProto marshals PatternFlowPfcPauseControlOpCodeMetricTag to protobuf object *otg.PatternFlowPfcPauseControlOpCodeMetricTag - ToProto() (*otg.PatternFlowPfcPauseControlOpCodeMetricTag, error) - // ToPbText marshals PatternFlowPfcPauseControlOpCodeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseControlOpCodeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseControlOpCodeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseControlOpCodeMetricTag struct { - obj *patternFlowPfcPauseControlOpCodeMetricTag -} - -type unMarshalPatternFlowPfcPauseControlOpCodeMetricTag interface { - // FromProto unmarshals PatternFlowPfcPauseControlOpCodeMetricTag from protobuf object *otg.PatternFlowPfcPauseControlOpCodeMetricTag - FromProto(msg *otg.PatternFlowPfcPauseControlOpCodeMetricTag) (PatternFlowPfcPauseControlOpCodeMetricTag, error) - // FromPbText unmarshals PatternFlowPfcPauseControlOpCodeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseControlOpCodeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseControlOpCodeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) Marshal() marshalPatternFlowPfcPauseControlOpCodeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseControlOpCodeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) Unmarshal() unMarshalPatternFlowPfcPauseControlOpCodeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseControlOpCodeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseControlOpCodeMetricTag) ToProto() (*otg.PatternFlowPfcPauseControlOpCodeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseControlOpCodeMetricTag) FromProto(msg *otg.PatternFlowPfcPauseControlOpCodeMetricTag) (PatternFlowPfcPauseControlOpCodeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseControlOpCodeMetricTag) 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 *unMarshalpatternFlowPfcPauseControlOpCodeMetricTag) 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 *marshalpatternFlowPfcPauseControlOpCodeMetricTag) 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 *unMarshalpatternFlowPfcPauseControlOpCodeMetricTag) 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 *marshalpatternFlowPfcPauseControlOpCodeMetricTag) 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 *unMarshalpatternFlowPfcPauseControlOpCodeMetricTag) 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 *patternFlowPfcPauseControlOpCodeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) Clone() (PatternFlowPfcPauseControlOpCodeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseControlOpCodeMetricTag() - 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 -} - -// PatternFlowPfcPauseControlOpCodeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPfcPauseControlOpCodeMetricTag interface { - Validation - // msg marshals PatternFlowPfcPauseControlOpCodeMetricTag to protobuf object *otg.PatternFlowPfcPauseControlOpCodeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseControlOpCodeMetricTag - // setMsg unmarshals PatternFlowPfcPauseControlOpCodeMetricTag from protobuf object *otg.PatternFlowPfcPauseControlOpCodeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseControlOpCodeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseControlOpCodeMetricTag - // validate validates PatternFlowPfcPauseControlOpCodeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseControlOpCodeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPfcPauseControlOpCodeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPfcPauseControlOpCodeMetricTag - SetName(value string) PatternFlowPfcPauseControlOpCodeMetricTag - // Offset returns uint32, set in PatternFlowPfcPauseControlOpCodeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPfcPauseControlOpCodeMetricTag - SetOffset(value uint32) PatternFlowPfcPauseControlOpCodeMetricTag - // HasOffset checks if Offset has been set in PatternFlowPfcPauseControlOpCodeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPfcPauseControlOpCodeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPfcPauseControlOpCodeMetricTag - SetLength(value uint32) PatternFlowPfcPauseControlOpCodeMetricTag - // HasLength checks if Length has been set in PatternFlowPfcPauseControlOpCodeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPfcPauseControlOpCodeMetricTag object -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) SetName(value string) PatternFlowPfcPauseControlOpCodeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPfcPauseControlOpCodeMetricTag object -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) SetOffset(value uint32) PatternFlowPfcPauseControlOpCodeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPfcPauseControlOpCodeMetricTag object -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) SetLength(value uint32) PatternFlowPfcPauseControlOpCodeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPauseControlOpCodeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseControlOpCodeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPfcPauseControlOpCodeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPfcPauseControlOpCodeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowPfcPauseClassEnableVectorCounter ***** -type patternFlowPfcPauseClassEnableVectorCounter struct { - validation - obj *otg.PatternFlowPfcPauseClassEnableVectorCounter - marshaller marshalPatternFlowPfcPauseClassEnableVectorCounter - unMarshaller unMarshalPatternFlowPfcPauseClassEnableVectorCounter -} - -func NewPatternFlowPfcPauseClassEnableVectorCounter() PatternFlowPfcPauseClassEnableVectorCounter { - obj := patternFlowPfcPauseClassEnableVectorCounter{obj: &otg.PatternFlowPfcPauseClassEnableVectorCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseClassEnableVectorCounter) msg() *otg.PatternFlowPfcPauseClassEnableVectorCounter { - return obj.obj -} - -func (obj *patternFlowPfcPauseClassEnableVectorCounter) setMsg(msg *otg.PatternFlowPfcPauseClassEnableVectorCounter) PatternFlowPfcPauseClassEnableVectorCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseClassEnableVectorCounter struct { - obj *patternFlowPfcPauseClassEnableVectorCounter -} - -type marshalPatternFlowPfcPauseClassEnableVectorCounter interface { - // ToProto marshals PatternFlowPfcPauseClassEnableVectorCounter to protobuf object *otg.PatternFlowPfcPauseClassEnableVectorCounter - ToProto() (*otg.PatternFlowPfcPauseClassEnableVectorCounter, error) - // ToPbText marshals PatternFlowPfcPauseClassEnableVectorCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseClassEnableVectorCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseClassEnableVectorCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseClassEnableVectorCounter struct { - obj *patternFlowPfcPauseClassEnableVectorCounter -} - -type unMarshalPatternFlowPfcPauseClassEnableVectorCounter interface { - // FromProto unmarshals PatternFlowPfcPauseClassEnableVectorCounter from protobuf object *otg.PatternFlowPfcPauseClassEnableVectorCounter - FromProto(msg *otg.PatternFlowPfcPauseClassEnableVectorCounter) (PatternFlowPfcPauseClassEnableVectorCounter, error) - // FromPbText unmarshals PatternFlowPfcPauseClassEnableVectorCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseClassEnableVectorCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseClassEnableVectorCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseClassEnableVectorCounter) Marshal() marshalPatternFlowPfcPauseClassEnableVectorCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseClassEnableVectorCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseClassEnableVectorCounter) Unmarshal() unMarshalPatternFlowPfcPauseClassEnableVectorCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseClassEnableVectorCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseClassEnableVectorCounter) ToProto() (*otg.PatternFlowPfcPauseClassEnableVectorCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseClassEnableVectorCounter) FromProto(msg *otg.PatternFlowPfcPauseClassEnableVectorCounter) (PatternFlowPfcPauseClassEnableVectorCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseClassEnableVectorCounter) 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 *unMarshalpatternFlowPfcPauseClassEnableVectorCounter) 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 *marshalpatternFlowPfcPauseClassEnableVectorCounter) 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 *unMarshalpatternFlowPfcPauseClassEnableVectorCounter) 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 *marshalpatternFlowPfcPauseClassEnableVectorCounter) 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 *unMarshalpatternFlowPfcPauseClassEnableVectorCounter) 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 *patternFlowPfcPauseClassEnableVectorCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseClassEnableVectorCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseClassEnableVectorCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseClassEnableVectorCounter) Clone() (PatternFlowPfcPauseClassEnableVectorCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseClassEnableVectorCounter() - 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 -} - -// PatternFlowPfcPauseClassEnableVectorCounter is integer counter pattern -type PatternFlowPfcPauseClassEnableVectorCounter interface { - Validation - // msg marshals PatternFlowPfcPauseClassEnableVectorCounter to protobuf object *otg.PatternFlowPfcPauseClassEnableVectorCounter - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseClassEnableVectorCounter - // setMsg unmarshals PatternFlowPfcPauseClassEnableVectorCounter from protobuf object *otg.PatternFlowPfcPauseClassEnableVectorCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseClassEnableVectorCounter) PatternFlowPfcPauseClassEnableVectorCounter - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseClassEnableVectorCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseClassEnableVectorCounter - // validate validates PatternFlowPfcPauseClassEnableVectorCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseClassEnableVectorCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowPfcPauseClassEnableVectorCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowPfcPauseClassEnableVectorCounter - SetStart(value uint32) PatternFlowPfcPauseClassEnableVectorCounter - // HasStart checks if Start has been set in PatternFlowPfcPauseClassEnableVectorCounter - HasStart() bool - // Step returns uint32, set in PatternFlowPfcPauseClassEnableVectorCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowPfcPauseClassEnableVectorCounter - SetStep(value uint32) PatternFlowPfcPauseClassEnableVectorCounter - // HasStep checks if Step has been set in PatternFlowPfcPauseClassEnableVectorCounter - HasStep() bool - // Count returns uint32, set in PatternFlowPfcPauseClassEnableVectorCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPfcPauseClassEnableVectorCounter - SetCount(value uint32) PatternFlowPfcPauseClassEnableVectorCounter - // HasCount checks if Count has been set in PatternFlowPfcPauseClassEnableVectorCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPauseClassEnableVectorCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPauseClassEnableVectorCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowPfcPauseClassEnableVectorCounter object -func (obj *patternFlowPfcPauseClassEnableVectorCounter) SetStart(value uint32) PatternFlowPfcPauseClassEnableVectorCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPauseClassEnableVectorCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPauseClassEnableVectorCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowPfcPauseClassEnableVectorCounter object -func (obj *patternFlowPfcPauseClassEnableVectorCounter) SetStep(value uint32) PatternFlowPfcPauseClassEnableVectorCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPauseClassEnableVectorCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPauseClassEnableVectorCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPfcPauseClassEnableVectorCounter object -func (obj *patternFlowPfcPauseClassEnableVectorCounter) SetCount(value uint32) PatternFlowPfcPauseClassEnableVectorCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPfcPauseClassEnableVectorCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseClassEnableVectorCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseClassEnableVectorCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseClassEnableVectorCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowPfcPauseClassEnableVectorCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPfcPauseClassEnableVectorMetricTag ***** -type patternFlowPfcPauseClassEnableVectorMetricTag struct { - validation - obj *otg.PatternFlowPfcPauseClassEnableVectorMetricTag - marshaller marshalPatternFlowPfcPauseClassEnableVectorMetricTag - unMarshaller unMarshalPatternFlowPfcPauseClassEnableVectorMetricTag -} - -func NewPatternFlowPfcPauseClassEnableVectorMetricTag() PatternFlowPfcPauseClassEnableVectorMetricTag { - obj := patternFlowPfcPauseClassEnableVectorMetricTag{obj: &otg.PatternFlowPfcPauseClassEnableVectorMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) msg() *otg.PatternFlowPfcPauseClassEnableVectorMetricTag { - return obj.obj -} - -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) setMsg(msg *otg.PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPauseClassEnableVectorMetricTag struct { - obj *patternFlowPfcPauseClassEnableVectorMetricTag -} - -type marshalPatternFlowPfcPauseClassEnableVectorMetricTag interface { - // ToProto marshals PatternFlowPfcPauseClassEnableVectorMetricTag to protobuf object *otg.PatternFlowPfcPauseClassEnableVectorMetricTag - ToProto() (*otg.PatternFlowPfcPauseClassEnableVectorMetricTag, error) - // ToPbText marshals PatternFlowPfcPauseClassEnableVectorMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPauseClassEnableVectorMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPauseClassEnableVectorMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPauseClassEnableVectorMetricTag struct { - obj *patternFlowPfcPauseClassEnableVectorMetricTag -} - -type unMarshalPatternFlowPfcPauseClassEnableVectorMetricTag interface { - // FromProto unmarshals PatternFlowPfcPauseClassEnableVectorMetricTag from protobuf object *otg.PatternFlowPfcPauseClassEnableVectorMetricTag - FromProto(msg *otg.PatternFlowPfcPauseClassEnableVectorMetricTag) (PatternFlowPfcPauseClassEnableVectorMetricTag, error) - // FromPbText unmarshals PatternFlowPfcPauseClassEnableVectorMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPauseClassEnableVectorMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPauseClassEnableVectorMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) Marshal() marshalPatternFlowPfcPauseClassEnableVectorMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPauseClassEnableVectorMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) Unmarshal() unMarshalPatternFlowPfcPauseClassEnableVectorMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPauseClassEnableVectorMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPauseClassEnableVectorMetricTag) ToProto() (*otg.PatternFlowPfcPauseClassEnableVectorMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPauseClassEnableVectorMetricTag) FromProto(msg *otg.PatternFlowPfcPauseClassEnableVectorMetricTag) (PatternFlowPfcPauseClassEnableVectorMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPauseClassEnableVectorMetricTag) 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 *unMarshalpatternFlowPfcPauseClassEnableVectorMetricTag) 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 *marshalpatternFlowPfcPauseClassEnableVectorMetricTag) 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 *unMarshalpatternFlowPfcPauseClassEnableVectorMetricTag) 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 *marshalpatternFlowPfcPauseClassEnableVectorMetricTag) 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 *unMarshalpatternFlowPfcPauseClassEnableVectorMetricTag) 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 *patternFlowPfcPauseClassEnableVectorMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) Clone() (PatternFlowPfcPauseClassEnableVectorMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPauseClassEnableVectorMetricTag() - 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 -} - -// PatternFlowPfcPauseClassEnableVectorMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPfcPauseClassEnableVectorMetricTag interface { - Validation - // msg marshals PatternFlowPfcPauseClassEnableVectorMetricTag to protobuf object *otg.PatternFlowPfcPauseClassEnableVectorMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPfcPauseClassEnableVectorMetricTag - // setMsg unmarshals PatternFlowPfcPauseClassEnableVectorMetricTag from protobuf object *otg.PatternFlowPfcPauseClassEnableVectorMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorMetricTag - // provides marshal interface - Marshal() marshalPatternFlowPfcPauseClassEnableVectorMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPauseClassEnableVectorMetricTag - // validate validates PatternFlowPfcPauseClassEnableVectorMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPauseClassEnableVectorMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPfcPauseClassEnableVectorMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPfcPauseClassEnableVectorMetricTag - SetName(value string) PatternFlowPfcPauseClassEnableVectorMetricTag - // Offset returns uint32, set in PatternFlowPfcPauseClassEnableVectorMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPfcPauseClassEnableVectorMetricTag - SetOffset(value uint32) PatternFlowPfcPauseClassEnableVectorMetricTag - // HasOffset checks if Offset has been set in PatternFlowPfcPauseClassEnableVectorMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPfcPauseClassEnableVectorMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPfcPauseClassEnableVectorMetricTag - SetLength(value uint32) PatternFlowPfcPauseClassEnableVectorMetricTag - // HasLength checks if Length has been set in PatternFlowPfcPauseClassEnableVectorMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPfcPauseClassEnableVectorMetricTag object -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) SetName(value string) PatternFlowPfcPauseClassEnableVectorMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPfcPauseClassEnableVectorMetricTag object -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) SetOffset(value uint32) PatternFlowPfcPauseClassEnableVectorMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPfcPauseClassEnableVectorMetricTag object -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) SetLength(value uint32) PatternFlowPfcPauseClassEnableVectorMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPauseClassEnableVectorMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPauseClassEnableVectorMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPfcPauseClassEnableVectorMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowPfcPausePauseClass0Counter ***** -type patternFlowPfcPausePauseClass0Counter struct { - validation - obj *otg.PatternFlowPfcPausePauseClass0Counter - marshaller marshalPatternFlowPfcPausePauseClass0Counter - unMarshaller unMarshalPatternFlowPfcPausePauseClass0Counter -} - -func NewPatternFlowPfcPausePauseClass0Counter() PatternFlowPfcPausePauseClass0Counter { - obj := patternFlowPfcPausePauseClass0Counter{obj: &otg.PatternFlowPfcPausePauseClass0Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass0Counter) msg() *otg.PatternFlowPfcPausePauseClass0Counter { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass0Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass0Counter) PatternFlowPfcPausePauseClass0Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass0Counter struct { - obj *patternFlowPfcPausePauseClass0Counter -} - -type marshalPatternFlowPfcPausePauseClass0Counter interface { - // ToProto marshals PatternFlowPfcPausePauseClass0Counter to protobuf object *otg.PatternFlowPfcPausePauseClass0Counter - ToProto() (*otg.PatternFlowPfcPausePauseClass0Counter, error) - // ToPbText marshals PatternFlowPfcPausePauseClass0Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass0Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass0Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass0Counter struct { - obj *patternFlowPfcPausePauseClass0Counter -} - -type unMarshalPatternFlowPfcPausePauseClass0Counter interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass0Counter from protobuf object *otg.PatternFlowPfcPausePauseClass0Counter - FromProto(msg *otg.PatternFlowPfcPausePauseClass0Counter) (PatternFlowPfcPausePauseClass0Counter, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass0Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass0Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass0Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass0Counter) Marshal() marshalPatternFlowPfcPausePauseClass0Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass0Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass0Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass0Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass0Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass0Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass0Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass0Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass0Counter) (PatternFlowPfcPausePauseClass0Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass0Counter) 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 *unMarshalpatternFlowPfcPausePauseClass0Counter) 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 *marshalpatternFlowPfcPausePauseClass0Counter) 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 *unMarshalpatternFlowPfcPausePauseClass0Counter) 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 *marshalpatternFlowPfcPausePauseClass0Counter) 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 *unMarshalpatternFlowPfcPausePauseClass0Counter) 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 *patternFlowPfcPausePauseClass0Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass0Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass0Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass0Counter) Clone() (PatternFlowPfcPausePauseClass0Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass0Counter() - 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 -} - -// PatternFlowPfcPausePauseClass0Counter is integer counter pattern -type PatternFlowPfcPausePauseClass0Counter interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass0Counter to protobuf object *otg.PatternFlowPfcPausePauseClass0Counter - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass0Counter - // setMsg unmarshals PatternFlowPfcPausePauseClass0Counter from protobuf object *otg.PatternFlowPfcPausePauseClass0Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass0Counter) PatternFlowPfcPausePauseClass0Counter - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass0Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass0Counter - // validate validates PatternFlowPfcPausePauseClass0Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass0Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowPfcPausePauseClass0Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass0Counter - SetStart(value uint32) PatternFlowPfcPausePauseClass0Counter - // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass0Counter - HasStart() bool - // Step returns uint32, set in PatternFlowPfcPausePauseClass0Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass0Counter - SetStep(value uint32) PatternFlowPfcPausePauseClass0Counter - // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass0Counter - HasStep() bool - // Count returns uint32, set in PatternFlowPfcPausePauseClass0Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass0Counter - SetCount(value uint32) PatternFlowPfcPausePauseClass0Counter - // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass0Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass0Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass0Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass0Counter object -func (obj *patternFlowPfcPausePauseClass0Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass0Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass0Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass0Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass0Counter object -func (obj *patternFlowPfcPausePauseClass0Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass0Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass0Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass0Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass0Counter object -func (obj *patternFlowPfcPausePauseClass0Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass0Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass0Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass0Counter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass0Counter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass0Counter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass0Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPfcPausePauseClass0MetricTag ***** -type patternFlowPfcPausePauseClass0MetricTag struct { - validation - obj *otg.PatternFlowPfcPausePauseClass0MetricTag - marshaller marshalPatternFlowPfcPausePauseClass0MetricTag - unMarshaller unMarshalPatternFlowPfcPausePauseClass0MetricTag -} - -func NewPatternFlowPfcPausePauseClass0MetricTag() PatternFlowPfcPausePauseClass0MetricTag { - obj := patternFlowPfcPausePauseClass0MetricTag{obj: &otg.PatternFlowPfcPausePauseClass0MetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass0MetricTag) msg() *otg.PatternFlowPfcPausePauseClass0MetricTag { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass0MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0MetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass0MetricTag struct { - obj *patternFlowPfcPausePauseClass0MetricTag -} - -type marshalPatternFlowPfcPausePauseClass0MetricTag interface { - // ToProto marshals PatternFlowPfcPausePauseClass0MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass0MetricTag - ToProto() (*otg.PatternFlowPfcPausePauseClass0MetricTag, error) - // ToPbText marshals PatternFlowPfcPausePauseClass0MetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass0MetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass0MetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass0MetricTag struct { - obj *patternFlowPfcPausePauseClass0MetricTag -} - -type unMarshalPatternFlowPfcPausePauseClass0MetricTag interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass0MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass0MetricTag - FromProto(msg *otg.PatternFlowPfcPausePauseClass0MetricTag) (PatternFlowPfcPausePauseClass0MetricTag, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass0MetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass0MetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass0MetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass0MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass0MetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass0MetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass0MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass0MetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass0MetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass0MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass0MetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass0MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass0MetricTag) (PatternFlowPfcPausePauseClass0MetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass0MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass0MetricTag) 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 *marshalpatternFlowPfcPausePauseClass0MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass0MetricTag) 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 *marshalpatternFlowPfcPausePauseClass0MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass0MetricTag) 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 *patternFlowPfcPausePauseClass0MetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass0MetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass0MetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass0MetricTag) Clone() (PatternFlowPfcPausePauseClass0MetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass0MetricTag() - 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 -} - -// PatternFlowPfcPausePauseClass0MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPfcPausePauseClass0MetricTag interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass0MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass0MetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass0MetricTag - // setMsg unmarshals PatternFlowPfcPausePauseClass0MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass0MetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0MetricTag - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass0MetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass0MetricTag - // validate validates PatternFlowPfcPausePauseClass0MetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass0MetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPfcPausePauseClass0MetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPfcPausePauseClass0MetricTag - SetName(value string) PatternFlowPfcPausePauseClass0MetricTag - // Offset returns uint32, set in PatternFlowPfcPausePauseClass0MetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass0MetricTag - SetOffset(value uint32) PatternFlowPfcPausePauseClass0MetricTag - // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass0MetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPfcPausePauseClass0MetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass0MetricTag - SetLength(value uint32) PatternFlowPfcPausePauseClass0MetricTag - // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass0MetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPfcPausePauseClass0MetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPfcPausePauseClass0MetricTag object -func (obj *patternFlowPfcPausePauseClass0MetricTag) SetName(value string) PatternFlowPfcPausePauseClass0MetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass0MetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass0MetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass0MetricTag object -func (obj *patternFlowPfcPausePauseClass0MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass0MetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass0MetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass0MetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass0MetricTag object -func (obj *patternFlowPfcPausePauseClass0MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass0MetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass0MetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass0MetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass0MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass0MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass0MetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowPfcPausePauseClass1Counter ***** -type patternFlowPfcPausePauseClass1Counter struct { - validation - obj *otg.PatternFlowPfcPausePauseClass1Counter - marshaller marshalPatternFlowPfcPausePauseClass1Counter - unMarshaller unMarshalPatternFlowPfcPausePauseClass1Counter -} - -func NewPatternFlowPfcPausePauseClass1Counter() PatternFlowPfcPausePauseClass1Counter { - obj := patternFlowPfcPausePauseClass1Counter{obj: &otg.PatternFlowPfcPausePauseClass1Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass1Counter) msg() *otg.PatternFlowPfcPausePauseClass1Counter { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass1Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass1Counter) PatternFlowPfcPausePauseClass1Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass1Counter struct { - obj *patternFlowPfcPausePauseClass1Counter -} - -type marshalPatternFlowPfcPausePauseClass1Counter interface { - // ToProto marshals PatternFlowPfcPausePauseClass1Counter to protobuf object *otg.PatternFlowPfcPausePauseClass1Counter - ToProto() (*otg.PatternFlowPfcPausePauseClass1Counter, error) - // ToPbText marshals PatternFlowPfcPausePauseClass1Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass1Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass1Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass1Counter struct { - obj *patternFlowPfcPausePauseClass1Counter -} - -type unMarshalPatternFlowPfcPausePauseClass1Counter interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass1Counter from protobuf object *otg.PatternFlowPfcPausePauseClass1Counter - FromProto(msg *otg.PatternFlowPfcPausePauseClass1Counter) (PatternFlowPfcPausePauseClass1Counter, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass1Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass1Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass1Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass1Counter) Marshal() marshalPatternFlowPfcPausePauseClass1Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass1Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass1Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass1Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass1Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass1Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass1Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass1Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass1Counter) (PatternFlowPfcPausePauseClass1Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass1Counter) 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 *unMarshalpatternFlowPfcPausePauseClass1Counter) 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 *marshalpatternFlowPfcPausePauseClass1Counter) 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 *unMarshalpatternFlowPfcPausePauseClass1Counter) 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 *marshalpatternFlowPfcPausePauseClass1Counter) 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 *unMarshalpatternFlowPfcPausePauseClass1Counter) 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 *patternFlowPfcPausePauseClass1Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass1Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass1Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass1Counter) Clone() (PatternFlowPfcPausePauseClass1Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass1Counter() - 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 -} - -// PatternFlowPfcPausePauseClass1Counter is integer counter pattern -type PatternFlowPfcPausePauseClass1Counter interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass1Counter to protobuf object *otg.PatternFlowPfcPausePauseClass1Counter - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass1Counter - // setMsg unmarshals PatternFlowPfcPausePauseClass1Counter from protobuf object *otg.PatternFlowPfcPausePauseClass1Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass1Counter) PatternFlowPfcPausePauseClass1Counter - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass1Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass1Counter - // validate validates PatternFlowPfcPausePauseClass1Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass1Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowPfcPausePauseClass1Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass1Counter - SetStart(value uint32) PatternFlowPfcPausePauseClass1Counter - // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass1Counter - HasStart() bool - // Step returns uint32, set in PatternFlowPfcPausePauseClass1Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass1Counter - SetStep(value uint32) PatternFlowPfcPausePauseClass1Counter - // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass1Counter - HasStep() bool - // Count returns uint32, set in PatternFlowPfcPausePauseClass1Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass1Counter - SetCount(value uint32) PatternFlowPfcPausePauseClass1Counter - // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass1Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass1Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass1Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass1Counter object -func (obj *patternFlowPfcPausePauseClass1Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass1Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass1Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass1Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass1Counter object -func (obj *patternFlowPfcPausePauseClass1Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass1Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass1Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass1Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass1Counter object -func (obj *patternFlowPfcPausePauseClass1Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass1Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass1Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass1Counter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass1Counter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass1Counter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass1Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPfcPausePauseClass1MetricTag ***** -type patternFlowPfcPausePauseClass1MetricTag struct { - validation - obj *otg.PatternFlowPfcPausePauseClass1MetricTag - marshaller marshalPatternFlowPfcPausePauseClass1MetricTag - unMarshaller unMarshalPatternFlowPfcPausePauseClass1MetricTag -} - -func NewPatternFlowPfcPausePauseClass1MetricTag() PatternFlowPfcPausePauseClass1MetricTag { - obj := patternFlowPfcPausePauseClass1MetricTag{obj: &otg.PatternFlowPfcPausePauseClass1MetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass1MetricTag) msg() *otg.PatternFlowPfcPausePauseClass1MetricTag { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass1MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1MetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass1MetricTag struct { - obj *patternFlowPfcPausePauseClass1MetricTag -} - -type marshalPatternFlowPfcPausePauseClass1MetricTag interface { - // ToProto marshals PatternFlowPfcPausePauseClass1MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass1MetricTag - ToProto() (*otg.PatternFlowPfcPausePauseClass1MetricTag, error) - // ToPbText marshals PatternFlowPfcPausePauseClass1MetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass1MetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass1MetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass1MetricTag struct { - obj *patternFlowPfcPausePauseClass1MetricTag -} - -type unMarshalPatternFlowPfcPausePauseClass1MetricTag interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass1MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass1MetricTag - FromProto(msg *otg.PatternFlowPfcPausePauseClass1MetricTag) (PatternFlowPfcPausePauseClass1MetricTag, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass1MetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass1MetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass1MetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass1MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass1MetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass1MetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass1MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass1MetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass1MetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass1MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass1MetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass1MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass1MetricTag) (PatternFlowPfcPausePauseClass1MetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass1MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass1MetricTag) 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 *marshalpatternFlowPfcPausePauseClass1MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass1MetricTag) 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 *marshalpatternFlowPfcPausePauseClass1MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass1MetricTag) 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 *patternFlowPfcPausePauseClass1MetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass1MetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass1MetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass1MetricTag) Clone() (PatternFlowPfcPausePauseClass1MetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass1MetricTag() - 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 -} - -// PatternFlowPfcPausePauseClass1MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPfcPausePauseClass1MetricTag interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass1MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass1MetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass1MetricTag - // setMsg unmarshals PatternFlowPfcPausePauseClass1MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass1MetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1MetricTag - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass1MetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass1MetricTag - // validate validates PatternFlowPfcPausePauseClass1MetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass1MetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPfcPausePauseClass1MetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPfcPausePauseClass1MetricTag - SetName(value string) PatternFlowPfcPausePauseClass1MetricTag - // Offset returns uint32, set in PatternFlowPfcPausePauseClass1MetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass1MetricTag - SetOffset(value uint32) PatternFlowPfcPausePauseClass1MetricTag - // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass1MetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPfcPausePauseClass1MetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass1MetricTag - SetLength(value uint32) PatternFlowPfcPausePauseClass1MetricTag - // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass1MetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPfcPausePauseClass1MetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPfcPausePauseClass1MetricTag object -func (obj *patternFlowPfcPausePauseClass1MetricTag) SetName(value string) PatternFlowPfcPausePauseClass1MetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass1MetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass1MetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass1MetricTag object -func (obj *patternFlowPfcPausePauseClass1MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass1MetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass1MetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass1MetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass1MetricTag object -func (obj *patternFlowPfcPausePauseClass1MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass1MetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass1MetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass1MetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass1MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass1MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass1MetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowPfcPausePauseClass2Counter ***** -type patternFlowPfcPausePauseClass2Counter struct { - validation - obj *otg.PatternFlowPfcPausePauseClass2Counter - marshaller marshalPatternFlowPfcPausePauseClass2Counter - unMarshaller unMarshalPatternFlowPfcPausePauseClass2Counter -} - -func NewPatternFlowPfcPausePauseClass2Counter() PatternFlowPfcPausePauseClass2Counter { - obj := patternFlowPfcPausePauseClass2Counter{obj: &otg.PatternFlowPfcPausePauseClass2Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass2Counter) msg() *otg.PatternFlowPfcPausePauseClass2Counter { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass2Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass2Counter) PatternFlowPfcPausePauseClass2Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass2Counter struct { - obj *patternFlowPfcPausePauseClass2Counter -} - -type marshalPatternFlowPfcPausePauseClass2Counter interface { - // ToProto marshals PatternFlowPfcPausePauseClass2Counter to protobuf object *otg.PatternFlowPfcPausePauseClass2Counter - ToProto() (*otg.PatternFlowPfcPausePauseClass2Counter, error) - // ToPbText marshals PatternFlowPfcPausePauseClass2Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass2Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass2Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass2Counter struct { - obj *patternFlowPfcPausePauseClass2Counter -} - -type unMarshalPatternFlowPfcPausePauseClass2Counter interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass2Counter from protobuf object *otg.PatternFlowPfcPausePauseClass2Counter - FromProto(msg *otg.PatternFlowPfcPausePauseClass2Counter) (PatternFlowPfcPausePauseClass2Counter, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass2Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass2Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass2Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass2Counter) Marshal() marshalPatternFlowPfcPausePauseClass2Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass2Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass2Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass2Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass2Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass2Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass2Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass2Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass2Counter) (PatternFlowPfcPausePauseClass2Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass2Counter) 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 *unMarshalpatternFlowPfcPausePauseClass2Counter) 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 *marshalpatternFlowPfcPausePauseClass2Counter) 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 *unMarshalpatternFlowPfcPausePauseClass2Counter) 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 *marshalpatternFlowPfcPausePauseClass2Counter) 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 *unMarshalpatternFlowPfcPausePauseClass2Counter) 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 *patternFlowPfcPausePauseClass2Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass2Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass2Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass2Counter) Clone() (PatternFlowPfcPausePauseClass2Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass2Counter() - 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 -} - -// PatternFlowPfcPausePauseClass2Counter is integer counter pattern -type PatternFlowPfcPausePauseClass2Counter interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass2Counter to protobuf object *otg.PatternFlowPfcPausePauseClass2Counter - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass2Counter - // setMsg unmarshals PatternFlowPfcPausePauseClass2Counter from protobuf object *otg.PatternFlowPfcPausePauseClass2Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass2Counter) PatternFlowPfcPausePauseClass2Counter - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass2Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass2Counter - // validate validates PatternFlowPfcPausePauseClass2Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass2Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowPfcPausePauseClass2Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass2Counter - SetStart(value uint32) PatternFlowPfcPausePauseClass2Counter - // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass2Counter - HasStart() bool - // Step returns uint32, set in PatternFlowPfcPausePauseClass2Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass2Counter - SetStep(value uint32) PatternFlowPfcPausePauseClass2Counter - // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass2Counter - HasStep() bool - // Count returns uint32, set in PatternFlowPfcPausePauseClass2Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass2Counter - SetCount(value uint32) PatternFlowPfcPausePauseClass2Counter - // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass2Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass2Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass2Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass2Counter object -func (obj *patternFlowPfcPausePauseClass2Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass2Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass2Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass2Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass2Counter object -func (obj *patternFlowPfcPausePauseClass2Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass2Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass2Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass2Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass2Counter object -func (obj *patternFlowPfcPausePauseClass2Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass2Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass2Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass2Counter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass2Counter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass2Counter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass2Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPfcPausePauseClass2MetricTag ***** -type patternFlowPfcPausePauseClass2MetricTag struct { - validation - obj *otg.PatternFlowPfcPausePauseClass2MetricTag - marshaller marshalPatternFlowPfcPausePauseClass2MetricTag - unMarshaller unMarshalPatternFlowPfcPausePauseClass2MetricTag -} - -func NewPatternFlowPfcPausePauseClass2MetricTag() PatternFlowPfcPausePauseClass2MetricTag { - obj := patternFlowPfcPausePauseClass2MetricTag{obj: &otg.PatternFlowPfcPausePauseClass2MetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass2MetricTag) msg() *otg.PatternFlowPfcPausePauseClass2MetricTag { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass2MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2MetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass2MetricTag struct { - obj *patternFlowPfcPausePauseClass2MetricTag -} - -type marshalPatternFlowPfcPausePauseClass2MetricTag interface { - // ToProto marshals PatternFlowPfcPausePauseClass2MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass2MetricTag - ToProto() (*otg.PatternFlowPfcPausePauseClass2MetricTag, error) - // ToPbText marshals PatternFlowPfcPausePauseClass2MetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass2MetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass2MetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass2MetricTag struct { - obj *patternFlowPfcPausePauseClass2MetricTag -} - -type unMarshalPatternFlowPfcPausePauseClass2MetricTag interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass2MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass2MetricTag - FromProto(msg *otg.PatternFlowPfcPausePauseClass2MetricTag) (PatternFlowPfcPausePauseClass2MetricTag, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass2MetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass2MetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass2MetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass2MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass2MetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass2MetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass2MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass2MetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass2MetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass2MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass2MetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass2MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass2MetricTag) (PatternFlowPfcPausePauseClass2MetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass2MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass2MetricTag) 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 *marshalpatternFlowPfcPausePauseClass2MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass2MetricTag) 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 *marshalpatternFlowPfcPausePauseClass2MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass2MetricTag) 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 *patternFlowPfcPausePauseClass2MetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass2MetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass2MetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass2MetricTag) Clone() (PatternFlowPfcPausePauseClass2MetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass2MetricTag() - 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 -} - -// PatternFlowPfcPausePauseClass2MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPfcPausePauseClass2MetricTag interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass2MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass2MetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass2MetricTag - // setMsg unmarshals PatternFlowPfcPausePauseClass2MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass2MetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2MetricTag - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass2MetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass2MetricTag - // validate validates PatternFlowPfcPausePauseClass2MetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass2MetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPfcPausePauseClass2MetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPfcPausePauseClass2MetricTag - SetName(value string) PatternFlowPfcPausePauseClass2MetricTag - // Offset returns uint32, set in PatternFlowPfcPausePauseClass2MetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass2MetricTag - SetOffset(value uint32) PatternFlowPfcPausePauseClass2MetricTag - // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass2MetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPfcPausePauseClass2MetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass2MetricTag - SetLength(value uint32) PatternFlowPfcPausePauseClass2MetricTag - // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass2MetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPfcPausePauseClass2MetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPfcPausePauseClass2MetricTag object -func (obj *patternFlowPfcPausePauseClass2MetricTag) SetName(value string) PatternFlowPfcPausePauseClass2MetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass2MetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass2MetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass2MetricTag object -func (obj *patternFlowPfcPausePauseClass2MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass2MetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass2MetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass2MetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass2MetricTag object -func (obj *patternFlowPfcPausePauseClass2MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass2MetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass2MetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass2MetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass2MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass2MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass2MetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowPfcPausePauseClass3Counter ***** -type patternFlowPfcPausePauseClass3Counter struct { - validation - obj *otg.PatternFlowPfcPausePauseClass3Counter - marshaller marshalPatternFlowPfcPausePauseClass3Counter - unMarshaller unMarshalPatternFlowPfcPausePauseClass3Counter -} - -func NewPatternFlowPfcPausePauseClass3Counter() PatternFlowPfcPausePauseClass3Counter { - obj := patternFlowPfcPausePauseClass3Counter{obj: &otg.PatternFlowPfcPausePauseClass3Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass3Counter) msg() *otg.PatternFlowPfcPausePauseClass3Counter { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass3Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass3Counter) PatternFlowPfcPausePauseClass3Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass3Counter struct { - obj *patternFlowPfcPausePauseClass3Counter -} - -type marshalPatternFlowPfcPausePauseClass3Counter interface { - // ToProto marshals PatternFlowPfcPausePauseClass3Counter to protobuf object *otg.PatternFlowPfcPausePauseClass3Counter - ToProto() (*otg.PatternFlowPfcPausePauseClass3Counter, error) - // ToPbText marshals PatternFlowPfcPausePauseClass3Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass3Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass3Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass3Counter struct { - obj *patternFlowPfcPausePauseClass3Counter -} - -type unMarshalPatternFlowPfcPausePauseClass3Counter interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass3Counter from protobuf object *otg.PatternFlowPfcPausePauseClass3Counter - FromProto(msg *otg.PatternFlowPfcPausePauseClass3Counter) (PatternFlowPfcPausePauseClass3Counter, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass3Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass3Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass3Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass3Counter) Marshal() marshalPatternFlowPfcPausePauseClass3Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass3Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass3Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass3Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass3Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass3Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass3Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass3Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass3Counter) (PatternFlowPfcPausePauseClass3Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass3Counter) 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 *unMarshalpatternFlowPfcPausePauseClass3Counter) 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 *marshalpatternFlowPfcPausePauseClass3Counter) 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 *unMarshalpatternFlowPfcPausePauseClass3Counter) 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 *marshalpatternFlowPfcPausePauseClass3Counter) 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 *unMarshalpatternFlowPfcPausePauseClass3Counter) 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 *patternFlowPfcPausePauseClass3Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass3Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass3Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass3Counter) Clone() (PatternFlowPfcPausePauseClass3Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass3Counter() - 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 -} - -// PatternFlowPfcPausePauseClass3Counter is integer counter pattern -type PatternFlowPfcPausePauseClass3Counter interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass3Counter to protobuf object *otg.PatternFlowPfcPausePauseClass3Counter - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass3Counter - // setMsg unmarshals PatternFlowPfcPausePauseClass3Counter from protobuf object *otg.PatternFlowPfcPausePauseClass3Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass3Counter) PatternFlowPfcPausePauseClass3Counter - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass3Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass3Counter - // validate validates PatternFlowPfcPausePauseClass3Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass3Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowPfcPausePauseClass3Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass3Counter - SetStart(value uint32) PatternFlowPfcPausePauseClass3Counter - // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass3Counter - HasStart() bool - // Step returns uint32, set in PatternFlowPfcPausePauseClass3Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass3Counter - SetStep(value uint32) PatternFlowPfcPausePauseClass3Counter - // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass3Counter - HasStep() bool - // Count returns uint32, set in PatternFlowPfcPausePauseClass3Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass3Counter - SetCount(value uint32) PatternFlowPfcPausePauseClass3Counter - // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass3Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass3Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass3Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass3Counter object -func (obj *patternFlowPfcPausePauseClass3Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass3Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass3Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass3Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass3Counter object -func (obj *patternFlowPfcPausePauseClass3Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass3Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass3Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass3Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass3Counter object -func (obj *patternFlowPfcPausePauseClass3Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass3Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass3Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass3Counter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass3Counter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass3Counter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass3Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPfcPausePauseClass3MetricTag ***** -type patternFlowPfcPausePauseClass3MetricTag struct { - validation - obj *otg.PatternFlowPfcPausePauseClass3MetricTag - marshaller marshalPatternFlowPfcPausePauseClass3MetricTag - unMarshaller unMarshalPatternFlowPfcPausePauseClass3MetricTag -} - -func NewPatternFlowPfcPausePauseClass3MetricTag() PatternFlowPfcPausePauseClass3MetricTag { - obj := patternFlowPfcPausePauseClass3MetricTag{obj: &otg.PatternFlowPfcPausePauseClass3MetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass3MetricTag) msg() *otg.PatternFlowPfcPausePauseClass3MetricTag { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass3MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3MetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass3MetricTag struct { - obj *patternFlowPfcPausePauseClass3MetricTag -} - -type marshalPatternFlowPfcPausePauseClass3MetricTag interface { - // ToProto marshals PatternFlowPfcPausePauseClass3MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass3MetricTag - ToProto() (*otg.PatternFlowPfcPausePauseClass3MetricTag, error) - // ToPbText marshals PatternFlowPfcPausePauseClass3MetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass3MetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass3MetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass3MetricTag struct { - obj *patternFlowPfcPausePauseClass3MetricTag -} - -type unMarshalPatternFlowPfcPausePauseClass3MetricTag interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass3MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass3MetricTag - FromProto(msg *otg.PatternFlowPfcPausePauseClass3MetricTag) (PatternFlowPfcPausePauseClass3MetricTag, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass3MetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass3MetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass3MetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass3MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass3MetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass3MetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass3MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass3MetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass3MetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass3MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass3MetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass3MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass3MetricTag) (PatternFlowPfcPausePauseClass3MetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass3MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass3MetricTag) 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 *marshalpatternFlowPfcPausePauseClass3MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass3MetricTag) 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 *marshalpatternFlowPfcPausePauseClass3MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass3MetricTag) 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 *patternFlowPfcPausePauseClass3MetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass3MetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass3MetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass3MetricTag) Clone() (PatternFlowPfcPausePauseClass3MetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass3MetricTag() - 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 -} - -// PatternFlowPfcPausePauseClass3MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPfcPausePauseClass3MetricTag interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass3MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass3MetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass3MetricTag - // setMsg unmarshals PatternFlowPfcPausePauseClass3MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass3MetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3MetricTag - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass3MetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass3MetricTag - // validate validates PatternFlowPfcPausePauseClass3MetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass3MetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPfcPausePauseClass3MetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPfcPausePauseClass3MetricTag - SetName(value string) PatternFlowPfcPausePauseClass3MetricTag - // Offset returns uint32, set in PatternFlowPfcPausePauseClass3MetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass3MetricTag - SetOffset(value uint32) PatternFlowPfcPausePauseClass3MetricTag - // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass3MetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPfcPausePauseClass3MetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass3MetricTag - SetLength(value uint32) PatternFlowPfcPausePauseClass3MetricTag - // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass3MetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPfcPausePauseClass3MetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPfcPausePauseClass3MetricTag object -func (obj *patternFlowPfcPausePauseClass3MetricTag) SetName(value string) PatternFlowPfcPausePauseClass3MetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass3MetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass3MetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass3MetricTag object -func (obj *patternFlowPfcPausePauseClass3MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass3MetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass3MetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass3MetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass3MetricTag object -func (obj *patternFlowPfcPausePauseClass3MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass3MetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass3MetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass3MetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass3MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass3MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass3MetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowPfcPausePauseClass4Counter ***** -type patternFlowPfcPausePauseClass4Counter struct { - validation - obj *otg.PatternFlowPfcPausePauseClass4Counter - marshaller marshalPatternFlowPfcPausePauseClass4Counter - unMarshaller unMarshalPatternFlowPfcPausePauseClass4Counter -} - -func NewPatternFlowPfcPausePauseClass4Counter() PatternFlowPfcPausePauseClass4Counter { - obj := patternFlowPfcPausePauseClass4Counter{obj: &otg.PatternFlowPfcPausePauseClass4Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass4Counter) msg() *otg.PatternFlowPfcPausePauseClass4Counter { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass4Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass4Counter) PatternFlowPfcPausePauseClass4Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass4Counter struct { - obj *patternFlowPfcPausePauseClass4Counter -} - -type marshalPatternFlowPfcPausePauseClass4Counter interface { - // ToProto marshals PatternFlowPfcPausePauseClass4Counter to protobuf object *otg.PatternFlowPfcPausePauseClass4Counter - ToProto() (*otg.PatternFlowPfcPausePauseClass4Counter, error) - // ToPbText marshals PatternFlowPfcPausePauseClass4Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass4Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass4Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass4Counter struct { - obj *patternFlowPfcPausePauseClass4Counter -} - -type unMarshalPatternFlowPfcPausePauseClass4Counter interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass4Counter from protobuf object *otg.PatternFlowPfcPausePauseClass4Counter - FromProto(msg *otg.PatternFlowPfcPausePauseClass4Counter) (PatternFlowPfcPausePauseClass4Counter, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass4Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass4Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass4Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass4Counter) Marshal() marshalPatternFlowPfcPausePauseClass4Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass4Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass4Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass4Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass4Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass4Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass4Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass4Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass4Counter) (PatternFlowPfcPausePauseClass4Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass4Counter) 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 *unMarshalpatternFlowPfcPausePauseClass4Counter) 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 *marshalpatternFlowPfcPausePauseClass4Counter) 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 *unMarshalpatternFlowPfcPausePauseClass4Counter) 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 *marshalpatternFlowPfcPausePauseClass4Counter) 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 *unMarshalpatternFlowPfcPausePauseClass4Counter) 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 *patternFlowPfcPausePauseClass4Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass4Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass4Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass4Counter) Clone() (PatternFlowPfcPausePauseClass4Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass4Counter() - 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 -} - -// PatternFlowPfcPausePauseClass4Counter is integer counter pattern -type PatternFlowPfcPausePauseClass4Counter interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass4Counter to protobuf object *otg.PatternFlowPfcPausePauseClass4Counter - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass4Counter - // setMsg unmarshals PatternFlowPfcPausePauseClass4Counter from protobuf object *otg.PatternFlowPfcPausePauseClass4Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass4Counter) PatternFlowPfcPausePauseClass4Counter - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass4Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass4Counter - // validate validates PatternFlowPfcPausePauseClass4Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass4Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowPfcPausePauseClass4Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass4Counter - SetStart(value uint32) PatternFlowPfcPausePauseClass4Counter - // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass4Counter - HasStart() bool - // Step returns uint32, set in PatternFlowPfcPausePauseClass4Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass4Counter - SetStep(value uint32) PatternFlowPfcPausePauseClass4Counter - // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass4Counter - HasStep() bool - // Count returns uint32, set in PatternFlowPfcPausePauseClass4Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass4Counter - SetCount(value uint32) PatternFlowPfcPausePauseClass4Counter - // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass4Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass4Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass4Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass4Counter object -func (obj *patternFlowPfcPausePauseClass4Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass4Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass4Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass4Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass4Counter object -func (obj *patternFlowPfcPausePauseClass4Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass4Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass4Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass4Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass4Counter object -func (obj *patternFlowPfcPausePauseClass4Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass4Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass4Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass4Counter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass4Counter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass4Counter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass4Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPfcPausePauseClass4MetricTag ***** -type patternFlowPfcPausePauseClass4MetricTag struct { - validation - obj *otg.PatternFlowPfcPausePauseClass4MetricTag - marshaller marshalPatternFlowPfcPausePauseClass4MetricTag - unMarshaller unMarshalPatternFlowPfcPausePauseClass4MetricTag -} - -func NewPatternFlowPfcPausePauseClass4MetricTag() PatternFlowPfcPausePauseClass4MetricTag { - obj := patternFlowPfcPausePauseClass4MetricTag{obj: &otg.PatternFlowPfcPausePauseClass4MetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass4MetricTag) msg() *otg.PatternFlowPfcPausePauseClass4MetricTag { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass4MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4MetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass4MetricTag struct { - obj *patternFlowPfcPausePauseClass4MetricTag -} - -type marshalPatternFlowPfcPausePauseClass4MetricTag interface { - // ToProto marshals PatternFlowPfcPausePauseClass4MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass4MetricTag - ToProto() (*otg.PatternFlowPfcPausePauseClass4MetricTag, error) - // ToPbText marshals PatternFlowPfcPausePauseClass4MetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass4MetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass4MetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass4MetricTag struct { - obj *patternFlowPfcPausePauseClass4MetricTag -} - -type unMarshalPatternFlowPfcPausePauseClass4MetricTag interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass4MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass4MetricTag - FromProto(msg *otg.PatternFlowPfcPausePauseClass4MetricTag) (PatternFlowPfcPausePauseClass4MetricTag, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass4MetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass4MetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass4MetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass4MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass4MetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass4MetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass4MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass4MetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass4MetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass4MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass4MetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass4MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass4MetricTag) (PatternFlowPfcPausePauseClass4MetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass4MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass4MetricTag) 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 *marshalpatternFlowPfcPausePauseClass4MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass4MetricTag) 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 *marshalpatternFlowPfcPausePauseClass4MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass4MetricTag) 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 *patternFlowPfcPausePauseClass4MetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass4MetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass4MetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass4MetricTag) Clone() (PatternFlowPfcPausePauseClass4MetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass4MetricTag() - 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 -} - -// PatternFlowPfcPausePauseClass4MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPfcPausePauseClass4MetricTag interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass4MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass4MetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass4MetricTag - // setMsg unmarshals PatternFlowPfcPausePauseClass4MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass4MetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4MetricTag - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass4MetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass4MetricTag - // validate validates PatternFlowPfcPausePauseClass4MetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass4MetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPfcPausePauseClass4MetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPfcPausePauseClass4MetricTag - SetName(value string) PatternFlowPfcPausePauseClass4MetricTag - // Offset returns uint32, set in PatternFlowPfcPausePauseClass4MetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass4MetricTag - SetOffset(value uint32) PatternFlowPfcPausePauseClass4MetricTag - // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass4MetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPfcPausePauseClass4MetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass4MetricTag - SetLength(value uint32) PatternFlowPfcPausePauseClass4MetricTag - // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass4MetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPfcPausePauseClass4MetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPfcPausePauseClass4MetricTag object -func (obj *patternFlowPfcPausePauseClass4MetricTag) SetName(value string) PatternFlowPfcPausePauseClass4MetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass4MetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass4MetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass4MetricTag object -func (obj *patternFlowPfcPausePauseClass4MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass4MetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass4MetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass4MetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass4MetricTag object -func (obj *patternFlowPfcPausePauseClass4MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass4MetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass4MetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass4MetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass4MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass4MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass4MetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowPfcPausePauseClass5Counter ***** -type patternFlowPfcPausePauseClass5Counter struct { - validation - obj *otg.PatternFlowPfcPausePauseClass5Counter - marshaller marshalPatternFlowPfcPausePauseClass5Counter - unMarshaller unMarshalPatternFlowPfcPausePauseClass5Counter -} - -func NewPatternFlowPfcPausePauseClass5Counter() PatternFlowPfcPausePauseClass5Counter { - obj := patternFlowPfcPausePauseClass5Counter{obj: &otg.PatternFlowPfcPausePauseClass5Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass5Counter) msg() *otg.PatternFlowPfcPausePauseClass5Counter { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass5Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass5Counter) PatternFlowPfcPausePauseClass5Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass5Counter struct { - obj *patternFlowPfcPausePauseClass5Counter -} - -type marshalPatternFlowPfcPausePauseClass5Counter interface { - // ToProto marshals PatternFlowPfcPausePauseClass5Counter to protobuf object *otg.PatternFlowPfcPausePauseClass5Counter - ToProto() (*otg.PatternFlowPfcPausePauseClass5Counter, error) - // ToPbText marshals PatternFlowPfcPausePauseClass5Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass5Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass5Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass5Counter struct { - obj *patternFlowPfcPausePauseClass5Counter -} - -type unMarshalPatternFlowPfcPausePauseClass5Counter interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass5Counter from protobuf object *otg.PatternFlowPfcPausePauseClass5Counter - FromProto(msg *otg.PatternFlowPfcPausePauseClass5Counter) (PatternFlowPfcPausePauseClass5Counter, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass5Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass5Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass5Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass5Counter) Marshal() marshalPatternFlowPfcPausePauseClass5Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass5Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass5Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass5Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass5Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass5Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass5Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass5Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass5Counter) (PatternFlowPfcPausePauseClass5Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass5Counter) 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 *unMarshalpatternFlowPfcPausePauseClass5Counter) 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 *marshalpatternFlowPfcPausePauseClass5Counter) 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 *unMarshalpatternFlowPfcPausePauseClass5Counter) 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 *marshalpatternFlowPfcPausePauseClass5Counter) 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 *unMarshalpatternFlowPfcPausePauseClass5Counter) 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 *patternFlowPfcPausePauseClass5Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass5Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass5Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass5Counter) Clone() (PatternFlowPfcPausePauseClass5Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass5Counter() - 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 -} - -// PatternFlowPfcPausePauseClass5Counter is integer counter pattern -type PatternFlowPfcPausePauseClass5Counter interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass5Counter to protobuf object *otg.PatternFlowPfcPausePauseClass5Counter - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass5Counter - // setMsg unmarshals PatternFlowPfcPausePauseClass5Counter from protobuf object *otg.PatternFlowPfcPausePauseClass5Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass5Counter) PatternFlowPfcPausePauseClass5Counter - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass5Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass5Counter - // validate validates PatternFlowPfcPausePauseClass5Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass5Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowPfcPausePauseClass5Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass5Counter - SetStart(value uint32) PatternFlowPfcPausePauseClass5Counter - // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass5Counter - HasStart() bool - // Step returns uint32, set in PatternFlowPfcPausePauseClass5Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass5Counter - SetStep(value uint32) PatternFlowPfcPausePauseClass5Counter - // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass5Counter - HasStep() bool - // Count returns uint32, set in PatternFlowPfcPausePauseClass5Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass5Counter - SetCount(value uint32) PatternFlowPfcPausePauseClass5Counter - // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass5Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass5Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass5Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass5Counter object -func (obj *patternFlowPfcPausePauseClass5Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass5Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass5Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass5Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass5Counter object -func (obj *patternFlowPfcPausePauseClass5Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass5Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass5Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass5Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass5Counter object -func (obj *patternFlowPfcPausePauseClass5Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass5Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass5Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass5Counter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass5Counter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass5Counter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass5Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPfcPausePauseClass5MetricTag ***** -type patternFlowPfcPausePauseClass5MetricTag struct { - validation - obj *otg.PatternFlowPfcPausePauseClass5MetricTag - marshaller marshalPatternFlowPfcPausePauseClass5MetricTag - unMarshaller unMarshalPatternFlowPfcPausePauseClass5MetricTag -} - -func NewPatternFlowPfcPausePauseClass5MetricTag() PatternFlowPfcPausePauseClass5MetricTag { - obj := patternFlowPfcPausePauseClass5MetricTag{obj: &otg.PatternFlowPfcPausePauseClass5MetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass5MetricTag) msg() *otg.PatternFlowPfcPausePauseClass5MetricTag { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass5MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5MetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass5MetricTag struct { - obj *patternFlowPfcPausePauseClass5MetricTag -} - -type marshalPatternFlowPfcPausePauseClass5MetricTag interface { - // ToProto marshals PatternFlowPfcPausePauseClass5MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass5MetricTag - ToProto() (*otg.PatternFlowPfcPausePauseClass5MetricTag, error) - // ToPbText marshals PatternFlowPfcPausePauseClass5MetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass5MetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass5MetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass5MetricTag struct { - obj *patternFlowPfcPausePauseClass5MetricTag -} - -type unMarshalPatternFlowPfcPausePauseClass5MetricTag interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass5MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass5MetricTag - FromProto(msg *otg.PatternFlowPfcPausePauseClass5MetricTag) (PatternFlowPfcPausePauseClass5MetricTag, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass5MetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass5MetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass5MetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass5MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass5MetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass5MetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass5MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass5MetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass5MetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass5MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass5MetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass5MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass5MetricTag) (PatternFlowPfcPausePauseClass5MetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass5MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass5MetricTag) 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 *marshalpatternFlowPfcPausePauseClass5MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass5MetricTag) 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 *marshalpatternFlowPfcPausePauseClass5MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass5MetricTag) 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 *patternFlowPfcPausePauseClass5MetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass5MetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass5MetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass5MetricTag) Clone() (PatternFlowPfcPausePauseClass5MetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass5MetricTag() - 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 -} - -// PatternFlowPfcPausePauseClass5MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPfcPausePauseClass5MetricTag interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass5MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass5MetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass5MetricTag - // setMsg unmarshals PatternFlowPfcPausePauseClass5MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass5MetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5MetricTag - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass5MetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass5MetricTag - // validate validates PatternFlowPfcPausePauseClass5MetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass5MetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPfcPausePauseClass5MetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPfcPausePauseClass5MetricTag - SetName(value string) PatternFlowPfcPausePauseClass5MetricTag - // Offset returns uint32, set in PatternFlowPfcPausePauseClass5MetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass5MetricTag - SetOffset(value uint32) PatternFlowPfcPausePauseClass5MetricTag - // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass5MetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPfcPausePauseClass5MetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass5MetricTag - SetLength(value uint32) PatternFlowPfcPausePauseClass5MetricTag - // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass5MetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPfcPausePauseClass5MetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPfcPausePauseClass5MetricTag object -func (obj *patternFlowPfcPausePauseClass5MetricTag) SetName(value string) PatternFlowPfcPausePauseClass5MetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass5MetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass5MetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass5MetricTag object -func (obj *patternFlowPfcPausePauseClass5MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass5MetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass5MetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass5MetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass5MetricTag object -func (obj *patternFlowPfcPausePauseClass5MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass5MetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass5MetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass5MetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass5MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass5MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass5MetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowPfcPausePauseClass6Counter ***** -type patternFlowPfcPausePauseClass6Counter struct { - validation - obj *otg.PatternFlowPfcPausePauseClass6Counter - marshaller marshalPatternFlowPfcPausePauseClass6Counter - unMarshaller unMarshalPatternFlowPfcPausePauseClass6Counter -} - -func NewPatternFlowPfcPausePauseClass6Counter() PatternFlowPfcPausePauseClass6Counter { - obj := patternFlowPfcPausePauseClass6Counter{obj: &otg.PatternFlowPfcPausePauseClass6Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass6Counter) msg() *otg.PatternFlowPfcPausePauseClass6Counter { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass6Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass6Counter) PatternFlowPfcPausePauseClass6Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass6Counter struct { - obj *patternFlowPfcPausePauseClass6Counter -} - -type marshalPatternFlowPfcPausePauseClass6Counter interface { - // ToProto marshals PatternFlowPfcPausePauseClass6Counter to protobuf object *otg.PatternFlowPfcPausePauseClass6Counter - ToProto() (*otg.PatternFlowPfcPausePauseClass6Counter, error) - // ToPbText marshals PatternFlowPfcPausePauseClass6Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass6Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass6Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass6Counter struct { - obj *patternFlowPfcPausePauseClass6Counter -} - -type unMarshalPatternFlowPfcPausePauseClass6Counter interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass6Counter from protobuf object *otg.PatternFlowPfcPausePauseClass6Counter - FromProto(msg *otg.PatternFlowPfcPausePauseClass6Counter) (PatternFlowPfcPausePauseClass6Counter, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass6Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass6Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass6Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass6Counter) Marshal() marshalPatternFlowPfcPausePauseClass6Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass6Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass6Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass6Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass6Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass6Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass6Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass6Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass6Counter) (PatternFlowPfcPausePauseClass6Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass6Counter) 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 *unMarshalpatternFlowPfcPausePauseClass6Counter) 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 *marshalpatternFlowPfcPausePauseClass6Counter) 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 *unMarshalpatternFlowPfcPausePauseClass6Counter) 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 *marshalpatternFlowPfcPausePauseClass6Counter) 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 *unMarshalpatternFlowPfcPausePauseClass6Counter) 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 *patternFlowPfcPausePauseClass6Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass6Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass6Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass6Counter) Clone() (PatternFlowPfcPausePauseClass6Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass6Counter() - 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 -} - -// PatternFlowPfcPausePauseClass6Counter is integer counter pattern -type PatternFlowPfcPausePauseClass6Counter interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass6Counter to protobuf object *otg.PatternFlowPfcPausePauseClass6Counter - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass6Counter - // setMsg unmarshals PatternFlowPfcPausePauseClass6Counter from protobuf object *otg.PatternFlowPfcPausePauseClass6Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass6Counter) PatternFlowPfcPausePauseClass6Counter - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass6Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass6Counter - // validate validates PatternFlowPfcPausePauseClass6Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass6Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowPfcPausePauseClass6Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass6Counter - SetStart(value uint32) PatternFlowPfcPausePauseClass6Counter - // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass6Counter - HasStart() bool - // Step returns uint32, set in PatternFlowPfcPausePauseClass6Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass6Counter - SetStep(value uint32) PatternFlowPfcPausePauseClass6Counter - // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass6Counter - HasStep() bool - // Count returns uint32, set in PatternFlowPfcPausePauseClass6Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass6Counter - SetCount(value uint32) PatternFlowPfcPausePauseClass6Counter - // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass6Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass6Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass6Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass6Counter object -func (obj *patternFlowPfcPausePauseClass6Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass6Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass6Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass6Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass6Counter object -func (obj *patternFlowPfcPausePauseClass6Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass6Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass6Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass6Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass6Counter object -func (obj *patternFlowPfcPausePauseClass6Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass6Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass6Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass6Counter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass6Counter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass6Counter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass6Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPfcPausePauseClass6MetricTag ***** -type patternFlowPfcPausePauseClass6MetricTag struct { - validation - obj *otg.PatternFlowPfcPausePauseClass6MetricTag - marshaller marshalPatternFlowPfcPausePauseClass6MetricTag - unMarshaller unMarshalPatternFlowPfcPausePauseClass6MetricTag -} - -func NewPatternFlowPfcPausePauseClass6MetricTag() PatternFlowPfcPausePauseClass6MetricTag { - obj := patternFlowPfcPausePauseClass6MetricTag{obj: &otg.PatternFlowPfcPausePauseClass6MetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass6MetricTag) msg() *otg.PatternFlowPfcPausePauseClass6MetricTag { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass6MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6MetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass6MetricTag struct { - obj *patternFlowPfcPausePauseClass6MetricTag -} - -type marshalPatternFlowPfcPausePauseClass6MetricTag interface { - // ToProto marshals PatternFlowPfcPausePauseClass6MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass6MetricTag - ToProto() (*otg.PatternFlowPfcPausePauseClass6MetricTag, error) - // ToPbText marshals PatternFlowPfcPausePauseClass6MetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass6MetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass6MetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass6MetricTag struct { - obj *patternFlowPfcPausePauseClass6MetricTag -} - -type unMarshalPatternFlowPfcPausePauseClass6MetricTag interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass6MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass6MetricTag - FromProto(msg *otg.PatternFlowPfcPausePauseClass6MetricTag) (PatternFlowPfcPausePauseClass6MetricTag, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass6MetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass6MetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass6MetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass6MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass6MetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass6MetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass6MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass6MetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass6MetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass6MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass6MetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass6MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass6MetricTag) (PatternFlowPfcPausePauseClass6MetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass6MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass6MetricTag) 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 *marshalpatternFlowPfcPausePauseClass6MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass6MetricTag) 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 *marshalpatternFlowPfcPausePauseClass6MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass6MetricTag) 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 *patternFlowPfcPausePauseClass6MetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass6MetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass6MetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass6MetricTag) Clone() (PatternFlowPfcPausePauseClass6MetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass6MetricTag() - 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 -} - -// PatternFlowPfcPausePauseClass6MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPfcPausePauseClass6MetricTag interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass6MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass6MetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass6MetricTag - // setMsg unmarshals PatternFlowPfcPausePauseClass6MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass6MetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6MetricTag - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass6MetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass6MetricTag - // validate validates PatternFlowPfcPausePauseClass6MetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass6MetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPfcPausePauseClass6MetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPfcPausePauseClass6MetricTag - SetName(value string) PatternFlowPfcPausePauseClass6MetricTag - // Offset returns uint32, set in PatternFlowPfcPausePauseClass6MetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass6MetricTag - SetOffset(value uint32) PatternFlowPfcPausePauseClass6MetricTag - // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass6MetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPfcPausePauseClass6MetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass6MetricTag - SetLength(value uint32) PatternFlowPfcPausePauseClass6MetricTag - // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass6MetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPfcPausePauseClass6MetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPfcPausePauseClass6MetricTag object -func (obj *patternFlowPfcPausePauseClass6MetricTag) SetName(value string) PatternFlowPfcPausePauseClass6MetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass6MetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass6MetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass6MetricTag object -func (obj *patternFlowPfcPausePauseClass6MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass6MetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass6MetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass6MetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass6MetricTag object -func (obj *patternFlowPfcPausePauseClass6MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass6MetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass6MetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass6MetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass6MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass6MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass6MetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowPfcPausePauseClass7Counter ***** -type patternFlowPfcPausePauseClass7Counter struct { - validation - obj *otg.PatternFlowPfcPausePauseClass7Counter - marshaller marshalPatternFlowPfcPausePauseClass7Counter - unMarshaller unMarshalPatternFlowPfcPausePauseClass7Counter -} - -func NewPatternFlowPfcPausePauseClass7Counter() PatternFlowPfcPausePauseClass7Counter { - obj := patternFlowPfcPausePauseClass7Counter{obj: &otg.PatternFlowPfcPausePauseClass7Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass7Counter) msg() *otg.PatternFlowPfcPausePauseClass7Counter { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass7Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass7Counter) PatternFlowPfcPausePauseClass7Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass7Counter struct { - obj *patternFlowPfcPausePauseClass7Counter -} - -type marshalPatternFlowPfcPausePauseClass7Counter interface { - // ToProto marshals PatternFlowPfcPausePauseClass7Counter to protobuf object *otg.PatternFlowPfcPausePauseClass7Counter - ToProto() (*otg.PatternFlowPfcPausePauseClass7Counter, error) - // ToPbText marshals PatternFlowPfcPausePauseClass7Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass7Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass7Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass7Counter struct { - obj *patternFlowPfcPausePauseClass7Counter -} - -type unMarshalPatternFlowPfcPausePauseClass7Counter interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass7Counter from protobuf object *otg.PatternFlowPfcPausePauseClass7Counter - FromProto(msg *otg.PatternFlowPfcPausePauseClass7Counter) (PatternFlowPfcPausePauseClass7Counter, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass7Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass7Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass7Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass7Counter) Marshal() marshalPatternFlowPfcPausePauseClass7Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass7Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass7Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass7Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass7Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass7Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass7Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass7Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass7Counter) (PatternFlowPfcPausePauseClass7Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass7Counter) 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 *unMarshalpatternFlowPfcPausePauseClass7Counter) 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 *marshalpatternFlowPfcPausePauseClass7Counter) 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 *unMarshalpatternFlowPfcPausePauseClass7Counter) 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 *marshalpatternFlowPfcPausePauseClass7Counter) 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 *unMarshalpatternFlowPfcPausePauseClass7Counter) 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 *patternFlowPfcPausePauseClass7Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass7Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass7Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass7Counter) Clone() (PatternFlowPfcPausePauseClass7Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass7Counter() - 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 -} - -// PatternFlowPfcPausePauseClass7Counter is integer counter pattern -type PatternFlowPfcPausePauseClass7Counter interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass7Counter to protobuf object *otg.PatternFlowPfcPausePauseClass7Counter - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass7Counter - // setMsg unmarshals PatternFlowPfcPausePauseClass7Counter from protobuf object *otg.PatternFlowPfcPausePauseClass7Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass7Counter) PatternFlowPfcPausePauseClass7Counter - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass7Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass7Counter - // validate validates PatternFlowPfcPausePauseClass7Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass7Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowPfcPausePauseClass7Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass7Counter - SetStart(value uint32) PatternFlowPfcPausePauseClass7Counter - // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass7Counter - HasStart() bool - // Step returns uint32, set in PatternFlowPfcPausePauseClass7Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass7Counter - SetStep(value uint32) PatternFlowPfcPausePauseClass7Counter - // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass7Counter - HasStep() bool - // Count returns uint32, set in PatternFlowPfcPausePauseClass7Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass7Counter - SetCount(value uint32) PatternFlowPfcPausePauseClass7Counter - // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass7Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass7Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPfcPausePauseClass7Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass7Counter object -func (obj *patternFlowPfcPausePauseClass7Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass7Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass7Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPfcPausePauseClass7Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass7Counter object -func (obj *patternFlowPfcPausePauseClass7Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass7Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass7Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPfcPausePauseClass7Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass7Counter object -func (obj *patternFlowPfcPausePauseClass7Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass7Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass7Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass7Counter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass7Counter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass7Counter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass7Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPfcPausePauseClass7MetricTag ***** -type patternFlowPfcPausePauseClass7MetricTag struct { - validation - obj *otg.PatternFlowPfcPausePauseClass7MetricTag - marshaller marshalPatternFlowPfcPausePauseClass7MetricTag - unMarshaller unMarshalPatternFlowPfcPausePauseClass7MetricTag -} - -func NewPatternFlowPfcPausePauseClass7MetricTag() PatternFlowPfcPausePauseClass7MetricTag { - obj := patternFlowPfcPausePauseClass7MetricTag{obj: &otg.PatternFlowPfcPausePauseClass7MetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPfcPausePauseClass7MetricTag) msg() *otg.PatternFlowPfcPausePauseClass7MetricTag { - return obj.obj -} - -func (obj *patternFlowPfcPausePauseClass7MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7MetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPfcPausePauseClass7MetricTag struct { - obj *patternFlowPfcPausePauseClass7MetricTag -} - -type marshalPatternFlowPfcPausePauseClass7MetricTag interface { - // ToProto marshals PatternFlowPfcPausePauseClass7MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass7MetricTag - ToProto() (*otg.PatternFlowPfcPausePauseClass7MetricTag, error) - // ToPbText marshals PatternFlowPfcPausePauseClass7MetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPfcPausePauseClass7MetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPfcPausePauseClass7MetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPfcPausePauseClass7MetricTag struct { - obj *patternFlowPfcPausePauseClass7MetricTag -} - -type unMarshalPatternFlowPfcPausePauseClass7MetricTag interface { - // FromProto unmarshals PatternFlowPfcPausePauseClass7MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass7MetricTag - FromProto(msg *otg.PatternFlowPfcPausePauseClass7MetricTag) (PatternFlowPfcPausePauseClass7MetricTag, error) - // FromPbText unmarshals PatternFlowPfcPausePauseClass7MetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPfcPausePauseClass7MetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPfcPausePauseClass7MetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPfcPausePauseClass7MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass7MetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPfcPausePauseClass7MetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPfcPausePauseClass7MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass7MetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass7MetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPfcPausePauseClass7MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass7MetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPfcPausePauseClass7MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass7MetricTag) (PatternFlowPfcPausePauseClass7MetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPfcPausePauseClass7MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass7MetricTag) 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 *marshalpatternFlowPfcPausePauseClass7MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass7MetricTag) 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 *marshalpatternFlowPfcPausePauseClass7MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass7MetricTag) 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 *patternFlowPfcPausePauseClass7MetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass7MetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPfcPausePauseClass7MetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPfcPausePauseClass7MetricTag) Clone() (PatternFlowPfcPausePauseClass7MetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPfcPausePauseClass7MetricTag() - 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 -} - -// PatternFlowPfcPausePauseClass7MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPfcPausePauseClass7MetricTag interface { - Validation - // msg marshals PatternFlowPfcPausePauseClass7MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass7MetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPfcPausePauseClass7MetricTag - // setMsg unmarshals PatternFlowPfcPausePauseClass7MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass7MetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7MetricTag - // provides marshal interface - Marshal() marshalPatternFlowPfcPausePauseClass7MetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPfcPausePauseClass7MetricTag - // validate validates PatternFlowPfcPausePauseClass7MetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPfcPausePauseClass7MetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPfcPausePauseClass7MetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPfcPausePauseClass7MetricTag - SetName(value string) PatternFlowPfcPausePauseClass7MetricTag - // Offset returns uint32, set in PatternFlowPfcPausePauseClass7MetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass7MetricTag - SetOffset(value uint32) PatternFlowPfcPausePauseClass7MetricTag - // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass7MetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPfcPausePauseClass7MetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass7MetricTag - SetLength(value uint32) PatternFlowPfcPausePauseClass7MetricTag - // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass7MetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPfcPausePauseClass7MetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPfcPausePauseClass7MetricTag object -func (obj *patternFlowPfcPausePauseClass7MetricTag) SetName(value string) PatternFlowPfcPausePauseClass7MetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass7MetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPfcPausePauseClass7MetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass7MetricTag object -func (obj *patternFlowPfcPausePauseClass7MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass7MetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass7MetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPfcPausePauseClass7MetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass7MetricTag object -func (obj *patternFlowPfcPausePauseClass7MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass7MetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPfcPausePauseClass7MetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass7MetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass7MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass7MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPfcPausePauseClass7MetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowEthernetPauseDstCounter ***** -type patternFlowEthernetPauseDstCounter struct { - validation - obj *otg.PatternFlowEthernetPauseDstCounter - marshaller marshalPatternFlowEthernetPauseDstCounter - unMarshaller unMarshalPatternFlowEthernetPauseDstCounter -} - -func NewPatternFlowEthernetPauseDstCounter() PatternFlowEthernetPauseDstCounter { - obj := patternFlowEthernetPauseDstCounter{obj: &otg.PatternFlowEthernetPauseDstCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseDstCounter) msg() *otg.PatternFlowEthernetPauseDstCounter { - return obj.obj -} - -func (obj *patternFlowEthernetPauseDstCounter) setMsg(msg *otg.PatternFlowEthernetPauseDstCounter) PatternFlowEthernetPauseDstCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseDstCounter struct { - obj *patternFlowEthernetPauseDstCounter -} - -type marshalPatternFlowEthernetPauseDstCounter interface { - // ToProto marshals PatternFlowEthernetPauseDstCounter to protobuf object *otg.PatternFlowEthernetPauseDstCounter - ToProto() (*otg.PatternFlowEthernetPauseDstCounter, error) - // ToPbText marshals PatternFlowEthernetPauseDstCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseDstCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseDstCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseDstCounter struct { - obj *patternFlowEthernetPauseDstCounter -} - -type unMarshalPatternFlowEthernetPauseDstCounter interface { - // FromProto unmarshals PatternFlowEthernetPauseDstCounter from protobuf object *otg.PatternFlowEthernetPauseDstCounter - FromProto(msg *otg.PatternFlowEthernetPauseDstCounter) (PatternFlowEthernetPauseDstCounter, error) - // FromPbText unmarshals PatternFlowEthernetPauseDstCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseDstCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseDstCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseDstCounter) Marshal() marshalPatternFlowEthernetPauseDstCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseDstCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseDstCounter) Unmarshal() unMarshalPatternFlowEthernetPauseDstCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseDstCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseDstCounter) ToProto() (*otg.PatternFlowEthernetPauseDstCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseDstCounter) FromProto(msg *otg.PatternFlowEthernetPauseDstCounter) (PatternFlowEthernetPauseDstCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseDstCounter) 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 *unMarshalpatternFlowEthernetPauseDstCounter) 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 *marshalpatternFlowEthernetPauseDstCounter) 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 *unMarshalpatternFlowEthernetPauseDstCounter) 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 *marshalpatternFlowEthernetPauseDstCounter) 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 *unMarshalpatternFlowEthernetPauseDstCounter) 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 *patternFlowEthernetPauseDstCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseDstCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseDstCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseDstCounter) Clone() (PatternFlowEthernetPauseDstCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseDstCounter() - 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 -} - -// PatternFlowEthernetPauseDstCounter is mac counter pattern -type PatternFlowEthernetPauseDstCounter interface { - Validation - // msg marshals PatternFlowEthernetPauseDstCounter to protobuf object *otg.PatternFlowEthernetPauseDstCounter - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseDstCounter - // setMsg unmarshals PatternFlowEthernetPauseDstCounter from protobuf object *otg.PatternFlowEthernetPauseDstCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseDstCounter) PatternFlowEthernetPauseDstCounter - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseDstCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseDstCounter - // validate validates PatternFlowEthernetPauseDstCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseDstCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowEthernetPauseDstCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowEthernetPauseDstCounter - SetStart(value string) PatternFlowEthernetPauseDstCounter - // HasStart checks if Start has been set in PatternFlowEthernetPauseDstCounter - HasStart() bool - // Step returns string, set in PatternFlowEthernetPauseDstCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowEthernetPauseDstCounter - SetStep(value string) PatternFlowEthernetPauseDstCounter - // HasStep checks if Step has been set in PatternFlowEthernetPauseDstCounter - HasStep() bool - // Count returns uint32, set in PatternFlowEthernetPauseDstCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowEthernetPauseDstCounter - SetCount(value uint32) PatternFlowEthernetPauseDstCounter - // HasCount checks if Count has been set in PatternFlowEthernetPauseDstCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowEthernetPauseDstCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowEthernetPauseDstCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowEthernetPauseDstCounter object -func (obj *patternFlowEthernetPauseDstCounter) SetStart(value string) PatternFlowEthernetPauseDstCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowEthernetPauseDstCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowEthernetPauseDstCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowEthernetPauseDstCounter object -func (obj *patternFlowEthernetPauseDstCounter) SetStep(value string) PatternFlowEthernetPauseDstCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetPauseDstCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetPauseDstCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowEthernetPauseDstCounter object -func (obj *patternFlowEthernetPauseDstCounter) SetCount(value uint32) PatternFlowEthernetPauseDstCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowEthernetPauseDstCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateMac(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseDstCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateMac(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseDstCounter.Step")) - } - - } - -} - -func (obj *patternFlowEthernetPauseDstCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("01:80:c2:00:00:01") - } - if obj.obj.Step == nil { - obj.SetStep("00:00:00:00:00:01") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowEthernetPauseDstMetricTag ***** -type patternFlowEthernetPauseDstMetricTag struct { - validation - obj *otg.PatternFlowEthernetPauseDstMetricTag - marshaller marshalPatternFlowEthernetPauseDstMetricTag - unMarshaller unMarshalPatternFlowEthernetPauseDstMetricTag -} - -func NewPatternFlowEthernetPauseDstMetricTag() PatternFlowEthernetPauseDstMetricTag { - obj := patternFlowEthernetPauseDstMetricTag{obj: &otg.PatternFlowEthernetPauseDstMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseDstMetricTag) msg() *otg.PatternFlowEthernetPauseDstMetricTag { - return obj.obj -} - -func (obj *patternFlowEthernetPauseDstMetricTag) setMsg(msg *otg.PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseDstMetricTag struct { - obj *patternFlowEthernetPauseDstMetricTag -} - -type marshalPatternFlowEthernetPauseDstMetricTag interface { - // ToProto marshals PatternFlowEthernetPauseDstMetricTag to protobuf object *otg.PatternFlowEthernetPauseDstMetricTag - ToProto() (*otg.PatternFlowEthernetPauseDstMetricTag, error) - // ToPbText marshals PatternFlowEthernetPauseDstMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseDstMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseDstMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseDstMetricTag struct { - obj *patternFlowEthernetPauseDstMetricTag -} - -type unMarshalPatternFlowEthernetPauseDstMetricTag interface { - // FromProto unmarshals PatternFlowEthernetPauseDstMetricTag from protobuf object *otg.PatternFlowEthernetPauseDstMetricTag - FromProto(msg *otg.PatternFlowEthernetPauseDstMetricTag) (PatternFlowEthernetPauseDstMetricTag, error) - // FromPbText unmarshals PatternFlowEthernetPauseDstMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseDstMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseDstMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseDstMetricTag) Marshal() marshalPatternFlowEthernetPauseDstMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseDstMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseDstMetricTag) Unmarshal() unMarshalPatternFlowEthernetPauseDstMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseDstMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseDstMetricTag) ToProto() (*otg.PatternFlowEthernetPauseDstMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseDstMetricTag) FromProto(msg *otg.PatternFlowEthernetPauseDstMetricTag) (PatternFlowEthernetPauseDstMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseDstMetricTag) 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 *unMarshalpatternFlowEthernetPauseDstMetricTag) 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 *marshalpatternFlowEthernetPauseDstMetricTag) 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 *unMarshalpatternFlowEthernetPauseDstMetricTag) 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 *marshalpatternFlowEthernetPauseDstMetricTag) 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 *unMarshalpatternFlowEthernetPauseDstMetricTag) 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 *patternFlowEthernetPauseDstMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseDstMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseDstMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseDstMetricTag) Clone() (PatternFlowEthernetPauseDstMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseDstMetricTag() - 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 -} - -// PatternFlowEthernetPauseDstMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowEthernetPauseDstMetricTag interface { - Validation - // msg marshals PatternFlowEthernetPauseDstMetricTag to protobuf object *otg.PatternFlowEthernetPauseDstMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseDstMetricTag - // setMsg unmarshals PatternFlowEthernetPauseDstMetricTag from protobuf object *otg.PatternFlowEthernetPauseDstMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstMetricTag - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseDstMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseDstMetricTag - // validate validates PatternFlowEthernetPauseDstMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseDstMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowEthernetPauseDstMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowEthernetPauseDstMetricTag - SetName(value string) PatternFlowEthernetPauseDstMetricTag - // Offset returns uint32, set in PatternFlowEthernetPauseDstMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowEthernetPauseDstMetricTag - SetOffset(value uint32) PatternFlowEthernetPauseDstMetricTag - // HasOffset checks if Offset has been set in PatternFlowEthernetPauseDstMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowEthernetPauseDstMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowEthernetPauseDstMetricTag - SetLength(value uint32) PatternFlowEthernetPauseDstMetricTag - // HasLength checks if Length has been set in PatternFlowEthernetPauseDstMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowEthernetPauseDstMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowEthernetPauseDstMetricTag object -func (obj *patternFlowEthernetPauseDstMetricTag) SetName(value string) PatternFlowEthernetPauseDstMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetPauseDstMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetPauseDstMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowEthernetPauseDstMetricTag object -func (obj *patternFlowEthernetPauseDstMetricTag) SetOffset(value uint32) PatternFlowEthernetPauseDstMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetPauseDstMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetPauseDstMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowEthernetPauseDstMetricTag object -func (obj *patternFlowEthernetPauseDstMetricTag) SetLength(value uint32) PatternFlowEthernetPauseDstMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowEthernetPauseDstMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetPauseDstMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 47 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseDstMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 48 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowEthernetPauseDstMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowEthernetPauseDstMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(48) - } - -} - -// ***** PatternFlowEthernetPauseSrcCounter ***** -type patternFlowEthernetPauseSrcCounter struct { - validation - obj *otg.PatternFlowEthernetPauseSrcCounter - marshaller marshalPatternFlowEthernetPauseSrcCounter - unMarshaller unMarshalPatternFlowEthernetPauseSrcCounter -} - -func NewPatternFlowEthernetPauseSrcCounter() PatternFlowEthernetPauseSrcCounter { - obj := patternFlowEthernetPauseSrcCounter{obj: &otg.PatternFlowEthernetPauseSrcCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseSrcCounter) msg() *otg.PatternFlowEthernetPauseSrcCounter { - return obj.obj -} - -func (obj *patternFlowEthernetPauseSrcCounter) setMsg(msg *otg.PatternFlowEthernetPauseSrcCounter) PatternFlowEthernetPauseSrcCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseSrcCounter struct { - obj *patternFlowEthernetPauseSrcCounter -} - -type marshalPatternFlowEthernetPauseSrcCounter interface { - // ToProto marshals PatternFlowEthernetPauseSrcCounter to protobuf object *otg.PatternFlowEthernetPauseSrcCounter - ToProto() (*otg.PatternFlowEthernetPauseSrcCounter, error) - // ToPbText marshals PatternFlowEthernetPauseSrcCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseSrcCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseSrcCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseSrcCounter struct { - obj *patternFlowEthernetPauseSrcCounter -} - -type unMarshalPatternFlowEthernetPauseSrcCounter interface { - // FromProto unmarshals PatternFlowEthernetPauseSrcCounter from protobuf object *otg.PatternFlowEthernetPauseSrcCounter - FromProto(msg *otg.PatternFlowEthernetPauseSrcCounter) (PatternFlowEthernetPauseSrcCounter, error) - // FromPbText unmarshals PatternFlowEthernetPauseSrcCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseSrcCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseSrcCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseSrcCounter) Marshal() marshalPatternFlowEthernetPauseSrcCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseSrcCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseSrcCounter) Unmarshal() unMarshalPatternFlowEthernetPauseSrcCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseSrcCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseSrcCounter) ToProto() (*otg.PatternFlowEthernetPauseSrcCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseSrcCounter) FromProto(msg *otg.PatternFlowEthernetPauseSrcCounter) (PatternFlowEthernetPauseSrcCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseSrcCounter) 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 *unMarshalpatternFlowEthernetPauseSrcCounter) 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 *marshalpatternFlowEthernetPauseSrcCounter) 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 *unMarshalpatternFlowEthernetPauseSrcCounter) 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 *marshalpatternFlowEthernetPauseSrcCounter) 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 *unMarshalpatternFlowEthernetPauseSrcCounter) 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 *patternFlowEthernetPauseSrcCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseSrcCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseSrcCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseSrcCounter) Clone() (PatternFlowEthernetPauseSrcCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseSrcCounter() - 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 -} - -// PatternFlowEthernetPauseSrcCounter is mac counter pattern -type PatternFlowEthernetPauseSrcCounter interface { - Validation - // msg marshals PatternFlowEthernetPauseSrcCounter to protobuf object *otg.PatternFlowEthernetPauseSrcCounter - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseSrcCounter - // setMsg unmarshals PatternFlowEthernetPauseSrcCounter from protobuf object *otg.PatternFlowEthernetPauseSrcCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseSrcCounter) PatternFlowEthernetPauseSrcCounter - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseSrcCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseSrcCounter - // validate validates PatternFlowEthernetPauseSrcCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseSrcCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowEthernetPauseSrcCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowEthernetPauseSrcCounter - SetStart(value string) PatternFlowEthernetPauseSrcCounter - // HasStart checks if Start has been set in PatternFlowEthernetPauseSrcCounter - HasStart() bool - // Step returns string, set in PatternFlowEthernetPauseSrcCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowEthernetPauseSrcCounter - SetStep(value string) PatternFlowEthernetPauseSrcCounter - // HasStep checks if Step has been set in PatternFlowEthernetPauseSrcCounter - HasStep() bool - // Count returns uint32, set in PatternFlowEthernetPauseSrcCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowEthernetPauseSrcCounter - SetCount(value uint32) PatternFlowEthernetPauseSrcCounter - // HasCount checks if Count has been set in PatternFlowEthernetPauseSrcCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowEthernetPauseSrcCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowEthernetPauseSrcCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowEthernetPauseSrcCounter object -func (obj *patternFlowEthernetPauseSrcCounter) SetStart(value string) PatternFlowEthernetPauseSrcCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowEthernetPauseSrcCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowEthernetPauseSrcCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowEthernetPauseSrcCounter object -func (obj *patternFlowEthernetPauseSrcCounter) SetStep(value string) PatternFlowEthernetPauseSrcCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetPauseSrcCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetPauseSrcCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowEthernetPauseSrcCounter object -func (obj *patternFlowEthernetPauseSrcCounter) SetCount(value uint32) PatternFlowEthernetPauseSrcCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowEthernetPauseSrcCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateMac(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseSrcCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateMac(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseSrcCounter.Step")) - } - - } - -} - -func (obj *patternFlowEthernetPauseSrcCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("00:00:00:00:00:00") - } - if obj.obj.Step == nil { - obj.SetStep("00:00:00:00:00:01") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowEthernetPauseSrcMetricTag ***** -type patternFlowEthernetPauseSrcMetricTag struct { - validation - obj *otg.PatternFlowEthernetPauseSrcMetricTag - marshaller marshalPatternFlowEthernetPauseSrcMetricTag - unMarshaller unMarshalPatternFlowEthernetPauseSrcMetricTag -} - -func NewPatternFlowEthernetPauseSrcMetricTag() PatternFlowEthernetPauseSrcMetricTag { - obj := patternFlowEthernetPauseSrcMetricTag{obj: &otg.PatternFlowEthernetPauseSrcMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseSrcMetricTag) msg() *otg.PatternFlowEthernetPauseSrcMetricTag { - return obj.obj -} - -func (obj *patternFlowEthernetPauseSrcMetricTag) setMsg(msg *otg.PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseSrcMetricTag struct { - obj *patternFlowEthernetPauseSrcMetricTag -} - -type marshalPatternFlowEthernetPauseSrcMetricTag interface { - // ToProto marshals PatternFlowEthernetPauseSrcMetricTag to protobuf object *otg.PatternFlowEthernetPauseSrcMetricTag - ToProto() (*otg.PatternFlowEthernetPauseSrcMetricTag, error) - // ToPbText marshals PatternFlowEthernetPauseSrcMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseSrcMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseSrcMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseSrcMetricTag struct { - obj *patternFlowEthernetPauseSrcMetricTag -} - -type unMarshalPatternFlowEthernetPauseSrcMetricTag interface { - // FromProto unmarshals PatternFlowEthernetPauseSrcMetricTag from protobuf object *otg.PatternFlowEthernetPauseSrcMetricTag - FromProto(msg *otg.PatternFlowEthernetPauseSrcMetricTag) (PatternFlowEthernetPauseSrcMetricTag, error) - // FromPbText unmarshals PatternFlowEthernetPauseSrcMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseSrcMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseSrcMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseSrcMetricTag) Marshal() marshalPatternFlowEthernetPauseSrcMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseSrcMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseSrcMetricTag) Unmarshal() unMarshalPatternFlowEthernetPauseSrcMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseSrcMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseSrcMetricTag) ToProto() (*otg.PatternFlowEthernetPauseSrcMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseSrcMetricTag) FromProto(msg *otg.PatternFlowEthernetPauseSrcMetricTag) (PatternFlowEthernetPauseSrcMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseSrcMetricTag) 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 *unMarshalpatternFlowEthernetPauseSrcMetricTag) 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 *marshalpatternFlowEthernetPauseSrcMetricTag) 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 *unMarshalpatternFlowEthernetPauseSrcMetricTag) 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 *marshalpatternFlowEthernetPauseSrcMetricTag) 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 *unMarshalpatternFlowEthernetPauseSrcMetricTag) 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 *patternFlowEthernetPauseSrcMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseSrcMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseSrcMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseSrcMetricTag) Clone() (PatternFlowEthernetPauseSrcMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseSrcMetricTag() - 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 -} - -// PatternFlowEthernetPauseSrcMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowEthernetPauseSrcMetricTag interface { - Validation - // msg marshals PatternFlowEthernetPauseSrcMetricTag to protobuf object *otg.PatternFlowEthernetPauseSrcMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseSrcMetricTag - // setMsg unmarshals PatternFlowEthernetPauseSrcMetricTag from protobuf object *otg.PatternFlowEthernetPauseSrcMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcMetricTag - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseSrcMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseSrcMetricTag - // validate validates PatternFlowEthernetPauseSrcMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseSrcMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowEthernetPauseSrcMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowEthernetPauseSrcMetricTag - SetName(value string) PatternFlowEthernetPauseSrcMetricTag - // Offset returns uint32, set in PatternFlowEthernetPauseSrcMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowEthernetPauseSrcMetricTag - SetOffset(value uint32) PatternFlowEthernetPauseSrcMetricTag - // HasOffset checks if Offset has been set in PatternFlowEthernetPauseSrcMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowEthernetPauseSrcMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowEthernetPauseSrcMetricTag - SetLength(value uint32) PatternFlowEthernetPauseSrcMetricTag - // HasLength checks if Length has been set in PatternFlowEthernetPauseSrcMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowEthernetPauseSrcMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowEthernetPauseSrcMetricTag object -func (obj *patternFlowEthernetPauseSrcMetricTag) SetName(value string) PatternFlowEthernetPauseSrcMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetPauseSrcMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetPauseSrcMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowEthernetPauseSrcMetricTag object -func (obj *patternFlowEthernetPauseSrcMetricTag) SetOffset(value uint32) PatternFlowEthernetPauseSrcMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetPauseSrcMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetPauseSrcMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowEthernetPauseSrcMetricTag object -func (obj *patternFlowEthernetPauseSrcMetricTag) SetLength(value uint32) PatternFlowEthernetPauseSrcMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowEthernetPauseSrcMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetPauseSrcMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 47 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseSrcMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 48 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowEthernetPauseSrcMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowEthernetPauseSrcMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(48) - } - -} - -// ***** PatternFlowEthernetPauseEtherTypeCounter ***** -type patternFlowEthernetPauseEtherTypeCounter struct { - validation - obj *otg.PatternFlowEthernetPauseEtherTypeCounter - marshaller marshalPatternFlowEthernetPauseEtherTypeCounter - unMarshaller unMarshalPatternFlowEthernetPauseEtherTypeCounter -} - -func NewPatternFlowEthernetPauseEtherTypeCounter() PatternFlowEthernetPauseEtherTypeCounter { - obj := patternFlowEthernetPauseEtherTypeCounter{obj: &otg.PatternFlowEthernetPauseEtherTypeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseEtherTypeCounter) msg() *otg.PatternFlowEthernetPauseEtherTypeCounter { - return obj.obj -} - -func (obj *patternFlowEthernetPauseEtherTypeCounter) setMsg(msg *otg.PatternFlowEthernetPauseEtherTypeCounter) PatternFlowEthernetPauseEtherTypeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseEtherTypeCounter struct { - obj *patternFlowEthernetPauseEtherTypeCounter -} - -type marshalPatternFlowEthernetPauseEtherTypeCounter interface { - // ToProto marshals PatternFlowEthernetPauseEtherTypeCounter to protobuf object *otg.PatternFlowEthernetPauseEtherTypeCounter - ToProto() (*otg.PatternFlowEthernetPauseEtherTypeCounter, error) - // ToPbText marshals PatternFlowEthernetPauseEtherTypeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseEtherTypeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseEtherTypeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseEtherTypeCounter struct { - obj *patternFlowEthernetPauseEtherTypeCounter -} - -type unMarshalPatternFlowEthernetPauseEtherTypeCounter interface { - // FromProto unmarshals PatternFlowEthernetPauseEtherTypeCounter from protobuf object *otg.PatternFlowEthernetPauseEtherTypeCounter - FromProto(msg *otg.PatternFlowEthernetPauseEtherTypeCounter) (PatternFlowEthernetPauseEtherTypeCounter, error) - // FromPbText unmarshals PatternFlowEthernetPauseEtherTypeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseEtherTypeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseEtherTypeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseEtherTypeCounter) Marshal() marshalPatternFlowEthernetPauseEtherTypeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseEtherTypeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseEtherTypeCounter) Unmarshal() unMarshalPatternFlowEthernetPauseEtherTypeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseEtherTypeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseEtherTypeCounter) ToProto() (*otg.PatternFlowEthernetPauseEtherTypeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseEtherTypeCounter) FromProto(msg *otg.PatternFlowEthernetPauseEtherTypeCounter) (PatternFlowEthernetPauseEtherTypeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseEtherTypeCounter) 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 *unMarshalpatternFlowEthernetPauseEtherTypeCounter) 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 *marshalpatternFlowEthernetPauseEtherTypeCounter) 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 *unMarshalpatternFlowEthernetPauseEtherTypeCounter) 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 *marshalpatternFlowEthernetPauseEtherTypeCounter) 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 *unMarshalpatternFlowEthernetPauseEtherTypeCounter) 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 *patternFlowEthernetPauseEtherTypeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseEtherTypeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseEtherTypeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseEtherTypeCounter) Clone() (PatternFlowEthernetPauseEtherTypeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseEtherTypeCounter() - 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 -} - -// PatternFlowEthernetPauseEtherTypeCounter is integer counter pattern -type PatternFlowEthernetPauseEtherTypeCounter interface { - Validation - // msg marshals PatternFlowEthernetPauseEtherTypeCounter to protobuf object *otg.PatternFlowEthernetPauseEtherTypeCounter - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseEtherTypeCounter - // setMsg unmarshals PatternFlowEthernetPauseEtherTypeCounter from protobuf object *otg.PatternFlowEthernetPauseEtherTypeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseEtherTypeCounter) PatternFlowEthernetPauseEtherTypeCounter - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseEtherTypeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseEtherTypeCounter - // validate validates PatternFlowEthernetPauseEtherTypeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseEtherTypeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowEthernetPauseEtherTypeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowEthernetPauseEtherTypeCounter - SetStart(value uint32) PatternFlowEthernetPauseEtherTypeCounter - // HasStart checks if Start has been set in PatternFlowEthernetPauseEtherTypeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowEthernetPauseEtherTypeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowEthernetPauseEtherTypeCounter - SetStep(value uint32) PatternFlowEthernetPauseEtherTypeCounter - // HasStep checks if Step has been set in PatternFlowEthernetPauseEtherTypeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowEthernetPauseEtherTypeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowEthernetPauseEtherTypeCounter - SetCount(value uint32) PatternFlowEthernetPauseEtherTypeCounter - // HasCount checks if Count has been set in PatternFlowEthernetPauseEtherTypeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowEthernetPauseEtherTypeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowEthernetPauseEtherTypeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowEthernetPauseEtherTypeCounter object -func (obj *patternFlowEthernetPauseEtherTypeCounter) SetStart(value uint32) PatternFlowEthernetPauseEtherTypeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowEthernetPauseEtherTypeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowEthernetPauseEtherTypeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowEthernetPauseEtherTypeCounter object -func (obj *patternFlowEthernetPauseEtherTypeCounter) SetStep(value uint32) PatternFlowEthernetPauseEtherTypeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetPauseEtherTypeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetPauseEtherTypeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowEthernetPauseEtherTypeCounter object -func (obj *patternFlowEthernetPauseEtherTypeCounter) SetCount(value uint32) PatternFlowEthernetPauseEtherTypeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowEthernetPauseEtherTypeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseEtherTypeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseEtherTypeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseEtherTypeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowEthernetPauseEtherTypeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(34824) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowEthernetPauseEtherTypeMetricTag ***** -type patternFlowEthernetPauseEtherTypeMetricTag struct { - validation - obj *otg.PatternFlowEthernetPauseEtherTypeMetricTag - marshaller marshalPatternFlowEthernetPauseEtherTypeMetricTag - unMarshaller unMarshalPatternFlowEthernetPauseEtherTypeMetricTag -} - -func NewPatternFlowEthernetPauseEtherTypeMetricTag() PatternFlowEthernetPauseEtherTypeMetricTag { - obj := patternFlowEthernetPauseEtherTypeMetricTag{obj: &otg.PatternFlowEthernetPauseEtherTypeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) msg() *otg.PatternFlowEthernetPauseEtherTypeMetricTag { - return obj.obj -} - -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) setMsg(msg *otg.PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseEtherTypeMetricTag struct { - obj *patternFlowEthernetPauseEtherTypeMetricTag -} - -type marshalPatternFlowEthernetPauseEtherTypeMetricTag interface { - // ToProto marshals PatternFlowEthernetPauseEtherTypeMetricTag to protobuf object *otg.PatternFlowEthernetPauseEtherTypeMetricTag - ToProto() (*otg.PatternFlowEthernetPauseEtherTypeMetricTag, error) - // ToPbText marshals PatternFlowEthernetPauseEtherTypeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseEtherTypeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseEtherTypeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseEtherTypeMetricTag struct { - obj *patternFlowEthernetPauseEtherTypeMetricTag -} - -type unMarshalPatternFlowEthernetPauseEtherTypeMetricTag interface { - // FromProto unmarshals PatternFlowEthernetPauseEtherTypeMetricTag from protobuf object *otg.PatternFlowEthernetPauseEtherTypeMetricTag - FromProto(msg *otg.PatternFlowEthernetPauseEtherTypeMetricTag) (PatternFlowEthernetPauseEtherTypeMetricTag, error) - // FromPbText unmarshals PatternFlowEthernetPauseEtherTypeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseEtherTypeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseEtherTypeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) Marshal() marshalPatternFlowEthernetPauseEtherTypeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseEtherTypeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) Unmarshal() unMarshalPatternFlowEthernetPauseEtherTypeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseEtherTypeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseEtherTypeMetricTag) ToProto() (*otg.PatternFlowEthernetPauseEtherTypeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseEtherTypeMetricTag) FromProto(msg *otg.PatternFlowEthernetPauseEtherTypeMetricTag) (PatternFlowEthernetPauseEtherTypeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseEtherTypeMetricTag) 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 *unMarshalpatternFlowEthernetPauseEtherTypeMetricTag) 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 *marshalpatternFlowEthernetPauseEtherTypeMetricTag) 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 *unMarshalpatternFlowEthernetPauseEtherTypeMetricTag) 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 *marshalpatternFlowEthernetPauseEtherTypeMetricTag) 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 *unMarshalpatternFlowEthernetPauseEtherTypeMetricTag) 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 *patternFlowEthernetPauseEtherTypeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) Clone() (PatternFlowEthernetPauseEtherTypeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseEtherTypeMetricTag() - 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 -} - -// PatternFlowEthernetPauseEtherTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowEthernetPauseEtherTypeMetricTag interface { - Validation - // msg marshals PatternFlowEthernetPauseEtherTypeMetricTag to protobuf object *otg.PatternFlowEthernetPauseEtherTypeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseEtherTypeMetricTag - // setMsg unmarshals PatternFlowEthernetPauseEtherTypeMetricTag from protobuf object *otg.PatternFlowEthernetPauseEtherTypeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseEtherTypeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseEtherTypeMetricTag - // validate validates PatternFlowEthernetPauseEtherTypeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseEtherTypeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowEthernetPauseEtherTypeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowEthernetPauseEtherTypeMetricTag - SetName(value string) PatternFlowEthernetPauseEtherTypeMetricTag - // Offset returns uint32, set in PatternFlowEthernetPauseEtherTypeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowEthernetPauseEtherTypeMetricTag - SetOffset(value uint32) PatternFlowEthernetPauseEtherTypeMetricTag - // HasOffset checks if Offset has been set in PatternFlowEthernetPauseEtherTypeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowEthernetPauseEtherTypeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowEthernetPauseEtherTypeMetricTag - SetLength(value uint32) PatternFlowEthernetPauseEtherTypeMetricTag - // HasLength checks if Length has been set in PatternFlowEthernetPauseEtherTypeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowEthernetPauseEtherTypeMetricTag object -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) SetName(value string) PatternFlowEthernetPauseEtherTypeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowEthernetPauseEtherTypeMetricTag object -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) SetOffset(value uint32) PatternFlowEthernetPauseEtherTypeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowEthernetPauseEtherTypeMetricTag object -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) SetLength(value uint32) PatternFlowEthernetPauseEtherTypeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetPauseEtherTypeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseEtherTypeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowEthernetPauseEtherTypeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowEthernetPauseEtherTypeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowEthernetPauseControlOpCodeCounter ***** -type patternFlowEthernetPauseControlOpCodeCounter struct { - validation - obj *otg.PatternFlowEthernetPauseControlOpCodeCounter - marshaller marshalPatternFlowEthernetPauseControlOpCodeCounter - unMarshaller unMarshalPatternFlowEthernetPauseControlOpCodeCounter -} - -func NewPatternFlowEthernetPauseControlOpCodeCounter() PatternFlowEthernetPauseControlOpCodeCounter { - obj := patternFlowEthernetPauseControlOpCodeCounter{obj: &otg.PatternFlowEthernetPauseControlOpCodeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseControlOpCodeCounter) msg() *otg.PatternFlowEthernetPauseControlOpCodeCounter { - return obj.obj -} - -func (obj *patternFlowEthernetPauseControlOpCodeCounter) setMsg(msg *otg.PatternFlowEthernetPauseControlOpCodeCounter) PatternFlowEthernetPauseControlOpCodeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseControlOpCodeCounter struct { - obj *patternFlowEthernetPauseControlOpCodeCounter -} - -type marshalPatternFlowEthernetPauseControlOpCodeCounter interface { - // ToProto marshals PatternFlowEthernetPauseControlOpCodeCounter to protobuf object *otg.PatternFlowEthernetPauseControlOpCodeCounter - ToProto() (*otg.PatternFlowEthernetPauseControlOpCodeCounter, error) - // ToPbText marshals PatternFlowEthernetPauseControlOpCodeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseControlOpCodeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseControlOpCodeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseControlOpCodeCounter struct { - obj *patternFlowEthernetPauseControlOpCodeCounter -} - -type unMarshalPatternFlowEthernetPauseControlOpCodeCounter interface { - // FromProto unmarshals PatternFlowEthernetPauseControlOpCodeCounter from protobuf object *otg.PatternFlowEthernetPauseControlOpCodeCounter - FromProto(msg *otg.PatternFlowEthernetPauseControlOpCodeCounter) (PatternFlowEthernetPauseControlOpCodeCounter, error) - // FromPbText unmarshals PatternFlowEthernetPauseControlOpCodeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseControlOpCodeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseControlOpCodeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseControlOpCodeCounter) Marshal() marshalPatternFlowEthernetPauseControlOpCodeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseControlOpCodeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseControlOpCodeCounter) Unmarshal() unMarshalPatternFlowEthernetPauseControlOpCodeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseControlOpCodeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseControlOpCodeCounter) ToProto() (*otg.PatternFlowEthernetPauseControlOpCodeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseControlOpCodeCounter) FromProto(msg *otg.PatternFlowEthernetPauseControlOpCodeCounter) (PatternFlowEthernetPauseControlOpCodeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseControlOpCodeCounter) 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 *unMarshalpatternFlowEthernetPauseControlOpCodeCounter) 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 *marshalpatternFlowEthernetPauseControlOpCodeCounter) 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 *unMarshalpatternFlowEthernetPauseControlOpCodeCounter) 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 *marshalpatternFlowEthernetPauseControlOpCodeCounter) 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 *unMarshalpatternFlowEthernetPauseControlOpCodeCounter) 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 *patternFlowEthernetPauseControlOpCodeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseControlOpCodeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseControlOpCodeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseControlOpCodeCounter) Clone() (PatternFlowEthernetPauseControlOpCodeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseControlOpCodeCounter() - 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 -} - -// PatternFlowEthernetPauseControlOpCodeCounter is integer counter pattern -type PatternFlowEthernetPauseControlOpCodeCounter interface { - Validation - // msg marshals PatternFlowEthernetPauseControlOpCodeCounter to protobuf object *otg.PatternFlowEthernetPauseControlOpCodeCounter - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseControlOpCodeCounter - // setMsg unmarshals PatternFlowEthernetPauseControlOpCodeCounter from protobuf object *otg.PatternFlowEthernetPauseControlOpCodeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseControlOpCodeCounter) PatternFlowEthernetPauseControlOpCodeCounter - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseControlOpCodeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseControlOpCodeCounter - // validate validates PatternFlowEthernetPauseControlOpCodeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseControlOpCodeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowEthernetPauseControlOpCodeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowEthernetPauseControlOpCodeCounter - SetStart(value uint32) PatternFlowEthernetPauseControlOpCodeCounter - // HasStart checks if Start has been set in PatternFlowEthernetPauseControlOpCodeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowEthernetPauseControlOpCodeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowEthernetPauseControlOpCodeCounter - SetStep(value uint32) PatternFlowEthernetPauseControlOpCodeCounter - // HasStep checks if Step has been set in PatternFlowEthernetPauseControlOpCodeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowEthernetPauseControlOpCodeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowEthernetPauseControlOpCodeCounter - SetCount(value uint32) PatternFlowEthernetPauseControlOpCodeCounter - // HasCount checks if Count has been set in PatternFlowEthernetPauseControlOpCodeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowEthernetPauseControlOpCodeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowEthernetPauseControlOpCodeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowEthernetPauseControlOpCodeCounter object -func (obj *patternFlowEthernetPauseControlOpCodeCounter) SetStart(value uint32) PatternFlowEthernetPauseControlOpCodeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowEthernetPauseControlOpCodeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowEthernetPauseControlOpCodeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowEthernetPauseControlOpCodeCounter object -func (obj *patternFlowEthernetPauseControlOpCodeCounter) SetStep(value uint32) PatternFlowEthernetPauseControlOpCodeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetPauseControlOpCodeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetPauseControlOpCodeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowEthernetPauseControlOpCodeCounter object -func (obj *patternFlowEthernetPauseControlOpCodeCounter) SetCount(value uint32) PatternFlowEthernetPauseControlOpCodeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowEthernetPauseControlOpCodeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseControlOpCodeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseControlOpCodeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseControlOpCodeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowEthernetPauseControlOpCodeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowEthernetPauseControlOpCodeMetricTag ***** -type patternFlowEthernetPauseControlOpCodeMetricTag struct { - validation - obj *otg.PatternFlowEthernetPauseControlOpCodeMetricTag - marshaller marshalPatternFlowEthernetPauseControlOpCodeMetricTag - unMarshaller unMarshalPatternFlowEthernetPauseControlOpCodeMetricTag -} - -func NewPatternFlowEthernetPauseControlOpCodeMetricTag() PatternFlowEthernetPauseControlOpCodeMetricTag { - obj := patternFlowEthernetPauseControlOpCodeMetricTag{obj: &otg.PatternFlowEthernetPauseControlOpCodeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) msg() *otg.PatternFlowEthernetPauseControlOpCodeMetricTag { - return obj.obj -} - -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) setMsg(msg *otg.PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseControlOpCodeMetricTag struct { - obj *patternFlowEthernetPauseControlOpCodeMetricTag -} - -type marshalPatternFlowEthernetPauseControlOpCodeMetricTag interface { - // ToProto marshals PatternFlowEthernetPauseControlOpCodeMetricTag to protobuf object *otg.PatternFlowEthernetPauseControlOpCodeMetricTag - ToProto() (*otg.PatternFlowEthernetPauseControlOpCodeMetricTag, error) - // ToPbText marshals PatternFlowEthernetPauseControlOpCodeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseControlOpCodeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseControlOpCodeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseControlOpCodeMetricTag struct { - obj *patternFlowEthernetPauseControlOpCodeMetricTag -} - -type unMarshalPatternFlowEthernetPauseControlOpCodeMetricTag interface { - // FromProto unmarshals PatternFlowEthernetPauseControlOpCodeMetricTag from protobuf object *otg.PatternFlowEthernetPauseControlOpCodeMetricTag - FromProto(msg *otg.PatternFlowEthernetPauseControlOpCodeMetricTag) (PatternFlowEthernetPauseControlOpCodeMetricTag, error) - // FromPbText unmarshals PatternFlowEthernetPauseControlOpCodeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseControlOpCodeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseControlOpCodeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) Marshal() marshalPatternFlowEthernetPauseControlOpCodeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseControlOpCodeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) Unmarshal() unMarshalPatternFlowEthernetPauseControlOpCodeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseControlOpCodeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseControlOpCodeMetricTag) ToProto() (*otg.PatternFlowEthernetPauseControlOpCodeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseControlOpCodeMetricTag) FromProto(msg *otg.PatternFlowEthernetPauseControlOpCodeMetricTag) (PatternFlowEthernetPauseControlOpCodeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseControlOpCodeMetricTag) 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 *unMarshalpatternFlowEthernetPauseControlOpCodeMetricTag) 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 *marshalpatternFlowEthernetPauseControlOpCodeMetricTag) 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 *unMarshalpatternFlowEthernetPauseControlOpCodeMetricTag) 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 *marshalpatternFlowEthernetPauseControlOpCodeMetricTag) 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 *unMarshalpatternFlowEthernetPauseControlOpCodeMetricTag) 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 *patternFlowEthernetPauseControlOpCodeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) Clone() (PatternFlowEthernetPauseControlOpCodeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseControlOpCodeMetricTag() - 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 -} - -// PatternFlowEthernetPauseControlOpCodeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowEthernetPauseControlOpCodeMetricTag interface { - Validation - // msg marshals PatternFlowEthernetPauseControlOpCodeMetricTag to protobuf object *otg.PatternFlowEthernetPauseControlOpCodeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseControlOpCodeMetricTag - // setMsg unmarshals PatternFlowEthernetPauseControlOpCodeMetricTag from protobuf object *otg.PatternFlowEthernetPauseControlOpCodeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseControlOpCodeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseControlOpCodeMetricTag - // validate validates PatternFlowEthernetPauseControlOpCodeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseControlOpCodeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowEthernetPauseControlOpCodeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowEthernetPauseControlOpCodeMetricTag - SetName(value string) PatternFlowEthernetPauseControlOpCodeMetricTag - // Offset returns uint32, set in PatternFlowEthernetPauseControlOpCodeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowEthernetPauseControlOpCodeMetricTag - SetOffset(value uint32) PatternFlowEthernetPauseControlOpCodeMetricTag - // HasOffset checks if Offset has been set in PatternFlowEthernetPauseControlOpCodeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowEthernetPauseControlOpCodeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowEthernetPauseControlOpCodeMetricTag - SetLength(value uint32) PatternFlowEthernetPauseControlOpCodeMetricTag - // HasLength checks if Length has been set in PatternFlowEthernetPauseControlOpCodeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowEthernetPauseControlOpCodeMetricTag object -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) SetName(value string) PatternFlowEthernetPauseControlOpCodeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowEthernetPauseControlOpCodeMetricTag object -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) SetOffset(value uint32) PatternFlowEthernetPauseControlOpCodeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowEthernetPauseControlOpCodeMetricTag object -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) SetLength(value uint32) PatternFlowEthernetPauseControlOpCodeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetPauseControlOpCodeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseControlOpCodeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowEthernetPauseControlOpCodeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowEthernetPauseTimeCounter ***** -type patternFlowEthernetPauseTimeCounter struct { - validation - obj *otg.PatternFlowEthernetPauseTimeCounter - marshaller marshalPatternFlowEthernetPauseTimeCounter - unMarshaller unMarshalPatternFlowEthernetPauseTimeCounter -} - -func NewPatternFlowEthernetPauseTimeCounter() PatternFlowEthernetPauseTimeCounter { - obj := patternFlowEthernetPauseTimeCounter{obj: &otg.PatternFlowEthernetPauseTimeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseTimeCounter) msg() *otg.PatternFlowEthernetPauseTimeCounter { - return obj.obj -} - -func (obj *patternFlowEthernetPauseTimeCounter) setMsg(msg *otg.PatternFlowEthernetPauseTimeCounter) PatternFlowEthernetPauseTimeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseTimeCounter struct { - obj *patternFlowEthernetPauseTimeCounter -} - -type marshalPatternFlowEthernetPauseTimeCounter interface { - // ToProto marshals PatternFlowEthernetPauseTimeCounter to protobuf object *otg.PatternFlowEthernetPauseTimeCounter - ToProto() (*otg.PatternFlowEthernetPauseTimeCounter, error) - // ToPbText marshals PatternFlowEthernetPauseTimeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseTimeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseTimeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseTimeCounter struct { - obj *patternFlowEthernetPauseTimeCounter -} - -type unMarshalPatternFlowEthernetPauseTimeCounter interface { - // FromProto unmarshals PatternFlowEthernetPauseTimeCounter from protobuf object *otg.PatternFlowEthernetPauseTimeCounter - FromProto(msg *otg.PatternFlowEthernetPauseTimeCounter) (PatternFlowEthernetPauseTimeCounter, error) - // FromPbText unmarshals PatternFlowEthernetPauseTimeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseTimeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseTimeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseTimeCounter) Marshal() marshalPatternFlowEthernetPauseTimeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseTimeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseTimeCounter) Unmarshal() unMarshalPatternFlowEthernetPauseTimeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseTimeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseTimeCounter) ToProto() (*otg.PatternFlowEthernetPauseTimeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseTimeCounter) FromProto(msg *otg.PatternFlowEthernetPauseTimeCounter) (PatternFlowEthernetPauseTimeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseTimeCounter) 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 *unMarshalpatternFlowEthernetPauseTimeCounter) 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 *marshalpatternFlowEthernetPauseTimeCounter) 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 *unMarshalpatternFlowEthernetPauseTimeCounter) 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 *marshalpatternFlowEthernetPauseTimeCounter) 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 *unMarshalpatternFlowEthernetPauseTimeCounter) 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 *patternFlowEthernetPauseTimeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseTimeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseTimeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseTimeCounter) Clone() (PatternFlowEthernetPauseTimeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseTimeCounter() - 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 -} - -// PatternFlowEthernetPauseTimeCounter is integer counter pattern -type PatternFlowEthernetPauseTimeCounter interface { - Validation - // msg marshals PatternFlowEthernetPauseTimeCounter to protobuf object *otg.PatternFlowEthernetPauseTimeCounter - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseTimeCounter - // setMsg unmarshals PatternFlowEthernetPauseTimeCounter from protobuf object *otg.PatternFlowEthernetPauseTimeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseTimeCounter) PatternFlowEthernetPauseTimeCounter - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseTimeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseTimeCounter - // validate validates PatternFlowEthernetPauseTimeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseTimeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowEthernetPauseTimeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowEthernetPauseTimeCounter - SetStart(value uint32) PatternFlowEthernetPauseTimeCounter - // HasStart checks if Start has been set in PatternFlowEthernetPauseTimeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowEthernetPauseTimeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowEthernetPauseTimeCounter - SetStep(value uint32) PatternFlowEthernetPauseTimeCounter - // HasStep checks if Step has been set in PatternFlowEthernetPauseTimeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowEthernetPauseTimeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowEthernetPauseTimeCounter - SetCount(value uint32) PatternFlowEthernetPauseTimeCounter - // HasCount checks if Count has been set in PatternFlowEthernetPauseTimeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowEthernetPauseTimeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowEthernetPauseTimeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowEthernetPauseTimeCounter object -func (obj *patternFlowEthernetPauseTimeCounter) SetStart(value uint32) PatternFlowEthernetPauseTimeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowEthernetPauseTimeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowEthernetPauseTimeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowEthernetPauseTimeCounter object -func (obj *patternFlowEthernetPauseTimeCounter) SetStep(value uint32) PatternFlowEthernetPauseTimeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetPauseTimeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowEthernetPauseTimeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowEthernetPauseTimeCounter object -func (obj *patternFlowEthernetPauseTimeCounter) SetCount(value uint32) PatternFlowEthernetPauseTimeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowEthernetPauseTimeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseTimeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseTimeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseTimeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowEthernetPauseTimeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowEthernetPauseTimeMetricTag ***** -type patternFlowEthernetPauseTimeMetricTag struct { - validation - obj *otg.PatternFlowEthernetPauseTimeMetricTag - marshaller marshalPatternFlowEthernetPauseTimeMetricTag - unMarshaller unMarshalPatternFlowEthernetPauseTimeMetricTag -} - -func NewPatternFlowEthernetPauseTimeMetricTag() PatternFlowEthernetPauseTimeMetricTag { - obj := patternFlowEthernetPauseTimeMetricTag{obj: &otg.PatternFlowEthernetPauseTimeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowEthernetPauseTimeMetricTag) msg() *otg.PatternFlowEthernetPauseTimeMetricTag { - return obj.obj -} - -func (obj *patternFlowEthernetPauseTimeMetricTag) setMsg(msg *otg.PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowEthernetPauseTimeMetricTag struct { - obj *patternFlowEthernetPauseTimeMetricTag -} - -type marshalPatternFlowEthernetPauseTimeMetricTag interface { - // ToProto marshals PatternFlowEthernetPauseTimeMetricTag to protobuf object *otg.PatternFlowEthernetPauseTimeMetricTag - ToProto() (*otg.PatternFlowEthernetPauseTimeMetricTag, error) - // ToPbText marshals PatternFlowEthernetPauseTimeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowEthernetPauseTimeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowEthernetPauseTimeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowEthernetPauseTimeMetricTag struct { - obj *patternFlowEthernetPauseTimeMetricTag -} - -type unMarshalPatternFlowEthernetPauseTimeMetricTag interface { - // FromProto unmarshals PatternFlowEthernetPauseTimeMetricTag from protobuf object *otg.PatternFlowEthernetPauseTimeMetricTag - FromProto(msg *otg.PatternFlowEthernetPauseTimeMetricTag) (PatternFlowEthernetPauseTimeMetricTag, error) - // FromPbText unmarshals PatternFlowEthernetPauseTimeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowEthernetPauseTimeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowEthernetPauseTimeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowEthernetPauseTimeMetricTag) Marshal() marshalPatternFlowEthernetPauseTimeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowEthernetPauseTimeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowEthernetPauseTimeMetricTag) Unmarshal() unMarshalPatternFlowEthernetPauseTimeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowEthernetPauseTimeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowEthernetPauseTimeMetricTag) ToProto() (*otg.PatternFlowEthernetPauseTimeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowEthernetPauseTimeMetricTag) FromProto(msg *otg.PatternFlowEthernetPauseTimeMetricTag) (PatternFlowEthernetPauseTimeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowEthernetPauseTimeMetricTag) 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 *unMarshalpatternFlowEthernetPauseTimeMetricTag) 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 *marshalpatternFlowEthernetPauseTimeMetricTag) 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 *unMarshalpatternFlowEthernetPauseTimeMetricTag) 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 *marshalpatternFlowEthernetPauseTimeMetricTag) 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 *unMarshalpatternFlowEthernetPauseTimeMetricTag) 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 *patternFlowEthernetPauseTimeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseTimeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowEthernetPauseTimeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowEthernetPauseTimeMetricTag) Clone() (PatternFlowEthernetPauseTimeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowEthernetPauseTimeMetricTag() - 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 -} - -// PatternFlowEthernetPauseTimeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowEthernetPauseTimeMetricTag interface { - Validation - // msg marshals PatternFlowEthernetPauseTimeMetricTag to protobuf object *otg.PatternFlowEthernetPauseTimeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowEthernetPauseTimeMetricTag - // setMsg unmarshals PatternFlowEthernetPauseTimeMetricTag from protobuf object *otg.PatternFlowEthernetPauseTimeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowEthernetPauseTimeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowEthernetPauseTimeMetricTag - // validate validates PatternFlowEthernetPauseTimeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowEthernetPauseTimeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowEthernetPauseTimeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowEthernetPauseTimeMetricTag - SetName(value string) PatternFlowEthernetPauseTimeMetricTag - // Offset returns uint32, set in PatternFlowEthernetPauseTimeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowEthernetPauseTimeMetricTag - SetOffset(value uint32) PatternFlowEthernetPauseTimeMetricTag - // HasOffset checks if Offset has been set in PatternFlowEthernetPauseTimeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowEthernetPauseTimeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowEthernetPauseTimeMetricTag - SetLength(value uint32) PatternFlowEthernetPauseTimeMetricTag - // HasLength checks if Length has been set in PatternFlowEthernetPauseTimeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowEthernetPauseTimeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowEthernetPauseTimeMetricTag object -func (obj *patternFlowEthernetPauseTimeMetricTag) SetName(value string) PatternFlowEthernetPauseTimeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetPauseTimeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowEthernetPauseTimeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowEthernetPauseTimeMetricTag object -func (obj *patternFlowEthernetPauseTimeMetricTag) SetOffset(value uint32) PatternFlowEthernetPauseTimeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetPauseTimeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowEthernetPauseTimeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowEthernetPauseTimeMetricTag object -func (obj *patternFlowEthernetPauseTimeMetricTag) SetLength(value uint32) PatternFlowEthernetPauseTimeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowEthernetPauseTimeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetPauseTimeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowEthernetPauseTimeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowEthernetPauseTimeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowEthernetPauseTimeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowTcpSrcPortCounter ***** -type patternFlowTcpSrcPortCounter struct { - validation - obj *otg.PatternFlowTcpSrcPortCounter - marshaller marshalPatternFlowTcpSrcPortCounter - unMarshaller unMarshalPatternFlowTcpSrcPortCounter -} - -func NewPatternFlowTcpSrcPortCounter() PatternFlowTcpSrcPortCounter { - obj := patternFlowTcpSrcPortCounter{obj: &otg.PatternFlowTcpSrcPortCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpSrcPortCounter) msg() *otg.PatternFlowTcpSrcPortCounter { - return obj.obj -} - -func (obj *patternFlowTcpSrcPortCounter) setMsg(msg *otg.PatternFlowTcpSrcPortCounter) PatternFlowTcpSrcPortCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpSrcPortCounter struct { - obj *patternFlowTcpSrcPortCounter -} - -type marshalPatternFlowTcpSrcPortCounter interface { - // ToProto marshals PatternFlowTcpSrcPortCounter to protobuf object *otg.PatternFlowTcpSrcPortCounter - ToProto() (*otg.PatternFlowTcpSrcPortCounter, error) - // ToPbText marshals PatternFlowTcpSrcPortCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpSrcPortCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpSrcPortCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpSrcPortCounter struct { - obj *patternFlowTcpSrcPortCounter -} - -type unMarshalPatternFlowTcpSrcPortCounter interface { - // FromProto unmarshals PatternFlowTcpSrcPortCounter from protobuf object *otg.PatternFlowTcpSrcPortCounter - FromProto(msg *otg.PatternFlowTcpSrcPortCounter) (PatternFlowTcpSrcPortCounter, error) - // FromPbText unmarshals PatternFlowTcpSrcPortCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpSrcPortCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpSrcPortCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpSrcPortCounter) Marshal() marshalPatternFlowTcpSrcPortCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpSrcPortCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpSrcPortCounter) Unmarshal() unMarshalPatternFlowTcpSrcPortCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpSrcPortCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpSrcPortCounter) ToProto() (*otg.PatternFlowTcpSrcPortCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpSrcPortCounter) FromProto(msg *otg.PatternFlowTcpSrcPortCounter) (PatternFlowTcpSrcPortCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpSrcPortCounter) 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 *unMarshalpatternFlowTcpSrcPortCounter) 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 *marshalpatternFlowTcpSrcPortCounter) 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 *unMarshalpatternFlowTcpSrcPortCounter) 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 *marshalpatternFlowTcpSrcPortCounter) 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 *unMarshalpatternFlowTcpSrcPortCounter) 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 *patternFlowTcpSrcPortCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpSrcPortCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpSrcPortCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpSrcPortCounter) Clone() (PatternFlowTcpSrcPortCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpSrcPortCounter() - 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 -} - -// PatternFlowTcpSrcPortCounter is integer counter pattern -type PatternFlowTcpSrcPortCounter interface { - Validation - // msg marshals PatternFlowTcpSrcPortCounter to protobuf object *otg.PatternFlowTcpSrcPortCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpSrcPortCounter - // setMsg unmarshals PatternFlowTcpSrcPortCounter from protobuf object *otg.PatternFlowTcpSrcPortCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpSrcPortCounter) PatternFlowTcpSrcPortCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpSrcPortCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpSrcPortCounter - // validate validates PatternFlowTcpSrcPortCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpSrcPortCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpSrcPortCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpSrcPortCounter - SetStart(value uint32) PatternFlowTcpSrcPortCounter - // HasStart checks if Start has been set in PatternFlowTcpSrcPortCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpSrcPortCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpSrcPortCounter - SetStep(value uint32) PatternFlowTcpSrcPortCounter - // HasStep checks if Step has been set in PatternFlowTcpSrcPortCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpSrcPortCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpSrcPortCounter - SetCount(value uint32) PatternFlowTcpSrcPortCounter - // HasCount checks if Count has been set in PatternFlowTcpSrcPortCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpSrcPortCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpSrcPortCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpSrcPortCounter object -func (obj *patternFlowTcpSrcPortCounter) SetStart(value uint32) PatternFlowTcpSrcPortCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpSrcPortCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpSrcPortCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpSrcPortCounter object -func (obj *patternFlowTcpSrcPortCounter) SetStep(value uint32) PatternFlowTcpSrcPortCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpSrcPortCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpSrcPortCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpSrcPortCounter object -func (obj *patternFlowTcpSrcPortCounter) SetCount(value uint32) PatternFlowTcpSrcPortCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpSrcPortCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpSrcPortCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpSrcPortCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpSrcPortCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowTcpSrcPortCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpSrcPortMetricTag ***** -type patternFlowTcpSrcPortMetricTag struct { - validation - obj *otg.PatternFlowTcpSrcPortMetricTag - marshaller marshalPatternFlowTcpSrcPortMetricTag - unMarshaller unMarshalPatternFlowTcpSrcPortMetricTag -} - -func NewPatternFlowTcpSrcPortMetricTag() PatternFlowTcpSrcPortMetricTag { - obj := patternFlowTcpSrcPortMetricTag{obj: &otg.PatternFlowTcpSrcPortMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpSrcPortMetricTag) msg() *otg.PatternFlowTcpSrcPortMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpSrcPortMetricTag) setMsg(msg *otg.PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpSrcPortMetricTag struct { - obj *patternFlowTcpSrcPortMetricTag -} - -type marshalPatternFlowTcpSrcPortMetricTag interface { - // ToProto marshals PatternFlowTcpSrcPortMetricTag to protobuf object *otg.PatternFlowTcpSrcPortMetricTag - ToProto() (*otg.PatternFlowTcpSrcPortMetricTag, error) - // ToPbText marshals PatternFlowTcpSrcPortMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpSrcPortMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpSrcPortMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpSrcPortMetricTag struct { - obj *patternFlowTcpSrcPortMetricTag -} - -type unMarshalPatternFlowTcpSrcPortMetricTag interface { - // FromProto unmarshals PatternFlowTcpSrcPortMetricTag from protobuf object *otg.PatternFlowTcpSrcPortMetricTag - FromProto(msg *otg.PatternFlowTcpSrcPortMetricTag) (PatternFlowTcpSrcPortMetricTag, error) - // FromPbText unmarshals PatternFlowTcpSrcPortMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpSrcPortMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpSrcPortMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpSrcPortMetricTag) Marshal() marshalPatternFlowTcpSrcPortMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpSrcPortMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpSrcPortMetricTag) Unmarshal() unMarshalPatternFlowTcpSrcPortMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpSrcPortMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpSrcPortMetricTag) ToProto() (*otg.PatternFlowTcpSrcPortMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpSrcPortMetricTag) FromProto(msg *otg.PatternFlowTcpSrcPortMetricTag) (PatternFlowTcpSrcPortMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpSrcPortMetricTag) 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 *unMarshalpatternFlowTcpSrcPortMetricTag) 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 *marshalpatternFlowTcpSrcPortMetricTag) 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 *unMarshalpatternFlowTcpSrcPortMetricTag) 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 *marshalpatternFlowTcpSrcPortMetricTag) 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 *unMarshalpatternFlowTcpSrcPortMetricTag) 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 *patternFlowTcpSrcPortMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpSrcPortMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpSrcPortMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpSrcPortMetricTag) Clone() (PatternFlowTcpSrcPortMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpSrcPortMetricTag() - 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 -} - -// PatternFlowTcpSrcPortMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpSrcPortMetricTag interface { - Validation - // msg marshals PatternFlowTcpSrcPortMetricTag to protobuf object *otg.PatternFlowTcpSrcPortMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpSrcPortMetricTag - // setMsg unmarshals PatternFlowTcpSrcPortMetricTag from protobuf object *otg.PatternFlowTcpSrcPortMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpSrcPortMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpSrcPortMetricTag - // validate validates PatternFlowTcpSrcPortMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpSrcPortMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpSrcPortMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpSrcPortMetricTag - SetName(value string) PatternFlowTcpSrcPortMetricTag - // Offset returns uint32, set in PatternFlowTcpSrcPortMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpSrcPortMetricTag - SetOffset(value uint32) PatternFlowTcpSrcPortMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpSrcPortMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpSrcPortMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpSrcPortMetricTag - SetLength(value uint32) PatternFlowTcpSrcPortMetricTag - // HasLength checks if Length has been set in PatternFlowTcpSrcPortMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpSrcPortMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpSrcPortMetricTag object -func (obj *patternFlowTcpSrcPortMetricTag) SetName(value string) PatternFlowTcpSrcPortMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpSrcPortMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpSrcPortMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpSrcPortMetricTag object -func (obj *patternFlowTcpSrcPortMetricTag) SetOffset(value uint32) PatternFlowTcpSrcPortMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpSrcPortMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpSrcPortMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpSrcPortMetricTag object -func (obj *patternFlowTcpSrcPortMetricTag) SetLength(value uint32) PatternFlowTcpSrcPortMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpSrcPortMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpSrcPortMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpSrcPortMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpSrcPortMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpSrcPortMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowTcpSrcPortRandom ***** -type patternFlowTcpSrcPortRandom struct { - validation - obj *otg.PatternFlowTcpSrcPortRandom - marshaller marshalPatternFlowTcpSrcPortRandom - unMarshaller unMarshalPatternFlowTcpSrcPortRandom -} - -func NewPatternFlowTcpSrcPortRandom() PatternFlowTcpSrcPortRandom { - obj := patternFlowTcpSrcPortRandom{obj: &otg.PatternFlowTcpSrcPortRandom{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpSrcPortRandom) msg() *otg.PatternFlowTcpSrcPortRandom { - return obj.obj -} - -func (obj *patternFlowTcpSrcPortRandom) setMsg(msg *otg.PatternFlowTcpSrcPortRandom) PatternFlowTcpSrcPortRandom { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpSrcPortRandom struct { - obj *patternFlowTcpSrcPortRandom -} - -type marshalPatternFlowTcpSrcPortRandom interface { - // ToProto marshals PatternFlowTcpSrcPortRandom to protobuf object *otg.PatternFlowTcpSrcPortRandom - ToProto() (*otg.PatternFlowTcpSrcPortRandom, error) - // ToPbText marshals PatternFlowTcpSrcPortRandom to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpSrcPortRandom to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpSrcPortRandom to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpSrcPortRandom struct { - obj *patternFlowTcpSrcPortRandom -} - -type unMarshalPatternFlowTcpSrcPortRandom interface { - // FromProto unmarshals PatternFlowTcpSrcPortRandom from protobuf object *otg.PatternFlowTcpSrcPortRandom - FromProto(msg *otg.PatternFlowTcpSrcPortRandom) (PatternFlowTcpSrcPortRandom, error) - // FromPbText unmarshals PatternFlowTcpSrcPortRandom from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpSrcPortRandom from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpSrcPortRandom from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpSrcPortRandom) Marshal() marshalPatternFlowTcpSrcPortRandom { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpSrcPortRandom{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpSrcPortRandom) Unmarshal() unMarshalPatternFlowTcpSrcPortRandom { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpSrcPortRandom{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpSrcPortRandom) ToProto() (*otg.PatternFlowTcpSrcPortRandom, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpSrcPortRandom) FromProto(msg *otg.PatternFlowTcpSrcPortRandom) (PatternFlowTcpSrcPortRandom, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpSrcPortRandom) 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 *unMarshalpatternFlowTcpSrcPortRandom) 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 *marshalpatternFlowTcpSrcPortRandom) 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 *unMarshalpatternFlowTcpSrcPortRandom) 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 *marshalpatternFlowTcpSrcPortRandom) 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 *unMarshalpatternFlowTcpSrcPortRandom) 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 *patternFlowTcpSrcPortRandom) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpSrcPortRandom) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpSrcPortRandom) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpSrcPortRandom) Clone() (PatternFlowTcpSrcPortRandom, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpSrcPortRandom() - 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 -} - -// PatternFlowTcpSrcPortRandom is integer random pattern -type PatternFlowTcpSrcPortRandom interface { - Validation - // msg marshals PatternFlowTcpSrcPortRandom to protobuf object *otg.PatternFlowTcpSrcPortRandom - // and doesn't set defaults - msg() *otg.PatternFlowTcpSrcPortRandom - // setMsg unmarshals PatternFlowTcpSrcPortRandom from protobuf object *otg.PatternFlowTcpSrcPortRandom - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpSrcPortRandom) PatternFlowTcpSrcPortRandom - // provides marshal interface - Marshal() marshalPatternFlowTcpSrcPortRandom - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpSrcPortRandom - // validate validates PatternFlowTcpSrcPortRandom - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpSrcPortRandom, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Min returns uint32, set in PatternFlowTcpSrcPortRandom. - Min() uint32 - // SetMin assigns uint32 provided by user to PatternFlowTcpSrcPortRandom - SetMin(value uint32) PatternFlowTcpSrcPortRandom - // HasMin checks if Min has been set in PatternFlowTcpSrcPortRandom - HasMin() bool - // Max returns uint32, set in PatternFlowTcpSrcPortRandom. - Max() uint32 - // SetMax assigns uint32 provided by user to PatternFlowTcpSrcPortRandom - SetMax(value uint32) PatternFlowTcpSrcPortRandom - // HasMax checks if Max has been set in PatternFlowTcpSrcPortRandom - HasMax() bool - // Seed returns uint32, set in PatternFlowTcpSrcPortRandom. - Seed() uint32 - // SetSeed assigns uint32 provided by user to PatternFlowTcpSrcPortRandom - SetSeed(value uint32) PatternFlowTcpSrcPortRandom - // HasSeed checks if Seed has been set in PatternFlowTcpSrcPortRandom - HasSeed() bool - // Count returns uint32, set in PatternFlowTcpSrcPortRandom. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpSrcPortRandom - SetCount(value uint32) PatternFlowTcpSrcPortRandom - // HasCount checks if Count has been set in PatternFlowTcpSrcPortRandom - HasCount() bool -} - -// The minimum possible value generated by the random value generator. -// Min returns a uint32 -func (obj *patternFlowTcpSrcPortRandom) Min() uint32 { - - return *obj.obj.Min - -} - -// The minimum possible value generated by the random value generator. -// Min returns a uint32 -func (obj *patternFlowTcpSrcPortRandom) HasMin() bool { - return obj.obj.Min != nil -} - -// The minimum possible value generated by the random value generator. -// SetMin sets the uint32 value in the PatternFlowTcpSrcPortRandom object -func (obj *patternFlowTcpSrcPortRandom) SetMin(value uint32) PatternFlowTcpSrcPortRandom { - - obj.obj.Min = &value - return obj -} - -// The maximum possible value generated by the random value generator. -// Max returns a uint32 -func (obj *patternFlowTcpSrcPortRandom) Max() uint32 { - - return *obj.obj.Max - -} - -// The maximum possible value generated by the random value generator. -// Max returns a uint32 -func (obj *patternFlowTcpSrcPortRandom) HasMax() bool { - return obj.obj.Max != nil -} - -// The maximum possible value generated by the random value generator. -// SetMax sets the uint32 value in the PatternFlowTcpSrcPortRandom object -func (obj *patternFlowTcpSrcPortRandom) SetMax(value uint32) PatternFlowTcpSrcPortRandom { - - obj.obj.Max = &value - return obj -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// Seed returns a uint32 -func (obj *patternFlowTcpSrcPortRandom) Seed() uint32 { - - return *obj.obj.Seed - -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// Seed returns a uint32 -func (obj *patternFlowTcpSrcPortRandom) HasSeed() bool { - return obj.obj.Seed != nil -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// SetSeed sets the uint32 value in the PatternFlowTcpSrcPortRandom object -func (obj *patternFlowTcpSrcPortRandom) SetSeed(value uint32) PatternFlowTcpSrcPortRandom { - - obj.obj.Seed = &value - return obj -} - -// The total number of values to be generated by the random value generator. -// Count returns a uint32 -func (obj *patternFlowTcpSrcPortRandom) Count() uint32 { - - return *obj.obj.Count - -} - -// The total number of values to be generated by the random value generator. -// Count returns a uint32 -func (obj *patternFlowTcpSrcPortRandom) HasCount() bool { - return obj.obj.Count != nil -} - -// The total number of values to be generated by the random value generator. -// SetCount sets the uint32 value in the PatternFlowTcpSrcPortRandom object -func (obj *patternFlowTcpSrcPortRandom) SetCount(value uint32) PatternFlowTcpSrcPortRandom { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpSrcPortRandom) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Min != nil { - - if *obj.obj.Min > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpSrcPortRandom.Min <= 65535 but Got %d", *obj.obj.Min)) - } - - } - - if obj.obj.Max != nil { - - if *obj.obj.Max > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpSrcPortRandom.Max <= 65535 but Got %d", *obj.obj.Max)) - } - - } - -} - -func (obj *patternFlowTcpSrcPortRandom) setDefault() { - if obj.obj.Min == nil { - obj.SetMin(0) - } - if obj.obj.Max == nil { - obj.SetMax(65535) - } - if obj.obj.Seed == nil { - obj.SetSeed(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpDstPortCounter ***** -type patternFlowTcpDstPortCounter struct { - validation - obj *otg.PatternFlowTcpDstPortCounter - marshaller marshalPatternFlowTcpDstPortCounter - unMarshaller unMarshalPatternFlowTcpDstPortCounter -} - -func NewPatternFlowTcpDstPortCounter() PatternFlowTcpDstPortCounter { - obj := patternFlowTcpDstPortCounter{obj: &otg.PatternFlowTcpDstPortCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpDstPortCounter) msg() *otg.PatternFlowTcpDstPortCounter { - return obj.obj -} - -func (obj *patternFlowTcpDstPortCounter) setMsg(msg *otg.PatternFlowTcpDstPortCounter) PatternFlowTcpDstPortCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpDstPortCounter struct { - obj *patternFlowTcpDstPortCounter -} - -type marshalPatternFlowTcpDstPortCounter interface { - // ToProto marshals PatternFlowTcpDstPortCounter to protobuf object *otg.PatternFlowTcpDstPortCounter - ToProto() (*otg.PatternFlowTcpDstPortCounter, error) - // ToPbText marshals PatternFlowTcpDstPortCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpDstPortCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpDstPortCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpDstPortCounter struct { - obj *patternFlowTcpDstPortCounter -} - -type unMarshalPatternFlowTcpDstPortCounter interface { - // FromProto unmarshals PatternFlowTcpDstPortCounter from protobuf object *otg.PatternFlowTcpDstPortCounter - FromProto(msg *otg.PatternFlowTcpDstPortCounter) (PatternFlowTcpDstPortCounter, error) - // FromPbText unmarshals PatternFlowTcpDstPortCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpDstPortCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpDstPortCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpDstPortCounter) Marshal() marshalPatternFlowTcpDstPortCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpDstPortCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpDstPortCounter) Unmarshal() unMarshalPatternFlowTcpDstPortCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpDstPortCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpDstPortCounter) ToProto() (*otg.PatternFlowTcpDstPortCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpDstPortCounter) FromProto(msg *otg.PatternFlowTcpDstPortCounter) (PatternFlowTcpDstPortCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpDstPortCounter) 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 *unMarshalpatternFlowTcpDstPortCounter) 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 *marshalpatternFlowTcpDstPortCounter) 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 *unMarshalpatternFlowTcpDstPortCounter) 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 *marshalpatternFlowTcpDstPortCounter) 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 *unMarshalpatternFlowTcpDstPortCounter) 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 *patternFlowTcpDstPortCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpDstPortCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpDstPortCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpDstPortCounter) Clone() (PatternFlowTcpDstPortCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpDstPortCounter() - 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 -} - -// PatternFlowTcpDstPortCounter is integer counter pattern -type PatternFlowTcpDstPortCounter interface { - Validation - // msg marshals PatternFlowTcpDstPortCounter to protobuf object *otg.PatternFlowTcpDstPortCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpDstPortCounter - // setMsg unmarshals PatternFlowTcpDstPortCounter from protobuf object *otg.PatternFlowTcpDstPortCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpDstPortCounter) PatternFlowTcpDstPortCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpDstPortCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpDstPortCounter - // validate validates PatternFlowTcpDstPortCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpDstPortCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpDstPortCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpDstPortCounter - SetStart(value uint32) PatternFlowTcpDstPortCounter - // HasStart checks if Start has been set in PatternFlowTcpDstPortCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpDstPortCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpDstPortCounter - SetStep(value uint32) PatternFlowTcpDstPortCounter - // HasStep checks if Step has been set in PatternFlowTcpDstPortCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpDstPortCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpDstPortCounter - SetCount(value uint32) PatternFlowTcpDstPortCounter - // HasCount checks if Count has been set in PatternFlowTcpDstPortCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpDstPortCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpDstPortCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpDstPortCounter object -func (obj *patternFlowTcpDstPortCounter) SetStart(value uint32) PatternFlowTcpDstPortCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpDstPortCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpDstPortCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpDstPortCounter object -func (obj *patternFlowTcpDstPortCounter) SetStep(value uint32) PatternFlowTcpDstPortCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpDstPortCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpDstPortCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpDstPortCounter object -func (obj *patternFlowTcpDstPortCounter) SetCount(value uint32) PatternFlowTcpDstPortCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpDstPortCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpDstPortCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpDstPortCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpDstPortCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowTcpDstPortCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpDstPortMetricTag ***** -type patternFlowTcpDstPortMetricTag struct { - validation - obj *otg.PatternFlowTcpDstPortMetricTag - marshaller marshalPatternFlowTcpDstPortMetricTag - unMarshaller unMarshalPatternFlowTcpDstPortMetricTag -} - -func NewPatternFlowTcpDstPortMetricTag() PatternFlowTcpDstPortMetricTag { - obj := patternFlowTcpDstPortMetricTag{obj: &otg.PatternFlowTcpDstPortMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpDstPortMetricTag) msg() *otg.PatternFlowTcpDstPortMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpDstPortMetricTag) setMsg(msg *otg.PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpDstPortMetricTag struct { - obj *patternFlowTcpDstPortMetricTag -} - -type marshalPatternFlowTcpDstPortMetricTag interface { - // ToProto marshals PatternFlowTcpDstPortMetricTag to protobuf object *otg.PatternFlowTcpDstPortMetricTag - ToProto() (*otg.PatternFlowTcpDstPortMetricTag, error) - // ToPbText marshals PatternFlowTcpDstPortMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpDstPortMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpDstPortMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpDstPortMetricTag struct { - obj *patternFlowTcpDstPortMetricTag -} - -type unMarshalPatternFlowTcpDstPortMetricTag interface { - // FromProto unmarshals PatternFlowTcpDstPortMetricTag from protobuf object *otg.PatternFlowTcpDstPortMetricTag - FromProto(msg *otg.PatternFlowTcpDstPortMetricTag) (PatternFlowTcpDstPortMetricTag, error) - // FromPbText unmarshals PatternFlowTcpDstPortMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpDstPortMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpDstPortMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpDstPortMetricTag) Marshal() marshalPatternFlowTcpDstPortMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpDstPortMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpDstPortMetricTag) Unmarshal() unMarshalPatternFlowTcpDstPortMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpDstPortMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpDstPortMetricTag) ToProto() (*otg.PatternFlowTcpDstPortMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpDstPortMetricTag) FromProto(msg *otg.PatternFlowTcpDstPortMetricTag) (PatternFlowTcpDstPortMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpDstPortMetricTag) 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 *unMarshalpatternFlowTcpDstPortMetricTag) 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 *marshalpatternFlowTcpDstPortMetricTag) 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 *unMarshalpatternFlowTcpDstPortMetricTag) 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 *marshalpatternFlowTcpDstPortMetricTag) 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 *unMarshalpatternFlowTcpDstPortMetricTag) 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 *patternFlowTcpDstPortMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpDstPortMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpDstPortMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpDstPortMetricTag) Clone() (PatternFlowTcpDstPortMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpDstPortMetricTag() - 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 -} - -// PatternFlowTcpDstPortMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpDstPortMetricTag interface { - Validation - // msg marshals PatternFlowTcpDstPortMetricTag to protobuf object *otg.PatternFlowTcpDstPortMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpDstPortMetricTag - // setMsg unmarshals PatternFlowTcpDstPortMetricTag from protobuf object *otg.PatternFlowTcpDstPortMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpDstPortMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpDstPortMetricTag - // validate validates PatternFlowTcpDstPortMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpDstPortMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpDstPortMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpDstPortMetricTag - SetName(value string) PatternFlowTcpDstPortMetricTag - // Offset returns uint32, set in PatternFlowTcpDstPortMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpDstPortMetricTag - SetOffset(value uint32) PatternFlowTcpDstPortMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpDstPortMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpDstPortMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpDstPortMetricTag - SetLength(value uint32) PatternFlowTcpDstPortMetricTag - // HasLength checks if Length has been set in PatternFlowTcpDstPortMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpDstPortMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpDstPortMetricTag object -func (obj *patternFlowTcpDstPortMetricTag) SetName(value string) PatternFlowTcpDstPortMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpDstPortMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpDstPortMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpDstPortMetricTag object -func (obj *patternFlowTcpDstPortMetricTag) SetOffset(value uint32) PatternFlowTcpDstPortMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpDstPortMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpDstPortMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpDstPortMetricTag object -func (obj *patternFlowTcpDstPortMetricTag) SetLength(value uint32) PatternFlowTcpDstPortMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpDstPortMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpDstPortMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpDstPortMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpDstPortMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpDstPortMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowTcpDstPortRandom ***** -type patternFlowTcpDstPortRandom struct { - validation - obj *otg.PatternFlowTcpDstPortRandom - marshaller marshalPatternFlowTcpDstPortRandom - unMarshaller unMarshalPatternFlowTcpDstPortRandom -} - -func NewPatternFlowTcpDstPortRandom() PatternFlowTcpDstPortRandom { - obj := patternFlowTcpDstPortRandom{obj: &otg.PatternFlowTcpDstPortRandom{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpDstPortRandom) msg() *otg.PatternFlowTcpDstPortRandom { - return obj.obj -} - -func (obj *patternFlowTcpDstPortRandom) setMsg(msg *otg.PatternFlowTcpDstPortRandom) PatternFlowTcpDstPortRandom { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpDstPortRandom struct { - obj *patternFlowTcpDstPortRandom -} - -type marshalPatternFlowTcpDstPortRandom interface { - // ToProto marshals PatternFlowTcpDstPortRandom to protobuf object *otg.PatternFlowTcpDstPortRandom - ToProto() (*otg.PatternFlowTcpDstPortRandom, error) - // ToPbText marshals PatternFlowTcpDstPortRandom to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpDstPortRandom to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpDstPortRandom to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpDstPortRandom struct { - obj *patternFlowTcpDstPortRandom -} - -type unMarshalPatternFlowTcpDstPortRandom interface { - // FromProto unmarshals PatternFlowTcpDstPortRandom from protobuf object *otg.PatternFlowTcpDstPortRandom - FromProto(msg *otg.PatternFlowTcpDstPortRandom) (PatternFlowTcpDstPortRandom, error) - // FromPbText unmarshals PatternFlowTcpDstPortRandom from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpDstPortRandom from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpDstPortRandom from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpDstPortRandom) Marshal() marshalPatternFlowTcpDstPortRandom { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpDstPortRandom{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpDstPortRandom) Unmarshal() unMarshalPatternFlowTcpDstPortRandom { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpDstPortRandom{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpDstPortRandom) ToProto() (*otg.PatternFlowTcpDstPortRandom, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpDstPortRandom) FromProto(msg *otg.PatternFlowTcpDstPortRandom) (PatternFlowTcpDstPortRandom, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpDstPortRandom) 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 *unMarshalpatternFlowTcpDstPortRandom) 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 *marshalpatternFlowTcpDstPortRandom) 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 *unMarshalpatternFlowTcpDstPortRandom) 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 *marshalpatternFlowTcpDstPortRandom) 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 *unMarshalpatternFlowTcpDstPortRandom) 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 *patternFlowTcpDstPortRandom) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpDstPortRandom) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpDstPortRandom) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpDstPortRandom) Clone() (PatternFlowTcpDstPortRandom, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpDstPortRandom() - 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 -} - -// PatternFlowTcpDstPortRandom is integer random pattern -type PatternFlowTcpDstPortRandom interface { - Validation - // msg marshals PatternFlowTcpDstPortRandom to protobuf object *otg.PatternFlowTcpDstPortRandom - // and doesn't set defaults - msg() *otg.PatternFlowTcpDstPortRandom - // setMsg unmarshals PatternFlowTcpDstPortRandom from protobuf object *otg.PatternFlowTcpDstPortRandom - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpDstPortRandom) PatternFlowTcpDstPortRandom - // provides marshal interface - Marshal() marshalPatternFlowTcpDstPortRandom - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpDstPortRandom - // validate validates PatternFlowTcpDstPortRandom - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpDstPortRandom, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Min returns uint32, set in PatternFlowTcpDstPortRandom. - Min() uint32 - // SetMin assigns uint32 provided by user to PatternFlowTcpDstPortRandom - SetMin(value uint32) PatternFlowTcpDstPortRandom - // HasMin checks if Min has been set in PatternFlowTcpDstPortRandom - HasMin() bool - // Max returns uint32, set in PatternFlowTcpDstPortRandom. - Max() uint32 - // SetMax assigns uint32 provided by user to PatternFlowTcpDstPortRandom - SetMax(value uint32) PatternFlowTcpDstPortRandom - // HasMax checks if Max has been set in PatternFlowTcpDstPortRandom - HasMax() bool - // Seed returns uint32, set in PatternFlowTcpDstPortRandom. - Seed() uint32 - // SetSeed assigns uint32 provided by user to PatternFlowTcpDstPortRandom - SetSeed(value uint32) PatternFlowTcpDstPortRandom - // HasSeed checks if Seed has been set in PatternFlowTcpDstPortRandom - HasSeed() bool - // Count returns uint32, set in PatternFlowTcpDstPortRandom. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpDstPortRandom - SetCount(value uint32) PatternFlowTcpDstPortRandom - // HasCount checks if Count has been set in PatternFlowTcpDstPortRandom - HasCount() bool -} - -// The minimum possible value generated by the random value generator. -// Min returns a uint32 -func (obj *patternFlowTcpDstPortRandom) Min() uint32 { - - return *obj.obj.Min - -} - -// The minimum possible value generated by the random value generator. -// Min returns a uint32 -func (obj *patternFlowTcpDstPortRandom) HasMin() bool { - return obj.obj.Min != nil -} - -// The minimum possible value generated by the random value generator. -// SetMin sets the uint32 value in the PatternFlowTcpDstPortRandom object -func (obj *patternFlowTcpDstPortRandom) SetMin(value uint32) PatternFlowTcpDstPortRandom { - - obj.obj.Min = &value - return obj -} - -// The maximum possible value generated by the random value generator. -// Max returns a uint32 -func (obj *patternFlowTcpDstPortRandom) Max() uint32 { - - return *obj.obj.Max - -} - -// The maximum possible value generated by the random value generator. -// Max returns a uint32 -func (obj *patternFlowTcpDstPortRandom) HasMax() bool { - return obj.obj.Max != nil -} - -// The maximum possible value generated by the random value generator. -// SetMax sets the uint32 value in the PatternFlowTcpDstPortRandom object -func (obj *patternFlowTcpDstPortRandom) SetMax(value uint32) PatternFlowTcpDstPortRandom { - - obj.obj.Max = &value - return obj -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// Seed returns a uint32 -func (obj *patternFlowTcpDstPortRandom) Seed() uint32 { - - return *obj.obj.Seed - -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// Seed returns a uint32 -func (obj *patternFlowTcpDstPortRandom) HasSeed() bool { - return obj.obj.Seed != nil -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// SetSeed sets the uint32 value in the PatternFlowTcpDstPortRandom object -func (obj *patternFlowTcpDstPortRandom) SetSeed(value uint32) PatternFlowTcpDstPortRandom { - - obj.obj.Seed = &value - return obj -} - -// The total number of values to be generated by the random value generator. -// Count returns a uint32 -func (obj *patternFlowTcpDstPortRandom) Count() uint32 { - - return *obj.obj.Count - -} - -// The total number of values to be generated by the random value generator. -// Count returns a uint32 -func (obj *patternFlowTcpDstPortRandom) HasCount() bool { - return obj.obj.Count != nil -} - -// The total number of values to be generated by the random value generator. -// SetCount sets the uint32 value in the PatternFlowTcpDstPortRandom object -func (obj *patternFlowTcpDstPortRandom) SetCount(value uint32) PatternFlowTcpDstPortRandom { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpDstPortRandom) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Min != nil { - - if *obj.obj.Min > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpDstPortRandom.Min <= 65535 but Got %d", *obj.obj.Min)) - } - - } - - if obj.obj.Max != nil { - - if *obj.obj.Max > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpDstPortRandom.Max <= 65535 but Got %d", *obj.obj.Max)) - } - - } - -} - -func (obj *patternFlowTcpDstPortRandom) setDefault() { - if obj.obj.Min == nil { - obj.SetMin(0) - } - if obj.obj.Max == nil { - obj.SetMax(65535) - } - if obj.obj.Seed == nil { - obj.SetSeed(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpSeqNumCounter ***** -type patternFlowTcpSeqNumCounter struct { - validation - obj *otg.PatternFlowTcpSeqNumCounter - marshaller marshalPatternFlowTcpSeqNumCounter - unMarshaller unMarshalPatternFlowTcpSeqNumCounter -} - -func NewPatternFlowTcpSeqNumCounter() PatternFlowTcpSeqNumCounter { - obj := patternFlowTcpSeqNumCounter{obj: &otg.PatternFlowTcpSeqNumCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpSeqNumCounter) msg() *otg.PatternFlowTcpSeqNumCounter { - return obj.obj -} - -func (obj *patternFlowTcpSeqNumCounter) setMsg(msg *otg.PatternFlowTcpSeqNumCounter) PatternFlowTcpSeqNumCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpSeqNumCounter struct { - obj *patternFlowTcpSeqNumCounter -} - -type marshalPatternFlowTcpSeqNumCounter interface { - // ToProto marshals PatternFlowTcpSeqNumCounter to protobuf object *otg.PatternFlowTcpSeqNumCounter - ToProto() (*otg.PatternFlowTcpSeqNumCounter, error) - // ToPbText marshals PatternFlowTcpSeqNumCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpSeqNumCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpSeqNumCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpSeqNumCounter struct { - obj *patternFlowTcpSeqNumCounter -} - -type unMarshalPatternFlowTcpSeqNumCounter interface { - // FromProto unmarshals PatternFlowTcpSeqNumCounter from protobuf object *otg.PatternFlowTcpSeqNumCounter - FromProto(msg *otg.PatternFlowTcpSeqNumCounter) (PatternFlowTcpSeqNumCounter, error) - // FromPbText unmarshals PatternFlowTcpSeqNumCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpSeqNumCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpSeqNumCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpSeqNumCounter) Marshal() marshalPatternFlowTcpSeqNumCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpSeqNumCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpSeqNumCounter) Unmarshal() unMarshalPatternFlowTcpSeqNumCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpSeqNumCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpSeqNumCounter) ToProto() (*otg.PatternFlowTcpSeqNumCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpSeqNumCounter) FromProto(msg *otg.PatternFlowTcpSeqNumCounter) (PatternFlowTcpSeqNumCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpSeqNumCounter) 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 *unMarshalpatternFlowTcpSeqNumCounter) 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 *marshalpatternFlowTcpSeqNumCounter) 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 *unMarshalpatternFlowTcpSeqNumCounter) 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 *marshalpatternFlowTcpSeqNumCounter) 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 *unMarshalpatternFlowTcpSeqNumCounter) 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 *patternFlowTcpSeqNumCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpSeqNumCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpSeqNumCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpSeqNumCounter) Clone() (PatternFlowTcpSeqNumCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpSeqNumCounter() - 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 -} - -// PatternFlowTcpSeqNumCounter is integer counter pattern -type PatternFlowTcpSeqNumCounter interface { - Validation - // msg marshals PatternFlowTcpSeqNumCounter to protobuf object *otg.PatternFlowTcpSeqNumCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpSeqNumCounter - // setMsg unmarshals PatternFlowTcpSeqNumCounter from protobuf object *otg.PatternFlowTcpSeqNumCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpSeqNumCounter) PatternFlowTcpSeqNumCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpSeqNumCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpSeqNumCounter - // validate validates PatternFlowTcpSeqNumCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpSeqNumCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpSeqNumCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpSeqNumCounter - SetStart(value uint32) PatternFlowTcpSeqNumCounter - // HasStart checks if Start has been set in PatternFlowTcpSeqNumCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpSeqNumCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpSeqNumCounter - SetStep(value uint32) PatternFlowTcpSeqNumCounter - // HasStep checks if Step has been set in PatternFlowTcpSeqNumCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpSeqNumCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpSeqNumCounter - SetCount(value uint32) PatternFlowTcpSeqNumCounter - // HasCount checks if Count has been set in PatternFlowTcpSeqNumCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpSeqNumCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpSeqNumCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpSeqNumCounter object -func (obj *patternFlowTcpSeqNumCounter) SetStart(value uint32) PatternFlowTcpSeqNumCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpSeqNumCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpSeqNumCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpSeqNumCounter object -func (obj *patternFlowTcpSeqNumCounter) SetStep(value uint32) PatternFlowTcpSeqNumCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpSeqNumCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpSeqNumCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpSeqNumCounter object -func (obj *patternFlowTcpSeqNumCounter) SetCount(value uint32) PatternFlowTcpSeqNumCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpSeqNumCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowTcpSeqNumCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpSeqNumMetricTag ***** -type patternFlowTcpSeqNumMetricTag struct { - validation - obj *otg.PatternFlowTcpSeqNumMetricTag - marshaller marshalPatternFlowTcpSeqNumMetricTag - unMarshaller unMarshalPatternFlowTcpSeqNumMetricTag -} - -func NewPatternFlowTcpSeqNumMetricTag() PatternFlowTcpSeqNumMetricTag { - obj := patternFlowTcpSeqNumMetricTag{obj: &otg.PatternFlowTcpSeqNumMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpSeqNumMetricTag) msg() *otg.PatternFlowTcpSeqNumMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpSeqNumMetricTag) setMsg(msg *otg.PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpSeqNumMetricTag struct { - obj *patternFlowTcpSeqNumMetricTag -} - -type marshalPatternFlowTcpSeqNumMetricTag interface { - // ToProto marshals PatternFlowTcpSeqNumMetricTag to protobuf object *otg.PatternFlowTcpSeqNumMetricTag - ToProto() (*otg.PatternFlowTcpSeqNumMetricTag, error) - // ToPbText marshals PatternFlowTcpSeqNumMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpSeqNumMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpSeqNumMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpSeqNumMetricTag struct { - obj *patternFlowTcpSeqNumMetricTag -} - -type unMarshalPatternFlowTcpSeqNumMetricTag interface { - // FromProto unmarshals PatternFlowTcpSeqNumMetricTag from protobuf object *otg.PatternFlowTcpSeqNumMetricTag - FromProto(msg *otg.PatternFlowTcpSeqNumMetricTag) (PatternFlowTcpSeqNumMetricTag, error) - // FromPbText unmarshals PatternFlowTcpSeqNumMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpSeqNumMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpSeqNumMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpSeqNumMetricTag) Marshal() marshalPatternFlowTcpSeqNumMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpSeqNumMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpSeqNumMetricTag) Unmarshal() unMarshalPatternFlowTcpSeqNumMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpSeqNumMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpSeqNumMetricTag) ToProto() (*otg.PatternFlowTcpSeqNumMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpSeqNumMetricTag) FromProto(msg *otg.PatternFlowTcpSeqNumMetricTag) (PatternFlowTcpSeqNumMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpSeqNumMetricTag) 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 *unMarshalpatternFlowTcpSeqNumMetricTag) 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 *marshalpatternFlowTcpSeqNumMetricTag) 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 *unMarshalpatternFlowTcpSeqNumMetricTag) 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 *marshalpatternFlowTcpSeqNumMetricTag) 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 *unMarshalpatternFlowTcpSeqNumMetricTag) 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 *patternFlowTcpSeqNumMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpSeqNumMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpSeqNumMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpSeqNumMetricTag) Clone() (PatternFlowTcpSeqNumMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpSeqNumMetricTag() - 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 -} - -// PatternFlowTcpSeqNumMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpSeqNumMetricTag interface { - Validation - // msg marshals PatternFlowTcpSeqNumMetricTag to protobuf object *otg.PatternFlowTcpSeqNumMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpSeqNumMetricTag - // setMsg unmarshals PatternFlowTcpSeqNumMetricTag from protobuf object *otg.PatternFlowTcpSeqNumMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpSeqNumMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpSeqNumMetricTag - // validate validates PatternFlowTcpSeqNumMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpSeqNumMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpSeqNumMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpSeqNumMetricTag - SetName(value string) PatternFlowTcpSeqNumMetricTag - // Offset returns uint32, set in PatternFlowTcpSeqNumMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpSeqNumMetricTag - SetOffset(value uint32) PatternFlowTcpSeqNumMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpSeqNumMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpSeqNumMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpSeqNumMetricTag - SetLength(value uint32) PatternFlowTcpSeqNumMetricTag - // HasLength checks if Length has been set in PatternFlowTcpSeqNumMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpSeqNumMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpSeqNumMetricTag object -func (obj *patternFlowTcpSeqNumMetricTag) SetName(value string) PatternFlowTcpSeqNumMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpSeqNumMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpSeqNumMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpSeqNumMetricTag object -func (obj *patternFlowTcpSeqNumMetricTag) SetOffset(value uint32) PatternFlowTcpSeqNumMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpSeqNumMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpSeqNumMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpSeqNumMetricTag object -func (obj *patternFlowTcpSeqNumMetricTag) SetLength(value uint32) PatternFlowTcpSeqNumMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpSeqNumMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpSeqNumMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpSeqNumMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpSeqNumMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpSeqNumMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(32) - } - -} - -// ***** PatternFlowTcpAckNumCounter ***** -type patternFlowTcpAckNumCounter struct { - validation - obj *otg.PatternFlowTcpAckNumCounter - marshaller marshalPatternFlowTcpAckNumCounter - unMarshaller unMarshalPatternFlowTcpAckNumCounter -} - -func NewPatternFlowTcpAckNumCounter() PatternFlowTcpAckNumCounter { - obj := patternFlowTcpAckNumCounter{obj: &otg.PatternFlowTcpAckNumCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpAckNumCounter) msg() *otg.PatternFlowTcpAckNumCounter { - return obj.obj -} - -func (obj *patternFlowTcpAckNumCounter) setMsg(msg *otg.PatternFlowTcpAckNumCounter) PatternFlowTcpAckNumCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpAckNumCounter struct { - obj *patternFlowTcpAckNumCounter -} - -type marshalPatternFlowTcpAckNumCounter interface { - // ToProto marshals PatternFlowTcpAckNumCounter to protobuf object *otg.PatternFlowTcpAckNumCounter - ToProto() (*otg.PatternFlowTcpAckNumCounter, error) - // ToPbText marshals PatternFlowTcpAckNumCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpAckNumCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpAckNumCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpAckNumCounter struct { - obj *patternFlowTcpAckNumCounter -} - -type unMarshalPatternFlowTcpAckNumCounter interface { - // FromProto unmarshals PatternFlowTcpAckNumCounter from protobuf object *otg.PatternFlowTcpAckNumCounter - FromProto(msg *otg.PatternFlowTcpAckNumCounter) (PatternFlowTcpAckNumCounter, error) - // FromPbText unmarshals PatternFlowTcpAckNumCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpAckNumCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpAckNumCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpAckNumCounter) Marshal() marshalPatternFlowTcpAckNumCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpAckNumCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpAckNumCounter) Unmarshal() unMarshalPatternFlowTcpAckNumCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpAckNumCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpAckNumCounter) ToProto() (*otg.PatternFlowTcpAckNumCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpAckNumCounter) FromProto(msg *otg.PatternFlowTcpAckNumCounter) (PatternFlowTcpAckNumCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpAckNumCounter) 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 *unMarshalpatternFlowTcpAckNumCounter) 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 *marshalpatternFlowTcpAckNumCounter) 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 *unMarshalpatternFlowTcpAckNumCounter) 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 *marshalpatternFlowTcpAckNumCounter) 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 *unMarshalpatternFlowTcpAckNumCounter) 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 *patternFlowTcpAckNumCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpAckNumCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpAckNumCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpAckNumCounter) Clone() (PatternFlowTcpAckNumCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpAckNumCounter() - 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 -} - -// PatternFlowTcpAckNumCounter is integer counter pattern -type PatternFlowTcpAckNumCounter interface { - Validation - // msg marshals PatternFlowTcpAckNumCounter to protobuf object *otg.PatternFlowTcpAckNumCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpAckNumCounter - // setMsg unmarshals PatternFlowTcpAckNumCounter from protobuf object *otg.PatternFlowTcpAckNumCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpAckNumCounter) PatternFlowTcpAckNumCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpAckNumCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpAckNumCounter - // validate validates PatternFlowTcpAckNumCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpAckNumCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpAckNumCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpAckNumCounter - SetStart(value uint32) PatternFlowTcpAckNumCounter - // HasStart checks if Start has been set in PatternFlowTcpAckNumCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpAckNumCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpAckNumCounter - SetStep(value uint32) PatternFlowTcpAckNumCounter - // HasStep checks if Step has been set in PatternFlowTcpAckNumCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpAckNumCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpAckNumCounter - SetCount(value uint32) PatternFlowTcpAckNumCounter - // HasCount checks if Count has been set in PatternFlowTcpAckNumCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpAckNumCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpAckNumCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpAckNumCounter object -func (obj *patternFlowTcpAckNumCounter) SetStart(value uint32) PatternFlowTcpAckNumCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpAckNumCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpAckNumCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpAckNumCounter object -func (obj *patternFlowTcpAckNumCounter) SetStep(value uint32) PatternFlowTcpAckNumCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpAckNumCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpAckNumCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpAckNumCounter object -func (obj *patternFlowTcpAckNumCounter) SetCount(value uint32) PatternFlowTcpAckNumCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpAckNumCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowTcpAckNumCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpAckNumMetricTag ***** -type patternFlowTcpAckNumMetricTag struct { - validation - obj *otg.PatternFlowTcpAckNumMetricTag - marshaller marshalPatternFlowTcpAckNumMetricTag - unMarshaller unMarshalPatternFlowTcpAckNumMetricTag -} - -func NewPatternFlowTcpAckNumMetricTag() PatternFlowTcpAckNumMetricTag { - obj := patternFlowTcpAckNumMetricTag{obj: &otg.PatternFlowTcpAckNumMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpAckNumMetricTag) msg() *otg.PatternFlowTcpAckNumMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpAckNumMetricTag) setMsg(msg *otg.PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpAckNumMetricTag struct { - obj *patternFlowTcpAckNumMetricTag -} - -type marshalPatternFlowTcpAckNumMetricTag interface { - // ToProto marshals PatternFlowTcpAckNumMetricTag to protobuf object *otg.PatternFlowTcpAckNumMetricTag - ToProto() (*otg.PatternFlowTcpAckNumMetricTag, error) - // ToPbText marshals PatternFlowTcpAckNumMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpAckNumMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpAckNumMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpAckNumMetricTag struct { - obj *patternFlowTcpAckNumMetricTag -} - -type unMarshalPatternFlowTcpAckNumMetricTag interface { - // FromProto unmarshals PatternFlowTcpAckNumMetricTag from protobuf object *otg.PatternFlowTcpAckNumMetricTag - FromProto(msg *otg.PatternFlowTcpAckNumMetricTag) (PatternFlowTcpAckNumMetricTag, error) - // FromPbText unmarshals PatternFlowTcpAckNumMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpAckNumMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpAckNumMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpAckNumMetricTag) Marshal() marshalPatternFlowTcpAckNumMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpAckNumMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpAckNumMetricTag) Unmarshal() unMarshalPatternFlowTcpAckNumMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpAckNumMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpAckNumMetricTag) ToProto() (*otg.PatternFlowTcpAckNumMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpAckNumMetricTag) FromProto(msg *otg.PatternFlowTcpAckNumMetricTag) (PatternFlowTcpAckNumMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpAckNumMetricTag) 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 *unMarshalpatternFlowTcpAckNumMetricTag) 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 *marshalpatternFlowTcpAckNumMetricTag) 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 *unMarshalpatternFlowTcpAckNumMetricTag) 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 *marshalpatternFlowTcpAckNumMetricTag) 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 *unMarshalpatternFlowTcpAckNumMetricTag) 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 *patternFlowTcpAckNumMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpAckNumMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpAckNumMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpAckNumMetricTag) Clone() (PatternFlowTcpAckNumMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpAckNumMetricTag() - 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 -} - -// PatternFlowTcpAckNumMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpAckNumMetricTag interface { - Validation - // msg marshals PatternFlowTcpAckNumMetricTag to protobuf object *otg.PatternFlowTcpAckNumMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpAckNumMetricTag - // setMsg unmarshals PatternFlowTcpAckNumMetricTag from protobuf object *otg.PatternFlowTcpAckNumMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpAckNumMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpAckNumMetricTag - // validate validates PatternFlowTcpAckNumMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpAckNumMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpAckNumMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpAckNumMetricTag - SetName(value string) PatternFlowTcpAckNumMetricTag - // Offset returns uint32, set in PatternFlowTcpAckNumMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpAckNumMetricTag - SetOffset(value uint32) PatternFlowTcpAckNumMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpAckNumMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpAckNumMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpAckNumMetricTag - SetLength(value uint32) PatternFlowTcpAckNumMetricTag - // HasLength checks if Length has been set in PatternFlowTcpAckNumMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpAckNumMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpAckNumMetricTag object -func (obj *patternFlowTcpAckNumMetricTag) SetName(value string) PatternFlowTcpAckNumMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpAckNumMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpAckNumMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpAckNumMetricTag object -func (obj *patternFlowTcpAckNumMetricTag) SetOffset(value uint32) PatternFlowTcpAckNumMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpAckNumMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpAckNumMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpAckNumMetricTag object -func (obj *patternFlowTcpAckNumMetricTag) SetLength(value uint32) PatternFlowTcpAckNumMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpAckNumMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpAckNumMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpAckNumMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpAckNumMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpAckNumMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(32) - } - -} - -// ***** PatternFlowTcpDataOffsetCounter ***** -type patternFlowTcpDataOffsetCounter struct { - validation - obj *otg.PatternFlowTcpDataOffsetCounter - marshaller marshalPatternFlowTcpDataOffsetCounter - unMarshaller unMarshalPatternFlowTcpDataOffsetCounter -} - -func NewPatternFlowTcpDataOffsetCounter() PatternFlowTcpDataOffsetCounter { - obj := patternFlowTcpDataOffsetCounter{obj: &otg.PatternFlowTcpDataOffsetCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpDataOffsetCounter) msg() *otg.PatternFlowTcpDataOffsetCounter { - return obj.obj -} - -func (obj *patternFlowTcpDataOffsetCounter) setMsg(msg *otg.PatternFlowTcpDataOffsetCounter) PatternFlowTcpDataOffsetCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpDataOffsetCounter struct { - obj *patternFlowTcpDataOffsetCounter -} - -type marshalPatternFlowTcpDataOffsetCounter interface { - // ToProto marshals PatternFlowTcpDataOffsetCounter to protobuf object *otg.PatternFlowTcpDataOffsetCounter - ToProto() (*otg.PatternFlowTcpDataOffsetCounter, error) - // ToPbText marshals PatternFlowTcpDataOffsetCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpDataOffsetCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpDataOffsetCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpDataOffsetCounter struct { - obj *patternFlowTcpDataOffsetCounter -} - -type unMarshalPatternFlowTcpDataOffsetCounter interface { - // FromProto unmarshals PatternFlowTcpDataOffsetCounter from protobuf object *otg.PatternFlowTcpDataOffsetCounter - FromProto(msg *otg.PatternFlowTcpDataOffsetCounter) (PatternFlowTcpDataOffsetCounter, error) - // FromPbText unmarshals PatternFlowTcpDataOffsetCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpDataOffsetCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpDataOffsetCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpDataOffsetCounter) Marshal() marshalPatternFlowTcpDataOffsetCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpDataOffsetCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpDataOffsetCounter) Unmarshal() unMarshalPatternFlowTcpDataOffsetCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpDataOffsetCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpDataOffsetCounter) ToProto() (*otg.PatternFlowTcpDataOffsetCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpDataOffsetCounter) FromProto(msg *otg.PatternFlowTcpDataOffsetCounter) (PatternFlowTcpDataOffsetCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpDataOffsetCounter) 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 *unMarshalpatternFlowTcpDataOffsetCounter) 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 *marshalpatternFlowTcpDataOffsetCounter) 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 *unMarshalpatternFlowTcpDataOffsetCounter) 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 *marshalpatternFlowTcpDataOffsetCounter) 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 *unMarshalpatternFlowTcpDataOffsetCounter) 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 *patternFlowTcpDataOffsetCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpDataOffsetCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpDataOffsetCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpDataOffsetCounter) Clone() (PatternFlowTcpDataOffsetCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpDataOffsetCounter() - 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 -} - -// PatternFlowTcpDataOffsetCounter is integer counter pattern -type PatternFlowTcpDataOffsetCounter interface { - Validation - // msg marshals PatternFlowTcpDataOffsetCounter to protobuf object *otg.PatternFlowTcpDataOffsetCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpDataOffsetCounter - // setMsg unmarshals PatternFlowTcpDataOffsetCounter from protobuf object *otg.PatternFlowTcpDataOffsetCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpDataOffsetCounter) PatternFlowTcpDataOffsetCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpDataOffsetCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpDataOffsetCounter - // validate validates PatternFlowTcpDataOffsetCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpDataOffsetCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpDataOffsetCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpDataOffsetCounter - SetStart(value uint32) PatternFlowTcpDataOffsetCounter - // HasStart checks if Start has been set in PatternFlowTcpDataOffsetCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpDataOffsetCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpDataOffsetCounter - SetStep(value uint32) PatternFlowTcpDataOffsetCounter - // HasStep checks if Step has been set in PatternFlowTcpDataOffsetCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpDataOffsetCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpDataOffsetCounter - SetCount(value uint32) PatternFlowTcpDataOffsetCounter - // HasCount checks if Count has been set in PatternFlowTcpDataOffsetCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpDataOffsetCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpDataOffsetCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpDataOffsetCounter object -func (obj *patternFlowTcpDataOffsetCounter) SetStart(value uint32) PatternFlowTcpDataOffsetCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpDataOffsetCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpDataOffsetCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpDataOffsetCounter object -func (obj *patternFlowTcpDataOffsetCounter) SetStep(value uint32) PatternFlowTcpDataOffsetCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpDataOffsetCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpDataOffsetCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpDataOffsetCounter object -func (obj *patternFlowTcpDataOffsetCounter) SetCount(value uint32) PatternFlowTcpDataOffsetCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpDataOffsetCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpDataOffsetCounter.Start <= 15 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpDataOffsetCounter.Step <= 15 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpDataOffsetCounter.Count <= 15 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowTcpDataOffsetCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpDataOffsetMetricTag ***** -type patternFlowTcpDataOffsetMetricTag struct { - validation - obj *otg.PatternFlowTcpDataOffsetMetricTag - marshaller marshalPatternFlowTcpDataOffsetMetricTag - unMarshaller unMarshalPatternFlowTcpDataOffsetMetricTag -} - -func NewPatternFlowTcpDataOffsetMetricTag() PatternFlowTcpDataOffsetMetricTag { - obj := patternFlowTcpDataOffsetMetricTag{obj: &otg.PatternFlowTcpDataOffsetMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpDataOffsetMetricTag) msg() *otg.PatternFlowTcpDataOffsetMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpDataOffsetMetricTag) setMsg(msg *otg.PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpDataOffsetMetricTag struct { - obj *patternFlowTcpDataOffsetMetricTag -} - -type marshalPatternFlowTcpDataOffsetMetricTag interface { - // ToProto marshals PatternFlowTcpDataOffsetMetricTag to protobuf object *otg.PatternFlowTcpDataOffsetMetricTag - ToProto() (*otg.PatternFlowTcpDataOffsetMetricTag, error) - // ToPbText marshals PatternFlowTcpDataOffsetMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpDataOffsetMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpDataOffsetMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpDataOffsetMetricTag struct { - obj *patternFlowTcpDataOffsetMetricTag -} - -type unMarshalPatternFlowTcpDataOffsetMetricTag interface { - // FromProto unmarshals PatternFlowTcpDataOffsetMetricTag from protobuf object *otg.PatternFlowTcpDataOffsetMetricTag - FromProto(msg *otg.PatternFlowTcpDataOffsetMetricTag) (PatternFlowTcpDataOffsetMetricTag, error) - // FromPbText unmarshals PatternFlowTcpDataOffsetMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpDataOffsetMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpDataOffsetMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpDataOffsetMetricTag) Marshal() marshalPatternFlowTcpDataOffsetMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpDataOffsetMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpDataOffsetMetricTag) Unmarshal() unMarshalPatternFlowTcpDataOffsetMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpDataOffsetMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpDataOffsetMetricTag) ToProto() (*otg.PatternFlowTcpDataOffsetMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpDataOffsetMetricTag) FromProto(msg *otg.PatternFlowTcpDataOffsetMetricTag) (PatternFlowTcpDataOffsetMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpDataOffsetMetricTag) 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 *unMarshalpatternFlowTcpDataOffsetMetricTag) 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 *marshalpatternFlowTcpDataOffsetMetricTag) 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 *unMarshalpatternFlowTcpDataOffsetMetricTag) 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 *marshalpatternFlowTcpDataOffsetMetricTag) 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 *unMarshalpatternFlowTcpDataOffsetMetricTag) 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 *patternFlowTcpDataOffsetMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpDataOffsetMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpDataOffsetMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpDataOffsetMetricTag) Clone() (PatternFlowTcpDataOffsetMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpDataOffsetMetricTag() - 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 -} - -// PatternFlowTcpDataOffsetMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpDataOffsetMetricTag interface { - Validation - // msg marshals PatternFlowTcpDataOffsetMetricTag to protobuf object *otg.PatternFlowTcpDataOffsetMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpDataOffsetMetricTag - // setMsg unmarshals PatternFlowTcpDataOffsetMetricTag from protobuf object *otg.PatternFlowTcpDataOffsetMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpDataOffsetMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpDataOffsetMetricTag - // validate validates PatternFlowTcpDataOffsetMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpDataOffsetMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpDataOffsetMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpDataOffsetMetricTag - SetName(value string) PatternFlowTcpDataOffsetMetricTag - // Offset returns uint32, set in PatternFlowTcpDataOffsetMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpDataOffsetMetricTag - SetOffset(value uint32) PatternFlowTcpDataOffsetMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpDataOffsetMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpDataOffsetMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpDataOffsetMetricTag - SetLength(value uint32) PatternFlowTcpDataOffsetMetricTag - // HasLength checks if Length has been set in PatternFlowTcpDataOffsetMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpDataOffsetMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpDataOffsetMetricTag object -func (obj *patternFlowTcpDataOffsetMetricTag) SetName(value string) PatternFlowTcpDataOffsetMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpDataOffsetMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpDataOffsetMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpDataOffsetMetricTag object -func (obj *patternFlowTcpDataOffsetMetricTag) SetOffset(value uint32) PatternFlowTcpDataOffsetMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpDataOffsetMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpDataOffsetMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpDataOffsetMetricTag object -func (obj *patternFlowTcpDataOffsetMetricTag) SetLength(value uint32) PatternFlowTcpDataOffsetMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpDataOffsetMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpDataOffsetMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpDataOffsetMetricTag.Offset <= 3 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 4 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpDataOffsetMetricTag.Length <= 4 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpDataOffsetMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(4) - } - -} - -// ***** PatternFlowTcpEcnNsCounter ***** -type patternFlowTcpEcnNsCounter struct { - validation - obj *otg.PatternFlowTcpEcnNsCounter - marshaller marshalPatternFlowTcpEcnNsCounter - unMarshaller unMarshalPatternFlowTcpEcnNsCounter -} - -func NewPatternFlowTcpEcnNsCounter() PatternFlowTcpEcnNsCounter { - obj := patternFlowTcpEcnNsCounter{obj: &otg.PatternFlowTcpEcnNsCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpEcnNsCounter) msg() *otg.PatternFlowTcpEcnNsCounter { - return obj.obj -} - -func (obj *patternFlowTcpEcnNsCounter) setMsg(msg *otg.PatternFlowTcpEcnNsCounter) PatternFlowTcpEcnNsCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpEcnNsCounter struct { - obj *patternFlowTcpEcnNsCounter -} - -type marshalPatternFlowTcpEcnNsCounter interface { - // ToProto marshals PatternFlowTcpEcnNsCounter to protobuf object *otg.PatternFlowTcpEcnNsCounter - ToProto() (*otg.PatternFlowTcpEcnNsCounter, error) - // ToPbText marshals PatternFlowTcpEcnNsCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpEcnNsCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpEcnNsCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpEcnNsCounter struct { - obj *patternFlowTcpEcnNsCounter -} - -type unMarshalPatternFlowTcpEcnNsCounter interface { - // FromProto unmarshals PatternFlowTcpEcnNsCounter from protobuf object *otg.PatternFlowTcpEcnNsCounter - FromProto(msg *otg.PatternFlowTcpEcnNsCounter) (PatternFlowTcpEcnNsCounter, error) - // FromPbText unmarshals PatternFlowTcpEcnNsCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpEcnNsCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpEcnNsCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpEcnNsCounter) Marshal() marshalPatternFlowTcpEcnNsCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpEcnNsCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpEcnNsCounter) Unmarshal() unMarshalPatternFlowTcpEcnNsCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpEcnNsCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpEcnNsCounter) ToProto() (*otg.PatternFlowTcpEcnNsCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpEcnNsCounter) FromProto(msg *otg.PatternFlowTcpEcnNsCounter) (PatternFlowTcpEcnNsCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpEcnNsCounter) 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 *unMarshalpatternFlowTcpEcnNsCounter) 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 *marshalpatternFlowTcpEcnNsCounter) 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 *unMarshalpatternFlowTcpEcnNsCounter) 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 *marshalpatternFlowTcpEcnNsCounter) 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 *unMarshalpatternFlowTcpEcnNsCounter) 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 *patternFlowTcpEcnNsCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnNsCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnNsCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpEcnNsCounter) Clone() (PatternFlowTcpEcnNsCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpEcnNsCounter() - 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 -} - -// PatternFlowTcpEcnNsCounter is integer counter pattern -type PatternFlowTcpEcnNsCounter interface { - Validation - // msg marshals PatternFlowTcpEcnNsCounter to protobuf object *otg.PatternFlowTcpEcnNsCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpEcnNsCounter - // setMsg unmarshals PatternFlowTcpEcnNsCounter from protobuf object *otg.PatternFlowTcpEcnNsCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpEcnNsCounter) PatternFlowTcpEcnNsCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpEcnNsCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpEcnNsCounter - // validate validates PatternFlowTcpEcnNsCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpEcnNsCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpEcnNsCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpEcnNsCounter - SetStart(value uint32) PatternFlowTcpEcnNsCounter - // HasStart checks if Start has been set in PatternFlowTcpEcnNsCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpEcnNsCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpEcnNsCounter - SetStep(value uint32) PatternFlowTcpEcnNsCounter - // HasStep checks if Step has been set in PatternFlowTcpEcnNsCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpEcnNsCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpEcnNsCounter - SetCount(value uint32) PatternFlowTcpEcnNsCounter - // HasCount checks if Count has been set in PatternFlowTcpEcnNsCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpEcnNsCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpEcnNsCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpEcnNsCounter object -func (obj *patternFlowTcpEcnNsCounter) SetStart(value uint32) PatternFlowTcpEcnNsCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpEcnNsCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpEcnNsCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpEcnNsCounter object -func (obj *patternFlowTcpEcnNsCounter) SetStep(value uint32) PatternFlowTcpEcnNsCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpEcnNsCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpEcnNsCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpEcnNsCounter object -func (obj *patternFlowTcpEcnNsCounter) SetCount(value uint32) PatternFlowTcpEcnNsCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpEcnNsCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnNsCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnNsCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnNsCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowTcpEcnNsCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpEcnNsMetricTag ***** -type patternFlowTcpEcnNsMetricTag struct { - validation - obj *otg.PatternFlowTcpEcnNsMetricTag - marshaller marshalPatternFlowTcpEcnNsMetricTag - unMarshaller unMarshalPatternFlowTcpEcnNsMetricTag -} - -func NewPatternFlowTcpEcnNsMetricTag() PatternFlowTcpEcnNsMetricTag { - obj := patternFlowTcpEcnNsMetricTag{obj: &otg.PatternFlowTcpEcnNsMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpEcnNsMetricTag) msg() *otg.PatternFlowTcpEcnNsMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpEcnNsMetricTag) setMsg(msg *otg.PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpEcnNsMetricTag struct { - obj *patternFlowTcpEcnNsMetricTag -} - -type marshalPatternFlowTcpEcnNsMetricTag interface { - // ToProto marshals PatternFlowTcpEcnNsMetricTag to protobuf object *otg.PatternFlowTcpEcnNsMetricTag - ToProto() (*otg.PatternFlowTcpEcnNsMetricTag, error) - // ToPbText marshals PatternFlowTcpEcnNsMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpEcnNsMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpEcnNsMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpEcnNsMetricTag struct { - obj *patternFlowTcpEcnNsMetricTag -} - -type unMarshalPatternFlowTcpEcnNsMetricTag interface { - // FromProto unmarshals PatternFlowTcpEcnNsMetricTag from protobuf object *otg.PatternFlowTcpEcnNsMetricTag - FromProto(msg *otg.PatternFlowTcpEcnNsMetricTag) (PatternFlowTcpEcnNsMetricTag, error) - // FromPbText unmarshals PatternFlowTcpEcnNsMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpEcnNsMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpEcnNsMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpEcnNsMetricTag) Marshal() marshalPatternFlowTcpEcnNsMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpEcnNsMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpEcnNsMetricTag) Unmarshal() unMarshalPatternFlowTcpEcnNsMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpEcnNsMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpEcnNsMetricTag) ToProto() (*otg.PatternFlowTcpEcnNsMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpEcnNsMetricTag) FromProto(msg *otg.PatternFlowTcpEcnNsMetricTag) (PatternFlowTcpEcnNsMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpEcnNsMetricTag) 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 *unMarshalpatternFlowTcpEcnNsMetricTag) 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 *marshalpatternFlowTcpEcnNsMetricTag) 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 *unMarshalpatternFlowTcpEcnNsMetricTag) 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 *marshalpatternFlowTcpEcnNsMetricTag) 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 *unMarshalpatternFlowTcpEcnNsMetricTag) 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 *patternFlowTcpEcnNsMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnNsMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnNsMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpEcnNsMetricTag) Clone() (PatternFlowTcpEcnNsMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpEcnNsMetricTag() - 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 -} - -// PatternFlowTcpEcnNsMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpEcnNsMetricTag interface { - Validation - // msg marshals PatternFlowTcpEcnNsMetricTag to protobuf object *otg.PatternFlowTcpEcnNsMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpEcnNsMetricTag - // setMsg unmarshals PatternFlowTcpEcnNsMetricTag from protobuf object *otg.PatternFlowTcpEcnNsMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpEcnNsMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpEcnNsMetricTag - // validate validates PatternFlowTcpEcnNsMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpEcnNsMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpEcnNsMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpEcnNsMetricTag - SetName(value string) PatternFlowTcpEcnNsMetricTag - // Offset returns uint32, set in PatternFlowTcpEcnNsMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpEcnNsMetricTag - SetOffset(value uint32) PatternFlowTcpEcnNsMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpEcnNsMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpEcnNsMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpEcnNsMetricTag - SetLength(value uint32) PatternFlowTcpEcnNsMetricTag - // HasLength checks if Length has been set in PatternFlowTcpEcnNsMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpEcnNsMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpEcnNsMetricTag object -func (obj *patternFlowTcpEcnNsMetricTag) SetName(value string) PatternFlowTcpEcnNsMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpEcnNsMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpEcnNsMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpEcnNsMetricTag object -func (obj *patternFlowTcpEcnNsMetricTag) SetOffset(value uint32) PatternFlowTcpEcnNsMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpEcnNsMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpEcnNsMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpEcnNsMetricTag object -func (obj *patternFlowTcpEcnNsMetricTag) SetLength(value uint32) PatternFlowTcpEcnNsMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpEcnNsMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpEcnNsMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnNsMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpEcnNsMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpEcnNsMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowTcpEcnCwrCounter ***** -type patternFlowTcpEcnCwrCounter struct { - validation - obj *otg.PatternFlowTcpEcnCwrCounter - marshaller marshalPatternFlowTcpEcnCwrCounter - unMarshaller unMarshalPatternFlowTcpEcnCwrCounter -} - -func NewPatternFlowTcpEcnCwrCounter() PatternFlowTcpEcnCwrCounter { - obj := patternFlowTcpEcnCwrCounter{obj: &otg.PatternFlowTcpEcnCwrCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpEcnCwrCounter) msg() *otg.PatternFlowTcpEcnCwrCounter { - return obj.obj -} - -func (obj *patternFlowTcpEcnCwrCounter) setMsg(msg *otg.PatternFlowTcpEcnCwrCounter) PatternFlowTcpEcnCwrCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpEcnCwrCounter struct { - obj *patternFlowTcpEcnCwrCounter -} - -type marshalPatternFlowTcpEcnCwrCounter interface { - // ToProto marshals PatternFlowTcpEcnCwrCounter to protobuf object *otg.PatternFlowTcpEcnCwrCounter - ToProto() (*otg.PatternFlowTcpEcnCwrCounter, error) - // ToPbText marshals PatternFlowTcpEcnCwrCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpEcnCwrCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpEcnCwrCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpEcnCwrCounter struct { - obj *patternFlowTcpEcnCwrCounter -} - -type unMarshalPatternFlowTcpEcnCwrCounter interface { - // FromProto unmarshals PatternFlowTcpEcnCwrCounter from protobuf object *otg.PatternFlowTcpEcnCwrCounter - FromProto(msg *otg.PatternFlowTcpEcnCwrCounter) (PatternFlowTcpEcnCwrCounter, error) - // FromPbText unmarshals PatternFlowTcpEcnCwrCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpEcnCwrCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpEcnCwrCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpEcnCwrCounter) Marshal() marshalPatternFlowTcpEcnCwrCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpEcnCwrCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpEcnCwrCounter) Unmarshal() unMarshalPatternFlowTcpEcnCwrCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpEcnCwrCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpEcnCwrCounter) ToProto() (*otg.PatternFlowTcpEcnCwrCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpEcnCwrCounter) FromProto(msg *otg.PatternFlowTcpEcnCwrCounter) (PatternFlowTcpEcnCwrCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpEcnCwrCounter) 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 *unMarshalpatternFlowTcpEcnCwrCounter) 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 *marshalpatternFlowTcpEcnCwrCounter) 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 *unMarshalpatternFlowTcpEcnCwrCounter) 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 *marshalpatternFlowTcpEcnCwrCounter) 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 *unMarshalpatternFlowTcpEcnCwrCounter) 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 *patternFlowTcpEcnCwrCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnCwrCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnCwrCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpEcnCwrCounter) Clone() (PatternFlowTcpEcnCwrCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpEcnCwrCounter() - 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 -} - -// PatternFlowTcpEcnCwrCounter is integer counter pattern -type PatternFlowTcpEcnCwrCounter interface { - Validation - // msg marshals PatternFlowTcpEcnCwrCounter to protobuf object *otg.PatternFlowTcpEcnCwrCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpEcnCwrCounter - // setMsg unmarshals PatternFlowTcpEcnCwrCounter from protobuf object *otg.PatternFlowTcpEcnCwrCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpEcnCwrCounter) PatternFlowTcpEcnCwrCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpEcnCwrCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpEcnCwrCounter - // validate validates PatternFlowTcpEcnCwrCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpEcnCwrCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpEcnCwrCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpEcnCwrCounter - SetStart(value uint32) PatternFlowTcpEcnCwrCounter - // HasStart checks if Start has been set in PatternFlowTcpEcnCwrCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpEcnCwrCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpEcnCwrCounter - SetStep(value uint32) PatternFlowTcpEcnCwrCounter - // HasStep checks if Step has been set in PatternFlowTcpEcnCwrCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpEcnCwrCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpEcnCwrCounter - SetCount(value uint32) PatternFlowTcpEcnCwrCounter - // HasCount checks if Count has been set in PatternFlowTcpEcnCwrCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpEcnCwrCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpEcnCwrCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpEcnCwrCounter object -func (obj *patternFlowTcpEcnCwrCounter) SetStart(value uint32) PatternFlowTcpEcnCwrCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpEcnCwrCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpEcnCwrCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpEcnCwrCounter object -func (obj *patternFlowTcpEcnCwrCounter) SetStep(value uint32) PatternFlowTcpEcnCwrCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpEcnCwrCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpEcnCwrCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpEcnCwrCounter object -func (obj *patternFlowTcpEcnCwrCounter) SetCount(value uint32) PatternFlowTcpEcnCwrCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpEcnCwrCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnCwrCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnCwrCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnCwrCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowTcpEcnCwrCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpEcnCwrMetricTag ***** -type patternFlowTcpEcnCwrMetricTag struct { - validation - obj *otg.PatternFlowTcpEcnCwrMetricTag - marshaller marshalPatternFlowTcpEcnCwrMetricTag - unMarshaller unMarshalPatternFlowTcpEcnCwrMetricTag -} - -func NewPatternFlowTcpEcnCwrMetricTag() PatternFlowTcpEcnCwrMetricTag { - obj := patternFlowTcpEcnCwrMetricTag{obj: &otg.PatternFlowTcpEcnCwrMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpEcnCwrMetricTag) msg() *otg.PatternFlowTcpEcnCwrMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpEcnCwrMetricTag) setMsg(msg *otg.PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpEcnCwrMetricTag struct { - obj *patternFlowTcpEcnCwrMetricTag -} - -type marshalPatternFlowTcpEcnCwrMetricTag interface { - // ToProto marshals PatternFlowTcpEcnCwrMetricTag to protobuf object *otg.PatternFlowTcpEcnCwrMetricTag - ToProto() (*otg.PatternFlowTcpEcnCwrMetricTag, error) - // ToPbText marshals PatternFlowTcpEcnCwrMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpEcnCwrMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpEcnCwrMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpEcnCwrMetricTag struct { - obj *patternFlowTcpEcnCwrMetricTag -} - -type unMarshalPatternFlowTcpEcnCwrMetricTag interface { - // FromProto unmarshals PatternFlowTcpEcnCwrMetricTag from protobuf object *otg.PatternFlowTcpEcnCwrMetricTag - FromProto(msg *otg.PatternFlowTcpEcnCwrMetricTag) (PatternFlowTcpEcnCwrMetricTag, error) - // FromPbText unmarshals PatternFlowTcpEcnCwrMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpEcnCwrMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpEcnCwrMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpEcnCwrMetricTag) Marshal() marshalPatternFlowTcpEcnCwrMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpEcnCwrMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpEcnCwrMetricTag) Unmarshal() unMarshalPatternFlowTcpEcnCwrMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpEcnCwrMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpEcnCwrMetricTag) ToProto() (*otg.PatternFlowTcpEcnCwrMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpEcnCwrMetricTag) FromProto(msg *otg.PatternFlowTcpEcnCwrMetricTag) (PatternFlowTcpEcnCwrMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpEcnCwrMetricTag) 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 *unMarshalpatternFlowTcpEcnCwrMetricTag) 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 *marshalpatternFlowTcpEcnCwrMetricTag) 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 *unMarshalpatternFlowTcpEcnCwrMetricTag) 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 *marshalpatternFlowTcpEcnCwrMetricTag) 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 *unMarshalpatternFlowTcpEcnCwrMetricTag) 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 *patternFlowTcpEcnCwrMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnCwrMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnCwrMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpEcnCwrMetricTag) Clone() (PatternFlowTcpEcnCwrMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpEcnCwrMetricTag() - 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 -} - -// PatternFlowTcpEcnCwrMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpEcnCwrMetricTag interface { - Validation - // msg marshals PatternFlowTcpEcnCwrMetricTag to protobuf object *otg.PatternFlowTcpEcnCwrMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpEcnCwrMetricTag - // setMsg unmarshals PatternFlowTcpEcnCwrMetricTag from protobuf object *otg.PatternFlowTcpEcnCwrMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpEcnCwrMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpEcnCwrMetricTag - // validate validates PatternFlowTcpEcnCwrMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpEcnCwrMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpEcnCwrMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpEcnCwrMetricTag - SetName(value string) PatternFlowTcpEcnCwrMetricTag - // Offset returns uint32, set in PatternFlowTcpEcnCwrMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpEcnCwrMetricTag - SetOffset(value uint32) PatternFlowTcpEcnCwrMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpEcnCwrMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpEcnCwrMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpEcnCwrMetricTag - SetLength(value uint32) PatternFlowTcpEcnCwrMetricTag - // HasLength checks if Length has been set in PatternFlowTcpEcnCwrMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpEcnCwrMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpEcnCwrMetricTag object -func (obj *patternFlowTcpEcnCwrMetricTag) SetName(value string) PatternFlowTcpEcnCwrMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpEcnCwrMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpEcnCwrMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpEcnCwrMetricTag object -func (obj *patternFlowTcpEcnCwrMetricTag) SetOffset(value uint32) PatternFlowTcpEcnCwrMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpEcnCwrMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpEcnCwrMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpEcnCwrMetricTag object -func (obj *patternFlowTcpEcnCwrMetricTag) SetLength(value uint32) PatternFlowTcpEcnCwrMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpEcnCwrMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpEcnCwrMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnCwrMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpEcnCwrMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpEcnCwrMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowTcpEcnEchoCounter ***** -type patternFlowTcpEcnEchoCounter struct { - validation - obj *otg.PatternFlowTcpEcnEchoCounter - marshaller marshalPatternFlowTcpEcnEchoCounter - unMarshaller unMarshalPatternFlowTcpEcnEchoCounter -} - -func NewPatternFlowTcpEcnEchoCounter() PatternFlowTcpEcnEchoCounter { - obj := patternFlowTcpEcnEchoCounter{obj: &otg.PatternFlowTcpEcnEchoCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpEcnEchoCounter) msg() *otg.PatternFlowTcpEcnEchoCounter { - return obj.obj -} - -func (obj *patternFlowTcpEcnEchoCounter) setMsg(msg *otg.PatternFlowTcpEcnEchoCounter) PatternFlowTcpEcnEchoCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpEcnEchoCounter struct { - obj *patternFlowTcpEcnEchoCounter -} - -type marshalPatternFlowTcpEcnEchoCounter interface { - // ToProto marshals PatternFlowTcpEcnEchoCounter to protobuf object *otg.PatternFlowTcpEcnEchoCounter - ToProto() (*otg.PatternFlowTcpEcnEchoCounter, error) - // ToPbText marshals PatternFlowTcpEcnEchoCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpEcnEchoCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpEcnEchoCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpEcnEchoCounter struct { - obj *patternFlowTcpEcnEchoCounter -} - -type unMarshalPatternFlowTcpEcnEchoCounter interface { - // FromProto unmarshals PatternFlowTcpEcnEchoCounter from protobuf object *otg.PatternFlowTcpEcnEchoCounter - FromProto(msg *otg.PatternFlowTcpEcnEchoCounter) (PatternFlowTcpEcnEchoCounter, error) - // FromPbText unmarshals PatternFlowTcpEcnEchoCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpEcnEchoCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpEcnEchoCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpEcnEchoCounter) Marshal() marshalPatternFlowTcpEcnEchoCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpEcnEchoCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpEcnEchoCounter) Unmarshal() unMarshalPatternFlowTcpEcnEchoCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpEcnEchoCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpEcnEchoCounter) ToProto() (*otg.PatternFlowTcpEcnEchoCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpEcnEchoCounter) FromProto(msg *otg.PatternFlowTcpEcnEchoCounter) (PatternFlowTcpEcnEchoCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpEcnEchoCounter) 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 *unMarshalpatternFlowTcpEcnEchoCounter) 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 *marshalpatternFlowTcpEcnEchoCounter) 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 *unMarshalpatternFlowTcpEcnEchoCounter) 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 *marshalpatternFlowTcpEcnEchoCounter) 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 *unMarshalpatternFlowTcpEcnEchoCounter) 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 *patternFlowTcpEcnEchoCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnEchoCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnEchoCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpEcnEchoCounter) Clone() (PatternFlowTcpEcnEchoCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpEcnEchoCounter() - 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 -} - -// PatternFlowTcpEcnEchoCounter is integer counter pattern -type PatternFlowTcpEcnEchoCounter interface { - Validation - // msg marshals PatternFlowTcpEcnEchoCounter to protobuf object *otg.PatternFlowTcpEcnEchoCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpEcnEchoCounter - // setMsg unmarshals PatternFlowTcpEcnEchoCounter from protobuf object *otg.PatternFlowTcpEcnEchoCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpEcnEchoCounter) PatternFlowTcpEcnEchoCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpEcnEchoCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpEcnEchoCounter - // validate validates PatternFlowTcpEcnEchoCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpEcnEchoCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpEcnEchoCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpEcnEchoCounter - SetStart(value uint32) PatternFlowTcpEcnEchoCounter - // HasStart checks if Start has been set in PatternFlowTcpEcnEchoCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpEcnEchoCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpEcnEchoCounter - SetStep(value uint32) PatternFlowTcpEcnEchoCounter - // HasStep checks if Step has been set in PatternFlowTcpEcnEchoCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpEcnEchoCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpEcnEchoCounter - SetCount(value uint32) PatternFlowTcpEcnEchoCounter - // HasCount checks if Count has been set in PatternFlowTcpEcnEchoCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpEcnEchoCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpEcnEchoCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpEcnEchoCounter object -func (obj *patternFlowTcpEcnEchoCounter) SetStart(value uint32) PatternFlowTcpEcnEchoCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpEcnEchoCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpEcnEchoCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpEcnEchoCounter object -func (obj *patternFlowTcpEcnEchoCounter) SetStep(value uint32) PatternFlowTcpEcnEchoCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpEcnEchoCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpEcnEchoCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpEcnEchoCounter object -func (obj *patternFlowTcpEcnEchoCounter) SetCount(value uint32) PatternFlowTcpEcnEchoCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpEcnEchoCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnEchoCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnEchoCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnEchoCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowTcpEcnEchoCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpEcnEchoMetricTag ***** -type patternFlowTcpEcnEchoMetricTag struct { - validation - obj *otg.PatternFlowTcpEcnEchoMetricTag - marshaller marshalPatternFlowTcpEcnEchoMetricTag - unMarshaller unMarshalPatternFlowTcpEcnEchoMetricTag -} - -func NewPatternFlowTcpEcnEchoMetricTag() PatternFlowTcpEcnEchoMetricTag { - obj := patternFlowTcpEcnEchoMetricTag{obj: &otg.PatternFlowTcpEcnEchoMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpEcnEchoMetricTag) msg() *otg.PatternFlowTcpEcnEchoMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpEcnEchoMetricTag) setMsg(msg *otg.PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpEcnEchoMetricTag struct { - obj *patternFlowTcpEcnEchoMetricTag -} - -type marshalPatternFlowTcpEcnEchoMetricTag interface { - // ToProto marshals PatternFlowTcpEcnEchoMetricTag to protobuf object *otg.PatternFlowTcpEcnEchoMetricTag - ToProto() (*otg.PatternFlowTcpEcnEchoMetricTag, error) - // ToPbText marshals PatternFlowTcpEcnEchoMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpEcnEchoMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpEcnEchoMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpEcnEchoMetricTag struct { - obj *patternFlowTcpEcnEchoMetricTag -} - -type unMarshalPatternFlowTcpEcnEchoMetricTag interface { - // FromProto unmarshals PatternFlowTcpEcnEchoMetricTag from protobuf object *otg.PatternFlowTcpEcnEchoMetricTag - FromProto(msg *otg.PatternFlowTcpEcnEchoMetricTag) (PatternFlowTcpEcnEchoMetricTag, error) - // FromPbText unmarshals PatternFlowTcpEcnEchoMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpEcnEchoMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpEcnEchoMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpEcnEchoMetricTag) Marshal() marshalPatternFlowTcpEcnEchoMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpEcnEchoMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpEcnEchoMetricTag) Unmarshal() unMarshalPatternFlowTcpEcnEchoMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpEcnEchoMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpEcnEchoMetricTag) ToProto() (*otg.PatternFlowTcpEcnEchoMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpEcnEchoMetricTag) FromProto(msg *otg.PatternFlowTcpEcnEchoMetricTag) (PatternFlowTcpEcnEchoMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpEcnEchoMetricTag) 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 *unMarshalpatternFlowTcpEcnEchoMetricTag) 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 *marshalpatternFlowTcpEcnEchoMetricTag) 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 *unMarshalpatternFlowTcpEcnEchoMetricTag) 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 *marshalpatternFlowTcpEcnEchoMetricTag) 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 *unMarshalpatternFlowTcpEcnEchoMetricTag) 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 *patternFlowTcpEcnEchoMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnEchoMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpEcnEchoMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpEcnEchoMetricTag) Clone() (PatternFlowTcpEcnEchoMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpEcnEchoMetricTag() - 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 -} - -// PatternFlowTcpEcnEchoMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpEcnEchoMetricTag interface { - Validation - // msg marshals PatternFlowTcpEcnEchoMetricTag to protobuf object *otg.PatternFlowTcpEcnEchoMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpEcnEchoMetricTag - // setMsg unmarshals PatternFlowTcpEcnEchoMetricTag from protobuf object *otg.PatternFlowTcpEcnEchoMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpEcnEchoMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpEcnEchoMetricTag - // validate validates PatternFlowTcpEcnEchoMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpEcnEchoMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpEcnEchoMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpEcnEchoMetricTag - SetName(value string) PatternFlowTcpEcnEchoMetricTag - // Offset returns uint32, set in PatternFlowTcpEcnEchoMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpEcnEchoMetricTag - SetOffset(value uint32) PatternFlowTcpEcnEchoMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpEcnEchoMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpEcnEchoMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpEcnEchoMetricTag - SetLength(value uint32) PatternFlowTcpEcnEchoMetricTag - // HasLength checks if Length has been set in PatternFlowTcpEcnEchoMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpEcnEchoMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpEcnEchoMetricTag object -func (obj *patternFlowTcpEcnEchoMetricTag) SetName(value string) PatternFlowTcpEcnEchoMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpEcnEchoMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpEcnEchoMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpEcnEchoMetricTag object -func (obj *patternFlowTcpEcnEchoMetricTag) SetOffset(value uint32) PatternFlowTcpEcnEchoMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpEcnEchoMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpEcnEchoMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpEcnEchoMetricTag object -func (obj *patternFlowTcpEcnEchoMetricTag) SetLength(value uint32) PatternFlowTcpEcnEchoMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpEcnEchoMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpEcnEchoMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpEcnEchoMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpEcnEchoMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpEcnEchoMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowTcpCtlUrgCounter ***** -type patternFlowTcpCtlUrgCounter struct { - validation - obj *otg.PatternFlowTcpCtlUrgCounter - marshaller marshalPatternFlowTcpCtlUrgCounter - unMarshaller unMarshalPatternFlowTcpCtlUrgCounter -} - -func NewPatternFlowTcpCtlUrgCounter() PatternFlowTcpCtlUrgCounter { - obj := patternFlowTcpCtlUrgCounter{obj: &otg.PatternFlowTcpCtlUrgCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlUrgCounter) msg() *otg.PatternFlowTcpCtlUrgCounter { - return obj.obj -} - -func (obj *patternFlowTcpCtlUrgCounter) setMsg(msg *otg.PatternFlowTcpCtlUrgCounter) PatternFlowTcpCtlUrgCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlUrgCounter struct { - obj *patternFlowTcpCtlUrgCounter -} - -type marshalPatternFlowTcpCtlUrgCounter interface { - // ToProto marshals PatternFlowTcpCtlUrgCounter to protobuf object *otg.PatternFlowTcpCtlUrgCounter - ToProto() (*otg.PatternFlowTcpCtlUrgCounter, error) - // ToPbText marshals PatternFlowTcpCtlUrgCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlUrgCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlUrgCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlUrgCounter struct { - obj *patternFlowTcpCtlUrgCounter -} - -type unMarshalPatternFlowTcpCtlUrgCounter interface { - // FromProto unmarshals PatternFlowTcpCtlUrgCounter from protobuf object *otg.PatternFlowTcpCtlUrgCounter - FromProto(msg *otg.PatternFlowTcpCtlUrgCounter) (PatternFlowTcpCtlUrgCounter, error) - // FromPbText unmarshals PatternFlowTcpCtlUrgCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlUrgCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlUrgCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlUrgCounter) Marshal() marshalPatternFlowTcpCtlUrgCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlUrgCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlUrgCounter) Unmarshal() unMarshalPatternFlowTcpCtlUrgCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlUrgCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlUrgCounter) ToProto() (*otg.PatternFlowTcpCtlUrgCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlUrgCounter) FromProto(msg *otg.PatternFlowTcpCtlUrgCounter) (PatternFlowTcpCtlUrgCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlUrgCounter) 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 *unMarshalpatternFlowTcpCtlUrgCounter) 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 *marshalpatternFlowTcpCtlUrgCounter) 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 *unMarshalpatternFlowTcpCtlUrgCounter) 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 *marshalpatternFlowTcpCtlUrgCounter) 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 *unMarshalpatternFlowTcpCtlUrgCounter) 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 *patternFlowTcpCtlUrgCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlUrgCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlUrgCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlUrgCounter) Clone() (PatternFlowTcpCtlUrgCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlUrgCounter() - 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 -} - -// PatternFlowTcpCtlUrgCounter is integer counter pattern -type PatternFlowTcpCtlUrgCounter interface { - Validation - // msg marshals PatternFlowTcpCtlUrgCounter to protobuf object *otg.PatternFlowTcpCtlUrgCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlUrgCounter - // setMsg unmarshals PatternFlowTcpCtlUrgCounter from protobuf object *otg.PatternFlowTcpCtlUrgCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlUrgCounter) PatternFlowTcpCtlUrgCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlUrgCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlUrgCounter - // validate validates PatternFlowTcpCtlUrgCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlUrgCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpCtlUrgCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpCtlUrgCounter - SetStart(value uint32) PatternFlowTcpCtlUrgCounter - // HasStart checks if Start has been set in PatternFlowTcpCtlUrgCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpCtlUrgCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpCtlUrgCounter - SetStep(value uint32) PatternFlowTcpCtlUrgCounter - // HasStep checks if Step has been set in PatternFlowTcpCtlUrgCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpCtlUrgCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpCtlUrgCounter - SetCount(value uint32) PatternFlowTcpCtlUrgCounter - // HasCount checks if Count has been set in PatternFlowTcpCtlUrgCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpCtlUrgCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpCtlUrgCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpCtlUrgCounter object -func (obj *patternFlowTcpCtlUrgCounter) SetStart(value uint32) PatternFlowTcpCtlUrgCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpCtlUrgCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpCtlUrgCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpCtlUrgCounter object -func (obj *patternFlowTcpCtlUrgCounter) SetStep(value uint32) PatternFlowTcpCtlUrgCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpCtlUrgCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpCtlUrgCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpCtlUrgCounter object -func (obj *patternFlowTcpCtlUrgCounter) SetCount(value uint32) PatternFlowTcpCtlUrgCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpCtlUrgCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlUrgCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlUrgCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlUrgCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowTcpCtlUrgCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpCtlUrgMetricTag ***** -type patternFlowTcpCtlUrgMetricTag struct { - validation - obj *otg.PatternFlowTcpCtlUrgMetricTag - marshaller marshalPatternFlowTcpCtlUrgMetricTag - unMarshaller unMarshalPatternFlowTcpCtlUrgMetricTag -} - -func NewPatternFlowTcpCtlUrgMetricTag() PatternFlowTcpCtlUrgMetricTag { - obj := patternFlowTcpCtlUrgMetricTag{obj: &otg.PatternFlowTcpCtlUrgMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlUrgMetricTag) msg() *otg.PatternFlowTcpCtlUrgMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpCtlUrgMetricTag) setMsg(msg *otg.PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlUrgMetricTag struct { - obj *patternFlowTcpCtlUrgMetricTag -} - -type marshalPatternFlowTcpCtlUrgMetricTag interface { - // ToProto marshals PatternFlowTcpCtlUrgMetricTag to protobuf object *otg.PatternFlowTcpCtlUrgMetricTag - ToProto() (*otg.PatternFlowTcpCtlUrgMetricTag, error) - // ToPbText marshals PatternFlowTcpCtlUrgMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlUrgMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlUrgMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlUrgMetricTag struct { - obj *patternFlowTcpCtlUrgMetricTag -} - -type unMarshalPatternFlowTcpCtlUrgMetricTag interface { - // FromProto unmarshals PatternFlowTcpCtlUrgMetricTag from protobuf object *otg.PatternFlowTcpCtlUrgMetricTag - FromProto(msg *otg.PatternFlowTcpCtlUrgMetricTag) (PatternFlowTcpCtlUrgMetricTag, error) - // FromPbText unmarshals PatternFlowTcpCtlUrgMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlUrgMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlUrgMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlUrgMetricTag) Marshal() marshalPatternFlowTcpCtlUrgMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlUrgMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlUrgMetricTag) Unmarshal() unMarshalPatternFlowTcpCtlUrgMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlUrgMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlUrgMetricTag) ToProto() (*otg.PatternFlowTcpCtlUrgMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlUrgMetricTag) FromProto(msg *otg.PatternFlowTcpCtlUrgMetricTag) (PatternFlowTcpCtlUrgMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlUrgMetricTag) 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 *unMarshalpatternFlowTcpCtlUrgMetricTag) 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 *marshalpatternFlowTcpCtlUrgMetricTag) 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 *unMarshalpatternFlowTcpCtlUrgMetricTag) 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 *marshalpatternFlowTcpCtlUrgMetricTag) 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 *unMarshalpatternFlowTcpCtlUrgMetricTag) 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 *patternFlowTcpCtlUrgMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlUrgMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlUrgMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlUrgMetricTag) Clone() (PatternFlowTcpCtlUrgMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlUrgMetricTag() - 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 -} - -// PatternFlowTcpCtlUrgMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpCtlUrgMetricTag interface { - Validation - // msg marshals PatternFlowTcpCtlUrgMetricTag to protobuf object *otg.PatternFlowTcpCtlUrgMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlUrgMetricTag - // setMsg unmarshals PatternFlowTcpCtlUrgMetricTag from protobuf object *otg.PatternFlowTcpCtlUrgMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlUrgMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlUrgMetricTag - // validate validates PatternFlowTcpCtlUrgMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlUrgMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpCtlUrgMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpCtlUrgMetricTag - SetName(value string) PatternFlowTcpCtlUrgMetricTag - // Offset returns uint32, set in PatternFlowTcpCtlUrgMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpCtlUrgMetricTag - SetOffset(value uint32) PatternFlowTcpCtlUrgMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpCtlUrgMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpCtlUrgMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpCtlUrgMetricTag - SetLength(value uint32) PatternFlowTcpCtlUrgMetricTag - // HasLength checks if Length has been set in PatternFlowTcpCtlUrgMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpCtlUrgMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpCtlUrgMetricTag object -func (obj *patternFlowTcpCtlUrgMetricTag) SetName(value string) PatternFlowTcpCtlUrgMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpCtlUrgMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpCtlUrgMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpCtlUrgMetricTag object -func (obj *patternFlowTcpCtlUrgMetricTag) SetOffset(value uint32) PatternFlowTcpCtlUrgMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpCtlUrgMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpCtlUrgMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpCtlUrgMetricTag object -func (obj *patternFlowTcpCtlUrgMetricTag) SetLength(value uint32) PatternFlowTcpCtlUrgMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpCtlUrgMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpCtlUrgMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlUrgMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpCtlUrgMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpCtlUrgMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowTcpCtlAckCounter ***** -type patternFlowTcpCtlAckCounter struct { - validation - obj *otg.PatternFlowTcpCtlAckCounter - marshaller marshalPatternFlowTcpCtlAckCounter - unMarshaller unMarshalPatternFlowTcpCtlAckCounter -} - -func NewPatternFlowTcpCtlAckCounter() PatternFlowTcpCtlAckCounter { - obj := patternFlowTcpCtlAckCounter{obj: &otg.PatternFlowTcpCtlAckCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlAckCounter) msg() *otg.PatternFlowTcpCtlAckCounter { - return obj.obj -} - -func (obj *patternFlowTcpCtlAckCounter) setMsg(msg *otg.PatternFlowTcpCtlAckCounter) PatternFlowTcpCtlAckCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlAckCounter struct { - obj *patternFlowTcpCtlAckCounter -} - -type marshalPatternFlowTcpCtlAckCounter interface { - // ToProto marshals PatternFlowTcpCtlAckCounter to protobuf object *otg.PatternFlowTcpCtlAckCounter - ToProto() (*otg.PatternFlowTcpCtlAckCounter, error) - // ToPbText marshals PatternFlowTcpCtlAckCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlAckCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlAckCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlAckCounter struct { - obj *patternFlowTcpCtlAckCounter -} - -type unMarshalPatternFlowTcpCtlAckCounter interface { - // FromProto unmarshals PatternFlowTcpCtlAckCounter from protobuf object *otg.PatternFlowTcpCtlAckCounter - FromProto(msg *otg.PatternFlowTcpCtlAckCounter) (PatternFlowTcpCtlAckCounter, error) - // FromPbText unmarshals PatternFlowTcpCtlAckCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlAckCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlAckCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlAckCounter) Marshal() marshalPatternFlowTcpCtlAckCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlAckCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlAckCounter) Unmarshal() unMarshalPatternFlowTcpCtlAckCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlAckCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlAckCounter) ToProto() (*otg.PatternFlowTcpCtlAckCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlAckCounter) FromProto(msg *otg.PatternFlowTcpCtlAckCounter) (PatternFlowTcpCtlAckCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlAckCounter) 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 *unMarshalpatternFlowTcpCtlAckCounter) 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 *marshalpatternFlowTcpCtlAckCounter) 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 *unMarshalpatternFlowTcpCtlAckCounter) 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 *marshalpatternFlowTcpCtlAckCounter) 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 *unMarshalpatternFlowTcpCtlAckCounter) 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 *patternFlowTcpCtlAckCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlAckCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlAckCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlAckCounter) Clone() (PatternFlowTcpCtlAckCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlAckCounter() - 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 -} - -// PatternFlowTcpCtlAckCounter is integer counter pattern -type PatternFlowTcpCtlAckCounter interface { - Validation - // msg marshals PatternFlowTcpCtlAckCounter to protobuf object *otg.PatternFlowTcpCtlAckCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlAckCounter - // setMsg unmarshals PatternFlowTcpCtlAckCounter from protobuf object *otg.PatternFlowTcpCtlAckCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlAckCounter) PatternFlowTcpCtlAckCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlAckCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlAckCounter - // validate validates PatternFlowTcpCtlAckCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlAckCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpCtlAckCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpCtlAckCounter - SetStart(value uint32) PatternFlowTcpCtlAckCounter - // HasStart checks if Start has been set in PatternFlowTcpCtlAckCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpCtlAckCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpCtlAckCounter - SetStep(value uint32) PatternFlowTcpCtlAckCounter - // HasStep checks if Step has been set in PatternFlowTcpCtlAckCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpCtlAckCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpCtlAckCounter - SetCount(value uint32) PatternFlowTcpCtlAckCounter - // HasCount checks if Count has been set in PatternFlowTcpCtlAckCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpCtlAckCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpCtlAckCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpCtlAckCounter object -func (obj *patternFlowTcpCtlAckCounter) SetStart(value uint32) PatternFlowTcpCtlAckCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpCtlAckCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpCtlAckCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpCtlAckCounter object -func (obj *patternFlowTcpCtlAckCounter) SetStep(value uint32) PatternFlowTcpCtlAckCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpCtlAckCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpCtlAckCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpCtlAckCounter object -func (obj *patternFlowTcpCtlAckCounter) SetCount(value uint32) PatternFlowTcpCtlAckCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpCtlAckCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlAckCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlAckCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlAckCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowTcpCtlAckCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpCtlAckMetricTag ***** -type patternFlowTcpCtlAckMetricTag struct { - validation - obj *otg.PatternFlowTcpCtlAckMetricTag - marshaller marshalPatternFlowTcpCtlAckMetricTag - unMarshaller unMarshalPatternFlowTcpCtlAckMetricTag -} - -func NewPatternFlowTcpCtlAckMetricTag() PatternFlowTcpCtlAckMetricTag { - obj := patternFlowTcpCtlAckMetricTag{obj: &otg.PatternFlowTcpCtlAckMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlAckMetricTag) msg() *otg.PatternFlowTcpCtlAckMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpCtlAckMetricTag) setMsg(msg *otg.PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlAckMetricTag struct { - obj *patternFlowTcpCtlAckMetricTag -} - -type marshalPatternFlowTcpCtlAckMetricTag interface { - // ToProto marshals PatternFlowTcpCtlAckMetricTag to protobuf object *otg.PatternFlowTcpCtlAckMetricTag - ToProto() (*otg.PatternFlowTcpCtlAckMetricTag, error) - // ToPbText marshals PatternFlowTcpCtlAckMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlAckMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlAckMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlAckMetricTag struct { - obj *patternFlowTcpCtlAckMetricTag -} - -type unMarshalPatternFlowTcpCtlAckMetricTag interface { - // FromProto unmarshals PatternFlowTcpCtlAckMetricTag from protobuf object *otg.PatternFlowTcpCtlAckMetricTag - FromProto(msg *otg.PatternFlowTcpCtlAckMetricTag) (PatternFlowTcpCtlAckMetricTag, error) - // FromPbText unmarshals PatternFlowTcpCtlAckMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlAckMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlAckMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlAckMetricTag) Marshal() marshalPatternFlowTcpCtlAckMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlAckMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlAckMetricTag) Unmarshal() unMarshalPatternFlowTcpCtlAckMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlAckMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlAckMetricTag) ToProto() (*otg.PatternFlowTcpCtlAckMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlAckMetricTag) FromProto(msg *otg.PatternFlowTcpCtlAckMetricTag) (PatternFlowTcpCtlAckMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlAckMetricTag) 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 *unMarshalpatternFlowTcpCtlAckMetricTag) 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 *marshalpatternFlowTcpCtlAckMetricTag) 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 *unMarshalpatternFlowTcpCtlAckMetricTag) 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 *marshalpatternFlowTcpCtlAckMetricTag) 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 *unMarshalpatternFlowTcpCtlAckMetricTag) 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 *patternFlowTcpCtlAckMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlAckMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlAckMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlAckMetricTag) Clone() (PatternFlowTcpCtlAckMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlAckMetricTag() - 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 -} - -// PatternFlowTcpCtlAckMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpCtlAckMetricTag interface { - Validation - // msg marshals PatternFlowTcpCtlAckMetricTag to protobuf object *otg.PatternFlowTcpCtlAckMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlAckMetricTag - // setMsg unmarshals PatternFlowTcpCtlAckMetricTag from protobuf object *otg.PatternFlowTcpCtlAckMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlAckMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlAckMetricTag - // validate validates PatternFlowTcpCtlAckMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlAckMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpCtlAckMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpCtlAckMetricTag - SetName(value string) PatternFlowTcpCtlAckMetricTag - // Offset returns uint32, set in PatternFlowTcpCtlAckMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpCtlAckMetricTag - SetOffset(value uint32) PatternFlowTcpCtlAckMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpCtlAckMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpCtlAckMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpCtlAckMetricTag - SetLength(value uint32) PatternFlowTcpCtlAckMetricTag - // HasLength checks if Length has been set in PatternFlowTcpCtlAckMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpCtlAckMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpCtlAckMetricTag object -func (obj *patternFlowTcpCtlAckMetricTag) SetName(value string) PatternFlowTcpCtlAckMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpCtlAckMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpCtlAckMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpCtlAckMetricTag object -func (obj *patternFlowTcpCtlAckMetricTag) SetOffset(value uint32) PatternFlowTcpCtlAckMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpCtlAckMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpCtlAckMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpCtlAckMetricTag object -func (obj *patternFlowTcpCtlAckMetricTag) SetLength(value uint32) PatternFlowTcpCtlAckMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpCtlAckMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpCtlAckMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlAckMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpCtlAckMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpCtlAckMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowTcpCtlPshCounter ***** -type patternFlowTcpCtlPshCounter struct { - validation - obj *otg.PatternFlowTcpCtlPshCounter - marshaller marshalPatternFlowTcpCtlPshCounter - unMarshaller unMarshalPatternFlowTcpCtlPshCounter -} - -func NewPatternFlowTcpCtlPshCounter() PatternFlowTcpCtlPshCounter { - obj := patternFlowTcpCtlPshCounter{obj: &otg.PatternFlowTcpCtlPshCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlPshCounter) msg() *otg.PatternFlowTcpCtlPshCounter { - return obj.obj -} - -func (obj *patternFlowTcpCtlPshCounter) setMsg(msg *otg.PatternFlowTcpCtlPshCounter) PatternFlowTcpCtlPshCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlPshCounter struct { - obj *patternFlowTcpCtlPshCounter -} - -type marshalPatternFlowTcpCtlPshCounter interface { - // ToProto marshals PatternFlowTcpCtlPshCounter to protobuf object *otg.PatternFlowTcpCtlPshCounter - ToProto() (*otg.PatternFlowTcpCtlPshCounter, error) - // ToPbText marshals PatternFlowTcpCtlPshCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlPshCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlPshCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlPshCounter struct { - obj *patternFlowTcpCtlPshCounter -} - -type unMarshalPatternFlowTcpCtlPshCounter interface { - // FromProto unmarshals PatternFlowTcpCtlPshCounter from protobuf object *otg.PatternFlowTcpCtlPshCounter - FromProto(msg *otg.PatternFlowTcpCtlPshCounter) (PatternFlowTcpCtlPshCounter, error) - // FromPbText unmarshals PatternFlowTcpCtlPshCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlPshCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlPshCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlPshCounter) Marshal() marshalPatternFlowTcpCtlPshCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlPshCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlPshCounter) Unmarshal() unMarshalPatternFlowTcpCtlPshCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlPshCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlPshCounter) ToProto() (*otg.PatternFlowTcpCtlPshCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlPshCounter) FromProto(msg *otg.PatternFlowTcpCtlPshCounter) (PatternFlowTcpCtlPshCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlPshCounter) 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 *unMarshalpatternFlowTcpCtlPshCounter) 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 *marshalpatternFlowTcpCtlPshCounter) 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 *unMarshalpatternFlowTcpCtlPshCounter) 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 *marshalpatternFlowTcpCtlPshCounter) 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 *unMarshalpatternFlowTcpCtlPshCounter) 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 *patternFlowTcpCtlPshCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlPshCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlPshCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlPshCounter) Clone() (PatternFlowTcpCtlPshCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlPshCounter() - 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 -} - -// PatternFlowTcpCtlPshCounter is integer counter pattern -type PatternFlowTcpCtlPshCounter interface { - Validation - // msg marshals PatternFlowTcpCtlPshCounter to protobuf object *otg.PatternFlowTcpCtlPshCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlPshCounter - // setMsg unmarshals PatternFlowTcpCtlPshCounter from protobuf object *otg.PatternFlowTcpCtlPshCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlPshCounter) PatternFlowTcpCtlPshCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlPshCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlPshCounter - // validate validates PatternFlowTcpCtlPshCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlPshCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpCtlPshCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpCtlPshCounter - SetStart(value uint32) PatternFlowTcpCtlPshCounter - // HasStart checks if Start has been set in PatternFlowTcpCtlPshCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpCtlPshCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpCtlPshCounter - SetStep(value uint32) PatternFlowTcpCtlPshCounter - // HasStep checks if Step has been set in PatternFlowTcpCtlPshCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpCtlPshCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpCtlPshCounter - SetCount(value uint32) PatternFlowTcpCtlPshCounter - // HasCount checks if Count has been set in PatternFlowTcpCtlPshCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpCtlPshCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpCtlPshCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpCtlPshCounter object -func (obj *patternFlowTcpCtlPshCounter) SetStart(value uint32) PatternFlowTcpCtlPshCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpCtlPshCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpCtlPshCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpCtlPshCounter object -func (obj *patternFlowTcpCtlPshCounter) SetStep(value uint32) PatternFlowTcpCtlPshCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpCtlPshCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpCtlPshCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpCtlPshCounter object -func (obj *patternFlowTcpCtlPshCounter) SetCount(value uint32) PatternFlowTcpCtlPshCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpCtlPshCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlPshCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlPshCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlPshCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowTcpCtlPshCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpCtlPshMetricTag ***** -type patternFlowTcpCtlPshMetricTag struct { - validation - obj *otg.PatternFlowTcpCtlPshMetricTag - marshaller marshalPatternFlowTcpCtlPshMetricTag - unMarshaller unMarshalPatternFlowTcpCtlPshMetricTag -} - -func NewPatternFlowTcpCtlPshMetricTag() PatternFlowTcpCtlPshMetricTag { - obj := patternFlowTcpCtlPshMetricTag{obj: &otg.PatternFlowTcpCtlPshMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlPshMetricTag) msg() *otg.PatternFlowTcpCtlPshMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpCtlPshMetricTag) setMsg(msg *otg.PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlPshMetricTag struct { - obj *patternFlowTcpCtlPshMetricTag -} - -type marshalPatternFlowTcpCtlPshMetricTag interface { - // ToProto marshals PatternFlowTcpCtlPshMetricTag to protobuf object *otg.PatternFlowTcpCtlPshMetricTag - ToProto() (*otg.PatternFlowTcpCtlPshMetricTag, error) - // ToPbText marshals PatternFlowTcpCtlPshMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlPshMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlPshMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlPshMetricTag struct { - obj *patternFlowTcpCtlPshMetricTag -} - -type unMarshalPatternFlowTcpCtlPshMetricTag interface { - // FromProto unmarshals PatternFlowTcpCtlPshMetricTag from protobuf object *otg.PatternFlowTcpCtlPshMetricTag - FromProto(msg *otg.PatternFlowTcpCtlPshMetricTag) (PatternFlowTcpCtlPshMetricTag, error) - // FromPbText unmarshals PatternFlowTcpCtlPshMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlPshMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlPshMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlPshMetricTag) Marshal() marshalPatternFlowTcpCtlPshMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlPshMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlPshMetricTag) Unmarshal() unMarshalPatternFlowTcpCtlPshMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlPshMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlPshMetricTag) ToProto() (*otg.PatternFlowTcpCtlPshMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlPshMetricTag) FromProto(msg *otg.PatternFlowTcpCtlPshMetricTag) (PatternFlowTcpCtlPshMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlPshMetricTag) 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 *unMarshalpatternFlowTcpCtlPshMetricTag) 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 *marshalpatternFlowTcpCtlPshMetricTag) 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 *unMarshalpatternFlowTcpCtlPshMetricTag) 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 *marshalpatternFlowTcpCtlPshMetricTag) 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 *unMarshalpatternFlowTcpCtlPshMetricTag) 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 *patternFlowTcpCtlPshMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlPshMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlPshMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlPshMetricTag) Clone() (PatternFlowTcpCtlPshMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlPshMetricTag() - 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 -} - -// PatternFlowTcpCtlPshMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpCtlPshMetricTag interface { - Validation - // msg marshals PatternFlowTcpCtlPshMetricTag to protobuf object *otg.PatternFlowTcpCtlPshMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlPshMetricTag - // setMsg unmarshals PatternFlowTcpCtlPshMetricTag from protobuf object *otg.PatternFlowTcpCtlPshMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlPshMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlPshMetricTag - // validate validates PatternFlowTcpCtlPshMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlPshMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpCtlPshMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpCtlPshMetricTag - SetName(value string) PatternFlowTcpCtlPshMetricTag - // Offset returns uint32, set in PatternFlowTcpCtlPshMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpCtlPshMetricTag - SetOffset(value uint32) PatternFlowTcpCtlPshMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpCtlPshMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpCtlPshMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpCtlPshMetricTag - SetLength(value uint32) PatternFlowTcpCtlPshMetricTag - // HasLength checks if Length has been set in PatternFlowTcpCtlPshMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpCtlPshMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpCtlPshMetricTag object -func (obj *patternFlowTcpCtlPshMetricTag) SetName(value string) PatternFlowTcpCtlPshMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpCtlPshMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpCtlPshMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpCtlPshMetricTag object -func (obj *patternFlowTcpCtlPshMetricTag) SetOffset(value uint32) PatternFlowTcpCtlPshMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpCtlPshMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpCtlPshMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpCtlPshMetricTag object -func (obj *patternFlowTcpCtlPshMetricTag) SetLength(value uint32) PatternFlowTcpCtlPshMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpCtlPshMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpCtlPshMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlPshMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpCtlPshMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpCtlPshMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowTcpCtlRstCounter ***** -type patternFlowTcpCtlRstCounter struct { - validation - obj *otg.PatternFlowTcpCtlRstCounter - marshaller marshalPatternFlowTcpCtlRstCounter - unMarshaller unMarshalPatternFlowTcpCtlRstCounter -} - -func NewPatternFlowTcpCtlRstCounter() PatternFlowTcpCtlRstCounter { - obj := patternFlowTcpCtlRstCounter{obj: &otg.PatternFlowTcpCtlRstCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlRstCounter) msg() *otg.PatternFlowTcpCtlRstCounter { - return obj.obj -} - -func (obj *patternFlowTcpCtlRstCounter) setMsg(msg *otg.PatternFlowTcpCtlRstCounter) PatternFlowTcpCtlRstCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlRstCounter struct { - obj *patternFlowTcpCtlRstCounter -} - -type marshalPatternFlowTcpCtlRstCounter interface { - // ToProto marshals PatternFlowTcpCtlRstCounter to protobuf object *otg.PatternFlowTcpCtlRstCounter - ToProto() (*otg.PatternFlowTcpCtlRstCounter, error) - // ToPbText marshals PatternFlowTcpCtlRstCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlRstCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlRstCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlRstCounter struct { - obj *patternFlowTcpCtlRstCounter -} - -type unMarshalPatternFlowTcpCtlRstCounter interface { - // FromProto unmarshals PatternFlowTcpCtlRstCounter from protobuf object *otg.PatternFlowTcpCtlRstCounter - FromProto(msg *otg.PatternFlowTcpCtlRstCounter) (PatternFlowTcpCtlRstCounter, error) - // FromPbText unmarshals PatternFlowTcpCtlRstCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlRstCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlRstCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlRstCounter) Marshal() marshalPatternFlowTcpCtlRstCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlRstCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlRstCounter) Unmarshal() unMarshalPatternFlowTcpCtlRstCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlRstCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlRstCounter) ToProto() (*otg.PatternFlowTcpCtlRstCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlRstCounter) FromProto(msg *otg.PatternFlowTcpCtlRstCounter) (PatternFlowTcpCtlRstCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlRstCounter) 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 *unMarshalpatternFlowTcpCtlRstCounter) 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 *marshalpatternFlowTcpCtlRstCounter) 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 *unMarshalpatternFlowTcpCtlRstCounter) 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 *marshalpatternFlowTcpCtlRstCounter) 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 *unMarshalpatternFlowTcpCtlRstCounter) 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 *patternFlowTcpCtlRstCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlRstCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlRstCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlRstCounter) Clone() (PatternFlowTcpCtlRstCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlRstCounter() - 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 -} - -// PatternFlowTcpCtlRstCounter is integer counter pattern -type PatternFlowTcpCtlRstCounter interface { - Validation - // msg marshals PatternFlowTcpCtlRstCounter to protobuf object *otg.PatternFlowTcpCtlRstCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlRstCounter - // setMsg unmarshals PatternFlowTcpCtlRstCounter from protobuf object *otg.PatternFlowTcpCtlRstCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlRstCounter) PatternFlowTcpCtlRstCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlRstCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlRstCounter - // validate validates PatternFlowTcpCtlRstCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlRstCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpCtlRstCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpCtlRstCounter - SetStart(value uint32) PatternFlowTcpCtlRstCounter - // HasStart checks if Start has been set in PatternFlowTcpCtlRstCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpCtlRstCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpCtlRstCounter - SetStep(value uint32) PatternFlowTcpCtlRstCounter - // HasStep checks if Step has been set in PatternFlowTcpCtlRstCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpCtlRstCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpCtlRstCounter - SetCount(value uint32) PatternFlowTcpCtlRstCounter - // HasCount checks if Count has been set in PatternFlowTcpCtlRstCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpCtlRstCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpCtlRstCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpCtlRstCounter object -func (obj *patternFlowTcpCtlRstCounter) SetStart(value uint32) PatternFlowTcpCtlRstCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpCtlRstCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpCtlRstCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpCtlRstCounter object -func (obj *patternFlowTcpCtlRstCounter) SetStep(value uint32) PatternFlowTcpCtlRstCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpCtlRstCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpCtlRstCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpCtlRstCounter object -func (obj *patternFlowTcpCtlRstCounter) SetCount(value uint32) PatternFlowTcpCtlRstCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpCtlRstCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlRstCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlRstCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlRstCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowTcpCtlRstCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpCtlRstMetricTag ***** -type patternFlowTcpCtlRstMetricTag struct { - validation - obj *otg.PatternFlowTcpCtlRstMetricTag - marshaller marshalPatternFlowTcpCtlRstMetricTag - unMarshaller unMarshalPatternFlowTcpCtlRstMetricTag -} - -func NewPatternFlowTcpCtlRstMetricTag() PatternFlowTcpCtlRstMetricTag { - obj := patternFlowTcpCtlRstMetricTag{obj: &otg.PatternFlowTcpCtlRstMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlRstMetricTag) msg() *otg.PatternFlowTcpCtlRstMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpCtlRstMetricTag) setMsg(msg *otg.PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlRstMetricTag struct { - obj *patternFlowTcpCtlRstMetricTag -} - -type marshalPatternFlowTcpCtlRstMetricTag interface { - // ToProto marshals PatternFlowTcpCtlRstMetricTag to protobuf object *otg.PatternFlowTcpCtlRstMetricTag - ToProto() (*otg.PatternFlowTcpCtlRstMetricTag, error) - // ToPbText marshals PatternFlowTcpCtlRstMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlRstMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlRstMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlRstMetricTag struct { - obj *patternFlowTcpCtlRstMetricTag -} - -type unMarshalPatternFlowTcpCtlRstMetricTag interface { - // FromProto unmarshals PatternFlowTcpCtlRstMetricTag from protobuf object *otg.PatternFlowTcpCtlRstMetricTag - FromProto(msg *otg.PatternFlowTcpCtlRstMetricTag) (PatternFlowTcpCtlRstMetricTag, error) - // FromPbText unmarshals PatternFlowTcpCtlRstMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlRstMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlRstMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlRstMetricTag) Marshal() marshalPatternFlowTcpCtlRstMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlRstMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlRstMetricTag) Unmarshal() unMarshalPatternFlowTcpCtlRstMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlRstMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlRstMetricTag) ToProto() (*otg.PatternFlowTcpCtlRstMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlRstMetricTag) FromProto(msg *otg.PatternFlowTcpCtlRstMetricTag) (PatternFlowTcpCtlRstMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlRstMetricTag) 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 *unMarshalpatternFlowTcpCtlRstMetricTag) 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 *marshalpatternFlowTcpCtlRstMetricTag) 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 *unMarshalpatternFlowTcpCtlRstMetricTag) 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 *marshalpatternFlowTcpCtlRstMetricTag) 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 *unMarshalpatternFlowTcpCtlRstMetricTag) 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 *patternFlowTcpCtlRstMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlRstMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlRstMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlRstMetricTag) Clone() (PatternFlowTcpCtlRstMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlRstMetricTag() - 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 -} - -// PatternFlowTcpCtlRstMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpCtlRstMetricTag interface { - Validation - // msg marshals PatternFlowTcpCtlRstMetricTag to protobuf object *otg.PatternFlowTcpCtlRstMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlRstMetricTag - // setMsg unmarshals PatternFlowTcpCtlRstMetricTag from protobuf object *otg.PatternFlowTcpCtlRstMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlRstMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlRstMetricTag - // validate validates PatternFlowTcpCtlRstMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlRstMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpCtlRstMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpCtlRstMetricTag - SetName(value string) PatternFlowTcpCtlRstMetricTag - // Offset returns uint32, set in PatternFlowTcpCtlRstMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpCtlRstMetricTag - SetOffset(value uint32) PatternFlowTcpCtlRstMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpCtlRstMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpCtlRstMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpCtlRstMetricTag - SetLength(value uint32) PatternFlowTcpCtlRstMetricTag - // HasLength checks if Length has been set in PatternFlowTcpCtlRstMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpCtlRstMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpCtlRstMetricTag object -func (obj *patternFlowTcpCtlRstMetricTag) SetName(value string) PatternFlowTcpCtlRstMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpCtlRstMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpCtlRstMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpCtlRstMetricTag object -func (obj *patternFlowTcpCtlRstMetricTag) SetOffset(value uint32) PatternFlowTcpCtlRstMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpCtlRstMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpCtlRstMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpCtlRstMetricTag object -func (obj *patternFlowTcpCtlRstMetricTag) SetLength(value uint32) PatternFlowTcpCtlRstMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpCtlRstMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpCtlRstMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlRstMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpCtlRstMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpCtlRstMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowTcpCtlSynCounter ***** -type patternFlowTcpCtlSynCounter struct { - validation - obj *otg.PatternFlowTcpCtlSynCounter - marshaller marshalPatternFlowTcpCtlSynCounter - unMarshaller unMarshalPatternFlowTcpCtlSynCounter -} - -func NewPatternFlowTcpCtlSynCounter() PatternFlowTcpCtlSynCounter { - obj := patternFlowTcpCtlSynCounter{obj: &otg.PatternFlowTcpCtlSynCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlSynCounter) msg() *otg.PatternFlowTcpCtlSynCounter { - return obj.obj -} - -func (obj *patternFlowTcpCtlSynCounter) setMsg(msg *otg.PatternFlowTcpCtlSynCounter) PatternFlowTcpCtlSynCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlSynCounter struct { - obj *patternFlowTcpCtlSynCounter -} - -type marshalPatternFlowTcpCtlSynCounter interface { - // ToProto marshals PatternFlowTcpCtlSynCounter to protobuf object *otg.PatternFlowTcpCtlSynCounter - ToProto() (*otg.PatternFlowTcpCtlSynCounter, error) - // ToPbText marshals PatternFlowTcpCtlSynCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlSynCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlSynCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlSynCounter struct { - obj *patternFlowTcpCtlSynCounter -} - -type unMarshalPatternFlowTcpCtlSynCounter interface { - // FromProto unmarshals PatternFlowTcpCtlSynCounter from protobuf object *otg.PatternFlowTcpCtlSynCounter - FromProto(msg *otg.PatternFlowTcpCtlSynCounter) (PatternFlowTcpCtlSynCounter, error) - // FromPbText unmarshals PatternFlowTcpCtlSynCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlSynCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlSynCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlSynCounter) Marshal() marshalPatternFlowTcpCtlSynCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlSynCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlSynCounter) Unmarshal() unMarshalPatternFlowTcpCtlSynCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlSynCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlSynCounter) ToProto() (*otg.PatternFlowTcpCtlSynCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlSynCounter) FromProto(msg *otg.PatternFlowTcpCtlSynCounter) (PatternFlowTcpCtlSynCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlSynCounter) 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 *unMarshalpatternFlowTcpCtlSynCounter) 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 *marshalpatternFlowTcpCtlSynCounter) 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 *unMarshalpatternFlowTcpCtlSynCounter) 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 *marshalpatternFlowTcpCtlSynCounter) 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 *unMarshalpatternFlowTcpCtlSynCounter) 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 *patternFlowTcpCtlSynCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlSynCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlSynCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlSynCounter) Clone() (PatternFlowTcpCtlSynCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlSynCounter() - 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 -} - -// PatternFlowTcpCtlSynCounter is integer counter pattern -type PatternFlowTcpCtlSynCounter interface { - Validation - // msg marshals PatternFlowTcpCtlSynCounter to protobuf object *otg.PatternFlowTcpCtlSynCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlSynCounter - // setMsg unmarshals PatternFlowTcpCtlSynCounter from protobuf object *otg.PatternFlowTcpCtlSynCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlSynCounter) PatternFlowTcpCtlSynCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlSynCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlSynCounter - // validate validates PatternFlowTcpCtlSynCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlSynCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpCtlSynCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpCtlSynCounter - SetStart(value uint32) PatternFlowTcpCtlSynCounter - // HasStart checks if Start has been set in PatternFlowTcpCtlSynCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpCtlSynCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpCtlSynCounter - SetStep(value uint32) PatternFlowTcpCtlSynCounter - // HasStep checks if Step has been set in PatternFlowTcpCtlSynCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpCtlSynCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpCtlSynCounter - SetCount(value uint32) PatternFlowTcpCtlSynCounter - // HasCount checks if Count has been set in PatternFlowTcpCtlSynCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpCtlSynCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpCtlSynCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpCtlSynCounter object -func (obj *patternFlowTcpCtlSynCounter) SetStart(value uint32) PatternFlowTcpCtlSynCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpCtlSynCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpCtlSynCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpCtlSynCounter object -func (obj *patternFlowTcpCtlSynCounter) SetStep(value uint32) PatternFlowTcpCtlSynCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpCtlSynCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpCtlSynCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpCtlSynCounter object -func (obj *patternFlowTcpCtlSynCounter) SetCount(value uint32) PatternFlowTcpCtlSynCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpCtlSynCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlSynCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlSynCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlSynCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowTcpCtlSynCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpCtlSynMetricTag ***** -type patternFlowTcpCtlSynMetricTag struct { - validation - obj *otg.PatternFlowTcpCtlSynMetricTag - marshaller marshalPatternFlowTcpCtlSynMetricTag - unMarshaller unMarshalPatternFlowTcpCtlSynMetricTag -} - -func NewPatternFlowTcpCtlSynMetricTag() PatternFlowTcpCtlSynMetricTag { - obj := patternFlowTcpCtlSynMetricTag{obj: &otg.PatternFlowTcpCtlSynMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlSynMetricTag) msg() *otg.PatternFlowTcpCtlSynMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpCtlSynMetricTag) setMsg(msg *otg.PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlSynMetricTag struct { - obj *patternFlowTcpCtlSynMetricTag -} - -type marshalPatternFlowTcpCtlSynMetricTag interface { - // ToProto marshals PatternFlowTcpCtlSynMetricTag to protobuf object *otg.PatternFlowTcpCtlSynMetricTag - ToProto() (*otg.PatternFlowTcpCtlSynMetricTag, error) - // ToPbText marshals PatternFlowTcpCtlSynMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlSynMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlSynMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlSynMetricTag struct { - obj *patternFlowTcpCtlSynMetricTag -} - -type unMarshalPatternFlowTcpCtlSynMetricTag interface { - // FromProto unmarshals PatternFlowTcpCtlSynMetricTag from protobuf object *otg.PatternFlowTcpCtlSynMetricTag - FromProto(msg *otg.PatternFlowTcpCtlSynMetricTag) (PatternFlowTcpCtlSynMetricTag, error) - // FromPbText unmarshals PatternFlowTcpCtlSynMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlSynMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlSynMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlSynMetricTag) Marshal() marshalPatternFlowTcpCtlSynMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlSynMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlSynMetricTag) Unmarshal() unMarshalPatternFlowTcpCtlSynMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlSynMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlSynMetricTag) ToProto() (*otg.PatternFlowTcpCtlSynMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlSynMetricTag) FromProto(msg *otg.PatternFlowTcpCtlSynMetricTag) (PatternFlowTcpCtlSynMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlSynMetricTag) 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 *unMarshalpatternFlowTcpCtlSynMetricTag) 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 *marshalpatternFlowTcpCtlSynMetricTag) 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 *unMarshalpatternFlowTcpCtlSynMetricTag) 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 *marshalpatternFlowTcpCtlSynMetricTag) 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 *unMarshalpatternFlowTcpCtlSynMetricTag) 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 *patternFlowTcpCtlSynMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlSynMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlSynMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlSynMetricTag) Clone() (PatternFlowTcpCtlSynMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlSynMetricTag() - 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 -} - -// PatternFlowTcpCtlSynMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpCtlSynMetricTag interface { - Validation - // msg marshals PatternFlowTcpCtlSynMetricTag to protobuf object *otg.PatternFlowTcpCtlSynMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlSynMetricTag - // setMsg unmarshals PatternFlowTcpCtlSynMetricTag from protobuf object *otg.PatternFlowTcpCtlSynMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlSynMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlSynMetricTag - // validate validates PatternFlowTcpCtlSynMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlSynMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpCtlSynMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpCtlSynMetricTag - SetName(value string) PatternFlowTcpCtlSynMetricTag - // Offset returns uint32, set in PatternFlowTcpCtlSynMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpCtlSynMetricTag - SetOffset(value uint32) PatternFlowTcpCtlSynMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpCtlSynMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpCtlSynMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpCtlSynMetricTag - SetLength(value uint32) PatternFlowTcpCtlSynMetricTag - // HasLength checks if Length has been set in PatternFlowTcpCtlSynMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpCtlSynMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpCtlSynMetricTag object -func (obj *patternFlowTcpCtlSynMetricTag) SetName(value string) PatternFlowTcpCtlSynMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpCtlSynMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpCtlSynMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpCtlSynMetricTag object -func (obj *patternFlowTcpCtlSynMetricTag) SetOffset(value uint32) PatternFlowTcpCtlSynMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpCtlSynMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpCtlSynMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpCtlSynMetricTag object -func (obj *patternFlowTcpCtlSynMetricTag) SetLength(value uint32) PatternFlowTcpCtlSynMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpCtlSynMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpCtlSynMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlSynMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpCtlSynMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpCtlSynMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowTcpCtlFinCounter ***** -type patternFlowTcpCtlFinCounter struct { - validation - obj *otg.PatternFlowTcpCtlFinCounter - marshaller marshalPatternFlowTcpCtlFinCounter - unMarshaller unMarshalPatternFlowTcpCtlFinCounter -} - -func NewPatternFlowTcpCtlFinCounter() PatternFlowTcpCtlFinCounter { - obj := patternFlowTcpCtlFinCounter{obj: &otg.PatternFlowTcpCtlFinCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlFinCounter) msg() *otg.PatternFlowTcpCtlFinCounter { - return obj.obj -} - -func (obj *patternFlowTcpCtlFinCounter) setMsg(msg *otg.PatternFlowTcpCtlFinCounter) PatternFlowTcpCtlFinCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlFinCounter struct { - obj *patternFlowTcpCtlFinCounter -} - -type marshalPatternFlowTcpCtlFinCounter interface { - // ToProto marshals PatternFlowTcpCtlFinCounter to protobuf object *otg.PatternFlowTcpCtlFinCounter - ToProto() (*otg.PatternFlowTcpCtlFinCounter, error) - // ToPbText marshals PatternFlowTcpCtlFinCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlFinCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlFinCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlFinCounter struct { - obj *patternFlowTcpCtlFinCounter -} - -type unMarshalPatternFlowTcpCtlFinCounter interface { - // FromProto unmarshals PatternFlowTcpCtlFinCounter from protobuf object *otg.PatternFlowTcpCtlFinCounter - FromProto(msg *otg.PatternFlowTcpCtlFinCounter) (PatternFlowTcpCtlFinCounter, error) - // FromPbText unmarshals PatternFlowTcpCtlFinCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlFinCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlFinCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlFinCounter) Marshal() marshalPatternFlowTcpCtlFinCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlFinCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlFinCounter) Unmarshal() unMarshalPatternFlowTcpCtlFinCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlFinCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlFinCounter) ToProto() (*otg.PatternFlowTcpCtlFinCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlFinCounter) FromProto(msg *otg.PatternFlowTcpCtlFinCounter) (PatternFlowTcpCtlFinCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlFinCounter) 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 *unMarshalpatternFlowTcpCtlFinCounter) 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 *marshalpatternFlowTcpCtlFinCounter) 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 *unMarshalpatternFlowTcpCtlFinCounter) 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 *marshalpatternFlowTcpCtlFinCounter) 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 *unMarshalpatternFlowTcpCtlFinCounter) 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 *patternFlowTcpCtlFinCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlFinCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlFinCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlFinCounter) Clone() (PatternFlowTcpCtlFinCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlFinCounter() - 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 -} - -// PatternFlowTcpCtlFinCounter is integer counter pattern -type PatternFlowTcpCtlFinCounter interface { - Validation - // msg marshals PatternFlowTcpCtlFinCounter to protobuf object *otg.PatternFlowTcpCtlFinCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlFinCounter - // setMsg unmarshals PatternFlowTcpCtlFinCounter from protobuf object *otg.PatternFlowTcpCtlFinCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlFinCounter) PatternFlowTcpCtlFinCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlFinCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlFinCounter - // validate validates PatternFlowTcpCtlFinCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlFinCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpCtlFinCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpCtlFinCounter - SetStart(value uint32) PatternFlowTcpCtlFinCounter - // HasStart checks if Start has been set in PatternFlowTcpCtlFinCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpCtlFinCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpCtlFinCounter - SetStep(value uint32) PatternFlowTcpCtlFinCounter - // HasStep checks if Step has been set in PatternFlowTcpCtlFinCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpCtlFinCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpCtlFinCounter - SetCount(value uint32) PatternFlowTcpCtlFinCounter - // HasCount checks if Count has been set in PatternFlowTcpCtlFinCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpCtlFinCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpCtlFinCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpCtlFinCounter object -func (obj *patternFlowTcpCtlFinCounter) SetStart(value uint32) PatternFlowTcpCtlFinCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpCtlFinCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpCtlFinCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpCtlFinCounter object -func (obj *patternFlowTcpCtlFinCounter) SetStep(value uint32) PatternFlowTcpCtlFinCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpCtlFinCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpCtlFinCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpCtlFinCounter object -func (obj *patternFlowTcpCtlFinCounter) SetCount(value uint32) PatternFlowTcpCtlFinCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpCtlFinCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlFinCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlFinCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlFinCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowTcpCtlFinCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpCtlFinMetricTag ***** -type patternFlowTcpCtlFinMetricTag struct { - validation - obj *otg.PatternFlowTcpCtlFinMetricTag - marshaller marshalPatternFlowTcpCtlFinMetricTag - unMarshaller unMarshalPatternFlowTcpCtlFinMetricTag -} - -func NewPatternFlowTcpCtlFinMetricTag() PatternFlowTcpCtlFinMetricTag { - obj := patternFlowTcpCtlFinMetricTag{obj: &otg.PatternFlowTcpCtlFinMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpCtlFinMetricTag) msg() *otg.PatternFlowTcpCtlFinMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpCtlFinMetricTag) setMsg(msg *otg.PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpCtlFinMetricTag struct { - obj *patternFlowTcpCtlFinMetricTag -} - -type marshalPatternFlowTcpCtlFinMetricTag interface { - // ToProto marshals PatternFlowTcpCtlFinMetricTag to protobuf object *otg.PatternFlowTcpCtlFinMetricTag - ToProto() (*otg.PatternFlowTcpCtlFinMetricTag, error) - // ToPbText marshals PatternFlowTcpCtlFinMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpCtlFinMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpCtlFinMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpCtlFinMetricTag struct { - obj *patternFlowTcpCtlFinMetricTag -} - -type unMarshalPatternFlowTcpCtlFinMetricTag interface { - // FromProto unmarshals PatternFlowTcpCtlFinMetricTag from protobuf object *otg.PatternFlowTcpCtlFinMetricTag - FromProto(msg *otg.PatternFlowTcpCtlFinMetricTag) (PatternFlowTcpCtlFinMetricTag, error) - // FromPbText unmarshals PatternFlowTcpCtlFinMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpCtlFinMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpCtlFinMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpCtlFinMetricTag) Marshal() marshalPatternFlowTcpCtlFinMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpCtlFinMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpCtlFinMetricTag) Unmarshal() unMarshalPatternFlowTcpCtlFinMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpCtlFinMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpCtlFinMetricTag) ToProto() (*otg.PatternFlowTcpCtlFinMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpCtlFinMetricTag) FromProto(msg *otg.PatternFlowTcpCtlFinMetricTag) (PatternFlowTcpCtlFinMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpCtlFinMetricTag) 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 *unMarshalpatternFlowTcpCtlFinMetricTag) 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 *marshalpatternFlowTcpCtlFinMetricTag) 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 *unMarshalpatternFlowTcpCtlFinMetricTag) 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 *marshalpatternFlowTcpCtlFinMetricTag) 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 *unMarshalpatternFlowTcpCtlFinMetricTag) 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 *patternFlowTcpCtlFinMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlFinMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpCtlFinMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpCtlFinMetricTag) Clone() (PatternFlowTcpCtlFinMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpCtlFinMetricTag() - 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 -} - -// PatternFlowTcpCtlFinMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpCtlFinMetricTag interface { - Validation - // msg marshals PatternFlowTcpCtlFinMetricTag to protobuf object *otg.PatternFlowTcpCtlFinMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpCtlFinMetricTag - // setMsg unmarshals PatternFlowTcpCtlFinMetricTag from protobuf object *otg.PatternFlowTcpCtlFinMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpCtlFinMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpCtlFinMetricTag - // validate validates PatternFlowTcpCtlFinMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpCtlFinMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpCtlFinMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpCtlFinMetricTag - SetName(value string) PatternFlowTcpCtlFinMetricTag - // Offset returns uint32, set in PatternFlowTcpCtlFinMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpCtlFinMetricTag - SetOffset(value uint32) PatternFlowTcpCtlFinMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpCtlFinMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpCtlFinMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpCtlFinMetricTag - SetLength(value uint32) PatternFlowTcpCtlFinMetricTag - // HasLength checks if Length has been set in PatternFlowTcpCtlFinMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpCtlFinMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpCtlFinMetricTag object -func (obj *patternFlowTcpCtlFinMetricTag) SetName(value string) PatternFlowTcpCtlFinMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpCtlFinMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpCtlFinMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpCtlFinMetricTag object -func (obj *patternFlowTcpCtlFinMetricTag) SetOffset(value uint32) PatternFlowTcpCtlFinMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpCtlFinMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpCtlFinMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpCtlFinMetricTag object -func (obj *patternFlowTcpCtlFinMetricTag) SetLength(value uint32) PatternFlowTcpCtlFinMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpCtlFinMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpCtlFinMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpCtlFinMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpCtlFinMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpCtlFinMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowTcpWindowCounter ***** -type patternFlowTcpWindowCounter struct { - validation - obj *otg.PatternFlowTcpWindowCounter - marshaller marshalPatternFlowTcpWindowCounter - unMarshaller unMarshalPatternFlowTcpWindowCounter -} - -func NewPatternFlowTcpWindowCounter() PatternFlowTcpWindowCounter { - obj := patternFlowTcpWindowCounter{obj: &otg.PatternFlowTcpWindowCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpWindowCounter) msg() *otg.PatternFlowTcpWindowCounter { - return obj.obj -} - -func (obj *patternFlowTcpWindowCounter) setMsg(msg *otg.PatternFlowTcpWindowCounter) PatternFlowTcpWindowCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpWindowCounter struct { - obj *patternFlowTcpWindowCounter -} - -type marshalPatternFlowTcpWindowCounter interface { - // ToProto marshals PatternFlowTcpWindowCounter to protobuf object *otg.PatternFlowTcpWindowCounter - ToProto() (*otg.PatternFlowTcpWindowCounter, error) - // ToPbText marshals PatternFlowTcpWindowCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpWindowCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpWindowCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpWindowCounter struct { - obj *patternFlowTcpWindowCounter -} - -type unMarshalPatternFlowTcpWindowCounter interface { - // FromProto unmarshals PatternFlowTcpWindowCounter from protobuf object *otg.PatternFlowTcpWindowCounter - FromProto(msg *otg.PatternFlowTcpWindowCounter) (PatternFlowTcpWindowCounter, error) - // FromPbText unmarshals PatternFlowTcpWindowCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpWindowCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpWindowCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpWindowCounter) Marshal() marshalPatternFlowTcpWindowCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpWindowCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpWindowCounter) Unmarshal() unMarshalPatternFlowTcpWindowCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpWindowCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpWindowCounter) ToProto() (*otg.PatternFlowTcpWindowCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpWindowCounter) FromProto(msg *otg.PatternFlowTcpWindowCounter) (PatternFlowTcpWindowCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpWindowCounter) 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 *unMarshalpatternFlowTcpWindowCounter) 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 *marshalpatternFlowTcpWindowCounter) 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 *unMarshalpatternFlowTcpWindowCounter) 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 *marshalpatternFlowTcpWindowCounter) 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 *unMarshalpatternFlowTcpWindowCounter) 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 *patternFlowTcpWindowCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpWindowCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpWindowCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpWindowCounter) Clone() (PatternFlowTcpWindowCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpWindowCounter() - 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 -} - -// PatternFlowTcpWindowCounter is integer counter pattern -type PatternFlowTcpWindowCounter interface { - Validation - // msg marshals PatternFlowTcpWindowCounter to protobuf object *otg.PatternFlowTcpWindowCounter - // and doesn't set defaults - msg() *otg.PatternFlowTcpWindowCounter - // setMsg unmarshals PatternFlowTcpWindowCounter from protobuf object *otg.PatternFlowTcpWindowCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpWindowCounter) PatternFlowTcpWindowCounter - // provides marshal interface - Marshal() marshalPatternFlowTcpWindowCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpWindowCounter - // validate validates PatternFlowTcpWindowCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpWindowCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowTcpWindowCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowTcpWindowCounter - SetStart(value uint32) PatternFlowTcpWindowCounter - // HasStart checks if Start has been set in PatternFlowTcpWindowCounter - HasStart() bool - // Step returns uint32, set in PatternFlowTcpWindowCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowTcpWindowCounter - SetStep(value uint32) PatternFlowTcpWindowCounter - // HasStep checks if Step has been set in PatternFlowTcpWindowCounter - HasStep() bool - // Count returns uint32, set in PatternFlowTcpWindowCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowTcpWindowCounter - SetCount(value uint32) PatternFlowTcpWindowCounter - // HasCount checks if Count has been set in PatternFlowTcpWindowCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpWindowCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowTcpWindowCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowTcpWindowCounter object -func (obj *patternFlowTcpWindowCounter) SetStart(value uint32) PatternFlowTcpWindowCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpWindowCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowTcpWindowCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowTcpWindowCounter object -func (obj *patternFlowTcpWindowCounter) SetStep(value uint32) PatternFlowTcpWindowCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpWindowCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowTcpWindowCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowTcpWindowCounter object -func (obj *patternFlowTcpWindowCounter) SetCount(value uint32) PatternFlowTcpWindowCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowTcpWindowCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpWindowCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpWindowCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpWindowCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowTcpWindowCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowTcpWindowMetricTag ***** -type patternFlowTcpWindowMetricTag struct { - validation - obj *otg.PatternFlowTcpWindowMetricTag - marshaller marshalPatternFlowTcpWindowMetricTag - unMarshaller unMarshalPatternFlowTcpWindowMetricTag -} - -func NewPatternFlowTcpWindowMetricTag() PatternFlowTcpWindowMetricTag { - obj := patternFlowTcpWindowMetricTag{obj: &otg.PatternFlowTcpWindowMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowTcpWindowMetricTag) msg() *otg.PatternFlowTcpWindowMetricTag { - return obj.obj -} - -func (obj *patternFlowTcpWindowMetricTag) setMsg(msg *otg.PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowTcpWindowMetricTag struct { - obj *patternFlowTcpWindowMetricTag -} - -type marshalPatternFlowTcpWindowMetricTag interface { - // ToProto marshals PatternFlowTcpWindowMetricTag to protobuf object *otg.PatternFlowTcpWindowMetricTag - ToProto() (*otg.PatternFlowTcpWindowMetricTag, error) - // ToPbText marshals PatternFlowTcpWindowMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowTcpWindowMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowTcpWindowMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowTcpWindowMetricTag struct { - obj *patternFlowTcpWindowMetricTag -} - -type unMarshalPatternFlowTcpWindowMetricTag interface { - // FromProto unmarshals PatternFlowTcpWindowMetricTag from protobuf object *otg.PatternFlowTcpWindowMetricTag - FromProto(msg *otg.PatternFlowTcpWindowMetricTag) (PatternFlowTcpWindowMetricTag, error) - // FromPbText unmarshals PatternFlowTcpWindowMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowTcpWindowMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowTcpWindowMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowTcpWindowMetricTag) Marshal() marshalPatternFlowTcpWindowMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowTcpWindowMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowTcpWindowMetricTag) Unmarshal() unMarshalPatternFlowTcpWindowMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowTcpWindowMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowTcpWindowMetricTag) ToProto() (*otg.PatternFlowTcpWindowMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowTcpWindowMetricTag) FromProto(msg *otg.PatternFlowTcpWindowMetricTag) (PatternFlowTcpWindowMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowTcpWindowMetricTag) 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 *unMarshalpatternFlowTcpWindowMetricTag) 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 *marshalpatternFlowTcpWindowMetricTag) 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 *unMarshalpatternFlowTcpWindowMetricTag) 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 *marshalpatternFlowTcpWindowMetricTag) 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 *unMarshalpatternFlowTcpWindowMetricTag) 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 *patternFlowTcpWindowMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowTcpWindowMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowTcpWindowMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowTcpWindowMetricTag) Clone() (PatternFlowTcpWindowMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowTcpWindowMetricTag() - 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 -} - -// PatternFlowTcpWindowMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowTcpWindowMetricTag interface { - Validation - // msg marshals PatternFlowTcpWindowMetricTag to protobuf object *otg.PatternFlowTcpWindowMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowTcpWindowMetricTag - // setMsg unmarshals PatternFlowTcpWindowMetricTag from protobuf object *otg.PatternFlowTcpWindowMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowMetricTag - // provides marshal interface - Marshal() marshalPatternFlowTcpWindowMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowTcpWindowMetricTag - // validate validates PatternFlowTcpWindowMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowTcpWindowMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowTcpWindowMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowTcpWindowMetricTag - SetName(value string) PatternFlowTcpWindowMetricTag - // Offset returns uint32, set in PatternFlowTcpWindowMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowTcpWindowMetricTag - SetOffset(value uint32) PatternFlowTcpWindowMetricTag - // HasOffset checks if Offset has been set in PatternFlowTcpWindowMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowTcpWindowMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowTcpWindowMetricTag - SetLength(value uint32) PatternFlowTcpWindowMetricTag - // HasLength checks if Length has been set in PatternFlowTcpWindowMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowTcpWindowMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowTcpWindowMetricTag object -func (obj *patternFlowTcpWindowMetricTag) SetName(value string) PatternFlowTcpWindowMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpWindowMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowTcpWindowMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowTcpWindowMetricTag object -func (obj *patternFlowTcpWindowMetricTag) SetOffset(value uint32) PatternFlowTcpWindowMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpWindowMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowTcpWindowMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowTcpWindowMetricTag object -func (obj *patternFlowTcpWindowMetricTag) SetLength(value uint32) PatternFlowTcpWindowMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowTcpWindowMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpWindowMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowTcpWindowMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowTcpWindowMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowTcpWindowMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowUdpSrcPortCounter ***** -type patternFlowUdpSrcPortCounter struct { - validation - obj *otg.PatternFlowUdpSrcPortCounter - marshaller marshalPatternFlowUdpSrcPortCounter - unMarshaller unMarshalPatternFlowUdpSrcPortCounter -} - -func NewPatternFlowUdpSrcPortCounter() PatternFlowUdpSrcPortCounter { - obj := patternFlowUdpSrcPortCounter{obj: &otg.PatternFlowUdpSrcPortCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowUdpSrcPortCounter) msg() *otg.PatternFlowUdpSrcPortCounter { - return obj.obj -} - -func (obj *patternFlowUdpSrcPortCounter) setMsg(msg *otg.PatternFlowUdpSrcPortCounter) PatternFlowUdpSrcPortCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowUdpSrcPortCounter struct { - obj *patternFlowUdpSrcPortCounter -} - -type marshalPatternFlowUdpSrcPortCounter interface { - // ToProto marshals PatternFlowUdpSrcPortCounter to protobuf object *otg.PatternFlowUdpSrcPortCounter - ToProto() (*otg.PatternFlowUdpSrcPortCounter, error) - // ToPbText marshals PatternFlowUdpSrcPortCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowUdpSrcPortCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowUdpSrcPortCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowUdpSrcPortCounter struct { - obj *patternFlowUdpSrcPortCounter -} - -type unMarshalPatternFlowUdpSrcPortCounter interface { - // FromProto unmarshals PatternFlowUdpSrcPortCounter from protobuf object *otg.PatternFlowUdpSrcPortCounter - FromProto(msg *otg.PatternFlowUdpSrcPortCounter) (PatternFlowUdpSrcPortCounter, error) - // FromPbText unmarshals PatternFlowUdpSrcPortCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowUdpSrcPortCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowUdpSrcPortCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowUdpSrcPortCounter) Marshal() marshalPatternFlowUdpSrcPortCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowUdpSrcPortCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowUdpSrcPortCounter) Unmarshal() unMarshalPatternFlowUdpSrcPortCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowUdpSrcPortCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowUdpSrcPortCounter) ToProto() (*otg.PatternFlowUdpSrcPortCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowUdpSrcPortCounter) FromProto(msg *otg.PatternFlowUdpSrcPortCounter) (PatternFlowUdpSrcPortCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowUdpSrcPortCounter) 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 *unMarshalpatternFlowUdpSrcPortCounter) 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 *marshalpatternFlowUdpSrcPortCounter) 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 *unMarshalpatternFlowUdpSrcPortCounter) 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 *marshalpatternFlowUdpSrcPortCounter) 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 *unMarshalpatternFlowUdpSrcPortCounter) 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 *patternFlowUdpSrcPortCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowUdpSrcPortCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowUdpSrcPortCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowUdpSrcPortCounter) Clone() (PatternFlowUdpSrcPortCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowUdpSrcPortCounter() - 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 -} - -// PatternFlowUdpSrcPortCounter is integer counter pattern -type PatternFlowUdpSrcPortCounter interface { - Validation - // msg marshals PatternFlowUdpSrcPortCounter to protobuf object *otg.PatternFlowUdpSrcPortCounter - // and doesn't set defaults - msg() *otg.PatternFlowUdpSrcPortCounter - // setMsg unmarshals PatternFlowUdpSrcPortCounter from protobuf object *otg.PatternFlowUdpSrcPortCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowUdpSrcPortCounter) PatternFlowUdpSrcPortCounter - // provides marshal interface - Marshal() marshalPatternFlowUdpSrcPortCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowUdpSrcPortCounter - // validate validates PatternFlowUdpSrcPortCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowUdpSrcPortCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowUdpSrcPortCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowUdpSrcPortCounter - SetStart(value uint32) PatternFlowUdpSrcPortCounter - // HasStart checks if Start has been set in PatternFlowUdpSrcPortCounter - HasStart() bool - // Step returns uint32, set in PatternFlowUdpSrcPortCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowUdpSrcPortCounter - SetStep(value uint32) PatternFlowUdpSrcPortCounter - // HasStep checks if Step has been set in PatternFlowUdpSrcPortCounter - HasStep() bool - // Count returns uint32, set in PatternFlowUdpSrcPortCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowUdpSrcPortCounter - SetCount(value uint32) PatternFlowUdpSrcPortCounter - // HasCount checks if Count has been set in PatternFlowUdpSrcPortCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowUdpSrcPortCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowUdpSrcPortCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowUdpSrcPortCounter object -func (obj *patternFlowUdpSrcPortCounter) SetStart(value uint32) PatternFlowUdpSrcPortCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowUdpSrcPortCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowUdpSrcPortCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowUdpSrcPortCounter object -func (obj *patternFlowUdpSrcPortCounter) SetStep(value uint32) PatternFlowUdpSrcPortCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowUdpSrcPortCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowUdpSrcPortCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowUdpSrcPortCounter object -func (obj *patternFlowUdpSrcPortCounter) SetCount(value uint32) PatternFlowUdpSrcPortCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowUdpSrcPortCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpSrcPortCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpSrcPortCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpSrcPortCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowUdpSrcPortCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowUdpSrcPortMetricTag ***** -type patternFlowUdpSrcPortMetricTag struct { - validation - obj *otg.PatternFlowUdpSrcPortMetricTag - marshaller marshalPatternFlowUdpSrcPortMetricTag - unMarshaller unMarshalPatternFlowUdpSrcPortMetricTag -} - -func NewPatternFlowUdpSrcPortMetricTag() PatternFlowUdpSrcPortMetricTag { - obj := patternFlowUdpSrcPortMetricTag{obj: &otg.PatternFlowUdpSrcPortMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowUdpSrcPortMetricTag) msg() *otg.PatternFlowUdpSrcPortMetricTag { - return obj.obj -} - -func (obj *patternFlowUdpSrcPortMetricTag) setMsg(msg *otg.PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowUdpSrcPortMetricTag struct { - obj *patternFlowUdpSrcPortMetricTag -} - -type marshalPatternFlowUdpSrcPortMetricTag interface { - // ToProto marshals PatternFlowUdpSrcPortMetricTag to protobuf object *otg.PatternFlowUdpSrcPortMetricTag - ToProto() (*otg.PatternFlowUdpSrcPortMetricTag, error) - // ToPbText marshals PatternFlowUdpSrcPortMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowUdpSrcPortMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowUdpSrcPortMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowUdpSrcPortMetricTag struct { - obj *patternFlowUdpSrcPortMetricTag -} - -type unMarshalPatternFlowUdpSrcPortMetricTag interface { - // FromProto unmarshals PatternFlowUdpSrcPortMetricTag from protobuf object *otg.PatternFlowUdpSrcPortMetricTag - FromProto(msg *otg.PatternFlowUdpSrcPortMetricTag) (PatternFlowUdpSrcPortMetricTag, error) - // FromPbText unmarshals PatternFlowUdpSrcPortMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowUdpSrcPortMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowUdpSrcPortMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowUdpSrcPortMetricTag) Marshal() marshalPatternFlowUdpSrcPortMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowUdpSrcPortMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowUdpSrcPortMetricTag) Unmarshal() unMarshalPatternFlowUdpSrcPortMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowUdpSrcPortMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowUdpSrcPortMetricTag) ToProto() (*otg.PatternFlowUdpSrcPortMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowUdpSrcPortMetricTag) FromProto(msg *otg.PatternFlowUdpSrcPortMetricTag) (PatternFlowUdpSrcPortMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowUdpSrcPortMetricTag) 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 *unMarshalpatternFlowUdpSrcPortMetricTag) 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 *marshalpatternFlowUdpSrcPortMetricTag) 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 *unMarshalpatternFlowUdpSrcPortMetricTag) 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 *marshalpatternFlowUdpSrcPortMetricTag) 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 *unMarshalpatternFlowUdpSrcPortMetricTag) 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 *patternFlowUdpSrcPortMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowUdpSrcPortMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowUdpSrcPortMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowUdpSrcPortMetricTag) Clone() (PatternFlowUdpSrcPortMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowUdpSrcPortMetricTag() - 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 -} - -// PatternFlowUdpSrcPortMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowUdpSrcPortMetricTag interface { - Validation - // msg marshals PatternFlowUdpSrcPortMetricTag to protobuf object *otg.PatternFlowUdpSrcPortMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowUdpSrcPortMetricTag - // setMsg unmarshals PatternFlowUdpSrcPortMetricTag from protobuf object *otg.PatternFlowUdpSrcPortMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortMetricTag - // provides marshal interface - Marshal() marshalPatternFlowUdpSrcPortMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowUdpSrcPortMetricTag - // validate validates PatternFlowUdpSrcPortMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowUdpSrcPortMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowUdpSrcPortMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowUdpSrcPortMetricTag - SetName(value string) PatternFlowUdpSrcPortMetricTag - // Offset returns uint32, set in PatternFlowUdpSrcPortMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowUdpSrcPortMetricTag - SetOffset(value uint32) PatternFlowUdpSrcPortMetricTag - // HasOffset checks if Offset has been set in PatternFlowUdpSrcPortMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowUdpSrcPortMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowUdpSrcPortMetricTag - SetLength(value uint32) PatternFlowUdpSrcPortMetricTag - // HasLength checks if Length has been set in PatternFlowUdpSrcPortMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowUdpSrcPortMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowUdpSrcPortMetricTag object -func (obj *patternFlowUdpSrcPortMetricTag) SetName(value string) PatternFlowUdpSrcPortMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowUdpSrcPortMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowUdpSrcPortMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowUdpSrcPortMetricTag object -func (obj *patternFlowUdpSrcPortMetricTag) SetOffset(value uint32) PatternFlowUdpSrcPortMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowUdpSrcPortMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowUdpSrcPortMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowUdpSrcPortMetricTag object -func (obj *patternFlowUdpSrcPortMetricTag) SetLength(value uint32) PatternFlowUdpSrcPortMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowUdpSrcPortMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowUdpSrcPortMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpSrcPortMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowUdpSrcPortMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowUdpSrcPortMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowUdpSrcPortRandom ***** -type patternFlowUdpSrcPortRandom struct { - validation - obj *otg.PatternFlowUdpSrcPortRandom - marshaller marshalPatternFlowUdpSrcPortRandom - unMarshaller unMarshalPatternFlowUdpSrcPortRandom -} - -func NewPatternFlowUdpSrcPortRandom() PatternFlowUdpSrcPortRandom { - obj := patternFlowUdpSrcPortRandom{obj: &otg.PatternFlowUdpSrcPortRandom{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowUdpSrcPortRandom) msg() *otg.PatternFlowUdpSrcPortRandom { - return obj.obj -} - -func (obj *patternFlowUdpSrcPortRandom) setMsg(msg *otg.PatternFlowUdpSrcPortRandom) PatternFlowUdpSrcPortRandom { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowUdpSrcPortRandom struct { - obj *patternFlowUdpSrcPortRandom -} - -type marshalPatternFlowUdpSrcPortRandom interface { - // ToProto marshals PatternFlowUdpSrcPortRandom to protobuf object *otg.PatternFlowUdpSrcPortRandom - ToProto() (*otg.PatternFlowUdpSrcPortRandom, error) - // ToPbText marshals PatternFlowUdpSrcPortRandom to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowUdpSrcPortRandom to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowUdpSrcPortRandom to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowUdpSrcPortRandom struct { - obj *patternFlowUdpSrcPortRandom -} - -type unMarshalPatternFlowUdpSrcPortRandom interface { - // FromProto unmarshals PatternFlowUdpSrcPortRandom from protobuf object *otg.PatternFlowUdpSrcPortRandom - FromProto(msg *otg.PatternFlowUdpSrcPortRandom) (PatternFlowUdpSrcPortRandom, error) - // FromPbText unmarshals PatternFlowUdpSrcPortRandom from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowUdpSrcPortRandom from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowUdpSrcPortRandom from JSON text - FromJson(value string) error -} - -func (obj *patternFlowUdpSrcPortRandom) Marshal() marshalPatternFlowUdpSrcPortRandom { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowUdpSrcPortRandom{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowUdpSrcPortRandom) Unmarshal() unMarshalPatternFlowUdpSrcPortRandom { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowUdpSrcPortRandom{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowUdpSrcPortRandom) ToProto() (*otg.PatternFlowUdpSrcPortRandom, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowUdpSrcPortRandom) FromProto(msg *otg.PatternFlowUdpSrcPortRandom) (PatternFlowUdpSrcPortRandom, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowUdpSrcPortRandom) 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 *unMarshalpatternFlowUdpSrcPortRandom) 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 *marshalpatternFlowUdpSrcPortRandom) 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 *unMarshalpatternFlowUdpSrcPortRandom) 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 *marshalpatternFlowUdpSrcPortRandom) 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 *unMarshalpatternFlowUdpSrcPortRandom) 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 *patternFlowUdpSrcPortRandom) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowUdpSrcPortRandom) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowUdpSrcPortRandom) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowUdpSrcPortRandom) Clone() (PatternFlowUdpSrcPortRandom, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowUdpSrcPortRandom() - 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 -} - -// PatternFlowUdpSrcPortRandom is integer random pattern -type PatternFlowUdpSrcPortRandom interface { - Validation - // msg marshals PatternFlowUdpSrcPortRandom to protobuf object *otg.PatternFlowUdpSrcPortRandom - // and doesn't set defaults - msg() *otg.PatternFlowUdpSrcPortRandom - // setMsg unmarshals PatternFlowUdpSrcPortRandom from protobuf object *otg.PatternFlowUdpSrcPortRandom - // and doesn't set defaults - setMsg(*otg.PatternFlowUdpSrcPortRandom) PatternFlowUdpSrcPortRandom - // provides marshal interface - Marshal() marshalPatternFlowUdpSrcPortRandom - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowUdpSrcPortRandom - // validate validates PatternFlowUdpSrcPortRandom - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowUdpSrcPortRandom, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Min returns uint32, set in PatternFlowUdpSrcPortRandom. - Min() uint32 - // SetMin assigns uint32 provided by user to PatternFlowUdpSrcPortRandom - SetMin(value uint32) PatternFlowUdpSrcPortRandom - // HasMin checks if Min has been set in PatternFlowUdpSrcPortRandom - HasMin() bool - // Max returns uint32, set in PatternFlowUdpSrcPortRandom. - Max() uint32 - // SetMax assigns uint32 provided by user to PatternFlowUdpSrcPortRandom - SetMax(value uint32) PatternFlowUdpSrcPortRandom - // HasMax checks if Max has been set in PatternFlowUdpSrcPortRandom - HasMax() bool - // Seed returns uint32, set in PatternFlowUdpSrcPortRandom. - Seed() uint32 - // SetSeed assigns uint32 provided by user to PatternFlowUdpSrcPortRandom - SetSeed(value uint32) PatternFlowUdpSrcPortRandom - // HasSeed checks if Seed has been set in PatternFlowUdpSrcPortRandom - HasSeed() bool - // Count returns uint32, set in PatternFlowUdpSrcPortRandom. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowUdpSrcPortRandom - SetCount(value uint32) PatternFlowUdpSrcPortRandom - // HasCount checks if Count has been set in PatternFlowUdpSrcPortRandom - HasCount() bool -} - -// The minimum possible value generated by the random value generator. -// Min returns a uint32 -func (obj *patternFlowUdpSrcPortRandom) Min() uint32 { - - return *obj.obj.Min - -} - -// The minimum possible value generated by the random value generator. -// Min returns a uint32 -func (obj *patternFlowUdpSrcPortRandom) HasMin() bool { - return obj.obj.Min != nil -} - -// The minimum possible value generated by the random value generator. -// SetMin sets the uint32 value in the PatternFlowUdpSrcPortRandom object -func (obj *patternFlowUdpSrcPortRandom) SetMin(value uint32) PatternFlowUdpSrcPortRandom { - - obj.obj.Min = &value - return obj -} - -// The maximum possible value generated by the random value generator. -// Max returns a uint32 -func (obj *patternFlowUdpSrcPortRandom) Max() uint32 { - - return *obj.obj.Max - -} - -// The maximum possible value generated by the random value generator. -// Max returns a uint32 -func (obj *patternFlowUdpSrcPortRandom) HasMax() bool { - return obj.obj.Max != nil -} - -// The maximum possible value generated by the random value generator. -// SetMax sets the uint32 value in the PatternFlowUdpSrcPortRandom object -func (obj *patternFlowUdpSrcPortRandom) SetMax(value uint32) PatternFlowUdpSrcPortRandom { - - obj.obj.Max = &value - return obj -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// Seed returns a uint32 -func (obj *patternFlowUdpSrcPortRandom) Seed() uint32 { - - return *obj.obj.Seed - -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// Seed returns a uint32 -func (obj *patternFlowUdpSrcPortRandom) HasSeed() bool { - return obj.obj.Seed != nil -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// SetSeed sets the uint32 value in the PatternFlowUdpSrcPortRandom object -func (obj *patternFlowUdpSrcPortRandom) SetSeed(value uint32) PatternFlowUdpSrcPortRandom { - - obj.obj.Seed = &value - return obj -} - -// The total number of values to be generated by the random value generator. -// Count returns a uint32 -func (obj *patternFlowUdpSrcPortRandom) Count() uint32 { - - return *obj.obj.Count - -} - -// The total number of values to be generated by the random value generator. -// Count returns a uint32 -func (obj *patternFlowUdpSrcPortRandom) HasCount() bool { - return obj.obj.Count != nil -} - -// The total number of values to be generated by the random value generator. -// SetCount sets the uint32 value in the PatternFlowUdpSrcPortRandom object -func (obj *patternFlowUdpSrcPortRandom) SetCount(value uint32) PatternFlowUdpSrcPortRandom { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowUdpSrcPortRandom) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Min != nil { - - if *obj.obj.Min > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpSrcPortRandom.Min <= 65535 but Got %d", *obj.obj.Min)) - } - - } - - if obj.obj.Max != nil { - - if *obj.obj.Max > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpSrcPortRandom.Max <= 65535 but Got %d", *obj.obj.Max)) - } - - } - -} - -func (obj *patternFlowUdpSrcPortRandom) setDefault() { - if obj.obj.Min == nil { - obj.SetMin(0) - } - if obj.obj.Max == nil { - obj.SetMax(65535) - } - if obj.obj.Seed == nil { - obj.SetSeed(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowUdpDstPortCounter ***** -type patternFlowUdpDstPortCounter struct { - validation - obj *otg.PatternFlowUdpDstPortCounter - marshaller marshalPatternFlowUdpDstPortCounter - unMarshaller unMarshalPatternFlowUdpDstPortCounter -} - -func NewPatternFlowUdpDstPortCounter() PatternFlowUdpDstPortCounter { - obj := patternFlowUdpDstPortCounter{obj: &otg.PatternFlowUdpDstPortCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowUdpDstPortCounter) msg() *otg.PatternFlowUdpDstPortCounter { - return obj.obj -} - -func (obj *patternFlowUdpDstPortCounter) setMsg(msg *otg.PatternFlowUdpDstPortCounter) PatternFlowUdpDstPortCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowUdpDstPortCounter struct { - obj *patternFlowUdpDstPortCounter -} - -type marshalPatternFlowUdpDstPortCounter interface { - // ToProto marshals PatternFlowUdpDstPortCounter to protobuf object *otg.PatternFlowUdpDstPortCounter - ToProto() (*otg.PatternFlowUdpDstPortCounter, error) - // ToPbText marshals PatternFlowUdpDstPortCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowUdpDstPortCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowUdpDstPortCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowUdpDstPortCounter struct { - obj *patternFlowUdpDstPortCounter -} - -type unMarshalPatternFlowUdpDstPortCounter interface { - // FromProto unmarshals PatternFlowUdpDstPortCounter from protobuf object *otg.PatternFlowUdpDstPortCounter - FromProto(msg *otg.PatternFlowUdpDstPortCounter) (PatternFlowUdpDstPortCounter, error) - // FromPbText unmarshals PatternFlowUdpDstPortCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowUdpDstPortCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowUdpDstPortCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowUdpDstPortCounter) Marshal() marshalPatternFlowUdpDstPortCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowUdpDstPortCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowUdpDstPortCounter) Unmarshal() unMarshalPatternFlowUdpDstPortCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowUdpDstPortCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowUdpDstPortCounter) ToProto() (*otg.PatternFlowUdpDstPortCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowUdpDstPortCounter) FromProto(msg *otg.PatternFlowUdpDstPortCounter) (PatternFlowUdpDstPortCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowUdpDstPortCounter) 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 *unMarshalpatternFlowUdpDstPortCounter) 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 *marshalpatternFlowUdpDstPortCounter) 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 *unMarshalpatternFlowUdpDstPortCounter) 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 *marshalpatternFlowUdpDstPortCounter) 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 *unMarshalpatternFlowUdpDstPortCounter) 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 *patternFlowUdpDstPortCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowUdpDstPortCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowUdpDstPortCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowUdpDstPortCounter) Clone() (PatternFlowUdpDstPortCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowUdpDstPortCounter() - 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 -} - -// PatternFlowUdpDstPortCounter is integer counter pattern -type PatternFlowUdpDstPortCounter interface { - Validation - // msg marshals PatternFlowUdpDstPortCounter to protobuf object *otg.PatternFlowUdpDstPortCounter - // and doesn't set defaults - msg() *otg.PatternFlowUdpDstPortCounter - // setMsg unmarshals PatternFlowUdpDstPortCounter from protobuf object *otg.PatternFlowUdpDstPortCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowUdpDstPortCounter) PatternFlowUdpDstPortCounter - // provides marshal interface - Marshal() marshalPatternFlowUdpDstPortCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowUdpDstPortCounter - // validate validates PatternFlowUdpDstPortCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowUdpDstPortCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowUdpDstPortCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowUdpDstPortCounter - SetStart(value uint32) PatternFlowUdpDstPortCounter - // HasStart checks if Start has been set in PatternFlowUdpDstPortCounter - HasStart() bool - // Step returns uint32, set in PatternFlowUdpDstPortCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowUdpDstPortCounter - SetStep(value uint32) PatternFlowUdpDstPortCounter - // HasStep checks if Step has been set in PatternFlowUdpDstPortCounter - HasStep() bool - // Count returns uint32, set in PatternFlowUdpDstPortCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowUdpDstPortCounter - SetCount(value uint32) PatternFlowUdpDstPortCounter - // HasCount checks if Count has been set in PatternFlowUdpDstPortCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowUdpDstPortCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowUdpDstPortCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowUdpDstPortCounter object -func (obj *patternFlowUdpDstPortCounter) SetStart(value uint32) PatternFlowUdpDstPortCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowUdpDstPortCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowUdpDstPortCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowUdpDstPortCounter object -func (obj *patternFlowUdpDstPortCounter) SetStep(value uint32) PatternFlowUdpDstPortCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowUdpDstPortCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowUdpDstPortCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowUdpDstPortCounter object -func (obj *patternFlowUdpDstPortCounter) SetCount(value uint32) PatternFlowUdpDstPortCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowUdpDstPortCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpDstPortCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpDstPortCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpDstPortCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowUdpDstPortCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowUdpDstPortMetricTag ***** -type patternFlowUdpDstPortMetricTag struct { - validation - obj *otg.PatternFlowUdpDstPortMetricTag - marshaller marshalPatternFlowUdpDstPortMetricTag - unMarshaller unMarshalPatternFlowUdpDstPortMetricTag -} - -func NewPatternFlowUdpDstPortMetricTag() PatternFlowUdpDstPortMetricTag { - obj := patternFlowUdpDstPortMetricTag{obj: &otg.PatternFlowUdpDstPortMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowUdpDstPortMetricTag) msg() *otg.PatternFlowUdpDstPortMetricTag { - return obj.obj -} - -func (obj *patternFlowUdpDstPortMetricTag) setMsg(msg *otg.PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowUdpDstPortMetricTag struct { - obj *patternFlowUdpDstPortMetricTag -} - -type marshalPatternFlowUdpDstPortMetricTag interface { - // ToProto marshals PatternFlowUdpDstPortMetricTag to protobuf object *otg.PatternFlowUdpDstPortMetricTag - ToProto() (*otg.PatternFlowUdpDstPortMetricTag, error) - // ToPbText marshals PatternFlowUdpDstPortMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowUdpDstPortMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowUdpDstPortMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowUdpDstPortMetricTag struct { - obj *patternFlowUdpDstPortMetricTag -} - -type unMarshalPatternFlowUdpDstPortMetricTag interface { - // FromProto unmarshals PatternFlowUdpDstPortMetricTag from protobuf object *otg.PatternFlowUdpDstPortMetricTag - FromProto(msg *otg.PatternFlowUdpDstPortMetricTag) (PatternFlowUdpDstPortMetricTag, error) - // FromPbText unmarshals PatternFlowUdpDstPortMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowUdpDstPortMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowUdpDstPortMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowUdpDstPortMetricTag) Marshal() marshalPatternFlowUdpDstPortMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowUdpDstPortMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowUdpDstPortMetricTag) Unmarshal() unMarshalPatternFlowUdpDstPortMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowUdpDstPortMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowUdpDstPortMetricTag) ToProto() (*otg.PatternFlowUdpDstPortMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowUdpDstPortMetricTag) FromProto(msg *otg.PatternFlowUdpDstPortMetricTag) (PatternFlowUdpDstPortMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowUdpDstPortMetricTag) 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 *unMarshalpatternFlowUdpDstPortMetricTag) 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 *marshalpatternFlowUdpDstPortMetricTag) 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 *unMarshalpatternFlowUdpDstPortMetricTag) 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 *marshalpatternFlowUdpDstPortMetricTag) 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 *unMarshalpatternFlowUdpDstPortMetricTag) 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 *patternFlowUdpDstPortMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowUdpDstPortMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowUdpDstPortMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowUdpDstPortMetricTag) Clone() (PatternFlowUdpDstPortMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowUdpDstPortMetricTag() - 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 -} - -// PatternFlowUdpDstPortMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowUdpDstPortMetricTag interface { - Validation - // msg marshals PatternFlowUdpDstPortMetricTag to protobuf object *otg.PatternFlowUdpDstPortMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowUdpDstPortMetricTag - // setMsg unmarshals PatternFlowUdpDstPortMetricTag from protobuf object *otg.PatternFlowUdpDstPortMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortMetricTag - // provides marshal interface - Marshal() marshalPatternFlowUdpDstPortMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowUdpDstPortMetricTag - // validate validates PatternFlowUdpDstPortMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowUdpDstPortMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowUdpDstPortMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowUdpDstPortMetricTag - SetName(value string) PatternFlowUdpDstPortMetricTag - // Offset returns uint32, set in PatternFlowUdpDstPortMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowUdpDstPortMetricTag - SetOffset(value uint32) PatternFlowUdpDstPortMetricTag - // HasOffset checks if Offset has been set in PatternFlowUdpDstPortMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowUdpDstPortMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowUdpDstPortMetricTag - SetLength(value uint32) PatternFlowUdpDstPortMetricTag - // HasLength checks if Length has been set in PatternFlowUdpDstPortMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowUdpDstPortMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowUdpDstPortMetricTag object -func (obj *patternFlowUdpDstPortMetricTag) SetName(value string) PatternFlowUdpDstPortMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowUdpDstPortMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowUdpDstPortMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowUdpDstPortMetricTag object -func (obj *patternFlowUdpDstPortMetricTag) SetOffset(value uint32) PatternFlowUdpDstPortMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowUdpDstPortMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowUdpDstPortMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowUdpDstPortMetricTag object -func (obj *patternFlowUdpDstPortMetricTag) SetLength(value uint32) PatternFlowUdpDstPortMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowUdpDstPortMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowUdpDstPortMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpDstPortMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowUdpDstPortMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowUdpDstPortMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowUdpDstPortRandom ***** -type patternFlowUdpDstPortRandom struct { - validation - obj *otg.PatternFlowUdpDstPortRandom - marshaller marshalPatternFlowUdpDstPortRandom - unMarshaller unMarshalPatternFlowUdpDstPortRandom -} - -func NewPatternFlowUdpDstPortRandom() PatternFlowUdpDstPortRandom { - obj := patternFlowUdpDstPortRandom{obj: &otg.PatternFlowUdpDstPortRandom{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowUdpDstPortRandom) msg() *otg.PatternFlowUdpDstPortRandom { - return obj.obj -} - -func (obj *patternFlowUdpDstPortRandom) setMsg(msg *otg.PatternFlowUdpDstPortRandom) PatternFlowUdpDstPortRandom { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowUdpDstPortRandom struct { - obj *patternFlowUdpDstPortRandom -} - -type marshalPatternFlowUdpDstPortRandom interface { - // ToProto marshals PatternFlowUdpDstPortRandom to protobuf object *otg.PatternFlowUdpDstPortRandom - ToProto() (*otg.PatternFlowUdpDstPortRandom, error) - // ToPbText marshals PatternFlowUdpDstPortRandom to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowUdpDstPortRandom to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowUdpDstPortRandom to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowUdpDstPortRandom struct { - obj *patternFlowUdpDstPortRandom -} - -type unMarshalPatternFlowUdpDstPortRandom interface { - // FromProto unmarshals PatternFlowUdpDstPortRandom from protobuf object *otg.PatternFlowUdpDstPortRandom - FromProto(msg *otg.PatternFlowUdpDstPortRandom) (PatternFlowUdpDstPortRandom, error) - // FromPbText unmarshals PatternFlowUdpDstPortRandom from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowUdpDstPortRandom from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowUdpDstPortRandom from JSON text - FromJson(value string) error -} - -func (obj *patternFlowUdpDstPortRandom) Marshal() marshalPatternFlowUdpDstPortRandom { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowUdpDstPortRandom{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowUdpDstPortRandom) Unmarshal() unMarshalPatternFlowUdpDstPortRandom { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowUdpDstPortRandom{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowUdpDstPortRandom) ToProto() (*otg.PatternFlowUdpDstPortRandom, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowUdpDstPortRandom) FromProto(msg *otg.PatternFlowUdpDstPortRandom) (PatternFlowUdpDstPortRandom, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowUdpDstPortRandom) 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 *unMarshalpatternFlowUdpDstPortRandom) 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 *marshalpatternFlowUdpDstPortRandom) 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 *unMarshalpatternFlowUdpDstPortRandom) 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 *marshalpatternFlowUdpDstPortRandom) 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 *unMarshalpatternFlowUdpDstPortRandom) 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 *patternFlowUdpDstPortRandom) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowUdpDstPortRandom) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowUdpDstPortRandom) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowUdpDstPortRandom) Clone() (PatternFlowUdpDstPortRandom, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowUdpDstPortRandom() - 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 -} - -// PatternFlowUdpDstPortRandom is integer random pattern -type PatternFlowUdpDstPortRandom interface { - Validation - // msg marshals PatternFlowUdpDstPortRandom to protobuf object *otg.PatternFlowUdpDstPortRandom - // and doesn't set defaults - msg() *otg.PatternFlowUdpDstPortRandom - // setMsg unmarshals PatternFlowUdpDstPortRandom from protobuf object *otg.PatternFlowUdpDstPortRandom - // and doesn't set defaults - setMsg(*otg.PatternFlowUdpDstPortRandom) PatternFlowUdpDstPortRandom - // provides marshal interface - Marshal() marshalPatternFlowUdpDstPortRandom - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowUdpDstPortRandom - // validate validates PatternFlowUdpDstPortRandom - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowUdpDstPortRandom, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Min returns uint32, set in PatternFlowUdpDstPortRandom. - Min() uint32 - // SetMin assigns uint32 provided by user to PatternFlowUdpDstPortRandom - SetMin(value uint32) PatternFlowUdpDstPortRandom - // HasMin checks if Min has been set in PatternFlowUdpDstPortRandom - HasMin() bool - // Max returns uint32, set in PatternFlowUdpDstPortRandom. - Max() uint32 - // SetMax assigns uint32 provided by user to PatternFlowUdpDstPortRandom - SetMax(value uint32) PatternFlowUdpDstPortRandom - // HasMax checks if Max has been set in PatternFlowUdpDstPortRandom - HasMax() bool - // Seed returns uint32, set in PatternFlowUdpDstPortRandom. - Seed() uint32 - // SetSeed assigns uint32 provided by user to PatternFlowUdpDstPortRandom - SetSeed(value uint32) PatternFlowUdpDstPortRandom - // HasSeed checks if Seed has been set in PatternFlowUdpDstPortRandom - HasSeed() bool - // Count returns uint32, set in PatternFlowUdpDstPortRandom. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowUdpDstPortRandom - SetCount(value uint32) PatternFlowUdpDstPortRandom - // HasCount checks if Count has been set in PatternFlowUdpDstPortRandom - HasCount() bool -} - -// The minimum possible value generated by the random value generator. -// Min returns a uint32 -func (obj *patternFlowUdpDstPortRandom) Min() uint32 { - - return *obj.obj.Min - -} - -// The minimum possible value generated by the random value generator. -// Min returns a uint32 -func (obj *patternFlowUdpDstPortRandom) HasMin() bool { - return obj.obj.Min != nil -} - -// The minimum possible value generated by the random value generator. -// SetMin sets the uint32 value in the PatternFlowUdpDstPortRandom object -func (obj *patternFlowUdpDstPortRandom) SetMin(value uint32) PatternFlowUdpDstPortRandom { - - obj.obj.Min = &value - return obj -} - -// The maximum possible value generated by the random value generator. -// Max returns a uint32 -func (obj *patternFlowUdpDstPortRandom) Max() uint32 { - - return *obj.obj.Max - -} - -// The maximum possible value generated by the random value generator. -// Max returns a uint32 -func (obj *patternFlowUdpDstPortRandom) HasMax() bool { - return obj.obj.Max != nil -} - -// The maximum possible value generated by the random value generator. -// SetMax sets the uint32 value in the PatternFlowUdpDstPortRandom object -func (obj *patternFlowUdpDstPortRandom) SetMax(value uint32) PatternFlowUdpDstPortRandom { - - obj.obj.Max = &value - return obj -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// Seed returns a uint32 -func (obj *patternFlowUdpDstPortRandom) Seed() uint32 { - - return *obj.obj.Seed - -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// Seed returns a uint32 -func (obj *patternFlowUdpDstPortRandom) HasSeed() bool { - return obj.obj.Seed != nil -} - -// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). -// SetSeed sets the uint32 value in the PatternFlowUdpDstPortRandom object -func (obj *patternFlowUdpDstPortRandom) SetSeed(value uint32) PatternFlowUdpDstPortRandom { - - obj.obj.Seed = &value - return obj -} - -// The total number of values to be generated by the random value generator. -// Count returns a uint32 -func (obj *patternFlowUdpDstPortRandom) Count() uint32 { - - return *obj.obj.Count - -} - -// The total number of values to be generated by the random value generator. -// Count returns a uint32 -func (obj *patternFlowUdpDstPortRandom) HasCount() bool { - return obj.obj.Count != nil -} - -// The total number of values to be generated by the random value generator. -// SetCount sets the uint32 value in the PatternFlowUdpDstPortRandom object -func (obj *patternFlowUdpDstPortRandom) SetCount(value uint32) PatternFlowUdpDstPortRandom { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowUdpDstPortRandom) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Min != nil { - - if *obj.obj.Min > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpDstPortRandom.Min <= 65535 but Got %d", *obj.obj.Min)) - } - - } - - if obj.obj.Max != nil { - - if *obj.obj.Max > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpDstPortRandom.Max <= 65535 but Got %d", *obj.obj.Max)) - } - - } - -} - -func (obj *patternFlowUdpDstPortRandom) setDefault() { - if obj.obj.Min == nil { - obj.SetMin(0) - } - if obj.obj.Max == nil { - obj.SetMax(65535) - } - if obj.obj.Seed == nil { - obj.SetSeed(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowUdpLengthCounter ***** -type patternFlowUdpLengthCounter struct { - validation - obj *otg.PatternFlowUdpLengthCounter - marshaller marshalPatternFlowUdpLengthCounter - unMarshaller unMarshalPatternFlowUdpLengthCounter -} - -func NewPatternFlowUdpLengthCounter() PatternFlowUdpLengthCounter { - obj := patternFlowUdpLengthCounter{obj: &otg.PatternFlowUdpLengthCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowUdpLengthCounter) msg() *otg.PatternFlowUdpLengthCounter { - return obj.obj -} - -func (obj *patternFlowUdpLengthCounter) setMsg(msg *otg.PatternFlowUdpLengthCounter) PatternFlowUdpLengthCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowUdpLengthCounter struct { - obj *patternFlowUdpLengthCounter -} - -type marshalPatternFlowUdpLengthCounter interface { - // ToProto marshals PatternFlowUdpLengthCounter to protobuf object *otg.PatternFlowUdpLengthCounter - ToProto() (*otg.PatternFlowUdpLengthCounter, error) - // ToPbText marshals PatternFlowUdpLengthCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowUdpLengthCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowUdpLengthCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowUdpLengthCounter struct { - obj *patternFlowUdpLengthCounter -} - -type unMarshalPatternFlowUdpLengthCounter interface { - // FromProto unmarshals PatternFlowUdpLengthCounter from protobuf object *otg.PatternFlowUdpLengthCounter - FromProto(msg *otg.PatternFlowUdpLengthCounter) (PatternFlowUdpLengthCounter, error) - // FromPbText unmarshals PatternFlowUdpLengthCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowUdpLengthCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowUdpLengthCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowUdpLengthCounter) Marshal() marshalPatternFlowUdpLengthCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowUdpLengthCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowUdpLengthCounter) Unmarshal() unMarshalPatternFlowUdpLengthCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowUdpLengthCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowUdpLengthCounter) ToProto() (*otg.PatternFlowUdpLengthCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowUdpLengthCounter) FromProto(msg *otg.PatternFlowUdpLengthCounter) (PatternFlowUdpLengthCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowUdpLengthCounter) 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 *unMarshalpatternFlowUdpLengthCounter) 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 *marshalpatternFlowUdpLengthCounter) 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 *unMarshalpatternFlowUdpLengthCounter) 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 *marshalpatternFlowUdpLengthCounter) 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 *unMarshalpatternFlowUdpLengthCounter) 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 *patternFlowUdpLengthCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowUdpLengthCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowUdpLengthCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowUdpLengthCounter) Clone() (PatternFlowUdpLengthCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowUdpLengthCounter() - 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 -} - -// PatternFlowUdpLengthCounter is integer counter pattern -type PatternFlowUdpLengthCounter interface { - Validation - // msg marshals PatternFlowUdpLengthCounter to protobuf object *otg.PatternFlowUdpLengthCounter - // and doesn't set defaults - msg() *otg.PatternFlowUdpLengthCounter - // setMsg unmarshals PatternFlowUdpLengthCounter from protobuf object *otg.PatternFlowUdpLengthCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowUdpLengthCounter) PatternFlowUdpLengthCounter - // provides marshal interface - Marshal() marshalPatternFlowUdpLengthCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowUdpLengthCounter - // validate validates PatternFlowUdpLengthCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowUdpLengthCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowUdpLengthCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowUdpLengthCounter - SetStart(value uint32) PatternFlowUdpLengthCounter - // HasStart checks if Start has been set in PatternFlowUdpLengthCounter - HasStart() bool - // Step returns uint32, set in PatternFlowUdpLengthCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowUdpLengthCounter - SetStep(value uint32) PatternFlowUdpLengthCounter - // HasStep checks if Step has been set in PatternFlowUdpLengthCounter - HasStep() bool - // Count returns uint32, set in PatternFlowUdpLengthCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowUdpLengthCounter - SetCount(value uint32) PatternFlowUdpLengthCounter - // HasCount checks if Count has been set in PatternFlowUdpLengthCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowUdpLengthCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowUdpLengthCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowUdpLengthCounter object -func (obj *patternFlowUdpLengthCounter) SetStart(value uint32) PatternFlowUdpLengthCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowUdpLengthCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowUdpLengthCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowUdpLengthCounter object -func (obj *patternFlowUdpLengthCounter) SetStep(value uint32) PatternFlowUdpLengthCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowUdpLengthCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowUdpLengthCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowUdpLengthCounter object -func (obj *patternFlowUdpLengthCounter) SetCount(value uint32) PatternFlowUdpLengthCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowUdpLengthCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpLengthCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpLengthCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpLengthCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowUdpLengthCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowUdpLengthMetricTag ***** -type patternFlowUdpLengthMetricTag struct { - validation - obj *otg.PatternFlowUdpLengthMetricTag - marshaller marshalPatternFlowUdpLengthMetricTag - unMarshaller unMarshalPatternFlowUdpLengthMetricTag -} - -func NewPatternFlowUdpLengthMetricTag() PatternFlowUdpLengthMetricTag { - obj := patternFlowUdpLengthMetricTag{obj: &otg.PatternFlowUdpLengthMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowUdpLengthMetricTag) msg() *otg.PatternFlowUdpLengthMetricTag { - return obj.obj -} - -func (obj *patternFlowUdpLengthMetricTag) setMsg(msg *otg.PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowUdpLengthMetricTag struct { - obj *patternFlowUdpLengthMetricTag -} - -type marshalPatternFlowUdpLengthMetricTag interface { - // ToProto marshals PatternFlowUdpLengthMetricTag to protobuf object *otg.PatternFlowUdpLengthMetricTag - ToProto() (*otg.PatternFlowUdpLengthMetricTag, error) - // ToPbText marshals PatternFlowUdpLengthMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowUdpLengthMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowUdpLengthMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowUdpLengthMetricTag struct { - obj *patternFlowUdpLengthMetricTag -} - -type unMarshalPatternFlowUdpLengthMetricTag interface { - // FromProto unmarshals PatternFlowUdpLengthMetricTag from protobuf object *otg.PatternFlowUdpLengthMetricTag - FromProto(msg *otg.PatternFlowUdpLengthMetricTag) (PatternFlowUdpLengthMetricTag, error) - // FromPbText unmarshals PatternFlowUdpLengthMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowUdpLengthMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowUdpLengthMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowUdpLengthMetricTag) Marshal() marshalPatternFlowUdpLengthMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowUdpLengthMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowUdpLengthMetricTag) Unmarshal() unMarshalPatternFlowUdpLengthMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowUdpLengthMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowUdpLengthMetricTag) ToProto() (*otg.PatternFlowUdpLengthMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowUdpLengthMetricTag) FromProto(msg *otg.PatternFlowUdpLengthMetricTag) (PatternFlowUdpLengthMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowUdpLengthMetricTag) 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 *unMarshalpatternFlowUdpLengthMetricTag) 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 *marshalpatternFlowUdpLengthMetricTag) 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 *unMarshalpatternFlowUdpLengthMetricTag) 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 *marshalpatternFlowUdpLengthMetricTag) 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 *unMarshalpatternFlowUdpLengthMetricTag) 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 *patternFlowUdpLengthMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowUdpLengthMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowUdpLengthMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowUdpLengthMetricTag) Clone() (PatternFlowUdpLengthMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowUdpLengthMetricTag() - 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 -} - -// PatternFlowUdpLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowUdpLengthMetricTag interface { - Validation - // msg marshals PatternFlowUdpLengthMetricTag to protobuf object *otg.PatternFlowUdpLengthMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowUdpLengthMetricTag - // setMsg unmarshals PatternFlowUdpLengthMetricTag from protobuf object *otg.PatternFlowUdpLengthMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthMetricTag - // provides marshal interface - Marshal() marshalPatternFlowUdpLengthMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowUdpLengthMetricTag - // validate validates PatternFlowUdpLengthMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowUdpLengthMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowUdpLengthMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowUdpLengthMetricTag - SetName(value string) PatternFlowUdpLengthMetricTag - // Offset returns uint32, set in PatternFlowUdpLengthMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowUdpLengthMetricTag - SetOffset(value uint32) PatternFlowUdpLengthMetricTag - // HasOffset checks if Offset has been set in PatternFlowUdpLengthMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowUdpLengthMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowUdpLengthMetricTag - SetLength(value uint32) PatternFlowUdpLengthMetricTag - // HasLength checks if Length has been set in PatternFlowUdpLengthMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowUdpLengthMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowUdpLengthMetricTag object -func (obj *patternFlowUdpLengthMetricTag) SetName(value string) PatternFlowUdpLengthMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowUdpLengthMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowUdpLengthMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowUdpLengthMetricTag object -func (obj *patternFlowUdpLengthMetricTag) SetOffset(value uint32) PatternFlowUdpLengthMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowUdpLengthMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowUdpLengthMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowUdpLengthMetricTag object -func (obj *patternFlowUdpLengthMetricTag) SetLength(value uint32) PatternFlowUdpLengthMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowUdpLengthMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowUdpLengthMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowUdpLengthMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowUdpLengthMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowUdpLengthMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowGreChecksumPresentCounter ***** -type patternFlowGreChecksumPresentCounter struct { - validation - obj *otg.PatternFlowGreChecksumPresentCounter - marshaller marshalPatternFlowGreChecksumPresentCounter - unMarshaller unMarshalPatternFlowGreChecksumPresentCounter -} - -func NewPatternFlowGreChecksumPresentCounter() PatternFlowGreChecksumPresentCounter { - obj := patternFlowGreChecksumPresentCounter{obj: &otg.PatternFlowGreChecksumPresentCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreChecksumPresentCounter) msg() *otg.PatternFlowGreChecksumPresentCounter { - return obj.obj -} - -func (obj *patternFlowGreChecksumPresentCounter) setMsg(msg *otg.PatternFlowGreChecksumPresentCounter) PatternFlowGreChecksumPresentCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreChecksumPresentCounter struct { - obj *patternFlowGreChecksumPresentCounter -} - -type marshalPatternFlowGreChecksumPresentCounter interface { - // ToProto marshals PatternFlowGreChecksumPresentCounter to protobuf object *otg.PatternFlowGreChecksumPresentCounter - ToProto() (*otg.PatternFlowGreChecksumPresentCounter, error) - // ToPbText marshals PatternFlowGreChecksumPresentCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreChecksumPresentCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreChecksumPresentCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreChecksumPresentCounter struct { - obj *patternFlowGreChecksumPresentCounter -} - -type unMarshalPatternFlowGreChecksumPresentCounter interface { - // FromProto unmarshals PatternFlowGreChecksumPresentCounter from protobuf object *otg.PatternFlowGreChecksumPresentCounter - FromProto(msg *otg.PatternFlowGreChecksumPresentCounter) (PatternFlowGreChecksumPresentCounter, error) - // FromPbText unmarshals PatternFlowGreChecksumPresentCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreChecksumPresentCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreChecksumPresentCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreChecksumPresentCounter) Marshal() marshalPatternFlowGreChecksumPresentCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreChecksumPresentCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreChecksumPresentCounter) Unmarshal() unMarshalPatternFlowGreChecksumPresentCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreChecksumPresentCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreChecksumPresentCounter) ToProto() (*otg.PatternFlowGreChecksumPresentCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreChecksumPresentCounter) FromProto(msg *otg.PatternFlowGreChecksumPresentCounter) (PatternFlowGreChecksumPresentCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreChecksumPresentCounter) 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 *unMarshalpatternFlowGreChecksumPresentCounter) 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 *marshalpatternFlowGreChecksumPresentCounter) 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 *unMarshalpatternFlowGreChecksumPresentCounter) 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 *marshalpatternFlowGreChecksumPresentCounter) 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 *unMarshalpatternFlowGreChecksumPresentCounter) 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 *patternFlowGreChecksumPresentCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreChecksumPresentCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreChecksumPresentCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreChecksumPresentCounter) Clone() (PatternFlowGreChecksumPresentCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreChecksumPresentCounter() - 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 -} - -// PatternFlowGreChecksumPresentCounter is integer counter pattern -type PatternFlowGreChecksumPresentCounter interface { - Validation - // msg marshals PatternFlowGreChecksumPresentCounter to protobuf object *otg.PatternFlowGreChecksumPresentCounter - // and doesn't set defaults - msg() *otg.PatternFlowGreChecksumPresentCounter - // setMsg unmarshals PatternFlowGreChecksumPresentCounter from protobuf object *otg.PatternFlowGreChecksumPresentCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGreChecksumPresentCounter) PatternFlowGreChecksumPresentCounter - // provides marshal interface - Marshal() marshalPatternFlowGreChecksumPresentCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreChecksumPresentCounter - // validate validates PatternFlowGreChecksumPresentCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreChecksumPresentCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGreChecksumPresentCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGreChecksumPresentCounter - SetStart(value uint32) PatternFlowGreChecksumPresentCounter - // HasStart checks if Start has been set in PatternFlowGreChecksumPresentCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGreChecksumPresentCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGreChecksumPresentCounter - SetStep(value uint32) PatternFlowGreChecksumPresentCounter - // HasStep checks if Step has been set in PatternFlowGreChecksumPresentCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGreChecksumPresentCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGreChecksumPresentCounter - SetCount(value uint32) PatternFlowGreChecksumPresentCounter - // HasCount checks if Count has been set in PatternFlowGreChecksumPresentCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGreChecksumPresentCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGreChecksumPresentCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGreChecksumPresentCounter object -func (obj *patternFlowGreChecksumPresentCounter) SetStart(value uint32) PatternFlowGreChecksumPresentCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGreChecksumPresentCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGreChecksumPresentCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGreChecksumPresentCounter object -func (obj *patternFlowGreChecksumPresentCounter) SetStep(value uint32) PatternFlowGreChecksumPresentCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGreChecksumPresentCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGreChecksumPresentCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGreChecksumPresentCounter object -func (obj *patternFlowGreChecksumPresentCounter) SetCount(value uint32) PatternFlowGreChecksumPresentCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGreChecksumPresentCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreChecksumPresentCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreChecksumPresentCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreChecksumPresentCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGreChecksumPresentCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGreChecksumPresentMetricTag ***** -type patternFlowGreChecksumPresentMetricTag struct { - validation - obj *otg.PatternFlowGreChecksumPresentMetricTag - marshaller marshalPatternFlowGreChecksumPresentMetricTag - unMarshaller unMarshalPatternFlowGreChecksumPresentMetricTag -} - -func NewPatternFlowGreChecksumPresentMetricTag() PatternFlowGreChecksumPresentMetricTag { - obj := patternFlowGreChecksumPresentMetricTag{obj: &otg.PatternFlowGreChecksumPresentMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreChecksumPresentMetricTag) msg() *otg.PatternFlowGreChecksumPresentMetricTag { - return obj.obj -} - -func (obj *patternFlowGreChecksumPresentMetricTag) setMsg(msg *otg.PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreChecksumPresentMetricTag struct { - obj *patternFlowGreChecksumPresentMetricTag -} - -type marshalPatternFlowGreChecksumPresentMetricTag interface { - // ToProto marshals PatternFlowGreChecksumPresentMetricTag to protobuf object *otg.PatternFlowGreChecksumPresentMetricTag - ToProto() (*otg.PatternFlowGreChecksumPresentMetricTag, error) - // ToPbText marshals PatternFlowGreChecksumPresentMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreChecksumPresentMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreChecksumPresentMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreChecksumPresentMetricTag struct { - obj *patternFlowGreChecksumPresentMetricTag -} - -type unMarshalPatternFlowGreChecksumPresentMetricTag interface { - // FromProto unmarshals PatternFlowGreChecksumPresentMetricTag from protobuf object *otg.PatternFlowGreChecksumPresentMetricTag - FromProto(msg *otg.PatternFlowGreChecksumPresentMetricTag) (PatternFlowGreChecksumPresentMetricTag, error) - // FromPbText unmarshals PatternFlowGreChecksumPresentMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreChecksumPresentMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreChecksumPresentMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreChecksumPresentMetricTag) Marshal() marshalPatternFlowGreChecksumPresentMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreChecksumPresentMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreChecksumPresentMetricTag) Unmarshal() unMarshalPatternFlowGreChecksumPresentMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreChecksumPresentMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreChecksumPresentMetricTag) ToProto() (*otg.PatternFlowGreChecksumPresentMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreChecksumPresentMetricTag) FromProto(msg *otg.PatternFlowGreChecksumPresentMetricTag) (PatternFlowGreChecksumPresentMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreChecksumPresentMetricTag) 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 *unMarshalpatternFlowGreChecksumPresentMetricTag) 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 *marshalpatternFlowGreChecksumPresentMetricTag) 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 *unMarshalpatternFlowGreChecksumPresentMetricTag) 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 *marshalpatternFlowGreChecksumPresentMetricTag) 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 *unMarshalpatternFlowGreChecksumPresentMetricTag) 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 *patternFlowGreChecksumPresentMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreChecksumPresentMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreChecksumPresentMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreChecksumPresentMetricTag) Clone() (PatternFlowGreChecksumPresentMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreChecksumPresentMetricTag() - 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 -} - -// PatternFlowGreChecksumPresentMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGreChecksumPresentMetricTag interface { - Validation - // msg marshals PatternFlowGreChecksumPresentMetricTag to protobuf object *otg.PatternFlowGreChecksumPresentMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGreChecksumPresentMetricTag - // setMsg unmarshals PatternFlowGreChecksumPresentMetricTag from protobuf object *otg.PatternFlowGreChecksumPresentMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGreChecksumPresentMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreChecksumPresentMetricTag - // validate validates PatternFlowGreChecksumPresentMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreChecksumPresentMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGreChecksumPresentMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGreChecksumPresentMetricTag - SetName(value string) PatternFlowGreChecksumPresentMetricTag - // Offset returns uint32, set in PatternFlowGreChecksumPresentMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGreChecksumPresentMetricTag - SetOffset(value uint32) PatternFlowGreChecksumPresentMetricTag - // HasOffset checks if Offset has been set in PatternFlowGreChecksumPresentMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGreChecksumPresentMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGreChecksumPresentMetricTag - SetLength(value uint32) PatternFlowGreChecksumPresentMetricTag - // HasLength checks if Length has been set in PatternFlowGreChecksumPresentMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGreChecksumPresentMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGreChecksumPresentMetricTag object -func (obj *patternFlowGreChecksumPresentMetricTag) SetName(value string) PatternFlowGreChecksumPresentMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGreChecksumPresentMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGreChecksumPresentMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGreChecksumPresentMetricTag object -func (obj *patternFlowGreChecksumPresentMetricTag) SetOffset(value uint32) PatternFlowGreChecksumPresentMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGreChecksumPresentMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGreChecksumPresentMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGreChecksumPresentMetricTag object -func (obj *patternFlowGreChecksumPresentMetricTag) SetLength(value uint32) PatternFlowGreChecksumPresentMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGreChecksumPresentMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGreChecksumPresentMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreChecksumPresentMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGreChecksumPresentMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGreChecksumPresentMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowGreReserved0Counter ***** -type patternFlowGreReserved0Counter struct { - validation - obj *otg.PatternFlowGreReserved0Counter - marshaller marshalPatternFlowGreReserved0Counter - unMarshaller unMarshalPatternFlowGreReserved0Counter -} - -func NewPatternFlowGreReserved0Counter() PatternFlowGreReserved0Counter { - obj := patternFlowGreReserved0Counter{obj: &otg.PatternFlowGreReserved0Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreReserved0Counter) msg() *otg.PatternFlowGreReserved0Counter { - return obj.obj -} - -func (obj *patternFlowGreReserved0Counter) setMsg(msg *otg.PatternFlowGreReserved0Counter) PatternFlowGreReserved0Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreReserved0Counter struct { - obj *patternFlowGreReserved0Counter -} - -type marshalPatternFlowGreReserved0Counter interface { - // ToProto marshals PatternFlowGreReserved0Counter to protobuf object *otg.PatternFlowGreReserved0Counter - ToProto() (*otg.PatternFlowGreReserved0Counter, error) - // ToPbText marshals PatternFlowGreReserved0Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreReserved0Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreReserved0Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreReserved0Counter struct { - obj *patternFlowGreReserved0Counter -} - -type unMarshalPatternFlowGreReserved0Counter interface { - // FromProto unmarshals PatternFlowGreReserved0Counter from protobuf object *otg.PatternFlowGreReserved0Counter - FromProto(msg *otg.PatternFlowGreReserved0Counter) (PatternFlowGreReserved0Counter, error) - // FromPbText unmarshals PatternFlowGreReserved0Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreReserved0Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreReserved0Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreReserved0Counter) Marshal() marshalPatternFlowGreReserved0Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreReserved0Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreReserved0Counter) Unmarshal() unMarshalPatternFlowGreReserved0Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreReserved0Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreReserved0Counter) ToProto() (*otg.PatternFlowGreReserved0Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreReserved0Counter) FromProto(msg *otg.PatternFlowGreReserved0Counter) (PatternFlowGreReserved0Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreReserved0Counter) 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 *unMarshalpatternFlowGreReserved0Counter) 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 *marshalpatternFlowGreReserved0Counter) 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 *unMarshalpatternFlowGreReserved0Counter) 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 *marshalpatternFlowGreReserved0Counter) 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 *unMarshalpatternFlowGreReserved0Counter) 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 *patternFlowGreReserved0Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreReserved0Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreReserved0Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreReserved0Counter) Clone() (PatternFlowGreReserved0Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreReserved0Counter() - 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 -} - -// PatternFlowGreReserved0Counter is integer counter pattern -type PatternFlowGreReserved0Counter interface { - Validation - // msg marshals PatternFlowGreReserved0Counter to protobuf object *otg.PatternFlowGreReserved0Counter - // and doesn't set defaults - msg() *otg.PatternFlowGreReserved0Counter - // setMsg unmarshals PatternFlowGreReserved0Counter from protobuf object *otg.PatternFlowGreReserved0Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowGreReserved0Counter) PatternFlowGreReserved0Counter - // provides marshal interface - Marshal() marshalPatternFlowGreReserved0Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreReserved0Counter - // validate validates PatternFlowGreReserved0Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreReserved0Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGreReserved0Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGreReserved0Counter - SetStart(value uint32) PatternFlowGreReserved0Counter - // HasStart checks if Start has been set in PatternFlowGreReserved0Counter - HasStart() bool - // Step returns uint32, set in PatternFlowGreReserved0Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGreReserved0Counter - SetStep(value uint32) PatternFlowGreReserved0Counter - // HasStep checks if Step has been set in PatternFlowGreReserved0Counter - HasStep() bool - // Count returns uint32, set in PatternFlowGreReserved0Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGreReserved0Counter - SetCount(value uint32) PatternFlowGreReserved0Counter - // HasCount checks if Count has been set in PatternFlowGreReserved0Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGreReserved0Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGreReserved0Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGreReserved0Counter object -func (obj *patternFlowGreReserved0Counter) SetStart(value uint32) PatternFlowGreReserved0Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGreReserved0Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGreReserved0Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGreReserved0Counter object -func (obj *patternFlowGreReserved0Counter) SetStep(value uint32) PatternFlowGreReserved0Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGreReserved0Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGreReserved0Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGreReserved0Counter object -func (obj *patternFlowGreReserved0Counter) SetCount(value uint32) PatternFlowGreReserved0Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGreReserved0Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreReserved0Counter.Start <= 4095 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreReserved0Counter.Step <= 4095 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreReserved0Counter.Count <= 4095 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGreReserved0Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGreReserved0MetricTag ***** -type patternFlowGreReserved0MetricTag struct { - validation - obj *otg.PatternFlowGreReserved0MetricTag - marshaller marshalPatternFlowGreReserved0MetricTag - unMarshaller unMarshalPatternFlowGreReserved0MetricTag -} - -func NewPatternFlowGreReserved0MetricTag() PatternFlowGreReserved0MetricTag { - obj := patternFlowGreReserved0MetricTag{obj: &otg.PatternFlowGreReserved0MetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreReserved0MetricTag) msg() *otg.PatternFlowGreReserved0MetricTag { - return obj.obj -} - -func (obj *patternFlowGreReserved0MetricTag) setMsg(msg *otg.PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0MetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreReserved0MetricTag struct { - obj *patternFlowGreReserved0MetricTag -} - -type marshalPatternFlowGreReserved0MetricTag interface { - // ToProto marshals PatternFlowGreReserved0MetricTag to protobuf object *otg.PatternFlowGreReserved0MetricTag - ToProto() (*otg.PatternFlowGreReserved0MetricTag, error) - // ToPbText marshals PatternFlowGreReserved0MetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreReserved0MetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreReserved0MetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreReserved0MetricTag struct { - obj *patternFlowGreReserved0MetricTag -} - -type unMarshalPatternFlowGreReserved0MetricTag interface { - // FromProto unmarshals PatternFlowGreReserved0MetricTag from protobuf object *otg.PatternFlowGreReserved0MetricTag - FromProto(msg *otg.PatternFlowGreReserved0MetricTag) (PatternFlowGreReserved0MetricTag, error) - // FromPbText unmarshals PatternFlowGreReserved0MetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreReserved0MetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreReserved0MetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreReserved0MetricTag) Marshal() marshalPatternFlowGreReserved0MetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreReserved0MetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreReserved0MetricTag) Unmarshal() unMarshalPatternFlowGreReserved0MetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreReserved0MetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreReserved0MetricTag) ToProto() (*otg.PatternFlowGreReserved0MetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreReserved0MetricTag) FromProto(msg *otg.PatternFlowGreReserved0MetricTag) (PatternFlowGreReserved0MetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreReserved0MetricTag) 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 *unMarshalpatternFlowGreReserved0MetricTag) 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 *marshalpatternFlowGreReserved0MetricTag) 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 *unMarshalpatternFlowGreReserved0MetricTag) 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 *marshalpatternFlowGreReserved0MetricTag) 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 *unMarshalpatternFlowGreReserved0MetricTag) 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 *patternFlowGreReserved0MetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreReserved0MetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreReserved0MetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreReserved0MetricTag) Clone() (PatternFlowGreReserved0MetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreReserved0MetricTag() - 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 -} - -// PatternFlowGreReserved0MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGreReserved0MetricTag interface { - Validation - // msg marshals PatternFlowGreReserved0MetricTag to protobuf object *otg.PatternFlowGreReserved0MetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGreReserved0MetricTag - // setMsg unmarshals PatternFlowGreReserved0MetricTag from protobuf object *otg.PatternFlowGreReserved0MetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0MetricTag - // provides marshal interface - Marshal() marshalPatternFlowGreReserved0MetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreReserved0MetricTag - // validate validates PatternFlowGreReserved0MetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreReserved0MetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGreReserved0MetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGreReserved0MetricTag - SetName(value string) PatternFlowGreReserved0MetricTag - // Offset returns uint32, set in PatternFlowGreReserved0MetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGreReserved0MetricTag - SetOffset(value uint32) PatternFlowGreReserved0MetricTag - // HasOffset checks if Offset has been set in PatternFlowGreReserved0MetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGreReserved0MetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGreReserved0MetricTag - SetLength(value uint32) PatternFlowGreReserved0MetricTag - // HasLength checks if Length has been set in PatternFlowGreReserved0MetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGreReserved0MetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGreReserved0MetricTag object -func (obj *patternFlowGreReserved0MetricTag) SetName(value string) PatternFlowGreReserved0MetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGreReserved0MetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGreReserved0MetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGreReserved0MetricTag object -func (obj *patternFlowGreReserved0MetricTag) SetOffset(value uint32) PatternFlowGreReserved0MetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGreReserved0MetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGreReserved0MetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGreReserved0MetricTag object -func (obj *patternFlowGreReserved0MetricTag) SetLength(value uint32) PatternFlowGreReserved0MetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGreReserved0MetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGreReserved0MetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 11 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreReserved0MetricTag.Offset <= 11 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 12 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGreReserved0MetricTag.Length <= 12 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGreReserved0MetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(12) - } - -} - -// ***** PatternFlowGreVersionCounter ***** -type patternFlowGreVersionCounter struct { - validation - obj *otg.PatternFlowGreVersionCounter - marshaller marshalPatternFlowGreVersionCounter - unMarshaller unMarshalPatternFlowGreVersionCounter -} - -func NewPatternFlowGreVersionCounter() PatternFlowGreVersionCounter { - obj := patternFlowGreVersionCounter{obj: &otg.PatternFlowGreVersionCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreVersionCounter) msg() *otg.PatternFlowGreVersionCounter { - return obj.obj -} - -func (obj *patternFlowGreVersionCounter) setMsg(msg *otg.PatternFlowGreVersionCounter) PatternFlowGreVersionCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreVersionCounter struct { - obj *patternFlowGreVersionCounter -} - -type marshalPatternFlowGreVersionCounter interface { - // ToProto marshals PatternFlowGreVersionCounter to protobuf object *otg.PatternFlowGreVersionCounter - ToProto() (*otg.PatternFlowGreVersionCounter, error) - // ToPbText marshals PatternFlowGreVersionCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreVersionCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreVersionCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreVersionCounter struct { - obj *patternFlowGreVersionCounter -} - -type unMarshalPatternFlowGreVersionCounter interface { - // FromProto unmarshals PatternFlowGreVersionCounter from protobuf object *otg.PatternFlowGreVersionCounter - FromProto(msg *otg.PatternFlowGreVersionCounter) (PatternFlowGreVersionCounter, error) - // FromPbText unmarshals PatternFlowGreVersionCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreVersionCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreVersionCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreVersionCounter) Marshal() marshalPatternFlowGreVersionCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreVersionCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreVersionCounter) Unmarshal() unMarshalPatternFlowGreVersionCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreVersionCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreVersionCounter) ToProto() (*otg.PatternFlowGreVersionCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreVersionCounter) FromProto(msg *otg.PatternFlowGreVersionCounter) (PatternFlowGreVersionCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreVersionCounter) 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 *unMarshalpatternFlowGreVersionCounter) 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 *marshalpatternFlowGreVersionCounter) 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 *unMarshalpatternFlowGreVersionCounter) 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 *marshalpatternFlowGreVersionCounter) 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 *unMarshalpatternFlowGreVersionCounter) 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 *patternFlowGreVersionCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreVersionCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreVersionCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreVersionCounter) Clone() (PatternFlowGreVersionCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreVersionCounter() - 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 -} - -// PatternFlowGreVersionCounter is integer counter pattern -type PatternFlowGreVersionCounter interface { - Validation - // msg marshals PatternFlowGreVersionCounter to protobuf object *otg.PatternFlowGreVersionCounter - // and doesn't set defaults - msg() *otg.PatternFlowGreVersionCounter - // setMsg unmarshals PatternFlowGreVersionCounter from protobuf object *otg.PatternFlowGreVersionCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGreVersionCounter) PatternFlowGreVersionCounter - // provides marshal interface - Marshal() marshalPatternFlowGreVersionCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreVersionCounter - // validate validates PatternFlowGreVersionCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreVersionCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGreVersionCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGreVersionCounter - SetStart(value uint32) PatternFlowGreVersionCounter - // HasStart checks if Start has been set in PatternFlowGreVersionCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGreVersionCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGreVersionCounter - SetStep(value uint32) PatternFlowGreVersionCounter - // HasStep checks if Step has been set in PatternFlowGreVersionCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGreVersionCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGreVersionCounter - SetCount(value uint32) PatternFlowGreVersionCounter - // HasCount checks if Count has been set in PatternFlowGreVersionCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGreVersionCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGreVersionCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGreVersionCounter object -func (obj *patternFlowGreVersionCounter) SetStart(value uint32) PatternFlowGreVersionCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGreVersionCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGreVersionCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGreVersionCounter object -func (obj *patternFlowGreVersionCounter) SetStep(value uint32) PatternFlowGreVersionCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGreVersionCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGreVersionCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGreVersionCounter object -func (obj *patternFlowGreVersionCounter) SetCount(value uint32) PatternFlowGreVersionCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGreVersionCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreVersionCounter.Start <= 7 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreVersionCounter.Step <= 7 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreVersionCounter.Count <= 7 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGreVersionCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGreVersionMetricTag ***** -type patternFlowGreVersionMetricTag struct { - validation - obj *otg.PatternFlowGreVersionMetricTag - marshaller marshalPatternFlowGreVersionMetricTag - unMarshaller unMarshalPatternFlowGreVersionMetricTag -} - -func NewPatternFlowGreVersionMetricTag() PatternFlowGreVersionMetricTag { - obj := patternFlowGreVersionMetricTag{obj: &otg.PatternFlowGreVersionMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreVersionMetricTag) msg() *otg.PatternFlowGreVersionMetricTag { - return obj.obj -} - -func (obj *patternFlowGreVersionMetricTag) setMsg(msg *otg.PatternFlowGreVersionMetricTag) PatternFlowGreVersionMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreVersionMetricTag struct { - obj *patternFlowGreVersionMetricTag -} - -type marshalPatternFlowGreVersionMetricTag interface { - // ToProto marshals PatternFlowGreVersionMetricTag to protobuf object *otg.PatternFlowGreVersionMetricTag - ToProto() (*otg.PatternFlowGreVersionMetricTag, error) - // ToPbText marshals PatternFlowGreVersionMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreVersionMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreVersionMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreVersionMetricTag struct { - obj *patternFlowGreVersionMetricTag -} - -type unMarshalPatternFlowGreVersionMetricTag interface { - // FromProto unmarshals PatternFlowGreVersionMetricTag from protobuf object *otg.PatternFlowGreVersionMetricTag - FromProto(msg *otg.PatternFlowGreVersionMetricTag) (PatternFlowGreVersionMetricTag, error) - // FromPbText unmarshals PatternFlowGreVersionMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreVersionMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreVersionMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreVersionMetricTag) Marshal() marshalPatternFlowGreVersionMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreVersionMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreVersionMetricTag) Unmarshal() unMarshalPatternFlowGreVersionMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreVersionMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreVersionMetricTag) ToProto() (*otg.PatternFlowGreVersionMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreVersionMetricTag) FromProto(msg *otg.PatternFlowGreVersionMetricTag) (PatternFlowGreVersionMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreVersionMetricTag) 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 *unMarshalpatternFlowGreVersionMetricTag) 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 *marshalpatternFlowGreVersionMetricTag) 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 *unMarshalpatternFlowGreVersionMetricTag) 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 *marshalpatternFlowGreVersionMetricTag) 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 *unMarshalpatternFlowGreVersionMetricTag) 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 *patternFlowGreVersionMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreVersionMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreVersionMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreVersionMetricTag) Clone() (PatternFlowGreVersionMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreVersionMetricTag() - 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 -} - -// PatternFlowGreVersionMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGreVersionMetricTag interface { - Validation - // msg marshals PatternFlowGreVersionMetricTag to protobuf object *otg.PatternFlowGreVersionMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGreVersionMetricTag - // setMsg unmarshals PatternFlowGreVersionMetricTag from protobuf object *otg.PatternFlowGreVersionMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGreVersionMetricTag) PatternFlowGreVersionMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGreVersionMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreVersionMetricTag - // validate validates PatternFlowGreVersionMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreVersionMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGreVersionMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGreVersionMetricTag - SetName(value string) PatternFlowGreVersionMetricTag - // Offset returns uint32, set in PatternFlowGreVersionMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGreVersionMetricTag - SetOffset(value uint32) PatternFlowGreVersionMetricTag - // HasOffset checks if Offset has been set in PatternFlowGreVersionMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGreVersionMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGreVersionMetricTag - SetLength(value uint32) PatternFlowGreVersionMetricTag - // HasLength checks if Length has been set in PatternFlowGreVersionMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGreVersionMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGreVersionMetricTag object -func (obj *patternFlowGreVersionMetricTag) SetName(value string) PatternFlowGreVersionMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGreVersionMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGreVersionMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGreVersionMetricTag object -func (obj *patternFlowGreVersionMetricTag) SetOffset(value uint32) PatternFlowGreVersionMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGreVersionMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGreVersionMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGreVersionMetricTag object -func (obj *patternFlowGreVersionMetricTag) SetLength(value uint32) PatternFlowGreVersionMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGreVersionMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGreVersionMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 2 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreVersionMetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGreVersionMetricTag.Length <= 3 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGreVersionMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(3) - } - -} - -// ***** PatternFlowGreProtocolCounter ***** -type patternFlowGreProtocolCounter struct { - validation - obj *otg.PatternFlowGreProtocolCounter - marshaller marshalPatternFlowGreProtocolCounter - unMarshaller unMarshalPatternFlowGreProtocolCounter -} - -func NewPatternFlowGreProtocolCounter() PatternFlowGreProtocolCounter { - obj := patternFlowGreProtocolCounter{obj: &otg.PatternFlowGreProtocolCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreProtocolCounter) msg() *otg.PatternFlowGreProtocolCounter { - return obj.obj -} - -func (obj *patternFlowGreProtocolCounter) setMsg(msg *otg.PatternFlowGreProtocolCounter) PatternFlowGreProtocolCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreProtocolCounter struct { - obj *patternFlowGreProtocolCounter -} - -type marshalPatternFlowGreProtocolCounter interface { - // ToProto marshals PatternFlowGreProtocolCounter to protobuf object *otg.PatternFlowGreProtocolCounter - ToProto() (*otg.PatternFlowGreProtocolCounter, error) - // ToPbText marshals PatternFlowGreProtocolCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreProtocolCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreProtocolCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreProtocolCounter struct { - obj *patternFlowGreProtocolCounter -} - -type unMarshalPatternFlowGreProtocolCounter interface { - // FromProto unmarshals PatternFlowGreProtocolCounter from protobuf object *otg.PatternFlowGreProtocolCounter - FromProto(msg *otg.PatternFlowGreProtocolCounter) (PatternFlowGreProtocolCounter, error) - // FromPbText unmarshals PatternFlowGreProtocolCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreProtocolCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreProtocolCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreProtocolCounter) Marshal() marshalPatternFlowGreProtocolCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreProtocolCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreProtocolCounter) Unmarshal() unMarshalPatternFlowGreProtocolCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreProtocolCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreProtocolCounter) ToProto() (*otg.PatternFlowGreProtocolCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreProtocolCounter) FromProto(msg *otg.PatternFlowGreProtocolCounter) (PatternFlowGreProtocolCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreProtocolCounter) 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 *unMarshalpatternFlowGreProtocolCounter) 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 *marshalpatternFlowGreProtocolCounter) 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 *unMarshalpatternFlowGreProtocolCounter) 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 *marshalpatternFlowGreProtocolCounter) 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 *unMarshalpatternFlowGreProtocolCounter) 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 *patternFlowGreProtocolCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreProtocolCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreProtocolCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreProtocolCounter) Clone() (PatternFlowGreProtocolCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreProtocolCounter() - 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 -} - -// PatternFlowGreProtocolCounter is integer counter pattern -type PatternFlowGreProtocolCounter interface { - Validation - // msg marshals PatternFlowGreProtocolCounter to protobuf object *otg.PatternFlowGreProtocolCounter - // and doesn't set defaults - msg() *otg.PatternFlowGreProtocolCounter - // setMsg unmarshals PatternFlowGreProtocolCounter from protobuf object *otg.PatternFlowGreProtocolCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGreProtocolCounter) PatternFlowGreProtocolCounter - // provides marshal interface - Marshal() marshalPatternFlowGreProtocolCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreProtocolCounter - // validate validates PatternFlowGreProtocolCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreProtocolCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGreProtocolCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGreProtocolCounter - SetStart(value uint32) PatternFlowGreProtocolCounter - // HasStart checks if Start has been set in PatternFlowGreProtocolCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGreProtocolCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGreProtocolCounter - SetStep(value uint32) PatternFlowGreProtocolCounter - // HasStep checks if Step has been set in PatternFlowGreProtocolCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGreProtocolCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGreProtocolCounter - SetCount(value uint32) PatternFlowGreProtocolCounter - // HasCount checks if Count has been set in PatternFlowGreProtocolCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGreProtocolCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGreProtocolCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGreProtocolCounter object -func (obj *patternFlowGreProtocolCounter) SetStart(value uint32) PatternFlowGreProtocolCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGreProtocolCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGreProtocolCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGreProtocolCounter object -func (obj *patternFlowGreProtocolCounter) SetStep(value uint32) PatternFlowGreProtocolCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGreProtocolCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGreProtocolCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGreProtocolCounter object -func (obj *patternFlowGreProtocolCounter) SetCount(value uint32) PatternFlowGreProtocolCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGreProtocolCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreProtocolCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreProtocolCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreProtocolCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGreProtocolCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(2048) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGreProtocolMetricTag ***** -type patternFlowGreProtocolMetricTag struct { - validation - obj *otg.PatternFlowGreProtocolMetricTag - marshaller marshalPatternFlowGreProtocolMetricTag - unMarshaller unMarshalPatternFlowGreProtocolMetricTag -} - -func NewPatternFlowGreProtocolMetricTag() PatternFlowGreProtocolMetricTag { - obj := patternFlowGreProtocolMetricTag{obj: &otg.PatternFlowGreProtocolMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreProtocolMetricTag) msg() *otg.PatternFlowGreProtocolMetricTag { - return obj.obj -} - -func (obj *patternFlowGreProtocolMetricTag) setMsg(msg *otg.PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreProtocolMetricTag struct { - obj *patternFlowGreProtocolMetricTag -} - -type marshalPatternFlowGreProtocolMetricTag interface { - // ToProto marshals PatternFlowGreProtocolMetricTag to protobuf object *otg.PatternFlowGreProtocolMetricTag - ToProto() (*otg.PatternFlowGreProtocolMetricTag, error) - // ToPbText marshals PatternFlowGreProtocolMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreProtocolMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreProtocolMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreProtocolMetricTag struct { - obj *patternFlowGreProtocolMetricTag -} - -type unMarshalPatternFlowGreProtocolMetricTag interface { - // FromProto unmarshals PatternFlowGreProtocolMetricTag from protobuf object *otg.PatternFlowGreProtocolMetricTag - FromProto(msg *otg.PatternFlowGreProtocolMetricTag) (PatternFlowGreProtocolMetricTag, error) - // FromPbText unmarshals PatternFlowGreProtocolMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreProtocolMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreProtocolMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreProtocolMetricTag) Marshal() marshalPatternFlowGreProtocolMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreProtocolMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreProtocolMetricTag) Unmarshal() unMarshalPatternFlowGreProtocolMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreProtocolMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreProtocolMetricTag) ToProto() (*otg.PatternFlowGreProtocolMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreProtocolMetricTag) FromProto(msg *otg.PatternFlowGreProtocolMetricTag) (PatternFlowGreProtocolMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreProtocolMetricTag) 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 *unMarshalpatternFlowGreProtocolMetricTag) 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 *marshalpatternFlowGreProtocolMetricTag) 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 *unMarshalpatternFlowGreProtocolMetricTag) 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 *marshalpatternFlowGreProtocolMetricTag) 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 *unMarshalpatternFlowGreProtocolMetricTag) 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 *patternFlowGreProtocolMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreProtocolMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreProtocolMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreProtocolMetricTag) Clone() (PatternFlowGreProtocolMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreProtocolMetricTag() - 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 -} - -// PatternFlowGreProtocolMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGreProtocolMetricTag interface { - Validation - // msg marshals PatternFlowGreProtocolMetricTag to protobuf object *otg.PatternFlowGreProtocolMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGreProtocolMetricTag - // setMsg unmarshals PatternFlowGreProtocolMetricTag from protobuf object *otg.PatternFlowGreProtocolMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGreProtocolMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreProtocolMetricTag - // validate validates PatternFlowGreProtocolMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreProtocolMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGreProtocolMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGreProtocolMetricTag - SetName(value string) PatternFlowGreProtocolMetricTag - // Offset returns uint32, set in PatternFlowGreProtocolMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGreProtocolMetricTag - SetOffset(value uint32) PatternFlowGreProtocolMetricTag - // HasOffset checks if Offset has been set in PatternFlowGreProtocolMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGreProtocolMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGreProtocolMetricTag - SetLength(value uint32) PatternFlowGreProtocolMetricTag - // HasLength checks if Length has been set in PatternFlowGreProtocolMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGreProtocolMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGreProtocolMetricTag object -func (obj *patternFlowGreProtocolMetricTag) SetName(value string) PatternFlowGreProtocolMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGreProtocolMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGreProtocolMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGreProtocolMetricTag object -func (obj *patternFlowGreProtocolMetricTag) SetOffset(value uint32) PatternFlowGreProtocolMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGreProtocolMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGreProtocolMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGreProtocolMetricTag object -func (obj *patternFlowGreProtocolMetricTag) SetLength(value uint32) PatternFlowGreProtocolMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGreProtocolMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGreProtocolMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreProtocolMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGreProtocolMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGreProtocolMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowGreReserved1Counter ***** -type patternFlowGreReserved1Counter struct { - validation - obj *otg.PatternFlowGreReserved1Counter - marshaller marshalPatternFlowGreReserved1Counter - unMarshaller unMarshalPatternFlowGreReserved1Counter -} - -func NewPatternFlowGreReserved1Counter() PatternFlowGreReserved1Counter { - obj := patternFlowGreReserved1Counter{obj: &otg.PatternFlowGreReserved1Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreReserved1Counter) msg() *otg.PatternFlowGreReserved1Counter { - return obj.obj -} - -func (obj *patternFlowGreReserved1Counter) setMsg(msg *otg.PatternFlowGreReserved1Counter) PatternFlowGreReserved1Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreReserved1Counter struct { - obj *patternFlowGreReserved1Counter -} - -type marshalPatternFlowGreReserved1Counter interface { - // ToProto marshals PatternFlowGreReserved1Counter to protobuf object *otg.PatternFlowGreReserved1Counter - ToProto() (*otg.PatternFlowGreReserved1Counter, error) - // ToPbText marshals PatternFlowGreReserved1Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreReserved1Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreReserved1Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreReserved1Counter struct { - obj *patternFlowGreReserved1Counter -} - -type unMarshalPatternFlowGreReserved1Counter interface { - // FromProto unmarshals PatternFlowGreReserved1Counter from protobuf object *otg.PatternFlowGreReserved1Counter - FromProto(msg *otg.PatternFlowGreReserved1Counter) (PatternFlowGreReserved1Counter, error) - // FromPbText unmarshals PatternFlowGreReserved1Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreReserved1Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreReserved1Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreReserved1Counter) Marshal() marshalPatternFlowGreReserved1Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreReserved1Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreReserved1Counter) Unmarshal() unMarshalPatternFlowGreReserved1Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreReserved1Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreReserved1Counter) ToProto() (*otg.PatternFlowGreReserved1Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreReserved1Counter) FromProto(msg *otg.PatternFlowGreReserved1Counter) (PatternFlowGreReserved1Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreReserved1Counter) 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 *unMarshalpatternFlowGreReserved1Counter) 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 *marshalpatternFlowGreReserved1Counter) 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 *unMarshalpatternFlowGreReserved1Counter) 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 *marshalpatternFlowGreReserved1Counter) 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 *unMarshalpatternFlowGreReserved1Counter) 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 *patternFlowGreReserved1Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreReserved1Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreReserved1Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreReserved1Counter) Clone() (PatternFlowGreReserved1Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreReserved1Counter() - 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 -} - -// PatternFlowGreReserved1Counter is integer counter pattern -type PatternFlowGreReserved1Counter interface { - Validation - // msg marshals PatternFlowGreReserved1Counter to protobuf object *otg.PatternFlowGreReserved1Counter - // and doesn't set defaults - msg() *otg.PatternFlowGreReserved1Counter - // setMsg unmarshals PatternFlowGreReserved1Counter from protobuf object *otg.PatternFlowGreReserved1Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowGreReserved1Counter) PatternFlowGreReserved1Counter - // provides marshal interface - Marshal() marshalPatternFlowGreReserved1Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreReserved1Counter - // validate validates PatternFlowGreReserved1Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreReserved1Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGreReserved1Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGreReserved1Counter - SetStart(value uint32) PatternFlowGreReserved1Counter - // HasStart checks if Start has been set in PatternFlowGreReserved1Counter - HasStart() bool - // Step returns uint32, set in PatternFlowGreReserved1Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGreReserved1Counter - SetStep(value uint32) PatternFlowGreReserved1Counter - // HasStep checks if Step has been set in PatternFlowGreReserved1Counter - HasStep() bool - // Count returns uint32, set in PatternFlowGreReserved1Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGreReserved1Counter - SetCount(value uint32) PatternFlowGreReserved1Counter - // HasCount checks if Count has been set in PatternFlowGreReserved1Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGreReserved1Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGreReserved1Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGreReserved1Counter object -func (obj *patternFlowGreReserved1Counter) SetStart(value uint32) PatternFlowGreReserved1Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGreReserved1Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGreReserved1Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGreReserved1Counter object -func (obj *patternFlowGreReserved1Counter) SetStep(value uint32) PatternFlowGreReserved1Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGreReserved1Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGreReserved1Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGreReserved1Counter object -func (obj *patternFlowGreReserved1Counter) SetCount(value uint32) PatternFlowGreReserved1Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGreReserved1Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreReserved1Counter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreReserved1Counter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreReserved1Counter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGreReserved1Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGreReserved1MetricTag ***** -type patternFlowGreReserved1MetricTag struct { - validation - obj *otg.PatternFlowGreReserved1MetricTag - marshaller marshalPatternFlowGreReserved1MetricTag - unMarshaller unMarshalPatternFlowGreReserved1MetricTag -} - -func NewPatternFlowGreReserved1MetricTag() PatternFlowGreReserved1MetricTag { - obj := patternFlowGreReserved1MetricTag{obj: &otg.PatternFlowGreReserved1MetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGreReserved1MetricTag) msg() *otg.PatternFlowGreReserved1MetricTag { - return obj.obj -} - -func (obj *patternFlowGreReserved1MetricTag) setMsg(msg *otg.PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1MetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGreReserved1MetricTag struct { - obj *patternFlowGreReserved1MetricTag -} - -type marshalPatternFlowGreReserved1MetricTag interface { - // ToProto marshals PatternFlowGreReserved1MetricTag to protobuf object *otg.PatternFlowGreReserved1MetricTag - ToProto() (*otg.PatternFlowGreReserved1MetricTag, error) - // ToPbText marshals PatternFlowGreReserved1MetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGreReserved1MetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGreReserved1MetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGreReserved1MetricTag struct { - obj *patternFlowGreReserved1MetricTag -} - -type unMarshalPatternFlowGreReserved1MetricTag interface { - // FromProto unmarshals PatternFlowGreReserved1MetricTag from protobuf object *otg.PatternFlowGreReserved1MetricTag - FromProto(msg *otg.PatternFlowGreReserved1MetricTag) (PatternFlowGreReserved1MetricTag, error) - // FromPbText unmarshals PatternFlowGreReserved1MetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGreReserved1MetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGreReserved1MetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGreReserved1MetricTag) Marshal() marshalPatternFlowGreReserved1MetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGreReserved1MetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGreReserved1MetricTag) Unmarshal() unMarshalPatternFlowGreReserved1MetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGreReserved1MetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGreReserved1MetricTag) ToProto() (*otg.PatternFlowGreReserved1MetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGreReserved1MetricTag) FromProto(msg *otg.PatternFlowGreReserved1MetricTag) (PatternFlowGreReserved1MetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGreReserved1MetricTag) 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 *unMarshalpatternFlowGreReserved1MetricTag) 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 *marshalpatternFlowGreReserved1MetricTag) 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 *unMarshalpatternFlowGreReserved1MetricTag) 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 *marshalpatternFlowGreReserved1MetricTag) 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 *unMarshalpatternFlowGreReserved1MetricTag) 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 *patternFlowGreReserved1MetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGreReserved1MetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGreReserved1MetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGreReserved1MetricTag) Clone() (PatternFlowGreReserved1MetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGreReserved1MetricTag() - 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 -} - -// PatternFlowGreReserved1MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGreReserved1MetricTag interface { - Validation - // msg marshals PatternFlowGreReserved1MetricTag to protobuf object *otg.PatternFlowGreReserved1MetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGreReserved1MetricTag - // setMsg unmarshals PatternFlowGreReserved1MetricTag from protobuf object *otg.PatternFlowGreReserved1MetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1MetricTag - // provides marshal interface - Marshal() marshalPatternFlowGreReserved1MetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGreReserved1MetricTag - // validate validates PatternFlowGreReserved1MetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGreReserved1MetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGreReserved1MetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGreReserved1MetricTag - SetName(value string) PatternFlowGreReserved1MetricTag - // Offset returns uint32, set in PatternFlowGreReserved1MetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGreReserved1MetricTag - SetOffset(value uint32) PatternFlowGreReserved1MetricTag - // HasOffset checks if Offset has been set in PatternFlowGreReserved1MetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGreReserved1MetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGreReserved1MetricTag - SetLength(value uint32) PatternFlowGreReserved1MetricTag - // HasLength checks if Length has been set in PatternFlowGreReserved1MetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGreReserved1MetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGreReserved1MetricTag object -func (obj *patternFlowGreReserved1MetricTag) SetName(value string) PatternFlowGreReserved1MetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGreReserved1MetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGreReserved1MetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGreReserved1MetricTag object -func (obj *patternFlowGreReserved1MetricTag) SetOffset(value uint32) PatternFlowGreReserved1MetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGreReserved1MetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGreReserved1MetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGreReserved1MetricTag object -func (obj *patternFlowGreReserved1MetricTag) SetLength(value uint32) PatternFlowGreReserved1MetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGreReserved1MetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGreReserved1MetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGreReserved1MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGreReserved1MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGreReserved1MetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowGtpv1VersionCounter ***** -type patternFlowGtpv1VersionCounter struct { - validation - obj *otg.PatternFlowGtpv1VersionCounter - marshaller marshalPatternFlowGtpv1VersionCounter - unMarshaller unMarshalPatternFlowGtpv1VersionCounter -} - -func NewPatternFlowGtpv1VersionCounter() PatternFlowGtpv1VersionCounter { - obj := patternFlowGtpv1VersionCounter{obj: &otg.PatternFlowGtpv1VersionCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1VersionCounter) msg() *otg.PatternFlowGtpv1VersionCounter { - return obj.obj -} - -func (obj *patternFlowGtpv1VersionCounter) setMsg(msg *otg.PatternFlowGtpv1VersionCounter) PatternFlowGtpv1VersionCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1VersionCounter struct { - obj *patternFlowGtpv1VersionCounter -} - -type marshalPatternFlowGtpv1VersionCounter interface { - // ToProto marshals PatternFlowGtpv1VersionCounter to protobuf object *otg.PatternFlowGtpv1VersionCounter - ToProto() (*otg.PatternFlowGtpv1VersionCounter, error) - // ToPbText marshals PatternFlowGtpv1VersionCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1VersionCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1VersionCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1VersionCounter struct { - obj *patternFlowGtpv1VersionCounter -} - -type unMarshalPatternFlowGtpv1VersionCounter interface { - // FromProto unmarshals PatternFlowGtpv1VersionCounter from protobuf object *otg.PatternFlowGtpv1VersionCounter - FromProto(msg *otg.PatternFlowGtpv1VersionCounter) (PatternFlowGtpv1VersionCounter, error) - // FromPbText unmarshals PatternFlowGtpv1VersionCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1VersionCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1VersionCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1VersionCounter) Marshal() marshalPatternFlowGtpv1VersionCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1VersionCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1VersionCounter) Unmarshal() unMarshalPatternFlowGtpv1VersionCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1VersionCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1VersionCounter) ToProto() (*otg.PatternFlowGtpv1VersionCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1VersionCounter) FromProto(msg *otg.PatternFlowGtpv1VersionCounter) (PatternFlowGtpv1VersionCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1VersionCounter) 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 *unMarshalpatternFlowGtpv1VersionCounter) 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 *marshalpatternFlowGtpv1VersionCounter) 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 *unMarshalpatternFlowGtpv1VersionCounter) 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 *marshalpatternFlowGtpv1VersionCounter) 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 *unMarshalpatternFlowGtpv1VersionCounter) 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 *patternFlowGtpv1VersionCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1VersionCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1VersionCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1VersionCounter) Clone() (PatternFlowGtpv1VersionCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1VersionCounter() - 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 -} - -// PatternFlowGtpv1VersionCounter is integer counter pattern -type PatternFlowGtpv1VersionCounter interface { - Validation - // msg marshals PatternFlowGtpv1VersionCounter to protobuf object *otg.PatternFlowGtpv1VersionCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1VersionCounter - // setMsg unmarshals PatternFlowGtpv1VersionCounter from protobuf object *otg.PatternFlowGtpv1VersionCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1VersionCounter) PatternFlowGtpv1VersionCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv1VersionCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1VersionCounter - // validate validates PatternFlowGtpv1VersionCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1VersionCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv1VersionCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv1VersionCounter - SetStart(value uint32) PatternFlowGtpv1VersionCounter - // HasStart checks if Start has been set in PatternFlowGtpv1VersionCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv1VersionCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv1VersionCounter - SetStep(value uint32) PatternFlowGtpv1VersionCounter - // HasStep checks if Step has been set in PatternFlowGtpv1VersionCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv1VersionCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv1VersionCounter - SetCount(value uint32) PatternFlowGtpv1VersionCounter - // HasCount checks if Count has been set in PatternFlowGtpv1VersionCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1VersionCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1VersionCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv1VersionCounter object -func (obj *patternFlowGtpv1VersionCounter) SetStart(value uint32) PatternFlowGtpv1VersionCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1VersionCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1VersionCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv1VersionCounter object -func (obj *patternFlowGtpv1VersionCounter) SetStep(value uint32) PatternFlowGtpv1VersionCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1VersionCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1VersionCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv1VersionCounter object -func (obj *patternFlowGtpv1VersionCounter) SetCount(value uint32) PatternFlowGtpv1VersionCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv1VersionCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1VersionCounter.Start <= 7 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1VersionCounter.Step <= 7 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1VersionCounter.Count <= 7 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv1VersionCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv1VersionMetricTag ***** -type patternFlowGtpv1VersionMetricTag struct { - validation - obj *otg.PatternFlowGtpv1VersionMetricTag - marshaller marshalPatternFlowGtpv1VersionMetricTag - unMarshaller unMarshalPatternFlowGtpv1VersionMetricTag -} - -func NewPatternFlowGtpv1VersionMetricTag() PatternFlowGtpv1VersionMetricTag { - obj := patternFlowGtpv1VersionMetricTag{obj: &otg.PatternFlowGtpv1VersionMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1VersionMetricTag) msg() *otg.PatternFlowGtpv1VersionMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv1VersionMetricTag) setMsg(msg *otg.PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1VersionMetricTag struct { - obj *patternFlowGtpv1VersionMetricTag -} - -type marshalPatternFlowGtpv1VersionMetricTag interface { - // ToProto marshals PatternFlowGtpv1VersionMetricTag to protobuf object *otg.PatternFlowGtpv1VersionMetricTag - ToProto() (*otg.PatternFlowGtpv1VersionMetricTag, error) - // ToPbText marshals PatternFlowGtpv1VersionMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1VersionMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1VersionMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1VersionMetricTag struct { - obj *patternFlowGtpv1VersionMetricTag -} - -type unMarshalPatternFlowGtpv1VersionMetricTag interface { - // FromProto unmarshals PatternFlowGtpv1VersionMetricTag from protobuf object *otg.PatternFlowGtpv1VersionMetricTag - FromProto(msg *otg.PatternFlowGtpv1VersionMetricTag) (PatternFlowGtpv1VersionMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv1VersionMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1VersionMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1VersionMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1VersionMetricTag) Marshal() marshalPatternFlowGtpv1VersionMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1VersionMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1VersionMetricTag) Unmarshal() unMarshalPatternFlowGtpv1VersionMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1VersionMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1VersionMetricTag) ToProto() (*otg.PatternFlowGtpv1VersionMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1VersionMetricTag) FromProto(msg *otg.PatternFlowGtpv1VersionMetricTag) (PatternFlowGtpv1VersionMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1VersionMetricTag) 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 *unMarshalpatternFlowGtpv1VersionMetricTag) 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 *marshalpatternFlowGtpv1VersionMetricTag) 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 *unMarshalpatternFlowGtpv1VersionMetricTag) 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 *marshalpatternFlowGtpv1VersionMetricTag) 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 *unMarshalpatternFlowGtpv1VersionMetricTag) 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 *patternFlowGtpv1VersionMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1VersionMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1VersionMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1VersionMetricTag) Clone() (PatternFlowGtpv1VersionMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1VersionMetricTag() - 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 -} - -// PatternFlowGtpv1VersionMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv1VersionMetricTag interface { - Validation - // msg marshals PatternFlowGtpv1VersionMetricTag to protobuf object *otg.PatternFlowGtpv1VersionMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1VersionMetricTag - // setMsg unmarshals PatternFlowGtpv1VersionMetricTag from protobuf object *otg.PatternFlowGtpv1VersionMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1VersionMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1VersionMetricTag - // validate validates PatternFlowGtpv1VersionMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1VersionMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv1VersionMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv1VersionMetricTag - SetName(value string) PatternFlowGtpv1VersionMetricTag - // Offset returns uint32, set in PatternFlowGtpv1VersionMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv1VersionMetricTag - SetOffset(value uint32) PatternFlowGtpv1VersionMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv1VersionMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv1VersionMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv1VersionMetricTag - SetLength(value uint32) PatternFlowGtpv1VersionMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv1VersionMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv1VersionMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv1VersionMetricTag object -func (obj *patternFlowGtpv1VersionMetricTag) SetName(value string) PatternFlowGtpv1VersionMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1VersionMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1VersionMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv1VersionMetricTag object -func (obj *patternFlowGtpv1VersionMetricTag) SetOffset(value uint32) PatternFlowGtpv1VersionMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1VersionMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1VersionMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv1VersionMetricTag object -func (obj *patternFlowGtpv1VersionMetricTag) SetLength(value uint32) PatternFlowGtpv1VersionMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv1VersionMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1VersionMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 2 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1VersionMetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv1VersionMetricTag.Length <= 3 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv1VersionMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(3) - } - -} - -// ***** PatternFlowGtpv1ProtocolTypeCounter ***** -type patternFlowGtpv1ProtocolTypeCounter struct { - validation - obj *otg.PatternFlowGtpv1ProtocolTypeCounter - marshaller marshalPatternFlowGtpv1ProtocolTypeCounter - unMarshaller unMarshalPatternFlowGtpv1ProtocolTypeCounter -} - -func NewPatternFlowGtpv1ProtocolTypeCounter() PatternFlowGtpv1ProtocolTypeCounter { - obj := patternFlowGtpv1ProtocolTypeCounter{obj: &otg.PatternFlowGtpv1ProtocolTypeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1ProtocolTypeCounter) msg() *otg.PatternFlowGtpv1ProtocolTypeCounter { - return obj.obj -} - -func (obj *patternFlowGtpv1ProtocolTypeCounter) setMsg(msg *otg.PatternFlowGtpv1ProtocolTypeCounter) PatternFlowGtpv1ProtocolTypeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1ProtocolTypeCounter struct { - obj *patternFlowGtpv1ProtocolTypeCounter -} - -type marshalPatternFlowGtpv1ProtocolTypeCounter interface { - // ToProto marshals PatternFlowGtpv1ProtocolTypeCounter to protobuf object *otg.PatternFlowGtpv1ProtocolTypeCounter - ToProto() (*otg.PatternFlowGtpv1ProtocolTypeCounter, error) - // ToPbText marshals PatternFlowGtpv1ProtocolTypeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1ProtocolTypeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1ProtocolTypeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1ProtocolTypeCounter struct { - obj *patternFlowGtpv1ProtocolTypeCounter -} - -type unMarshalPatternFlowGtpv1ProtocolTypeCounter interface { - // FromProto unmarshals PatternFlowGtpv1ProtocolTypeCounter from protobuf object *otg.PatternFlowGtpv1ProtocolTypeCounter - FromProto(msg *otg.PatternFlowGtpv1ProtocolTypeCounter) (PatternFlowGtpv1ProtocolTypeCounter, error) - // FromPbText unmarshals PatternFlowGtpv1ProtocolTypeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1ProtocolTypeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1ProtocolTypeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1ProtocolTypeCounter) Marshal() marshalPatternFlowGtpv1ProtocolTypeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1ProtocolTypeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1ProtocolTypeCounter) Unmarshal() unMarshalPatternFlowGtpv1ProtocolTypeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1ProtocolTypeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1ProtocolTypeCounter) ToProto() (*otg.PatternFlowGtpv1ProtocolTypeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1ProtocolTypeCounter) FromProto(msg *otg.PatternFlowGtpv1ProtocolTypeCounter) (PatternFlowGtpv1ProtocolTypeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1ProtocolTypeCounter) 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 *unMarshalpatternFlowGtpv1ProtocolTypeCounter) 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 *marshalpatternFlowGtpv1ProtocolTypeCounter) 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 *unMarshalpatternFlowGtpv1ProtocolTypeCounter) 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 *marshalpatternFlowGtpv1ProtocolTypeCounter) 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 *unMarshalpatternFlowGtpv1ProtocolTypeCounter) 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 *patternFlowGtpv1ProtocolTypeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1ProtocolTypeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1ProtocolTypeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1ProtocolTypeCounter) Clone() (PatternFlowGtpv1ProtocolTypeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1ProtocolTypeCounter() - 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 -} - -// PatternFlowGtpv1ProtocolTypeCounter is integer counter pattern -type PatternFlowGtpv1ProtocolTypeCounter interface { - Validation - // msg marshals PatternFlowGtpv1ProtocolTypeCounter to protobuf object *otg.PatternFlowGtpv1ProtocolTypeCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1ProtocolTypeCounter - // setMsg unmarshals PatternFlowGtpv1ProtocolTypeCounter from protobuf object *otg.PatternFlowGtpv1ProtocolTypeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1ProtocolTypeCounter) PatternFlowGtpv1ProtocolTypeCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv1ProtocolTypeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1ProtocolTypeCounter - // validate validates PatternFlowGtpv1ProtocolTypeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1ProtocolTypeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv1ProtocolTypeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv1ProtocolTypeCounter - SetStart(value uint32) PatternFlowGtpv1ProtocolTypeCounter - // HasStart checks if Start has been set in PatternFlowGtpv1ProtocolTypeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv1ProtocolTypeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv1ProtocolTypeCounter - SetStep(value uint32) PatternFlowGtpv1ProtocolTypeCounter - // HasStep checks if Step has been set in PatternFlowGtpv1ProtocolTypeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv1ProtocolTypeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv1ProtocolTypeCounter - SetCount(value uint32) PatternFlowGtpv1ProtocolTypeCounter - // HasCount checks if Count has been set in PatternFlowGtpv1ProtocolTypeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1ProtocolTypeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1ProtocolTypeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv1ProtocolTypeCounter object -func (obj *patternFlowGtpv1ProtocolTypeCounter) SetStart(value uint32) PatternFlowGtpv1ProtocolTypeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1ProtocolTypeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1ProtocolTypeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv1ProtocolTypeCounter object -func (obj *patternFlowGtpv1ProtocolTypeCounter) SetStep(value uint32) PatternFlowGtpv1ProtocolTypeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1ProtocolTypeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1ProtocolTypeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv1ProtocolTypeCounter object -func (obj *patternFlowGtpv1ProtocolTypeCounter) SetCount(value uint32) PatternFlowGtpv1ProtocolTypeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv1ProtocolTypeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1ProtocolTypeCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1ProtocolTypeCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1ProtocolTypeCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv1ProtocolTypeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv1ProtocolTypeMetricTag ***** -type patternFlowGtpv1ProtocolTypeMetricTag struct { - validation - obj *otg.PatternFlowGtpv1ProtocolTypeMetricTag - marshaller marshalPatternFlowGtpv1ProtocolTypeMetricTag - unMarshaller unMarshalPatternFlowGtpv1ProtocolTypeMetricTag -} - -func NewPatternFlowGtpv1ProtocolTypeMetricTag() PatternFlowGtpv1ProtocolTypeMetricTag { - obj := patternFlowGtpv1ProtocolTypeMetricTag{obj: &otg.PatternFlowGtpv1ProtocolTypeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) msg() *otg.PatternFlowGtpv1ProtocolTypeMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) setMsg(msg *otg.PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1ProtocolTypeMetricTag struct { - obj *patternFlowGtpv1ProtocolTypeMetricTag -} - -type marshalPatternFlowGtpv1ProtocolTypeMetricTag interface { - // ToProto marshals PatternFlowGtpv1ProtocolTypeMetricTag to protobuf object *otg.PatternFlowGtpv1ProtocolTypeMetricTag - ToProto() (*otg.PatternFlowGtpv1ProtocolTypeMetricTag, error) - // ToPbText marshals PatternFlowGtpv1ProtocolTypeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1ProtocolTypeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1ProtocolTypeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1ProtocolTypeMetricTag struct { - obj *patternFlowGtpv1ProtocolTypeMetricTag -} - -type unMarshalPatternFlowGtpv1ProtocolTypeMetricTag interface { - // FromProto unmarshals PatternFlowGtpv1ProtocolTypeMetricTag from protobuf object *otg.PatternFlowGtpv1ProtocolTypeMetricTag - FromProto(msg *otg.PatternFlowGtpv1ProtocolTypeMetricTag) (PatternFlowGtpv1ProtocolTypeMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv1ProtocolTypeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1ProtocolTypeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1ProtocolTypeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) Marshal() marshalPatternFlowGtpv1ProtocolTypeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1ProtocolTypeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) Unmarshal() unMarshalPatternFlowGtpv1ProtocolTypeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1ProtocolTypeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1ProtocolTypeMetricTag) ToProto() (*otg.PatternFlowGtpv1ProtocolTypeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1ProtocolTypeMetricTag) FromProto(msg *otg.PatternFlowGtpv1ProtocolTypeMetricTag) (PatternFlowGtpv1ProtocolTypeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1ProtocolTypeMetricTag) 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 *unMarshalpatternFlowGtpv1ProtocolTypeMetricTag) 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 *marshalpatternFlowGtpv1ProtocolTypeMetricTag) 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 *unMarshalpatternFlowGtpv1ProtocolTypeMetricTag) 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 *marshalpatternFlowGtpv1ProtocolTypeMetricTag) 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 *unMarshalpatternFlowGtpv1ProtocolTypeMetricTag) 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 *patternFlowGtpv1ProtocolTypeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) Clone() (PatternFlowGtpv1ProtocolTypeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1ProtocolTypeMetricTag() - 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 -} - -// PatternFlowGtpv1ProtocolTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv1ProtocolTypeMetricTag interface { - Validation - // msg marshals PatternFlowGtpv1ProtocolTypeMetricTag to protobuf object *otg.PatternFlowGtpv1ProtocolTypeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1ProtocolTypeMetricTag - // setMsg unmarshals PatternFlowGtpv1ProtocolTypeMetricTag from protobuf object *otg.PatternFlowGtpv1ProtocolTypeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1ProtocolTypeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1ProtocolTypeMetricTag - // validate validates PatternFlowGtpv1ProtocolTypeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1ProtocolTypeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv1ProtocolTypeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv1ProtocolTypeMetricTag - SetName(value string) PatternFlowGtpv1ProtocolTypeMetricTag - // Offset returns uint32, set in PatternFlowGtpv1ProtocolTypeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv1ProtocolTypeMetricTag - SetOffset(value uint32) PatternFlowGtpv1ProtocolTypeMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv1ProtocolTypeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv1ProtocolTypeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv1ProtocolTypeMetricTag - SetLength(value uint32) PatternFlowGtpv1ProtocolTypeMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv1ProtocolTypeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv1ProtocolTypeMetricTag object -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) SetName(value string) PatternFlowGtpv1ProtocolTypeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv1ProtocolTypeMetricTag object -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) SetOffset(value uint32) PatternFlowGtpv1ProtocolTypeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv1ProtocolTypeMetricTag object -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) SetLength(value uint32) PatternFlowGtpv1ProtocolTypeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1ProtocolTypeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1ProtocolTypeMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv1ProtocolTypeMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv1ProtocolTypeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowGtpv1ReservedCounter ***** -type patternFlowGtpv1ReservedCounter struct { - validation - obj *otg.PatternFlowGtpv1ReservedCounter - marshaller marshalPatternFlowGtpv1ReservedCounter - unMarshaller unMarshalPatternFlowGtpv1ReservedCounter -} - -func NewPatternFlowGtpv1ReservedCounter() PatternFlowGtpv1ReservedCounter { - obj := patternFlowGtpv1ReservedCounter{obj: &otg.PatternFlowGtpv1ReservedCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1ReservedCounter) msg() *otg.PatternFlowGtpv1ReservedCounter { - return obj.obj -} - -func (obj *patternFlowGtpv1ReservedCounter) setMsg(msg *otg.PatternFlowGtpv1ReservedCounter) PatternFlowGtpv1ReservedCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1ReservedCounter struct { - obj *patternFlowGtpv1ReservedCounter -} - -type marshalPatternFlowGtpv1ReservedCounter interface { - // ToProto marshals PatternFlowGtpv1ReservedCounter to protobuf object *otg.PatternFlowGtpv1ReservedCounter - ToProto() (*otg.PatternFlowGtpv1ReservedCounter, error) - // ToPbText marshals PatternFlowGtpv1ReservedCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1ReservedCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1ReservedCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1ReservedCounter struct { - obj *patternFlowGtpv1ReservedCounter -} - -type unMarshalPatternFlowGtpv1ReservedCounter interface { - // FromProto unmarshals PatternFlowGtpv1ReservedCounter from protobuf object *otg.PatternFlowGtpv1ReservedCounter - FromProto(msg *otg.PatternFlowGtpv1ReservedCounter) (PatternFlowGtpv1ReservedCounter, error) - // FromPbText unmarshals PatternFlowGtpv1ReservedCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1ReservedCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1ReservedCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1ReservedCounter) Marshal() marshalPatternFlowGtpv1ReservedCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1ReservedCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1ReservedCounter) Unmarshal() unMarshalPatternFlowGtpv1ReservedCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1ReservedCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1ReservedCounter) ToProto() (*otg.PatternFlowGtpv1ReservedCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1ReservedCounter) FromProto(msg *otg.PatternFlowGtpv1ReservedCounter) (PatternFlowGtpv1ReservedCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1ReservedCounter) 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 *unMarshalpatternFlowGtpv1ReservedCounter) 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 *marshalpatternFlowGtpv1ReservedCounter) 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 *unMarshalpatternFlowGtpv1ReservedCounter) 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 *marshalpatternFlowGtpv1ReservedCounter) 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 *unMarshalpatternFlowGtpv1ReservedCounter) 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 *patternFlowGtpv1ReservedCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1ReservedCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1ReservedCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1ReservedCounter) Clone() (PatternFlowGtpv1ReservedCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1ReservedCounter() - 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 -} - -// PatternFlowGtpv1ReservedCounter is integer counter pattern -type PatternFlowGtpv1ReservedCounter interface { - Validation - // msg marshals PatternFlowGtpv1ReservedCounter to protobuf object *otg.PatternFlowGtpv1ReservedCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1ReservedCounter - // setMsg unmarshals PatternFlowGtpv1ReservedCounter from protobuf object *otg.PatternFlowGtpv1ReservedCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1ReservedCounter) PatternFlowGtpv1ReservedCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv1ReservedCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1ReservedCounter - // validate validates PatternFlowGtpv1ReservedCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1ReservedCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv1ReservedCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv1ReservedCounter - SetStart(value uint32) PatternFlowGtpv1ReservedCounter - // HasStart checks if Start has been set in PatternFlowGtpv1ReservedCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv1ReservedCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv1ReservedCounter - SetStep(value uint32) PatternFlowGtpv1ReservedCounter - // HasStep checks if Step has been set in PatternFlowGtpv1ReservedCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv1ReservedCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv1ReservedCounter - SetCount(value uint32) PatternFlowGtpv1ReservedCounter - // HasCount checks if Count has been set in PatternFlowGtpv1ReservedCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1ReservedCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1ReservedCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv1ReservedCounter object -func (obj *patternFlowGtpv1ReservedCounter) SetStart(value uint32) PatternFlowGtpv1ReservedCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1ReservedCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1ReservedCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv1ReservedCounter object -func (obj *patternFlowGtpv1ReservedCounter) SetStep(value uint32) PatternFlowGtpv1ReservedCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1ReservedCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1ReservedCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv1ReservedCounter object -func (obj *patternFlowGtpv1ReservedCounter) SetCount(value uint32) PatternFlowGtpv1ReservedCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv1ReservedCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1ReservedCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1ReservedCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1ReservedCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv1ReservedCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv1ReservedMetricTag ***** -type patternFlowGtpv1ReservedMetricTag struct { - validation - obj *otg.PatternFlowGtpv1ReservedMetricTag - marshaller marshalPatternFlowGtpv1ReservedMetricTag - unMarshaller unMarshalPatternFlowGtpv1ReservedMetricTag -} - -func NewPatternFlowGtpv1ReservedMetricTag() PatternFlowGtpv1ReservedMetricTag { - obj := patternFlowGtpv1ReservedMetricTag{obj: &otg.PatternFlowGtpv1ReservedMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1ReservedMetricTag) msg() *otg.PatternFlowGtpv1ReservedMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv1ReservedMetricTag) setMsg(msg *otg.PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1ReservedMetricTag struct { - obj *patternFlowGtpv1ReservedMetricTag -} - -type marshalPatternFlowGtpv1ReservedMetricTag interface { - // ToProto marshals PatternFlowGtpv1ReservedMetricTag to protobuf object *otg.PatternFlowGtpv1ReservedMetricTag - ToProto() (*otg.PatternFlowGtpv1ReservedMetricTag, error) - // ToPbText marshals PatternFlowGtpv1ReservedMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1ReservedMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1ReservedMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1ReservedMetricTag struct { - obj *patternFlowGtpv1ReservedMetricTag -} - -type unMarshalPatternFlowGtpv1ReservedMetricTag interface { - // FromProto unmarshals PatternFlowGtpv1ReservedMetricTag from protobuf object *otg.PatternFlowGtpv1ReservedMetricTag - FromProto(msg *otg.PatternFlowGtpv1ReservedMetricTag) (PatternFlowGtpv1ReservedMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv1ReservedMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1ReservedMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1ReservedMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1ReservedMetricTag) Marshal() marshalPatternFlowGtpv1ReservedMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1ReservedMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1ReservedMetricTag) Unmarshal() unMarshalPatternFlowGtpv1ReservedMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1ReservedMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1ReservedMetricTag) ToProto() (*otg.PatternFlowGtpv1ReservedMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1ReservedMetricTag) FromProto(msg *otg.PatternFlowGtpv1ReservedMetricTag) (PatternFlowGtpv1ReservedMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1ReservedMetricTag) 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 *unMarshalpatternFlowGtpv1ReservedMetricTag) 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 *marshalpatternFlowGtpv1ReservedMetricTag) 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 *unMarshalpatternFlowGtpv1ReservedMetricTag) 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 *marshalpatternFlowGtpv1ReservedMetricTag) 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 *unMarshalpatternFlowGtpv1ReservedMetricTag) 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 *patternFlowGtpv1ReservedMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1ReservedMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1ReservedMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1ReservedMetricTag) Clone() (PatternFlowGtpv1ReservedMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1ReservedMetricTag() - 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 -} - -// PatternFlowGtpv1ReservedMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv1ReservedMetricTag interface { - Validation - // msg marshals PatternFlowGtpv1ReservedMetricTag to protobuf object *otg.PatternFlowGtpv1ReservedMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1ReservedMetricTag - // setMsg unmarshals PatternFlowGtpv1ReservedMetricTag from protobuf object *otg.PatternFlowGtpv1ReservedMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1ReservedMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1ReservedMetricTag - // validate validates PatternFlowGtpv1ReservedMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1ReservedMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv1ReservedMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv1ReservedMetricTag - SetName(value string) PatternFlowGtpv1ReservedMetricTag - // Offset returns uint32, set in PatternFlowGtpv1ReservedMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv1ReservedMetricTag - SetOffset(value uint32) PatternFlowGtpv1ReservedMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv1ReservedMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv1ReservedMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv1ReservedMetricTag - SetLength(value uint32) PatternFlowGtpv1ReservedMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv1ReservedMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv1ReservedMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv1ReservedMetricTag object -func (obj *patternFlowGtpv1ReservedMetricTag) SetName(value string) PatternFlowGtpv1ReservedMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1ReservedMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1ReservedMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv1ReservedMetricTag object -func (obj *patternFlowGtpv1ReservedMetricTag) SetOffset(value uint32) PatternFlowGtpv1ReservedMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1ReservedMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1ReservedMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv1ReservedMetricTag object -func (obj *patternFlowGtpv1ReservedMetricTag) SetLength(value uint32) PatternFlowGtpv1ReservedMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv1ReservedMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1ReservedMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1ReservedMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv1ReservedMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv1ReservedMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowGtpv1EFlagCounter ***** -type patternFlowGtpv1EFlagCounter struct { - validation - obj *otg.PatternFlowGtpv1EFlagCounter - marshaller marshalPatternFlowGtpv1EFlagCounter - unMarshaller unMarshalPatternFlowGtpv1EFlagCounter -} - -func NewPatternFlowGtpv1EFlagCounter() PatternFlowGtpv1EFlagCounter { - obj := patternFlowGtpv1EFlagCounter{obj: &otg.PatternFlowGtpv1EFlagCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1EFlagCounter) msg() *otg.PatternFlowGtpv1EFlagCounter { - return obj.obj -} - -func (obj *patternFlowGtpv1EFlagCounter) setMsg(msg *otg.PatternFlowGtpv1EFlagCounter) PatternFlowGtpv1EFlagCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1EFlagCounter struct { - obj *patternFlowGtpv1EFlagCounter -} - -type marshalPatternFlowGtpv1EFlagCounter interface { - // ToProto marshals PatternFlowGtpv1EFlagCounter to protobuf object *otg.PatternFlowGtpv1EFlagCounter - ToProto() (*otg.PatternFlowGtpv1EFlagCounter, error) - // ToPbText marshals PatternFlowGtpv1EFlagCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1EFlagCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1EFlagCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1EFlagCounter struct { - obj *patternFlowGtpv1EFlagCounter -} - -type unMarshalPatternFlowGtpv1EFlagCounter interface { - // FromProto unmarshals PatternFlowGtpv1EFlagCounter from protobuf object *otg.PatternFlowGtpv1EFlagCounter - FromProto(msg *otg.PatternFlowGtpv1EFlagCounter) (PatternFlowGtpv1EFlagCounter, error) - // FromPbText unmarshals PatternFlowGtpv1EFlagCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1EFlagCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1EFlagCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1EFlagCounter) Marshal() marshalPatternFlowGtpv1EFlagCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1EFlagCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1EFlagCounter) Unmarshal() unMarshalPatternFlowGtpv1EFlagCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1EFlagCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1EFlagCounter) ToProto() (*otg.PatternFlowGtpv1EFlagCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1EFlagCounter) FromProto(msg *otg.PatternFlowGtpv1EFlagCounter) (PatternFlowGtpv1EFlagCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1EFlagCounter) 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 *unMarshalpatternFlowGtpv1EFlagCounter) 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 *marshalpatternFlowGtpv1EFlagCounter) 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 *unMarshalpatternFlowGtpv1EFlagCounter) 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 *marshalpatternFlowGtpv1EFlagCounter) 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 *unMarshalpatternFlowGtpv1EFlagCounter) 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 *patternFlowGtpv1EFlagCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1EFlagCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1EFlagCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1EFlagCounter) Clone() (PatternFlowGtpv1EFlagCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1EFlagCounter() - 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 -} - -// PatternFlowGtpv1EFlagCounter is integer counter pattern -type PatternFlowGtpv1EFlagCounter interface { - Validation - // msg marshals PatternFlowGtpv1EFlagCounter to protobuf object *otg.PatternFlowGtpv1EFlagCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1EFlagCounter - // setMsg unmarshals PatternFlowGtpv1EFlagCounter from protobuf object *otg.PatternFlowGtpv1EFlagCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1EFlagCounter) PatternFlowGtpv1EFlagCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv1EFlagCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1EFlagCounter - // validate validates PatternFlowGtpv1EFlagCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1EFlagCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv1EFlagCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv1EFlagCounter - SetStart(value uint32) PatternFlowGtpv1EFlagCounter - // HasStart checks if Start has been set in PatternFlowGtpv1EFlagCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv1EFlagCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv1EFlagCounter - SetStep(value uint32) PatternFlowGtpv1EFlagCounter - // HasStep checks if Step has been set in PatternFlowGtpv1EFlagCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv1EFlagCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv1EFlagCounter - SetCount(value uint32) PatternFlowGtpv1EFlagCounter - // HasCount checks if Count has been set in PatternFlowGtpv1EFlagCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1EFlagCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1EFlagCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv1EFlagCounter object -func (obj *patternFlowGtpv1EFlagCounter) SetStart(value uint32) PatternFlowGtpv1EFlagCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1EFlagCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1EFlagCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv1EFlagCounter object -func (obj *patternFlowGtpv1EFlagCounter) SetStep(value uint32) PatternFlowGtpv1EFlagCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1EFlagCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1EFlagCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv1EFlagCounter object -func (obj *patternFlowGtpv1EFlagCounter) SetCount(value uint32) PatternFlowGtpv1EFlagCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv1EFlagCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1EFlagCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1EFlagCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1EFlagCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv1EFlagCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv1EFlagMetricTag ***** -type patternFlowGtpv1EFlagMetricTag struct { - validation - obj *otg.PatternFlowGtpv1EFlagMetricTag - marshaller marshalPatternFlowGtpv1EFlagMetricTag - unMarshaller unMarshalPatternFlowGtpv1EFlagMetricTag -} - -func NewPatternFlowGtpv1EFlagMetricTag() PatternFlowGtpv1EFlagMetricTag { - obj := patternFlowGtpv1EFlagMetricTag{obj: &otg.PatternFlowGtpv1EFlagMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1EFlagMetricTag) msg() *otg.PatternFlowGtpv1EFlagMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv1EFlagMetricTag) setMsg(msg *otg.PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1EFlagMetricTag struct { - obj *patternFlowGtpv1EFlagMetricTag -} - -type marshalPatternFlowGtpv1EFlagMetricTag interface { - // ToProto marshals PatternFlowGtpv1EFlagMetricTag to protobuf object *otg.PatternFlowGtpv1EFlagMetricTag - ToProto() (*otg.PatternFlowGtpv1EFlagMetricTag, error) - // ToPbText marshals PatternFlowGtpv1EFlagMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1EFlagMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1EFlagMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1EFlagMetricTag struct { - obj *patternFlowGtpv1EFlagMetricTag -} - -type unMarshalPatternFlowGtpv1EFlagMetricTag interface { - // FromProto unmarshals PatternFlowGtpv1EFlagMetricTag from protobuf object *otg.PatternFlowGtpv1EFlagMetricTag - FromProto(msg *otg.PatternFlowGtpv1EFlagMetricTag) (PatternFlowGtpv1EFlagMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv1EFlagMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1EFlagMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1EFlagMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1EFlagMetricTag) Marshal() marshalPatternFlowGtpv1EFlagMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1EFlagMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1EFlagMetricTag) Unmarshal() unMarshalPatternFlowGtpv1EFlagMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1EFlagMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1EFlagMetricTag) ToProto() (*otg.PatternFlowGtpv1EFlagMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1EFlagMetricTag) FromProto(msg *otg.PatternFlowGtpv1EFlagMetricTag) (PatternFlowGtpv1EFlagMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1EFlagMetricTag) 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 *unMarshalpatternFlowGtpv1EFlagMetricTag) 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 *marshalpatternFlowGtpv1EFlagMetricTag) 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 *unMarshalpatternFlowGtpv1EFlagMetricTag) 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 *marshalpatternFlowGtpv1EFlagMetricTag) 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 *unMarshalpatternFlowGtpv1EFlagMetricTag) 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 *patternFlowGtpv1EFlagMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1EFlagMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1EFlagMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1EFlagMetricTag) Clone() (PatternFlowGtpv1EFlagMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1EFlagMetricTag() - 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 -} - -// PatternFlowGtpv1EFlagMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv1EFlagMetricTag interface { - Validation - // msg marshals PatternFlowGtpv1EFlagMetricTag to protobuf object *otg.PatternFlowGtpv1EFlagMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1EFlagMetricTag - // setMsg unmarshals PatternFlowGtpv1EFlagMetricTag from protobuf object *otg.PatternFlowGtpv1EFlagMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1EFlagMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1EFlagMetricTag - // validate validates PatternFlowGtpv1EFlagMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1EFlagMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv1EFlagMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv1EFlagMetricTag - SetName(value string) PatternFlowGtpv1EFlagMetricTag - // Offset returns uint32, set in PatternFlowGtpv1EFlagMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv1EFlagMetricTag - SetOffset(value uint32) PatternFlowGtpv1EFlagMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv1EFlagMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv1EFlagMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv1EFlagMetricTag - SetLength(value uint32) PatternFlowGtpv1EFlagMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv1EFlagMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv1EFlagMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv1EFlagMetricTag object -func (obj *patternFlowGtpv1EFlagMetricTag) SetName(value string) PatternFlowGtpv1EFlagMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1EFlagMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1EFlagMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv1EFlagMetricTag object -func (obj *patternFlowGtpv1EFlagMetricTag) SetOffset(value uint32) PatternFlowGtpv1EFlagMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1EFlagMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1EFlagMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv1EFlagMetricTag object -func (obj *patternFlowGtpv1EFlagMetricTag) SetLength(value uint32) PatternFlowGtpv1EFlagMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv1EFlagMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1EFlagMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1EFlagMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv1EFlagMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv1EFlagMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowGtpv1SFlagCounter ***** -type patternFlowGtpv1SFlagCounter struct { - validation - obj *otg.PatternFlowGtpv1SFlagCounter - marshaller marshalPatternFlowGtpv1SFlagCounter - unMarshaller unMarshalPatternFlowGtpv1SFlagCounter -} - -func NewPatternFlowGtpv1SFlagCounter() PatternFlowGtpv1SFlagCounter { - obj := patternFlowGtpv1SFlagCounter{obj: &otg.PatternFlowGtpv1SFlagCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1SFlagCounter) msg() *otg.PatternFlowGtpv1SFlagCounter { - return obj.obj -} - -func (obj *patternFlowGtpv1SFlagCounter) setMsg(msg *otg.PatternFlowGtpv1SFlagCounter) PatternFlowGtpv1SFlagCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1SFlagCounter struct { - obj *patternFlowGtpv1SFlagCounter -} - -type marshalPatternFlowGtpv1SFlagCounter interface { - // ToProto marshals PatternFlowGtpv1SFlagCounter to protobuf object *otg.PatternFlowGtpv1SFlagCounter - ToProto() (*otg.PatternFlowGtpv1SFlagCounter, error) - // ToPbText marshals PatternFlowGtpv1SFlagCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1SFlagCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1SFlagCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1SFlagCounter struct { - obj *patternFlowGtpv1SFlagCounter -} - -type unMarshalPatternFlowGtpv1SFlagCounter interface { - // FromProto unmarshals PatternFlowGtpv1SFlagCounter from protobuf object *otg.PatternFlowGtpv1SFlagCounter - FromProto(msg *otg.PatternFlowGtpv1SFlagCounter) (PatternFlowGtpv1SFlagCounter, error) - // FromPbText unmarshals PatternFlowGtpv1SFlagCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1SFlagCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1SFlagCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1SFlagCounter) Marshal() marshalPatternFlowGtpv1SFlagCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1SFlagCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1SFlagCounter) Unmarshal() unMarshalPatternFlowGtpv1SFlagCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1SFlagCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1SFlagCounter) ToProto() (*otg.PatternFlowGtpv1SFlagCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1SFlagCounter) FromProto(msg *otg.PatternFlowGtpv1SFlagCounter) (PatternFlowGtpv1SFlagCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1SFlagCounter) 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 *unMarshalpatternFlowGtpv1SFlagCounter) 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 *marshalpatternFlowGtpv1SFlagCounter) 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 *unMarshalpatternFlowGtpv1SFlagCounter) 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 *marshalpatternFlowGtpv1SFlagCounter) 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 *unMarshalpatternFlowGtpv1SFlagCounter) 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 *patternFlowGtpv1SFlagCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1SFlagCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1SFlagCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1SFlagCounter) Clone() (PatternFlowGtpv1SFlagCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1SFlagCounter() - 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 -} - -// PatternFlowGtpv1SFlagCounter is integer counter pattern -type PatternFlowGtpv1SFlagCounter interface { - Validation - // msg marshals PatternFlowGtpv1SFlagCounter to protobuf object *otg.PatternFlowGtpv1SFlagCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1SFlagCounter - // setMsg unmarshals PatternFlowGtpv1SFlagCounter from protobuf object *otg.PatternFlowGtpv1SFlagCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1SFlagCounter) PatternFlowGtpv1SFlagCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv1SFlagCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1SFlagCounter - // validate validates PatternFlowGtpv1SFlagCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1SFlagCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv1SFlagCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv1SFlagCounter - SetStart(value uint32) PatternFlowGtpv1SFlagCounter - // HasStart checks if Start has been set in PatternFlowGtpv1SFlagCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv1SFlagCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv1SFlagCounter - SetStep(value uint32) PatternFlowGtpv1SFlagCounter - // HasStep checks if Step has been set in PatternFlowGtpv1SFlagCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv1SFlagCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv1SFlagCounter - SetCount(value uint32) PatternFlowGtpv1SFlagCounter - // HasCount checks if Count has been set in PatternFlowGtpv1SFlagCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1SFlagCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1SFlagCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv1SFlagCounter object -func (obj *patternFlowGtpv1SFlagCounter) SetStart(value uint32) PatternFlowGtpv1SFlagCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1SFlagCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1SFlagCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv1SFlagCounter object -func (obj *patternFlowGtpv1SFlagCounter) SetStep(value uint32) PatternFlowGtpv1SFlagCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1SFlagCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1SFlagCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv1SFlagCounter object -func (obj *patternFlowGtpv1SFlagCounter) SetCount(value uint32) PatternFlowGtpv1SFlagCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv1SFlagCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1SFlagCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1SFlagCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1SFlagCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv1SFlagCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv1SFlagMetricTag ***** -type patternFlowGtpv1SFlagMetricTag struct { - validation - obj *otg.PatternFlowGtpv1SFlagMetricTag - marshaller marshalPatternFlowGtpv1SFlagMetricTag - unMarshaller unMarshalPatternFlowGtpv1SFlagMetricTag -} - -func NewPatternFlowGtpv1SFlagMetricTag() PatternFlowGtpv1SFlagMetricTag { - obj := patternFlowGtpv1SFlagMetricTag{obj: &otg.PatternFlowGtpv1SFlagMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1SFlagMetricTag) msg() *otg.PatternFlowGtpv1SFlagMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv1SFlagMetricTag) setMsg(msg *otg.PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1SFlagMetricTag struct { - obj *patternFlowGtpv1SFlagMetricTag -} - -type marshalPatternFlowGtpv1SFlagMetricTag interface { - // ToProto marshals PatternFlowGtpv1SFlagMetricTag to protobuf object *otg.PatternFlowGtpv1SFlagMetricTag - ToProto() (*otg.PatternFlowGtpv1SFlagMetricTag, error) - // ToPbText marshals PatternFlowGtpv1SFlagMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1SFlagMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1SFlagMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1SFlagMetricTag struct { - obj *patternFlowGtpv1SFlagMetricTag -} - -type unMarshalPatternFlowGtpv1SFlagMetricTag interface { - // FromProto unmarshals PatternFlowGtpv1SFlagMetricTag from protobuf object *otg.PatternFlowGtpv1SFlagMetricTag - FromProto(msg *otg.PatternFlowGtpv1SFlagMetricTag) (PatternFlowGtpv1SFlagMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv1SFlagMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1SFlagMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1SFlagMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1SFlagMetricTag) Marshal() marshalPatternFlowGtpv1SFlagMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1SFlagMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1SFlagMetricTag) Unmarshal() unMarshalPatternFlowGtpv1SFlagMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1SFlagMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1SFlagMetricTag) ToProto() (*otg.PatternFlowGtpv1SFlagMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1SFlagMetricTag) FromProto(msg *otg.PatternFlowGtpv1SFlagMetricTag) (PatternFlowGtpv1SFlagMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1SFlagMetricTag) 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 *unMarshalpatternFlowGtpv1SFlagMetricTag) 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 *marshalpatternFlowGtpv1SFlagMetricTag) 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 *unMarshalpatternFlowGtpv1SFlagMetricTag) 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 *marshalpatternFlowGtpv1SFlagMetricTag) 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 *unMarshalpatternFlowGtpv1SFlagMetricTag) 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 *patternFlowGtpv1SFlagMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1SFlagMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1SFlagMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1SFlagMetricTag) Clone() (PatternFlowGtpv1SFlagMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1SFlagMetricTag() - 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 -} - -// PatternFlowGtpv1SFlagMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv1SFlagMetricTag interface { - Validation - // msg marshals PatternFlowGtpv1SFlagMetricTag to protobuf object *otg.PatternFlowGtpv1SFlagMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1SFlagMetricTag - // setMsg unmarshals PatternFlowGtpv1SFlagMetricTag from protobuf object *otg.PatternFlowGtpv1SFlagMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1SFlagMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1SFlagMetricTag - // validate validates PatternFlowGtpv1SFlagMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1SFlagMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv1SFlagMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv1SFlagMetricTag - SetName(value string) PatternFlowGtpv1SFlagMetricTag - // Offset returns uint32, set in PatternFlowGtpv1SFlagMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv1SFlagMetricTag - SetOffset(value uint32) PatternFlowGtpv1SFlagMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv1SFlagMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv1SFlagMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv1SFlagMetricTag - SetLength(value uint32) PatternFlowGtpv1SFlagMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv1SFlagMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv1SFlagMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv1SFlagMetricTag object -func (obj *patternFlowGtpv1SFlagMetricTag) SetName(value string) PatternFlowGtpv1SFlagMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1SFlagMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1SFlagMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv1SFlagMetricTag object -func (obj *patternFlowGtpv1SFlagMetricTag) SetOffset(value uint32) PatternFlowGtpv1SFlagMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1SFlagMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1SFlagMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv1SFlagMetricTag object -func (obj *patternFlowGtpv1SFlagMetricTag) SetLength(value uint32) PatternFlowGtpv1SFlagMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv1SFlagMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1SFlagMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1SFlagMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv1SFlagMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv1SFlagMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowGtpv1PnFlagCounter ***** -type patternFlowGtpv1PnFlagCounter struct { - validation - obj *otg.PatternFlowGtpv1PnFlagCounter - marshaller marshalPatternFlowGtpv1PnFlagCounter - unMarshaller unMarshalPatternFlowGtpv1PnFlagCounter -} - -func NewPatternFlowGtpv1PnFlagCounter() PatternFlowGtpv1PnFlagCounter { - obj := patternFlowGtpv1PnFlagCounter{obj: &otg.PatternFlowGtpv1PnFlagCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1PnFlagCounter) msg() *otg.PatternFlowGtpv1PnFlagCounter { - return obj.obj -} - -func (obj *patternFlowGtpv1PnFlagCounter) setMsg(msg *otg.PatternFlowGtpv1PnFlagCounter) PatternFlowGtpv1PnFlagCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1PnFlagCounter struct { - obj *patternFlowGtpv1PnFlagCounter -} - -type marshalPatternFlowGtpv1PnFlagCounter interface { - // ToProto marshals PatternFlowGtpv1PnFlagCounter to protobuf object *otg.PatternFlowGtpv1PnFlagCounter - ToProto() (*otg.PatternFlowGtpv1PnFlagCounter, error) - // ToPbText marshals PatternFlowGtpv1PnFlagCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1PnFlagCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1PnFlagCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1PnFlagCounter struct { - obj *patternFlowGtpv1PnFlagCounter -} - -type unMarshalPatternFlowGtpv1PnFlagCounter interface { - // FromProto unmarshals PatternFlowGtpv1PnFlagCounter from protobuf object *otg.PatternFlowGtpv1PnFlagCounter - FromProto(msg *otg.PatternFlowGtpv1PnFlagCounter) (PatternFlowGtpv1PnFlagCounter, error) - // FromPbText unmarshals PatternFlowGtpv1PnFlagCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1PnFlagCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1PnFlagCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1PnFlagCounter) Marshal() marshalPatternFlowGtpv1PnFlagCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1PnFlagCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1PnFlagCounter) Unmarshal() unMarshalPatternFlowGtpv1PnFlagCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1PnFlagCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1PnFlagCounter) ToProto() (*otg.PatternFlowGtpv1PnFlagCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1PnFlagCounter) FromProto(msg *otg.PatternFlowGtpv1PnFlagCounter) (PatternFlowGtpv1PnFlagCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1PnFlagCounter) 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 *unMarshalpatternFlowGtpv1PnFlagCounter) 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 *marshalpatternFlowGtpv1PnFlagCounter) 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 *unMarshalpatternFlowGtpv1PnFlagCounter) 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 *marshalpatternFlowGtpv1PnFlagCounter) 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 *unMarshalpatternFlowGtpv1PnFlagCounter) 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 *patternFlowGtpv1PnFlagCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1PnFlagCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1PnFlagCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1PnFlagCounter) Clone() (PatternFlowGtpv1PnFlagCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1PnFlagCounter() - 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 -} - -// PatternFlowGtpv1PnFlagCounter is integer counter pattern -type PatternFlowGtpv1PnFlagCounter interface { - Validation - // msg marshals PatternFlowGtpv1PnFlagCounter to protobuf object *otg.PatternFlowGtpv1PnFlagCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1PnFlagCounter - // setMsg unmarshals PatternFlowGtpv1PnFlagCounter from protobuf object *otg.PatternFlowGtpv1PnFlagCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1PnFlagCounter) PatternFlowGtpv1PnFlagCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv1PnFlagCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1PnFlagCounter - // validate validates PatternFlowGtpv1PnFlagCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1PnFlagCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv1PnFlagCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv1PnFlagCounter - SetStart(value uint32) PatternFlowGtpv1PnFlagCounter - // HasStart checks if Start has been set in PatternFlowGtpv1PnFlagCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv1PnFlagCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv1PnFlagCounter - SetStep(value uint32) PatternFlowGtpv1PnFlagCounter - // HasStep checks if Step has been set in PatternFlowGtpv1PnFlagCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv1PnFlagCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv1PnFlagCounter - SetCount(value uint32) PatternFlowGtpv1PnFlagCounter - // HasCount checks if Count has been set in PatternFlowGtpv1PnFlagCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1PnFlagCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1PnFlagCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv1PnFlagCounter object -func (obj *patternFlowGtpv1PnFlagCounter) SetStart(value uint32) PatternFlowGtpv1PnFlagCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1PnFlagCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1PnFlagCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv1PnFlagCounter object -func (obj *patternFlowGtpv1PnFlagCounter) SetStep(value uint32) PatternFlowGtpv1PnFlagCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1PnFlagCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1PnFlagCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv1PnFlagCounter object -func (obj *patternFlowGtpv1PnFlagCounter) SetCount(value uint32) PatternFlowGtpv1PnFlagCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv1PnFlagCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1PnFlagCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1PnFlagCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1PnFlagCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv1PnFlagCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv1PnFlagMetricTag ***** -type patternFlowGtpv1PnFlagMetricTag struct { - validation - obj *otg.PatternFlowGtpv1PnFlagMetricTag - marshaller marshalPatternFlowGtpv1PnFlagMetricTag - unMarshaller unMarshalPatternFlowGtpv1PnFlagMetricTag -} - -func NewPatternFlowGtpv1PnFlagMetricTag() PatternFlowGtpv1PnFlagMetricTag { - obj := patternFlowGtpv1PnFlagMetricTag{obj: &otg.PatternFlowGtpv1PnFlagMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1PnFlagMetricTag) msg() *otg.PatternFlowGtpv1PnFlagMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv1PnFlagMetricTag) setMsg(msg *otg.PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1PnFlagMetricTag struct { - obj *patternFlowGtpv1PnFlagMetricTag -} - -type marshalPatternFlowGtpv1PnFlagMetricTag interface { - // ToProto marshals PatternFlowGtpv1PnFlagMetricTag to protobuf object *otg.PatternFlowGtpv1PnFlagMetricTag - ToProto() (*otg.PatternFlowGtpv1PnFlagMetricTag, error) - // ToPbText marshals PatternFlowGtpv1PnFlagMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1PnFlagMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1PnFlagMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1PnFlagMetricTag struct { - obj *patternFlowGtpv1PnFlagMetricTag -} - -type unMarshalPatternFlowGtpv1PnFlagMetricTag interface { - // FromProto unmarshals PatternFlowGtpv1PnFlagMetricTag from protobuf object *otg.PatternFlowGtpv1PnFlagMetricTag - FromProto(msg *otg.PatternFlowGtpv1PnFlagMetricTag) (PatternFlowGtpv1PnFlagMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv1PnFlagMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1PnFlagMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1PnFlagMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1PnFlagMetricTag) Marshal() marshalPatternFlowGtpv1PnFlagMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1PnFlagMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1PnFlagMetricTag) Unmarshal() unMarshalPatternFlowGtpv1PnFlagMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1PnFlagMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1PnFlagMetricTag) ToProto() (*otg.PatternFlowGtpv1PnFlagMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1PnFlagMetricTag) FromProto(msg *otg.PatternFlowGtpv1PnFlagMetricTag) (PatternFlowGtpv1PnFlagMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1PnFlagMetricTag) 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 *unMarshalpatternFlowGtpv1PnFlagMetricTag) 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 *marshalpatternFlowGtpv1PnFlagMetricTag) 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 *unMarshalpatternFlowGtpv1PnFlagMetricTag) 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 *marshalpatternFlowGtpv1PnFlagMetricTag) 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 *unMarshalpatternFlowGtpv1PnFlagMetricTag) 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 *patternFlowGtpv1PnFlagMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1PnFlagMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1PnFlagMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1PnFlagMetricTag) Clone() (PatternFlowGtpv1PnFlagMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1PnFlagMetricTag() - 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 -} - -// PatternFlowGtpv1PnFlagMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv1PnFlagMetricTag interface { - Validation - // msg marshals PatternFlowGtpv1PnFlagMetricTag to protobuf object *otg.PatternFlowGtpv1PnFlagMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1PnFlagMetricTag - // setMsg unmarshals PatternFlowGtpv1PnFlagMetricTag from protobuf object *otg.PatternFlowGtpv1PnFlagMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1PnFlagMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1PnFlagMetricTag - // validate validates PatternFlowGtpv1PnFlagMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1PnFlagMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv1PnFlagMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv1PnFlagMetricTag - SetName(value string) PatternFlowGtpv1PnFlagMetricTag - // Offset returns uint32, set in PatternFlowGtpv1PnFlagMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv1PnFlagMetricTag - SetOffset(value uint32) PatternFlowGtpv1PnFlagMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv1PnFlagMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv1PnFlagMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv1PnFlagMetricTag - SetLength(value uint32) PatternFlowGtpv1PnFlagMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv1PnFlagMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv1PnFlagMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv1PnFlagMetricTag object -func (obj *patternFlowGtpv1PnFlagMetricTag) SetName(value string) PatternFlowGtpv1PnFlagMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1PnFlagMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1PnFlagMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv1PnFlagMetricTag object -func (obj *patternFlowGtpv1PnFlagMetricTag) SetOffset(value uint32) PatternFlowGtpv1PnFlagMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1PnFlagMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1PnFlagMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv1PnFlagMetricTag object -func (obj *patternFlowGtpv1PnFlagMetricTag) SetLength(value uint32) PatternFlowGtpv1PnFlagMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv1PnFlagMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1PnFlagMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1PnFlagMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv1PnFlagMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv1PnFlagMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowGtpv1MessageTypeCounter ***** -type patternFlowGtpv1MessageTypeCounter struct { - validation - obj *otg.PatternFlowGtpv1MessageTypeCounter - marshaller marshalPatternFlowGtpv1MessageTypeCounter - unMarshaller unMarshalPatternFlowGtpv1MessageTypeCounter -} - -func NewPatternFlowGtpv1MessageTypeCounter() PatternFlowGtpv1MessageTypeCounter { - obj := patternFlowGtpv1MessageTypeCounter{obj: &otg.PatternFlowGtpv1MessageTypeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1MessageTypeCounter) msg() *otg.PatternFlowGtpv1MessageTypeCounter { - return obj.obj -} - -func (obj *patternFlowGtpv1MessageTypeCounter) setMsg(msg *otg.PatternFlowGtpv1MessageTypeCounter) PatternFlowGtpv1MessageTypeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1MessageTypeCounter struct { - obj *patternFlowGtpv1MessageTypeCounter -} - -type marshalPatternFlowGtpv1MessageTypeCounter interface { - // ToProto marshals PatternFlowGtpv1MessageTypeCounter to protobuf object *otg.PatternFlowGtpv1MessageTypeCounter - ToProto() (*otg.PatternFlowGtpv1MessageTypeCounter, error) - // ToPbText marshals PatternFlowGtpv1MessageTypeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1MessageTypeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1MessageTypeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1MessageTypeCounter struct { - obj *patternFlowGtpv1MessageTypeCounter -} - -type unMarshalPatternFlowGtpv1MessageTypeCounter interface { - // FromProto unmarshals PatternFlowGtpv1MessageTypeCounter from protobuf object *otg.PatternFlowGtpv1MessageTypeCounter - FromProto(msg *otg.PatternFlowGtpv1MessageTypeCounter) (PatternFlowGtpv1MessageTypeCounter, error) - // FromPbText unmarshals PatternFlowGtpv1MessageTypeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1MessageTypeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1MessageTypeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1MessageTypeCounter) Marshal() marshalPatternFlowGtpv1MessageTypeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1MessageTypeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1MessageTypeCounter) Unmarshal() unMarshalPatternFlowGtpv1MessageTypeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1MessageTypeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1MessageTypeCounter) ToProto() (*otg.PatternFlowGtpv1MessageTypeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1MessageTypeCounter) FromProto(msg *otg.PatternFlowGtpv1MessageTypeCounter) (PatternFlowGtpv1MessageTypeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1MessageTypeCounter) 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 *unMarshalpatternFlowGtpv1MessageTypeCounter) 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 *marshalpatternFlowGtpv1MessageTypeCounter) 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 *unMarshalpatternFlowGtpv1MessageTypeCounter) 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 *marshalpatternFlowGtpv1MessageTypeCounter) 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 *unMarshalpatternFlowGtpv1MessageTypeCounter) 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 *patternFlowGtpv1MessageTypeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1MessageTypeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1MessageTypeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1MessageTypeCounter) Clone() (PatternFlowGtpv1MessageTypeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1MessageTypeCounter() - 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 -} - -// PatternFlowGtpv1MessageTypeCounter is integer counter pattern -type PatternFlowGtpv1MessageTypeCounter interface { - Validation - // msg marshals PatternFlowGtpv1MessageTypeCounter to protobuf object *otg.PatternFlowGtpv1MessageTypeCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1MessageTypeCounter - // setMsg unmarshals PatternFlowGtpv1MessageTypeCounter from protobuf object *otg.PatternFlowGtpv1MessageTypeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1MessageTypeCounter) PatternFlowGtpv1MessageTypeCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv1MessageTypeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1MessageTypeCounter - // validate validates PatternFlowGtpv1MessageTypeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1MessageTypeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv1MessageTypeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv1MessageTypeCounter - SetStart(value uint32) PatternFlowGtpv1MessageTypeCounter - // HasStart checks if Start has been set in PatternFlowGtpv1MessageTypeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv1MessageTypeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv1MessageTypeCounter - SetStep(value uint32) PatternFlowGtpv1MessageTypeCounter - // HasStep checks if Step has been set in PatternFlowGtpv1MessageTypeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv1MessageTypeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv1MessageTypeCounter - SetCount(value uint32) PatternFlowGtpv1MessageTypeCounter - // HasCount checks if Count has been set in PatternFlowGtpv1MessageTypeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1MessageTypeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1MessageTypeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv1MessageTypeCounter object -func (obj *patternFlowGtpv1MessageTypeCounter) SetStart(value uint32) PatternFlowGtpv1MessageTypeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1MessageTypeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1MessageTypeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv1MessageTypeCounter object -func (obj *patternFlowGtpv1MessageTypeCounter) SetStep(value uint32) PatternFlowGtpv1MessageTypeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1MessageTypeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1MessageTypeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv1MessageTypeCounter object -func (obj *patternFlowGtpv1MessageTypeCounter) SetCount(value uint32) PatternFlowGtpv1MessageTypeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv1MessageTypeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1MessageTypeCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1MessageTypeCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1MessageTypeCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv1MessageTypeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv1MessageTypeMetricTag ***** -type patternFlowGtpv1MessageTypeMetricTag struct { - validation - obj *otg.PatternFlowGtpv1MessageTypeMetricTag - marshaller marshalPatternFlowGtpv1MessageTypeMetricTag - unMarshaller unMarshalPatternFlowGtpv1MessageTypeMetricTag -} - -func NewPatternFlowGtpv1MessageTypeMetricTag() PatternFlowGtpv1MessageTypeMetricTag { - obj := patternFlowGtpv1MessageTypeMetricTag{obj: &otg.PatternFlowGtpv1MessageTypeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1MessageTypeMetricTag) msg() *otg.PatternFlowGtpv1MessageTypeMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv1MessageTypeMetricTag) setMsg(msg *otg.PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1MessageTypeMetricTag struct { - obj *patternFlowGtpv1MessageTypeMetricTag -} - -type marshalPatternFlowGtpv1MessageTypeMetricTag interface { - // ToProto marshals PatternFlowGtpv1MessageTypeMetricTag to protobuf object *otg.PatternFlowGtpv1MessageTypeMetricTag - ToProto() (*otg.PatternFlowGtpv1MessageTypeMetricTag, error) - // ToPbText marshals PatternFlowGtpv1MessageTypeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1MessageTypeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1MessageTypeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1MessageTypeMetricTag struct { - obj *patternFlowGtpv1MessageTypeMetricTag -} - -type unMarshalPatternFlowGtpv1MessageTypeMetricTag interface { - // FromProto unmarshals PatternFlowGtpv1MessageTypeMetricTag from protobuf object *otg.PatternFlowGtpv1MessageTypeMetricTag - FromProto(msg *otg.PatternFlowGtpv1MessageTypeMetricTag) (PatternFlowGtpv1MessageTypeMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv1MessageTypeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1MessageTypeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1MessageTypeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1MessageTypeMetricTag) Marshal() marshalPatternFlowGtpv1MessageTypeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1MessageTypeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1MessageTypeMetricTag) Unmarshal() unMarshalPatternFlowGtpv1MessageTypeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1MessageTypeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1MessageTypeMetricTag) ToProto() (*otg.PatternFlowGtpv1MessageTypeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1MessageTypeMetricTag) FromProto(msg *otg.PatternFlowGtpv1MessageTypeMetricTag) (PatternFlowGtpv1MessageTypeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1MessageTypeMetricTag) 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 *unMarshalpatternFlowGtpv1MessageTypeMetricTag) 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 *marshalpatternFlowGtpv1MessageTypeMetricTag) 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 *unMarshalpatternFlowGtpv1MessageTypeMetricTag) 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 *marshalpatternFlowGtpv1MessageTypeMetricTag) 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 *unMarshalpatternFlowGtpv1MessageTypeMetricTag) 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 *patternFlowGtpv1MessageTypeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1MessageTypeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1MessageTypeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1MessageTypeMetricTag) Clone() (PatternFlowGtpv1MessageTypeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1MessageTypeMetricTag() - 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 -} - -// PatternFlowGtpv1MessageTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv1MessageTypeMetricTag interface { - Validation - // msg marshals PatternFlowGtpv1MessageTypeMetricTag to protobuf object *otg.PatternFlowGtpv1MessageTypeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1MessageTypeMetricTag - // setMsg unmarshals PatternFlowGtpv1MessageTypeMetricTag from protobuf object *otg.PatternFlowGtpv1MessageTypeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1MessageTypeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1MessageTypeMetricTag - // validate validates PatternFlowGtpv1MessageTypeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1MessageTypeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv1MessageTypeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv1MessageTypeMetricTag - SetName(value string) PatternFlowGtpv1MessageTypeMetricTag - // Offset returns uint32, set in PatternFlowGtpv1MessageTypeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv1MessageTypeMetricTag - SetOffset(value uint32) PatternFlowGtpv1MessageTypeMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv1MessageTypeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv1MessageTypeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv1MessageTypeMetricTag - SetLength(value uint32) PatternFlowGtpv1MessageTypeMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv1MessageTypeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv1MessageTypeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv1MessageTypeMetricTag object -func (obj *patternFlowGtpv1MessageTypeMetricTag) SetName(value string) PatternFlowGtpv1MessageTypeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1MessageTypeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1MessageTypeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv1MessageTypeMetricTag object -func (obj *patternFlowGtpv1MessageTypeMetricTag) SetOffset(value uint32) PatternFlowGtpv1MessageTypeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1MessageTypeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1MessageTypeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv1MessageTypeMetricTag object -func (obj *patternFlowGtpv1MessageTypeMetricTag) SetLength(value uint32) PatternFlowGtpv1MessageTypeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv1MessageTypeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1MessageTypeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1MessageTypeMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv1MessageTypeMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv1MessageTypeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowGtpv1MessageLengthCounter ***** -type patternFlowGtpv1MessageLengthCounter struct { - validation - obj *otg.PatternFlowGtpv1MessageLengthCounter - marshaller marshalPatternFlowGtpv1MessageLengthCounter - unMarshaller unMarshalPatternFlowGtpv1MessageLengthCounter -} - -func NewPatternFlowGtpv1MessageLengthCounter() PatternFlowGtpv1MessageLengthCounter { - obj := patternFlowGtpv1MessageLengthCounter{obj: &otg.PatternFlowGtpv1MessageLengthCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1MessageLengthCounter) msg() *otg.PatternFlowGtpv1MessageLengthCounter { - return obj.obj -} - -func (obj *patternFlowGtpv1MessageLengthCounter) setMsg(msg *otg.PatternFlowGtpv1MessageLengthCounter) PatternFlowGtpv1MessageLengthCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1MessageLengthCounter struct { - obj *patternFlowGtpv1MessageLengthCounter -} - -type marshalPatternFlowGtpv1MessageLengthCounter interface { - // ToProto marshals PatternFlowGtpv1MessageLengthCounter to protobuf object *otg.PatternFlowGtpv1MessageLengthCounter - ToProto() (*otg.PatternFlowGtpv1MessageLengthCounter, error) - // ToPbText marshals PatternFlowGtpv1MessageLengthCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1MessageLengthCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1MessageLengthCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1MessageLengthCounter struct { - obj *patternFlowGtpv1MessageLengthCounter -} - -type unMarshalPatternFlowGtpv1MessageLengthCounter interface { - // FromProto unmarshals PatternFlowGtpv1MessageLengthCounter from protobuf object *otg.PatternFlowGtpv1MessageLengthCounter - FromProto(msg *otg.PatternFlowGtpv1MessageLengthCounter) (PatternFlowGtpv1MessageLengthCounter, error) - // FromPbText unmarshals PatternFlowGtpv1MessageLengthCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1MessageLengthCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1MessageLengthCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1MessageLengthCounter) Marshal() marshalPatternFlowGtpv1MessageLengthCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1MessageLengthCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1MessageLengthCounter) Unmarshal() unMarshalPatternFlowGtpv1MessageLengthCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1MessageLengthCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1MessageLengthCounter) ToProto() (*otg.PatternFlowGtpv1MessageLengthCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1MessageLengthCounter) FromProto(msg *otg.PatternFlowGtpv1MessageLengthCounter) (PatternFlowGtpv1MessageLengthCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1MessageLengthCounter) 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 *unMarshalpatternFlowGtpv1MessageLengthCounter) 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 *marshalpatternFlowGtpv1MessageLengthCounter) 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 *unMarshalpatternFlowGtpv1MessageLengthCounter) 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 *marshalpatternFlowGtpv1MessageLengthCounter) 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 *unMarshalpatternFlowGtpv1MessageLengthCounter) 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 *patternFlowGtpv1MessageLengthCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1MessageLengthCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1MessageLengthCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1MessageLengthCounter) Clone() (PatternFlowGtpv1MessageLengthCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1MessageLengthCounter() - 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 -} - -// PatternFlowGtpv1MessageLengthCounter is integer counter pattern -type PatternFlowGtpv1MessageLengthCounter interface { - Validation - // msg marshals PatternFlowGtpv1MessageLengthCounter to protobuf object *otg.PatternFlowGtpv1MessageLengthCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1MessageLengthCounter - // setMsg unmarshals PatternFlowGtpv1MessageLengthCounter from protobuf object *otg.PatternFlowGtpv1MessageLengthCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1MessageLengthCounter) PatternFlowGtpv1MessageLengthCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv1MessageLengthCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1MessageLengthCounter - // validate validates PatternFlowGtpv1MessageLengthCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1MessageLengthCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv1MessageLengthCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv1MessageLengthCounter - SetStart(value uint32) PatternFlowGtpv1MessageLengthCounter - // HasStart checks if Start has been set in PatternFlowGtpv1MessageLengthCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv1MessageLengthCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv1MessageLengthCounter - SetStep(value uint32) PatternFlowGtpv1MessageLengthCounter - // HasStep checks if Step has been set in PatternFlowGtpv1MessageLengthCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv1MessageLengthCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv1MessageLengthCounter - SetCount(value uint32) PatternFlowGtpv1MessageLengthCounter - // HasCount checks if Count has been set in PatternFlowGtpv1MessageLengthCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1MessageLengthCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1MessageLengthCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv1MessageLengthCounter object -func (obj *patternFlowGtpv1MessageLengthCounter) SetStart(value uint32) PatternFlowGtpv1MessageLengthCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1MessageLengthCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1MessageLengthCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv1MessageLengthCounter object -func (obj *patternFlowGtpv1MessageLengthCounter) SetStep(value uint32) PatternFlowGtpv1MessageLengthCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1MessageLengthCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1MessageLengthCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv1MessageLengthCounter object -func (obj *patternFlowGtpv1MessageLengthCounter) SetCount(value uint32) PatternFlowGtpv1MessageLengthCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv1MessageLengthCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1MessageLengthCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1MessageLengthCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1MessageLengthCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv1MessageLengthCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv1MessageLengthMetricTag ***** -type patternFlowGtpv1MessageLengthMetricTag struct { - validation - obj *otg.PatternFlowGtpv1MessageLengthMetricTag - marshaller marshalPatternFlowGtpv1MessageLengthMetricTag - unMarshaller unMarshalPatternFlowGtpv1MessageLengthMetricTag -} - -func NewPatternFlowGtpv1MessageLengthMetricTag() PatternFlowGtpv1MessageLengthMetricTag { - obj := patternFlowGtpv1MessageLengthMetricTag{obj: &otg.PatternFlowGtpv1MessageLengthMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1MessageLengthMetricTag) msg() *otg.PatternFlowGtpv1MessageLengthMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv1MessageLengthMetricTag) setMsg(msg *otg.PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1MessageLengthMetricTag struct { - obj *patternFlowGtpv1MessageLengthMetricTag -} - -type marshalPatternFlowGtpv1MessageLengthMetricTag interface { - // ToProto marshals PatternFlowGtpv1MessageLengthMetricTag to protobuf object *otg.PatternFlowGtpv1MessageLengthMetricTag - ToProto() (*otg.PatternFlowGtpv1MessageLengthMetricTag, error) - // ToPbText marshals PatternFlowGtpv1MessageLengthMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1MessageLengthMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1MessageLengthMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1MessageLengthMetricTag struct { - obj *patternFlowGtpv1MessageLengthMetricTag -} - -type unMarshalPatternFlowGtpv1MessageLengthMetricTag interface { - // FromProto unmarshals PatternFlowGtpv1MessageLengthMetricTag from protobuf object *otg.PatternFlowGtpv1MessageLengthMetricTag - FromProto(msg *otg.PatternFlowGtpv1MessageLengthMetricTag) (PatternFlowGtpv1MessageLengthMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv1MessageLengthMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1MessageLengthMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1MessageLengthMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1MessageLengthMetricTag) Marshal() marshalPatternFlowGtpv1MessageLengthMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1MessageLengthMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1MessageLengthMetricTag) Unmarshal() unMarshalPatternFlowGtpv1MessageLengthMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1MessageLengthMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1MessageLengthMetricTag) ToProto() (*otg.PatternFlowGtpv1MessageLengthMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1MessageLengthMetricTag) FromProto(msg *otg.PatternFlowGtpv1MessageLengthMetricTag) (PatternFlowGtpv1MessageLengthMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1MessageLengthMetricTag) 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 *unMarshalpatternFlowGtpv1MessageLengthMetricTag) 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 *marshalpatternFlowGtpv1MessageLengthMetricTag) 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 *unMarshalpatternFlowGtpv1MessageLengthMetricTag) 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 *marshalpatternFlowGtpv1MessageLengthMetricTag) 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 *unMarshalpatternFlowGtpv1MessageLengthMetricTag) 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 *patternFlowGtpv1MessageLengthMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1MessageLengthMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1MessageLengthMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1MessageLengthMetricTag) Clone() (PatternFlowGtpv1MessageLengthMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1MessageLengthMetricTag() - 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 -} - -// PatternFlowGtpv1MessageLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv1MessageLengthMetricTag interface { - Validation - // msg marshals PatternFlowGtpv1MessageLengthMetricTag to protobuf object *otg.PatternFlowGtpv1MessageLengthMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1MessageLengthMetricTag - // setMsg unmarshals PatternFlowGtpv1MessageLengthMetricTag from protobuf object *otg.PatternFlowGtpv1MessageLengthMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1MessageLengthMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1MessageLengthMetricTag - // validate validates PatternFlowGtpv1MessageLengthMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1MessageLengthMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv1MessageLengthMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv1MessageLengthMetricTag - SetName(value string) PatternFlowGtpv1MessageLengthMetricTag - // Offset returns uint32, set in PatternFlowGtpv1MessageLengthMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv1MessageLengthMetricTag - SetOffset(value uint32) PatternFlowGtpv1MessageLengthMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv1MessageLengthMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv1MessageLengthMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv1MessageLengthMetricTag - SetLength(value uint32) PatternFlowGtpv1MessageLengthMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv1MessageLengthMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv1MessageLengthMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv1MessageLengthMetricTag object -func (obj *patternFlowGtpv1MessageLengthMetricTag) SetName(value string) PatternFlowGtpv1MessageLengthMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1MessageLengthMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1MessageLengthMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv1MessageLengthMetricTag object -func (obj *patternFlowGtpv1MessageLengthMetricTag) SetOffset(value uint32) PatternFlowGtpv1MessageLengthMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1MessageLengthMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1MessageLengthMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv1MessageLengthMetricTag object -func (obj *patternFlowGtpv1MessageLengthMetricTag) SetLength(value uint32) PatternFlowGtpv1MessageLengthMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv1MessageLengthMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1MessageLengthMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1MessageLengthMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv1MessageLengthMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv1MessageLengthMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowGtpv1TeidCounter ***** -type patternFlowGtpv1TeidCounter struct { - validation - obj *otg.PatternFlowGtpv1TeidCounter - marshaller marshalPatternFlowGtpv1TeidCounter - unMarshaller unMarshalPatternFlowGtpv1TeidCounter -} - -func NewPatternFlowGtpv1TeidCounter() PatternFlowGtpv1TeidCounter { - obj := patternFlowGtpv1TeidCounter{obj: &otg.PatternFlowGtpv1TeidCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1TeidCounter) msg() *otg.PatternFlowGtpv1TeidCounter { - return obj.obj -} - -func (obj *patternFlowGtpv1TeidCounter) setMsg(msg *otg.PatternFlowGtpv1TeidCounter) PatternFlowGtpv1TeidCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1TeidCounter struct { - obj *patternFlowGtpv1TeidCounter -} - -type marshalPatternFlowGtpv1TeidCounter interface { - // ToProto marshals PatternFlowGtpv1TeidCounter to protobuf object *otg.PatternFlowGtpv1TeidCounter - ToProto() (*otg.PatternFlowGtpv1TeidCounter, error) - // ToPbText marshals PatternFlowGtpv1TeidCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1TeidCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1TeidCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1TeidCounter struct { - obj *patternFlowGtpv1TeidCounter -} - -type unMarshalPatternFlowGtpv1TeidCounter interface { - // FromProto unmarshals PatternFlowGtpv1TeidCounter from protobuf object *otg.PatternFlowGtpv1TeidCounter - FromProto(msg *otg.PatternFlowGtpv1TeidCounter) (PatternFlowGtpv1TeidCounter, error) - // FromPbText unmarshals PatternFlowGtpv1TeidCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1TeidCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1TeidCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1TeidCounter) Marshal() marshalPatternFlowGtpv1TeidCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1TeidCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1TeidCounter) Unmarshal() unMarshalPatternFlowGtpv1TeidCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1TeidCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1TeidCounter) ToProto() (*otg.PatternFlowGtpv1TeidCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1TeidCounter) FromProto(msg *otg.PatternFlowGtpv1TeidCounter) (PatternFlowGtpv1TeidCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1TeidCounter) 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 *unMarshalpatternFlowGtpv1TeidCounter) 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 *marshalpatternFlowGtpv1TeidCounter) 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 *unMarshalpatternFlowGtpv1TeidCounter) 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 *marshalpatternFlowGtpv1TeidCounter) 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 *unMarshalpatternFlowGtpv1TeidCounter) 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 *patternFlowGtpv1TeidCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1TeidCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1TeidCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1TeidCounter) Clone() (PatternFlowGtpv1TeidCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1TeidCounter() - 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 -} - -// PatternFlowGtpv1TeidCounter is integer counter pattern -type PatternFlowGtpv1TeidCounter interface { - Validation - // msg marshals PatternFlowGtpv1TeidCounter to protobuf object *otg.PatternFlowGtpv1TeidCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1TeidCounter - // setMsg unmarshals PatternFlowGtpv1TeidCounter from protobuf object *otg.PatternFlowGtpv1TeidCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1TeidCounter) PatternFlowGtpv1TeidCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv1TeidCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1TeidCounter - // validate validates PatternFlowGtpv1TeidCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1TeidCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv1TeidCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv1TeidCounter - SetStart(value uint32) PatternFlowGtpv1TeidCounter - // HasStart checks if Start has been set in PatternFlowGtpv1TeidCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv1TeidCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv1TeidCounter - SetStep(value uint32) PatternFlowGtpv1TeidCounter - // HasStep checks if Step has been set in PatternFlowGtpv1TeidCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv1TeidCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv1TeidCounter - SetCount(value uint32) PatternFlowGtpv1TeidCounter - // HasCount checks if Count has been set in PatternFlowGtpv1TeidCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1TeidCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1TeidCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv1TeidCounter object -func (obj *patternFlowGtpv1TeidCounter) SetStart(value uint32) PatternFlowGtpv1TeidCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1TeidCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1TeidCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv1TeidCounter object -func (obj *patternFlowGtpv1TeidCounter) SetStep(value uint32) PatternFlowGtpv1TeidCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1TeidCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1TeidCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv1TeidCounter object -func (obj *patternFlowGtpv1TeidCounter) SetCount(value uint32) PatternFlowGtpv1TeidCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv1TeidCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowGtpv1TeidCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv1TeidMetricTag ***** -type patternFlowGtpv1TeidMetricTag struct { - validation - obj *otg.PatternFlowGtpv1TeidMetricTag - marshaller marshalPatternFlowGtpv1TeidMetricTag - unMarshaller unMarshalPatternFlowGtpv1TeidMetricTag -} - -func NewPatternFlowGtpv1TeidMetricTag() PatternFlowGtpv1TeidMetricTag { - obj := patternFlowGtpv1TeidMetricTag{obj: &otg.PatternFlowGtpv1TeidMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1TeidMetricTag) msg() *otg.PatternFlowGtpv1TeidMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv1TeidMetricTag) setMsg(msg *otg.PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1TeidMetricTag struct { - obj *patternFlowGtpv1TeidMetricTag -} - -type marshalPatternFlowGtpv1TeidMetricTag interface { - // ToProto marshals PatternFlowGtpv1TeidMetricTag to protobuf object *otg.PatternFlowGtpv1TeidMetricTag - ToProto() (*otg.PatternFlowGtpv1TeidMetricTag, error) - // ToPbText marshals PatternFlowGtpv1TeidMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1TeidMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1TeidMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1TeidMetricTag struct { - obj *patternFlowGtpv1TeidMetricTag -} - -type unMarshalPatternFlowGtpv1TeidMetricTag interface { - // FromProto unmarshals PatternFlowGtpv1TeidMetricTag from protobuf object *otg.PatternFlowGtpv1TeidMetricTag - FromProto(msg *otg.PatternFlowGtpv1TeidMetricTag) (PatternFlowGtpv1TeidMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv1TeidMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1TeidMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1TeidMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1TeidMetricTag) Marshal() marshalPatternFlowGtpv1TeidMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1TeidMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1TeidMetricTag) Unmarshal() unMarshalPatternFlowGtpv1TeidMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1TeidMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1TeidMetricTag) ToProto() (*otg.PatternFlowGtpv1TeidMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1TeidMetricTag) FromProto(msg *otg.PatternFlowGtpv1TeidMetricTag) (PatternFlowGtpv1TeidMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1TeidMetricTag) 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 *unMarshalpatternFlowGtpv1TeidMetricTag) 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 *marshalpatternFlowGtpv1TeidMetricTag) 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 *unMarshalpatternFlowGtpv1TeidMetricTag) 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 *marshalpatternFlowGtpv1TeidMetricTag) 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 *unMarshalpatternFlowGtpv1TeidMetricTag) 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 *patternFlowGtpv1TeidMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1TeidMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1TeidMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1TeidMetricTag) Clone() (PatternFlowGtpv1TeidMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1TeidMetricTag() - 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 -} - -// PatternFlowGtpv1TeidMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv1TeidMetricTag interface { - Validation - // msg marshals PatternFlowGtpv1TeidMetricTag to protobuf object *otg.PatternFlowGtpv1TeidMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1TeidMetricTag - // setMsg unmarshals PatternFlowGtpv1TeidMetricTag from protobuf object *otg.PatternFlowGtpv1TeidMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1TeidMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1TeidMetricTag - // validate validates PatternFlowGtpv1TeidMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1TeidMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv1TeidMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv1TeidMetricTag - SetName(value string) PatternFlowGtpv1TeidMetricTag - // Offset returns uint32, set in PatternFlowGtpv1TeidMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv1TeidMetricTag - SetOffset(value uint32) PatternFlowGtpv1TeidMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv1TeidMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv1TeidMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv1TeidMetricTag - SetLength(value uint32) PatternFlowGtpv1TeidMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv1TeidMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv1TeidMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv1TeidMetricTag object -func (obj *patternFlowGtpv1TeidMetricTag) SetName(value string) PatternFlowGtpv1TeidMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1TeidMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1TeidMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv1TeidMetricTag object -func (obj *patternFlowGtpv1TeidMetricTag) SetOffset(value uint32) PatternFlowGtpv1TeidMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1TeidMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1TeidMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv1TeidMetricTag object -func (obj *patternFlowGtpv1TeidMetricTag) SetLength(value uint32) PatternFlowGtpv1TeidMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv1TeidMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1TeidMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1TeidMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv1TeidMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv1TeidMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(32) - } - -} - -// ***** PatternFlowGtpv1SquenceNumberCounter ***** -type patternFlowGtpv1SquenceNumberCounter struct { - validation - obj *otg.PatternFlowGtpv1SquenceNumberCounter - marshaller marshalPatternFlowGtpv1SquenceNumberCounter - unMarshaller unMarshalPatternFlowGtpv1SquenceNumberCounter -} - -func NewPatternFlowGtpv1SquenceNumberCounter() PatternFlowGtpv1SquenceNumberCounter { - obj := patternFlowGtpv1SquenceNumberCounter{obj: &otg.PatternFlowGtpv1SquenceNumberCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1SquenceNumberCounter) msg() *otg.PatternFlowGtpv1SquenceNumberCounter { - return obj.obj -} - -func (obj *patternFlowGtpv1SquenceNumberCounter) setMsg(msg *otg.PatternFlowGtpv1SquenceNumberCounter) PatternFlowGtpv1SquenceNumberCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1SquenceNumberCounter struct { - obj *patternFlowGtpv1SquenceNumberCounter -} - -type marshalPatternFlowGtpv1SquenceNumberCounter interface { - // ToProto marshals PatternFlowGtpv1SquenceNumberCounter to protobuf object *otg.PatternFlowGtpv1SquenceNumberCounter - ToProto() (*otg.PatternFlowGtpv1SquenceNumberCounter, error) - // ToPbText marshals PatternFlowGtpv1SquenceNumberCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1SquenceNumberCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1SquenceNumberCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1SquenceNumberCounter struct { - obj *patternFlowGtpv1SquenceNumberCounter -} - -type unMarshalPatternFlowGtpv1SquenceNumberCounter interface { - // FromProto unmarshals PatternFlowGtpv1SquenceNumberCounter from protobuf object *otg.PatternFlowGtpv1SquenceNumberCounter - FromProto(msg *otg.PatternFlowGtpv1SquenceNumberCounter) (PatternFlowGtpv1SquenceNumberCounter, error) - // FromPbText unmarshals PatternFlowGtpv1SquenceNumberCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1SquenceNumberCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1SquenceNumberCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1SquenceNumberCounter) Marshal() marshalPatternFlowGtpv1SquenceNumberCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1SquenceNumberCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1SquenceNumberCounter) Unmarshal() unMarshalPatternFlowGtpv1SquenceNumberCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1SquenceNumberCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1SquenceNumberCounter) ToProto() (*otg.PatternFlowGtpv1SquenceNumberCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1SquenceNumberCounter) FromProto(msg *otg.PatternFlowGtpv1SquenceNumberCounter) (PatternFlowGtpv1SquenceNumberCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1SquenceNumberCounter) 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 *unMarshalpatternFlowGtpv1SquenceNumberCounter) 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 *marshalpatternFlowGtpv1SquenceNumberCounter) 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 *unMarshalpatternFlowGtpv1SquenceNumberCounter) 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 *marshalpatternFlowGtpv1SquenceNumberCounter) 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 *unMarshalpatternFlowGtpv1SquenceNumberCounter) 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 *patternFlowGtpv1SquenceNumberCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1SquenceNumberCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1SquenceNumberCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1SquenceNumberCounter) Clone() (PatternFlowGtpv1SquenceNumberCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1SquenceNumberCounter() - 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 -} - -// PatternFlowGtpv1SquenceNumberCounter is integer counter pattern -type PatternFlowGtpv1SquenceNumberCounter interface { - Validation - // msg marshals PatternFlowGtpv1SquenceNumberCounter to protobuf object *otg.PatternFlowGtpv1SquenceNumberCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1SquenceNumberCounter - // setMsg unmarshals PatternFlowGtpv1SquenceNumberCounter from protobuf object *otg.PatternFlowGtpv1SquenceNumberCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1SquenceNumberCounter) PatternFlowGtpv1SquenceNumberCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv1SquenceNumberCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1SquenceNumberCounter - // validate validates PatternFlowGtpv1SquenceNumberCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1SquenceNumberCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv1SquenceNumberCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv1SquenceNumberCounter - SetStart(value uint32) PatternFlowGtpv1SquenceNumberCounter - // HasStart checks if Start has been set in PatternFlowGtpv1SquenceNumberCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv1SquenceNumberCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv1SquenceNumberCounter - SetStep(value uint32) PatternFlowGtpv1SquenceNumberCounter - // HasStep checks if Step has been set in PatternFlowGtpv1SquenceNumberCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv1SquenceNumberCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv1SquenceNumberCounter - SetCount(value uint32) PatternFlowGtpv1SquenceNumberCounter - // HasCount checks if Count has been set in PatternFlowGtpv1SquenceNumberCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1SquenceNumberCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1SquenceNumberCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv1SquenceNumberCounter object -func (obj *patternFlowGtpv1SquenceNumberCounter) SetStart(value uint32) PatternFlowGtpv1SquenceNumberCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1SquenceNumberCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1SquenceNumberCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv1SquenceNumberCounter object -func (obj *patternFlowGtpv1SquenceNumberCounter) SetStep(value uint32) PatternFlowGtpv1SquenceNumberCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1SquenceNumberCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1SquenceNumberCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv1SquenceNumberCounter object -func (obj *patternFlowGtpv1SquenceNumberCounter) SetCount(value uint32) PatternFlowGtpv1SquenceNumberCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv1SquenceNumberCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1SquenceNumberCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1SquenceNumberCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1SquenceNumberCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv1SquenceNumberCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv1SquenceNumberMetricTag ***** -type patternFlowGtpv1SquenceNumberMetricTag struct { - validation - obj *otg.PatternFlowGtpv1SquenceNumberMetricTag - marshaller marshalPatternFlowGtpv1SquenceNumberMetricTag - unMarshaller unMarshalPatternFlowGtpv1SquenceNumberMetricTag -} - -func NewPatternFlowGtpv1SquenceNumberMetricTag() PatternFlowGtpv1SquenceNumberMetricTag { - obj := patternFlowGtpv1SquenceNumberMetricTag{obj: &otg.PatternFlowGtpv1SquenceNumberMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1SquenceNumberMetricTag) msg() *otg.PatternFlowGtpv1SquenceNumberMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv1SquenceNumberMetricTag) setMsg(msg *otg.PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1SquenceNumberMetricTag struct { - obj *patternFlowGtpv1SquenceNumberMetricTag -} - -type marshalPatternFlowGtpv1SquenceNumberMetricTag interface { - // ToProto marshals PatternFlowGtpv1SquenceNumberMetricTag to protobuf object *otg.PatternFlowGtpv1SquenceNumberMetricTag - ToProto() (*otg.PatternFlowGtpv1SquenceNumberMetricTag, error) - // ToPbText marshals PatternFlowGtpv1SquenceNumberMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1SquenceNumberMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1SquenceNumberMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1SquenceNumberMetricTag struct { - obj *patternFlowGtpv1SquenceNumberMetricTag -} - -type unMarshalPatternFlowGtpv1SquenceNumberMetricTag interface { - // FromProto unmarshals PatternFlowGtpv1SquenceNumberMetricTag from protobuf object *otg.PatternFlowGtpv1SquenceNumberMetricTag - FromProto(msg *otg.PatternFlowGtpv1SquenceNumberMetricTag) (PatternFlowGtpv1SquenceNumberMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv1SquenceNumberMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1SquenceNumberMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1SquenceNumberMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1SquenceNumberMetricTag) Marshal() marshalPatternFlowGtpv1SquenceNumberMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1SquenceNumberMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1SquenceNumberMetricTag) Unmarshal() unMarshalPatternFlowGtpv1SquenceNumberMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1SquenceNumberMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1SquenceNumberMetricTag) ToProto() (*otg.PatternFlowGtpv1SquenceNumberMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1SquenceNumberMetricTag) FromProto(msg *otg.PatternFlowGtpv1SquenceNumberMetricTag) (PatternFlowGtpv1SquenceNumberMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1SquenceNumberMetricTag) 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 *unMarshalpatternFlowGtpv1SquenceNumberMetricTag) 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 *marshalpatternFlowGtpv1SquenceNumberMetricTag) 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 *unMarshalpatternFlowGtpv1SquenceNumberMetricTag) 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 *marshalpatternFlowGtpv1SquenceNumberMetricTag) 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 *unMarshalpatternFlowGtpv1SquenceNumberMetricTag) 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 *patternFlowGtpv1SquenceNumberMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1SquenceNumberMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1SquenceNumberMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1SquenceNumberMetricTag) Clone() (PatternFlowGtpv1SquenceNumberMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1SquenceNumberMetricTag() - 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 -} - -// PatternFlowGtpv1SquenceNumberMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv1SquenceNumberMetricTag interface { - Validation - // msg marshals PatternFlowGtpv1SquenceNumberMetricTag to protobuf object *otg.PatternFlowGtpv1SquenceNumberMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1SquenceNumberMetricTag - // setMsg unmarshals PatternFlowGtpv1SquenceNumberMetricTag from protobuf object *otg.PatternFlowGtpv1SquenceNumberMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1SquenceNumberMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1SquenceNumberMetricTag - // validate validates PatternFlowGtpv1SquenceNumberMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1SquenceNumberMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv1SquenceNumberMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv1SquenceNumberMetricTag - SetName(value string) PatternFlowGtpv1SquenceNumberMetricTag - // Offset returns uint32, set in PatternFlowGtpv1SquenceNumberMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv1SquenceNumberMetricTag - SetOffset(value uint32) PatternFlowGtpv1SquenceNumberMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv1SquenceNumberMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv1SquenceNumberMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv1SquenceNumberMetricTag - SetLength(value uint32) PatternFlowGtpv1SquenceNumberMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv1SquenceNumberMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv1SquenceNumberMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv1SquenceNumberMetricTag object -func (obj *patternFlowGtpv1SquenceNumberMetricTag) SetName(value string) PatternFlowGtpv1SquenceNumberMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1SquenceNumberMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1SquenceNumberMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv1SquenceNumberMetricTag object -func (obj *patternFlowGtpv1SquenceNumberMetricTag) SetOffset(value uint32) PatternFlowGtpv1SquenceNumberMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1SquenceNumberMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1SquenceNumberMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv1SquenceNumberMetricTag object -func (obj *patternFlowGtpv1SquenceNumberMetricTag) SetLength(value uint32) PatternFlowGtpv1SquenceNumberMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv1SquenceNumberMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1SquenceNumberMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1SquenceNumberMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv1SquenceNumberMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv1SquenceNumberMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowGtpv1NPduNumberCounter ***** -type patternFlowGtpv1NPduNumberCounter struct { - validation - obj *otg.PatternFlowGtpv1NPduNumberCounter - marshaller marshalPatternFlowGtpv1NPduNumberCounter - unMarshaller unMarshalPatternFlowGtpv1NPduNumberCounter -} - -func NewPatternFlowGtpv1NPduNumberCounter() PatternFlowGtpv1NPduNumberCounter { - obj := patternFlowGtpv1NPduNumberCounter{obj: &otg.PatternFlowGtpv1NPduNumberCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1NPduNumberCounter) msg() *otg.PatternFlowGtpv1NPduNumberCounter { - return obj.obj -} - -func (obj *patternFlowGtpv1NPduNumberCounter) setMsg(msg *otg.PatternFlowGtpv1NPduNumberCounter) PatternFlowGtpv1NPduNumberCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1NPduNumberCounter struct { - obj *patternFlowGtpv1NPduNumberCounter -} - -type marshalPatternFlowGtpv1NPduNumberCounter interface { - // ToProto marshals PatternFlowGtpv1NPduNumberCounter to protobuf object *otg.PatternFlowGtpv1NPduNumberCounter - ToProto() (*otg.PatternFlowGtpv1NPduNumberCounter, error) - // ToPbText marshals PatternFlowGtpv1NPduNumberCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1NPduNumberCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1NPduNumberCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1NPduNumberCounter struct { - obj *patternFlowGtpv1NPduNumberCounter -} - -type unMarshalPatternFlowGtpv1NPduNumberCounter interface { - // FromProto unmarshals PatternFlowGtpv1NPduNumberCounter from protobuf object *otg.PatternFlowGtpv1NPduNumberCounter - FromProto(msg *otg.PatternFlowGtpv1NPduNumberCounter) (PatternFlowGtpv1NPduNumberCounter, error) - // FromPbText unmarshals PatternFlowGtpv1NPduNumberCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1NPduNumberCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1NPduNumberCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1NPduNumberCounter) Marshal() marshalPatternFlowGtpv1NPduNumberCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1NPduNumberCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1NPduNumberCounter) Unmarshal() unMarshalPatternFlowGtpv1NPduNumberCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1NPduNumberCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1NPduNumberCounter) ToProto() (*otg.PatternFlowGtpv1NPduNumberCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1NPduNumberCounter) FromProto(msg *otg.PatternFlowGtpv1NPduNumberCounter) (PatternFlowGtpv1NPduNumberCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1NPduNumberCounter) 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 *unMarshalpatternFlowGtpv1NPduNumberCounter) 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 *marshalpatternFlowGtpv1NPduNumberCounter) 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 *unMarshalpatternFlowGtpv1NPduNumberCounter) 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 *marshalpatternFlowGtpv1NPduNumberCounter) 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 *unMarshalpatternFlowGtpv1NPduNumberCounter) 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 *patternFlowGtpv1NPduNumberCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1NPduNumberCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1NPduNumberCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1NPduNumberCounter) Clone() (PatternFlowGtpv1NPduNumberCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1NPduNumberCounter() - 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 -} - -// PatternFlowGtpv1NPduNumberCounter is integer counter pattern -type PatternFlowGtpv1NPduNumberCounter interface { - Validation - // msg marshals PatternFlowGtpv1NPduNumberCounter to protobuf object *otg.PatternFlowGtpv1NPduNumberCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1NPduNumberCounter - // setMsg unmarshals PatternFlowGtpv1NPduNumberCounter from protobuf object *otg.PatternFlowGtpv1NPduNumberCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1NPduNumberCounter) PatternFlowGtpv1NPduNumberCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv1NPduNumberCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1NPduNumberCounter - // validate validates PatternFlowGtpv1NPduNumberCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1NPduNumberCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv1NPduNumberCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv1NPduNumberCounter - SetStart(value uint32) PatternFlowGtpv1NPduNumberCounter - // HasStart checks if Start has been set in PatternFlowGtpv1NPduNumberCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv1NPduNumberCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv1NPduNumberCounter - SetStep(value uint32) PatternFlowGtpv1NPduNumberCounter - // HasStep checks if Step has been set in PatternFlowGtpv1NPduNumberCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv1NPduNumberCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv1NPduNumberCounter - SetCount(value uint32) PatternFlowGtpv1NPduNumberCounter - // HasCount checks if Count has been set in PatternFlowGtpv1NPduNumberCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1NPduNumberCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1NPduNumberCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv1NPduNumberCounter object -func (obj *patternFlowGtpv1NPduNumberCounter) SetStart(value uint32) PatternFlowGtpv1NPduNumberCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1NPduNumberCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1NPduNumberCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv1NPduNumberCounter object -func (obj *patternFlowGtpv1NPduNumberCounter) SetStep(value uint32) PatternFlowGtpv1NPduNumberCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1NPduNumberCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1NPduNumberCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv1NPduNumberCounter object -func (obj *patternFlowGtpv1NPduNumberCounter) SetCount(value uint32) PatternFlowGtpv1NPduNumberCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv1NPduNumberCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1NPduNumberCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1NPduNumberCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1NPduNumberCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv1NPduNumberCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv1NPduNumberMetricTag ***** -type patternFlowGtpv1NPduNumberMetricTag struct { - validation - obj *otg.PatternFlowGtpv1NPduNumberMetricTag - marshaller marshalPatternFlowGtpv1NPduNumberMetricTag - unMarshaller unMarshalPatternFlowGtpv1NPduNumberMetricTag -} - -func NewPatternFlowGtpv1NPduNumberMetricTag() PatternFlowGtpv1NPduNumberMetricTag { - obj := patternFlowGtpv1NPduNumberMetricTag{obj: &otg.PatternFlowGtpv1NPduNumberMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1NPduNumberMetricTag) msg() *otg.PatternFlowGtpv1NPduNumberMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv1NPduNumberMetricTag) setMsg(msg *otg.PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1NPduNumberMetricTag struct { - obj *patternFlowGtpv1NPduNumberMetricTag -} - -type marshalPatternFlowGtpv1NPduNumberMetricTag interface { - // ToProto marshals PatternFlowGtpv1NPduNumberMetricTag to protobuf object *otg.PatternFlowGtpv1NPduNumberMetricTag - ToProto() (*otg.PatternFlowGtpv1NPduNumberMetricTag, error) - // ToPbText marshals PatternFlowGtpv1NPduNumberMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1NPduNumberMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1NPduNumberMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1NPduNumberMetricTag struct { - obj *patternFlowGtpv1NPduNumberMetricTag -} - -type unMarshalPatternFlowGtpv1NPduNumberMetricTag interface { - // FromProto unmarshals PatternFlowGtpv1NPduNumberMetricTag from protobuf object *otg.PatternFlowGtpv1NPduNumberMetricTag - FromProto(msg *otg.PatternFlowGtpv1NPduNumberMetricTag) (PatternFlowGtpv1NPduNumberMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv1NPduNumberMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1NPduNumberMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1NPduNumberMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1NPduNumberMetricTag) Marshal() marshalPatternFlowGtpv1NPduNumberMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1NPduNumberMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1NPduNumberMetricTag) Unmarshal() unMarshalPatternFlowGtpv1NPduNumberMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1NPduNumberMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1NPduNumberMetricTag) ToProto() (*otg.PatternFlowGtpv1NPduNumberMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1NPduNumberMetricTag) FromProto(msg *otg.PatternFlowGtpv1NPduNumberMetricTag) (PatternFlowGtpv1NPduNumberMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1NPduNumberMetricTag) 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 *unMarshalpatternFlowGtpv1NPduNumberMetricTag) 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 *marshalpatternFlowGtpv1NPduNumberMetricTag) 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 *unMarshalpatternFlowGtpv1NPduNumberMetricTag) 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 *marshalpatternFlowGtpv1NPduNumberMetricTag) 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 *unMarshalpatternFlowGtpv1NPduNumberMetricTag) 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 *patternFlowGtpv1NPduNumberMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1NPduNumberMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1NPduNumberMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1NPduNumberMetricTag) Clone() (PatternFlowGtpv1NPduNumberMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1NPduNumberMetricTag() - 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 -} - -// PatternFlowGtpv1NPduNumberMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv1NPduNumberMetricTag interface { - Validation - // msg marshals PatternFlowGtpv1NPduNumberMetricTag to protobuf object *otg.PatternFlowGtpv1NPduNumberMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1NPduNumberMetricTag - // setMsg unmarshals PatternFlowGtpv1NPduNumberMetricTag from protobuf object *otg.PatternFlowGtpv1NPduNumberMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1NPduNumberMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1NPduNumberMetricTag - // validate validates PatternFlowGtpv1NPduNumberMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1NPduNumberMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv1NPduNumberMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv1NPduNumberMetricTag - SetName(value string) PatternFlowGtpv1NPduNumberMetricTag - // Offset returns uint32, set in PatternFlowGtpv1NPduNumberMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv1NPduNumberMetricTag - SetOffset(value uint32) PatternFlowGtpv1NPduNumberMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv1NPduNumberMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv1NPduNumberMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv1NPduNumberMetricTag - SetLength(value uint32) PatternFlowGtpv1NPduNumberMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv1NPduNumberMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv1NPduNumberMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv1NPduNumberMetricTag object -func (obj *patternFlowGtpv1NPduNumberMetricTag) SetName(value string) PatternFlowGtpv1NPduNumberMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1NPduNumberMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1NPduNumberMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv1NPduNumberMetricTag object -func (obj *patternFlowGtpv1NPduNumberMetricTag) SetOffset(value uint32) PatternFlowGtpv1NPduNumberMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1NPduNumberMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1NPduNumberMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv1NPduNumberMetricTag object -func (obj *patternFlowGtpv1NPduNumberMetricTag) SetLength(value uint32) PatternFlowGtpv1NPduNumberMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv1NPduNumberMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1NPduNumberMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1NPduNumberMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv1NPduNumberMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv1NPduNumberMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowGtpv1NextExtensionHeaderTypeCounter ***** -type patternFlowGtpv1NextExtensionHeaderTypeCounter struct { - validation - obj *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter - marshaller marshalPatternFlowGtpv1NextExtensionHeaderTypeCounter - unMarshaller unMarshalPatternFlowGtpv1NextExtensionHeaderTypeCounter -} - -func NewPatternFlowGtpv1NextExtensionHeaderTypeCounter() PatternFlowGtpv1NextExtensionHeaderTypeCounter { - obj := patternFlowGtpv1NextExtensionHeaderTypeCounter{obj: &otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) msg() *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter { - return obj.obj -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) setMsg(msg *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter) PatternFlowGtpv1NextExtensionHeaderTypeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1NextExtensionHeaderTypeCounter struct { - obj *patternFlowGtpv1NextExtensionHeaderTypeCounter -} - -type marshalPatternFlowGtpv1NextExtensionHeaderTypeCounter interface { - // ToProto marshals PatternFlowGtpv1NextExtensionHeaderTypeCounter to protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter - ToProto() (*otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter, error) - // ToPbText marshals PatternFlowGtpv1NextExtensionHeaderTypeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1NextExtensionHeaderTypeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1NextExtensionHeaderTypeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1NextExtensionHeaderTypeCounter struct { - obj *patternFlowGtpv1NextExtensionHeaderTypeCounter -} - -type unMarshalPatternFlowGtpv1NextExtensionHeaderTypeCounter interface { - // FromProto unmarshals PatternFlowGtpv1NextExtensionHeaderTypeCounter from protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter - FromProto(msg *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter) (PatternFlowGtpv1NextExtensionHeaderTypeCounter, error) - // FromPbText unmarshals PatternFlowGtpv1NextExtensionHeaderTypeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1NextExtensionHeaderTypeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1NextExtensionHeaderTypeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) Marshal() marshalPatternFlowGtpv1NextExtensionHeaderTypeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1NextExtensionHeaderTypeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) Unmarshal() unMarshalPatternFlowGtpv1NextExtensionHeaderTypeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1NextExtensionHeaderTypeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) ToProto() (*otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) FromProto(msg *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter) (PatternFlowGtpv1NextExtensionHeaderTypeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) 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 *marshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) 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 *marshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) 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 *patternFlowGtpv1NextExtensionHeaderTypeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) Clone() (PatternFlowGtpv1NextExtensionHeaderTypeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1NextExtensionHeaderTypeCounter() - 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 -} - -// PatternFlowGtpv1NextExtensionHeaderTypeCounter is integer counter pattern -type PatternFlowGtpv1NextExtensionHeaderTypeCounter interface { - Validation - // msg marshals PatternFlowGtpv1NextExtensionHeaderTypeCounter to protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter - // setMsg unmarshals PatternFlowGtpv1NextExtensionHeaderTypeCounter from protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter) PatternFlowGtpv1NextExtensionHeaderTypeCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv1NextExtensionHeaderTypeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1NextExtensionHeaderTypeCounter - // validate validates PatternFlowGtpv1NextExtensionHeaderTypeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1NextExtensionHeaderTypeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv1NextExtensionHeaderTypeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv1NextExtensionHeaderTypeCounter - SetStart(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeCounter - // HasStart checks if Start has been set in PatternFlowGtpv1NextExtensionHeaderTypeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv1NextExtensionHeaderTypeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv1NextExtensionHeaderTypeCounter - SetStep(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeCounter - // HasStep checks if Step has been set in PatternFlowGtpv1NextExtensionHeaderTypeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv1NextExtensionHeaderTypeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv1NextExtensionHeaderTypeCounter - SetCount(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeCounter - // HasCount checks if Count has been set in PatternFlowGtpv1NextExtensionHeaderTypeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv1NextExtensionHeaderTypeCounter object -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) SetStart(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv1NextExtensionHeaderTypeCounter object -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) SetStep(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv1NextExtensionHeaderTypeCounter object -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) SetCount(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1NextExtensionHeaderTypeCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1NextExtensionHeaderTypeCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1NextExtensionHeaderTypeCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv1NextExtensionHeaderTypeMetricTag ***** -type patternFlowGtpv1NextExtensionHeaderTypeMetricTag struct { - validation - obj *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - marshaller marshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag - unMarshaller unMarshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag -} - -func NewPatternFlowGtpv1NextExtensionHeaderTypeMetricTag() PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { - obj := patternFlowGtpv1NextExtensionHeaderTypeMetricTag{obj: &otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) msg() *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) setMsg(msg *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag struct { - obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag -} - -type marshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag interface { - // ToProto marshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag to protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - ToProto() (*otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag, error) - // ToPbText marshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag struct { - obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag -} - -type unMarshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag interface { - // FromProto unmarshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag from protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - FromProto(msg *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) (PatternFlowGtpv1NextExtensionHeaderTypeMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) Marshal() marshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) Unmarshal() unMarshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) ToProto() (*otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) FromProto(msg *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) (PatternFlowGtpv1NextExtensionHeaderTypeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) 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 *marshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) 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 *marshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) 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 *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) Clone() (PatternFlowGtpv1NextExtensionHeaderTypeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv1NextExtensionHeaderTypeMetricTag() - 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 -} - -// PatternFlowGtpv1NextExtensionHeaderTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv1NextExtensionHeaderTypeMetricTag interface { - Validation - // msg marshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag to protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - // setMsg unmarshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag from protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag - // validate validates PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv1NextExtensionHeaderTypeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv1NextExtensionHeaderTypeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - SetName(value string) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - // Offset returns uint32, set in PatternFlowGtpv1NextExtensionHeaderTypeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - SetOffset(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv1NextExtensionHeaderTypeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - SetLength(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv1NextExtensionHeaderTypeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv1NextExtensionHeaderTypeMetricTag object -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) SetName(value string) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv1NextExtensionHeaderTypeMetricTag object -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) SetOffset(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv1NextExtensionHeaderTypeMetricTag object -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) SetLength(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1NextExtensionHeaderTypeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv1NextExtensionHeaderTypeMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv1NextExtensionHeaderTypeMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowGtpExtensionExtensionLength ***** -type patternFlowGtpExtensionExtensionLength struct { - validation - obj *otg.PatternFlowGtpExtensionExtensionLength - marshaller marshalPatternFlowGtpExtensionExtensionLength - unMarshaller unMarshalPatternFlowGtpExtensionExtensionLength - incrementHolder PatternFlowGtpExtensionExtensionLengthCounter - decrementHolder PatternFlowGtpExtensionExtensionLengthCounter - metricTagsHolder PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter -} - -func NewPatternFlowGtpExtensionExtensionLength() PatternFlowGtpExtensionExtensionLength { - obj := patternFlowGtpExtensionExtensionLength{obj: &otg.PatternFlowGtpExtensionExtensionLength{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpExtensionExtensionLength) msg() *otg.PatternFlowGtpExtensionExtensionLength { - return obj.obj -} - -func (obj *patternFlowGtpExtensionExtensionLength) setMsg(msg *otg.PatternFlowGtpExtensionExtensionLength) PatternFlowGtpExtensionExtensionLength { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpExtensionExtensionLength struct { - obj *patternFlowGtpExtensionExtensionLength -} - -type marshalPatternFlowGtpExtensionExtensionLength interface { - // ToProto marshals PatternFlowGtpExtensionExtensionLength to protobuf object *otg.PatternFlowGtpExtensionExtensionLength - ToProto() (*otg.PatternFlowGtpExtensionExtensionLength, error) - // ToPbText marshals PatternFlowGtpExtensionExtensionLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpExtensionExtensionLength to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpExtensionExtensionLength to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpExtensionExtensionLength struct { - obj *patternFlowGtpExtensionExtensionLength -} - -type unMarshalPatternFlowGtpExtensionExtensionLength interface { - // FromProto unmarshals PatternFlowGtpExtensionExtensionLength from protobuf object *otg.PatternFlowGtpExtensionExtensionLength - FromProto(msg *otg.PatternFlowGtpExtensionExtensionLength) (PatternFlowGtpExtensionExtensionLength, error) - // FromPbText unmarshals PatternFlowGtpExtensionExtensionLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpExtensionExtensionLength from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpExtensionExtensionLength from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpExtensionExtensionLength) Marshal() marshalPatternFlowGtpExtensionExtensionLength { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpExtensionExtensionLength{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpExtensionExtensionLength) Unmarshal() unMarshalPatternFlowGtpExtensionExtensionLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpExtensionExtensionLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpExtensionExtensionLength) ToProto() (*otg.PatternFlowGtpExtensionExtensionLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpExtensionExtensionLength) FromProto(msg *otg.PatternFlowGtpExtensionExtensionLength) (PatternFlowGtpExtensionExtensionLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpExtensionExtensionLength) 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 *unMarshalpatternFlowGtpExtensionExtensionLength) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpExtensionExtensionLength) 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 *unMarshalpatternFlowGtpExtensionExtensionLength) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpExtensionExtensionLength) 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 *unMarshalpatternFlowGtpExtensionExtensionLength) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpExtensionExtensionLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionExtensionLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionExtensionLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpExtensionExtensionLength) Clone() (PatternFlowGtpExtensionExtensionLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpExtensionExtensionLength() - 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 -} - -func (obj *patternFlowGtpExtensionExtensionLength) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpExtensionExtensionLength is this field states the length of this extension header, including the length, the contents, and the next extension header field, in 4-octet units, so the length of the extension must always be a multiple of 4. -type PatternFlowGtpExtensionExtensionLength interface { - Validation - // msg marshals PatternFlowGtpExtensionExtensionLength to protobuf object *otg.PatternFlowGtpExtensionExtensionLength - // and doesn't set defaults - msg() *otg.PatternFlowGtpExtensionExtensionLength - // setMsg unmarshals PatternFlowGtpExtensionExtensionLength from protobuf object *otg.PatternFlowGtpExtensionExtensionLength - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpExtensionExtensionLength) PatternFlowGtpExtensionExtensionLength - // provides marshal interface - Marshal() marshalPatternFlowGtpExtensionExtensionLength - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpExtensionExtensionLength - // validate validates PatternFlowGtpExtensionExtensionLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpExtensionExtensionLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpExtensionExtensionLengthChoiceEnum, set in PatternFlowGtpExtensionExtensionLength - Choice() PatternFlowGtpExtensionExtensionLengthChoiceEnum - // setChoice assigns PatternFlowGtpExtensionExtensionLengthChoiceEnum provided by user to PatternFlowGtpExtensionExtensionLength - setChoice(value PatternFlowGtpExtensionExtensionLengthChoiceEnum) PatternFlowGtpExtensionExtensionLength - // HasChoice checks if Choice has been set in PatternFlowGtpExtensionExtensionLength - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpExtensionExtensionLength. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpExtensionExtensionLength - SetValue(value uint32) PatternFlowGtpExtensionExtensionLength - // HasValue checks if Value has been set in PatternFlowGtpExtensionExtensionLength - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpExtensionExtensionLength. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpExtensionExtensionLength - SetValues(value []uint32) PatternFlowGtpExtensionExtensionLength - // Increment returns PatternFlowGtpExtensionExtensionLengthCounter, set in PatternFlowGtpExtensionExtensionLength. - // PatternFlowGtpExtensionExtensionLengthCounter is integer counter pattern - Increment() PatternFlowGtpExtensionExtensionLengthCounter - // SetIncrement assigns PatternFlowGtpExtensionExtensionLengthCounter provided by user to PatternFlowGtpExtensionExtensionLength. - // PatternFlowGtpExtensionExtensionLengthCounter is integer counter pattern - SetIncrement(value PatternFlowGtpExtensionExtensionLengthCounter) PatternFlowGtpExtensionExtensionLength - // HasIncrement checks if Increment has been set in PatternFlowGtpExtensionExtensionLength - HasIncrement() bool - // Decrement returns PatternFlowGtpExtensionExtensionLengthCounter, set in PatternFlowGtpExtensionExtensionLength. - // PatternFlowGtpExtensionExtensionLengthCounter is integer counter pattern - Decrement() PatternFlowGtpExtensionExtensionLengthCounter - // SetDecrement assigns PatternFlowGtpExtensionExtensionLengthCounter provided by user to PatternFlowGtpExtensionExtensionLength. - // PatternFlowGtpExtensionExtensionLengthCounter is integer counter pattern - SetDecrement(value PatternFlowGtpExtensionExtensionLengthCounter) PatternFlowGtpExtensionExtensionLength - // HasDecrement checks if Decrement has been set in PatternFlowGtpExtensionExtensionLength - HasDecrement() bool - // MetricTags returns PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIterIter, set in PatternFlowGtpExtensionExtensionLength - MetricTags() PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter - setNil() -} - -type PatternFlowGtpExtensionExtensionLengthChoiceEnum string - -// Enum of Choice on PatternFlowGtpExtensionExtensionLength -var PatternFlowGtpExtensionExtensionLengthChoice = struct { - VALUE PatternFlowGtpExtensionExtensionLengthChoiceEnum - VALUES PatternFlowGtpExtensionExtensionLengthChoiceEnum - INCREMENT PatternFlowGtpExtensionExtensionLengthChoiceEnum - DECREMENT PatternFlowGtpExtensionExtensionLengthChoiceEnum -}{ - VALUE: PatternFlowGtpExtensionExtensionLengthChoiceEnum("value"), - VALUES: PatternFlowGtpExtensionExtensionLengthChoiceEnum("values"), - INCREMENT: PatternFlowGtpExtensionExtensionLengthChoiceEnum("increment"), - DECREMENT: PatternFlowGtpExtensionExtensionLengthChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpExtensionExtensionLength) Choice() PatternFlowGtpExtensionExtensionLengthChoiceEnum { - return PatternFlowGtpExtensionExtensionLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpExtensionExtensionLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpExtensionExtensionLength) setChoice(value PatternFlowGtpExtensionExtensionLengthChoiceEnum) PatternFlowGtpExtensionExtensionLength { - intValue, ok := otg.PatternFlowGtpExtensionExtensionLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpExtensionExtensionLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpExtensionExtensionLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpExtensionExtensionLengthChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpExtensionExtensionLengthChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpExtensionExtensionLengthChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpExtensionExtensionLengthCounter().msg() - } - - if value == PatternFlowGtpExtensionExtensionLengthChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpExtensionExtensionLengthCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpExtensionExtensionLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpExtensionExtensionLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpExtensionExtensionLength object -func (obj *patternFlowGtpExtensionExtensionLength) SetValue(value uint32) PatternFlowGtpExtensionExtensionLength { - obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpExtensionExtensionLength) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpExtensionExtensionLength object -func (obj *patternFlowGtpExtensionExtensionLength) SetValues(value []uint32) PatternFlowGtpExtensionExtensionLength { - obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpExtensionExtensionLengthCounter -func (obj *patternFlowGtpExtensionExtensionLength) Increment() PatternFlowGtpExtensionExtensionLengthCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpExtensionExtensionLengthCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpExtensionExtensionLengthCounter -func (obj *patternFlowGtpExtensionExtensionLength) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpExtensionExtensionLengthCounter value in the PatternFlowGtpExtensionExtensionLength object -func (obj *patternFlowGtpExtensionExtensionLength) SetIncrement(value PatternFlowGtpExtensionExtensionLengthCounter) PatternFlowGtpExtensionExtensionLength { - obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpExtensionExtensionLengthCounter -func (obj *patternFlowGtpExtensionExtensionLength) Decrement() PatternFlowGtpExtensionExtensionLengthCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpExtensionExtensionLengthCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpExtensionExtensionLengthCounter -func (obj *patternFlowGtpExtensionExtensionLength) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpExtensionExtensionLengthCounter value in the PatternFlowGtpExtensionExtensionLength object -func (obj *patternFlowGtpExtensionExtensionLength) SetDecrement(value PatternFlowGtpExtensionExtensionLengthCounter) PatternFlowGtpExtensionExtensionLength { - obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpExtensionExtensionLengthMetricTag -func (obj *patternFlowGtpExtensionExtensionLength) MetricTags() PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpExtensionExtensionLengthMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter struct { - obj *patternFlowGtpExtensionExtensionLength - patternFlowGtpExtensionExtensionLengthMetricTagSlice []PatternFlowGtpExtensionExtensionLengthMetricTag - fieldPtr *[]*otg.PatternFlowGtpExtensionExtensionLengthMetricTag -} - -func newPatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter(ptr *[]*otg.PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { - return &patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter interface { - setMsg(*patternFlowGtpExtensionExtensionLength) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter - Items() []PatternFlowGtpExtensionExtensionLengthMetricTag - Add() PatternFlowGtpExtensionExtensionLengthMetricTag - Append(items ...PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter - Set(index int, newObj PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter - Clear() PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter - clearHolderSlice() PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter - appendHolderSlice(item PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter -} - -func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) setMsg(msg *patternFlowGtpExtensionExtensionLength) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpExtensionExtensionLengthMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) Items() []PatternFlowGtpExtensionExtensionLengthMetricTag { - return obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice -} - -func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) Add() PatternFlowGtpExtensionExtensionLengthMetricTag { - newObj := &otg.PatternFlowGtpExtensionExtensionLengthMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpExtensionExtensionLengthMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice = append(obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) Append(items ...PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice = append(obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) Set(index int, newObj PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) Clear() PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpExtensionExtensionLengthMetricTag{} - obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice = []PatternFlowGtpExtensionExtensionLengthMetricTag{} - } - return obj -} -func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) clearHolderSlice() PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { - if len(obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice) > 0 { - obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice = []PatternFlowGtpExtensionExtensionLengthMetricTag{} - } - return obj -} -func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) appendHolderSlice(item PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { - obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice = append(obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpExtensionExtensionLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionExtensionLength.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpExtensionExtensionLength.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpExtensionExtensionLengthMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpExtensionExtensionLength) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpExtensionExtensionLengthChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpExtensionExtensionLengthChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpExtensionExtensionLengthChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpExtensionExtensionLengthChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpExtensionExtensionLengthChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpExtensionExtensionLength") - } - } else { - intVal := otg.PatternFlowGtpExtensionExtensionLength_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpExtensionExtensionLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpExtensionContents ***** -type patternFlowGtpExtensionContents struct { - validation - obj *otg.PatternFlowGtpExtensionContents - marshaller marshalPatternFlowGtpExtensionContents - unMarshaller unMarshalPatternFlowGtpExtensionContents - incrementHolder PatternFlowGtpExtensionContentsCounter - decrementHolder PatternFlowGtpExtensionContentsCounter - metricTagsHolder PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter -} - -func NewPatternFlowGtpExtensionContents() PatternFlowGtpExtensionContents { - obj := patternFlowGtpExtensionContents{obj: &otg.PatternFlowGtpExtensionContents{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpExtensionContents) msg() *otg.PatternFlowGtpExtensionContents { - return obj.obj -} - -func (obj *patternFlowGtpExtensionContents) setMsg(msg *otg.PatternFlowGtpExtensionContents) PatternFlowGtpExtensionContents { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpExtensionContents struct { - obj *patternFlowGtpExtensionContents -} - -type marshalPatternFlowGtpExtensionContents interface { - // ToProto marshals PatternFlowGtpExtensionContents to protobuf object *otg.PatternFlowGtpExtensionContents - ToProto() (*otg.PatternFlowGtpExtensionContents, error) - // ToPbText marshals PatternFlowGtpExtensionContents to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpExtensionContents to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpExtensionContents to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpExtensionContents struct { - obj *patternFlowGtpExtensionContents -} - -type unMarshalPatternFlowGtpExtensionContents interface { - // FromProto unmarshals PatternFlowGtpExtensionContents from protobuf object *otg.PatternFlowGtpExtensionContents - FromProto(msg *otg.PatternFlowGtpExtensionContents) (PatternFlowGtpExtensionContents, error) - // FromPbText unmarshals PatternFlowGtpExtensionContents from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpExtensionContents from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpExtensionContents from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpExtensionContents) Marshal() marshalPatternFlowGtpExtensionContents { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpExtensionContents{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpExtensionContents) Unmarshal() unMarshalPatternFlowGtpExtensionContents { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpExtensionContents{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpExtensionContents) ToProto() (*otg.PatternFlowGtpExtensionContents, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpExtensionContents) FromProto(msg *otg.PatternFlowGtpExtensionContents) (PatternFlowGtpExtensionContents, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpExtensionContents) 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 *unMarshalpatternFlowGtpExtensionContents) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpExtensionContents) 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 *unMarshalpatternFlowGtpExtensionContents) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpExtensionContents) 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 *unMarshalpatternFlowGtpExtensionContents) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpExtensionContents) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionContents) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionContents) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpExtensionContents) Clone() (PatternFlowGtpExtensionContents, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpExtensionContents() - 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 -} - -func (obj *patternFlowGtpExtensionContents) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpExtensionContents is the extension header contents -type PatternFlowGtpExtensionContents interface { - Validation - // msg marshals PatternFlowGtpExtensionContents to protobuf object *otg.PatternFlowGtpExtensionContents - // and doesn't set defaults - msg() *otg.PatternFlowGtpExtensionContents - // setMsg unmarshals PatternFlowGtpExtensionContents from protobuf object *otg.PatternFlowGtpExtensionContents - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpExtensionContents) PatternFlowGtpExtensionContents - // provides marshal interface - Marshal() marshalPatternFlowGtpExtensionContents - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpExtensionContents - // validate validates PatternFlowGtpExtensionContents - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpExtensionContents, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpExtensionContentsChoiceEnum, set in PatternFlowGtpExtensionContents - Choice() PatternFlowGtpExtensionContentsChoiceEnum - // setChoice assigns PatternFlowGtpExtensionContentsChoiceEnum provided by user to PatternFlowGtpExtensionContents - setChoice(value PatternFlowGtpExtensionContentsChoiceEnum) PatternFlowGtpExtensionContents - // HasChoice checks if Choice has been set in PatternFlowGtpExtensionContents - HasChoice() bool - // Value returns uint64, set in PatternFlowGtpExtensionContents. - Value() uint64 - // SetValue assigns uint64 provided by user to PatternFlowGtpExtensionContents - SetValue(value uint64) PatternFlowGtpExtensionContents - // HasValue checks if Value has been set in PatternFlowGtpExtensionContents - HasValue() bool - // Values returns []uint64, set in PatternFlowGtpExtensionContents. - Values() []uint64 - // SetValues assigns []uint64 provided by user to PatternFlowGtpExtensionContents - SetValues(value []uint64) PatternFlowGtpExtensionContents - // Increment returns PatternFlowGtpExtensionContentsCounter, set in PatternFlowGtpExtensionContents. - // PatternFlowGtpExtensionContentsCounter is integer counter pattern - Increment() PatternFlowGtpExtensionContentsCounter - // SetIncrement assigns PatternFlowGtpExtensionContentsCounter provided by user to PatternFlowGtpExtensionContents. - // PatternFlowGtpExtensionContentsCounter is integer counter pattern - SetIncrement(value PatternFlowGtpExtensionContentsCounter) PatternFlowGtpExtensionContents - // HasIncrement checks if Increment has been set in PatternFlowGtpExtensionContents - HasIncrement() bool - // Decrement returns PatternFlowGtpExtensionContentsCounter, set in PatternFlowGtpExtensionContents. - // PatternFlowGtpExtensionContentsCounter is integer counter pattern - Decrement() PatternFlowGtpExtensionContentsCounter - // SetDecrement assigns PatternFlowGtpExtensionContentsCounter provided by user to PatternFlowGtpExtensionContents. - // PatternFlowGtpExtensionContentsCounter is integer counter pattern - SetDecrement(value PatternFlowGtpExtensionContentsCounter) PatternFlowGtpExtensionContents - // HasDecrement checks if Decrement has been set in PatternFlowGtpExtensionContents - HasDecrement() bool - // MetricTags returns PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIterIter, set in PatternFlowGtpExtensionContents - MetricTags() PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter - setNil() -} - -type PatternFlowGtpExtensionContentsChoiceEnum string - -// Enum of Choice on PatternFlowGtpExtensionContents -var PatternFlowGtpExtensionContentsChoice = struct { - VALUE PatternFlowGtpExtensionContentsChoiceEnum - VALUES PatternFlowGtpExtensionContentsChoiceEnum - INCREMENT PatternFlowGtpExtensionContentsChoiceEnum - DECREMENT PatternFlowGtpExtensionContentsChoiceEnum -}{ - VALUE: PatternFlowGtpExtensionContentsChoiceEnum("value"), - VALUES: PatternFlowGtpExtensionContentsChoiceEnum("values"), - INCREMENT: PatternFlowGtpExtensionContentsChoiceEnum("increment"), - DECREMENT: PatternFlowGtpExtensionContentsChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpExtensionContents) Choice() PatternFlowGtpExtensionContentsChoiceEnum { - return PatternFlowGtpExtensionContentsChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpExtensionContents) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpExtensionContents) setChoice(value PatternFlowGtpExtensionContentsChoiceEnum) PatternFlowGtpExtensionContents { - intValue, ok := otg.PatternFlowGtpExtensionContents_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpExtensionContentsChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpExtensionContents_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpExtensionContentsChoice.VALUE { - defaultValue := uint64(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpExtensionContentsChoice.VALUES { - defaultValue := []uint64{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpExtensionContentsChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpExtensionContentsCounter().msg() - } - - if value == PatternFlowGtpExtensionContentsChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpExtensionContentsCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint64 -func (obj *patternFlowGtpExtensionContents) Value() uint64 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpExtensionContentsChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint64 -func (obj *patternFlowGtpExtensionContents) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint64 value in the PatternFlowGtpExtensionContents object -func (obj *patternFlowGtpExtensionContents) SetValue(value uint64) PatternFlowGtpExtensionContents { - obj.setChoice(PatternFlowGtpExtensionContentsChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint64 -func (obj *patternFlowGtpExtensionContents) Values() []uint64 { - if obj.obj.Values == nil { - obj.SetValues([]uint64{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint64 value in the PatternFlowGtpExtensionContents object -func (obj *patternFlowGtpExtensionContents) SetValues(value []uint64) PatternFlowGtpExtensionContents { - obj.setChoice(PatternFlowGtpExtensionContentsChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint64, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpExtensionContentsCounter -func (obj *patternFlowGtpExtensionContents) Increment() PatternFlowGtpExtensionContentsCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpExtensionContentsChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpExtensionContentsCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpExtensionContentsCounter -func (obj *patternFlowGtpExtensionContents) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpExtensionContentsCounter value in the PatternFlowGtpExtensionContents object -func (obj *patternFlowGtpExtensionContents) SetIncrement(value PatternFlowGtpExtensionContentsCounter) PatternFlowGtpExtensionContents { - obj.setChoice(PatternFlowGtpExtensionContentsChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpExtensionContentsCounter -func (obj *patternFlowGtpExtensionContents) Decrement() PatternFlowGtpExtensionContentsCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpExtensionContentsChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpExtensionContentsCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpExtensionContentsCounter -func (obj *patternFlowGtpExtensionContents) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpExtensionContentsCounter value in the PatternFlowGtpExtensionContents object -func (obj *patternFlowGtpExtensionContents) SetDecrement(value PatternFlowGtpExtensionContentsCounter) PatternFlowGtpExtensionContents { - obj.setChoice(PatternFlowGtpExtensionContentsChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpExtensionContentsMetricTag -func (obj *patternFlowGtpExtensionContents) MetricTags() PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpExtensionContentsMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter struct { - obj *patternFlowGtpExtensionContents - patternFlowGtpExtensionContentsMetricTagSlice []PatternFlowGtpExtensionContentsMetricTag - fieldPtr *[]*otg.PatternFlowGtpExtensionContentsMetricTag -} - -func newPatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter(ptr *[]*otg.PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { - return &patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter interface { - setMsg(*patternFlowGtpExtensionContents) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter - Items() []PatternFlowGtpExtensionContentsMetricTag - Add() PatternFlowGtpExtensionContentsMetricTag - Append(items ...PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter - Set(index int, newObj PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter - Clear() PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter - clearHolderSlice() PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter - appendHolderSlice(item PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter -} - -func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) setMsg(msg *patternFlowGtpExtensionContents) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpExtensionContentsMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) Items() []PatternFlowGtpExtensionContentsMetricTag { - return obj.patternFlowGtpExtensionContentsMetricTagSlice -} - -func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) Add() PatternFlowGtpExtensionContentsMetricTag { - newObj := &otg.PatternFlowGtpExtensionContentsMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpExtensionContentsMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpExtensionContentsMetricTagSlice = append(obj.patternFlowGtpExtensionContentsMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) Append(items ...PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpExtensionContentsMetricTagSlice = append(obj.patternFlowGtpExtensionContentsMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) Set(index int, newObj PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpExtensionContentsMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) Clear() PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpExtensionContentsMetricTag{} - obj.patternFlowGtpExtensionContentsMetricTagSlice = []PatternFlowGtpExtensionContentsMetricTag{} - } - return obj -} -func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) clearHolderSlice() PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { - if len(obj.patternFlowGtpExtensionContentsMetricTagSlice) > 0 { - obj.patternFlowGtpExtensionContentsMetricTagSlice = []PatternFlowGtpExtensionContentsMetricTag{} - } - return obj -} -func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) appendHolderSlice(item PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { - obj.patternFlowGtpExtensionContentsMetricTagSlice = append(obj.patternFlowGtpExtensionContentsMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpExtensionContents) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 281474976710655 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionContents.Value <= 281474976710655 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 281474976710655 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint64) <= PatternFlowGtpExtensionContents.Values <= 281474976710655 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpExtensionContentsMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpExtensionContents) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpExtensionContentsChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpExtensionContentsChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpExtensionContentsChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpExtensionContentsChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpExtensionContentsChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpExtensionContentsChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpExtensionContents") - } - } else { - intVal := otg.PatternFlowGtpExtensionContents_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpExtensionContents_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpExtensionNextExtensionHeader ***** -type patternFlowGtpExtensionNextExtensionHeader struct { - validation - obj *otg.PatternFlowGtpExtensionNextExtensionHeader - marshaller marshalPatternFlowGtpExtensionNextExtensionHeader - unMarshaller unMarshalPatternFlowGtpExtensionNextExtensionHeader - incrementHolder PatternFlowGtpExtensionNextExtensionHeaderCounter - decrementHolder PatternFlowGtpExtensionNextExtensionHeaderCounter - metricTagsHolder PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter -} - -func NewPatternFlowGtpExtensionNextExtensionHeader() PatternFlowGtpExtensionNextExtensionHeader { - obj := patternFlowGtpExtensionNextExtensionHeader{obj: &otg.PatternFlowGtpExtensionNextExtensionHeader{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpExtensionNextExtensionHeader) msg() *otg.PatternFlowGtpExtensionNextExtensionHeader { - return obj.obj -} - -func (obj *patternFlowGtpExtensionNextExtensionHeader) setMsg(msg *otg.PatternFlowGtpExtensionNextExtensionHeader) PatternFlowGtpExtensionNextExtensionHeader { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpExtensionNextExtensionHeader struct { - obj *patternFlowGtpExtensionNextExtensionHeader -} - -type marshalPatternFlowGtpExtensionNextExtensionHeader interface { - // ToProto marshals PatternFlowGtpExtensionNextExtensionHeader to protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeader - ToProto() (*otg.PatternFlowGtpExtensionNextExtensionHeader, error) - // ToPbText marshals PatternFlowGtpExtensionNextExtensionHeader to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpExtensionNextExtensionHeader to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpExtensionNextExtensionHeader to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpExtensionNextExtensionHeader struct { - obj *patternFlowGtpExtensionNextExtensionHeader -} - -type unMarshalPatternFlowGtpExtensionNextExtensionHeader interface { - // FromProto unmarshals PatternFlowGtpExtensionNextExtensionHeader from protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeader - FromProto(msg *otg.PatternFlowGtpExtensionNextExtensionHeader) (PatternFlowGtpExtensionNextExtensionHeader, error) - // FromPbText unmarshals PatternFlowGtpExtensionNextExtensionHeader from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpExtensionNextExtensionHeader from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpExtensionNextExtensionHeader from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpExtensionNextExtensionHeader) Marshal() marshalPatternFlowGtpExtensionNextExtensionHeader { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpExtensionNextExtensionHeader{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpExtensionNextExtensionHeader) Unmarshal() unMarshalPatternFlowGtpExtensionNextExtensionHeader { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpExtensionNextExtensionHeader{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpExtensionNextExtensionHeader) ToProto() (*otg.PatternFlowGtpExtensionNextExtensionHeader, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpExtensionNextExtensionHeader) FromProto(msg *otg.PatternFlowGtpExtensionNextExtensionHeader) (PatternFlowGtpExtensionNextExtensionHeader, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpExtensionNextExtensionHeader) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeader) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowGtpExtensionNextExtensionHeader) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeader) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowGtpExtensionNextExtensionHeader) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeader) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowGtpExtensionNextExtensionHeader) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionNextExtensionHeader) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionNextExtensionHeader) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpExtensionNextExtensionHeader) Clone() (PatternFlowGtpExtensionNextExtensionHeader, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpExtensionNextExtensionHeader() - 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 -} - -func (obj *patternFlowGtpExtensionNextExtensionHeader) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowGtpExtensionNextExtensionHeader is it states the type of the next extension, or 0 if no next extension exists. This permits chaining several next extension headers. -type PatternFlowGtpExtensionNextExtensionHeader interface { - Validation - // msg marshals PatternFlowGtpExtensionNextExtensionHeader to protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeader - // and doesn't set defaults - msg() *otg.PatternFlowGtpExtensionNextExtensionHeader - // setMsg unmarshals PatternFlowGtpExtensionNextExtensionHeader from protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeader - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpExtensionNextExtensionHeader) PatternFlowGtpExtensionNextExtensionHeader - // provides marshal interface - Marshal() marshalPatternFlowGtpExtensionNextExtensionHeader - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpExtensionNextExtensionHeader - // validate validates PatternFlowGtpExtensionNextExtensionHeader - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpExtensionNextExtensionHeader, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum, set in PatternFlowGtpExtensionNextExtensionHeader - Choice() PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum - // setChoice assigns PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum provided by user to PatternFlowGtpExtensionNextExtensionHeader - setChoice(value PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum) PatternFlowGtpExtensionNextExtensionHeader - // HasChoice checks if Choice has been set in PatternFlowGtpExtensionNextExtensionHeader - HasChoice() bool - // Value returns uint32, set in PatternFlowGtpExtensionNextExtensionHeader. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowGtpExtensionNextExtensionHeader - SetValue(value uint32) PatternFlowGtpExtensionNextExtensionHeader - // HasValue checks if Value has been set in PatternFlowGtpExtensionNextExtensionHeader - HasValue() bool - // Values returns []uint32, set in PatternFlowGtpExtensionNextExtensionHeader. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowGtpExtensionNextExtensionHeader - SetValues(value []uint32) PatternFlowGtpExtensionNextExtensionHeader - // Increment returns PatternFlowGtpExtensionNextExtensionHeaderCounter, set in PatternFlowGtpExtensionNextExtensionHeader. - // PatternFlowGtpExtensionNextExtensionHeaderCounter is integer counter pattern - Increment() PatternFlowGtpExtensionNextExtensionHeaderCounter - // SetIncrement assigns PatternFlowGtpExtensionNextExtensionHeaderCounter provided by user to PatternFlowGtpExtensionNextExtensionHeader. - // PatternFlowGtpExtensionNextExtensionHeaderCounter is integer counter pattern - SetIncrement(value PatternFlowGtpExtensionNextExtensionHeaderCounter) PatternFlowGtpExtensionNextExtensionHeader - // HasIncrement checks if Increment has been set in PatternFlowGtpExtensionNextExtensionHeader - HasIncrement() bool - // Decrement returns PatternFlowGtpExtensionNextExtensionHeaderCounter, set in PatternFlowGtpExtensionNextExtensionHeader. - // PatternFlowGtpExtensionNextExtensionHeaderCounter is integer counter pattern - Decrement() PatternFlowGtpExtensionNextExtensionHeaderCounter - // SetDecrement assigns PatternFlowGtpExtensionNextExtensionHeaderCounter provided by user to PatternFlowGtpExtensionNextExtensionHeader. - // PatternFlowGtpExtensionNextExtensionHeaderCounter is integer counter pattern - SetDecrement(value PatternFlowGtpExtensionNextExtensionHeaderCounter) PatternFlowGtpExtensionNextExtensionHeader - // HasDecrement checks if Decrement has been set in PatternFlowGtpExtensionNextExtensionHeader - HasDecrement() bool - // MetricTags returns PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIterIter, set in PatternFlowGtpExtensionNextExtensionHeader - MetricTags() PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter - setNil() -} - -type PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum string - -// Enum of Choice on PatternFlowGtpExtensionNextExtensionHeader -var PatternFlowGtpExtensionNextExtensionHeaderChoice = struct { - VALUE PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum - VALUES PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum - INCREMENT PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum - DECREMENT PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum -}{ - VALUE: PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum("value"), - VALUES: PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum("values"), - INCREMENT: PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum("increment"), - DECREMENT: PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum("decrement"), -} - -func (obj *patternFlowGtpExtensionNextExtensionHeader) Choice() PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum { - return PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowGtpExtensionNextExtensionHeader) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowGtpExtensionNextExtensionHeader) setChoice(value PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum) PatternFlowGtpExtensionNextExtensionHeader { - intValue, ok := otg.PatternFlowGtpExtensionNextExtensionHeader_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowGtpExtensionNextExtensionHeader_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowGtpExtensionNextExtensionHeaderChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowGtpExtensionNextExtensionHeaderCounter().msg() - } - - if value == PatternFlowGtpExtensionNextExtensionHeaderChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowGtpExtensionNextExtensionHeaderCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpExtensionNextExtensionHeader) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowGtpExtensionNextExtensionHeader) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowGtpExtensionNextExtensionHeader object -func (obj *patternFlowGtpExtensionNextExtensionHeader) SetValue(value uint32) PatternFlowGtpExtensionNextExtensionHeader { - obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowGtpExtensionNextExtensionHeader) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowGtpExtensionNextExtensionHeader object -func (obj *patternFlowGtpExtensionNextExtensionHeader) SetValues(value []uint32) PatternFlowGtpExtensionNextExtensionHeader { - obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowGtpExtensionNextExtensionHeaderCounter -func (obj *patternFlowGtpExtensionNextExtensionHeader) Increment() PatternFlowGtpExtensionNextExtensionHeaderCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowGtpExtensionNextExtensionHeaderCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowGtpExtensionNextExtensionHeaderCounter -func (obj *patternFlowGtpExtensionNextExtensionHeader) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowGtpExtensionNextExtensionHeaderCounter value in the PatternFlowGtpExtensionNextExtensionHeader object -func (obj *patternFlowGtpExtensionNextExtensionHeader) SetIncrement(value PatternFlowGtpExtensionNextExtensionHeaderCounter) PatternFlowGtpExtensionNextExtensionHeader { - obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowGtpExtensionNextExtensionHeaderCounter -func (obj *patternFlowGtpExtensionNextExtensionHeader) Decrement() PatternFlowGtpExtensionNextExtensionHeaderCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowGtpExtensionNextExtensionHeaderCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowGtpExtensionNextExtensionHeaderCounter -func (obj *patternFlowGtpExtensionNextExtensionHeader) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowGtpExtensionNextExtensionHeaderCounter value in the PatternFlowGtpExtensionNextExtensionHeader object -func (obj *patternFlowGtpExtensionNextExtensionHeader) SetDecrement(value PatternFlowGtpExtensionNextExtensionHeaderCounter) PatternFlowGtpExtensionNextExtensionHeader { - obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowGtpExtensionNextExtensionHeaderMetricTag -func (obj *patternFlowGtpExtensionNextExtensionHeader) MetricTags() PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter struct { - obj *patternFlowGtpExtensionNextExtensionHeader - patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice []PatternFlowGtpExtensionNextExtensionHeaderMetricTag - fieldPtr *[]*otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag -} - -func newPatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter(ptr *[]*otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { - return &patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter interface { - setMsg(*patternFlowGtpExtensionNextExtensionHeader) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter - Items() []PatternFlowGtpExtensionNextExtensionHeaderMetricTag - Add() PatternFlowGtpExtensionNextExtensionHeaderMetricTag - Append(items ...PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter - Set(index int, newObj PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter - Clear() PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter - clearHolderSlice() PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter - appendHolderSlice(item PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) setMsg(msg *patternFlowGtpExtensionNextExtensionHeader) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowGtpExtensionNextExtensionHeaderMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) Items() []PatternFlowGtpExtensionNextExtensionHeaderMetricTag { - return obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) Add() PatternFlowGtpExtensionNextExtensionHeaderMetricTag { - newObj := &otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowGtpExtensionNextExtensionHeaderMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice = append(obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) Append(items ...PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice = append(obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) Set(index int, newObj PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) Clear() PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag{} - obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice = []PatternFlowGtpExtensionNextExtensionHeaderMetricTag{} - } - return obj -} -func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) clearHolderSlice() PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { - if len(obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice) > 0 { - obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice = []PatternFlowGtpExtensionNextExtensionHeaderMetricTag{} - } - return obj -} -func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) appendHolderSlice(item PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { - obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice = append(obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice, item) - return obj -} - -func (obj *patternFlowGtpExtensionNextExtensionHeader) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionNextExtensionHeader.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowGtpExtensionNextExtensionHeader.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowGtpExtensionNextExtensionHeaderMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowGtpExtensionNextExtensionHeader) setDefault() { - var choices_set int = 0 - var choice PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowGtpExtensionNextExtensionHeaderChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowGtpExtensionNextExtensionHeaderChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpExtensionNextExtensionHeader") - } - } else { - intVal := otg.PatternFlowGtpExtensionNextExtensionHeader_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowGtpExtensionNextExtensionHeader_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpv2VersionCounter ***** -type patternFlowGtpv2VersionCounter struct { - validation - obj *otg.PatternFlowGtpv2VersionCounter - marshaller marshalPatternFlowGtpv2VersionCounter - unMarshaller unMarshalPatternFlowGtpv2VersionCounter -} - -func NewPatternFlowGtpv2VersionCounter() PatternFlowGtpv2VersionCounter { - obj := patternFlowGtpv2VersionCounter{obj: &otg.PatternFlowGtpv2VersionCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2VersionCounter) msg() *otg.PatternFlowGtpv2VersionCounter { - return obj.obj -} - -func (obj *patternFlowGtpv2VersionCounter) setMsg(msg *otg.PatternFlowGtpv2VersionCounter) PatternFlowGtpv2VersionCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2VersionCounter struct { - obj *patternFlowGtpv2VersionCounter -} - -type marshalPatternFlowGtpv2VersionCounter interface { - // ToProto marshals PatternFlowGtpv2VersionCounter to protobuf object *otg.PatternFlowGtpv2VersionCounter - ToProto() (*otg.PatternFlowGtpv2VersionCounter, error) - // ToPbText marshals PatternFlowGtpv2VersionCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2VersionCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2VersionCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2VersionCounter struct { - obj *patternFlowGtpv2VersionCounter -} - -type unMarshalPatternFlowGtpv2VersionCounter interface { - // FromProto unmarshals PatternFlowGtpv2VersionCounter from protobuf object *otg.PatternFlowGtpv2VersionCounter - FromProto(msg *otg.PatternFlowGtpv2VersionCounter) (PatternFlowGtpv2VersionCounter, error) - // FromPbText unmarshals PatternFlowGtpv2VersionCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2VersionCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2VersionCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2VersionCounter) Marshal() marshalPatternFlowGtpv2VersionCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2VersionCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2VersionCounter) Unmarshal() unMarshalPatternFlowGtpv2VersionCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2VersionCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2VersionCounter) ToProto() (*otg.PatternFlowGtpv2VersionCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2VersionCounter) FromProto(msg *otg.PatternFlowGtpv2VersionCounter) (PatternFlowGtpv2VersionCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2VersionCounter) 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 *unMarshalpatternFlowGtpv2VersionCounter) 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 *marshalpatternFlowGtpv2VersionCounter) 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 *unMarshalpatternFlowGtpv2VersionCounter) 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 *marshalpatternFlowGtpv2VersionCounter) 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 *unMarshalpatternFlowGtpv2VersionCounter) 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 *patternFlowGtpv2VersionCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2VersionCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2VersionCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2VersionCounter) Clone() (PatternFlowGtpv2VersionCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2VersionCounter() - 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 -} - -// PatternFlowGtpv2VersionCounter is integer counter pattern -type PatternFlowGtpv2VersionCounter interface { - Validation - // msg marshals PatternFlowGtpv2VersionCounter to protobuf object *otg.PatternFlowGtpv2VersionCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2VersionCounter - // setMsg unmarshals PatternFlowGtpv2VersionCounter from protobuf object *otg.PatternFlowGtpv2VersionCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2VersionCounter) PatternFlowGtpv2VersionCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv2VersionCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2VersionCounter - // validate validates PatternFlowGtpv2VersionCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2VersionCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv2VersionCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv2VersionCounter - SetStart(value uint32) PatternFlowGtpv2VersionCounter - // HasStart checks if Start has been set in PatternFlowGtpv2VersionCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv2VersionCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv2VersionCounter - SetStep(value uint32) PatternFlowGtpv2VersionCounter - // HasStep checks if Step has been set in PatternFlowGtpv2VersionCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv2VersionCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv2VersionCounter - SetCount(value uint32) PatternFlowGtpv2VersionCounter - // HasCount checks if Count has been set in PatternFlowGtpv2VersionCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2VersionCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2VersionCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv2VersionCounter object -func (obj *patternFlowGtpv2VersionCounter) SetStart(value uint32) PatternFlowGtpv2VersionCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2VersionCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2VersionCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv2VersionCounter object -func (obj *patternFlowGtpv2VersionCounter) SetStep(value uint32) PatternFlowGtpv2VersionCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2VersionCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2VersionCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv2VersionCounter object -func (obj *patternFlowGtpv2VersionCounter) SetCount(value uint32) PatternFlowGtpv2VersionCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv2VersionCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2VersionCounter.Start <= 7 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2VersionCounter.Step <= 7 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2VersionCounter.Count <= 7 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv2VersionCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(2) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv2VersionMetricTag ***** -type patternFlowGtpv2VersionMetricTag struct { - validation - obj *otg.PatternFlowGtpv2VersionMetricTag - marshaller marshalPatternFlowGtpv2VersionMetricTag - unMarshaller unMarshalPatternFlowGtpv2VersionMetricTag -} - -func NewPatternFlowGtpv2VersionMetricTag() PatternFlowGtpv2VersionMetricTag { - obj := patternFlowGtpv2VersionMetricTag{obj: &otg.PatternFlowGtpv2VersionMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2VersionMetricTag) msg() *otg.PatternFlowGtpv2VersionMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv2VersionMetricTag) setMsg(msg *otg.PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2VersionMetricTag struct { - obj *patternFlowGtpv2VersionMetricTag -} - -type marshalPatternFlowGtpv2VersionMetricTag interface { - // ToProto marshals PatternFlowGtpv2VersionMetricTag to protobuf object *otg.PatternFlowGtpv2VersionMetricTag - ToProto() (*otg.PatternFlowGtpv2VersionMetricTag, error) - // ToPbText marshals PatternFlowGtpv2VersionMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2VersionMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2VersionMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2VersionMetricTag struct { - obj *patternFlowGtpv2VersionMetricTag -} - -type unMarshalPatternFlowGtpv2VersionMetricTag interface { - // FromProto unmarshals PatternFlowGtpv2VersionMetricTag from protobuf object *otg.PatternFlowGtpv2VersionMetricTag - FromProto(msg *otg.PatternFlowGtpv2VersionMetricTag) (PatternFlowGtpv2VersionMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv2VersionMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2VersionMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2VersionMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2VersionMetricTag) Marshal() marshalPatternFlowGtpv2VersionMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2VersionMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2VersionMetricTag) Unmarshal() unMarshalPatternFlowGtpv2VersionMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2VersionMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2VersionMetricTag) ToProto() (*otg.PatternFlowGtpv2VersionMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2VersionMetricTag) FromProto(msg *otg.PatternFlowGtpv2VersionMetricTag) (PatternFlowGtpv2VersionMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2VersionMetricTag) 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 *unMarshalpatternFlowGtpv2VersionMetricTag) 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 *marshalpatternFlowGtpv2VersionMetricTag) 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 *unMarshalpatternFlowGtpv2VersionMetricTag) 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 *marshalpatternFlowGtpv2VersionMetricTag) 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 *unMarshalpatternFlowGtpv2VersionMetricTag) 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 *patternFlowGtpv2VersionMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2VersionMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2VersionMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2VersionMetricTag) Clone() (PatternFlowGtpv2VersionMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2VersionMetricTag() - 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 -} - -// PatternFlowGtpv2VersionMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv2VersionMetricTag interface { - Validation - // msg marshals PatternFlowGtpv2VersionMetricTag to protobuf object *otg.PatternFlowGtpv2VersionMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2VersionMetricTag - // setMsg unmarshals PatternFlowGtpv2VersionMetricTag from protobuf object *otg.PatternFlowGtpv2VersionMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv2VersionMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2VersionMetricTag - // validate validates PatternFlowGtpv2VersionMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2VersionMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv2VersionMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv2VersionMetricTag - SetName(value string) PatternFlowGtpv2VersionMetricTag - // Offset returns uint32, set in PatternFlowGtpv2VersionMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv2VersionMetricTag - SetOffset(value uint32) PatternFlowGtpv2VersionMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv2VersionMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv2VersionMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv2VersionMetricTag - SetLength(value uint32) PatternFlowGtpv2VersionMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv2VersionMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv2VersionMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv2VersionMetricTag object -func (obj *patternFlowGtpv2VersionMetricTag) SetName(value string) PatternFlowGtpv2VersionMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2VersionMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2VersionMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv2VersionMetricTag object -func (obj *patternFlowGtpv2VersionMetricTag) SetOffset(value uint32) PatternFlowGtpv2VersionMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2VersionMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2VersionMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv2VersionMetricTag object -func (obj *patternFlowGtpv2VersionMetricTag) SetLength(value uint32) PatternFlowGtpv2VersionMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv2VersionMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2VersionMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 2 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2VersionMetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv2VersionMetricTag.Length <= 3 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv2VersionMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(3) - } - -} - -// ***** PatternFlowGtpv2PiggybackingFlagCounter ***** -type patternFlowGtpv2PiggybackingFlagCounter struct { - validation - obj *otg.PatternFlowGtpv2PiggybackingFlagCounter - marshaller marshalPatternFlowGtpv2PiggybackingFlagCounter - unMarshaller unMarshalPatternFlowGtpv2PiggybackingFlagCounter -} - -func NewPatternFlowGtpv2PiggybackingFlagCounter() PatternFlowGtpv2PiggybackingFlagCounter { - obj := patternFlowGtpv2PiggybackingFlagCounter{obj: &otg.PatternFlowGtpv2PiggybackingFlagCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2PiggybackingFlagCounter) msg() *otg.PatternFlowGtpv2PiggybackingFlagCounter { - return obj.obj -} - -func (obj *patternFlowGtpv2PiggybackingFlagCounter) setMsg(msg *otg.PatternFlowGtpv2PiggybackingFlagCounter) PatternFlowGtpv2PiggybackingFlagCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2PiggybackingFlagCounter struct { - obj *patternFlowGtpv2PiggybackingFlagCounter -} - -type marshalPatternFlowGtpv2PiggybackingFlagCounter interface { - // ToProto marshals PatternFlowGtpv2PiggybackingFlagCounter to protobuf object *otg.PatternFlowGtpv2PiggybackingFlagCounter - ToProto() (*otg.PatternFlowGtpv2PiggybackingFlagCounter, error) - // ToPbText marshals PatternFlowGtpv2PiggybackingFlagCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2PiggybackingFlagCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2PiggybackingFlagCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2PiggybackingFlagCounter struct { - obj *patternFlowGtpv2PiggybackingFlagCounter -} - -type unMarshalPatternFlowGtpv2PiggybackingFlagCounter interface { - // FromProto unmarshals PatternFlowGtpv2PiggybackingFlagCounter from protobuf object *otg.PatternFlowGtpv2PiggybackingFlagCounter - FromProto(msg *otg.PatternFlowGtpv2PiggybackingFlagCounter) (PatternFlowGtpv2PiggybackingFlagCounter, error) - // FromPbText unmarshals PatternFlowGtpv2PiggybackingFlagCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2PiggybackingFlagCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2PiggybackingFlagCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2PiggybackingFlagCounter) Marshal() marshalPatternFlowGtpv2PiggybackingFlagCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2PiggybackingFlagCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2PiggybackingFlagCounter) Unmarshal() unMarshalPatternFlowGtpv2PiggybackingFlagCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2PiggybackingFlagCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2PiggybackingFlagCounter) ToProto() (*otg.PatternFlowGtpv2PiggybackingFlagCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2PiggybackingFlagCounter) FromProto(msg *otg.PatternFlowGtpv2PiggybackingFlagCounter) (PatternFlowGtpv2PiggybackingFlagCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2PiggybackingFlagCounter) 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 *unMarshalpatternFlowGtpv2PiggybackingFlagCounter) 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 *marshalpatternFlowGtpv2PiggybackingFlagCounter) 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 *unMarshalpatternFlowGtpv2PiggybackingFlagCounter) 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 *marshalpatternFlowGtpv2PiggybackingFlagCounter) 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 *unMarshalpatternFlowGtpv2PiggybackingFlagCounter) 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 *patternFlowGtpv2PiggybackingFlagCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2PiggybackingFlagCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2PiggybackingFlagCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2PiggybackingFlagCounter) Clone() (PatternFlowGtpv2PiggybackingFlagCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2PiggybackingFlagCounter() - 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 -} - -// PatternFlowGtpv2PiggybackingFlagCounter is integer counter pattern -type PatternFlowGtpv2PiggybackingFlagCounter interface { - Validation - // msg marshals PatternFlowGtpv2PiggybackingFlagCounter to protobuf object *otg.PatternFlowGtpv2PiggybackingFlagCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2PiggybackingFlagCounter - // setMsg unmarshals PatternFlowGtpv2PiggybackingFlagCounter from protobuf object *otg.PatternFlowGtpv2PiggybackingFlagCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2PiggybackingFlagCounter) PatternFlowGtpv2PiggybackingFlagCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv2PiggybackingFlagCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2PiggybackingFlagCounter - // validate validates PatternFlowGtpv2PiggybackingFlagCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2PiggybackingFlagCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv2PiggybackingFlagCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv2PiggybackingFlagCounter - SetStart(value uint32) PatternFlowGtpv2PiggybackingFlagCounter - // HasStart checks if Start has been set in PatternFlowGtpv2PiggybackingFlagCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv2PiggybackingFlagCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv2PiggybackingFlagCounter - SetStep(value uint32) PatternFlowGtpv2PiggybackingFlagCounter - // HasStep checks if Step has been set in PatternFlowGtpv2PiggybackingFlagCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv2PiggybackingFlagCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv2PiggybackingFlagCounter - SetCount(value uint32) PatternFlowGtpv2PiggybackingFlagCounter - // HasCount checks if Count has been set in PatternFlowGtpv2PiggybackingFlagCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2PiggybackingFlagCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2PiggybackingFlagCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv2PiggybackingFlagCounter object -func (obj *patternFlowGtpv2PiggybackingFlagCounter) SetStart(value uint32) PatternFlowGtpv2PiggybackingFlagCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2PiggybackingFlagCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2PiggybackingFlagCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv2PiggybackingFlagCounter object -func (obj *patternFlowGtpv2PiggybackingFlagCounter) SetStep(value uint32) PatternFlowGtpv2PiggybackingFlagCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2PiggybackingFlagCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2PiggybackingFlagCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv2PiggybackingFlagCounter object -func (obj *patternFlowGtpv2PiggybackingFlagCounter) SetCount(value uint32) PatternFlowGtpv2PiggybackingFlagCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv2PiggybackingFlagCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2PiggybackingFlagCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2PiggybackingFlagCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2PiggybackingFlagCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv2PiggybackingFlagCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv2PiggybackingFlagMetricTag ***** -type patternFlowGtpv2PiggybackingFlagMetricTag struct { - validation - obj *otg.PatternFlowGtpv2PiggybackingFlagMetricTag - marshaller marshalPatternFlowGtpv2PiggybackingFlagMetricTag - unMarshaller unMarshalPatternFlowGtpv2PiggybackingFlagMetricTag -} - -func NewPatternFlowGtpv2PiggybackingFlagMetricTag() PatternFlowGtpv2PiggybackingFlagMetricTag { - obj := patternFlowGtpv2PiggybackingFlagMetricTag{obj: &otg.PatternFlowGtpv2PiggybackingFlagMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) msg() *otg.PatternFlowGtpv2PiggybackingFlagMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) setMsg(msg *otg.PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2PiggybackingFlagMetricTag struct { - obj *patternFlowGtpv2PiggybackingFlagMetricTag -} - -type marshalPatternFlowGtpv2PiggybackingFlagMetricTag interface { - // ToProto marshals PatternFlowGtpv2PiggybackingFlagMetricTag to protobuf object *otg.PatternFlowGtpv2PiggybackingFlagMetricTag - ToProto() (*otg.PatternFlowGtpv2PiggybackingFlagMetricTag, error) - // ToPbText marshals PatternFlowGtpv2PiggybackingFlagMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2PiggybackingFlagMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2PiggybackingFlagMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2PiggybackingFlagMetricTag struct { - obj *patternFlowGtpv2PiggybackingFlagMetricTag -} - -type unMarshalPatternFlowGtpv2PiggybackingFlagMetricTag interface { - // FromProto unmarshals PatternFlowGtpv2PiggybackingFlagMetricTag from protobuf object *otg.PatternFlowGtpv2PiggybackingFlagMetricTag - FromProto(msg *otg.PatternFlowGtpv2PiggybackingFlagMetricTag) (PatternFlowGtpv2PiggybackingFlagMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv2PiggybackingFlagMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2PiggybackingFlagMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2PiggybackingFlagMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) Marshal() marshalPatternFlowGtpv2PiggybackingFlagMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2PiggybackingFlagMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) Unmarshal() unMarshalPatternFlowGtpv2PiggybackingFlagMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2PiggybackingFlagMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2PiggybackingFlagMetricTag) ToProto() (*otg.PatternFlowGtpv2PiggybackingFlagMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2PiggybackingFlagMetricTag) FromProto(msg *otg.PatternFlowGtpv2PiggybackingFlagMetricTag) (PatternFlowGtpv2PiggybackingFlagMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2PiggybackingFlagMetricTag) 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 *unMarshalpatternFlowGtpv2PiggybackingFlagMetricTag) 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 *marshalpatternFlowGtpv2PiggybackingFlagMetricTag) 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 *unMarshalpatternFlowGtpv2PiggybackingFlagMetricTag) 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 *marshalpatternFlowGtpv2PiggybackingFlagMetricTag) 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 *unMarshalpatternFlowGtpv2PiggybackingFlagMetricTag) 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 *patternFlowGtpv2PiggybackingFlagMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) Clone() (PatternFlowGtpv2PiggybackingFlagMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2PiggybackingFlagMetricTag() - 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 -} - -// PatternFlowGtpv2PiggybackingFlagMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv2PiggybackingFlagMetricTag interface { - Validation - // msg marshals PatternFlowGtpv2PiggybackingFlagMetricTag to protobuf object *otg.PatternFlowGtpv2PiggybackingFlagMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2PiggybackingFlagMetricTag - // setMsg unmarshals PatternFlowGtpv2PiggybackingFlagMetricTag from protobuf object *otg.PatternFlowGtpv2PiggybackingFlagMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv2PiggybackingFlagMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2PiggybackingFlagMetricTag - // validate validates PatternFlowGtpv2PiggybackingFlagMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2PiggybackingFlagMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv2PiggybackingFlagMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv2PiggybackingFlagMetricTag - SetName(value string) PatternFlowGtpv2PiggybackingFlagMetricTag - // Offset returns uint32, set in PatternFlowGtpv2PiggybackingFlagMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv2PiggybackingFlagMetricTag - SetOffset(value uint32) PatternFlowGtpv2PiggybackingFlagMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv2PiggybackingFlagMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv2PiggybackingFlagMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv2PiggybackingFlagMetricTag - SetLength(value uint32) PatternFlowGtpv2PiggybackingFlagMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv2PiggybackingFlagMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv2PiggybackingFlagMetricTag object -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) SetName(value string) PatternFlowGtpv2PiggybackingFlagMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv2PiggybackingFlagMetricTag object -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) SetOffset(value uint32) PatternFlowGtpv2PiggybackingFlagMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv2PiggybackingFlagMetricTag object -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) SetLength(value uint32) PatternFlowGtpv2PiggybackingFlagMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2PiggybackingFlagMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2PiggybackingFlagMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv2PiggybackingFlagMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowGtpv2TeidFlagCounter ***** -type patternFlowGtpv2TeidFlagCounter struct { - validation - obj *otg.PatternFlowGtpv2TeidFlagCounter - marshaller marshalPatternFlowGtpv2TeidFlagCounter - unMarshaller unMarshalPatternFlowGtpv2TeidFlagCounter -} - -func NewPatternFlowGtpv2TeidFlagCounter() PatternFlowGtpv2TeidFlagCounter { - obj := patternFlowGtpv2TeidFlagCounter{obj: &otg.PatternFlowGtpv2TeidFlagCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2TeidFlagCounter) msg() *otg.PatternFlowGtpv2TeidFlagCounter { - return obj.obj -} - -func (obj *patternFlowGtpv2TeidFlagCounter) setMsg(msg *otg.PatternFlowGtpv2TeidFlagCounter) PatternFlowGtpv2TeidFlagCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2TeidFlagCounter struct { - obj *patternFlowGtpv2TeidFlagCounter -} - -type marshalPatternFlowGtpv2TeidFlagCounter interface { - // ToProto marshals PatternFlowGtpv2TeidFlagCounter to protobuf object *otg.PatternFlowGtpv2TeidFlagCounter - ToProto() (*otg.PatternFlowGtpv2TeidFlagCounter, error) - // ToPbText marshals PatternFlowGtpv2TeidFlagCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2TeidFlagCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2TeidFlagCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2TeidFlagCounter struct { - obj *patternFlowGtpv2TeidFlagCounter -} - -type unMarshalPatternFlowGtpv2TeidFlagCounter interface { - // FromProto unmarshals PatternFlowGtpv2TeidFlagCounter from protobuf object *otg.PatternFlowGtpv2TeidFlagCounter - FromProto(msg *otg.PatternFlowGtpv2TeidFlagCounter) (PatternFlowGtpv2TeidFlagCounter, error) - // FromPbText unmarshals PatternFlowGtpv2TeidFlagCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2TeidFlagCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2TeidFlagCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2TeidFlagCounter) Marshal() marshalPatternFlowGtpv2TeidFlagCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2TeidFlagCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2TeidFlagCounter) Unmarshal() unMarshalPatternFlowGtpv2TeidFlagCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2TeidFlagCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2TeidFlagCounter) ToProto() (*otg.PatternFlowGtpv2TeidFlagCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2TeidFlagCounter) FromProto(msg *otg.PatternFlowGtpv2TeidFlagCounter) (PatternFlowGtpv2TeidFlagCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2TeidFlagCounter) 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 *unMarshalpatternFlowGtpv2TeidFlagCounter) 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 *marshalpatternFlowGtpv2TeidFlagCounter) 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 *unMarshalpatternFlowGtpv2TeidFlagCounter) 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 *marshalpatternFlowGtpv2TeidFlagCounter) 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 *unMarshalpatternFlowGtpv2TeidFlagCounter) 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 *patternFlowGtpv2TeidFlagCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2TeidFlagCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2TeidFlagCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2TeidFlagCounter) Clone() (PatternFlowGtpv2TeidFlagCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2TeidFlagCounter() - 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 -} - -// PatternFlowGtpv2TeidFlagCounter is integer counter pattern -type PatternFlowGtpv2TeidFlagCounter interface { - Validation - // msg marshals PatternFlowGtpv2TeidFlagCounter to protobuf object *otg.PatternFlowGtpv2TeidFlagCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2TeidFlagCounter - // setMsg unmarshals PatternFlowGtpv2TeidFlagCounter from protobuf object *otg.PatternFlowGtpv2TeidFlagCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2TeidFlagCounter) PatternFlowGtpv2TeidFlagCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv2TeidFlagCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2TeidFlagCounter - // validate validates PatternFlowGtpv2TeidFlagCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2TeidFlagCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv2TeidFlagCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv2TeidFlagCounter - SetStart(value uint32) PatternFlowGtpv2TeidFlagCounter - // HasStart checks if Start has been set in PatternFlowGtpv2TeidFlagCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv2TeidFlagCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv2TeidFlagCounter - SetStep(value uint32) PatternFlowGtpv2TeidFlagCounter - // HasStep checks if Step has been set in PatternFlowGtpv2TeidFlagCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv2TeidFlagCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv2TeidFlagCounter - SetCount(value uint32) PatternFlowGtpv2TeidFlagCounter - // HasCount checks if Count has been set in PatternFlowGtpv2TeidFlagCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2TeidFlagCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2TeidFlagCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv2TeidFlagCounter object -func (obj *patternFlowGtpv2TeidFlagCounter) SetStart(value uint32) PatternFlowGtpv2TeidFlagCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2TeidFlagCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2TeidFlagCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv2TeidFlagCounter object -func (obj *patternFlowGtpv2TeidFlagCounter) SetStep(value uint32) PatternFlowGtpv2TeidFlagCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2TeidFlagCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2TeidFlagCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv2TeidFlagCounter object -func (obj *patternFlowGtpv2TeidFlagCounter) SetCount(value uint32) PatternFlowGtpv2TeidFlagCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv2TeidFlagCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2TeidFlagCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2TeidFlagCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2TeidFlagCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv2TeidFlagCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv2TeidFlagMetricTag ***** -type patternFlowGtpv2TeidFlagMetricTag struct { - validation - obj *otg.PatternFlowGtpv2TeidFlagMetricTag - marshaller marshalPatternFlowGtpv2TeidFlagMetricTag - unMarshaller unMarshalPatternFlowGtpv2TeidFlagMetricTag -} - -func NewPatternFlowGtpv2TeidFlagMetricTag() PatternFlowGtpv2TeidFlagMetricTag { - obj := patternFlowGtpv2TeidFlagMetricTag{obj: &otg.PatternFlowGtpv2TeidFlagMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2TeidFlagMetricTag) msg() *otg.PatternFlowGtpv2TeidFlagMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv2TeidFlagMetricTag) setMsg(msg *otg.PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2TeidFlagMetricTag struct { - obj *patternFlowGtpv2TeidFlagMetricTag -} - -type marshalPatternFlowGtpv2TeidFlagMetricTag interface { - // ToProto marshals PatternFlowGtpv2TeidFlagMetricTag to protobuf object *otg.PatternFlowGtpv2TeidFlagMetricTag - ToProto() (*otg.PatternFlowGtpv2TeidFlagMetricTag, error) - // ToPbText marshals PatternFlowGtpv2TeidFlagMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2TeidFlagMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2TeidFlagMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2TeidFlagMetricTag struct { - obj *patternFlowGtpv2TeidFlagMetricTag -} - -type unMarshalPatternFlowGtpv2TeidFlagMetricTag interface { - // FromProto unmarshals PatternFlowGtpv2TeidFlagMetricTag from protobuf object *otg.PatternFlowGtpv2TeidFlagMetricTag - FromProto(msg *otg.PatternFlowGtpv2TeidFlagMetricTag) (PatternFlowGtpv2TeidFlagMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv2TeidFlagMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2TeidFlagMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2TeidFlagMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2TeidFlagMetricTag) Marshal() marshalPatternFlowGtpv2TeidFlagMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2TeidFlagMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2TeidFlagMetricTag) Unmarshal() unMarshalPatternFlowGtpv2TeidFlagMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2TeidFlagMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2TeidFlagMetricTag) ToProto() (*otg.PatternFlowGtpv2TeidFlagMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2TeidFlagMetricTag) FromProto(msg *otg.PatternFlowGtpv2TeidFlagMetricTag) (PatternFlowGtpv2TeidFlagMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2TeidFlagMetricTag) 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 *unMarshalpatternFlowGtpv2TeidFlagMetricTag) 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 *marshalpatternFlowGtpv2TeidFlagMetricTag) 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 *unMarshalpatternFlowGtpv2TeidFlagMetricTag) 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 *marshalpatternFlowGtpv2TeidFlagMetricTag) 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 *unMarshalpatternFlowGtpv2TeidFlagMetricTag) 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 *patternFlowGtpv2TeidFlagMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2TeidFlagMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2TeidFlagMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2TeidFlagMetricTag) Clone() (PatternFlowGtpv2TeidFlagMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2TeidFlagMetricTag() - 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 -} - -// PatternFlowGtpv2TeidFlagMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv2TeidFlagMetricTag interface { - Validation - // msg marshals PatternFlowGtpv2TeidFlagMetricTag to protobuf object *otg.PatternFlowGtpv2TeidFlagMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2TeidFlagMetricTag - // setMsg unmarshals PatternFlowGtpv2TeidFlagMetricTag from protobuf object *otg.PatternFlowGtpv2TeidFlagMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv2TeidFlagMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2TeidFlagMetricTag - // validate validates PatternFlowGtpv2TeidFlagMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2TeidFlagMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv2TeidFlagMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv2TeidFlagMetricTag - SetName(value string) PatternFlowGtpv2TeidFlagMetricTag - // Offset returns uint32, set in PatternFlowGtpv2TeidFlagMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv2TeidFlagMetricTag - SetOffset(value uint32) PatternFlowGtpv2TeidFlagMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv2TeidFlagMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv2TeidFlagMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv2TeidFlagMetricTag - SetLength(value uint32) PatternFlowGtpv2TeidFlagMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv2TeidFlagMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv2TeidFlagMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv2TeidFlagMetricTag object -func (obj *patternFlowGtpv2TeidFlagMetricTag) SetName(value string) PatternFlowGtpv2TeidFlagMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2TeidFlagMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2TeidFlagMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv2TeidFlagMetricTag object -func (obj *patternFlowGtpv2TeidFlagMetricTag) SetOffset(value uint32) PatternFlowGtpv2TeidFlagMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2TeidFlagMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2TeidFlagMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv2TeidFlagMetricTag object -func (obj *patternFlowGtpv2TeidFlagMetricTag) SetLength(value uint32) PatternFlowGtpv2TeidFlagMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv2TeidFlagMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2TeidFlagMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2TeidFlagMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv2TeidFlagMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv2TeidFlagMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowGtpv2Spare1Counter ***** -type patternFlowGtpv2Spare1Counter struct { - validation - obj *otg.PatternFlowGtpv2Spare1Counter - marshaller marshalPatternFlowGtpv2Spare1Counter - unMarshaller unMarshalPatternFlowGtpv2Spare1Counter -} - -func NewPatternFlowGtpv2Spare1Counter() PatternFlowGtpv2Spare1Counter { - obj := patternFlowGtpv2Spare1Counter{obj: &otg.PatternFlowGtpv2Spare1Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2Spare1Counter) msg() *otg.PatternFlowGtpv2Spare1Counter { - return obj.obj -} - -func (obj *patternFlowGtpv2Spare1Counter) setMsg(msg *otg.PatternFlowGtpv2Spare1Counter) PatternFlowGtpv2Spare1Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2Spare1Counter struct { - obj *patternFlowGtpv2Spare1Counter -} - -type marshalPatternFlowGtpv2Spare1Counter interface { - // ToProto marshals PatternFlowGtpv2Spare1Counter to protobuf object *otg.PatternFlowGtpv2Spare1Counter - ToProto() (*otg.PatternFlowGtpv2Spare1Counter, error) - // ToPbText marshals PatternFlowGtpv2Spare1Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2Spare1Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2Spare1Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2Spare1Counter struct { - obj *patternFlowGtpv2Spare1Counter -} - -type unMarshalPatternFlowGtpv2Spare1Counter interface { - // FromProto unmarshals PatternFlowGtpv2Spare1Counter from protobuf object *otg.PatternFlowGtpv2Spare1Counter - FromProto(msg *otg.PatternFlowGtpv2Spare1Counter) (PatternFlowGtpv2Spare1Counter, error) - // FromPbText unmarshals PatternFlowGtpv2Spare1Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2Spare1Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2Spare1Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2Spare1Counter) Marshal() marshalPatternFlowGtpv2Spare1Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2Spare1Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2Spare1Counter) Unmarshal() unMarshalPatternFlowGtpv2Spare1Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2Spare1Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2Spare1Counter) ToProto() (*otg.PatternFlowGtpv2Spare1Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2Spare1Counter) FromProto(msg *otg.PatternFlowGtpv2Spare1Counter) (PatternFlowGtpv2Spare1Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2Spare1Counter) 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 *unMarshalpatternFlowGtpv2Spare1Counter) 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 *marshalpatternFlowGtpv2Spare1Counter) 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 *unMarshalpatternFlowGtpv2Spare1Counter) 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 *marshalpatternFlowGtpv2Spare1Counter) 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 *unMarshalpatternFlowGtpv2Spare1Counter) 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 *patternFlowGtpv2Spare1Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Spare1Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Spare1Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2Spare1Counter) Clone() (PatternFlowGtpv2Spare1Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2Spare1Counter() - 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 -} - -// PatternFlowGtpv2Spare1Counter is integer counter pattern -type PatternFlowGtpv2Spare1Counter interface { - Validation - // msg marshals PatternFlowGtpv2Spare1Counter to protobuf object *otg.PatternFlowGtpv2Spare1Counter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2Spare1Counter - // setMsg unmarshals PatternFlowGtpv2Spare1Counter from protobuf object *otg.PatternFlowGtpv2Spare1Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2Spare1Counter) PatternFlowGtpv2Spare1Counter - // provides marshal interface - Marshal() marshalPatternFlowGtpv2Spare1Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2Spare1Counter - // validate validates PatternFlowGtpv2Spare1Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2Spare1Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv2Spare1Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv2Spare1Counter - SetStart(value uint32) PatternFlowGtpv2Spare1Counter - // HasStart checks if Start has been set in PatternFlowGtpv2Spare1Counter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv2Spare1Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv2Spare1Counter - SetStep(value uint32) PatternFlowGtpv2Spare1Counter - // HasStep checks if Step has been set in PatternFlowGtpv2Spare1Counter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv2Spare1Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv2Spare1Counter - SetCount(value uint32) PatternFlowGtpv2Spare1Counter - // HasCount checks if Count has been set in PatternFlowGtpv2Spare1Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2Spare1Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2Spare1Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv2Spare1Counter object -func (obj *patternFlowGtpv2Spare1Counter) SetStart(value uint32) PatternFlowGtpv2Spare1Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2Spare1Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2Spare1Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv2Spare1Counter object -func (obj *patternFlowGtpv2Spare1Counter) SetStep(value uint32) PatternFlowGtpv2Spare1Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2Spare1Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2Spare1Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv2Spare1Counter object -func (obj *patternFlowGtpv2Spare1Counter) SetCount(value uint32) PatternFlowGtpv2Spare1Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv2Spare1Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2Spare1Counter.Start <= 7 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2Spare1Counter.Step <= 7 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2Spare1Counter.Count <= 7 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv2Spare1Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv2Spare1MetricTag ***** -type patternFlowGtpv2Spare1MetricTag struct { - validation - obj *otg.PatternFlowGtpv2Spare1MetricTag - marshaller marshalPatternFlowGtpv2Spare1MetricTag - unMarshaller unMarshalPatternFlowGtpv2Spare1MetricTag -} - -func NewPatternFlowGtpv2Spare1MetricTag() PatternFlowGtpv2Spare1MetricTag { - obj := patternFlowGtpv2Spare1MetricTag{obj: &otg.PatternFlowGtpv2Spare1MetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2Spare1MetricTag) msg() *otg.PatternFlowGtpv2Spare1MetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv2Spare1MetricTag) setMsg(msg *otg.PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1MetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2Spare1MetricTag struct { - obj *patternFlowGtpv2Spare1MetricTag -} - -type marshalPatternFlowGtpv2Spare1MetricTag interface { - // ToProto marshals PatternFlowGtpv2Spare1MetricTag to protobuf object *otg.PatternFlowGtpv2Spare1MetricTag - ToProto() (*otg.PatternFlowGtpv2Spare1MetricTag, error) - // ToPbText marshals PatternFlowGtpv2Spare1MetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2Spare1MetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2Spare1MetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2Spare1MetricTag struct { - obj *patternFlowGtpv2Spare1MetricTag -} - -type unMarshalPatternFlowGtpv2Spare1MetricTag interface { - // FromProto unmarshals PatternFlowGtpv2Spare1MetricTag from protobuf object *otg.PatternFlowGtpv2Spare1MetricTag - FromProto(msg *otg.PatternFlowGtpv2Spare1MetricTag) (PatternFlowGtpv2Spare1MetricTag, error) - // FromPbText unmarshals PatternFlowGtpv2Spare1MetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2Spare1MetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2Spare1MetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2Spare1MetricTag) Marshal() marshalPatternFlowGtpv2Spare1MetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2Spare1MetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2Spare1MetricTag) Unmarshal() unMarshalPatternFlowGtpv2Spare1MetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2Spare1MetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2Spare1MetricTag) ToProto() (*otg.PatternFlowGtpv2Spare1MetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2Spare1MetricTag) FromProto(msg *otg.PatternFlowGtpv2Spare1MetricTag) (PatternFlowGtpv2Spare1MetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2Spare1MetricTag) 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 *unMarshalpatternFlowGtpv2Spare1MetricTag) 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 *marshalpatternFlowGtpv2Spare1MetricTag) 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 *unMarshalpatternFlowGtpv2Spare1MetricTag) 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 *marshalpatternFlowGtpv2Spare1MetricTag) 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 *unMarshalpatternFlowGtpv2Spare1MetricTag) 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 *patternFlowGtpv2Spare1MetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Spare1MetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Spare1MetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2Spare1MetricTag) Clone() (PatternFlowGtpv2Spare1MetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2Spare1MetricTag() - 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 -} - -// PatternFlowGtpv2Spare1MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv2Spare1MetricTag interface { - Validation - // msg marshals PatternFlowGtpv2Spare1MetricTag to protobuf object *otg.PatternFlowGtpv2Spare1MetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2Spare1MetricTag - // setMsg unmarshals PatternFlowGtpv2Spare1MetricTag from protobuf object *otg.PatternFlowGtpv2Spare1MetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1MetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv2Spare1MetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2Spare1MetricTag - // validate validates PatternFlowGtpv2Spare1MetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2Spare1MetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv2Spare1MetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv2Spare1MetricTag - SetName(value string) PatternFlowGtpv2Spare1MetricTag - // Offset returns uint32, set in PatternFlowGtpv2Spare1MetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv2Spare1MetricTag - SetOffset(value uint32) PatternFlowGtpv2Spare1MetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv2Spare1MetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv2Spare1MetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv2Spare1MetricTag - SetLength(value uint32) PatternFlowGtpv2Spare1MetricTag - // HasLength checks if Length has been set in PatternFlowGtpv2Spare1MetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv2Spare1MetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv2Spare1MetricTag object -func (obj *patternFlowGtpv2Spare1MetricTag) SetName(value string) PatternFlowGtpv2Spare1MetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2Spare1MetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2Spare1MetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv2Spare1MetricTag object -func (obj *patternFlowGtpv2Spare1MetricTag) SetOffset(value uint32) PatternFlowGtpv2Spare1MetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2Spare1MetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2Spare1MetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv2Spare1MetricTag object -func (obj *patternFlowGtpv2Spare1MetricTag) SetLength(value uint32) PatternFlowGtpv2Spare1MetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv2Spare1MetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2Spare1MetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 2 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2Spare1MetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv2Spare1MetricTag.Length <= 3 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv2Spare1MetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(3) - } - -} - -// ***** PatternFlowGtpv2MessageTypeCounter ***** -type patternFlowGtpv2MessageTypeCounter struct { - validation - obj *otg.PatternFlowGtpv2MessageTypeCounter - marshaller marshalPatternFlowGtpv2MessageTypeCounter - unMarshaller unMarshalPatternFlowGtpv2MessageTypeCounter -} - -func NewPatternFlowGtpv2MessageTypeCounter() PatternFlowGtpv2MessageTypeCounter { - obj := patternFlowGtpv2MessageTypeCounter{obj: &otg.PatternFlowGtpv2MessageTypeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2MessageTypeCounter) msg() *otg.PatternFlowGtpv2MessageTypeCounter { - return obj.obj -} - -func (obj *patternFlowGtpv2MessageTypeCounter) setMsg(msg *otg.PatternFlowGtpv2MessageTypeCounter) PatternFlowGtpv2MessageTypeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2MessageTypeCounter struct { - obj *patternFlowGtpv2MessageTypeCounter -} - -type marshalPatternFlowGtpv2MessageTypeCounter interface { - // ToProto marshals PatternFlowGtpv2MessageTypeCounter to protobuf object *otg.PatternFlowGtpv2MessageTypeCounter - ToProto() (*otg.PatternFlowGtpv2MessageTypeCounter, error) - // ToPbText marshals PatternFlowGtpv2MessageTypeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2MessageTypeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2MessageTypeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2MessageTypeCounter struct { - obj *patternFlowGtpv2MessageTypeCounter -} - -type unMarshalPatternFlowGtpv2MessageTypeCounter interface { - // FromProto unmarshals PatternFlowGtpv2MessageTypeCounter from protobuf object *otg.PatternFlowGtpv2MessageTypeCounter - FromProto(msg *otg.PatternFlowGtpv2MessageTypeCounter) (PatternFlowGtpv2MessageTypeCounter, error) - // FromPbText unmarshals PatternFlowGtpv2MessageTypeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2MessageTypeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2MessageTypeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2MessageTypeCounter) Marshal() marshalPatternFlowGtpv2MessageTypeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2MessageTypeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2MessageTypeCounter) Unmarshal() unMarshalPatternFlowGtpv2MessageTypeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2MessageTypeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2MessageTypeCounter) ToProto() (*otg.PatternFlowGtpv2MessageTypeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2MessageTypeCounter) FromProto(msg *otg.PatternFlowGtpv2MessageTypeCounter) (PatternFlowGtpv2MessageTypeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2MessageTypeCounter) 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 *unMarshalpatternFlowGtpv2MessageTypeCounter) 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 *marshalpatternFlowGtpv2MessageTypeCounter) 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 *unMarshalpatternFlowGtpv2MessageTypeCounter) 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 *marshalpatternFlowGtpv2MessageTypeCounter) 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 *unMarshalpatternFlowGtpv2MessageTypeCounter) 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 *patternFlowGtpv2MessageTypeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2MessageTypeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2MessageTypeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2MessageTypeCounter) Clone() (PatternFlowGtpv2MessageTypeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2MessageTypeCounter() - 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 -} - -// PatternFlowGtpv2MessageTypeCounter is integer counter pattern -type PatternFlowGtpv2MessageTypeCounter interface { - Validation - // msg marshals PatternFlowGtpv2MessageTypeCounter to protobuf object *otg.PatternFlowGtpv2MessageTypeCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2MessageTypeCounter - // setMsg unmarshals PatternFlowGtpv2MessageTypeCounter from protobuf object *otg.PatternFlowGtpv2MessageTypeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2MessageTypeCounter) PatternFlowGtpv2MessageTypeCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv2MessageTypeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2MessageTypeCounter - // validate validates PatternFlowGtpv2MessageTypeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2MessageTypeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv2MessageTypeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv2MessageTypeCounter - SetStart(value uint32) PatternFlowGtpv2MessageTypeCounter - // HasStart checks if Start has been set in PatternFlowGtpv2MessageTypeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv2MessageTypeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv2MessageTypeCounter - SetStep(value uint32) PatternFlowGtpv2MessageTypeCounter - // HasStep checks if Step has been set in PatternFlowGtpv2MessageTypeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv2MessageTypeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv2MessageTypeCounter - SetCount(value uint32) PatternFlowGtpv2MessageTypeCounter - // HasCount checks if Count has been set in PatternFlowGtpv2MessageTypeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2MessageTypeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2MessageTypeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv2MessageTypeCounter object -func (obj *patternFlowGtpv2MessageTypeCounter) SetStart(value uint32) PatternFlowGtpv2MessageTypeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2MessageTypeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2MessageTypeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv2MessageTypeCounter object -func (obj *patternFlowGtpv2MessageTypeCounter) SetStep(value uint32) PatternFlowGtpv2MessageTypeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2MessageTypeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2MessageTypeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv2MessageTypeCounter object -func (obj *patternFlowGtpv2MessageTypeCounter) SetCount(value uint32) PatternFlowGtpv2MessageTypeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv2MessageTypeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2MessageTypeCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2MessageTypeCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2MessageTypeCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv2MessageTypeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv2MessageTypeMetricTag ***** -type patternFlowGtpv2MessageTypeMetricTag struct { - validation - obj *otg.PatternFlowGtpv2MessageTypeMetricTag - marshaller marshalPatternFlowGtpv2MessageTypeMetricTag - unMarshaller unMarshalPatternFlowGtpv2MessageTypeMetricTag -} - -func NewPatternFlowGtpv2MessageTypeMetricTag() PatternFlowGtpv2MessageTypeMetricTag { - obj := patternFlowGtpv2MessageTypeMetricTag{obj: &otg.PatternFlowGtpv2MessageTypeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2MessageTypeMetricTag) msg() *otg.PatternFlowGtpv2MessageTypeMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv2MessageTypeMetricTag) setMsg(msg *otg.PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2MessageTypeMetricTag struct { - obj *patternFlowGtpv2MessageTypeMetricTag -} - -type marshalPatternFlowGtpv2MessageTypeMetricTag interface { - // ToProto marshals PatternFlowGtpv2MessageTypeMetricTag to protobuf object *otg.PatternFlowGtpv2MessageTypeMetricTag - ToProto() (*otg.PatternFlowGtpv2MessageTypeMetricTag, error) - // ToPbText marshals PatternFlowGtpv2MessageTypeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2MessageTypeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2MessageTypeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2MessageTypeMetricTag struct { - obj *patternFlowGtpv2MessageTypeMetricTag -} - -type unMarshalPatternFlowGtpv2MessageTypeMetricTag interface { - // FromProto unmarshals PatternFlowGtpv2MessageTypeMetricTag from protobuf object *otg.PatternFlowGtpv2MessageTypeMetricTag - FromProto(msg *otg.PatternFlowGtpv2MessageTypeMetricTag) (PatternFlowGtpv2MessageTypeMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv2MessageTypeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2MessageTypeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2MessageTypeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2MessageTypeMetricTag) Marshal() marshalPatternFlowGtpv2MessageTypeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2MessageTypeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2MessageTypeMetricTag) Unmarshal() unMarshalPatternFlowGtpv2MessageTypeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2MessageTypeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2MessageTypeMetricTag) ToProto() (*otg.PatternFlowGtpv2MessageTypeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2MessageTypeMetricTag) FromProto(msg *otg.PatternFlowGtpv2MessageTypeMetricTag) (PatternFlowGtpv2MessageTypeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2MessageTypeMetricTag) 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 *unMarshalpatternFlowGtpv2MessageTypeMetricTag) 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 *marshalpatternFlowGtpv2MessageTypeMetricTag) 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 *unMarshalpatternFlowGtpv2MessageTypeMetricTag) 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 *marshalpatternFlowGtpv2MessageTypeMetricTag) 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 *unMarshalpatternFlowGtpv2MessageTypeMetricTag) 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 *patternFlowGtpv2MessageTypeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2MessageTypeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2MessageTypeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2MessageTypeMetricTag) Clone() (PatternFlowGtpv2MessageTypeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2MessageTypeMetricTag() - 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 -} - -// PatternFlowGtpv2MessageTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv2MessageTypeMetricTag interface { - Validation - // msg marshals PatternFlowGtpv2MessageTypeMetricTag to protobuf object *otg.PatternFlowGtpv2MessageTypeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2MessageTypeMetricTag - // setMsg unmarshals PatternFlowGtpv2MessageTypeMetricTag from protobuf object *otg.PatternFlowGtpv2MessageTypeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv2MessageTypeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2MessageTypeMetricTag - // validate validates PatternFlowGtpv2MessageTypeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2MessageTypeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv2MessageTypeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv2MessageTypeMetricTag - SetName(value string) PatternFlowGtpv2MessageTypeMetricTag - // Offset returns uint32, set in PatternFlowGtpv2MessageTypeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv2MessageTypeMetricTag - SetOffset(value uint32) PatternFlowGtpv2MessageTypeMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv2MessageTypeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv2MessageTypeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv2MessageTypeMetricTag - SetLength(value uint32) PatternFlowGtpv2MessageTypeMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv2MessageTypeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv2MessageTypeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv2MessageTypeMetricTag object -func (obj *patternFlowGtpv2MessageTypeMetricTag) SetName(value string) PatternFlowGtpv2MessageTypeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2MessageTypeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2MessageTypeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv2MessageTypeMetricTag object -func (obj *patternFlowGtpv2MessageTypeMetricTag) SetOffset(value uint32) PatternFlowGtpv2MessageTypeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2MessageTypeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2MessageTypeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv2MessageTypeMetricTag object -func (obj *patternFlowGtpv2MessageTypeMetricTag) SetLength(value uint32) PatternFlowGtpv2MessageTypeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv2MessageTypeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2MessageTypeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2MessageTypeMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv2MessageTypeMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv2MessageTypeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowGtpv2MessageLengthCounter ***** -type patternFlowGtpv2MessageLengthCounter struct { - validation - obj *otg.PatternFlowGtpv2MessageLengthCounter - marshaller marshalPatternFlowGtpv2MessageLengthCounter - unMarshaller unMarshalPatternFlowGtpv2MessageLengthCounter -} - -func NewPatternFlowGtpv2MessageLengthCounter() PatternFlowGtpv2MessageLengthCounter { - obj := patternFlowGtpv2MessageLengthCounter{obj: &otg.PatternFlowGtpv2MessageLengthCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2MessageLengthCounter) msg() *otg.PatternFlowGtpv2MessageLengthCounter { - return obj.obj -} - -func (obj *patternFlowGtpv2MessageLengthCounter) setMsg(msg *otg.PatternFlowGtpv2MessageLengthCounter) PatternFlowGtpv2MessageLengthCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2MessageLengthCounter struct { - obj *patternFlowGtpv2MessageLengthCounter -} - -type marshalPatternFlowGtpv2MessageLengthCounter interface { - // ToProto marshals PatternFlowGtpv2MessageLengthCounter to protobuf object *otg.PatternFlowGtpv2MessageLengthCounter - ToProto() (*otg.PatternFlowGtpv2MessageLengthCounter, error) - // ToPbText marshals PatternFlowGtpv2MessageLengthCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2MessageLengthCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2MessageLengthCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2MessageLengthCounter struct { - obj *patternFlowGtpv2MessageLengthCounter -} - -type unMarshalPatternFlowGtpv2MessageLengthCounter interface { - // FromProto unmarshals PatternFlowGtpv2MessageLengthCounter from protobuf object *otg.PatternFlowGtpv2MessageLengthCounter - FromProto(msg *otg.PatternFlowGtpv2MessageLengthCounter) (PatternFlowGtpv2MessageLengthCounter, error) - // FromPbText unmarshals PatternFlowGtpv2MessageLengthCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2MessageLengthCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2MessageLengthCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2MessageLengthCounter) Marshal() marshalPatternFlowGtpv2MessageLengthCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2MessageLengthCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2MessageLengthCounter) Unmarshal() unMarshalPatternFlowGtpv2MessageLengthCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2MessageLengthCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2MessageLengthCounter) ToProto() (*otg.PatternFlowGtpv2MessageLengthCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2MessageLengthCounter) FromProto(msg *otg.PatternFlowGtpv2MessageLengthCounter) (PatternFlowGtpv2MessageLengthCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2MessageLengthCounter) 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 *unMarshalpatternFlowGtpv2MessageLengthCounter) 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 *marshalpatternFlowGtpv2MessageLengthCounter) 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 *unMarshalpatternFlowGtpv2MessageLengthCounter) 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 *marshalpatternFlowGtpv2MessageLengthCounter) 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 *unMarshalpatternFlowGtpv2MessageLengthCounter) 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 *patternFlowGtpv2MessageLengthCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2MessageLengthCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2MessageLengthCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2MessageLengthCounter) Clone() (PatternFlowGtpv2MessageLengthCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2MessageLengthCounter() - 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 -} - -// PatternFlowGtpv2MessageLengthCounter is integer counter pattern -type PatternFlowGtpv2MessageLengthCounter interface { - Validation - // msg marshals PatternFlowGtpv2MessageLengthCounter to protobuf object *otg.PatternFlowGtpv2MessageLengthCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2MessageLengthCounter - // setMsg unmarshals PatternFlowGtpv2MessageLengthCounter from protobuf object *otg.PatternFlowGtpv2MessageLengthCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2MessageLengthCounter) PatternFlowGtpv2MessageLengthCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv2MessageLengthCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2MessageLengthCounter - // validate validates PatternFlowGtpv2MessageLengthCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2MessageLengthCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv2MessageLengthCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv2MessageLengthCounter - SetStart(value uint32) PatternFlowGtpv2MessageLengthCounter - // HasStart checks if Start has been set in PatternFlowGtpv2MessageLengthCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv2MessageLengthCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv2MessageLengthCounter - SetStep(value uint32) PatternFlowGtpv2MessageLengthCounter - // HasStep checks if Step has been set in PatternFlowGtpv2MessageLengthCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv2MessageLengthCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv2MessageLengthCounter - SetCount(value uint32) PatternFlowGtpv2MessageLengthCounter - // HasCount checks if Count has been set in PatternFlowGtpv2MessageLengthCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2MessageLengthCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2MessageLengthCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv2MessageLengthCounter object -func (obj *patternFlowGtpv2MessageLengthCounter) SetStart(value uint32) PatternFlowGtpv2MessageLengthCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2MessageLengthCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2MessageLengthCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv2MessageLengthCounter object -func (obj *patternFlowGtpv2MessageLengthCounter) SetStep(value uint32) PatternFlowGtpv2MessageLengthCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2MessageLengthCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2MessageLengthCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv2MessageLengthCounter object -func (obj *patternFlowGtpv2MessageLengthCounter) SetCount(value uint32) PatternFlowGtpv2MessageLengthCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv2MessageLengthCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2MessageLengthCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2MessageLengthCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2MessageLengthCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv2MessageLengthCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv2MessageLengthMetricTag ***** -type patternFlowGtpv2MessageLengthMetricTag struct { - validation - obj *otg.PatternFlowGtpv2MessageLengthMetricTag - marshaller marshalPatternFlowGtpv2MessageLengthMetricTag - unMarshaller unMarshalPatternFlowGtpv2MessageLengthMetricTag -} - -func NewPatternFlowGtpv2MessageLengthMetricTag() PatternFlowGtpv2MessageLengthMetricTag { - obj := patternFlowGtpv2MessageLengthMetricTag{obj: &otg.PatternFlowGtpv2MessageLengthMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2MessageLengthMetricTag) msg() *otg.PatternFlowGtpv2MessageLengthMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv2MessageLengthMetricTag) setMsg(msg *otg.PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2MessageLengthMetricTag struct { - obj *patternFlowGtpv2MessageLengthMetricTag -} - -type marshalPatternFlowGtpv2MessageLengthMetricTag interface { - // ToProto marshals PatternFlowGtpv2MessageLengthMetricTag to protobuf object *otg.PatternFlowGtpv2MessageLengthMetricTag - ToProto() (*otg.PatternFlowGtpv2MessageLengthMetricTag, error) - // ToPbText marshals PatternFlowGtpv2MessageLengthMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2MessageLengthMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2MessageLengthMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2MessageLengthMetricTag struct { - obj *patternFlowGtpv2MessageLengthMetricTag -} - -type unMarshalPatternFlowGtpv2MessageLengthMetricTag interface { - // FromProto unmarshals PatternFlowGtpv2MessageLengthMetricTag from protobuf object *otg.PatternFlowGtpv2MessageLengthMetricTag - FromProto(msg *otg.PatternFlowGtpv2MessageLengthMetricTag) (PatternFlowGtpv2MessageLengthMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv2MessageLengthMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2MessageLengthMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2MessageLengthMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2MessageLengthMetricTag) Marshal() marshalPatternFlowGtpv2MessageLengthMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2MessageLengthMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2MessageLengthMetricTag) Unmarshal() unMarshalPatternFlowGtpv2MessageLengthMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2MessageLengthMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2MessageLengthMetricTag) ToProto() (*otg.PatternFlowGtpv2MessageLengthMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2MessageLengthMetricTag) FromProto(msg *otg.PatternFlowGtpv2MessageLengthMetricTag) (PatternFlowGtpv2MessageLengthMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2MessageLengthMetricTag) 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 *unMarshalpatternFlowGtpv2MessageLengthMetricTag) 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 *marshalpatternFlowGtpv2MessageLengthMetricTag) 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 *unMarshalpatternFlowGtpv2MessageLengthMetricTag) 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 *marshalpatternFlowGtpv2MessageLengthMetricTag) 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 *unMarshalpatternFlowGtpv2MessageLengthMetricTag) 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 *patternFlowGtpv2MessageLengthMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2MessageLengthMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2MessageLengthMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2MessageLengthMetricTag) Clone() (PatternFlowGtpv2MessageLengthMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2MessageLengthMetricTag() - 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 -} - -// PatternFlowGtpv2MessageLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv2MessageLengthMetricTag interface { - Validation - // msg marshals PatternFlowGtpv2MessageLengthMetricTag to protobuf object *otg.PatternFlowGtpv2MessageLengthMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2MessageLengthMetricTag - // setMsg unmarshals PatternFlowGtpv2MessageLengthMetricTag from protobuf object *otg.PatternFlowGtpv2MessageLengthMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv2MessageLengthMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2MessageLengthMetricTag - // validate validates PatternFlowGtpv2MessageLengthMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2MessageLengthMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv2MessageLengthMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv2MessageLengthMetricTag - SetName(value string) PatternFlowGtpv2MessageLengthMetricTag - // Offset returns uint32, set in PatternFlowGtpv2MessageLengthMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv2MessageLengthMetricTag - SetOffset(value uint32) PatternFlowGtpv2MessageLengthMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv2MessageLengthMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv2MessageLengthMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv2MessageLengthMetricTag - SetLength(value uint32) PatternFlowGtpv2MessageLengthMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv2MessageLengthMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv2MessageLengthMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv2MessageLengthMetricTag object -func (obj *patternFlowGtpv2MessageLengthMetricTag) SetName(value string) PatternFlowGtpv2MessageLengthMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2MessageLengthMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2MessageLengthMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv2MessageLengthMetricTag object -func (obj *patternFlowGtpv2MessageLengthMetricTag) SetOffset(value uint32) PatternFlowGtpv2MessageLengthMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2MessageLengthMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2MessageLengthMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv2MessageLengthMetricTag object -func (obj *patternFlowGtpv2MessageLengthMetricTag) SetLength(value uint32) PatternFlowGtpv2MessageLengthMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv2MessageLengthMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2MessageLengthMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2MessageLengthMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv2MessageLengthMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv2MessageLengthMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowGtpv2TeidCounter ***** -type patternFlowGtpv2TeidCounter struct { - validation - obj *otg.PatternFlowGtpv2TeidCounter - marshaller marshalPatternFlowGtpv2TeidCounter - unMarshaller unMarshalPatternFlowGtpv2TeidCounter -} - -func NewPatternFlowGtpv2TeidCounter() PatternFlowGtpv2TeidCounter { - obj := patternFlowGtpv2TeidCounter{obj: &otg.PatternFlowGtpv2TeidCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2TeidCounter) msg() *otg.PatternFlowGtpv2TeidCounter { - return obj.obj -} - -func (obj *patternFlowGtpv2TeidCounter) setMsg(msg *otg.PatternFlowGtpv2TeidCounter) PatternFlowGtpv2TeidCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2TeidCounter struct { - obj *patternFlowGtpv2TeidCounter -} - -type marshalPatternFlowGtpv2TeidCounter interface { - // ToProto marshals PatternFlowGtpv2TeidCounter to protobuf object *otg.PatternFlowGtpv2TeidCounter - ToProto() (*otg.PatternFlowGtpv2TeidCounter, error) - // ToPbText marshals PatternFlowGtpv2TeidCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2TeidCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2TeidCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2TeidCounter struct { - obj *patternFlowGtpv2TeidCounter -} - -type unMarshalPatternFlowGtpv2TeidCounter interface { - // FromProto unmarshals PatternFlowGtpv2TeidCounter from protobuf object *otg.PatternFlowGtpv2TeidCounter - FromProto(msg *otg.PatternFlowGtpv2TeidCounter) (PatternFlowGtpv2TeidCounter, error) - // FromPbText unmarshals PatternFlowGtpv2TeidCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2TeidCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2TeidCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2TeidCounter) Marshal() marshalPatternFlowGtpv2TeidCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2TeidCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2TeidCounter) Unmarshal() unMarshalPatternFlowGtpv2TeidCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2TeidCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2TeidCounter) ToProto() (*otg.PatternFlowGtpv2TeidCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2TeidCounter) FromProto(msg *otg.PatternFlowGtpv2TeidCounter) (PatternFlowGtpv2TeidCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2TeidCounter) 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 *unMarshalpatternFlowGtpv2TeidCounter) 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 *marshalpatternFlowGtpv2TeidCounter) 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 *unMarshalpatternFlowGtpv2TeidCounter) 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 *marshalpatternFlowGtpv2TeidCounter) 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 *unMarshalpatternFlowGtpv2TeidCounter) 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 *patternFlowGtpv2TeidCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2TeidCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2TeidCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2TeidCounter) Clone() (PatternFlowGtpv2TeidCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2TeidCounter() - 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 -} - -// PatternFlowGtpv2TeidCounter is integer counter pattern -type PatternFlowGtpv2TeidCounter interface { - Validation - // msg marshals PatternFlowGtpv2TeidCounter to protobuf object *otg.PatternFlowGtpv2TeidCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2TeidCounter - // setMsg unmarshals PatternFlowGtpv2TeidCounter from protobuf object *otg.PatternFlowGtpv2TeidCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2TeidCounter) PatternFlowGtpv2TeidCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv2TeidCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2TeidCounter - // validate validates PatternFlowGtpv2TeidCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2TeidCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv2TeidCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv2TeidCounter - SetStart(value uint32) PatternFlowGtpv2TeidCounter - // HasStart checks if Start has been set in PatternFlowGtpv2TeidCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv2TeidCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv2TeidCounter - SetStep(value uint32) PatternFlowGtpv2TeidCounter - // HasStep checks if Step has been set in PatternFlowGtpv2TeidCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv2TeidCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv2TeidCounter - SetCount(value uint32) PatternFlowGtpv2TeidCounter - // HasCount checks if Count has been set in PatternFlowGtpv2TeidCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2TeidCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2TeidCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv2TeidCounter object -func (obj *patternFlowGtpv2TeidCounter) SetStart(value uint32) PatternFlowGtpv2TeidCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2TeidCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2TeidCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv2TeidCounter object -func (obj *patternFlowGtpv2TeidCounter) SetStep(value uint32) PatternFlowGtpv2TeidCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2TeidCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2TeidCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv2TeidCounter object -func (obj *patternFlowGtpv2TeidCounter) SetCount(value uint32) PatternFlowGtpv2TeidCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv2TeidCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowGtpv2TeidCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv2TeidMetricTag ***** -type patternFlowGtpv2TeidMetricTag struct { - validation - obj *otg.PatternFlowGtpv2TeidMetricTag - marshaller marshalPatternFlowGtpv2TeidMetricTag - unMarshaller unMarshalPatternFlowGtpv2TeidMetricTag -} - -func NewPatternFlowGtpv2TeidMetricTag() PatternFlowGtpv2TeidMetricTag { - obj := patternFlowGtpv2TeidMetricTag{obj: &otg.PatternFlowGtpv2TeidMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2TeidMetricTag) msg() *otg.PatternFlowGtpv2TeidMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv2TeidMetricTag) setMsg(msg *otg.PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2TeidMetricTag struct { - obj *patternFlowGtpv2TeidMetricTag -} - -type marshalPatternFlowGtpv2TeidMetricTag interface { - // ToProto marshals PatternFlowGtpv2TeidMetricTag to protobuf object *otg.PatternFlowGtpv2TeidMetricTag - ToProto() (*otg.PatternFlowGtpv2TeidMetricTag, error) - // ToPbText marshals PatternFlowGtpv2TeidMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2TeidMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2TeidMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2TeidMetricTag struct { - obj *patternFlowGtpv2TeidMetricTag -} - -type unMarshalPatternFlowGtpv2TeidMetricTag interface { - // FromProto unmarshals PatternFlowGtpv2TeidMetricTag from protobuf object *otg.PatternFlowGtpv2TeidMetricTag - FromProto(msg *otg.PatternFlowGtpv2TeidMetricTag) (PatternFlowGtpv2TeidMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv2TeidMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2TeidMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2TeidMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2TeidMetricTag) Marshal() marshalPatternFlowGtpv2TeidMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2TeidMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2TeidMetricTag) Unmarshal() unMarshalPatternFlowGtpv2TeidMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2TeidMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2TeidMetricTag) ToProto() (*otg.PatternFlowGtpv2TeidMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2TeidMetricTag) FromProto(msg *otg.PatternFlowGtpv2TeidMetricTag) (PatternFlowGtpv2TeidMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2TeidMetricTag) 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 *unMarshalpatternFlowGtpv2TeidMetricTag) 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 *marshalpatternFlowGtpv2TeidMetricTag) 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 *unMarshalpatternFlowGtpv2TeidMetricTag) 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 *marshalpatternFlowGtpv2TeidMetricTag) 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 *unMarshalpatternFlowGtpv2TeidMetricTag) 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 *patternFlowGtpv2TeidMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2TeidMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2TeidMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2TeidMetricTag) Clone() (PatternFlowGtpv2TeidMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2TeidMetricTag() - 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 -} - -// PatternFlowGtpv2TeidMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv2TeidMetricTag interface { - Validation - // msg marshals PatternFlowGtpv2TeidMetricTag to protobuf object *otg.PatternFlowGtpv2TeidMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2TeidMetricTag - // setMsg unmarshals PatternFlowGtpv2TeidMetricTag from protobuf object *otg.PatternFlowGtpv2TeidMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv2TeidMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2TeidMetricTag - // validate validates PatternFlowGtpv2TeidMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2TeidMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv2TeidMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv2TeidMetricTag - SetName(value string) PatternFlowGtpv2TeidMetricTag - // Offset returns uint32, set in PatternFlowGtpv2TeidMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv2TeidMetricTag - SetOffset(value uint32) PatternFlowGtpv2TeidMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv2TeidMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv2TeidMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv2TeidMetricTag - SetLength(value uint32) PatternFlowGtpv2TeidMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv2TeidMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv2TeidMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv2TeidMetricTag object -func (obj *patternFlowGtpv2TeidMetricTag) SetName(value string) PatternFlowGtpv2TeidMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2TeidMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2TeidMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv2TeidMetricTag object -func (obj *patternFlowGtpv2TeidMetricTag) SetOffset(value uint32) PatternFlowGtpv2TeidMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2TeidMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2TeidMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv2TeidMetricTag object -func (obj *patternFlowGtpv2TeidMetricTag) SetLength(value uint32) PatternFlowGtpv2TeidMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv2TeidMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2TeidMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2TeidMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv2TeidMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv2TeidMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(32) - } - -} - -// ***** PatternFlowGtpv2SequenceNumberCounter ***** -type patternFlowGtpv2SequenceNumberCounter struct { - validation - obj *otg.PatternFlowGtpv2SequenceNumberCounter - marshaller marshalPatternFlowGtpv2SequenceNumberCounter - unMarshaller unMarshalPatternFlowGtpv2SequenceNumberCounter -} - -func NewPatternFlowGtpv2SequenceNumberCounter() PatternFlowGtpv2SequenceNumberCounter { - obj := patternFlowGtpv2SequenceNumberCounter{obj: &otg.PatternFlowGtpv2SequenceNumberCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2SequenceNumberCounter) msg() *otg.PatternFlowGtpv2SequenceNumberCounter { - return obj.obj -} - -func (obj *patternFlowGtpv2SequenceNumberCounter) setMsg(msg *otg.PatternFlowGtpv2SequenceNumberCounter) PatternFlowGtpv2SequenceNumberCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2SequenceNumberCounter struct { - obj *patternFlowGtpv2SequenceNumberCounter -} - -type marshalPatternFlowGtpv2SequenceNumberCounter interface { - // ToProto marshals PatternFlowGtpv2SequenceNumberCounter to protobuf object *otg.PatternFlowGtpv2SequenceNumberCounter - ToProto() (*otg.PatternFlowGtpv2SequenceNumberCounter, error) - // ToPbText marshals PatternFlowGtpv2SequenceNumberCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2SequenceNumberCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2SequenceNumberCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2SequenceNumberCounter struct { - obj *patternFlowGtpv2SequenceNumberCounter -} - -type unMarshalPatternFlowGtpv2SequenceNumberCounter interface { - // FromProto unmarshals PatternFlowGtpv2SequenceNumberCounter from protobuf object *otg.PatternFlowGtpv2SequenceNumberCounter - FromProto(msg *otg.PatternFlowGtpv2SequenceNumberCounter) (PatternFlowGtpv2SequenceNumberCounter, error) - // FromPbText unmarshals PatternFlowGtpv2SequenceNumberCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2SequenceNumberCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2SequenceNumberCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2SequenceNumberCounter) Marshal() marshalPatternFlowGtpv2SequenceNumberCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2SequenceNumberCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2SequenceNumberCounter) Unmarshal() unMarshalPatternFlowGtpv2SequenceNumberCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2SequenceNumberCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2SequenceNumberCounter) ToProto() (*otg.PatternFlowGtpv2SequenceNumberCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2SequenceNumberCounter) FromProto(msg *otg.PatternFlowGtpv2SequenceNumberCounter) (PatternFlowGtpv2SequenceNumberCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2SequenceNumberCounter) 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 *unMarshalpatternFlowGtpv2SequenceNumberCounter) 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 *marshalpatternFlowGtpv2SequenceNumberCounter) 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 *unMarshalpatternFlowGtpv2SequenceNumberCounter) 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 *marshalpatternFlowGtpv2SequenceNumberCounter) 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 *unMarshalpatternFlowGtpv2SequenceNumberCounter) 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 *patternFlowGtpv2SequenceNumberCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2SequenceNumberCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2SequenceNumberCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2SequenceNumberCounter) Clone() (PatternFlowGtpv2SequenceNumberCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2SequenceNumberCounter() - 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 -} - -// PatternFlowGtpv2SequenceNumberCounter is integer counter pattern -type PatternFlowGtpv2SequenceNumberCounter interface { - Validation - // msg marshals PatternFlowGtpv2SequenceNumberCounter to protobuf object *otg.PatternFlowGtpv2SequenceNumberCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2SequenceNumberCounter - // setMsg unmarshals PatternFlowGtpv2SequenceNumberCounter from protobuf object *otg.PatternFlowGtpv2SequenceNumberCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2SequenceNumberCounter) PatternFlowGtpv2SequenceNumberCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpv2SequenceNumberCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2SequenceNumberCounter - // validate validates PatternFlowGtpv2SequenceNumberCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2SequenceNumberCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv2SequenceNumberCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv2SequenceNumberCounter - SetStart(value uint32) PatternFlowGtpv2SequenceNumberCounter - // HasStart checks if Start has been set in PatternFlowGtpv2SequenceNumberCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv2SequenceNumberCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv2SequenceNumberCounter - SetStep(value uint32) PatternFlowGtpv2SequenceNumberCounter - // HasStep checks if Step has been set in PatternFlowGtpv2SequenceNumberCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv2SequenceNumberCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv2SequenceNumberCounter - SetCount(value uint32) PatternFlowGtpv2SequenceNumberCounter - // HasCount checks if Count has been set in PatternFlowGtpv2SequenceNumberCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2SequenceNumberCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2SequenceNumberCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv2SequenceNumberCounter object -func (obj *patternFlowGtpv2SequenceNumberCounter) SetStart(value uint32) PatternFlowGtpv2SequenceNumberCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2SequenceNumberCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2SequenceNumberCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv2SequenceNumberCounter object -func (obj *patternFlowGtpv2SequenceNumberCounter) SetStep(value uint32) PatternFlowGtpv2SequenceNumberCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2SequenceNumberCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2SequenceNumberCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv2SequenceNumberCounter object -func (obj *patternFlowGtpv2SequenceNumberCounter) SetCount(value uint32) PatternFlowGtpv2SequenceNumberCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv2SequenceNumberCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2SequenceNumberCounter.Start <= 16777215 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2SequenceNumberCounter.Step <= 16777215 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2SequenceNumberCounter.Count <= 16777215 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv2SequenceNumberCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv2SequenceNumberMetricTag ***** -type patternFlowGtpv2SequenceNumberMetricTag struct { - validation - obj *otg.PatternFlowGtpv2SequenceNumberMetricTag - marshaller marshalPatternFlowGtpv2SequenceNumberMetricTag - unMarshaller unMarshalPatternFlowGtpv2SequenceNumberMetricTag -} - -func NewPatternFlowGtpv2SequenceNumberMetricTag() PatternFlowGtpv2SequenceNumberMetricTag { - obj := patternFlowGtpv2SequenceNumberMetricTag{obj: &otg.PatternFlowGtpv2SequenceNumberMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2SequenceNumberMetricTag) msg() *otg.PatternFlowGtpv2SequenceNumberMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv2SequenceNumberMetricTag) setMsg(msg *otg.PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2SequenceNumberMetricTag struct { - obj *patternFlowGtpv2SequenceNumberMetricTag -} - -type marshalPatternFlowGtpv2SequenceNumberMetricTag interface { - // ToProto marshals PatternFlowGtpv2SequenceNumberMetricTag to protobuf object *otg.PatternFlowGtpv2SequenceNumberMetricTag - ToProto() (*otg.PatternFlowGtpv2SequenceNumberMetricTag, error) - // ToPbText marshals PatternFlowGtpv2SequenceNumberMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2SequenceNumberMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2SequenceNumberMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2SequenceNumberMetricTag struct { - obj *patternFlowGtpv2SequenceNumberMetricTag -} - -type unMarshalPatternFlowGtpv2SequenceNumberMetricTag interface { - // FromProto unmarshals PatternFlowGtpv2SequenceNumberMetricTag from protobuf object *otg.PatternFlowGtpv2SequenceNumberMetricTag - FromProto(msg *otg.PatternFlowGtpv2SequenceNumberMetricTag) (PatternFlowGtpv2SequenceNumberMetricTag, error) - // FromPbText unmarshals PatternFlowGtpv2SequenceNumberMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2SequenceNumberMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2SequenceNumberMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2SequenceNumberMetricTag) Marshal() marshalPatternFlowGtpv2SequenceNumberMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2SequenceNumberMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2SequenceNumberMetricTag) Unmarshal() unMarshalPatternFlowGtpv2SequenceNumberMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2SequenceNumberMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2SequenceNumberMetricTag) ToProto() (*otg.PatternFlowGtpv2SequenceNumberMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2SequenceNumberMetricTag) FromProto(msg *otg.PatternFlowGtpv2SequenceNumberMetricTag) (PatternFlowGtpv2SequenceNumberMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2SequenceNumberMetricTag) 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 *unMarshalpatternFlowGtpv2SequenceNumberMetricTag) 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 *marshalpatternFlowGtpv2SequenceNumberMetricTag) 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 *unMarshalpatternFlowGtpv2SequenceNumberMetricTag) 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 *marshalpatternFlowGtpv2SequenceNumberMetricTag) 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 *unMarshalpatternFlowGtpv2SequenceNumberMetricTag) 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 *patternFlowGtpv2SequenceNumberMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2SequenceNumberMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2SequenceNumberMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2SequenceNumberMetricTag) Clone() (PatternFlowGtpv2SequenceNumberMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2SequenceNumberMetricTag() - 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 -} - -// PatternFlowGtpv2SequenceNumberMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv2SequenceNumberMetricTag interface { - Validation - // msg marshals PatternFlowGtpv2SequenceNumberMetricTag to protobuf object *otg.PatternFlowGtpv2SequenceNumberMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2SequenceNumberMetricTag - // setMsg unmarshals PatternFlowGtpv2SequenceNumberMetricTag from protobuf object *otg.PatternFlowGtpv2SequenceNumberMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv2SequenceNumberMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2SequenceNumberMetricTag - // validate validates PatternFlowGtpv2SequenceNumberMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2SequenceNumberMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv2SequenceNumberMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv2SequenceNumberMetricTag - SetName(value string) PatternFlowGtpv2SequenceNumberMetricTag - // Offset returns uint32, set in PatternFlowGtpv2SequenceNumberMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv2SequenceNumberMetricTag - SetOffset(value uint32) PatternFlowGtpv2SequenceNumberMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv2SequenceNumberMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv2SequenceNumberMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv2SequenceNumberMetricTag - SetLength(value uint32) PatternFlowGtpv2SequenceNumberMetricTag - // HasLength checks if Length has been set in PatternFlowGtpv2SequenceNumberMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv2SequenceNumberMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv2SequenceNumberMetricTag object -func (obj *patternFlowGtpv2SequenceNumberMetricTag) SetName(value string) PatternFlowGtpv2SequenceNumberMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2SequenceNumberMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2SequenceNumberMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv2SequenceNumberMetricTag object -func (obj *patternFlowGtpv2SequenceNumberMetricTag) SetOffset(value uint32) PatternFlowGtpv2SequenceNumberMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2SequenceNumberMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2SequenceNumberMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv2SequenceNumberMetricTag object -func (obj *patternFlowGtpv2SequenceNumberMetricTag) SetLength(value uint32) PatternFlowGtpv2SequenceNumberMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv2SequenceNumberMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2SequenceNumberMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 23 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2SequenceNumberMetricTag.Offset <= 23 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 24 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv2SequenceNumberMetricTag.Length <= 24 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv2SequenceNumberMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(24) - } - -} - -// ***** PatternFlowGtpv2Spare2Counter ***** -type patternFlowGtpv2Spare2Counter struct { - validation - obj *otg.PatternFlowGtpv2Spare2Counter - marshaller marshalPatternFlowGtpv2Spare2Counter - unMarshaller unMarshalPatternFlowGtpv2Spare2Counter -} - -func NewPatternFlowGtpv2Spare2Counter() PatternFlowGtpv2Spare2Counter { - obj := patternFlowGtpv2Spare2Counter{obj: &otg.PatternFlowGtpv2Spare2Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2Spare2Counter) msg() *otg.PatternFlowGtpv2Spare2Counter { - return obj.obj -} - -func (obj *patternFlowGtpv2Spare2Counter) setMsg(msg *otg.PatternFlowGtpv2Spare2Counter) PatternFlowGtpv2Spare2Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2Spare2Counter struct { - obj *patternFlowGtpv2Spare2Counter -} - -type marshalPatternFlowGtpv2Spare2Counter interface { - // ToProto marshals PatternFlowGtpv2Spare2Counter to protobuf object *otg.PatternFlowGtpv2Spare2Counter - ToProto() (*otg.PatternFlowGtpv2Spare2Counter, error) - // ToPbText marshals PatternFlowGtpv2Spare2Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2Spare2Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2Spare2Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2Spare2Counter struct { - obj *patternFlowGtpv2Spare2Counter -} - -type unMarshalPatternFlowGtpv2Spare2Counter interface { - // FromProto unmarshals PatternFlowGtpv2Spare2Counter from protobuf object *otg.PatternFlowGtpv2Spare2Counter - FromProto(msg *otg.PatternFlowGtpv2Spare2Counter) (PatternFlowGtpv2Spare2Counter, error) - // FromPbText unmarshals PatternFlowGtpv2Spare2Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2Spare2Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2Spare2Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2Spare2Counter) Marshal() marshalPatternFlowGtpv2Spare2Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2Spare2Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2Spare2Counter) Unmarshal() unMarshalPatternFlowGtpv2Spare2Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2Spare2Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2Spare2Counter) ToProto() (*otg.PatternFlowGtpv2Spare2Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2Spare2Counter) FromProto(msg *otg.PatternFlowGtpv2Spare2Counter) (PatternFlowGtpv2Spare2Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2Spare2Counter) 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 *unMarshalpatternFlowGtpv2Spare2Counter) 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 *marshalpatternFlowGtpv2Spare2Counter) 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 *unMarshalpatternFlowGtpv2Spare2Counter) 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 *marshalpatternFlowGtpv2Spare2Counter) 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 *unMarshalpatternFlowGtpv2Spare2Counter) 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 *patternFlowGtpv2Spare2Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Spare2Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Spare2Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2Spare2Counter) Clone() (PatternFlowGtpv2Spare2Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2Spare2Counter() - 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 -} - -// PatternFlowGtpv2Spare2Counter is integer counter pattern -type PatternFlowGtpv2Spare2Counter interface { - Validation - // msg marshals PatternFlowGtpv2Spare2Counter to protobuf object *otg.PatternFlowGtpv2Spare2Counter - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2Spare2Counter - // setMsg unmarshals PatternFlowGtpv2Spare2Counter from protobuf object *otg.PatternFlowGtpv2Spare2Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2Spare2Counter) PatternFlowGtpv2Spare2Counter - // provides marshal interface - Marshal() marshalPatternFlowGtpv2Spare2Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2Spare2Counter - // validate validates PatternFlowGtpv2Spare2Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2Spare2Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpv2Spare2Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpv2Spare2Counter - SetStart(value uint32) PatternFlowGtpv2Spare2Counter - // HasStart checks if Start has been set in PatternFlowGtpv2Spare2Counter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpv2Spare2Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpv2Spare2Counter - SetStep(value uint32) PatternFlowGtpv2Spare2Counter - // HasStep checks if Step has been set in PatternFlowGtpv2Spare2Counter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpv2Spare2Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpv2Spare2Counter - SetCount(value uint32) PatternFlowGtpv2Spare2Counter - // HasCount checks if Count has been set in PatternFlowGtpv2Spare2Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2Spare2Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpv2Spare2Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpv2Spare2Counter object -func (obj *patternFlowGtpv2Spare2Counter) SetStart(value uint32) PatternFlowGtpv2Spare2Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2Spare2Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpv2Spare2Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpv2Spare2Counter object -func (obj *patternFlowGtpv2Spare2Counter) SetStep(value uint32) PatternFlowGtpv2Spare2Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2Spare2Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpv2Spare2Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpv2Spare2Counter object -func (obj *patternFlowGtpv2Spare2Counter) SetCount(value uint32) PatternFlowGtpv2Spare2Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpv2Spare2Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2Spare2Counter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2Spare2Counter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2Spare2Counter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpv2Spare2Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpv2Spare2MetricTag ***** -type patternFlowGtpv2Spare2MetricTag struct { - validation - obj *otg.PatternFlowGtpv2Spare2MetricTag - marshaller marshalPatternFlowGtpv2Spare2MetricTag - unMarshaller unMarshalPatternFlowGtpv2Spare2MetricTag -} - -func NewPatternFlowGtpv2Spare2MetricTag() PatternFlowGtpv2Spare2MetricTag { - obj := patternFlowGtpv2Spare2MetricTag{obj: &otg.PatternFlowGtpv2Spare2MetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpv2Spare2MetricTag) msg() *otg.PatternFlowGtpv2Spare2MetricTag { - return obj.obj -} - -func (obj *patternFlowGtpv2Spare2MetricTag) setMsg(msg *otg.PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2MetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpv2Spare2MetricTag struct { - obj *patternFlowGtpv2Spare2MetricTag -} - -type marshalPatternFlowGtpv2Spare2MetricTag interface { - // ToProto marshals PatternFlowGtpv2Spare2MetricTag to protobuf object *otg.PatternFlowGtpv2Spare2MetricTag - ToProto() (*otg.PatternFlowGtpv2Spare2MetricTag, error) - // ToPbText marshals PatternFlowGtpv2Spare2MetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpv2Spare2MetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpv2Spare2MetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpv2Spare2MetricTag struct { - obj *patternFlowGtpv2Spare2MetricTag -} - -type unMarshalPatternFlowGtpv2Spare2MetricTag interface { - // FromProto unmarshals PatternFlowGtpv2Spare2MetricTag from protobuf object *otg.PatternFlowGtpv2Spare2MetricTag - FromProto(msg *otg.PatternFlowGtpv2Spare2MetricTag) (PatternFlowGtpv2Spare2MetricTag, error) - // FromPbText unmarshals PatternFlowGtpv2Spare2MetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpv2Spare2MetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpv2Spare2MetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpv2Spare2MetricTag) Marshal() marshalPatternFlowGtpv2Spare2MetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpv2Spare2MetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpv2Spare2MetricTag) Unmarshal() unMarshalPatternFlowGtpv2Spare2MetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpv2Spare2MetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpv2Spare2MetricTag) ToProto() (*otg.PatternFlowGtpv2Spare2MetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpv2Spare2MetricTag) FromProto(msg *otg.PatternFlowGtpv2Spare2MetricTag) (PatternFlowGtpv2Spare2MetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpv2Spare2MetricTag) 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 *unMarshalpatternFlowGtpv2Spare2MetricTag) 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 *marshalpatternFlowGtpv2Spare2MetricTag) 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 *unMarshalpatternFlowGtpv2Spare2MetricTag) 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 *marshalpatternFlowGtpv2Spare2MetricTag) 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 *unMarshalpatternFlowGtpv2Spare2MetricTag) 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 *patternFlowGtpv2Spare2MetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Spare2MetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpv2Spare2MetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpv2Spare2MetricTag) Clone() (PatternFlowGtpv2Spare2MetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpv2Spare2MetricTag() - 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 -} - -// PatternFlowGtpv2Spare2MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpv2Spare2MetricTag interface { - Validation - // msg marshals PatternFlowGtpv2Spare2MetricTag to protobuf object *otg.PatternFlowGtpv2Spare2MetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpv2Spare2MetricTag - // setMsg unmarshals PatternFlowGtpv2Spare2MetricTag from protobuf object *otg.PatternFlowGtpv2Spare2MetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2MetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpv2Spare2MetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpv2Spare2MetricTag - // validate validates PatternFlowGtpv2Spare2MetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpv2Spare2MetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpv2Spare2MetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpv2Spare2MetricTag - SetName(value string) PatternFlowGtpv2Spare2MetricTag - // Offset returns uint32, set in PatternFlowGtpv2Spare2MetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpv2Spare2MetricTag - SetOffset(value uint32) PatternFlowGtpv2Spare2MetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpv2Spare2MetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpv2Spare2MetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpv2Spare2MetricTag - SetLength(value uint32) PatternFlowGtpv2Spare2MetricTag - // HasLength checks if Length has been set in PatternFlowGtpv2Spare2MetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpv2Spare2MetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpv2Spare2MetricTag object -func (obj *patternFlowGtpv2Spare2MetricTag) SetName(value string) PatternFlowGtpv2Spare2MetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2Spare2MetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpv2Spare2MetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpv2Spare2MetricTag object -func (obj *patternFlowGtpv2Spare2MetricTag) SetOffset(value uint32) PatternFlowGtpv2Spare2MetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2Spare2MetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpv2Spare2MetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpv2Spare2MetricTag object -func (obj *patternFlowGtpv2Spare2MetricTag) SetLength(value uint32) PatternFlowGtpv2Spare2MetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpv2Spare2MetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2Spare2MetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpv2Spare2MetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpv2Spare2MetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpv2Spare2MetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowArpHardwareTypeCounter ***** -type patternFlowArpHardwareTypeCounter struct { - validation - obj *otg.PatternFlowArpHardwareTypeCounter - marshaller marshalPatternFlowArpHardwareTypeCounter - unMarshaller unMarshalPatternFlowArpHardwareTypeCounter -} - -func NewPatternFlowArpHardwareTypeCounter() PatternFlowArpHardwareTypeCounter { - obj := patternFlowArpHardwareTypeCounter{obj: &otg.PatternFlowArpHardwareTypeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpHardwareTypeCounter) msg() *otg.PatternFlowArpHardwareTypeCounter { - return obj.obj -} - -func (obj *patternFlowArpHardwareTypeCounter) setMsg(msg *otg.PatternFlowArpHardwareTypeCounter) PatternFlowArpHardwareTypeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpHardwareTypeCounter struct { - obj *patternFlowArpHardwareTypeCounter -} - -type marshalPatternFlowArpHardwareTypeCounter interface { - // ToProto marshals PatternFlowArpHardwareTypeCounter to protobuf object *otg.PatternFlowArpHardwareTypeCounter - ToProto() (*otg.PatternFlowArpHardwareTypeCounter, error) - // ToPbText marshals PatternFlowArpHardwareTypeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpHardwareTypeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpHardwareTypeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpHardwareTypeCounter struct { - obj *patternFlowArpHardwareTypeCounter -} - -type unMarshalPatternFlowArpHardwareTypeCounter interface { - // FromProto unmarshals PatternFlowArpHardwareTypeCounter from protobuf object *otg.PatternFlowArpHardwareTypeCounter - FromProto(msg *otg.PatternFlowArpHardwareTypeCounter) (PatternFlowArpHardwareTypeCounter, error) - // FromPbText unmarshals PatternFlowArpHardwareTypeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpHardwareTypeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpHardwareTypeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpHardwareTypeCounter) Marshal() marshalPatternFlowArpHardwareTypeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpHardwareTypeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpHardwareTypeCounter) Unmarshal() unMarshalPatternFlowArpHardwareTypeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpHardwareTypeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpHardwareTypeCounter) ToProto() (*otg.PatternFlowArpHardwareTypeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpHardwareTypeCounter) FromProto(msg *otg.PatternFlowArpHardwareTypeCounter) (PatternFlowArpHardwareTypeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpHardwareTypeCounter) 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 *unMarshalpatternFlowArpHardwareTypeCounter) 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 *marshalpatternFlowArpHardwareTypeCounter) 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 *unMarshalpatternFlowArpHardwareTypeCounter) 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 *marshalpatternFlowArpHardwareTypeCounter) 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 *unMarshalpatternFlowArpHardwareTypeCounter) 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 *patternFlowArpHardwareTypeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpHardwareTypeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpHardwareTypeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpHardwareTypeCounter) Clone() (PatternFlowArpHardwareTypeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpHardwareTypeCounter() - 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 -} - -// PatternFlowArpHardwareTypeCounter is integer counter pattern -type PatternFlowArpHardwareTypeCounter interface { - Validation - // msg marshals PatternFlowArpHardwareTypeCounter to protobuf object *otg.PatternFlowArpHardwareTypeCounter - // and doesn't set defaults - msg() *otg.PatternFlowArpHardwareTypeCounter - // setMsg unmarshals PatternFlowArpHardwareTypeCounter from protobuf object *otg.PatternFlowArpHardwareTypeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowArpHardwareTypeCounter) PatternFlowArpHardwareTypeCounter - // provides marshal interface - Marshal() marshalPatternFlowArpHardwareTypeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpHardwareTypeCounter - // validate validates PatternFlowArpHardwareTypeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpHardwareTypeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowArpHardwareTypeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowArpHardwareTypeCounter - SetStart(value uint32) PatternFlowArpHardwareTypeCounter - // HasStart checks if Start has been set in PatternFlowArpHardwareTypeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowArpHardwareTypeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowArpHardwareTypeCounter - SetStep(value uint32) PatternFlowArpHardwareTypeCounter - // HasStep checks if Step has been set in PatternFlowArpHardwareTypeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowArpHardwareTypeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowArpHardwareTypeCounter - SetCount(value uint32) PatternFlowArpHardwareTypeCounter - // HasCount checks if Count has been set in PatternFlowArpHardwareTypeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowArpHardwareTypeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowArpHardwareTypeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowArpHardwareTypeCounter object -func (obj *patternFlowArpHardwareTypeCounter) SetStart(value uint32) PatternFlowArpHardwareTypeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowArpHardwareTypeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowArpHardwareTypeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowArpHardwareTypeCounter object -func (obj *patternFlowArpHardwareTypeCounter) SetStep(value uint32) PatternFlowArpHardwareTypeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpHardwareTypeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpHardwareTypeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowArpHardwareTypeCounter object -func (obj *patternFlowArpHardwareTypeCounter) SetCount(value uint32) PatternFlowArpHardwareTypeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowArpHardwareTypeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpHardwareTypeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpHardwareTypeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpHardwareTypeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowArpHardwareTypeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowArpHardwareTypeMetricTag ***** -type patternFlowArpHardwareTypeMetricTag struct { - validation - obj *otg.PatternFlowArpHardwareTypeMetricTag - marshaller marshalPatternFlowArpHardwareTypeMetricTag - unMarshaller unMarshalPatternFlowArpHardwareTypeMetricTag -} - -func NewPatternFlowArpHardwareTypeMetricTag() PatternFlowArpHardwareTypeMetricTag { - obj := patternFlowArpHardwareTypeMetricTag{obj: &otg.PatternFlowArpHardwareTypeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpHardwareTypeMetricTag) msg() *otg.PatternFlowArpHardwareTypeMetricTag { - return obj.obj -} - -func (obj *patternFlowArpHardwareTypeMetricTag) setMsg(msg *otg.PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpHardwareTypeMetricTag struct { - obj *patternFlowArpHardwareTypeMetricTag -} - -type marshalPatternFlowArpHardwareTypeMetricTag interface { - // ToProto marshals PatternFlowArpHardwareTypeMetricTag to protobuf object *otg.PatternFlowArpHardwareTypeMetricTag - ToProto() (*otg.PatternFlowArpHardwareTypeMetricTag, error) - // ToPbText marshals PatternFlowArpHardwareTypeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpHardwareTypeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpHardwareTypeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpHardwareTypeMetricTag struct { - obj *patternFlowArpHardwareTypeMetricTag -} - -type unMarshalPatternFlowArpHardwareTypeMetricTag interface { - // FromProto unmarshals PatternFlowArpHardwareTypeMetricTag from protobuf object *otg.PatternFlowArpHardwareTypeMetricTag - FromProto(msg *otg.PatternFlowArpHardwareTypeMetricTag) (PatternFlowArpHardwareTypeMetricTag, error) - // FromPbText unmarshals PatternFlowArpHardwareTypeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpHardwareTypeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpHardwareTypeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpHardwareTypeMetricTag) Marshal() marshalPatternFlowArpHardwareTypeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpHardwareTypeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpHardwareTypeMetricTag) Unmarshal() unMarshalPatternFlowArpHardwareTypeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpHardwareTypeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpHardwareTypeMetricTag) ToProto() (*otg.PatternFlowArpHardwareTypeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpHardwareTypeMetricTag) FromProto(msg *otg.PatternFlowArpHardwareTypeMetricTag) (PatternFlowArpHardwareTypeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpHardwareTypeMetricTag) 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 *unMarshalpatternFlowArpHardwareTypeMetricTag) 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 *marshalpatternFlowArpHardwareTypeMetricTag) 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 *unMarshalpatternFlowArpHardwareTypeMetricTag) 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 *marshalpatternFlowArpHardwareTypeMetricTag) 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 *unMarshalpatternFlowArpHardwareTypeMetricTag) 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 *patternFlowArpHardwareTypeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpHardwareTypeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpHardwareTypeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpHardwareTypeMetricTag) Clone() (PatternFlowArpHardwareTypeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpHardwareTypeMetricTag() - 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 -} - -// PatternFlowArpHardwareTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowArpHardwareTypeMetricTag interface { - Validation - // msg marshals PatternFlowArpHardwareTypeMetricTag to protobuf object *otg.PatternFlowArpHardwareTypeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowArpHardwareTypeMetricTag - // setMsg unmarshals PatternFlowArpHardwareTypeMetricTag from protobuf object *otg.PatternFlowArpHardwareTypeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowArpHardwareTypeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpHardwareTypeMetricTag - // validate validates PatternFlowArpHardwareTypeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpHardwareTypeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowArpHardwareTypeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowArpHardwareTypeMetricTag - SetName(value string) PatternFlowArpHardwareTypeMetricTag - // Offset returns uint32, set in PatternFlowArpHardwareTypeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowArpHardwareTypeMetricTag - SetOffset(value uint32) PatternFlowArpHardwareTypeMetricTag - // HasOffset checks if Offset has been set in PatternFlowArpHardwareTypeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowArpHardwareTypeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowArpHardwareTypeMetricTag - SetLength(value uint32) PatternFlowArpHardwareTypeMetricTag - // HasLength checks if Length has been set in PatternFlowArpHardwareTypeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowArpHardwareTypeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowArpHardwareTypeMetricTag object -func (obj *patternFlowArpHardwareTypeMetricTag) SetName(value string) PatternFlowArpHardwareTypeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpHardwareTypeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpHardwareTypeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowArpHardwareTypeMetricTag object -func (obj *patternFlowArpHardwareTypeMetricTag) SetOffset(value uint32) PatternFlowArpHardwareTypeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpHardwareTypeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpHardwareTypeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowArpHardwareTypeMetricTag object -func (obj *patternFlowArpHardwareTypeMetricTag) SetLength(value uint32) PatternFlowArpHardwareTypeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowArpHardwareTypeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpHardwareTypeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpHardwareTypeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowArpHardwareTypeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowArpHardwareTypeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowArpProtocolTypeCounter ***** -type patternFlowArpProtocolTypeCounter struct { - validation - obj *otg.PatternFlowArpProtocolTypeCounter - marshaller marshalPatternFlowArpProtocolTypeCounter - unMarshaller unMarshalPatternFlowArpProtocolTypeCounter -} - -func NewPatternFlowArpProtocolTypeCounter() PatternFlowArpProtocolTypeCounter { - obj := patternFlowArpProtocolTypeCounter{obj: &otg.PatternFlowArpProtocolTypeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpProtocolTypeCounter) msg() *otg.PatternFlowArpProtocolTypeCounter { - return obj.obj -} - -func (obj *patternFlowArpProtocolTypeCounter) setMsg(msg *otg.PatternFlowArpProtocolTypeCounter) PatternFlowArpProtocolTypeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpProtocolTypeCounter struct { - obj *patternFlowArpProtocolTypeCounter -} - -type marshalPatternFlowArpProtocolTypeCounter interface { - // ToProto marshals PatternFlowArpProtocolTypeCounter to protobuf object *otg.PatternFlowArpProtocolTypeCounter - ToProto() (*otg.PatternFlowArpProtocolTypeCounter, error) - // ToPbText marshals PatternFlowArpProtocolTypeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpProtocolTypeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpProtocolTypeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpProtocolTypeCounter struct { - obj *patternFlowArpProtocolTypeCounter -} - -type unMarshalPatternFlowArpProtocolTypeCounter interface { - // FromProto unmarshals PatternFlowArpProtocolTypeCounter from protobuf object *otg.PatternFlowArpProtocolTypeCounter - FromProto(msg *otg.PatternFlowArpProtocolTypeCounter) (PatternFlowArpProtocolTypeCounter, error) - // FromPbText unmarshals PatternFlowArpProtocolTypeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpProtocolTypeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpProtocolTypeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpProtocolTypeCounter) Marshal() marshalPatternFlowArpProtocolTypeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpProtocolTypeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpProtocolTypeCounter) Unmarshal() unMarshalPatternFlowArpProtocolTypeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpProtocolTypeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpProtocolTypeCounter) ToProto() (*otg.PatternFlowArpProtocolTypeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpProtocolTypeCounter) FromProto(msg *otg.PatternFlowArpProtocolTypeCounter) (PatternFlowArpProtocolTypeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpProtocolTypeCounter) 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 *unMarshalpatternFlowArpProtocolTypeCounter) 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 *marshalpatternFlowArpProtocolTypeCounter) 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 *unMarshalpatternFlowArpProtocolTypeCounter) 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 *marshalpatternFlowArpProtocolTypeCounter) 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 *unMarshalpatternFlowArpProtocolTypeCounter) 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 *patternFlowArpProtocolTypeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpProtocolTypeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpProtocolTypeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpProtocolTypeCounter) Clone() (PatternFlowArpProtocolTypeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpProtocolTypeCounter() - 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 -} - -// PatternFlowArpProtocolTypeCounter is integer counter pattern -type PatternFlowArpProtocolTypeCounter interface { - Validation - // msg marshals PatternFlowArpProtocolTypeCounter to protobuf object *otg.PatternFlowArpProtocolTypeCounter - // and doesn't set defaults - msg() *otg.PatternFlowArpProtocolTypeCounter - // setMsg unmarshals PatternFlowArpProtocolTypeCounter from protobuf object *otg.PatternFlowArpProtocolTypeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowArpProtocolTypeCounter) PatternFlowArpProtocolTypeCounter - // provides marshal interface - Marshal() marshalPatternFlowArpProtocolTypeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpProtocolTypeCounter - // validate validates PatternFlowArpProtocolTypeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpProtocolTypeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowArpProtocolTypeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowArpProtocolTypeCounter - SetStart(value uint32) PatternFlowArpProtocolTypeCounter - // HasStart checks if Start has been set in PatternFlowArpProtocolTypeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowArpProtocolTypeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowArpProtocolTypeCounter - SetStep(value uint32) PatternFlowArpProtocolTypeCounter - // HasStep checks if Step has been set in PatternFlowArpProtocolTypeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowArpProtocolTypeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowArpProtocolTypeCounter - SetCount(value uint32) PatternFlowArpProtocolTypeCounter - // HasCount checks if Count has been set in PatternFlowArpProtocolTypeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowArpProtocolTypeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowArpProtocolTypeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowArpProtocolTypeCounter object -func (obj *patternFlowArpProtocolTypeCounter) SetStart(value uint32) PatternFlowArpProtocolTypeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowArpProtocolTypeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowArpProtocolTypeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowArpProtocolTypeCounter object -func (obj *patternFlowArpProtocolTypeCounter) SetStep(value uint32) PatternFlowArpProtocolTypeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpProtocolTypeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpProtocolTypeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowArpProtocolTypeCounter object -func (obj *patternFlowArpProtocolTypeCounter) SetCount(value uint32) PatternFlowArpProtocolTypeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowArpProtocolTypeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpProtocolTypeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpProtocolTypeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpProtocolTypeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowArpProtocolTypeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(2048) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowArpProtocolTypeMetricTag ***** -type patternFlowArpProtocolTypeMetricTag struct { - validation - obj *otg.PatternFlowArpProtocolTypeMetricTag - marshaller marshalPatternFlowArpProtocolTypeMetricTag - unMarshaller unMarshalPatternFlowArpProtocolTypeMetricTag -} - -func NewPatternFlowArpProtocolTypeMetricTag() PatternFlowArpProtocolTypeMetricTag { - obj := patternFlowArpProtocolTypeMetricTag{obj: &otg.PatternFlowArpProtocolTypeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpProtocolTypeMetricTag) msg() *otg.PatternFlowArpProtocolTypeMetricTag { - return obj.obj -} - -func (obj *patternFlowArpProtocolTypeMetricTag) setMsg(msg *otg.PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpProtocolTypeMetricTag struct { - obj *patternFlowArpProtocolTypeMetricTag -} - -type marshalPatternFlowArpProtocolTypeMetricTag interface { - // ToProto marshals PatternFlowArpProtocolTypeMetricTag to protobuf object *otg.PatternFlowArpProtocolTypeMetricTag - ToProto() (*otg.PatternFlowArpProtocolTypeMetricTag, error) - // ToPbText marshals PatternFlowArpProtocolTypeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpProtocolTypeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpProtocolTypeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpProtocolTypeMetricTag struct { - obj *patternFlowArpProtocolTypeMetricTag -} - -type unMarshalPatternFlowArpProtocolTypeMetricTag interface { - // FromProto unmarshals PatternFlowArpProtocolTypeMetricTag from protobuf object *otg.PatternFlowArpProtocolTypeMetricTag - FromProto(msg *otg.PatternFlowArpProtocolTypeMetricTag) (PatternFlowArpProtocolTypeMetricTag, error) - // FromPbText unmarshals PatternFlowArpProtocolTypeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpProtocolTypeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpProtocolTypeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpProtocolTypeMetricTag) Marshal() marshalPatternFlowArpProtocolTypeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpProtocolTypeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpProtocolTypeMetricTag) Unmarshal() unMarshalPatternFlowArpProtocolTypeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpProtocolTypeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpProtocolTypeMetricTag) ToProto() (*otg.PatternFlowArpProtocolTypeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpProtocolTypeMetricTag) FromProto(msg *otg.PatternFlowArpProtocolTypeMetricTag) (PatternFlowArpProtocolTypeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpProtocolTypeMetricTag) 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 *unMarshalpatternFlowArpProtocolTypeMetricTag) 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 *marshalpatternFlowArpProtocolTypeMetricTag) 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 *unMarshalpatternFlowArpProtocolTypeMetricTag) 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 *marshalpatternFlowArpProtocolTypeMetricTag) 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 *unMarshalpatternFlowArpProtocolTypeMetricTag) 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 *patternFlowArpProtocolTypeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpProtocolTypeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpProtocolTypeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpProtocolTypeMetricTag) Clone() (PatternFlowArpProtocolTypeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpProtocolTypeMetricTag() - 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 -} - -// PatternFlowArpProtocolTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowArpProtocolTypeMetricTag interface { - Validation - // msg marshals PatternFlowArpProtocolTypeMetricTag to protobuf object *otg.PatternFlowArpProtocolTypeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowArpProtocolTypeMetricTag - // setMsg unmarshals PatternFlowArpProtocolTypeMetricTag from protobuf object *otg.PatternFlowArpProtocolTypeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowArpProtocolTypeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpProtocolTypeMetricTag - // validate validates PatternFlowArpProtocolTypeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpProtocolTypeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowArpProtocolTypeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowArpProtocolTypeMetricTag - SetName(value string) PatternFlowArpProtocolTypeMetricTag - // Offset returns uint32, set in PatternFlowArpProtocolTypeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowArpProtocolTypeMetricTag - SetOffset(value uint32) PatternFlowArpProtocolTypeMetricTag - // HasOffset checks if Offset has been set in PatternFlowArpProtocolTypeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowArpProtocolTypeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowArpProtocolTypeMetricTag - SetLength(value uint32) PatternFlowArpProtocolTypeMetricTag - // HasLength checks if Length has been set in PatternFlowArpProtocolTypeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowArpProtocolTypeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowArpProtocolTypeMetricTag object -func (obj *patternFlowArpProtocolTypeMetricTag) SetName(value string) PatternFlowArpProtocolTypeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpProtocolTypeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpProtocolTypeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowArpProtocolTypeMetricTag object -func (obj *patternFlowArpProtocolTypeMetricTag) SetOffset(value uint32) PatternFlowArpProtocolTypeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpProtocolTypeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpProtocolTypeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowArpProtocolTypeMetricTag object -func (obj *patternFlowArpProtocolTypeMetricTag) SetLength(value uint32) PatternFlowArpProtocolTypeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowArpProtocolTypeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpProtocolTypeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpProtocolTypeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowArpProtocolTypeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowArpProtocolTypeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowArpHardwareLengthCounter ***** -type patternFlowArpHardwareLengthCounter struct { - validation - obj *otg.PatternFlowArpHardwareLengthCounter - marshaller marshalPatternFlowArpHardwareLengthCounter - unMarshaller unMarshalPatternFlowArpHardwareLengthCounter -} - -func NewPatternFlowArpHardwareLengthCounter() PatternFlowArpHardwareLengthCounter { - obj := patternFlowArpHardwareLengthCounter{obj: &otg.PatternFlowArpHardwareLengthCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpHardwareLengthCounter) msg() *otg.PatternFlowArpHardwareLengthCounter { - return obj.obj -} - -func (obj *patternFlowArpHardwareLengthCounter) setMsg(msg *otg.PatternFlowArpHardwareLengthCounter) PatternFlowArpHardwareLengthCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpHardwareLengthCounter struct { - obj *patternFlowArpHardwareLengthCounter -} - -type marshalPatternFlowArpHardwareLengthCounter interface { - // ToProto marshals PatternFlowArpHardwareLengthCounter to protobuf object *otg.PatternFlowArpHardwareLengthCounter - ToProto() (*otg.PatternFlowArpHardwareLengthCounter, error) - // ToPbText marshals PatternFlowArpHardwareLengthCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpHardwareLengthCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpHardwareLengthCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpHardwareLengthCounter struct { - obj *patternFlowArpHardwareLengthCounter -} - -type unMarshalPatternFlowArpHardwareLengthCounter interface { - // FromProto unmarshals PatternFlowArpHardwareLengthCounter from protobuf object *otg.PatternFlowArpHardwareLengthCounter - FromProto(msg *otg.PatternFlowArpHardwareLengthCounter) (PatternFlowArpHardwareLengthCounter, error) - // FromPbText unmarshals PatternFlowArpHardwareLengthCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpHardwareLengthCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpHardwareLengthCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpHardwareLengthCounter) Marshal() marshalPatternFlowArpHardwareLengthCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpHardwareLengthCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpHardwareLengthCounter) Unmarshal() unMarshalPatternFlowArpHardwareLengthCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpHardwareLengthCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpHardwareLengthCounter) ToProto() (*otg.PatternFlowArpHardwareLengthCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpHardwareLengthCounter) FromProto(msg *otg.PatternFlowArpHardwareLengthCounter) (PatternFlowArpHardwareLengthCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpHardwareLengthCounter) 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 *unMarshalpatternFlowArpHardwareLengthCounter) 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 *marshalpatternFlowArpHardwareLengthCounter) 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 *unMarshalpatternFlowArpHardwareLengthCounter) 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 *marshalpatternFlowArpHardwareLengthCounter) 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 *unMarshalpatternFlowArpHardwareLengthCounter) 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 *patternFlowArpHardwareLengthCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpHardwareLengthCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpHardwareLengthCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpHardwareLengthCounter) Clone() (PatternFlowArpHardwareLengthCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpHardwareLengthCounter() - 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 -} - -// PatternFlowArpHardwareLengthCounter is integer counter pattern -type PatternFlowArpHardwareLengthCounter interface { - Validation - // msg marshals PatternFlowArpHardwareLengthCounter to protobuf object *otg.PatternFlowArpHardwareLengthCounter - // and doesn't set defaults - msg() *otg.PatternFlowArpHardwareLengthCounter - // setMsg unmarshals PatternFlowArpHardwareLengthCounter from protobuf object *otg.PatternFlowArpHardwareLengthCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowArpHardwareLengthCounter) PatternFlowArpHardwareLengthCounter - // provides marshal interface - Marshal() marshalPatternFlowArpHardwareLengthCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpHardwareLengthCounter - // validate validates PatternFlowArpHardwareLengthCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpHardwareLengthCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowArpHardwareLengthCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowArpHardwareLengthCounter - SetStart(value uint32) PatternFlowArpHardwareLengthCounter - // HasStart checks if Start has been set in PatternFlowArpHardwareLengthCounter - HasStart() bool - // Step returns uint32, set in PatternFlowArpHardwareLengthCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowArpHardwareLengthCounter - SetStep(value uint32) PatternFlowArpHardwareLengthCounter - // HasStep checks if Step has been set in PatternFlowArpHardwareLengthCounter - HasStep() bool - // Count returns uint32, set in PatternFlowArpHardwareLengthCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowArpHardwareLengthCounter - SetCount(value uint32) PatternFlowArpHardwareLengthCounter - // HasCount checks if Count has been set in PatternFlowArpHardwareLengthCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowArpHardwareLengthCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowArpHardwareLengthCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowArpHardwareLengthCounter object -func (obj *patternFlowArpHardwareLengthCounter) SetStart(value uint32) PatternFlowArpHardwareLengthCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowArpHardwareLengthCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowArpHardwareLengthCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowArpHardwareLengthCounter object -func (obj *patternFlowArpHardwareLengthCounter) SetStep(value uint32) PatternFlowArpHardwareLengthCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpHardwareLengthCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpHardwareLengthCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowArpHardwareLengthCounter object -func (obj *patternFlowArpHardwareLengthCounter) SetCount(value uint32) PatternFlowArpHardwareLengthCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowArpHardwareLengthCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpHardwareLengthCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpHardwareLengthCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpHardwareLengthCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowArpHardwareLengthCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(6) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowArpHardwareLengthMetricTag ***** -type patternFlowArpHardwareLengthMetricTag struct { - validation - obj *otg.PatternFlowArpHardwareLengthMetricTag - marshaller marshalPatternFlowArpHardwareLengthMetricTag - unMarshaller unMarshalPatternFlowArpHardwareLengthMetricTag -} - -func NewPatternFlowArpHardwareLengthMetricTag() PatternFlowArpHardwareLengthMetricTag { - obj := patternFlowArpHardwareLengthMetricTag{obj: &otg.PatternFlowArpHardwareLengthMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpHardwareLengthMetricTag) msg() *otg.PatternFlowArpHardwareLengthMetricTag { - return obj.obj -} - -func (obj *patternFlowArpHardwareLengthMetricTag) setMsg(msg *otg.PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpHardwareLengthMetricTag struct { - obj *patternFlowArpHardwareLengthMetricTag -} - -type marshalPatternFlowArpHardwareLengthMetricTag interface { - // ToProto marshals PatternFlowArpHardwareLengthMetricTag to protobuf object *otg.PatternFlowArpHardwareLengthMetricTag - ToProto() (*otg.PatternFlowArpHardwareLengthMetricTag, error) - // ToPbText marshals PatternFlowArpHardwareLengthMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpHardwareLengthMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpHardwareLengthMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpHardwareLengthMetricTag struct { - obj *patternFlowArpHardwareLengthMetricTag -} - -type unMarshalPatternFlowArpHardwareLengthMetricTag interface { - // FromProto unmarshals PatternFlowArpHardwareLengthMetricTag from protobuf object *otg.PatternFlowArpHardwareLengthMetricTag - FromProto(msg *otg.PatternFlowArpHardwareLengthMetricTag) (PatternFlowArpHardwareLengthMetricTag, error) - // FromPbText unmarshals PatternFlowArpHardwareLengthMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpHardwareLengthMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpHardwareLengthMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpHardwareLengthMetricTag) Marshal() marshalPatternFlowArpHardwareLengthMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpHardwareLengthMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpHardwareLengthMetricTag) Unmarshal() unMarshalPatternFlowArpHardwareLengthMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpHardwareLengthMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpHardwareLengthMetricTag) ToProto() (*otg.PatternFlowArpHardwareLengthMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpHardwareLengthMetricTag) FromProto(msg *otg.PatternFlowArpHardwareLengthMetricTag) (PatternFlowArpHardwareLengthMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpHardwareLengthMetricTag) 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 *unMarshalpatternFlowArpHardwareLengthMetricTag) 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 *marshalpatternFlowArpHardwareLengthMetricTag) 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 *unMarshalpatternFlowArpHardwareLengthMetricTag) 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 *marshalpatternFlowArpHardwareLengthMetricTag) 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 *unMarshalpatternFlowArpHardwareLengthMetricTag) 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 *patternFlowArpHardwareLengthMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpHardwareLengthMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpHardwareLengthMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpHardwareLengthMetricTag) Clone() (PatternFlowArpHardwareLengthMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpHardwareLengthMetricTag() - 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 -} - -// PatternFlowArpHardwareLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowArpHardwareLengthMetricTag interface { - Validation - // msg marshals PatternFlowArpHardwareLengthMetricTag to protobuf object *otg.PatternFlowArpHardwareLengthMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowArpHardwareLengthMetricTag - // setMsg unmarshals PatternFlowArpHardwareLengthMetricTag from protobuf object *otg.PatternFlowArpHardwareLengthMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthMetricTag - // provides marshal interface - Marshal() marshalPatternFlowArpHardwareLengthMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpHardwareLengthMetricTag - // validate validates PatternFlowArpHardwareLengthMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpHardwareLengthMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowArpHardwareLengthMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowArpHardwareLengthMetricTag - SetName(value string) PatternFlowArpHardwareLengthMetricTag - // Offset returns uint32, set in PatternFlowArpHardwareLengthMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowArpHardwareLengthMetricTag - SetOffset(value uint32) PatternFlowArpHardwareLengthMetricTag - // HasOffset checks if Offset has been set in PatternFlowArpHardwareLengthMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowArpHardwareLengthMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowArpHardwareLengthMetricTag - SetLength(value uint32) PatternFlowArpHardwareLengthMetricTag - // HasLength checks if Length has been set in PatternFlowArpHardwareLengthMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowArpHardwareLengthMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowArpHardwareLengthMetricTag object -func (obj *patternFlowArpHardwareLengthMetricTag) SetName(value string) PatternFlowArpHardwareLengthMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpHardwareLengthMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpHardwareLengthMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowArpHardwareLengthMetricTag object -func (obj *patternFlowArpHardwareLengthMetricTag) SetOffset(value uint32) PatternFlowArpHardwareLengthMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpHardwareLengthMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpHardwareLengthMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowArpHardwareLengthMetricTag object -func (obj *patternFlowArpHardwareLengthMetricTag) SetLength(value uint32) PatternFlowArpHardwareLengthMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowArpHardwareLengthMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpHardwareLengthMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpHardwareLengthMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowArpHardwareLengthMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowArpHardwareLengthMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowArpProtocolLengthCounter ***** -type patternFlowArpProtocolLengthCounter struct { - validation - obj *otg.PatternFlowArpProtocolLengthCounter - marshaller marshalPatternFlowArpProtocolLengthCounter - unMarshaller unMarshalPatternFlowArpProtocolLengthCounter -} - -func NewPatternFlowArpProtocolLengthCounter() PatternFlowArpProtocolLengthCounter { - obj := patternFlowArpProtocolLengthCounter{obj: &otg.PatternFlowArpProtocolLengthCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpProtocolLengthCounter) msg() *otg.PatternFlowArpProtocolLengthCounter { - return obj.obj -} - -func (obj *patternFlowArpProtocolLengthCounter) setMsg(msg *otg.PatternFlowArpProtocolLengthCounter) PatternFlowArpProtocolLengthCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpProtocolLengthCounter struct { - obj *patternFlowArpProtocolLengthCounter -} - -type marshalPatternFlowArpProtocolLengthCounter interface { - // ToProto marshals PatternFlowArpProtocolLengthCounter to protobuf object *otg.PatternFlowArpProtocolLengthCounter - ToProto() (*otg.PatternFlowArpProtocolLengthCounter, error) - // ToPbText marshals PatternFlowArpProtocolLengthCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpProtocolLengthCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpProtocolLengthCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpProtocolLengthCounter struct { - obj *patternFlowArpProtocolLengthCounter -} - -type unMarshalPatternFlowArpProtocolLengthCounter interface { - // FromProto unmarshals PatternFlowArpProtocolLengthCounter from protobuf object *otg.PatternFlowArpProtocolLengthCounter - FromProto(msg *otg.PatternFlowArpProtocolLengthCounter) (PatternFlowArpProtocolLengthCounter, error) - // FromPbText unmarshals PatternFlowArpProtocolLengthCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpProtocolLengthCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpProtocolLengthCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpProtocolLengthCounter) Marshal() marshalPatternFlowArpProtocolLengthCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpProtocolLengthCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpProtocolLengthCounter) Unmarshal() unMarshalPatternFlowArpProtocolLengthCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpProtocolLengthCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpProtocolLengthCounter) ToProto() (*otg.PatternFlowArpProtocolLengthCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpProtocolLengthCounter) FromProto(msg *otg.PatternFlowArpProtocolLengthCounter) (PatternFlowArpProtocolLengthCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpProtocolLengthCounter) 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 *unMarshalpatternFlowArpProtocolLengthCounter) 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 *marshalpatternFlowArpProtocolLengthCounter) 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 *unMarshalpatternFlowArpProtocolLengthCounter) 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 *marshalpatternFlowArpProtocolLengthCounter) 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 *unMarshalpatternFlowArpProtocolLengthCounter) 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 *patternFlowArpProtocolLengthCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpProtocolLengthCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpProtocolLengthCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpProtocolLengthCounter) Clone() (PatternFlowArpProtocolLengthCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpProtocolLengthCounter() - 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 -} - -// PatternFlowArpProtocolLengthCounter is integer counter pattern -type PatternFlowArpProtocolLengthCounter interface { - Validation - // msg marshals PatternFlowArpProtocolLengthCounter to protobuf object *otg.PatternFlowArpProtocolLengthCounter - // and doesn't set defaults - msg() *otg.PatternFlowArpProtocolLengthCounter - // setMsg unmarshals PatternFlowArpProtocolLengthCounter from protobuf object *otg.PatternFlowArpProtocolLengthCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowArpProtocolLengthCounter) PatternFlowArpProtocolLengthCounter - // provides marshal interface - Marshal() marshalPatternFlowArpProtocolLengthCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpProtocolLengthCounter - // validate validates PatternFlowArpProtocolLengthCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpProtocolLengthCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowArpProtocolLengthCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowArpProtocolLengthCounter - SetStart(value uint32) PatternFlowArpProtocolLengthCounter - // HasStart checks if Start has been set in PatternFlowArpProtocolLengthCounter - HasStart() bool - // Step returns uint32, set in PatternFlowArpProtocolLengthCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowArpProtocolLengthCounter - SetStep(value uint32) PatternFlowArpProtocolLengthCounter - // HasStep checks if Step has been set in PatternFlowArpProtocolLengthCounter - HasStep() bool - // Count returns uint32, set in PatternFlowArpProtocolLengthCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowArpProtocolLengthCounter - SetCount(value uint32) PatternFlowArpProtocolLengthCounter - // HasCount checks if Count has been set in PatternFlowArpProtocolLengthCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowArpProtocolLengthCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowArpProtocolLengthCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowArpProtocolLengthCounter object -func (obj *patternFlowArpProtocolLengthCounter) SetStart(value uint32) PatternFlowArpProtocolLengthCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowArpProtocolLengthCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowArpProtocolLengthCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowArpProtocolLengthCounter object -func (obj *patternFlowArpProtocolLengthCounter) SetStep(value uint32) PatternFlowArpProtocolLengthCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpProtocolLengthCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpProtocolLengthCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowArpProtocolLengthCounter object -func (obj *patternFlowArpProtocolLengthCounter) SetCount(value uint32) PatternFlowArpProtocolLengthCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowArpProtocolLengthCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpProtocolLengthCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpProtocolLengthCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpProtocolLengthCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowArpProtocolLengthCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(4) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowArpProtocolLengthMetricTag ***** -type patternFlowArpProtocolLengthMetricTag struct { - validation - obj *otg.PatternFlowArpProtocolLengthMetricTag - marshaller marshalPatternFlowArpProtocolLengthMetricTag - unMarshaller unMarshalPatternFlowArpProtocolLengthMetricTag -} - -func NewPatternFlowArpProtocolLengthMetricTag() PatternFlowArpProtocolLengthMetricTag { - obj := patternFlowArpProtocolLengthMetricTag{obj: &otg.PatternFlowArpProtocolLengthMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpProtocolLengthMetricTag) msg() *otg.PatternFlowArpProtocolLengthMetricTag { - return obj.obj -} - -func (obj *patternFlowArpProtocolLengthMetricTag) setMsg(msg *otg.PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpProtocolLengthMetricTag struct { - obj *patternFlowArpProtocolLengthMetricTag -} - -type marshalPatternFlowArpProtocolLengthMetricTag interface { - // ToProto marshals PatternFlowArpProtocolLengthMetricTag to protobuf object *otg.PatternFlowArpProtocolLengthMetricTag - ToProto() (*otg.PatternFlowArpProtocolLengthMetricTag, error) - // ToPbText marshals PatternFlowArpProtocolLengthMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpProtocolLengthMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpProtocolLengthMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpProtocolLengthMetricTag struct { - obj *patternFlowArpProtocolLengthMetricTag -} - -type unMarshalPatternFlowArpProtocolLengthMetricTag interface { - // FromProto unmarshals PatternFlowArpProtocolLengthMetricTag from protobuf object *otg.PatternFlowArpProtocolLengthMetricTag - FromProto(msg *otg.PatternFlowArpProtocolLengthMetricTag) (PatternFlowArpProtocolLengthMetricTag, error) - // FromPbText unmarshals PatternFlowArpProtocolLengthMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpProtocolLengthMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpProtocolLengthMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpProtocolLengthMetricTag) Marshal() marshalPatternFlowArpProtocolLengthMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpProtocolLengthMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpProtocolLengthMetricTag) Unmarshal() unMarshalPatternFlowArpProtocolLengthMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpProtocolLengthMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpProtocolLengthMetricTag) ToProto() (*otg.PatternFlowArpProtocolLengthMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpProtocolLengthMetricTag) FromProto(msg *otg.PatternFlowArpProtocolLengthMetricTag) (PatternFlowArpProtocolLengthMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpProtocolLengthMetricTag) 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 *unMarshalpatternFlowArpProtocolLengthMetricTag) 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 *marshalpatternFlowArpProtocolLengthMetricTag) 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 *unMarshalpatternFlowArpProtocolLengthMetricTag) 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 *marshalpatternFlowArpProtocolLengthMetricTag) 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 *unMarshalpatternFlowArpProtocolLengthMetricTag) 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 *patternFlowArpProtocolLengthMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpProtocolLengthMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpProtocolLengthMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpProtocolLengthMetricTag) Clone() (PatternFlowArpProtocolLengthMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpProtocolLengthMetricTag() - 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 -} - -// PatternFlowArpProtocolLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowArpProtocolLengthMetricTag interface { - Validation - // msg marshals PatternFlowArpProtocolLengthMetricTag to protobuf object *otg.PatternFlowArpProtocolLengthMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowArpProtocolLengthMetricTag - // setMsg unmarshals PatternFlowArpProtocolLengthMetricTag from protobuf object *otg.PatternFlowArpProtocolLengthMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthMetricTag - // provides marshal interface - Marshal() marshalPatternFlowArpProtocolLengthMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpProtocolLengthMetricTag - // validate validates PatternFlowArpProtocolLengthMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpProtocolLengthMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowArpProtocolLengthMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowArpProtocolLengthMetricTag - SetName(value string) PatternFlowArpProtocolLengthMetricTag - // Offset returns uint32, set in PatternFlowArpProtocolLengthMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowArpProtocolLengthMetricTag - SetOffset(value uint32) PatternFlowArpProtocolLengthMetricTag - // HasOffset checks if Offset has been set in PatternFlowArpProtocolLengthMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowArpProtocolLengthMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowArpProtocolLengthMetricTag - SetLength(value uint32) PatternFlowArpProtocolLengthMetricTag - // HasLength checks if Length has been set in PatternFlowArpProtocolLengthMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowArpProtocolLengthMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowArpProtocolLengthMetricTag object -func (obj *patternFlowArpProtocolLengthMetricTag) SetName(value string) PatternFlowArpProtocolLengthMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpProtocolLengthMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpProtocolLengthMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowArpProtocolLengthMetricTag object -func (obj *patternFlowArpProtocolLengthMetricTag) SetOffset(value uint32) PatternFlowArpProtocolLengthMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpProtocolLengthMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpProtocolLengthMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowArpProtocolLengthMetricTag object -func (obj *patternFlowArpProtocolLengthMetricTag) SetLength(value uint32) PatternFlowArpProtocolLengthMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowArpProtocolLengthMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpProtocolLengthMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpProtocolLengthMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowArpProtocolLengthMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowArpProtocolLengthMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowArpOperationCounter ***** -type patternFlowArpOperationCounter struct { - validation - obj *otg.PatternFlowArpOperationCounter - marshaller marshalPatternFlowArpOperationCounter - unMarshaller unMarshalPatternFlowArpOperationCounter -} - -func NewPatternFlowArpOperationCounter() PatternFlowArpOperationCounter { - obj := patternFlowArpOperationCounter{obj: &otg.PatternFlowArpOperationCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpOperationCounter) msg() *otg.PatternFlowArpOperationCounter { - return obj.obj -} - -func (obj *patternFlowArpOperationCounter) setMsg(msg *otg.PatternFlowArpOperationCounter) PatternFlowArpOperationCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpOperationCounter struct { - obj *patternFlowArpOperationCounter -} - -type marshalPatternFlowArpOperationCounter interface { - // ToProto marshals PatternFlowArpOperationCounter to protobuf object *otg.PatternFlowArpOperationCounter - ToProto() (*otg.PatternFlowArpOperationCounter, error) - // ToPbText marshals PatternFlowArpOperationCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpOperationCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpOperationCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpOperationCounter struct { - obj *patternFlowArpOperationCounter -} - -type unMarshalPatternFlowArpOperationCounter interface { - // FromProto unmarshals PatternFlowArpOperationCounter from protobuf object *otg.PatternFlowArpOperationCounter - FromProto(msg *otg.PatternFlowArpOperationCounter) (PatternFlowArpOperationCounter, error) - // FromPbText unmarshals PatternFlowArpOperationCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpOperationCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpOperationCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpOperationCounter) Marshal() marshalPatternFlowArpOperationCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpOperationCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpOperationCounter) Unmarshal() unMarshalPatternFlowArpOperationCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpOperationCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpOperationCounter) ToProto() (*otg.PatternFlowArpOperationCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpOperationCounter) FromProto(msg *otg.PatternFlowArpOperationCounter) (PatternFlowArpOperationCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpOperationCounter) 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 *unMarshalpatternFlowArpOperationCounter) 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 *marshalpatternFlowArpOperationCounter) 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 *unMarshalpatternFlowArpOperationCounter) 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 *marshalpatternFlowArpOperationCounter) 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 *unMarshalpatternFlowArpOperationCounter) 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 *patternFlowArpOperationCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpOperationCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpOperationCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpOperationCounter) Clone() (PatternFlowArpOperationCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpOperationCounter() - 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 -} - -// PatternFlowArpOperationCounter is integer counter pattern -type PatternFlowArpOperationCounter interface { - Validation - // msg marshals PatternFlowArpOperationCounter to protobuf object *otg.PatternFlowArpOperationCounter - // and doesn't set defaults - msg() *otg.PatternFlowArpOperationCounter - // setMsg unmarshals PatternFlowArpOperationCounter from protobuf object *otg.PatternFlowArpOperationCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowArpOperationCounter) PatternFlowArpOperationCounter - // provides marshal interface - Marshal() marshalPatternFlowArpOperationCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpOperationCounter - // validate validates PatternFlowArpOperationCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpOperationCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowArpOperationCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowArpOperationCounter - SetStart(value uint32) PatternFlowArpOperationCounter - // HasStart checks if Start has been set in PatternFlowArpOperationCounter - HasStart() bool - // Step returns uint32, set in PatternFlowArpOperationCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowArpOperationCounter - SetStep(value uint32) PatternFlowArpOperationCounter - // HasStep checks if Step has been set in PatternFlowArpOperationCounter - HasStep() bool - // Count returns uint32, set in PatternFlowArpOperationCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowArpOperationCounter - SetCount(value uint32) PatternFlowArpOperationCounter - // HasCount checks if Count has been set in PatternFlowArpOperationCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowArpOperationCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowArpOperationCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowArpOperationCounter object -func (obj *patternFlowArpOperationCounter) SetStart(value uint32) PatternFlowArpOperationCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowArpOperationCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowArpOperationCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowArpOperationCounter object -func (obj *patternFlowArpOperationCounter) SetStep(value uint32) PatternFlowArpOperationCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpOperationCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpOperationCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowArpOperationCounter object -func (obj *patternFlowArpOperationCounter) SetCount(value uint32) PatternFlowArpOperationCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowArpOperationCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpOperationCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpOperationCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpOperationCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowArpOperationCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowArpOperationMetricTag ***** -type patternFlowArpOperationMetricTag struct { - validation - obj *otg.PatternFlowArpOperationMetricTag - marshaller marshalPatternFlowArpOperationMetricTag - unMarshaller unMarshalPatternFlowArpOperationMetricTag -} - -func NewPatternFlowArpOperationMetricTag() PatternFlowArpOperationMetricTag { - obj := patternFlowArpOperationMetricTag{obj: &otg.PatternFlowArpOperationMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpOperationMetricTag) msg() *otg.PatternFlowArpOperationMetricTag { - return obj.obj -} - -func (obj *patternFlowArpOperationMetricTag) setMsg(msg *otg.PatternFlowArpOperationMetricTag) PatternFlowArpOperationMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpOperationMetricTag struct { - obj *patternFlowArpOperationMetricTag -} - -type marshalPatternFlowArpOperationMetricTag interface { - // ToProto marshals PatternFlowArpOperationMetricTag to protobuf object *otg.PatternFlowArpOperationMetricTag - ToProto() (*otg.PatternFlowArpOperationMetricTag, error) - // ToPbText marshals PatternFlowArpOperationMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpOperationMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpOperationMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpOperationMetricTag struct { - obj *patternFlowArpOperationMetricTag -} - -type unMarshalPatternFlowArpOperationMetricTag interface { - // FromProto unmarshals PatternFlowArpOperationMetricTag from protobuf object *otg.PatternFlowArpOperationMetricTag - FromProto(msg *otg.PatternFlowArpOperationMetricTag) (PatternFlowArpOperationMetricTag, error) - // FromPbText unmarshals PatternFlowArpOperationMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpOperationMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpOperationMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpOperationMetricTag) Marshal() marshalPatternFlowArpOperationMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpOperationMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpOperationMetricTag) Unmarshal() unMarshalPatternFlowArpOperationMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpOperationMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpOperationMetricTag) ToProto() (*otg.PatternFlowArpOperationMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpOperationMetricTag) FromProto(msg *otg.PatternFlowArpOperationMetricTag) (PatternFlowArpOperationMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpOperationMetricTag) 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 *unMarshalpatternFlowArpOperationMetricTag) 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 *marshalpatternFlowArpOperationMetricTag) 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 *unMarshalpatternFlowArpOperationMetricTag) 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 *marshalpatternFlowArpOperationMetricTag) 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 *unMarshalpatternFlowArpOperationMetricTag) 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 *patternFlowArpOperationMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpOperationMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpOperationMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpOperationMetricTag) Clone() (PatternFlowArpOperationMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpOperationMetricTag() - 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 -} - -// PatternFlowArpOperationMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowArpOperationMetricTag interface { - Validation - // msg marshals PatternFlowArpOperationMetricTag to protobuf object *otg.PatternFlowArpOperationMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowArpOperationMetricTag - // setMsg unmarshals PatternFlowArpOperationMetricTag from protobuf object *otg.PatternFlowArpOperationMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowArpOperationMetricTag) PatternFlowArpOperationMetricTag - // provides marshal interface - Marshal() marshalPatternFlowArpOperationMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpOperationMetricTag - // validate validates PatternFlowArpOperationMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpOperationMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowArpOperationMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowArpOperationMetricTag - SetName(value string) PatternFlowArpOperationMetricTag - // Offset returns uint32, set in PatternFlowArpOperationMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowArpOperationMetricTag - SetOffset(value uint32) PatternFlowArpOperationMetricTag - // HasOffset checks if Offset has been set in PatternFlowArpOperationMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowArpOperationMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowArpOperationMetricTag - SetLength(value uint32) PatternFlowArpOperationMetricTag - // HasLength checks if Length has been set in PatternFlowArpOperationMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowArpOperationMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowArpOperationMetricTag object -func (obj *patternFlowArpOperationMetricTag) SetName(value string) PatternFlowArpOperationMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpOperationMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpOperationMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowArpOperationMetricTag object -func (obj *patternFlowArpOperationMetricTag) SetOffset(value uint32) PatternFlowArpOperationMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpOperationMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpOperationMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowArpOperationMetricTag object -func (obj *patternFlowArpOperationMetricTag) SetLength(value uint32) PatternFlowArpOperationMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowArpOperationMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpOperationMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpOperationMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowArpOperationMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowArpOperationMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowArpSenderHardwareAddrCounter ***** -type patternFlowArpSenderHardwareAddrCounter struct { - validation - obj *otg.PatternFlowArpSenderHardwareAddrCounter - marshaller marshalPatternFlowArpSenderHardwareAddrCounter - unMarshaller unMarshalPatternFlowArpSenderHardwareAddrCounter -} - -func NewPatternFlowArpSenderHardwareAddrCounter() PatternFlowArpSenderHardwareAddrCounter { - obj := patternFlowArpSenderHardwareAddrCounter{obj: &otg.PatternFlowArpSenderHardwareAddrCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpSenderHardwareAddrCounter) msg() *otg.PatternFlowArpSenderHardwareAddrCounter { - return obj.obj -} - -func (obj *patternFlowArpSenderHardwareAddrCounter) setMsg(msg *otg.PatternFlowArpSenderHardwareAddrCounter) PatternFlowArpSenderHardwareAddrCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpSenderHardwareAddrCounter struct { - obj *patternFlowArpSenderHardwareAddrCounter -} - -type marshalPatternFlowArpSenderHardwareAddrCounter interface { - // ToProto marshals PatternFlowArpSenderHardwareAddrCounter to protobuf object *otg.PatternFlowArpSenderHardwareAddrCounter - ToProto() (*otg.PatternFlowArpSenderHardwareAddrCounter, error) - // ToPbText marshals PatternFlowArpSenderHardwareAddrCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpSenderHardwareAddrCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpSenderHardwareAddrCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpSenderHardwareAddrCounter struct { - obj *patternFlowArpSenderHardwareAddrCounter -} - -type unMarshalPatternFlowArpSenderHardwareAddrCounter interface { - // FromProto unmarshals PatternFlowArpSenderHardwareAddrCounter from protobuf object *otg.PatternFlowArpSenderHardwareAddrCounter - FromProto(msg *otg.PatternFlowArpSenderHardwareAddrCounter) (PatternFlowArpSenderHardwareAddrCounter, error) - // FromPbText unmarshals PatternFlowArpSenderHardwareAddrCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpSenderHardwareAddrCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpSenderHardwareAddrCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpSenderHardwareAddrCounter) Marshal() marshalPatternFlowArpSenderHardwareAddrCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpSenderHardwareAddrCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpSenderHardwareAddrCounter) Unmarshal() unMarshalPatternFlowArpSenderHardwareAddrCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpSenderHardwareAddrCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpSenderHardwareAddrCounter) ToProto() (*otg.PatternFlowArpSenderHardwareAddrCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpSenderHardwareAddrCounter) FromProto(msg *otg.PatternFlowArpSenderHardwareAddrCounter) (PatternFlowArpSenderHardwareAddrCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpSenderHardwareAddrCounter) 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 *unMarshalpatternFlowArpSenderHardwareAddrCounter) 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 *marshalpatternFlowArpSenderHardwareAddrCounter) 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 *unMarshalpatternFlowArpSenderHardwareAddrCounter) 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 *marshalpatternFlowArpSenderHardwareAddrCounter) 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 *unMarshalpatternFlowArpSenderHardwareAddrCounter) 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 *patternFlowArpSenderHardwareAddrCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpSenderHardwareAddrCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpSenderHardwareAddrCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpSenderHardwareAddrCounter) Clone() (PatternFlowArpSenderHardwareAddrCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpSenderHardwareAddrCounter() - 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 -} - -// PatternFlowArpSenderHardwareAddrCounter is mac counter pattern -type PatternFlowArpSenderHardwareAddrCounter interface { - Validation - // msg marshals PatternFlowArpSenderHardwareAddrCounter to protobuf object *otg.PatternFlowArpSenderHardwareAddrCounter - // and doesn't set defaults - msg() *otg.PatternFlowArpSenderHardwareAddrCounter - // setMsg unmarshals PatternFlowArpSenderHardwareAddrCounter from protobuf object *otg.PatternFlowArpSenderHardwareAddrCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowArpSenderHardwareAddrCounter) PatternFlowArpSenderHardwareAddrCounter - // provides marshal interface - Marshal() marshalPatternFlowArpSenderHardwareAddrCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpSenderHardwareAddrCounter - // validate validates PatternFlowArpSenderHardwareAddrCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpSenderHardwareAddrCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowArpSenderHardwareAddrCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowArpSenderHardwareAddrCounter - SetStart(value string) PatternFlowArpSenderHardwareAddrCounter - // HasStart checks if Start has been set in PatternFlowArpSenderHardwareAddrCounter - HasStart() bool - // Step returns string, set in PatternFlowArpSenderHardwareAddrCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowArpSenderHardwareAddrCounter - SetStep(value string) PatternFlowArpSenderHardwareAddrCounter - // HasStep checks if Step has been set in PatternFlowArpSenderHardwareAddrCounter - HasStep() bool - // Count returns uint32, set in PatternFlowArpSenderHardwareAddrCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowArpSenderHardwareAddrCounter - SetCount(value uint32) PatternFlowArpSenderHardwareAddrCounter - // HasCount checks if Count has been set in PatternFlowArpSenderHardwareAddrCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowArpSenderHardwareAddrCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowArpSenderHardwareAddrCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowArpSenderHardwareAddrCounter object -func (obj *patternFlowArpSenderHardwareAddrCounter) SetStart(value string) PatternFlowArpSenderHardwareAddrCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowArpSenderHardwareAddrCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowArpSenderHardwareAddrCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowArpSenderHardwareAddrCounter object -func (obj *patternFlowArpSenderHardwareAddrCounter) SetStep(value string) PatternFlowArpSenderHardwareAddrCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpSenderHardwareAddrCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpSenderHardwareAddrCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowArpSenderHardwareAddrCounter object -func (obj *patternFlowArpSenderHardwareAddrCounter) SetCount(value uint32) PatternFlowArpSenderHardwareAddrCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowArpSenderHardwareAddrCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateMac(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderHardwareAddrCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateMac(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderHardwareAddrCounter.Step")) - } - - } - -} - -func (obj *patternFlowArpSenderHardwareAddrCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("00:00:00:00:00:00") - } - if obj.obj.Step == nil { - obj.SetStep("00:00:00:00:00:01") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowArpSenderHardwareAddrMetricTag ***** -type patternFlowArpSenderHardwareAddrMetricTag struct { - validation - obj *otg.PatternFlowArpSenderHardwareAddrMetricTag - marshaller marshalPatternFlowArpSenderHardwareAddrMetricTag - unMarshaller unMarshalPatternFlowArpSenderHardwareAddrMetricTag -} - -func NewPatternFlowArpSenderHardwareAddrMetricTag() PatternFlowArpSenderHardwareAddrMetricTag { - obj := patternFlowArpSenderHardwareAddrMetricTag{obj: &otg.PatternFlowArpSenderHardwareAddrMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpSenderHardwareAddrMetricTag) msg() *otg.PatternFlowArpSenderHardwareAddrMetricTag { - return obj.obj -} - -func (obj *patternFlowArpSenderHardwareAddrMetricTag) setMsg(msg *otg.PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpSenderHardwareAddrMetricTag struct { - obj *patternFlowArpSenderHardwareAddrMetricTag -} - -type marshalPatternFlowArpSenderHardwareAddrMetricTag interface { - // ToProto marshals PatternFlowArpSenderHardwareAddrMetricTag to protobuf object *otg.PatternFlowArpSenderHardwareAddrMetricTag - ToProto() (*otg.PatternFlowArpSenderHardwareAddrMetricTag, error) - // ToPbText marshals PatternFlowArpSenderHardwareAddrMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpSenderHardwareAddrMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpSenderHardwareAddrMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpSenderHardwareAddrMetricTag struct { - obj *patternFlowArpSenderHardwareAddrMetricTag -} - -type unMarshalPatternFlowArpSenderHardwareAddrMetricTag interface { - // FromProto unmarshals PatternFlowArpSenderHardwareAddrMetricTag from protobuf object *otg.PatternFlowArpSenderHardwareAddrMetricTag - FromProto(msg *otg.PatternFlowArpSenderHardwareAddrMetricTag) (PatternFlowArpSenderHardwareAddrMetricTag, error) - // FromPbText unmarshals PatternFlowArpSenderHardwareAddrMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpSenderHardwareAddrMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpSenderHardwareAddrMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpSenderHardwareAddrMetricTag) Marshal() marshalPatternFlowArpSenderHardwareAddrMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpSenderHardwareAddrMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpSenderHardwareAddrMetricTag) Unmarshal() unMarshalPatternFlowArpSenderHardwareAddrMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpSenderHardwareAddrMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpSenderHardwareAddrMetricTag) ToProto() (*otg.PatternFlowArpSenderHardwareAddrMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpSenderHardwareAddrMetricTag) FromProto(msg *otg.PatternFlowArpSenderHardwareAddrMetricTag) (PatternFlowArpSenderHardwareAddrMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpSenderHardwareAddrMetricTag) 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 *unMarshalpatternFlowArpSenderHardwareAddrMetricTag) 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 *marshalpatternFlowArpSenderHardwareAddrMetricTag) 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 *unMarshalpatternFlowArpSenderHardwareAddrMetricTag) 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 *marshalpatternFlowArpSenderHardwareAddrMetricTag) 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 *unMarshalpatternFlowArpSenderHardwareAddrMetricTag) 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 *patternFlowArpSenderHardwareAddrMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpSenderHardwareAddrMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpSenderHardwareAddrMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpSenderHardwareAddrMetricTag) Clone() (PatternFlowArpSenderHardwareAddrMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpSenderHardwareAddrMetricTag() - 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 -} - -// PatternFlowArpSenderHardwareAddrMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowArpSenderHardwareAddrMetricTag interface { - Validation - // msg marshals PatternFlowArpSenderHardwareAddrMetricTag to protobuf object *otg.PatternFlowArpSenderHardwareAddrMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowArpSenderHardwareAddrMetricTag - // setMsg unmarshals PatternFlowArpSenderHardwareAddrMetricTag from protobuf object *otg.PatternFlowArpSenderHardwareAddrMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrMetricTag - // provides marshal interface - Marshal() marshalPatternFlowArpSenderHardwareAddrMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpSenderHardwareAddrMetricTag - // validate validates PatternFlowArpSenderHardwareAddrMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpSenderHardwareAddrMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowArpSenderHardwareAddrMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowArpSenderHardwareAddrMetricTag - SetName(value string) PatternFlowArpSenderHardwareAddrMetricTag - // Offset returns uint32, set in PatternFlowArpSenderHardwareAddrMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowArpSenderHardwareAddrMetricTag - SetOffset(value uint32) PatternFlowArpSenderHardwareAddrMetricTag - // HasOffset checks if Offset has been set in PatternFlowArpSenderHardwareAddrMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowArpSenderHardwareAddrMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowArpSenderHardwareAddrMetricTag - SetLength(value uint32) PatternFlowArpSenderHardwareAddrMetricTag - // HasLength checks if Length has been set in PatternFlowArpSenderHardwareAddrMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowArpSenderHardwareAddrMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowArpSenderHardwareAddrMetricTag object -func (obj *patternFlowArpSenderHardwareAddrMetricTag) SetName(value string) PatternFlowArpSenderHardwareAddrMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpSenderHardwareAddrMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpSenderHardwareAddrMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowArpSenderHardwareAddrMetricTag object -func (obj *patternFlowArpSenderHardwareAddrMetricTag) SetOffset(value uint32) PatternFlowArpSenderHardwareAddrMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpSenderHardwareAddrMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpSenderHardwareAddrMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowArpSenderHardwareAddrMetricTag object -func (obj *patternFlowArpSenderHardwareAddrMetricTag) SetLength(value uint32) PatternFlowArpSenderHardwareAddrMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowArpSenderHardwareAddrMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpSenderHardwareAddrMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 47 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpSenderHardwareAddrMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 48 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowArpSenderHardwareAddrMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowArpSenderHardwareAddrMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(48) - } - -} - -// ***** PatternFlowArpSenderProtocolAddrCounter ***** -type patternFlowArpSenderProtocolAddrCounter struct { - validation - obj *otg.PatternFlowArpSenderProtocolAddrCounter - marshaller marshalPatternFlowArpSenderProtocolAddrCounter - unMarshaller unMarshalPatternFlowArpSenderProtocolAddrCounter -} - -func NewPatternFlowArpSenderProtocolAddrCounter() PatternFlowArpSenderProtocolAddrCounter { - obj := patternFlowArpSenderProtocolAddrCounter{obj: &otg.PatternFlowArpSenderProtocolAddrCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpSenderProtocolAddrCounter) msg() *otg.PatternFlowArpSenderProtocolAddrCounter { - return obj.obj -} - -func (obj *patternFlowArpSenderProtocolAddrCounter) setMsg(msg *otg.PatternFlowArpSenderProtocolAddrCounter) PatternFlowArpSenderProtocolAddrCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpSenderProtocolAddrCounter struct { - obj *patternFlowArpSenderProtocolAddrCounter -} - -type marshalPatternFlowArpSenderProtocolAddrCounter interface { - // ToProto marshals PatternFlowArpSenderProtocolAddrCounter to protobuf object *otg.PatternFlowArpSenderProtocolAddrCounter - ToProto() (*otg.PatternFlowArpSenderProtocolAddrCounter, error) - // ToPbText marshals PatternFlowArpSenderProtocolAddrCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpSenderProtocolAddrCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpSenderProtocolAddrCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpSenderProtocolAddrCounter struct { - obj *patternFlowArpSenderProtocolAddrCounter -} - -type unMarshalPatternFlowArpSenderProtocolAddrCounter interface { - // FromProto unmarshals PatternFlowArpSenderProtocolAddrCounter from protobuf object *otg.PatternFlowArpSenderProtocolAddrCounter - FromProto(msg *otg.PatternFlowArpSenderProtocolAddrCounter) (PatternFlowArpSenderProtocolAddrCounter, error) - // FromPbText unmarshals PatternFlowArpSenderProtocolAddrCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpSenderProtocolAddrCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpSenderProtocolAddrCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpSenderProtocolAddrCounter) Marshal() marshalPatternFlowArpSenderProtocolAddrCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpSenderProtocolAddrCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpSenderProtocolAddrCounter) Unmarshal() unMarshalPatternFlowArpSenderProtocolAddrCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpSenderProtocolAddrCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpSenderProtocolAddrCounter) ToProto() (*otg.PatternFlowArpSenderProtocolAddrCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpSenderProtocolAddrCounter) FromProto(msg *otg.PatternFlowArpSenderProtocolAddrCounter) (PatternFlowArpSenderProtocolAddrCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpSenderProtocolAddrCounter) 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 *unMarshalpatternFlowArpSenderProtocolAddrCounter) 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 *marshalpatternFlowArpSenderProtocolAddrCounter) 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 *unMarshalpatternFlowArpSenderProtocolAddrCounter) 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 *marshalpatternFlowArpSenderProtocolAddrCounter) 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 *unMarshalpatternFlowArpSenderProtocolAddrCounter) 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 *patternFlowArpSenderProtocolAddrCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpSenderProtocolAddrCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpSenderProtocolAddrCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpSenderProtocolAddrCounter) Clone() (PatternFlowArpSenderProtocolAddrCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpSenderProtocolAddrCounter() - 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 -} - -// PatternFlowArpSenderProtocolAddrCounter is ipv4 counter pattern -type PatternFlowArpSenderProtocolAddrCounter interface { - Validation - // msg marshals PatternFlowArpSenderProtocolAddrCounter to protobuf object *otg.PatternFlowArpSenderProtocolAddrCounter - // and doesn't set defaults - msg() *otg.PatternFlowArpSenderProtocolAddrCounter - // setMsg unmarshals PatternFlowArpSenderProtocolAddrCounter from protobuf object *otg.PatternFlowArpSenderProtocolAddrCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowArpSenderProtocolAddrCounter) PatternFlowArpSenderProtocolAddrCounter - // provides marshal interface - Marshal() marshalPatternFlowArpSenderProtocolAddrCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpSenderProtocolAddrCounter - // validate validates PatternFlowArpSenderProtocolAddrCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpSenderProtocolAddrCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowArpSenderProtocolAddrCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowArpSenderProtocolAddrCounter - SetStart(value string) PatternFlowArpSenderProtocolAddrCounter - // HasStart checks if Start has been set in PatternFlowArpSenderProtocolAddrCounter - HasStart() bool - // Step returns string, set in PatternFlowArpSenderProtocolAddrCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowArpSenderProtocolAddrCounter - SetStep(value string) PatternFlowArpSenderProtocolAddrCounter - // HasStep checks if Step has been set in PatternFlowArpSenderProtocolAddrCounter - HasStep() bool - // Count returns uint32, set in PatternFlowArpSenderProtocolAddrCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowArpSenderProtocolAddrCounter - SetCount(value uint32) PatternFlowArpSenderProtocolAddrCounter - // HasCount checks if Count has been set in PatternFlowArpSenderProtocolAddrCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowArpSenderProtocolAddrCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowArpSenderProtocolAddrCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowArpSenderProtocolAddrCounter object -func (obj *patternFlowArpSenderProtocolAddrCounter) SetStart(value string) PatternFlowArpSenderProtocolAddrCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowArpSenderProtocolAddrCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowArpSenderProtocolAddrCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowArpSenderProtocolAddrCounter object -func (obj *patternFlowArpSenderProtocolAddrCounter) SetStep(value string) PatternFlowArpSenderProtocolAddrCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpSenderProtocolAddrCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpSenderProtocolAddrCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowArpSenderProtocolAddrCounter object -func (obj *patternFlowArpSenderProtocolAddrCounter) SetCount(value uint32) PatternFlowArpSenderProtocolAddrCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowArpSenderProtocolAddrCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateIpv4(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderProtocolAddrCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateIpv4(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderProtocolAddrCounter.Step")) - } - - } - -} - -func (obj *patternFlowArpSenderProtocolAddrCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("0.0.0.0") - } - if obj.obj.Step == nil { - obj.SetStep("0.0.0.1") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowArpSenderProtocolAddrMetricTag ***** -type patternFlowArpSenderProtocolAddrMetricTag struct { - validation - obj *otg.PatternFlowArpSenderProtocolAddrMetricTag - marshaller marshalPatternFlowArpSenderProtocolAddrMetricTag - unMarshaller unMarshalPatternFlowArpSenderProtocolAddrMetricTag -} - -func NewPatternFlowArpSenderProtocolAddrMetricTag() PatternFlowArpSenderProtocolAddrMetricTag { - obj := patternFlowArpSenderProtocolAddrMetricTag{obj: &otg.PatternFlowArpSenderProtocolAddrMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpSenderProtocolAddrMetricTag) msg() *otg.PatternFlowArpSenderProtocolAddrMetricTag { - return obj.obj -} - -func (obj *patternFlowArpSenderProtocolAddrMetricTag) setMsg(msg *otg.PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpSenderProtocolAddrMetricTag struct { - obj *patternFlowArpSenderProtocolAddrMetricTag -} - -type marshalPatternFlowArpSenderProtocolAddrMetricTag interface { - // ToProto marshals PatternFlowArpSenderProtocolAddrMetricTag to protobuf object *otg.PatternFlowArpSenderProtocolAddrMetricTag - ToProto() (*otg.PatternFlowArpSenderProtocolAddrMetricTag, error) - // ToPbText marshals PatternFlowArpSenderProtocolAddrMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpSenderProtocolAddrMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpSenderProtocolAddrMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpSenderProtocolAddrMetricTag struct { - obj *patternFlowArpSenderProtocolAddrMetricTag -} - -type unMarshalPatternFlowArpSenderProtocolAddrMetricTag interface { - // FromProto unmarshals PatternFlowArpSenderProtocolAddrMetricTag from protobuf object *otg.PatternFlowArpSenderProtocolAddrMetricTag - FromProto(msg *otg.PatternFlowArpSenderProtocolAddrMetricTag) (PatternFlowArpSenderProtocolAddrMetricTag, error) - // FromPbText unmarshals PatternFlowArpSenderProtocolAddrMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpSenderProtocolAddrMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpSenderProtocolAddrMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpSenderProtocolAddrMetricTag) Marshal() marshalPatternFlowArpSenderProtocolAddrMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpSenderProtocolAddrMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpSenderProtocolAddrMetricTag) Unmarshal() unMarshalPatternFlowArpSenderProtocolAddrMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpSenderProtocolAddrMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpSenderProtocolAddrMetricTag) ToProto() (*otg.PatternFlowArpSenderProtocolAddrMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpSenderProtocolAddrMetricTag) FromProto(msg *otg.PatternFlowArpSenderProtocolAddrMetricTag) (PatternFlowArpSenderProtocolAddrMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpSenderProtocolAddrMetricTag) 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 *unMarshalpatternFlowArpSenderProtocolAddrMetricTag) 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 *marshalpatternFlowArpSenderProtocolAddrMetricTag) 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 *unMarshalpatternFlowArpSenderProtocolAddrMetricTag) 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 *marshalpatternFlowArpSenderProtocolAddrMetricTag) 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 *unMarshalpatternFlowArpSenderProtocolAddrMetricTag) 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 *patternFlowArpSenderProtocolAddrMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpSenderProtocolAddrMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpSenderProtocolAddrMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpSenderProtocolAddrMetricTag) Clone() (PatternFlowArpSenderProtocolAddrMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpSenderProtocolAddrMetricTag() - 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 -} - -// PatternFlowArpSenderProtocolAddrMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowArpSenderProtocolAddrMetricTag interface { - Validation - // msg marshals PatternFlowArpSenderProtocolAddrMetricTag to protobuf object *otg.PatternFlowArpSenderProtocolAddrMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowArpSenderProtocolAddrMetricTag - // setMsg unmarshals PatternFlowArpSenderProtocolAddrMetricTag from protobuf object *otg.PatternFlowArpSenderProtocolAddrMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrMetricTag - // provides marshal interface - Marshal() marshalPatternFlowArpSenderProtocolAddrMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpSenderProtocolAddrMetricTag - // validate validates PatternFlowArpSenderProtocolAddrMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpSenderProtocolAddrMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowArpSenderProtocolAddrMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowArpSenderProtocolAddrMetricTag - SetName(value string) PatternFlowArpSenderProtocolAddrMetricTag - // Offset returns uint32, set in PatternFlowArpSenderProtocolAddrMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowArpSenderProtocolAddrMetricTag - SetOffset(value uint32) PatternFlowArpSenderProtocolAddrMetricTag - // HasOffset checks if Offset has been set in PatternFlowArpSenderProtocolAddrMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowArpSenderProtocolAddrMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowArpSenderProtocolAddrMetricTag - SetLength(value uint32) PatternFlowArpSenderProtocolAddrMetricTag - // HasLength checks if Length has been set in PatternFlowArpSenderProtocolAddrMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowArpSenderProtocolAddrMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowArpSenderProtocolAddrMetricTag object -func (obj *patternFlowArpSenderProtocolAddrMetricTag) SetName(value string) PatternFlowArpSenderProtocolAddrMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpSenderProtocolAddrMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpSenderProtocolAddrMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowArpSenderProtocolAddrMetricTag object -func (obj *patternFlowArpSenderProtocolAddrMetricTag) SetOffset(value uint32) PatternFlowArpSenderProtocolAddrMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpSenderProtocolAddrMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpSenderProtocolAddrMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowArpSenderProtocolAddrMetricTag object -func (obj *patternFlowArpSenderProtocolAddrMetricTag) SetLength(value uint32) PatternFlowArpSenderProtocolAddrMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowArpSenderProtocolAddrMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpSenderProtocolAddrMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpSenderProtocolAddrMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowArpSenderProtocolAddrMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowArpSenderProtocolAddrMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(32) - } - -} - -// ***** PatternFlowArpTargetHardwareAddrCounter ***** -type patternFlowArpTargetHardwareAddrCounter struct { - validation - obj *otg.PatternFlowArpTargetHardwareAddrCounter - marshaller marshalPatternFlowArpTargetHardwareAddrCounter - unMarshaller unMarshalPatternFlowArpTargetHardwareAddrCounter -} - -func NewPatternFlowArpTargetHardwareAddrCounter() PatternFlowArpTargetHardwareAddrCounter { - obj := patternFlowArpTargetHardwareAddrCounter{obj: &otg.PatternFlowArpTargetHardwareAddrCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpTargetHardwareAddrCounter) msg() *otg.PatternFlowArpTargetHardwareAddrCounter { - return obj.obj -} - -func (obj *patternFlowArpTargetHardwareAddrCounter) setMsg(msg *otg.PatternFlowArpTargetHardwareAddrCounter) PatternFlowArpTargetHardwareAddrCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpTargetHardwareAddrCounter struct { - obj *patternFlowArpTargetHardwareAddrCounter -} - -type marshalPatternFlowArpTargetHardwareAddrCounter interface { - // ToProto marshals PatternFlowArpTargetHardwareAddrCounter to protobuf object *otg.PatternFlowArpTargetHardwareAddrCounter - ToProto() (*otg.PatternFlowArpTargetHardwareAddrCounter, error) - // ToPbText marshals PatternFlowArpTargetHardwareAddrCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpTargetHardwareAddrCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpTargetHardwareAddrCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpTargetHardwareAddrCounter struct { - obj *patternFlowArpTargetHardwareAddrCounter -} - -type unMarshalPatternFlowArpTargetHardwareAddrCounter interface { - // FromProto unmarshals PatternFlowArpTargetHardwareAddrCounter from protobuf object *otg.PatternFlowArpTargetHardwareAddrCounter - FromProto(msg *otg.PatternFlowArpTargetHardwareAddrCounter) (PatternFlowArpTargetHardwareAddrCounter, error) - // FromPbText unmarshals PatternFlowArpTargetHardwareAddrCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpTargetHardwareAddrCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpTargetHardwareAddrCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpTargetHardwareAddrCounter) Marshal() marshalPatternFlowArpTargetHardwareAddrCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpTargetHardwareAddrCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpTargetHardwareAddrCounter) Unmarshal() unMarshalPatternFlowArpTargetHardwareAddrCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpTargetHardwareAddrCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpTargetHardwareAddrCounter) ToProto() (*otg.PatternFlowArpTargetHardwareAddrCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpTargetHardwareAddrCounter) FromProto(msg *otg.PatternFlowArpTargetHardwareAddrCounter) (PatternFlowArpTargetHardwareAddrCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpTargetHardwareAddrCounter) 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 *unMarshalpatternFlowArpTargetHardwareAddrCounter) 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 *marshalpatternFlowArpTargetHardwareAddrCounter) 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 *unMarshalpatternFlowArpTargetHardwareAddrCounter) 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 *marshalpatternFlowArpTargetHardwareAddrCounter) 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 *unMarshalpatternFlowArpTargetHardwareAddrCounter) 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 *patternFlowArpTargetHardwareAddrCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpTargetHardwareAddrCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpTargetHardwareAddrCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpTargetHardwareAddrCounter) Clone() (PatternFlowArpTargetHardwareAddrCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpTargetHardwareAddrCounter() - 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 -} - -// PatternFlowArpTargetHardwareAddrCounter is mac counter pattern -type PatternFlowArpTargetHardwareAddrCounter interface { - Validation - // msg marshals PatternFlowArpTargetHardwareAddrCounter to protobuf object *otg.PatternFlowArpTargetHardwareAddrCounter - // and doesn't set defaults - msg() *otg.PatternFlowArpTargetHardwareAddrCounter - // setMsg unmarshals PatternFlowArpTargetHardwareAddrCounter from protobuf object *otg.PatternFlowArpTargetHardwareAddrCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowArpTargetHardwareAddrCounter) PatternFlowArpTargetHardwareAddrCounter - // provides marshal interface - Marshal() marshalPatternFlowArpTargetHardwareAddrCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpTargetHardwareAddrCounter - // validate validates PatternFlowArpTargetHardwareAddrCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpTargetHardwareAddrCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowArpTargetHardwareAddrCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowArpTargetHardwareAddrCounter - SetStart(value string) PatternFlowArpTargetHardwareAddrCounter - // HasStart checks if Start has been set in PatternFlowArpTargetHardwareAddrCounter - HasStart() bool - // Step returns string, set in PatternFlowArpTargetHardwareAddrCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowArpTargetHardwareAddrCounter - SetStep(value string) PatternFlowArpTargetHardwareAddrCounter - // HasStep checks if Step has been set in PatternFlowArpTargetHardwareAddrCounter - HasStep() bool - // Count returns uint32, set in PatternFlowArpTargetHardwareAddrCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowArpTargetHardwareAddrCounter - SetCount(value uint32) PatternFlowArpTargetHardwareAddrCounter - // HasCount checks if Count has been set in PatternFlowArpTargetHardwareAddrCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowArpTargetHardwareAddrCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowArpTargetHardwareAddrCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowArpTargetHardwareAddrCounter object -func (obj *patternFlowArpTargetHardwareAddrCounter) SetStart(value string) PatternFlowArpTargetHardwareAddrCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowArpTargetHardwareAddrCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowArpTargetHardwareAddrCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowArpTargetHardwareAddrCounter object -func (obj *patternFlowArpTargetHardwareAddrCounter) SetStep(value string) PatternFlowArpTargetHardwareAddrCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpTargetHardwareAddrCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpTargetHardwareAddrCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowArpTargetHardwareAddrCounter object -func (obj *patternFlowArpTargetHardwareAddrCounter) SetCount(value uint32) PatternFlowArpTargetHardwareAddrCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowArpTargetHardwareAddrCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateMac(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetHardwareAddrCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateMac(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetHardwareAddrCounter.Step")) - } - - } - -} - -func (obj *patternFlowArpTargetHardwareAddrCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("00:00:00:00:00:00") - } - if obj.obj.Step == nil { - obj.SetStep("00:00:00:00:00:01") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowArpTargetHardwareAddrMetricTag ***** -type patternFlowArpTargetHardwareAddrMetricTag struct { - validation - obj *otg.PatternFlowArpTargetHardwareAddrMetricTag - marshaller marshalPatternFlowArpTargetHardwareAddrMetricTag - unMarshaller unMarshalPatternFlowArpTargetHardwareAddrMetricTag -} - -func NewPatternFlowArpTargetHardwareAddrMetricTag() PatternFlowArpTargetHardwareAddrMetricTag { - obj := patternFlowArpTargetHardwareAddrMetricTag{obj: &otg.PatternFlowArpTargetHardwareAddrMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpTargetHardwareAddrMetricTag) msg() *otg.PatternFlowArpTargetHardwareAddrMetricTag { - return obj.obj -} - -func (obj *patternFlowArpTargetHardwareAddrMetricTag) setMsg(msg *otg.PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpTargetHardwareAddrMetricTag struct { - obj *patternFlowArpTargetHardwareAddrMetricTag -} - -type marshalPatternFlowArpTargetHardwareAddrMetricTag interface { - // ToProto marshals PatternFlowArpTargetHardwareAddrMetricTag to protobuf object *otg.PatternFlowArpTargetHardwareAddrMetricTag - ToProto() (*otg.PatternFlowArpTargetHardwareAddrMetricTag, error) - // ToPbText marshals PatternFlowArpTargetHardwareAddrMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpTargetHardwareAddrMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpTargetHardwareAddrMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpTargetHardwareAddrMetricTag struct { - obj *patternFlowArpTargetHardwareAddrMetricTag -} - -type unMarshalPatternFlowArpTargetHardwareAddrMetricTag interface { - // FromProto unmarshals PatternFlowArpTargetHardwareAddrMetricTag from protobuf object *otg.PatternFlowArpTargetHardwareAddrMetricTag - FromProto(msg *otg.PatternFlowArpTargetHardwareAddrMetricTag) (PatternFlowArpTargetHardwareAddrMetricTag, error) - // FromPbText unmarshals PatternFlowArpTargetHardwareAddrMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpTargetHardwareAddrMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpTargetHardwareAddrMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpTargetHardwareAddrMetricTag) Marshal() marshalPatternFlowArpTargetHardwareAddrMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpTargetHardwareAddrMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpTargetHardwareAddrMetricTag) Unmarshal() unMarshalPatternFlowArpTargetHardwareAddrMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpTargetHardwareAddrMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpTargetHardwareAddrMetricTag) ToProto() (*otg.PatternFlowArpTargetHardwareAddrMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpTargetHardwareAddrMetricTag) FromProto(msg *otg.PatternFlowArpTargetHardwareAddrMetricTag) (PatternFlowArpTargetHardwareAddrMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpTargetHardwareAddrMetricTag) 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 *unMarshalpatternFlowArpTargetHardwareAddrMetricTag) 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 *marshalpatternFlowArpTargetHardwareAddrMetricTag) 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 *unMarshalpatternFlowArpTargetHardwareAddrMetricTag) 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 *marshalpatternFlowArpTargetHardwareAddrMetricTag) 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 *unMarshalpatternFlowArpTargetHardwareAddrMetricTag) 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 *patternFlowArpTargetHardwareAddrMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpTargetHardwareAddrMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpTargetHardwareAddrMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpTargetHardwareAddrMetricTag) Clone() (PatternFlowArpTargetHardwareAddrMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpTargetHardwareAddrMetricTag() - 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 -} - -// PatternFlowArpTargetHardwareAddrMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowArpTargetHardwareAddrMetricTag interface { - Validation - // msg marshals PatternFlowArpTargetHardwareAddrMetricTag to protobuf object *otg.PatternFlowArpTargetHardwareAddrMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowArpTargetHardwareAddrMetricTag - // setMsg unmarshals PatternFlowArpTargetHardwareAddrMetricTag from protobuf object *otg.PatternFlowArpTargetHardwareAddrMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrMetricTag - // provides marshal interface - Marshal() marshalPatternFlowArpTargetHardwareAddrMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpTargetHardwareAddrMetricTag - // validate validates PatternFlowArpTargetHardwareAddrMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpTargetHardwareAddrMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowArpTargetHardwareAddrMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowArpTargetHardwareAddrMetricTag - SetName(value string) PatternFlowArpTargetHardwareAddrMetricTag - // Offset returns uint32, set in PatternFlowArpTargetHardwareAddrMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowArpTargetHardwareAddrMetricTag - SetOffset(value uint32) PatternFlowArpTargetHardwareAddrMetricTag - // HasOffset checks if Offset has been set in PatternFlowArpTargetHardwareAddrMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowArpTargetHardwareAddrMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowArpTargetHardwareAddrMetricTag - SetLength(value uint32) PatternFlowArpTargetHardwareAddrMetricTag - // HasLength checks if Length has been set in PatternFlowArpTargetHardwareAddrMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowArpTargetHardwareAddrMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowArpTargetHardwareAddrMetricTag object -func (obj *patternFlowArpTargetHardwareAddrMetricTag) SetName(value string) PatternFlowArpTargetHardwareAddrMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpTargetHardwareAddrMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpTargetHardwareAddrMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowArpTargetHardwareAddrMetricTag object -func (obj *patternFlowArpTargetHardwareAddrMetricTag) SetOffset(value uint32) PatternFlowArpTargetHardwareAddrMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpTargetHardwareAddrMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpTargetHardwareAddrMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowArpTargetHardwareAddrMetricTag object -func (obj *patternFlowArpTargetHardwareAddrMetricTag) SetLength(value uint32) PatternFlowArpTargetHardwareAddrMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowArpTargetHardwareAddrMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpTargetHardwareAddrMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 47 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpTargetHardwareAddrMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 48 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowArpTargetHardwareAddrMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowArpTargetHardwareAddrMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(48) - } - -} - -// ***** PatternFlowArpTargetProtocolAddrCounter ***** -type patternFlowArpTargetProtocolAddrCounter struct { - validation - obj *otg.PatternFlowArpTargetProtocolAddrCounter - marshaller marshalPatternFlowArpTargetProtocolAddrCounter - unMarshaller unMarshalPatternFlowArpTargetProtocolAddrCounter -} - -func NewPatternFlowArpTargetProtocolAddrCounter() PatternFlowArpTargetProtocolAddrCounter { - obj := patternFlowArpTargetProtocolAddrCounter{obj: &otg.PatternFlowArpTargetProtocolAddrCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpTargetProtocolAddrCounter) msg() *otg.PatternFlowArpTargetProtocolAddrCounter { - return obj.obj -} - -func (obj *patternFlowArpTargetProtocolAddrCounter) setMsg(msg *otg.PatternFlowArpTargetProtocolAddrCounter) PatternFlowArpTargetProtocolAddrCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpTargetProtocolAddrCounter struct { - obj *patternFlowArpTargetProtocolAddrCounter -} - -type marshalPatternFlowArpTargetProtocolAddrCounter interface { - // ToProto marshals PatternFlowArpTargetProtocolAddrCounter to protobuf object *otg.PatternFlowArpTargetProtocolAddrCounter - ToProto() (*otg.PatternFlowArpTargetProtocolAddrCounter, error) - // ToPbText marshals PatternFlowArpTargetProtocolAddrCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpTargetProtocolAddrCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpTargetProtocolAddrCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpTargetProtocolAddrCounter struct { - obj *patternFlowArpTargetProtocolAddrCounter -} - -type unMarshalPatternFlowArpTargetProtocolAddrCounter interface { - // FromProto unmarshals PatternFlowArpTargetProtocolAddrCounter from protobuf object *otg.PatternFlowArpTargetProtocolAddrCounter - FromProto(msg *otg.PatternFlowArpTargetProtocolAddrCounter) (PatternFlowArpTargetProtocolAddrCounter, error) - // FromPbText unmarshals PatternFlowArpTargetProtocolAddrCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpTargetProtocolAddrCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpTargetProtocolAddrCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpTargetProtocolAddrCounter) Marshal() marshalPatternFlowArpTargetProtocolAddrCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpTargetProtocolAddrCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpTargetProtocolAddrCounter) Unmarshal() unMarshalPatternFlowArpTargetProtocolAddrCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpTargetProtocolAddrCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpTargetProtocolAddrCounter) ToProto() (*otg.PatternFlowArpTargetProtocolAddrCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpTargetProtocolAddrCounter) FromProto(msg *otg.PatternFlowArpTargetProtocolAddrCounter) (PatternFlowArpTargetProtocolAddrCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpTargetProtocolAddrCounter) 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 *unMarshalpatternFlowArpTargetProtocolAddrCounter) 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 *marshalpatternFlowArpTargetProtocolAddrCounter) 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 *unMarshalpatternFlowArpTargetProtocolAddrCounter) 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 *marshalpatternFlowArpTargetProtocolAddrCounter) 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 *unMarshalpatternFlowArpTargetProtocolAddrCounter) 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 *patternFlowArpTargetProtocolAddrCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpTargetProtocolAddrCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpTargetProtocolAddrCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpTargetProtocolAddrCounter) Clone() (PatternFlowArpTargetProtocolAddrCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpTargetProtocolAddrCounter() - 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 -} - -// PatternFlowArpTargetProtocolAddrCounter is ipv4 counter pattern -type PatternFlowArpTargetProtocolAddrCounter interface { - Validation - // msg marshals PatternFlowArpTargetProtocolAddrCounter to protobuf object *otg.PatternFlowArpTargetProtocolAddrCounter - // and doesn't set defaults - msg() *otg.PatternFlowArpTargetProtocolAddrCounter - // setMsg unmarshals PatternFlowArpTargetProtocolAddrCounter from protobuf object *otg.PatternFlowArpTargetProtocolAddrCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowArpTargetProtocolAddrCounter) PatternFlowArpTargetProtocolAddrCounter - // provides marshal interface - Marshal() marshalPatternFlowArpTargetProtocolAddrCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpTargetProtocolAddrCounter - // validate validates PatternFlowArpTargetProtocolAddrCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpTargetProtocolAddrCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowArpTargetProtocolAddrCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowArpTargetProtocolAddrCounter - SetStart(value string) PatternFlowArpTargetProtocolAddrCounter - // HasStart checks if Start has been set in PatternFlowArpTargetProtocolAddrCounter - HasStart() bool - // Step returns string, set in PatternFlowArpTargetProtocolAddrCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowArpTargetProtocolAddrCounter - SetStep(value string) PatternFlowArpTargetProtocolAddrCounter - // HasStep checks if Step has been set in PatternFlowArpTargetProtocolAddrCounter - HasStep() bool - // Count returns uint32, set in PatternFlowArpTargetProtocolAddrCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowArpTargetProtocolAddrCounter - SetCount(value uint32) PatternFlowArpTargetProtocolAddrCounter - // HasCount checks if Count has been set in PatternFlowArpTargetProtocolAddrCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowArpTargetProtocolAddrCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowArpTargetProtocolAddrCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowArpTargetProtocolAddrCounter object -func (obj *patternFlowArpTargetProtocolAddrCounter) SetStart(value string) PatternFlowArpTargetProtocolAddrCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowArpTargetProtocolAddrCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowArpTargetProtocolAddrCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowArpTargetProtocolAddrCounter object -func (obj *patternFlowArpTargetProtocolAddrCounter) SetStep(value string) PatternFlowArpTargetProtocolAddrCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpTargetProtocolAddrCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowArpTargetProtocolAddrCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowArpTargetProtocolAddrCounter object -func (obj *patternFlowArpTargetProtocolAddrCounter) SetCount(value uint32) PatternFlowArpTargetProtocolAddrCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowArpTargetProtocolAddrCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateIpv4(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetProtocolAddrCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateIpv4(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetProtocolAddrCounter.Step")) - } - - } - -} - -func (obj *patternFlowArpTargetProtocolAddrCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("0.0.0.0") - } - if obj.obj.Step == nil { - obj.SetStep("0.0.0.1") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowArpTargetProtocolAddrMetricTag ***** -type patternFlowArpTargetProtocolAddrMetricTag struct { - validation - obj *otg.PatternFlowArpTargetProtocolAddrMetricTag - marshaller marshalPatternFlowArpTargetProtocolAddrMetricTag - unMarshaller unMarshalPatternFlowArpTargetProtocolAddrMetricTag -} - -func NewPatternFlowArpTargetProtocolAddrMetricTag() PatternFlowArpTargetProtocolAddrMetricTag { - obj := patternFlowArpTargetProtocolAddrMetricTag{obj: &otg.PatternFlowArpTargetProtocolAddrMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowArpTargetProtocolAddrMetricTag) msg() *otg.PatternFlowArpTargetProtocolAddrMetricTag { - return obj.obj -} - -func (obj *patternFlowArpTargetProtocolAddrMetricTag) setMsg(msg *otg.PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowArpTargetProtocolAddrMetricTag struct { - obj *patternFlowArpTargetProtocolAddrMetricTag -} - -type marshalPatternFlowArpTargetProtocolAddrMetricTag interface { - // ToProto marshals PatternFlowArpTargetProtocolAddrMetricTag to protobuf object *otg.PatternFlowArpTargetProtocolAddrMetricTag - ToProto() (*otg.PatternFlowArpTargetProtocolAddrMetricTag, error) - // ToPbText marshals PatternFlowArpTargetProtocolAddrMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowArpTargetProtocolAddrMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowArpTargetProtocolAddrMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowArpTargetProtocolAddrMetricTag struct { - obj *patternFlowArpTargetProtocolAddrMetricTag -} - -type unMarshalPatternFlowArpTargetProtocolAddrMetricTag interface { - // FromProto unmarshals PatternFlowArpTargetProtocolAddrMetricTag from protobuf object *otg.PatternFlowArpTargetProtocolAddrMetricTag - FromProto(msg *otg.PatternFlowArpTargetProtocolAddrMetricTag) (PatternFlowArpTargetProtocolAddrMetricTag, error) - // FromPbText unmarshals PatternFlowArpTargetProtocolAddrMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowArpTargetProtocolAddrMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowArpTargetProtocolAddrMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowArpTargetProtocolAddrMetricTag) Marshal() marshalPatternFlowArpTargetProtocolAddrMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowArpTargetProtocolAddrMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowArpTargetProtocolAddrMetricTag) Unmarshal() unMarshalPatternFlowArpTargetProtocolAddrMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowArpTargetProtocolAddrMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowArpTargetProtocolAddrMetricTag) ToProto() (*otg.PatternFlowArpTargetProtocolAddrMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowArpTargetProtocolAddrMetricTag) FromProto(msg *otg.PatternFlowArpTargetProtocolAddrMetricTag) (PatternFlowArpTargetProtocolAddrMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowArpTargetProtocolAddrMetricTag) 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 *unMarshalpatternFlowArpTargetProtocolAddrMetricTag) 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 *marshalpatternFlowArpTargetProtocolAddrMetricTag) 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 *unMarshalpatternFlowArpTargetProtocolAddrMetricTag) 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 *marshalpatternFlowArpTargetProtocolAddrMetricTag) 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 *unMarshalpatternFlowArpTargetProtocolAddrMetricTag) 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 *patternFlowArpTargetProtocolAddrMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowArpTargetProtocolAddrMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowArpTargetProtocolAddrMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowArpTargetProtocolAddrMetricTag) Clone() (PatternFlowArpTargetProtocolAddrMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowArpTargetProtocolAddrMetricTag() - 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 -} - -// PatternFlowArpTargetProtocolAddrMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowArpTargetProtocolAddrMetricTag interface { - Validation - // msg marshals PatternFlowArpTargetProtocolAddrMetricTag to protobuf object *otg.PatternFlowArpTargetProtocolAddrMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowArpTargetProtocolAddrMetricTag - // setMsg unmarshals PatternFlowArpTargetProtocolAddrMetricTag from protobuf object *otg.PatternFlowArpTargetProtocolAddrMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrMetricTag - // provides marshal interface - Marshal() marshalPatternFlowArpTargetProtocolAddrMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowArpTargetProtocolAddrMetricTag - // validate validates PatternFlowArpTargetProtocolAddrMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowArpTargetProtocolAddrMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowArpTargetProtocolAddrMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowArpTargetProtocolAddrMetricTag - SetName(value string) PatternFlowArpTargetProtocolAddrMetricTag - // Offset returns uint32, set in PatternFlowArpTargetProtocolAddrMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowArpTargetProtocolAddrMetricTag - SetOffset(value uint32) PatternFlowArpTargetProtocolAddrMetricTag - // HasOffset checks if Offset has been set in PatternFlowArpTargetProtocolAddrMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowArpTargetProtocolAddrMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowArpTargetProtocolAddrMetricTag - SetLength(value uint32) PatternFlowArpTargetProtocolAddrMetricTag - // HasLength checks if Length has been set in PatternFlowArpTargetProtocolAddrMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowArpTargetProtocolAddrMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowArpTargetProtocolAddrMetricTag object -func (obj *patternFlowArpTargetProtocolAddrMetricTag) SetName(value string) PatternFlowArpTargetProtocolAddrMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpTargetProtocolAddrMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowArpTargetProtocolAddrMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowArpTargetProtocolAddrMetricTag object -func (obj *patternFlowArpTargetProtocolAddrMetricTag) SetOffset(value uint32) PatternFlowArpTargetProtocolAddrMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpTargetProtocolAddrMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowArpTargetProtocolAddrMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowArpTargetProtocolAddrMetricTag object -func (obj *patternFlowArpTargetProtocolAddrMetricTag) SetLength(value uint32) PatternFlowArpTargetProtocolAddrMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowArpTargetProtocolAddrMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpTargetProtocolAddrMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowArpTargetProtocolAddrMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowArpTargetProtocolAddrMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowArpTargetProtocolAddrMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(32) - } - -} - -// ***** PatternFlowIcmpEchoType ***** -type patternFlowIcmpEchoType struct { - validation - obj *otg.PatternFlowIcmpEchoType - marshaller marshalPatternFlowIcmpEchoType - unMarshaller unMarshalPatternFlowIcmpEchoType - incrementHolder PatternFlowIcmpEchoTypeCounter - decrementHolder PatternFlowIcmpEchoTypeCounter - metricTagsHolder PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter -} - -func NewPatternFlowIcmpEchoType() PatternFlowIcmpEchoType { - obj := patternFlowIcmpEchoType{obj: &otg.PatternFlowIcmpEchoType{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpEchoType) msg() *otg.PatternFlowIcmpEchoType { - return obj.obj -} - -func (obj *patternFlowIcmpEchoType) setMsg(msg *otg.PatternFlowIcmpEchoType) PatternFlowIcmpEchoType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpEchoType struct { - obj *patternFlowIcmpEchoType -} - -type marshalPatternFlowIcmpEchoType interface { - // ToProto marshals PatternFlowIcmpEchoType to protobuf object *otg.PatternFlowIcmpEchoType - ToProto() (*otg.PatternFlowIcmpEchoType, error) - // ToPbText marshals PatternFlowIcmpEchoType to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpEchoType to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpEchoType to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpEchoType struct { - obj *patternFlowIcmpEchoType -} - -type unMarshalPatternFlowIcmpEchoType interface { - // FromProto unmarshals PatternFlowIcmpEchoType from protobuf object *otg.PatternFlowIcmpEchoType - FromProto(msg *otg.PatternFlowIcmpEchoType) (PatternFlowIcmpEchoType, error) - // FromPbText unmarshals PatternFlowIcmpEchoType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpEchoType from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpEchoType from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpEchoType) Marshal() marshalPatternFlowIcmpEchoType { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpEchoType{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpEchoType) Unmarshal() unMarshalPatternFlowIcmpEchoType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpEchoType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpEchoType) ToProto() (*otg.PatternFlowIcmpEchoType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpEchoType) FromProto(msg *otg.PatternFlowIcmpEchoType) (PatternFlowIcmpEchoType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpEchoType) 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 *unMarshalpatternFlowIcmpEchoType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIcmpEchoType) 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 *unMarshalpatternFlowIcmpEchoType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIcmpEchoType) 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 *unMarshalpatternFlowIcmpEchoType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIcmpEchoType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpEchoType) Clone() (PatternFlowIcmpEchoType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpEchoType() - 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 -} - -func (obj *patternFlowIcmpEchoType) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIcmpEchoType is the type of ICMP echo packet -type PatternFlowIcmpEchoType interface { - Validation - // msg marshals PatternFlowIcmpEchoType to protobuf object *otg.PatternFlowIcmpEchoType - // and doesn't set defaults - msg() *otg.PatternFlowIcmpEchoType - // setMsg unmarshals PatternFlowIcmpEchoType from protobuf object *otg.PatternFlowIcmpEchoType - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpEchoType) PatternFlowIcmpEchoType - // provides marshal interface - Marshal() marshalPatternFlowIcmpEchoType - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpEchoType - // validate validates PatternFlowIcmpEchoType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpEchoType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIcmpEchoTypeChoiceEnum, set in PatternFlowIcmpEchoType - Choice() PatternFlowIcmpEchoTypeChoiceEnum - // setChoice assigns PatternFlowIcmpEchoTypeChoiceEnum provided by user to PatternFlowIcmpEchoType - setChoice(value PatternFlowIcmpEchoTypeChoiceEnum) PatternFlowIcmpEchoType - // HasChoice checks if Choice has been set in PatternFlowIcmpEchoType - HasChoice() bool - // Value returns uint32, set in PatternFlowIcmpEchoType. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIcmpEchoType - SetValue(value uint32) PatternFlowIcmpEchoType - // HasValue checks if Value has been set in PatternFlowIcmpEchoType - HasValue() bool - // Values returns []uint32, set in PatternFlowIcmpEchoType. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIcmpEchoType - SetValues(value []uint32) PatternFlowIcmpEchoType - // Increment returns PatternFlowIcmpEchoTypeCounter, set in PatternFlowIcmpEchoType. - // PatternFlowIcmpEchoTypeCounter is integer counter pattern - Increment() PatternFlowIcmpEchoTypeCounter - // SetIncrement assigns PatternFlowIcmpEchoTypeCounter provided by user to PatternFlowIcmpEchoType. - // PatternFlowIcmpEchoTypeCounter is integer counter pattern - SetIncrement(value PatternFlowIcmpEchoTypeCounter) PatternFlowIcmpEchoType - // HasIncrement checks if Increment has been set in PatternFlowIcmpEchoType - HasIncrement() bool - // Decrement returns PatternFlowIcmpEchoTypeCounter, set in PatternFlowIcmpEchoType. - // PatternFlowIcmpEchoTypeCounter is integer counter pattern - Decrement() PatternFlowIcmpEchoTypeCounter - // SetDecrement assigns PatternFlowIcmpEchoTypeCounter provided by user to PatternFlowIcmpEchoType. - // PatternFlowIcmpEchoTypeCounter is integer counter pattern - SetDecrement(value PatternFlowIcmpEchoTypeCounter) PatternFlowIcmpEchoType - // HasDecrement checks if Decrement has been set in PatternFlowIcmpEchoType - HasDecrement() bool - // MetricTags returns PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIterIter, set in PatternFlowIcmpEchoType - MetricTags() PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter - setNil() -} - -type PatternFlowIcmpEchoTypeChoiceEnum string - -// Enum of Choice on PatternFlowIcmpEchoType -var PatternFlowIcmpEchoTypeChoice = struct { - VALUE PatternFlowIcmpEchoTypeChoiceEnum - VALUES PatternFlowIcmpEchoTypeChoiceEnum - INCREMENT PatternFlowIcmpEchoTypeChoiceEnum - DECREMENT PatternFlowIcmpEchoTypeChoiceEnum -}{ - VALUE: PatternFlowIcmpEchoTypeChoiceEnum("value"), - VALUES: PatternFlowIcmpEchoTypeChoiceEnum("values"), - INCREMENT: PatternFlowIcmpEchoTypeChoiceEnum("increment"), - DECREMENT: PatternFlowIcmpEchoTypeChoiceEnum("decrement"), -} - -func (obj *patternFlowIcmpEchoType) Choice() PatternFlowIcmpEchoTypeChoiceEnum { - return PatternFlowIcmpEchoTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIcmpEchoType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIcmpEchoType) setChoice(value PatternFlowIcmpEchoTypeChoiceEnum) PatternFlowIcmpEchoType { - intValue, ok := otg.PatternFlowIcmpEchoType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIcmpEchoTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIcmpEchoType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIcmpEchoTypeChoice.VALUE { - defaultValue := uint32(8) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIcmpEchoTypeChoice.VALUES { - defaultValue := []uint32{8} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIcmpEchoTypeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIcmpEchoTypeCounter().msg() - } - - if value == PatternFlowIcmpEchoTypeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIcmpEchoTypeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpEchoType) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIcmpEchoTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpEchoType) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIcmpEchoType object -func (obj *patternFlowIcmpEchoType) SetValue(value uint32) PatternFlowIcmpEchoType { - obj.setChoice(PatternFlowIcmpEchoTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIcmpEchoType) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{8}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIcmpEchoType object -func (obj *patternFlowIcmpEchoType) SetValues(value []uint32) PatternFlowIcmpEchoType { - obj.setChoice(PatternFlowIcmpEchoTypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIcmpEchoTypeCounter -func (obj *patternFlowIcmpEchoType) Increment() PatternFlowIcmpEchoTypeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIcmpEchoTypeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIcmpEchoTypeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIcmpEchoTypeCounter -func (obj *patternFlowIcmpEchoType) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIcmpEchoTypeCounter value in the PatternFlowIcmpEchoType object -func (obj *patternFlowIcmpEchoType) SetIncrement(value PatternFlowIcmpEchoTypeCounter) PatternFlowIcmpEchoType { - obj.setChoice(PatternFlowIcmpEchoTypeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIcmpEchoTypeCounter -func (obj *patternFlowIcmpEchoType) Decrement() PatternFlowIcmpEchoTypeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIcmpEchoTypeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIcmpEchoTypeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIcmpEchoTypeCounter -func (obj *patternFlowIcmpEchoType) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIcmpEchoTypeCounter value in the PatternFlowIcmpEchoType object -func (obj *patternFlowIcmpEchoType) SetDecrement(value PatternFlowIcmpEchoTypeCounter) PatternFlowIcmpEchoType { - obj.setChoice(PatternFlowIcmpEchoTypeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIcmpEchoTypeMetricTag -func (obj *patternFlowIcmpEchoType) MetricTags() PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIcmpEchoTypeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter struct { - obj *patternFlowIcmpEchoType - patternFlowIcmpEchoTypeMetricTagSlice []PatternFlowIcmpEchoTypeMetricTag - fieldPtr *[]*otg.PatternFlowIcmpEchoTypeMetricTag -} - -func newPatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter(ptr *[]*otg.PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { - return &patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter interface { - setMsg(*patternFlowIcmpEchoType) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter - Items() []PatternFlowIcmpEchoTypeMetricTag - Add() PatternFlowIcmpEchoTypeMetricTag - Append(items ...PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter - Set(index int, newObj PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter - Clear() PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter - clearHolderSlice() PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter - appendHolderSlice(item PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter -} - -func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) setMsg(msg *patternFlowIcmpEchoType) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIcmpEchoTypeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) Items() []PatternFlowIcmpEchoTypeMetricTag { - return obj.patternFlowIcmpEchoTypeMetricTagSlice -} - -func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) Add() PatternFlowIcmpEchoTypeMetricTag { - newObj := &otg.PatternFlowIcmpEchoTypeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIcmpEchoTypeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIcmpEchoTypeMetricTagSlice = append(obj.patternFlowIcmpEchoTypeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) Append(items ...PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIcmpEchoTypeMetricTagSlice = append(obj.patternFlowIcmpEchoTypeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) Set(index int, newObj PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIcmpEchoTypeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) Clear() PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIcmpEchoTypeMetricTag{} - obj.patternFlowIcmpEchoTypeMetricTagSlice = []PatternFlowIcmpEchoTypeMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) clearHolderSlice() PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { - if len(obj.patternFlowIcmpEchoTypeMetricTagSlice) > 0 { - obj.patternFlowIcmpEchoTypeMetricTagSlice = []PatternFlowIcmpEchoTypeMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) appendHolderSlice(item PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { - obj.patternFlowIcmpEchoTypeMetricTagSlice = append(obj.patternFlowIcmpEchoTypeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIcmpEchoType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoType.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIcmpEchoType.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIcmpEchoTypeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIcmpEchoType) setDefault() { - var choices_set int = 0 - var choice PatternFlowIcmpEchoTypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIcmpEchoTypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIcmpEchoTypeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIcmpEchoTypeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIcmpEchoTypeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIcmpEchoTypeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpEchoType") - } - } else { - intVal := otg.PatternFlowIcmpEchoType_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIcmpEchoType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIcmpEchoCode ***** -type patternFlowIcmpEchoCode struct { - validation - obj *otg.PatternFlowIcmpEchoCode - marshaller marshalPatternFlowIcmpEchoCode - unMarshaller unMarshalPatternFlowIcmpEchoCode - incrementHolder PatternFlowIcmpEchoCodeCounter - decrementHolder PatternFlowIcmpEchoCodeCounter - metricTagsHolder PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter -} - -func NewPatternFlowIcmpEchoCode() PatternFlowIcmpEchoCode { - obj := patternFlowIcmpEchoCode{obj: &otg.PatternFlowIcmpEchoCode{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpEchoCode) msg() *otg.PatternFlowIcmpEchoCode { - return obj.obj -} - -func (obj *patternFlowIcmpEchoCode) setMsg(msg *otg.PatternFlowIcmpEchoCode) PatternFlowIcmpEchoCode { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpEchoCode struct { - obj *patternFlowIcmpEchoCode -} - -type marshalPatternFlowIcmpEchoCode interface { - // ToProto marshals PatternFlowIcmpEchoCode to protobuf object *otg.PatternFlowIcmpEchoCode - ToProto() (*otg.PatternFlowIcmpEchoCode, error) - // ToPbText marshals PatternFlowIcmpEchoCode to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpEchoCode to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpEchoCode to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpEchoCode struct { - obj *patternFlowIcmpEchoCode -} - -type unMarshalPatternFlowIcmpEchoCode interface { - // FromProto unmarshals PatternFlowIcmpEchoCode from protobuf object *otg.PatternFlowIcmpEchoCode - FromProto(msg *otg.PatternFlowIcmpEchoCode) (PatternFlowIcmpEchoCode, error) - // FromPbText unmarshals PatternFlowIcmpEchoCode from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpEchoCode from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpEchoCode from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpEchoCode) Marshal() marshalPatternFlowIcmpEchoCode { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpEchoCode{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpEchoCode) Unmarshal() unMarshalPatternFlowIcmpEchoCode { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpEchoCode{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpEchoCode) ToProto() (*otg.PatternFlowIcmpEchoCode, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpEchoCode) FromProto(msg *otg.PatternFlowIcmpEchoCode) (PatternFlowIcmpEchoCode, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpEchoCode) 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 *unMarshalpatternFlowIcmpEchoCode) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIcmpEchoCode) 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 *unMarshalpatternFlowIcmpEchoCode) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIcmpEchoCode) 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 *unMarshalpatternFlowIcmpEchoCode) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIcmpEchoCode) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoCode) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoCode) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpEchoCode) Clone() (PatternFlowIcmpEchoCode, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpEchoCode() - 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 -} - -func (obj *patternFlowIcmpEchoCode) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIcmpEchoCode is the ICMP subtype. The default code for ICMP echo request and reply is 0. -type PatternFlowIcmpEchoCode interface { - Validation - // msg marshals PatternFlowIcmpEchoCode to protobuf object *otg.PatternFlowIcmpEchoCode - // and doesn't set defaults - msg() *otg.PatternFlowIcmpEchoCode - // setMsg unmarshals PatternFlowIcmpEchoCode from protobuf object *otg.PatternFlowIcmpEchoCode - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpEchoCode) PatternFlowIcmpEchoCode - // provides marshal interface - Marshal() marshalPatternFlowIcmpEchoCode - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpEchoCode - // validate validates PatternFlowIcmpEchoCode - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpEchoCode, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIcmpEchoCodeChoiceEnum, set in PatternFlowIcmpEchoCode - Choice() PatternFlowIcmpEchoCodeChoiceEnum - // setChoice assigns PatternFlowIcmpEchoCodeChoiceEnum provided by user to PatternFlowIcmpEchoCode - setChoice(value PatternFlowIcmpEchoCodeChoiceEnum) PatternFlowIcmpEchoCode - // HasChoice checks if Choice has been set in PatternFlowIcmpEchoCode - HasChoice() bool - // Value returns uint32, set in PatternFlowIcmpEchoCode. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIcmpEchoCode - SetValue(value uint32) PatternFlowIcmpEchoCode - // HasValue checks if Value has been set in PatternFlowIcmpEchoCode - HasValue() bool - // Values returns []uint32, set in PatternFlowIcmpEchoCode. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIcmpEchoCode - SetValues(value []uint32) PatternFlowIcmpEchoCode - // Increment returns PatternFlowIcmpEchoCodeCounter, set in PatternFlowIcmpEchoCode. - // PatternFlowIcmpEchoCodeCounter is integer counter pattern - Increment() PatternFlowIcmpEchoCodeCounter - // SetIncrement assigns PatternFlowIcmpEchoCodeCounter provided by user to PatternFlowIcmpEchoCode. - // PatternFlowIcmpEchoCodeCounter is integer counter pattern - SetIncrement(value PatternFlowIcmpEchoCodeCounter) PatternFlowIcmpEchoCode - // HasIncrement checks if Increment has been set in PatternFlowIcmpEchoCode - HasIncrement() bool - // Decrement returns PatternFlowIcmpEchoCodeCounter, set in PatternFlowIcmpEchoCode. - // PatternFlowIcmpEchoCodeCounter is integer counter pattern - Decrement() PatternFlowIcmpEchoCodeCounter - // SetDecrement assigns PatternFlowIcmpEchoCodeCounter provided by user to PatternFlowIcmpEchoCode. - // PatternFlowIcmpEchoCodeCounter is integer counter pattern - SetDecrement(value PatternFlowIcmpEchoCodeCounter) PatternFlowIcmpEchoCode - // HasDecrement checks if Decrement has been set in PatternFlowIcmpEchoCode - HasDecrement() bool - // MetricTags returns PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIterIter, set in PatternFlowIcmpEchoCode - MetricTags() PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter - setNil() -} - -type PatternFlowIcmpEchoCodeChoiceEnum string - -// Enum of Choice on PatternFlowIcmpEchoCode -var PatternFlowIcmpEchoCodeChoice = struct { - VALUE PatternFlowIcmpEchoCodeChoiceEnum - VALUES PatternFlowIcmpEchoCodeChoiceEnum - INCREMENT PatternFlowIcmpEchoCodeChoiceEnum - DECREMENT PatternFlowIcmpEchoCodeChoiceEnum -}{ - VALUE: PatternFlowIcmpEchoCodeChoiceEnum("value"), - VALUES: PatternFlowIcmpEchoCodeChoiceEnum("values"), - INCREMENT: PatternFlowIcmpEchoCodeChoiceEnum("increment"), - DECREMENT: PatternFlowIcmpEchoCodeChoiceEnum("decrement"), -} - -func (obj *patternFlowIcmpEchoCode) Choice() PatternFlowIcmpEchoCodeChoiceEnum { - return PatternFlowIcmpEchoCodeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIcmpEchoCode) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIcmpEchoCode) setChoice(value PatternFlowIcmpEchoCodeChoiceEnum) PatternFlowIcmpEchoCode { - intValue, ok := otg.PatternFlowIcmpEchoCode_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIcmpEchoCodeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIcmpEchoCode_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIcmpEchoCodeChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIcmpEchoCodeChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIcmpEchoCodeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIcmpEchoCodeCounter().msg() - } - - if value == PatternFlowIcmpEchoCodeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIcmpEchoCodeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpEchoCode) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIcmpEchoCodeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpEchoCode) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIcmpEchoCode object -func (obj *patternFlowIcmpEchoCode) SetValue(value uint32) PatternFlowIcmpEchoCode { - obj.setChoice(PatternFlowIcmpEchoCodeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIcmpEchoCode) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIcmpEchoCode object -func (obj *patternFlowIcmpEchoCode) SetValues(value []uint32) PatternFlowIcmpEchoCode { - obj.setChoice(PatternFlowIcmpEchoCodeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIcmpEchoCodeCounter -func (obj *patternFlowIcmpEchoCode) Increment() PatternFlowIcmpEchoCodeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIcmpEchoCodeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIcmpEchoCodeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIcmpEchoCodeCounter -func (obj *patternFlowIcmpEchoCode) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIcmpEchoCodeCounter value in the PatternFlowIcmpEchoCode object -func (obj *patternFlowIcmpEchoCode) SetIncrement(value PatternFlowIcmpEchoCodeCounter) PatternFlowIcmpEchoCode { - obj.setChoice(PatternFlowIcmpEchoCodeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIcmpEchoCodeCounter -func (obj *patternFlowIcmpEchoCode) Decrement() PatternFlowIcmpEchoCodeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIcmpEchoCodeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIcmpEchoCodeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIcmpEchoCodeCounter -func (obj *patternFlowIcmpEchoCode) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIcmpEchoCodeCounter value in the PatternFlowIcmpEchoCode object -func (obj *patternFlowIcmpEchoCode) SetDecrement(value PatternFlowIcmpEchoCodeCounter) PatternFlowIcmpEchoCode { - obj.setChoice(PatternFlowIcmpEchoCodeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIcmpEchoCodeMetricTag -func (obj *patternFlowIcmpEchoCode) MetricTags() PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIcmpEchoCodeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter struct { - obj *patternFlowIcmpEchoCode - patternFlowIcmpEchoCodeMetricTagSlice []PatternFlowIcmpEchoCodeMetricTag - fieldPtr *[]*otg.PatternFlowIcmpEchoCodeMetricTag -} - -func newPatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter(ptr *[]*otg.PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { - return &patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter interface { - setMsg(*patternFlowIcmpEchoCode) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter - Items() []PatternFlowIcmpEchoCodeMetricTag - Add() PatternFlowIcmpEchoCodeMetricTag - Append(items ...PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter - Set(index int, newObj PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter - Clear() PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter - clearHolderSlice() PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter - appendHolderSlice(item PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter -} - -func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) setMsg(msg *patternFlowIcmpEchoCode) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIcmpEchoCodeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) Items() []PatternFlowIcmpEchoCodeMetricTag { - return obj.patternFlowIcmpEchoCodeMetricTagSlice -} - -func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) Add() PatternFlowIcmpEchoCodeMetricTag { - newObj := &otg.PatternFlowIcmpEchoCodeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIcmpEchoCodeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIcmpEchoCodeMetricTagSlice = append(obj.patternFlowIcmpEchoCodeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) Append(items ...PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIcmpEchoCodeMetricTagSlice = append(obj.patternFlowIcmpEchoCodeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) Set(index int, newObj PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIcmpEchoCodeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) Clear() PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIcmpEchoCodeMetricTag{} - obj.patternFlowIcmpEchoCodeMetricTagSlice = []PatternFlowIcmpEchoCodeMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) clearHolderSlice() PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { - if len(obj.patternFlowIcmpEchoCodeMetricTagSlice) > 0 { - obj.patternFlowIcmpEchoCodeMetricTagSlice = []PatternFlowIcmpEchoCodeMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) appendHolderSlice(item PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { - obj.patternFlowIcmpEchoCodeMetricTagSlice = append(obj.patternFlowIcmpEchoCodeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIcmpEchoCode) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoCode.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIcmpEchoCode.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIcmpEchoCodeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIcmpEchoCode) setDefault() { - var choices_set int = 0 - var choice PatternFlowIcmpEchoCodeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIcmpEchoCodeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIcmpEchoCodeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIcmpEchoCodeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIcmpEchoCodeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIcmpEchoCodeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpEchoCode") - } - } else { - intVal := otg.PatternFlowIcmpEchoCode_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIcmpEchoCode_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIcmpEchoChecksum ***** -type patternFlowIcmpEchoChecksum struct { - validation - obj *otg.PatternFlowIcmpEchoChecksum - marshaller marshalPatternFlowIcmpEchoChecksum - unMarshaller unMarshalPatternFlowIcmpEchoChecksum -} - -func NewPatternFlowIcmpEchoChecksum() PatternFlowIcmpEchoChecksum { - obj := patternFlowIcmpEchoChecksum{obj: &otg.PatternFlowIcmpEchoChecksum{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpEchoChecksum) msg() *otg.PatternFlowIcmpEchoChecksum { - return obj.obj -} - -func (obj *patternFlowIcmpEchoChecksum) setMsg(msg *otg.PatternFlowIcmpEchoChecksum) PatternFlowIcmpEchoChecksum { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpEchoChecksum struct { - obj *patternFlowIcmpEchoChecksum -} - -type marshalPatternFlowIcmpEchoChecksum interface { - // ToProto marshals PatternFlowIcmpEchoChecksum to protobuf object *otg.PatternFlowIcmpEchoChecksum - ToProto() (*otg.PatternFlowIcmpEchoChecksum, error) - // ToPbText marshals PatternFlowIcmpEchoChecksum to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpEchoChecksum to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpEchoChecksum to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpEchoChecksum struct { - obj *patternFlowIcmpEchoChecksum -} - -type unMarshalPatternFlowIcmpEchoChecksum interface { - // FromProto unmarshals PatternFlowIcmpEchoChecksum from protobuf object *otg.PatternFlowIcmpEchoChecksum - FromProto(msg *otg.PatternFlowIcmpEchoChecksum) (PatternFlowIcmpEchoChecksum, error) - // FromPbText unmarshals PatternFlowIcmpEchoChecksum from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpEchoChecksum from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpEchoChecksum from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpEchoChecksum) Marshal() marshalPatternFlowIcmpEchoChecksum { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpEchoChecksum{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpEchoChecksum) Unmarshal() unMarshalPatternFlowIcmpEchoChecksum { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpEchoChecksum{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpEchoChecksum) ToProto() (*otg.PatternFlowIcmpEchoChecksum, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpEchoChecksum) FromProto(msg *otg.PatternFlowIcmpEchoChecksum) (PatternFlowIcmpEchoChecksum, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpEchoChecksum) 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 *unMarshalpatternFlowIcmpEchoChecksum) 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 *marshalpatternFlowIcmpEchoChecksum) 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 *unMarshalpatternFlowIcmpEchoChecksum) 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 *marshalpatternFlowIcmpEchoChecksum) 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 *unMarshalpatternFlowIcmpEchoChecksum) 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 *patternFlowIcmpEchoChecksum) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoChecksum) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoChecksum) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpEchoChecksum) Clone() (PatternFlowIcmpEchoChecksum, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpEchoChecksum() - 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 -} - -// PatternFlowIcmpEchoChecksum is iCMP checksum -type PatternFlowIcmpEchoChecksum interface { - Validation - // msg marshals PatternFlowIcmpEchoChecksum to protobuf object *otg.PatternFlowIcmpEchoChecksum - // and doesn't set defaults - msg() *otg.PatternFlowIcmpEchoChecksum - // setMsg unmarshals PatternFlowIcmpEchoChecksum from protobuf object *otg.PatternFlowIcmpEchoChecksum - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpEchoChecksum) PatternFlowIcmpEchoChecksum - // provides marshal interface - Marshal() marshalPatternFlowIcmpEchoChecksum - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpEchoChecksum - // validate validates PatternFlowIcmpEchoChecksum - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpEchoChecksum, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIcmpEchoChecksumChoiceEnum, set in PatternFlowIcmpEchoChecksum - Choice() PatternFlowIcmpEchoChecksumChoiceEnum - // setChoice assigns PatternFlowIcmpEchoChecksumChoiceEnum provided by user to PatternFlowIcmpEchoChecksum - setChoice(value PatternFlowIcmpEchoChecksumChoiceEnum) PatternFlowIcmpEchoChecksum - // HasChoice checks if Choice has been set in PatternFlowIcmpEchoChecksum - HasChoice() bool - // Generated returns PatternFlowIcmpEchoChecksumGeneratedEnum, set in PatternFlowIcmpEchoChecksum - Generated() PatternFlowIcmpEchoChecksumGeneratedEnum - // SetGenerated assigns PatternFlowIcmpEchoChecksumGeneratedEnum provided by user to PatternFlowIcmpEchoChecksum - SetGenerated(value PatternFlowIcmpEchoChecksumGeneratedEnum) PatternFlowIcmpEchoChecksum - // HasGenerated checks if Generated has been set in PatternFlowIcmpEchoChecksum - HasGenerated() bool - // Custom returns uint32, set in PatternFlowIcmpEchoChecksum. - Custom() uint32 - // SetCustom assigns uint32 provided by user to PatternFlowIcmpEchoChecksum - SetCustom(value uint32) PatternFlowIcmpEchoChecksum - // HasCustom checks if Custom has been set in PatternFlowIcmpEchoChecksum - HasCustom() bool -} - -type PatternFlowIcmpEchoChecksumChoiceEnum string - -// Enum of Choice on PatternFlowIcmpEchoChecksum -var PatternFlowIcmpEchoChecksumChoice = struct { - GENERATED PatternFlowIcmpEchoChecksumChoiceEnum - CUSTOM PatternFlowIcmpEchoChecksumChoiceEnum -}{ - GENERATED: PatternFlowIcmpEchoChecksumChoiceEnum("generated"), - CUSTOM: PatternFlowIcmpEchoChecksumChoiceEnum("custom"), -} - -func (obj *patternFlowIcmpEchoChecksum) Choice() PatternFlowIcmpEchoChecksumChoiceEnum { - return PatternFlowIcmpEchoChecksumChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The type of checksum -// Choice returns a string -func (obj *patternFlowIcmpEchoChecksum) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIcmpEchoChecksum) setChoice(value PatternFlowIcmpEchoChecksumChoiceEnum) PatternFlowIcmpEchoChecksum { - intValue, ok := otg.PatternFlowIcmpEchoChecksum_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIcmpEchoChecksumChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIcmpEchoChecksum_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Custom = nil - obj.obj.Generated = otg.PatternFlowIcmpEchoChecksum_Generated_unspecified.Enum() - return obj -} - -type PatternFlowIcmpEchoChecksumGeneratedEnum string - -// Enum of Generated on PatternFlowIcmpEchoChecksum -var PatternFlowIcmpEchoChecksumGenerated = struct { - GOOD PatternFlowIcmpEchoChecksumGeneratedEnum - BAD PatternFlowIcmpEchoChecksumGeneratedEnum -}{ - GOOD: PatternFlowIcmpEchoChecksumGeneratedEnum("good"), - BAD: PatternFlowIcmpEchoChecksumGeneratedEnum("bad"), -} - -func (obj *patternFlowIcmpEchoChecksum) Generated() PatternFlowIcmpEchoChecksumGeneratedEnum { - return PatternFlowIcmpEchoChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) -} - -// A system generated checksum value -// Generated returns a string -func (obj *patternFlowIcmpEchoChecksum) HasGenerated() bool { - return obj.obj.Generated != nil -} - -func (obj *patternFlowIcmpEchoChecksum) SetGenerated(value PatternFlowIcmpEchoChecksumGeneratedEnum) PatternFlowIcmpEchoChecksum { - intValue, ok := otg.PatternFlowIcmpEchoChecksum_Generated_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIcmpEchoChecksumGeneratedEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIcmpEchoChecksum_Generated_Enum(intValue) - obj.obj.Generated = &enumValue - - return obj -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowIcmpEchoChecksum) Custom() uint32 { - - if obj.obj.Custom == nil { - obj.setChoice(PatternFlowIcmpEchoChecksumChoice.CUSTOM) - } - - return *obj.obj.Custom - -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowIcmpEchoChecksum) HasCustom() bool { - return obj.obj.Custom != nil -} - -// A custom checksum value -// SetCustom sets the uint32 value in the PatternFlowIcmpEchoChecksum object -func (obj *patternFlowIcmpEchoChecksum) SetCustom(value uint32) PatternFlowIcmpEchoChecksum { - obj.setChoice(PatternFlowIcmpEchoChecksumChoice.CUSTOM) - obj.obj.Custom = &value - return obj -} - -func (obj *patternFlowIcmpEchoChecksum) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Custom != nil { - - if *obj.obj.Custom > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoChecksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) - } - - } - -} - -func (obj *patternFlowIcmpEchoChecksum) setDefault() { - var choices_set int = 0 - var choice PatternFlowIcmpEchoChecksumChoiceEnum - - if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { - choices_set += 1 - choice = PatternFlowIcmpEchoChecksumChoice.GENERATED - } - - if obj.obj.Custom != nil { - choices_set += 1 - choice = PatternFlowIcmpEchoChecksumChoice.CUSTOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIcmpEchoChecksumChoice.GENERATED) - if obj.obj.Generated.Number() == 0 { - obj.SetGenerated(PatternFlowIcmpEchoChecksumGenerated.GOOD) - - } - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpEchoChecksum") - } - } else { - intVal := otg.PatternFlowIcmpEchoChecksum_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIcmpEchoChecksum_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIcmpEchoIdentifier ***** -type patternFlowIcmpEchoIdentifier struct { - validation - obj *otg.PatternFlowIcmpEchoIdentifier - marshaller marshalPatternFlowIcmpEchoIdentifier - unMarshaller unMarshalPatternFlowIcmpEchoIdentifier - incrementHolder PatternFlowIcmpEchoIdentifierCounter - decrementHolder PatternFlowIcmpEchoIdentifierCounter - metricTagsHolder PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter -} - -func NewPatternFlowIcmpEchoIdentifier() PatternFlowIcmpEchoIdentifier { - obj := patternFlowIcmpEchoIdentifier{obj: &otg.PatternFlowIcmpEchoIdentifier{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpEchoIdentifier) msg() *otg.PatternFlowIcmpEchoIdentifier { - return obj.obj -} - -func (obj *patternFlowIcmpEchoIdentifier) setMsg(msg *otg.PatternFlowIcmpEchoIdentifier) PatternFlowIcmpEchoIdentifier { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpEchoIdentifier struct { - obj *patternFlowIcmpEchoIdentifier -} - -type marshalPatternFlowIcmpEchoIdentifier interface { - // ToProto marshals PatternFlowIcmpEchoIdentifier to protobuf object *otg.PatternFlowIcmpEchoIdentifier - ToProto() (*otg.PatternFlowIcmpEchoIdentifier, error) - // ToPbText marshals PatternFlowIcmpEchoIdentifier to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpEchoIdentifier to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpEchoIdentifier to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpEchoIdentifier struct { - obj *patternFlowIcmpEchoIdentifier -} - -type unMarshalPatternFlowIcmpEchoIdentifier interface { - // FromProto unmarshals PatternFlowIcmpEchoIdentifier from protobuf object *otg.PatternFlowIcmpEchoIdentifier - FromProto(msg *otg.PatternFlowIcmpEchoIdentifier) (PatternFlowIcmpEchoIdentifier, error) - // FromPbText unmarshals PatternFlowIcmpEchoIdentifier from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpEchoIdentifier from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpEchoIdentifier from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpEchoIdentifier) Marshal() marshalPatternFlowIcmpEchoIdentifier { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpEchoIdentifier{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpEchoIdentifier) Unmarshal() unMarshalPatternFlowIcmpEchoIdentifier { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpEchoIdentifier{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpEchoIdentifier) ToProto() (*otg.PatternFlowIcmpEchoIdentifier, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpEchoIdentifier) FromProto(msg *otg.PatternFlowIcmpEchoIdentifier) (PatternFlowIcmpEchoIdentifier, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpEchoIdentifier) 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 *unMarshalpatternFlowIcmpEchoIdentifier) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIcmpEchoIdentifier) 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 *unMarshalpatternFlowIcmpEchoIdentifier) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIcmpEchoIdentifier) 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 *unMarshalpatternFlowIcmpEchoIdentifier) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIcmpEchoIdentifier) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoIdentifier) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoIdentifier) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpEchoIdentifier) Clone() (PatternFlowIcmpEchoIdentifier, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpEchoIdentifier() - 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 -} - -func (obj *patternFlowIcmpEchoIdentifier) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIcmpEchoIdentifier is iCMP identifier -type PatternFlowIcmpEchoIdentifier interface { - Validation - // msg marshals PatternFlowIcmpEchoIdentifier to protobuf object *otg.PatternFlowIcmpEchoIdentifier - // and doesn't set defaults - msg() *otg.PatternFlowIcmpEchoIdentifier - // setMsg unmarshals PatternFlowIcmpEchoIdentifier from protobuf object *otg.PatternFlowIcmpEchoIdentifier - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpEchoIdentifier) PatternFlowIcmpEchoIdentifier - // provides marshal interface - Marshal() marshalPatternFlowIcmpEchoIdentifier - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpEchoIdentifier - // validate validates PatternFlowIcmpEchoIdentifier - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpEchoIdentifier, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIcmpEchoIdentifierChoiceEnum, set in PatternFlowIcmpEchoIdentifier - Choice() PatternFlowIcmpEchoIdentifierChoiceEnum - // setChoice assigns PatternFlowIcmpEchoIdentifierChoiceEnum provided by user to PatternFlowIcmpEchoIdentifier - setChoice(value PatternFlowIcmpEchoIdentifierChoiceEnum) PatternFlowIcmpEchoIdentifier - // HasChoice checks if Choice has been set in PatternFlowIcmpEchoIdentifier - HasChoice() bool - // Value returns uint32, set in PatternFlowIcmpEchoIdentifier. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIcmpEchoIdentifier - SetValue(value uint32) PatternFlowIcmpEchoIdentifier - // HasValue checks if Value has been set in PatternFlowIcmpEchoIdentifier - HasValue() bool - // Values returns []uint32, set in PatternFlowIcmpEchoIdentifier. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIcmpEchoIdentifier - SetValues(value []uint32) PatternFlowIcmpEchoIdentifier - // Increment returns PatternFlowIcmpEchoIdentifierCounter, set in PatternFlowIcmpEchoIdentifier. - // PatternFlowIcmpEchoIdentifierCounter is integer counter pattern - Increment() PatternFlowIcmpEchoIdentifierCounter - // SetIncrement assigns PatternFlowIcmpEchoIdentifierCounter provided by user to PatternFlowIcmpEchoIdentifier. - // PatternFlowIcmpEchoIdentifierCounter is integer counter pattern - SetIncrement(value PatternFlowIcmpEchoIdentifierCounter) PatternFlowIcmpEchoIdentifier - // HasIncrement checks if Increment has been set in PatternFlowIcmpEchoIdentifier - HasIncrement() bool - // Decrement returns PatternFlowIcmpEchoIdentifierCounter, set in PatternFlowIcmpEchoIdentifier. - // PatternFlowIcmpEchoIdentifierCounter is integer counter pattern - Decrement() PatternFlowIcmpEchoIdentifierCounter - // SetDecrement assigns PatternFlowIcmpEchoIdentifierCounter provided by user to PatternFlowIcmpEchoIdentifier. - // PatternFlowIcmpEchoIdentifierCounter is integer counter pattern - SetDecrement(value PatternFlowIcmpEchoIdentifierCounter) PatternFlowIcmpEchoIdentifier - // HasDecrement checks if Decrement has been set in PatternFlowIcmpEchoIdentifier - HasDecrement() bool - // MetricTags returns PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIterIter, set in PatternFlowIcmpEchoIdentifier - MetricTags() PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter - setNil() -} - -type PatternFlowIcmpEchoIdentifierChoiceEnum string - -// Enum of Choice on PatternFlowIcmpEchoIdentifier -var PatternFlowIcmpEchoIdentifierChoice = struct { - VALUE PatternFlowIcmpEchoIdentifierChoiceEnum - VALUES PatternFlowIcmpEchoIdentifierChoiceEnum - INCREMENT PatternFlowIcmpEchoIdentifierChoiceEnum - DECREMENT PatternFlowIcmpEchoIdentifierChoiceEnum -}{ - VALUE: PatternFlowIcmpEchoIdentifierChoiceEnum("value"), - VALUES: PatternFlowIcmpEchoIdentifierChoiceEnum("values"), - INCREMENT: PatternFlowIcmpEchoIdentifierChoiceEnum("increment"), - DECREMENT: PatternFlowIcmpEchoIdentifierChoiceEnum("decrement"), -} - -func (obj *patternFlowIcmpEchoIdentifier) Choice() PatternFlowIcmpEchoIdentifierChoiceEnum { - return PatternFlowIcmpEchoIdentifierChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIcmpEchoIdentifier) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIcmpEchoIdentifier) setChoice(value PatternFlowIcmpEchoIdentifierChoiceEnum) PatternFlowIcmpEchoIdentifier { - intValue, ok := otg.PatternFlowIcmpEchoIdentifier_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIcmpEchoIdentifierChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIcmpEchoIdentifier_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIcmpEchoIdentifierChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIcmpEchoIdentifierChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIcmpEchoIdentifierChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIcmpEchoIdentifierCounter().msg() - } - - if value == PatternFlowIcmpEchoIdentifierChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIcmpEchoIdentifierCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpEchoIdentifier) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpEchoIdentifier) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIcmpEchoIdentifier object -func (obj *patternFlowIcmpEchoIdentifier) SetValue(value uint32) PatternFlowIcmpEchoIdentifier { - obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIcmpEchoIdentifier) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIcmpEchoIdentifier object -func (obj *patternFlowIcmpEchoIdentifier) SetValues(value []uint32) PatternFlowIcmpEchoIdentifier { - obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIcmpEchoIdentifierCounter -func (obj *patternFlowIcmpEchoIdentifier) Increment() PatternFlowIcmpEchoIdentifierCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIcmpEchoIdentifierCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIcmpEchoIdentifierCounter -func (obj *patternFlowIcmpEchoIdentifier) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIcmpEchoIdentifierCounter value in the PatternFlowIcmpEchoIdentifier object -func (obj *patternFlowIcmpEchoIdentifier) SetIncrement(value PatternFlowIcmpEchoIdentifierCounter) PatternFlowIcmpEchoIdentifier { - obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIcmpEchoIdentifierCounter -func (obj *patternFlowIcmpEchoIdentifier) Decrement() PatternFlowIcmpEchoIdentifierCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIcmpEchoIdentifierCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIcmpEchoIdentifierCounter -func (obj *patternFlowIcmpEchoIdentifier) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIcmpEchoIdentifierCounter value in the PatternFlowIcmpEchoIdentifier object -func (obj *patternFlowIcmpEchoIdentifier) SetDecrement(value PatternFlowIcmpEchoIdentifierCounter) PatternFlowIcmpEchoIdentifier { - obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIcmpEchoIdentifierMetricTag -func (obj *patternFlowIcmpEchoIdentifier) MetricTags() PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIcmpEchoIdentifierMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter struct { - obj *patternFlowIcmpEchoIdentifier - patternFlowIcmpEchoIdentifierMetricTagSlice []PatternFlowIcmpEchoIdentifierMetricTag - fieldPtr *[]*otg.PatternFlowIcmpEchoIdentifierMetricTag -} - -func newPatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter(ptr *[]*otg.PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { - return &patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter interface { - setMsg(*patternFlowIcmpEchoIdentifier) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter - Items() []PatternFlowIcmpEchoIdentifierMetricTag - Add() PatternFlowIcmpEchoIdentifierMetricTag - Append(items ...PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter - Set(index int, newObj PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter - Clear() PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter - clearHolderSlice() PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter - appendHolderSlice(item PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter -} - -func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) setMsg(msg *patternFlowIcmpEchoIdentifier) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIcmpEchoIdentifierMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) Items() []PatternFlowIcmpEchoIdentifierMetricTag { - return obj.patternFlowIcmpEchoIdentifierMetricTagSlice -} - -func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) Add() PatternFlowIcmpEchoIdentifierMetricTag { - newObj := &otg.PatternFlowIcmpEchoIdentifierMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIcmpEchoIdentifierMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIcmpEchoIdentifierMetricTagSlice = append(obj.patternFlowIcmpEchoIdentifierMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) Append(items ...PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIcmpEchoIdentifierMetricTagSlice = append(obj.patternFlowIcmpEchoIdentifierMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) Set(index int, newObj PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIcmpEchoIdentifierMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) Clear() PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIcmpEchoIdentifierMetricTag{} - obj.patternFlowIcmpEchoIdentifierMetricTagSlice = []PatternFlowIcmpEchoIdentifierMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) clearHolderSlice() PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { - if len(obj.patternFlowIcmpEchoIdentifierMetricTagSlice) > 0 { - obj.patternFlowIcmpEchoIdentifierMetricTagSlice = []PatternFlowIcmpEchoIdentifierMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) appendHolderSlice(item PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { - obj.patternFlowIcmpEchoIdentifierMetricTagSlice = append(obj.patternFlowIcmpEchoIdentifierMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIcmpEchoIdentifier) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoIdentifier.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIcmpEchoIdentifier.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIcmpEchoIdentifierMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIcmpEchoIdentifier) setDefault() { - var choices_set int = 0 - var choice PatternFlowIcmpEchoIdentifierChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIcmpEchoIdentifierChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIcmpEchoIdentifierChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIcmpEchoIdentifierChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIcmpEchoIdentifierChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpEchoIdentifier") - } - } else { - intVal := otg.PatternFlowIcmpEchoIdentifier_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIcmpEchoIdentifier_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIcmpEchoSequenceNumber ***** -type patternFlowIcmpEchoSequenceNumber struct { - validation - obj *otg.PatternFlowIcmpEchoSequenceNumber - marshaller marshalPatternFlowIcmpEchoSequenceNumber - unMarshaller unMarshalPatternFlowIcmpEchoSequenceNumber - incrementHolder PatternFlowIcmpEchoSequenceNumberCounter - decrementHolder PatternFlowIcmpEchoSequenceNumberCounter - metricTagsHolder PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter -} - -func NewPatternFlowIcmpEchoSequenceNumber() PatternFlowIcmpEchoSequenceNumber { - obj := patternFlowIcmpEchoSequenceNumber{obj: &otg.PatternFlowIcmpEchoSequenceNumber{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpEchoSequenceNumber) msg() *otg.PatternFlowIcmpEchoSequenceNumber { - return obj.obj -} - -func (obj *patternFlowIcmpEchoSequenceNumber) setMsg(msg *otg.PatternFlowIcmpEchoSequenceNumber) PatternFlowIcmpEchoSequenceNumber { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpEchoSequenceNumber struct { - obj *patternFlowIcmpEchoSequenceNumber -} - -type marshalPatternFlowIcmpEchoSequenceNumber interface { - // ToProto marshals PatternFlowIcmpEchoSequenceNumber to protobuf object *otg.PatternFlowIcmpEchoSequenceNumber - ToProto() (*otg.PatternFlowIcmpEchoSequenceNumber, error) - // ToPbText marshals PatternFlowIcmpEchoSequenceNumber to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpEchoSequenceNumber to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpEchoSequenceNumber to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpEchoSequenceNumber struct { - obj *patternFlowIcmpEchoSequenceNumber -} - -type unMarshalPatternFlowIcmpEchoSequenceNumber interface { - // FromProto unmarshals PatternFlowIcmpEchoSequenceNumber from protobuf object *otg.PatternFlowIcmpEchoSequenceNumber - FromProto(msg *otg.PatternFlowIcmpEchoSequenceNumber) (PatternFlowIcmpEchoSequenceNumber, error) - // FromPbText unmarshals PatternFlowIcmpEchoSequenceNumber from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpEchoSequenceNumber from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpEchoSequenceNumber from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpEchoSequenceNumber) Marshal() marshalPatternFlowIcmpEchoSequenceNumber { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpEchoSequenceNumber{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpEchoSequenceNumber) Unmarshal() unMarshalPatternFlowIcmpEchoSequenceNumber { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpEchoSequenceNumber{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpEchoSequenceNumber) ToProto() (*otg.PatternFlowIcmpEchoSequenceNumber, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpEchoSequenceNumber) FromProto(msg *otg.PatternFlowIcmpEchoSequenceNumber) (PatternFlowIcmpEchoSequenceNumber, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpEchoSequenceNumber) 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 *unMarshalpatternFlowIcmpEchoSequenceNumber) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIcmpEchoSequenceNumber) 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 *unMarshalpatternFlowIcmpEchoSequenceNumber) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIcmpEchoSequenceNumber) 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 *unMarshalpatternFlowIcmpEchoSequenceNumber) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIcmpEchoSequenceNumber) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoSequenceNumber) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoSequenceNumber) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpEchoSequenceNumber) Clone() (PatternFlowIcmpEchoSequenceNumber, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpEchoSequenceNumber() - 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 -} - -func (obj *patternFlowIcmpEchoSequenceNumber) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIcmpEchoSequenceNumber is iCMP sequence number -type PatternFlowIcmpEchoSequenceNumber interface { - Validation - // msg marshals PatternFlowIcmpEchoSequenceNumber to protobuf object *otg.PatternFlowIcmpEchoSequenceNumber - // and doesn't set defaults - msg() *otg.PatternFlowIcmpEchoSequenceNumber - // setMsg unmarshals PatternFlowIcmpEchoSequenceNumber from protobuf object *otg.PatternFlowIcmpEchoSequenceNumber - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpEchoSequenceNumber) PatternFlowIcmpEchoSequenceNumber - // provides marshal interface - Marshal() marshalPatternFlowIcmpEchoSequenceNumber - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpEchoSequenceNumber - // validate validates PatternFlowIcmpEchoSequenceNumber - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpEchoSequenceNumber, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIcmpEchoSequenceNumberChoiceEnum, set in PatternFlowIcmpEchoSequenceNumber - Choice() PatternFlowIcmpEchoSequenceNumberChoiceEnum - // setChoice assigns PatternFlowIcmpEchoSequenceNumberChoiceEnum provided by user to PatternFlowIcmpEchoSequenceNumber - setChoice(value PatternFlowIcmpEchoSequenceNumberChoiceEnum) PatternFlowIcmpEchoSequenceNumber - // HasChoice checks if Choice has been set in PatternFlowIcmpEchoSequenceNumber - HasChoice() bool - // Value returns uint32, set in PatternFlowIcmpEchoSequenceNumber. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIcmpEchoSequenceNumber - SetValue(value uint32) PatternFlowIcmpEchoSequenceNumber - // HasValue checks if Value has been set in PatternFlowIcmpEchoSequenceNumber - HasValue() bool - // Values returns []uint32, set in PatternFlowIcmpEchoSequenceNumber. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIcmpEchoSequenceNumber - SetValues(value []uint32) PatternFlowIcmpEchoSequenceNumber - // Increment returns PatternFlowIcmpEchoSequenceNumberCounter, set in PatternFlowIcmpEchoSequenceNumber. - // PatternFlowIcmpEchoSequenceNumberCounter is integer counter pattern - Increment() PatternFlowIcmpEchoSequenceNumberCounter - // SetIncrement assigns PatternFlowIcmpEchoSequenceNumberCounter provided by user to PatternFlowIcmpEchoSequenceNumber. - // PatternFlowIcmpEchoSequenceNumberCounter is integer counter pattern - SetIncrement(value PatternFlowIcmpEchoSequenceNumberCounter) PatternFlowIcmpEchoSequenceNumber - // HasIncrement checks if Increment has been set in PatternFlowIcmpEchoSequenceNumber - HasIncrement() bool - // Decrement returns PatternFlowIcmpEchoSequenceNumberCounter, set in PatternFlowIcmpEchoSequenceNumber. - // PatternFlowIcmpEchoSequenceNumberCounter is integer counter pattern - Decrement() PatternFlowIcmpEchoSequenceNumberCounter - // SetDecrement assigns PatternFlowIcmpEchoSequenceNumberCounter provided by user to PatternFlowIcmpEchoSequenceNumber. - // PatternFlowIcmpEchoSequenceNumberCounter is integer counter pattern - SetDecrement(value PatternFlowIcmpEchoSequenceNumberCounter) PatternFlowIcmpEchoSequenceNumber - // HasDecrement checks if Decrement has been set in PatternFlowIcmpEchoSequenceNumber - HasDecrement() bool - // MetricTags returns PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIterIter, set in PatternFlowIcmpEchoSequenceNumber - MetricTags() PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter - setNil() -} - -type PatternFlowIcmpEchoSequenceNumberChoiceEnum string - -// Enum of Choice on PatternFlowIcmpEchoSequenceNumber -var PatternFlowIcmpEchoSequenceNumberChoice = struct { - VALUE PatternFlowIcmpEchoSequenceNumberChoiceEnum - VALUES PatternFlowIcmpEchoSequenceNumberChoiceEnum - INCREMENT PatternFlowIcmpEchoSequenceNumberChoiceEnum - DECREMENT PatternFlowIcmpEchoSequenceNumberChoiceEnum -}{ - VALUE: PatternFlowIcmpEchoSequenceNumberChoiceEnum("value"), - VALUES: PatternFlowIcmpEchoSequenceNumberChoiceEnum("values"), - INCREMENT: PatternFlowIcmpEchoSequenceNumberChoiceEnum("increment"), - DECREMENT: PatternFlowIcmpEchoSequenceNumberChoiceEnum("decrement"), -} - -func (obj *patternFlowIcmpEchoSequenceNumber) Choice() PatternFlowIcmpEchoSequenceNumberChoiceEnum { - return PatternFlowIcmpEchoSequenceNumberChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIcmpEchoSequenceNumber) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIcmpEchoSequenceNumber) setChoice(value PatternFlowIcmpEchoSequenceNumberChoiceEnum) PatternFlowIcmpEchoSequenceNumber { - intValue, ok := otg.PatternFlowIcmpEchoSequenceNumber_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIcmpEchoSequenceNumberChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIcmpEchoSequenceNumber_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIcmpEchoSequenceNumberChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIcmpEchoSequenceNumberChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIcmpEchoSequenceNumberChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIcmpEchoSequenceNumberCounter().msg() - } - - if value == PatternFlowIcmpEchoSequenceNumberChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIcmpEchoSequenceNumberCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpEchoSequenceNumber) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpEchoSequenceNumber) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIcmpEchoSequenceNumber object -func (obj *patternFlowIcmpEchoSequenceNumber) SetValue(value uint32) PatternFlowIcmpEchoSequenceNumber { - obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIcmpEchoSequenceNumber) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIcmpEchoSequenceNumber object -func (obj *patternFlowIcmpEchoSequenceNumber) SetValues(value []uint32) PatternFlowIcmpEchoSequenceNumber { - obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIcmpEchoSequenceNumberCounter -func (obj *patternFlowIcmpEchoSequenceNumber) Increment() PatternFlowIcmpEchoSequenceNumberCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIcmpEchoSequenceNumberCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIcmpEchoSequenceNumberCounter -func (obj *patternFlowIcmpEchoSequenceNumber) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIcmpEchoSequenceNumberCounter value in the PatternFlowIcmpEchoSequenceNumber object -func (obj *patternFlowIcmpEchoSequenceNumber) SetIncrement(value PatternFlowIcmpEchoSequenceNumberCounter) PatternFlowIcmpEchoSequenceNumber { - obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIcmpEchoSequenceNumberCounter -func (obj *patternFlowIcmpEchoSequenceNumber) Decrement() PatternFlowIcmpEchoSequenceNumberCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIcmpEchoSequenceNumberCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIcmpEchoSequenceNumberCounter -func (obj *patternFlowIcmpEchoSequenceNumber) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIcmpEchoSequenceNumberCounter value in the PatternFlowIcmpEchoSequenceNumber object -func (obj *patternFlowIcmpEchoSequenceNumber) SetDecrement(value PatternFlowIcmpEchoSequenceNumberCounter) PatternFlowIcmpEchoSequenceNumber { - obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIcmpEchoSequenceNumberMetricTag -func (obj *patternFlowIcmpEchoSequenceNumber) MetricTags() PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIcmpEchoSequenceNumberMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter struct { - obj *patternFlowIcmpEchoSequenceNumber - patternFlowIcmpEchoSequenceNumberMetricTagSlice []PatternFlowIcmpEchoSequenceNumberMetricTag - fieldPtr *[]*otg.PatternFlowIcmpEchoSequenceNumberMetricTag -} - -func newPatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter(ptr *[]*otg.PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { - return &patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter interface { - setMsg(*patternFlowIcmpEchoSequenceNumber) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter - Items() []PatternFlowIcmpEchoSequenceNumberMetricTag - Add() PatternFlowIcmpEchoSequenceNumberMetricTag - Append(items ...PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter - Set(index int, newObj PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter - Clear() PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter - clearHolderSlice() PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter - appendHolderSlice(item PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter -} - -func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) setMsg(msg *patternFlowIcmpEchoSequenceNumber) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIcmpEchoSequenceNumberMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) Items() []PatternFlowIcmpEchoSequenceNumberMetricTag { - return obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice -} - -func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) Add() PatternFlowIcmpEchoSequenceNumberMetricTag { - newObj := &otg.PatternFlowIcmpEchoSequenceNumberMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIcmpEchoSequenceNumberMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice = append(obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) Append(items ...PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice = append(obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) Set(index int, newObj PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) Clear() PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIcmpEchoSequenceNumberMetricTag{} - obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice = []PatternFlowIcmpEchoSequenceNumberMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) clearHolderSlice() PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { - if len(obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice) > 0 { - obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice = []PatternFlowIcmpEchoSequenceNumberMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) appendHolderSlice(item PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { - obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice = append(obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIcmpEchoSequenceNumber) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoSequenceNumber.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIcmpEchoSequenceNumber.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIcmpEchoSequenceNumberMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIcmpEchoSequenceNumber) setDefault() { - var choices_set int = 0 - var choice PatternFlowIcmpEchoSequenceNumberChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIcmpEchoSequenceNumberChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIcmpEchoSequenceNumberChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIcmpEchoSequenceNumberChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIcmpEchoSequenceNumberChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpEchoSequenceNumber") - } - } else { - intVal := otg.PatternFlowIcmpEchoSequenceNumber_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIcmpEchoSequenceNumber_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIcmpv6EchoType ***** -type patternFlowIcmpv6EchoType struct { - validation - obj *otg.PatternFlowIcmpv6EchoType - marshaller marshalPatternFlowIcmpv6EchoType - unMarshaller unMarshalPatternFlowIcmpv6EchoType - incrementHolder PatternFlowIcmpv6EchoTypeCounter - decrementHolder PatternFlowIcmpv6EchoTypeCounter - metricTagsHolder PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter -} - -func NewPatternFlowIcmpv6EchoType() PatternFlowIcmpv6EchoType { - obj := patternFlowIcmpv6EchoType{obj: &otg.PatternFlowIcmpv6EchoType{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpv6EchoType) msg() *otg.PatternFlowIcmpv6EchoType { - return obj.obj -} - -func (obj *patternFlowIcmpv6EchoType) setMsg(msg *otg.PatternFlowIcmpv6EchoType) PatternFlowIcmpv6EchoType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpv6EchoType struct { - obj *patternFlowIcmpv6EchoType -} - -type marshalPatternFlowIcmpv6EchoType interface { - // ToProto marshals PatternFlowIcmpv6EchoType to protobuf object *otg.PatternFlowIcmpv6EchoType - ToProto() (*otg.PatternFlowIcmpv6EchoType, error) - // ToPbText marshals PatternFlowIcmpv6EchoType to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpv6EchoType to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpv6EchoType to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpv6EchoType struct { - obj *patternFlowIcmpv6EchoType -} - -type unMarshalPatternFlowIcmpv6EchoType interface { - // FromProto unmarshals PatternFlowIcmpv6EchoType from protobuf object *otg.PatternFlowIcmpv6EchoType - FromProto(msg *otg.PatternFlowIcmpv6EchoType) (PatternFlowIcmpv6EchoType, error) - // FromPbText unmarshals PatternFlowIcmpv6EchoType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpv6EchoType from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpv6EchoType from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpv6EchoType) Marshal() marshalPatternFlowIcmpv6EchoType { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpv6EchoType{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpv6EchoType) Unmarshal() unMarshalPatternFlowIcmpv6EchoType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpv6EchoType) ToProto() (*otg.PatternFlowIcmpv6EchoType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpv6EchoType) FromProto(msg *otg.PatternFlowIcmpv6EchoType) (PatternFlowIcmpv6EchoType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpv6EchoType) 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 *unMarshalpatternFlowIcmpv6EchoType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIcmpv6EchoType) 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 *unMarshalpatternFlowIcmpv6EchoType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIcmpv6EchoType) 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 *unMarshalpatternFlowIcmpv6EchoType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIcmpv6EchoType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpv6EchoType) Clone() (PatternFlowIcmpv6EchoType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpv6EchoType() - 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 -} - -func (obj *patternFlowIcmpv6EchoType) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIcmpv6EchoType is iCMPv6 echo type -type PatternFlowIcmpv6EchoType interface { - Validation - // msg marshals PatternFlowIcmpv6EchoType to protobuf object *otg.PatternFlowIcmpv6EchoType - // and doesn't set defaults - msg() *otg.PatternFlowIcmpv6EchoType - // setMsg unmarshals PatternFlowIcmpv6EchoType from protobuf object *otg.PatternFlowIcmpv6EchoType - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpv6EchoType) PatternFlowIcmpv6EchoType - // provides marshal interface - Marshal() marshalPatternFlowIcmpv6EchoType - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpv6EchoType - // validate validates PatternFlowIcmpv6EchoType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpv6EchoType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIcmpv6EchoTypeChoiceEnum, set in PatternFlowIcmpv6EchoType - Choice() PatternFlowIcmpv6EchoTypeChoiceEnum - // setChoice assigns PatternFlowIcmpv6EchoTypeChoiceEnum provided by user to PatternFlowIcmpv6EchoType - setChoice(value PatternFlowIcmpv6EchoTypeChoiceEnum) PatternFlowIcmpv6EchoType - // HasChoice checks if Choice has been set in PatternFlowIcmpv6EchoType - HasChoice() bool - // Value returns uint32, set in PatternFlowIcmpv6EchoType. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIcmpv6EchoType - SetValue(value uint32) PatternFlowIcmpv6EchoType - // HasValue checks if Value has been set in PatternFlowIcmpv6EchoType - HasValue() bool - // Values returns []uint32, set in PatternFlowIcmpv6EchoType. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIcmpv6EchoType - SetValues(value []uint32) PatternFlowIcmpv6EchoType - // Increment returns PatternFlowIcmpv6EchoTypeCounter, set in PatternFlowIcmpv6EchoType. - // PatternFlowIcmpv6EchoTypeCounter is integer counter pattern - Increment() PatternFlowIcmpv6EchoTypeCounter - // SetIncrement assigns PatternFlowIcmpv6EchoTypeCounter provided by user to PatternFlowIcmpv6EchoType. - // PatternFlowIcmpv6EchoTypeCounter is integer counter pattern - SetIncrement(value PatternFlowIcmpv6EchoTypeCounter) PatternFlowIcmpv6EchoType - // HasIncrement checks if Increment has been set in PatternFlowIcmpv6EchoType - HasIncrement() bool - // Decrement returns PatternFlowIcmpv6EchoTypeCounter, set in PatternFlowIcmpv6EchoType. - // PatternFlowIcmpv6EchoTypeCounter is integer counter pattern - Decrement() PatternFlowIcmpv6EchoTypeCounter - // SetDecrement assigns PatternFlowIcmpv6EchoTypeCounter provided by user to PatternFlowIcmpv6EchoType. - // PatternFlowIcmpv6EchoTypeCounter is integer counter pattern - SetDecrement(value PatternFlowIcmpv6EchoTypeCounter) PatternFlowIcmpv6EchoType - // HasDecrement checks if Decrement has been set in PatternFlowIcmpv6EchoType - HasDecrement() bool - // MetricTags returns PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIterIter, set in PatternFlowIcmpv6EchoType - MetricTags() PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter - setNil() -} - -type PatternFlowIcmpv6EchoTypeChoiceEnum string - -// Enum of Choice on PatternFlowIcmpv6EchoType -var PatternFlowIcmpv6EchoTypeChoice = struct { - VALUE PatternFlowIcmpv6EchoTypeChoiceEnum - VALUES PatternFlowIcmpv6EchoTypeChoiceEnum - INCREMENT PatternFlowIcmpv6EchoTypeChoiceEnum - DECREMENT PatternFlowIcmpv6EchoTypeChoiceEnum -}{ - VALUE: PatternFlowIcmpv6EchoTypeChoiceEnum("value"), - VALUES: PatternFlowIcmpv6EchoTypeChoiceEnum("values"), - INCREMENT: PatternFlowIcmpv6EchoTypeChoiceEnum("increment"), - DECREMENT: PatternFlowIcmpv6EchoTypeChoiceEnum("decrement"), -} - -func (obj *patternFlowIcmpv6EchoType) Choice() PatternFlowIcmpv6EchoTypeChoiceEnum { - return PatternFlowIcmpv6EchoTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIcmpv6EchoType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIcmpv6EchoType) setChoice(value PatternFlowIcmpv6EchoTypeChoiceEnum) PatternFlowIcmpv6EchoType { - intValue, ok := otg.PatternFlowIcmpv6EchoType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIcmpv6EchoTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIcmpv6EchoType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIcmpv6EchoTypeChoice.VALUE { - defaultValue := uint32(128) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIcmpv6EchoTypeChoice.VALUES { - defaultValue := []uint32{128} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIcmpv6EchoTypeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIcmpv6EchoTypeCounter().msg() - } - - if value == PatternFlowIcmpv6EchoTypeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIcmpv6EchoTypeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpv6EchoType) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpv6EchoType) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIcmpv6EchoType object -func (obj *patternFlowIcmpv6EchoType) SetValue(value uint32) PatternFlowIcmpv6EchoType { - obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIcmpv6EchoType) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{128}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIcmpv6EchoType object -func (obj *patternFlowIcmpv6EchoType) SetValues(value []uint32) PatternFlowIcmpv6EchoType { - obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIcmpv6EchoTypeCounter -func (obj *patternFlowIcmpv6EchoType) Increment() PatternFlowIcmpv6EchoTypeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIcmpv6EchoTypeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIcmpv6EchoTypeCounter -func (obj *patternFlowIcmpv6EchoType) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIcmpv6EchoTypeCounter value in the PatternFlowIcmpv6EchoType object -func (obj *patternFlowIcmpv6EchoType) SetIncrement(value PatternFlowIcmpv6EchoTypeCounter) PatternFlowIcmpv6EchoType { - obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIcmpv6EchoTypeCounter -func (obj *patternFlowIcmpv6EchoType) Decrement() PatternFlowIcmpv6EchoTypeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIcmpv6EchoTypeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIcmpv6EchoTypeCounter -func (obj *patternFlowIcmpv6EchoType) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIcmpv6EchoTypeCounter value in the PatternFlowIcmpv6EchoType object -func (obj *patternFlowIcmpv6EchoType) SetDecrement(value PatternFlowIcmpv6EchoTypeCounter) PatternFlowIcmpv6EchoType { - obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIcmpv6EchoTypeMetricTag -func (obj *patternFlowIcmpv6EchoType) MetricTags() PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIcmpv6EchoTypeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter struct { - obj *patternFlowIcmpv6EchoType - patternFlowIcmpv6EchoTypeMetricTagSlice []PatternFlowIcmpv6EchoTypeMetricTag - fieldPtr *[]*otg.PatternFlowIcmpv6EchoTypeMetricTag -} - -func newPatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter(ptr *[]*otg.PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { - return &patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter interface { - setMsg(*patternFlowIcmpv6EchoType) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter - Items() []PatternFlowIcmpv6EchoTypeMetricTag - Add() PatternFlowIcmpv6EchoTypeMetricTag - Append(items ...PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter - Set(index int, newObj PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter - Clear() PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter - clearHolderSlice() PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter - appendHolderSlice(item PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter -} - -func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) setMsg(msg *patternFlowIcmpv6EchoType) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIcmpv6EchoTypeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) Items() []PatternFlowIcmpv6EchoTypeMetricTag { - return obj.patternFlowIcmpv6EchoTypeMetricTagSlice -} - -func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) Add() PatternFlowIcmpv6EchoTypeMetricTag { - newObj := &otg.PatternFlowIcmpv6EchoTypeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIcmpv6EchoTypeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIcmpv6EchoTypeMetricTagSlice = append(obj.patternFlowIcmpv6EchoTypeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) Append(items ...PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIcmpv6EchoTypeMetricTagSlice = append(obj.patternFlowIcmpv6EchoTypeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) Set(index int, newObj PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIcmpv6EchoTypeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) Clear() PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIcmpv6EchoTypeMetricTag{} - obj.patternFlowIcmpv6EchoTypeMetricTagSlice = []PatternFlowIcmpv6EchoTypeMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) clearHolderSlice() PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { - if len(obj.patternFlowIcmpv6EchoTypeMetricTagSlice) > 0 { - obj.patternFlowIcmpv6EchoTypeMetricTagSlice = []PatternFlowIcmpv6EchoTypeMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) appendHolderSlice(item PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { - obj.patternFlowIcmpv6EchoTypeMetricTagSlice = append(obj.patternFlowIcmpv6EchoTypeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIcmpv6EchoType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoType.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIcmpv6EchoType.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIcmpv6EchoTypeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIcmpv6EchoType) setDefault() { - var choices_set int = 0 - var choice PatternFlowIcmpv6EchoTypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIcmpv6EchoTypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIcmpv6EchoTypeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIcmpv6EchoTypeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIcmpv6EchoTypeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpv6EchoType") - } - } else { - intVal := otg.PatternFlowIcmpv6EchoType_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIcmpv6EchoType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIcmpv6EchoCode ***** -type patternFlowIcmpv6EchoCode struct { - validation - obj *otg.PatternFlowIcmpv6EchoCode - marshaller marshalPatternFlowIcmpv6EchoCode - unMarshaller unMarshalPatternFlowIcmpv6EchoCode - incrementHolder PatternFlowIcmpv6EchoCodeCounter - decrementHolder PatternFlowIcmpv6EchoCodeCounter - metricTagsHolder PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter -} - -func NewPatternFlowIcmpv6EchoCode() PatternFlowIcmpv6EchoCode { - obj := patternFlowIcmpv6EchoCode{obj: &otg.PatternFlowIcmpv6EchoCode{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpv6EchoCode) msg() *otg.PatternFlowIcmpv6EchoCode { - return obj.obj -} - -func (obj *patternFlowIcmpv6EchoCode) setMsg(msg *otg.PatternFlowIcmpv6EchoCode) PatternFlowIcmpv6EchoCode { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpv6EchoCode struct { - obj *patternFlowIcmpv6EchoCode -} - -type marshalPatternFlowIcmpv6EchoCode interface { - // ToProto marshals PatternFlowIcmpv6EchoCode to protobuf object *otg.PatternFlowIcmpv6EchoCode - ToProto() (*otg.PatternFlowIcmpv6EchoCode, error) - // ToPbText marshals PatternFlowIcmpv6EchoCode to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpv6EchoCode to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpv6EchoCode to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpv6EchoCode struct { - obj *patternFlowIcmpv6EchoCode -} - -type unMarshalPatternFlowIcmpv6EchoCode interface { - // FromProto unmarshals PatternFlowIcmpv6EchoCode from protobuf object *otg.PatternFlowIcmpv6EchoCode - FromProto(msg *otg.PatternFlowIcmpv6EchoCode) (PatternFlowIcmpv6EchoCode, error) - // FromPbText unmarshals PatternFlowIcmpv6EchoCode from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpv6EchoCode from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpv6EchoCode from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpv6EchoCode) Marshal() marshalPatternFlowIcmpv6EchoCode { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpv6EchoCode{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpv6EchoCode) Unmarshal() unMarshalPatternFlowIcmpv6EchoCode { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoCode{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpv6EchoCode) ToProto() (*otg.PatternFlowIcmpv6EchoCode, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpv6EchoCode) FromProto(msg *otg.PatternFlowIcmpv6EchoCode) (PatternFlowIcmpv6EchoCode, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpv6EchoCode) 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 *unMarshalpatternFlowIcmpv6EchoCode) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIcmpv6EchoCode) 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 *unMarshalpatternFlowIcmpv6EchoCode) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIcmpv6EchoCode) 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 *unMarshalpatternFlowIcmpv6EchoCode) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIcmpv6EchoCode) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoCode) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoCode) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpv6EchoCode) Clone() (PatternFlowIcmpv6EchoCode, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpv6EchoCode() - 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 -} - -func (obj *patternFlowIcmpv6EchoCode) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIcmpv6EchoCode is iCMPv6 echo sub type -type PatternFlowIcmpv6EchoCode interface { - Validation - // msg marshals PatternFlowIcmpv6EchoCode to protobuf object *otg.PatternFlowIcmpv6EchoCode - // and doesn't set defaults - msg() *otg.PatternFlowIcmpv6EchoCode - // setMsg unmarshals PatternFlowIcmpv6EchoCode from protobuf object *otg.PatternFlowIcmpv6EchoCode - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpv6EchoCode) PatternFlowIcmpv6EchoCode - // provides marshal interface - Marshal() marshalPatternFlowIcmpv6EchoCode - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpv6EchoCode - // validate validates PatternFlowIcmpv6EchoCode - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpv6EchoCode, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIcmpv6EchoCodeChoiceEnum, set in PatternFlowIcmpv6EchoCode - Choice() PatternFlowIcmpv6EchoCodeChoiceEnum - // setChoice assigns PatternFlowIcmpv6EchoCodeChoiceEnum provided by user to PatternFlowIcmpv6EchoCode - setChoice(value PatternFlowIcmpv6EchoCodeChoiceEnum) PatternFlowIcmpv6EchoCode - // HasChoice checks if Choice has been set in PatternFlowIcmpv6EchoCode - HasChoice() bool - // Value returns uint32, set in PatternFlowIcmpv6EchoCode. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIcmpv6EchoCode - SetValue(value uint32) PatternFlowIcmpv6EchoCode - // HasValue checks if Value has been set in PatternFlowIcmpv6EchoCode - HasValue() bool - // Values returns []uint32, set in PatternFlowIcmpv6EchoCode. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIcmpv6EchoCode - SetValues(value []uint32) PatternFlowIcmpv6EchoCode - // Increment returns PatternFlowIcmpv6EchoCodeCounter, set in PatternFlowIcmpv6EchoCode. - // PatternFlowIcmpv6EchoCodeCounter is integer counter pattern - Increment() PatternFlowIcmpv6EchoCodeCounter - // SetIncrement assigns PatternFlowIcmpv6EchoCodeCounter provided by user to PatternFlowIcmpv6EchoCode. - // PatternFlowIcmpv6EchoCodeCounter is integer counter pattern - SetIncrement(value PatternFlowIcmpv6EchoCodeCounter) PatternFlowIcmpv6EchoCode - // HasIncrement checks if Increment has been set in PatternFlowIcmpv6EchoCode - HasIncrement() bool - // Decrement returns PatternFlowIcmpv6EchoCodeCounter, set in PatternFlowIcmpv6EchoCode. - // PatternFlowIcmpv6EchoCodeCounter is integer counter pattern - Decrement() PatternFlowIcmpv6EchoCodeCounter - // SetDecrement assigns PatternFlowIcmpv6EchoCodeCounter provided by user to PatternFlowIcmpv6EchoCode. - // PatternFlowIcmpv6EchoCodeCounter is integer counter pattern - SetDecrement(value PatternFlowIcmpv6EchoCodeCounter) PatternFlowIcmpv6EchoCode - // HasDecrement checks if Decrement has been set in PatternFlowIcmpv6EchoCode - HasDecrement() bool - // MetricTags returns PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIterIter, set in PatternFlowIcmpv6EchoCode - MetricTags() PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter - setNil() -} - -type PatternFlowIcmpv6EchoCodeChoiceEnum string - -// Enum of Choice on PatternFlowIcmpv6EchoCode -var PatternFlowIcmpv6EchoCodeChoice = struct { - VALUE PatternFlowIcmpv6EchoCodeChoiceEnum - VALUES PatternFlowIcmpv6EchoCodeChoiceEnum - INCREMENT PatternFlowIcmpv6EchoCodeChoiceEnum - DECREMENT PatternFlowIcmpv6EchoCodeChoiceEnum -}{ - VALUE: PatternFlowIcmpv6EchoCodeChoiceEnum("value"), - VALUES: PatternFlowIcmpv6EchoCodeChoiceEnum("values"), - INCREMENT: PatternFlowIcmpv6EchoCodeChoiceEnum("increment"), - DECREMENT: PatternFlowIcmpv6EchoCodeChoiceEnum("decrement"), -} - -func (obj *patternFlowIcmpv6EchoCode) Choice() PatternFlowIcmpv6EchoCodeChoiceEnum { - return PatternFlowIcmpv6EchoCodeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIcmpv6EchoCode) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIcmpv6EchoCode) setChoice(value PatternFlowIcmpv6EchoCodeChoiceEnum) PatternFlowIcmpv6EchoCode { - intValue, ok := otg.PatternFlowIcmpv6EchoCode_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIcmpv6EchoCodeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIcmpv6EchoCode_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIcmpv6EchoCodeChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIcmpv6EchoCodeChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIcmpv6EchoCodeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIcmpv6EchoCodeCounter().msg() - } - - if value == PatternFlowIcmpv6EchoCodeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIcmpv6EchoCodeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpv6EchoCode) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpv6EchoCode) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIcmpv6EchoCode object -func (obj *patternFlowIcmpv6EchoCode) SetValue(value uint32) PatternFlowIcmpv6EchoCode { - obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIcmpv6EchoCode) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIcmpv6EchoCode object -func (obj *patternFlowIcmpv6EchoCode) SetValues(value []uint32) PatternFlowIcmpv6EchoCode { - obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIcmpv6EchoCodeCounter -func (obj *patternFlowIcmpv6EchoCode) Increment() PatternFlowIcmpv6EchoCodeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIcmpv6EchoCodeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIcmpv6EchoCodeCounter -func (obj *patternFlowIcmpv6EchoCode) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIcmpv6EchoCodeCounter value in the PatternFlowIcmpv6EchoCode object -func (obj *patternFlowIcmpv6EchoCode) SetIncrement(value PatternFlowIcmpv6EchoCodeCounter) PatternFlowIcmpv6EchoCode { - obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIcmpv6EchoCodeCounter -func (obj *patternFlowIcmpv6EchoCode) Decrement() PatternFlowIcmpv6EchoCodeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIcmpv6EchoCodeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIcmpv6EchoCodeCounter -func (obj *patternFlowIcmpv6EchoCode) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIcmpv6EchoCodeCounter value in the PatternFlowIcmpv6EchoCode object -func (obj *patternFlowIcmpv6EchoCode) SetDecrement(value PatternFlowIcmpv6EchoCodeCounter) PatternFlowIcmpv6EchoCode { - obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIcmpv6EchoCodeMetricTag -func (obj *patternFlowIcmpv6EchoCode) MetricTags() PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIcmpv6EchoCodeMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter struct { - obj *patternFlowIcmpv6EchoCode - patternFlowIcmpv6EchoCodeMetricTagSlice []PatternFlowIcmpv6EchoCodeMetricTag - fieldPtr *[]*otg.PatternFlowIcmpv6EchoCodeMetricTag -} - -func newPatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter(ptr *[]*otg.PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { - return &patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter interface { - setMsg(*patternFlowIcmpv6EchoCode) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter - Items() []PatternFlowIcmpv6EchoCodeMetricTag - Add() PatternFlowIcmpv6EchoCodeMetricTag - Append(items ...PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter - Set(index int, newObj PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter - Clear() PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter - clearHolderSlice() PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter - appendHolderSlice(item PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter -} - -func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) setMsg(msg *patternFlowIcmpv6EchoCode) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIcmpv6EchoCodeMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) Items() []PatternFlowIcmpv6EchoCodeMetricTag { - return obj.patternFlowIcmpv6EchoCodeMetricTagSlice -} - -func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) Add() PatternFlowIcmpv6EchoCodeMetricTag { - newObj := &otg.PatternFlowIcmpv6EchoCodeMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIcmpv6EchoCodeMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIcmpv6EchoCodeMetricTagSlice = append(obj.patternFlowIcmpv6EchoCodeMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) Append(items ...PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIcmpv6EchoCodeMetricTagSlice = append(obj.patternFlowIcmpv6EchoCodeMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) Set(index int, newObj PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIcmpv6EchoCodeMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) Clear() PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIcmpv6EchoCodeMetricTag{} - obj.patternFlowIcmpv6EchoCodeMetricTagSlice = []PatternFlowIcmpv6EchoCodeMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) clearHolderSlice() PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { - if len(obj.patternFlowIcmpv6EchoCodeMetricTagSlice) > 0 { - obj.patternFlowIcmpv6EchoCodeMetricTagSlice = []PatternFlowIcmpv6EchoCodeMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) appendHolderSlice(item PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { - obj.patternFlowIcmpv6EchoCodeMetricTagSlice = append(obj.patternFlowIcmpv6EchoCodeMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIcmpv6EchoCode) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoCode.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIcmpv6EchoCode.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIcmpv6EchoCodeMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIcmpv6EchoCode) setDefault() { - var choices_set int = 0 - var choice PatternFlowIcmpv6EchoCodeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIcmpv6EchoCodeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIcmpv6EchoCodeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIcmpv6EchoCodeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIcmpv6EchoCodeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpv6EchoCode") - } - } else { - intVal := otg.PatternFlowIcmpv6EchoCode_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIcmpv6EchoCode_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIcmpv6EchoIdentifier ***** -type patternFlowIcmpv6EchoIdentifier struct { - validation - obj *otg.PatternFlowIcmpv6EchoIdentifier - marshaller marshalPatternFlowIcmpv6EchoIdentifier - unMarshaller unMarshalPatternFlowIcmpv6EchoIdentifier - incrementHolder PatternFlowIcmpv6EchoIdentifierCounter - decrementHolder PatternFlowIcmpv6EchoIdentifierCounter - metricTagsHolder PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter -} - -func NewPatternFlowIcmpv6EchoIdentifier() PatternFlowIcmpv6EchoIdentifier { - obj := patternFlowIcmpv6EchoIdentifier{obj: &otg.PatternFlowIcmpv6EchoIdentifier{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpv6EchoIdentifier) msg() *otg.PatternFlowIcmpv6EchoIdentifier { - return obj.obj -} - -func (obj *patternFlowIcmpv6EchoIdentifier) setMsg(msg *otg.PatternFlowIcmpv6EchoIdentifier) PatternFlowIcmpv6EchoIdentifier { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpv6EchoIdentifier struct { - obj *patternFlowIcmpv6EchoIdentifier -} - -type marshalPatternFlowIcmpv6EchoIdentifier interface { - // ToProto marshals PatternFlowIcmpv6EchoIdentifier to protobuf object *otg.PatternFlowIcmpv6EchoIdentifier - ToProto() (*otg.PatternFlowIcmpv6EchoIdentifier, error) - // ToPbText marshals PatternFlowIcmpv6EchoIdentifier to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpv6EchoIdentifier to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpv6EchoIdentifier to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpv6EchoIdentifier struct { - obj *patternFlowIcmpv6EchoIdentifier -} - -type unMarshalPatternFlowIcmpv6EchoIdentifier interface { - // FromProto unmarshals PatternFlowIcmpv6EchoIdentifier from protobuf object *otg.PatternFlowIcmpv6EchoIdentifier - FromProto(msg *otg.PatternFlowIcmpv6EchoIdentifier) (PatternFlowIcmpv6EchoIdentifier, error) - // FromPbText unmarshals PatternFlowIcmpv6EchoIdentifier from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpv6EchoIdentifier from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpv6EchoIdentifier from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpv6EchoIdentifier) Marshal() marshalPatternFlowIcmpv6EchoIdentifier { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpv6EchoIdentifier{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpv6EchoIdentifier) Unmarshal() unMarshalPatternFlowIcmpv6EchoIdentifier { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoIdentifier{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpv6EchoIdentifier) ToProto() (*otg.PatternFlowIcmpv6EchoIdentifier, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpv6EchoIdentifier) FromProto(msg *otg.PatternFlowIcmpv6EchoIdentifier) (PatternFlowIcmpv6EchoIdentifier, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpv6EchoIdentifier) 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 *unMarshalpatternFlowIcmpv6EchoIdentifier) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIcmpv6EchoIdentifier) 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 *unMarshalpatternFlowIcmpv6EchoIdentifier) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIcmpv6EchoIdentifier) 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 *unMarshalpatternFlowIcmpv6EchoIdentifier) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIcmpv6EchoIdentifier) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoIdentifier) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoIdentifier) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpv6EchoIdentifier) Clone() (PatternFlowIcmpv6EchoIdentifier, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpv6EchoIdentifier() - 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 -} - -func (obj *patternFlowIcmpv6EchoIdentifier) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIcmpv6EchoIdentifier is iCMPv6 echo identifier -type PatternFlowIcmpv6EchoIdentifier interface { - Validation - // msg marshals PatternFlowIcmpv6EchoIdentifier to protobuf object *otg.PatternFlowIcmpv6EchoIdentifier - // and doesn't set defaults - msg() *otg.PatternFlowIcmpv6EchoIdentifier - // setMsg unmarshals PatternFlowIcmpv6EchoIdentifier from protobuf object *otg.PatternFlowIcmpv6EchoIdentifier - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpv6EchoIdentifier) PatternFlowIcmpv6EchoIdentifier - // provides marshal interface - Marshal() marshalPatternFlowIcmpv6EchoIdentifier - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpv6EchoIdentifier - // validate validates PatternFlowIcmpv6EchoIdentifier - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpv6EchoIdentifier, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIcmpv6EchoIdentifierChoiceEnum, set in PatternFlowIcmpv6EchoIdentifier - Choice() PatternFlowIcmpv6EchoIdentifierChoiceEnum - // setChoice assigns PatternFlowIcmpv6EchoIdentifierChoiceEnum provided by user to PatternFlowIcmpv6EchoIdentifier - setChoice(value PatternFlowIcmpv6EchoIdentifierChoiceEnum) PatternFlowIcmpv6EchoIdentifier - // HasChoice checks if Choice has been set in PatternFlowIcmpv6EchoIdentifier - HasChoice() bool - // Value returns uint32, set in PatternFlowIcmpv6EchoIdentifier. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIcmpv6EchoIdentifier - SetValue(value uint32) PatternFlowIcmpv6EchoIdentifier - // HasValue checks if Value has been set in PatternFlowIcmpv6EchoIdentifier - HasValue() bool - // Values returns []uint32, set in PatternFlowIcmpv6EchoIdentifier. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIcmpv6EchoIdentifier - SetValues(value []uint32) PatternFlowIcmpv6EchoIdentifier - // Increment returns PatternFlowIcmpv6EchoIdentifierCounter, set in PatternFlowIcmpv6EchoIdentifier. - // PatternFlowIcmpv6EchoIdentifierCounter is integer counter pattern - Increment() PatternFlowIcmpv6EchoIdentifierCounter - // SetIncrement assigns PatternFlowIcmpv6EchoIdentifierCounter provided by user to PatternFlowIcmpv6EchoIdentifier. - // PatternFlowIcmpv6EchoIdentifierCounter is integer counter pattern - SetIncrement(value PatternFlowIcmpv6EchoIdentifierCounter) PatternFlowIcmpv6EchoIdentifier - // HasIncrement checks if Increment has been set in PatternFlowIcmpv6EchoIdentifier - HasIncrement() bool - // Decrement returns PatternFlowIcmpv6EchoIdentifierCounter, set in PatternFlowIcmpv6EchoIdentifier. - // PatternFlowIcmpv6EchoIdentifierCounter is integer counter pattern - Decrement() PatternFlowIcmpv6EchoIdentifierCounter - // SetDecrement assigns PatternFlowIcmpv6EchoIdentifierCounter provided by user to PatternFlowIcmpv6EchoIdentifier. - // PatternFlowIcmpv6EchoIdentifierCounter is integer counter pattern - SetDecrement(value PatternFlowIcmpv6EchoIdentifierCounter) PatternFlowIcmpv6EchoIdentifier - // HasDecrement checks if Decrement has been set in PatternFlowIcmpv6EchoIdentifier - HasDecrement() bool - // MetricTags returns PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIterIter, set in PatternFlowIcmpv6EchoIdentifier - MetricTags() PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter - setNil() -} - -type PatternFlowIcmpv6EchoIdentifierChoiceEnum string - -// Enum of Choice on PatternFlowIcmpv6EchoIdentifier -var PatternFlowIcmpv6EchoIdentifierChoice = struct { - VALUE PatternFlowIcmpv6EchoIdentifierChoiceEnum - VALUES PatternFlowIcmpv6EchoIdentifierChoiceEnum - INCREMENT PatternFlowIcmpv6EchoIdentifierChoiceEnum - DECREMENT PatternFlowIcmpv6EchoIdentifierChoiceEnum -}{ - VALUE: PatternFlowIcmpv6EchoIdentifierChoiceEnum("value"), - VALUES: PatternFlowIcmpv6EchoIdentifierChoiceEnum("values"), - INCREMENT: PatternFlowIcmpv6EchoIdentifierChoiceEnum("increment"), - DECREMENT: PatternFlowIcmpv6EchoIdentifierChoiceEnum("decrement"), -} - -func (obj *patternFlowIcmpv6EchoIdentifier) Choice() PatternFlowIcmpv6EchoIdentifierChoiceEnum { - return PatternFlowIcmpv6EchoIdentifierChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIcmpv6EchoIdentifier) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIcmpv6EchoIdentifier) setChoice(value PatternFlowIcmpv6EchoIdentifierChoiceEnum) PatternFlowIcmpv6EchoIdentifier { - intValue, ok := otg.PatternFlowIcmpv6EchoIdentifier_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIcmpv6EchoIdentifierChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIcmpv6EchoIdentifier_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIcmpv6EchoIdentifierChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIcmpv6EchoIdentifierChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIcmpv6EchoIdentifierChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIcmpv6EchoIdentifierCounter().msg() - } - - if value == PatternFlowIcmpv6EchoIdentifierChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIcmpv6EchoIdentifierCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpv6EchoIdentifier) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpv6EchoIdentifier) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIcmpv6EchoIdentifier object -func (obj *patternFlowIcmpv6EchoIdentifier) SetValue(value uint32) PatternFlowIcmpv6EchoIdentifier { - obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIcmpv6EchoIdentifier) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIcmpv6EchoIdentifier object -func (obj *patternFlowIcmpv6EchoIdentifier) SetValues(value []uint32) PatternFlowIcmpv6EchoIdentifier { - obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIcmpv6EchoIdentifierCounter -func (obj *patternFlowIcmpv6EchoIdentifier) Increment() PatternFlowIcmpv6EchoIdentifierCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIcmpv6EchoIdentifierCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIcmpv6EchoIdentifierCounter -func (obj *patternFlowIcmpv6EchoIdentifier) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIcmpv6EchoIdentifierCounter value in the PatternFlowIcmpv6EchoIdentifier object -func (obj *patternFlowIcmpv6EchoIdentifier) SetIncrement(value PatternFlowIcmpv6EchoIdentifierCounter) PatternFlowIcmpv6EchoIdentifier { - obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIcmpv6EchoIdentifierCounter -func (obj *patternFlowIcmpv6EchoIdentifier) Decrement() PatternFlowIcmpv6EchoIdentifierCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIcmpv6EchoIdentifierCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIcmpv6EchoIdentifierCounter -func (obj *patternFlowIcmpv6EchoIdentifier) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIcmpv6EchoIdentifierCounter value in the PatternFlowIcmpv6EchoIdentifier object -func (obj *patternFlowIcmpv6EchoIdentifier) SetDecrement(value PatternFlowIcmpv6EchoIdentifierCounter) PatternFlowIcmpv6EchoIdentifier { - obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIcmpv6EchoIdentifierMetricTag -func (obj *patternFlowIcmpv6EchoIdentifier) MetricTags() PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIcmpv6EchoIdentifierMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter struct { - obj *patternFlowIcmpv6EchoIdentifier - patternFlowIcmpv6EchoIdentifierMetricTagSlice []PatternFlowIcmpv6EchoIdentifierMetricTag - fieldPtr *[]*otg.PatternFlowIcmpv6EchoIdentifierMetricTag -} - -func newPatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter(ptr *[]*otg.PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { - return &patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter interface { - setMsg(*patternFlowIcmpv6EchoIdentifier) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter - Items() []PatternFlowIcmpv6EchoIdentifierMetricTag - Add() PatternFlowIcmpv6EchoIdentifierMetricTag - Append(items ...PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter - Set(index int, newObj PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter - Clear() PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter - clearHolderSlice() PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter - appendHolderSlice(item PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter -} - -func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) setMsg(msg *patternFlowIcmpv6EchoIdentifier) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIcmpv6EchoIdentifierMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) Items() []PatternFlowIcmpv6EchoIdentifierMetricTag { - return obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice -} - -func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) Add() PatternFlowIcmpv6EchoIdentifierMetricTag { - newObj := &otg.PatternFlowIcmpv6EchoIdentifierMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIcmpv6EchoIdentifierMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice = append(obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) Append(items ...PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice = append(obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) Set(index int, newObj PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) Clear() PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIcmpv6EchoIdentifierMetricTag{} - obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice = []PatternFlowIcmpv6EchoIdentifierMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) clearHolderSlice() PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { - if len(obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice) > 0 { - obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice = []PatternFlowIcmpv6EchoIdentifierMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) appendHolderSlice(item PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { - obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice = append(obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIcmpv6EchoIdentifier) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoIdentifier.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIcmpv6EchoIdentifier.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIcmpv6EchoIdentifierMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIcmpv6EchoIdentifier) setDefault() { - var choices_set int = 0 - var choice PatternFlowIcmpv6EchoIdentifierChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIcmpv6EchoIdentifierChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIcmpv6EchoIdentifierChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIcmpv6EchoIdentifierChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIcmpv6EchoIdentifierChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpv6EchoIdentifier") - } - } else { - intVal := otg.PatternFlowIcmpv6EchoIdentifier_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIcmpv6EchoIdentifier_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIcmpv6EchoSequenceNumber ***** -type patternFlowIcmpv6EchoSequenceNumber struct { - validation - obj *otg.PatternFlowIcmpv6EchoSequenceNumber - marshaller marshalPatternFlowIcmpv6EchoSequenceNumber - unMarshaller unMarshalPatternFlowIcmpv6EchoSequenceNumber - incrementHolder PatternFlowIcmpv6EchoSequenceNumberCounter - decrementHolder PatternFlowIcmpv6EchoSequenceNumberCounter - metricTagsHolder PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter -} - -func NewPatternFlowIcmpv6EchoSequenceNumber() PatternFlowIcmpv6EchoSequenceNumber { - obj := patternFlowIcmpv6EchoSequenceNumber{obj: &otg.PatternFlowIcmpv6EchoSequenceNumber{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpv6EchoSequenceNumber) msg() *otg.PatternFlowIcmpv6EchoSequenceNumber { - return obj.obj -} - -func (obj *patternFlowIcmpv6EchoSequenceNumber) setMsg(msg *otg.PatternFlowIcmpv6EchoSequenceNumber) PatternFlowIcmpv6EchoSequenceNumber { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpv6EchoSequenceNumber struct { - obj *patternFlowIcmpv6EchoSequenceNumber -} - -type marshalPatternFlowIcmpv6EchoSequenceNumber interface { - // ToProto marshals PatternFlowIcmpv6EchoSequenceNumber to protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumber - ToProto() (*otg.PatternFlowIcmpv6EchoSequenceNumber, error) - // ToPbText marshals PatternFlowIcmpv6EchoSequenceNumber to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpv6EchoSequenceNumber to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpv6EchoSequenceNumber to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpv6EchoSequenceNumber struct { - obj *patternFlowIcmpv6EchoSequenceNumber -} - -type unMarshalPatternFlowIcmpv6EchoSequenceNumber interface { - // FromProto unmarshals PatternFlowIcmpv6EchoSequenceNumber from protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumber - FromProto(msg *otg.PatternFlowIcmpv6EchoSequenceNumber) (PatternFlowIcmpv6EchoSequenceNumber, error) - // FromPbText unmarshals PatternFlowIcmpv6EchoSequenceNumber from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpv6EchoSequenceNumber from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpv6EchoSequenceNumber from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpv6EchoSequenceNumber) Marshal() marshalPatternFlowIcmpv6EchoSequenceNumber { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpv6EchoSequenceNumber{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpv6EchoSequenceNumber) Unmarshal() unMarshalPatternFlowIcmpv6EchoSequenceNumber { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoSequenceNumber{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpv6EchoSequenceNumber) ToProto() (*otg.PatternFlowIcmpv6EchoSequenceNumber, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpv6EchoSequenceNumber) FromProto(msg *otg.PatternFlowIcmpv6EchoSequenceNumber) (PatternFlowIcmpv6EchoSequenceNumber, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpv6EchoSequenceNumber) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumber) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIcmpv6EchoSequenceNumber) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumber) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIcmpv6EchoSequenceNumber) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumber) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIcmpv6EchoSequenceNumber) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoSequenceNumber) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoSequenceNumber) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpv6EchoSequenceNumber) Clone() (PatternFlowIcmpv6EchoSequenceNumber, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpv6EchoSequenceNumber() - 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 -} - -func (obj *patternFlowIcmpv6EchoSequenceNumber) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIcmpv6EchoSequenceNumber is iCMPv6 echo sequence number -type PatternFlowIcmpv6EchoSequenceNumber interface { - Validation - // msg marshals PatternFlowIcmpv6EchoSequenceNumber to protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumber - // and doesn't set defaults - msg() *otg.PatternFlowIcmpv6EchoSequenceNumber - // setMsg unmarshals PatternFlowIcmpv6EchoSequenceNumber from protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumber - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpv6EchoSequenceNumber) PatternFlowIcmpv6EchoSequenceNumber - // provides marshal interface - Marshal() marshalPatternFlowIcmpv6EchoSequenceNumber - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpv6EchoSequenceNumber - // validate validates PatternFlowIcmpv6EchoSequenceNumber - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpv6EchoSequenceNumber, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIcmpv6EchoSequenceNumberChoiceEnum, set in PatternFlowIcmpv6EchoSequenceNumber - Choice() PatternFlowIcmpv6EchoSequenceNumberChoiceEnum - // setChoice assigns PatternFlowIcmpv6EchoSequenceNumberChoiceEnum provided by user to PatternFlowIcmpv6EchoSequenceNumber - setChoice(value PatternFlowIcmpv6EchoSequenceNumberChoiceEnum) PatternFlowIcmpv6EchoSequenceNumber - // HasChoice checks if Choice has been set in PatternFlowIcmpv6EchoSequenceNumber - HasChoice() bool - // Value returns uint32, set in PatternFlowIcmpv6EchoSequenceNumber. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIcmpv6EchoSequenceNumber - SetValue(value uint32) PatternFlowIcmpv6EchoSequenceNumber - // HasValue checks if Value has been set in PatternFlowIcmpv6EchoSequenceNumber - HasValue() bool - // Values returns []uint32, set in PatternFlowIcmpv6EchoSequenceNumber. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIcmpv6EchoSequenceNumber - SetValues(value []uint32) PatternFlowIcmpv6EchoSequenceNumber - // Increment returns PatternFlowIcmpv6EchoSequenceNumberCounter, set in PatternFlowIcmpv6EchoSequenceNumber. - // PatternFlowIcmpv6EchoSequenceNumberCounter is integer counter pattern - Increment() PatternFlowIcmpv6EchoSequenceNumberCounter - // SetIncrement assigns PatternFlowIcmpv6EchoSequenceNumberCounter provided by user to PatternFlowIcmpv6EchoSequenceNumber. - // PatternFlowIcmpv6EchoSequenceNumberCounter is integer counter pattern - SetIncrement(value PatternFlowIcmpv6EchoSequenceNumberCounter) PatternFlowIcmpv6EchoSequenceNumber - // HasIncrement checks if Increment has been set in PatternFlowIcmpv6EchoSequenceNumber - HasIncrement() bool - // Decrement returns PatternFlowIcmpv6EchoSequenceNumberCounter, set in PatternFlowIcmpv6EchoSequenceNumber. - // PatternFlowIcmpv6EchoSequenceNumberCounter is integer counter pattern - Decrement() PatternFlowIcmpv6EchoSequenceNumberCounter - // SetDecrement assigns PatternFlowIcmpv6EchoSequenceNumberCounter provided by user to PatternFlowIcmpv6EchoSequenceNumber. - // PatternFlowIcmpv6EchoSequenceNumberCounter is integer counter pattern - SetDecrement(value PatternFlowIcmpv6EchoSequenceNumberCounter) PatternFlowIcmpv6EchoSequenceNumber - // HasDecrement checks if Decrement has been set in PatternFlowIcmpv6EchoSequenceNumber - HasDecrement() bool - // MetricTags returns PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIterIter, set in PatternFlowIcmpv6EchoSequenceNumber - MetricTags() PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter - setNil() -} - -type PatternFlowIcmpv6EchoSequenceNumberChoiceEnum string - -// Enum of Choice on PatternFlowIcmpv6EchoSequenceNumber -var PatternFlowIcmpv6EchoSequenceNumberChoice = struct { - VALUE PatternFlowIcmpv6EchoSequenceNumberChoiceEnum - VALUES PatternFlowIcmpv6EchoSequenceNumberChoiceEnum - INCREMENT PatternFlowIcmpv6EchoSequenceNumberChoiceEnum - DECREMENT PatternFlowIcmpv6EchoSequenceNumberChoiceEnum -}{ - VALUE: PatternFlowIcmpv6EchoSequenceNumberChoiceEnum("value"), - VALUES: PatternFlowIcmpv6EchoSequenceNumberChoiceEnum("values"), - INCREMENT: PatternFlowIcmpv6EchoSequenceNumberChoiceEnum("increment"), - DECREMENT: PatternFlowIcmpv6EchoSequenceNumberChoiceEnum("decrement"), -} - -func (obj *patternFlowIcmpv6EchoSequenceNumber) Choice() PatternFlowIcmpv6EchoSequenceNumberChoiceEnum { - return PatternFlowIcmpv6EchoSequenceNumberChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIcmpv6EchoSequenceNumber) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIcmpv6EchoSequenceNumber) setChoice(value PatternFlowIcmpv6EchoSequenceNumberChoiceEnum) PatternFlowIcmpv6EchoSequenceNumber { - intValue, ok := otg.PatternFlowIcmpv6EchoSequenceNumber_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIcmpv6EchoSequenceNumberChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIcmpv6EchoSequenceNumber_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIcmpv6EchoSequenceNumberChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIcmpv6EchoSequenceNumberChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIcmpv6EchoSequenceNumberChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIcmpv6EchoSequenceNumberCounter().msg() - } - - if value == PatternFlowIcmpv6EchoSequenceNumberChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIcmpv6EchoSequenceNumberCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpv6EchoSequenceNumber) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIcmpv6EchoSequenceNumber) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIcmpv6EchoSequenceNumber object -func (obj *patternFlowIcmpv6EchoSequenceNumber) SetValue(value uint32) PatternFlowIcmpv6EchoSequenceNumber { - obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIcmpv6EchoSequenceNumber) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIcmpv6EchoSequenceNumber object -func (obj *patternFlowIcmpv6EchoSequenceNumber) SetValues(value []uint32) PatternFlowIcmpv6EchoSequenceNumber { - obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIcmpv6EchoSequenceNumberCounter -func (obj *patternFlowIcmpv6EchoSequenceNumber) Increment() PatternFlowIcmpv6EchoSequenceNumberCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIcmpv6EchoSequenceNumberCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIcmpv6EchoSequenceNumberCounter -func (obj *patternFlowIcmpv6EchoSequenceNumber) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIcmpv6EchoSequenceNumberCounter value in the PatternFlowIcmpv6EchoSequenceNumber object -func (obj *patternFlowIcmpv6EchoSequenceNumber) SetIncrement(value PatternFlowIcmpv6EchoSequenceNumberCounter) PatternFlowIcmpv6EchoSequenceNumber { - obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIcmpv6EchoSequenceNumberCounter -func (obj *patternFlowIcmpv6EchoSequenceNumber) Decrement() PatternFlowIcmpv6EchoSequenceNumberCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIcmpv6EchoSequenceNumberCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIcmpv6EchoSequenceNumberCounter -func (obj *patternFlowIcmpv6EchoSequenceNumber) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIcmpv6EchoSequenceNumberCounter value in the PatternFlowIcmpv6EchoSequenceNumber object -func (obj *patternFlowIcmpv6EchoSequenceNumber) SetDecrement(value PatternFlowIcmpv6EchoSequenceNumberCounter) PatternFlowIcmpv6EchoSequenceNumber { - obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIcmpv6EchoSequenceNumberMetricTag -func (obj *patternFlowIcmpv6EchoSequenceNumber) MetricTags() PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter struct { - obj *patternFlowIcmpv6EchoSequenceNumber - patternFlowIcmpv6EchoSequenceNumberMetricTagSlice []PatternFlowIcmpv6EchoSequenceNumberMetricTag - fieldPtr *[]*otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag -} - -func newPatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter(ptr *[]*otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { - return &patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter interface { - setMsg(*patternFlowIcmpv6EchoSequenceNumber) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter - Items() []PatternFlowIcmpv6EchoSequenceNumberMetricTag - Add() PatternFlowIcmpv6EchoSequenceNumberMetricTag - Append(items ...PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter - Set(index int, newObj PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter - Clear() PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter - clearHolderSlice() PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter - appendHolderSlice(item PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) setMsg(msg *patternFlowIcmpv6EchoSequenceNumber) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIcmpv6EchoSequenceNumberMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) Items() []PatternFlowIcmpv6EchoSequenceNumberMetricTag { - return obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) Add() PatternFlowIcmpv6EchoSequenceNumberMetricTag { - newObj := &otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIcmpv6EchoSequenceNumberMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice = append(obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) Append(items ...PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice = append(obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) Set(index int, newObj PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) Clear() PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag{} - obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice = []PatternFlowIcmpv6EchoSequenceNumberMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) clearHolderSlice() PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { - if len(obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice) > 0 { - obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice = []PatternFlowIcmpv6EchoSequenceNumberMetricTag{} - } - return obj -} -func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) appendHolderSlice(item PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { - obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice = append(obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIcmpv6EchoSequenceNumber) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoSequenceNumber.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIcmpv6EchoSequenceNumber.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIcmpv6EchoSequenceNumberMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIcmpv6EchoSequenceNumber) setDefault() { - var choices_set int = 0 - var choice PatternFlowIcmpv6EchoSequenceNumberChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIcmpv6EchoSequenceNumberChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIcmpv6EchoSequenceNumberChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIcmpv6EchoSequenceNumberChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIcmpv6EchoSequenceNumberChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpv6EchoSequenceNumber") - } - } else { - intVal := otg.PatternFlowIcmpv6EchoSequenceNumber_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIcmpv6EchoSequenceNumber_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIcmpv6EchoChecksum ***** -type patternFlowIcmpv6EchoChecksum struct { - validation - obj *otg.PatternFlowIcmpv6EchoChecksum - marshaller marshalPatternFlowIcmpv6EchoChecksum - unMarshaller unMarshalPatternFlowIcmpv6EchoChecksum -} - -func NewPatternFlowIcmpv6EchoChecksum() PatternFlowIcmpv6EchoChecksum { - obj := patternFlowIcmpv6EchoChecksum{obj: &otg.PatternFlowIcmpv6EchoChecksum{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpv6EchoChecksum) msg() *otg.PatternFlowIcmpv6EchoChecksum { - return obj.obj -} - -func (obj *patternFlowIcmpv6EchoChecksum) setMsg(msg *otg.PatternFlowIcmpv6EchoChecksum) PatternFlowIcmpv6EchoChecksum { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpv6EchoChecksum struct { - obj *patternFlowIcmpv6EchoChecksum -} - -type marshalPatternFlowIcmpv6EchoChecksum interface { - // ToProto marshals PatternFlowIcmpv6EchoChecksum to protobuf object *otg.PatternFlowIcmpv6EchoChecksum - ToProto() (*otg.PatternFlowIcmpv6EchoChecksum, error) - // ToPbText marshals PatternFlowIcmpv6EchoChecksum to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpv6EchoChecksum to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpv6EchoChecksum to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpv6EchoChecksum struct { - obj *patternFlowIcmpv6EchoChecksum -} - -type unMarshalPatternFlowIcmpv6EchoChecksum interface { - // FromProto unmarshals PatternFlowIcmpv6EchoChecksum from protobuf object *otg.PatternFlowIcmpv6EchoChecksum - FromProto(msg *otg.PatternFlowIcmpv6EchoChecksum) (PatternFlowIcmpv6EchoChecksum, error) - // FromPbText unmarshals PatternFlowIcmpv6EchoChecksum from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpv6EchoChecksum from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpv6EchoChecksum from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpv6EchoChecksum) Marshal() marshalPatternFlowIcmpv6EchoChecksum { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpv6EchoChecksum{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpv6EchoChecksum) Unmarshal() unMarshalPatternFlowIcmpv6EchoChecksum { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoChecksum{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpv6EchoChecksum) ToProto() (*otg.PatternFlowIcmpv6EchoChecksum, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpv6EchoChecksum) FromProto(msg *otg.PatternFlowIcmpv6EchoChecksum) (PatternFlowIcmpv6EchoChecksum, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpv6EchoChecksum) 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 *unMarshalpatternFlowIcmpv6EchoChecksum) 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 *marshalpatternFlowIcmpv6EchoChecksum) 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 *unMarshalpatternFlowIcmpv6EchoChecksum) 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 *marshalpatternFlowIcmpv6EchoChecksum) 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 *unMarshalpatternFlowIcmpv6EchoChecksum) 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 *patternFlowIcmpv6EchoChecksum) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoChecksum) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoChecksum) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpv6EchoChecksum) Clone() (PatternFlowIcmpv6EchoChecksum, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpv6EchoChecksum() - 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 -} - -// PatternFlowIcmpv6EchoChecksum is iCMPv6 checksum -type PatternFlowIcmpv6EchoChecksum interface { - Validation - // msg marshals PatternFlowIcmpv6EchoChecksum to protobuf object *otg.PatternFlowIcmpv6EchoChecksum - // and doesn't set defaults - msg() *otg.PatternFlowIcmpv6EchoChecksum - // setMsg unmarshals PatternFlowIcmpv6EchoChecksum from protobuf object *otg.PatternFlowIcmpv6EchoChecksum - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpv6EchoChecksum) PatternFlowIcmpv6EchoChecksum - // provides marshal interface - Marshal() marshalPatternFlowIcmpv6EchoChecksum - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpv6EchoChecksum - // validate validates PatternFlowIcmpv6EchoChecksum - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpv6EchoChecksum, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIcmpv6EchoChecksumChoiceEnum, set in PatternFlowIcmpv6EchoChecksum - Choice() PatternFlowIcmpv6EchoChecksumChoiceEnum - // setChoice assigns PatternFlowIcmpv6EchoChecksumChoiceEnum provided by user to PatternFlowIcmpv6EchoChecksum - setChoice(value PatternFlowIcmpv6EchoChecksumChoiceEnum) PatternFlowIcmpv6EchoChecksum - // HasChoice checks if Choice has been set in PatternFlowIcmpv6EchoChecksum - HasChoice() bool - // Generated returns PatternFlowIcmpv6EchoChecksumGeneratedEnum, set in PatternFlowIcmpv6EchoChecksum - Generated() PatternFlowIcmpv6EchoChecksumGeneratedEnum - // SetGenerated assigns PatternFlowIcmpv6EchoChecksumGeneratedEnum provided by user to PatternFlowIcmpv6EchoChecksum - SetGenerated(value PatternFlowIcmpv6EchoChecksumGeneratedEnum) PatternFlowIcmpv6EchoChecksum - // HasGenerated checks if Generated has been set in PatternFlowIcmpv6EchoChecksum - HasGenerated() bool - // Custom returns uint32, set in PatternFlowIcmpv6EchoChecksum. - Custom() uint32 - // SetCustom assigns uint32 provided by user to PatternFlowIcmpv6EchoChecksum - SetCustom(value uint32) PatternFlowIcmpv6EchoChecksum - // HasCustom checks if Custom has been set in PatternFlowIcmpv6EchoChecksum - HasCustom() bool -} - -type PatternFlowIcmpv6EchoChecksumChoiceEnum string - -// Enum of Choice on PatternFlowIcmpv6EchoChecksum -var PatternFlowIcmpv6EchoChecksumChoice = struct { - GENERATED PatternFlowIcmpv6EchoChecksumChoiceEnum - CUSTOM PatternFlowIcmpv6EchoChecksumChoiceEnum -}{ - GENERATED: PatternFlowIcmpv6EchoChecksumChoiceEnum("generated"), - CUSTOM: PatternFlowIcmpv6EchoChecksumChoiceEnum("custom"), -} - -func (obj *patternFlowIcmpv6EchoChecksum) Choice() PatternFlowIcmpv6EchoChecksumChoiceEnum { - return PatternFlowIcmpv6EchoChecksumChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The type of checksum -// Choice returns a string -func (obj *patternFlowIcmpv6EchoChecksum) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIcmpv6EchoChecksum) setChoice(value PatternFlowIcmpv6EchoChecksumChoiceEnum) PatternFlowIcmpv6EchoChecksum { - intValue, ok := otg.PatternFlowIcmpv6EchoChecksum_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIcmpv6EchoChecksumChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIcmpv6EchoChecksum_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Custom = nil - obj.obj.Generated = otg.PatternFlowIcmpv6EchoChecksum_Generated_unspecified.Enum() - return obj -} - -type PatternFlowIcmpv6EchoChecksumGeneratedEnum string - -// Enum of Generated on PatternFlowIcmpv6EchoChecksum -var PatternFlowIcmpv6EchoChecksumGenerated = struct { - GOOD PatternFlowIcmpv6EchoChecksumGeneratedEnum - BAD PatternFlowIcmpv6EchoChecksumGeneratedEnum -}{ - GOOD: PatternFlowIcmpv6EchoChecksumGeneratedEnum("good"), - BAD: PatternFlowIcmpv6EchoChecksumGeneratedEnum("bad"), -} - -func (obj *patternFlowIcmpv6EchoChecksum) Generated() PatternFlowIcmpv6EchoChecksumGeneratedEnum { - return PatternFlowIcmpv6EchoChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) -} - -// A system generated checksum value -// Generated returns a string -func (obj *patternFlowIcmpv6EchoChecksum) HasGenerated() bool { - return obj.obj.Generated != nil -} - -func (obj *patternFlowIcmpv6EchoChecksum) SetGenerated(value PatternFlowIcmpv6EchoChecksumGeneratedEnum) PatternFlowIcmpv6EchoChecksum { - intValue, ok := otg.PatternFlowIcmpv6EchoChecksum_Generated_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIcmpv6EchoChecksumGeneratedEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIcmpv6EchoChecksum_Generated_Enum(intValue) - obj.obj.Generated = &enumValue - - return obj -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowIcmpv6EchoChecksum) Custom() uint32 { - - if obj.obj.Custom == nil { - obj.setChoice(PatternFlowIcmpv6EchoChecksumChoice.CUSTOM) - } - - return *obj.obj.Custom - -} - -// A custom checksum value -// Custom returns a uint32 -func (obj *patternFlowIcmpv6EchoChecksum) HasCustom() bool { - return obj.obj.Custom != nil -} - -// A custom checksum value -// SetCustom sets the uint32 value in the PatternFlowIcmpv6EchoChecksum object -func (obj *patternFlowIcmpv6EchoChecksum) SetCustom(value uint32) PatternFlowIcmpv6EchoChecksum { - obj.setChoice(PatternFlowIcmpv6EchoChecksumChoice.CUSTOM) - obj.obj.Custom = &value - return obj -} - -func (obj *patternFlowIcmpv6EchoChecksum) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Custom != nil { - - if *obj.obj.Custom > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoChecksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) - } - - } - -} - -func (obj *patternFlowIcmpv6EchoChecksum) setDefault() { - var choices_set int = 0 - var choice PatternFlowIcmpv6EchoChecksumChoiceEnum - - if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { - choices_set += 1 - choice = PatternFlowIcmpv6EchoChecksumChoice.GENERATED - } - - if obj.obj.Custom != nil { - choices_set += 1 - choice = PatternFlowIcmpv6EchoChecksumChoice.CUSTOM - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIcmpv6EchoChecksumChoice.GENERATED) - if obj.obj.Generated.Number() == 0 { - obj.SetGenerated(PatternFlowIcmpv6EchoChecksumGenerated.GOOD) - - } - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpv6EchoChecksum") - } - } else { - intVal := otg.PatternFlowIcmpv6EchoChecksum_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIcmpv6EchoChecksum_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowPppAddressCounter ***** -type patternFlowPppAddressCounter struct { - validation - obj *otg.PatternFlowPppAddressCounter - marshaller marshalPatternFlowPppAddressCounter - unMarshaller unMarshalPatternFlowPppAddressCounter -} - -func NewPatternFlowPppAddressCounter() PatternFlowPppAddressCounter { - obj := patternFlowPppAddressCounter{obj: &otg.PatternFlowPppAddressCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPppAddressCounter) msg() *otg.PatternFlowPppAddressCounter { - return obj.obj -} - -func (obj *patternFlowPppAddressCounter) setMsg(msg *otg.PatternFlowPppAddressCounter) PatternFlowPppAddressCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPppAddressCounter struct { - obj *patternFlowPppAddressCounter -} - -type marshalPatternFlowPppAddressCounter interface { - // ToProto marshals PatternFlowPppAddressCounter to protobuf object *otg.PatternFlowPppAddressCounter - ToProto() (*otg.PatternFlowPppAddressCounter, error) - // ToPbText marshals PatternFlowPppAddressCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPppAddressCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPppAddressCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPppAddressCounter struct { - obj *patternFlowPppAddressCounter -} - -type unMarshalPatternFlowPppAddressCounter interface { - // FromProto unmarshals PatternFlowPppAddressCounter from protobuf object *otg.PatternFlowPppAddressCounter - FromProto(msg *otg.PatternFlowPppAddressCounter) (PatternFlowPppAddressCounter, error) - // FromPbText unmarshals PatternFlowPppAddressCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPppAddressCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPppAddressCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPppAddressCounter) Marshal() marshalPatternFlowPppAddressCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPppAddressCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPppAddressCounter) Unmarshal() unMarshalPatternFlowPppAddressCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPppAddressCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPppAddressCounter) ToProto() (*otg.PatternFlowPppAddressCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPppAddressCounter) FromProto(msg *otg.PatternFlowPppAddressCounter) (PatternFlowPppAddressCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPppAddressCounter) 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 *unMarshalpatternFlowPppAddressCounter) 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 *marshalpatternFlowPppAddressCounter) 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 *unMarshalpatternFlowPppAddressCounter) 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 *marshalpatternFlowPppAddressCounter) 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 *unMarshalpatternFlowPppAddressCounter) 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 *patternFlowPppAddressCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPppAddressCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPppAddressCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPppAddressCounter) Clone() (PatternFlowPppAddressCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPppAddressCounter() - 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 -} - -// PatternFlowPppAddressCounter is integer counter pattern -type PatternFlowPppAddressCounter interface { - Validation - // msg marshals PatternFlowPppAddressCounter to protobuf object *otg.PatternFlowPppAddressCounter - // and doesn't set defaults - msg() *otg.PatternFlowPppAddressCounter - // setMsg unmarshals PatternFlowPppAddressCounter from protobuf object *otg.PatternFlowPppAddressCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowPppAddressCounter) PatternFlowPppAddressCounter - // provides marshal interface - Marshal() marshalPatternFlowPppAddressCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPppAddressCounter - // validate validates PatternFlowPppAddressCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPppAddressCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowPppAddressCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowPppAddressCounter - SetStart(value uint32) PatternFlowPppAddressCounter - // HasStart checks if Start has been set in PatternFlowPppAddressCounter - HasStart() bool - // Step returns uint32, set in PatternFlowPppAddressCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowPppAddressCounter - SetStep(value uint32) PatternFlowPppAddressCounter - // HasStep checks if Step has been set in PatternFlowPppAddressCounter - HasStep() bool - // Count returns uint32, set in PatternFlowPppAddressCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPppAddressCounter - SetCount(value uint32) PatternFlowPppAddressCounter - // HasCount checks if Count has been set in PatternFlowPppAddressCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPppAddressCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPppAddressCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowPppAddressCounter object -func (obj *patternFlowPppAddressCounter) SetStart(value uint32) PatternFlowPppAddressCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPppAddressCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPppAddressCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowPppAddressCounter object -func (obj *patternFlowPppAddressCounter) SetStep(value uint32) PatternFlowPppAddressCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPppAddressCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPppAddressCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPppAddressCounter object -func (obj *patternFlowPppAddressCounter) SetCount(value uint32) PatternFlowPppAddressCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPppAddressCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppAddressCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppAddressCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppAddressCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowPppAddressCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(255) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPppAddressMetricTag ***** -type patternFlowPppAddressMetricTag struct { - validation - obj *otg.PatternFlowPppAddressMetricTag - marshaller marshalPatternFlowPppAddressMetricTag - unMarshaller unMarshalPatternFlowPppAddressMetricTag -} - -func NewPatternFlowPppAddressMetricTag() PatternFlowPppAddressMetricTag { - obj := patternFlowPppAddressMetricTag{obj: &otg.PatternFlowPppAddressMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPppAddressMetricTag) msg() *otg.PatternFlowPppAddressMetricTag { - return obj.obj -} - -func (obj *patternFlowPppAddressMetricTag) setMsg(msg *otg.PatternFlowPppAddressMetricTag) PatternFlowPppAddressMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPppAddressMetricTag struct { - obj *patternFlowPppAddressMetricTag -} - -type marshalPatternFlowPppAddressMetricTag interface { - // ToProto marshals PatternFlowPppAddressMetricTag to protobuf object *otg.PatternFlowPppAddressMetricTag - ToProto() (*otg.PatternFlowPppAddressMetricTag, error) - // ToPbText marshals PatternFlowPppAddressMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPppAddressMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPppAddressMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPppAddressMetricTag struct { - obj *patternFlowPppAddressMetricTag -} - -type unMarshalPatternFlowPppAddressMetricTag interface { - // FromProto unmarshals PatternFlowPppAddressMetricTag from protobuf object *otg.PatternFlowPppAddressMetricTag - FromProto(msg *otg.PatternFlowPppAddressMetricTag) (PatternFlowPppAddressMetricTag, error) - // FromPbText unmarshals PatternFlowPppAddressMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPppAddressMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPppAddressMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPppAddressMetricTag) Marshal() marshalPatternFlowPppAddressMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPppAddressMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPppAddressMetricTag) Unmarshal() unMarshalPatternFlowPppAddressMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPppAddressMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPppAddressMetricTag) ToProto() (*otg.PatternFlowPppAddressMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPppAddressMetricTag) FromProto(msg *otg.PatternFlowPppAddressMetricTag) (PatternFlowPppAddressMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPppAddressMetricTag) 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 *unMarshalpatternFlowPppAddressMetricTag) 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 *marshalpatternFlowPppAddressMetricTag) 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 *unMarshalpatternFlowPppAddressMetricTag) 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 *marshalpatternFlowPppAddressMetricTag) 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 *unMarshalpatternFlowPppAddressMetricTag) 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 *patternFlowPppAddressMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPppAddressMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPppAddressMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPppAddressMetricTag) Clone() (PatternFlowPppAddressMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPppAddressMetricTag() - 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 -} - -// PatternFlowPppAddressMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPppAddressMetricTag interface { - Validation - // msg marshals PatternFlowPppAddressMetricTag to protobuf object *otg.PatternFlowPppAddressMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPppAddressMetricTag - // setMsg unmarshals PatternFlowPppAddressMetricTag from protobuf object *otg.PatternFlowPppAddressMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPppAddressMetricTag) PatternFlowPppAddressMetricTag - // provides marshal interface - Marshal() marshalPatternFlowPppAddressMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPppAddressMetricTag - // validate validates PatternFlowPppAddressMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPppAddressMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPppAddressMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPppAddressMetricTag - SetName(value string) PatternFlowPppAddressMetricTag - // Offset returns uint32, set in PatternFlowPppAddressMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPppAddressMetricTag - SetOffset(value uint32) PatternFlowPppAddressMetricTag - // HasOffset checks if Offset has been set in PatternFlowPppAddressMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPppAddressMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPppAddressMetricTag - SetLength(value uint32) PatternFlowPppAddressMetricTag - // HasLength checks if Length has been set in PatternFlowPppAddressMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPppAddressMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPppAddressMetricTag object -func (obj *patternFlowPppAddressMetricTag) SetName(value string) PatternFlowPppAddressMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPppAddressMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPppAddressMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPppAddressMetricTag object -func (obj *patternFlowPppAddressMetricTag) SetOffset(value uint32) PatternFlowPppAddressMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPppAddressMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPppAddressMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPppAddressMetricTag object -func (obj *patternFlowPppAddressMetricTag) SetLength(value uint32) PatternFlowPppAddressMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPppAddressMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPppAddressMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppAddressMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPppAddressMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPppAddressMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowPppControlCounter ***** -type patternFlowPppControlCounter struct { - validation - obj *otg.PatternFlowPppControlCounter - marshaller marshalPatternFlowPppControlCounter - unMarshaller unMarshalPatternFlowPppControlCounter -} - -func NewPatternFlowPppControlCounter() PatternFlowPppControlCounter { - obj := patternFlowPppControlCounter{obj: &otg.PatternFlowPppControlCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPppControlCounter) msg() *otg.PatternFlowPppControlCounter { - return obj.obj -} - -func (obj *patternFlowPppControlCounter) setMsg(msg *otg.PatternFlowPppControlCounter) PatternFlowPppControlCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPppControlCounter struct { - obj *patternFlowPppControlCounter -} - -type marshalPatternFlowPppControlCounter interface { - // ToProto marshals PatternFlowPppControlCounter to protobuf object *otg.PatternFlowPppControlCounter - ToProto() (*otg.PatternFlowPppControlCounter, error) - // ToPbText marshals PatternFlowPppControlCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPppControlCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPppControlCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPppControlCounter struct { - obj *patternFlowPppControlCounter -} - -type unMarshalPatternFlowPppControlCounter interface { - // FromProto unmarshals PatternFlowPppControlCounter from protobuf object *otg.PatternFlowPppControlCounter - FromProto(msg *otg.PatternFlowPppControlCounter) (PatternFlowPppControlCounter, error) - // FromPbText unmarshals PatternFlowPppControlCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPppControlCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPppControlCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPppControlCounter) Marshal() marshalPatternFlowPppControlCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPppControlCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPppControlCounter) Unmarshal() unMarshalPatternFlowPppControlCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPppControlCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPppControlCounter) ToProto() (*otg.PatternFlowPppControlCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPppControlCounter) FromProto(msg *otg.PatternFlowPppControlCounter) (PatternFlowPppControlCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPppControlCounter) 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 *unMarshalpatternFlowPppControlCounter) 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 *marshalpatternFlowPppControlCounter) 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 *unMarshalpatternFlowPppControlCounter) 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 *marshalpatternFlowPppControlCounter) 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 *unMarshalpatternFlowPppControlCounter) 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 *patternFlowPppControlCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPppControlCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPppControlCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPppControlCounter) Clone() (PatternFlowPppControlCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPppControlCounter() - 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 -} - -// PatternFlowPppControlCounter is integer counter pattern -type PatternFlowPppControlCounter interface { - Validation - // msg marshals PatternFlowPppControlCounter to protobuf object *otg.PatternFlowPppControlCounter - // and doesn't set defaults - msg() *otg.PatternFlowPppControlCounter - // setMsg unmarshals PatternFlowPppControlCounter from protobuf object *otg.PatternFlowPppControlCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowPppControlCounter) PatternFlowPppControlCounter - // provides marshal interface - Marshal() marshalPatternFlowPppControlCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPppControlCounter - // validate validates PatternFlowPppControlCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPppControlCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowPppControlCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowPppControlCounter - SetStart(value uint32) PatternFlowPppControlCounter - // HasStart checks if Start has been set in PatternFlowPppControlCounter - HasStart() bool - // Step returns uint32, set in PatternFlowPppControlCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowPppControlCounter - SetStep(value uint32) PatternFlowPppControlCounter - // HasStep checks if Step has been set in PatternFlowPppControlCounter - HasStep() bool - // Count returns uint32, set in PatternFlowPppControlCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPppControlCounter - SetCount(value uint32) PatternFlowPppControlCounter - // HasCount checks if Count has been set in PatternFlowPppControlCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPppControlCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPppControlCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowPppControlCounter object -func (obj *patternFlowPppControlCounter) SetStart(value uint32) PatternFlowPppControlCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPppControlCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPppControlCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowPppControlCounter object -func (obj *patternFlowPppControlCounter) SetStep(value uint32) PatternFlowPppControlCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPppControlCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPppControlCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPppControlCounter object -func (obj *patternFlowPppControlCounter) SetCount(value uint32) PatternFlowPppControlCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPppControlCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppControlCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppControlCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppControlCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowPppControlCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(3) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPppControlMetricTag ***** -type patternFlowPppControlMetricTag struct { - validation - obj *otg.PatternFlowPppControlMetricTag - marshaller marshalPatternFlowPppControlMetricTag - unMarshaller unMarshalPatternFlowPppControlMetricTag -} - -func NewPatternFlowPppControlMetricTag() PatternFlowPppControlMetricTag { - obj := patternFlowPppControlMetricTag{obj: &otg.PatternFlowPppControlMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPppControlMetricTag) msg() *otg.PatternFlowPppControlMetricTag { - return obj.obj -} - -func (obj *patternFlowPppControlMetricTag) setMsg(msg *otg.PatternFlowPppControlMetricTag) PatternFlowPppControlMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPppControlMetricTag struct { - obj *patternFlowPppControlMetricTag -} - -type marshalPatternFlowPppControlMetricTag interface { - // ToProto marshals PatternFlowPppControlMetricTag to protobuf object *otg.PatternFlowPppControlMetricTag - ToProto() (*otg.PatternFlowPppControlMetricTag, error) - // ToPbText marshals PatternFlowPppControlMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPppControlMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPppControlMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPppControlMetricTag struct { - obj *patternFlowPppControlMetricTag -} - -type unMarshalPatternFlowPppControlMetricTag interface { - // FromProto unmarshals PatternFlowPppControlMetricTag from protobuf object *otg.PatternFlowPppControlMetricTag - FromProto(msg *otg.PatternFlowPppControlMetricTag) (PatternFlowPppControlMetricTag, error) - // FromPbText unmarshals PatternFlowPppControlMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPppControlMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPppControlMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPppControlMetricTag) Marshal() marshalPatternFlowPppControlMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPppControlMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPppControlMetricTag) Unmarshal() unMarshalPatternFlowPppControlMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPppControlMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPppControlMetricTag) ToProto() (*otg.PatternFlowPppControlMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPppControlMetricTag) FromProto(msg *otg.PatternFlowPppControlMetricTag) (PatternFlowPppControlMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPppControlMetricTag) 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 *unMarshalpatternFlowPppControlMetricTag) 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 *marshalpatternFlowPppControlMetricTag) 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 *unMarshalpatternFlowPppControlMetricTag) 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 *marshalpatternFlowPppControlMetricTag) 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 *unMarshalpatternFlowPppControlMetricTag) 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 *patternFlowPppControlMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPppControlMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPppControlMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPppControlMetricTag) Clone() (PatternFlowPppControlMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPppControlMetricTag() - 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 -} - -// PatternFlowPppControlMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPppControlMetricTag interface { - Validation - // msg marshals PatternFlowPppControlMetricTag to protobuf object *otg.PatternFlowPppControlMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPppControlMetricTag - // setMsg unmarshals PatternFlowPppControlMetricTag from protobuf object *otg.PatternFlowPppControlMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPppControlMetricTag) PatternFlowPppControlMetricTag - // provides marshal interface - Marshal() marshalPatternFlowPppControlMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPppControlMetricTag - // validate validates PatternFlowPppControlMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPppControlMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPppControlMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPppControlMetricTag - SetName(value string) PatternFlowPppControlMetricTag - // Offset returns uint32, set in PatternFlowPppControlMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPppControlMetricTag - SetOffset(value uint32) PatternFlowPppControlMetricTag - // HasOffset checks if Offset has been set in PatternFlowPppControlMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPppControlMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPppControlMetricTag - SetLength(value uint32) PatternFlowPppControlMetricTag - // HasLength checks if Length has been set in PatternFlowPppControlMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPppControlMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPppControlMetricTag object -func (obj *patternFlowPppControlMetricTag) SetName(value string) PatternFlowPppControlMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPppControlMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPppControlMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPppControlMetricTag object -func (obj *patternFlowPppControlMetricTag) SetOffset(value uint32) PatternFlowPppControlMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPppControlMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPppControlMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPppControlMetricTag object -func (obj *patternFlowPppControlMetricTag) SetLength(value uint32) PatternFlowPppControlMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPppControlMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPppControlMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppControlMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPppControlMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPppControlMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowPppProtocolTypeCounter ***** -type patternFlowPppProtocolTypeCounter struct { - validation - obj *otg.PatternFlowPppProtocolTypeCounter - marshaller marshalPatternFlowPppProtocolTypeCounter - unMarshaller unMarshalPatternFlowPppProtocolTypeCounter -} - -func NewPatternFlowPppProtocolTypeCounter() PatternFlowPppProtocolTypeCounter { - obj := patternFlowPppProtocolTypeCounter{obj: &otg.PatternFlowPppProtocolTypeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPppProtocolTypeCounter) msg() *otg.PatternFlowPppProtocolTypeCounter { - return obj.obj -} - -func (obj *patternFlowPppProtocolTypeCounter) setMsg(msg *otg.PatternFlowPppProtocolTypeCounter) PatternFlowPppProtocolTypeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPppProtocolTypeCounter struct { - obj *patternFlowPppProtocolTypeCounter -} - -type marshalPatternFlowPppProtocolTypeCounter interface { - // ToProto marshals PatternFlowPppProtocolTypeCounter to protobuf object *otg.PatternFlowPppProtocolTypeCounter - ToProto() (*otg.PatternFlowPppProtocolTypeCounter, error) - // ToPbText marshals PatternFlowPppProtocolTypeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPppProtocolTypeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPppProtocolTypeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPppProtocolTypeCounter struct { - obj *patternFlowPppProtocolTypeCounter -} - -type unMarshalPatternFlowPppProtocolTypeCounter interface { - // FromProto unmarshals PatternFlowPppProtocolTypeCounter from protobuf object *otg.PatternFlowPppProtocolTypeCounter - FromProto(msg *otg.PatternFlowPppProtocolTypeCounter) (PatternFlowPppProtocolTypeCounter, error) - // FromPbText unmarshals PatternFlowPppProtocolTypeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPppProtocolTypeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPppProtocolTypeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPppProtocolTypeCounter) Marshal() marshalPatternFlowPppProtocolTypeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPppProtocolTypeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPppProtocolTypeCounter) Unmarshal() unMarshalPatternFlowPppProtocolTypeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPppProtocolTypeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPppProtocolTypeCounter) ToProto() (*otg.PatternFlowPppProtocolTypeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPppProtocolTypeCounter) FromProto(msg *otg.PatternFlowPppProtocolTypeCounter) (PatternFlowPppProtocolTypeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPppProtocolTypeCounter) 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 *unMarshalpatternFlowPppProtocolTypeCounter) 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 *marshalpatternFlowPppProtocolTypeCounter) 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 *unMarshalpatternFlowPppProtocolTypeCounter) 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 *marshalpatternFlowPppProtocolTypeCounter) 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 *unMarshalpatternFlowPppProtocolTypeCounter) 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 *patternFlowPppProtocolTypeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPppProtocolTypeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPppProtocolTypeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPppProtocolTypeCounter) Clone() (PatternFlowPppProtocolTypeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPppProtocolTypeCounter() - 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 -} - -// PatternFlowPppProtocolTypeCounter is integer counter pattern -type PatternFlowPppProtocolTypeCounter interface { - Validation - // msg marshals PatternFlowPppProtocolTypeCounter to protobuf object *otg.PatternFlowPppProtocolTypeCounter - // and doesn't set defaults - msg() *otg.PatternFlowPppProtocolTypeCounter - // setMsg unmarshals PatternFlowPppProtocolTypeCounter from protobuf object *otg.PatternFlowPppProtocolTypeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowPppProtocolTypeCounter) PatternFlowPppProtocolTypeCounter - // provides marshal interface - Marshal() marshalPatternFlowPppProtocolTypeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPppProtocolTypeCounter - // validate validates PatternFlowPppProtocolTypeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPppProtocolTypeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowPppProtocolTypeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowPppProtocolTypeCounter - SetStart(value uint32) PatternFlowPppProtocolTypeCounter - // HasStart checks if Start has been set in PatternFlowPppProtocolTypeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowPppProtocolTypeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowPppProtocolTypeCounter - SetStep(value uint32) PatternFlowPppProtocolTypeCounter - // HasStep checks if Step has been set in PatternFlowPppProtocolTypeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowPppProtocolTypeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowPppProtocolTypeCounter - SetCount(value uint32) PatternFlowPppProtocolTypeCounter - // HasCount checks if Count has been set in PatternFlowPppProtocolTypeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPppProtocolTypeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowPppProtocolTypeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowPppProtocolTypeCounter object -func (obj *patternFlowPppProtocolTypeCounter) SetStart(value uint32) PatternFlowPppProtocolTypeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPppProtocolTypeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowPppProtocolTypeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowPppProtocolTypeCounter object -func (obj *patternFlowPppProtocolTypeCounter) SetStep(value uint32) PatternFlowPppProtocolTypeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPppProtocolTypeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowPppProtocolTypeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowPppProtocolTypeCounter object -func (obj *patternFlowPppProtocolTypeCounter) SetCount(value uint32) PatternFlowPppProtocolTypeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowPppProtocolTypeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppProtocolTypeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppProtocolTypeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppProtocolTypeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowPppProtocolTypeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(33) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowPppProtocolTypeMetricTag ***** -type patternFlowPppProtocolTypeMetricTag struct { - validation - obj *otg.PatternFlowPppProtocolTypeMetricTag - marshaller marshalPatternFlowPppProtocolTypeMetricTag - unMarshaller unMarshalPatternFlowPppProtocolTypeMetricTag -} - -func NewPatternFlowPppProtocolTypeMetricTag() PatternFlowPppProtocolTypeMetricTag { - obj := patternFlowPppProtocolTypeMetricTag{obj: &otg.PatternFlowPppProtocolTypeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowPppProtocolTypeMetricTag) msg() *otg.PatternFlowPppProtocolTypeMetricTag { - return obj.obj -} - -func (obj *patternFlowPppProtocolTypeMetricTag) setMsg(msg *otg.PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowPppProtocolTypeMetricTag struct { - obj *patternFlowPppProtocolTypeMetricTag -} - -type marshalPatternFlowPppProtocolTypeMetricTag interface { - // ToProto marshals PatternFlowPppProtocolTypeMetricTag to protobuf object *otg.PatternFlowPppProtocolTypeMetricTag - ToProto() (*otg.PatternFlowPppProtocolTypeMetricTag, error) - // ToPbText marshals PatternFlowPppProtocolTypeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowPppProtocolTypeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowPppProtocolTypeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowPppProtocolTypeMetricTag struct { - obj *patternFlowPppProtocolTypeMetricTag -} - -type unMarshalPatternFlowPppProtocolTypeMetricTag interface { - // FromProto unmarshals PatternFlowPppProtocolTypeMetricTag from protobuf object *otg.PatternFlowPppProtocolTypeMetricTag - FromProto(msg *otg.PatternFlowPppProtocolTypeMetricTag) (PatternFlowPppProtocolTypeMetricTag, error) - // FromPbText unmarshals PatternFlowPppProtocolTypeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowPppProtocolTypeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowPppProtocolTypeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowPppProtocolTypeMetricTag) Marshal() marshalPatternFlowPppProtocolTypeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowPppProtocolTypeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowPppProtocolTypeMetricTag) Unmarshal() unMarshalPatternFlowPppProtocolTypeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowPppProtocolTypeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowPppProtocolTypeMetricTag) ToProto() (*otg.PatternFlowPppProtocolTypeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowPppProtocolTypeMetricTag) FromProto(msg *otg.PatternFlowPppProtocolTypeMetricTag) (PatternFlowPppProtocolTypeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowPppProtocolTypeMetricTag) 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 *unMarshalpatternFlowPppProtocolTypeMetricTag) 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 *marshalpatternFlowPppProtocolTypeMetricTag) 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 *unMarshalpatternFlowPppProtocolTypeMetricTag) 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 *marshalpatternFlowPppProtocolTypeMetricTag) 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 *unMarshalpatternFlowPppProtocolTypeMetricTag) 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 *patternFlowPppProtocolTypeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowPppProtocolTypeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowPppProtocolTypeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowPppProtocolTypeMetricTag) Clone() (PatternFlowPppProtocolTypeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowPppProtocolTypeMetricTag() - 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 -} - -// PatternFlowPppProtocolTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowPppProtocolTypeMetricTag interface { - Validation - // msg marshals PatternFlowPppProtocolTypeMetricTag to protobuf object *otg.PatternFlowPppProtocolTypeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowPppProtocolTypeMetricTag - // setMsg unmarshals PatternFlowPppProtocolTypeMetricTag from protobuf object *otg.PatternFlowPppProtocolTypeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowPppProtocolTypeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowPppProtocolTypeMetricTag - // validate validates PatternFlowPppProtocolTypeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowPppProtocolTypeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowPppProtocolTypeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowPppProtocolTypeMetricTag - SetName(value string) PatternFlowPppProtocolTypeMetricTag - // Offset returns uint32, set in PatternFlowPppProtocolTypeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowPppProtocolTypeMetricTag - SetOffset(value uint32) PatternFlowPppProtocolTypeMetricTag - // HasOffset checks if Offset has been set in PatternFlowPppProtocolTypeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowPppProtocolTypeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowPppProtocolTypeMetricTag - SetLength(value uint32) PatternFlowPppProtocolTypeMetricTag - // HasLength checks if Length has been set in PatternFlowPppProtocolTypeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowPppProtocolTypeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowPppProtocolTypeMetricTag object -func (obj *patternFlowPppProtocolTypeMetricTag) SetName(value string) PatternFlowPppProtocolTypeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPppProtocolTypeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowPppProtocolTypeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowPppProtocolTypeMetricTag object -func (obj *patternFlowPppProtocolTypeMetricTag) SetOffset(value uint32) PatternFlowPppProtocolTypeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPppProtocolTypeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowPppProtocolTypeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowPppProtocolTypeMetricTag object -func (obj *patternFlowPppProtocolTypeMetricTag) SetLength(value uint32) PatternFlowPppProtocolTypeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowPppProtocolTypeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPppProtocolTypeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowPppProtocolTypeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowPppProtocolTypeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowPppProtocolTypeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowIgmpv1VersionCounter ***** -type patternFlowIgmpv1VersionCounter struct { - validation - obj *otg.PatternFlowIgmpv1VersionCounter - marshaller marshalPatternFlowIgmpv1VersionCounter - unMarshaller unMarshalPatternFlowIgmpv1VersionCounter -} - -func NewPatternFlowIgmpv1VersionCounter() PatternFlowIgmpv1VersionCounter { - obj := patternFlowIgmpv1VersionCounter{obj: &otg.PatternFlowIgmpv1VersionCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIgmpv1VersionCounter) msg() *otg.PatternFlowIgmpv1VersionCounter { - return obj.obj -} - -func (obj *patternFlowIgmpv1VersionCounter) setMsg(msg *otg.PatternFlowIgmpv1VersionCounter) PatternFlowIgmpv1VersionCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIgmpv1VersionCounter struct { - obj *patternFlowIgmpv1VersionCounter -} - -type marshalPatternFlowIgmpv1VersionCounter interface { - // ToProto marshals PatternFlowIgmpv1VersionCounter to protobuf object *otg.PatternFlowIgmpv1VersionCounter - ToProto() (*otg.PatternFlowIgmpv1VersionCounter, error) - // ToPbText marshals PatternFlowIgmpv1VersionCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIgmpv1VersionCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIgmpv1VersionCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIgmpv1VersionCounter struct { - obj *patternFlowIgmpv1VersionCounter -} - -type unMarshalPatternFlowIgmpv1VersionCounter interface { - // FromProto unmarshals PatternFlowIgmpv1VersionCounter from protobuf object *otg.PatternFlowIgmpv1VersionCounter - FromProto(msg *otg.PatternFlowIgmpv1VersionCounter) (PatternFlowIgmpv1VersionCounter, error) - // FromPbText unmarshals PatternFlowIgmpv1VersionCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIgmpv1VersionCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIgmpv1VersionCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIgmpv1VersionCounter) Marshal() marshalPatternFlowIgmpv1VersionCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIgmpv1VersionCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIgmpv1VersionCounter) Unmarshal() unMarshalPatternFlowIgmpv1VersionCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIgmpv1VersionCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIgmpv1VersionCounter) ToProto() (*otg.PatternFlowIgmpv1VersionCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIgmpv1VersionCounter) FromProto(msg *otg.PatternFlowIgmpv1VersionCounter) (PatternFlowIgmpv1VersionCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIgmpv1VersionCounter) 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 *unMarshalpatternFlowIgmpv1VersionCounter) 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 *marshalpatternFlowIgmpv1VersionCounter) 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 *unMarshalpatternFlowIgmpv1VersionCounter) 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 *marshalpatternFlowIgmpv1VersionCounter) 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 *unMarshalpatternFlowIgmpv1VersionCounter) 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 *patternFlowIgmpv1VersionCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1VersionCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1VersionCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIgmpv1VersionCounter) Clone() (PatternFlowIgmpv1VersionCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIgmpv1VersionCounter() - 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 -} - -// PatternFlowIgmpv1VersionCounter is integer counter pattern -type PatternFlowIgmpv1VersionCounter interface { - Validation - // msg marshals PatternFlowIgmpv1VersionCounter to protobuf object *otg.PatternFlowIgmpv1VersionCounter - // and doesn't set defaults - msg() *otg.PatternFlowIgmpv1VersionCounter - // setMsg unmarshals PatternFlowIgmpv1VersionCounter from protobuf object *otg.PatternFlowIgmpv1VersionCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIgmpv1VersionCounter) PatternFlowIgmpv1VersionCounter - // provides marshal interface - Marshal() marshalPatternFlowIgmpv1VersionCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIgmpv1VersionCounter - // validate validates PatternFlowIgmpv1VersionCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIgmpv1VersionCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIgmpv1VersionCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIgmpv1VersionCounter - SetStart(value uint32) PatternFlowIgmpv1VersionCounter - // HasStart checks if Start has been set in PatternFlowIgmpv1VersionCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIgmpv1VersionCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIgmpv1VersionCounter - SetStep(value uint32) PatternFlowIgmpv1VersionCounter - // HasStep checks if Step has been set in PatternFlowIgmpv1VersionCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIgmpv1VersionCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIgmpv1VersionCounter - SetCount(value uint32) PatternFlowIgmpv1VersionCounter - // HasCount checks if Count has been set in PatternFlowIgmpv1VersionCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIgmpv1VersionCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIgmpv1VersionCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIgmpv1VersionCounter object -func (obj *patternFlowIgmpv1VersionCounter) SetStart(value uint32) PatternFlowIgmpv1VersionCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIgmpv1VersionCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIgmpv1VersionCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIgmpv1VersionCounter object -func (obj *patternFlowIgmpv1VersionCounter) SetStep(value uint32) PatternFlowIgmpv1VersionCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIgmpv1VersionCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIgmpv1VersionCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIgmpv1VersionCounter object -func (obj *patternFlowIgmpv1VersionCounter) SetCount(value uint32) PatternFlowIgmpv1VersionCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIgmpv1VersionCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1VersionCounter.Start <= 15 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1VersionCounter.Step <= 15 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1VersionCounter.Count <= 15 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIgmpv1VersionCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIgmpv1VersionMetricTag ***** -type patternFlowIgmpv1VersionMetricTag struct { - validation - obj *otg.PatternFlowIgmpv1VersionMetricTag - marshaller marshalPatternFlowIgmpv1VersionMetricTag - unMarshaller unMarshalPatternFlowIgmpv1VersionMetricTag -} - -func NewPatternFlowIgmpv1VersionMetricTag() PatternFlowIgmpv1VersionMetricTag { - obj := patternFlowIgmpv1VersionMetricTag{obj: &otg.PatternFlowIgmpv1VersionMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIgmpv1VersionMetricTag) msg() *otg.PatternFlowIgmpv1VersionMetricTag { - return obj.obj -} - -func (obj *patternFlowIgmpv1VersionMetricTag) setMsg(msg *otg.PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIgmpv1VersionMetricTag struct { - obj *patternFlowIgmpv1VersionMetricTag -} - -type marshalPatternFlowIgmpv1VersionMetricTag interface { - // ToProto marshals PatternFlowIgmpv1VersionMetricTag to protobuf object *otg.PatternFlowIgmpv1VersionMetricTag - ToProto() (*otg.PatternFlowIgmpv1VersionMetricTag, error) - // ToPbText marshals PatternFlowIgmpv1VersionMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIgmpv1VersionMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIgmpv1VersionMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIgmpv1VersionMetricTag struct { - obj *patternFlowIgmpv1VersionMetricTag -} - -type unMarshalPatternFlowIgmpv1VersionMetricTag interface { - // FromProto unmarshals PatternFlowIgmpv1VersionMetricTag from protobuf object *otg.PatternFlowIgmpv1VersionMetricTag - FromProto(msg *otg.PatternFlowIgmpv1VersionMetricTag) (PatternFlowIgmpv1VersionMetricTag, error) - // FromPbText unmarshals PatternFlowIgmpv1VersionMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIgmpv1VersionMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIgmpv1VersionMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIgmpv1VersionMetricTag) Marshal() marshalPatternFlowIgmpv1VersionMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIgmpv1VersionMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIgmpv1VersionMetricTag) Unmarshal() unMarshalPatternFlowIgmpv1VersionMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIgmpv1VersionMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIgmpv1VersionMetricTag) ToProto() (*otg.PatternFlowIgmpv1VersionMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIgmpv1VersionMetricTag) FromProto(msg *otg.PatternFlowIgmpv1VersionMetricTag) (PatternFlowIgmpv1VersionMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIgmpv1VersionMetricTag) 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 *unMarshalpatternFlowIgmpv1VersionMetricTag) 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 *marshalpatternFlowIgmpv1VersionMetricTag) 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 *unMarshalpatternFlowIgmpv1VersionMetricTag) 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 *marshalpatternFlowIgmpv1VersionMetricTag) 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 *unMarshalpatternFlowIgmpv1VersionMetricTag) 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 *patternFlowIgmpv1VersionMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1VersionMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1VersionMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIgmpv1VersionMetricTag) Clone() (PatternFlowIgmpv1VersionMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIgmpv1VersionMetricTag() - 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 -} - -// PatternFlowIgmpv1VersionMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIgmpv1VersionMetricTag interface { - Validation - // msg marshals PatternFlowIgmpv1VersionMetricTag to protobuf object *otg.PatternFlowIgmpv1VersionMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIgmpv1VersionMetricTag - // setMsg unmarshals PatternFlowIgmpv1VersionMetricTag from protobuf object *otg.PatternFlowIgmpv1VersionMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIgmpv1VersionMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIgmpv1VersionMetricTag - // validate validates PatternFlowIgmpv1VersionMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIgmpv1VersionMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIgmpv1VersionMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIgmpv1VersionMetricTag - SetName(value string) PatternFlowIgmpv1VersionMetricTag - // Offset returns uint32, set in PatternFlowIgmpv1VersionMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIgmpv1VersionMetricTag - SetOffset(value uint32) PatternFlowIgmpv1VersionMetricTag - // HasOffset checks if Offset has been set in PatternFlowIgmpv1VersionMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIgmpv1VersionMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIgmpv1VersionMetricTag - SetLength(value uint32) PatternFlowIgmpv1VersionMetricTag - // HasLength checks if Length has been set in PatternFlowIgmpv1VersionMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIgmpv1VersionMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIgmpv1VersionMetricTag object -func (obj *patternFlowIgmpv1VersionMetricTag) SetName(value string) PatternFlowIgmpv1VersionMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIgmpv1VersionMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIgmpv1VersionMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIgmpv1VersionMetricTag object -func (obj *patternFlowIgmpv1VersionMetricTag) SetOffset(value uint32) PatternFlowIgmpv1VersionMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIgmpv1VersionMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIgmpv1VersionMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIgmpv1VersionMetricTag object -func (obj *patternFlowIgmpv1VersionMetricTag) SetLength(value uint32) PatternFlowIgmpv1VersionMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIgmpv1VersionMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIgmpv1VersionMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1VersionMetricTag.Offset <= 3 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 4 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIgmpv1VersionMetricTag.Length <= 4 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIgmpv1VersionMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(4) - } - -} - -// ***** PatternFlowIgmpv1TypeCounter ***** -type patternFlowIgmpv1TypeCounter struct { - validation - obj *otg.PatternFlowIgmpv1TypeCounter - marshaller marshalPatternFlowIgmpv1TypeCounter - unMarshaller unMarshalPatternFlowIgmpv1TypeCounter -} - -func NewPatternFlowIgmpv1TypeCounter() PatternFlowIgmpv1TypeCounter { - obj := patternFlowIgmpv1TypeCounter{obj: &otg.PatternFlowIgmpv1TypeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIgmpv1TypeCounter) msg() *otg.PatternFlowIgmpv1TypeCounter { - return obj.obj -} - -func (obj *patternFlowIgmpv1TypeCounter) setMsg(msg *otg.PatternFlowIgmpv1TypeCounter) PatternFlowIgmpv1TypeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIgmpv1TypeCounter struct { - obj *patternFlowIgmpv1TypeCounter -} - -type marshalPatternFlowIgmpv1TypeCounter interface { - // ToProto marshals PatternFlowIgmpv1TypeCounter to protobuf object *otg.PatternFlowIgmpv1TypeCounter - ToProto() (*otg.PatternFlowIgmpv1TypeCounter, error) - // ToPbText marshals PatternFlowIgmpv1TypeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIgmpv1TypeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIgmpv1TypeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIgmpv1TypeCounter struct { - obj *patternFlowIgmpv1TypeCounter -} - -type unMarshalPatternFlowIgmpv1TypeCounter interface { - // FromProto unmarshals PatternFlowIgmpv1TypeCounter from protobuf object *otg.PatternFlowIgmpv1TypeCounter - FromProto(msg *otg.PatternFlowIgmpv1TypeCounter) (PatternFlowIgmpv1TypeCounter, error) - // FromPbText unmarshals PatternFlowIgmpv1TypeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIgmpv1TypeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIgmpv1TypeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIgmpv1TypeCounter) Marshal() marshalPatternFlowIgmpv1TypeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIgmpv1TypeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIgmpv1TypeCounter) Unmarshal() unMarshalPatternFlowIgmpv1TypeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIgmpv1TypeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIgmpv1TypeCounter) ToProto() (*otg.PatternFlowIgmpv1TypeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIgmpv1TypeCounter) FromProto(msg *otg.PatternFlowIgmpv1TypeCounter) (PatternFlowIgmpv1TypeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIgmpv1TypeCounter) 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 *unMarshalpatternFlowIgmpv1TypeCounter) 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 *marshalpatternFlowIgmpv1TypeCounter) 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 *unMarshalpatternFlowIgmpv1TypeCounter) 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 *marshalpatternFlowIgmpv1TypeCounter) 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 *unMarshalpatternFlowIgmpv1TypeCounter) 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 *patternFlowIgmpv1TypeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1TypeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1TypeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIgmpv1TypeCounter) Clone() (PatternFlowIgmpv1TypeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIgmpv1TypeCounter() - 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 -} - -// PatternFlowIgmpv1TypeCounter is integer counter pattern -type PatternFlowIgmpv1TypeCounter interface { - Validation - // msg marshals PatternFlowIgmpv1TypeCounter to protobuf object *otg.PatternFlowIgmpv1TypeCounter - // and doesn't set defaults - msg() *otg.PatternFlowIgmpv1TypeCounter - // setMsg unmarshals PatternFlowIgmpv1TypeCounter from protobuf object *otg.PatternFlowIgmpv1TypeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIgmpv1TypeCounter) PatternFlowIgmpv1TypeCounter - // provides marshal interface - Marshal() marshalPatternFlowIgmpv1TypeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIgmpv1TypeCounter - // validate validates PatternFlowIgmpv1TypeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIgmpv1TypeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIgmpv1TypeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIgmpv1TypeCounter - SetStart(value uint32) PatternFlowIgmpv1TypeCounter - // HasStart checks if Start has been set in PatternFlowIgmpv1TypeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIgmpv1TypeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIgmpv1TypeCounter - SetStep(value uint32) PatternFlowIgmpv1TypeCounter - // HasStep checks if Step has been set in PatternFlowIgmpv1TypeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIgmpv1TypeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIgmpv1TypeCounter - SetCount(value uint32) PatternFlowIgmpv1TypeCounter - // HasCount checks if Count has been set in PatternFlowIgmpv1TypeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIgmpv1TypeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIgmpv1TypeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIgmpv1TypeCounter object -func (obj *patternFlowIgmpv1TypeCounter) SetStart(value uint32) PatternFlowIgmpv1TypeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIgmpv1TypeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIgmpv1TypeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIgmpv1TypeCounter object -func (obj *patternFlowIgmpv1TypeCounter) SetStep(value uint32) PatternFlowIgmpv1TypeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIgmpv1TypeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIgmpv1TypeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIgmpv1TypeCounter object -func (obj *patternFlowIgmpv1TypeCounter) SetCount(value uint32) PatternFlowIgmpv1TypeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIgmpv1TypeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1TypeCounter.Start <= 15 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1TypeCounter.Step <= 15 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1TypeCounter.Count <= 15 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIgmpv1TypeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIgmpv1TypeMetricTag ***** -type patternFlowIgmpv1TypeMetricTag struct { - validation - obj *otg.PatternFlowIgmpv1TypeMetricTag - marshaller marshalPatternFlowIgmpv1TypeMetricTag - unMarshaller unMarshalPatternFlowIgmpv1TypeMetricTag -} - -func NewPatternFlowIgmpv1TypeMetricTag() PatternFlowIgmpv1TypeMetricTag { - obj := patternFlowIgmpv1TypeMetricTag{obj: &otg.PatternFlowIgmpv1TypeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIgmpv1TypeMetricTag) msg() *otg.PatternFlowIgmpv1TypeMetricTag { - return obj.obj -} - -func (obj *patternFlowIgmpv1TypeMetricTag) setMsg(msg *otg.PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIgmpv1TypeMetricTag struct { - obj *patternFlowIgmpv1TypeMetricTag -} - -type marshalPatternFlowIgmpv1TypeMetricTag interface { - // ToProto marshals PatternFlowIgmpv1TypeMetricTag to protobuf object *otg.PatternFlowIgmpv1TypeMetricTag - ToProto() (*otg.PatternFlowIgmpv1TypeMetricTag, error) - // ToPbText marshals PatternFlowIgmpv1TypeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIgmpv1TypeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIgmpv1TypeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIgmpv1TypeMetricTag struct { - obj *patternFlowIgmpv1TypeMetricTag -} - -type unMarshalPatternFlowIgmpv1TypeMetricTag interface { - // FromProto unmarshals PatternFlowIgmpv1TypeMetricTag from protobuf object *otg.PatternFlowIgmpv1TypeMetricTag - FromProto(msg *otg.PatternFlowIgmpv1TypeMetricTag) (PatternFlowIgmpv1TypeMetricTag, error) - // FromPbText unmarshals PatternFlowIgmpv1TypeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIgmpv1TypeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIgmpv1TypeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIgmpv1TypeMetricTag) Marshal() marshalPatternFlowIgmpv1TypeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIgmpv1TypeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIgmpv1TypeMetricTag) Unmarshal() unMarshalPatternFlowIgmpv1TypeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIgmpv1TypeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIgmpv1TypeMetricTag) ToProto() (*otg.PatternFlowIgmpv1TypeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIgmpv1TypeMetricTag) FromProto(msg *otg.PatternFlowIgmpv1TypeMetricTag) (PatternFlowIgmpv1TypeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIgmpv1TypeMetricTag) 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 *unMarshalpatternFlowIgmpv1TypeMetricTag) 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 *marshalpatternFlowIgmpv1TypeMetricTag) 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 *unMarshalpatternFlowIgmpv1TypeMetricTag) 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 *marshalpatternFlowIgmpv1TypeMetricTag) 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 *unMarshalpatternFlowIgmpv1TypeMetricTag) 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 *patternFlowIgmpv1TypeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1TypeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1TypeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIgmpv1TypeMetricTag) Clone() (PatternFlowIgmpv1TypeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIgmpv1TypeMetricTag() - 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 -} - -// PatternFlowIgmpv1TypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIgmpv1TypeMetricTag interface { - Validation - // msg marshals PatternFlowIgmpv1TypeMetricTag to protobuf object *otg.PatternFlowIgmpv1TypeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIgmpv1TypeMetricTag - // setMsg unmarshals PatternFlowIgmpv1TypeMetricTag from protobuf object *otg.PatternFlowIgmpv1TypeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIgmpv1TypeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIgmpv1TypeMetricTag - // validate validates PatternFlowIgmpv1TypeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIgmpv1TypeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIgmpv1TypeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIgmpv1TypeMetricTag - SetName(value string) PatternFlowIgmpv1TypeMetricTag - // Offset returns uint32, set in PatternFlowIgmpv1TypeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIgmpv1TypeMetricTag - SetOffset(value uint32) PatternFlowIgmpv1TypeMetricTag - // HasOffset checks if Offset has been set in PatternFlowIgmpv1TypeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIgmpv1TypeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIgmpv1TypeMetricTag - SetLength(value uint32) PatternFlowIgmpv1TypeMetricTag - // HasLength checks if Length has been set in PatternFlowIgmpv1TypeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIgmpv1TypeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIgmpv1TypeMetricTag object -func (obj *patternFlowIgmpv1TypeMetricTag) SetName(value string) PatternFlowIgmpv1TypeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIgmpv1TypeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIgmpv1TypeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIgmpv1TypeMetricTag object -func (obj *patternFlowIgmpv1TypeMetricTag) SetOffset(value uint32) PatternFlowIgmpv1TypeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIgmpv1TypeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIgmpv1TypeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIgmpv1TypeMetricTag object -func (obj *patternFlowIgmpv1TypeMetricTag) SetLength(value uint32) PatternFlowIgmpv1TypeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIgmpv1TypeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIgmpv1TypeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1TypeMetricTag.Offset <= 3 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 4 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIgmpv1TypeMetricTag.Length <= 4 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIgmpv1TypeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(4) - } - -} - -// ***** PatternFlowIgmpv1UnusedCounter ***** -type patternFlowIgmpv1UnusedCounter struct { - validation - obj *otg.PatternFlowIgmpv1UnusedCounter - marshaller marshalPatternFlowIgmpv1UnusedCounter - unMarshaller unMarshalPatternFlowIgmpv1UnusedCounter -} - -func NewPatternFlowIgmpv1UnusedCounter() PatternFlowIgmpv1UnusedCounter { - obj := patternFlowIgmpv1UnusedCounter{obj: &otg.PatternFlowIgmpv1UnusedCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIgmpv1UnusedCounter) msg() *otg.PatternFlowIgmpv1UnusedCounter { - return obj.obj -} - -func (obj *patternFlowIgmpv1UnusedCounter) setMsg(msg *otg.PatternFlowIgmpv1UnusedCounter) PatternFlowIgmpv1UnusedCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIgmpv1UnusedCounter struct { - obj *patternFlowIgmpv1UnusedCounter -} - -type marshalPatternFlowIgmpv1UnusedCounter interface { - // ToProto marshals PatternFlowIgmpv1UnusedCounter to protobuf object *otg.PatternFlowIgmpv1UnusedCounter - ToProto() (*otg.PatternFlowIgmpv1UnusedCounter, error) - // ToPbText marshals PatternFlowIgmpv1UnusedCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIgmpv1UnusedCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIgmpv1UnusedCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIgmpv1UnusedCounter struct { - obj *patternFlowIgmpv1UnusedCounter -} - -type unMarshalPatternFlowIgmpv1UnusedCounter interface { - // FromProto unmarshals PatternFlowIgmpv1UnusedCounter from protobuf object *otg.PatternFlowIgmpv1UnusedCounter - FromProto(msg *otg.PatternFlowIgmpv1UnusedCounter) (PatternFlowIgmpv1UnusedCounter, error) - // FromPbText unmarshals PatternFlowIgmpv1UnusedCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIgmpv1UnusedCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIgmpv1UnusedCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIgmpv1UnusedCounter) Marshal() marshalPatternFlowIgmpv1UnusedCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIgmpv1UnusedCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIgmpv1UnusedCounter) Unmarshal() unMarshalPatternFlowIgmpv1UnusedCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIgmpv1UnusedCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIgmpv1UnusedCounter) ToProto() (*otg.PatternFlowIgmpv1UnusedCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIgmpv1UnusedCounter) FromProto(msg *otg.PatternFlowIgmpv1UnusedCounter) (PatternFlowIgmpv1UnusedCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIgmpv1UnusedCounter) 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 *unMarshalpatternFlowIgmpv1UnusedCounter) 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 *marshalpatternFlowIgmpv1UnusedCounter) 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 *unMarshalpatternFlowIgmpv1UnusedCounter) 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 *marshalpatternFlowIgmpv1UnusedCounter) 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 *unMarshalpatternFlowIgmpv1UnusedCounter) 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 *patternFlowIgmpv1UnusedCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1UnusedCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1UnusedCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIgmpv1UnusedCounter) Clone() (PatternFlowIgmpv1UnusedCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIgmpv1UnusedCounter() - 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 -} - -// PatternFlowIgmpv1UnusedCounter is integer counter pattern -type PatternFlowIgmpv1UnusedCounter interface { - Validation - // msg marshals PatternFlowIgmpv1UnusedCounter to protobuf object *otg.PatternFlowIgmpv1UnusedCounter - // and doesn't set defaults - msg() *otg.PatternFlowIgmpv1UnusedCounter - // setMsg unmarshals PatternFlowIgmpv1UnusedCounter from protobuf object *otg.PatternFlowIgmpv1UnusedCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIgmpv1UnusedCounter) PatternFlowIgmpv1UnusedCounter - // provides marshal interface - Marshal() marshalPatternFlowIgmpv1UnusedCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIgmpv1UnusedCounter - // validate validates PatternFlowIgmpv1UnusedCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIgmpv1UnusedCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIgmpv1UnusedCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIgmpv1UnusedCounter - SetStart(value uint32) PatternFlowIgmpv1UnusedCounter - // HasStart checks if Start has been set in PatternFlowIgmpv1UnusedCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIgmpv1UnusedCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIgmpv1UnusedCounter - SetStep(value uint32) PatternFlowIgmpv1UnusedCounter - // HasStep checks if Step has been set in PatternFlowIgmpv1UnusedCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIgmpv1UnusedCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIgmpv1UnusedCounter - SetCount(value uint32) PatternFlowIgmpv1UnusedCounter - // HasCount checks if Count has been set in PatternFlowIgmpv1UnusedCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIgmpv1UnusedCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIgmpv1UnusedCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIgmpv1UnusedCounter object -func (obj *patternFlowIgmpv1UnusedCounter) SetStart(value uint32) PatternFlowIgmpv1UnusedCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIgmpv1UnusedCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIgmpv1UnusedCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIgmpv1UnusedCounter object -func (obj *patternFlowIgmpv1UnusedCounter) SetStep(value uint32) PatternFlowIgmpv1UnusedCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIgmpv1UnusedCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIgmpv1UnusedCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIgmpv1UnusedCounter object -func (obj *patternFlowIgmpv1UnusedCounter) SetCount(value uint32) PatternFlowIgmpv1UnusedCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIgmpv1UnusedCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1UnusedCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1UnusedCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1UnusedCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIgmpv1UnusedCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIgmpv1UnusedMetricTag ***** -type patternFlowIgmpv1UnusedMetricTag struct { - validation - obj *otg.PatternFlowIgmpv1UnusedMetricTag - marshaller marshalPatternFlowIgmpv1UnusedMetricTag - unMarshaller unMarshalPatternFlowIgmpv1UnusedMetricTag -} - -func NewPatternFlowIgmpv1UnusedMetricTag() PatternFlowIgmpv1UnusedMetricTag { - obj := patternFlowIgmpv1UnusedMetricTag{obj: &otg.PatternFlowIgmpv1UnusedMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIgmpv1UnusedMetricTag) msg() *otg.PatternFlowIgmpv1UnusedMetricTag { - return obj.obj -} - -func (obj *patternFlowIgmpv1UnusedMetricTag) setMsg(msg *otg.PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIgmpv1UnusedMetricTag struct { - obj *patternFlowIgmpv1UnusedMetricTag -} - -type marshalPatternFlowIgmpv1UnusedMetricTag interface { - // ToProto marshals PatternFlowIgmpv1UnusedMetricTag to protobuf object *otg.PatternFlowIgmpv1UnusedMetricTag - ToProto() (*otg.PatternFlowIgmpv1UnusedMetricTag, error) - // ToPbText marshals PatternFlowIgmpv1UnusedMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIgmpv1UnusedMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIgmpv1UnusedMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIgmpv1UnusedMetricTag struct { - obj *patternFlowIgmpv1UnusedMetricTag -} - -type unMarshalPatternFlowIgmpv1UnusedMetricTag interface { - // FromProto unmarshals PatternFlowIgmpv1UnusedMetricTag from protobuf object *otg.PatternFlowIgmpv1UnusedMetricTag - FromProto(msg *otg.PatternFlowIgmpv1UnusedMetricTag) (PatternFlowIgmpv1UnusedMetricTag, error) - // FromPbText unmarshals PatternFlowIgmpv1UnusedMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIgmpv1UnusedMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIgmpv1UnusedMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIgmpv1UnusedMetricTag) Marshal() marshalPatternFlowIgmpv1UnusedMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIgmpv1UnusedMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIgmpv1UnusedMetricTag) Unmarshal() unMarshalPatternFlowIgmpv1UnusedMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIgmpv1UnusedMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIgmpv1UnusedMetricTag) ToProto() (*otg.PatternFlowIgmpv1UnusedMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIgmpv1UnusedMetricTag) FromProto(msg *otg.PatternFlowIgmpv1UnusedMetricTag) (PatternFlowIgmpv1UnusedMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIgmpv1UnusedMetricTag) 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 *unMarshalpatternFlowIgmpv1UnusedMetricTag) 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 *marshalpatternFlowIgmpv1UnusedMetricTag) 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 *unMarshalpatternFlowIgmpv1UnusedMetricTag) 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 *marshalpatternFlowIgmpv1UnusedMetricTag) 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 *unMarshalpatternFlowIgmpv1UnusedMetricTag) 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 *patternFlowIgmpv1UnusedMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1UnusedMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1UnusedMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIgmpv1UnusedMetricTag) Clone() (PatternFlowIgmpv1UnusedMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIgmpv1UnusedMetricTag() - 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 -} - -// PatternFlowIgmpv1UnusedMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIgmpv1UnusedMetricTag interface { - Validation - // msg marshals PatternFlowIgmpv1UnusedMetricTag to protobuf object *otg.PatternFlowIgmpv1UnusedMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIgmpv1UnusedMetricTag - // setMsg unmarshals PatternFlowIgmpv1UnusedMetricTag from protobuf object *otg.PatternFlowIgmpv1UnusedMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIgmpv1UnusedMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIgmpv1UnusedMetricTag - // validate validates PatternFlowIgmpv1UnusedMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIgmpv1UnusedMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIgmpv1UnusedMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIgmpv1UnusedMetricTag - SetName(value string) PatternFlowIgmpv1UnusedMetricTag - // Offset returns uint32, set in PatternFlowIgmpv1UnusedMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIgmpv1UnusedMetricTag - SetOffset(value uint32) PatternFlowIgmpv1UnusedMetricTag - // HasOffset checks if Offset has been set in PatternFlowIgmpv1UnusedMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIgmpv1UnusedMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIgmpv1UnusedMetricTag - SetLength(value uint32) PatternFlowIgmpv1UnusedMetricTag - // HasLength checks if Length has been set in PatternFlowIgmpv1UnusedMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIgmpv1UnusedMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIgmpv1UnusedMetricTag object -func (obj *patternFlowIgmpv1UnusedMetricTag) SetName(value string) PatternFlowIgmpv1UnusedMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIgmpv1UnusedMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIgmpv1UnusedMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIgmpv1UnusedMetricTag object -func (obj *patternFlowIgmpv1UnusedMetricTag) SetOffset(value uint32) PatternFlowIgmpv1UnusedMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIgmpv1UnusedMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIgmpv1UnusedMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIgmpv1UnusedMetricTag object -func (obj *patternFlowIgmpv1UnusedMetricTag) SetLength(value uint32) PatternFlowIgmpv1UnusedMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIgmpv1UnusedMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIgmpv1UnusedMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1UnusedMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIgmpv1UnusedMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIgmpv1UnusedMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowIgmpv1GroupAddressCounter ***** -type patternFlowIgmpv1GroupAddressCounter struct { - validation - obj *otg.PatternFlowIgmpv1GroupAddressCounter - marshaller marshalPatternFlowIgmpv1GroupAddressCounter - unMarshaller unMarshalPatternFlowIgmpv1GroupAddressCounter -} - -func NewPatternFlowIgmpv1GroupAddressCounter() PatternFlowIgmpv1GroupAddressCounter { - obj := patternFlowIgmpv1GroupAddressCounter{obj: &otg.PatternFlowIgmpv1GroupAddressCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIgmpv1GroupAddressCounter) msg() *otg.PatternFlowIgmpv1GroupAddressCounter { - return obj.obj -} - -func (obj *patternFlowIgmpv1GroupAddressCounter) setMsg(msg *otg.PatternFlowIgmpv1GroupAddressCounter) PatternFlowIgmpv1GroupAddressCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIgmpv1GroupAddressCounter struct { - obj *patternFlowIgmpv1GroupAddressCounter -} - -type marshalPatternFlowIgmpv1GroupAddressCounter interface { - // ToProto marshals PatternFlowIgmpv1GroupAddressCounter to protobuf object *otg.PatternFlowIgmpv1GroupAddressCounter - ToProto() (*otg.PatternFlowIgmpv1GroupAddressCounter, error) - // ToPbText marshals PatternFlowIgmpv1GroupAddressCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIgmpv1GroupAddressCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIgmpv1GroupAddressCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIgmpv1GroupAddressCounter struct { - obj *patternFlowIgmpv1GroupAddressCounter -} - -type unMarshalPatternFlowIgmpv1GroupAddressCounter interface { - // FromProto unmarshals PatternFlowIgmpv1GroupAddressCounter from protobuf object *otg.PatternFlowIgmpv1GroupAddressCounter - FromProto(msg *otg.PatternFlowIgmpv1GroupAddressCounter) (PatternFlowIgmpv1GroupAddressCounter, error) - // FromPbText unmarshals PatternFlowIgmpv1GroupAddressCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIgmpv1GroupAddressCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIgmpv1GroupAddressCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIgmpv1GroupAddressCounter) Marshal() marshalPatternFlowIgmpv1GroupAddressCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIgmpv1GroupAddressCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIgmpv1GroupAddressCounter) Unmarshal() unMarshalPatternFlowIgmpv1GroupAddressCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIgmpv1GroupAddressCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIgmpv1GroupAddressCounter) ToProto() (*otg.PatternFlowIgmpv1GroupAddressCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIgmpv1GroupAddressCounter) FromProto(msg *otg.PatternFlowIgmpv1GroupAddressCounter) (PatternFlowIgmpv1GroupAddressCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIgmpv1GroupAddressCounter) 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 *unMarshalpatternFlowIgmpv1GroupAddressCounter) 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 *marshalpatternFlowIgmpv1GroupAddressCounter) 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 *unMarshalpatternFlowIgmpv1GroupAddressCounter) 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 *marshalpatternFlowIgmpv1GroupAddressCounter) 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 *unMarshalpatternFlowIgmpv1GroupAddressCounter) 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 *patternFlowIgmpv1GroupAddressCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1GroupAddressCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1GroupAddressCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIgmpv1GroupAddressCounter) Clone() (PatternFlowIgmpv1GroupAddressCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIgmpv1GroupAddressCounter() - 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 -} - -// PatternFlowIgmpv1GroupAddressCounter is ipv4 counter pattern -type PatternFlowIgmpv1GroupAddressCounter interface { - Validation - // msg marshals PatternFlowIgmpv1GroupAddressCounter to protobuf object *otg.PatternFlowIgmpv1GroupAddressCounter - // and doesn't set defaults - msg() *otg.PatternFlowIgmpv1GroupAddressCounter - // setMsg unmarshals PatternFlowIgmpv1GroupAddressCounter from protobuf object *otg.PatternFlowIgmpv1GroupAddressCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIgmpv1GroupAddressCounter) PatternFlowIgmpv1GroupAddressCounter - // provides marshal interface - Marshal() marshalPatternFlowIgmpv1GroupAddressCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIgmpv1GroupAddressCounter - // validate validates PatternFlowIgmpv1GroupAddressCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIgmpv1GroupAddressCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowIgmpv1GroupAddressCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowIgmpv1GroupAddressCounter - SetStart(value string) PatternFlowIgmpv1GroupAddressCounter - // HasStart checks if Start has been set in PatternFlowIgmpv1GroupAddressCounter - HasStart() bool - // Step returns string, set in PatternFlowIgmpv1GroupAddressCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowIgmpv1GroupAddressCounter - SetStep(value string) PatternFlowIgmpv1GroupAddressCounter - // HasStep checks if Step has been set in PatternFlowIgmpv1GroupAddressCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIgmpv1GroupAddressCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIgmpv1GroupAddressCounter - SetCount(value uint32) PatternFlowIgmpv1GroupAddressCounter - // HasCount checks if Count has been set in PatternFlowIgmpv1GroupAddressCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowIgmpv1GroupAddressCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowIgmpv1GroupAddressCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowIgmpv1GroupAddressCounter object -func (obj *patternFlowIgmpv1GroupAddressCounter) SetStart(value string) PatternFlowIgmpv1GroupAddressCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowIgmpv1GroupAddressCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowIgmpv1GroupAddressCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowIgmpv1GroupAddressCounter object -func (obj *patternFlowIgmpv1GroupAddressCounter) SetStep(value string) PatternFlowIgmpv1GroupAddressCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIgmpv1GroupAddressCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIgmpv1GroupAddressCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIgmpv1GroupAddressCounter object -func (obj *patternFlowIgmpv1GroupAddressCounter) SetCount(value uint32) PatternFlowIgmpv1GroupAddressCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIgmpv1GroupAddressCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateIpv4(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIgmpv1GroupAddressCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateIpv4(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIgmpv1GroupAddressCounter.Step")) - } - - } - -} - -func (obj *patternFlowIgmpv1GroupAddressCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("0.0.0.0") - } - if obj.obj.Step == nil { - obj.SetStep("0.0.0.1") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIgmpv1GroupAddressMetricTag ***** -type patternFlowIgmpv1GroupAddressMetricTag struct { - validation - obj *otg.PatternFlowIgmpv1GroupAddressMetricTag - marshaller marshalPatternFlowIgmpv1GroupAddressMetricTag - unMarshaller unMarshalPatternFlowIgmpv1GroupAddressMetricTag -} - -func NewPatternFlowIgmpv1GroupAddressMetricTag() PatternFlowIgmpv1GroupAddressMetricTag { - obj := patternFlowIgmpv1GroupAddressMetricTag{obj: &otg.PatternFlowIgmpv1GroupAddressMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIgmpv1GroupAddressMetricTag) msg() *otg.PatternFlowIgmpv1GroupAddressMetricTag { - return obj.obj -} - -func (obj *patternFlowIgmpv1GroupAddressMetricTag) setMsg(msg *otg.PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIgmpv1GroupAddressMetricTag struct { - obj *patternFlowIgmpv1GroupAddressMetricTag -} - -type marshalPatternFlowIgmpv1GroupAddressMetricTag interface { - // ToProto marshals PatternFlowIgmpv1GroupAddressMetricTag to protobuf object *otg.PatternFlowIgmpv1GroupAddressMetricTag - ToProto() (*otg.PatternFlowIgmpv1GroupAddressMetricTag, error) - // ToPbText marshals PatternFlowIgmpv1GroupAddressMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIgmpv1GroupAddressMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIgmpv1GroupAddressMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIgmpv1GroupAddressMetricTag struct { - obj *patternFlowIgmpv1GroupAddressMetricTag -} - -type unMarshalPatternFlowIgmpv1GroupAddressMetricTag interface { - // FromProto unmarshals PatternFlowIgmpv1GroupAddressMetricTag from protobuf object *otg.PatternFlowIgmpv1GroupAddressMetricTag - FromProto(msg *otg.PatternFlowIgmpv1GroupAddressMetricTag) (PatternFlowIgmpv1GroupAddressMetricTag, error) - // FromPbText unmarshals PatternFlowIgmpv1GroupAddressMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIgmpv1GroupAddressMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIgmpv1GroupAddressMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIgmpv1GroupAddressMetricTag) Marshal() marshalPatternFlowIgmpv1GroupAddressMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIgmpv1GroupAddressMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIgmpv1GroupAddressMetricTag) Unmarshal() unMarshalPatternFlowIgmpv1GroupAddressMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIgmpv1GroupAddressMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIgmpv1GroupAddressMetricTag) ToProto() (*otg.PatternFlowIgmpv1GroupAddressMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIgmpv1GroupAddressMetricTag) FromProto(msg *otg.PatternFlowIgmpv1GroupAddressMetricTag) (PatternFlowIgmpv1GroupAddressMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIgmpv1GroupAddressMetricTag) 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 *unMarshalpatternFlowIgmpv1GroupAddressMetricTag) 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 *marshalpatternFlowIgmpv1GroupAddressMetricTag) 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 *unMarshalpatternFlowIgmpv1GroupAddressMetricTag) 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 *marshalpatternFlowIgmpv1GroupAddressMetricTag) 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 *unMarshalpatternFlowIgmpv1GroupAddressMetricTag) 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 *patternFlowIgmpv1GroupAddressMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1GroupAddressMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIgmpv1GroupAddressMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIgmpv1GroupAddressMetricTag) Clone() (PatternFlowIgmpv1GroupAddressMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIgmpv1GroupAddressMetricTag() - 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 -} - -// PatternFlowIgmpv1GroupAddressMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIgmpv1GroupAddressMetricTag interface { - Validation - // msg marshals PatternFlowIgmpv1GroupAddressMetricTag to protobuf object *otg.PatternFlowIgmpv1GroupAddressMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIgmpv1GroupAddressMetricTag - // setMsg unmarshals PatternFlowIgmpv1GroupAddressMetricTag from protobuf object *otg.PatternFlowIgmpv1GroupAddressMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIgmpv1GroupAddressMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIgmpv1GroupAddressMetricTag - // validate validates PatternFlowIgmpv1GroupAddressMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIgmpv1GroupAddressMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIgmpv1GroupAddressMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIgmpv1GroupAddressMetricTag - SetName(value string) PatternFlowIgmpv1GroupAddressMetricTag - // Offset returns uint32, set in PatternFlowIgmpv1GroupAddressMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIgmpv1GroupAddressMetricTag - SetOffset(value uint32) PatternFlowIgmpv1GroupAddressMetricTag - // HasOffset checks if Offset has been set in PatternFlowIgmpv1GroupAddressMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIgmpv1GroupAddressMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIgmpv1GroupAddressMetricTag - SetLength(value uint32) PatternFlowIgmpv1GroupAddressMetricTag - // HasLength checks if Length has been set in PatternFlowIgmpv1GroupAddressMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIgmpv1GroupAddressMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIgmpv1GroupAddressMetricTag object -func (obj *patternFlowIgmpv1GroupAddressMetricTag) SetName(value string) PatternFlowIgmpv1GroupAddressMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIgmpv1GroupAddressMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIgmpv1GroupAddressMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIgmpv1GroupAddressMetricTag object -func (obj *patternFlowIgmpv1GroupAddressMetricTag) SetOffset(value uint32) PatternFlowIgmpv1GroupAddressMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIgmpv1GroupAddressMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIgmpv1GroupAddressMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIgmpv1GroupAddressMetricTag object -func (obj *patternFlowIgmpv1GroupAddressMetricTag) SetLength(value uint32) PatternFlowIgmpv1GroupAddressMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIgmpv1GroupAddressMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIgmpv1GroupAddressMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIgmpv1GroupAddressMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIgmpv1GroupAddressMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIgmpv1GroupAddressMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(32) - } - -} - -// ***** PatternFlowMplsLabelCounter ***** -type patternFlowMplsLabelCounter struct { - validation - obj *otg.PatternFlowMplsLabelCounter - marshaller marshalPatternFlowMplsLabelCounter - unMarshaller unMarshalPatternFlowMplsLabelCounter -} - -func NewPatternFlowMplsLabelCounter() PatternFlowMplsLabelCounter { - obj := patternFlowMplsLabelCounter{obj: &otg.PatternFlowMplsLabelCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowMplsLabelCounter) msg() *otg.PatternFlowMplsLabelCounter { - return obj.obj -} - -func (obj *patternFlowMplsLabelCounter) setMsg(msg *otg.PatternFlowMplsLabelCounter) PatternFlowMplsLabelCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowMplsLabelCounter struct { - obj *patternFlowMplsLabelCounter -} - -type marshalPatternFlowMplsLabelCounter interface { - // ToProto marshals PatternFlowMplsLabelCounter to protobuf object *otg.PatternFlowMplsLabelCounter - ToProto() (*otg.PatternFlowMplsLabelCounter, error) - // ToPbText marshals PatternFlowMplsLabelCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowMplsLabelCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowMplsLabelCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowMplsLabelCounter struct { - obj *patternFlowMplsLabelCounter -} - -type unMarshalPatternFlowMplsLabelCounter interface { - // FromProto unmarshals PatternFlowMplsLabelCounter from protobuf object *otg.PatternFlowMplsLabelCounter - FromProto(msg *otg.PatternFlowMplsLabelCounter) (PatternFlowMplsLabelCounter, error) - // FromPbText unmarshals PatternFlowMplsLabelCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowMplsLabelCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowMplsLabelCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowMplsLabelCounter) Marshal() marshalPatternFlowMplsLabelCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowMplsLabelCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowMplsLabelCounter) Unmarshal() unMarshalPatternFlowMplsLabelCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowMplsLabelCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowMplsLabelCounter) ToProto() (*otg.PatternFlowMplsLabelCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowMplsLabelCounter) FromProto(msg *otg.PatternFlowMplsLabelCounter) (PatternFlowMplsLabelCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowMplsLabelCounter) 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 *unMarshalpatternFlowMplsLabelCounter) 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 *marshalpatternFlowMplsLabelCounter) 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 *unMarshalpatternFlowMplsLabelCounter) 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 *marshalpatternFlowMplsLabelCounter) 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 *unMarshalpatternFlowMplsLabelCounter) 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 *patternFlowMplsLabelCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowMplsLabelCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowMplsLabelCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowMplsLabelCounter) Clone() (PatternFlowMplsLabelCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowMplsLabelCounter() - 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 -} - -// PatternFlowMplsLabelCounter is integer counter pattern -type PatternFlowMplsLabelCounter interface { - Validation - // msg marshals PatternFlowMplsLabelCounter to protobuf object *otg.PatternFlowMplsLabelCounter - // and doesn't set defaults - msg() *otg.PatternFlowMplsLabelCounter - // setMsg unmarshals PatternFlowMplsLabelCounter from protobuf object *otg.PatternFlowMplsLabelCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowMplsLabelCounter) PatternFlowMplsLabelCounter - // provides marshal interface - Marshal() marshalPatternFlowMplsLabelCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowMplsLabelCounter - // validate validates PatternFlowMplsLabelCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowMplsLabelCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowMplsLabelCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowMplsLabelCounter - SetStart(value uint32) PatternFlowMplsLabelCounter - // HasStart checks if Start has been set in PatternFlowMplsLabelCounter - HasStart() bool - // Step returns uint32, set in PatternFlowMplsLabelCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowMplsLabelCounter - SetStep(value uint32) PatternFlowMplsLabelCounter - // HasStep checks if Step has been set in PatternFlowMplsLabelCounter - HasStep() bool - // Count returns uint32, set in PatternFlowMplsLabelCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowMplsLabelCounter - SetCount(value uint32) PatternFlowMplsLabelCounter - // HasCount checks if Count has been set in PatternFlowMplsLabelCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowMplsLabelCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowMplsLabelCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowMplsLabelCounter object -func (obj *patternFlowMplsLabelCounter) SetStart(value uint32) PatternFlowMplsLabelCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowMplsLabelCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowMplsLabelCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowMplsLabelCounter object -func (obj *patternFlowMplsLabelCounter) SetStep(value uint32) PatternFlowMplsLabelCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowMplsLabelCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowMplsLabelCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowMplsLabelCounter object -func (obj *patternFlowMplsLabelCounter) SetCount(value uint32) PatternFlowMplsLabelCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowMplsLabelCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsLabelCounter.Start <= 1048575 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsLabelCounter.Step <= 1048575 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsLabelCounter.Count <= 1048575 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowMplsLabelCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(16) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowMplsLabelMetricTag ***** -type patternFlowMplsLabelMetricTag struct { - validation - obj *otg.PatternFlowMplsLabelMetricTag - marshaller marshalPatternFlowMplsLabelMetricTag - unMarshaller unMarshalPatternFlowMplsLabelMetricTag -} - -func NewPatternFlowMplsLabelMetricTag() PatternFlowMplsLabelMetricTag { - obj := patternFlowMplsLabelMetricTag{obj: &otg.PatternFlowMplsLabelMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowMplsLabelMetricTag) msg() *otg.PatternFlowMplsLabelMetricTag { - return obj.obj -} - -func (obj *patternFlowMplsLabelMetricTag) setMsg(msg *otg.PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowMplsLabelMetricTag struct { - obj *patternFlowMplsLabelMetricTag -} - -type marshalPatternFlowMplsLabelMetricTag interface { - // ToProto marshals PatternFlowMplsLabelMetricTag to protobuf object *otg.PatternFlowMplsLabelMetricTag - ToProto() (*otg.PatternFlowMplsLabelMetricTag, error) - // ToPbText marshals PatternFlowMplsLabelMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowMplsLabelMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowMplsLabelMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowMplsLabelMetricTag struct { - obj *patternFlowMplsLabelMetricTag -} - -type unMarshalPatternFlowMplsLabelMetricTag interface { - // FromProto unmarshals PatternFlowMplsLabelMetricTag from protobuf object *otg.PatternFlowMplsLabelMetricTag - FromProto(msg *otg.PatternFlowMplsLabelMetricTag) (PatternFlowMplsLabelMetricTag, error) - // FromPbText unmarshals PatternFlowMplsLabelMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowMplsLabelMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowMplsLabelMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowMplsLabelMetricTag) Marshal() marshalPatternFlowMplsLabelMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowMplsLabelMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowMplsLabelMetricTag) Unmarshal() unMarshalPatternFlowMplsLabelMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowMplsLabelMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowMplsLabelMetricTag) ToProto() (*otg.PatternFlowMplsLabelMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowMplsLabelMetricTag) FromProto(msg *otg.PatternFlowMplsLabelMetricTag) (PatternFlowMplsLabelMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowMplsLabelMetricTag) 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 *unMarshalpatternFlowMplsLabelMetricTag) 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 *marshalpatternFlowMplsLabelMetricTag) 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 *unMarshalpatternFlowMplsLabelMetricTag) 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 *marshalpatternFlowMplsLabelMetricTag) 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 *unMarshalpatternFlowMplsLabelMetricTag) 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 *patternFlowMplsLabelMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowMplsLabelMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowMplsLabelMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowMplsLabelMetricTag) Clone() (PatternFlowMplsLabelMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowMplsLabelMetricTag() - 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 -} - -// PatternFlowMplsLabelMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowMplsLabelMetricTag interface { - Validation - // msg marshals PatternFlowMplsLabelMetricTag to protobuf object *otg.PatternFlowMplsLabelMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowMplsLabelMetricTag - // setMsg unmarshals PatternFlowMplsLabelMetricTag from protobuf object *otg.PatternFlowMplsLabelMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelMetricTag - // provides marshal interface - Marshal() marshalPatternFlowMplsLabelMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowMplsLabelMetricTag - // validate validates PatternFlowMplsLabelMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowMplsLabelMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowMplsLabelMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowMplsLabelMetricTag - SetName(value string) PatternFlowMplsLabelMetricTag - // Offset returns uint32, set in PatternFlowMplsLabelMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowMplsLabelMetricTag - SetOffset(value uint32) PatternFlowMplsLabelMetricTag - // HasOffset checks if Offset has been set in PatternFlowMplsLabelMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowMplsLabelMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowMplsLabelMetricTag - SetLength(value uint32) PatternFlowMplsLabelMetricTag - // HasLength checks if Length has been set in PatternFlowMplsLabelMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowMplsLabelMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowMplsLabelMetricTag object -func (obj *patternFlowMplsLabelMetricTag) SetName(value string) PatternFlowMplsLabelMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowMplsLabelMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowMplsLabelMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowMplsLabelMetricTag object -func (obj *patternFlowMplsLabelMetricTag) SetOffset(value uint32) PatternFlowMplsLabelMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowMplsLabelMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowMplsLabelMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowMplsLabelMetricTag object -func (obj *patternFlowMplsLabelMetricTag) SetLength(value uint32) PatternFlowMplsLabelMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowMplsLabelMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowMplsLabelMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 19 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsLabelMetricTag.Offset <= 19 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 20 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowMplsLabelMetricTag.Length <= 20 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowMplsLabelMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(20) - } - -} - -// ***** PatternFlowMplsTrafficClassCounter ***** -type patternFlowMplsTrafficClassCounter struct { - validation - obj *otg.PatternFlowMplsTrafficClassCounter - marshaller marshalPatternFlowMplsTrafficClassCounter - unMarshaller unMarshalPatternFlowMplsTrafficClassCounter -} - -func NewPatternFlowMplsTrafficClassCounter() PatternFlowMplsTrafficClassCounter { - obj := patternFlowMplsTrafficClassCounter{obj: &otg.PatternFlowMplsTrafficClassCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowMplsTrafficClassCounter) msg() *otg.PatternFlowMplsTrafficClassCounter { - return obj.obj -} - -func (obj *patternFlowMplsTrafficClassCounter) setMsg(msg *otg.PatternFlowMplsTrafficClassCounter) PatternFlowMplsTrafficClassCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowMplsTrafficClassCounter struct { - obj *patternFlowMplsTrafficClassCounter -} - -type marshalPatternFlowMplsTrafficClassCounter interface { - // ToProto marshals PatternFlowMplsTrafficClassCounter to protobuf object *otg.PatternFlowMplsTrafficClassCounter - ToProto() (*otg.PatternFlowMplsTrafficClassCounter, error) - // ToPbText marshals PatternFlowMplsTrafficClassCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowMplsTrafficClassCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowMplsTrafficClassCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowMplsTrafficClassCounter struct { - obj *patternFlowMplsTrafficClassCounter -} - -type unMarshalPatternFlowMplsTrafficClassCounter interface { - // FromProto unmarshals PatternFlowMplsTrafficClassCounter from protobuf object *otg.PatternFlowMplsTrafficClassCounter - FromProto(msg *otg.PatternFlowMplsTrafficClassCounter) (PatternFlowMplsTrafficClassCounter, error) - // FromPbText unmarshals PatternFlowMplsTrafficClassCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowMplsTrafficClassCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowMplsTrafficClassCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowMplsTrafficClassCounter) Marshal() marshalPatternFlowMplsTrafficClassCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowMplsTrafficClassCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowMplsTrafficClassCounter) Unmarshal() unMarshalPatternFlowMplsTrafficClassCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowMplsTrafficClassCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowMplsTrafficClassCounter) ToProto() (*otg.PatternFlowMplsTrafficClassCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowMplsTrafficClassCounter) FromProto(msg *otg.PatternFlowMplsTrafficClassCounter) (PatternFlowMplsTrafficClassCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowMplsTrafficClassCounter) 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 *unMarshalpatternFlowMplsTrafficClassCounter) 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 *marshalpatternFlowMplsTrafficClassCounter) 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 *unMarshalpatternFlowMplsTrafficClassCounter) 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 *marshalpatternFlowMplsTrafficClassCounter) 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 *unMarshalpatternFlowMplsTrafficClassCounter) 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 *patternFlowMplsTrafficClassCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowMplsTrafficClassCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowMplsTrafficClassCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowMplsTrafficClassCounter) Clone() (PatternFlowMplsTrafficClassCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowMplsTrafficClassCounter() - 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 -} - -// PatternFlowMplsTrafficClassCounter is integer counter pattern -type PatternFlowMplsTrafficClassCounter interface { - Validation - // msg marshals PatternFlowMplsTrafficClassCounter to protobuf object *otg.PatternFlowMplsTrafficClassCounter - // and doesn't set defaults - msg() *otg.PatternFlowMplsTrafficClassCounter - // setMsg unmarshals PatternFlowMplsTrafficClassCounter from protobuf object *otg.PatternFlowMplsTrafficClassCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowMplsTrafficClassCounter) PatternFlowMplsTrafficClassCounter - // provides marshal interface - Marshal() marshalPatternFlowMplsTrafficClassCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowMplsTrafficClassCounter - // validate validates PatternFlowMplsTrafficClassCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowMplsTrafficClassCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowMplsTrafficClassCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowMplsTrafficClassCounter - SetStart(value uint32) PatternFlowMplsTrafficClassCounter - // HasStart checks if Start has been set in PatternFlowMplsTrafficClassCounter - HasStart() bool - // Step returns uint32, set in PatternFlowMplsTrafficClassCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowMplsTrafficClassCounter - SetStep(value uint32) PatternFlowMplsTrafficClassCounter - // HasStep checks if Step has been set in PatternFlowMplsTrafficClassCounter - HasStep() bool - // Count returns uint32, set in PatternFlowMplsTrafficClassCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowMplsTrafficClassCounter - SetCount(value uint32) PatternFlowMplsTrafficClassCounter - // HasCount checks if Count has been set in PatternFlowMplsTrafficClassCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowMplsTrafficClassCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowMplsTrafficClassCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowMplsTrafficClassCounter object -func (obj *patternFlowMplsTrafficClassCounter) SetStart(value uint32) PatternFlowMplsTrafficClassCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowMplsTrafficClassCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowMplsTrafficClassCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowMplsTrafficClassCounter object -func (obj *patternFlowMplsTrafficClassCounter) SetStep(value uint32) PatternFlowMplsTrafficClassCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowMplsTrafficClassCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowMplsTrafficClassCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowMplsTrafficClassCounter object -func (obj *patternFlowMplsTrafficClassCounter) SetCount(value uint32) PatternFlowMplsTrafficClassCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowMplsTrafficClassCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsTrafficClassCounter.Start <= 7 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsTrafficClassCounter.Step <= 7 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsTrafficClassCounter.Count <= 7 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowMplsTrafficClassCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowMplsTrafficClassMetricTag ***** -type patternFlowMplsTrafficClassMetricTag struct { - validation - obj *otg.PatternFlowMplsTrafficClassMetricTag - marshaller marshalPatternFlowMplsTrafficClassMetricTag - unMarshaller unMarshalPatternFlowMplsTrafficClassMetricTag -} - -func NewPatternFlowMplsTrafficClassMetricTag() PatternFlowMplsTrafficClassMetricTag { - obj := patternFlowMplsTrafficClassMetricTag{obj: &otg.PatternFlowMplsTrafficClassMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowMplsTrafficClassMetricTag) msg() *otg.PatternFlowMplsTrafficClassMetricTag { - return obj.obj -} - -func (obj *patternFlowMplsTrafficClassMetricTag) setMsg(msg *otg.PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowMplsTrafficClassMetricTag struct { - obj *patternFlowMplsTrafficClassMetricTag -} - -type marshalPatternFlowMplsTrafficClassMetricTag interface { - // ToProto marshals PatternFlowMplsTrafficClassMetricTag to protobuf object *otg.PatternFlowMplsTrafficClassMetricTag - ToProto() (*otg.PatternFlowMplsTrafficClassMetricTag, error) - // ToPbText marshals PatternFlowMplsTrafficClassMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowMplsTrafficClassMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowMplsTrafficClassMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowMplsTrafficClassMetricTag struct { - obj *patternFlowMplsTrafficClassMetricTag -} - -type unMarshalPatternFlowMplsTrafficClassMetricTag interface { - // FromProto unmarshals PatternFlowMplsTrafficClassMetricTag from protobuf object *otg.PatternFlowMplsTrafficClassMetricTag - FromProto(msg *otg.PatternFlowMplsTrafficClassMetricTag) (PatternFlowMplsTrafficClassMetricTag, error) - // FromPbText unmarshals PatternFlowMplsTrafficClassMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowMplsTrafficClassMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowMplsTrafficClassMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowMplsTrafficClassMetricTag) Marshal() marshalPatternFlowMplsTrafficClassMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowMplsTrafficClassMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowMplsTrafficClassMetricTag) Unmarshal() unMarshalPatternFlowMplsTrafficClassMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowMplsTrafficClassMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowMplsTrafficClassMetricTag) ToProto() (*otg.PatternFlowMplsTrafficClassMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowMplsTrafficClassMetricTag) FromProto(msg *otg.PatternFlowMplsTrafficClassMetricTag) (PatternFlowMplsTrafficClassMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowMplsTrafficClassMetricTag) 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 *unMarshalpatternFlowMplsTrafficClassMetricTag) 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 *marshalpatternFlowMplsTrafficClassMetricTag) 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 *unMarshalpatternFlowMplsTrafficClassMetricTag) 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 *marshalpatternFlowMplsTrafficClassMetricTag) 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 *unMarshalpatternFlowMplsTrafficClassMetricTag) 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 *patternFlowMplsTrafficClassMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowMplsTrafficClassMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowMplsTrafficClassMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowMplsTrafficClassMetricTag) Clone() (PatternFlowMplsTrafficClassMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowMplsTrafficClassMetricTag() - 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 -} - -// PatternFlowMplsTrafficClassMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowMplsTrafficClassMetricTag interface { - Validation - // msg marshals PatternFlowMplsTrafficClassMetricTag to protobuf object *otg.PatternFlowMplsTrafficClassMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowMplsTrafficClassMetricTag - // setMsg unmarshals PatternFlowMplsTrafficClassMetricTag from protobuf object *otg.PatternFlowMplsTrafficClassMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassMetricTag - // provides marshal interface - Marshal() marshalPatternFlowMplsTrafficClassMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowMplsTrafficClassMetricTag - // validate validates PatternFlowMplsTrafficClassMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowMplsTrafficClassMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowMplsTrafficClassMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowMplsTrafficClassMetricTag - SetName(value string) PatternFlowMplsTrafficClassMetricTag - // Offset returns uint32, set in PatternFlowMplsTrafficClassMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowMplsTrafficClassMetricTag - SetOffset(value uint32) PatternFlowMplsTrafficClassMetricTag - // HasOffset checks if Offset has been set in PatternFlowMplsTrafficClassMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowMplsTrafficClassMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowMplsTrafficClassMetricTag - SetLength(value uint32) PatternFlowMplsTrafficClassMetricTag - // HasLength checks if Length has been set in PatternFlowMplsTrafficClassMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowMplsTrafficClassMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowMplsTrafficClassMetricTag object -func (obj *patternFlowMplsTrafficClassMetricTag) SetName(value string) PatternFlowMplsTrafficClassMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowMplsTrafficClassMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowMplsTrafficClassMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowMplsTrafficClassMetricTag object -func (obj *patternFlowMplsTrafficClassMetricTag) SetOffset(value uint32) PatternFlowMplsTrafficClassMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowMplsTrafficClassMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowMplsTrafficClassMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowMplsTrafficClassMetricTag object -func (obj *patternFlowMplsTrafficClassMetricTag) SetLength(value uint32) PatternFlowMplsTrafficClassMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowMplsTrafficClassMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowMplsTrafficClassMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 2 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsTrafficClassMetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowMplsTrafficClassMetricTag.Length <= 3 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowMplsTrafficClassMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(3) - } - -} - -// ***** PatternFlowMplsBottomOfStackCounter ***** -type patternFlowMplsBottomOfStackCounter struct { - validation - obj *otg.PatternFlowMplsBottomOfStackCounter - marshaller marshalPatternFlowMplsBottomOfStackCounter - unMarshaller unMarshalPatternFlowMplsBottomOfStackCounter -} - -func NewPatternFlowMplsBottomOfStackCounter() PatternFlowMplsBottomOfStackCounter { - obj := patternFlowMplsBottomOfStackCounter{obj: &otg.PatternFlowMplsBottomOfStackCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowMplsBottomOfStackCounter) msg() *otg.PatternFlowMplsBottomOfStackCounter { - return obj.obj -} - -func (obj *patternFlowMplsBottomOfStackCounter) setMsg(msg *otg.PatternFlowMplsBottomOfStackCounter) PatternFlowMplsBottomOfStackCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowMplsBottomOfStackCounter struct { - obj *patternFlowMplsBottomOfStackCounter -} - -type marshalPatternFlowMplsBottomOfStackCounter interface { - // ToProto marshals PatternFlowMplsBottomOfStackCounter to protobuf object *otg.PatternFlowMplsBottomOfStackCounter - ToProto() (*otg.PatternFlowMplsBottomOfStackCounter, error) - // ToPbText marshals PatternFlowMplsBottomOfStackCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowMplsBottomOfStackCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowMplsBottomOfStackCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowMplsBottomOfStackCounter struct { - obj *patternFlowMplsBottomOfStackCounter -} - -type unMarshalPatternFlowMplsBottomOfStackCounter interface { - // FromProto unmarshals PatternFlowMplsBottomOfStackCounter from protobuf object *otg.PatternFlowMplsBottomOfStackCounter - FromProto(msg *otg.PatternFlowMplsBottomOfStackCounter) (PatternFlowMplsBottomOfStackCounter, error) - // FromPbText unmarshals PatternFlowMplsBottomOfStackCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowMplsBottomOfStackCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowMplsBottomOfStackCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowMplsBottomOfStackCounter) Marshal() marshalPatternFlowMplsBottomOfStackCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowMplsBottomOfStackCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowMplsBottomOfStackCounter) Unmarshal() unMarshalPatternFlowMplsBottomOfStackCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowMplsBottomOfStackCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowMplsBottomOfStackCounter) ToProto() (*otg.PatternFlowMplsBottomOfStackCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowMplsBottomOfStackCounter) FromProto(msg *otg.PatternFlowMplsBottomOfStackCounter) (PatternFlowMplsBottomOfStackCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowMplsBottomOfStackCounter) 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 *unMarshalpatternFlowMplsBottomOfStackCounter) 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 *marshalpatternFlowMplsBottomOfStackCounter) 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 *unMarshalpatternFlowMplsBottomOfStackCounter) 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 *marshalpatternFlowMplsBottomOfStackCounter) 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 *unMarshalpatternFlowMplsBottomOfStackCounter) 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 *patternFlowMplsBottomOfStackCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowMplsBottomOfStackCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowMplsBottomOfStackCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowMplsBottomOfStackCounter) Clone() (PatternFlowMplsBottomOfStackCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowMplsBottomOfStackCounter() - 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 -} - -// PatternFlowMplsBottomOfStackCounter is integer counter pattern -type PatternFlowMplsBottomOfStackCounter interface { - Validation - // msg marshals PatternFlowMplsBottomOfStackCounter to protobuf object *otg.PatternFlowMplsBottomOfStackCounter - // and doesn't set defaults - msg() *otg.PatternFlowMplsBottomOfStackCounter - // setMsg unmarshals PatternFlowMplsBottomOfStackCounter from protobuf object *otg.PatternFlowMplsBottomOfStackCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowMplsBottomOfStackCounter) PatternFlowMplsBottomOfStackCounter - // provides marshal interface - Marshal() marshalPatternFlowMplsBottomOfStackCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowMplsBottomOfStackCounter - // validate validates PatternFlowMplsBottomOfStackCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowMplsBottomOfStackCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowMplsBottomOfStackCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowMplsBottomOfStackCounter - SetStart(value uint32) PatternFlowMplsBottomOfStackCounter - // HasStart checks if Start has been set in PatternFlowMplsBottomOfStackCounter - HasStart() bool - // Step returns uint32, set in PatternFlowMplsBottomOfStackCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowMplsBottomOfStackCounter - SetStep(value uint32) PatternFlowMplsBottomOfStackCounter - // HasStep checks if Step has been set in PatternFlowMplsBottomOfStackCounter - HasStep() bool - // Count returns uint32, set in PatternFlowMplsBottomOfStackCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowMplsBottomOfStackCounter - SetCount(value uint32) PatternFlowMplsBottomOfStackCounter - // HasCount checks if Count has been set in PatternFlowMplsBottomOfStackCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowMplsBottomOfStackCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowMplsBottomOfStackCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowMplsBottomOfStackCounter object -func (obj *patternFlowMplsBottomOfStackCounter) SetStart(value uint32) PatternFlowMplsBottomOfStackCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowMplsBottomOfStackCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowMplsBottomOfStackCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowMplsBottomOfStackCounter object -func (obj *patternFlowMplsBottomOfStackCounter) SetStep(value uint32) PatternFlowMplsBottomOfStackCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowMplsBottomOfStackCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowMplsBottomOfStackCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowMplsBottomOfStackCounter object -func (obj *patternFlowMplsBottomOfStackCounter) SetCount(value uint32) PatternFlowMplsBottomOfStackCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowMplsBottomOfStackCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsBottomOfStackCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsBottomOfStackCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsBottomOfStackCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowMplsBottomOfStackCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowMplsBottomOfStackMetricTag ***** -type patternFlowMplsBottomOfStackMetricTag struct { - validation - obj *otg.PatternFlowMplsBottomOfStackMetricTag - marshaller marshalPatternFlowMplsBottomOfStackMetricTag - unMarshaller unMarshalPatternFlowMplsBottomOfStackMetricTag -} - -func NewPatternFlowMplsBottomOfStackMetricTag() PatternFlowMplsBottomOfStackMetricTag { - obj := patternFlowMplsBottomOfStackMetricTag{obj: &otg.PatternFlowMplsBottomOfStackMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowMplsBottomOfStackMetricTag) msg() *otg.PatternFlowMplsBottomOfStackMetricTag { - return obj.obj -} - -func (obj *patternFlowMplsBottomOfStackMetricTag) setMsg(msg *otg.PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowMplsBottomOfStackMetricTag struct { - obj *patternFlowMplsBottomOfStackMetricTag -} - -type marshalPatternFlowMplsBottomOfStackMetricTag interface { - // ToProto marshals PatternFlowMplsBottomOfStackMetricTag to protobuf object *otg.PatternFlowMplsBottomOfStackMetricTag - ToProto() (*otg.PatternFlowMplsBottomOfStackMetricTag, error) - // ToPbText marshals PatternFlowMplsBottomOfStackMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowMplsBottomOfStackMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowMplsBottomOfStackMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowMplsBottomOfStackMetricTag struct { - obj *patternFlowMplsBottomOfStackMetricTag -} - -type unMarshalPatternFlowMplsBottomOfStackMetricTag interface { - // FromProto unmarshals PatternFlowMplsBottomOfStackMetricTag from protobuf object *otg.PatternFlowMplsBottomOfStackMetricTag - FromProto(msg *otg.PatternFlowMplsBottomOfStackMetricTag) (PatternFlowMplsBottomOfStackMetricTag, error) - // FromPbText unmarshals PatternFlowMplsBottomOfStackMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowMplsBottomOfStackMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowMplsBottomOfStackMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowMplsBottomOfStackMetricTag) Marshal() marshalPatternFlowMplsBottomOfStackMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowMplsBottomOfStackMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowMplsBottomOfStackMetricTag) Unmarshal() unMarshalPatternFlowMplsBottomOfStackMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowMplsBottomOfStackMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowMplsBottomOfStackMetricTag) ToProto() (*otg.PatternFlowMplsBottomOfStackMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowMplsBottomOfStackMetricTag) FromProto(msg *otg.PatternFlowMplsBottomOfStackMetricTag) (PatternFlowMplsBottomOfStackMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowMplsBottomOfStackMetricTag) 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 *unMarshalpatternFlowMplsBottomOfStackMetricTag) 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 *marshalpatternFlowMplsBottomOfStackMetricTag) 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 *unMarshalpatternFlowMplsBottomOfStackMetricTag) 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 *marshalpatternFlowMplsBottomOfStackMetricTag) 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 *unMarshalpatternFlowMplsBottomOfStackMetricTag) 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 *patternFlowMplsBottomOfStackMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowMplsBottomOfStackMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowMplsBottomOfStackMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowMplsBottomOfStackMetricTag) Clone() (PatternFlowMplsBottomOfStackMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowMplsBottomOfStackMetricTag() - 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 -} - -// PatternFlowMplsBottomOfStackMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowMplsBottomOfStackMetricTag interface { - Validation - // msg marshals PatternFlowMplsBottomOfStackMetricTag to protobuf object *otg.PatternFlowMplsBottomOfStackMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowMplsBottomOfStackMetricTag - // setMsg unmarshals PatternFlowMplsBottomOfStackMetricTag from protobuf object *otg.PatternFlowMplsBottomOfStackMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackMetricTag - // provides marshal interface - Marshal() marshalPatternFlowMplsBottomOfStackMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowMplsBottomOfStackMetricTag - // validate validates PatternFlowMplsBottomOfStackMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowMplsBottomOfStackMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowMplsBottomOfStackMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowMplsBottomOfStackMetricTag - SetName(value string) PatternFlowMplsBottomOfStackMetricTag - // Offset returns uint32, set in PatternFlowMplsBottomOfStackMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowMplsBottomOfStackMetricTag - SetOffset(value uint32) PatternFlowMplsBottomOfStackMetricTag - // HasOffset checks if Offset has been set in PatternFlowMplsBottomOfStackMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowMplsBottomOfStackMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowMplsBottomOfStackMetricTag - SetLength(value uint32) PatternFlowMplsBottomOfStackMetricTag - // HasLength checks if Length has been set in PatternFlowMplsBottomOfStackMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowMplsBottomOfStackMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowMplsBottomOfStackMetricTag object -func (obj *patternFlowMplsBottomOfStackMetricTag) SetName(value string) PatternFlowMplsBottomOfStackMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowMplsBottomOfStackMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowMplsBottomOfStackMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowMplsBottomOfStackMetricTag object -func (obj *patternFlowMplsBottomOfStackMetricTag) SetOffset(value uint32) PatternFlowMplsBottomOfStackMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowMplsBottomOfStackMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowMplsBottomOfStackMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowMplsBottomOfStackMetricTag object -func (obj *patternFlowMplsBottomOfStackMetricTag) SetLength(value uint32) PatternFlowMplsBottomOfStackMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowMplsBottomOfStackMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowMplsBottomOfStackMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsBottomOfStackMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowMplsBottomOfStackMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowMplsBottomOfStackMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowMplsTimeToLiveCounter ***** -type patternFlowMplsTimeToLiveCounter struct { - validation - obj *otg.PatternFlowMplsTimeToLiveCounter - marshaller marshalPatternFlowMplsTimeToLiveCounter - unMarshaller unMarshalPatternFlowMplsTimeToLiveCounter -} - -func NewPatternFlowMplsTimeToLiveCounter() PatternFlowMplsTimeToLiveCounter { - obj := patternFlowMplsTimeToLiveCounter{obj: &otg.PatternFlowMplsTimeToLiveCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowMplsTimeToLiveCounter) msg() *otg.PatternFlowMplsTimeToLiveCounter { - return obj.obj -} - -func (obj *patternFlowMplsTimeToLiveCounter) setMsg(msg *otg.PatternFlowMplsTimeToLiveCounter) PatternFlowMplsTimeToLiveCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowMplsTimeToLiveCounter struct { - obj *patternFlowMplsTimeToLiveCounter -} - -type marshalPatternFlowMplsTimeToLiveCounter interface { - // ToProto marshals PatternFlowMplsTimeToLiveCounter to protobuf object *otg.PatternFlowMplsTimeToLiveCounter - ToProto() (*otg.PatternFlowMplsTimeToLiveCounter, error) - // ToPbText marshals PatternFlowMplsTimeToLiveCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowMplsTimeToLiveCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowMplsTimeToLiveCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowMplsTimeToLiveCounter struct { - obj *patternFlowMplsTimeToLiveCounter -} - -type unMarshalPatternFlowMplsTimeToLiveCounter interface { - // FromProto unmarshals PatternFlowMplsTimeToLiveCounter from protobuf object *otg.PatternFlowMplsTimeToLiveCounter - FromProto(msg *otg.PatternFlowMplsTimeToLiveCounter) (PatternFlowMplsTimeToLiveCounter, error) - // FromPbText unmarshals PatternFlowMplsTimeToLiveCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowMplsTimeToLiveCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowMplsTimeToLiveCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowMplsTimeToLiveCounter) Marshal() marshalPatternFlowMplsTimeToLiveCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowMplsTimeToLiveCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowMplsTimeToLiveCounter) Unmarshal() unMarshalPatternFlowMplsTimeToLiveCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowMplsTimeToLiveCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowMplsTimeToLiveCounter) ToProto() (*otg.PatternFlowMplsTimeToLiveCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowMplsTimeToLiveCounter) FromProto(msg *otg.PatternFlowMplsTimeToLiveCounter) (PatternFlowMplsTimeToLiveCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowMplsTimeToLiveCounter) 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 *unMarshalpatternFlowMplsTimeToLiveCounter) 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 *marshalpatternFlowMplsTimeToLiveCounter) 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 *unMarshalpatternFlowMplsTimeToLiveCounter) 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 *marshalpatternFlowMplsTimeToLiveCounter) 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 *unMarshalpatternFlowMplsTimeToLiveCounter) 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 *patternFlowMplsTimeToLiveCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowMplsTimeToLiveCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowMplsTimeToLiveCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowMplsTimeToLiveCounter) Clone() (PatternFlowMplsTimeToLiveCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowMplsTimeToLiveCounter() - 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 -} - -// PatternFlowMplsTimeToLiveCounter is integer counter pattern -type PatternFlowMplsTimeToLiveCounter interface { - Validation - // msg marshals PatternFlowMplsTimeToLiveCounter to protobuf object *otg.PatternFlowMplsTimeToLiveCounter - // and doesn't set defaults - msg() *otg.PatternFlowMplsTimeToLiveCounter - // setMsg unmarshals PatternFlowMplsTimeToLiveCounter from protobuf object *otg.PatternFlowMplsTimeToLiveCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowMplsTimeToLiveCounter) PatternFlowMplsTimeToLiveCounter - // provides marshal interface - Marshal() marshalPatternFlowMplsTimeToLiveCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowMplsTimeToLiveCounter - // validate validates PatternFlowMplsTimeToLiveCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowMplsTimeToLiveCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowMplsTimeToLiveCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowMplsTimeToLiveCounter - SetStart(value uint32) PatternFlowMplsTimeToLiveCounter - // HasStart checks if Start has been set in PatternFlowMplsTimeToLiveCounter - HasStart() bool - // Step returns uint32, set in PatternFlowMplsTimeToLiveCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowMplsTimeToLiveCounter - SetStep(value uint32) PatternFlowMplsTimeToLiveCounter - // HasStep checks if Step has been set in PatternFlowMplsTimeToLiveCounter - HasStep() bool - // Count returns uint32, set in PatternFlowMplsTimeToLiveCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowMplsTimeToLiveCounter - SetCount(value uint32) PatternFlowMplsTimeToLiveCounter - // HasCount checks if Count has been set in PatternFlowMplsTimeToLiveCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowMplsTimeToLiveCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowMplsTimeToLiveCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowMplsTimeToLiveCounter object -func (obj *patternFlowMplsTimeToLiveCounter) SetStart(value uint32) PatternFlowMplsTimeToLiveCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowMplsTimeToLiveCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowMplsTimeToLiveCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowMplsTimeToLiveCounter object -func (obj *patternFlowMplsTimeToLiveCounter) SetStep(value uint32) PatternFlowMplsTimeToLiveCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowMplsTimeToLiveCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowMplsTimeToLiveCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowMplsTimeToLiveCounter object -func (obj *patternFlowMplsTimeToLiveCounter) SetCount(value uint32) PatternFlowMplsTimeToLiveCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowMplsTimeToLiveCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsTimeToLiveCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsTimeToLiveCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsTimeToLiveCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowMplsTimeToLiveCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(64) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowMplsTimeToLiveMetricTag ***** -type patternFlowMplsTimeToLiveMetricTag struct { - validation - obj *otg.PatternFlowMplsTimeToLiveMetricTag - marshaller marshalPatternFlowMplsTimeToLiveMetricTag - unMarshaller unMarshalPatternFlowMplsTimeToLiveMetricTag -} - -func NewPatternFlowMplsTimeToLiveMetricTag() PatternFlowMplsTimeToLiveMetricTag { - obj := patternFlowMplsTimeToLiveMetricTag{obj: &otg.PatternFlowMplsTimeToLiveMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowMplsTimeToLiveMetricTag) msg() *otg.PatternFlowMplsTimeToLiveMetricTag { - return obj.obj -} - -func (obj *patternFlowMplsTimeToLiveMetricTag) setMsg(msg *otg.PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLiveMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowMplsTimeToLiveMetricTag struct { - obj *patternFlowMplsTimeToLiveMetricTag -} - -type marshalPatternFlowMplsTimeToLiveMetricTag interface { - // ToProto marshals PatternFlowMplsTimeToLiveMetricTag to protobuf object *otg.PatternFlowMplsTimeToLiveMetricTag - ToProto() (*otg.PatternFlowMplsTimeToLiveMetricTag, error) - // ToPbText marshals PatternFlowMplsTimeToLiveMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowMplsTimeToLiveMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowMplsTimeToLiveMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowMplsTimeToLiveMetricTag struct { - obj *patternFlowMplsTimeToLiveMetricTag -} - -type unMarshalPatternFlowMplsTimeToLiveMetricTag interface { - // FromProto unmarshals PatternFlowMplsTimeToLiveMetricTag from protobuf object *otg.PatternFlowMplsTimeToLiveMetricTag - FromProto(msg *otg.PatternFlowMplsTimeToLiveMetricTag) (PatternFlowMplsTimeToLiveMetricTag, error) - // FromPbText unmarshals PatternFlowMplsTimeToLiveMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowMplsTimeToLiveMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowMplsTimeToLiveMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowMplsTimeToLiveMetricTag) Marshal() marshalPatternFlowMplsTimeToLiveMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowMplsTimeToLiveMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowMplsTimeToLiveMetricTag) Unmarshal() unMarshalPatternFlowMplsTimeToLiveMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowMplsTimeToLiveMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowMplsTimeToLiveMetricTag) ToProto() (*otg.PatternFlowMplsTimeToLiveMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowMplsTimeToLiveMetricTag) FromProto(msg *otg.PatternFlowMplsTimeToLiveMetricTag) (PatternFlowMplsTimeToLiveMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowMplsTimeToLiveMetricTag) 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 *unMarshalpatternFlowMplsTimeToLiveMetricTag) 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 *marshalpatternFlowMplsTimeToLiveMetricTag) 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 *unMarshalpatternFlowMplsTimeToLiveMetricTag) 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 *marshalpatternFlowMplsTimeToLiveMetricTag) 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 *unMarshalpatternFlowMplsTimeToLiveMetricTag) 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 *patternFlowMplsTimeToLiveMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowMplsTimeToLiveMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowMplsTimeToLiveMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowMplsTimeToLiveMetricTag) Clone() (PatternFlowMplsTimeToLiveMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowMplsTimeToLiveMetricTag() - 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 -} - -// PatternFlowMplsTimeToLiveMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowMplsTimeToLiveMetricTag interface { - Validation - // msg marshals PatternFlowMplsTimeToLiveMetricTag to protobuf object *otg.PatternFlowMplsTimeToLiveMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowMplsTimeToLiveMetricTag - // setMsg unmarshals PatternFlowMplsTimeToLiveMetricTag from protobuf object *otg.PatternFlowMplsTimeToLiveMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLiveMetricTag - // provides marshal interface - Marshal() marshalPatternFlowMplsTimeToLiveMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowMplsTimeToLiveMetricTag - // validate validates PatternFlowMplsTimeToLiveMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowMplsTimeToLiveMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowMplsTimeToLiveMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowMplsTimeToLiveMetricTag - SetName(value string) PatternFlowMplsTimeToLiveMetricTag - // Offset returns uint32, set in PatternFlowMplsTimeToLiveMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowMplsTimeToLiveMetricTag - SetOffset(value uint32) PatternFlowMplsTimeToLiveMetricTag - // HasOffset checks if Offset has been set in PatternFlowMplsTimeToLiveMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowMplsTimeToLiveMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowMplsTimeToLiveMetricTag - SetLength(value uint32) PatternFlowMplsTimeToLiveMetricTag - // HasLength checks if Length has been set in PatternFlowMplsTimeToLiveMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowMplsTimeToLiveMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowMplsTimeToLiveMetricTag object -func (obj *patternFlowMplsTimeToLiveMetricTag) SetName(value string) PatternFlowMplsTimeToLiveMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowMplsTimeToLiveMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowMplsTimeToLiveMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowMplsTimeToLiveMetricTag object -func (obj *patternFlowMplsTimeToLiveMetricTag) SetOffset(value uint32) PatternFlowMplsTimeToLiveMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowMplsTimeToLiveMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowMplsTimeToLiveMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowMplsTimeToLiveMetricTag object -func (obj *patternFlowMplsTimeToLiveMetricTag) SetLength(value uint32) PatternFlowMplsTimeToLiveMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowMplsTimeToLiveMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowMplsTimeToLiveMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowMplsTimeToLiveMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowMplsTimeToLiveMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowMplsTimeToLiveMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowSnmpv2CVersionCounter ***** -type patternFlowSnmpv2CVersionCounter struct { - validation - obj *otg.PatternFlowSnmpv2CVersionCounter - marshaller marshalPatternFlowSnmpv2CVersionCounter - unMarshaller unMarshalPatternFlowSnmpv2CVersionCounter -} - -func NewPatternFlowSnmpv2CVersionCounter() PatternFlowSnmpv2CVersionCounter { - obj := patternFlowSnmpv2CVersionCounter{obj: &otg.PatternFlowSnmpv2CVersionCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CVersionCounter) msg() *otg.PatternFlowSnmpv2CVersionCounter { - return obj.obj -} - -func (obj *patternFlowSnmpv2CVersionCounter) setMsg(msg *otg.PatternFlowSnmpv2CVersionCounter) PatternFlowSnmpv2CVersionCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CVersionCounter struct { - obj *patternFlowSnmpv2CVersionCounter -} - -type marshalPatternFlowSnmpv2CVersionCounter interface { - // ToProto marshals PatternFlowSnmpv2CVersionCounter to protobuf object *otg.PatternFlowSnmpv2CVersionCounter - ToProto() (*otg.PatternFlowSnmpv2CVersionCounter, error) - // ToPbText marshals PatternFlowSnmpv2CVersionCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CVersionCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CVersionCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CVersionCounter struct { - obj *patternFlowSnmpv2CVersionCounter -} - -type unMarshalPatternFlowSnmpv2CVersionCounter interface { - // FromProto unmarshals PatternFlowSnmpv2CVersionCounter from protobuf object *otg.PatternFlowSnmpv2CVersionCounter - FromProto(msg *otg.PatternFlowSnmpv2CVersionCounter) (PatternFlowSnmpv2CVersionCounter, error) - // FromPbText unmarshals PatternFlowSnmpv2CVersionCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CVersionCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CVersionCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CVersionCounter) Marshal() marshalPatternFlowSnmpv2CVersionCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CVersionCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CVersionCounter) Unmarshal() unMarshalPatternFlowSnmpv2CVersionCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVersionCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CVersionCounter) ToProto() (*otg.PatternFlowSnmpv2CVersionCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CVersionCounter) FromProto(msg *otg.PatternFlowSnmpv2CVersionCounter) (PatternFlowSnmpv2CVersionCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CVersionCounter) 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 *unMarshalpatternFlowSnmpv2CVersionCounter) 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 *marshalpatternFlowSnmpv2CVersionCounter) 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 *unMarshalpatternFlowSnmpv2CVersionCounter) 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 *marshalpatternFlowSnmpv2CVersionCounter) 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 *unMarshalpatternFlowSnmpv2CVersionCounter) 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 *patternFlowSnmpv2CVersionCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVersionCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVersionCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CVersionCounter) Clone() (PatternFlowSnmpv2CVersionCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CVersionCounter() - 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 -} - -// PatternFlowSnmpv2CVersionCounter is integer counter pattern -type PatternFlowSnmpv2CVersionCounter interface { - Validation - // msg marshals PatternFlowSnmpv2CVersionCounter to protobuf object *otg.PatternFlowSnmpv2CVersionCounter - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CVersionCounter - // setMsg unmarshals PatternFlowSnmpv2CVersionCounter from protobuf object *otg.PatternFlowSnmpv2CVersionCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CVersionCounter) PatternFlowSnmpv2CVersionCounter - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CVersionCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CVersionCounter - // validate validates PatternFlowSnmpv2CVersionCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CVersionCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowSnmpv2CVersionCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowSnmpv2CVersionCounter - SetStart(value uint32) PatternFlowSnmpv2CVersionCounter - // HasStart checks if Start has been set in PatternFlowSnmpv2CVersionCounter - HasStart() bool - // Step returns uint32, set in PatternFlowSnmpv2CVersionCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowSnmpv2CVersionCounter - SetStep(value uint32) PatternFlowSnmpv2CVersionCounter - // HasStep checks if Step has been set in PatternFlowSnmpv2CVersionCounter - HasStep() bool - // Count returns uint32, set in PatternFlowSnmpv2CVersionCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowSnmpv2CVersionCounter - SetCount(value uint32) PatternFlowSnmpv2CVersionCounter - // HasCount checks if Count has been set in PatternFlowSnmpv2CVersionCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowSnmpv2CVersionCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowSnmpv2CVersionCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowSnmpv2CVersionCounter object -func (obj *patternFlowSnmpv2CVersionCounter) SetStart(value uint32) PatternFlowSnmpv2CVersionCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowSnmpv2CVersionCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowSnmpv2CVersionCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowSnmpv2CVersionCounter object -func (obj *patternFlowSnmpv2CVersionCounter) SetStep(value uint32) PatternFlowSnmpv2CVersionCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowSnmpv2CVersionCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowSnmpv2CVersionCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowSnmpv2CVersionCounter object -func (obj *patternFlowSnmpv2CVersionCounter) SetCount(value uint32) PatternFlowSnmpv2CVersionCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowSnmpv2CVersionCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowSnmpv2CVersionCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowSnmpv2CVersionCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowSnmpv2CVersionCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowSnmpv2CVersionCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** FlowSnmpv2CPDU ***** -type flowSnmpv2CPDU struct { - validation - obj *otg.FlowSnmpv2CPDU - marshaller marshalFlowSnmpv2CPDU - unMarshaller unMarshalFlowSnmpv2CPDU - requestIdHolder PatternFlowSnmpv2CPDURequestId - errorIndexHolder PatternFlowSnmpv2CPDUErrorIndex - variableBindingsHolder FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter -} - -func NewFlowSnmpv2CPDU() FlowSnmpv2CPDU { - obj := flowSnmpv2CPDU{obj: &otg.FlowSnmpv2CPDU{}} - obj.setDefault() - return &obj -} - -func (obj *flowSnmpv2CPDU) msg() *otg.FlowSnmpv2CPDU { - return obj.obj -} - -func (obj *flowSnmpv2CPDU) setMsg(msg *otg.FlowSnmpv2CPDU) FlowSnmpv2CPDU { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowSnmpv2CPDU struct { - obj *flowSnmpv2CPDU -} - -type marshalFlowSnmpv2CPDU interface { - // ToProto marshals FlowSnmpv2CPDU to protobuf object *otg.FlowSnmpv2CPDU - ToProto() (*otg.FlowSnmpv2CPDU, error) - // ToPbText marshals FlowSnmpv2CPDU to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowSnmpv2CPDU to YAML text - ToYaml() (string, error) - // ToJson marshals FlowSnmpv2CPDU to JSON text - ToJson() (string, error) -} - -type unMarshalflowSnmpv2CPDU struct { - obj *flowSnmpv2CPDU -} - -type unMarshalFlowSnmpv2CPDU interface { - // FromProto unmarshals FlowSnmpv2CPDU from protobuf object *otg.FlowSnmpv2CPDU - FromProto(msg *otg.FlowSnmpv2CPDU) (FlowSnmpv2CPDU, error) - // FromPbText unmarshals FlowSnmpv2CPDU from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowSnmpv2CPDU from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowSnmpv2CPDU from JSON text - FromJson(value string) error -} - -func (obj *flowSnmpv2CPDU) Marshal() marshalFlowSnmpv2CPDU { - if obj.marshaller == nil { - obj.marshaller = &marshalflowSnmpv2CPDU{obj: obj} - } - return obj.marshaller -} - -func (obj *flowSnmpv2CPDU) Unmarshal() unMarshalFlowSnmpv2CPDU { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowSnmpv2CPDU{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowSnmpv2CPDU) ToProto() (*otg.FlowSnmpv2CPDU, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowSnmpv2CPDU) FromProto(msg *otg.FlowSnmpv2CPDU) (FlowSnmpv2CPDU, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowSnmpv2CPDU) 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 *unMarshalflowSnmpv2CPDU) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowSnmpv2CPDU) 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 *unMarshalflowSnmpv2CPDU) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowSnmpv2CPDU) 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 *unMarshalflowSnmpv2CPDU) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowSnmpv2CPDU) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowSnmpv2CPDU) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowSnmpv2CPDU) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowSnmpv2CPDU) Clone() (FlowSnmpv2CPDU, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowSnmpv2CPDU() - 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 -} - -func (obj *flowSnmpv2CPDU) setNil() { - obj.requestIdHolder = nil - obj.errorIndexHolder = nil - obj.variableBindingsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowSnmpv2CPDU is this contains the body of the SNMPv2C PDU. -type FlowSnmpv2CPDU interface { - Validation - // msg marshals FlowSnmpv2CPDU to protobuf object *otg.FlowSnmpv2CPDU - // and doesn't set defaults - msg() *otg.FlowSnmpv2CPDU - // setMsg unmarshals FlowSnmpv2CPDU from protobuf object *otg.FlowSnmpv2CPDU - // and doesn't set defaults - setMsg(*otg.FlowSnmpv2CPDU) FlowSnmpv2CPDU - // provides marshal interface - Marshal() marshalFlowSnmpv2CPDU - // provides unmarshal interface - Unmarshal() unMarshalFlowSnmpv2CPDU - // validate validates FlowSnmpv2CPDU - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowSnmpv2CPDU, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RequestId returns PatternFlowSnmpv2CPDURequestId, set in FlowSnmpv2CPDU. - RequestId() PatternFlowSnmpv2CPDURequestId - // SetRequestId assigns PatternFlowSnmpv2CPDURequestId provided by user to FlowSnmpv2CPDU. - SetRequestId(value PatternFlowSnmpv2CPDURequestId) FlowSnmpv2CPDU - // HasRequestId checks if RequestId has been set in FlowSnmpv2CPDU - HasRequestId() bool - // ErrorStatus returns FlowSnmpv2CPDUErrorStatusEnum, set in FlowSnmpv2CPDU - ErrorStatus() FlowSnmpv2CPDUErrorStatusEnum - // SetErrorStatus assigns FlowSnmpv2CPDUErrorStatusEnum provided by user to FlowSnmpv2CPDU - SetErrorStatus(value FlowSnmpv2CPDUErrorStatusEnum) FlowSnmpv2CPDU - // HasErrorStatus checks if ErrorStatus has been set in FlowSnmpv2CPDU - HasErrorStatus() bool - // ErrorIndex returns PatternFlowSnmpv2CPDUErrorIndex, set in FlowSnmpv2CPDU. - ErrorIndex() PatternFlowSnmpv2CPDUErrorIndex - // SetErrorIndex assigns PatternFlowSnmpv2CPDUErrorIndex provided by user to FlowSnmpv2CPDU. - SetErrorIndex(value PatternFlowSnmpv2CPDUErrorIndex) FlowSnmpv2CPDU - // HasErrorIndex checks if ErrorIndex has been set in FlowSnmpv2CPDU - HasErrorIndex() bool - // VariableBindings returns FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIterIter, set in FlowSnmpv2CPDU - VariableBindings() FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter - setNil() -} - -// description is TBD -// RequestId returns a PatternFlowSnmpv2CPDURequestId -func (obj *flowSnmpv2CPDU) RequestId() PatternFlowSnmpv2CPDURequestId { - if obj.obj.RequestId == nil { - obj.obj.RequestId = NewPatternFlowSnmpv2CPDURequestId().msg() - } - if obj.requestIdHolder == nil { - obj.requestIdHolder = &patternFlowSnmpv2CPDURequestId{obj: obj.obj.RequestId} - } - return obj.requestIdHolder -} - -// description is TBD -// RequestId returns a PatternFlowSnmpv2CPDURequestId -func (obj *flowSnmpv2CPDU) HasRequestId() bool { - return obj.obj.RequestId != nil -} - -// description is TBD -// SetRequestId sets the PatternFlowSnmpv2CPDURequestId value in the FlowSnmpv2CPDU object -func (obj *flowSnmpv2CPDU) SetRequestId(value PatternFlowSnmpv2CPDURequestId) FlowSnmpv2CPDU { - - obj.requestIdHolder = nil - obj.obj.RequestId = value.msg() - - return obj -} - -type FlowSnmpv2CPDUErrorStatusEnum string - -// Enum of ErrorStatus on FlowSnmpv2CPDU -var FlowSnmpv2CPDUErrorStatus = struct { - NO_ERROR FlowSnmpv2CPDUErrorStatusEnum - TOO_BIG FlowSnmpv2CPDUErrorStatusEnum - NO_SUCH_NAME FlowSnmpv2CPDUErrorStatusEnum - BAD_VALUE FlowSnmpv2CPDUErrorStatusEnum - READ_ONLY FlowSnmpv2CPDUErrorStatusEnum - GEN_ERR FlowSnmpv2CPDUErrorStatusEnum - NO_ACCESS FlowSnmpv2CPDUErrorStatusEnum - WRONG_TYPE FlowSnmpv2CPDUErrorStatusEnum - WRONG_LENGTH FlowSnmpv2CPDUErrorStatusEnum - WRONG_ENCODING FlowSnmpv2CPDUErrorStatusEnum - WRONG_VALUE FlowSnmpv2CPDUErrorStatusEnum - NO_CREATION FlowSnmpv2CPDUErrorStatusEnum - INCONSISTENT_VALUE FlowSnmpv2CPDUErrorStatusEnum - RESOURCE_UNAVAILABLE FlowSnmpv2CPDUErrorStatusEnum - COMMIT_FAILED FlowSnmpv2CPDUErrorStatusEnum - UNDO_FAILED FlowSnmpv2CPDUErrorStatusEnum - AUTHORIZATION_ERROR FlowSnmpv2CPDUErrorStatusEnum - NOT_WRITABLE FlowSnmpv2CPDUErrorStatusEnum - INCONSISTENT_NAME FlowSnmpv2CPDUErrorStatusEnum -}{ - NO_ERROR: FlowSnmpv2CPDUErrorStatusEnum("no_error"), - TOO_BIG: FlowSnmpv2CPDUErrorStatusEnum("too_big"), - NO_SUCH_NAME: FlowSnmpv2CPDUErrorStatusEnum("no_such_name"), - BAD_VALUE: FlowSnmpv2CPDUErrorStatusEnum("bad_value"), - READ_ONLY: FlowSnmpv2CPDUErrorStatusEnum("read_only"), - GEN_ERR: FlowSnmpv2CPDUErrorStatusEnum("gen_err"), - NO_ACCESS: FlowSnmpv2CPDUErrorStatusEnum("no_access"), - WRONG_TYPE: FlowSnmpv2CPDUErrorStatusEnum("wrong_type"), - WRONG_LENGTH: FlowSnmpv2CPDUErrorStatusEnum("wrong_length"), - WRONG_ENCODING: FlowSnmpv2CPDUErrorStatusEnum("wrong_encoding"), - WRONG_VALUE: FlowSnmpv2CPDUErrorStatusEnum("wrong_value"), - NO_CREATION: FlowSnmpv2CPDUErrorStatusEnum("no_creation"), - INCONSISTENT_VALUE: FlowSnmpv2CPDUErrorStatusEnum("inconsistent_value"), - RESOURCE_UNAVAILABLE: FlowSnmpv2CPDUErrorStatusEnum("resource_unavailable"), - COMMIT_FAILED: FlowSnmpv2CPDUErrorStatusEnum("commit_failed"), - UNDO_FAILED: FlowSnmpv2CPDUErrorStatusEnum("undo_failed"), - AUTHORIZATION_ERROR: FlowSnmpv2CPDUErrorStatusEnum("authorization_error"), - NOT_WRITABLE: FlowSnmpv2CPDUErrorStatusEnum("not_writable"), - INCONSISTENT_NAME: FlowSnmpv2CPDUErrorStatusEnum("inconsistent_name"), -} - -func (obj *flowSnmpv2CPDU) ErrorStatus() FlowSnmpv2CPDUErrorStatusEnum { - return FlowSnmpv2CPDUErrorStatusEnum(obj.obj.ErrorStatus.Enum().String()) -} - -// The SNMP agent places an error code in this field in the response message if an error occurred processing the request. -// ErrorStatus returns a string -func (obj *flowSnmpv2CPDU) HasErrorStatus() bool { - return obj.obj.ErrorStatus != nil -} - -func (obj *flowSnmpv2CPDU) SetErrorStatus(value FlowSnmpv2CPDUErrorStatusEnum) FlowSnmpv2CPDU { - intValue, ok := otg.FlowSnmpv2CPDU_ErrorStatus_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowSnmpv2CPDUErrorStatusEnum", string(value))) - return obj - } - enumValue := otg.FlowSnmpv2CPDU_ErrorStatus_Enum(intValue) - obj.obj.ErrorStatus = &enumValue - - return obj -} - -// description is TBD -// ErrorIndex returns a PatternFlowSnmpv2CPDUErrorIndex -func (obj *flowSnmpv2CPDU) ErrorIndex() PatternFlowSnmpv2CPDUErrorIndex { - if obj.obj.ErrorIndex == nil { - obj.obj.ErrorIndex = NewPatternFlowSnmpv2CPDUErrorIndex().msg() - } - if obj.errorIndexHolder == nil { - obj.errorIndexHolder = &patternFlowSnmpv2CPDUErrorIndex{obj: obj.obj.ErrorIndex} - } - return obj.errorIndexHolder -} - -// description is TBD -// ErrorIndex returns a PatternFlowSnmpv2CPDUErrorIndex -func (obj *flowSnmpv2CPDU) HasErrorIndex() bool { - return obj.obj.ErrorIndex != nil -} - -// description is TBD -// SetErrorIndex sets the PatternFlowSnmpv2CPDUErrorIndex value in the FlowSnmpv2CPDU object -func (obj *flowSnmpv2CPDU) SetErrorIndex(value PatternFlowSnmpv2CPDUErrorIndex) FlowSnmpv2CPDU { - - obj.errorIndexHolder = nil - obj.obj.ErrorIndex = value.msg() - - return obj -} - -// A Sequence of variable_bindings. -// VariableBindings returns a []FlowSnmpv2CVariableBinding -func (obj *flowSnmpv2CPDU) VariableBindings() FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { - if len(obj.obj.VariableBindings) == 0 { - obj.obj.VariableBindings = []*otg.FlowSnmpv2CVariableBinding{} - } - if obj.variableBindingsHolder == nil { - obj.variableBindingsHolder = newFlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter(&obj.obj.VariableBindings).setMsg(obj) - } - return obj.variableBindingsHolder -} - -type flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter struct { - obj *flowSnmpv2CPDU - flowSnmpv2CVariableBindingSlice []FlowSnmpv2CVariableBinding - fieldPtr *[]*otg.FlowSnmpv2CVariableBinding -} - -func newFlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter(ptr *[]*otg.FlowSnmpv2CVariableBinding) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { - return &flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter{fieldPtr: ptr} -} - -type FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter interface { - setMsg(*flowSnmpv2CPDU) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter - Items() []FlowSnmpv2CVariableBinding - Add() FlowSnmpv2CVariableBinding - Append(items ...FlowSnmpv2CVariableBinding) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter - Set(index int, newObj FlowSnmpv2CVariableBinding) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter - Clear() FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter - clearHolderSlice() FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter - appendHolderSlice(item FlowSnmpv2CVariableBinding) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter -} - -func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) setMsg(msg *flowSnmpv2CPDU) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flowSnmpv2CVariableBinding{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) Items() []FlowSnmpv2CVariableBinding { - return obj.flowSnmpv2CVariableBindingSlice -} - -func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) Add() FlowSnmpv2CVariableBinding { - newObj := &otg.FlowSnmpv2CVariableBinding{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flowSnmpv2CVariableBinding{obj: newObj} - newLibObj.setDefault() - obj.flowSnmpv2CVariableBindingSlice = append(obj.flowSnmpv2CVariableBindingSlice, newLibObj) - return newLibObj -} - -func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) Append(items ...FlowSnmpv2CVariableBinding) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowSnmpv2CVariableBindingSlice = append(obj.flowSnmpv2CVariableBindingSlice, item) - } - return obj -} - -func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) Set(index int, newObj FlowSnmpv2CVariableBinding) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowSnmpv2CVariableBindingSlice[index] = newObj - return obj -} -func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) Clear() FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.FlowSnmpv2CVariableBinding{} - obj.flowSnmpv2CVariableBindingSlice = []FlowSnmpv2CVariableBinding{} - } - return obj -} -func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) clearHolderSlice() FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { - if len(obj.flowSnmpv2CVariableBindingSlice) > 0 { - obj.flowSnmpv2CVariableBindingSlice = []FlowSnmpv2CVariableBinding{} - } - return obj -} -func (obj *flowSnmpv2CPDUFlowSnmpv2CVariableBindingIter) appendHolderSlice(item FlowSnmpv2CVariableBinding) FlowSnmpv2CPDUFlowSnmpv2CVariableBindingIter { - obj.flowSnmpv2CVariableBindingSlice = append(obj.flowSnmpv2CVariableBindingSlice, item) - return obj -} - -func (obj *flowSnmpv2CPDU) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RequestId != nil { - - obj.RequestId().validateObj(vObj, set_default) - } - - if obj.obj.ErrorIndex != nil { - - obj.ErrorIndex().validateObj(vObj, set_default) - } - - if len(obj.obj.VariableBindings) != 0 { - - if set_default { - obj.VariableBindings().clearHolderSlice() - for _, item := range obj.obj.VariableBindings { - obj.VariableBindings().appendHolderSlice(&flowSnmpv2CVariableBinding{obj: item}) - } - } - for _, item := range obj.VariableBindings().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *flowSnmpv2CPDU) setDefault() { - if obj.obj.ErrorStatus == nil { - obj.SetErrorStatus(FlowSnmpv2CPDUErrorStatus.NO_ERROR) - - } - -} - -// ***** FlowSnmpv2CBulkPDU ***** -type flowSnmpv2CBulkPDU struct { - validation - obj *otg.FlowSnmpv2CBulkPDU - marshaller marshalFlowSnmpv2CBulkPDU - unMarshaller unMarshalFlowSnmpv2CBulkPDU - requestIdHolder PatternFlowSnmpv2CBulkPDURequestId - nonRepeatersHolder PatternFlowSnmpv2CBulkPDUNonRepeaters - maxRepetitionsHolder PatternFlowSnmpv2CBulkPDUMaxRepetitions - variableBindingsHolder FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter -} - -func NewFlowSnmpv2CBulkPDU() FlowSnmpv2CBulkPDU { - obj := flowSnmpv2CBulkPDU{obj: &otg.FlowSnmpv2CBulkPDU{}} - obj.setDefault() - return &obj -} - -func (obj *flowSnmpv2CBulkPDU) msg() *otg.FlowSnmpv2CBulkPDU { - return obj.obj -} - -func (obj *flowSnmpv2CBulkPDU) setMsg(msg *otg.FlowSnmpv2CBulkPDU) FlowSnmpv2CBulkPDU { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowSnmpv2CBulkPDU struct { - obj *flowSnmpv2CBulkPDU -} - -type marshalFlowSnmpv2CBulkPDU interface { - // ToProto marshals FlowSnmpv2CBulkPDU to protobuf object *otg.FlowSnmpv2CBulkPDU - ToProto() (*otg.FlowSnmpv2CBulkPDU, error) - // ToPbText marshals FlowSnmpv2CBulkPDU to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowSnmpv2CBulkPDU to YAML text - ToYaml() (string, error) - // ToJson marshals FlowSnmpv2CBulkPDU to JSON text - ToJson() (string, error) -} - -type unMarshalflowSnmpv2CBulkPDU struct { - obj *flowSnmpv2CBulkPDU -} - -type unMarshalFlowSnmpv2CBulkPDU interface { - // FromProto unmarshals FlowSnmpv2CBulkPDU from protobuf object *otg.FlowSnmpv2CBulkPDU - FromProto(msg *otg.FlowSnmpv2CBulkPDU) (FlowSnmpv2CBulkPDU, error) - // FromPbText unmarshals FlowSnmpv2CBulkPDU from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowSnmpv2CBulkPDU from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowSnmpv2CBulkPDU from JSON text - FromJson(value string) error -} - -func (obj *flowSnmpv2CBulkPDU) Marshal() marshalFlowSnmpv2CBulkPDU { - if obj.marshaller == nil { - obj.marshaller = &marshalflowSnmpv2CBulkPDU{obj: obj} - } - return obj.marshaller -} - -func (obj *flowSnmpv2CBulkPDU) Unmarshal() unMarshalFlowSnmpv2CBulkPDU { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowSnmpv2CBulkPDU{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowSnmpv2CBulkPDU) ToProto() (*otg.FlowSnmpv2CBulkPDU, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowSnmpv2CBulkPDU) FromProto(msg *otg.FlowSnmpv2CBulkPDU) (FlowSnmpv2CBulkPDU, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowSnmpv2CBulkPDU) 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 *unMarshalflowSnmpv2CBulkPDU) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowSnmpv2CBulkPDU) 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 *unMarshalflowSnmpv2CBulkPDU) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowSnmpv2CBulkPDU) 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 *unMarshalflowSnmpv2CBulkPDU) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowSnmpv2CBulkPDU) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowSnmpv2CBulkPDU) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowSnmpv2CBulkPDU) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowSnmpv2CBulkPDU) Clone() (FlowSnmpv2CBulkPDU, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowSnmpv2CBulkPDU() - 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 -} - -func (obj *flowSnmpv2CBulkPDU) setNil() { - obj.requestIdHolder = nil - obj.nonRepeatersHolder = nil - obj.maxRepetitionsHolder = nil - obj.variableBindingsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowSnmpv2CBulkPDU is the purpose of the GetBulkRequest-PDU is to request the transfer of a potentially large amount of data, including, but not limited to, the efficient and rapid retrieval of large tables. -type FlowSnmpv2CBulkPDU interface { - Validation - // msg marshals FlowSnmpv2CBulkPDU to protobuf object *otg.FlowSnmpv2CBulkPDU - // and doesn't set defaults - msg() *otg.FlowSnmpv2CBulkPDU - // setMsg unmarshals FlowSnmpv2CBulkPDU from protobuf object *otg.FlowSnmpv2CBulkPDU - // and doesn't set defaults - setMsg(*otg.FlowSnmpv2CBulkPDU) FlowSnmpv2CBulkPDU - // provides marshal interface - Marshal() marshalFlowSnmpv2CBulkPDU - // provides unmarshal interface - Unmarshal() unMarshalFlowSnmpv2CBulkPDU - // validate validates FlowSnmpv2CBulkPDU - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowSnmpv2CBulkPDU, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RequestId returns PatternFlowSnmpv2CBulkPDURequestId, set in FlowSnmpv2CBulkPDU. - RequestId() PatternFlowSnmpv2CBulkPDURequestId - // SetRequestId assigns PatternFlowSnmpv2CBulkPDURequestId provided by user to FlowSnmpv2CBulkPDU. - SetRequestId(value PatternFlowSnmpv2CBulkPDURequestId) FlowSnmpv2CBulkPDU - // HasRequestId checks if RequestId has been set in FlowSnmpv2CBulkPDU - HasRequestId() bool - // NonRepeaters returns PatternFlowSnmpv2CBulkPDUNonRepeaters, set in FlowSnmpv2CBulkPDU. - NonRepeaters() PatternFlowSnmpv2CBulkPDUNonRepeaters - // SetNonRepeaters assigns PatternFlowSnmpv2CBulkPDUNonRepeaters provided by user to FlowSnmpv2CBulkPDU. - SetNonRepeaters(value PatternFlowSnmpv2CBulkPDUNonRepeaters) FlowSnmpv2CBulkPDU - // HasNonRepeaters checks if NonRepeaters has been set in FlowSnmpv2CBulkPDU - HasNonRepeaters() bool - // MaxRepetitions returns PatternFlowSnmpv2CBulkPDUMaxRepetitions, set in FlowSnmpv2CBulkPDU. - MaxRepetitions() PatternFlowSnmpv2CBulkPDUMaxRepetitions - // SetMaxRepetitions assigns PatternFlowSnmpv2CBulkPDUMaxRepetitions provided by user to FlowSnmpv2CBulkPDU. - SetMaxRepetitions(value PatternFlowSnmpv2CBulkPDUMaxRepetitions) FlowSnmpv2CBulkPDU - // HasMaxRepetitions checks if MaxRepetitions has been set in FlowSnmpv2CBulkPDU - HasMaxRepetitions() bool - // VariableBindings returns FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIterIter, set in FlowSnmpv2CBulkPDU - VariableBindings() FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter - setNil() -} - -// description is TBD -// RequestId returns a PatternFlowSnmpv2CBulkPDURequestId -func (obj *flowSnmpv2CBulkPDU) RequestId() PatternFlowSnmpv2CBulkPDURequestId { - if obj.obj.RequestId == nil { - obj.obj.RequestId = NewPatternFlowSnmpv2CBulkPDURequestId().msg() - } - if obj.requestIdHolder == nil { - obj.requestIdHolder = &patternFlowSnmpv2CBulkPDURequestId{obj: obj.obj.RequestId} - } - return obj.requestIdHolder -} - -// description is TBD -// RequestId returns a PatternFlowSnmpv2CBulkPDURequestId -func (obj *flowSnmpv2CBulkPDU) HasRequestId() bool { - return obj.obj.RequestId != nil -} - -// description is TBD -// SetRequestId sets the PatternFlowSnmpv2CBulkPDURequestId value in the FlowSnmpv2CBulkPDU object -func (obj *flowSnmpv2CBulkPDU) SetRequestId(value PatternFlowSnmpv2CBulkPDURequestId) FlowSnmpv2CBulkPDU { - - obj.requestIdHolder = nil - obj.obj.RequestId = value.msg() - - return obj -} - -// description is TBD -// NonRepeaters returns a PatternFlowSnmpv2CBulkPDUNonRepeaters -func (obj *flowSnmpv2CBulkPDU) NonRepeaters() PatternFlowSnmpv2CBulkPDUNonRepeaters { - if obj.obj.NonRepeaters == nil { - obj.obj.NonRepeaters = NewPatternFlowSnmpv2CBulkPDUNonRepeaters().msg() - } - if obj.nonRepeatersHolder == nil { - obj.nonRepeatersHolder = &patternFlowSnmpv2CBulkPDUNonRepeaters{obj: obj.obj.NonRepeaters} - } - return obj.nonRepeatersHolder -} - -// description is TBD -// NonRepeaters returns a PatternFlowSnmpv2CBulkPDUNonRepeaters -func (obj *flowSnmpv2CBulkPDU) HasNonRepeaters() bool { - return obj.obj.NonRepeaters != nil -} - -// description is TBD -// SetNonRepeaters sets the PatternFlowSnmpv2CBulkPDUNonRepeaters value in the FlowSnmpv2CBulkPDU object -func (obj *flowSnmpv2CBulkPDU) SetNonRepeaters(value PatternFlowSnmpv2CBulkPDUNonRepeaters) FlowSnmpv2CBulkPDU { - - obj.nonRepeatersHolder = nil - obj.obj.NonRepeaters = value.msg() - - return obj -} - -// description is TBD -// MaxRepetitions returns a PatternFlowSnmpv2CBulkPDUMaxRepetitions -func (obj *flowSnmpv2CBulkPDU) MaxRepetitions() PatternFlowSnmpv2CBulkPDUMaxRepetitions { - if obj.obj.MaxRepetitions == nil { - obj.obj.MaxRepetitions = NewPatternFlowSnmpv2CBulkPDUMaxRepetitions().msg() - } - if obj.maxRepetitionsHolder == nil { - obj.maxRepetitionsHolder = &patternFlowSnmpv2CBulkPDUMaxRepetitions{obj: obj.obj.MaxRepetitions} - } - return obj.maxRepetitionsHolder -} - -// description is TBD -// MaxRepetitions returns a PatternFlowSnmpv2CBulkPDUMaxRepetitions -func (obj *flowSnmpv2CBulkPDU) HasMaxRepetitions() bool { - return obj.obj.MaxRepetitions != nil -} - -// description is TBD -// SetMaxRepetitions sets the PatternFlowSnmpv2CBulkPDUMaxRepetitions value in the FlowSnmpv2CBulkPDU object -func (obj *flowSnmpv2CBulkPDU) SetMaxRepetitions(value PatternFlowSnmpv2CBulkPDUMaxRepetitions) FlowSnmpv2CBulkPDU { - - obj.maxRepetitionsHolder = nil - obj.obj.MaxRepetitions = value.msg() - - return obj -} - -// A Sequence of variable_bindings. -// VariableBindings returns a []FlowSnmpv2CVariableBinding -func (obj *flowSnmpv2CBulkPDU) VariableBindings() FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { - if len(obj.obj.VariableBindings) == 0 { - obj.obj.VariableBindings = []*otg.FlowSnmpv2CVariableBinding{} - } - if obj.variableBindingsHolder == nil { - obj.variableBindingsHolder = newFlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter(&obj.obj.VariableBindings).setMsg(obj) - } - return obj.variableBindingsHolder -} - -type flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter struct { - obj *flowSnmpv2CBulkPDU - flowSnmpv2CVariableBindingSlice []FlowSnmpv2CVariableBinding - fieldPtr *[]*otg.FlowSnmpv2CVariableBinding -} - -func newFlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter(ptr *[]*otg.FlowSnmpv2CVariableBinding) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { - return &flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter{fieldPtr: ptr} -} - -type FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter interface { - setMsg(*flowSnmpv2CBulkPDU) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter - Items() []FlowSnmpv2CVariableBinding - Add() FlowSnmpv2CVariableBinding - Append(items ...FlowSnmpv2CVariableBinding) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter - Set(index int, newObj FlowSnmpv2CVariableBinding) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter - Clear() FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter - clearHolderSlice() FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter - appendHolderSlice(item FlowSnmpv2CVariableBinding) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter -} - -func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) setMsg(msg *flowSnmpv2CBulkPDU) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flowSnmpv2CVariableBinding{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) Items() []FlowSnmpv2CVariableBinding { - return obj.flowSnmpv2CVariableBindingSlice -} - -func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) Add() FlowSnmpv2CVariableBinding { - newObj := &otg.FlowSnmpv2CVariableBinding{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flowSnmpv2CVariableBinding{obj: newObj} - newLibObj.setDefault() - obj.flowSnmpv2CVariableBindingSlice = append(obj.flowSnmpv2CVariableBindingSlice, newLibObj) - return newLibObj -} - -func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) Append(items ...FlowSnmpv2CVariableBinding) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowSnmpv2CVariableBindingSlice = append(obj.flowSnmpv2CVariableBindingSlice, item) - } - return obj -} - -func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) Set(index int, newObj FlowSnmpv2CVariableBinding) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowSnmpv2CVariableBindingSlice[index] = newObj - return obj -} -func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) Clear() FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.FlowSnmpv2CVariableBinding{} - obj.flowSnmpv2CVariableBindingSlice = []FlowSnmpv2CVariableBinding{} - } - return obj -} -func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) clearHolderSlice() FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { - if len(obj.flowSnmpv2CVariableBindingSlice) > 0 { - obj.flowSnmpv2CVariableBindingSlice = []FlowSnmpv2CVariableBinding{} - } - return obj -} -func (obj *flowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter) appendHolderSlice(item FlowSnmpv2CVariableBinding) FlowSnmpv2CBulkPDUFlowSnmpv2CVariableBindingIter { - obj.flowSnmpv2CVariableBindingSlice = append(obj.flowSnmpv2CVariableBindingSlice, item) - return obj -} - -func (obj *flowSnmpv2CBulkPDU) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RequestId != nil { - - obj.RequestId().validateObj(vObj, set_default) - } - - if obj.obj.NonRepeaters != nil { - - obj.NonRepeaters().validateObj(vObj, set_default) - } - - if obj.obj.MaxRepetitions != nil { - - obj.MaxRepetitions().validateObj(vObj, set_default) - } - - if len(obj.obj.VariableBindings) != 0 { - - if set_default { - obj.VariableBindings().clearHolderSlice() - for _, item := range obj.obj.VariableBindings { - obj.VariableBindings().appendHolderSlice(&flowSnmpv2CVariableBinding{obj: item}) - } - } - for _, item := range obj.VariableBindings().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *flowSnmpv2CBulkPDU) setDefault() { - -} - -// ***** PatternFlowRsvpTimeToLiveCounter ***** -type patternFlowRsvpTimeToLiveCounter struct { - validation - obj *otg.PatternFlowRsvpTimeToLiveCounter - marshaller marshalPatternFlowRsvpTimeToLiveCounter - unMarshaller unMarshalPatternFlowRsvpTimeToLiveCounter -} - -func NewPatternFlowRsvpTimeToLiveCounter() PatternFlowRsvpTimeToLiveCounter { - obj := patternFlowRsvpTimeToLiveCounter{obj: &otg.PatternFlowRsvpTimeToLiveCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRsvpTimeToLiveCounter) msg() *otg.PatternFlowRsvpTimeToLiveCounter { - return obj.obj -} - -func (obj *patternFlowRsvpTimeToLiveCounter) setMsg(msg *otg.PatternFlowRsvpTimeToLiveCounter) PatternFlowRsvpTimeToLiveCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRsvpTimeToLiveCounter struct { - obj *patternFlowRsvpTimeToLiveCounter -} - -type marshalPatternFlowRsvpTimeToLiveCounter interface { - // ToProto marshals PatternFlowRsvpTimeToLiveCounter to protobuf object *otg.PatternFlowRsvpTimeToLiveCounter - ToProto() (*otg.PatternFlowRsvpTimeToLiveCounter, error) - // ToPbText marshals PatternFlowRsvpTimeToLiveCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRsvpTimeToLiveCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRsvpTimeToLiveCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRsvpTimeToLiveCounter struct { - obj *patternFlowRsvpTimeToLiveCounter -} - -type unMarshalPatternFlowRsvpTimeToLiveCounter interface { - // FromProto unmarshals PatternFlowRsvpTimeToLiveCounter from protobuf object *otg.PatternFlowRsvpTimeToLiveCounter - FromProto(msg *otg.PatternFlowRsvpTimeToLiveCounter) (PatternFlowRsvpTimeToLiveCounter, error) - // FromPbText unmarshals PatternFlowRsvpTimeToLiveCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRsvpTimeToLiveCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRsvpTimeToLiveCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRsvpTimeToLiveCounter) Marshal() marshalPatternFlowRsvpTimeToLiveCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRsvpTimeToLiveCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRsvpTimeToLiveCounter) Unmarshal() unMarshalPatternFlowRsvpTimeToLiveCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRsvpTimeToLiveCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRsvpTimeToLiveCounter) ToProto() (*otg.PatternFlowRsvpTimeToLiveCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRsvpTimeToLiveCounter) FromProto(msg *otg.PatternFlowRsvpTimeToLiveCounter) (PatternFlowRsvpTimeToLiveCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRsvpTimeToLiveCounter) 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 *unMarshalpatternFlowRsvpTimeToLiveCounter) 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 *marshalpatternFlowRsvpTimeToLiveCounter) 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 *unMarshalpatternFlowRsvpTimeToLiveCounter) 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 *marshalpatternFlowRsvpTimeToLiveCounter) 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 *unMarshalpatternFlowRsvpTimeToLiveCounter) 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 *patternFlowRsvpTimeToLiveCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRsvpTimeToLiveCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRsvpTimeToLiveCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRsvpTimeToLiveCounter) Clone() (PatternFlowRsvpTimeToLiveCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRsvpTimeToLiveCounter() - 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 -} - -// PatternFlowRsvpTimeToLiveCounter is integer counter pattern -type PatternFlowRsvpTimeToLiveCounter interface { - Validation - // msg marshals PatternFlowRsvpTimeToLiveCounter to protobuf object *otg.PatternFlowRsvpTimeToLiveCounter - // and doesn't set defaults - msg() *otg.PatternFlowRsvpTimeToLiveCounter - // setMsg unmarshals PatternFlowRsvpTimeToLiveCounter from protobuf object *otg.PatternFlowRsvpTimeToLiveCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRsvpTimeToLiveCounter) PatternFlowRsvpTimeToLiveCounter - // provides marshal interface - Marshal() marshalPatternFlowRsvpTimeToLiveCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRsvpTimeToLiveCounter - // validate validates PatternFlowRsvpTimeToLiveCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRsvpTimeToLiveCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRsvpTimeToLiveCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRsvpTimeToLiveCounter - SetStart(value uint32) PatternFlowRsvpTimeToLiveCounter - // HasStart checks if Start has been set in PatternFlowRsvpTimeToLiveCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRsvpTimeToLiveCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRsvpTimeToLiveCounter - SetStep(value uint32) PatternFlowRsvpTimeToLiveCounter - // HasStep checks if Step has been set in PatternFlowRsvpTimeToLiveCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRsvpTimeToLiveCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRsvpTimeToLiveCounter - SetCount(value uint32) PatternFlowRsvpTimeToLiveCounter - // HasCount checks if Count has been set in PatternFlowRsvpTimeToLiveCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRsvpTimeToLiveCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRsvpTimeToLiveCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRsvpTimeToLiveCounter object -func (obj *patternFlowRsvpTimeToLiveCounter) SetStart(value uint32) PatternFlowRsvpTimeToLiveCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRsvpTimeToLiveCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRsvpTimeToLiveCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRsvpTimeToLiveCounter object -func (obj *patternFlowRsvpTimeToLiveCounter) SetStep(value uint32) PatternFlowRsvpTimeToLiveCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRsvpTimeToLiveCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRsvpTimeToLiveCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRsvpTimeToLiveCounter object -func (obj *patternFlowRsvpTimeToLiveCounter) SetCount(value uint32) PatternFlowRsvpTimeToLiveCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRsvpTimeToLiveCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRsvpTimeToLiveCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRsvpTimeToLiveCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRsvpTimeToLiveCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRsvpTimeToLiveCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(64) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRsvpReservedCounter ***** -type patternFlowRsvpReservedCounter struct { - validation - obj *otg.PatternFlowRsvpReservedCounter - marshaller marshalPatternFlowRsvpReservedCounter - unMarshaller unMarshalPatternFlowRsvpReservedCounter -} - -func NewPatternFlowRsvpReservedCounter() PatternFlowRsvpReservedCounter { - obj := patternFlowRsvpReservedCounter{obj: &otg.PatternFlowRsvpReservedCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRsvpReservedCounter) msg() *otg.PatternFlowRsvpReservedCounter { - return obj.obj -} - -func (obj *patternFlowRsvpReservedCounter) setMsg(msg *otg.PatternFlowRsvpReservedCounter) PatternFlowRsvpReservedCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRsvpReservedCounter struct { - obj *patternFlowRsvpReservedCounter -} - -type marshalPatternFlowRsvpReservedCounter interface { - // ToProto marshals PatternFlowRsvpReservedCounter to protobuf object *otg.PatternFlowRsvpReservedCounter - ToProto() (*otg.PatternFlowRsvpReservedCounter, error) - // ToPbText marshals PatternFlowRsvpReservedCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRsvpReservedCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRsvpReservedCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRsvpReservedCounter struct { - obj *patternFlowRsvpReservedCounter -} - -type unMarshalPatternFlowRsvpReservedCounter interface { - // FromProto unmarshals PatternFlowRsvpReservedCounter from protobuf object *otg.PatternFlowRsvpReservedCounter - FromProto(msg *otg.PatternFlowRsvpReservedCounter) (PatternFlowRsvpReservedCounter, error) - // FromPbText unmarshals PatternFlowRsvpReservedCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRsvpReservedCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRsvpReservedCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRsvpReservedCounter) Marshal() marshalPatternFlowRsvpReservedCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRsvpReservedCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRsvpReservedCounter) Unmarshal() unMarshalPatternFlowRsvpReservedCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRsvpReservedCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRsvpReservedCounter) ToProto() (*otg.PatternFlowRsvpReservedCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRsvpReservedCounter) FromProto(msg *otg.PatternFlowRsvpReservedCounter) (PatternFlowRsvpReservedCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRsvpReservedCounter) 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 *unMarshalpatternFlowRsvpReservedCounter) 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 *marshalpatternFlowRsvpReservedCounter) 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 *unMarshalpatternFlowRsvpReservedCounter) 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 *marshalpatternFlowRsvpReservedCounter) 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 *unMarshalpatternFlowRsvpReservedCounter) 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 *patternFlowRsvpReservedCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRsvpReservedCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRsvpReservedCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRsvpReservedCounter) Clone() (PatternFlowRsvpReservedCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRsvpReservedCounter() - 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 -} - -// PatternFlowRsvpReservedCounter is integer counter pattern -type PatternFlowRsvpReservedCounter interface { - Validation - // msg marshals PatternFlowRsvpReservedCounter to protobuf object *otg.PatternFlowRsvpReservedCounter - // and doesn't set defaults - msg() *otg.PatternFlowRsvpReservedCounter - // setMsg unmarshals PatternFlowRsvpReservedCounter from protobuf object *otg.PatternFlowRsvpReservedCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRsvpReservedCounter) PatternFlowRsvpReservedCounter - // provides marshal interface - Marshal() marshalPatternFlowRsvpReservedCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRsvpReservedCounter - // validate validates PatternFlowRsvpReservedCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRsvpReservedCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRsvpReservedCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRsvpReservedCounter - SetStart(value uint32) PatternFlowRsvpReservedCounter - // HasStart checks if Start has been set in PatternFlowRsvpReservedCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRsvpReservedCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRsvpReservedCounter - SetStep(value uint32) PatternFlowRsvpReservedCounter - // HasStep checks if Step has been set in PatternFlowRsvpReservedCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRsvpReservedCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRsvpReservedCounter - SetCount(value uint32) PatternFlowRsvpReservedCounter - // HasCount checks if Count has been set in PatternFlowRsvpReservedCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRsvpReservedCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRsvpReservedCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRsvpReservedCounter object -func (obj *patternFlowRsvpReservedCounter) SetStart(value uint32) PatternFlowRsvpReservedCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRsvpReservedCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRsvpReservedCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRsvpReservedCounter object -func (obj *patternFlowRsvpReservedCounter) SetStep(value uint32) PatternFlowRsvpReservedCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRsvpReservedCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRsvpReservedCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRsvpReservedCounter object -func (obj *patternFlowRsvpReservedCounter) SetCount(value uint32) PatternFlowRsvpReservedCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRsvpReservedCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRsvpReservedCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRsvpReservedCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRsvpReservedCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRsvpReservedCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** FlowRSVPPathMessage ***** -type flowRSVPPathMessage struct { - validation - obj *otg.FlowRSVPPathMessage - marshaller marshalFlowRSVPPathMessage - unMarshaller unMarshalFlowRSVPPathMessage - objectsHolder FlowRSVPPathMessageFlowRSVPPathObjectsIter -} - -func NewFlowRSVPPathMessage() FlowRSVPPathMessage { - obj := flowRSVPPathMessage{obj: &otg.FlowRSVPPathMessage{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathMessage) msg() *otg.FlowRSVPPathMessage { - return obj.obj -} - -func (obj *flowRSVPPathMessage) setMsg(msg *otg.FlowRSVPPathMessage) FlowRSVPPathMessage { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathMessage struct { - obj *flowRSVPPathMessage -} - -type marshalFlowRSVPPathMessage interface { - // ToProto marshals FlowRSVPPathMessage to protobuf object *otg.FlowRSVPPathMessage - ToProto() (*otg.FlowRSVPPathMessage, error) - // ToPbText marshals FlowRSVPPathMessage to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathMessage to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathMessage to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathMessage struct { - obj *flowRSVPPathMessage -} - -type unMarshalFlowRSVPPathMessage interface { - // FromProto unmarshals FlowRSVPPathMessage from protobuf object *otg.FlowRSVPPathMessage - FromProto(msg *otg.FlowRSVPPathMessage) (FlowRSVPPathMessage, error) - // FromPbText unmarshals FlowRSVPPathMessage from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathMessage from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathMessage from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathMessage) Marshal() marshalFlowRSVPPathMessage { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathMessage{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathMessage) Unmarshal() unMarshalFlowRSVPPathMessage { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathMessage{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathMessage) ToProto() (*otg.FlowRSVPPathMessage, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathMessage) FromProto(msg *otg.FlowRSVPPathMessage) (FlowRSVPPathMessage, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathMessage) 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 *unMarshalflowRSVPPathMessage) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathMessage) 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 *unMarshalflowRSVPPathMessage) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathMessage) 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 *unMarshalflowRSVPPathMessage) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathMessage) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathMessage) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathMessage) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathMessage) Clone() (FlowRSVPPathMessage, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathMessage() - 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 -} - -func (obj *flowRSVPPathMessage) setNil() { - obj.objectsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathMessage is "Path" message requires the following list of objects in order as defined in https://www.rfc-editor.org/rfc/rfc3209.html#page-15: 1. SESSION 2. RSVP_HOP 3. TIME_VALUES 4. EXPLICIT_ROUTE [optional] 5. LABEL_REQUEST 6. SESSION_ATTRIBUTE [optional] 7. SENDER_TEMPLATE 8. SENDER_TSPEC 9. RECORD_ROUTE [optional] -type FlowRSVPPathMessage interface { - Validation - // msg marshals FlowRSVPPathMessage to protobuf object *otg.FlowRSVPPathMessage - // and doesn't set defaults - msg() *otg.FlowRSVPPathMessage - // setMsg unmarshals FlowRSVPPathMessage from protobuf object *otg.FlowRSVPPathMessage - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathMessage) FlowRSVPPathMessage - // provides marshal interface - Marshal() marshalFlowRSVPPathMessage - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathMessage - // validate validates FlowRSVPPathMessage - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathMessage, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Objects returns FlowRSVPPathMessageFlowRSVPPathObjectsIterIter, set in FlowRSVPPathMessage - Objects() FlowRSVPPathMessageFlowRSVPPathObjectsIter - setNil() -} - -// "Path" message requires atleast SESSION, RSVP_HOP, TIME_VALUES, LABEL_REQUEST, SENDER_TEMPLATE and SENDER_TSPEC objects in order. -// Objects returns a []FlowRSVPPathObjects -func (obj *flowRSVPPathMessage) Objects() FlowRSVPPathMessageFlowRSVPPathObjectsIter { - if len(obj.obj.Objects) == 0 { - obj.obj.Objects = []*otg.FlowRSVPPathObjects{} - } - if obj.objectsHolder == nil { - obj.objectsHolder = newFlowRSVPPathMessageFlowRSVPPathObjectsIter(&obj.obj.Objects).setMsg(obj) - } - return obj.objectsHolder -} - -type flowRSVPPathMessageFlowRSVPPathObjectsIter struct { - obj *flowRSVPPathMessage - flowRSVPPathObjectsSlice []FlowRSVPPathObjects - fieldPtr *[]*otg.FlowRSVPPathObjects -} - -func newFlowRSVPPathMessageFlowRSVPPathObjectsIter(ptr *[]*otg.FlowRSVPPathObjects) FlowRSVPPathMessageFlowRSVPPathObjectsIter { - return &flowRSVPPathMessageFlowRSVPPathObjectsIter{fieldPtr: ptr} -} - -type FlowRSVPPathMessageFlowRSVPPathObjectsIter interface { - setMsg(*flowRSVPPathMessage) FlowRSVPPathMessageFlowRSVPPathObjectsIter - Items() []FlowRSVPPathObjects - Add() FlowRSVPPathObjects - Append(items ...FlowRSVPPathObjects) FlowRSVPPathMessageFlowRSVPPathObjectsIter - Set(index int, newObj FlowRSVPPathObjects) FlowRSVPPathMessageFlowRSVPPathObjectsIter - Clear() FlowRSVPPathMessageFlowRSVPPathObjectsIter - clearHolderSlice() FlowRSVPPathMessageFlowRSVPPathObjectsIter - appendHolderSlice(item FlowRSVPPathObjects) FlowRSVPPathMessageFlowRSVPPathObjectsIter -} - -func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) setMsg(msg *flowRSVPPathMessage) FlowRSVPPathMessageFlowRSVPPathObjectsIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flowRSVPPathObjects{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) Items() []FlowRSVPPathObjects { - return obj.flowRSVPPathObjectsSlice -} - -func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) Add() FlowRSVPPathObjects { - newObj := &otg.FlowRSVPPathObjects{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flowRSVPPathObjects{obj: newObj} - newLibObj.setDefault() - obj.flowRSVPPathObjectsSlice = append(obj.flowRSVPPathObjectsSlice, newLibObj) - return newLibObj -} - -func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) Append(items ...FlowRSVPPathObjects) FlowRSVPPathMessageFlowRSVPPathObjectsIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowRSVPPathObjectsSlice = append(obj.flowRSVPPathObjectsSlice, item) - } - return obj -} - -func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) Set(index int, newObj FlowRSVPPathObjects) FlowRSVPPathMessageFlowRSVPPathObjectsIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowRSVPPathObjectsSlice[index] = newObj - return obj -} -func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) Clear() FlowRSVPPathMessageFlowRSVPPathObjectsIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.FlowRSVPPathObjects{} - obj.flowRSVPPathObjectsSlice = []FlowRSVPPathObjects{} - } - return obj -} -func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) clearHolderSlice() FlowRSVPPathMessageFlowRSVPPathObjectsIter { - if len(obj.flowRSVPPathObjectsSlice) > 0 { - obj.flowRSVPPathObjectsSlice = []FlowRSVPPathObjects{} - } - return obj -} -func (obj *flowRSVPPathMessageFlowRSVPPathObjectsIter) appendHolderSlice(item FlowRSVPPathObjects) FlowRSVPPathMessageFlowRSVPPathObjectsIter { - obj.flowRSVPPathObjectsSlice = append(obj.flowRSVPPathObjectsSlice, item) - return obj -} - -func (obj *flowRSVPPathMessage) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Objects) != 0 { - - if set_default { - obj.Objects().clearHolderSlice() - for _, item := range obj.obj.Objects { - obj.Objects().appendHolderSlice(&flowRSVPPathObjects{obj: item}) - } - } - for _, item := range obj.Objects().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *flowRSVPPathMessage) setDefault() { - -} - -// ***** ActionResponseProtocolIpv4Ping ***** -type actionResponseProtocolIpv4Ping struct { - validation - obj *otg.ActionResponseProtocolIpv4Ping - marshaller marshalActionResponseProtocolIpv4Ping - unMarshaller unMarshalActionResponseProtocolIpv4Ping - responsesHolder ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter -} - -func NewActionResponseProtocolIpv4Ping() ActionResponseProtocolIpv4Ping { - obj := actionResponseProtocolIpv4Ping{obj: &otg.ActionResponseProtocolIpv4Ping{}} - obj.setDefault() - return &obj -} - -func (obj *actionResponseProtocolIpv4Ping) msg() *otg.ActionResponseProtocolIpv4Ping { - return obj.obj -} - -func (obj *actionResponseProtocolIpv4Ping) setMsg(msg *otg.ActionResponseProtocolIpv4Ping) ActionResponseProtocolIpv4Ping { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionResponseProtocolIpv4Ping struct { - obj *actionResponseProtocolIpv4Ping -} - -type marshalActionResponseProtocolIpv4Ping interface { - // ToProto marshals ActionResponseProtocolIpv4Ping to protobuf object *otg.ActionResponseProtocolIpv4Ping - ToProto() (*otg.ActionResponseProtocolIpv4Ping, error) - // ToPbText marshals ActionResponseProtocolIpv4Ping to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionResponseProtocolIpv4Ping to YAML text - ToYaml() (string, error) - // ToJson marshals ActionResponseProtocolIpv4Ping to JSON text - ToJson() (string, error) -} - -type unMarshalactionResponseProtocolIpv4Ping struct { - obj *actionResponseProtocolIpv4Ping -} - -type unMarshalActionResponseProtocolIpv4Ping interface { - // FromProto unmarshals ActionResponseProtocolIpv4Ping from protobuf object *otg.ActionResponseProtocolIpv4Ping - FromProto(msg *otg.ActionResponseProtocolIpv4Ping) (ActionResponseProtocolIpv4Ping, error) - // FromPbText unmarshals ActionResponseProtocolIpv4Ping from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionResponseProtocolIpv4Ping from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionResponseProtocolIpv4Ping from JSON text - FromJson(value string) error -} - -func (obj *actionResponseProtocolIpv4Ping) Marshal() marshalActionResponseProtocolIpv4Ping { - if obj.marshaller == nil { - obj.marshaller = &marshalactionResponseProtocolIpv4Ping{obj: obj} - } - return obj.marshaller -} - -func (obj *actionResponseProtocolIpv4Ping) Unmarshal() unMarshalActionResponseProtocolIpv4Ping { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionResponseProtocolIpv4Ping{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionResponseProtocolIpv4Ping) ToProto() (*otg.ActionResponseProtocolIpv4Ping, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionResponseProtocolIpv4Ping) FromProto(msg *otg.ActionResponseProtocolIpv4Ping) (ActionResponseProtocolIpv4Ping, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionResponseProtocolIpv4Ping) 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 *unMarshalactionResponseProtocolIpv4Ping) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalactionResponseProtocolIpv4Ping) 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 *unMarshalactionResponseProtocolIpv4Ping) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalactionResponseProtocolIpv4Ping) 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 *unMarshalactionResponseProtocolIpv4Ping) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *actionResponseProtocolIpv4Ping) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionResponseProtocolIpv4Ping) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionResponseProtocolIpv4Ping) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionResponseProtocolIpv4Ping) Clone() (ActionResponseProtocolIpv4Ping, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionResponseProtocolIpv4Ping() - 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 -} - -func (obj *actionResponseProtocolIpv4Ping) setNil() { - obj.responsesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ActionResponseProtocolIpv4Ping is response for ping initiated between multiple source and destination pairs. -type ActionResponseProtocolIpv4Ping interface { - Validation - // msg marshals ActionResponseProtocolIpv4Ping to protobuf object *otg.ActionResponseProtocolIpv4Ping - // and doesn't set defaults - msg() *otg.ActionResponseProtocolIpv4Ping - // setMsg unmarshals ActionResponseProtocolIpv4Ping from protobuf object *otg.ActionResponseProtocolIpv4Ping - // and doesn't set defaults - setMsg(*otg.ActionResponseProtocolIpv4Ping) ActionResponseProtocolIpv4Ping - // provides marshal interface - Marshal() marshalActionResponseProtocolIpv4Ping - // provides unmarshal interface - Unmarshal() unMarshalActionResponseProtocolIpv4Ping - // validate validates ActionResponseProtocolIpv4Ping - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionResponseProtocolIpv4Ping, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Responses returns ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIterIter, set in ActionResponseProtocolIpv4Ping - Responses() ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter - setNil() -} - -// List of responses for IPv4 ping responses. -// Responses returns a []ActionResponseProtocolIpv4PingResponse -func (obj *actionResponseProtocolIpv4Ping) Responses() ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { - if len(obj.obj.Responses) == 0 { - obj.obj.Responses = []*otg.ActionResponseProtocolIpv4PingResponse{} - } - if obj.responsesHolder == nil { - obj.responsesHolder = newActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter(&obj.obj.Responses).setMsg(obj) - } - return obj.responsesHolder -} - -type actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter struct { - obj *actionResponseProtocolIpv4Ping - actionResponseProtocolIpv4PingResponseSlice []ActionResponseProtocolIpv4PingResponse - fieldPtr *[]*otg.ActionResponseProtocolIpv4PingResponse -} - -func newActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter(ptr *[]*otg.ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { - return &actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter{fieldPtr: ptr} -} - -type ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter interface { - setMsg(*actionResponseProtocolIpv4Ping) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter - Items() []ActionResponseProtocolIpv4PingResponse - Add() ActionResponseProtocolIpv4PingResponse - Append(items ...ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter - Set(index int, newObj ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter - Clear() ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter - clearHolderSlice() ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter - appendHolderSlice(item ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter -} - -func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) setMsg(msg *actionResponseProtocolIpv4Ping) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&actionResponseProtocolIpv4PingResponse{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) Items() []ActionResponseProtocolIpv4PingResponse { - return obj.actionResponseProtocolIpv4PingResponseSlice -} - -func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) Add() ActionResponseProtocolIpv4PingResponse { - newObj := &otg.ActionResponseProtocolIpv4PingResponse{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &actionResponseProtocolIpv4PingResponse{obj: newObj} - newLibObj.setDefault() - obj.actionResponseProtocolIpv4PingResponseSlice = append(obj.actionResponseProtocolIpv4PingResponseSlice, newLibObj) - return newLibObj -} - -func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) Append(items ...ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.actionResponseProtocolIpv4PingResponseSlice = append(obj.actionResponseProtocolIpv4PingResponseSlice, item) - } - return obj -} - -func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) Set(index int, newObj ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.actionResponseProtocolIpv4PingResponseSlice[index] = newObj - return obj -} -func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) Clear() ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.ActionResponseProtocolIpv4PingResponse{} - obj.actionResponseProtocolIpv4PingResponseSlice = []ActionResponseProtocolIpv4PingResponse{} - } - return obj -} -func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) clearHolderSlice() ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { - if len(obj.actionResponseProtocolIpv4PingResponseSlice) > 0 { - obj.actionResponseProtocolIpv4PingResponseSlice = []ActionResponseProtocolIpv4PingResponse{} - } - return obj -} -func (obj *actionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter) appendHolderSlice(item ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingActionResponseProtocolIpv4PingResponseIter { - obj.actionResponseProtocolIpv4PingResponseSlice = append(obj.actionResponseProtocolIpv4PingResponseSlice, item) - return obj -} - -func (obj *actionResponseProtocolIpv4Ping) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Responses) != 0 { - - if set_default { - obj.Responses().clearHolderSlice() - for _, item := range obj.obj.Responses { - obj.Responses().appendHolderSlice(&actionResponseProtocolIpv4PingResponse{obj: item}) - } - } - for _, item := range obj.Responses().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *actionResponseProtocolIpv4Ping) setDefault() { - -} - -// ***** ActionResponseProtocolIpv6Ping ***** -type actionResponseProtocolIpv6Ping struct { - validation - obj *otg.ActionResponseProtocolIpv6Ping - marshaller marshalActionResponseProtocolIpv6Ping - unMarshaller unMarshalActionResponseProtocolIpv6Ping - responsesHolder ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter -} - -func NewActionResponseProtocolIpv6Ping() ActionResponseProtocolIpv6Ping { - obj := actionResponseProtocolIpv6Ping{obj: &otg.ActionResponseProtocolIpv6Ping{}} - obj.setDefault() - return &obj -} - -func (obj *actionResponseProtocolIpv6Ping) msg() *otg.ActionResponseProtocolIpv6Ping { - return obj.obj -} - -func (obj *actionResponseProtocolIpv6Ping) setMsg(msg *otg.ActionResponseProtocolIpv6Ping) ActionResponseProtocolIpv6Ping { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionResponseProtocolIpv6Ping struct { - obj *actionResponseProtocolIpv6Ping -} - -type marshalActionResponseProtocolIpv6Ping interface { - // ToProto marshals ActionResponseProtocolIpv6Ping to protobuf object *otg.ActionResponseProtocolIpv6Ping - ToProto() (*otg.ActionResponseProtocolIpv6Ping, error) - // ToPbText marshals ActionResponseProtocolIpv6Ping to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionResponseProtocolIpv6Ping to YAML text - ToYaml() (string, error) - // ToJson marshals ActionResponseProtocolIpv6Ping to JSON text - ToJson() (string, error) -} - -type unMarshalactionResponseProtocolIpv6Ping struct { - obj *actionResponseProtocolIpv6Ping -} - -type unMarshalActionResponseProtocolIpv6Ping interface { - // FromProto unmarshals ActionResponseProtocolIpv6Ping from protobuf object *otg.ActionResponseProtocolIpv6Ping - FromProto(msg *otg.ActionResponseProtocolIpv6Ping) (ActionResponseProtocolIpv6Ping, error) - // FromPbText unmarshals ActionResponseProtocolIpv6Ping from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionResponseProtocolIpv6Ping from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionResponseProtocolIpv6Ping from JSON text - FromJson(value string) error -} - -func (obj *actionResponseProtocolIpv6Ping) Marshal() marshalActionResponseProtocolIpv6Ping { - if obj.marshaller == nil { - obj.marshaller = &marshalactionResponseProtocolIpv6Ping{obj: obj} - } - return obj.marshaller -} - -func (obj *actionResponseProtocolIpv6Ping) Unmarshal() unMarshalActionResponseProtocolIpv6Ping { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionResponseProtocolIpv6Ping{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionResponseProtocolIpv6Ping) ToProto() (*otg.ActionResponseProtocolIpv6Ping, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionResponseProtocolIpv6Ping) FromProto(msg *otg.ActionResponseProtocolIpv6Ping) (ActionResponseProtocolIpv6Ping, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionResponseProtocolIpv6Ping) 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 *unMarshalactionResponseProtocolIpv6Ping) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalactionResponseProtocolIpv6Ping) 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 *unMarshalactionResponseProtocolIpv6Ping) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalactionResponseProtocolIpv6Ping) 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 *unMarshalactionResponseProtocolIpv6Ping) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *actionResponseProtocolIpv6Ping) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionResponseProtocolIpv6Ping) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionResponseProtocolIpv6Ping) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionResponseProtocolIpv6Ping) Clone() (ActionResponseProtocolIpv6Ping, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionResponseProtocolIpv6Ping() - 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 -} - -func (obj *actionResponseProtocolIpv6Ping) setNil() { - obj.responsesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ActionResponseProtocolIpv6Ping is response for ping initiated between multiple source and destination pairs. -type ActionResponseProtocolIpv6Ping interface { - Validation - // msg marshals ActionResponseProtocolIpv6Ping to protobuf object *otg.ActionResponseProtocolIpv6Ping - // and doesn't set defaults - msg() *otg.ActionResponseProtocolIpv6Ping - // setMsg unmarshals ActionResponseProtocolIpv6Ping from protobuf object *otg.ActionResponseProtocolIpv6Ping - // and doesn't set defaults - setMsg(*otg.ActionResponseProtocolIpv6Ping) ActionResponseProtocolIpv6Ping - // provides marshal interface - Marshal() marshalActionResponseProtocolIpv6Ping - // provides unmarshal interface - Unmarshal() unMarshalActionResponseProtocolIpv6Ping - // validate validates ActionResponseProtocolIpv6Ping - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionResponseProtocolIpv6Ping, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Responses returns ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIterIter, set in ActionResponseProtocolIpv6Ping - Responses() ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter - setNil() -} - -// List of responses for IPv6 ping responses. -// Responses returns a []ActionResponseProtocolIpv6PingResponse -func (obj *actionResponseProtocolIpv6Ping) Responses() ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { - if len(obj.obj.Responses) == 0 { - obj.obj.Responses = []*otg.ActionResponseProtocolIpv6PingResponse{} - } - if obj.responsesHolder == nil { - obj.responsesHolder = newActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter(&obj.obj.Responses).setMsg(obj) - } - return obj.responsesHolder -} - -type actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter struct { - obj *actionResponseProtocolIpv6Ping - actionResponseProtocolIpv6PingResponseSlice []ActionResponseProtocolIpv6PingResponse - fieldPtr *[]*otg.ActionResponseProtocolIpv6PingResponse -} - -func newActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter(ptr *[]*otg.ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { - return &actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter{fieldPtr: ptr} -} - -type ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter interface { - setMsg(*actionResponseProtocolIpv6Ping) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter - Items() []ActionResponseProtocolIpv6PingResponse - Add() ActionResponseProtocolIpv6PingResponse - Append(items ...ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter - Set(index int, newObj ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter - Clear() ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter - clearHolderSlice() ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter - appendHolderSlice(item ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter -} - -func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) setMsg(msg *actionResponseProtocolIpv6Ping) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&actionResponseProtocolIpv6PingResponse{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) Items() []ActionResponseProtocolIpv6PingResponse { - return obj.actionResponseProtocolIpv6PingResponseSlice -} - -func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) Add() ActionResponseProtocolIpv6PingResponse { - newObj := &otg.ActionResponseProtocolIpv6PingResponse{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &actionResponseProtocolIpv6PingResponse{obj: newObj} - newLibObj.setDefault() - obj.actionResponseProtocolIpv6PingResponseSlice = append(obj.actionResponseProtocolIpv6PingResponseSlice, newLibObj) - return newLibObj -} - -func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) Append(items ...ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.actionResponseProtocolIpv6PingResponseSlice = append(obj.actionResponseProtocolIpv6PingResponseSlice, item) - } - return obj -} - -func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) Set(index int, newObj ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.actionResponseProtocolIpv6PingResponseSlice[index] = newObj - return obj -} -func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) Clear() ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.ActionResponseProtocolIpv6PingResponse{} - obj.actionResponseProtocolIpv6PingResponseSlice = []ActionResponseProtocolIpv6PingResponse{} - } - return obj -} -func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) clearHolderSlice() ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { - if len(obj.actionResponseProtocolIpv6PingResponseSlice) > 0 { - obj.actionResponseProtocolIpv6PingResponseSlice = []ActionResponseProtocolIpv6PingResponse{} - } - return obj -} -func (obj *actionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter) appendHolderSlice(item ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingActionResponseProtocolIpv6PingResponseIter { - obj.actionResponseProtocolIpv6PingResponseSlice = append(obj.actionResponseProtocolIpv6PingResponseSlice, item) - return obj -} - -func (obj *actionResponseProtocolIpv6Ping) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Responses) != 0 { - - if set_default { - obj.Responses().clearHolderSlice() - for _, item := range obj.obj.Responses { - obj.Responses().appendHolderSlice(&actionResponseProtocolIpv6PingResponse{obj: item}) - } - } - for _, item := range obj.Responses().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *actionResponseProtocolIpv6Ping) setDefault() { - -} - -// ***** FlowMetricTagValue ***** -type flowMetricTagValue struct { - validation - obj *otg.FlowMetricTagValue - marshaller marshalFlowMetricTagValue - unMarshaller unMarshalFlowMetricTagValue -} - -func NewFlowMetricTagValue() FlowMetricTagValue { - obj := flowMetricTagValue{obj: &otg.FlowMetricTagValue{}} - obj.setDefault() - return &obj -} - -func (obj *flowMetricTagValue) msg() *otg.FlowMetricTagValue { - return obj.obj -} - -func (obj *flowMetricTagValue) setMsg(msg *otg.FlowMetricTagValue) FlowMetricTagValue { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowMetricTagValue struct { - obj *flowMetricTagValue -} - -type marshalFlowMetricTagValue interface { - // ToProto marshals FlowMetricTagValue to protobuf object *otg.FlowMetricTagValue - ToProto() (*otg.FlowMetricTagValue, error) - // ToPbText marshals FlowMetricTagValue to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowMetricTagValue to YAML text - ToYaml() (string, error) - // ToJson marshals FlowMetricTagValue to JSON text - ToJson() (string, error) -} - -type unMarshalflowMetricTagValue struct { - obj *flowMetricTagValue -} - -type unMarshalFlowMetricTagValue interface { - // FromProto unmarshals FlowMetricTagValue from protobuf object *otg.FlowMetricTagValue - FromProto(msg *otg.FlowMetricTagValue) (FlowMetricTagValue, error) - // FromPbText unmarshals FlowMetricTagValue from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowMetricTagValue from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowMetricTagValue from JSON text - FromJson(value string) error -} - -func (obj *flowMetricTagValue) Marshal() marshalFlowMetricTagValue { - if obj.marshaller == nil { - obj.marshaller = &marshalflowMetricTagValue{obj: obj} - } - return obj.marshaller -} - -func (obj *flowMetricTagValue) Unmarshal() unMarshalFlowMetricTagValue { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowMetricTagValue{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowMetricTagValue) ToProto() (*otg.FlowMetricTagValue, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowMetricTagValue) FromProto(msg *otg.FlowMetricTagValue) (FlowMetricTagValue, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowMetricTagValue) 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 *unMarshalflowMetricTagValue) 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 *marshalflowMetricTagValue) 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 *unMarshalflowMetricTagValue) 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 *marshalflowMetricTagValue) 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 *unMarshalflowMetricTagValue) 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 *flowMetricTagValue) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowMetricTagValue) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowMetricTagValue) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowMetricTagValue) Clone() (FlowMetricTagValue, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowMetricTagValue() - 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 -} - -// FlowMetricTagValue is a container for metric tag value -type FlowMetricTagValue interface { - Validation - // msg marshals FlowMetricTagValue to protobuf object *otg.FlowMetricTagValue - // and doesn't set defaults - msg() *otg.FlowMetricTagValue - // setMsg unmarshals FlowMetricTagValue from protobuf object *otg.FlowMetricTagValue - // and doesn't set defaults - setMsg(*otg.FlowMetricTagValue) FlowMetricTagValue - // provides marshal interface - Marshal() marshalFlowMetricTagValue - // provides unmarshal interface - Unmarshal() unMarshalFlowMetricTagValue - // validate validates FlowMetricTagValue - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowMetricTagValue, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowMetricTagValueChoiceEnum, set in FlowMetricTagValue - Choice() FlowMetricTagValueChoiceEnum - // setChoice assigns FlowMetricTagValueChoiceEnum provided by user to FlowMetricTagValue - setChoice(value FlowMetricTagValueChoiceEnum) FlowMetricTagValue - // HasChoice checks if Choice has been set in FlowMetricTagValue - HasChoice() bool - // Hex returns string, set in FlowMetricTagValue. - Hex() string - // SetHex assigns string provided by user to FlowMetricTagValue - SetHex(value string) FlowMetricTagValue - // HasHex checks if Hex has been set in FlowMetricTagValue - HasHex() bool - // Str returns string, set in FlowMetricTagValue. - Str() string - // SetStr assigns string provided by user to FlowMetricTagValue - SetStr(value string) FlowMetricTagValue - // HasStr checks if Str has been set in FlowMetricTagValue - HasStr() bool -} - -type FlowMetricTagValueChoiceEnum string - -// Enum of Choice on FlowMetricTagValue -var FlowMetricTagValueChoice = struct { - HEX FlowMetricTagValueChoiceEnum - STR FlowMetricTagValueChoiceEnum -}{ - HEX: FlowMetricTagValueChoiceEnum("hex"), - STR: FlowMetricTagValueChoiceEnum("str"), -} - -func (obj *flowMetricTagValue) Choice() FlowMetricTagValueChoiceEnum { - return FlowMetricTagValueChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// Available formats for metric tag value -// Choice returns a string -func (obj *flowMetricTagValue) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowMetricTagValue) setChoice(value FlowMetricTagValueChoiceEnum) FlowMetricTagValue { - intValue, ok := otg.FlowMetricTagValue_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowMetricTagValueChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowMetricTagValue_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Str = nil - obj.obj.Hex = nil - return obj -} - -// Value represented in hexadecimal format -// Hex returns a string -func (obj *flowMetricTagValue) Hex() string { - - if obj.obj.Hex == nil { - obj.setChoice(FlowMetricTagValueChoice.HEX) - } - - return *obj.obj.Hex - -} - -// Value represented in hexadecimal format -// Hex returns a string -func (obj *flowMetricTagValue) HasHex() bool { - return obj.obj.Hex != nil -} - -// Value represented in hexadecimal format -// SetHex sets the string value in the FlowMetricTagValue object -func (obj *flowMetricTagValue) SetHex(value string) FlowMetricTagValue { - obj.setChoice(FlowMetricTagValueChoice.HEX) - obj.obj.Hex = &value - return obj -} - -// Value represented in string format -// Str returns a string -func (obj *flowMetricTagValue) Str() string { - - if obj.obj.Str == nil { - obj.setChoice(FlowMetricTagValueChoice.STR) - } - - return *obj.obj.Str - -} - -// Value represented in string format -// Str returns a string -func (obj *flowMetricTagValue) HasStr() bool { - return obj.obj.Str != nil -} - -// Value represented in string format -// SetStr sets the string value in the FlowMetricTagValue object -func (obj *flowMetricTagValue) SetStr(value string) FlowMetricTagValue { - obj.setChoice(FlowMetricTagValueChoice.STR) - obj.obj.Str = &value - return obj -} - -func (obj *flowMetricTagValue) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Hex != nil { - - err := obj.validateHex(obj.Hex()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on FlowMetricTagValue.Hex")) - } - - } - -} - -func (obj *flowMetricTagValue) setDefault() { - var choices_set int = 0 - var choice FlowMetricTagValueChoiceEnum - - if obj.obj.Hex != nil { - choices_set += 1 - choice = FlowMetricTagValueChoice.HEX - } - - if obj.obj.Str != nil { - choices_set += 1 - choice = FlowMetricTagValueChoice.STR - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowMetricTagValueChoice.HEX) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowMetricTagValue") - } - } else { - intVal := otg.FlowMetricTagValue_Choice_Enum_value[string(choice)] - enumValue := otg.FlowMetricTagValue_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** ResultExtendedCommunityStructured ***** -type resultExtendedCommunityStructured struct { - validation - obj *otg.ResultExtendedCommunityStructured - marshaller marshalResultExtendedCommunityStructured - unMarshaller unMarshalResultExtendedCommunityStructured - transitive_2OctetAsTypeHolder ResultExtendedCommunityTransitive2OctetAsType - transitiveIpv4AddressTypeHolder ResultExtendedCommunityTransitiveIpv4AddressType - transitive_4OctetAsTypeHolder ResultExtendedCommunityTransitive4OctetAsType - transitiveOpaqueTypeHolder ResultExtendedCommunityTransitiveOpaqueType - nonTransitive_2OctetAsTypeHolder ResultExtendedCommunityNonTransitive2OctetAsType -} - -func NewResultExtendedCommunityStructured() ResultExtendedCommunityStructured { - obj := resultExtendedCommunityStructured{obj: &otg.ResultExtendedCommunityStructured{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityStructured) msg() *otg.ResultExtendedCommunityStructured { - return obj.obj -} - -func (obj *resultExtendedCommunityStructured) setMsg(msg *otg.ResultExtendedCommunityStructured) ResultExtendedCommunityStructured { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityStructured struct { - obj *resultExtendedCommunityStructured -} - -type marshalResultExtendedCommunityStructured interface { - // ToProto marshals ResultExtendedCommunityStructured to protobuf object *otg.ResultExtendedCommunityStructured - ToProto() (*otg.ResultExtendedCommunityStructured, error) - // ToPbText marshals ResultExtendedCommunityStructured to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityStructured to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityStructured to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityStructured struct { - obj *resultExtendedCommunityStructured -} - -type unMarshalResultExtendedCommunityStructured interface { - // FromProto unmarshals ResultExtendedCommunityStructured from protobuf object *otg.ResultExtendedCommunityStructured - FromProto(msg *otg.ResultExtendedCommunityStructured) (ResultExtendedCommunityStructured, error) - // FromPbText unmarshals ResultExtendedCommunityStructured from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityStructured from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityStructured from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityStructured) Marshal() marshalResultExtendedCommunityStructured { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityStructured{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityStructured) Unmarshal() unMarshalResultExtendedCommunityStructured { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityStructured{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityStructured) ToProto() (*otg.ResultExtendedCommunityStructured, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityStructured) FromProto(msg *otg.ResultExtendedCommunityStructured) (ResultExtendedCommunityStructured, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityStructured) 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 *unMarshalresultExtendedCommunityStructured) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalresultExtendedCommunityStructured) 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 *unMarshalresultExtendedCommunityStructured) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalresultExtendedCommunityStructured) 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 *unMarshalresultExtendedCommunityStructured) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *resultExtendedCommunityStructured) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityStructured) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityStructured) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityStructured) Clone() (ResultExtendedCommunityStructured, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityStructured() - 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 -} - -func (obj *resultExtendedCommunityStructured) setNil() { - obj.transitive_2OctetAsTypeHolder = nil - obj.transitiveIpv4AddressTypeHolder = nil - obj.transitive_4OctetAsTypeHolder = nil - obj.transitiveOpaqueTypeHolder = nil - obj.nonTransitive_2OctetAsTypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ResultExtendedCommunityStructured is the Extended Communities Attribute is a optional BGP attribute,defined in RFC4360 with the Type Code 16. -// Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. -// An extended community is an 8-bytes value. It is divided into two main parts. The first 2 bytes of the community encode a type and optonal sub-type field. -// The last 6 bytes (or 7 bytes for types without a sub-type) carry a unique set of data in a format defined by the type and optional sub-type field. -// Extended communities provide a larger range for grouping or categorizing communities. -type ResultExtendedCommunityStructured interface { - Validation - // msg marshals ResultExtendedCommunityStructured to protobuf object *otg.ResultExtendedCommunityStructured - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityStructured - // setMsg unmarshals ResultExtendedCommunityStructured from protobuf object *otg.ResultExtendedCommunityStructured - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityStructured) ResultExtendedCommunityStructured - // provides marshal interface - Marshal() marshalResultExtendedCommunityStructured - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityStructured - // validate validates ResultExtendedCommunityStructured - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityStructured, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ResultExtendedCommunityStructuredChoiceEnum, set in ResultExtendedCommunityStructured - Choice() ResultExtendedCommunityStructuredChoiceEnum - // setChoice assigns ResultExtendedCommunityStructuredChoiceEnum provided by user to ResultExtendedCommunityStructured - setChoice(value ResultExtendedCommunityStructuredChoiceEnum) ResultExtendedCommunityStructured - // HasChoice checks if Choice has been set in ResultExtendedCommunityStructured - HasChoice() bool - // Transitive2OctetAsType returns ResultExtendedCommunityTransitive2OctetAsType, set in ResultExtendedCommunityStructured. - // ResultExtendedCommunityTransitive2OctetAsType is the Transitive Two-Octet AS-Specific Extended Community is sent as type 0x00 . - Transitive2OctetAsType() ResultExtendedCommunityTransitive2OctetAsType - // SetTransitive2OctetAsType assigns ResultExtendedCommunityTransitive2OctetAsType provided by user to ResultExtendedCommunityStructured. - // ResultExtendedCommunityTransitive2OctetAsType is the Transitive Two-Octet AS-Specific Extended Community is sent as type 0x00 . - SetTransitive2OctetAsType(value ResultExtendedCommunityTransitive2OctetAsType) ResultExtendedCommunityStructured - // HasTransitive2OctetAsType checks if Transitive2OctetAsType has been set in ResultExtendedCommunityStructured - HasTransitive2OctetAsType() bool - // TransitiveIpv4AddressType returns ResultExtendedCommunityTransitiveIpv4AddressType, set in ResultExtendedCommunityStructured. - // ResultExtendedCommunityTransitiveIpv4AddressType is the Transitive IPv4 Address Specific Extended Community is sent as type 0x01. - TransitiveIpv4AddressType() ResultExtendedCommunityTransitiveIpv4AddressType - // SetTransitiveIpv4AddressType assigns ResultExtendedCommunityTransitiveIpv4AddressType provided by user to ResultExtendedCommunityStructured. - // ResultExtendedCommunityTransitiveIpv4AddressType is the Transitive IPv4 Address Specific Extended Community is sent as type 0x01. - SetTransitiveIpv4AddressType(value ResultExtendedCommunityTransitiveIpv4AddressType) ResultExtendedCommunityStructured - // HasTransitiveIpv4AddressType checks if TransitiveIpv4AddressType has been set in ResultExtendedCommunityStructured - HasTransitiveIpv4AddressType() bool - // Transitive4OctetAsType returns ResultExtendedCommunityTransitive4OctetAsType, set in ResultExtendedCommunityStructured. - // ResultExtendedCommunityTransitive4OctetAsType is the Transitive Four-Octet AS-Specific Extended Community is sent as type 0x02. It is defined in RFC 5668. - Transitive4OctetAsType() ResultExtendedCommunityTransitive4OctetAsType - // SetTransitive4OctetAsType assigns ResultExtendedCommunityTransitive4OctetAsType provided by user to ResultExtendedCommunityStructured. - // ResultExtendedCommunityTransitive4OctetAsType is the Transitive Four-Octet AS-Specific Extended Community is sent as type 0x02. It is defined in RFC 5668. - SetTransitive4OctetAsType(value ResultExtendedCommunityTransitive4OctetAsType) ResultExtendedCommunityStructured - // HasTransitive4OctetAsType checks if Transitive4OctetAsType has been set in ResultExtendedCommunityStructured - HasTransitive4OctetAsType() bool - // TransitiveOpaqueType returns ResultExtendedCommunityTransitiveOpaqueType, set in ResultExtendedCommunityStructured. - // ResultExtendedCommunityTransitiveOpaqueType is the Transitive Opaque Extended Community is sent as type 0x03. - TransitiveOpaqueType() ResultExtendedCommunityTransitiveOpaqueType - // SetTransitiveOpaqueType assigns ResultExtendedCommunityTransitiveOpaqueType provided by user to ResultExtendedCommunityStructured. - // ResultExtendedCommunityTransitiveOpaqueType is the Transitive Opaque Extended Community is sent as type 0x03. - SetTransitiveOpaqueType(value ResultExtendedCommunityTransitiveOpaqueType) ResultExtendedCommunityStructured - // HasTransitiveOpaqueType checks if TransitiveOpaqueType has been set in ResultExtendedCommunityStructured - HasTransitiveOpaqueType() bool - // NonTransitive2OctetAsType returns ResultExtendedCommunityNonTransitive2OctetAsType, set in ResultExtendedCommunityStructured. - // ResultExtendedCommunityNonTransitive2OctetAsType is the Non-Transitive Two-Octet AS-Specific Extended Community is sent as type 0x40. - NonTransitive2OctetAsType() ResultExtendedCommunityNonTransitive2OctetAsType - // SetNonTransitive2OctetAsType assigns ResultExtendedCommunityNonTransitive2OctetAsType provided by user to ResultExtendedCommunityStructured. - // ResultExtendedCommunityNonTransitive2OctetAsType is the Non-Transitive Two-Octet AS-Specific Extended Community is sent as type 0x40. - SetNonTransitive2OctetAsType(value ResultExtendedCommunityNonTransitive2OctetAsType) ResultExtendedCommunityStructured - // HasNonTransitive2OctetAsType checks if NonTransitive2OctetAsType has been set in ResultExtendedCommunityStructured - HasNonTransitive2OctetAsType() bool - setNil() -} - -type ResultExtendedCommunityStructuredChoiceEnum string - -// Enum of Choice on ResultExtendedCommunityStructured -var ResultExtendedCommunityStructuredChoice = struct { - TRANSITIVE_2OCTET_AS_TYPE ResultExtendedCommunityStructuredChoiceEnum - TRANSITIVE_IPV4_ADDRESS_TYPE ResultExtendedCommunityStructuredChoiceEnum - TRANSITIVE_4OCTET_AS_TYPE ResultExtendedCommunityStructuredChoiceEnum - TRANSITIVE_OPAQUE_TYPE ResultExtendedCommunityStructuredChoiceEnum - NON_TRANSITIVE_2OCTET_AS_TYPE ResultExtendedCommunityStructuredChoiceEnum -}{ - TRANSITIVE_2OCTET_AS_TYPE: ResultExtendedCommunityStructuredChoiceEnum("transitive_2octet_as_type"), - TRANSITIVE_IPV4_ADDRESS_TYPE: ResultExtendedCommunityStructuredChoiceEnum("transitive_ipv4_address_type"), - TRANSITIVE_4OCTET_AS_TYPE: ResultExtendedCommunityStructuredChoiceEnum("transitive_4octet_as_type"), - TRANSITIVE_OPAQUE_TYPE: ResultExtendedCommunityStructuredChoiceEnum("transitive_opaque_type"), - NON_TRANSITIVE_2OCTET_AS_TYPE: ResultExtendedCommunityStructuredChoiceEnum("non_transitive_2octet_as_type"), -} - -func (obj *resultExtendedCommunityStructured) Choice() ResultExtendedCommunityStructuredChoiceEnum { - return ResultExtendedCommunityStructuredChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *resultExtendedCommunityStructured) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *resultExtendedCommunityStructured) setChoice(value ResultExtendedCommunityStructuredChoiceEnum) ResultExtendedCommunityStructured { - intValue, ok := otg.ResultExtendedCommunityStructured_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ResultExtendedCommunityStructuredChoiceEnum", string(value))) - return obj - } - enumValue := otg.ResultExtendedCommunityStructured_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.NonTransitive_2OctetAsType = nil - obj.nonTransitive_2OctetAsTypeHolder = nil - obj.obj.TransitiveOpaqueType = nil - obj.transitiveOpaqueTypeHolder = nil - obj.obj.Transitive_4OctetAsType = nil - obj.transitive_4OctetAsTypeHolder = nil - obj.obj.TransitiveIpv4AddressType = nil - obj.transitiveIpv4AddressTypeHolder = nil - obj.obj.Transitive_2OctetAsType = nil - obj.transitive_2OctetAsTypeHolder = nil - - if value == ResultExtendedCommunityStructuredChoice.TRANSITIVE_2OCTET_AS_TYPE { - obj.obj.Transitive_2OctetAsType = NewResultExtendedCommunityTransitive2OctetAsType().msg() - } - - if value == ResultExtendedCommunityStructuredChoice.TRANSITIVE_IPV4_ADDRESS_TYPE { - obj.obj.TransitiveIpv4AddressType = NewResultExtendedCommunityTransitiveIpv4AddressType().msg() - } - - if value == ResultExtendedCommunityStructuredChoice.TRANSITIVE_4OCTET_AS_TYPE { - obj.obj.Transitive_4OctetAsType = NewResultExtendedCommunityTransitive4OctetAsType().msg() - } - - if value == ResultExtendedCommunityStructuredChoice.TRANSITIVE_OPAQUE_TYPE { - obj.obj.TransitiveOpaqueType = NewResultExtendedCommunityTransitiveOpaqueType().msg() - } - - if value == ResultExtendedCommunityStructuredChoice.NON_TRANSITIVE_2OCTET_AS_TYPE { - obj.obj.NonTransitive_2OctetAsType = NewResultExtendedCommunityNonTransitive2OctetAsType().msg() - } - - return obj -} - -// description is TBD -// Transitive2OctetAsType returns a ResultExtendedCommunityTransitive2OctetAsType -func (obj *resultExtendedCommunityStructured) Transitive2OctetAsType() ResultExtendedCommunityTransitive2OctetAsType { - if obj.obj.Transitive_2OctetAsType == nil { - obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_2OCTET_AS_TYPE) - } - if obj.transitive_2OctetAsTypeHolder == nil { - obj.transitive_2OctetAsTypeHolder = &resultExtendedCommunityTransitive2OctetAsType{obj: obj.obj.Transitive_2OctetAsType} - } - return obj.transitive_2OctetAsTypeHolder -} - -// description is TBD -// Transitive2OctetAsType returns a ResultExtendedCommunityTransitive2OctetAsType -func (obj *resultExtendedCommunityStructured) HasTransitive2OctetAsType() bool { - return obj.obj.Transitive_2OctetAsType != nil -} - -// description is TBD -// SetTransitive2OctetAsType sets the ResultExtendedCommunityTransitive2OctetAsType value in the ResultExtendedCommunityStructured object -func (obj *resultExtendedCommunityStructured) SetTransitive2OctetAsType(value ResultExtendedCommunityTransitive2OctetAsType) ResultExtendedCommunityStructured { - obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_2OCTET_AS_TYPE) - obj.transitive_2OctetAsTypeHolder = nil - obj.obj.Transitive_2OctetAsType = value.msg() - - return obj -} - -// description is TBD -// TransitiveIpv4AddressType returns a ResultExtendedCommunityTransitiveIpv4AddressType -func (obj *resultExtendedCommunityStructured) TransitiveIpv4AddressType() ResultExtendedCommunityTransitiveIpv4AddressType { - if obj.obj.TransitiveIpv4AddressType == nil { - obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_IPV4_ADDRESS_TYPE) - } - if obj.transitiveIpv4AddressTypeHolder == nil { - obj.transitiveIpv4AddressTypeHolder = &resultExtendedCommunityTransitiveIpv4AddressType{obj: obj.obj.TransitiveIpv4AddressType} - } - return obj.transitiveIpv4AddressTypeHolder -} - -// description is TBD -// TransitiveIpv4AddressType returns a ResultExtendedCommunityTransitiveIpv4AddressType -func (obj *resultExtendedCommunityStructured) HasTransitiveIpv4AddressType() bool { - return obj.obj.TransitiveIpv4AddressType != nil -} - -// description is TBD -// SetTransitiveIpv4AddressType sets the ResultExtendedCommunityTransitiveIpv4AddressType value in the ResultExtendedCommunityStructured object -func (obj *resultExtendedCommunityStructured) SetTransitiveIpv4AddressType(value ResultExtendedCommunityTransitiveIpv4AddressType) ResultExtendedCommunityStructured { - obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_IPV4_ADDRESS_TYPE) - obj.transitiveIpv4AddressTypeHolder = nil - obj.obj.TransitiveIpv4AddressType = value.msg() - - return obj -} - -// description is TBD -// Transitive4OctetAsType returns a ResultExtendedCommunityTransitive4OctetAsType -func (obj *resultExtendedCommunityStructured) Transitive4OctetAsType() ResultExtendedCommunityTransitive4OctetAsType { - if obj.obj.Transitive_4OctetAsType == nil { - obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_4OCTET_AS_TYPE) - } - if obj.transitive_4OctetAsTypeHolder == nil { - obj.transitive_4OctetAsTypeHolder = &resultExtendedCommunityTransitive4OctetAsType{obj: obj.obj.Transitive_4OctetAsType} - } - return obj.transitive_4OctetAsTypeHolder -} - -// description is TBD -// Transitive4OctetAsType returns a ResultExtendedCommunityTransitive4OctetAsType -func (obj *resultExtendedCommunityStructured) HasTransitive4OctetAsType() bool { - return obj.obj.Transitive_4OctetAsType != nil -} - -// description is TBD -// SetTransitive4OctetAsType sets the ResultExtendedCommunityTransitive4OctetAsType value in the ResultExtendedCommunityStructured object -func (obj *resultExtendedCommunityStructured) SetTransitive4OctetAsType(value ResultExtendedCommunityTransitive4OctetAsType) ResultExtendedCommunityStructured { - obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_4OCTET_AS_TYPE) - obj.transitive_4OctetAsTypeHolder = nil - obj.obj.Transitive_4OctetAsType = value.msg() - - return obj -} - -// description is TBD -// TransitiveOpaqueType returns a ResultExtendedCommunityTransitiveOpaqueType -func (obj *resultExtendedCommunityStructured) TransitiveOpaqueType() ResultExtendedCommunityTransitiveOpaqueType { - if obj.obj.TransitiveOpaqueType == nil { - obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_OPAQUE_TYPE) - } - if obj.transitiveOpaqueTypeHolder == nil { - obj.transitiveOpaqueTypeHolder = &resultExtendedCommunityTransitiveOpaqueType{obj: obj.obj.TransitiveOpaqueType} - } - return obj.transitiveOpaqueTypeHolder -} - -// description is TBD -// TransitiveOpaqueType returns a ResultExtendedCommunityTransitiveOpaqueType -func (obj *resultExtendedCommunityStructured) HasTransitiveOpaqueType() bool { - return obj.obj.TransitiveOpaqueType != nil -} - -// description is TBD -// SetTransitiveOpaqueType sets the ResultExtendedCommunityTransitiveOpaqueType value in the ResultExtendedCommunityStructured object -func (obj *resultExtendedCommunityStructured) SetTransitiveOpaqueType(value ResultExtendedCommunityTransitiveOpaqueType) ResultExtendedCommunityStructured { - obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_OPAQUE_TYPE) - obj.transitiveOpaqueTypeHolder = nil - obj.obj.TransitiveOpaqueType = value.msg() - - return obj -} - -// description is TBD -// NonTransitive2OctetAsType returns a ResultExtendedCommunityNonTransitive2OctetAsType -func (obj *resultExtendedCommunityStructured) NonTransitive2OctetAsType() ResultExtendedCommunityNonTransitive2OctetAsType { - if obj.obj.NonTransitive_2OctetAsType == nil { - obj.setChoice(ResultExtendedCommunityStructuredChoice.NON_TRANSITIVE_2OCTET_AS_TYPE) - } - if obj.nonTransitive_2OctetAsTypeHolder == nil { - obj.nonTransitive_2OctetAsTypeHolder = &resultExtendedCommunityNonTransitive2OctetAsType{obj: obj.obj.NonTransitive_2OctetAsType} - } - return obj.nonTransitive_2OctetAsTypeHolder -} - -// description is TBD -// NonTransitive2OctetAsType returns a ResultExtendedCommunityNonTransitive2OctetAsType -func (obj *resultExtendedCommunityStructured) HasNonTransitive2OctetAsType() bool { - return obj.obj.NonTransitive_2OctetAsType != nil -} - -// description is TBD -// SetNonTransitive2OctetAsType sets the ResultExtendedCommunityNonTransitive2OctetAsType value in the ResultExtendedCommunityStructured object -func (obj *resultExtendedCommunityStructured) SetNonTransitive2OctetAsType(value ResultExtendedCommunityNonTransitive2OctetAsType) ResultExtendedCommunityStructured { - obj.setChoice(ResultExtendedCommunityStructuredChoice.NON_TRANSITIVE_2OCTET_AS_TYPE) - obj.nonTransitive_2OctetAsTypeHolder = nil - obj.obj.NonTransitive_2OctetAsType = value.msg() - - return obj -} - -func (obj *resultExtendedCommunityStructured) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Transitive_2OctetAsType != nil { - - obj.Transitive2OctetAsType().validateObj(vObj, set_default) - } - - if obj.obj.TransitiveIpv4AddressType != nil { - - obj.TransitiveIpv4AddressType().validateObj(vObj, set_default) - } - - if obj.obj.Transitive_4OctetAsType != nil { - - obj.Transitive4OctetAsType().validateObj(vObj, set_default) - } - - if obj.obj.TransitiveOpaqueType != nil { - - obj.TransitiveOpaqueType().validateObj(vObj, set_default) - } - - if obj.obj.NonTransitive_2OctetAsType != nil { - - obj.NonTransitive2OctetAsType().validateObj(vObj, set_default) - } - -} - -func (obj *resultExtendedCommunityStructured) setDefault() { - var choices_set int = 0 - var choice ResultExtendedCommunityStructuredChoiceEnum - - if obj.obj.TransitiveIpv4AddressType != nil { - choices_set += 1 - choice = ResultExtendedCommunityStructuredChoice.TRANSITIVE_IPV4_ADDRESS_TYPE - } - - if obj.obj.TransitiveOpaqueType != nil { - choices_set += 1 - choice = ResultExtendedCommunityStructuredChoice.TRANSITIVE_OPAQUE_TYPE - } - - if obj.obj.Transitive_2OctetAsType != nil { - choices_set += 1 - choice = ResultExtendedCommunityStructuredChoice.TRANSITIVE_2OCTET_AS_TYPE - } - - if obj.obj.Transitive_4OctetAsType != nil { - choices_set += 1 - choice = ResultExtendedCommunityStructuredChoice.TRANSITIVE_4OCTET_AS_TYPE - } - - if obj.obj.NonTransitive_2OctetAsType != nil { - choices_set += 1 - choice = ResultExtendedCommunityStructuredChoice.NON_TRANSITIVE_2OCTET_AS_TYPE - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ResultExtendedCommunityStructured") - } - } else { - intVal := otg.ResultExtendedCommunityStructured_Choice_Enum_value[string(choice)] - enumValue := otg.ResultExtendedCommunityStructured_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** ResultBgpAsPathSegment ***** -type resultBgpAsPathSegment struct { - validation - obj *otg.ResultBgpAsPathSegment - marshaller marshalResultBgpAsPathSegment - unMarshaller unMarshalResultBgpAsPathSegment -} - -func NewResultBgpAsPathSegment() ResultBgpAsPathSegment { - obj := resultBgpAsPathSegment{obj: &otg.ResultBgpAsPathSegment{}} - obj.setDefault() - return &obj -} - -func (obj *resultBgpAsPathSegment) msg() *otg.ResultBgpAsPathSegment { - return obj.obj -} - -func (obj *resultBgpAsPathSegment) setMsg(msg *otg.ResultBgpAsPathSegment) ResultBgpAsPathSegment { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultBgpAsPathSegment struct { - obj *resultBgpAsPathSegment -} - -type marshalResultBgpAsPathSegment interface { - // ToProto marshals ResultBgpAsPathSegment to protobuf object *otg.ResultBgpAsPathSegment - ToProto() (*otg.ResultBgpAsPathSegment, error) - // ToPbText marshals ResultBgpAsPathSegment to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultBgpAsPathSegment to YAML text - ToYaml() (string, error) - // ToJson marshals ResultBgpAsPathSegment to JSON text - ToJson() (string, error) -} - -type unMarshalresultBgpAsPathSegment struct { - obj *resultBgpAsPathSegment -} - -type unMarshalResultBgpAsPathSegment interface { - // FromProto unmarshals ResultBgpAsPathSegment from protobuf object *otg.ResultBgpAsPathSegment - FromProto(msg *otg.ResultBgpAsPathSegment) (ResultBgpAsPathSegment, error) - // FromPbText unmarshals ResultBgpAsPathSegment from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultBgpAsPathSegment from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultBgpAsPathSegment from JSON text - FromJson(value string) error -} - -func (obj *resultBgpAsPathSegment) Marshal() marshalResultBgpAsPathSegment { - if obj.marshaller == nil { - obj.marshaller = &marshalresultBgpAsPathSegment{obj: obj} - } - return obj.marshaller -} - -func (obj *resultBgpAsPathSegment) Unmarshal() unMarshalResultBgpAsPathSegment { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultBgpAsPathSegment{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultBgpAsPathSegment) ToProto() (*otg.ResultBgpAsPathSegment, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultBgpAsPathSegment) FromProto(msg *otg.ResultBgpAsPathSegment) (ResultBgpAsPathSegment, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultBgpAsPathSegment) 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 *unMarshalresultBgpAsPathSegment) 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 *marshalresultBgpAsPathSegment) 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 *unMarshalresultBgpAsPathSegment) 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 *marshalresultBgpAsPathSegment) 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 *unMarshalresultBgpAsPathSegment) 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 *resultBgpAsPathSegment) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultBgpAsPathSegment) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultBgpAsPathSegment) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultBgpAsPathSegment) Clone() (ResultBgpAsPathSegment, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultBgpAsPathSegment() - 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 -} - -// ResultBgpAsPathSegment is configuration for a single BGP AS path segment -type ResultBgpAsPathSegment interface { - Validation - // msg marshals ResultBgpAsPathSegment to protobuf object *otg.ResultBgpAsPathSegment - // and doesn't set defaults - msg() *otg.ResultBgpAsPathSegment - // setMsg unmarshals ResultBgpAsPathSegment from protobuf object *otg.ResultBgpAsPathSegment - // and doesn't set defaults - setMsg(*otg.ResultBgpAsPathSegment) ResultBgpAsPathSegment - // provides marshal interface - Marshal() marshalResultBgpAsPathSegment - // provides unmarshal interface - Unmarshal() unMarshalResultBgpAsPathSegment - // validate validates ResultBgpAsPathSegment - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultBgpAsPathSegment, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Type returns ResultBgpAsPathSegmentTypeEnum, set in ResultBgpAsPathSegment - Type() ResultBgpAsPathSegmentTypeEnum - // SetType assigns ResultBgpAsPathSegmentTypeEnum provided by user to ResultBgpAsPathSegment - SetType(value ResultBgpAsPathSegmentTypeEnum) ResultBgpAsPathSegment - // HasType checks if Type has been set in ResultBgpAsPathSegment - HasType() bool - // AsNumbers returns []uint32, set in ResultBgpAsPathSegment. - AsNumbers() []uint32 - // SetAsNumbers assigns []uint32 provided by user to ResultBgpAsPathSegment - SetAsNumbers(value []uint32) ResultBgpAsPathSegment -} - -type ResultBgpAsPathSegmentTypeEnum string - -// Enum of Type on ResultBgpAsPathSegment -var ResultBgpAsPathSegmentType = struct { - AS_SEQ ResultBgpAsPathSegmentTypeEnum - AS_SET ResultBgpAsPathSegmentTypeEnum - AS_CONFED_SEQ ResultBgpAsPathSegmentTypeEnum - AS_CONFED_SET ResultBgpAsPathSegmentTypeEnum -}{ - AS_SEQ: ResultBgpAsPathSegmentTypeEnum("as_seq"), - AS_SET: ResultBgpAsPathSegmentTypeEnum("as_set"), - AS_CONFED_SEQ: ResultBgpAsPathSegmentTypeEnum("as_confed_seq"), - AS_CONFED_SET: ResultBgpAsPathSegmentTypeEnum("as_confed_set"), -} - -func (obj *resultBgpAsPathSegment) Type() ResultBgpAsPathSegmentTypeEnum { - return ResultBgpAsPathSegmentTypeEnum(obj.obj.Type.Enum().String()) -} - -// AS sequence is the most common type of AS_PATH, it contains the list of ASNs starting with the most recent ASN being added read from left to right. -// The other three AS_PATH types are used for Confederations - AS_SET is the type of AS_PATH attribute that summarizes routes using using the aggregate-address command, allowing AS_PATHs to be summarized in the update as well. - AS_CONFED_SEQ gives the list of ASNs in the path starting with the most recent ASN to be added reading left to right - AS_CONFED_SET will allow summarization of multiple AS PATHs to be sent in BGP Updates. -// Type returns a string -func (obj *resultBgpAsPathSegment) HasType() bool { - return obj.obj.Type != nil -} - -func (obj *resultBgpAsPathSegment) SetType(value ResultBgpAsPathSegmentTypeEnum) ResultBgpAsPathSegment { - intValue, ok := otg.ResultBgpAsPathSegment_Type_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ResultBgpAsPathSegmentTypeEnum", string(value))) - return obj - } - enumValue := otg.ResultBgpAsPathSegment_Type_Enum(intValue) - obj.obj.Type = &enumValue - - return obj -} - -// The AS numbers in this AS path segment. -// AsNumbers returns a []uint32 -func (obj *resultBgpAsPathSegment) AsNumbers() []uint32 { - if obj.obj.AsNumbers == nil { - obj.obj.AsNumbers = make([]uint32, 0) - } - return obj.obj.AsNumbers -} - -// The AS numbers in this AS path segment. -// SetAsNumbers sets the []uint32 value in the ResultBgpAsPathSegment object -func (obj *resultBgpAsPathSegment) SetAsNumbers(value []uint32) ResultBgpAsPathSegment { - - if obj.obj.AsNumbers == nil { - obj.obj.AsNumbers = make([]uint32, 0) - } - obj.obj.AsNumbers = value - - return obj -} - -func (obj *resultBgpAsPathSegment) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *resultBgpAsPathSegment) setDefault() { - -} - -// ***** IsisLspHostname ***** -type isisLspHostname struct { - validation - obj *otg.IsisLspHostname - marshaller marshalIsisLspHostname - unMarshaller unMarshalIsisLspHostname -} - -func NewIsisLspHostname() IsisLspHostname { - obj := isisLspHostname{obj: &otg.IsisLspHostname{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspHostname) msg() *otg.IsisLspHostname { - return obj.obj -} - -func (obj *isisLspHostname) setMsg(msg *otg.IsisLspHostname) IsisLspHostname { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspHostname struct { - obj *isisLspHostname -} - -type marshalIsisLspHostname interface { - // ToProto marshals IsisLspHostname to protobuf object *otg.IsisLspHostname - ToProto() (*otg.IsisLspHostname, error) - // ToPbText marshals IsisLspHostname to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspHostname to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspHostname to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspHostname struct { - obj *isisLspHostname -} - -type unMarshalIsisLspHostname interface { - // FromProto unmarshals IsisLspHostname from protobuf object *otg.IsisLspHostname - FromProto(msg *otg.IsisLspHostname) (IsisLspHostname, error) - // FromPbText unmarshals IsisLspHostname from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspHostname from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspHostname from JSON text - FromJson(value string) error -} - -func (obj *isisLspHostname) Marshal() marshalIsisLspHostname { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspHostname{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspHostname) Unmarshal() unMarshalIsisLspHostname { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspHostname{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspHostname) ToProto() (*otg.IsisLspHostname, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspHostname) FromProto(msg *otg.IsisLspHostname) (IsisLspHostname, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspHostname) 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 *unMarshalisisLspHostname) 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 *marshalisisLspHostname) 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 *unMarshalisisLspHostname) 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 *marshalisisLspHostname) 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 *unMarshalisisLspHostname) 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 *isisLspHostname) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspHostname) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspHostname) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspHostname) Clone() (IsisLspHostname, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspHostname() - 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 -} - -// IsisLspHostname is it contains Hostname for the TLV 137. -type IsisLspHostname interface { - Validation - // msg marshals IsisLspHostname to protobuf object *otg.IsisLspHostname - // and doesn't set defaults - msg() *otg.IsisLspHostname - // setMsg unmarshals IsisLspHostname from protobuf object *otg.IsisLspHostname - // and doesn't set defaults - setMsg(*otg.IsisLspHostname) IsisLspHostname - // provides marshal interface - Marshal() marshalIsisLspHostname - // provides unmarshal interface - Unmarshal() unMarshalIsisLspHostname - // validate validates IsisLspHostname - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspHostname, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Hostname returns string, set in IsisLspHostname. - Hostname() string - // SetHostname assigns string provided by user to IsisLspHostname - SetHostname(value string) IsisLspHostname - // HasHostname checks if Hostname has been set in IsisLspHostname - HasHostname() bool -} - -// Hostname for an ISIS router. -// Hostname returns a string -func (obj *isisLspHostname) Hostname() string { - - return *obj.obj.Hostname - -} - -// Hostname for an ISIS router. -// Hostname returns a string -func (obj *isisLspHostname) HasHostname() bool { - return obj.obj.Hostname != nil -} - -// Hostname for an ISIS router. -// SetHostname sets the string value in the IsisLspHostname object -func (obj *isisLspHostname) SetHostname(value string) IsisLspHostname { - - obj.obj.Hostname = &value - return obj -} - -func (obj *isisLspHostname) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *isisLspHostname) setDefault() { - -} - -// ***** IsisLspIsReachabilityTlv ***** -type isisLspIsReachabilityTlv struct { - validation - obj *otg.IsisLspIsReachabilityTlv - marshaller marshalIsisLspIsReachabilityTlv - unMarshaller unMarshalIsisLspIsReachabilityTlv - neighborsHolder IsisLspIsReachabilityTlvIsisLspneighborIter -} - -func NewIsisLspIsReachabilityTlv() IsisLspIsReachabilityTlv { - obj := isisLspIsReachabilityTlv{obj: &otg.IsisLspIsReachabilityTlv{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspIsReachabilityTlv) msg() *otg.IsisLspIsReachabilityTlv { - return obj.obj -} - -func (obj *isisLspIsReachabilityTlv) setMsg(msg *otg.IsisLspIsReachabilityTlv) IsisLspIsReachabilityTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspIsReachabilityTlv struct { - obj *isisLspIsReachabilityTlv -} - -type marshalIsisLspIsReachabilityTlv interface { - // ToProto marshals IsisLspIsReachabilityTlv to protobuf object *otg.IsisLspIsReachabilityTlv - ToProto() (*otg.IsisLspIsReachabilityTlv, error) - // ToPbText marshals IsisLspIsReachabilityTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspIsReachabilityTlv to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspIsReachabilityTlv to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspIsReachabilityTlv struct { - obj *isisLspIsReachabilityTlv -} - -type unMarshalIsisLspIsReachabilityTlv interface { - // FromProto unmarshals IsisLspIsReachabilityTlv from protobuf object *otg.IsisLspIsReachabilityTlv - FromProto(msg *otg.IsisLspIsReachabilityTlv) (IsisLspIsReachabilityTlv, error) - // FromPbText unmarshals IsisLspIsReachabilityTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspIsReachabilityTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspIsReachabilityTlv from JSON text - FromJson(value string) error -} - -func (obj *isisLspIsReachabilityTlv) Marshal() marshalIsisLspIsReachabilityTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspIsReachabilityTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspIsReachabilityTlv) Unmarshal() unMarshalIsisLspIsReachabilityTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspIsReachabilityTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspIsReachabilityTlv) ToProto() (*otg.IsisLspIsReachabilityTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspIsReachabilityTlv) FromProto(msg *otg.IsisLspIsReachabilityTlv) (IsisLspIsReachabilityTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspIsReachabilityTlv) 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 *unMarshalisisLspIsReachabilityTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisLspIsReachabilityTlv) 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 *unMarshalisisLspIsReachabilityTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisLspIsReachabilityTlv) 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 *unMarshalisisLspIsReachabilityTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisLspIsReachabilityTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspIsReachabilityTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspIsReachabilityTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspIsReachabilityTlv) Clone() (IsisLspIsReachabilityTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspIsReachabilityTlv() - 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 -} - -func (obj *isisLspIsReachabilityTlv) setNil() { - obj.neighborsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisLspIsReachabilityTlv is this container describes list of ISIS neighbors and attributes in IS-Reachability TLV (type 2). -type IsisLspIsReachabilityTlv interface { - Validation - // msg marshals IsisLspIsReachabilityTlv to protobuf object *otg.IsisLspIsReachabilityTlv - // and doesn't set defaults - msg() *otg.IsisLspIsReachabilityTlv - // setMsg unmarshals IsisLspIsReachabilityTlv from protobuf object *otg.IsisLspIsReachabilityTlv - // and doesn't set defaults - setMsg(*otg.IsisLspIsReachabilityTlv) IsisLspIsReachabilityTlv - // provides marshal interface - Marshal() marshalIsisLspIsReachabilityTlv - // provides unmarshal interface - Unmarshal() unMarshalIsisLspIsReachabilityTlv - // validate validates IsisLspIsReachabilityTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspIsReachabilityTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Neighbors returns IsisLspIsReachabilityTlvIsisLspneighborIterIter, set in IsisLspIsReachabilityTlv - Neighbors() IsisLspIsReachabilityTlvIsisLspneighborIter - setNil() -} - -// This container describes Intermediate System (IS) neighbors. -// Neighbors returns a []IsisLspneighbor -func (obj *isisLspIsReachabilityTlv) Neighbors() IsisLspIsReachabilityTlvIsisLspneighborIter { - if len(obj.obj.Neighbors) == 0 { - obj.obj.Neighbors = []*otg.IsisLspneighbor{} - } - if obj.neighborsHolder == nil { - obj.neighborsHolder = newIsisLspIsReachabilityTlvIsisLspneighborIter(&obj.obj.Neighbors).setMsg(obj) - } - return obj.neighborsHolder -} - -type isisLspIsReachabilityTlvIsisLspneighborIter struct { - obj *isisLspIsReachabilityTlv - isisLspneighborSlice []IsisLspneighbor - fieldPtr *[]*otg.IsisLspneighbor -} - -func newIsisLspIsReachabilityTlvIsisLspneighborIter(ptr *[]*otg.IsisLspneighbor) IsisLspIsReachabilityTlvIsisLspneighborIter { - return &isisLspIsReachabilityTlvIsisLspneighborIter{fieldPtr: ptr} -} - -type IsisLspIsReachabilityTlvIsisLspneighborIter interface { - setMsg(*isisLspIsReachabilityTlv) IsisLspIsReachabilityTlvIsisLspneighborIter - Items() []IsisLspneighbor - Add() IsisLspneighbor - Append(items ...IsisLspneighbor) IsisLspIsReachabilityTlvIsisLspneighborIter - Set(index int, newObj IsisLspneighbor) IsisLspIsReachabilityTlvIsisLspneighborIter - Clear() IsisLspIsReachabilityTlvIsisLspneighborIter - clearHolderSlice() IsisLspIsReachabilityTlvIsisLspneighborIter - appendHolderSlice(item IsisLspneighbor) IsisLspIsReachabilityTlvIsisLspneighborIter -} - -func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) setMsg(msg *isisLspIsReachabilityTlv) IsisLspIsReachabilityTlvIsisLspneighborIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspneighbor{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) Items() []IsisLspneighbor { - return obj.isisLspneighborSlice -} - -func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) Add() IsisLspneighbor { - newObj := &otg.IsisLspneighbor{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspneighbor{obj: newObj} - newLibObj.setDefault() - obj.isisLspneighborSlice = append(obj.isisLspneighborSlice, newLibObj) - return newLibObj -} - -func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) Append(items ...IsisLspneighbor) IsisLspIsReachabilityTlvIsisLspneighborIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspneighborSlice = append(obj.isisLspneighborSlice, item) - } - return obj -} - -func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) Set(index int, newObj IsisLspneighbor) IsisLspIsReachabilityTlvIsisLspneighborIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspneighborSlice[index] = newObj - return obj -} -func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) Clear() IsisLspIsReachabilityTlvIsisLspneighborIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspneighbor{} - obj.isisLspneighborSlice = []IsisLspneighbor{} - } - return obj -} -func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) clearHolderSlice() IsisLspIsReachabilityTlvIsisLspneighborIter { - if len(obj.isisLspneighborSlice) > 0 { - obj.isisLspneighborSlice = []IsisLspneighbor{} - } - return obj -} -func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) appendHolderSlice(item IsisLspneighbor) IsisLspIsReachabilityTlvIsisLspneighborIter { - obj.isisLspneighborSlice = append(obj.isisLspneighborSlice, item) - return obj -} - -func (obj *isisLspIsReachabilityTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Neighbors) != 0 { - - if set_default { - obj.Neighbors().clearHolderSlice() - for _, item := range obj.obj.Neighbors { - obj.Neighbors().appendHolderSlice(&isisLspneighbor{obj: item}) - } - } - for _, item := range obj.Neighbors().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *isisLspIsReachabilityTlv) setDefault() { - -} - -// ***** IsisLspExtendedIsReachabilityTlv ***** -type isisLspExtendedIsReachabilityTlv struct { - validation - obj *otg.IsisLspExtendedIsReachabilityTlv - marshaller marshalIsisLspExtendedIsReachabilityTlv - unMarshaller unMarshalIsisLspExtendedIsReachabilityTlv - neighborsHolder IsisLspExtendedIsReachabilityTlvIsisLspneighborIter -} - -func NewIsisLspExtendedIsReachabilityTlv() IsisLspExtendedIsReachabilityTlv { - obj := isisLspExtendedIsReachabilityTlv{obj: &otg.IsisLspExtendedIsReachabilityTlv{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspExtendedIsReachabilityTlv) msg() *otg.IsisLspExtendedIsReachabilityTlv { - return obj.obj -} - -func (obj *isisLspExtendedIsReachabilityTlv) setMsg(msg *otg.IsisLspExtendedIsReachabilityTlv) IsisLspExtendedIsReachabilityTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspExtendedIsReachabilityTlv struct { - obj *isisLspExtendedIsReachabilityTlv -} - -type marshalIsisLspExtendedIsReachabilityTlv interface { - // ToProto marshals IsisLspExtendedIsReachabilityTlv to protobuf object *otg.IsisLspExtendedIsReachabilityTlv - ToProto() (*otg.IsisLspExtendedIsReachabilityTlv, error) - // ToPbText marshals IsisLspExtendedIsReachabilityTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspExtendedIsReachabilityTlv to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspExtendedIsReachabilityTlv to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspExtendedIsReachabilityTlv struct { - obj *isisLspExtendedIsReachabilityTlv -} - -type unMarshalIsisLspExtendedIsReachabilityTlv interface { - // FromProto unmarshals IsisLspExtendedIsReachabilityTlv from protobuf object *otg.IsisLspExtendedIsReachabilityTlv - FromProto(msg *otg.IsisLspExtendedIsReachabilityTlv) (IsisLspExtendedIsReachabilityTlv, error) - // FromPbText unmarshals IsisLspExtendedIsReachabilityTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspExtendedIsReachabilityTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspExtendedIsReachabilityTlv from JSON text - FromJson(value string) error -} - -func (obj *isisLspExtendedIsReachabilityTlv) Marshal() marshalIsisLspExtendedIsReachabilityTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspExtendedIsReachabilityTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspExtendedIsReachabilityTlv) Unmarshal() unMarshalIsisLspExtendedIsReachabilityTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspExtendedIsReachabilityTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspExtendedIsReachabilityTlv) ToProto() (*otg.IsisLspExtendedIsReachabilityTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspExtendedIsReachabilityTlv) FromProto(msg *otg.IsisLspExtendedIsReachabilityTlv) (IsisLspExtendedIsReachabilityTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspExtendedIsReachabilityTlv) 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 *unMarshalisisLspExtendedIsReachabilityTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisLspExtendedIsReachabilityTlv) 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 *unMarshalisisLspExtendedIsReachabilityTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisLspExtendedIsReachabilityTlv) 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 *unMarshalisisLspExtendedIsReachabilityTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisLspExtendedIsReachabilityTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspExtendedIsReachabilityTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspExtendedIsReachabilityTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspExtendedIsReachabilityTlv) Clone() (IsisLspExtendedIsReachabilityTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspExtendedIsReachabilityTlv() - 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 -} - -func (obj *isisLspExtendedIsReachabilityTlv) setNil() { - obj.neighborsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisLspExtendedIsReachabilityTlv is this is list of ISIS neighbors and attributes in Extended-IS-Reachability TLV (type 22). -type IsisLspExtendedIsReachabilityTlv interface { - Validation - // msg marshals IsisLspExtendedIsReachabilityTlv to protobuf object *otg.IsisLspExtendedIsReachabilityTlv - // and doesn't set defaults - msg() *otg.IsisLspExtendedIsReachabilityTlv - // setMsg unmarshals IsisLspExtendedIsReachabilityTlv from protobuf object *otg.IsisLspExtendedIsReachabilityTlv - // and doesn't set defaults - setMsg(*otg.IsisLspExtendedIsReachabilityTlv) IsisLspExtendedIsReachabilityTlv - // provides marshal interface - Marshal() marshalIsisLspExtendedIsReachabilityTlv - // provides unmarshal interface - Unmarshal() unMarshalIsisLspExtendedIsReachabilityTlv - // validate validates IsisLspExtendedIsReachabilityTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspExtendedIsReachabilityTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Neighbors returns IsisLspExtendedIsReachabilityTlvIsisLspneighborIterIter, set in IsisLspExtendedIsReachabilityTlv - Neighbors() IsisLspExtendedIsReachabilityTlvIsisLspneighborIter - setNil() -} - -// This container describes IS neighbors. -// Neighbors returns a []IsisLspneighbor -func (obj *isisLspExtendedIsReachabilityTlv) Neighbors() IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { - if len(obj.obj.Neighbors) == 0 { - obj.obj.Neighbors = []*otg.IsisLspneighbor{} - } - if obj.neighborsHolder == nil { - obj.neighborsHolder = newIsisLspExtendedIsReachabilityTlvIsisLspneighborIter(&obj.obj.Neighbors).setMsg(obj) - } - return obj.neighborsHolder -} - -type isisLspExtendedIsReachabilityTlvIsisLspneighborIter struct { - obj *isisLspExtendedIsReachabilityTlv - isisLspneighborSlice []IsisLspneighbor - fieldPtr *[]*otg.IsisLspneighbor -} - -func newIsisLspExtendedIsReachabilityTlvIsisLspneighborIter(ptr *[]*otg.IsisLspneighbor) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { - return &isisLspExtendedIsReachabilityTlvIsisLspneighborIter{fieldPtr: ptr} -} - -type IsisLspExtendedIsReachabilityTlvIsisLspneighborIter interface { - setMsg(*isisLspExtendedIsReachabilityTlv) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter - Items() []IsisLspneighbor - Add() IsisLspneighbor - Append(items ...IsisLspneighbor) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter - Set(index int, newObj IsisLspneighbor) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter - Clear() IsisLspExtendedIsReachabilityTlvIsisLspneighborIter - clearHolderSlice() IsisLspExtendedIsReachabilityTlvIsisLspneighborIter - appendHolderSlice(item IsisLspneighbor) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter -} - -func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) setMsg(msg *isisLspExtendedIsReachabilityTlv) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspneighbor{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) Items() []IsisLspneighbor { - return obj.isisLspneighborSlice -} - -func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) Add() IsisLspneighbor { - newObj := &otg.IsisLspneighbor{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspneighbor{obj: newObj} - newLibObj.setDefault() - obj.isisLspneighborSlice = append(obj.isisLspneighborSlice, newLibObj) - return newLibObj -} - -func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) Append(items ...IsisLspneighbor) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspneighborSlice = append(obj.isisLspneighborSlice, item) - } - return obj -} - -func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) Set(index int, newObj IsisLspneighbor) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspneighborSlice[index] = newObj - return obj -} -func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) Clear() IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspneighbor{} - obj.isisLspneighborSlice = []IsisLspneighbor{} - } - return obj -} -func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) clearHolderSlice() IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { - if len(obj.isisLspneighborSlice) > 0 { - obj.isisLspneighborSlice = []IsisLspneighbor{} - } - return obj -} -func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) appendHolderSlice(item IsisLspneighbor) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { - obj.isisLspneighborSlice = append(obj.isisLspneighborSlice, item) - return obj -} - -func (obj *isisLspExtendedIsReachabilityTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Neighbors) != 0 { - - if set_default { - obj.Neighbors().clearHolderSlice() - for _, item := range obj.obj.Neighbors { - obj.Neighbors().appendHolderSlice(&isisLspneighbor{obj: item}) - } - } - for _, item := range obj.Neighbors().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *isisLspExtendedIsReachabilityTlv) setDefault() { - -} - -// ***** IsisLspIpv4InternalReachabilityTlv ***** -type isisLspIpv4InternalReachabilityTlv struct { - validation - obj *otg.IsisLspIpv4InternalReachabilityTlv - marshaller marshalIsisLspIpv4InternalReachabilityTlv - unMarshaller unMarshalIsisLspIpv4InternalReachabilityTlv - prefixesHolder IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter -} - -func NewIsisLspIpv4InternalReachabilityTlv() IsisLspIpv4InternalReachabilityTlv { - obj := isisLspIpv4InternalReachabilityTlv{obj: &otg.IsisLspIpv4InternalReachabilityTlv{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspIpv4InternalReachabilityTlv) msg() *otg.IsisLspIpv4InternalReachabilityTlv { - return obj.obj -} - -func (obj *isisLspIpv4InternalReachabilityTlv) setMsg(msg *otg.IsisLspIpv4InternalReachabilityTlv) IsisLspIpv4InternalReachabilityTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspIpv4InternalReachabilityTlv struct { - obj *isisLspIpv4InternalReachabilityTlv -} - -type marshalIsisLspIpv4InternalReachabilityTlv interface { - // ToProto marshals IsisLspIpv4InternalReachabilityTlv to protobuf object *otg.IsisLspIpv4InternalReachabilityTlv - ToProto() (*otg.IsisLspIpv4InternalReachabilityTlv, error) - // ToPbText marshals IsisLspIpv4InternalReachabilityTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspIpv4InternalReachabilityTlv to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspIpv4InternalReachabilityTlv to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspIpv4InternalReachabilityTlv struct { - obj *isisLspIpv4InternalReachabilityTlv -} - -type unMarshalIsisLspIpv4InternalReachabilityTlv interface { - // FromProto unmarshals IsisLspIpv4InternalReachabilityTlv from protobuf object *otg.IsisLspIpv4InternalReachabilityTlv - FromProto(msg *otg.IsisLspIpv4InternalReachabilityTlv) (IsisLspIpv4InternalReachabilityTlv, error) - // FromPbText unmarshals IsisLspIpv4InternalReachabilityTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspIpv4InternalReachabilityTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspIpv4InternalReachabilityTlv from JSON text - FromJson(value string) error -} - -func (obj *isisLspIpv4InternalReachabilityTlv) Marshal() marshalIsisLspIpv4InternalReachabilityTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspIpv4InternalReachabilityTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspIpv4InternalReachabilityTlv) Unmarshal() unMarshalIsisLspIpv4InternalReachabilityTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspIpv4InternalReachabilityTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspIpv4InternalReachabilityTlv) ToProto() (*otg.IsisLspIpv4InternalReachabilityTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspIpv4InternalReachabilityTlv) FromProto(msg *otg.IsisLspIpv4InternalReachabilityTlv) (IsisLspIpv4InternalReachabilityTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspIpv4InternalReachabilityTlv) 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 *unMarshalisisLspIpv4InternalReachabilityTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisLspIpv4InternalReachabilityTlv) 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 *unMarshalisisLspIpv4InternalReachabilityTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisLspIpv4InternalReachabilityTlv) 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 *unMarshalisisLspIpv4InternalReachabilityTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisLspIpv4InternalReachabilityTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspIpv4InternalReachabilityTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspIpv4InternalReachabilityTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspIpv4InternalReachabilityTlv) Clone() (IsisLspIpv4InternalReachabilityTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspIpv4InternalReachabilityTlv() - 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 -} - -func (obj *isisLspIpv4InternalReachabilityTlv) setNil() { - obj.prefixesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisLspIpv4InternalReachabilityTlv is this container defines list of IPv4 internal reachability information in one IPv4 internal reachability TLV. -// This is advertised when the origin-type is set 'internal' in route range configurations. -type IsisLspIpv4InternalReachabilityTlv interface { - Validation - // msg marshals IsisLspIpv4InternalReachabilityTlv to protobuf object *otg.IsisLspIpv4InternalReachabilityTlv - // and doesn't set defaults - msg() *otg.IsisLspIpv4InternalReachabilityTlv - // setMsg unmarshals IsisLspIpv4InternalReachabilityTlv from protobuf object *otg.IsisLspIpv4InternalReachabilityTlv - // and doesn't set defaults - setMsg(*otg.IsisLspIpv4InternalReachabilityTlv) IsisLspIpv4InternalReachabilityTlv - // provides marshal interface - Marshal() marshalIsisLspIpv4InternalReachabilityTlv - // provides unmarshal interface - Unmarshal() unMarshalIsisLspIpv4InternalReachabilityTlv - // validate validates IsisLspIpv4InternalReachabilityTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspIpv4InternalReachabilityTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Prefixes returns IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIterIter, set in IsisLspIpv4InternalReachabilityTlv - Prefixes() IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter - setNil() -} - -// Describes list of IPv4 prefixes in this TLV. -// Prefixes returns a []IsisLspV4Prefix -func (obj *isisLspIpv4InternalReachabilityTlv) Prefixes() IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { - if len(obj.obj.Prefixes) == 0 { - obj.obj.Prefixes = []*otg.IsisLspV4Prefix{} - } - if obj.prefixesHolder == nil { - obj.prefixesHolder = newIsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter(&obj.obj.Prefixes).setMsg(obj) - } - return obj.prefixesHolder -} - -type isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter struct { - obj *isisLspIpv4InternalReachabilityTlv - isisLspV4PrefixSlice []IsisLspV4Prefix - fieldPtr *[]*otg.IsisLspV4Prefix -} - -func newIsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter(ptr *[]*otg.IsisLspV4Prefix) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { - return &isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter{fieldPtr: ptr} -} - -type IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter interface { - setMsg(*isisLspIpv4InternalReachabilityTlv) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter - Items() []IsisLspV4Prefix - Add() IsisLspV4Prefix - Append(items ...IsisLspV4Prefix) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter - Set(index int, newObj IsisLspV4Prefix) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter - Clear() IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter - clearHolderSlice() IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter - appendHolderSlice(item IsisLspV4Prefix) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter -} - -func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) setMsg(msg *isisLspIpv4InternalReachabilityTlv) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspV4Prefix{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) Items() []IsisLspV4Prefix { - return obj.isisLspV4PrefixSlice -} - -func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) Add() IsisLspV4Prefix { - newObj := &otg.IsisLspV4Prefix{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspV4Prefix{obj: newObj} - newLibObj.setDefault() - obj.isisLspV4PrefixSlice = append(obj.isisLspV4PrefixSlice, newLibObj) - return newLibObj -} - -func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) Append(items ...IsisLspV4Prefix) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspV4PrefixSlice = append(obj.isisLspV4PrefixSlice, item) - } - return obj -} - -func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) Set(index int, newObj IsisLspV4Prefix) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspV4PrefixSlice[index] = newObj - return obj -} -func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) Clear() IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspV4Prefix{} - obj.isisLspV4PrefixSlice = []IsisLspV4Prefix{} - } - return obj -} -func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) clearHolderSlice() IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { - if len(obj.isisLspV4PrefixSlice) > 0 { - obj.isisLspV4PrefixSlice = []IsisLspV4Prefix{} - } - return obj -} -func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) appendHolderSlice(item IsisLspV4Prefix) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { - obj.isisLspV4PrefixSlice = append(obj.isisLspV4PrefixSlice, item) - return obj -} - -func (obj *isisLspIpv4InternalReachabilityTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Prefixes) != 0 { - - if set_default { - obj.Prefixes().clearHolderSlice() - for _, item := range obj.obj.Prefixes { - obj.Prefixes().appendHolderSlice(&isisLspV4Prefix{obj: item}) - } - } - for _, item := range obj.Prefixes().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *isisLspIpv4InternalReachabilityTlv) setDefault() { - -} - -// ***** IsisLspIpv4ExternalReachabilityTlv ***** -type isisLspIpv4ExternalReachabilityTlv struct { - validation - obj *otg.IsisLspIpv4ExternalReachabilityTlv - marshaller marshalIsisLspIpv4ExternalReachabilityTlv - unMarshaller unMarshalIsisLspIpv4ExternalReachabilityTlv - prefixesHolder IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter -} - -func NewIsisLspIpv4ExternalReachabilityTlv() IsisLspIpv4ExternalReachabilityTlv { - obj := isisLspIpv4ExternalReachabilityTlv{obj: &otg.IsisLspIpv4ExternalReachabilityTlv{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspIpv4ExternalReachabilityTlv) msg() *otg.IsisLspIpv4ExternalReachabilityTlv { - return obj.obj -} - -func (obj *isisLspIpv4ExternalReachabilityTlv) setMsg(msg *otg.IsisLspIpv4ExternalReachabilityTlv) IsisLspIpv4ExternalReachabilityTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspIpv4ExternalReachabilityTlv struct { - obj *isisLspIpv4ExternalReachabilityTlv -} - -type marshalIsisLspIpv4ExternalReachabilityTlv interface { - // ToProto marshals IsisLspIpv4ExternalReachabilityTlv to protobuf object *otg.IsisLspIpv4ExternalReachabilityTlv - ToProto() (*otg.IsisLspIpv4ExternalReachabilityTlv, error) - // ToPbText marshals IsisLspIpv4ExternalReachabilityTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspIpv4ExternalReachabilityTlv to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspIpv4ExternalReachabilityTlv to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspIpv4ExternalReachabilityTlv struct { - obj *isisLspIpv4ExternalReachabilityTlv -} - -type unMarshalIsisLspIpv4ExternalReachabilityTlv interface { - // FromProto unmarshals IsisLspIpv4ExternalReachabilityTlv from protobuf object *otg.IsisLspIpv4ExternalReachabilityTlv - FromProto(msg *otg.IsisLspIpv4ExternalReachabilityTlv) (IsisLspIpv4ExternalReachabilityTlv, error) - // FromPbText unmarshals IsisLspIpv4ExternalReachabilityTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspIpv4ExternalReachabilityTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspIpv4ExternalReachabilityTlv from JSON text - FromJson(value string) error -} - -func (obj *isisLspIpv4ExternalReachabilityTlv) Marshal() marshalIsisLspIpv4ExternalReachabilityTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspIpv4ExternalReachabilityTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspIpv4ExternalReachabilityTlv) Unmarshal() unMarshalIsisLspIpv4ExternalReachabilityTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspIpv4ExternalReachabilityTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspIpv4ExternalReachabilityTlv) ToProto() (*otg.IsisLspIpv4ExternalReachabilityTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspIpv4ExternalReachabilityTlv) FromProto(msg *otg.IsisLspIpv4ExternalReachabilityTlv) (IsisLspIpv4ExternalReachabilityTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspIpv4ExternalReachabilityTlv) 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 *unMarshalisisLspIpv4ExternalReachabilityTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisLspIpv4ExternalReachabilityTlv) 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 *unMarshalisisLspIpv4ExternalReachabilityTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisLspIpv4ExternalReachabilityTlv) 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 *unMarshalisisLspIpv4ExternalReachabilityTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisLspIpv4ExternalReachabilityTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspIpv4ExternalReachabilityTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspIpv4ExternalReachabilityTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspIpv4ExternalReachabilityTlv) Clone() (IsisLspIpv4ExternalReachabilityTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspIpv4ExternalReachabilityTlv() - 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 -} - -func (obj *isisLspIpv4ExternalReachabilityTlv) setNil() { - obj.prefixesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisLspIpv4ExternalReachabilityTlv is this container defines list of IPv4 external reachability information in one IPv4 external reachability TLV. -// This is advertised when the origin-type is set 'external' in route range configurations. -type IsisLspIpv4ExternalReachabilityTlv interface { - Validation - // msg marshals IsisLspIpv4ExternalReachabilityTlv to protobuf object *otg.IsisLspIpv4ExternalReachabilityTlv - // and doesn't set defaults - msg() *otg.IsisLspIpv4ExternalReachabilityTlv - // setMsg unmarshals IsisLspIpv4ExternalReachabilityTlv from protobuf object *otg.IsisLspIpv4ExternalReachabilityTlv - // and doesn't set defaults - setMsg(*otg.IsisLspIpv4ExternalReachabilityTlv) IsisLspIpv4ExternalReachabilityTlv - // provides marshal interface - Marshal() marshalIsisLspIpv4ExternalReachabilityTlv - // provides unmarshal interface - Unmarshal() unMarshalIsisLspIpv4ExternalReachabilityTlv - // validate validates IsisLspIpv4ExternalReachabilityTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspIpv4ExternalReachabilityTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Prefixes returns IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIterIter, set in IsisLspIpv4ExternalReachabilityTlv - Prefixes() IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter - setNil() -} - -// Describes list of IPv4 prefixes in this TLV.. -// Prefixes returns a []IsisLspV4Prefix -func (obj *isisLspIpv4ExternalReachabilityTlv) Prefixes() IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { - if len(obj.obj.Prefixes) == 0 { - obj.obj.Prefixes = []*otg.IsisLspV4Prefix{} - } - if obj.prefixesHolder == nil { - obj.prefixesHolder = newIsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter(&obj.obj.Prefixes).setMsg(obj) - } - return obj.prefixesHolder -} - -type isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter struct { - obj *isisLspIpv4ExternalReachabilityTlv - isisLspV4PrefixSlice []IsisLspV4Prefix - fieldPtr *[]*otg.IsisLspV4Prefix -} - -func newIsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter(ptr *[]*otg.IsisLspV4Prefix) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { - return &isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter{fieldPtr: ptr} -} - -type IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter interface { - setMsg(*isisLspIpv4ExternalReachabilityTlv) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter - Items() []IsisLspV4Prefix - Add() IsisLspV4Prefix - Append(items ...IsisLspV4Prefix) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter - Set(index int, newObj IsisLspV4Prefix) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter - Clear() IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter - clearHolderSlice() IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter - appendHolderSlice(item IsisLspV4Prefix) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter -} - -func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) setMsg(msg *isisLspIpv4ExternalReachabilityTlv) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspV4Prefix{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) Items() []IsisLspV4Prefix { - return obj.isisLspV4PrefixSlice -} - -func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) Add() IsisLspV4Prefix { - newObj := &otg.IsisLspV4Prefix{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspV4Prefix{obj: newObj} - newLibObj.setDefault() - obj.isisLspV4PrefixSlice = append(obj.isisLspV4PrefixSlice, newLibObj) - return newLibObj -} - -func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) Append(items ...IsisLspV4Prefix) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspV4PrefixSlice = append(obj.isisLspV4PrefixSlice, item) - } - return obj -} - -func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) Set(index int, newObj IsisLspV4Prefix) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspV4PrefixSlice[index] = newObj - return obj -} -func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) Clear() IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspV4Prefix{} - obj.isisLspV4PrefixSlice = []IsisLspV4Prefix{} - } - return obj -} -func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) clearHolderSlice() IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { - if len(obj.isisLspV4PrefixSlice) > 0 { - obj.isisLspV4PrefixSlice = []IsisLspV4Prefix{} - } - return obj -} -func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) appendHolderSlice(item IsisLspV4Prefix) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { - obj.isisLspV4PrefixSlice = append(obj.isisLspV4PrefixSlice, item) - return obj -} - -func (obj *isisLspIpv4ExternalReachabilityTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Prefixes) != 0 { - - if set_default { - obj.Prefixes().clearHolderSlice() - for _, item := range obj.obj.Prefixes { - obj.Prefixes().appendHolderSlice(&isisLspV4Prefix{obj: item}) - } - } - for _, item := range obj.Prefixes().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *isisLspIpv4ExternalReachabilityTlv) setDefault() { - -} - -// ***** IsisLspExtendedIpv4ReachabilityTlv ***** -type isisLspExtendedIpv4ReachabilityTlv struct { - validation - obj *otg.IsisLspExtendedIpv4ReachabilityTlv - marshaller marshalIsisLspExtendedIpv4ReachabilityTlv - unMarshaller unMarshalIsisLspExtendedIpv4ReachabilityTlv - prefixesHolder IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter -} - -func NewIsisLspExtendedIpv4ReachabilityTlv() IsisLspExtendedIpv4ReachabilityTlv { - obj := isisLspExtendedIpv4ReachabilityTlv{obj: &otg.IsisLspExtendedIpv4ReachabilityTlv{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspExtendedIpv4ReachabilityTlv) msg() *otg.IsisLspExtendedIpv4ReachabilityTlv { - return obj.obj -} - -func (obj *isisLspExtendedIpv4ReachabilityTlv) setMsg(msg *otg.IsisLspExtendedIpv4ReachabilityTlv) IsisLspExtendedIpv4ReachabilityTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspExtendedIpv4ReachabilityTlv struct { - obj *isisLspExtendedIpv4ReachabilityTlv -} - -type marshalIsisLspExtendedIpv4ReachabilityTlv interface { - // ToProto marshals IsisLspExtendedIpv4ReachabilityTlv to protobuf object *otg.IsisLspExtendedIpv4ReachabilityTlv - ToProto() (*otg.IsisLspExtendedIpv4ReachabilityTlv, error) - // ToPbText marshals IsisLspExtendedIpv4ReachabilityTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspExtendedIpv4ReachabilityTlv to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspExtendedIpv4ReachabilityTlv to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspExtendedIpv4ReachabilityTlv struct { - obj *isisLspExtendedIpv4ReachabilityTlv -} - -type unMarshalIsisLspExtendedIpv4ReachabilityTlv interface { - // FromProto unmarshals IsisLspExtendedIpv4ReachabilityTlv from protobuf object *otg.IsisLspExtendedIpv4ReachabilityTlv - FromProto(msg *otg.IsisLspExtendedIpv4ReachabilityTlv) (IsisLspExtendedIpv4ReachabilityTlv, error) - // FromPbText unmarshals IsisLspExtendedIpv4ReachabilityTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspExtendedIpv4ReachabilityTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspExtendedIpv4ReachabilityTlv from JSON text - FromJson(value string) error -} - -func (obj *isisLspExtendedIpv4ReachabilityTlv) Marshal() marshalIsisLspExtendedIpv4ReachabilityTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspExtendedIpv4ReachabilityTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspExtendedIpv4ReachabilityTlv) Unmarshal() unMarshalIsisLspExtendedIpv4ReachabilityTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspExtendedIpv4ReachabilityTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspExtendedIpv4ReachabilityTlv) ToProto() (*otg.IsisLspExtendedIpv4ReachabilityTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspExtendedIpv4ReachabilityTlv) FromProto(msg *otg.IsisLspExtendedIpv4ReachabilityTlv) (IsisLspExtendedIpv4ReachabilityTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspExtendedIpv4ReachabilityTlv) 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 *unMarshalisisLspExtendedIpv4ReachabilityTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisLspExtendedIpv4ReachabilityTlv) 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 *unMarshalisisLspExtendedIpv4ReachabilityTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisLspExtendedIpv4ReachabilityTlv) 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 *unMarshalisisLspExtendedIpv4ReachabilityTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisLspExtendedIpv4ReachabilityTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspExtendedIpv4ReachabilityTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspExtendedIpv4ReachabilityTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspExtendedIpv4ReachabilityTlv) Clone() (IsisLspExtendedIpv4ReachabilityTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspExtendedIpv4ReachabilityTlv() - 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 -} - -func (obj *isisLspExtendedIpv4ReachabilityTlv) setNil() { - obj.prefixesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisLspExtendedIpv4ReachabilityTlv is this container defines list of IPv4 extended reachability information in one Extended IPv4 External Reachability TLV. -// It is advertised when the 'wide metric' is enabled. -type IsisLspExtendedIpv4ReachabilityTlv interface { - Validation - // msg marshals IsisLspExtendedIpv4ReachabilityTlv to protobuf object *otg.IsisLspExtendedIpv4ReachabilityTlv - // and doesn't set defaults - msg() *otg.IsisLspExtendedIpv4ReachabilityTlv - // setMsg unmarshals IsisLspExtendedIpv4ReachabilityTlv from protobuf object *otg.IsisLspExtendedIpv4ReachabilityTlv - // and doesn't set defaults - setMsg(*otg.IsisLspExtendedIpv4ReachabilityTlv) IsisLspExtendedIpv4ReachabilityTlv - // provides marshal interface - Marshal() marshalIsisLspExtendedIpv4ReachabilityTlv - // provides unmarshal interface - Unmarshal() unMarshalIsisLspExtendedIpv4ReachabilityTlv - // validate validates IsisLspExtendedIpv4ReachabilityTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspExtendedIpv4ReachabilityTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Prefixes returns IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIterIter, set in IsisLspExtendedIpv4ReachabilityTlv - Prefixes() IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter - setNil() -} - -// IPv4 prefix contained within extended reachability TLVs. -// Prefixes returns a []IsisLspExtendedV4Prefix -func (obj *isisLspExtendedIpv4ReachabilityTlv) Prefixes() IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { - if len(obj.obj.Prefixes) == 0 { - obj.obj.Prefixes = []*otg.IsisLspExtendedV4Prefix{} - } - if obj.prefixesHolder == nil { - obj.prefixesHolder = newIsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter(&obj.obj.Prefixes).setMsg(obj) - } - return obj.prefixesHolder -} - -type isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter struct { - obj *isisLspExtendedIpv4ReachabilityTlv - isisLspExtendedV4PrefixSlice []IsisLspExtendedV4Prefix - fieldPtr *[]*otg.IsisLspExtendedV4Prefix -} - -func newIsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter(ptr *[]*otg.IsisLspExtendedV4Prefix) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { - return &isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter{fieldPtr: ptr} -} - -type IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter interface { - setMsg(*isisLspExtendedIpv4ReachabilityTlv) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter - Items() []IsisLspExtendedV4Prefix - Add() IsisLspExtendedV4Prefix - Append(items ...IsisLspExtendedV4Prefix) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter - Set(index int, newObj IsisLspExtendedV4Prefix) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter - Clear() IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter - clearHolderSlice() IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter - appendHolderSlice(item IsisLspExtendedV4Prefix) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter -} - -func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) setMsg(msg *isisLspExtendedIpv4ReachabilityTlv) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspExtendedV4Prefix{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) Items() []IsisLspExtendedV4Prefix { - return obj.isisLspExtendedV4PrefixSlice -} - -func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) Add() IsisLspExtendedV4Prefix { - newObj := &otg.IsisLspExtendedV4Prefix{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspExtendedV4Prefix{obj: newObj} - newLibObj.setDefault() - obj.isisLspExtendedV4PrefixSlice = append(obj.isisLspExtendedV4PrefixSlice, newLibObj) - return newLibObj -} - -func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) Append(items ...IsisLspExtendedV4Prefix) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspExtendedV4PrefixSlice = append(obj.isisLspExtendedV4PrefixSlice, item) - } - return obj -} - -func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) Set(index int, newObj IsisLspExtendedV4Prefix) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspExtendedV4PrefixSlice[index] = newObj - return obj -} -func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) Clear() IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspExtendedV4Prefix{} - obj.isisLspExtendedV4PrefixSlice = []IsisLspExtendedV4Prefix{} - } - return obj -} -func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) clearHolderSlice() IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { - if len(obj.isisLspExtendedV4PrefixSlice) > 0 { - obj.isisLspExtendedV4PrefixSlice = []IsisLspExtendedV4Prefix{} - } - return obj -} -func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) appendHolderSlice(item IsisLspExtendedV4Prefix) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { - obj.isisLspExtendedV4PrefixSlice = append(obj.isisLspExtendedV4PrefixSlice, item) - return obj -} - -func (obj *isisLspExtendedIpv4ReachabilityTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Prefixes) != 0 { - - if set_default { - obj.Prefixes().clearHolderSlice() - for _, item := range obj.obj.Prefixes { - obj.Prefixes().appendHolderSlice(&isisLspExtendedV4Prefix{obj: item}) - } - } - for _, item := range obj.Prefixes().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *isisLspExtendedIpv4ReachabilityTlv) setDefault() { - -} - -// ***** IsisLspIpv6ReachabilityTlv ***** -type isisLspIpv6ReachabilityTlv struct { - validation - obj *otg.IsisLspIpv6ReachabilityTlv - marshaller marshalIsisLspIpv6ReachabilityTlv - unMarshaller unMarshalIsisLspIpv6ReachabilityTlv - prefixesHolder IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter -} - -func NewIsisLspIpv6ReachabilityTlv() IsisLspIpv6ReachabilityTlv { - obj := isisLspIpv6ReachabilityTlv{obj: &otg.IsisLspIpv6ReachabilityTlv{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspIpv6ReachabilityTlv) msg() *otg.IsisLspIpv6ReachabilityTlv { - return obj.obj -} - -func (obj *isisLspIpv6ReachabilityTlv) setMsg(msg *otg.IsisLspIpv6ReachabilityTlv) IsisLspIpv6ReachabilityTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspIpv6ReachabilityTlv struct { - obj *isisLspIpv6ReachabilityTlv -} - -type marshalIsisLspIpv6ReachabilityTlv interface { - // ToProto marshals IsisLspIpv6ReachabilityTlv to protobuf object *otg.IsisLspIpv6ReachabilityTlv - ToProto() (*otg.IsisLspIpv6ReachabilityTlv, error) - // ToPbText marshals IsisLspIpv6ReachabilityTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspIpv6ReachabilityTlv to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspIpv6ReachabilityTlv to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspIpv6ReachabilityTlv struct { - obj *isisLspIpv6ReachabilityTlv -} - -type unMarshalIsisLspIpv6ReachabilityTlv interface { - // FromProto unmarshals IsisLspIpv6ReachabilityTlv from protobuf object *otg.IsisLspIpv6ReachabilityTlv - FromProto(msg *otg.IsisLspIpv6ReachabilityTlv) (IsisLspIpv6ReachabilityTlv, error) - // FromPbText unmarshals IsisLspIpv6ReachabilityTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspIpv6ReachabilityTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspIpv6ReachabilityTlv from JSON text - FromJson(value string) error -} - -func (obj *isisLspIpv6ReachabilityTlv) Marshal() marshalIsisLspIpv6ReachabilityTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspIpv6ReachabilityTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspIpv6ReachabilityTlv) Unmarshal() unMarshalIsisLspIpv6ReachabilityTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspIpv6ReachabilityTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspIpv6ReachabilityTlv) ToProto() (*otg.IsisLspIpv6ReachabilityTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspIpv6ReachabilityTlv) FromProto(msg *otg.IsisLspIpv6ReachabilityTlv) (IsisLspIpv6ReachabilityTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspIpv6ReachabilityTlv) 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 *unMarshalisisLspIpv6ReachabilityTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisLspIpv6ReachabilityTlv) 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 *unMarshalisisLspIpv6ReachabilityTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisLspIpv6ReachabilityTlv) 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 *unMarshalisisLspIpv6ReachabilityTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisLspIpv6ReachabilityTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspIpv6ReachabilityTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspIpv6ReachabilityTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspIpv6ReachabilityTlv) Clone() (IsisLspIpv6ReachabilityTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspIpv6ReachabilityTlv() - 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 -} - -func (obj *isisLspIpv6ReachabilityTlv) setNil() { - obj.prefixesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisLspIpv6ReachabilityTlv is it defines list of IPv6 extended reachability information in one IPv6 Reachability TLV. -type IsisLspIpv6ReachabilityTlv interface { - Validation - // msg marshals IsisLspIpv6ReachabilityTlv to protobuf object *otg.IsisLspIpv6ReachabilityTlv - // and doesn't set defaults - msg() *otg.IsisLspIpv6ReachabilityTlv - // setMsg unmarshals IsisLspIpv6ReachabilityTlv from protobuf object *otg.IsisLspIpv6ReachabilityTlv - // and doesn't set defaults - setMsg(*otg.IsisLspIpv6ReachabilityTlv) IsisLspIpv6ReachabilityTlv - // provides marshal interface - Marshal() marshalIsisLspIpv6ReachabilityTlv - // provides unmarshal interface - Unmarshal() unMarshalIsisLspIpv6ReachabilityTlv - // validate validates IsisLspIpv6ReachabilityTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspIpv6ReachabilityTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Prefixes returns IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIterIter, set in IsisLspIpv6ReachabilityTlv - Prefixes() IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter - setNil() -} - -// IPv6 prefix contained within reachability TLVs. -// Prefixes returns a []IsisLspV6Prefix -func (obj *isisLspIpv6ReachabilityTlv) Prefixes() IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { - if len(obj.obj.Prefixes) == 0 { - obj.obj.Prefixes = []*otg.IsisLspV6Prefix{} - } - if obj.prefixesHolder == nil { - obj.prefixesHolder = newIsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter(&obj.obj.Prefixes).setMsg(obj) - } - return obj.prefixesHolder -} - -type isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter struct { - obj *isisLspIpv6ReachabilityTlv - isisLspV6PrefixSlice []IsisLspV6Prefix - fieldPtr *[]*otg.IsisLspV6Prefix -} - -func newIsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter(ptr *[]*otg.IsisLspV6Prefix) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { - return &isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter{fieldPtr: ptr} -} - -type IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter interface { - setMsg(*isisLspIpv6ReachabilityTlv) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter - Items() []IsisLspV6Prefix - Add() IsisLspV6Prefix - Append(items ...IsisLspV6Prefix) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter - Set(index int, newObj IsisLspV6Prefix) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter - Clear() IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter - clearHolderSlice() IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter - appendHolderSlice(item IsisLspV6Prefix) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter -} - -func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) setMsg(msg *isisLspIpv6ReachabilityTlv) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&isisLspV6Prefix{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) Items() []IsisLspV6Prefix { - return obj.isisLspV6PrefixSlice -} - -func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) Add() IsisLspV6Prefix { - newObj := &otg.IsisLspV6Prefix{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &isisLspV6Prefix{obj: newObj} - newLibObj.setDefault() - obj.isisLspV6PrefixSlice = append(obj.isisLspV6PrefixSlice, newLibObj) - return newLibObj -} - -func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) Append(items ...IsisLspV6Prefix) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.isisLspV6PrefixSlice = append(obj.isisLspV6PrefixSlice, item) - } - return obj -} - -func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) Set(index int, newObj IsisLspV6Prefix) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.isisLspV6PrefixSlice[index] = newObj - return obj -} -func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) Clear() IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.IsisLspV6Prefix{} - obj.isisLspV6PrefixSlice = []IsisLspV6Prefix{} - } - return obj -} -func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) clearHolderSlice() IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { - if len(obj.isisLspV6PrefixSlice) > 0 { - obj.isisLspV6PrefixSlice = []IsisLspV6Prefix{} - } - return obj -} -func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) appendHolderSlice(item IsisLspV6Prefix) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { - obj.isisLspV6PrefixSlice = append(obj.isisLspV6PrefixSlice, item) - return obj -} - -func (obj *isisLspIpv6ReachabilityTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Prefixes) != 0 { - - if set_default { - obj.Prefixes().clearHolderSlice() - for _, item := range obj.obj.Prefixes { - obj.Prefixes().appendHolderSlice(&isisLspV6Prefix{obj: item}) - } - } - for _, item := range obj.Prefixes().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *isisLspIpv6ReachabilityTlv) setDefault() { - -} - -// ***** BgpEthernetSegmentDfElection ***** -type bgpEthernetSegmentDfElection struct { - validation - obj *otg.BgpEthernetSegmentDfElection - marshaller marshalBgpEthernetSegmentDfElection - unMarshaller unMarshalBgpEthernetSegmentDfElection -} - -func NewBgpEthernetSegmentDfElection() BgpEthernetSegmentDfElection { - obj := bgpEthernetSegmentDfElection{obj: &otg.BgpEthernetSegmentDfElection{}} - obj.setDefault() - return &obj -} - -func (obj *bgpEthernetSegmentDfElection) msg() *otg.BgpEthernetSegmentDfElection { - return obj.obj -} - -func (obj *bgpEthernetSegmentDfElection) setMsg(msg *otg.BgpEthernetSegmentDfElection) BgpEthernetSegmentDfElection { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpEthernetSegmentDfElection struct { - obj *bgpEthernetSegmentDfElection -} - -type marshalBgpEthernetSegmentDfElection interface { - // ToProto marshals BgpEthernetSegmentDfElection to protobuf object *otg.BgpEthernetSegmentDfElection - ToProto() (*otg.BgpEthernetSegmentDfElection, error) - // ToPbText marshals BgpEthernetSegmentDfElection to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpEthernetSegmentDfElection to YAML text - ToYaml() (string, error) - // ToJson marshals BgpEthernetSegmentDfElection to JSON text - ToJson() (string, error) -} - -type unMarshalbgpEthernetSegmentDfElection struct { - obj *bgpEthernetSegmentDfElection -} - -type unMarshalBgpEthernetSegmentDfElection interface { - // FromProto unmarshals BgpEthernetSegmentDfElection from protobuf object *otg.BgpEthernetSegmentDfElection - FromProto(msg *otg.BgpEthernetSegmentDfElection) (BgpEthernetSegmentDfElection, error) - // FromPbText unmarshals BgpEthernetSegmentDfElection from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpEthernetSegmentDfElection from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpEthernetSegmentDfElection from JSON text - FromJson(value string) error -} - -func (obj *bgpEthernetSegmentDfElection) Marshal() marshalBgpEthernetSegmentDfElection { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpEthernetSegmentDfElection{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpEthernetSegmentDfElection) Unmarshal() unMarshalBgpEthernetSegmentDfElection { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpEthernetSegmentDfElection{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpEthernetSegmentDfElection) ToProto() (*otg.BgpEthernetSegmentDfElection, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpEthernetSegmentDfElection) FromProto(msg *otg.BgpEthernetSegmentDfElection) (BgpEthernetSegmentDfElection, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpEthernetSegmentDfElection) 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 *unMarshalbgpEthernetSegmentDfElection) 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 *marshalbgpEthernetSegmentDfElection) 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 *unMarshalbgpEthernetSegmentDfElection) 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 *marshalbgpEthernetSegmentDfElection) 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 *unMarshalbgpEthernetSegmentDfElection) 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 *bgpEthernetSegmentDfElection) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpEthernetSegmentDfElection) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpEthernetSegmentDfElection) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpEthernetSegmentDfElection) Clone() (BgpEthernetSegmentDfElection, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpEthernetSegmentDfElection() - 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 -} - -// BgpEthernetSegmentDfElection is configuration for Designated Forwarder (DF) election among the Provider Edge (PE) routers on the same Ethernet Segment. -type BgpEthernetSegmentDfElection interface { - Validation - // msg marshals BgpEthernetSegmentDfElection to protobuf object *otg.BgpEthernetSegmentDfElection - // and doesn't set defaults - msg() *otg.BgpEthernetSegmentDfElection - // setMsg unmarshals BgpEthernetSegmentDfElection from protobuf object *otg.BgpEthernetSegmentDfElection - // and doesn't set defaults - setMsg(*otg.BgpEthernetSegmentDfElection) BgpEthernetSegmentDfElection - // provides marshal interface - Marshal() marshalBgpEthernetSegmentDfElection - // provides unmarshal interface - Unmarshal() unMarshalBgpEthernetSegmentDfElection - // validate validates BgpEthernetSegmentDfElection - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpEthernetSegmentDfElection, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ElectionTimer returns uint32, set in BgpEthernetSegmentDfElection. - ElectionTimer() uint32 - // SetElectionTimer assigns uint32 provided by user to BgpEthernetSegmentDfElection - SetElectionTimer(value uint32) BgpEthernetSegmentDfElection - // HasElectionTimer checks if ElectionTimer has been set in BgpEthernetSegmentDfElection - HasElectionTimer() bool -} - -// The DF election timer in seconds. -// ElectionTimer returns a uint32 -func (obj *bgpEthernetSegmentDfElection) ElectionTimer() uint32 { - - return *obj.obj.ElectionTimer - -} - -// The DF election timer in seconds. -// ElectionTimer returns a uint32 -func (obj *bgpEthernetSegmentDfElection) HasElectionTimer() bool { - return obj.obj.ElectionTimer != nil -} - -// The DF election timer in seconds. -// SetElectionTimer sets the uint32 value in the BgpEthernetSegmentDfElection object -func (obj *bgpEthernetSegmentDfElection) SetElectionTimer(value uint32) BgpEthernetSegmentDfElection { - - obj.obj.ElectionTimer = &value - return obj -} - -func (obj *bgpEthernetSegmentDfElection) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.ElectionTimer != nil { - - if *obj.obj.ElectionTimer > 300 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpEthernetSegmentDfElection.ElectionTimer <= 300 but Got %d", *obj.obj.ElectionTimer)) - } - - } - -} - -func (obj *bgpEthernetSegmentDfElection) setDefault() { - if obj.obj.ElectionTimer == nil { - obj.SetElectionTimer(3) - } - -} - -// ***** BgpV4EvpnEvis ***** -type bgpV4EvpnEvis struct { - validation - obj *otg.BgpV4EvpnEvis - marshaller marshalBgpV4EvpnEvis - unMarshaller unMarshalBgpV4EvpnEvis - eviVxlanHolder BgpV4EviVxlan -} - -func NewBgpV4EvpnEvis() BgpV4EvpnEvis { - obj := bgpV4EvpnEvis{obj: &otg.BgpV4EvpnEvis{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV4EvpnEvis) msg() *otg.BgpV4EvpnEvis { - return obj.obj -} - -func (obj *bgpV4EvpnEvis) setMsg(msg *otg.BgpV4EvpnEvis) BgpV4EvpnEvis { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV4EvpnEvis struct { - obj *bgpV4EvpnEvis -} - -type marshalBgpV4EvpnEvis interface { - // ToProto marshals BgpV4EvpnEvis to protobuf object *otg.BgpV4EvpnEvis - ToProto() (*otg.BgpV4EvpnEvis, error) - // ToPbText marshals BgpV4EvpnEvis to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV4EvpnEvis to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV4EvpnEvis to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV4EvpnEvis struct { - obj *bgpV4EvpnEvis -} - -type unMarshalBgpV4EvpnEvis interface { - // FromProto unmarshals BgpV4EvpnEvis from protobuf object *otg.BgpV4EvpnEvis - FromProto(msg *otg.BgpV4EvpnEvis) (BgpV4EvpnEvis, error) - // FromPbText unmarshals BgpV4EvpnEvis from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV4EvpnEvis from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV4EvpnEvis from JSON text - FromJson(value string) error -} - -func (obj *bgpV4EvpnEvis) Marshal() marshalBgpV4EvpnEvis { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV4EvpnEvis{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV4EvpnEvis) Unmarshal() unMarshalBgpV4EvpnEvis { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV4EvpnEvis{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV4EvpnEvis) ToProto() (*otg.BgpV4EvpnEvis, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV4EvpnEvis) FromProto(msg *otg.BgpV4EvpnEvis) (BgpV4EvpnEvis, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV4EvpnEvis) 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 *unMarshalbgpV4EvpnEvis) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpV4EvpnEvis) 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 *unMarshalbgpV4EvpnEvis) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpV4EvpnEvis) 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 *unMarshalbgpV4EvpnEvis) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpV4EvpnEvis) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV4EvpnEvis) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV4EvpnEvis) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV4EvpnEvis) Clone() (BgpV4EvpnEvis, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV4EvpnEvis() - 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 -} - -func (obj *bgpV4EvpnEvis) setNil() { - obj.eviVxlanHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpV4EvpnEvis is this contains a list of different flavors of EVPN. -// For example EVPN over VXLAN or EVPN over MPLS etc to be configured per Ethernet segment. -// Need to instantiate correct type of EVPN instance as per requirement. -type BgpV4EvpnEvis interface { - Validation - // msg marshals BgpV4EvpnEvis to protobuf object *otg.BgpV4EvpnEvis - // and doesn't set defaults - msg() *otg.BgpV4EvpnEvis - // setMsg unmarshals BgpV4EvpnEvis from protobuf object *otg.BgpV4EvpnEvis - // and doesn't set defaults - setMsg(*otg.BgpV4EvpnEvis) BgpV4EvpnEvis - // provides marshal interface - Marshal() marshalBgpV4EvpnEvis - // provides unmarshal interface - Unmarshal() unMarshalBgpV4EvpnEvis - // validate validates BgpV4EvpnEvis - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV4EvpnEvis, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpV4EvpnEvisChoiceEnum, set in BgpV4EvpnEvis - Choice() BgpV4EvpnEvisChoiceEnum - // setChoice assigns BgpV4EvpnEvisChoiceEnum provided by user to BgpV4EvpnEvis - setChoice(value BgpV4EvpnEvisChoiceEnum) BgpV4EvpnEvis - // HasChoice checks if Choice has been set in BgpV4EvpnEvis - HasChoice() bool - // EviVxlan returns BgpV4EviVxlan, set in BgpV4EvpnEvis. - // BgpV4EviVxlan is configuration for BGP EVPN EVI. Advertises following routes - - // - // # Type 3 - Inclusive Multicast Ethernet Tag Route - // - // Type 1 - Ethernet Auto-discovery Route (Per EVI) - // - // Type 1 - Ethernet Auto-discovery Route (Per ES) - EviVxlan() BgpV4EviVxlan - // SetEviVxlan assigns BgpV4EviVxlan provided by user to BgpV4EvpnEvis. - // BgpV4EviVxlan is configuration for BGP EVPN EVI. Advertises following routes - - // - // # Type 3 - Inclusive Multicast Ethernet Tag Route - // - // Type 1 - Ethernet Auto-discovery Route (Per EVI) - // - // Type 1 - Ethernet Auto-discovery Route (Per ES) - SetEviVxlan(value BgpV4EviVxlan) BgpV4EvpnEvis - // HasEviVxlan checks if EviVxlan has been set in BgpV4EvpnEvis - HasEviVxlan() bool - setNil() -} - -type BgpV4EvpnEvisChoiceEnum string - -// Enum of Choice on BgpV4EvpnEvis -var BgpV4EvpnEvisChoice = struct { - EVI_VXLAN BgpV4EvpnEvisChoiceEnum -}{ - EVI_VXLAN: BgpV4EvpnEvisChoiceEnum("evi_vxlan"), -} - -func (obj *bgpV4EvpnEvis) Choice() BgpV4EvpnEvisChoiceEnum { - return BgpV4EvpnEvisChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *bgpV4EvpnEvis) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpV4EvpnEvis) setChoice(value BgpV4EvpnEvisChoiceEnum) BgpV4EvpnEvis { - intValue, ok := otg.BgpV4EvpnEvis_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpV4EvpnEvisChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpV4EvpnEvis_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.EviVxlan = nil - obj.eviVxlanHolder = nil - - if value == BgpV4EvpnEvisChoice.EVI_VXLAN { - obj.obj.EviVxlan = NewBgpV4EviVxlan().msg() - } - - return obj -} - -// EVPN VXLAN instance to be configured per Ethernet Segment. -// EviVxlan returns a BgpV4EviVxlan -func (obj *bgpV4EvpnEvis) EviVxlan() BgpV4EviVxlan { - if obj.obj.EviVxlan == nil { - obj.setChoice(BgpV4EvpnEvisChoice.EVI_VXLAN) - } - if obj.eviVxlanHolder == nil { - obj.eviVxlanHolder = &bgpV4EviVxlan{obj: obj.obj.EviVxlan} - } - return obj.eviVxlanHolder -} - -// EVPN VXLAN instance to be configured per Ethernet Segment. -// EviVxlan returns a BgpV4EviVxlan -func (obj *bgpV4EvpnEvis) HasEviVxlan() bool { - return obj.obj.EviVxlan != nil -} - -// EVPN VXLAN instance to be configured per Ethernet Segment. -// SetEviVxlan sets the BgpV4EviVxlan value in the BgpV4EvpnEvis object -func (obj *bgpV4EvpnEvis) SetEviVxlan(value BgpV4EviVxlan) BgpV4EvpnEvis { - obj.setChoice(BgpV4EvpnEvisChoice.EVI_VXLAN) - obj.eviVxlanHolder = nil - obj.obj.EviVxlan = value.msg() - - return obj -} - -func (obj *bgpV4EvpnEvis) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.EviVxlan != nil { - - obj.EviVxlan().validateObj(vObj, set_default) - } - -} - -func (obj *bgpV4EvpnEvis) setDefault() { - var choices_set int = 0 - var choice BgpV4EvpnEvisChoiceEnum - - if obj.obj.EviVxlan != nil { - choices_set += 1 - choice = BgpV4EvpnEvisChoice.EVI_VXLAN - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(BgpV4EvpnEvisChoice.EVI_VXLAN) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpV4EvpnEvis") - } - } else { - intVal := otg.BgpV4EvpnEvis_Choice_Enum_value[string(choice)] - enumValue := otg.BgpV4EvpnEvis_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpRouteAdvanced ***** -type bgpRouteAdvanced struct { - validation - obj *otg.BgpRouteAdvanced - marshaller marshalBgpRouteAdvanced - unMarshaller unMarshalBgpRouteAdvanced -} - -func NewBgpRouteAdvanced() BgpRouteAdvanced { - obj := bgpRouteAdvanced{obj: &otg.BgpRouteAdvanced{}} - obj.setDefault() - return &obj -} - -func (obj *bgpRouteAdvanced) msg() *otg.BgpRouteAdvanced { - return obj.obj -} - -func (obj *bgpRouteAdvanced) setMsg(msg *otg.BgpRouteAdvanced) BgpRouteAdvanced { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpRouteAdvanced struct { - obj *bgpRouteAdvanced -} - -type marshalBgpRouteAdvanced interface { - // ToProto marshals BgpRouteAdvanced to protobuf object *otg.BgpRouteAdvanced - ToProto() (*otg.BgpRouteAdvanced, error) - // ToPbText marshals BgpRouteAdvanced to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpRouteAdvanced to YAML text - ToYaml() (string, error) - // ToJson marshals BgpRouteAdvanced to JSON text - ToJson() (string, error) -} - -type unMarshalbgpRouteAdvanced struct { - obj *bgpRouteAdvanced -} - -type unMarshalBgpRouteAdvanced interface { - // FromProto unmarshals BgpRouteAdvanced from protobuf object *otg.BgpRouteAdvanced - FromProto(msg *otg.BgpRouteAdvanced) (BgpRouteAdvanced, error) - // FromPbText unmarshals BgpRouteAdvanced from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpRouteAdvanced from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpRouteAdvanced from JSON text - FromJson(value string) error -} - -func (obj *bgpRouteAdvanced) Marshal() marshalBgpRouteAdvanced { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpRouteAdvanced{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpRouteAdvanced) Unmarshal() unMarshalBgpRouteAdvanced { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpRouteAdvanced{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpRouteAdvanced) ToProto() (*otg.BgpRouteAdvanced, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpRouteAdvanced) FromProto(msg *otg.BgpRouteAdvanced) (BgpRouteAdvanced, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpRouteAdvanced) 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 *unMarshalbgpRouteAdvanced) 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 *marshalbgpRouteAdvanced) 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 *unMarshalbgpRouteAdvanced) 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 *marshalbgpRouteAdvanced) 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 *unMarshalbgpRouteAdvanced) 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 *bgpRouteAdvanced) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpRouteAdvanced) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpRouteAdvanced) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpRouteAdvanced) Clone() (BgpRouteAdvanced, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpRouteAdvanced() - 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 -} - -// BgpRouteAdvanced is configuration for advanced BGP route range settings. -type BgpRouteAdvanced interface { - Validation - // msg marshals BgpRouteAdvanced to protobuf object *otg.BgpRouteAdvanced - // and doesn't set defaults - msg() *otg.BgpRouteAdvanced - // setMsg unmarshals BgpRouteAdvanced from protobuf object *otg.BgpRouteAdvanced - // and doesn't set defaults - setMsg(*otg.BgpRouteAdvanced) BgpRouteAdvanced - // provides marshal interface - Marshal() marshalBgpRouteAdvanced - // provides unmarshal interface - Unmarshal() unMarshalBgpRouteAdvanced - // validate validates BgpRouteAdvanced - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpRouteAdvanced, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // IncludeMultiExitDiscriminator returns bool, set in BgpRouteAdvanced. - IncludeMultiExitDiscriminator() bool - // SetIncludeMultiExitDiscriminator assigns bool provided by user to BgpRouteAdvanced - SetIncludeMultiExitDiscriminator(value bool) BgpRouteAdvanced - // HasIncludeMultiExitDiscriminator checks if IncludeMultiExitDiscriminator has been set in BgpRouteAdvanced - HasIncludeMultiExitDiscriminator() bool - // MultiExitDiscriminator returns uint32, set in BgpRouteAdvanced. - MultiExitDiscriminator() uint32 - // SetMultiExitDiscriminator assigns uint32 provided by user to BgpRouteAdvanced - SetMultiExitDiscriminator(value uint32) BgpRouteAdvanced - // HasMultiExitDiscriminator checks if MultiExitDiscriminator has been set in BgpRouteAdvanced - HasMultiExitDiscriminator() bool - // IncludeOrigin returns bool, set in BgpRouteAdvanced. - IncludeOrigin() bool - // SetIncludeOrigin assigns bool provided by user to BgpRouteAdvanced - SetIncludeOrigin(value bool) BgpRouteAdvanced - // HasIncludeOrigin checks if IncludeOrigin has been set in BgpRouteAdvanced - HasIncludeOrigin() bool - // Origin returns BgpRouteAdvancedOriginEnum, set in BgpRouteAdvanced - Origin() BgpRouteAdvancedOriginEnum - // SetOrigin assigns BgpRouteAdvancedOriginEnum provided by user to BgpRouteAdvanced - SetOrigin(value BgpRouteAdvancedOriginEnum) BgpRouteAdvanced - // HasOrigin checks if Origin has been set in BgpRouteAdvanced - HasOrigin() bool - // IncludeLocalPreference returns bool, set in BgpRouteAdvanced. - IncludeLocalPreference() bool - // SetIncludeLocalPreference assigns bool provided by user to BgpRouteAdvanced - SetIncludeLocalPreference(value bool) BgpRouteAdvanced - // HasIncludeLocalPreference checks if IncludeLocalPreference has been set in BgpRouteAdvanced - HasIncludeLocalPreference() bool - // LocalPreference returns uint32, set in BgpRouteAdvanced. - LocalPreference() uint32 - // SetLocalPreference assigns uint32 provided by user to BgpRouteAdvanced - SetLocalPreference(value uint32) BgpRouteAdvanced - // HasLocalPreference checks if LocalPreference has been set in BgpRouteAdvanced - HasLocalPreference() bool -} - -// BGP Multi Exit Discriminator attribute sent to the peer to help in the route selection process. If set to true, the Multi Exit Discriminator attribute will be included in the route advertisement. -// IncludeMultiExitDiscriminator returns a bool -func (obj *bgpRouteAdvanced) IncludeMultiExitDiscriminator() bool { - - return *obj.obj.IncludeMultiExitDiscriminator - -} - -// BGP Multi Exit Discriminator attribute sent to the peer to help in the route selection process. If set to true, the Multi Exit Discriminator attribute will be included in the route advertisement. -// IncludeMultiExitDiscriminator returns a bool -func (obj *bgpRouteAdvanced) HasIncludeMultiExitDiscriminator() bool { - return obj.obj.IncludeMultiExitDiscriminator != nil -} - -// BGP Multi Exit Discriminator attribute sent to the peer to help in the route selection process. If set to true, the Multi Exit Discriminator attribute will be included in the route advertisement. -// SetIncludeMultiExitDiscriminator sets the bool value in the BgpRouteAdvanced object -func (obj *bgpRouteAdvanced) SetIncludeMultiExitDiscriminator(value bool) BgpRouteAdvanced { - - obj.obj.IncludeMultiExitDiscriminator = &value - return obj -} - -// The multi exit discriminator (MED) value used for route selection sent to the peer. -// MultiExitDiscriminator returns a uint32 -func (obj *bgpRouteAdvanced) MultiExitDiscriminator() uint32 { - - return *obj.obj.MultiExitDiscriminator - -} - -// The multi exit discriminator (MED) value used for route selection sent to the peer. -// MultiExitDiscriminator returns a uint32 -func (obj *bgpRouteAdvanced) HasMultiExitDiscriminator() bool { - return obj.obj.MultiExitDiscriminator != nil -} - -// The multi exit discriminator (MED) value used for route selection sent to the peer. -// SetMultiExitDiscriminator sets the uint32 value in the BgpRouteAdvanced object -func (obj *bgpRouteAdvanced) SetMultiExitDiscriminator(value uint32) BgpRouteAdvanced { - - obj.obj.MultiExitDiscriminator = &value - return obj -} - -// If set to true, the Origin attribute will be included in the route advertisement. -// IncludeOrigin returns a bool -func (obj *bgpRouteAdvanced) IncludeOrigin() bool { - - return *obj.obj.IncludeOrigin - -} - -// If set to true, the Origin attribute will be included in the route advertisement. -// IncludeOrigin returns a bool -func (obj *bgpRouteAdvanced) HasIncludeOrigin() bool { - return obj.obj.IncludeOrigin != nil -} - -// If set to true, the Origin attribute will be included in the route advertisement. -// SetIncludeOrigin sets the bool value in the BgpRouteAdvanced object -func (obj *bgpRouteAdvanced) SetIncludeOrigin(value bool) BgpRouteAdvanced { - - obj.obj.IncludeOrigin = &value - return obj -} - -type BgpRouteAdvancedOriginEnum string - -// Enum of Origin on BgpRouteAdvanced -var BgpRouteAdvancedOrigin = struct { - IGP BgpRouteAdvancedOriginEnum - EGP BgpRouteAdvancedOriginEnum - INCOMPLETE BgpRouteAdvancedOriginEnum -}{ - IGP: BgpRouteAdvancedOriginEnum("igp"), - EGP: BgpRouteAdvancedOriginEnum("egp"), - INCOMPLETE: BgpRouteAdvancedOriginEnum("incomplete"), -} - -func (obj *bgpRouteAdvanced) Origin() BgpRouteAdvancedOriginEnum { - return BgpRouteAdvancedOriginEnum(obj.obj.Origin.Enum().String()) -} - -// The origin attribute of a prefix can take three values: the prefix originates from an interior routing protocol 'igp', it originates from 'egp' or the origin is 'incomplete', if the prefix is learned through other means. -// Origin returns a string -func (obj *bgpRouteAdvanced) HasOrigin() bool { - return obj.obj.Origin != nil -} - -func (obj *bgpRouteAdvanced) SetOrigin(value BgpRouteAdvancedOriginEnum) BgpRouteAdvanced { - intValue, ok := otg.BgpRouteAdvanced_Origin_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpRouteAdvancedOriginEnum", string(value))) - return obj - } - enumValue := otg.BgpRouteAdvanced_Origin_Enum(intValue) - obj.obj.Origin = &enumValue - - return obj -} - -// BGP Local Preference attribute sent to the peer to indicate the degree of preference for externally learned routes. If set to true, the Local Preference attribute will be included in the route advertisement. This should be included only for internal peers. -// IncludeLocalPreference returns a bool -func (obj *bgpRouteAdvanced) IncludeLocalPreference() bool { - - return *obj.obj.IncludeLocalPreference - -} - -// BGP Local Preference attribute sent to the peer to indicate the degree of preference for externally learned routes. If set to true, the Local Preference attribute will be included in the route advertisement. This should be included only for internal peers. -// IncludeLocalPreference returns a bool -func (obj *bgpRouteAdvanced) HasIncludeLocalPreference() bool { - return obj.obj.IncludeLocalPreference != nil -} - -// BGP Local Preference attribute sent to the peer to indicate the degree of preference for externally learned routes. If set to true, the Local Preference attribute will be included in the route advertisement. This should be included only for internal peers. -// SetIncludeLocalPreference sets the bool value in the BgpRouteAdvanced object -func (obj *bgpRouteAdvanced) SetIncludeLocalPreference(value bool) BgpRouteAdvanced { - - obj.obj.IncludeLocalPreference = &value - return obj -} - -// Value to be set in Local Preference attribute if include_local_preference is set to true. It is used for the selection of the path for the traffic leaving the AS. The route with the highest local preference value is preferred. -// LocalPreference returns a uint32 -func (obj *bgpRouteAdvanced) LocalPreference() uint32 { - - return *obj.obj.LocalPreference - -} - -// Value to be set in Local Preference attribute if include_local_preference is set to true. It is used for the selection of the path for the traffic leaving the AS. The route with the highest local preference value is preferred. -// LocalPreference returns a uint32 -func (obj *bgpRouteAdvanced) HasLocalPreference() bool { - return obj.obj.LocalPreference != nil -} - -// Value to be set in Local Preference attribute if include_local_preference is set to true. It is used for the selection of the path for the traffic leaving the AS. The route with the highest local preference value is preferred. -// SetLocalPreference sets the uint32 value in the BgpRouteAdvanced object -func (obj *bgpRouteAdvanced) SetLocalPreference(value uint32) BgpRouteAdvanced { - - obj.obj.LocalPreference = &value - return obj -} - -func (obj *bgpRouteAdvanced) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpRouteAdvanced) setDefault() { - if obj.obj.IncludeMultiExitDiscriminator == nil { - obj.SetIncludeMultiExitDiscriminator(true) - } - if obj.obj.IncludeOrigin == nil { - obj.SetIncludeOrigin(true) - } - if obj.obj.Origin == nil { - obj.SetOrigin(BgpRouteAdvancedOrigin.IGP) - - } - if obj.obj.IncludeLocalPreference == nil { - obj.SetIncludeLocalPreference(true) - } - if obj.obj.LocalPreference == nil { - obj.SetLocalPreference(100) - } - -} - -// ***** BgpCommunity ***** -type bgpCommunity struct { - validation - obj *otg.BgpCommunity - marshaller marshalBgpCommunity - unMarshaller unMarshalBgpCommunity -} - -func NewBgpCommunity() BgpCommunity { - obj := bgpCommunity{obj: &otg.BgpCommunity{}} - obj.setDefault() - return &obj -} - -func (obj *bgpCommunity) msg() *otg.BgpCommunity { - return obj.obj -} - -func (obj *bgpCommunity) setMsg(msg *otg.BgpCommunity) BgpCommunity { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpCommunity struct { - obj *bgpCommunity -} - -type marshalBgpCommunity interface { - // ToProto marshals BgpCommunity to protobuf object *otg.BgpCommunity - ToProto() (*otg.BgpCommunity, error) - // ToPbText marshals BgpCommunity to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpCommunity to YAML text - ToYaml() (string, error) - // ToJson marshals BgpCommunity to JSON text - ToJson() (string, error) -} - -type unMarshalbgpCommunity struct { - obj *bgpCommunity -} - -type unMarshalBgpCommunity interface { - // FromProto unmarshals BgpCommunity from protobuf object *otg.BgpCommunity - FromProto(msg *otg.BgpCommunity) (BgpCommunity, error) - // FromPbText unmarshals BgpCommunity from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpCommunity from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpCommunity from JSON text - FromJson(value string) error -} - -func (obj *bgpCommunity) Marshal() marshalBgpCommunity { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpCommunity{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpCommunity) Unmarshal() unMarshalBgpCommunity { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpCommunity{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpCommunity) ToProto() (*otg.BgpCommunity, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpCommunity) FromProto(msg *otg.BgpCommunity) (BgpCommunity, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpCommunity) 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 *unMarshalbgpCommunity) 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 *marshalbgpCommunity) 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 *unMarshalbgpCommunity) 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 *marshalbgpCommunity) 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 *unMarshalbgpCommunity) 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 *bgpCommunity) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpCommunity) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpCommunity) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpCommunity) Clone() (BgpCommunity, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpCommunity() - 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 -} - -// BgpCommunity is bGP communities provide additional capability for tagging routes and for modifying BGP routing policy on upstream and downstream routers. BGP community is a 32-bit number which is broken into 16-bit AS number and a 16-bit custom value. -type BgpCommunity interface { - Validation - // msg marshals BgpCommunity to protobuf object *otg.BgpCommunity - // and doesn't set defaults - msg() *otg.BgpCommunity - // setMsg unmarshals BgpCommunity from protobuf object *otg.BgpCommunity - // and doesn't set defaults - setMsg(*otg.BgpCommunity) BgpCommunity - // provides marshal interface - Marshal() marshalBgpCommunity - // provides unmarshal interface - Unmarshal() unMarshalBgpCommunity - // validate validates BgpCommunity - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpCommunity, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Type returns BgpCommunityTypeEnum, set in BgpCommunity - Type() BgpCommunityTypeEnum - // SetType assigns BgpCommunityTypeEnum provided by user to BgpCommunity - SetType(value BgpCommunityTypeEnum) BgpCommunity - // HasType checks if Type has been set in BgpCommunity - HasType() bool - // AsNumber returns uint32, set in BgpCommunity. - AsNumber() uint32 - // SetAsNumber assigns uint32 provided by user to BgpCommunity - SetAsNumber(value uint32) BgpCommunity - // HasAsNumber checks if AsNumber has been set in BgpCommunity - HasAsNumber() bool - // AsCustom returns uint32, set in BgpCommunity. - AsCustom() uint32 - // SetAsCustom assigns uint32 provided by user to BgpCommunity - SetAsCustom(value uint32) BgpCommunity - // HasAsCustom checks if AsCustom has been set in BgpCommunity - HasAsCustom() bool -} - -type BgpCommunityTypeEnum string - -// Enum of Type on BgpCommunity -var BgpCommunityType = struct { - MANUAL_AS_NUMBER BgpCommunityTypeEnum - NO_EXPORT BgpCommunityTypeEnum - NO_ADVERTISED BgpCommunityTypeEnum - NO_EXPORT_SUBCONFED BgpCommunityTypeEnum - LLGR_STALE BgpCommunityTypeEnum - NO_LLGR BgpCommunityTypeEnum -}{ - MANUAL_AS_NUMBER: BgpCommunityTypeEnum("manual_as_number"), - NO_EXPORT: BgpCommunityTypeEnum("no_export"), - NO_ADVERTISED: BgpCommunityTypeEnum("no_advertised"), - NO_EXPORT_SUBCONFED: BgpCommunityTypeEnum("no_export_subconfed"), - LLGR_STALE: BgpCommunityTypeEnum("llgr_stale"), - NO_LLGR: BgpCommunityTypeEnum("no_llgr"), -} - -func (obj *bgpCommunity) Type() BgpCommunityTypeEnum { - return BgpCommunityTypeEnum(obj.obj.Type.Enum().String()) -} - -// The type of community AS number. -// Type returns a string -func (obj *bgpCommunity) HasType() bool { - return obj.obj.Type != nil -} - -func (obj *bgpCommunity) SetType(value BgpCommunityTypeEnum) BgpCommunity { - intValue, ok := otg.BgpCommunity_Type_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpCommunityTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpCommunity_Type_Enum(intValue) - obj.obj.Type = &enumValue - - return obj -} - -// First two octets of 32 bit community AS number. -// AsNumber returns a uint32 -func (obj *bgpCommunity) AsNumber() uint32 { - - return *obj.obj.AsNumber - -} - -// First two octets of 32 bit community AS number. -// AsNumber returns a uint32 -func (obj *bgpCommunity) HasAsNumber() bool { - return obj.obj.AsNumber != nil -} - -// First two octets of 32 bit community AS number. -// SetAsNumber sets the uint32 value in the BgpCommunity object -func (obj *bgpCommunity) SetAsNumber(value uint32) BgpCommunity { - - obj.obj.AsNumber = &value - return obj -} - -// Last two octets of the community value. -// AsCustom returns a uint32 -func (obj *bgpCommunity) AsCustom() uint32 { - - return *obj.obj.AsCustom - -} - -// Last two octets of the community value. -// AsCustom returns a uint32 -func (obj *bgpCommunity) HasAsCustom() bool { - return obj.obj.AsCustom != nil -} - -// Last two octets of the community value. -// SetAsCustom sets the uint32 value in the BgpCommunity object -func (obj *bgpCommunity) SetAsCustom(value uint32) BgpCommunity { - - obj.obj.AsCustom = &value - return obj -} - -func (obj *bgpCommunity) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.AsNumber != nil { - - if *obj.obj.AsNumber > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpCommunity.AsNumber <= 65535 but Got %d", *obj.obj.AsNumber)) - } - - } - - if obj.obj.AsCustom != nil { - - if *obj.obj.AsCustom > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpCommunity.AsCustom <= 65535 but Got %d", *obj.obj.AsCustom)) - } - - } - -} - -func (obj *bgpCommunity) setDefault() { - if obj.obj.AsNumber == nil { - obj.SetAsNumber(0) - } - if obj.obj.AsCustom == nil { - obj.SetAsCustom(0) - } - -} - -// ***** BgpExtCommunity ***** -type bgpExtCommunity struct { - validation - obj *otg.BgpExtCommunity - marshaller marshalBgpExtCommunity - unMarshaller unMarshalBgpExtCommunity -} - -func NewBgpExtCommunity() BgpExtCommunity { - obj := bgpExtCommunity{obj: &otg.BgpExtCommunity{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtCommunity) msg() *otg.BgpExtCommunity { - return obj.obj -} - -func (obj *bgpExtCommunity) setMsg(msg *otg.BgpExtCommunity) BgpExtCommunity { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtCommunity struct { - obj *bgpExtCommunity -} - -type marshalBgpExtCommunity interface { - // ToProto marshals BgpExtCommunity to protobuf object *otg.BgpExtCommunity - ToProto() (*otg.BgpExtCommunity, error) - // ToPbText marshals BgpExtCommunity to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtCommunity to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtCommunity to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtCommunity struct { - obj *bgpExtCommunity -} - -type unMarshalBgpExtCommunity interface { - // FromProto unmarshals BgpExtCommunity from protobuf object *otg.BgpExtCommunity - FromProto(msg *otg.BgpExtCommunity) (BgpExtCommunity, error) - // FromPbText unmarshals BgpExtCommunity from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtCommunity from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtCommunity from JSON text - FromJson(value string) error -} - -func (obj *bgpExtCommunity) Marshal() marshalBgpExtCommunity { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtCommunity{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtCommunity) Unmarshal() unMarshalBgpExtCommunity { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtCommunity{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtCommunity) ToProto() (*otg.BgpExtCommunity, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtCommunity) FromProto(msg *otg.BgpExtCommunity) (BgpExtCommunity, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtCommunity) 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 *unMarshalbgpExtCommunity) 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 *marshalbgpExtCommunity) 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 *unMarshalbgpExtCommunity) 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 *marshalbgpExtCommunity) 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 *unMarshalbgpExtCommunity) 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 *bgpExtCommunity) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtCommunity) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtCommunity) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtCommunity) Clone() (BgpExtCommunity, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtCommunity() - 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 -} - -// BgpExtCommunity is the Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. -type BgpExtCommunity interface { - Validation - // msg marshals BgpExtCommunity to protobuf object *otg.BgpExtCommunity - // and doesn't set defaults - msg() *otg.BgpExtCommunity - // setMsg unmarshals BgpExtCommunity from protobuf object *otg.BgpExtCommunity - // and doesn't set defaults - setMsg(*otg.BgpExtCommunity) BgpExtCommunity - // provides marshal interface - Marshal() marshalBgpExtCommunity - // provides unmarshal interface - Unmarshal() unMarshalBgpExtCommunity - // validate validates BgpExtCommunity - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtCommunity, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Type returns BgpExtCommunityTypeEnum, set in BgpExtCommunity - Type() BgpExtCommunityTypeEnum - // SetType assigns BgpExtCommunityTypeEnum provided by user to BgpExtCommunity - SetType(value BgpExtCommunityTypeEnum) BgpExtCommunity - // HasType checks if Type has been set in BgpExtCommunity - HasType() bool - // Subtype returns BgpExtCommunitySubtypeEnum, set in BgpExtCommunity - Subtype() BgpExtCommunitySubtypeEnum - // SetSubtype assigns BgpExtCommunitySubtypeEnum provided by user to BgpExtCommunity - SetSubtype(value BgpExtCommunitySubtypeEnum) BgpExtCommunity - // HasSubtype checks if Subtype has been set in BgpExtCommunity - HasSubtype() bool - // Value returns string, set in BgpExtCommunity. - Value() string - // SetValue assigns string provided by user to BgpExtCommunity - SetValue(value string) BgpExtCommunity - // HasValue checks if Value has been set in BgpExtCommunity - HasValue() bool -} - -type BgpExtCommunityTypeEnum string - -// Enum of Type on BgpExtCommunity -var BgpExtCommunityType = struct { - ADMINISTRATOR_AS_2OCTET BgpExtCommunityTypeEnum - ADMINISTRATOR_IPV4_ADDRESS BgpExtCommunityTypeEnum - ADMINISTRATOR_AS_4OCTET BgpExtCommunityTypeEnum - OPAQUE BgpExtCommunityTypeEnum - EVPN BgpExtCommunityTypeEnum - ADMINISTRATOR_AS_2OCTET_LINK_BANDWIDTH BgpExtCommunityTypeEnum -}{ - ADMINISTRATOR_AS_2OCTET: BgpExtCommunityTypeEnum("administrator_as_2octet"), - ADMINISTRATOR_IPV4_ADDRESS: BgpExtCommunityTypeEnum("administrator_ipv4_address"), - ADMINISTRATOR_AS_4OCTET: BgpExtCommunityTypeEnum("administrator_as_4octet"), - OPAQUE: BgpExtCommunityTypeEnum("opaque"), - EVPN: BgpExtCommunityTypeEnum("evpn"), - ADMINISTRATOR_AS_2OCTET_LINK_BANDWIDTH: BgpExtCommunityTypeEnum("administrator_as_2octet_link_bandwidth"), -} - -func (obj *bgpExtCommunity) Type() BgpExtCommunityTypeEnum { - return BgpExtCommunityTypeEnum(obj.obj.Type.Enum().String()) -} - -// Extended Community Type field of 1 Byte. -// - administrator_as_2octet: Two-Octet AS Specific Extended Community (RFC 4360). -// - administrator_ipv4_address: IPv4 Address Specific Extended Community (RFC 4360). -// - administrator_as_4octet: 4-Octet AS Specific Extended Community (RFC 5668). -// - opaque: Opaque Extended Community (RFC 7432). -// - evpn: EVPN Extended Community (RFC 7153). -// - administrator_as_2octet_link_bandwidth : Link Bandwidth Extended Community (RFC 7153). -// Type returns a string -func (obj *bgpExtCommunity) HasType() bool { - return obj.obj.Type != nil -} - -func (obj *bgpExtCommunity) SetType(value BgpExtCommunityTypeEnum) BgpExtCommunity { - intValue, ok := otg.BgpExtCommunity_Type_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpExtCommunityTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpExtCommunity_Type_Enum(intValue) - obj.obj.Type = &enumValue - - return obj -} - -type BgpExtCommunitySubtypeEnum string - -// Enum of Subtype on BgpExtCommunity -var BgpExtCommunitySubtype = struct { - ROUTE_TARGET BgpExtCommunitySubtypeEnum - ORIGIN BgpExtCommunitySubtypeEnum - EXTENDED_BANDWIDTH BgpExtCommunitySubtypeEnum - COLOR BgpExtCommunitySubtypeEnum - ENCAPSULATION BgpExtCommunitySubtypeEnum - MAC_ADDRESS BgpExtCommunitySubtypeEnum -}{ - ROUTE_TARGET: BgpExtCommunitySubtypeEnum("route_target"), - ORIGIN: BgpExtCommunitySubtypeEnum("origin"), - EXTENDED_BANDWIDTH: BgpExtCommunitySubtypeEnum("extended_bandwidth"), - COLOR: BgpExtCommunitySubtypeEnum("color"), - ENCAPSULATION: BgpExtCommunitySubtypeEnum("encapsulation"), - MAC_ADDRESS: BgpExtCommunitySubtypeEnum("mac_address"), -} - -func (obj *bgpExtCommunity) Subtype() BgpExtCommunitySubtypeEnum { - return BgpExtCommunitySubtypeEnum(obj.obj.Subtype.Enum().String()) -} - -// Extended Community Sub Type field of 1 Byte. -// - route_target: Route Target. -// - origin: Origin. -// - extended_bandwidth: Specifies the link bandwidth. -// - color: Specifies the color value. -// - encapsulation: Specifies the Encapsulation Extended Community. -// - mac_address: Specifies the Extended community MAC address. -// Subtype returns a string -func (obj *bgpExtCommunity) HasSubtype() bool { - return obj.obj.Subtype != nil -} - -func (obj *bgpExtCommunity) SetSubtype(value BgpExtCommunitySubtypeEnum) BgpExtCommunity { - intValue, ok := otg.BgpExtCommunity_Subtype_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpExtCommunitySubtypeEnum", string(value))) - return obj - } - enumValue := otg.BgpExtCommunity_Subtype_Enum(intValue) - obj.obj.Subtype = &enumValue - - return obj -} - -// Extended Community value of 6 Bytes. Example - for the Opaque type and Color subtype value can be '0000000000c8' for the color value 200. -// Value returns a string -func (obj *bgpExtCommunity) Value() string { - - return *obj.obj.Value - -} - -// Extended Community value of 6 Bytes. Example - for the Opaque type and Color subtype value can be '0000000000c8' for the color value 200. -// Value returns a string -func (obj *bgpExtCommunity) HasValue() bool { - return obj.obj.Value != nil -} - -// Extended Community value of 6 Bytes. Example - for the Opaque type and Color subtype value can be '0000000000c8' for the color value 200. -// SetValue sets the string value in the BgpExtCommunity object -func (obj *bgpExtCommunity) SetValue(value string) BgpExtCommunity { - - obj.obj.Value = &value - return obj -} - -func (obj *bgpExtCommunity) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateHex(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpExtCommunity.Value")) - } - - } - -} - -func (obj *bgpExtCommunity) setDefault() { - -} - -// ***** BgpAsPath ***** -type bgpAsPath struct { - validation - obj *otg.BgpAsPath - marshaller marshalBgpAsPath - unMarshaller unMarshalBgpAsPath - segmentsHolder BgpAsPathBgpAsPathSegmentIter -} - -func NewBgpAsPath() BgpAsPath { - obj := bgpAsPath{obj: &otg.BgpAsPath{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAsPath) msg() *otg.BgpAsPath { - return obj.obj -} - -func (obj *bgpAsPath) setMsg(msg *otg.BgpAsPath) BgpAsPath { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAsPath struct { - obj *bgpAsPath -} - -type marshalBgpAsPath interface { - // ToProto marshals BgpAsPath to protobuf object *otg.BgpAsPath - ToProto() (*otg.BgpAsPath, error) - // ToPbText marshals BgpAsPath to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAsPath to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAsPath to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAsPath struct { - obj *bgpAsPath -} - -type unMarshalBgpAsPath interface { - // FromProto unmarshals BgpAsPath from protobuf object *otg.BgpAsPath - FromProto(msg *otg.BgpAsPath) (BgpAsPath, error) - // FromPbText unmarshals BgpAsPath from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAsPath from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAsPath from JSON text - FromJson(value string) error -} - -func (obj *bgpAsPath) Marshal() marshalBgpAsPath { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAsPath{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAsPath) Unmarshal() unMarshalBgpAsPath { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAsPath{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAsPath) ToProto() (*otg.BgpAsPath, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAsPath) FromProto(msg *otg.BgpAsPath) (BgpAsPath, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAsPath) 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 *unMarshalbgpAsPath) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAsPath) 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 *unMarshalbgpAsPath) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAsPath) 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 *unMarshalbgpAsPath) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAsPath) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAsPath) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAsPath) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAsPath) Clone() (BgpAsPath, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAsPath() - 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 -} - -func (obj *bgpAsPath) setNil() { - obj.segmentsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. -type BgpAsPath interface { - Validation - // msg marshals BgpAsPath to protobuf object *otg.BgpAsPath - // and doesn't set defaults - msg() *otg.BgpAsPath - // setMsg unmarshals BgpAsPath from protobuf object *otg.BgpAsPath - // and doesn't set defaults - setMsg(*otg.BgpAsPath) BgpAsPath - // provides marshal interface - Marshal() marshalBgpAsPath - // provides unmarshal interface - Unmarshal() unMarshalBgpAsPath - // validate validates BgpAsPath - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAsPath, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // AsSetMode returns BgpAsPathAsSetModeEnum, set in BgpAsPath - AsSetMode() BgpAsPathAsSetModeEnum - // SetAsSetMode assigns BgpAsPathAsSetModeEnum provided by user to BgpAsPath - SetAsSetMode(value BgpAsPathAsSetModeEnum) BgpAsPath - // HasAsSetMode checks if AsSetMode has been set in BgpAsPath - HasAsSetMode() bool - // Segments returns BgpAsPathBgpAsPathSegmentIterIter, set in BgpAsPath - Segments() BgpAsPathBgpAsPathSegmentIter - setNil() -} - -type BgpAsPathAsSetModeEnum string - -// Enum of AsSetMode on BgpAsPath -var BgpAsPathAsSetMode = struct { - DO_NOT_INCLUDE_LOCAL_AS BgpAsPathAsSetModeEnum - INCLUDE_AS_SEQ BgpAsPathAsSetModeEnum - INCLUDE_AS_SET BgpAsPathAsSetModeEnum - INCLUDE_AS_CONFED_SEQ BgpAsPathAsSetModeEnum - INCLUDE_AS_CONFED_SET BgpAsPathAsSetModeEnum - PREPEND_TO_FIRST_SEGMENT BgpAsPathAsSetModeEnum -}{ - DO_NOT_INCLUDE_LOCAL_AS: BgpAsPathAsSetModeEnum("do_not_include_local_as"), - INCLUDE_AS_SEQ: BgpAsPathAsSetModeEnum("include_as_seq"), - INCLUDE_AS_SET: BgpAsPathAsSetModeEnum("include_as_set"), - INCLUDE_AS_CONFED_SEQ: BgpAsPathAsSetModeEnum("include_as_confed_seq"), - INCLUDE_AS_CONFED_SET: BgpAsPathAsSetModeEnum("include_as_confed_set"), - PREPEND_TO_FIRST_SEGMENT: BgpAsPathAsSetModeEnum("prepend_to_first_segment"), -} - -func (obj *bgpAsPath) AsSetMode() BgpAsPathAsSetModeEnum { - return BgpAsPathAsSetModeEnum(obj.obj.AsSetMode.Enum().String()) -} - -// Defines how the Local AS should be included in the MP REACH NLRI. For iBGP sessions, "Do Not Include Local AS" must be chosen. For eBGP sessions, any choice other than "Do Not Include Local AS" can be chosen. -// AsSetMode returns a string -func (obj *bgpAsPath) HasAsSetMode() bool { - return obj.obj.AsSetMode != nil -} - -func (obj *bgpAsPath) SetAsSetMode(value BgpAsPathAsSetModeEnum) BgpAsPath { - intValue, ok := otg.BgpAsPath_AsSetMode_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAsPathAsSetModeEnum", string(value))) - return obj - } - enumValue := otg.BgpAsPath_AsSetMode_Enum(intValue) - obj.obj.AsSetMode = &enumValue - - return obj -} - -// The additional AS path segments to be added in the NLRI. By default, an empty AS path is always included and the local AS is added to it as per the value of 'as_set_mode' attribute. -// Segments returns a []BgpAsPathSegment -func (obj *bgpAsPath) Segments() BgpAsPathBgpAsPathSegmentIter { - if len(obj.obj.Segments) == 0 { - obj.obj.Segments = []*otg.BgpAsPathSegment{} - } - if obj.segmentsHolder == nil { - obj.segmentsHolder = newBgpAsPathBgpAsPathSegmentIter(&obj.obj.Segments).setMsg(obj) - } - return obj.segmentsHolder -} - -type bgpAsPathBgpAsPathSegmentIter struct { - obj *bgpAsPath - bgpAsPathSegmentSlice []BgpAsPathSegment - fieldPtr *[]*otg.BgpAsPathSegment -} - -func newBgpAsPathBgpAsPathSegmentIter(ptr *[]*otg.BgpAsPathSegment) BgpAsPathBgpAsPathSegmentIter { - return &bgpAsPathBgpAsPathSegmentIter{fieldPtr: ptr} -} - -type BgpAsPathBgpAsPathSegmentIter interface { - setMsg(*bgpAsPath) BgpAsPathBgpAsPathSegmentIter - Items() []BgpAsPathSegment - Add() BgpAsPathSegment - Append(items ...BgpAsPathSegment) BgpAsPathBgpAsPathSegmentIter - Set(index int, newObj BgpAsPathSegment) BgpAsPathBgpAsPathSegmentIter - Clear() BgpAsPathBgpAsPathSegmentIter - clearHolderSlice() BgpAsPathBgpAsPathSegmentIter - appendHolderSlice(item BgpAsPathSegment) BgpAsPathBgpAsPathSegmentIter -} - -func (obj *bgpAsPathBgpAsPathSegmentIter) setMsg(msg *bgpAsPath) BgpAsPathBgpAsPathSegmentIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpAsPathSegment{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpAsPathBgpAsPathSegmentIter) Items() []BgpAsPathSegment { - return obj.bgpAsPathSegmentSlice -} - -func (obj *bgpAsPathBgpAsPathSegmentIter) Add() BgpAsPathSegment { - newObj := &otg.BgpAsPathSegment{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpAsPathSegment{obj: newObj} - newLibObj.setDefault() - obj.bgpAsPathSegmentSlice = append(obj.bgpAsPathSegmentSlice, newLibObj) - return newLibObj -} - -func (obj *bgpAsPathBgpAsPathSegmentIter) Append(items ...BgpAsPathSegment) BgpAsPathBgpAsPathSegmentIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpAsPathSegmentSlice = append(obj.bgpAsPathSegmentSlice, item) - } - return obj -} - -func (obj *bgpAsPathBgpAsPathSegmentIter) Set(index int, newObj BgpAsPathSegment) BgpAsPathBgpAsPathSegmentIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpAsPathSegmentSlice[index] = newObj - return obj -} -func (obj *bgpAsPathBgpAsPathSegmentIter) Clear() BgpAsPathBgpAsPathSegmentIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpAsPathSegment{} - obj.bgpAsPathSegmentSlice = []BgpAsPathSegment{} - } - return obj -} -func (obj *bgpAsPathBgpAsPathSegmentIter) clearHolderSlice() BgpAsPathBgpAsPathSegmentIter { - if len(obj.bgpAsPathSegmentSlice) > 0 { - obj.bgpAsPathSegmentSlice = []BgpAsPathSegment{} - } - return obj -} -func (obj *bgpAsPathBgpAsPathSegmentIter) appendHolderSlice(item BgpAsPathSegment) BgpAsPathBgpAsPathSegmentIter { - obj.bgpAsPathSegmentSlice = append(obj.bgpAsPathSegmentSlice, item) - return obj -} - -func (obj *bgpAsPath) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Segments) != 0 { - - if set_default { - obj.Segments().clearHolderSlice() - for _, item := range obj.obj.Segments { - obj.Segments().appendHolderSlice(&bgpAsPathSegment{obj: item}) - } - } - for _, item := range obj.Segments().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpAsPath) setDefault() { - if obj.obj.AsSetMode == nil { - obj.SetAsSetMode(BgpAsPathAsSetMode.DO_NOT_INCLUDE_LOCAL_AS) - - } - -} - -// ***** BgpAddPath ***** -type bgpAddPath struct { - validation - obj *otg.BgpAddPath - marshaller marshalBgpAddPath - unMarshaller unMarshalBgpAddPath -} - -func NewBgpAddPath() BgpAddPath { - obj := bgpAddPath{obj: &otg.BgpAddPath{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAddPath) msg() *otg.BgpAddPath { - return obj.obj -} - -func (obj *bgpAddPath) setMsg(msg *otg.BgpAddPath) BgpAddPath { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAddPath struct { - obj *bgpAddPath -} - -type marshalBgpAddPath interface { - // ToProto marshals BgpAddPath to protobuf object *otg.BgpAddPath - ToProto() (*otg.BgpAddPath, error) - // ToPbText marshals BgpAddPath to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAddPath to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAddPath to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAddPath struct { - obj *bgpAddPath -} - -type unMarshalBgpAddPath interface { - // FromProto unmarshals BgpAddPath from protobuf object *otg.BgpAddPath - FromProto(msg *otg.BgpAddPath) (BgpAddPath, error) - // FromPbText unmarshals BgpAddPath from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAddPath from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAddPath from JSON text - FromJson(value string) error -} - -func (obj *bgpAddPath) Marshal() marshalBgpAddPath { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAddPath{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAddPath) Unmarshal() unMarshalBgpAddPath { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAddPath{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAddPath) ToProto() (*otg.BgpAddPath, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAddPath) FromProto(msg *otg.BgpAddPath) (BgpAddPath, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAddPath) 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 *unMarshalbgpAddPath) 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 *marshalbgpAddPath) 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 *unMarshalbgpAddPath) 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 *marshalbgpAddPath) 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 *unMarshalbgpAddPath) 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 *bgpAddPath) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAddPath) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAddPath) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAddPath) Clone() (BgpAddPath, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAddPath() - 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 -} - -// BgpAddPath is the BGP Additional Paths feature is a BGP extension that allows the advertisement of multiple paths for the same prefix without the new paths implicitly replacing any previous paths. -type BgpAddPath interface { - Validation - // msg marshals BgpAddPath to protobuf object *otg.BgpAddPath - // and doesn't set defaults - msg() *otg.BgpAddPath - // setMsg unmarshals BgpAddPath from protobuf object *otg.BgpAddPath - // and doesn't set defaults - setMsg(*otg.BgpAddPath) BgpAddPath - // provides marshal interface - Marshal() marshalBgpAddPath - // provides unmarshal interface - Unmarshal() unMarshalBgpAddPath - // validate validates BgpAddPath - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAddPath, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PathId returns uint32, set in BgpAddPath. - PathId() uint32 - // SetPathId assigns uint32 provided by user to BgpAddPath - SetPathId(value uint32) BgpAddPath - // HasPathId checks if PathId has been set in BgpAddPath - HasPathId() bool -} - -// The id of the additional path. -// PathId returns a uint32 -func (obj *bgpAddPath) PathId() uint32 { - - return *obj.obj.PathId - -} - -// The id of the additional path. -// PathId returns a uint32 -func (obj *bgpAddPath) HasPathId() bool { - return obj.obj.PathId != nil -} - -// The id of the additional path. -// SetPathId sets the uint32 value in the BgpAddPath object -func (obj *bgpAddPath) SetPathId(value uint32) BgpAddPath { - - obj.obj.PathId = &value - return obj -} - -func (obj *bgpAddPath) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpAddPath) setDefault() { - if obj.obj.PathId == nil { - obj.SetPathId(1) - } - -} - -// ***** BgpExtendedCommunity ***** -type bgpExtendedCommunity struct { - validation - obj *otg.BgpExtendedCommunity - marshaller marshalBgpExtendedCommunity - unMarshaller unMarshalBgpExtendedCommunity - transitive_2OctetAsTypeHolder BgpExtendedCommunityTransitive2OctetAsType - transitiveIpv4AddressTypeHolder BgpExtendedCommunityTransitiveIpv4AddressType - transitive_4OctetAsTypeHolder BgpExtendedCommunityTransitive4OctetAsType - transitiveOpaqueTypeHolder BgpExtendedCommunityTransitiveOpaqueType - transitiveEvpnTypeHolder BgpExtendedCommunityTransitiveEvpnType - nonTransitive_2OctetAsTypeHolder BgpExtendedCommunityNonTransitive2OctetAsType - customHolder BgpExtendedCommunityCustomType -} - -func NewBgpExtendedCommunity() BgpExtendedCommunity { - obj := bgpExtendedCommunity{obj: &otg.BgpExtendedCommunity{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunity) msg() *otg.BgpExtendedCommunity { - return obj.obj -} - -func (obj *bgpExtendedCommunity) setMsg(msg *otg.BgpExtendedCommunity) BgpExtendedCommunity { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunity struct { - obj *bgpExtendedCommunity -} - -type marshalBgpExtendedCommunity interface { - // ToProto marshals BgpExtendedCommunity to protobuf object *otg.BgpExtendedCommunity - ToProto() (*otg.BgpExtendedCommunity, error) - // ToPbText marshals BgpExtendedCommunity to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunity to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunity to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunity struct { - obj *bgpExtendedCommunity -} - -type unMarshalBgpExtendedCommunity interface { - // FromProto unmarshals BgpExtendedCommunity from protobuf object *otg.BgpExtendedCommunity - FromProto(msg *otg.BgpExtendedCommunity) (BgpExtendedCommunity, error) - // FromPbText unmarshals BgpExtendedCommunity from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunity from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunity from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunity) Marshal() marshalBgpExtendedCommunity { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunity{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunity) Unmarshal() unMarshalBgpExtendedCommunity { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunity{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunity) ToProto() (*otg.BgpExtendedCommunity, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunity) FromProto(msg *otg.BgpExtendedCommunity) (BgpExtendedCommunity, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunity) 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 *unMarshalbgpExtendedCommunity) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpExtendedCommunity) 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 *unMarshalbgpExtendedCommunity) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpExtendedCommunity) 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 *unMarshalbgpExtendedCommunity) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpExtendedCommunity) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunity) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunity) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunity) Clone() (BgpExtendedCommunity, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunity() - 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 -} - -func (obj *bgpExtendedCommunity) setNil() { - obj.transitive_2OctetAsTypeHolder = nil - obj.transitiveIpv4AddressTypeHolder = nil - obj.transitive_4OctetAsTypeHolder = nil - obj.transitiveOpaqueTypeHolder = nil - obj.transitiveEvpnTypeHolder = nil - obj.nonTransitive_2OctetAsTypeHolder = nil - obj.customHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpExtendedCommunity is the Extended Communities Attribute is a optional BGP attribute,defined in RFC4360 with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value.It is divided into two main parts. The first 2 Bytes of the community encode a type and optonal sub-type field. The last 6 bytes (or 7 bytes for types without a sub-type) carry a unique set of data in a format defined by the type and optional sub-type field. Extended communities provide a larger range for grouping or categorizing communities. -type BgpExtendedCommunity interface { - Validation - // msg marshals BgpExtendedCommunity to protobuf object *otg.BgpExtendedCommunity - // and doesn't set defaults - msg() *otg.BgpExtendedCommunity - // setMsg unmarshals BgpExtendedCommunity from protobuf object *otg.BgpExtendedCommunity - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunity) BgpExtendedCommunity - // provides marshal interface - Marshal() marshalBgpExtendedCommunity - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunity - // validate validates BgpExtendedCommunity - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunity, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpExtendedCommunityChoiceEnum, set in BgpExtendedCommunity - Choice() BgpExtendedCommunityChoiceEnum - // setChoice assigns BgpExtendedCommunityChoiceEnum provided by user to BgpExtendedCommunity - setChoice(value BgpExtendedCommunityChoiceEnum) BgpExtendedCommunity - // HasChoice checks if Choice has been set in BgpExtendedCommunity - HasChoice() bool - // Transitive2OctetAsType returns BgpExtendedCommunityTransitive2OctetAsType, set in BgpExtendedCommunity. - // BgpExtendedCommunityTransitive2OctetAsType is the Transitive Two-Octet AS-Specific Extended Community is sent as type 0x00 . - Transitive2OctetAsType() BgpExtendedCommunityTransitive2OctetAsType - // SetTransitive2OctetAsType assigns BgpExtendedCommunityTransitive2OctetAsType provided by user to BgpExtendedCommunity. - // BgpExtendedCommunityTransitive2OctetAsType is the Transitive Two-Octet AS-Specific Extended Community is sent as type 0x00 . - SetTransitive2OctetAsType(value BgpExtendedCommunityTransitive2OctetAsType) BgpExtendedCommunity - // HasTransitive2OctetAsType checks if Transitive2OctetAsType has been set in BgpExtendedCommunity - HasTransitive2OctetAsType() bool - // TransitiveIpv4AddressType returns BgpExtendedCommunityTransitiveIpv4AddressType, set in BgpExtendedCommunity. - // BgpExtendedCommunityTransitiveIpv4AddressType is the Transitive IPv4 Address Specific Extended Community is sent as type 0x01. - TransitiveIpv4AddressType() BgpExtendedCommunityTransitiveIpv4AddressType - // SetTransitiveIpv4AddressType assigns BgpExtendedCommunityTransitiveIpv4AddressType provided by user to BgpExtendedCommunity. - // BgpExtendedCommunityTransitiveIpv4AddressType is the Transitive IPv4 Address Specific Extended Community is sent as type 0x01. - SetTransitiveIpv4AddressType(value BgpExtendedCommunityTransitiveIpv4AddressType) BgpExtendedCommunity - // HasTransitiveIpv4AddressType checks if TransitiveIpv4AddressType has been set in BgpExtendedCommunity - HasTransitiveIpv4AddressType() bool - // Transitive4OctetAsType returns BgpExtendedCommunityTransitive4OctetAsType, set in BgpExtendedCommunity. - // BgpExtendedCommunityTransitive4OctetAsType is the Transitive Four-Octet AS-Specific Extended Community is sent as type 0x02. It is defined in RFC 5668. - Transitive4OctetAsType() BgpExtendedCommunityTransitive4OctetAsType - // SetTransitive4OctetAsType assigns BgpExtendedCommunityTransitive4OctetAsType provided by user to BgpExtendedCommunity. - // BgpExtendedCommunityTransitive4OctetAsType is the Transitive Four-Octet AS-Specific Extended Community is sent as type 0x02. It is defined in RFC 5668. - SetTransitive4OctetAsType(value BgpExtendedCommunityTransitive4OctetAsType) BgpExtendedCommunity - // HasTransitive4OctetAsType checks if Transitive4OctetAsType has been set in BgpExtendedCommunity - HasTransitive4OctetAsType() bool - // TransitiveOpaqueType returns BgpExtendedCommunityTransitiveOpaqueType, set in BgpExtendedCommunity. - // BgpExtendedCommunityTransitiveOpaqueType is the Transitive Opaque Extended Community is sent as type 0x03. - TransitiveOpaqueType() BgpExtendedCommunityTransitiveOpaqueType - // SetTransitiveOpaqueType assigns BgpExtendedCommunityTransitiveOpaqueType provided by user to BgpExtendedCommunity. - // BgpExtendedCommunityTransitiveOpaqueType is the Transitive Opaque Extended Community is sent as type 0x03. - SetTransitiveOpaqueType(value BgpExtendedCommunityTransitiveOpaqueType) BgpExtendedCommunity - // HasTransitiveOpaqueType checks if TransitiveOpaqueType has been set in BgpExtendedCommunity - HasTransitiveOpaqueType() bool - // TransitiveEvpnType returns BgpExtendedCommunityTransitiveEvpnType, set in BgpExtendedCommunity. - // BgpExtendedCommunityTransitiveEvpnType is the Transitive EVPN Extended Community is sent as type 0x06 . - TransitiveEvpnType() BgpExtendedCommunityTransitiveEvpnType - // SetTransitiveEvpnType assigns BgpExtendedCommunityTransitiveEvpnType provided by user to BgpExtendedCommunity. - // BgpExtendedCommunityTransitiveEvpnType is the Transitive EVPN Extended Community is sent as type 0x06 . - SetTransitiveEvpnType(value BgpExtendedCommunityTransitiveEvpnType) BgpExtendedCommunity - // HasTransitiveEvpnType checks if TransitiveEvpnType has been set in BgpExtendedCommunity - HasTransitiveEvpnType() bool - // NonTransitive2OctetAsType returns BgpExtendedCommunityNonTransitive2OctetAsType, set in BgpExtendedCommunity. - // BgpExtendedCommunityNonTransitive2OctetAsType is the Non-Transitive Two-Octet AS-Specific Extended Community is sent as type 0x40. - NonTransitive2OctetAsType() BgpExtendedCommunityNonTransitive2OctetAsType - // SetNonTransitive2OctetAsType assigns BgpExtendedCommunityNonTransitive2OctetAsType provided by user to BgpExtendedCommunity. - // BgpExtendedCommunityNonTransitive2OctetAsType is the Non-Transitive Two-Octet AS-Specific Extended Community is sent as type 0x40. - SetNonTransitive2OctetAsType(value BgpExtendedCommunityNonTransitive2OctetAsType) BgpExtendedCommunity - // HasNonTransitive2OctetAsType checks if NonTransitive2OctetAsType has been set in BgpExtendedCommunity - HasNonTransitive2OctetAsType() bool - // Custom returns BgpExtendedCommunityCustomType, set in BgpExtendedCommunity. - // BgpExtendedCommunityCustomType is add a custom Extended Community with a combination of types , sub-types and values not explicitly specified above or not defined yet. - Custom() BgpExtendedCommunityCustomType - // SetCustom assigns BgpExtendedCommunityCustomType provided by user to BgpExtendedCommunity. - // BgpExtendedCommunityCustomType is add a custom Extended Community with a combination of types , sub-types and values not explicitly specified above or not defined yet. - SetCustom(value BgpExtendedCommunityCustomType) BgpExtendedCommunity - // HasCustom checks if Custom has been set in BgpExtendedCommunity - HasCustom() bool - setNil() -} - -type BgpExtendedCommunityChoiceEnum string - -// Enum of Choice on BgpExtendedCommunity -var BgpExtendedCommunityChoice = struct { - TRANSITIVE_2OCTET_AS_TYPE BgpExtendedCommunityChoiceEnum - TRANSITIVE_IPV4_ADDRESS_TYPE BgpExtendedCommunityChoiceEnum - TRANSITIVE_4OCTET_AS_TYPE BgpExtendedCommunityChoiceEnum - TRANSITIVE_OPAQUE_TYPE BgpExtendedCommunityChoiceEnum - TRANSITIVE_EVPN_TYPE BgpExtendedCommunityChoiceEnum - NON_TRANSITIVE_2OCTET_AS_TYPE BgpExtendedCommunityChoiceEnum - CUSTOM BgpExtendedCommunityChoiceEnum -}{ - TRANSITIVE_2OCTET_AS_TYPE: BgpExtendedCommunityChoiceEnum("transitive_2octet_as_type"), - TRANSITIVE_IPV4_ADDRESS_TYPE: BgpExtendedCommunityChoiceEnum("transitive_ipv4_address_type"), - TRANSITIVE_4OCTET_AS_TYPE: BgpExtendedCommunityChoiceEnum("transitive_4octet_as_type"), - TRANSITIVE_OPAQUE_TYPE: BgpExtendedCommunityChoiceEnum("transitive_opaque_type"), - TRANSITIVE_EVPN_TYPE: BgpExtendedCommunityChoiceEnum("transitive_evpn_type"), - NON_TRANSITIVE_2OCTET_AS_TYPE: BgpExtendedCommunityChoiceEnum("non_transitive_2octet_as_type"), - CUSTOM: BgpExtendedCommunityChoiceEnum("custom"), -} - -func (obj *bgpExtendedCommunity) Choice() BgpExtendedCommunityChoiceEnum { - return BgpExtendedCommunityChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *bgpExtendedCommunity) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpExtendedCommunity) setChoice(value BgpExtendedCommunityChoiceEnum) BgpExtendedCommunity { - intValue, ok := otg.BgpExtendedCommunity_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpExtendedCommunityChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpExtendedCommunity_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Custom = nil - obj.customHolder = nil - obj.obj.NonTransitive_2OctetAsType = nil - obj.nonTransitive_2OctetAsTypeHolder = nil - obj.obj.TransitiveEvpnType = nil - obj.transitiveEvpnTypeHolder = nil - obj.obj.TransitiveOpaqueType = nil - obj.transitiveOpaqueTypeHolder = nil - obj.obj.Transitive_4OctetAsType = nil - obj.transitive_4OctetAsTypeHolder = nil - obj.obj.TransitiveIpv4AddressType = nil - obj.transitiveIpv4AddressTypeHolder = nil - obj.obj.Transitive_2OctetAsType = nil - obj.transitive_2OctetAsTypeHolder = nil - - if value == BgpExtendedCommunityChoice.TRANSITIVE_2OCTET_AS_TYPE { - obj.obj.Transitive_2OctetAsType = NewBgpExtendedCommunityTransitive2OctetAsType().msg() - } - - if value == BgpExtendedCommunityChoice.TRANSITIVE_IPV4_ADDRESS_TYPE { - obj.obj.TransitiveIpv4AddressType = NewBgpExtendedCommunityTransitiveIpv4AddressType().msg() - } - - if value == BgpExtendedCommunityChoice.TRANSITIVE_4OCTET_AS_TYPE { - obj.obj.Transitive_4OctetAsType = NewBgpExtendedCommunityTransitive4OctetAsType().msg() - } - - if value == BgpExtendedCommunityChoice.TRANSITIVE_OPAQUE_TYPE { - obj.obj.TransitiveOpaqueType = NewBgpExtendedCommunityTransitiveOpaqueType().msg() - } - - if value == BgpExtendedCommunityChoice.TRANSITIVE_EVPN_TYPE { - obj.obj.TransitiveEvpnType = NewBgpExtendedCommunityTransitiveEvpnType().msg() - } - - if value == BgpExtendedCommunityChoice.NON_TRANSITIVE_2OCTET_AS_TYPE { - obj.obj.NonTransitive_2OctetAsType = NewBgpExtendedCommunityNonTransitive2OctetAsType().msg() - } - - if value == BgpExtendedCommunityChoice.CUSTOM { - obj.obj.Custom = NewBgpExtendedCommunityCustomType().msg() - } - - return obj -} - -// description is TBD -// Transitive2OctetAsType returns a BgpExtendedCommunityTransitive2OctetAsType -func (obj *bgpExtendedCommunity) Transitive2OctetAsType() BgpExtendedCommunityTransitive2OctetAsType { - if obj.obj.Transitive_2OctetAsType == nil { - obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_2OCTET_AS_TYPE) - } - if obj.transitive_2OctetAsTypeHolder == nil { - obj.transitive_2OctetAsTypeHolder = &bgpExtendedCommunityTransitive2OctetAsType{obj: obj.obj.Transitive_2OctetAsType} - } - return obj.transitive_2OctetAsTypeHolder -} - -// description is TBD -// Transitive2OctetAsType returns a BgpExtendedCommunityTransitive2OctetAsType -func (obj *bgpExtendedCommunity) HasTransitive2OctetAsType() bool { - return obj.obj.Transitive_2OctetAsType != nil -} - -// description is TBD -// SetTransitive2OctetAsType sets the BgpExtendedCommunityTransitive2OctetAsType value in the BgpExtendedCommunity object -func (obj *bgpExtendedCommunity) SetTransitive2OctetAsType(value BgpExtendedCommunityTransitive2OctetAsType) BgpExtendedCommunity { - obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_2OCTET_AS_TYPE) - obj.transitive_2OctetAsTypeHolder = nil - obj.obj.Transitive_2OctetAsType = value.msg() - - return obj -} - -// description is TBD -// TransitiveIpv4AddressType returns a BgpExtendedCommunityTransitiveIpv4AddressType -func (obj *bgpExtendedCommunity) TransitiveIpv4AddressType() BgpExtendedCommunityTransitiveIpv4AddressType { - if obj.obj.TransitiveIpv4AddressType == nil { - obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_IPV4_ADDRESS_TYPE) - } - if obj.transitiveIpv4AddressTypeHolder == nil { - obj.transitiveIpv4AddressTypeHolder = &bgpExtendedCommunityTransitiveIpv4AddressType{obj: obj.obj.TransitiveIpv4AddressType} - } - return obj.transitiveIpv4AddressTypeHolder -} - -// description is TBD -// TransitiveIpv4AddressType returns a BgpExtendedCommunityTransitiveIpv4AddressType -func (obj *bgpExtendedCommunity) HasTransitiveIpv4AddressType() bool { - return obj.obj.TransitiveIpv4AddressType != nil -} - -// description is TBD -// SetTransitiveIpv4AddressType sets the BgpExtendedCommunityTransitiveIpv4AddressType value in the BgpExtendedCommunity object -func (obj *bgpExtendedCommunity) SetTransitiveIpv4AddressType(value BgpExtendedCommunityTransitiveIpv4AddressType) BgpExtendedCommunity { - obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_IPV4_ADDRESS_TYPE) - obj.transitiveIpv4AddressTypeHolder = nil - obj.obj.TransitiveIpv4AddressType = value.msg() - - return obj -} - -// description is TBD -// Transitive4OctetAsType returns a BgpExtendedCommunityTransitive4OctetAsType -func (obj *bgpExtendedCommunity) Transitive4OctetAsType() BgpExtendedCommunityTransitive4OctetAsType { - if obj.obj.Transitive_4OctetAsType == nil { - obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_4OCTET_AS_TYPE) - } - if obj.transitive_4OctetAsTypeHolder == nil { - obj.transitive_4OctetAsTypeHolder = &bgpExtendedCommunityTransitive4OctetAsType{obj: obj.obj.Transitive_4OctetAsType} - } - return obj.transitive_4OctetAsTypeHolder -} - -// description is TBD -// Transitive4OctetAsType returns a BgpExtendedCommunityTransitive4OctetAsType -func (obj *bgpExtendedCommunity) HasTransitive4OctetAsType() bool { - return obj.obj.Transitive_4OctetAsType != nil -} - -// description is TBD -// SetTransitive4OctetAsType sets the BgpExtendedCommunityTransitive4OctetAsType value in the BgpExtendedCommunity object -func (obj *bgpExtendedCommunity) SetTransitive4OctetAsType(value BgpExtendedCommunityTransitive4OctetAsType) BgpExtendedCommunity { - obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_4OCTET_AS_TYPE) - obj.transitive_4OctetAsTypeHolder = nil - obj.obj.Transitive_4OctetAsType = value.msg() - - return obj -} - -// description is TBD -// TransitiveOpaqueType returns a BgpExtendedCommunityTransitiveOpaqueType -func (obj *bgpExtendedCommunity) TransitiveOpaqueType() BgpExtendedCommunityTransitiveOpaqueType { - if obj.obj.TransitiveOpaqueType == nil { - obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_OPAQUE_TYPE) - } - if obj.transitiveOpaqueTypeHolder == nil { - obj.transitiveOpaqueTypeHolder = &bgpExtendedCommunityTransitiveOpaqueType{obj: obj.obj.TransitiveOpaqueType} - } - return obj.transitiveOpaqueTypeHolder -} - -// description is TBD -// TransitiveOpaqueType returns a BgpExtendedCommunityTransitiveOpaqueType -func (obj *bgpExtendedCommunity) HasTransitiveOpaqueType() bool { - return obj.obj.TransitiveOpaqueType != nil -} - -// description is TBD -// SetTransitiveOpaqueType sets the BgpExtendedCommunityTransitiveOpaqueType value in the BgpExtendedCommunity object -func (obj *bgpExtendedCommunity) SetTransitiveOpaqueType(value BgpExtendedCommunityTransitiveOpaqueType) BgpExtendedCommunity { - obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_OPAQUE_TYPE) - obj.transitiveOpaqueTypeHolder = nil - obj.obj.TransitiveOpaqueType = value.msg() - - return obj -} - -// description is TBD -// TransitiveEvpnType returns a BgpExtendedCommunityTransitiveEvpnType -func (obj *bgpExtendedCommunity) TransitiveEvpnType() BgpExtendedCommunityTransitiveEvpnType { - if obj.obj.TransitiveEvpnType == nil { - obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_EVPN_TYPE) - } - if obj.transitiveEvpnTypeHolder == nil { - obj.transitiveEvpnTypeHolder = &bgpExtendedCommunityTransitiveEvpnType{obj: obj.obj.TransitiveEvpnType} - } - return obj.transitiveEvpnTypeHolder -} - -// description is TBD -// TransitiveEvpnType returns a BgpExtendedCommunityTransitiveEvpnType -func (obj *bgpExtendedCommunity) HasTransitiveEvpnType() bool { - return obj.obj.TransitiveEvpnType != nil -} - -// description is TBD -// SetTransitiveEvpnType sets the BgpExtendedCommunityTransitiveEvpnType value in the BgpExtendedCommunity object -func (obj *bgpExtendedCommunity) SetTransitiveEvpnType(value BgpExtendedCommunityTransitiveEvpnType) BgpExtendedCommunity { - obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_EVPN_TYPE) - obj.transitiveEvpnTypeHolder = nil - obj.obj.TransitiveEvpnType = value.msg() - - return obj -} - -// description is TBD -// NonTransitive2OctetAsType returns a BgpExtendedCommunityNonTransitive2OctetAsType -func (obj *bgpExtendedCommunity) NonTransitive2OctetAsType() BgpExtendedCommunityNonTransitive2OctetAsType { - if obj.obj.NonTransitive_2OctetAsType == nil { - obj.setChoice(BgpExtendedCommunityChoice.NON_TRANSITIVE_2OCTET_AS_TYPE) - } - if obj.nonTransitive_2OctetAsTypeHolder == nil { - obj.nonTransitive_2OctetAsTypeHolder = &bgpExtendedCommunityNonTransitive2OctetAsType{obj: obj.obj.NonTransitive_2OctetAsType} - } - return obj.nonTransitive_2OctetAsTypeHolder -} - -// description is TBD -// NonTransitive2OctetAsType returns a BgpExtendedCommunityNonTransitive2OctetAsType -func (obj *bgpExtendedCommunity) HasNonTransitive2OctetAsType() bool { - return obj.obj.NonTransitive_2OctetAsType != nil -} - -// description is TBD -// SetNonTransitive2OctetAsType sets the BgpExtendedCommunityNonTransitive2OctetAsType value in the BgpExtendedCommunity object -func (obj *bgpExtendedCommunity) SetNonTransitive2OctetAsType(value BgpExtendedCommunityNonTransitive2OctetAsType) BgpExtendedCommunity { - obj.setChoice(BgpExtendedCommunityChoice.NON_TRANSITIVE_2OCTET_AS_TYPE) - obj.nonTransitive_2OctetAsTypeHolder = nil - obj.obj.NonTransitive_2OctetAsType = value.msg() - - return obj -} - -// description is TBD -// Custom returns a BgpExtendedCommunityCustomType -func (obj *bgpExtendedCommunity) Custom() BgpExtendedCommunityCustomType { - if obj.obj.Custom == nil { - obj.setChoice(BgpExtendedCommunityChoice.CUSTOM) - } - if obj.customHolder == nil { - obj.customHolder = &bgpExtendedCommunityCustomType{obj: obj.obj.Custom} - } - return obj.customHolder -} - -// description is TBD -// Custom returns a BgpExtendedCommunityCustomType -func (obj *bgpExtendedCommunity) HasCustom() bool { - return obj.obj.Custom != nil -} - -// description is TBD -// SetCustom sets the BgpExtendedCommunityCustomType value in the BgpExtendedCommunity object -func (obj *bgpExtendedCommunity) SetCustom(value BgpExtendedCommunityCustomType) BgpExtendedCommunity { - obj.setChoice(BgpExtendedCommunityChoice.CUSTOM) - obj.customHolder = nil - obj.obj.Custom = value.msg() - - return obj -} - -func (obj *bgpExtendedCommunity) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Transitive_2OctetAsType != nil { - - obj.Transitive2OctetAsType().validateObj(vObj, set_default) - } - - if obj.obj.TransitiveIpv4AddressType != nil { - - obj.TransitiveIpv4AddressType().validateObj(vObj, set_default) - } - - if obj.obj.Transitive_4OctetAsType != nil { - - obj.Transitive4OctetAsType().validateObj(vObj, set_default) - } - - if obj.obj.TransitiveOpaqueType != nil { - - obj.TransitiveOpaqueType().validateObj(vObj, set_default) - } - - if obj.obj.TransitiveEvpnType != nil { - - obj.TransitiveEvpnType().validateObj(vObj, set_default) - } - - if obj.obj.NonTransitive_2OctetAsType != nil { - - obj.NonTransitive2OctetAsType().validateObj(vObj, set_default) - } - - if obj.obj.Custom != nil { - - obj.Custom().validateObj(vObj, set_default) - } - -} - -func (obj *bgpExtendedCommunity) setDefault() { - var choices_set int = 0 - var choice BgpExtendedCommunityChoiceEnum - - if obj.obj.TransitiveIpv4AddressType != nil { - choices_set += 1 - choice = BgpExtendedCommunityChoice.TRANSITIVE_IPV4_ADDRESS_TYPE - } - - if obj.obj.TransitiveOpaqueType != nil { - choices_set += 1 - choice = BgpExtendedCommunityChoice.TRANSITIVE_OPAQUE_TYPE - } - - if obj.obj.TransitiveEvpnType != nil { - choices_set += 1 - choice = BgpExtendedCommunityChoice.TRANSITIVE_EVPN_TYPE - } - - if obj.obj.Custom != nil { - choices_set += 1 - choice = BgpExtendedCommunityChoice.CUSTOM - } - - if obj.obj.Transitive_2OctetAsType != nil { - choices_set += 1 - choice = BgpExtendedCommunityChoice.TRANSITIVE_2OCTET_AS_TYPE - } - - if obj.obj.Transitive_4OctetAsType != nil { - choices_set += 1 - choice = BgpExtendedCommunityChoice.TRANSITIVE_4OCTET_AS_TYPE - } - - if obj.obj.NonTransitive_2OctetAsType != nil { - choices_set += 1 - choice = BgpExtendedCommunityChoice.NON_TRANSITIVE_2OCTET_AS_TYPE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(BgpExtendedCommunityChoice.TRANSITIVE_2OCTET_AS_TYPE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpExtendedCommunity") - } - } else { - intVal := otg.BgpExtendedCommunity_Choice_Enum_value[string(choice)] - enumValue := otg.BgpExtendedCommunity_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpSrteV4TunnelTlv ***** -type bgpSrteV4TunnelTlv struct { - validation - obj *otg.BgpSrteV4TunnelTlv - marshaller marshalBgpSrteV4TunnelTlv - unMarshaller unMarshalBgpSrteV4TunnelTlv - remoteEndpointSubTlvHolder BgpSrteRemoteEndpointSubTlv - colorSubTlvHolder BgpSrteColorSubTlv - bindingSubTlvHolder BgpSrteBindingSubTlv - preferenceSubTlvHolder BgpSrtePreferenceSubTlv - policyPrioritySubTlvHolder BgpSrtePolicyPrioritySubTlv - policyNameSubTlvHolder BgpSrtePolicyNameSubTlv - explicitNullLabelPolicySubTlvHolder BgpSrteExplicitNullLabelPolicySubTlv - segmentListsHolder BgpSrteV4TunnelTlvBgpSrteSegmentListIter -} - -func NewBgpSrteV4TunnelTlv() BgpSrteV4TunnelTlv { - obj := bgpSrteV4TunnelTlv{obj: &otg.BgpSrteV4TunnelTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteV4TunnelTlv) msg() *otg.BgpSrteV4TunnelTlv { - return obj.obj -} - -func (obj *bgpSrteV4TunnelTlv) setMsg(msg *otg.BgpSrteV4TunnelTlv) BgpSrteV4TunnelTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteV4TunnelTlv struct { - obj *bgpSrteV4TunnelTlv -} - -type marshalBgpSrteV4TunnelTlv interface { - // ToProto marshals BgpSrteV4TunnelTlv to protobuf object *otg.BgpSrteV4TunnelTlv - ToProto() (*otg.BgpSrteV4TunnelTlv, error) - // ToPbText marshals BgpSrteV4TunnelTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteV4TunnelTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteV4TunnelTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteV4TunnelTlv struct { - obj *bgpSrteV4TunnelTlv -} - -type unMarshalBgpSrteV4TunnelTlv interface { - // FromProto unmarshals BgpSrteV4TunnelTlv from protobuf object *otg.BgpSrteV4TunnelTlv - FromProto(msg *otg.BgpSrteV4TunnelTlv) (BgpSrteV4TunnelTlv, error) - // FromPbText unmarshals BgpSrteV4TunnelTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteV4TunnelTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteV4TunnelTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteV4TunnelTlv) Marshal() marshalBgpSrteV4TunnelTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteV4TunnelTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteV4TunnelTlv) Unmarshal() unMarshalBgpSrteV4TunnelTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteV4TunnelTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteV4TunnelTlv) ToProto() (*otg.BgpSrteV4TunnelTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteV4TunnelTlv) FromProto(msg *otg.BgpSrteV4TunnelTlv) (BgpSrteV4TunnelTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteV4TunnelTlv) 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 *unMarshalbgpSrteV4TunnelTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteV4TunnelTlv) 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 *unMarshalbgpSrteV4TunnelTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteV4TunnelTlv) 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 *unMarshalbgpSrteV4TunnelTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteV4TunnelTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteV4TunnelTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteV4TunnelTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteV4TunnelTlv) Clone() (BgpSrteV4TunnelTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteV4TunnelTlv() - 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 -} - -func (obj *bgpSrteV4TunnelTlv) setNil() { - obj.remoteEndpointSubTlvHolder = nil - obj.colorSubTlvHolder = nil - obj.bindingSubTlvHolder = nil - obj.preferenceSubTlvHolder = nil - obj.policyPrioritySubTlvHolder = nil - obj.policyNameSubTlvHolder = nil - obj.explicitNullLabelPolicySubTlvHolder = nil - obj.segmentListsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteV4TunnelTlv is configuration for BGP SRTE Tunnel TLV. -type BgpSrteV4TunnelTlv interface { - Validation - // msg marshals BgpSrteV4TunnelTlv to protobuf object *otg.BgpSrteV4TunnelTlv - // and doesn't set defaults - msg() *otg.BgpSrteV4TunnelTlv - // setMsg unmarshals BgpSrteV4TunnelTlv from protobuf object *otg.BgpSrteV4TunnelTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteV4TunnelTlv) BgpSrteV4TunnelTlv - // provides marshal interface - Marshal() marshalBgpSrteV4TunnelTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteV4TunnelTlv - // validate validates BgpSrteV4TunnelTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteV4TunnelTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RemoteEndpointSubTlv returns BgpSrteRemoteEndpointSubTlv, set in BgpSrteV4TunnelTlv. - // BgpSrteRemoteEndpointSubTlv is configuration for the BGP remote endpoint sub TLV. - RemoteEndpointSubTlv() BgpSrteRemoteEndpointSubTlv - // SetRemoteEndpointSubTlv assigns BgpSrteRemoteEndpointSubTlv provided by user to BgpSrteV4TunnelTlv. - // BgpSrteRemoteEndpointSubTlv is configuration for the BGP remote endpoint sub TLV. - SetRemoteEndpointSubTlv(value BgpSrteRemoteEndpointSubTlv) BgpSrteV4TunnelTlv - // HasRemoteEndpointSubTlv checks if RemoteEndpointSubTlv has been set in BgpSrteV4TunnelTlv - HasRemoteEndpointSubTlv() bool - // ColorSubTlv returns BgpSrteColorSubTlv, set in BgpSrteV4TunnelTlv. - // BgpSrteColorSubTlv is configuration for the Policy Color attribute sub-TLV. The Color sub-TLV MAY be used as a way to "color" the corresponding Tunnel TLV. The Value field of the sub-TLV is eight octets long and consists of a Color Extended Community. First two octets of its Value field are 0x030b as type and subtype of extended community. Remaining six octets are are exposed to configure. - ColorSubTlv() BgpSrteColorSubTlv - // SetColorSubTlv assigns BgpSrteColorSubTlv provided by user to BgpSrteV4TunnelTlv. - // BgpSrteColorSubTlv is configuration for the Policy Color attribute sub-TLV. The Color sub-TLV MAY be used as a way to "color" the corresponding Tunnel TLV. The Value field of the sub-TLV is eight octets long and consists of a Color Extended Community. First two octets of its Value field are 0x030b as type and subtype of extended community. Remaining six octets are are exposed to configure. - SetColorSubTlv(value BgpSrteColorSubTlv) BgpSrteV4TunnelTlv - // HasColorSubTlv checks if ColorSubTlv has been set in BgpSrteV4TunnelTlv - HasColorSubTlv() bool - // BindingSubTlv returns BgpSrteBindingSubTlv, set in BgpSrteV4TunnelTlv. - // BgpSrteBindingSubTlv is configuration for the binding SID sub-TLV. This is used to signal the binding SID related information of the SR Policy candidate path. - BindingSubTlv() BgpSrteBindingSubTlv - // SetBindingSubTlv assigns BgpSrteBindingSubTlv provided by user to BgpSrteV4TunnelTlv. - // BgpSrteBindingSubTlv is configuration for the binding SID sub-TLV. This is used to signal the binding SID related information of the SR Policy candidate path. - SetBindingSubTlv(value BgpSrteBindingSubTlv) BgpSrteV4TunnelTlv - // HasBindingSubTlv checks if BindingSubTlv has been set in BgpSrteV4TunnelTlv - HasBindingSubTlv() bool - // PreferenceSubTlv returns BgpSrtePreferenceSubTlv, set in BgpSrteV4TunnelTlv. - // BgpSrtePreferenceSubTlv is configuration for BGP preference sub TLV of the SR Policy candidate path. - PreferenceSubTlv() BgpSrtePreferenceSubTlv - // SetPreferenceSubTlv assigns BgpSrtePreferenceSubTlv provided by user to BgpSrteV4TunnelTlv. - // BgpSrtePreferenceSubTlv is configuration for BGP preference sub TLV of the SR Policy candidate path. - SetPreferenceSubTlv(value BgpSrtePreferenceSubTlv) BgpSrteV4TunnelTlv - // HasPreferenceSubTlv checks if PreferenceSubTlv has been set in BgpSrteV4TunnelTlv - HasPreferenceSubTlv() bool - // PolicyPrioritySubTlv returns BgpSrtePolicyPrioritySubTlv, set in BgpSrteV4TunnelTlv. - // BgpSrtePolicyPrioritySubTlv is configuration for the Policy Priority sub-TLV. The Policy Priority to indicate the order in which the SR policies are re-computed upon topological change. - PolicyPrioritySubTlv() BgpSrtePolicyPrioritySubTlv - // SetPolicyPrioritySubTlv assigns BgpSrtePolicyPrioritySubTlv provided by user to BgpSrteV4TunnelTlv. - // BgpSrtePolicyPrioritySubTlv is configuration for the Policy Priority sub-TLV. The Policy Priority to indicate the order in which the SR policies are re-computed upon topological change. - SetPolicyPrioritySubTlv(value BgpSrtePolicyPrioritySubTlv) BgpSrteV4TunnelTlv - // HasPolicyPrioritySubTlv checks if PolicyPrioritySubTlv has been set in BgpSrteV4TunnelTlv - HasPolicyPrioritySubTlv() bool - // PolicyNameSubTlv returns BgpSrtePolicyNameSubTlv, set in BgpSrteV4TunnelTlv. - // BgpSrtePolicyNameSubTlv is configuration for the Policy Name sub-TLV. The Policy Name sub-TLV is used to attach a symbolic name to the SR Policy candidate path. - PolicyNameSubTlv() BgpSrtePolicyNameSubTlv - // SetPolicyNameSubTlv assigns BgpSrtePolicyNameSubTlv provided by user to BgpSrteV4TunnelTlv. - // BgpSrtePolicyNameSubTlv is configuration for the Policy Name sub-TLV. The Policy Name sub-TLV is used to attach a symbolic name to the SR Policy candidate path. - SetPolicyNameSubTlv(value BgpSrtePolicyNameSubTlv) BgpSrteV4TunnelTlv - // HasPolicyNameSubTlv checks if PolicyNameSubTlv has been set in BgpSrteV4TunnelTlv - HasPolicyNameSubTlv() bool - // ExplicitNullLabelPolicySubTlv returns BgpSrteExplicitNullLabelPolicySubTlv, set in BgpSrteV4TunnelTlv. - // BgpSrteExplicitNullLabelPolicySubTlv is configuration for BGP explicit null label policy sub TLV settings. - ExplicitNullLabelPolicySubTlv() BgpSrteExplicitNullLabelPolicySubTlv - // SetExplicitNullLabelPolicySubTlv assigns BgpSrteExplicitNullLabelPolicySubTlv provided by user to BgpSrteV4TunnelTlv. - // BgpSrteExplicitNullLabelPolicySubTlv is configuration for BGP explicit null label policy sub TLV settings. - SetExplicitNullLabelPolicySubTlv(value BgpSrteExplicitNullLabelPolicySubTlv) BgpSrteV4TunnelTlv - // HasExplicitNullLabelPolicySubTlv checks if ExplicitNullLabelPolicySubTlv has been set in BgpSrteV4TunnelTlv - HasExplicitNullLabelPolicySubTlv() bool - // SegmentLists returns BgpSrteV4TunnelTlvBgpSrteSegmentListIterIter, set in BgpSrteV4TunnelTlv - SegmentLists() BgpSrteV4TunnelTlvBgpSrteSegmentListIter - // Name returns string, set in BgpSrteV4TunnelTlv. - Name() string - // SetName assigns string provided by user to BgpSrteV4TunnelTlv - SetName(value string) BgpSrteV4TunnelTlv - // Active returns bool, set in BgpSrteV4TunnelTlv. - Active() bool - // SetActive assigns bool provided by user to BgpSrteV4TunnelTlv - SetActive(value bool) BgpSrteV4TunnelTlv - // HasActive checks if Active has been set in BgpSrteV4TunnelTlv - HasActive() bool - setNil() -} - -// description is TBD -// RemoteEndpointSubTlv returns a BgpSrteRemoteEndpointSubTlv -func (obj *bgpSrteV4TunnelTlv) RemoteEndpointSubTlv() BgpSrteRemoteEndpointSubTlv { - if obj.obj.RemoteEndpointSubTlv == nil { - obj.obj.RemoteEndpointSubTlv = NewBgpSrteRemoteEndpointSubTlv().msg() - } - if obj.remoteEndpointSubTlvHolder == nil { - obj.remoteEndpointSubTlvHolder = &bgpSrteRemoteEndpointSubTlv{obj: obj.obj.RemoteEndpointSubTlv} - } - return obj.remoteEndpointSubTlvHolder -} - -// description is TBD -// RemoteEndpointSubTlv returns a BgpSrteRemoteEndpointSubTlv -func (obj *bgpSrteV4TunnelTlv) HasRemoteEndpointSubTlv() bool { - return obj.obj.RemoteEndpointSubTlv != nil -} - -// description is TBD -// SetRemoteEndpointSubTlv sets the BgpSrteRemoteEndpointSubTlv value in the BgpSrteV4TunnelTlv object -func (obj *bgpSrteV4TunnelTlv) SetRemoteEndpointSubTlv(value BgpSrteRemoteEndpointSubTlv) BgpSrteV4TunnelTlv { - - obj.remoteEndpointSubTlvHolder = nil - obj.obj.RemoteEndpointSubTlv = value.msg() - - return obj -} - -// description is TBD -// ColorSubTlv returns a BgpSrteColorSubTlv -func (obj *bgpSrteV4TunnelTlv) ColorSubTlv() BgpSrteColorSubTlv { - if obj.obj.ColorSubTlv == nil { - obj.obj.ColorSubTlv = NewBgpSrteColorSubTlv().msg() - } - if obj.colorSubTlvHolder == nil { - obj.colorSubTlvHolder = &bgpSrteColorSubTlv{obj: obj.obj.ColorSubTlv} - } - return obj.colorSubTlvHolder -} - -// description is TBD -// ColorSubTlv returns a BgpSrteColorSubTlv -func (obj *bgpSrteV4TunnelTlv) HasColorSubTlv() bool { - return obj.obj.ColorSubTlv != nil -} - -// description is TBD -// SetColorSubTlv sets the BgpSrteColorSubTlv value in the BgpSrteV4TunnelTlv object -func (obj *bgpSrteV4TunnelTlv) SetColorSubTlv(value BgpSrteColorSubTlv) BgpSrteV4TunnelTlv { - - obj.colorSubTlvHolder = nil - obj.obj.ColorSubTlv = value.msg() - - return obj -} - -// description is TBD -// BindingSubTlv returns a BgpSrteBindingSubTlv -func (obj *bgpSrteV4TunnelTlv) BindingSubTlv() BgpSrteBindingSubTlv { - if obj.obj.BindingSubTlv == nil { - obj.obj.BindingSubTlv = NewBgpSrteBindingSubTlv().msg() - } - if obj.bindingSubTlvHolder == nil { - obj.bindingSubTlvHolder = &bgpSrteBindingSubTlv{obj: obj.obj.BindingSubTlv} - } - return obj.bindingSubTlvHolder -} - -// description is TBD -// BindingSubTlv returns a BgpSrteBindingSubTlv -func (obj *bgpSrteV4TunnelTlv) HasBindingSubTlv() bool { - return obj.obj.BindingSubTlv != nil -} - -// description is TBD -// SetBindingSubTlv sets the BgpSrteBindingSubTlv value in the BgpSrteV4TunnelTlv object -func (obj *bgpSrteV4TunnelTlv) SetBindingSubTlv(value BgpSrteBindingSubTlv) BgpSrteV4TunnelTlv { - - obj.bindingSubTlvHolder = nil - obj.obj.BindingSubTlv = value.msg() - - return obj -} - -// description is TBD -// PreferenceSubTlv returns a BgpSrtePreferenceSubTlv -func (obj *bgpSrteV4TunnelTlv) PreferenceSubTlv() BgpSrtePreferenceSubTlv { - if obj.obj.PreferenceSubTlv == nil { - obj.obj.PreferenceSubTlv = NewBgpSrtePreferenceSubTlv().msg() - } - if obj.preferenceSubTlvHolder == nil { - obj.preferenceSubTlvHolder = &bgpSrtePreferenceSubTlv{obj: obj.obj.PreferenceSubTlv} - } - return obj.preferenceSubTlvHolder -} - -// description is TBD -// PreferenceSubTlv returns a BgpSrtePreferenceSubTlv -func (obj *bgpSrteV4TunnelTlv) HasPreferenceSubTlv() bool { - return obj.obj.PreferenceSubTlv != nil -} - -// description is TBD -// SetPreferenceSubTlv sets the BgpSrtePreferenceSubTlv value in the BgpSrteV4TunnelTlv object -func (obj *bgpSrteV4TunnelTlv) SetPreferenceSubTlv(value BgpSrtePreferenceSubTlv) BgpSrteV4TunnelTlv { - - obj.preferenceSubTlvHolder = nil - obj.obj.PreferenceSubTlv = value.msg() - - return obj -} - -// description is TBD -// PolicyPrioritySubTlv returns a BgpSrtePolicyPrioritySubTlv -func (obj *bgpSrteV4TunnelTlv) PolicyPrioritySubTlv() BgpSrtePolicyPrioritySubTlv { - if obj.obj.PolicyPrioritySubTlv == nil { - obj.obj.PolicyPrioritySubTlv = NewBgpSrtePolicyPrioritySubTlv().msg() - } - if obj.policyPrioritySubTlvHolder == nil { - obj.policyPrioritySubTlvHolder = &bgpSrtePolicyPrioritySubTlv{obj: obj.obj.PolicyPrioritySubTlv} - } - return obj.policyPrioritySubTlvHolder -} - -// description is TBD -// PolicyPrioritySubTlv returns a BgpSrtePolicyPrioritySubTlv -func (obj *bgpSrteV4TunnelTlv) HasPolicyPrioritySubTlv() bool { - return obj.obj.PolicyPrioritySubTlv != nil -} - -// description is TBD -// SetPolicyPrioritySubTlv sets the BgpSrtePolicyPrioritySubTlv value in the BgpSrteV4TunnelTlv object -func (obj *bgpSrteV4TunnelTlv) SetPolicyPrioritySubTlv(value BgpSrtePolicyPrioritySubTlv) BgpSrteV4TunnelTlv { - - obj.policyPrioritySubTlvHolder = nil - obj.obj.PolicyPrioritySubTlv = value.msg() - - return obj -} - -// description is TBD -// PolicyNameSubTlv returns a BgpSrtePolicyNameSubTlv -func (obj *bgpSrteV4TunnelTlv) PolicyNameSubTlv() BgpSrtePolicyNameSubTlv { - if obj.obj.PolicyNameSubTlv == nil { - obj.obj.PolicyNameSubTlv = NewBgpSrtePolicyNameSubTlv().msg() - } - if obj.policyNameSubTlvHolder == nil { - obj.policyNameSubTlvHolder = &bgpSrtePolicyNameSubTlv{obj: obj.obj.PolicyNameSubTlv} - } - return obj.policyNameSubTlvHolder -} - -// description is TBD -// PolicyNameSubTlv returns a BgpSrtePolicyNameSubTlv -func (obj *bgpSrteV4TunnelTlv) HasPolicyNameSubTlv() bool { - return obj.obj.PolicyNameSubTlv != nil -} - -// description is TBD -// SetPolicyNameSubTlv sets the BgpSrtePolicyNameSubTlv value in the BgpSrteV4TunnelTlv object -func (obj *bgpSrteV4TunnelTlv) SetPolicyNameSubTlv(value BgpSrtePolicyNameSubTlv) BgpSrteV4TunnelTlv { - - obj.policyNameSubTlvHolder = nil - obj.obj.PolicyNameSubTlv = value.msg() - - return obj -} - -// description is TBD -// ExplicitNullLabelPolicySubTlv returns a BgpSrteExplicitNullLabelPolicySubTlv -func (obj *bgpSrteV4TunnelTlv) ExplicitNullLabelPolicySubTlv() BgpSrteExplicitNullLabelPolicySubTlv { - if obj.obj.ExplicitNullLabelPolicySubTlv == nil { - obj.obj.ExplicitNullLabelPolicySubTlv = NewBgpSrteExplicitNullLabelPolicySubTlv().msg() - } - if obj.explicitNullLabelPolicySubTlvHolder == nil { - obj.explicitNullLabelPolicySubTlvHolder = &bgpSrteExplicitNullLabelPolicySubTlv{obj: obj.obj.ExplicitNullLabelPolicySubTlv} - } - return obj.explicitNullLabelPolicySubTlvHolder -} - -// description is TBD -// ExplicitNullLabelPolicySubTlv returns a BgpSrteExplicitNullLabelPolicySubTlv -func (obj *bgpSrteV4TunnelTlv) HasExplicitNullLabelPolicySubTlv() bool { - return obj.obj.ExplicitNullLabelPolicySubTlv != nil -} - -// description is TBD -// SetExplicitNullLabelPolicySubTlv sets the BgpSrteExplicitNullLabelPolicySubTlv value in the BgpSrteV4TunnelTlv object -func (obj *bgpSrteV4TunnelTlv) SetExplicitNullLabelPolicySubTlv(value BgpSrteExplicitNullLabelPolicySubTlv) BgpSrteV4TunnelTlv { - - obj.explicitNullLabelPolicySubTlvHolder = nil - obj.obj.ExplicitNullLabelPolicySubTlv = value.msg() - - return obj -} - -// description is TBD -// SegmentLists returns a []BgpSrteSegmentList -func (obj *bgpSrteV4TunnelTlv) SegmentLists() BgpSrteV4TunnelTlvBgpSrteSegmentListIter { - if len(obj.obj.SegmentLists) == 0 { - obj.obj.SegmentLists = []*otg.BgpSrteSegmentList{} - } - if obj.segmentListsHolder == nil { - obj.segmentListsHolder = newBgpSrteV4TunnelTlvBgpSrteSegmentListIter(&obj.obj.SegmentLists).setMsg(obj) - } - return obj.segmentListsHolder -} - -type bgpSrteV4TunnelTlvBgpSrteSegmentListIter struct { - obj *bgpSrteV4TunnelTlv - bgpSrteSegmentListSlice []BgpSrteSegmentList - fieldPtr *[]*otg.BgpSrteSegmentList -} - -func newBgpSrteV4TunnelTlvBgpSrteSegmentListIter(ptr *[]*otg.BgpSrteSegmentList) BgpSrteV4TunnelTlvBgpSrteSegmentListIter { - return &bgpSrteV4TunnelTlvBgpSrteSegmentListIter{fieldPtr: ptr} -} - -type BgpSrteV4TunnelTlvBgpSrteSegmentListIter interface { - setMsg(*bgpSrteV4TunnelTlv) BgpSrteV4TunnelTlvBgpSrteSegmentListIter - Items() []BgpSrteSegmentList - Add() BgpSrteSegmentList - Append(items ...BgpSrteSegmentList) BgpSrteV4TunnelTlvBgpSrteSegmentListIter - Set(index int, newObj BgpSrteSegmentList) BgpSrteV4TunnelTlvBgpSrteSegmentListIter - Clear() BgpSrteV4TunnelTlvBgpSrteSegmentListIter - clearHolderSlice() BgpSrteV4TunnelTlvBgpSrteSegmentListIter - appendHolderSlice(item BgpSrteSegmentList) BgpSrteV4TunnelTlvBgpSrteSegmentListIter -} - -func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) setMsg(msg *bgpSrteV4TunnelTlv) BgpSrteV4TunnelTlvBgpSrteSegmentListIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpSrteSegmentList{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) Items() []BgpSrteSegmentList { - return obj.bgpSrteSegmentListSlice -} - -func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) Add() BgpSrteSegmentList { - newObj := &otg.BgpSrteSegmentList{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpSrteSegmentList{obj: newObj} - newLibObj.setDefault() - obj.bgpSrteSegmentListSlice = append(obj.bgpSrteSegmentListSlice, newLibObj) - return newLibObj -} - -func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) Append(items ...BgpSrteSegmentList) BgpSrteV4TunnelTlvBgpSrteSegmentListIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpSrteSegmentListSlice = append(obj.bgpSrteSegmentListSlice, item) - } - return obj -} - -func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) Set(index int, newObj BgpSrteSegmentList) BgpSrteV4TunnelTlvBgpSrteSegmentListIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpSrteSegmentListSlice[index] = newObj - return obj -} -func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) Clear() BgpSrteV4TunnelTlvBgpSrteSegmentListIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpSrteSegmentList{} - obj.bgpSrteSegmentListSlice = []BgpSrteSegmentList{} - } - return obj -} -func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) clearHolderSlice() BgpSrteV4TunnelTlvBgpSrteSegmentListIter { - if len(obj.bgpSrteSegmentListSlice) > 0 { - obj.bgpSrteSegmentListSlice = []BgpSrteSegmentList{} - } - return obj -} -func (obj *bgpSrteV4TunnelTlvBgpSrteSegmentListIter) appendHolderSlice(item BgpSrteSegmentList) BgpSrteV4TunnelTlvBgpSrteSegmentListIter { - obj.bgpSrteSegmentListSlice = append(obj.bgpSrteSegmentListSlice, item) - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *bgpSrteV4TunnelTlv) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the BgpSrteV4TunnelTlv object -func (obj *bgpSrteV4TunnelTlv) SetName(value string) BgpSrteV4TunnelTlv { - - obj.obj.Name = &value - return obj -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// Active returns a bool -func (obj *bgpSrteV4TunnelTlv) Active() bool { - - return *obj.obj.Active - -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// Active returns a bool -func (obj *bgpSrteV4TunnelTlv) HasActive() bool { - return obj.obj.Active != nil -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// SetActive sets the bool value in the BgpSrteV4TunnelTlv object -func (obj *bgpSrteV4TunnelTlv) SetActive(value bool) BgpSrteV4TunnelTlv { - - obj.obj.Active = &value - return obj -} - -func (obj *bgpSrteV4TunnelTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RemoteEndpointSubTlv != nil { - - obj.RemoteEndpointSubTlv().validateObj(vObj, set_default) - } - - if obj.obj.ColorSubTlv != nil { - - obj.ColorSubTlv().validateObj(vObj, set_default) - } - - if obj.obj.BindingSubTlv != nil { - - obj.BindingSubTlv().validateObj(vObj, set_default) - } - - if obj.obj.PreferenceSubTlv != nil { - - obj.PreferenceSubTlv().validateObj(vObj, set_default) - } - - if obj.obj.PolicyPrioritySubTlv != nil { - - obj.PolicyPrioritySubTlv().validateObj(vObj, set_default) - } - - if obj.obj.PolicyNameSubTlv != nil { - - obj.PolicyNameSubTlv().validateObj(vObj, set_default) - } - - if obj.obj.ExplicitNullLabelPolicySubTlv != nil { - - obj.ExplicitNullLabelPolicySubTlv().validateObj(vObj, set_default) - } - - if len(obj.obj.SegmentLists) != 0 { - - if set_default { - obj.SegmentLists().clearHolderSlice() - for _, item := range obj.obj.SegmentLists { - obj.SegmentLists().appendHolderSlice(&bgpSrteSegmentList{obj: item}) - } - } - for _, item := range obj.SegmentLists().Items() { - item.validateObj(vObj, set_default) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpSrteV4TunnelTlv") - } -} - -func (obj *bgpSrteV4TunnelTlv) setDefault() { - if obj.obj.Active == nil { - obj.SetActive(true) - } - -} - -// ***** BgpSrteV6TunnelTlv ***** -type bgpSrteV6TunnelTlv struct { - validation - obj *otg.BgpSrteV6TunnelTlv - marshaller marshalBgpSrteV6TunnelTlv - unMarshaller unMarshalBgpSrteV6TunnelTlv - remoteEndpointSubTlvHolder BgpSrteRemoteEndpointSubTlv - colorSubTlvHolder BgpSrteColorSubTlv - bindingSubTlvHolder BgpSrteBindingSubTlv - preferenceSubTlvHolder BgpSrtePreferenceSubTlv - policyPrioritySubTlvHolder BgpSrtePolicyPrioritySubTlv - policyNameSubTlvHolder BgpSrtePolicyNameSubTlv - explicitNullLabelPolicySubTlvHolder BgpSrteExplicitNullLabelPolicySubTlv - segmentListsHolder BgpSrteV6TunnelTlvBgpSrteSegmentListIter -} - -func NewBgpSrteV6TunnelTlv() BgpSrteV6TunnelTlv { - obj := bgpSrteV6TunnelTlv{obj: &otg.BgpSrteV6TunnelTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteV6TunnelTlv) msg() *otg.BgpSrteV6TunnelTlv { - return obj.obj -} - -func (obj *bgpSrteV6TunnelTlv) setMsg(msg *otg.BgpSrteV6TunnelTlv) BgpSrteV6TunnelTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteV6TunnelTlv struct { - obj *bgpSrteV6TunnelTlv -} - -type marshalBgpSrteV6TunnelTlv interface { - // ToProto marshals BgpSrteV6TunnelTlv to protobuf object *otg.BgpSrteV6TunnelTlv - ToProto() (*otg.BgpSrteV6TunnelTlv, error) - // ToPbText marshals BgpSrteV6TunnelTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteV6TunnelTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteV6TunnelTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteV6TunnelTlv struct { - obj *bgpSrteV6TunnelTlv -} - -type unMarshalBgpSrteV6TunnelTlv interface { - // FromProto unmarshals BgpSrteV6TunnelTlv from protobuf object *otg.BgpSrteV6TunnelTlv - FromProto(msg *otg.BgpSrteV6TunnelTlv) (BgpSrteV6TunnelTlv, error) - // FromPbText unmarshals BgpSrteV6TunnelTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteV6TunnelTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteV6TunnelTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteV6TunnelTlv) Marshal() marshalBgpSrteV6TunnelTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteV6TunnelTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteV6TunnelTlv) Unmarshal() unMarshalBgpSrteV6TunnelTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteV6TunnelTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteV6TunnelTlv) ToProto() (*otg.BgpSrteV6TunnelTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteV6TunnelTlv) FromProto(msg *otg.BgpSrteV6TunnelTlv) (BgpSrteV6TunnelTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteV6TunnelTlv) 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 *unMarshalbgpSrteV6TunnelTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteV6TunnelTlv) 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 *unMarshalbgpSrteV6TunnelTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteV6TunnelTlv) 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 *unMarshalbgpSrteV6TunnelTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteV6TunnelTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteV6TunnelTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteV6TunnelTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteV6TunnelTlv) Clone() (BgpSrteV6TunnelTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteV6TunnelTlv() - 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 -} - -func (obj *bgpSrteV6TunnelTlv) setNil() { - obj.remoteEndpointSubTlvHolder = nil - obj.colorSubTlvHolder = nil - obj.bindingSubTlvHolder = nil - obj.preferenceSubTlvHolder = nil - obj.policyPrioritySubTlvHolder = nil - obj.policyNameSubTlvHolder = nil - obj.explicitNullLabelPolicySubTlvHolder = nil - obj.segmentListsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteV6TunnelTlv is configuration for BGP SRTE Tunnel TLV. -type BgpSrteV6TunnelTlv interface { - Validation - // msg marshals BgpSrteV6TunnelTlv to protobuf object *otg.BgpSrteV6TunnelTlv - // and doesn't set defaults - msg() *otg.BgpSrteV6TunnelTlv - // setMsg unmarshals BgpSrteV6TunnelTlv from protobuf object *otg.BgpSrteV6TunnelTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteV6TunnelTlv) BgpSrteV6TunnelTlv - // provides marshal interface - Marshal() marshalBgpSrteV6TunnelTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteV6TunnelTlv - // validate validates BgpSrteV6TunnelTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteV6TunnelTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RemoteEndpointSubTlv returns BgpSrteRemoteEndpointSubTlv, set in BgpSrteV6TunnelTlv. - // BgpSrteRemoteEndpointSubTlv is configuration for the BGP remote endpoint sub TLV. - RemoteEndpointSubTlv() BgpSrteRemoteEndpointSubTlv - // SetRemoteEndpointSubTlv assigns BgpSrteRemoteEndpointSubTlv provided by user to BgpSrteV6TunnelTlv. - // BgpSrteRemoteEndpointSubTlv is configuration for the BGP remote endpoint sub TLV. - SetRemoteEndpointSubTlv(value BgpSrteRemoteEndpointSubTlv) BgpSrteV6TunnelTlv - // HasRemoteEndpointSubTlv checks if RemoteEndpointSubTlv has been set in BgpSrteV6TunnelTlv - HasRemoteEndpointSubTlv() bool - // ColorSubTlv returns BgpSrteColorSubTlv, set in BgpSrteV6TunnelTlv. - // BgpSrteColorSubTlv is configuration for the Policy Color attribute sub-TLV. The Color sub-TLV MAY be used as a way to "color" the corresponding Tunnel TLV. The Value field of the sub-TLV is eight octets long and consists of a Color Extended Community. First two octets of its Value field are 0x030b as type and subtype of extended community. Remaining six octets are are exposed to configure. - ColorSubTlv() BgpSrteColorSubTlv - // SetColorSubTlv assigns BgpSrteColorSubTlv provided by user to BgpSrteV6TunnelTlv. - // BgpSrteColorSubTlv is configuration for the Policy Color attribute sub-TLV. The Color sub-TLV MAY be used as a way to "color" the corresponding Tunnel TLV. The Value field of the sub-TLV is eight octets long and consists of a Color Extended Community. First two octets of its Value field are 0x030b as type and subtype of extended community. Remaining six octets are are exposed to configure. - SetColorSubTlv(value BgpSrteColorSubTlv) BgpSrteV6TunnelTlv - // HasColorSubTlv checks if ColorSubTlv has been set in BgpSrteV6TunnelTlv - HasColorSubTlv() bool - // BindingSubTlv returns BgpSrteBindingSubTlv, set in BgpSrteV6TunnelTlv. - // BgpSrteBindingSubTlv is configuration for the binding SID sub-TLV. This is used to signal the binding SID related information of the SR Policy candidate path. - BindingSubTlv() BgpSrteBindingSubTlv - // SetBindingSubTlv assigns BgpSrteBindingSubTlv provided by user to BgpSrteV6TunnelTlv. - // BgpSrteBindingSubTlv is configuration for the binding SID sub-TLV. This is used to signal the binding SID related information of the SR Policy candidate path. - SetBindingSubTlv(value BgpSrteBindingSubTlv) BgpSrteV6TunnelTlv - // HasBindingSubTlv checks if BindingSubTlv has been set in BgpSrteV6TunnelTlv - HasBindingSubTlv() bool - // PreferenceSubTlv returns BgpSrtePreferenceSubTlv, set in BgpSrteV6TunnelTlv. - // BgpSrtePreferenceSubTlv is configuration for BGP preference sub TLV of the SR Policy candidate path. - PreferenceSubTlv() BgpSrtePreferenceSubTlv - // SetPreferenceSubTlv assigns BgpSrtePreferenceSubTlv provided by user to BgpSrteV6TunnelTlv. - // BgpSrtePreferenceSubTlv is configuration for BGP preference sub TLV of the SR Policy candidate path. - SetPreferenceSubTlv(value BgpSrtePreferenceSubTlv) BgpSrteV6TunnelTlv - // HasPreferenceSubTlv checks if PreferenceSubTlv has been set in BgpSrteV6TunnelTlv - HasPreferenceSubTlv() bool - // PolicyPrioritySubTlv returns BgpSrtePolicyPrioritySubTlv, set in BgpSrteV6TunnelTlv. - // BgpSrtePolicyPrioritySubTlv is configuration for the Policy Priority sub-TLV. The Policy Priority to indicate the order in which the SR policies are re-computed upon topological change. - PolicyPrioritySubTlv() BgpSrtePolicyPrioritySubTlv - // SetPolicyPrioritySubTlv assigns BgpSrtePolicyPrioritySubTlv provided by user to BgpSrteV6TunnelTlv. - // BgpSrtePolicyPrioritySubTlv is configuration for the Policy Priority sub-TLV. The Policy Priority to indicate the order in which the SR policies are re-computed upon topological change. - SetPolicyPrioritySubTlv(value BgpSrtePolicyPrioritySubTlv) BgpSrteV6TunnelTlv - // HasPolicyPrioritySubTlv checks if PolicyPrioritySubTlv has been set in BgpSrteV6TunnelTlv - HasPolicyPrioritySubTlv() bool - // PolicyNameSubTlv returns BgpSrtePolicyNameSubTlv, set in BgpSrteV6TunnelTlv. - // BgpSrtePolicyNameSubTlv is configuration for the Policy Name sub-TLV. The Policy Name sub-TLV is used to attach a symbolic name to the SR Policy candidate path. - PolicyNameSubTlv() BgpSrtePolicyNameSubTlv - // SetPolicyNameSubTlv assigns BgpSrtePolicyNameSubTlv provided by user to BgpSrteV6TunnelTlv. - // BgpSrtePolicyNameSubTlv is configuration for the Policy Name sub-TLV. The Policy Name sub-TLV is used to attach a symbolic name to the SR Policy candidate path. - SetPolicyNameSubTlv(value BgpSrtePolicyNameSubTlv) BgpSrteV6TunnelTlv - // HasPolicyNameSubTlv checks if PolicyNameSubTlv has been set in BgpSrteV6TunnelTlv - HasPolicyNameSubTlv() bool - // ExplicitNullLabelPolicySubTlv returns BgpSrteExplicitNullLabelPolicySubTlv, set in BgpSrteV6TunnelTlv. - // BgpSrteExplicitNullLabelPolicySubTlv is configuration for BGP explicit null label policy sub TLV settings. - ExplicitNullLabelPolicySubTlv() BgpSrteExplicitNullLabelPolicySubTlv - // SetExplicitNullLabelPolicySubTlv assigns BgpSrteExplicitNullLabelPolicySubTlv provided by user to BgpSrteV6TunnelTlv. - // BgpSrteExplicitNullLabelPolicySubTlv is configuration for BGP explicit null label policy sub TLV settings. - SetExplicitNullLabelPolicySubTlv(value BgpSrteExplicitNullLabelPolicySubTlv) BgpSrteV6TunnelTlv - // HasExplicitNullLabelPolicySubTlv checks if ExplicitNullLabelPolicySubTlv has been set in BgpSrteV6TunnelTlv - HasExplicitNullLabelPolicySubTlv() bool - // SegmentLists returns BgpSrteV6TunnelTlvBgpSrteSegmentListIterIter, set in BgpSrteV6TunnelTlv - SegmentLists() BgpSrteV6TunnelTlvBgpSrteSegmentListIter - // Name returns string, set in BgpSrteV6TunnelTlv. - Name() string - // SetName assigns string provided by user to BgpSrteV6TunnelTlv - SetName(value string) BgpSrteV6TunnelTlv - // Active returns bool, set in BgpSrteV6TunnelTlv. - Active() bool - // SetActive assigns bool provided by user to BgpSrteV6TunnelTlv - SetActive(value bool) BgpSrteV6TunnelTlv - // HasActive checks if Active has been set in BgpSrteV6TunnelTlv - HasActive() bool - setNil() -} - -// description is TBD -// RemoteEndpointSubTlv returns a BgpSrteRemoteEndpointSubTlv -func (obj *bgpSrteV6TunnelTlv) RemoteEndpointSubTlv() BgpSrteRemoteEndpointSubTlv { - if obj.obj.RemoteEndpointSubTlv == nil { - obj.obj.RemoteEndpointSubTlv = NewBgpSrteRemoteEndpointSubTlv().msg() - } - if obj.remoteEndpointSubTlvHolder == nil { - obj.remoteEndpointSubTlvHolder = &bgpSrteRemoteEndpointSubTlv{obj: obj.obj.RemoteEndpointSubTlv} - } - return obj.remoteEndpointSubTlvHolder -} - -// description is TBD -// RemoteEndpointSubTlv returns a BgpSrteRemoteEndpointSubTlv -func (obj *bgpSrteV6TunnelTlv) HasRemoteEndpointSubTlv() bool { - return obj.obj.RemoteEndpointSubTlv != nil -} - -// description is TBD -// SetRemoteEndpointSubTlv sets the BgpSrteRemoteEndpointSubTlv value in the BgpSrteV6TunnelTlv object -func (obj *bgpSrteV6TunnelTlv) SetRemoteEndpointSubTlv(value BgpSrteRemoteEndpointSubTlv) BgpSrteV6TunnelTlv { - - obj.remoteEndpointSubTlvHolder = nil - obj.obj.RemoteEndpointSubTlv = value.msg() - - return obj -} - -// description is TBD -// ColorSubTlv returns a BgpSrteColorSubTlv -func (obj *bgpSrteV6TunnelTlv) ColorSubTlv() BgpSrteColorSubTlv { - if obj.obj.ColorSubTlv == nil { - obj.obj.ColorSubTlv = NewBgpSrteColorSubTlv().msg() - } - if obj.colorSubTlvHolder == nil { - obj.colorSubTlvHolder = &bgpSrteColorSubTlv{obj: obj.obj.ColorSubTlv} - } - return obj.colorSubTlvHolder -} - -// description is TBD -// ColorSubTlv returns a BgpSrteColorSubTlv -func (obj *bgpSrteV6TunnelTlv) HasColorSubTlv() bool { - return obj.obj.ColorSubTlv != nil -} - -// description is TBD -// SetColorSubTlv sets the BgpSrteColorSubTlv value in the BgpSrteV6TunnelTlv object -func (obj *bgpSrteV6TunnelTlv) SetColorSubTlv(value BgpSrteColorSubTlv) BgpSrteV6TunnelTlv { - - obj.colorSubTlvHolder = nil - obj.obj.ColorSubTlv = value.msg() - - return obj -} - -// description is TBD -// BindingSubTlv returns a BgpSrteBindingSubTlv -func (obj *bgpSrteV6TunnelTlv) BindingSubTlv() BgpSrteBindingSubTlv { - if obj.obj.BindingSubTlv == nil { - obj.obj.BindingSubTlv = NewBgpSrteBindingSubTlv().msg() - } - if obj.bindingSubTlvHolder == nil { - obj.bindingSubTlvHolder = &bgpSrteBindingSubTlv{obj: obj.obj.BindingSubTlv} - } - return obj.bindingSubTlvHolder -} - -// description is TBD -// BindingSubTlv returns a BgpSrteBindingSubTlv -func (obj *bgpSrteV6TunnelTlv) HasBindingSubTlv() bool { - return obj.obj.BindingSubTlv != nil -} - -// description is TBD -// SetBindingSubTlv sets the BgpSrteBindingSubTlv value in the BgpSrteV6TunnelTlv object -func (obj *bgpSrteV6TunnelTlv) SetBindingSubTlv(value BgpSrteBindingSubTlv) BgpSrteV6TunnelTlv { - - obj.bindingSubTlvHolder = nil - obj.obj.BindingSubTlv = value.msg() - - return obj -} - -// description is TBD -// PreferenceSubTlv returns a BgpSrtePreferenceSubTlv -func (obj *bgpSrteV6TunnelTlv) PreferenceSubTlv() BgpSrtePreferenceSubTlv { - if obj.obj.PreferenceSubTlv == nil { - obj.obj.PreferenceSubTlv = NewBgpSrtePreferenceSubTlv().msg() - } - if obj.preferenceSubTlvHolder == nil { - obj.preferenceSubTlvHolder = &bgpSrtePreferenceSubTlv{obj: obj.obj.PreferenceSubTlv} - } - return obj.preferenceSubTlvHolder -} - -// description is TBD -// PreferenceSubTlv returns a BgpSrtePreferenceSubTlv -func (obj *bgpSrteV6TunnelTlv) HasPreferenceSubTlv() bool { - return obj.obj.PreferenceSubTlv != nil -} - -// description is TBD -// SetPreferenceSubTlv sets the BgpSrtePreferenceSubTlv value in the BgpSrteV6TunnelTlv object -func (obj *bgpSrteV6TunnelTlv) SetPreferenceSubTlv(value BgpSrtePreferenceSubTlv) BgpSrteV6TunnelTlv { - - obj.preferenceSubTlvHolder = nil - obj.obj.PreferenceSubTlv = value.msg() - - return obj -} - -// description is TBD -// PolicyPrioritySubTlv returns a BgpSrtePolicyPrioritySubTlv -func (obj *bgpSrteV6TunnelTlv) PolicyPrioritySubTlv() BgpSrtePolicyPrioritySubTlv { - if obj.obj.PolicyPrioritySubTlv == nil { - obj.obj.PolicyPrioritySubTlv = NewBgpSrtePolicyPrioritySubTlv().msg() - } - if obj.policyPrioritySubTlvHolder == nil { - obj.policyPrioritySubTlvHolder = &bgpSrtePolicyPrioritySubTlv{obj: obj.obj.PolicyPrioritySubTlv} - } - return obj.policyPrioritySubTlvHolder -} - -// description is TBD -// PolicyPrioritySubTlv returns a BgpSrtePolicyPrioritySubTlv -func (obj *bgpSrteV6TunnelTlv) HasPolicyPrioritySubTlv() bool { - return obj.obj.PolicyPrioritySubTlv != nil -} - -// description is TBD -// SetPolicyPrioritySubTlv sets the BgpSrtePolicyPrioritySubTlv value in the BgpSrteV6TunnelTlv object -func (obj *bgpSrteV6TunnelTlv) SetPolicyPrioritySubTlv(value BgpSrtePolicyPrioritySubTlv) BgpSrteV6TunnelTlv { - - obj.policyPrioritySubTlvHolder = nil - obj.obj.PolicyPrioritySubTlv = value.msg() - - return obj -} - -// description is TBD -// PolicyNameSubTlv returns a BgpSrtePolicyNameSubTlv -func (obj *bgpSrteV6TunnelTlv) PolicyNameSubTlv() BgpSrtePolicyNameSubTlv { - if obj.obj.PolicyNameSubTlv == nil { - obj.obj.PolicyNameSubTlv = NewBgpSrtePolicyNameSubTlv().msg() - } - if obj.policyNameSubTlvHolder == nil { - obj.policyNameSubTlvHolder = &bgpSrtePolicyNameSubTlv{obj: obj.obj.PolicyNameSubTlv} - } - return obj.policyNameSubTlvHolder -} - -// description is TBD -// PolicyNameSubTlv returns a BgpSrtePolicyNameSubTlv -func (obj *bgpSrteV6TunnelTlv) HasPolicyNameSubTlv() bool { - return obj.obj.PolicyNameSubTlv != nil -} - -// description is TBD -// SetPolicyNameSubTlv sets the BgpSrtePolicyNameSubTlv value in the BgpSrteV6TunnelTlv object -func (obj *bgpSrteV6TunnelTlv) SetPolicyNameSubTlv(value BgpSrtePolicyNameSubTlv) BgpSrteV6TunnelTlv { - - obj.policyNameSubTlvHolder = nil - obj.obj.PolicyNameSubTlv = value.msg() - - return obj -} - -// description is TBD -// ExplicitNullLabelPolicySubTlv returns a BgpSrteExplicitNullLabelPolicySubTlv -func (obj *bgpSrteV6TunnelTlv) ExplicitNullLabelPolicySubTlv() BgpSrteExplicitNullLabelPolicySubTlv { - if obj.obj.ExplicitNullLabelPolicySubTlv == nil { - obj.obj.ExplicitNullLabelPolicySubTlv = NewBgpSrteExplicitNullLabelPolicySubTlv().msg() - } - if obj.explicitNullLabelPolicySubTlvHolder == nil { - obj.explicitNullLabelPolicySubTlvHolder = &bgpSrteExplicitNullLabelPolicySubTlv{obj: obj.obj.ExplicitNullLabelPolicySubTlv} - } - return obj.explicitNullLabelPolicySubTlvHolder -} - -// description is TBD -// ExplicitNullLabelPolicySubTlv returns a BgpSrteExplicitNullLabelPolicySubTlv -func (obj *bgpSrteV6TunnelTlv) HasExplicitNullLabelPolicySubTlv() bool { - return obj.obj.ExplicitNullLabelPolicySubTlv != nil -} - -// description is TBD -// SetExplicitNullLabelPolicySubTlv sets the BgpSrteExplicitNullLabelPolicySubTlv value in the BgpSrteV6TunnelTlv object -func (obj *bgpSrteV6TunnelTlv) SetExplicitNullLabelPolicySubTlv(value BgpSrteExplicitNullLabelPolicySubTlv) BgpSrteV6TunnelTlv { - - obj.explicitNullLabelPolicySubTlvHolder = nil - obj.obj.ExplicitNullLabelPolicySubTlv = value.msg() - - return obj -} - -// description is TBD -// SegmentLists returns a []BgpSrteSegmentList -func (obj *bgpSrteV6TunnelTlv) SegmentLists() BgpSrteV6TunnelTlvBgpSrteSegmentListIter { - if len(obj.obj.SegmentLists) == 0 { - obj.obj.SegmentLists = []*otg.BgpSrteSegmentList{} - } - if obj.segmentListsHolder == nil { - obj.segmentListsHolder = newBgpSrteV6TunnelTlvBgpSrteSegmentListIter(&obj.obj.SegmentLists).setMsg(obj) - } - return obj.segmentListsHolder -} - -type bgpSrteV6TunnelTlvBgpSrteSegmentListIter struct { - obj *bgpSrteV6TunnelTlv - bgpSrteSegmentListSlice []BgpSrteSegmentList - fieldPtr *[]*otg.BgpSrteSegmentList -} - -func newBgpSrteV6TunnelTlvBgpSrteSegmentListIter(ptr *[]*otg.BgpSrteSegmentList) BgpSrteV6TunnelTlvBgpSrteSegmentListIter { - return &bgpSrteV6TunnelTlvBgpSrteSegmentListIter{fieldPtr: ptr} -} - -type BgpSrteV6TunnelTlvBgpSrteSegmentListIter interface { - setMsg(*bgpSrteV6TunnelTlv) BgpSrteV6TunnelTlvBgpSrteSegmentListIter - Items() []BgpSrteSegmentList - Add() BgpSrteSegmentList - Append(items ...BgpSrteSegmentList) BgpSrteV6TunnelTlvBgpSrteSegmentListIter - Set(index int, newObj BgpSrteSegmentList) BgpSrteV6TunnelTlvBgpSrteSegmentListIter - Clear() BgpSrteV6TunnelTlvBgpSrteSegmentListIter - clearHolderSlice() BgpSrteV6TunnelTlvBgpSrteSegmentListIter - appendHolderSlice(item BgpSrteSegmentList) BgpSrteV6TunnelTlvBgpSrteSegmentListIter -} - -func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) setMsg(msg *bgpSrteV6TunnelTlv) BgpSrteV6TunnelTlvBgpSrteSegmentListIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpSrteSegmentList{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) Items() []BgpSrteSegmentList { - return obj.bgpSrteSegmentListSlice -} - -func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) Add() BgpSrteSegmentList { - newObj := &otg.BgpSrteSegmentList{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpSrteSegmentList{obj: newObj} - newLibObj.setDefault() - obj.bgpSrteSegmentListSlice = append(obj.bgpSrteSegmentListSlice, newLibObj) - return newLibObj -} - -func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) Append(items ...BgpSrteSegmentList) BgpSrteV6TunnelTlvBgpSrteSegmentListIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpSrteSegmentListSlice = append(obj.bgpSrteSegmentListSlice, item) - } - return obj -} - -func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) Set(index int, newObj BgpSrteSegmentList) BgpSrteV6TunnelTlvBgpSrteSegmentListIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpSrteSegmentListSlice[index] = newObj - return obj -} -func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) Clear() BgpSrteV6TunnelTlvBgpSrteSegmentListIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpSrteSegmentList{} - obj.bgpSrteSegmentListSlice = []BgpSrteSegmentList{} - } - return obj -} -func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) clearHolderSlice() BgpSrteV6TunnelTlvBgpSrteSegmentListIter { - if len(obj.bgpSrteSegmentListSlice) > 0 { - obj.bgpSrteSegmentListSlice = []BgpSrteSegmentList{} - } - return obj -} -func (obj *bgpSrteV6TunnelTlvBgpSrteSegmentListIter) appendHolderSlice(item BgpSrteSegmentList) BgpSrteV6TunnelTlvBgpSrteSegmentListIter { - obj.bgpSrteSegmentListSlice = append(obj.bgpSrteSegmentListSlice, item) - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *bgpSrteV6TunnelTlv) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the BgpSrteV6TunnelTlv object -func (obj *bgpSrteV6TunnelTlv) SetName(value string) BgpSrteV6TunnelTlv { - - obj.obj.Name = &value - return obj -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// Active returns a bool -func (obj *bgpSrteV6TunnelTlv) Active() bool { - - return *obj.obj.Active - -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// Active returns a bool -func (obj *bgpSrteV6TunnelTlv) HasActive() bool { - return obj.obj.Active != nil -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// SetActive sets the bool value in the BgpSrteV6TunnelTlv object -func (obj *bgpSrteV6TunnelTlv) SetActive(value bool) BgpSrteV6TunnelTlv { - - obj.obj.Active = &value - return obj -} - -func (obj *bgpSrteV6TunnelTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RemoteEndpointSubTlv != nil { - - obj.RemoteEndpointSubTlv().validateObj(vObj, set_default) - } - - if obj.obj.ColorSubTlv != nil { - - obj.ColorSubTlv().validateObj(vObj, set_default) - } - - if obj.obj.BindingSubTlv != nil { - - obj.BindingSubTlv().validateObj(vObj, set_default) - } - - if obj.obj.PreferenceSubTlv != nil { - - obj.PreferenceSubTlv().validateObj(vObj, set_default) - } - - if obj.obj.PolicyPrioritySubTlv != nil { - - obj.PolicyPrioritySubTlv().validateObj(vObj, set_default) - } - - if obj.obj.PolicyNameSubTlv != nil { - - obj.PolicyNameSubTlv().validateObj(vObj, set_default) - } - - if obj.obj.ExplicitNullLabelPolicySubTlv != nil { - - obj.ExplicitNullLabelPolicySubTlv().validateObj(vObj, set_default) - } - - if len(obj.obj.SegmentLists) != 0 { - - if set_default { - obj.SegmentLists().clearHolderSlice() - for _, item := range obj.obj.SegmentLists { - obj.SegmentLists().appendHolderSlice(&bgpSrteSegmentList{obj: item}) - } - } - for _, item := range obj.SegmentLists().Items() { - item.validateObj(vObj, set_default) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpSrteV6TunnelTlv") - } -} - -func (obj *bgpSrteV6TunnelTlv) setDefault() { - if obj.obj.Active == nil { - obj.SetActive(true) - } - -} - -// ***** BgpStructuredPdus ***** -type bgpStructuredPdus struct { - validation - obj *otg.BgpStructuredPdus - marshaller marshalBgpStructuredPdus - unMarshaller unMarshalBgpStructuredPdus - updatesHolder BgpStructuredPdusBgpOneStructuredUpdateReplayIter -} - -func NewBgpStructuredPdus() BgpStructuredPdus { - obj := bgpStructuredPdus{obj: &otg.BgpStructuredPdus{}} - obj.setDefault() - return &obj -} - -func (obj *bgpStructuredPdus) msg() *otg.BgpStructuredPdus { - return obj.obj -} - -func (obj *bgpStructuredPdus) setMsg(msg *otg.BgpStructuredPdus) BgpStructuredPdus { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpStructuredPdus struct { - obj *bgpStructuredPdus -} - -type marshalBgpStructuredPdus interface { - // ToProto marshals BgpStructuredPdus to protobuf object *otg.BgpStructuredPdus - ToProto() (*otg.BgpStructuredPdus, error) - // ToPbText marshals BgpStructuredPdus to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpStructuredPdus to YAML text - ToYaml() (string, error) - // ToJson marshals BgpStructuredPdus to JSON text - ToJson() (string, error) -} - -type unMarshalbgpStructuredPdus struct { - obj *bgpStructuredPdus -} - -type unMarshalBgpStructuredPdus interface { - // FromProto unmarshals BgpStructuredPdus from protobuf object *otg.BgpStructuredPdus - FromProto(msg *otg.BgpStructuredPdus) (BgpStructuredPdus, error) - // FromPbText unmarshals BgpStructuredPdus from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpStructuredPdus from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpStructuredPdus from JSON text - FromJson(value string) error -} - -func (obj *bgpStructuredPdus) Marshal() marshalBgpStructuredPdus { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpStructuredPdus{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpStructuredPdus) Unmarshal() unMarshalBgpStructuredPdus { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpStructuredPdus{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpStructuredPdus) ToProto() (*otg.BgpStructuredPdus, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpStructuredPdus) FromProto(msg *otg.BgpStructuredPdus) (BgpStructuredPdus, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpStructuredPdus) 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 *unMarshalbgpStructuredPdus) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpStructuredPdus) 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 *unMarshalbgpStructuredPdus) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpStructuredPdus) 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 *unMarshalbgpStructuredPdus) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpStructuredPdus) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpStructuredPdus) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpStructuredPdus) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpStructuredPdus) Clone() (BgpStructuredPdus, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpStructuredPdus() - 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 -} - -func (obj *bgpStructuredPdus) setNil() { - obj.updatesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpStructuredPdus is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. -type BgpStructuredPdus interface { - Validation - // msg marshals BgpStructuredPdus to protobuf object *otg.BgpStructuredPdus - // and doesn't set defaults - msg() *otg.BgpStructuredPdus - // setMsg unmarshals BgpStructuredPdus from protobuf object *otg.BgpStructuredPdus - // and doesn't set defaults - setMsg(*otg.BgpStructuredPdus) BgpStructuredPdus - // provides marshal interface - Marshal() marshalBgpStructuredPdus - // provides unmarshal interface - Unmarshal() unMarshalBgpStructuredPdus - // validate validates BgpStructuredPdus - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpStructuredPdus, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Updates returns BgpStructuredPdusBgpOneStructuredUpdateReplayIterIter, set in BgpStructuredPdus - Updates() BgpStructuredPdusBgpOneStructuredUpdateReplayIter - setNil() -} - -// Array of ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. -// Updates returns a []BgpOneStructuredUpdateReplay -func (obj *bgpStructuredPdus) Updates() BgpStructuredPdusBgpOneStructuredUpdateReplayIter { - if len(obj.obj.Updates) == 0 { - obj.obj.Updates = []*otg.BgpOneStructuredUpdateReplay{} - } - if obj.updatesHolder == nil { - obj.updatesHolder = newBgpStructuredPdusBgpOneStructuredUpdateReplayIter(&obj.obj.Updates).setMsg(obj) - } - return obj.updatesHolder -} - -type bgpStructuredPdusBgpOneStructuredUpdateReplayIter struct { - obj *bgpStructuredPdus - bgpOneStructuredUpdateReplaySlice []BgpOneStructuredUpdateReplay - fieldPtr *[]*otg.BgpOneStructuredUpdateReplay -} - -func newBgpStructuredPdusBgpOneStructuredUpdateReplayIter(ptr *[]*otg.BgpOneStructuredUpdateReplay) BgpStructuredPdusBgpOneStructuredUpdateReplayIter { - return &bgpStructuredPdusBgpOneStructuredUpdateReplayIter{fieldPtr: ptr} -} - -type BgpStructuredPdusBgpOneStructuredUpdateReplayIter interface { - setMsg(*bgpStructuredPdus) BgpStructuredPdusBgpOneStructuredUpdateReplayIter - Items() []BgpOneStructuredUpdateReplay - Add() BgpOneStructuredUpdateReplay - Append(items ...BgpOneStructuredUpdateReplay) BgpStructuredPdusBgpOneStructuredUpdateReplayIter - Set(index int, newObj BgpOneStructuredUpdateReplay) BgpStructuredPdusBgpOneStructuredUpdateReplayIter - Clear() BgpStructuredPdusBgpOneStructuredUpdateReplayIter - clearHolderSlice() BgpStructuredPdusBgpOneStructuredUpdateReplayIter - appendHolderSlice(item BgpOneStructuredUpdateReplay) BgpStructuredPdusBgpOneStructuredUpdateReplayIter -} - -func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) setMsg(msg *bgpStructuredPdus) BgpStructuredPdusBgpOneStructuredUpdateReplayIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpOneStructuredUpdateReplay{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) Items() []BgpOneStructuredUpdateReplay { - return obj.bgpOneStructuredUpdateReplaySlice -} - -func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) Add() BgpOneStructuredUpdateReplay { - newObj := &otg.BgpOneStructuredUpdateReplay{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpOneStructuredUpdateReplay{obj: newObj} - newLibObj.setDefault() - obj.bgpOneStructuredUpdateReplaySlice = append(obj.bgpOneStructuredUpdateReplaySlice, newLibObj) - return newLibObj -} - -func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) Append(items ...BgpOneStructuredUpdateReplay) BgpStructuredPdusBgpOneStructuredUpdateReplayIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpOneStructuredUpdateReplaySlice = append(obj.bgpOneStructuredUpdateReplaySlice, item) - } - return obj -} - -func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) Set(index int, newObj BgpOneStructuredUpdateReplay) BgpStructuredPdusBgpOneStructuredUpdateReplayIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpOneStructuredUpdateReplaySlice[index] = newObj - return obj -} -func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) Clear() BgpStructuredPdusBgpOneStructuredUpdateReplayIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpOneStructuredUpdateReplay{} - obj.bgpOneStructuredUpdateReplaySlice = []BgpOneStructuredUpdateReplay{} - } - return obj -} -func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) clearHolderSlice() BgpStructuredPdusBgpOneStructuredUpdateReplayIter { - if len(obj.bgpOneStructuredUpdateReplaySlice) > 0 { - obj.bgpOneStructuredUpdateReplaySlice = []BgpOneStructuredUpdateReplay{} - } - return obj -} -func (obj *bgpStructuredPdusBgpOneStructuredUpdateReplayIter) appendHolderSlice(item BgpOneStructuredUpdateReplay) BgpStructuredPdusBgpOneStructuredUpdateReplayIter { - obj.bgpOneStructuredUpdateReplaySlice = append(obj.bgpOneStructuredUpdateReplaySlice, item) - return obj -} - -func (obj *bgpStructuredPdus) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Updates) != 0 { - - if set_default { - obj.Updates().clearHolderSlice() - for _, item := range obj.obj.Updates { - obj.Updates().appendHolderSlice(&bgpOneStructuredUpdateReplay{obj: item}) - } - } - for _, item := range obj.Updates().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpStructuredPdus) setDefault() { - -} - -// ***** BgpRawBytes ***** -type bgpRawBytes struct { - validation - obj *otg.BgpRawBytes - marshaller marshalBgpRawBytes - unMarshaller unMarshalBgpRawBytes - updatesHolder BgpRawBytesBgpOneUpdateReplayIter -} - -func NewBgpRawBytes() BgpRawBytes { - obj := bgpRawBytes{obj: &otg.BgpRawBytes{}} - obj.setDefault() - return &obj -} - -func (obj *bgpRawBytes) msg() *otg.BgpRawBytes { - return obj.obj -} - -func (obj *bgpRawBytes) setMsg(msg *otg.BgpRawBytes) BgpRawBytes { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpRawBytes struct { - obj *bgpRawBytes -} - -type marshalBgpRawBytes interface { - // ToProto marshals BgpRawBytes to protobuf object *otg.BgpRawBytes - ToProto() (*otg.BgpRawBytes, error) - // ToPbText marshals BgpRawBytes to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpRawBytes to YAML text - ToYaml() (string, error) - // ToJson marshals BgpRawBytes to JSON text - ToJson() (string, error) -} - -type unMarshalbgpRawBytes struct { - obj *bgpRawBytes -} - -type unMarshalBgpRawBytes interface { - // FromProto unmarshals BgpRawBytes from protobuf object *otg.BgpRawBytes - FromProto(msg *otg.BgpRawBytes) (BgpRawBytes, error) - // FromPbText unmarshals BgpRawBytes from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpRawBytes from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpRawBytes from JSON text - FromJson(value string) error -} - -func (obj *bgpRawBytes) Marshal() marshalBgpRawBytes { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpRawBytes{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpRawBytes) Unmarshal() unMarshalBgpRawBytes { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpRawBytes{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpRawBytes) ToProto() (*otg.BgpRawBytes, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpRawBytes) FromProto(msg *otg.BgpRawBytes) (BgpRawBytes, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpRawBytes) 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 *unMarshalbgpRawBytes) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpRawBytes) 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 *unMarshalbgpRawBytes) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpRawBytes) 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 *unMarshalbgpRawBytes) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpRawBytes) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpRawBytes) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpRawBytes) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpRawBytes) Clone() (BgpRawBytes, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpRawBytes() - 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 -} - -func (obj *bgpRawBytes) setNil() { - obj.updatesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpRawBytes is ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. -type BgpRawBytes interface { - Validation - // msg marshals BgpRawBytes to protobuf object *otg.BgpRawBytes - // and doesn't set defaults - msg() *otg.BgpRawBytes - // setMsg unmarshals BgpRawBytes from protobuf object *otg.BgpRawBytes - // and doesn't set defaults - setMsg(*otg.BgpRawBytes) BgpRawBytes - // provides marshal interface - Marshal() marshalBgpRawBytes - // provides unmarshal interface - Unmarshal() unMarshalBgpRawBytes - // validate validates BgpRawBytes - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpRawBytes, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Updates returns BgpRawBytesBgpOneUpdateReplayIterIter, set in BgpRawBytes - Updates() BgpRawBytesBgpOneUpdateReplayIter - setNil() -} - -// Array of ordered BGP Updates ( including both Advertise and Withdraws ) to be sent in the order given in the input to the peer after the BGP session is established. -// Updates returns a []BgpOneUpdateReplay -func (obj *bgpRawBytes) Updates() BgpRawBytesBgpOneUpdateReplayIter { - if len(obj.obj.Updates) == 0 { - obj.obj.Updates = []*otg.BgpOneUpdateReplay{} - } - if obj.updatesHolder == nil { - obj.updatesHolder = newBgpRawBytesBgpOneUpdateReplayIter(&obj.obj.Updates).setMsg(obj) - } - return obj.updatesHolder -} - -type bgpRawBytesBgpOneUpdateReplayIter struct { - obj *bgpRawBytes - bgpOneUpdateReplaySlice []BgpOneUpdateReplay - fieldPtr *[]*otg.BgpOneUpdateReplay -} - -func newBgpRawBytesBgpOneUpdateReplayIter(ptr *[]*otg.BgpOneUpdateReplay) BgpRawBytesBgpOneUpdateReplayIter { - return &bgpRawBytesBgpOneUpdateReplayIter{fieldPtr: ptr} -} - -type BgpRawBytesBgpOneUpdateReplayIter interface { - setMsg(*bgpRawBytes) BgpRawBytesBgpOneUpdateReplayIter - Items() []BgpOneUpdateReplay - Add() BgpOneUpdateReplay - Append(items ...BgpOneUpdateReplay) BgpRawBytesBgpOneUpdateReplayIter - Set(index int, newObj BgpOneUpdateReplay) BgpRawBytesBgpOneUpdateReplayIter - Clear() BgpRawBytesBgpOneUpdateReplayIter - clearHolderSlice() BgpRawBytesBgpOneUpdateReplayIter - appendHolderSlice(item BgpOneUpdateReplay) BgpRawBytesBgpOneUpdateReplayIter -} - -func (obj *bgpRawBytesBgpOneUpdateReplayIter) setMsg(msg *bgpRawBytes) BgpRawBytesBgpOneUpdateReplayIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpOneUpdateReplay{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpRawBytesBgpOneUpdateReplayIter) Items() []BgpOneUpdateReplay { - return obj.bgpOneUpdateReplaySlice -} - -func (obj *bgpRawBytesBgpOneUpdateReplayIter) Add() BgpOneUpdateReplay { - newObj := &otg.BgpOneUpdateReplay{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpOneUpdateReplay{obj: newObj} - newLibObj.setDefault() - obj.bgpOneUpdateReplaySlice = append(obj.bgpOneUpdateReplaySlice, newLibObj) - return newLibObj -} - -func (obj *bgpRawBytesBgpOneUpdateReplayIter) Append(items ...BgpOneUpdateReplay) BgpRawBytesBgpOneUpdateReplayIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpOneUpdateReplaySlice = append(obj.bgpOneUpdateReplaySlice, item) - } - return obj -} - -func (obj *bgpRawBytesBgpOneUpdateReplayIter) Set(index int, newObj BgpOneUpdateReplay) BgpRawBytesBgpOneUpdateReplayIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpOneUpdateReplaySlice[index] = newObj - return obj -} -func (obj *bgpRawBytesBgpOneUpdateReplayIter) Clear() BgpRawBytesBgpOneUpdateReplayIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpOneUpdateReplay{} - obj.bgpOneUpdateReplaySlice = []BgpOneUpdateReplay{} - } - return obj -} -func (obj *bgpRawBytesBgpOneUpdateReplayIter) clearHolderSlice() BgpRawBytesBgpOneUpdateReplayIter { - if len(obj.bgpOneUpdateReplaySlice) > 0 { - obj.bgpOneUpdateReplaySlice = []BgpOneUpdateReplay{} - } - return obj -} -func (obj *bgpRawBytesBgpOneUpdateReplayIter) appendHolderSlice(item BgpOneUpdateReplay) BgpRawBytesBgpOneUpdateReplayIter { - obj.bgpOneUpdateReplaySlice = append(obj.bgpOneUpdateReplaySlice, item) - return obj -} - -func (obj *bgpRawBytes) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Updates) != 0 { - - if set_default { - obj.Updates().clearHolderSlice() - for _, item := range obj.obj.Updates { - obj.Updates().appendHolderSlice(&bgpOneUpdateReplay{obj: item}) - } - } - for _, item := range obj.Updates().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpRawBytes) setDefault() { - -} - -// ***** BgpV6EvpnEvis ***** -type bgpV6EvpnEvis struct { - validation - obj *otg.BgpV6EvpnEvis - marshaller marshalBgpV6EvpnEvis - unMarshaller unMarshalBgpV6EvpnEvis - eviVxlanHolder BgpV6EviVxlan -} - -func NewBgpV6EvpnEvis() BgpV6EvpnEvis { - obj := bgpV6EvpnEvis{obj: &otg.BgpV6EvpnEvis{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV6EvpnEvis) msg() *otg.BgpV6EvpnEvis { - return obj.obj -} - -func (obj *bgpV6EvpnEvis) setMsg(msg *otg.BgpV6EvpnEvis) BgpV6EvpnEvis { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV6EvpnEvis struct { - obj *bgpV6EvpnEvis -} - -type marshalBgpV6EvpnEvis interface { - // ToProto marshals BgpV6EvpnEvis to protobuf object *otg.BgpV6EvpnEvis - ToProto() (*otg.BgpV6EvpnEvis, error) - // ToPbText marshals BgpV6EvpnEvis to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV6EvpnEvis to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV6EvpnEvis to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV6EvpnEvis struct { - obj *bgpV6EvpnEvis -} - -type unMarshalBgpV6EvpnEvis interface { - // FromProto unmarshals BgpV6EvpnEvis from protobuf object *otg.BgpV6EvpnEvis - FromProto(msg *otg.BgpV6EvpnEvis) (BgpV6EvpnEvis, error) - // FromPbText unmarshals BgpV6EvpnEvis from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV6EvpnEvis from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV6EvpnEvis from JSON text - FromJson(value string) error -} - -func (obj *bgpV6EvpnEvis) Marshal() marshalBgpV6EvpnEvis { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV6EvpnEvis{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV6EvpnEvis) Unmarshal() unMarshalBgpV6EvpnEvis { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV6EvpnEvis{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV6EvpnEvis) ToProto() (*otg.BgpV6EvpnEvis, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV6EvpnEvis) FromProto(msg *otg.BgpV6EvpnEvis) (BgpV6EvpnEvis, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV6EvpnEvis) 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 *unMarshalbgpV6EvpnEvis) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpV6EvpnEvis) 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 *unMarshalbgpV6EvpnEvis) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpV6EvpnEvis) 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 *unMarshalbgpV6EvpnEvis) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpV6EvpnEvis) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV6EvpnEvis) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV6EvpnEvis) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV6EvpnEvis) Clone() (BgpV6EvpnEvis, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV6EvpnEvis() - 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 -} - -func (obj *bgpV6EvpnEvis) setNil() { - obj.eviVxlanHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpV6EvpnEvis is this contains a list of different flavors of EVPN. -// For example EVPN over VXLAN or EVPN over MPLS etc to be configured per Ethernet segment. -// Need to instantiate correct type of EVPN instance as per requirement. -type BgpV6EvpnEvis interface { - Validation - // msg marshals BgpV6EvpnEvis to protobuf object *otg.BgpV6EvpnEvis - // and doesn't set defaults - msg() *otg.BgpV6EvpnEvis - // setMsg unmarshals BgpV6EvpnEvis from protobuf object *otg.BgpV6EvpnEvis - // and doesn't set defaults - setMsg(*otg.BgpV6EvpnEvis) BgpV6EvpnEvis - // provides marshal interface - Marshal() marshalBgpV6EvpnEvis - // provides unmarshal interface - Unmarshal() unMarshalBgpV6EvpnEvis - // validate validates BgpV6EvpnEvis - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV6EvpnEvis, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpV6EvpnEvisChoiceEnum, set in BgpV6EvpnEvis - Choice() BgpV6EvpnEvisChoiceEnum - // setChoice assigns BgpV6EvpnEvisChoiceEnum provided by user to BgpV6EvpnEvis - setChoice(value BgpV6EvpnEvisChoiceEnum) BgpV6EvpnEvis - // HasChoice checks if Choice has been set in BgpV6EvpnEvis - HasChoice() bool - // EviVxlan returns BgpV6EviVxlan, set in BgpV6EvpnEvis. - // BgpV6EviVxlan is configuration for BGP EVPN EVI. Advertises following routes - - // - // # Type 3 - Inclusive Multicast Ethernet Tag Route - // - // Type 1 - Ethernet Auto-discovery Route (Per EVI) - // - // Type 1 - Ethernet Auto-discovery Route (Per ES) - EviVxlan() BgpV6EviVxlan - // SetEviVxlan assigns BgpV6EviVxlan provided by user to BgpV6EvpnEvis. - // BgpV6EviVxlan is configuration for BGP EVPN EVI. Advertises following routes - - // - // # Type 3 - Inclusive Multicast Ethernet Tag Route - // - // Type 1 - Ethernet Auto-discovery Route (Per EVI) - // - // Type 1 - Ethernet Auto-discovery Route (Per ES) - SetEviVxlan(value BgpV6EviVxlan) BgpV6EvpnEvis - // HasEviVxlan checks if EviVxlan has been set in BgpV6EvpnEvis - HasEviVxlan() bool - setNil() -} - -type BgpV6EvpnEvisChoiceEnum string - -// Enum of Choice on BgpV6EvpnEvis -var BgpV6EvpnEvisChoice = struct { - EVI_VXLAN BgpV6EvpnEvisChoiceEnum -}{ - EVI_VXLAN: BgpV6EvpnEvisChoiceEnum("evi_vxlan"), -} - -func (obj *bgpV6EvpnEvis) Choice() BgpV6EvpnEvisChoiceEnum { - return BgpV6EvpnEvisChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *bgpV6EvpnEvis) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpV6EvpnEvis) setChoice(value BgpV6EvpnEvisChoiceEnum) BgpV6EvpnEvis { - intValue, ok := otg.BgpV6EvpnEvis_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpV6EvpnEvisChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpV6EvpnEvis_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.EviVxlan = nil - obj.eviVxlanHolder = nil - - if value == BgpV6EvpnEvisChoice.EVI_VXLAN { - obj.obj.EviVxlan = NewBgpV6EviVxlan().msg() - } - - return obj -} - -// EVPN VXLAN instance to be configured per Ethernet Segment. -// EviVxlan returns a BgpV6EviVxlan -func (obj *bgpV6EvpnEvis) EviVxlan() BgpV6EviVxlan { - if obj.obj.EviVxlan == nil { - obj.setChoice(BgpV6EvpnEvisChoice.EVI_VXLAN) - } - if obj.eviVxlanHolder == nil { - obj.eviVxlanHolder = &bgpV6EviVxlan{obj: obj.obj.EviVxlan} - } - return obj.eviVxlanHolder -} - -// EVPN VXLAN instance to be configured per Ethernet Segment. -// EviVxlan returns a BgpV6EviVxlan -func (obj *bgpV6EvpnEvis) HasEviVxlan() bool { - return obj.obj.EviVxlan != nil -} - -// EVPN VXLAN instance to be configured per Ethernet Segment. -// SetEviVxlan sets the BgpV6EviVxlan value in the BgpV6EvpnEvis object -func (obj *bgpV6EvpnEvis) SetEviVxlan(value BgpV6EviVxlan) BgpV6EvpnEvis { - obj.setChoice(BgpV6EvpnEvisChoice.EVI_VXLAN) - obj.eviVxlanHolder = nil - obj.obj.EviVxlan = value.msg() - - return obj -} - -func (obj *bgpV6EvpnEvis) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.EviVxlan != nil { - - obj.EviVxlan().validateObj(vObj, set_default) - } - -} - -func (obj *bgpV6EvpnEvis) setDefault() { - var choices_set int = 0 - var choice BgpV6EvpnEvisChoiceEnum - - if obj.obj.EviVxlan != nil { - choices_set += 1 - choice = BgpV6EvpnEvisChoice.EVI_VXLAN - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(BgpV6EvpnEvisChoice.EVI_VXLAN) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpV6EvpnEvis") - } - } else { - intVal := otg.BgpV6EvpnEvis_Choice_Enum_value[string(choice)] - enumValue := otg.BgpV6EvpnEvis_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** VxlanV4TunnelDestinationIPModeUnicastVtep ***** -type vxlanV4TunnelDestinationIPModeUnicastVtep struct { - validation - obj *otg.VxlanV4TunnelDestinationIPModeUnicastVtep - marshaller marshalVxlanV4TunnelDestinationIPModeUnicastVtep - unMarshaller unMarshalVxlanV4TunnelDestinationIPModeUnicastVtep - arpSuppressionCacheHolder VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter -} - -func NewVxlanV4TunnelDestinationIPModeUnicastVtep() VxlanV4TunnelDestinationIPModeUnicastVtep { - obj := vxlanV4TunnelDestinationIPModeUnicastVtep{obj: &otg.VxlanV4TunnelDestinationIPModeUnicastVtep{}} - obj.setDefault() - return &obj -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) msg() *otg.VxlanV4TunnelDestinationIPModeUnicastVtep { - return obj.obj -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) setMsg(msg *otg.VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVtep { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalvxlanV4TunnelDestinationIPModeUnicastVtep struct { - obj *vxlanV4TunnelDestinationIPModeUnicastVtep -} - -type marshalVxlanV4TunnelDestinationIPModeUnicastVtep interface { - // ToProto marshals VxlanV4TunnelDestinationIPModeUnicastVtep to protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicastVtep - ToProto() (*otg.VxlanV4TunnelDestinationIPModeUnicastVtep, error) - // ToPbText marshals VxlanV4TunnelDestinationIPModeUnicastVtep to protobuf text - ToPbText() (string, error) - // ToYaml marshals VxlanV4TunnelDestinationIPModeUnicastVtep to YAML text - ToYaml() (string, error) - // ToJson marshals VxlanV4TunnelDestinationIPModeUnicastVtep to JSON text - ToJson() (string, error) -} - -type unMarshalvxlanV4TunnelDestinationIPModeUnicastVtep struct { - obj *vxlanV4TunnelDestinationIPModeUnicastVtep -} - -type unMarshalVxlanV4TunnelDestinationIPModeUnicastVtep interface { - // FromProto unmarshals VxlanV4TunnelDestinationIPModeUnicastVtep from protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicastVtep - FromProto(msg *otg.VxlanV4TunnelDestinationIPModeUnicastVtep) (VxlanV4TunnelDestinationIPModeUnicastVtep, error) - // FromPbText unmarshals VxlanV4TunnelDestinationIPModeUnicastVtep from protobuf text - FromPbText(value string) error - // FromYaml unmarshals VxlanV4TunnelDestinationIPModeUnicastVtep from YAML text - FromYaml(value string) error - // FromJson unmarshals VxlanV4TunnelDestinationIPModeUnicastVtep from JSON text - FromJson(value string) error -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) Marshal() marshalVxlanV4TunnelDestinationIPModeUnicastVtep { - if obj.marshaller == nil { - obj.marshaller = &marshalvxlanV4TunnelDestinationIPModeUnicastVtep{obj: obj} - } - return obj.marshaller -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) Unmarshal() unMarshalVxlanV4TunnelDestinationIPModeUnicastVtep { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalvxlanV4TunnelDestinationIPModeUnicastVtep{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalvxlanV4TunnelDestinationIPModeUnicastVtep) ToProto() (*otg.VxlanV4TunnelDestinationIPModeUnicastVtep, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalvxlanV4TunnelDestinationIPModeUnicastVtep) FromProto(msg *otg.VxlanV4TunnelDestinationIPModeUnicastVtep) (VxlanV4TunnelDestinationIPModeUnicastVtep, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalvxlanV4TunnelDestinationIPModeUnicastVtep) 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 *unMarshalvxlanV4TunnelDestinationIPModeUnicastVtep) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalvxlanV4TunnelDestinationIPModeUnicastVtep) 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 *unMarshalvxlanV4TunnelDestinationIPModeUnicastVtep) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalvxlanV4TunnelDestinationIPModeUnicastVtep) 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 *unMarshalvxlanV4TunnelDestinationIPModeUnicastVtep) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) Clone() (VxlanV4TunnelDestinationIPModeUnicastVtep, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewVxlanV4TunnelDestinationIPModeUnicastVtep() - 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 -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) setNil() { - obj.arpSuppressionCacheHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// VxlanV4TunnelDestinationIPModeUnicastVtep is vTEP (VXLAN Tunnel End Point (VTEP)) parameters -type VxlanV4TunnelDestinationIPModeUnicastVtep interface { - Validation - // msg marshals VxlanV4TunnelDestinationIPModeUnicastVtep to protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicastVtep - // and doesn't set defaults - msg() *otg.VxlanV4TunnelDestinationIPModeUnicastVtep - // setMsg unmarshals VxlanV4TunnelDestinationIPModeUnicastVtep from protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicastVtep - // and doesn't set defaults - setMsg(*otg.VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVtep - // provides marshal interface - Marshal() marshalVxlanV4TunnelDestinationIPModeUnicastVtep - // provides unmarshal interface - Unmarshal() unMarshalVxlanV4TunnelDestinationIPModeUnicastVtep - // validate validates VxlanV4TunnelDestinationIPModeUnicastVtep - validate() error - // A stringer function - String() string - // Clones the object - Clone() (VxlanV4TunnelDestinationIPModeUnicastVtep, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RemoteVtepAddress returns string, set in VxlanV4TunnelDestinationIPModeUnicastVtep. - RemoteVtepAddress() string - // SetRemoteVtepAddress assigns string provided by user to VxlanV4TunnelDestinationIPModeUnicastVtep - SetRemoteVtepAddress(value string) VxlanV4TunnelDestinationIPModeUnicastVtep - // HasRemoteVtepAddress checks if RemoteVtepAddress has been set in VxlanV4TunnelDestinationIPModeUnicastVtep - HasRemoteVtepAddress() bool - // ArpSuppressionCache returns VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIterIter, set in VxlanV4TunnelDestinationIPModeUnicastVtep - ArpSuppressionCache() VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter - setNil() -} - -// Remote VXLAN Tunnel End Point address -// RemoteVtepAddress returns a string -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) RemoteVtepAddress() string { - - return *obj.obj.RemoteVtepAddress - -} - -// Remote VXLAN Tunnel End Point address -// RemoteVtepAddress returns a string -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) HasRemoteVtepAddress() bool { - return obj.obj.RemoteVtepAddress != nil -} - -// Remote VXLAN Tunnel End Point address -// SetRemoteVtepAddress sets the string value in the VxlanV4TunnelDestinationIPModeUnicastVtep object -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) SetRemoteVtepAddress(value string) VxlanV4TunnelDestinationIPModeUnicastVtep { - - obj.obj.RemoteVtepAddress = &value - return obj -} - -// Each VTEP maintains an ARP suppression cache table for known IP hosts and their associated MAC addresses in the VNI segment. When an end host in the VNI sends an ARP request for another end-host IP address, its local VTEP intercepts the ARP request and checks for the ARP-resolved IP address in its ARP suppression cache table. If it finds a match, the local VTEP sends an ARP response on behalf of the remote end host. -// ArpSuppressionCache returns a []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) ArpSuppressionCache() VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - if len(obj.obj.ArpSuppressionCache) == 0 { - obj.obj.ArpSuppressionCache = []*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} - } - if obj.arpSuppressionCacheHolder == nil { - obj.arpSuppressionCacheHolder = newVxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter(&obj.obj.ArpSuppressionCache).setMsg(obj) - } - return obj.arpSuppressionCacheHolder -} - -type vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter struct { - obj *vxlanV4TunnelDestinationIPModeUnicastVtep - vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - fieldPtr *[]*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache -} - -func newVxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter(ptr *[]*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - return &vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter{fieldPtr: ptr} -} - -type VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter interface { - setMsg(*vxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter - Items() []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - Add() VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - Append(items ...VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter - Set(index int, newObj VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter - Clear() VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter - clearHolderSlice() VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter - appendHolderSlice(item VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) setMsg(msg *vxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&vxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Items() []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { - return obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Add() VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { - newObj := &otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &vxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: newObj} - newLibObj.setDefault() - obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = append(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice, newLibObj) - return newLibObj -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Append(items ...VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = append(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice, item) - } - return obj -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Set(index int, newObj VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice[index] = newObj - return obj -} -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Clear() VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} - obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} - } - return obj -} -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) clearHolderSlice() VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - if len(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice) > 0 { - obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} - } - return obj -} -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) appendHolderSlice(item VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = append(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice, item) - return obj -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RemoteVtepAddress != nil { - - err := obj.validateIpv4(obj.RemoteVtepAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on VxlanV4TunnelDestinationIPModeUnicastVtep.RemoteVtepAddress")) - } - - } - - if len(obj.obj.ArpSuppressionCache) != 0 { - - if set_default { - obj.ArpSuppressionCache().clearHolderSlice() - for _, item := range obj.obj.ArpSuppressionCache { - obj.ArpSuppressionCache().appendHolderSlice(&vxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: item}) - } - } - for _, item := range obj.ArpSuppressionCache().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) setDefault() { - -} - -// ***** VxlanV6TunnelDestinationIPModeUnicastVtep ***** -type vxlanV6TunnelDestinationIPModeUnicastVtep struct { - validation - obj *otg.VxlanV6TunnelDestinationIPModeUnicastVtep - marshaller marshalVxlanV6TunnelDestinationIPModeUnicastVtep - unMarshaller unMarshalVxlanV6TunnelDestinationIPModeUnicastVtep - arpSuppressionCacheHolder VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter -} - -func NewVxlanV6TunnelDestinationIPModeUnicastVtep() VxlanV6TunnelDestinationIPModeUnicastVtep { - obj := vxlanV6TunnelDestinationIPModeUnicastVtep{obj: &otg.VxlanV6TunnelDestinationIPModeUnicastVtep{}} - obj.setDefault() - return &obj -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) msg() *otg.VxlanV6TunnelDestinationIPModeUnicastVtep { - return obj.obj -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) setMsg(msg *otg.VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVtep { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalvxlanV6TunnelDestinationIPModeUnicastVtep struct { - obj *vxlanV6TunnelDestinationIPModeUnicastVtep -} - -type marshalVxlanV6TunnelDestinationIPModeUnicastVtep interface { - // ToProto marshals VxlanV6TunnelDestinationIPModeUnicastVtep to protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicastVtep - ToProto() (*otg.VxlanV6TunnelDestinationIPModeUnicastVtep, error) - // ToPbText marshals VxlanV6TunnelDestinationIPModeUnicastVtep to protobuf text - ToPbText() (string, error) - // ToYaml marshals VxlanV6TunnelDestinationIPModeUnicastVtep to YAML text - ToYaml() (string, error) - // ToJson marshals VxlanV6TunnelDestinationIPModeUnicastVtep to JSON text - ToJson() (string, error) -} - -type unMarshalvxlanV6TunnelDestinationIPModeUnicastVtep struct { - obj *vxlanV6TunnelDestinationIPModeUnicastVtep -} - -type unMarshalVxlanV6TunnelDestinationIPModeUnicastVtep interface { - // FromProto unmarshals VxlanV6TunnelDestinationIPModeUnicastVtep from protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicastVtep - FromProto(msg *otg.VxlanV6TunnelDestinationIPModeUnicastVtep) (VxlanV6TunnelDestinationIPModeUnicastVtep, error) - // FromPbText unmarshals VxlanV6TunnelDestinationIPModeUnicastVtep from protobuf text - FromPbText(value string) error - // FromYaml unmarshals VxlanV6TunnelDestinationIPModeUnicastVtep from YAML text - FromYaml(value string) error - // FromJson unmarshals VxlanV6TunnelDestinationIPModeUnicastVtep from JSON text - FromJson(value string) error -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) Marshal() marshalVxlanV6TunnelDestinationIPModeUnicastVtep { - if obj.marshaller == nil { - obj.marshaller = &marshalvxlanV6TunnelDestinationIPModeUnicastVtep{obj: obj} - } - return obj.marshaller -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) Unmarshal() unMarshalVxlanV6TunnelDestinationIPModeUnicastVtep { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalvxlanV6TunnelDestinationIPModeUnicastVtep{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalvxlanV6TunnelDestinationIPModeUnicastVtep) ToProto() (*otg.VxlanV6TunnelDestinationIPModeUnicastVtep, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalvxlanV6TunnelDestinationIPModeUnicastVtep) FromProto(msg *otg.VxlanV6TunnelDestinationIPModeUnicastVtep) (VxlanV6TunnelDestinationIPModeUnicastVtep, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalvxlanV6TunnelDestinationIPModeUnicastVtep) 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 *unMarshalvxlanV6TunnelDestinationIPModeUnicastVtep) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalvxlanV6TunnelDestinationIPModeUnicastVtep) 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 *unMarshalvxlanV6TunnelDestinationIPModeUnicastVtep) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalvxlanV6TunnelDestinationIPModeUnicastVtep) 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 *unMarshalvxlanV6TunnelDestinationIPModeUnicastVtep) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) Clone() (VxlanV6TunnelDestinationIPModeUnicastVtep, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewVxlanV6TunnelDestinationIPModeUnicastVtep() - 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 -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) setNil() { - obj.arpSuppressionCacheHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// VxlanV6TunnelDestinationIPModeUnicastVtep is vTEP (VXLAN Tunnel End Point (VTEP)) parameters -type VxlanV6TunnelDestinationIPModeUnicastVtep interface { - Validation - // msg marshals VxlanV6TunnelDestinationIPModeUnicastVtep to protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicastVtep - // and doesn't set defaults - msg() *otg.VxlanV6TunnelDestinationIPModeUnicastVtep - // setMsg unmarshals VxlanV6TunnelDestinationIPModeUnicastVtep from protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicastVtep - // and doesn't set defaults - setMsg(*otg.VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVtep - // provides marshal interface - Marshal() marshalVxlanV6TunnelDestinationIPModeUnicastVtep - // provides unmarshal interface - Unmarshal() unMarshalVxlanV6TunnelDestinationIPModeUnicastVtep - // validate validates VxlanV6TunnelDestinationIPModeUnicastVtep - validate() error - // A stringer function - String() string - // Clones the object - Clone() (VxlanV6TunnelDestinationIPModeUnicastVtep, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RemoteVtepAddress returns string, set in VxlanV6TunnelDestinationIPModeUnicastVtep. - RemoteVtepAddress() string - // SetRemoteVtepAddress assigns string provided by user to VxlanV6TunnelDestinationIPModeUnicastVtep - SetRemoteVtepAddress(value string) VxlanV6TunnelDestinationIPModeUnicastVtep - // HasRemoteVtepAddress checks if RemoteVtepAddress has been set in VxlanV6TunnelDestinationIPModeUnicastVtep - HasRemoteVtepAddress() bool - // ArpSuppressionCache returns VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIterIter, set in VxlanV6TunnelDestinationIPModeUnicastVtep - ArpSuppressionCache() VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter - setNil() -} - -// Remote VXLAN Tunnel End Point address -// RemoteVtepAddress returns a string -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) RemoteVtepAddress() string { - - return *obj.obj.RemoteVtepAddress - -} - -// Remote VXLAN Tunnel End Point address -// RemoteVtepAddress returns a string -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) HasRemoteVtepAddress() bool { - return obj.obj.RemoteVtepAddress != nil -} - -// Remote VXLAN Tunnel End Point address -// SetRemoteVtepAddress sets the string value in the VxlanV6TunnelDestinationIPModeUnicastVtep object -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) SetRemoteVtepAddress(value string) VxlanV6TunnelDestinationIPModeUnicastVtep { - - obj.obj.RemoteVtepAddress = &value - return obj -} - -// Each VTEP maintains an ARP suppression cache table for known IP hosts and their associated MAC addresses in the VNI segment. When an end host in the VNI sends an ARP request for another end-host IP address, its local VTEP intercepts the ARP request and checks for the ARP-resolved IP address in its ARP suppression cache table. If it finds a match, the local VTEP sends an ARP response on behalf of the remote end host. -// ArpSuppressionCache returns a []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) ArpSuppressionCache() VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - if len(obj.obj.ArpSuppressionCache) == 0 { - obj.obj.ArpSuppressionCache = []*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} - } - if obj.arpSuppressionCacheHolder == nil { - obj.arpSuppressionCacheHolder = newVxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter(&obj.obj.ArpSuppressionCache).setMsg(obj) - } - return obj.arpSuppressionCacheHolder -} - -type vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter struct { - obj *vxlanV6TunnelDestinationIPModeUnicastVtep - vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - fieldPtr *[]*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache -} - -func newVxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter(ptr *[]*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - return &vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter{fieldPtr: ptr} -} - -type VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter interface { - setMsg(*vxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter - Items() []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - Add() VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - Append(items ...VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter - Set(index int, newObj VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter - Clear() VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter - clearHolderSlice() VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter - appendHolderSlice(item VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) setMsg(msg *vxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&vxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Items() []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { - return obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Add() VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { - newObj := &otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &vxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: newObj} - newLibObj.setDefault() - obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = append(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice, newLibObj) - return newLibObj -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Append(items ...VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = append(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice, item) - } - return obj -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Set(index int, newObj VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice[index] = newObj - return obj -} -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Clear() VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} - obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} - } - return obj -} -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) clearHolderSlice() VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - if len(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice) > 0 { - obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} - } - return obj -} -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) appendHolderSlice(item VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { - obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = append(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice, item) - return obj -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RemoteVtepAddress != nil { - - err := obj.validateIpv6(obj.RemoteVtepAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on VxlanV6TunnelDestinationIPModeUnicastVtep.RemoteVtepAddress")) - } - - } - - if len(obj.obj.ArpSuppressionCache) != 0 { - - if set_default { - obj.ArpSuppressionCache().clearHolderSlice() - for _, item := range obj.obj.ArpSuppressionCache { - obj.ArpSuppressionCache().appendHolderSlice(&vxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: item}) - } - } - for _, item := range obj.ArpSuppressionCache().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) setDefault() { - -} - -// ***** RsvpResourceAffinities ***** -type rsvpResourceAffinities struct { - validation - obj *otg.RsvpResourceAffinities - marshaller marshalRsvpResourceAffinities - unMarshaller unMarshalRsvpResourceAffinities -} - -func NewRsvpResourceAffinities() RsvpResourceAffinities { - obj := rsvpResourceAffinities{obj: &otg.RsvpResourceAffinities{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpResourceAffinities) msg() *otg.RsvpResourceAffinities { - return obj.obj -} - -func (obj *rsvpResourceAffinities) setMsg(msg *otg.RsvpResourceAffinities) RsvpResourceAffinities { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpResourceAffinities struct { - obj *rsvpResourceAffinities -} - -type marshalRsvpResourceAffinities interface { - // ToProto marshals RsvpResourceAffinities to protobuf object *otg.RsvpResourceAffinities - ToProto() (*otg.RsvpResourceAffinities, error) - // ToPbText marshals RsvpResourceAffinities to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpResourceAffinities to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpResourceAffinities to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpResourceAffinities struct { - obj *rsvpResourceAffinities -} - -type unMarshalRsvpResourceAffinities interface { - // FromProto unmarshals RsvpResourceAffinities from protobuf object *otg.RsvpResourceAffinities - FromProto(msg *otg.RsvpResourceAffinities) (RsvpResourceAffinities, error) - // FromPbText unmarshals RsvpResourceAffinities from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpResourceAffinities from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpResourceAffinities from JSON text - FromJson(value string) error -} - -func (obj *rsvpResourceAffinities) Marshal() marshalRsvpResourceAffinities { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpResourceAffinities{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpResourceAffinities) Unmarshal() unMarshalRsvpResourceAffinities { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpResourceAffinities{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpResourceAffinities) ToProto() (*otg.RsvpResourceAffinities, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpResourceAffinities) FromProto(msg *otg.RsvpResourceAffinities) (RsvpResourceAffinities, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpResourceAffinities) 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 *unMarshalrsvpResourceAffinities) 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 *marshalrsvpResourceAffinities) 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 *unMarshalrsvpResourceAffinities) 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 *marshalrsvpResourceAffinities) 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 *unMarshalrsvpResourceAffinities) 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 *rsvpResourceAffinities) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpResourceAffinities) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpResourceAffinities) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpResourceAffinities) Clone() (RsvpResourceAffinities, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpResourceAffinities() - 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 -} - -// RsvpResourceAffinities is this is an optional object. If included, the extended SESSION_ATTRIBUTE object is sent in the Path message containing -// the additional fields included in this object. This contains a set of three bitmaps using which further constraints can be -// set on the path calculated for the LSP based on the Admin Group settings in the IGP (e.g ISIS or OSPF interface). -type RsvpResourceAffinities interface { - Validation - // msg marshals RsvpResourceAffinities to protobuf object *otg.RsvpResourceAffinities - // and doesn't set defaults - msg() *otg.RsvpResourceAffinities - // setMsg unmarshals RsvpResourceAffinities from protobuf object *otg.RsvpResourceAffinities - // and doesn't set defaults - setMsg(*otg.RsvpResourceAffinities) RsvpResourceAffinities - // provides marshal interface - Marshal() marshalRsvpResourceAffinities - // provides unmarshal interface - Unmarshal() unMarshalRsvpResourceAffinities - // validate validates RsvpResourceAffinities - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpResourceAffinities, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ExcludeAny returns string, set in RsvpResourceAffinities. - ExcludeAny() string - // SetExcludeAny assigns string provided by user to RsvpResourceAffinities - SetExcludeAny(value string) RsvpResourceAffinities - // HasExcludeAny checks if ExcludeAny has been set in RsvpResourceAffinities - HasExcludeAny() bool - // IncludeAny returns string, set in RsvpResourceAffinities. - IncludeAny() string - // SetIncludeAny assigns string provided by user to RsvpResourceAffinities - SetIncludeAny(value string) RsvpResourceAffinities - // HasIncludeAny checks if IncludeAny has been set in RsvpResourceAffinities - HasIncludeAny() bool - // IncludeAll returns string, set in RsvpResourceAffinities. - IncludeAll() string - // SetIncludeAll assigns string provided by user to RsvpResourceAffinities - SetIncludeAll(value string) RsvpResourceAffinities - // HasIncludeAll checks if IncludeAll has been set in RsvpResourceAffinities - HasIncludeAll() bool -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// ExcludeAny returns a string -func (obj *rsvpResourceAffinities) ExcludeAny() string { - - return *obj.obj.ExcludeAny - -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// ExcludeAny returns a string -func (obj *rsvpResourceAffinities) HasExcludeAny() bool { - return obj.obj.ExcludeAny != nil -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// SetExcludeAny sets the string value in the RsvpResourceAffinities object -func (obj *rsvpResourceAffinities) SetExcludeAny(value string) RsvpResourceAffinities { - - obj.obj.ExcludeAny = &value - return obj -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// IncludeAny returns a string -func (obj *rsvpResourceAffinities) IncludeAny() string { - - return *obj.obj.IncludeAny - -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// IncludeAny returns a string -func (obj *rsvpResourceAffinities) HasIncludeAny() bool { - return obj.obj.IncludeAny != nil -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// SetIncludeAny sets the string value in the RsvpResourceAffinities object -func (obj *rsvpResourceAffinities) SetIncludeAny(value string) RsvpResourceAffinities { - - obj.obj.IncludeAny = &value - return obj -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// IncludeAll returns a string -func (obj *rsvpResourceAffinities) IncludeAll() string { - - return *obj.obj.IncludeAll - -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// IncludeAll returns a string -func (obj *rsvpResourceAffinities) HasIncludeAll() bool { - return obj.obj.IncludeAll != nil -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// SetIncludeAll sets the string value in the RsvpResourceAffinities object -func (obj *rsvpResourceAffinities) SetIncludeAll(value string) RsvpResourceAffinities { - - obj.obj.IncludeAll = &value - return obj -} - -func (obj *rsvpResourceAffinities) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.ExcludeAny != nil { - - if len(*obj.obj.ExcludeAny) < 0 || len(*obj.obj.ExcludeAny) > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of RsvpResourceAffinities.ExcludeAny <= 8 but Got %d", - len(*obj.obj.ExcludeAny))) - } - - } - - if obj.obj.IncludeAny != nil { - - if len(*obj.obj.IncludeAny) < 0 || len(*obj.obj.IncludeAny) > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of RsvpResourceAffinities.IncludeAny <= 8 but Got %d", - len(*obj.obj.IncludeAny))) - } - - } - - if obj.obj.IncludeAll != nil { - - if len(*obj.obj.IncludeAll) < 0 || len(*obj.obj.IncludeAll) > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of RsvpResourceAffinities.IncludeAll <= 8 but Got %d", - len(*obj.obj.IncludeAll))) - } - - } - -} - -func (obj *rsvpResourceAffinities) setDefault() { - if obj.obj.ExcludeAny == nil { - obj.SetExcludeAny("0") - } - if obj.obj.IncludeAny == nil { - obj.SetIncludeAny("0") - } - if obj.obj.IncludeAll == nil { - obj.SetIncludeAll("0") - } - -} - -// ***** RsvpEroSubobject ***** -type rsvpEroSubobject struct { - validation - obj *otg.RsvpEroSubobject - marshaller marshalRsvpEroSubobject - unMarshaller unMarshalRsvpEroSubobject -} - -func NewRsvpEroSubobject() RsvpEroSubobject { - obj := rsvpEroSubobject{obj: &otg.RsvpEroSubobject{}} - obj.setDefault() - return &obj -} - -func (obj *rsvpEroSubobject) msg() *otg.RsvpEroSubobject { - return obj.obj -} - -func (obj *rsvpEroSubobject) setMsg(msg *otg.RsvpEroSubobject) RsvpEroSubobject { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalrsvpEroSubobject struct { - obj *rsvpEroSubobject -} - -type marshalRsvpEroSubobject interface { - // ToProto marshals RsvpEroSubobject to protobuf object *otg.RsvpEroSubobject - ToProto() (*otg.RsvpEroSubobject, error) - // ToPbText marshals RsvpEroSubobject to protobuf text - ToPbText() (string, error) - // ToYaml marshals RsvpEroSubobject to YAML text - ToYaml() (string, error) - // ToJson marshals RsvpEroSubobject to JSON text - ToJson() (string, error) -} - -type unMarshalrsvpEroSubobject struct { - obj *rsvpEroSubobject -} - -type unMarshalRsvpEroSubobject interface { - // FromProto unmarshals RsvpEroSubobject from protobuf object *otg.RsvpEroSubobject - FromProto(msg *otg.RsvpEroSubobject) (RsvpEroSubobject, error) - // FromPbText unmarshals RsvpEroSubobject from protobuf text - FromPbText(value string) error - // FromYaml unmarshals RsvpEroSubobject from YAML text - FromYaml(value string) error - // FromJson unmarshals RsvpEroSubobject from JSON text - FromJson(value string) error -} - -func (obj *rsvpEroSubobject) Marshal() marshalRsvpEroSubobject { - if obj.marshaller == nil { - obj.marshaller = &marshalrsvpEroSubobject{obj: obj} - } - return obj.marshaller -} - -func (obj *rsvpEroSubobject) Unmarshal() unMarshalRsvpEroSubobject { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalrsvpEroSubobject{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalrsvpEroSubobject) ToProto() (*otg.RsvpEroSubobject, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalrsvpEroSubobject) FromProto(msg *otg.RsvpEroSubobject) (RsvpEroSubobject, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalrsvpEroSubobject) 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 *unMarshalrsvpEroSubobject) 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 *marshalrsvpEroSubobject) 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 *unMarshalrsvpEroSubobject) 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 *marshalrsvpEroSubobject) 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 *unMarshalrsvpEroSubobject) 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 *rsvpEroSubobject) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *rsvpEroSubobject) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *rsvpEroSubobject) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *rsvpEroSubobject) Clone() (RsvpEroSubobject, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewRsvpEroSubobject() - 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 -} - -// RsvpEroSubobject is configuration for the ERO sub-object. -type RsvpEroSubobject interface { - Validation - // msg marshals RsvpEroSubobject to protobuf object *otg.RsvpEroSubobject - // and doesn't set defaults - msg() *otg.RsvpEroSubobject - // setMsg unmarshals RsvpEroSubobject from protobuf object *otg.RsvpEroSubobject - // and doesn't set defaults - setMsg(*otg.RsvpEroSubobject) RsvpEroSubobject - // provides marshal interface - Marshal() marshalRsvpEroSubobject - // provides unmarshal interface - Unmarshal() unMarshalRsvpEroSubobject - // validate validates RsvpEroSubobject - validate() error - // A stringer function - String() string - // Clones the object - Clone() (RsvpEroSubobject, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Type returns RsvpEroSubobjectTypeEnum, set in RsvpEroSubobject - Type() RsvpEroSubobjectTypeEnum - // SetType assigns RsvpEroSubobjectTypeEnum provided by user to RsvpEroSubobject - SetType(value RsvpEroSubobjectTypeEnum) RsvpEroSubobject - // HasType checks if Type has been set in RsvpEroSubobject - HasType() bool - // Ipv4Address returns string, set in RsvpEroSubobject. - Ipv4Address() string - // SetIpv4Address assigns string provided by user to RsvpEroSubobject - SetIpv4Address(value string) RsvpEroSubobject - // HasIpv4Address checks if Ipv4Address has been set in RsvpEroSubobject - HasIpv4Address() bool - // PrefixLength returns uint32, set in RsvpEroSubobject. - PrefixLength() uint32 - // SetPrefixLength assigns uint32 provided by user to RsvpEroSubobject - SetPrefixLength(value uint32) RsvpEroSubobject - // HasPrefixLength checks if PrefixLength has been set in RsvpEroSubobject - HasPrefixLength() bool - // AsNumber returns uint32, set in RsvpEroSubobject. - AsNumber() uint32 - // SetAsNumber assigns uint32 provided by user to RsvpEroSubobject - SetAsNumber(value uint32) RsvpEroSubobject - // HasAsNumber checks if AsNumber has been set in RsvpEroSubobject - HasAsNumber() bool - // HopType returns RsvpEroSubobjectHopTypeEnum, set in RsvpEroSubobject - HopType() RsvpEroSubobjectHopTypeEnum - // SetHopType assigns RsvpEroSubobjectHopTypeEnum provided by user to RsvpEroSubobject - SetHopType(value RsvpEroSubobjectHopTypeEnum) RsvpEroSubobject - // HasHopType checks if HopType has been set in RsvpEroSubobject - HasHopType() bool -} - -type RsvpEroSubobjectTypeEnum string - -// Enum of Type on RsvpEroSubobject -var RsvpEroSubobjectType = struct { - IPV4 RsvpEroSubobjectTypeEnum - AS_NUMBER RsvpEroSubobjectTypeEnum -}{ - IPV4: RsvpEroSubobjectTypeEnum("ipv4"), - AS_NUMBER: RsvpEroSubobjectTypeEnum("as_number"), -} - -func (obj *rsvpEroSubobject) Type() RsvpEroSubobjectTypeEnum { - return RsvpEroSubobjectTypeEnum(obj.obj.Type.Enum().String()) -} - -// The type of the ERO sub-object, one of IPv4 Address or AS Number. -// Type returns a string -func (obj *rsvpEroSubobject) HasType() bool { - return obj.obj.Type != nil -} - -func (obj *rsvpEroSubobject) SetType(value RsvpEroSubobjectTypeEnum) RsvpEroSubobject { - intValue, ok := otg.RsvpEroSubobject_Type_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on RsvpEroSubobjectTypeEnum", string(value))) - return obj - } - enumValue := otg.RsvpEroSubobject_Type_Enum(intValue) - obj.obj.Type = &enumValue - - return obj -} - -// IPv4 address that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'ipv4'. -// Ipv4Address returns a string -func (obj *rsvpEroSubobject) Ipv4Address() string { - - return *obj.obj.Ipv4Address - -} - -// IPv4 address that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'ipv4'. -// Ipv4Address returns a string -func (obj *rsvpEroSubobject) HasIpv4Address() bool { - return obj.obj.Ipv4Address != nil -} - -// IPv4 address that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'ipv4'. -// SetIpv4Address sets the string value in the RsvpEroSubobject object -func (obj *rsvpEroSubobject) SetIpv4Address(value string) RsvpEroSubobject { - - obj.obj.Ipv4Address = &value - return obj -} - -// Prefix length for the IPv4 address in the ERO sub-object. This field is applicable only if the value of 'type' is set to 'ipv4'. -// PrefixLength returns a uint32 -func (obj *rsvpEroSubobject) PrefixLength() uint32 { - - return *obj.obj.PrefixLength - -} - -// Prefix length for the IPv4 address in the ERO sub-object. This field is applicable only if the value of 'type' is set to 'ipv4'. -// PrefixLength returns a uint32 -func (obj *rsvpEroSubobject) HasPrefixLength() bool { - return obj.obj.PrefixLength != nil -} - -// Prefix length for the IPv4 address in the ERO sub-object. This field is applicable only if the value of 'type' is set to 'ipv4'. -// SetPrefixLength sets the uint32 value in the RsvpEroSubobject object -func (obj *rsvpEroSubobject) SetPrefixLength(value uint32) RsvpEroSubobject { - - obj.obj.PrefixLength = &value - return obj -} - -// Autonomous System number to be set in the ERO sub-object that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'as_number'. Note that as per RFC3209, 4-byte AS encoding is not supported. -// AsNumber returns a uint32 -func (obj *rsvpEroSubobject) AsNumber() uint32 { - - return *obj.obj.AsNumber - -} - -// Autonomous System number to be set in the ERO sub-object that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'as_number'. Note that as per RFC3209, 4-byte AS encoding is not supported. -// AsNumber returns a uint32 -func (obj *rsvpEroSubobject) HasAsNumber() bool { - return obj.obj.AsNumber != nil -} - -// Autonomous System number to be set in the ERO sub-object that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'as_number'. Note that as per RFC3209, 4-byte AS encoding is not supported. -// SetAsNumber sets the uint32 value in the RsvpEroSubobject object -func (obj *rsvpEroSubobject) SetAsNumber(value uint32) RsvpEroSubobject { - - obj.obj.AsNumber = &value - return obj -} - -type RsvpEroSubobjectHopTypeEnum string - -// Enum of HopType on RsvpEroSubobject -var RsvpEroSubobjectHopType = struct { - STRICT RsvpEroSubobjectHopTypeEnum - LOOSE RsvpEroSubobjectHopTypeEnum -}{ - STRICT: RsvpEroSubobjectHopTypeEnum("strict"), - LOOSE: RsvpEroSubobjectHopTypeEnum("loose"), -} - -func (obj *rsvpEroSubobject) HopType() RsvpEroSubobjectHopTypeEnum { - return RsvpEroSubobjectHopTypeEnum(obj.obj.HopType.Enum().String()) -} - -// The hop type of the ERO sub-object, one of Strict or Loose. -// HopType returns a string -func (obj *rsvpEroSubobject) HasHopType() bool { - return obj.obj.HopType != nil -} - -func (obj *rsvpEroSubobject) SetHopType(value RsvpEroSubobjectHopTypeEnum) RsvpEroSubobject { - intValue, ok := otg.RsvpEroSubobject_HopType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on RsvpEroSubobjectHopTypeEnum", string(value))) - return obj - } - enumValue := otg.RsvpEroSubobject_HopType_Enum(intValue) - obj.obj.HopType = &enumValue - - return obj -} - -func (obj *rsvpEroSubobject) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv4Address != nil { - - err := obj.validateIpv4(obj.Ipv4Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on RsvpEroSubobject.Ipv4Address")) - } - - } - - if obj.obj.PrefixLength != nil { - - if *obj.obj.PrefixLength > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpEroSubobject.PrefixLength <= 32 but Got %d", *obj.obj.PrefixLength)) - } - - } - - if obj.obj.AsNumber != nil { - - if *obj.obj.AsNumber > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= RsvpEroSubobject.AsNumber <= 65535 but Got %d", *obj.obj.AsNumber)) - } - - } - -} - -func (obj *rsvpEroSubobject) setDefault() { - if obj.obj.Type == nil { - obj.SetType(RsvpEroSubobjectType.IPV4) - - } - if obj.obj.Ipv4Address == nil { - obj.SetIpv4Address("0.0.0.0") - } - if obj.obj.PrefixLength == nil { - obj.SetPrefixLength(32) - } - if obj.obj.AsNumber == nil { - obj.SetAsNumber(0) - } - if obj.obj.HopType == nil { - obj.SetHopType(RsvpEroSubobjectHopType.LOOSE) - - } - -} - -// ***** PatternFlowIpv4PriorityRawCounter ***** -type patternFlowIpv4PriorityRawCounter struct { - validation - obj *otg.PatternFlowIpv4PriorityRawCounter - marshaller marshalPatternFlowIpv4PriorityRawCounter - unMarshaller unMarshalPatternFlowIpv4PriorityRawCounter -} - -func NewPatternFlowIpv4PriorityRawCounter() PatternFlowIpv4PriorityRawCounter { - obj := patternFlowIpv4PriorityRawCounter{obj: &otg.PatternFlowIpv4PriorityRawCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4PriorityRawCounter) msg() *otg.PatternFlowIpv4PriorityRawCounter { - return obj.obj -} - -func (obj *patternFlowIpv4PriorityRawCounter) setMsg(msg *otg.PatternFlowIpv4PriorityRawCounter) PatternFlowIpv4PriorityRawCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4PriorityRawCounter struct { - obj *patternFlowIpv4PriorityRawCounter -} - -type marshalPatternFlowIpv4PriorityRawCounter interface { - // ToProto marshals PatternFlowIpv4PriorityRawCounter to protobuf object *otg.PatternFlowIpv4PriorityRawCounter - ToProto() (*otg.PatternFlowIpv4PriorityRawCounter, error) - // ToPbText marshals PatternFlowIpv4PriorityRawCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4PriorityRawCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4PriorityRawCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4PriorityRawCounter struct { - obj *patternFlowIpv4PriorityRawCounter -} - -type unMarshalPatternFlowIpv4PriorityRawCounter interface { - // FromProto unmarshals PatternFlowIpv4PriorityRawCounter from protobuf object *otg.PatternFlowIpv4PriorityRawCounter - FromProto(msg *otg.PatternFlowIpv4PriorityRawCounter) (PatternFlowIpv4PriorityRawCounter, error) - // FromPbText unmarshals PatternFlowIpv4PriorityRawCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4PriorityRawCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4PriorityRawCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4PriorityRawCounter) Marshal() marshalPatternFlowIpv4PriorityRawCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4PriorityRawCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4PriorityRawCounter) Unmarshal() unMarshalPatternFlowIpv4PriorityRawCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4PriorityRawCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4PriorityRawCounter) ToProto() (*otg.PatternFlowIpv4PriorityRawCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4PriorityRawCounter) FromProto(msg *otg.PatternFlowIpv4PriorityRawCounter) (PatternFlowIpv4PriorityRawCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4PriorityRawCounter) 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 *unMarshalpatternFlowIpv4PriorityRawCounter) 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 *marshalpatternFlowIpv4PriorityRawCounter) 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 *unMarshalpatternFlowIpv4PriorityRawCounter) 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 *marshalpatternFlowIpv4PriorityRawCounter) 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 *unMarshalpatternFlowIpv4PriorityRawCounter) 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 *patternFlowIpv4PriorityRawCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4PriorityRawCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4PriorityRawCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4PriorityRawCounter) Clone() (PatternFlowIpv4PriorityRawCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4PriorityRawCounter() - 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 -} - -// PatternFlowIpv4PriorityRawCounter is integer counter pattern -type PatternFlowIpv4PriorityRawCounter interface { - Validation - // msg marshals PatternFlowIpv4PriorityRawCounter to protobuf object *otg.PatternFlowIpv4PriorityRawCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4PriorityRawCounter - // setMsg unmarshals PatternFlowIpv4PriorityRawCounter from protobuf object *otg.PatternFlowIpv4PriorityRawCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4PriorityRawCounter) PatternFlowIpv4PriorityRawCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4PriorityRawCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4PriorityRawCounter - // validate validates PatternFlowIpv4PriorityRawCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4PriorityRawCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4PriorityRawCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4PriorityRawCounter - SetStart(value uint32) PatternFlowIpv4PriorityRawCounter - // HasStart checks if Start has been set in PatternFlowIpv4PriorityRawCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4PriorityRawCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4PriorityRawCounter - SetStep(value uint32) PatternFlowIpv4PriorityRawCounter - // HasStep checks if Step has been set in PatternFlowIpv4PriorityRawCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4PriorityRawCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4PriorityRawCounter - SetCount(value uint32) PatternFlowIpv4PriorityRawCounter - // HasCount checks if Count has been set in PatternFlowIpv4PriorityRawCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4PriorityRawCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4PriorityRawCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4PriorityRawCounter object -func (obj *patternFlowIpv4PriorityRawCounter) SetStart(value uint32) PatternFlowIpv4PriorityRawCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4PriorityRawCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4PriorityRawCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4PriorityRawCounter object -func (obj *patternFlowIpv4PriorityRawCounter) SetStep(value uint32) PatternFlowIpv4PriorityRawCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4PriorityRawCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4PriorityRawCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4PriorityRawCounter object -func (obj *patternFlowIpv4PriorityRawCounter) SetCount(value uint32) PatternFlowIpv4PriorityRawCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4PriorityRawCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4PriorityRawCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4PriorityRawCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4PriorityRawCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4PriorityRawCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4PriorityRawMetricTag ***** -type patternFlowIpv4PriorityRawMetricTag struct { - validation - obj *otg.PatternFlowIpv4PriorityRawMetricTag - marshaller marshalPatternFlowIpv4PriorityRawMetricTag - unMarshaller unMarshalPatternFlowIpv4PriorityRawMetricTag -} - -func NewPatternFlowIpv4PriorityRawMetricTag() PatternFlowIpv4PriorityRawMetricTag { - obj := patternFlowIpv4PriorityRawMetricTag{obj: &otg.PatternFlowIpv4PriorityRawMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4PriorityRawMetricTag) msg() *otg.PatternFlowIpv4PriorityRawMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4PriorityRawMetricTag) setMsg(msg *otg.PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4PriorityRawMetricTag struct { - obj *patternFlowIpv4PriorityRawMetricTag -} - -type marshalPatternFlowIpv4PriorityRawMetricTag interface { - // ToProto marshals PatternFlowIpv4PriorityRawMetricTag to protobuf object *otg.PatternFlowIpv4PriorityRawMetricTag - ToProto() (*otg.PatternFlowIpv4PriorityRawMetricTag, error) - // ToPbText marshals PatternFlowIpv4PriorityRawMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4PriorityRawMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4PriorityRawMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4PriorityRawMetricTag struct { - obj *patternFlowIpv4PriorityRawMetricTag -} - -type unMarshalPatternFlowIpv4PriorityRawMetricTag interface { - // FromProto unmarshals PatternFlowIpv4PriorityRawMetricTag from protobuf object *otg.PatternFlowIpv4PriorityRawMetricTag - FromProto(msg *otg.PatternFlowIpv4PriorityRawMetricTag) (PatternFlowIpv4PriorityRawMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4PriorityRawMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4PriorityRawMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4PriorityRawMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4PriorityRawMetricTag) Marshal() marshalPatternFlowIpv4PriorityRawMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4PriorityRawMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4PriorityRawMetricTag) Unmarshal() unMarshalPatternFlowIpv4PriorityRawMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4PriorityRawMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4PriorityRawMetricTag) ToProto() (*otg.PatternFlowIpv4PriorityRawMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4PriorityRawMetricTag) FromProto(msg *otg.PatternFlowIpv4PriorityRawMetricTag) (PatternFlowIpv4PriorityRawMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4PriorityRawMetricTag) 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 *unMarshalpatternFlowIpv4PriorityRawMetricTag) 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 *marshalpatternFlowIpv4PriorityRawMetricTag) 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 *unMarshalpatternFlowIpv4PriorityRawMetricTag) 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 *marshalpatternFlowIpv4PriorityRawMetricTag) 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 *unMarshalpatternFlowIpv4PriorityRawMetricTag) 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 *patternFlowIpv4PriorityRawMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4PriorityRawMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4PriorityRawMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4PriorityRawMetricTag) Clone() (PatternFlowIpv4PriorityRawMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4PriorityRawMetricTag() - 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 -} - -// PatternFlowIpv4PriorityRawMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4PriorityRawMetricTag interface { - Validation - // msg marshals PatternFlowIpv4PriorityRawMetricTag to protobuf object *otg.PatternFlowIpv4PriorityRawMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4PriorityRawMetricTag - // setMsg unmarshals PatternFlowIpv4PriorityRawMetricTag from protobuf object *otg.PatternFlowIpv4PriorityRawMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4PriorityRawMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4PriorityRawMetricTag - // validate validates PatternFlowIpv4PriorityRawMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4PriorityRawMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4PriorityRawMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4PriorityRawMetricTag - SetName(value string) PatternFlowIpv4PriorityRawMetricTag - // Offset returns uint32, set in PatternFlowIpv4PriorityRawMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4PriorityRawMetricTag - SetOffset(value uint32) PatternFlowIpv4PriorityRawMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4PriorityRawMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4PriorityRawMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4PriorityRawMetricTag - SetLength(value uint32) PatternFlowIpv4PriorityRawMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4PriorityRawMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4PriorityRawMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4PriorityRawMetricTag object -func (obj *patternFlowIpv4PriorityRawMetricTag) SetName(value string) PatternFlowIpv4PriorityRawMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4PriorityRawMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4PriorityRawMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4PriorityRawMetricTag object -func (obj *patternFlowIpv4PriorityRawMetricTag) SetOffset(value uint32) PatternFlowIpv4PriorityRawMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4PriorityRawMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4PriorityRawMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4PriorityRawMetricTag object -func (obj *patternFlowIpv4PriorityRawMetricTag) SetLength(value uint32) PatternFlowIpv4PriorityRawMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4PriorityRawMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4PriorityRawMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4PriorityRawMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4PriorityRawMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4PriorityRawMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowIpv4TosPrecedence ***** -type patternFlowIpv4TosPrecedence struct { - validation - obj *otg.PatternFlowIpv4TosPrecedence - marshaller marshalPatternFlowIpv4TosPrecedence - unMarshaller unMarshalPatternFlowIpv4TosPrecedence - incrementHolder PatternFlowIpv4TosPrecedenceCounter - decrementHolder PatternFlowIpv4TosPrecedenceCounter - metricTagsHolder PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter -} - -func NewPatternFlowIpv4TosPrecedence() PatternFlowIpv4TosPrecedence { - obj := patternFlowIpv4TosPrecedence{obj: &otg.PatternFlowIpv4TosPrecedence{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosPrecedence) msg() *otg.PatternFlowIpv4TosPrecedence { - return obj.obj -} - -func (obj *patternFlowIpv4TosPrecedence) setMsg(msg *otg.PatternFlowIpv4TosPrecedence) PatternFlowIpv4TosPrecedence { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosPrecedence struct { - obj *patternFlowIpv4TosPrecedence -} - -type marshalPatternFlowIpv4TosPrecedence interface { - // ToProto marshals PatternFlowIpv4TosPrecedence to protobuf object *otg.PatternFlowIpv4TosPrecedence - ToProto() (*otg.PatternFlowIpv4TosPrecedence, error) - // ToPbText marshals PatternFlowIpv4TosPrecedence to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosPrecedence to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosPrecedence to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosPrecedence struct { - obj *patternFlowIpv4TosPrecedence -} - -type unMarshalPatternFlowIpv4TosPrecedence interface { - // FromProto unmarshals PatternFlowIpv4TosPrecedence from protobuf object *otg.PatternFlowIpv4TosPrecedence - FromProto(msg *otg.PatternFlowIpv4TosPrecedence) (PatternFlowIpv4TosPrecedence, error) - // FromPbText unmarshals PatternFlowIpv4TosPrecedence from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosPrecedence from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosPrecedence from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosPrecedence) Marshal() marshalPatternFlowIpv4TosPrecedence { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosPrecedence{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosPrecedence) Unmarshal() unMarshalPatternFlowIpv4TosPrecedence { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosPrecedence{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosPrecedence) ToProto() (*otg.PatternFlowIpv4TosPrecedence, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosPrecedence) FromProto(msg *otg.PatternFlowIpv4TosPrecedence) (PatternFlowIpv4TosPrecedence, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosPrecedence) 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 *unMarshalpatternFlowIpv4TosPrecedence) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4TosPrecedence) 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 *unMarshalpatternFlowIpv4TosPrecedence) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4TosPrecedence) 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 *unMarshalpatternFlowIpv4TosPrecedence) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4TosPrecedence) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosPrecedence) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosPrecedence) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosPrecedence) Clone() (PatternFlowIpv4TosPrecedence, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosPrecedence() - 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 -} - -func (obj *patternFlowIpv4TosPrecedence) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4TosPrecedence is precedence -type PatternFlowIpv4TosPrecedence interface { - Validation - // msg marshals PatternFlowIpv4TosPrecedence to protobuf object *otg.PatternFlowIpv4TosPrecedence - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosPrecedence - // setMsg unmarshals PatternFlowIpv4TosPrecedence from protobuf object *otg.PatternFlowIpv4TosPrecedence - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosPrecedence) PatternFlowIpv4TosPrecedence - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosPrecedence - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosPrecedence - // validate validates PatternFlowIpv4TosPrecedence - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosPrecedence, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4TosPrecedenceChoiceEnum, set in PatternFlowIpv4TosPrecedence - Choice() PatternFlowIpv4TosPrecedenceChoiceEnum - // setChoice assigns PatternFlowIpv4TosPrecedenceChoiceEnum provided by user to PatternFlowIpv4TosPrecedence - setChoice(value PatternFlowIpv4TosPrecedenceChoiceEnum) PatternFlowIpv4TosPrecedence - // HasChoice checks if Choice has been set in PatternFlowIpv4TosPrecedence - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4TosPrecedence. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4TosPrecedence - SetValue(value uint32) PatternFlowIpv4TosPrecedence - // HasValue checks if Value has been set in PatternFlowIpv4TosPrecedence - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4TosPrecedence. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4TosPrecedence - SetValues(value []uint32) PatternFlowIpv4TosPrecedence - // Increment returns PatternFlowIpv4TosPrecedenceCounter, set in PatternFlowIpv4TosPrecedence. - // PatternFlowIpv4TosPrecedenceCounter is integer counter pattern - Increment() PatternFlowIpv4TosPrecedenceCounter - // SetIncrement assigns PatternFlowIpv4TosPrecedenceCounter provided by user to PatternFlowIpv4TosPrecedence. - // PatternFlowIpv4TosPrecedenceCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4TosPrecedenceCounter) PatternFlowIpv4TosPrecedence - // HasIncrement checks if Increment has been set in PatternFlowIpv4TosPrecedence - HasIncrement() bool - // Decrement returns PatternFlowIpv4TosPrecedenceCounter, set in PatternFlowIpv4TosPrecedence. - // PatternFlowIpv4TosPrecedenceCounter is integer counter pattern - Decrement() PatternFlowIpv4TosPrecedenceCounter - // SetDecrement assigns PatternFlowIpv4TosPrecedenceCounter provided by user to PatternFlowIpv4TosPrecedence. - // PatternFlowIpv4TosPrecedenceCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4TosPrecedenceCounter) PatternFlowIpv4TosPrecedence - // HasDecrement checks if Decrement has been set in PatternFlowIpv4TosPrecedence - HasDecrement() bool - // MetricTags returns PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIterIter, set in PatternFlowIpv4TosPrecedence - MetricTags() PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter - setNil() -} - -type PatternFlowIpv4TosPrecedenceChoiceEnum string - -// Enum of Choice on PatternFlowIpv4TosPrecedence -var PatternFlowIpv4TosPrecedenceChoice = struct { - VALUE PatternFlowIpv4TosPrecedenceChoiceEnum - VALUES PatternFlowIpv4TosPrecedenceChoiceEnum - INCREMENT PatternFlowIpv4TosPrecedenceChoiceEnum - DECREMENT PatternFlowIpv4TosPrecedenceChoiceEnum -}{ - VALUE: PatternFlowIpv4TosPrecedenceChoiceEnum("value"), - VALUES: PatternFlowIpv4TosPrecedenceChoiceEnum("values"), - INCREMENT: PatternFlowIpv4TosPrecedenceChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4TosPrecedenceChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4TosPrecedence) Choice() PatternFlowIpv4TosPrecedenceChoiceEnum { - return PatternFlowIpv4TosPrecedenceChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4TosPrecedence) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4TosPrecedence) setChoice(value PatternFlowIpv4TosPrecedenceChoiceEnum) PatternFlowIpv4TosPrecedence { - intValue, ok := otg.PatternFlowIpv4TosPrecedence_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4TosPrecedenceChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4TosPrecedence_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4TosPrecedenceChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4TosPrecedenceChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4TosPrecedenceChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4TosPrecedenceCounter().msg() - } - - if value == PatternFlowIpv4TosPrecedenceChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4TosPrecedenceCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TosPrecedence) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TosPrecedence) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4TosPrecedence object -func (obj *patternFlowIpv4TosPrecedence) SetValue(value uint32) PatternFlowIpv4TosPrecedence { - obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4TosPrecedence) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4TosPrecedence object -func (obj *patternFlowIpv4TosPrecedence) SetValues(value []uint32) PatternFlowIpv4TosPrecedence { - obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4TosPrecedenceCounter -func (obj *patternFlowIpv4TosPrecedence) Increment() PatternFlowIpv4TosPrecedenceCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4TosPrecedenceCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4TosPrecedenceCounter -func (obj *patternFlowIpv4TosPrecedence) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4TosPrecedenceCounter value in the PatternFlowIpv4TosPrecedence object -func (obj *patternFlowIpv4TosPrecedence) SetIncrement(value PatternFlowIpv4TosPrecedenceCounter) PatternFlowIpv4TosPrecedence { - obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TosPrecedenceCounter -func (obj *patternFlowIpv4TosPrecedence) Decrement() PatternFlowIpv4TosPrecedenceCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4TosPrecedenceCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TosPrecedenceCounter -func (obj *patternFlowIpv4TosPrecedence) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4TosPrecedenceCounter value in the PatternFlowIpv4TosPrecedence object -func (obj *patternFlowIpv4TosPrecedence) SetDecrement(value PatternFlowIpv4TosPrecedenceCounter) PatternFlowIpv4TosPrecedence { - obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4TosPrecedenceMetricTag -func (obj *patternFlowIpv4TosPrecedence) MetricTags() PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4TosPrecedenceMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter struct { - obj *patternFlowIpv4TosPrecedence - patternFlowIpv4TosPrecedenceMetricTagSlice []PatternFlowIpv4TosPrecedenceMetricTag - fieldPtr *[]*otg.PatternFlowIpv4TosPrecedenceMetricTag -} - -func newPatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter(ptr *[]*otg.PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { - return &patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter interface { - setMsg(*patternFlowIpv4TosPrecedence) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter - Items() []PatternFlowIpv4TosPrecedenceMetricTag - Add() PatternFlowIpv4TosPrecedenceMetricTag - Append(items ...PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter - Set(index int, newObj PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter - Clear() PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter - clearHolderSlice() PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter - appendHolderSlice(item PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter -} - -func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) setMsg(msg *patternFlowIpv4TosPrecedence) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4TosPrecedenceMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) Items() []PatternFlowIpv4TosPrecedenceMetricTag { - return obj.patternFlowIpv4TosPrecedenceMetricTagSlice -} - -func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) Add() PatternFlowIpv4TosPrecedenceMetricTag { - newObj := &otg.PatternFlowIpv4TosPrecedenceMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4TosPrecedenceMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4TosPrecedenceMetricTagSlice = append(obj.patternFlowIpv4TosPrecedenceMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) Append(items ...PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4TosPrecedenceMetricTagSlice = append(obj.patternFlowIpv4TosPrecedenceMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) Set(index int, newObj PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4TosPrecedenceMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) Clear() PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4TosPrecedenceMetricTag{} - obj.patternFlowIpv4TosPrecedenceMetricTagSlice = []PatternFlowIpv4TosPrecedenceMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) clearHolderSlice() PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { - if len(obj.patternFlowIpv4TosPrecedenceMetricTagSlice) > 0 { - obj.patternFlowIpv4TosPrecedenceMetricTagSlice = []PatternFlowIpv4TosPrecedenceMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) appendHolderSlice(item PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { - obj.patternFlowIpv4TosPrecedenceMetricTagSlice = append(obj.patternFlowIpv4TosPrecedenceMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4TosPrecedence) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosPrecedence.Value <= 7 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4TosPrecedence.Values <= 7 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4TosPrecedenceMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4TosPrecedence) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4TosPrecedenceChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4TosPrecedenceChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4TosPrecedenceChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4TosPrecedenceChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4TosPrecedenceChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TosPrecedence") - } - } else { - intVal := otg.PatternFlowIpv4TosPrecedence_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4TosPrecedence_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4TosDelay ***** -type patternFlowIpv4TosDelay struct { - validation - obj *otg.PatternFlowIpv4TosDelay - marshaller marshalPatternFlowIpv4TosDelay - unMarshaller unMarshalPatternFlowIpv4TosDelay - incrementHolder PatternFlowIpv4TosDelayCounter - decrementHolder PatternFlowIpv4TosDelayCounter - metricTagsHolder PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter -} - -func NewPatternFlowIpv4TosDelay() PatternFlowIpv4TosDelay { - obj := patternFlowIpv4TosDelay{obj: &otg.PatternFlowIpv4TosDelay{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosDelay) msg() *otg.PatternFlowIpv4TosDelay { - return obj.obj -} - -func (obj *patternFlowIpv4TosDelay) setMsg(msg *otg.PatternFlowIpv4TosDelay) PatternFlowIpv4TosDelay { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosDelay struct { - obj *patternFlowIpv4TosDelay -} - -type marshalPatternFlowIpv4TosDelay interface { - // ToProto marshals PatternFlowIpv4TosDelay to protobuf object *otg.PatternFlowIpv4TosDelay - ToProto() (*otg.PatternFlowIpv4TosDelay, error) - // ToPbText marshals PatternFlowIpv4TosDelay to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosDelay to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosDelay to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosDelay struct { - obj *patternFlowIpv4TosDelay -} - -type unMarshalPatternFlowIpv4TosDelay interface { - // FromProto unmarshals PatternFlowIpv4TosDelay from protobuf object *otg.PatternFlowIpv4TosDelay - FromProto(msg *otg.PatternFlowIpv4TosDelay) (PatternFlowIpv4TosDelay, error) - // FromPbText unmarshals PatternFlowIpv4TosDelay from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosDelay from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosDelay from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosDelay) Marshal() marshalPatternFlowIpv4TosDelay { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosDelay{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosDelay) Unmarshal() unMarshalPatternFlowIpv4TosDelay { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosDelay{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosDelay) ToProto() (*otg.PatternFlowIpv4TosDelay, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosDelay) FromProto(msg *otg.PatternFlowIpv4TosDelay) (PatternFlowIpv4TosDelay, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosDelay) 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 *unMarshalpatternFlowIpv4TosDelay) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4TosDelay) 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 *unMarshalpatternFlowIpv4TosDelay) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4TosDelay) 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 *unMarshalpatternFlowIpv4TosDelay) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4TosDelay) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosDelay) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosDelay) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosDelay) Clone() (PatternFlowIpv4TosDelay, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosDelay() - 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 -} - -func (obj *patternFlowIpv4TosDelay) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4TosDelay is delay -type PatternFlowIpv4TosDelay interface { - Validation - // msg marshals PatternFlowIpv4TosDelay to protobuf object *otg.PatternFlowIpv4TosDelay - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosDelay - // setMsg unmarshals PatternFlowIpv4TosDelay from protobuf object *otg.PatternFlowIpv4TosDelay - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosDelay) PatternFlowIpv4TosDelay - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosDelay - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosDelay - // validate validates PatternFlowIpv4TosDelay - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosDelay, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4TosDelayChoiceEnum, set in PatternFlowIpv4TosDelay - Choice() PatternFlowIpv4TosDelayChoiceEnum - // setChoice assigns PatternFlowIpv4TosDelayChoiceEnum provided by user to PatternFlowIpv4TosDelay - setChoice(value PatternFlowIpv4TosDelayChoiceEnum) PatternFlowIpv4TosDelay - // HasChoice checks if Choice has been set in PatternFlowIpv4TosDelay - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4TosDelay. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4TosDelay - SetValue(value uint32) PatternFlowIpv4TosDelay - // HasValue checks if Value has been set in PatternFlowIpv4TosDelay - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4TosDelay. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4TosDelay - SetValues(value []uint32) PatternFlowIpv4TosDelay - // Increment returns PatternFlowIpv4TosDelayCounter, set in PatternFlowIpv4TosDelay. - // PatternFlowIpv4TosDelayCounter is integer counter pattern - Increment() PatternFlowIpv4TosDelayCounter - // SetIncrement assigns PatternFlowIpv4TosDelayCounter provided by user to PatternFlowIpv4TosDelay. - // PatternFlowIpv4TosDelayCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4TosDelayCounter) PatternFlowIpv4TosDelay - // HasIncrement checks if Increment has been set in PatternFlowIpv4TosDelay - HasIncrement() bool - // Decrement returns PatternFlowIpv4TosDelayCounter, set in PatternFlowIpv4TosDelay. - // PatternFlowIpv4TosDelayCounter is integer counter pattern - Decrement() PatternFlowIpv4TosDelayCounter - // SetDecrement assigns PatternFlowIpv4TosDelayCounter provided by user to PatternFlowIpv4TosDelay. - // PatternFlowIpv4TosDelayCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4TosDelayCounter) PatternFlowIpv4TosDelay - // HasDecrement checks if Decrement has been set in PatternFlowIpv4TosDelay - HasDecrement() bool - // MetricTags returns PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIterIter, set in PatternFlowIpv4TosDelay - MetricTags() PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter - setNil() -} - -type PatternFlowIpv4TosDelayChoiceEnum string - -// Enum of Choice on PatternFlowIpv4TosDelay -var PatternFlowIpv4TosDelayChoice = struct { - VALUE PatternFlowIpv4TosDelayChoiceEnum - VALUES PatternFlowIpv4TosDelayChoiceEnum - INCREMENT PatternFlowIpv4TosDelayChoiceEnum - DECREMENT PatternFlowIpv4TosDelayChoiceEnum -}{ - VALUE: PatternFlowIpv4TosDelayChoiceEnum("value"), - VALUES: PatternFlowIpv4TosDelayChoiceEnum("values"), - INCREMENT: PatternFlowIpv4TosDelayChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4TosDelayChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4TosDelay) Choice() PatternFlowIpv4TosDelayChoiceEnum { - return PatternFlowIpv4TosDelayChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4TosDelay) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4TosDelay) setChoice(value PatternFlowIpv4TosDelayChoiceEnum) PatternFlowIpv4TosDelay { - intValue, ok := otg.PatternFlowIpv4TosDelay_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4TosDelayChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4TosDelay_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4TosDelayChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4TosDelayChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4TosDelayChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4TosDelayCounter().msg() - } - - if value == PatternFlowIpv4TosDelayChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4TosDelayCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TosDelay) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4TosDelayChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TosDelay) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4TosDelay object -func (obj *patternFlowIpv4TosDelay) SetValue(value uint32) PatternFlowIpv4TosDelay { - obj.setChoice(PatternFlowIpv4TosDelayChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4TosDelay) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4TosDelay object -func (obj *patternFlowIpv4TosDelay) SetValues(value []uint32) PatternFlowIpv4TosDelay { - obj.setChoice(PatternFlowIpv4TosDelayChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4TosDelayCounter -func (obj *patternFlowIpv4TosDelay) Increment() PatternFlowIpv4TosDelayCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4TosDelayChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4TosDelayCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4TosDelayCounter -func (obj *patternFlowIpv4TosDelay) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4TosDelayCounter value in the PatternFlowIpv4TosDelay object -func (obj *patternFlowIpv4TosDelay) SetIncrement(value PatternFlowIpv4TosDelayCounter) PatternFlowIpv4TosDelay { - obj.setChoice(PatternFlowIpv4TosDelayChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TosDelayCounter -func (obj *patternFlowIpv4TosDelay) Decrement() PatternFlowIpv4TosDelayCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4TosDelayChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4TosDelayCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TosDelayCounter -func (obj *patternFlowIpv4TosDelay) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4TosDelayCounter value in the PatternFlowIpv4TosDelay object -func (obj *patternFlowIpv4TosDelay) SetDecrement(value PatternFlowIpv4TosDelayCounter) PatternFlowIpv4TosDelay { - obj.setChoice(PatternFlowIpv4TosDelayChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4TosDelayMetricTag -func (obj *patternFlowIpv4TosDelay) MetricTags() PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4TosDelayMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter struct { - obj *patternFlowIpv4TosDelay - patternFlowIpv4TosDelayMetricTagSlice []PatternFlowIpv4TosDelayMetricTag - fieldPtr *[]*otg.PatternFlowIpv4TosDelayMetricTag -} - -func newPatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter(ptr *[]*otg.PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { - return &patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter interface { - setMsg(*patternFlowIpv4TosDelay) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter - Items() []PatternFlowIpv4TosDelayMetricTag - Add() PatternFlowIpv4TosDelayMetricTag - Append(items ...PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter - Set(index int, newObj PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter - Clear() PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter - clearHolderSlice() PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter - appendHolderSlice(item PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter -} - -func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) setMsg(msg *patternFlowIpv4TosDelay) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4TosDelayMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) Items() []PatternFlowIpv4TosDelayMetricTag { - return obj.patternFlowIpv4TosDelayMetricTagSlice -} - -func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) Add() PatternFlowIpv4TosDelayMetricTag { - newObj := &otg.PatternFlowIpv4TosDelayMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4TosDelayMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4TosDelayMetricTagSlice = append(obj.patternFlowIpv4TosDelayMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) Append(items ...PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4TosDelayMetricTagSlice = append(obj.patternFlowIpv4TosDelayMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) Set(index int, newObj PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4TosDelayMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) Clear() PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4TosDelayMetricTag{} - obj.patternFlowIpv4TosDelayMetricTagSlice = []PatternFlowIpv4TosDelayMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) clearHolderSlice() PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { - if len(obj.patternFlowIpv4TosDelayMetricTagSlice) > 0 { - obj.patternFlowIpv4TosDelayMetricTagSlice = []PatternFlowIpv4TosDelayMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) appendHolderSlice(item PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { - obj.patternFlowIpv4TosDelayMetricTagSlice = append(obj.patternFlowIpv4TosDelayMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4TosDelay) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosDelay.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4TosDelay.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4TosDelayMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4TosDelay) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4TosDelayChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4TosDelayChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4TosDelayChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4TosDelayChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4TosDelayChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4TosDelayChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TosDelay") - } - } else { - intVal := otg.PatternFlowIpv4TosDelay_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4TosDelay_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4TosThroughput ***** -type patternFlowIpv4TosThroughput struct { - validation - obj *otg.PatternFlowIpv4TosThroughput - marshaller marshalPatternFlowIpv4TosThroughput - unMarshaller unMarshalPatternFlowIpv4TosThroughput - incrementHolder PatternFlowIpv4TosThroughputCounter - decrementHolder PatternFlowIpv4TosThroughputCounter - metricTagsHolder PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter -} - -func NewPatternFlowIpv4TosThroughput() PatternFlowIpv4TosThroughput { - obj := patternFlowIpv4TosThroughput{obj: &otg.PatternFlowIpv4TosThroughput{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosThroughput) msg() *otg.PatternFlowIpv4TosThroughput { - return obj.obj -} - -func (obj *patternFlowIpv4TosThroughput) setMsg(msg *otg.PatternFlowIpv4TosThroughput) PatternFlowIpv4TosThroughput { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosThroughput struct { - obj *patternFlowIpv4TosThroughput -} - -type marshalPatternFlowIpv4TosThroughput interface { - // ToProto marshals PatternFlowIpv4TosThroughput to protobuf object *otg.PatternFlowIpv4TosThroughput - ToProto() (*otg.PatternFlowIpv4TosThroughput, error) - // ToPbText marshals PatternFlowIpv4TosThroughput to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosThroughput to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosThroughput to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosThroughput struct { - obj *patternFlowIpv4TosThroughput -} - -type unMarshalPatternFlowIpv4TosThroughput interface { - // FromProto unmarshals PatternFlowIpv4TosThroughput from protobuf object *otg.PatternFlowIpv4TosThroughput - FromProto(msg *otg.PatternFlowIpv4TosThroughput) (PatternFlowIpv4TosThroughput, error) - // FromPbText unmarshals PatternFlowIpv4TosThroughput from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosThroughput from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosThroughput from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosThroughput) Marshal() marshalPatternFlowIpv4TosThroughput { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosThroughput{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosThroughput) Unmarshal() unMarshalPatternFlowIpv4TosThroughput { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosThroughput{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosThroughput) ToProto() (*otg.PatternFlowIpv4TosThroughput, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosThroughput) FromProto(msg *otg.PatternFlowIpv4TosThroughput) (PatternFlowIpv4TosThroughput, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosThroughput) 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 *unMarshalpatternFlowIpv4TosThroughput) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4TosThroughput) 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 *unMarshalpatternFlowIpv4TosThroughput) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4TosThroughput) 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 *unMarshalpatternFlowIpv4TosThroughput) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4TosThroughput) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosThroughput) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosThroughput) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosThroughput) Clone() (PatternFlowIpv4TosThroughput, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosThroughput() - 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 -} - -func (obj *patternFlowIpv4TosThroughput) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4TosThroughput is throughput -type PatternFlowIpv4TosThroughput interface { - Validation - // msg marshals PatternFlowIpv4TosThroughput to protobuf object *otg.PatternFlowIpv4TosThroughput - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosThroughput - // setMsg unmarshals PatternFlowIpv4TosThroughput from protobuf object *otg.PatternFlowIpv4TosThroughput - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosThroughput) PatternFlowIpv4TosThroughput - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosThroughput - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosThroughput - // validate validates PatternFlowIpv4TosThroughput - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosThroughput, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4TosThroughputChoiceEnum, set in PatternFlowIpv4TosThroughput - Choice() PatternFlowIpv4TosThroughputChoiceEnum - // setChoice assigns PatternFlowIpv4TosThroughputChoiceEnum provided by user to PatternFlowIpv4TosThroughput - setChoice(value PatternFlowIpv4TosThroughputChoiceEnum) PatternFlowIpv4TosThroughput - // HasChoice checks if Choice has been set in PatternFlowIpv4TosThroughput - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4TosThroughput. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4TosThroughput - SetValue(value uint32) PatternFlowIpv4TosThroughput - // HasValue checks if Value has been set in PatternFlowIpv4TosThroughput - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4TosThroughput. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4TosThroughput - SetValues(value []uint32) PatternFlowIpv4TosThroughput - // Increment returns PatternFlowIpv4TosThroughputCounter, set in PatternFlowIpv4TosThroughput. - // PatternFlowIpv4TosThroughputCounter is integer counter pattern - Increment() PatternFlowIpv4TosThroughputCounter - // SetIncrement assigns PatternFlowIpv4TosThroughputCounter provided by user to PatternFlowIpv4TosThroughput. - // PatternFlowIpv4TosThroughputCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4TosThroughputCounter) PatternFlowIpv4TosThroughput - // HasIncrement checks if Increment has been set in PatternFlowIpv4TosThroughput - HasIncrement() bool - // Decrement returns PatternFlowIpv4TosThroughputCounter, set in PatternFlowIpv4TosThroughput. - // PatternFlowIpv4TosThroughputCounter is integer counter pattern - Decrement() PatternFlowIpv4TosThroughputCounter - // SetDecrement assigns PatternFlowIpv4TosThroughputCounter provided by user to PatternFlowIpv4TosThroughput. - // PatternFlowIpv4TosThroughputCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4TosThroughputCounter) PatternFlowIpv4TosThroughput - // HasDecrement checks if Decrement has been set in PatternFlowIpv4TosThroughput - HasDecrement() bool - // MetricTags returns PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIterIter, set in PatternFlowIpv4TosThroughput - MetricTags() PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter - setNil() -} - -type PatternFlowIpv4TosThroughputChoiceEnum string - -// Enum of Choice on PatternFlowIpv4TosThroughput -var PatternFlowIpv4TosThroughputChoice = struct { - VALUE PatternFlowIpv4TosThroughputChoiceEnum - VALUES PatternFlowIpv4TosThroughputChoiceEnum - INCREMENT PatternFlowIpv4TosThroughputChoiceEnum - DECREMENT PatternFlowIpv4TosThroughputChoiceEnum -}{ - VALUE: PatternFlowIpv4TosThroughputChoiceEnum("value"), - VALUES: PatternFlowIpv4TosThroughputChoiceEnum("values"), - INCREMENT: PatternFlowIpv4TosThroughputChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4TosThroughputChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4TosThroughput) Choice() PatternFlowIpv4TosThroughputChoiceEnum { - return PatternFlowIpv4TosThroughputChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4TosThroughput) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4TosThroughput) setChoice(value PatternFlowIpv4TosThroughputChoiceEnum) PatternFlowIpv4TosThroughput { - intValue, ok := otg.PatternFlowIpv4TosThroughput_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4TosThroughputChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4TosThroughput_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4TosThroughputChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4TosThroughputChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4TosThroughputChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4TosThroughputCounter().msg() - } - - if value == PatternFlowIpv4TosThroughputChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4TosThroughputCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TosThroughput) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4TosThroughputChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TosThroughput) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4TosThroughput object -func (obj *patternFlowIpv4TosThroughput) SetValue(value uint32) PatternFlowIpv4TosThroughput { - obj.setChoice(PatternFlowIpv4TosThroughputChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4TosThroughput) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4TosThroughput object -func (obj *patternFlowIpv4TosThroughput) SetValues(value []uint32) PatternFlowIpv4TosThroughput { - obj.setChoice(PatternFlowIpv4TosThroughputChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4TosThroughputCounter -func (obj *patternFlowIpv4TosThroughput) Increment() PatternFlowIpv4TosThroughputCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4TosThroughputChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4TosThroughputCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4TosThroughputCounter -func (obj *patternFlowIpv4TosThroughput) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4TosThroughputCounter value in the PatternFlowIpv4TosThroughput object -func (obj *patternFlowIpv4TosThroughput) SetIncrement(value PatternFlowIpv4TosThroughputCounter) PatternFlowIpv4TosThroughput { - obj.setChoice(PatternFlowIpv4TosThroughputChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TosThroughputCounter -func (obj *patternFlowIpv4TosThroughput) Decrement() PatternFlowIpv4TosThroughputCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4TosThroughputChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4TosThroughputCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TosThroughputCounter -func (obj *patternFlowIpv4TosThroughput) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4TosThroughputCounter value in the PatternFlowIpv4TosThroughput object -func (obj *patternFlowIpv4TosThroughput) SetDecrement(value PatternFlowIpv4TosThroughputCounter) PatternFlowIpv4TosThroughput { - obj.setChoice(PatternFlowIpv4TosThroughputChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4TosThroughputMetricTag -func (obj *patternFlowIpv4TosThroughput) MetricTags() PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4TosThroughputMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter struct { - obj *patternFlowIpv4TosThroughput - patternFlowIpv4TosThroughputMetricTagSlice []PatternFlowIpv4TosThroughputMetricTag - fieldPtr *[]*otg.PatternFlowIpv4TosThroughputMetricTag -} - -func newPatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter(ptr *[]*otg.PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { - return &patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter interface { - setMsg(*patternFlowIpv4TosThroughput) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter - Items() []PatternFlowIpv4TosThroughputMetricTag - Add() PatternFlowIpv4TosThroughputMetricTag - Append(items ...PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter - Set(index int, newObj PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter - Clear() PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter - clearHolderSlice() PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter - appendHolderSlice(item PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter -} - -func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) setMsg(msg *patternFlowIpv4TosThroughput) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4TosThroughputMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) Items() []PatternFlowIpv4TosThroughputMetricTag { - return obj.patternFlowIpv4TosThroughputMetricTagSlice -} - -func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) Add() PatternFlowIpv4TosThroughputMetricTag { - newObj := &otg.PatternFlowIpv4TosThroughputMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4TosThroughputMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4TosThroughputMetricTagSlice = append(obj.patternFlowIpv4TosThroughputMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) Append(items ...PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4TosThroughputMetricTagSlice = append(obj.patternFlowIpv4TosThroughputMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) Set(index int, newObj PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4TosThroughputMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) Clear() PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4TosThroughputMetricTag{} - obj.patternFlowIpv4TosThroughputMetricTagSlice = []PatternFlowIpv4TosThroughputMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) clearHolderSlice() PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { - if len(obj.patternFlowIpv4TosThroughputMetricTagSlice) > 0 { - obj.patternFlowIpv4TosThroughputMetricTagSlice = []PatternFlowIpv4TosThroughputMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) appendHolderSlice(item PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { - obj.patternFlowIpv4TosThroughputMetricTagSlice = append(obj.patternFlowIpv4TosThroughputMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4TosThroughput) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosThroughput.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4TosThroughput.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4TosThroughputMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4TosThroughput) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4TosThroughputChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4TosThroughputChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4TosThroughputChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4TosThroughputChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4TosThroughputChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4TosThroughputChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TosThroughput") - } - } else { - intVal := otg.PatternFlowIpv4TosThroughput_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4TosThroughput_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4TosReliability ***** -type patternFlowIpv4TosReliability struct { - validation - obj *otg.PatternFlowIpv4TosReliability - marshaller marshalPatternFlowIpv4TosReliability - unMarshaller unMarshalPatternFlowIpv4TosReliability - incrementHolder PatternFlowIpv4TosReliabilityCounter - decrementHolder PatternFlowIpv4TosReliabilityCounter - metricTagsHolder PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter -} - -func NewPatternFlowIpv4TosReliability() PatternFlowIpv4TosReliability { - obj := patternFlowIpv4TosReliability{obj: &otg.PatternFlowIpv4TosReliability{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosReliability) msg() *otg.PatternFlowIpv4TosReliability { - return obj.obj -} - -func (obj *patternFlowIpv4TosReliability) setMsg(msg *otg.PatternFlowIpv4TosReliability) PatternFlowIpv4TosReliability { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosReliability struct { - obj *patternFlowIpv4TosReliability -} - -type marshalPatternFlowIpv4TosReliability interface { - // ToProto marshals PatternFlowIpv4TosReliability to protobuf object *otg.PatternFlowIpv4TosReliability - ToProto() (*otg.PatternFlowIpv4TosReliability, error) - // ToPbText marshals PatternFlowIpv4TosReliability to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosReliability to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosReliability to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosReliability struct { - obj *patternFlowIpv4TosReliability -} - -type unMarshalPatternFlowIpv4TosReliability interface { - // FromProto unmarshals PatternFlowIpv4TosReliability from protobuf object *otg.PatternFlowIpv4TosReliability - FromProto(msg *otg.PatternFlowIpv4TosReliability) (PatternFlowIpv4TosReliability, error) - // FromPbText unmarshals PatternFlowIpv4TosReliability from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosReliability from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosReliability from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosReliability) Marshal() marshalPatternFlowIpv4TosReliability { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosReliability{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosReliability) Unmarshal() unMarshalPatternFlowIpv4TosReliability { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosReliability{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosReliability) ToProto() (*otg.PatternFlowIpv4TosReliability, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosReliability) FromProto(msg *otg.PatternFlowIpv4TosReliability) (PatternFlowIpv4TosReliability, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosReliability) 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 *unMarshalpatternFlowIpv4TosReliability) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4TosReliability) 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 *unMarshalpatternFlowIpv4TosReliability) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4TosReliability) 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 *unMarshalpatternFlowIpv4TosReliability) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4TosReliability) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosReliability) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosReliability) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosReliability) Clone() (PatternFlowIpv4TosReliability, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosReliability() - 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 -} - -func (obj *patternFlowIpv4TosReliability) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4TosReliability is reliability -type PatternFlowIpv4TosReliability interface { - Validation - // msg marshals PatternFlowIpv4TosReliability to protobuf object *otg.PatternFlowIpv4TosReliability - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosReliability - // setMsg unmarshals PatternFlowIpv4TosReliability from protobuf object *otg.PatternFlowIpv4TosReliability - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosReliability) PatternFlowIpv4TosReliability - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosReliability - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosReliability - // validate validates PatternFlowIpv4TosReliability - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosReliability, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4TosReliabilityChoiceEnum, set in PatternFlowIpv4TosReliability - Choice() PatternFlowIpv4TosReliabilityChoiceEnum - // setChoice assigns PatternFlowIpv4TosReliabilityChoiceEnum provided by user to PatternFlowIpv4TosReliability - setChoice(value PatternFlowIpv4TosReliabilityChoiceEnum) PatternFlowIpv4TosReliability - // HasChoice checks if Choice has been set in PatternFlowIpv4TosReliability - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4TosReliability. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4TosReliability - SetValue(value uint32) PatternFlowIpv4TosReliability - // HasValue checks if Value has been set in PatternFlowIpv4TosReliability - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4TosReliability. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4TosReliability - SetValues(value []uint32) PatternFlowIpv4TosReliability - // Increment returns PatternFlowIpv4TosReliabilityCounter, set in PatternFlowIpv4TosReliability. - // PatternFlowIpv4TosReliabilityCounter is integer counter pattern - Increment() PatternFlowIpv4TosReliabilityCounter - // SetIncrement assigns PatternFlowIpv4TosReliabilityCounter provided by user to PatternFlowIpv4TosReliability. - // PatternFlowIpv4TosReliabilityCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4TosReliabilityCounter) PatternFlowIpv4TosReliability - // HasIncrement checks if Increment has been set in PatternFlowIpv4TosReliability - HasIncrement() bool - // Decrement returns PatternFlowIpv4TosReliabilityCounter, set in PatternFlowIpv4TosReliability. - // PatternFlowIpv4TosReliabilityCounter is integer counter pattern - Decrement() PatternFlowIpv4TosReliabilityCounter - // SetDecrement assigns PatternFlowIpv4TosReliabilityCounter provided by user to PatternFlowIpv4TosReliability. - // PatternFlowIpv4TosReliabilityCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4TosReliabilityCounter) PatternFlowIpv4TosReliability - // HasDecrement checks if Decrement has been set in PatternFlowIpv4TosReliability - HasDecrement() bool - // MetricTags returns PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIterIter, set in PatternFlowIpv4TosReliability - MetricTags() PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter - setNil() -} - -type PatternFlowIpv4TosReliabilityChoiceEnum string - -// Enum of Choice on PatternFlowIpv4TosReliability -var PatternFlowIpv4TosReliabilityChoice = struct { - VALUE PatternFlowIpv4TosReliabilityChoiceEnum - VALUES PatternFlowIpv4TosReliabilityChoiceEnum - INCREMENT PatternFlowIpv4TosReliabilityChoiceEnum - DECREMENT PatternFlowIpv4TosReliabilityChoiceEnum -}{ - VALUE: PatternFlowIpv4TosReliabilityChoiceEnum("value"), - VALUES: PatternFlowIpv4TosReliabilityChoiceEnum("values"), - INCREMENT: PatternFlowIpv4TosReliabilityChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4TosReliabilityChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4TosReliability) Choice() PatternFlowIpv4TosReliabilityChoiceEnum { - return PatternFlowIpv4TosReliabilityChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4TosReliability) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4TosReliability) setChoice(value PatternFlowIpv4TosReliabilityChoiceEnum) PatternFlowIpv4TosReliability { - intValue, ok := otg.PatternFlowIpv4TosReliability_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4TosReliabilityChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4TosReliability_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4TosReliabilityChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4TosReliabilityChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4TosReliabilityChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4TosReliabilityCounter().msg() - } - - if value == PatternFlowIpv4TosReliabilityChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4TosReliabilityCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TosReliability) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4TosReliabilityChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TosReliability) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4TosReliability object -func (obj *patternFlowIpv4TosReliability) SetValue(value uint32) PatternFlowIpv4TosReliability { - obj.setChoice(PatternFlowIpv4TosReliabilityChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4TosReliability) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4TosReliability object -func (obj *patternFlowIpv4TosReliability) SetValues(value []uint32) PatternFlowIpv4TosReliability { - obj.setChoice(PatternFlowIpv4TosReliabilityChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4TosReliabilityCounter -func (obj *patternFlowIpv4TosReliability) Increment() PatternFlowIpv4TosReliabilityCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4TosReliabilityChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4TosReliabilityCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4TosReliabilityCounter -func (obj *patternFlowIpv4TosReliability) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4TosReliabilityCounter value in the PatternFlowIpv4TosReliability object -func (obj *patternFlowIpv4TosReliability) SetIncrement(value PatternFlowIpv4TosReliabilityCounter) PatternFlowIpv4TosReliability { - obj.setChoice(PatternFlowIpv4TosReliabilityChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TosReliabilityCounter -func (obj *patternFlowIpv4TosReliability) Decrement() PatternFlowIpv4TosReliabilityCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4TosReliabilityChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4TosReliabilityCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TosReliabilityCounter -func (obj *patternFlowIpv4TosReliability) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4TosReliabilityCounter value in the PatternFlowIpv4TosReliability object -func (obj *patternFlowIpv4TosReliability) SetDecrement(value PatternFlowIpv4TosReliabilityCounter) PatternFlowIpv4TosReliability { - obj.setChoice(PatternFlowIpv4TosReliabilityChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4TosReliabilityMetricTag -func (obj *patternFlowIpv4TosReliability) MetricTags() PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4TosReliabilityMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter struct { - obj *patternFlowIpv4TosReliability - patternFlowIpv4TosReliabilityMetricTagSlice []PatternFlowIpv4TosReliabilityMetricTag - fieldPtr *[]*otg.PatternFlowIpv4TosReliabilityMetricTag -} - -func newPatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter(ptr *[]*otg.PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { - return &patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter interface { - setMsg(*patternFlowIpv4TosReliability) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter - Items() []PatternFlowIpv4TosReliabilityMetricTag - Add() PatternFlowIpv4TosReliabilityMetricTag - Append(items ...PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter - Set(index int, newObj PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter - Clear() PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter - clearHolderSlice() PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter - appendHolderSlice(item PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter -} - -func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) setMsg(msg *patternFlowIpv4TosReliability) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4TosReliabilityMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) Items() []PatternFlowIpv4TosReliabilityMetricTag { - return obj.patternFlowIpv4TosReliabilityMetricTagSlice -} - -func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) Add() PatternFlowIpv4TosReliabilityMetricTag { - newObj := &otg.PatternFlowIpv4TosReliabilityMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4TosReliabilityMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4TosReliabilityMetricTagSlice = append(obj.patternFlowIpv4TosReliabilityMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) Append(items ...PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4TosReliabilityMetricTagSlice = append(obj.patternFlowIpv4TosReliabilityMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) Set(index int, newObj PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4TosReliabilityMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) Clear() PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4TosReliabilityMetricTag{} - obj.patternFlowIpv4TosReliabilityMetricTagSlice = []PatternFlowIpv4TosReliabilityMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) clearHolderSlice() PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { - if len(obj.patternFlowIpv4TosReliabilityMetricTagSlice) > 0 { - obj.patternFlowIpv4TosReliabilityMetricTagSlice = []PatternFlowIpv4TosReliabilityMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) appendHolderSlice(item PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { - obj.patternFlowIpv4TosReliabilityMetricTagSlice = append(obj.patternFlowIpv4TosReliabilityMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4TosReliability) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosReliability.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4TosReliability.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4TosReliabilityMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4TosReliability) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4TosReliabilityChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4TosReliabilityChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4TosReliabilityChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4TosReliabilityChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4TosReliabilityChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4TosReliabilityChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TosReliability") - } - } else { - intVal := otg.PatternFlowIpv4TosReliability_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4TosReliability_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4TosMonetary ***** -type patternFlowIpv4TosMonetary struct { - validation - obj *otg.PatternFlowIpv4TosMonetary - marshaller marshalPatternFlowIpv4TosMonetary - unMarshaller unMarshalPatternFlowIpv4TosMonetary - incrementHolder PatternFlowIpv4TosMonetaryCounter - decrementHolder PatternFlowIpv4TosMonetaryCounter - metricTagsHolder PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter -} - -func NewPatternFlowIpv4TosMonetary() PatternFlowIpv4TosMonetary { - obj := patternFlowIpv4TosMonetary{obj: &otg.PatternFlowIpv4TosMonetary{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosMonetary) msg() *otg.PatternFlowIpv4TosMonetary { - return obj.obj -} - -func (obj *patternFlowIpv4TosMonetary) setMsg(msg *otg.PatternFlowIpv4TosMonetary) PatternFlowIpv4TosMonetary { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosMonetary struct { - obj *patternFlowIpv4TosMonetary -} - -type marshalPatternFlowIpv4TosMonetary interface { - // ToProto marshals PatternFlowIpv4TosMonetary to protobuf object *otg.PatternFlowIpv4TosMonetary - ToProto() (*otg.PatternFlowIpv4TosMonetary, error) - // ToPbText marshals PatternFlowIpv4TosMonetary to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosMonetary to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosMonetary to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosMonetary struct { - obj *patternFlowIpv4TosMonetary -} - -type unMarshalPatternFlowIpv4TosMonetary interface { - // FromProto unmarshals PatternFlowIpv4TosMonetary from protobuf object *otg.PatternFlowIpv4TosMonetary - FromProto(msg *otg.PatternFlowIpv4TosMonetary) (PatternFlowIpv4TosMonetary, error) - // FromPbText unmarshals PatternFlowIpv4TosMonetary from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosMonetary from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosMonetary from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosMonetary) Marshal() marshalPatternFlowIpv4TosMonetary { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosMonetary{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosMonetary) Unmarshal() unMarshalPatternFlowIpv4TosMonetary { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosMonetary{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosMonetary) ToProto() (*otg.PatternFlowIpv4TosMonetary, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosMonetary) FromProto(msg *otg.PatternFlowIpv4TosMonetary) (PatternFlowIpv4TosMonetary, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosMonetary) 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 *unMarshalpatternFlowIpv4TosMonetary) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4TosMonetary) 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 *unMarshalpatternFlowIpv4TosMonetary) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4TosMonetary) 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 *unMarshalpatternFlowIpv4TosMonetary) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4TosMonetary) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosMonetary) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosMonetary) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosMonetary) Clone() (PatternFlowIpv4TosMonetary, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosMonetary() - 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 -} - -func (obj *patternFlowIpv4TosMonetary) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4TosMonetary is monetary -type PatternFlowIpv4TosMonetary interface { - Validation - // msg marshals PatternFlowIpv4TosMonetary to protobuf object *otg.PatternFlowIpv4TosMonetary - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosMonetary - // setMsg unmarshals PatternFlowIpv4TosMonetary from protobuf object *otg.PatternFlowIpv4TosMonetary - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosMonetary) PatternFlowIpv4TosMonetary - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosMonetary - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosMonetary - // validate validates PatternFlowIpv4TosMonetary - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosMonetary, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4TosMonetaryChoiceEnum, set in PatternFlowIpv4TosMonetary - Choice() PatternFlowIpv4TosMonetaryChoiceEnum - // setChoice assigns PatternFlowIpv4TosMonetaryChoiceEnum provided by user to PatternFlowIpv4TosMonetary - setChoice(value PatternFlowIpv4TosMonetaryChoiceEnum) PatternFlowIpv4TosMonetary - // HasChoice checks if Choice has been set in PatternFlowIpv4TosMonetary - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4TosMonetary. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4TosMonetary - SetValue(value uint32) PatternFlowIpv4TosMonetary - // HasValue checks if Value has been set in PatternFlowIpv4TosMonetary - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4TosMonetary. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4TosMonetary - SetValues(value []uint32) PatternFlowIpv4TosMonetary - // Increment returns PatternFlowIpv4TosMonetaryCounter, set in PatternFlowIpv4TosMonetary. - // PatternFlowIpv4TosMonetaryCounter is integer counter pattern - Increment() PatternFlowIpv4TosMonetaryCounter - // SetIncrement assigns PatternFlowIpv4TosMonetaryCounter provided by user to PatternFlowIpv4TosMonetary. - // PatternFlowIpv4TosMonetaryCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4TosMonetaryCounter) PatternFlowIpv4TosMonetary - // HasIncrement checks if Increment has been set in PatternFlowIpv4TosMonetary - HasIncrement() bool - // Decrement returns PatternFlowIpv4TosMonetaryCounter, set in PatternFlowIpv4TosMonetary. - // PatternFlowIpv4TosMonetaryCounter is integer counter pattern - Decrement() PatternFlowIpv4TosMonetaryCounter - // SetDecrement assigns PatternFlowIpv4TosMonetaryCounter provided by user to PatternFlowIpv4TosMonetary. - // PatternFlowIpv4TosMonetaryCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4TosMonetaryCounter) PatternFlowIpv4TosMonetary - // HasDecrement checks if Decrement has been set in PatternFlowIpv4TosMonetary - HasDecrement() bool - // MetricTags returns PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIterIter, set in PatternFlowIpv4TosMonetary - MetricTags() PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter - setNil() -} - -type PatternFlowIpv4TosMonetaryChoiceEnum string - -// Enum of Choice on PatternFlowIpv4TosMonetary -var PatternFlowIpv4TosMonetaryChoice = struct { - VALUE PatternFlowIpv4TosMonetaryChoiceEnum - VALUES PatternFlowIpv4TosMonetaryChoiceEnum - INCREMENT PatternFlowIpv4TosMonetaryChoiceEnum - DECREMENT PatternFlowIpv4TosMonetaryChoiceEnum -}{ - VALUE: PatternFlowIpv4TosMonetaryChoiceEnum("value"), - VALUES: PatternFlowIpv4TosMonetaryChoiceEnum("values"), - INCREMENT: PatternFlowIpv4TosMonetaryChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4TosMonetaryChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4TosMonetary) Choice() PatternFlowIpv4TosMonetaryChoiceEnum { - return PatternFlowIpv4TosMonetaryChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4TosMonetary) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4TosMonetary) setChoice(value PatternFlowIpv4TosMonetaryChoiceEnum) PatternFlowIpv4TosMonetary { - intValue, ok := otg.PatternFlowIpv4TosMonetary_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4TosMonetaryChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4TosMonetary_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4TosMonetaryChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4TosMonetaryChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4TosMonetaryChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4TosMonetaryCounter().msg() - } - - if value == PatternFlowIpv4TosMonetaryChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4TosMonetaryCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TosMonetary) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4TosMonetaryChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TosMonetary) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4TosMonetary object -func (obj *patternFlowIpv4TosMonetary) SetValue(value uint32) PatternFlowIpv4TosMonetary { - obj.setChoice(PatternFlowIpv4TosMonetaryChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4TosMonetary) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4TosMonetary object -func (obj *patternFlowIpv4TosMonetary) SetValues(value []uint32) PatternFlowIpv4TosMonetary { - obj.setChoice(PatternFlowIpv4TosMonetaryChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4TosMonetaryCounter -func (obj *patternFlowIpv4TosMonetary) Increment() PatternFlowIpv4TosMonetaryCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4TosMonetaryChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4TosMonetaryCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4TosMonetaryCounter -func (obj *patternFlowIpv4TosMonetary) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4TosMonetaryCounter value in the PatternFlowIpv4TosMonetary object -func (obj *patternFlowIpv4TosMonetary) SetIncrement(value PatternFlowIpv4TosMonetaryCounter) PatternFlowIpv4TosMonetary { - obj.setChoice(PatternFlowIpv4TosMonetaryChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TosMonetaryCounter -func (obj *patternFlowIpv4TosMonetary) Decrement() PatternFlowIpv4TosMonetaryCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4TosMonetaryChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4TosMonetaryCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TosMonetaryCounter -func (obj *patternFlowIpv4TosMonetary) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4TosMonetaryCounter value in the PatternFlowIpv4TosMonetary object -func (obj *patternFlowIpv4TosMonetary) SetDecrement(value PatternFlowIpv4TosMonetaryCounter) PatternFlowIpv4TosMonetary { - obj.setChoice(PatternFlowIpv4TosMonetaryChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4TosMonetaryMetricTag -func (obj *patternFlowIpv4TosMonetary) MetricTags() PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4TosMonetaryMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter struct { - obj *patternFlowIpv4TosMonetary - patternFlowIpv4TosMonetaryMetricTagSlice []PatternFlowIpv4TosMonetaryMetricTag - fieldPtr *[]*otg.PatternFlowIpv4TosMonetaryMetricTag -} - -func newPatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter(ptr *[]*otg.PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { - return &patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter interface { - setMsg(*patternFlowIpv4TosMonetary) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter - Items() []PatternFlowIpv4TosMonetaryMetricTag - Add() PatternFlowIpv4TosMonetaryMetricTag - Append(items ...PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter - Set(index int, newObj PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter - Clear() PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter - clearHolderSlice() PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter - appendHolderSlice(item PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter -} - -func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) setMsg(msg *patternFlowIpv4TosMonetary) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4TosMonetaryMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) Items() []PatternFlowIpv4TosMonetaryMetricTag { - return obj.patternFlowIpv4TosMonetaryMetricTagSlice -} - -func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) Add() PatternFlowIpv4TosMonetaryMetricTag { - newObj := &otg.PatternFlowIpv4TosMonetaryMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4TosMonetaryMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4TosMonetaryMetricTagSlice = append(obj.patternFlowIpv4TosMonetaryMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) Append(items ...PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4TosMonetaryMetricTagSlice = append(obj.patternFlowIpv4TosMonetaryMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) Set(index int, newObj PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4TosMonetaryMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) Clear() PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4TosMonetaryMetricTag{} - obj.patternFlowIpv4TosMonetaryMetricTagSlice = []PatternFlowIpv4TosMonetaryMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) clearHolderSlice() PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { - if len(obj.patternFlowIpv4TosMonetaryMetricTagSlice) > 0 { - obj.patternFlowIpv4TosMonetaryMetricTagSlice = []PatternFlowIpv4TosMonetaryMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) appendHolderSlice(item PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { - obj.patternFlowIpv4TosMonetaryMetricTagSlice = append(obj.patternFlowIpv4TosMonetaryMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4TosMonetary) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosMonetary.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4TosMonetary.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4TosMonetaryMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4TosMonetary) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4TosMonetaryChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4TosMonetaryChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4TosMonetaryChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4TosMonetaryChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4TosMonetaryChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4TosMonetaryChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TosMonetary") - } - } else { - intVal := otg.PatternFlowIpv4TosMonetary_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4TosMonetary_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4TosUnused ***** -type patternFlowIpv4TosUnused struct { - validation - obj *otg.PatternFlowIpv4TosUnused - marshaller marshalPatternFlowIpv4TosUnused - unMarshaller unMarshalPatternFlowIpv4TosUnused - incrementHolder PatternFlowIpv4TosUnusedCounter - decrementHolder PatternFlowIpv4TosUnusedCounter - metricTagsHolder PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter -} - -func NewPatternFlowIpv4TosUnused() PatternFlowIpv4TosUnused { - obj := patternFlowIpv4TosUnused{obj: &otg.PatternFlowIpv4TosUnused{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosUnused) msg() *otg.PatternFlowIpv4TosUnused { - return obj.obj -} - -func (obj *patternFlowIpv4TosUnused) setMsg(msg *otg.PatternFlowIpv4TosUnused) PatternFlowIpv4TosUnused { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosUnused struct { - obj *patternFlowIpv4TosUnused -} - -type marshalPatternFlowIpv4TosUnused interface { - // ToProto marshals PatternFlowIpv4TosUnused to protobuf object *otg.PatternFlowIpv4TosUnused - ToProto() (*otg.PatternFlowIpv4TosUnused, error) - // ToPbText marshals PatternFlowIpv4TosUnused to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosUnused to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosUnused to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosUnused struct { - obj *patternFlowIpv4TosUnused -} - -type unMarshalPatternFlowIpv4TosUnused interface { - // FromProto unmarshals PatternFlowIpv4TosUnused from protobuf object *otg.PatternFlowIpv4TosUnused - FromProto(msg *otg.PatternFlowIpv4TosUnused) (PatternFlowIpv4TosUnused, error) - // FromPbText unmarshals PatternFlowIpv4TosUnused from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosUnused from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosUnused from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosUnused) Marshal() marshalPatternFlowIpv4TosUnused { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosUnused{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosUnused) Unmarshal() unMarshalPatternFlowIpv4TosUnused { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosUnused{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosUnused) ToProto() (*otg.PatternFlowIpv4TosUnused, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosUnused) FromProto(msg *otg.PatternFlowIpv4TosUnused) (PatternFlowIpv4TosUnused, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosUnused) 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 *unMarshalpatternFlowIpv4TosUnused) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4TosUnused) 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 *unMarshalpatternFlowIpv4TosUnused) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4TosUnused) 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 *unMarshalpatternFlowIpv4TosUnused) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4TosUnused) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosUnused) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosUnused) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosUnused) Clone() (PatternFlowIpv4TosUnused, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosUnused() - 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 -} - -func (obj *patternFlowIpv4TosUnused) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4TosUnused is unused -type PatternFlowIpv4TosUnused interface { - Validation - // msg marshals PatternFlowIpv4TosUnused to protobuf object *otg.PatternFlowIpv4TosUnused - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosUnused - // setMsg unmarshals PatternFlowIpv4TosUnused from protobuf object *otg.PatternFlowIpv4TosUnused - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosUnused) PatternFlowIpv4TosUnused - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosUnused - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosUnused - // validate validates PatternFlowIpv4TosUnused - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosUnused, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4TosUnusedChoiceEnum, set in PatternFlowIpv4TosUnused - Choice() PatternFlowIpv4TosUnusedChoiceEnum - // setChoice assigns PatternFlowIpv4TosUnusedChoiceEnum provided by user to PatternFlowIpv4TosUnused - setChoice(value PatternFlowIpv4TosUnusedChoiceEnum) PatternFlowIpv4TosUnused - // HasChoice checks if Choice has been set in PatternFlowIpv4TosUnused - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4TosUnused. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4TosUnused - SetValue(value uint32) PatternFlowIpv4TosUnused - // HasValue checks if Value has been set in PatternFlowIpv4TosUnused - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4TosUnused. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4TosUnused - SetValues(value []uint32) PatternFlowIpv4TosUnused - // Increment returns PatternFlowIpv4TosUnusedCounter, set in PatternFlowIpv4TosUnused. - // PatternFlowIpv4TosUnusedCounter is integer counter pattern - Increment() PatternFlowIpv4TosUnusedCounter - // SetIncrement assigns PatternFlowIpv4TosUnusedCounter provided by user to PatternFlowIpv4TosUnused. - // PatternFlowIpv4TosUnusedCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4TosUnusedCounter) PatternFlowIpv4TosUnused - // HasIncrement checks if Increment has been set in PatternFlowIpv4TosUnused - HasIncrement() bool - // Decrement returns PatternFlowIpv4TosUnusedCounter, set in PatternFlowIpv4TosUnused. - // PatternFlowIpv4TosUnusedCounter is integer counter pattern - Decrement() PatternFlowIpv4TosUnusedCounter - // SetDecrement assigns PatternFlowIpv4TosUnusedCounter provided by user to PatternFlowIpv4TosUnused. - // PatternFlowIpv4TosUnusedCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4TosUnusedCounter) PatternFlowIpv4TosUnused - // HasDecrement checks if Decrement has been set in PatternFlowIpv4TosUnused - HasDecrement() bool - // MetricTags returns PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIterIter, set in PatternFlowIpv4TosUnused - MetricTags() PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter - setNil() -} - -type PatternFlowIpv4TosUnusedChoiceEnum string - -// Enum of Choice on PatternFlowIpv4TosUnused -var PatternFlowIpv4TosUnusedChoice = struct { - VALUE PatternFlowIpv4TosUnusedChoiceEnum - VALUES PatternFlowIpv4TosUnusedChoiceEnum - INCREMENT PatternFlowIpv4TosUnusedChoiceEnum - DECREMENT PatternFlowIpv4TosUnusedChoiceEnum -}{ - VALUE: PatternFlowIpv4TosUnusedChoiceEnum("value"), - VALUES: PatternFlowIpv4TosUnusedChoiceEnum("values"), - INCREMENT: PatternFlowIpv4TosUnusedChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4TosUnusedChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4TosUnused) Choice() PatternFlowIpv4TosUnusedChoiceEnum { - return PatternFlowIpv4TosUnusedChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4TosUnused) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4TosUnused) setChoice(value PatternFlowIpv4TosUnusedChoiceEnum) PatternFlowIpv4TosUnused { - intValue, ok := otg.PatternFlowIpv4TosUnused_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4TosUnusedChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4TosUnused_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4TosUnusedChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4TosUnusedChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4TosUnusedChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4TosUnusedCounter().msg() - } - - if value == PatternFlowIpv4TosUnusedChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4TosUnusedCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TosUnused) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4TosUnusedChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4TosUnused) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4TosUnused object -func (obj *patternFlowIpv4TosUnused) SetValue(value uint32) PatternFlowIpv4TosUnused { - obj.setChoice(PatternFlowIpv4TosUnusedChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4TosUnused) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4TosUnused object -func (obj *patternFlowIpv4TosUnused) SetValues(value []uint32) PatternFlowIpv4TosUnused { - obj.setChoice(PatternFlowIpv4TosUnusedChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4TosUnusedCounter -func (obj *patternFlowIpv4TosUnused) Increment() PatternFlowIpv4TosUnusedCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4TosUnusedChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4TosUnusedCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4TosUnusedCounter -func (obj *patternFlowIpv4TosUnused) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4TosUnusedCounter value in the PatternFlowIpv4TosUnused object -func (obj *patternFlowIpv4TosUnused) SetIncrement(value PatternFlowIpv4TosUnusedCounter) PatternFlowIpv4TosUnused { - obj.setChoice(PatternFlowIpv4TosUnusedChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TosUnusedCounter -func (obj *patternFlowIpv4TosUnused) Decrement() PatternFlowIpv4TosUnusedCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4TosUnusedChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4TosUnusedCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4TosUnusedCounter -func (obj *patternFlowIpv4TosUnused) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4TosUnusedCounter value in the PatternFlowIpv4TosUnused object -func (obj *patternFlowIpv4TosUnused) SetDecrement(value PatternFlowIpv4TosUnusedCounter) PatternFlowIpv4TosUnused { - obj.setChoice(PatternFlowIpv4TosUnusedChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4TosUnusedMetricTag -func (obj *patternFlowIpv4TosUnused) MetricTags() PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4TosUnusedMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter struct { - obj *patternFlowIpv4TosUnused - patternFlowIpv4TosUnusedMetricTagSlice []PatternFlowIpv4TosUnusedMetricTag - fieldPtr *[]*otg.PatternFlowIpv4TosUnusedMetricTag -} - -func newPatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter(ptr *[]*otg.PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { - return &patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter interface { - setMsg(*patternFlowIpv4TosUnused) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter - Items() []PatternFlowIpv4TosUnusedMetricTag - Add() PatternFlowIpv4TosUnusedMetricTag - Append(items ...PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter - Set(index int, newObj PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter - Clear() PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter - clearHolderSlice() PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter - appendHolderSlice(item PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter -} - -func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) setMsg(msg *patternFlowIpv4TosUnused) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4TosUnusedMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) Items() []PatternFlowIpv4TosUnusedMetricTag { - return obj.patternFlowIpv4TosUnusedMetricTagSlice -} - -func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) Add() PatternFlowIpv4TosUnusedMetricTag { - newObj := &otg.PatternFlowIpv4TosUnusedMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4TosUnusedMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4TosUnusedMetricTagSlice = append(obj.patternFlowIpv4TosUnusedMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) Append(items ...PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4TosUnusedMetricTagSlice = append(obj.patternFlowIpv4TosUnusedMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) Set(index int, newObj PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4TosUnusedMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) Clear() PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4TosUnusedMetricTag{} - obj.patternFlowIpv4TosUnusedMetricTagSlice = []PatternFlowIpv4TosUnusedMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) clearHolderSlice() PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { - if len(obj.patternFlowIpv4TosUnusedMetricTagSlice) > 0 { - obj.patternFlowIpv4TosUnusedMetricTagSlice = []PatternFlowIpv4TosUnusedMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) appendHolderSlice(item PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { - obj.patternFlowIpv4TosUnusedMetricTagSlice = append(obj.patternFlowIpv4TosUnusedMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4TosUnused) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosUnused.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4TosUnused.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4TosUnusedMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4TosUnused) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4TosUnusedChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4TosUnusedChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4TosUnusedChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4TosUnusedChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4TosUnusedChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4TosUnusedChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TosUnused") - } - } else { - intVal := otg.PatternFlowIpv4TosUnused_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4TosUnused_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4DscpPhb ***** -type patternFlowIpv4DscpPhb struct { - validation - obj *otg.PatternFlowIpv4DscpPhb - marshaller marshalPatternFlowIpv4DscpPhb - unMarshaller unMarshalPatternFlowIpv4DscpPhb - incrementHolder PatternFlowIpv4DscpPhbCounter - decrementHolder PatternFlowIpv4DscpPhbCounter - metricTagsHolder PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter -} - -func NewPatternFlowIpv4DscpPhb() PatternFlowIpv4DscpPhb { - obj := patternFlowIpv4DscpPhb{obj: &otg.PatternFlowIpv4DscpPhb{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4DscpPhb) msg() *otg.PatternFlowIpv4DscpPhb { - return obj.obj -} - -func (obj *patternFlowIpv4DscpPhb) setMsg(msg *otg.PatternFlowIpv4DscpPhb) PatternFlowIpv4DscpPhb { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4DscpPhb struct { - obj *patternFlowIpv4DscpPhb -} - -type marshalPatternFlowIpv4DscpPhb interface { - // ToProto marshals PatternFlowIpv4DscpPhb to protobuf object *otg.PatternFlowIpv4DscpPhb - ToProto() (*otg.PatternFlowIpv4DscpPhb, error) - // ToPbText marshals PatternFlowIpv4DscpPhb to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4DscpPhb to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4DscpPhb to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4DscpPhb struct { - obj *patternFlowIpv4DscpPhb -} - -type unMarshalPatternFlowIpv4DscpPhb interface { - // FromProto unmarshals PatternFlowIpv4DscpPhb from protobuf object *otg.PatternFlowIpv4DscpPhb - FromProto(msg *otg.PatternFlowIpv4DscpPhb) (PatternFlowIpv4DscpPhb, error) - // FromPbText unmarshals PatternFlowIpv4DscpPhb from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4DscpPhb from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4DscpPhb from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4DscpPhb) Marshal() marshalPatternFlowIpv4DscpPhb { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4DscpPhb{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4DscpPhb) Unmarshal() unMarshalPatternFlowIpv4DscpPhb { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4DscpPhb{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4DscpPhb) ToProto() (*otg.PatternFlowIpv4DscpPhb, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4DscpPhb) FromProto(msg *otg.PatternFlowIpv4DscpPhb) (PatternFlowIpv4DscpPhb, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4DscpPhb) 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 *unMarshalpatternFlowIpv4DscpPhb) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4DscpPhb) 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 *unMarshalpatternFlowIpv4DscpPhb) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4DscpPhb) 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 *unMarshalpatternFlowIpv4DscpPhb) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4DscpPhb) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DscpPhb) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DscpPhb) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4DscpPhb) Clone() (PatternFlowIpv4DscpPhb, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4DscpPhb() - 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 -} - -func (obj *patternFlowIpv4DscpPhb) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4DscpPhb is per hop behavior -type PatternFlowIpv4DscpPhb interface { - Validation - // msg marshals PatternFlowIpv4DscpPhb to protobuf object *otg.PatternFlowIpv4DscpPhb - // and doesn't set defaults - msg() *otg.PatternFlowIpv4DscpPhb - // setMsg unmarshals PatternFlowIpv4DscpPhb from protobuf object *otg.PatternFlowIpv4DscpPhb - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4DscpPhb) PatternFlowIpv4DscpPhb - // provides marshal interface - Marshal() marshalPatternFlowIpv4DscpPhb - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4DscpPhb - // validate validates PatternFlowIpv4DscpPhb - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4DscpPhb, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4DscpPhbChoiceEnum, set in PatternFlowIpv4DscpPhb - Choice() PatternFlowIpv4DscpPhbChoiceEnum - // setChoice assigns PatternFlowIpv4DscpPhbChoiceEnum provided by user to PatternFlowIpv4DscpPhb - setChoice(value PatternFlowIpv4DscpPhbChoiceEnum) PatternFlowIpv4DscpPhb - // HasChoice checks if Choice has been set in PatternFlowIpv4DscpPhb - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4DscpPhb. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4DscpPhb - SetValue(value uint32) PatternFlowIpv4DscpPhb - // HasValue checks if Value has been set in PatternFlowIpv4DscpPhb - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4DscpPhb. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4DscpPhb - SetValues(value []uint32) PatternFlowIpv4DscpPhb - // Increment returns PatternFlowIpv4DscpPhbCounter, set in PatternFlowIpv4DscpPhb. - // PatternFlowIpv4DscpPhbCounter is integer counter pattern - Increment() PatternFlowIpv4DscpPhbCounter - // SetIncrement assigns PatternFlowIpv4DscpPhbCounter provided by user to PatternFlowIpv4DscpPhb. - // PatternFlowIpv4DscpPhbCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4DscpPhbCounter) PatternFlowIpv4DscpPhb - // HasIncrement checks if Increment has been set in PatternFlowIpv4DscpPhb - HasIncrement() bool - // Decrement returns PatternFlowIpv4DscpPhbCounter, set in PatternFlowIpv4DscpPhb. - // PatternFlowIpv4DscpPhbCounter is integer counter pattern - Decrement() PatternFlowIpv4DscpPhbCounter - // SetDecrement assigns PatternFlowIpv4DscpPhbCounter provided by user to PatternFlowIpv4DscpPhb. - // PatternFlowIpv4DscpPhbCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4DscpPhbCounter) PatternFlowIpv4DscpPhb - // HasDecrement checks if Decrement has been set in PatternFlowIpv4DscpPhb - HasDecrement() bool - // MetricTags returns PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIterIter, set in PatternFlowIpv4DscpPhb - MetricTags() PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter - setNil() -} - -type PatternFlowIpv4DscpPhbChoiceEnum string - -// Enum of Choice on PatternFlowIpv4DscpPhb -var PatternFlowIpv4DscpPhbChoice = struct { - VALUE PatternFlowIpv4DscpPhbChoiceEnum - VALUES PatternFlowIpv4DscpPhbChoiceEnum - INCREMENT PatternFlowIpv4DscpPhbChoiceEnum - DECREMENT PatternFlowIpv4DscpPhbChoiceEnum -}{ - VALUE: PatternFlowIpv4DscpPhbChoiceEnum("value"), - VALUES: PatternFlowIpv4DscpPhbChoiceEnum("values"), - INCREMENT: PatternFlowIpv4DscpPhbChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4DscpPhbChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4DscpPhb) Choice() PatternFlowIpv4DscpPhbChoiceEnum { - return PatternFlowIpv4DscpPhbChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4DscpPhb) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4DscpPhb) setChoice(value PatternFlowIpv4DscpPhbChoiceEnum) PatternFlowIpv4DscpPhb { - intValue, ok := otg.PatternFlowIpv4DscpPhb_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4DscpPhbChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4DscpPhb_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4DscpPhbChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4DscpPhbChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4DscpPhbChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4DscpPhbCounter().msg() - } - - if value == PatternFlowIpv4DscpPhbChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4DscpPhbCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4DscpPhb) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4DscpPhbChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4DscpPhb) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4DscpPhb object -func (obj *patternFlowIpv4DscpPhb) SetValue(value uint32) PatternFlowIpv4DscpPhb { - obj.setChoice(PatternFlowIpv4DscpPhbChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4DscpPhb) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4DscpPhb object -func (obj *patternFlowIpv4DscpPhb) SetValues(value []uint32) PatternFlowIpv4DscpPhb { - obj.setChoice(PatternFlowIpv4DscpPhbChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4DscpPhbCounter -func (obj *patternFlowIpv4DscpPhb) Increment() PatternFlowIpv4DscpPhbCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4DscpPhbChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4DscpPhbCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4DscpPhbCounter -func (obj *patternFlowIpv4DscpPhb) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4DscpPhbCounter value in the PatternFlowIpv4DscpPhb object -func (obj *patternFlowIpv4DscpPhb) SetIncrement(value PatternFlowIpv4DscpPhbCounter) PatternFlowIpv4DscpPhb { - obj.setChoice(PatternFlowIpv4DscpPhbChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4DscpPhbCounter -func (obj *patternFlowIpv4DscpPhb) Decrement() PatternFlowIpv4DscpPhbCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4DscpPhbChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4DscpPhbCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4DscpPhbCounter -func (obj *patternFlowIpv4DscpPhb) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4DscpPhbCounter value in the PatternFlowIpv4DscpPhb object -func (obj *patternFlowIpv4DscpPhb) SetDecrement(value PatternFlowIpv4DscpPhbCounter) PatternFlowIpv4DscpPhb { - obj.setChoice(PatternFlowIpv4DscpPhbChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4DscpPhbMetricTag -func (obj *patternFlowIpv4DscpPhb) MetricTags() PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4DscpPhbMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter struct { - obj *patternFlowIpv4DscpPhb - patternFlowIpv4DscpPhbMetricTagSlice []PatternFlowIpv4DscpPhbMetricTag - fieldPtr *[]*otg.PatternFlowIpv4DscpPhbMetricTag -} - -func newPatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter(ptr *[]*otg.PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { - return &patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter interface { - setMsg(*patternFlowIpv4DscpPhb) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter - Items() []PatternFlowIpv4DscpPhbMetricTag - Add() PatternFlowIpv4DscpPhbMetricTag - Append(items ...PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter - Set(index int, newObj PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter - Clear() PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter - clearHolderSlice() PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter - appendHolderSlice(item PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter -} - -func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) setMsg(msg *patternFlowIpv4DscpPhb) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4DscpPhbMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) Items() []PatternFlowIpv4DscpPhbMetricTag { - return obj.patternFlowIpv4DscpPhbMetricTagSlice -} - -func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) Add() PatternFlowIpv4DscpPhbMetricTag { - newObj := &otg.PatternFlowIpv4DscpPhbMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4DscpPhbMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4DscpPhbMetricTagSlice = append(obj.patternFlowIpv4DscpPhbMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) Append(items ...PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4DscpPhbMetricTagSlice = append(obj.patternFlowIpv4DscpPhbMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) Set(index int, newObj PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4DscpPhbMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) Clear() PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4DscpPhbMetricTag{} - obj.patternFlowIpv4DscpPhbMetricTagSlice = []PatternFlowIpv4DscpPhbMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) clearHolderSlice() PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { - if len(obj.patternFlowIpv4DscpPhbMetricTagSlice) > 0 { - obj.patternFlowIpv4DscpPhbMetricTagSlice = []PatternFlowIpv4DscpPhbMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) appendHolderSlice(item PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { - obj.patternFlowIpv4DscpPhbMetricTagSlice = append(obj.patternFlowIpv4DscpPhbMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4DscpPhb) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 63 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DscpPhb.Value <= 63 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 63 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4DscpPhb.Values <= 63 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4DscpPhbMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4DscpPhb) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4DscpPhbChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4DscpPhbChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4DscpPhbChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4DscpPhbChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4DscpPhbChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4DscpPhbChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4DscpPhb") - } - } else { - intVal := otg.PatternFlowIpv4DscpPhb_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4DscpPhb_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4DscpEcn ***** -type patternFlowIpv4DscpEcn struct { - validation - obj *otg.PatternFlowIpv4DscpEcn - marshaller marshalPatternFlowIpv4DscpEcn - unMarshaller unMarshalPatternFlowIpv4DscpEcn - incrementHolder PatternFlowIpv4DscpEcnCounter - decrementHolder PatternFlowIpv4DscpEcnCounter - metricTagsHolder PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter -} - -func NewPatternFlowIpv4DscpEcn() PatternFlowIpv4DscpEcn { - obj := patternFlowIpv4DscpEcn{obj: &otg.PatternFlowIpv4DscpEcn{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4DscpEcn) msg() *otg.PatternFlowIpv4DscpEcn { - return obj.obj -} - -func (obj *patternFlowIpv4DscpEcn) setMsg(msg *otg.PatternFlowIpv4DscpEcn) PatternFlowIpv4DscpEcn { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4DscpEcn struct { - obj *patternFlowIpv4DscpEcn -} - -type marshalPatternFlowIpv4DscpEcn interface { - // ToProto marshals PatternFlowIpv4DscpEcn to protobuf object *otg.PatternFlowIpv4DscpEcn - ToProto() (*otg.PatternFlowIpv4DscpEcn, error) - // ToPbText marshals PatternFlowIpv4DscpEcn to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4DscpEcn to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4DscpEcn to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4DscpEcn struct { - obj *patternFlowIpv4DscpEcn -} - -type unMarshalPatternFlowIpv4DscpEcn interface { - // FromProto unmarshals PatternFlowIpv4DscpEcn from protobuf object *otg.PatternFlowIpv4DscpEcn - FromProto(msg *otg.PatternFlowIpv4DscpEcn) (PatternFlowIpv4DscpEcn, error) - // FromPbText unmarshals PatternFlowIpv4DscpEcn from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4DscpEcn from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4DscpEcn from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4DscpEcn) Marshal() marshalPatternFlowIpv4DscpEcn { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4DscpEcn{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4DscpEcn) Unmarshal() unMarshalPatternFlowIpv4DscpEcn { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4DscpEcn{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4DscpEcn) ToProto() (*otg.PatternFlowIpv4DscpEcn, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4DscpEcn) FromProto(msg *otg.PatternFlowIpv4DscpEcn) (PatternFlowIpv4DscpEcn, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4DscpEcn) 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 *unMarshalpatternFlowIpv4DscpEcn) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4DscpEcn) 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 *unMarshalpatternFlowIpv4DscpEcn) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4DscpEcn) 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 *unMarshalpatternFlowIpv4DscpEcn) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4DscpEcn) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DscpEcn) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DscpEcn) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4DscpEcn) Clone() (PatternFlowIpv4DscpEcn, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4DscpEcn() - 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 -} - -func (obj *patternFlowIpv4DscpEcn) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.metricTagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4DscpEcn is explicit congestion notification -type PatternFlowIpv4DscpEcn interface { - Validation - // msg marshals PatternFlowIpv4DscpEcn to protobuf object *otg.PatternFlowIpv4DscpEcn - // and doesn't set defaults - msg() *otg.PatternFlowIpv4DscpEcn - // setMsg unmarshals PatternFlowIpv4DscpEcn from protobuf object *otg.PatternFlowIpv4DscpEcn - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4DscpEcn) PatternFlowIpv4DscpEcn - // provides marshal interface - Marshal() marshalPatternFlowIpv4DscpEcn - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4DscpEcn - // validate validates PatternFlowIpv4DscpEcn - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4DscpEcn, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4DscpEcnChoiceEnum, set in PatternFlowIpv4DscpEcn - Choice() PatternFlowIpv4DscpEcnChoiceEnum - // setChoice assigns PatternFlowIpv4DscpEcnChoiceEnum provided by user to PatternFlowIpv4DscpEcn - setChoice(value PatternFlowIpv4DscpEcnChoiceEnum) PatternFlowIpv4DscpEcn - // HasChoice checks if Choice has been set in PatternFlowIpv4DscpEcn - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4DscpEcn. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4DscpEcn - SetValue(value uint32) PatternFlowIpv4DscpEcn - // HasValue checks if Value has been set in PatternFlowIpv4DscpEcn - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4DscpEcn. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4DscpEcn - SetValues(value []uint32) PatternFlowIpv4DscpEcn - // Increment returns PatternFlowIpv4DscpEcnCounter, set in PatternFlowIpv4DscpEcn. - // PatternFlowIpv4DscpEcnCounter is integer counter pattern - Increment() PatternFlowIpv4DscpEcnCounter - // SetIncrement assigns PatternFlowIpv4DscpEcnCounter provided by user to PatternFlowIpv4DscpEcn. - // PatternFlowIpv4DscpEcnCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4DscpEcnCounter) PatternFlowIpv4DscpEcn - // HasIncrement checks if Increment has been set in PatternFlowIpv4DscpEcn - HasIncrement() bool - // Decrement returns PatternFlowIpv4DscpEcnCounter, set in PatternFlowIpv4DscpEcn. - // PatternFlowIpv4DscpEcnCounter is integer counter pattern - Decrement() PatternFlowIpv4DscpEcnCounter - // SetDecrement assigns PatternFlowIpv4DscpEcnCounter provided by user to PatternFlowIpv4DscpEcn. - // PatternFlowIpv4DscpEcnCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4DscpEcnCounter) PatternFlowIpv4DscpEcn - // HasDecrement checks if Decrement has been set in PatternFlowIpv4DscpEcn - HasDecrement() bool - // MetricTags returns PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIterIter, set in PatternFlowIpv4DscpEcn - MetricTags() PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter - setNil() -} - -type PatternFlowIpv4DscpEcnChoiceEnum string - -// Enum of Choice on PatternFlowIpv4DscpEcn -var PatternFlowIpv4DscpEcnChoice = struct { - VALUE PatternFlowIpv4DscpEcnChoiceEnum - VALUES PatternFlowIpv4DscpEcnChoiceEnum - INCREMENT PatternFlowIpv4DscpEcnChoiceEnum - DECREMENT PatternFlowIpv4DscpEcnChoiceEnum -}{ - VALUE: PatternFlowIpv4DscpEcnChoiceEnum("value"), - VALUES: PatternFlowIpv4DscpEcnChoiceEnum("values"), - INCREMENT: PatternFlowIpv4DscpEcnChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4DscpEcnChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4DscpEcn) Choice() PatternFlowIpv4DscpEcnChoiceEnum { - return PatternFlowIpv4DscpEcnChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4DscpEcn) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4DscpEcn) setChoice(value PatternFlowIpv4DscpEcnChoiceEnum) PatternFlowIpv4DscpEcn { - intValue, ok := otg.PatternFlowIpv4DscpEcn_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4DscpEcnChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4DscpEcn_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4DscpEcnChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4DscpEcnChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4DscpEcnChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4DscpEcnCounter().msg() - } - - if value == PatternFlowIpv4DscpEcnChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4DscpEcnCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4DscpEcn) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4DscpEcnChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4DscpEcn) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4DscpEcn object -func (obj *patternFlowIpv4DscpEcn) SetValue(value uint32) PatternFlowIpv4DscpEcn { - obj.setChoice(PatternFlowIpv4DscpEcnChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4DscpEcn) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4DscpEcn object -func (obj *patternFlowIpv4DscpEcn) SetValues(value []uint32) PatternFlowIpv4DscpEcn { - obj.setChoice(PatternFlowIpv4DscpEcnChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4DscpEcnCounter -func (obj *patternFlowIpv4DscpEcn) Increment() PatternFlowIpv4DscpEcnCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4DscpEcnChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4DscpEcnCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4DscpEcnCounter -func (obj *patternFlowIpv4DscpEcn) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4DscpEcnCounter value in the PatternFlowIpv4DscpEcn object -func (obj *patternFlowIpv4DscpEcn) SetIncrement(value PatternFlowIpv4DscpEcnCounter) PatternFlowIpv4DscpEcn { - obj.setChoice(PatternFlowIpv4DscpEcnChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4DscpEcnCounter -func (obj *patternFlowIpv4DscpEcn) Decrement() PatternFlowIpv4DscpEcnCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4DscpEcnChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4DscpEcnCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4DscpEcnCounter -func (obj *patternFlowIpv4DscpEcn) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4DscpEcnCounter value in the PatternFlowIpv4DscpEcn object -func (obj *patternFlowIpv4DscpEcn) SetDecrement(value PatternFlowIpv4DscpEcnCounter) PatternFlowIpv4DscpEcn { - obj.setChoice(PatternFlowIpv4DscpEcnChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -// MetricTags returns a []PatternFlowIpv4DscpEcnMetricTag -func (obj *patternFlowIpv4DscpEcn) MetricTags() PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { - if len(obj.obj.MetricTags) == 0 { - obj.obj.MetricTags = []*otg.PatternFlowIpv4DscpEcnMetricTag{} - } - if obj.metricTagsHolder == nil { - obj.metricTagsHolder = newPatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter(&obj.obj.MetricTags).setMsg(obj) - } - return obj.metricTagsHolder -} - -type patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter struct { - obj *patternFlowIpv4DscpEcn - patternFlowIpv4DscpEcnMetricTagSlice []PatternFlowIpv4DscpEcnMetricTag - fieldPtr *[]*otg.PatternFlowIpv4DscpEcnMetricTag -} - -func newPatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter(ptr *[]*otg.PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { - return &patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter{fieldPtr: ptr} -} - -type PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter interface { - setMsg(*patternFlowIpv4DscpEcn) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter - Items() []PatternFlowIpv4DscpEcnMetricTag - Add() PatternFlowIpv4DscpEcnMetricTag - Append(items ...PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter - Set(index int, newObj PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter - Clear() PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter - clearHolderSlice() PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter - appendHolderSlice(item PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter -} - -func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) setMsg(msg *patternFlowIpv4DscpEcn) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&patternFlowIpv4DscpEcnMetricTag{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) Items() []PatternFlowIpv4DscpEcnMetricTag { - return obj.patternFlowIpv4DscpEcnMetricTagSlice -} - -func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) Add() PatternFlowIpv4DscpEcnMetricTag { - newObj := &otg.PatternFlowIpv4DscpEcnMetricTag{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &patternFlowIpv4DscpEcnMetricTag{obj: newObj} - newLibObj.setDefault() - obj.patternFlowIpv4DscpEcnMetricTagSlice = append(obj.patternFlowIpv4DscpEcnMetricTagSlice, newLibObj) - return newLibObj -} - -func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) Append(items ...PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.patternFlowIpv4DscpEcnMetricTagSlice = append(obj.patternFlowIpv4DscpEcnMetricTagSlice, item) - } - return obj -} - -func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) Set(index int, newObj PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.patternFlowIpv4DscpEcnMetricTagSlice[index] = newObj - return obj -} -func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) Clear() PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.PatternFlowIpv4DscpEcnMetricTag{} - obj.patternFlowIpv4DscpEcnMetricTagSlice = []PatternFlowIpv4DscpEcnMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) clearHolderSlice() PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { - if len(obj.patternFlowIpv4DscpEcnMetricTagSlice) > 0 { - obj.patternFlowIpv4DscpEcnMetricTagSlice = []PatternFlowIpv4DscpEcnMetricTag{} - } - return obj -} -func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) appendHolderSlice(item PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { - obj.patternFlowIpv4DscpEcnMetricTagSlice = append(obj.patternFlowIpv4DscpEcnMetricTagSlice, item) - return obj -} - -func (obj *patternFlowIpv4DscpEcn) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DscpEcn.Value <= 3 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4DscpEcn.Values <= 3 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - - if len(obj.obj.MetricTags) != 0 { - - if set_default { - obj.MetricTags().clearHolderSlice() - for _, item := range obj.obj.MetricTags { - obj.MetricTags().appendHolderSlice(&patternFlowIpv4DscpEcnMetricTag{obj: item}) - } - } - for _, item := range obj.MetricTags().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *patternFlowIpv4DscpEcn) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4DscpEcnChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4DscpEcnChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4DscpEcnChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4DscpEcnChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4DscpEcnChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4DscpEcnChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4DscpEcn") - } - } else { - intVal := otg.PatternFlowIpv4DscpEcn_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4DscpEcn_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowIpv4OptionsCustomType ***** -type flowIpv4OptionsCustomType struct { - validation - obj *otg.FlowIpv4OptionsCustomType - marshaller marshalFlowIpv4OptionsCustomType - unMarshaller unMarshalFlowIpv4OptionsCustomType - copiedFlagHolder PatternFlowIpv4OptionsCustomTypeCopiedFlag - optionClassHolder PatternFlowIpv4OptionsCustomTypeOptionClass - optionNumberHolder PatternFlowIpv4OptionsCustomTypeOptionNumber -} - -func NewFlowIpv4OptionsCustomType() FlowIpv4OptionsCustomType { - obj := flowIpv4OptionsCustomType{obj: &otg.FlowIpv4OptionsCustomType{}} - obj.setDefault() - return &obj -} - -func (obj *flowIpv4OptionsCustomType) msg() *otg.FlowIpv4OptionsCustomType { - return obj.obj -} - -func (obj *flowIpv4OptionsCustomType) setMsg(msg *otg.FlowIpv4OptionsCustomType) FlowIpv4OptionsCustomType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIpv4OptionsCustomType struct { - obj *flowIpv4OptionsCustomType -} - -type marshalFlowIpv4OptionsCustomType interface { - // ToProto marshals FlowIpv4OptionsCustomType to protobuf object *otg.FlowIpv4OptionsCustomType - ToProto() (*otg.FlowIpv4OptionsCustomType, error) - // ToPbText marshals FlowIpv4OptionsCustomType to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIpv4OptionsCustomType to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIpv4OptionsCustomType to JSON text - ToJson() (string, error) -} - -type unMarshalflowIpv4OptionsCustomType struct { - obj *flowIpv4OptionsCustomType -} - -type unMarshalFlowIpv4OptionsCustomType interface { - // FromProto unmarshals FlowIpv4OptionsCustomType from protobuf object *otg.FlowIpv4OptionsCustomType - FromProto(msg *otg.FlowIpv4OptionsCustomType) (FlowIpv4OptionsCustomType, error) - // FromPbText unmarshals FlowIpv4OptionsCustomType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIpv4OptionsCustomType from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIpv4OptionsCustomType from JSON text - FromJson(value string) error -} - -func (obj *flowIpv4OptionsCustomType) Marshal() marshalFlowIpv4OptionsCustomType { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIpv4OptionsCustomType{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIpv4OptionsCustomType) Unmarshal() unMarshalFlowIpv4OptionsCustomType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIpv4OptionsCustomType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIpv4OptionsCustomType) ToProto() (*otg.FlowIpv4OptionsCustomType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIpv4OptionsCustomType) FromProto(msg *otg.FlowIpv4OptionsCustomType) (FlowIpv4OptionsCustomType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIpv4OptionsCustomType) 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 *unMarshalflowIpv4OptionsCustomType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowIpv4OptionsCustomType) 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 *unMarshalflowIpv4OptionsCustomType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowIpv4OptionsCustomType) 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 *unMarshalflowIpv4OptionsCustomType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowIpv4OptionsCustomType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIpv4OptionsCustomType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIpv4OptionsCustomType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIpv4OptionsCustomType) Clone() (FlowIpv4OptionsCustomType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIpv4OptionsCustomType() - 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 -} - -func (obj *flowIpv4OptionsCustomType) setNil() { - obj.copiedFlagHolder = nil - obj.optionClassHolder = nil - obj.optionNumberHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowIpv4OptionsCustomType is type options for custom options. -type FlowIpv4OptionsCustomType interface { - Validation - // msg marshals FlowIpv4OptionsCustomType to protobuf object *otg.FlowIpv4OptionsCustomType - // and doesn't set defaults - msg() *otg.FlowIpv4OptionsCustomType - // setMsg unmarshals FlowIpv4OptionsCustomType from protobuf object *otg.FlowIpv4OptionsCustomType - // and doesn't set defaults - setMsg(*otg.FlowIpv4OptionsCustomType) FlowIpv4OptionsCustomType - // provides marshal interface - Marshal() marshalFlowIpv4OptionsCustomType - // provides unmarshal interface - Unmarshal() unMarshalFlowIpv4OptionsCustomType - // validate validates FlowIpv4OptionsCustomType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIpv4OptionsCustomType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // CopiedFlag returns PatternFlowIpv4OptionsCustomTypeCopiedFlag, set in FlowIpv4OptionsCustomType. - // PatternFlowIpv4OptionsCustomTypeCopiedFlag is this flag indicates this option is copied to all fragments on fragmentations. - CopiedFlag() PatternFlowIpv4OptionsCustomTypeCopiedFlag - // SetCopiedFlag assigns PatternFlowIpv4OptionsCustomTypeCopiedFlag provided by user to FlowIpv4OptionsCustomType. - // PatternFlowIpv4OptionsCustomTypeCopiedFlag is this flag indicates this option is copied to all fragments on fragmentations. - SetCopiedFlag(value PatternFlowIpv4OptionsCustomTypeCopiedFlag) FlowIpv4OptionsCustomType - // HasCopiedFlag checks if CopiedFlag has been set in FlowIpv4OptionsCustomType - HasCopiedFlag() bool - // OptionClass returns PatternFlowIpv4OptionsCustomTypeOptionClass, set in FlowIpv4OptionsCustomType. - // PatternFlowIpv4OptionsCustomTypeOptionClass is option class [Ref:https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-1]. - OptionClass() PatternFlowIpv4OptionsCustomTypeOptionClass - // SetOptionClass assigns PatternFlowIpv4OptionsCustomTypeOptionClass provided by user to FlowIpv4OptionsCustomType. - // PatternFlowIpv4OptionsCustomTypeOptionClass is option class [Ref:https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-1]. - SetOptionClass(value PatternFlowIpv4OptionsCustomTypeOptionClass) FlowIpv4OptionsCustomType - // HasOptionClass checks if OptionClass has been set in FlowIpv4OptionsCustomType - HasOptionClass() bool - // OptionNumber returns PatternFlowIpv4OptionsCustomTypeOptionNumber, set in FlowIpv4OptionsCustomType. - // PatternFlowIpv4OptionsCustomTypeOptionNumber is option Number [Ref:https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-1]. - OptionNumber() PatternFlowIpv4OptionsCustomTypeOptionNumber - // SetOptionNumber assigns PatternFlowIpv4OptionsCustomTypeOptionNumber provided by user to FlowIpv4OptionsCustomType. - // PatternFlowIpv4OptionsCustomTypeOptionNumber is option Number [Ref:https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-1]. - SetOptionNumber(value PatternFlowIpv4OptionsCustomTypeOptionNumber) FlowIpv4OptionsCustomType - // HasOptionNumber checks if OptionNumber has been set in FlowIpv4OptionsCustomType - HasOptionNumber() bool - setNil() -} - -// description is TBD -// CopiedFlag returns a PatternFlowIpv4OptionsCustomTypeCopiedFlag -func (obj *flowIpv4OptionsCustomType) CopiedFlag() PatternFlowIpv4OptionsCustomTypeCopiedFlag { - if obj.obj.CopiedFlag == nil { - obj.obj.CopiedFlag = NewPatternFlowIpv4OptionsCustomTypeCopiedFlag().msg() - } - if obj.copiedFlagHolder == nil { - obj.copiedFlagHolder = &patternFlowIpv4OptionsCustomTypeCopiedFlag{obj: obj.obj.CopiedFlag} - } - return obj.copiedFlagHolder -} - -// description is TBD -// CopiedFlag returns a PatternFlowIpv4OptionsCustomTypeCopiedFlag -func (obj *flowIpv4OptionsCustomType) HasCopiedFlag() bool { - return obj.obj.CopiedFlag != nil -} - -// description is TBD -// SetCopiedFlag sets the PatternFlowIpv4OptionsCustomTypeCopiedFlag value in the FlowIpv4OptionsCustomType object -func (obj *flowIpv4OptionsCustomType) SetCopiedFlag(value PatternFlowIpv4OptionsCustomTypeCopiedFlag) FlowIpv4OptionsCustomType { - - obj.copiedFlagHolder = nil - obj.obj.CopiedFlag = value.msg() - - return obj -} - -// description is TBD -// OptionClass returns a PatternFlowIpv4OptionsCustomTypeOptionClass -func (obj *flowIpv4OptionsCustomType) OptionClass() PatternFlowIpv4OptionsCustomTypeOptionClass { - if obj.obj.OptionClass == nil { - obj.obj.OptionClass = NewPatternFlowIpv4OptionsCustomTypeOptionClass().msg() - } - if obj.optionClassHolder == nil { - obj.optionClassHolder = &patternFlowIpv4OptionsCustomTypeOptionClass{obj: obj.obj.OptionClass} - } - return obj.optionClassHolder -} - -// description is TBD -// OptionClass returns a PatternFlowIpv4OptionsCustomTypeOptionClass -func (obj *flowIpv4OptionsCustomType) HasOptionClass() bool { - return obj.obj.OptionClass != nil -} - -// description is TBD -// SetOptionClass sets the PatternFlowIpv4OptionsCustomTypeOptionClass value in the FlowIpv4OptionsCustomType object -func (obj *flowIpv4OptionsCustomType) SetOptionClass(value PatternFlowIpv4OptionsCustomTypeOptionClass) FlowIpv4OptionsCustomType { - - obj.optionClassHolder = nil - obj.obj.OptionClass = value.msg() - - return obj -} - -// description is TBD -// OptionNumber returns a PatternFlowIpv4OptionsCustomTypeOptionNumber -func (obj *flowIpv4OptionsCustomType) OptionNumber() PatternFlowIpv4OptionsCustomTypeOptionNumber { - if obj.obj.OptionNumber == nil { - obj.obj.OptionNumber = NewPatternFlowIpv4OptionsCustomTypeOptionNumber().msg() - } - if obj.optionNumberHolder == nil { - obj.optionNumberHolder = &patternFlowIpv4OptionsCustomTypeOptionNumber{obj: obj.obj.OptionNumber} - } - return obj.optionNumberHolder -} - -// description is TBD -// OptionNumber returns a PatternFlowIpv4OptionsCustomTypeOptionNumber -func (obj *flowIpv4OptionsCustomType) HasOptionNumber() bool { - return obj.obj.OptionNumber != nil -} - -// description is TBD -// SetOptionNumber sets the PatternFlowIpv4OptionsCustomTypeOptionNumber value in the FlowIpv4OptionsCustomType object -func (obj *flowIpv4OptionsCustomType) SetOptionNumber(value PatternFlowIpv4OptionsCustomTypeOptionNumber) FlowIpv4OptionsCustomType { - - obj.optionNumberHolder = nil - obj.obj.OptionNumber = value.msg() - - return obj -} - -func (obj *flowIpv4OptionsCustomType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.CopiedFlag != nil { - - obj.CopiedFlag().validateObj(vObj, set_default) - } - - if obj.obj.OptionClass != nil { - - obj.OptionClass().validateObj(vObj, set_default) - } - - if obj.obj.OptionNumber != nil { - - obj.OptionNumber().validateObj(vObj, set_default) - } - -} - -func (obj *flowIpv4OptionsCustomType) setDefault() { - -} - -// ***** FlowIpv4OptionsCustomLength ***** -type flowIpv4OptionsCustomLength struct { - validation - obj *otg.FlowIpv4OptionsCustomLength - marshaller marshalFlowIpv4OptionsCustomLength - unMarshaller unMarshalFlowIpv4OptionsCustomLength -} - -func NewFlowIpv4OptionsCustomLength() FlowIpv4OptionsCustomLength { - obj := flowIpv4OptionsCustomLength{obj: &otg.FlowIpv4OptionsCustomLength{}} - obj.setDefault() - return &obj -} - -func (obj *flowIpv4OptionsCustomLength) msg() *otg.FlowIpv4OptionsCustomLength { - return obj.obj -} - -func (obj *flowIpv4OptionsCustomLength) setMsg(msg *otg.FlowIpv4OptionsCustomLength) FlowIpv4OptionsCustomLength { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowIpv4OptionsCustomLength struct { - obj *flowIpv4OptionsCustomLength -} - -type marshalFlowIpv4OptionsCustomLength interface { - // ToProto marshals FlowIpv4OptionsCustomLength to protobuf object *otg.FlowIpv4OptionsCustomLength - ToProto() (*otg.FlowIpv4OptionsCustomLength, error) - // ToPbText marshals FlowIpv4OptionsCustomLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowIpv4OptionsCustomLength to YAML text - ToYaml() (string, error) - // ToJson marshals FlowIpv4OptionsCustomLength to JSON text - ToJson() (string, error) -} - -type unMarshalflowIpv4OptionsCustomLength struct { - obj *flowIpv4OptionsCustomLength -} - -type unMarshalFlowIpv4OptionsCustomLength interface { - // FromProto unmarshals FlowIpv4OptionsCustomLength from protobuf object *otg.FlowIpv4OptionsCustomLength - FromProto(msg *otg.FlowIpv4OptionsCustomLength) (FlowIpv4OptionsCustomLength, error) - // FromPbText unmarshals FlowIpv4OptionsCustomLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowIpv4OptionsCustomLength from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowIpv4OptionsCustomLength from JSON text - FromJson(value string) error -} - -func (obj *flowIpv4OptionsCustomLength) Marshal() marshalFlowIpv4OptionsCustomLength { - if obj.marshaller == nil { - obj.marshaller = &marshalflowIpv4OptionsCustomLength{obj: obj} - } - return obj.marshaller -} - -func (obj *flowIpv4OptionsCustomLength) Unmarshal() unMarshalFlowIpv4OptionsCustomLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowIpv4OptionsCustomLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowIpv4OptionsCustomLength) ToProto() (*otg.FlowIpv4OptionsCustomLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowIpv4OptionsCustomLength) FromProto(msg *otg.FlowIpv4OptionsCustomLength) (FlowIpv4OptionsCustomLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowIpv4OptionsCustomLength) 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 *unMarshalflowIpv4OptionsCustomLength) 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 *marshalflowIpv4OptionsCustomLength) 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 *unMarshalflowIpv4OptionsCustomLength) 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 *marshalflowIpv4OptionsCustomLength) 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 *unMarshalflowIpv4OptionsCustomLength) 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 *flowIpv4OptionsCustomLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowIpv4OptionsCustomLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowIpv4OptionsCustomLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowIpv4OptionsCustomLength) Clone() (FlowIpv4OptionsCustomLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowIpv4OptionsCustomLength() - 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 -} - -// FlowIpv4OptionsCustomLength is length for custom options. -type FlowIpv4OptionsCustomLength interface { - Validation - // msg marshals FlowIpv4OptionsCustomLength to protobuf object *otg.FlowIpv4OptionsCustomLength - // and doesn't set defaults - msg() *otg.FlowIpv4OptionsCustomLength - // setMsg unmarshals FlowIpv4OptionsCustomLength from protobuf object *otg.FlowIpv4OptionsCustomLength - // and doesn't set defaults - setMsg(*otg.FlowIpv4OptionsCustomLength) FlowIpv4OptionsCustomLength - // provides marshal interface - Marshal() marshalFlowIpv4OptionsCustomLength - // provides unmarshal interface - Unmarshal() unMarshalFlowIpv4OptionsCustomLength - // validate validates FlowIpv4OptionsCustomLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowIpv4OptionsCustomLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowIpv4OptionsCustomLengthChoiceEnum, set in FlowIpv4OptionsCustomLength - Choice() FlowIpv4OptionsCustomLengthChoiceEnum - // setChoice assigns FlowIpv4OptionsCustomLengthChoiceEnum provided by user to FlowIpv4OptionsCustomLength - setChoice(value FlowIpv4OptionsCustomLengthChoiceEnum) FlowIpv4OptionsCustomLength - // HasChoice checks if Choice has been set in FlowIpv4OptionsCustomLength - HasChoice() bool - // Auto returns uint32, set in FlowIpv4OptionsCustomLength. - Auto() uint32 - // HasAuto checks if Auto has been set in FlowIpv4OptionsCustomLength - HasAuto() bool - // Value returns uint32, set in FlowIpv4OptionsCustomLength. - Value() uint32 - // SetValue assigns uint32 provided by user to FlowIpv4OptionsCustomLength - SetValue(value uint32) FlowIpv4OptionsCustomLength - // HasValue checks if Value has been set in FlowIpv4OptionsCustomLength - HasValue() bool -} - -type FlowIpv4OptionsCustomLengthChoiceEnum string - -// Enum of Choice on FlowIpv4OptionsCustomLength -var FlowIpv4OptionsCustomLengthChoice = struct { - AUTO FlowIpv4OptionsCustomLengthChoiceEnum - VALUE FlowIpv4OptionsCustomLengthChoiceEnum -}{ - AUTO: FlowIpv4OptionsCustomLengthChoiceEnum("auto"), - VALUE: FlowIpv4OptionsCustomLengthChoiceEnum("value"), -} - -func (obj *flowIpv4OptionsCustomLength) Choice() FlowIpv4OptionsCustomLengthChoiceEnum { - return FlowIpv4OptionsCustomLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// auto or configured value. -// Choice returns a string -func (obj *flowIpv4OptionsCustomLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowIpv4OptionsCustomLength) setChoice(value FlowIpv4OptionsCustomLengthChoiceEnum) FlowIpv4OptionsCustomLength { - intValue, ok := otg.FlowIpv4OptionsCustomLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowIpv4OptionsCustomLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowIpv4OptionsCustomLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Value = nil - obj.obj.Auto = nil - - if value == FlowIpv4OptionsCustomLengthChoice.AUTO { - defaultValue := uint32(0) - obj.obj.Auto = &defaultValue - } - - if value == FlowIpv4OptionsCustomLengthChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - return obj -} - -// The OTG implementation can provide a system generated value for this property. If the OTG is unable to generate a value the default value must be used. -// Auto returns a uint32 -func (obj *flowIpv4OptionsCustomLength) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(FlowIpv4OptionsCustomLengthChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation can provide a system generated value for this property. If the OTG is unable to generate a value the default value must be used. -// Auto returns a uint32 -func (obj *flowIpv4OptionsCustomLength) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Value returns a uint32 -func (obj *flowIpv4OptionsCustomLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(FlowIpv4OptionsCustomLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *flowIpv4OptionsCustomLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the FlowIpv4OptionsCustomLength object -func (obj *flowIpv4OptionsCustomLength) SetValue(value uint32) FlowIpv4OptionsCustomLength { - obj.setChoice(FlowIpv4OptionsCustomLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -func (obj *flowIpv4OptionsCustomLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *flowIpv4OptionsCustomLength) setDefault() { - var choices_set int = 0 - var choice FlowIpv4OptionsCustomLengthChoiceEnum - - if obj.obj.Auto != nil { - choices_set += 1 - choice = FlowIpv4OptionsCustomLengthChoice.AUTO - } - - if obj.obj.Value != nil { - choices_set += 1 - choice = FlowIpv4OptionsCustomLengthChoice.VALUE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowIpv4OptionsCustomLengthChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowIpv4OptionsCustomLength") - } - } else { - intVal := otg.FlowIpv4OptionsCustomLength_Choice_Enum_value[string(choice)] - enumValue := otg.FlowIpv4OptionsCustomLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowGtpExtensionExtensionLengthCounter ***** -type patternFlowGtpExtensionExtensionLengthCounter struct { - validation - obj *otg.PatternFlowGtpExtensionExtensionLengthCounter - marshaller marshalPatternFlowGtpExtensionExtensionLengthCounter - unMarshaller unMarshalPatternFlowGtpExtensionExtensionLengthCounter -} - -func NewPatternFlowGtpExtensionExtensionLengthCounter() PatternFlowGtpExtensionExtensionLengthCounter { - obj := patternFlowGtpExtensionExtensionLengthCounter{obj: &otg.PatternFlowGtpExtensionExtensionLengthCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpExtensionExtensionLengthCounter) msg() *otg.PatternFlowGtpExtensionExtensionLengthCounter { - return obj.obj -} - -func (obj *patternFlowGtpExtensionExtensionLengthCounter) setMsg(msg *otg.PatternFlowGtpExtensionExtensionLengthCounter) PatternFlowGtpExtensionExtensionLengthCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpExtensionExtensionLengthCounter struct { - obj *patternFlowGtpExtensionExtensionLengthCounter -} - -type marshalPatternFlowGtpExtensionExtensionLengthCounter interface { - // ToProto marshals PatternFlowGtpExtensionExtensionLengthCounter to protobuf object *otg.PatternFlowGtpExtensionExtensionLengthCounter - ToProto() (*otg.PatternFlowGtpExtensionExtensionLengthCounter, error) - // ToPbText marshals PatternFlowGtpExtensionExtensionLengthCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpExtensionExtensionLengthCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpExtensionExtensionLengthCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpExtensionExtensionLengthCounter struct { - obj *patternFlowGtpExtensionExtensionLengthCounter -} - -type unMarshalPatternFlowGtpExtensionExtensionLengthCounter interface { - // FromProto unmarshals PatternFlowGtpExtensionExtensionLengthCounter from protobuf object *otg.PatternFlowGtpExtensionExtensionLengthCounter - FromProto(msg *otg.PatternFlowGtpExtensionExtensionLengthCounter) (PatternFlowGtpExtensionExtensionLengthCounter, error) - // FromPbText unmarshals PatternFlowGtpExtensionExtensionLengthCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpExtensionExtensionLengthCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpExtensionExtensionLengthCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpExtensionExtensionLengthCounter) Marshal() marshalPatternFlowGtpExtensionExtensionLengthCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpExtensionExtensionLengthCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpExtensionExtensionLengthCounter) Unmarshal() unMarshalPatternFlowGtpExtensionExtensionLengthCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpExtensionExtensionLengthCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpExtensionExtensionLengthCounter) ToProto() (*otg.PatternFlowGtpExtensionExtensionLengthCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpExtensionExtensionLengthCounter) FromProto(msg *otg.PatternFlowGtpExtensionExtensionLengthCounter) (PatternFlowGtpExtensionExtensionLengthCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpExtensionExtensionLengthCounter) 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 *unMarshalpatternFlowGtpExtensionExtensionLengthCounter) 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 *marshalpatternFlowGtpExtensionExtensionLengthCounter) 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 *unMarshalpatternFlowGtpExtensionExtensionLengthCounter) 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 *marshalpatternFlowGtpExtensionExtensionLengthCounter) 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 *unMarshalpatternFlowGtpExtensionExtensionLengthCounter) 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 *patternFlowGtpExtensionExtensionLengthCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionExtensionLengthCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionExtensionLengthCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpExtensionExtensionLengthCounter) Clone() (PatternFlowGtpExtensionExtensionLengthCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpExtensionExtensionLengthCounter() - 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 -} - -// PatternFlowGtpExtensionExtensionLengthCounter is integer counter pattern -type PatternFlowGtpExtensionExtensionLengthCounter interface { - Validation - // msg marshals PatternFlowGtpExtensionExtensionLengthCounter to protobuf object *otg.PatternFlowGtpExtensionExtensionLengthCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpExtensionExtensionLengthCounter - // setMsg unmarshals PatternFlowGtpExtensionExtensionLengthCounter from protobuf object *otg.PatternFlowGtpExtensionExtensionLengthCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpExtensionExtensionLengthCounter) PatternFlowGtpExtensionExtensionLengthCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpExtensionExtensionLengthCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpExtensionExtensionLengthCounter - // validate validates PatternFlowGtpExtensionExtensionLengthCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpExtensionExtensionLengthCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpExtensionExtensionLengthCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpExtensionExtensionLengthCounter - SetStart(value uint32) PatternFlowGtpExtensionExtensionLengthCounter - // HasStart checks if Start has been set in PatternFlowGtpExtensionExtensionLengthCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpExtensionExtensionLengthCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpExtensionExtensionLengthCounter - SetStep(value uint32) PatternFlowGtpExtensionExtensionLengthCounter - // HasStep checks if Step has been set in PatternFlowGtpExtensionExtensionLengthCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpExtensionExtensionLengthCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpExtensionExtensionLengthCounter - SetCount(value uint32) PatternFlowGtpExtensionExtensionLengthCounter - // HasCount checks if Count has been set in PatternFlowGtpExtensionExtensionLengthCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpExtensionExtensionLengthCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpExtensionExtensionLengthCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpExtensionExtensionLengthCounter object -func (obj *patternFlowGtpExtensionExtensionLengthCounter) SetStart(value uint32) PatternFlowGtpExtensionExtensionLengthCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpExtensionExtensionLengthCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpExtensionExtensionLengthCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpExtensionExtensionLengthCounter object -func (obj *patternFlowGtpExtensionExtensionLengthCounter) SetStep(value uint32) PatternFlowGtpExtensionExtensionLengthCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpExtensionExtensionLengthCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpExtensionExtensionLengthCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpExtensionExtensionLengthCounter object -func (obj *patternFlowGtpExtensionExtensionLengthCounter) SetCount(value uint32) PatternFlowGtpExtensionExtensionLengthCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpExtensionExtensionLengthCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionExtensionLengthCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionExtensionLengthCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionExtensionLengthCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpExtensionExtensionLengthCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpExtensionExtensionLengthMetricTag ***** -type patternFlowGtpExtensionExtensionLengthMetricTag struct { - validation - obj *otg.PatternFlowGtpExtensionExtensionLengthMetricTag - marshaller marshalPatternFlowGtpExtensionExtensionLengthMetricTag - unMarshaller unMarshalPatternFlowGtpExtensionExtensionLengthMetricTag -} - -func NewPatternFlowGtpExtensionExtensionLengthMetricTag() PatternFlowGtpExtensionExtensionLengthMetricTag { - obj := patternFlowGtpExtensionExtensionLengthMetricTag{obj: &otg.PatternFlowGtpExtensionExtensionLengthMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) msg() *otg.PatternFlowGtpExtensionExtensionLengthMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) setMsg(msg *otg.PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpExtensionExtensionLengthMetricTag struct { - obj *patternFlowGtpExtensionExtensionLengthMetricTag -} - -type marshalPatternFlowGtpExtensionExtensionLengthMetricTag interface { - // ToProto marshals PatternFlowGtpExtensionExtensionLengthMetricTag to protobuf object *otg.PatternFlowGtpExtensionExtensionLengthMetricTag - ToProto() (*otg.PatternFlowGtpExtensionExtensionLengthMetricTag, error) - // ToPbText marshals PatternFlowGtpExtensionExtensionLengthMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpExtensionExtensionLengthMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpExtensionExtensionLengthMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpExtensionExtensionLengthMetricTag struct { - obj *patternFlowGtpExtensionExtensionLengthMetricTag -} - -type unMarshalPatternFlowGtpExtensionExtensionLengthMetricTag interface { - // FromProto unmarshals PatternFlowGtpExtensionExtensionLengthMetricTag from protobuf object *otg.PatternFlowGtpExtensionExtensionLengthMetricTag - FromProto(msg *otg.PatternFlowGtpExtensionExtensionLengthMetricTag) (PatternFlowGtpExtensionExtensionLengthMetricTag, error) - // FromPbText unmarshals PatternFlowGtpExtensionExtensionLengthMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpExtensionExtensionLengthMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpExtensionExtensionLengthMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) Marshal() marshalPatternFlowGtpExtensionExtensionLengthMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpExtensionExtensionLengthMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) Unmarshal() unMarshalPatternFlowGtpExtensionExtensionLengthMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpExtensionExtensionLengthMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpExtensionExtensionLengthMetricTag) ToProto() (*otg.PatternFlowGtpExtensionExtensionLengthMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpExtensionExtensionLengthMetricTag) FromProto(msg *otg.PatternFlowGtpExtensionExtensionLengthMetricTag) (PatternFlowGtpExtensionExtensionLengthMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpExtensionExtensionLengthMetricTag) 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 *unMarshalpatternFlowGtpExtensionExtensionLengthMetricTag) 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 *marshalpatternFlowGtpExtensionExtensionLengthMetricTag) 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 *unMarshalpatternFlowGtpExtensionExtensionLengthMetricTag) 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 *marshalpatternFlowGtpExtensionExtensionLengthMetricTag) 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 *unMarshalpatternFlowGtpExtensionExtensionLengthMetricTag) 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 *patternFlowGtpExtensionExtensionLengthMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) Clone() (PatternFlowGtpExtensionExtensionLengthMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpExtensionExtensionLengthMetricTag() - 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 -} - -// PatternFlowGtpExtensionExtensionLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpExtensionExtensionLengthMetricTag interface { - Validation - // msg marshals PatternFlowGtpExtensionExtensionLengthMetricTag to protobuf object *otg.PatternFlowGtpExtensionExtensionLengthMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpExtensionExtensionLengthMetricTag - // setMsg unmarshals PatternFlowGtpExtensionExtensionLengthMetricTag from protobuf object *otg.PatternFlowGtpExtensionExtensionLengthMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpExtensionExtensionLengthMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpExtensionExtensionLengthMetricTag - // validate validates PatternFlowGtpExtensionExtensionLengthMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpExtensionExtensionLengthMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpExtensionExtensionLengthMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpExtensionExtensionLengthMetricTag - SetName(value string) PatternFlowGtpExtensionExtensionLengthMetricTag - // Offset returns uint32, set in PatternFlowGtpExtensionExtensionLengthMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpExtensionExtensionLengthMetricTag - SetOffset(value uint32) PatternFlowGtpExtensionExtensionLengthMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpExtensionExtensionLengthMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpExtensionExtensionLengthMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpExtensionExtensionLengthMetricTag - SetLength(value uint32) PatternFlowGtpExtensionExtensionLengthMetricTag - // HasLength checks if Length has been set in PatternFlowGtpExtensionExtensionLengthMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpExtensionExtensionLengthMetricTag object -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) SetName(value string) PatternFlowGtpExtensionExtensionLengthMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpExtensionExtensionLengthMetricTag object -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) SetOffset(value uint32) PatternFlowGtpExtensionExtensionLengthMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpExtensionExtensionLengthMetricTag object -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) SetLength(value uint32) PatternFlowGtpExtensionExtensionLengthMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpExtensionExtensionLengthMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionExtensionLengthMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpExtensionExtensionLengthMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowGtpExtensionContentsCounter ***** -type patternFlowGtpExtensionContentsCounter struct { - validation - obj *otg.PatternFlowGtpExtensionContentsCounter - marshaller marshalPatternFlowGtpExtensionContentsCounter - unMarshaller unMarshalPatternFlowGtpExtensionContentsCounter -} - -func NewPatternFlowGtpExtensionContentsCounter() PatternFlowGtpExtensionContentsCounter { - obj := patternFlowGtpExtensionContentsCounter{obj: &otg.PatternFlowGtpExtensionContentsCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpExtensionContentsCounter) msg() *otg.PatternFlowGtpExtensionContentsCounter { - return obj.obj -} - -func (obj *patternFlowGtpExtensionContentsCounter) setMsg(msg *otg.PatternFlowGtpExtensionContentsCounter) PatternFlowGtpExtensionContentsCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpExtensionContentsCounter struct { - obj *patternFlowGtpExtensionContentsCounter -} - -type marshalPatternFlowGtpExtensionContentsCounter interface { - // ToProto marshals PatternFlowGtpExtensionContentsCounter to protobuf object *otg.PatternFlowGtpExtensionContentsCounter - ToProto() (*otg.PatternFlowGtpExtensionContentsCounter, error) - // ToPbText marshals PatternFlowGtpExtensionContentsCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpExtensionContentsCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpExtensionContentsCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpExtensionContentsCounter struct { - obj *patternFlowGtpExtensionContentsCounter -} - -type unMarshalPatternFlowGtpExtensionContentsCounter interface { - // FromProto unmarshals PatternFlowGtpExtensionContentsCounter from protobuf object *otg.PatternFlowGtpExtensionContentsCounter - FromProto(msg *otg.PatternFlowGtpExtensionContentsCounter) (PatternFlowGtpExtensionContentsCounter, error) - // FromPbText unmarshals PatternFlowGtpExtensionContentsCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpExtensionContentsCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpExtensionContentsCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpExtensionContentsCounter) Marshal() marshalPatternFlowGtpExtensionContentsCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpExtensionContentsCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpExtensionContentsCounter) Unmarshal() unMarshalPatternFlowGtpExtensionContentsCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpExtensionContentsCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpExtensionContentsCounter) ToProto() (*otg.PatternFlowGtpExtensionContentsCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpExtensionContentsCounter) FromProto(msg *otg.PatternFlowGtpExtensionContentsCounter) (PatternFlowGtpExtensionContentsCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpExtensionContentsCounter) 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 *unMarshalpatternFlowGtpExtensionContentsCounter) 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 *marshalpatternFlowGtpExtensionContentsCounter) 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 *unMarshalpatternFlowGtpExtensionContentsCounter) 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 *marshalpatternFlowGtpExtensionContentsCounter) 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 *unMarshalpatternFlowGtpExtensionContentsCounter) 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 *patternFlowGtpExtensionContentsCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionContentsCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionContentsCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpExtensionContentsCounter) Clone() (PatternFlowGtpExtensionContentsCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpExtensionContentsCounter() - 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 -} - -// PatternFlowGtpExtensionContentsCounter is integer counter pattern -type PatternFlowGtpExtensionContentsCounter interface { - Validation - // msg marshals PatternFlowGtpExtensionContentsCounter to protobuf object *otg.PatternFlowGtpExtensionContentsCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpExtensionContentsCounter - // setMsg unmarshals PatternFlowGtpExtensionContentsCounter from protobuf object *otg.PatternFlowGtpExtensionContentsCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpExtensionContentsCounter) PatternFlowGtpExtensionContentsCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpExtensionContentsCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpExtensionContentsCounter - // validate validates PatternFlowGtpExtensionContentsCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpExtensionContentsCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint64, set in PatternFlowGtpExtensionContentsCounter. - Start() uint64 - // SetStart assigns uint64 provided by user to PatternFlowGtpExtensionContentsCounter - SetStart(value uint64) PatternFlowGtpExtensionContentsCounter - // HasStart checks if Start has been set in PatternFlowGtpExtensionContentsCounter - HasStart() bool - // Step returns uint64, set in PatternFlowGtpExtensionContentsCounter. - Step() uint64 - // SetStep assigns uint64 provided by user to PatternFlowGtpExtensionContentsCounter - SetStep(value uint64) PatternFlowGtpExtensionContentsCounter - // HasStep checks if Step has been set in PatternFlowGtpExtensionContentsCounter - HasStep() bool - // Count returns uint64, set in PatternFlowGtpExtensionContentsCounter. - Count() uint64 - // SetCount assigns uint64 provided by user to PatternFlowGtpExtensionContentsCounter - SetCount(value uint64) PatternFlowGtpExtensionContentsCounter - // HasCount checks if Count has been set in PatternFlowGtpExtensionContentsCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint64 -func (obj *patternFlowGtpExtensionContentsCounter) Start() uint64 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint64 -func (obj *patternFlowGtpExtensionContentsCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint64 value in the PatternFlowGtpExtensionContentsCounter object -func (obj *patternFlowGtpExtensionContentsCounter) SetStart(value uint64) PatternFlowGtpExtensionContentsCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint64 -func (obj *patternFlowGtpExtensionContentsCounter) Step() uint64 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint64 -func (obj *patternFlowGtpExtensionContentsCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint64 value in the PatternFlowGtpExtensionContentsCounter object -func (obj *patternFlowGtpExtensionContentsCounter) SetStep(value uint64) PatternFlowGtpExtensionContentsCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint64 -func (obj *patternFlowGtpExtensionContentsCounter) Count() uint64 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint64 -func (obj *patternFlowGtpExtensionContentsCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint64 value in the PatternFlowGtpExtensionContentsCounter object -func (obj *patternFlowGtpExtensionContentsCounter) SetCount(value uint64) PatternFlowGtpExtensionContentsCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpExtensionContentsCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 281474976710655 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionContentsCounter.Start <= 281474976710655 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 281474976710655 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionContentsCounter.Step <= 281474976710655 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 281474976710655 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionContentsCounter.Count <= 281474976710655 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpExtensionContentsCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpExtensionContentsMetricTag ***** -type patternFlowGtpExtensionContentsMetricTag struct { - validation - obj *otg.PatternFlowGtpExtensionContentsMetricTag - marshaller marshalPatternFlowGtpExtensionContentsMetricTag - unMarshaller unMarshalPatternFlowGtpExtensionContentsMetricTag -} - -func NewPatternFlowGtpExtensionContentsMetricTag() PatternFlowGtpExtensionContentsMetricTag { - obj := patternFlowGtpExtensionContentsMetricTag{obj: &otg.PatternFlowGtpExtensionContentsMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpExtensionContentsMetricTag) msg() *otg.PatternFlowGtpExtensionContentsMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpExtensionContentsMetricTag) setMsg(msg *otg.PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpExtensionContentsMetricTag struct { - obj *patternFlowGtpExtensionContentsMetricTag -} - -type marshalPatternFlowGtpExtensionContentsMetricTag interface { - // ToProto marshals PatternFlowGtpExtensionContentsMetricTag to protobuf object *otg.PatternFlowGtpExtensionContentsMetricTag - ToProto() (*otg.PatternFlowGtpExtensionContentsMetricTag, error) - // ToPbText marshals PatternFlowGtpExtensionContentsMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpExtensionContentsMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpExtensionContentsMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpExtensionContentsMetricTag struct { - obj *patternFlowGtpExtensionContentsMetricTag -} - -type unMarshalPatternFlowGtpExtensionContentsMetricTag interface { - // FromProto unmarshals PatternFlowGtpExtensionContentsMetricTag from protobuf object *otg.PatternFlowGtpExtensionContentsMetricTag - FromProto(msg *otg.PatternFlowGtpExtensionContentsMetricTag) (PatternFlowGtpExtensionContentsMetricTag, error) - // FromPbText unmarshals PatternFlowGtpExtensionContentsMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpExtensionContentsMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpExtensionContentsMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpExtensionContentsMetricTag) Marshal() marshalPatternFlowGtpExtensionContentsMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpExtensionContentsMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpExtensionContentsMetricTag) Unmarshal() unMarshalPatternFlowGtpExtensionContentsMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpExtensionContentsMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpExtensionContentsMetricTag) ToProto() (*otg.PatternFlowGtpExtensionContentsMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpExtensionContentsMetricTag) FromProto(msg *otg.PatternFlowGtpExtensionContentsMetricTag) (PatternFlowGtpExtensionContentsMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpExtensionContentsMetricTag) 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 *unMarshalpatternFlowGtpExtensionContentsMetricTag) 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 *marshalpatternFlowGtpExtensionContentsMetricTag) 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 *unMarshalpatternFlowGtpExtensionContentsMetricTag) 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 *marshalpatternFlowGtpExtensionContentsMetricTag) 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 *unMarshalpatternFlowGtpExtensionContentsMetricTag) 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 *patternFlowGtpExtensionContentsMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionContentsMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionContentsMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpExtensionContentsMetricTag) Clone() (PatternFlowGtpExtensionContentsMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpExtensionContentsMetricTag() - 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 -} - -// PatternFlowGtpExtensionContentsMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpExtensionContentsMetricTag interface { - Validation - // msg marshals PatternFlowGtpExtensionContentsMetricTag to protobuf object *otg.PatternFlowGtpExtensionContentsMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpExtensionContentsMetricTag - // setMsg unmarshals PatternFlowGtpExtensionContentsMetricTag from protobuf object *otg.PatternFlowGtpExtensionContentsMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpExtensionContentsMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpExtensionContentsMetricTag - // validate validates PatternFlowGtpExtensionContentsMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpExtensionContentsMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpExtensionContentsMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpExtensionContentsMetricTag - SetName(value string) PatternFlowGtpExtensionContentsMetricTag - // Offset returns uint64, set in PatternFlowGtpExtensionContentsMetricTag. - Offset() uint64 - // SetOffset assigns uint64 provided by user to PatternFlowGtpExtensionContentsMetricTag - SetOffset(value uint64) PatternFlowGtpExtensionContentsMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpExtensionContentsMetricTag - HasOffset() bool - // Length returns uint64, set in PatternFlowGtpExtensionContentsMetricTag. - Length() uint64 - // SetLength assigns uint64 provided by user to PatternFlowGtpExtensionContentsMetricTag - SetLength(value uint64) PatternFlowGtpExtensionContentsMetricTag - // HasLength checks if Length has been set in PatternFlowGtpExtensionContentsMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpExtensionContentsMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpExtensionContentsMetricTag object -func (obj *patternFlowGtpExtensionContentsMetricTag) SetName(value string) PatternFlowGtpExtensionContentsMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint64 -func (obj *patternFlowGtpExtensionContentsMetricTag) Offset() uint64 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint64 -func (obj *patternFlowGtpExtensionContentsMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint64 value in the PatternFlowGtpExtensionContentsMetricTag object -func (obj *patternFlowGtpExtensionContentsMetricTag) SetOffset(value uint64) PatternFlowGtpExtensionContentsMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint64 -func (obj *patternFlowGtpExtensionContentsMetricTag) Length() uint64 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint64 -func (obj *patternFlowGtpExtensionContentsMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint64 value in the PatternFlowGtpExtensionContentsMetricTag object -func (obj *patternFlowGtpExtensionContentsMetricTag) SetLength(value uint64) PatternFlowGtpExtensionContentsMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpExtensionContentsMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpExtensionContentsMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 47 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionContentsMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 48 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpExtensionContentsMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpExtensionContentsMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(48) - } - -} - -// ***** PatternFlowGtpExtensionNextExtensionHeaderCounter ***** -type patternFlowGtpExtensionNextExtensionHeaderCounter struct { - validation - obj *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter - marshaller marshalPatternFlowGtpExtensionNextExtensionHeaderCounter - unMarshaller unMarshalPatternFlowGtpExtensionNextExtensionHeaderCounter -} - -func NewPatternFlowGtpExtensionNextExtensionHeaderCounter() PatternFlowGtpExtensionNextExtensionHeaderCounter { - obj := patternFlowGtpExtensionNextExtensionHeaderCounter{obj: &otg.PatternFlowGtpExtensionNextExtensionHeaderCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) msg() *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter { - return obj.obj -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) setMsg(msg *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter) PatternFlowGtpExtensionNextExtensionHeaderCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpExtensionNextExtensionHeaderCounter struct { - obj *patternFlowGtpExtensionNextExtensionHeaderCounter -} - -type marshalPatternFlowGtpExtensionNextExtensionHeaderCounter interface { - // ToProto marshals PatternFlowGtpExtensionNextExtensionHeaderCounter to protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter - ToProto() (*otg.PatternFlowGtpExtensionNextExtensionHeaderCounter, error) - // ToPbText marshals PatternFlowGtpExtensionNextExtensionHeaderCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpExtensionNextExtensionHeaderCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpExtensionNextExtensionHeaderCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpExtensionNextExtensionHeaderCounter struct { - obj *patternFlowGtpExtensionNextExtensionHeaderCounter -} - -type unMarshalPatternFlowGtpExtensionNextExtensionHeaderCounter interface { - // FromProto unmarshals PatternFlowGtpExtensionNextExtensionHeaderCounter from protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter - FromProto(msg *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter) (PatternFlowGtpExtensionNextExtensionHeaderCounter, error) - // FromPbText unmarshals PatternFlowGtpExtensionNextExtensionHeaderCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpExtensionNextExtensionHeaderCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpExtensionNextExtensionHeaderCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) Marshal() marshalPatternFlowGtpExtensionNextExtensionHeaderCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpExtensionNextExtensionHeaderCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) Unmarshal() unMarshalPatternFlowGtpExtensionNextExtensionHeaderCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpExtensionNextExtensionHeaderCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpExtensionNextExtensionHeaderCounter) ToProto() (*otg.PatternFlowGtpExtensionNextExtensionHeaderCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpExtensionNextExtensionHeaderCounter) FromProto(msg *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter) (PatternFlowGtpExtensionNextExtensionHeaderCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpExtensionNextExtensionHeaderCounter) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeaderCounter) 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 *marshalpatternFlowGtpExtensionNextExtensionHeaderCounter) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeaderCounter) 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 *marshalpatternFlowGtpExtensionNextExtensionHeaderCounter) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeaderCounter) 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 *patternFlowGtpExtensionNextExtensionHeaderCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) Clone() (PatternFlowGtpExtensionNextExtensionHeaderCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpExtensionNextExtensionHeaderCounter() - 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 -} - -// PatternFlowGtpExtensionNextExtensionHeaderCounter is integer counter pattern -type PatternFlowGtpExtensionNextExtensionHeaderCounter interface { - Validation - // msg marshals PatternFlowGtpExtensionNextExtensionHeaderCounter to protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter - // and doesn't set defaults - msg() *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter - // setMsg unmarshals PatternFlowGtpExtensionNextExtensionHeaderCounter from protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpExtensionNextExtensionHeaderCounter) PatternFlowGtpExtensionNextExtensionHeaderCounter - // provides marshal interface - Marshal() marshalPatternFlowGtpExtensionNextExtensionHeaderCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpExtensionNextExtensionHeaderCounter - // validate validates PatternFlowGtpExtensionNextExtensionHeaderCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpExtensionNextExtensionHeaderCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowGtpExtensionNextExtensionHeaderCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowGtpExtensionNextExtensionHeaderCounter - SetStart(value uint32) PatternFlowGtpExtensionNextExtensionHeaderCounter - // HasStart checks if Start has been set in PatternFlowGtpExtensionNextExtensionHeaderCounter - HasStart() bool - // Step returns uint32, set in PatternFlowGtpExtensionNextExtensionHeaderCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowGtpExtensionNextExtensionHeaderCounter - SetStep(value uint32) PatternFlowGtpExtensionNextExtensionHeaderCounter - // HasStep checks if Step has been set in PatternFlowGtpExtensionNextExtensionHeaderCounter - HasStep() bool - // Count returns uint32, set in PatternFlowGtpExtensionNextExtensionHeaderCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowGtpExtensionNextExtensionHeaderCounter - SetCount(value uint32) PatternFlowGtpExtensionNextExtensionHeaderCounter - // HasCount checks if Count has been set in PatternFlowGtpExtensionNextExtensionHeaderCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowGtpExtensionNextExtensionHeaderCounter object -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) SetStart(value uint32) PatternFlowGtpExtensionNextExtensionHeaderCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowGtpExtensionNextExtensionHeaderCounter object -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) SetStep(value uint32) PatternFlowGtpExtensionNextExtensionHeaderCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowGtpExtensionNextExtensionHeaderCounter object -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) SetCount(value uint32) PatternFlowGtpExtensionNextExtensionHeaderCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionNextExtensionHeaderCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionNextExtensionHeaderCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionNextExtensionHeaderCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowGtpExtensionNextExtensionHeaderMetricTag ***** -type patternFlowGtpExtensionNextExtensionHeaderMetricTag struct { - validation - obj *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag - marshaller marshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag - unMarshaller unMarshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag -} - -func NewPatternFlowGtpExtensionNextExtensionHeaderMetricTag() PatternFlowGtpExtensionNextExtensionHeaderMetricTag { - obj := patternFlowGtpExtensionNextExtensionHeaderMetricTag{obj: &otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) msg() *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag { - return obj.obj -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) setMsg(msg *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag struct { - obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag -} - -type marshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag interface { - // ToProto marshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag to protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag - ToProto() (*otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag, error) - // ToPbText marshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag struct { - obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag -} - -type unMarshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag interface { - // FromProto unmarshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag from protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag - FromProto(msg *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag) (PatternFlowGtpExtensionNextExtensionHeaderMetricTag, error) - // FromPbText unmarshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) Marshal() marshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) Unmarshal() unMarshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) ToProto() (*otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) FromProto(msg *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag) (PatternFlowGtpExtensionNextExtensionHeaderMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) 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 *marshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) 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 *marshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) 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 *patternFlowGtpExtensionNextExtensionHeaderMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) Clone() (PatternFlowGtpExtensionNextExtensionHeaderMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowGtpExtensionNextExtensionHeaderMetricTag() - 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 -} - -// PatternFlowGtpExtensionNextExtensionHeaderMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowGtpExtensionNextExtensionHeaderMetricTag interface { - Validation - // msg marshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag to protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag - // setMsg unmarshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag from protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderMetricTag - // provides marshal interface - Marshal() marshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag - // validate validates PatternFlowGtpExtensionNextExtensionHeaderMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowGtpExtensionNextExtensionHeaderMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowGtpExtensionNextExtensionHeaderMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowGtpExtensionNextExtensionHeaderMetricTag - SetName(value string) PatternFlowGtpExtensionNextExtensionHeaderMetricTag - // Offset returns uint32, set in PatternFlowGtpExtensionNextExtensionHeaderMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowGtpExtensionNextExtensionHeaderMetricTag - SetOffset(value uint32) PatternFlowGtpExtensionNextExtensionHeaderMetricTag - // HasOffset checks if Offset has been set in PatternFlowGtpExtensionNextExtensionHeaderMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowGtpExtensionNextExtensionHeaderMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowGtpExtensionNextExtensionHeaderMetricTag - SetLength(value uint32) PatternFlowGtpExtensionNextExtensionHeaderMetricTag - // HasLength checks if Length has been set in PatternFlowGtpExtensionNextExtensionHeaderMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowGtpExtensionNextExtensionHeaderMetricTag object -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) SetName(value string) PatternFlowGtpExtensionNextExtensionHeaderMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowGtpExtensionNextExtensionHeaderMetricTag object -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) SetOffset(value uint32) PatternFlowGtpExtensionNextExtensionHeaderMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowGtpExtensionNextExtensionHeaderMetricTag object -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) SetLength(value uint32) PatternFlowGtpExtensionNextExtensionHeaderMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpExtensionNextExtensionHeaderMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowGtpExtensionNextExtensionHeaderMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowGtpExtensionNextExtensionHeaderMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowIcmpEchoTypeCounter ***** -type patternFlowIcmpEchoTypeCounter struct { - validation - obj *otg.PatternFlowIcmpEchoTypeCounter - marshaller marshalPatternFlowIcmpEchoTypeCounter - unMarshaller unMarshalPatternFlowIcmpEchoTypeCounter -} - -func NewPatternFlowIcmpEchoTypeCounter() PatternFlowIcmpEchoTypeCounter { - obj := patternFlowIcmpEchoTypeCounter{obj: &otg.PatternFlowIcmpEchoTypeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpEchoTypeCounter) msg() *otg.PatternFlowIcmpEchoTypeCounter { - return obj.obj -} - -func (obj *patternFlowIcmpEchoTypeCounter) setMsg(msg *otg.PatternFlowIcmpEchoTypeCounter) PatternFlowIcmpEchoTypeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpEchoTypeCounter struct { - obj *patternFlowIcmpEchoTypeCounter -} - -type marshalPatternFlowIcmpEchoTypeCounter interface { - // ToProto marshals PatternFlowIcmpEchoTypeCounter to protobuf object *otg.PatternFlowIcmpEchoTypeCounter - ToProto() (*otg.PatternFlowIcmpEchoTypeCounter, error) - // ToPbText marshals PatternFlowIcmpEchoTypeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpEchoTypeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpEchoTypeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpEchoTypeCounter struct { - obj *patternFlowIcmpEchoTypeCounter -} - -type unMarshalPatternFlowIcmpEchoTypeCounter interface { - // FromProto unmarshals PatternFlowIcmpEchoTypeCounter from protobuf object *otg.PatternFlowIcmpEchoTypeCounter - FromProto(msg *otg.PatternFlowIcmpEchoTypeCounter) (PatternFlowIcmpEchoTypeCounter, error) - // FromPbText unmarshals PatternFlowIcmpEchoTypeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpEchoTypeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpEchoTypeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpEchoTypeCounter) Marshal() marshalPatternFlowIcmpEchoTypeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpEchoTypeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpEchoTypeCounter) Unmarshal() unMarshalPatternFlowIcmpEchoTypeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpEchoTypeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpEchoTypeCounter) ToProto() (*otg.PatternFlowIcmpEchoTypeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpEchoTypeCounter) FromProto(msg *otg.PatternFlowIcmpEchoTypeCounter) (PatternFlowIcmpEchoTypeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpEchoTypeCounter) 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 *unMarshalpatternFlowIcmpEchoTypeCounter) 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 *marshalpatternFlowIcmpEchoTypeCounter) 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 *unMarshalpatternFlowIcmpEchoTypeCounter) 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 *marshalpatternFlowIcmpEchoTypeCounter) 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 *unMarshalpatternFlowIcmpEchoTypeCounter) 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 *patternFlowIcmpEchoTypeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoTypeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoTypeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpEchoTypeCounter) Clone() (PatternFlowIcmpEchoTypeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpEchoTypeCounter() - 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 -} - -// PatternFlowIcmpEchoTypeCounter is integer counter pattern -type PatternFlowIcmpEchoTypeCounter interface { - Validation - // msg marshals PatternFlowIcmpEchoTypeCounter to protobuf object *otg.PatternFlowIcmpEchoTypeCounter - // and doesn't set defaults - msg() *otg.PatternFlowIcmpEchoTypeCounter - // setMsg unmarshals PatternFlowIcmpEchoTypeCounter from protobuf object *otg.PatternFlowIcmpEchoTypeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpEchoTypeCounter) PatternFlowIcmpEchoTypeCounter - // provides marshal interface - Marshal() marshalPatternFlowIcmpEchoTypeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpEchoTypeCounter - // validate validates PatternFlowIcmpEchoTypeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpEchoTypeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIcmpEchoTypeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIcmpEchoTypeCounter - SetStart(value uint32) PatternFlowIcmpEchoTypeCounter - // HasStart checks if Start has been set in PatternFlowIcmpEchoTypeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIcmpEchoTypeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIcmpEchoTypeCounter - SetStep(value uint32) PatternFlowIcmpEchoTypeCounter - // HasStep checks if Step has been set in PatternFlowIcmpEchoTypeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIcmpEchoTypeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIcmpEchoTypeCounter - SetCount(value uint32) PatternFlowIcmpEchoTypeCounter - // HasCount checks if Count has been set in PatternFlowIcmpEchoTypeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpEchoTypeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpEchoTypeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIcmpEchoTypeCounter object -func (obj *patternFlowIcmpEchoTypeCounter) SetStart(value uint32) PatternFlowIcmpEchoTypeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpEchoTypeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpEchoTypeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIcmpEchoTypeCounter object -func (obj *patternFlowIcmpEchoTypeCounter) SetStep(value uint32) PatternFlowIcmpEchoTypeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpEchoTypeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpEchoTypeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIcmpEchoTypeCounter object -func (obj *patternFlowIcmpEchoTypeCounter) SetCount(value uint32) PatternFlowIcmpEchoTypeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIcmpEchoTypeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoTypeCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoTypeCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoTypeCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIcmpEchoTypeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(8) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIcmpEchoTypeMetricTag ***** -type patternFlowIcmpEchoTypeMetricTag struct { - validation - obj *otg.PatternFlowIcmpEchoTypeMetricTag - marshaller marshalPatternFlowIcmpEchoTypeMetricTag - unMarshaller unMarshalPatternFlowIcmpEchoTypeMetricTag -} - -func NewPatternFlowIcmpEchoTypeMetricTag() PatternFlowIcmpEchoTypeMetricTag { - obj := patternFlowIcmpEchoTypeMetricTag{obj: &otg.PatternFlowIcmpEchoTypeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpEchoTypeMetricTag) msg() *otg.PatternFlowIcmpEchoTypeMetricTag { - return obj.obj -} - -func (obj *patternFlowIcmpEchoTypeMetricTag) setMsg(msg *otg.PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpEchoTypeMetricTag struct { - obj *patternFlowIcmpEchoTypeMetricTag -} - -type marshalPatternFlowIcmpEchoTypeMetricTag interface { - // ToProto marshals PatternFlowIcmpEchoTypeMetricTag to protobuf object *otg.PatternFlowIcmpEchoTypeMetricTag - ToProto() (*otg.PatternFlowIcmpEchoTypeMetricTag, error) - // ToPbText marshals PatternFlowIcmpEchoTypeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpEchoTypeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpEchoTypeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpEchoTypeMetricTag struct { - obj *patternFlowIcmpEchoTypeMetricTag -} - -type unMarshalPatternFlowIcmpEchoTypeMetricTag interface { - // FromProto unmarshals PatternFlowIcmpEchoTypeMetricTag from protobuf object *otg.PatternFlowIcmpEchoTypeMetricTag - FromProto(msg *otg.PatternFlowIcmpEchoTypeMetricTag) (PatternFlowIcmpEchoTypeMetricTag, error) - // FromPbText unmarshals PatternFlowIcmpEchoTypeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpEchoTypeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpEchoTypeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpEchoTypeMetricTag) Marshal() marshalPatternFlowIcmpEchoTypeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpEchoTypeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpEchoTypeMetricTag) Unmarshal() unMarshalPatternFlowIcmpEchoTypeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpEchoTypeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpEchoTypeMetricTag) ToProto() (*otg.PatternFlowIcmpEchoTypeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpEchoTypeMetricTag) FromProto(msg *otg.PatternFlowIcmpEchoTypeMetricTag) (PatternFlowIcmpEchoTypeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpEchoTypeMetricTag) 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 *unMarshalpatternFlowIcmpEchoTypeMetricTag) 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 *marshalpatternFlowIcmpEchoTypeMetricTag) 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 *unMarshalpatternFlowIcmpEchoTypeMetricTag) 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 *marshalpatternFlowIcmpEchoTypeMetricTag) 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 *unMarshalpatternFlowIcmpEchoTypeMetricTag) 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 *patternFlowIcmpEchoTypeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoTypeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoTypeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpEchoTypeMetricTag) Clone() (PatternFlowIcmpEchoTypeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpEchoTypeMetricTag() - 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 -} - -// PatternFlowIcmpEchoTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIcmpEchoTypeMetricTag interface { - Validation - // msg marshals PatternFlowIcmpEchoTypeMetricTag to protobuf object *otg.PatternFlowIcmpEchoTypeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIcmpEchoTypeMetricTag - // setMsg unmarshals PatternFlowIcmpEchoTypeMetricTag from protobuf object *otg.PatternFlowIcmpEchoTypeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIcmpEchoTypeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpEchoTypeMetricTag - // validate validates PatternFlowIcmpEchoTypeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpEchoTypeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIcmpEchoTypeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIcmpEchoTypeMetricTag - SetName(value string) PatternFlowIcmpEchoTypeMetricTag - // Offset returns uint32, set in PatternFlowIcmpEchoTypeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIcmpEchoTypeMetricTag - SetOffset(value uint32) PatternFlowIcmpEchoTypeMetricTag - // HasOffset checks if Offset has been set in PatternFlowIcmpEchoTypeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIcmpEchoTypeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIcmpEchoTypeMetricTag - SetLength(value uint32) PatternFlowIcmpEchoTypeMetricTag - // HasLength checks if Length has been set in PatternFlowIcmpEchoTypeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIcmpEchoTypeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIcmpEchoTypeMetricTag object -func (obj *patternFlowIcmpEchoTypeMetricTag) SetName(value string) PatternFlowIcmpEchoTypeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpEchoTypeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpEchoTypeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIcmpEchoTypeMetricTag object -func (obj *patternFlowIcmpEchoTypeMetricTag) SetOffset(value uint32) PatternFlowIcmpEchoTypeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpEchoTypeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpEchoTypeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIcmpEchoTypeMetricTag object -func (obj *patternFlowIcmpEchoTypeMetricTag) SetLength(value uint32) PatternFlowIcmpEchoTypeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIcmpEchoTypeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpEchoTypeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoTypeMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIcmpEchoTypeMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIcmpEchoTypeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowIcmpEchoCodeCounter ***** -type patternFlowIcmpEchoCodeCounter struct { - validation - obj *otg.PatternFlowIcmpEchoCodeCounter - marshaller marshalPatternFlowIcmpEchoCodeCounter - unMarshaller unMarshalPatternFlowIcmpEchoCodeCounter -} - -func NewPatternFlowIcmpEchoCodeCounter() PatternFlowIcmpEchoCodeCounter { - obj := patternFlowIcmpEchoCodeCounter{obj: &otg.PatternFlowIcmpEchoCodeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpEchoCodeCounter) msg() *otg.PatternFlowIcmpEchoCodeCounter { - return obj.obj -} - -func (obj *patternFlowIcmpEchoCodeCounter) setMsg(msg *otg.PatternFlowIcmpEchoCodeCounter) PatternFlowIcmpEchoCodeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpEchoCodeCounter struct { - obj *patternFlowIcmpEchoCodeCounter -} - -type marshalPatternFlowIcmpEchoCodeCounter interface { - // ToProto marshals PatternFlowIcmpEchoCodeCounter to protobuf object *otg.PatternFlowIcmpEchoCodeCounter - ToProto() (*otg.PatternFlowIcmpEchoCodeCounter, error) - // ToPbText marshals PatternFlowIcmpEchoCodeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpEchoCodeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpEchoCodeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpEchoCodeCounter struct { - obj *patternFlowIcmpEchoCodeCounter -} - -type unMarshalPatternFlowIcmpEchoCodeCounter interface { - // FromProto unmarshals PatternFlowIcmpEchoCodeCounter from protobuf object *otg.PatternFlowIcmpEchoCodeCounter - FromProto(msg *otg.PatternFlowIcmpEchoCodeCounter) (PatternFlowIcmpEchoCodeCounter, error) - // FromPbText unmarshals PatternFlowIcmpEchoCodeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpEchoCodeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpEchoCodeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpEchoCodeCounter) Marshal() marshalPatternFlowIcmpEchoCodeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpEchoCodeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpEchoCodeCounter) Unmarshal() unMarshalPatternFlowIcmpEchoCodeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpEchoCodeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpEchoCodeCounter) ToProto() (*otg.PatternFlowIcmpEchoCodeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpEchoCodeCounter) FromProto(msg *otg.PatternFlowIcmpEchoCodeCounter) (PatternFlowIcmpEchoCodeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpEchoCodeCounter) 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 *unMarshalpatternFlowIcmpEchoCodeCounter) 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 *marshalpatternFlowIcmpEchoCodeCounter) 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 *unMarshalpatternFlowIcmpEchoCodeCounter) 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 *marshalpatternFlowIcmpEchoCodeCounter) 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 *unMarshalpatternFlowIcmpEchoCodeCounter) 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 *patternFlowIcmpEchoCodeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoCodeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoCodeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpEchoCodeCounter) Clone() (PatternFlowIcmpEchoCodeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpEchoCodeCounter() - 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 -} - -// PatternFlowIcmpEchoCodeCounter is integer counter pattern -type PatternFlowIcmpEchoCodeCounter interface { - Validation - // msg marshals PatternFlowIcmpEchoCodeCounter to protobuf object *otg.PatternFlowIcmpEchoCodeCounter - // and doesn't set defaults - msg() *otg.PatternFlowIcmpEchoCodeCounter - // setMsg unmarshals PatternFlowIcmpEchoCodeCounter from protobuf object *otg.PatternFlowIcmpEchoCodeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpEchoCodeCounter) PatternFlowIcmpEchoCodeCounter - // provides marshal interface - Marshal() marshalPatternFlowIcmpEchoCodeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpEchoCodeCounter - // validate validates PatternFlowIcmpEchoCodeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpEchoCodeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIcmpEchoCodeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIcmpEchoCodeCounter - SetStart(value uint32) PatternFlowIcmpEchoCodeCounter - // HasStart checks if Start has been set in PatternFlowIcmpEchoCodeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIcmpEchoCodeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIcmpEchoCodeCounter - SetStep(value uint32) PatternFlowIcmpEchoCodeCounter - // HasStep checks if Step has been set in PatternFlowIcmpEchoCodeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIcmpEchoCodeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIcmpEchoCodeCounter - SetCount(value uint32) PatternFlowIcmpEchoCodeCounter - // HasCount checks if Count has been set in PatternFlowIcmpEchoCodeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpEchoCodeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpEchoCodeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIcmpEchoCodeCounter object -func (obj *patternFlowIcmpEchoCodeCounter) SetStart(value uint32) PatternFlowIcmpEchoCodeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpEchoCodeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpEchoCodeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIcmpEchoCodeCounter object -func (obj *patternFlowIcmpEchoCodeCounter) SetStep(value uint32) PatternFlowIcmpEchoCodeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpEchoCodeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpEchoCodeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIcmpEchoCodeCounter object -func (obj *patternFlowIcmpEchoCodeCounter) SetCount(value uint32) PatternFlowIcmpEchoCodeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIcmpEchoCodeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoCodeCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoCodeCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoCodeCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIcmpEchoCodeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIcmpEchoCodeMetricTag ***** -type patternFlowIcmpEchoCodeMetricTag struct { - validation - obj *otg.PatternFlowIcmpEchoCodeMetricTag - marshaller marshalPatternFlowIcmpEchoCodeMetricTag - unMarshaller unMarshalPatternFlowIcmpEchoCodeMetricTag -} - -func NewPatternFlowIcmpEchoCodeMetricTag() PatternFlowIcmpEchoCodeMetricTag { - obj := patternFlowIcmpEchoCodeMetricTag{obj: &otg.PatternFlowIcmpEchoCodeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpEchoCodeMetricTag) msg() *otg.PatternFlowIcmpEchoCodeMetricTag { - return obj.obj -} - -func (obj *patternFlowIcmpEchoCodeMetricTag) setMsg(msg *otg.PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpEchoCodeMetricTag struct { - obj *patternFlowIcmpEchoCodeMetricTag -} - -type marshalPatternFlowIcmpEchoCodeMetricTag interface { - // ToProto marshals PatternFlowIcmpEchoCodeMetricTag to protobuf object *otg.PatternFlowIcmpEchoCodeMetricTag - ToProto() (*otg.PatternFlowIcmpEchoCodeMetricTag, error) - // ToPbText marshals PatternFlowIcmpEchoCodeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpEchoCodeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpEchoCodeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpEchoCodeMetricTag struct { - obj *patternFlowIcmpEchoCodeMetricTag -} - -type unMarshalPatternFlowIcmpEchoCodeMetricTag interface { - // FromProto unmarshals PatternFlowIcmpEchoCodeMetricTag from protobuf object *otg.PatternFlowIcmpEchoCodeMetricTag - FromProto(msg *otg.PatternFlowIcmpEchoCodeMetricTag) (PatternFlowIcmpEchoCodeMetricTag, error) - // FromPbText unmarshals PatternFlowIcmpEchoCodeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpEchoCodeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpEchoCodeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpEchoCodeMetricTag) Marshal() marshalPatternFlowIcmpEchoCodeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpEchoCodeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpEchoCodeMetricTag) Unmarshal() unMarshalPatternFlowIcmpEchoCodeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpEchoCodeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpEchoCodeMetricTag) ToProto() (*otg.PatternFlowIcmpEchoCodeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpEchoCodeMetricTag) FromProto(msg *otg.PatternFlowIcmpEchoCodeMetricTag) (PatternFlowIcmpEchoCodeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpEchoCodeMetricTag) 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 *unMarshalpatternFlowIcmpEchoCodeMetricTag) 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 *marshalpatternFlowIcmpEchoCodeMetricTag) 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 *unMarshalpatternFlowIcmpEchoCodeMetricTag) 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 *marshalpatternFlowIcmpEchoCodeMetricTag) 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 *unMarshalpatternFlowIcmpEchoCodeMetricTag) 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 *patternFlowIcmpEchoCodeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoCodeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoCodeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpEchoCodeMetricTag) Clone() (PatternFlowIcmpEchoCodeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpEchoCodeMetricTag() - 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 -} - -// PatternFlowIcmpEchoCodeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIcmpEchoCodeMetricTag interface { - Validation - // msg marshals PatternFlowIcmpEchoCodeMetricTag to protobuf object *otg.PatternFlowIcmpEchoCodeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIcmpEchoCodeMetricTag - // setMsg unmarshals PatternFlowIcmpEchoCodeMetricTag from protobuf object *otg.PatternFlowIcmpEchoCodeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIcmpEchoCodeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpEchoCodeMetricTag - // validate validates PatternFlowIcmpEchoCodeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpEchoCodeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIcmpEchoCodeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIcmpEchoCodeMetricTag - SetName(value string) PatternFlowIcmpEchoCodeMetricTag - // Offset returns uint32, set in PatternFlowIcmpEchoCodeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIcmpEchoCodeMetricTag - SetOffset(value uint32) PatternFlowIcmpEchoCodeMetricTag - // HasOffset checks if Offset has been set in PatternFlowIcmpEchoCodeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIcmpEchoCodeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIcmpEchoCodeMetricTag - SetLength(value uint32) PatternFlowIcmpEchoCodeMetricTag - // HasLength checks if Length has been set in PatternFlowIcmpEchoCodeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIcmpEchoCodeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIcmpEchoCodeMetricTag object -func (obj *patternFlowIcmpEchoCodeMetricTag) SetName(value string) PatternFlowIcmpEchoCodeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpEchoCodeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpEchoCodeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIcmpEchoCodeMetricTag object -func (obj *patternFlowIcmpEchoCodeMetricTag) SetOffset(value uint32) PatternFlowIcmpEchoCodeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpEchoCodeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpEchoCodeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIcmpEchoCodeMetricTag object -func (obj *patternFlowIcmpEchoCodeMetricTag) SetLength(value uint32) PatternFlowIcmpEchoCodeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIcmpEchoCodeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpEchoCodeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoCodeMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIcmpEchoCodeMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIcmpEchoCodeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowIcmpEchoIdentifierCounter ***** -type patternFlowIcmpEchoIdentifierCounter struct { - validation - obj *otg.PatternFlowIcmpEchoIdentifierCounter - marshaller marshalPatternFlowIcmpEchoIdentifierCounter - unMarshaller unMarshalPatternFlowIcmpEchoIdentifierCounter -} - -func NewPatternFlowIcmpEchoIdentifierCounter() PatternFlowIcmpEchoIdentifierCounter { - obj := patternFlowIcmpEchoIdentifierCounter{obj: &otg.PatternFlowIcmpEchoIdentifierCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpEchoIdentifierCounter) msg() *otg.PatternFlowIcmpEchoIdentifierCounter { - return obj.obj -} - -func (obj *patternFlowIcmpEchoIdentifierCounter) setMsg(msg *otg.PatternFlowIcmpEchoIdentifierCounter) PatternFlowIcmpEchoIdentifierCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpEchoIdentifierCounter struct { - obj *patternFlowIcmpEchoIdentifierCounter -} - -type marshalPatternFlowIcmpEchoIdentifierCounter interface { - // ToProto marshals PatternFlowIcmpEchoIdentifierCounter to protobuf object *otg.PatternFlowIcmpEchoIdentifierCounter - ToProto() (*otg.PatternFlowIcmpEchoIdentifierCounter, error) - // ToPbText marshals PatternFlowIcmpEchoIdentifierCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpEchoIdentifierCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpEchoIdentifierCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpEchoIdentifierCounter struct { - obj *patternFlowIcmpEchoIdentifierCounter -} - -type unMarshalPatternFlowIcmpEchoIdentifierCounter interface { - // FromProto unmarshals PatternFlowIcmpEchoIdentifierCounter from protobuf object *otg.PatternFlowIcmpEchoIdentifierCounter - FromProto(msg *otg.PatternFlowIcmpEchoIdentifierCounter) (PatternFlowIcmpEchoIdentifierCounter, error) - // FromPbText unmarshals PatternFlowIcmpEchoIdentifierCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpEchoIdentifierCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpEchoIdentifierCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpEchoIdentifierCounter) Marshal() marshalPatternFlowIcmpEchoIdentifierCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpEchoIdentifierCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpEchoIdentifierCounter) Unmarshal() unMarshalPatternFlowIcmpEchoIdentifierCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpEchoIdentifierCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpEchoIdentifierCounter) ToProto() (*otg.PatternFlowIcmpEchoIdentifierCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpEchoIdentifierCounter) FromProto(msg *otg.PatternFlowIcmpEchoIdentifierCounter) (PatternFlowIcmpEchoIdentifierCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpEchoIdentifierCounter) 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 *unMarshalpatternFlowIcmpEchoIdentifierCounter) 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 *marshalpatternFlowIcmpEchoIdentifierCounter) 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 *unMarshalpatternFlowIcmpEchoIdentifierCounter) 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 *marshalpatternFlowIcmpEchoIdentifierCounter) 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 *unMarshalpatternFlowIcmpEchoIdentifierCounter) 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 *patternFlowIcmpEchoIdentifierCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoIdentifierCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoIdentifierCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpEchoIdentifierCounter) Clone() (PatternFlowIcmpEchoIdentifierCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpEchoIdentifierCounter() - 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 -} - -// PatternFlowIcmpEchoIdentifierCounter is integer counter pattern -type PatternFlowIcmpEchoIdentifierCounter interface { - Validation - // msg marshals PatternFlowIcmpEchoIdentifierCounter to protobuf object *otg.PatternFlowIcmpEchoIdentifierCounter - // and doesn't set defaults - msg() *otg.PatternFlowIcmpEchoIdentifierCounter - // setMsg unmarshals PatternFlowIcmpEchoIdentifierCounter from protobuf object *otg.PatternFlowIcmpEchoIdentifierCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpEchoIdentifierCounter) PatternFlowIcmpEchoIdentifierCounter - // provides marshal interface - Marshal() marshalPatternFlowIcmpEchoIdentifierCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpEchoIdentifierCounter - // validate validates PatternFlowIcmpEchoIdentifierCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpEchoIdentifierCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIcmpEchoIdentifierCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIcmpEchoIdentifierCounter - SetStart(value uint32) PatternFlowIcmpEchoIdentifierCounter - // HasStart checks if Start has been set in PatternFlowIcmpEchoIdentifierCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIcmpEchoIdentifierCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIcmpEchoIdentifierCounter - SetStep(value uint32) PatternFlowIcmpEchoIdentifierCounter - // HasStep checks if Step has been set in PatternFlowIcmpEchoIdentifierCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIcmpEchoIdentifierCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIcmpEchoIdentifierCounter - SetCount(value uint32) PatternFlowIcmpEchoIdentifierCounter - // HasCount checks if Count has been set in PatternFlowIcmpEchoIdentifierCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpEchoIdentifierCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpEchoIdentifierCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIcmpEchoIdentifierCounter object -func (obj *patternFlowIcmpEchoIdentifierCounter) SetStart(value uint32) PatternFlowIcmpEchoIdentifierCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpEchoIdentifierCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpEchoIdentifierCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIcmpEchoIdentifierCounter object -func (obj *patternFlowIcmpEchoIdentifierCounter) SetStep(value uint32) PatternFlowIcmpEchoIdentifierCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpEchoIdentifierCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpEchoIdentifierCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIcmpEchoIdentifierCounter object -func (obj *patternFlowIcmpEchoIdentifierCounter) SetCount(value uint32) PatternFlowIcmpEchoIdentifierCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIcmpEchoIdentifierCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoIdentifierCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoIdentifierCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoIdentifierCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIcmpEchoIdentifierCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIcmpEchoIdentifierMetricTag ***** -type patternFlowIcmpEchoIdentifierMetricTag struct { - validation - obj *otg.PatternFlowIcmpEchoIdentifierMetricTag - marshaller marshalPatternFlowIcmpEchoIdentifierMetricTag - unMarshaller unMarshalPatternFlowIcmpEchoIdentifierMetricTag -} - -func NewPatternFlowIcmpEchoIdentifierMetricTag() PatternFlowIcmpEchoIdentifierMetricTag { - obj := patternFlowIcmpEchoIdentifierMetricTag{obj: &otg.PatternFlowIcmpEchoIdentifierMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpEchoIdentifierMetricTag) msg() *otg.PatternFlowIcmpEchoIdentifierMetricTag { - return obj.obj -} - -func (obj *patternFlowIcmpEchoIdentifierMetricTag) setMsg(msg *otg.PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpEchoIdentifierMetricTag struct { - obj *patternFlowIcmpEchoIdentifierMetricTag -} - -type marshalPatternFlowIcmpEchoIdentifierMetricTag interface { - // ToProto marshals PatternFlowIcmpEchoIdentifierMetricTag to protobuf object *otg.PatternFlowIcmpEchoIdentifierMetricTag - ToProto() (*otg.PatternFlowIcmpEchoIdentifierMetricTag, error) - // ToPbText marshals PatternFlowIcmpEchoIdentifierMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpEchoIdentifierMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpEchoIdentifierMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpEchoIdentifierMetricTag struct { - obj *patternFlowIcmpEchoIdentifierMetricTag -} - -type unMarshalPatternFlowIcmpEchoIdentifierMetricTag interface { - // FromProto unmarshals PatternFlowIcmpEchoIdentifierMetricTag from protobuf object *otg.PatternFlowIcmpEchoIdentifierMetricTag - FromProto(msg *otg.PatternFlowIcmpEchoIdentifierMetricTag) (PatternFlowIcmpEchoIdentifierMetricTag, error) - // FromPbText unmarshals PatternFlowIcmpEchoIdentifierMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpEchoIdentifierMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpEchoIdentifierMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpEchoIdentifierMetricTag) Marshal() marshalPatternFlowIcmpEchoIdentifierMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpEchoIdentifierMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpEchoIdentifierMetricTag) Unmarshal() unMarshalPatternFlowIcmpEchoIdentifierMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpEchoIdentifierMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpEchoIdentifierMetricTag) ToProto() (*otg.PatternFlowIcmpEchoIdentifierMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpEchoIdentifierMetricTag) FromProto(msg *otg.PatternFlowIcmpEchoIdentifierMetricTag) (PatternFlowIcmpEchoIdentifierMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpEchoIdentifierMetricTag) 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 *unMarshalpatternFlowIcmpEchoIdentifierMetricTag) 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 *marshalpatternFlowIcmpEchoIdentifierMetricTag) 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 *unMarshalpatternFlowIcmpEchoIdentifierMetricTag) 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 *marshalpatternFlowIcmpEchoIdentifierMetricTag) 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 *unMarshalpatternFlowIcmpEchoIdentifierMetricTag) 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 *patternFlowIcmpEchoIdentifierMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoIdentifierMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoIdentifierMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpEchoIdentifierMetricTag) Clone() (PatternFlowIcmpEchoIdentifierMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpEchoIdentifierMetricTag() - 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 -} - -// PatternFlowIcmpEchoIdentifierMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIcmpEchoIdentifierMetricTag interface { - Validation - // msg marshals PatternFlowIcmpEchoIdentifierMetricTag to protobuf object *otg.PatternFlowIcmpEchoIdentifierMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIcmpEchoIdentifierMetricTag - // setMsg unmarshals PatternFlowIcmpEchoIdentifierMetricTag from protobuf object *otg.PatternFlowIcmpEchoIdentifierMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIcmpEchoIdentifierMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpEchoIdentifierMetricTag - // validate validates PatternFlowIcmpEchoIdentifierMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpEchoIdentifierMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIcmpEchoIdentifierMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIcmpEchoIdentifierMetricTag - SetName(value string) PatternFlowIcmpEchoIdentifierMetricTag - // Offset returns uint32, set in PatternFlowIcmpEchoIdentifierMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIcmpEchoIdentifierMetricTag - SetOffset(value uint32) PatternFlowIcmpEchoIdentifierMetricTag - // HasOffset checks if Offset has been set in PatternFlowIcmpEchoIdentifierMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIcmpEchoIdentifierMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIcmpEchoIdentifierMetricTag - SetLength(value uint32) PatternFlowIcmpEchoIdentifierMetricTag - // HasLength checks if Length has been set in PatternFlowIcmpEchoIdentifierMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIcmpEchoIdentifierMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIcmpEchoIdentifierMetricTag object -func (obj *patternFlowIcmpEchoIdentifierMetricTag) SetName(value string) PatternFlowIcmpEchoIdentifierMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpEchoIdentifierMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpEchoIdentifierMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIcmpEchoIdentifierMetricTag object -func (obj *patternFlowIcmpEchoIdentifierMetricTag) SetOffset(value uint32) PatternFlowIcmpEchoIdentifierMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpEchoIdentifierMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpEchoIdentifierMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIcmpEchoIdentifierMetricTag object -func (obj *patternFlowIcmpEchoIdentifierMetricTag) SetLength(value uint32) PatternFlowIcmpEchoIdentifierMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIcmpEchoIdentifierMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpEchoIdentifierMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoIdentifierMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIcmpEchoIdentifierMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIcmpEchoIdentifierMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowIcmpEchoSequenceNumberCounter ***** -type patternFlowIcmpEchoSequenceNumberCounter struct { - validation - obj *otg.PatternFlowIcmpEchoSequenceNumberCounter - marshaller marshalPatternFlowIcmpEchoSequenceNumberCounter - unMarshaller unMarshalPatternFlowIcmpEchoSequenceNumberCounter -} - -func NewPatternFlowIcmpEchoSequenceNumberCounter() PatternFlowIcmpEchoSequenceNumberCounter { - obj := patternFlowIcmpEchoSequenceNumberCounter{obj: &otg.PatternFlowIcmpEchoSequenceNumberCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpEchoSequenceNumberCounter) msg() *otg.PatternFlowIcmpEchoSequenceNumberCounter { - return obj.obj -} - -func (obj *patternFlowIcmpEchoSequenceNumberCounter) setMsg(msg *otg.PatternFlowIcmpEchoSequenceNumberCounter) PatternFlowIcmpEchoSequenceNumberCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpEchoSequenceNumberCounter struct { - obj *patternFlowIcmpEchoSequenceNumberCounter -} - -type marshalPatternFlowIcmpEchoSequenceNumberCounter interface { - // ToProto marshals PatternFlowIcmpEchoSequenceNumberCounter to protobuf object *otg.PatternFlowIcmpEchoSequenceNumberCounter - ToProto() (*otg.PatternFlowIcmpEchoSequenceNumberCounter, error) - // ToPbText marshals PatternFlowIcmpEchoSequenceNumberCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpEchoSequenceNumberCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpEchoSequenceNumberCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpEchoSequenceNumberCounter struct { - obj *patternFlowIcmpEchoSequenceNumberCounter -} - -type unMarshalPatternFlowIcmpEchoSequenceNumberCounter interface { - // FromProto unmarshals PatternFlowIcmpEchoSequenceNumberCounter from protobuf object *otg.PatternFlowIcmpEchoSequenceNumberCounter - FromProto(msg *otg.PatternFlowIcmpEchoSequenceNumberCounter) (PatternFlowIcmpEchoSequenceNumberCounter, error) - // FromPbText unmarshals PatternFlowIcmpEchoSequenceNumberCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpEchoSequenceNumberCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpEchoSequenceNumberCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpEchoSequenceNumberCounter) Marshal() marshalPatternFlowIcmpEchoSequenceNumberCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpEchoSequenceNumberCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpEchoSequenceNumberCounter) Unmarshal() unMarshalPatternFlowIcmpEchoSequenceNumberCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpEchoSequenceNumberCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpEchoSequenceNumberCounter) ToProto() (*otg.PatternFlowIcmpEchoSequenceNumberCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpEchoSequenceNumberCounter) FromProto(msg *otg.PatternFlowIcmpEchoSequenceNumberCounter) (PatternFlowIcmpEchoSequenceNumberCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpEchoSequenceNumberCounter) 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 *unMarshalpatternFlowIcmpEchoSequenceNumberCounter) 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 *marshalpatternFlowIcmpEchoSequenceNumberCounter) 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 *unMarshalpatternFlowIcmpEchoSequenceNumberCounter) 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 *marshalpatternFlowIcmpEchoSequenceNumberCounter) 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 *unMarshalpatternFlowIcmpEchoSequenceNumberCounter) 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 *patternFlowIcmpEchoSequenceNumberCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoSequenceNumberCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoSequenceNumberCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpEchoSequenceNumberCounter) Clone() (PatternFlowIcmpEchoSequenceNumberCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpEchoSequenceNumberCounter() - 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 -} - -// PatternFlowIcmpEchoSequenceNumberCounter is integer counter pattern -type PatternFlowIcmpEchoSequenceNumberCounter interface { - Validation - // msg marshals PatternFlowIcmpEchoSequenceNumberCounter to protobuf object *otg.PatternFlowIcmpEchoSequenceNumberCounter - // and doesn't set defaults - msg() *otg.PatternFlowIcmpEchoSequenceNumberCounter - // setMsg unmarshals PatternFlowIcmpEchoSequenceNumberCounter from protobuf object *otg.PatternFlowIcmpEchoSequenceNumberCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpEchoSequenceNumberCounter) PatternFlowIcmpEchoSequenceNumberCounter - // provides marshal interface - Marshal() marshalPatternFlowIcmpEchoSequenceNumberCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpEchoSequenceNumberCounter - // validate validates PatternFlowIcmpEchoSequenceNumberCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpEchoSequenceNumberCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIcmpEchoSequenceNumberCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIcmpEchoSequenceNumberCounter - SetStart(value uint32) PatternFlowIcmpEchoSequenceNumberCounter - // HasStart checks if Start has been set in PatternFlowIcmpEchoSequenceNumberCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIcmpEchoSequenceNumberCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIcmpEchoSequenceNumberCounter - SetStep(value uint32) PatternFlowIcmpEchoSequenceNumberCounter - // HasStep checks if Step has been set in PatternFlowIcmpEchoSequenceNumberCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIcmpEchoSequenceNumberCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIcmpEchoSequenceNumberCounter - SetCount(value uint32) PatternFlowIcmpEchoSequenceNumberCounter - // HasCount checks if Count has been set in PatternFlowIcmpEchoSequenceNumberCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpEchoSequenceNumberCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpEchoSequenceNumberCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIcmpEchoSequenceNumberCounter object -func (obj *patternFlowIcmpEchoSequenceNumberCounter) SetStart(value uint32) PatternFlowIcmpEchoSequenceNumberCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpEchoSequenceNumberCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpEchoSequenceNumberCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIcmpEchoSequenceNumberCounter object -func (obj *patternFlowIcmpEchoSequenceNumberCounter) SetStep(value uint32) PatternFlowIcmpEchoSequenceNumberCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpEchoSequenceNumberCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpEchoSequenceNumberCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIcmpEchoSequenceNumberCounter object -func (obj *patternFlowIcmpEchoSequenceNumberCounter) SetCount(value uint32) PatternFlowIcmpEchoSequenceNumberCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIcmpEchoSequenceNumberCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoSequenceNumberCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoSequenceNumberCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoSequenceNumberCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIcmpEchoSequenceNumberCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIcmpEchoSequenceNumberMetricTag ***** -type patternFlowIcmpEchoSequenceNumberMetricTag struct { - validation - obj *otg.PatternFlowIcmpEchoSequenceNumberMetricTag - marshaller marshalPatternFlowIcmpEchoSequenceNumberMetricTag - unMarshaller unMarshalPatternFlowIcmpEchoSequenceNumberMetricTag -} - -func NewPatternFlowIcmpEchoSequenceNumberMetricTag() PatternFlowIcmpEchoSequenceNumberMetricTag { - obj := patternFlowIcmpEchoSequenceNumberMetricTag{obj: &otg.PatternFlowIcmpEchoSequenceNumberMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) msg() *otg.PatternFlowIcmpEchoSequenceNumberMetricTag { - return obj.obj -} - -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) setMsg(msg *otg.PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpEchoSequenceNumberMetricTag struct { - obj *patternFlowIcmpEchoSequenceNumberMetricTag -} - -type marshalPatternFlowIcmpEchoSequenceNumberMetricTag interface { - // ToProto marshals PatternFlowIcmpEchoSequenceNumberMetricTag to protobuf object *otg.PatternFlowIcmpEchoSequenceNumberMetricTag - ToProto() (*otg.PatternFlowIcmpEchoSequenceNumberMetricTag, error) - // ToPbText marshals PatternFlowIcmpEchoSequenceNumberMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpEchoSequenceNumberMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpEchoSequenceNumberMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpEchoSequenceNumberMetricTag struct { - obj *patternFlowIcmpEchoSequenceNumberMetricTag -} - -type unMarshalPatternFlowIcmpEchoSequenceNumberMetricTag interface { - // FromProto unmarshals PatternFlowIcmpEchoSequenceNumberMetricTag from protobuf object *otg.PatternFlowIcmpEchoSequenceNumberMetricTag - FromProto(msg *otg.PatternFlowIcmpEchoSequenceNumberMetricTag) (PatternFlowIcmpEchoSequenceNumberMetricTag, error) - // FromPbText unmarshals PatternFlowIcmpEchoSequenceNumberMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpEchoSequenceNumberMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpEchoSequenceNumberMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) Marshal() marshalPatternFlowIcmpEchoSequenceNumberMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpEchoSequenceNumberMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) Unmarshal() unMarshalPatternFlowIcmpEchoSequenceNumberMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpEchoSequenceNumberMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpEchoSequenceNumberMetricTag) ToProto() (*otg.PatternFlowIcmpEchoSequenceNumberMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpEchoSequenceNumberMetricTag) FromProto(msg *otg.PatternFlowIcmpEchoSequenceNumberMetricTag) (PatternFlowIcmpEchoSequenceNumberMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpEchoSequenceNumberMetricTag) 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 *unMarshalpatternFlowIcmpEchoSequenceNumberMetricTag) 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 *marshalpatternFlowIcmpEchoSequenceNumberMetricTag) 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 *unMarshalpatternFlowIcmpEchoSequenceNumberMetricTag) 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 *marshalpatternFlowIcmpEchoSequenceNumberMetricTag) 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 *unMarshalpatternFlowIcmpEchoSequenceNumberMetricTag) 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 *patternFlowIcmpEchoSequenceNumberMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) Clone() (PatternFlowIcmpEchoSequenceNumberMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpEchoSequenceNumberMetricTag() - 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 -} - -// PatternFlowIcmpEchoSequenceNumberMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIcmpEchoSequenceNumberMetricTag interface { - Validation - // msg marshals PatternFlowIcmpEchoSequenceNumberMetricTag to protobuf object *otg.PatternFlowIcmpEchoSequenceNumberMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIcmpEchoSequenceNumberMetricTag - // setMsg unmarshals PatternFlowIcmpEchoSequenceNumberMetricTag from protobuf object *otg.PatternFlowIcmpEchoSequenceNumberMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIcmpEchoSequenceNumberMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpEchoSequenceNumberMetricTag - // validate validates PatternFlowIcmpEchoSequenceNumberMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpEchoSequenceNumberMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIcmpEchoSequenceNumberMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIcmpEchoSequenceNumberMetricTag - SetName(value string) PatternFlowIcmpEchoSequenceNumberMetricTag - // Offset returns uint32, set in PatternFlowIcmpEchoSequenceNumberMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIcmpEchoSequenceNumberMetricTag - SetOffset(value uint32) PatternFlowIcmpEchoSequenceNumberMetricTag - // HasOffset checks if Offset has been set in PatternFlowIcmpEchoSequenceNumberMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIcmpEchoSequenceNumberMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIcmpEchoSequenceNumberMetricTag - SetLength(value uint32) PatternFlowIcmpEchoSequenceNumberMetricTag - // HasLength checks if Length has been set in PatternFlowIcmpEchoSequenceNumberMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIcmpEchoSequenceNumberMetricTag object -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) SetName(value string) PatternFlowIcmpEchoSequenceNumberMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIcmpEchoSequenceNumberMetricTag object -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) SetOffset(value uint32) PatternFlowIcmpEchoSequenceNumberMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIcmpEchoSequenceNumberMetricTag object -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) SetLength(value uint32) PatternFlowIcmpEchoSequenceNumberMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpEchoSequenceNumberMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpEchoSequenceNumberMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIcmpEchoSequenceNumberMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowIcmpv6EchoTypeCounter ***** -type patternFlowIcmpv6EchoTypeCounter struct { - validation - obj *otg.PatternFlowIcmpv6EchoTypeCounter - marshaller marshalPatternFlowIcmpv6EchoTypeCounter - unMarshaller unMarshalPatternFlowIcmpv6EchoTypeCounter -} - -func NewPatternFlowIcmpv6EchoTypeCounter() PatternFlowIcmpv6EchoTypeCounter { - obj := patternFlowIcmpv6EchoTypeCounter{obj: &otg.PatternFlowIcmpv6EchoTypeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpv6EchoTypeCounter) msg() *otg.PatternFlowIcmpv6EchoTypeCounter { - return obj.obj -} - -func (obj *patternFlowIcmpv6EchoTypeCounter) setMsg(msg *otg.PatternFlowIcmpv6EchoTypeCounter) PatternFlowIcmpv6EchoTypeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpv6EchoTypeCounter struct { - obj *patternFlowIcmpv6EchoTypeCounter -} - -type marshalPatternFlowIcmpv6EchoTypeCounter interface { - // ToProto marshals PatternFlowIcmpv6EchoTypeCounter to protobuf object *otg.PatternFlowIcmpv6EchoTypeCounter - ToProto() (*otg.PatternFlowIcmpv6EchoTypeCounter, error) - // ToPbText marshals PatternFlowIcmpv6EchoTypeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpv6EchoTypeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpv6EchoTypeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpv6EchoTypeCounter struct { - obj *patternFlowIcmpv6EchoTypeCounter -} - -type unMarshalPatternFlowIcmpv6EchoTypeCounter interface { - // FromProto unmarshals PatternFlowIcmpv6EchoTypeCounter from protobuf object *otg.PatternFlowIcmpv6EchoTypeCounter - FromProto(msg *otg.PatternFlowIcmpv6EchoTypeCounter) (PatternFlowIcmpv6EchoTypeCounter, error) - // FromPbText unmarshals PatternFlowIcmpv6EchoTypeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpv6EchoTypeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpv6EchoTypeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpv6EchoTypeCounter) Marshal() marshalPatternFlowIcmpv6EchoTypeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpv6EchoTypeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpv6EchoTypeCounter) Unmarshal() unMarshalPatternFlowIcmpv6EchoTypeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoTypeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpv6EchoTypeCounter) ToProto() (*otg.PatternFlowIcmpv6EchoTypeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpv6EchoTypeCounter) FromProto(msg *otg.PatternFlowIcmpv6EchoTypeCounter) (PatternFlowIcmpv6EchoTypeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpv6EchoTypeCounter) 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 *unMarshalpatternFlowIcmpv6EchoTypeCounter) 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 *marshalpatternFlowIcmpv6EchoTypeCounter) 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 *unMarshalpatternFlowIcmpv6EchoTypeCounter) 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 *marshalpatternFlowIcmpv6EchoTypeCounter) 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 *unMarshalpatternFlowIcmpv6EchoTypeCounter) 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 *patternFlowIcmpv6EchoTypeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoTypeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoTypeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpv6EchoTypeCounter) Clone() (PatternFlowIcmpv6EchoTypeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpv6EchoTypeCounter() - 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 -} - -// PatternFlowIcmpv6EchoTypeCounter is integer counter pattern -type PatternFlowIcmpv6EchoTypeCounter interface { - Validation - // msg marshals PatternFlowIcmpv6EchoTypeCounter to protobuf object *otg.PatternFlowIcmpv6EchoTypeCounter - // and doesn't set defaults - msg() *otg.PatternFlowIcmpv6EchoTypeCounter - // setMsg unmarshals PatternFlowIcmpv6EchoTypeCounter from protobuf object *otg.PatternFlowIcmpv6EchoTypeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpv6EchoTypeCounter) PatternFlowIcmpv6EchoTypeCounter - // provides marshal interface - Marshal() marshalPatternFlowIcmpv6EchoTypeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpv6EchoTypeCounter - // validate validates PatternFlowIcmpv6EchoTypeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpv6EchoTypeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIcmpv6EchoTypeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIcmpv6EchoTypeCounter - SetStart(value uint32) PatternFlowIcmpv6EchoTypeCounter - // HasStart checks if Start has been set in PatternFlowIcmpv6EchoTypeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIcmpv6EchoTypeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIcmpv6EchoTypeCounter - SetStep(value uint32) PatternFlowIcmpv6EchoTypeCounter - // HasStep checks if Step has been set in PatternFlowIcmpv6EchoTypeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIcmpv6EchoTypeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIcmpv6EchoTypeCounter - SetCount(value uint32) PatternFlowIcmpv6EchoTypeCounter - // HasCount checks if Count has been set in PatternFlowIcmpv6EchoTypeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpv6EchoTypeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpv6EchoTypeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIcmpv6EchoTypeCounter object -func (obj *patternFlowIcmpv6EchoTypeCounter) SetStart(value uint32) PatternFlowIcmpv6EchoTypeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpv6EchoTypeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpv6EchoTypeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIcmpv6EchoTypeCounter object -func (obj *patternFlowIcmpv6EchoTypeCounter) SetStep(value uint32) PatternFlowIcmpv6EchoTypeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpv6EchoTypeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpv6EchoTypeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIcmpv6EchoTypeCounter object -func (obj *patternFlowIcmpv6EchoTypeCounter) SetCount(value uint32) PatternFlowIcmpv6EchoTypeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIcmpv6EchoTypeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoTypeCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoTypeCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoTypeCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIcmpv6EchoTypeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(128) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIcmpv6EchoTypeMetricTag ***** -type patternFlowIcmpv6EchoTypeMetricTag struct { - validation - obj *otg.PatternFlowIcmpv6EchoTypeMetricTag - marshaller marshalPatternFlowIcmpv6EchoTypeMetricTag - unMarshaller unMarshalPatternFlowIcmpv6EchoTypeMetricTag -} - -func NewPatternFlowIcmpv6EchoTypeMetricTag() PatternFlowIcmpv6EchoTypeMetricTag { - obj := patternFlowIcmpv6EchoTypeMetricTag{obj: &otg.PatternFlowIcmpv6EchoTypeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpv6EchoTypeMetricTag) msg() *otg.PatternFlowIcmpv6EchoTypeMetricTag { - return obj.obj -} - -func (obj *patternFlowIcmpv6EchoTypeMetricTag) setMsg(msg *otg.PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpv6EchoTypeMetricTag struct { - obj *patternFlowIcmpv6EchoTypeMetricTag -} - -type marshalPatternFlowIcmpv6EchoTypeMetricTag interface { - // ToProto marshals PatternFlowIcmpv6EchoTypeMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoTypeMetricTag - ToProto() (*otg.PatternFlowIcmpv6EchoTypeMetricTag, error) - // ToPbText marshals PatternFlowIcmpv6EchoTypeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpv6EchoTypeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpv6EchoTypeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpv6EchoTypeMetricTag struct { - obj *patternFlowIcmpv6EchoTypeMetricTag -} - -type unMarshalPatternFlowIcmpv6EchoTypeMetricTag interface { - // FromProto unmarshals PatternFlowIcmpv6EchoTypeMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoTypeMetricTag - FromProto(msg *otg.PatternFlowIcmpv6EchoTypeMetricTag) (PatternFlowIcmpv6EchoTypeMetricTag, error) - // FromPbText unmarshals PatternFlowIcmpv6EchoTypeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpv6EchoTypeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpv6EchoTypeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpv6EchoTypeMetricTag) Marshal() marshalPatternFlowIcmpv6EchoTypeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpv6EchoTypeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpv6EchoTypeMetricTag) Unmarshal() unMarshalPatternFlowIcmpv6EchoTypeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoTypeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpv6EchoTypeMetricTag) ToProto() (*otg.PatternFlowIcmpv6EchoTypeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpv6EchoTypeMetricTag) FromProto(msg *otg.PatternFlowIcmpv6EchoTypeMetricTag) (PatternFlowIcmpv6EchoTypeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpv6EchoTypeMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoTypeMetricTag) 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 *marshalpatternFlowIcmpv6EchoTypeMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoTypeMetricTag) 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 *marshalpatternFlowIcmpv6EchoTypeMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoTypeMetricTag) 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 *patternFlowIcmpv6EchoTypeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoTypeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoTypeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpv6EchoTypeMetricTag) Clone() (PatternFlowIcmpv6EchoTypeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpv6EchoTypeMetricTag() - 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 -} - -// PatternFlowIcmpv6EchoTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIcmpv6EchoTypeMetricTag interface { - Validation - // msg marshals PatternFlowIcmpv6EchoTypeMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoTypeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIcmpv6EchoTypeMetricTag - // setMsg unmarshals PatternFlowIcmpv6EchoTypeMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoTypeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIcmpv6EchoTypeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpv6EchoTypeMetricTag - // validate validates PatternFlowIcmpv6EchoTypeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpv6EchoTypeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIcmpv6EchoTypeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIcmpv6EchoTypeMetricTag - SetName(value string) PatternFlowIcmpv6EchoTypeMetricTag - // Offset returns uint32, set in PatternFlowIcmpv6EchoTypeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIcmpv6EchoTypeMetricTag - SetOffset(value uint32) PatternFlowIcmpv6EchoTypeMetricTag - // HasOffset checks if Offset has been set in PatternFlowIcmpv6EchoTypeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIcmpv6EchoTypeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIcmpv6EchoTypeMetricTag - SetLength(value uint32) PatternFlowIcmpv6EchoTypeMetricTag - // HasLength checks if Length has been set in PatternFlowIcmpv6EchoTypeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIcmpv6EchoTypeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIcmpv6EchoTypeMetricTag object -func (obj *patternFlowIcmpv6EchoTypeMetricTag) SetName(value string) PatternFlowIcmpv6EchoTypeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpv6EchoTypeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpv6EchoTypeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIcmpv6EchoTypeMetricTag object -func (obj *patternFlowIcmpv6EchoTypeMetricTag) SetOffset(value uint32) PatternFlowIcmpv6EchoTypeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpv6EchoTypeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpv6EchoTypeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIcmpv6EchoTypeMetricTag object -func (obj *patternFlowIcmpv6EchoTypeMetricTag) SetLength(value uint32) PatternFlowIcmpv6EchoTypeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIcmpv6EchoTypeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpv6EchoTypeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoTypeMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIcmpv6EchoTypeMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIcmpv6EchoTypeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowIcmpv6EchoCodeCounter ***** -type patternFlowIcmpv6EchoCodeCounter struct { - validation - obj *otg.PatternFlowIcmpv6EchoCodeCounter - marshaller marshalPatternFlowIcmpv6EchoCodeCounter - unMarshaller unMarshalPatternFlowIcmpv6EchoCodeCounter -} - -func NewPatternFlowIcmpv6EchoCodeCounter() PatternFlowIcmpv6EchoCodeCounter { - obj := patternFlowIcmpv6EchoCodeCounter{obj: &otg.PatternFlowIcmpv6EchoCodeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpv6EchoCodeCounter) msg() *otg.PatternFlowIcmpv6EchoCodeCounter { - return obj.obj -} - -func (obj *patternFlowIcmpv6EchoCodeCounter) setMsg(msg *otg.PatternFlowIcmpv6EchoCodeCounter) PatternFlowIcmpv6EchoCodeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpv6EchoCodeCounter struct { - obj *patternFlowIcmpv6EchoCodeCounter -} - -type marshalPatternFlowIcmpv6EchoCodeCounter interface { - // ToProto marshals PatternFlowIcmpv6EchoCodeCounter to protobuf object *otg.PatternFlowIcmpv6EchoCodeCounter - ToProto() (*otg.PatternFlowIcmpv6EchoCodeCounter, error) - // ToPbText marshals PatternFlowIcmpv6EchoCodeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpv6EchoCodeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpv6EchoCodeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpv6EchoCodeCounter struct { - obj *patternFlowIcmpv6EchoCodeCounter -} - -type unMarshalPatternFlowIcmpv6EchoCodeCounter interface { - // FromProto unmarshals PatternFlowIcmpv6EchoCodeCounter from protobuf object *otg.PatternFlowIcmpv6EchoCodeCounter - FromProto(msg *otg.PatternFlowIcmpv6EchoCodeCounter) (PatternFlowIcmpv6EchoCodeCounter, error) - // FromPbText unmarshals PatternFlowIcmpv6EchoCodeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpv6EchoCodeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpv6EchoCodeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpv6EchoCodeCounter) Marshal() marshalPatternFlowIcmpv6EchoCodeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpv6EchoCodeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpv6EchoCodeCounter) Unmarshal() unMarshalPatternFlowIcmpv6EchoCodeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoCodeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpv6EchoCodeCounter) ToProto() (*otg.PatternFlowIcmpv6EchoCodeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpv6EchoCodeCounter) FromProto(msg *otg.PatternFlowIcmpv6EchoCodeCounter) (PatternFlowIcmpv6EchoCodeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpv6EchoCodeCounter) 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 *unMarshalpatternFlowIcmpv6EchoCodeCounter) 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 *marshalpatternFlowIcmpv6EchoCodeCounter) 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 *unMarshalpatternFlowIcmpv6EchoCodeCounter) 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 *marshalpatternFlowIcmpv6EchoCodeCounter) 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 *unMarshalpatternFlowIcmpv6EchoCodeCounter) 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 *patternFlowIcmpv6EchoCodeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoCodeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoCodeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpv6EchoCodeCounter) Clone() (PatternFlowIcmpv6EchoCodeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpv6EchoCodeCounter() - 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 -} - -// PatternFlowIcmpv6EchoCodeCounter is integer counter pattern -type PatternFlowIcmpv6EchoCodeCounter interface { - Validation - // msg marshals PatternFlowIcmpv6EchoCodeCounter to protobuf object *otg.PatternFlowIcmpv6EchoCodeCounter - // and doesn't set defaults - msg() *otg.PatternFlowIcmpv6EchoCodeCounter - // setMsg unmarshals PatternFlowIcmpv6EchoCodeCounter from protobuf object *otg.PatternFlowIcmpv6EchoCodeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpv6EchoCodeCounter) PatternFlowIcmpv6EchoCodeCounter - // provides marshal interface - Marshal() marshalPatternFlowIcmpv6EchoCodeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpv6EchoCodeCounter - // validate validates PatternFlowIcmpv6EchoCodeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpv6EchoCodeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIcmpv6EchoCodeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIcmpv6EchoCodeCounter - SetStart(value uint32) PatternFlowIcmpv6EchoCodeCounter - // HasStart checks if Start has been set in PatternFlowIcmpv6EchoCodeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIcmpv6EchoCodeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIcmpv6EchoCodeCounter - SetStep(value uint32) PatternFlowIcmpv6EchoCodeCounter - // HasStep checks if Step has been set in PatternFlowIcmpv6EchoCodeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIcmpv6EchoCodeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIcmpv6EchoCodeCounter - SetCount(value uint32) PatternFlowIcmpv6EchoCodeCounter - // HasCount checks if Count has been set in PatternFlowIcmpv6EchoCodeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpv6EchoCodeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpv6EchoCodeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIcmpv6EchoCodeCounter object -func (obj *patternFlowIcmpv6EchoCodeCounter) SetStart(value uint32) PatternFlowIcmpv6EchoCodeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpv6EchoCodeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpv6EchoCodeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIcmpv6EchoCodeCounter object -func (obj *patternFlowIcmpv6EchoCodeCounter) SetStep(value uint32) PatternFlowIcmpv6EchoCodeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpv6EchoCodeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpv6EchoCodeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIcmpv6EchoCodeCounter object -func (obj *patternFlowIcmpv6EchoCodeCounter) SetCount(value uint32) PatternFlowIcmpv6EchoCodeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIcmpv6EchoCodeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoCodeCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoCodeCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoCodeCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIcmpv6EchoCodeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIcmpv6EchoCodeMetricTag ***** -type patternFlowIcmpv6EchoCodeMetricTag struct { - validation - obj *otg.PatternFlowIcmpv6EchoCodeMetricTag - marshaller marshalPatternFlowIcmpv6EchoCodeMetricTag - unMarshaller unMarshalPatternFlowIcmpv6EchoCodeMetricTag -} - -func NewPatternFlowIcmpv6EchoCodeMetricTag() PatternFlowIcmpv6EchoCodeMetricTag { - obj := patternFlowIcmpv6EchoCodeMetricTag{obj: &otg.PatternFlowIcmpv6EchoCodeMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpv6EchoCodeMetricTag) msg() *otg.PatternFlowIcmpv6EchoCodeMetricTag { - return obj.obj -} - -func (obj *patternFlowIcmpv6EchoCodeMetricTag) setMsg(msg *otg.PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodeMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpv6EchoCodeMetricTag struct { - obj *patternFlowIcmpv6EchoCodeMetricTag -} - -type marshalPatternFlowIcmpv6EchoCodeMetricTag interface { - // ToProto marshals PatternFlowIcmpv6EchoCodeMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoCodeMetricTag - ToProto() (*otg.PatternFlowIcmpv6EchoCodeMetricTag, error) - // ToPbText marshals PatternFlowIcmpv6EchoCodeMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpv6EchoCodeMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpv6EchoCodeMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpv6EchoCodeMetricTag struct { - obj *patternFlowIcmpv6EchoCodeMetricTag -} - -type unMarshalPatternFlowIcmpv6EchoCodeMetricTag interface { - // FromProto unmarshals PatternFlowIcmpv6EchoCodeMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoCodeMetricTag - FromProto(msg *otg.PatternFlowIcmpv6EchoCodeMetricTag) (PatternFlowIcmpv6EchoCodeMetricTag, error) - // FromPbText unmarshals PatternFlowIcmpv6EchoCodeMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpv6EchoCodeMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpv6EchoCodeMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpv6EchoCodeMetricTag) Marshal() marshalPatternFlowIcmpv6EchoCodeMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpv6EchoCodeMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpv6EchoCodeMetricTag) Unmarshal() unMarshalPatternFlowIcmpv6EchoCodeMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoCodeMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpv6EchoCodeMetricTag) ToProto() (*otg.PatternFlowIcmpv6EchoCodeMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpv6EchoCodeMetricTag) FromProto(msg *otg.PatternFlowIcmpv6EchoCodeMetricTag) (PatternFlowIcmpv6EchoCodeMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpv6EchoCodeMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoCodeMetricTag) 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 *marshalpatternFlowIcmpv6EchoCodeMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoCodeMetricTag) 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 *marshalpatternFlowIcmpv6EchoCodeMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoCodeMetricTag) 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 *patternFlowIcmpv6EchoCodeMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoCodeMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoCodeMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpv6EchoCodeMetricTag) Clone() (PatternFlowIcmpv6EchoCodeMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpv6EchoCodeMetricTag() - 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 -} - -// PatternFlowIcmpv6EchoCodeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIcmpv6EchoCodeMetricTag interface { - Validation - // msg marshals PatternFlowIcmpv6EchoCodeMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoCodeMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIcmpv6EchoCodeMetricTag - // setMsg unmarshals PatternFlowIcmpv6EchoCodeMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoCodeMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodeMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIcmpv6EchoCodeMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpv6EchoCodeMetricTag - // validate validates PatternFlowIcmpv6EchoCodeMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpv6EchoCodeMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIcmpv6EchoCodeMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIcmpv6EchoCodeMetricTag - SetName(value string) PatternFlowIcmpv6EchoCodeMetricTag - // Offset returns uint32, set in PatternFlowIcmpv6EchoCodeMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIcmpv6EchoCodeMetricTag - SetOffset(value uint32) PatternFlowIcmpv6EchoCodeMetricTag - // HasOffset checks if Offset has been set in PatternFlowIcmpv6EchoCodeMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIcmpv6EchoCodeMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIcmpv6EchoCodeMetricTag - SetLength(value uint32) PatternFlowIcmpv6EchoCodeMetricTag - // HasLength checks if Length has been set in PatternFlowIcmpv6EchoCodeMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIcmpv6EchoCodeMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIcmpv6EchoCodeMetricTag object -func (obj *patternFlowIcmpv6EchoCodeMetricTag) SetName(value string) PatternFlowIcmpv6EchoCodeMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpv6EchoCodeMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpv6EchoCodeMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIcmpv6EchoCodeMetricTag object -func (obj *patternFlowIcmpv6EchoCodeMetricTag) SetOffset(value uint32) PatternFlowIcmpv6EchoCodeMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpv6EchoCodeMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpv6EchoCodeMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIcmpv6EchoCodeMetricTag object -func (obj *patternFlowIcmpv6EchoCodeMetricTag) SetLength(value uint32) PatternFlowIcmpv6EchoCodeMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIcmpv6EchoCodeMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpv6EchoCodeMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoCodeMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIcmpv6EchoCodeMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIcmpv6EchoCodeMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(8) - } - -} - -// ***** PatternFlowIcmpv6EchoIdentifierCounter ***** -type patternFlowIcmpv6EchoIdentifierCounter struct { - validation - obj *otg.PatternFlowIcmpv6EchoIdentifierCounter - marshaller marshalPatternFlowIcmpv6EchoIdentifierCounter - unMarshaller unMarshalPatternFlowIcmpv6EchoIdentifierCounter -} - -func NewPatternFlowIcmpv6EchoIdentifierCounter() PatternFlowIcmpv6EchoIdentifierCounter { - obj := patternFlowIcmpv6EchoIdentifierCounter{obj: &otg.PatternFlowIcmpv6EchoIdentifierCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpv6EchoIdentifierCounter) msg() *otg.PatternFlowIcmpv6EchoIdentifierCounter { - return obj.obj -} - -func (obj *patternFlowIcmpv6EchoIdentifierCounter) setMsg(msg *otg.PatternFlowIcmpv6EchoIdentifierCounter) PatternFlowIcmpv6EchoIdentifierCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpv6EchoIdentifierCounter struct { - obj *patternFlowIcmpv6EchoIdentifierCounter -} - -type marshalPatternFlowIcmpv6EchoIdentifierCounter interface { - // ToProto marshals PatternFlowIcmpv6EchoIdentifierCounter to protobuf object *otg.PatternFlowIcmpv6EchoIdentifierCounter - ToProto() (*otg.PatternFlowIcmpv6EchoIdentifierCounter, error) - // ToPbText marshals PatternFlowIcmpv6EchoIdentifierCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpv6EchoIdentifierCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpv6EchoIdentifierCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpv6EchoIdentifierCounter struct { - obj *patternFlowIcmpv6EchoIdentifierCounter -} - -type unMarshalPatternFlowIcmpv6EchoIdentifierCounter interface { - // FromProto unmarshals PatternFlowIcmpv6EchoIdentifierCounter from protobuf object *otg.PatternFlowIcmpv6EchoIdentifierCounter - FromProto(msg *otg.PatternFlowIcmpv6EchoIdentifierCounter) (PatternFlowIcmpv6EchoIdentifierCounter, error) - // FromPbText unmarshals PatternFlowIcmpv6EchoIdentifierCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpv6EchoIdentifierCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpv6EchoIdentifierCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpv6EchoIdentifierCounter) Marshal() marshalPatternFlowIcmpv6EchoIdentifierCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpv6EchoIdentifierCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpv6EchoIdentifierCounter) Unmarshal() unMarshalPatternFlowIcmpv6EchoIdentifierCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoIdentifierCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpv6EchoIdentifierCounter) ToProto() (*otg.PatternFlowIcmpv6EchoIdentifierCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpv6EchoIdentifierCounter) FromProto(msg *otg.PatternFlowIcmpv6EchoIdentifierCounter) (PatternFlowIcmpv6EchoIdentifierCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpv6EchoIdentifierCounter) 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 *unMarshalpatternFlowIcmpv6EchoIdentifierCounter) 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 *marshalpatternFlowIcmpv6EchoIdentifierCounter) 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 *unMarshalpatternFlowIcmpv6EchoIdentifierCounter) 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 *marshalpatternFlowIcmpv6EchoIdentifierCounter) 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 *unMarshalpatternFlowIcmpv6EchoIdentifierCounter) 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 *patternFlowIcmpv6EchoIdentifierCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoIdentifierCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoIdentifierCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpv6EchoIdentifierCounter) Clone() (PatternFlowIcmpv6EchoIdentifierCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpv6EchoIdentifierCounter() - 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 -} - -// PatternFlowIcmpv6EchoIdentifierCounter is integer counter pattern -type PatternFlowIcmpv6EchoIdentifierCounter interface { - Validation - // msg marshals PatternFlowIcmpv6EchoIdentifierCounter to protobuf object *otg.PatternFlowIcmpv6EchoIdentifierCounter - // and doesn't set defaults - msg() *otg.PatternFlowIcmpv6EchoIdentifierCounter - // setMsg unmarshals PatternFlowIcmpv6EchoIdentifierCounter from protobuf object *otg.PatternFlowIcmpv6EchoIdentifierCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpv6EchoIdentifierCounter) PatternFlowIcmpv6EchoIdentifierCounter - // provides marshal interface - Marshal() marshalPatternFlowIcmpv6EchoIdentifierCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpv6EchoIdentifierCounter - // validate validates PatternFlowIcmpv6EchoIdentifierCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpv6EchoIdentifierCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIcmpv6EchoIdentifierCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIcmpv6EchoIdentifierCounter - SetStart(value uint32) PatternFlowIcmpv6EchoIdentifierCounter - // HasStart checks if Start has been set in PatternFlowIcmpv6EchoIdentifierCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIcmpv6EchoIdentifierCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIcmpv6EchoIdentifierCounter - SetStep(value uint32) PatternFlowIcmpv6EchoIdentifierCounter - // HasStep checks if Step has been set in PatternFlowIcmpv6EchoIdentifierCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIcmpv6EchoIdentifierCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIcmpv6EchoIdentifierCounter - SetCount(value uint32) PatternFlowIcmpv6EchoIdentifierCounter - // HasCount checks if Count has been set in PatternFlowIcmpv6EchoIdentifierCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpv6EchoIdentifierCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpv6EchoIdentifierCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIcmpv6EchoIdentifierCounter object -func (obj *patternFlowIcmpv6EchoIdentifierCounter) SetStart(value uint32) PatternFlowIcmpv6EchoIdentifierCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpv6EchoIdentifierCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpv6EchoIdentifierCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIcmpv6EchoIdentifierCounter object -func (obj *patternFlowIcmpv6EchoIdentifierCounter) SetStep(value uint32) PatternFlowIcmpv6EchoIdentifierCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpv6EchoIdentifierCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpv6EchoIdentifierCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIcmpv6EchoIdentifierCounter object -func (obj *patternFlowIcmpv6EchoIdentifierCounter) SetCount(value uint32) PatternFlowIcmpv6EchoIdentifierCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIcmpv6EchoIdentifierCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoIdentifierCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoIdentifierCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoIdentifierCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIcmpv6EchoIdentifierCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIcmpv6EchoIdentifierMetricTag ***** -type patternFlowIcmpv6EchoIdentifierMetricTag struct { - validation - obj *otg.PatternFlowIcmpv6EchoIdentifierMetricTag - marshaller marshalPatternFlowIcmpv6EchoIdentifierMetricTag - unMarshaller unMarshalPatternFlowIcmpv6EchoIdentifierMetricTag -} - -func NewPatternFlowIcmpv6EchoIdentifierMetricTag() PatternFlowIcmpv6EchoIdentifierMetricTag { - obj := patternFlowIcmpv6EchoIdentifierMetricTag{obj: &otg.PatternFlowIcmpv6EchoIdentifierMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) msg() *otg.PatternFlowIcmpv6EchoIdentifierMetricTag { - return obj.obj -} - -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) setMsg(msg *otg.PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpv6EchoIdentifierMetricTag struct { - obj *patternFlowIcmpv6EchoIdentifierMetricTag -} - -type marshalPatternFlowIcmpv6EchoIdentifierMetricTag interface { - // ToProto marshals PatternFlowIcmpv6EchoIdentifierMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoIdentifierMetricTag - ToProto() (*otg.PatternFlowIcmpv6EchoIdentifierMetricTag, error) - // ToPbText marshals PatternFlowIcmpv6EchoIdentifierMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpv6EchoIdentifierMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpv6EchoIdentifierMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpv6EchoIdentifierMetricTag struct { - obj *patternFlowIcmpv6EchoIdentifierMetricTag -} - -type unMarshalPatternFlowIcmpv6EchoIdentifierMetricTag interface { - // FromProto unmarshals PatternFlowIcmpv6EchoIdentifierMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoIdentifierMetricTag - FromProto(msg *otg.PatternFlowIcmpv6EchoIdentifierMetricTag) (PatternFlowIcmpv6EchoIdentifierMetricTag, error) - // FromPbText unmarshals PatternFlowIcmpv6EchoIdentifierMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpv6EchoIdentifierMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpv6EchoIdentifierMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) Marshal() marshalPatternFlowIcmpv6EchoIdentifierMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpv6EchoIdentifierMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) Unmarshal() unMarshalPatternFlowIcmpv6EchoIdentifierMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoIdentifierMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpv6EchoIdentifierMetricTag) ToProto() (*otg.PatternFlowIcmpv6EchoIdentifierMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpv6EchoIdentifierMetricTag) FromProto(msg *otg.PatternFlowIcmpv6EchoIdentifierMetricTag) (PatternFlowIcmpv6EchoIdentifierMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpv6EchoIdentifierMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoIdentifierMetricTag) 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 *marshalpatternFlowIcmpv6EchoIdentifierMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoIdentifierMetricTag) 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 *marshalpatternFlowIcmpv6EchoIdentifierMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoIdentifierMetricTag) 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 *patternFlowIcmpv6EchoIdentifierMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) Clone() (PatternFlowIcmpv6EchoIdentifierMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpv6EchoIdentifierMetricTag() - 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 -} - -// PatternFlowIcmpv6EchoIdentifierMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIcmpv6EchoIdentifierMetricTag interface { - Validation - // msg marshals PatternFlowIcmpv6EchoIdentifierMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoIdentifierMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIcmpv6EchoIdentifierMetricTag - // setMsg unmarshals PatternFlowIcmpv6EchoIdentifierMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoIdentifierMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIcmpv6EchoIdentifierMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpv6EchoIdentifierMetricTag - // validate validates PatternFlowIcmpv6EchoIdentifierMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpv6EchoIdentifierMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIcmpv6EchoIdentifierMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIcmpv6EchoIdentifierMetricTag - SetName(value string) PatternFlowIcmpv6EchoIdentifierMetricTag - // Offset returns uint32, set in PatternFlowIcmpv6EchoIdentifierMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIcmpv6EchoIdentifierMetricTag - SetOffset(value uint32) PatternFlowIcmpv6EchoIdentifierMetricTag - // HasOffset checks if Offset has been set in PatternFlowIcmpv6EchoIdentifierMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIcmpv6EchoIdentifierMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIcmpv6EchoIdentifierMetricTag - SetLength(value uint32) PatternFlowIcmpv6EchoIdentifierMetricTag - // HasLength checks if Length has been set in PatternFlowIcmpv6EchoIdentifierMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIcmpv6EchoIdentifierMetricTag object -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) SetName(value string) PatternFlowIcmpv6EchoIdentifierMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIcmpv6EchoIdentifierMetricTag object -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) SetOffset(value uint32) PatternFlowIcmpv6EchoIdentifierMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIcmpv6EchoIdentifierMetricTag object -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) SetLength(value uint32) PatternFlowIcmpv6EchoIdentifierMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpv6EchoIdentifierMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoIdentifierMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIcmpv6EchoIdentifierMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowIcmpv6EchoSequenceNumberCounter ***** -type patternFlowIcmpv6EchoSequenceNumberCounter struct { - validation - obj *otg.PatternFlowIcmpv6EchoSequenceNumberCounter - marshaller marshalPatternFlowIcmpv6EchoSequenceNumberCounter - unMarshaller unMarshalPatternFlowIcmpv6EchoSequenceNumberCounter -} - -func NewPatternFlowIcmpv6EchoSequenceNumberCounter() PatternFlowIcmpv6EchoSequenceNumberCounter { - obj := patternFlowIcmpv6EchoSequenceNumberCounter{obj: &otg.PatternFlowIcmpv6EchoSequenceNumberCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) msg() *otg.PatternFlowIcmpv6EchoSequenceNumberCounter { - return obj.obj -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) setMsg(msg *otg.PatternFlowIcmpv6EchoSequenceNumberCounter) PatternFlowIcmpv6EchoSequenceNumberCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpv6EchoSequenceNumberCounter struct { - obj *patternFlowIcmpv6EchoSequenceNumberCounter -} - -type marshalPatternFlowIcmpv6EchoSequenceNumberCounter interface { - // ToProto marshals PatternFlowIcmpv6EchoSequenceNumberCounter to protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberCounter - ToProto() (*otg.PatternFlowIcmpv6EchoSequenceNumberCounter, error) - // ToPbText marshals PatternFlowIcmpv6EchoSequenceNumberCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpv6EchoSequenceNumberCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpv6EchoSequenceNumberCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpv6EchoSequenceNumberCounter struct { - obj *patternFlowIcmpv6EchoSequenceNumberCounter -} - -type unMarshalPatternFlowIcmpv6EchoSequenceNumberCounter interface { - // FromProto unmarshals PatternFlowIcmpv6EchoSequenceNumberCounter from protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberCounter - FromProto(msg *otg.PatternFlowIcmpv6EchoSequenceNumberCounter) (PatternFlowIcmpv6EchoSequenceNumberCounter, error) - // FromPbText unmarshals PatternFlowIcmpv6EchoSequenceNumberCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpv6EchoSequenceNumberCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpv6EchoSequenceNumberCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) Marshal() marshalPatternFlowIcmpv6EchoSequenceNumberCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpv6EchoSequenceNumberCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) Unmarshal() unMarshalPatternFlowIcmpv6EchoSequenceNumberCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoSequenceNumberCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpv6EchoSequenceNumberCounter) ToProto() (*otg.PatternFlowIcmpv6EchoSequenceNumberCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpv6EchoSequenceNumberCounter) FromProto(msg *otg.PatternFlowIcmpv6EchoSequenceNumberCounter) (PatternFlowIcmpv6EchoSequenceNumberCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpv6EchoSequenceNumberCounter) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumberCounter) 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 *marshalpatternFlowIcmpv6EchoSequenceNumberCounter) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumberCounter) 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 *marshalpatternFlowIcmpv6EchoSequenceNumberCounter) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumberCounter) 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 *patternFlowIcmpv6EchoSequenceNumberCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) Clone() (PatternFlowIcmpv6EchoSequenceNumberCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpv6EchoSequenceNumberCounter() - 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 -} - -// PatternFlowIcmpv6EchoSequenceNumberCounter is integer counter pattern -type PatternFlowIcmpv6EchoSequenceNumberCounter interface { - Validation - // msg marshals PatternFlowIcmpv6EchoSequenceNumberCounter to protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberCounter - // and doesn't set defaults - msg() *otg.PatternFlowIcmpv6EchoSequenceNumberCounter - // setMsg unmarshals PatternFlowIcmpv6EchoSequenceNumberCounter from protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpv6EchoSequenceNumberCounter) PatternFlowIcmpv6EchoSequenceNumberCounter - // provides marshal interface - Marshal() marshalPatternFlowIcmpv6EchoSequenceNumberCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpv6EchoSequenceNumberCounter - // validate validates PatternFlowIcmpv6EchoSequenceNumberCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpv6EchoSequenceNumberCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIcmpv6EchoSequenceNumberCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIcmpv6EchoSequenceNumberCounter - SetStart(value uint32) PatternFlowIcmpv6EchoSequenceNumberCounter - // HasStart checks if Start has been set in PatternFlowIcmpv6EchoSequenceNumberCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIcmpv6EchoSequenceNumberCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIcmpv6EchoSequenceNumberCounter - SetStep(value uint32) PatternFlowIcmpv6EchoSequenceNumberCounter - // HasStep checks if Step has been set in PatternFlowIcmpv6EchoSequenceNumberCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIcmpv6EchoSequenceNumberCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIcmpv6EchoSequenceNumberCounter - SetCount(value uint32) PatternFlowIcmpv6EchoSequenceNumberCounter - // HasCount checks if Count has been set in PatternFlowIcmpv6EchoSequenceNumberCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIcmpv6EchoSequenceNumberCounter object -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) SetStart(value uint32) PatternFlowIcmpv6EchoSequenceNumberCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIcmpv6EchoSequenceNumberCounter object -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) SetStep(value uint32) PatternFlowIcmpv6EchoSequenceNumberCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIcmpv6EchoSequenceNumberCounter object -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) SetCount(value uint32) PatternFlowIcmpv6EchoSequenceNumberCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoSequenceNumberCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoSequenceNumberCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoSequenceNumberCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIcmpv6EchoSequenceNumberMetricTag ***** -type patternFlowIcmpv6EchoSequenceNumberMetricTag struct { - validation - obj *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag - marshaller marshalPatternFlowIcmpv6EchoSequenceNumberMetricTag - unMarshaller unMarshalPatternFlowIcmpv6EchoSequenceNumberMetricTag -} - -func NewPatternFlowIcmpv6EchoSequenceNumberMetricTag() PatternFlowIcmpv6EchoSequenceNumberMetricTag { - obj := patternFlowIcmpv6EchoSequenceNumberMetricTag{obj: &otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) msg() *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag { - return obj.obj -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) setMsg(msg *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIcmpv6EchoSequenceNumberMetricTag struct { - obj *patternFlowIcmpv6EchoSequenceNumberMetricTag -} - -type marshalPatternFlowIcmpv6EchoSequenceNumberMetricTag interface { - // ToProto marshals PatternFlowIcmpv6EchoSequenceNumberMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag - ToProto() (*otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag, error) - // ToPbText marshals PatternFlowIcmpv6EchoSequenceNumberMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIcmpv6EchoSequenceNumberMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIcmpv6EchoSequenceNumberMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIcmpv6EchoSequenceNumberMetricTag struct { - obj *patternFlowIcmpv6EchoSequenceNumberMetricTag -} - -type unMarshalPatternFlowIcmpv6EchoSequenceNumberMetricTag interface { - // FromProto unmarshals PatternFlowIcmpv6EchoSequenceNumberMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag - FromProto(msg *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag) (PatternFlowIcmpv6EchoSequenceNumberMetricTag, error) - // FromPbText unmarshals PatternFlowIcmpv6EchoSequenceNumberMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIcmpv6EchoSequenceNumberMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIcmpv6EchoSequenceNumberMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) Marshal() marshalPatternFlowIcmpv6EchoSequenceNumberMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIcmpv6EchoSequenceNumberMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) Unmarshal() unMarshalPatternFlowIcmpv6EchoSequenceNumberMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoSequenceNumberMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) ToProto() (*otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) FromProto(msg *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag) (PatternFlowIcmpv6EchoSequenceNumberMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) 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 *marshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) 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 *marshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) 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 *patternFlowIcmpv6EchoSequenceNumberMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) Clone() (PatternFlowIcmpv6EchoSequenceNumberMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIcmpv6EchoSequenceNumberMetricTag() - 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 -} - -// PatternFlowIcmpv6EchoSequenceNumberMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIcmpv6EchoSequenceNumberMetricTag interface { - Validation - // msg marshals PatternFlowIcmpv6EchoSequenceNumberMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag - // setMsg unmarshals PatternFlowIcmpv6EchoSequenceNumberMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIcmpv6EchoSequenceNumberMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIcmpv6EchoSequenceNumberMetricTag - // validate validates PatternFlowIcmpv6EchoSequenceNumberMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIcmpv6EchoSequenceNumberMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIcmpv6EchoSequenceNumberMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIcmpv6EchoSequenceNumberMetricTag - SetName(value string) PatternFlowIcmpv6EchoSequenceNumberMetricTag - // Offset returns uint32, set in PatternFlowIcmpv6EchoSequenceNumberMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIcmpv6EchoSequenceNumberMetricTag - SetOffset(value uint32) PatternFlowIcmpv6EchoSequenceNumberMetricTag - // HasOffset checks if Offset has been set in PatternFlowIcmpv6EchoSequenceNumberMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIcmpv6EchoSequenceNumberMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIcmpv6EchoSequenceNumberMetricTag - SetLength(value uint32) PatternFlowIcmpv6EchoSequenceNumberMetricTag - // HasLength checks if Length has been set in PatternFlowIcmpv6EchoSequenceNumberMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIcmpv6EchoSequenceNumberMetricTag object -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) SetName(value string) PatternFlowIcmpv6EchoSequenceNumberMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIcmpv6EchoSequenceNumberMetricTag object -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) SetOffset(value uint32) PatternFlowIcmpv6EchoSequenceNumberMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIcmpv6EchoSequenceNumberMetricTag object -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) SetLength(value uint32) PatternFlowIcmpv6EchoSequenceNumberMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpv6EchoSequenceNumberMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIcmpv6EchoSequenceNumberMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 16 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIcmpv6EchoSequenceNumberMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(16) - } - -} - -// ***** PatternFlowSnmpv2CPDURequestId ***** -type patternFlowSnmpv2CPDURequestId struct { - validation - obj *otg.PatternFlowSnmpv2CPDURequestId - marshaller marshalPatternFlowSnmpv2CPDURequestId - unMarshaller unMarshalPatternFlowSnmpv2CPDURequestId - incrementHolder PatternFlowSnmpv2CPDURequestIdCounter - decrementHolder PatternFlowSnmpv2CPDURequestIdCounter -} - -func NewPatternFlowSnmpv2CPDURequestId() PatternFlowSnmpv2CPDURequestId { - obj := patternFlowSnmpv2CPDURequestId{obj: &otg.PatternFlowSnmpv2CPDURequestId{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CPDURequestId) msg() *otg.PatternFlowSnmpv2CPDURequestId { - return obj.obj -} - -func (obj *patternFlowSnmpv2CPDURequestId) setMsg(msg *otg.PatternFlowSnmpv2CPDURequestId) PatternFlowSnmpv2CPDURequestId { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CPDURequestId struct { - obj *patternFlowSnmpv2CPDURequestId -} - -type marshalPatternFlowSnmpv2CPDURequestId interface { - // ToProto marshals PatternFlowSnmpv2CPDURequestId to protobuf object *otg.PatternFlowSnmpv2CPDURequestId - ToProto() (*otg.PatternFlowSnmpv2CPDURequestId, error) - // ToPbText marshals PatternFlowSnmpv2CPDURequestId to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CPDURequestId to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CPDURequestId to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CPDURequestId struct { - obj *patternFlowSnmpv2CPDURequestId -} - -type unMarshalPatternFlowSnmpv2CPDURequestId interface { - // FromProto unmarshals PatternFlowSnmpv2CPDURequestId from protobuf object *otg.PatternFlowSnmpv2CPDURequestId - FromProto(msg *otg.PatternFlowSnmpv2CPDURequestId) (PatternFlowSnmpv2CPDURequestId, error) - // FromPbText unmarshals PatternFlowSnmpv2CPDURequestId from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CPDURequestId from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CPDURequestId from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CPDURequestId) Marshal() marshalPatternFlowSnmpv2CPDURequestId { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CPDURequestId{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CPDURequestId) Unmarshal() unMarshalPatternFlowSnmpv2CPDURequestId { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CPDURequestId{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CPDURequestId) ToProto() (*otg.PatternFlowSnmpv2CPDURequestId, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CPDURequestId) FromProto(msg *otg.PatternFlowSnmpv2CPDURequestId) (PatternFlowSnmpv2CPDURequestId, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CPDURequestId) 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 *unMarshalpatternFlowSnmpv2CPDURequestId) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowSnmpv2CPDURequestId) 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 *unMarshalpatternFlowSnmpv2CPDURequestId) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowSnmpv2CPDURequestId) 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 *unMarshalpatternFlowSnmpv2CPDURequestId) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowSnmpv2CPDURequestId) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CPDURequestId) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CPDURequestId) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CPDURequestId) Clone() (PatternFlowSnmpv2CPDURequestId, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CPDURequestId() - 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 -} - -func (obj *patternFlowSnmpv2CPDURequestId) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowSnmpv2CPDURequestId is identifies a particular SNMP request. -// This index is echoed back in the response from the SNMP agent, -// allowing the SNMP manager to match an incoming response to the appropriate request. -// -// - Encoding of this field follows ASN.1 X.690(section 8.3) specification. -// Refer: http://www.itu.int/ITU-T/asn1 -type PatternFlowSnmpv2CPDURequestId interface { - Validation - // msg marshals PatternFlowSnmpv2CPDURequestId to protobuf object *otg.PatternFlowSnmpv2CPDURequestId - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CPDURequestId - // setMsg unmarshals PatternFlowSnmpv2CPDURequestId from protobuf object *otg.PatternFlowSnmpv2CPDURequestId - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CPDURequestId) PatternFlowSnmpv2CPDURequestId - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CPDURequestId - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CPDURequestId - // validate validates PatternFlowSnmpv2CPDURequestId - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CPDURequestId, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowSnmpv2CPDURequestIdChoiceEnum, set in PatternFlowSnmpv2CPDURequestId - Choice() PatternFlowSnmpv2CPDURequestIdChoiceEnum - // setChoice assigns PatternFlowSnmpv2CPDURequestIdChoiceEnum provided by user to PatternFlowSnmpv2CPDURequestId - setChoice(value PatternFlowSnmpv2CPDURequestIdChoiceEnum) PatternFlowSnmpv2CPDURequestId - // HasChoice checks if Choice has been set in PatternFlowSnmpv2CPDURequestId - HasChoice() bool - // Value returns int32, set in PatternFlowSnmpv2CPDURequestId. - Value() int32 - // SetValue assigns int32 provided by user to PatternFlowSnmpv2CPDURequestId - SetValue(value int32) PatternFlowSnmpv2CPDURequestId - // HasValue checks if Value has been set in PatternFlowSnmpv2CPDURequestId - HasValue() bool - // Values returns []int32, set in PatternFlowSnmpv2CPDURequestId. - Values() []int32 - // SetValues assigns []int32 provided by user to PatternFlowSnmpv2CPDURequestId - SetValues(value []int32) PatternFlowSnmpv2CPDURequestId - // Increment returns PatternFlowSnmpv2CPDURequestIdCounter, set in PatternFlowSnmpv2CPDURequestId. - Increment() PatternFlowSnmpv2CPDURequestIdCounter - // SetIncrement assigns PatternFlowSnmpv2CPDURequestIdCounter provided by user to PatternFlowSnmpv2CPDURequestId. - SetIncrement(value PatternFlowSnmpv2CPDURequestIdCounter) PatternFlowSnmpv2CPDURequestId - // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CPDURequestId - HasIncrement() bool - // Decrement returns PatternFlowSnmpv2CPDURequestIdCounter, set in PatternFlowSnmpv2CPDURequestId. - Decrement() PatternFlowSnmpv2CPDURequestIdCounter - // SetDecrement assigns PatternFlowSnmpv2CPDURequestIdCounter provided by user to PatternFlowSnmpv2CPDURequestId. - SetDecrement(value PatternFlowSnmpv2CPDURequestIdCounter) PatternFlowSnmpv2CPDURequestId - // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CPDURequestId - HasDecrement() bool - setNil() -} - -type PatternFlowSnmpv2CPDURequestIdChoiceEnum string - -// Enum of Choice on PatternFlowSnmpv2CPDURequestId -var PatternFlowSnmpv2CPDURequestIdChoice = struct { - VALUE PatternFlowSnmpv2CPDURequestIdChoiceEnum - VALUES PatternFlowSnmpv2CPDURequestIdChoiceEnum - INCREMENT PatternFlowSnmpv2CPDURequestIdChoiceEnum - DECREMENT PatternFlowSnmpv2CPDURequestIdChoiceEnum -}{ - VALUE: PatternFlowSnmpv2CPDURequestIdChoiceEnum("value"), - VALUES: PatternFlowSnmpv2CPDURequestIdChoiceEnum("values"), - INCREMENT: PatternFlowSnmpv2CPDURequestIdChoiceEnum("increment"), - DECREMENT: PatternFlowSnmpv2CPDURequestIdChoiceEnum("decrement"), -} - -func (obj *patternFlowSnmpv2CPDURequestId) Choice() PatternFlowSnmpv2CPDURequestIdChoiceEnum { - return PatternFlowSnmpv2CPDURequestIdChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowSnmpv2CPDURequestId) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowSnmpv2CPDURequestId) setChoice(value PatternFlowSnmpv2CPDURequestIdChoiceEnum) PatternFlowSnmpv2CPDURequestId { - intValue, ok := otg.PatternFlowSnmpv2CPDURequestId_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowSnmpv2CPDURequestIdChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowSnmpv2CPDURequestId_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowSnmpv2CPDURequestIdChoice.VALUE { - defaultValue := int32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowSnmpv2CPDURequestIdChoice.VALUES { - defaultValue := []int32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowSnmpv2CPDURequestIdChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowSnmpv2CPDURequestIdCounter().msg() - } - - if value == PatternFlowSnmpv2CPDURequestIdChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowSnmpv2CPDURequestIdCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a int32 -func (obj *patternFlowSnmpv2CPDURequestId) Value() int32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a int32 -func (obj *patternFlowSnmpv2CPDURequestId) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the int32 value in the PatternFlowSnmpv2CPDURequestId object -func (obj *patternFlowSnmpv2CPDURequestId) SetValue(value int32) PatternFlowSnmpv2CPDURequestId { - obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []int32 -func (obj *patternFlowSnmpv2CPDURequestId) Values() []int32 { - if obj.obj.Values == nil { - obj.SetValues([]int32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []int32 value in the PatternFlowSnmpv2CPDURequestId object -func (obj *patternFlowSnmpv2CPDURequestId) SetValues(value []int32) PatternFlowSnmpv2CPDURequestId { - obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]int32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CPDURequestIdCounter -func (obj *patternFlowSnmpv2CPDURequestId) Increment() PatternFlowSnmpv2CPDURequestIdCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowSnmpv2CPDURequestIdCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CPDURequestIdCounter -func (obj *patternFlowSnmpv2CPDURequestId) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowSnmpv2CPDURequestIdCounter value in the PatternFlowSnmpv2CPDURequestId object -func (obj *patternFlowSnmpv2CPDURequestId) SetIncrement(value PatternFlowSnmpv2CPDURequestIdCounter) PatternFlowSnmpv2CPDURequestId { - obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CPDURequestIdCounter -func (obj *patternFlowSnmpv2CPDURequestId) Decrement() PatternFlowSnmpv2CPDURequestIdCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowSnmpv2CPDURequestIdCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CPDURequestIdCounter -func (obj *patternFlowSnmpv2CPDURequestId) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowSnmpv2CPDURequestIdCounter value in the PatternFlowSnmpv2CPDURequestId object -func (obj *patternFlowSnmpv2CPDURequestId) SetDecrement(value PatternFlowSnmpv2CPDURequestIdCounter) PatternFlowSnmpv2CPDURequestId { - obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowSnmpv2CPDURequestId) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowSnmpv2CPDURequestId) setDefault() { - var choices_set int = 0 - var choice PatternFlowSnmpv2CPDURequestIdChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CPDURequestIdChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowSnmpv2CPDURequestIdChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CPDURequestIdChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CPDURequestIdChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CPDURequestId") - } - } else { - intVal := otg.PatternFlowSnmpv2CPDURequestId_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowSnmpv2CPDURequestId_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowSnmpv2CPDUErrorIndex ***** -type patternFlowSnmpv2CPDUErrorIndex struct { - validation - obj *otg.PatternFlowSnmpv2CPDUErrorIndex - marshaller marshalPatternFlowSnmpv2CPDUErrorIndex - unMarshaller unMarshalPatternFlowSnmpv2CPDUErrorIndex - incrementHolder PatternFlowSnmpv2CPDUErrorIndexCounter - decrementHolder PatternFlowSnmpv2CPDUErrorIndexCounter -} - -func NewPatternFlowSnmpv2CPDUErrorIndex() PatternFlowSnmpv2CPDUErrorIndex { - obj := patternFlowSnmpv2CPDUErrorIndex{obj: &otg.PatternFlowSnmpv2CPDUErrorIndex{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CPDUErrorIndex) msg() *otg.PatternFlowSnmpv2CPDUErrorIndex { - return obj.obj -} - -func (obj *patternFlowSnmpv2CPDUErrorIndex) setMsg(msg *otg.PatternFlowSnmpv2CPDUErrorIndex) PatternFlowSnmpv2CPDUErrorIndex { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CPDUErrorIndex struct { - obj *patternFlowSnmpv2CPDUErrorIndex -} - -type marshalPatternFlowSnmpv2CPDUErrorIndex interface { - // ToProto marshals PatternFlowSnmpv2CPDUErrorIndex to protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndex - ToProto() (*otg.PatternFlowSnmpv2CPDUErrorIndex, error) - // ToPbText marshals PatternFlowSnmpv2CPDUErrorIndex to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CPDUErrorIndex to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CPDUErrorIndex to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CPDUErrorIndex struct { - obj *patternFlowSnmpv2CPDUErrorIndex -} - -type unMarshalPatternFlowSnmpv2CPDUErrorIndex interface { - // FromProto unmarshals PatternFlowSnmpv2CPDUErrorIndex from protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndex - FromProto(msg *otg.PatternFlowSnmpv2CPDUErrorIndex) (PatternFlowSnmpv2CPDUErrorIndex, error) - // FromPbText unmarshals PatternFlowSnmpv2CPDUErrorIndex from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CPDUErrorIndex from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CPDUErrorIndex from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CPDUErrorIndex) Marshal() marshalPatternFlowSnmpv2CPDUErrorIndex { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CPDUErrorIndex{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CPDUErrorIndex) Unmarshal() unMarshalPatternFlowSnmpv2CPDUErrorIndex { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CPDUErrorIndex{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CPDUErrorIndex) ToProto() (*otg.PatternFlowSnmpv2CPDUErrorIndex, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CPDUErrorIndex) FromProto(msg *otg.PatternFlowSnmpv2CPDUErrorIndex) (PatternFlowSnmpv2CPDUErrorIndex, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CPDUErrorIndex) 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 *unMarshalpatternFlowSnmpv2CPDUErrorIndex) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowSnmpv2CPDUErrorIndex) 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 *unMarshalpatternFlowSnmpv2CPDUErrorIndex) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowSnmpv2CPDUErrorIndex) 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 *unMarshalpatternFlowSnmpv2CPDUErrorIndex) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowSnmpv2CPDUErrorIndex) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CPDUErrorIndex) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CPDUErrorIndex) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CPDUErrorIndex) Clone() (PatternFlowSnmpv2CPDUErrorIndex, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CPDUErrorIndex() - 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 -} - -func (obj *patternFlowSnmpv2CPDUErrorIndex) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowSnmpv2CPDUErrorIndex is when Error Status is non-zero, this field contains a pointer that specifies which object generated the error. Always zero in a request. -type PatternFlowSnmpv2CPDUErrorIndex interface { - Validation - // msg marshals PatternFlowSnmpv2CPDUErrorIndex to protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndex - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CPDUErrorIndex - // setMsg unmarshals PatternFlowSnmpv2CPDUErrorIndex from protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndex - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CPDUErrorIndex) PatternFlowSnmpv2CPDUErrorIndex - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CPDUErrorIndex - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CPDUErrorIndex - // validate validates PatternFlowSnmpv2CPDUErrorIndex - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CPDUErrorIndex, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowSnmpv2CPDUErrorIndexChoiceEnum, set in PatternFlowSnmpv2CPDUErrorIndex - Choice() PatternFlowSnmpv2CPDUErrorIndexChoiceEnum - // setChoice assigns PatternFlowSnmpv2CPDUErrorIndexChoiceEnum provided by user to PatternFlowSnmpv2CPDUErrorIndex - setChoice(value PatternFlowSnmpv2CPDUErrorIndexChoiceEnum) PatternFlowSnmpv2CPDUErrorIndex - // HasChoice checks if Choice has been set in PatternFlowSnmpv2CPDUErrorIndex - HasChoice() bool - // Value returns uint32, set in PatternFlowSnmpv2CPDUErrorIndex. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowSnmpv2CPDUErrorIndex - SetValue(value uint32) PatternFlowSnmpv2CPDUErrorIndex - // HasValue checks if Value has been set in PatternFlowSnmpv2CPDUErrorIndex - HasValue() bool - // Values returns []uint32, set in PatternFlowSnmpv2CPDUErrorIndex. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowSnmpv2CPDUErrorIndex - SetValues(value []uint32) PatternFlowSnmpv2CPDUErrorIndex - // Increment returns PatternFlowSnmpv2CPDUErrorIndexCounter, set in PatternFlowSnmpv2CPDUErrorIndex. - Increment() PatternFlowSnmpv2CPDUErrorIndexCounter - // SetIncrement assigns PatternFlowSnmpv2CPDUErrorIndexCounter provided by user to PatternFlowSnmpv2CPDUErrorIndex. - SetIncrement(value PatternFlowSnmpv2CPDUErrorIndexCounter) PatternFlowSnmpv2CPDUErrorIndex - // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CPDUErrorIndex - HasIncrement() bool - // Decrement returns PatternFlowSnmpv2CPDUErrorIndexCounter, set in PatternFlowSnmpv2CPDUErrorIndex. - Decrement() PatternFlowSnmpv2CPDUErrorIndexCounter - // SetDecrement assigns PatternFlowSnmpv2CPDUErrorIndexCounter provided by user to PatternFlowSnmpv2CPDUErrorIndex. - SetDecrement(value PatternFlowSnmpv2CPDUErrorIndexCounter) PatternFlowSnmpv2CPDUErrorIndex - // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CPDUErrorIndex - HasDecrement() bool - setNil() -} - -type PatternFlowSnmpv2CPDUErrorIndexChoiceEnum string - -// Enum of Choice on PatternFlowSnmpv2CPDUErrorIndex -var PatternFlowSnmpv2CPDUErrorIndexChoice = struct { - VALUE PatternFlowSnmpv2CPDUErrorIndexChoiceEnum - VALUES PatternFlowSnmpv2CPDUErrorIndexChoiceEnum - INCREMENT PatternFlowSnmpv2CPDUErrorIndexChoiceEnum - DECREMENT PatternFlowSnmpv2CPDUErrorIndexChoiceEnum -}{ - VALUE: PatternFlowSnmpv2CPDUErrorIndexChoiceEnum("value"), - VALUES: PatternFlowSnmpv2CPDUErrorIndexChoiceEnum("values"), - INCREMENT: PatternFlowSnmpv2CPDUErrorIndexChoiceEnum("increment"), - DECREMENT: PatternFlowSnmpv2CPDUErrorIndexChoiceEnum("decrement"), -} - -func (obj *patternFlowSnmpv2CPDUErrorIndex) Choice() PatternFlowSnmpv2CPDUErrorIndexChoiceEnum { - return PatternFlowSnmpv2CPDUErrorIndexChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowSnmpv2CPDUErrorIndex) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowSnmpv2CPDUErrorIndex) setChoice(value PatternFlowSnmpv2CPDUErrorIndexChoiceEnum) PatternFlowSnmpv2CPDUErrorIndex { - intValue, ok := otg.PatternFlowSnmpv2CPDUErrorIndex_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowSnmpv2CPDUErrorIndexChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowSnmpv2CPDUErrorIndex_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowSnmpv2CPDUErrorIndexChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowSnmpv2CPDUErrorIndexChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowSnmpv2CPDUErrorIndexChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowSnmpv2CPDUErrorIndexCounter().msg() - } - - if value == PatternFlowSnmpv2CPDUErrorIndexChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowSnmpv2CPDUErrorIndexCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowSnmpv2CPDUErrorIndex) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowSnmpv2CPDUErrorIndex) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowSnmpv2CPDUErrorIndex object -func (obj *patternFlowSnmpv2CPDUErrorIndex) SetValue(value uint32) PatternFlowSnmpv2CPDUErrorIndex { - obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowSnmpv2CPDUErrorIndex) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowSnmpv2CPDUErrorIndex object -func (obj *patternFlowSnmpv2CPDUErrorIndex) SetValues(value []uint32) PatternFlowSnmpv2CPDUErrorIndex { - obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CPDUErrorIndexCounter -func (obj *patternFlowSnmpv2CPDUErrorIndex) Increment() PatternFlowSnmpv2CPDUErrorIndexCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowSnmpv2CPDUErrorIndexCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CPDUErrorIndexCounter -func (obj *patternFlowSnmpv2CPDUErrorIndex) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowSnmpv2CPDUErrorIndexCounter value in the PatternFlowSnmpv2CPDUErrorIndex object -func (obj *patternFlowSnmpv2CPDUErrorIndex) SetIncrement(value PatternFlowSnmpv2CPDUErrorIndexCounter) PatternFlowSnmpv2CPDUErrorIndex { - obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CPDUErrorIndexCounter -func (obj *patternFlowSnmpv2CPDUErrorIndex) Decrement() PatternFlowSnmpv2CPDUErrorIndexCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowSnmpv2CPDUErrorIndexCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CPDUErrorIndexCounter -func (obj *patternFlowSnmpv2CPDUErrorIndex) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowSnmpv2CPDUErrorIndexCounter value in the PatternFlowSnmpv2CPDUErrorIndex object -func (obj *patternFlowSnmpv2CPDUErrorIndex) SetDecrement(value PatternFlowSnmpv2CPDUErrorIndexCounter) PatternFlowSnmpv2CPDUErrorIndex { - obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowSnmpv2CPDUErrorIndex) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowSnmpv2CPDUErrorIndex) setDefault() { - var choices_set int = 0 - var choice PatternFlowSnmpv2CPDUErrorIndexChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CPDUErrorIndexChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowSnmpv2CPDUErrorIndexChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CPDUErrorIndexChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CPDUErrorIndexChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CPDUErrorIndex") - } - } else { - intVal := otg.PatternFlowSnmpv2CPDUErrorIndex_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowSnmpv2CPDUErrorIndex_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowSnmpv2CVariableBinding ***** -type flowSnmpv2CVariableBinding struct { - validation - obj *otg.FlowSnmpv2CVariableBinding - marshaller marshalFlowSnmpv2CVariableBinding - unMarshaller unMarshalFlowSnmpv2CVariableBinding - valueHolder FlowSnmpv2CVariableBindingValue -} - -func NewFlowSnmpv2CVariableBinding() FlowSnmpv2CVariableBinding { - obj := flowSnmpv2CVariableBinding{obj: &otg.FlowSnmpv2CVariableBinding{}} - obj.setDefault() - return &obj -} - -func (obj *flowSnmpv2CVariableBinding) msg() *otg.FlowSnmpv2CVariableBinding { - return obj.obj -} - -func (obj *flowSnmpv2CVariableBinding) setMsg(msg *otg.FlowSnmpv2CVariableBinding) FlowSnmpv2CVariableBinding { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowSnmpv2CVariableBinding struct { - obj *flowSnmpv2CVariableBinding -} - -type marshalFlowSnmpv2CVariableBinding interface { - // ToProto marshals FlowSnmpv2CVariableBinding to protobuf object *otg.FlowSnmpv2CVariableBinding - ToProto() (*otg.FlowSnmpv2CVariableBinding, error) - // ToPbText marshals FlowSnmpv2CVariableBinding to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowSnmpv2CVariableBinding to YAML text - ToYaml() (string, error) - // ToJson marshals FlowSnmpv2CVariableBinding to JSON text - ToJson() (string, error) -} - -type unMarshalflowSnmpv2CVariableBinding struct { - obj *flowSnmpv2CVariableBinding -} - -type unMarshalFlowSnmpv2CVariableBinding interface { - // FromProto unmarshals FlowSnmpv2CVariableBinding from protobuf object *otg.FlowSnmpv2CVariableBinding - FromProto(msg *otg.FlowSnmpv2CVariableBinding) (FlowSnmpv2CVariableBinding, error) - // FromPbText unmarshals FlowSnmpv2CVariableBinding from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowSnmpv2CVariableBinding from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowSnmpv2CVariableBinding from JSON text - FromJson(value string) error -} - -func (obj *flowSnmpv2CVariableBinding) Marshal() marshalFlowSnmpv2CVariableBinding { - if obj.marshaller == nil { - obj.marshaller = &marshalflowSnmpv2CVariableBinding{obj: obj} - } - return obj.marshaller -} - -func (obj *flowSnmpv2CVariableBinding) Unmarshal() unMarshalFlowSnmpv2CVariableBinding { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowSnmpv2CVariableBinding{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowSnmpv2CVariableBinding) ToProto() (*otg.FlowSnmpv2CVariableBinding, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowSnmpv2CVariableBinding) FromProto(msg *otg.FlowSnmpv2CVariableBinding) (FlowSnmpv2CVariableBinding, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowSnmpv2CVariableBinding) 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 *unMarshalflowSnmpv2CVariableBinding) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowSnmpv2CVariableBinding) 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 *unMarshalflowSnmpv2CVariableBinding) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowSnmpv2CVariableBinding) 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 *unMarshalflowSnmpv2CVariableBinding) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowSnmpv2CVariableBinding) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowSnmpv2CVariableBinding) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowSnmpv2CVariableBinding) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowSnmpv2CVariableBinding) Clone() (FlowSnmpv2CVariableBinding, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowSnmpv2CVariableBinding() - 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 -} - -func (obj *flowSnmpv2CVariableBinding) setNil() { - obj.valueHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowSnmpv2CVariableBinding is a Sequence of two fields, an object_identifier and the value for/from that object_identifier. -type FlowSnmpv2CVariableBinding interface { - Validation - // msg marshals FlowSnmpv2CVariableBinding to protobuf object *otg.FlowSnmpv2CVariableBinding - // and doesn't set defaults - msg() *otg.FlowSnmpv2CVariableBinding - // setMsg unmarshals FlowSnmpv2CVariableBinding from protobuf object *otg.FlowSnmpv2CVariableBinding - // and doesn't set defaults - setMsg(*otg.FlowSnmpv2CVariableBinding) FlowSnmpv2CVariableBinding - // provides marshal interface - Marshal() marshalFlowSnmpv2CVariableBinding - // provides unmarshal interface - Unmarshal() unMarshalFlowSnmpv2CVariableBinding - // validate validates FlowSnmpv2CVariableBinding - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowSnmpv2CVariableBinding, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ObjectIdentifier returns string, set in FlowSnmpv2CVariableBinding. - ObjectIdentifier() string - // SetObjectIdentifier assigns string provided by user to FlowSnmpv2CVariableBinding - SetObjectIdentifier(value string) FlowSnmpv2CVariableBinding - // HasObjectIdentifier checks if ObjectIdentifier has been set in FlowSnmpv2CVariableBinding - HasObjectIdentifier() bool - // Value returns FlowSnmpv2CVariableBindingValue, set in FlowSnmpv2CVariableBinding. - Value() FlowSnmpv2CVariableBindingValue - // SetValue assigns FlowSnmpv2CVariableBindingValue provided by user to FlowSnmpv2CVariableBinding. - SetValue(value FlowSnmpv2CVariableBindingValue) FlowSnmpv2CVariableBinding - // HasValue checks if Value has been set in FlowSnmpv2CVariableBinding - HasValue() bool - setNil() -} - -// The Object Identifier points to a particular parameter in the SNMP agent. -// - Encoding of this field follows RFC2578(section 3.5) and ASN.1 X.690(section 8.1.3.6) specification. -// Refer: http://www.itu.int/ITU-T/asn1/ -// - According to BER, the first two numbers of any OID (x.y) are encoded as one value using the formula (40*x)+y. -// Example, the first two numbers of an SNMP OID 1.3... are encoded as 43 or 0x2B, because (40*1)+3 = 43. -// - After the first two numbers are encoded, the subsequent numbers in the OID are each encoded as a byte. -// - However, a special rule is required for large numbers because one byte can only represent a number from 0-127. -// - The rule for large numbers states that only the lower 7 bits in the byte are used for holding the value (0-127). -// - The highest order bit(8th) is used as a flag to indicate that this number spans more than one byte. Therefore, any number over 127 must be encoded using more than one byte. -// - Example, the number 2680 in the OID '1.3.6.1.4.1.2680.1.2.7.3.2.0' cannot be encoded using a single byte. -// According to this rule, the number 2680 must be encoded as 0x94 0x78. -// Since the most significant bit is set in the first byte (0x94), it indicates that number spans to the next byte. -// Since the most significant bit is not set in the next byte (0x78), it indicates that the number ends at the second byte. -// The value is derived by appending 7 bits from each of the concatenated bytes i.e (0x14 *128^1) + (0x78 * 128^0) = 2680. -// ObjectIdentifier returns a string -func (obj *flowSnmpv2CVariableBinding) ObjectIdentifier() string { - - return *obj.obj.ObjectIdentifier - -} - -// The Object Identifier points to a particular parameter in the SNMP agent. -// - Encoding of this field follows RFC2578(section 3.5) and ASN.1 X.690(section 8.1.3.6) specification. -// Refer: http://www.itu.int/ITU-T/asn1/ -// - According to BER, the first two numbers of any OID (x.y) are encoded as one value using the formula (40*x)+y. -// Example, the first two numbers of an SNMP OID 1.3... are encoded as 43 or 0x2B, because (40*1)+3 = 43. -// - After the first two numbers are encoded, the subsequent numbers in the OID are each encoded as a byte. -// - However, a special rule is required for large numbers because one byte can only represent a number from 0-127. -// - The rule for large numbers states that only the lower 7 bits in the byte are used for holding the value (0-127). -// - The highest order bit(8th) is used as a flag to indicate that this number spans more than one byte. Therefore, any number over 127 must be encoded using more than one byte. -// - Example, the number 2680 in the OID '1.3.6.1.4.1.2680.1.2.7.3.2.0' cannot be encoded using a single byte. -// According to this rule, the number 2680 must be encoded as 0x94 0x78. -// Since the most significant bit is set in the first byte (0x94), it indicates that number spans to the next byte. -// Since the most significant bit is not set in the next byte (0x78), it indicates that the number ends at the second byte. -// The value is derived by appending 7 bits from each of the concatenated bytes i.e (0x14 *128^1) + (0x78 * 128^0) = 2680. -// ObjectIdentifier returns a string -func (obj *flowSnmpv2CVariableBinding) HasObjectIdentifier() bool { - return obj.obj.ObjectIdentifier != nil -} - -// The Object Identifier points to a particular parameter in the SNMP agent. -// - Encoding of this field follows RFC2578(section 3.5) and ASN.1 X.690(section 8.1.3.6) specification. -// Refer: http://www.itu.int/ITU-T/asn1/ -// - According to BER, the first two numbers of any OID (x.y) are encoded as one value using the formula (40*x)+y. -// Example, the first two numbers of an SNMP OID 1.3... are encoded as 43 or 0x2B, because (40*1)+3 = 43. -// - After the first two numbers are encoded, the subsequent numbers in the OID are each encoded as a byte. -// - However, a special rule is required for large numbers because one byte can only represent a number from 0-127. -// - The rule for large numbers states that only the lower 7 bits in the byte are used for holding the value (0-127). -// - The highest order bit(8th) is used as a flag to indicate that this number spans more than one byte. Therefore, any number over 127 must be encoded using more than one byte. -// - Example, the number 2680 in the OID '1.3.6.1.4.1.2680.1.2.7.3.2.0' cannot be encoded using a single byte. -// According to this rule, the number 2680 must be encoded as 0x94 0x78. -// Since the most significant bit is set in the first byte (0x94), it indicates that number spans to the next byte. -// Since the most significant bit is not set in the next byte (0x78), it indicates that the number ends at the second byte. -// The value is derived by appending 7 bits from each of the concatenated bytes i.e (0x14 *128^1) + (0x78 * 128^0) = 2680. -// SetObjectIdentifier sets the string value in the FlowSnmpv2CVariableBinding object -func (obj *flowSnmpv2CVariableBinding) SetObjectIdentifier(value string) FlowSnmpv2CVariableBinding { - - obj.obj.ObjectIdentifier = &value - return obj -} - -// description is TBD -// Value returns a FlowSnmpv2CVariableBindingValue -func (obj *flowSnmpv2CVariableBinding) Value() FlowSnmpv2CVariableBindingValue { - if obj.obj.Value == nil { - obj.obj.Value = NewFlowSnmpv2CVariableBindingValue().msg() - } - if obj.valueHolder == nil { - obj.valueHolder = &flowSnmpv2CVariableBindingValue{obj: obj.obj.Value} - } - return obj.valueHolder -} - -// description is TBD -// Value returns a FlowSnmpv2CVariableBindingValue -func (obj *flowSnmpv2CVariableBinding) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the FlowSnmpv2CVariableBindingValue value in the FlowSnmpv2CVariableBinding object -func (obj *flowSnmpv2CVariableBinding) SetValue(value FlowSnmpv2CVariableBindingValue) FlowSnmpv2CVariableBinding { - - obj.valueHolder = nil - obj.obj.Value = value.msg() - - return obj -} - -func (obj *flowSnmpv2CVariableBinding) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.ObjectIdentifier != nil { - - err := obj.validateOid(obj.ObjectIdentifier()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on FlowSnmpv2CVariableBinding.ObjectIdentifier")) - } - - } - - if obj.obj.Value != nil { - - obj.Value().validateObj(vObj, set_default) - } - -} - -func (obj *flowSnmpv2CVariableBinding) setDefault() { - if obj.obj.ObjectIdentifier == nil { - obj.SetObjectIdentifier("0.1") - } - -} - -// ***** PatternFlowSnmpv2CBulkPDURequestId ***** -type patternFlowSnmpv2CBulkPDURequestId struct { - validation - obj *otg.PatternFlowSnmpv2CBulkPDURequestId - marshaller marshalPatternFlowSnmpv2CBulkPDURequestId - unMarshaller unMarshalPatternFlowSnmpv2CBulkPDURequestId - incrementHolder PatternFlowSnmpv2CBulkPDURequestIdCounter - decrementHolder PatternFlowSnmpv2CBulkPDURequestIdCounter -} - -func NewPatternFlowSnmpv2CBulkPDURequestId() PatternFlowSnmpv2CBulkPDURequestId { - obj := patternFlowSnmpv2CBulkPDURequestId{obj: &otg.PatternFlowSnmpv2CBulkPDURequestId{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CBulkPDURequestId) msg() *otg.PatternFlowSnmpv2CBulkPDURequestId { - return obj.obj -} - -func (obj *patternFlowSnmpv2CBulkPDURequestId) setMsg(msg *otg.PatternFlowSnmpv2CBulkPDURequestId) PatternFlowSnmpv2CBulkPDURequestId { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CBulkPDURequestId struct { - obj *patternFlowSnmpv2CBulkPDURequestId -} - -type marshalPatternFlowSnmpv2CBulkPDURequestId interface { - // ToProto marshals PatternFlowSnmpv2CBulkPDURequestId to protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestId - ToProto() (*otg.PatternFlowSnmpv2CBulkPDURequestId, error) - // ToPbText marshals PatternFlowSnmpv2CBulkPDURequestId to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CBulkPDURequestId to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CBulkPDURequestId to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CBulkPDURequestId struct { - obj *patternFlowSnmpv2CBulkPDURequestId -} - -type unMarshalPatternFlowSnmpv2CBulkPDURequestId interface { - // FromProto unmarshals PatternFlowSnmpv2CBulkPDURequestId from protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestId - FromProto(msg *otg.PatternFlowSnmpv2CBulkPDURequestId) (PatternFlowSnmpv2CBulkPDURequestId, error) - // FromPbText unmarshals PatternFlowSnmpv2CBulkPDURequestId from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CBulkPDURequestId from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CBulkPDURequestId from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CBulkPDURequestId) Marshal() marshalPatternFlowSnmpv2CBulkPDURequestId { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CBulkPDURequestId{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CBulkPDURequestId) Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDURequestId { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CBulkPDURequestId{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CBulkPDURequestId) ToProto() (*otg.PatternFlowSnmpv2CBulkPDURequestId, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CBulkPDURequestId) FromProto(msg *otg.PatternFlowSnmpv2CBulkPDURequestId) (PatternFlowSnmpv2CBulkPDURequestId, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CBulkPDURequestId) 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 *unMarshalpatternFlowSnmpv2CBulkPDURequestId) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowSnmpv2CBulkPDURequestId) 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 *unMarshalpatternFlowSnmpv2CBulkPDURequestId) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowSnmpv2CBulkPDURequestId) 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 *unMarshalpatternFlowSnmpv2CBulkPDURequestId) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowSnmpv2CBulkPDURequestId) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CBulkPDURequestId) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CBulkPDURequestId) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CBulkPDURequestId) Clone() (PatternFlowSnmpv2CBulkPDURequestId, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CBulkPDURequestId() - 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 -} - -func (obj *patternFlowSnmpv2CBulkPDURequestId) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowSnmpv2CBulkPDURequestId is identifies a particular SNMP request. -// This index is echoed back in the response from the SNMP agent, -// allowing the SNMP manager to match an incoming response to the appropriate request. -// -// - Encoding of this field follows ASN.1 X.690(section 8.3) specification. -// Refer: http://www.itu.int/ITU-T/asn1 -type PatternFlowSnmpv2CBulkPDURequestId interface { - Validation - // msg marshals PatternFlowSnmpv2CBulkPDURequestId to protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestId - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CBulkPDURequestId - // setMsg unmarshals PatternFlowSnmpv2CBulkPDURequestId from protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestId - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CBulkPDURequestId) PatternFlowSnmpv2CBulkPDURequestId - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CBulkPDURequestId - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDURequestId - // validate validates PatternFlowSnmpv2CBulkPDURequestId - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CBulkPDURequestId, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum, set in PatternFlowSnmpv2CBulkPDURequestId - Choice() PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum - // setChoice assigns PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum provided by user to PatternFlowSnmpv2CBulkPDURequestId - setChoice(value PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum) PatternFlowSnmpv2CBulkPDURequestId - // HasChoice checks if Choice has been set in PatternFlowSnmpv2CBulkPDURequestId - HasChoice() bool - // Value returns int32, set in PatternFlowSnmpv2CBulkPDURequestId. - Value() int32 - // SetValue assigns int32 provided by user to PatternFlowSnmpv2CBulkPDURequestId - SetValue(value int32) PatternFlowSnmpv2CBulkPDURequestId - // HasValue checks if Value has been set in PatternFlowSnmpv2CBulkPDURequestId - HasValue() bool - // Values returns []int32, set in PatternFlowSnmpv2CBulkPDURequestId. - Values() []int32 - // SetValues assigns []int32 provided by user to PatternFlowSnmpv2CBulkPDURequestId - SetValues(value []int32) PatternFlowSnmpv2CBulkPDURequestId - // Increment returns PatternFlowSnmpv2CBulkPDURequestIdCounter, set in PatternFlowSnmpv2CBulkPDURequestId. - Increment() PatternFlowSnmpv2CBulkPDURequestIdCounter - // SetIncrement assigns PatternFlowSnmpv2CBulkPDURequestIdCounter provided by user to PatternFlowSnmpv2CBulkPDURequestId. - SetIncrement(value PatternFlowSnmpv2CBulkPDURequestIdCounter) PatternFlowSnmpv2CBulkPDURequestId - // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CBulkPDURequestId - HasIncrement() bool - // Decrement returns PatternFlowSnmpv2CBulkPDURequestIdCounter, set in PatternFlowSnmpv2CBulkPDURequestId. - Decrement() PatternFlowSnmpv2CBulkPDURequestIdCounter - // SetDecrement assigns PatternFlowSnmpv2CBulkPDURequestIdCounter provided by user to PatternFlowSnmpv2CBulkPDURequestId. - SetDecrement(value PatternFlowSnmpv2CBulkPDURequestIdCounter) PatternFlowSnmpv2CBulkPDURequestId - // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CBulkPDURequestId - HasDecrement() bool - setNil() -} - -type PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum string - -// Enum of Choice on PatternFlowSnmpv2CBulkPDURequestId -var PatternFlowSnmpv2CBulkPDURequestIdChoice = struct { - VALUE PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum - VALUES PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum - INCREMENT PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum - DECREMENT PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum -}{ - VALUE: PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum("value"), - VALUES: PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum("values"), - INCREMENT: PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum("increment"), - DECREMENT: PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum("decrement"), -} - -func (obj *patternFlowSnmpv2CBulkPDURequestId) Choice() PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum { - return PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowSnmpv2CBulkPDURequestId) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowSnmpv2CBulkPDURequestId) setChoice(value PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum) PatternFlowSnmpv2CBulkPDURequestId { - intValue, ok := otg.PatternFlowSnmpv2CBulkPDURequestId_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowSnmpv2CBulkPDURequestId_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUE { - defaultValue := int32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUES { - defaultValue := []int32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowSnmpv2CBulkPDURequestIdChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowSnmpv2CBulkPDURequestIdCounter().msg() - } - - if value == PatternFlowSnmpv2CBulkPDURequestIdChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowSnmpv2CBulkPDURequestIdCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a int32 -func (obj *patternFlowSnmpv2CBulkPDURequestId) Value() int32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a int32 -func (obj *patternFlowSnmpv2CBulkPDURequestId) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the int32 value in the PatternFlowSnmpv2CBulkPDURequestId object -func (obj *patternFlowSnmpv2CBulkPDURequestId) SetValue(value int32) PatternFlowSnmpv2CBulkPDURequestId { - obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []int32 -func (obj *patternFlowSnmpv2CBulkPDURequestId) Values() []int32 { - if obj.obj.Values == nil { - obj.SetValues([]int32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []int32 value in the PatternFlowSnmpv2CBulkPDURequestId object -func (obj *patternFlowSnmpv2CBulkPDURequestId) SetValues(value []int32) PatternFlowSnmpv2CBulkPDURequestId { - obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]int32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CBulkPDURequestIdCounter -func (obj *patternFlowSnmpv2CBulkPDURequestId) Increment() PatternFlowSnmpv2CBulkPDURequestIdCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowSnmpv2CBulkPDURequestIdCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CBulkPDURequestIdCounter -func (obj *patternFlowSnmpv2CBulkPDURequestId) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowSnmpv2CBulkPDURequestIdCounter value in the PatternFlowSnmpv2CBulkPDURequestId object -func (obj *patternFlowSnmpv2CBulkPDURequestId) SetIncrement(value PatternFlowSnmpv2CBulkPDURequestIdCounter) PatternFlowSnmpv2CBulkPDURequestId { - obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CBulkPDURequestIdCounter -func (obj *patternFlowSnmpv2CBulkPDURequestId) Decrement() PatternFlowSnmpv2CBulkPDURequestIdCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowSnmpv2CBulkPDURequestIdCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CBulkPDURequestIdCounter -func (obj *patternFlowSnmpv2CBulkPDURequestId) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowSnmpv2CBulkPDURequestIdCounter value in the PatternFlowSnmpv2CBulkPDURequestId object -func (obj *patternFlowSnmpv2CBulkPDURequestId) SetDecrement(value PatternFlowSnmpv2CBulkPDURequestIdCounter) PatternFlowSnmpv2CBulkPDURequestId { - obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowSnmpv2CBulkPDURequestId) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowSnmpv2CBulkPDURequestId) setDefault() { - var choices_set int = 0 - var choice PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CBulkPDURequestIdChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CBulkPDURequestIdChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CBulkPDURequestId") - } - } else { - intVal := otg.PatternFlowSnmpv2CBulkPDURequestId_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowSnmpv2CBulkPDURequestId_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowSnmpv2CBulkPDUNonRepeaters ***** -type patternFlowSnmpv2CBulkPDUNonRepeaters struct { - validation - obj *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters - marshaller marshalPatternFlowSnmpv2CBulkPDUNonRepeaters - unMarshaller unMarshalPatternFlowSnmpv2CBulkPDUNonRepeaters -} - -func NewPatternFlowSnmpv2CBulkPDUNonRepeaters() PatternFlowSnmpv2CBulkPDUNonRepeaters { - obj := patternFlowSnmpv2CBulkPDUNonRepeaters{obj: &otg.PatternFlowSnmpv2CBulkPDUNonRepeaters{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) msg() *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters { - return obj.obj -} - -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) setMsg(msg *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters) PatternFlowSnmpv2CBulkPDUNonRepeaters { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CBulkPDUNonRepeaters struct { - obj *patternFlowSnmpv2CBulkPDUNonRepeaters -} - -type marshalPatternFlowSnmpv2CBulkPDUNonRepeaters interface { - // ToProto marshals PatternFlowSnmpv2CBulkPDUNonRepeaters to protobuf object *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters - ToProto() (*otg.PatternFlowSnmpv2CBulkPDUNonRepeaters, error) - // ToPbText marshals PatternFlowSnmpv2CBulkPDUNonRepeaters to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CBulkPDUNonRepeaters to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CBulkPDUNonRepeaters to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CBulkPDUNonRepeaters struct { - obj *patternFlowSnmpv2CBulkPDUNonRepeaters -} - -type unMarshalPatternFlowSnmpv2CBulkPDUNonRepeaters interface { - // FromProto unmarshals PatternFlowSnmpv2CBulkPDUNonRepeaters from protobuf object *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters - FromProto(msg *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters) (PatternFlowSnmpv2CBulkPDUNonRepeaters, error) - // FromPbText unmarshals PatternFlowSnmpv2CBulkPDUNonRepeaters from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CBulkPDUNonRepeaters from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CBulkPDUNonRepeaters from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) Marshal() marshalPatternFlowSnmpv2CBulkPDUNonRepeaters { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CBulkPDUNonRepeaters{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDUNonRepeaters { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CBulkPDUNonRepeaters{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CBulkPDUNonRepeaters) ToProto() (*otg.PatternFlowSnmpv2CBulkPDUNonRepeaters, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CBulkPDUNonRepeaters) FromProto(msg *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters) (PatternFlowSnmpv2CBulkPDUNonRepeaters, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CBulkPDUNonRepeaters) 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 *unMarshalpatternFlowSnmpv2CBulkPDUNonRepeaters) 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 *marshalpatternFlowSnmpv2CBulkPDUNonRepeaters) 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 *unMarshalpatternFlowSnmpv2CBulkPDUNonRepeaters) 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 *marshalpatternFlowSnmpv2CBulkPDUNonRepeaters) 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 *unMarshalpatternFlowSnmpv2CBulkPDUNonRepeaters) 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 *patternFlowSnmpv2CBulkPDUNonRepeaters) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) Clone() (PatternFlowSnmpv2CBulkPDUNonRepeaters, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CBulkPDUNonRepeaters() - 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 -} - -// PatternFlowSnmpv2CBulkPDUNonRepeaters is one variable binding in the Response-PDU is requested for the first non_repeaters variable bindings in the GetBulkRequest. -type PatternFlowSnmpv2CBulkPDUNonRepeaters interface { - Validation - // msg marshals PatternFlowSnmpv2CBulkPDUNonRepeaters to protobuf object *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters - // setMsg unmarshals PatternFlowSnmpv2CBulkPDUNonRepeaters from protobuf object *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CBulkPDUNonRepeaters) PatternFlowSnmpv2CBulkPDUNonRepeaters - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CBulkPDUNonRepeaters - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDUNonRepeaters - // validate validates PatternFlowSnmpv2CBulkPDUNonRepeaters - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CBulkPDUNonRepeaters, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum, set in PatternFlowSnmpv2CBulkPDUNonRepeaters - Choice() PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum - // setChoice assigns PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum provided by user to PatternFlowSnmpv2CBulkPDUNonRepeaters - setChoice(value PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum) PatternFlowSnmpv2CBulkPDUNonRepeaters - // HasChoice checks if Choice has been set in PatternFlowSnmpv2CBulkPDUNonRepeaters - HasChoice() bool - // Value returns uint32, set in PatternFlowSnmpv2CBulkPDUNonRepeaters. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowSnmpv2CBulkPDUNonRepeaters - SetValue(value uint32) PatternFlowSnmpv2CBulkPDUNonRepeaters - // HasValue checks if Value has been set in PatternFlowSnmpv2CBulkPDUNonRepeaters - HasValue() bool - // Values returns []uint32, set in PatternFlowSnmpv2CBulkPDUNonRepeaters. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowSnmpv2CBulkPDUNonRepeaters - SetValues(value []uint32) PatternFlowSnmpv2CBulkPDUNonRepeaters -} - -type PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum string - -// Enum of Choice on PatternFlowSnmpv2CBulkPDUNonRepeaters -var PatternFlowSnmpv2CBulkPDUNonRepeatersChoice = struct { - VALUE PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum - VALUES PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum -}{ - VALUE: PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum("value"), - VALUES: PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum("values"), -} - -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) Choice() PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum { - return PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) setChoice(value PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum) PatternFlowSnmpv2CBulkPDUNonRepeaters { - intValue, ok := otg.PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowSnmpv2CBulkPDUNonRepeaters object -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) SetValue(value uint32) PatternFlowSnmpv2CBulkPDUNonRepeaters { - obj.setChoice(PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowSnmpv2CBulkPDUNonRepeaters object -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) SetValues(value []uint32) PatternFlowSnmpv2CBulkPDUNonRepeaters { - obj.setChoice(PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) setDefault() { - var choices_set int = 0 - var choice PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUES - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CBulkPDUNonRepeaters") - } - } else { - intVal := otg.PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowSnmpv2CBulkPDUMaxRepetitions ***** -type patternFlowSnmpv2CBulkPDUMaxRepetitions struct { - validation - obj *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions - marshaller marshalPatternFlowSnmpv2CBulkPDUMaxRepetitions - unMarshaller unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitions - incrementHolder PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - decrementHolder PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter -} - -func NewPatternFlowSnmpv2CBulkPDUMaxRepetitions() PatternFlowSnmpv2CBulkPDUMaxRepetitions { - obj := patternFlowSnmpv2CBulkPDUMaxRepetitions{obj: &otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) msg() *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions { - return obj.obj -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) setMsg(msg *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions) PatternFlowSnmpv2CBulkPDUMaxRepetitions { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CBulkPDUMaxRepetitions struct { - obj *patternFlowSnmpv2CBulkPDUMaxRepetitions -} - -type marshalPatternFlowSnmpv2CBulkPDUMaxRepetitions interface { - // ToProto marshals PatternFlowSnmpv2CBulkPDUMaxRepetitions to protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions - ToProto() (*otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions, error) - // ToPbText marshals PatternFlowSnmpv2CBulkPDUMaxRepetitions to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CBulkPDUMaxRepetitions to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CBulkPDUMaxRepetitions to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitions struct { - obj *patternFlowSnmpv2CBulkPDUMaxRepetitions -} - -type unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitions interface { - // FromProto unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitions from protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions - FromProto(msg *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions) (PatternFlowSnmpv2CBulkPDUMaxRepetitions, error) - // FromPbText unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitions from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitions from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitions from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Marshal() marshalPatternFlowSnmpv2CBulkPDUMaxRepetitions { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CBulkPDUMaxRepetitions{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitions { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitions{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) ToProto() (*otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) FromProto(msg *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions) (PatternFlowSnmpv2CBulkPDUMaxRepetitions, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) 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 *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) 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 *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) 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 *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Clone() (PatternFlowSnmpv2CBulkPDUMaxRepetitions, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CBulkPDUMaxRepetitions() - 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 -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowSnmpv2CBulkPDUMaxRepetitions is a maximum of max_repetitions variable bindings are requested in the Response-PDU for each of the remaining variable bindings in the GetBulkRequest after the non_repeaters variable bindings. -type PatternFlowSnmpv2CBulkPDUMaxRepetitions interface { - Validation - // msg marshals PatternFlowSnmpv2CBulkPDUMaxRepetitions to protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions - // setMsg unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitions from protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions) PatternFlowSnmpv2CBulkPDUMaxRepetitions - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CBulkPDUMaxRepetitions - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitions - // validate validates PatternFlowSnmpv2CBulkPDUMaxRepetitions - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CBulkPDUMaxRepetitions, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum, set in PatternFlowSnmpv2CBulkPDUMaxRepetitions - Choice() PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum - // setChoice assigns PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitions - setChoice(value PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum) PatternFlowSnmpv2CBulkPDUMaxRepetitions - // HasChoice checks if Choice has been set in PatternFlowSnmpv2CBulkPDUMaxRepetitions - HasChoice() bool - // Value returns uint32, set in PatternFlowSnmpv2CBulkPDUMaxRepetitions. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitions - SetValue(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitions - // HasValue checks if Value has been set in PatternFlowSnmpv2CBulkPDUMaxRepetitions - HasValue() bool - // Values returns []uint32, set in PatternFlowSnmpv2CBulkPDUMaxRepetitions. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitions - SetValues(value []uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitions - // Increment returns PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, set in PatternFlowSnmpv2CBulkPDUMaxRepetitions. - Increment() PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - // SetIncrement assigns PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitions. - SetIncrement(value PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) PatternFlowSnmpv2CBulkPDUMaxRepetitions - // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CBulkPDUMaxRepetitions - HasIncrement() bool - // Decrement returns PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, set in PatternFlowSnmpv2CBulkPDUMaxRepetitions. - Decrement() PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - // SetDecrement assigns PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitions. - SetDecrement(value PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) PatternFlowSnmpv2CBulkPDUMaxRepetitions - // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CBulkPDUMaxRepetitions - HasDecrement() bool - setNil() -} - -type PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum string - -// Enum of Choice on PatternFlowSnmpv2CBulkPDUMaxRepetitions -var PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice = struct { - VALUE PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum - VALUES PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum - INCREMENT PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum - DECREMENT PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum -}{ - VALUE: PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum("value"), - VALUES: PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum("values"), - INCREMENT: PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum("increment"), - DECREMENT: PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum("decrement"), -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Choice() PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum { - return PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) setChoice(value PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum) PatternFlowSnmpv2CBulkPDUMaxRepetitions { - intValue, ok := otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter().msg() - } - - if value == PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowSnmpv2CBulkPDUMaxRepetitions object -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) SetValue(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitions { - obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowSnmpv2CBulkPDUMaxRepetitions object -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) SetValues(value []uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitions { - obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Increment() PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter value in the PatternFlowSnmpv2CBulkPDUMaxRepetitions object -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) SetIncrement(value PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) PatternFlowSnmpv2CBulkPDUMaxRepetitions { - obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Decrement() PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter value in the PatternFlowSnmpv2CBulkPDUMaxRepetitions object -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) SetDecrement(value PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) PatternFlowSnmpv2CBulkPDUMaxRepetitions { - obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) setDefault() { - var choices_set int = 0 - var choice PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CBulkPDUMaxRepetitions") - } - } else { - intVal := otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPPathObjects ***** -type flowRSVPPathObjects struct { - validation - obj *otg.FlowRSVPPathObjects - marshaller marshalFlowRSVPPathObjects - unMarshaller unMarshalFlowRSVPPathObjects - classNumHolder FlowRSVPPathObjectsClass -} - -func NewFlowRSVPPathObjects() FlowRSVPPathObjects { - obj := flowRSVPPathObjects{obj: &otg.FlowRSVPPathObjects{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjects) msg() *otg.FlowRSVPPathObjects { - return obj.obj -} - -func (obj *flowRSVPPathObjects) setMsg(msg *otg.FlowRSVPPathObjects) FlowRSVPPathObjects { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjects struct { - obj *flowRSVPPathObjects -} - -type marshalFlowRSVPPathObjects interface { - // ToProto marshals FlowRSVPPathObjects to protobuf object *otg.FlowRSVPPathObjects - ToProto() (*otg.FlowRSVPPathObjects, error) - // ToPbText marshals FlowRSVPPathObjects to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjects to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjects to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjects struct { - obj *flowRSVPPathObjects -} - -type unMarshalFlowRSVPPathObjects interface { - // FromProto unmarshals FlowRSVPPathObjects from protobuf object *otg.FlowRSVPPathObjects - FromProto(msg *otg.FlowRSVPPathObjects) (FlowRSVPPathObjects, error) - // FromPbText unmarshals FlowRSVPPathObjects from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjects from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjects from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjects) Marshal() marshalFlowRSVPPathObjects { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjects{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjects) Unmarshal() unMarshalFlowRSVPPathObjects { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjects{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjects) ToProto() (*otg.FlowRSVPPathObjects, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjects) FromProto(msg *otg.FlowRSVPPathObjects) (FlowRSVPPathObjects, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjects) 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 *unMarshalflowRSVPPathObjects) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjects) 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 *unMarshalflowRSVPPathObjects) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjects) 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 *unMarshalflowRSVPPathObjects) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjects) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjects) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjects) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjects) Clone() (FlowRSVPPathObjects, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjects() - 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 -} - -func (obj *flowRSVPPathObjects) setNil() { - obj.classNumHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjects is every RSVP object encapsulated in an RSVP message consists of a 32-bit word header and the object's contents. -type FlowRSVPPathObjects interface { - Validation - // msg marshals FlowRSVPPathObjects to protobuf object *otg.FlowRSVPPathObjects - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjects - // setMsg unmarshals FlowRSVPPathObjects from protobuf object *otg.FlowRSVPPathObjects - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjects) FlowRSVPPathObjects - // provides marshal interface - Marshal() marshalFlowRSVPPathObjects - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjects - // validate validates FlowRSVPPathObjects - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjects, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ClassNum returns FlowRSVPPathObjectsClass, set in FlowRSVPPathObjects. - // FlowRSVPPathObjectsClass is the class number is used to identify the class of an object. Defined in https://www.iana.org/assignments/rsvp-parameters/rsvp-parameters.xhtml#rsvp-parameters-4 . Curently supported class numbers are for "Path" message type. "Path" message: Supported Class numbers and it's value: SESSION: 1, RSVP_HOP: 3, TIME_VALUES: 5, EXPLICIT_ROUTE: 20, LABEL_REQUEST: 19, SESSION_ATTRIBUTE: 207, SENDER_TEMPLATE: 11, SENDER_TSPEC: 12, RECORD_ROUTE: 21, Custom: User defined bytes based on class and c-types not supported in above options. - ClassNum() FlowRSVPPathObjectsClass - // SetClassNum assigns FlowRSVPPathObjectsClass provided by user to FlowRSVPPathObjects. - // FlowRSVPPathObjectsClass is the class number is used to identify the class of an object. Defined in https://www.iana.org/assignments/rsvp-parameters/rsvp-parameters.xhtml#rsvp-parameters-4 . Curently supported class numbers are for "Path" message type. "Path" message: Supported Class numbers and it's value: SESSION: 1, RSVP_HOP: 3, TIME_VALUES: 5, EXPLICIT_ROUTE: 20, LABEL_REQUEST: 19, SESSION_ATTRIBUTE: 207, SENDER_TEMPLATE: 11, SENDER_TSPEC: 12, RECORD_ROUTE: 21, Custom: User defined bytes based on class and c-types not supported in above options. - SetClassNum(value FlowRSVPPathObjectsClass) FlowRSVPPathObjects - // HasClassNum checks if ClassNum has been set in FlowRSVPPathObjects - HasClassNum() bool - setNil() -} - -// description is TBD -// ClassNum returns a FlowRSVPPathObjectsClass -func (obj *flowRSVPPathObjects) ClassNum() FlowRSVPPathObjectsClass { - if obj.obj.ClassNum == nil { - obj.obj.ClassNum = NewFlowRSVPPathObjectsClass().msg() - } - if obj.classNumHolder == nil { - obj.classNumHolder = &flowRSVPPathObjectsClass{obj: obj.obj.ClassNum} - } - return obj.classNumHolder -} - -// description is TBD -// ClassNum returns a FlowRSVPPathObjectsClass -func (obj *flowRSVPPathObjects) HasClassNum() bool { - return obj.obj.ClassNum != nil -} - -// description is TBD -// SetClassNum sets the FlowRSVPPathObjectsClass value in the FlowRSVPPathObjects object -func (obj *flowRSVPPathObjects) SetClassNum(value FlowRSVPPathObjectsClass) FlowRSVPPathObjects { - - obj.classNumHolder = nil - obj.obj.ClassNum = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjects) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.ClassNum != nil { - - obj.ClassNum().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjects) setDefault() { - -} - -// ***** ActionResponseProtocolIpv4PingResponse ***** -type actionResponseProtocolIpv4PingResponse struct { - validation - obj *otg.ActionResponseProtocolIpv4PingResponse - marshaller marshalActionResponseProtocolIpv4PingResponse - unMarshaller unMarshalActionResponseProtocolIpv4PingResponse -} - -func NewActionResponseProtocolIpv4PingResponse() ActionResponseProtocolIpv4PingResponse { - obj := actionResponseProtocolIpv4PingResponse{obj: &otg.ActionResponseProtocolIpv4PingResponse{}} - obj.setDefault() - return &obj -} - -func (obj *actionResponseProtocolIpv4PingResponse) msg() *otg.ActionResponseProtocolIpv4PingResponse { - return obj.obj -} - -func (obj *actionResponseProtocolIpv4PingResponse) setMsg(msg *otg.ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingResponse { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionResponseProtocolIpv4PingResponse struct { - obj *actionResponseProtocolIpv4PingResponse -} - -type marshalActionResponseProtocolIpv4PingResponse interface { - // ToProto marshals ActionResponseProtocolIpv4PingResponse to protobuf object *otg.ActionResponseProtocolIpv4PingResponse - ToProto() (*otg.ActionResponseProtocolIpv4PingResponse, error) - // ToPbText marshals ActionResponseProtocolIpv4PingResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionResponseProtocolIpv4PingResponse to YAML text - ToYaml() (string, error) - // ToJson marshals ActionResponseProtocolIpv4PingResponse to JSON text - ToJson() (string, error) -} - -type unMarshalactionResponseProtocolIpv4PingResponse struct { - obj *actionResponseProtocolIpv4PingResponse -} - -type unMarshalActionResponseProtocolIpv4PingResponse interface { - // FromProto unmarshals ActionResponseProtocolIpv4PingResponse from protobuf object *otg.ActionResponseProtocolIpv4PingResponse - FromProto(msg *otg.ActionResponseProtocolIpv4PingResponse) (ActionResponseProtocolIpv4PingResponse, error) - // FromPbText unmarshals ActionResponseProtocolIpv4PingResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionResponseProtocolIpv4PingResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionResponseProtocolIpv4PingResponse from JSON text - FromJson(value string) error -} - -func (obj *actionResponseProtocolIpv4PingResponse) Marshal() marshalActionResponseProtocolIpv4PingResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalactionResponseProtocolIpv4PingResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *actionResponseProtocolIpv4PingResponse) Unmarshal() unMarshalActionResponseProtocolIpv4PingResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionResponseProtocolIpv4PingResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionResponseProtocolIpv4PingResponse) ToProto() (*otg.ActionResponseProtocolIpv4PingResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionResponseProtocolIpv4PingResponse) FromProto(msg *otg.ActionResponseProtocolIpv4PingResponse) (ActionResponseProtocolIpv4PingResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionResponseProtocolIpv4PingResponse) 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 *unMarshalactionResponseProtocolIpv4PingResponse) 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 *marshalactionResponseProtocolIpv4PingResponse) 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 *unMarshalactionResponseProtocolIpv4PingResponse) 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 *marshalactionResponseProtocolIpv4PingResponse) 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 *unMarshalactionResponseProtocolIpv4PingResponse) 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 *actionResponseProtocolIpv4PingResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionResponseProtocolIpv4PingResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionResponseProtocolIpv4PingResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionResponseProtocolIpv4PingResponse) Clone() (ActionResponseProtocolIpv4PingResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionResponseProtocolIpv4PingResponse() - 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 -} - -// ActionResponseProtocolIpv4PingResponse is response for ping initiated between a single source and destination pair. -type ActionResponseProtocolIpv4PingResponse interface { - Validation - // msg marshals ActionResponseProtocolIpv4PingResponse to protobuf object *otg.ActionResponseProtocolIpv4PingResponse - // and doesn't set defaults - msg() *otg.ActionResponseProtocolIpv4PingResponse - // setMsg unmarshals ActionResponseProtocolIpv4PingResponse from protobuf object *otg.ActionResponseProtocolIpv4PingResponse - // and doesn't set defaults - setMsg(*otg.ActionResponseProtocolIpv4PingResponse) ActionResponseProtocolIpv4PingResponse - // provides marshal interface - Marshal() marshalActionResponseProtocolIpv4PingResponse - // provides unmarshal interface - Unmarshal() unMarshalActionResponseProtocolIpv4PingResponse - // validate validates ActionResponseProtocolIpv4PingResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionResponseProtocolIpv4PingResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // SrcName returns string, set in ActionResponseProtocolIpv4PingResponse. - SrcName() string - // SetSrcName assigns string provided by user to ActionResponseProtocolIpv4PingResponse - SetSrcName(value string) ActionResponseProtocolIpv4PingResponse - // DstIp returns string, set in ActionResponseProtocolIpv4PingResponse. - DstIp() string - // SetDstIp assigns string provided by user to ActionResponseProtocolIpv4PingResponse - SetDstIp(value string) ActionResponseProtocolIpv4PingResponse - // Result returns ActionResponseProtocolIpv4PingResponseResultEnum, set in ActionResponseProtocolIpv4PingResponse - Result() ActionResponseProtocolIpv4PingResponseResultEnum - // SetResult assigns ActionResponseProtocolIpv4PingResponseResultEnum provided by user to ActionResponseProtocolIpv4PingResponse - SetResult(value ActionResponseProtocolIpv4PingResponseResultEnum) ActionResponseProtocolIpv4PingResponse -} - -// Name of source IPv4 interface used for ping. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// SrcName returns a string -func (obj *actionResponseProtocolIpv4PingResponse) SrcName() string { - - return *obj.obj.SrcName - -} - -// Name of source IPv4 interface used for ping. -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv4/properties/name -// -// SetSrcName sets the string value in the ActionResponseProtocolIpv4PingResponse object -func (obj *actionResponseProtocolIpv4PingResponse) SetSrcName(value string) ActionResponseProtocolIpv4PingResponse { - - obj.obj.SrcName = &value - return obj -} - -// Destination IPv4 address used for ping. -// DstIp returns a string -func (obj *actionResponseProtocolIpv4PingResponse) DstIp() string { - - return *obj.obj.DstIp - -} - -// Destination IPv4 address used for ping. -// SetDstIp sets the string value in the ActionResponseProtocolIpv4PingResponse object -func (obj *actionResponseProtocolIpv4PingResponse) SetDstIp(value string) ActionResponseProtocolIpv4PingResponse { - - obj.obj.DstIp = &value - return obj -} - -type ActionResponseProtocolIpv4PingResponseResultEnum string - -// Enum of Result on ActionResponseProtocolIpv4PingResponse -var ActionResponseProtocolIpv4PingResponseResult = struct { - SUCCEEDED ActionResponseProtocolIpv4PingResponseResultEnum - FAILED ActionResponseProtocolIpv4PingResponseResultEnum -}{ - SUCCEEDED: ActionResponseProtocolIpv4PingResponseResultEnum("succeeded"), - FAILED: ActionResponseProtocolIpv4PingResponseResultEnum("failed"), -} - -func (obj *actionResponseProtocolIpv4PingResponse) Result() ActionResponseProtocolIpv4PingResponseResultEnum { - return ActionResponseProtocolIpv4PingResponseResultEnum(obj.obj.Result.Enum().String()) -} - -func (obj *actionResponseProtocolIpv4PingResponse) SetResult(value ActionResponseProtocolIpv4PingResponseResultEnum) ActionResponseProtocolIpv4PingResponse { - intValue, ok := otg.ActionResponseProtocolIpv4PingResponse_Result_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ActionResponseProtocolIpv4PingResponseResultEnum", string(value))) - return obj - } - enumValue := otg.ActionResponseProtocolIpv4PingResponse_Result_Enum(intValue) - obj.obj.Result = &enumValue - - return obj -} - -func (obj *actionResponseProtocolIpv4PingResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // SrcName is required - if obj.obj.SrcName == nil { - vObj.validationErrors = append(vObj.validationErrors, "SrcName is required field on interface ActionResponseProtocolIpv4PingResponse") - } - - // DstIp is required - if obj.obj.DstIp == nil { - vObj.validationErrors = append(vObj.validationErrors, "DstIp is required field on interface ActionResponseProtocolIpv4PingResponse") - } - if obj.obj.DstIp != nil { - - err := obj.validateIpv4(obj.DstIp()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on ActionResponseProtocolIpv4PingResponse.DstIp")) - } - - } - - // Result is required - if obj.obj.Result == nil { - vObj.validationErrors = append(vObj.validationErrors, "Result is required field on interface ActionResponseProtocolIpv4PingResponse") - } -} - -func (obj *actionResponseProtocolIpv4PingResponse) setDefault() { - -} - -// ***** ActionResponseProtocolIpv6PingResponse ***** -type actionResponseProtocolIpv6PingResponse struct { - validation - obj *otg.ActionResponseProtocolIpv6PingResponse - marshaller marshalActionResponseProtocolIpv6PingResponse - unMarshaller unMarshalActionResponseProtocolIpv6PingResponse -} - -func NewActionResponseProtocolIpv6PingResponse() ActionResponseProtocolIpv6PingResponse { - obj := actionResponseProtocolIpv6PingResponse{obj: &otg.ActionResponseProtocolIpv6PingResponse{}} - obj.setDefault() - return &obj -} - -func (obj *actionResponseProtocolIpv6PingResponse) msg() *otg.ActionResponseProtocolIpv6PingResponse { - return obj.obj -} - -func (obj *actionResponseProtocolIpv6PingResponse) setMsg(msg *otg.ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingResponse { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalactionResponseProtocolIpv6PingResponse struct { - obj *actionResponseProtocolIpv6PingResponse -} - -type marshalActionResponseProtocolIpv6PingResponse interface { - // ToProto marshals ActionResponseProtocolIpv6PingResponse to protobuf object *otg.ActionResponseProtocolIpv6PingResponse - ToProto() (*otg.ActionResponseProtocolIpv6PingResponse, error) - // ToPbText marshals ActionResponseProtocolIpv6PingResponse to protobuf text - ToPbText() (string, error) - // ToYaml marshals ActionResponseProtocolIpv6PingResponse to YAML text - ToYaml() (string, error) - // ToJson marshals ActionResponseProtocolIpv6PingResponse to JSON text - ToJson() (string, error) -} - -type unMarshalactionResponseProtocolIpv6PingResponse struct { - obj *actionResponseProtocolIpv6PingResponse -} - -type unMarshalActionResponseProtocolIpv6PingResponse interface { - // FromProto unmarshals ActionResponseProtocolIpv6PingResponse from protobuf object *otg.ActionResponseProtocolIpv6PingResponse - FromProto(msg *otg.ActionResponseProtocolIpv6PingResponse) (ActionResponseProtocolIpv6PingResponse, error) - // FromPbText unmarshals ActionResponseProtocolIpv6PingResponse from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ActionResponseProtocolIpv6PingResponse from YAML text - FromYaml(value string) error - // FromJson unmarshals ActionResponseProtocolIpv6PingResponse from JSON text - FromJson(value string) error -} - -func (obj *actionResponseProtocolIpv6PingResponse) Marshal() marshalActionResponseProtocolIpv6PingResponse { - if obj.marshaller == nil { - obj.marshaller = &marshalactionResponseProtocolIpv6PingResponse{obj: obj} - } - return obj.marshaller -} - -func (obj *actionResponseProtocolIpv6PingResponse) Unmarshal() unMarshalActionResponseProtocolIpv6PingResponse { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalactionResponseProtocolIpv6PingResponse{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalactionResponseProtocolIpv6PingResponse) ToProto() (*otg.ActionResponseProtocolIpv6PingResponse, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalactionResponseProtocolIpv6PingResponse) FromProto(msg *otg.ActionResponseProtocolIpv6PingResponse) (ActionResponseProtocolIpv6PingResponse, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalactionResponseProtocolIpv6PingResponse) 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 *unMarshalactionResponseProtocolIpv6PingResponse) 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 *marshalactionResponseProtocolIpv6PingResponse) 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 *unMarshalactionResponseProtocolIpv6PingResponse) 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 *marshalactionResponseProtocolIpv6PingResponse) 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 *unMarshalactionResponseProtocolIpv6PingResponse) 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 *actionResponseProtocolIpv6PingResponse) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *actionResponseProtocolIpv6PingResponse) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *actionResponseProtocolIpv6PingResponse) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *actionResponseProtocolIpv6PingResponse) Clone() (ActionResponseProtocolIpv6PingResponse, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewActionResponseProtocolIpv6PingResponse() - 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 -} - -// ActionResponseProtocolIpv6PingResponse is response for ping initiated between a single source and destination pair. -type ActionResponseProtocolIpv6PingResponse interface { - Validation - // msg marshals ActionResponseProtocolIpv6PingResponse to protobuf object *otg.ActionResponseProtocolIpv6PingResponse - // and doesn't set defaults - msg() *otg.ActionResponseProtocolIpv6PingResponse - // setMsg unmarshals ActionResponseProtocolIpv6PingResponse from protobuf object *otg.ActionResponseProtocolIpv6PingResponse - // and doesn't set defaults - setMsg(*otg.ActionResponseProtocolIpv6PingResponse) ActionResponseProtocolIpv6PingResponse - // provides marshal interface - Marshal() marshalActionResponseProtocolIpv6PingResponse - // provides unmarshal interface - Unmarshal() unMarshalActionResponseProtocolIpv6PingResponse - // validate validates ActionResponseProtocolIpv6PingResponse - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ActionResponseProtocolIpv6PingResponse, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // SrcName returns string, set in ActionResponseProtocolIpv6PingResponse. - SrcName() string - // SetSrcName assigns string provided by user to ActionResponseProtocolIpv6PingResponse - SetSrcName(value string) ActionResponseProtocolIpv6PingResponse - // DstIp returns string, set in ActionResponseProtocolIpv6PingResponse. - DstIp() string - // SetDstIp assigns string provided by user to ActionResponseProtocolIpv6PingResponse - SetDstIp(value string) ActionResponseProtocolIpv6PingResponse - // Result returns ActionResponseProtocolIpv6PingResponseResultEnum, set in ActionResponseProtocolIpv6PingResponse - Result() ActionResponseProtocolIpv6PingResponseResultEnum - // SetResult assigns ActionResponseProtocolIpv6PingResponseResultEnum provided by user to ActionResponseProtocolIpv6PingResponse - SetResult(value ActionResponseProtocolIpv6PingResponseResultEnum) ActionResponseProtocolIpv6PingResponse -} - -// Name of source IPv6 interface used for ping. -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// -// SrcName returns a string -func (obj *actionResponseProtocolIpv6PingResponse) SrcName() string { - - return *obj.obj.SrcName - -} - -// Name of source IPv6 interface used for ping. -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// -// x-constraint: -// - /components/schemas/Device.Ipv6/properties/name -// -// SetSrcName sets the string value in the ActionResponseProtocolIpv6PingResponse object -func (obj *actionResponseProtocolIpv6PingResponse) SetSrcName(value string) ActionResponseProtocolIpv6PingResponse { - - obj.obj.SrcName = &value - return obj -} - -// Destination IPv6 address used for ping. -// DstIp returns a string -func (obj *actionResponseProtocolIpv6PingResponse) DstIp() string { - - return *obj.obj.DstIp - -} - -// Destination IPv6 address used for ping. -// SetDstIp sets the string value in the ActionResponseProtocolIpv6PingResponse object -func (obj *actionResponseProtocolIpv6PingResponse) SetDstIp(value string) ActionResponseProtocolIpv6PingResponse { - - obj.obj.DstIp = &value - return obj -} - -type ActionResponseProtocolIpv6PingResponseResultEnum string - -// Enum of Result on ActionResponseProtocolIpv6PingResponse -var ActionResponseProtocolIpv6PingResponseResult = struct { - SUCCEEDED ActionResponseProtocolIpv6PingResponseResultEnum - FAILED ActionResponseProtocolIpv6PingResponseResultEnum -}{ - SUCCEEDED: ActionResponseProtocolIpv6PingResponseResultEnum("succeeded"), - FAILED: ActionResponseProtocolIpv6PingResponseResultEnum("failed"), -} - -func (obj *actionResponseProtocolIpv6PingResponse) Result() ActionResponseProtocolIpv6PingResponseResultEnum { - return ActionResponseProtocolIpv6PingResponseResultEnum(obj.obj.Result.Enum().String()) -} - -func (obj *actionResponseProtocolIpv6PingResponse) SetResult(value ActionResponseProtocolIpv6PingResponseResultEnum) ActionResponseProtocolIpv6PingResponse { - intValue, ok := otg.ActionResponseProtocolIpv6PingResponse_Result_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ActionResponseProtocolIpv6PingResponseResultEnum", string(value))) - return obj - } - enumValue := otg.ActionResponseProtocolIpv6PingResponse_Result_Enum(intValue) - obj.obj.Result = &enumValue - - return obj -} - -func (obj *actionResponseProtocolIpv6PingResponse) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // SrcName is required - if obj.obj.SrcName == nil { - vObj.validationErrors = append(vObj.validationErrors, "SrcName is required field on interface ActionResponseProtocolIpv6PingResponse") - } - - // DstIp is required - if obj.obj.DstIp == nil { - vObj.validationErrors = append(vObj.validationErrors, "DstIp is required field on interface ActionResponseProtocolIpv6PingResponse") - } - if obj.obj.DstIp != nil { - - err := obj.validateIpv6(obj.DstIp()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on ActionResponseProtocolIpv6PingResponse.DstIp")) - } - - } - - // Result is required - if obj.obj.Result == nil { - vObj.validationErrors = append(vObj.validationErrors, "Result is required field on interface ActionResponseProtocolIpv6PingResponse") - } -} - -func (obj *actionResponseProtocolIpv6PingResponse) setDefault() { - -} - -// ***** ResultExtendedCommunityTransitive2OctetAsType ***** -type resultExtendedCommunityTransitive2OctetAsType struct { - validation - obj *otg.ResultExtendedCommunityTransitive2OctetAsType - marshaller marshalResultExtendedCommunityTransitive2OctetAsType - unMarshaller unMarshalResultExtendedCommunityTransitive2OctetAsType - routeTargetSubtypeHolder ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - routeOriginSubtypeHolder ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin -} - -func NewResultExtendedCommunityTransitive2OctetAsType() ResultExtendedCommunityTransitive2OctetAsType { - obj := resultExtendedCommunityTransitive2OctetAsType{obj: &otg.ResultExtendedCommunityTransitive2OctetAsType{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityTransitive2OctetAsType) msg() *otg.ResultExtendedCommunityTransitive2OctetAsType { - return obj.obj -} - -func (obj *resultExtendedCommunityTransitive2OctetAsType) setMsg(msg *otg.ResultExtendedCommunityTransitive2OctetAsType) ResultExtendedCommunityTransitive2OctetAsType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityTransitive2OctetAsType struct { - obj *resultExtendedCommunityTransitive2OctetAsType -} - -type marshalResultExtendedCommunityTransitive2OctetAsType interface { - // ToProto marshals ResultExtendedCommunityTransitive2OctetAsType to protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsType - ToProto() (*otg.ResultExtendedCommunityTransitive2OctetAsType, error) - // ToPbText marshals ResultExtendedCommunityTransitive2OctetAsType to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityTransitive2OctetAsType to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityTransitive2OctetAsType to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityTransitive2OctetAsType struct { - obj *resultExtendedCommunityTransitive2OctetAsType -} - -type unMarshalResultExtendedCommunityTransitive2OctetAsType interface { - // FromProto unmarshals ResultExtendedCommunityTransitive2OctetAsType from protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsType - FromProto(msg *otg.ResultExtendedCommunityTransitive2OctetAsType) (ResultExtendedCommunityTransitive2OctetAsType, error) - // FromPbText unmarshals ResultExtendedCommunityTransitive2OctetAsType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityTransitive2OctetAsType from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityTransitive2OctetAsType from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityTransitive2OctetAsType) Marshal() marshalResultExtendedCommunityTransitive2OctetAsType { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityTransitive2OctetAsType{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityTransitive2OctetAsType) Unmarshal() unMarshalResultExtendedCommunityTransitive2OctetAsType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityTransitive2OctetAsType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityTransitive2OctetAsType) ToProto() (*otg.ResultExtendedCommunityTransitive2OctetAsType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityTransitive2OctetAsType) FromProto(msg *otg.ResultExtendedCommunityTransitive2OctetAsType) (ResultExtendedCommunityTransitive2OctetAsType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityTransitive2OctetAsType) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalresultExtendedCommunityTransitive2OctetAsType) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalresultExtendedCommunityTransitive2OctetAsType) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *resultExtendedCommunityTransitive2OctetAsType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitive2OctetAsType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitive2OctetAsType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityTransitive2OctetAsType) Clone() (ResultExtendedCommunityTransitive2OctetAsType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityTransitive2OctetAsType() - 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 -} - -func (obj *resultExtendedCommunityTransitive2OctetAsType) setNil() { - obj.routeTargetSubtypeHolder = nil - obj.routeOriginSubtypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ResultExtendedCommunityTransitive2OctetAsType is the Transitive Two-Octet AS-Specific Extended Community is sent as type 0x00 . -type ResultExtendedCommunityTransitive2OctetAsType interface { - Validation - // msg marshals ResultExtendedCommunityTransitive2OctetAsType to protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsType - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityTransitive2OctetAsType - // setMsg unmarshals ResultExtendedCommunityTransitive2OctetAsType from protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsType - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityTransitive2OctetAsType) ResultExtendedCommunityTransitive2OctetAsType - // provides marshal interface - Marshal() marshalResultExtendedCommunityTransitive2OctetAsType - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityTransitive2OctetAsType - // validate validates ResultExtendedCommunityTransitive2OctetAsType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityTransitive2OctetAsType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum, set in ResultExtendedCommunityTransitive2OctetAsType - Choice() ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum - // setChoice assigns ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum provided by user to ResultExtendedCommunityTransitive2OctetAsType - setChoice(value ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum) ResultExtendedCommunityTransitive2OctetAsType - // HasChoice checks if Choice has been set in ResultExtendedCommunityTransitive2OctetAsType - HasChoice() bool - // RouteTargetSubtype returns ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget, set in ResultExtendedCommunityTransitive2OctetAsType. - // ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP Update message. It is sent with sub-type as 0x02. - RouteTargetSubtype() ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - // SetRouteTargetSubtype assigns ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget provided by user to ResultExtendedCommunityTransitive2OctetAsType. - // ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP Update message. It is sent with sub-type as 0x02. - SetRouteTargetSubtype(value ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive2OctetAsType - // HasRouteTargetSubtype checks if RouteTargetSubtype has been set in ResultExtendedCommunityTransitive2OctetAsType - HasRouteTargetSubtype() bool - // RouteOriginSubtype returns ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin, set in ResultExtendedCommunityTransitive2OctetAsType. - // ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03 . - RouteOriginSubtype() ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // SetRouteOriginSubtype assigns ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin provided by user to ResultExtendedCommunityTransitive2OctetAsType. - // ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03 . - SetRouteOriginSubtype(value ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive2OctetAsType - // HasRouteOriginSubtype checks if RouteOriginSubtype has been set in ResultExtendedCommunityTransitive2OctetAsType - HasRouteOriginSubtype() bool - setNil() -} - -type ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum string - -// Enum of Choice on ResultExtendedCommunityTransitive2OctetAsType -var ResultExtendedCommunityTransitive2OctetAsTypeChoice = struct { - ROUTE_TARGET_SUBTYPE ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum - ROUTE_ORIGIN_SUBTYPE ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum -}{ - ROUTE_TARGET_SUBTYPE: ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum("route_target_subtype"), - ROUTE_ORIGIN_SUBTYPE: ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum("route_origin_subtype"), -} - -func (obj *resultExtendedCommunityTransitive2OctetAsType) Choice() ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum { - return ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *resultExtendedCommunityTransitive2OctetAsType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *resultExtendedCommunityTransitive2OctetAsType) setChoice(value ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum) ResultExtendedCommunityTransitive2OctetAsType { - intValue, ok := otg.ResultExtendedCommunityTransitive2OctetAsType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.ResultExtendedCommunityTransitive2OctetAsType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.RouteOriginSubtype = nil - obj.routeOriginSubtypeHolder = nil - obj.obj.RouteTargetSubtype = nil - obj.routeTargetSubtypeHolder = nil - - if value == ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE { - obj.obj.RouteTargetSubtype = NewResultExtendedCommunityTransitive2OctetAsTypeRouteTarget().msg() - } - - if value == ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE { - obj.obj.RouteOriginSubtype = NewResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin().msg() - } - - return obj -} - -// description is TBD -// RouteTargetSubtype returns a ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget -func (obj *resultExtendedCommunityTransitive2OctetAsType) RouteTargetSubtype() ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { - if obj.obj.RouteTargetSubtype == nil { - obj.setChoice(ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) - } - if obj.routeTargetSubtypeHolder == nil { - obj.routeTargetSubtypeHolder = &resultExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: obj.obj.RouteTargetSubtype} - } - return obj.routeTargetSubtypeHolder -} - -// description is TBD -// RouteTargetSubtype returns a ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget -func (obj *resultExtendedCommunityTransitive2OctetAsType) HasRouteTargetSubtype() bool { - return obj.obj.RouteTargetSubtype != nil -} - -// description is TBD -// SetRouteTargetSubtype sets the ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget value in the ResultExtendedCommunityTransitive2OctetAsType object -func (obj *resultExtendedCommunityTransitive2OctetAsType) SetRouteTargetSubtype(value ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive2OctetAsType { - obj.setChoice(ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) - obj.routeTargetSubtypeHolder = nil - obj.obj.RouteTargetSubtype = value.msg() - - return obj -} - -// description is TBD -// RouteOriginSubtype returns a ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin -func (obj *resultExtendedCommunityTransitive2OctetAsType) RouteOriginSubtype() ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - if obj.obj.RouteOriginSubtype == nil { - obj.setChoice(ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) - } - if obj.routeOriginSubtypeHolder == nil { - obj.routeOriginSubtypeHolder = &resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: obj.obj.RouteOriginSubtype} - } - return obj.routeOriginSubtypeHolder -} - -// description is TBD -// RouteOriginSubtype returns a ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin -func (obj *resultExtendedCommunityTransitive2OctetAsType) HasRouteOriginSubtype() bool { - return obj.obj.RouteOriginSubtype != nil -} - -// description is TBD -// SetRouteOriginSubtype sets the ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin value in the ResultExtendedCommunityTransitive2OctetAsType object -func (obj *resultExtendedCommunityTransitive2OctetAsType) SetRouteOriginSubtype(value ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive2OctetAsType { - obj.setChoice(ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) - obj.routeOriginSubtypeHolder = nil - obj.obj.RouteOriginSubtype = value.msg() - - return obj -} - -func (obj *resultExtendedCommunityTransitive2OctetAsType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RouteTargetSubtype != nil { - - obj.RouteTargetSubtype().validateObj(vObj, set_default) - } - - if obj.obj.RouteOriginSubtype != nil { - - obj.RouteOriginSubtype().validateObj(vObj, set_default) - } - -} - -func (obj *resultExtendedCommunityTransitive2OctetAsType) setDefault() { - var choices_set int = 0 - var choice ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum - - if obj.obj.RouteTargetSubtype != nil { - choices_set += 1 - choice = ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE - } - - if obj.obj.RouteOriginSubtype != nil { - choices_set += 1 - choice = ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ResultExtendedCommunityTransitive2OctetAsType") - } - } else { - intVal := otg.ResultExtendedCommunityTransitive2OctetAsType_Choice_Enum_value[string(choice)] - enumValue := otg.ResultExtendedCommunityTransitive2OctetAsType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** ResultExtendedCommunityTransitiveIpv4AddressType ***** -type resultExtendedCommunityTransitiveIpv4AddressType struct { - validation - obj *otg.ResultExtendedCommunityTransitiveIpv4AddressType - marshaller marshalResultExtendedCommunityTransitiveIpv4AddressType - unMarshaller unMarshalResultExtendedCommunityTransitiveIpv4AddressType - routeTargetSubtypeHolder ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - routeOriginSubtypeHolder ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin -} - -func NewResultExtendedCommunityTransitiveIpv4AddressType() ResultExtendedCommunityTransitiveIpv4AddressType { - obj := resultExtendedCommunityTransitiveIpv4AddressType{obj: &otg.ResultExtendedCommunityTransitiveIpv4AddressType{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) msg() *otg.ResultExtendedCommunityTransitiveIpv4AddressType { - return obj.obj -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) setMsg(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressType) ResultExtendedCommunityTransitiveIpv4AddressType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityTransitiveIpv4AddressType struct { - obj *resultExtendedCommunityTransitiveIpv4AddressType -} - -type marshalResultExtendedCommunityTransitiveIpv4AddressType interface { - // ToProto marshals ResultExtendedCommunityTransitiveIpv4AddressType to protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressType - ToProto() (*otg.ResultExtendedCommunityTransitiveIpv4AddressType, error) - // ToPbText marshals ResultExtendedCommunityTransitiveIpv4AddressType to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityTransitiveIpv4AddressType to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityTransitiveIpv4AddressType to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityTransitiveIpv4AddressType struct { - obj *resultExtendedCommunityTransitiveIpv4AddressType -} - -type unMarshalResultExtendedCommunityTransitiveIpv4AddressType interface { - // FromProto unmarshals ResultExtendedCommunityTransitiveIpv4AddressType from protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressType - FromProto(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressType) (ResultExtendedCommunityTransitiveIpv4AddressType, error) - // FromPbText unmarshals ResultExtendedCommunityTransitiveIpv4AddressType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityTransitiveIpv4AddressType from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityTransitiveIpv4AddressType from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) Marshal() marshalResultExtendedCommunityTransitiveIpv4AddressType { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityTransitiveIpv4AddressType{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) Unmarshal() unMarshalResultExtendedCommunityTransitiveIpv4AddressType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityTransitiveIpv4AddressType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityTransitiveIpv4AddressType) ToProto() (*otg.ResultExtendedCommunityTransitiveIpv4AddressType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityTransitiveIpv4AddressType) FromProto(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressType) (ResultExtendedCommunityTransitiveIpv4AddressType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityTransitiveIpv4AddressType) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalresultExtendedCommunityTransitiveIpv4AddressType) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalresultExtendedCommunityTransitiveIpv4AddressType) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) Clone() (ResultExtendedCommunityTransitiveIpv4AddressType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityTransitiveIpv4AddressType() - 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 -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) setNil() { - obj.routeTargetSubtypeHolder = nil - obj.routeOriginSubtypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ResultExtendedCommunityTransitiveIpv4AddressType is the Transitive IPv4 Address Specific Extended Community is sent as type 0x01. -type ResultExtendedCommunityTransitiveIpv4AddressType interface { - Validation - // msg marshals ResultExtendedCommunityTransitiveIpv4AddressType to protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressType - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityTransitiveIpv4AddressType - // setMsg unmarshals ResultExtendedCommunityTransitiveIpv4AddressType from protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressType - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityTransitiveIpv4AddressType) ResultExtendedCommunityTransitiveIpv4AddressType - // provides marshal interface - Marshal() marshalResultExtendedCommunityTransitiveIpv4AddressType - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityTransitiveIpv4AddressType - // validate validates ResultExtendedCommunityTransitiveIpv4AddressType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityTransitiveIpv4AddressType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum, set in ResultExtendedCommunityTransitiveIpv4AddressType - Choice() ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum - // setChoice assigns ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum provided by user to ResultExtendedCommunityTransitiveIpv4AddressType - setChoice(value ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum) ResultExtendedCommunityTransitiveIpv4AddressType - // HasChoice checks if Choice has been set in ResultExtendedCommunityTransitiveIpv4AddressType - HasChoice() bool - // RouteTargetSubtype returns ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, set in ResultExtendedCommunityTransitiveIpv4AddressType. - // ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. - RouteTargetSubtype() ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // SetRouteTargetSubtype assigns ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget provided by user to ResultExtendedCommunityTransitiveIpv4AddressType. - // ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. - SetRouteTargetSubtype(value ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) ResultExtendedCommunityTransitiveIpv4AddressType - // HasRouteTargetSubtype checks if RouteTargetSubtype has been set in ResultExtendedCommunityTransitiveIpv4AddressType - HasRouteTargetSubtype() bool - // RouteOriginSubtype returns ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, set in ResultExtendedCommunityTransitiveIpv4AddressType. - // ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP It is sent with sub-type as 0x03. - RouteOriginSubtype() ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // SetRouteOriginSubtype assigns ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin provided by user to ResultExtendedCommunityTransitiveIpv4AddressType. - // ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP It is sent with sub-type as 0x03. - SetRouteOriginSubtype(value ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) ResultExtendedCommunityTransitiveIpv4AddressType - // HasRouteOriginSubtype checks if RouteOriginSubtype has been set in ResultExtendedCommunityTransitiveIpv4AddressType - HasRouteOriginSubtype() bool - setNil() -} - -type ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum string - -// Enum of Choice on ResultExtendedCommunityTransitiveIpv4AddressType -var ResultExtendedCommunityTransitiveIpv4AddressTypeChoice = struct { - ROUTE_TARGET_SUBTYPE ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum - ROUTE_ORIGIN_SUBTYPE ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum -}{ - ROUTE_TARGET_SUBTYPE: ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum("route_target_subtype"), - ROUTE_ORIGIN_SUBTYPE: ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum("route_origin_subtype"), -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) Choice() ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum { - return ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) setChoice(value ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum) ResultExtendedCommunityTransitiveIpv4AddressType { - intValue, ok := otg.ResultExtendedCommunityTransitiveIpv4AddressType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.ResultExtendedCommunityTransitiveIpv4AddressType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.RouteOriginSubtype = nil - obj.routeOriginSubtypeHolder = nil - obj.obj.RouteTargetSubtype = nil - obj.routeTargetSubtypeHolder = nil - - if value == ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE { - obj.obj.RouteTargetSubtype = NewResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget().msg() - } - - if value == ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE { - obj.obj.RouteOriginSubtype = NewResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin().msg() - } - - return obj -} - -// description is TBD -// RouteTargetSubtype returns a ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) RouteTargetSubtype() ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - if obj.obj.RouteTargetSubtype == nil { - obj.setChoice(ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE) - } - if obj.routeTargetSubtypeHolder == nil { - obj.routeTargetSubtypeHolder = &resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: obj.obj.RouteTargetSubtype} - } - return obj.routeTargetSubtypeHolder -} - -// description is TBD -// RouteTargetSubtype returns a ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) HasRouteTargetSubtype() bool { - return obj.obj.RouteTargetSubtype != nil -} - -// description is TBD -// SetRouteTargetSubtype sets the ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget value in the ResultExtendedCommunityTransitiveIpv4AddressType object -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) SetRouteTargetSubtype(value ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) ResultExtendedCommunityTransitiveIpv4AddressType { - obj.setChoice(ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE) - obj.routeTargetSubtypeHolder = nil - obj.obj.RouteTargetSubtype = value.msg() - - return obj -} - -// description is TBD -// RouteOriginSubtype returns a ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) RouteOriginSubtype() ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - if obj.obj.RouteOriginSubtype == nil { - obj.setChoice(ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE) - } - if obj.routeOriginSubtypeHolder == nil { - obj.routeOriginSubtypeHolder = &resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: obj.obj.RouteOriginSubtype} - } - return obj.routeOriginSubtypeHolder -} - -// description is TBD -// RouteOriginSubtype returns a ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) HasRouteOriginSubtype() bool { - return obj.obj.RouteOriginSubtype != nil -} - -// description is TBD -// SetRouteOriginSubtype sets the ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin value in the ResultExtendedCommunityTransitiveIpv4AddressType object -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) SetRouteOriginSubtype(value ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) ResultExtendedCommunityTransitiveIpv4AddressType { - obj.setChoice(ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE) - obj.routeOriginSubtypeHolder = nil - obj.obj.RouteOriginSubtype = value.msg() - - return obj -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RouteTargetSubtype != nil { - - obj.RouteTargetSubtype().validateObj(vObj, set_default) - } - - if obj.obj.RouteOriginSubtype != nil { - - obj.RouteOriginSubtype().validateObj(vObj, set_default) - } - -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressType) setDefault() { - var choices_set int = 0 - var choice ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum - - if obj.obj.RouteTargetSubtype != nil { - choices_set += 1 - choice = ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE - } - - if obj.obj.RouteOriginSubtype != nil { - choices_set += 1 - choice = ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ResultExtendedCommunityTransitiveIpv4AddressType") - } - } else { - intVal := otg.ResultExtendedCommunityTransitiveIpv4AddressType_Choice_Enum_value[string(choice)] - enumValue := otg.ResultExtendedCommunityTransitiveIpv4AddressType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** ResultExtendedCommunityTransitive4OctetAsType ***** -type resultExtendedCommunityTransitive4OctetAsType struct { - validation - obj *otg.ResultExtendedCommunityTransitive4OctetAsType - marshaller marshalResultExtendedCommunityTransitive4OctetAsType - unMarshaller unMarshalResultExtendedCommunityTransitive4OctetAsType - routeTargetSubtypeHolder ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - routeOriginSubtypeHolder ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin -} - -func NewResultExtendedCommunityTransitive4OctetAsType() ResultExtendedCommunityTransitive4OctetAsType { - obj := resultExtendedCommunityTransitive4OctetAsType{obj: &otg.ResultExtendedCommunityTransitive4OctetAsType{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityTransitive4OctetAsType) msg() *otg.ResultExtendedCommunityTransitive4OctetAsType { - return obj.obj -} - -func (obj *resultExtendedCommunityTransitive4OctetAsType) setMsg(msg *otg.ResultExtendedCommunityTransitive4OctetAsType) ResultExtendedCommunityTransitive4OctetAsType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityTransitive4OctetAsType struct { - obj *resultExtendedCommunityTransitive4OctetAsType -} - -type marshalResultExtendedCommunityTransitive4OctetAsType interface { - // ToProto marshals ResultExtendedCommunityTransitive4OctetAsType to protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsType - ToProto() (*otg.ResultExtendedCommunityTransitive4OctetAsType, error) - // ToPbText marshals ResultExtendedCommunityTransitive4OctetAsType to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityTransitive4OctetAsType to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityTransitive4OctetAsType to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityTransitive4OctetAsType struct { - obj *resultExtendedCommunityTransitive4OctetAsType -} - -type unMarshalResultExtendedCommunityTransitive4OctetAsType interface { - // FromProto unmarshals ResultExtendedCommunityTransitive4OctetAsType from protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsType - FromProto(msg *otg.ResultExtendedCommunityTransitive4OctetAsType) (ResultExtendedCommunityTransitive4OctetAsType, error) - // FromPbText unmarshals ResultExtendedCommunityTransitive4OctetAsType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityTransitive4OctetAsType from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityTransitive4OctetAsType from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityTransitive4OctetAsType) Marshal() marshalResultExtendedCommunityTransitive4OctetAsType { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityTransitive4OctetAsType{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityTransitive4OctetAsType) Unmarshal() unMarshalResultExtendedCommunityTransitive4OctetAsType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityTransitive4OctetAsType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityTransitive4OctetAsType) ToProto() (*otg.ResultExtendedCommunityTransitive4OctetAsType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityTransitive4OctetAsType) FromProto(msg *otg.ResultExtendedCommunityTransitive4OctetAsType) (ResultExtendedCommunityTransitive4OctetAsType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityTransitive4OctetAsType) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalresultExtendedCommunityTransitive4OctetAsType) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalresultExtendedCommunityTransitive4OctetAsType) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *resultExtendedCommunityTransitive4OctetAsType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitive4OctetAsType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitive4OctetAsType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityTransitive4OctetAsType) Clone() (ResultExtendedCommunityTransitive4OctetAsType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityTransitive4OctetAsType() - 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 -} - -func (obj *resultExtendedCommunityTransitive4OctetAsType) setNil() { - obj.routeTargetSubtypeHolder = nil - obj.routeOriginSubtypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ResultExtendedCommunityTransitive4OctetAsType is the Transitive Four-Octet AS-Specific Extended Community is sent as type 0x02. It is defined in RFC 5668. -type ResultExtendedCommunityTransitive4OctetAsType interface { - Validation - // msg marshals ResultExtendedCommunityTransitive4OctetAsType to protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsType - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityTransitive4OctetAsType - // setMsg unmarshals ResultExtendedCommunityTransitive4OctetAsType from protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsType - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityTransitive4OctetAsType) ResultExtendedCommunityTransitive4OctetAsType - // provides marshal interface - Marshal() marshalResultExtendedCommunityTransitive4OctetAsType - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityTransitive4OctetAsType - // validate validates ResultExtendedCommunityTransitive4OctetAsType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityTransitive4OctetAsType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum, set in ResultExtendedCommunityTransitive4OctetAsType - Choice() ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum - // setChoice assigns ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum provided by user to ResultExtendedCommunityTransitive4OctetAsType - setChoice(value ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum) ResultExtendedCommunityTransitive4OctetAsType - // HasChoice checks if Choice has been set in ResultExtendedCommunityTransitive4OctetAsType - HasChoice() bool - // RouteTargetSubtype returns ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget, set in ResultExtendedCommunityTransitive4OctetAsType. - // ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02 - RouteTargetSubtype() ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - // SetRouteTargetSubtype assigns ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget provided by user to ResultExtendedCommunityTransitive4OctetAsType. - // ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02 - SetRouteTargetSubtype(value ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive4OctetAsType - // HasRouteTargetSubtype checks if RouteTargetSubtype has been set in ResultExtendedCommunityTransitive4OctetAsType - HasRouteTargetSubtype() bool - // RouteOriginSubtype returns ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin, set in ResultExtendedCommunityTransitive4OctetAsType. - // ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03. - RouteOriginSubtype() ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // SetRouteOriginSubtype assigns ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin provided by user to ResultExtendedCommunityTransitive4OctetAsType. - // ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03. - SetRouteOriginSubtype(value ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive4OctetAsType - // HasRouteOriginSubtype checks if RouteOriginSubtype has been set in ResultExtendedCommunityTransitive4OctetAsType - HasRouteOriginSubtype() bool - setNil() -} - -type ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum string - -// Enum of Choice on ResultExtendedCommunityTransitive4OctetAsType -var ResultExtendedCommunityTransitive4OctetAsTypeChoice = struct { - ROUTE_TARGET_SUBTYPE ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum - ROUTE_ORIGIN_SUBTYPE ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum -}{ - ROUTE_TARGET_SUBTYPE: ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum("route_target_subtype"), - ROUTE_ORIGIN_SUBTYPE: ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum("route_origin_subtype"), -} - -func (obj *resultExtendedCommunityTransitive4OctetAsType) Choice() ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum { - return ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *resultExtendedCommunityTransitive4OctetAsType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *resultExtendedCommunityTransitive4OctetAsType) setChoice(value ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum) ResultExtendedCommunityTransitive4OctetAsType { - intValue, ok := otg.ResultExtendedCommunityTransitive4OctetAsType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.ResultExtendedCommunityTransitive4OctetAsType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.RouteOriginSubtype = nil - obj.routeOriginSubtypeHolder = nil - obj.obj.RouteTargetSubtype = nil - obj.routeTargetSubtypeHolder = nil - - if value == ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE { - obj.obj.RouteTargetSubtype = NewResultExtendedCommunityTransitive4OctetAsTypeRouteTarget().msg() - } - - if value == ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE { - obj.obj.RouteOriginSubtype = NewResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin().msg() - } - - return obj -} - -// description is TBD -// RouteTargetSubtype returns a ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget -func (obj *resultExtendedCommunityTransitive4OctetAsType) RouteTargetSubtype() ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { - if obj.obj.RouteTargetSubtype == nil { - obj.setChoice(ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) - } - if obj.routeTargetSubtypeHolder == nil { - obj.routeTargetSubtypeHolder = &resultExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: obj.obj.RouteTargetSubtype} - } - return obj.routeTargetSubtypeHolder -} - -// description is TBD -// RouteTargetSubtype returns a ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget -func (obj *resultExtendedCommunityTransitive4OctetAsType) HasRouteTargetSubtype() bool { - return obj.obj.RouteTargetSubtype != nil -} - -// description is TBD -// SetRouteTargetSubtype sets the ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget value in the ResultExtendedCommunityTransitive4OctetAsType object -func (obj *resultExtendedCommunityTransitive4OctetAsType) SetRouteTargetSubtype(value ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive4OctetAsType { - obj.setChoice(ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) - obj.routeTargetSubtypeHolder = nil - obj.obj.RouteTargetSubtype = value.msg() - - return obj -} - -// description is TBD -// RouteOriginSubtype returns a ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin -func (obj *resultExtendedCommunityTransitive4OctetAsType) RouteOriginSubtype() ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - if obj.obj.RouteOriginSubtype == nil { - obj.setChoice(ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) - } - if obj.routeOriginSubtypeHolder == nil { - obj.routeOriginSubtypeHolder = &resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: obj.obj.RouteOriginSubtype} - } - return obj.routeOriginSubtypeHolder -} - -// description is TBD -// RouteOriginSubtype returns a ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin -func (obj *resultExtendedCommunityTransitive4OctetAsType) HasRouteOriginSubtype() bool { - return obj.obj.RouteOriginSubtype != nil -} - -// description is TBD -// SetRouteOriginSubtype sets the ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin value in the ResultExtendedCommunityTransitive4OctetAsType object -func (obj *resultExtendedCommunityTransitive4OctetAsType) SetRouteOriginSubtype(value ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive4OctetAsType { - obj.setChoice(ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) - obj.routeOriginSubtypeHolder = nil - obj.obj.RouteOriginSubtype = value.msg() - - return obj -} - -func (obj *resultExtendedCommunityTransitive4OctetAsType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RouteTargetSubtype != nil { - - obj.RouteTargetSubtype().validateObj(vObj, set_default) - } - - if obj.obj.RouteOriginSubtype != nil { - - obj.RouteOriginSubtype().validateObj(vObj, set_default) - } - -} - -func (obj *resultExtendedCommunityTransitive4OctetAsType) setDefault() { - var choices_set int = 0 - var choice ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum - - if obj.obj.RouteTargetSubtype != nil { - choices_set += 1 - choice = ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE - } - - if obj.obj.RouteOriginSubtype != nil { - choices_set += 1 - choice = ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ResultExtendedCommunityTransitive4OctetAsType") - } - } else { - intVal := otg.ResultExtendedCommunityTransitive4OctetAsType_Choice_Enum_value[string(choice)] - enumValue := otg.ResultExtendedCommunityTransitive4OctetAsType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** ResultExtendedCommunityTransitiveOpaqueType ***** -type resultExtendedCommunityTransitiveOpaqueType struct { - validation - obj *otg.ResultExtendedCommunityTransitiveOpaqueType - marshaller marshalResultExtendedCommunityTransitiveOpaqueType - unMarshaller unMarshalResultExtendedCommunityTransitiveOpaqueType - colorSubtypeHolder ResultExtendedCommunityTransitiveOpaqueTypeColor - encapsulationSubtypeHolder ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation -} - -func NewResultExtendedCommunityTransitiveOpaqueType() ResultExtendedCommunityTransitiveOpaqueType { - obj := resultExtendedCommunityTransitiveOpaqueType{obj: &otg.ResultExtendedCommunityTransitiveOpaqueType{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityTransitiveOpaqueType) msg() *otg.ResultExtendedCommunityTransitiveOpaqueType { - return obj.obj -} - -func (obj *resultExtendedCommunityTransitiveOpaqueType) setMsg(msg *otg.ResultExtendedCommunityTransitiveOpaqueType) ResultExtendedCommunityTransitiveOpaqueType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityTransitiveOpaqueType struct { - obj *resultExtendedCommunityTransitiveOpaqueType -} - -type marshalResultExtendedCommunityTransitiveOpaqueType interface { - // ToProto marshals ResultExtendedCommunityTransitiveOpaqueType to protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueType - ToProto() (*otg.ResultExtendedCommunityTransitiveOpaqueType, error) - // ToPbText marshals ResultExtendedCommunityTransitiveOpaqueType to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityTransitiveOpaqueType to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityTransitiveOpaqueType to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityTransitiveOpaqueType struct { - obj *resultExtendedCommunityTransitiveOpaqueType -} - -type unMarshalResultExtendedCommunityTransitiveOpaqueType interface { - // FromProto unmarshals ResultExtendedCommunityTransitiveOpaqueType from protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueType - FromProto(msg *otg.ResultExtendedCommunityTransitiveOpaqueType) (ResultExtendedCommunityTransitiveOpaqueType, error) - // FromPbText unmarshals ResultExtendedCommunityTransitiveOpaqueType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityTransitiveOpaqueType from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityTransitiveOpaqueType from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityTransitiveOpaqueType) Marshal() marshalResultExtendedCommunityTransitiveOpaqueType { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityTransitiveOpaqueType{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityTransitiveOpaqueType) Unmarshal() unMarshalResultExtendedCommunityTransitiveOpaqueType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityTransitiveOpaqueType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityTransitiveOpaqueType) ToProto() (*otg.ResultExtendedCommunityTransitiveOpaqueType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityTransitiveOpaqueType) FromProto(msg *otg.ResultExtendedCommunityTransitiveOpaqueType) (ResultExtendedCommunityTransitiveOpaqueType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityTransitiveOpaqueType) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalresultExtendedCommunityTransitiveOpaqueType) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalresultExtendedCommunityTransitiveOpaqueType) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *resultExtendedCommunityTransitiveOpaqueType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitiveOpaqueType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitiveOpaqueType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityTransitiveOpaqueType) Clone() (ResultExtendedCommunityTransitiveOpaqueType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityTransitiveOpaqueType() - 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 -} - -func (obj *resultExtendedCommunityTransitiveOpaqueType) setNil() { - obj.colorSubtypeHolder = nil - obj.encapsulationSubtypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ResultExtendedCommunityTransitiveOpaqueType is the Transitive Opaque Extended Community is sent as type 0x03. -type ResultExtendedCommunityTransitiveOpaqueType interface { - Validation - // msg marshals ResultExtendedCommunityTransitiveOpaqueType to protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueType - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityTransitiveOpaqueType - // setMsg unmarshals ResultExtendedCommunityTransitiveOpaqueType from protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueType - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityTransitiveOpaqueType) ResultExtendedCommunityTransitiveOpaqueType - // provides marshal interface - Marshal() marshalResultExtendedCommunityTransitiveOpaqueType - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityTransitiveOpaqueType - // validate validates ResultExtendedCommunityTransitiveOpaqueType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityTransitiveOpaqueType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum, set in ResultExtendedCommunityTransitiveOpaqueType - Choice() ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum - // setChoice assigns ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum provided by user to ResultExtendedCommunityTransitiveOpaqueType - setChoice(value ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum) ResultExtendedCommunityTransitiveOpaqueType - // HasChoice checks if Choice has been set in ResultExtendedCommunityTransitiveOpaqueType - HasChoice() bool - // ColorSubtype returns ResultExtendedCommunityTransitiveOpaqueTypeColor, set in ResultExtendedCommunityTransitiveOpaqueType. - // ResultExtendedCommunityTransitiveOpaqueTypeColor is the Color Community contains locally administrator defined 'color' value which is used in conjunction with Encapsulation attribute to decide whether a data packet can be transmitted on a certain tunnel or not. It is defined in RFC9012 and sent with sub-type as 0x0b. - ColorSubtype() ResultExtendedCommunityTransitiveOpaqueTypeColor - // SetColorSubtype assigns ResultExtendedCommunityTransitiveOpaqueTypeColor provided by user to ResultExtendedCommunityTransitiveOpaqueType. - // ResultExtendedCommunityTransitiveOpaqueTypeColor is the Color Community contains locally administrator defined 'color' value which is used in conjunction with Encapsulation attribute to decide whether a data packet can be transmitted on a certain tunnel or not. It is defined in RFC9012 and sent with sub-type as 0x0b. - SetColorSubtype(value ResultExtendedCommunityTransitiveOpaqueTypeColor) ResultExtendedCommunityTransitiveOpaqueType - // HasColorSubtype checks if ColorSubtype has been set in ResultExtendedCommunityTransitiveOpaqueType - HasColorSubtype() bool - // EncapsulationSubtype returns ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation, set in ResultExtendedCommunityTransitiveOpaqueType. - // ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation is this identifies the type of tunneling technology being signalled. It is defined in RFC9012 and sent with sub-type as 0x0c. - EncapsulationSubtype() ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - // SetEncapsulationSubtype assigns ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation provided by user to ResultExtendedCommunityTransitiveOpaqueType. - // ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation is this identifies the type of tunneling technology being signalled. It is defined in RFC9012 and sent with sub-type as 0x0c. - SetEncapsulationSubtype(value ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation) ResultExtendedCommunityTransitiveOpaqueType - // HasEncapsulationSubtype checks if EncapsulationSubtype has been set in ResultExtendedCommunityTransitiveOpaqueType - HasEncapsulationSubtype() bool - setNil() -} - -type ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum string - -// Enum of Choice on ResultExtendedCommunityTransitiveOpaqueType -var ResultExtendedCommunityTransitiveOpaqueTypeChoice = struct { - COLOR_SUBTYPE ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum - ENCAPSULATION_SUBTYPE ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum -}{ - COLOR_SUBTYPE: ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum("color_subtype"), - ENCAPSULATION_SUBTYPE: ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum("encapsulation_subtype"), -} - -func (obj *resultExtendedCommunityTransitiveOpaqueType) Choice() ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum { - return ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *resultExtendedCommunityTransitiveOpaqueType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *resultExtendedCommunityTransitiveOpaqueType) setChoice(value ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum) ResultExtendedCommunityTransitiveOpaqueType { - intValue, ok := otg.ResultExtendedCommunityTransitiveOpaqueType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.ResultExtendedCommunityTransitiveOpaqueType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.EncapsulationSubtype = nil - obj.encapsulationSubtypeHolder = nil - obj.obj.ColorSubtype = nil - obj.colorSubtypeHolder = nil - - if value == ResultExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE { - obj.obj.ColorSubtype = NewResultExtendedCommunityTransitiveOpaqueTypeColor().msg() - } - - if value == ResultExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE { - obj.obj.EncapsulationSubtype = NewResultExtendedCommunityTransitiveOpaqueTypeEncapsulation().msg() - } - - return obj -} - -// description is TBD -// ColorSubtype returns a ResultExtendedCommunityTransitiveOpaqueTypeColor -func (obj *resultExtendedCommunityTransitiveOpaqueType) ColorSubtype() ResultExtendedCommunityTransitiveOpaqueTypeColor { - if obj.obj.ColorSubtype == nil { - obj.setChoice(ResultExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE) - } - if obj.colorSubtypeHolder == nil { - obj.colorSubtypeHolder = &resultExtendedCommunityTransitiveOpaqueTypeColor{obj: obj.obj.ColorSubtype} - } - return obj.colorSubtypeHolder -} - -// description is TBD -// ColorSubtype returns a ResultExtendedCommunityTransitiveOpaqueTypeColor -func (obj *resultExtendedCommunityTransitiveOpaqueType) HasColorSubtype() bool { - return obj.obj.ColorSubtype != nil -} - -// description is TBD -// SetColorSubtype sets the ResultExtendedCommunityTransitiveOpaqueTypeColor value in the ResultExtendedCommunityTransitiveOpaqueType object -func (obj *resultExtendedCommunityTransitiveOpaqueType) SetColorSubtype(value ResultExtendedCommunityTransitiveOpaqueTypeColor) ResultExtendedCommunityTransitiveOpaqueType { - obj.setChoice(ResultExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE) - obj.colorSubtypeHolder = nil - obj.obj.ColorSubtype = value.msg() - - return obj -} - -// description is TBD -// EncapsulationSubtype returns a ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation -func (obj *resultExtendedCommunityTransitiveOpaqueType) EncapsulationSubtype() ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { - if obj.obj.EncapsulationSubtype == nil { - obj.setChoice(ResultExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE) - } - if obj.encapsulationSubtypeHolder == nil { - obj.encapsulationSubtypeHolder = &resultExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: obj.obj.EncapsulationSubtype} - } - return obj.encapsulationSubtypeHolder -} - -// description is TBD -// EncapsulationSubtype returns a ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation -func (obj *resultExtendedCommunityTransitiveOpaqueType) HasEncapsulationSubtype() bool { - return obj.obj.EncapsulationSubtype != nil -} - -// description is TBD -// SetEncapsulationSubtype sets the ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation value in the ResultExtendedCommunityTransitiveOpaqueType object -func (obj *resultExtendedCommunityTransitiveOpaqueType) SetEncapsulationSubtype(value ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation) ResultExtendedCommunityTransitiveOpaqueType { - obj.setChoice(ResultExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE) - obj.encapsulationSubtypeHolder = nil - obj.obj.EncapsulationSubtype = value.msg() - - return obj -} - -func (obj *resultExtendedCommunityTransitiveOpaqueType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.ColorSubtype != nil { - - obj.ColorSubtype().validateObj(vObj, set_default) - } - - if obj.obj.EncapsulationSubtype != nil { - - obj.EncapsulationSubtype().validateObj(vObj, set_default) - } - -} - -func (obj *resultExtendedCommunityTransitiveOpaqueType) setDefault() { - var choices_set int = 0 - var choice ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum - - if obj.obj.ColorSubtype != nil { - choices_set += 1 - choice = ResultExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE - } - - if obj.obj.EncapsulationSubtype != nil { - choices_set += 1 - choice = ResultExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ResultExtendedCommunityTransitiveOpaqueType") - } - } else { - intVal := otg.ResultExtendedCommunityTransitiveOpaqueType_Choice_Enum_value[string(choice)] - enumValue := otg.ResultExtendedCommunityTransitiveOpaqueType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** ResultExtendedCommunityNonTransitive2OctetAsType ***** -type resultExtendedCommunityNonTransitive2OctetAsType struct { - validation - obj *otg.ResultExtendedCommunityNonTransitive2OctetAsType - marshaller marshalResultExtendedCommunityNonTransitive2OctetAsType - unMarshaller unMarshalResultExtendedCommunityNonTransitive2OctetAsType - linkBandwidthSubtypeHolder ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth -} - -func NewResultExtendedCommunityNonTransitive2OctetAsType() ResultExtendedCommunityNonTransitive2OctetAsType { - obj := resultExtendedCommunityNonTransitive2OctetAsType{obj: &otg.ResultExtendedCommunityNonTransitive2OctetAsType{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) msg() *otg.ResultExtendedCommunityNonTransitive2OctetAsType { - return obj.obj -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) setMsg(msg *otg.ResultExtendedCommunityNonTransitive2OctetAsType) ResultExtendedCommunityNonTransitive2OctetAsType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityNonTransitive2OctetAsType struct { - obj *resultExtendedCommunityNonTransitive2OctetAsType -} - -type marshalResultExtendedCommunityNonTransitive2OctetAsType interface { - // ToProto marshals ResultExtendedCommunityNonTransitive2OctetAsType to protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsType - ToProto() (*otg.ResultExtendedCommunityNonTransitive2OctetAsType, error) - // ToPbText marshals ResultExtendedCommunityNonTransitive2OctetAsType to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityNonTransitive2OctetAsType to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityNonTransitive2OctetAsType to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityNonTransitive2OctetAsType struct { - obj *resultExtendedCommunityNonTransitive2OctetAsType -} - -type unMarshalResultExtendedCommunityNonTransitive2OctetAsType interface { - // FromProto unmarshals ResultExtendedCommunityNonTransitive2OctetAsType from protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsType - FromProto(msg *otg.ResultExtendedCommunityNonTransitive2OctetAsType) (ResultExtendedCommunityNonTransitive2OctetAsType, error) - // FromPbText unmarshals ResultExtendedCommunityNonTransitive2OctetAsType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityNonTransitive2OctetAsType from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityNonTransitive2OctetAsType from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) Marshal() marshalResultExtendedCommunityNonTransitive2OctetAsType { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityNonTransitive2OctetAsType{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) Unmarshal() unMarshalResultExtendedCommunityNonTransitive2OctetAsType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityNonTransitive2OctetAsType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityNonTransitive2OctetAsType) ToProto() (*otg.ResultExtendedCommunityNonTransitive2OctetAsType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityNonTransitive2OctetAsType) FromProto(msg *otg.ResultExtendedCommunityNonTransitive2OctetAsType) (ResultExtendedCommunityNonTransitive2OctetAsType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityNonTransitive2OctetAsType) 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 *unMarshalresultExtendedCommunityNonTransitive2OctetAsType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalresultExtendedCommunityNonTransitive2OctetAsType) 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 *unMarshalresultExtendedCommunityNonTransitive2OctetAsType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalresultExtendedCommunityNonTransitive2OctetAsType) 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 *unMarshalresultExtendedCommunityNonTransitive2OctetAsType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) Clone() (ResultExtendedCommunityNonTransitive2OctetAsType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityNonTransitive2OctetAsType() - 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 -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) setNil() { - obj.linkBandwidthSubtypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// ResultExtendedCommunityNonTransitive2OctetAsType is the Non-Transitive Two-Octet AS-Specific Extended Community is sent as type 0x40. -type ResultExtendedCommunityNonTransitive2OctetAsType interface { - Validation - // msg marshals ResultExtendedCommunityNonTransitive2OctetAsType to protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsType - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityNonTransitive2OctetAsType - // setMsg unmarshals ResultExtendedCommunityNonTransitive2OctetAsType from protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsType - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityNonTransitive2OctetAsType) ResultExtendedCommunityNonTransitive2OctetAsType - // provides marshal interface - Marshal() marshalResultExtendedCommunityNonTransitive2OctetAsType - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityNonTransitive2OctetAsType - // validate validates ResultExtendedCommunityNonTransitive2OctetAsType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityNonTransitive2OctetAsType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum, set in ResultExtendedCommunityNonTransitive2OctetAsType - Choice() ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum - // setChoice assigns ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum provided by user to ResultExtendedCommunityNonTransitive2OctetAsType - setChoice(value ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum) ResultExtendedCommunityNonTransitive2OctetAsType - // HasChoice checks if Choice has been set in ResultExtendedCommunityNonTransitive2OctetAsType - HasChoice() bool - // LinkBandwidthSubtype returns ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, set in ResultExtendedCommunityNonTransitive2OctetAsType. - // ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth is the Link Bandwidth Extended Community attribute is defined in draft-ietf-idr-link-bandwidth. It is sent with sub-type as 0x04. - LinkBandwidthSubtype() ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // SetLinkBandwidthSubtype assigns ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth provided by user to ResultExtendedCommunityNonTransitive2OctetAsType. - // ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth is the Link Bandwidth Extended Community attribute is defined in draft-ietf-idr-link-bandwidth. It is sent with sub-type as 0x04. - SetLinkBandwidthSubtype(value ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) ResultExtendedCommunityNonTransitive2OctetAsType - // HasLinkBandwidthSubtype checks if LinkBandwidthSubtype has been set in ResultExtendedCommunityNonTransitive2OctetAsType - HasLinkBandwidthSubtype() bool - setNil() -} - -type ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum string - -// Enum of Choice on ResultExtendedCommunityNonTransitive2OctetAsType -var ResultExtendedCommunityNonTransitive2OctetAsTypeChoice = struct { - LINK_BANDWIDTH_SUBTYPE ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum -}{ - LINK_BANDWIDTH_SUBTYPE: ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum("link_bandwidth_subtype"), -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) Choice() ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum { - return ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) setChoice(value ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum) ResultExtendedCommunityNonTransitive2OctetAsType { - intValue, ok := otg.ResultExtendedCommunityNonTransitive2OctetAsType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.ResultExtendedCommunityNonTransitive2OctetAsType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.LinkBandwidthSubtype = nil - obj.linkBandwidthSubtypeHolder = nil - - if value == ResultExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE { - obj.obj.LinkBandwidthSubtype = NewResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth().msg() - } - - return obj -} - -// description is TBD -// LinkBandwidthSubtype returns a ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) LinkBandwidthSubtype() ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - if obj.obj.LinkBandwidthSubtype == nil { - obj.setChoice(ResultExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE) - } - if obj.linkBandwidthSubtypeHolder == nil { - obj.linkBandwidthSubtypeHolder = &resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: obj.obj.LinkBandwidthSubtype} - } - return obj.linkBandwidthSubtypeHolder -} - -// description is TBD -// LinkBandwidthSubtype returns a ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) HasLinkBandwidthSubtype() bool { - return obj.obj.LinkBandwidthSubtype != nil -} - -// description is TBD -// SetLinkBandwidthSubtype sets the ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth value in the ResultExtendedCommunityNonTransitive2OctetAsType object -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) SetLinkBandwidthSubtype(value ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) ResultExtendedCommunityNonTransitive2OctetAsType { - obj.setChoice(ResultExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE) - obj.linkBandwidthSubtypeHolder = nil - obj.obj.LinkBandwidthSubtype = value.msg() - - return obj -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.LinkBandwidthSubtype != nil { - - obj.LinkBandwidthSubtype().validateObj(vObj, set_default) - } - -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsType) setDefault() { - var choices_set int = 0 - var choice ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum - - if obj.obj.LinkBandwidthSubtype != nil { - choices_set += 1 - choice = ResultExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ResultExtendedCommunityNonTransitive2OctetAsType") - } - } else { - intVal := otg.ResultExtendedCommunityNonTransitive2OctetAsType_Choice_Enum_value[string(choice)] - enumValue := otg.ResultExtendedCommunityNonTransitive2OctetAsType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** IsisLspneighbor ***** -type isisLspneighbor struct { - validation - obj *otg.IsisLspneighbor - marshaller marshalIsisLspneighbor - unMarshaller unMarshalIsisLspneighbor -} - -func NewIsisLspneighbor() IsisLspneighbor { - obj := isisLspneighbor{obj: &otg.IsisLspneighbor{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspneighbor) msg() *otg.IsisLspneighbor { - return obj.obj -} - -func (obj *isisLspneighbor) setMsg(msg *otg.IsisLspneighbor) IsisLspneighbor { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspneighbor struct { - obj *isisLspneighbor -} - -type marshalIsisLspneighbor interface { - // ToProto marshals IsisLspneighbor to protobuf object *otg.IsisLspneighbor - ToProto() (*otg.IsisLspneighbor, error) - // ToPbText marshals IsisLspneighbor to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspneighbor to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspneighbor to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspneighbor struct { - obj *isisLspneighbor -} - -type unMarshalIsisLspneighbor interface { - // FromProto unmarshals IsisLspneighbor from protobuf object *otg.IsisLspneighbor - FromProto(msg *otg.IsisLspneighbor) (IsisLspneighbor, error) - // FromPbText unmarshals IsisLspneighbor from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspneighbor from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspneighbor from JSON text - FromJson(value string) error -} - -func (obj *isisLspneighbor) Marshal() marshalIsisLspneighbor { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspneighbor{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspneighbor) Unmarshal() unMarshalIsisLspneighbor { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspneighbor{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspneighbor) ToProto() (*otg.IsisLspneighbor, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspneighbor) FromProto(msg *otg.IsisLspneighbor) (IsisLspneighbor, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspneighbor) 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 *unMarshalisisLspneighbor) 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 *marshalisisLspneighbor) 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 *unMarshalisisLspneighbor) 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 *marshalisisLspneighbor) 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 *unMarshalisisLspneighbor) 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 *isisLspneighbor) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspneighbor) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspneighbor) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspneighbor) Clone() (IsisLspneighbor, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspneighbor() - 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 -} - -// IsisLspneighbor is this contains IS neighbors. -type IsisLspneighbor interface { - Validation - // msg marshals IsisLspneighbor to protobuf object *otg.IsisLspneighbor - // and doesn't set defaults - msg() *otg.IsisLspneighbor - // setMsg unmarshals IsisLspneighbor from protobuf object *otg.IsisLspneighbor - // and doesn't set defaults - setMsg(*otg.IsisLspneighbor) IsisLspneighbor - // provides marshal interface - Marshal() marshalIsisLspneighbor - // provides unmarshal interface - Unmarshal() unMarshalIsisLspneighbor - // validate validates IsisLspneighbor - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspneighbor, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // SystemId returns string, set in IsisLspneighbor. - SystemId() string - // SetSystemId assigns string provided by user to IsisLspneighbor - SetSystemId(value string) IsisLspneighbor - // HasSystemId checks if SystemId has been set in IsisLspneighbor - HasSystemId() bool -} - -// The System ID for this emulated ISIS router, e.g. "640100010000". -// SystemId returns a string -func (obj *isisLspneighbor) SystemId() string { - - return *obj.obj.SystemId - -} - -// The System ID for this emulated ISIS router, e.g. "640100010000". -// SystemId returns a string -func (obj *isisLspneighbor) HasSystemId() bool { - return obj.obj.SystemId != nil -} - -// The System ID for this emulated ISIS router, e.g. "640100010000". -// SetSystemId sets the string value in the IsisLspneighbor object -func (obj *isisLspneighbor) SetSystemId(value string) IsisLspneighbor { - - obj.obj.SystemId = &value - return obj -} - -func (obj *isisLspneighbor) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.SystemId != nil { - - err := obj.validateHex(obj.SystemId()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on IsisLspneighbor.SystemId")) - } - - } - -} - -func (obj *isisLspneighbor) setDefault() { - -} - -// ***** IsisLspV4Prefix ***** -type isisLspV4Prefix struct { - validation - obj *otg.IsisLspV4Prefix - marshaller marshalIsisLspV4Prefix - unMarshaller unMarshalIsisLspV4Prefix -} - -func NewIsisLspV4Prefix() IsisLspV4Prefix { - obj := isisLspV4Prefix{obj: &otg.IsisLspV4Prefix{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspV4Prefix) msg() *otg.IsisLspV4Prefix { - return obj.obj -} - -func (obj *isisLspV4Prefix) setMsg(msg *otg.IsisLspV4Prefix) IsisLspV4Prefix { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspV4Prefix struct { - obj *isisLspV4Prefix -} - -type marshalIsisLspV4Prefix interface { - // ToProto marshals IsisLspV4Prefix to protobuf object *otg.IsisLspV4Prefix - ToProto() (*otg.IsisLspV4Prefix, error) - // ToPbText marshals IsisLspV4Prefix to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspV4Prefix to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspV4Prefix to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspV4Prefix struct { - obj *isisLspV4Prefix -} - -type unMarshalIsisLspV4Prefix interface { - // FromProto unmarshals IsisLspV4Prefix from protobuf object *otg.IsisLspV4Prefix - FromProto(msg *otg.IsisLspV4Prefix) (IsisLspV4Prefix, error) - // FromPbText unmarshals IsisLspV4Prefix from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspV4Prefix from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspV4Prefix from JSON text - FromJson(value string) error -} - -func (obj *isisLspV4Prefix) Marshal() marshalIsisLspV4Prefix { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspV4Prefix{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspV4Prefix) Unmarshal() unMarshalIsisLspV4Prefix { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspV4Prefix{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspV4Prefix) ToProto() (*otg.IsisLspV4Prefix, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspV4Prefix) FromProto(msg *otg.IsisLspV4Prefix) (IsisLspV4Prefix, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspV4Prefix) 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 *unMarshalisisLspV4Prefix) 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 *marshalisisLspV4Prefix) 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 *unMarshalisisLspV4Prefix) 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 *marshalisisLspV4Prefix) 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 *unMarshalisisLspV4Prefix) 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 *isisLspV4Prefix) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspV4Prefix) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspV4Prefix) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspV4Prefix) Clone() (IsisLspV4Prefix, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspV4Prefix() - 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 -} - -// IsisLspV4Prefix is this group defines attributes of an IPv4 standard prefix. -type IsisLspV4Prefix interface { - Validation - // msg marshals IsisLspV4Prefix to protobuf object *otg.IsisLspV4Prefix - // and doesn't set defaults - msg() *otg.IsisLspV4Prefix - // setMsg unmarshals IsisLspV4Prefix from protobuf object *otg.IsisLspV4Prefix - // and doesn't set defaults - setMsg(*otg.IsisLspV4Prefix) IsisLspV4Prefix - // provides marshal interface - Marshal() marshalIsisLspV4Prefix - // provides unmarshal interface - Unmarshal() unMarshalIsisLspV4Prefix - // validate validates IsisLspV4Prefix - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspV4Prefix, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv4Address returns string, set in IsisLspV4Prefix. - Ipv4Address() string - // SetIpv4Address assigns string provided by user to IsisLspV4Prefix - SetIpv4Address(value string) IsisLspV4Prefix - // HasIpv4Address checks if Ipv4Address has been set in IsisLspV4Prefix - HasIpv4Address() bool - // PrefixLength returns uint32, set in IsisLspV4Prefix. - PrefixLength() uint32 - // SetPrefixLength assigns uint32 provided by user to IsisLspV4Prefix - SetPrefixLength(value uint32) IsisLspV4Prefix - // HasPrefixLength checks if PrefixLength has been set in IsisLspV4Prefix - HasPrefixLength() bool - // RedistributionType returns IsisLspV4PrefixRedistributionTypeEnum, set in IsisLspV4Prefix - RedistributionType() IsisLspV4PrefixRedistributionTypeEnum - // SetRedistributionType assigns IsisLspV4PrefixRedistributionTypeEnum provided by user to IsisLspV4Prefix - SetRedistributionType(value IsisLspV4PrefixRedistributionTypeEnum) IsisLspV4Prefix - // HasRedistributionType checks if RedistributionType has been set in IsisLspV4Prefix - HasRedistributionType() bool - // DefaultMetric returns uint32, set in IsisLspV4Prefix. - DefaultMetric() uint32 - // SetDefaultMetric assigns uint32 provided by user to IsisLspV4Prefix - SetDefaultMetric(value uint32) IsisLspV4Prefix - // HasDefaultMetric checks if DefaultMetric has been set in IsisLspV4Prefix - HasDefaultMetric() bool - // OriginType returns IsisLspV4PrefixOriginTypeEnum, set in IsisLspV4Prefix - OriginType() IsisLspV4PrefixOriginTypeEnum - // SetOriginType assigns IsisLspV4PrefixOriginTypeEnum provided by user to IsisLspV4Prefix - SetOriginType(value IsisLspV4PrefixOriginTypeEnum) IsisLspV4Prefix - // HasOriginType checks if OriginType has been set in IsisLspV4Prefix - HasOriginType() bool -} - -// An IPv4 unicast prefix reachable via the originator of this LSP. -// Ipv4Address returns a string -func (obj *isisLspV4Prefix) Ipv4Address() string { - - return *obj.obj.Ipv4Address - -} - -// An IPv4 unicast prefix reachable via the originator of this LSP. -// Ipv4Address returns a string -func (obj *isisLspV4Prefix) HasIpv4Address() bool { - return obj.obj.Ipv4Address != nil -} - -// An IPv4 unicast prefix reachable via the originator of this LSP. -// SetIpv4Address sets the string value in the IsisLspV4Prefix object -func (obj *isisLspV4Prefix) SetIpv4Address(value string) IsisLspV4Prefix { - - obj.obj.Ipv4Address = &value - return obj -} - -// The length of the IPv4 prefix. -// PrefixLength returns a uint32 -func (obj *isisLspV4Prefix) PrefixLength() uint32 { - - return *obj.obj.PrefixLength - -} - -// The length of the IPv4 prefix. -// PrefixLength returns a uint32 -func (obj *isisLspV4Prefix) HasPrefixLength() bool { - return obj.obj.PrefixLength != nil -} - -// The length of the IPv4 prefix. -// SetPrefixLength sets the uint32 value in the IsisLspV4Prefix object -func (obj *isisLspV4Prefix) SetPrefixLength(value uint32) IsisLspV4Prefix { - - obj.obj.PrefixLength = &value - return obj -} - -type IsisLspV4PrefixRedistributionTypeEnum string - -// Enum of RedistributionType on IsisLspV4Prefix -var IsisLspV4PrefixRedistributionType = struct { - UP IsisLspV4PrefixRedistributionTypeEnum - DOWN IsisLspV4PrefixRedistributionTypeEnum -}{ - UP: IsisLspV4PrefixRedistributionTypeEnum("up"), - DOWN: IsisLspV4PrefixRedistributionTypeEnum("down"), -} - -func (obj *isisLspV4Prefix) RedistributionType() IsisLspV4PrefixRedistributionTypeEnum { - return IsisLspV4PrefixRedistributionTypeEnum(obj.obj.RedistributionType.Enum().String()) -} - -// Up (0)-used when a prefix is initially advertised within the ISIS L3 hierarchy, -// and for all other prefixes in L1 and L2 LSPs. (default) -// Down (1)-used when an L1/L2 router advertises L2 prefixes in L1 LSPs. -// The prefixes are being advertised from a higher level (L2) down to a lower level (L1). -// RedistributionType returns a string -func (obj *isisLspV4Prefix) HasRedistributionType() bool { - return obj.obj.RedistributionType != nil -} - -func (obj *isisLspV4Prefix) SetRedistributionType(value IsisLspV4PrefixRedistributionTypeEnum) IsisLspV4Prefix { - intValue, ok := otg.IsisLspV4Prefix_RedistributionType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on IsisLspV4PrefixRedistributionTypeEnum", string(value))) - return obj - } - enumValue := otg.IsisLspV4Prefix_RedistributionType_Enum(intValue) - obj.obj.RedistributionType = &enumValue - - return obj -} - -// ISIS default metric value. -// DefaultMetric returns a uint32 -func (obj *isisLspV4Prefix) DefaultMetric() uint32 { - - return *obj.obj.DefaultMetric - -} - -// ISIS default metric value. -// DefaultMetric returns a uint32 -func (obj *isisLspV4Prefix) HasDefaultMetric() bool { - return obj.obj.DefaultMetric != nil -} - -// ISIS default metric value. -// SetDefaultMetric sets the uint32 value in the IsisLspV4Prefix object -func (obj *isisLspV4Prefix) SetDefaultMetric(value uint32) IsisLspV4Prefix { - - obj.obj.DefaultMetric = &value - return obj -} - -type IsisLspV4PrefixOriginTypeEnum string - -// Enum of OriginType on IsisLspV4Prefix -var IsisLspV4PrefixOriginType = struct { - INTERNAL IsisLspV4PrefixOriginTypeEnum - EXTERNAL IsisLspV4PrefixOriginTypeEnum -}{ - INTERNAL: IsisLspV4PrefixOriginTypeEnum("internal"), - EXTERNAL: IsisLspV4PrefixOriginTypeEnum("external"), -} - -func (obj *isisLspV4Prefix) OriginType() IsisLspV4PrefixOriginTypeEnum { - return IsisLspV4PrefixOriginTypeEnum(obj.obj.OriginType.Enum().String()) -} - -// The origin of the advertised route-internal or external to the ISIS area. Options include the following: -// Internal-for intra-area routes, through Level 1 LSPs. -// External-for inter-area routes redistributed within L1, through Level -// 1 LSPs. -// OriginType returns a string -func (obj *isisLspV4Prefix) HasOriginType() bool { - return obj.obj.OriginType != nil -} - -func (obj *isisLspV4Prefix) SetOriginType(value IsisLspV4PrefixOriginTypeEnum) IsisLspV4Prefix { - intValue, ok := otg.IsisLspV4Prefix_OriginType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on IsisLspV4PrefixOriginTypeEnum", string(value))) - return obj - } - enumValue := otg.IsisLspV4Prefix_OriginType_Enum(intValue) - obj.obj.OriginType = &enumValue - - return obj -} - -func (obj *isisLspV4Prefix) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.PrefixLength != nil { - - if *obj.obj.PrefixLength > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= IsisLspV4Prefix.PrefixLength <= 32 but Got %d", *obj.obj.PrefixLength)) - } - - } - -} - -func (obj *isisLspV4Prefix) setDefault() { - -} - -// ***** IsisLspExtendedV4Prefix ***** -type isisLspExtendedV4Prefix struct { - validation - obj *otg.IsisLspExtendedV4Prefix - marshaller marshalIsisLspExtendedV4Prefix - unMarshaller unMarshalIsisLspExtendedV4Prefix - prefixAttributesHolder IsisLspPrefixAttributes -} - -func NewIsisLspExtendedV4Prefix() IsisLspExtendedV4Prefix { - obj := isisLspExtendedV4Prefix{obj: &otg.IsisLspExtendedV4Prefix{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspExtendedV4Prefix) msg() *otg.IsisLspExtendedV4Prefix { - return obj.obj -} - -func (obj *isisLspExtendedV4Prefix) setMsg(msg *otg.IsisLspExtendedV4Prefix) IsisLspExtendedV4Prefix { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspExtendedV4Prefix struct { - obj *isisLspExtendedV4Prefix -} - -type marshalIsisLspExtendedV4Prefix interface { - // ToProto marshals IsisLspExtendedV4Prefix to protobuf object *otg.IsisLspExtendedV4Prefix - ToProto() (*otg.IsisLspExtendedV4Prefix, error) - // ToPbText marshals IsisLspExtendedV4Prefix to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspExtendedV4Prefix to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspExtendedV4Prefix to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspExtendedV4Prefix struct { - obj *isisLspExtendedV4Prefix -} - -type unMarshalIsisLspExtendedV4Prefix interface { - // FromProto unmarshals IsisLspExtendedV4Prefix from protobuf object *otg.IsisLspExtendedV4Prefix - FromProto(msg *otg.IsisLspExtendedV4Prefix) (IsisLspExtendedV4Prefix, error) - // FromPbText unmarshals IsisLspExtendedV4Prefix from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspExtendedV4Prefix from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspExtendedV4Prefix from JSON text - FromJson(value string) error -} - -func (obj *isisLspExtendedV4Prefix) Marshal() marshalIsisLspExtendedV4Prefix { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspExtendedV4Prefix{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspExtendedV4Prefix) Unmarshal() unMarshalIsisLspExtendedV4Prefix { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspExtendedV4Prefix{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspExtendedV4Prefix) ToProto() (*otg.IsisLspExtendedV4Prefix, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspExtendedV4Prefix) FromProto(msg *otg.IsisLspExtendedV4Prefix) (IsisLspExtendedV4Prefix, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspExtendedV4Prefix) 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 *unMarshalisisLspExtendedV4Prefix) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisLspExtendedV4Prefix) 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 *unMarshalisisLspExtendedV4Prefix) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisLspExtendedV4Prefix) 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 *unMarshalisisLspExtendedV4Prefix) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisLspExtendedV4Prefix) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspExtendedV4Prefix) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspExtendedV4Prefix) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspExtendedV4Prefix) Clone() (IsisLspExtendedV4Prefix, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspExtendedV4Prefix() - 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 -} - -func (obj *isisLspExtendedV4Prefix) setNil() { - obj.prefixAttributesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisLspExtendedV4Prefix is this group defines attributes of an IPv4 standard prefix. -type IsisLspExtendedV4Prefix interface { - Validation - // msg marshals IsisLspExtendedV4Prefix to protobuf object *otg.IsisLspExtendedV4Prefix - // and doesn't set defaults - msg() *otg.IsisLspExtendedV4Prefix - // setMsg unmarshals IsisLspExtendedV4Prefix from protobuf object *otg.IsisLspExtendedV4Prefix - // and doesn't set defaults - setMsg(*otg.IsisLspExtendedV4Prefix) IsisLspExtendedV4Prefix - // provides marshal interface - Marshal() marshalIsisLspExtendedV4Prefix - // provides unmarshal interface - Unmarshal() unMarshalIsisLspExtendedV4Prefix - // validate validates IsisLspExtendedV4Prefix - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspExtendedV4Prefix, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv4Address returns string, set in IsisLspExtendedV4Prefix. - Ipv4Address() string - // SetIpv4Address assigns string provided by user to IsisLspExtendedV4Prefix - SetIpv4Address(value string) IsisLspExtendedV4Prefix - // HasIpv4Address checks if Ipv4Address has been set in IsisLspExtendedV4Prefix - HasIpv4Address() bool - // PrefixLength returns uint32, set in IsisLspExtendedV4Prefix. - PrefixLength() uint32 - // SetPrefixLength assigns uint32 provided by user to IsisLspExtendedV4Prefix - SetPrefixLength(value uint32) IsisLspExtendedV4Prefix - // HasPrefixLength checks if PrefixLength has been set in IsisLspExtendedV4Prefix - HasPrefixLength() bool - // Metric returns uint32, set in IsisLspExtendedV4Prefix. - Metric() uint32 - // SetMetric assigns uint32 provided by user to IsisLspExtendedV4Prefix - SetMetric(value uint32) IsisLspExtendedV4Prefix - // HasMetric checks if Metric has been set in IsisLspExtendedV4Prefix - HasMetric() bool - // RedistributionType returns IsisLspExtendedV4PrefixRedistributionTypeEnum, set in IsisLspExtendedV4Prefix - RedistributionType() IsisLspExtendedV4PrefixRedistributionTypeEnum - // SetRedistributionType assigns IsisLspExtendedV4PrefixRedistributionTypeEnum provided by user to IsisLspExtendedV4Prefix - SetRedistributionType(value IsisLspExtendedV4PrefixRedistributionTypeEnum) IsisLspExtendedV4Prefix - // HasRedistributionType checks if RedistributionType has been set in IsisLspExtendedV4Prefix - HasRedistributionType() bool - // PrefixAttributes returns IsisLspPrefixAttributes, set in IsisLspExtendedV4Prefix. - // IsisLspPrefixAttributes is this contains the properties of ISIS Prefix attributes for the extended IPv4 and IPv6 reachability. https://www.rfc-editor.org/rfc/rfc7794.html - PrefixAttributes() IsisLspPrefixAttributes - // SetPrefixAttributes assigns IsisLspPrefixAttributes provided by user to IsisLspExtendedV4Prefix. - // IsisLspPrefixAttributes is this contains the properties of ISIS Prefix attributes for the extended IPv4 and IPv6 reachability. https://www.rfc-editor.org/rfc/rfc7794.html - SetPrefixAttributes(value IsisLspPrefixAttributes) IsisLspExtendedV4Prefix - // HasPrefixAttributes checks if PrefixAttributes has been set in IsisLspExtendedV4Prefix - HasPrefixAttributes() bool - setNil() -} - -// An IPv4 unicast prefix reachable via the originator of this LSP. -// Ipv4Address returns a string -func (obj *isisLspExtendedV4Prefix) Ipv4Address() string { - - return *obj.obj.Ipv4Address - -} - -// An IPv4 unicast prefix reachable via the originator of this LSP. -// Ipv4Address returns a string -func (obj *isisLspExtendedV4Prefix) HasIpv4Address() bool { - return obj.obj.Ipv4Address != nil -} - -// An IPv4 unicast prefix reachable via the originator of this LSP. -// SetIpv4Address sets the string value in the IsisLspExtendedV4Prefix object -func (obj *isisLspExtendedV4Prefix) SetIpv4Address(value string) IsisLspExtendedV4Prefix { - - obj.obj.Ipv4Address = &value - return obj -} - -// The length of the IPv4 prefix. -// PrefixLength returns a uint32 -func (obj *isisLspExtendedV4Prefix) PrefixLength() uint32 { - - return *obj.obj.PrefixLength - -} - -// The length of the IPv4 prefix. -// PrefixLength returns a uint32 -func (obj *isisLspExtendedV4Prefix) HasPrefixLength() bool { - return obj.obj.PrefixLength != nil -} - -// The length of the IPv4 prefix. -// SetPrefixLength sets the uint32 value in the IsisLspExtendedV4Prefix object -func (obj *isisLspExtendedV4Prefix) SetPrefixLength(value uint32) IsisLspExtendedV4Prefix { - - obj.obj.PrefixLength = &value - return obj -} - -// ISIS wide metric. -// Metric returns a uint32 -func (obj *isisLspExtendedV4Prefix) Metric() uint32 { - - return *obj.obj.Metric - -} - -// ISIS wide metric. -// Metric returns a uint32 -func (obj *isisLspExtendedV4Prefix) HasMetric() bool { - return obj.obj.Metric != nil -} - -// ISIS wide metric. -// SetMetric sets the uint32 value in the IsisLspExtendedV4Prefix object -func (obj *isisLspExtendedV4Prefix) SetMetric(value uint32) IsisLspExtendedV4Prefix { - - obj.obj.Metric = &value - return obj -} - -type IsisLspExtendedV4PrefixRedistributionTypeEnum string - -// Enum of RedistributionType on IsisLspExtendedV4Prefix -var IsisLspExtendedV4PrefixRedistributionType = struct { - UP IsisLspExtendedV4PrefixRedistributionTypeEnum - DOWN IsisLspExtendedV4PrefixRedistributionTypeEnum -}{ - UP: IsisLspExtendedV4PrefixRedistributionTypeEnum("up"), - DOWN: IsisLspExtendedV4PrefixRedistributionTypeEnum("down"), -} - -func (obj *isisLspExtendedV4Prefix) RedistributionType() IsisLspExtendedV4PrefixRedistributionTypeEnum { - return IsisLspExtendedV4PrefixRedistributionTypeEnum(obj.obj.RedistributionType.Enum().String()) -} - -// Up (0)-used when a prefix is initially advertised within the ISIS L3 hierarchy, -// and for all other prefixes in L1 and L2 LSPs. (default) -// Down (1)-used when an L1/L2 router advertises L2 prefixes in L1 LSPs. -// The prefixes are being advertised from a higher level (L2) down to a lower level (L1). -// RedistributionType returns a string -func (obj *isisLspExtendedV4Prefix) HasRedistributionType() bool { - return obj.obj.RedistributionType != nil -} - -func (obj *isisLspExtendedV4Prefix) SetRedistributionType(value IsisLspExtendedV4PrefixRedistributionTypeEnum) IsisLspExtendedV4Prefix { - intValue, ok := otg.IsisLspExtendedV4Prefix_RedistributionType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on IsisLspExtendedV4PrefixRedistributionTypeEnum", string(value))) - return obj - } - enumValue := otg.IsisLspExtendedV4Prefix_RedistributionType_Enum(intValue) - obj.obj.RedistributionType = &enumValue - - return obj -} - -// description is TBD -// PrefixAttributes returns a IsisLspPrefixAttributes -func (obj *isisLspExtendedV4Prefix) PrefixAttributes() IsisLspPrefixAttributes { - if obj.obj.PrefixAttributes == nil { - obj.obj.PrefixAttributes = NewIsisLspPrefixAttributes().msg() - } - if obj.prefixAttributesHolder == nil { - obj.prefixAttributesHolder = &isisLspPrefixAttributes{obj: obj.obj.PrefixAttributes} - } - return obj.prefixAttributesHolder -} - -// description is TBD -// PrefixAttributes returns a IsisLspPrefixAttributes -func (obj *isisLspExtendedV4Prefix) HasPrefixAttributes() bool { - return obj.obj.PrefixAttributes != nil -} - -// description is TBD -// SetPrefixAttributes sets the IsisLspPrefixAttributes value in the IsisLspExtendedV4Prefix object -func (obj *isisLspExtendedV4Prefix) SetPrefixAttributes(value IsisLspPrefixAttributes) IsisLspExtendedV4Prefix { - - obj.prefixAttributesHolder = nil - obj.obj.PrefixAttributes = value.msg() - - return obj -} - -func (obj *isisLspExtendedV4Prefix) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv4Address != nil { - - err := obj.validateIpv4(obj.Ipv4Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on IsisLspExtendedV4Prefix.Ipv4Address")) - } - - } - - if obj.obj.PrefixLength != nil { - - if *obj.obj.PrefixLength > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= IsisLspExtendedV4Prefix.PrefixLength <= 32 but Got %d", *obj.obj.PrefixLength)) - } - - } - - if obj.obj.PrefixAttributes != nil { - - obj.PrefixAttributes().validateObj(vObj, set_default) - } - -} - -func (obj *isisLspExtendedV4Prefix) setDefault() { - -} - -// ***** IsisLspV6Prefix ***** -type isisLspV6Prefix struct { - validation - obj *otg.IsisLspV6Prefix - marshaller marshalIsisLspV6Prefix - unMarshaller unMarshalIsisLspV6Prefix - prefixAttributesHolder IsisLspPrefixAttributes -} - -func NewIsisLspV6Prefix() IsisLspV6Prefix { - obj := isisLspV6Prefix{obj: &otg.IsisLspV6Prefix{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspV6Prefix) msg() *otg.IsisLspV6Prefix { - return obj.obj -} - -func (obj *isisLspV6Prefix) setMsg(msg *otg.IsisLspV6Prefix) IsisLspV6Prefix { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspV6Prefix struct { - obj *isisLspV6Prefix -} - -type marshalIsisLspV6Prefix interface { - // ToProto marshals IsisLspV6Prefix to protobuf object *otg.IsisLspV6Prefix - ToProto() (*otg.IsisLspV6Prefix, error) - // ToPbText marshals IsisLspV6Prefix to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspV6Prefix to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspV6Prefix to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspV6Prefix struct { - obj *isisLspV6Prefix -} - -type unMarshalIsisLspV6Prefix interface { - // FromProto unmarshals IsisLspV6Prefix from protobuf object *otg.IsisLspV6Prefix - FromProto(msg *otg.IsisLspV6Prefix) (IsisLspV6Prefix, error) - // FromPbText unmarshals IsisLspV6Prefix from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspV6Prefix from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspV6Prefix from JSON text - FromJson(value string) error -} - -func (obj *isisLspV6Prefix) Marshal() marshalIsisLspV6Prefix { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspV6Prefix{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspV6Prefix) Unmarshal() unMarshalIsisLspV6Prefix { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspV6Prefix{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspV6Prefix) ToProto() (*otg.IsisLspV6Prefix, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspV6Prefix) FromProto(msg *otg.IsisLspV6Prefix) (IsisLspV6Prefix, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspV6Prefix) 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 *unMarshalisisLspV6Prefix) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalisisLspV6Prefix) 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 *unMarshalisisLspV6Prefix) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalisisLspV6Prefix) 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 *unMarshalisisLspV6Prefix) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *isisLspV6Prefix) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspV6Prefix) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspV6Prefix) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspV6Prefix) Clone() (IsisLspV6Prefix, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspV6Prefix() - 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 -} - -func (obj *isisLspV6Prefix) setNil() { - obj.prefixAttributesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// IsisLspV6Prefix is it defines attributes of an IPv6 standard prefix. -type IsisLspV6Prefix interface { - Validation - // msg marshals IsisLspV6Prefix to protobuf object *otg.IsisLspV6Prefix - // and doesn't set defaults - msg() *otg.IsisLspV6Prefix - // setMsg unmarshals IsisLspV6Prefix from protobuf object *otg.IsisLspV6Prefix - // and doesn't set defaults - setMsg(*otg.IsisLspV6Prefix) IsisLspV6Prefix - // provides marshal interface - Marshal() marshalIsisLspV6Prefix - // provides unmarshal interface - Unmarshal() unMarshalIsisLspV6Prefix - // validate validates IsisLspV6Prefix - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspV6Prefix, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv6Address returns string, set in IsisLspV6Prefix. - Ipv6Address() string - // SetIpv6Address assigns string provided by user to IsisLspV6Prefix - SetIpv6Address(value string) IsisLspV6Prefix - // HasIpv6Address checks if Ipv6Address has been set in IsisLspV6Prefix - HasIpv6Address() bool - // PrefixLength returns uint32, set in IsisLspV6Prefix. - PrefixLength() uint32 - // SetPrefixLength assigns uint32 provided by user to IsisLspV6Prefix - SetPrefixLength(value uint32) IsisLspV6Prefix - // HasPrefixLength checks if PrefixLength has been set in IsisLspV6Prefix - HasPrefixLength() bool - // Metric returns uint32, set in IsisLspV6Prefix. - Metric() uint32 - // SetMetric assigns uint32 provided by user to IsisLspV6Prefix - SetMetric(value uint32) IsisLspV6Prefix - // HasMetric checks if Metric has been set in IsisLspV6Prefix - HasMetric() bool - // RedistributionType returns IsisLspV6PrefixRedistributionTypeEnum, set in IsisLspV6Prefix - RedistributionType() IsisLspV6PrefixRedistributionTypeEnum - // SetRedistributionType assigns IsisLspV6PrefixRedistributionTypeEnum provided by user to IsisLspV6Prefix - SetRedistributionType(value IsisLspV6PrefixRedistributionTypeEnum) IsisLspV6Prefix - // HasRedistributionType checks if RedistributionType has been set in IsisLspV6Prefix - HasRedistributionType() bool - // OriginType returns IsisLspV6PrefixOriginTypeEnum, set in IsisLspV6Prefix - OriginType() IsisLspV6PrefixOriginTypeEnum - // SetOriginType assigns IsisLspV6PrefixOriginTypeEnum provided by user to IsisLspV6Prefix - SetOriginType(value IsisLspV6PrefixOriginTypeEnum) IsisLspV6Prefix - // HasOriginType checks if OriginType has been set in IsisLspV6Prefix - HasOriginType() bool - // PrefixAttributes returns IsisLspPrefixAttributes, set in IsisLspV6Prefix. - // IsisLspPrefixAttributes is this contains the properties of ISIS Prefix attributes for the extended IPv4 and IPv6 reachability. https://www.rfc-editor.org/rfc/rfc7794.html - PrefixAttributes() IsisLspPrefixAttributes - // SetPrefixAttributes assigns IsisLspPrefixAttributes provided by user to IsisLspV6Prefix. - // IsisLspPrefixAttributes is this contains the properties of ISIS Prefix attributes for the extended IPv4 and IPv6 reachability. https://www.rfc-editor.org/rfc/rfc7794.html - SetPrefixAttributes(value IsisLspPrefixAttributes) IsisLspV6Prefix - // HasPrefixAttributes checks if PrefixAttributes has been set in IsisLspV6Prefix - HasPrefixAttributes() bool - setNil() -} - -// An IPv6 unicast prefix reachable via the originator of this LSP. -// Ipv6Address returns a string -func (obj *isisLspV6Prefix) Ipv6Address() string { - - return *obj.obj.Ipv6Address - -} - -// An IPv6 unicast prefix reachable via the originator of this LSP. -// Ipv6Address returns a string -func (obj *isisLspV6Prefix) HasIpv6Address() bool { - return obj.obj.Ipv6Address != nil -} - -// An IPv6 unicast prefix reachable via the originator of this LSP. -// SetIpv6Address sets the string value in the IsisLspV6Prefix object -func (obj *isisLspV6Prefix) SetIpv6Address(value string) IsisLspV6Prefix { - - obj.obj.Ipv6Address = &value - return obj -} - -// The length of the IPv6 prefix. -// PrefixLength returns a uint32 -func (obj *isisLspV6Prefix) PrefixLength() uint32 { - - return *obj.obj.PrefixLength - -} - -// The length of the IPv6 prefix. -// PrefixLength returns a uint32 -func (obj *isisLspV6Prefix) HasPrefixLength() bool { - return obj.obj.PrefixLength != nil -} - -// The length of the IPv6 prefix. -// SetPrefixLength sets the uint32 value in the IsisLspV6Prefix object -func (obj *isisLspV6Prefix) SetPrefixLength(value uint32) IsisLspV6Prefix { - - obj.obj.PrefixLength = &value - return obj -} - -// ISIS wide metric. -// Metric returns a uint32 -func (obj *isisLspV6Prefix) Metric() uint32 { - - return *obj.obj.Metric - -} - -// ISIS wide metric. -// Metric returns a uint32 -func (obj *isisLspV6Prefix) HasMetric() bool { - return obj.obj.Metric != nil -} - -// ISIS wide metric. -// SetMetric sets the uint32 value in the IsisLspV6Prefix object -func (obj *isisLspV6Prefix) SetMetric(value uint32) IsisLspV6Prefix { - - obj.obj.Metric = &value - return obj -} - -type IsisLspV6PrefixRedistributionTypeEnum string - -// Enum of RedistributionType on IsisLspV6Prefix -var IsisLspV6PrefixRedistributionType = struct { - UP IsisLspV6PrefixRedistributionTypeEnum - DOWN IsisLspV6PrefixRedistributionTypeEnum -}{ - UP: IsisLspV6PrefixRedistributionTypeEnum("up"), - DOWN: IsisLspV6PrefixRedistributionTypeEnum("down"), -} - -func (obj *isisLspV6Prefix) RedistributionType() IsisLspV6PrefixRedistributionTypeEnum { - return IsisLspV6PrefixRedistributionTypeEnum(obj.obj.RedistributionType.Enum().String()) -} - -// Up (0)-used when a prefix is initially advertised within the ISIS L3 hierarchy, -// and for all other prefixes in L1 and L2 LSPs. (default) -// Down (1)-used when an L1/L2 router advertises L2 prefixes in L1 LSPs. -// The prefixes are being advertised from a higher level (L2) down to a lower level (L1). -// RedistributionType returns a string -func (obj *isisLspV6Prefix) HasRedistributionType() bool { - return obj.obj.RedistributionType != nil -} - -func (obj *isisLspV6Prefix) SetRedistributionType(value IsisLspV6PrefixRedistributionTypeEnum) IsisLspV6Prefix { - intValue, ok := otg.IsisLspV6Prefix_RedistributionType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on IsisLspV6PrefixRedistributionTypeEnum", string(value))) - return obj - } - enumValue := otg.IsisLspV6Prefix_RedistributionType_Enum(intValue) - obj.obj.RedistributionType = &enumValue - - return obj -} - -type IsisLspV6PrefixOriginTypeEnum string - -// Enum of OriginType on IsisLspV6Prefix -var IsisLspV6PrefixOriginType = struct { - INTERNAL IsisLspV6PrefixOriginTypeEnum - EXTERNAL IsisLspV6PrefixOriginTypeEnum -}{ - INTERNAL: IsisLspV6PrefixOriginTypeEnum("internal"), - EXTERNAL: IsisLspV6PrefixOriginTypeEnum("external"), -} - -func (obj *isisLspV6Prefix) OriginType() IsisLspV6PrefixOriginTypeEnum { - return IsisLspV6PrefixOriginTypeEnum(obj.obj.OriginType.Enum().String()) -} - -// The origin of the advertised route-internal or external to the ISIS area. Options include the following: -// Internal-for intra-area routes, through Level 1 LSPs. -// External-for inter-area routes redistributed within L1, through Level -// 1 LSPs. -// OriginType returns a string -func (obj *isisLspV6Prefix) HasOriginType() bool { - return obj.obj.OriginType != nil -} - -func (obj *isisLspV6Prefix) SetOriginType(value IsisLspV6PrefixOriginTypeEnum) IsisLspV6Prefix { - intValue, ok := otg.IsisLspV6Prefix_OriginType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on IsisLspV6PrefixOriginTypeEnum", string(value))) - return obj - } - enumValue := otg.IsisLspV6Prefix_OriginType_Enum(intValue) - obj.obj.OriginType = &enumValue - - return obj -} - -// description is TBD -// PrefixAttributes returns a IsisLspPrefixAttributes -func (obj *isisLspV6Prefix) PrefixAttributes() IsisLspPrefixAttributes { - if obj.obj.PrefixAttributes == nil { - obj.obj.PrefixAttributes = NewIsisLspPrefixAttributes().msg() - } - if obj.prefixAttributesHolder == nil { - obj.prefixAttributesHolder = &isisLspPrefixAttributes{obj: obj.obj.PrefixAttributes} - } - return obj.prefixAttributesHolder -} - -// description is TBD -// PrefixAttributes returns a IsisLspPrefixAttributes -func (obj *isisLspV6Prefix) HasPrefixAttributes() bool { - return obj.obj.PrefixAttributes != nil -} - -// description is TBD -// SetPrefixAttributes sets the IsisLspPrefixAttributes value in the IsisLspV6Prefix object -func (obj *isisLspV6Prefix) SetPrefixAttributes(value IsisLspPrefixAttributes) IsisLspV6Prefix { - - obj.prefixAttributesHolder = nil - obj.obj.PrefixAttributes = value.msg() - - return obj -} - -func (obj *isisLspV6Prefix) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv6Address != nil { - - err := obj.validateIpv6(obj.Ipv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on IsisLspV6Prefix.Ipv6Address")) - } - - } - - if obj.obj.PrefixLength != nil { - - if *obj.obj.PrefixLength > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= IsisLspV6Prefix.PrefixLength <= 128 but Got %d", *obj.obj.PrefixLength)) - } - - } - - if obj.obj.PrefixAttributes != nil { - - obj.PrefixAttributes().validateObj(vObj, set_default) - } - -} - -func (obj *isisLspV6Prefix) setDefault() { - -} - -// ***** BgpV4EviVxlan ***** -type bgpV4EviVxlan struct { - validation - obj *otg.BgpV4EviVxlan - marshaller marshalBgpV4EviVxlan - unMarshaller unMarshalBgpV4EviVxlan - broadcastDomainsHolder BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter - routeDistinguisherHolder BgpRouteDistinguisher - routeTargetExportHolder BgpV4EviVxlanBgpRouteTargetIter - routeTargetImportHolder BgpV4EviVxlanBgpRouteTargetIter - l3RouteTargetExportHolder BgpV4EviVxlanBgpRouteTargetIter - l3RouteTargetImportHolder BgpV4EviVxlanBgpRouteTargetIter - advancedHolder BgpRouteAdvanced - communitiesHolder BgpV4EviVxlanBgpCommunityIter - extCommunitiesHolder BgpV4EviVxlanBgpExtCommunityIter - asPathHolder BgpAsPath -} - -func NewBgpV4EviVxlan() BgpV4EviVxlan { - obj := bgpV4EviVxlan{obj: &otg.BgpV4EviVxlan{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV4EviVxlan) msg() *otg.BgpV4EviVxlan { - return obj.obj -} - -func (obj *bgpV4EviVxlan) setMsg(msg *otg.BgpV4EviVxlan) BgpV4EviVxlan { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV4EviVxlan struct { - obj *bgpV4EviVxlan -} - -type marshalBgpV4EviVxlan interface { - // ToProto marshals BgpV4EviVxlan to protobuf object *otg.BgpV4EviVxlan - ToProto() (*otg.BgpV4EviVxlan, error) - // ToPbText marshals BgpV4EviVxlan to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV4EviVxlan to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV4EviVxlan to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV4EviVxlan struct { - obj *bgpV4EviVxlan -} - -type unMarshalBgpV4EviVxlan interface { - // FromProto unmarshals BgpV4EviVxlan from protobuf object *otg.BgpV4EviVxlan - FromProto(msg *otg.BgpV4EviVxlan) (BgpV4EviVxlan, error) - // FromPbText unmarshals BgpV4EviVxlan from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV4EviVxlan from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV4EviVxlan from JSON text - FromJson(value string) error -} - -func (obj *bgpV4EviVxlan) Marshal() marshalBgpV4EviVxlan { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV4EviVxlan{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV4EviVxlan) Unmarshal() unMarshalBgpV4EviVxlan { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV4EviVxlan{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV4EviVxlan) ToProto() (*otg.BgpV4EviVxlan, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV4EviVxlan) FromProto(msg *otg.BgpV4EviVxlan) (BgpV4EviVxlan, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV4EviVxlan) 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 *unMarshalbgpV4EviVxlan) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpV4EviVxlan) 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 *unMarshalbgpV4EviVxlan) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpV4EviVxlan) 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 *unMarshalbgpV4EviVxlan) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpV4EviVxlan) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV4EviVxlan) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV4EviVxlan) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV4EviVxlan) Clone() (BgpV4EviVxlan, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV4EviVxlan() - 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 -} - -func (obj *bgpV4EviVxlan) setNil() { - obj.broadcastDomainsHolder = nil - obj.routeDistinguisherHolder = nil - obj.routeTargetExportHolder = nil - obj.routeTargetImportHolder = nil - obj.l3RouteTargetExportHolder = nil - obj.l3RouteTargetImportHolder = nil - obj.advancedHolder = nil - obj.communitiesHolder = nil - obj.extCommunitiesHolder = nil - obj.asPathHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpV4EviVxlan is configuration for BGP EVPN EVI. Advertises following routes - -// -// # Type 3 - Inclusive Multicast Ethernet Tag Route -// -// Type 1 - Ethernet Auto-discovery Route (Per EVI) -// -// Type 1 - Ethernet Auto-discovery Route (Per ES) -type BgpV4EviVxlan interface { - Validation - // msg marshals BgpV4EviVxlan to protobuf object *otg.BgpV4EviVxlan - // and doesn't set defaults - msg() *otg.BgpV4EviVxlan - // setMsg unmarshals BgpV4EviVxlan from protobuf object *otg.BgpV4EviVxlan - // and doesn't set defaults - setMsg(*otg.BgpV4EviVxlan) BgpV4EviVxlan - // provides marshal interface - Marshal() marshalBgpV4EviVxlan - // provides unmarshal interface - Unmarshal() unMarshalBgpV4EviVxlan - // validate validates BgpV4EviVxlan - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV4EviVxlan, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // BroadcastDomains returns BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIterIter, set in BgpV4EviVxlan - BroadcastDomains() BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter - // ReplicationType returns BgpV4EviVxlanReplicationTypeEnum, set in BgpV4EviVxlan - ReplicationType() BgpV4EviVxlanReplicationTypeEnum - // SetReplicationType assigns BgpV4EviVxlanReplicationTypeEnum provided by user to BgpV4EviVxlan - SetReplicationType(value BgpV4EviVxlanReplicationTypeEnum) BgpV4EviVxlan - // HasReplicationType checks if ReplicationType has been set in BgpV4EviVxlan - HasReplicationType() bool - // PmsiLabel returns uint32, set in BgpV4EviVxlan. - PmsiLabel() uint32 - // SetPmsiLabel assigns uint32 provided by user to BgpV4EviVxlan - SetPmsiLabel(value uint32) BgpV4EviVxlan - // HasPmsiLabel checks if PmsiLabel has been set in BgpV4EviVxlan - HasPmsiLabel() bool - // AdLabel returns uint32, set in BgpV4EviVxlan. - AdLabel() uint32 - // SetAdLabel assigns uint32 provided by user to BgpV4EviVxlan - SetAdLabel(value uint32) BgpV4EviVxlan - // HasAdLabel checks if AdLabel has been set in BgpV4EviVxlan - HasAdLabel() bool - // RouteDistinguisher returns BgpRouteDistinguisher, set in BgpV4EviVxlan. - // BgpRouteDistinguisher is bGP Route Distinguisher. - RouteDistinguisher() BgpRouteDistinguisher - // SetRouteDistinguisher assigns BgpRouteDistinguisher provided by user to BgpV4EviVxlan. - // BgpRouteDistinguisher is bGP Route Distinguisher. - SetRouteDistinguisher(value BgpRouteDistinguisher) BgpV4EviVxlan - // HasRouteDistinguisher checks if RouteDistinguisher has been set in BgpV4EviVxlan - HasRouteDistinguisher() bool - // RouteTargetExport returns BgpV4EviVxlanBgpRouteTargetIterIter, set in BgpV4EviVxlan - RouteTargetExport() BgpV4EviVxlanBgpRouteTargetIter - // RouteTargetImport returns BgpV4EviVxlanBgpRouteTargetIterIter, set in BgpV4EviVxlan - RouteTargetImport() BgpV4EviVxlanBgpRouteTargetIter - // L3RouteTargetExport returns BgpV4EviVxlanBgpRouteTargetIterIter, set in BgpV4EviVxlan - L3RouteTargetExport() BgpV4EviVxlanBgpRouteTargetIter - // L3RouteTargetImport returns BgpV4EviVxlanBgpRouteTargetIterIter, set in BgpV4EviVxlan - L3RouteTargetImport() BgpV4EviVxlanBgpRouteTargetIter - // Advanced returns BgpRouteAdvanced, set in BgpV4EviVxlan. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - Advanced() BgpRouteAdvanced - // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpV4EviVxlan. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - SetAdvanced(value BgpRouteAdvanced) BgpV4EviVxlan - // HasAdvanced checks if Advanced has been set in BgpV4EviVxlan - HasAdvanced() bool - // Communities returns BgpV4EviVxlanBgpCommunityIterIter, set in BgpV4EviVxlan - Communities() BgpV4EviVxlanBgpCommunityIter - // ExtCommunities returns BgpV4EviVxlanBgpExtCommunityIterIter, set in BgpV4EviVxlan - ExtCommunities() BgpV4EviVxlanBgpExtCommunityIter - // AsPath returns BgpAsPath, set in BgpV4EviVxlan. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - AsPath() BgpAsPath - // SetAsPath assigns BgpAsPath provided by user to BgpV4EviVxlan. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - SetAsPath(value BgpAsPath) BgpV4EviVxlan - // HasAsPath checks if AsPath has been set in BgpV4EviVxlan - HasAsPath() bool - setNil() -} - -// This contains the list of Broadcast Domains to be configured per EVI. -// BroadcastDomains returns a []BgpV4EviVxlanBroadcastDomain -func (obj *bgpV4EviVxlan) BroadcastDomains() BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { - if len(obj.obj.BroadcastDomains) == 0 { - obj.obj.BroadcastDomains = []*otg.BgpV4EviVxlanBroadcastDomain{} - } - if obj.broadcastDomainsHolder == nil { - obj.broadcastDomainsHolder = newBgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter(&obj.obj.BroadcastDomains).setMsg(obj) - } - return obj.broadcastDomainsHolder -} - -type bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter struct { - obj *bgpV4EviVxlan - bgpV4EviVxlanBroadcastDomainSlice []BgpV4EviVxlanBroadcastDomain - fieldPtr *[]*otg.BgpV4EviVxlanBroadcastDomain -} - -func newBgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter(ptr *[]*otg.BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { - return &bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter{fieldPtr: ptr} -} - -type BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter interface { - setMsg(*bgpV4EviVxlan) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter - Items() []BgpV4EviVxlanBroadcastDomain - Add() BgpV4EviVxlanBroadcastDomain - Append(items ...BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter - Set(index int, newObj BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter - Clear() BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter - clearHolderSlice() BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter - appendHolderSlice(item BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter -} - -func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) setMsg(msg *bgpV4EviVxlan) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpV4EviVxlanBroadcastDomain{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) Items() []BgpV4EviVxlanBroadcastDomain { - return obj.bgpV4EviVxlanBroadcastDomainSlice -} - -func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) Add() BgpV4EviVxlanBroadcastDomain { - newObj := &otg.BgpV4EviVxlanBroadcastDomain{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpV4EviVxlanBroadcastDomain{obj: newObj} - newLibObj.setDefault() - obj.bgpV4EviVxlanBroadcastDomainSlice = append(obj.bgpV4EviVxlanBroadcastDomainSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) Append(items ...BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpV4EviVxlanBroadcastDomainSlice = append(obj.bgpV4EviVxlanBroadcastDomainSlice, item) - } - return obj -} - -func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) Set(index int, newObj BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpV4EviVxlanBroadcastDomainSlice[index] = newObj - return obj -} -func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) Clear() BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpV4EviVxlanBroadcastDomain{} - obj.bgpV4EviVxlanBroadcastDomainSlice = []BgpV4EviVxlanBroadcastDomain{} - } - return obj -} -func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) clearHolderSlice() BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { - if len(obj.bgpV4EviVxlanBroadcastDomainSlice) > 0 { - obj.bgpV4EviVxlanBroadcastDomainSlice = []BgpV4EviVxlanBroadcastDomain{} - } - return obj -} -func (obj *bgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter) appendHolderSlice(item BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBgpV4EviVxlanBroadcastDomainIter { - obj.bgpV4EviVxlanBroadcastDomainSlice = append(obj.bgpV4EviVxlanBroadcastDomainSlice, item) - return obj -} - -type BgpV4EviVxlanReplicationTypeEnum string - -// Enum of ReplicationType on BgpV4EviVxlan -var BgpV4EviVxlanReplicationType = struct { - INGRESS_REPLICATION BgpV4EviVxlanReplicationTypeEnum -}{ - INGRESS_REPLICATION: BgpV4EviVxlanReplicationTypeEnum("ingress_replication"), -} - -func (obj *bgpV4EviVxlan) ReplicationType() BgpV4EviVxlanReplicationTypeEnum { - return BgpV4EviVxlanReplicationTypeEnum(obj.obj.ReplicationType.Enum().String()) -} - -// This model only supports Ingress Replication -// ReplicationType returns a string -func (obj *bgpV4EviVxlan) HasReplicationType() bool { - return obj.obj.ReplicationType != nil -} - -func (obj *bgpV4EviVxlan) SetReplicationType(value BgpV4EviVxlanReplicationTypeEnum) BgpV4EviVxlan { - intValue, ok := otg.BgpV4EviVxlan_ReplicationType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpV4EviVxlanReplicationTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpV4EviVxlan_ReplicationType_Enum(intValue) - obj.obj.ReplicationType = &enumValue - - return obj -} - -// Downstream assigned VNI to be carried as Part of P-Multicast Service Interface Tunnel attribute (PMSI Tunnel Attribute) in Type 3 Inclusive Multicast Ethernet Tag Route. -// PmsiLabel returns a uint32 -func (obj *bgpV4EviVxlan) PmsiLabel() uint32 { - - return *obj.obj.PmsiLabel - -} - -// Downstream assigned VNI to be carried as Part of P-Multicast Service Interface Tunnel attribute (PMSI Tunnel Attribute) in Type 3 Inclusive Multicast Ethernet Tag Route. -// PmsiLabel returns a uint32 -func (obj *bgpV4EviVxlan) HasPmsiLabel() bool { - return obj.obj.PmsiLabel != nil -} - -// Downstream assigned VNI to be carried as Part of P-Multicast Service Interface Tunnel attribute (PMSI Tunnel Attribute) in Type 3 Inclusive Multicast Ethernet Tag Route. -// SetPmsiLabel sets the uint32 value in the BgpV4EviVxlan object -func (obj *bgpV4EviVxlan) SetPmsiLabel(value uint32) BgpV4EviVxlan { - - obj.obj.PmsiLabel = &value - return obj -} - -// The Auto-discovery Route label (AD label) value, which gets advertised in the Ethernet Auto-discovery Route per -// AdLabel returns a uint32 -func (obj *bgpV4EviVxlan) AdLabel() uint32 { - - return *obj.obj.AdLabel - -} - -// The Auto-discovery Route label (AD label) value, which gets advertised in the Ethernet Auto-discovery Route per -// AdLabel returns a uint32 -func (obj *bgpV4EviVxlan) HasAdLabel() bool { - return obj.obj.AdLabel != nil -} - -// The Auto-discovery Route label (AD label) value, which gets advertised in the Ethernet Auto-discovery Route per -// SetAdLabel sets the uint32 value in the BgpV4EviVxlan object -func (obj *bgpV4EviVxlan) SetAdLabel(value uint32) BgpV4EviVxlan { - - obj.obj.AdLabel = &value - return obj -} - -// Colon separated Extended Community value of 6 Bytes - "AS number: Value" identifying an EVI. Example - for the as_2octet "60005:100". -// RouteDistinguisher returns a BgpRouteDistinguisher -func (obj *bgpV4EviVxlan) RouteDistinguisher() BgpRouteDistinguisher { - if obj.obj.RouteDistinguisher == nil { - obj.obj.RouteDistinguisher = NewBgpRouteDistinguisher().msg() - } - if obj.routeDistinguisherHolder == nil { - obj.routeDistinguisherHolder = &bgpRouteDistinguisher{obj: obj.obj.RouteDistinguisher} - } - return obj.routeDistinguisherHolder -} - -// Colon separated Extended Community value of 6 Bytes - "AS number: Value" identifying an EVI. Example - for the as_2octet "60005:100". -// RouteDistinguisher returns a BgpRouteDistinguisher -func (obj *bgpV4EviVxlan) HasRouteDistinguisher() bool { - return obj.obj.RouteDistinguisher != nil -} - -// Colon separated Extended Community value of 6 Bytes - "AS number: Value" identifying an EVI. Example - for the as_2octet "60005:100". -// SetRouteDistinguisher sets the BgpRouteDistinguisher value in the BgpV4EviVxlan object -func (obj *bgpV4EviVxlan) SetRouteDistinguisher(value BgpRouteDistinguisher) BgpV4EviVxlan { - - obj.routeDistinguisherHolder = nil - obj.obj.RouteDistinguisher = value.msg() - - return obj -} - -// List of Layer 2 Virtual Network Identifier (L2VNI) export targets associated with this EVI. -// RouteTargetExport returns a []BgpRouteTarget -func (obj *bgpV4EviVxlan) RouteTargetExport() BgpV4EviVxlanBgpRouteTargetIter { - if len(obj.obj.RouteTargetExport) == 0 { - obj.obj.RouteTargetExport = []*otg.BgpRouteTarget{} - } - if obj.routeTargetExportHolder == nil { - obj.routeTargetExportHolder = newBgpV4EviVxlanBgpRouteTargetIter(&obj.obj.RouteTargetExport).setMsg(obj) - } - return obj.routeTargetExportHolder -} - -type bgpV4EviVxlanBgpRouteTargetIter struct { - obj *bgpV4EviVxlan - bgpRouteTargetSlice []BgpRouteTarget - fieldPtr *[]*otg.BgpRouteTarget -} - -func newBgpV4EviVxlanBgpRouteTargetIter(ptr *[]*otg.BgpRouteTarget) BgpV4EviVxlanBgpRouteTargetIter { - return &bgpV4EviVxlanBgpRouteTargetIter{fieldPtr: ptr} -} - -type BgpV4EviVxlanBgpRouteTargetIter interface { - setMsg(*bgpV4EviVxlan) BgpV4EviVxlanBgpRouteTargetIter - Items() []BgpRouteTarget - Add() BgpRouteTarget - Append(items ...BgpRouteTarget) BgpV4EviVxlanBgpRouteTargetIter - Set(index int, newObj BgpRouteTarget) BgpV4EviVxlanBgpRouteTargetIter - Clear() BgpV4EviVxlanBgpRouteTargetIter - clearHolderSlice() BgpV4EviVxlanBgpRouteTargetIter - appendHolderSlice(item BgpRouteTarget) BgpV4EviVxlanBgpRouteTargetIter -} - -func (obj *bgpV4EviVxlanBgpRouteTargetIter) setMsg(msg *bgpV4EviVxlan) BgpV4EviVxlanBgpRouteTargetIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpRouteTarget{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4EviVxlanBgpRouteTargetIter) Items() []BgpRouteTarget { - return obj.bgpRouteTargetSlice -} - -func (obj *bgpV4EviVxlanBgpRouteTargetIter) Add() BgpRouteTarget { - newObj := &otg.BgpRouteTarget{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpRouteTarget{obj: newObj} - newLibObj.setDefault() - obj.bgpRouteTargetSlice = append(obj.bgpRouteTargetSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4EviVxlanBgpRouteTargetIter) Append(items ...BgpRouteTarget) BgpV4EviVxlanBgpRouteTargetIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpRouteTargetSlice = append(obj.bgpRouteTargetSlice, item) - } - return obj -} - -func (obj *bgpV4EviVxlanBgpRouteTargetIter) Set(index int, newObj BgpRouteTarget) BgpV4EviVxlanBgpRouteTargetIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpRouteTargetSlice[index] = newObj - return obj -} -func (obj *bgpV4EviVxlanBgpRouteTargetIter) Clear() BgpV4EviVxlanBgpRouteTargetIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpRouteTarget{} - obj.bgpRouteTargetSlice = []BgpRouteTarget{} - } - return obj -} -func (obj *bgpV4EviVxlanBgpRouteTargetIter) clearHolderSlice() BgpV4EviVxlanBgpRouteTargetIter { - if len(obj.bgpRouteTargetSlice) > 0 { - obj.bgpRouteTargetSlice = []BgpRouteTarget{} - } - return obj -} -func (obj *bgpV4EviVxlanBgpRouteTargetIter) appendHolderSlice(item BgpRouteTarget) BgpV4EviVxlanBgpRouteTargetIter { - obj.bgpRouteTargetSlice = append(obj.bgpRouteTargetSlice, item) - return obj -} - -// List of L2VNI import targets associated with this EVI. -// RouteTargetImport returns a []BgpRouteTarget -func (obj *bgpV4EviVxlan) RouteTargetImport() BgpV4EviVxlanBgpRouteTargetIter { - if len(obj.obj.RouteTargetImport) == 0 { - obj.obj.RouteTargetImport = []*otg.BgpRouteTarget{} - } - if obj.routeTargetImportHolder == nil { - obj.routeTargetImportHolder = newBgpV4EviVxlanBgpRouteTargetIter(&obj.obj.RouteTargetImport).setMsg(obj) - } - return obj.routeTargetImportHolder -} - -// List of Layer 3 Virtual Network Identifier (L3VNI) Export Route Targets. -// L3RouteTargetExport returns a []BgpRouteTarget -func (obj *bgpV4EviVxlan) L3RouteTargetExport() BgpV4EviVxlanBgpRouteTargetIter { - if len(obj.obj.L3RouteTargetExport) == 0 { - obj.obj.L3RouteTargetExport = []*otg.BgpRouteTarget{} - } - if obj.l3RouteTargetExportHolder == nil { - obj.l3RouteTargetExportHolder = newBgpV4EviVxlanBgpRouteTargetIter(&obj.obj.L3RouteTargetExport).setMsg(obj) - } - return obj.l3RouteTargetExportHolder -} - -// List of L3VNI Import Route Targets. -// L3RouteTargetImport returns a []BgpRouteTarget -func (obj *bgpV4EviVxlan) L3RouteTargetImport() BgpV4EviVxlanBgpRouteTargetIter { - if len(obj.obj.L3RouteTargetImport) == 0 { - obj.obj.L3RouteTargetImport = []*otg.BgpRouteTarget{} - } - if obj.l3RouteTargetImportHolder == nil { - obj.l3RouteTargetImportHolder = newBgpV4EviVxlanBgpRouteTargetIter(&obj.obj.L3RouteTargetImport).setMsg(obj) - } - return obj.l3RouteTargetImportHolder -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpV4EviVxlan) Advanced() BgpRouteAdvanced { - if obj.obj.Advanced == nil { - obj.obj.Advanced = NewBgpRouteAdvanced().msg() - } - if obj.advancedHolder == nil { - obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} - } - return obj.advancedHolder -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpV4EviVxlan) HasAdvanced() bool { - return obj.obj.Advanced != nil -} - -// description is TBD -// SetAdvanced sets the BgpRouteAdvanced value in the BgpV4EviVxlan object -func (obj *bgpV4EviVxlan) SetAdvanced(value BgpRouteAdvanced) BgpV4EviVxlan { - - obj.advancedHolder = nil - obj.obj.Advanced = value.msg() - - return obj -} - -// Optional community settings. -// Communities returns a []BgpCommunity -func (obj *bgpV4EviVxlan) Communities() BgpV4EviVxlanBgpCommunityIter { - if len(obj.obj.Communities) == 0 { - obj.obj.Communities = []*otg.BgpCommunity{} - } - if obj.communitiesHolder == nil { - obj.communitiesHolder = newBgpV4EviVxlanBgpCommunityIter(&obj.obj.Communities).setMsg(obj) - } - return obj.communitiesHolder -} - -type bgpV4EviVxlanBgpCommunityIter struct { - obj *bgpV4EviVxlan - bgpCommunitySlice []BgpCommunity - fieldPtr *[]*otg.BgpCommunity -} - -func newBgpV4EviVxlanBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpV4EviVxlanBgpCommunityIter { - return &bgpV4EviVxlanBgpCommunityIter{fieldPtr: ptr} -} - -type BgpV4EviVxlanBgpCommunityIter interface { - setMsg(*bgpV4EviVxlan) BgpV4EviVxlanBgpCommunityIter - Items() []BgpCommunity - Add() BgpCommunity - Append(items ...BgpCommunity) BgpV4EviVxlanBgpCommunityIter - Set(index int, newObj BgpCommunity) BgpV4EviVxlanBgpCommunityIter - Clear() BgpV4EviVxlanBgpCommunityIter - clearHolderSlice() BgpV4EviVxlanBgpCommunityIter - appendHolderSlice(item BgpCommunity) BgpV4EviVxlanBgpCommunityIter -} - -func (obj *bgpV4EviVxlanBgpCommunityIter) setMsg(msg *bgpV4EviVxlan) BgpV4EviVxlanBgpCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4EviVxlanBgpCommunityIter) Items() []BgpCommunity { - return obj.bgpCommunitySlice -} - -func (obj *bgpV4EviVxlanBgpCommunityIter) Add() BgpCommunity { - newObj := &otg.BgpCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4EviVxlanBgpCommunityIter) Append(items ...BgpCommunity) BgpV4EviVxlanBgpCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - } - return obj -} - -func (obj *bgpV4EviVxlanBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpV4EviVxlanBgpCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpCommunitySlice[index] = newObj - return obj -} -func (obj *bgpV4EviVxlanBgpCommunityIter) Clear() BgpV4EviVxlanBgpCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpCommunity{} - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpV4EviVxlanBgpCommunityIter) clearHolderSlice() BgpV4EviVxlanBgpCommunityIter { - if len(obj.bgpCommunitySlice) > 0 { - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpV4EviVxlanBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpV4EviVxlanBgpCommunityIter { - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - return obj -} - -// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. -// ExtCommunities returns a []BgpExtCommunity -func (obj *bgpV4EviVxlan) ExtCommunities() BgpV4EviVxlanBgpExtCommunityIter { - if len(obj.obj.ExtCommunities) == 0 { - obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} - } - if obj.extCommunitiesHolder == nil { - obj.extCommunitiesHolder = newBgpV4EviVxlanBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) - } - return obj.extCommunitiesHolder -} - -type bgpV4EviVxlanBgpExtCommunityIter struct { - obj *bgpV4EviVxlan - bgpExtCommunitySlice []BgpExtCommunity - fieldPtr *[]*otg.BgpExtCommunity -} - -func newBgpV4EviVxlanBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpV4EviVxlanBgpExtCommunityIter { - return &bgpV4EviVxlanBgpExtCommunityIter{fieldPtr: ptr} -} - -type BgpV4EviVxlanBgpExtCommunityIter interface { - setMsg(*bgpV4EviVxlan) BgpV4EviVxlanBgpExtCommunityIter - Items() []BgpExtCommunity - Add() BgpExtCommunity - Append(items ...BgpExtCommunity) BgpV4EviVxlanBgpExtCommunityIter - Set(index int, newObj BgpExtCommunity) BgpV4EviVxlanBgpExtCommunityIter - Clear() BgpV4EviVxlanBgpExtCommunityIter - clearHolderSlice() BgpV4EviVxlanBgpExtCommunityIter - appendHolderSlice(item BgpExtCommunity) BgpV4EviVxlanBgpExtCommunityIter -} - -func (obj *bgpV4EviVxlanBgpExtCommunityIter) setMsg(msg *bgpV4EviVxlan) BgpV4EviVxlanBgpExtCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpExtCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4EviVxlanBgpExtCommunityIter) Items() []BgpExtCommunity { - return obj.bgpExtCommunitySlice -} - -func (obj *bgpV4EviVxlanBgpExtCommunityIter) Add() BgpExtCommunity { - newObj := &otg.BgpExtCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpExtCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4EviVxlanBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpV4EviVxlanBgpExtCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - } - return obj -} - -func (obj *bgpV4EviVxlanBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpV4EviVxlanBgpExtCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpExtCommunitySlice[index] = newObj - return obj -} -func (obj *bgpV4EviVxlanBgpExtCommunityIter) Clear() BgpV4EviVxlanBgpExtCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpExtCommunity{} - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpV4EviVxlanBgpExtCommunityIter) clearHolderSlice() BgpV4EviVxlanBgpExtCommunityIter { - if len(obj.bgpExtCommunitySlice) > 0 { - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpV4EviVxlanBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpV4EviVxlanBgpExtCommunityIter { - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - return obj -} - -// Optional AS PATH settings. -// AsPath returns a BgpAsPath -func (obj *bgpV4EviVxlan) AsPath() BgpAsPath { - if obj.obj.AsPath == nil { - obj.obj.AsPath = NewBgpAsPath().msg() - } - if obj.asPathHolder == nil { - obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} - } - return obj.asPathHolder -} - -// Optional AS PATH settings. -// AsPath returns a BgpAsPath -func (obj *bgpV4EviVxlan) HasAsPath() bool { - return obj.obj.AsPath != nil -} - -// Optional AS PATH settings. -// SetAsPath sets the BgpAsPath value in the BgpV4EviVxlan object -func (obj *bgpV4EviVxlan) SetAsPath(value BgpAsPath) BgpV4EviVxlan { - - obj.asPathHolder = nil - obj.obj.AsPath = value.msg() - - return obj -} - -func (obj *bgpV4EviVxlan) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.BroadcastDomains) != 0 { - - if set_default { - obj.BroadcastDomains().clearHolderSlice() - for _, item := range obj.obj.BroadcastDomains { - obj.BroadcastDomains().appendHolderSlice(&bgpV4EviVxlanBroadcastDomain{obj: item}) - } - } - for _, item := range obj.BroadcastDomains().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.PmsiLabel != nil { - - if *obj.obj.PmsiLabel > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpV4EviVxlan.PmsiLabel <= 16777215 but Got %d", *obj.obj.PmsiLabel)) - } - - } - - if obj.obj.AdLabel != nil { - - if *obj.obj.AdLabel > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpV4EviVxlan.AdLabel <= 16777215 but Got %d", *obj.obj.AdLabel)) - } - - } - - if obj.obj.RouteDistinguisher != nil { - - obj.RouteDistinguisher().validateObj(vObj, set_default) - } - - if len(obj.obj.RouteTargetExport) != 0 { - - if set_default { - obj.RouteTargetExport().clearHolderSlice() - for _, item := range obj.obj.RouteTargetExport { - obj.RouteTargetExport().appendHolderSlice(&bgpRouteTarget{obj: item}) - } - } - for _, item := range obj.RouteTargetExport().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.RouteTargetImport) != 0 { - - if set_default { - obj.RouteTargetImport().clearHolderSlice() - for _, item := range obj.obj.RouteTargetImport { - obj.RouteTargetImport().appendHolderSlice(&bgpRouteTarget{obj: item}) - } - } - for _, item := range obj.RouteTargetImport().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.L3RouteTargetExport) != 0 { - - if set_default { - obj.L3RouteTargetExport().clearHolderSlice() - for _, item := range obj.obj.L3RouteTargetExport { - obj.L3RouteTargetExport().appendHolderSlice(&bgpRouteTarget{obj: item}) - } - } - for _, item := range obj.L3RouteTargetExport().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.L3RouteTargetImport) != 0 { - - if set_default { - obj.L3RouteTargetImport().clearHolderSlice() - for _, item := range obj.obj.L3RouteTargetImport { - obj.L3RouteTargetImport().appendHolderSlice(&bgpRouteTarget{obj: item}) - } - } - for _, item := range obj.L3RouteTargetImport().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Advanced != nil { - - obj.Advanced().validateObj(vObj, set_default) - } - - if len(obj.obj.Communities) != 0 { - - if set_default { - obj.Communities().clearHolderSlice() - for _, item := range obj.obj.Communities { - obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) - } - } - for _, item := range obj.Communities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.ExtCommunities) != 0 { - - if set_default { - obj.ExtCommunities().clearHolderSlice() - for _, item := range obj.obj.ExtCommunities { - obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) - } - } - for _, item := range obj.ExtCommunities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.AsPath != nil { - - obj.AsPath().validateObj(vObj, set_default) - } - -} - -func (obj *bgpV4EviVxlan) setDefault() { - if obj.obj.ReplicationType == nil { - obj.SetReplicationType(BgpV4EviVxlanReplicationType.INGRESS_REPLICATION) - - } - if obj.obj.PmsiLabel == nil { - obj.SetPmsiLabel(16) - } - if obj.obj.AdLabel == nil { - obj.SetAdLabel(0) - } - -} - -// ***** BgpAsPathSegment ***** -type bgpAsPathSegment struct { - validation - obj *otg.BgpAsPathSegment - marshaller marshalBgpAsPathSegment - unMarshaller unMarshalBgpAsPathSegment -} - -func NewBgpAsPathSegment() BgpAsPathSegment { - obj := bgpAsPathSegment{obj: &otg.BgpAsPathSegment{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAsPathSegment) msg() *otg.BgpAsPathSegment { - return obj.obj -} - -func (obj *bgpAsPathSegment) setMsg(msg *otg.BgpAsPathSegment) BgpAsPathSegment { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAsPathSegment struct { - obj *bgpAsPathSegment -} - -type marshalBgpAsPathSegment interface { - // ToProto marshals BgpAsPathSegment to protobuf object *otg.BgpAsPathSegment - ToProto() (*otg.BgpAsPathSegment, error) - // ToPbText marshals BgpAsPathSegment to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAsPathSegment to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAsPathSegment to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAsPathSegment struct { - obj *bgpAsPathSegment -} - -type unMarshalBgpAsPathSegment interface { - // FromProto unmarshals BgpAsPathSegment from protobuf object *otg.BgpAsPathSegment - FromProto(msg *otg.BgpAsPathSegment) (BgpAsPathSegment, error) - // FromPbText unmarshals BgpAsPathSegment from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAsPathSegment from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAsPathSegment from JSON text - FromJson(value string) error -} - -func (obj *bgpAsPathSegment) Marshal() marshalBgpAsPathSegment { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAsPathSegment{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAsPathSegment) Unmarshal() unMarshalBgpAsPathSegment { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAsPathSegment{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAsPathSegment) ToProto() (*otg.BgpAsPathSegment, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAsPathSegment) FromProto(msg *otg.BgpAsPathSegment) (BgpAsPathSegment, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAsPathSegment) 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 *unMarshalbgpAsPathSegment) 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 *marshalbgpAsPathSegment) 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 *unMarshalbgpAsPathSegment) 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 *marshalbgpAsPathSegment) 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 *unMarshalbgpAsPathSegment) 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 *bgpAsPathSegment) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAsPathSegment) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAsPathSegment) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAsPathSegment) Clone() (BgpAsPathSegment, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAsPathSegment() - 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 -} - -// BgpAsPathSegment is configuration for a single BGP AS path segment -type BgpAsPathSegment interface { - Validation - // msg marshals BgpAsPathSegment to protobuf object *otg.BgpAsPathSegment - // and doesn't set defaults - msg() *otg.BgpAsPathSegment - // setMsg unmarshals BgpAsPathSegment from protobuf object *otg.BgpAsPathSegment - // and doesn't set defaults - setMsg(*otg.BgpAsPathSegment) BgpAsPathSegment - // provides marshal interface - Marshal() marshalBgpAsPathSegment - // provides unmarshal interface - Unmarshal() unMarshalBgpAsPathSegment - // validate validates BgpAsPathSegment - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAsPathSegment, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Type returns BgpAsPathSegmentTypeEnum, set in BgpAsPathSegment - Type() BgpAsPathSegmentTypeEnum - // SetType assigns BgpAsPathSegmentTypeEnum provided by user to BgpAsPathSegment - SetType(value BgpAsPathSegmentTypeEnum) BgpAsPathSegment - // HasType checks if Type has been set in BgpAsPathSegment - HasType() bool - // AsNumbers returns []uint32, set in BgpAsPathSegment. - AsNumbers() []uint32 - // SetAsNumbers assigns []uint32 provided by user to BgpAsPathSegment - SetAsNumbers(value []uint32) BgpAsPathSegment -} - -type BgpAsPathSegmentTypeEnum string - -// Enum of Type on BgpAsPathSegment -var BgpAsPathSegmentType = struct { - AS_SEQ BgpAsPathSegmentTypeEnum - AS_SET BgpAsPathSegmentTypeEnum - AS_CONFED_SEQ BgpAsPathSegmentTypeEnum - AS_CONFED_SET BgpAsPathSegmentTypeEnum -}{ - AS_SEQ: BgpAsPathSegmentTypeEnum("as_seq"), - AS_SET: BgpAsPathSegmentTypeEnum("as_set"), - AS_CONFED_SEQ: BgpAsPathSegmentTypeEnum("as_confed_seq"), - AS_CONFED_SET: BgpAsPathSegmentTypeEnum("as_confed_set"), -} - -func (obj *bgpAsPathSegment) Type() BgpAsPathSegmentTypeEnum { - return BgpAsPathSegmentTypeEnum(obj.obj.Type.Enum().String()) -} - -// AS sequence is the most common type of AS_PATH, it contains the list of ASNs starting with the most recent ASN being added read from left to right. -// The other three AS_PATH types are used for Confederations - AS_SET is the type of AS_PATH attribute that summarizes routes using using the aggregate-address command, allowing AS_PATHs to be summarized in the update as well. - AS_CONFED_SEQ gives the list of ASNs in the path starting with the most recent ASN to be added reading left to right - AS_CONFED_SET will allow summarization of multiple AS PATHs to be sent in BGP Updates. -// Type returns a string -func (obj *bgpAsPathSegment) HasType() bool { - return obj.obj.Type != nil -} - -func (obj *bgpAsPathSegment) SetType(value BgpAsPathSegmentTypeEnum) BgpAsPathSegment { - intValue, ok := otg.BgpAsPathSegment_Type_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAsPathSegmentTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpAsPathSegment_Type_Enum(intValue) - obj.obj.Type = &enumValue - - return obj -} - -// The AS numbers in this AS path segment. -// AsNumbers returns a []uint32 -func (obj *bgpAsPathSegment) AsNumbers() []uint32 { - if obj.obj.AsNumbers == nil { - obj.obj.AsNumbers = make([]uint32, 0) - } - return obj.obj.AsNumbers -} - -// The AS numbers in this AS path segment. -// SetAsNumbers sets the []uint32 value in the BgpAsPathSegment object -func (obj *bgpAsPathSegment) SetAsNumbers(value []uint32) BgpAsPathSegment { - - if obj.obj.AsNumbers == nil { - obj.obj.AsNumbers = make([]uint32, 0) - } - obj.obj.AsNumbers = value - - return obj -} - -func (obj *bgpAsPathSegment) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpAsPathSegment) setDefault() { - if obj.obj.Type == nil { - obj.SetType(BgpAsPathSegmentType.AS_SEQ) - - } - -} - -// ***** BgpExtendedCommunityTransitive2OctetAsType ***** -type bgpExtendedCommunityTransitive2OctetAsType struct { - validation - obj *otg.BgpExtendedCommunityTransitive2OctetAsType - marshaller marshalBgpExtendedCommunityTransitive2OctetAsType - unMarshaller unMarshalBgpExtendedCommunityTransitive2OctetAsType - routeTargetSubtypeHolder BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - routeOriginSubtypeHolder BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin -} - -func NewBgpExtendedCommunityTransitive2OctetAsType() BgpExtendedCommunityTransitive2OctetAsType { - obj := bgpExtendedCommunityTransitive2OctetAsType{obj: &otg.BgpExtendedCommunityTransitive2OctetAsType{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsType) msg() *otg.BgpExtendedCommunityTransitive2OctetAsType { - return obj.obj -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsType) setMsg(msg *otg.BgpExtendedCommunityTransitive2OctetAsType) BgpExtendedCommunityTransitive2OctetAsType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityTransitive2OctetAsType struct { - obj *bgpExtendedCommunityTransitive2OctetAsType -} - -type marshalBgpExtendedCommunityTransitive2OctetAsType interface { - // ToProto marshals BgpExtendedCommunityTransitive2OctetAsType to protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsType - ToProto() (*otg.BgpExtendedCommunityTransitive2OctetAsType, error) - // ToPbText marshals BgpExtendedCommunityTransitive2OctetAsType to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityTransitive2OctetAsType to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityTransitive2OctetAsType to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityTransitive2OctetAsType struct { - obj *bgpExtendedCommunityTransitive2OctetAsType -} - -type unMarshalBgpExtendedCommunityTransitive2OctetAsType interface { - // FromProto unmarshals BgpExtendedCommunityTransitive2OctetAsType from protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsType - FromProto(msg *otg.BgpExtendedCommunityTransitive2OctetAsType) (BgpExtendedCommunityTransitive2OctetAsType, error) - // FromPbText unmarshals BgpExtendedCommunityTransitive2OctetAsType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityTransitive2OctetAsType from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityTransitive2OctetAsType from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsType) Marshal() marshalBgpExtendedCommunityTransitive2OctetAsType { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityTransitive2OctetAsType{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsType) Unmarshal() unMarshalBgpExtendedCommunityTransitive2OctetAsType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitive2OctetAsType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityTransitive2OctetAsType) ToProto() (*otg.BgpExtendedCommunityTransitive2OctetAsType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityTransitive2OctetAsType) FromProto(msg *otg.BgpExtendedCommunityTransitive2OctetAsType) (BgpExtendedCommunityTransitive2OctetAsType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityTransitive2OctetAsType) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpExtendedCommunityTransitive2OctetAsType) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpExtendedCommunityTransitive2OctetAsType) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsType) Clone() (BgpExtendedCommunityTransitive2OctetAsType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityTransitive2OctetAsType() - 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 -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsType) setNil() { - obj.routeTargetSubtypeHolder = nil - obj.routeOriginSubtypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpExtendedCommunityTransitive2OctetAsType is the Transitive Two-Octet AS-Specific Extended Community is sent as type 0x00 . -type BgpExtendedCommunityTransitive2OctetAsType interface { - Validation - // msg marshals BgpExtendedCommunityTransitive2OctetAsType to protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsType - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityTransitive2OctetAsType - // setMsg unmarshals BgpExtendedCommunityTransitive2OctetAsType from protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsType - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityTransitive2OctetAsType) BgpExtendedCommunityTransitive2OctetAsType - // provides marshal interface - Marshal() marshalBgpExtendedCommunityTransitive2OctetAsType - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityTransitive2OctetAsType - // validate validates BgpExtendedCommunityTransitive2OctetAsType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityTransitive2OctetAsType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum, set in BgpExtendedCommunityTransitive2OctetAsType - Choice() BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum - // setChoice assigns BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum provided by user to BgpExtendedCommunityTransitive2OctetAsType - setChoice(value BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum) BgpExtendedCommunityTransitive2OctetAsType - // HasChoice checks if Choice has been set in BgpExtendedCommunityTransitive2OctetAsType - HasChoice() bool - // RouteTargetSubtype returns BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget, set in BgpExtendedCommunityTransitive2OctetAsType. - // BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. - RouteTargetSubtype() BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - // SetRouteTargetSubtype assigns BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget provided by user to BgpExtendedCommunityTransitive2OctetAsType. - // BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. - SetRouteTargetSubtype(value BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive2OctetAsType - // HasRouteTargetSubtype checks if RouteTargetSubtype has been set in BgpExtendedCommunityTransitive2OctetAsType - HasRouteTargetSubtype() bool - // RouteOriginSubtype returns BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin, set in BgpExtendedCommunityTransitive2OctetAsType. - // BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03 . - RouteOriginSubtype() BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // SetRouteOriginSubtype assigns BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin provided by user to BgpExtendedCommunityTransitive2OctetAsType. - // BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03 . - SetRouteOriginSubtype(value BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive2OctetAsType - // HasRouteOriginSubtype checks if RouteOriginSubtype has been set in BgpExtendedCommunityTransitive2OctetAsType - HasRouteOriginSubtype() bool - setNil() -} - -type BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum string - -// Enum of Choice on BgpExtendedCommunityTransitive2OctetAsType -var BgpExtendedCommunityTransitive2OctetAsTypeChoice = struct { - ROUTE_TARGET_SUBTYPE BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum - ROUTE_ORIGIN_SUBTYPE BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum -}{ - ROUTE_TARGET_SUBTYPE: BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum("route_target_subtype"), - ROUTE_ORIGIN_SUBTYPE: BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum("route_origin_subtype"), -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsType) Choice() BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum { - return BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *bgpExtendedCommunityTransitive2OctetAsType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsType) setChoice(value BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum) BgpExtendedCommunityTransitive2OctetAsType { - intValue, ok := otg.BgpExtendedCommunityTransitive2OctetAsType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpExtendedCommunityTransitive2OctetAsType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.RouteOriginSubtype = nil - obj.routeOriginSubtypeHolder = nil - obj.obj.RouteTargetSubtype = nil - obj.routeTargetSubtypeHolder = nil - - if value == BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE { - obj.obj.RouteTargetSubtype = NewBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget().msg() - } - - if value == BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE { - obj.obj.RouteOriginSubtype = NewBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin().msg() - } - - return obj -} - -// description is TBD -// RouteTargetSubtype returns a BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget -func (obj *bgpExtendedCommunityTransitive2OctetAsType) RouteTargetSubtype() BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { - if obj.obj.RouteTargetSubtype == nil { - obj.setChoice(BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) - } - if obj.routeTargetSubtypeHolder == nil { - obj.routeTargetSubtypeHolder = &bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: obj.obj.RouteTargetSubtype} - } - return obj.routeTargetSubtypeHolder -} - -// description is TBD -// RouteTargetSubtype returns a BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget -func (obj *bgpExtendedCommunityTransitive2OctetAsType) HasRouteTargetSubtype() bool { - return obj.obj.RouteTargetSubtype != nil -} - -// description is TBD -// SetRouteTargetSubtype sets the BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget value in the BgpExtendedCommunityTransitive2OctetAsType object -func (obj *bgpExtendedCommunityTransitive2OctetAsType) SetRouteTargetSubtype(value BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive2OctetAsType { - obj.setChoice(BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) - obj.routeTargetSubtypeHolder = nil - obj.obj.RouteTargetSubtype = value.msg() - - return obj -} - -// description is TBD -// RouteOriginSubtype returns a BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin -func (obj *bgpExtendedCommunityTransitive2OctetAsType) RouteOriginSubtype() BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - if obj.obj.RouteOriginSubtype == nil { - obj.setChoice(BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) - } - if obj.routeOriginSubtypeHolder == nil { - obj.routeOriginSubtypeHolder = &bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: obj.obj.RouteOriginSubtype} - } - return obj.routeOriginSubtypeHolder -} - -// description is TBD -// RouteOriginSubtype returns a BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin -func (obj *bgpExtendedCommunityTransitive2OctetAsType) HasRouteOriginSubtype() bool { - return obj.obj.RouteOriginSubtype != nil -} - -// description is TBD -// SetRouteOriginSubtype sets the BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin value in the BgpExtendedCommunityTransitive2OctetAsType object -func (obj *bgpExtendedCommunityTransitive2OctetAsType) SetRouteOriginSubtype(value BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive2OctetAsType { - obj.setChoice(BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) - obj.routeOriginSubtypeHolder = nil - obj.obj.RouteOriginSubtype = value.msg() - - return obj -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RouteTargetSubtype != nil { - - obj.RouteTargetSubtype().validateObj(vObj, set_default) - } - - if obj.obj.RouteOriginSubtype != nil { - - obj.RouteOriginSubtype().validateObj(vObj, set_default) - } - -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsType) setDefault() { - var choices_set int = 0 - var choice BgpExtendedCommunityTransitive2OctetAsTypeChoiceEnum - - if obj.obj.RouteTargetSubtype != nil { - choices_set += 1 - choice = BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE - } - - if obj.obj.RouteOriginSubtype != nil { - choices_set += 1 - choice = BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(BgpExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpExtendedCommunityTransitive2OctetAsType") - } - } else { - intVal := otg.BgpExtendedCommunityTransitive2OctetAsType_Choice_Enum_value[string(choice)] - enumValue := otg.BgpExtendedCommunityTransitive2OctetAsType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpExtendedCommunityTransitiveIpv4AddressType ***** -type bgpExtendedCommunityTransitiveIpv4AddressType struct { - validation - obj *otg.BgpExtendedCommunityTransitiveIpv4AddressType - marshaller marshalBgpExtendedCommunityTransitiveIpv4AddressType - unMarshaller unMarshalBgpExtendedCommunityTransitiveIpv4AddressType - routeTargetSubtypeHolder BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - routeOriginSubtypeHolder BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin -} - -func NewBgpExtendedCommunityTransitiveIpv4AddressType() BgpExtendedCommunityTransitiveIpv4AddressType { - obj := bgpExtendedCommunityTransitiveIpv4AddressType{obj: &otg.BgpExtendedCommunityTransitiveIpv4AddressType{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) msg() *otg.BgpExtendedCommunityTransitiveIpv4AddressType { - return obj.obj -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) setMsg(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressType) BgpExtendedCommunityTransitiveIpv4AddressType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityTransitiveIpv4AddressType struct { - obj *bgpExtendedCommunityTransitiveIpv4AddressType -} - -type marshalBgpExtendedCommunityTransitiveIpv4AddressType interface { - // ToProto marshals BgpExtendedCommunityTransitiveIpv4AddressType to protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressType - ToProto() (*otg.BgpExtendedCommunityTransitiveIpv4AddressType, error) - // ToPbText marshals BgpExtendedCommunityTransitiveIpv4AddressType to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityTransitiveIpv4AddressType to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityTransitiveIpv4AddressType to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityTransitiveIpv4AddressType struct { - obj *bgpExtendedCommunityTransitiveIpv4AddressType -} - -type unMarshalBgpExtendedCommunityTransitiveIpv4AddressType interface { - // FromProto unmarshals BgpExtendedCommunityTransitiveIpv4AddressType from protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressType - FromProto(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressType) (BgpExtendedCommunityTransitiveIpv4AddressType, error) - // FromPbText unmarshals BgpExtendedCommunityTransitiveIpv4AddressType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityTransitiveIpv4AddressType from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityTransitiveIpv4AddressType from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) Marshal() marshalBgpExtendedCommunityTransitiveIpv4AddressType { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityTransitiveIpv4AddressType{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) Unmarshal() unMarshalBgpExtendedCommunityTransitiveIpv4AddressType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveIpv4AddressType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressType) ToProto() (*otg.BgpExtendedCommunityTransitiveIpv4AddressType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityTransitiveIpv4AddressType) FromProto(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressType) (BgpExtendedCommunityTransitiveIpv4AddressType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressType) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressType) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressType) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) Clone() (BgpExtendedCommunityTransitiveIpv4AddressType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityTransitiveIpv4AddressType() - 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 -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) setNil() { - obj.routeTargetSubtypeHolder = nil - obj.routeOriginSubtypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpExtendedCommunityTransitiveIpv4AddressType is the Transitive IPv4 Address Specific Extended Community is sent as type 0x01. -type BgpExtendedCommunityTransitiveIpv4AddressType interface { - Validation - // msg marshals BgpExtendedCommunityTransitiveIpv4AddressType to protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressType - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityTransitiveIpv4AddressType - // setMsg unmarshals BgpExtendedCommunityTransitiveIpv4AddressType from protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressType - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityTransitiveIpv4AddressType) BgpExtendedCommunityTransitiveIpv4AddressType - // provides marshal interface - Marshal() marshalBgpExtendedCommunityTransitiveIpv4AddressType - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityTransitiveIpv4AddressType - // validate validates BgpExtendedCommunityTransitiveIpv4AddressType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityTransitiveIpv4AddressType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum, set in BgpExtendedCommunityTransitiveIpv4AddressType - Choice() BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum - // setChoice assigns BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum provided by user to BgpExtendedCommunityTransitiveIpv4AddressType - setChoice(value BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum) BgpExtendedCommunityTransitiveIpv4AddressType - // HasChoice checks if Choice has been set in BgpExtendedCommunityTransitiveIpv4AddressType - HasChoice() bool - // RouteTargetSubtype returns BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, set in BgpExtendedCommunityTransitiveIpv4AddressType. - // BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. - RouteTargetSubtype() BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // SetRouteTargetSubtype assigns BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget provided by user to BgpExtendedCommunityTransitiveIpv4AddressType. - // BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. - SetRouteTargetSubtype(value BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) BgpExtendedCommunityTransitiveIpv4AddressType - // HasRouteTargetSubtype checks if RouteTargetSubtype has been set in BgpExtendedCommunityTransitiveIpv4AddressType - HasRouteTargetSubtype() bool - // RouteOriginSubtype returns BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, set in BgpExtendedCommunityTransitiveIpv4AddressType. - // BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP It is sent with sub-type as 0x03. - RouteOriginSubtype() BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // SetRouteOriginSubtype assigns BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin provided by user to BgpExtendedCommunityTransitiveIpv4AddressType. - // BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP It is sent with sub-type as 0x03. - SetRouteOriginSubtype(value BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) BgpExtendedCommunityTransitiveIpv4AddressType - // HasRouteOriginSubtype checks if RouteOriginSubtype has been set in BgpExtendedCommunityTransitiveIpv4AddressType - HasRouteOriginSubtype() bool - setNil() -} - -type BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum string - -// Enum of Choice on BgpExtendedCommunityTransitiveIpv4AddressType -var BgpExtendedCommunityTransitiveIpv4AddressTypeChoice = struct { - ROUTE_TARGET_SUBTYPE BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum - ROUTE_ORIGIN_SUBTYPE BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum -}{ - ROUTE_TARGET_SUBTYPE: BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum("route_target_subtype"), - ROUTE_ORIGIN_SUBTYPE: BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum("route_origin_subtype"), -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) Choice() BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum { - return BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) setChoice(value BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum) BgpExtendedCommunityTransitiveIpv4AddressType { - intValue, ok := otg.BgpExtendedCommunityTransitiveIpv4AddressType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpExtendedCommunityTransitiveIpv4AddressType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.RouteOriginSubtype = nil - obj.routeOriginSubtypeHolder = nil - obj.obj.RouteTargetSubtype = nil - obj.routeTargetSubtypeHolder = nil - - if value == BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE { - obj.obj.RouteTargetSubtype = NewBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget().msg() - } - - if value == BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE { - obj.obj.RouteOriginSubtype = NewBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin().msg() - } - - return obj -} - -// description is TBD -// RouteTargetSubtype returns a BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) RouteTargetSubtype() BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - if obj.obj.RouteTargetSubtype == nil { - obj.setChoice(BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE) - } - if obj.routeTargetSubtypeHolder == nil { - obj.routeTargetSubtypeHolder = &bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: obj.obj.RouteTargetSubtype} - } - return obj.routeTargetSubtypeHolder -} - -// description is TBD -// RouteTargetSubtype returns a BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) HasRouteTargetSubtype() bool { - return obj.obj.RouteTargetSubtype != nil -} - -// description is TBD -// SetRouteTargetSubtype sets the BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget value in the BgpExtendedCommunityTransitiveIpv4AddressType object -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) SetRouteTargetSubtype(value BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) BgpExtendedCommunityTransitiveIpv4AddressType { - obj.setChoice(BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE) - obj.routeTargetSubtypeHolder = nil - obj.obj.RouteTargetSubtype = value.msg() - - return obj -} - -// description is TBD -// RouteOriginSubtype returns a BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) RouteOriginSubtype() BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - if obj.obj.RouteOriginSubtype == nil { - obj.setChoice(BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE) - } - if obj.routeOriginSubtypeHolder == nil { - obj.routeOriginSubtypeHolder = &bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: obj.obj.RouteOriginSubtype} - } - return obj.routeOriginSubtypeHolder -} - -// description is TBD -// RouteOriginSubtype returns a BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) HasRouteOriginSubtype() bool { - return obj.obj.RouteOriginSubtype != nil -} - -// description is TBD -// SetRouteOriginSubtype sets the BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin value in the BgpExtendedCommunityTransitiveIpv4AddressType object -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) SetRouteOriginSubtype(value BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) BgpExtendedCommunityTransitiveIpv4AddressType { - obj.setChoice(BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE) - obj.routeOriginSubtypeHolder = nil - obj.obj.RouteOriginSubtype = value.msg() - - return obj -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RouteTargetSubtype != nil { - - obj.RouteTargetSubtype().validateObj(vObj, set_default) - } - - if obj.obj.RouteOriginSubtype != nil { - - obj.RouteOriginSubtype().validateObj(vObj, set_default) - } - -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressType) setDefault() { - var choices_set int = 0 - var choice BgpExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum - - if obj.obj.RouteTargetSubtype != nil { - choices_set += 1 - choice = BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE - } - - if obj.obj.RouteOriginSubtype != nil { - choices_set += 1 - choice = BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(BgpExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpExtendedCommunityTransitiveIpv4AddressType") - } - } else { - intVal := otg.BgpExtendedCommunityTransitiveIpv4AddressType_Choice_Enum_value[string(choice)] - enumValue := otg.BgpExtendedCommunityTransitiveIpv4AddressType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpExtendedCommunityTransitive4OctetAsType ***** -type bgpExtendedCommunityTransitive4OctetAsType struct { - validation - obj *otg.BgpExtendedCommunityTransitive4OctetAsType - marshaller marshalBgpExtendedCommunityTransitive4OctetAsType - unMarshaller unMarshalBgpExtendedCommunityTransitive4OctetAsType - routeTargetSubtypeHolder BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - routeOriginSubtypeHolder BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin -} - -func NewBgpExtendedCommunityTransitive4OctetAsType() BgpExtendedCommunityTransitive4OctetAsType { - obj := bgpExtendedCommunityTransitive4OctetAsType{obj: &otg.BgpExtendedCommunityTransitive4OctetAsType{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsType) msg() *otg.BgpExtendedCommunityTransitive4OctetAsType { - return obj.obj -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsType) setMsg(msg *otg.BgpExtendedCommunityTransitive4OctetAsType) BgpExtendedCommunityTransitive4OctetAsType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityTransitive4OctetAsType struct { - obj *bgpExtendedCommunityTransitive4OctetAsType -} - -type marshalBgpExtendedCommunityTransitive4OctetAsType interface { - // ToProto marshals BgpExtendedCommunityTransitive4OctetAsType to protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsType - ToProto() (*otg.BgpExtendedCommunityTransitive4OctetAsType, error) - // ToPbText marshals BgpExtendedCommunityTransitive4OctetAsType to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityTransitive4OctetAsType to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityTransitive4OctetAsType to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityTransitive4OctetAsType struct { - obj *bgpExtendedCommunityTransitive4OctetAsType -} - -type unMarshalBgpExtendedCommunityTransitive4OctetAsType interface { - // FromProto unmarshals BgpExtendedCommunityTransitive4OctetAsType from protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsType - FromProto(msg *otg.BgpExtendedCommunityTransitive4OctetAsType) (BgpExtendedCommunityTransitive4OctetAsType, error) - // FromPbText unmarshals BgpExtendedCommunityTransitive4OctetAsType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityTransitive4OctetAsType from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityTransitive4OctetAsType from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsType) Marshal() marshalBgpExtendedCommunityTransitive4OctetAsType { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityTransitive4OctetAsType{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsType) Unmarshal() unMarshalBgpExtendedCommunityTransitive4OctetAsType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitive4OctetAsType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityTransitive4OctetAsType) ToProto() (*otg.BgpExtendedCommunityTransitive4OctetAsType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityTransitive4OctetAsType) FromProto(msg *otg.BgpExtendedCommunityTransitive4OctetAsType) (BgpExtendedCommunityTransitive4OctetAsType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityTransitive4OctetAsType) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpExtendedCommunityTransitive4OctetAsType) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpExtendedCommunityTransitive4OctetAsType) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsType) Clone() (BgpExtendedCommunityTransitive4OctetAsType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityTransitive4OctetAsType() - 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 -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsType) setNil() { - obj.routeTargetSubtypeHolder = nil - obj.routeOriginSubtypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpExtendedCommunityTransitive4OctetAsType is the Transitive Four-Octet AS-Specific Extended Community is sent as type 0x02. It is defined in RFC 5668. -type BgpExtendedCommunityTransitive4OctetAsType interface { - Validation - // msg marshals BgpExtendedCommunityTransitive4OctetAsType to protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsType - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityTransitive4OctetAsType - // setMsg unmarshals BgpExtendedCommunityTransitive4OctetAsType from protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsType - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityTransitive4OctetAsType) BgpExtendedCommunityTransitive4OctetAsType - // provides marshal interface - Marshal() marshalBgpExtendedCommunityTransitive4OctetAsType - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityTransitive4OctetAsType - // validate validates BgpExtendedCommunityTransitive4OctetAsType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityTransitive4OctetAsType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum, set in BgpExtendedCommunityTransitive4OctetAsType - Choice() BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum - // setChoice assigns BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum provided by user to BgpExtendedCommunityTransitive4OctetAsType - setChoice(value BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum) BgpExtendedCommunityTransitive4OctetAsType - // HasChoice checks if Choice has been set in BgpExtendedCommunityTransitive4OctetAsType - HasChoice() bool - // RouteTargetSubtype returns BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget, set in BgpExtendedCommunityTransitive4OctetAsType. - // BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02 - RouteTargetSubtype() BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - // SetRouteTargetSubtype assigns BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget provided by user to BgpExtendedCommunityTransitive4OctetAsType. - // BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02 - SetRouteTargetSubtype(value BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive4OctetAsType - // HasRouteTargetSubtype checks if RouteTargetSubtype has been set in BgpExtendedCommunityTransitive4OctetAsType - HasRouteTargetSubtype() bool - // RouteOriginSubtype returns BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin, set in BgpExtendedCommunityTransitive4OctetAsType. - // BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03. - RouteOriginSubtype() BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // SetRouteOriginSubtype assigns BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin provided by user to BgpExtendedCommunityTransitive4OctetAsType. - // BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03. - SetRouteOriginSubtype(value BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive4OctetAsType - // HasRouteOriginSubtype checks if RouteOriginSubtype has been set in BgpExtendedCommunityTransitive4OctetAsType - HasRouteOriginSubtype() bool - setNil() -} - -type BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum string - -// Enum of Choice on BgpExtendedCommunityTransitive4OctetAsType -var BgpExtendedCommunityTransitive4OctetAsTypeChoice = struct { - ROUTE_TARGET_SUBTYPE BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum - ROUTE_ORIGIN_SUBTYPE BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum -}{ - ROUTE_TARGET_SUBTYPE: BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum("route_target_subtype"), - ROUTE_ORIGIN_SUBTYPE: BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum("route_origin_subtype"), -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsType) Choice() BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum { - return BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *bgpExtendedCommunityTransitive4OctetAsType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsType) setChoice(value BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum) BgpExtendedCommunityTransitive4OctetAsType { - intValue, ok := otg.BgpExtendedCommunityTransitive4OctetAsType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpExtendedCommunityTransitive4OctetAsType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.RouteOriginSubtype = nil - obj.routeOriginSubtypeHolder = nil - obj.obj.RouteTargetSubtype = nil - obj.routeTargetSubtypeHolder = nil - - if value == BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE { - obj.obj.RouteTargetSubtype = NewBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget().msg() - } - - if value == BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE { - obj.obj.RouteOriginSubtype = NewBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin().msg() - } - - return obj -} - -// description is TBD -// RouteTargetSubtype returns a BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget -func (obj *bgpExtendedCommunityTransitive4OctetAsType) RouteTargetSubtype() BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { - if obj.obj.RouteTargetSubtype == nil { - obj.setChoice(BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) - } - if obj.routeTargetSubtypeHolder == nil { - obj.routeTargetSubtypeHolder = &bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: obj.obj.RouteTargetSubtype} - } - return obj.routeTargetSubtypeHolder -} - -// description is TBD -// RouteTargetSubtype returns a BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget -func (obj *bgpExtendedCommunityTransitive4OctetAsType) HasRouteTargetSubtype() bool { - return obj.obj.RouteTargetSubtype != nil -} - -// description is TBD -// SetRouteTargetSubtype sets the BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget value in the BgpExtendedCommunityTransitive4OctetAsType object -func (obj *bgpExtendedCommunityTransitive4OctetAsType) SetRouteTargetSubtype(value BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive4OctetAsType { - obj.setChoice(BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) - obj.routeTargetSubtypeHolder = nil - obj.obj.RouteTargetSubtype = value.msg() - - return obj -} - -// description is TBD -// RouteOriginSubtype returns a BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin -func (obj *bgpExtendedCommunityTransitive4OctetAsType) RouteOriginSubtype() BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - if obj.obj.RouteOriginSubtype == nil { - obj.setChoice(BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) - } - if obj.routeOriginSubtypeHolder == nil { - obj.routeOriginSubtypeHolder = &bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: obj.obj.RouteOriginSubtype} - } - return obj.routeOriginSubtypeHolder -} - -// description is TBD -// RouteOriginSubtype returns a BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin -func (obj *bgpExtendedCommunityTransitive4OctetAsType) HasRouteOriginSubtype() bool { - return obj.obj.RouteOriginSubtype != nil -} - -// description is TBD -// SetRouteOriginSubtype sets the BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin value in the BgpExtendedCommunityTransitive4OctetAsType object -func (obj *bgpExtendedCommunityTransitive4OctetAsType) SetRouteOriginSubtype(value BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive4OctetAsType { - obj.setChoice(BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) - obj.routeOriginSubtypeHolder = nil - obj.obj.RouteOriginSubtype = value.msg() - - return obj -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RouteTargetSubtype != nil { - - obj.RouteTargetSubtype().validateObj(vObj, set_default) - } - - if obj.obj.RouteOriginSubtype != nil { - - obj.RouteOriginSubtype().validateObj(vObj, set_default) - } - -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsType) setDefault() { - var choices_set int = 0 - var choice BgpExtendedCommunityTransitive4OctetAsTypeChoiceEnum - - if obj.obj.RouteTargetSubtype != nil { - choices_set += 1 - choice = BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE - } - - if obj.obj.RouteOriginSubtype != nil { - choices_set += 1 - choice = BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(BgpExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpExtendedCommunityTransitive4OctetAsType") - } - } else { - intVal := otg.BgpExtendedCommunityTransitive4OctetAsType_Choice_Enum_value[string(choice)] - enumValue := otg.BgpExtendedCommunityTransitive4OctetAsType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpExtendedCommunityTransitiveOpaqueType ***** -type bgpExtendedCommunityTransitiveOpaqueType struct { - validation - obj *otg.BgpExtendedCommunityTransitiveOpaqueType - marshaller marshalBgpExtendedCommunityTransitiveOpaqueType - unMarshaller unMarshalBgpExtendedCommunityTransitiveOpaqueType - colorSubtypeHolder BgpExtendedCommunityTransitiveOpaqueTypeColor - encapsulationSubtypeHolder BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation -} - -func NewBgpExtendedCommunityTransitiveOpaqueType() BgpExtendedCommunityTransitiveOpaqueType { - obj := bgpExtendedCommunityTransitiveOpaqueType{obj: &otg.BgpExtendedCommunityTransitiveOpaqueType{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueType) msg() *otg.BgpExtendedCommunityTransitiveOpaqueType { - return obj.obj -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueType) setMsg(msg *otg.BgpExtendedCommunityTransitiveOpaqueType) BgpExtendedCommunityTransitiveOpaqueType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityTransitiveOpaqueType struct { - obj *bgpExtendedCommunityTransitiveOpaqueType -} - -type marshalBgpExtendedCommunityTransitiveOpaqueType interface { - // ToProto marshals BgpExtendedCommunityTransitiveOpaqueType to protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueType - ToProto() (*otg.BgpExtendedCommunityTransitiveOpaqueType, error) - // ToPbText marshals BgpExtendedCommunityTransitiveOpaqueType to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityTransitiveOpaqueType to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityTransitiveOpaqueType to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityTransitiveOpaqueType struct { - obj *bgpExtendedCommunityTransitiveOpaqueType -} - -type unMarshalBgpExtendedCommunityTransitiveOpaqueType interface { - // FromProto unmarshals BgpExtendedCommunityTransitiveOpaqueType from protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueType - FromProto(msg *otg.BgpExtendedCommunityTransitiveOpaqueType) (BgpExtendedCommunityTransitiveOpaqueType, error) - // FromPbText unmarshals BgpExtendedCommunityTransitiveOpaqueType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityTransitiveOpaqueType from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityTransitiveOpaqueType from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueType) Marshal() marshalBgpExtendedCommunityTransitiveOpaqueType { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityTransitiveOpaqueType{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueType) Unmarshal() unMarshalBgpExtendedCommunityTransitiveOpaqueType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveOpaqueType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityTransitiveOpaqueType) ToProto() (*otg.BgpExtendedCommunityTransitiveOpaqueType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityTransitiveOpaqueType) FromProto(msg *otg.BgpExtendedCommunityTransitiveOpaqueType) (BgpExtendedCommunityTransitiveOpaqueType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityTransitiveOpaqueType) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpExtendedCommunityTransitiveOpaqueType) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpExtendedCommunityTransitiveOpaqueType) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueType) Clone() (BgpExtendedCommunityTransitiveOpaqueType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityTransitiveOpaqueType() - 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 -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueType) setNil() { - obj.colorSubtypeHolder = nil - obj.encapsulationSubtypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpExtendedCommunityTransitiveOpaqueType is the Transitive Opaque Extended Community is sent as type 0x03. -type BgpExtendedCommunityTransitiveOpaqueType interface { - Validation - // msg marshals BgpExtendedCommunityTransitiveOpaqueType to protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueType - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityTransitiveOpaqueType - // setMsg unmarshals BgpExtendedCommunityTransitiveOpaqueType from protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueType - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityTransitiveOpaqueType) BgpExtendedCommunityTransitiveOpaqueType - // provides marshal interface - Marshal() marshalBgpExtendedCommunityTransitiveOpaqueType - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityTransitiveOpaqueType - // validate validates BgpExtendedCommunityTransitiveOpaqueType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityTransitiveOpaqueType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum, set in BgpExtendedCommunityTransitiveOpaqueType - Choice() BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum - // setChoice assigns BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum provided by user to BgpExtendedCommunityTransitiveOpaqueType - setChoice(value BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum) BgpExtendedCommunityTransitiveOpaqueType - // HasChoice checks if Choice has been set in BgpExtendedCommunityTransitiveOpaqueType - HasChoice() bool - // ColorSubtype returns BgpExtendedCommunityTransitiveOpaqueTypeColor, set in BgpExtendedCommunityTransitiveOpaqueType. - // BgpExtendedCommunityTransitiveOpaqueTypeColor is the Color Community contains locally administrator defined 'color' value which is used in conjunction with Encapsulation attribute to decide whether a data packet can be transmitted on a certain tunnel or not. It is defined in RFC9012 and sent with sub-type as 0x0b. - ColorSubtype() BgpExtendedCommunityTransitiveOpaqueTypeColor - // SetColorSubtype assigns BgpExtendedCommunityTransitiveOpaqueTypeColor provided by user to BgpExtendedCommunityTransitiveOpaqueType. - // BgpExtendedCommunityTransitiveOpaqueTypeColor is the Color Community contains locally administrator defined 'color' value which is used in conjunction with Encapsulation attribute to decide whether a data packet can be transmitted on a certain tunnel or not. It is defined in RFC9012 and sent with sub-type as 0x0b. - SetColorSubtype(value BgpExtendedCommunityTransitiveOpaqueTypeColor) BgpExtendedCommunityTransitiveOpaqueType - // HasColorSubtype checks if ColorSubtype has been set in BgpExtendedCommunityTransitiveOpaqueType - HasColorSubtype() bool - // EncapsulationSubtype returns BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation, set in BgpExtendedCommunityTransitiveOpaqueType. - // BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation is this identifies the type of tunneling technology being signalled. It is defined in RFC9012 and sent with sub-type as 0x0c. - EncapsulationSubtype() BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - // SetEncapsulationSubtype assigns BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation provided by user to BgpExtendedCommunityTransitiveOpaqueType. - // BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation is this identifies the type of tunneling technology being signalled. It is defined in RFC9012 and sent with sub-type as 0x0c. - SetEncapsulationSubtype(value BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) BgpExtendedCommunityTransitiveOpaqueType - // HasEncapsulationSubtype checks if EncapsulationSubtype has been set in BgpExtendedCommunityTransitiveOpaqueType - HasEncapsulationSubtype() bool - setNil() -} - -type BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum string - -// Enum of Choice on BgpExtendedCommunityTransitiveOpaqueType -var BgpExtendedCommunityTransitiveOpaqueTypeChoice = struct { - COLOR_SUBTYPE BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum - ENCAPSULATION_SUBTYPE BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum -}{ - COLOR_SUBTYPE: BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum("color_subtype"), - ENCAPSULATION_SUBTYPE: BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum("encapsulation_subtype"), -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueType) Choice() BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum { - return BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *bgpExtendedCommunityTransitiveOpaqueType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueType) setChoice(value BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum) BgpExtendedCommunityTransitiveOpaqueType { - intValue, ok := otg.BgpExtendedCommunityTransitiveOpaqueType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpExtendedCommunityTransitiveOpaqueType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.EncapsulationSubtype = nil - obj.encapsulationSubtypeHolder = nil - obj.obj.ColorSubtype = nil - obj.colorSubtypeHolder = nil - - if value == BgpExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE { - obj.obj.ColorSubtype = NewBgpExtendedCommunityTransitiveOpaqueTypeColor().msg() - } - - if value == BgpExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE { - obj.obj.EncapsulationSubtype = NewBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation().msg() - } - - return obj -} - -// description is TBD -// ColorSubtype returns a BgpExtendedCommunityTransitiveOpaqueTypeColor -func (obj *bgpExtendedCommunityTransitiveOpaqueType) ColorSubtype() BgpExtendedCommunityTransitiveOpaqueTypeColor { - if obj.obj.ColorSubtype == nil { - obj.setChoice(BgpExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE) - } - if obj.colorSubtypeHolder == nil { - obj.colorSubtypeHolder = &bgpExtendedCommunityTransitiveOpaqueTypeColor{obj: obj.obj.ColorSubtype} - } - return obj.colorSubtypeHolder -} - -// description is TBD -// ColorSubtype returns a BgpExtendedCommunityTransitiveOpaqueTypeColor -func (obj *bgpExtendedCommunityTransitiveOpaqueType) HasColorSubtype() bool { - return obj.obj.ColorSubtype != nil -} - -// description is TBD -// SetColorSubtype sets the BgpExtendedCommunityTransitiveOpaqueTypeColor value in the BgpExtendedCommunityTransitiveOpaqueType object -func (obj *bgpExtendedCommunityTransitiveOpaqueType) SetColorSubtype(value BgpExtendedCommunityTransitiveOpaqueTypeColor) BgpExtendedCommunityTransitiveOpaqueType { - obj.setChoice(BgpExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE) - obj.colorSubtypeHolder = nil - obj.obj.ColorSubtype = value.msg() - - return obj -} - -// description is TBD -// EncapsulationSubtype returns a BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation -func (obj *bgpExtendedCommunityTransitiveOpaqueType) EncapsulationSubtype() BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { - if obj.obj.EncapsulationSubtype == nil { - obj.setChoice(BgpExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE) - } - if obj.encapsulationSubtypeHolder == nil { - obj.encapsulationSubtypeHolder = &bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: obj.obj.EncapsulationSubtype} - } - return obj.encapsulationSubtypeHolder -} - -// description is TBD -// EncapsulationSubtype returns a BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation -func (obj *bgpExtendedCommunityTransitiveOpaqueType) HasEncapsulationSubtype() bool { - return obj.obj.EncapsulationSubtype != nil -} - -// description is TBD -// SetEncapsulationSubtype sets the BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation value in the BgpExtendedCommunityTransitiveOpaqueType object -func (obj *bgpExtendedCommunityTransitiveOpaqueType) SetEncapsulationSubtype(value BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) BgpExtendedCommunityTransitiveOpaqueType { - obj.setChoice(BgpExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE) - obj.encapsulationSubtypeHolder = nil - obj.obj.EncapsulationSubtype = value.msg() - - return obj -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.ColorSubtype != nil { - - obj.ColorSubtype().validateObj(vObj, set_default) - } - - if obj.obj.EncapsulationSubtype != nil { - - obj.EncapsulationSubtype().validateObj(vObj, set_default) - } - -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueType) setDefault() { - var choices_set int = 0 - var choice BgpExtendedCommunityTransitiveOpaqueTypeChoiceEnum - - if obj.obj.ColorSubtype != nil { - choices_set += 1 - choice = BgpExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE - } - - if obj.obj.EncapsulationSubtype != nil { - choices_set += 1 - choice = BgpExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(BgpExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpExtendedCommunityTransitiveOpaqueType") - } - } else { - intVal := otg.BgpExtendedCommunityTransitiveOpaqueType_Choice_Enum_value[string(choice)] - enumValue := otg.BgpExtendedCommunityTransitiveOpaqueType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpExtendedCommunityTransitiveEvpnType ***** -type bgpExtendedCommunityTransitiveEvpnType struct { - validation - obj *otg.BgpExtendedCommunityTransitiveEvpnType - marshaller marshalBgpExtendedCommunityTransitiveEvpnType - unMarshaller unMarshalBgpExtendedCommunityTransitiveEvpnType - routerMacSubtypeHolder BgpExtendedCommunityTransitiveEvpnTypeRouterMac -} - -func NewBgpExtendedCommunityTransitiveEvpnType() BgpExtendedCommunityTransitiveEvpnType { - obj := bgpExtendedCommunityTransitiveEvpnType{obj: &otg.BgpExtendedCommunityTransitiveEvpnType{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityTransitiveEvpnType) msg() *otg.BgpExtendedCommunityTransitiveEvpnType { - return obj.obj -} - -func (obj *bgpExtendedCommunityTransitiveEvpnType) setMsg(msg *otg.BgpExtendedCommunityTransitiveEvpnType) BgpExtendedCommunityTransitiveEvpnType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityTransitiveEvpnType struct { - obj *bgpExtendedCommunityTransitiveEvpnType -} - -type marshalBgpExtendedCommunityTransitiveEvpnType interface { - // ToProto marshals BgpExtendedCommunityTransitiveEvpnType to protobuf object *otg.BgpExtendedCommunityTransitiveEvpnType - ToProto() (*otg.BgpExtendedCommunityTransitiveEvpnType, error) - // ToPbText marshals BgpExtendedCommunityTransitiveEvpnType to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityTransitiveEvpnType to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityTransitiveEvpnType to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityTransitiveEvpnType struct { - obj *bgpExtendedCommunityTransitiveEvpnType -} - -type unMarshalBgpExtendedCommunityTransitiveEvpnType interface { - // FromProto unmarshals BgpExtendedCommunityTransitiveEvpnType from protobuf object *otg.BgpExtendedCommunityTransitiveEvpnType - FromProto(msg *otg.BgpExtendedCommunityTransitiveEvpnType) (BgpExtendedCommunityTransitiveEvpnType, error) - // FromPbText unmarshals BgpExtendedCommunityTransitiveEvpnType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityTransitiveEvpnType from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityTransitiveEvpnType from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityTransitiveEvpnType) Marshal() marshalBgpExtendedCommunityTransitiveEvpnType { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityTransitiveEvpnType{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityTransitiveEvpnType) Unmarshal() unMarshalBgpExtendedCommunityTransitiveEvpnType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveEvpnType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityTransitiveEvpnType) ToProto() (*otg.BgpExtendedCommunityTransitiveEvpnType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityTransitiveEvpnType) FromProto(msg *otg.BgpExtendedCommunityTransitiveEvpnType) (BgpExtendedCommunityTransitiveEvpnType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityTransitiveEvpnType) 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 *unMarshalbgpExtendedCommunityTransitiveEvpnType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpExtendedCommunityTransitiveEvpnType) 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 *unMarshalbgpExtendedCommunityTransitiveEvpnType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpExtendedCommunityTransitiveEvpnType) 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 *unMarshalbgpExtendedCommunityTransitiveEvpnType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpExtendedCommunityTransitiveEvpnType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveEvpnType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveEvpnType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityTransitiveEvpnType) Clone() (BgpExtendedCommunityTransitiveEvpnType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityTransitiveEvpnType() - 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 -} - -func (obj *bgpExtendedCommunityTransitiveEvpnType) setNil() { - obj.routerMacSubtypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpExtendedCommunityTransitiveEvpnType is the Transitive EVPN Extended Community is sent as type 0x06 . -type BgpExtendedCommunityTransitiveEvpnType interface { - Validation - // msg marshals BgpExtendedCommunityTransitiveEvpnType to protobuf object *otg.BgpExtendedCommunityTransitiveEvpnType - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityTransitiveEvpnType - // setMsg unmarshals BgpExtendedCommunityTransitiveEvpnType from protobuf object *otg.BgpExtendedCommunityTransitiveEvpnType - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityTransitiveEvpnType) BgpExtendedCommunityTransitiveEvpnType - // provides marshal interface - Marshal() marshalBgpExtendedCommunityTransitiveEvpnType - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityTransitiveEvpnType - // validate validates BgpExtendedCommunityTransitiveEvpnType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityTransitiveEvpnType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum, set in BgpExtendedCommunityTransitiveEvpnType - Choice() BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum - // setChoice assigns BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum provided by user to BgpExtendedCommunityTransitiveEvpnType - setChoice(value BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum) BgpExtendedCommunityTransitiveEvpnType - // HasChoice checks if Choice has been set in BgpExtendedCommunityTransitiveEvpnType - HasChoice() bool - // RouterMacSubtype returns BgpExtendedCommunityTransitiveEvpnTypeRouterMac, set in BgpExtendedCommunityTransitiveEvpnType. - // BgpExtendedCommunityTransitiveEvpnTypeRouterMac is the Router MAC EVPN Community is defined in RFC9135 and normally sent only for EVPN Type-2 Routes . It is sent with sub-type 0x03. - RouterMacSubtype() BgpExtendedCommunityTransitiveEvpnTypeRouterMac - // SetRouterMacSubtype assigns BgpExtendedCommunityTransitiveEvpnTypeRouterMac provided by user to BgpExtendedCommunityTransitiveEvpnType. - // BgpExtendedCommunityTransitiveEvpnTypeRouterMac is the Router MAC EVPN Community is defined in RFC9135 and normally sent only for EVPN Type-2 Routes . It is sent with sub-type 0x03. - SetRouterMacSubtype(value BgpExtendedCommunityTransitiveEvpnTypeRouterMac) BgpExtendedCommunityTransitiveEvpnType - // HasRouterMacSubtype checks if RouterMacSubtype has been set in BgpExtendedCommunityTransitiveEvpnType - HasRouterMacSubtype() bool - setNil() -} - -type BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum string - -// Enum of Choice on BgpExtendedCommunityTransitiveEvpnType -var BgpExtendedCommunityTransitiveEvpnTypeChoice = struct { - ROUTER_MAC_SUBTYPE BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum -}{ - ROUTER_MAC_SUBTYPE: BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum("router_mac_subtype"), -} - -func (obj *bgpExtendedCommunityTransitiveEvpnType) Choice() BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum { - return BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *bgpExtendedCommunityTransitiveEvpnType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpExtendedCommunityTransitiveEvpnType) setChoice(value BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum) BgpExtendedCommunityTransitiveEvpnType { - intValue, ok := otg.BgpExtendedCommunityTransitiveEvpnType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpExtendedCommunityTransitiveEvpnType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.RouterMacSubtype = nil - obj.routerMacSubtypeHolder = nil - - if value == BgpExtendedCommunityTransitiveEvpnTypeChoice.ROUTER_MAC_SUBTYPE { - obj.obj.RouterMacSubtype = NewBgpExtendedCommunityTransitiveEvpnTypeRouterMac().msg() - } - - return obj -} - -// description is TBD -// RouterMacSubtype returns a BgpExtendedCommunityTransitiveEvpnTypeRouterMac -func (obj *bgpExtendedCommunityTransitiveEvpnType) RouterMacSubtype() BgpExtendedCommunityTransitiveEvpnTypeRouterMac { - if obj.obj.RouterMacSubtype == nil { - obj.setChoice(BgpExtendedCommunityTransitiveEvpnTypeChoice.ROUTER_MAC_SUBTYPE) - } - if obj.routerMacSubtypeHolder == nil { - obj.routerMacSubtypeHolder = &bgpExtendedCommunityTransitiveEvpnTypeRouterMac{obj: obj.obj.RouterMacSubtype} - } - return obj.routerMacSubtypeHolder -} - -// description is TBD -// RouterMacSubtype returns a BgpExtendedCommunityTransitiveEvpnTypeRouterMac -func (obj *bgpExtendedCommunityTransitiveEvpnType) HasRouterMacSubtype() bool { - return obj.obj.RouterMacSubtype != nil -} - -// description is TBD -// SetRouterMacSubtype sets the BgpExtendedCommunityTransitiveEvpnTypeRouterMac value in the BgpExtendedCommunityTransitiveEvpnType object -func (obj *bgpExtendedCommunityTransitiveEvpnType) SetRouterMacSubtype(value BgpExtendedCommunityTransitiveEvpnTypeRouterMac) BgpExtendedCommunityTransitiveEvpnType { - obj.setChoice(BgpExtendedCommunityTransitiveEvpnTypeChoice.ROUTER_MAC_SUBTYPE) - obj.routerMacSubtypeHolder = nil - obj.obj.RouterMacSubtype = value.msg() - - return obj -} - -func (obj *bgpExtendedCommunityTransitiveEvpnType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RouterMacSubtype != nil { - - obj.RouterMacSubtype().validateObj(vObj, set_default) - } - -} - -func (obj *bgpExtendedCommunityTransitiveEvpnType) setDefault() { - var choices_set int = 0 - var choice BgpExtendedCommunityTransitiveEvpnTypeChoiceEnum - - if obj.obj.RouterMacSubtype != nil { - choices_set += 1 - choice = BgpExtendedCommunityTransitiveEvpnTypeChoice.ROUTER_MAC_SUBTYPE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(BgpExtendedCommunityTransitiveEvpnTypeChoice.ROUTER_MAC_SUBTYPE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpExtendedCommunityTransitiveEvpnType") - } - } else { - intVal := otg.BgpExtendedCommunityTransitiveEvpnType_Choice_Enum_value[string(choice)] - enumValue := otg.BgpExtendedCommunityTransitiveEvpnType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpExtendedCommunityNonTransitive2OctetAsType ***** -type bgpExtendedCommunityNonTransitive2OctetAsType struct { - validation - obj *otg.BgpExtendedCommunityNonTransitive2OctetAsType - marshaller marshalBgpExtendedCommunityNonTransitive2OctetAsType - unMarshaller unMarshalBgpExtendedCommunityNonTransitive2OctetAsType - linkBandwidthSubtypeHolder BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth -} - -func NewBgpExtendedCommunityNonTransitive2OctetAsType() BgpExtendedCommunityNonTransitive2OctetAsType { - obj := bgpExtendedCommunityNonTransitive2OctetAsType{obj: &otg.BgpExtendedCommunityNonTransitive2OctetAsType{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) msg() *otg.BgpExtendedCommunityNonTransitive2OctetAsType { - return obj.obj -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) setMsg(msg *otg.BgpExtendedCommunityNonTransitive2OctetAsType) BgpExtendedCommunityNonTransitive2OctetAsType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityNonTransitive2OctetAsType struct { - obj *bgpExtendedCommunityNonTransitive2OctetAsType -} - -type marshalBgpExtendedCommunityNonTransitive2OctetAsType interface { - // ToProto marshals BgpExtendedCommunityNonTransitive2OctetAsType to protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsType - ToProto() (*otg.BgpExtendedCommunityNonTransitive2OctetAsType, error) - // ToPbText marshals BgpExtendedCommunityNonTransitive2OctetAsType to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityNonTransitive2OctetAsType to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityNonTransitive2OctetAsType to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityNonTransitive2OctetAsType struct { - obj *bgpExtendedCommunityNonTransitive2OctetAsType -} - -type unMarshalBgpExtendedCommunityNonTransitive2OctetAsType interface { - // FromProto unmarshals BgpExtendedCommunityNonTransitive2OctetAsType from protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsType - FromProto(msg *otg.BgpExtendedCommunityNonTransitive2OctetAsType) (BgpExtendedCommunityNonTransitive2OctetAsType, error) - // FromPbText unmarshals BgpExtendedCommunityNonTransitive2OctetAsType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityNonTransitive2OctetAsType from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityNonTransitive2OctetAsType from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) Marshal() marshalBgpExtendedCommunityNonTransitive2OctetAsType { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityNonTransitive2OctetAsType{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) Unmarshal() unMarshalBgpExtendedCommunityNonTransitive2OctetAsType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityNonTransitive2OctetAsType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityNonTransitive2OctetAsType) ToProto() (*otg.BgpExtendedCommunityNonTransitive2OctetAsType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityNonTransitive2OctetAsType) FromProto(msg *otg.BgpExtendedCommunityNonTransitive2OctetAsType) (BgpExtendedCommunityNonTransitive2OctetAsType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityNonTransitive2OctetAsType) 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 *unMarshalbgpExtendedCommunityNonTransitive2OctetAsType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpExtendedCommunityNonTransitive2OctetAsType) 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 *unMarshalbgpExtendedCommunityNonTransitive2OctetAsType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpExtendedCommunityNonTransitive2OctetAsType) 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 *unMarshalbgpExtendedCommunityNonTransitive2OctetAsType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) Clone() (BgpExtendedCommunityNonTransitive2OctetAsType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityNonTransitive2OctetAsType() - 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 -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) setNil() { - obj.linkBandwidthSubtypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpExtendedCommunityNonTransitive2OctetAsType is the Non-Transitive Two-Octet AS-Specific Extended Community is sent as type 0x40. -type BgpExtendedCommunityNonTransitive2OctetAsType interface { - Validation - // msg marshals BgpExtendedCommunityNonTransitive2OctetAsType to protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsType - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityNonTransitive2OctetAsType - // setMsg unmarshals BgpExtendedCommunityNonTransitive2OctetAsType from protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsType - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityNonTransitive2OctetAsType) BgpExtendedCommunityNonTransitive2OctetAsType - // provides marshal interface - Marshal() marshalBgpExtendedCommunityNonTransitive2OctetAsType - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityNonTransitive2OctetAsType - // validate validates BgpExtendedCommunityNonTransitive2OctetAsType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityNonTransitive2OctetAsType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum, set in BgpExtendedCommunityNonTransitive2OctetAsType - Choice() BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum - // setChoice assigns BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum provided by user to BgpExtendedCommunityNonTransitive2OctetAsType - setChoice(value BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum) BgpExtendedCommunityNonTransitive2OctetAsType - // HasChoice checks if Choice has been set in BgpExtendedCommunityNonTransitive2OctetAsType - HasChoice() bool - // LinkBandwidthSubtype returns BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, set in BgpExtendedCommunityNonTransitive2OctetAsType. - // BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth is the Link Bandwidth Extended Community attribute is defined in draft-ietf-idr-link-bandwidth. It is sent with sub-type as 0x04. - LinkBandwidthSubtype() BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // SetLinkBandwidthSubtype assigns BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth provided by user to BgpExtendedCommunityNonTransitive2OctetAsType. - // BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth is the Link Bandwidth Extended Community attribute is defined in draft-ietf-idr-link-bandwidth. It is sent with sub-type as 0x04. - SetLinkBandwidthSubtype(value BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) BgpExtendedCommunityNonTransitive2OctetAsType - // HasLinkBandwidthSubtype checks if LinkBandwidthSubtype has been set in BgpExtendedCommunityNonTransitive2OctetAsType - HasLinkBandwidthSubtype() bool - setNil() -} - -type BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum string - -// Enum of Choice on BgpExtendedCommunityNonTransitive2OctetAsType -var BgpExtendedCommunityNonTransitive2OctetAsTypeChoice = struct { - LINK_BANDWIDTH_SUBTYPE BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum -}{ - LINK_BANDWIDTH_SUBTYPE: BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum("link_bandwidth_subtype"), -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) Choice() BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum { - return BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) setChoice(value BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum) BgpExtendedCommunityNonTransitive2OctetAsType { - intValue, ok := otg.BgpExtendedCommunityNonTransitive2OctetAsType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpExtendedCommunityNonTransitive2OctetAsType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.LinkBandwidthSubtype = nil - obj.linkBandwidthSubtypeHolder = nil - - if value == BgpExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE { - obj.obj.LinkBandwidthSubtype = NewBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth().msg() - } - - return obj -} - -// description is TBD -// LinkBandwidthSubtype returns a BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) LinkBandwidthSubtype() BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - if obj.obj.LinkBandwidthSubtype == nil { - obj.setChoice(BgpExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE) - } - if obj.linkBandwidthSubtypeHolder == nil { - obj.linkBandwidthSubtypeHolder = &bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: obj.obj.LinkBandwidthSubtype} - } - return obj.linkBandwidthSubtypeHolder -} - -// description is TBD -// LinkBandwidthSubtype returns a BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) HasLinkBandwidthSubtype() bool { - return obj.obj.LinkBandwidthSubtype != nil -} - -// description is TBD -// SetLinkBandwidthSubtype sets the BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth value in the BgpExtendedCommunityNonTransitive2OctetAsType object -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) SetLinkBandwidthSubtype(value BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) BgpExtendedCommunityNonTransitive2OctetAsType { - obj.setChoice(BgpExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE) - obj.linkBandwidthSubtypeHolder = nil - obj.obj.LinkBandwidthSubtype = value.msg() - - return obj -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.LinkBandwidthSubtype != nil { - - obj.LinkBandwidthSubtype().validateObj(vObj, set_default) - } - -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsType) setDefault() { - var choices_set int = 0 - var choice BgpExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum - - if obj.obj.LinkBandwidthSubtype != nil { - choices_set += 1 - choice = BgpExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(BgpExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpExtendedCommunityNonTransitive2OctetAsType") - } - } else { - intVal := otg.BgpExtendedCommunityNonTransitive2OctetAsType_Choice_Enum_value[string(choice)] - enumValue := otg.BgpExtendedCommunityNonTransitive2OctetAsType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpExtendedCommunityCustomType ***** -type bgpExtendedCommunityCustomType struct { - validation - obj *otg.BgpExtendedCommunityCustomType - marshaller marshalBgpExtendedCommunityCustomType - unMarshaller unMarshalBgpExtendedCommunityCustomType -} - -func NewBgpExtendedCommunityCustomType() BgpExtendedCommunityCustomType { - obj := bgpExtendedCommunityCustomType{obj: &otg.BgpExtendedCommunityCustomType{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityCustomType) msg() *otg.BgpExtendedCommunityCustomType { - return obj.obj -} - -func (obj *bgpExtendedCommunityCustomType) setMsg(msg *otg.BgpExtendedCommunityCustomType) BgpExtendedCommunityCustomType { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityCustomType struct { - obj *bgpExtendedCommunityCustomType -} - -type marshalBgpExtendedCommunityCustomType interface { - // ToProto marshals BgpExtendedCommunityCustomType to protobuf object *otg.BgpExtendedCommunityCustomType - ToProto() (*otg.BgpExtendedCommunityCustomType, error) - // ToPbText marshals BgpExtendedCommunityCustomType to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityCustomType to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityCustomType to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityCustomType struct { - obj *bgpExtendedCommunityCustomType -} - -type unMarshalBgpExtendedCommunityCustomType interface { - // FromProto unmarshals BgpExtendedCommunityCustomType from protobuf object *otg.BgpExtendedCommunityCustomType - FromProto(msg *otg.BgpExtendedCommunityCustomType) (BgpExtendedCommunityCustomType, error) - // FromPbText unmarshals BgpExtendedCommunityCustomType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityCustomType from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityCustomType from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityCustomType) Marshal() marshalBgpExtendedCommunityCustomType { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityCustomType{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityCustomType) Unmarshal() unMarshalBgpExtendedCommunityCustomType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityCustomType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityCustomType) ToProto() (*otg.BgpExtendedCommunityCustomType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityCustomType) FromProto(msg *otg.BgpExtendedCommunityCustomType) (BgpExtendedCommunityCustomType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityCustomType) 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 *unMarshalbgpExtendedCommunityCustomType) 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 *marshalbgpExtendedCommunityCustomType) 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 *unMarshalbgpExtendedCommunityCustomType) 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 *marshalbgpExtendedCommunityCustomType) 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 *unMarshalbgpExtendedCommunityCustomType) 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 *bgpExtendedCommunityCustomType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityCustomType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityCustomType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityCustomType) Clone() (BgpExtendedCommunityCustomType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityCustomType() - 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 -} - -// BgpExtendedCommunityCustomType is add a custom Extended Community with a combination of types , sub-types and values not explicitly specified above or not defined yet. -type BgpExtendedCommunityCustomType interface { - Validation - // msg marshals BgpExtendedCommunityCustomType to protobuf object *otg.BgpExtendedCommunityCustomType - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityCustomType - // setMsg unmarshals BgpExtendedCommunityCustomType from protobuf object *otg.BgpExtendedCommunityCustomType - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityCustomType) BgpExtendedCommunityCustomType - // provides marshal interface - Marshal() marshalBgpExtendedCommunityCustomType - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityCustomType - // validate validates BgpExtendedCommunityCustomType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityCustomType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // CommunityType returns string, set in BgpExtendedCommunityCustomType. - CommunityType() string - // SetCommunityType assigns string provided by user to BgpExtendedCommunityCustomType - SetCommunityType(value string) BgpExtendedCommunityCustomType - // HasCommunityType checks if CommunityType has been set in BgpExtendedCommunityCustomType - HasCommunityType() bool - // CommunitySubtype returns string, set in BgpExtendedCommunityCustomType. - CommunitySubtype() string - // SetCommunitySubtype assigns string provided by user to BgpExtendedCommunityCustomType - SetCommunitySubtype(value string) BgpExtendedCommunityCustomType - // HasCommunitySubtype checks if CommunitySubtype has been set in BgpExtendedCommunityCustomType - HasCommunitySubtype() bool - // Value returns string, set in BgpExtendedCommunityCustomType. - Value() string - // SetValue assigns string provided by user to BgpExtendedCommunityCustomType - SetValue(value string) BgpExtendedCommunityCustomType - // HasValue checks if Value has been set in BgpExtendedCommunityCustomType - HasValue() bool -} - -// The type to be set in the Extended Community attribute. Accepts hexadecimal input upto ff . -// CommunityType returns a string -func (obj *bgpExtendedCommunityCustomType) CommunityType() string { - - return *obj.obj.CommunityType - -} - -// The type to be set in the Extended Community attribute. Accepts hexadecimal input upto ff . -// CommunityType returns a string -func (obj *bgpExtendedCommunityCustomType) HasCommunityType() bool { - return obj.obj.CommunityType != nil -} - -// The type to be set in the Extended Community attribute. Accepts hexadecimal input upto ff . -// SetCommunityType sets the string value in the BgpExtendedCommunityCustomType object -func (obj *bgpExtendedCommunityCustomType) SetCommunityType(value string) BgpExtendedCommunityCustomType { - - obj.obj.CommunityType = &value - return obj -} - -// The sub-type to be set in the Extended Community attribute. For certain types with no sub-type this byte can also be used as part of an extended value field. Accepts hexadecimal input upto ff. -// CommunitySubtype returns a string -func (obj *bgpExtendedCommunityCustomType) CommunitySubtype() string { - - return *obj.obj.CommunitySubtype - -} - -// The sub-type to be set in the Extended Community attribute. For certain types with no sub-type this byte can also be used as part of an extended value field. Accepts hexadecimal input upto ff. -// CommunitySubtype returns a string -func (obj *bgpExtendedCommunityCustomType) HasCommunitySubtype() bool { - return obj.obj.CommunitySubtype != nil -} - -// The sub-type to be set in the Extended Community attribute. For certain types with no sub-type this byte can also be used as part of an extended value field. Accepts hexadecimal input upto ff. -// SetCommunitySubtype sets the string value in the BgpExtendedCommunityCustomType object -func (obj *bgpExtendedCommunityCustomType) SetCommunitySubtype(value string) BgpExtendedCommunityCustomType { - - obj.obj.CommunitySubtype = &value - return obj -} - -// 6 byte hex value to be carried in the last 6 bytes of the Extended Community. Accepts hexadecimal input upto ffffffffffff. -// Value returns a string -func (obj *bgpExtendedCommunityCustomType) Value() string { - - return *obj.obj.Value - -} - -// 6 byte hex value to be carried in the last 6 bytes of the Extended Community. Accepts hexadecimal input upto ffffffffffff. -// Value returns a string -func (obj *bgpExtendedCommunityCustomType) HasValue() bool { - return obj.obj.Value != nil -} - -// 6 byte hex value to be carried in the last 6 bytes of the Extended Community. Accepts hexadecimal input upto ffffffffffff. -// SetValue sets the string value in the BgpExtendedCommunityCustomType object -func (obj *bgpExtendedCommunityCustomType) SetValue(value string) BgpExtendedCommunityCustomType { - - obj.obj.Value = &value - return obj -} - -func (obj *bgpExtendedCommunityCustomType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.CommunityType != nil { - - if len(*obj.obj.CommunityType) > 2 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "None <= length of BgpExtendedCommunityCustomType.CommunityType <= 2 but Got %d", - len(*obj.obj.CommunityType))) - } - - } - - if obj.obj.CommunitySubtype != nil { - - if len(*obj.obj.CommunitySubtype) > 2 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "None <= length of BgpExtendedCommunityCustomType.CommunitySubtype <= 2 but Got %d", - len(*obj.obj.CommunitySubtype))) - } - - } - - if obj.obj.Value != nil { - - if len(*obj.obj.Value) > 12 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "None <= length of BgpExtendedCommunityCustomType.Value <= 12 but Got %d", - len(*obj.obj.Value))) - } - - } - -} - -func (obj *bgpExtendedCommunityCustomType) setDefault() { - if obj.obj.CommunityType == nil { - obj.SetCommunityType("00") - } - if obj.obj.CommunitySubtype == nil { - obj.SetCommunitySubtype("00") - } - if obj.obj.Value == nil { - obj.SetValue("000000000000") - } - -} - -// ***** BgpSrteRemoteEndpointSubTlv ***** -type bgpSrteRemoteEndpointSubTlv struct { - validation - obj *otg.BgpSrteRemoteEndpointSubTlv - marshaller marshalBgpSrteRemoteEndpointSubTlv - unMarshaller unMarshalBgpSrteRemoteEndpointSubTlv -} - -func NewBgpSrteRemoteEndpointSubTlv() BgpSrteRemoteEndpointSubTlv { - obj := bgpSrteRemoteEndpointSubTlv{obj: &otg.BgpSrteRemoteEndpointSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteRemoteEndpointSubTlv) msg() *otg.BgpSrteRemoteEndpointSubTlv { - return obj.obj -} - -func (obj *bgpSrteRemoteEndpointSubTlv) setMsg(msg *otg.BgpSrteRemoteEndpointSubTlv) BgpSrteRemoteEndpointSubTlv { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteRemoteEndpointSubTlv struct { - obj *bgpSrteRemoteEndpointSubTlv -} - -type marshalBgpSrteRemoteEndpointSubTlv interface { - // ToProto marshals BgpSrteRemoteEndpointSubTlv to protobuf object *otg.BgpSrteRemoteEndpointSubTlv - ToProto() (*otg.BgpSrteRemoteEndpointSubTlv, error) - // ToPbText marshals BgpSrteRemoteEndpointSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteRemoteEndpointSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteRemoteEndpointSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteRemoteEndpointSubTlv struct { - obj *bgpSrteRemoteEndpointSubTlv -} - -type unMarshalBgpSrteRemoteEndpointSubTlv interface { - // FromProto unmarshals BgpSrteRemoteEndpointSubTlv from protobuf object *otg.BgpSrteRemoteEndpointSubTlv - FromProto(msg *otg.BgpSrteRemoteEndpointSubTlv) (BgpSrteRemoteEndpointSubTlv, error) - // FromPbText unmarshals BgpSrteRemoteEndpointSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteRemoteEndpointSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteRemoteEndpointSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteRemoteEndpointSubTlv) Marshal() marshalBgpSrteRemoteEndpointSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteRemoteEndpointSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteRemoteEndpointSubTlv) Unmarshal() unMarshalBgpSrteRemoteEndpointSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteRemoteEndpointSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteRemoteEndpointSubTlv) ToProto() (*otg.BgpSrteRemoteEndpointSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteRemoteEndpointSubTlv) FromProto(msg *otg.BgpSrteRemoteEndpointSubTlv) (BgpSrteRemoteEndpointSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteRemoteEndpointSubTlv) 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 *unMarshalbgpSrteRemoteEndpointSubTlv) 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 *marshalbgpSrteRemoteEndpointSubTlv) 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 *unMarshalbgpSrteRemoteEndpointSubTlv) 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 *marshalbgpSrteRemoteEndpointSubTlv) 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 *unMarshalbgpSrteRemoteEndpointSubTlv) 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 *bgpSrteRemoteEndpointSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteRemoteEndpointSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteRemoteEndpointSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteRemoteEndpointSubTlv) Clone() (BgpSrteRemoteEndpointSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteRemoteEndpointSubTlv() - 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 -} - -// BgpSrteRemoteEndpointSubTlv is configuration for the BGP remote endpoint sub TLV. -type BgpSrteRemoteEndpointSubTlv interface { - Validation - // msg marshals BgpSrteRemoteEndpointSubTlv to protobuf object *otg.BgpSrteRemoteEndpointSubTlv - // and doesn't set defaults - msg() *otg.BgpSrteRemoteEndpointSubTlv - // setMsg unmarshals BgpSrteRemoteEndpointSubTlv from protobuf object *otg.BgpSrteRemoteEndpointSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteRemoteEndpointSubTlv) BgpSrteRemoteEndpointSubTlv - // provides marshal interface - Marshal() marshalBgpSrteRemoteEndpointSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteRemoteEndpointSubTlv - // validate validates BgpSrteRemoteEndpointSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteRemoteEndpointSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // AsNumber returns uint32, set in BgpSrteRemoteEndpointSubTlv. - AsNumber() uint32 - // SetAsNumber assigns uint32 provided by user to BgpSrteRemoteEndpointSubTlv - SetAsNumber(value uint32) BgpSrteRemoteEndpointSubTlv - // HasAsNumber checks if AsNumber has been set in BgpSrteRemoteEndpointSubTlv - HasAsNumber() bool - // AddressFamily returns BgpSrteRemoteEndpointSubTlvAddressFamilyEnum, set in BgpSrteRemoteEndpointSubTlv - AddressFamily() BgpSrteRemoteEndpointSubTlvAddressFamilyEnum - // SetAddressFamily assigns BgpSrteRemoteEndpointSubTlvAddressFamilyEnum provided by user to BgpSrteRemoteEndpointSubTlv - SetAddressFamily(value BgpSrteRemoteEndpointSubTlvAddressFamilyEnum) BgpSrteRemoteEndpointSubTlv - // HasAddressFamily checks if AddressFamily has been set in BgpSrteRemoteEndpointSubTlv - HasAddressFamily() bool - // Ipv4Address returns string, set in BgpSrteRemoteEndpointSubTlv. - Ipv4Address() string - // SetIpv4Address assigns string provided by user to BgpSrteRemoteEndpointSubTlv - SetIpv4Address(value string) BgpSrteRemoteEndpointSubTlv - // HasIpv4Address checks if Ipv4Address has been set in BgpSrteRemoteEndpointSubTlv - HasIpv4Address() bool - // Ipv6Address returns string, set in BgpSrteRemoteEndpointSubTlv. - Ipv6Address() string - // SetIpv6Address assigns string provided by user to BgpSrteRemoteEndpointSubTlv - SetIpv6Address(value string) BgpSrteRemoteEndpointSubTlv - // HasIpv6Address checks if Ipv6Address has been set in BgpSrteRemoteEndpointSubTlv - HasIpv6Address() bool -} - -// Autonomous system (AS) number -// AsNumber returns a uint32 -func (obj *bgpSrteRemoteEndpointSubTlv) AsNumber() uint32 { - - return *obj.obj.AsNumber - -} - -// Autonomous system (AS) number -// AsNumber returns a uint32 -func (obj *bgpSrteRemoteEndpointSubTlv) HasAsNumber() bool { - return obj.obj.AsNumber != nil -} - -// Autonomous system (AS) number -// SetAsNumber sets the uint32 value in the BgpSrteRemoteEndpointSubTlv object -func (obj *bgpSrteRemoteEndpointSubTlv) SetAsNumber(value uint32) BgpSrteRemoteEndpointSubTlv { - - obj.obj.AsNumber = &value - return obj -} - -type BgpSrteRemoteEndpointSubTlvAddressFamilyEnum string - -// Enum of AddressFamily on BgpSrteRemoteEndpointSubTlv -var BgpSrteRemoteEndpointSubTlvAddressFamily = struct { - IPV4 BgpSrteRemoteEndpointSubTlvAddressFamilyEnum - IPV6 BgpSrteRemoteEndpointSubTlvAddressFamilyEnum -}{ - IPV4: BgpSrteRemoteEndpointSubTlvAddressFamilyEnum("ipv4"), - IPV6: BgpSrteRemoteEndpointSubTlvAddressFamilyEnum("ipv6"), -} - -func (obj *bgpSrteRemoteEndpointSubTlv) AddressFamily() BgpSrteRemoteEndpointSubTlvAddressFamilyEnum { - return BgpSrteRemoteEndpointSubTlvAddressFamilyEnum(obj.obj.AddressFamily.Enum().String()) -} - -// Determines the address type -// AddressFamily returns a string -func (obj *bgpSrteRemoteEndpointSubTlv) HasAddressFamily() bool { - return obj.obj.AddressFamily != nil -} - -func (obj *bgpSrteRemoteEndpointSubTlv) SetAddressFamily(value BgpSrteRemoteEndpointSubTlvAddressFamilyEnum) BgpSrteRemoteEndpointSubTlv { - intValue, ok := otg.BgpSrteRemoteEndpointSubTlv_AddressFamily_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpSrteRemoteEndpointSubTlvAddressFamilyEnum", string(value))) - return obj - } - enumValue := otg.BgpSrteRemoteEndpointSubTlv_AddressFamily_Enum(intValue) - obj.obj.AddressFamily = &enumValue - - return obj -} - -// The IPv4 address of the Remote Endpoint. -// Ipv4Address returns a string -func (obj *bgpSrteRemoteEndpointSubTlv) Ipv4Address() string { - - return *obj.obj.Ipv4Address - -} - -// The IPv4 address of the Remote Endpoint. -// Ipv4Address returns a string -func (obj *bgpSrteRemoteEndpointSubTlv) HasIpv4Address() bool { - return obj.obj.Ipv4Address != nil -} - -// The IPv4 address of the Remote Endpoint. -// SetIpv4Address sets the string value in the BgpSrteRemoteEndpointSubTlv object -func (obj *bgpSrteRemoteEndpointSubTlv) SetIpv4Address(value string) BgpSrteRemoteEndpointSubTlv { - - obj.obj.Ipv4Address = &value - return obj -} - -// The IPv6 address of the Remote Endpoint. -// Ipv6Address returns a string -func (obj *bgpSrteRemoteEndpointSubTlv) Ipv6Address() string { - - return *obj.obj.Ipv6Address - -} - -// The IPv6 address of the Remote Endpoint. -// Ipv6Address returns a string -func (obj *bgpSrteRemoteEndpointSubTlv) HasIpv6Address() bool { - return obj.obj.Ipv6Address != nil -} - -// The IPv6 address of the Remote Endpoint. -// SetIpv6Address sets the string value in the BgpSrteRemoteEndpointSubTlv object -func (obj *bgpSrteRemoteEndpointSubTlv) SetIpv6Address(value string) BgpSrteRemoteEndpointSubTlv { - - obj.obj.Ipv6Address = &value - return obj -} - -func (obj *bgpSrteRemoteEndpointSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv4Address != nil { - - err := obj.validateIpv4(obj.Ipv4Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteRemoteEndpointSubTlv.Ipv4Address")) - } - - } - - if obj.obj.Ipv6Address != nil { - - err := obj.validateIpv6(obj.Ipv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteRemoteEndpointSubTlv.Ipv6Address")) - } - - } - -} - -func (obj *bgpSrteRemoteEndpointSubTlv) setDefault() { - if obj.obj.AsNumber == nil { - obj.SetAsNumber(0) - } - if obj.obj.AddressFamily == nil { - obj.SetAddressFamily(BgpSrteRemoteEndpointSubTlvAddressFamily.IPV4) - - } - if obj.obj.Ipv4Address == nil { - obj.SetIpv4Address("0.0.0.0") - } - if obj.obj.Ipv6Address == nil { - obj.SetIpv6Address("::0") - } - -} - -// ***** BgpSrteColorSubTlv ***** -type bgpSrteColorSubTlv struct { - validation - obj *otg.BgpSrteColorSubTlv - marshaller marshalBgpSrteColorSubTlv - unMarshaller unMarshalBgpSrteColorSubTlv -} - -func NewBgpSrteColorSubTlv() BgpSrteColorSubTlv { - obj := bgpSrteColorSubTlv{obj: &otg.BgpSrteColorSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteColorSubTlv) msg() *otg.BgpSrteColorSubTlv { - return obj.obj -} - -func (obj *bgpSrteColorSubTlv) setMsg(msg *otg.BgpSrteColorSubTlv) BgpSrteColorSubTlv { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteColorSubTlv struct { - obj *bgpSrteColorSubTlv -} - -type marshalBgpSrteColorSubTlv interface { - // ToProto marshals BgpSrteColorSubTlv to protobuf object *otg.BgpSrteColorSubTlv - ToProto() (*otg.BgpSrteColorSubTlv, error) - // ToPbText marshals BgpSrteColorSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteColorSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteColorSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteColorSubTlv struct { - obj *bgpSrteColorSubTlv -} - -type unMarshalBgpSrteColorSubTlv interface { - // FromProto unmarshals BgpSrteColorSubTlv from protobuf object *otg.BgpSrteColorSubTlv - FromProto(msg *otg.BgpSrteColorSubTlv) (BgpSrteColorSubTlv, error) - // FromPbText unmarshals BgpSrteColorSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteColorSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteColorSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteColorSubTlv) Marshal() marshalBgpSrteColorSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteColorSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteColorSubTlv) Unmarshal() unMarshalBgpSrteColorSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteColorSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteColorSubTlv) ToProto() (*otg.BgpSrteColorSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteColorSubTlv) FromProto(msg *otg.BgpSrteColorSubTlv) (BgpSrteColorSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteColorSubTlv) 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 *unMarshalbgpSrteColorSubTlv) 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 *marshalbgpSrteColorSubTlv) 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 *unMarshalbgpSrteColorSubTlv) 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 *marshalbgpSrteColorSubTlv) 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 *unMarshalbgpSrteColorSubTlv) 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 *bgpSrteColorSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteColorSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteColorSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteColorSubTlv) Clone() (BgpSrteColorSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteColorSubTlv() - 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 -} - -// BgpSrteColorSubTlv is configuration for the Policy Color attribute sub-TLV. The Color sub-TLV MAY be used as a way to "color" the corresponding Tunnel TLV. The Value field of the sub-TLV is eight octets long and consists of a Color Extended Community. First two octets of its Value field are 0x030b as type and subtype of extended community. Remaining six octets are are exposed to configure. -type BgpSrteColorSubTlv interface { - Validation - // msg marshals BgpSrteColorSubTlv to protobuf object *otg.BgpSrteColorSubTlv - // and doesn't set defaults - msg() *otg.BgpSrteColorSubTlv - // setMsg unmarshals BgpSrteColorSubTlv from protobuf object *otg.BgpSrteColorSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteColorSubTlv) BgpSrteColorSubTlv - // provides marshal interface - Marshal() marshalBgpSrteColorSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteColorSubTlv - // validate validates BgpSrteColorSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteColorSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Color returns string, set in BgpSrteColorSubTlv. - Color() string - // SetColor assigns string provided by user to BgpSrteColorSubTlv - SetColor(value string) BgpSrteColorSubTlv - // HasColor checks if Color has been set in BgpSrteColorSubTlv - HasColor() bool -} - -// Six octet values. Example: 000000000064 for color value 100. -// Color returns a string -func (obj *bgpSrteColorSubTlv) Color() string { - - return *obj.obj.Color - -} - -// Six octet values. Example: 000000000064 for color value 100. -// Color returns a string -func (obj *bgpSrteColorSubTlv) HasColor() bool { - return obj.obj.Color != nil -} - -// Six octet values. Example: 000000000064 for color value 100. -// SetColor sets the string value in the BgpSrteColorSubTlv object -func (obj *bgpSrteColorSubTlv) SetColor(value string) BgpSrteColorSubTlv { - - obj.obj.Color = &value - return obj -} - -func (obj *bgpSrteColorSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Color != nil { - - err := obj.validateHex(obj.Color()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteColorSubTlv.Color")) - } - - } - -} - -func (obj *bgpSrteColorSubTlv) setDefault() { - -} - -// ***** BgpSrteBindingSubTlv ***** -type bgpSrteBindingSubTlv struct { - validation - obj *otg.BgpSrteBindingSubTlv - marshaller marshalBgpSrteBindingSubTlv - unMarshaller unMarshalBgpSrteBindingSubTlv -} - -func NewBgpSrteBindingSubTlv() BgpSrteBindingSubTlv { - obj := bgpSrteBindingSubTlv{obj: &otg.BgpSrteBindingSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteBindingSubTlv) msg() *otg.BgpSrteBindingSubTlv { - return obj.obj -} - -func (obj *bgpSrteBindingSubTlv) setMsg(msg *otg.BgpSrteBindingSubTlv) BgpSrteBindingSubTlv { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteBindingSubTlv struct { - obj *bgpSrteBindingSubTlv -} - -type marshalBgpSrteBindingSubTlv interface { - // ToProto marshals BgpSrteBindingSubTlv to protobuf object *otg.BgpSrteBindingSubTlv - ToProto() (*otg.BgpSrteBindingSubTlv, error) - // ToPbText marshals BgpSrteBindingSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteBindingSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteBindingSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteBindingSubTlv struct { - obj *bgpSrteBindingSubTlv -} - -type unMarshalBgpSrteBindingSubTlv interface { - // FromProto unmarshals BgpSrteBindingSubTlv from protobuf object *otg.BgpSrteBindingSubTlv - FromProto(msg *otg.BgpSrteBindingSubTlv) (BgpSrteBindingSubTlv, error) - // FromPbText unmarshals BgpSrteBindingSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteBindingSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteBindingSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteBindingSubTlv) Marshal() marshalBgpSrteBindingSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteBindingSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteBindingSubTlv) Unmarshal() unMarshalBgpSrteBindingSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteBindingSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteBindingSubTlv) ToProto() (*otg.BgpSrteBindingSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteBindingSubTlv) FromProto(msg *otg.BgpSrteBindingSubTlv) (BgpSrteBindingSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteBindingSubTlv) 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 *unMarshalbgpSrteBindingSubTlv) 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 *marshalbgpSrteBindingSubTlv) 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 *unMarshalbgpSrteBindingSubTlv) 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 *marshalbgpSrteBindingSubTlv) 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 *unMarshalbgpSrteBindingSubTlv) 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 *bgpSrteBindingSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteBindingSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteBindingSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteBindingSubTlv) Clone() (BgpSrteBindingSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteBindingSubTlv() - 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 -} - -// BgpSrteBindingSubTlv is configuration for the binding SID sub-TLV. This is used to signal the binding SID related information of the SR Policy candidate path. -type BgpSrteBindingSubTlv interface { - Validation - // msg marshals BgpSrteBindingSubTlv to protobuf object *otg.BgpSrteBindingSubTlv - // and doesn't set defaults - msg() *otg.BgpSrteBindingSubTlv - // setMsg unmarshals BgpSrteBindingSubTlv from protobuf object *otg.BgpSrteBindingSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteBindingSubTlv) BgpSrteBindingSubTlv - // provides marshal interface - Marshal() marshalBgpSrteBindingSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteBindingSubTlv - // validate validates BgpSrteBindingSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteBindingSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // BindingSidType returns BgpSrteBindingSubTlvBindingSidTypeEnum, set in BgpSrteBindingSubTlv - BindingSidType() BgpSrteBindingSubTlvBindingSidTypeEnum - // SetBindingSidType assigns BgpSrteBindingSubTlvBindingSidTypeEnum provided by user to BgpSrteBindingSubTlv - SetBindingSidType(value BgpSrteBindingSubTlvBindingSidTypeEnum) BgpSrteBindingSubTlv - // HasBindingSidType checks if BindingSidType has been set in BgpSrteBindingSubTlv - HasBindingSidType() bool - // FourOctetSid returns uint32, set in BgpSrteBindingSubTlv. - FourOctetSid() uint32 - // SetFourOctetSid assigns uint32 provided by user to BgpSrteBindingSubTlv - SetFourOctetSid(value uint32) BgpSrteBindingSubTlv - // HasFourOctetSid checks if FourOctetSid has been set in BgpSrteBindingSubTlv - HasFourOctetSid() bool - // Ipv6Sid returns string, set in BgpSrteBindingSubTlv. - Ipv6Sid() string - // SetIpv6Sid assigns string provided by user to BgpSrteBindingSubTlv - SetIpv6Sid(value string) BgpSrteBindingSubTlv - // HasIpv6Sid checks if Ipv6Sid has been set in BgpSrteBindingSubTlv - HasIpv6Sid() bool - // SFlag returns bool, set in BgpSrteBindingSubTlv. - SFlag() bool - // SetSFlag assigns bool provided by user to BgpSrteBindingSubTlv - SetSFlag(value bool) BgpSrteBindingSubTlv - // HasSFlag checks if SFlag has been set in BgpSrteBindingSubTlv - HasSFlag() bool - // IFlag returns bool, set in BgpSrteBindingSubTlv. - IFlag() bool - // SetIFlag assigns bool provided by user to BgpSrteBindingSubTlv - SetIFlag(value bool) BgpSrteBindingSubTlv - // HasIFlag checks if IFlag has been set in BgpSrteBindingSubTlv - HasIFlag() bool -} - -type BgpSrteBindingSubTlvBindingSidTypeEnum string - -// Enum of BindingSidType on BgpSrteBindingSubTlv -var BgpSrteBindingSubTlvBindingSidType = struct { - NO_BINDING BgpSrteBindingSubTlvBindingSidTypeEnum - FOUR_OCTET_SID BgpSrteBindingSubTlvBindingSidTypeEnum - IPV6_SID BgpSrteBindingSubTlvBindingSidTypeEnum -}{ - NO_BINDING: BgpSrteBindingSubTlvBindingSidTypeEnum("no_binding"), - FOUR_OCTET_SID: BgpSrteBindingSubTlvBindingSidTypeEnum("four_octet_sid"), - IPV6_SID: BgpSrteBindingSubTlvBindingSidTypeEnum("ipv6_sid"), -} - -func (obj *bgpSrteBindingSubTlv) BindingSidType() BgpSrteBindingSubTlvBindingSidTypeEnum { - return BgpSrteBindingSubTlvBindingSidTypeEnum(obj.obj.BindingSidType.Enum().String()) -} - -// Type of the binding SID. Supported types are "No Binding SID" or "Four Octets Sid" or "IPv6 SID". -// BindingSidType returns a string -func (obj *bgpSrteBindingSubTlv) HasBindingSidType() bool { - return obj.obj.BindingSidType != nil -} - -func (obj *bgpSrteBindingSubTlv) SetBindingSidType(value BgpSrteBindingSubTlvBindingSidTypeEnum) BgpSrteBindingSubTlv { - intValue, ok := otg.BgpSrteBindingSubTlv_BindingSidType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpSrteBindingSubTlvBindingSidTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpSrteBindingSubTlv_BindingSidType_Enum(intValue) - obj.obj.BindingSidType = &enumValue - - return obj -} - -// Binding SID is encoded in 4 octets. -// FourOctetSid returns a uint32 -func (obj *bgpSrteBindingSubTlv) FourOctetSid() uint32 { - - return *obj.obj.FourOctetSid - -} - -// Binding SID is encoded in 4 octets. -// FourOctetSid returns a uint32 -func (obj *bgpSrteBindingSubTlv) HasFourOctetSid() bool { - return obj.obj.FourOctetSid != nil -} - -// Binding SID is encoded in 4 octets. -// SetFourOctetSid sets the uint32 value in the BgpSrteBindingSubTlv object -func (obj *bgpSrteBindingSubTlv) SetFourOctetSid(value uint32) BgpSrteBindingSubTlv { - - obj.obj.FourOctetSid = &value - return obj -} - -// IPv6 SID value. -// Ipv6Sid returns a string -func (obj *bgpSrteBindingSubTlv) Ipv6Sid() string { - - return *obj.obj.Ipv6Sid - -} - -// IPv6 SID value. -// Ipv6Sid returns a string -func (obj *bgpSrteBindingSubTlv) HasIpv6Sid() bool { - return obj.obj.Ipv6Sid != nil -} - -// IPv6 SID value. -// SetIpv6Sid sets the string value in the BgpSrteBindingSubTlv object -func (obj *bgpSrteBindingSubTlv) SetIpv6Sid(value string) BgpSrteBindingSubTlv { - - obj.obj.Ipv6Sid = &value - return obj -} - -// S-Flag encodes the "Specified-BSID-only" behavior. -// SFlag returns a bool -func (obj *bgpSrteBindingSubTlv) SFlag() bool { - - return *obj.obj.SFlag - -} - -// S-Flag encodes the "Specified-BSID-only" behavior. -// SFlag returns a bool -func (obj *bgpSrteBindingSubTlv) HasSFlag() bool { - return obj.obj.SFlag != nil -} - -// S-Flag encodes the "Specified-BSID-only" behavior. -// SetSFlag sets the bool value in the BgpSrteBindingSubTlv object -func (obj *bgpSrteBindingSubTlv) SetSFlag(value bool) BgpSrteBindingSubTlv { - - obj.obj.SFlag = &value - return obj -} - -// I-Flag encodes the "Drop Upon Invalid" behavior. -// IFlag returns a bool -func (obj *bgpSrteBindingSubTlv) IFlag() bool { - - return *obj.obj.IFlag - -} - -// I-Flag encodes the "Drop Upon Invalid" behavior. -// IFlag returns a bool -func (obj *bgpSrteBindingSubTlv) HasIFlag() bool { - return obj.obj.IFlag != nil -} - -// I-Flag encodes the "Drop Upon Invalid" behavior. -// SetIFlag sets the bool value in the BgpSrteBindingSubTlv object -func (obj *bgpSrteBindingSubTlv) SetIFlag(value bool) BgpSrteBindingSubTlv { - - obj.obj.IFlag = &value - return obj -} - -func (obj *bgpSrteBindingSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv6Sid != nil { - - err := obj.validateIpv6(obj.Ipv6Sid()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteBindingSubTlv.Ipv6Sid")) - } - - } - -} - -func (obj *bgpSrteBindingSubTlv) setDefault() { - if obj.obj.BindingSidType == nil { - obj.SetBindingSidType(BgpSrteBindingSubTlvBindingSidType.NO_BINDING) - - } - if obj.obj.SFlag == nil { - obj.SetSFlag(false) - } - if obj.obj.IFlag == nil { - obj.SetIFlag(false) - } - -} - -// ***** BgpSrtePreferenceSubTlv ***** -type bgpSrtePreferenceSubTlv struct { - validation - obj *otg.BgpSrtePreferenceSubTlv - marshaller marshalBgpSrtePreferenceSubTlv - unMarshaller unMarshalBgpSrtePreferenceSubTlv -} - -func NewBgpSrtePreferenceSubTlv() BgpSrtePreferenceSubTlv { - obj := bgpSrtePreferenceSubTlv{obj: &otg.BgpSrtePreferenceSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrtePreferenceSubTlv) msg() *otg.BgpSrtePreferenceSubTlv { - return obj.obj -} - -func (obj *bgpSrtePreferenceSubTlv) setMsg(msg *otg.BgpSrtePreferenceSubTlv) BgpSrtePreferenceSubTlv { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrtePreferenceSubTlv struct { - obj *bgpSrtePreferenceSubTlv -} - -type marshalBgpSrtePreferenceSubTlv interface { - // ToProto marshals BgpSrtePreferenceSubTlv to protobuf object *otg.BgpSrtePreferenceSubTlv - ToProto() (*otg.BgpSrtePreferenceSubTlv, error) - // ToPbText marshals BgpSrtePreferenceSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrtePreferenceSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrtePreferenceSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrtePreferenceSubTlv struct { - obj *bgpSrtePreferenceSubTlv -} - -type unMarshalBgpSrtePreferenceSubTlv interface { - // FromProto unmarshals BgpSrtePreferenceSubTlv from protobuf object *otg.BgpSrtePreferenceSubTlv - FromProto(msg *otg.BgpSrtePreferenceSubTlv) (BgpSrtePreferenceSubTlv, error) - // FromPbText unmarshals BgpSrtePreferenceSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrtePreferenceSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrtePreferenceSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrtePreferenceSubTlv) Marshal() marshalBgpSrtePreferenceSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrtePreferenceSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrtePreferenceSubTlv) Unmarshal() unMarshalBgpSrtePreferenceSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrtePreferenceSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrtePreferenceSubTlv) ToProto() (*otg.BgpSrtePreferenceSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrtePreferenceSubTlv) FromProto(msg *otg.BgpSrtePreferenceSubTlv) (BgpSrtePreferenceSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrtePreferenceSubTlv) 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 *unMarshalbgpSrtePreferenceSubTlv) 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 *marshalbgpSrtePreferenceSubTlv) 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 *unMarshalbgpSrtePreferenceSubTlv) 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 *marshalbgpSrtePreferenceSubTlv) 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 *unMarshalbgpSrtePreferenceSubTlv) 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 *bgpSrtePreferenceSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrtePreferenceSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrtePreferenceSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrtePreferenceSubTlv) Clone() (BgpSrtePreferenceSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrtePreferenceSubTlv() - 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 -} - -// BgpSrtePreferenceSubTlv is configuration for BGP preference sub TLV of the SR Policy candidate path. -type BgpSrtePreferenceSubTlv interface { - Validation - // msg marshals BgpSrtePreferenceSubTlv to protobuf object *otg.BgpSrtePreferenceSubTlv - // and doesn't set defaults - msg() *otg.BgpSrtePreferenceSubTlv - // setMsg unmarshals BgpSrtePreferenceSubTlv from protobuf object *otg.BgpSrtePreferenceSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrtePreferenceSubTlv) BgpSrtePreferenceSubTlv - // provides marshal interface - Marshal() marshalBgpSrtePreferenceSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrtePreferenceSubTlv - // validate validates BgpSrtePreferenceSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrtePreferenceSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Preference returns uint32, set in BgpSrtePreferenceSubTlv. - Preference() uint32 - // SetPreference assigns uint32 provided by user to BgpSrtePreferenceSubTlv - SetPreference(value uint32) BgpSrtePreferenceSubTlv - // HasPreference checks if Preference has been set in BgpSrtePreferenceSubTlv - HasPreference() bool -} - -// The preference value of the SR Policy candidate path. -// Preference returns a uint32 -func (obj *bgpSrtePreferenceSubTlv) Preference() uint32 { - - return *obj.obj.Preference - -} - -// The preference value of the SR Policy candidate path. -// Preference returns a uint32 -func (obj *bgpSrtePreferenceSubTlv) HasPreference() bool { - return obj.obj.Preference != nil -} - -// The preference value of the SR Policy candidate path. -// SetPreference sets the uint32 value in the BgpSrtePreferenceSubTlv object -func (obj *bgpSrtePreferenceSubTlv) SetPreference(value uint32) BgpSrtePreferenceSubTlv { - - obj.obj.Preference = &value - return obj -} - -func (obj *bgpSrtePreferenceSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpSrtePreferenceSubTlv) setDefault() { - if obj.obj.Preference == nil { - obj.SetPreference(0) - } - -} - -// ***** BgpSrtePolicyPrioritySubTlv ***** -type bgpSrtePolicyPrioritySubTlv struct { - validation - obj *otg.BgpSrtePolicyPrioritySubTlv - marshaller marshalBgpSrtePolicyPrioritySubTlv - unMarshaller unMarshalBgpSrtePolicyPrioritySubTlv -} - -func NewBgpSrtePolicyPrioritySubTlv() BgpSrtePolicyPrioritySubTlv { - obj := bgpSrtePolicyPrioritySubTlv{obj: &otg.BgpSrtePolicyPrioritySubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrtePolicyPrioritySubTlv) msg() *otg.BgpSrtePolicyPrioritySubTlv { - return obj.obj -} - -func (obj *bgpSrtePolicyPrioritySubTlv) setMsg(msg *otg.BgpSrtePolicyPrioritySubTlv) BgpSrtePolicyPrioritySubTlv { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrtePolicyPrioritySubTlv struct { - obj *bgpSrtePolicyPrioritySubTlv -} - -type marshalBgpSrtePolicyPrioritySubTlv interface { - // ToProto marshals BgpSrtePolicyPrioritySubTlv to protobuf object *otg.BgpSrtePolicyPrioritySubTlv - ToProto() (*otg.BgpSrtePolicyPrioritySubTlv, error) - // ToPbText marshals BgpSrtePolicyPrioritySubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrtePolicyPrioritySubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrtePolicyPrioritySubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrtePolicyPrioritySubTlv struct { - obj *bgpSrtePolicyPrioritySubTlv -} - -type unMarshalBgpSrtePolicyPrioritySubTlv interface { - // FromProto unmarshals BgpSrtePolicyPrioritySubTlv from protobuf object *otg.BgpSrtePolicyPrioritySubTlv - FromProto(msg *otg.BgpSrtePolicyPrioritySubTlv) (BgpSrtePolicyPrioritySubTlv, error) - // FromPbText unmarshals BgpSrtePolicyPrioritySubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrtePolicyPrioritySubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrtePolicyPrioritySubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrtePolicyPrioritySubTlv) Marshal() marshalBgpSrtePolicyPrioritySubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrtePolicyPrioritySubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrtePolicyPrioritySubTlv) Unmarshal() unMarshalBgpSrtePolicyPrioritySubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrtePolicyPrioritySubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrtePolicyPrioritySubTlv) ToProto() (*otg.BgpSrtePolicyPrioritySubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrtePolicyPrioritySubTlv) FromProto(msg *otg.BgpSrtePolicyPrioritySubTlv) (BgpSrtePolicyPrioritySubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrtePolicyPrioritySubTlv) 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 *unMarshalbgpSrtePolicyPrioritySubTlv) 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 *marshalbgpSrtePolicyPrioritySubTlv) 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 *unMarshalbgpSrtePolicyPrioritySubTlv) 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 *marshalbgpSrtePolicyPrioritySubTlv) 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 *unMarshalbgpSrtePolicyPrioritySubTlv) 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 *bgpSrtePolicyPrioritySubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrtePolicyPrioritySubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrtePolicyPrioritySubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrtePolicyPrioritySubTlv) Clone() (BgpSrtePolicyPrioritySubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrtePolicyPrioritySubTlv() - 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 -} - -// BgpSrtePolicyPrioritySubTlv is configuration for the Policy Priority sub-TLV. The Policy Priority to indicate the order in which the SR policies are re-computed upon topological change. -type BgpSrtePolicyPrioritySubTlv interface { - Validation - // msg marshals BgpSrtePolicyPrioritySubTlv to protobuf object *otg.BgpSrtePolicyPrioritySubTlv - // and doesn't set defaults - msg() *otg.BgpSrtePolicyPrioritySubTlv - // setMsg unmarshals BgpSrtePolicyPrioritySubTlv from protobuf object *otg.BgpSrtePolicyPrioritySubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrtePolicyPrioritySubTlv) BgpSrtePolicyPrioritySubTlv - // provides marshal interface - Marshal() marshalBgpSrtePolicyPrioritySubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrtePolicyPrioritySubTlv - // validate validates BgpSrtePolicyPrioritySubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrtePolicyPrioritySubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PolicyPriority returns uint32, set in BgpSrtePolicyPrioritySubTlv. - PolicyPriority() uint32 - // SetPolicyPriority assigns uint32 provided by user to BgpSrtePolicyPrioritySubTlv - SetPolicyPriority(value uint32) BgpSrtePolicyPrioritySubTlv - // HasPolicyPriority checks if PolicyPriority has been set in BgpSrtePolicyPrioritySubTlv - HasPolicyPriority() bool -} - -// One-octet Priority value. -// PolicyPriority returns a uint32 -func (obj *bgpSrtePolicyPrioritySubTlv) PolicyPriority() uint32 { - - return *obj.obj.PolicyPriority - -} - -// One-octet Priority value. -// PolicyPriority returns a uint32 -func (obj *bgpSrtePolicyPrioritySubTlv) HasPolicyPriority() bool { - return obj.obj.PolicyPriority != nil -} - -// One-octet Priority value. -// SetPolicyPriority sets the uint32 value in the BgpSrtePolicyPrioritySubTlv object -func (obj *bgpSrtePolicyPrioritySubTlv) SetPolicyPriority(value uint32) BgpSrtePolicyPrioritySubTlv { - - obj.obj.PolicyPriority = &value - return obj -} - -func (obj *bgpSrtePolicyPrioritySubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.PolicyPriority != nil { - - if *obj.obj.PolicyPriority > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpSrtePolicyPrioritySubTlv.PolicyPriority <= 255 but Got %d", *obj.obj.PolicyPriority)) - } - - } - -} - -func (obj *bgpSrtePolicyPrioritySubTlv) setDefault() { - -} - -// ***** BgpSrtePolicyNameSubTlv ***** -type bgpSrtePolicyNameSubTlv struct { - validation - obj *otg.BgpSrtePolicyNameSubTlv - marshaller marshalBgpSrtePolicyNameSubTlv - unMarshaller unMarshalBgpSrtePolicyNameSubTlv -} - -func NewBgpSrtePolicyNameSubTlv() BgpSrtePolicyNameSubTlv { - obj := bgpSrtePolicyNameSubTlv{obj: &otg.BgpSrtePolicyNameSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrtePolicyNameSubTlv) msg() *otg.BgpSrtePolicyNameSubTlv { - return obj.obj -} - -func (obj *bgpSrtePolicyNameSubTlv) setMsg(msg *otg.BgpSrtePolicyNameSubTlv) BgpSrtePolicyNameSubTlv { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrtePolicyNameSubTlv struct { - obj *bgpSrtePolicyNameSubTlv -} - -type marshalBgpSrtePolicyNameSubTlv interface { - // ToProto marshals BgpSrtePolicyNameSubTlv to protobuf object *otg.BgpSrtePolicyNameSubTlv - ToProto() (*otg.BgpSrtePolicyNameSubTlv, error) - // ToPbText marshals BgpSrtePolicyNameSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrtePolicyNameSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrtePolicyNameSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrtePolicyNameSubTlv struct { - obj *bgpSrtePolicyNameSubTlv -} - -type unMarshalBgpSrtePolicyNameSubTlv interface { - // FromProto unmarshals BgpSrtePolicyNameSubTlv from protobuf object *otg.BgpSrtePolicyNameSubTlv - FromProto(msg *otg.BgpSrtePolicyNameSubTlv) (BgpSrtePolicyNameSubTlv, error) - // FromPbText unmarshals BgpSrtePolicyNameSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrtePolicyNameSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrtePolicyNameSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrtePolicyNameSubTlv) Marshal() marshalBgpSrtePolicyNameSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrtePolicyNameSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrtePolicyNameSubTlv) Unmarshal() unMarshalBgpSrtePolicyNameSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrtePolicyNameSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrtePolicyNameSubTlv) ToProto() (*otg.BgpSrtePolicyNameSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrtePolicyNameSubTlv) FromProto(msg *otg.BgpSrtePolicyNameSubTlv) (BgpSrtePolicyNameSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrtePolicyNameSubTlv) 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 *unMarshalbgpSrtePolicyNameSubTlv) 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 *marshalbgpSrtePolicyNameSubTlv) 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 *unMarshalbgpSrtePolicyNameSubTlv) 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 *marshalbgpSrtePolicyNameSubTlv) 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 *unMarshalbgpSrtePolicyNameSubTlv) 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 *bgpSrtePolicyNameSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrtePolicyNameSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrtePolicyNameSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrtePolicyNameSubTlv) Clone() (BgpSrtePolicyNameSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrtePolicyNameSubTlv() - 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 -} - -// BgpSrtePolicyNameSubTlv is configuration for the Policy Name sub-TLV. The Policy Name sub-TLV is used to attach a symbolic name to the SR Policy candidate path. -type BgpSrtePolicyNameSubTlv interface { - Validation - // msg marshals BgpSrtePolicyNameSubTlv to protobuf object *otg.BgpSrtePolicyNameSubTlv - // and doesn't set defaults - msg() *otg.BgpSrtePolicyNameSubTlv - // setMsg unmarshals BgpSrtePolicyNameSubTlv from protobuf object *otg.BgpSrtePolicyNameSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrtePolicyNameSubTlv) BgpSrtePolicyNameSubTlv - // provides marshal interface - Marshal() marshalBgpSrtePolicyNameSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrtePolicyNameSubTlv - // validate validates BgpSrtePolicyNameSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrtePolicyNameSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // PolicyName returns string, set in BgpSrtePolicyNameSubTlv. - PolicyName() string - // SetPolicyName assigns string provided by user to BgpSrtePolicyNameSubTlv - SetPolicyName(value string) BgpSrtePolicyNameSubTlv - // HasPolicyName checks if PolicyName has been set in BgpSrtePolicyNameSubTlv - HasPolicyName() bool -} - -// Symbolic name for the policy that should be a string of printable ASCII characters, without a NULL terminator. -// PolicyName returns a string -func (obj *bgpSrtePolicyNameSubTlv) PolicyName() string { - - return *obj.obj.PolicyName - -} - -// Symbolic name for the policy that should be a string of printable ASCII characters, without a NULL terminator. -// PolicyName returns a string -func (obj *bgpSrtePolicyNameSubTlv) HasPolicyName() bool { - return obj.obj.PolicyName != nil -} - -// Symbolic name for the policy that should be a string of printable ASCII characters, without a NULL terminator. -// SetPolicyName sets the string value in the BgpSrtePolicyNameSubTlv object -func (obj *bgpSrtePolicyNameSubTlv) SetPolicyName(value string) BgpSrtePolicyNameSubTlv { - - obj.obj.PolicyName = &value - return obj -} - -func (obj *bgpSrtePolicyNameSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.PolicyName != nil { - - if len(*obj.obj.PolicyName) < 1 || len(*obj.obj.PolicyName) > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "1 <= length of BgpSrtePolicyNameSubTlv.PolicyName <= 32 but Got %d", - len(*obj.obj.PolicyName))) - } - - } - -} - -func (obj *bgpSrtePolicyNameSubTlv) setDefault() { - -} - -// ***** BgpSrteExplicitNullLabelPolicySubTlv ***** -type bgpSrteExplicitNullLabelPolicySubTlv struct { - validation - obj *otg.BgpSrteExplicitNullLabelPolicySubTlv - marshaller marshalBgpSrteExplicitNullLabelPolicySubTlv - unMarshaller unMarshalBgpSrteExplicitNullLabelPolicySubTlv -} - -func NewBgpSrteExplicitNullLabelPolicySubTlv() BgpSrteExplicitNullLabelPolicySubTlv { - obj := bgpSrteExplicitNullLabelPolicySubTlv{obj: &otg.BgpSrteExplicitNullLabelPolicySubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteExplicitNullLabelPolicySubTlv) msg() *otg.BgpSrteExplicitNullLabelPolicySubTlv { - return obj.obj -} - -func (obj *bgpSrteExplicitNullLabelPolicySubTlv) setMsg(msg *otg.BgpSrteExplicitNullLabelPolicySubTlv) BgpSrteExplicitNullLabelPolicySubTlv { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteExplicitNullLabelPolicySubTlv struct { - obj *bgpSrteExplicitNullLabelPolicySubTlv -} - -type marshalBgpSrteExplicitNullLabelPolicySubTlv interface { - // ToProto marshals BgpSrteExplicitNullLabelPolicySubTlv to protobuf object *otg.BgpSrteExplicitNullLabelPolicySubTlv - ToProto() (*otg.BgpSrteExplicitNullLabelPolicySubTlv, error) - // ToPbText marshals BgpSrteExplicitNullLabelPolicySubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteExplicitNullLabelPolicySubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteExplicitNullLabelPolicySubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteExplicitNullLabelPolicySubTlv struct { - obj *bgpSrteExplicitNullLabelPolicySubTlv -} - -type unMarshalBgpSrteExplicitNullLabelPolicySubTlv interface { - // FromProto unmarshals BgpSrteExplicitNullLabelPolicySubTlv from protobuf object *otg.BgpSrteExplicitNullLabelPolicySubTlv - FromProto(msg *otg.BgpSrteExplicitNullLabelPolicySubTlv) (BgpSrteExplicitNullLabelPolicySubTlv, error) - // FromPbText unmarshals BgpSrteExplicitNullLabelPolicySubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteExplicitNullLabelPolicySubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteExplicitNullLabelPolicySubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteExplicitNullLabelPolicySubTlv) Marshal() marshalBgpSrteExplicitNullLabelPolicySubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteExplicitNullLabelPolicySubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteExplicitNullLabelPolicySubTlv) Unmarshal() unMarshalBgpSrteExplicitNullLabelPolicySubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteExplicitNullLabelPolicySubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteExplicitNullLabelPolicySubTlv) ToProto() (*otg.BgpSrteExplicitNullLabelPolicySubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteExplicitNullLabelPolicySubTlv) FromProto(msg *otg.BgpSrteExplicitNullLabelPolicySubTlv) (BgpSrteExplicitNullLabelPolicySubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteExplicitNullLabelPolicySubTlv) 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 *unMarshalbgpSrteExplicitNullLabelPolicySubTlv) 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 *marshalbgpSrteExplicitNullLabelPolicySubTlv) 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 *unMarshalbgpSrteExplicitNullLabelPolicySubTlv) 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 *marshalbgpSrteExplicitNullLabelPolicySubTlv) 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 *unMarshalbgpSrteExplicitNullLabelPolicySubTlv) 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 *bgpSrteExplicitNullLabelPolicySubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteExplicitNullLabelPolicySubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteExplicitNullLabelPolicySubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteExplicitNullLabelPolicySubTlv) Clone() (BgpSrteExplicitNullLabelPolicySubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteExplicitNullLabelPolicySubTlv() - 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 -} - -// BgpSrteExplicitNullLabelPolicySubTlv is configuration for BGP explicit null label policy sub TLV settings. -type BgpSrteExplicitNullLabelPolicySubTlv interface { - Validation - // msg marshals BgpSrteExplicitNullLabelPolicySubTlv to protobuf object *otg.BgpSrteExplicitNullLabelPolicySubTlv - // and doesn't set defaults - msg() *otg.BgpSrteExplicitNullLabelPolicySubTlv - // setMsg unmarshals BgpSrteExplicitNullLabelPolicySubTlv from protobuf object *otg.BgpSrteExplicitNullLabelPolicySubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteExplicitNullLabelPolicySubTlv) BgpSrteExplicitNullLabelPolicySubTlv - // provides marshal interface - Marshal() marshalBgpSrteExplicitNullLabelPolicySubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteExplicitNullLabelPolicySubTlv - // validate validates BgpSrteExplicitNullLabelPolicySubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteExplicitNullLabelPolicySubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ExplicitNullLabelPolicy returns BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum, set in BgpSrteExplicitNullLabelPolicySubTlv - ExplicitNullLabelPolicy() BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum - // SetExplicitNullLabelPolicy assigns BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum provided by user to BgpSrteExplicitNullLabelPolicySubTlv - SetExplicitNullLabelPolicy(value BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum) BgpSrteExplicitNullLabelPolicySubTlv - // HasExplicitNullLabelPolicy checks if ExplicitNullLabelPolicy has been set in BgpSrteExplicitNullLabelPolicySubTlv - HasExplicitNullLabelPolicy() bool -} - -type BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum string - -// Enum of ExplicitNullLabelPolicy on BgpSrteExplicitNullLabelPolicySubTlv -var BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicy = struct { - RESERVED_ENLP BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum - PUSH_IPV4_ENLP BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum - PUSH_IPV6_ENLP BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum - PUSH_IPV4_IPV6_ENLP BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum - DO_NOT_PUSH_ENLP BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum -}{ - RESERVED_ENLP: BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum("reserved_enlp"), - PUSH_IPV4_ENLP: BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum("push_ipv4_enlp"), - PUSH_IPV6_ENLP: BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum("push_ipv6_enlp"), - PUSH_IPV4_IPV6_ENLP: BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum("push_ipv4_ipv6_enlp"), - DO_NOT_PUSH_ENLP: BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum("do_not_push_enlp"), -} - -func (obj *bgpSrteExplicitNullLabelPolicySubTlv) ExplicitNullLabelPolicy() BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum { - return BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum(obj.obj.ExplicitNullLabelPolicy.Enum().String()) -} - -// The value of the explicit null label policy -// ExplicitNullLabelPolicy returns a string -func (obj *bgpSrteExplicitNullLabelPolicySubTlv) HasExplicitNullLabelPolicy() bool { - return obj.obj.ExplicitNullLabelPolicy != nil -} - -func (obj *bgpSrteExplicitNullLabelPolicySubTlv) SetExplicitNullLabelPolicy(value BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum) BgpSrteExplicitNullLabelPolicySubTlv { - intValue, ok := otg.BgpSrteExplicitNullLabelPolicySubTlv_ExplicitNullLabelPolicy_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicyEnum", string(value))) - return obj - } - enumValue := otg.BgpSrteExplicitNullLabelPolicySubTlv_ExplicitNullLabelPolicy_Enum(intValue) - obj.obj.ExplicitNullLabelPolicy = &enumValue - - return obj -} - -func (obj *bgpSrteExplicitNullLabelPolicySubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpSrteExplicitNullLabelPolicySubTlv) setDefault() { - if obj.obj.ExplicitNullLabelPolicy == nil { - obj.SetExplicitNullLabelPolicy(BgpSrteExplicitNullLabelPolicySubTlvExplicitNullLabelPolicy.DO_NOT_PUSH_ENLP) - - } - -} - -// ***** BgpSrteSegmentList ***** -type bgpSrteSegmentList struct { - validation - obj *otg.BgpSrteSegmentList - marshaller marshalBgpSrteSegmentList - unMarshaller unMarshalBgpSrteSegmentList - segmentsHolder BgpSrteSegmentListBgpSrteSegmentIter -} - -func NewBgpSrteSegmentList() BgpSrteSegmentList { - obj := bgpSrteSegmentList{obj: &otg.BgpSrteSegmentList{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSegmentList) msg() *otg.BgpSrteSegmentList { - return obj.obj -} - -func (obj *bgpSrteSegmentList) setMsg(msg *otg.BgpSrteSegmentList) BgpSrteSegmentList { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSegmentList struct { - obj *bgpSrteSegmentList -} - -type marshalBgpSrteSegmentList interface { - // ToProto marshals BgpSrteSegmentList to protobuf object *otg.BgpSrteSegmentList - ToProto() (*otg.BgpSrteSegmentList, error) - // ToPbText marshals BgpSrteSegmentList to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSegmentList to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSegmentList to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSegmentList struct { - obj *bgpSrteSegmentList -} - -type unMarshalBgpSrteSegmentList interface { - // FromProto unmarshals BgpSrteSegmentList from protobuf object *otg.BgpSrteSegmentList - FromProto(msg *otg.BgpSrteSegmentList) (BgpSrteSegmentList, error) - // FromPbText unmarshals BgpSrteSegmentList from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSegmentList from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSegmentList from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSegmentList) Marshal() marshalBgpSrteSegmentList { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSegmentList{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSegmentList) Unmarshal() unMarshalBgpSrteSegmentList { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSegmentList{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSegmentList) ToProto() (*otg.BgpSrteSegmentList, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSegmentList) FromProto(msg *otg.BgpSrteSegmentList) (BgpSrteSegmentList, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSegmentList) 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 *unMarshalbgpSrteSegmentList) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteSegmentList) 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 *unMarshalbgpSrteSegmentList) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteSegmentList) 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 *unMarshalbgpSrteSegmentList) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteSegmentList) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentList) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentList) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSegmentList) Clone() (BgpSrteSegmentList, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSegmentList() - 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 -} - -func (obj *bgpSrteSegmentList) setNil() { - obj.segmentsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteSegmentList is optional configuration for BGP SR TE Policy segment list. The Segment List sub-TLV encodes a single explicit path towards the Endpoint. -type BgpSrteSegmentList interface { - Validation - // msg marshals BgpSrteSegmentList to protobuf object *otg.BgpSrteSegmentList - // and doesn't set defaults - msg() *otg.BgpSrteSegmentList - // setMsg unmarshals BgpSrteSegmentList from protobuf object *otg.BgpSrteSegmentList - // and doesn't set defaults - setMsg(*otg.BgpSrteSegmentList) BgpSrteSegmentList - // provides marshal interface - Marshal() marshalBgpSrteSegmentList - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSegmentList - // validate validates BgpSrteSegmentList - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSegmentList, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Weight returns uint32, set in BgpSrteSegmentList. - Weight() uint32 - // SetWeight assigns uint32 provided by user to BgpSrteSegmentList - SetWeight(value uint32) BgpSrteSegmentList - // HasWeight checks if Weight has been set in BgpSrteSegmentList - HasWeight() bool - // Segments returns BgpSrteSegmentListBgpSrteSegmentIterIter, set in BgpSrteSegmentList - Segments() BgpSrteSegmentListBgpSrteSegmentIter - // Name returns string, set in BgpSrteSegmentList. - Name() string - // SetName assigns string provided by user to BgpSrteSegmentList - SetName(value string) BgpSrteSegmentList - // Active returns bool, set in BgpSrteSegmentList. - Active() bool - // SetActive assigns bool provided by user to BgpSrteSegmentList - SetActive(value bool) BgpSrteSegmentList - // HasActive checks if Active has been set in BgpSrteSegmentList - HasActive() bool - setNil() -} - -// The Weight associated with a given path and the sub-TLV is optional. -// Weight returns a uint32 -func (obj *bgpSrteSegmentList) Weight() uint32 { - - return *obj.obj.Weight - -} - -// The Weight associated with a given path and the sub-TLV is optional. -// Weight returns a uint32 -func (obj *bgpSrteSegmentList) HasWeight() bool { - return obj.obj.Weight != nil -} - -// The Weight associated with a given path and the sub-TLV is optional. -// SetWeight sets the uint32 value in the BgpSrteSegmentList object -func (obj *bgpSrteSegmentList) SetWeight(value uint32) BgpSrteSegmentList { - - obj.obj.Weight = &value - return obj -} - -// description is TBD -// Segments returns a []BgpSrteSegment -func (obj *bgpSrteSegmentList) Segments() BgpSrteSegmentListBgpSrteSegmentIter { - if len(obj.obj.Segments) == 0 { - obj.obj.Segments = []*otg.BgpSrteSegment{} - } - if obj.segmentsHolder == nil { - obj.segmentsHolder = newBgpSrteSegmentListBgpSrteSegmentIter(&obj.obj.Segments).setMsg(obj) - } - return obj.segmentsHolder -} - -type bgpSrteSegmentListBgpSrteSegmentIter struct { - obj *bgpSrteSegmentList - bgpSrteSegmentSlice []BgpSrteSegment - fieldPtr *[]*otg.BgpSrteSegment -} - -func newBgpSrteSegmentListBgpSrteSegmentIter(ptr *[]*otg.BgpSrteSegment) BgpSrteSegmentListBgpSrteSegmentIter { - return &bgpSrteSegmentListBgpSrteSegmentIter{fieldPtr: ptr} -} - -type BgpSrteSegmentListBgpSrteSegmentIter interface { - setMsg(*bgpSrteSegmentList) BgpSrteSegmentListBgpSrteSegmentIter - Items() []BgpSrteSegment - Add() BgpSrteSegment - Append(items ...BgpSrteSegment) BgpSrteSegmentListBgpSrteSegmentIter - Set(index int, newObj BgpSrteSegment) BgpSrteSegmentListBgpSrteSegmentIter - Clear() BgpSrteSegmentListBgpSrteSegmentIter - clearHolderSlice() BgpSrteSegmentListBgpSrteSegmentIter - appendHolderSlice(item BgpSrteSegment) BgpSrteSegmentListBgpSrteSegmentIter -} - -func (obj *bgpSrteSegmentListBgpSrteSegmentIter) setMsg(msg *bgpSrteSegmentList) BgpSrteSegmentListBgpSrteSegmentIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpSrteSegment{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpSrteSegmentListBgpSrteSegmentIter) Items() []BgpSrteSegment { - return obj.bgpSrteSegmentSlice -} - -func (obj *bgpSrteSegmentListBgpSrteSegmentIter) Add() BgpSrteSegment { - newObj := &otg.BgpSrteSegment{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpSrteSegment{obj: newObj} - newLibObj.setDefault() - obj.bgpSrteSegmentSlice = append(obj.bgpSrteSegmentSlice, newLibObj) - return newLibObj -} - -func (obj *bgpSrteSegmentListBgpSrteSegmentIter) Append(items ...BgpSrteSegment) BgpSrteSegmentListBgpSrteSegmentIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpSrteSegmentSlice = append(obj.bgpSrteSegmentSlice, item) - } - return obj -} - -func (obj *bgpSrteSegmentListBgpSrteSegmentIter) Set(index int, newObj BgpSrteSegment) BgpSrteSegmentListBgpSrteSegmentIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpSrteSegmentSlice[index] = newObj - return obj -} -func (obj *bgpSrteSegmentListBgpSrteSegmentIter) Clear() BgpSrteSegmentListBgpSrteSegmentIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpSrteSegment{} - obj.bgpSrteSegmentSlice = []BgpSrteSegment{} - } - return obj -} -func (obj *bgpSrteSegmentListBgpSrteSegmentIter) clearHolderSlice() BgpSrteSegmentListBgpSrteSegmentIter { - if len(obj.bgpSrteSegmentSlice) > 0 { - obj.bgpSrteSegmentSlice = []BgpSrteSegment{} - } - return obj -} -func (obj *bgpSrteSegmentListBgpSrteSegmentIter) appendHolderSlice(item BgpSrteSegment) BgpSrteSegmentListBgpSrteSegmentIter { - obj.bgpSrteSegmentSlice = append(obj.bgpSrteSegmentSlice, item) - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *bgpSrteSegmentList) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the BgpSrteSegmentList object -func (obj *bgpSrteSegmentList) SetName(value string) BgpSrteSegmentList { - - obj.obj.Name = &value - return obj -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// Active returns a bool -func (obj *bgpSrteSegmentList) Active() bool { - - return *obj.obj.Active - -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// Active returns a bool -func (obj *bgpSrteSegmentList) HasActive() bool { - return obj.obj.Active != nil -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// SetActive sets the bool value in the BgpSrteSegmentList object -func (obj *bgpSrteSegmentList) SetActive(value bool) BgpSrteSegmentList { - - obj.obj.Active = &value - return obj -} - -func (obj *bgpSrteSegmentList) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Segments) != 0 { - - if set_default { - obj.Segments().clearHolderSlice() - for _, item := range obj.obj.Segments { - obj.Segments().appendHolderSlice(&bgpSrteSegment{obj: item}) - } - } - for _, item := range obj.Segments().Items() { - item.validateObj(vObj, set_default) - } - - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpSrteSegmentList") - } -} - -func (obj *bgpSrteSegmentList) setDefault() { - if obj.obj.Weight == nil { - obj.SetWeight(0) - } - if obj.obj.Active == nil { - obj.SetActive(true) - } - -} - -// ***** BgpOneStructuredUpdateReplay ***** -type bgpOneStructuredUpdateReplay struct { - validation - obj *otg.BgpOneStructuredUpdateReplay - marshaller marshalBgpOneStructuredUpdateReplay - unMarshaller unMarshalBgpOneStructuredUpdateReplay - pathAttributesHolder BgpAttributes - traditionalUnreachNlrisHolder BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter - traditionalReachNlrisHolder BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter -} - -func NewBgpOneStructuredUpdateReplay() BgpOneStructuredUpdateReplay { - obj := bgpOneStructuredUpdateReplay{obj: &otg.BgpOneStructuredUpdateReplay{}} - obj.setDefault() - return &obj -} - -func (obj *bgpOneStructuredUpdateReplay) msg() *otg.BgpOneStructuredUpdateReplay { - return obj.obj -} - -func (obj *bgpOneStructuredUpdateReplay) setMsg(msg *otg.BgpOneStructuredUpdateReplay) BgpOneStructuredUpdateReplay { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpOneStructuredUpdateReplay struct { - obj *bgpOneStructuredUpdateReplay -} - -type marshalBgpOneStructuredUpdateReplay interface { - // ToProto marshals BgpOneStructuredUpdateReplay to protobuf object *otg.BgpOneStructuredUpdateReplay - ToProto() (*otg.BgpOneStructuredUpdateReplay, error) - // ToPbText marshals BgpOneStructuredUpdateReplay to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpOneStructuredUpdateReplay to YAML text - ToYaml() (string, error) - // ToJson marshals BgpOneStructuredUpdateReplay to JSON text - ToJson() (string, error) -} - -type unMarshalbgpOneStructuredUpdateReplay struct { - obj *bgpOneStructuredUpdateReplay -} - -type unMarshalBgpOneStructuredUpdateReplay interface { - // FromProto unmarshals BgpOneStructuredUpdateReplay from protobuf object *otg.BgpOneStructuredUpdateReplay - FromProto(msg *otg.BgpOneStructuredUpdateReplay) (BgpOneStructuredUpdateReplay, error) - // FromPbText unmarshals BgpOneStructuredUpdateReplay from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpOneStructuredUpdateReplay from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpOneStructuredUpdateReplay from JSON text - FromJson(value string) error -} - -func (obj *bgpOneStructuredUpdateReplay) Marshal() marshalBgpOneStructuredUpdateReplay { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpOneStructuredUpdateReplay{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpOneStructuredUpdateReplay) Unmarshal() unMarshalBgpOneStructuredUpdateReplay { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpOneStructuredUpdateReplay{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpOneStructuredUpdateReplay) ToProto() (*otg.BgpOneStructuredUpdateReplay, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpOneStructuredUpdateReplay) FromProto(msg *otg.BgpOneStructuredUpdateReplay) (BgpOneStructuredUpdateReplay, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpOneStructuredUpdateReplay) 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 *unMarshalbgpOneStructuredUpdateReplay) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpOneStructuredUpdateReplay) 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 *unMarshalbgpOneStructuredUpdateReplay) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpOneStructuredUpdateReplay) 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 *unMarshalbgpOneStructuredUpdateReplay) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpOneStructuredUpdateReplay) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpOneStructuredUpdateReplay) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpOneStructuredUpdateReplay) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpOneStructuredUpdateReplay) Clone() (BgpOneStructuredUpdateReplay, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpOneStructuredUpdateReplay() - 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 -} - -func (obj *bgpOneStructuredUpdateReplay) setNil() { - obj.pathAttributesHolder = nil - obj.traditionalUnreachNlrisHolder = nil - obj.traditionalReachNlrisHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpOneStructuredUpdateReplay is one structured BGP Update. -type BgpOneStructuredUpdateReplay interface { - Validation - // msg marshals BgpOneStructuredUpdateReplay to protobuf object *otg.BgpOneStructuredUpdateReplay - // and doesn't set defaults - msg() *otg.BgpOneStructuredUpdateReplay - // setMsg unmarshals BgpOneStructuredUpdateReplay from protobuf object *otg.BgpOneStructuredUpdateReplay - // and doesn't set defaults - setMsg(*otg.BgpOneStructuredUpdateReplay) BgpOneStructuredUpdateReplay - // provides marshal interface - Marshal() marshalBgpOneStructuredUpdateReplay - // provides unmarshal interface - Unmarshal() unMarshalBgpOneStructuredUpdateReplay - // validate validates BgpOneStructuredUpdateReplay - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpOneStructuredUpdateReplay, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // TimeGap returns uint32, set in BgpOneStructuredUpdateReplay. - TimeGap() uint32 - // SetTimeGap assigns uint32 provided by user to BgpOneStructuredUpdateReplay - SetTimeGap(value uint32) BgpOneStructuredUpdateReplay - // HasTimeGap checks if TimeGap has been set in BgpOneStructuredUpdateReplay - HasTimeGap() bool - // PathAttributes returns BgpAttributes, set in BgpOneStructuredUpdateReplay. - // BgpAttributes is attributes carried in the Update packet alongwith the reach/unreach prefixes. - PathAttributes() BgpAttributes - // SetPathAttributes assigns BgpAttributes provided by user to BgpOneStructuredUpdateReplay. - // BgpAttributes is attributes carried in the Update packet alongwith the reach/unreach prefixes. - SetPathAttributes(value BgpAttributes) BgpOneStructuredUpdateReplay - // HasPathAttributes checks if PathAttributes has been set in BgpOneStructuredUpdateReplay - HasPathAttributes() bool - // TraditionalUnreachNlris returns BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIterIter, set in BgpOneStructuredUpdateReplay - TraditionalUnreachNlris() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter - // TraditionalReachNlris returns BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIterIter, set in BgpOneStructuredUpdateReplay - TraditionalReachNlris() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter - setNil() -} - -// Minimum time interval in milliseconds from previous Update from the sequence of BGP Updates to be replayed. -// TimeGap returns a uint32 -func (obj *bgpOneStructuredUpdateReplay) TimeGap() uint32 { - - return *obj.obj.TimeGap - -} - -// Minimum time interval in milliseconds from previous Update from the sequence of BGP Updates to be replayed. -// TimeGap returns a uint32 -func (obj *bgpOneStructuredUpdateReplay) HasTimeGap() bool { - return obj.obj.TimeGap != nil -} - -// Minimum time interval in milliseconds from previous Update from the sequence of BGP Updates to be replayed. -// SetTimeGap sets the uint32 value in the BgpOneStructuredUpdateReplay object -func (obj *bgpOneStructuredUpdateReplay) SetTimeGap(value uint32) BgpOneStructuredUpdateReplay { - - obj.obj.TimeGap = &value - return obj -} - -// Attributes carried in the Update packet alongwith the reach/unreach prefixes. -// PathAttributes returns a BgpAttributes -func (obj *bgpOneStructuredUpdateReplay) PathAttributes() BgpAttributes { - if obj.obj.PathAttributes == nil { - obj.obj.PathAttributes = NewBgpAttributes().msg() - } - if obj.pathAttributesHolder == nil { - obj.pathAttributesHolder = &bgpAttributes{obj: obj.obj.PathAttributes} - } - return obj.pathAttributesHolder -} - -// Attributes carried in the Update packet alongwith the reach/unreach prefixes. -// PathAttributes returns a BgpAttributes -func (obj *bgpOneStructuredUpdateReplay) HasPathAttributes() bool { - return obj.obj.PathAttributes != nil -} - -// Attributes carried in the Update packet alongwith the reach/unreach prefixes. -// SetPathAttributes sets the BgpAttributes value in the BgpOneStructuredUpdateReplay object -func (obj *bgpOneStructuredUpdateReplay) SetPathAttributes(value BgpAttributes) BgpOneStructuredUpdateReplay { - - obj.pathAttributesHolder = nil - obj.obj.PathAttributes = value.msg() - - return obj -} - -// The IPv4 prefixes to be included in the traditional UNREACH_NLRI. -// TraditionalUnreachNlris returns a []BgpOneTraditionalNlriPrefix -func (obj *bgpOneStructuredUpdateReplay) TraditionalUnreachNlris() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { - if len(obj.obj.TraditionalUnreachNlris) == 0 { - obj.obj.TraditionalUnreachNlris = []*otg.BgpOneTraditionalNlriPrefix{} - } - if obj.traditionalUnreachNlrisHolder == nil { - obj.traditionalUnreachNlrisHolder = newBgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter(&obj.obj.TraditionalUnreachNlris).setMsg(obj) - } - return obj.traditionalUnreachNlrisHolder -} - -type bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter struct { - obj *bgpOneStructuredUpdateReplay - bgpOneTraditionalNlriPrefixSlice []BgpOneTraditionalNlriPrefix - fieldPtr *[]*otg.BgpOneTraditionalNlriPrefix -} - -func newBgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter(ptr *[]*otg.BgpOneTraditionalNlriPrefix) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { - return &bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter{fieldPtr: ptr} -} - -type BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter interface { - setMsg(*bgpOneStructuredUpdateReplay) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter - Items() []BgpOneTraditionalNlriPrefix - Add() BgpOneTraditionalNlriPrefix - Append(items ...BgpOneTraditionalNlriPrefix) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter - Set(index int, newObj BgpOneTraditionalNlriPrefix) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter - Clear() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter - clearHolderSlice() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter - appendHolderSlice(item BgpOneTraditionalNlriPrefix) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter -} - -func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) setMsg(msg *bgpOneStructuredUpdateReplay) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpOneTraditionalNlriPrefix{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) Items() []BgpOneTraditionalNlriPrefix { - return obj.bgpOneTraditionalNlriPrefixSlice -} - -func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) Add() BgpOneTraditionalNlriPrefix { - newObj := &otg.BgpOneTraditionalNlriPrefix{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpOneTraditionalNlriPrefix{obj: newObj} - newLibObj.setDefault() - obj.bgpOneTraditionalNlriPrefixSlice = append(obj.bgpOneTraditionalNlriPrefixSlice, newLibObj) - return newLibObj -} - -func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) Append(items ...BgpOneTraditionalNlriPrefix) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpOneTraditionalNlriPrefixSlice = append(obj.bgpOneTraditionalNlriPrefixSlice, item) - } - return obj -} - -func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) Set(index int, newObj BgpOneTraditionalNlriPrefix) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpOneTraditionalNlriPrefixSlice[index] = newObj - return obj -} -func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) Clear() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpOneTraditionalNlriPrefix{} - obj.bgpOneTraditionalNlriPrefixSlice = []BgpOneTraditionalNlriPrefix{} - } - return obj -} -func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) clearHolderSlice() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { - if len(obj.bgpOneTraditionalNlriPrefixSlice) > 0 { - obj.bgpOneTraditionalNlriPrefixSlice = []BgpOneTraditionalNlriPrefix{} - } - return obj -} -func (obj *bgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter) appendHolderSlice(item BgpOneTraditionalNlriPrefix) BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { - obj.bgpOneTraditionalNlriPrefixSlice = append(obj.bgpOneTraditionalNlriPrefixSlice, item) - return obj -} - -// The IPv4 prefixes to be included in the traditional REACH_NLRI. -// TraditionalReachNlris returns a []BgpOneTraditionalNlriPrefix -func (obj *bgpOneStructuredUpdateReplay) TraditionalReachNlris() BgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter { - if len(obj.obj.TraditionalReachNlris) == 0 { - obj.obj.TraditionalReachNlris = []*otg.BgpOneTraditionalNlriPrefix{} - } - if obj.traditionalReachNlrisHolder == nil { - obj.traditionalReachNlrisHolder = newBgpOneStructuredUpdateReplayBgpOneTraditionalNlriPrefixIter(&obj.obj.TraditionalReachNlris).setMsg(obj) - } - return obj.traditionalReachNlrisHolder -} - -func (obj *bgpOneStructuredUpdateReplay) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.PathAttributes != nil { - - obj.PathAttributes().validateObj(vObj, set_default) - } - - if len(obj.obj.TraditionalUnreachNlris) != 0 { - - if set_default { - obj.TraditionalUnreachNlris().clearHolderSlice() - for _, item := range obj.obj.TraditionalUnreachNlris { - obj.TraditionalUnreachNlris().appendHolderSlice(&bgpOneTraditionalNlriPrefix{obj: item}) - } - } - for _, item := range obj.TraditionalUnreachNlris().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.TraditionalReachNlris) != 0 { - - if set_default { - obj.TraditionalReachNlris().clearHolderSlice() - for _, item := range obj.obj.TraditionalReachNlris { - obj.TraditionalReachNlris().appendHolderSlice(&bgpOneTraditionalNlriPrefix{obj: item}) - } - } - for _, item := range obj.TraditionalReachNlris().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpOneStructuredUpdateReplay) setDefault() { - if obj.obj.TimeGap == nil { - obj.SetTimeGap(0) - } - -} - -// ***** BgpOneUpdateReplay ***** -type bgpOneUpdateReplay struct { - validation - obj *otg.BgpOneUpdateReplay - marshaller marshalBgpOneUpdateReplay - unMarshaller unMarshalBgpOneUpdateReplay -} - -func NewBgpOneUpdateReplay() BgpOneUpdateReplay { - obj := bgpOneUpdateReplay{obj: &otg.BgpOneUpdateReplay{}} - obj.setDefault() - return &obj -} - -func (obj *bgpOneUpdateReplay) msg() *otg.BgpOneUpdateReplay { - return obj.obj -} - -func (obj *bgpOneUpdateReplay) setMsg(msg *otg.BgpOneUpdateReplay) BgpOneUpdateReplay { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpOneUpdateReplay struct { - obj *bgpOneUpdateReplay -} - -type marshalBgpOneUpdateReplay interface { - // ToProto marshals BgpOneUpdateReplay to protobuf object *otg.BgpOneUpdateReplay - ToProto() (*otg.BgpOneUpdateReplay, error) - // ToPbText marshals BgpOneUpdateReplay to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpOneUpdateReplay to YAML text - ToYaml() (string, error) - // ToJson marshals BgpOneUpdateReplay to JSON text - ToJson() (string, error) -} - -type unMarshalbgpOneUpdateReplay struct { - obj *bgpOneUpdateReplay -} - -type unMarshalBgpOneUpdateReplay interface { - // FromProto unmarshals BgpOneUpdateReplay from protobuf object *otg.BgpOneUpdateReplay - FromProto(msg *otg.BgpOneUpdateReplay) (BgpOneUpdateReplay, error) - // FromPbText unmarshals BgpOneUpdateReplay from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpOneUpdateReplay from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpOneUpdateReplay from JSON text - FromJson(value string) error -} - -func (obj *bgpOneUpdateReplay) Marshal() marshalBgpOneUpdateReplay { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpOneUpdateReplay{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpOneUpdateReplay) Unmarshal() unMarshalBgpOneUpdateReplay { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpOneUpdateReplay{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpOneUpdateReplay) ToProto() (*otg.BgpOneUpdateReplay, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpOneUpdateReplay) FromProto(msg *otg.BgpOneUpdateReplay) (BgpOneUpdateReplay, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpOneUpdateReplay) 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 *unMarshalbgpOneUpdateReplay) 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 *marshalbgpOneUpdateReplay) 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 *unMarshalbgpOneUpdateReplay) 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 *marshalbgpOneUpdateReplay) 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 *unMarshalbgpOneUpdateReplay) 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 *bgpOneUpdateReplay) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpOneUpdateReplay) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpOneUpdateReplay) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpOneUpdateReplay) Clone() (BgpOneUpdateReplay, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpOneUpdateReplay() - 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 -} - -// BgpOneUpdateReplay is specification of one BGP Update to be sent to the BGP peer. -type BgpOneUpdateReplay interface { - Validation - // msg marshals BgpOneUpdateReplay to protobuf object *otg.BgpOneUpdateReplay - // and doesn't set defaults - msg() *otg.BgpOneUpdateReplay - // setMsg unmarshals BgpOneUpdateReplay from protobuf object *otg.BgpOneUpdateReplay - // and doesn't set defaults - setMsg(*otg.BgpOneUpdateReplay) BgpOneUpdateReplay - // provides marshal interface - Marshal() marshalBgpOneUpdateReplay - // provides unmarshal interface - Unmarshal() unMarshalBgpOneUpdateReplay - // validate validates BgpOneUpdateReplay - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpOneUpdateReplay, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // TimeGap returns uint32, set in BgpOneUpdateReplay. - TimeGap() uint32 - // SetTimeGap assigns uint32 provided by user to BgpOneUpdateReplay - SetTimeGap(value uint32) BgpOneUpdateReplay - // HasTimeGap checks if TimeGap has been set in BgpOneUpdateReplay - HasTimeGap() bool - // UpdateBytes returns string, set in BgpOneUpdateReplay. - UpdateBytes() string - // SetUpdateBytes assigns string provided by user to BgpOneUpdateReplay - SetUpdateBytes(value string) BgpOneUpdateReplay -} - -// Minimum time interval in milliseconds from previous Update from the sequence of BGP Updates to be replayed. -// TimeGap returns a uint32 -func (obj *bgpOneUpdateReplay) TimeGap() uint32 { - - return *obj.obj.TimeGap - -} - -// Minimum time interval in milliseconds from previous Update from the sequence of BGP Updates to be replayed. -// TimeGap returns a uint32 -func (obj *bgpOneUpdateReplay) HasTimeGap() bool { - return obj.obj.TimeGap != nil -} - -// Minimum time interval in milliseconds from previous Update from the sequence of BGP Updates to be replayed. -// SetTimeGap sets the uint32 value in the BgpOneUpdateReplay object -func (obj *bgpOneUpdateReplay) SetTimeGap(value uint32) BgpOneUpdateReplay { - - obj.obj.TimeGap = &value - return obj -} - -// Bytes specified in hex format to be sent to peer after the BGP Update Header. The Update Header will always have the initial 16 bytes containing Marker bytes, 2 bytes containing the Length and 1 byte containing the Type.The string MUST contain sequence of valid hex bytes. The bytes specified in hex format should be appended to the Update message to be sent to the peer after the fixed 19 bytes described above. This byte stream can be of any length from 1 to 4077 bytes.The value 4077 is derived from the maximum length allowed for a BGP message in RFC4271 which is 4096 minus mandatory 19 bytes described above. In the imported byte stream, one byte is represented as string of 2 characters, for example 2 character string (0x)AB represents value of a single byte. So the maximum length of this attribute is 8154 (4077 * 2 hex characters per byte). -// UpdateBytes returns a string -func (obj *bgpOneUpdateReplay) UpdateBytes() string { - - return *obj.obj.UpdateBytes - -} - -// Bytes specified in hex format to be sent to peer after the BGP Update Header. The Update Header will always have the initial 16 bytes containing Marker bytes, 2 bytes containing the Length and 1 byte containing the Type.The string MUST contain sequence of valid hex bytes. The bytes specified in hex format should be appended to the Update message to be sent to the peer after the fixed 19 bytes described above. This byte stream can be of any length from 1 to 4077 bytes.The value 4077 is derived from the maximum length allowed for a BGP message in RFC4271 which is 4096 minus mandatory 19 bytes described above. In the imported byte stream, one byte is represented as string of 2 characters, for example 2 character string (0x)AB represents value of a single byte. So the maximum length of this attribute is 8154 (4077 * 2 hex characters per byte). -// SetUpdateBytes sets the string value in the BgpOneUpdateReplay object -func (obj *bgpOneUpdateReplay) SetUpdateBytes(value string) BgpOneUpdateReplay { - - obj.obj.UpdateBytes = &value - return obj -} - -func (obj *bgpOneUpdateReplay) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // UpdateBytes is required - if obj.obj.UpdateBytes == nil { - vObj.validationErrors = append(vObj.validationErrors, "UpdateBytes is required field on interface BgpOneUpdateReplay") - } - if obj.obj.UpdateBytes != nil { - - if len(*obj.obj.UpdateBytes) < 1 || len(*obj.obj.UpdateBytes) > 8154 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "1 <= length of BgpOneUpdateReplay.UpdateBytes <= 8154 but Got %d", - len(*obj.obj.UpdateBytes))) - } - - } - -} - -func (obj *bgpOneUpdateReplay) setDefault() { - if obj.obj.TimeGap == nil { - obj.SetTimeGap(0) - } - -} - -// ***** BgpV6EviVxlan ***** -type bgpV6EviVxlan struct { - validation - obj *otg.BgpV6EviVxlan - marshaller marshalBgpV6EviVxlan - unMarshaller unMarshalBgpV6EviVxlan - broadcastDomainsHolder BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter - routeDistinguisherHolder BgpRouteDistinguisher - routeTargetExportHolder BgpV6EviVxlanBgpRouteTargetIter - routeTargetImportHolder BgpV6EviVxlanBgpRouteTargetIter - l3RouteTargetExportHolder BgpV6EviVxlanBgpRouteTargetIter - l3RouteTargetImportHolder BgpV6EviVxlanBgpRouteTargetIter - advancedHolder BgpRouteAdvanced - communitiesHolder BgpV6EviVxlanBgpCommunityIter - extCommunitiesHolder BgpV6EviVxlanBgpExtCommunityIter - asPathHolder BgpAsPath -} - -func NewBgpV6EviVxlan() BgpV6EviVxlan { - obj := bgpV6EviVxlan{obj: &otg.BgpV6EviVxlan{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV6EviVxlan) msg() *otg.BgpV6EviVxlan { - return obj.obj -} - -func (obj *bgpV6EviVxlan) setMsg(msg *otg.BgpV6EviVxlan) BgpV6EviVxlan { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV6EviVxlan struct { - obj *bgpV6EviVxlan -} - -type marshalBgpV6EviVxlan interface { - // ToProto marshals BgpV6EviVxlan to protobuf object *otg.BgpV6EviVxlan - ToProto() (*otg.BgpV6EviVxlan, error) - // ToPbText marshals BgpV6EviVxlan to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV6EviVxlan to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV6EviVxlan to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV6EviVxlan struct { - obj *bgpV6EviVxlan -} - -type unMarshalBgpV6EviVxlan interface { - // FromProto unmarshals BgpV6EviVxlan from protobuf object *otg.BgpV6EviVxlan - FromProto(msg *otg.BgpV6EviVxlan) (BgpV6EviVxlan, error) - // FromPbText unmarshals BgpV6EviVxlan from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV6EviVxlan from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV6EviVxlan from JSON text - FromJson(value string) error -} - -func (obj *bgpV6EviVxlan) Marshal() marshalBgpV6EviVxlan { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV6EviVxlan{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV6EviVxlan) Unmarshal() unMarshalBgpV6EviVxlan { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV6EviVxlan{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV6EviVxlan) ToProto() (*otg.BgpV6EviVxlan, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV6EviVxlan) FromProto(msg *otg.BgpV6EviVxlan) (BgpV6EviVxlan, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV6EviVxlan) 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 *unMarshalbgpV6EviVxlan) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpV6EviVxlan) 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 *unMarshalbgpV6EviVxlan) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpV6EviVxlan) 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 *unMarshalbgpV6EviVxlan) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpV6EviVxlan) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV6EviVxlan) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV6EviVxlan) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV6EviVxlan) Clone() (BgpV6EviVxlan, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV6EviVxlan() - 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 -} - -func (obj *bgpV6EviVxlan) setNil() { - obj.broadcastDomainsHolder = nil - obj.routeDistinguisherHolder = nil - obj.routeTargetExportHolder = nil - obj.routeTargetImportHolder = nil - obj.l3RouteTargetExportHolder = nil - obj.l3RouteTargetImportHolder = nil - obj.advancedHolder = nil - obj.communitiesHolder = nil - obj.extCommunitiesHolder = nil - obj.asPathHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpV6EviVxlan is configuration for BGP EVPN EVI. Advertises following routes - -// -// # Type 3 - Inclusive Multicast Ethernet Tag Route -// -// Type 1 - Ethernet Auto-discovery Route (Per EVI) -// -// Type 1 - Ethernet Auto-discovery Route (Per ES) -type BgpV6EviVxlan interface { - Validation - // msg marshals BgpV6EviVxlan to protobuf object *otg.BgpV6EviVxlan - // and doesn't set defaults - msg() *otg.BgpV6EviVxlan - // setMsg unmarshals BgpV6EviVxlan from protobuf object *otg.BgpV6EviVxlan - // and doesn't set defaults - setMsg(*otg.BgpV6EviVxlan) BgpV6EviVxlan - // provides marshal interface - Marshal() marshalBgpV6EviVxlan - // provides unmarshal interface - Unmarshal() unMarshalBgpV6EviVxlan - // validate validates BgpV6EviVxlan - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV6EviVxlan, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // BroadcastDomains returns BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIterIter, set in BgpV6EviVxlan - BroadcastDomains() BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter - // ReplicationType returns BgpV6EviVxlanReplicationTypeEnum, set in BgpV6EviVxlan - ReplicationType() BgpV6EviVxlanReplicationTypeEnum - // SetReplicationType assigns BgpV6EviVxlanReplicationTypeEnum provided by user to BgpV6EviVxlan - SetReplicationType(value BgpV6EviVxlanReplicationTypeEnum) BgpV6EviVxlan - // HasReplicationType checks if ReplicationType has been set in BgpV6EviVxlan - HasReplicationType() bool - // PmsiLabel returns uint32, set in BgpV6EviVxlan. - PmsiLabel() uint32 - // SetPmsiLabel assigns uint32 provided by user to BgpV6EviVxlan - SetPmsiLabel(value uint32) BgpV6EviVxlan - // HasPmsiLabel checks if PmsiLabel has been set in BgpV6EviVxlan - HasPmsiLabel() bool - // AdLabel returns uint32, set in BgpV6EviVxlan. - AdLabel() uint32 - // SetAdLabel assigns uint32 provided by user to BgpV6EviVxlan - SetAdLabel(value uint32) BgpV6EviVxlan - // HasAdLabel checks if AdLabel has been set in BgpV6EviVxlan - HasAdLabel() bool - // RouteDistinguisher returns BgpRouteDistinguisher, set in BgpV6EviVxlan. - // BgpRouteDistinguisher is bGP Route Distinguisher. - RouteDistinguisher() BgpRouteDistinguisher - // SetRouteDistinguisher assigns BgpRouteDistinguisher provided by user to BgpV6EviVxlan. - // BgpRouteDistinguisher is bGP Route Distinguisher. - SetRouteDistinguisher(value BgpRouteDistinguisher) BgpV6EviVxlan - // HasRouteDistinguisher checks if RouteDistinguisher has been set in BgpV6EviVxlan - HasRouteDistinguisher() bool - // RouteTargetExport returns BgpV6EviVxlanBgpRouteTargetIterIter, set in BgpV6EviVxlan - RouteTargetExport() BgpV6EviVxlanBgpRouteTargetIter - // RouteTargetImport returns BgpV6EviVxlanBgpRouteTargetIterIter, set in BgpV6EviVxlan - RouteTargetImport() BgpV6EviVxlanBgpRouteTargetIter - // L3RouteTargetExport returns BgpV6EviVxlanBgpRouteTargetIterIter, set in BgpV6EviVxlan - L3RouteTargetExport() BgpV6EviVxlanBgpRouteTargetIter - // L3RouteTargetImport returns BgpV6EviVxlanBgpRouteTargetIterIter, set in BgpV6EviVxlan - L3RouteTargetImport() BgpV6EviVxlanBgpRouteTargetIter - // Advanced returns BgpRouteAdvanced, set in BgpV6EviVxlan. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - Advanced() BgpRouteAdvanced - // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpV6EviVxlan. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - SetAdvanced(value BgpRouteAdvanced) BgpV6EviVxlan - // HasAdvanced checks if Advanced has been set in BgpV6EviVxlan - HasAdvanced() bool - // Communities returns BgpV6EviVxlanBgpCommunityIterIter, set in BgpV6EviVxlan - Communities() BgpV6EviVxlanBgpCommunityIter - // ExtCommunities returns BgpV6EviVxlanBgpExtCommunityIterIter, set in BgpV6EviVxlan - ExtCommunities() BgpV6EviVxlanBgpExtCommunityIter - // AsPath returns BgpAsPath, set in BgpV6EviVxlan. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - AsPath() BgpAsPath - // SetAsPath assigns BgpAsPath provided by user to BgpV6EviVxlan. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - SetAsPath(value BgpAsPath) BgpV6EviVxlan - // HasAsPath checks if AsPath has been set in BgpV6EviVxlan - HasAsPath() bool - setNil() -} - -// This contains the list of Broadcast Domains to be configured per EVI. -// BroadcastDomains returns a []BgpV6EviVxlanBroadcastDomain -func (obj *bgpV6EviVxlan) BroadcastDomains() BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { - if len(obj.obj.BroadcastDomains) == 0 { - obj.obj.BroadcastDomains = []*otg.BgpV6EviVxlanBroadcastDomain{} - } - if obj.broadcastDomainsHolder == nil { - obj.broadcastDomainsHolder = newBgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter(&obj.obj.BroadcastDomains).setMsg(obj) - } - return obj.broadcastDomainsHolder -} - -type bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter struct { - obj *bgpV6EviVxlan - bgpV6EviVxlanBroadcastDomainSlice []BgpV6EviVxlanBroadcastDomain - fieldPtr *[]*otg.BgpV6EviVxlanBroadcastDomain -} - -func newBgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter(ptr *[]*otg.BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { - return &bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter{fieldPtr: ptr} -} - -type BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter interface { - setMsg(*bgpV6EviVxlan) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter - Items() []BgpV6EviVxlanBroadcastDomain - Add() BgpV6EviVxlanBroadcastDomain - Append(items ...BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter - Set(index int, newObj BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter - Clear() BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter - clearHolderSlice() BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter - appendHolderSlice(item BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter -} - -func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) setMsg(msg *bgpV6EviVxlan) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpV6EviVxlanBroadcastDomain{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) Items() []BgpV6EviVxlanBroadcastDomain { - return obj.bgpV6EviVxlanBroadcastDomainSlice -} - -func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) Add() BgpV6EviVxlanBroadcastDomain { - newObj := &otg.BgpV6EviVxlanBroadcastDomain{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpV6EviVxlanBroadcastDomain{obj: newObj} - newLibObj.setDefault() - obj.bgpV6EviVxlanBroadcastDomainSlice = append(obj.bgpV6EviVxlanBroadcastDomainSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) Append(items ...BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpV6EviVxlanBroadcastDomainSlice = append(obj.bgpV6EviVxlanBroadcastDomainSlice, item) - } - return obj -} - -func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) Set(index int, newObj BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpV6EviVxlanBroadcastDomainSlice[index] = newObj - return obj -} -func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) Clear() BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpV6EviVxlanBroadcastDomain{} - obj.bgpV6EviVxlanBroadcastDomainSlice = []BgpV6EviVxlanBroadcastDomain{} - } - return obj -} -func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) clearHolderSlice() BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { - if len(obj.bgpV6EviVxlanBroadcastDomainSlice) > 0 { - obj.bgpV6EviVxlanBroadcastDomainSlice = []BgpV6EviVxlanBroadcastDomain{} - } - return obj -} -func (obj *bgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter) appendHolderSlice(item BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBgpV6EviVxlanBroadcastDomainIter { - obj.bgpV6EviVxlanBroadcastDomainSlice = append(obj.bgpV6EviVxlanBroadcastDomainSlice, item) - return obj -} - -type BgpV6EviVxlanReplicationTypeEnum string - -// Enum of ReplicationType on BgpV6EviVxlan -var BgpV6EviVxlanReplicationType = struct { - INGRESS_REPLICATION BgpV6EviVxlanReplicationTypeEnum -}{ - INGRESS_REPLICATION: BgpV6EviVxlanReplicationTypeEnum("ingress_replication"), -} - -func (obj *bgpV6EviVxlan) ReplicationType() BgpV6EviVxlanReplicationTypeEnum { - return BgpV6EviVxlanReplicationTypeEnum(obj.obj.ReplicationType.Enum().String()) -} - -// This model only supports Ingress Replication -// ReplicationType returns a string -func (obj *bgpV6EviVxlan) HasReplicationType() bool { - return obj.obj.ReplicationType != nil -} - -func (obj *bgpV6EviVxlan) SetReplicationType(value BgpV6EviVxlanReplicationTypeEnum) BgpV6EviVxlan { - intValue, ok := otg.BgpV6EviVxlan_ReplicationType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpV6EviVxlanReplicationTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpV6EviVxlan_ReplicationType_Enum(intValue) - obj.obj.ReplicationType = &enumValue - - return obj -} - -// Downstream assigned VNI to be carried as Part of P-Multicast Service Interface Tunnel attribute (PMSI Tunnel Attribute) in Type 3 Inclusive Multicast Ethernet Tag Route. -// PmsiLabel returns a uint32 -func (obj *bgpV6EviVxlan) PmsiLabel() uint32 { - - return *obj.obj.PmsiLabel - -} - -// Downstream assigned VNI to be carried as Part of P-Multicast Service Interface Tunnel attribute (PMSI Tunnel Attribute) in Type 3 Inclusive Multicast Ethernet Tag Route. -// PmsiLabel returns a uint32 -func (obj *bgpV6EviVxlan) HasPmsiLabel() bool { - return obj.obj.PmsiLabel != nil -} - -// Downstream assigned VNI to be carried as Part of P-Multicast Service Interface Tunnel attribute (PMSI Tunnel Attribute) in Type 3 Inclusive Multicast Ethernet Tag Route. -// SetPmsiLabel sets the uint32 value in the BgpV6EviVxlan object -func (obj *bgpV6EviVxlan) SetPmsiLabel(value uint32) BgpV6EviVxlan { - - obj.obj.PmsiLabel = &value - return obj -} - -// The Auto-discovery Route label (AD label) value, which gets advertised in the Ethernet Auto-discovery Route per -// AdLabel returns a uint32 -func (obj *bgpV6EviVxlan) AdLabel() uint32 { - - return *obj.obj.AdLabel - -} - -// The Auto-discovery Route label (AD label) value, which gets advertised in the Ethernet Auto-discovery Route per -// AdLabel returns a uint32 -func (obj *bgpV6EviVxlan) HasAdLabel() bool { - return obj.obj.AdLabel != nil -} - -// The Auto-discovery Route label (AD label) value, which gets advertised in the Ethernet Auto-discovery Route per -// SetAdLabel sets the uint32 value in the BgpV6EviVxlan object -func (obj *bgpV6EviVxlan) SetAdLabel(value uint32) BgpV6EviVxlan { - - obj.obj.AdLabel = &value - return obj -} - -// Colon separated Extended Community value of 6 Bytes - "AS number: Value" identifying an EVI. Example - for the as_2octet "60005:100". -// RouteDistinguisher returns a BgpRouteDistinguisher -func (obj *bgpV6EviVxlan) RouteDistinguisher() BgpRouteDistinguisher { - if obj.obj.RouteDistinguisher == nil { - obj.obj.RouteDistinguisher = NewBgpRouteDistinguisher().msg() - } - if obj.routeDistinguisherHolder == nil { - obj.routeDistinguisherHolder = &bgpRouteDistinguisher{obj: obj.obj.RouteDistinguisher} - } - return obj.routeDistinguisherHolder -} - -// Colon separated Extended Community value of 6 Bytes - "AS number: Value" identifying an EVI. Example - for the as_2octet "60005:100". -// RouteDistinguisher returns a BgpRouteDistinguisher -func (obj *bgpV6EviVxlan) HasRouteDistinguisher() bool { - return obj.obj.RouteDistinguisher != nil -} - -// Colon separated Extended Community value of 6 Bytes - "AS number: Value" identifying an EVI. Example - for the as_2octet "60005:100". -// SetRouteDistinguisher sets the BgpRouteDistinguisher value in the BgpV6EviVxlan object -func (obj *bgpV6EviVxlan) SetRouteDistinguisher(value BgpRouteDistinguisher) BgpV6EviVxlan { - - obj.routeDistinguisherHolder = nil - obj.obj.RouteDistinguisher = value.msg() - - return obj -} - -// List of Layer 2 Virtual Network Identifier (L2VNI) export targets associated with this EVI. -// RouteTargetExport returns a []BgpRouteTarget -func (obj *bgpV6EviVxlan) RouteTargetExport() BgpV6EviVxlanBgpRouteTargetIter { - if len(obj.obj.RouteTargetExport) == 0 { - obj.obj.RouteTargetExport = []*otg.BgpRouteTarget{} - } - if obj.routeTargetExportHolder == nil { - obj.routeTargetExportHolder = newBgpV6EviVxlanBgpRouteTargetIter(&obj.obj.RouteTargetExport).setMsg(obj) - } - return obj.routeTargetExportHolder -} - -type bgpV6EviVxlanBgpRouteTargetIter struct { - obj *bgpV6EviVxlan - bgpRouteTargetSlice []BgpRouteTarget - fieldPtr *[]*otg.BgpRouteTarget -} - -func newBgpV6EviVxlanBgpRouteTargetIter(ptr *[]*otg.BgpRouteTarget) BgpV6EviVxlanBgpRouteTargetIter { - return &bgpV6EviVxlanBgpRouteTargetIter{fieldPtr: ptr} -} - -type BgpV6EviVxlanBgpRouteTargetIter interface { - setMsg(*bgpV6EviVxlan) BgpV6EviVxlanBgpRouteTargetIter - Items() []BgpRouteTarget - Add() BgpRouteTarget - Append(items ...BgpRouteTarget) BgpV6EviVxlanBgpRouteTargetIter - Set(index int, newObj BgpRouteTarget) BgpV6EviVxlanBgpRouteTargetIter - Clear() BgpV6EviVxlanBgpRouteTargetIter - clearHolderSlice() BgpV6EviVxlanBgpRouteTargetIter - appendHolderSlice(item BgpRouteTarget) BgpV6EviVxlanBgpRouteTargetIter -} - -func (obj *bgpV6EviVxlanBgpRouteTargetIter) setMsg(msg *bgpV6EviVxlan) BgpV6EviVxlanBgpRouteTargetIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpRouteTarget{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6EviVxlanBgpRouteTargetIter) Items() []BgpRouteTarget { - return obj.bgpRouteTargetSlice -} - -func (obj *bgpV6EviVxlanBgpRouteTargetIter) Add() BgpRouteTarget { - newObj := &otg.BgpRouteTarget{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpRouteTarget{obj: newObj} - newLibObj.setDefault() - obj.bgpRouteTargetSlice = append(obj.bgpRouteTargetSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6EviVxlanBgpRouteTargetIter) Append(items ...BgpRouteTarget) BgpV6EviVxlanBgpRouteTargetIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpRouteTargetSlice = append(obj.bgpRouteTargetSlice, item) - } - return obj -} - -func (obj *bgpV6EviVxlanBgpRouteTargetIter) Set(index int, newObj BgpRouteTarget) BgpV6EviVxlanBgpRouteTargetIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpRouteTargetSlice[index] = newObj - return obj -} -func (obj *bgpV6EviVxlanBgpRouteTargetIter) Clear() BgpV6EviVxlanBgpRouteTargetIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpRouteTarget{} - obj.bgpRouteTargetSlice = []BgpRouteTarget{} - } - return obj -} -func (obj *bgpV6EviVxlanBgpRouteTargetIter) clearHolderSlice() BgpV6EviVxlanBgpRouteTargetIter { - if len(obj.bgpRouteTargetSlice) > 0 { - obj.bgpRouteTargetSlice = []BgpRouteTarget{} - } - return obj -} -func (obj *bgpV6EviVxlanBgpRouteTargetIter) appendHolderSlice(item BgpRouteTarget) BgpV6EviVxlanBgpRouteTargetIter { - obj.bgpRouteTargetSlice = append(obj.bgpRouteTargetSlice, item) - return obj -} - -// List of L2VNI import targets associated with this EVI. -// RouteTargetImport returns a []BgpRouteTarget -func (obj *bgpV6EviVxlan) RouteTargetImport() BgpV6EviVxlanBgpRouteTargetIter { - if len(obj.obj.RouteTargetImport) == 0 { - obj.obj.RouteTargetImport = []*otg.BgpRouteTarget{} - } - if obj.routeTargetImportHolder == nil { - obj.routeTargetImportHolder = newBgpV6EviVxlanBgpRouteTargetIter(&obj.obj.RouteTargetImport).setMsg(obj) - } - return obj.routeTargetImportHolder -} - -// List of Layer 3 Virtual Network Identifier (L3VNI) Export Route Targets. -// L3RouteTargetExport returns a []BgpRouteTarget -func (obj *bgpV6EviVxlan) L3RouteTargetExport() BgpV6EviVxlanBgpRouteTargetIter { - if len(obj.obj.L3RouteTargetExport) == 0 { - obj.obj.L3RouteTargetExport = []*otg.BgpRouteTarget{} - } - if obj.l3RouteTargetExportHolder == nil { - obj.l3RouteTargetExportHolder = newBgpV6EviVxlanBgpRouteTargetIter(&obj.obj.L3RouteTargetExport).setMsg(obj) - } - return obj.l3RouteTargetExportHolder -} - -// List of L3VNI Import Route Targets. -// L3RouteTargetImport returns a []BgpRouteTarget -func (obj *bgpV6EviVxlan) L3RouteTargetImport() BgpV6EviVxlanBgpRouteTargetIter { - if len(obj.obj.L3RouteTargetImport) == 0 { - obj.obj.L3RouteTargetImport = []*otg.BgpRouteTarget{} - } - if obj.l3RouteTargetImportHolder == nil { - obj.l3RouteTargetImportHolder = newBgpV6EviVxlanBgpRouteTargetIter(&obj.obj.L3RouteTargetImport).setMsg(obj) - } - return obj.l3RouteTargetImportHolder -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpV6EviVxlan) Advanced() BgpRouteAdvanced { - if obj.obj.Advanced == nil { - obj.obj.Advanced = NewBgpRouteAdvanced().msg() - } - if obj.advancedHolder == nil { - obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} - } - return obj.advancedHolder -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpV6EviVxlan) HasAdvanced() bool { - return obj.obj.Advanced != nil -} - -// description is TBD -// SetAdvanced sets the BgpRouteAdvanced value in the BgpV6EviVxlan object -func (obj *bgpV6EviVxlan) SetAdvanced(value BgpRouteAdvanced) BgpV6EviVxlan { - - obj.advancedHolder = nil - obj.obj.Advanced = value.msg() - - return obj -} - -// Optional community settings. -// Communities returns a []BgpCommunity -func (obj *bgpV6EviVxlan) Communities() BgpV6EviVxlanBgpCommunityIter { - if len(obj.obj.Communities) == 0 { - obj.obj.Communities = []*otg.BgpCommunity{} - } - if obj.communitiesHolder == nil { - obj.communitiesHolder = newBgpV6EviVxlanBgpCommunityIter(&obj.obj.Communities).setMsg(obj) - } - return obj.communitiesHolder -} - -type bgpV6EviVxlanBgpCommunityIter struct { - obj *bgpV6EviVxlan - bgpCommunitySlice []BgpCommunity - fieldPtr *[]*otg.BgpCommunity -} - -func newBgpV6EviVxlanBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpV6EviVxlanBgpCommunityIter { - return &bgpV6EviVxlanBgpCommunityIter{fieldPtr: ptr} -} - -type BgpV6EviVxlanBgpCommunityIter interface { - setMsg(*bgpV6EviVxlan) BgpV6EviVxlanBgpCommunityIter - Items() []BgpCommunity - Add() BgpCommunity - Append(items ...BgpCommunity) BgpV6EviVxlanBgpCommunityIter - Set(index int, newObj BgpCommunity) BgpV6EviVxlanBgpCommunityIter - Clear() BgpV6EviVxlanBgpCommunityIter - clearHolderSlice() BgpV6EviVxlanBgpCommunityIter - appendHolderSlice(item BgpCommunity) BgpV6EviVxlanBgpCommunityIter -} - -func (obj *bgpV6EviVxlanBgpCommunityIter) setMsg(msg *bgpV6EviVxlan) BgpV6EviVxlanBgpCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6EviVxlanBgpCommunityIter) Items() []BgpCommunity { - return obj.bgpCommunitySlice -} - -func (obj *bgpV6EviVxlanBgpCommunityIter) Add() BgpCommunity { - newObj := &otg.BgpCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6EviVxlanBgpCommunityIter) Append(items ...BgpCommunity) BgpV6EviVxlanBgpCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - } - return obj -} - -func (obj *bgpV6EviVxlanBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpV6EviVxlanBgpCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpCommunitySlice[index] = newObj - return obj -} -func (obj *bgpV6EviVxlanBgpCommunityIter) Clear() BgpV6EviVxlanBgpCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpCommunity{} - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpV6EviVxlanBgpCommunityIter) clearHolderSlice() BgpV6EviVxlanBgpCommunityIter { - if len(obj.bgpCommunitySlice) > 0 { - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpV6EviVxlanBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpV6EviVxlanBgpCommunityIter { - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - return obj -} - -// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. -// ExtCommunities returns a []BgpExtCommunity -func (obj *bgpV6EviVxlan) ExtCommunities() BgpV6EviVxlanBgpExtCommunityIter { - if len(obj.obj.ExtCommunities) == 0 { - obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} - } - if obj.extCommunitiesHolder == nil { - obj.extCommunitiesHolder = newBgpV6EviVxlanBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) - } - return obj.extCommunitiesHolder -} - -type bgpV6EviVxlanBgpExtCommunityIter struct { - obj *bgpV6EviVxlan - bgpExtCommunitySlice []BgpExtCommunity - fieldPtr *[]*otg.BgpExtCommunity -} - -func newBgpV6EviVxlanBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpV6EviVxlanBgpExtCommunityIter { - return &bgpV6EviVxlanBgpExtCommunityIter{fieldPtr: ptr} -} - -type BgpV6EviVxlanBgpExtCommunityIter interface { - setMsg(*bgpV6EviVxlan) BgpV6EviVxlanBgpExtCommunityIter - Items() []BgpExtCommunity - Add() BgpExtCommunity - Append(items ...BgpExtCommunity) BgpV6EviVxlanBgpExtCommunityIter - Set(index int, newObj BgpExtCommunity) BgpV6EviVxlanBgpExtCommunityIter - Clear() BgpV6EviVxlanBgpExtCommunityIter - clearHolderSlice() BgpV6EviVxlanBgpExtCommunityIter - appendHolderSlice(item BgpExtCommunity) BgpV6EviVxlanBgpExtCommunityIter -} - -func (obj *bgpV6EviVxlanBgpExtCommunityIter) setMsg(msg *bgpV6EviVxlan) BgpV6EviVxlanBgpExtCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpExtCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6EviVxlanBgpExtCommunityIter) Items() []BgpExtCommunity { - return obj.bgpExtCommunitySlice -} - -func (obj *bgpV6EviVxlanBgpExtCommunityIter) Add() BgpExtCommunity { - newObj := &otg.BgpExtCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpExtCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6EviVxlanBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpV6EviVxlanBgpExtCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - } - return obj -} - -func (obj *bgpV6EviVxlanBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpV6EviVxlanBgpExtCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpExtCommunitySlice[index] = newObj - return obj -} -func (obj *bgpV6EviVxlanBgpExtCommunityIter) Clear() BgpV6EviVxlanBgpExtCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpExtCommunity{} - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpV6EviVxlanBgpExtCommunityIter) clearHolderSlice() BgpV6EviVxlanBgpExtCommunityIter { - if len(obj.bgpExtCommunitySlice) > 0 { - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpV6EviVxlanBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpV6EviVxlanBgpExtCommunityIter { - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - return obj -} - -// Optional AS PATH settings. -// AsPath returns a BgpAsPath -func (obj *bgpV6EviVxlan) AsPath() BgpAsPath { - if obj.obj.AsPath == nil { - obj.obj.AsPath = NewBgpAsPath().msg() - } - if obj.asPathHolder == nil { - obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} - } - return obj.asPathHolder -} - -// Optional AS PATH settings. -// AsPath returns a BgpAsPath -func (obj *bgpV6EviVxlan) HasAsPath() bool { - return obj.obj.AsPath != nil -} - -// Optional AS PATH settings. -// SetAsPath sets the BgpAsPath value in the BgpV6EviVxlan object -func (obj *bgpV6EviVxlan) SetAsPath(value BgpAsPath) BgpV6EviVxlan { - - obj.asPathHolder = nil - obj.obj.AsPath = value.msg() - - return obj -} - -func (obj *bgpV6EviVxlan) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.BroadcastDomains) != 0 { - - if set_default { - obj.BroadcastDomains().clearHolderSlice() - for _, item := range obj.obj.BroadcastDomains { - obj.BroadcastDomains().appendHolderSlice(&bgpV6EviVxlanBroadcastDomain{obj: item}) - } - } - for _, item := range obj.BroadcastDomains().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.PmsiLabel != nil { - - if *obj.obj.PmsiLabel > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpV6EviVxlan.PmsiLabel <= 16777215 but Got %d", *obj.obj.PmsiLabel)) - } - - } - - if obj.obj.AdLabel != nil { - - if *obj.obj.AdLabel > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpV6EviVxlan.AdLabel <= 16777215 but Got %d", *obj.obj.AdLabel)) - } - - } - - if obj.obj.RouteDistinguisher != nil { - - obj.RouteDistinguisher().validateObj(vObj, set_default) - } - - if len(obj.obj.RouteTargetExport) != 0 { - - if set_default { - obj.RouteTargetExport().clearHolderSlice() - for _, item := range obj.obj.RouteTargetExport { - obj.RouteTargetExport().appendHolderSlice(&bgpRouteTarget{obj: item}) - } - } - for _, item := range obj.RouteTargetExport().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.RouteTargetImport) != 0 { - - if set_default { - obj.RouteTargetImport().clearHolderSlice() - for _, item := range obj.obj.RouteTargetImport { - obj.RouteTargetImport().appendHolderSlice(&bgpRouteTarget{obj: item}) - } - } - for _, item := range obj.RouteTargetImport().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.L3RouteTargetExport) != 0 { - - if set_default { - obj.L3RouteTargetExport().clearHolderSlice() - for _, item := range obj.obj.L3RouteTargetExport { - obj.L3RouteTargetExport().appendHolderSlice(&bgpRouteTarget{obj: item}) - } - } - for _, item := range obj.L3RouteTargetExport().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.L3RouteTargetImport) != 0 { - - if set_default { - obj.L3RouteTargetImport().clearHolderSlice() - for _, item := range obj.obj.L3RouteTargetImport { - obj.L3RouteTargetImport().appendHolderSlice(&bgpRouteTarget{obj: item}) - } - } - for _, item := range obj.L3RouteTargetImport().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Advanced != nil { - - obj.Advanced().validateObj(vObj, set_default) - } - - if len(obj.obj.Communities) != 0 { - - if set_default { - obj.Communities().clearHolderSlice() - for _, item := range obj.obj.Communities { - obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) - } - } - for _, item := range obj.Communities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.ExtCommunities) != 0 { - - if set_default { - obj.ExtCommunities().clearHolderSlice() - for _, item := range obj.obj.ExtCommunities { - obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) - } - } - for _, item := range obj.ExtCommunities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.AsPath != nil { - - obj.AsPath().validateObj(vObj, set_default) - } - -} - -func (obj *bgpV6EviVxlan) setDefault() { - if obj.obj.ReplicationType == nil { - obj.SetReplicationType(BgpV6EviVxlanReplicationType.INGRESS_REPLICATION) - - } - if obj.obj.PmsiLabel == nil { - obj.SetPmsiLabel(16) - } - if obj.obj.AdLabel == nil { - obj.SetAdLabel(0) - } - -} - -// ***** VxlanTunnelDestinationIPModeUnicastArpSuppressionCache ***** -type vxlanTunnelDestinationIPModeUnicastArpSuppressionCache struct { - validation - obj *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - marshaller marshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache - unMarshaller unMarshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache -} - -func NewVxlanTunnelDestinationIPModeUnicastArpSuppressionCache() VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { - obj := vxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: &otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{}} - obj.setDefault() - return &obj -} - -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) msg() *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { - return obj.obj -} - -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) setMsg(msg *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache struct { - obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache -} - -type marshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache interface { - // ToProto marshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache to protobuf object *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - ToProto() (*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache, error) - // ToPbText marshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache to protobuf text - ToPbText() (string, error) - // ToYaml marshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache to YAML text - ToYaml() (string, error) - // ToJson marshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache to JSON text - ToJson() (string, error) -} - -type unMarshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache struct { - obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache -} - -type unMarshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache interface { - // FromProto unmarshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache from protobuf object *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - FromProto(msg *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) (VxlanTunnelDestinationIPModeUnicastArpSuppressionCache, error) - // FromPbText unmarshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache from protobuf text - FromPbText(value string) error - // FromYaml unmarshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache from YAML text - FromYaml(value string) error - // FromJson unmarshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache from JSON text - FromJson(value string) error -} - -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) Marshal() marshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache { - if obj.marshaller == nil { - obj.marshaller = &marshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: obj} - } - return obj.marshaller -} - -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) Unmarshal() unMarshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) ToProto() (*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) FromProto(msg *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) (VxlanTunnelDestinationIPModeUnicastArpSuppressionCache, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) 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 *unMarshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) 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 *marshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) 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 *unMarshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) 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 *marshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) 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 *unMarshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) 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 *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) Clone() (VxlanTunnelDestinationIPModeUnicastArpSuppressionCache, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewVxlanTunnelDestinationIPModeUnicastArpSuppressionCache() - 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 -} - -// VxlanTunnelDestinationIPModeUnicastArpSuppressionCache is each VTEP maintains an ARP suppression cache table for known IP hosts and their associated MAC addresses in the VNI segment. When an end host in the VNI sends an ARP request for another end-host IP address, its local VTEP intercepts the ARP request and checks for the ARP-resolved IP address in its ARP suppression cache table. If it finds a match, the local VTEP sends an ARP response on behalf of the remote end host. -type VxlanTunnelDestinationIPModeUnicastArpSuppressionCache interface { - Validation - // msg marshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache to protobuf object *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - // and doesn't set defaults - msg() *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - // setMsg unmarshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache from protobuf object *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - // and doesn't set defaults - setMsg(*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - // provides marshal interface - Marshal() marshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache - // provides unmarshal interface - Unmarshal() unMarshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache - // validate validates VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - validate() error - // A stringer function - String() string - // Clones the object - Clone() (VxlanTunnelDestinationIPModeUnicastArpSuppressionCache, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RemoteVmMac returns string, set in VxlanTunnelDestinationIPModeUnicastArpSuppressionCache. - RemoteVmMac() string - // SetRemoteVmMac assigns string provided by user to VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - SetRemoteVmMac(value string) VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - // HasRemoteVmMac checks if RemoteVmMac has been set in VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - HasRemoteVmMac() bool - // RemoteVmIpv4 returns string, set in VxlanTunnelDestinationIPModeUnicastArpSuppressionCache. - RemoteVmIpv4() string - // SetRemoteVmIpv4 assigns string provided by user to VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - SetRemoteVmIpv4(value string) VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - // HasRemoteVmIpv4 checks if RemoteVmIpv4 has been set in VxlanTunnelDestinationIPModeUnicastArpSuppressionCache - HasRemoteVmIpv4() bool -} - -// Remote VM MAC address bound to Remote VM IPv4 address -// RemoteVmMac returns a string -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) RemoteVmMac() string { - - return *obj.obj.RemoteVmMac - -} - -// Remote VM MAC address bound to Remote VM IPv4 address -// RemoteVmMac returns a string -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) HasRemoteVmMac() bool { - return obj.obj.RemoteVmMac != nil -} - -// Remote VM MAC address bound to Remote VM IPv4 address -// SetRemoteVmMac sets the string value in the VxlanTunnelDestinationIPModeUnicastArpSuppressionCache object -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) SetRemoteVmMac(value string) VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { - - obj.obj.RemoteVmMac = &value - return obj -} - -// Remote VM IPv4 address -// RemoteVmIpv4 returns a string -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) RemoteVmIpv4() string { - - return *obj.obj.RemoteVmIpv4 - -} - -// Remote VM IPv4 address -// RemoteVmIpv4 returns a string -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) HasRemoteVmIpv4() bool { - return obj.obj.RemoteVmIpv4 != nil -} - -// Remote VM IPv4 address -// SetRemoteVmIpv4 sets the string value in the VxlanTunnelDestinationIPModeUnicastArpSuppressionCache object -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) SetRemoteVmIpv4(value string) VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { - - obj.obj.RemoteVmIpv4 = &value - return obj -} - -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RemoteVmMac != nil { - - err := obj.validateMac(obj.RemoteVmMac()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on VxlanTunnelDestinationIPModeUnicastArpSuppressionCache.RemoteVmMac")) - } - - } - - if obj.obj.RemoteVmIpv4 != nil { - - err := obj.validateIpv4(obj.RemoteVmIpv4()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on VxlanTunnelDestinationIPModeUnicastArpSuppressionCache.RemoteVmIpv4")) - } - - } - -} - -func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) setDefault() { - -} - -// ***** PatternFlowIpv4TosPrecedenceCounter ***** -type patternFlowIpv4TosPrecedenceCounter struct { - validation - obj *otg.PatternFlowIpv4TosPrecedenceCounter - marshaller marshalPatternFlowIpv4TosPrecedenceCounter - unMarshaller unMarshalPatternFlowIpv4TosPrecedenceCounter -} - -func NewPatternFlowIpv4TosPrecedenceCounter() PatternFlowIpv4TosPrecedenceCounter { - obj := patternFlowIpv4TosPrecedenceCounter{obj: &otg.PatternFlowIpv4TosPrecedenceCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosPrecedenceCounter) msg() *otg.PatternFlowIpv4TosPrecedenceCounter { - return obj.obj -} - -func (obj *patternFlowIpv4TosPrecedenceCounter) setMsg(msg *otg.PatternFlowIpv4TosPrecedenceCounter) PatternFlowIpv4TosPrecedenceCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosPrecedenceCounter struct { - obj *patternFlowIpv4TosPrecedenceCounter -} - -type marshalPatternFlowIpv4TosPrecedenceCounter interface { - // ToProto marshals PatternFlowIpv4TosPrecedenceCounter to protobuf object *otg.PatternFlowIpv4TosPrecedenceCounter - ToProto() (*otg.PatternFlowIpv4TosPrecedenceCounter, error) - // ToPbText marshals PatternFlowIpv4TosPrecedenceCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosPrecedenceCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosPrecedenceCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosPrecedenceCounter struct { - obj *patternFlowIpv4TosPrecedenceCounter -} - -type unMarshalPatternFlowIpv4TosPrecedenceCounter interface { - // FromProto unmarshals PatternFlowIpv4TosPrecedenceCounter from protobuf object *otg.PatternFlowIpv4TosPrecedenceCounter - FromProto(msg *otg.PatternFlowIpv4TosPrecedenceCounter) (PatternFlowIpv4TosPrecedenceCounter, error) - // FromPbText unmarshals PatternFlowIpv4TosPrecedenceCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosPrecedenceCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosPrecedenceCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosPrecedenceCounter) Marshal() marshalPatternFlowIpv4TosPrecedenceCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosPrecedenceCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosPrecedenceCounter) Unmarshal() unMarshalPatternFlowIpv4TosPrecedenceCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosPrecedenceCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosPrecedenceCounter) ToProto() (*otg.PatternFlowIpv4TosPrecedenceCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosPrecedenceCounter) FromProto(msg *otg.PatternFlowIpv4TosPrecedenceCounter) (PatternFlowIpv4TosPrecedenceCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosPrecedenceCounter) 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 *unMarshalpatternFlowIpv4TosPrecedenceCounter) 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 *marshalpatternFlowIpv4TosPrecedenceCounter) 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 *unMarshalpatternFlowIpv4TosPrecedenceCounter) 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 *marshalpatternFlowIpv4TosPrecedenceCounter) 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 *unMarshalpatternFlowIpv4TosPrecedenceCounter) 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 *patternFlowIpv4TosPrecedenceCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosPrecedenceCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosPrecedenceCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosPrecedenceCounter) Clone() (PatternFlowIpv4TosPrecedenceCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosPrecedenceCounter() - 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 -} - -// PatternFlowIpv4TosPrecedenceCounter is integer counter pattern -type PatternFlowIpv4TosPrecedenceCounter interface { - Validation - // msg marshals PatternFlowIpv4TosPrecedenceCounter to protobuf object *otg.PatternFlowIpv4TosPrecedenceCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosPrecedenceCounter - // setMsg unmarshals PatternFlowIpv4TosPrecedenceCounter from protobuf object *otg.PatternFlowIpv4TosPrecedenceCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosPrecedenceCounter) PatternFlowIpv4TosPrecedenceCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosPrecedenceCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosPrecedenceCounter - // validate validates PatternFlowIpv4TosPrecedenceCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosPrecedenceCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4TosPrecedenceCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4TosPrecedenceCounter - SetStart(value uint32) PatternFlowIpv4TosPrecedenceCounter - // HasStart checks if Start has been set in PatternFlowIpv4TosPrecedenceCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4TosPrecedenceCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4TosPrecedenceCounter - SetStep(value uint32) PatternFlowIpv4TosPrecedenceCounter - // HasStep checks if Step has been set in PatternFlowIpv4TosPrecedenceCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4TosPrecedenceCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4TosPrecedenceCounter - SetCount(value uint32) PatternFlowIpv4TosPrecedenceCounter - // HasCount checks if Count has been set in PatternFlowIpv4TosPrecedenceCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TosPrecedenceCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TosPrecedenceCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4TosPrecedenceCounter object -func (obj *patternFlowIpv4TosPrecedenceCounter) SetStart(value uint32) PatternFlowIpv4TosPrecedenceCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TosPrecedenceCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TosPrecedenceCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4TosPrecedenceCounter object -func (obj *patternFlowIpv4TosPrecedenceCounter) SetStep(value uint32) PatternFlowIpv4TosPrecedenceCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TosPrecedenceCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TosPrecedenceCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4TosPrecedenceCounter object -func (obj *patternFlowIpv4TosPrecedenceCounter) SetCount(value uint32) PatternFlowIpv4TosPrecedenceCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4TosPrecedenceCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosPrecedenceCounter.Start <= 7 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosPrecedenceCounter.Step <= 7 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosPrecedenceCounter.Count <= 7 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4TosPrecedenceCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4TosPrecedenceMetricTag ***** -type patternFlowIpv4TosPrecedenceMetricTag struct { - validation - obj *otg.PatternFlowIpv4TosPrecedenceMetricTag - marshaller marshalPatternFlowIpv4TosPrecedenceMetricTag - unMarshaller unMarshalPatternFlowIpv4TosPrecedenceMetricTag -} - -func NewPatternFlowIpv4TosPrecedenceMetricTag() PatternFlowIpv4TosPrecedenceMetricTag { - obj := patternFlowIpv4TosPrecedenceMetricTag{obj: &otg.PatternFlowIpv4TosPrecedenceMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosPrecedenceMetricTag) msg() *otg.PatternFlowIpv4TosPrecedenceMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4TosPrecedenceMetricTag) setMsg(msg *otg.PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedenceMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosPrecedenceMetricTag struct { - obj *patternFlowIpv4TosPrecedenceMetricTag -} - -type marshalPatternFlowIpv4TosPrecedenceMetricTag interface { - // ToProto marshals PatternFlowIpv4TosPrecedenceMetricTag to protobuf object *otg.PatternFlowIpv4TosPrecedenceMetricTag - ToProto() (*otg.PatternFlowIpv4TosPrecedenceMetricTag, error) - // ToPbText marshals PatternFlowIpv4TosPrecedenceMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosPrecedenceMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosPrecedenceMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosPrecedenceMetricTag struct { - obj *patternFlowIpv4TosPrecedenceMetricTag -} - -type unMarshalPatternFlowIpv4TosPrecedenceMetricTag interface { - // FromProto unmarshals PatternFlowIpv4TosPrecedenceMetricTag from protobuf object *otg.PatternFlowIpv4TosPrecedenceMetricTag - FromProto(msg *otg.PatternFlowIpv4TosPrecedenceMetricTag) (PatternFlowIpv4TosPrecedenceMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4TosPrecedenceMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosPrecedenceMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosPrecedenceMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosPrecedenceMetricTag) Marshal() marshalPatternFlowIpv4TosPrecedenceMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosPrecedenceMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosPrecedenceMetricTag) Unmarshal() unMarshalPatternFlowIpv4TosPrecedenceMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosPrecedenceMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosPrecedenceMetricTag) ToProto() (*otg.PatternFlowIpv4TosPrecedenceMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosPrecedenceMetricTag) FromProto(msg *otg.PatternFlowIpv4TosPrecedenceMetricTag) (PatternFlowIpv4TosPrecedenceMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosPrecedenceMetricTag) 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 *unMarshalpatternFlowIpv4TosPrecedenceMetricTag) 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 *marshalpatternFlowIpv4TosPrecedenceMetricTag) 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 *unMarshalpatternFlowIpv4TosPrecedenceMetricTag) 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 *marshalpatternFlowIpv4TosPrecedenceMetricTag) 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 *unMarshalpatternFlowIpv4TosPrecedenceMetricTag) 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 *patternFlowIpv4TosPrecedenceMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosPrecedenceMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosPrecedenceMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosPrecedenceMetricTag) Clone() (PatternFlowIpv4TosPrecedenceMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosPrecedenceMetricTag() - 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 -} - -// PatternFlowIpv4TosPrecedenceMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4TosPrecedenceMetricTag interface { - Validation - // msg marshals PatternFlowIpv4TosPrecedenceMetricTag to protobuf object *otg.PatternFlowIpv4TosPrecedenceMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosPrecedenceMetricTag - // setMsg unmarshals PatternFlowIpv4TosPrecedenceMetricTag from protobuf object *otg.PatternFlowIpv4TosPrecedenceMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedenceMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosPrecedenceMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosPrecedenceMetricTag - // validate validates PatternFlowIpv4TosPrecedenceMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosPrecedenceMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4TosPrecedenceMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4TosPrecedenceMetricTag - SetName(value string) PatternFlowIpv4TosPrecedenceMetricTag - // Offset returns uint32, set in PatternFlowIpv4TosPrecedenceMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4TosPrecedenceMetricTag - SetOffset(value uint32) PatternFlowIpv4TosPrecedenceMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4TosPrecedenceMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4TosPrecedenceMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4TosPrecedenceMetricTag - SetLength(value uint32) PatternFlowIpv4TosPrecedenceMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4TosPrecedenceMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4TosPrecedenceMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4TosPrecedenceMetricTag object -func (obj *patternFlowIpv4TosPrecedenceMetricTag) SetName(value string) PatternFlowIpv4TosPrecedenceMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TosPrecedenceMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TosPrecedenceMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4TosPrecedenceMetricTag object -func (obj *patternFlowIpv4TosPrecedenceMetricTag) SetOffset(value uint32) PatternFlowIpv4TosPrecedenceMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TosPrecedenceMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TosPrecedenceMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4TosPrecedenceMetricTag object -func (obj *patternFlowIpv4TosPrecedenceMetricTag) SetLength(value uint32) PatternFlowIpv4TosPrecedenceMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4TosPrecedenceMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TosPrecedenceMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 2 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosPrecedenceMetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4TosPrecedenceMetricTag.Length <= 3 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4TosPrecedenceMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(3) - } - -} - -// ***** PatternFlowIpv4TosDelayCounter ***** -type patternFlowIpv4TosDelayCounter struct { - validation - obj *otg.PatternFlowIpv4TosDelayCounter - marshaller marshalPatternFlowIpv4TosDelayCounter - unMarshaller unMarshalPatternFlowIpv4TosDelayCounter -} - -func NewPatternFlowIpv4TosDelayCounter() PatternFlowIpv4TosDelayCounter { - obj := patternFlowIpv4TosDelayCounter{obj: &otg.PatternFlowIpv4TosDelayCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosDelayCounter) msg() *otg.PatternFlowIpv4TosDelayCounter { - return obj.obj -} - -func (obj *patternFlowIpv4TosDelayCounter) setMsg(msg *otg.PatternFlowIpv4TosDelayCounter) PatternFlowIpv4TosDelayCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosDelayCounter struct { - obj *patternFlowIpv4TosDelayCounter -} - -type marshalPatternFlowIpv4TosDelayCounter interface { - // ToProto marshals PatternFlowIpv4TosDelayCounter to protobuf object *otg.PatternFlowIpv4TosDelayCounter - ToProto() (*otg.PatternFlowIpv4TosDelayCounter, error) - // ToPbText marshals PatternFlowIpv4TosDelayCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosDelayCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosDelayCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosDelayCounter struct { - obj *patternFlowIpv4TosDelayCounter -} - -type unMarshalPatternFlowIpv4TosDelayCounter interface { - // FromProto unmarshals PatternFlowIpv4TosDelayCounter from protobuf object *otg.PatternFlowIpv4TosDelayCounter - FromProto(msg *otg.PatternFlowIpv4TosDelayCounter) (PatternFlowIpv4TosDelayCounter, error) - // FromPbText unmarshals PatternFlowIpv4TosDelayCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosDelayCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosDelayCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosDelayCounter) Marshal() marshalPatternFlowIpv4TosDelayCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosDelayCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosDelayCounter) Unmarshal() unMarshalPatternFlowIpv4TosDelayCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosDelayCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosDelayCounter) ToProto() (*otg.PatternFlowIpv4TosDelayCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosDelayCounter) FromProto(msg *otg.PatternFlowIpv4TosDelayCounter) (PatternFlowIpv4TosDelayCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosDelayCounter) 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 *unMarshalpatternFlowIpv4TosDelayCounter) 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 *marshalpatternFlowIpv4TosDelayCounter) 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 *unMarshalpatternFlowIpv4TosDelayCounter) 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 *marshalpatternFlowIpv4TosDelayCounter) 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 *unMarshalpatternFlowIpv4TosDelayCounter) 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 *patternFlowIpv4TosDelayCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosDelayCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosDelayCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosDelayCounter) Clone() (PatternFlowIpv4TosDelayCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosDelayCounter() - 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 -} - -// PatternFlowIpv4TosDelayCounter is integer counter pattern -type PatternFlowIpv4TosDelayCounter interface { - Validation - // msg marshals PatternFlowIpv4TosDelayCounter to protobuf object *otg.PatternFlowIpv4TosDelayCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosDelayCounter - // setMsg unmarshals PatternFlowIpv4TosDelayCounter from protobuf object *otg.PatternFlowIpv4TosDelayCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosDelayCounter) PatternFlowIpv4TosDelayCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosDelayCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosDelayCounter - // validate validates PatternFlowIpv4TosDelayCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosDelayCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4TosDelayCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4TosDelayCounter - SetStart(value uint32) PatternFlowIpv4TosDelayCounter - // HasStart checks if Start has been set in PatternFlowIpv4TosDelayCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4TosDelayCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4TosDelayCounter - SetStep(value uint32) PatternFlowIpv4TosDelayCounter - // HasStep checks if Step has been set in PatternFlowIpv4TosDelayCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4TosDelayCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4TosDelayCounter - SetCount(value uint32) PatternFlowIpv4TosDelayCounter - // HasCount checks if Count has been set in PatternFlowIpv4TosDelayCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TosDelayCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TosDelayCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4TosDelayCounter object -func (obj *patternFlowIpv4TosDelayCounter) SetStart(value uint32) PatternFlowIpv4TosDelayCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TosDelayCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TosDelayCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4TosDelayCounter object -func (obj *patternFlowIpv4TosDelayCounter) SetStep(value uint32) PatternFlowIpv4TosDelayCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TosDelayCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TosDelayCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4TosDelayCounter object -func (obj *patternFlowIpv4TosDelayCounter) SetCount(value uint32) PatternFlowIpv4TosDelayCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4TosDelayCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosDelayCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosDelayCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosDelayCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4TosDelayCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4TosDelayMetricTag ***** -type patternFlowIpv4TosDelayMetricTag struct { - validation - obj *otg.PatternFlowIpv4TosDelayMetricTag - marshaller marshalPatternFlowIpv4TosDelayMetricTag - unMarshaller unMarshalPatternFlowIpv4TosDelayMetricTag -} - -func NewPatternFlowIpv4TosDelayMetricTag() PatternFlowIpv4TosDelayMetricTag { - obj := patternFlowIpv4TosDelayMetricTag{obj: &otg.PatternFlowIpv4TosDelayMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosDelayMetricTag) msg() *otg.PatternFlowIpv4TosDelayMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4TosDelayMetricTag) setMsg(msg *otg.PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosDelayMetricTag struct { - obj *patternFlowIpv4TosDelayMetricTag -} - -type marshalPatternFlowIpv4TosDelayMetricTag interface { - // ToProto marshals PatternFlowIpv4TosDelayMetricTag to protobuf object *otg.PatternFlowIpv4TosDelayMetricTag - ToProto() (*otg.PatternFlowIpv4TosDelayMetricTag, error) - // ToPbText marshals PatternFlowIpv4TosDelayMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosDelayMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosDelayMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosDelayMetricTag struct { - obj *patternFlowIpv4TosDelayMetricTag -} - -type unMarshalPatternFlowIpv4TosDelayMetricTag interface { - // FromProto unmarshals PatternFlowIpv4TosDelayMetricTag from protobuf object *otg.PatternFlowIpv4TosDelayMetricTag - FromProto(msg *otg.PatternFlowIpv4TosDelayMetricTag) (PatternFlowIpv4TosDelayMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4TosDelayMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosDelayMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosDelayMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosDelayMetricTag) Marshal() marshalPatternFlowIpv4TosDelayMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosDelayMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosDelayMetricTag) Unmarshal() unMarshalPatternFlowIpv4TosDelayMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosDelayMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosDelayMetricTag) ToProto() (*otg.PatternFlowIpv4TosDelayMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosDelayMetricTag) FromProto(msg *otg.PatternFlowIpv4TosDelayMetricTag) (PatternFlowIpv4TosDelayMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosDelayMetricTag) 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 *unMarshalpatternFlowIpv4TosDelayMetricTag) 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 *marshalpatternFlowIpv4TosDelayMetricTag) 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 *unMarshalpatternFlowIpv4TosDelayMetricTag) 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 *marshalpatternFlowIpv4TosDelayMetricTag) 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 *unMarshalpatternFlowIpv4TosDelayMetricTag) 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 *patternFlowIpv4TosDelayMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosDelayMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosDelayMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosDelayMetricTag) Clone() (PatternFlowIpv4TosDelayMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosDelayMetricTag() - 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 -} - -// PatternFlowIpv4TosDelayMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4TosDelayMetricTag interface { - Validation - // msg marshals PatternFlowIpv4TosDelayMetricTag to protobuf object *otg.PatternFlowIpv4TosDelayMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosDelayMetricTag - // setMsg unmarshals PatternFlowIpv4TosDelayMetricTag from protobuf object *otg.PatternFlowIpv4TosDelayMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosDelayMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosDelayMetricTag - // validate validates PatternFlowIpv4TosDelayMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosDelayMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4TosDelayMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4TosDelayMetricTag - SetName(value string) PatternFlowIpv4TosDelayMetricTag - // Offset returns uint32, set in PatternFlowIpv4TosDelayMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4TosDelayMetricTag - SetOffset(value uint32) PatternFlowIpv4TosDelayMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4TosDelayMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4TosDelayMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4TosDelayMetricTag - SetLength(value uint32) PatternFlowIpv4TosDelayMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4TosDelayMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4TosDelayMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4TosDelayMetricTag object -func (obj *patternFlowIpv4TosDelayMetricTag) SetName(value string) PatternFlowIpv4TosDelayMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TosDelayMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TosDelayMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4TosDelayMetricTag object -func (obj *patternFlowIpv4TosDelayMetricTag) SetOffset(value uint32) PatternFlowIpv4TosDelayMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TosDelayMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TosDelayMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4TosDelayMetricTag object -func (obj *patternFlowIpv4TosDelayMetricTag) SetLength(value uint32) PatternFlowIpv4TosDelayMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4TosDelayMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TosDelayMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosDelayMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4TosDelayMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4TosDelayMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowIpv4TosThroughputCounter ***** -type patternFlowIpv4TosThroughputCounter struct { - validation - obj *otg.PatternFlowIpv4TosThroughputCounter - marshaller marshalPatternFlowIpv4TosThroughputCounter - unMarshaller unMarshalPatternFlowIpv4TosThroughputCounter -} - -func NewPatternFlowIpv4TosThroughputCounter() PatternFlowIpv4TosThroughputCounter { - obj := patternFlowIpv4TosThroughputCounter{obj: &otg.PatternFlowIpv4TosThroughputCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosThroughputCounter) msg() *otg.PatternFlowIpv4TosThroughputCounter { - return obj.obj -} - -func (obj *patternFlowIpv4TosThroughputCounter) setMsg(msg *otg.PatternFlowIpv4TosThroughputCounter) PatternFlowIpv4TosThroughputCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosThroughputCounter struct { - obj *patternFlowIpv4TosThroughputCounter -} - -type marshalPatternFlowIpv4TosThroughputCounter interface { - // ToProto marshals PatternFlowIpv4TosThroughputCounter to protobuf object *otg.PatternFlowIpv4TosThroughputCounter - ToProto() (*otg.PatternFlowIpv4TosThroughputCounter, error) - // ToPbText marshals PatternFlowIpv4TosThroughputCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosThroughputCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosThroughputCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosThroughputCounter struct { - obj *patternFlowIpv4TosThroughputCounter -} - -type unMarshalPatternFlowIpv4TosThroughputCounter interface { - // FromProto unmarshals PatternFlowIpv4TosThroughputCounter from protobuf object *otg.PatternFlowIpv4TosThroughputCounter - FromProto(msg *otg.PatternFlowIpv4TosThroughputCounter) (PatternFlowIpv4TosThroughputCounter, error) - // FromPbText unmarshals PatternFlowIpv4TosThroughputCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosThroughputCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosThroughputCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosThroughputCounter) Marshal() marshalPatternFlowIpv4TosThroughputCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosThroughputCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosThroughputCounter) Unmarshal() unMarshalPatternFlowIpv4TosThroughputCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosThroughputCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosThroughputCounter) ToProto() (*otg.PatternFlowIpv4TosThroughputCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosThroughputCounter) FromProto(msg *otg.PatternFlowIpv4TosThroughputCounter) (PatternFlowIpv4TosThroughputCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosThroughputCounter) 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 *unMarshalpatternFlowIpv4TosThroughputCounter) 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 *marshalpatternFlowIpv4TosThroughputCounter) 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 *unMarshalpatternFlowIpv4TosThroughputCounter) 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 *marshalpatternFlowIpv4TosThroughputCounter) 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 *unMarshalpatternFlowIpv4TosThroughputCounter) 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 *patternFlowIpv4TosThroughputCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosThroughputCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosThroughputCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosThroughputCounter) Clone() (PatternFlowIpv4TosThroughputCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosThroughputCounter() - 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 -} - -// PatternFlowIpv4TosThroughputCounter is integer counter pattern -type PatternFlowIpv4TosThroughputCounter interface { - Validation - // msg marshals PatternFlowIpv4TosThroughputCounter to protobuf object *otg.PatternFlowIpv4TosThroughputCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosThroughputCounter - // setMsg unmarshals PatternFlowIpv4TosThroughputCounter from protobuf object *otg.PatternFlowIpv4TosThroughputCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosThroughputCounter) PatternFlowIpv4TosThroughputCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosThroughputCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosThroughputCounter - // validate validates PatternFlowIpv4TosThroughputCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosThroughputCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4TosThroughputCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4TosThroughputCounter - SetStart(value uint32) PatternFlowIpv4TosThroughputCounter - // HasStart checks if Start has been set in PatternFlowIpv4TosThroughputCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4TosThroughputCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4TosThroughputCounter - SetStep(value uint32) PatternFlowIpv4TosThroughputCounter - // HasStep checks if Step has been set in PatternFlowIpv4TosThroughputCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4TosThroughputCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4TosThroughputCounter - SetCount(value uint32) PatternFlowIpv4TosThroughputCounter - // HasCount checks if Count has been set in PatternFlowIpv4TosThroughputCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TosThroughputCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TosThroughputCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4TosThroughputCounter object -func (obj *patternFlowIpv4TosThroughputCounter) SetStart(value uint32) PatternFlowIpv4TosThroughputCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TosThroughputCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TosThroughputCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4TosThroughputCounter object -func (obj *patternFlowIpv4TosThroughputCounter) SetStep(value uint32) PatternFlowIpv4TosThroughputCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TosThroughputCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TosThroughputCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4TosThroughputCounter object -func (obj *patternFlowIpv4TosThroughputCounter) SetCount(value uint32) PatternFlowIpv4TosThroughputCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4TosThroughputCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosThroughputCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosThroughputCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosThroughputCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4TosThroughputCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4TosThroughputMetricTag ***** -type patternFlowIpv4TosThroughputMetricTag struct { - validation - obj *otg.PatternFlowIpv4TosThroughputMetricTag - marshaller marshalPatternFlowIpv4TosThroughputMetricTag - unMarshaller unMarshalPatternFlowIpv4TosThroughputMetricTag -} - -func NewPatternFlowIpv4TosThroughputMetricTag() PatternFlowIpv4TosThroughputMetricTag { - obj := patternFlowIpv4TosThroughputMetricTag{obj: &otg.PatternFlowIpv4TosThroughputMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosThroughputMetricTag) msg() *otg.PatternFlowIpv4TosThroughputMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4TosThroughputMetricTag) setMsg(msg *otg.PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosThroughputMetricTag struct { - obj *patternFlowIpv4TosThroughputMetricTag -} - -type marshalPatternFlowIpv4TosThroughputMetricTag interface { - // ToProto marshals PatternFlowIpv4TosThroughputMetricTag to protobuf object *otg.PatternFlowIpv4TosThroughputMetricTag - ToProto() (*otg.PatternFlowIpv4TosThroughputMetricTag, error) - // ToPbText marshals PatternFlowIpv4TosThroughputMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosThroughputMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosThroughputMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosThroughputMetricTag struct { - obj *patternFlowIpv4TosThroughputMetricTag -} - -type unMarshalPatternFlowIpv4TosThroughputMetricTag interface { - // FromProto unmarshals PatternFlowIpv4TosThroughputMetricTag from protobuf object *otg.PatternFlowIpv4TosThroughputMetricTag - FromProto(msg *otg.PatternFlowIpv4TosThroughputMetricTag) (PatternFlowIpv4TosThroughputMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4TosThroughputMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosThroughputMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosThroughputMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosThroughputMetricTag) Marshal() marshalPatternFlowIpv4TosThroughputMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosThroughputMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosThroughputMetricTag) Unmarshal() unMarshalPatternFlowIpv4TosThroughputMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosThroughputMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosThroughputMetricTag) ToProto() (*otg.PatternFlowIpv4TosThroughputMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosThroughputMetricTag) FromProto(msg *otg.PatternFlowIpv4TosThroughputMetricTag) (PatternFlowIpv4TosThroughputMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosThroughputMetricTag) 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 *unMarshalpatternFlowIpv4TosThroughputMetricTag) 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 *marshalpatternFlowIpv4TosThroughputMetricTag) 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 *unMarshalpatternFlowIpv4TosThroughputMetricTag) 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 *marshalpatternFlowIpv4TosThroughputMetricTag) 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 *unMarshalpatternFlowIpv4TosThroughputMetricTag) 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 *patternFlowIpv4TosThroughputMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosThroughputMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosThroughputMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosThroughputMetricTag) Clone() (PatternFlowIpv4TosThroughputMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosThroughputMetricTag() - 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 -} - -// PatternFlowIpv4TosThroughputMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4TosThroughputMetricTag interface { - Validation - // msg marshals PatternFlowIpv4TosThroughputMetricTag to protobuf object *otg.PatternFlowIpv4TosThroughputMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosThroughputMetricTag - // setMsg unmarshals PatternFlowIpv4TosThroughputMetricTag from protobuf object *otg.PatternFlowIpv4TosThroughputMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosThroughputMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosThroughputMetricTag - // validate validates PatternFlowIpv4TosThroughputMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosThroughputMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4TosThroughputMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4TosThroughputMetricTag - SetName(value string) PatternFlowIpv4TosThroughputMetricTag - // Offset returns uint32, set in PatternFlowIpv4TosThroughputMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4TosThroughputMetricTag - SetOffset(value uint32) PatternFlowIpv4TosThroughputMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4TosThroughputMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4TosThroughputMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4TosThroughputMetricTag - SetLength(value uint32) PatternFlowIpv4TosThroughputMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4TosThroughputMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4TosThroughputMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4TosThroughputMetricTag object -func (obj *patternFlowIpv4TosThroughputMetricTag) SetName(value string) PatternFlowIpv4TosThroughputMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TosThroughputMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TosThroughputMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4TosThroughputMetricTag object -func (obj *patternFlowIpv4TosThroughputMetricTag) SetOffset(value uint32) PatternFlowIpv4TosThroughputMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TosThroughputMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TosThroughputMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4TosThroughputMetricTag object -func (obj *patternFlowIpv4TosThroughputMetricTag) SetLength(value uint32) PatternFlowIpv4TosThroughputMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4TosThroughputMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TosThroughputMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosThroughputMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4TosThroughputMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4TosThroughputMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowIpv4TosReliabilityCounter ***** -type patternFlowIpv4TosReliabilityCounter struct { - validation - obj *otg.PatternFlowIpv4TosReliabilityCounter - marshaller marshalPatternFlowIpv4TosReliabilityCounter - unMarshaller unMarshalPatternFlowIpv4TosReliabilityCounter -} - -func NewPatternFlowIpv4TosReliabilityCounter() PatternFlowIpv4TosReliabilityCounter { - obj := patternFlowIpv4TosReliabilityCounter{obj: &otg.PatternFlowIpv4TosReliabilityCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosReliabilityCounter) msg() *otg.PatternFlowIpv4TosReliabilityCounter { - return obj.obj -} - -func (obj *patternFlowIpv4TosReliabilityCounter) setMsg(msg *otg.PatternFlowIpv4TosReliabilityCounter) PatternFlowIpv4TosReliabilityCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosReliabilityCounter struct { - obj *patternFlowIpv4TosReliabilityCounter -} - -type marshalPatternFlowIpv4TosReliabilityCounter interface { - // ToProto marshals PatternFlowIpv4TosReliabilityCounter to protobuf object *otg.PatternFlowIpv4TosReliabilityCounter - ToProto() (*otg.PatternFlowIpv4TosReliabilityCounter, error) - // ToPbText marshals PatternFlowIpv4TosReliabilityCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosReliabilityCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosReliabilityCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosReliabilityCounter struct { - obj *patternFlowIpv4TosReliabilityCounter -} - -type unMarshalPatternFlowIpv4TosReliabilityCounter interface { - // FromProto unmarshals PatternFlowIpv4TosReliabilityCounter from protobuf object *otg.PatternFlowIpv4TosReliabilityCounter - FromProto(msg *otg.PatternFlowIpv4TosReliabilityCounter) (PatternFlowIpv4TosReliabilityCounter, error) - // FromPbText unmarshals PatternFlowIpv4TosReliabilityCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosReliabilityCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosReliabilityCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosReliabilityCounter) Marshal() marshalPatternFlowIpv4TosReliabilityCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosReliabilityCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosReliabilityCounter) Unmarshal() unMarshalPatternFlowIpv4TosReliabilityCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosReliabilityCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosReliabilityCounter) ToProto() (*otg.PatternFlowIpv4TosReliabilityCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosReliabilityCounter) FromProto(msg *otg.PatternFlowIpv4TosReliabilityCounter) (PatternFlowIpv4TosReliabilityCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosReliabilityCounter) 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 *unMarshalpatternFlowIpv4TosReliabilityCounter) 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 *marshalpatternFlowIpv4TosReliabilityCounter) 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 *unMarshalpatternFlowIpv4TosReliabilityCounter) 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 *marshalpatternFlowIpv4TosReliabilityCounter) 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 *unMarshalpatternFlowIpv4TosReliabilityCounter) 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 *patternFlowIpv4TosReliabilityCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosReliabilityCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosReliabilityCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosReliabilityCounter) Clone() (PatternFlowIpv4TosReliabilityCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosReliabilityCounter() - 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 -} - -// PatternFlowIpv4TosReliabilityCounter is integer counter pattern -type PatternFlowIpv4TosReliabilityCounter interface { - Validation - // msg marshals PatternFlowIpv4TosReliabilityCounter to protobuf object *otg.PatternFlowIpv4TosReliabilityCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosReliabilityCounter - // setMsg unmarshals PatternFlowIpv4TosReliabilityCounter from protobuf object *otg.PatternFlowIpv4TosReliabilityCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosReliabilityCounter) PatternFlowIpv4TosReliabilityCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosReliabilityCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosReliabilityCounter - // validate validates PatternFlowIpv4TosReliabilityCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosReliabilityCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4TosReliabilityCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4TosReliabilityCounter - SetStart(value uint32) PatternFlowIpv4TosReliabilityCounter - // HasStart checks if Start has been set in PatternFlowIpv4TosReliabilityCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4TosReliabilityCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4TosReliabilityCounter - SetStep(value uint32) PatternFlowIpv4TosReliabilityCounter - // HasStep checks if Step has been set in PatternFlowIpv4TosReliabilityCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4TosReliabilityCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4TosReliabilityCounter - SetCount(value uint32) PatternFlowIpv4TosReliabilityCounter - // HasCount checks if Count has been set in PatternFlowIpv4TosReliabilityCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TosReliabilityCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TosReliabilityCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4TosReliabilityCounter object -func (obj *patternFlowIpv4TosReliabilityCounter) SetStart(value uint32) PatternFlowIpv4TosReliabilityCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TosReliabilityCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TosReliabilityCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4TosReliabilityCounter object -func (obj *patternFlowIpv4TosReliabilityCounter) SetStep(value uint32) PatternFlowIpv4TosReliabilityCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TosReliabilityCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TosReliabilityCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4TosReliabilityCounter object -func (obj *patternFlowIpv4TosReliabilityCounter) SetCount(value uint32) PatternFlowIpv4TosReliabilityCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4TosReliabilityCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosReliabilityCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosReliabilityCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosReliabilityCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4TosReliabilityCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4TosReliabilityMetricTag ***** -type patternFlowIpv4TosReliabilityMetricTag struct { - validation - obj *otg.PatternFlowIpv4TosReliabilityMetricTag - marshaller marshalPatternFlowIpv4TosReliabilityMetricTag - unMarshaller unMarshalPatternFlowIpv4TosReliabilityMetricTag -} - -func NewPatternFlowIpv4TosReliabilityMetricTag() PatternFlowIpv4TosReliabilityMetricTag { - obj := patternFlowIpv4TosReliabilityMetricTag{obj: &otg.PatternFlowIpv4TosReliabilityMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosReliabilityMetricTag) msg() *otg.PatternFlowIpv4TosReliabilityMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4TosReliabilityMetricTag) setMsg(msg *otg.PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosReliabilityMetricTag struct { - obj *patternFlowIpv4TosReliabilityMetricTag -} - -type marshalPatternFlowIpv4TosReliabilityMetricTag interface { - // ToProto marshals PatternFlowIpv4TosReliabilityMetricTag to protobuf object *otg.PatternFlowIpv4TosReliabilityMetricTag - ToProto() (*otg.PatternFlowIpv4TosReliabilityMetricTag, error) - // ToPbText marshals PatternFlowIpv4TosReliabilityMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosReliabilityMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosReliabilityMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosReliabilityMetricTag struct { - obj *patternFlowIpv4TosReliabilityMetricTag -} - -type unMarshalPatternFlowIpv4TosReliabilityMetricTag interface { - // FromProto unmarshals PatternFlowIpv4TosReliabilityMetricTag from protobuf object *otg.PatternFlowIpv4TosReliabilityMetricTag - FromProto(msg *otg.PatternFlowIpv4TosReliabilityMetricTag) (PatternFlowIpv4TosReliabilityMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4TosReliabilityMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosReliabilityMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosReliabilityMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosReliabilityMetricTag) Marshal() marshalPatternFlowIpv4TosReliabilityMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosReliabilityMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosReliabilityMetricTag) Unmarshal() unMarshalPatternFlowIpv4TosReliabilityMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosReliabilityMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosReliabilityMetricTag) ToProto() (*otg.PatternFlowIpv4TosReliabilityMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosReliabilityMetricTag) FromProto(msg *otg.PatternFlowIpv4TosReliabilityMetricTag) (PatternFlowIpv4TosReliabilityMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosReliabilityMetricTag) 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 *unMarshalpatternFlowIpv4TosReliabilityMetricTag) 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 *marshalpatternFlowIpv4TosReliabilityMetricTag) 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 *unMarshalpatternFlowIpv4TosReliabilityMetricTag) 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 *marshalpatternFlowIpv4TosReliabilityMetricTag) 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 *unMarshalpatternFlowIpv4TosReliabilityMetricTag) 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 *patternFlowIpv4TosReliabilityMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosReliabilityMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosReliabilityMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosReliabilityMetricTag) Clone() (PatternFlowIpv4TosReliabilityMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosReliabilityMetricTag() - 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 -} - -// PatternFlowIpv4TosReliabilityMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4TosReliabilityMetricTag interface { - Validation - // msg marshals PatternFlowIpv4TosReliabilityMetricTag to protobuf object *otg.PatternFlowIpv4TosReliabilityMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosReliabilityMetricTag - // setMsg unmarshals PatternFlowIpv4TosReliabilityMetricTag from protobuf object *otg.PatternFlowIpv4TosReliabilityMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosReliabilityMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosReliabilityMetricTag - // validate validates PatternFlowIpv4TosReliabilityMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosReliabilityMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4TosReliabilityMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4TosReliabilityMetricTag - SetName(value string) PatternFlowIpv4TosReliabilityMetricTag - // Offset returns uint32, set in PatternFlowIpv4TosReliabilityMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4TosReliabilityMetricTag - SetOffset(value uint32) PatternFlowIpv4TosReliabilityMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4TosReliabilityMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4TosReliabilityMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4TosReliabilityMetricTag - SetLength(value uint32) PatternFlowIpv4TosReliabilityMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4TosReliabilityMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4TosReliabilityMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4TosReliabilityMetricTag object -func (obj *patternFlowIpv4TosReliabilityMetricTag) SetName(value string) PatternFlowIpv4TosReliabilityMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TosReliabilityMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TosReliabilityMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4TosReliabilityMetricTag object -func (obj *patternFlowIpv4TosReliabilityMetricTag) SetOffset(value uint32) PatternFlowIpv4TosReliabilityMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TosReliabilityMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TosReliabilityMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4TosReliabilityMetricTag object -func (obj *patternFlowIpv4TosReliabilityMetricTag) SetLength(value uint32) PatternFlowIpv4TosReliabilityMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4TosReliabilityMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TosReliabilityMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosReliabilityMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4TosReliabilityMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4TosReliabilityMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowIpv4TosMonetaryCounter ***** -type patternFlowIpv4TosMonetaryCounter struct { - validation - obj *otg.PatternFlowIpv4TosMonetaryCounter - marshaller marshalPatternFlowIpv4TosMonetaryCounter - unMarshaller unMarshalPatternFlowIpv4TosMonetaryCounter -} - -func NewPatternFlowIpv4TosMonetaryCounter() PatternFlowIpv4TosMonetaryCounter { - obj := patternFlowIpv4TosMonetaryCounter{obj: &otg.PatternFlowIpv4TosMonetaryCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosMonetaryCounter) msg() *otg.PatternFlowIpv4TosMonetaryCounter { - return obj.obj -} - -func (obj *patternFlowIpv4TosMonetaryCounter) setMsg(msg *otg.PatternFlowIpv4TosMonetaryCounter) PatternFlowIpv4TosMonetaryCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosMonetaryCounter struct { - obj *patternFlowIpv4TosMonetaryCounter -} - -type marshalPatternFlowIpv4TosMonetaryCounter interface { - // ToProto marshals PatternFlowIpv4TosMonetaryCounter to protobuf object *otg.PatternFlowIpv4TosMonetaryCounter - ToProto() (*otg.PatternFlowIpv4TosMonetaryCounter, error) - // ToPbText marshals PatternFlowIpv4TosMonetaryCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosMonetaryCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosMonetaryCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosMonetaryCounter struct { - obj *patternFlowIpv4TosMonetaryCounter -} - -type unMarshalPatternFlowIpv4TosMonetaryCounter interface { - // FromProto unmarshals PatternFlowIpv4TosMonetaryCounter from protobuf object *otg.PatternFlowIpv4TosMonetaryCounter - FromProto(msg *otg.PatternFlowIpv4TosMonetaryCounter) (PatternFlowIpv4TosMonetaryCounter, error) - // FromPbText unmarshals PatternFlowIpv4TosMonetaryCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosMonetaryCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosMonetaryCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosMonetaryCounter) Marshal() marshalPatternFlowIpv4TosMonetaryCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosMonetaryCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosMonetaryCounter) Unmarshal() unMarshalPatternFlowIpv4TosMonetaryCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosMonetaryCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosMonetaryCounter) ToProto() (*otg.PatternFlowIpv4TosMonetaryCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosMonetaryCounter) FromProto(msg *otg.PatternFlowIpv4TosMonetaryCounter) (PatternFlowIpv4TosMonetaryCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosMonetaryCounter) 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 *unMarshalpatternFlowIpv4TosMonetaryCounter) 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 *marshalpatternFlowIpv4TosMonetaryCounter) 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 *unMarshalpatternFlowIpv4TosMonetaryCounter) 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 *marshalpatternFlowIpv4TosMonetaryCounter) 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 *unMarshalpatternFlowIpv4TosMonetaryCounter) 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 *patternFlowIpv4TosMonetaryCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosMonetaryCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosMonetaryCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosMonetaryCounter) Clone() (PatternFlowIpv4TosMonetaryCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosMonetaryCounter() - 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 -} - -// PatternFlowIpv4TosMonetaryCounter is integer counter pattern -type PatternFlowIpv4TosMonetaryCounter interface { - Validation - // msg marshals PatternFlowIpv4TosMonetaryCounter to protobuf object *otg.PatternFlowIpv4TosMonetaryCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosMonetaryCounter - // setMsg unmarshals PatternFlowIpv4TosMonetaryCounter from protobuf object *otg.PatternFlowIpv4TosMonetaryCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosMonetaryCounter) PatternFlowIpv4TosMonetaryCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosMonetaryCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosMonetaryCounter - // validate validates PatternFlowIpv4TosMonetaryCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosMonetaryCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4TosMonetaryCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4TosMonetaryCounter - SetStart(value uint32) PatternFlowIpv4TosMonetaryCounter - // HasStart checks if Start has been set in PatternFlowIpv4TosMonetaryCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4TosMonetaryCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4TosMonetaryCounter - SetStep(value uint32) PatternFlowIpv4TosMonetaryCounter - // HasStep checks if Step has been set in PatternFlowIpv4TosMonetaryCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4TosMonetaryCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4TosMonetaryCounter - SetCount(value uint32) PatternFlowIpv4TosMonetaryCounter - // HasCount checks if Count has been set in PatternFlowIpv4TosMonetaryCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TosMonetaryCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TosMonetaryCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4TosMonetaryCounter object -func (obj *patternFlowIpv4TosMonetaryCounter) SetStart(value uint32) PatternFlowIpv4TosMonetaryCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TosMonetaryCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TosMonetaryCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4TosMonetaryCounter object -func (obj *patternFlowIpv4TosMonetaryCounter) SetStep(value uint32) PatternFlowIpv4TosMonetaryCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TosMonetaryCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TosMonetaryCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4TosMonetaryCounter object -func (obj *patternFlowIpv4TosMonetaryCounter) SetCount(value uint32) PatternFlowIpv4TosMonetaryCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4TosMonetaryCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosMonetaryCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosMonetaryCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosMonetaryCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4TosMonetaryCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4TosMonetaryMetricTag ***** -type patternFlowIpv4TosMonetaryMetricTag struct { - validation - obj *otg.PatternFlowIpv4TosMonetaryMetricTag - marshaller marshalPatternFlowIpv4TosMonetaryMetricTag - unMarshaller unMarshalPatternFlowIpv4TosMonetaryMetricTag -} - -func NewPatternFlowIpv4TosMonetaryMetricTag() PatternFlowIpv4TosMonetaryMetricTag { - obj := patternFlowIpv4TosMonetaryMetricTag{obj: &otg.PatternFlowIpv4TosMonetaryMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosMonetaryMetricTag) msg() *otg.PatternFlowIpv4TosMonetaryMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4TosMonetaryMetricTag) setMsg(msg *otg.PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosMonetaryMetricTag struct { - obj *patternFlowIpv4TosMonetaryMetricTag -} - -type marshalPatternFlowIpv4TosMonetaryMetricTag interface { - // ToProto marshals PatternFlowIpv4TosMonetaryMetricTag to protobuf object *otg.PatternFlowIpv4TosMonetaryMetricTag - ToProto() (*otg.PatternFlowIpv4TosMonetaryMetricTag, error) - // ToPbText marshals PatternFlowIpv4TosMonetaryMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosMonetaryMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosMonetaryMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosMonetaryMetricTag struct { - obj *patternFlowIpv4TosMonetaryMetricTag -} - -type unMarshalPatternFlowIpv4TosMonetaryMetricTag interface { - // FromProto unmarshals PatternFlowIpv4TosMonetaryMetricTag from protobuf object *otg.PatternFlowIpv4TosMonetaryMetricTag - FromProto(msg *otg.PatternFlowIpv4TosMonetaryMetricTag) (PatternFlowIpv4TosMonetaryMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4TosMonetaryMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosMonetaryMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosMonetaryMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosMonetaryMetricTag) Marshal() marshalPatternFlowIpv4TosMonetaryMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosMonetaryMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosMonetaryMetricTag) Unmarshal() unMarshalPatternFlowIpv4TosMonetaryMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosMonetaryMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosMonetaryMetricTag) ToProto() (*otg.PatternFlowIpv4TosMonetaryMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosMonetaryMetricTag) FromProto(msg *otg.PatternFlowIpv4TosMonetaryMetricTag) (PatternFlowIpv4TosMonetaryMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosMonetaryMetricTag) 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 *unMarshalpatternFlowIpv4TosMonetaryMetricTag) 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 *marshalpatternFlowIpv4TosMonetaryMetricTag) 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 *unMarshalpatternFlowIpv4TosMonetaryMetricTag) 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 *marshalpatternFlowIpv4TosMonetaryMetricTag) 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 *unMarshalpatternFlowIpv4TosMonetaryMetricTag) 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 *patternFlowIpv4TosMonetaryMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosMonetaryMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosMonetaryMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosMonetaryMetricTag) Clone() (PatternFlowIpv4TosMonetaryMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosMonetaryMetricTag() - 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 -} - -// PatternFlowIpv4TosMonetaryMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4TosMonetaryMetricTag interface { - Validation - // msg marshals PatternFlowIpv4TosMonetaryMetricTag to protobuf object *otg.PatternFlowIpv4TosMonetaryMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosMonetaryMetricTag - // setMsg unmarshals PatternFlowIpv4TosMonetaryMetricTag from protobuf object *otg.PatternFlowIpv4TosMonetaryMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosMonetaryMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosMonetaryMetricTag - // validate validates PatternFlowIpv4TosMonetaryMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosMonetaryMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4TosMonetaryMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4TosMonetaryMetricTag - SetName(value string) PatternFlowIpv4TosMonetaryMetricTag - // Offset returns uint32, set in PatternFlowIpv4TosMonetaryMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4TosMonetaryMetricTag - SetOffset(value uint32) PatternFlowIpv4TosMonetaryMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4TosMonetaryMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4TosMonetaryMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4TosMonetaryMetricTag - SetLength(value uint32) PatternFlowIpv4TosMonetaryMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4TosMonetaryMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4TosMonetaryMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4TosMonetaryMetricTag object -func (obj *patternFlowIpv4TosMonetaryMetricTag) SetName(value string) PatternFlowIpv4TosMonetaryMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TosMonetaryMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TosMonetaryMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4TosMonetaryMetricTag object -func (obj *patternFlowIpv4TosMonetaryMetricTag) SetOffset(value uint32) PatternFlowIpv4TosMonetaryMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TosMonetaryMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TosMonetaryMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4TosMonetaryMetricTag object -func (obj *patternFlowIpv4TosMonetaryMetricTag) SetLength(value uint32) PatternFlowIpv4TosMonetaryMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4TosMonetaryMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TosMonetaryMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosMonetaryMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4TosMonetaryMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4TosMonetaryMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowIpv4TosUnusedCounter ***** -type patternFlowIpv4TosUnusedCounter struct { - validation - obj *otg.PatternFlowIpv4TosUnusedCounter - marshaller marshalPatternFlowIpv4TosUnusedCounter - unMarshaller unMarshalPatternFlowIpv4TosUnusedCounter -} - -func NewPatternFlowIpv4TosUnusedCounter() PatternFlowIpv4TosUnusedCounter { - obj := patternFlowIpv4TosUnusedCounter{obj: &otg.PatternFlowIpv4TosUnusedCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosUnusedCounter) msg() *otg.PatternFlowIpv4TosUnusedCounter { - return obj.obj -} - -func (obj *patternFlowIpv4TosUnusedCounter) setMsg(msg *otg.PatternFlowIpv4TosUnusedCounter) PatternFlowIpv4TosUnusedCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosUnusedCounter struct { - obj *patternFlowIpv4TosUnusedCounter -} - -type marshalPatternFlowIpv4TosUnusedCounter interface { - // ToProto marshals PatternFlowIpv4TosUnusedCounter to protobuf object *otg.PatternFlowIpv4TosUnusedCounter - ToProto() (*otg.PatternFlowIpv4TosUnusedCounter, error) - // ToPbText marshals PatternFlowIpv4TosUnusedCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosUnusedCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosUnusedCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosUnusedCounter struct { - obj *patternFlowIpv4TosUnusedCounter -} - -type unMarshalPatternFlowIpv4TosUnusedCounter interface { - // FromProto unmarshals PatternFlowIpv4TosUnusedCounter from protobuf object *otg.PatternFlowIpv4TosUnusedCounter - FromProto(msg *otg.PatternFlowIpv4TosUnusedCounter) (PatternFlowIpv4TosUnusedCounter, error) - // FromPbText unmarshals PatternFlowIpv4TosUnusedCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosUnusedCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosUnusedCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosUnusedCounter) Marshal() marshalPatternFlowIpv4TosUnusedCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosUnusedCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosUnusedCounter) Unmarshal() unMarshalPatternFlowIpv4TosUnusedCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosUnusedCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosUnusedCounter) ToProto() (*otg.PatternFlowIpv4TosUnusedCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosUnusedCounter) FromProto(msg *otg.PatternFlowIpv4TosUnusedCounter) (PatternFlowIpv4TosUnusedCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosUnusedCounter) 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 *unMarshalpatternFlowIpv4TosUnusedCounter) 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 *marshalpatternFlowIpv4TosUnusedCounter) 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 *unMarshalpatternFlowIpv4TosUnusedCounter) 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 *marshalpatternFlowIpv4TosUnusedCounter) 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 *unMarshalpatternFlowIpv4TosUnusedCounter) 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 *patternFlowIpv4TosUnusedCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosUnusedCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosUnusedCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosUnusedCounter) Clone() (PatternFlowIpv4TosUnusedCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosUnusedCounter() - 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 -} - -// PatternFlowIpv4TosUnusedCounter is integer counter pattern -type PatternFlowIpv4TosUnusedCounter interface { - Validation - // msg marshals PatternFlowIpv4TosUnusedCounter to protobuf object *otg.PatternFlowIpv4TosUnusedCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosUnusedCounter - // setMsg unmarshals PatternFlowIpv4TosUnusedCounter from protobuf object *otg.PatternFlowIpv4TosUnusedCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosUnusedCounter) PatternFlowIpv4TosUnusedCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosUnusedCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosUnusedCounter - // validate validates PatternFlowIpv4TosUnusedCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosUnusedCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4TosUnusedCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4TosUnusedCounter - SetStart(value uint32) PatternFlowIpv4TosUnusedCounter - // HasStart checks if Start has been set in PatternFlowIpv4TosUnusedCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4TosUnusedCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4TosUnusedCounter - SetStep(value uint32) PatternFlowIpv4TosUnusedCounter - // HasStep checks if Step has been set in PatternFlowIpv4TosUnusedCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4TosUnusedCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4TosUnusedCounter - SetCount(value uint32) PatternFlowIpv4TosUnusedCounter - // HasCount checks if Count has been set in PatternFlowIpv4TosUnusedCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TosUnusedCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4TosUnusedCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4TosUnusedCounter object -func (obj *patternFlowIpv4TosUnusedCounter) SetStart(value uint32) PatternFlowIpv4TosUnusedCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TosUnusedCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4TosUnusedCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4TosUnusedCounter object -func (obj *patternFlowIpv4TosUnusedCounter) SetStep(value uint32) PatternFlowIpv4TosUnusedCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TosUnusedCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4TosUnusedCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4TosUnusedCounter object -func (obj *patternFlowIpv4TosUnusedCounter) SetCount(value uint32) PatternFlowIpv4TosUnusedCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4TosUnusedCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosUnusedCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosUnusedCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosUnusedCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4TosUnusedCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4TosUnusedMetricTag ***** -type patternFlowIpv4TosUnusedMetricTag struct { - validation - obj *otg.PatternFlowIpv4TosUnusedMetricTag - marshaller marshalPatternFlowIpv4TosUnusedMetricTag - unMarshaller unMarshalPatternFlowIpv4TosUnusedMetricTag -} - -func NewPatternFlowIpv4TosUnusedMetricTag() PatternFlowIpv4TosUnusedMetricTag { - obj := patternFlowIpv4TosUnusedMetricTag{obj: &otg.PatternFlowIpv4TosUnusedMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4TosUnusedMetricTag) msg() *otg.PatternFlowIpv4TosUnusedMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4TosUnusedMetricTag) setMsg(msg *otg.PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4TosUnusedMetricTag struct { - obj *patternFlowIpv4TosUnusedMetricTag -} - -type marshalPatternFlowIpv4TosUnusedMetricTag interface { - // ToProto marshals PatternFlowIpv4TosUnusedMetricTag to protobuf object *otg.PatternFlowIpv4TosUnusedMetricTag - ToProto() (*otg.PatternFlowIpv4TosUnusedMetricTag, error) - // ToPbText marshals PatternFlowIpv4TosUnusedMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4TosUnusedMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4TosUnusedMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4TosUnusedMetricTag struct { - obj *patternFlowIpv4TosUnusedMetricTag -} - -type unMarshalPatternFlowIpv4TosUnusedMetricTag interface { - // FromProto unmarshals PatternFlowIpv4TosUnusedMetricTag from protobuf object *otg.PatternFlowIpv4TosUnusedMetricTag - FromProto(msg *otg.PatternFlowIpv4TosUnusedMetricTag) (PatternFlowIpv4TosUnusedMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4TosUnusedMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4TosUnusedMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4TosUnusedMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4TosUnusedMetricTag) Marshal() marshalPatternFlowIpv4TosUnusedMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4TosUnusedMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4TosUnusedMetricTag) Unmarshal() unMarshalPatternFlowIpv4TosUnusedMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4TosUnusedMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4TosUnusedMetricTag) ToProto() (*otg.PatternFlowIpv4TosUnusedMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4TosUnusedMetricTag) FromProto(msg *otg.PatternFlowIpv4TosUnusedMetricTag) (PatternFlowIpv4TosUnusedMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4TosUnusedMetricTag) 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 *unMarshalpatternFlowIpv4TosUnusedMetricTag) 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 *marshalpatternFlowIpv4TosUnusedMetricTag) 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 *unMarshalpatternFlowIpv4TosUnusedMetricTag) 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 *marshalpatternFlowIpv4TosUnusedMetricTag) 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 *unMarshalpatternFlowIpv4TosUnusedMetricTag) 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 *patternFlowIpv4TosUnusedMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosUnusedMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4TosUnusedMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4TosUnusedMetricTag) Clone() (PatternFlowIpv4TosUnusedMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4TosUnusedMetricTag() - 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 -} - -// PatternFlowIpv4TosUnusedMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4TosUnusedMetricTag interface { - Validation - // msg marshals PatternFlowIpv4TosUnusedMetricTag to protobuf object *otg.PatternFlowIpv4TosUnusedMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4TosUnusedMetricTag - // setMsg unmarshals PatternFlowIpv4TosUnusedMetricTag from protobuf object *otg.PatternFlowIpv4TosUnusedMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4TosUnusedMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4TosUnusedMetricTag - // validate validates PatternFlowIpv4TosUnusedMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4TosUnusedMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4TosUnusedMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4TosUnusedMetricTag - SetName(value string) PatternFlowIpv4TosUnusedMetricTag - // Offset returns uint32, set in PatternFlowIpv4TosUnusedMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4TosUnusedMetricTag - SetOffset(value uint32) PatternFlowIpv4TosUnusedMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4TosUnusedMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4TosUnusedMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4TosUnusedMetricTag - SetLength(value uint32) PatternFlowIpv4TosUnusedMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4TosUnusedMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4TosUnusedMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4TosUnusedMetricTag object -func (obj *patternFlowIpv4TosUnusedMetricTag) SetName(value string) PatternFlowIpv4TosUnusedMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TosUnusedMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4TosUnusedMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4TosUnusedMetricTag object -func (obj *patternFlowIpv4TosUnusedMetricTag) SetOffset(value uint32) PatternFlowIpv4TosUnusedMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TosUnusedMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4TosUnusedMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4TosUnusedMetricTag object -func (obj *patternFlowIpv4TosUnusedMetricTag) SetLength(value uint32) PatternFlowIpv4TosUnusedMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4TosUnusedMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TosUnusedMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 0 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4TosUnusedMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4TosUnusedMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4TosUnusedMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(1) - } - -} - -// ***** PatternFlowIpv4DscpPhbCounter ***** -type patternFlowIpv4DscpPhbCounter struct { - validation - obj *otg.PatternFlowIpv4DscpPhbCounter - marshaller marshalPatternFlowIpv4DscpPhbCounter - unMarshaller unMarshalPatternFlowIpv4DscpPhbCounter -} - -func NewPatternFlowIpv4DscpPhbCounter() PatternFlowIpv4DscpPhbCounter { - obj := patternFlowIpv4DscpPhbCounter{obj: &otg.PatternFlowIpv4DscpPhbCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4DscpPhbCounter) msg() *otg.PatternFlowIpv4DscpPhbCounter { - return obj.obj -} - -func (obj *patternFlowIpv4DscpPhbCounter) setMsg(msg *otg.PatternFlowIpv4DscpPhbCounter) PatternFlowIpv4DscpPhbCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4DscpPhbCounter struct { - obj *patternFlowIpv4DscpPhbCounter -} - -type marshalPatternFlowIpv4DscpPhbCounter interface { - // ToProto marshals PatternFlowIpv4DscpPhbCounter to protobuf object *otg.PatternFlowIpv4DscpPhbCounter - ToProto() (*otg.PatternFlowIpv4DscpPhbCounter, error) - // ToPbText marshals PatternFlowIpv4DscpPhbCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4DscpPhbCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4DscpPhbCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4DscpPhbCounter struct { - obj *patternFlowIpv4DscpPhbCounter -} - -type unMarshalPatternFlowIpv4DscpPhbCounter interface { - // FromProto unmarshals PatternFlowIpv4DscpPhbCounter from protobuf object *otg.PatternFlowIpv4DscpPhbCounter - FromProto(msg *otg.PatternFlowIpv4DscpPhbCounter) (PatternFlowIpv4DscpPhbCounter, error) - // FromPbText unmarshals PatternFlowIpv4DscpPhbCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4DscpPhbCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4DscpPhbCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4DscpPhbCounter) Marshal() marshalPatternFlowIpv4DscpPhbCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4DscpPhbCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4DscpPhbCounter) Unmarshal() unMarshalPatternFlowIpv4DscpPhbCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4DscpPhbCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4DscpPhbCounter) ToProto() (*otg.PatternFlowIpv4DscpPhbCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4DscpPhbCounter) FromProto(msg *otg.PatternFlowIpv4DscpPhbCounter) (PatternFlowIpv4DscpPhbCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4DscpPhbCounter) 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 *unMarshalpatternFlowIpv4DscpPhbCounter) 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 *marshalpatternFlowIpv4DscpPhbCounter) 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 *unMarshalpatternFlowIpv4DscpPhbCounter) 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 *marshalpatternFlowIpv4DscpPhbCounter) 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 *unMarshalpatternFlowIpv4DscpPhbCounter) 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 *patternFlowIpv4DscpPhbCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DscpPhbCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DscpPhbCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4DscpPhbCounter) Clone() (PatternFlowIpv4DscpPhbCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4DscpPhbCounter() - 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 -} - -// PatternFlowIpv4DscpPhbCounter is integer counter pattern -type PatternFlowIpv4DscpPhbCounter interface { - Validation - // msg marshals PatternFlowIpv4DscpPhbCounter to protobuf object *otg.PatternFlowIpv4DscpPhbCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4DscpPhbCounter - // setMsg unmarshals PatternFlowIpv4DscpPhbCounter from protobuf object *otg.PatternFlowIpv4DscpPhbCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4DscpPhbCounter) PatternFlowIpv4DscpPhbCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4DscpPhbCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4DscpPhbCounter - // validate validates PatternFlowIpv4DscpPhbCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4DscpPhbCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4DscpPhbCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4DscpPhbCounter - SetStart(value uint32) PatternFlowIpv4DscpPhbCounter - // HasStart checks if Start has been set in PatternFlowIpv4DscpPhbCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4DscpPhbCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4DscpPhbCounter - SetStep(value uint32) PatternFlowIpv4DscpPhbCounter - // HasStep checks if Step has been set in PatternFlowIpv4DscpPhbCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4DscpPhbCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4DscpPhbCounter - SetCount(value uint32) PatternFlowIpv4DscpPhbCounter - // HasCount checks if Count has been set in PatternFlowIpv4DscpPhbCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4DscpPhbCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4DscpPhbCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4DscpPhbCounter object -func (obj *patternFlowIpv4DscpPhbCounter) SetStart(value uint32) PatternFlowIpv4DscpPhbCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4DscpPhbCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4DscpPhbCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4DscpPhbCounter object -func (obj *patternFlowIpv4DscpPhbCounter) SetStep(value uint32) PatternFlowIpv4DscpPhbCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4DscpPhbCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4DscpPhbCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4DscpPhbCounter object -func (obj *patternFlowIpv4DscpPhbCounter) SetCount(value uint32) PatternFlowIpv4DscpPhbCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4DscpPhbCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 63 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DscpPhbCounter.Start <= 63 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 63 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DscpPhbCounter.Step <= 63 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 63 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DscpPhbCounter.Count <= 63 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4DscpPhbCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4DscpPhbMetricTag ***** -type patternFlowIpv4DscpPhbMetricTag struct { - validation - obj *otg.PatternFlowIpv4DscpPhbMetricTag - marshaller marshalPatternFlowIpv4DscpPhbMetricTag - unMarshaller unMarshalPatternFlowIpv4DscpPhbMetricTag -} - -func NewPatternFlowIpv4DscpPhbMetricTag() PatternFlowIpv4DscpPhbMetricTag { - obj := patternFlowIpv4DscpPhbMetricTag{obj: &otg.PatternFlowIpv4DscpPhbMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4DscpPhbMetricTag) msg() *otg.PatternFlowIpv4DscpPhbMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4DscpPhbMetricTag) setMsg(msg *otg.PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4DscpPhbMetricTag struct { - obj *patternFlowIpv4DscpPhbMetricTag -} - -type marshalPatternFlowIpv4DscpPhbMetricTag interface { - // ToProto marshals PatternFlowIpv4DscpPhbMetricTag to protobuf object *otg.PatternFlowIpv4DscpPhbMetricTag - ToProto() (*otg.PatternFlowIpv4DscpPhbMetricTag, error) - // ToPbText marshals PatternFlowIpv4DscpPhbMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4DscpPhbMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4DscpPhbMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4DscpPhbMetricTag struct { - obj *patternFlowIpv4DscpPhbMetricTag -} - -type unMarshalPatternFlowIpv4DscpPhbMetricTag interface { - // FromProto unmarshals PatternFlowIpv4DscpPhbMetricTag from protobuf object *otg.PatternFlowIpv4DscpPhbMetricTag - FromProto(msg *otg.PatternFlowIpv4DscpPhbMetricTag) (PatternFlowIpv4DscpPhbMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4DscpPhbMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4DscpPhbMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4DscpPhbMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4DscpPhbMetricTag) Marshal() marshalPatternFlowIpv4DscpPhbMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4DscpPhbMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4DscpPhbMetricTag) Unmarshal() unMarshalPatternFlowIpv4DscpPhbMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4DscpPhbMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4DscpPhbMetricTag) ToProto() (*otg.PatternFlowIpv4DscpPhbMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4DscpPhbMetricTag) FromProto(msg *otg.PatternFlowIpv4DscpPhbMetricTag) (PatternFlowIpv4DscpPhbMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4DscpPhbMetricTag) 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 *unMarshalpatternFlowIpv4DscpPhbMetricTag) 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 *marshalpatternFlowIpv4DscpPhbMetricTag) 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 *unMarshalpatternFlowIpv4DscpPhbMetricTag) 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 *marshalpatternFlowIpv4DscpPhbMetricTag) 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 *unMarshalpatternFlowIpv4DscpPhbMetricTag) 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 *patternFlowIpv4DscpPhbMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DscpPhbMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DscpPhbMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4DscpPhbMetricTag) Clone() (PatternFlowIpv4DscpPhbMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4DscpPhbMetricTag() - 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 -} - -// PatternFlowIpv4DscpPhbMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4DscpPhbMetricTag interface { - Validation - // msg marshals PatternFlowIpv4DscpPhbMetricTag to protobuf object *otg.PatternFlowIpv4DscpPhbMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4DscpPhbMetricTag - // setMsg unmarshals PatternFlowIpv4DscpPhbMetricTag from protobuf object *otg.PatternFlowIpv4DscpPhbMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4DscpPhbMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4DscpPhbMetricTag - // validate validates PatternFlowIpv4DscpPhbMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4DscpPhbMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4DscpPhbMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4DscpPhbMetricTag - SetName(value string) PatternFlowIpv4DscpPhbMetricTag - // Offset returns uint32, set in PatternFlowIpv4DscpPhbMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4DscpPhbMetricTag - SetOffset(value uint32) PatternFlowIpv4DscpPhbMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4DscpPhbMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4DscpPhbMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4DscpPhbMetricTag - SetLength(value uint32) PatternFlowIpv4DscpPhbMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4DscpPhbMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4DscpPhbMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4DscpPhbMetricTag object -func (obj *patternFlowIpv4DscpPhbMetricTag) SetName(value string) PatternFlowIpv4DscpPhbMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4DscpPhbMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4DscpPhbMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4DscpPhbMetricTag object -func (obj *patternFlowIpv4DscpPhbMetricTag) SetOffset(value uint32) PatternFlowIpv4DscpPhbMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4DscpPhbMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4DscpPhbMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4DscpPhbMetricTag object -func (obj *patternFlowIpv4DscpPhbMetricTag) SetLength(value uint32) PatternFlowIpv4DscpPhbMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4DscpPhbMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4DscpPhbMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 5 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DscpPhbMetricTag.Offset <= 5 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 6 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4DscpPhbMetricTag.Length <= 6 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4DscpPhbMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(6) - } - -} - -// ***** PatternFlowIpv4DscpEcnCounter ***** -type patternFlowIpv4DscpEcnCounter struct { - validation - obj *otg.PatternFlowIpv4DscpEcnCounter - marshaller marshalPatternFlowIpv4DscpEcnCounter - unMarshaller unMarshalPatternFlowIpv4DscpEcnCounter -} - -func NewPatternFlowIpv4DscpEcnCounter() PatternFlowIpv4DscpEcnCounter { - obj := patternFlowIpv4DscpEcnCounter{obj: &otg.PatternFlowIpv4DscpEcnCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4DscpEcnCounter) msg() *otg.PatternFlowIpv4DscpEcnCounter { - return obj.obj -} - -func (obj *patternFlowIpv4DscpEcnCounter) setMsg(msg *otg.PatternFlowIpv4DscpEcnCounter) PatternFlowIpv4DscpEcnCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4DscpEcnCounter struct { - obj *patternFlowIpv4DscpEcnCounter -} - -type marshalPatternFlowIpv4DscpEcnCounter interface { - // ToProto marshals PatternFlowIpv4DscpEcnCounter to protobuf object *otg.PatternFlowIpv4DscpEcnCounter - ToProto() (*otg.PatternFlowIpv4DscpEcnCounter, error) - // ToPbText marshals PatternFlowIpv4DscpEcnCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4DscpEcnCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4DscpEcnCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4DscpEcnCounter struct { - obj *patternFlowIpv4DscpEcnCounter -} - -type unMarshalPatternFlowIpv4DscpEcnCounter interface { - // FromProto unmarshals PatternFlowIpv4DscpEcnCounter from protobuf object *otg.PatternFlowIpv4DscpEcnCounter - FromProto(msg *otg.PatternFlowIpv4DscpEcnCounter) (PatternFlowIpv4DscpEcnCounter, error) - // FromPbText unmarshals PatternFlowIpv4DscpEcnCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4DscpEcnCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4DscpEcnCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4DscpEcnCounter) Marshal() marshalPatternFlowIpv4DscpEcnCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4DscpEcnCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4DscpEcnCounter) Unmarshal() unMarshalPatternFlowIpv4DscpEcnCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4DscpEcnCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4DscpEcnCounter) ToProto() (*otg.PatternFlowIpv4DscpEcnCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4DscpEcnCounter) FromProto(msg *otg.PatternFlowIpv4DscpEcnCounter) (PatternFlowIpv4DscpEcnCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4DscpEcnCounter) 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 *unMarshalpatternFlowIpv4DscpEcnCounter) 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 *marshalpatternFlowIpv4DscpEcnCounter) 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 *unMarshalpatternFlowIpv4DscpEcnCounter) 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 *marshalpatternFlowIpv4DscpEcnCounter) 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 *unMarshalpatternFlowIpv4DscpEcnCounter) 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 *patternFlowIpv4DscpEcnCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DscpEcnCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DscpEcnCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4DscpEcnCounter) Clone() (PatternFlowIpv4DscpEcnCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4DscpEcnCounter() - 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 -} - -// PatternFlowIpv4DscpEcnCounter is integer counter pattern -type PatternFlowIpv4DscpEcnCounter interface { - Validation - // msg marshals PatternFlowIpv4DscpEcnCounter to protobuf object *otg.PatternFlowIpv4DscpEcnCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4DscpEcnCounter - // setMsg unmarshals PatternFlowIpv4DscpEcnCounter from protobuf object *otg.PatternFlowIpv4DscpEcnCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4DscpEcnCounter) PatternFlowIpv4DscpEcnCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4DscpEcnCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4DscpEcnCounter - // validate validates PatternFlowIpv4DscpEcnCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4DscpEcnCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4DscpEcnCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4DscpEcnCounter - SetStart(value uint32) PatternFlowIpv4DscpEcnCounter - // HasStart checks if Start has been set in PatternFlowIpv4DscpEcnCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4DscpEcnCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4DscpEcnCounter - SetStep(value uint32) PatternFlowIpv4DscpEcnCounter - // HasStep checks if Step has been set in PatternFlowIpv4DscpEcnCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4DscpEcnCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4DscpEcnCounter - SetCount(value uint32) PatternFlowIpv4DscpEcnCounter - // HasCount checks if Count has been set in PatternFlowIpv4DscpEcnCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4DscpEcnCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4DscpEcnCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4DscpEcnCounter object -func (obj *patternFlowIpv4DscpEcnCounter) SetStart(value uint32) PatternFlowIpv4DscpEcnCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4DscpEcnCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4DscpEcnCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4DscpEcnCounter object -func (obj *patternFlowIpv4DscpEcnCounter) SetStep(value uint32) PatternFlowIpv4DscpEcnCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4DscpEcnCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4DscpEcnCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4DscpEcnCounter object -func (obj *patternFlowIpv4DscpEcnCounter) SetCount(value uint32) PatternFlowIpv4DscpEcnCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4DscpEcnCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DscpEcnCounter.Start <= 3 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DscpEcnCounter.Step <= 3 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DscpEcnCounter.Count <= 3 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4DscpEcnCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4DscpEcnMetricTag ***** -type patternFlowIpv4DscpEcnMetricTag struct { - validation - obj *otg.PatternFlowIpv4DscpEcnMetricTag - marshaller marshalPatternFlowIpv4DscpEcnMetricTag - unMarshaller unMarshalPatternFlowIpv4DscpEcnMetricTag -} - -func NewPatternFlowIpv4DscpEcnMetricTag() PatternFlowIpv4DscpEcnMetricTag { - obj := patternFlowIpv4DscpEcnMetricTag{obj: &otg.PatternFlowIpv4DscpEcnMetricTag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4DscpEcnMetricTag) msg() *otg.PatternFlowIpv4DscpEcnMetricTag { - return obj.obj -} - -func (obj *patternFlowIpv4DscpEcnMetricTag) setMsg(msg *otg.PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnMetricTag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4DscpEcnMetricTag struct { - obj *patternFlowIpv4DscpEcnMetricTag -} - -type marshalPatternFlowIpv4DscpEcnMetricTag interface { - // ToProto marshals PatternFlowIpv4DscpEcnMetricTag to protobuf object *otg.PatternFlowIpv4DscpEcnMetricTag - ToProto() (*otg.PatternFlowIpv4DscpEcnMetricTag, error) - // ToPbText marshals PatternFlowIpv4DscpEcnMetricTag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4DscpEcnMetricTag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4DscpEcnMetricTag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4DscpEcnMetricTag struct { - obj *patternFlowIpv4DscpEcnMetricTag -} - -type unMarshalPatternFlowIpv4DscpEcnMetricTag interface { - // FromProto unmarshals PatternFlowIpv4DscpEcnMetricTag from protobuf object *otg.PatternFlowIpv4DscpEcnMetricTag - FromProto(msg *otg.PatternFlowIpv4DscpEcnMetricTag) (PatternFlowIpv4DscpEcnMetricTag, error) - // FromPbText unmarshals PatternFlowIpv4DscpEcnMetricTag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4DscpEcnMetricTag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4DscpEcnMetricTag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4DscpEcnMetricTag) Marshal() marshalPatternFlowIpv4DscpEcnMetricTag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4DscpEcnMetricTag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4DscpEcnMetricTag) Unmarshal() unMarshalPatternFlowIpv4DscpEcnMetricTag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4DscpEcnMetricTag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4DscpEcnMetricTag) ToProto() (*otg.PatternFlowIpv4DscpEcnMetricTag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4DscpEcnMetricTag) FromProto(msg *otg.PatternFlowIpv4DscpEcnMetricTag) (PatternFlowIpv4DscpEcnMetricTag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4DscpEcnMetricTag) 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 *unMarshalpatternFlowIpv4DscpEcnMetricTag) 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 *marshalpatternFlowIpv4DscpEcnMetricTag) 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 *unMarshalpatternFlowIpv4DscpEcnMetricTag) 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 *marshalpatternFlowIpv4DscpEcnMetricTag) 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 *unMarshalpatternFlowIpv4DscpEcnMetricTag) 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 *patternFlowIpv4DscpEcnMetricTag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DscpEcnMetricTag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4DscpEcnMetricTag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4DscpEcnMetricTag) Clone() (PatternFlowIpv4DscpEcnMetricTag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4DscpEcnMetricTag() - 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 -} - -// PatternFlowIpv4DscpEcnMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. -type PatternFlowIpv4DscpEcnMetricTag interface { - Validation - // msg marshals PatternFlowIpv4DscpEcnMetricTag to protobuf object *otg.PatternFlowIpv4DscpEcnMetricTag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4DscpEcnMetricTag - // setMsg unmarshals PatternFlowIpv4DscpEcnMetricTag from protobuf object *otg.PatternFlowIpv4DscpEcnMetricTag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnMetricTag - // provides marshal interface - Marshal() marshalPatternFlowIpv4DscpEcnMetricTag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4DscpEcnMetricTag - // validate validates PatternFlowIpv4DscpEcnMetricTag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4DscpEcnMetricTag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Name returns string, set in PatternFlowIpv4DscpEcnMetricTag. - Name() string - // SetName assigns string provided by user to PatternFlowIpv4DscpEcnMetricTag - SetName(value string) PatternFlowIpv4DscpEcnMetricTag - // Offset returns uint32, set in PatternFlowIpv4DscpEcnMetricTag. - Offset() uint32 - // SetOffset assigns uint32 provided by user to PatternFlowIpv4DscpEcnMetricTag - SetOffset(value uint32) PatternFlowIpv4DscpEcnMetricTag - // HasOffset checks if Offset has been set in PatternFlowIpv4DscpEcnMetricTag - HasOffset() bool - // Length returns uint32, set in PatternFlowIpv4DscpEcnMetricTag. - Length() uint32 - // SetLength assigns uint32 provided by user to PatternFlowIpv4DscpEcnMetricTag - SetLength(value uint32) PatternFlowIpv4DscpEcnMetricTag - // HasLength checks if Length has been set in PatternFlowIpv4DscpEcnMetricTag - HasLength() bool -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// Name returns a string -func (obj *patternFlowIpv4DscpEcnMetricTag) Name() string { - - return *obj.obj.Name - -} - -// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field -// SetName sets the string value in the PatternFlowIpv4DscpEcnMetricTag object -func (obj *patternFlowIpv4DscpEcnMetricTag) SetName(value string) PatternFlowIpv4DscpEcnMetricTag { - - obj.obj.Name = &value - return obj -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4DscpEcnMetricTag) Offset() uint32 { - - return *obj.obj.Offset - -} - -// Offset in bits relative to start of corresponding header field -// Offset returns a uint32 -func (obj *patternFlowIpv4DscpEcnMetricTag) HasOffset() bool { - return obj.obj.Offset != nil -} - -// Offset in bits relative to start of corresponding header field -// SetOffset sets the uint32 value in the PatternFlowIpv4DscpEcnMetricTag object -func (obj *patternFlowIpv4DscpEcnMetricTag) SetOffset(value uint32) PatternFlowIpv4DscpEcnMetricTag { - - obj.obj.Offset = &value - return obj -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4DscpEcnMetricTag) Length() uint32 { - - return *obj.obj.Length - -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// Length returns a uint32 -func (obj *patternFlowIpv4DscpEcnMetricTag) HasLength() bool { - return obj.obj.Length != nil -} - -// Number of bits to track for metrics starting from configured offset of corresponding header field -// SetLength sets the uint32 value in the PatternFlowIpv4DscpEcnMetricTag object -func (obj *patternFlowIpv4DscpEcnMetricTag) SetLength(value uint32) PatternFlowIpv4DscpEcnMetricTag { - - obj.obj.Length = &value - return obj -} - -func (obj *patternFlowIpv4DscpEcnMetricTag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4DscpEcnMetricTag") - } - - if obj.obj.Offset != nil { - - if *obj.obj.Offset > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4DscpEcnMetricTag.Offset <= 1 but Got %d", *obj.obj.Offset)) - } - - } - - if obj.obj.Length != nil { - - if *obj.obj.Length < 1 || *obj.obj.Length > 2 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= PatternFlowIpv4DscpEcnMetricTag.Length <= 2 but Got %d", *obj.obj.Length)) - } - - } - -} - -func (obj *patternFlowIpv4DscpEcnMetricTag) setDefault() { - if obj.obj.Offset == nil { - obj.SetOffset(0) - } - if obj.obj.Length == nil { - obj.SetLength(2) - } - -} - -// ***** PatternFlowIpv4OptionsCustomTypeCopiedFlag ***** -type patternFlowIpv4OptionsCustomTypeCopiedFlag struct { - validation - obj *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag - marshaller marshalPatternFlowIpv4OptionsCustomTypeCopiedFlag - unMarshaller unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlag - incrementHolder PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - decrementHolder PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter -} - -func NewPatternFlowIpv4OptionsCustomTypeCopiedFlag() PatternFlowIpv4OptionsCustomTypeCopiedFlag { - obj := patternFlowIpv4OptionsCustomTypeCopiedFlag{obj: &otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) msg() *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag { - return obj.obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) setMsg(msg *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag) PatternFlowIpv4OptionsCustomTypeCopiedFlag { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4OptionsCustomTypeCopiedFlag struct { - obj *patternFlowIpv4OptionsCustomTypeCopiedFlag -} - -type marshalPatternFlowIpv4OptionsCustomTypeCopiedFlag interface { - // ToProto marshals PatternFlowIpv4OptionsCustomTypeCopiedFlag to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag - ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag, error) - // ToPbText marshals PatternFlowIpv4OptionsCustomTypeCopiedFlag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4OptionsCustomTypeCopiedFlag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4OptionsCustomTypeCopiedFlag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlag struct { - obj *patternFlowIpv4OptionsCustomTypeCopiedFlag -} - -type unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlag interface { - // FromProto unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlag from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag - FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag) (PatternFlowIpv4OptionsCustomTypeCopiedFlag, error) - // FromPbText unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Marshal() marshalPatternFlowIpv4OptionsCustomTypeCopiedFlag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4OptionsCustomTypeCopiedFlag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag) (PatternFlowIpv4OptionsCustomTypeCopiedFlag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Clone() (PatternFlowIpv4OptionsCustomTypeCopiedFlag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4OptionsCustomTypeCopiedFlag() - 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 -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4OptionsCustomTypeCopiedFlag is this flag indicates this option is copied to all fragments on fragmentations. -type PatternFlowIpv4OptionsCustomTypeCopiedFlag interface { - Validation - // msg marshals PatternFlowIpv4OptionsCustomTypeCopiedFlag to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag - // and doesn't set defaults - msg() *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag - // setMsg unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlag from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag) PatternFlowIpv4OptionsCustomTypeCopiedFlag - // provides marshal interface - Marshal() marshalPatternFlowIpv4OptionsCustomTypeCopiedFlag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlag - // validate validates PatternFlowIpv4OptionsCustomTypeCopiedFlag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4OptionsCustomTypeCopiedFlag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum, set in PatternFlowIpv4OptionsCustomTypeCopiedFlag - Choice() PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum - // setChoice assigns PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlag - setChoice(value PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum) PatternFlowIpv4OptionsCustomTypeCopiedFlag - // HasChoice checks if Choice has been set in PatternFlowIpv4OptionsCustomTypeCopiedFlag - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4OptionsCustomTypeCopiedFlag. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlag - SetValue(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlag - // HasValue checks if Value has been set in PatternFlowIpv4OptionsCustomTypeCopiedFlag - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4OptionsCustomTypeCopiedFlag. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlag - SetValues(value []uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlag - // Increment returns PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, set in PatternFlowIpv4OptionsCustomTypeCopiedFlag. - // PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter is integer counter pattern - Increment() PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - // SetIncrement assigns PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlag. - // PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) PatternFlowIpv4OptionsCustomTypeCopiedFlag - // HasIncrement checks if Increment has been set in PatternFlowIpv4OptionsCustomTypeCopiedFlag - HasIncrement() bool - // Decrement returns PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, set in PatternFlowIpv4OptionsCustomTypeCopiedFlag. - // PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter is integer counter pattern - Decrement() PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - // SetDecrement assigns PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlag. - // PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) PatternFlowIpv4OptionsCustomTypeCopiedFlag - // HasDecrement checks if Decrement has been set in PatternFlowIpv4OptionsCustomTypeCopiedFlag - HasDecrement() bool - setNil() -} - -type PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum string - -// Enum of Choice on PatternFlowIpv4OptionsCustomTypeCopiedFlag -var PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice = struct { - VALUE PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum - VALUES PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum - INCREMENT PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum - DECREMENT PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum -}{ - VALUE: PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum("value"), - VALUES: PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum("values"), - INCREMENT: PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Choice() PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum { - return PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) setChoice(value PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum) PatternFlowIpv4OptionsCustomTypeCopiedFlag { - intValue, ok := otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter().msg() - } - - if value == PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeCopiedFlag object -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) SetValue(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlag { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4OptionsCustomTypeCopiedFlag object -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) SetValues(value []uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlag { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Increment() PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4OptionsCustomTypeCopiedFlagCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter value in the PatternFlowIpv4OptionsCustomTypeCopiedFlag object -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) SetIncrement(value PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) PatternFlowIpv4OptionsCustomTypeCopiedFlag { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Decrement() PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4OptionsCustomTypeCopiedFlagCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter value in the PatternFlowIpv4OptionsCustomTypeCopiedFlag object -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) SetDecrement(value PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) PatternFlowIpv4OptionsCustomTypeCopiedFlag { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeCopiedFlag.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4OptionsCustomTypeCopiedFlag.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4OptionsCustomTypeCopiedFlag") - } - } else { - intVal := otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4OptionsCustomTypeOptionClass ***** -type patternFlowIpv4OptionsCustomTypeOptionClass struct { - validation - obj *otg.PatternFlowIpv4OptionsCustomTypeOptionClass - marshaller marshalPatternFlowIpv4OptionsCustomTypeOptionClass - unMarshaller unMarshalPatternFlowIpv4OptionsCustomTypeOptionClass - incrementHolder PatternFlowIpv4OptionsCustomTypeOptionClassCounter - decrementHolder PatternFlowIpv4OptionsCustomTypeOptionClassCounter -} - -func NewPatternFlowIpv4OptionsCustomTypeOptionClass() PatternFlowIpv4OptionsCustomTypeOptionClass { - obj := patternFlowIpv4OptionsCustomTypeOptionClass{obj: &otg.PatternFlowIpv4OptionsCustomTypeOptionClass{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionClass { - return obj.obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) setMsg(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionClass) PatternFlowIpv4OptionsCustomTypeOptionClass { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4OptionsCustomTypeOptionClass struct { - obj *patternFlowIpv4OptionsCustomTypeOptionClass -} - -type marshalPatternFlowIpv4OptionsCustomTypeOptionClass interface { - // ToProto marshals PatternFlowIpv4OptionsCustomTypeOptionClass to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClass - ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionClass, error) - // ToPbText marshals PatternFlowIpv4OptionsCustomTypeOptionClass to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4OptionsCustomTypeOptionClass to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4OptionsCustomTypeOptionClass to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4OptionsCustomTypeOptionClass struct { - obj *patternFlowIpv4OptionsCustomTypeOptionClass -} - -type unMarshalPatternFlowIpv4OptionsCustomTypeOptionClass interface { - // FromProto unmarshals PatternFlowIpv4OptionsCustomTypeOptionClass from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClass - FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionClass) (PatternFlowIpv4OptionsCustomTypeOptionClass, error) - // FromPbText unmarshals PatternFlowIpv4OptionsCustomTypeOptionClass from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4OptionsCustomTypeOptionClass from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4OptionsCustomTypeOptionClass from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionClass { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4OptionsCustomTypeOptionClass{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionClass { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4OptionsCustomTypeOptionClass{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionClass) ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionClass, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClass) FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionClass) (PatternFlowIpv4OptionsCustomTypeOptionClass, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionClass) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClass) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionClass) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClass) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionClass) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClass) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Clone() (PatternFlowIpv4OptionsCustomTypeOptionClass, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4OptionsCustomTypeOptionClass() - 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 -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4OptionsCustomTypeOptionClass is option class [Ref:https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-1]. -type PatternFlowIpv4OptionsCustomTypeOptionClass interface { - Validation - // msg marshals PatternFlowIpv4OptionsCustomTypeOptionClass to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClass - // and doesn't set defaults - msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionClass - // setMsg unmarshals PatternFlowIpv4OptionsCustomTypeOptionClass from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClass - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4OptionsCustomTypeOptionClass) PatternFlowIpv4OptionsCustomTypeOptionClass - // provides marshal interface - Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionClass - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionClass - // validate validates PatternFlowIpv4OptionsCustomTypeOptionClass - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4OptionsCustomTypeOptionClass, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum, set in PatternFlowIpv4OptionsCustomTypeOptionClass - Choice() PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum - // setChoice assigns PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum provided by user to PatternFlowIpv4OptionsCustomTypeOptionClass - setChoice(value PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum) PatternFlowIpv4OptionsCustomTypeOptionClass - // HasChoice checks if Choice has been set in PatternFlowIpv4OptionsCustomTypeOptionClass - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionClass. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionClass - SetValue(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClass - // HasValue checks if Value has been set in PatternFlowIpv4OptionsCustomTypeOptionClass - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4OptionsCustomTypeOptionClass. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionClass - SetValues(value []uint32) PatternFlowIpv4OptionsCustomTypeOptionClass - // Increment returns PatternFlowIpv4OptionsCustomTypeOptionClassCounter, set in PatternFlowIpv4OptionsCustomTypeOptionClass. - // PatternFlowIpv4OptionsCustomTypeOptionClassCounter is integer counter pattern - Increment() PatternFlowIpv4OptionsCustomTypeOptionClassCounter - // SetIncrement assigns PatternFlowIpv4OptionsCustomTypeOptionClassCounter provided by user to PatternFlowIpv4OptionsCustomTypeOptionClass. - // PatternFlowIpv4OptionsCustomTypeOptionClassCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4OptionsCustomTypeOptionClassCounter) PatternFlowIpv4OptionsCustomTypeOptionClass - // HasIncrement checks if Increment has been set in PatternFlowIpv4OptionsCustomTypeOptionClass - HasIncrement() bool - // Decrement returns PatternFlowIpv4OptionsCustomTypeOptionClassCounter, set in PatternFlowIpv4OptionsCustomTypeOptionClass. - // PatternFlowIpv4OptionsCustomTypeOptionClassCounter is integer counter pattern - Decrement() PatternFlowIpv4OptionsCustomTypeOptionClassCounter - // SetDecrement assigns PatternFlowIpv4OptionsCustomTypeOptionClassCounter provided by user to PatternFlowIpv4OptionsCustomTypeOptionClass. - // PatternFlowIpv4OptionsCustomTypeOptionClassCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4OptionsCustomTypeOptionClassCounter) PatternFlowIpv4OptionsCustomTypeOptionClass - // HasDecrement checks if Decrement has been set in PatternFlowIpv4OptionsCustomTypeOptionClass - HasDecrement() bool - setNil() -} - -type PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum string - -// Enum of Choice on PatternFlowIpv4OptionsCustomTypeOptionClass -var PatternFlowIpv4OptionsCustomTypeOptionClassChoice = struct { - VALUE PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum - VALUES PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum - INCREMENT PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum - DECREMENT PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum -}{ - VALUE: PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum("value"), - VALUES: PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum("values"), - INCREMENT: PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Choice() PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum { - return PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) setChoice(value PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum) PatternFlowIpv4OptionsCustomTypeOptionClass { - intValue, ok := otg.PatternFlowIpv4OptionsCustomTypeOptionClass_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4OptionsCustomTypeOptionClass_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4OptionsCustomTypeOptionClassChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4OptionsCustomTypeOptionClassCounter().msg() - } - - if value == PatternFlowIpv4OptionsCustomTypeOptionClassChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4OptionsCustomTypeOptionClassCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionClass object -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) SetValue(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClass { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionClass object -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) SetValues(value []uint32) PatternFlowIpv4OptionsCustomTypeOptionClass { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4OptionsCustomTypeOptionClassCounter -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Increment() PatternFlowIpv4OptionsCustomTypeOptionClassCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4OptionsCustomTypeOptionClassCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4OptionsCustomTypeOptionClassCounter -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4OptionsCustomTypeOptionClassCounter value in the PatternFlowIpv4OptionsCustomTypeOptionClass object -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) SetIncrement(value PatternFlowIpv4OptionsCustomTypeOptionClassCounter) PatternFlowIpv4OptionsCustomTypeOptionClass { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4OptionsCustomTypeOptionClassCounter -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Decrement() PatternFlowIpv4OptionsCustomTypeOptionClassCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4OptionsCustomTypeOptionClassCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4OptionsCustomTypeOptionClassCounter -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4OptionsCustomTypeOptionClassCounter value in the PatternFlowIpv4OptionsCustomTypeOptionClass object -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) SetDecrement(value PatternFlowIpv4OptionsCustomTypeOptionClassCounter) PatternFlowIpv4OptionsCustomTypeOptionClass { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionClass.Value <= 3 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4OptionsCustomTypeOptionClass.Values <= 3 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4OptionsCustomTypeOptionClassChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4OptionsCustomTypeOptionClassChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4OptionsCustomTypeOptionClass") - } - } else { - intVal := otg.PatternFlowIpv4OptionsCustomTypeOptionClass_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4OptionsCustomTypeOptionClass_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowIpv4OptionsCustomTypeOptionNumber ***** -type patternFlowIpv4OptionsCustomTypeOptionNumber struct { - validation - obj *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber - marshaller marshalPatternFlowIpv4OptionsCustomTypeOptionNumber - unMarshaller unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumber - incrementHolder PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - decrementHolder PatternFlowIpv4OptionsCustomTypeOptionNumberCounter -} - -func NewPatternFlowIpv4OptionsCustomTypeOptionNumber() PatternFlowIpv4OptionsCustomTypeOptionNumber { - obj := patternFlowIpv4OptionsCustomTypeOptionNumber{obj: &otg.PatternFlowIpv4OptionsCustomTypeOptionNumber{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber { - return obj.obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) setMsg(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber) PatternFlowIpv4OptionsCustomTypeOptionNumber { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4OptionsCustomTypeOptionNumber struct { - obj *patternFlowIpv4OptionsCustomTypeOptionNumber -} - -type marshalPatternFlowIpv4OptionsCustomTypeOptionNumber interface { - // ToProto marshals PatternFlowIpv4OptionsCustomTypeOptionNumber to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber - ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionNumber, error) - // ToPbText marshals PatternFlowIpv4OptionsCustomTypeOptionNumber to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4OptionsCustomTypeOptionNumber to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4OptionsCustomTypeOptionNumber to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumber struct { - obj *patternFlowIpv4OptionsCustomTypeOptionNumber -} - -type unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumber interface { - // FromProto unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumber from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber - FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber) (PatternFlowIpv4OptionsCustomTypeOptionNumber, error) - // FromPbText unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumber from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumber from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumber from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionNumber { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4OptionsCustomTypeOptionNumber{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumber { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumber{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionNumber) ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionNumber, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumber) FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber) (PatternFlowIpv4OptionsCustomTypeOptionNumber, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionNumber) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumber) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionNumber) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumber) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionNumber) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumber) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Clone() (PatternFlowIpv4OptionsCustomTypeOptionNumber, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4OptionsCustomTypeOptionNumber() - 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 -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowIpv4OptionsCustomTypeOptionNumber is option Number [Ref:https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-1]. -type PatternFlowIpv4OptionsCustomTypeOptionNumber interface { - Validation - // msg marshals PatternFlowIpv4OptionsCustomTypeOptionNumber to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber - // and doesn't set defaults - msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber - // setMsg unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumber from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4OptionsCustomTypeOptionNumber) PatternFlowIpv4OptionsCustomTypeOptionNumber - // provides marshal interface - Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionNumber - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumber - // validate validates PatternFlowIpv4OptionsCustomTypeOptionNumber - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4OptionsCustomTypeOptionNumber, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum, set in PatternFlowIpv4OptionsCustomTypeOptionNumber - Choice() PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum - // setChoice assigns PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumber - setChoice(value PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum) PatternFlowIpv4OptionsCustomTypeOptionNumber - // HasChoice checks if Choice has been set in PatternFlowIpv4OptionsCustomTypeOptionNumber - HasChoice() bool - // Value returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionNumber. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumber - SetValue(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumber - // HasValue checks if Value has been set in PatternFlowIpv4OptionsCustomTypeOptionNumber - HasValue() bool - // Values returns []uint32, set in PatternFlowIpv4OptionsCustomTypeOptionNumber. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumber - SetValues(value []uint32) PatternFlowIpv4OptionsCustomTypeOptionNumber - // Increment returns PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, set in PatternFlowIpv4OptionsCustomTypeOptionNumber. - // PatternFlowIpv4OptionsCustomTypeOptionNumberCounter is integer counter pattern - Increment() PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - // SetIncrement assigns PatternFlowIpv4OptionsCustomTypeOptionNumberCounter provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumber. - // PatternFlowIpv4OptionsCustomTypeOptionNumberCounter is integer counter pattern - SetIncrement(value PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) PatternFlowIpv4OptionsCustomTypeOptionNumber - // HasIncrement checks if Increment has been set in PatternFlowIpv4OptionsCustomTypeOptionNumber - HasIncrement() bool - // Decrement returns PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, set in PatternFlowIpv4OptionsCustomTypeOptionNumber. - // PatternFlowIpv4OptionsCustomTypeOptionNumberCounter is integer counter pattern - Decrement() PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - // SetDecrement assigns PatternFlowIpv4OptionsCustomTypeOptionNumberCounter provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumber. - // PatternFlowIpv4OptionsCustomTypeOptionNumberCounter is integer counter pattern - SetDecrement(value PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) PatternFlowIpv4OptionsCustomTypeOptionNumber - // HasDecrement checks if Decrement has been set in PatternFlowIpv4OptionsCustomTypeOptionNumber - HasDecrement() bool - setNil() -} - -type PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum string - -// Enum of Choice on PatternFlowIpv4OptionsCustomTypeOptionNumber -var PatternFlowIpv4OptionsCustomTypeOptionNumberChoice = struct { - VALUE PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum - VALUES PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum - INCREMENT PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum - DECREMENT PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum -}{ - VALUE: PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum("value"), - VALUES: PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum("values"), - INCREMENT: PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum("increment"), - DECREMENT: PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum("decrement"), -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Choice() PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum { - return PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) setChoice(value PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum) PatternFlowIpv4OptionsCustomTypeOptionNumber { - intValue, ok := otg.PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowIpv4OptionsCustomTypeOptionNumberCounter().msg() - } - - if value == PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowIpv4OptionsCustomTypeOptionNumberCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionNumber object -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) SetValue(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumber { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionNumber object -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) SetValues(value []uint32) PatternFlowIpv4OptionsCustomTypeOptionNumber { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowIpv4OptionsCustomTypeOptionNumberCounter -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Increment() PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowIpv4OptionsCustomTypeOptionNumberCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowIpv4OptionsCustomTypeOptionNumberCounter -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowIpv4OptionsCustomTypeOptionNumberCounter value in the PatternFlowIpv4OptionsCustomTypeOptionNumber object -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) SetIncrement(value PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) PatternFlowIpv4OptionsCustomTypeOptionNumber { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowIpv4OptionsCustomTypeOptionNumberCounter -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Decrement() PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowIpv4OptionsCustomTypeOptionNumberCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowIpv4OptionsCustomTypeOptionNumberCounter -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowIpv4OptionsCustomTypeOptionNumberCounter value in the PatternFlowIpv4OptionsCustomTypeOptionNumber object -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) SetDecrement(value PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) PatternFlowIpv4OptionsCustomTypeOptionNumber { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionNumber.Value <= 31 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowIpv4OptionsCustomTypeOptionNumber.Values <= 31 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) setDefault() { - var choices_set int = 0 - var choice PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4OptionsCustomTypeOptionNumber") - } - } else { - intVal := otg.PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowSnmpv2CPDURequestIdCounter ***** -type patternFlowSnmpv2CPDURequestIdCounter struct { - validation - obj *otg.PatternFlowSnmpv2CPDURequestIdCounter - marshaller marshalPatternFlowSnmpv2CPDURequestIdCounter - unMarshaller unMarshalPatternFlowSnmpv2CPDURequestIdCounter -} - -func NewPatternFlowSnmpv2CPDURequestIdCounter() PatternFlowSnmpv2CPDURequestIdCounter { - obj := patternFlowSnmpv2CPDURequestIdCounter{obj: &otg.PatternFlowSnmpv2CPDURequestIdCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CPDURequestIdCounter) msg() *otg.PatternFlowSnmpv2CPDURequestIdCounter { - return obj.obj -} - -func (obj *patternFlowSnmpv2CPDURequestIdCounter) setMsg(msg *otg.PatternFlowSnmpv2CPDURequestIdCounter) PatternFlowSnmpv2CPDURequestIdCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CPDURequestIdCounter struct { - obj *patternFlowSnmpv2CPDURequestIdCounter -} - -type marshalPatternFlowSnmpv2CPDURequestIdCounter interface { - // ToProto marshals PatternFlowSnmpv2CPDURequestIdCounter to protobuf object *otg.PatternFlowSnmpv2CPDURequestIdCounter - ToProto() (*otg.PatternFlowSnmpv2CPDURequestIdCounter, error) - // ToPbText marshals PatternFlowSnmpv2CPDURequestIdCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CPDURequestIdCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CPDURequestIdCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CPDURequestIdCounter struct { - obj *patternFlowSnmpv2CPDURequestIdCounter -} - -type unMarshalPatternFlowSnmpv2CPDURequestIdCounter interface { - // FromProto unmarshals PatternFlowSnmpv2CPDURequestIdCounter from protobuf object *otg.PatternFlowSnmpv2CPDURequestIdCounter - FromProto(msg *otg.PatternFlowSnmpv2CPDURequestIdCounter) (PatternFlowSnmpv2CPDURequestIdCounter, error) - // FromPbText unmarshals PatternFlowSnmpv2CPDURequestIdCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CPDURequestIdCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CPDURequestIdCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CPDURequestIdCounter) Marshal() marshalPatternFlowSnmpv2CPDURequestIdCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CPDURequestIdCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CPDURequestIdCounter) Unmarshal() unMarshalPatternFlowSnmpv2CPDURequestIdCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CPDURequestIdCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CPDURequestIdCounter) ToProto() (*otg.PatternFlowSnmpv2CPDURequestIdCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CPDURequestIdCounter) FromProto(msg *otg.PatternFlowSnmpv2CPDURequestIdCounter) (PatternFlowSnmpv2CPDURequestIdCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CPDURequestIdCounter) 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 *unMarshalpatternFlowSnmpv2CPDURequestIdCounter) 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 *marshalpatternFlowSnmpv2CPDURequestIdCounter) 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 *unMarshalpatternFlowSnmpv2CPDURequestIdCounter) 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 *marshalpatternFlowSnmpv2CPDURequestIdCounter) 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 *unMarshalpatternFlowSnmpv2CPDURequestIdCounter) 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 *patternFlowSnmpv2CPDURequestIdCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CPDURequestIdCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CPDURequestIdCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CPDURequestIdCounter) Clone() (PatternFlowSnmpv2CPDURequestIdCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CPDURequestIdCounter() - 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 -} - -// PatternFlowSnmpv2CPDURequestIdCounter is integer counter pattern -type PatternFlowSnmpv2CPDURequestIdCounter interface { - Validation - // msg marshals PatternFlowSnmpv2CPDURequestIdCounter to protobuf object *otg.PatternFlowSnmpv2CPDURequestIdCounter - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CPDURequestIdCounter - // setMsg unmarshals PatternFlowSnmpv2CPDURequestIdCounter from protobuf object *otg.PatternFlowSnmpv2CPDURequestIdCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CPDURequestIdCounter) PatternFlowSnmpv2CPDURequestIdCounter - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CPDURequestIdCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CPDURequestIdCounter - // validate validates PatternFlowSnmpv2CPDURequestIdCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CPDURequestIdCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns int32, set in PatternFlowSnmpv2CPDURequestIdCounter. - Start() int32 - // SetStart assigns int32 provided by user to PatternFlowSnmpv2CPDURequestIdCounter - SetStart(value int32) PatternFlowSnmpv2CPDURequestIdCounter - // HasStart checks if Start has been set in PatternFlowSnmpv2CPDURequestIdCounter - HasStart() bool - // Step returns int32, set in PatternFlowSnmpv2CPDURequestIdCounter. - Step() int32 - // SetStep assigns int32 provided by user to PatternFlowSnmpv2CPDURequestIdCounter - SetStep(value int32) PatternFlowSnmpv2CPDURequestIdCounter - // HasStep checks if Step has been set in PatternFlowSnmpv2CPDURequestIdCounter - HasStep() bool - // Count returns int32, set in PatternFlowSnmpv2CPDURequestIdCounter. - Count() int32 - // SetCount assigns int32 provided by user to PatternFlowSnmpv2CPDURequestIdCounter - SetCount(value int32) PatternFlowSnmpv2CPDURequestIdCounter - // HasCount checks if Count has been set in PatternFlowSnmpv2CPDURequestIdCounter - HasCount() bool -} - -// description is TBD -// Start returns a int32 -func (obj *patternFlowSnmpv2CPDURequestIdCounter) Start() int32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a int32 -func (obj *patternFlowSnmpv2CPDURequestIdCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the int32 value in the PatternFlowSnmpv2CPDURequestIdCounter object -func (obj *patternFlowSnmpv2CPDURequestIdCounter) SetStart(value int32) PatternFlowSnmpv2CPDURequestIdCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a int32 -func (obj *patternFlowSnmpv2CPDURequestIdCounter) Step() int32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a int32 -func (obj *patternFlowSnmpv2CPDURequestIdCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the int32 value in the PatternFlowSnmpv2CPDURequestIdCounter object -func (obj *patternFlowSnmpv2CPDURequestIdCounter) SetStep(value int32) PatternFlowSnmpv2CPDURequestIdCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a int32 -func (obj *patternFlowSnmpv2CPDURequestIdCounter) Count() int32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a int32 -func (obj *patternFlowSnmpv2CPDURequestIdCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the int32 value in the PatternFlowSnmpv2CPDURequestIdCounter object -func (obj *patternFlowSnmpv2CPDURequestIdCounter) SetCount(value int32) PatternFlowSnmpv2CPDURequestIdCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowSnmpv2CPDURequestIdCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowSnmpv2CPDURequestIdCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowSnmpv2CPDUErrorIndexCounter ***** -type patternFlowSnmpv2CPDUErrorIndexCounter struct { - validation - obj *otg.PatternFlowSnmpv2CPDUErrorIndexCounter - marshaller marshalPatternFlowSnmpv2CPDUErrorIndexCounter - unMarshaller unMarshalPatternFlowSnmpv2CPDUErrorIndexCounter -} - -func NewPatternFlowSnmpv2CPDUErrorIndexCounter() PatternFlowSnmpv2CPDUErrorIndexCounter { - obj := patternFlowSnmpv2CPDUErrorIndexCounter{obj: &otg.PatternFlowSnmpv2CPDUErrorIndexCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) msg() *otg.PatternFlowSnmpv2CPDUErrorIndexCounter { - return obj.obj -} - -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) setMsg(msg *otg.PatternFlowSnmpv2CPDUErrorIndexCounter) PatternFlowSnmpv2CPDUErrorIndexCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CPDUErrorIndexCounter struct { - obj *patternFlowSnmpv2CPDUErrorIndexCounter -} - -type marshalPatternFlowSnmpv2CPDUErrorIndexCounter interface { - // ToProto marshals PatternFlowSnmpv2CPDUErrorIndexCounter to protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndexCounter - ToProto() (*otg.PatternFlowSnmpv2CPDUErrorIndexCounter, error) - // ToPbText marshals PatternFlowSnmpv2CPDUErrorIndexCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CPDUErrorIndexCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CPDUErrorIndexCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CPDUErrorIndexCounter struct { - obj *patternFlowSnmpv2CPDUErrorIndexCounter -} - -type unMarshalPatternFlowSnmpv2CPDUErrorIndexCounter interface { - // FromProto unmarshals PatternFlowSnmpv2CPDUErrorIndexCounter from protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndexCounter - FromProto(msg *otg.PatternFlowSnmpv2CPDUErrorIndexCounter) (PatternFlowSnmpv2CPDUErrorIndexCounter, error) - // FromPbText unmarshals PatternFlowSnmpv2CPDUErrorIndexCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CPDUErrorIndexCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CPDUErrorIndexCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) Marshal() marshalPatternFlowSnmpv2CPDUErrorIndexCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CPDUErrorIndexCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) Unmarshal() unMarshalPatternFlowSnmpv2CPDUErrorIndexCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CPDUErrorIndexCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CPDUErrorIndexCounter) ToProto() (*otg.PatternFlowSnmpv2CPDUErrorIndexCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CPDUErrorIndexCounter) FromProto(msg *otg.PatternFlowSnmpv2CPDUErrorIndexCounter) (PatternFlowSnmpv2CPDUErrorIndexCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CPDUErrorIndexCounter) 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 *unMarshalpatternFlowSnmpv2CPDUErrorIndexCounter) 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 *marshalpatternFlowSnmpv2CPDUErrorIndexCounter) 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 *unMarshalpatternFlowSnmpv2CPDUErrorIndexCounter) 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 *marshalpatternFlowSnmpv2CPDUErrorIndexCounter) 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 *unMarshalpatternFlowSnmpv2CPDUErrorIndexCounter) 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 *patternFlowSnmpv2CPDUErrorIndexCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) Clone() (PatternFlowSnmpv2CPDUErrorIndexCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CPDUErrorIndexCounter() - 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 -} - -// PatternFlowSnmpv2CPDUErrorIndexCounter is integer counter pattern -type PatternFlowSnmpv2CPDUErrorIndexCounter interface { - Validation - // msg marshals PatternFlowSnmpv2CPDUErrorIndexCounter to protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndexCounter - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CPDUErrorIndexCounter - // setMsg unmarshals PatternFlowSnmpv2CPDUErrorIndexCounter from protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndexCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CPDUErrorIndexCounter) PatternFlowSnmpv2CPDUErrorIndexCounter - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CPDUErrorIndexCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CPDUErrorIndexCounter - // validate validates PatternFlowSnmpv2CPDUErrorIndexCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CPDUErrorIndexCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowSnmpv2CPDUErrorIndexCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowSnmpv2CPDUErrorIndexCounter - SetStart(value uint32) PatternFlowSnmpv2CPDUErrorIndexCounter - // HasStart checks if Start has been set in PatternFlowSnmpv2CPDUErrorIndexCounter - HasStart() bool - // Step returns uint32, set in PatternFlowSnmpv2CPDUErrorIndexCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowSnmpv2CPDUErrorIndexCounter - SetStep(value uint32) PatternFlowSnmpv2CPDUErrorIndexCounter - // HasStep checks if Step has been set in PatternFlowSnmpv2CPDUErrorIndexCounter - HasStep() bool - // Count returns uint32, set in PatternFlowSnmpv2CPDUErrorIndexCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowSnmpv2CPDUErrorIndexCounter - SetCount(value uint32) PatternFlowSnmpv2CPDUErrorIndexCounter - // HasCount checks if Count has been set in PatternFlowSnmpv2CPDUErrorIndexCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowSnmpv2CPDUErrorIndexCounter object -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) SetStart(value uint32) PatternFlowSnmpv2CPDUErrorIndexCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowSnmpv2CPDUErrorIndexCounter object -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) SetStep(value uint32) PatternFlowSnmpv2CPDUErrorIndexCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowSnmpv2CPDUErrorIndexCounter object -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) SetCount(value uint32) PatternFlowSnmpv2CPDUErrorIndexCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** FlowSnmpv2CVariableBindingValue ***** -type flowSnmpv2CVariableBindingValue struct { - validation - obj *otg.FlowSnmpv2CVariableBindingValue - marshaller marshalFlowSnmpv2CVariableBindingValue - unMarshaller unMarshalFlowSnmpv2CVariableBindingValue - integerValueHolder PatternFlowSnmpv2CVariableBindingValueIntegerValue - stringValueHolder FlowSnmpv2CVariableBindingStringValue - ipAddressValueHolder PatternFlowSnmpv2CVariableBindingValueIpAddressValue - counterValueHolder PatternFlowSnmpv2CVariableBindingValueCounterValue - timeticksValueHolder PatternFlowSnmpv2CVariableBindingValueTimeticksValue - bigCounterValueHolder PatternFlowSnmpv2CVariableBindingValueBigCounterValue - unsignedIntegerValueHolder PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue -} - -func NewFlowSnmpv2CVariableBindingValue() FlowSnmpv2CVariableBindingValue { - obj := flowSnmpv2CVariableBindingValue{obj: &otg.FlowSnmpv2CVariableBindingValue{}} - obj.setDefault() - return &obj -} - -func (obj *flowSnmpv2CVariableBindingValue) msg() *otg.FlowSnmpv2CVariableBindingValue { - return obj.obj -} - -func (obj *flowSnmpv2CVariableBindingValue) setMsg(msg *otg.FlowSnmpv2CVariableBindingValue) FlowSnmpv2CVariableBindingValue { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowSnmpv2CVariableBindingValue struct { - obj *flowSnmpv2CVariableBindingValue -} - -type marshalFlowSnmpv2CVariableBindingValue interface { - // ToProto marshals FlowSnmpv2CVariableBindingValue to protobuf object *otg.FlowSnmpv2CVariableBindingValue - ToProto() (*otg.FlowSnmpv2CVariableBindingValue, error) - // ToPbText marshals FlowSnmpv2CVariableBindingValue to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowSnmpv2CVariableBindingValue to YAML text - ToYaml() (string, error) - // ToJson marshals FlowSnmpv2CVariableBindingValue to JSON text - ToJson() (string, error) -} - -type unMarshalflowSnmpv2CVariableBindingValue struct { - obj *flowSnmpv2CVariableBindingValue -} - -type unMarshalFlowSnmpv2CVariableBindingValue interface { - // FromProto unmarshals FlowSnmpv2CVariableBindingValue from protobuf object *otg.FlowSnmpv2CVariableBindingValue - FromProto(msg *otg.FlowSnmpv2CVariableBindingValue) (FlowSnmpv2CVariableBindingValue, error) - // FromPbText unmarshals FlowSnmpv2CVariableBindingValue from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowSnmpv2CVariableBindingValue from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowSnmpv2CVariableBindingValue from JSON text - FromJson(value string) error -} - -func (obj *flowSnmpv2CVariableBindingValue) Marshal() marshalFlowSnmpv2CVariableBindingValue { - if obj.marshaller == nil { - obj.marshaller = &marshalflowSnmpv2CVariableBindingValue{obj: obj} - } - return obj.marshaller -} - -func (obj *flowSnmpv2CVariableBindingValue) Unmarshal() unMarshalFlowSnmpv2CVariableBindingValue { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowSnmpv2CVariableBindingValue{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowSnmpv2CVariableBindingValue) ToProto() (*otg.FlowSnmpv2CVariableBindingValue, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowSnmpv2CVariableBindingValue) FromProto(msg *otg.FlowSnmpv2CVariableBindingValue) (FlowSnmpv2CVariableBindingValue, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowSnmpv2CVariableBindingValue) 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 *unMarshalflowSnmpv2CVariableBindingValue) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowSnmpv2CVariableBindingValue) 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 *unMarshalflowSnmpv2CVariableBindingValue) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowSnmpv2CVariableBindingValue) 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 *unMarshalflowSnmpv2CVariableBindingValue) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowSnmpv2CVariableBindingValue) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowSnmpv2CVariableBindingValue) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowSnmpv2CVariableBindingValue) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowSnmpv2CVariableBindingValue) Clone() (FlowSnmpv2CVariableBindingValue, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowSnmpv2CVariableBindingValue() - 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 -} - -func (obj *flowSnmpv2CVariableBindingValue) setNil() { - obj.integerValueHolder = nil - obj.stringValueHolder = nil - obj.ipAddressValueHolder = nil - obj.counterValueHolder = nil - obj.timeticksValueHolder = nil - obj.bigCounterValueHolder = nil - obj.unsignedIntegerValueHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowSnmpv2CVariableBindingValue is the value for the object_identifier as per RFC2578. -type FlowSnmpv2CVariableBindingValue interface { - Validation - // msg marshals FlowSnmpv2CVariableBindingValue to protobuf object *otg.FlowSnmpv2CVariableBindingValue - // and doesn't set defaults - msg() *otg.FlowSnmpv2CVariableBindingValue - // setMsg unmarshals FlowSnmpv2CVariableBindingValue from protobuf object *otg.FlowSnmpv2CVariableBindingValue - // and doesn't set defaults - setMsg(*otg.FlowSnmpv2CVariableBindingValue) FlowSnmpv2CVariableBindingValue - // provides marshal interface - Marshal() marshalFlowSnmpv2CVariableBindingValue - // provides unmarshal interface - Unmarshal() unMarshalFlowSnmpv2CVariableBindingValue - // validate validates FlowSnmpv2CVariableBindingValue - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowSnmpv2CVariableBindingValue, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowSnmpv2CVariableBindingValueChoiceEnum, set in FlowSnmpv2CVariableBindingValue - Choice() FlowSnmpv2CVariableBindingValueChoiceEnum - // setChoice assigns FlowSnmpv2CVariableBindingValueChoiceEnum provided by user to FlowSnmpv2CVariableBindingValue - setChoice(value FlowSnmpv2CVariableBindingValueChoiceEnum) FlowSnmpv2CVariableBindingValue - // HasChoice checks if Choice has been set in FlowSnmpv2CVariableBindingValue - HasChoice() bool - // getter for NoValue to set choice. - NoValue() - // IntegerValue returns PatternFlowSnmpv2CVariableBindingValueIntegerValue, set in FlowSnmpv2CVariableBindingValue. - IntegerValue() PatternFlowSnmpv2CVariableBindingValueIntegerValue - // SetIntegerValue assigns PatternFlowSnmpv2CVariableBindingValueIntegerValue provided by user to FlowSnmpv2CVariableBindingValue. - SetIntegerValue(value PatternFlowSnmpv2CVariableBindingValueIntegerValue) FlowSnmpv2CVariableBindingValue - // HasIntegerValue checks if IntegerValue has been set in FlowSnmpv2CVariableBindingValue - HasIntegerValue() bool - // StringValue returns FlowSnmpv2CVariableBindingStringValue, set in FlowSnmpv2CVariableBindingValue. - StringValue() FlowSnmpv2CVariableBindingStringValue - // SetStringValue assigns FlowSnmpv2CVariableBindingStringValue provided by user to FlowSnmpv2CVariableBindingValue. - SetStringValue(value FlowSnmpv2CVariableBindingStringValue) FlowSnmpv2CVariableBindingValue - // HasStringValue checks if StringValue has been set in FlowSnmpv2CVariableBindingValue - HasStringValue() bool - // ObjectIdentifierValue returns string, set in FlowSnmpv2CVariableBindingValue. - ObjectIdentifierValue() string - // SetObjectIdentifierValue assigns string provided by user to FlowSnmpv2CVariableBindingValue - SetObjectIdentifierValue(value string) FlowSnmpv2CVariableBindingValue - // HasObjectIdentifierValue checks if ObjectIdentifierValue has been set in FlowSnmpv2CVariableBindingValue - HasObjectIdentifierValue() bool - // IpAddressValue returns PatternFlowSnmpv2CVariableBindingValueIpAddressValue, set in FlowSnmpv2CVariableBindingValue. - IpAddressValue() PatternFlowSnmpv2CVariableBindingValueIpAddressValue - // SetIpAddressValue assigns PatternFlowSnmpv2CVariableBindingValueIpAddressValue provided by user to FlowSnmpv2CVariableBindingValue. - SetIpAddressValue(value PatternFlowSnmpv2CVariableBindingValueIpAddressValue) FlowSnmpv2CVariableBindingValue - // HasIpAddressValue checks if IpAddressValue has been set in FlowSnmpv2CVariableBindingValue - HasIpAddressValue() bool - // CounterValue returns PatternFlowSnmpv2CVariableBindingValueCounterValue, set in FlowSnmpv2CVariableBindingValue. - CounterValue() PatternFlowSnmpv2CVariableBindingValueCounterValue - // SetCounterValue assigns PatternFlowSnmpv2CVariableBindingValueCounterValue provided by user to FlowSnmpv2CVariableBindingValue. - SetCounterValue(value PatternFlowSnmpv2CVariableBindingValueCounterValue) FlowSnmpv2CVariableBindingValue - // HasCounterValue checks if CounterValue has been set in FlowSnmpv2CVariableBindingValue - HasCounterValue() bool - // TimeticksValue returns PatternFlowSnmpv2CVariableBindingValueTimeticksValue, set in FlowSnmpv2CVariableBindingValue. - TimeticksValue() PatternFlowSnmpv2CVariableBindingValueTimeticksValue - // SetTimeticksValue assigns PatternFlowSnmpv2CVariableBindingValueTimeticksValue provided by user to FlowSnmpv2CVariableBindingValue. - SetTimeticksValue(value PatternFlowSnmpv2CVariableBindingValueTimeticksValue) FlowSnmpv2CVariableBindingValue - // HasTimeticksValue checks if TimeticksValue has been set in FlowSnmpv2CVariableBindingValue - HasTimeticksValue() bool - // ArbitraryValue returns string, set in FlowSnmpv2CVariableBindingValue. - ArbitraryValue() string - // SetArbitraryValue assigns string provided by user to FlowSnmpv2CVariableBindingValue - SetArbitraryValue(value string) FlowSnmpv2CVariableBindingValue - // HasArbitraryValue checks if ArbitraryValue has been set in FlowSnmpv2CVariableBindingValue - HasArbitraryValue() bool - // BigCounterValue returns PatternFlowSnmpv2CVariableBindingValueBigCounterValue, set in FlowSnmpv2CVariableBindingValue. - BigCounterValue() PatternFlowSnmpv2CVariableBindingValueBigCounterValue - // SetBigCounterValue assigns PatternFlowSnmpv2CVariableBindingValueBigCounterValue provided by user to FlowSnmpv2CVariableBindingValue. - SetBigCounterValue(value PatternFlowSnmpv2CVariableBindingValueBigCounterValue) FlowSnmpv2CVariableBindingValue - // HasBigCounterValue checks if BigCounterValue has been set in FlowSnmpv2CVariableBindingValue - HasBigCounterValue() bool - // UnsignedIntegerValue returns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue, set in FlowSnmpv2CVariableBindingValue. - UnsignedIntegerValue() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - // SetUnsignedIntegerValue assigns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue provided by user to FlowSnmpv2CVariableBindingValue. - SetUnsignedIntegerValue(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) FlowSnmpv2CVariableBindingValue - // HasUnsignedIntegerValue checks if UnsignedIntegerValue has been set in FlowSnmpv2CVariableBindingValue - HasUnsignedIntegerValue() bool - setNil() -} - -type FlowSnmpv2CVariableBindingValueChoiceEnum string - -// Enum of Choice on FlowSnmpv2CVariableBindingValue -var FlowSnmpv2CVariableBindingValueChoice = struct { - NO_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum - INTEGER_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum - STRING_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum - OBJECT_IDENTIFIER_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum - IP_ADDRESS_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum - COUNTER_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum - TIMETICKS_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum - ARBITRARY_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum - BIG_COUNTER_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum - UNSIGNED_INTEGER_VALUE FlowSnmpv2CVariableBindingValueChoiceEnum -}{ - NO_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("no_value"), - INTEGER_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("integer_value"), - STRING_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("string_value"), - OBJECT_IDENTIFIER_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("object_identifier_value"), - IP_ADDRESS_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("ip_address_value"), - COUNTER_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("counter_value"), - TIMETICKS_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("timeticks_value"), - ARBITRARY_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("arbitrary_value"), - BIG_COUNTER_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("big_counter_value"), - UNSIGNED_INTEGER_VALUE: FlowSnmpv2CVariableBindingValueChoiceEnum("unsigned_integer_value"), -} - -func (obj *flowSnmpv2CVariableBindingValue) Choice() FlowSnmpv2CVariableBindingValueChoiceEnum { - return FlowSnmpv2CVariableBindingValueChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// getter for NoValue to set choice -func (obj *flowSnmpv2CVariableBindingValue) NoValue() { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.NO_VALUE) -} - -// description is TBD -// Choice returns a string -func (obj *flowSnmpv2CVariableBindingValue) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowSnmpv2CVariableBindingValue) setChoice(value FlowSnmpv2CVariableBindingValueChoiceEnum) FlowSnmpv2CVariableBindingValue { - intValue, ok := otg.FlowSnmpv2CVariableBindingValue_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowSnmpv2CVariableBindingValueChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowSnmpv2CVariableBindingValue_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.UnsignedIntegerValue = nil - obj.unsignedIntegerValueHolder = nil - obj.obj.BigCounterValue = nil - obj.bigCounterValueHolder = nil - obj.obj.ArbitraryValue = nil - obj.obj.TimeticksValue = nil - obj.timeticksValueHolder = nil - obj.obj.CounterValue = nil - obj.counterValueHolder = nil - obj.obj.IpAddressValue = nil - obj.ipAddressValueHolder = nil - obj.obj.ObjectIdentifierValue = nil - obj.obj.StringValue = nil - obj.stringValueHolder = nil - obj.obj.IntegerValue = nil - obj.integerValueHolder = nil - - if value == FlowSnmpv2CVariableBindingValueChoice.INTEGER_VALUE { - obj.obj.IntegerValue = NewPatternFlowSnmpv2CVariableBindingValueIntegerValue().msg() - } - - if value == FlowSnmpv2CVariableBindingValueChoice.STRING_VALUE { - obj.obj.StringValue = NewFlowSnmpv2CVariableBindingStringValue().msg() - } - - if value == FlowSnmpv2CVariableBindingValueChoice.OBJECT_IDENTIFIER_VALUE { - defaultValue := "0.1" - obj.obj.ObjectIdentifierValue = &defaultValue - } - - if value == FlowSnmpv2CVariableBindingValueChoice.IP_ADDRESS_VALUE { - obj.obj.IpAddressValue = NewPatternFlowSnmpv2CVariableBindingValueIpAddressValue().msg() - } - - if value == FlowSnmpv2CVariableBindingValueChoice.COUNTER_VALUE { - obj.obj.CounterValue = NewPatternFlowSnmpv2CVariableBindingValueCounterValue().msg() - } - - if value == FlowSnmpv2CVariableBindingValueChoice.TIMETICKS_VALUE { - obj.obj.TimeticksValue = NewPatternFlowSnmpv2CVariableBindingValueTimeticksValue().msg() - } - - if value == FlowSnmpv2CVariableBindingValueChoice.ARBITRARY_VALUE { - defaultValue := "00" - obj.obj.ArbitraryValue = &defaultValue - } - - if value == FlowSnmpv2CVariableBindingValueChoice.BIG_COUNTER_VALUE { - obj.obj.BigCounterValue = NewPatternFlowSnmpv2CVariableBindingValueBigCounterValue().msg() - } - - if value == FlowSnmpv2CVariableBindingValueChoice.UNSIGNED_INTEGER_VALUE { - obj.obj.UnsignedIntegerValue = NewPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue().msg() - } - - return obj -} - -// description is TBD -// IntegerValue returns a PatternFlowSnmpv2CVariableBindingValueIntegerValue -func (obj *flowSnmpv2CVariableBindingValue) IntegerValue() PatternFlowSnmpv2CVariableBindingValueIntegerValue { - if obj.obj.IntegerValue == nil { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.INTEGER_VALUE) - } - if obj.integerValueHolder == nil { - obj.integerValueHolder = &patternFlowSnmpv2CVariableBindingValueIntegerValue{obj: obj.obj.IntegerValue} - } - return obj.integerValueHolder -} - -// description is TBD -// IntegerValue returns a PatternFlowSnmpv2CVariableBindingValueIntegerValue -func (obj *flowSnmpv2CVariableBindingValue) HasIntegerValue() bool { - return obj.obj.IntegerValue != nil -} - -// description is TBD -// SetIntegerValue sets the PatternFlowSnmpv2CVariableBindingValueIntegerValue value in the FlowSnmpv2CVariableBindingValue object -func (obj *flowSnmpv2CVariableBindingValue) SetIntegerValue(value PatternFlowSnmpv2CVariableBindingValueIntegerValue) FlowSnmpv2CVariableBindingValue { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.INTEGER_VALUE) - obj.integerValueHolder = nil - obj.obj.IntegerValue = value.msg() - - return obj -} - -// description is TBD -// StringValue returns a FlowSnmpv2CVariableBindingStringValue -func (obj *flowSnmpv2CVariableBindingValue) StringValue() FlowSnmpv2CVariableBindingStringValue { - if obj.obj.StringValue == nil { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.STRING_VALUE) - } - if obj.stringValueHolder == nil { - obj.stringValueHolder = &flowSnmpv2CVariableBindingStringValue{obj: obj.obj.StringValue} - } - return obj.stringValueHolder -} - -// description is TBD -// StringValue returns a FlowSnmpv2CVariableBindingStringValue -func (obj *flowSnmpv2CVariableBindingValue) HasStringValue() bool { - return obj.obj.StringValue != nil -} - -// description is TBD -// SetStringValue sets the FlowSnmpv2CVariableBindingStringValue value in the FlowSnmpv2CVariableBindingValue object -func (obj *flowSnmpv2CVariableBindingValue) SetStringValue(value FlowSnmpv2CVariableBindingStringValue) FlowSnmpv2CVariableBindingValue { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.STRING_VALUE) - obj.stringValueHolder = nil - obj.obj.StringValue = value.msg() - - return obj -} - -// The Object Identifier points to a particular parameter in the SNMP agent. -// - Encoding of this field follows RFC2578(section 3.5) and ASN.1 X.690(section 8.1.3.6) specification. -// Refer: http://www.itu.int/ITU-T/asn1/ -// - According to BER, the first two numbers of any OID (x.y) are encoded as one value using the formula (40*x)+y. -// Example, the first two numbers of an SNMP OID 1.3... are encoded as 43 or 0x2B, because (40*1)+3 = 43. -// - After the first two numbers are encoded, the subsequent numbers in the OID are each encoded as a byte. -// - However, a special rule is required for large numbers because one byte can only represent a number from 0-127. -// - The rule for large numbers states that only the lower 7 bits in the byte are used for holding the value (0-127). -// - The highest order bit(8th) is used as a flag to indicate that this number spans more than one byte. Therefore, any number over 127 must be encoded using more than one byte. -// - Example, the number 2680 in the OID '1.3.6.1.4.1.2680.1.2.7.3.2.0' cannot be encoded using a single byte. -// According to this rule, the number 2680 must be encoded as 0x94 0x78. -// Since the most significant bit is set in the first byte (0x94), it indicates that number spans to the next byte. -// Since the most significant bit is not set in the next byte (0x78), it indicates that the number ends at the second byte. -// The value is derived by appending 7 bits from each of the concatenated bytes i.e (0x14 *128^1) + (0x78 * 128^0) = 2680. -// ObjectIdentifierValue returns a string -func (obj *flowSnmpv2CVariableBindingValue) ObjectIdentifierValue() string { - - if obj.obj.ObjectIdentifierValue == nil { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.OBJECT_IDENTIFIER_VALUE) - } - - return *obj.obj.ObjectIdentifierValue - -} - -// The Object Identifier points to a particular parameter in the SNMP agent. -// - Encoding of this field follows RFC2578(section 3.5) and ASN.1 X.690(section 8.1.3.6) specification. -// Refer: http://www.itu.int/ITU-T/asn1/ -// - According to BER, the first two numbers of any OID (x.y) are encoded as one value using the formula (40*x)+y. -// Example, the first two numbers of an SNMP OID 1.3... are encoded as 43 or 0x2B, because (40*1)+3 = 43. -// - After the first two numbers are encoded, the subsequent numbers in the OID are each encoded as a byte. -// - However, a special rule is required for large numbers because one byte can only represent a number from 0-127. -// - The rule for large numbers states that only the lower 7 bits in the byte are used for holding the value (0-127). -// - The highest order bit(8th) is used as a flag to indicate that this number spans more than one byte. Therefore, any number over 127 must be encoded using more than one byte. -// - Example, the number 2680 in the OID '1.3.6.1.4.1.2680.1.2.7.3.2.0' cannot be encoded using a single byte. -// According to this rule, the number 2680 must be encoded as 0x94 0x78. -// Since the most significant bit is set in the first byte (0x94), it indicates that number spans to the next byte. -// Since the most significant bit is not set in the next byte (0x78), it indicates that the number ends at the second byte. -// The value is derived by appending 7 bits from each of the concatenated bytes i.e (0x14 *128^1) + (0x78 * 128^0) = 2680. -// ObjectIdentifierValue returns a string -func (obj *flowSnmpv2CVariableBindingValue) HasObjectIdentifierValue() bool { - return obj.obj.ObjectIdentifierValue != nil -} - -// The Object Identifier points to a particular parameter in the SNMP agent. -// - Encoding of this field follows RFC2578(section 3.5) and ASN.1 X.690(section 8.1.3.6) specification. -// Refer: http://www.itu.int/ITU-T/asn1/ -// - According to BER, the first two numbers of any OID (x.y) are encoded as one value using the formula (40*x)+y. -// Example, the first two numbers of an SNMP OID 1.3... are encoded as 43 or 0x2B, because (40*1)+3 = 43. -// - After the first two numbers are encoded, the subsequent numbers in the OID are each encoded as a byte. -// - However, a special rule is required for large numbers because one byte can only represent a number from 0-127. -// - The rule for large numbers states that only the lower 7 bits in the byte are used for holding the value (0-127). -// - The highest order bit(8th) is used as a flag to indicate that this number spans more than one byte. Therefore, any number over 127 must be encoded using more than one byte. -// - Example, the number 2680 in the OID '1.3.6.1.4.1.2680.1.2.7.3.2.0' cannot be encoded using a single byte. -// According to this rule, the number 2680 must be encoded as 0x94 0x78. -// Since the most significant bit is set in the first byte (0x94), it indicates that number spans to the next byte. -// Since the most significant bit is not set in the next byte (0x78), it indicates that the number ends at the second byte. -// The value is derived by appending 7 bits from each of the concatenated bytes i.e (0x14 *128^1) + (0x78 * 128^0) = 2680. -// SetObjectIdentifierValue sets the string value in the FlowSnmpv2CVariableBindingValue object -func (obj *flowSnmpv2CVariableBindingValue) SetObjectIdentifierValue(value string) FlowSnmpv2CVariableBindingValue { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.OBJECT_IDENTIFIER_VALUE) - obj.obj.ObjectIdentifierValue = &value - return obj -} - -// description is TBD -// IpAddressValue returns a PatternFlowSnmpv2CVariableBindingValueIpAddressValue -func (obj *flowSnmpv2CVariableBindingValue) IpAddressValue() PatternFlowSnmpv2CVariableBindingValueIpAddressValue { - if obj.obj.IpAddressValue == nil { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.IP_ADDRESS_VALUE) - } - if obj.ipAddressValueHolder == nil { - obj.ipAddressValueHolder = &patternFlowSnmpv2CVariableBindingValueIpAddressValue{obj: obj.obj.IpAddressValue} - } - return obj.ipAddressValueHolder -} - -// description is TBD -// IpAddressValue returns a PatternFlowSnmpv2CVariableBindingValueIpAddressValue -func (obj *flowSnmpv2CVariableBindingValue) HasIpAddressValue() bool { - return obj.obj.IpAddressValue != nil -} - -// description is TBD -// SetIpAddressValue sets the PatternFlowSnmpv2CVariableBindingValueIpAddressValue value in the FlowSnmpv2CVariableBindingValue object -func (obj *flowSnmpv2CVariableBindingValue) SetIpAddressValue(value PatternFlowSnmpv2CVariableBindingValueIpAddressValue) FlowSnmpv2CVariableBindingValue { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.IP_ADDRESS_VALUE) - obj.ipAddressValueHolder = nil - obj.obj.IpAddressValue = value.msg() - - return obj -} - -// description is TBD -// CounterValue returns a PatternFlowSnmpv2CVariableBindingValueCounterValue -func (obj *flowSnmpv2CVariableBindingValue) CounterValue() PatternFlowSnmpv2CVariableBindingValueCounterValue { - if obj.obj.CounterValue == nil { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.COUNTER_VALUE) - } - if obj.counterValueHolder == nil { - obj.counterValueHolder = &patternFlowSnmpv2CVariableBindingValueCounterValue{obj: obj.obj.CounterValue} - } - return obj.counterValueHolder -} - -// description is TBD -// CounterValue returns a PatternFlowSnmpv2CVariableBindingValueCounterValue -func (obj *flowSnmpv2CVariableBindingValue) HasCounterValue() bool { - return obj.obj.CounterValue != nil -} - -// description is TBD -// SetCounterValue sets the PatternFlowSnmpv2CVariableBindingValueCounterValue value in the FlowSnmpv2CVariableBindingValue object -func (obj *flowSnmpv2CVariableBindingValue) SetCounterValue(value PatternFlowSnmpv2CVariableBindingValueCounterValue) FlowSnmpv2CVariableBindingValue { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.COUNTER_VALUE) - obj.counterValueHolder = nil - obj.obj.CounterValue = value.msg() - - return obj -} - -// description is TBD -// TimeticksValue returns a PatternFlowSnmpv2CVariableBindingValueTimeticksValue -func (obj *flowSnmpv2CVariableBindingValue) TimeticksValue() PatternFlowSnmpv2CVariableBindingValueTimeticksValue { - if obj.obj.TimeticksValue == nil { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.TIMETICKS_VALUE) - } - if obj.timeticksValueHolder == nil { - obj.timeticksValueHolder = &patternFlowSnmpv2CVariableBindingValueTimeticksValue{obj: obj.obj.TimeticksValue} - } - return obj.timeticksValueHolder -} - -// description is TBD -// TimeticksValue returns a PatternFlowSnmpv2CVariableBindingValueTimeticksValue -func (obj *flowSnmpv2CVariableBindingValue) HasTimeticksValue() bool { - return obj.obj.TimeticksValue != nil -} - -// description is TBD -// SetTimeticksValue sets the PatternFlowSnmpv2CVariableBindingValueTimeticksValue value in the FlowSnmpv2CVariableBindingValue object -func (obj *flowSnmpv2CVariableBindingValue) SetTimeticksValue(value PatternFlowSnmpv2CVariableBindingValueTimeticksValue) FlowSnmpv2CVariableBindingValue { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.TIMETICKS_VALUE) - obj.timeticksValueHolder = nil - obj.obj.TimeticksValue = value.msg() - - return obj -} - -// It contains the hex bytes of the value to be sent. As of now it is restricted to 10000 bytes. -// ArbitraryValue returns a string -func (obj *flowSnmpv2CVariableBindingValue) ArbitraryValue() string { - - if obj.obj.ArbitraryValue == nil { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.ARBITRARY_VALUE) - } - - return *obj.obj.ArbitraryValue - -} - -// It contains the hex bytes of the value to be sent. As of now it is restricted to 10000 bytes. -// ArbitraryValue returns a string -func (obj *flowSnmpv2CVariableBindingValue) HasArbitraryValue() bool { - return obj.obj.ArbitraryValue != nil -} - -// It contains the hex bytes of the value to be sent. As of now it is restricted to 10000 bytes. -// SetArbitraryValue sets the string value in the FlowSnmpv2CVariableBindingValue object -func (obj *flowSnmpv2CVariableBindingValue) SetArbitraryValue(value string) FlowSnmpv2CVariableBindingValue { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.ARBITRARY_VALUE) - obj.obj.ArbitraryValue = &value - return obj -} - -// description is TBD -// BigCounterValue returns a PatternFlowSnmpv2CVariableBindingValueBigCounterValue -func (obj *flowSnmpv2CVariableBindingValue) BigCounterValue() PatternFlowSnmpv2CVariableBindingValueBigCounterValue { - if obj.obj.BigCounterValue == nil { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.BIG_COUNTER_VALUE) - } - if obj.bigCounterValueHolder == nil { - obj.bigCounterValueHolder = &patternFlowSnmpv2CVariableBindingValueBigCounterValue{obj: obj.obj.BigCounterValue} - } - return obj.bigCounterValueHolder -} - -// description is TBD -// BigCounterValue returns a PatternFlowSnmpv2CVariableBindingValueBigCounterValue -func (obj *flowSnmpv2CVariableBindingValue) HasBigCounterValue() bool { - return obj.obj.BigCounterValue != nil -} - -// description is TBD -// SetBigCounterValue sets the PatternFlowSnmpv2CVariableBindingValueBigCounterValue value in the FlowSnmpv2CVariableBindingValue object -func (obj *flowSnmpv2CVariableBindingValue) SetBigCounterValue(value PatternFlowSnmpv2CVariableBindingValueBigCounterValue) FlowSnmpv2CVariableBindingValue { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.BIG_COUNTER_VALUE) - obj.bigCounterValueHolder = nil - obj.obj.BigCounterValue = value.msg() - - return obj -} - -// description is TBD -// UnsignedIntegerValue returns a PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue -func (obj *flowSnmpv2CVariableBindingValue) UnsignedIntegerValue() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { - if obj.obj.UnsignedIntegerValue == nil { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.UNSIGNED_INTEGER_VALUE) - } - if obj.unsignedIntegerValueHolder == nil { - obj.unsignedIntegerValueHolder = &patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue{obj: obj.obj.UnsignedIntegerValue} - } - return obj.unsignedIntegerValueHolder -} - -// description is TBD -// UnsignedIntegerValue returns a PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue -func (obj *flowSnmpv2CVariableBindingValue) HasUnsignedIntegerValue() bool { - return obj.obj.UnsignedIntegerValue != nil -} - -// description is TBD -// SetUnsignedIntegerValue sets the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue value in the FlowSnmpv2CVariableBindingValue object -func (obj *flowSnmpv2CVariableBindingValue) SetUnsignedIntegerValue(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) FlowSnmpv2CVariableBindingValue { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.UNSIGNED_INTEGER_VALUE) - obj.unsignedIntegerValueHolder = nil - obj.obj.UnsignedIntegerValue = value.msg() - - return obj -} - -func (obj *flowSnmpv2CVariableBindingValue) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.IntegerValue != nil { - - obj.IntegerValue().validateObj(vObj, set_default) - } - - if obj.obj.StringValue != nil { - - obj.StringValue().validateObj(vObj, set_default) - } - - if obj.obj.ObjectIdentifierValue != nil { - - err := obj.validateOid(obj.ObjectIdentifierValue()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on FlowSnmpv2CVariableBindingValue.ObjectIdentifierValue")) - } - - } - - if obj.obj.IpAddressValue != nil { - - obj.IpAddressValue().validateObj(vObj, set_default) - } - - if obj.obj.CounterValue != nil { - - obj.CounterValue().validateObj(vObj, set_default) - } - - if obj.obj.TimeticksValue != nil { - - obj.TimeticksValue().validateObj(vObj, set_default) - } - - if obj.obj.ArbitraryValue != nil { - - if len(*obj.obj.ArbitraryValue) > 10000 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "None <= length of FlowSnmpv2CVariableBindingValue.ArbitraryValue <= 10000 but Got %d", - len(*obj.obj.ArbitraryValue))) - } - - } - - if obj.obj.BigCounterValue != nil { - - obj.BigCounterValue().validateObj(vObj, set_default) - } - - if obj.obj.UnsignedIntegerValue != nil { - - obj.UnsignedIntegerValue().validateObj(vObj, set_default) - } - -} - -func (obj *flowSnmpv2CVariableBindingValue) setDefault() { - var choices_set int = 0 - var choice FlowSnmpv2CVariableBindingValueChoiceEnum - - if obj.obj.IntegerValue != nil { - choices_set += 1 - choice = FlowSnmpv2CVariableBindingValueChoice.INTEGER_VALUE - } - - if obj.obj.StringValue != nil { - choices_set += 1 - choice = FlowSnmpv2CVariableBindingValueChoice.STRING_VALUE - } - - if obj.obj.ObjectIdentifierValue != nil { - choices_set += 1 - choice = FlowSnmpv2CVariableBindingValueChoice.OBJECT_IDENTIFIER_VALUE - } - - if obj.obj.IpAddressValue != nil { - choices_set += 1 - choice = FlowSnmpv2CVariableBindingValueChoice.IP_ADDRESS_VALUE - } - - if obj.obj.CounterValue != nil { - choices_set += 1 - choice = FlowSnmpv2CVariableBindingValueChoice.COUNTER_VALUE - } - - if obj.obj.TimeticksValue != nil { - choices_set += 1 - choice = FlowSnmpv2CVariableBindingValueChoice.TIMETICKS_VALUE - } - - if obj.obj.ArbitraryValue != nil { - choices_set += 1 - choice = FlowSnmpv2CVariableBindingValueChoice.ARBITRARY_VALUE - } - - if obj.obj.BigCounterValue != nil { - choices_set += 1 - choice = FlowSnmpv2CVariableBindingValueChoice.BIG_COUNTER_VALUE - } - - if obj.obj.UnsignedIntegerValue != nil { - choices_set += 1 - choice = FlowSnmpv2CVariableBindingValueChoice.UNSIGNED_INTEGER_VALUE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowSnmpv2CVariableBindingValueChoice.NO_VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowSnmpv2CVariableBindingValue") - } - } else { - intVal := otg.FlowSnmpv2CVariableBindingValue_Choice_Enum_value[string(choice)] - enumValue := otg.FlowSnmpv2CVariableBindingValue_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowSnmpv2CBulkPDURequestIdCounter ***** -type patternFlowSnmpv2CBulkPDURequestIdCounter struct { - validation - obj *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter - marshaller marshalPatternFlowSnmpv2CBulkPDURequestIdCounter - unMarshaller unMarshalPatternFlowSnmpv2CBulkPDURequestIdCounter -} - -func NewPatternFlowSnmpv2CBulkPDURequestIdCounter() PatternFlowSnmpv2CBulkPDURequestIdCounter { - obj := patternFlowSnmpv2CBulkPDURequestIdCounter{obj: &otg.PatternFlowSnmpv2CBulkPDURequestIdCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) msg() *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter { - return obj.obj -} - -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) setMsg(msg *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter) PatternFlowSnmpv2CBulkPDURequestIdCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CBulkPDURequestIdCounter struct { - obj *patternFlowSnmpv2CBulkPDURequestIdCounter -} - -type marshalPatternFlowSnmpv2CBulkPDURequestIdCounter interface { - // ToProto marshals PatternFlowSnmpv2CBulkPDURequestIdCounter to protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter - ToProto() (*otg.PatternFlowSnmpv2CBulkPDURequestIdCounter, error) - // ToPbText marshals PatternFlowSnmpv2CBulkPDURequestIdCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CBulkPDURequestIdCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CBulkPDURequestIdCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CBulkPDURequestIdCounter struct { - obj *patternFlowSnmpv2CBulkPDURequestIdCounter -} - -type unMarshalPatternFlowSnmpv2CBulkPDURequestIdCounter interface { - // FromProto unmarshals PatternFlowSnmpv2CBulkPDURequestIdCounter from protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter - FromProto(msg *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter) (PatternFlowSnmpv2CBulkPDURequestIdCounter, error) - // FromPbText unmarshals PatternFlowSnmpv2CBulkPDURequestIdCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CBulkPDURequestIdCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CBulkPDURequestIdCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) Marshal() marshalPatternFlowSnmpv2CBulkPDURequestIdCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CBulkPDURequestIdCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDURequestIdCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CBulkPDURequestIdCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CBulkPDURequestIdCounter) ToProto() (*otg.PatternFlowSnmpv2CBulkPDURequestIdCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CBulkPDURequestIdCounter) FromProto(msg *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter) (PatternFlowSnmpv2CBulkPDURequestIdCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CBulkPDURequestIdCounter) 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 *unMarshalpatternFlowSnmpv2CBulkPDURequestIdCounter) 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 *marshalpatternFlowSnmpv2CBulkPDURequestIdCounter) 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 *unMarshalpatternFlowSnmpv2CBulkPDURequestIdCounter) 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 *marshalpatternFlowSnmpv2CBulkPDURequestIdCounter) 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 *unMarshalpatternFlowSnmpv2CBulkPDURequestIdCounter) 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 *patternFlowSnmpv2CBulkPDURequestIdCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) Clone() (PatternFlowSnmpv2CBulkPDURequestIdCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CBulkPDURequestIdCounter() - 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 -} - -// PatternFlowSnmpv2CBulkPDURequestIdCounter is integer counter pattern -type PatternFlowSnmpv2CBulkPDURequestIdCounter interface { - Validation - // msg marshals PatternFlowSnmpv2CBulkPDURequestIdCounter to protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter - // setMsg unmarshals PatternFlowSnmpv2CBulkPDURequestIdCounter from protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CBulkPDURequestIdCounter) PatternFlowSnmpv2CBulkPDURequestIdCounter - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CBulkPDURequestIdCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDURequestIdCounter - // validate validates PatternFlowSnmpv2CBulkPDURequestIdCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CBulkPDURequestIdCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns int32, set in PatternFlowSnmpv2CBulkPDURequestIdCounter. - Start() int32 - // SetStart assigns int32 provided by user to PatternFlowSnmpv2CBulkPDURequestIdCounter - SetStart(value int32) PatternFlowSnmpv2CBulkPDURequestIdCounter - // HasStart checks if Start has been set in PatternFlowSnmpv2CBulkPDURequestIdCounter - HasStart() bool - // Step returns int32, set in PatternFlowSnmpv2CBulkPDURequestIdCounter. - Step() int32 - // SetStep assigns int32 provided by user to PatternFlowSnmpv2CBulkPDURequestIdCounter - SetStep(value int32) PatternFlowSnmpv2CBulkPDURequestIdCounter - // HasStep checks if Step has been set in PatternFlowSnmpv2CBulkPDURequestIdCounter - HasStep() bool - // Count returns int32, set in PatternFlowSnmpv2CBulkPDURequestIdCounter. - Count() int32 - // SetCount assigns int32 provided by user to PatternFlowSnmpv2CBulkPDURequestIdCounter - SetCount(value int32) PatternFlowSnmpv2CBulkPDURequestIdCounter - // HasCount checks if Count has been set in PatternFlowSnmpv2CBulkPDURequestIdCounter - HasCount() bool -} - -// description is TBD -// Start returns a int32 -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) Start() int32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a int32 -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the int32 value in the PatternFlowSnmpv2CBulkPDURequestIdCounter object -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) SetStart(value int32) PatternFlowSnmpv2CBulkPDURequestIdCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a int32 -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) Step() int32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a int32 -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the int32 value in the PatternFlowSnmpv2CBulkPDURequestIdCounter object -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) SetStep(value int32) PatternFlowSnmpv2CBulkPDURequestIdCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a int32 -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) Count() int32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a int32 -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the int32 value in the PatternFlowSnmpv2CBulkPDURequestIdCounter object -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) SetCount(value int32) PatternFlowSnmpv2CBulkPDURequestIdCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter ***** -type patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter struct { - validation - obj *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - marshaller marshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - unMarshaller unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter -} - -func NewPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter() PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { - obj := patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter{obj: &otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) msg() *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { - return obj.obj -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) setMsg(msg *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter struct { - obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter -} - -type marshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter interface { - // ToProto marshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter to protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - ToProto() (*otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, error) - // ToPbText marshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter struct { - obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter -} - -type unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter interface { - // FromProto unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter from protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - FromProto(msg *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) (PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, error) - // FromPbText unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) Marshal() marshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) ToProto() (*otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) FromProto(msg *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) (PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) 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 *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) 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 *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) 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 *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) 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 *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) 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 *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) 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 *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) Clone() (PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter() - 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 -} - -// PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter is integer counter pattern -type PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter interface { - Validation - // msg marshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter to protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - // setMsg unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter from protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - // validate validates PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - SetStart(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - // HasStart checks if Start has been set in PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - HasStart() bool - // Step returns uint32, set in PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - SetStep(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - // HasStep checks if Step has been set in PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - HasStep() bool - // Count returns uint32, set in PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - SetCount(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - // HasCount checks if Count has been set in PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter object -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) SetStart(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter object -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) SetStep(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter object -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) SetCount(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** FlowRSVPPathObjectsClass ***** -type flowRSVPPathObjectsClass struct { - validation - obj *otg.FlowRSVPPathObjectsClass - marshaller marshalFlowRSVPPathObjectsClass - unMarshaller unMarshalFlowRSVPPathObjectsClass - sessionHolder FlowRSVPPathObjectsClassSession - rsvpHopHolder FlowRSVPPathObjectsClassRsvpHop - timeValuesHolder FlowRSVPPathObjectsClassTimeValues - explicitRouteHolder FlowRSVPPathObjectsClassExplicitRoute - labelRequestHolder FlowRSVPPathObjectsClassLabelRequest - sessionAttributeHolder FlowRSVPPathObjectsClassSessionAttribute - senderTemplateHolder FlowRSVPPathObjectsClassSenderTemplate - senderTspecHolder FlowRSVPPathObjectsClassSenderTspec - recordRouteHolder FlowRSVPPathObjectsClassRecordRoute - customHolder FlowRSVPPathObjectsCustom -} - -func NewFlowRSVPPathObjectsClass() FlowRSVPPathObjectsClass { - obj := flowRSVPPathObjectsClass{obj: &otg.FlowRSVPPathObjectsClass{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsClass) msg() *otg.FlowRSVPPathObjectsClass { - return obj.obj -} - -func (obj *flowRSVPPathObjectsClass) setMsg(msg *otg.FlowRSVPPathObjectsClass) FlowRSVPPathObjectsClass { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsClass struct { - obj *flowRSVPPathObjectsClass -} - -type marshalFlowRSVPPathObjectsClass interface { - // ToProto marshals FlowRSVPPathObjectsClass to protobuf object *otg.FlowRSVPPathObjectsClass - ToProto() (*otg.FlowRSVPPathObjectsClass, error) - // ToPbText marshals FlowRSVPPathObjectsClass to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsClass to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsClass to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsClass struct { - obj *flowRSVPPathObjectsClass -} - -type unMarshalFlowRSVPPathObjectsClass interface { - // FromProto unmarshals FlowRSVPPathObjectsClass from protobuf object *otg.FlowRSVPPathObjectsClass - FromProto(msg *otg.FlowRSVPPathObjectsClass) (FlowRSVPPathObjectsClass, error) - // FromPbText unmarshals FlowRSVPPathObjectsClass from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsClass from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsClass from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsClass) Marshal() marshalFlowRSVPPathObjectsClass { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsClass{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsClass) Unmarshal() unMarshalFlowRSVPPathObjectsClass { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsClass{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsClass) ToProto() (*otg.FlowRSVPPathObjectsClass, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsClass) FromProto(msg *otg.FlowRSVPPathObjectsClass) (FlowRSVPPathObjectsClass, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsClass) 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 *unMarshalflowRSVPPathObjectsClass) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsClass) 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 *unMarshalflowRSVPPathObjectsClass) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsClass) 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 *unMarshalflowRSVPPathObjectsClass) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsClass) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClass) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClass) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsClass) Clone() (FlowRSVPPathObjectsClass, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsClass() - 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 -} - -func (obj *flowRSVPPathObjectsClass) setNil() { - obj.sessionHolder = nil - obj.rsvpHopHolder = nil - obj.timeValuesHolder = nil - obj.explicitRouteHolder = nil - obj.labelRequestHolder = nil - obj.sessionAttributeHolder = nil - obj.senderTemplateHolder = nil - obj.senderTspecHolder = nil - obj.recordRouteHolder = nil - obj.customHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsClass is the class number is used to identify the class of an object. Defined in https://www.iana.org/assignments/rsvp-parameters/rsvp-parameters.xhtml#rsvp-parameters-4 . Curently supported class numbers are for "Path" message type. "Path" message: Supported Class numbers and it's value: SESSION: 1, RSVP_HOP: 3, TIME_VALUES: 5, EXPLICIT_ROUTE: 20, LABEL_REQUEST: 19, SESSION_ATTRIBUTE: 207, SENDER_TEMPLATE: 11, SENDER_TSPEC: 12, RECORD_ROUTE: 21, Custom: User defined bytes based on class and c-types not supported in above options. -type FlowRSVPPathObjectsClass interface { - Validation - // msg marshals FlowRSVPPathObjectsClass to protobuf object *otg.FlowRSVPPathObjectsClass - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsClass - // setMsg unmarshals FlowRSVPPathObjectsClass from protobuf object *otg.FlowRSVPPathObjectsClass - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsClass) FlowRSVPPathObjectsClass - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsClass - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsClass - // validate validates FlowRSVPPathObjectsClass - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsClass, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPPathObjectsClassChoiceEnum, set in FlowRSVPPathObjectsClass - Choice() FlowRSVPPathObjectsClassChoiceEnum - // setChoice assigns FlowRSVPPathObjectsClassChoiceEnum provided by user to FlowRSVPPathObjectsClass - setChoice(value FlowRSVPPathObjectsClassChoiceEnum) FlowRSVPPathObjectsClass - // Session returns FlowRSVPPathObjectsClassSession, set in FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassSession is c-Type is specific to a class num. - Session() FlowRSVPPathObjectsClassSession - // SetSession assigns FlowRSVPPathObjectsClassSession provided by user to FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassSession is c-Type is specific to a class num. - SetSession(value FlowRSVPPathObjectsClassSession) FlowRSVPPathObjectsClass - // HasSession checks if Session has been set in FlowRSVPPathObjectsClass - HasSession() bool - // RsvpHop returns FlowRSVPPathObjectsClassRsvpHop, set in FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassRsvpHop is c-Type is specific to a class num. - RsvpHop() FlowRSVPPathObjectsClassRsvpHop - // SetRsvpHop assigns FlowRSVPPathObjectsClassRsvpHop provided by user to FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassRsvpHop is c-Type is specific to a class num. - SetRsvpHop(value FlowRSVPPathObjectsClassRsvpHop) FlowRSVPPathObjectsClass - // HasRsvpHop checks if RsvpHop has been set in FlowRSVPPathObjectsClass - HasRsvpHop() bool - // TimeValues returns FlowRSVPPathObjectsClassTimeValues, set in FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassTimeValues is c-Type is specific to a class num. - TimeValues() FlowRSVPPathObjectsClassTimeValues - // SetTimeValues assigns FlowRSVPPathObjectsClassTimeValues provided by user to FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassTimeValues is c-Type is specific to a class num. - SetTimeValues(value FlowRSVPPathObjectsClassTimeValues) FlowRSVPPathObjectsClass - // HasTimeValues checks if TimeValues has been set in FlowRSVPPathObjectsClass - HasTimeValues() bool - // ExplicitRoute returns FlowRSVPPathObjectsClassExplicitRoute, set in FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassExplicitRoute is c-Type is specific to a class num. - ExplicitRoute() FlowRSVPPathObjectsClassExplicitRoute - // SetExplicitRoute assigns FlowRSVPPathObjectsClassExplicitRoute provided by user to FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassExplicitRoute is c-Type is specific to a class num. - SetExplicitRoute(value FlowRSVPPathObjectsClassExplicitRoute) FlowRSVPPathObjectsClass - // HasExplicitRoute checks if ExplicitRoute has been set in FlowRSVPPathObjectsClass - HasExplicitRoute() bool - // LabelRequest returns FlowRSVPPathObjectsClassLabelRequest, set in FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassLabelRequest is c-Type is specific to a class num. - LabelRequest() FlowRSVPPathObjectsClassLabelRequest - // SetLabelRequest assigns FlowRSVPPathObjectsClassLabelRequest provided by user to FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassLabelRequest is c-Type is specific to a class num. - SetLabelRequest(value FlowRSVPPathObjectsClassLabelRequest) FlowRSVPPathObjectsClass - // HasLabelRequest checks if LabelRequest has been set in FlowRSVPPathObjectsClass - HasLabelRequest() bool - // SessionAttribute returns FlowRSVPPathObjectsClassSessionAttribute, set in FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassSessionAttribute is c-Type is specific to a class num. - SessionAttribute() FlowRSVPPathObjectsClassSessionAttribute - // SetSessionAttribute assigns FlowRSVPPathObjectsClassSessionAttribute provided by user to FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassSessionAttribute is c-Type is specific to a class num. - SetSessionAttribute(value FlowRSVPPathObjectsClassSessionAttribute) FlowRSVPPathObjectsClass - // HasSessionAttribute checks if SessionAttribute has been set in FlowRSVPPathObjectsClass - HasSessionAttribute() bool - // SenderTemplate returns FlowRSVPPathObjectsClassSenderTemplate, set in FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassSenderTemplate is c-Type is specific to a class num. - SenderTemplate() FlowRSVPPathObjectsClassSenderTemplate - // SetSenderTemplate assigns FlowRSVPPathObjectsClassSenderTemplate provided by user to FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassSenderTemplate is c-Type is specific to a class num. - SetSenderTemplate(value FlowRSVPPathObjectsClassSenderTemplate) FlowRSVPPathObjectsClass - // HasSenderTemplate checks if SenderTemplate has been set in FlowRSVPPathObjectsClass - HasSenderTemplate() bool - // SenderTspec returns FlowRSVPPathObjectsClassSenderTspec, set in FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassSenderTspec is c-Type is specific to a class num. - SenderTspec() FlowRSVPPathObjectsClassSenderTspec - // SetSenderTspec assigns FlowRSVPPathObjectsClassSenderTspec provided by user to FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassSenderTspec is c-Type is specific to a class num. - SetSenderTspec(value FlowRSVPPathObjectsClassSenderTspec) FlowRSVPPathObjectsClass - // HasSenderTspec checks if SenderTspec has been set in FlowRSVPPathObjectsClass - HasSenderTspec() bool - // RecordRoute returns FlowRSVPPathObjectsClassRecordRoute, set in FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassRecordRoute is c-Type is specific to a class num. - RecordRoute() FlowRSVPPathObjectsClassRecordRoute - // SetRecordRoute assigns FlowRSVPPathObjectsClassRecordRoute provided by user to FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsClassRecordRoute is c-Type is specific to a class num. - SetRecordRoute(value FlowRSVPPathObjectsClassRecordRoute) FlowRSVPPathObjectsClass - // HasRecordRoute checks if RecordRoute has been set in FlowRSVPPathObjectsClass - HasRecordRoute() bool - // Custom returns FlowRSVPPathObjectsCustom, set in FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsCustom is custom packet header - Custom() FlowRSVPPathObjectsCustom - // SetCustom assigns FlowRSVPPathObjectsCustom provided by user to FlowRSVPPathObjectsClass. - // FlowRSVPPathObjectsCustom is custom packet header - SetCustom(value FlowRSVPPathObjectsCustom) FlowRSVPPathObjectsClass - // HasCustom checks if Custom has been set in FlowRSVPPathObjectsClass - HasCustom() bool - setNil() -} - -type FlowRSVPPathObjectsClassChoiceEnum string - -// Enum of Choice on FlowRSVPPathObjectsClass -var FlowRSVPPathObjectsClassChoice = struct { - SESSION FlowRSVPPathObjectsClassChoiceEnum - RSVP_HOP FlowRSVPPathObjectsClassChoiceEnum - TIME_VALUES FlowRSVPPathObjectsClassChoiceEnum - EXPLICIT_ROUTE FlowRSVPPathObjectsClassChoiceEnum - LABEL_REQUEST FlowRSVPPathObjectsClassChoiceEnum - SESSION_ATTRIBUTE FlowRSVPPathObjectsClassChoiceEnum - SENDER_TEMPLATE FlowRSVPPathObjectsClassChoiceEnum - SENDER_TSPEC FlowRSVPPathObjectsClassChoiceEnum - RECORD_ROUTE FlowRSVPPathObjectsClassChoiceEnum - CUSTOM FlowRSVPPathObjectsClassChoiceEnum -}{ - SESSION: FlowRSVPPathObjectsClassChoiceEnum("session"), - RSVP_HOP: FlowRSVPPathObjectsClassChoiceEnum("rsvp_hop"), - TIME_VALUES: FlowRSVPPathObjectsClassChoiceEnum("time_values"), - EXPLICIT_ROUTE: FlowRSVPPathObjectsClassChoiceEnum("explicit_route"), - LABEL_REQUEST: FlowRSVPPathObjectsClassChoiceEnum("label_request"), - SESSION_ATTRIBUTE: FlowRSVPPathObjectsClassChoiceEnum("session_attribute"), - SENDER_TEMPLATE: FlowRSVPPathObjectsClassChoiceEnum("sender_template"), - SENDER_TSPEC: FlowRSVPPathObjectsClassChoiceEnum("sender_tspec"), - RECORD_ROUTE: FlowRSVPPathObjectsClassChoiceEnum("record_route"), - CUSTOM: FlowRSVPPathObjectsClassChoiceEnum("custom"), -} - -func (obj *flowRSVPPathObjectsClass) Choice() FlowRSVPPathObjectsClassChoiceEnum { - return FlowRSVPPathObjectsClassChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *flowRSVPPathObjectsClass) setChoice(value FlowRSVPPathObjectsClassChoiceEnum) FlowRSVPPathObjectsClass { - intValue, ok := otg.FlowRSVPPathObjectsClass_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPPathObjectsClassChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPPathObjectsClass_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Custom = nil - obj.customHolder = nil - obj.obj.RecordRoute = nil - obj.recordRouteHolder = nil - obj.obj.SenderTspec = nil - obj.senderTspecHolder = nil - obj.obj.SenderTemplate = nil - obj.senderTemplateHolder = nil - obj.obj.SessionAttribute = nil - obj.sessionAttributeHolder = nil - obj.obj.LabelRequest = nil - obj.labelRequestHolder = nil - obj.obj.ExplicitRoute = nil - obj.explicitRouteHolder = nil - obj.obj.TimeValues = nil - obj.timeValuesHolder = nil - obj.obj.RsvpHop = nil - obj.rsvpHopHolder = nil - obj.obj.Session = nil - obj.sessionHolder = nil - - if value == FlowRSVPPathObjectsClassChoice.SESSION { - obj.obj.Session = NewFlowRSVPPathObjectsClassSession().msg() - } - - if value == FlowRSVPPathObjectsClassChoice.RSVP_HOP { - obj.obj.RsvpHop = NewFlowRSVPPathObjectsClassRsvpHop().msg() - } - - if value == FlowRSVPPathObjectsClassChoice.TIME_VALUES { - obj.obj.TimeValues = NewFlowRSVPPathObjectsClassTimeValues().msg() - } - - if value == FlowRSVPPathObjectsClassChoice.EXPLICIT_ROUTE { - obj.obj.ExplicitRoute = NewFlowRSVPPathObjectsClassExplicitRoute().msg() - } - - if value == FlowRSVPPathObjectsClassChoice.LABEL_REQUEST { - obj.obj.LabelRequest = NewFlowRSVPPathObjectsClassLabelRequest().msg() - } - - if value == FlowRSVPPathObjectsClassChoice.SESSION_ATTRIBUTE { - obj.obj.SessionAttribute = NewFlowRSVPPathObjectsClassSessionAttribute().msg() - } - - if value == FlowRSVPPathObjectsClassChoice.SENDER_TEMPLATE { - obj.obj.SenderTemplate = NewFlowRSVPPathObjectsClassSenderTemplate().msg() - } - - if value == FlowRSVPPathObjectsClassChoice.SENDER_TSPEC { - obj.obj.SenderTspec = NewFlowRSVPPathObjectsClassSenderTspec().msg() - } - - if value == FlowRSVPPathObjectsClassChoice.RECORD_ROUTE { - obj.obj.RecordRoute = NewFlowRSVPPathObjectsClassRecordRoute().msg() - } - - if value == FlowRSVPPathObjectsClassChoice.CUSTOM { - obj.obj.Custom = NewFlowRSVPPathObjectsCustom().msg() - } - - return obj -} - -// description is TBD -// Session returns a FlowRSVPPathObjectsClassSession -func (obj *flowRSVPPathObjectsClass) Session() FlowRSVPPathObjectsClassSession { - if obj.obj.Session == nil { - obj.setChoice(FlowRSVPPathObjectsClassChoice.SESSION) - } - if obj.sessionHolder == nil { - obj.sessionHolder = &flowRSVPPathObjectsClassSession{obj: obj.obj.Session} - } - return obj.sessionHolder -} - -// description is TBD -// Session returns a FlowRSVPPathObjectsClassSession -func (obj *flowRSVPPathObjectsClass) HasSession() bool { - return obj.obj.Session != nil -} - -// description is TBD -// SetSession sets the FlowRSVPPathObjectsClassSession value in the FlowRSVPPathObjectsClass object -func (obj *flowRSVPPathObjectsClass) SetSession(value FlowRSVPPathObjectsClassSession) FlowRSVPPathObjectsClass { - obj.setChoice(FlowRSVPPathObjectsClassChoice.SESSION) - obj.sessionHolder = nil - obj.obj.Session = value.msg() - - return obj -} - -// description is TBD -// RsvpHop returns a FlowRSVPPathObjectsClassRsvpHop -func (obj *flowRSVPPathObjectsClass) RsvpHop() FlowRSVPPathObjectsClassRsvpHop { - if obj.obj.RsvpHop == nil { - obj.setChoice(FlowRSVPPathObjectsClassChoice.RSVP_HOP) - } - if obj.rsvpHopHolder == nil { - obj.rsvpHopHolder = &flowRSVPPathObjectsClassRsvpHop{obj: obj.obj.RsvpHop} - } - return obj.rsvpHopHolder -} - -// description is TBD -// RsvpHop returns a FlowRSVPPathObjectsClassRsvpHop -func (obj *flowRSVPPathObjectsClass) HasRsvpHop() bool { - return obj.obj.RsvpHop != nil -} - -// description is TBD -// SetRsvpHop sets the FlowRSVPPathObjectsClassRsvpHop value in the FlowRSVPPathObjectsClass object -func (obj *flowRSVPPathObjectsClass) SetRsvpHop(value FlowRSVPPathObjectsClassRsvpHop) FlowRSVPPathObjectsClass { - obj.setChoice(FlowRSVPPathObjectsClassChoice.RSVP_HOP) - obj.rsvpHopHolder = nil - obj.obj.RsvpHop = value.msg() - - return obj -} - -// description is TBD -// TimeValues returns a FlowRSVPPathObjectsClassTimeValues -func (obj *flowRSVPPathObjectsClass) TimeValues() FlowRSVPPathObjectsClassTimeValues { - if obj.obj.TimeValues == nil { - obj.setChoice(FlowRSVPPathObjectsClassChoice.TIME_VALUES) - } - if obj.timeValuesHolder == nil { - obj.timeValuesHolder = &flowRSVPPathObjectsClassTimeValues{obj: obj.obj.TimeValues} - } - return obj.timeValuesHolder -} - -// description is TBD -// TimeValues returns a FlowRSVPPathObjectsClassTimeValues -func (obj *flowRSVPPathObjectsClass) HasTimeValues() bool { - return obj.obj.TimeValues != nil -} - -// description is TBD -// SetTimeValues sets the FlowRSVPPathObjectsClassTimeValues value in the FlowRSVPPathObjectsClass object -func (obj *flowRSVPPathObjectsClass) SetTimeValues(value FlowRSVPPathObjectsClassTimeValues) FlowRSVPPathObjectsClass { - obj.setChoice(FlowRSVPPathObjectsClassChoice.TIME_VALUES) - obj.timeValuesHolder = nil - obj.obj.TimeValues = value.msg() - - return obj -} - -// description is TBD -// ExplicitRoute returns a FlowRSVPPathObjectsClassExplicitRoute -func (obj *flowRSVPPathObjectsClass) ExplicitRoute() FlowRSVPPathObjectsClassExplicitRoute { - if obj.obj.ExplicitRoute == nil { - obj.setChoice(FlowRSVPPathObjectsClassChoice.EXPLICIT_ROUTE) - } - if obj.explicitRouteHolder == nil { - obj.explicitRouteHolder = &flowRSVPPathObjectsClassExplicitRoute{obj: obj.obj.ExplicitRoute} - } - return obj.explicitRouteHolder -} - -// description is TBD -// ExplicitRoute returns a FlowRSVPPathObjectsClassExplicitRoute -func (obj *flowRSVPPathObjectsClass) HasExplicitRoute() bool { - return obj.obj.ExplicitRoute != nil -} - -// description is TBD -// SetExplicitRoute sets the FlowRSVPPathObjectsClassExplicitRoute value in the FlowRSVPPathObjectsClass object -func (obj *flowRSVPPathObjectsClass) SetExplicitRoute(value FlowRSVPPathObjectsClassExplicitRoute) FlowRSVPPathObjectsClass { - obj.setChoice(FlowRSVPPathObjectsClassChoice.EXPLICIT_ROUTE) - obj.explicitRouteHolder = nil - obj.obj.ExplicitRoute = value.msg() - - return obj -} - -// description is TBD -// LabelRequest returns a FlowRSVPPathObjectsClassLabelRequest -func (obj *flowRSVPPathObjectsClass) LabelRequest() FlowRSVPPathObjectsClassLabelRequest { - if obj.obj.LabelRequest == nil { - obj.setChoice(FlowRSVPPathObjectsClassChoice.LABEL_REQUEST) - } - if obj.labelRequestHolder == nil { - obj.labelRequestHolder = &flowRSVPPathObjectsClassLabelRequest{obj: obj.obj.LabelRequest} - } - return obj.labelRequestHolder -} - -// description is TBD -// LabelRequest returns a FlowRSVPPathObjectsClassLabelRequest -func (obj *flowRSVPPathObjectsClass) HasLabelRequest() bool { - return obj.obj.LabelRequest != nil -} - -// description is TBD -// SetLabelRequest sets the FlowRSVPPathObjectsClassLabelRequest value in the FlowRSVPPathObjectsClass object -func (obj *flowRSVPPathObjectsClass) SetLabelRequest(value FlowRSVPPathObjectsClassLabelRequest) FlowRSVPPathObjectsClass { - obj.setChoice(FlowRSVPPathObjectsClassChoice.LABEL_REQUEST) - obj.labelRequestHolder = nil - obj.obj.LabelRequest = value.msg() - - return obj -} - -// description is TBD -// SessionAttribute returns a FlowRSVPPathObjectsClassSessionAttribute -func (obj *flowRSVPPathObjectsClass) SessionAttribute() FlowRSVPPathObjectsClassSessionAttribute { - if obj.obj.SessionAttribute == nil { - obj.setChoice(FlowRSVPPathObjectsClassChoice.SESSION_ATTRIBUTE) - } - if obj.sessionAttributeHolder == nil { - obj.sessionAttributeHolder = &flowRSVPPathObjectsClassSessionAttribute{obj: obj.obj.SessionAttribute} - } - return obj.sessionAttributeHolder -} - -// description is TBD -// SessionAttribute returns a FlowRSVPPathObjectsClassSessionAttribute -func (obj *flowRSVPPathObjectsClass) HasSessionAttribute() bool { - return obj.obj.SessionAttribute != nil -} - -// description is TBD -// SetSessionAttribute sets the FlowRSVPPathObjectsClassSessionAttribute value in the FlowRSVPPathObjectsClass object -func (obj *flowRSVPPathObjectsClass) SetSessionAttribute(value FlowRSVPPathObjectsClassSessionAttribute) FlowRSVPPathObjectsClass { - obj.setChoice(FlowRSVPPathObjectsClassChoice.SESSION_ATTRIBUTE) - obj.sessionAttributeHolder = nil - obj.obj.SessionAttribute = value.msg() - - return obj -} - -// description is TBD -// SenderTemplate returns a FlowRSVPPathObjectsClassSenderTemplate -func (obj *flowRSVPPathObjectsClass) SenderTemplate() FlowRSVPPathObjectsClassSenderTemplate { - if obj.obj.SenderTemplate == nil { - obj.setChoice(FlowRSVPPathObjectsClassChoice.SENDER_TEMPLATE) - } - if obj.senderTemplateHolder == nil { - obj.senderTemplateHolder = &flowRSVPPathObjectsClassSenderTemplate{obj: obj.obj.SenderTemplate} - } - return obj.senderTemplateHolder -} - -// description is TBD -// SenderTemplate returns a FlowRSVPPathObjectsClassSenderTemplate -func (obj *flowRSVPPathObjectsClass) HasSenderTemplate() bool { - return obj.obj.SenderTemplate != nil -} - -// description is TBD -// SetSenderTemplate sets the FlowRSVPPathObjectsClassSenderTemplate value in the FlowRSVPPathObjectsClass object -func (obj *flowRSVPPathObjectsClass) SetSenderTemplate(value FlowRSVPPathObjectsClassSenderTemplate) FlowRSVPPathObjectsClass { - obj.setChoice(FlowRSVPPathObjectsClassChoice.SENDER_TEMPLATE) - obj.senderTemplateHolder = nil - obj.obj.SenderTemplate = value.msg() - - return obj -} - -// description is TBD -// SenderTspec returns a FlowRSVPPathObjectsClassSenderTspec -func (obj *flowRSVPPathObjectsClass) SenderTspec() FlowRSVPPathObjectsClassSenderTspec { - if obj.obj.SenderTspec == nil { - obj.setChoice(FlowRSVPPathObjectsClassChoice.SENDER_TSPEC) - } - if obj.senderTspecHolder == nil { - obj.senderTspecHolder = &flowRSVPPathObjectsClassSenderTspec{obj: obj.obj.SenderTspec} - } - return obj.senderTspecHolder -} - -// description is TBD -// SenderTspec returns a FlowRSVPPathObjectsClassSenderTspec -func (obj *flowRSVPPathObjectsClass) HasSenderTspec() bool { - return obj.obj.SenderTspec != nil -} - -// description is TBD -// SetSenderTspec sets the FlowRSVPPathObjectsClassSenderTspec value in the FlowRSVPPathObjectsClass object -func (obj *flowRSVPPathObjectsClass) SetSenderTspec(value FlowRSVPPathObjectsClassSenderTspec) FlowRSVPPathObjectsClass { - obj.setChoice(FlowRSVPPathObjectsClassChoice.SENDER_TSPEC) - obj.senderTspecHolder = nil - obj.obj.SenderTspec = value.msg() - - return obj -} - -// description is TBD -// RecordRoute returns a FlowRSVPPathObjectsClassRecordRoute -func (obj *flowRSVPPathObjectsClass) RecordRoute() FlowRSVPPathObjectsClassRecordRoute { - if obj.obj.RecordRoute == nil { - obj.setChoice(FlowRSVPPathObjectsClassChoice.RECORD_ROUTE) - } - if obj.recordRouteHolder == nil { - obj.recordRouteHolder = &flowRSVPPathObjectsClassRecordRoute{obj: obj.obj.RecordRoute} - } - return obj.recordRouteHolder -} - -// description is TBD -// RecordRoute returns a FlowRSVPPathObjectsClassRecordRoute -func (obj *flowRSVPPathObjectsClass) HasRecordRoute() bool { - return obj.obj.RecordRoute != nil -} - -// description is TBD -// SetRecordRoute sets the FlowRSVPPathObjectsClassRecordRoute value in the FlowRSVPPathObjectsClass object -func (obj *flowRSVPPathObjectsClass) SetRecordRoute(value FlowRSVPPathObjectsClassRecordRoute) FlowRSVPPathObjectsClass { - obj.setChoice(FlowRSVPPathObjectsClassChoice.RECORD_ROUTE) - obj.recordRouteHolder = nil - obj.obj.RecordRoute = value.msg() - - return obj -} - -// description is TBD -// Custom returns a FlowRSVPPathObjectsCustom -func (obj *flowRSVPPathObjectsClass) Custom() FlowRSVPPathObjectsCustom { - if obj.obj.Custom == nil { - obj.setChoice(FlowRSVPPathObjectsClassChoice.CUSTOM) - } - if obj.customHolder == nil { - obj.customHolder = &flowRSVPPathObjectsCustom{obj: obj.obj.Custom} - } - return obj.customHolder -} - -// description is TBD -// Custom returns a FlowRSVPPathObjectsCustom -func (obj *flowRSVPPathObjectsClass) HasCustom() bool { - return obj.obj.Custom != nil -} - -// description is TBD -// SetCustom sets the FlowRSVPPathObjectsCustom value in the FlowRSVPPathObjectsClass object -func (obj *flowRSVPPathObjectsClass) SetCustom(value FlowRSVPPathObjectsCustom) FlowRSVPPathObjectsClass { - obj.setChoice(FlowRSVPPathObjectsClassChoice.CUSTOM) - obj.customHolder = nil - obj.obj.Custom = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsClass) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface FlowRSVPPathObjectsClass") - } - - if obj.obj.Session != nil { - - obj.Session().validateObj(vObj, set_default) - } - - if obj.obj.RsvpHop != nil { - - obj.RsvpHop().validateObj(vObj, set_default) - } - - if obj.obj.TimeValues != nil { - - obj.TimeValues().validateObj(vObj, set_default) - } - - if obj.obj.ExplicitRoute != nil { - - obj.ExplicitRoute().validateObj(vObj, set_default) - } - - if obj.obj.LabelRequest != nil { - - obj.LabelRequest().validateObj(vObj, set_default) - } - - if obj.obj.SessionAttribute != nil { - - obj.SessionAttribute().validateObj(vObj, set_default) - } - - if obj.obj.SenderTemplate != nil { - - obj.SenderTemplate().validateObj(vObj, set_default) - } - - if obj.obj.SenderTspec != nil { - - obj.SenderTspec().validateObj(vObj, set_default) - } - - if obj.obj.RecordRoute != nil { - - obj.RecordRoute().validateObj(vObj, set_default) - } - - if obj.obj.Custom != nil { - - obj.Custom().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsClass) setDefault() { - var choices_set int = 0 - var choice FlowRSVPPathObjectsClassChoiceEnum - - if obj.obj.Session != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsClassChoice.SESSION - } - - if obj.obj.RsvpHop != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsClassChoice.RSVP_HOP - } - - if obj.obj.TimeValues != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsClassChoice.TIME_VALUES - } - - if obj.obj.ExplicitRoute != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsClassChoice.EXPLICIT_ROUTE - } - - if obj.obj.LabelRequest != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsClassChoice.LABEL_REQUEST - } - - if obj.obj.SessionAttribute != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsClassChoice.SESSION_ATTRIBUTE - } - - if obj.obj.SenderTemplate != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsClassChoice.SENDER_TEMPLATE - } - - if obj.obj.SenderTspec != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsClassChoice.SENDER_TSPEC - } - - if obj.obj.RecordRoute != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsClassChoice.RECORD_ROUTE - } - - if obj.obj.Custom != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsClassChoice.CUSTOM - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsClass") - } - } else { - intVal := otg.FlowRSVPPathObjectsClass_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPPathObjectsClass_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget ***** -type resultExtendedCommunityTransitive2OctetAsTypeRouteTarget struct { - validation - obj *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - marshaller marshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - unMarshaller unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget -} - -func NewResultExtendedCommunityTransitive2OctetAsTypeRouteTarget() ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { - obj := resultExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: &otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) msg() *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { - return obj.obj -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) setMsg(msg *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget struct { - obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget -} - -type marshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget interface { - // ToProto marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget to protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - ToProto() (*otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) - // ToPbText marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget struct { - obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget -} - -type unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget interface { - // FromProto unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget from protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - FromProto(msg *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget) (ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) - // FromPbText unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) Marshal() marshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) Unmarshal() unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) ToProto() (*otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) FromProto(msg *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget) (ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) Clone() (ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityTransitive2OctetAsTypeRouteTarget() - 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 -} - -// ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP Update message. It is sent with sub-type as 0x02. -type ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget interface { - Validation - // msg marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget to protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - // setMsg unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget from protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - // provides marshal interface - Marshal() marshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - // validate validates ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Global2ByteAs returns uint32, set in ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget. - Global2ByteAs() uint32 - // SetGlobal2ByteAs assigns uint32 provided by user to ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - SetGlobal2ByteAs(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - // HasGlobal2ByteAs checks if Global2ByteAs has been set in ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - HasGlobal2ByteAs() bool - // Local4ByteAdmin returns uint32, set in ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget. - Local4ByteAdmin() uint32 - // SetLocal4ByteAdmin assigns uint32 provided by user to ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - SetLocal4ByteAdmin(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - // HasLocal4ByteAdmin checks if Local4ByteAdmin has been set in ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget - HasLocal4ByteAdmin() bool -} - -// The two octet IANA assigned AS value assigned to the Autonomous System. -// Global2ByteAs returns a uint32 -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) Global2ByteAs() uint32 { - - return *obj.obj.Global_2ByteAs - -} - -// The two octet IANA assigned AS value assigned to the Autonomous System. -// Global2ByteAs returns a uint32 -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) HasGlobal2ByteAs() bool { - return obj.obj.Global_2ByteAs != nil -} - -// The two octet IANA assigned AS value assigned to the Autonomous System. -// SetGlobal2ByteAs sets the uint32 value in the ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget object -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) SetGlobal2ByteAs(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { - - obj.obj.Global_2ByteAs = &value - return obj -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local4ByteAdmin returns a uint32 -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) Local4ByteAdmin() uint32 { - - return *obj.obj.Local_4ByteAdmin - -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local4ByteAdmin returns a uint32 -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) HasLocal4ByteAdmin() bool { - return obj.obj.Local_4ByteAdmin != nil -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// SetLocal4ByteAdmin sets the uint32 value in the ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget object -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) SetLocal4ByteAdmin(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { - - obj.obj.Local_4ByteAdmin = &value - return obj -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Global_2ByteAs != nil { - - if *obj.obj.Global_2ByteAs > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget.Global_2ByteAs <= 65535 but Got %d", *obj.obj.Global_2ByteAs)) - } - - } - -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) setDefault() { - -} - -// ***** ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin ***** -type resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin struct { - validation - obj *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - marshaller marshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - unMarshaller unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin -} - -func NewResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin() ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - obj := resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: &otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) msg() *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - return obj.obj -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) setMsg(msg *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin struct { - obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin -} - -type marshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin interface { - // ToProto marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin to protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - ToProto() (*otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) - // ToPbText marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin struct { - obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin -} - -type unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin interface { - // FromProto unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin from protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - FromProto(msg *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) (ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) - // FromPbText unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Marshal() marshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Unmarshal() unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) ToProto() (*otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) FromProto(msg *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) (ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Clone() (ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin() - 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 -} - -// ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03 . -type ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin interface { - Validation - // msg marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin to protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // setMsg unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin from protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // provides marshal interface - Marshal() marshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // validate validates ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Global2ByteAs returns uint32, set in ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin. - Global2ByteAs() uint32 - // SetGlobal2ByteAs assigns uint32 provided by user to ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - SetGlobal2ByteAs(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // HasGlobal2ByteAs checks if Global2ByteAs has been set in ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - HasGlobal2ByteAs() bool - // Local4ByteAdmin returns uint32, set in ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin. - Local4ByteAdmin() uint32 - // SetLocal4ByteAdmin assigns uint32 provided by user to ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - SetLocal4ByteAdmin(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // HasLocal4ByteAdmin checks if Local4ByteAdmin has been set in ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin - HasLocal4ByteAdmin() bool -} - -// The two octet IANA assigned AS value assigned to the Autonomous System. -// Global2ByteAs returns a uint32 -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Global2ByteAs() uint32 { - - return *obj.obj.Global_2ByteAs - -} - -// The two octet IANA assigned AS value assigned to the Autonomous System. -// Global2ByteAs returns a uint32 -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) HasGlobal2ByteAs() bool { - return obj.obj.Global_2ByteAs != nil -} - -// The two octet IANA assigned AS value assigned to the Autonomous System. -// SetGlobal2ByteAs sets the uint32 value in the ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin object -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) SetGlobal2ByteAs(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - - obj.obj.Global_2ByteAs = &value - return obj -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local4ByteAdmin returns a uint32 -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Local4ByteAdmin() uint32 { - - return *obj.obj.Local_4ByteAdmin - -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local4ByteAdmin returns a uint32 -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) HasLocal4ByteAdmin() bool { - return obj.obj.Local_4ByteAdmin != nil -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// SetLocal4ByteAdmin sets the uint32 value in the ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin object -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) SetLocal4ByteAdmin(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - - obj.obj.Local_4ByteAdmin = &value - return obj -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Global_2ByteAs != nil { - - if *obj.obj.Global_2ByteAs > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin.Global_2ByteAs <= 65535 but Got %d", *obj.obj.Global_2ByteAs)) - } - - } - -} - -func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) setDefault() { - -} - -// ***** ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget ***** -type resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget struct { - validation - obj *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - marshaller marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - unMarshaller unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget -} - -func NewResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget() ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - obj := resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: &otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) msg() *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - return obj.obj -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) setMsg(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget struct { - obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget -} - -type marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget interface { - // ToProto marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - ToProto() (*otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) - // ToPbText marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget struct { - obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget -} - -type unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget interface { - // FromProto unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - FromProto(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) - // FromPbText unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Marshal() marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Unmarshal() unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) ToProto() (*otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) FromProto(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Clone() (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget() - 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 -} - -// ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. -type ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget interface { - Validation - // msg marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // setMsg unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // provides marshal interface - Marshal() marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // validate validates ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // GlobalIpv4Admin returns string, set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget. - GlobalIpv4Admin() string - // SetGlobalIpv4Admin assigns string provided by user to ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - SetGlobalIpv4Admin(value string) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // HasGlobalIpv4Admin checks if GlobalIpv4Admin has been set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - HasGlobalIpv4Admin() bool - // Local2ByteAdmin returns uint32, set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget. - Local2ByteAdmin() uint32 - // SetLocal2ByteAdmin assigns uint32 provided by user to ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - HasLocal2ByteAdmin() bool -} - -// An IPv4 unicast address assigned by one of the Internet registries. -// GlobalIpv4Admin returns a string -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) GlobalIpv4Admin() string { - - return *obj.obj.GlobalIpv4Admin - -} - -// An IPv4 unicast address assigned by one of the Internet registries. -// GlobalIpv4Admin returns a string -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) HasGlobalIpv4Admin() bool { - return obj.obj.GlobalIpv4Admin != nil -} - -// An IPv4 unicast address assigned by one of the Internet registries. -// SetGlobalIpv4Admin sets the string value in the ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget object -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) SetGlobalIpv4Admin(value string) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - - obj.obj.GlobalIpv4Admin = &value - return obj -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Local2ByteAdmin() uint32 { - - return *obj.obj.Local_2ByteAdmin - -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) HasLocal2ByteAdmin() bool { - return obj.obj.Local_2ByteAdmin != nil -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// SetLocal2ByteAdmin sets the uint32 value in the ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget object -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - - obj.obj.Local_2ByteAdmin = &value - return obj -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.GlobalIpv4Admin != nil { - - err := obj.validateIpv4(obj.GlobalIpv4Admin()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget.GlobalIpv4Admin")) - } - - } - - if obj.obj.Local_2ByteAdmin != nil { - - if *obj.obj.Local_2ByteAdmin > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) - } - - } - -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) setDefault() { - -} - -// ***** ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin ***** -type resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin struct { - validation - obj *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - marshaller marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - unMarshaller unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin -} - -func NewResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin() ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - obj := resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: &otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) msg() *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - return obj.obj -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) setMsg(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin struct { - obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin -} - -type marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin interface { - // ToProto marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - ToProto() (*otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) - // ToPbText marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin struct { - obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin -} - -type unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin interface { - // FromProto unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - FromProto(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) - // FromPbText unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Marshal() marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Unmarshal() unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) ToProto() (*otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) FromProto(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Clone() (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin() - 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 -} - -// ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP It is sent with sub-type as 0x03. -type ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin interface { - Validation - // msg marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // setMsg unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // provides marshal interface - Marshal() marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // validate validates ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // GlobalIpv4Admin returns string, set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin. - GlobalIpv4Admin() string - // SetGlobalIpv4Admin assigns string provided by user to ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - SetGlobalIpv4Admin(value string) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // HasGlobalIpv4Admin checks if GlobalIpv4Admin has been set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - HasGlobalIpv4Admin() bool - // Local2ByteAdmin returns uint32, set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin. - Local2ByteAdmin() uint32 - // SetLocal2ByteAdmin assigns uint32 provided by user to ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - HasLocal2ByteAdmin() bool -} - -// An IPv4 unicast address assigned by one of the Internet registries. -// GlobalIpv4Admin returns a string -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) GlobalIpv4Admin() string { - - return *obj.obj.GlobalIpv4Admin - -} - -// An IPv4 unicast address assigned by one of the Internet registries. -// GlobalIpv4Admin returns a string -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) HasGlobalIpv4Admin() bool { - return obj.obj.GlobalIpv4Admin != nil -} - -// An IPv4 unicast address assigned by one of the Internet registries. -// SetGlobalIpv4Admin sets the string value in the ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin object -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) SetGlobalIpv4Admin(value string) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - - obj.obj.GlobalIpv4Admin = &value - return obj -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Local2ByteAdmin() uint32 { - - return *obj.obj.Local_2ByteAdmin - -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) HasLocal2ByteAdmin() bool { - return obj.obj.Local_2ByteAdmin != nil -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// SetLocal2ByteAdmin sets the uint32 value in the ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin object -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - - obj.obj.Local_2ByteAdmin = &value - return obj -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.GlobalIpv4Admin != nil { - - err := obj.validateIpv4(obj.GlobalIpv4Admin()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin.GlobalIpv4Admin")) - } - - } - - if obj.obj.Local_2ByteAdmin != nil { - - if *obj.obj.Local_2ByteAdmin > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) - } - - } - -} - -func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) setDefault() { - -} - -// ***** ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget ***** -type resultExtendedCommunityTransitive4OctetAsTypeRouteTarget struct { - validation - obj *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - marshaller marshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - unMarshaller unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget -} - -func NewResultExtendedCommunityTransitive4OctetAsTypeRouteTarget() ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { - obj := resultExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: &otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) msg() *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { - return obj.obj -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) setMsg(msg *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget struct { - obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget -} - -type marshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget interface { - // ToProto marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget to protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - ToProto() (*otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) - // ToPbText marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget struct { - obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget -} - -type unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget interface { - // FromProto unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget from protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - FromProto(msg *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget) (ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) - // FromPbText unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) Marshal() marshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) Unmarshal() unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) ToProto() (*otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) FromProto(msg *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget) (ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) Clone() (ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityTransitive4OctetAsTypeRouteTarget() - 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 -} - -// ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02 -type ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget interface { - Validation - // msg marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget to protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - // setMsg unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget from protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - // provides marshal interface - Marshal() marshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - // validate validates ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Global4ByteAs returns uint32, set in ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget. - Global4ByteAs() uint32 - // SetGlobal4ByteAs assigns uint32 provided by user to ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - SetGlobal4ByteAs(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - // HasGlobal4ByteAs checks if Global4ByteAs has been set in ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - HasGlobal4ByteAs() bool - // Local2ByteAdmin returns uint32, set in ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget. - Local2ByteAdmin() uint32 - // SetLocal2ByteAdmin assigns uint32 provided by user to ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget - HasLocal2ByteAdmin() bool -} - -// The four octet IANA assigned AS value assigned to the Autonomous System. -// Global4ByteAs returns a uint32 -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) Global4ByteAs() uint32 { - - return *obj.obj.Global_4ByteAs - -} - -// The four octet IANA assigned AS value assigned to the Autonomous System. -// Global4ByteAs returns a uint32 -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) HasGlobal4ByteAs() bool { - return obj.obj.Global_4ByteAs != nil -} - -// The four octet IANA assigned AS value assigned to the Autonomous System. -// SetGlobal4ByteAs sets the uint32 value in the ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget object -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) SetGlobal4ByteAs(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { - - obj.obj.Global_4ByteAs = &value - return obj -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) Local2ByteAdmin() uint32 { - - return *obj.obj.Local_2ByteAdmin - -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) HasLocal2ByteAdmin() bool { - return obj.obj.Local_2ByteAdmin != nil -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// SetLocal2ByteAdmin sets the uint32 value in the ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget object -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { - - obj.obj.Local_2ByteAdmin = &value - return obj -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Local_2ByteAdmin != nil { - - if *obj.obj.Local_2ByteAdmin > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) - } - - } - -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) setDefault() { - -} - -// ***** ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin ***** -type resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin struct { - validation - obj *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - marshaller marshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - unMarshaller unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin -} - -func NewResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin() ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - obj := resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: &otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) msg() *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - return obj.obj -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) setMsg(msg *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin struct { - obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin -} - -type marshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin interface { - // ToProto marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin to protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - ToProto() (*otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) - // ToPbText marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin struct { - obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin -} - -type unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin interface { - // FromProto unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin from protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - FromProto(msg *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) (ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) - // FromPbText unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Marshal() marshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Unmarshal() unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) ToProto() (*otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) FromProto(msg *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) (ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Clone() (ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin() - 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 -} - -// ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03. -type ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin interface { - Validation - // msg marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin to protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // setMsg unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin from protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // provides marshal interface - Marshal() marshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // validate validates ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Global4ByteAs returns uint32, set in ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin. - Global4ByteAs() uint32 - // SetGlobal4ByteAs assigns uint32 provided by user to ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - SetGlobal4ByteAs(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // HasGlobal4ByteAs checks if Global4ByteAs has been set in ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - HasGlobal4ByteAs() bool - // Local2ByteAdmin returns uint32, set in ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin. - Local2ByteAdmin() uint32 - // SetLocal2ByteAdmin assigns uint32 provided by user to ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin - HasLocal2ByteAdmin() bool -} - -// The four octet IANA assigned AS value assigned to the Autonomous System. -// Global4ByteAs returns a uint32 -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Global4ByteAs() uint32 { - - return *obj.obj.Global_4ByteAs - -} - -// The four octet IANA assigned AS value assigned to the Autonomous System. -// Global4ByteAs returns a uint32 -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) HasGlobal4ByteAs() bool { - return obj.obj.Global_4ByteAs != nil -} - -// The four octet IANA assigned AS value assigned to the Autonomous System. -// SetGlobal4ByteAs sets the uint32 value in the ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin object -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) SetGlobal4ByteAs(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - - obj.obj.Global_4ByteAs = &value - return obj -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Local2ByteAdmin() uint32 { - - return *obj.obj.Local_2ByteAdmin - -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) HasLocal2ByteAdmin() bool { - return obj.obj.Local_2ByteAdmin != nil -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// SetLocal2ByteAdmin sets the uint32 value in the ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin object -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - - obj.obj.Local_2ByteAdmin = &value - return obj -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Local_2ByteAdmin != nil { - - if *obj.obj.Local_2ByteAdmin > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) - } - - } - -} - -func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) setDefault() { - -} - -// ***** ResultExtendedCommunityTransitiveOpaqueTypeColor ***** -type resultExtendedCommunityTransitiveOpaqueTypeColor struct { - validation - obj *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor - marshaller marshalResultExtendedCommunityTransitiveOpaqueTypeColor - unMarshaller unMarshalResultExtendedCommunityTransitiveOpaqueTypeColor -} - -func NewResultExtendedCommunityTransitiveOpaqueTypeColor() ResultExtendedCommunityTransitiveOpaqueTypeColor { - obj := resultExtendedCommunityTransitiveOpaqueTypeColor{obj: &otg.ResultExtendedCommunityTransitiveOpaqueTypeColor{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) msg() *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor { - return obj.obj -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) setMsg(msg *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor) ResultExtendedCommunityTransitiveOpaqueTypeColor { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityTransitiveOpaqueTypeColor struct { - obj *resultExtendedCommunityTransitiveOpaqueTypeColor -} - -type marshalResultExtendedCommunityTransitiveOpaqueTypeColor interface { - // ToProto marshals ResultExtendedCommunityTransitiveOpaqueTypeColor to protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor - ToProto() (*otg.ResultExtendedCommunityTransitiveOpaqueTypeColor, error) - // ToPbText marshals ResultExtendedCommunityTransitiveOpaqueTypeColor to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityTransitiveOpaqueTypeColor to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityTransitiveOpaqueTypeColor to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityTransitiveOpaqueTypeColor struct { - obj *resultExtendedCommunityTransitiveOpaqueTypeColor -} - -type unMarshalResultExtendedCommunityTransitiveOpaqueTypeColor interface { - // FromProto unmarshals ResultExtendedCommunityTransitiveOpaqueTypeColor from protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor - FromProto(msg *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor) (ResultExtendedCommunityTransitiveOpaqueTypeColor, error) - // FromPbText unmarshals ResultExtendedCommunityTransitiveOpaqueTypeColor from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityTransitiveOpaqueTypeColor from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityTransitiveOpaqueTypeColor from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) Marshal() marshalResultExtendedCommunityTransitiveOpaqueTypeColor { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityTransitiveOpaqueTypeColor{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) Unmarshal() unMarshalResultExtendedCommunityTransitiveOpaqueTypeColor { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityTransitiveOpaqueTypeColor{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityTransitiveOpaqueTypeColor) ToProto() (*otg.ResultExtendedCommunityTransitiveOpaqueTypeColor, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityTransitiveOpaqueTypeColor) FromProto(msg *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor) (ResultExtendedCommunityTransitiveOpaqueTypeColor, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityTransitiveOpaqueTypeColor) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueTypeColor) 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 *marshalresultExtendedCommunityTransitiveOpaqueTypeColor) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueTypeColor) 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 *marshalresultExtendedCommunityTransitiveOpaqueTypeColor) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueTypeColor) 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 *resultExtendedCommunityTransitiveOpaqueTypeColor) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) Clone() (ResultExtendedCommunityTransitiveOpaqueTypeColor, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityTransitiveOpaqueTypeColor() - 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 -} - -// ResultExtendedCommunityTransitiveOpaqueTypeColor is the Color Community contains locally administrator defined 'color' value which is used in conjunction with Encapsulation attribute to decide whether a data packet can be transmitted on a certain tunnel or not. It is defined in RFC9012 and sent with sub-type as 0x0b. -type ResultExtendedCommunityTransitiveOpaqueTypeColor interface { - Validation - // msg marshals ResultExtendedCommunityTransitiveOpaqueTypeColor to protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor - // setMsg unmarshals ResultExtendedCommunityTransitiveOpaqueTypeColor from protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityTransitiveOpaqueTypeColor) ResultExtendedCommunityTransitiveOpaqueTypeColor - // provides marshal interface - Marshal() marshalResultExtendedCommunityTransitiveOpaqueTypeColor - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityTransitiveOpaqueTypeColor - // validate validates ResultExtendedCommunityTransitiveOpaqueTypeColor - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityTransitiveOpaqueTypeColor, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns uint32, set in ResultExtendedCommunityTransitiveOpaqueTypeColor. - Flags() uint32 - // SetFlags assigns uint32 provided by user to ResultExtendedCommunityTransitiveOpaqueTypeColor - SetFlags(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeColor - // HasFlags checks if Flags has been set in ResultExtendedCommunityTransitiveOpaqueTypeColor - HasFlags() bool - // Color returns uint32, set in ResultExtendedCommunityTransitiveOpaqueTypeColor. - Color() uint32 - // SetColor assigns uint32 provided by user to ResultExtendedCommunityTransitiveOpaqueTypeColor - SetColor(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeColor - // HasColor checks if Color has been set in ResultExtendedCommunityTransitiveOpaqueTypeColor - HasColor() bool -} - -// Two octet flag values. -// Flags returns a uint32 -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) Flags() uint32 { - - return *obj.obj.Flags - -} - -// Two octet flag values. -// Flags returns a uint32 -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) HasFlags() bool { - return obj.obj.Flags != nil -} - -// Two octet flag values. -// SetFlags sets the uint32 value in the ResultExtendedCommunityTransitiveOpaqueTypeColor object -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) SetFlags(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeColor { - - obj.obj.Flags = &value - return obj -} - -// The color value is user defined and configured locally and used to determine whether a data packet can be transmitted on a certain tunnel or not -// in conjunction with the Encapsulation attribute. It is defined in RFC9012. -// Color returns a uint32 -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) Color() uint32 { - - return *obj.obj.Color - -} - -// The color value is user defined and configured locally and used to determine whether a data packet can be transmitted on a certain tunnel or not -// in conjunction with the Encapsulation attribute. It is defined in RFC9012. -// Color returns a uint32 -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) HasColor() bool { - return obj.obj.Color != nil -} - -// The color value is user defined and configured locally and used to determine whether a data packet can be transmitted on a certain tunnel or not -// in conjunction with the Encapsulation attribute. It is defined in RFC9012. -// SetColor sets the uint32 value in the ResultExtendedCommunityTransitiveOpaqueTypeColor object -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) SetColor(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeColor { - - obj.obj.Color = &value - return obj -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - if *obj.obj.Flags > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= ResultExtendedCommunityTransitiveOpaqueTypeColor.Flags <= 65535 but Got %d", *obj.obj.Flags)) - } - - } - -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) setDefault() { - -} - -// ***** ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation ***** -type resultExtendedCommunityTransitiveOpaqueTypeEncapsulation struct { - validation - obj *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - marshaller marshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - unMarshaller unMarshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation -} - -func NewResultExtendedCommunityTransitiveOpaqueTypeEncapsulation() ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { - obj := resultExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: &otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) msg() *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { - return obj.obj -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) setMsg(msg *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation) ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation struct { - obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation -} - -type marshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation interface { - // ToProto marshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation to protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - ToProto() (*otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) - // ToPbText marshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation struct { - obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation -} - -type unMarshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation interface { - // FromProto unmarshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation from protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - FromProto(msg *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation) (ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) - // FromPbText unmarshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) Marshal() marshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) Unmarshal() unMarshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) ToProto() (*otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) FromProto(msg *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation) (ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *marshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *marshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) Clone() (ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityTransitiveOpaqueTypeEncapsulation() - 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 -} - -// ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation is this identifies the type of tunneling technology being signalled. It is defined in RFC9012 and sent with sub-type as 0x0c. -type ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation interface { - Validation - // msg marshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation to protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - // setMsg unmarshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation from protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation) ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - // provides marshal interface - Marshal() marshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - // validate validates ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Reserved returns uint32, set in ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation. - Reserved() uint32 - // SetReserved assigns uint32 provided by user to ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - SetReserved(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - // HasReserved checks if Reserved has been set in ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - HasReserved() bool - // TunnelType returns uint32, set in ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation. - TunnelType() uint32 - // SetTunnelType assigns uint32 provided by user to ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - SetTunnelType(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - // HasTunnelType checks if TunnelType has been set in ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation - HasTunnelType() bool -} - -// Four bytes of reserved values. Normally set to 0 on transmit and ignored on receive. -// Reserved returns a uint32 -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) Reserved() uint32 { - - return *obj.obj.Reserved - -} - -// Four bytes of reserved values. Normally set to 0 on transmit and ignored on receive. -// Reserved returns a uint32 -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) HasReserved() bool { - return obj.obj.Reserved != nil -} - -// Four bytes of reserved values. Normally set to 0 on transmit and ignored on receive. -// SetReserved sets the uint32 value in the ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation object -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) SetReserved(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { - - obj.obj.Reserved = &value - return obj -} - -// Identifies the type of tunneling technology being signalled. Initially defined in RFC5512 and extended in RFC9012. -// Some of the important tunnel types include -// - 1 L2TPv3 over IP [RFC9012], -// - 2 GRE [RFC9012], -// - 7 IP in IP [RFC9012], -// - 8 VXLAN Encapsulation [RFC8365], -// - 9 NVGRE Encapsulation [RFC8365], -// - 10 MPLS Encapsulation [RFC8365], -// - 15 SR TE Policy Type [draft-ietf-idr-segment-routing-te-policy], -// - 19 Geneve Encapsulation [RFC8926] -// TunnelType returns a uint32 -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) TunnelType() uint32 { - - return *obj.obj.TunnelType - -} - -// Identifies the type of tunneling technology being signalled. Initially defined in RFC5512 and extended in RFC9012. -// Some of the important tunnel types include -// - 1 L2TPv3 over IP [RFC9012], -// - 2 GRE [RFC9012], -// - 7 IP in IP [RFC9012], -// - 8 VXLAN Encapsulation [RFC8365], -// - 9 NVGRE Encapsulation [RFC8365], -// - 10 MPLS Encapsulation [RFC8365], -// - 15 SR TE Policy Type [draft-ietf-idr-segment-routing-te-policy], -// - 19 Geneve Encapsulation [RFC8926] -// TunnelType returns a uint32 -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) HasTunnelType() bool { - return obj.obj.TunnelType != nil -} - -// Identifies the type of tunneling technology being signalled. Initially defined in RFC5512 and extended in RFC9012. -// Some of the important tunnel types include -// - 1 L2TPv3 over IP [RFC9012], -// - 2 GRE [RFC9012], -// - 7 IP in IP [RFC9012], -// - 8 VXLAN Encapsulation [RFC8365], -// - 9 NVGRE Encapsulation [RFC8365], -// - 10 MPLS Encapsulation [RFC8365], -// - 15 SR TE Policy Type [draft-ietf-idr-segment-routing-te-policy], -// - 19 Geneve Encapsulation [RFC8926] -// SetTunnelType sets the uint32 value in the ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation object -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) SetTunnelType(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { - - obj.obj.TunnelType = &value - return obj -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.TunnelType != nil { - - if *obj.obj.TunnelType > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation.TunnelType <= 65535 but Got %d", *obj.obj.TunnelType)) - } - - } - -} - -func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) setDefault() { - -} - -// ***** ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth ***** -type resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth struct { - validation - obj *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - marshaller marshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - unMarshaller unMarshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth -} - -func NewResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth() ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - obj := resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: &otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{}} - obj.setDefault() - return &obj -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) msg() *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - return obj.obj -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) setMsg(msg *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth struct { - obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth -} - -type marshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth interface { - // ToProto marshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - ToProto() (*otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) - // ToPbText marshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to protobuf text - ToPbText() (string, error) - // ToYaml marshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to YAML text - ToYaml() (string, error) - // ToJson marshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to JSON text - ToJson() (string, error) -} - -type unMarshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth struct { - obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth -} - -type unMarshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth interface { - // FromProto unmarshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - FromProto(msg *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) (ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) - // FromPbText unmarshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from protobuf text - FromPbText(value string) error - // FromYaml unmarshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from YAML text - FromYaml(value string) error - // FromJson unmarshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from JSON text - FromJson(value string) error -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Marshal() marshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - if obj.marshaller == nil { - obj.marshaller = &marshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: obj} - } - return obj.marshaller -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Unmarshal() unMarshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) ToProto() (*otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) FromProto(msg *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) (ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *unMarshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *marshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *unMarshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *marshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *unMarshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Clone() (ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth() - 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 -} - -// ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth is the Link Bandwidth Extended Community attribute is defined in draft-ietf-idr-link-bandwidth. It is sent with sub-type as 0x04. -type ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth interface { - Validation - // msg marshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // and doesn't set defaults - msg() *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // setMsg unmarshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // and doesn't set defaults - setMsg(*otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // provides marshal interface - Marshal() marshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // provides unmarshal interface - Unmarshal() unMarshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // validate validates ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - validate() error - // A stringer function - String() string - // Clones the object - Clone() (ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Global2ByteAs returns uint32, set in ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth. - Global2ByteAs() uint32 - // SetGlobal2ByteAs assigns uint32 provided by user to ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - SetGlobal2ByteAs(value uint32) ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // HasGlobal2ByteAs checks if Global2ByteAs has been set in ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - HasGlobal2ByteAs() bool - // Bandwidth returns float32, set in ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth. - Bandwidth() float32 - // SetBandwidth assigns float32 provided by user to ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - SetBandwidth(value float32) ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // HasBandwidth checks if Bandwidth has been set in ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - HasBandwidth() bool -} - -// The value of the Global Administrator subfield should represent the Autonomous System of the router that attaches the Link Bandwidth Community. If four octet AS numbering scheme is used, AS_TRANS (23456) should be used. -// Global2ByteAs returns a uint32 -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Global2ByteAs() uint32 { - - return *obj.obj.Global_2ByteAs - -} - -// The value of the Global Administrator subfield should represent the Autonomous System of the router that attaches the Link Bandwidth Community. If four octet AS numbering scheme is used, AS_TRANS (23456) should be used. -// Global2ByteAs returns a uint32 -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) HasGlobal2ByteAs() bool { - return obj.obj.Global_2ByteAs != nil -} - -// The value of the Global Administrator subfield should represent the Autonomous System of the router that attaches the Link Bandwidth Community. If four octet AS numbering scheme is used, AS_TRANS (23456) should be used. -// SetGlobal2ByteAs sets the uint32 value in the ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth object -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) SetGlobal2ByteAs(value uint32) ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - - obj.obj.Global_2ByteAs = &value - return obj -} - -// Bandwidth of the link in bytes per second. ( 1 Kbps is 1000 bytes per second and 1 Mbps is 1000 Kbps per second ) -// Bandwidth returns a float32 -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Bandwidth() float32 { - - return *obj.obj.Bandwidth - -} - -// Bandwidth of the link in bytes per second. ( 1 Kbps is 1000 bytes per second and 1 Mbps is 1000 Kbps per second ) -// Bandwidth returns a float32 -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) HasBandwidth() bool { - return obj.obj.Bandwidth != nil -} - -// Bandwidth of the link in bytes per second. ( 1 Kbps is 1000 bytes per second and 1 Mbps is 1000 Kbps per second ) -// SetBandwidth sets the float32 value in the ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth object -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) SetBandwidth(value float32) ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - - obj.obj.Bandwidth = &value - return obj -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Global_2ByteAs != nil { - - if *obj.obj.Global_2ByteAs > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth.Global_2ByteAs <= 65535 but Got %d", *obj.obj.Global_2ByteAs)) - } - - } - -} - -func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) setDefault() { - -} - -// ***** IsisLspPrefixAttributes ***** -type isisLspPrefixAttributes struct { - validation - obj *otg.IsisLspPrefixAttributes - marshaller marshalIsisLspPrefixAttributes - unMarshaller unMarshalIsisLspPrefixAttributes -} - -func NewIsisLspPrefixAttributes() IsisLspPrefixAttributes { - obj := isisLspPrefixAttributes{obj: &otg.IsisLspPrefixAttributes{}} - obj.setDefault() - return &obj -} - -func (obj *isisLspPrefixAttributes) msg() *otg.IsisLspPrefixAttributes { - return obj.obj -} - -func (obj *isisLspPrefixAttributes) setMsg(msg *otg.IsisLspPrefixAttributes) IsisLspPrefixAttributes { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalisisLspPrefixAttributes struct { - obj *isisLspPrefixAttributes -} - -type marshalIsisLspPrefixAttributes interface { - // ToProto marshals IsisLspPrefixAttributes to protobuf object *otg.IsisLspPrefixAttributes - ToProto() (*otg.IsisLspPrefixAttributes, error) - // ToPbText marshals IsisLspPrefixAttributes to protobuf text - ToPbText() (string, error) - // ToYaml marshals IsisLspPrefixAttributes to YAML text - ToYaml() (string, error) - // ToJson marshals IsisLspPrefixAttributes to JSON text - ToJson() (string, error) -} - -type unMarshalisisLspPrefixAttributes struct { - obj *isisLspPrefixAttributes -} - -type unMarshalIsisLspPrefixAttributes interface { - // FromProto unmarshals IsisLspPrefixAttributes from protobuf object *otg.IsisLspPrefixAttributes - FromProto(msg *otg.IsisLspPrefixAttributes) (IsisLspPrefixAttributes, error) - // FromPbText unmarshals IsisLspPrefixAttributes from protobuf text - FromPbText(value string) error - // FromYaml unmarshals IsisLspPrefixAttributes from YAML text - FromYaml(value string) error - // FromJson unmarshals IsisLspPrefixAttributes from JSON text - FromJson(value string) error -} - -func (obj *isisLspPrefixAttributes) Marshal() marshalIsisLspPrefixAttributes { - if obj.marshaller == nil { - obj.marshaller = &marshalisisLspPrefixAttributes{obj: obj} - } - return obj.marshaller -} - -func (obj *isisLspPrefixAttributes) Unmarshal() unMarshalIsisLspPrefixAttributes { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalisisLspPrefixAttributes{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalisisLspPrefixAttributes) ToProto() (*otg.IsisLspPrefixAttributes, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalisisLspPrefixAttributes) FromProto(msg *otg.IsisLspPrefixAttributes) (IsisLspPrefixAttributes, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalisisLspPrefixAttributes) 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 *unMarshalisisLspPrefixAttributes) 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 *marshalisisLspPrefixAttributes) 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 *unMarshalisisLspPrefixAttributes) 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 *marshalisisLspPrefixAttributes) 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 *unMarshalisisLspPrefixAttributes) 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 *isisLspPrefixAttributes) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *isisLspPrefixAttributes) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *isisLspPrefixAttributes) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *isisLspPrefixAttributes) Clone() (IsisLspPrefixAttributes, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewIsisLspPrefixAttributes() - 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 -} - -// IsisLspPrefixAttributes is this contains the properties of ISIS Prefix attributes for the extended IPv4 and IPv6 reachability. https://www.rfc-editor.org/rfc/rfc7794.html -type IsisLspPrefixAttributes interface { - Validation - // msg marshals IsisLspPrefixAttributes to protobuf object *otg.IsisLspPrefixAttributes - // and doesn't set defaults - msg() *otg.IsisLspPrefixAttributes - // setMsg unmarshals IsisLspPrefixAttributes from protobuf object *otg.IsisLspPrefixAttributes - // and doesn't set defaults - setMsg(*otg.IsisLspPrefixAttributes) IsisLspPrefixAttributes - // provides marshal interface - Marshal() marshalIsisLspPrefixAttributes - // provides unmarshal interface - Unmarshal() unMarshalIsisLspPrefixAttributes - // validate validates IsisLspPrefixAttributes - validate() error - // A stringer function - String() string - // Clones the object - Clone() (IsisLspPrefixAttributes, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // XFlag returns bool, set in IsisLspPrefixAttributes. - XFlag() bool - // SetXFlag assigns bool provided by user to IsisLspPrefixAttributes - SetXFlag(value bool) IsisLspPrefixAttributes - // HasXFlag checks if XFlag has been set in IsisLspPrefixAttributes - HasXFlag() bool - // RFlag returns bool, set in IsisLspPrefixAttributes. - RFlag() bool - // SetRFlag assigns bool provided by user to IsisLspPrefixAttributes - SetRFlag(value bool) IsisLspPrefixAttributes - // HasRFlag checks if RFlag has been set in IsisLspPrefixAttributes - HasRFlag() bool - // NFlag returns bool, set in IsisLspPrefixAttributes. - NFlag() bool - // SetNFlag assigns bool provided by user to IsisLspPrefixAttributes - SetNFlag(value bool) IsisLspPrefixAttributes - // HasNFlag checks if NFlag has been set in IsisLspPrefixAttributes - HasNFlag() bool -} - -// External Prefix Flag (Bit 0) -// XFlag returns a bool -func (obj *isisLspPrefixAttributes) XFlag() bool { - - return *obj.obj.XFlag - -} - -// External Prefix Flag (Bit 0) -// XFlag returns a bool -func (obj *isisLspPrefixAttributes) HasXFlag() bool { - return obj.obj.XFlag != nil -} - -// External Prefix Flag (Bit 0) -// SetXFlag sets the bool value in the IsisLspPrefixAttributes object -func (obj *isisLspPrefixAttributes) SetXFlag(value bool) IsisLspPrefixAttributes { - - obj.obj.XFlag = &value - return obj -} - -// Re-advertisement Flag (Bit 1) -// RFlag returns a bool -func (obj *isisLspPrefixAttributes) RFlag() bool { - - return *obj.obj.RFlag - -} - -// Re-advertisement Flag (Bit 1) -// RFlag returns a bool -func (obj *isisLspPrefixAttributes) HasRFlag() bool { - return obj.obj.RFlag != nil -} - -// Re-advertisement Flag (Bit 1) -// SetRFlag sets the bool value in the IsisLspPrefixAttributes object -func (obj *isisLspPrefixAttributes) SetRFlag(value bool) IsisLspPrefixAttributes { - - obj.obj.RFlag = &value - return obj -} - -// Node Flag (Bit 2) -// NFlag returns a bool -func (obj *isisLspPrefixAttributes) NFlag() bool { - - return *obj.obj.NFlag - -} - -// Node Flag (Bit 2) -// NFlag returns a bool -func (obj *isisLspPrefixAttributes) HasNFlag() bool { - return obj.obj.NFlag != nil -} - -// Node Flag (Bit 2) -// SetNFlag sets the bool value in the IsisLspPrefixAttributes object -func (obj *isisLspPrefixAttributes) SetNFlag(value bool) IsisLspPrefixAttributes { - - obj.obj.NFlag = &value - return obj -} - -func (obj *isisLspPrefixAttributes) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *isisLspPrefixAttributes) setDefault() { - -} - -// ***** BgpV4EviVxlanBroadcastDomain ***** -type bgpV4EviVxlanBroadcastDomain struct { - validation - obj *otg.BgpV4EviVxlanBroadcastDomain - marshaller marshalBgpV4EviVxlanBroadcastDomain - unMarshaller unMarshalBgpV4EviVxlanBroadcastDomain - cmacIpRangeHolder BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter -} - -func NewBgpV4EviVxlanBroadcastDomain() BgpV4EviVxlanBroadcastDomain { - obj := bgpV4EviVxlanBroadcastDomain{obj: &otg.BgpV4EviVxlanBroadcastDomain{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV4EviVxlanBroadcastDomain) msg() *otg.BgpV4EviVxlanBroadcastDomain { - return obj.obj -} - -func (obj *bgpV4EviVxlanBroadcastDomain) setMsg(msg *otg.BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBroadcastDomain { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV4EviVxlanBroadcastDomain struct { - obj *bgpV4EviVxlanBroadcastDomain -} - -type marshalBgpV4EviVxlanBroadcastDomain interface { - // ToProto marshals BgpV4EviVxlanBroadcastDomain to protobuf object *otg.BgpV4EviVxlanBroadcastDomain - ToProto() (*otg.BgpV4EviVxlanBroadcastDomain, error) - // ToPbText marshals BgpV4EviVxlanBroadcastDomain to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV4EviVxlanBroadcastDomain to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV4EviVxlanBroadcastDomain to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV4EviVxlanBroadcastDomain struct { - obj *bgpV4EviVxlanBroadcastDomain -} - -type unMarshalBgpV4EviVxlanBroadcastDomain interface { - // FromProto unmarshals BgpV4EviVxlanBroadcastDomain from protobuf object *otg.BgpV4EviVxlanBroadcastDomain - FromProto(msg *otg.BgpV4EviVxlanBroadcastDomain) (BgpV4EviVxlanBroadcastDomain, error) - // FromPbText unmarshals BgpV4EviVxlanBroadcastDomain from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV4EviVxlanBroadcastDomain from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV4EviVxlanBroadcastDomain from JSON text - FromJson(value string) error -} - -func (obj *bgpV4EviVxlanBroadcastDomain) Marshal() marshalBgpV4EviVxlanBroadcastDomain { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV4EviVxlanBroadcastDomain{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV4EviVxlanBroadcastDomain) Unmarshal() unMarshalBgpV4EviVxlanBroadcastDomain { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV4EviVxlanBroadcastDomain{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV4EviVxlanBroadcastDomain) ToProto() (*otg.BgpV4EviVxlanBroadcastDomain, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV4EviVxlanBroadcastDomain) FromProto(msg *otg.BgpV4EviVxlanBroadcastDomain) (BgpV4EviVxlanBroadcastDomain, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV4EviVxlanBroadcastDomain) 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 *unMarshalbgpV4EviVxlanBroadcastDomain) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpV4EviVxlanBroadcastDomain) 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 *unMarshalbgpV4EviVxlanBroadcastDomain) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpV4EviVxlanBroadcastDomain) 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 *unMarshalbgpV4EviVxlanBroadcastDomain) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpV4EviVxlanBroadcastDomain) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV4EviVxlanBroadcastDomain) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV4EviVxlanBroadcastDomain) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV4EviVxlanBroadcastDomain) Clone() (BgpV4EviVxlanBroadcastDomain, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV4EviVxlanBroadcastDomain() - 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 -} - -func (obj *bgpV4EviVxlanBroadcastDomain) setNil() { - obj.cmacIpRangeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpV4EviVxlanBroadcastDomain is configuration for Broadcast Domains per EVI. -type BgpV4EviVxlanBroadcastDomain interface { - Validation - // msg marshals BgpV4EviVxlanBroadcastDomain to protobuf object *otg.BgpV4EviVxlanBroadcastDomain - // and doesn't set defaults - msg() *otg.BgpV4EviVxlanBroadcastDomain - // setMsg unmarshals BgpV4EviVxlanBroadcastDomain from protobuf object *otg.BgpV4EviVxlanBroadcastDomain - // and doesn't set defaults - setMsg(*otg.BgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBroadcastDomain - // provides marshal interface - Marshal() marshalBgpV4EviVxlanBroadcastDomain - // provides unmarshal interface - Unmarshal() unMarshalBgpV4EviVxlanBroadcastDomain - // validate validates BgpV4EviVxlanBroadcastDomain - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV4EviVxlanBroadcastDomain, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // CmacIpRange returns BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIterIter, set in BgpV4EviVxlanBroadcastDomain - CmacIpRange() BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter - // EthernetTagId returns uint32, set in BgpV4EviVxlanBroadcastDomain. - EthernetTagId() uint32 - // SetEthernetTagId assigns uint32 provided by user to BgpV4EviVxlanBroadcastDomain - SetEthernetTagId(value uint32) BgpV4EviVxlanBroadcastDomain - // HasEthernetTagId checks if EthernetTagId has been set in BgpV4EviVxlanBroadcastDomain - HasEthernetTagId() bool - // VlanAwareService returns bool, set in BgpV4EviVxlanBroadcastDomain. - VlanAwareService() bool - // SetVlanAwareService assigns bool provided by user to BgpV4EviVxlanBroadcastDomain - SetVlanAwareService(value bool) BgpV4EviVxlanBroadcastDomain - // HasVlanAwareService checks if VlanAwareService has been set in BgpV4EviVxlanBroadcastDomain - HasVlanAwareService() bool - setNil() -} - -// This contains the list of Customer MAC/IP Ranges to be configured per Broadcast Domain. -// -// Advertises following route - -// Type 2 - MAC/IP Advertisement Route. -// CmacIpRange returns a []BgpCMacIpRange -func (obj *bgpV4EviVxlanBroadcastDomain) CmacIpRange() BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { - if len(obj.obj.CmacIpRange) == 0 { - obj.obj.CmacIpRange = []*otg.BgpCMacIpRange{} - } - if obj.cmacIpRangeHolder == nil { - obj.cmacIpRangeHolder = newBgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter(&obj.obj.CmacIpRange).setMsg(obj) - } - return obj.cmacIpRangeHolder -} - -type bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter struct { - obj *bgpV4EviVxlanBroadcastDomain - bgpCMacIpRangeSlice []BgpCMacIpRange - fieldPtr *[]*otg.BgpCMacIpRange -} - -func newBgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter(ptr *[]*otg.BgpCMacIpRange) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { - return &bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter{fieldPtr: ptr} -} - -type BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter interface { - setMsg(*bgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter - Items() []BgpCMacIpRange - Add() BgpCMacIpRange - Append(items ...BgpCMacIpRange) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter - Set(index int, newObj BgpCMacIpRange) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter - Clear() BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter - clearHolderSlice() BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter - appendHolderSlice(item BgpCMacIpRange) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter -} - -func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) setMsg(msg *bgpV4EviVxlanBroadcastDomain) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpCMacIpRange{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) Items() []BgpCMacIpRange { - return obj.bgpCMacIpRangeSlice -} - -func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) Add() BgpCMacIpRange { - newObj := &otg.BgpCMacIpRange{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpCMacIpRange{obj: newObj} - newLibObj.setDefault() - obj.bgpCMacIpRangeSlice = append(obj.bgpCMacIpRangeSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) Append(items ...BgpCMacIpRange) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpCMacIpRangeSlice = append(obj.bgpCMacIpRangeSlice, item) - } - return obj -} - -func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) Set(index int, newObj BgpCMacIpRange) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpCMacIpRangeSlice[index] = newObj - return obj -} -func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) Clear() BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpCMacIpRange{} - obj.bgpCMacIpRangeSlice = []BgpCMacIpRange{} - } - return obj -} -func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) clearHolderSlice() BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { - if len(obj.bgpCMacIpRangeSlice) > 0 { - obj.bgpCMacIpRangeSlice = []BgpCMacIpRange{} - } - return obj -} -func (obj *bgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter) appendHolderSlice(item BgpCMacIpRange) BgpV4EviVxlanBroadcastDomainBgpCMacIpRangeIter { - obj.bgpCMacIpRangeSlice = append(obj.bgpCMacIpRangeSlice, item) - return obj -} - -// The Ethernet Tag ID of the Broadcast Domain. -// EthernetTagId returns a uint32 -func (obj *bgpV4EviVxlanBroadcastDomain) EthernetTagId() uint32 { - - return *obj.obj.EthernetTagId - -} - -// The Ethernet Tag ID of the Broadcast Domain. -// EthernetTagId returns a uint32 -func (obj *bgpV4EviVxlanBroadcastDomain) HasEthernetTagId() bool { - return obj.obj.EthernetTagId != nil -} - -// The Ethernet Tag ID of the Broadcast Domain. -// SetEthernetTagId sets the uint32 value in the BgpV4EviVxlanBroadcastDomain object -func (obj *bgpV4EviVxlanBroadcastDomain) SetEthernetTagId(value uint32) BgpV4EviVxlanBroadcastDomain { - - obj.obj.EthernetTagId = &value - return obj -} - -// VLAN-Aware service to be enabled or disabled. -// VlanAwareService returns a bool -func (obj *bgpV4EviVxlanBroadcastDomain) VlanAwareService() bool { - - return *obj.obj.VlanAwareService - -} - -// VLAN-Aware service to be enabled or disabled. -// VlanAwareService returns a bool -func (obj *bgpV4EviVxlanBroadcastDomain) HasVlanAwareService() bool { - return obj.obj.VlanAwareService != nil -} - -// VLAN-Aware service to be enabled or disabled. -// SetVlanAwareService sets the bool value in the BgpV4EviVxlanBroadcastDomain object -func (obj *bgpV4EviVxlanBroadcastDomain) SetVlanAwareService(value bool) BgpV4EviVxlanBroadcastDomain { - - obj.obj.VlanAwareService = &value - return obj -} - -func (obj *bgpV4EviVxlanBroadcastDomain) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.CmacIpRange) != 0 { - - if set_default { - obj.CmacIpRange().clearHolderSlice() - for _, item := range obj.obj.CmacIpRange { - obj.CmacIpRange().appendHolderSlice(&bgpCMacIpRange{obj: item}) - } - } - for _, item := range obj.CmacIpRange().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpV4EviVxlanBroadcastDomain) setDefault() { - if obj.obj.EthernetTagId == nil { - obj.SetEthernetTagId(0) - } - if obj.obj.VlanAwareService == nil { - obj.SetVlanAwareService(false) - } - -} - -// ***** BgpRouteDistinguisher ***** -type bgpRouteDistinguisher struct { - validation - obj *otg.BgpRouteDistinguisher - marshaller marshalBgpRouteDistinguisher - unMarshaller unMarshalBgpRouteDistinguisher -} - -func NewBgpRouteDistinguisher() BgpRouteDistinguisher { - obj := bgpRouteDistinguisher{obj: &otg.BgpRouteDistinguisher{}} - obj.setDefault() - return &obj -} - -func (obj *bgpRouteDistinguisher) msg() *otg.BgpRouteDistinguisher { - return obj.obj -} - -func (obj *bgpRouteDistinguisher) setMsg(msg *otg.BgpRouteDistinguisher) BgpRouteDistinguisher { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpRouteDistinguisher struct { - obj *bgpRouteDistinguisher -} - -type marshalBgpRouteDistinguisher interface { - // ToProto marshals BgpRouteDistinguisher to protobuf object *otg.BgpRouteDistinguisher - ToProto() (*otg.BgpRouteDistinguisher, error) - // ToPbText marshals BgpRouteDistinguisher to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpRouteDistinguisher to YAML text - ToYaml() (string, error) - // ToJson marshals BgpRouteDistinguisher to JSON text - ToJson() (string, error) -} - -type unMarshalbgpRouteDistinguisher struct { - obj *bgpRouteDistinguisher -} - -type unMarshalBgpRouteDistinguisher interface { - // FromProto unmarshals BgpRouteDistinguisher from protobuf object *otg.BgpRouteDistinguisher - FromProto(msg *otg.BgpRouteDistinguisher) (BgpRouteDistinguisher, error) - // FromPbText unmarshals BgpRouteDistinguisher from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpRouteDistinguisher from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpRouteDistinguisher from JSON text - FromJson(value string) error -} - -func (obj *bgpRouteDistinguisher) Marshal() marshalBgpRouteDistinguisher { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpRouteDistinguisher{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpRouteDistinguisher) Unmarshal() unMarshalBgpRouteDistinguisher { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpRouteDistinguisher{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpRouteDistinguisher) ToProto() (*otg.BgpRouteDistinguisher, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpRouteDistinguisher) FromProto(msg *otg.BgpRouteDistinguisher) (BgpRouteDistinguisher, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpRouteDistinguisher) 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 *unMarshalbgpRouteDistinguisher) 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 *marshalbgpRouteDistinguisher) 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 *unMarshalbgpRouteDistinguisher) 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 *marshalbgpRouteDistinguisher) 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 *unMarshalbgpRouteDistinguisher) 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 *bgpRouteDistinguisher) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpRouteDistinguisher) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpRouteDistinguisher) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpRouteDistinguisher) Clone() (BgpRouteDistinguisher, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpRouteDistinguisher() - 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 -} - -// BgpRouteDistinguisher is bGP Route Distinguisher. -type BgpRouteDistinguisher interface { - Validation - // msg marshals BgpRouteDistinguisher to protobuf object *otg.BgpRouteDistinguisher - // and doesn't set defaults - msg() *otg.BgpRouteDistinguisher - // setMsg unmarshals BgpRouteDistinguisher from protobuf object *otg.BgpRouteDistinguisher - // and doesn't set defaults - setMsg(*otg.BgpRouteDistinguisher) BgpRouteDistinguisher - // provides marshal interface - Marshal() marshalBgpRouteDistinguisher - // provides unmarshal interface - Unmarshal() unMarshalBgpRouteDistinguisher - // validate validates BgpRouteDistinguisher - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpRouteDistinguisher, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RdType returns BgpRouteDistinguisherRdTypeEnum, set in BgpRouteDistinguisher - RdType() BgpRouteDistinguisherRdTypeEnum - // SetRdType assigns BgpRouteDistinguisherRdTypeEnum provided by user to BgpRouteDistinguisher - SetRdType(value BgpRouteDistinguisherRdTypeEnum) BgpRouteDistinguisher - // HasRdType checks if RdType has been set in BgpRouteDistinguisher - HasRdType() bool - // AutoConfigRdIpAddr returns bool, set in BgpRouteDistinguisher. - AutoConfigRdIpAddr() bool - // SetAutoConfigRdIpAddr assigns bool provided by user to BgpRouteDistinguisher - SetAutoConfigRdIpAddr(value bool) BgpRouteDistinguisher - // HasAutoConfigRdIpAddr checks if AutoConfigRdIpAddr has been set in BgpRouteDistinguisher - HasAutoConfigRdIpAddr() bool - // RdValue returns string, set in BgpRouteDistinguisher. - RdValue() string - // SetRdValue assigns string provided by user to BgpRouteDistinguisher - SetRdValue(value string) BgpRouteDistinguisher - // HasRdValue checks if RdValue has been set in BgpRouteDistinguisher - HasRdValue() bool -} - -type BgpRouteDistinguisherRdTypeEnum string - -// Enum of RdType on BgpRouteDistinguisher -var BgpRouteDistinguisherRdType = struct { - AS_2OCTET BgpRouteDistinguisherRdTypeEnum - IPV4_ADDRESS BgpRouteDistinguisherRdTypeEnum - AS_4OCTET BgpRouteDistinguisherRdTypeEnum -}{ - AS_2OCTET: BgpRouteDistinguisherRdTypeEnum("as_2octet"), - IPV4_ADDRESS: BgpRouteDistinguisherRdTypeEnum("ipv4_address"), - AS_4OCTET: BgpRouteDistinguisherRdTypeEnum("as_4octet"), -} - -func (obj *bgpRouteDistinguisher) RdType() BgpRouteDistinguisherRdTypeEnum { - return BgpRouteDistinguisherRdTypeEnum(obj.obj.RdType.Enum().String()) -} - -// Route Distinguisher Type field of 2 Byte. -// - as_2octet: Two-Octet AS Specific Extended Community (RFC 4360). -// - ipv4_address: IPv4 Address Specific Extended Community (RFC 4360). -// - as_4octet: 4-Octet AS Specific Extended Community (RFC 5668). -// RdType returns a string -func (obj *bgpRouteDistinguisher) HasRdType() bool { - return obj.obj.RdType != nil -} - -func (obj *bgpRouteDistinguisher) SetRdType(value BgpRouteDistinguisherRdTypeEnum) BgpRouteDistinguisher { - intValue, ok := otg.BgpRouteDistinguisher_RdType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpRouteDistinguisherRdTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpRouteDistinguisher_RdType_Enum(intValue) - obj.obj.RdType = &enumValue - - return obj -} - -// Allow to automatically configure RD IP address from local ip. -// AutoConfigRdIpAddr returns a bool -func (obj *bgpRouteDistinguisher) AutoConfigRdIpAddr() bool { - - return *obj.obj.AutoConfigRdIpAddr - -} - -// Allow to automatically configure RD IP address from local ip. -// AutoConfigRdIpAddr returns a bool -func (obj *bgpRouteDistinguisher) HasAutoConfigRdIpAddr() bool { - return obj.obj.AutoConfigRdIpAddr != nil -} - -// Allow to automatically configure RD IP address from local ip. -// SetAutoConfigRdIpAddr sets the bool value in the BgpRouteDistinguisher object -func (obj *bgpRouteDistinguisher) SetAutoConfigRdIpAddr(value bool) BgpRouteDistinguisher { - - obj.obj.AutoConfigRdIpAddr = &value - return obj -} - -// Colon separated Extended Community value of 6 Bytes - "AS number: Value". Example - for the as_2octet or as_4octet "60005:100", for ipv4_address "1.1.1.1:100" -// RdValue returns a string -func (obj *bgpRouteDistinguisher) RdValue() string { - - return *obj.obj.RdValue - -} - -// Colon separated Extended Community value of 6 Bytes - "AS number: Value". Example - for the as_2octet or as_4octet "60005:100", for ipv4_address "1.1.1.1:100" -// RdValue returns a string -func (obj *bgpRouteDistinguisher) HasRdValue() bool { - return obj.obj.RdValue != nil -} - -// Colon separated Extended Community value of 6 Bytes - "AS number: Value". Example - for the as_2octet or as_4octet "60005:100", for ipv4_address "1.1.1.1:100" -// SetRdValue sets the string value in the BgpRouteDistinguisher object -func (obj *bgpRouteDistinguisher) SetRdValue(value string) BgpRouteDistinguisher { - - obj.obj.RdValue = &value - return obj -} - -func (obj *bgpRouteDistinguisher) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpRouteDistinguisher) setDefault() { - if obj.obj.RdType == nil { - obj.SetRdType(BgpRouteDistinguisherRdType.AS_2OCTET) - - } - if obj.obj.AutoConfigRdIpAddr == nil { - obj.SetAutoConfigRdIpAddr(false) - } - -} - -// ***** BgpRouteTarget ***** -type bgpRouteTarget struct { - validation - obj *otg.BgpRouteTarget - marshaller marshalBgpRouteTarget - unMarshaller unMarshalBgpRouteTarget -} - -func NewBgpRouteTarget() BgpRouteTarget { - obj := bgpRouteTarget{obj: &otg.BgpRouteTarget{}} - obj.setDefault() - return &obj -} - -func (obj *bgpRouteTarget) msg() *otg.BgpRouteTarget { - return obj.obj -} - -func (obj *bgpRouteTarget) setMsg(msg *otg.BgpRouteTarget) BgpRouteTarget { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpRouteTarget struct { - obj *bgpRouteTarget -} - -type marshalBgpRouteTarget interface { - // ToProto marshals BgpRouteTarget to protobuf object *otg.BgpRouteTarget - ToProto() (*otg.BgpRouteTarget, error) - // ToPbText marshals BgpRouteTarget to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpRouteTarget to YAML text - ToYaml() (string, error) - // ToJson marshals BgpRouteTarget to JSON text - ToJson() (string, error) -} - -type unMarshalbgpRouteTarget struct { - obj *bgpRouteTarget -} - -type unMarshalBgpRouteTarget interface { - // FromProto unmarshals BgpRouteTarget from protobuf object *otg.BgpRouteTarget - FromProto(msg *otg.BgpRouteTarget) (BgpRouteTarget, error) - // FromPbText unmarshals BgpRouteTarget from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpRouteTarget from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpRouteTarget from JSON text - FromJson(value string) error -} - -func (obj *bgpRouteTarget) Marshal() marshalBgpRouteTarget { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpRouteTarget{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpRouteTarget) Unmarshal() unMarshalBgpRouteTarget { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpRouteTarget{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpRouteTarget) ToProto() (*otg.BgpRouteTarget, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpRouteTarget) FromProto(msg *otg.BgpRouteTarget) (BgpRouteTarget, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpRouteTarget) 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 *unMarshalbgpRouteTarget) 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 *marshalbgpRouteTarget) 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 *unMarshalbgpRouteTarget) 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 *marshalbgpRouteTarget) 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 *unMarshalbgpRouteTarget) 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 *bgpRouteTarget) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpRouteTarget) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpRouteTarget) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpRouteTarget) Clone() (BgpRouteTarget, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpRouteTarget() - 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 -} - -// BgpRouteTarget is bGP Route Target. -type BgpRouteTarget interface { - Validation - // msg marshals BgpRouteTarget to protobuf object *otg.BgpRouteTarget - // and doesn't set defaults - msg() *otg.BgpRouteTarget - // setMsg unmarshals BgpRouteTarget from protobuf object *otg.BgpRouteTarget - // and doesn't set defaults - setMsg(*otg.BgpRouteTarget) BgpRouteTarget - // provides marshal interface - Marshal() marshalBgpRouteTarget - // provides unmarshal interface - Unmarshal() unMarshalBgpRouteTarget - // validate validates BgpRouteTarget - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpRouteTarget, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RtType returns BgpRouteTargetRtTypeEnum, set in BgpRouteTarget - RtType() BgpRouteTargetRtTypeEnum - // SetRtType assigns BgpRouteTargetRtTypeEnum provided by user to BgpRouteTarget - SetRtType(value BgpRouteTargetRtTypeEnum) BgpRouteTarget - // HasRtType checks if RtType has been set in BgpRouteTarget - HasRtType() bool - // RtValue returns string, set in BgpRouteTarget. - RtValue() string - // SetRtValue assigns string provided by user to BgpRouteTarget - SetRtValue(value string) BgpRouteTarget - // HasRtValue checks if RtValue has been set in BgpRouteTarget - HasRtValue() bool -} - -type BgpRouteTargetRtTypeEnum string - -// Enum of RtType on BgpRouteTarget -var BgpRouteTargetRtType = struct { - AS_2OCTET BgpRouteTargetRtTypeEnum - IPV4_ADDRESS BgpRouteTargetRtTypeEnum - AS_4OCTET BgpRouteTargetRtTypeEnum -}{ - AS_2OCTET: BgpRouteTargetRtTypeEnum("as_2octet"), - IPV4_ADDRESS: BgpRouteTargetRtTypeEnum("ipv4_address"), - AS_4OCTET: BgpRouteTargetRtTypeEnum("as_4octet"), -} - -func (obj *bgpRouteTarget) RtType() BgpRouteTargetRtTypeEnum { - return BgpRouteTargetRtTypeEnum(obj.obj.RtType.Enum().String()) -} - -// Extended Community Type field of 2 Byte. -// - as_2octet: Two-Octet AS Specific Extended Community (RFC 4360). -// - ipv4_address: IPv4 Address Specific Extended Community (RFC 4360). -// - as_4octet: 4-Octet AS Specific Extended Community (RFC 5668). -// RtType returns a string -func (obj *bgpRouteTarget) HasRtType() bool { - return obj.obj.RtType != nil -} - -func (obj *bgpRouteTarget) SetRtType(value BgpRouteTargetRtTypeEnum) BgpRouteTarget { - intValue, ok := otg.BgpRouteTarget_RtType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpRouteTargetRtTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpRouteTarget_RtType_Enum(intValue) - obj.obj.RtType = &enumValue - - return obj -} - -// Colon separated Extended Community value of 6 Bytes - AS number: Assigned Number. Example - for the as_2octet or as_4octet "60005:100", for ipv4_address "1.1.1.1:100" -// RtValue returns a string -func (obj *bgpRouteTarget) RtValue() string { - - return *obj.obj.RtValue - -} - -// Colon separated Extended Community value of 6 Bytes - AS number: Assigned Number. Example - for the as_2octet or as_4octet "60005:100", for ipv4_address "1.1.1.1:100" -// RtValue returns a string -func (obj *bgpRouteTarget) HasRtValue() bool { - return obj.obj.RtValue != nil -} - -// Colon separated Extended Community value of 6 Bytes - AS number: Assigned Number. Example - for the as_2octet or as_4octet "60005:100", for ipv4_address "1.1.1.1:100" -// SetRtValue sets the string value in the BgpRouteTarget object -func (obj *bgpRouteTarget) SetRtValue(value string) BgpRouteTarget { - - obj.obj.RtValue = &value - return obj -} - -func (obj *bgpRouteTarget) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpRouteTarget) setDefault() { - -} - -// ***** BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget ***** -type bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget struct { - validation - obj *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - marshaller marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - unMarshaller unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget -} - -func NewBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget() BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { - obj := bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: &otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) msg() *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { - return obj.obj -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) setMsg(msg *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget struct { - obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget -} - -type marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget interface { - // ToProto marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget to protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - ToProto() (*otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) - // ToPbText marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget struct { - obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget -} - -type unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget interface { - // FromProto unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget from protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - FromProto(msg *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) (BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) - // FromPbText unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) Marshal() marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) Unmarshal() unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) ToProto() (*otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) FromProto(msg *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) (BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) Clone() (BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget() - 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 -} - -// BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. -type BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget interface { - Validation - // msg marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget to protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - // setMsg unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget from protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - // provides marshal interface - Marshal() marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - // validate validates BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Global2ByteAs returns uint32, set in BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget. - Global2ByteAs() uint32 - // SetGlobal2ByteAs assigns uint32 provided by user to BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - SetGlobal2ByteAs(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - // HasGlobal2ByteAs checks if Global2ByteAs has been set in BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - HasGlobal2ByteAs() bool - // Local4ByteAdmin returns uint32, set in BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget. - Local4ByteAdmin() uint32 - // SetLocal4ByteAdmin assigns uint32 provided by user to BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - SetLocal4ByteAdmin(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - // HasLocal4ByteAdmin checks if Local4ByteAdmin has been set in BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget - HasLocal4ByteAdmin() bool -} - -// The two octet IANA assigned AS value assigned to the Autonomous System. -// Global2ByteAs returns a uint32 -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) Global2ByteAs() uint32 { - - return *obj.obj.Global_2ByteAs - -} - -// The two octet IANA assigned AS value assigned to the Autonomous System. -// Global2ByteAs returns a uint32 -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) HasGlobal2ByteAs() bool { - return obj.obj.Global_2ByteAs != nil -} - -// The two octet IANA assigned AS value assigned to the Autonomous System. -// SetGlobal2ByteAs sets the uint32 value in the BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget object -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) SetGlobal2ByteAs(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { - - obj.obj.Global_2ByteAs = &value - return obj -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local4ByteAdmin returns a uint32 -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) Local4ByteAdmin() uint32 { - - return *obj.obj.Local_4ByteAdmin - -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local4ByteAdmin returns a uint32 -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) HasLocal4ByteAdmin() bool { - return obj.obj.Local_4ByteAdmin != nil -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// SetLocal4ByteAdmin sets the uint32 value in the BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget object -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) SetLocal4ByteAdmin(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget { - - obj.obj.Local_4ByteAdmin = &value - return obj -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Global_2ByteAs != nil { - - if *obj.obj.Global_2ByteAs > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpExtendedCommunityTransitive2OctetAsTypeRouteTarget.Global_2ByteAs <= 65535 but Got %d", *obj.obj.Global_2ByteAs)) - } - - } - -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteTarget) setDefault() { - if obj.obj.Global_2ByteAs == nil { - obj.SetGlobal2ByteAs(100) - } - if obj.obj.Local_4ByteAdmin == nil { - obj.SetLocal4ByteAdmin(1) - } - -} - -// ***** BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin ***** -type bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin struct { - validation - obj *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - marshaller marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - unMarshaller unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin -} - -func NewBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin() BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - obj := bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: &otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) msg() *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - return obj.obj -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) setMsg(msg *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin struct { - obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin -} - -type marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin interface { - // ToProto marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin to protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - ToProto() (*otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) - // ToPbText marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin struct { - obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin -} - -type unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin interface { - // FromProto unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin from protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - FromProto(msg *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) (BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) - // FromPbText unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Marshal() marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Unmarshal() unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) ToProto() (*otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) FromProto(msg *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) (BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *marshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Clone() (BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin() - 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 -} - -// BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03 . -type BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin interface { - Validation - // msg marshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin to protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // setMsg unmarshals BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin from protobuf object *otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // provides marshal interface - Marshal() marshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // validate validates BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Global2ByteAs returns uint32, set in BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin. - Global2ByteAs() uint32 - // SetGlobal2ByteAs assigns uint32 provided by user to BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - SetGlobal2ByteAs(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // HasGlobal2ByteAs checks if Global2ByteAs has been set in BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - HasGlobal2ByteAs() bool - // Local4ByteAdmin returns uint32, set in BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin. - Local4ByteAdmin() uint32 - // SetLocal4ByteAdmin assigns uint32 provided by user to BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - SetLocal4ByteAdmin(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - // HasLocal4ByteAdmin checks if Local4ByteAdmin has been set in BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin - HasLocal4ByteAdmin() bool -} - -// The two octet IANA assigned AS value assigned to the Autonomous System. -// Global2ByteAs returns a uint32 -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Global2ByteAs() uint32 { - - return *obj.obj.Global_2ByteAs - -} - -// The two octet IANA assigned AS value assigned to the Autonomous System. -// Global2ByteAs returns a uint32 -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) HasGlobal2ByteAs() bool { - return obj.obj.Global_2ByteAs != nil -} - -// The two octet IANA assigned AS value assigned to the Autonomous System. -// SetGlobal2ByteAs sets the uint32 value in the BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin object -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) SetGlobal2ByteAs(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - - obj.obj.Global_2ByteAs = &value - return obj -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local4ByteAdmin returns a uint32 -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Local4ByteAdmin() uint32 { - - return *obj.obj.Local_4ByteAdmin - -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local4ByteAdmin returns a uint32 -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) HasLocal4ByteAdmin() bool { - return obj.obj.Local_4ByteAdmin != nil -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// SetLocal4ByteAdmin sets the uint32 value in the BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin object -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) SetLocal4ByteAdmin(value uint32) BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin { - - obj.obj.Local_4ByteAdmin = &value - return obj -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Global_2ByteAs != nil { - - if *obj.obj.Global_2ByteAs > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin.Global_2ByteAs <= 65535 but Got %d", *obj.obj.Global_2ByteAs)) - } - - } - -} - -func (obj *bgpExtendedCommunityTransitive2OctetAsTypeRouteOrigin) setDefault() { - if obj.obj.Global_2ByteAs == nil { - obj.SetGlobal2ByteAs(100) - } - if obj.obj.Local_4ByteAdmin == nil { - obj.SetLocal4ByteAdmin(1) - } - -} - -// ***** BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget ***** -type bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget struct { - validation - obj *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - marshaller marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - unMarshaller unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget -} - -func NewBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget() BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - obj := bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: &otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) msg() *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - return obj.obj -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) setMsg(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget struct { - obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget -} - -type marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget interface { - // ToProto marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - ToProto() (*otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) - // ToPbText marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget struct { - obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget -} - -type unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget interface { - // FromProto unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - FromProto(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) - // FromPbText unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Marshal() marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Unmarshal() unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) ToProto() (*otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) FromProto(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Clone() (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget() - 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 -} - -// BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. -type BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget interface { - Validation - // msg marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // setMsg unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // provides marshal interface - Marshal() marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // validate validates BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // GlobalIpv4Admin returns string, set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget. - GlobalIpv4Admin() string - // SetGlobalIpv4Admin assigns string provided by user to BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - SetGlobalIpv4Admin(value string) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // HasGlobalIpv4Admin checks if GlobalIpv4Admin has been set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - HasGlobalIpv4Admin() bool - // Local2ByteAdmin returns uint32, set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget. - Local2ByteAdmin() uint32 - // SetLocal2ByteAdmin assigns uint32 provided by user to BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget - HasLocal2ByteAdmin() bool -} - -// An IPv4 unicast address assigned by one of the Internet registries. -// GlobalIpv4Admin returns a string -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) GlobalIpv4Admin() string { - - return *obj.obj.GlobalIpv4Admin - -} - -// An IPv4 unicast address assigned by one of the Internet registries. -// GlobalIpv4Admin returns a string -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) HasGlobalIpv4Admin() bool { - return obj.obj.GlobalIpv4Admin != nil -} - -// An IPv4 unicast address assigned by one of the Internet registries. -// SetGlobalIpv4Admin sets the string value in the BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget object -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) SetGlobalIpv4Admin(value string) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - - obj.obj.GlobalIpv4Admin = &value - return obj -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Local2ByteAdmin() uint32 { - - return *obj.obj.Local_2ByteAdmin - -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) HasLocal2ByteAdmin() bool { - return obj.obj.Local_2ByteAdmin != nil -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// SetLocal2ByteAdmin sets the uint32 value in the BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget object -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { - - obj.obj.Local_2ByteAdmin = &value - return obj -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.GlobalIpv4Admin != nil { - - err := obj.validateIpv4(obj.GlobalIpv4Admin()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget.GlobalIpv4Admin")) - } - - } - - if obj.obj.Local_2ByteAdmin != nil { - - if *obj.obj.Local_2ByteAdmin > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) - } - - } - -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) setDefault() { - if obj.obj.GlobalIpv4Admin == nil { - obj.SetGlobalIpv4Admin("0.0.0.0") - } - if obj.obj.Local_2ByteAdmin == nil { - obj.SetLocal2ByteAdmin(1) - } - -} - -// ***** BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin ***** -type bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin struct { - validation - obj *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - marshaller marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - unMarshaller unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin -} - -func NewBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin() BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - obj := bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: &otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) msg() *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - return obj.obj -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) setMsg(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin struct { - obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin -} - -type marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin interface { - // ToProto marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - ToProto() (*otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) - // ToPbText marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin struct { - obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin -} - -type unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin interface { - // FromProto unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - FromProto(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) - // FromPbText unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Marshal() marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Unmarshal() unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) ToProto() (*otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) FromProto(msg *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *marshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Clone() (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin() - 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 -} - -// BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP It is sent with sub-type as 0x03. -type BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin interface { - Validation - // msg marshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // setMsg unmarshals BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from protobuf object *otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // provides marshal interface - Marshal() marshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // validate validates BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // GlobalIpv4Admin returns string, set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin. - GlobalIpv4Admin() string - // SetGlobalIpv4Admin assigns string provided by user to BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - SetGlobalIpv4Admin(value string) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // HasGlobalIpv4Admin checks if GlobalIpv4Admin has been set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - HasGlobalIpv4Admin() bool - // Local2ByteAdmin returns uint32, set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin. - Local2ByteAdmin() uint32 - // SetLocal2ByteAdmin assigns uint32 provided by user to BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin - HasLocal2ByteAdmin() bool -} - -// An IPv4 unicast address assigned by one of the Internet registries. -// GlobalIpv4Admin returns a string -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) GlobalIpv4Admin() string { - - return *obj.obj.GlobalIpv4Admin - -} - -// An IPv4 unicast address assigned by one of the Internet registries. -// GlobalIpv4Admin returns a string -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) HasGlobalIpv4Admin() bool { - return obj.obj.GlobalIpv4Admin != nil -} - -// An IPv4 unicast address assigned by one of the Internet registries. -// SetGlobalIpv4Admin sets the string value in the BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin object -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) SetGlobalIpv4Admin(value string) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - - obj.obj.GlobalIpv4Admin = &value - return obj -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Local2ByteAdmin() uint32 { - - return *obj.obj.Local_2ByteAdmin - -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) HasLocal2ByteAdmin() bool { - return obj.obj.Local_2ByteAdmin != nil -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// SetLocal2ByteAdmin sets the uint32 value in the BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin object -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { - - obj.obj.Local_2ByteAdmin = &value - return obj -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.GlobalIpv4Admin != nil { - - err := obj.validateIpv4(obj.GlobalIpv4Admin()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin.GlobalIpv4Admin")) - } - - } - - if obj.obj.Local_2ByteAdmin != nil { - - if *obj.obj.Local_2ByteAdmin > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) - } - - } - -} - -func (obj *bgpExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) setDefault() { - if obj.obj.GlobalIpv4Admin == nil { - obj.SetGlobalIpv4Admin("0.0.0.0") - } - if obj.obj.Local_2ByteAdmin == nil { - obj.SetLocal2ByteAdmin(1) - } - -} - -// ***** BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget ***** -type bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget struct { - validation - obj *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - marshaller marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - unMarshaller unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget -} - -func NewBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget() BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { - obj := bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: &otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) msg() *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { - return obj.obj -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) setMsg(msg *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget struct { - obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget -} - -type marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget interface { - // ToProto marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget to protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - ToProto() (*otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) - // ToPbText marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget struct { - obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget -} - -type unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget interface { - // FromProto unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget from protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - FromProto(msg *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) (BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) - // FromPbText unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) Marshal() marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) Unmarshal() unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) ToProto() (*otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) FromProto(msg *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) (BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) Clone() (BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget() - 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 -} - -// BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02 -type BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget interface { - Validation - // msg marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget to protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - // setMsg unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget from protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - // provides marshal interface - Marshal() marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - // validate validates BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Global4ByteAs returns uint32, set in BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget. - Global4ByteAs() uint32 - // SetGlobal4ByteAs assigns uint32 provided by user to BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - SetGlobal4ByteAs(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - // HasGlobal4ByteAs checks if Global4ByteAs has been set in BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - HasGlobal4ByteAs() bool - // Local2ByteAdmin returns uint32, set in BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget. - Local2ByteAdmin() uint32 - // SetLocal2ByteAdmin assigns uint32 provided by user to BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget - HasLocal2ByteAdmin() bool -} - -// The four octet IANA assigned AS value assigned to the Autonomous System. -// Global4ByteAs returns a uint32 -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) Global4ByteAs() uint32 { - - return *obj.obj.Global_4ByteAs - -} - -// The four octet IANA assigned AS value assigned to the Autonomous System. -// Global4ByteAs returns a uint32 -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) HasGlobal4ByteAs() bool { - return obj.obj.Global_4ByteAs != nil -} - -// The four octet IANA assigned AS value assigned to the Autonomous System. -// SetGlobal4ByteAs sets the uint32 value in the BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget object -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) SetGlobal4ByteAs(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { - - obj.obj.Global_4ByteAs = &value - return obj -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) Local2ByteAdmin() uint32 { - - return *obj.obj.Local_2ByteAdmin - -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) HasLocal2ByteAdmin() bool { - return obj.obj.Local_2ByteAdmin != nil -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// SetLocal2ByteAdmin sets the uint32 value in the BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget object -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget { - - obj.obj.Local_2ByteAdmin = &value - return obj -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Local_2ByteAdmin != nil { - - if *obj.obj.Local_2ByteAdmin > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpExtendedCommunityTransitive4OctetAsTypeRouteTarget.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) - } - - } - -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteTarget) setDefault() { - if obj.obj.Global_4ByteAs == nil { - obj.SetGlobal4ByteAs(100) - } - if obj.obj.Local_2ByteAdmin == nil { - obj.SetLocal2ByteAdmin(1) - } - -} - -// ***** BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin ***** -type bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin struct { - validation - obj *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - marshaller marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - unMarshaller unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin -} - -func NewBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin() BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - obj := bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: &otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) msg() *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - return obj.obj -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) setMsg(msg *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin struct { - obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin -} - -type marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin interface { - // ToProto marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin to protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - ToProto() (*otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) - // ToPbText marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin struct { - obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin -} - -type unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin interface { - // FromProto unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin from protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - FromProto(msg *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) (BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) - // FromPbText unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Marshal() marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Unmarshal() unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) ToProto() (*otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) FromProto(msg *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) (BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *marshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *unMarshalbgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Clone() (BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin() - 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 -} - -// BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03. -type BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin interface { - Validation - // msg marshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin to protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // setMsg unmarshals BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin from protobuf object *otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // provides marshal interface - Marshal() marshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // validate validates BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Global4ByteAs returns uint32, set in BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin. - Global4ByteAs() uint32 - // SetGlobal4ByteAs assigns uint32 provided by user to BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - SetGlobal4ByteAs(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // HasGlobal4ByteAs checks if Global4ByteAs has been set in BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - HasGlobal4ByteAs() bool - // Local2ByteAdmin returns uint32, set in BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin. - Local2ByteAdmin() uint32 - // SetLocal2ByteAdmin assigns uint32 provided by user to BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin - HasLocal2ByteAdmin() bool -} - -// The four octet IANA assigned AS value assigned to the Autonomous System. -// Global4ByteAs returns a uint32 -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Global4ByteAs() uint32 { - - return *obj.obj.Global_4ByteAs - -} - -// The four octet IANA assigned AS value assigned to the Autonomous System. -// Global4ByteAs returns a uint32 -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) HasGlobal4ByteAs() bool { - return obj.obj.Global_4ByteAs != nil -} - -// The four octet IANA assigned AS value assigned to the Autonomous System. -// SetGlobal4ByteAs sets the uint32 value in the BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin object -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) SetGlobal4ByteAs(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - - obj.obj.Global_4ByteAs = &value - return obj -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Local2ByteAdmin() uint32 { - - return *obj.obj.Local_2ByteAdmin - -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// Local2ByteAdmin returns a uint32 -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) HasLocal2ByteAdmin() bool { - return obj.obj.Local_2ByteAdmin != nil -} - -// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. -// SetLocal2ByteAdmin sets the uint32 value in the BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin object -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) SetLocal2ByteAdmin(value uint32) BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin { - - obj.obj.Local_2ByteAdmin = &value - return obj -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Local_2ByteAdmin != nil { - - if *obj.obj.Local_2ByteAdmin > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) - } - - } - -} - -func (obj *bgpExtendedCommunityTransitive4OctetAsTypeRouteOrigin) setDefault() { - if obj.obj.Global_4ByteAs == nil { - obj.SetGlobal4ByteAs(100) - } - if obj.obj.Local_2ByteAdmin == nil { - obj.SetLocal2ByteAdmin(1) - } - -} - -// ***** BgpExtendedCommunityTransitiveOpaqueTypeColor ***** -type bgpExtendedCommunityTransitiveOpaqueTypeColor struct { - validation - obj *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor - marshaller marshalBgpExtendedCommunityTransitiveOpaqueTypeColor - unMarshaller unMarshalBgpExtendedCommunityTransitiveOpaqueTypeColor -} - -func NewBgpExtendedCommunityTransitiveOpaqueTypeColor() BgpExtendedCommunityTransitiveOpaqueTypeColor { - obj := bgpExtendedCommunityTransitiveOpaqueTypeColor{obj: &otg.BgpExtendedCommunityTransitiveOpaqueTypeColor{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) msg() *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor { - return obj.obj -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) setMsg(msg *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor) BgpExtendedCommunityTransitiveOpaqueTypeColor { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityTransitiveOpaqueTypeColor struct { - obj *bgpExtendedCommunityTransitiveOpaqueTypeColor -} - -type marshalBgpExtendedCommunityTransitiveOpaqueTypeColor interface { - // ToProto marshals BgpExtendedCommunityTransitiveOpaqueTypeColor to protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor - ToProto() (*otg.BgpExtendedCommunityTransitiveOpaqueTypeColor, error) - // ToPbText marshals BgpExtendedCommunityTransitiveOpaqueTypeColor to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityTransitiveOpaqueTypeColor to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityTransitiveOpaqueTypeColor to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityTransitiveOpaqueTypeColor struct { - obj *bgpExtendedCommunityTransitiveOpaqueTypeColor -} - -type unMarshalBgpExtendedCommunityTransitiveOpaqueTypeColor interface { - // FromProto unmarshals BgpExtendedCommunityTransitiveOpaqueTypeColor from protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor - FromProto(msg *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor) (BgpExtendedCommunityTransitiveOpaqueTypeColor, error) - // FromPbText unmarshals BgpExtendedCommunityTransitiveOpaqueTypeColor from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityTransitiveOpaqueTypeColor from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityTransitiveOpaqueTypeColor from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) Marshal() marshalBgpExtendedCommunityTransitiveOpaqueTypeColor { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityTransitiveOpaqueTypeColor{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) Unmarshal() unMarshalBgpExtendedCommunityTransitiveOpaqueTypeColor { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveOpaqueTypeColor{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityTransitiveOpaqueTypeColor) ToProto() (*otg.BgpExtendedCommunityTransitiveOpaqueTypeColor, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeColor) FromProto(msg *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor) (BgpExtendedCommunityTransitiveOpaqueTypeColor, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityTransitiveOpaqueTypeColor) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeColor) 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 *marshalbgpExtendedCommunityTransitiveOpaqueTypeColor) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeColor) 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 *marshalbgpExtendedCommunityTransitiveOpaqueTypeColor) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeColor) 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 *bgpExtendedCommunityTransitiveOpaqueTypeColor) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) Clone() (BgpExtendedCommunityTransitiveOpaqueTypeColor, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityTransitiveOpaqueTypeColor() - 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 -} - -// BgpExtendedCommunityTransitiveOpaqueTypeColor is the Color Community contains locally administrator defined 'color' value which is used in conjunction with Encapsulation attribute to decide whether a data packet can be transmitted on a certain tunnel or not. It is defined in RFC9012 and sent with sub-type as 0x0b. -type BgpExtendedCommunityTransitiveOpaqueTypeColor interface { - Validation - // msg marshals BgpExtendedCommunityTransitiveOpaqueTypeColor to protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor - // setMsg unmarshals BgpExtendedCommunityTransitiveOpaqueTypeColor from protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeColor - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityTransitiveOpaqueTypeColor) BgpExtendedCommunityTransitiveOpaqueTypeColor - // provides marshal interface - Marshal() marshalBgpExtendedCommunityTransitiveOpaqueTypeColor - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityTransitiveOpaqueTypeColor - // validate validates BgpExtendedCommunityTransitiveOpaqueTypeColor - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityTransitiveOpaqueTypeColor, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns uint32, set in BgpExtendedCommunityTransitiveOpaqueTypeColor. - Flags() uint32 - // SetFlags assigns uint32 provided by user to BgpExtendedCommunityTransitiveOpaqueTypeColor - SetFlags(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeColor - // HasFlags checks if Flags has been set in BgpExtendedCommunityTransitiveOpaqueTypeColor - HasFlags() bool - // Color returns uint32, set in BgpExtendedCommunityTransitiveOpaqueTypeColor. - Color() uint32 - // SetColor assigns uint32 provided by user to BgpExtendedCommunityTransitiveOpaqueTypeColor - SetColor(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeColor - // HasColor checks if Color has been set in BgpExtendedCommunityTransitiveOpaqueTypeColor - HasColor() bool -} - -// Two octet flag values. -// Flags returns a uint32 -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) Flags() uint32 { - - return *obj.obj.Flags - -} - -// Two octet flag values. -// Flags returns a uint32 -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) HasFlags() bool { - return obj.obj.Flags != nil -} - -// Two octet flag values. -// SetFlags sets the uint32 value in the BgpExtendedCommunityTransitiveOpaqueTypeColor object -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) SetFlags(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeColor { - - obj.obj.Flags = &value - return obj -} - -// The color value is user defined and configured locally and used to determine whether a data packet can be transmitted on a certain tunnel or not in conjunction with the Encapsulation attribute. It is defined in RFC9012. -// Color returns a uint32 -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) Color() uint32 { - - return *obj.obj.Color - -} - -// The color value is user defined and configured locally and used to determine whether a data packet can be transmitted on a certain tunnel or not in conjunction with the Encapsulation attribute. It is defined in RFC9012. -// Color returns a uint32 -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) HasColor() bool { - return obj.obj.Color != nil -} - -// The color value is user defined and configured locally and used to determine whether a data packet can be transmitted on a certain tunnel or not in conjunction with the Encapsulation attribute. It is defined in RFC9012. -// SetColor sets the uint32 value in the BgpExtendedCommunityTransitiveOpaqueTypeColor object -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) SetColor(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeColor { - - obj.obj.Color = &value - return obj -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - if *obj.obj.Flags > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpExtendedCommunityTransitiveOpaqueTypeColor.Flags <= 65535 but Got %d", *obj.obj.Flags)) - } - - } - -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeColor) setDefault() { - if obj.obj.Flags == nil { - obj.SetFlags(0) - } - if obj.obj.Color == nil { - obj.SetColor(0) - } - -} - -// ***** BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation ***** -type bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation struct { - validation - obj *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - marshaller marshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - unMarshaller unMarshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation -} - -func NewBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation() BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { - obj := bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: &otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) msg() *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { - return obj.obj -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) setMsg(msg *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation struct { - obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation -} - -type marshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation interface { - // ToProto marshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation to protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - ToProto() (*otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) - // ToPbText marshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation struct { - obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation -} - -type unMarshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation interface { - // FromProto unmarshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation from protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - FromProto(msg *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) (BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) - // FromPbText unmarshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) Marshal() marshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) Unmarshal() unMarshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) ToProto() (*otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) FromProto(msg *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) (BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *marshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *marshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *unMarshalbgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) Clone() (BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation() - 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 -} - -// BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation is this identifies the type of tunneling technology being signalled. It is defined in RFC9012 and sent with sub-type as 0x0c. -type BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation interface { - Validation - // msg marshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation to protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - // setMsg unmarshals BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation from protobuf object *otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - // provides marshal interface - Marshal() marshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - // validate validates BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Reserved returns uint32, set in BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation. - Reserved() uint32 - // SetReserved assigns uint32 provided by user to BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - SetReserved(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - // HasReserved checks if Reserved has been set in BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - HasReserved() bool - // TunnelType returns uint32, set in BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation. - TunnelType() uint32 - // SetTunnelType assigns uint32 provided by user to BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - SetTunnelType(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - // HasTunnelType checks if TunnelType has been set in BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation - HasTunnelType() bool -} - -// Four bytes of reserved values. Normally set to 0 on transmit and ignored on receive. -// Reserved returns a uint32 -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) Reserved() uint32 { - - return *obj.obj.Reserved - -} - -// Four bytes of reserved values. Normally set to 0 on transmit and ignored on receive. -// Reserved returns a uint32 -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) HasReserved() bool { - return obj.obj.Reserved != nil -} - -// Four bytes of reserved values. Normally set to 0 on transmit and ignored on receive. -// SetReserved sets the uint32 value in the BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation object -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) SetReserved(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { - - obj.obj.Reserved = &value - return obj -} - -// Identifies the type of tunneling technology being signalled. Initially defined in RFC5512 and extended in RFC9012. Some of the important tunnel types include 1 L2TPv3 over IP [RFC9012], -// 2 GRE [RFC9012] -// 7 IP in IP [RFC9012] -// 8 VXLAN Encapsulation [RFC8365] -// 9 NVGRE Encapsulation [RFC8365] -// 10 MPLS Encapsulation [RFC8365] -// 15 SR TE Policy Type [draft-ietf-idr-segment-routing-te-policy] -// 19 Geneve Encapsulation [RFC8926] -// TunnelType returns a uint32 -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) TunnelType() uint32 { - - return *obj.obj.TunnelType - -} - -// Identifies the type of tunneling technology being signalled. Initially defined in RFC5512 and extended in RFC9012. Some of the important tunnel types include 1 L2TPv3 over IP [RFC9012], -// 2 GRE [RFC9012] -// 7 IP in IP [RFC9012] -// 8 VXLAN Encapsulation [RFC8365] -// 9 NVGRE Encapsulation [RFC8365] -// 10 MPLS Encapsulation [RFC8365] -// 15 SR TE Policy Type [draft-ietf-idr-segment-routing-te-policy] -// 19 Geneve Encapsulation [RFC8926] -// TunnelType returns a uint32 -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) HasTunnelType() bool { - return obj.obj.TunnelType != nil -} - -// Identifies the type of tunneling technology being signalled. Initially defined in RFC5512 and extended in RFC9012. Some of the important tunnel types include 1 L2TPv3 over IP [RFC9012], -// 2 GRE [RFC9012] -// 7 IP in IP [RFC9012] -// 8 VXLAN Encapsulation [RFC8365] -// 9 NVGRE Encapsulation [RFC8365] -// 10 MPLS Encapsulation [RFC8365] -// 15 SR TE Policy Type [draft-ietf-idr-segment-routing-te-policy] -// 19 Geneve Encapsulation [RFC8926] -// SetTunnelType sets the uint32 value in the BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation object -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) SetTunnelType(value uint32) BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation { - - obj.obj.TunnelType = &value - return obj -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.TunnelType != nil { - - if *obj.obj.TunnelType > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpExtendedCommunityTransitiveOpaqueTypeEncapsulation.TunnelType <= 65535 but Got %d", *obj.obj.TunnelType)) - } - - } - -} - -func (obj *bgpExtendedCommunityTransitiveOpaqueTypeEncapsulation) setDefault() { - if obj.obj.Reserved == nil { - obj.SetReserved(0) - } - if obj.obj.TunnelType == nil { - obj.SetTunnelType(1) - } - -} - -// ***** BgpExtendedCommunityTransitiveEvpnTypeRouterMac ***** -type bgpExtendedCommunityTransitiveEvpnTypeRouterMac struct { - validation - obj *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac - marshaller marshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac - unMarshaller unMarshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac -} - -func NewBgpExtendedCommunityTransitiveEvpnTypeRouterMac() BgpExtendedCommunityTransitiveEvpnTypeRouterMac { - obj := bgpExtendedCommunityTransitiveEvpnTypeRouterMac{obj: &otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) msg() *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac { - return obj.obj -} - -func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) setMsg(msg *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac) BgpExtendedCommunityTransitiveEvpnTypeRouterMac { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac struct { - obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac -} - -type marshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac interface { - // ToProto marshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac to protobuf object *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac - ToProto() (*otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac, error) - // ToPbText marshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac struct { - obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac -} - -type unMarshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac interface { - // FromProto unmarshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac from protobuf object *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac - FromProto(msg *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac) (BgpExtendedCommunityTransitiveEvpnTypeRouterMac, error) - // FromPbText unmarshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) Marshal() marshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) Unmarshal() unMarshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) ToProto() (*otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) FromProto(msg *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac) (BgpExtendedCommunityTransitiveEvpnTypeRouterMac, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) 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 *unMarshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) 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 *marshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) 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 *unMarshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) 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 *marshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) 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 *unMarshalbgpExtendedCommunityTransitiveEvpnTypeRouterMac) 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 *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) Clone() (BgpExtendedCommunityTransitiveEvpnTypeRouterMac, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityTransitiveEvpnTypeRouterMac() - 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 -} - -// BgpExtendedCommunityTransitiveEvpnTypeRouterMac is the Router MAC EVPN Community is defined in RFC9135 and normally sent only for EVPN Type-2 Routes . It is sent with sub-type 0x03. -type BgpExtendedCommunityTransitiveEvpnTypeRouterMac interface { - Validation - // msg marshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac to protobuf object *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac - // setMsg unmarshals BgpExtendedCommunityTransitiveEvpnTypeRouterMac from protobuf object *otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityTransitiveEvpnTypeRouterMac) BgpExtendedCommunityTransitiveEvpnTypeRouterMac - // provides marshal interface - Marshal() marshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityTransitiveEvpnTypeRouterMac - // validate validates BgpExtendedCommunityTransitiveEvpnTypeRouterMac - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityTransitiveEvpnTypeRouterMac, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RouterMac returns string, set in BgpExtendedCommunityTransitiveEvpnTypeRouterMac. - RouterMac() string - // SetRouterMac assigns string provided by user to BgpExtendedCommunityTransitiveEvpnTypeRouterMac - SetRouterMac(value string) BgpExtendedCommunityTransitiveEvpnTypeRouterMac - // HasRouterMac checks if RouterMac has been set in BgpExtendedCommunityTransitiveEvpnTypeRouterMac - HasRouterMac() bool -} - -// MAC Address of the PE Router. -// RouterMac returns a string -func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) RouterMac() string { - - return *obj.obj.RouterMac - -} - -// MAC Address of the PE Router. -// RouterMac returns a string -func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) HasRouterMac() bool { - return obj.obj.RouterMac != nil -} - -// MAC Address of the PE Router. -// SetRouterMac sets the string value in the BgpExtendedCommunityTransitiveEvpnTypeRouterMac object -func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) SetRouterMac(value string) BgpExtendedCommunityTransitiveEvpnTypeRouterMac { - - obj.obj.RouterMac = &value - return obj -} - -func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RouterMac != nil { - - err := obj.validateMac(obj.RouterMac()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpExtendedCommunityTransitiveEvpnTypeRouterMac.RouterMac")) - } - - } - -} - -func (obj *bgpExtendedCommunityTransitiveEvpnTypeRouterMac) setDefault() { - if obj.obj.RouterMac == nil { - obj.SetRouterMac("0:0:0:0:0:0") - } - -} - -// ***** BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth ***** -type bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth struct { - validation - obj *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - marshaller marshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - unMarshaller unMarshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth -} - -func NewBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth() BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - obj := bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: &otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{}} - obj.setDefault() - return &obj -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) msg() *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - return obj.obj -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) setMsg(msg *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth struct { - obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth -} - -type marshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth interface { - // ToProto marshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - ToProto() (*otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) - // ToPbText marshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to YAML text - ToYaml() (string, error) - // ToJson marshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to JSON text - ToJson() (string, error) -} - -type unMarshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth struct { - obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth -} - -type unMarshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth interface { - // FromProto unmarshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - FromProto(msg *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) (BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) - // FromPbText unmarshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from JSON text - FromJson(value string) error -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Marshal() marshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Unmarshal() unMarshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) ToProto() (*otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) FromProto(msg *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) (BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *unMarshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *marshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *unMarshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *marshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *unMarshalbgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Clone() (BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth() - 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 -} - -// BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth is the Link Bandwidth Extended Community attribute is defined in draft-ietf-idr-link-bandwidth. It is sent with sub-type as 0x04. -type BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth interface { - Validation - // msg marshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // and doesn't set defaults - msg() *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // setMsg unmarshals BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from protobuf object *otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // and doesn't set defaults - setMsg(*otg.BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // provides marshal interface - Marshal() marshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // provides unmarshal interface - Unmarshal() unMarshalBgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // validate validates BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Global2ByteAs returns uint32, set in BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth. - Global2ByteAs() uint32 - // SetGlobal2ByteAs assigns uint32 provided by user to BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - SetGlobal2ByteAs(value uint32) BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // HasGlobal2ByteAs checks if Global2ByteAs has been set in BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - HasGlobal2ByteAs() bool - // Bandwidth returns float32, set in BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth. - Bandwidth() float32 - // SetBandwidth assigns float32 provided by user to BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - SetBandwidth(value float32) BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - // HasBandwidth checks if Bandwidth has been set in BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth - HasBandwidth() bool -} - -// The value of the Global Administrator subfield should represent the Autonomous System of the router that attaches the Link Bandwidth Community. If four octet AS numbering scheme is used, AS_TRANS (23456) should be used. -// Global2ByteAs returns a uint32 -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Global2ByteAs() uint32 { - - return *obj.obj.Global_2ByteAs - -} - -// The value of the Global Administrator subfield should represent the Autonomous System of the router that attaches the Link Bandwidth Community. If four octet AS numbering scheme is used, AS_TRANS (23456) should be used. -// Global2ByteAs returns a uint32 -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) HasGlobal2ByteAs() bool { - return obj.obj.Global_2ByteAs != nil -} - -// The value of the Global Administrator subfield should represent the Autonomous System of the router that attaches the Link Bandwidth Community. If four octet AS numbering scheme is used, AS_TRANS (23456) should be used. -// SetGlobal2ByteAs sets the uint32 value in the BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth object -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) SetGlobal2ByteAs(value uint32) BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - - obj.obj.Global_2ByteAs = &value - return obj -} - -// Bandwidth of the link in bytes per second. ( 1 Kbps is 1000 bytes per second and 1 Mbps is 1000 Kbps per second ) -// Bandwidth returns a float32 -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Bandwidth() float32 { - - return *obj.obj.Bandwidth - -} - -// Bandwidth of the link in bytes per second. ( 1 Kbps is 1000 bytes per second and 1 Mbps is 1000 Kbps per second ) -// Bandwidth returns a float32 -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) HasBandwidth() bool { - return obj.obj.Bandwidth != nil -} - -// Bandwidth of the link in bytes per second. ( 1 Kbps is 1000 bytes per second and 1 Mbps is 1000 Kbps per second ) -// SetBandwidth sets the float32 value in the BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth object -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) SetBandwidth(value float32) BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { - - obj.obj.Bandwidth = &value - return obj -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Global_2ByteAs != nil { - - if *obj.obj.Global_2ByteAs > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth.Global_2ByteAs <= 65535 but Got %d", *obj.obj.Global_2ByteAs)) - } - - } - -} - -func (obj *bgpExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) setDefault() { - if obj.obj.Global_2ByteAs == nil { - obj.SetGlobal2ByteAs(100) - } - if obj.obj.Bandwidth == nil { - obj.SetBandwidth(0) - } - -} - -// ***** BgpSrteSegment ***** -type bgpSrteSegment struct { - validation - obj *otg.BgpSrteSegment - marshaller marshalBgpSrteSegment - unMarshaller unMarshalBgpSrteSegment - typeAHolder BgpSrteSegmentATypeSubTlv - typeBHolder BgpSrteSegmentBTypeSubTlv - typeCHolder BgpSrteSegmentCTypeSubTlv - typeDHolder BgpSrteSegmentDTypeSubTlv - typeEHolder BgpSrteSegmentETypeSubTlv - typeFHolder BgpSrteSegmentFTypeSubTlv - typeGHolder BgpSrteSegmentGTypeSubTlv - typeHHolder BgpSrteSegmentHTypeSubTlv - typeIHolder BgpSrteSegmentITypeSubTlv - typeJHolder BgpSrteSegmentJTypeSubTlv - typeKHolder BgpSrteSegmentKTypeSubTlv -} - -func NewBgpSrteSegment() BgpSrteSegment { - obj := bgpSrteSegment{obj: &otg.BgpSrteSegment{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSegment) msg() *otg.BgpSrteSegment { - return obj.obj -} - -func (obj *bgpSrteSegment) setMsg(msg *otg.BgpSrteSegment) BgpSrteSegment { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSegment struct { - obj *bgpSrteSegment -} - -type marshalBgpSrteSegment interface { - // ToProto marshals BgpSrteSegment to protobuf object *otg.BgpSrteSegment - ToProto() (*otg.BgpSrteSegment, error) - // ToPbText marshals BgpSrteSegment to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSegment to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSegment to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSegment struct { - obj *bgpSrteSegment -} - -type unMarshalBgpSrteSegment interface { - // FromProto unmarshals BgpSrteSegment from protobuf object *otg.BgpSrteSegment - FromProto(msg *otg.BgpSrteSegment) (BgpSrteSegment, error) - // FromPbText unmarshals BgpSrteSegment from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSegment from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSegment from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSegment) Marshal() marshalBgpSrteSegment { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSegment{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSegment) Unmarshal() unMarshalBgpSrteSegment { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSegment{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSegment) ToProto() (*otg.BgpSrteSegment, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSegment) FromProto(msg *otg.BgpSrteSegment) (BgpSrteSegment, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSegment) 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 *unMarshalbgpSrteSegment) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteSegment) 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 *unMarshalbgpSrteSegment) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteSegment) 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 *unMarshalbgpSrteSegment) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteSegment) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSegment) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSegment) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSegment) Clone() (BgpSrteSegment, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSegment() - 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 -} - -func (obj *bgpSrteSegment) setNil() { - obj.typeAHolder = nil - obj.typeBHolder = nil - obj.typeCHolder = nil - obj.typeDHolder = nil - obj.typeEHolder = nil - obj.typeFHolder = nil - obj.typeGHolder = nil - obj.typeHHolder = nil - obj.typeIHolder = nil - obj.typeJHolder = nil - obj.typeKHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteSegment is a Segment sub-TLV describes a single segment in a segment list i.e., a single element of the explicit path. The Segment sub-TLVs are optional. -type BgpSrteSegment interface { - Validation - // msg marshals BgpSrteSegment to protobuf object *otg.BgpSrteSegment - // and doesn't set defaults - msg() *otg.BgpSrteSegment - // setMsg unmarshals BgpSrteSegment from protobuf object *otg.BgpSrteSegment - // and doesn't set defaults - setMsg(*otg.BgpSrteSegment) BgpSrteSegment - // provides marshal interface - Marshal() marshalBgpSrteSegment - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSegment - // validate validates BgpSrteSegment - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSegment, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // SegmentType returns BgpSrteSegmentSegmentTypeEnum, set in BgpSrteSegment - SegmentType() BgpSrteSegmentSegmentTypeEnum - // SetSegmentType assigns BgpSrteSegmentSegmentTypeEnum provided by user to BgpSrteSegment - SetSegmentType(value BgpSrteSegmentSegmentTypeEnum) BgpSrteSegment - // TypeA returns BgpSrteSegmentATypeSubTlv, set in BgpSrteSegment. - // BgpSrteSegmentATypeSubTlv is type A: SID only, in the form of MPLS Label. - TypeA() BgpSrteSegmentATypeSubTlv - // SetTypeA assigns BgpSrteSegmentATypeSubTlv provided by user to BgpSrteSegment. - // BgpSrteSegmentATypeSubTlv is type A: SID only, in the form of MPLS Label. - SetTypeA(value BgpSrteSegmentATypeSubTlv) BgpSrteSegment - // HasTypeA checks if TypeA has been set in BgpSrteSegment - HasTypeA() bool - // TypeB returns BgpSrteSegmentBTypeSubTlv, set in BgpSrteSegment. - // BgpSrteSegmentBTypeSubTlv is type B: SID only, in the form of IPv6 address. - TypeB() BgpSrteSegmentBTypeSubTlv - // SetTypeB assigns BgpSrteSegmentBTypeSubTlv provided by user to BgpSrteSegment. - // BgpSrteSegmentBTypeSubTlv is type B: SID only, in the form of IPv6 address. - SetTypeB(value BgpSrteSegmentBTypeSubTlv) BgpSrteSegment - // HasTypeB checks if TypeB has been set in BgpSrteSegment - HasTypeB() bool - // TypeC returns BgpSrteSegmentCTypeSubTlv, set in BgpSrteSegment. - // BgpSrteSegmentCTypeSubTlv is type C: IPv4 Node Address with optional SID. - TypeC() BgpSrteSegmentCTypeSubTlv - // SetTypeC assigns BgpSrteSegmentCTypeSubTlv provided by user to BgpSrteSegment. - // BgpSrteSegmentCTypeSubTlv is type C: IPv4 Node Address with optional SID. - SetTypeC(value BgpSrteSegmentCTypeSubTlv) BgpSrteSegment - // HasTypeC checks if TypeC has been set in BgpSrteSegment - HasTypeC() bool - // TypeD returns BgpSrteSegmentDTypeSubTlv, set in BgpSrteSegment. - // BgpSrteSegmentDTypeSubTlv is type D: IPv6 Node Address with optional SID for SR MPLS. - TypeD() BgpSrteSegmentDTypeSubTlv - // SetTypeD assigns BgpSrteSegmentDTypeSubTlv provided by user to BgpSrteSegment. - // BgpSrteSegmentDTypeSubTlv is type D: IPv6 Node Address with optional SID for SR MPLS. - SetTypeD(value BgpSrteSegmentDTypeSubTlv) BgpSrteSegment - // HasTypeD checks if TypeD has been set in BgpSrteSegment - HasTypeD() bool - // TypeE returns BgpSrteSegmentETypeSubTlv, set in BgpSrteSegment. - // BgpSrteSegmentETypeSubTlv is type E: IPv4 Address and Local Interface ID with optional SID - TypeE() BgpSrteSegmentETypeSubTlv - // SetTypeE assigns BgpSrteSegmentETypeSubTlv provided by user to BgpSrteSegment. - // BgpSrteSegmentETypeSubTlv is type E: IPv4 Address and Local Interface ID with optional SID - SetTypeE(value BgpSrteSegmentETypeSubTlv) BgpSrteSegment - // HasTypeE checks if TypeE has been set in BgpSrteSegment - HasTypeE() bool - // TypeF returns BgpSrteSegmentFTypeSubTlv, set in BgpSrteSegment. - // BgpSrteSegmentFTypeSubTlv is type F: IPv4 Local and Remote addresses with optional SID. - TypeF() BgpSrteSegmentFTypeSubTlv - // SetTypeF assigns BgpSrteSegmentFTypeSubTlv provided by user to BgpSrteSegment. - // BgpSrteSegmentFTypeSubTlv is type F: IPv4 Local and Remote addresses with optional SID. - SetTypeF(value BgpSrteSegmentFTypeSubTlv) BgpSrteSegment - // HasTypeF checks if TypeF has been set in BgpSrteSegment - HasTypeF() bool - // TypeG returns BgpSrteSegmentGTypeSubTlv, set in BgpSrteSegment. - // BgpSrteSegmentGTypeSubTlv is type G: IPv6 Address, Interface ID for local and remote pair with optional SID for SR MPLS. - TypeG() BgpSrteSegmentGTypeSubTlv - // SetTypeG assigns BgpSrteSegmentGTypeSubTlv provided by user to BgpSrteSegment. - // BgpSrteSegmentGTypeSubTlv is type G: IPv6 Address, Interface ID for local and remote pair with optional SID for SR MPLS. - SetTypeG(value BgpSrteSegmentGTypeSubTlv) BgpSrteSegment - // HasTypeG checks if TypeG has been set in BgpSrteSegment - HasTypeG() bool - // TypeH returns BgpSrteSegmentHTypeSubTlv, set in BgpSrteSegment. - // BgpSrteSegmentHTypeSubTlv is type H: IPv6 Local and Remote addresses with optional SID for SR MPLS. - TypeH() BgpSrteSegmentHTypeSubTlv - // SetTypeH assigns BgpSrteSegmentHTypeSubTlv provided by user to BgpSrteSegment. - // BgpSrteSegmentHTypeSubTlv is type H: IPv6 Local and Remote addresses with optional SID for SR MPLS. - SetTypeH(value BgpSrteSegmentHTypeSubTlv) BgpSrteSegment - // HasTypeH checks if TypeH has been set in BgpSrteSegment - HasTypeH() bool - // TypeI returns BgpSrteSegmentITypeSubTlv, set in BgpSrteSegment. - // BgpSrteSegmentITypeSubTlv is type I: IPv6 Node Address with optional SRv6 SID. - TypeI() BgpSrteSegmentITypeSubTlv - // SetTypeI assigns BgpSrteSegmentITypeSubTlv provided by user to BgpSrteSegment. - // BgpSrteSegmentITypeSubTlv is type I: IPv6 Node Address with optional SRv6 SID. - SetTypeI(value BgpSrteSegmentITypeSubTlv) BgpSrteSegment - // HasTypeI checks if TypeI has been set in BgpSrteSegment - HasTypeI() bool - // TypeJ returns BgpSrteSegmentJTypeSubTlv, set in BgpSrteSegment. - // BgpSrteSegmentJTypeSubTlv is type J: IPv6 Address, Interface ID for local and remote pair for SRv6 with optional SID. - TypeJ() BgpSrteSegmentJTypeSubTlv - // SetTypeJ assigns BgpSrteSegmentJTypeSubTlv provided by user to BgpSrteSegment. - // BgpSrteSegmentJTypeSubTlv is type J: IPv6 Address, Interface ID for local and remote pair for SRv6 with optional SID. - SetTypeJ(value BgpSrteSegmentJTypeSubTlv) BgpSrteSegment - // HasTypeJ checks if TypeJ has been set in BgpSrteSegment - HasTypeJ() bool - // TypeK returns BgpSrteSegmentKTypeSubTlv, set in BgpSrteSegment. - // BgpSrteSegmentKTypeSubTlv is type K: IPv6 Local and Remote addresses for SRv6 with optional SID. - TypeK() BgpSrteSegmentKTypeSubTlv - // SetTypeK assigns BgpSrteSegmentKTypeSubTlv provided by user to BgpSrteSegment. - // BgpSrteSegmentKTypeSubTlv is type K: IPv6 Local and Remote addresses for SRv6 with optional SID. - SetTypeK(value BgpSrteSegmentKTypeSubTlv) BgpSrteSegment - // HasTypeK checks if TypeK has been set in BgpSrteSegment - HasTypeK() bool - // Name returns string, set in BgpSrteSegment. - Name() string - // SetName assigns string provided by user to BgpSrteSegment - SetName(value string) BgpSrteSegment - // Active returns bool, set in BgpSrteSegment. - Active() bool - // SetActive assigns bool provided by user to BgpSrteSegment - SetActive(value bool) BgpSrteSegment - // HasActive checks if Active has been set in BgpSrteSegment - HasActive() bool - setNil() -} - -type BgpSrteSegmentSegmentTypeEnum string - -// Enum of SegmentType on BgpSrteSegment -var BgpSrteSegmentSegmentType = struct { - TYPE_A BgpSrteSegmentSegmentTypeEnum - TYPE_B BgpSrteSegmentSegmentTypeEnum - TYPE_C BgpSrteSegmentSegmentTypeEnum - TYPE_D BgpSrteSegmentSegmentTypeEnum - TYPE_E BgpSrteSegmentSegmentTypeEnum - TYPE_F BgpSrteSegmentSegmentTypeEnum - TYPE_G BgpSrteSegmentSegmentTypeEnum - TYPE_H BgpSrteSegmentSegmentTypeEnum - TYPE_I BgpSrteSegmentSegmentTypeEnum - TYPE_J BgpSrteSegmentSegmentTypeEnum - TYPE_K BgpSrteSegmentSegmentTypeEnum -}{ - TYPE_A: BgpSrteSegmentSegmentTypeEnum("type_a"), - TYPE_B: BgpSrteSegmentSegmentTypeEnum("type_b"), - TYPE_C: BgpSrteSegmentSegmentTypeEnum("type_c"), - TYPE_D: BgpSrteSegmentSegmentTypeEnum("type_d"), - TYPE_E: BgpSrteSegmentSegmentTypeEnum("type_e"), - TYPE_F: BgpSrteSegmentSegmentTypeEnum("type_f"), - TYPE_G: BgpSrteSegmentSegmentTypeEnum("type_g"), - TYPE_H: BgpSrteSegmentSegmentTypeEnum("type_h"), - TYPE_I: BgpSrteSegmentSegmentTypeEnum("type_i"), - TYPE_J: BgpSrteSegmentSegmentTypeEnum("type_j"), - TYPE_K: BgpSrteSegmentSegmentTypeEnum("type_k"), -} - -func (obj *bgpSrteSegment) SegmentType() BgpSrteSegmentSegmentTypeEnum { - return BgpSrteSegmentSegmentTypeEnum(obj.obj.SegmentType.Enum().String()) -} - -func (obj *bgpSrteSegment) SetSegmentType(value BgpSrteSegmentSegmentTypeEnum) BgpSrteSegment { - intValue, ok := otg.BgpSrteSegment_SegmentType_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpSrteSegmentSegmentTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpSrteSegment_SegmentType_Enum(intValue) - obj.obj.SegmentType = &enumValue - - return obj -} - -// description is TBD -// TypeA returns a BgpSrteSegmentATypeSubTlv -func (obj *bgpSrteSegment) TypeA() BgpSrteSegmentATypeSubTlv { - if obj.obj.TypeA == nil { - obj.obj.TypeA = NewBgpSrteSegmentATypeSubTlv().msg() - } - if obj.typeAHolder == nil { - obj.typeAHolder = &bgpSrteSegmentATypeSubTlv{obj: obj.obj.TypeA} - } - return obj.typeAHolder -} - -// description is TBD -// TypeA returns a BgpSrteSegmentATypeSubTlv -func (obj *bgpSrteSegment) HasTypeA() bool { - return obj.obj.TypeA != nil -} - -// description is TBD -// SetTypeA sets the BgpSrteSegmentATypeSubTlv value in the BgpSrteSegment object -func (obj *bgpSrteSegment) SetTypeA(value BgpSrteSegmentATypeSubTlv) BgpSrteSegment { - - obj.typeAHolder = nil - obj.obj.TypeA = value.msg() - - return obj -} - -// description is TBD -// TypeB returns a BgpSrteSegmentBTypeSubTlv -func (obj *bgpSrteSegment) TypeB() BgpSrteSegmentBTypeSubTlv { - if obj.obj.TypeB == nil { - obj.obj.TypeB = NewBgpSrteSegmentBTypeSubTlv().msg() - } - if obj.typeBHolder == nil { - obj.typeBHolder = &bgpSrteSegmentBTypeSubTlv{obj: obj.obj.TypeB} - } - return obj.typeBHolder -} - -// description is TBD -// TypeB returns a BgpSrteSegmentBTypeSubTlv -func (obj *bgpSrteSegment) HasTypeB() bool { - return obj.obj.TypeB != nil -} - -// description is TBD -// SetTypeB sets the BgpSrteSegmentBTypeSubTlv value in the BgpSrteSegment object -func (obj *bgpSrteSegment) SetTypeB(value BgpSrteSegmentBTypeSubTlv) BgpSrteSegment { - - obj.typeBHolder = nil - obj.obj.TypeB = value.msg() - - return obj -} - -// description is TBD -// TypeC returns a BgpSrteSegmentCTypeSubTlv -func (obj *bgpSrteSegment) TypeC() BgpSrteSegmentCTypeSubTlv { - if obj.obj.TypeC == nil { - obj.obj.TypeC = NewBgpSrteSegmentCTypeSubTlv().msg() - } - if obj.typeCHolder == nil { - obj.typeCHolder = &bgpSrteSegmentCTypeSubTlv{obj: obj.obj.TypeC} - } - return obj.typeCHolder -} - -// description is TBD -// TypeC returns a BgpSrteSegmentCTypeSubTlv -func (obj *bgpSrteSegment) HasTypeC() bool { - return obj.obj.TypeC != nil -} - -// description is TBD -// SetTypeC sets the BgpSrteSegmentCTypeSubTlv value in the BgpSrteSegment object -func (obj *bgpSrteSegment) SetTypeC(value BgpSrteSegmentCTypeSubTlv) BgpSrteSegment { - - obj.typeCHolder = nil - obj.obj.TypeC = value.msg() - - return obj -} - -// description is TBD -// TypeD returns a BgpSrteSegmentDTypeSubTlv -func (obj *bgpSrteSegment) TypeD() BgpSrteSegmentDTypeSubTlv { - if obj.obj.TypeD == nil { - obj.obj.TypeD = NewBgpSrteSegmentDTypeSubTlv().msg() - } - if obj.typeDHolder == nil { - obj.typeDHolder = &bgpSrteSegmentDTypeSubTlv{obj: obj.obj.TypeD} - } - return obj.typeDHolder -} - -// description is TBD -// TypeD returns a BgpSrteSegmentDTypeSubTlv -func (obj *bgpSrteSegment) HasTypeD() bool { - return obj.obj.TypeD != nil -} - -// description is TBD -// SetTypeD sets the BgpSrteSegmentDTypeSubTlv value in the BgpSrteSegment object -func (obj *bgpSrteSegment) SetTypeD(value BgpSrteSegmentDTypeSubTlv) BgpSrteSegment { - - obj.typeDHolder = nil - obj.obj.TypeD = value.msg() - - return obj -} - -// description is TBD -// TypeE returns a BgpSrteSegmentETypeSubTlv -func (obj *bgpSrteSegment) TypeE() BgpSrteSegmentETypeSubTlv { - if obj.obj.TypeE == nil { - obj.obj.TypeE = NewBgpSrteSegmentETypeSubTlv().msg() - } - if obj.typeEHolder == nil { - obj.typeEHolder = &bgpSrteSegmentETypeSubTlv{obj: obj.obj.TypeE} - } - return obj.typeEHolder -} - -// description is TBD -// TypeE returns a BgpSrteSegmentETypeSubTlv -func (obj *bgpSrteSegment) HasTypeE() bool { - return obj.obj.TypeE != nil -} - -// description is TBD -// SetTypeE sets the BgpSrteSegmentETypeSubTlv value in the BgpSrteSegment object -func (obj *bgpSrteSegment) SetTypeE(value BgpSrteSegmentETypeSubTlv) BgpSrteSegment { - - obj.typeEHolder = nil - obj.obj.TypeE = value.msg() - - return obj -} - -// description is TBD -// TypeF returns a BgpSrteSegmentFTypeSubTlv -func (obj *bgpSrteSegment) TypeF() BgpSrteSegmentFTypeSubTlv { - if obj.obj.TypeF == nil { - obj.obj.TypeF = NewBgpSrteSegmentFTypeSubTlv().msg() - } - if obj.typeFHolder == nil { - obj.typeFHolder = &bgpSrteSegmentFTypeSubTlv{obj: obj.obj.TypeF} - } - return obj.typeFHolder -} - -// description is TBD -// TypeF returns a BgpSrteSegmentFTypeSubTlv -func (obj *bgpSrteSegment) HasTypeF() bool { - return obj.obj.TypeF != nil -} - -// description is TBD -// SetTypeF sets the BgpSrteSegmentFTypeSubTlv value in the BgpSrteSegment object -func (obj *bgpSrteSegment) SetTypeF(value BgpSrteSegmentFTypeSubTlv) BgpSrteSegment { - - obj.typeFHolder = nil - obj.obj.TypeF = value.msg() - - return obj -} - -// description is TBD -// TypeG returns a BgpSrteSegmentGTypeSubTlv -func (obj *bgpSrteSegment) TypeG() BgpSrteSegmentGTypeSubTlv { - if obj.obj.TypeG == nil { - obj.obj.TypeG = NewBgpSrteSegmentGTypeSubTlv().msg() - } - if obj.typeGHolder == nil { - obj.typeGHolder = &bgpSrteSegmentGTypeSubTlv{obj: obj.obj.TypeG} - } - return obj.typeGHolder -} - -// description is TBD -// TypeG returns a BgpSrteSegmentGTypeSubTlv -func (obj *bgpSrteSegment) HasTypeG() bool { - return obj.obj.TypeG != nil -} - -// description is TBD -// SetTypeG sets the BgpSrteSegmentGTypeSubTlv value in the BgpSrteSegment object -func (obj *bgpSrteSegment) SetTypeG(value BgpSrteSegmentGTypeSubTlv) BgpSrteSegment { - - obj.typeGHolder = nil - obj.obj.TypeG = value.msg() - - return obj -} - -// description is TBD -// TypeH returns a BgpSrteSegmentHTypeSubTlv -func (obj *bgpSrteSegment) TypeH() BgpSrteSegmentHTypeSubTlv { - if obj.obj.TypeH == nil { - obj.obj.TypeH = NewBgpSrteSegmentHTypeSubTlv().msg() - } - if obj.typeHHolder == nil { - obj.typeHHolder = &bgpSrteSegmentHTypeSubTlv{obj: obj.obj.TypeH} - } - return obj.typeHHolder -} - -// description is TBD -// TypeH returns a BgpSrteSegmentHTypeSubTlv -func (obj *bgpSrteSegment) HasTypeH() bool { - return obj.obj.TypeH != nil -} - -// description is TBD -// SetTypeH sets the BgpSrteSegmentHTypeSubTlv value in the BgpSrteSegment object -func (obj *bgpSrteSegment) SetTypeH(value BgpSrteSegmentHTypeSubTlv) BgpSrteSegment { - - obj.typeHHolder = nil - obj.obj.TypeH = value.msg() - - return obj -} - -// description is TBD -// TypeI returns a BgpSrteSegmentITypeSubTlv -func (obj *bgpSrteSegment) TypeI() BgpSrteSegmentITypeSubTlv { - if obj.obj.TypeI == nil { - obj.obj.TypeI = NewBgpSrteSegmentITypeSubTlv().msg() - } - if obj.typeIHolder == nil { - obj.typeIHolder = &bgpSrteSegmentITypeSubTlv{obj: obj.obj.TypeI} - } - return obj.typeIHolder -} - -// description is TBD -// TypeI returns a BgpSrteSegmentITypeSubTlv -func (obj *bgpSrteSegment) HasTypeI() bool { - return obj.obj.TypeI != nil -} - -// description is TBD -// SetTypeI sets the BgpSrteSegmentITypeSubTlv value in the BgpSrteSegment object -func (obj *bgpSrteSegment) SetTypeI(value BgpSrteSegmentITypeSubTlv) BgpSrteSegment { - - obj.typeIHolder = nil - obj.obj.TypeI = value.msg() - - return obj -} - -// description is TBD -// TypeJ returns a BgpSrteSegmentJTypeSubTlv -func (obj *bgpSrteSegment) TypeJ() BgpSrteSegmentJTypeSubTlv { - if obj.obj.TypeJ == nil { - obj.obj.TypeJ = NewBgpSrteSegmentJTypeSubTlv().msg() - } - if obj.typeJHolder == nil { - obj.typeJHolder = &bgpSrteSegmentJTypeSubTlv{obj: obj.obj.TypeJ} - } - return obj.typeJHolder -} - -// description is TBD -// TypeJ returns a BgpSrteSegmentJTypeSubTlv -func (obj *bgpSrteSegment) HasTypeJ() bool { - return obj.obj.TypeJ != nil -} - -// description is TBD -// SetTypeJ sets the BgpSrteSegmentJTypeSubTlv value in the BgpSrteSegment object -func (obj *bgpSrteSegment) SetTypeJ(value BgpSrteSegmentJTypeSubTlv) BgpSrteSegment { - - obj.typeJHolder = nil - obj.obj.TypeJ = value.msg() - - return obj -} - -// description is TBD -// TypeK returns a BgpSrteSegmentKTypeSubTlv -func (obj *bgpSrteSegment) TypeK() BgpSrteSegmentKTypeSubTlv { - if obj.obj.TypeK == nil { - obj.obj.TypeK = NewBgpSrteSegmentKTypeSubTlv().msg() - } - if obj.typeKHolder == nil { - obj.typeKHolder = &bgpSrteSegmentKTypeSubTlv{obj: obj.obj.TypeK} - } - return obj.typeKHolder -} - -// description is TBD -// TypeK returns a BgpSrteSegmentKTypeSubTlv -func (obj *bgpSrteSegment) HasTypeK() bool { - return obj.obj.TypeK != nil -} - -// description is TBD -// SetTypeK sets the BgpSrteSegmentKTypeSubTlv value in the BgpSrteSegment object -func (obj *bgpSrteSegment) SetTypeK(value BgpSrteSegmentKTypeSubTlv) BgpSrteSegment { - - obj.typeKHolder = nil - obj.obj.TypeK = value.msg() - - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *bgpSrteSegment) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the BgpSrteSegment object -func (obj *bgpSrteSegment) SetName(value string) BgpSrteSegment { - - obj.obj.Name = &value - return obj -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// Active returns a bool -func (obj *bgpSrteSegment) Active() bool { - - return *obj.obj.Active - -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// Active returns a bool -func (obj *bgpSrteSegment) HasActive() bool { - return obj.obj.Active != nil -} - -// If enabled means that this part of the configuration including any active 'children' nodes will be advertised to peer. If disabled, this means that though config is present, it is not taking any part of the test but can be activated at run-time to advertise just this part of the configuration to the peer. -// SetActive sets the bool value in the BgpSrteSegment object -func (obj *bgpSrteSegment) SetActive(value bool) BgpSrteSegment { - - obj.obj.Active = &value - return obj -} - -func (obj *bgpSrteSegment) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // SegmentType is required - if obj.obj.SegmentType == nil { - vObj.validationErrors = append(vObj.validationErrors, "SegmentType is required field on interface BgpSrteSegment") - } - - if obj.obj.TypeA != nil { - - obj.TypeA().validateObj(vObj, set_default) - } - - if obj.obj.TypeB != nil { - - obj.TypeB().validateObj(vObj, set_default) - } - - if obj.obj.TypeC != nil { - - obj.TypeC().validateObj(vObj, set_default) - } - - if obj.obj.TypeD != nil { - - obj.TypeD().validateObj(vObj, set_default) - } - - if obj.obj.TypeE != nil { - - obj.TypeE().validateObj(vObj, set_default) - } - - if obj.obj.TypeF != nil { - - obj.TypeF().validateObj(vObj, set_default) - } - - if obj.obj.TypeG != nil { - - obj.TypeG().validateObj(vObj, set_default) - } - - if obj.obj.TypeH != nil { - - obj.TypeH().validateObj(vObj, set_default) - } - - if obj.obj.TypeI != nil { - - obj.TypeI().validateObj(vObj, set_default) - } - - if obj.obj.TypeJ != nil { - - obj.TypeJ().validateObj(vObj, set_default) - } - - if obj.obj.TypeK != nil { - - obj.TypeK().validateObj(vObj, set_default) - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpSrteSegment") - } -} - -func (obj *bgpSrteSegment) setDefault() { - if obj.obj.Active == nil { - obj.SetActive(true) - } - -} - -// ***** BgpAttributes ***** -type bgpAttributes struct { - validation - obj *otg.BgpAttributes - marshaller marshalBgpAttributes - unMarshaller unMarshalBgpAttributes - otherAttributesHolder BgpAttributesBgpAttributesOtherAttributeIter - asPathHolder BgpAttributesAsPath - as4PathHolder BgpAttributesAs4Path - nextHopHolder BgpAttributesNextHop - multiExitDiscriminatorHolder BgpAttributesMultiExitDiscriminator - localPreferenceHolder BgpAttributesLocalPreference - aggregatorHolder BgpAttributesAggregator - as4AggregatorHolder BgpAttributesAs4Aggregator - communityHolder BgpAttributesBgpAttributesCommunityIter - originatorIdHolder BgpAttributesOriginatorId - extendedCommunitiesHolder BgpAttributesBgpExtendedCommunityIter - tunnelEncapsulationHolder BgpAttributesTunnelEncapsulation - mpReachHolder BgpAttributesMpReachNlri - mpUnreachHolder BgpAttributesMpUnreachNlri -} - -func NewBgpAttributes() BgpAttributes { - obj := bgpAttributes{obj: &otg.BgpAttributes{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributes) msg() *otg.BgpAttributes { - return obj.obj -} - -func (obj *bgpAttributes) setMsg(msg *otg.BgpAttributes) BgpAttributes { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributes struct { - obj *bgpAttributes -} - -type marshalBgpAttributes interface { - // ToProto marshals BgpAttributes to protobuf object *otg.BgpAttributes - ToProto() (*otg.BgpAttributes, error) - // ToPbText marshals BgpAttributes to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributes to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributes to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributes struct { - obj *bgpAttributes -} - -type unMarshalBgpAttributes interface { - // FromProto unmarshals BgpAttributes from protobuf object *otg.BgpAttributes - FromProto(msg *otg.BgpAttributes) (BgpAttributes, error) - // FromPbText unmarshals BgpAttributes from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributes from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributes from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributes) Marshal() marshalBgpAttributes { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributes{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributes) Unmarshal() unMarshalBgpAttributes { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributes{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributes) ToProto() (*otg.BgpAttributes, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributes) FromProto(msg *otg.BgpAttributes) (BgpAttributes, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributes) 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 *unMarshalbgpAttributes) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributes) 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 *unMarshalbgpAttributes) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributes) 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 *unMarshalbgpAttributes) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributes) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributes) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributes) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributes) Clone() (BgpAttributes, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributes() - 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 -} - -func (obj *bgpAttributes) setNil() { - obj.otherAttributesHolder = nil - obj.asPathHolder = nil - obj.as4PathHolder = nil - obj.nextHopHolder = nil - obj.multiExitDiscriminatorHolder = nil - obj.localPreferenceHolder = nil - obj.aggregatorHolder = nil - obj.as4AggregatorHolder = nil - obj.communityHolder = nil - obj.originatorIdHolder = nil - obj.extendedCommunitiesHolder = nil - obj.tunnelEncapsulationHolder = nil - obj.mpReachHolder = nil - obj.mpUnreachHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributes is attributes carried in the Update packet alongwith the reach/unreach prefixes. -type BgpAttributes interface { - Validation - // msg marshals BgpAttributes to protobuf object *otg.BgpAttributes - // and doesn't set defaults - msg() *otg.BgpAttributes - // setMsg unmarshals BgpAttributes from protobuf object *otg.BgpAttributes - // and doesn't set defaults - setMsg(*otg.BgpAttributes) BgpAttributes - // provides marshal interface - Marshal() marshalBgpAttributes - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributes - // validate validates BgpAttributes - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributes, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // OtherAttributes returns BgpAttributesBgpAttributesOtherAttributeIterIter, set in BgpAttributes - OtherAttributes() BgpAttributesBgpAttributesOtherAttributeIter - // Origin returns BgpAttributesOriginEnum, set in BgpAttributes - Origin() BgpAttributesOriginEnum - // SetOrigin assigns BgpAttributesOriginEnum provided by user to BgpAttributes - SetOrigin(value BgpAttributesOriginEnum) BgpAttributes - // HasOrigin checks if Origin has been set in BgpAttributes - HasOrigin() bool - // AsPath returns BgpAttributesAsPath, set in BgpAttributes. - // BgpAttributesAsPath is the AS_PATH attribute identifies the autonomous systems through which routing information - // carried in this UPDATE message has passed. - // This contains the configuration of how to include the Local AS in the AS path - // attribute of the MP REACH NLRI. It also contains optional configuration of - // additional AS Path Segments that can be included in the AS Path attribute. - // The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that - // a routing information passes through to reach the destination. - // There are two modes in which AS numbers can be encoded in the AS Path Segments - // - When the AS Path is being exchanged between old and new BGP speakers or between two old BGP speakers , the AS numbers are encoded as 2 byte values. - // - When the AS Path is being exchanged between two new BGP speakers supporting 4 byte AS , the AS numbers are encoded as 4 byte values. - AsPath() BgpAttributesAsPath - // SetAsPath assigns BgpAttributesAsPath provided by user to BgpAttributes. - // BgpAttributesAsPath is the AS_PATH attribute identifies the autonomous systems through which routing information - // carried in this UPDATE message has passed. - // This contains the configuration of how to include the Local AS in the AS path - // attribute of the MP REACH NLRI. It also contains optional configuration of - // additional AS Path Segments that can be included in the AS Path attribute. - // The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that - // a routing information passes through to reach the destination. - // There are two modes in which AS numbers can be encoded in the AS Path Segments - // - When the AS Path is being exchanged between old and new BGP speakers or between two old BGP speakers , the AS numbers are encoded as 2 byte values. - // - When the AS Path is being exchanged between two new BGP speakers supporting 4 byte AS , the AS numbers are encoded as 4 byte values. - SetAsPath(value BgpAttributesAsPath) BgpAttributes - // HasAsPath checks if AsPath has been set in BgpAttributes - HasAsPath() bool - // As4Path returns BgpAttributesAs4Path, set in BgpAttributes. - // BgpAttributesAs4Path is the AS4_PATH attribute identifies the autonomous systems through which routing information - // carried in this UPDATE message has passed. - // This contains the configuration of how to include the Local AS in the AS path - // attribute of the MP REACH NLRI. It also contains optional configuration of - // additional AS Path Segments that can be included in the AS Path attribute. - // The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that - // a routing information passes through to reach the destination. - // AS4_PATH is only exchanged in two scenarios: - // - When an old BGP speaker has to forward a received AS4_PATH containing 4 byte AS numbers to new BGP speaker. - // - When a new BGP speaker is connected to an old BGP speaker and has to propagate 4 byte AS numbers via the old BGP speaker. - // Its usage is described in RFC4893. - As4Path() BgpAttributesAs4Path - // SetAs4Path assigns BgpAttributesAs4Path provided by user to BgpAttributes. - // BgpAttributesAs4Path is the AS4_PATH attribute identifies the autonomous systems through which routing information - // carried in this UPDATE message has passed. - // This contains the configuration of how to include the Local AS in the AS path - // attribute of the MP REACH NLRI. It also contains optional configuration of - // additional AS Path Segments that can be included in the AS Path attribute. - // The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that - // a routing information passes through to reach the destination. - // AS4_PATH is only exchanged in two scenarios: - // - When an old BGP speaker has to forward a received AS4_PATH containing 4 byte AS numbers to new BGP speaker. - // - When a new BGP speaker is connected to an old BGP speaker and has to propagate 4 byte AS numbers via the old BGP speaker. - // Its usage is described in RFC4893. - SetAs4Path(value BgpAttributesAs4Path) BgpAttributes - // HasAs4Path checks if As4Path has been set in BgpAttributes - HasAs4Path() bool - // NextHop returns BgpAttributesNextHop, set in BgpAttributes. - // BgpAttributesNextHop is next hop to be sent inside MP_REACH NLRI or as the NEXT_HOP attribute if advertised as traditional NLRI. - NextHop() BgpAttributesNextHop - // SetNextHop assigns BgpAttributesNextHop provided by user to BgpAttributes. - // BgpAttributesNextHop is next hop to be sent inside MP_REACH NLRI or as the NEXT_HOP attribute if advertised as traditional NLRI. - SetNextHop(value BgpAttributesNextHop) BgpAttributes - // HasNextHop checks if NextHop has been set in BgpAttributes - HasNextHop() bool - // MultiExitDiscriminator returns BgpAttributesMultiExitDiscriminator, set in BgpAttributes. - // BgpAttributesMultiExitDiscriminator is optional MULTI_EXIT_DISCRIMINATOR attribute sent to the peer to help in the route selection process. - MultiExitDiscriminator() BgpAttributesMultiExitDiscriminator - // SetMultiExitDiscriminator assigns BgpAttributesMultiExitDiscriminator provided by user to BgpAttributes. - // BgpAttributesMultiExitDiscriminator is optional MULTI_EXIT_DISCRIMINATOR attribute sent to the peer to help in the route selection process. - SetMultiExitDiscriminator(value BgpAttributesMultiExitDiscriminator) BgpAttributes - // HasMultiExitDiscriminator checks if MultiExitDiscriminator has been set in BgpAttributes - HasMultiExitDiscriminator() bool - // LocalPreference returns BgpAttributesLocalPreference, set in BgpAttributes. - // BgpAttributesLocalPreference is optional LOCAL_PREFERENCE attribute sent to the peer to indicate the degree of preference - // for externally learned routes.This should be included only for internal peers.It is - // used for the selection of the path for the traffic leaving the AS.The route with the - // highest local preference value is preferred. - LocalPreference() BgpAttributesLocalPreference - // SetLocalPreference assigns BgpAttributesLocalPreference provided by user to BgpAttributes. - // BgpAttributesLocalPreference is optional LOCAL_PREFERENCE attribute sent to the peer to indicate the degree of preference - // for externally learned routes.This should be included only for internal peers.It is - // used for the selection of the path for the traffic leaving the AS.The route with the - // highest local preference value is preferred. - SetLocalPreference(value BgpAttributesLocalPreference) BgpAttributes - // HasLocalPreference checks if LocalPreference has been set in BgpAttributes - HasLocalPreference() bool - // IncludeAtomicAggregator returns bool, set in BgpAttributes. - IncludeAtomicAggregator() bool - // SetIncludeAtomicAggregator assigns bool provided by user to BgpAttributes - SetIncludeAtomicAggregator(value bool) BgpAttributes - // HasIncludeAtomicAggregator checks if IncludeAtomicAggregator has been set in BgpAttributes - HasIncludeAtomicAggregator() bool - // Aggregator returns BgpAttributesAggregator, set in BgpAttributes. - // BgpAttributesAggregator is optional AGGREGATOR attribute which maybe be added by a BGP speaker which performs route aggregation. - // When AGGREGATOR attribute is being sent to a new BGP speaker , the AS number is encoded as a 4 byte value. - // When AGGREGATOR attribute is being exchanged between a new and an old BGP speaker or between two old BGP speakers, - // the AS number is encoded as a 2 byte value. - // It contain the AS number and IP address of the speaker performing the aggregation. - Aggregator() BgpAttributesAggregator - // SetAggregator assigns BgpAttributesAggregator provided by user to BgpAttributes. - // BgpAttributesAggregator is optional AGGREGATOR attribute which maybe be added by a BGP speaker which performs route aggregation. - // When AGGREGATOR attribute is being sent to a new BGP speaker , the AS number is encoded as a 4 byte value. - // When AGGREGATOR attribute is being exchanged between a new and an old BGP speaker or between two old BGP speakers, - // the AS number is encoded as a 2 byte value. - // It contain the AS number and IP address of the speaker performing the aggregation. - SetAggregator(value BgpAttributesAggregator) BgpAttributes - // HasAggregator checks if Aggregator has been set in BgpAttributes - HasAggregator() bool - // As4Aggregator returns BgpAttributesAs4Aggregator, set in BgpAttributes. - // BgpAttributesAs4Aggregator is optional AS4_AGGREGATOR attribute which maybe be added by a BGP speaker in one of two cases: - // - If it is a new BGP speaker speaking to an old BGP speaker and needs to send a 4 byte value for the AS number of the BGP route aggregator. - // - If it is a old BGP speaker speaking to a new BGP speaker and has to transparently forward a received AS4_AGGREGATOR from some other peer. - // Its usage is described in RFC4893. - As4Aggregator() BgpAttributesAs4Aggregator - // SetAs4Aggregator assigns BgpAttributesAs4Aggregator provided by user to BgpAttributes. - // BgpAttributesAs4Aggregator is optional AS4_AGGREGATOR attribute which maybe be added by a BGP speaker in one of two cases: - // - If it is a new BGP speaker speaking to an old BGP speaker and needs to send a 4 byte value for the AS number of the BGP route aggregator. - // - If it is a old BGP speaker speaking to a new BGP speaker and has to transparently forward a received AS4_AGGREGATOR from some other peer. - // Its usage is described in RFC4893. - SetAs4Aggregator(value BgpAttributesAs4Aggregator) BgpAttributes - // HasAs4Aggregator checks if As4Aggregator has been set in BgpAttributes - HasAs4Aggregator() bool - // Community returns BgpAttributesBgpAttributesCommunityIterIter, set in BgpAttributes - Community() BgpAttributesBgpAttributesCommunityIter - // OriginatorId returns BgpAttributesOriginatorId, set in BgpAttributes. - // BgpAttributesOriginatorId is optional ORIGINATOR_ID attribute (type code 9) carries the Router Id of the route's originator in the local AS. - OriginatorId() BgpAttributesOriginatorId - // SetOriginatorId assigns BgpAttributesOriginatorId provided by user to BgpAttributes. - // BgpAttributesOriginatorId is optional ORIGINATOR_ID attribute (type code 9) carries the Router Id of the route's originator in the local AS. - SetOriginatorId(value BgpAttributesOriginatorId) BgpAttributes - // HasOriginatorId checks if OriginatorId has been set in BgpAttributes - HasOriginatorId() bool - // ClusterIds returns []string, set in BgpAttributes. - ClusterIds() []string - // SetClusterIds assigns []string provided by user to BgpAttributes - SetClusterIds(value []string) BgpAttributes - // ExtendedCommunities returns BgpAttributesBgpExtendedCommunityIterIter, set in BgpAttributes - ExtendedCommunities() BgpAttributesBgpExtendedCommunityIter - // TunnelEncapsulation returns BgpAttributesTunnelEncapsulation, set in BgpAttributes. - // BgpAttributesTunnelEncapsulation is the TUNNEL_ENCAPSULATION attribute is used by a BGP speaker to inform other BGP speakers how to encapsulate packets that need to be sent to it. - // It is defined in RFC9012 and is assigned a Type code of 23. - TunnelEncapsulation() BgpAttributesTunnelEncapsulation - // SetTunnelEncapsulation assigns BgpAttributesTunnelEncapsulation provided by user to BgpAttributes. - // BgpAttributesTunnelEncapsulation is the TUNNEL_ENCAPSULATION attribute is used by a BGP speaker to inform other BGP speakers how to encapsulate packets that need to be sent to it. - // It is defined in RFC9012 and is assigned a Type code of 23. - SetTunnelEncapsulation(value BgpAttributesTunnelEncapsulation) BgpAttributes - // HasTunnelEncapsulation checks if TunnelEncapsulation has been set in BgpAttributes - HasTunnelEncapsulation() bool - // MpReach returns BgpAttributesMpReachNlri, set in BgpAttributes. - // BgpAttributesMpReachNlri is the MP_REACH attribute is an optional attribute which can be included in the attributes of a BGP Update message as defined in https://datatracker.ietf.org/doc/html/rfc4760#section-3. - // The following AFI / SAFI combinations are supported: - // - IPv4 Unicast with AFI as 1 and SAFI as 1 - // - IPv6 Unicast with AFI as 2 and SAFI as 1 - // - Segment Routing Policy for IPv4 Unicast with AFI as 1 and SAFI as 73 ( draft-ietf-idr-sr-policy-safi-02 Section 2.1 ) - // - Segment Routing Policy for IPv6 Unicast with AFI as 2 and SAFI as 73 - MpReach() BgpAttributesMpReachNlri - // SetMpReach assigns BgpAttributesMpReachNlri provided by user to BgpAttributes. - // BgpAttributesMpReachNlri is the MP_REACH attribute is an optional attribute which can be included in the attributes of a BGP Update message as defined in https://datatracker.ietf.org/doc/html/rfc4760#section-3. - // The following AFI / SAFI combinations are supported: - // - IPv4 Unicast with AFI as 1 and SAFI as 1 - // - IPv6 Unicast with AFI as 2 and SAFI as 1 - // - Segment Routing Policy for IPv4 Unicast with AFI as 1 and SAFI as 73 ( draft-ietf-idr-sr-policy-safi-02 Section 2.1 ) - // - Segment Routing Policy for IPv6 Unicast with AFI as 2 and SAFI as 73 - SetMpReach(value BgpAttributesMpReachNlri) BgpAttributes - // HasMpReach checks if MpReach has been set in BgpAttributes - HasMpReach() bool - // MpUnreach returns BgpAttributesMpUnreachNlri, set in BgpAttributes. - // BgpAttributesMpUnreachNlri is the MP_UNREACH attribute is an optional attribute which can be included in the attributes of a BGP Update message as defined in https://datatracker.ietf.org/doc/html/rfc4760#section-3. - // The following AFI / SAFI combinations are supported: - // - IPv4 Unicast with AFI as 1 and SAFI as 1 - // - IPv6 Unicast with AFI as 2 and SAFI as 1 - // - Segment Routing Policy for IPv4 Unicast with AFI as 1 and SAFI as 73 (draft-ietf-idr-sr-policy-safi-02 Section 2.1) - // - Segment Routing Policy for IPv6 Unicast with AFI as 2 and SAFI as 73 - MpUnreach() BgpAttributesMpUnreachNlri - // SetMpUnreach assigns BgpAttributesMpUnreachNlri provided by user to BgpAttributes. - // BgpAttributesMpUnreachNlri is the MP_UNREACH attribute is an optional attribute which can be included in the attributes of a BGP Update message as defined in https://datatracker.ietf.org/doc/html/rfc4760#section-3. - // The following AFI / SAFI combinations are supported: - // - IPv4 Unicast with AFI as 1 and SAFI as 1 - // - IPv6 Unicast with AFI as 2 and SAFI as 1 - // - Segment Routing Policy for IPv4 Unicast with AFI as 1 and SAFI as 73 (draft-ietf-idr-sr-policy-safi-02 Section 2.1) - // - Segment Routing Policy for IPv6 Unicast with AFI as 2 and SAFI as 73 - SetMpUnreach(value BgpAttributesMpUnreachNlri) BgpAttributes - // HasMpUnreach checks if MpUnreach has been set in BgpAttributes - HasMpUnreach() bool - setNil() -} - -// Any attributes not present in the list of configurable attributes should be added to the list of unknown attributes. -// OtherAttributes returns a []BgpAttributesOtherAttribute -func (obj *bgpAttributes) OtherAttributes() BgpAttributesBgpAttributesOtherAttributeIter { - if len(obj.obj.OtherAttributes) == 0 { - obj.obj.OtherAttributes = []*otg.BgpAttributesOtherAttribute{} - } - if obj.otherAttributesHolder == nil { - obj.otherAttributesHolder = newBgpAttributesBgpAttributesOtherAttributeIter(&obj.obj.OtherAttributes).setMsg(obj) - } - return obj.otherAttributesHolder -} - -type bgpAttributesBgpAttributesOtherAttributeIter struct { - obj *bgpAttributes - bgpAttributesOtherAttributeSlice []BgpAttributesOtherAttribute - fieldPtr *[]*otg.BgpAttributesOtherAttribute -} - -func newBgpAttributesBgpAttributesOtherAttributeIter(ptr *[]*otg.BgpAttributesOtherAttribute) BgpAttributesBgpAttributesOtherAttributeIter { - return &bgpAttributesBgpAttributesOtherAttributeIter{fieldPtr: ptr} -} - -type BgpAttributesBgpAttributesOtherAttributeIter interface { - setMsg(*bgpAttributes) BgpAttributesBgpAttributesOtherAttributeIter - Items() []BgpAttributesOtherAttribute - Add() BgpAttributesOtherAttribute - Append(items ...BgpAttributesOtherAttribute) BgpAttributesBgpAttributesOtherAttributeIter - Set(index int, newObj BgpAttributesOtherAttribute) BgpAttributesBgpAttributesOtherAttributeIter - Clear() BgpAttributesBgpAttributesOtherAttributeIter - clearHolderSlice() BgpAttributesBgpAttributesOtherAttributeIter - appendHolderSlice(item BgpAttributesOtherAttribute) BgpAttributesBgpAttributesOtherAttributeIter -} - -func (obj *bgpAttributesBgpAttributesOtherAttributeIter) setMsg(msg *bgpAttributes) BgpAttributesBgpAttributesOtherAttributeIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpAttributesOtherAttribute{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpAttributesBgpAttributesOtherAttributeIter) Items() []BgpAttributesOtherAttribute { - return obj.bgpAttributesOtherAttributeSlice -} - -func (obj *bgpAttributesBgpAttributesOtherAttributeIter) Add() BgpAttributesOtherAttribute { - newObj := &otg.BgpAttributesOtherAttribute{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpAttributesOtherAttribute{obj: newObj} - newLibObj.setDefault() - obj.bgpAttributesOtherAttributeSlice = append(obj.bgpAttributesOtherAttributeSlice, newLibObj) - return newLibObj -} - -func (obj *bgpAttributesBgpAttributesOtherAttributeIter) Append(items ...BgpAttributesOtherAttribute) BgpAttributesBgpAttributesOtherAttributeIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpAttributesOtherAttributeSlice = append(obj.bgpAttributesOtherAttributeSlice, item) - } - return obj -} - -func (obj *bgpAttributesBgpAttributesOtherAttributeIter) Set(index int, newObj BgpAttributesOtherAttribute) BgpAttributesBgpAttributesOtherAttributeIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpAttributesOtherAttributeSlice[index] = newObj - return obj -} -func (obj *bgpAttributesBgpAttributesOtherAttributeIter) Clear() BgpAttributesBgpAttributesOtherAttributeIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpAttributesOtherAttribute{} - obj.bgpAttributesOtherAttributeSlice = []BgpAttributesOtherAttribute{} - } - return obj -} -func (obj *bgpAttributesBgpAttributesOtherAttributeIter) clearHolderSlice() BgpAttributesBgpAttributesOtherAttributeIter { - if len(obj.bgpAttributesOtherAttributeSlice) > 0 { - obj.bgpAttributesOtherAttributeSlice = []BgpAttributesOtherAttribute{} - } - return obj -} -func (obj *bgpAttributesBgpAttributesOtherAttributeIter) appendHolderSlice(item BgpAttributesOtherAttribute) BgpAttributesBgpAttributesOtherAttributeIter { - obj.bgpAttributesOtherAttributeSlice = append(obj.bgpAttributesOtherAttributeSlice, item) - return obj -} - -type BgpAttributesOriginEnum string - -// Enum of Origin on BgpAttributes -var BgpAttributesOrigin = struct { - IGP BgpAttributesOriginEnum - EGP BgpAttributesOriginEnum - INCOMPLETE BgpAttributesOriginEnum -}{ - IGP: BgpAttributesOriginEnum("igp"), - EGP: BgpAttributesOriginEnum("egp"), - INCOMPLETE: BgpAttributesOriginEnum("incomplete"), -} - -func (obj *bgpAttributes) Origin() BgpAttributesOriginEnum { - return BgpAttributesOriginEnum(obj.obj.Origin.Enum().String()) -} - -// The ORIGIN attribute is a mandatory attribute which can take three values: -// the prefix originates from an interior routing protocol 'igp', it originates from 'egp' -// or the origin is 'incomplete',if the prefix is learned through other means. -// Origin returns a string -func (obj *bgpAttributes) HasOrigin() bool { - return obj.obj.Origin != nil -} - -func (obj *bgpAttributes) SetOrigin(value BgpAttributesOriginEnum) BgpAttributes { - intValue, ok := otg.BgpAttributes_Origin_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAttributesOriginEnum", string(value))) - return obj - } - enumValue := otg.BgpAttributes_Origin_Enum(intValue) - obj.obj.Origin = &enumValue - - return obj -} - -// AS_PATH attribute to be included in the Update. -// AsPath returns a BgpAttributesAsPath -func (obj *bgpAttributes) AsPath() BgpAttributesAsPath { - if obj.obj.AsPath == nil { - obj.obj.AsPath = NewBgpAttributesAsPath().msg() - } - if obj.asPathHolder == nil { - obj.asPathHolder = &bgpAttributesAsPath{obj: obj.obj.AsPath} - } - return obj.asPathHolder -} - -// AS_PATH attribute to be included in the Update. -// AsPath returns a BgpAttributesAsPath -func (obj *bgpAttributes) HasAsPath() bool { - return obj.obj.AsPath != nil -} - -// AS_PATH attribute to be included in the Update. -// SetAsPath sets the BgpAttributesAsPath value in the BgpAttributes object -func (obj *bgpAttributes) SetAsPath(value BgpAttributesAsPath) BgpAttributes { - - obj.asPathHolder = nil - obj.obj.AsPath = value.msg() - - return obj -} - -// AS4_PATH attribute to be included in the Update. -// As4Path returns a BgpAttributesAs4Path -func (obj *bgpAttributes) As4Path() BgpAttributesAs4Path { - if obj.obj.As4Path == nil { - obj.obj.As4Path = NewBgpAttributesAs4Path().msg() - } - if obj.as4PathHolder == nil { - obj.as4PathHolder = &bgpAttributesAs4Path{obj: obj.obj.As4Path} - } - return obj.as4PathHolder -} - -// AS4_PATH attribute to be included in the Update. -// As4Path returns a BgpAttributesAs4Path -func (obj *bgpAttributes) HasAs4Path() bool { - return obj.obj.As4Path != nil -} - -// AS4_PATH attribute to be included in the Update. -// SetAs4Path sets the BgpAttributesAs4Path value in the BgpAttributes object -func (obj *bgpAttributes) SetAs4Path(value BgpAttributesAs4Path) BgpAttributes { - - obj.as4PathHolder = nil - obj.obj.As4Path = value.msg() - - return obj -} - -// description is TBD -// NextHop returns a BgpAttributesNextHop -func (obj *bgpAttributes) NextHop() BgpAttributesNextHop { - if obj.obj.NextHop == nil { - obj.obj.NextHop = NewBgpAttributesNextHop().msg() - } - if obj.nextHopHolder == nil { - obj.nextHopHolder = &bgpAttributesNextHop{obj: obj.obj.NextHop} - } - return obj.nextHopHolder -} - -// description is TBD -// NextHop returns a BgpAttributesNextHop -func (obj *bgpAttributes) HasNextHop() bool { - return obj.obj.NextHop != nil -} - -// description is TBD -// SetNextHop sets the BgpAttributesNextHop value in the BgpAttributes object -func (obj *bgpAttributes) SetNextHop(value BgpAttributesNextHop) BgpAttributes { - - obj.nextHopHolder = nil - obj.obj.NextHop = value.msg() - - return obj -} - -// description is TBD -// MultiExitDiscriminator returns a BgpAttributesMultiExitDiscriminator -func (obj *bgpAttributes) MultiExitDiscriminator() BgpAttributesMultiExitDiscriminator { - if obj.obj.MultiExitDiscriminator == nil { - obj.obj.MultiExitDiscriminator = NewBgpAttributesMultiExitDiscriminator().msg() - } - if obj.multiExitDiscriminatorHolder == nil { - obj.multiExitDiscriminatorHolder = &bgpAttributesMultiExitDiscriminator{obj: obj.obj.MultiExitDiscriminator} - } - return obj.multiExitDiscriminatorHolder -} - -// description is TBD -// MultiExitDiscriminator returns a BgpAttributesMultiExitDiscriminator -func (obj *bgpAttributes) HasMultiExitDiscriminator() bool { - return obj.obj.MultiExitDiscriminator != nil -} - -// description is TBD -// SetMultiExitDiscriminator sets the BgpAttributesMultiExitDiscriminator value in the BgpAttributes object -func (obj *bgpAttributes) SetMultiExitDiscriminator(value BgpAttributesMultiExitDiscriminator) BgpAttributes { - - obj.multiExitDiscriminatorHolder = nil - obj.obj.MultiExitDiscriminator = value.msg() - - return obj -} - -// description is TBD -// LocalPreference returns a BgpAttributesLocalPreference -func (obj *bgpAttributes) LocalPreference() BgpAttributesLocalPreference { - if obj.obj.LocalPreference == nil { - obj.obj.LocalPreference = NewBgpAttributesLocalPreference().msg() - } - if obj.localPreferenceHolder == nil { - obj.localPreferenceHolder = &bgpAttributesLocalPreference{obj: obj.obj.LocalPreference} - } - return obj.localPreferenceHolder -} - -// description is TBD -// LocalPreference returns a BgpAttributesLocalPreference -func (obj *bgpAttributes) HasLocalPreference() bool { - return obj.obj.LocalPreference != nil -} - -// description is TBD -// SetLocalPreference sets the BgpAttributesLocalPreference value in the BgpAttributes object -func (obj *bgpAttributes) SetLocalPreference(value BgpAttributesLocalPreference) BgpAttributes { - - obj.localPreferenceHolder = nil - obj.obj.LocalPreference = value.msg() - - return obj -} - -// If enabled, it indicates that the ATOMIC_AGGREGATOR attribute should be included in the Update. -// Presence of this attribute Indicates that this route might not be getting sent on a fully optimized path -// since some intermediate BGP speaker has aggregated the route. -// IncludeAtomicAggregator returns a bool -func (obj *bgpAttributes) IncludeAtomicAggregator() bool { - - return *obj.obj.IncludeAtomicAggregator - -} - -// If enabled, it indicates that the ATOMIC_AGGREGATOR attribute should be included in the Update. -// Presence of this attribute Indicates that this route might not be getting sent on a fully optimized path -// since some intermediate BGP speaker has aggregated the route. -// IncludeAtomicAggregator returns a bool -func (obj *bgpAttributes) HasIncludeAtomicAggregator() bool { - return obj.obj.IncludeAtomicAggregator != nil -} - -// If enabled, it indicates that the ATOMIC_AGGREGATOR attribute should be included in the Update. -// Presence of this attribute Indicates that this route might not be getting sent on a fully optimized path -// since some intermediate BGP speaker has aggregated the route. -// SetIncludeAtomicAggregator sets the bool value in the BgpAttributes object -func (obj *bgpAttributes) SetIncludeAtomicAggregator(value bool) BgpAttributes { - - obj.obj.IncludeAtomicAggregator = &value - return obj -} - -// description is TBD -// Aggregator returns a BgpAttributesAggregator -func (obj *bgpAttributes) Aggregator() BgpAttributesAggregator { - if obj.obj.Aggregator == nil { - obj.obj.Aggregator = NewBgpAttributesAggregator().msg() - } - if obj.aggregatorHolder == nil { - obj.aggregatorHolder = &bgpAttributesAggregator{obj: obj.obj.Aggregator} - } - return obj.aggregatorHolder -} - -// description is TBD -// Aggregator returns a BgpAttributesAggregator -func (obj *bgpAttributes) HasAggregator() bool { - return obj.obj.Aggregator != nil -} - -// description is TBD -// SetAggregator sets the BgpAttributesAggregator value in the BgpAttributes object -func (obj *bgpAttributes) SetAggregator(value BgpAttributesAggregator) BgpAttributes { - - obj.aggregatorHolder = nil - obj.obj.Aggregator = value.msg() - - return obj -} - -// description is TBD -// As4Aggregator returns a BgpAttributesAs4Aggregator -func (obj *bgpAttributes) As4Aggregator() BgpAttributesAs4Aggregator { - if obj.obj.As4Aggregator == nil { - obj.obj.As4Aggregator = NewBgpAttributesAs4Aggregator().msg() - } - if obj.as4AggregatorHolder == nil { - obj.as4AggregatorHolder = &bgpAttributesAs4Aggregator{obj: obj.obj.As4Aggregator} - } - return obj.as4AggregatorHolder -} - -// description is TBD -// As4Aggregator returns a BgpAttributesAs4Aggregator -func (obj *bgpAttributes) HasAs4Aggregator() bool { - return obj.obj.As4Aggregator != nil -} - -// description is TBD -// SetAs4Aggregator sets the BgpAttributesAs4Aggregator value in the BgpAttributes object -func (obj *bgpAttributes) SetAs4Aggregator(value BgpAttributesAs4Aggregator) BgpAttributes { - - obj.as4AggregatorHolder = nil - obj.obj.As4Aggregator = value.msg() - - return obj -} - -// description is TBD -// Community returns a []BgpAttributesCommunity -func (obj *bgpAttributes) Community() BgpAttributesBgpAttributesCommunityIter { - if len(obj.obj.Community) == 0 { - obj.obj.Community = []*otg.BgpAttributesCommunity{} - } - if obj.communityHolder == nil { - obj.communityHolder = newBgpAttributesBgpAttributesCommunityIter(&obj.obj.Community).setMsg(obj) - } - return obj.communityHolder -} - -type bgpAttributesBgpAttributesCommunityIter struct { - obj *bgpAttributes - bgpAttributesCommunitySlice []BgpAttributesCommunity - fieldPtr *[]*otg.BgpAttributesCommunity -} - -func newBgpAttributesBgpAttributesCommunityIter(ptr *[]*otg.BgpAttributesCommunity) BgpAttributesBgpAttributesCommunityIter { - return &bgpAttributesBgpAttributesCommunityIter{fieldPtr: ptr} -} - -type BgpAttributesBgpAttributesCommunityIter interface { - setMsg(*bgpAttributes) BgpAttributesBgpAttributesCommunityIter - Items() []BgpAttributesCommunity - Add() BgpAttributesCommunity - Append(items ...BgpAttributesCommunity) BgpAttributesBgpAttributesCommunityIter - Set(index int, newObj BgpAttributesCommunity) BgpAttributesBgpAttributesCommunityIter - Clear() BgpAttributesBgpAttributesCommunityIter - clearHolderSlice() BgpAttributesBgpAttributesCommunityIter - appendHolderSlice(item BgpAttributesCommunity) BgpAttributesBgpAttributesCommunityIter -} - -func (obj *bgpAttributesBgpAttributesCommunityIter) setMsg(msg *bgpAttributes) BgpAttributesBgpAttributesCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpAttributesCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpAttributesBgpAttributesCommunityIter) Items() []BgpAttributesCommunity { - return obj.bgpAttributesCommunitySlice -} - -func (obj *bgpAttributesBgpAttributesCommunityIter) Add() BgpAttributesCommunity { - newObj := &otg.BgpAttributesCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpAttributesCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpAttributesCommunitySlice = append(obj.bgpAttributesCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpAttributesBgpAttributesCommunityIter) Append(items ...BgpAttributesCommunity) BgpAttributesBgpAttributesCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpAttributesCommunitySlice = append(obj.bgpAttributesCommunitySlice, item) - } - return obj -} - -func (obj *bgpAttributesBgpAttributesCommunityIter) Set(index int, newObj BgpAttributesCommunity) BgpAttributesBgpAttributesCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpAttributesCommunitySlice[index] = newObj - return obj -} -func (obj *bgpAttributesBgpAttributesCommunityIter) Clear() BgpAttributesBgpAttributesCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpAttributesCommunity{} - obj.bgpAttributesCommunitySlice = []BgpAttributesCommunity{} - } - return obj -} -func (obj *bgpAttributesBgpAttributesCommunityIter) clearHolderSlice() BgpAttributesBgpAttributesCommunityIter { - if len(obj.bgpAttributesCommunitySlice) > 0 { - obj.bgpAttributesCommunitySlice = []BgpAttributesCommunity{} - } - return obj -} -func (obj *bgpAttributesBgpAttributesCommunityIter) appendHolderSlice(item BgpAttributesCommunity) BgpAttributesBgpAttributesCommunityIter { - obj.bgpAttributesCommunitySlice = append(obj.bgpAttributesCommunitySlice, item) - return obj -} - -// description is TBD -// OriginatorId returns a BgpAttributesOriginatorId -func (obj *bgpAttributes) OriginatorId() BgpAttributesOriginatorId { - if obj.obj.OriginatorId == nil { - obj.obj.OriginatorId = NewBgpAttributesOriginatorId().msg() - } - if obj.originatorIdHolder == nil { - obj.originatorIdHolder = &bgpAttributesOriginatorId{obj: obj.obj.OriginatorId} - } - return obj.originatorIdHolder -} - -// description is TBD -// OriginatorId returns a BgpAttributesOriginatorId -func (obj *bgpAttributes) HasOriginatorId() bool { - return obj.obj.OriginatorId != nil -} - -// description is TBD -// SetOriginatorId sets the BgpAttributesOriginatorId value in the BgpAttributes object -func (obj *bgpAttributes) SetOriginatorId(value BgpAttributesOriginatorId) BgpAttributes { - - obj.originatorIdHolder = nil - obj.obj.OriginatorId = value.msg() - - return obj -} - -// When a Route Reflector reflects a route, it prepends the local CLUSTER_ID to the CLUSTER_LIST as defined in RFC4456. -// ClusterIds returns a []string -func (obj *bgpAttributes) ClusterIds() []string { - if obj.obj.ClusterIds == nil { - obj.obj.ClusterIds = make([]string, 0) - } - return obj.obj.ClusterIds -} - -// When a Route Reflector reflects a route, it prepends the local CLUSTER_ID to the CLUSTER_LIST as defined in RFC4456. -// SetClusterIds sets the []string value in the BgpAttributes object -func (obj *bgpAttributes) SetClusterIds(value []string) BgpAttributes { - - if obj.obj.ClusterIds == nil { - obj.obj.ClusterIds = make([]string, 0) - } - obj.obj.ClusterIds = value - - return obj -} - -// Optional EXTENDED_COMMUNITY attribute settings. -// The EXTENDED_COMMUNITY Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes -// are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an eight byte value. -// It is divided into two main parts. The first two bytes of the community encode a type and sub-type fields and the last six bytes carry a unique set -// of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. -// ExtendedCommunities returns a []BgpExtendedCommunity -func (obj *bgpAttributes) ExtendedCommunities() BgpAttributesBgpExtendedCommunityIter { - if len(obj.obj.ExtendedCommunities) == 0 { - obj.obj.ExtendedCommunities = []*otg.BgpExtendedCommunity{} - } - if obj.extendedCommunitiesHolder == nil { - obj.extendedCommunitiesHolder = newBgpAttributesBgpExtendedCommunityIter(&obj.obj.ExtendedCommunities).setMsg(obj) - } - return obj.extendedCommunitiesHolder -} - -type bgpAttributesBgpExtendedCommunityIter struct { - obj *bgpAttributes - bgpExtendedCommunitySlice []BgpExtendedCommunity - fieldPtr *[]*otg.BgpExtendedCommunity -} - -func newBgpAttributesBgpExtendedCommunityIter(ptr *[]*otg.BgpExtendedCommunity) BgpAttributesBgpExtendedCommunityIter { - return &bgpAttributesBgpExtendedCommunityIter{fieldPtr: ptr} -} - -type BgpAttributesBgpExtendedCommunityIter interface { - setMsg(*bgpAttributes) BgpAttributesBgpExtendedCommunityIter - Items() []BgpExtendedCommunity - Add() BgpExtendedCommunity - Append(items ...BgpExtendedCommunity) BgpAttributesBgpExtendedCommunityIter - Set(index int, newObj BgpExtendedCommunity) BgpAttributesBgpExtendedCommunityIter - Clear() BgpAttributesBgpExtendedCommunityIter - clearHolderSlice() BgpAttributesBgpExtendedCommunityIter - appendHolderSlice(item BgpExtendedCommunity) BgpAttributesBgpExtendedCommunityIter -} - -func (obj *bgpAttributesBgpExtendedCommunityIter) setMsg(msg *bgpAttributes) BgpAttributesBgpExtendedCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpExtendedCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpAttributesBgpExtendedCommunityIter) Items() []BgpExtendedCommunity { - return obj.bgpExtendedCommunitySlice -} - -func (obj *bgpAttributesBgpExtendedCommunityIter) Add() BgpExtendedCommunity { - newObj := &otg.BgpExtendedCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpExtendedCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpAttributesBgpExtendedCommunityIter) Append(items ...BgpExtendedCommunity) BgpAttributesBgpExtendedCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, item) - } - return obj -} - -func (obj *bgpAttributesBgpExtendedCommunityIter) Set(index int, newObj BgpExtendedCommunity) BgpAttributesBgpExtendedCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpExtendedCommunitySlice[index] = newObj - return obj -} -func (obj *bgpAttributesBgpExtendedCommunityIter) Clear() BgpAttributesBgpExtendedCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpExtendedCommunity{} - obj.bgpExtendedCommunitySlice = []BgpExtendedCommunity{} - } - return obj -} -func (obj *bgpAttributesBgpExtendedCommunityIter) clearHolderSlice() BgpAttributesBgpExtendedCommunityIter { - if len(obj.bgpExtendedCommunitySlice) > 0 { - obj.bgpExtendedCommunitySlice = []BgpExtendedCommunity{} - } - return obj -} -func (obj *bgpAttributesBgpExtendedCommunityIter) appendHolderSlice(item BgpExtendedCommunity) BgpAttributesBgpExtendedCommunityIter { - obj.bgpExtendedCommunitySlice = append(obj.bgpExtendedCommunitySlice, item) - return obj -} - -// description is TBD -// TunnelEncapsulation returns a BgpAttributesTunnelEncapsulation -func (obj *bgpAttributes) TunnelEncapsulation() BgpAttributesTunnelEncapsulation { - if obj.obj.TunnelEncapsulation == nil { - obj.obj.TunnelEncapsulation = NewBgpAttributesTunnelEncapsulation().msg() - } - if obj.tunnelEncapsulationHolder == nil { - obj.tunnelEncapsulationHolder = &bgpAttributesTunnelEncapsulation{obj: obj.obj.TunnelEncapsulation} - } - return obj.tunnelEncapsulationHolder -} - -// description is TBD -// TunnelEncapsulation returns a BgpAttributesTunnelEncapsulation -func (obj *bgpAttributes) HasTunnelEncapsulation() bool { - return obj.obj.TunnelEncapsulation != nil -} - -// description is TBD -// SetTunnelEncapsulation sets the BgpAttributesTunnelEncapsulation value in the BgpAttributes object -func (obj *bgpAttributes) SetTunnelEncapsulation(value BgpAttributesTunnelEncapsulation) BgpAttributes { - - obj.tunnelEncapsulationHolder = nil - obj.obj.TunnelEncapsulation = value.msg() - - return obj -} - -// description is TBD -// MpReach returns a BgpAttributesMpReachNlri -func (obj *bgpAttributes) MpReach() BgpAttributesMpReachNlri { - if obj.obj.MpReach == nil { - obj.obj.MpReach = NewBgpAttributesMpReachNlri().msg() - } - if obj.mpReachHolder == nil { - obj.mpReachHolder = &bgpAttributesMpReachNlri{obj: obj.obj.MpReach} - } - return obj.mpReachHolder -} - -// description is TBD -// MpReach returns a BgpAttributesMpReachNlri -func (obj *bgpAttributes) HasMpReach() bool { - return obj.obj.MpReach != nil -} - -// description is TBD -// SetMpReach sets the BgpAttributesMpReachNlri value in the BgpAttributes object -func (obj *bgpAttributes) SetMpReach(value BgpAttributesMpReachNlri) BgpAttributes { - - obj.mpReachHolder = nil - obj.obj.MpReach = value.msg() - - return obj -} - -// description is TBD -// MpUnreach returns a BgpAttributesMpUnreachNlri -func (obj *bgpAttributes) MpUnreach() BgpAttributesMpUnreachNlri { - if obj.obj.MpUnreach == nil { - obj.obj.MpUnreach = NewBgpAttributesMpUnreachNlri().msg() - } - if obj.mpUnreachHolder == nil { - obj.mpUnreachHolder = &bgpAttributesMpUnreachNlri{obj: obj.obj.MpUnreach} - } - return obj.mpUnreachHolder -} - -// description is TBD -// MpUnreach returns a BgpAttributesMpUnreachNlri -func (obj *bgpAttributes) HasMpUnreach() bool { - return obj.obj.MpUnreach != nil -} - -// description is TBD -// SetMpUnreach sets the BgpAttributesMpUnreachNlri value in the BgpAttributes object -func (obj *bgpAttributes) SetMpUnreach(value BgpAttributesMpUnreachNlri) BgpAttributes { - - obj.mpUnreachHolder = nil - obj.obj.MpUnreach = value.msg() - - return obj -} - -func (obj *bgpAttributes) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.OtherAttributes) != 0 { - - if set_default { - obj.OtherAttributes().clearHolderSlice() - for _, item := range obj.obj.OtherAttributes { - obj.OtherAttributes().appendHolderSlice(&bgpAttributesOtherAttribute{obj: item}) - } - } - for _, item := range obj.OtherAttributes().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.AsPath != nil { - - obj.AsPath().validateObj(vObj, set_default) - } - - if obj.obj.As4Path != nil { - - obj.As4Path().validateObj(vObj, set_default) - } - - if obj.obj.NextHop != nil { - - obj.NextHop().validateObj(vObj, set_default) - } - - if obj.obj.MultiExitDiscriminator != nil { - - obj.MultiExitDiscriminator().validateObj(vObj, set_default) - } - - if obj.obj.LocalPreference != nil { - - obj.LocalPreference().validateObj(vObj, set_default) - } - - if obj.obj.Aggregator != nil { - - obj.Aggregator().validateObj(vObj, set_default) - } - - if obj.obj.As4Aggregator != nil { - - obj.As4Aggregator().validateObj(vObj, set_default) - } - - if len(obj.obj.Community) != 0 { - - if set_default { - obj.Community().clearHolderSlice() - for _, item := range obj.obj.Community { - obj.Community().appendHolderSlice(&bgpAttributesCommunity{obj: item}) - } - } - for _, item := range obj.Community().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.OriginatorId != nil { - - obj.OriginatorId().validateObj(vObj, set_default) - } - - if obj.obj.ClusterIds != nil { - - err := obj.validateIpv4Slice(obj.ClusterIds()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributes.ClusterIds")) - } - - } - - if len(obj.obj.ExtendedCommunities) != 0 { - - if set_default { - obj.ExtendedCommunities().clearHolderSlice() - for _, item := range obj.obj.ExtendedCommunities { - obj.ExtendedCommunities().appendHolderSlice(&bgpExtendedCommunity{obj: item}) - } - } - for _, item := range obj.ExtendedCommunities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.TunnelEncapsulation != nil { - - obj.TunnelEncapsulation().validateObj(vObj, set_default) - } - - if obj.obj.MpReach != nil { - - obj.MpReach().validateObj(vObj, set_default) - } - - if obj.obj.MpUnreach != nil { - - obj.MpUnreach().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributes) setDefault() { - if obj.obj.Origin == nil { - obj.SetOrigin(BgpAttributesOrigin.INCOMPLETE) - - } - if obj.obj.IncludeAtomicAggregator == nil { - obj.SetIncludeAtomicAggregator(false) - } - -} - -// ***** BgpOneTraditionalNlriPrefix ***** -type bgpOneTraditionalNlriPrefix struct { - validation - obj *otg.BgpOneTraditionalNlriPrefix - marshaller marshalBgpOneTraditionalNlriPrefix - unMarshaller unMarshalBgpOneTraditionalNlriPrefix - pathIdHolder BgpNLRIPrefixPathId -} - -func NewBgpOneTraditionalNlriPrefix() BgpOneTraditionalNlriPrefix { - obj := bgpOneTraditionalNlriPrefix{obj: &otg.BgpOneTraditionalNlriPrefix{}} - obj.setDefault() - return &obj -} - -func (obj *bgpOneTraditionalNlriPrefix) msg() *otg.BgpOneTraditionalNlriPrefix { - return obj.obj -} - -func (obj *bgpOneTraditionalNlriPrefix) setMsg(msg *otg.BgpOneTraditionalNlriPrefix) BgpOneTraditionalNlriPrefix { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpOneTraditionalNlriPrefix struct { - obj *bgpOneTraditionalNlriPrefix -} - -type marshalBgpOneTraditionalNlriPrefix interface { - // ToProto marshals BgpOneTraditionalNlriPrefix to protobuf object *otg.BgpOneTraditionalNlriPrefix - ToProto() (*otg.BgpOneTraditionalNlriPrefix, error) - // ToPbText marshals BgpOneTraditionalNlriPrefix to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpOneTraditionalNlriPrefix to YAML text - ToYaml() (string, error) - // ToJson marshals BgpOneTraditionalNlriPrefix to JSON text - ToJson() (string, error) -} - -type unMarshalbgpOneTraditionalNlriPrefix struct { - obj *bgpOneTraditionalNlriPrefix -} - -type unMarshalBgpOneTraditionalNlriPrefix interface { - // FromProto unmarshals BgpOneTraditionalNlriPrefix from protobuf object *otg.BgpOneTraditionalNlriPrefix - FromProto(msg *otg.BgpOneTraditionalNlriPrefix) (BgpOneTraditionalNlriPrefix, error) - // FromPbText unmarshals BgpOneTraditionalNlriPrefix from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpOneTraditionalNlriPrefix from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpOneTraditionalNlriPrefix from JSON text - FromJson(value string) error -} - -func (obj *bgpOneTraditionalNlriPrefix) Marshal() marshalBgpOneTraditionalNlriPrefix { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpOneTraditionalNlriPrefix{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpOneTraditionalNlriPrefix) Unmarshal() unMarshalBgpOneTraditionalNlriPrefix { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpOneTraditionalNlriPrefix{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpOneTraditionalNlriPrefix) ToProto() (*otg.BgpOneTraditionalNlriPrefix, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpOneTraditionalNlriPrefix) FromProto(msg *otg.BgpOneTraditionalNlriPrefix) (BgpOneTraditionalNlriPrefix, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpOneTraditionalNlriPrefix) 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 *unMarshalbgpOneTraditionalNlriPrefix) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpOneTraditionalNlriPrefix) 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 *unMarshalbgpOneTraditionalNlriPrefix) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpOneTraditionalNlriPrefix) 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 *unMarshalbgpOneTraditionalNlriPrefix) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpOneTraditionalNlriPrefix) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpOneTraditionalNlriPrefix) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpOneTraditionalNlriPrefix) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpOneTraditionalNlriPrefix) Clone() (BgpOneTraditionalNlriPrefix, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpOneTraditionalNlriPrefix() - 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 -} - -func (obj *bgpOneTraditionalNlriPrefix) setNil() { - obj.pathIdHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpOneTraditionalNlriPrefix is tRADITIONAL_NLRI is an optional part of the the BGP Update which can carry only IPv4 prefix information as defined in https://www.rfc-editor.org/rfc/rfc4271.html#section-4.3 -// and extended by https://datatracker.ietf.org/doc/html/rfc7911#section-3 to carry additional Path Id information per prefix. -type BgpOneTraditionalNlriPrefix interface { - Validation - // msg marshals BgpOneTraditionalNlriPrefix to protobuf object *otg.BgpOneTraditionalNlriPrefix - // and doesn't set defaults - msg() *otg.BgpOneTraditionalNlriPrefix - // setMsg unmarshals BgpOneTraditionalNlriPrefix from protobuf object *otg.BgpOneTraditionalNlriPrefix - // and doesn't set defaults - setMsg(*otg.BgpOneTraditionalNlriPrefix) BgpOneTraditionalNlriPrefix - // provides marshal interface - Marshal() marshalBgpOneTraditionalNlriPrefix - // provides unmarshal interface - Unmarshal() unMarshalBgpOneTraditionalNlriPrefix - // validate validates BgpOneTraditionalNlriPrefix - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpOneTraditionalNlriPrefix, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Address returns string, set in BgpOneTraditionalNlriPrefix. - Address() string - // SetAddress assigns string provided by user to BgpOneTraditionalNlriPrefix - SetAddress(value string) BgpOneTraditionalNlriPrefix - // HasAddress checks if Address has been set in BgpOneTraditionalNlriPrefix - HasAddress() bool - // Prefix returns uint32, set in BgpOneTraditionalNlriPrefix. - Prefix() uint32 - // SetPrefix assigns uint32 provided by user to BgpOneTraditionalNlriPrefix - SetPrefix(value uint32) BgpOneTraditionalNlriPrefix - // HasPrefix checks if Prefix has been set in BgpOneTraditionalNlriPrefix - HasPrefix() bool - // PathId returns BgpNLRIPrefixPathId, set in BgpOneTraditionalNlriPrefix. - // BgpNLRIPrefixPathId is optional field in the NLRI carrying Path Id of the prefix. - PathId() BgpNLRIPrefixPathId - // SetPathId assigns BgpNLRIPrefixPathId provided by user to BgpOneTraditionalNlriPrefix. - // BgpNLRIPrefixPathId is optional field in the NLRI carrying Path Id of the prefix. - SetPathId(value BgpNLRIPrefixPathId) BgpOneTraditionalNlriPrefix - // HasPathId checks if PathId has been set in BgpOneTraditionalNlriPrefix - HasPathId() bool - setNil() -} - -// The IPv4 address of the network. -// Address returns a string -func (obj *bgpOneTraditionalNlriPrefix) Address() string { - - return *obj.obj.Address - -} - -// The IPv4 address of the network. -// Address returns a string -func (obj *bgpOneTraditionalNlriPrefix) HasAddress() bool { - return obj.obj.Address != nil -} - -// The IPv4 address of the network. -// SetAddress sets the string value in the BgpOneTraditionalNlriPrefix object -func (obj *bgpOneTraditionalNlriPrefix) SetAddress(value string) BgpOneTraditionalNlriPrefix { - - obj.obj.Address = &value - return obj -} - -// The IPv4 network prefix length to be applied to the address. -// Prefix returns a uint32 -func (obj *bgpOneTraditionalNlriPrefix) Prefix() uint32 { - - return *obj.obj.Prefix - -} - -// The IPv4 network prefix length to be applied to the address. -// Prefix returns a uint32 -func (obj *bgpOneTraditionalNlriPrefix) HasPrefix() bool { - return obj.obj.Prefix != nil -} - -// The IPv4 network prefix length to be applied to the address. -// SetPrefix sets the uint32 value in the BgpOneTraditionalNlriPrefix object -func (obj *bgpOneTraditionalNlriPrefix) SetPrefix(value uint32) BgpOneTraditionalNlriPrefix { - - obj.obj.Prefix = &value - return obj -} - -// description is TBD -// PathId returns a BgpNLRIPrefixPathId -func (obj *bgpOneTraditionalNlriPrefix) PathId() BgpNLRIPrefixPathId { - if obj.obj.PathId == nil { - obj.obj.PathId = NewBgpNLRIPrefixPathId().msg() - } - if obj.pathIdHolder == nil { - obj.pathIdHolder = &bgpNLRIPrefixPathId{obj: obj.obj.PathId} - } - return obj.pathIdHolder -} - -// description is TBD -// PathId returns a BgpNLRIPrefixPathId -func (obj *bgpOneTraditionalNlriPrefix) HasPathId() bool { - return obj.obj.PathId != nil -} - -// description is TBD -// SetPathId sets the BgpNLRIPrefixPathId value in the BgpOneTraditionalNlriPrefix object -func (obj *bgpOneTraditionalNlriPrefix) SetPathId(value BgpNLRIPrefixPathId) BgpOneTraditionalNlriPrefix { - - obj.pathIdHolder = nil - obj.obj.PathId = value.msg() - - return obj -} - -func (obj *bgpOneTraditionalNlriPrefix) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Address != nil { - - err := obj.validateIpv4(obj.Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpOneTraditionalNlriPrefix.Address")) - } - - } - - if obj.obj.Prefix != nil { - - if *obj.obj.Prefix > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpOneTraditionalNlriPrefix.Prefix <= 32 but Got %d", *obj.obj.Prefix)) - } - - } - - if obj.obj.PathId != nil { - - obj.PathId().validateObj(vObj, set_default) - } - -} - -func (obj *bgpOneTraditionalNlriPrefix) setDefault() { - if obj.obj.Address == nil { - obj.SetAddress("0.0.0.0") - } - if obj.obj.Prefix == nil { - obj.SetPrefix(24) - } - -} - -// ***** BgpV6EviVxlanBroadcastDomain ***** -type bgpV6EviVxlanBroadcastDomain struct { - validation - obj *otg.BgpV6EviVxlanBroadcastDomain - marshaller marshalBgpV6EviVxlanBroadcastDomain - unMarshaller unMarshalBgpV6EviVxlanBroadcastDomain - cmacIpRangeHolder BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter -} - -func NewBgpV6EviVxlanBroadcastDomain() BgpV6EviVxlanBroadcastDomain { - obj := bgpV6EviVxlanBroadcastDomain{obj: &otg.BgpV6EviVxlanBroadcastDomain{}} - obj.setDefault() - return &obj -} - -func (obj *bgpV6EviVxlanBroadcastDomain) msg() *otg.BgpV6EviVxlanBroadcastDomain { - return obj.obj -} - -func (obj *bgpV6EviVxlanBroadcastDomain) setMsg(msg *otg.BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBroadcastDomain { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpV6EviVxlanBroadcastDomain struct { - obj *bgpV6EviVxlanBroadcastDomain -} - -type marshalBgpV6EviVxlanBroadcastDomain interface { - // ToProto marshals BgpV6EviVxlanBroadcastDomain to protobuf object *otg.BgpV6EviVxlanBroadcastDomain - ToProto() (*otg.BgpV6EviVxlanBroadcastDomain, error) - // ToPbText marshals BgpV6EviVxlanBroadcastDomain to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpV6EviVxlanBroadcastDomain to YAML text - ToYaml() (string, error) - // ToJson marshals BgpV6EviVxlanBroadcastDomain to JSON text - ToJson() (string, error) -} - -type unMarshalbgpV6EviVxlanBroadcastDomain struct { - obj *bgpV6EviVxlanBroadcastDomain -} - -type unMarshalBgpV6EviVxlanBroadcastDomain interface { - // FromProto unmarshals BgpV6EviVxlanBroadcastDomain from protobuf object *otg.BgpV6EviVxlanBroadcastDomain - FromProto(msg *otg.BgpV6EviVxlanBroadcastDomain) (BgpV6EviVxlanBroadcastDomain, error) - // FromPbText unmarshals BgpV6EviVxlanBroadcastDomain from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpV6EviVxlanBroadcastDomain from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpV6EviVxlanBroadcastDomain from JSON text - FromJson(value string) error -} - -func (obj *bgpV6EviVxlanBroadcastDomain) Marshal() marshalBgpV6EviVxlanBroadcastDomain { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpV6EviVxlanBroadcastDomain{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpV6EviVxlanBroadcastDomain) Unmarshal() unMarshalBgpV6EviVxlanBroadcastDomain { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpV6EviVxlanBroadcastDomain{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpV6EviVxlanBroadcastDomain) ToProto() (*otg.BgpV6EviVxlanBroadcastDomain, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpV6EviVxlanBroadcastDomain) FromProto(msg *otg.BgpV6EviVxlanBroadcastDomain) (BgpV6EviVxlanBroadcastDomain, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpV6EviVxlanBroadcastDomain) 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 *unMarshalbgpV6EviVxlanBroadcastDomain) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpV6EviVxlanBroadcastDomain) 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 *unMarshalbgpV6EviVxlanBroadcastDomain) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpV6EviVxlanBroadcastDomain) 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 *unMarshalbgpV6EviVxlanBroadcastDomain) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpV6EviVxlanBroadcastDomain) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpV6EviVxlanBroadcastDomain) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpV6EviVxlanBroadcastDomain) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpV6EviVxlanBroadcastDomain) Clone() (BgpV6EviVxlanBroadcastDomain, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpV6EviVxlanBroadcastDomain() - 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 -} - -func (obj *bgpV6EviVxlanBroadcastDomain) setNil() { - obj.cmacIpRangeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpV6EviVxlanBroadcastDomain is configuration for Broadcast Domains per EVI. -type BgpV6EviVxlanBroadcastDomain interface { - Validation - // msg marshals BgpV6EviVxlanBroadcastDomain to protobuf object *otg.BgpV6EviVxlanBroadcastDomain - // and doesn't set defaults - msg() *otg.BgpV6EviVxlanBroadcastDomain - // setMsg unmarshals BgpV6EviVxlanBroadcastDomain from protobuf object *otg.BgpV6EviVxlanBroadcastDomain - // and doesn't set defaults - setMsg(*otg.BgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBroadcastDomain - // provides marshal interface - Marshal() marshalBgpV6EviVxlanBroadcastDomain - // provides unmarshal interface - Unmarshal() unMarshalBgpV6EviVxlanBroadcastDomain - // validate validates BgpV6EviVxlanBroadcastDomain - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpV6EviVxlanBroadcastDomain, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // CmacIpRange returns BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIterIter, set in BgpV6EviVxlanBroadcastDomain - CmacIpRange() BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter - // EthernetTagId returns uint32, set in BgpV6EviVxlanBroadcastDomain. - EthernetTagId() uint32 - // SetEthernetTagId assigns uint32 provided by user to BgpV6EviVxlanBroadcastDomain - SetEthernetTagId(value uint32) BgpV6EviVxlanBroadcastDomain - // HasEthernetTagId checks if EthernetTagId has been set in BgpV6EviVxlanBroadcastDomain - HasEthernetTagId() bool - // VlanAwareService returns bool, set in BgpV6EviVxlanBroadcastDomain. - VlanAwareService() bool - // SetVlanAwareService assigns bool provided by user to BgpV6EviVxlanBroadcastDomain - SetVlanAwareService(value bool) BgpV6EviVxlanBroadcastDomain - // HasVlanAwareService checks if VlanAwareService has been set in BgpV6EviVxlanBroadcastDomain - HasVlanAwareService() bool - setNil() -} - -// This contains the list of Customer MAC/IP Ranges to be configured per Broadcast Domain. -// -// Advertises following route - -// Type 2 - MAC/IP Advertisement Route. -// CmacIpRange returns a []BgpCMacIpRange -func (obj *bgpV6EviVxlanBroadcastDomain) CmacIpRange() BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { - if len(obj.obj.CmacIpRange) == 0 { - obj.obj.CmacIpRange = []*otg.BgpCMacIpRange{} - } - if obj.cmacIpRangeHolder == nil { - obj.cmacIpRangeHolder = newBgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter(&obj.obj.CmacIpRange).setMsg(obj) - } - return obj.cmacIpRangeHolder -} - -type bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter struct { - obj *bgpV6EviVxlanBroadcastDomain - bgpCMacIpRangeSlice []BgpCMacIpRange - fieldPtr *[]*otg.BgpCMacIpRange -} - -func newBgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter(ptr *[]*otg.BgpCMacIpRange) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { - return &bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter{fieldPtr: ptr} -} - -type BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter interface { - setMsg(*bgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter - Items() []BgpCMacIpRange - Add() BgpCMacIpRange - Append(items ...BgpCMacIpRange) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter - Set(index int, newObj BgpCMacIpRange) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter - Clear() BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter - clearHolderSlice() BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter - appendHolderSlice(item BgpCMacIpRange) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter -} - -func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) setMsg(msg *bgpV6EviVxlanBroadcastDomain) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpCMacIpRange{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) Items() []BgpCMacIpRange { - return obj.bgpCMacIpRangeSlice -} - -func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) Add() BgpCMacIpRange { - newObj := &otg.BgpCMacIpRange{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpCMacIpRange{obj: newObj} - newLibObj.setDefault() - obj.bgpCMacIpRangeSlice = append(obj.bgpCMacIpRangeSlice, newLibObj) - return newLibObj -} - -func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) Append(items ...BgpCMacIpRange) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpCMacIpRangeSlice = append(obj.bgpCMacIpRangeSlice, item) - } - return obj -} - -func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) Set(index int, newObj BgpCMacIpRange) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpCMacIpRangeSlice[index] = newObj - return obj -} -func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) Clear() BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpCMacIpRange{} - obj.bgpCMacIpRangeSlice = []BgpCMacIpRange{} - } - return obj -} -func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) clearHolderSlice() BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { - if len(obj.bgpCMacIpRangeSlice) > 0 { - obj.bgpCMacIpRangeSlice = []BgpCMacIpRange{} - } - return obj -} -func (obj *bgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter) appendHolderSlice(item BgpCMacIpRange) BgpV6EviVxlanBroadcastDomainBgpCMacIpRangeIter { - obj.bgpCMacIpRangeSlice = append(obj.bgpCMacIpRangeSlice, item) - return obj -} - -// The Ethernet Tag ID of the Broadcast Domain. -// EthernetTagId returns a uint32 -func (obj *bgpV6EviVxlanBroadcastDomain) EthernetTagId() uint32 { - - return *obj.obj.EthernetTagId - -} - -// The Ethernet Tag ID of the Broadcast Domain. -// EthernetTagId returns a uint32 -func (obj *bgpV6EviVxlanBroadcastDomain) HasEthernetTagId() bool { - return obj.obj.EthernetTagId != nil -} - -// The Ethernet Tag ID of the Broadcast Domain. -// SetEthernetTagId sets the uint32 value in the BgpV6EviVxlanBroadcastDomain object -func (obj *bgpV6EviVxlanBroadcastDomain) SetEthernetTagId(value uint32) BgpV6EviVxlanBroadcastDomain { - - obj.obj.EthernetTagId = &value - return obj -} - -// VLAN-Aware service to be enabled or disabled. -// VlanAwareService returns a bool -func (obj *bgpV6EviVxlanBroadcastDomain) VlanAwareService() bool { - - return *obj.obj.VlanAwareService - -} - -// VLAN-Aware service to be enabled or disabled. -// VlanAwareService returns a bool -func (obj *bgpV6EviVxlanBroadcastDomain) HasVlanAwareService() bool { - return obj.obj.VlanAwareService != nil -} - -// VLAN-Aware service to be enabled or disabled. -// SetVlanAwareService sets the bool value in the BgpV6EviVxlanBroadcastDomain object -func (obj *bgpV6EviVxlanBroadcastDomain) SetVlanAwareService(value bool) BgpV6EviVxlanBroadcastDomain { - - obj.obj.VlanAwareService = &value - return obj -} - -func (obj *bgpV6EviVxlanBroadcastDomain) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.CmacIpRange) != 0 { - - if set_default { - obj.CmacIpRange().clearHolderSlice() - for _, item := range obj.obj.CmacIpRange { - obj.CmacIpRange().appendHolderSlice(&bgpCMacIpRange{obj: item}) - } - } - for _, item := range obj.CmacIpRange().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpV6EviVxlanBroadcastDomain) setDefault() { - if obj.obj.EthernetTagId == nil { - obj.SetEthernetTagId(0) - } - if obj.obj.VlanAwareService == nil { - obj.SetVlanAwareService(false) - } - -} - -// ***** PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter ***** -type patternFlowIpv4OptionsCustomTypeCopiedFlagCounter struct { - validation - obj *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - marshaller marshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - unMarshaller unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter -} - -func NewPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter() PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { - obj := patternFlowIpv4OptionsCustomTypeCopiedFlagCounter{obj: &otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) msg() *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { - return obj.obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) setMsg(msg *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter struct { - obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter -} - -type marshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter interface { - // ToProto marshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, error) - // ToPbText marshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter struct { - obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter -} - -type unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter interface { - // FromProto unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) (PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, error) - // FromPbText unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) Marshal() marshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) (PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) 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 *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) 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 *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) 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 *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) Clone() (PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter() - 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 -} - -// PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter is integer counter pattern -type PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter interface { - Validation - // msg marshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - // setMsg unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - // validate validates PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - SetStart(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - // HasStart checks if Start has been set in PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - SetStep(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - // HasStep checks if Step has been set in PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - SetCount(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - // HasCount checks if Count has been set in PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter object -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) SetStart(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter object -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) SetStep(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter object -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) SetCount(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4OptionsCustomTypeOptionClassCounter ***** -type patternFlowIpv4OptionsCustomTypeOptionClassCounter struct { - validation - obj *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter - marshaller marshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter - unMarshaller unMarshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter -} - -func NewPatternFlowIpv4OptionsCustomTypeOptionClassCounter() PatternFlowIpv4OptionsCustomTypeOptionClassCounter { - obj := patternFlowIpv4OptionsCustomTypeOptionClassCounter{obj: &otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter { - return obj.obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) setMsg(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter) PatternFlowIpv4OptionsCustomTypeOptionClassCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter struct { - obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter -} - -type marshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter interface { - // ToProto marshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter - ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter, error) - // ToPbText marshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter struct { - obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter -} - -type unMarshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter interface { - // FromProto unmarshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter - FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter) (PatternFlowIpv4OptionsCustomTypeOptionClassCounter, error) - // FromPbText unmarshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter) (PatternFlowIpv4OptionsCustomTypeOptionClassCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) 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 *marshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) 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 *marshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) 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 *patternFlowIpv4OptionsCustomTypeOptionClassCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) Clone() (PatternFlowIpv4OptionsCustomTypeOptionClassCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4OptionsCustomTypeOptionClassCounter() - 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 -} - -// PatternFlowIpv4OptionsCustomTypeOptionClassCounter is integer counter pattern -type PatternFlowIpv4OptionsCustomTypeOptionClassCounter interface { - Validation - // msg marshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter - // setMsg unmarshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter) PatternFlowIpv4OptionsCustomTypeOptionClassCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter - // validate validates PatternFlowIpv4OptionsCustomTypeOptionClassCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4OptionsCustomTypeOptionClassCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionClassCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionClassCounter - SetStart(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClassCounter - // HasStart checks if Start has been set in PatternFlowIpv4OptionsCustomTypeOptionClassCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionClassCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionClassCounter - SetStep(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClassCounter - // HasStep checks if Step has been set in PatternFlowIpv4OptionsCustomTypeOptionClassCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionClassCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionClassCounter - SetCount(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClassCounter - // HasCount checks if Count has been set in PatternFlowIpv4OptionsCustomTypeOptionClassCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionClassCounter object -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) SetStart(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClassCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionClassCounter object -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) SetStep(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClassCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionClassCounter object -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) SetCount(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClassCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionClassCounter.Start <= 3 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionClassCounter.Step <= 3 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 3 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionClassCounter.Count <= 3 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowIpv4OptionsCustomTypeOptionNumberCounter ***** -type patternFlowIpv4OptionsCustomTypeOptionNumberCounter struct { - validation - obj *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - marshaller marshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter - unMarshaller unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter -} - -func NewPatternFlowIpv4OptionsCustomTypeOptionNumberCounter() PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { - obj := patternFlowIpv4OptionsCustomTypeOptionNumberCounter{obj: &otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { - return obj.obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) setMsg(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter struct { - obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter -} - -type marshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter interface { - // ToProto marshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, error) - // ToPbText marshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter struct { - obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter -} - -type unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter interface { - // FromProto unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) (PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, error) - // FromPbText unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) (PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) 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 *marshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) 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 *marshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) 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 *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) Clone() (PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowIpv4OptionsCustomTypeOptionNumberCounter() - 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 -} - -// PatternFlowIpv4OptionsCustomTypeOptionNumberCounter is integer counter pattern -type PatternFlowIpv4OptionsCustomTypeOptionNumberCounter interface { - Validation - // msg marshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - // and doesn't set defaults - msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - // setMsg unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - // provides marshal interface - Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter - // validate validates PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionNumberCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - SetStart(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - // HasStart checks if Start has been set in PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - HasStart() bool - // Step returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionNumberCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - SetStep(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - // HasStep checks if Step has been set in PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - HasStep() bool - // Count returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionNumberCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - SetCount(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - // HasCount checks if Count has been set in PatternFlowIpv4OptionsCustomTypeOptionNumberCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionNumberCounter object -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) SetStart(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionNumberCounter object -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) SetStep(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionNumberCounter object -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) SetCount(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionNumberCounter.Start <= 31 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionNumberCounter.Step <= 31 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 31 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionNumberCounter.Count <= 31 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowSnmpv2CVariableBindingValueIntegerValue ***** -type patternFlowSnmpv2CVariableBindingValueIntegerValue struct { - validation - obj *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue - marshaller marshalPatternFlowSnmpv2CVariableBindingValueIntegerValue - unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValue - incrementHolder PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - decrementHolder PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter -} - -func NewPatternFlowSnmpv2CVariableBindingValueIntegerValue() PatternFlowSnmpv2CVariableBindingValueIntegerValue { - obj := patternFlowSnmpv2CVariableBindingValueIntegerValue{obj: &otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) msg() *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue { - return obj.obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue) PatternFlowSnmpv2CVariableBindingValueIntegerValue { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CVariableBindingValueIntegerValue struct { - obj *patternFlowSnmpv2CVariableBindingValueIntegerValue -} - -type marshalPatternFlowSnmpv2CVariableBindingValueIntegerValue interface { - // ToProto marshals PatternFlowSnmpv2CVariableBindingValueIntegerValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue - ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue, error) - // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueIntegerValue to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueIntegerValue to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CVariableBindingValueIntegerValue to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValue struct { - obj *patternFlowSnmpv2CVariableBindingValueIntegerValue -} - -type unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValue interface { - // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue - FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue) (PatternFlowSnmpv2CVariableBindingValueIntegerValue, error) - // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValue from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValue from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValue from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIntegerValue { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueIntegerValue{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValue { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValue{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue) (PatternFlowSnmpv2CVariableBindingValueIntegerValue, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Clone() (PatternFlowSnmpv2CVariableBindingValueIntegerValue, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CVariableBindingValueIntegerValue() - 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 -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowSnmpv2CVariableBindingValueIntegerValue is integer value returned for the requested OID. -type PatternFlowSnmpv2CVariableBindingValueIntegerValue interface { - Validation - // msg marshals PatternFlowSnmpv2CVariableBindingValueIntegerValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue - // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue) PatternFlowSnmpv2CVariableBindingValueIntegerValue - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIntegerValue - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValue - // validate validates PatternFlowSnmpv2CVariableBindingValueIntegerValue - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CVariableBindingValueIntegerValue, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum, set in PatternFlowSnmpv2CVariableBindingValueIntegerValue - Choice() PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum - // setChoice assigns PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValue - setChoice(value PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueIntegerValue - // HasChoice checks if Choice has been set in PatternFlowSnmpv2CVariableBindingValueIntegerValue - HasChoice() bool - // Value returns int32, set in PatternFlowSnmpv2CVariableBindingValueIntegerValue. - Value() int32 - // SetValue assigns int32 provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValue - SetValue(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValue - // HasValue checks if Value has been set in PatternFlowSnmpv2CVariableBindingValueIntegerValue - HasValue() bool - // Values returns []int32, set in PatternFlowSnmpv2CVariableBindingValueIntegerValue. - Values() []int32 - // SetValues assigns []int32 provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValue - SetValues(value []int32) PatternFlowSnmpv2CVariableBindingValueIntegerValue - // Increment returns PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, set in PatternFlowSnmpv2CVariableBindingValueIntegerValue. - Increment() PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - // SetIncrement assigns PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValue. - SetIncrement(value PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueIntegerValue - // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CVariableBindingValueIntegerValue - HasIncrement() bool - // Decrement returns PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, set in PatternFlowSnmpv2CVariableBindingValueIntegerValue. - Decrement() PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - // SetDecrement assigns PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValue. - SetDecrement(value PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueIntegerValue - // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CVariableBindingValueIntegerValue - HasDecrement() bool - setNil() -} - -type PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum string - -// Enum of Choice on PatternFlowSnmpv2CVariableBindingValueIntegerValue -var PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice = struct { - VALUE PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum - VALUES PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum - INCREMENT PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum - DECREMENT PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum -}{ - VALUE: PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum("value"), - VALUES: PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum("values"), - INCREMENT: PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum("increment"), - DECREMENT: PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum("decrement"), -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Choice() PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum { - return PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) setChoice(value PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueIntegerValue { - intValue, ok := otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUE { - defaultValue := int32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUES { - defaultValue := []int32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter().msg() - } - - if value == PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a int32 -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Value() int32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a int32 -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the int32 value in the PatternFlowSnmpv2CVariableBindingValueIntegerValue object -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) SetValue(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []int32 -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Values() []int32 { - if obj.obj.Values == nil { - obj.SetValues([]int32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []int32 value in the PatternFlowSnmpv2CVariableBindingValueIntegerValue object -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) SetValues(value []int32) PatternFlowSnmpv2CVariableBindingValueIntegerValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]int32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Increment() PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowSnmpv2CVariableBindingValueIntegerValueCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter value in the PatternFlowSnmpv2CVariableBindingValueIntegerValue object -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) SetIncrement(value PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueIntegerValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Decrement() PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowSnmpv2CVariableBindingValueIntegerValueCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter value in the PatternFlowSnmpv2CVariableBindingValueIntegerValue object -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) SetDecrement(value PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueIntegerValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) setDefault() { - var choices_set int = 0 - var choice PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CVariableBindingValueIntegerValue") - } - } else { - intVal := otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowSnmpv2CVariableBindingStringValue ***** -type flowSnmpv2CVariableBindingStringValue struct { - validation - obj *otg.FlowSnmpv2CVariableBindingStringValue - marshaller marshalFlowSnmpv2CVariableBindingStringValue - unMarshaller unMarshalFlowSnmpv2CVariableBindingStringValue -} - -func NewFlowSnmpv2CVariableBindingStringValue() FlowSnmpv2CVariableBindingStringValue { - obj := flowSnmpv2CVariableBindingStringValue{obj: &otg.FlowSnmpv2CVariableBindingStringValue{}} - obj.setDefault() - return &obj -} - -func (obj *flowSnmpv2CVariableBindingStringValue) msg() *otg.FlowSnmpv2CVariableBindingStringValue { - return obj.obj -} - -func (obj *flowSnmpv2CVariableBindingStringValue) setMsg(msg *otg.FlowSnmpv2CVariableBindingStringValue) FlowSnmpv2CVariableBindingStringValue { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowSnmpv2CVariableBindingStringValue struct { - obj *flowSnmpv2CVariableBindingStringValue -} - -type marshalFlowSnmpv2CVariableBindingStringValue interface { - // ToProto marshals FlowSnmpv2CVariableBindingStringValue to protobuf object *otg.FlowSnmpv2CVariableBindingStringValue - ToProto() (*otg.FlowSnmpv2CVariableBindingStringValue, error) - // ToPbText marshals FlowSnmpv2CVariableBindingStringValue to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowSnmpv2CVariableBindingStringValue to YAML text - ToYaml() (string, error) - // ToJson marshals FlowSnmpv2CVariableBindingStringValue to JSON text - ToJson() (string, error) -} - -type unMarshalflowSnmpv2CVariableBindingStringValue struct { - obj *flowSnmpv2CVariableBindingStringValue -} - -type unMarshalFlowSnmpv2CVariableBindingStringValue interface { - // FromProto unmarshals FlowSnmpv2CVariableBindingStringValue from protobuf object *otg.FlowSnmpv2CVariableBindingStringValue - FromProto(msg *otg.FlowSnmpv2CVariableBindingStringValue) (FlowSnmpv2CVariableBindingStringValue, error) - // FromPbText unmarshals FlowSnmpv2CVariableBindingStringValue from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowSnmpv2CVariableBindingStringValue from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowSnmpv2CVariableBindingStringValue from JSON text - FromJson(value string) error -} - -func (obj *flowSnmpv2CVariableBindingStringValue) Marshal() marshalFlowSnmpv2CVariableBindingStringValue { - if obj.marshaller == nil { - obj.marshaller = &marshalflowSnmpv2CVariableBindingStringValue{obj: obj} - } - return obj.marshaller -} - -func (obj *flowSnmpv2CVariableBindingStringValue) Unmarshal() unMarshalFlowSnmpv2CVariableBindingStringValue { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowSnmpv2CVariableBindingStringValue{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowSnmpv2CVariableBindingStringValue) ToProto() (*otg.FlowSnmpv2CVariableBindingStringValue, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowSnmpv2CVariableBindingStringValue) FromProto(msg *otg.FlowSnmpv2CVariableBindingStringValue) (FlowSnmpv2CVariableBindingStringValue, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowSnmpv2CVariableBindingStringValue) 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 *unMarshalflowSnmpv2CVariableBindingStringValue) 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 *marshalflowSnmpv2CVariableBindingStringValue) 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 *unMarshalflowSnmpv2CVariableBindingStringValue) 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 *marshalflowSnmpv2CVariableBindingStringValue) 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 *unMarshalflowSnmpv2CVariableBindingStringValue) 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 *flowSnmpv2CVariableBindingStringValue) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowSnmpv2CVariableBindingStringValue) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowSnmpv2CVariableBindingStringValue) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowSnmpv2CVariableBindingStringValue) Clone() (FlowSnmpv2CVariableBindingStringValue, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowSnmpv2CVariableBindingStringValue() - 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 -} - -// FlowSnmpv2CVariableBindingStringValue is it contains the raw/ascii string value to be sent. -type FlowSnmpv2CVariableBindingStringValue interface { - Validation - // msg marshals FlowSnmpv2CVariableBindingStringValue to protobuf object *otg.FlowSnmpv2CVariableBindingStringValue - // and doesn't set defaults - msg() *otg.FlowSnmpv2CVariableBindingStringValue - // setMsg unmarshals FlowSnmpv2CVariableBindingStringValue from protobuf object *otg.FlowSnmpv2CVariableBindingStringValue - // and doesn't set defaults - setMsg(*otg.FlowSnmpv2CVariableBindingStringValue) FlowSnmpv2CVariableBindingStringValue - // provides marshal interface - Marshal() marshalFlowSnmpv2CVariableBindingStringValue - // provides unmarshal interface - Unmarshal() unMarshalFlowSnmpv2CVariableBindingStringValue - // validate validates FlowSnmpv2CVariableBindingStringValue - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowSnmpv2CVariableBindingStringValue, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowSnmpv2CVariableBindingStringValueChoiceEnum, set in FlowSnmpv2CVariableBindingStringValue - Choice() FlowSnmpv2CVariableBindingStringValueChoiceEnum - // setChoice assigns FlowSnmpv2CVariableBindingStringValueChoiceEnum provided by user to FlowSnmpv2CVariableBindingStringValue - setChoice(value FlowSnmpv2CVariableBindingStringValueChoiceEnum) FlowSnmpv2CVariableBindingStringValue - // HasChoice checks if Choice has been set in FlowSnmpv2CVariableBindingStringValue - HasChoice() bool - // Ascii returns string, set in FlowSnmpv2CVariableBindingStringValue. - Ascii() string - // SetAscii assigns string provided by user to FlowSnmpv2CVariableBindingStringValue - SetAscii(value string) FlowSnmpv2CVariableBindingStringValue - // HasAscii checks if Ascii has been set in FlowSnmpv2CVariableBindingStringValue - HasAscii() bool - // Raw returns string, set in FlowSnmpv2CVariableBindingStringValue. - Raw() string - // SetRaw assigns string provided by user to FlowSnmpv2CVariableBindingStringValue - SetRaw(value string) FlowSnmpv2CVariableBindingStringValue - // HasRaw checks if Raw has been set in FlowSnmpv2CVariableBindingStringValue - HasRaw() bool -} - -type FlowSnmpv2CVariableBindingStringValueChoiceEnum string - -// Enum of Choice on FlowSnmpv2CVariableBindingStringValue -var FlowSnmpv2CVariableBindingStringValueChoice = struct { - ASCII FlowSnmpv2CVariableBindingStringValueChoiceEnum - RAW FlowSnmpv2CVariableBindingStringValueChoiceEnum -}{ - ASCII: FlowSnmpv2CVariableBindingStringValueChoiceEnum("ascii"), - RAW: FlowSnmpv2CVariableBindingStringValueChoiceEnum("raw"), -} - -func (obj *flowSnmpv2CVariableBindingStringValue) Choice() FlowSnmpv2CVariableBindingStringValueChoiceEnum { - return FlowSnmpv2CVariableBindingStringValueChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowSnmpv2CVariableBindingStringValue) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowSnmpv2CVariableBindingStringValue) setChoice(value FlowSnmpv2CVariableBindingStringValueChoiceEnum) FlowSnmpv2CVariableBindingStringValue { - intValue, ok := otg.FlowSnmpv2CVariableBindingStringValue_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowSnmpv2CVariableBindingStringValueChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowSnmpv2CVariableBindingStringValue_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Raw = nil - obj.obj.Ascii = nil - - if value == FlowSnmpv2CVariableBindingStringValueChoice.ASCII { - defaultValue := "ascii" - obj.obj.Ascii = &defaultValue - } - - if value == FlowSnmpv2CVariableBindingStringValueChoice.RAW { - defaultValue := "00" - obj.obj.Raw = &defaultValue - } - - return obj -} - -// It contains the ASCII string to be sent. As of now it is restricted to 10000 bytes. -// Ascii returns a string -func (obj *flowSnmpv2CVariableBindingStringValue) Ascii() string { - - if obj.obj.Ascii == nil { - obj.setChoice(FlowSnmpv2CVariableBindingStringValueChoice.ASCII) - } - - return *obj.obj.Ascii - -} - -// It contains the ASCII string to be sent. As of now it is restricted to 10000 bytes. -// Ascii returns a string -func (obj *flowSnmpv2CVariableBindingStringValue) HasAscii() bool { - return obj.obj.Ascii != nil -} - -// It contains the ASCII string to be sent. As of now it is restricted to 10000 bytes. -// SetAscii sets the string value in the FlowSnmpv2CVariableBindingStringValue object -func (obj *flowSnmpv2CVariableBindingStringValue) SetAscii(value string) FlowSnmpv2CVariableBindingStringValue { - obj.setChoice(FlowSnmpv2CVariableBindingStringValueChoice.ASCII) - obj.obj.Ascii = &value - return obj -} - -// It contains the hex string to be sent. As of now it is restricted to 10000 bytes. -// Raw returns a string -func (obj *flowSnmpv2CVariableBindingStringValue) Raw() string { - - if obj.obj.Raw == nil { - obj.setChoice(FlowSnmpv2CVariableBindingStringValueChoice.RAW) - } - - return *obj.obj.Raw - -} - -// It contains the hex string to be sent. As of now it is restricted to 10000 bytes. -// Raw returns a string -func (obj *flowSnmpv2CVariableBindingStringValue) HasRaw() bool { - return obj.obj.Raw != nil -} - -// It contains the hex string to be sent. As of now it is restricted to 10000 bytes. -// SetRaw sets the string value in the FlowSnmpv2CVariableBindingStringValue object -func (obj *flowSnmpv2CVariableBindingStringValue) SetRaw(value string) FlowSnmpv2CVariableBindingStringValue { - obj.setChoice(FlowSnmpv2CVariableBindingStringValueChoice.RAW) - obj.obj.Raw = &value - return obj -} - -func (obj *flowSnmpv2CVariableBindingStringValue) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ascii != nil { - - if len(*obj.obj.Ascii) > 10000 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "None <= length of FlowSnmpv2CVariableBindingStringValue.Ascii <= 10000 but Got %d", - len(*obj.obj.Ascii))) - } - - } - - if obj.obj.Raw != nil { - - if len(*obj.obj.Raw) > 10000 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "None <= length of FlowSnmpv2CVariableBindingStringValue.Raw <= 10000 but Got %d", - len(*obj.obj.Raw))) - } - - } - -} - -func (obj *flowSnmpv2CVariableBindingStringValue) setDefault() { - var choices_set int = 0 - var choice FlowSnmpv2CVariableBindingStringValueChoiceEnum - - if obj.obj.Ascii != nil { - choices_set += 1 - choice = FlowSnmpv2CVariableBindingStringValueChoice.ASCII - } - - if obj.obj.Raw != nil { - choices_set += 1 - choice = FlowSnmpv2CVariableBindingStringValueChoice.RAW - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowSnmpv2CVariableBindingStringValueChoice.ASCII) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowSnmpv2CVariableBindingStringValue") - } - } else { - intVal := otg.FlowSnmpv2CVariableBindingStringValue_Choice_Enum_value[string(choice)] - enumValue := otg.FlowSnmpv2CVariableBindingStringValue_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowSnmpv2CVariableBindingValueIpAddressValue ***** -type patternFlowSnmpv2CVariableBindingValueIpAddressValue struct { - validation - obj *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue - marshaller marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue - unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue - incrementHolder PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - decrementHolder PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter -} - -func NewPatternFlowSnmpv2CVariableBindingValueIpAddressValue() PatternFlowSnmpv2CVariableBindingValueIpAddressValue { - obj := patternFlowSnmpv2CVariableBindingValueIpAddressValue{obj: &otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) msg() *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue { - return obj.obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue) PatternFlowSnmpv2CVariableBindingValueIpAddressValue { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue struct { - obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue -} - -type marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue interface { - // ToProto marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue - ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue, error) - // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue struct { - obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue -} - -type unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue interface { - // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue - FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue) (PatternFlowSnmpv2CVariableBindingValueIpAddressValue, error) - // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue) (PatternFlowSnmpv2CVariableBindingValueIpAddressValue, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Clone() (PatternFlowSnmpv2CVariableBindingValueIpAddressValue, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CVariableBindingValueIpAddressValue() - 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 -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowSnmpv2CVariableBindingValueIpAddressValue is iPv4 address returned for the requested OID. -type PatternFlowSnmpv2CVariableBindingValueIpAddressValue interface { - Validation - // msg marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue - // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue) PatternFlowSnmpv2CVariableBindingValueIpAddressValue - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue - // validate validates PatternFlowSnmpv2CVariableBindingValueIpAddressValue - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CVariableBindingValueIpAddressValue, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue - Choice() PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum - // setChoice assigns PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValue - setChoice(value PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueIpAddressValue - // HasChoice checks if Choice has been set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue - HasChoice() bool - // Value returns string, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue. - Value() string - // SetValue assigns string provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValue - SetValue(value string) PatternFlowSnmpv2CVariableBindingValueIpAddressValue - // HasValue checks if Value has been set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue - HasValue() bool - // Values returns []string, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue. - Values() []string - // SetValues assigns []string provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValue - SetValues(value []string) PatternFlowSnmpv2CVariableBindingValueIpAddressValue - // Increment returns PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue. - Increment() PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - // SetIncrement assigns PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValue. - SetIncrement(value PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) PatternFlowSnmpv2CVariableBindingValueIpAddressValue - // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue - HasIncrement() bool - // Decrement returns PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue. - Decrement() PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - // SetDecrement assigns PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValue. - SetDecrement(value PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) PatternFlowSnmpv2CVariableBindingValueIpAddressValue - // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue - HasDecrement() bool - setNil() -} - -type PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum string - -// Enum of Choice on PatternFlowSnmpv2CVariableBindingValueIpAddressValue -var PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice = struct { - VALUE PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum - VALUES PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum - INCREMENT PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum - DECREMENT PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum -}{ - VALUE: PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum("value"), - VALUES: PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum("values"), - INCREMENT: PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum("increment"), - DECREMENT: PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum("decrement"), -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Choice() PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum { - return PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) setChoice(value PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueIpAddressValue { - intValue, ok := otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUE { - defaultValue := "0.0.0.0" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUES { - defaultValue := []string{"0.0.0.0"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter().msg() - } - - if value == PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowSnmpv2CVariableBindingValueIpAddressValue object -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) SetValue(value string) PatternFlowSnmpv2CVariableBindingValueIpAddressValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"0.0.0.0"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowSnmpv2CVariableBindingValueIpAddressValue object -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) SetValues(value []string) PatternFlowSnmpv2CVariableBindingValueIpAddressValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Increment() PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter value in the PatternFlowSnmpv2CVariableBindingValueIpAddressValue object -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) SetIncrement(value PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) PatternFlowSnmpv2CVariableBindingValueIpAddressValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Decrement() PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter value in the PatternFlowSnmpv2CVariableBindingValueIpAddressValue object -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) SetDecrement(value PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) PatternFlowSnmpv2CVariableBindingValueIpAddressValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv4(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowSnmpv2CVariableBindingValueIpAddressValue.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateIpv4Slice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowSnmpv2CVariableBindingValueIpAddressValue.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) setDefault() { - var choices_set int = 0 - var choice PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CVariableBindingValueIpAddressValue") - } - } else { - intVal := otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowSnmpv2CVariableBindingValueCounterValue ***** -type patternFlowSnmpv2CVariableBindingValueCounterValue struct { - validation - obj *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue - marshaller marshalPatternFlowSnmpv2CVariableBindingValueCounterValue - unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValue - incrementHolder PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - decrementHolder PatternFlowSnmpv2CVariableBindingValueCounterValueCounter -} - -func NewPatternFlowSnmpv2CVariableBindingValueCounterValue() PatternFlowSnmpv2CVariableBindingValueCounterValue { - obj := patternFlowSnmpv2CVariableBindingValueCounterValue{obj: &otg.PatternFlowSnmpv2CVariableBindingValueCounterValue{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) msg() *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue { - return obj.obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue) PatternFlowSnmpv2CVariableBindingValueCounterValue { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CVariableBindingValueCounterValue struct { - obj *patternFlowSnmpv2CVariableBindingValueCounterValue -} - -type marshalPatternFlowSnmpv2CVariableBindingValueCounterValue interface { - // ToProto marshals PatternFlowSnmpv2CVariableBindingValueCounterValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue - ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueCounterValue, error) - // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueCounterValue to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueCounterValue to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CVariableBindingValueCounterValue to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValue struct { - obj *patternFlowSnmpv2CVariableBindingValueCounterValue -} - -type unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValue interface { - // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue - FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue) (PatternFlowSnmpv2CVariableBindingValueCounterValue, error) - // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValue from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValue from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValue from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueCounterValue { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueCounterValue{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValue { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValue{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueCounterValue) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueCounterValue, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValue) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue) (PatternFlowSnmpv2CVariableBindingValueCounterValue, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueCounterValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValue) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueCounterValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValue) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueCounterValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValue) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Clone() (PatternFlowSnmpv2CVariableBindingValueCounterValue, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CVariableBindingValueCounterValue() - 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 -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowSnmpv2CVariableBindingValueCounterValue is counter returned for the requested OID. -type PatternFlowSnmpv2CVariableBindingValueCounterValue interface { - Validation - // msg marshals PatternFlowSnmpv2CVariableBindingValueCounterValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue - // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueCounterValue) PatternFlowSnmpv2CVariableBindingValueCounterValue - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CVariableBindingValueCounterValue - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValue - // validate validates PatternFlowSnmpv2CVariableBindingValueCounterValue - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CVariableBindingValueCounterValue, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum, set in PatternFlowSnmpv2CVariableBindingValueCounterValue - Choice() PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum - // setChoice assigns PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValue - setChoice(value PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueCounterValue - // HasChoice checks if Choice has been set in PatternFlowSnmpv2CVariableBindingValueCounterValue - HasChoice() bool - // Value returns uint32, set in PatternFlowSnmpv2CVariableBindingValueCounterValue. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValue - SetValue(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValue - // HasValue checks if Value has been set in PatternFlowSnmpv2CVariableBindingValueCounterValue - HasValue() bool - // Values returns []uint32, set in PatternFlowSnmpv2CVariableBindingValueCounterValue. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValue - SetValues(value []uint32) PatternFlowSnmpv2CVariableBindingValueCounterValue - // Increment returns PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, set in PatternFlowSnmpv2CVariableBindingValueCounterValue. - Increment() PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - // SetIncrement assigns PatternFlowSnmpv2CVariableBindingValueCounterValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValue. - SetIncrement(value PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueCounterValue - // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CVariableBindingValueCounterValue - HasIncrement() bool - // Decrement returns PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, set in PatternFlowSnmpv2CVariableBindingValueCounterValue. - Decrement() PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - // SetDecrement assigns PatternFlowSnmpv2CVariableBindingValueCounterValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValue. - SetDecrement(value PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueCounterValue - // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CVariableBindingValueCounterValue - HasDecrement() bool - setNil() -} - -type PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum string - -// Enum of Choice on PatternFlowSnmpv2CVariableBindingValueCounterValue -var PatternFlowSnmpv2CVariableBindingValueCounterValueChoice = struct { - VALUE PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum - VALUES PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum - INCREMENT PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum - DECREMENT PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum -}{ - VALUE: PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum("value"), - VALUES: PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum("values"), - INCREMENT: PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum("increment"), - DECREMENT: PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum("decrement"), -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Choice() PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum { - return PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) setChoice(value PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueCounterValue { - intValue, ok := otg.PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowSnmpv2CVariableBindingValueCounterValueCounter().msg() - } - - if value == PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowSnmpv2CVariableBindingValueCounterValueCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueCounterValue object -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) SetValue(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowSnmpv2CVariableBindingValueCounterValue object -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) SetValues(value []uint32) PatternFlowSnmpv2CVariableBindingValueCounterValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CVariableBindingValueCounterValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Increment() PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowSnmpv2CVariableBindingValueCounterValueCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CVariableBindingValueCounterValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowSnmpv2CVariableBindingValueCounterValueCounter value in the PatternFlowSnmpv2CVariableBindingValueCounterValue object -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) SetIncrement(value PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueCounterValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CVariableBindingValueCounterValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Decrement() PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowSnmpv2CVariableBindingValueCounterValueCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CVariableBindingValueCounterValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowSnmpv2CVariableBindingValueCounterValueCounter value in the PatternFlowSnmpv2CVariableBindingValueCounterValue object -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) SetDecrement(value PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueCounterValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) setDefault() { - var choices_set int = 0 - var choice PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CVariableBindingValueCounterValue") - } - } else { - intVal := otg.PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowSnmpv2CVariableBindingValueTimeticksValue ***** -type patternFlowSnmpv2CVariableBindingValueTimeticksValue struct { - validation - obj *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue - marshaller marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue - unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue - incrementHolder PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - decrementHolder PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter -} - -func NewPatternFlowSnmpv2CVariableBindingValueTimeticksValue() PatternFlowSnmpv2CVariableBindingValueTimeticksValue { - obj := patternFlowSnmpv2CVariableBindingValueTimeticksValue{obj: &otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) msg() *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue { - return obj.obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue) PatternFlowSnmpv2CVariableBindingValueTimeticksValue { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue struct { - obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue -} - -type marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue interface { - // ToProto marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue - ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue, error) - // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue struct { - obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue -} - -type unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue interface { - // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue - FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue) (PatternFlowSnmpv2CVariableBindingValueTimeticksValue, error) - // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue) (PatternFlowSnmpv2CVariableBindingValueTimeticksValue, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Clone() (PatternFlowSnmpv2CVariableBindingValueTimeticksValue, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CVariableBindingValueTimeticksValue() - 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 -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowSnmpv2CVariableBindingValueTimeticksValue is timeticks returned for the requested OID. -type PatternFlowSnmpv2CVariableBindingValueTimeticksValue interface { - Validation - // msg marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue - // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue) PatternFlowSnmpv2CVariableBindingValueTimeticksValue - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue - // validate validates PatternFlowSnmpv2CVariableBindingValueTimeticksValue - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CVariableBindingValueTimeticksValue, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue - Choice() PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum - // setChoice assigns PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValue - setChoice(value PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueTimeticksValue - // HasChoice checks if Choice has been set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue - HasChoice() bool - // Value returns uint32, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValue - SetValue(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValue - // HasValue checks if Value has been set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue - HasValue() bool - // Values returns []uint32, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValue - SetValues(value []uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValue - // Increment returns PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue. - Increment() PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - // SetIncrement assigns PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValue. - SetIncrement(value PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) PatternFlowSnmpv2CVariableBindingValueTimeticksValue - // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue - HasIncrement() bool - // Decrement returns PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue. - Decrement() PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - // SetDecrement assigns PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValue. - SetDecrement(value PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) PatternFlowSnmpv2CVariableBindingValueTimeticksValue - // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue - HasDecrement() bool - setNil() -} - -type PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum string - -// Enum of Choice on PatternFlowSnmpv2CVariableBindingValueTimeticksValue -var PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice = struct { - VALUE PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum - VALUES PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum - INCREMENT PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum - DECREMENT PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum -}{ - VALUE: PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum("value"), - VALUES: PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum("values"), - INCREMENT: PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum("increment"), - DECREMENT: PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum("decrement"), -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Choice() PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum { - return PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) setChoice(value PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueTimeticksValue { - intValue, ok := otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter().msg() - } - - if value == PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueTimeticksValue object -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) SetValue(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowSnmpv2CVariableBindingValueTimeticksValue object -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) SetValues(value []uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Increment() PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter value in the PatternFlowSnmpv2CVariableBindingValueTimeticksValue object -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) SetIncrement(value PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) PatternFlowSnmpv2CVariableBindingValueTimeticksValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Decrement() PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter value in the PatternFlowSnmpv2CVariableBindingValueTimeticksValue object -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) SetDecrement(value PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) PatternFlowSnmpv2CVariableBindingValueTimeticksValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) setDefault() { - var choices_set int = 0 - var choice PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CVariableBindingValueTimeticksValue") - } - } else { - intVal := otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowSnmpv2CVariableBindingValueBigCounterValue ***** -type patternFlowSnmpv2CVariableBindingValueBigCounterValue struct { - validation - obj *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue - marshaller marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue - unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue - incrementHolder PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - decrementHolder PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter -} - -func NewPatternFlowSnmpv2CVariableBindingValueBigCounterValue() PatternFlowSnmpv2CVariableBindingValueBigCounterValue { - obj := patternFlowSnmpv2CVariableBindingValueBigCounterValue{obj: &otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) msg() *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue { - return obj.obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue) PatternFlowSnmpv2CVariableBindingValueBigCounterValue { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue struct { - obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue -} - -type marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue interface { - // ToProto marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue - ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue, error) - // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue struct { - obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue -} - -type unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue interface { - // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue - FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue) (PatternFlowSnmpv2CVariableBindingValueBigCounterValue, error) - // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue) (PatternFlowSnmpv2CVariableBindingValueBigCounterValue, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Clone() (PatternFlowSnmpv2CVariableBindingValueBigCounterValue, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CVariableBindingValueBigCounterValue() - 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 -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowSnmpv2CVariableBindingValueBigCounterValue is big counter returned for the requested OID. -type PatternFlowSnmpv2CVariableBindingValueBigCounterValue interface { - Validation - // msg marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue - // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue) PatternFlowSnmpv2CVariableBindingValueBigCounterValue - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue - // validate validates PatternFlowSnmpv2CVariableBindingValueBigCounterValue - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CVariableBindingValueBigCounterValue, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue - Choice() PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum - // setChoice assigns PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValue - setChoice(value PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueBigCounterValue - // HasChoice checks if Choice has been set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue - HasChoice() bool - // Value returns uint64, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue. - Value() uint64 - // SetValue assigns uint64 provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValue - SetValue(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValue - // HasValue checks if Value has been set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue - HasValue() bool - // Values returns []uint64, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue. - Values() []uint64 - // SetValues assigns []uint64 provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValue - SetValues(value []uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValue - // Increment returns PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue. - Increment() PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - // SetIncrement assigns PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValue. - SetIncrement(value PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueBigCounterValue - // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue - HasIncrement() bool - // Decrement returns PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue. - Decrement() PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - // SetDecrement assigns PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValue. - SetDecrement(value PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueBigCounterValue - // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue - HasDecrement() bool - setNil() -} - -type PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum string - -// Enum of Choice on PatternFlowSnmpv2CVariableBindingValueBigCounterValue -var PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice = struct { - VALUE PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum - VALUES PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum - INCREMENT PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum - DECREMENT PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum -}{ - VALUE: PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum("value"), - VALUES: PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum("values"), - INCREMENT: PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum("increment"), - DECREMENT: PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum("decrement"), -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Choice() PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum { - return PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) setChoice(value PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueBigCounterValue { - intValue, ok := otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUE { - defaultValue := uint64(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUES { - defaultValue := []uint64{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter().msg() - } - - if value == PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint64 -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Value() uint64 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint64 -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint64 value in the PatternFlowSnmpv2CVariableBindingValueBigCounterValue object -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) SetValue(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint64 -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Values() []uint64 { - if obj.obj.Values == nil { - obj.SetValues([]uint64{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint64 value in the PatternFlowSnmpv2CVariableBindingValueBigCounterValue object -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) SetValues(value []uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint64, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Increment() PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter value in the PatternFlowSnmpv2CVariableBindingValueBigCounterValue object -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) SetIncrement(value PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueBigCounterValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Decrement() PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter value in the PatternFlowSnmpv2CVariableBindingValueBigCounterValue object -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) SetDecrement(value PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueBigCounterValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) setDefault() { - var choices_set int = 0 - var choice PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CVariableBindingValueBigCounterValue") - } - } else { - intVal := otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue ***** -type patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue struct { - validation - obj *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - marshaller marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - incrementHolder PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - decrementHolder PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter -} - -func NewPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { - obj := patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue{obj: &otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) msg() *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { - return obj.obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue struct { - obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue -} - -type marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue interface { - // ToProto marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue, error) - // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue struct { - obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue -} - -type unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue interface { - // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue, error) - // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Clone() (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue() - 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 -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue is unsigned integer value returned for the requested OID. -type PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue interface { - Validation - // msg marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - // validate validates PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - Choice() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum - // setChoice assigns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - setChoice(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - // HasChoice checks if Choice has been set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - HasChoice() bool - // Value returns uint32, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - SetValue(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - // HasValue checks if Value has been set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - HasValue() bool - // Values returns []uint32, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - SetValues(value []uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - // Increment returns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue. - Increment() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - // SetIncrement assigns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue. - SetIncrement(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - HasIncrement() bool - // Decrement returns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue. - Decrement() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - // SetDecrement assigns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue. - SetDecrement(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue - HasDecrement() bool - setNil() -} - -type PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum string - -// Enum of Choice on PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue -var PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice = struct { - VALUE PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum - VALUES PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum - INCREMENT PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum - DECREMENT PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum -}{ - VALUE: PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum("value"), - VALUES: PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum("values"), - INCREMENT: PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum("increment"), - DECREMENT: PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum("decrement"), -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Choice() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum { - return PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) setChoice(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { - intValue, ok := otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter().msg() - } - - if value == PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue object -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) SetValue(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue object -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) SetValues(value []uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Increment() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter value in the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue object -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) SetIncrement(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Decrement() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter value in the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue object -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) SetDecrement(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) setDefault() { - var choices_set int = 0 - var choice PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue") - } - } else { - intVal := otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPPathObjectsClassSession ***** -type flowRSVPPathObjectsClassSession struct { - validation - obj *otg.FlowRSVPPathObjectsClassSession - marshaller marshalFlowRSVPPathObjectsClassSession - unMarshaller unMarshalFlowRSVPPathObjectsClassSession - lengthHolder FlowRSVPObjectLength - cTypeHolder FlowRSVPPathObjectsSessionCType -} - -func NewFlowRSVPPathObjectsClassSession() FlowRSVPPathObjectsClassSession { - obj := flowRSVPPathObjectsClassSession{obj: &otg.FlowRSVPPathObjectsClassSession{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsClassSession) msg() *otg.FlowRSVPPathObjectsClassSession { - return obj.obj -} - -func (obj *flowRSVPPathObjectsClassSession) setMsg(msg *otg.FlowRSVPPathObjectsClassSession) FlowRSVPPathObjectsClassSession { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsClassSession struct { - obj *flowRSVPPathObjectsClassSession -} - -type marshalFlowRSVPPathObjectsClassSession interface { - // ToProto marshals FlowRSVPPathObjectsClassSession to protobuf object *otg.FlowRSVPPathObjectsClassSession - ToProto() (*otg.FlowRSVPPathObjectsClassSession, error) - // ToPbText marshals FlowRSVPPathObjectsClassSession to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsClassSession to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsClassSession to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsClassSession struct { - obj *flowRSVPPathObjectsClassSession -} - -type unMarshalFlowRSVPPathObjectsClassSession interface { - // FromProto unmarshals FlowRSVPPathObjectsClassSession from protobuf object *otg.FlowRSVPPathObjectsClassSession - FromProto(msg *otg.FlowRSVPPathObjectsClassSession) (FlowRSVPPathObjectsClassSession, error) - // FromPbText unmarshals FlowRSVPPathObjectsClassSession from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsClassSession from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsClassSession from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsClassSession) Marshal() marshalFlowRSVPPathObjectsClassSession { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsClassSession{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsClassSession) Unmarshal() unMarshalFlowRSVPPathObjectsClassSession { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassSession{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsClassSession) ToProto() (*otg.FlowRSVPPathObjectsClassSession, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsClassSession) FromProto(msg *otg.FlowRSVPPathObjectsClassSession) (FlowRSVPPathObjectsClassSession, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsClassSession) 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 *unMarshalflowRSVPPathObjectsClassSession) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsClassSession) 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 *unMarshalflowRSVPPathObjectsClassSession) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsClassSession) 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 *unMarshalflowRSVPPathObjectsClassSession) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsClassSession) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassSession) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassSession) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsClassSession) Clone() (FlowRSVPPathObjectsClassSession, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsClassSession() - 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 -} - -func (obj *flowRSVPPathObjectsClassSession) setNil() { - obj.lengthHolder = nil - obj.cTypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsClassSession is c-Type is specific to a class num. -type FlowRSVPPathObjectsClassSession interface { - Validation - // msg marshals FlowRSVPPathObjectsClassSession to protobuf object *otg.FlowRSVPPathObjectsClassSession - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsClassSession - // setMsg unmarshals FlowRSVPPathObjectsClassSession from protobuf object *otg.FlowRSVPPathObjectsClassSession - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsClassSession) FlowRSVPPathObjectsClassSession - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsClassSession - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsClassSession - // validate validates FlowRSVPPathObjectsClassSession - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsClassSession, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassSession. - // FlowRSVPObjectLength is description is TBD - Length() FlowRSVPObjectLength - // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassSession. - // FlowRSVPObjectLength is description is TBD - SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSession - // HasLength checks if Length has been set in FlowRSVPPathObjectsClassSession - HasLength() bool - // CType returns FlowRSVPPathObjectsSessionCType, set in FlowRSVPPathObjectsClassSession. - // FlowRSVPPathObjectsSessionCType is the body of an object corresponding to the class number and c-type. Currently supported c-type for SESSION object is LSP Tunnel IPv4 (7). - CType() FlowRSVPPathObjectsSessionCType - // SetCType assigns FlowRSVPPathObjectsSessionCType provided by user to FlowRSVPPathObjectsClassSession. - // FlowRSVPPathObjectsSessionCType is the body of an object corresponding to the class number and c-type. Currently supported c-type for SESSION object is LSP Tunnel IPv4 (7). - SetCType(value FlowRSVPPathObjectsSessionCType) FlowRSVPPathObjectsClassSession - // HasCType checks if CType has been set in FlowRSVPPathObjectsClassSession - HasCType() bool - setNil() -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassSession) Length() FlowRSVPObjectLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowRSVPObjectLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassSession) HasLength() bool { - return obj.obj.Length != nil -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassSession object -func (obj *flowRSVPPathObjectsClassSession) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSession { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsSessionCType -func (obj *flowRSVPPathObjectsClassSession) CType() FlowRSVPPathObjectsSessionCType { - if obj.obj.CType == nil { - obj.obj.CType = NewFlowRSVPPathObjectsSessionCType().msg() - } - if obj.cTypeHolder == nil { - obj.cTypeHolder = &flowRSVPPathObjectsSessionCType{obj: obj.obj.CType} - } - return obj.cTypeHolder -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsSessionCType -func (obj *flowRSVPPathObjectsClassSession) HasCType() bool { - return obj.obj.CType != nil -} - -// description is TBD -// SetCType sets the FlowRSVPPathObjectsSessionCType value in the FlowRSVPPathObjectsClassSession object -func (obj *flowRSVPPathObjectsClassSession) SetCType(value FlowRSVPPathObjectsSessionCType) FlowRSVPPathObjectsClassSession { - - obj.cTypeHolder = nil - obj.obj.CType = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsClassSession) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.CType != nil { - - obj.CType().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsClassSession) setDefault() { - -} - -// ***** FlowRSVPPathObjectsClassRsvpHop ***** -type flowRSVPPathObjectsClassRsvpHop struct { - validation - obj *otg.FlowRSVPPathObjectsClassRsvpHop - marshaller marshalFlowRSVPPathObjectsClassRsvpHop - unMarshaller unMarshalFlowRSVPPathObjectsClassRsvpHop - lengthHolder FlowRSVPObjectLength - cTypeHolder FlowRSVPPathObjectsRsvpHopCType -} - -func NewFlowRSVPPathObjectsClassRsvpHop() FlowRSVPPathObjectsClassRsvpHop { - obj := flowRSVPPathObjectsClassRsvpHop{obj: &otg.FlowRSVPPathObjectsClassRsvpHop{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsClassRsvpHop) msg() *otg.FlowRSVPPathObjectsClassRsvpHop { - return obj.obj -} - -func (obj *flowRSVPPathObjectsClassRsvpHop) setMsg(msg *otg.FlowRSVPPathObjectsClassRsvpHop) FlowRSVPPathObjectsClassRsvpHop { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsClassRsvpHop struct { - obj *flowRSVPPathObjectsClassRsvpHop -} - -type marshalFlowRSVPPathObjectsClassRsvpHop interface { - // ToProto marshals FlowRSVPPathObjectsClassRsvpHop to protobuf object *otg.FlowRSVPPathObjectsClassRsvpHop - ToProto() (*otg.FlowRSVPPathObjectsClassRsvpHop, error) - // ToPbText marshals FlowRSVPPathObjectsClassRsvpHop to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsClassRsvpHop to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsClassRsvpHop to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsClassRsvpHop struct { - obj *flowRSVPPathObjectsClassRsvpHop -} - -type unMarshalFlowRSVPPathObjectsClassRsvpHop interface { - // FromProto unmarshals FlowRSVPPathObjectsClassRsvpHop from protobuf object *otg.FlowRSVPPathObjectsClassRsvpHop - FromProto(msg *otg.FlowRSVPPathObjectsClassRsvpHop) (FlowRSVPPathObjectsClassRsvpHop, error) - // FromPbText unmarshals FlowRSVPPathObjectsClassRsvpHop from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsClassRsvpHop from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsClassRsvpHop from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsClassRsvpHop) Marshal() marshalFlowRSVPPathObjectsClassRsvpHop { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsClassRsvpHop{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsClassRsvpHop) Unmarshal() unMarshalFlowRSVPPathObjectsClassRsvpHop { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassRsvpHop{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsClassRsvpHop) ToProto() (*otg.FlowRSVPPathObjectsClassRsvpHop, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsClassRsvpHop) FromProto(msg *otg.FlowRSVPPathObjectsClassRsvpHop) (FlowRSVPPathObjectsClassRsvpHop, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsClassRsvpHop) 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 *unMarshalflowRSVPPathObjectsClassRsvpHop) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsClassRsvpHop) 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 *unMarshalflowRSVPPathObjectsClassRsvpHop) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsClassRsvpHop) 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 *unMarshalflowRSVPPathObjectsClassRsvpHop) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsClassRsvpHop) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassRsvpHop) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassRsvpHop) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsClassRsvpHop) Clone() (FlowRSVPPathObjectsClassRsvpHop, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsClassRsvpHop() - 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 -} - -func (obj *flowRSVPPathObjectsClassRsvpHop) setNil() { - obj.lengthHolder = nil - obj.cTypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsClassRsvpHop is c-Type is specific to a class num. -type FlowRSVPPathObjectsClassRsvpHop interface { - Validation - // msg marshals FlowRSVPPathObjectsClassRsvpHop to protobuf object *otg.FlowRSVPPathObjectsClassRsvpHop - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsClassRsvpHop - // setMsg unmarshals FlowRSVPPathObjectsClassRsvpHop from protobuf object *otg.FlowRSVPPathObjectsClassRsvpHop - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsClassRsvpHop) FlowRSVPPathObjectsClassRsvpHop - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsClassRsvpHop - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsClassRsvpHop - // validate validates FlowRSVPPathObjectsClassRsvpHop - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsClassRsvpHop, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassRsvpHop. - // FlowRSVPObjectLength is description is TBD - Length() FlowRSVPObjectLength - // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassRsvpHop. - // FlowRSVPObjectLength is description is TBD - SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassRsvpHop - // HasLength checks if Length has been set in FlowRSVPPathObjectsClassRsvpHop - HasLength() bool - // CType returns FlowRSVPPathObjectsRsvpHopCType, set in FlowRSVPPathObjectsClassRsvpHop. - // FlowRSVPPathObjectsRsvpHopCType is object for RSVP_HOP class. Currently supported c-type is IPv4 (1). - CType() FlowRSVPPathObjectsRsvpHopCType - // SetCType assigns FlowRSVPPathObjectsRsvpHopCType provided by user to FlowRSVPPathObjectsClassRsvpHop. - // FlowRSVPPathObjectsRsvpHopCType is object for RSVP_HOP class. Currently supported c-type is IPv4 (1). - SetCType(value FlowRSVPPathObjectsRsvpHopCType) FlowRSVPPathObjectsClassRsvpHop - // HasCType checks if CType has been set in FlowRSVPPathObjectsClassRsvpHop - HasCType() bool - setNil() -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassRsvpHop) Length() FlowRSVPObjectLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowRSVPObjectLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassRsvpHop) HasLength() bool { - return obj.obj.Length != nil -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassRsvpHop object -func (obj *flowRSVPPathObjectsClassRsvpHop) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassRsvpHop { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsRsvpHopCType -func (obj *flowRSVPPathObjectsClassRsvpHop) CType() FlowRSVPPathObjectsRsvpHopCType { - if obj.obj.CType == nil { - obj.obj.CType = NewFlowRSVPPathObjectsRsvpHopCType().msg() - } - if obj.cTypeHolder == nil { - obj.cTypeHolder = &flowRSVPPathObjectsRsvpHopCType{obj: obj.obj.CType} - } - return obj.cTypeHolder -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsRsvpHopCType -func (obj *flowRSVPPathObjectsClassRsvpHop) HasCType() bool { - return obj.obj.CType != nil -} - -// description is TBD -// SetCType sets the FlowRSVPPathObjectsRsvpHopCType value in the FlowRSVPPathObjectsClassRsvpHop object -func (obj *flowRSVPPathObjectsClassRsvpHop) SetCType(value FlowRSVPPathObjectsRsvpHopCType) FlowRSVPPathObjectsClassRsvpHop { - - obj.cTypeHolder = nil - obj.obj.CType = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsClassRsvpHop) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.CType != nil { - - obj.CType().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsClassRsvpHop) setDefault() { - -} - -// ***** FlowRSVPPathObjectsClassTimeValues ***** -type flowRSVPPathObjectsClassTimeValues struct { - validation - obj *otg.FlowRSVPPathObjectsClassTimeValues - marshaller marshalFlowRSVPPathObjectsClassTimeValues - unMarshaller unMarshalFlowRSVPPathObjectsClassTimeValues - lengthHolder FlowRSVPObjectLength - cTypeHolder FlowRSVPPathObjectsTimeValuesCType -} - -func NewFlowRSVPPathObjectsClassTimeValues() FlowRSVPPathObjectsClassTimeValues { - obj := flowRSVPPathObjectsClassTimeValues{obj: &otg.FlowRSVPPathObjectsClassTimeValues{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsClassTimeValues) msg() *otg.FlowRSVPPathObjectsClassTimeValues { - return obj.obj -} - -func (obj *flowRSVPPathObjectsClassTimeValues) setMsg(msg *otg.FlowRSVPPathObjectsClassTimeValues) FlowRSVPPathObjectsClassTimeValues { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsClassTimeValues struct { - obj *flowRSVPPathObjectsClassTimeValues -} - -type marshalFlowRSVPPathObjectsClassTimeValues interface { - // ToProto marshals FlowRSVPPathObjectsClassTimeValues to protobuf object *otg.FlowRSVPPathObjectsClassTimeValues - ToProto() (*otg.FlowRSVPPathObjectsClassTimeValues, error) - // ToPbText marshals FlowRSVPPathObjectsClassTimeValues to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsClassTimeValues to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsClassTimeValues to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsClassTimeValues struct { - obj *flowRSVPPathObjectsClassTimeValues -} - -type unMarshalFlowRSVPPathObjectsClassTimeValues interface { - // FromProto unmarshals FlowRSVPPathObjectsClassTimeValues from protobuf object *otg.FlowRSVPPathObjectsClassTimeValues - FromProto(msg *otg.FlowRSVPPathObjectsClassTimeValues) (FlowRSVPPathObjectsClassTimeValues, error) - // FromPbText unmarshals FlowRSVPPathObjectsClassTimeValues from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsClassTimeValues from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsClassTimeValues from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsClassTimeValues) Marshal() marshalFlowRSVPPathObjectsClassTimeValues { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsClassTimeValues{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsClassTimeValues) Unmarshal() unMarshalFlowRSVPPathObjectsClassTimeValues { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassTimeValues{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsClassTimeValues) ToProto() (*otg.FlowRSVPPathObjectsClassTimeValues, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsClassTimeValues) FromProto(msg *otg.FlowRSVPPathObjectsClassTimeValues) (FlowRSVPPathObjectsClassTimeValues, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsClassTimeValues) 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 *unMarshalflowRSVPPathObjectsClassTimeValues) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsClassTimeValues) 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 *unMarshalflowRSVPPathObjectsClassTimeValues) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsClassTimeValues) 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 *unMarshalflowRSVPPathObjectsClassTimeValues) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsClassTimeValues) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassTimeValues) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassTimeValues) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsClassTimeValues) Clone() (FlowRSVPPathObjectsClassTimeValues, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsClassTimeValues() - 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 -} - -func (obj *flowRSVPPathObjectsClassTimeValues) setNil() { - obj.lengthHolder = nil - obj.cTypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsClassTimeValues is c-Type is specific to a class num. -type FlowRSVPPathObjectsClassTimeValues interface { - Validation - // msg marshals FlowRSVPPathObjectsClassTimeValues to protobuf object *otg.FlowRSVPPathObjectsClassTimeValues - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsClassTimeValues - // setMsg unmarshals FlowRSVPPathObjectsClassTimeValues from protobuf object *otg.FlowRSVPPathObjectsClassTimeValues - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsClassTimeValues) FlowRSVPPathObjectsClassTimeValues - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsClassTimeValues - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsClassTimeValues - // validate validates FlowRSVPPathObjectsClassTimeValues - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsClassTimeValues, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassTimeValues. - // FlowRSVPObjectLength is description is TBD - Length() FlowRSVPObjectLength - // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassTimeValues. - // FlowRSVPObjectLength is description is TBD - SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassTimeValues - // HasLength checks if Length has been set in FlowRSVPPathObjectsClassTimeValues - HasLength() bool - // CType returns FlowRSVPPathObjectsTimeValuesCType, set in FlowRSVPPathObjectsClassTimeValues. - // FlowRSVPPathObjectsTimeValuesCType is object for TIME_VALUES class. Currently supported c-type is Type 1 Time Value (1). - CType() FlowRSVPPathObjectsTimeValuesCType - // SetCType assigns FlowRSVPPathObjectsTimeValuesCType provided by user to FlowRSVPPathObjectsClassTimeValues. - // FlowRSVPPathObjectsTimeValuesCType is object for TIME_VALUES class. Currently supported c-type is Type 1 Time Value (1). - SetCType(value FlowRSVPPathObjectsTimeValuesCType) FlowRSVPPathObjectsClassTimeValues - // HasCType checks if CType has been set in FlowRSVPPathObjectsClassTimeValues - HasCType() bool - setNil() -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassTimeValues) Length() FlowRSVPObjectLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowRSVPObjectLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassTimeValues) HasLength() bool { - return obj.obj.Length != nil -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassTimeValues object -func (obj *flowRSVPPathObjectsClassTimeValues) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassTimeValues { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsTimeValuesCType -func (obj *flowRSVPPathObjectsClassTimeValues) CType() FlowRSVPPathObjectsTimeValuesCType { - if obj.obj.CType == nil { - obj.obj.CType = NewFlowRSVPPathObjectsTimeValuesCType().msg() - } - if obj.cTypeHolder == nil { - obj.cTypeHolder = &flowRSVPPathObjectsTimeValuesCType{obj: obj.obj.CType} - } - return obj.cTypeHolder -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsTimeValuesCType -func (obj *flowRSVPPathObjectsClassTimeValues) HasCType() bool { - return obj.obj.CType != nil -} - -// description is TBD -// SetCType sets the FlowRSVPPathObjectsTimeValuesCType value in the FlowRSVPPathObjectsClassTimeValues object -func (obj *flowRSVPPathObjectsClassTimeValues) SetCType(value FlowRSVPPathObjectsTimeValuesCType) FlowRSVPPathObjectsClassTimeValues { - - obj.cTypeHolder = nil - obj.obj.CType = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsClassTimeValues) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.CType != nil { - - obj.CType().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsClassTimeValues) setDefault() { - -} - -// ***** FlowRSVPPathObjectsClassExplicitRoute ***** -type flowRSVPPathObjectsClassExplicitRoute struct { - validation - obj *otg.FlowRSVPPathObjectsClassExplicitRoute - marshaller marshalFlowRSVPPathObjectsClassExplicitRoute - unMarshaller unMarshalFlowRSVPPathObjectsClassExplicitRoute - lengthHolder FlowRSVPObjectLength - cTypeHolder FlowRSVPPathObjectsClassExplicitRouteCType -} - -func NewFlowRSVPPathObjectsClassExplicitRoute() FlowRSVPPathObjectsClassExplicitRoute { - obj := flowRSVPPathObjectsClassExplicitRoute{obj: &otg.FlowRSVPPathObjectsClassExplicitRoute{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsClassExplicitRoute) msg() *otg.FlowRSVPPathObjectsClassExplicitRoute { - return obj.obj -} - -func (obj *flowRSVPPathObjectsClassExplicitRoute) setMsg(msg *otg.FlowRSVPPathObjectsClassExplicitRoute) FlowRSVPPathObjectsClassExplicitRoute { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsClassExplicitRoute struct { - obj *flowRSVPPathObjectsClassExplicitRoute -} - -type marshalFlowRSVPPathObjectsClassExplicitRoute interface { - // ToProto marshals FlowRSVPPathObjectsClassExplicitRoute to protobuf object *otg.FlowRSVPPathObjectsClassExplicitRoute - ToProto() (*otg.FlowRSVPPathObjectsClassExplicitRoute, error) - // ToPbText marshals FlowRSVPPathObjectsClassExplicitRoute to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsClassExplicitRoute to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsClassExplicitRoute to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsClassExplicitRoute struct { - obj *flowRSVPPathObjectsClassExplicitRoute -} - -type unMarshalFlowRSVPPathObjectsClassExplicitRoute interface { - // FromProto unmarshals FlowRSVPPathObjectsClassExplicitRoute from protobuf object *otg.FlowRSVPPathObjectsClassExplicitRoute - FromProto(msg *otg.FlowRSVPPathObjectsClassExplicitRoute) (FlowRSVPPathObjectsClassExplicitRoute, error) - // FromPbText unmarshals FlowRSVPPathObjectsClassExplicitRoute from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsClassExplicitRoute from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsClassExplicitRoute from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsClassExplicitRoute) Marshal() marshalFlowRSVPPathObjectsClassExplicitRoute { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsClassExplicitRoute{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsClassExplicitRoute) Unmarshal() unMarshalFlowRSVPPathObjectsClassExplicitRoute { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassExplicitRoute{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsClassExplicitRoute) ToProto() (*otg.FlowRSVPPathObjectsClassExplicitRoute, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsClassExplicitRoute) FromProto(msg *otg.FlowRSVPPathObjectsClassExplicitRoute) (FlowRSVPPathObjectsClassExplicitRoute, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsClassExplicitRoute) 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 *unMarshalflowRSVPPathObjectsClassExplicitRoute) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsClassExplicitRoute) 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 *unMarshalflowRSVPPathObjectsClassExplicitRoute) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsClassExplicitRoute) 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 *unMarshalflowRSVPPathObjectsClassExplicitRoute) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsClassExplicitRoute) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassExplicitRoute) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassExplicitRoute) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsClassExplicitRoute) Clone() (FlowRSVPPathObjectsClassExplicitRoute, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsClassExplicitRoute() - 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 -} - -func (obj *flowRSVPPathObjectsClassExplicitRoute) setNil() { - obj.lengthHolder = nil - obj.cTypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsClassExplicitRoute is c-Type is specific to a class num. -type FlowRSVPPathObjectsClassExplicitRoute interface { - Validation - // msg marshals FlowRSVPPathObjectsClassExplicitRoute to protobuf object *otg.FlowRSVPPathObjectsClassExplicitRoute - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsClassExplicitRoute - // setMsg unmarshals FlowRSVPPathObjectsClassExplicitRoute from protobuf object *otg.FlowRSVPPathObjectsClassExplicitRoute - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsClassExplicitRoute) FlowRSVPPathObjectsClassExplicitRoute - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsClassExplicitRoute - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsClassExplicitRoute - // validate validates FlowRSVPPathObjectsClassExplicitRoute - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsClassExplicitRoute, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassExplicitRoute. - // FlowRSVPObjectLength is description is TBD - Length() FlowRSVPObjectLength - // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassExplicitRoute. - // FlowRSVPObjectLength is description is TBD - SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassExplicitRoute - // HasLength checks if Length has been set in FlowRSVPPathObjectsClassExplicitRoute - HasLength() bool - // CType returns FlowRSVPPathObjectsClassExplicitRouteCType, set in FlowRSVPPathObjectsClassExplicitRoute. - // FlowRSVPPathObjectsClassExplicitRouteCType is object for EXPLICIT_ROUTE class and c-type is Type 1 Explicit Route (1). - CType() FlowRSVPPathObjectsClassExplicitRouteCType - // SetCType assigns FlowRSVPPathObjectsClassExplicitRouteCType provided by user to FlowRSVPPathObjectsClassExplicitRoute. - // FlowRSVPPathObjectsClassExplicitRouteCType is object for EXPLICIT_ROUTE class and c-type is Type 1 Explicit Route (1). - SetCType(value FlowRSVPPathObjectsClassExplicitRouteCType) FlowRSVPPathObjectsClassExplicitRoute - // HasCType checks if CType has been set in FlowRSVPPathObjectsClassExplicitRoute - HasCType() bool - setNil() -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassExplicitRoute) Length() FlowRSVPObjectLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowRSVPObjectLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassExplicitRoute) HasLength() bool { - return obj.obj.Length != nil -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassExplicitRoute object -func (obj *flowRSVPPathObjectsClassExplicitRoute) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassExplicitRoute { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsClassExplicitRouteCType -func (obj *flowRSVPPathObjectsClassExplicitRoute) CType() FlowRSVPPathObjectsClassExplicitRouteCType { - if obj.obj.CType == nil { - obj.obj.CType = NewFlowRSVPPathObjectsClassExplicitRouteCType().msg() - } - if obj.cTypeHolder == nil { - obj.cTypeHolder = &flowRSVPPathObjectsClassExplicitRouteCType{obj: obj.obj.CType} - } - return obj.cTypeHolder -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsClassExplicitRouteCType -func (obj *flowRSVPPathObjectsClassExplicitRoute) HasCType() bool { - return obj.obj.CType != nil -} - -// description is TBD -// SetCType sets the FlowRSVPPathObjectsClassExplicitRouteCType value in the FlowRSVPPathObjectsClassExplicitRoute object -func (obj *flowRSVPPathObjectsClassExplicitRoute) SetCType(value FlowRSVPPathObjectsClassExplicitRouteCType) FlowRSVPPathObjectsClassExplicitRoute { - - obj.cTypeHolder = nil - obj.obj.CType = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsClassExplicitRoute) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.CType != nil { - - obj.CType().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsClassExplicitRoute) setDefault() { - -} - -// ***** FlowRSVPPathObjectsClassLabelRequest ***** -type flowRSVPPathObjectsClassLabelRequest struct { - validation - obj *otg.FlowRSVPPathObjectsClassLabelRequest - marshaller marshalFlowRSVPPathObjectsClassLabelRequest - unMarshaller unMarshalFlowRSVPPathObjectsClassLabelRequest - lengthHolder FlowRSVPObjectLength - cTypeHolder FlowRSVPPathObjectsLabelRequestCType -} - -func NewFlowRSVPPathObjectsClassLabelRequest() FlowRSVPPathObjectsClassLabelRequest { - obj := flowRSVPPathObjectsClassLabelRequest{obj: &otg.FlowRSVPPathObjectsClassLabelRequest{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsClassLabelRequest) msg() *otg.FlowRSVPPathObjectsClassLabelRequest { - return obj.obj -} - -func (obj *flowRSVPPathObjectsClassLabelRequest) setMsg(msg *otg.FlowRSVPPathObjectsClassLabelRequest) FlowRSVPPathObjectsClassLabelRequest { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsClassLabelRequest struct { - obj *flowRSVPPathObjectsClassLabelRequest -} - -type marshalFlowRSVPPathObjectsClassLabelRequest interface { - // ToProto marshals FlowRSVPPathObjectsClassLabelRequest to protobuf object *otg.FlowRSVPPathObjectsClassLabelRequest - ToProto() (*otg.FlowRSVPPathObjectsClassLabelRequest, error) - // ToPbText marshals FlowRSVPPathObjectsClassLabelRequest to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsClassLabelRequest to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsClassLabelRequest to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsClassLabelRequest struct { - obj *flowRSVPPathObjectsClassLabelRequest -} - -type unMarshalFlowRSVPPathObjectsClassLabelRequest interface { - // FromProto unmarshals FlowRSVPPathObjectsClassLabelRequest from protobuf object *otg.FlowRSVPPathObjectsClassLabelRequest - FromProto(msg *otg.FlowRSVPPathObjectsClassLabelRequest) (FlowRSVPPathObjectsClassLabelRequest, error) - // FromPbText unmarshals FlowRSVPPathObjectsClassLabelRequest from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsClassLabelRequest from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsClassLabelRequest from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsClassLabelRequest) Marshal() marshalFlowRSVPPathObjectsClassLabelRequest { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsClassLabelRequest{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsClassLabelRequest) Unmarshal() unMarshalFlowRSVPPathObjectsClassLabelRequest { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassLabelRequest{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsClassLabelRequest) ToProto() (*otg.FlowRSVPPathObjectsClassLabelRequest, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsClassLabelRequest) FromProto(msg *otg.FlowRSVPPathObjectsClassLabelRequest) (FlowRSVPPathObjectsClassLabelRequest, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsClassLabelRequest) 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 *unMarshalflowRSVPPathObjectsClassLabelRequest) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsClassLabelRequest) 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 *unMarshalflowRSVPPathObjectsClassLabelRequest) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsClassLabelRequest) 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 *unMarshalflowRSVPPathObjectsClassLabelRequest) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsClassLabelRequest) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassLabelRequest) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassLabelRequest) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsClassLabelRequest) Clone() (FlowRSVPPathObjectsClassLabelRequest, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsClassLabelRequest() - 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 -} - -func (obj *flowRSVPPathObjectsClassLabelRequest) setNil() { - obj.lengthHolder = nil - obj.cTypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsClassLabelRequest is c-Type is specific to a class num. -type FlowRSVPPathObjectsClassLabelRequest interface { - Validation - // msg marshals FlowRSVPPathObjectsClassLabelRequest to protobuf object *otg.FlowRSVPPathObjectsClassLabelRequest - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsClassLabelRequest - // setMsg unmarshals FlowRSVPPathObjectsClassLabelRequest from protobuf object *otg.FlowRSVPPathObjectsClassLabelRequest - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsClassLabelRequest) FlowRSVPPathObjectsClassLabelRequest - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsClassLabelRequest - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsClassLabelRequest - // validate validates FlowRSVPPathObjectsClassLabelRequest - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsClassLabelRequest, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassLabelRequest. - // FlowRSVPObjectLength is description is TBD - Length() FlowRSVPObjectLength - // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassLabelRequest. - // FlowRSVPObjectLength is description is TBD - SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassLabelRequest - // HasLength checks if Length has been set in FlowRSVPPathObjectsClassLabelRequest - HasLength() bool - // CType returns FlowRSVPPathObjectsLabelRequestCType, set in FlowRSVPPathObjectsClassLabelRequest. - // FlowRSVPPathObjectsLabelRequestCType is object for LABEL_REQUEST class. Currently supported c-type is Without Label Range (1). - CType() FlowRSVPPathObjectsLabelRequestCType - // SetCType assigns FlowRSVPPathObjectsLabelRequestCType provided by user to FlowRSVPPathObjectsClassLabelRequest. - // FlowRSVPPathObjectsLabelRequestCType is object for LABEL_REQUEST class. Currently supported c-type is Without Label Range (1). - SetCType(value FlowRSVPPathObjectsLabelRequestCType) FlowRSVPPathObjectsClassLabelRequest - // HasCType checks if CType has been set in FlowRSVPPathObjectsClassLabelRequest - HasCType() bool - setNil() -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassLabelRequest) Length() FlowRSVPObjectLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowRSVPObjectLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassLabelRequest) HasLength() bool { - return obj.obj.Length != nil -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassLabelRequest object -func (obj *flowRSVPPathObjectsClassLabelRequest) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassLabelRequest { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsLabelRequestCType -func (obj *flowRSVPPathObjectsClassLabelRequest) CType() FlowRSVPPathObjectsLabelRequestCType { - if obj.obj.CType == nil { - obj.obj.CType = NewFlowRSVPPathObjectsLabelRequestCType().msg() - } - if obj.cTypeHolder == nil { - obj.cTypeHolder = &flowRSVPPathObjectsLabelRequestCType{obj: obj.obj.CType} - } - return obj.cTypeHolder -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsLabelRequestCType -func (obj *flowRSVPPathObjectsClassLabelRequest) HasCType() bool { - return obj.obj.CType != nil -} - -// description is TBD -// SetCType sets the FlowRSVPPathObjectsLabelRequestCType value in the FlowRSVPPathObjectsClassLabelRequest object -func (obj *flowRSVPPathObjectsClassLabelRequest) SetCType(value FlowRSVPPathObjectsLabelRequestCType) FlowRSVPPathObjectsClassLabelRequest { - - obj.cTypeHolder = nil - obj.obj.CType = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsClassLabelRequest) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.CType != nil { - - obj.CType().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsClassLabelRequest) setDefault() { - -} - -// ***** FlowRSVPPathObjectsClassSessionAttribute ***** -type flowRSVPPathObjectsClassSessionAttribute struct { - validation - obj *otg.FlowRSVPPathObjectsClassSessionAttribute - marshaller marshalFlowRSVPPathObjectsClassSessionAttribute - unMarshaller unMarshalFlowRSVPPathObjectsClassSessionAttribute - lengthHolder FlowRSVPObjectLength - cTypeHolder FlowRSVPPathObjectsSessionAttributeCType -} - -func NewFlowRSVPPathObjectsClassSessionAttribute() FlowRSVPPathObjectsClassSessionAttribute { - obj := flowRSVPPathObjectsClassSessionAttribute{obj: &otg.FlowRSVPPathObjectsClassSessionAttribute{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsClassSessionAttribute) msg() *otg.FlowRSVPPathObjectsClassSessionAttribute { - return obj.obj -} - -func (obj *flowRSVPPathObjectsClassSessionAttribute) setMsg(msg *otg.FlowRSVPPathObjectsClassSessionAttribute) FlowRSVPPathObjectsClassSessionAttribute { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsClassSessionAttribute struct { - obj *flowRSVPPathObjectsClassSessionAttribute -} - -type marshalFlowRSVPPathObjectsClassSessionAttribute interface { - // ToProto marshals FlowRSVPPathObjectsClassSessionAttribute to protobuf object *otg.FlowRSVPPathObjectsClassSessionAttribute - ToProto() (*otg.FlowRSVPPathObjectsClassSessionAttribute, error) - // ToPbText marshals FlowRSVPPathObjectsClassSessionAttribute to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsClassSessionAttribute to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsClassSessionAttribute to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsClassSessionAttribute struct { - obj *flowRSVPPathObjectsClassSessionAttribute -} - -type unMarshalFlowRSVPPathObjectsClassSessionAttribute interface { - // FromProto unmarshals FlowRSVPPathObjectsClassSessionAttribute from protobuf object *otg.FlowRSVPPathObjectsClassSessionAttribute - FromProto(msg *otg.FlowRSVPPathObjectsClassSessionAttribute) (FlowRSVPPathObjectsClassSessionAttribute, error) - // FromPbText unmarshals FlowRSVPPathObjectsClassSessionAttribute from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsClassSessionAttribute from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsClassSessionAttribute from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsClassSessionAttribute) Marshal() marshalFlowRSVPPathObjectsClassSessionAttribute { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsClassSessionAttribute{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsClassSessionAttribute) Unmarshal() unMarshalFlowRSVPPathObjectsClassSessionAttribute { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassSessionAttribute{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsClassSessionAttribute) ToProto() (*otg.FlowRSVPPathObjectsClassSessionAttribute, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsClassSessionAttribute) FromProto(msg *otg.FlowRSVPPathObjectsClassSessionAttribute) (FlowRSVPPathObjectsClassSessionAttribute, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsClassSessionAttribute) 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 *unMarshalflowRSVPPathObjectsClassSessionAttribute) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsClassSessionAttribute) 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 *unMarshalflowRSVPPathObjectsClassSessionAttribute) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsClassSessionAttribute) 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 *unMarshalflowRSVPPathObjectsClassSessionAttribute) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsClassSessionAttribute) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassSessionAttribute) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassSessionAttribute) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsClassSessionAttribute) Clone() (FlowRSVPPathObjectsClassSessionAttribute, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsClassSessionAttribute() - 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 -} - -func (obj *flowRSVPPathObjectsClassSessionAttribute) setNil() { - obj.lengthHolder = nil - obj.cTypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsClassSessionAttribute is c-Type is specific to a class num. -type FlowRSVPPathObjectsClassSessionAttribute interface { - Validation - // msg marshals FlowRSVPPathObjectsClassSessionAttribute to protobuf object *otg.FlowRSVPPathObjectsClassSessionAttribute - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsClassSessionAttribute - // setMsg unmarshals FlowRSVPPathObjectsClassSessionAttribute from protobuf object *otg.FlowRSVPPathObjectsClassSessionAttribute - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsClassSessionAttribute) FlowRSVPPathObjectsClassSessionAttribute - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsClassSessionAttribute - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsClassSessionAttribute - // validate validates FlowRSVPPathObjectsClassSessionAttribute - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsClassSessionAttribute, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassSessionAttribute. - // FlowRSVPObjectLength is description is TBD - Length() FlowRSVPObjectLength - // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassSessionAttribute. - // FlowRSVPObjectLength is description is TBD - SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSessionAttribute - // HasLength checks if Length has been set in FlowRSVPPathObjectsClassSessionAttribute - HasLength() bool - // CType returns FlowRSVPPathObjectsSessionAttributeCType, set in FlowRSVPPathObjectsClassSessionAttribute. - // FlowRSVPPathObjectsSessionAttributeCType is object for SESSION_ATTRIBUTE class. Currently supported c-type is LSP_Tunnel_RA (1) and LSP_Tunnel (7). - CType() FlowRSVPPathObjectsSessionAttributeCType - // SetCType assigns FlowRSVPPathObjectsSessionAttributeCType provided by user to FlowRSVPPathObjectsClassSessionAttribute. - // FlowRSVPPathObjectsSessionAttributeCType is object for SESSION_ATTRIBUTE class. Currently supported c-type is LSP_Tunnel_RA (1) and LSP_Tunnel (7). - SetCType(value FlowRSVPPathObjectsSessionAttributeCType) FlowRSVPPathObjectsClassSessionAttribute - // HasCType checks if CType has been set in FlowRSVPPathObjectsClassSessionAttribute - HasCType() bool - setNil() -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassSessionAttribute) Length() FlowRSVPObjectLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowRSVPObjectLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassSessionAttribute) HasLength() bool { - return obj.obj.Length != nil -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassSessionAttribute object -func (obj *flowRSVPPathObjectsClassSessionAttribute) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSessionAttribute { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsSessionAttributeCType -func (obj *flowRSVPPathObjectsClassSessionAttribute) CType() FlowRSVPPathObjectsSessionAttributeCType { - if obj.obj.CType == nil { - obj.obj.CType = NewFlowRSVPPathObjectsSessionAttributeCType().msg() - } - if obj.cTypeHolder == nil { - obj.cTypeHolder = &flowRSVPPathObjectsSessionAttributeCType{obj: obj.obj.CType} - } - return obj.cTypeHolder -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsSessionAttributeCType -func (obj *flowRSVPPathObjectsClassSessionAttribute) HasCType() bool { - return obj.obj.CType != nil -} - -// description is TBD -// SetCType sets the FlowRSVPPathObjectsSessionAttributeCType value in the FlowRSVPPathObjectsClassSessionAttribute object -func (obj *flowRSVPPathObjectsClassSessionAttribute) SetCType(value FlowRSVPPathObjectsSessionAttributeCType) FlowRSVPPathObjectsClassSessionAttribute { - - obj.cTypeHolder = nil - obj.obj.CType = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsClassSessionAttribute) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.CType != nil { - - obj.CType().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsClassSessionAttribute) setDefault() { - -} - -// ***** FlowRSVPPathObjectsClassSenderTemplate ***** -type flowRSVPPathObjectsClassSenderTemplate struct { - validation - obj *otg.FlowRSVPPathObjectsClassSenderTemplate - marshaller marshalFlowRSVPPathObjectsClassSenderTemplate - unMarshaller unMarshalFlowRSVPPathObjectsClassSenderTemplate - lengthHolder FlowRSVPObjectLength - cTypeHolder FlowRSVPPathObjectsSenderTemplateCType -} - -func NewFlowRSVPPathObjectsClassSenderTemplate() FlowRSVPPathObjectsClassSenderTemplate { - obj := flowRSVPPathObjectsClassSenderTemplate{obj: &otg.FlowRSVPPathObjectsClassSenderTemplate{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsClassSenderTemplate) msg() *otg.FlowRSVPPathObjectsClassSenderTemplate { - return obj.obj -} - -func (obj *flowRSVPPathObjectsClassSenderTemplate) setMsg(msg *otg.FlowRSVPPathObjectsClassSenderTemplate) FlowRSVPPathObjectsClassSenderTemplate { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsClassSenderTemplate struct { - obj *flowRSVPPathObjectsClassSenderTemplate -} - -type marshalFlowRSVPPathObjectsClassSenderTemplate interface { - // ToProto marshals FlowRSVPPathObjectsClassSenderTemplate to protobuf object *otg.FlowRSVPPathObjectsClassSenderTemplate - ToProto() (*otg.FlowRSVPPathObjectsClassSenderTemplate, error) - // ToPbText marshals FlowRSVPPathObjectsClassSenderTemplate to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsClassSenderTemplate to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsClassSenderTemplate to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsClassSenderTemplate struct { - obj *flowRSVPPathObjectsClassSenderTemplate -} - -type unMarshalFlowRSVPPathObjectsClassSenderTemplate interface { - // FromProto unmarshals FlowRSVPPathObjectsClassSenderTemplate from protobuf object *otg.FlowRSVPPathObjectsClassSenderTemplate - FromProto(msg *otg.FlowRSVPPathObjectsClassSenderTemplate) (FlowRSVPPathObjectsClassSenderTemplate, error) - // FromPbText unmarshals FlowRSVPPathObjectsClassSenderTemplate from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsClassSenderTemplate from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsClassSenderTemplate from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsClassSenderTemplate) Marshal() marshalFlowRSVPPathObjectsClassSenderTemplate { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsClassSenderTemplate{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsClassSenderTemplate) Unmarshal() unMarshalFlowRSVPPathObjectsClassSenderTemplate { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassSenderTemplate{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsClassSenderTemplate) ToProto() (*otg.FlowRSVPPathObjectsClassSenderTemplate, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsClassSenderTemplate) FromProto(msg *otg.FlowRSVPPathObjectsClassSenderTemplate) (FlowRSVPPathObjectsClassSenderTemplate, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsClassSenderTemplate) 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 *unMarshalflowRSVPPathObjectsClassSenderTemplate) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsClassSenderTemplate) 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 *unMarshalflowRSVPPathObjectsClassSenderTemplate) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsClassSenderTemplate) 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 *unMarshalflowRSVPPathObjectsClassSenderTemplate) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsClassSenderTemplate) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassSenderTemplate) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassSenderTemplate) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsClassSenderTemplate) Clone() (FlowRSVPPathObjectsClassSenderTemplate, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsClassSenderTemplate() - 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 -} - -func (obj *flowRSVPPathObjectsClassSenderTemplate) setNil() { - obj.lengthHolder = nil - obj.cTypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsClassSenderTemplate is c-Type is specific to a class num. -type FlowRSVPPathObjectsClassSenderTemplate interface { - Validation - // msg marshals FlowRSVPPathObjectsClassSenderTemplate to protobuf object *otg.FlowRSVPPathObjectsClassSenderTemplate - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsClassSenderTemplate - // setMsg unmarshals FlowRSVPPathObjectsClassSenderTemplate from protobuf object *otg.FlowRSVPPathObjectsClassSenderTemplate - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsClassSenderTemplate) FlowRSVPPathObjectsClassSenderTemplate - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsClassSenderTemplate - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsClassSenderTemplate - // validate validates FlowRSVPPathObjectsClassSenderTemplate - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsClassSenderTemplate, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassSenderTemplate. - // FlowRSVPObjectLength is description is TBD - Length() FlowRSVPObjectLength - // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassSenderTemplate. - // FlowRSVPObjectLength is description is TBD - SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSenderTemplate - // HasLength checks if Length has been set in FlowRSVPPathObjectsClassSenderTemplate - HasLength() bool - // CType returns FlowRSVPPathObjectsSenderTemplateCType, set in FlowRSVPPathObjectsClassSenderTemplate. - // FlowRSVPPathObjectsSenderTemplateCType is object for SENDER_TEMPLATE class. Currently supported c-type is LSP Tunnel IPv4 (7). - CType() FlowRSVPPathObjectsSenderTemplateCType - // SetCType assigns FlowRSVPPathObjectsSenderTemplateCType provided by user to FlowRSVPPathObjectsClassSenderTemplate. - // FlowRSVPPathObjectsSenderTemplateCType is object for SENDER_TEMPLATE class. Currently supported c-type is LSP Tunnel IPv4 (7). - SetCType(value FlowRSVPPathObjectsSenderTemplateCType) FlowRSVPPathObjectsClassSenderTemplate - // HasCType checks if CType has been set in FlowRSVPPathObjectsClassSenderTemplate - HasCType() bool - setNil() -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassSenderTemplate) Length() FlowRSVPObjectLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowRSVPObjectLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassSenderTemplate) HasLength() bool { - return obj.obj.Length != nil -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassSenderTemplate object -func (obj *flowRSVPPathObjectsClassSenderTemplate) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSenderTemplate { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsSenderTemplateCType -func (obj *flowRSVPPathObjectsClassSenderTemplate) CType() FlowRSVPPathObjectsSenderTemplateCType { - if obj.obj.CType == nil { - obj.obj.CType = NewFlowRSVPPathObjectsSenderTemplateCType().msg() - } - if obj.cTypeHolder == nil { - obj.cTypeHolder = &flowRSVPPathObjectsSenderTemplateCType{obj: obj.obj.CType} - } - return obj.cTypeHolder -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsSenderTemplateCType -func (obj *flowRSVPPathObjectsClassSenderTemplate) HasCType() bool { - return obj.obj.CType != nil -} - -// description is TBD -// SetCType sets the FlowRSVPPathObjectsSenderTemplateCType value in the FlowRSVPPathObjectsClassSenderTemplate object -func (obj *flowRSVPPathObjectsClassSenderTemplate) SetCType(value FlowRSVPPathObjectsSenderTemplateCType) FlowRSVPPathObjectsClassSenderTemplate { - - obj.cTypeHolder = nil - obj.obj.CType = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsClassSenderTemplate) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.CType != nil { - - obj.CType().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsClassSenderTemplate) setDefault() { - -} - -// ***** FlowRSVPPathObjectsClassSenderTspec ***** -type flowRSVPPathObjectsClassSenderTspec struct { - validation - obj *otg.FlowRSVPPathObjectsClassSenderTspec - marshaller marshalFlowRSVPPathObjectsClassSenderTspec - unMarshaller unMarshalFlowRSVPPathObjectsClassSenderTspec - lengthHolder FlowRSVPObjectLength - cTypeHolder FlowRSVPPathObjectsSenderTspecCType -} - -func NewFlowRSVPPathObjectsClassSenderTspec() FlowRSVPPathObjectsClassSenderTspec { - obj := flowRSVPPathObjectsClassSenderTspec{obj: &otg.FlowRSVPPathObjectsClassSenderTspec{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsClassSenderTspec) msg() *otg.FlowRSVPPathObjectsClassSenderTspec { - return obj.obj -} - -func (obj *flowRSVPPathObjectsClassSenderTspec) setMsg(msg *otg.FlowRSVPPathObjectsClassSenderTspec) FlowRSVPPathObjectsClassSenderTspec { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsClassSenderTspec struct { - obj *flowRSVPPathObjectsClassSenderTspec -} - -type marshalFlowRSVPPathObjectsClassSenderTspec interface { - // ToProto marshals FlowRSVPPathObjectsClassSenderTspec to protobuf object *otg.FlowRSVPPathObjectsClassSenderTspec - ToProto() (*otg.FlowRSVPPathObjectsClassSenderTspec, error) - // ToPbText marshals FlowRSVPPathObjectsClassSenderTspec to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsClassSenderTspec to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsClassSenderTspec to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsClassSenderTspec struct { - obj *flowRSVPPathObjectsClassSenderTspec -} - -type unMarshalFlowRSVPPathObjectsClassSenderTspec interface { - // FromProto unmarshals FlowRSVPPathObjectsClassSenderTspec from protobuf object *otg.FlowRSVPPathObjectsClassSenderTspec - FromProto(msg *otg.FlowRSVPPathObjectsClassSenderTspec) (FlowRSVPPathObjectsClassSenderTspec, error) - // FromPbText unmarshals FlowRSVPPathObjectsClassSenderTspec from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsClassSenderTspec from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsClassSenderTspec from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsClassSenderTspec) Marshal() marshalFlowRSVPPathObjectsClassSenderTspec { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsClassSenderTspec{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsClassSenderTspec) Unmarshal() unMarshalFlowRSVPPathObjectsClassSenderTspec { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassSenderTspec{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsClassSenderTspec) ToProto() (*otg.FlowRSVPPathObjectsClassSenderTspec, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsClassSenderTspec) FromProto(msg *otg.FlowRSVPPathObjectsClassSenderTspec) (FlowRSVPPathObjectsClassSenderTspec, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsClassSenderTspec) 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 *unMarshalflowRSVPPathObjectsClassSenderTspec) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsClassSenderTspec) 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 *unMarshalflowRSVPPathObjectsClassSenderTspec) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsClassSenderTspec) 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 *unMarshalflowRSVPPathObjectsClassSenderTspec) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsClassSenderTspec) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassSenderTspec) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassSenderTspec) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsClassSenderTspec) Clone() (FlowRSVPPathObjectsClassSenderTspec, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsClassSenderTspec() - 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 -} - -func (obj *flowRSVPPathObjectsClassSenderTspec) setNil() { - obj.lengthHolder = nil - obj.cTypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsClassSenderTspec is c-Type is specific to a class num. -type FlowRSVPPathObjectsClassSenderTspec interface { - Validation - // msg marshals FlowRSVPPathObjectsClassSenderTspec to protobuf object *otg.FlowRSVPPathObjectsClassSenderTspec - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsClassSenderTspec - // setMsg unmarshals FlowRSVPPathObjectsClassSenderTspec from protobuf object *otg.FlowRSVPPathObjectsClassSenderTspec - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsClassSenderTspec) FlowRSVPPathObjectsClassSenderTspec - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsClassSenderTspec - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsClassSenderTspec - // validate validates FlowRSVPPathObjectsClassSenderTspec - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsClassSenderTspec, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassSenderTspec. - // FlowRSVPObjectLength is description is TBD - Length() FlowRSVPObjectLength - // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassSenderTspec. - // FlowRSVPObjectLength is description is TBD - SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSenderTspec - // HasLength checks if Length has been set in FlowRSVPPathObjectsClassSenderTspec - HasLength() bool - // CType returns FlowRSVPPathObjectsSenderTspecCType, set in FlowRSVPPathObjectsClassSenderTspec. - // FlowRSVPPathObjectsSenderTspecCType is object for SENDER_TSPEC class. Currently supported c-type is int-serv (2). - CType() FlowRSVPPathObjectsSenderTspecCType - // SetCType assigns FlowRSVPPathObjectsSenderTspecCType provided by user to FlowRSVPPathObjectsClassSenderTspec. - // FlowRSVPPathObjectsSenderTspecCType is object for SENDER_TSPEC class. Currently supported c-type is int-serv (2). - SetCType(value FlowRSVPPathObjectsSenderTspecCType) FlowRSVPPathObjectsClassSenderTspec - // HasCType checks if CType has been set in FlowRSVPPathObjectsClassSenderTspec - HasCType() bool - setNil() -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassSenderTspec) Length() FlowRSVPObjectLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowRSVPObjectLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassSenderTspec) HasLength() bool { - return obj.obj.Length != nil -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassSenderTspec object -func (obj *flowRSVPPathObjectsClassSenderTspec) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassSenderTspec { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsSenderTspecCType -func (obj *flowRSVPPathObjectsClassSenderTspec) CType() FlowRSVPPathObjectsSenderTspecCType { - if obj.obj.CType == nil { - obj.obj.CType = NewFlowRSVPPathObjectsSenderTspecCType().msg() - } - if obj.cTypeHolder == nil { - obj.cTypeHolder = &flowRSVPPathObjectsSenderTspecCType{obj: obj.obj.CType} - } - return obj.cTypeHolder -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsSenderTspecCType -func (obj *flowRSVPPathObjectsClassSenderTspec) HasCType() bool { - return obj.obj.CType != nil -} - -// description is TBD -// SetCType sets the FlowRSVPPathObjectsSenderTspecCType value in the FlowRSVPPathObjectsClassSenderTspec object -func (obj *flowRSVPPathObjectsClassSenderTspec) SetCType(value FlowRSVPPathObjectsSenderTspecCType) FlowRSVPPathObjectsClassSenderTspec { - - obj.cTypeHolder = nil - obj.obj.CType = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsClassSenderTspec) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.CType != nil { - - obj.CType().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsClassSenderTspec) setDefault() { - -} - -// ***** FlowRSVPPathObjectsClassRecordRoute ***** -type flowRSVPPathObjectsClassRecordRoute struct { - validation - obj *otg.FlowRSVPPathObjectsClassRecordRoute - marshaller marshalFlowRSVPPathObjectsClassRecordRoute - unMarshaller unMarshalFlowRSVPPathObjectsClassRecordRoute - lengthHolder FlowRSVPObjectLength - cTypeHolder FlowRSVPPathObjectsRecordRouteCType -} - -func NewFlowRSVPPathObjectsClassRecordRoute() FlowRSVPPathObjectsClassRecordRoute { - obj := flowRSVPPathObjectsClassRecordRoute{obj: &otg.FlowRSVPPathObjectsClassRecordRoute{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsClassRecordRoute) msg() *otg.FlowRSVPPathObjectsClassRecordRoute { - return obj.obj -} - -func (obj *flowRSVPPathObjectsClassRecordRoute) setMsg(msg *otg.FlowRSVPPathObjectsClassRecordRoute) FlowRSVPPathObjectsClassRecordRoute { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsClassRecordRoute struct { - obj *flowRSVPPathObjectsClassRecordRoute -} - -type marshalFlowRSVPPathObjectsClassRecordRoute interface { - // ToProto marshals FlowRSVPPathObjectsClassRecordRoute to protobuf object *otg.FlowRSVPPathObjectsClassRecordRoute - ToProto() (*otg.FlowRSVPPathObjectsClassRecordRoute, error) - // ToPbText marshals FlowRSVPPathObjectsClassRecordRoute to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsClassRecordRoute to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsClassRecordRoute to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsClassRecordRoute struct { - obj *flowRSVPPathObjectsClassRecordRoute -} - -type unMarshalFlowRSVPPathObjectsClassRecordRoute interface { - // FromProto unmarshals FlowRSVPPathObjectsClassRecordRoute from protobuf object *otg.FlowRSVPPathObjectsClassRecordRoute - FromProto(msg *otg.FlowRSVPPathObjectsClassRecordRoute) (FlowRSVPPathObjectsClassRecordRoute, error) - // FromPbText unmarshals FlowRSVPPathObjectsClassRecordRoute from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsClassRecordRoute from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsClassRecordRoute from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsClassRecordRoute) Marshal() marshalFlowRSVPPathObjectsClassRecordRoute { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsClassRecordRoute{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsClassRecordRoute) Unmarshal() unMarshalFlowRSVPPathObjectsClassRecordRoute { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassRecordRoute{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsClassRecordRoute) ToProto() (*otg.FlowRSVPPathObjectsClassRecordRoute, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsClassRecordRoute) FromProto(msg *otg.FlowRSVPPathObjectsClassRecordRoute) (FlowRSVPPathObjectsClassRecordRoute, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsClassRecordRoute) 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 *unMarshalflowRSVPPathObjectsClassRecordRoute) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsClassRecordRoute) 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 *unMarshalflowRSVPPathObjectsClassRecordRoute) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsClassRecordRoute) 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 *unMarshalflowRSVPPathObjectsClassRecordRoute) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsClassRecordRoute) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassRecordRoute) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassRecordRoute) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsClassRecordRoute) Clone() (FlowRSVPPathObjectsClassRecordRoute, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsClassRecordRoute() - 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 -} - -func (obj *flowRSVPPathObjectsClassRecordRoute) setNil() { - obj.lengthHolder = nil - obj.cTypeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsClassRecordRoute is c-Type is specific to a class num. -type FlowRSVPPathObjectsClassRecordRoute interface { - Validation - // msg marshals FlowRSVPPathObjectsClassRecordRoute to protobuf object *otg.FlowRSVPPathObjectsClassRecordRoute - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsClassRecordRoute - // setMsg unmarshals FlowRSVPPathObjectsClassRecordRoute from protobuf object *otg.FlowRSVPPathObjectsClassRecordRoute - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsClassRecordRoute) FlowRSVPPathObjectsClassRecordRoute - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsClassRecordRoute - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsClassRecordRoute - // validate validates FlowRSVPPathObjectsClassRecordRoute - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsClassRecordRoute, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsClassRecordRoute. - // FlowRSVPObjectLength is description is TBD - Length() FlowRSVPObjectLength - // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsClassRecordRoute. - // FlowRSVPObjectLength is description is TBD - SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassRecordRoute - // HasLength checks if Length has been set in FlowRSVPPathObjectsClassRecordRoute - HasLength() bool - // CType returns FlowRSVPPathObjectsRecordRouteCType, set in FlowRSVPPathObjectsClassRecordRoute. - // FlowRSVPPathObjectsRecordRouteCType is object for RECORD_ROUTE class. c-type is Type 1 Route Record (1). - CType() FlowRSVPPathObjectsRecordRouteCType - // SetCType assigns FlowRSVPPathObjectsRecordRouteCType provided by user to FlowRSVPPathObjectsClassRecordRoute. - // FlowRSVPPathObjectsRecordRouteCType is object for RECORD_ROUTE class. c-type is Type 1 Route Record (1). - SetCType(value FlowRSVPPathObjectsRecordRouteCType) FlowRSVPPathObjectsClassRecordRoute - // HasCType checks if CType has been set in FlowRSVPPathObjectsClassRecordRoute - HasCType() bool - setNil() -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassRecordRoute) Length() FlowRSVPObjectLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowRSVPObjectLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsClassRecordRoute) HasLength() bool { - return obj.obj.Length != nil -} - -// A 16-bit field containing the total object length in bytes. Must always be a multiple of 4 or at least 4. -// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsClassRecordRoute object -func (obj *flowRSVPPathObjectsClassRecordRoute) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsClassRecordRoute { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsRecordRouteCType -func (obj *flowRSVPPathObjectsClassRecordRoute) CType() FlowRSVPPathObjectsRecordRouteCType { - if obj.obj.CType == nil { - obj.obj.CType = NewFlowRSVPPathObjectsRecordRouteCType().msg() - } - if obj.cTypeHolder == nil { - obj.cTypeHolder = &flowRSVPPathObjectsRecordRouteCType{obj: obj.obj.CType} - } - return obj.cTypeHolder -} - -// description is TBD -// CType returns a FlowRSVPPathObjectsRecordRouteCType -func (obj *flowRSVPPathObjectsClassRecordRoute) HasCType() bool { - return obj.obj.CType != nil -} - -// description is TBD -// SetCType sets the FlowRSVPPathObjectsRecordRouteCType value in the FlowRSVPPathObjectsClassRecordRoute object -func (obj *flowRSVPPathObjectsClassRecordRoute) SetCType(value FlowRSVPPathObjectsRecordRouteCType) FlowRSVPPathObjectsClassRecordRoute { - - obj.cTypeHolder = nil - obj.obj.CType = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsClassRecordRoute) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.CType != nil { - - obj.CType().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsClassRecordRoute) setDefault() { - -} - -// ***** FlowRSVPPathObjectsCustom ***** -type flowRSVPPathObjectsCustom struct { - validation - obj *otg.FlowRSVPPathObjectsCustom - marshaller marshalFlowRSVPPathObjectsCustom - unMarshaller unMarshalFlowRSVPPathObjectsCustom - typeHolder PatternFlowRSVPPathObjectsCustomType - lengthHolder FlowRSVPObjectLength -} - -func NewFlowRSVPPathObjectsCustom() FlowRSVPPathObjectsCustom { - obj := flowRSVPPathObjectsCustom{obj: &otg.FlowRSVPPathObjectsCustom{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsCustom) msg() *otg.FlowRSVPPathObjectsCustom { - return obj.obj -} - -func (obj *flowRSVPPathObjectsCustom) setMsg(msg *otg.FlowRSVPPathObjectsCustom) FlowRSVPPathObjectsCustom { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsCustom struct { - obj *flowRSVPPathObjectsCustom -} - -type marshalFlowRSVPPathObjectsCustom interface { - // ToProto marshals FlowRSVPPathObjectsCustom to protobuf object *otg.FlowRSVPPathObjectsCustom - ToProto() (*otg.FlowRSVPPathObjectsCustom, error) - // ToPbText marshals FlowRSVPPathObjectsCustom to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsCustom to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsCustom to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsCustom struct { - obj *flowRSVPPathObjectsCustom -} - -type unMarshalFlowRSVPPathObjectsCustom interface { - // FromProto unmarshals FlowRSVPPathObjectsCustom from protobuf object *otg.FlowRSVPPathObjectsCustom - FromProto(msg *otg.FlowRSVPPathObjectsCustom) (FlowRSVPPathObjectsCustom, error) - // FromPbText unmarshals FlowRSVPPathObjectsCustom from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsCustom from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsCustom from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsCustom) Marshal() marshalFlowRSVPPathObjectsCustom { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsCustom{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsCustom) Unmarshal() unMarshalFlowRSVPPathObjectsCustom { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsCustom{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsCustom) ToProto() (*otg.FlowRSVPPathObjectsCustom, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsCustom) FromProto(msg *otg.FlowRSVPPathObjectsCustom) (FlowRSVPPathObjectsCustom, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsCustom) 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 *unMarshalflowRSVPPathObjectsCustom) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsCustom) 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 *unMarshalflowRSVPPathObjectsCustom) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsCustom) 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 *unMarshalflowRSVPPathObjectsCustom) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsCustom) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsCustom) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsCustom) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsCustom) Clone() (FlowRSVPPathObjectsCustom, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsCustom() - 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 -} - -func (obj *flowRSVPPathObjectsCustom) setNil() { - obj.typeHolder = nil - obj.lengthHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsCustom is custom packet header -type FlowRSVPPathObjectsCustom interface { - Validation - // msg marshals FlowRSVPPathObjectsCustom to protobuf object *otg.FlowRSVPPathObjectsCustom - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsCustom - // setMsg unmarshals FlowRSVPPathObjectsCustom from protobuf object *otg.FlowRSVPPathObjectsCustom - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsCustom) FlowRSVPPathObjectsCustom - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsCustom - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsCustom - // validate validates FlowRSVPPathObjectsCustom - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsCustom, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Type returns PatternFlowRSVPPathObjectsCustomType, set in FlowRSVPPathObjectsCustom. - // PatternFlowRSVPPathObjectsCustomType is user defined object type. - Type() PatternFlowRSVPPathObjectsCustomType - // SetType assigns PatternFlowRSVPPathObjectsCustomType provided by user to FlowRSVPPathObjectsCustom. - // PatternFlowRSVPPathObjectsCustomType is user defined object type. - SetType(value PatternFlowRSVPPathObjectsCustomType) FlowRSVPPathObjectsCustom - // HasType checks if Type has been set in FlowRSVPPathObjectsCustom - HasType() bool - // Length returns FlowRSVPObjectLength, set in FlowRSVPPathObjectsCustom. - // FlowRSVPObjectLength is description is TBD - Length() FlowRSVPObjectLength - // SetLength assigns FlowRSVPObjectLength provided by user to FlowRSVPPathObjectsCustom. - // FlowRSVPObjectLength is description is TBD - SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsCustom - // HasLength checks if Length has been set in FlowRSVPPathObjectsCustom - HasLength() bool - // Bytes returns string, set in FlowRSVPPathObjectsCustom. - Bytes() string - // SetBytes assigns string provided by user to FlowRSVPPathObjectsCustom - SetBytes(value string) FlowRSVPPathObjectsCustom - // HasBytes checks if Bytes has been set in FlowRSVPPathObjectsCustom - HasBytes() bool - setNil() -} - -// description is TBD -// Type returns a PatternFlowRSVPPathObjectsCustomType -func (obj *flowRSVPPathObjectsCustom) Type() PatternFlowRSVPPathObjectsCustomType { - if obj.obj.Type == nil { - obj.obj.Type = NewPatternFlowRSVPPathObjectsCustomType().msg() - } - if obj.typeHolder == nil { - obj.typeHolder = &patternFlowRSVPPathObjectsCustomType{obj: obj.obj.Type} - } - return obj.typeHolder -} - -// description is TBD -// Type returns a PatternFlowRSVPPathObjectsCustomType -func (obj *flowRSVPPathObjectsCustom) HasType() bool { - return obj.obj.Type != nil -} - -// description is TBD -// SetType sets the PatternFlowRSVPPathObjectsCustomType value in the FlowRSVPPathObjectsCustom object -func (obj *flowRSVPPathObjectsCustom) SetType(value PatternFlowRSVPPathObjectsCustomType) FlowRSVPPathObjectsCustom { - - obj.typeHolder = nil - obj.obj.Type = value.msg() - - return obj -} - -// description is TBD -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsCustom) Length() FlowRSVPObjectLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowRSVPObjectLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowRSVPObjectLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// description is TBD -// Length returns a FlowRSVPObjectLength -func (obj *flowRSVPPathObjectsCustom) HasLength() bool { - return obj.obj.Length != nil -} - -// description is TBD -// SetLength sets the FlowRSVPObjectLength value in the FlowRSVPPathObjectsCustom object -func (obj *flowRSVPPathObjectsCustom) SetLength(value FlowRSVPObjectLength) FlowRSVPPathObjectsCustom { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// A custom packet header defined as a string of hex bytes. The string MUST contain sequence of valid hex bytes. Spaces or colons can be part of the bytes but will be discarded. Value of the this field should not excced 65525 bytes since maximum 65528 bytes can be added as object-contents in RSVP header. For type and length requires 3 bytes, hence maximum of 65524 bytes are expected. Maximum length of this attribute is 131050 (65525 * 2 hex character per byte). -// Bytes returns a string -func (obj *flowRSVPPathObjectsCustom) Bytes() string { - - return *obj.obj.Bytes - -} - -// A custom packet header defined as a string of hex bytes. The string MUST contain sequence of valid hex bytes. Spaces or colons can be part of the bytes but will be discarded. Value of the this field should not excced 65525 bytes since maximum 65528 bytes can be added as object-contents in RSVP header. For type and length requires 3 bytes, hence maximum of 65524 bytes are expected. Maximum length of this attribute is 131050 (65525 * 2 hex character per byte). -// Bytes returns a string -func (obj *flowRSVPPathObjectsCustom) HasBytes() bool { - return obj.obj.Bytes != nil -} - -// A custom packet header defined as a string of hex bytes. The string MUST contain sequence of valid hex bytes. Spaces or colons can be part of the bytes but will be discarded. Value of the this field should not excced 65525 bytes since maximum 65528 bytes can be added as object-contents in RSVP header. For type and length requires 3 bytes, hence maximum of 65524 bytes are expected. Maximum length of this attribute is 131050 (65525 * 2 hex character per byte). -// SetBytes sets the string value in the FlowRSVPPathObjectsCustom object -func (obj *flowRSVPPathObjectsCustom) SetBytes(value string) FlowRSVPPathObjectsCustom { - - obj.obj.Bytes = &value - return obj -} - -func (obj *flowRSVPPathObjectsCustom) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Type != nil { - - obj.Type().validateObj(vObj, set_default) - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.Bytes != nil { - - if len(*obj.obj.Bytes) < 1 || len(*obj.obj.Bytes) > 131050 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "1 <= length of FlowRSVPPathObjectsCustom.Bytes <= 131050 but Got %d", - len(*obj.obj.Bytes))) - } - - } - -} - -func (obj *flowRSVPPathObjectsCustom) setDefault() { - if obj.obj.Bytes == nil { - obj.SetBytes("0000") - } - -} - -// ***** BgpCMacIpRange ***** -type bgpCMacIpRange struct { - validation - obj *otg.BgpCMacIpRange - marshaller marshalBgpCMacIpRange - unMarshaller unMarshalBgpCMacIpRange - macAddressesHolder MACRouteAddress - ipv4AddressesHolder V4RouteAddress - ipv6AddressesHolder V6RouteAddress - advancedHolder BgpRouteAdvanced - communitiesHolder BgpCMacIpRangeBgpCommunityIter - extCommunitiesHolder BgpCMacIpRangeBgpExtCommunityIter - asPathHolder BgpAsPath -} - -func NewBgpCMacIpRange() BgpCMacIpRange { - obj := bgpCMacIpRange{obj: &otg.BgpCMacIpRange{}} - obj.setDefault() - return &obj -} - -func (obj *bgpCMacIpRange) msg() *otg.BgpCMacIpRange { - return obj.obj -} - -func (obj *bgpCMacIpRange) setMsg(msg *otg.BgpCMacIpRange) BgpCMacIpRange { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpCMacIpRange struct { - obj *bgpCMacIpRange -} - -type marshalBgpCMacIpRange interface { - // ToProto marshals BgpCMacIpRange to protobuf object *otg.BgpCMacIpRange - ToProto() (*otg.BgpCMacIpRange, error) - // ToPbText marshals BgpCMacIpRange to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpCMacIpRange to YAML text - ToYaml() (string, error) - // ToJson marshals BgpCMacIpRange to JSON text - ToJson() (string, error) -} - -type unMarshalbgpCMacIpRange struct { - obj *bgpCMacIpRange -} - -type unMarshalBgpCMacIpRange interface { - // FromProto unmarshals BgpCMacIpRange from protobuf object *otg.BgpCMacIpRange - FromProto(msg *otg.BgpCMacIpRange) (BgpCMacIpRange, error) - // FromPbText unmarshals BgpCMacIpRange from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpCMacIpRange from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpCMacIpRange from JSON text - FromJson(value string) error -} - -func (obj *bgpCMacIpRange) Marshal() marshalBgpCMacIpRange { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpCMacIpRange{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpCMacIpRange) Unmarshal() unMarshalBgpCMacIpRange { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpCMacIpRange{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpCMacIpRange) ToProto() (*otg.BgpCMacIpRange, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpCMacIpRange) FromProto(msg *otg.BgpCMacIpRange) (BgpCMacIpRange, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpCMacIpRange) 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 *unMarshalbgpCMacIpRange) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpCMacIpRange) 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 *unMarshalbgpCMacIpRange) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpCMacIpRange) 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 *unMarshalbgpCMacIpRange) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpCMacIpRange) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpCMacIpRange) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpCMacIpRange) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpCMacIpRange) Clone() (BgpCMacIpRange, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpCMacIpRange() - 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 -} - -func (obj *bgpCMacIpRange) setNil() { - obj.macAddressesHolder = nil - obj.ipv4AddressesHolder = nil - obj.ipv6AddressesHolder = nil - obj.advancedHolder = nil - obj.communitiesHolder = nil - obj.extCommunitiesHolder = nil - obj.asPathHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpCMacIpRange is configuration for MAC/IP Ranges per Broadcast Domain. -// -// Advertises following route - -// -// Type 2 - MAC/IP Advertisement Route. -type BgpCMacIpRange interface { - Validation - // msg marshals BgpCMacIpRange to protobuf object *otg.BgpCMacIpRange - // and doesn't set defaults - msg() *otg.BgpCMacIpRange - // setMsg unmarshals BgpCMacIpRange from protobuf object *otg.BgpCMacIpRange - // and doesn't set defaults - setMsg(*otg.BgpCMacIpRange) BgpCMacIpRange - // provides marshal interface - Marshal() marshalBgpCMacIpRange - // provides unmarshal interface - Unmarshal() unMarshalBgpCMacIpRange - // validate validates BgpCMacIpRange - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpCMacIpRange, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // MacAddresses returns MACRouteAddress, set in BgpCMacIpRange. - // MACRouteAddress is a container for MAC route addresses. - MacAddresses() MACRouteAddress - // SetMacAddresses assigns MACRouteAddress provided by user to BgpCMacIpRange. - // MACRouteAddress is a container for MAC route addresses. - SetMacAddresses(value MACRouteAddress) BgpCMacIpRange - // HasMacAddresses checks if MacAddresses has been set in BgpCMacIpRange - HasMacAddresses() bool - // L2Vni returns uint32, set in BgpCMacIpRange. - L2Vni() uint32 - // SetL2Vni assigns uint32 provided by user to BgpCMacIpRange - SetL2Vni(value uint32) BgpCMacIpRange - // HasL2Vni checks if L2Vni has been set in BgpCMacIpRange - HasL2Vni() bool - // Ipv4Addresses returns V4RouteAddress, set in BgpCMacIpRange. - // V4RouteAddress is a container for IPv4 route addresses. - Ipv4Addresses() V4RouteAddress - // SetIpv4Addresses assigns V4RouteAddress provided by user to BgpCMacIpRange. - // V4RouteAddress is a container for IPv4 route addresses. - SetIpv4Addresses(value V4RouteAddress) BgpCMacIpRange - // HasIpv4Addresses checks if Ipv4Addresses has been set in BgpCMacIpRange - HasIpv4Addresses() bool - // Ipv6Addresses returns V6RouteAddress, set in BgpCMacIpRange. - // V6RouteAddress is a container for IPv6 route addresses. - Ipv6Addresses() V6RouteAddress - // SetIpv6Addresses assigns V6RouteAddress provided by user to BgpCMacIpRange. - // V6RouteAddress is a container for IPv6 route addresses. - SetIpv6Addresses(value V6RouteAddress) BgpCMacIpRange - // HasIpv6Addresses checks if Ipv6Addresses has been set in BgpCMacIpRange - HasIpv6Addresses() bool - // L3Vni returns uint32, set in BgpCMacIpRange. - L3Vni() uint32 - // SetL3Vni assigns uint32 provided by user to BgpCMacIpRange - SetL3Vni(value uint32) BgpCMacIpRange - // HasL3Vni checks if L3Vni has been set in BgpCMacIpRange - HasL3Vni() bool - // IncludeDefaultGateway returns bool, set in BgpCMacIpRange. - IncludeDefaultGateway() bool - // SetIncludeDefaultGateway assigns bool provided by user to BgpCMacIpRange - SetIncludeDefaultGateway(value bool) BgpCMacIpRange - // HasIncludeDefaultGateway checks if IncludeDefaultGateway has been set in BgpCMacIpRange - HasIncludeDefaultGateway() bool - // Advanced returns BgpRouteAdvanced, set in BgpCMacIpRange. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - Advanced() BgpRouteAdvanced - // SetAdvanced assigns BgpRouteAdvanced provided by user to BgpCMacIpRange. - // BgpRouteAdvanced is configuration for advanced BGP route range settings. - SetAdvanced(value BgpRouteAdvanced) BgpCMacIpRange - // HasAdvanced checks if Advanced has been set in BgpCMacIpRange - HasAdvanced() bool - // Communities returns BgpCMacIpRangeBgpCommunityIterIter, set in BgpCMacIpRange - Communities() BgpCMacIpRangeBgpCommunityIter - // ExtCommunities returns BgpCMacIpRangeBgpExtCommunityIterIter, set in BgpCMacIpRange - ExtCommunities() BgpCMacIpRangeBgpExtCommunityIter - // AsPath returns BgpAsPath, set in BgpCMacIpRange. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - AsPath() BgpAsPath - // SetAsPath assigns BgpAsPath provided by user to BgpCMacIpRange. - // BgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. This contains the configuration of how to include the Local AS in the AS path attribute of the MP REACH NLRI. It also contains optional configuration of additional AS Path Segments that can be included in the AS Path attribute. The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that a routing information passes through to reach the destination. - SetAsPath(value BgpAsPath) BgpCMacIpRange - // HasAsPath checks if AsPath has been set in BgpCMacIpRange - HasAsPath() bool - // Name returns string, set in BgpCMacIpRange. - Name() string - // SetName assigns string provided by user to BgpCMacIpRange - SetName(value string) BgpCMacIpRange - setNil() -} - -// Host MAC address range per Broadcast Domain. -// MacAddresses returns a MACRouteAddress -func (obj *bgpCMacIpRange) MacAddresses() MACRouteAddress { - if obj.obj.MacAddresses == nil { - obj.obj.MacAddresses = NewMACRouteAddress().msg() - } - if obj.macAddressesHolder == nil { - obj.macAddressesHolder = &mACRouteAddress{obj: obj.obj.MacAddresses} - } - return obj.macAddressesHolder -} - -// Host MAC address range per Broadcast Domain. -// MacAddresses returns a MACRouteAddress -func (obj *bgpCMacIpRange) HasMacAddresses() bool { - return obj.obj.MacAddresses != nil -} - -// Host MAC address range per Broadcast Domain. -// SetMacAddresses sets the MACRouteAddress value in the BgpCMacIpRange object -func (obj *bgpCMacIpRange) SetMacAddresses(value MACRouteAddress) BgpCMacIpRange { - - obj.macAddressesHolder = nil - obj.obj.MacAddresses = value.msg() - - return obj -} - -// Layer 2 Virtual Network Identifier (L2VNI) to be advertised with MAC/IP Advertisement Route (Type 2) -// L2Vni returns a uint32 -func (obj *bgpCMacIpRange) L2Vni() uint32 { - - return *obj.obj.L2Vni - -} - -// Layer 2 Virtual Network Identifier (L2VNI) to be advertised with MAC/IP Advertisement Route (Type 2) -// L2Vni returns a uint32 -func (obj *bgpCMacIpRange) HasL2Vni() bool { - return obj.obj.L2Vni != nil -} - -// Layer 2 Virtual Network Identifier (L2VNI) to be advertised with MAC/IP Advertisement Route (Type 2) -// SetL2Vni sets the uint32 value in the BgpCMacIpRange object -func (obj *bgpCMacIpRange) SetL2Vni(value uint32) BgpCMacIpRange { - - obj.obj.L2Vni = &value - return obj -} - -// Host IPv4 address range per Broadcast Domain. -// Ipv4Addresses returns a V4RouteAddress -func (obj *bgpCMacIpRange) Ipv4Addresses() V4RouteAddress { - if obj.obj.Ipv4Addresses == nil { - obj.obj.Ipv4Addresses = NewV4RouteAddress().msg() - } - if obj.ipv4AddressesHolder == nil { - obj.ipv4AddressesHolder = &v4RouteAddress{obj: obj.obj.Ipv4Addresses} - } - return obj.ipv4AddressesHolder -} - -// Host IPv4 address range per Broadcast Domain. -// Ipv4Addresses returns a V4RouteAddress -func (obj *bgpCMacIpRange) HasIpv4Addresses() bool { - return obj.obj.Ipv4Addresses != nil -} - -// Host IPv4 address range per Broadcast Domain. -// SetIpv4Addresses sets the V4RouteAddress value in the BgpCMacIpRange object -func (obj *bgpCMacIpRange) SetIpv4Addresses(value V4RouteAddress) BgpCMacIpRange { - - obj.ipv4AddressesHolder = nil - obj.obj.Ipv4Addresses = value.msg() - - return obj -} - -// Host IPv6 address range per Broadcast Domain. -// Ipv6Addresses returns a V6RouteAddress -func (obj *bgpCMacIpRange) Ipv6Addresses() V6RouteAddress { - if obj.obj.Ipv6Addresses == nil { - obj.obj.Ipv6Addresses = NewV6RouteAddress().msg() - } - if obj.ipv6AddressesHolder == nil { - obj.ipv6AddressesHolder = &v6RouteAddress{obj: obj.obj.Ipv6Addresses} - } - return obj.ipv6AddressesHolder -} - -// Host IPv6 address range per Broadcast Domain. -// Ipv6Addresses returns a V6RouteAddress -func (obj *bgpCMacIpRange) HasIpv6Addresses() bool { - return obj.obj.Ipv6Addresses != nil -} - -// Host IPv6 address range per Broadcast Domain. -// SetIpv6Addresses sets the V6RouteAddress value in the BgpCMacIpRange object -func (obj *bgpCMacIpRange) SetIpv6Addresses(value V6RouteAddress) BgpCMacIpRange { - - obj.ipv6AddressesHolder = nil - obj.obj.Ipv6Addresses = value.msg() - - return obj -} - -// Layer 3 Virtual Network Identifier (L3VNI) to be advertised with MAC/IP Advertisement Route (Type 2). -// L3Vni returns a uint32 -func (obj *bgpCMacIpRange) L3Vni() uint32 { - - return *obj.obj.L3Vni - -} - -// Layer 3 Virtual Network Identifier (L3VNI) to be advertised with MAC/IP Advertisement Route (Type 2). -// L3Vni returns a uint32 -func (obj *bgpCMacIpRange) HasL3Vni() bool { - return obj.obj.L3Vni != nil -} - -// Layer 3 Virtual Network Identifier (L3VNI) to be advertised with MAC/IP Advertisement Route (Type 2). -// SetL3Vni sets the uint32 value in the BgpCMacIpRange object -func (obj *bgpCMacIpRange) SetL3Vni(value uint32) BgpCMacIpRange { - - obj.obj.L3Vni = &value - return obj -} - -// Include default Gateway Extended Community in MAC/IP Advertisement Route (Type 2). -// IncludeDefaultGateway returns a bool -func (obj *bgpCMacIpRange) IncludeDefaultGateway() bool { - - return *obj.obj.IncludeDefaultGateway - -} - -// Include default Gateway Extended Community in MAC/IP Advertisement Route (Type 2). -// IncludeDefaultGateway returns a bool -func (obj *bgpCMacIpRange) HasIncludeDefaultGateway() bool { - return obj.obj.IncludeDefaultGateway != nil -} - -// Include default Gateway Extended Community in MAC/IP Advertisement Route (Type 2). -// SetIncludeDefaultGateway sets the bool value in the BgpCMacIpRange object -func (obj *bgpCMacIpRange) SetIncludeDefaultGateway(value bool) BgpCMacIpRange { - - obj.obj.IncludeDefaultGateway = &value - return obj -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpCMacIpRange) Advanced() BgpRouteAdvanced { - if obj.obj.Advanced == nil { - obj.obj.Advanced = NewBgpRouteAdvanced().msg() - } - if obj.advancedHolder == nil { - obj.advancedHolder = &bgpRouteAdvanced{obj: obj.obj.Advanced} - } - return obj.advancedHolder -} - -// description is TBD -// Advanced returns a BgpRouteAdvanced -func (obj *bgpCMacIpRange) HasAdvanced() bool { - return obj.obj.Advanced != nil -} - -// description is TBD -// SetAdvanced sets the BgpRouteAdvanced value in the BgpCMacIpRange object -func (obj *bgpCMacIpRange) SetAdvanced(value BgpRouteAdvanced) BgpCMacIpRange { - - obj.advancedHolder = nil - obj.obj.Advanced = value.msg() - - return obj -} - -// Optional community settings. -// Communities returns a []BgpCommunity -func (obj *bgpCMacIpRange) Communities() BgpCMacIpRangeBgpCommunityIter { - if len(obj.obj.Communities) == 0 { - obj.obj.Communities = []*otg.BgpCommunity{} - } - if obj.communitiesHolder == nil { - obj.communitiesHolder = newBgpCMacIpRangeBgpCommunityIter(&obj.obj.Communities).setMsg(obj) - } - return obj.communitiesHolder -} - -type bgpCMacIpRangeBgpCommunityIter struct { - obj *bgpCMacIpRange - bgpCommunitySlice []BgpCommunity - fieldPtr *[]*otg.BgpCommunity -} - -func newBgpCMacIpRangeBgpCommunityIter(ptr *[]*otg.BgpCommunity) BgpCMacIpRangeBgpCommunityIter { - return &bgpCMacIpRangeBgpCommunityIter{fieldPtr: ptr} -} - -type BgpCMacIpRangeBgpCommunityIter interface { - setMsg(*bgpCMacIpRange) BgpCMacIpRangeBgpCommunityIter - Items() []BgpCommunity - Add() BgpCommunity - Append(items ...BgpCommunity) BgpCMacIpRangeBgpCommunityIter - Set(index int, newObj BgpCommunity) BgpCMacIpRangeBgpCommunityIter - Clear() BgpCMacIpRangeBgpCommunityIter - clearHolderSlice() BgpCMacIpRangeBgpCommunityIter - appendHolderSlice(item BgpCommunity) BgpCMacIpRangeBgpCommunityIter -} - -func (obj *bgpCMacIpRangeBgpCommunityIter) setMsg(msg *bgpCMacIpRange) BgpCMacIpRangeBgpCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpCMacIpRangeBgpCommunityIter) Items() []BgpCommunity { - return obj.bgpCommunitySlice -} - -func (obj *bgpCMacIpRangeBgpCommunityIter) Add() BgpCommunity { - newObj := &otg.BgpCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpCMacIpRangeBgpCommunityIter) Append(items ...BgpCommunity) BgpCMacIpRangeBgpCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - } - return obj -} - -func (obj *bgpCMacIpRangeBgpCommunityIter) Set(index int, newObj BgpCommunity) BgpCMacIpRangeBgpCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpCommunitySlice[index] = newObj - return obj -} -func (obj *bgpCMacIpRangeBgpCommunityIter) Clear() BgpCMacIpRangeBgpCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpCommunity{} - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpCMacIpRangeBgpCommunityIter) clearHolderSlice() BgpCMacIpRangeBgpCommunityIter { - if len(obj.bgpCommunitySlice) > 0 { - obj.bgpCommunitySlice = []BgpCommunity{} - } - return obj -} -func (obj *bgpCMacIpRangeBgpCommunityIter) appendHolderSlice(item BgpCommunity) BgpCMacIpRangeBgpCommunityIter { - obj.bgpCommunitySlice = append(obj.bgpCommunitySlice, item) - return obj -} - -// Optional Extended Community settings. The Extended Communities Attribute is a transitive optional BGP attribute, with the Type Code 16. Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. An extended community is an 8-Bytes value. It is divided into two main parts. The first 2 Bytes of the community encode a type and sub-type fields and the last 6 Bytes carry a unique set of data in a format defined by the type and sub-type field. Extended communities provide a larger range for grouping or categorizing communities. When type is administrator_as_2octet or administrator_as_4octet, the valid sub types are route target and origin. The valid value for administrator_as_2octet and administrator_as_4octet type is either two byte AS followed by four byte local administrator id or four byte AS followed by two byte local administrator id. When type is administrator_ipv4_address the valid sub types are route target and origin. The valid value for administrator_ipv4_address is a four byte IPv4 address followed by a two byte local administrator id. When type is opaque, valid sub types are color and encapsulation. When sub type is color, first two bytes of the value field contain flags and last four bytes contains the value of the color. When sub type is encapsulation the first four bytes of value field are reserved and last two bytes carries the tunnel type from IANA's "ETHER TYPES" registry e.g IPv4 (protocol type = 0x0800), IPv6 (protocol type = 0x86dd), and MPLS (protocol type = 0x8847). When type is administrator_as_2octet_link_bandwidth the valid sub type is extended_bandwidth. The first two bytes of the value field contains the AS number and the last four bytes contains the bandwidth in IEEE floating point format. When type is evpn the valid subtype is mac_address. In the value field the low-order bit of the first byte(Flags) is defined as the "Sticky/static" flag and may be set to 1, indicating the MAC address is static and cannot move. The second byte is reserved and the last four bytes contain the sequence number which is used to ensure that PEs retain the correct MAC/IP Advertisement route when multiple updates occur for the same MAC address. -// ExtCommunities returns a []BgpExtCommunity -func (obj *bgpCMacIpRange) ExtCommunities() BgpCMacIpRangeBgpExtCommunityIter { - if len(obj.obj.ExtCommunities) == 0 { - obj.obj.ExtCommunities = []*otg.BgpExtCommunity{} - } - if obj.extCommunitiesHolder == nil { - obj.extCommunitiesHolder = newBgpCMacIpRangeBgpExtCommunityIter(&obj.obj.ExtCommunities).setMsg(obj) - } - return obj.extCommunitiesHolder -} - -type bgpCMacIpRangeBgpExtCommunityIter struct { - obj *bgpCMacIpRange - bgpExtCommunitySlice []BgpExtCommunity - fieldPtr *[]*otg.BgpExtCommunity -} - -func newBgpCMacIpRangeBgpExtCommunityIter(ptr *[]*otg.BgpExtCommunity) BgpCMacIpRangeBgpExtCommunityIter { - return &bgpCMacIpRangeBgpExtCommunityIter{fieldPtr: ptr} -} - -type BgpCMacIpRangeBgpExtCommunityIter interface { - setMsg(*bgpCMacIpRange) BgpCMacIpRangeBgpExtCommunityIter - Items() []BgpExtCommunity - Add() BgpExtCommunity - Append(items ...BgpExtCommunity) BgpCMacIpRangeBgpExtCommunityIter - Set(index int, newObj BgpExtCommunity) BgpCMacIpRangeBgpExtCommunityIter - Clear() BgpCMacIpRangeBgpExtCommunityIter - clearHolderSlice() BgpCMacIpRangeBgpExtCommunityIter - appendHolderSlice(item BgpExtCommunity) BgpCMacIpRangeBgpExtCommunityIter -} - -func (obj *bgpCMacIpRangeBgpExtCommunityIter) setMsg(msg *bgpCMacIpRange) BgpCMacIpRangeBgpExtCommunityIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpExtCommunity{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpCMacIpRangeBgpExtCommunityIter) Items() []BgpExtCommunity { - return obj.bgpExtCommunitySlice -} - -func (obj *bgpCMacIpRangeBgpExtCommunityIter) Add() BgpExtCommunity { - newObj := &otg.BgpExtCommunity{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpExtCommunity{obj: newObj} - newLibObj.setDefault() - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, newLibObj) - return newLibObj -} - -func (obj *bgpCMacIpRangeBgpExtCommunityIter) Append(items ...BgpExtCommunity) BgpCMacIpRangeBgpExtCommunityIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - } - return obj -} - -func (obj *bgpCMacIpRangeBgpExtCommunityIter) Set(index int, newObj BgpExtCommunity) BgpCMacIpRangeBgpExtCommunityIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpExtCommunitySlice[index] = newObj - return obj -} -func (obj *bgpCMacIpRangeBgpExtCommunityIter) Clear() BgpCMacIpRangeBgpExtCommunityIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpExtCommunity{} - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpCMacIpRangeBgpExtCommunityIter) clearHolderSlice() BgpCMacIpRangeBgpExtCommunityIter { - if len(obj.bgpExtCommunitySlice) > 0 { - obj.bgpExtCommunitySlice = []BgpExtCommunity{} - } - return obj -} -func (obj *bgpCMacIpRangeBgpExtCommunityIter) appendHolderSlice(item BgpExtCommunity) BgpCMacIpRangeBgpExtCommunityIter { - obj.bgpExtCommunitySlice = append(obj.bgpExtCommunitySlice, item) - return obj -} - -// Optional AS PATH settings. -// AsPath returns a BgpAsPath -func (obj *bgpCMacIpRange) AsPath() BgpAsPath { - if obj.obj.AsPath == nil { - obj.obj.AsPath = NewBgpAsPath().msg() - } - if obj.asPathHolder == nil { - obj.asPathHolder = &bgpAsPath{obj: obj.obj.AsPath} - } - return obj.asPathHolder -} - -// Optional AS PATH settings. -// AsPath returns a BgpAsPath -func (obj *bgpCMacIpRange) HasAsPath() bool { - return obj.obj.AsPath != nil -} - -// Optional AS PATH settings. -// SetAsPath sets the BgpAsPath value in the BgpCMacIpRange object -func (obj *bgpCMacIpRange) SetAsPath(value BgpAsPath) BgpCMacIpRange { - - obj.asPathHolder = nil - obj.obj.AsPath = value.msg() - - return obj -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// Name returns a string -func (obj *bgpCMacIpRange) Name() string { - - return *obj.obj.Name - -} - -// Globally unique name of an object. It also serves as the primary key for arrays of objects. -// SetName sets the string value in the BgpCMacIpRange object -func (obj *bgpCMacIpRange) SetName(value string) BgpCMacIpRange { - - obj.obj.Name = &value - return obj -} - -func (obj *bgpCMacIpRange) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.MacAddresses != nil { - - obj.MacAddresses().validateObj(vObj, set_default) - } - - if obj.obj.L2Vni != nil { - - if *obj.obj.L2Vni > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpCMacIpRange.L2Vni <= 16777215 but Got %d", *obj.obj.L2Vni)) - } - - } - - if obj.obj.Ipv4Addresses != nil { - - obj.Ipv4Addresses().validateObj(vObj, set_default) - } - - if obj.obj.Ipv6Addresses != nil { - - obj.Ipv6Addresses().validateObj(vObj, set_default) - } - - if obj.obj.L3Vni != nil { - - if *obj.obj.L3Vni > 16777215 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpCMacIpRange.L3Vni <= 16777215 but Got %d", *obj.obj.L3Vni)) - } - - } - - if obj.obj.Advanced != nil { - - obj.Advanced().validateObj(vObj, set_default) - } - - if len(obj.obj.Communities) != 0 { - - if set_default { - obj.Communities().clearHolderSlice() - for _, item := range obj.obj.Communities { - obj.Communities().appendHolderSlice(&bgpCommunity{obj: item}) - } - } - for _, item := range obj.Communities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.ExtCommunities) != 0 { - - if set_default { - obj.ExtCommunities().clearHolderSlice() - for _, item := range obj.obj.ExtCommunities { - obj.ExtCommunities().appendHolderSlice(&bgpExtCommunity{obj: item}) - } - } - for _, item := range obj.ExtCommunities().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.AsPath != nil { - - obj.AsPath().validateObj(vObj, set_default) - } - - // Name is required - if obj.obj.Name == nil { - vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface BgpCMacIpRange") - } -} - -func (obj *bgpCMacIpRange) setDefault() { - if obj.obj.L2Vni == nil { - obj.SetL2Vni(0) - } - if obj.obj.L3Vni == nil { - obj.SetL3Vni(0) - } - if obj.obj.IncludeDefaultGateway == nil { - obj.SetIncludeDefaultGateway(false) - } - -} - -// ***** BgpSrteSegmentATypeSubTlv ***** -type bgpSrteSegmentATypeSubTlv struct { - validation - obj *otg.BgpSrteSegmentATypeSubTlv - marshaller marshalBgpSrteSegmentATypeSubTlv - unMarshaller unMarshalBgpSrteSegmentATypeSubTlv -} - -func NewBgpSrteSegmentATypeSubTlv() BgpSrteSegmentATypeSubTlv { - obj := bgpSrteSegmentATypeSubTlv{obj: &otg.BgpSrteSegmentATypeSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSegmentATypeSubTlv) msg() *otg.BgpSrteSegmentATypeSubTlv { - return obj.obj -} - -func (obj *bgpSrteSegmentATypeSubTlv) setMsg(msg *otg.BgpSrteSegmentATypeSubTlv) BgpSrteSegmentATypeSubTlv { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSegmentATypeSubTlv struct { - obj *bgpSrteSegmentATypeSubTlv -} - -type marshalBgpSrteSegmentATypeSubTlv interface { - // ToProto marshals BgpSrteSegmentATypeSubTlv to protobuf object *otg.BgpSrteSegmentATypeSubTlv - ToProto() (*otg.BgpSrteSegmentATypeSubTlv, error) - // ToPbText marshals BgpSrteSegmentATypeSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSegmentATypeSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSegmentATypeSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSegmentATypeSubTlv struct { - obj *bgpSrteSegmentATypeSubTlv -} - -type unMarshalBgpSrteSegmentATypeSubTlv interface { - // FromProto unmarshals BgpSrteSegmentATypeSubTlv from protobuf object *otg.BgpSrteSegmentATypeSubTlv - FromProto(msg *otg.BgpSrteSegmentATypeSubTlv) (BgpSrteSegmentATypeSubTlv, error) - // FromPbText unmarshals BgpSrteSegmentATypeSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSegmentATypeSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSegmentATypeSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSegmentATypeSubTlv) Marshal() marshalBgpSrteSegmentATypeSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSegmentATypeSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSegmentATypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentATypeSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSegmentATypeSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSegmentATypeSubTlv) ToProto() (*otg.BgpSrteSegmentATypeSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSegmentATypeSubTlv) FromProto(msg *otg.BgpSrteSegmentATypeSubTlv) (BgpSrteSegmentATypeSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSegmentATypeSubTlv) 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 *unMarshalbgpSrteSegmentATypeSubTlv) 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 *marshalbgpSrteSegmentATypeSubTlv) 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 *unMarshalbgpSrteSegmentATypeSubTlv) 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 *marshalbgpSrteSegmentATypeSubTlv) 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 *unMarshalbgpSrteSegmentATypeSubTlv) 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 *bgpSrteSegmentATypeSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentATypeSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentATypeSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSegmentATypeSubTlv) Clone() (BgpSrteSegmentATypeSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSegmentATypeSubTlv() - 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 -} - -// BgpSrteSegmentATypeSubTlv is type A: SID only, in the form of MPLS Label. -type BgpSrteSegmentATypeSubTlv interface { - Validation - // msg marshals BgpSrteSegmentATypeSubTlv to protobuf object *otg.BgpSrteSegmentATypeSubTlv - // and doesn't set defaults - msg() *otg.BgpSrteSegmentATypeSubTlv - // setMsg unmarshals BgpSrteSegmentATypeSubTlv from protobuf object *otg.BgpSrteSegmentATypeSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteSegmentATypeSubTlv) BgpSrteSegmentATypeSubTlv - // provides marshal interface - Marshal() marshalBgpSrteSegmentATypeSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSegmentATypeSubTlv - // validate validates BgpSrteSegmentATypeSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSegmentATypeSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns string, set in BgpSrteSegmentATypeSubTlv. - Flags() string - // SetFlags assigns string provided by user to BgpSrteSegmentATypeSubTlv - SetFlags(value string) BgpSrteSegmentATypeSubTlv - // HasFlags checks if Flags has been set in BgpSrteSegmentATypeSubTlv - HasFlags() bool - // Label returns uint32, set in BgpSrteSegmentATypeSubTlv. - Label() uint32 - // SetLabel assigns uint32 provided by user to BgpSrteSegmentATypeSubTlv - SetLabel(value uint32) BgpSrteSegmentATypeSubTlv - // HasLabel checks if Label has been set in BgpSrteSegmentATypeSubTlv - HasLabel() bool - // Tc returns uint32, set in BgpSrteSegmentATypeSubTlv. - Tc() uint32 - // SetTc assigns uint32 provided by user to BgpSrteSegmentATypeSubTlv - SetTc(value uint32) BgpSrteSegmentATypeSubTlv - // HasTc checks if Tc has been set in BgpSrteSegmentATypeSubTlv - HasTc() bool - // SBit returns bool, set in BgpSrteSegmentATypeSubTlv. - SBit() bool - // SetSBit assigns bool provided by user to BgpSrteSegmentATypeSubTlv - SetSBit(value bool) BgpSrteSegmentATypeSubTlv - // HasSBit checks if SBit has been set in BgpSrteSegmentATypeSubTlv - HasSBit() bool - // Ttl returns uint32, set in BgpSrteSegmentATypeSubTlv. - Ttl() uint32 - // SetTtl assigns uint32 provided by user to BgpSrteSegmentATypeSubTlv - SetTtl(value uint32) BgpSrteSegmentATypeSubTlv - // HasTtl checks if Ttl has been set in BgpSrteSegmentATypeSubTlv - HasTtl() bool -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentATypeSubTlv) Flags() string { - - return *obj.obj.Flags - -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentATypeSubTlv) HasFlags() bool { - return obj.obj.Flags != nil -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// SetFlags sets the string value in the BgpSrteSegmentATypeSubTlv object -func (obj *bgpSrteSegmentATypeSubTlv) SetFlags(value string) BgpSrteSegmentATypeSubTlv { - - obj.obj.Flags = &value - return obj -} - -// Label value in [0, 2^20 -1]. -// Label returns a uint32 -func (obj *bgpSrteSegmentATypeSubTlv) Label() uint32 { - - return *obj.obj.Label - -} - -// Label value in [0, 2^20 -1]. -// Label returns a uint32 -func (obj *bgpSrteSegmentATypeSubTlv) HasLabel() bool { - return obj.obj.Label != nil -} - -// Label value in [0, 2^20 -1]. -// SetLabel sets the uint32 value in the BgpSrteSegmentATypeSubTlv object -func (obj *bgpSrteSegmentATypeSubTlv) SetLabel(value uint32) BgpSrteSegmentATypeSubTlv { - - obj.obj.Label = &value - return obj -} - -// Traffic class in bits. -// Tc returns a uint32 -func (obj *bgpSrteSegmentATypeSubTlv) Tc() uint32 { - - return *obj.obj.Tc - -} - -// Traffic class in bits. -// Tc returns a uint32 -func (obj *bgpSrteSegmentATypeSubTlv) HasTc() bool { - return obj.obj.Tc != nil -} - -// Traffic class in bits. -// SetTc sets the uint32 value in the BgpSrteSegmentATypeSubTlv object -func (obj *bgpSrteSegmentATypeSubTlv) SetTc(value uint32) BgpSrteSegmentATypeSubTlv { - - obj.obj.Tc = &value - return obj -} - -// Bottom-of-Stack bit. -// SBit returns a bool -func (obj *bgpSrteSegmentATypeSubTlv) SBit() bool { - - return *obj.obj.SBit - -} - -// Bottom-of-Stack bit. -// SBit returns a bool -func (obj *bgpSrteSegmentATypeSubTlv) HasSBit() bool { - return obj.obj.SBit != nil -} - -// Bottom-of-Stack bit. -// SetSBit sets the bool value in the BgpSrteSegmentATypeSubTlv object -func (obj *bgpSrteSegmentATypeSubTlv) SetSBit(value bool) BgpSrteSegmentATypeSubTlv { - - obj.obj.SBit = &value - return obj -} - -// Time To Live. -// Ttl returns a uint32 -func (obj *bgpSrteSegmentATypeSubTlv) Ttl() uint32 { - - return *obj.obj.Ttl - -} - -// Time To Live. -// Ttl returns a uint32 -func (obj *bgpSrteSegmentATypeSubTlv) HasTtl() bool { - return obj.obj.Ttl != nil -} - -// Time To Live. -// SetTtl sets the uint32 value in the BgpSrteSegmentATypeSubTlv object -func (obj *bgpSrteSegmentATypeSubTlv) SetTtl(value uint32) BgpSrteSegmentATypeSubTlv { - - obj.obj.Ttl = &value - return obj -} - -func (obj *bgpSrteSegmentATypeSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - err := obj.validateHex(obj.Flags()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentATypeSubTlv.Flags")) - } - - } - - if obj.obj.Label != nil { - - if *obj.obj.Label > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpSrteSegmentATypeSubTlv.Label <= 1048575 but Got %d", *obj.obj.Label)) - } - - } - - if obj.obj.Tc != nil { - - if *obj.obj.Tc > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpSrteSegmentATypeSubTlv.Tc <= 7 but Got %d", *obj.obj.Tc)) - } - - } - - if obj.obj.Ttl != nil { - - if *obj.obj.Ttl > 225 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpSrteSegmentATypeSubTlv.Ttl <= 225 but Got %d", *obj.obj.Ttl)) - } - - } - -} - -func (obj *bgpSrteSegmentATypeSubTlv) setDefault() { - -} - -// ***** BgpSrteSegmentBTypeSubTlv ***** -type bgpSrteSegmentBTypeSubTlv struct { - validation - obj *otg.BgpSrteSegmentBTypeSubTlv - marshaller marshalBgpSrteSegmentBTypeSubTlv - unMarshaller unMarshalBgpSrteSegmentBTypeSubTlv - srv6SidEndpointBehaviorHolder BgpSrteSRv6SIDEndpointBehaviorAndStructure -} - -func NewBgpSrteSegmentBTypeSubTlv() BgpSrteSegmentBTypeSubTlv { - obj := bgpSrteSegmentBTypeSubTlv{obj: &otg.BgpSrteSegmentBTypeSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSegmentBTypeSubTlv) msg() *otg.BgpSrteSegmentBTypeSubTlv { - return obj.obj -} - -func (obj *bgpSrteSegmentBTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentBTypeSubTlv) BgpSrteSegmentBTypeSubTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSegmentBTypeSubTlv struct { - obj *bgpSrteSegmentBTypeSubTlv -} - -type marshalBgpSrteSegmentBTypeSubTlv interface { - // ToProto marshals BgpSrteSegmentBTypeSubTlv to protobuf object *otg.BgpSrteSegmentBTypeSubTlv - ToProto() (*otg.BgpSrteSegmentBTypeSubTlv, error) - // ToPbText marshals BgpSrteSegmentBTypeSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSegmentBTypeSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSegmentBTypeSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSegmentBTypeSubTlv struct { - obj *bgpSrteSegmentBTypeSubTlv -} - -type unMarshalBgpSrteSegmentBTypeSubTlv interface { - // FromProto unmarshals BgpSrteSegmentBTypeSubTlv from protobuf object *otg.BgpSrteSegmentBTypeSubTlv - FromProto(msg *otg.BgpSrteSegmentBTypeSubTlv) (BgpSrteSegmentBTypeSubTlv, error) - // FromPbText unmarshals BgpSrteSegmentBTypeSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSegmentBTypeSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSegmentBTypeSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSegmentBTypeSubTlv) Marshal() marshalBgpSrteSegmentBTypeSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSegmentBTypeSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSegmentBTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentBTypeSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSegmentBTypeSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSegmentBTypeSubTlv) ToProto() (*otg.BgpSrteSegmentBTypeSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSegmentBTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentBTypeSubTlv) (BgpSrteSegmentBTypeSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSegmentBTypeSubTlv) 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 *unMarshalbgpSrteSegmentBTypeSubTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteSegmentBTypeSubTlv) 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 *unMarshalbgpSrteSegmentBTypeSubTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteSegmentBTypeSubTlv) 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 *unMarshalbgpSrteSegmentBTypeSubTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteSegmentBTypeSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentBTypeSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentBTypeSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSegmentBTypeSubTlv) Clone() (BgpSrteSegmentBTypeSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSegmentBTypeSubTlv() - 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 -} - -func (obj *bgpSrteSegmentBTypeSubTlv) setNil() { - obj.srv6SidEndpointBehaviorHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteSegmentBTypeSubTlv is type B: SID only, in the form of IPv6 address. -type BgpSrteSegmentBTypeSubTlv interface { - Validation - // msg marshals BgpSrteSegmentBTypeSubTlv to protobuf object *otg.BgpSrteSegmentBTypeSubTlv - // and doesn't set defaults - msg() *otg.BgpSrteSegmentBTypeSubTlv - // setMsg unmarshals BgpSrteSegmentBTypeSubTlv from protobuf object *otg.BgpSrteSegmentBTypeSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteSegmentBTypeSubTlv) BgpSrteSegmentBTypeSubTlv - // provides marshal interface - Marshal() marshalBgpSrteSegmentBTypeSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSegmentBTypeSubTlv - // validate validates BgpSrteSegmentBTypeSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSegmentBTypeSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns string, set in BgpSrteSegmentBTypeSubTlv. - Flags() string - // SetFlags assigns string provided by user to BgpSrteSegmentBTypeSubTlv - SetFlags(value string) BgpSrteSegmentBTypeSubTlv - // HasFlags checks if Flags has been set in BgpSrteSegmentBTypeSubTlv - HasFlags() bool - // Srv6Sid returns string, set in BgpSrteSegmentBTypeSubTlv. - Srv6Sid() string - // SetSrv6Sid assigns string provided by user to BgpSrteSegmentBTypeSubTlv - SetSrv6Sid(value string) BgpSrteSegmentBTypeSubTlv - // Srv6SidEndpointBehavior returns BgpSrteSRv6SIDEndpointBehaviorAndStructure, set in BgpSrteSegmentBTypeSubTlv. - // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure - // SetSrv6SidEndpointBehavior assigns BgpSrteSRv6SIDEndpointBehaviorAndStructure provided by user to BgpSrteSegmentBTypeSubTlv. - // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentBTypeSubTlv - // HasSrv6SidEndpointBehavior checks if Srv6SidEndpointBehavior has been set in BgpSrteSegmentBTypeSubTlv - HasSrv6SidEndpointBehavior() bool - setNil() -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentBTypeSubTlv) Flags() string { - - return *obj.obj.Flags - -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentBTypeSubTlv) HasFlags() bool { - return obj.obj.Flags != nil -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// SetFlags sets the string value in the BgpSrteSegmentBTypeSubTlv object -func (obj *bgpSrteSegmentBTypeSubTlv) SetFlags(value string) BgpSrteSegmentBTypeSubTlv { - - obj.obj.Flags = &value - return obj -} - -// SRv6 SID. -// Srv6Sid returns a string -func (obj *bgpSrteSegmentBTypeSubTlv) Srv6Sid() string { - - return *obj.obj.Srv6Sid - -} - -// SRv6 SID. -// SetSrv6Sid sets the string value in the BgpSrteSegmentBTypeSubTlv object -func (obj *bgpSrteSegmentBTypeSubTlv) SetSrv6Sid(value string) BgpSrteSegmentBTypeSubTlv { - - obj.obj.Srv6Sid = &value - return obj -} - -// Optional SRv6 Endpoint Behavior and SID Structure. -// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure -func (obj *bgpSrteSegmentBTypeSubTlv) Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure { - if obj.obj.Srv6SidEndpointBehavior == nil { - obj.obj.Srv6SidEndpointBehavior = NewBgpSrteSRv6SIDEndpointBehaviorAndStructure().msg() - } - if obj.srv6SidEndpointBehaviorHolder == nil { - obj.srv6SidEndpointBehaviorHolder = &bgpSrteSRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6SidEndpointBehavior} - } - return obj.srv6SidEndpointBehaviorHolder -} - -// Optional SRv6 Endpoint Behavior and SID Structure. -// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure -func (obj *bgpSrteSegmentBTypeSubTlv) HasSrv6SidEndpointBehavior() bool { - return obj.obj.Srv6SidEndpointBehavior != nil -} - -// Optional SRv6 Endpoint Behavior and SID Structure. -// SetSrv6SidEndpointBehavior sets the BgpSrteSRv6SIDEndpointBehaviorAndStructure value in the BgpSrteSegmentBTypeSubTlv object -func (obj *bgpSrteSegmentBTypeSubTlv) SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentBTypeSubTlv { - - obj.srv6SidEndpointBehaviorHolder = nil - obj.obj.Srv6SidEndpointBehavior = value.msg() - - return obj -} - -func (obj *bgpSrteSegmentBTypeSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - err := obj.validateHex(obj.Flags()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentBTypeSubTlv.Flags")) - } - - } - - // Srv6Sid is required - if obj.obj.Srv6Sid == nil { - vObj.validationErrors = append(vObj.validationErrors, "Srv6Sid is required field on interface BgpSrteSegmentBTypeSubTlv") - } - if obj.obj.Srv6Sid != nil { - - err := obj.validateIpv6(obj.Srv6Sid()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentBTypeSubTlv.Srv6Sid")) - } - - } - - if obj.obj.Srv6SidEndpointBehavior != nil { - - obj.Srv6SidEndpointBehavior().validateObj(vObj, set_default) - } - -} - -func (obj *bgpSrteSegmentBTypeSubTlv) setDefault() { - -} - -// ***** BgpSrteSegmentCTypeSubTlv ***** -type bgpSrteSegmentCTypeSubTlv struct { - validation - obj *otg.BgpSrteSegmentCTypeSubTlv - marshaller marshalBgpSrteSegmentCTypeSubTlv - unMarshaller unMarshalBgpSrteSegmentCTypeSubTlv - srMplsSidHolder BgpSrteSrMplsSid -} - -func NewBgpSrteSegmentCTypeSubTlv() BgpSrteSegmentCTypeSubTlv { - obj := bgpSrteSegmentCTypeSubTlv{obj: &otg.BgpSrteSegmentCTypeSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSegmentCTypeSubTlv) msg() *otg.BgpSrteSegmentCTypeSubTlv { - return obj.obj -} - -func (obj *bgpSrteSegmentCTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentCTypeSubTlv) BgpSrteSegmentCTypeSubTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSegmentCTypeSubTlv struct { - obj *bgpSrteSegmentCTypeSubTlv -} - -type marshalBgpSrteSegmentCTypeSubTlv interface { - // ToProto marshals BgpSrteSegmentCTypeSubTlv to protobuf object *otg.BgpSrteSegmentCTypeSubTlv - ToProto() (*otg.BgpSrteSegmentCTypeSubTlv, error) - // ToPbText marshals BgpSrteSegmentCTypeSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSegmentCTypeSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSegmentCTypeSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSegmentCTypeSubTlv struct { - obj *bgpSrteSegmentCTypeSubTlv -} - -type unMarshalBgpSrteSegmentCTypeSubTlv interface { - // FromProto unmarshals BgpSrteSegmentCTypeSubTlv from protobuf object *otg.BgpSrteSegmentCTypeSubTlv - FromProto(msg *otg.BgpSrteSegmentCTypeSubTlv) (BgpSrteSegmentCTypeSubTlv, error) - // FromPbText unmarshals BgpSrteSegmentCTypeSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSegmentCTypeSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSegmentCTypeSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSegmentCTypeSubTlv) Marshal() marshalBgpSrteSegmentCTypeSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSegmentCTypeSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSegmentCTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentCTypeSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSegmentCTypeSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSegmentCTypeSubTlv) ToProto() (*otg.BgpSrteSegmentCTypeSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSegmentCTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentCTypeSubTlv) (BgpSrteSegmentCTypeSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSegmentCTypeSubTlv) 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 *unMarshalbgpSrteSegmentCTypeSubTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteSegmentCTypeSubTlv) 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 *unMarshalbgpSrteSegmentCTypeSubTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteSegmentCTypeSubTlv) 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 *unMarshalbgpSrteSegmentCTypeSubTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteSegmentCTypeSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentCTypeSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentCTypeSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSegmentCTypeSubTlv) Clone() (BgpSrteSegmentCTypeSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSegmentCTypeSubTlv() - 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 -} - -func (obj *bgpSrteSegmentCTypeSubTlv) setNil() { - obj.srMplsSidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteSegmentCTypeSubTlv is type C: IPv4 Node Address with optional SID. -type BgpSrteSegmentCTypeSubTlv interface { - Validation - // msg marshals BgpSrteSegmentCTypeSubTlv to protobuf object *otg.BgpSrteSegmentCTypeSubTlv - // and doesn't set defaults - msg() *otg.BgpSrteSegmentCTypeSubTlv - // setMsg unmarshals BgpSrteSegmentCTypeSubTlv from protobuf object *otg.BgpSrteSegmentCTypeSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteSegmentCTypeSubTlv) BgpSrteSegmentCTypeSubTlv - // provides marshal interface - Marshal() marshalBgpSrteSegmentCTypeSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSegmentCTypeSubTlv - // validate validates BgpSrteSegmentCTypeSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSegmentCTypeSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns string, set in BgpSrteSegmentCTypeSubTlv. - Flags() string - // SetFlags assigns string provided by user to BgpSrteSegmentCTypeSubTlv - SetFlags(value string) BgpSrteSegmentCTypeSubTlv - // HasFlags checks if Flags has been set in BgpSrteSegmentCTypeSubTlv - HasFlags() bool - // SrAlgorithm returns uint32, set in BgpSrteSegmentCTypeSubTlv. - SrAlgorithm() uint32 - // SetSrAlgorithm assigns uint32 provided by user to BgpSrteSegmentCTypeSubTlv - SetSrAlgorithm(value uint32) BgpSrteSegmentCTypeSubTlv - // HasSrAlgorithm checks if SrAlgorithm has been set in BgpSrteSegmentCTypeSubTlv - HasSrAlgorithm() bool - // Ipv4NodeAddress returns string, set in BgpSrteSegmentCTypeSubTlv. - Ipv4NodeAddress() string - // SetIpv4NodeAddress assigns string provided by user to BgpSrteSegmentCTypeSubTlv - SetIpv4NodeAddress(value string) BgpSrteSegmentCTypeSubTlv - // SrMplsSid returns BgpSrteSrMplsSid, set in BgpSrteSegmentCTypeSubTlv. - // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. - SrMplsSid() BgpSrteSrMplsSid - // SetSrMplsSid assigns BgpSrteSrMplsSid provided by user to BgpSrteSegmentCTypeSubTlv. - // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. - SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentCTypeSubTlv - // HasSrMplsSid checks if SrMplsSid has been set in BgpSrteSegmentCTypeSubTlv - HasSrMplsSid() bool - setNil() -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentCTypeSubTlv) Flags() string { - - return *obj.obj.Flags - -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentCTypeSubTlv) HasFlags() bool { - return obj.obj.Flags != nil -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// SetFlags sets the string value in the BgpSrteSegmentCTypeSubTlv object -func (obj *bgpSrteSegmentCTypeSubTlv) SetFlags(value string) BgpSrteSegmentCTypeSubTlv { - - obj.obj.Flags = &value - return obj -} - -// SR Algorithm identifier when A-Flag in on. -// SrAlgorithm returns a uint32 -func (obj *bgpSrteSegmentCTypeSubTlv) SrAlgorithm() uint32 { - - return *obj.obj.SrAlgorithm - -} - -// SR Algorithm identifier when A-Flag in on. -// SrAlgorithm returns a uint32 -func (obj *bgpSrteSegmentCTypeSubTlv) HasSrAlgorithm() bool { - return obj.obj.SrAlgorithm != nil -} - -// SR Algorithm identifier when A-Flag in on. -// SetSrAlgorithm sets the uint32 value in the BgpSrteSegmentCTypeSubTlv object -func (obj *bgpSrteSegmentCTypeSubTlv) SetSrAlgorithm(value uint32) BgpSrteSegmentCTypeSubTlv { - - obj.obj.SrAlgorithm = &value - return obj -} - -// IPv4 address representing a node. -// Ipv4NodeAddress returns a string -func (obj *bgpSrteSegmentCTypeSubTlv) Ipv4NodeAddress() string { - - return *obj.obj.Ipv4NodeAddress - -} - -// IPv4 address representing a node. -// SetIpv4NodeAddress sets the string value in the BgpSrteSegmentCTypeSubTlv object -func (obj *bgpSrteSegmentCTypeSubTlv) SetIpv4NodeAddress(value string) BgpSrteSegmentCTypeSubTlv { - - obj.obj.Ipv4NodeAddress = &value - return obj -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpSrteSrMplsSid -func (obj *bgpSrteSegmentCTypeSubTlv) SrMplsSid() BgpSrteSrMplsSid { - if obj.obj.SrMplsSid == nil { - obj.obj.SrMplsSid = NewBgpSrteSrMplsSid().msg() - } - if obj.srMplsSidHolder == nil { - obj.srMplsSidHolder = &bgpSrteSrMplsSid{obj: obj.obj.SrMplsSid} - } - return obj.srMplsSidHolder -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpSrteSrMplsSid -func (obj *bgpSrteSegmentCTypeSubTlv) HasSrMplsSid() bool { - return obj.obj.SrMplsSid != nil -} - -// Optional SR-MPLS SID. -// SetSrMplsSid sets the BgpSrteSrMplsSid value in the BgpSrteSegmentCTypeSubTlv object -func (obj *bgpSrteSegmentCTypeSubTlv) SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentCTypeSubTlv { - - obj.srMplsSidHolder = nil - obj.obj.SrMplsSid = value.msg() - - return obj -} - -func (obj *bgpSrteSegmentCTypeSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - err := obj.validateHex(obj.Flags()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentCTypeSubTlv.Flags")) - } - - } - - if obj.obj.SrAlgorithm != nil { - - if *obj.obj.SrAlgorithm > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpSrteSegmentCTypeSubTlv.SrAlgorithm <= 255 but Got %d", *obj.obj.SrAlgorithm)) - } - - } - - // Ipv4NodeAddress is required - if obj.obj.Ipv4NodeAddress == nil { - vObj.validationErrors = append(vObj.validationErrors, "Ipv4NodeAddress is required field on interface BgpSrteSegmentCTypeSubTlv") - } - if obj.obj.Ipv4NodeAddress != nil { - - err := obj.validateIpv4(obj.Ipv4NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentCTypeSubTlv.Ipv4NodeAddress")) - } - - } - - if obj.obj.SrMplsSid != nil { - - obj.SrMplsSid().validateObj(vObj, set_default) - } - -} - -func (obj *bgpSrteSegmentCTypeSubTlv) setDefault() { - if obj.obj.SrAlgorithm == nil { - obj.SetSrAlgorithm(0) - } - -} - -// ***** BgpSrteSegmentDTypeSubTlv ***** -type bgpSrteSegmentDTypeSubTlv struct { - validation - obj *otg.BgpSrteSegmentDTypeSubTlv - marshaller marshalBgpSrteSegmentDTypeSubTlv - unMarshaller unMarshalBgpSrteSegmentDTypeSubTlv - srMplsSidHolder BgpSrteSrMplsSid -} - -func NewBgpSrteSegmentDTypeSubTlv() BgpSrteSegmentDTypeSubTlv { - obj := bgpSrteSegmentDTypeSubTlv{obj: &otg.BgpSrteSegmentDTypeSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSegmentDTypeSubTlv) msg() *otg.BgpSrteSegmentDTypeSubTlv { - return obj.obj -} - -func (obj *bgpSrteSegmentDTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentDTypeSubTlv) BgpSrteSegmentDTypeSubTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSegmentDTypeSubTlv struct { - obj *bgpSrteSegmentDTypeSubTlv -} - -type marshalBgpSrteSegmentDTypeSubTlv interface { - // ToProto marshals BgpSrteSegmentDTypeSubTlv to protobuf object *otg.BgpSrteSegmentDTypeSubTlv - ToProto() (*otg.BgpSrteSegmentDTypeSubTlv, error) - // ToPbText marshals BgpSrteSegmentDTypeSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSegmentDTypeSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSegmentDTypeSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSegmentDTypeSubTlv struct { - obj *bgpSrteSegmentDTypeSubTlv -} - -type unMarshalBgpSrteSegmentDTypeSubTlv interface { - // FromProto unmarshals BgpSrteSegmentDTypeSubTlv from protobuf object *otg.BgpSrteSegmentDTypeSubTlv - FromProto(msg *otg.BgpSrteSegmentDTypeSubTlv) (BgpSrteSegmentDTypeSubTlv, error) - // FromPbText unmarshals BgpSrteSegmentDTypeSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSegmentDTypeSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSegmentDTypeSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSegmentDTypeSubTlv) Marshal() marshalBgpSrteSegmentDTypeSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSegmentDTypeSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSegmentDTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentDTypeSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSegmentDTypeSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSegmentDTypeSubTlv) ToProto() (*otg.BgpSrteSegmentDTypeSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSegmentDTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentDTypeSubTlv) (BgpSrteSegmentDTypeSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSegmentDTypeSubTlv) 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 *unMarshalbgpSrteSegmentDTypeSubTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteSegmentDTypeSubTlv) 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 *unMarshalbgpSrteSegmentDTypeSubTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteSegmentDTypeSubTlv) 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 *unMarshalbgpSrteSegmentDTypeSubTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteSegmentDTypeSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentDTypeSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentDTypeSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSegmentDTypeSubTlv) Clone() (BgpSrteSegmentDTypeSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSegmentDTypeSubTlv() - 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 -} - -func (obj *bgpSrteSegmentDTypeSubTlv) setNil() { - obj.srMplsSidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteSegmentDTypeSubTlv is type D: IPv6 Node Address with optional SID for SR MPLS. -type BgpSrteSegmentDTypeSubTlv interface { - Validation - // msg marshals BgpSrteSegmentDTypeSubTlv to protobuf object *otg.BgpSrteSegmentDTypeSubTlv - // and doesn't set defaults - msg() *otg.BgpSrteSegmentDTypeSubTlv - // setMsg unmarshals BgpSrteSegmentDTypeSubTlv from protobuf object *otg.BgpSrteSegmentDTypeSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteSegmentDTypeSubTlv) BgpSrteSegmentDTypeSubTlv - // provides marshal interface - Marshal() marshalBgpSrteSegmentDTypeSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSegmentDTypeSubTlv - // validate validates BgpSrteSegmentDTypeSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSegmentDTypeSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns string, set in BgpSrteSegmentDTypeSubTlv. - Flags() string - // SetFlags assigns string provided by user to BgpSrteSegmentDTypeSubTlv - SetFlags(value string) BgpSrteSegmentDTypeSubTlv - // HasFlags checks if Flags has been set in BgpSrteSegmentDTypeSubTlv - HasFlags() bool - // SrAlgorithm returns uint32, set in BgpSrteSegmentDTypeSubTlv. - SrAlgorithm() uint32 - // SetSrAlgorithm assigns uint32 provided by user to BgpSrteSegmentDTypeSubTlv - SetSrAlgorithm(value uint32) BgpSrteSegmentDTypeSubTlv - // HasSrAlgorithm checks if SrAlgorithm has been set in BgpSrteSegmentDTypeSubTlv - HasSrAlgorithm() bool - // Ipv6NodeAddress returns string, set in BgpSrteSegmentDTypeSubTlv. - Ipv6NodeAddress() string - // SetIpv6NodeAddress assigns string provided by user to BgpSrteSegmentDTypeSubTlv - SetIpv6NodeAddress(value string) BgpSrteSegmentDTypeSubTlv - // SrMplsSid returns BgpSrteSrMplsSid, set in BgpSrteSegmentDTypeSubTlv. - // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. - SrMplsSid() BgpSrteSrMplsSid - // SetSrMplsSid assigns BgpSrteSrMplsSid provided by user to BgpSrteSegmentDTypeSubTlv. - // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. - SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentDTypeSubTlv - // HasSrMplsSid checks if SrMplsSid has been set in BgpSrteSegmentDTypeSubTlv - HasSrMplsSid() bool - setNil() -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentDTypeSubTlv) Flags() string { - - return *obj.obj.Flags - -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentDTypeSubTlv) HasFlags() bool { - return obj.obj.Flags != nil -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// SetFlags sets the string value in the BgpSrteSegmentDTypeSubTlv object -func (obj *bgpSrteSegmentDTypeSubTlv) SetFlags(value string) BgpSrteSegmentDTypeSubTlv { - - obj.obj.Flags = &value - return obj -} - -// specifying SR Algorithm when when A-Flag as defined in above flags. -// SrAlgorithm returns a uint32 -func (obj *bgpSrteSegmentDTypeSubTlv) SrAlgorithm() uint32 { - - return *obj.obj.SrAlgorithm - -} - -// specifying SR Algorithm when when A-Flag as defined in above flags. -// SrAlgorithm returns a uint32 -func (obj *bgpSrteSegmentDTypeSubTlv) HasSrAlgorithm() bool { - return obj.obj.SrAlgorithm != nil -} - -// specifying SR Algorithm when when A-Flag as defined in above flags. -// SetSrAlgorithm sets the uint32 value in the BgpSrteSegmentDTypeSubTlv object -func (obj *bgpSrteSegmentDTypeSubTlv) SetSrAlgorithm(value uint32) BgpSrteSegmentDTypeSubTlv { - - obj.obj.SrAlgorithm = &value - return obj -} - -// IPv6 address representing a node. -// Ipv6NodeAddress returns a string -func (obj *bgpSrteSegmentDTypeSubTlv) Ipv6NodeAddress() string { - - return *obj.obj.Ipv6NodeAddress - -} - -// IPv6 address representing a node. -// SetIpv6NodeAddress sets the string value in the BgpSrteSegmentDTypeSubTlv object -func (obj *bgpSrteSegmentDTypeSubTlv) SetIpv6NodeAddress(value string) BgpSrteSegmentDTypeSubTlv { - - obj.obj.Ipv6NodeAddress = &value - return obj -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpSrteSrMplsSid -func (obj *bgpSrteSegmentDTypeSubTlv) SrMplsSid() BgpSrteSrMplsSid { - if obj.obj.SrMplsSid == nil { - obj.obj.SrMplsSid = NewBgpSrteSrMplsSid().msg() - } - if obj.srMplsSidHolder == nil { - obj.srMplsSidHolder = &bgpSrteSrMplsSid{obj: obj.obj.SrMplsSid} - } - return obj.srMplsSidHolder -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpSrteSrMplsSid -func (obj *bgpSrteSegmentDTypeSubTlv) HasSrMplsSid() bool { - return obj.obj.SrMplsSid != nil -} - -// Optional SR-MPLS SID. -// SetSrMplsSid sets the BgpSrteSrMplsSid value in the BgpSrteSegmentDTypeSubTlv object -func (obj *bgpSrteSegmentDTypeSubTlv) SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentDTypeSubTlv { - - obj.srMplsSidHolder = nil - obj.obj.SrMplsSid = value.msg() - - return obj -} - -func (obj *bgpSrteSegmentDTypeSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - err := obj.validateHex(obj.Flags()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentDTypeSubTlv.Flags")) - } - - } - - if obj.obj.SrAlgorithm != nil { - - if *obj.obj.SrAlgorithm > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpSrteSegmentDTypeSubTlv.SrAlgorithm <= 255 but Got %d", *obj.obj.SrAlgorithm)) - } - - } - - // Ipv6NodeAddress is required - if obj.obj.Ipv6NodeAddress == nil { - vObj.validationErrors = append(vObj.validationErrors, "Ipv6NodeAddress is required field on interface BgpSrteSegmentDTypeSubTlv") - } - if obj.obj.Ipv6NodeAddress != nil { - - err := obj.validateIpv6(obj.Ipv6NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentDTypeSubTlv.Ipv6NodeAddress")) - } - - } - - if obj.obj.SrMplsSid != nil { - - obj.SrMplsSid().validateObj(vObj, set_default) - } - -} - -func (obj *bgpSrteSegmentDTypeSubTlv) setDefault() { - if obj.obj.SrAlgorithm == nil { - obj.SetSrAlgorithm(0) - } - -} - -// ***** BgpSrteSegmentETypeSubTlv ***** -type bgpSrteSegmentETypeSubTlv struct { - validation - obj *otg.BgpSrteSegmentETypeSubTlv - marshaller marshalBgpSrteSegmentETypeSubTlv - unMarshaller unMarshalBgpSrteSegmentETypeSubTlv - srMplsSidHolder BgpSrteSrMplsSid -} - -func NewBgpSrteSegmentETypeSubTlv() BgpSrteSegmentETypeSubTlv { - obj := bgpSrteSegmentETypeSubTlv{obj: &otg.BgpSrteSegmentETypeSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSegmentETypeSubTlv) msg() *otg.BgpSrteSegmentETypeSubTlv { - return obj.obj -} - -func (obj *bgpSrteSegmentETypeSubTlv) setMsg(msg *otg.BgpSrteSegmentETypeSubTlv) BgpSrteSegmentETypeSubTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSegmentETypeSubTlv struct { - obj *bgpSrteSegmentETypeSubTlv -} - -type marshalBgpSrteSegmentETypeSubTlv interface { - // ToProto marshals BgpSrteSegmentETypeSubTlv to protobuf object *otg.BgpSrteSegmentETypeSubTlv - ToProto() (*otg.BgpSrteSegmentETypeSubTlv, error) - // ToPbText marshals BgpSrteSegmentETypeSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSegmentETypeSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSegmentETypeSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSegmentETypeSubTlv struct { - obj *bgpSrteSegmentETypeSubTlv -} - -type unMarshalBgpSrteSegmentETypeSubTlv interface { - // FromProto unmarshals BgpSrteSegmentETypeSubTlv from protobuf object *otg.BgpSrteSegmentETypeSubTlv - FromProto(msg *otg.BgpSrteSegmentETypeSubTlv) (BgpSrteSegmentETypeSubTlv, error) - // FromPbText unmarshals BgpSrteSegmentETypeSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSegmentETypeSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSegmentETypeSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSegmentETypeSubTlv) Marshal() marshalBgpSrteSegmentETypeSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSegmentETypeSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSegmentETypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentETypeSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSegmentETypeSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSegmentETypeSubTlv) ToProto() (*otg.BgpSrteSegmentETypeSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSegmentETypeSubTlv) FromProto(msg *otg.BgpSrteSegmentETypeSubTlv) (BgpSrteSegmentETypeSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSegmentETypeSubTlv) 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 *unMarshalbgpSrteSegmentETypeSubTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteSegmentETypeSubTlv) 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 *unMarshalbgpSrteSegmentETypeSubTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteSegmentETypeSubTlv) 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 *unMarshalbgpSrteSegmentETypeSubTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteSegmentETypeSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentETypeSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentETypeSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSegmentETypeSubTlv) Clone() (BgpSrteSegmentETypeSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSegmentETypeSubTlv() - 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 -} - -func (obj *bgpSrteSegmentETypeSubTlv) setNil() { - obj.srMplsSidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteSegmentETypeSubTlv is type E: IPv4 Address and Local Interface ID with optional SID -type BgpSrteSegmentETypeSubTlv interface { - Validation - // msg marshals BgpSrteSegmentETypeSubTlv to protobuf object *otg.BgpSrteSegmentETypeSubTlv - // and doesn't set defaults - msg() *otg.BgpSrteSegmentETypeSubTlv - // setMsg unmarshals BgpSrteSegmentETypeSubTlv from protobuf object *otg.BgpSrteSegmentETypeSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteSegmentETypeSubTlv) BgpSrteSegmentETypeSubTlv - // provides marshal interface - Marshal() marshalBgpSrteSegmentETypeSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSegmentETypeSubTlv - // validate validates BgpSrteSegmentETypeSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSegmentETypeSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns string, set in BgpSrteSegmentETypeSubTlv. - Flags() string - // SetFlags assigns string provided by user to BgpSrteSegmentETypeSubTlv - SetFlags(value string) BgpSrteSegmentETypeSubTlv - // HasFlags checks if Flags has been set in BgpSrteSegmentETypeSubTlv - HasFlags() bool - // LocalInterfaceId returns uint32, set in BgpSrteSegmentETypeSubTlv. - LocalInterfaceId() uint32 - // SetLocalInterfaceId assigns uint32 provided by user to BgpSrteSegmentETypeSubTlv - SetLocalInterfaceId(value uint32) BgpSrteSegmentETypeSubTlv - // HasLocalInterfaceId checks if LocalInterfaceId has been set in BgpSrteSegmentETypeSubTlv - HasLocalInterfaceId() bool - // Ipv4NodeAddress returns string, set in BgpSrteSegmentETypeSubTlv. - Ipv4NodeAddress() string - // SetIpv4NodeAddress assigns string provided by user to BgpSrteSegmentETypeSubTlv - SetIpv4NodeAddress(value string) BgpSrteSegmentETypeSubTlv - // SrMplsSid returns BgpSrteSrMplsSid, set in BgpSrteSegmentETypeSubTlv. - // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. - SrMplsSid() BgpSrteSrMplsSid - // SetSrMplsSid assigns BgpSrteSrMplsSid provided by user to BgpSrteSegmentETypeSubTlv. - // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. - SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentETypeSubTlv - // HasSrMplsSid checks if SrMplsSid has been set in BgpSrteSegmentETypeSubTlv - HasSrMplsSid() bool - setNil() -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentETypeSubTlv) Flags() string { - - return *obj.obj.Flags - -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentETypeSubTlv) HasFlags() bool { - return obj.obj.Flags != nil -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// SetFlags sets the string value in the BgpSrteSegmentETypeSubTlv object -func (obj *bgpSrteSegmentETypeSubTlv) SetFlags(value string) BgpSrteSegmentETypeSubTlv { - - obj.obj.Flags = &value - return obj -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// LocalInterfaceId returns a uint32 -func (obj *bgpSrteSegmentETypeSubTlv) LocalInterfaceId() uint32 { - - return *obj.obj.LocalInterfaceId - -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// LocalInterfaceId returns a uint32 -func (obj *bgpSrteSegmentETypeSubTlv) HasLocalInterfaceId() bool { - return obj.obj.LocalInterfaceId != nil -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// SetLocalInterfaceId sets the uint32 value in the BgpSrteSegmentETypeSubTlv object -func (obj *bgpSrteSegmentETypeSubTlv) SetLocalInterfaceId(value uint32) BgpSrteSegmentETypeSubTlv { - - obj.obj.LocalInterfaceId = &value - return obj -} - -// IPv4 address representing a node. -// Ipv4NodeAddress returns a string -func (obj *bgpSrteSegmentETypeSubTlv) Ipv4NodeAddress() string { - - return *obj.obj.Ipv4NodeAddress - -} - -// IPv4 address representing a node. -// SetIpv4NodeAddress sets the string value in the BgpSrteSegmentETypeSubTlv object -func (obj *bgpSrteSegmentETypeSubTlv) SetIpv4NodeAddress(value string) BgpSrteSegmentETypeSubTlv { - - obj.obj.Ipv4NodeAddress = &value - return obj -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpSrteSrMplsSid -func (obj *bgpSrteSegmentETypeSubTlv) SrMplsSid() BgpSrteSrMplsSid { - if obj.obj.SrMplsSid == nil { - obj.obj.SrMplsSid = NewBgpSrteSrMplsSid().msg() - } - if obj.srMplsSidHolder == nil { - obj.srMplsSidHolder = &bgpSrteSrMplsSid{obj: obj.obj.SrMplsSid} - } - return obj.srMplsSidHolder -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpSrteSrMplsSid -func (obj *bgpSrteSegmentETypeSubTlv) HasSrMplsSid() bool { - return obj.obj.SrMplsSid != nil -} - -// Optional SR-MPLS SID. -// SetSrMplsSid sets the BgpSrteSrMplsSid value in the BgpSrteSegmentETypeSubTlv object -func (obj *bgpSrteSegmentETypeSubTlv) SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentETypeSubTlv { - - obj.srMplsSidHolder = nil - obj.obj.SrMplsSid = value.msg() - - return obj -} - -func (obj *bgpSrteSegmentETypeSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - err := obj.validateHex(obj.Flags()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentETypeSubTlv.Flags")) - } - - } - - // Ipv4NodeAddress is required - if obj.obj.Ipv4NodeAddress == nil { - vObj.validationErrors = append(vObj.validationErrors, "Ipv4NodeAddress is required field on interface BgpSrteSegmentETypeSubTlv") - } - if obj.obj.Ipv4NodeAddress != nil { - - err := obj.validateIpv4(obj.Ipv4NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentETypeSubTlv.Ipv4NodeAddress")) - } - - } - - if obj.obj.SrMplsSid != nil { - - obj.SrMplsSid().validateObj(vObj, set_default) - } - -} - -func (obj *bgpSrteSegmentETypeSubTlv) setDefault() { - if obj.obj.LocalInterfaceId == nil { - obj.SetLocalInterfaceId(0) - } - -} - -// ***** BgpSrteSegmentFTypeSubTlv ***** -type bgpSrteSegmentFTypeSubTlv struct { - validation - obj *otg.BgpSrteSegmentFTypeSubTlv - marshaller marshalBgpSrteSegmentFTypeSubTlv - unMarshaller unMarshalBgpSrteSegmentFTypeSubTlv - srMplsSidHolder BgpSrteSrMplsSid -} - -func NewBgpSrteSegmentFTypeSubTlv() BgpSrteSegmentFTypeSubTlv { - obj := bgpSrteSegmentFTypeSubTlv{obj: &otg.BgpSrteSegmentFTypeSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSegmentFTypeSubTlv) msg() *otg.BgpSrteSegmentFTypeSubTlv { - return obj.obj -} - -func (obj *bgpSrteSegmentFTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentFTypeSubTlv) BgpSrteSegmentFTypeSubTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSegmentFTypeSubTlv struct { - obj *bgpSrteSegmentFTypeSubTlv -} - -type marshalBgpSrteSegmentFTypeSubTlv interface { - // ToProto marshals BgpSrteSegmentFTypeSubTlv to protobuf object *otg.BgpSrteSegmentFTypeSubTlv - ToProto() (*otg.BgpSrteSegmentFTypeSubTlv, error) - // ToPbText marshals BgpSrteSegmentFTypeSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSegmentFTypeSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSegmentFTypeSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSegmentFTypeSubTlv struct { - obj *bgpSrteSegmentFTypeSubTlv -} - -type unMarshalBgpSrteSegmentFTypeSubTlv interface { - // FromProto unmarshals BgpSrteSegmentFTypeSubTlv from protobuf object *otg.BgpSrteSegmentFTypeSubTlv - FromProto(msg *otg.BgpSrteSegmentFTypeSubTlv) (BgpSrteSegmentFTypeSubTlv, error) - // FromPbText unmarshals BgpSrteSegmentFTypeSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSegmentFTypeSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSegmentFTypeSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSegmentFTypeSubTlv) Marshal() marshalBgpSrteSegmentFTypeSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSegmentFTypeSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSegmentFTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentFTypeSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSegmentFTypeSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSegmentFTypeSubTlv) ToProto() (*otg.BgpSrteSegmentFTypeSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSegmentFTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentFTypeSubTlv) (BgpSrteSegmentFTypeSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSegmentFTypeSubTlv) 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 *unMarshalbgpSrteSegmentFTypeSubTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteSegmentFTypeSubTlv) 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 *unMarshalbgpSrteSegmentFTypeSubTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteSegmentFTypeSubTlv) 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 *unMarshalbgpSrteSegmentFTypeSubTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteSegmentFTypeSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentFTypeSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentFTypeSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSegmentFTypeSubTlv) Clone() (BgpSrteSegmentFTypeSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSegmentFTypeSubTlv() - 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 -} - -func (obj *bgpSrteSegmentFTypeSubTlv) setNil() { - obj.srMplsSidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteSegmentFTypeSubTlv is type F: IPv4 Local and Remote addresses with optional SID. -type BgpSrteSegmentFTypeSubTlv interface { - Validation - // msg marshals BgpSrteSegmentFTypeSubTlv to protobuf object *otg.BgpSrteSegmentFTypeSubTlv - // and doesn't set defaults - msg() *otg.BgpSrteSegmentFTypeSubTlv - // setMsg unmarshals BgpSrteSegmentFTypeSubTlv from protobuf object *otg.BgpSrteSegmentFTypeSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteSegmentFTypeSubTlv) BgpSrteSegmentFTypeSubTlv - // provides marshal interface - Marshal() marshalBgpSrteSegmentFTypeSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSegmentFTypeSubTlv - // validate validates BgpSrteSegmentFTypeSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSegmentFTypeSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns string, set in BgpSrteSegmentFTypeSubTlv. - Flags() string - // SetFlags assigns string provided by user to BgpSrteSegmentFTypeSubTlv - SetFlags(value string) BgpSrteSegmentFTypeSubTlv - // HasFlags checks if Flags has been set in BgpSrteSegmentFTypeSubTlv - HasFlags() bool - // LocalIpv4Address returns string, set in BgpSrteSegmentFTypeSubTlv. - LocalIpv4Address() string - // SetLocalIpv4Address assigns string provided by user to BgpSrteSegmentFTypeSubTlv - SetLocalIpv4Address(value string) BgpSrteSegmentFTypeSubTlv - // RemoteIpv4Address returns string, set in BgpSrteSegmentFTypeSubTlv. - RemoteIpv4Address() string - // SetRemoteIpv4Address assigns string provided by user to BgpSrteSegmentFTypeSubTlv - SetRemoteIpv4Address(value string) BgpSrteSegmentFTypeSubTlv - // SrMplsSid returns BgpSrteSrMplsSid, set in BgpSrteSegmentFTypeSubTlv. - // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. - SrMplsSid() BgpSrteSrMplsSid - // SetSrMplsSid assigns BgpSrteSrMplsSid provided by user to BgpSrteSegmentFTypeSubTlv. - // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. - SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentFTypeSubTlv - // HasSrMplsSid checks if SrMplsSid has been set in BgpSrteSegmentFTypeSubTlv - HasSrMplsSid() bool - setNil() -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentFTypeSubTlv) Flags() string { - - return *obj.obj.Flags - -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentFTypeSubTlv) HasFlags() bool { - return obj.obj.Flags != nil -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// SetFlags sets the string value in the BgpSrteSegmentFTypeSubTlv object -func (obj *bgpSrteSegmentFTypeSubTlv) SetFlags(value string) BgpSrteSegmentFTypeSubTlv { - - obj.obj.Flags = &value - return obj -} - -// Local IPv4 Address. -// LocalIpv4Address returns a string -func (obj *bgpSrteSegmentFTypeSubTlv) LocalIpv4Address() string { - - return *obj.obj.LocalIpv4Address - -} - -// Local IPv4 Address. -// SetLocalIpv4Address sets the string value in the BgpSrteSegmentFTypeSubTlv object -func (obj *bgpSrteSegmentFTypeSubTlv) SetLocalIpv4Address(value string) BgpSrteSegmentFTypeSubTlv { - - obj.obj.LocalIpv4Address = &value - return obj -} - -// Remote IPv4 Address. -// RemoteIpv4Address returns a string -func (obj *bgpSrteSegmentFTypeSubTlv) RemoteIpv4Address() string { - - return *obj.obj.RemoteIpv4Address - -} - -// Remote IPv4 Address. -// SetRemoteIpv4Address sets the string value in the BgpSrteSegmentFTypeSubTlv object -func (obj *bgpSrteSegmentFTypeSubTlv) SetRemoteIpv4Address(value string) BgpSrteSegmentFTypeSubTlv { - - obj.obj.RemoteIpv4Address = &value - return obj -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpSrteSrMplsSid -func (obj *bgpSrteSegmentFTypeSubTlv) SrMplsSid() BgpSrteSrMplsSid { - if obj.obj.SrMplsSid == nil { - obj.obj.SrMplsSid = NewBgpSrteSrMplsSid().msg() - } - if obj.srMplsSidHolder == nil { - obj.srMplsSidHolder = &bgpSrteSrMplsSid{obj: obj.obj.SrMplsSid} - } - return obj.srMplsSidHolder -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpSrteSrMplsSid -func (obj *bgpSrteSegmentFTypeSubTlv) HasSrMplsSid() bool { - return obj.obj.SrMplsSid != nil -} - -// Optional SR-MPLS SID. -// SetSrMplsSid sets the BgpSrteSrMplsSid value in the BgpSrteSegmentFTypeSubTlv object -func (obj *bgpSrteSegmentFTypeSubTlv) SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentFTypeSubTlv { - - obj.srMplsSidHolder = nil - obj.obj.SrMplsSid = value.msg() - - return obj -} - -func (obj *bgpSrteSegmentFTypeSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - err := obj.validateHex(obj.Flags()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentFTypeSubTlv.Flags")) - } - - } - - // LocalIpv4Address is required - if obj.obj.LocalIpv4Address == nil { - vObj.validationErrors = append(vObj.validationErrors, "LocalIpv4Address is required field on interface BgpSrteSegmentFTypeSubTlv") - } - if obj.obj.LocalIpv4Address != nil { - - err := obj.validateIpv4(obj.LocalIpv4Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentFTypeSubTlv.LocalIpv4Address")) - } - - } - - // RemoteIpv4Address is required - if obj.obj.RemoteIpv4Address == nil { - vObj.validationErrors = append(vObj.validationErrors, "RemoteIpv4Address is required field on interface BgpSrteSegmentFTypeSubTlv") - } - if obj.obj.RemoteIpv4Address != nil { - - err := obj.validateIpv4(obj.RemoteIpv4Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentFTypeSubTlv.RemoteIpv4Address")) - } - - } - - if obj.obj.SrMplsSid != nil { - - obj.SrMplsSid().validateObj(vObj, set_default) - } - -} - -func (obj *bgpSrteSegmentFTypeSubTlv) setDefault() { - -} - -// ***** BgpSrteSegmentGTypeSubTlv ***** -type bgpSrteSegmentGTypeSubTlv struct { - validation - obj *otg.BgpSrteSegmentGTypeSubTlv - marshaller marshalBgpSrteSegmentGTypeSubTlv - unMarshaller unMarshalBgpSrteSegmentGTypeSubTlv - srMplsSidHolder BgpSrteSrMplsSid -} - -func NewBgpSrteSegmentGTypeSubTlv() BgpSrteSegmentGTypeSubTlv { - obj := bgpSrteSegmentGTypeSubTlv{obj: &otg.BgpSrteSegmentGTypeSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSegmentGTypeSubTlv) msg() *otg.BgpSrteSegmentGTypeSubTlv { - return obj.obj -} - -func (obj *bgpSrteSegmentGTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentGTypeSubTlv) BgpSrteSegmentGTypeSubTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSegmentGTypeSubTlv struct { - obj *bgpSrteSegmentGTypeSubTlv -} - -type marshalBgpSrteSegmentGTypeSubTlv interface { - // ToProto marshals BgpSrteSegmentGTypeSubTlv to protobuf object *otg.BgpSrteSegmentGTypeSubTlv - ToProto() (*otg.BgpSrteSegmentGTypeSubTlv, error) - // ToPbText marshals BgpSrteSegmentGTypeSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSegmentGTypeSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSegmentGTypeSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSegmentGTypeSubTlv struct { - obj *bgpSrteSegmentGTypeSubTlv -} - -type unMarshalBgpSrteSegmentGTypeSubTlv interface { - // FromProto unmarshals BgpSrteSegmentGTypeSubTlv from protobuf object *otg.BgpSrteSegmentGTypeSubTlv - FromProto(msg *otg.BgpSrteSegmentGTypeSubTlv) (BgpSrteSegmentGTypeSubTlv, error) - // FromPbText unmarshals BgpSrteSegmentGTypeSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSegmentGTypeSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSegmentGTypeSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSegmentGTypeSubTlv) Marshal() marshalBgpSrteSegmentGTypeSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSegmentGTypeSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSegmentGTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentGTypeSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSegmentGTypeSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSegmentGTypeSubTlv) ToProto() (*otg.BgpSrteSegmentGTypeSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSegmentGTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentGTypeSubTlv) (BgpSrteSegmentGTypeSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSegmentGTypeSubTlv) 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 *unMarshalbgpSrteSegmentGTypeSubTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteSegmentGTypeSubTlv) 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 *unMarshalbgpSrteSegmentGTypeSubTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteSegmentGTypeSubTlv) 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 *unMarshalbgpSrteSegmentGTypeSubTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteSegmentGTypeSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentGTypeSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentGTypeSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSegmentGTypeSubTlv) Clone() (BgpSrteSegmentGTypeSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSegmentGTypeSubTlv() - 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 -} - -func (obj *bgpSrteSegmentGTypeSubTlv) setNil() { - obj.srMplsSidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteSegmentGTypeSubTlv is type G: IPv6 Address, Interface ID for local and remote pair with optional SID for SR MPLS. -type BgpSrteSegmentGTypeSubTlv interface { - Validation - // msg marshals BgpSrteSegmentGTypeSubTlv to protobuf object *otg.BgpSrteSegmentGTypeSubTlv - // and doesn't set defaults - msg() *otg.BgpSrteSegmentGTypeSubTlv - // setMsg unmarshals BgpSrteSegmentGTypeSubTlv from protobuf object *otg.BgpSrteSegmentGTypeSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteSegmentGTypeSubTlv) BgpSrteSegmentGTypeSubTlv - // provides marshal interface - Marshal() marshalBgpSrteSegmentGTypeSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSegmentGTypeSubTlv - // validate validates BgpSrteSegmentGTypeSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSegmentGTypeSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns string, set in BgpSrteSegmentGTypeSubTlv. - Flags() string - // SetFlags assigns string provided by user to BgpSrteSegmentGTypeSubTlv - SetFlags(value string) BgpSrteSegmentGTypeSubTlv - // HasFlags checks if Flags has been set in BgpSrteSegmentGTypeSubTlv - HasFlags() bool - // LocalInterfaceId returns uint32, set in BgpSrteSegmentGTypeSubTlv. - LocalInterfaceId() uint32 - // SetLocalInterfaceId assigns uint32 provided by user to BgpSrteSegmentGTypeSubTlv - SetLocalInterfaceId(value uint32) BgpSrteSegmentGTypeSubTlv - // HasLocalInterfaceId checks if LocalInterfaceId has been set in BgpSrteSegmentGTypeSubTlv - HasLocalInterfaceId() bool - // LocalIpv6NodeAddress returns string, set in BgpSrteSegmentGTypeSubTlv. - LocalIpv6NodeAddress() string - // SetLocalIpv6NodeAddress assigns string provided by user to BgpSrteSegmentGTypeSubTlv - SetLocalIpv6NodeAddress(value string) BgpSrteSegmentGTypeSubTlv - // RemoteInterfaceId returns uint32, set in BgpSrteSegmentGTypeSubTlv. - RemoteInterfaceId() uint32 - // SetRemoteInterfaceId assigns uint32 provided by user to BgpSrteSegmentGTypeSubTlv - SetRemoteInterfaceId(value uint32) BgpSrteSegmentGTypeSubTlv - // HasRemoteInterfaceId checks if RemoteInterfaceId has been set in BgpSrteSegmentGTypeSubTlv - HasRemoteInterfaceId() bool - // RemoteIpv6NodeAddress returns string, set in BgpSrteSegmentGTypeSubTlv. - RemoteIpv6NodeAddress() string - // SetRemoteIpv6NodeAddress assigns string provided by user to BgpSrteSegmentGTypeSubTlv - SetRemoteIpv6NodeAddress(value string) BgpSrteSegmentGTypeSubTlv - // SrMplsSid returns BgpSrteSrMplsSid, set in BgpSrteSegmentGTypeSubTlv. - // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. - SrMplsSid() BgpSrteSrMplsSid - // SetSrMplsSid assigns BgpSrteSrMplsSid provided by user to BgpSrteSegmentGTypeSubTlv. - // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. - SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentGTypeSubTlv - // HasSrMplsSid checks if SrMplsSid has been set in BgpSrteSegmentGTypeSubTlv - HasSrMplsSid() bool - setNil() -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentGTypeSubTlv) Flags() string { - - return *obj.obj.Flags - -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentGTypeSubTlv) HasFlags() bool { - return obj.obj.Flags != nil -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// SetFlags sets the string value in the BgpSrteSegmentGTypeSubTlv object -func (obj *bgpSrteSegmentGTypeSubTlv) SetFlags(value string) BgpSrteSegmentGTypeSubTlv { - - obj.obj.Flags = &value - return obj -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// LocalInterfaceId returns a uint32 -func (obj *bgpSrteSegmentGTypeSubTlv) LocalInterfaceId() uint32 { - - return *obj.obj.LocalInterfaceId - -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// LocalInterfaceId returns a uint32 -func (obj *bgpSrteSegmentGTypeSubTlv) HasLocalInterfaceId() bool { - return obj.obj.LocalInterfaceId != nil -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// SetLocalInterfaceId sets the uint32 value in the BgpSrteSegmentGTypeSubTlv object -func (obj *bgpSrteSegmentGTypeSubTlv) SetLocalInterfaceId(value uint32) BgpSrteSegmentGTypeSubTlv { - - obj.obj.LocalInterfaceId = &value - return obj -} - -// IPv6 address representing a node. -// LocalIpv6NodeAddress returns a string -func (obj *bgpSrteSegmentGTypeSubTlv) LocalIpv6NodeAddress() string { - - return *obj.obj.LocalIpv6NodeAddress - -} - -// IPv6 address representing a node. -// SetLocalIpv6NodeAddress sets the string value in the BgpSrteSegmentGTypeSubTlv object -func (obj *bgpSrteSegmentGTypeSubTlv) SetLocalIpv6NodeAddress(value string) BgpSrteSegmentGTypeSubTlv { - - obj.obj.LocalIpv6NodeAddress = &value - return obj -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// RemoteInterfaceId returns a uint32 -func (obj *bgpSrteSegmentGTypeSubTlv) RemoteInterfaceId() uint32 { - - return *obj.obj.RemoteInterfaceId - -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// RemoteInterfaceId returns a uint32 -func (obj *bgpSrteSegmentGTypeSubTlv) HasRemoteInterfaceId() bool { - return obj.obj.RemoteInterfaceId != nil -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// SetRemoteInterfaceId sets the uint32 value in the BgpSrteSegmentGTypeSubTlv object -func (obj *bgpSrteSegmentGTypeSubTlv) SetRemoteInterfaceId(value uint32) BgpSrteSegmentGTypeSubTlv { - - obj.obj.RemoteInterfaceId = &value - return obj -} - -// IPv6 address representing a node. -// RemoteIpv6NodeAddress returns a string -func (obj *bgpSrteSegmentGTypeSubTlv) RemoteIpv6NodeAddress() string { - - return *obj.obj.RemoteIpv6NodeAddress - -} - -// IPv6 address representing a node. -// SetRemoteIpv6NodeAddress sets the string value in the BgpSrteSegmentGTypeSubTlv object -func (obj *bgpSrteSegmentGTypeSubTlv) SetRemoteIpv6NodeAddress(value string) BgpSrteSegmentGTypeSubTlv { - - obj.obj.RemoteIpv6NodeAddress = &value - return obj -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpSrteSrMplsSid -func (obj *bgpSrteSegmentGTypeSubTlv) SrMplsSid() BgpSrteSrMplsSid { - if obj.obj.SrMplsSid == nil { - obj.obj.SrMplsSid = NewBgpSrteSrMplsSid().msg() - } - if obj.srMplsSidHolder == nil { - obj.srMplsSidHolder = &bgpSrteSrMplsSid{obj: obj.obj.SrMplsSid} - } - return obj.srMplsSidHolder -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpSrteSrMplsSid -func (obj *bgpSrteSegmentGTypeSubTlv) HasSrMplsSid() bool { - return obj.obj.SrMplsSid != nil -} - -// Optional SR-MPLS SID. -// SetSrMplsSid sets the BgpSrteSrMplsSid value in the BgpSrteSegmentGTypeSubTlv object -func (obj *bgpSrteSegmentGTypeSubTlv) SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentGTypeSubTlv { - - obj.srMplsSidHolder = nil - obj.obj.SrMplsSid = value.msg() - - return obj -} - -func (obj *bgpSrteSegmentGTypeSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - err := obj.validateHex(obj.Flags()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentGTypeSubTlv.Flags")) - } - - } - - // LocalIpv6NodeAddress is required - if obj.obj.LocalIpv6NodeAddress == nil { - vObj.validationErrors = append(vObj.validationErrors, "LocalIpv6NodeAddress is required field on interface BgpSrteSegmentGTypeSubTlv") - } - if obj.obj.LocalIpv6NodeAddress != nil { - - err := obj.validateIpv6(obj.LocalIpv6NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentGTypeSubTlv.LocalIpv6NodeAddress")) - } - - } - - // RemoteIpv6NodeAddress is required - if obj.obj.RemoteIpv6NodeAddress == nil { - vObj.validationErrors = append(vObj.validationErrors, "RemoteIpv6NodeAddress is required field on interface BgpSrteSegmentGTypeSubTlv") - } - if obj.obj.RemoteIpv6NodeAddress != nil { - - err := obj.validateIpv6(obj.RemoteIpv6NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentGTypeSubTlv.RemoteIpv6NodeAddress")) - } - - } - - if obj.obj.SrMplsSid != nil { - - obj.SrMplsSid().validateObj(vObj, set_default) - } - -} - -func (obj *bgpSrteSegmentGTypeSubTlv) setDefault() { - if obj.obj.LocalInterfaceId == nil { - obj.SetLocalInterfaceId(0) - } - if obj.obj.RemoteInterfaceId == nil { - obj.SetRemoteInterfaceId(0) - } - -} - -// ***** BgpSrteSegmentHTypeSubTlv ***** -type bgpSrteSegmentHTypeSubTlv struct { - validation - obj *otg.BgpSrteSegmentHTypeSubTlv - marshaller marshalBgpSrteSegmentHTypeSubTlv - unMarshaller unMarshalBgpSrteSegmentHTypeSubTlv - srMplsSidHolder BgpSrteSrMplsSid -} - -func NewBgpSrteSegmentHTypeSubTlv() BgpSrteSegmentHTypeSubTlv { - obj := bgpSrteSegmentHTypeSubTlv{obj: &otg.BgpSrteSegmentHTypeSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSegmentHTypeSubTlv) msg() *otg.BgpSrteSegmentHTypeSubTlv { - return obj.obj -} - -func (obj *bgpSrteSegmentHTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentHTypeSubTlv) BgpSrteSegmentHTypeSubTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSegmentHTypeSubTlv struct { - obj *bgpSrteSegmentHTypeSubTlv -} - -type marshalBgpSrteSegmentHTypeSubTlv interface { - // ToProto marshals BgpSrteSegmentHTypeSubTlv to protobuf object *otg.BgpSrteSegmentHTypeSubTlv - ToProto() (*otg.BgpSrteSegmentHTypeSubTlv, error) - // ToPbText marshals BgpSrteSegmentHTypeSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSegmentHTypeSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSegmentHTypeSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSegmentHTypeSubTlv struct { - obj *bgpSrteSegmentHTypeSubTlv -} - -type unMarshalBgpSrteSegmentHTypeSubTlv interface { - // FromProto unmarshals BgpSrteSegmentHTypeSubTlv from protobuf object *otg.BgpSrteSegmentHTypeSubTlv - FromProto(msg *otg.BgpSrteSegmentHTypeSubTlv) (BgpSrteSegmentHTypeSubTlv, error) - // FromPbText unmarshals BgpSrteSegmentHTypeSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSegmentHTypeSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSegmentHTypeSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSegmentHTypeSubTlv) Marshal() marshalBgpSrteSegmentHTypeSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSegmentHTypeSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSegmentHTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentHTypeSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSegmentHTypeSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSegmentHTypeSubTlv) ToProto() (*otg.BgpSrteSegmentHTypeSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSegmentHTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentHTypeSubTlv) (BgpSrteSegmentHTypeSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSegmentHTypeSubTlv) 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 *unMarshalbgpSrteSegmentHTypeSubTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteSegmentHTypeSubTlv) 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 *unMarshalbgpSrteSegmentHTypeSubTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteSegmentHTypeSubTlv) 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 *unMarshalbgpSrteSegmentHTypeSubTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteSegmentHTypeSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentHTypeSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentHTypeSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSegmentHTypeSubTlv) Clone() (BgpSrteSegmentHTypeSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSegmentHTypeSubTlv() - 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 -} - -func (obj *bgpSrteSegmentHTypeSubTlv) setNil() { - obj.srMplsSidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteSegmentHTypeSubTlv is type H: IPv6 Local and Remote addresses with optional SID for SR MPLS. -type BgpSrteSegmentHTypeSubTlv interface { - Validation - // msg marshals BgpSrteSegmentHTypeSubTlv to protobuf object *otg.BgpSrteSegmentHTypeSubTlv - // and doesn't set defaults - msg() *otg.BgpSrteSegmentHTypeSubTlv - // setMsg unmarshals BgpSrteSegmentHTypeSubTlv from protobuf object *otg.BgpSrteSegmentHTypeSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteSegmentHTypeSubTlv) BgpSrteSegmentHTypeSubTlv - // provides marshal interface - Marshal() marshalBgpSrteSegmentHTypeSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSegmentHTypeSubTlv - // validate validates BgpSrteSegmentHTypeSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSegmentHTypeSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns string, set in BgpSrteSegmentHTypeSubTlv. - Flags() string - // SetFlags assigns string provided by user to BgpSrteSegmentHTypeSubTlv - SetFlags(value string) BgpSrteSegmentHTypeSubTlv - // HasFlags checks if Flags has been set in BgpSrteSegmentHTypeSubTlv - HasFlags() bool - // LocalIpv6Address returns string, set in BgpSrteSegmentHTypeSubTlv. - LocalIpv6Address() string - // SetLocalIpv6Address assigns string provided by user to BgpSrteSegmentHTypeSubTlv - SetLocalIpv6Address(value string) BgpSrteSegmentHTypeSubTlv - // RemoteIpv6Address returns string, set in BgpSrteSegmentHTypeSubTlv. - RemoteIpv6Address() string - // SetRemoteIpv6Address assigns string provided by user to BgpSrteSegmentHTypeSubTlv - SetRemoteIpv6Address(value string) BgpSrteSegmentHTypeSubTlv - // SrMplsSid returns BgpSrteSrMplsSid, set in BgpSrteSegmentHTypeSubTlv. - // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. - SrMplsSid() BgpSrteSrMplsSid - // SetSrMplsSid assigns BgpSrteSrMplsSid provided by user to BgpSrteSegmentHTypeSubTlv. - // BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. - SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentHTypeSubTlv - // HasSrMplsSid checks if SrMplsSid has been set in BgpSrteSegmentHTypeSubTlv - HasSrMplsSid() bool - setNil() -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentHTypeSubTlv) Flags() string { - - return *obj.obj.Flags - -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentHTypeSubTlv) HasFlags() bool { - return obj.obj.Flags != nil -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// SetFlags sets the string value in the BgpSrteSegmentHTypeSubTlv object -func (obj *bgpSrteSegmentHTypeSubTlv) SetFlags(value string) BgpSrteSegmentHTypeSubTlv { - - obj.obj.Flags = &value - return obj -} - -// Local IPv6 Address. -// LocalIpv6Address returns a string -func (obj *bgpSrteSegmentHTypeSubTlv) LocalIpv6Address() string { - - return *obj.obj.LocalIpv6Address - -} - -// Local IPv6 Address. -// SetLocalIpv6Address sets the string value in the BgpSrteSegmentHTypeSubTlv object -func (obj *bgpSrteSegmentHTypeSubTlv) SetLocalIpv6Address(value string) BgpSrteSegmentHTypeSubTlv { - - obj.obj.LocalIpv6Address = &value - return obj -} - -// Remote IPv6 Address. -// RemoteIpv6Address returns a string -func (obj *bgpSrteSegmentHTypeSubTlv) RemoteIpv6Address() string { - - return *obj.obj.RemoteIpv6Address - -} - -// Remote IPv6 Address. -// SetRemoteIpv6Address sets the string value in the BgpSrteSegmentHTypeSubTlv object -func (obj *bgpSrteSegmentHTypeSubTlv) SetRemoteIpv6Address(value string) BgpSrteSegmentHTypeSubTlv { - - obj.obj.RemoteIpv6Address = &value - return obj -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpSrteSrMplsSid -func (obj *bgpSrteSegmentHTypeSubTlv) SrMplsSid() BgpSrteSrMplsSid { - if obj.obj.SrMplsSid == nil { - obj.obj.SrMplsSid = NewBgpSrteSrMplsSid().msg() - } - if obj.srMplsSidHolder == nil { - obj.srMplsSidHolder = &bgpSrteSrMplsSid{obj: obj.obj.SrMplsSid} - } - return obj.srMplsSidHolder -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpSrteSrMplsSid -func (obj *bgpSrteSegmentHTypeSubTlv) HasSrMplsSid() bool { - return obj.obj.SrMplsSid != nil -} - -// Optional SR-MPLS SID. -// SetSrMplsSid sets the BgpSrteSrMplsSid value in the BgpSrteSegmentHTypeSubTlv object -func (obj *bgpSrteSegmentHTypeSubTlv) SetSrMplsSid(value BgpSrteSrMplsSid) BgpSrteSegmentHTypeSubTlv { - - obj.srMplsSidHolder = nil - obj.obj.SrMplsSid = value.msg() - - return obj -} - -func (obj *bgpSrteSegmentHTypeSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - err := obj.validateHex(obj.Flags()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentHTypeSubTlv.Flags")) - } - - } - - // LocalIpv6Address is required - if obj.obj.LocalIpv6Address == nil { - vObj.validationErrors = append(vObj.validationErrors, "LocalIpv6Address is required field on interface BgpSrteSegmentHTypeSubTlv") - } - if obj.obj.LocalIpv6Address != nil { - - err := obj.validateIpv6(obj.LocalIpv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentHTypeSubTlv.LocalIpv6Address")) - } - - } - - // RemoteIpv6Address is required - if obj.obj.RemoteIpv6Address == nil { - vObj.validationErrors = append(vObj.validationErrors, "RemoteIpv6Address is required field on interface BgpSrteSegmentHTypeSubTlv") - } - if obj.obj.RemoteIpv6Address != nil { - - err := obj.validateIpv6(obj.RemoteIpv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentHTypeSubTlv.RemoteIpv6Address")) - } - - } - - if obj.obj.SrMplsSid != nil { - - obj.SrMplsSid().validateObj(vObj, set_default) - } - -} - -func (obj *bgpSrteSegmentHTypeSubTlv) setDefault() { - -} - -// ***** BgpSrteSegmentITypeSubTlv ***** -type bgpSrteSegmentITypeSubTlv struct { - validation - obj *otg.BgpSrteSegmentITypeSubTlv - marshaller marshalBgpSrteSegmentITypeSubTlv - unMarshaller unMarshalBgpSrteSegmentITypeSubTlv - srv6SidEndpointBehaviorHolder BgpSrteSRv6SIDEndpointBehaviorAndStructure -} - -func NewBgpSrteSegmentITypeSubTlv() BgpSrteSegmentITypeSubTlv { - obj := bgpSrteSegmentITypeSubTlv{obj: &otg.BgpSrteSegmentITypeSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSegmentITypeSubTlv) msg() *otg.BgpSrteSegmentITypeSubTlv { - return obj.obj -} - -func (obj *bgpSrteSegmentITypeSubTlv) setMsg(msg *otg.BgpSrteSegmentITypeSubTlv) BgpSrteSegmentITypeSubTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSegmentITypeSubTlv struct { - obj *bgpSrteSegmentITypeSubTlv -} - -type marshalBgpSrteSegmentITypeSubTlv interface { - // ToProto marshals BgpSrteSegmentITypeSubTlv to protobuf object *otg.BgpSrteSegmentITypeSubTlv - ToProto() (*otg.BgpSrteSegmentITypeSubTlv, error) - // ToPbText marshals BgpSrteSegmentITypeSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSegmentITypeSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSegmentITypeSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSegmentITypeSubTlv struct { - obj *bgpSrteSegmentITypeSubTlv -} - -type unMarshalBgpSrteSegmentITypeSubTlv interface { - // FromProto unmarshals BgpSrteSegmentITypeSubTlv from protobuf object *otg.BgpSrteSegmentITypeSubTlv - FromProto(msg *otg.BgpSrteSegmentITypeSubTlv) (BgpSrteSegmentITypeSubTlv, error) - // FromPbText unmarshals BgpSrteSegmentITypeSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSegmentITypeSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSegmentITypeSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSegmentITypeSubTlv) Marshal() marshalBgpSrteSegmentITypeSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSegmentITypeSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSegmentITypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentITypeSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSegmentITypeSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSegmentITypeSubTlv) ToProto() (*otg.BgpSrteSegmentITypeSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSegmentITypeSubTlv) FromProto(msg *otg.BgpSrteSegmentITypeSubTlv) (BgpSrteSegmentITypeSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSegmentITypeSubTlv) 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 *unMarshalbgpSrteSegmentITypeSubTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteSegmentITypeSubTlv) 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 *unMarshalbgpSrteSegmentITypeSubTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteSegmentITypeSubTlv) 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 *unMarshalbgpSrteSegmentITypeSubTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteSegmentITypeSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentITypeSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentITypeSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSegmentITypeSubTlv) Clone() (BgpSrteSegmentITypeSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSegmentITypeSubTlv() - 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 -} - -func (obj *bgpSrteSegmentITypeSubTlv) setNil() { - obj.srv6SidEndpointBehaviorHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteSegmentITypeSubTlv is type I: IPv6 Node Address with optional SRv6 SID. -type BgpSrteSegmentITypeSubTlv interface { - Validation - // msg marshals BgpSrteSegmentITypeSubTlv to protobuf object *otg.BgpSrteSegmentITypeSubTlv - // and doesn't set defaults - msg() *otg.BgpSrteSegmentITypeSubTlv - // setMsg unmarshals BgpSrteSegmentITypeSubTlv from protobuf object *otg.BgpSrteSegmentITypeSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteSegmentITypeSubTlv) BgpSrteSegmentITypeSubTlv - // provides marshal interface - Marshal() marshalBgpSrteSegmentITypeSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSegmentITypeSubTlv - // validate validates BgpSrteSegmentITypeSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSegmentITypeSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns string, set in BgpSrteSegmentITypeSubTlv. - Flags() string - // SetFlags assigns string provided by user to BgpSrteSegmentITypeSubTlv - SetFlags(value string) BgpSrteSegmentITypeSubTlv - // HasFlags checks if Flags has been set in BgpSrteSegmentITypeSubTlv - HasFlags() bool - // Ipv6NodeAddress returns string, set in BgpSrteSegmentITypeSubTlv. - Ipv6NodeAddress() string - // SetIpv6NodeAddress assigns string provided by user to BgpSrteSegmentITypeSubTlv - SetIpv6NodeAddress(value string) BgpSrteSegmentITypeSubTlv - // Srv6Sid returns string, set in BgpSrteSegmentITypeSubTlv. - Srv6Sid() string - // SetSrv6Sid assigns string provided by user to BgpSrteSegmentITypeSubTlv - SetSrv6Sid(value string) BgpSrteSegmentITypeSubTlv - // HasSrv6Sid checks if Srv6Sid has been set in BgpSrteSegmentITypeSubTlv - HasSrv6Sid() bool - // Srv6SidEndpointBehavior returns BgpSrteSRv6SIDEndpointBehaviorAndStructure, set in BgpSrteSegmentITypeSubTlv. - // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure - // SetSrv6SidEndpointBehavior assigns BgpSrteSRv6SIDEndpointBehaviorAndStructure provided by user to BgpSrteSegmentITypeSubTlv. - // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentITypeSubTlv - // HasSrv6SidEndpointBehavior checks if Srv6SidEndpointBehavior has been set in BgpSrteSegmentITypeSubTlv - HasSrv6SidEndpointBehavior() bool - setNil() -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentITypeSubTlv) Flags() string { - - return *obj.obj.Flags - -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentITypeSubTlv) HasFlags() bool { - return obj.obj.Flags != nil -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// SetFlags sets the string value in the BgpSrteSegmentITypeSubTlv object -func (obj *bgpSrteSegmentITypeSubTlv) SetFlags(value string) BgpSrteSegmentITypeSubTlv { - - obj.obj.Flags = &value - return obj -} - -// IPv6 address representing a node. -// Ipv6NodeAddress returns a string -func (obj *bgpSrteSegmentITypeSubTlv) Ipv6NodeAddress() string { - - return *obj.obj.Ipv6NodeAddress - -} - -// IPv6 address representing a node. -// SetIpv6NodeAddress sets the string value in the BgpSrteSegmentITypeSubTlv object -func (obj *bgpSrteSegmentITypeSubTlv) SetIpv6NodeAddress(value string) BgpSrteSegmentITypeSubTlv { - - obj.obj.Ipv6NodeAddress = &value - return obj -} - -// Optional SRv6 SID. -// Srv6Sid returns a string -func (obj *bgpSrteSegmentITypeSubTlv) Srv6Sid() string { - - return *obj.obj.Srv6Sid - -} - -// Optional SRv6 SID. -// Srv6Sid returns a string -func (obj *bgpSrteSegmentITypeSubTlv) HasSrv6Sid() bool { - return obj.obj.Srv6Sid != nil -} - -// Optional SRv6 SID. -// SetSrv6Sid sets the string value in the BgpSrteSegmentITypeSubTlv object -func (obj *bgpSrteSegmentITypeSubTlv) SetSrv6Sid(value string) BgpSrteSegmentITypeSubTlv { - - obj.obj.Srv6Sid = &value - return obj -} - -// Optional SRv6 Endpoint Behavior and SID Structure. -// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure -func (obj *bgpSrteSegmentITypeSubTlv) Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure { - if obj.obj.Srv6SidEndpointBehavior == nil { - obj.obj.Srv6SidEndpointBehavior = NewBgpSrteSRv6SIDEndpointBehaviorAndStructure().msg() - } - if obj.srv6SidEndpointBehaviorHolder == nil { - obj.srv6SidEndpointBehaviorHolder = &bgpSrteSRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6SidEndpointBehavior} - } - return obj.srv6SidEndpointBehaviorHolder -} - -// Optional SRv6 Endpoint Behavior and SID Structure. -// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure -func (obj *bgpSrteSegmentITypeSubTlv) HasSrv6SidEndpointBehavior() bool { - return obj.obj.Srv6SidEndpointBehavior != nil -} - -// Optional SRv6 Endpoint Behavior and SID Structure. -// SetSrv6SidEndpointBehavior sets the BgpSrteSRv6SIDEndpointBehaviorAndStructure value in the BgpSrteSegmentITypeSubTlv object -func (obj *bgpSrteSegmentITypeSubTlv) SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentITypeSubTlv { - - obj.srv6SidEndpointBehaviorHolder = nil - obj.obj.Srv6SidEndpointBehavior = value.msg() - - return obj -} - -func (obj *bgpSrteSegmentITypeSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - err := obj.validateHex(obj.Flags()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentITypeSubTlv.Flags")) - } - - } - - // Ipv6NodeAddress is required - if obj.obj.Ipv6NodeAddress == nil { - vObj.validationErrors = append(vObj.validationErrors, "Ipv6NodeAddress is required field on interface BgpSrteSegmentITypeSubTlv") - } - if obj.obj.Ipv6NodeAddress != nil { - - err := obj.validateIpv6(obj.Ipv6NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentITypeSubTlv.Ipv6NodeAddress")) - } - - } - - if obj.obj.Srv6Sid != nil { - - err := obj.validateIpv6(obj.Srv6Sid()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentITypeSubTlv.Srv6Sid")) - } - - } - - if obj.obj.Srv6SidEndpointBehavior != nil { - - obj.Srv6SidEndpointBehavior().validateObj(vObj, set_default) - } - -} - -func (obj *bgpSrteSegmentITypeSubTlv) setDefault() { - -} - -// ***** BgpSrteSegmentJTypeSubTlv ***** -type bgpSrteSegmentJTypeSubTlv struct { - validation - obj *otg.BgpSrteSegmentJTypeSubTlv - marshaller marshalBgpSrteSegmentJTypeSubTlv - unMarshaller unMarshalBgpSrteSegmentJTypeSubTlv - srv6SidEndpointBehaviorHolder BgpSrteSRv6SIDEndpointBehaviorAndStructure -} - -func NewBgpSrteSegmentJTypeSubTlv() BgpSrteSegmentJTypeSubTlv { - obj := bgpSrteSegmentJTypeSubTlv{obj: &otg.BgpSrteSegmentJTypeSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSegmentJTypeSubTlv) msg() *otg.BgpSrteSegmentJTypeSubTlv { - return obj.obj -} - -func (obj *bgpSrteSegmentJTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentJTypeSubTlv) BgpSrteSegmentJTypeSubTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSegmentJTypeSubTlv struct { - obj *bgpSrteSegmentJTypeSubTlv -} - -type marshalBgpSrteSegmentJTypeSubTlv interface { - // ToProto marshals BgpSrteSegmentJTypeSubTlv to protobuf object *otg.BgpSrteSegmentJTypeSubTlv - ToProto() (*otg.BgpSrteSegmentJTypeSubTlv, error) - // ToPbText marshals BgpSrteSegmentJTypeSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSegmentJTypeSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSegmentJTypeSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSegmentJTypeSubTlv struct { - obj *bgpSrteSegmentJTypeSubTlv -} - -type unMarshalBgpSrteSegmentJTypeSubTlv interface { - // FromProto unmarshals BgpSrteSegmentJTypeSubTlv from protobuf object *otg.BgpSrteSegmentJTypeSubTlv - FromProto(msg *otg.BgpSrteSegmentJTypeSubTlv) (BgpSrteSegmentJTypeSubTlv, error) - // FromPbText unmarshals BgpSrteSegmentJTypeSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSegmentJTypeSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSegmentJTypeSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSegmentJTypeSubTlv) Marshal() marshalBgpSrteSegmentJTypeSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSegmentJTypeSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSegmentJTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentJTypeSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSegmentJTypeSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSegmentJTypeSubTlv) ToProto() (*otg.BgpSrteSegmentJTypeSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSegmentJTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentJTypeSubTlv) (BgpSrteSegmentJTypeSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSegmentJTypeSubTlv) 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 *unMarshalbgpSrteSegmentJTypeSubTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteSegmentJTypeSubTlv) 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 *unMarshalbgpSrteSegmentJTypeSubTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteSegmentJTypeSubTlv) 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 *unMarshalbgpSrteSegmentJTypeSubTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteSegmentJTypeSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentJTypeSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentJTypeSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSegmentJTypeSubTlv) Clone() (BgpSrteSegmentJTypeSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSegmentJTypeSubTlv() - 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 -} - -func (obj *bgpSrteSegmentJTypeSubTlv) setNil() { - obj.srv6SidEndpointBehaviorHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteSegmentJTypeSubTlv is type J: IPv6 Address, Interface ID for local and remote pair for SRv6 with optional SID. -type BgpSrteSegmentJTypeSubTlv interface { - Validation - // msg marshals BgpSrteSegmentJTypeSubTlv to protobuf object *otg.BgpSrteSegmentJTypeSubTlv - // and doesn't set defaults - msg() *otg.BgpSrteSegmentJTypeSubTlv - // setMsg unmarshals BgpSrteSegmentJTypeSubTlv from protobuf object *otg.BgpSrteSegmentJTypeSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteSegmentJTypeSubTlv) BgpSrteSegmentJTypeSubTlv - // provides marshal interface - Marshal() marshalBgpSrteSegmentJTypeSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSegmentJTypeSubTlv - // validate validates BgpSrteSegmentJTypeSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSegmentJTypeSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns string, set in BgpSrteSegmentJTypeSubTlv. - Flags() string - // SetFlags assigns string provided by user to BgpSrteSegmentJTypeSubTlv - SetFlags(value string) BgpSrteSegmentJTypeSubTlv - // HasFlags checks if Flags has been set in BgpSrteSegmentJTypeSubTlv - HasFlags() bool - // SrAlgorithm returns uint32, set in BgpSrteSegmentJTypeSubTlv. - SrAlgorithm() uint32 - // SetSrAlgorithm assigns uint32 provided by user to BgpSrteSegmentJTypeSubTlv - SetSrAlgorithm(value uint32) BgpSrteSegmentJTypeSubTlv - // HasSrAlgorithm checks if SrAlgorithm has been set in BgpSrteSegmentJTypeSubTlv - HasSrAlgorithm() bool - // LocalInterfaceId returns uint32, set in BgpSrteSegmentJTypeSubTlv. - LocalInterfaceId() uint32 - // SetLocalInterfaceId assigns uint32 provided by user to BgpSrteSegmentJTypeSubTlv - SetLocalInterfaceId(value uint32) BgpSrteSegmentJTypeSubTlv - // HasLocalInterfaceId checks if LocalInterfaceId has been set in BgpSrteSegmentJTypeSubTlv - HasLocalInterfaceId() bool - // LocalIpv6NodeAddress returns string, set in BgpSrteSegmentJTypeSubTlv. - LocalIpv6NodeAddress() string - // SetLocalIpv6NodeAddress assigns string provided by user to BgpSrteSegmentJTypeSubTlv - SetLocalIpv6NodeAddress(value string) BgpSrteSegmentJTypeSubTlv - // RemoteInterfaceId returns uint32, set in BgpSrteSegmentJTypeSubTlv. - RemoteInterfaceId() uint32 - // SetRemoteInterfaceId assigns uint32 provided by user to BgpSrteSegmentJTypeSubTlv - SetRemoteInterfaceId(value uint32) BgpSrteSegmentJTypeSubTlv - // HasRemoteInterfaceId checks if RemoteInterfaceId has been set in BgpSrteSegmentJTypeSubTlv - HasRemoteInterfaceId() bool - // RemoteIpv6NodeAddress returns string, set in BgpSrteSegmentJTypeSubTlv. - RemoteIpv6NodeAddress() string - // SetRemoteIpv6NodeAddress assigns string provided by user to BgpSrteSegmentJTypeSubTlv - SetRemoteIpv6NodeAddress(value string) BgpSrteSegmentJTypeSubTlv - // Srv6Sid returns string, set in BgpSrteSegmentJTypeSubTlv. - Srv6Sid() string - // SetSrv6Sid assigns string provided by user to BgpSrteSegmentJTypeSubTlv - SetSrv6Sid(value string) BgpSrteSegmentJTypeSubTlv - // HasSrv6Sid checks if Srv6Sid has been set in BgpSrteSegmentJTypeSubTlv - HasSrv6Sid() bool - // Srv6SidEndpointBehavior returns BgpSrteSRv6SIDEndpointBehaviorAndStructure, set in BgpSrteSegmentJTypeSubTlv. - // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure - // SetSrv6SidEndpointBehavior assigns BgpSrteSRv6SIDEndpointBehaviorAndStructure provided by user to BgpSrteSegmentJTypeSubTlv. - // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentJTypeSubTlv - // HasSrv6SidEndpointBehavior checks if Srv6SidEndpointBehavior has been set in BgpSrteSegmentJTypeSubTlv - HasSrv6SidEndpointBehavior() bool - setNil() -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentJTypeSubTlv) Flags() string { - - return *obj.obj.Flags - -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentJTypeSubTlv) HasFlags() bool { - return obj.obj.Flags != nil -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// SetFlags sets the string value in the BgpSrteSegmentJTypeSubTlv object -func (obj *bgpSrteSegmentJTypeSubTlv) SetFlags(value string) BgpSrteSegmentJTypeSubTlv { - - obj.obj.Flags = &value - return obj -} - -// SR Algorithm identifier when A-Flag in on. -// SrAlgorithm returns a uint32 -func (obj *bgpSrteSegmentJTypeSubTlv) SrAlgorithm() uint32 { - - return *obj.obj.SrAlgorithm - -} - -// SR Algorithm identifier when A-Flag in on. -// SrAlgorithm returns a uint32 -func (obj *bgpSrteSegmentJTypeSubTlv) HasSrAlgorithm() bool { - return obj.obj.SrAlgorithm != nil -} - -// SR Algorithm identifier when A-Flag in on. -// SetSrAlgorithm sets the uint32 value in the BgpSrteSegmentJTypeSubTlv object -func (obj *bgpSrteSegmentJTypeSubTlv) SetSrAlgorithm(value uint32) BgpSrteSegmentJTypeSubTlv { - - obj.obj.SrAlgorithm = &value - return obj -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// LocalInterfaceId returns a uint32 -func (obj *bgpSrteSegmentJTypeSubTlv) LocalInterfaceId() uint32 { - - return *obj.obj.LocalInterfaceId - -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// LocalInterfaceId returns a uint32 -func (obj *bgpSrteSegmentJTypeSubTlv) HasLocalInterfaceId() bool { - return obj.obj.LocalInterfaceId != nil -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// SetLocalInterfaceId sets the uint32 value in the BgpSrteSegmentJTypeSubTlv object -func (obj *bgpSrteSegmentJTypeSubTlv) SetLocalInterfaceId(value uint32) BgpSrteSegmentJTypeSubTlv { - - obj.obj.LocalInterfaceId = &value - return obj -} - -// IPv6 address representing a node. -// LocalIpv6NodeAddress returns a string -func (obj *bgpSrteSegmentJTypeSubTlv) LocalIpv6NodeAddress() string { - - return *obj.obj.LocalIpv6NodeAddress - -} - -// IPv6 address representing a node. -// SetLocalIpv6NodeAddress sets the string value in the BgpSrteSegmentJTypeSubTlv object -func (obj *bgpSrteSegmentJTypeSubTlv) SetLocalIpv6NodeAddress(value string) BgpSrteSegmentJTypeSubTlv { - - obj.obj.LocalIpv6NodeAddress = &value - return obj -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// RemoteInterfaceId returns a uint32 -func (obj *bgpSrteSegmentJTypeSubTlv) RemoteInterfaceId() uint32 { - - return *obj.obj.RemoteInterfaceId - -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// RemoteInterfaceId returns a uint32 -func (obj *bgpSrteSegmentJTypeSubTlv) HasRemoteInterfaceId() bool { - return obj.obj.RemoteInterfaceId != nil -} - -// Local Interface ID: The Interface Index as defined in [RFC8664]. -// SetRemoteInterfaceId sets the uint32 value in the BgpSrteSegmentJTypeSubTlv object -func (obj *bgpSrteSegmentJTypeSubTlv) SetRemoteInterfaceId(value uint32) BgpSrteSegmentJTypeSubTlv { - - obj.obj.RemoteInterfaceId = &value - return obj -} - -// IPv6 address representing a node. -// RemoteIpv6NodeAddress returns a string -func (obj *bgpSrteSegmentJTypeSubTlv) RemoteIpv6NodeAddress() string { - - return *obj.obj.RemoteIpv6NodeAddress - -} - -// IPv6 address representing a node. -// SetRemoteIpv6NodeAddress sets the string value in the BgpSrteSegmentJTypeSubTlv object -func (obj *bgpSrteSegmentJTypeSubTlv) SetRemoteIpv6NodeAddress(value string) BgpSrteSegmentJTypeSubTlv { - - obj.obj.RemoteIpv6NodeAddress = &value - return obj -} - -// Optional SRv6 SID. -// Srv6Sid returns a string -func (obj *bgpSrteSegmentJTypeSubTlv) Srv6Sid() string { - - return *obj.obj.Srv6Sid - -} - -// Optional SRv6 SID. -// Srv6Sid returns a string -func (obj *bgpSrteSegmentJTypeSubTlv) HasSrv6Sid() bool { - return obj.obj.Srv6Sid != nil -} - -// Optional SRv6 SID. -// SetSrv6Sid sets the string value in the BgpSrteSegmentJTypeSubTlv object -func (obj *bgpSrteSegmentJTypeSubTlv) SetSrv6Sid(value string) BgpSrteSegmentJTypeSubTlv { - - obj.obj.Srv6Sid = &value - return obj -} - -// Optional SRv6 Endpoint Behavior and SID Structure. -// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure -func (obj *bgpSrteSegmentJTypeSubTlv) Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure { - if obj.obj.Srv6SidEndpointBehavior == nil { - obj.obj.Srv6SidEndpointBehavior = NewBgpSrteSRv6SIDEndpointBehaviorAndStructure().msg() - } - if obj.srv6SidEndpointBehaviorHolder == nil { - obj.srv6SidEndpointBehaviorHolder = &bgpSrteSRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6SidEndpointBehavior} - } - return obj.srv6SidEndpointBehaviorHolder -} - -// Optional SRv6 Endpoint Behavior and SID Structure. -// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure -func (obj *bgpSrteSegmentJTypeSubTlv) HasSrv6SidEndpointBehavior() bool { - return obj.obj.Srv6SidEndpointBehavior != nil -} - -// Optional SRv6 Endpoint Behavior and SID Structure. -// SetSrv6SidEndpointBehavior sets the BgpSrteSRv6SIDEndpointBehaviorAndStructure value in the BgpSrteSegmentJTypeSubTlv object -func (obj *bgpSrteSegmentJTypeSubTlv) SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentJTypeSubTlv { - - obj.srv6SidEndpointBehaviorHolder = nil - obj.obj.Srv6SidEndpointBehavior = value.msg() - - return obj -} - -func (obj *bgpSrteSegmentJTypeSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - err := obj.validateHex(obj.Flags()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentJTypeSubTlv.Flags")) - } - - } - - // LocalIpv6NodeAddress is required - if obj.obj.LocalIpv6NodeAddress == nil { - vObj.validationErrors = append(vObj.validationErrors, "LocalIpv6NodeAddress is required field on interface BgpSrteSegmentJTypeSubTlv") - } - if obj.obj.LocalIpv6NodeAddress != nil { - - err := obj.validateIpv6(obj.LocalIpv6NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentJTypeSubTlv.LocalIpv6NodeAddress")) - } - - } - - // RemoteIpv6NodeAddress is required - if obj.obj.RemoteIpv6NodeAddress == nil { - vObj.validationErrors = append(vObj.validationErrors, "RemoteIpv6NodeAddress is required field on interface BgpSrteSegmentJTypeSubTlv") - } - if obj.obj.RemoteIpv6NodeAddress != nil { - - err := obj.validateIpv6(obj.RemoteIpv6NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentJTypeSubTlv.RemoteIpv6NodeAddress")) - } - - } - - if obj.obj.Srv6Sid != nil { - - err := obj.validateIpv6(obj.Srv6Sid()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentJTypeSubTlv.Srv6Sid")) - } - - } - - if obj.obj.Srv6SidEndpointBehavior != nil { - - obj.Srv6SidEndpointBehavior().validateObj(vObj, set_default) - } - -} - -func (obj *bgpSrteSegmentJTypeSubTlv) setDefault() { - if obj.obj.SrAlgorithm == nil { - obj.SetSrAlgorithm(0) - } - if obj.obj.LocalInterfaceId == nil { - obj.SetLocalInterfaceId(0) - } - if obj.obj.RemoteInterfaceId == nil { - obj.SetRemoteInterfaceId(0) - } - -} - -// ***** BgpSrteSegmentKTypeSubTlv ***** -type bgpSrteSegmentKTypeSubTlv struct { - validation - obj *otg.BgpSrteSegmentKTypeSubTlv - marshaller marshalBgpSrteSegmentKTypeSubTlv - unMarshaller unMarshalBgpSrteSegmentKTypeSubTlv - srv6SidEndpointBehaviorHolder BgpSrteSRv6SIDEndpointBehaviorAndStructure -} - -func NewBgpSrteSegmentKTypeSubTlv() BgpSrteSegmentKTypeSubTlv { - obj := bgpSrteSegmentKTypeSubTlv{obj: &otg.BgpSrteSegmentKTypeSubTlv{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSegmentKTypeSubTlv) msg() *otg.BgpSrteSegmentKTypeSubTlv { - return obj.obj -} - -func (obj *bgpSrteSegmentKTypeSubTlv) setMsg(msg *otg.BgpSrteSegmentKTypeSubTlv) BgpSrteSegmentKTypeSubTlv { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSegmentKTypeSubTlv struct { - obj *bgpSrteSegmentKTypeSubTlv -} - -type marshalBgpSrteSegmentKTypeSubTlv interface { - // ToProto marshals BgpSrteSegmentKTypeSubTlv to protobuf object *otg.BgpSrteSegmentKTypeSubTlv - ToProto() (*otg.BgpSrteSegmentKTypeSubTlv, error) - // ToPbText marshals BgpSrteSegmentKTypeSubTlv to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSegmentKTypeSubTlv to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSegmentKTypeSubTlv to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSegmentKTypeSubTlv struct { - obj *bgpSrteSegmentKTypeSubTlv -} - -type unMarshalBgpSrteSegmentKTypeSubTlv interface { - // FromProto unmarshals BgpSrteSegmentKTypeSubTlv from protobuf object *otg.BgpSrteSegmentKTypeSubTlv - FromProto(msg *otg.BgpSrteSegmentKTypeSubTlv) (BgpSrteSegmentKTypeSubTlv, error) - // FromPbText unmarshals BgpSrteSegmentKTypeSubTlv from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSegmentKTypeSubTlv from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSegmentKTypeSubTlv from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSegmentKTypeSubTlv) Marshal() marshalBgpSrteSegmentKTypeSubTlv { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSegmentKTypeSubTlv{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSegmentKTypeSubTlv) Unmarshal() unMarshalBgpSrteSegmentKTypeSubTlv { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSegmentKTypeSubTlv{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSegmentKTypeSubTlv) ToProto() (*otg.BgpSrteSegmentKTypeSubTlv, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSegmentKTypeSubTlv) FromProto(msg *otg.BgpSrteSegmentKTypeSubTlv) (BgpSrteSegmentKTypeSubTlv, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSegmentKTypeSubTlv) 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 *unMarshalbgpSrteSegmentKTypeSubTlv) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpSrteSegmentKTypeSubTlv) 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 *unMarshalbgpSrteSegmentKTypeSubTlv) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpSrteSegmentKTypeSubTlv) 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 *unMarshalbgpSrteSegmentKTypeSubTlv) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpSrteSegmentKTypeSubTlv) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentKTypeSubTlv) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSegmentKTypeSubTlv) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSegmentKTypeSubTlv) Clone() (BgpSrteSegmentKTypeSubTlv, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSegmentKTypeSubTlv() - 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 -} - -func (obj *bgpSrteSegmentKTypeSubTlv) setNil() { - obj.srv6SidEndpointBehaviorHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpSrteSegmentKTypeSubTlv is type K: IPv6 Local and Remote addresses for SRv6 with optional SID. -type BgpSrteSegmentKTypeSubTlv interface { - Validation - // msg marshals BgpSrteSegmentKTypeSubTlv to protobuf object *otg.BgpSrteSegmentKTypeSubTlv - // and doesn't set defaults - msg() *otg.BgpSrteSegmentKTypeSubTlv - // setMsg unmarshals BgpSrteSegmentKTypeSubTlv from protobuf object *otg.BgpSrteSegmentKTypeSubTlv - // and doesn't set defaults - setMsg(*otg.BgpSrteSegmentKTypeSubTlv) BgpSrteSegmentKTypeSubTlv - // provides marshal interface - Marshal() marshalBgpSrteSegmentKTypeSubTlv - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSegmentKTypeSubTlv - // validate validates BgpSrteSegmentKTypeSubTlv - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSegmentKTypeSubTlv, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns string, set in BgpSrteSegmentKTypeSubTlv. - Flags() string - // SetFlags assigns string provided by user to BgpSrteSegmentKTypeSubTlv - SetFlags(value string) BgpSrteSegmentKTypeSubTlv - // HasFlags checks if Flags has been set in BgpSrteSegmentKTypeSubTlv - HasFlags() bool - // SrAlgorithm returns uint32, set in BgpSrteSegmentKTypeSubTlv. - SrAlgorithm() uint32 - // SetSrAlgorithm assigns uint32 provided by user to BgpSrteSegmentKTypeSubTlv - SetSrAlgorithm(value uint32) BgpSrteSegmentKTypeSubTlv - // HasSrAlgorithm checks if SrAlgorithm has been set in BgpSrteSegmentKTypeSubTlv - HasSrAlgorithm() bool - // LocalIpv6Address returns string, set in BgpSrteSegmentKTypeSubTlv. - LocalIpv6Address() string - // SetLocalIpv6Address assigns string provided by user to BgpSrteSegmentKTypeSubTlv - SetLocalIpv6Address(value string) BgpSrteSegmentKTypeSubTlv - // RemoteIpv6Address returns string, set in BgpSrteSegmentKTypeSubTlv. - RemoteIpv6Address() string - // SetRemoteIpv6Address assigns string provided by user to BgpSrteSegmentKTypeSubTlv - SetRemoteIpv6Address(value string) BgpSrteSegmentKTypeSubTlv - // Srv6Sid returns string, set in BgpSrteSegmentKTypeSubTlv. - Srv6Sid() string - // SetSrv6Sid assigns string provided by user to BgpSrteSegmentKTypeSubTlv - SetSrv6Sid(value string) BgpSrteSegmentKTypeSubTlv - // HasSrv6Sid checks if Srv6Sid has been set in BgpSrteSegmentKTypeSubTlv - HasSrv6Sid() bool - // Srv6SidEndpointBehavior returns BgpSrteSRv6SIDEndpointBehaviorAndStructure, set in BgpSrteSegmentKTypeSubTlv. - // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure - // SetSrv6SidEndpointBehavior assigns BgpSrteSRv6SIDEndpointBehaviorAndStructure provided by user to BgpSrteSegmentKTypeSubTlv. - // BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentKTypeSubTlv - // HasSrv6SidEndpointBehavior checks if Srv6SidEndpointBehavior has been set in BgpSrteSegmentKTypeSubTlv - HasSrv6SidEndpointBehavior() bool - setNil() -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentKTypeSubTlv) Flags() string { - - return *obj.obj.Flags - -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// Flags returns a string -func (obj *bgpSrteSegmentKTypeSubTlv) HasFlags() bool { - return obj.obj.Flags != nil -} - -// One octet bitmap for flags including V-Flag, A-Flag, S-Flag, B-Flag etc. as defined in https://datatracker.ietf.org/doc/html/draft-ietf-idr-segment-routing-te-policy-13#section-2.4.4.2.12 -// SetFlags sets the string value in the BgpSrteSegmentKTypeSubTlv object -func (obj *bgpSrteSegmentKTypeSubTlv) SetFlags(value string) BgpSrteSegmentKTypeSubTlv { - - obj.obj.Flags = &value - return obj -} - -// SR Algorithm identifier when A-Flag in on. -// SrAlgorithm returns a uint32 -func (obj *bgpSrteSegmentKTypeSubTlv) SrAlgorithm() uint32 { - - return *obj.obj.SrAlgorithm - -} - -// SR Algorithm identifier when A-Flag in on. -// SrAlgorithm returns a uint32 -func (obj *bgpSrteSegmentKTypeSubTlv) HasSrAlgorithm() bool { - return obj.obj.SrAlgorithm != nil -} - -// SR Algorithm identifier when A-Flag in on. -// SetSrAlgorithm sets the uint32 value in the BgpSrteSegmentKTypeSubTlv object -func (obj *bgpSrteSegmentKTypeSubTlv) SetSrAlgorithm(value uint32) BgpSrteSegmentKTypeSubTlv { - - obj.obj.SrAlgorithm = &value - return obj -} - -// IPv6 address representing a node. -// LocalIpv6Address returns a string -func (obj *bgpSrteSegmentKTypeSubTlv) LocalIpv6Address() string { - - return *obj.obj.LocalIpv6Address - -} - -// IPv6 address representing a node. -// SetLocalIpv6Address sets the string value in the BgpSrteSegmentKTypeSubTlv object -func (obj *bgpSrteSegmentKTypeSubTlv) SetLocalIpv6Address(value string) BgpSrteSegmentKTypeSubTlv { - - obj.obj.LocalIpv6Address = &value - return obj -} - -// IPv6 address representing a node. -// RemoteIpv6Address returns a string -func (obj *bgpSrteSegmentKTypeSubTlv) RemoteIpv6Address() string { - - return *obj.obj.RemoteIpv6Address - -} - -// IPv6 address representing a node. -// SetRemoteIpv6Address sets the string value in the BgpSrteSegmentKTypeSubTlv object -func (obj *bgpSrteSegmentKTypeSubTlv) SetRemoteIpv6Address(value string) BgpSrteSegmentKTypeSubTlv { - - obj.obj.RemoteIpv6Address = &value - return obj -} - -// Optional SRv6 SID. -// Srv6Sid returns a string -func (obj *bgpSrteSegmentKTypeSubTlv) Srv6Sid() string { - - return *obj.obj.Srv6Sid - -} - -// Optional SRv6 SID. -// Srv6Sid returns a string -func (obj *bgpSrteSegmentKTypeSubTlv) HasSrv6Sid() bool { - return obj.obj.Srv6Sid != nil -} - -// Optional SRv6 SID. -// SetSrv6Sid sets the string value in the BgpSrteSegmentKTypeSubTlv object -func (obj *bgpSrteSegmentKTypeSubTlv) SetSrv6Sid(value string) BgpSrteSegmentKTypeSubTlv { - - obj.obj.Srv6Sid = &value - return obj -} - -// Optional SRv6 Endpoint Behavior and SID Structure. -// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure -func (obj *bgpSrteSegmentKTypeSubTlv) Srv6SidEndpointBehavior() BgpSrteSRv6SIDEndpointBehaviorAndStructure { - if obj.obj.Srv6SidEndpointBehavior == nil { - obj.obj.Srv6SidEndpointBehavior = NewBgpSrteSRv6SIDEndpointBehaviorAndStructure().msg() - } - if obj.srv6SidEndpointBehaviorHolder == nil { - obj.srv6SidEndpointBehaviorHolder = &bgpSrteSRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6SidEndpointBehavior} - } - return obj.srv6SidEndpointBehaviorHolder -} - -// Optional SRv6 Endpoint Behavior and SID Structure. -// Srv6SidEndpointBehavior returns a BgpSrteSRv6SIDEndpointBehaviorAndStructure -func (obj *bgpSrteSegmentKTypeSubTlv) HasSrv6SidEndpointBehavior() bool { - return obj.obj.Srv6SidEndpointBehavior != nil -} - -// Optional SRv6 Endpoint Behavior and SID Structure. -// SetSrv6SidEndpointBehavior sets the BgpSrteSRv6SIDEndpointBehaviorAndStructure value in the BgpSrteSegmentKTypeSubTlv object -func (obj *bgpSrteSegmentKTypeSubTlv) SetSrv6SidEndpointBehavior(value BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSegmentKTypeSubTlv { - - obj.srv6SidEndpointBehaviorHolder = nil - obj.obj.Srv6SidEndpointBehavior = value.msg() - - return obj -} - -func (obj *bgpSrteSegmentKTypeSubTlv) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - err := obj.validateHex(obj.Flags()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentKTypeSubTlv.Flags")) - } - - } - - // LocalIpv6Address is required - if obj.obj.LocalIpv6Address == nil { - vObj.validationErrors = append(vObj.validationErrors, "LocalIpv6Address is required field on interface BgpSrteSegmentKTypeSubTlv") - } - if obj.obj.LocalIpv6Address != nil { - - err := obj.validateIpv6(obj.LocalIpv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentKTypeSubTlv.LocalIpv6Address")) - } - - } - - // RemoteIpv6Address is required - if obj.obj.RemoteIpv6Address == nil { - vObj.validationErrors = append(vObj.validationErrors, "RemoteIpv6Address is required field on interface BgpSrteSegmentKTypeSubTlv") - } - if obj.obj.RemoteIpv6Address != nil { - - err := obj.validateIpv6(obj.RemoteIpv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentKTypeSubTlv.RemoteIpv6Address")) - } - - } - - if obj.obj.Srv6Sid != nil { - - err := obj.validateIpv6(obj.Srv6Sid()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpSrteSegmentKTypeSubTlv.Srv6Sid")) - } - - } - - if obj.obj.Srv6SidEndpointBehavior != nil { - - obj.Srv6SidEndpointBehavior().validateObj(vObj, set_default) - } - -} - -func (obj *bgpSrteSegmentKTypeSubTlv) setDefault() { - if obj.obj.SrAlgorithm == nil { - obj.SetSrAlgorithm(0) - } - -} - -// ***** BgpAttributesOtherAttribute ***** -type bgpAttributesOtherAttribute struct { - validation - obj *otg.BgpAttributesOtherAttribute - marshaller marshalBgpAttributesOtherAttribute - unMarshaller unMarshalBgpAttributesOtherAttribute -} - -func NewBgpAttributesOtherAttribute() BgpAttributesOtherAttribute { - obj := bgpAttributesOtherAttribute{obj: &otg.BgpAttributesOtherAttribute{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesOtherAttribute) msg() *otg.BgpAttributesOtherAttribute { - return obj.obj -} - -func (obj *bgpAttributesOtherAttribute) setMsg(msg *otg.BgpAttributesOtherAttribute) BgpAttributesOtherAttribute { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesOtherAttribute struct { - obj *bgpAttributesOtherAttribute -} - -type marshalBgpAttributesOtherAttribute interface { - // ToProto marshals BgpAttributesOtherAttribute to protobuf object *otg.BgpAttributesOtherAttribute - ToProto() (*otg.BgpAttributesOtherAttribute, error) - // ToPbText marshals BgpAttributesOtherAttribute to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesOtherAttribute to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesOtherAttribute to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesOtherAttribute struct { - obj *bgpAttributesOtherAttribute -} - -type unMarshalBgpAttributesOtherAttribute interface { - // FromProto unmarshals BgpAttributesOtherAttribute from protobuf object *otg.BgpAttributesOtherAttribute - FromProto(msg *otg.BgpAttributesOtherAttribute) (BgpAttributesOtherAttribute, error) - // FromPbText unmarshals BgpAttributesOtherAttribute from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesOtherAttribute from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesOtherAttribute from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesOtherAttribute) Marshal() marshalBgpAttributesOtherAttribute { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesOtherAttribute{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesOtherAttribute) Unmarshal() unMarshalBgpAttributesOtherAttribute { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesOtherAttribute{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesOtherAttribute) ToProto() (*otg.BgpAttributesOtherAttribute, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesOtherAttribute) FromProto(msg *otg.BgpAttributesOtherAttribute) (BgpAttributesOtherAttribute, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesOtherAttribute) 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 *unMarshalbgpAttributesOtherAttribute) 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 *marshalbgpAttributesOtherAttribute) 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 *unMarshalbgpAttributesOtherAttribute) 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 *marshalbgpAttributesOtherAttribute) 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 *unMarshalbgpAttributesOtherAttribute) 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 *bgpAttributesOtherAttribute) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesOtherAttribute) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesOtherAttribute) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesOtherAttribute) Clone() (BgpAttributesOtherAttribute, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesOtherAttribute() - 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 -} - -// BgpAttributesOtherAttribute is one unknown attribute stored as hex bytes. -type BgpAttributesOtherAttribute interface { - Validation - // msg marshals BgpAttributesOtherAttribute to protobuf object *otg.BgpAttributesOtherAttribute - // and doesn't set defaults - msg() *otg.BgpAttributesOtherAttribute - // setMsg unmarshals BgpAttributesOtherAttribute from protobuf object *otg.BgpAttributesOtherAttribute - // and doesn't set defaults - setMsg(*otg.BgpAttributesOtherAttribute) BgpAttributesOtherAttribute - // provides marshal interface - Marshal() marshalBgpAttributesOtherAttribute - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesOtherAttribute - // validate validates BgpAttributesOtherAttribute - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesOtherAttribute, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // FlagOptional returns bool, set in BgpAttributesOtherAttribute. - FlagOptional() bool - // SetFlagOptional assigns bool provided by user to BgpAttributesOtherAttribute - SetFlagOptional(value bool) BgpAttributesOtherAttribute - // HasFlagOptional checks if FlagOptional has been set in BgpAttributesOtherAttribute - HasFlagOptional() bool - // FlagTransitive returns bool, set in BgpAttributesOtherAttribute. - FlagTransitive() bool - // SetFlagTransitive assigns bool provided by user to BgpAttributesOtherAttribute - SetFlagTransitive(value bool) BgpAttributesOtherAttribute - // HasFlagTransitive checks if FlagTransitive has been set in BgpAttributesOtherAttribute - HasFlagTransitive() bool - // FlagPartial returns bool, set in BgpAttributesOtherAttribute. - FlagPartial() bool - // SetFlagPartial assigns bool provided by user to BgpAttributesOtherAttribute - SetFlagPartial(value bool) BgpAttributesOtherAttribute - // HasFlagPartial checks if FlagPartial has been set in BgpAttributesOtherAttribute - HasFlagPartial() bool - // FlagExtendedLength returns bool, set in BgpAttributesOtherAttribute. - FlagExtendedLength() bool - // SetFlagExtendedLength assigns bool provided by user to BgpAttributesOtherAttribute - SetFlagExtendedLength(value bool) BgpAttributesOtherAttribute - // HasFlagExtendedLength checks if FlagExtendedLength has been set in BgpAttributesOtherAttribute - HasFlagExtendedLength() bool - // Type returns uint32, set in BgpAttributesOtherAttribute. - Type() uint32 - // SetType assigns uint32 provided by user to BgpAttributesOtherAttribute - SetType(value uint32) BgpAttributesOtherAttribute - // RawValue returns string, set in BgpAttributesOtherAttribute. - RawValue() string - // SetRawValue assigns string provided by user to BgpAttributesOtherAttribute - SetRawValue(value string) BgpAttributesOtherAttribute -} - -// Optional flag in the BGP attribute. -// FlagOptional returns a bool -func (obj *bgpAttributesOtherAttribute) FlagOptional() bool { - - return *obj.obj.FlagOptional - -} - -// Optional flag in the BGP attribute. -// FlagOptional returns a bool -func (obj *bgpAttributesOtherAttribute) HasFlagOptional() bool { - return obj.obj.FlagOptional != nil -} - -// Optional flag in the BGP attribute. -// SetFlagOptional sets the bool value in the BgpAttributesOtherAttribute object -func (obj *bgpAttributesOtherAttribute) SetFlagOptional(value bool) BgpAttributesOtherAttribute { - - obj.obj.FlagOptional = &value - return obj -} - -// Transitive flag in the BGP attribute. -// FlagTransitive returns a bool -func (obj *bgpAttributesOtherAttribute) FlagTransitive() bool { - - return *obj.obj.FlagTransitive - -} - -// Transitive flag in the BGP attribute. -// FlagTransitive returns a bool -func (obj *bgpAttributesOtherAttribute) HasFlagTransitive() bool { - return obj.obj.FlagTransitive != nil -} - -// Transitive flag in the BGP attribute. -// SetFlagTransitive sets the bool value in the BgpAttributesOtherAttribute object -func (obj *bgpAttributesOtherAttribute) SetFlagTransitive(value bool) BgpAttributesOtherAttribute { - - obj.obj.FlagTransitive = &value - return obj -} - -// Partial flag in the BGP attribute. -// FlagPartial returns a bool -func (obj *bgpAttributesOtherAttribute) FlagPartial() bool { - - return *obj.obj.FlagPartial - -} - -// Partial flag in the BGP attribute. -// FlagPartial returns a bool -func (obj *bgpAttributesOtherAttribute) HasFlagPartial() bool { - return obj.obj.FlagPartial != nil -} - -// Partial flag in the BGP attribute. -// SetFlagPartial sets the bool value in the BgpAttributesOtherAttribute object -func (obj *bgpAttributesOtherAttribute) SetFlagPartial(value bool) BgpAttributesOtherAttribute { - - obj.obj.FlagPartial = &value - return obj -} - -// Extended length flag in the BGP attribute. -// FlagExtendedLength returns a bool -func (obj *bgpAttributesOtherAttribute) FlagExtendedLength() bool { - - return *obj.obj.FlagExtendedLength - -} - -// Extended length flag in the BGP attribute. -// FlagExtendedLength returns a bool -func (obj *bgpAttributesOtherAttribute) HasFlagExtendedLength() bool { - return obj.obj.FlagExtendedLength != nil -} - -// Extended length flag in the BGP attribute. -// SetFlagExtendedLength sets the bool value in the BgpAttributesOtherAttribute object -func (obj *bgpAttributesOtherAttribute) SetFlagExtendedLength(value bool) BgpAttributesOtherAttribute { - - obj.obj.FlagExtendedLength = &value - return obj -} - -// The value of the Type field in the attribute. -// Type returns a uint32 -func (obj *bgpAttributesOtherAttribute) Type() uint32 { - - return *obj.obj.Type - -} - -// The value of the Type field in the attribute. -// SetType sets the uint32 value in the BgpAttributesOtherAttribute object -func (obj *bgpAttributesOtherAttribute) SetType(value uint32) BgpAttributesOtherAttribute { - - obj.obj.Type = &value - return obj -} - -// Contents of the value field ( the contents after the initial two bytes containing the Flags and Type field ) of the attribute in hex bytes. -// It includes the contents of length of the extended length field if included. -// RawValue returns a string -func (obj *bgpAttributesOtherAttribute) RawValue() string { - - return *obj.obj.RawValue - -} - -// Contents of the value field ( the contents after the initial two bytes containing the Flags and Type field ) of the attribute in hex bytes. -// It includes the contents of length of the extended length field if included. -// SetRawValue sets the string value in the BgpAttributesOtherAttribute object -func (obj *bgpAttributesOtherAttribute) SetRawValue(value string) BgpAttributesOtherAttribute { - - obj.obj.RawValue = &value - return obj -} - -func (obj *bgpAttributesOtherAttribute) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Type is required - if obj.obj.Type == nil { - vObj.validationErrors = append(vObj.validationErrors, "Type is required field on interface BgpAttributesOtherAttribute") - } - - // RawValue is required - if obj.obj.RawValue == nil { - vObj.validationErrors = append(vObj.validationErrors, "RawValue is required field on interface BgpAttributesOtherAttribute") - } - if obj.obj.RawValue != nil { - - err := obj.validateHex(obj.RawValue()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesOtherAttribute.RawValue")) - } - - } - -} - -func (obj *bgpAttributesOtherAttribute) setDefault() { - if obj.obj.FlagOptional == nil { - obj.SetFlagOptional(false) - } - if obj.obj.FlagTransitive == nil { - obj.SetFlagTransitive(false) - } - if obj.obj.FlagPartial == nil { - obj.SetFlagPartial(false) - } - if obj.obj.FlagExtendedLength == nil { - obj.SetFlagExtendedLength(false) - } - -} - -// ***** BgpAttributesAsPath ***** -type bgpAttributesAsPath struct { - validation - obj *otg.BgpAttributesAsPath - marshaller marshalBgpAttributesAsPath - unMarshaller unMarshalBgpAttributesAsPath - fourByteAsPathHolder BgpAttributesAsPathFourByteAsPath - twoByteAsPathHolder BgpAttributesAsPathTwoByteAsPath -} - -func NewBgpAttributesAsPath() BgpAttributesAsPath { - obj := bgpAttributesAsPath{obj: &otg.BgpAttributesAsPath{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesAsPath) msg() *otg.BgpAttributesAsPath { - return obj.obj -} - -func (obj *bgpAttributesAsPath) setMsg(msg *otg.BgpAttributesAsPath) BgpAttributesAsPath { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesAsPath struct { - obj *bgpAttributesAsPath -} - -type marshalBgpAttributesAsPath interface { - // ToProto marshals BgpAttributesAsPath to protobuf object *otg.BgpAttributesAsPath - ToProto() (*otg.BgpAttributesAsPath, error) - // ToPbText marshals BgpAttributesAsPath to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesAsPath to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesAsPath to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesAsPath struct { - obj *bgpAttributesAsPath -} - -type unMarshalBgpAttributesAsPath interface { - // FromProto unmarshals BgpAttributesAsPath from protobuf object *otg.BgpAttributesAsPath - FromProto(msg *otg.BgpAttributesAsPath) (BgpAttributesAsPath, error) - // FromPbText unmarshals BgpAttributesAsPath from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesAsPath from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesAsPath from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesAsPath) Marshal() marshalBgpAttributesAsPath { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesAsPath{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesAsPath) Unmarshal() unMarshalBgpAttributesAsPath { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesAsPath{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesAsPath) ToProto() (*otg.BgpAttributesAsPath, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesAsPath) FromProto(msg *otg.BgpAttributesAsPath) (BgpAttributesAsPath, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesAsPath) 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 *unMarshalbgpAttributesAsPath) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesAsPath) 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 *unMarshalbgpAttributesAsPath) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesAsPath) 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 *unMarshalbgpAttributesAsPath) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesAsPath) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesAsPath) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesAsPath) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesAsPath) Clone() (BgpAttributesAsPath, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesAsPath() - 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 -} - -func (obj *bgpAttributesAsPath) setNil() { - obj.fourByteAsPathHolder = nil - obj.twoByteAsPathHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesAsPath is the AS_PATH attribute identifies the autonomous systems through which routing information -// carried in this UPDATE message has passed. -// This contains the configuration of how to include the Local AS in the AS path -// attribute of the MP REACH NLRI. It also contains optional configuration of -// additional AS Path Segments that can be included in the AS Path attribute. -// The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that -// a routing information passes through to reach the destination. -// There are two modes in which AS numbers can be encoded in the AS Path Segments -// - When the AS Path is being exchanged between old and new BGP speakers or between two old BGP speakers , the AS numbers are encoded as 2 byte values. -// - When the AS Path is being exchanged between two new BGP speakers supporting 4 byte AS , the AS numbers are encoded as 4 byte values. -type BgpAttributesAsPath interface { - Validation - // msg marshals BgpAttributesAsPath to protobuf object *otg.BgpAttributesAsPath - // and doesn't set defaults - msg() *otg.BgpAttributesAsPath - // setMsg unmarshals BgpAttributesAsPath from protobuf object *otg.BgpAttributesAsPath - // and doesn't set defaults - setMsg(*otg.BgpAttributesAsPath) BgpAttributesAsPath - // provides marshal interface - Marshal() marshalBgpAttributesAsPath - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesAsPath - // validate validates BgpAttributesAsPath - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesAsPath, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpAttributesAsPathChoiceEnum, set in BgpAttributesAsPath - Choice() BgpAttributesAsPathChoiceEnum - // setChoice assigns BgpAttributesAsPathChoiceEnum provided by user to BgpAttributesAsPath - setChoice(value BgpAttributesAsPathChoiceEnum) BgpAttributesAsPath - // HasChoice checks if Choice has been set in BgpAttributesAsPath - HasChoice() bool - // FourByteAsPath returns BgpAttributesAsPathFourByteAsPath, set in BgpAttributesAsPath. - // BgpAttributesAsPathFourByteAsPath is aS Paths with 4 byte AS numbers can be exchanged only if both BGP speakers support 4 byte AS number extensions. - FourByteAsPath() BgpAttributesAsPathFourByteAsPath - // SetFourByteAsPath assigns BgpAttributesAsPathFourByteAsPath provided by user to BgpAttributesAsPath. - // BgpAttributesAsPathFourByteAsPath is aS Paths with 4 byte AS numbers can be exchanged only if both BGP speakers support 4 byte AS number extensions. - SetFourByteAsPath(value BgpAttributesAsPathFourByteAsPath) BgpAttributesAsPath - // HasFourByteAsPath checks if FourByteAsPath has been set in BgpAttributesAsPath - HasFourByteAsPath() bool - // TwoByteAsPath returns BgpAttributesAsPathTwoByteAsPath, set in BgpAttributesAsPath. - // BgpAttributesAsPathTwoByteAsPath is aS Paths with 2 byte AS numbers is used when any of the two scenarios occur : - // - An old BGP speaker and new BGP speaker are sending BGP Updates to one another. - // - Two old BGP speakers are sending BGP Updates to one another. - TwoByteAsPath() BgpAttributesAsPathTwoByteAsPath - // SetTwoByteAsPath assigns BgpAttributesAsPathTwoByteAsPath provided by user to BgpAttributesAsPath. - // BgpAttributesAsPathTwoByteAsPath is aS Paths with 2 byte AS numbers is used when any of the two scenarios occur : - // - An old BGP speaker and new BGP speaker are sending BGP Updates to one another. - // - Two old BGP speakers are sending BGP Updates to one another. - SetTwoByteAsPath(value BgpAttributesAsPathTwoByteAsPath) BgpAttributesAsPath - // HasTwoByteAsPath checks if TwoByteAsPath has been set in BgpAttributesAsPath - HasTwoByteAsPath() bool - setNil() -} - -type BgpAttributesAsPathChoiceEnum string - -// Enum of Choice on BgpAttributesAsPath -var BgpAttributesAsPathChoice = struct { - FOUR_BYTE_AS_PATH BgpAttributesAsPathChoiceEnum - TWO_BYTE_AS_PATH BgpAttributesAsPathChoiceEnum -}{ - FOUR_BYTE_AS_PATH: BgpAttributesAsPathChoiceEnum("four_byte_as_path"), - TWO_BYTE_AS_PATH: BgpAttributesAsPathChoiceEnum("two_byte_as_path"), -} - -func (obj *bgpAttributesAsPath) Choice() BgpAttributesAsPathChoiceEnum { - return BgpAttributesAsPathChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *bgpAttributesAsPath) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpAttributesAsPath) setChoice(value BgpAttributesAsPathChoiceEnum) BgpAttributesAsPath { - intValue, ok := otg.BgpAttributesAsPath_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAttributesAsPathChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpAttributesAsPath_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.TwoByteAsPath = nil - obj.twoByteAsPathHolder = nil - obj.obj.FourByteAsPath = nil - obj.fourByteAsPathHolder = nil - - if value == BgpAttributesAsPathChoice.FOUR_BYTE_AS_PATH { - obj.obj.FourByteAsPath = NewBgpAttributesAsPathFourByteAsPath().msg() - } - - if value == BgpAttributesAsPathChoice.TWO_BYTE_AS_PATH { - obj.obj.TwoByteAsPath = NewBgpAttributesAsPathTwoByteAsPath().msg() - } - - return obj -} - -// description is TBD -// FourByteAsPath returns a BgpAttributesAsPathFourByteAsPath -func (obj *bgpAttributesAsPath) FourByteAsPath() BgpAttributesAsPathFourByteAsPath { - if obj.obj.FourByteAsPath == nil { - obj.setChoice(BgpAttributesAsPathChoice.FOUR_BYTE_AS_PATH) - } - if obj.fourByteAsPathHolder == nil { - obj.fourByteAsPathHolder = &bgpAttributesAsPathFourByteAsPath{obj: obj.obj.FourByteAsPath} - } - return obj.fourByteAsPathHolder -} - -// description is TBD -// FourByteAsPath returns a BgpAttributesAsPathFourByteAsPath -func (obj *bgpAttributesAsPath) HasFourByteAsPath() bool { - return obj.obj.FourByteAsPath != nil -} - -// description is TBD -// SetFourByteAsPath sets the BgpAttributesAsPathFourByteAsPath value in the BgpAttributesAsPath object -func (obj *bgpAttributesAsPath) SetFourByteAsPath(value BgpAttributesAsPathFourByteAsPath) BgpAttributesAsPath { - obj.setChoice(BgpAttributesAsPathChoice.FOUR_BYTE_AS_PATH) - obj.fourByteAsPathHolder = nil - obj.obj.FourByteAsPath = value.msg() - - return obj -} - -// description is TBD -// TwoByteAsPath returns a BgpAttributesAsPathTwoByteAsPath -func (obj *bgpAttributesAsPath) TwoByteAsPath() BgpAttributesAsPathTwoByteAsPath { - if obj.obj.TwoByteAsPath == nil { - obj.setChoice(BgpAttributesAsPathChoice.TWO_BYTE_AS_PATH) - } - if obj.twoByteAsPathHolder == nil { - obj.twoByteAsPathHolder = &bgpAttributesAsPathTwoByteAsPath{obj: obj.obj.TwoByteAsPath} - } - return obj.twoByteAsPathHolder -} - -// description is TBD -// TwoByteAsPath returns a BgpAttributesAsPathTwoByteAsPath -func (obj *bgpAttributesAsPath) HasTwoByteAsPath() bool { - return obj.obj.TwoByteAsPath != nil -} - -// description is TBD -// SetTwoByteAsPath sets the BgpAttributesAsPathTwoByteAsPath value in the BgpAttributesAsPath object -func (obj *bgpAttributesAsPath) SetTwoByteAsPath(value BgpAttributesAsPathTwoByteAsPath) BgpAttributesAsPath { - obj.setChoice(BgpAttributesAsPathChoice.TWO_BYTE_AS_PATH) - obj.twoByteAsPathHolder = nil - obj.obj.TwoByteAsPath = value.msg() - - return obj -} - -func (obj *bgpAttributesAsPath) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.FourByteAsPath != nil { - - obj.FourByteAsPath().validateObj(vObj, set_default) - } - - if obj.obj.TwoByteAsPath != nil { - - obj.TwoByteAsPath().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesAsPath) setDefault() { - var choices_set int = 0 - var choice BgpAttributesAsPathChoiceEnum - - if obj.obj.FourByteAsPath != nil { - choices_set += 1 - choice = BgpAttributesAsPathChoice.FOUR_BYTE_AS_PATH - } - - if obj.obj.TwoByteAsPath != nil { - choices_set += 1 - choice = BgpAttributesAsPathChoice.TWO_BYTE_AS_PATH - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(BgpAttributesAsPathChoice.FOUR_BYTE_AS_PATH) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesAsPath") - } - } else { - intVal := otg.BgpAttributesAsPath_Choice_Enum_value[string(choice)] - enumValue := otg.BgpAttributesAsPath_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpAttributesAs4Path ***** -type bgpAttributesAs4Path struct { - validation - obj *otg.BgpAttributesAs4Path - marshaller marshalBgpAttributesAs4Path - unMarshaller unMarshalBgpAttributesAs4Path - segmentsHolder BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter -} - -func NewBgpAttributesAs4Path() BgpAttributesAs4Path { - obj := bgpAttributesAs4Path{obj: &otg.BgpAttributesAs4Path{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesAs4Path) msg() *otg.BgpAttributesAs4Path { - return obj.obj -} - -func (obj *bgpAttributesAs4Path) setMsg(msg *otg.BgpAttributesAs4Path) BgpAttributesAs4Path { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesAs4Path struct { - obj *bgpAttributesAs4Path -} - -type marshalBgpAttributesAs4Path interface { - // ToProto marshals BgpAttributesAs4Path to protobuf object *otg.BgpAttributesAs4Path - ToProto() (*otg.BgpAttributesAs4Path, error) - // ToPbText marshals BgpAttributesAs4Path to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesAs4Path to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesAs4Path to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesAs4Path struct { - obj *bgpAttributesAs4Path -} - -type unMarshalBgpAttributesAs4Path interface { - // FromProto unmarshals BgpAttributesAs4Path from protobuf object *otg.BgpAttributesAs4Path - FromProto(msg *otg.BgpAttributesAs4Path) (BgpAttributesAs4Path, error) - // FromPbText unmarshals BgpAttributesAs4Path from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesAs4Path from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesAs4Path from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesAs4Path) Marshal() marshalBgpAttributesAs4Path { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesAs4Path{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesAs4Path) Unmarshal() unMarshalBgpAttributesAs4Path { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesAs4Path{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesAs4Path) ToProto() (*otg.BgpAttributesAs4Path, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesAs4Path) FromProto(msg *otg.BgpAttributesAs4Path) (BgpAttributesAs4Path, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesAs4Path) 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 *unMarshalbgpAttributesAs4Path) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesAs4Path) 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 *unMarshalbgpAttributesAs4Path) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesAs4Path) 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 *unMarshalbgpAttributesAs4Path) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesAs4Path) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesAs4Path) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesAs4Path) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesAs4Path) Clone() (BgpAttributesAs4Path, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesAs4Path() - 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 -} - -func (obj *bgpAttributesAs4Path) setNil() { - obj.segmentsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesAs4Path is the AS4_PATH attribute identifies the autonomous systems through which routing information -// carried in this UPDATE message has passed. -// This contains the configuration of how to include the Local AS in the AS path -// attribute of the MP REACH NLRI. It also contains optional configuration of -// additional AS Path Segments that can be included in the AS Path attribute. -// The AS Path consists of a Set or Sequence of Autonomous Systems (AS) numbers that -// a routing information passes through to reach the destination. -// AS4_PATH is only exchanged in two scenarios: -// - When an old BGP speaker has to forward a received AS4_PATH containing 4 byte AS numbers to new BGP speaker. -// - When a new BGP speaker is connected to an old BGP speaker and has to propagate 4 byte AS numbers via the old BGP speaker. -// Its usage is described in RFC4893. -type BgpAttributesAs4Path interface { - Validation - // msg marshals BgpAttributesAs4Path to protobuf object *otg.BgpAttributesAs4Path - // and doesn't set defaults - msg() *otg.BgpAttributesAs4Path - // setMsg unmarshals BgpAttributesAs4Path from protobuf object *otg.BgpAttributesAs4Path - // and doesn't set defaults - setMsg(*otg.BgpAttributesAs4Path) BgpAttributesAs4Path - // provides marshal interface - Marshal() marshalBgpAttributesAs4Path - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesAs4Path - // validate validates BgpAttributesAs4Path - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesAs4Path, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Segments returns BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIterIter, set in BgpAttributesAs4Path - Segments() BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter - setNil() -} - -// The AS path segments containing 4 byte AS numbers to be added in the AS4_PATH attribute. -// Segments returns a []BgpAttributesFourByteAsPathSegment -func (obj *bgpAttributesAs4Path) Segments() BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { - if len(obj.obj.Segments) == 0 { - obj.obj.Segments = []*otg.BgpAttributesFourByteAsPathSegment{} - } - if obj.segmentsHolder == nil { - obj.segmentsHolder = newBgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter(&obj.obj.Segments).setMsg(obj) - } - return obj.segmentsHolder -} - -type bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter struct { - obj *bgpAttributesAs4Path - bgpAttributesFourByteAsPathSegmentSlice []BgpAttributesFourByteAsPathSegment - fieldPtr *[]*otg.BgpAttributesFourByteAsPathSegment -} - -func newBgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter(ptr *[]*otg.BgpAttributesFourByteAsPathSegment) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { - return &bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter{fieldPtr: ptr} -} - -type BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter interface { - setMsg(*bgpAttributesAs4Path) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter - Items() []BgpAttributesFourByteAsPathSegment - Add() BgpAttributesFourByteAsPathSegment - Append(items ...BgpAttributesFourByteAsPathSegment) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter - Set(index int, newObj BgpAttributesFourByteAsPathSegment) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter - Clear() BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter - clearHolderSlice() BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter - appendHolderSlice(item BgpAttributesFourByteAsPathSegment) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter -} - -func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) setMsg(msg *bgpAttributesAs4Path) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpAttributesFourByteAsPathSegment{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) Items() []BgpAttributesFourByteAsPathSegment { - return obj.bgpAttributesFourByteAsPathSegmentSlice -} - -func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) Add() BgpAttributesFourByteAsPathSegment { - newObj := &otg.BgpAttributesFourByteAsPathSegment{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpAttributesFourByteAsPathSegment{obj: newObj} - newLibObj.setDefault() - obj.bgpAttributesFourByteAsPathSegmentSlice = append(obj.bgpAttributesFourByteAsPathSegmentSlice, newLibObj) - return newLibObj -} - -func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) Append(items ...BgpAttributesFourByteAsPathSegment) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpAttributesFourByteAsPathSegmentSlice = append(obj.bgpAttributesFourByteAsPathSegmentSlice, item) - } - return obj -} - -func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) Set(index int, newObj BgpAttributesFourByteAsPathSegment) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpAttributesFourByteAsPathSegmentSlice[index] = newObj - return obj -} -func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) Clear() BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpAttributesFourByteAsPathSegment{} - obj.bgpAttributesFourByteAsPathSegmentSlice = []BgpAttributesFourByteAsPathSegment{} - } - return obj -} -func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) clearHolderSlice() BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { - if len(obj.bgpAttributesFourByteAsPathSegmentSlice) > 0 { - obj.bgpAttributesFourByteAsPathSegmentSlice = []BgpAttributesFourByteAsPathSegment{} - } - return obj -} -func (obj *bgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter) appendHolderSlice(item BgpAttributesFourByteAsPathSegment) BgpAttributesAs4PathBgpAttributesFourByteAsPathSegmentIter { - obj.bgpAttributesFourByteAsPathSegmentSlice = append(obj.bgpAttributesFourByteAsPathSegmentSlice, item) - return obj -} - -func (obj *bgpAttributesAs4Path) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Segments) != 0 { - - if set_default { - obj.Segments().clearHolderSlice() - for _, item := range obj.obj.Segments { - obj.Segments().appendHolderSlice(&bgpAttributesFourByteAsPathSegment{obj: item}) - } - } - for _, item := range obj.Segments().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpAttributesAs4Path) setDefault() { - -} - -// ***** BgpAttributesNextHop ***** -type bgpAttributesNextHop struct { - validation - obj *otg.BgpAttributesNextHop - marshaller marshalBgpAttributesNextHop - unMarshaller unMarshalBgpAttributesNextHop - ipv6TwoAddressesHolder BgpAttributesNextHopIpv6TwoAddresses -} - -func NewBgpAttributesNextHop() BgpAttributesNextHop { - obj := bgpAttributesNextHop{obj: &otg.BgpAttributesNextHop{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesNextHop) msg() *otg.BgpAttributesNextHop { - return obj.obj -} - -func (obj *bgpAttributesNextHop) setMsg(msg *otg.BgpAttributesNextHop) BgpAttributesNextHop { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesNextHop struct { - obj *bgpAttributesNextHop -} - -type marshalBgpAttributesNextHop interface { - // ToProto marshals BgpAttributesNextHop to protobuf object *otg.BgpAttributesNextHop - ToProto() (*otg.BgpAttributesNextHop, error) - // ToPbText marshals BgpAttributesNextHop to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesNextHop to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesNextHop to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesNextHop struct { - obj *bgpAttributesNextHop -} - -type unMarshalBgpAttributesNextHop interface { - // FromProto unmarshals BgpAttributesNextHop from protobuf object *otg.BgpAttributesNextHop - FromProto(msg *otg.BgpAttributesNextHop) (BgpAttributesNextHop, error) - // FromPbText unmarshals BgpAttributesNextHop from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesNextHop from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesNextHop from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesNextHop) Marshal() marshalBgpAttributesNextHop { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesNextHop{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesNextHop) Unmarshal() unMarshalBgpAttributesNextHop { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesNextHop{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesNextHop) ToProto() (*otg.BgpAttributesNextHop, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesNextHop) FromProto(msg *otg.BgpAttributesNextHop) (BgpAttributesNextHop, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesNextHop) 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 *unMarshalbgpAttributesNextHop) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesNextHop) 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 *unMarshalbgpAttributesNextHop) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesNextHop) 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 *unMarshalbgpAttributesNextHop) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesNextHop) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesNextHop) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesNextHop) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesNextHop) Clone() (BgpAttributesNextHop, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesNextHop() - 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 -} - -func (obj *bgpAttributesNextHop) setNil() { - obj.ipv6TwoAddressesHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesNextHop is next hop to be sent inside MP_REACH NLRI or as the NEXT_HOP attribute if advertised as traditional NLRI. -type BgpAttributesNextHop interface { - Validation - // msg marshals BgpAttributesNextHop to protobuf object *otg.BgpAttributesNextHop - // and doesn't set defaults - msg() *otg.BgpAttributesNextHop - // setMsg unmarshals BgpAttributesNextHop from protobuf object *otg.BgpAttributesNextHop - // and doesn't set defaults - setMsg(*otg.BgpAttributesNextHop) BgpAttributesNextHop - // provides marshal interface - Marshal() marshalBgpAttributesNextHop - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesNextHop - // validate validates BgpAttributesNextHop - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesNextHop, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpAttributesNextHopChoiceEnum, set in BgpAttributesNextHop - Choice() BgpAttributesNextHopChoiceEnum - // setChoice assigns BgpAttributesNextHopChoiceEnum provided by user to BgpAttributesNextHop - setChoice(value BgpAttributesNextHopChoiceEnum) BgpAttributesNextHop - // Ipv4 returns string, set in BgpAttributesNextHop. - Ipv4() string - // SetIpv4 assigns string provided by user to BgpAttributesNextHop - SetIpv4(value string) BgpAttributesNextHop - // HasIpv4 checks if Ipv4 has been set in BgpAttributesNextHop - HasIpv4() bool - // Ipv6 returns string, set in BgpAttributesNextHop. - Ipv6() string - // SetIpv6 assigns string provided by user to BgpAttributesNextHop - SetIpv6(value string) BgpAttributesNextHop - // HasIpv6 checks if Ipv6 has been set in BgpAttributesNextHop - HasIpv6() bool - // Ipv6TwoAddresses returns BgpAttributesNextHopIpv6TwoAddresses, set in BgpAttributesNextHop. - // BgpAttributesNextHopIpv6TwoAddresses is there is a specific scenario in which it is possible to receive a Global and Link Local address in the Next Hop - // field in a MP_REACH attribute or in the NEXT_HOP attribute(RFC2545: Section 3). - Ipv6TwoAddresses() BgpAttributesNextHopIpv6TwoAddresses - // SetIpv6TwoAddresses assigns BgpAttributesNextHopIpv6TwoAddresses provided by user to BgpAttributesNextHop. - // BgpAttributesNextHopIpv6TwoAddresses is there is a specific scenario in which it is possible to receive a Global and Link Local address in the Next Hop - // field in a MP_REACH attribute or in the NEXT_HOP attribute(RFC2545: Section 3). - SetIpv6TwoAddresses(value BgpAttributesNextHopIpv6TwoAddresses) BgpAttributesNextHop - // HasIpv6TwoAddresses checks if Ipv6TwoAddresses has been set in BgpAttributesNextHop - HasIpv6TwoAddresses() bool - setNil() -} - -type BgpAttributesNextHopChoiceEnum string - -// Enum of Choice on BgpAttributesNextHop -var BgpAttributesNextHopChoice = struct { - IPV4 BgpAttributesNextHopChoiceEnum - IPV6 BgpAttributesNextHopChoiceEnum - IPV6_TWO_ADDRESSES BgpAttributesNextHopChoiceEnum -}{ - IPV4: BgpAttributesNextHopChoiceEnum("ipv4"), - IPV6: BgpAttributesNextHopChoiceEnum("ipv6"), - IPV6_TWO_ADDRESSES: BgpAttributesNextHopChoiceEnum("ipv6_two_addresses"), -} - -func (obj *bgpAttributesNextHop) Choice() BgpAttributesNextHopChoiceEnum { - return BgpAttributesNextHopChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *bgpAttributesNextHop) setChoice(value BgpAttributesNextHopChoiceEnum) BgpAttributesNextHop { - intValue, ok := otg.BgpAttributesNextHop_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAttributesNextHopChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpAttributesNextHop_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Ipv6TwoAddresses = nil - obj.ipv6TwoAddressesHolder = nil - obj.obj.Ipv6 = nil - obj.obj.Ipv4 = nil - - if value == BgpAttributesNextHopChoice.IPV4 { - defaultValue := "0.0.0.0" - obj.obj.Ipv4 = &defaultValue - } - - if value == BgpAttributesNextHopChoice.IPV6 { - defaultValue := "0::0" - obj.obj.Ipv6 = &defaultValue - } - - if value == BgpAttributesNextHopChoice.IPV6_TWO_ADDRESSES { - obj.obj.Ipv6TwoAddresses = NewBgpAttributesNextHopIpv6TwoAddresses().msg() - } - - return obj -} - -// The 4 byte IPv4 address of the next-hop from which the route was received. -// Ipv4 returns a string -func (obj *bgpAttributesNextHop) Ipv4() string { - - if obj.obj.Ipv4 == nil { - obj.setChoice(BgpAttributesNextHopChoice.IPV4) - } - - return *obj.obj.Ipv4 - -} - -// The 4 byte IPv4 address of the next-hop from which the route was received. -// Ipv4 returns a string -func (obj *bgpAttributesNextHop) HasIpv4() bool { - return obj.obj.Ipv4 != nil -} - -// The 4 byte IPv4 address of the next-hop from which the route was received. -// SetIpv4 sets the string value in the BgpAttributesNextHop object -func (obj *bgpAttributesNextHop) SetIpv4(value string) BgpAttributesNextHop { - obj.setChoice(BgpAttributesNextHopChoice.IPV4) - obj.obj.Ipv4 = &value - return obj -} - -// The 16 byte IPv6 address of the next-hop from which the route was received. -// Ipv6 returns a string -func (obj *bgpAttributesNextHop) Ipv6() string { - - if obj.obj.Ipv6 == nil { - obj.setChoice(BgpAttributesNextHopChoice.IPV6) - } - - return *obj.obj.Ipv6 - -} - -// The 16 byte IPv6 address of the next-hop from which the route was received. -// Ipv6 returns a string -func (obj *bgpAttributesNextHop) HasIpv6() bool { - return obj.obj.Ipv6 != nil -} - -// The 16 byte IPv6 address of the next-hop from which the route was received. -// SetIpv6 sets the string value in the BgpAttributesNextHop object -func (obj *bgpAttributesNextHop) SetIpv6(value string) BgpAttributesNextHop { - obj.setChoice(BgpAttributesNextHopChoice.IPV6) - obj.obj.Ipv6 = &value - return obj -} - -// description is TBD -// Ipv6TwoAddresses returns a BgpAttributesNextHopIpv6TwoAddresses -func (obj *bgpAttributesNextHop) Ipv6TwoAddresses() BgpAttributesNextHopIpv6TwoAddresses { - if obj.obj.Ipv6TwoAddresses == nil { - obj.setChoice(BgpAttributesNextHopChoice.IPV6_TWO_ADDRESSES) - } - if obj.ipv6TwoAddressesHolder == nil { - obj.ipv6TwoAddressesHolder = &bgpAttributesNextHopIpv6TwoAddresses{obj: obj.obj.Ipv6TwoAddresses} - } - return obj.ipv6TwoAddressesHolder -} - -// description is TBD -// Ipv6TwoAddresses returns a BgpAttributesNextHopIpv6TwoAddresses -func (obj *bgpAttributesNextHop) HasIpv6TwoAddresses() bool { - return obj.obj.Ipv6TwoAddresses != nil -} - -// description is TBD -// SetIpv6TwoAddresses sets the BgpAttributesNextHopIpv6TwoAddresses value in the BgpAttributesNextHop object -func (obj *bgpAttributesNextHop) SetIpv6TwoAddresses(value BgpAttributesNextHopIpv6TwoAddresses) BgpAttributesNextHop { - obj.setChoice(BgpAttributesNextHopChoice.IPV6_TWO_ADDRESSES) - obj.ipv6TwoAddressesHolder = nil - obj.obj.Ipv6TwoAddresses = value.msg() - - return obj -} - -func (obj *bgpAttributesNextHop) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface BgpAttributesNextHop") - } - - if obj.obj.Ipv4 != nil { - - err := obj.validateIpv4(obj.Ipv4()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesNextHop.Ipv4")) - } - - } - - if obj.obj.Ipv6 != nil { - - err := obj.validateIpv6(obj.Ipv6()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesNextHop.Ipv6")) - } - - } - - if obj.obj.Ipv6TwoAddresses != nil { - - obj.Ipv6TwoAddresses().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesNextHop) setDefault() { - var choices_set int = 0 - var choice BgpAttributesNextHopChoiceEnum - - if obj.obj.Ipv4 != nil { - choices_set += 1 - choice = BgpAttributesNextHopChoice.IPV4 - } - - if obj.obj.Ipv6 != nil { - choices_set += 1 - choice = BgpAttributesNextHopChoice.IPV6 - } - - if obj.obj.Ipv6TwoAddresses != nil { - choices_set += 1 - choice = BgpAttributesNextHopChoice.IPV6_TWO_ADDRESSES - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesNextHop") - } - } else { - intVal := otg.BgpAttributesNextHop_Choice_Enum_value[string(choice)] - enumValue := otg.BgpAttributesNextHop_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - - if obj.obj.Ipv4 == nil && choice == BgpAttributesNextHopChoice.IPV4 { - obj.SetIpv4("0.0.0.0") - } - if obj.obj.Ipv6 == nil && choice == BgpAttributesNextHopChoice.IPV6 { - obj.SetIpv6("0::0") - } - -} - -// ***** BgpAttributesMultiExitDiscriminator ***** -type bgpAttributesMultiExitDiscriminator struct { - validation - obj *otg.BgpAttributesMultiExitDiscriminator - marshaller marshalBgpAttributesMultiExitDiscriminator - unMarshaller unMarshalBgpAttributesMultiExitDiscriminator -} - -func NewBgpAttributesMultiExitDiscriminator() BgpAttributesMultiExitDiscriminator { - obj := bgpAttributesMultiExitDiscriminator{obj: &otg.BgpAttributesMultiExitDiscriminator{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesMultiExitDiscriminator) msg() *otg.BgpAttributesMultiExitDiscriminator { - return obj.obj -} - -func (obj *bgpAttributesMultiExitDiscriminator) setMsg(msg *otg.BgpAttributesMultiExitDiscriminator) BgpAttributesMultiExitDiscriminator { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesMultiExitDiscriminator struct { - obj *bgpAttributesMultiExitDiscriminator -} - -type marshalBgpAttributesMultiExitDiscriminator interface { - // ToProto marshals BgpAttributesMultiExitDiscriminator to protobuf object *otg.BgpAttributesMultiExitDiscriminator - ToProto() (*otg.BgpAttributesMultiExitDiscriminator, error) - // ToPbText marshals BgpAttributesMultiExitDiscriminator to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesMultiExitDiscriminator to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesMultiExitDiscriminator to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesMultiExitDiscriminator struct { - obj *bgpAttributesMultiExitDiscriminator -} - -type unMarshalBgpAttributesMultiExitDiscriminator interface { - // FromProto unmarshals BgpAttributesMultiExitDiscriminator from protobuf object *otg.BgpAttributesMultiExitDiscriminator - FromProto(msg *otg.BgpAttributesMultiExitDiscriminator) (BgpAttributesMultiExitDiscriminator, error) - // FromPbText unmarshals BgpAttributesMultiExitDiscriminator from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesMultiExitDiscriminator from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesMultiExitDiscriminator from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesMultiExitDiscriminator) Marshal() marshalBgpAttributesMultiExitDiscriminator { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesMultiExitDiscriminator{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesMultiExitDiscriminator) Unmarshal() unMarshalBgpAttributesMultiExitDiscriminator { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesMultiExitDiscriminator{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesMultiExitDiscriminator) ToProto() (*otg.BgpAttributesMultiExitDiscriminator, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesMultiExitDiscriminator) FromProto(msg *otg.BgpAttributesMultiExitDiscriminator) (BgpAttributesMultiExitDiscriminator, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesMultiExitDiscriminator) 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 *unMarshalbgpAttributesMultiExitDiscriminator) 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 *marshalbgpAttributesMultiExitDiscriminator) 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 *unMarshalbgpAttributesMultiExitDiscriminator) 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 *marshalbgpAttributesMultiExitDiscriminator) 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 *unMarshalbgpAttributesMultiExitDiscriminator) 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 *bgpAttributesMultiExitDiscriminator) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesMultiExitDiscriminator) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesMultiExitDiscriminator) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesMultiExitDiscriminator) Clone() (BgpAttributesMultiExitDiscriminator, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesMultiExitDiscriminator() - 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 -} - -// BgpAttributesMultiExitDiscriminator is optional MULTI_EXIT_DISCRIMINATOR attribute sent to the peer to help in the route selection process. -type BgpAttributesMultiExitDiscriminator interface { - Validation - // msg marshals BgpAttributesMultiExitDiscriminator to protobuf object *otg.BgpAttributesMultiExitDiscriminator - // and doesn't set defaults - msg() *otg.BgpAttributesMultiExitDiscriminator - // setMsg unmarshals BgpAttributesMultiExitDiscriminator from protobuf object *otg.BgpAttributesMultiExitDiscriminator - // and doesn't set defaults - setMsg(*otg.BgpAttributesMultiExitDiscriminator) BgpAttributesMultiExitDiscriminator - // provides marshal interface - Marshal() marshalBgpAttributesMultiExitDiscriminator - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesMultiExitDiscriminator - // validate validates BgpAttributesMultiExitDiscriminator - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesMultiExitDiscriminator, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Value returns uint32, set in BgpAttributesMultiExitDiscriminator. - Value() uint32 - // SetValue assigns uint32 provided by user to BgpAttributesMultiExitDiscriminator - SetValue(value uint32) BgpAttributesMultiExitDiscriminator - // HasValue checks if Value has been set in BgpAttributesMultiExitDiscriminator - HasValue() bool -} - -// The multi exit discriminator (MED) value used for route selection sent to the peer. -// Value returns a uint32 -func (obj *bgpAttributesMultiExitDiscriminator) Value() uint32 { - - return *obj.obj.Value - -} - -// The multi exit discriminator (MED) value used for route selection sent to the peer. -// Value returns a uint32 -func (obj *bgpAttributesMultiExitDiscriminator) HasValue() bool { - return obj.obj.Value != nil -} - -// The multi exit discriminator (MED) value used for route selection sent to the peer. -// SetValue sets the uint32 value in the BgpAttributesMultiExitDiscriminator object -func (obj *bgpAttributesMultiExitDiscriminator) SetValue(value uint32) BgpAttributesMultiExitDiscriminator { - - obj.obj.Value = &value - return obj -} - -func (obj *bgpAttributesMultiExitDiscriminator) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpAttributesMultiExitDiscriminator) setDefault() { - if obj.obj.Value == nil { - obj.SetValue(0) - } - -} - -// ***** BgpAttributesLocalPreference ***** -type bgpAttributesLocalPreference struct { - validation - obj *otg.BgpAttributesLocalPreference - marshaller marshalBgpAttributesLocalPreference - unMarshaller unMarshalBgpAttributesLocalPreference -} - -func NewBgpAttributesLocalPreference() BgpAttributesLocalPreference { - obj := bgpAttributesLocalPreference{obj: &otg.BgpAttributesLocalPreference{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesLocalPreference) msg() *otg.BgpAttributesLocalPreference { - return obj.obj -} - -func (obj *bgpAttributesLocalPreference) setMsg(msg *otg.BgpAttributesLocalPreference) BgpAttributesLocalPreference { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesLocalPreference struct { - obj *bgpAttributesLocalPreference -} - -type marshalBgpAttributesLocalPreference interface { - // ToProto marshals BgpAttributesLocalPreference to protobuf object *otg.BgpAttributesLocalPreference - ToProto() (*otg.BgpAttributesLocalPreference, error) - // ToPbText marshals BgpAttributesLocalPreference to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesLocalPreference to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesLocalPreference to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesLocalPreference struct { - obj *bgpAttributesLocalPreference -} - -type unMarshalBgpAttributesLocalPreference interface { - // FromProto unmarshals BgpAttributesLocalPreference from protobuf object *otg.BgpAttributesLocalPreference - FromProto(msg *otg.BgpAttributesLocalPreference) (BgpAttributesLocalPreference, error) - // FromPbText unmarshals BgpAttributesLocalPreference from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesLocalPreference from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesLocalPreference from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesLocalPreference) Marshal() marshalBgpAttributesLocalPreference { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesLocalPreference{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesLocalPreference) Unmarshal() unMarshalBgpAttributesLocalPreference { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesLocalPreference{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesLocalPreference) ToProto() (*otg.BgpAttributesLocalPreference, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesLocalPreference) FromProto(msg *otg.BgpAttributesLocalPreference) (BgpAttributesLocalPreference, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesLocalPreference) 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 *unMarshalbgpAttributesLocalPreference) 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 *marshalbgpAttributesLocalPreference) 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 *unMarshalbgpAttributesLocalPreference) 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 *marshalbgpAttributesLocalPreference) 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 *unMarshalbgpAttributesLocalPreference) 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 *bgpAttributesLocalPreference) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesLocalPreference) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesLocalPreference) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesLocalPreference) Clone() (BgpAttributesLocalPreference, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesLocalPreference() - 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 -} - -// BgpAttributesLocalPreference is optional LOCAL_PREFERENCE attribute sent to the peer to indicate the degree of preference -// for externally learned routes.This should be included only for internal peers.It is -// used for the selection of the path for the traffic leaving the AS.The route with the -// highest local preference value is preferred. -type BgpAttributesLocalPreference interface { - Validation - // msg marshals BgpAttributesLocalPreference to protobuf object *otg.BgpAttributesLocalPreference - // and doesn't set defaults - msg() *otg.BgpAttributesLocalPreference - // setMsg unmarshals BgpAttributesLocalPreference from protobuf object *otg.BgpAttributesLocalPreference - // and doesn't set defaults - setMsg(*otg.BgpAttributesLocalPreference) BgpAttributesLocalPreference - // provides marshal interface - Marshal() marshalBgpAttributesLocalPreference - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesLocalPreference - // validate validates BgpAttributesLocalPreference - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesLocalPreference, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Value returns uint32, set in BgpAttributesLocalPreference. - Value() uint32 - // SetValue assigns uint32 provided by user to BgpAttributesLocalPreference - SetValue(value uint32) BgpAttributesLocalPreference - // HasValue checks if Value has been set in BgpAttributesLocalPreference - HasValue() bool -} - -// Value to be set in the LOCAL_PREFERENCE attribute The multi exit discriminator (MED) value used for route selection sent to the peer. -// Value returns a uint32 -func (obj *bgpAttributesLocalPreference) Value() uint32 { - - return *obj.obj.Value - -} - -// Value to be set in the LOCAL_PREFERENCE attribute The multi exit discriminator (MED) value used for route selection sent to the peer. -// Value returns a uint32 -func (obj *bgpAttributesLocalPreference) HasValue() bool { - return obj.obj.Value != nil -} - -// Value to be set in the LOCAL_PREFERENCE attribute The multi exit discriminator (MED) value used for route selection sent to the peer. -// SetValue sets the uint32 value in the BgpAttributesLocalPreference object -func (obj *bgpAttributesLocalPreference) SetValue(value uint32) BgpAttributesLocalPreference { - - obj.obj.Value = &value - return obj -} - -func (obj *bgpAttributesLocalPreference) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpAttributesLocalPreference) setDefault() { - if obj.obj.Value == nil { - obj.SetValue(100) - } - -} - -// ***** BgpAttributesAggregator ***** -type bgpAttributesAggregator struct { - validation - obj *otg.BgpAttributesAggregator - marshaller marshalBgpAttributesAggregator - unMarshaller unMarshalBgpAttributesAggregator -} - -func NewBgpAttributesAggregator() BgpAttributesAggregator { - obj := bgpAttributesAggregator{obj: &otg.BgpAttributesAggregator{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesAggregator) msg() *otg.BgpAttributesAggregator { - return obj.obj -} - -func (obj *bgpAttributesAggregator) setMsg(msg *otg.BgpAttributesAggregator) BgpAttributesAggregator { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesAggregator struct { - obj *bgpAttributesAggregator -} - -type marshalBgpAttributesAggregator interface { - // ToProto marshals BgpAttributesAggregator to protobuf object *otg.BgpAttributesAggregator - ToProto() (*otg.BgpAttributesAggregator, error) - // ToPbText marshals BgpAttributesAggregator to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesAggregator to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesAggregator to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesAggregator struct { - obj *bgpAttributesAggregator -} - -type unMarshalBgpAttributesAggregator interface { - // FromProto unmarshals BgpAttributesAggregator from protobuf object *otg.BgpAttributesAggregator - FromProto(msg *otg.BgpAttributesAggregator) (BgpAttributesAggregator, error) - // FromPbText unmarshals BgpAttributesAggregator from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesAggregator from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesAggregator from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesAggregator) Marshal() marshalBgpAttributesAggregator { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesAggregator{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesAggregator) Unmarshal() unMarshalBgpAttributesAggregator { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesAggregator{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesAggregator) ToProto() (*otg.BgpAttributesAggregator, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesAggregator) FromProto(msg *otg.BgpAttributesAggregator) (BgpAttributesAggregator, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesAggregator) 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 *unMarshalbgpAttributesAggregator) 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 *marshalbgpAttributesAggregator) 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 *unMarshalbgpAttributesAggregator) 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 *marshalbgpAttributesAggregator) 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 *unMarshalbgpAttributesAggregator) 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 *bgpAttributesAggregator) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesAggregator) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesAggregator) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesAggregator) Clone() (BgpAttributesAggregator, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesAggregator() - 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 -} - -// BgpAttributesAggregator is optional AGGREGATOR attribute which maybe be added by a BGP speaker which performs route aggregation. -// When AGGREGATOR attribute is being sent to a new BGP speaker , the AS number is encoded as a 4 byte value. -// When AGGREGATOR attribute is being exchanged between a new and an old BGP speaker or between two old BGP speakers, -// the AS number is encoded as a 2 byte value. -// It contain the AS number and IP address of the speaker performing the aggregation. -type BgpAttributesAggregator interface { - Validation - // msg marshals BgpAttributesAggregator to protobuf object *otg.BgpAttributesAggregator - // and doesn't set defaults - msg() *otg.BgpAttributesAggregator - // setMsg unmarshals BgpAttributesAggregator from protobuf object *otg.BgpAttributesAggregator - // and doesn't set defaults - setMsg(*otg.BgpAttributesAggregator) BgpAttributesAggregator - // provides marshal interface - Marshal() marshalBgpAttributesAggregator - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesAggregator - // validate validates BgpAttributesAggregator - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesAggregator, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpAttributesAggregatorChoiceEnum, set in BgpAttributesAggregator - Choice() BgpAttributesAggregatorChoiceEnum - // setChoice assigns BgpAttributesAggregatorChoiceEnum provided by user to BgpAttributesAggregator - setChoice(value BgpAttributesAggregatorChoiceEnum) BgpAttributesAggregator - // HasChoice checks if Choice has been set in BgpAttributesAggregator - HasChoice() bool - // FourByteAs returns uint32, set in BgpAttributesAggregator. - FourByteAs() uint32 - // SetFourByteAs assigns uint32 provided by user to BgpAttributesAggregator - SetFourByteAs(value uint32) BgpAttributesAggregator - // HasFourByteAs checks if FourByteAs has been set in BgpAttributesAggregator - HasFourByteAs() bool - // TwoByteAs returns uint32, set in BgpAttributesAggregator. - TwoByteAs() uint32 - // SetTwoByteAs assigns uint32 provided by user to BgpAttributesAggregator - SetTwoByteAs(value uint32) BgpAttributesAggregator - // HasTwoByteAs checks if TwoByteAs has been set in BgpAttributesAggregator - HasTwoByteAs() bool - // Ipv4Address returns string, set in BgpAttributesAggregator. - Ipv4Address() string - // SetIpv4Address assigns string provided by user to BgpAttributesAggregator - SetIpv4Address(value string) BgpAttributesAggregator - // HasIpv4Address checks if Ipv4Address has been set in BgpAttributesAggregator - HasIpv4Address() bool -} - -type BgpAttributesAggregatorChoiceEnum string - -// Enum of Choice on BgpAttributesAggregator -var BgpAttributesAggregatorChoice = struct { - FOUR_BYTE_AS BgpAttributesAggregatorChoiceEnum - TWO_BYTE_AS BgpAttributesAggregatorChoiceEnum -}{ - FOUR_BYTE_AS: BgpAttributesAggregatorChoiceEnum("four_byte_as"), - TWO_BYTE_AS: BgpAttributesAggregatorChoiceEnum("two_byte_as"), -} - -func (obj *bgpAttributesAggregator) Choice() BgpAttributesAggregatorChoiceEnum { - return BgpAttributesAggregatorChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *bgpAttributesAggregator) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpAttributesAggregator) setChoice(value BgpAttributesAggregatorChoiceEnum) BgpAttributesAggregator { - intValue, ok := otg.BgpAttributesAggregator_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAttributesAggregatorChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpAttributesAggregator_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.TwoByteAs = nil - obj.obj.FourByteAs = nil - - if value == BgpAttributesAggregatorChoice.FOUR_BYTE_AS { - defaultValue := uint32(65536) - obj.obj.FourByteAs = &defaultValue - } - - if value == BgpAttributesAggregatorChoice.TWO_BYTE_AS { - defaultValue := uint32(1) - obj.obj.TwoByteAs = &defaultValue - } - - return obj -} - -// The value of the 4 byte AS number of the BGP speaker which aggregated the route. If the value of the AS number is less than 2 octets ( 65535 or less), the AS4_AGGREGATOR object should not be sent. -// FourByteAs returns a uint32 -func (obj *bgpAttributesAggregator) FourByteAs() uint32 { - - if obj.obj.FourByteAs == nil { - obj.setChoice(BgpAttributesAggregatorChoice.FOUR_BYTE_AS) - } - - return *obj.obj.FourByteAs - -} - -// The value of the 4 byte AS number of the BGP speaker which aggregated the route. If the value of the AS number is less than 2 octets ( 65535 or less), the AS4_AGGREGATOR object should not be sent. -// FourByteAs returns a uint32 -func (obj *bgpAttributesAggregator) HasFourByteAs() bool { - return obj.obj.FourByteAs != nil -} - -// The value of the 4 byte AS number of the BGP speaker which aggregated the route. If the value of the AS number is less than 2 octets ( 65535 or less), the AS4_AGGREGATOR object should not be sent. -// SetFourByteAs sets the uint32 value in the BgpAttributesAggregator object -func (obj *bgpAttributesAggregator) SetFourByteAs(value uint32) BgpAttributesAggregator { - obj.setChoice(BgpAttributesAggregatorChoice.FOUR_BYTE_AS) - obj.obj.FourByteAs = &value - return obj -} - -// The value of the 2 byte AS number of the BGP speaker which aggregated the route. -// TwoByteAs returns a uint32 -func (obj *bgpAttributesAggregator) TwoByteAs() uint32 { - - if obj.obj.TwoByteAs == nil { - obj.setChoice(BgpAttributesAggregatorChoice.TWO_BYTE_AS) - } - - return *obj.obj.TwoByteAs - -} - -// The value of the 2 byte AS number of the BGP speaker which aggregated the route. -// TwoByteAs returns a uint32 -func (obj *bgpAttributesAggregator) HasTwoByteAs() bool { - return obj.obj.TwoByteAs != nil -} - -// The value of the 2 byte AS number of the BGP speaker which aggregated the route. -// SetTwoByteAs sets the uint32 value in the BgpAttributesAggregator object -func (obj *bgpAttributesAggregator) SetTwoByteAs(value uint32) BgpAttributesAggregator { - obj.setChoice(BgpAttributesAggregatorChoice.TWO_BYTE_AS) - obj.obj.TwoByteAs = &value - return obj -} - -// The IPv4 address of the BGP speaker which aggregated the route. -// Ipv4Address returns a string -func (obj *bgpAttributesAggregator) Ipv4Address() string { - - return *obj.obj.Ipv4Address - -} - -// The IPv4 address of the BGP speaker which aggregated the route. -// Ipv4Address returns a string -func (obj *bgpAttributesAggregator) HasIpv4Address() bool { - return obj.obj.Ipv4Address != nil -} - -// The IPv4 address of the BGP speaker which aggregated the route. -// SetIpv4Address sets the string value in the BgpAttributesAggregator object -func (obj *bgpAttributesAggregator) SetIpv4Address(value string) BgpAttributesAggregator { - - obj.obj.Ipv4Address = &value - return obj -} - -func (obj *bgpAttributesAggregator) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.TwoByteAs != nil { - - if *obj.obj.TwoByteAs > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesAggregator.TwoByteAs <= 65535 but Got %d", *obj.obj.TwoByteAs)) - } - - } - - if obj.obj.Ipv4Address != nil { - - err := obj.validateIpv4(obj.Ipv4Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesAggregator.Ipv4Address")) - } - - } - -} - -func (obj *bgpAttributesAggregator) setDefault() { - var choices_set int = 0 - var choice BgpAttributesAggregatorChoiceEnum - - if obj.obj.FourByteAs != nil { - choices_set += 1 - choice = BgpAttributesAggregatorChoice.FOUR_BYTE_AS - } - - if obj.obj.TwoByteAs != nil { - choices_set += 1 - choice = BgpAttributesAggregatorChoice.TWO_BYTE_AS - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(BgpAttributesAggregatorChoice.FOUR_BYTE_AS) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesAggregator") - } - } else { - intVal := otg.BgpAttributesAggregator_Choice_Enum_value[string(choice)] - enumValue := otg.BgpAttributesAggregator_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - - if obj.obj.Ipv4Address == nil { - obj.SetIpv4Address("0.0.0.0") - } - -} - -// ***** BgpAttributesAs4Aggregator ***** -type bgpAttributesAs4Aggregator struct { - validation - obj *otg.BgpAttributesAs4Aggregator - marshaller marshalBgpAttributesAs4Aggregator - unMarshaller unMarshalBgpAttributesAs4Aggregator -} - -func NewBgpAttributesAs4Aggregator() BgpAttributesAs4Aggregator { - obj := bgpAttributesAs4Aggregator{obj: &otg.BgpAttributesAs4Aggregator{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesAs4Aggregator) msg() *otg.BgpAttributesAs4Aggregator { - return obj.obj -} - -func (obj *bgpAttributesAs4Aggregator) setMsg(msg *otg.BgpAttributesAs4Aggregator) BgpAttributesAs4Aggregator { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesAs4Aggregator struct { - obj *bgpAttributesAs4Aggregator -} - -type marshalBgpAttributesAs4Aggregator interface { - // ToProto marshals BgpAttributesAs4Aggregator to protobuf object *otg.BgpAttributesAs4Aggregator - ToProto() (*otg.BgpAttributesAs4Aggregator, error) - // ToPbText marshals BgpAttributesAs4Aggregator to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesAs4Aggregator to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesAs4Aggregator to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesAs4Aggregator struct { - obj *bgpAttributesAs4Aggregator -} - -type unMarshalBgpAttributesAs4Aggregator interface { - // FromProto unmarshals BgpAttributesAs4Aggregator from protobuf object *otg.BgpAttributesAs4Aggregator - FromProto(msg *otg.BgpAttributesAs4Aggregator) (BgpAttributesAs4Aggregator, error) - // FromPbText unmarshals BgpAttributesAs4Aggregator from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesAs4Aggregator from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesAs4Aggregator from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesAs4Aggregator) Marshal() marshalBgpAttributesAs4Aggregator { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesAs4Aggregator{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesAs4Aggregator) Unmarshal() unMarshalBgpAttributesAs4Aggregator { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesAs4Aggregator{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesAs4Aggregator) ToProto() (*otg.BgpAttributesAs4Aggregator, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesAs4Aggregator) FromProto(msg *otg.BgpAttributesAs4Aggregator) (BgpAttributesAs4Aggregator, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesAs4Aggregator) 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 *unMarshalbgpAttributesAs4Aggregator) 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 *marshalbgpAttributesAs4Aggregator) 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 *unMarshalbgpAttributesAs4Aggregator) 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 *marshalbgpAttributesAs4Aggregator) 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 *unMarshalbgpAttributesAs4Aggregator) 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 *bgpAttributesAs4Aggregator) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesAs4Aggregator) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesAs4Aggregator) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesAs4Aggregator) Clone() (BgpAttributesAs4Aggregator, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesAs4Aggregator() - 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 -} - -// BgpAttributesAs4Aggregator is optional AS4_AGGREGATOR attribute which maybe be added by a BGP speaker in one of two cases: -// - If it is a new BGP speaker speaking to an old BGP speaker and needs to send a 4 byte value for the AS number of the BGP route aggregator. -// - If it is a old BGP speaker speaking to a new BGP speaker and has to transparently forward a received AS4_AGGREGATOR from some other peer. -// Its usage is described in RFC4893. -type BgpAttributesAs4Aggregator interface { - Validation - // msg marshals BgpAttributesAs4Aggregator to protobuf object *otg.BgpAttributesAs4Aggregator - // and doesn't set defaults - msg() *otg.BgpAttributesAs4Aggregator - // setMsg unmarshals BgpAttributesAs4Aggregator from protobuf object *otg.BgpAttributesAs4Aggregator - // and doesn't set defaults - setMsg(*otg.BgpAttributesAs4Aggregator) BgpAttributesAs4Aggregator - // provides marshal interface - Marshal() marshalBgpAttributesAs4Aggregator - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesAs4Aggregator - // validate validates BgpAttributesAs4Aggregator - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesAs4Aggregator, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // AsNum returns uint32, set in BgpAttributesAs4Aggregator. - AsNum() uint32 - // SetAsNum assigns uint32 provided by user to BgpAttributesAs4Aggregator - SetAsNum(value uint32) BgpAttributesAs4Aggregator - // HasAsNum checks if AsNum has been set in BgpAttributesAs4Aggregator - HasAsNum() bool - // Ipv4Address returns string, set in BgpAttributesAs4Aggregator. - Ipv4Address() string - // SetIpv4Address assigns string provided by user to BgpAttributesAs4Aggregator - SetIpv4Address(value string) BgpAttributesAs4Aggregator - // HasIpv4Address checks if Ipv4Address has been set in BgpAttributesAs4Aggregator - HasIpv4Address() bool -} - -// The value of the 4 byte AS number of the BGP speaker which aggregated the route. -// AsNum returns a uint32 -func (obj *bgpAttributesAs4Aggregator) AsNum() uint32 { - - return *obj.obj.AsNum - -} - -// The value of the 4 byte AS number of the BGP speaker which aggregated the route. -// AsNum returns a uint32 -func (obj *bgpAttributesAs4Aggregator) HasAsNum() bool { - return obj.obj.AsNum != nil -} - -// The value of the 4 byte AS number of the BGP speaker which aggregated the route. -// SetAsNum sets the uint32 value in the BgpAttributesAs4Aggregator object -func (obj *bgpAttributesAs4Aggregator) SetAsNum(value uint32) BgpAttributesAs4Aggregator { - - obj.obj.AsNum = &value - return obj -} - -// The IPv4 address of the BGP speaker which aggregated the route. -// Ipv4Address returns a string -func (obj *bgpAttributesAs4Aggregator) Ipv4Address() string { - - return *obj.obj.Ipv4Address - -} - -// The IPv4 address of the BGP speaker which aggregated the route. -// Ipv4Address returns a string -func (obj *bgpAttributesAs4Aggregator) HasIpv4Address() bool { - return obj.obj.Ipv4Address != nil -} - -// The IPv4 address of the BGP speaker which aggregated the route. -// SetIpv4Address sets the string value in the BgpAttributesAs4Aggregator object -func (obj *bgpAttributesAs4Aggregator) SetIpv4Address(value string) BgpAttributesAs4Aggregator { - - obj.obj.Ipv4Address = &value - return obj -} - -func (obj *bgpAttributesAs4Aggregator) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv4Address != nil { - - err := obj.validateIpv4(obj.Ipv4Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesAs4Aggregator.Ipv4Address")) - } - - } - -} - -func (obj *bgpAttributesAs4Aggregator) setDefault() { - if obj.obj.Ipv4Address == nil { - obj.SetIpv4Address("0.0.0.0") - } - -} - -// ***** BgpAttributesCommunity ***** -type bgpAttributesCommunity struct { - validation - obj *otg.BgpAttributesCommunity - marshaller marshalBgpAttributesCommunity - unMarshaller unMarshalBgpAttributesCommunity - customCommunityHolder BgpAttributesCustomCommunity -} - -func NewBgpAttributesCommunity() BgpAttributesCommunity { - obj := bgpAttributesCommunity{obj: &otg.BgpAttributesCommunity{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesCommunity) msg() *otg.BgpAttributesCommunity { - return obj.obj -} - -func (obj *bgpAttributesCommunity) setMsg(msg *otg.BgpAttributesCommunity) BgpAttributesCommunity { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesCommunity struct { - obj *bgpAttributesCommunity -} - -type marshalBgpAttributesCommunity interface { - // ToProto marshals BgpAttributesCommunity to protobuf object *otg.BgpAttributesCommunity - ToProto() (*otg.BgpAttributesCommunity, error) - // ToPbText marshals BgpAttributesCommunity to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesCommunity to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesCommunity to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesCommunity struct { - obj *bgpAttributesCommunity -} - -type unMarshalBgpAttributesCommunity interface { - // FromProto unmarshals BgpAttributesCommunity from protobuf object *otg.BgpAttributesCommunity - FromProto(msg *otg.BgpAttributesCommunity) (BgpAttributesCommunity, error) - // FromPbText unmarshals BgpAttributesCommunity from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesCommunity from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesCommunity from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesCommunity) Marshal() marshalBgpAttributesCommunity { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesCommunity{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesCommunity) Unmarshal() unMarshalBgpAttributesCommunity { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesCommunity{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesCommunity) ToProto() (*otg.BgpAttributesCommunity, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesCommunity) FromProto(msg *otg.BgpAttributesCommunity) (BgpAttributesCommunity, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesCommunity) 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 *unMarshalbgpAttributesCommunity) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesCommunity) 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 *unMarshalbgpAttributesCommunity) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesCommunity) 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 *unMarshalbgpAttributesCommunity) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesCommunity) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesCommunity) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesCommunity) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesCommunity) Clone() (BgpAttributesCommunity, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesCommunity() - 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 -} - -func (obj *bgpAttributesCommunity) setNil() { - obj.customCommunityHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesCommunity is the COMMUNITY attribute provide additional capability for tagging routes and for modifying BGP routing policy on -// upstream and downstream routers. BGP community is a 32-bit number which is broken into 16-bit AS number and a -// 16-bit custom value or it contains some pre-defined well known values. -type BgpAttributesCommunity interface { - Validation - // msg marshals BgpAttributesCommunity to protobuf object *otg.BgpAttributesCommunity - // and doesn't set defaults - msg() *otg.BgpAttributesCommunity - // setMsg unmarshals BgpAttributesCommunity from protobuf object *otg.BgpAttributesCommunity - // and doesn't set defaults - setMsg(*otg.BgpAttributesCommunity) BgpAttributesCommunity - // provides marshal interface - Marshal() marshalBgpAttributesCommunity - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesCommunity - // validate validates BgpAttributesCommunity - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesCommunity, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpAttributesCommunityChoiceEnum, set in BgpAttributesCommunity - 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() - // 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 - // SetCustomCommunity assigns BgpAttributesCustomCommunity provided by user to BgpAttributesCommunity. - // BgpAttributesCustomCommunity is user defined COMMUNITY attribute containing 2 byte AS and custom 2 byte value defined by the administrator of the domain. - SetCustomCommunity(value BgpAttributesCustomCommunity) BgpAttributesCommunity - // HasCustomCommunity checks if CustomCommunity has been set in BgpAttributesCommunity - HasCustomCommunity() bool - setNil() -} - -type BgpAttributesCommunityChoiceEnum string - -// Enum of Choice on BgpAttributesCommunity -var BgpAttributesCommunityChoice = struct { - CUSTOM_COMMUNITY BgpAttributesCommunityChoiceEnum - NO_EXPORT BgpAttributesCommunityChoiceEnum - NO_ADVERTISED BgpAttributesCommunityChoiceEnum - NO_EXPORT_SUBCONFED BgpAttributesCommunityChoiceEnum - LLGR_STALE BgpAttributesCommunityChoiceEnum - NO_LLGR BgpAttributesCommunityChoiceEnum -}{ - CUSTOM_COMMUNITY: BgpAttributesCommunityChoiceEnum("custom_community"), - NO_EXPORT: BgpAttributesCommunityChoiceEnum("no_export"), - NO_ADVERTISED: BgpAttributesCommunityChoiceEnum("no_advertised"), - NO_EXPORT_SUBCONFED: BgpAttributesCommunityChoiceEnum("no_export_subconfed"), - LLGR_STALE: BgpAttributesCommunityChoiceEnum("llgr_stale"), - NO_LLGR: BgpAttributesCommunityChoiceEnum("no_llgr"), -} - -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 NoExportSubconfed to set choice -func (obj *bgpAttributesCommunity) NoExportSubconfed() { - obj.setChoice(BgpAttributesCommunityChoice.NO_EXPORT_SUBCONFED) -} - -// getter for NoAdvertised to set choice -func (obj *bgpAttributesCommunity) NoAdvertised() { - obj.setChoice(BgpAttributesCommunityChoice.NO_ADVERTISED) -} - -// getter for NoLlgr to set choice -func (obj *bgpAttributesCommunity) NoLlgr() { - obj.setChoice(BgpAttributesCommunityChoice.NO_LLGR) -} - -// getter for NoExport to set choice -func (obj *bgpAttributesCommunity) NoExport() { - obj.setChoice(BgpAttributesCommunityChoice.NO_EXPORT) -} - -func (obj *bgpAttributesCommunity) setChoice(value BgpAttributesCommunityChoiceEnum) BgpAttributesCommunity { - intValue, ok := otg.BgpAttributesCommunity_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAttributesCommunityChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpAttributesCommunity_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.CustomCommunity = nil - obj.customCommunityHolder = nil - - if value == BgpAttributesCommunityChoice.CUSTOM_COMMUNITY { - obj.obj.CustomCommunity = NewBgpAttributesCustomCommunity().msg() - } - - return obj -} - -// description is TBD -// CustomCommunity returns a BgpAttributesCustomCommunity -func (obj *bgpAttributesCommunity) CustomCommunity() BgpAttributesCustomCommunity { - if obj.obj.CustomCommunity == nil { - obj.setChoice(BgpAttributesCommunityChoice.CUSTOM_COMMUNITY) - } - if obj.customCommunityHolder == nil { - obj.customCommunityHolder = &bgpAttributesCustomCommunity{obj: obj.obj.CustomCommunity} - } - return obj.customCommunityHolder -} - -// description is TBD -// CustomCommunity returns a BgpAttributesCustomCommunity -func (obj *bgpAttributesCommunity) HasCustomCommunity() bool { - return obj.obj.CustomCommunity != nil -} - -// description is TBD -// SetCustomCommunity sets the BgpAttributesCustomCommunity value in the BgpAttributesCommunity object -func (obj *bgpAttributesCommunity) SetCustomCommunity(value BgpAttributesCustomCommunity) BgpAttributesCommunity { - obj.setChoice(BgpAttributesCommunityChoice.CUSTOM_COMMUNITY) - obj.customCommunityHolder = nil - obj.obj.CustomCommunity = value.msg() - - return obj -} - -func (obj *bgpAttributesCommunity) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface BgpAttributesCommunity") - } - - if obj.obj.CustomCommunity != nil { - - obj.CustomCommunity().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesCommunity) setDefault() { - var choices_set int = 0 - var choice BgpAttributesCommunityChoiceEnum - - if obj.obj.CustomCommunity != nil { - choices_set += 1 - choice = BgpAttributesCommunityChoice.CUSTOM_COMMUNITY - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesCommunity") - } - } else { - intVal := otg.BgpAttributesCommunity_Choice_Enum_value[string(choice)] - enumValue := otg.BgpAttributesCommunity_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpAttributesOriginatorId ***** -type bgpAttributesOriginatorId struct { - validation - obj *otg.BgpAttributesOriginatorId - marshaller marshalBgpAttributesOriginatorId - unMarshaller unMarshalBgpAttributesOriginatorId -} - -func NewBgpAttributesOriginatorId() BgpAttributesOriginatorId { - obj := bgpAttributesOriginatorId{obj: &otg.BgpAttributesOriginatorId{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesOriginatorId) msg() *otg.BgpAttributesOriginatorId { - return obj.obj -} - -func (obj *bgpAttributesOriginatorId) setMsg(msg *otg.BgpAttributesOriginatorId) BgpAttributesOriginatorId { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesOriginatorId struct { - obj *bgpAttributesOriginatorId -} - -type marshalBgpAttributesOriginatorId interface { - // ToProto marshals BgpAttributesOriginatorId to protobuf object *otg.BgpAttributesOriginatorId - ToProto() (*otg.BgpAttributesOriginatorId, error) - // ToPbText marshals BgpAttributesOriginatorId to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesOriginatorId to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesOriginatorId to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesOriginatorId struct { - obj *bgpAttributesOriginatorId -} - -type unMarshalBgpAttributesOriginatorId interface { - // FromProto unmarshals BgpAttributesOriginatorId from protobuf object *otg.BgpAttributesOriginatorId - FromProto(msg *otg.BgpAttributesOriginatorId) (BgpAttributesOriginatorId, error) - // FromPbText unmarshals BgpAttributesOriginatorId from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesOriginatorId from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesOriginatorId from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesOriginatorId) Marshal() marshalBgpAttributesOriginatorId { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesOriginatorId{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesOriginatorId) Unmarshal() unMarshalBgpAttributesOriginatorId { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesOriginatorId{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesOriginatorId) ToProto() (*otg.BgpAttributesOriginatorId, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesOriginatorId) FromProto(msg *otg.BgpAttributesOriginatorId) (BgpAttributesOriginatorId, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesOriginatorId) 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 *unMarshalbgpAttributesOriginatorId) 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 *marshalbgpAttributesOriginatorId) 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 *unMarshalbgpAttributesOriginatorId) 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 *marshalbgpAttributesOriginatorId) 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 *unMarshalbgpAttributesOriginatorId) 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 *bgpAttributesOriginatorId) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesOriginatorId) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesOriginatorId) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesOriginatorId) Clone() (BgpAttributesOriginatorId, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesOriginatorId() - 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 -} - -// BgpAttributesOriginatorId is optional ORIGINATOR_ID attribute (type code 9) carries the Router Id of the route's originator in the local AS. -type BgpAttributesOriginatorId interface { - Validation - // msg marshals BgpAttributesOriginatorId to protobuf object *otg.BgpAttributesOriginatorId - // and doesn't set defaults - msg() *otg.BgpAttributesOriginatorId - // setMsg unmarshals BgpAttributesOriginatorId from protobuf object *otg.BgpAttributesOriginatorId - // and doesn't set defaults - setMsg(*otg.BgpAttributesOriginatorId) BgpAttributesOriginatorId - // provides marshal interface - Marshal() marshalBgpAttributesOriginatorId - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesOriginatorId - // validate validates BgpAttributesOriginatorId - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesOriginatorId, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Value returns string, set in BgpAttributesOriginatorId. - Value() string - // SetValue assigns string provided by user to BgpAttributesOriginatorId - SetValue(value string) BgpAttributesOriginatorId - // HasValue checks if Value has been set in BgpAttributesOriginatorId - HasValue() bool -} - -// The value of the originator's Router Id. -// Value returns a string -func (obj *bgpAttributesOriginatorId) Value() string { - - return *obj.obj.Value - -} - -// The value of the originator's Router Id. -// Value returns a string -func (obj *bgpAttributesOriginatorId) HasValue() bool { - return obj.obj.Value != nil -} - -// The value of the originator's Router Id. -// SetValue sets the string value in the BgpAttributesOriginatorId object -func (obj *bgpAttributesOriginatorId) SetValue(value string) BgpAttributesOriginatorId { - - obj.obj.Value = &value - return obj -} - -func (obj *bgpAttributesOriginatorId) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv4(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesOriginatorId.Value")) - } - - } - -} - -func (obj *bgpAttributesOriginatorId) setDefault() { - if obj.obj.Value == nil { - obj.SetValue("0.0.0.0") - } - -} - -// ***** BgpAttributesTunnelEncapsulation ***** -type bgpAttributesTunnelEncapsulation struct { - validation - obj *otg.BgpAttributesTunnelEncapsulation - marshaller marshalBgpAttributesTunnelEncapsulation - unMarshaller unMarshalBgpAttributesTunnelEncapsulation - srPolicyHolder BgpAttributesSegmentRoutingPolicy -} - -func NewBgpAttributesTunnelEncapsulation() BgpAttributesTunnelEncapsulation { - obj := bgpAttributesTunnelEncapsulation{obj: &otg.BgpAttributesTunnelEncapsulation{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesTunnelEncapsulation) msg() *otg.BgpAttributesTunnelEncapsulation { - return obj.obj -} - -func (obj *bgpAttributesTunnelEncapsulation) setMsg(msg *otg.BgpAttributesTunnelEncapsulation) BgpAttributesTunnelEncapsulation { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesTunnelEncapsulation struct { - obj *bgpAttributesTunnelEncapsulation -} - -type marshalBgpAttributesTunnelEncapsulation interface { - // ToProto marshals BgpAttributesTunnelEncapsulation to protobuf object *otg.BgpAttributesTunnelEncapsulation - ToProto() (*otg.BgpAttributesTunnelEncapsulation, error) - // ToPbText marshals BgpAttributesTunnelEncapsulation to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesTunnelEncapsulation to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesTunnelEncapsulation to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesTunnelEncapsulation struct { - obj *bgpAttributesTunnelEncapsulation -} - -type unMarshalBgpAttributesTunnelEncapsulation interface { - // FromProto unmarshals BgpAttributesTunnelEncapsulation from protobuf object *otg.BgpAttributesTunnelEncapsulation - FromProto(msg *otg.BgpAttributesTunnelEncapsulation) (BgpAttributesTunnelEncapsulation, error) - // FromPbText unmarshals BgpAttributesTunnelEncapsulation from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesTunnelEncapsulation from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesTunnelEncapsulation from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesTunnelEncapsulation) Marshal() marshalBgpAttributesTunnelEncapsulation { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesTunnelEncapsulation{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesTunnelEncapsulation) Unmarshal() unMarshalBgpAttributesTunnelEncapsulation { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesTunnelEncapsulation{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesTunnelEncapsulation) ToProto() (*otg.BgpAttributesTunnelEncapsulation, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesTunnelEncapsulation) FromProto(msg *otg.BgpAttributesTunnelEncapsulation) (BgpAttributesTunnelEncapsulation, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesTunnelEncapsulation) 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 *unMarshalbgpAttributesTunnelEncapsulation) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesTunnelEncapsulation) 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 *unMarshalbgpAttributesTunnelEncapsulation) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesTunnelEncapsulation) 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 *unMarshalbgpAttributesTunnelEncapsulation) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesTunnelEncapsulation) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesTunnelEncapsulation) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesTunnelEncapsulation) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesTunnelEncapsulation) Clone() (BgpAttributesTunnelEncapsulation, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesTunnelEncapsulation() - 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 -} - -func (obj *bgpAttributesTunnelEncapsulation) setNil() { - obj.srPolicyHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesTunnelEncapsulation is the TUNNEL_ENCAPSULATION attribute is used by a BGP speaker to inform other BGP speakers how to encapsulate packets that need to be sent to it. -// It is defined in RFC9012 and is assigned a Type code of 23. -type BgpAttributesTunnelEncapsulation interface { - Validation - // msg marshals BgpAttributesTunnelEncapsulation to protobuf object *otg.BgpAttributesTunnelEncapsulation - // and doesn't set defaults - msg() *otg.BgpAttributesTunnelEncapsulation - // setMsg unmarshals BgpAttributesTunnelEncapsulation from protobuf object *otg.BgpAttributesTunnelEncapsulation - // and doesn't set defaults - setMsg(*otg.BgpAttributesTunnelEncapsulation) BgpAttributesTunnelEncapsulation - // provides marshal interface - Marshal() marshalBgpAttributesTunnelEncapsulation - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesTunnelEncapsulation - // validate validates BgpAttributesTunnelEncapsulation - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesTunnelEncapsulation, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpAttributesTunnelEncapsulationChoiceEnum, set in BgpAttributesTunnelEncapsulation - Choice() BgpAttributesTunnelEncapsulationChoiceEnum - // setChoice assigns BgpAttributesTunnelEncapsulationChoiceEnum provided by user to BgpAttributesTunnelEncapsulation - setChoice(value BgpAttributesTunnelEncapsulationChoiceEnum) BgpAttributesTunnelEncapsulation - // HasChoice checks if Choice has been set in BgpAttributesTunnelEncapsulation - HasChoice() bool - // SrPolicy returns BgpAttributesSegmentRoutingPolicy, set in BgpAttributesTunnelEncapsulation. - // BgpAttributesSegmentRoutingPolicy is optional Segment Routing Policy information as defined in draft-ietf-idr-sr-policy-safi-02. - // This information is carried in TUNNEL_ENCAPSULATION attribute with type set to SR Policy (15). - SrPolicy() BgpAttributesSegmentRoutingPolicy - // SetSrPolicy assigns BgpAttributesSegmentRoutingPolicy provided by user to BgpAttributesTunnelEncapsulation. - // BgpAttributesSegmentRoutingPolicy is optional Segment Routing Policy information as defined in draft-ietf-idr-sr-policy-safi-02. - // This information is carried in TUNNEL_ENCAPSULATION attribute with type set to SR Policy (15). - SetSrPolicy(value BgpAttributesSegmentRoutingPolicy) BgpAttributesTunnelEncapsulation - // HasSrPolicy checks if SrPolicy has been set in BgpAttributesTunnelEncapsulation - HasSrPolicy() bool - setNil() -} - -type BgpAttributesTunnelEncapsulationChoiceEnum string - -// Enum of Choice on BgpAttributesTunnelEncapsulation -var BgpAttributesTunnelEncapsulationChoice = struct { - SR_POLICY BgpAttributesTunnelEncapsulationChoiceEnum -}{ - SR_POLICY: BgpAttributesTunnelEncapsulationChoiceEnum("sr_policy"), -} - -func (obj *bgpAttributesTunnelEncapsulation) Choice() BgpAttributesTunnelEncapsulationChoiceEnum { - return BgpAttributesTunnelEncapsulationChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// Identifies a type of tunnel. The field contains values from the IANA registry "BGP Tunnel Encapsulation Attribute Tunnel Types". -// Choice returns a string -func (obj *bgpAttributesTunnelEncapsulation) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpAttributesTunnelEncapsulation) setChoice(value BgpAttributesTunnelEncapsulationChoiceEnum) BgpAttributesTunnelEncapsulation { - intValue, ok := otg.BgpAttributesTunnelEncapsulation_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAttributesTunnelEncapsulationChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpAttributesTunnelEncapsulation_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.SrPolicy = nil - obj.srPolicyHolder = nil - - if value == BgpAttributesTunnelEncapsulationChoice.SR_POLICY { - obj.obj.SrPolicy = NewBgpAttributesSegmentRoutingPolicy().msg() - } - - return obj -} - -// description is TBD -// SrPolicy returns a BgpAttributesSegmentRoutingPolicy -func (obj *bgpAttributesTunnelEncapsulation) SrPolicy() BgpAttributesSegmentRoutingPolicy { - if obj.obj.SrPolicy == nil { - obj.setChoice(BgpAttributesTunnelEncapsulationChoice.SR_POLICY) - } - if obj.srPolicyHolder == nil { - obj.srPolicyHolder = &bgpAttributesSegmentRoutingPolicy{obj: obj.obj.SrPolicy} - } - return obj.srPolicyHolder -} - -// description is TBD -// SrPolicy returns a BgpAttributesSegmentRoutingPolicy -func (obj *bgpAttributesTunnelEncapsulation) HasSrPolicy() bool { - return obj.obj.SrPolicy != nil -} - -// description is TBD -// SetSrPolicy sets the BgpAttributesSegmentRoutingPolicy value in the BgpAttributesTunnelEncapsulation object -func (obj *bgpAttributesTunnelEncapsulation) SetSrPolicy(value BgpAttributesSegmentRoutingPolicy) BgpAttributesTunnelEncapsulation { - obj.setChoice(BgpAttributesTunnelEncapsulationChoice.SR_POLICY) - obj.srPolicyHolder = nil - obj.obj.SrPolicy = value.msg() - - return obj -} - -func (obj *bgpAttributesTunnelEncapsulation) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.SrPolicy != nil { - - obj.SrPolicy().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesTunnelEncapsulation) setDefault() { - var choices_set int = 0 - var choice BgpAttributesTunnelEncapsulationChoiceEnum - - if obj.obj.SrPolicy != nil { - choices_set += 1 - choice = BgpAttributesTunnelEncapsulationChoice.SR_POLICY - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(BgpAttributesTunnelEncapsulationChoice.SR_POLICY) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesTunnelEncapsulation") - } - } else { - intVal := otg.BgpAttributesTunnelEncapsulation_Choice_Enum_value[string(choice)] - enumValue := otg.BgpAttributesTunnelEncapsulation_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpAttributesMpReachNlri ***** -type bgpAttributesMpReachNlri struct { - validation - obj *otg.BgpAttributesMpReachNlri - marshaller marshalBgpAttributesMpReachNlri - unMarshaller unMarshalBgpAttributesMpReachNlri - nextHopHolder BgpAttributesNextHop - ipv4UnicastHolder BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter - ipv6UnicastHolder BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter - ipv4SrpolicyHolder BgpIpv4SrPolicyNLRIPrefix - ipv6SrpolicyHolder BgpIpv6SrPolicyNLRIPrefix -} - -func NewBgpAttributesMpReachNlri() BgpAttributesMpReachNlri { - obj := bgpAttributesMpReachNlri{obj: &otg.BgpAttributesMpReachNlri{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesMpReachNlri) msg() *otg.BgpAttributesMpReachNlri { - return obj.obj -} - -func (obj *bgpAttributesMpReachNlri) setMsg(msg *otg.BgpAttributesMpReachNlri) BgpAttributesMpReachNlri { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesMpReachNlri struct { - obj *bgpAttributesMpReachNlri -} - -type marshalBgpAttributesMpReachNlri interface { - // ToProto marshals BgpAttributesMpReachNlri to protobuf object *otg.BgpAttributesMpReachNlri - ToProto() (*otg.BgpAttributesMpReachNlri, error) - // ToPbText marshals BgpAttributesMpReachNlri to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesMpReachNlri to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesMpReachNlri to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesMpReachNlri struct { - obj *bgpAttributesMpReachNlri -} - -type unMarshalBgpAttributesMpReachNlri interface { - // FromProto unmarshals BgpAttributesMpReachNlri from protobuf object *otg.BgpAttributesMpReachNlri - FromProto(msg *otg.BgpAttributesMpReachNlri) (BgpAttributesMpReachNlri, error) - // FromPbText unmarshals BgpAttributesMpReachNlri from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesMpReachNlri from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesMpReachNlri from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesMpReachNlri) Marshal() marshalBgpAttributesMpReachNlri { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesMpReachNlri{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesMpReachNlri) Unmarshal() unMarshalBgpAttributesMpReachNlri { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesMpReachNlri{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesMpReachNlri) ToProto() (*otg.BgpAttributesMpReachNlri, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesMpReachNlri) FromProto(msg *otg.BgpAttributesMpReachNlri) (BgpAttributesMpReachNlri, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesMpReachNlri) 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 *unMarshalbgpAttributesMpReachNlri) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesMpReachNlri) 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 *unMarshalbgpAttributesMpReachNlri) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesMpReachNlri) 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 *unMarshalbgpAttributesMpReachNlri) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesMpReachNlri) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesMpReachNlri) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesMpReachNlri) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesMpReachNlri) Clone() (BgpAttributesMpReachNlri, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesMpReachNlri() - 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 -} - -func (obj *bgpAttributesMpReachNlri) setNil() { - obj.nextHopHolder = nil - obj.ipv4UnicastHolder = nil - obj.ipv6UnicastHolder = nil - obj.ipv4SrpolicyHolder = nil - obj.ipv6SrpolicyHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesMpReachNlri is the MP_REACH attribute is an optional attribute which can be included in the attributes of a BGP Update message as defined in https://datatracker.ietf.org/doc/html/rfc4760#section-3. -// The following AFI / SAFI combinations are supported: -// - IPv4 Unicast with AFI as 1 and SAFI as 1 -// - IPv6 Unicast with AFI as 2 and SAFI as 1 -// - Segment Routing Policy for IPv4 Unicast with AFI as 1 and SAFI as 73 ( draft-ietf-idr-sr-policy-safi-02 Section 2.1 ) -// - Segment Routing Policy for IPv6 Unicast with AFI as 2 and SAFI as 73 -type BgpAttributesMpReachNlri interface { - Validation - // msg marshals BgpAttributesMpReachNlri to protobuf object *otg.BgpAttributesMpReachNlri - // and doesn't set defaults - msg() *otg.BgpAttributesMpReachNlri - // setMsg unmarshals BgpAttributesMpReachNlri from protobuf object *otg.BgpAttributesMpReachNlri - // and doesn't set defaults - setMsg(*otg.BgpAttributesMpReachNlri) BgpAttributesMpReachNlri - // provides marshal interface - Marshal() marshalBgpAttributesMpReachNlri - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesMpReachNlri - // validate validates BgpAttributesMpReachNlri - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesMpReachNlri, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // NextHop returns BgpAttributesNextHop, set in BgpAttributesMpReachNlri. - // BgpAttributesNextHop is next hop to be sent inside MP_REACH NLRI or as the NEXT_HOP attribute if advertised as traditional NLRI. - NextHop() BgpAttributesNextHop - // SetNextHop assigns BgpAttributesNextHop provided by user to BgpAttributesMpReachNlri. - // BgpAttributesNextHop is next hop to be sent inside MP_REACH NLRI or as the NEXT_HOP attribute if advertised as traditional NLRI. - SetNextHop(value BgpAttributesNextHop) BgpAttributesMpReachNlri - // HasNextHop checks if NextHop has been set in BgpAttributesMpReachNlri - HasNextHop() bool - // Choice returns BgpAttributesMpReachNlriChoiceEnum, set in BgpAttributesMpReachNlri - Choice() BgpAttributesMpReachNlriChoiceEnum - // setChoice assigns BgpAttributesMpReachNlriChoiceEnum provided by user to BgpAttributesMpReachNlri - setChoice(value BgpAttributesMpReachNlriChoiceEnum) BgpAttributesMpReachNlri - // Ipv4Unicast returns BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIterIter, set in BgpAttributesMpReachNlri - Ipv4Unicast() BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter - // Ipv6Unicast returns BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIterIter, set in BgpAttributesMpReachNlri - Ipv6Unicast() BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter - // Ipv4Srpolicy returns BgpIpv4SrPolicyNLRIPrefix, set in BgpAttributesMpReachNlri. - // BgpIpv4SrPolicyNLRIPrefix is iPv4 Segment Routing Policy NLRI Prefix. - Ipv4Srpolicy() BgpIpv4SrPolicyNLRIPrefix - // SetIpv4Srpolicy assigns BgpIpv4SrPolicyNLRIPrefix provided by user to BgpAttributesMpReachNlri. - // BgpIpv4SrPolicyNLRIPrefix is iPv4 Segment Routing Policy NLRI Prefix. - SetIpv4Srpolicy(value BgpIpv4SrPolicyNLRIPrefix) BgpAttributesMpReachNlri - // HasIpv4Srpolicy checks if Ipv4Srpolicy has been set in BgpAttributesMpReachNlri - HasIpv4Srpolicy() bool - // Ipv6Srpolicy returns BgpIpv6SrPolicyNLRIPrefix, set in BgpAttributesMpReachNlri. - // BgpIpv6SrPolicyNLRIPrefix is one IPv6 Segment Routing Policy NLRI Prefix. - Ipv6Srpolicy() BgpIpv6SrPolicyNLRIPrefix - // SetIpv6Srpolicy assigns BgpIpv6SrPolicyNLRIPrefix provided by user to BgpAttributesMpReachNlri. - // BgpIpv6SrPolicyNLRIPrefix is one IPv6 Segment Routing Policy NLRI Prefix. - SetIpv6Srpolicy(value BgpIpv6SrPolicyNLRIPrefix) BgpAttributesMpReachNlri - // HasIpv6Srpolicy checks if Ipv6Srpolicy has been set in BgpAttributesMpReachNlri - HasIpv6Srpolicy() bool - setNil() -} - -// description is TBD -// NextHop returns a BgpAttributesNextHop -func (obj *bgpAttributesMpReachNlri) NextHop() BgpAttributesNextHop { - if obj.obj.NextHop == nil { - obj.obj.NextHop = NewBgpAttributesNextHop().msg() - } - if obj.nextHopHolder == nil { - obj.nextHopHolder = &bgpAttributesNextHop{obj: obj.obj.NextHop} - } - return obj.nextHopHolder -} - -// description is TBD -// NextHop returns a BgpAttributesNextHop -func (obj *bgpAttributesMpReachNlri) HasNextHop() bool { - return obj.obj.NextHop != nil -} - -// description is TBD -// SetNextHop sets the BgpAttributesNextHop value in the BgpAttributesMpReachNlri object -func (obj *bgpAttributesMpReachNlri) SetNextHop(value BgpAttributesNextHop) BgpAttributesMpReachNlri { - - obj.nextHopHolder = nil - obj.obj.NextHop = value.msg() - - return obj -} - -type BgpAttributesMpReachNlriChoiceEnum string - -// Enum of Choice on BgpAttributesMpReachNlri -var BgpAttributesMpReachNlriChoice = struct { - IPV4_UNICAST BgpAttributesMpReachNlriChoiceEnum - IPV6_UNICAST BgpAttributesMpReachNlriChoiceEnum - IPV4_SRPOLICY BgpAttributesMpReachNlriChoiceEnum - IPV6_SRPOLICY BgpAttributesMpReachNlriChoiceEnum -}{ - IPV4_UNICAST: BgpAttributesMpReachNlriChoiceEnum("ipv4_unicast"), - IPV6_UNICAST: BgpAttributesMpReachNlriChoiceEnum("ipv6_unicast"), - IPV4_SRPOLICY: BgpAttributesMpReachNlriChoiceEnum("ipv4_srpolicy"), - IPV6_SRPOLICY: BgpAttributesMpReachNlriChoiceEnum("ipv6_srpolicy"), -} - -func (obj *bgpAttributesMpReachNlri) Choice() BgpAttributesMpReachNlriChoiceEnum { - return BgpAttributesMpReachNlriChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *bgpAttributesMpReachNlri) setChoice(value BgpAttributesMpReachNlriChoiceEnum) BgpAttributesMpReachNlri { - intValue, ok := otg.BgpAttributesMpReachNlri_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAttributesMpReachNlriChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpAttributesMpReachNlri_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Ipv6Srpolicy = nil - obj.ipv6SrpolicyHolder = nil - obj.obj.Ipv4Srpolicy = nil - obj.ipv4SrpolicyHolder = nil - obj.obj.Ipv6Unicast = nil - obj.ipv6UnicastHolder = nil - obj.obj.Ipv4Unicast = nil - obj.ipv4UnicastHolder = nil - - if value == BgpAttributesMpReachNlriChoice.IPV4_UNICAST { - obj.obj.Ipv4Unicast = []*otg.BgpOneIpv4NLRIPrefix{} - } - - if value == BgpAttributesMpReachNlriChoice.IPV6_UNICAST { - obj.obj.Ipv6Unicast = []*otg.BgpOneIpv6NLRIPrefix{} - } - - if value == BgpAttributesMpReachNlriChoice.IPV4_SRPOLICY { - obj.obj.Ipv4Srpolicy = NewBgpIpv4SrPolicyNLRIPrefix().msg() - } - - if value == BgpAttributesMpReachNlriChoice.IPV6_SRPOLICY { - obj.obj.Ipv6Srpolicy = NewBgpIpv6SrPolicyNLRIPrefix().msg() - } - - return obj -} - -// List of IPv4 prefixes being sent in the IPv4 Unicast MPREACH_NLRI . -// Ipv4Unicast returns a []BgpOneIpv4NLRIPrefix -func (obj *bgpAttributesMpReachNlri) Ipv4Unicast() BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { - if len(obj.obj.Ipv4Unicast) == 0 { - obj.setChoice(BgpAttributesMpReachNlriChoice.IPV4_UNICAST) - } - if obj.ipv4UnicastHolder == nil { - obj.ipv4UnicastHolder = newBgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter(&obj.obj.Ipv4Unicast).setMsg(obj) - } - return obj.ipv4UnicastHolder -} - -type bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter struct { - obj *bgpAttributesMpReachNlri - bgpOneIpv4NLRIPrefixSlice []BgpOneIpv4NLRIPrefix - fieldPtr *[]*otg.BgpOneIpv4NLRIPrefix -} - -func newBgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter(ptr *[]*otg.BgpOneIpv4NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { - return &bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter{fieldPtr: ptr} -} - -type BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter interface { - setMsg(*bgpAttributesMpReachNlri) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter - Items() []BgpOneIpv4NLRIPrefix - Add() BgpOneIpv4NLRIPrefix - Append(items ...BgpOneIpv4NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter - Set(index int, newObj BgpOneIpv4NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter - Clear() BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter - clearHolderSlice() BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter - appendHolderSlice(item BgpOneIpv4NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter -} - -func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) setMsg(msg *bgpAttributesMpReachNlri) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpOneIpv4NLRIPrefix{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) Items() []BgpOneIpv4NLRIPrefix { - return obj.bgpOneIpv4NLRIPrefixSlice -} - -func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) Add() BgpOneIpv4NLRIPrefix { - newObj := &otg.BgpOneIpv4NLRIPrefix{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpOneIpv4NLRIPrefix{obj: newObj} - newLibObj.setDefault() - obj.bgpOneIpv4NLRIPrefixSlice = append(obj.bgpOneIpv4NLRIPrefixSlice, newLibObj) - return newLibObj -} - -func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) Append(items ...BgpOneIpv4NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpOneIpv4NLRIPrefixSlice = append(obj.bgpOneIpv4NLRIPrefixSlice, item) - } - return obj -} - -func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) Set(index int, newObj BgpOneIpv4NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpOneIpv4NLRIPrefixSlice[index] = newObj - return obj -} -func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) Clear() BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpOneIpv4NLRIPrefix{} - obj.bgpOneIpv4NLRIPrefixSlice = []BgpOneIpv4NLRIPrefix{} - } - return obj -} -func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) clearHolderSlice() BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { - if len(obj.bgpOneIpv4NLRIPrefixSlice) > 0 { - obj.bgpOneIpv4NLRIPrefixSlice = []BgpOneIpv4NLRIPrefix{} - } - return obj -} -func (obj *bgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter) appendHolderSlice(item BgpOneIpv4NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv4NLRIPrefixIter { - obj.bgpOneIpv4NLRIPrefixSlice = append(obj.bgpOneIpv4NLRIPrefixSlice, item) - return obj -} - -// List of IPv6 prefixes being sent in the IPv6 Unicast MPREACH_NLRI . -// Ipv6Unicast returns a []BgpOneIpv6NLRIPrefix -func (obj *bgpAttributesMpReachNlri) Ipv6Unicast() BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { - if len(obj.obj.Ipv6Unicast) == 0 { - obj.setChoice(BgpAttributesMpReachNlriChoice.IPV6_UNICAST) - } - if obj.ipv6UnicastHolder == nil { - obj.ipv6UnicastHolder = newBgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter(&obj.obj.Ipv6Unicast).setMsg(obj) - } - return obj.ipv6UnicastHolder -} - -type bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter struct { - obj *bgpAttributesMpReachNlri - bgpOneIpv6NLRIPrefixSlice []BgpOneIpv6NLRIPrefix - fieldPtr *[]*otg.BgpOneIpv6NLRIPrefix -} - -func newBgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter(ptr *[]*otg.BgpOneIpv6NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { - return &bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter{fieldPtr: ptr} -} - -type BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter interface { - setMsg(*bgpAttributesMpReachNlri) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter - Items() []BgpOneIpv6NLRIPrefix - Add() BgpOneIpv6NLRIPrefix - Append(items ...BgpOneIpv6NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter - Set(index int, newObj BgpOneIpv6NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter - Clear() BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter - clearHolderSlice() BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter - appendHolderSlice(item BgpOneIpv6NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter -} - -func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) setMsg(msg *bgpAttributesMpReachNlri) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpOneIpv6NLRIPrefix{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) Items() []BgpOneIpv6NLRIPrefix { - return obj.bgpOneIpv6NLRIPrefixSlice -} - -func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) Add() BgpOneIpv6NLRIPrefix { - newObj := &otg.BgpOneIpv6NLRIPrefix{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpOneIpv6NLRIPrefix{obj: newObj} - newLibObj.setDefault() - obj.bgpOneIpv6NLRIPrefixSlice = append(obj.bgpOneIpv6NLRIPrefixSlice, newLibObj) - return newLibObj -} - -func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) Append(items ...BgpOneIpv6NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpOneIpv6NLRIPrefixSlice = append(obj.bgpOneIpv6NLRIPrefixSlice, item) - } - return obj -} - -func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) Set(index int, newObj BgpOneIpv6NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpOneIpv6NLRIPrefixSlice[index] = newObj - return obj -} -func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) Clear() BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpOneIpv6NLRIPrefix{} - obj.bgpOneIpv6NLRIPrefixSlice = []BgpOneIpv6NLRIPrefix{} - } - return obj -} -func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) clearHolderSlice() BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { - if len(obj.bgpOneIpv6NLRIPrefixSlice) > 0 { - obj.bgpOneIpv6NLRIPrefixSlice = []BgpOneIpv6NLRIPrefix{} - } - return obj -} -func (obj *bgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter) appendHolderSlice(item BgpOneIpv6NLRIPrefix) BgpAttributesMpReachNlriBgpOneIpv6NLRIPrefixIter { - obj.bgpOneIpv6NLRIPrefixSlice = append(obj.bgpOneIpv6NLRIPrefixSlice, item) - return obj -} - -// IPv4 endpoint with Segment Routing Policy being sent in the IPv4 MPREACH_NLRI . -// Ipv4Srpolicy returns a BgpIpv4SrPolicyNLRIPrefix -func (obj *bgpAttributesMpReachNlri) Ipv4Srpolicy() BgpIpv4SrPolicyNLRIPrefix { - if obj.obj.Ipv4Srpolicy == nil { - obj.setChoice(BgpAttributesMpReachNlriChoice.IPV4_SRPOLICY) - } - if obj.ipv4SrpolicyHolder == nil { - obj.ipv4SrpolicyHolder = &bgpIpv4SrPolicyNLRIPrefix{obj: obj.obj.Ipv4Srpolicy} - } - return obj.ipv4SrpolicyHolder -} - -// IPv4 endpoint with Segment Routing Policy being sent in the IPv4 MPREACH_NLRI . -// Ipv4Srpolicy returns a BgpIpv4SrPolicyNLRIPrefix -func (obj *bgpAttributesMpReachNlri) HasIpv4Srpolicy() bool { - return obj.obj.Ipv4Srpolicy != nil -} - -// IPv4 endpoint with Segment Routing Policy being sent in the IPv4 MPREACH_NLRI . -// SetIpv4Srpolicy sets the BgpIpv4SrPolicyNLRIPrefix value in the BgpAttributesMpReachNlri object -func (obj *bgpAttributesMpReachNlri) SetIpv4Srpolicy(value BgpIpv4SrPolicyNLRIPrefix) BgpAttributesMpReachNlri { - obj.setChoice(BgpAttributesMpReachNlriChoice.IPV4_SRPOLICY) - obj.ipv4SrpolicyHolder = nil - obj.obj.Ipv4Srpolicy = value.msg() - - return obj -} - -// IPv6 endpoint with Segment Routing Policy being sent in the IPv6 MPREACH_NLRI . -// Ipv6Srpolicy returns a BgpIpv6SrPolicyNLRIPrefix -func (obj *bgpAttributesMpReachNlri) Ipv6Srpolicy() BgpIpv6SrPolicyNLRIPrefix { - if obj.obj.Ipv6Srpolicy == nil { - obj.setChoice(BgpAttributesMpReachNlriChoice.IPV6_SRPOLICY) - } - if obj.ipv6SrpolicyHolder == nil { - obj.ipv6SrpolicyHolder = &bgpIpv6SrPolicyNLRIPrefix{obj: obj.obj.Ipv6Srpolicy} - } - return obj.ipv6SrpolicyHolder -} - -// IPv6 endpoint with Segment Routing Policy being sent in the IPv6 MPREACH_NLRI . -// Ipv6Srpolicy returns a BgpIpv6SrPolicyNLRIPrefix -func (obj *bgpAttributesMpReachNlri) HasIpv6Srpolicy() bool { - return obj.obj.Ipv6Srpolicy != nil -} - -// IPv6 endpoint with Segment Routing Policy being sent in the IPv6 MPREACH_NLRI . -// SetIpv6Srpolicy sets the BgpIpv6SrPolicyNLRIPrefix value in the BgpAttributesMpReachNlri object -func (obj *bgpAttributesMpReachNlri) SetIpv6Srpolicy(value BgpIpv6SrPolicyNLRIPrefix) BgpAttributesMpReachNlri { - obj.setChoice(BgpAttributesMpReachNlriChoice.IPV6_SRPOLICY) - obj.ipv6SrpolicyHolder = nil - obj.obj.Ipv6Srpolicy = value.msg() - - return obj -} - -func (obj *bgpAttributesMpReachNlri) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.NextHop != nil { - - obj.NextHop().validateObj(vObj, set_default) - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface BgpAttributesMpReachNlri") - } - - if len(obj.obj.Ipv4Unicast) != 0 { - - if set_default { - obj.Ipv4Unicast().clearHolderSlice() - for _, item := range obj.obj.Ipv4Unicast { - obj.Ipv4Unicast().appendHolderSlice(&bgpOneIpv4NLRIPrefix{obj: item}) - } - } - for _, item := range obj.Ipv4Unicast().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Ipv6Unicast) != 0 { - - if set_default { - obj.Ipv6Unicast().clearHolderSlice() - for _, item := range obj.obj.Ipv6Unicast { - obj.Ipv6Unicast().appendHolderSlice(&bgpOneIpv6NLRIPrefix{obj: item}) - } - } - for _, item := range obj.Ipv6Unicast().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Ipv4Srpolicy != nil { - - obj.Ipv4Srpolicy().validateObj(vObj, set_default) - } - - if obj.obj.Ipv6Srpolicy != nil { - - obj.Ipv6Srpolicy().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesMpReachNlri) setDefault() { - var choices_set int = 0 - var choice BgpAttributesMpReachNlriChoiceEnum - - if len(obj.obj.Ipv4Unicast) > 0 { - choices_set += 1 - choice = BgpAttributesMpReachNlriChoice.IPV4_UNICAST - } - - if len(obj.obj.Ipv6Unicast) > 0 { - choices_set += 1 - choice = BgpAttributesMpReachNlriChoice.IPV6_UNICAST - } - - if obj.obj.Ipv4Srpolicy != nil { - choices_set += 1 - choice = BgpAttributesMpReachNlriChoice.IPV4_SRPOLICY - } - - if obj.obj.Ipv6Srpolicy != nil { - choices_set += 1 - choice = BgpAttributesMpReachNlriChoice.IPV6_SRPOLICY - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesMpReachNlri") - } - } else { - intVal := otg.BgpAttributesMpReachNlri_Choice_Enum_value[string(choice)] - enumValue := otg.BgpAttributesMpReachNlri_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpAttributesMpUnreachNlri ***** -type bgpAttributesMpUnreachNlri struct { - validation - obj *otg.BgpAttributesMpUnreachNlri - marshaller marshalBgpAttributesMpUnreachNlri - unMarshaller unMarshalBgpAttributesMpUnreachNlri - ipv4UnicastHolder BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter - ipv6UnicastHolder BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter - ipv4SrpolicyHolder BgpIpv4SrPolicyNLRIPrefix - ipv6SrpolicyHolder BgpIpv6SrPolicyNLRIPrefix -} - -func NewBgpAttributesMpUnreachNlri() BgpAttributesMpUnreachNlri { - obj := bgpAttributesMpUnreachNlri{obj: &otg.BgpAttributesMpUnreachNlri{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesMpUnreachNlri) msg() *otg.BgpAttributesMpUnreachNlri { - return obj.obj -} - -func (obj *bgpAttributesMpUnreachNlri) setMsg(msg *otg.BgpAttributesMpUnreachNlri) BgpAttributesMpUnreachNlri { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesMpUnreachNlri struct { - obj *bgpAttributesMpUnreachNlri -} - -type marshalBgpAttributesMpUnreachNlri interface { - // ToProto marshals BgpAttributesMpUnreachNlri to protobuf object *otg.BgpAttributesMpUnreachNlri - ToProto() (*otg.BgpAttributesMpUnreachNlri, error) - // ToPbText marshals BgpAttributesMpUnreachNlri to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesMpUnreachNlri to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesMpUnreachNlri to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesMpUnreachNlri struct { - obj *bgpAttributesMpUnreachNlri -} - -type unMarshalBgpAttributesMpUnreachNlri interface { - // FromProto unmarshals BgpAttributesMpUnreachNlri from protobuf object *otg.BgpAttributesMpUnreachNlri - FromProto(msg *otg.BgpAttributesMpUnreachNlri) (BgpAttributesMpUnreachNlri, error) - // FromPbText unmarshals BgpAttributesMpUnreachNlri from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesMpUnreachNlri from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesMpUnreachNlri from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesMpUnreachNlri) Marshal() marshalBgpAttributesMpUnreachNlri { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesMpUnreachNlri{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesMpUnreachNlri) Unmarshal() unMarshalBgpAttributesMpUnreachNlri { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesMpUnreachNlri{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesMpUnreachNlri) ToProto() (*otg.BgpAttributesMpUnreachNlri, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesMpUnreachNlri) FromProto(msg *otg.BgpAttributesMpUnreachNlri) (BgpAttributesMpUnreachNlri, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesMpUnreachNlri) 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 *unMarshalbgpAttributesMpUnreachNlri) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesMpUnreachNlri) 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 *unMarshalbgpAttributesMpUnreachNlri) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesMpUnreachNlri) 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 *unMarshalbgpAttributesMpUnreachNlri) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesMpUnreachNlri) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesMpUnreachNlri) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesMpUnreachNlri) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesMpUnreachNlri) Clone() (BgpAttributesMpUnreachNlri, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesMpUnreachNlri() - 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 -} - -func (obj *bgpAttributesMpUnreachNlri) setNil() { - obj.ipv4UnicastHolder = nil - obj.ipv6UnicastHolder = nil - obj.ipv4SrpolicyHolder = nil - obj.ipv6SrpolicyHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesMpUnreachNlri is the MP_UNREACH attribute is an optional attribute which can be included in the attributes of a BGP Update message as defined in https://datatracker.ietf.org/doc/html/rfc4760#section-3. -// The following AFI / SAFI combinations are supported: -// - IPv4 Unicast with AFI as 1 and SAFI as 1 -// - IPv6 Unicast with AFI as 2 and SAFI as 1 -// - Segment Routing Policy for IPv4 Unicast with AFI as 1 and SAFI as 73 (draft-ietf-idr-sr-policy-safi-02 Section 2.1) -// - Segment Routing Policy for IPv6 Unicast with AFI as 2 and SAFI as 73 -type BgpAttributesMpUnreachNlri interface { - Validation - // msg marshals BgpAttributesMpUnreachNlri to protobuf object *otg.BgpAttributesMpUnreachNlri - // and doesn't set defaults - msg() *otg.BgpAttributesMpUnreachNlri - // setMsg unmarshals BgpAttributesMpUnreachNlri from protobuf object *otg.BgpAttributesMpUnreachNlri - // and doesn't set defaults - setMsg(*otg.BgpAttributesMpUnreachNlri) BgpAttributesMpUnreachNlri - // provides marshal interface - Marshal() marshalBgpAttributesMpUnreachNlri - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesMpUnreachNlri - // validate validates BgpAttributesMpUnreachNlri - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesMpUnreachNlri, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpAttributesMpUnreachNlriChoiceEnum, set in BgpAttributesMpUnreachNlri - Choice() BgpAttributesMpUnreachNlriChoiceEnum - // setChoice assigns BgpAttributesMpUnreachNlriChoiceEnum provided by user to BgpAttributesMpUnreachNlri - setChoice(value BgpAttributesMpUnreachNlriChoiceEnum) BgpAttributesMpUnreachNlri - // HasChoice checks if Choice has been set in BgpAttributesMpUnreachNlri - HasChoice() bool - // Ipv4Unicast returns BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIterIter, set in BgpAttributesMpUnreachNlri - Ipv4Unicast() BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter - // Ipv6Unicast returns BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIterIter, set in BgpAttributesMpUnreachNlri - Ipv6Unicast() BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter - // Ipv4Srpolicy returns BgpIpv4SrPolicyNLRIPrefix, set in BgpAttributesMpUnreachNlri. - // BgpIpv4SrPolicyNLRIPrefix is iPv4 Segment Routing Policy NLRI Prefix. - Ipv4Srpolicy() BgpIpv4SrPolicyNLRIPrefix - // SetIpv4Srpolicy assigns BgpIpv4SrPolicyNLRIPrefix provided by user to BgpAttributesMpUnreachNlri. - // BgpIpv4SrPolicyNLRIPrefix is iPv4 Segment Routing Policy NLRI Prefix. - SetIpv4Srpolicy(value BgpIpv4SrPolicyNLRIPrefix) BgpAttributesMpUnreachNlri - // HasIpv4Srpolicy checks if Ipv4Srpolicy has been set in BgpAttributesMpUnreachNlri - HasIpv4Srpolicy() bool - // Ipv6Srpolicy returns BgpIpv6SrPolicyNLRIPrefix, set in BgpAttributesMpUnreachNlri. - // BgpIpv6SrPolicyNLRIPrefix is one IPv6 Segment Routing Policy NLRI Prefix. - Ipv6Srpolicy() BgpIpv6SrPolicyNLRIPrefix - // SetIpv6Srpolicy assigns BgpIpv6SrPolicyNLRIPrefix provided by user to BgpAttributesMpUnreachNlri. - // BgpIpv6SrPolicyNLRIPrefix is one IPv6 Segment Routing Policy NLRI Prefix. - SetIpv6Srpolicy(value BgpIpv6SrPolicyNLRIPrefix) BgpAttributesMpUnreachNlri - // HasIpv6Srpolicy checks if Ipv6Srpolicy has been set in BgpAttributesMpUnreachNlri - HasIpv6Srpolicy() bool - setNil() -} - -type BgpAttributesMpUnreachNlriChoiceEnum string - -// Enum of Choice on BgpAttributesMpUnreachNlri -var BgpAttributesMpUnreachNlriChoice = struct { - IPV4_UNICAST BgpAttributesMpUnreachNlriChoiceEnum - IPV6_UNICAST BgpAttributesMpUnreachNlriChoiceEnum - IPV4_SRPOLICY BgpAttributesMpUnreachNlriChoiceEnum - IPV6_SRPOLICY BgpAttributesMpUnreachNlriChoiceEnum -}{ - IPV4_UNICAST: BgpAttributesMpUnreachNlriChoiceEnum("ipv4_unicast"), - IPV6_UNICAST: BgpAttributesMpUnreachNlriChoiceEnum("ipv6_unicast"), - IPV4_SRPOLICY: BgpAttributesMpUnreachNlriChoiceEnum("ipv4_srpolicy"), - IPV6_SRPOLICY: BgpAttributesMpUnreachNlriChoiceEnum("ipv6_srpolicy"), -} - -func (obj *bgpAttributesMpUnreachNlri) Choice() BgpAttributesMpUnreachNlriChoiceEnum { - return BgpAttributesMpUnreachNlriChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// The AFI and SAFI to be sent in the MPUNREACH_NLRI in the Update. -// Choice returns a string -func (obj *bgpAttributesMpUnreachNlri) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpAttributesMpUnreachNlri) setChoice(value BgpAttributesMpUnreachNlriChoiceEnum) BgpAttributesMpUnreachNlri { - intValue, ok := otg.BgpAttributesMpUnreachNlri_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAttributesMpUnreachNlriChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpAttributesMpUnreachNlri_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Ipv6Srpolicy = nil - obj.ipv6SrpolicyHolder = nil - obj.obj.Ipv4Srpolicy = nil - obj.ipv4SrpolicyHolder = nil - obj.obj.Ipv6Unicast = nil - obj.ipv6UnicastHolder = nil - obj.obj.Ipv4Unicast = nil - obj.ipv4UnicastHolder = nil - - if value == BgpAttributesMpUnreachNlriChoice.IPV4_UNICAST { - obj.obj.Ipv4Unicast = []*otg.BgpOneIpv4NLRIPrefix{} - } - - if value == BgpAttributesMpUnreachNlriChoice.IPV6_UNICAST { - obj.obj.Ipv6Unicast = []*otg.BgpOneIpv6NLRIPrefix{} - } - - if value == BgpAttributesMpUnreachNlriChoice.IPV4_SRPOLICY { - obj.obj.Ipv4Srpolicy = NewBgpIpv4SrPolicyNLRIPrefix().msg() - } - - if value == BgpAttributesMpUnreachNlriChoice.IPV6_SRPOLICY { - obj.obj.Ipv6Srpolicy = NewBgpIpv6SrPolicyNLRIPrefix().msg() - } - - return obj -} - -// List of IPv4 prefixes being sent in the IPv4 Unicast MPUNREACH_NLRI . -// Ipv4Unicast returns a []BgpOneIpv4NLRIPrefix -func (obj *bgpAttributesMpUnreachNlri) Ipv4Unicast() BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { - if len(obj.obj.Ipv4Unicast) == 0 { - obj.setChoice(BgpAttributesMpUnreachNlriChoice.IPV4_UNICAST) - } - if obj.ipv4UnicastHolder == nil { - obj.ipv4UnicastHolder = newBgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter(&obj.obj.Ipv4Unicast).setMsg(obj) - } - return obj.ipv4UnicastHolder -} - -type bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter struct { - obj *bgpAttributesMpUnreachNlri - bgpOneIpv4NLRIPrefixSlice []BgpOneIpv4NLRIPrefix - fieldPtr *[]*otg.BgpOneIpv4NLRIPrefix -} - -func newBgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter(ptr *[]*otg.BgpOneIpv4NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { - return &bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter{fieldPtr: ptr} -} - -type BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter interface { - setMsg(*bgpAttributesMpUnreachNlri) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter - Items() []BgpOneIpv4NLRIPrefix - Add() BgpOneIpv4NLRIPrefix - Append(items ...BgpOneIpv4NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter - Set(index int, newObj BgpOneIpv4NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter - Clear() BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter - clearHolderSlice() BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter - appendHolderSlice(item BgpOneIpv4NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter -} - -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) setMsg(msg *bgpAttributesMpUnreachNlri) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpOneIpv4NLRIPrefix{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) Items() []BgpOneIpv4NLRIPrefix { - return obj.bgpOneIpv4NLRIPrefixSlice -} - -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) Add() BgpOneIpv4NLRIPrefix { - newObj := &otg.BgpOneIpv4NLRIPrefix{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpOneIpv4NLRIPrefix{obj: newObj} - newLibObj.setDefault() - obj.bgpOneIpv4NLRIPrefixSlice = append(obj.bgpOneIpv4NLRIPrefixSlice, newLibObj) - return newLibObj -} - -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) Append(items ...BgpOneIpv4NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpOneIpv4NLRIPrefixSlice = append(obj.bgpOneIpv4NLRIPrefixSlice, item) - } - return obj -} - -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) Set(index int, newObj BgpOneIpv4NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpOneIpv4NLRIPrefixSlice[index] = newObj - return obj -} -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) Clear() BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpOneIpv4NLRIPrefix{} - obj.bgpOneIpv4NLRIPrefixSlice = []BgpOneIpv4NLRIPrefix{} - } - return obj -} -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) clearHolderSlice() BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { - if len(obj.bgpOneIpv4NLRIPrefixSlice) > 0 { - obj.bgpOneIpv4NLRIPrefixSlice = []BgpOneIpv4NLRIPrefix{} - } - return obj -} -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter) appendHolderSlice(item BgpOneIpv4NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv4NLRIPrefixIter { - obj.bgpOneIpv4NLRIPrefixSlice = append(obj.bgpOneIpv4NLRIPrefixSlice, item) - return obj -} - -// List of IPv6 prefixes being sent in the IPv6 Unicast MPUNREACH_NLRI . -// Ipv6Unicast returns a []BgpOneIpv6NLRIPrefix -func (obj *bgpAttributesMpUnreachNlri) Ipv6Unicast() BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { - if len(obj.obj.Ipv6Unicast) == 0 { - obj.setChoice(BgpAttributesMpUnreachNlriChoice.IPV6_UNICAST) - } - if obj.ipv6UnicastHolder == nil { - obj.ipv6UnicastHolder = newBgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter(&obj.obj.Ipv6Unicast).setMsg(obj) - } - return obj.ipv6UnicastHolder -} - -type bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter struct { - obj *bgpAttributesMpUnreachNlri - bgpOneIpv6NLRIPrefixSlice []BgpOneIpv6NLRIPrefix - fieldPtr *[]*otg.BgpOneIpv6NLRIPrefix -} - -func newBgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter(ptr *[]*otg.BgpOneIpv6NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { - return &bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter{fieldPtr: ptr} -} - -type BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter interface { - setMsg(*bgpAttributesMpUnreachNlri) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter - Items() []BgpOneIpv6NLRIPrefix - Add() BgpOneIpv6NLRIPrefix - Append(items ...BgpOneIpv6NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter - Set(index int, newObj BgpOneIpv6NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter - Clear() BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter - clearHolderSlice() BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter - appendHolderSlice(item BgpOneIpv6NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter -} - -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) setMsg(msg *bgpAttributesMpUnreachNlri) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpOneIpv6NLRIPrefix{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) Items() []BgpOneIpv6NLRIPrefix { - return obj.bgpOneIpv6NLRIPrefixSlice -} - -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) Add() BgpOneIpv6NLRIPrefix { - newObj := &otg.BgpOneIpv6NLRIPrefix{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpOneIpv6NLRIPrefix{obj: newObj} - newLibObj.setDefault() - obj.bgpOneIpv6NLRIPrefixSlice = append(obj.bgpOneIpv6NLRIPrefixSlice, newLibObj) - return newLibObj -} - -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) Append(items ...BgpOneIpv6NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpOneIpv6NLRIPrefixSlice = append(obj.bgpOneIpv6NLRIPrefixSlice, item) - } - return obj -} - -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) Set(index int, newObj BgpOneIpv6NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpOneIpv6NLRIPrefixSlice[index] = newObj - return obj -} -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) Clear() BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpOneIpv6NLRIPrefix{} - obj.bgpOneIpv6NLRIPrefixSlice = []BgpOneIpv6NLRIPrefix{} - } - return obj -} -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) clearHolderSlice() BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { - if len(obj.bgpOneIpv6NLRIPrefixSlice) > 0 { - obj.bgpOneIpv6NLRIPrefixSlice = []BgpOneIpv6NLRIPrefix{} - } - return obj -} -func (obj *bgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter) appendHolderSlice(item BgpOneIpv6NLRIPrefix) BgpAttributesMpUnreachNlriBgpOneIpv6NLRIPrefixIter { - obj.bgpOneIpv6NLRIPrefixSlice = append(obj.bgpOneIpv6NLRIPrefixSlice, item) - return obj -} - -// IPv4 endpoint with Segment Routing Policy being sent in the IPv4 MPUNREACH_NLRI . -// Ipv4Srpolicy returns a BgpIpv4SrPolicyNLRIPrefix -func (obj *bgpAttributesMpUnreachNlri) Ipv4Srpolicy() BgpIpv4SrPolicyNLRIPrefix { - if obj.obj.Ipv4Srpolicy == nil { - obj.setChoice(BgpAttributesMpUnreachNlriChoice.IPV4_SRPOLICY) - } - if obj.ipv4SrpolicyHolder == nil { - obj.ipv4SrpolicyHolder = &bgpIpv4SrPolicyNLRIPrefix{obj: obj.obj.Ipv4Srpolicy} - } - return obj.ipv4SrpolicyHolder -} - -// IPv4 endpoint with Segment Routing Policy being sent in the IPv4 MPUNREACH_NLRI . -// Ipv4Srpolicy returns a BgpIpv4SrPolicyNLRIPrefix -func (obj *bgpAttributesMpUnreachNlri) HasIpv4Srpolicy() bool { - return obj.obj.Ipv4Srpolicy != nil -} - -// IPv4 endpoint with Segment Routing Policy being sent in the IPv4 MPUNREACH_NLRI . -// SetIpv4Srpolicy sets the BgpIpv4SrPolicyNLRIPrefix value in the BgpAttributesMpUnreachNlri object -func (obj *bgpAttributesMpUnreachNlri) SetIpv4Srpolicy(value BgpIpv4SrPolicyNLRIPrefix) BgpAttributesMpUnreachNlri { - obj.setChoice(BgpAttributesMpUnreachNlriChoice.IPV4_SRPOLICY) - obj.ipv4SrpolicyHolder = nil - obj.obj.Ipv4Srpolicy = value.msg() - - return obj -} - -// IPv6 endpoint with Segment Routing Policy being sent in the IPv4 MPUNREACH_NLRI . -// Ipv6Srpolicy returns a BgpIpv6SrPolicyNLRIPrefix -func (obj *bgpAttributesMpUnreachNlri) Ipv6Srpolicy() BgpIpv6SrPolicyNLRIPrefix { - if obj.obj.Ipv6Srpolicy == nil { - obj.setChoice(BgpAttributesMpUnreachNlriChoice.IPV6_SRPOLICY) - } - if obj.ipv6SrpolicyHolder == nil { - obj.ipv6SrpolicyHolder = &bgpIpv6SrPolicyNLRIPrefix{obj: obj.obj.Ipv6Srpolicy} - } - return obj.ipv6SrpolicyHolder -} - -// IPv6 endpoint with Segment Routing Policy being sent in the IPv4 MPUNREACH_NLRI . -// Ipv6Srpolicy returns a BgpIpv6SrPolicyNLRIPrefix -func (obj *bgpAttributesMpUnreachNlri) HasIpv6Srpolicy() bool { - return obj.obj.Ipv6Srpolicy != nil -} - -// IPv6 endpoint with Segment Routing Policy being sent in the IPv4 MPUNREACH_NLRI . -// SetIpv6Srpolicy sets the BgpIpv6SrPolicyNLRIPrefix value in the BgpAttributesMpUnreachNlri object -func (obj *bgpAttributesMpUnreachNlri) SetIpv6Srpolicy(value BgpIpv6SrPolicyNLRIPrefix) BgpAttributesMpUnreachNlri { - obj.setChoice(BgpAttributesMpUnreachNlriChoice.IPV6_SRPOLICY) - obj.ipv6SrpolicyHolder = nil - obj.obj.Ipv6Srpolicy = value.msg() - - return obj -} - -func (obj *bgpAttributesMpUnreachNlri) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Ipv4Unicast) != 0 { - - if set_default { - obj.Ipv4Unicast().clearHolderSlice() - for _, item := range obj.obj.Ipv4Unicast { - obj.Ipv4Unicast().appendHolderSlice(&bgpOneIpv4NLRIPrefix{obj: item}) - } - } - for _, item := range obj.Ipv4Unicast().Items() { - item.validateObj(vObj, set_default) - } - - } - - if len(obj.obj.Ipv6Unicast) != 0 { - - if set_default { - obj.Ipv6Unicast().clearHolderSlice() - for _, item := range obj.obj.Ipv6Unicast { - obj.Ipv6Unicast().appendHolderSlice(&bgpOneIpv6NLRIPrefix{obj: item}) - } - } - for _, item := range obj.Ipv6Unicast().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Ipv4Srpolicy != nil { - - obj.Ipv4Srpolicy().validateObj(vObj, set_default) - } - - if obj.obj.Ipv6Srpolicy != nil { - - obj.Ipv6Srpolicy().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesMpUnreachNlri) setDefault() { - var choices_set int = 0 - var choice BgpAttributesMpUnreachNlriChoiceEnum - - if len(obj.obj.Ipv4Unicast) > 0 { - choices_set += 1 - choice = BgpAttributesMpUnreachNlriChoice.IPV4_UNICAST - } - - if len(obj.obj.Ipv6Unicast) > 0 { - choices_set += 1 - choice = BgpAttributesMpUnreachNlriChoice.IPV6_UNICAST - } - - if obj.obj.Ipv4Srpolicy != nil { - choices_set += 1 - choice = BgpAttributesMpUnreachNlriChoice.IPV4_SRPOLICY - } - - if obj.obj.Ipv6Srpolicy != nil { - choices_set += 1 - choice = BgpAttributesMpUnreachNlriChoice.IPV6_SRPOLICY - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesMpUnreachNlri") - } - } else { - intVal := otg.BgpAttributesMpUnreachNlri_Choice_Enum_value[string(choice)] - enumValue := otg.BgpAttributesMpUnreachNlri_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpNLRIPrefixPathId ***** -type bgpNLRIPrefixPathId struct { - validation - obj *otg.BgpNLRIPrefixPathId - marshaller marshalBgpNLRIPrefixPathId - unMarshaller unMarshalBgpNLRIPrefixPathId -} - -func NewBgpNLRIPrefixPathId() BgpNLRIPrefixPathId { - obj := bgpNLRIPrefixPathId{obj: &otg.BgpNLRIPrefixPathId{}} - obj.setDefault() - return &obj -} - -func (obj *bgpNLRIPrefixPathId) msg() *otg.BgpNLRIPrefixPathId { - return obj.obj -} - -func (obj *bgpNLRIPrefixPathId) setMsg(msg *otg.BgpNLRIPrefixPathId) BgpNLRIPrefixPathId { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpNLRIPrefixPathId struct { - obj *bgpNLRIPrefixPathId -} - -type marshalBgpNLRIPrefixPathId interface { - // ToProto marshals BgpNLRIPrefixPathId to protobuf object *otg.BgpNLRIPrefixPathId - ToProto() (*otg.BgpNLRIPrefixPathId, error) - // ToPbText marshals BgpNLRIPrefixPathId to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpNLRIPrefixPathId to YAML text - ToYaml() (string, error) - // ToJson marshals BgpNLRIPrefixPathId to JSON text - ToJson() (string, error) -} - -type unMarshalbgpNLRIPrefixPathId struct { - obj *bgpNLRIPrefixPathId -} - -type unMarshalBgpNLRIPrefixPathId interface { - // FromProto unmarshals BgpNLRIPrefixPathId from protobuf object *otg.BgpNLRIPrefixPathId - FromProto(msg *otg.BgpNLRIPrefixPathId) (BgpNLRIPrefixPathId, error) - // FromPbText unmarshals BgpNLRIPrefixPathId from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpNLRIPrefixPathId from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpNLRIPrefixPathId from JSON text - FromJson(value string) error -} - -func (obj *bgpNLRIPrefixPathId) Marshal() marshalBgpNLRIPrefixPathId { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpNLRIPrefixPathId{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpNLRIPrefixPathId) Unmarshal() unMarshalBgpNLRIPrefixPathId { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpNLRIPrefixPathId{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpNLRIPrefixPathId) ToProto() (*otg.BgpNLRIPrefixPathId, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpNLRIPrefixPathId) FromProto(msg *otg.BgpNLRIPrefixPathId) (BgpNLRIPrefixPathId, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpNLRIPrefixPathId) 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 *unMarshalbgpNLRIPrefixPathId) 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 *marshalbgpNLRIPrefixPathId) 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 *unMarshalbgpNLRIPrefixPathId) 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 *marshalbgpNLRIPrefixPathId) 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 *unMarshalbgpNLRIPrefixPathId) 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 *bgpNLRIPrefixPathId) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpNLRIPrefixPathId) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpNLRIPrefixPathId) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpNLRIPrefixPathId) Clone() (BgpNLRIPrefixPathId, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpNLRIPrefixPathId() - 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 -} - -// BgpNLRIPrefixPathId is optional field in the NLRI carrying Path Id of the prefix. -type BgpNLRIPrefixPathId interface { - Validation - // msg marshals BgpNLRIPrefixPathId to protobuf object *otg.BgpNLRIPrefixPathId - // and doesn't set defaults - msg() *otg.BgpNLRIPrefixPathId - // setMsg unmarshals BgpNLRIPrefixPathId from protobuf object *otg.BgpNLRIPrefixPathId - // and doesn't set defaults - setMsg(*otg.BgpNLRIPrefixPathId) BgpNLRIPrefixPathId - // provides marshal interface - Marshal() marshalBgpNLRIPrefixPathId - // provides unmarshal interface - Unmarshal() unMarshalBgpNLRIPrefixPathId - // validate validates BgpNLRIPrefixPathId - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpNLRIPrefixPathId, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Value returns uint32, set in BgpNLRIPrefixPathId. - Value() uint32 - // SetValue assigns uint32 provided by user to BgpNLRIPrefixPathId - SetValue(value uint32) BgpNLRIPrefixPathId - // HasValue checks if Value has been set in BgpNLRIPrefixPathId - HasValue() bool -} - -// The value of the optional Path ID of the prefix. -// Value returns a uint32 -func (obj *bgpNLRIPrefixPathId) Value() uint32 { - - return *obj.obj.Value - -} - -// The value of the optional Path ID of the prefix. -// Value returns a uint32 -func (obj *bgpNLRIPrefixPathId) HasValue() bool { - return obj.obj.Value != nil -} - -// The value of the optional Path ID of the prefix. -// SetValue sets the uint32 value in the BgpNLRIPrefixPathId object -func (obj *bgpNLRIPrefixPathId) SetValue(value uint32) BgpNLRIPrefixPathId { - - obj.obj.Value = &value - return obj -} - -func (obj *bgpNLRIPrefixPathId) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpNLRIPrefixPathId) setDefault() { - if obj.obj.Value == nil { - obj.SetValue(1) - } - -} - -// ***** PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter ***** -type patternFlowSnmpv2CVariableBindingValueIntegerValueCounter struct { - validation - obj *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - marshaller marshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter -} - -func NewPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter() PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { - obj := patternFlowSnmpv2CVariableBindingValueIntegerValueCounter{obj: &otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) msg() *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { - return obj.obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter struct { - obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter -} - -type marshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter interface { - // ToProto marshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, error) - // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter struct { - obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter -} - -type unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter interface { - // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) (PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, error) - // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) (PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) 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 *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) Clone() (PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter() - 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 -} - -// PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter is integer counter pattern -type PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter interface { - Validation - // msg marshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - // validate validates PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns int32, set in PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter. - Start() int32 - // SetStart assigns int32 provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - SetStart(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - // HasStart checks if Start has been set in PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - HasStart() bool - // Step returns int32, set in PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter. - Step() int32 - // SetStep assigns int32 provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - SetStep(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - // HasStep checks if Step has been set in PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - HasStep() bool - // Count returns int32, set in PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter. - Count() int32 - // SetCount assigns int32 provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - SetCount(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - // HasCount checks if Count has been set in PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter - HasCount() bool -} - -// description is TBD -// Start returns a int32 -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) Start() int32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a int32 -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the int32 value in the PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) SetStart(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a int32 -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) Step() int32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a int32 -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the int32 value in the PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) SetStep(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a int32 -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) Count() int32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a int32 -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the int32 value in the PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) SetCount(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter ***** -type patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter struct { - validation - obj *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - marshaller marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter -} - -func NewPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter() PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { - obj := patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter{obj: &otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) msg() *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { - return obj.obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter struct { - obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter -} - -type marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter interface { - // ToProto marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, error) - // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter struct { - obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter -} - -type unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter interface { - // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) (PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, error) - // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) (PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) 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 *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) Clone() (PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter() - 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 -} - -// PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter is ipv4 counter pattern -type PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter interface { - Validation - // msg marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - // validate validates PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - SetStart(value string) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - // HasStart checks if Start has been set in PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - HasStart() bool - // Step returns string, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - SetStep(value string) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - // HasStep checks if Step has been set in PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - HasStep() bool - // Count returns uint32, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - // HasCount checks if Count has been set in PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) SetStart(value string) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) SetStep(value string) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateIpv4(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateIpv4(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter.Step")) - } - - } - -} - -func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("0.0.0.0") - } - if obj.obj.Step == nil { - obj.SetStep("0.0.0.1") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowSnmpv2CVariableBindingValueCounterValueCounter ***** -type patternFlowSnmpv2CVariableBindingValueCounterValueCounter struct { - validation - obj *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - marshaller marshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter - unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter -} - -func NewPatternFlowSnmpv2CVariableBindingValueCounterValueCounter() PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { - obj := patternFlowSnmpv2CVariableBindingValueCounterValueCounter{obj: &otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) msg() *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { - return obj.obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter struct { - obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter -} - -type marshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter interface { - // ToProto marshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, error) - // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter struct { - obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter -} - -type unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter interface { - // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) (PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, error) - // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) (PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) 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 *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) Clone() (PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CVariableBindingValueCounterValueCounter() - 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 -} - -// PatternFlowSnmpv2CVariableBindingValueCounterValueCounter is integer counter pattern -type PatternFlowSnmpv2CVariableBindingValueCounterValueCounter interface { - Validation - // msg marshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter - // validate validates PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowSnmpv2CVariableBindingValueCounterValueCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - SetStart(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - // HasStart checks if Start has been set in PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - HasStart() bool - // Step returns uint32, set in PatternFlowSnmpv2CVariableBindingValueCounterValueCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - SetStep(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - // HasStep checks if Step has been set in PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - HasStep() bool - // Count returns uint32, set in PatternFlowSnmpv2CVariableBindingValueCounterValueCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - // HasCount checks if Count has been set in PatternFlowSnmpv2CVariableBindingValueCounterValueCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueCounterValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) SetStart(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueCounterValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) SetStep(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueCounterValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter ***** -type patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter struct { - validation - obj *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - marshaller marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter -} - -func NewPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter() PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { - obj := patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter{obj: &otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) msg() *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { - return obj.obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter struct { - obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter -} - -type marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter interface { - // ToProto marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, error) - // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter struct { - obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter -} - -type unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter interface { - // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) (PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, error) - // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) (PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) 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 *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) Clone() (PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter() - 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 -} - -// PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter is integer counter pattern -type PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter interface { - Validation - // msg marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - // validate validates PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - SetStart(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - // HasStart checks if Start has been set in PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - HasStart() bool - // Step returns uint32, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - SetStep(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - // HasStep checks if Step has been set in PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - HasStep() bool - // Count returns uint32, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - // HasCount checks if Count has been set in PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) SetStart(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) SetStep(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter ***** -type patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter struct { - validation - obj *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - marshaller marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter -} - -func NewPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter() PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { - obj := patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter{obj: &otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) msg() *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { - return obj.obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter struct { - obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter -} - -type marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter interface { - // ToProto marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, error) - // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter struct { - obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter -} - -type unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter interface { - // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) (PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, error) - // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) (PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) 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 *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) Clone() (PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter() - 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 -} - -// PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter is integer counter pattern -type PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter interface { - Validation - // msg marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - // validate validates PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint64, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter. - Start() uint64 - // SetStart assigns uint64 provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - SetStart(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - // HasStart checks if Start has been set in PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - HasStart() bool - // Step returns uint64, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter. - Step() uint64 - // SetStep assigns uint64 provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - SetStep(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - // HasStep checks if Step has been set in PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - HasStep() bool - // Count returns uint64, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter. - Count() uint64 - // SetCount assigns uint64 provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - SetCount(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - // HasCount checks if Count has been set in PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint64 -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) Start() uint64 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint64 -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint64 value in the PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) SetStart(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint64 -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) Step() uint64 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint64 -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint64 value in the PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) SetStep(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint64 -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) Count() uint64 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint64 -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint64 value in the PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) SetCount(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter ***** -type patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter struct { - validation - obj *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - marshaller marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter -} - -func NewPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { - obj := patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter{obj: &otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) msg() *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { - return obj.obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter struct { - obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter -} - -type marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter interface { - // ToProto marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, error) - // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter struct { - obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter -} - -type unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter interface { - // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, error) - // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) 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 *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Clone() (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter() - 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 -} - -// PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter is integer counter pattern -type PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter interface { - Validation - // msg marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - // and doesn't set defaults - msg() *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - // provides marshal interface - Marshal() marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - // validate validates PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - SetStart(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - // HasStart checks if Start has been set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - HasStart() bool - // Step returns uint32, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - SetStep(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - // HasStep checks if Step has been set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - HasStep() bool - // Count returns uint32, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - // HasCount checks if Count has been set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) SetStart(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) SetStep(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter object -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** FlowRSVPObjectLength ***** -type flowRSVPObjectLength struct { - validation - obj *otg.FlowRSVPObjectLength - marshaller marshalFlowRSVPObjectLength - unMarshaller unMarshalFlowRSVPObjectLength -} - -func NewFlowRSVPObjectLength() FlowRSVPObjectLength { - obj := flowRSVPObjectLength{obj: &otg.FlowRSVPObjectLength{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPObjectLength) msg() *otg.FlowRSVPObjectLength { - return obj.obj -} - -func (obj *flowRSVPObjectLength) setMsg(msg *otg.FlowRSVPObjectLength) FlowRSVPObjectLength { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPObjectLength struct { - obj *flowRSVPObjectLength -} - -type marshalFlowRSVPObjectLength interface { - // ToProto marshals FlowRSVPObjectLength to protobuf object *otg.FlowRSVPObjectLength - ToProto() (*otg.FlowRSVPObjectLength, error) - // ToPbText marshals FlowRSVPObjectLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPObjectLength to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPObjectLength to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPObjectLength struct { - obj *flowRSVPObjectLength -} - -type unMarshalFlowRSVPObjectLength interface { - // FromProto unmarshals FlowRSVPObjectLength from protobuf object *otg.FlowRSVPObjectLength - FromProto(msg *otg.FlowRSVPObjectLength) (FlowRSVPObjectLength, error) - // FromPbText unmarshals FlowRSVPObjectLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPObjectLength from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPObjectLength from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPObjectLength) Marshal() marshalFlowRSVPObjectLength { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPObjectLength{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPObjectLength) Unmarshal() unMarshalFlowRSVPObjectLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPObjectLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPObjectLength) ToProto() (*otg.FlowRSVPObjectLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPObjectLength) FromProto(msg *otg.FlowRSVPObjectLength) (FlowRSVPObjectLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPObjectLength) 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 *unMarshalflowRSVPObjectLength) 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 *marshalflowRSVPObjectLength) 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 *unMarshalflowRSVPObjectLength) 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 *marshalflowRSVPObjectLength) 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 *unMarshalflowRSVPObjectLength) 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 *flowRSVPObjectLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPObjectLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPObjectLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPObjectLength) Clone() (FlowRSVPObjectLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPObjectLength() - 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 -} - -// FlowRSVPObjectLength is description is TBD -type FlowRSVPObjectLength interface { - Validation - // msg marshals FlowRSVPObjectLength to protobuf object *otg.FlowRSVPObjectLength - // and doesn't set defaults - msg() *otg.FlowRSVPObjectLength - // setMsg unmarshals FlowRSVPObjectLength from protobuf object *otg.FlowRSVPObjectLength - // and doesn't set defaults - setMsg(*otg.FlowRSVPObjectLength) FlowRSVPObjectLength - // provides marshal interface - Marshal() marshalFlowRSVPObjectLength - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPObjectLength - // validate validates FlowRSVPObjectLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPObjectLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPObjectLengthChoiceEnum, set in FlowRSVPObjectLength - Choice() FlowRSVPObjectLengthChoiceEnum - // setChoice assigns FlowRSVPObjectLengthChoiceEnum provided by user to FlowRSVPObjectLength - setChoice(value FlowRSVPObjectLengthChoiceEnum) FlowRSVPObjectLength - // HasChoice checks if Choice has been set in FlowRSVPObjectLength - HasChoice() bool - // Auto returns uint32, set in FlowRSVPObjectLength. - Auto() uint32 - // HasAuto checks if Auto has been set in FlowRSVPObjectLength - HasAuto() bool - // Value returns uint32, set in FlowRSVPObjectLength. - Value() uint32 - // SetValue assigns uint32 provided by user to FlowRSVPObjectLength - SetValue(value uint32) FlowRSVPObjectLength - // HasValue checks if Value has been set in FlowRSVPObjectLength - HasValue() bool -} - -type FlowRSVPObjectLengthChoiceEnum string - -// Enum of Choice on FlowRSVPObjectLength -var FlowRSVPObjectLengthChoice = struct { - AUTO FlowRSVPObjectLengthChoiceEnum - VALUE FlowRSVPObjectLengthChoiceEnum -}{ - AUTO: FlowRSVPObjectLengthChoiceEnum("auto"), - VALUE: FlowRSVPObjectLengthChoiceEnum("value"), -} - -func (obj *flowRSVPObjectLength) Choice() FlowRSVPObjectLengthChoiceEnum { - return FlowRSVPObjectLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// auto or configured value. -// Choice returns a string -func (obj *flowRSVPObjectLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPObjectLength) setChoice(value FlowRSVPObjectLengthChoiceEnum) FlowRSVPObjectLength { - intValue, ok := otg.FlowRSVPObjectLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPObjectLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPObjectLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Value = nil - obj.obj.Auto = nil - - if value == FlowRSVPObjectLengthChoice.AUTO { - defaultValue := uint32(4) - obj.obj.Auto = &defaultValue - } - - if value == FlowRSVPObjectLengthChoice.VALUE { - defaultValue := uint32(4) - obj.obj.Value = &defaultValue - } - - return obj -} - -// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. -// Auto returns a uint32 -func (obj *flowRSVPObjectLength) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(FlowRSVPObjectLengthChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. -// Auto returns a uint32 -func (obj *flowRSVPObjectLength) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Value returns a uint32 -func (obj *flowRSVPObjectLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(FlowRSVPObjectLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *flowRSVPObjectLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the FlowRSVPObjectLength object -func (obj *flowRSVPObjectLength) SetValue(value uint32) FlowRSVPObjectLength { - obj.setChoice(FlowRSVPObjectLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -func (obj *flowRSVPObjectLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value < 4 || *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("4 <= FlowRSVPObjectLength.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - -} - -func (obj *flowRSVPObjectLength) setDefault() { - var choices_set int = 0 - var choice FlowRSVPObjectLengthChoiceEnum - - if obj.obj.Auto != nil { - choices_set += 1 - choice = FlowRSVPObjectLengthChoice.AUTO - } - - if obj.obj.Value != nil { - choices_set += 1 - choice = FlowRSVPObjectLengthChoice.VALUE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPObjectLengthChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPObjectLength") - } - } else { - intVal := otg.FlowRSVPObjectLength_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPObjectLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPPathObjectsSessionCType ***** -type flowRSVPPathObjectsSessionCType struct { - validation - obj *otg.FlowRSVPPathObjectsSessionCType - marshaller marshalFlowRSVPPathObjectsSessionCType - unMarshaller unMarshalFlowRSVPPathObjectsSessionCType - lspTunnelIpv4Holder FlowRSVPPathSessionLspTunnelIpv4 -} - -func NewFlowRSVPPathObjectsSessionCType() FlowRSVPPathObjectsSessionCType { - obj := flowRSVPPathObjectsSessionCType{obj: &otg.FlowRSVPPathObjectsSessionCType{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsSessionCType) msg() *otg.FlowRSVPPathObjectsSessionCType { - return obj.obj -} - -func (obj *flowRSVPPathObjectsSessionCType) setMsg(msg *otg.FlowRSVPPathObjectsSessionCType) FlowRSVPPathObjectsSessionCType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsSessionCType struct { - obj *flowRSVPPathObjectsSessionCType -} - -type marshalFlowRSVPPathObjectsSessionCType interface { - // ToProto marshals FlowRSVPPathObjectsSessionCType to protobuf object *otg.FlowRSVPPathObjectsSessionCType - ToProto() (*otg.FlowRSVPPathObjectsSessionCType, error) - // ToPbText marshals FlowRSVPPathObjectsSessionCType to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsSessionCType to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsSessionCType to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsSessionCType struct { - obj *flowRSVPPathObjectsSessionCType -} - -type unMarshalFlowRSVPPathObjectsSessionCType interface { - // FromProto unmarshals FlowRSVPPathObjectsSessionCType from protobuf object *otg.FlowRSVPPathObjectsSessionCType - FromProto(msg *otg.FlowRSVPPathObjectsSessionCType) (FlowRSVPPathObjectsSessionCType, error) - // FromPbText unmarshals FlowRSVPPathObjectsSessionCType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsSessionCType from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsSessionCType from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsSessionCType) Marshal() marshalFlowRSVPPathObjectsSessionCType { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsSessionCType{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsSessionCType) Unmarshal() unMarshalFlowRSVPPathObjectsSessionCType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsSessionCType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsSessionCType) ToProto() (*otg.FlowRSVPPathObjectsSessionCType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsSessionCType) FromProto(msg *otg.FlowRSVPPathObjectsSessionCType) (FlowRSVPPathObjectsSessionCType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsSessionCType) 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 *unMarshalflowRSVPPathObjectsSessionCType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsSessionCType) 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 *unMarshalflowRSVPPathObjectsSessionCType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsSessionCType) 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 *unMarshalflowRSVPPathObjectsSessionCType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsSessionCType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsSessionCType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsSessionCType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsSessionCType) Clone() (FlowRSVPPathObjectsSessionCType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsSessionCType() - 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 -} - -func (obj *flowRSVPPathObjectsSessionCType) setNil() { - obj.lspTunnelIpv4Holder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsSessionCType is the body of an object corresponding to the class number and c-type. Currently supported c-type for SESSION object is LSP Tunnel IPv4 (7). -type FlowRSVPPathObjectsSessionCType interface { - Validation - // msg marshals FlowRSVPPathObjectsSessionCType to protobuf object *otg.FlowRSVPPathObjectsSessionCType - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsSessionCType - // setMsg unmarshals FlowRSVPPathObjectsSessionCType from protobuf object *otg.FlowRSVPPathObjectsSessionCType - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsSessionCType) FlowRSVPPathObjectsSessionCType - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsSessionCType - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsSessionCType - // validate validates FlowRSVPPathObjectsSessionCType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsSessionCType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPPathObjectsSessionCTypeChoiceEnum, set in FlowRSVPPathObjectsSessionCType - Choice() FlowRSVPPathObjectsSessionCTypeChoiceEnum - // setChoice assigns FlowRSVPPathObjectsSessionCTypeChoiceEnum provided by user to FlowRSVPPathObjectsSessionCType - setChoice(value FlowRSVPPathObjectsSessionCTypeChoiceEnum) FlowRSVPPathObjectsSessionCType - // HasChoice checks if Choice has been set in FlowRSVPPathObjectsSessionCType - HasChoice() bool - // LspTunnelIpv4 returns FlowRSVPPathSessionLspTunnelIpv4, set in FlowRSVPPathObjectsSessionCType. - // FlowRSVPPathSessionLspTunnelIpv4 is class = SESSION, LSP_TUNNEL_IPv4 C-Type = 7. - LspTunnelIpv4() FlowRSVPPathSessionLspTunnelIpv4 - // SetLspTunnelIpv4 assigns FlowRSVPPathSessionLspTunnelIpv4 provided by user to FlowRSVPPathObjectsSessionCType. - // FlowRSVPPathSessionLspTunnelIpv4 is class = SESSION, LSP_TUNNEL_IPv4 C-Type = 7. - SetLspTunnelIpv4(value FlowRSVPPathSessionLspTunnelIpv4) FlowRSVPPathObjectsSessionCType - // HasLspTunnelIpv4 checks if LspTunnelIpv4 has been set in FlowRSVPPathObjectsSessionCType - HasLspTunnelIpv4() bool - setNil() -} - -type FlowRSVPPathObjectsSessionCTypeChoiceEnum string - -// Enum of Choice on FlowRSVPPathObjectsSessionCType -var FlowRSVPPathObjectsSessionCTypeChoice = struct { - LSP_TUNNEL_IPV4 FlowRSVPPathObjectsSessionCTypeChoiceEnum -}{ - LSP_TUNNEL_IPV4: FlowRSVPPathObjectsSessionCTypeChoiceEnum("lsp_tunnel_ipv4"), -} - -func (obj *flowRSVPPathObjectsSessionCType) Choice() FlowRSVPPathObjectsSessionCTypeChoiceEnum { - return FlowRSVPPathObjectsSessionCTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowRSVPPathObjectsSessionCType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPPathObjectsSessionCType) setChoice(value FlowRSVPPathObjectsSessionCTypeChoiceEnum) FlowRSVPPathObjectsSessionCType { - intValue, ok := otg.FlowRSVPPathObjectsSessionCType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPPathObjectsSessionCTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPPathObjectsSessionCType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.LspTunnelIpv4 = nil - obj.lspTunnelIpv4Holder = nil - - if value == FlowRSVPPathObjectsSessionCTypeChoice.LSP_TUNNEL_IPV4 { - obj.obj.LspTunnelIpv4 = NewFlowRSVPPathSessionLspTunnelIpv4().msg() - } - - return obj -} - -// description is TBD -// LspTunnelIpv4 returns a FlowRSVPPathSessionLspTunnelIpv4 -func (obj *flowRSVPPathObjectsSessionCType) LspTunnelIpv4() FlowRSVPPathSessionLspTunnelIpv4 { - if obj.obj.LspTunnelIpv4 == nil { - obj.setChoice(FlowRSVPPathObjectsSessionCTypeChoice.LSP_TUNNEL_IPV4) - } - if obj.lspTunnelIpv4Holder == nil { - obj.lspTunnelIpv4Holder = &flowRSVPPathSessionLspTunnelIpv4{obj: obj.obj.LspTunnelIpv4} - } - return obj.lspTunnelIpv4Holder -} - -// description is TBD -// LspTunnelIpv4 returns a FlowRSVPPathSessionLspTunnelIpv4 -func (obj *flowRSVPPathObjectsSessionCType) HasLspTunnelIpv4() bool { - return obj.obj.LspTunnelIpv4 != nil -} - -// description is TBD -// SetLspTunnelIpv4 sets the FlowRSVPPathSessionLspTunnelIpv4 value in the FlowRSVPPathObjectsSessionCType object -func (obj *flowRSVPPathObjectsSessionCType) SetLspTunnelIpv4(value FlowRSVPPathSessionLspTunnelIpv4) FlowRSVPPathObjectsSessionCType { - obj.setChoice(FlowRSVPPathObjectsSessionCTypeChoice.LSP_TUNNEL_IPV4) - obj.lspTunnelIpv4Holder = nil - obj.obj.LspTunnelIpv4 = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsSessionCType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.LspTunnelIpv4 != nil { - - obj.LspTunnelIpv4().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsSessionCType) setDefault() { - var choices_set int = 0 - var choice FlowRSVPPathObjectsSessionCTypeChoiceEnum - - if obj.obj.LspTunnelIpv4 != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsSessionCTypeChoice.LSP_TUNNEL_IPV4 - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPPathObjectsSessionCTypeChoice.LSP_TUNNEL_IPV4) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsSessionCType") - } - } else { - intVal := otg.FlowRSVPPathObjectsSessionCType_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPPathObjectsSessionCType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPPathObjectsRsvpHopCType ***** -type flowRSVPPathObjectsRsvpHopCType struct { - validation - obj *otg.FlowRSVPPathObjectsRsvpHopCType - marshaller marshalFlowRSVPPathObjectsRsvpHopCType - unMarshaller unMarshalFlowRSVPPathObjectsRsvpHopCType - ipv4Holder FlowRSVPPathRsvpHopIpv4 -} - -func NewFlowRSVPPathObjectsRsvpHopCType() FlowRSVPPathObjectsRsvpHopCType { - obj := flowRSVPPathObjectsRsvpHopCType{obj: &otg.FlowRSVPPathObjectsRsvpHopCType{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsRsvpHopCType) msg() *otg.FlowRSVPPathObjectsRsvpHopCType { - return obj.obj -} - -func (obj *flowRSVPPathObjectsRsvpHopCType) setMsg(msg *otg.FlowRSVPPathObjectsRsvpHopCType) FlowRSVPPathObjectsRsvpHopCType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsRsvpHopCType struct { - obj *flowRSVPPathObjectsRsvpHopCType -} - -type marshalFlowRSVPPathObjectsRsvpHopCType interface { - // ToProto marshals FlowRSVPPathObjectsRsvpHopCType to protobuf object *otg.FlowRSVPPathObjectsRsvpHopCType - ToProto() (*otg.FlowRSVPPathObjectsRsvpHopCType, error) - // ToPbText marshals FlowRSVPPathObjectsRsvpHopCType to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsRsvpHopCType to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsRsvpHopCType to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsRsvpHopCType struct { - obj *flowRSVPPathObjectsRsvpHopCType -} - -type unMarshalFlowRSVPPathObjectsRsvpHopCType interface { - // FromProto unmarshals FlowRSVPPathObjectsRsvpHopCType from protobuf object *otg.FlowRSVPPathObjectsRsvpHopCType - FromProto(msg *otg.FlowRSVPPathObjectsRsvpHopCType) (FlowRSVPPathObjectsRsvpHopCType, error) - // FromPbText unmarshals FlowRSVPPathObjectsRsvpHopCType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsRsvpHopCType from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsRsvpHopCType from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsRsvpHopCType) Marshal() marshalFlowRSVPPathObjectsRsvpHopCType { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsRsvpHopCType{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsRsvpHopCType) Unmarshal() unMarshalFlowRSVPPathObjectsRsvpHopCType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsRsvpHopCType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsRsvpHopCType) ToProto() (*otg.FlowRSVPPathObjectsRsvpHopCType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsRsvpHopCType) FromProto(msg *otg.FlowRSVPPathObjectsRsvpHopCType) (FlowRSVPPathObjectsRsvpHopCType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsRsvpHopCType) 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 *unMarshalflowRSVPPathObjectsRsvpHopCType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsRsvpHopCType) 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 *unMarshalflowRSVPPathObjectsRsvpHopCType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsRsvpHopCType) 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 *unMarshalflowRSVPPathObjectsRsvpHopCType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsRsvpHopCType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsRsvpHopCType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsRsvpHopCType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsRsvpHopCType) Clone() (FlowRSVPPathObjectsRsvpHopCType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsRsvpHopCType() - 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 -} - -func (obj *flowRSVPPathObjectsRsvpHopCType) setNil() { - obj.ipv4Holder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsRsvpHopCType is object for RSVP_HOP class. Currently supported c-type is IPv4 (1). -type FlowRSVPPathObjectsRsvpHopCType interface { - Validation - // msg marshals FlowRSVPPathObjectsRsvpHopCType to protobuf object *otg.FlowRSVPPathObjectsRsvpHopCType - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsRsvpHopCType - // setMsg unmarshals FlowRSVPPathObjectsRsvpHopCType from protobuf object *otg.FlowRSVPPathObjectsRsvpHopCType - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsRsvpHopCType) FlowRSVPPathObjectsRsvpHopCType - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsRsvpHopCType - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsRsvpHopCType - // validate validates FlowRSVPPathObjectsRsvpHopCType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsRsvpHopCType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum, set in FlowRSVPPathObjectsRsvpHopCType - Choice() FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum - // setChoice assigns FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum provided by user to FlowRSVPPathObjectsRsvpHopCType - setChoice(value FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum) FlowRSVPPathObjectsRsvpHopCType - // HasChoice checks if Choice has been set in FlowRSVPPathObjectsRsvpHopCType - HasChoice() bool - // Ipv4 returns FlowRSVPPathRsvpHopIpv4, set in FlowRSVPPathObjectsRsvpHopCType. - // FlowRSVPPathRsvpHopIpv4 is iPv4 RSVP_HOP object: Class = 3, C-Type = 1 - Ipv4() FlowRSVPPathRsvpHopIpv4 - // SetIpv4 assigns FlowRSVPPathRsvpHopIpv4 provided by user to FlowRSVPPathObjectsRsvpHopCType. - // FlowRSVPPathRsvpHopIpv4 is iPv4 RSVP_HOP object: Class = 3, C-Type = 1 - SetIpv4(value FlowRSVPPathRsvpHopIpv4) FlowRSVPPathObjectsRsvpHopCType - // HasIpv4 checks if Ipv4 has been set in FlowRSVPPathObjectsRsvpHopCType - HasIpv4() bool - setNil() -} - -type FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum string - -// Enum of Choice on FlowRSVPPathObjectsRsvpHopCType -var FlowRSVPPathObjectsRsvpHopCTypeChoice = struct { - IPV4 FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum -}{ - IPV4: FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum("ipv4"), -} - -func (obj *flowRSVPPathObjectsRsvpHopCType) Choice() FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum { - return FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowRSVPPathObjectsRsvpHopCType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPPathObjectsRsvpHopCType) setChoice(value FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum) FlowRSVPPathObjectsRsvpHopCType { - intValue, ok := otg.FlowRSVPPathObjectsRsvpHopCType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPPathObjectsRsvpHopCType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Ipv4 = nil - obj.ipv4Holder = nil - - if value == FlowRSVPPathObjectsRsvpHopCTypeChoice.IPV4 { - obj.obj.Ipv4 = NewFlowRSVPPathRsvpHopIpv4().msg() - } - - return obj -} - -// description is TBD -// Ipv4 returns a FlowRSVPPathRsvpHopIpv4 -func (obj *flowRSVPPathObjectsRsvpHopCType) Ipv4() FlowRSVPPathRsvpHopIpv4 { - if obj.obj.Ipv4 == nil { - obj.setChoice(FlowRSVPPathObjectsRsvpHopCTypeChoice.IPV4) - } - if obj.ipv4Holder == nil { - obj.ipv4Holder = &flowRSVPPathRsvpHopIpv4{obj: obj.obj.Ipv4} - } - return obj.ipv4Holder -} - -// description is TBD -// Ipv4 returns a FlowRSVPPathRsvpHopIpv4 -func (obj *flowRSVPPathObjectsRsvpHopCType) HasIpv4() bool { - return obj.obj.Ipv4 != nil -} - -// description is TBD -// SetIpv4 sets the FlowRSVPPathRsvpHopIpv4 value in the FlowRSVPPathObjectsRsvpHopCType object -func (obj *flowRSVPPathObjectsRsvpHopCType) SetIpv4(value FlowRSVPPathRsvpHopIpv4) FlowRSVPPathObjectsRsvpHopCType { - obj.setChoice(FlowRSVPPathObjectsRsvpHopCTypeChoice.IPV4) - obj.ipv4Holder = nil - obj.obj.Ipv4 = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsRsvpHopCType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv4 != nil { - - obj.Ipv4().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsRsvpHopCType) setDefault() { - var choices_set int = 0 - var choice FlowRSVPPathObjectsRsvpHopCTypeChoiceEnum - - if obj.obj.Ipv4 != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsRsvpHopCTypeChoice.IPV4 - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPPathObjectsRsvpHopCTypeChoice.IPV4) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsRsvpHopCType") - } - } else { - intVal := otg.FlowRSVPPathObjectsRsvpHopCType_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPPathObjectsRsvpHopCType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPPathObjectsTimeValuesCType ***** -type flowRSVPPathObjectsTimeValuesCType struct { - validation - obj *otg.FlowRSVPPathObjectsTimeValuesCType - marshaller marshalFlowRSVPPathObjectsTimeValuesCType - unMarshaller unMarshalFlowRSVPPathObjectsTimeValuesCType - type_1Holder FlowRSVPPathTimeValuesType1 -} - -func NewFlowRSVPPathObjectsTimeValuesCType() FlowRSVPPathObjectsTimeValuesCType { - obj := flowRSVPPathObjectsTimeValuesCType{obj: &otg.FlowRSVPPathObjectsTimeValuesCType{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsTimeValuesCType) msg() *otg.FlowRSVPPathObjectsTimeValuesCType { - return obj.obj -} - -func (obj *flowRSVPPathObjectsTimeValuesCType) setMsg(msg *otg.FlowRSVPPathObjectsTimeValuesCType) FlowRSVPPathObjectsTimeValuesCType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsTimeValuesCType struct { - obj *flowRSVPPathObjectsTimeValuesCType -} - -type marshalFlowRSVPPathObjectsTimeValuesCType interface { - // ToProto marshals FlowRSVPPathObjectsTimeValuesCType to protobuf object *otg.FlowRSVPPathObjectsTimeValuesCType - ToProto() (*otg.FlowRSVPPathObjectsTimeValuesCType, error) - // ToPbText marshals FlowRSVPPathObjectsTimeValuesCType to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsTimeValuesCType to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsTimeValuesCType to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsTimeValuesCType struct { - obj *flowRSVPPathObjectsTimeValuesCType -} - -type unMarshalFlowRSVPPathObjectsTimeValuesCType interface { - // FromProto unmarshals FlowRSVPPathObjectsTimeValuesCType from protobuf object *otg.FlowRSVPPathObjectsTimeValuesCType - FromProto(msg *otg.FlowRSVPPathObjectsTimeValuesCType) (FlowRSVPPathObjectsTimeValuesCType, error) - // FromPbText unmarshals FlowRSVPPathObjectsTimeValuesCType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsTimeValuesCType from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsTimeValuesCType from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsTimeValuesCType) Marshal() marshalFlowRSVPPathObjectsTimeValuesCType { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsTimeValuesCType{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsTimeValuesCType) Unmarshal() unMarshalFlowRSVPPathObjectsTimeValuesCType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsTimeValuesCType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsTimeValuesCType) ToProto() (*otg.FlowRSVPPathObjectsTimeValuesCType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsTimeValuesCType) FromProto(msg *otg.FlowRSVPPathObjectsTimeValuesCType) (FlowRSVPPathObjectsTimeValuesCType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsTimeValuesCType) 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 *unMarshalflowRSVPPathObjectsTimeValuesCType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsTimeValuesCType) 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 *unMarshalflowRSVPPathObjectsTimeValuesCType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsTimeValuesCType) 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 *unMarshalflowRSVPPathObjectsTimeValuesCType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsTimeValuesCType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsTimeValuesCType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsTimeValuesCType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsTimeValuesCType) Clone() (FlowRSVPPathObjectsTimeValuesCType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsTimeValuesCType() - 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 -} - -func (obj *flowRSVPPathObjectsTimeValuesCType) setNil() { - obj.type_1Holder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsTimeValuesCType is object for TIME_VALUES class. Currently supported c-type is Type 1 Time Value (1). -type FlowRSVPPathObjectsTimeValuesCType interface { - Validation - // msg marshals FlowRSVPPathObjectsTimeValuesCType to protobuf object *otg.FlowRSVPPathObjectsTimeValuesCType - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsTimeValuesCType - // setMsg unmarshals FlowRSVPPathObjectsTimeValuesCType from protobuf object *otg.FlowRSVPPathObjectsTimeValuesCType - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsTimeValuesCType) FlowRSVPPathObjectsTimeValuesCType - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsTimeValuesCType - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsTimeValuesCType - // validate validates FlowRSVPPathObjectsTimeValuesCType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsTimeValuesCType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum, set in FlowRSVPPathObjectsTimeValuesCType - Choice() FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum - // setChoice assigns FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum provided by user to FlowRSVPPathObjectsTimeValuesCType - setChoice(value FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum) FlowRSVPPathObjectsTimeValuesCType - // HasChoice checks if Choice has been set in FlowRSVPPathObjectsTimeValuesCType - HasChoice() bool - // Type1 returns FlowRSVPPathTimeValuesType1, set in FlowRSVPPathObjectsTimeValuesCType. - // FlowRSVPPathTimeValuesType1 is tIME_VALUES Object: Class = 5, C-Type = 1 - Type1() FlowRSVPPathTimeValuesType1 - // SetType1 assigns FlowRSVPPathTimeValuesType1 provided by user to FlowRSVPPathObjectsTimeValuesCType. - // FlowRSVPPathTimeValuesType1 is tIME_VALUES Object: Class = 5, C-Type = 1 - SetType1(value FlowRSVPPathTimeValuesType1) FlowRSVPPathObjectsTimeValuesCType - // HasType1 checks if Type1 has been set in FlowRSVPPathObjectsTimeValuesCType - HasType1() bool - setNil() -} - -type FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum string - -// Enum of Choice on FlowRSVPPathObjectsTimeValuesCType -var FlowRSVPPathObjectsTimeValuesCTypeChoice = struct { - TYPE_1 FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum -}{ - TYPE_1: FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum("type_1"), -} - -func (obj *flowRSVPPathObjectsTimeValuesCType) Choice() FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum { - return FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowRSVPPathObjectsTimeValuesCType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPPathObjectsTimeValuesCType) setChoice(value FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum) FlowRSVPPathObjectsTimeValuesCType { - intValue, ok := otg.FlowRSVPPathObjectsTimeValuesCType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPPathObjectsTimeValuesCType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Type_1 = nil - obj.type_1Holder = nil - - if value == FlowRSVPPathObjectsTimeValuesCTypeChoice.TYPE_1 { - obj.obj.Type_1 = NewFlowRSVPPathTimeValuesType1().msg() - } - - return obj -} - -// description is TBD -// Type1 returns a FlowRSVPPathTimeValuesType1 -func (obj *flowRSVPPathObjectsTimeValuesCType) Type1() FlowRSVPPathTimeValuesType1 { - if obj.obj.Type_1 == nil { - obj.setChoice(FlowRSVPPathObjectsTimeValuesCTypeChoice.TYPE_1) - } - if obj.type_1Holder == nil { - obj.type_1Holder = &flowRSVPPathTimeValuesType1{obj: obj.obj.Type_1} - } - return obj.type_1Holder -} - -// description is TBD -// Type1 returns a FlowRSVPPathTimeValuesType1 -func (obj *flowRSVPPathObjectsTimeValuesCType) HasType1() bool { - return obj.obj.Type_1 != nil -} - -// description is TBD -// SetType1 sets the FlowRSVPPathTimeValuesType1 value in the FlowRSVPPathObjectsTimeValuesCType object -func (obj *flowRSVPPathObjectsTimeValuesCType) SetType1(value FlowRSVPPathTimeValuesType1) FlowRSVPPathObjectsTimeValuesCType { - obj.setChoice(FlowRSVPPathObjectsTimeValuesCTypeChoice.TYPE_1) - obj.type_1Holder = nil - obj.obj.Type_1 = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsTimeValuesCType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Type_1 != nil { - - obj.Type1().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsTimeValuesCType) setDefault() { - var choices_set int = 0 - var choice FlowRSVPPathObjectsTimeValuesCTypeChoiceEnum - - if obj.obj.Type_1 != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsTimeValuesCTypeChoice.TYPE_1 - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPPathObjectsTimeValuesCTypeChoice.TYPE_1) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsTimeValuesCType") - } - } else { - intVal := otg.FlowRSVPPathObjectsTimeValuesCType_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPPathObjectsTimeValuesCType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPPathObjectsClassExplicitRouteCType ***** -type flowRSVPPathObjectsClassExplicitRouteCType struct { - validation - obj *otg.FlowRSVPPathObjectsClassExplicitRouteCType - marshaller marshalFlowRSVPPathObjectsClassExplicitRouteCType - unMarshaller unMarshalFlowRSVPPathObjectsClassExplicitRouteCType - type_1Holder FlowRSVPPathExplicitRouteType1 -} - -func NewFlowRSVPPathObjectsClassExplicitRouteCType() FlowRSVPPathObjectsClassExplicitRouteCType { - obj := flowRSVPPathObjectsClassExplicitRouteCType{obj: &otg.FlowRSVPPathObjectsClassExplicitRouteCType{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) msg() *otg.FlowRSVPPathObjectsClassExplicitRouteCType { - return obj.obj -} - -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) setMsg(msg *otg.FlowRSVPPathObjectsClassExplicitRouteCType) FlowRSVPPathObjectsClassExplicitRouteCType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsClassExplicitRouteCType struct { - obj *flowRSVPPathObjectsClassExplicitRouteCType -} - -type marshalFlowRSVPPathObjectsClassExplicitRouteCType interface { - // ToProto marshals FlowRSVPPathObjectsClassExplicitRouteCType to protobuf object *otg.FlowRSVPPathObjectsClassExplicitRouteCType - ToProto() (*otg.FlowRSVPPathObjectsClassExplicitRouteCType, error) - // ToPbText marshals FlowRSVPPathObjectsClassExplicitRouteCType to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsClassExplicitRouteCType to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsClassExplicitRouteCType to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsClassExplicitRouteCType struct { - obj *flowRSVPPathObjectsClassExplicitRouteCType -} - -type unMarshalFlowRSVPPathObjectsClassExplicitRouteCType interface { - // FromProto unmarshals FlowRSVPPathObjectsClassExplicitRouteCType from protobuf object *otg.FlowRSVPPathObjectsClassExplicitRouteCType - FromProto(msg *otg.FlowRSVPPathObjectsClassExplicitRouteCType) (FlowRSVPPathObjectsClassExplicitRouteCType, error) - // FromPbText unmarshals FlowRSVPPathObjectsClassExplicitRouteCType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsClassExplicitRouteCType from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsClassExplicitRouteCType from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) Marshal() marshalFlowRSVPPathObjectsClassExplicitRouteCType { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsClassExplicitRouteCType{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) Unmarshal() unMarshalFlowRSVPPathObjectsClassExplicitRouteCType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsClassExplicitRouteCType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsClassExplicitRouteCType) ToProto() (*otg.FlowRSVPPathObjectsClassExplicitRouteCType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsClassExplicitRouteCType) FromProto(msg *otg.FlowRSVPPathObjectsClassExplicitRouteCType) (FlowRSVPPathObjectsClassExplicitRouteCType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsClassExplicitRouteCType) 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 *unMarshalflowRSVPPathObjectsClassExplicitRouteCType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsClassExplicitRouteCType) 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 *unMarshalflowRSVPPathObjectsClassExplicitRouteCType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsClassExplicitRouteCType) 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 *unMarshalflowRSVPPathObjectsClassExplicitRouteCType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) Clone() (FlowRSVPPathObjectsClassExplicitRouteCType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsClassExplicitRouteCType() - 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 -} - -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) setNil() { - obj.type_1Holder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsClassExplicitRouteCType is object for EXPLICIT_ROUTE class and c-type is Type 1 Explicit Route (1). -type FlowRSVPPathObjectsClassExplicitRouteCType interface { - Validation - // msg marshals FlowRSVPPathObjectsClassExplicitRouteCType to protobuf object *otg.FlowRSVPPathObjectsClassExplicitRouteCType - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsClassExplicitRouteCType - // setMsg unmarshals FlowRSVPPathObjectsClassExplicitRouteCType from protobuf object *otg.FlowRSVPPathObjectsClassExplicitRouteCType - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsClassExplicitRouteCType) FlowRSVPPathObjectsClassExplicitRouteCType - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsClassExplicitRouteCType - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsClassExplicitRouteCType - // validate validates FlowRSVPPathObjectsClassExplicitRouteCType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsClassExplicitRouteCType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum, set in FlowRSVPPathObjectsClassExplicitRouteCType - Choice() FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum - // setChoice assigns FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum provided by user to FlowRSVPPathObjectsClassExplicitRouteCType - setChoice(value FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum) FlowRSVPPathObjectsClassExplicitRouteCType - // HasChoice checks if Choice has been set in FlowRSVPPathObjectsClassExplicitRouteCType - HasChoice() bool - // Type1 returns FlowRSVPPathExplicitRouteType1, set in FlowRSVPPathObjectsClassExplicitRouteCType. - // FlowRSVPPathExplicitRouteType1 is type1 Explicit Route has subobjects. Currently supported subobjects are IPv4 prefix and Autonomous system number. - Type1() FlowRSVPPathExplicitRouteType1 - // SetType1 assigns FlowRSVPPathExplicitRouteType1 provided by user to FlowRSVPPathObjectsClassExplicitRouteCType. - // FlowRSVPPathExplicitRouteType1 is type1 Explicit Route has subobjects. Currently supported subobjects are IPv4 prefix and Autonomous system number. - SetType1(value FlowRSVPPathExplicitRouteType1) FlowRSVPPathObjectsClassExplicitRouteCType - // HasType1 checks if Type1 has been set in FlowRSVPPathObjectsClassExplicitRouteCType - HasType1() bool - setNil() -} - -type FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum string - -// Enum of Choice on FlowRSVPPathObjectsClassExplicitRouteCType -var FlowRSVPPathObjectsClassExplicitRouteCTypeChoice = struct { - TYPE_1 FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum -}{ - TYPE_1: FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum("type_1"), -} - -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) Choice() FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum { - return FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) setChoice(value FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum) FlowRSVPPathObjectsClassExplicitRouteCType { - intValue, ok := otg.FlowRSVPPathObjectsClassExplicitRouteCType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPPathObjectsClassExplicitRouteCType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Type_1 = nil - obj.type_1Holder = nil - - if value == FlowRSVPPathObjectsClassExplicitRouteCTypeChoice.TYPE_1 { - obj.obj.Type_1 = NewFlowRSVPPathExplicitRouteType1().msg() - } - - return obj -} - -// description is TBD -// Type1 returns a FlowRSVPPathExplicitRouteType1 -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) Type1() FlowRSVPPathExplicitRouteType1 { - if obj.obj.Type_1 == nil { - obj.setChoice(FlowRSVPPathObjectsClassExplicitRouteCTypeChoice.TYPE_1) - } - if obj.type_1Holder == nil { - obj.type_1Holder = &flowRSVPPathExplicitRouteType1{obj: obj.obj.Type_1} - } - return obj.type_1Holder -} - -// description is TBD -// Type1 returns a FlowRSVPPathExplicitRouteType1 -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) HasType1() bool { - return obj.obj.Type_1 != nil -} - -// description is TBD -// SetType1 sets the FlowRSVPPathExplicitRouteType1 value in the FlowRSVPPathObjectsClassExplicitRouteCType object -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) SetType1(value FlowRSVPPathExplicitRouteType1) FlowRSVPPathObjectsClassExplicitRouteCType { - obj.setChoice(FlowRSVPPathObjectsClassExplicitRouteCTypeChoice.TYPE_1) - obj.type_1Holder = nil - obj.obj.Type_1 = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Type_1 != nil { - - obj.Type1().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsClassExplicitRouteCType) setDefault() { - var choices_set int = 0 - var choice FlowRSVPPathObjectsClassExplicitRouteCTypeChoiceEnum - - if obj.obj.Type_1 != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsClassExplicitRouteCTypeChoice.TYPE_1 - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPPathObjectsClassExplicitRouteCTypeChoice.TYPE_1) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsClassExplicitRouteCType") - } - } else { - intVal := otg.FlowRSVPPathObjectsClassExplicitRouteCType_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPPathObjectsClassExplicitRouteCType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPPathObjectsLabelRequestCType ***** -type flowRSVPPathObjectsLabelRequestCType struct { - validation - obj *otg.FlowRSVPPathObjectsLabelRequestCType - marshaller marshalFlowRSVPPathObjectsLabelRequestCType - unMarshaller unMarshalFlowRSVPPathObjectsLabelRequestCType - withoutLabelRangeHolder FlowRSVPPathLabelRequestWithoutLabelRange -} - -func NewFlowRSVPPathObjectsLabelRequestCType() FlowRSVPPathObjectsLabelRequestCType { - obj := flowRSVPPathObjectsLabelRequestCType{obj: &otg.FlowRSVPPathObjectsLabelRequestCType{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsLabelRequestCType) msg() *otg.FlowRSVPPathObjectsLabelRequestCType { - return obj.obj -} - -func (obj *flowRSVPPathObjectsLabelRequestCType) setMsg(msg *otg.FlowRSVPPathObjectsLabelRequestCType) FlowRSVPPathObjectsLabelRequestCType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsLabelRequestCType struct { - obj *flowRSVPPathObjectsLabelRequestCType -} - -type marshalFlowRSVPPathObjectsLabelRequestCType interface { - // ToProto marshals FlowRSVPPathObjectsLabelRequestCType to protobuf object *otg.FlowRSVPPathObjectsLabelRequestCType - ToProto() (*otg.FlowRSVPPathObjectsLabelRequestCType, error) - // ToPbText marshals FlowRSVPPathObjectsLabelRequestCType to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsLabelRequestCType to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsLabelRequestCType to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsLabelRequestCType struct { - obj *flowRSVPPathObjectsLabelRequestCType -} - -type unMarshalFlowRSVPPathObjectsLabelRequestCType interface { - // FromProto unmarshals FlowRSVPPathObjectsLabelRequestCType from protobuf object *otg.FlowRSVPPathObjectsLabelRequestCType - FromProto(msg *otg.FlowRSVPPathObjectsLabelRequestCType) (FlowRSVPPathObjectsLabelRequestCType, error) - // FromPbText unmarshals FlowRSVPPathObjectsLabelRequestCType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsLabelRequestCType from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsLabelRequestCType from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsLabelRequestCType) Marshal() marshalFlowRSVPPathObjectsLabelRequestCType { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsLabelRequestCType{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsLabelRequestCType) Unmarshal() unMarshalFlowRSVPPathObjectsLabelRequestCType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsLabelRequestCType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsLabelRequestCType) ToProto() (*otg.FlowRSVPPathObjectsLabelRequestCType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsLabelRequestCType) FromProto(msg *otg.FlowRSVPPathObjectsLabelRequestCType) (FlowRSVPPathObjectsLabelRequestCType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsLabelRequestCType) 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 *unMarshalflowRSVPPathObjectsLabelRequestCType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsLabelRequestCType) 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 *unMarshalflowRSVPPathObjectsLabelRequestCType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsLabelRequestCType) 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 *unMarshalflowRSVPPathObjectsLabelRequestCType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsLabelRequestCType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsLabelRequestCType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsLabelRequestCType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsLabelRequestCType) Clone() (FlowRSVPPathObjectsLabelRequestCType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsLabelRequestCType() - 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 -} - -func (obj *flowRSVPPathObjectsLabelRequestCType) setNil() { - obj.withoutLabelRangeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsLabelRequestCType is object for LABEL_REQUEST class. Currently supported c-type is Without Label Range (1). -type FlowRSVPPathObjectsLabelRequestCType interface { - Validation - // msg marshals FlowRSVPPathObjectsLabelRequestCType to protobuf object *otg.FlowRSVPPathObjectsLabelRequestCType - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsLabelRequestCType - // setMsg unmarshals FlowRSVPPathObjectsLabelRequestCType from protobuf object *otg.FlowRSVPPathObjectsLabelRequestCType - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsLabelRequestCType) FlowRSVPPathObjectsLabelRequestCType - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsLabelRequestCType - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsLabelRequestCType - // validate validates FlowRSVPPathObjectsLabelRequestCType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsLabelRequestCType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum, set in FlowRSVPPathObjectsLabelRequestCType - Choice() FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum - // setChoice assigns FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum provided by user to FlowRSVPPathObjectsLabelRequestCType - setChoice(value FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum) FlowRSVPPathObjectsLabelRequestCType - // HasChoice checks if Choice has been set in FlowRSVPPathObjectsLabelRequestCType - HasChoice() bool - // WithoutLabelRange returns FlowRSVPPathLabelRequestWithoutLabelRange, set in FlowRSVPPathObjectsLabelRequestCType. - // FlowRSVPPathLabelRequestWithoutLabelRange is class = LABEL_REQUEST, Without Label Range C-Type = 1 - WithoutLabelRange() FlowRSVPPathLabelRequestWithoutLabelRange - // SetWithoutLabelRange assigns FlowRSVPPathLabelRequestWithoutLabelRange provided by user to FlowRSVPPathObjectsLabelRequestCType. - // FlowRSVPPathLabelRequestWithoutLabelRange is class = LABEL_REQUEST, Without Label Range C-Type = 1 - SetWithoutLabelRange(value FlowRSVPPathLabelRequestWithoutLabelRange) FlowRSVPPathObjectsLabelRequestCType - // HasWithoutLabelRange checks if WithoutLabelRange has been set in FlowRSVPPathObjectsLabelRequestCType - HasWithoutLabelRange() bool - setNil() -} - -type FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum string - -// Enum of Choice on FlowRSVPPathObjectsLabelRequestCType -var FlowRSVPPathObjectsLabelRequestCTypeChoice = struct { - WITHOUT_LABEL_RANGE FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum -}{ - WITHOUT_LABEL_RANGE: FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum("without_label_range"), -} - -func (obj *flowRSVPPathObjectsLabelRequestCType) Choice() FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum { - return FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowRSVPPathObjectsLabelRequestCType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPPathObjectsLabelRequestCType) setChoice(value FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum) FlowRSVPPathObjectsLabelRequestCType { - intValue, ok := otg.FlowRSVPPathObjectsLabelRequestCType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPPathObjectsLabelRequestCType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.WithoutLabelRange = nil - obj.withoutLabelRangeHolder = nil - - if value == FlowRSVPPathObjectsLabelRequestCTypeChoice.WITHOUT_LABEL_RANGE { - obj.obj.WithoutLabelRange = NewFlowRSVPPathLabelRequestWithoutLabelRange().msg() - } - - return obj -} - -// description is TBD -// WithoutLabelRange returns a FlowRSVPPathLabelRequestWithoutLabelRange -func (obj *flowRSVPPathObjectsLabelRequestCType) WithoutLabelRange() FlowRSVPPathLabelRequestWithoutLabelRange { - if obj.obj.WithoutLabelRange == nil { - obj.setChoice(FlowRSVPPathObjectsLabelRequestCTypeChoice.WITHOUT_LABEL_RANGE) - } - if obj.withoutLabelRangeHolder == nil { - obj.withoutLabelRangeHolder = &flowRSVPPathLabelRequestWithoutLabelRange{obj: obj.obj.WithoutLabelRange} - } - return obj.withoutLabelRangeHolder -} - -// description is TBD -// WithoutLabelRange returns a FlowRSVPPathLabelRequestWithoutLabelRange -func (obj *flowRSVPPathObjectsLabelRequestCType) HasWithoutLabelRange() bool { - return obj.obj.WithoutLabelRange != nil -} - -// description is TBD -// SetWithoutLabelRange sets the FlowRSVPPathLabelRequestWithoutLabelRange value in the FlowRSVPPathObjectsLabelRequestCType object -func (obj *flowRSVPPathObjectsLabelRequestCType) SetWithoutLabelRange(value FlowRSVPPathLabelRequestWithoutLabelRange) FlowRSVPPathObjectsLabelRequestCType { - obj.setChoice(FlowRSVPPathObjectsLabelRequestCTypeChoice.WITHOUT_LABEL_RANGE) - obj.withoutLabelRangeHolder = nil - obj.obj.WithoutLabelRange = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsLabelRequestCType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.WithoutLabelRange != nil { - - obj.WithoutLabelRange().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsLabelRequestCType) setDefault() { - var choices_set int = 0 - var choice FlowRSVPPathObjectsLabelRequestCTypeChoiceEnum - - if obj.obj.WithoutLabelRange != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsLabelRequestCTypeChoice.WITHOUT_LABEL_RANGE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPPathObjectsLabelRequestCTypeChoice.WITHOUT_LABEL_RANGE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsLabelRequestCType") - } - } else { - intVal := otg.FlowRSVPPathObjectsLabelRequestCType_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPPathObjectsLabelRequestCType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPPathObjectsSessionAttributeCType ***** -type flowRSVPPathObjectsSessionAttributeCType struct { - validation - obj *otg.FlowRSVPPathObjectsSessionAttributeCType - marshaller marshalFlowRSVPPathObjectsSessionAttributeCType - unMarshaller unMarshalFlowRSVPPathObjectsSessionAttributeCType - lspTunnelHolder FlowRSVPPathSessionAttributeLspTunnel - lspTunnelRaHolder FlowRSVPPathSessionAttributeLspTunnelRa -} - -func NewFlowRSVPPathObjectsSessionAttributeCType() FlowRSVPPathObjectsSessionAttributeCType { - obj := flowRSVPPathObjectsSessionAttributeCType{obj: &otg.FlowRSVPPathObjectsSessionAttributeCType{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsSessionAttributeCType) msg() *otg.FlowRSVPPathObjectsSessionAttributeCType { - return obj.obj -} - -func (obj *flowRSVPPathObjectsSessionAttributeCType) setMsg(msg *otg.FlowRSVPPathObjectsSessionAttributeCType) FlowRSVPPathObjectsSessionAttributeCType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsSessionAttributeCType struct { - obj *flowRSVPPathObjectsSessionAttributeCType -} - -type marshalFlowRSVPPathObjectsSessionAttributeCType interface { - // ToProto marshals FlowRSVPPathObjectsSessionAttributeCType to protobuf object *otg.FlowRSVPPathObjectsSessionAttributeCType - ToProto() (*otg.FlowRSVPPathObjectsSessionAttributeCType, error) - // ToPbText marshals FlowRSVPPathObjectsSessionAttributeCType to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsSessionAttributeCType to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsSessionAttributeCType to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsSessionAttributeCType struct { - obj *flowRSVPPathObjectsSessionAttributeCType -} - -type unMarshalFlowRSVPPathObjectsSessionAttributeCType interface { - // FromProto unmarshals FlowRSVPPathObjectsSessionAttributeCType from protobuf object *otg.FlowRSVPPathObjectsSessionAttributeCType - FromProto(msg *otg.FlowRSVPPathObjectsSessionAttributeCType) (FlowRSVPPathObjectsSessionAttributeCType, error) - // FromPbText unmarshals FlowRSVPPathObjectsSessionAttributeCType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsSessionAttributeCType from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsSessionAttributeCType from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsSessionAttributeCType) Marshal() marshalFlowRSVPPathObjectsSessionAttributeCType { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsSessionAttributeCType{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsSessionAttributeCType) Unmarshal() unMarshalFlowRSVPPathObjectsSessionAttributeCType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsSessionAttributeCType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsSessionAttributeCType) ToProto() (*otg.FlowRSVPPathObjectsSessionAttributeCType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsSessionAttributeCType) FromProto(msg *otg.FlowRSVPPathObjectsSessionAttributeCType) (FlowRSVPPathObjectsSessionAttributeCType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsSessionAttributeCType) 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 *unMarshalflowRSVPPathObjectsSessionAttributeCType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsSessionAttributeCType) 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 *unMarshalflowRSVPPathObjectsSessionAttributeCType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsSessionAttributeCType) 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 *unMarshalflowRSVPPathObjectsSessionAttributeCType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsSessionAttributeCType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsSessionAttributeCType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsSessionAttributeCType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsSessionAttributeCType) Clone() (FlowRSVPPathObjectsSessionAttributeCType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsSessionAttributeCType() - 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 -} - -func (obj *flowRSVPPathObjectsSessionAttributeCType) setNil() { - obj.lspTunnelHolder = nil - obj.lspTunnelRaHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsSessionAttributeCType is object for SESSION_ATTRIBUTE class. Currently supported c-type is LSP_Tunnel_RA (1) and LSP_Tunnel (7). -type FlowRSVPPathObjectsSessionAttributeCType interface { - Validation - // msg marshals FlowRSVPPathObjectsSessionAttributeCType to protobuf object *otg.FlowRSVPPathObjectsSessionAttributeCType - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsSessionAttributeCType - // setMsg unmarshals FlowRSVPPathObjectsSessionAttributeCType from protobuf object *otg.FlowRSVPPathObjectsSessionAttributeCType - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsSessionAttributeCType) FlowRSVPPathObjectsSessionAttributeCType - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsSessionAttributeCType - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsSessionAttributeCType - // validate validates FlowRSVPPathObjectsSessionAttributeCType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsSessionAttributeCType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum, set in FlowRSVPPathObjectsSessionAttributeCType - Choice() FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum - // setChoice assigns FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum provided by user to FlowRSVPPathObjectsSessionAttributeCType - setChoice(value FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum) FlowRSVPPathObjectsSessionAttributeCType - // HasChoice checks if Choice has been set in FlowRSVPPathObjectsSessionAttributeCType - HasChoice() bool - // LspTunnel returns FlowRSVPPathSessionAttributeLspTunnel, set in FlowRSVPPathObjectsSessionAttributeCType. - // FlowRSVPPathSessionAttributeLspTunnel is sESSION_ATTRIBUTE class = 207, LSP_TUNNEL_RA C-Type = 7, resource affinity information. - LspTunnel() FlowRSVPPathSessionAttributeLspTunnel - // SetLspTunnel assigns FlowRSVPPathSessionAttributeLspTunnel provided by user to FlowRSVPPathObjectsSessionAttributeCType. - // FlowRSVPPathSessionAttributeLspTunnel is sESSION_ATTRIBUTE class = 207, LSP_TUNNEL_RA C-Type = 7, resource affinity information. - SetLspTunnel(value FlowRSVPPathSessionAttributeLspTunnel) FlowRSVPPathObjectsSessionAttributeCType - // HasLspTunnel checks if LspTunnel has been set in FlowRSVPPathObjectsSessionAttributeCType - HasLspTunnel() bool - // LspTunnelRa returns FlowRSVPPathSessionAttributeLspTunnelRa, set in FlowRSVPPathObjectsSessionAttributeCType. - // FlowRSVPPathSessionAttributeLspTunnelRa is sESSION_ATTRIBUTE class = 207, LSP_TUNNEL_RA C-Type = 1, it carries resource affinity information. - LspTunnelRa() FlowRSVPPathSessionAttributeLspTunnelRa - // SetLspTunnelRa assigns FlowRSVPPathSessionAttributeLspTunnelRa provided by user to FlowRSVPPathObjectsSessionAttributeCType. - // FlowRSVPPathSessionAttributeLspTunnelRa is sESSION_ATTRIBUTE class = 207, LSP_TUNNEL_RA C-Type = 1, it carries resource affinity information. - SetLspTunnelRa(value FlowRSVPPathSessionAttributeLspTunnelRa) FlowRSVPPathObjectsSessionAttributeCType - // HasLspTunnelRa checks if LspTunnelRa has been set in FlowRSVPPathObjectsSessionAttributeCType - HasLspTunnelRa() bool - setNil() -} - -type FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum string - -// Enum of Choice on FlowRSVPPathObjectsSessionAttributeCType -var FlowRSVPPathObjectsSessionAttributeCTypeChoice = struct { - LSP_TUNNEL FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum - LSP_TUNNEL_RA FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum -}{ - LSP_TUNNEL: FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum("lsp_tunnel"), - LSP_TUNNEL_RA: FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum("lsp_tunnel_ra"), -} - -func (obj *flowRSVPPathObjectsSessionAttributeCType) Choice() FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum { - return FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowRSVPPathObjectsSessionAttributeCType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPPathObjectsSessionAttributeCType) setChoice(value FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum) FlowRSVPPathObjectsSessionAttributeCType { - intValue, ok := otg.FlowRSVPPathObjectsSessionAttributeCType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPPathObjectsSessionAttributeCType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.LspTunnelRa = nil - obj.lspTunnelRaHolder = nil - obj.obj.LspTunnel = nil - obj.lspTunnelHolder = nil - - if value == FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL { - obj.obj.LspTunnel = NewFlowRSVPPathSessionAttributeLspTunnel().msg() - } - - if value == FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL_RA { - obj.obj.LspTunnelRa = NewFlowRSVPPathSessionAttributeLspTunnelRa().msg() - } - - return obj -} - -// description is TBD -// LspTunnel returns a FlowRSVPPathSessionAttributeLspTunnel -func (obj *flowRSVPPathObjectsSessionAttributeCType) LspTunnel() FlowRSVPPathSessionAttributeLspTunnel { - if obj.obj.LspTunnel == nil { - obj.setChoice(FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL) - } - if obj.lspTunnelHolder == nil { - obj.lspTunnelHolder = &flowRSVPPathSessionAttributeLspTunnel{obj: obj.obj.LspTunnel} - } - return obj.lspTunnelHolder -} - -// description is TBD -// LspTunnel returns a FlowRSVPPathSessionAttributeLspTunnel -func (obj *flowRSVPPathObjectsSessionAttributeCType) HasLspTunnel() bool { - return obj.obj.LspTunnel != nil -} - -// description is TBD -// SetLspTunnel sets the FlowRSVPPathSessionAttributeLspTunnel value in the FlowRSVPPathObjectsSessionAttributeCType object -func (obj *flowRSVPPathObjectsSessionAttributeCType) SetLspTunnel(value FlowRSVPPathSessionAttributeLspTunnel) FlowRSVPPathObjectsSessionAttributeCType { - obj.setChoice(FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL) - obj.lspTunnelHolder = nil - obj.obj.LspTunnel = value.msg() - - return obj -} - -// description is TBD -// LspTunnelRa returns a FlowRSVPPathSessionAttributeLspTunnelRa -func (obj *flowRSVPPathObjectsSessionAttributeCType) LspTunnelRa() FlowRSVPPathSessionAttributeLspTunnelRa { - if obj.obj.LspTunnelRa == nil { - obj.setChoice(FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL_RA) - } - if obj.lspTunnelRaHolder == nil { - obj.lspTunnelRaHolder = &flowRSVPPathSessionAttributeLspTunnelRa{obj: obj.obj.LspTunnelRa} - } - return obj.lspTunnelRaHolder -} - -// description is TBD -// LspTunnelRa returns a FlowRSVPPathSessionAttributeLspTunnelRa -func (obj *flowRSVPPathObjectsSessionAttributeCType) HasLspTunnelRa() bool { - return obj.obj.LspTunnelRa != nil -} - -// description is TBD -// SetLspTunnelRa sets the FlowRSVPPathSessionAttributeLspTunnelRa value in the FlowRSVPPathObjectsSessionAttributeCType object -func (obj *flowRSVPPathObjectsSessionAttributeCType) SetLspTunnelRa(value FlowRSVPPathSessionAttributeLspTunnelRa) FlowRSVPPathObjectsSessionAttributeCType { - obj.setChoice(FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL_RA) - obj.lspTunnelRaHolder = nil - obj.obj.LspTunnelRa = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsSessionAttributeCType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.LspTunnel != nil { - - obj.LspTunnel().validateObj(vObj, set_default) - } - - if obj.obj.LspTunnelRa != nil { - - obj.LspTunnelRa().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsSessionAttributeCType) setDefault() { - var choices_set int = 0 - var choice FlowRSVPPathObjectsSessionAttributeCTypeChoiceEnum - - if obj.obj.LspTunnel != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL - } - - if obj.obj.LspTunnelRa != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL_RA - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPPathObjectsSessionAttributeCTypeChoice.LSP_TUNNEL) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsSessionAttributeCType") - } - } else { - intVal := otg.FlowRSVPPathObjectsSessionAttributeCType_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPPathObjectsSessionAttributeCType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPPathObjectsSenderTemplateCType ***** -type flowRSVPPathObjectsSenderTemplateCType struct { - validation - obj *otg.FlowRSVPPathObjectsSenderTemplateCType - marshaller marshalFlowRSVPPathObjectsSenderTemplateCType - unMarshaller unMarshalFlowRSVPPathObjectsSenderTemplateCType - lspTunnelIpv4Holder FlowRSVPPathSenderTemplateLspTunnelIpv4 -} - -func NewFlowRSVPPathObjectsSenderTemplateCType() FlowRSVPPathObjectsSenderTemplateCType { - obj := flowRSVPPathObjectsSenderTemplateCType{obj: &otg.FlowRSVPPathObjectsSenderTemplateCType{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsSenderTemplateCType) msg() *otg.FlowRSVPPathObjectsSenderTemplateCType { - return obj.obj -} - -func (obj *flowRSVPPathObjectsSenderTemplateCType) setMsg(msg *otg.FlowRSVPPathObjectsSenderTemplateCType) FlowRSVPPathObjectsSenderTemplateCType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsSenderTemplateCType struct { - obj *flowRSVPPathObjectsSenderTemplateCType -} - -type marshalFlowRSVPPathObjectsSenderTemplateCType interface { - // ToProto marshals FlowRSVPPathObjectsSenderTemplateCType to protobuf object *otg.FlowRSVPPathObjectsSenderTemplateCType - ToProto() (*otg.FlowRSVPPathObjectsSenderTemplateCType, error) - // ToPbText marshals FlowRSVPPathObjectsSenderTemplateCType to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsSenderTemplateCType to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsSenderTemplateCType to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsSenderTemplateCType struct { - obj *flowRSVPPathObjectsSenderTemplateCType -} - -type unMarshalFlowRSVPPathObjectsSenderTemplateCType interface { - // FromProto unmarshals FlowRSVPPathObjectsSenderTemplateCType from protobuf object *otg.FlowRSVPPathObjectsSenderTemplateCType - FromProto(msg *otg.FlowRSVPPathObjectsSenderTemplateCType) (FlowRSVPPathObjectsSenderTemplateCType, error) - // FromPbText unmarshals FlowRSVPPathObjectsSenderTemplateCType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsSenderTemplateCType from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsSenderTemplateCType from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsSenderTemplateCType) Marshal() marshalFlowRSVPPathObjectsSenderTemplateCType { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsSenderTemplateCType{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsSenderTemplateCType) Unmarshal() unMarshalFlowRSVPPathObjectsSenderTemplateCType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsSenderTemplateCType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsSenderTemplateCType) ToProto() (*otg.FlowRSVPPathObjectsSenderTemplateCType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsSenderTemplateCType) FromProto(msg *otg.FlowRSVPPathObjectsSenderTemplateCType) (FlowRSVPPathObjectsSenderTemplateCType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsSenderTemplateCType) 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 *unMarshalflowRSVPPathObjectsSenderTemplateCType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsSenderTemplateCType) 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 *unMarshalflowRSVPPathObjectsSenderTemplateCType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsSenderTemplateCType) 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 *unMarshalflowRSVPPathObjectsSenderTemplateCType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsSenderTemplateCType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsSenderTemplateCType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsSenderTemplateCType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsSenderTemplateCType) Clone() (FlowRSVPPathObjectsSenderTemplateCType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsSenderTemplateCType() - 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 -} - -func (obj *flowRSVPPathObjectsSenderTemplateCType) setNil() { - obj.lspTunnelIpv4Holder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsSenderTemplateCType is object for SENDER_TEMPLATE class. Currently supported c-type is LSP Tunnel IPv4 (7). -type FlowRSVPPathObjectsSenderTemplateCType interface { - Validation - // msg marshals FlowRSVPPathObjectsSenderTemplateCType to protobuf object *otg.FlowRSVPPathObjectsSenderTemplateCType - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsSenderTemplateCType - // setMsg unmarshals FlowRSVPPathObjectsSenderTemplateCType from protobuf object *otg.FlowRSVPPathObjectsSenderTemplateCType - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsSenderTemplateCType) FlowRSVPPathObjectsSenderTemplateCType - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsSenderTemplateCType - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsSenderTemplateCType - // validate validates FlowRSVPPathObjectsSenderTemplateCType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsSenderTemplateCType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum, set in FlowRSVPPathObjectsSenderTemplateCType - Choice() FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum - // setChoice assigns FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum provided by user to FlowRSVPPathObjectsSenderTemplateCType - setChoice(value FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum) FlowRSVPPathObjectsSenderTemplateCType - // HasChoice checks if Choice has been set in FlowRSVPPathObjectsSenderTemplateCType - HasChoice() bool - // LspTunnelIpv4 returns FlowRSVPPathSenderTemplateLspTunnelIpv4, set in FlowRSVPPathObjectsSenderTemplateCType. - // FlowRSVPPathSenderTemplateLspTunnelIpv4 is class = SENDER_TEMPLATE, LSP_TUNNEL_IPv4 C-Type = 7 - LspTunnelIpv4() FlowRSVPPathSenderTemplateLspTunnelIpv4 - // SetLspTunnelIpv4 assigns FlowRSVPPathSenderTemplateLspTunnelIpv4 provided by user to FlowRSVPPathObjectsSenderTemplateCType. - // FlowRSVPPathSenderTemplateLspTunnelIpv4 is class = SENDER_TEMPLATE, LSP_TUNNEL_IPv4 C-Type = 7 - SetLspTunnelIpv4(value FlowRSVPPathSenderTemplateLspTunnelIpv4) FlowRSVPPathObjectsSenderTemplateCType - // HasLspTunnelIpv4 checks if LspTunnelIpv4 has been set in FlowRSVPPathObjectsSenderTemplateCType - HasLspTunnelIpv4() bool - setNil() -} - -type FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum string - -// Enum of Choice on FlowRSVPPathObjectsSenderTemplateCType -var FlowRSVPPathObjectsSenderTemplateCTypeChoice = struct { - LSP_TUNNEL_IPV4 FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum -}{ - LSP_TUNNEL_IPV4: FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum("lsp_tunnel_ipv4"), -} - -func (obj *flowRSVPPathObjectsSenderTemplateCType) Choice() FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum { - return FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowRSVPPathObjectsSenderTemplateCType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPPathObjectsSenderTemplateCType) setChoice(value FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum) FlowRSVPPathObjectsSenderTemplateCType { - intValue, ok := otg.FlowRSVPPathObjectsSenderTemplateCType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPPathObjectsSenderTemplateCType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.LspTunnelIpv4 = nil - obj.lspTunnelIpv4Holder = nil - - if value == FlowRSVPPathObjectsSenderTemplateCTypeChoice.LSP_TUNNEL_IPV4 { - obj.obj.LspTunnelIpv4 = NewFlowRSVPPathSenderTemplateLspTunnelIpv4().msg() - } - - return obj -} - -// description is TBD -// LspTunnelIpv4 returns a FlowRSVPPathSenderTemplateLspTunnelIpv4 -func (obj *flowRSVPPathObjectsSenderTemplateCType) LspTunnelIpv4() FlowRSVPPathSenderTemplateLspTunnelIpv4 { - if obj.obj.LspTunnelIpv4 == nil { - obj.setChoice(FlowRSVPPathObjectsSenderTemplateCTypeChoice.LSP_TUNNEL_IPV4) - } - if obj.lspTunnelIpv4Holder == nil { - obj.lspTunnelIpv4Holder = &flowRSVPPathSenderTemplateLspTunnelIpv4{obj: obj.obj.LspTunnelIpv4} - } - return obj.lspTunnelIpv4Holder -} - -// description is TBD -// LspTunnelIpv4 returns a FlowRSVPPathSenderTemplateLspTunnelIpv4 -func (obj *flowRSVPPathObjectsSenderTemplateCType) HasLspTunnelIpv4() bool { - return obj.obj.LspTunnelIpv4 != nil -} - -// description is TBD -// SetLspTunnelIpv4 sets the FlowRSVPPathSenderTemplateLspTunnelIpv4 value in the FlowRSVPPathObjectsSenderTemplateCType object -func (obj *flowRSVPPathObjectsSenderTemplateCType) SetLspTunnelIpv4(value FlowRSVPPathSenderTemplateLspTunnelIpv4) FlowRSVPPathObjectsSenderTemplateCType { - obj.setChoice(FlowRSVPPathObjectsSenderTemplateCTypeChoice.LSP_TUNNEL_IPV4) - obj.lspTunnelIpv4Holder = nil - obj.obj.LspTunnelIpv4 = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsSenderTemplateCType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.LspTunnelIpv4 != nil { - - obj.LspTunnelIpv4().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsSenderTemplateCType) setDefault() { - var choices_set int = 0 - var choice FlowRSVPPathObjectsSenderTemplateCTypeChoiceEnum - - if obj.obj.LspTunnelIpv4 != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsSenderTemplateCTypeChoice.LSP_TUNNEL_IPV4 - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPPathObjectsSenderTemplateCTypeChoice.LSP_TUNNEL_IPV4) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsSenderTemplateCType") - } - } else { - intVal := otg.FlowRSVPPathObjectsSenderTemplateCType_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPPathObjectsSenderTemplateCType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPPathObjectsSenderTspecCType ***** -type flowRSVPPathObjectsSenderTspecCType struct { - validation - obj *otg.FlowRSVPPathObjectsSenderTspecCType - marshaller marshalFlowRSVPPathObjectsSenderTspecCType - unMarshaller unMarshalFlowRSVPPathObjectsSenderTspecCType - intServHolder FlowRSVPPathSenderTspecIntServ -} - -func NewFlowRSVPPathObjectsSenderTspecCType() FlowRSVPPathObjectsSenderTspecCType { - obj := flowRSVPPathObjectsSenderTspecCType{obj: &otg.FlowRSVPPathObjectsSenderTspecCType{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsSenderTspecCType) msg() *otg.FlowRSVPPathObjectsSenderTspecCType { - return obj.obj -} - -func (obj *flowRSVPPathObjectsSenderTspecCType) setMsg(msg *otg.FlowRSVPPathObjectsSenderTspecCType) FlowRSVPPathObjectsSenderTspecCType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsSenderTspecCType struct { - obj *flowRSVPPathObjectsSenderTspecCType -} - -type marshalFlowRSVPPathObjectsSenderTspecCType interface { - // ToProto marshals FlowRSVPPathObjectsSenderTspecCType to protobuf object *otg.FlowRSVPPathObjectsSenderTspecCType - ToProto() (*otg.FlowRSVPPathObjectsSenderTspecCType, error) - // ToPbText marshals FlowRSVPPathObjectsSenderTspecCType to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsSenderTspecCType to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsSenderTspecCType to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsSenderTspecCType struct { - obj *flowRSVPPathObjectsSenderTspecCType -} - -type unMarshalFlowRSVPPathObjectsSenderTspecCType interface { - // FromProto unmarshals FlowRSVPPathObjectsSenderTspecCType from protobuf object *otg.FlowRSVPPathObjectsSenderTspecCType - FromProto(msg *otg.FlowRSVPPathObjectsSenderTspecCType) (FlowRSVPPathObjectsSenderTspecCType, error) - // FromPbText unmarshals FlowRSVPPathObjectsSenderTspecCType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsSenderTspecCType from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsSenderTspecCType from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsSenderTspecCType) Marshal() marshalFlowRSVPPathObjectsSenderTspecCType { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsSenderTspecCType{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsSenderTspecCType) Unmarshal() unMarshalFlowRSVPPathObjectsSenderTspecCType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsSenderTspecCType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsSenderTspecCType) ToProto() (*otg.FlowRSVPPathObjectsSenderTspecCType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsSenderTspecCType) FromProto(msg *otg.FlowRSVPPathObjectsSenderTspecCType) (FlowRSVPPathObjectsSenderTspecCType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsSenderTspecCType) 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 *unMarshalflowRSVPPathObjectsSenderTspecCType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsSenderTspecCType) 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 *unMarshalflowRSVPPathObjectsSenderTspecCType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsSenderTspecCType) 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 *unMarshalflowRSVPPathObjectsSenderTspecCType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsSenderTspecCType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsSenderTspecCType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsSenderTspecCType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsSenderTspecCType) Clone() (FlowRSVPPathObjectsSenderTspecCType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsSenderTspecCType() - 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 -} - -func (obj *flowRSVPPathObjectsSenderTspecCType) setNil() { - obj.intServHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsSenderTspecCType is object for SENDER_TSPEC class. Currently supported c-type is int-serv (2). -type FlowRSVPPathObjectsSenderTspecCType interface { - Validation - // msg marshals FlowRSVPPathObjectsSenderTspecCType to protobuf object *otg.FlowRSVPPathObjectsSenderTspecCType - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsSenderTspecCType - // setMsg unmarshals FlowRSVPPathObjectsSenderTspecCType from protobuf object *otg.FlowRSVPPathObjectsSenderTspecCType - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsSenderTspecCType) FlowRSVPPathObjectsSenderTspecCType - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsSenderTspecCType - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsSenderTspecCType - // validate validates FlowRSVPPathObjectsSenderTspecCType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsSenderTspecCType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum, set in FlowRSVPPathObjectsSenderTspecCType - Choice() FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum - // setChoice assigns FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum provided by user to FlowRSVPPathObjectsSenderTspecCType - setChoice(value FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum) FlowRSVPPathObjectsSenderTspecCType - // HasChoice checks if Choice has been set in FlowRSVPPathObjectsSenderTspecCType - HasChoice() bool - // IntServ returns FlowRSVPPathSenderTspecIntServ, set in FlowRSVPPathObjectsSenderTspecCType. - // FlowRSVPPathSenderTspecIntServ is int-serv SENDER_TSPEC object: Class = 12, C-Type = 2 - IntServ() FlowRSVPPathSenderTspecIntServ - // SetIntServ assigns FlowRSVPPathSenderTspecIntServ provided by user to FlowRSVPPathObjectsSenderTspecCType. - // FlowRSVPPathSenderTspecIntServ is int-serv SENDER_TSPEC object: Class = 12, C-Type = 2 - SetIntServ(value FlowRSVPPathSenderTspecIntServ) FlowRSVPPathObjectsSenderTspecCType - // HasIntServ checks if IntServ has been set in FlowRSVPPathObjectsSenderTspecCType - HasIntServ() bool - setNil() -} - -type FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum string - -// Enum of Choice on FlowRSVPPathObjectsSenderTspecCType -var FlowRSVPPathObjectsSenderTspecCTypeChoice = struct { - INT_SERV FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum -}{ - INT_SERV: FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum("int_serv"), -} - -func (obj *flowRSVPPathObjectsSenderTspecCType) Choice() FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum { - return FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowRSVPPathObjectsSenderTspecCType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPPathObjectsSenderTspecCType) setChoice(value FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum) FlowRSVPPathObjectsSenderTspecCType { - intValue, ok := otg.FlowRSVPPathObjectsSenderTspecCType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPPathObjectsSenderTspecCType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.IntServ = nil - obj.intServHolder = nil - - if value == FlowRSVPPathObjectsSenderTspecCTypeChoice.INT_SERV { - obj.obj.IntServ = NewFlowRSVPPathSenderTspecIntServ().msg() - } - - return obj -} - -// description is TBD -// IntServ returns a FlowRSVPPathSenderTspecIntServ -func (obj *flowRSVPPathObjectsSenderTspecCType) IntServ() FlowRSVPPathSenderTspecIntServ { - if obj.obj.IntServ == nil { - obj.setChoice(FlowRSVPPathObjectsSenderTspecCTypeChoice.INT_SERV) - } - if obj.intServHolder == nil { - obj.intServHolder = &flowRSVPPathSenderTspecIntServ{obj: obj.obj.IntServ} - } - return obj.intServHolder -} - -// description is TBD -// IntServ returns a FlowRSVPPathSenderTspecIntServ -func (obj *flowRSVPPathObjectsSenderTspecCType) HasIntServ() bool { - return obj.obj.IntServ != nil -} - -// description is TBD -// SetIntServ sets the FlowRSVPPathSenderTspecIntServ value in the FlowRSVPPathObjectsSenderTspecCType object -func (obj *flowRSVPPathObjectsSenderTspecCType) SetIntServ(value FlowRSVPPathSenderTspecIntServ) FlowRSVPPathObjectsSenderTspecCType { - obj.setChoice(FlowRSVPPathObjectsSenderTspecCTypeChoice.INT_SERV) - obj.intServHolder = nil - obj.obj.IntServ = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsSenderTspecCType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.IntServ != nil { - - obj.IntServ().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsSenderTspecCType) setDefault() { - var choices_set int = 0 - var choice FlowRSVPPathObjectsSenderTspecCTypeChoiceEnum - - if obj.obj.IntServ != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsSenderTspecCTypeChoice.INT_SERV - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPPathObjectsSenderTspecCTypeChoice.INT_SERV) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsSenderTspecCType") - } - } else { - intVal := otg.FlowRSVPPathObjectsSenderTspecCType_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPPathObjectsSenderTspecCType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPPathObjectsRecordRouteCType ***** -type flowRSVPPathObjectsRecordRouteCType struct { - validation - obj *otg.FlowRSVPPathObjectsRecordRouteCType - marshaller marshalFlowRSVPPathObjectsRecordRouteCType - unMarshaller unMarshalFlowRSVPPathObjectsRecordRouteCType - type_1Holder FlowRSVPPathRecordRouteType1 -} - -func NewFlowRSVPPathObjectsRecordRouteCType() FlowRSVPPathObjectsRecordRouteCType { - obj := flowRSVPPathObjectsRecordRouteCType{obj: &otg.FlowRSVPPathObjectsRecordRouteCType{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsRecordRouteCType) msg() *otg.FlowRSVPPathObjectsRecordRouteCType { - return obj.obj -} - -func (obj *flowRSVPPathObjectsRecordRouteCType) setMsg(msg *otg.FlowRSVPPathObjectsRecordRouteCType) FlowRSVPPathObjectsRecordRouteCType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsRecordRouteCType struct { - obj *flowRSVPPathObjectsRecordRouteCType -} - -type marshalFlowRSVPPathObjectsRecordRouteCType interface { - // ToProto marshals FlowRSVPPathObjectsRecordRouteCType to protobuf object *otg.FlowRSVPPathObjectsRecordRouteCType - ToProto() (*otg.FlowRSVPPathObjectsRecordRouteCType, error) - // ToPbText marshals FlowRSVPPathObjectsRecordRouteCType to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsRecordRouteCType to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsRecordRouteCType to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsRecordRouteCType struct { - obj *flowRSVPPathObjectsRecordRouteCType -} - -type unMarshalFlowRSVPPathObjectsRecordRouteCType interface { - // FromProto unmarshals FlowRSVPPathObjectsRecordRouteCType from protobuf object *otg.FlowRSVPPathObjectsRecordRouteCType - FromProto(msg *otg.FlowRSVPPathObjectsRecordRouteCType) (FlowRSVPPathObjectsRecordRouteCType, error) - // FromPbText unmarshals FlowRSVPPathObjectsRecordRouteCType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsRecordRouteCType from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsRecordRouteCType from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsRecordRouteCType) Marshal() marshalFlowRSVPPathObjectsRecordRouteCType { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsRecordRouteCType{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsRecordRouteCType) Unmarshal() unMarshalFlowRSVPPathObjectsRecordRouteCType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsRecordRouteCType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsRecordRouteCType) ToProto() (*otg.FlowRSVPPathObjectsRecordRouteCType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsRecordRouteCType) FromProto(msg *otg.FlowRSVPPathObjectsRecordRouteCType) (FlowRSVPPathObjectsRecordRouteCType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsRecordRouteCType) 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 *unMarshalflowRSVPPathObjectsRecordRouteCType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsRecordRouteCType) 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 *unMarshalflowRSVPPathObjectsRecordRouteCType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsRecordRouteCType) 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 *unMarshalflowRSVPPathObjectsRecordRouteCType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsRecordRouteCType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsRecordRouteCType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsRecordRouteCType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsRecordRouteCType) Clone() (FlowRSVPPathObjectsRecordRouteCType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsRecordRouteCType() - 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 -} - -func (obj *flowRSVPPathObjectsRecordRouteCType) setNil() { - obj.type_1Holder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsRecordRouteCType is object for RECORD_ROUTE class. c-type is Type 1 Route Record (1). -type FlowRSVPPathObjectsRecordRouteCType interface { - Validation - // msg marshals FlowRSVPPathObjectsRecordRouteCType to protobuf object *otg.FlowRSVPPathObjectsRecordRouteCType - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsRecordRouteCType - // setMsg unmarshals FlowRSVPPathObjectsRecordRouteCType from protobuf object *otg.FlowRSVPPathObjectsRecordRouteCType - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsRecordRouteCType) FlowRSVPPathObjectsRecordRouteCType - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsRecordRouteCType - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsRecordRouteCType - // validate validates FlowRSVPPathObjectsRecordRouteCType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsRecordRouteCType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum, set in FlowRSVPPathObjectsRecordRouteCType - Choice() FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum - // setChoice assigns FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum provided by user to FlowRSVPPathObjectsRecordRouteCType - setChoice(value FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum) FlowRSVPPathObjectsRecordRouteCType - // HasChoice checks if Choice has been set in FlowRSVPPathObjectsRecordRouteCType - HasChoice() bool - // Type1 returns FlowRSVPPathRecordRouteType1, set in FlowRSVPPathObjectsRecordRouteCType. - // FlowRSVPPathRecordRouteType1 is type1 record route has list of subobjects. Currently supported subobjects are IPv4 address(1) and Label(3). - Type1() FlowRSVPPathRecordRouteType1 - // SetType1 assigns FlowRSVPPathRecordRouteType1 provided by user to FlowRSVPPathObjectsRecordRouteCType. - // FlowRSVPPathRecordRouteType1 is type1 record route has list of subobjects. Currently supported subobjects are IPv4 address(1) and Label(3). - SetType1(value FlowRSVPPathRecordRouteType1) FlowRSVPPathObjectsRecordRouteCType - // HasType1 checks if Type1 has been set in FlowRSVPPathObjectsRecordRouteCType - HasType1() bool - setNil() -} - -type FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum string - -// Enum of Choice on FlowRSVPPathObjectsRecordRouteCType -var FlowRSVPPathObjectsRecordRouteCTypeChoice = struct { - TYPE_1 FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum -}{ - TYPE_1: FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum("type_1"), -} - -func (obj *flowRSVPPathObjectsRecordRouteCType) Choice() FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum { - return FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowRSVPPathObjectsRecordRouteCType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPPathObjectsRecordRouteCType) setChoice(value FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum) FlowRSVPPathObjectsRecordRouteCType { - intValue, ok := otg.FlowRSVPPathObjectsRecordRouteCType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPPathObjectsRecordRouteCType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Type_1 = nil - obj.type_1Holder = nil - - if value == FlowRSVPPathObjectsRecordRouteCTypeChoice.TYPE_1 { - obj.obj.Type_1 = NewFlowRSVPPathRecordRouteType1().msg() - } - - return obj -} - -// description is TBD -// Type1 returns a FlowRSVPPathRecordRouteType1 -func (obj *flowRSVPPathObjectsRecordRouteCType) Type1() FlowRSVPPathRecordRouteType1 { - if obj.obj.Type_1 == nil { - obj.setChoice(FlowRSVPPathObjectsRecordRouteCTypeChoice.TYPE_1) - } - if obj.type_1Holder == nil { - obj.type_1Holder = &flowRSVPPathRecordRouteType1{obj: obj.obj.Type_1} - } - return obj.type_1Holder -} - -// description is TBD -// Type1 returns a FlowRSVPPathRecordRouteType1 -func (obj *flowRSVPPathObjectsRecordRouteCType) HasType1() bool { - return obj.obj.Type_1 != nil -} - -// description is TBD -// SetType1 sets the FlowRSVPPathRecordRouteType1 value in the FlowRSVPPathObjectsRecordRouteCType object -func (obj *flowRSVPPathObjectsRecordRouteCType) SetType1(value FlowRSVPPathRecordRouteType1) FlowRSVPPathObjectsRecordRouteCType { - obj.setChoice(FlowRSVPPathObjectsRecordRouteCTypeChoice.TYPE_1) - obj.type_1Holder = nil - obj.obj.Type_1 = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsRecordRouteCType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Type_1 != nil { - - obj.Type1().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsRecordRouteCType) setDefault() { - var choices_set int = 0 - var choice FlowRSVPPathObjectsRecordRouteCTypeChoiceEnum - - if obj.obj.Type_1 != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsRecordRouteCTypeChoice.TYPE_1 - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPPathObjectsRecordRouteCTypeChoice.TYPE_1) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsRecordRouteCType") - } - } else { - intVal := otg.FlowRSVPPathObjectsRecordRouteCType_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPPathObjectsRecordRouteCType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathObjectsCustomType ***** -type patternFlowRSVPPathObjectsCustomType struct { - validation - obj *otg.PatternFlowRSVPPathObjectsCustomType - marshaller marshalPatternFlowRSVPPathObjectsCustomType - unMarshaller unMarshalPatternFlowRSVPPathObjectsCustomType - incrementHolder PatternFlowRSVPPathObjectsCustomTypeCounter - decrementHolder PatternFlowRSVPPathObjectsCustomTypeCounter -} - -func NewPatternFlowRSVPPathObjectsCustomType() PatternFlowRSVPPathObjectsCustomType { - obj := patternFlowRSVPPathObjectsCustomType{obj: &otg.PatternFlowRSVPPathObjectsCustomType{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathObjectsCustomType) msg() *otg.PatternFlowRSVPPathObjectsCustomType { - return obj.obj -} - -func (obj *patternFlowRSVPPathObjectsCustomType) setMsg(msg *otg.PatternFlowRSVPPathObjectsCustomType) PatternFlowRSVPPathObjectsCustomType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathObjectsCustomType struct { - obj *patternFlowRSVPPathObjectsCustomType -} - -type marshalPatternFlowRSVPPathObjectsCustomType interface { - // ToProto marshals PatternFlowRSVPPathObjectsCustomType to protobuf object *otg.PatternFlowRSVPPathObjectsCustomType - ToProto() (*otg.PatternFlowRSVPPathObjectsCustomType, error) - // ToPbText marshals PatternFlowRSVPPathObjectsCustomType to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathObjectsCustomType to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathObjectsCustomType to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathObjectsCustomType struct { - obj *patternFlowRSVPPathObjectsCustomType -} - -type unMarshalPatternFlowRSVPPathObjectsCustomType interface { - // FromProto unmarshals PatternFlowRSVPPathObjectsCustomType from protobuf object *otg.PatternFlowRSVPPathObjectsCustomType - FromProto(msg *otg.PatternFlowRSVPPathObjectsCustomType) (PatternFlowRSVPPathObjectsCustomType, error) - // FromPbText unmarshals PatternFlowRSVPPathObjectsCustomType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathObjectsCustomType from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathObjectsCustomType from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathObjectsCustomType) Marshal() marshalPatternFlowRSVPPathObjectsCustomType { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathObjectsCustomType{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathObjectsCustomType) Unmarshal() unMarshalPatternFlowRSVPPathObjectsCustomType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathObjectsCustomType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathObjectsCustomType) ToProto() (*otg.PatternFlowRSVPPathObjectsCustomType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathObjectsCustomType) FromProto(msg *otg.PatternFlowRSVPPathObjectsCustomType) (PatternFlowRSVPPathObjectsCustomType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathObjectsCustomType) 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 *unMarshalpatternFlowRSVPPathObjectsCustomType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathObjectsCustomType) 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 *unMarshalpatternFlowRSVPPathObjectsCustomType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathObjectsCustomType) 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 *unMarshalpatternFlowRSVPPathObjectsCustomType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathObjectsCustomType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathObjectsCustomType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathObjectsCustomType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathObjectsCustomType) Clone() (PatternFlowRSVPPathObjectsCustomType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathObjectsCustomType() - 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 -} - -func (obj *patternFlowRSVPPathObjectsCustomType) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathObjectsCustomType is user defined object type. -type PatternFlowRSVPPathObjectsCustomType interface { - Validation - // msg marshals PatternFlowRSVPPathObjectsCustomType to protobuf object *otg.PatternFlowRSVPPathObjectsCustomType - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathObjectsCustomType - // setMsg unmarshals PatternFlowRSVPPathObjectsCustomType from protobuf object *otg.PatternFlowRSVPPathObjectsCustomType - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathObjectsCustomType) PatternFlowRSVPPathObjectsCustomType - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathObjectsCustomType - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathObjectsCustomType - // validate validates PatternFlowRSVPPathObjectsCustomType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathObjectsCustomType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathObjectsCustomTypeChoiceEnum, set in PatternFlowRSVPPathObjectsCustomType - Choice() PatternFlowRSVPPathObjectsCustomTypeChoiceEnum - // setChoice assigns PatternFlowRSVPPathObjectsCustomTypeChoiceEnum provided by user to PatternFlowRSVPPathObjectsCustomType - setChoice(value PatternFlowRSVPPathObjectsCustomTypeChoiceEnum) PatternFlowRSVPPathObjectsCustomType - // HasChoice checks if Choice has been set in PatternFlowRSVPPathObjectsCustomType - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathObjectsCustomType. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathObjectsCustomType - SetValue(value uint32) PatternFlowRSVPPathObjectsCustomType - // HasValue checks if Value has been set in PatternFlowRSVPPathObjectsCustomType - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathObjectsCustomType. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathObjectsCustomType - SetValues(value []uint32) PatternFlowRSVPPathObjectsCustomType - // Increment returns PatternFlowRSVPPathObjectsCustomTypeCounter, set in PatternFlowRSVPPathObjectsCustomType. - // PatternFlowRSVPPathObjectsCustomTypeCounter is integer counter pattern - Increment() PatternFlowRSVPPathObjectsCustomTypeCounter - // SetIncrement assigns PatternFlowRSVPPathObjectsCustomTypeCounter provided by user to PatternFlowRSVPPathObjectsCustomType. - // PatternFlowRSVPPathObjectsCustomTypeCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathObjectsCustomTypeCounter) PatternFlowRSVPPathObjectsCustomType - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathObjectsCustomType - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathObjectsCustomTypeCounter, set in PatternFlowRSVPPathObjectsCustomType. - // PatternFlowRSVPPathObjectsCustomTypeCounter is integer counter pattern - Decrement() PatternFlowRSVPPathObjectsCustomTypeCounter - // SetDecrement assigns PatternFlowRSVPPathObjectsCustomTypeCounter provided by user to PatternFlowRSVPPathObjectsCustomType. - // PatternFlowRSVPPathObjectsCustomTypeCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathObjectsCustomTypeCounter) PatternFlowRSVPPathObjectsCustomType - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathObjectsCustomType - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathObjectsCustomTypeChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathObjectsCustomType -var PatternFlowRSVPPathObjectsCustomTypeChoice = struct { - VALUE PatternFlowRSVPPathObjectsCustomTypeChoiceEnum - VALUES PatternFlowRSVPPathObjectsCustomTypeChoiceEnum - INCREMENT PatternFlowRSVPPathObjectsCustomTypeChoiceEnum - DECREMENT PatternFlowRSVPPathObjectsCustomTypeChoiceEnum -}{ - VALUE: PatternFlowRSVPPathObjectsCustomTypeChoiceEnum("value"), - VALUES: PatternFlowRSVPPathObjectsCustomTypeChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathObjectsCustomTypeChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathObjectsCustomTypeChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathObjectsCustomType) Choice() PatternFlowRSVPPathObjectsCustomTypeChoiceEnum { - return PatternFlowRSVPPathObjectsCustomTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathObjectsCustomType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathObjectsCustomType) setChoice(value PatternFlowRSVPPathObjectsCustomTypeChoiceEnum) PatternFlowRSVPPathObjectsCustomType { - intValue, ok := otg.PatternFlowRSVPPathObjectsCustomType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathObjectsCustomTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathObjectsCustomType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathObjectsCustomTypeChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathObjectsCustomTypeChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathObjectsCustomTypeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathObjectsCustomTypeCounter().msg() - } - - if value == PatternFlowRSVPPathObjectsCustomTypeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathObjectsCustomTypeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathObjectsCustomType) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathObjectsCustomType) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathObjectsCustomType object -func (obj *patternFlowRSVPPathObjectsCustomType) SetValue(value uint32) PatternFlowRSVPPathObjectsCustomType { - obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathObjectsCustomType) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathObjectsCustomType object -func (obj *patternFlowRSVPPathObjectsCustomType) SetValues(value []uint32) PatternFlowRSVPPathObjectsCustomType { - obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathObjectsCustomTypeCounter -func (obj *patternFlowRSVPPathObjectsCustomType) Increment() PatternFlowRSVPPathObjectsCustomTypeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathObjectsCustomTypeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathObjectsCustomTypeCounter -func (obj *patternFlowRSVPPathObjectsCustomType) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathObjectsCustomTypeCounter value in the PatternFlowRSVPPathObjectsCustomType object -func (obj *patternFlowRSVPPathObjectsCustomType) SetIncrement(value PatternFlowRSVPPathObjectsCustomTypeCounter) PatternFlowRSVPPathObjectsCustomType { - obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathObjectsCustomTypeCounter -func (obj *patternFlowRSVPPathObjectsCustomType) Decrement() PatternFlowRSVPPathObjectsCustomTypeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathObjectsCustomTypeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathObjectsCustomTypeCounter -func (obj *patternFlowRSVPPathObjectsCustomType) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathObjectsCustomTypeCounter value in the PatternFlowRSVPPathObjectsCustomType object -func (obj *patternFlowRSVPPathObjectsCustomType) SetDecrement(value PatternFlowRSVPPathObjectsCustomTypeCounter) PatternFlowRSVPPathObjectsCustomType { - obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathObjectsCustomType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathObjectsCustomType.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathObjectsCustomType.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathObjectsCustomType) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathObjectsCustomTypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathObjectsCustomTypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathObjectsCustomTypeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathObjectsCustomTypeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathObjectsCustomTypeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathObjectsCustomType") - } - } else { - intVal := otg.PatternFlowRSVPPathObjectsCustomType_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathObjectsCustomType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** 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) - } - -} - -// ***** BgpSrteSRv6SIDEndpointBehaviorAndStructure ***** -type bgpSrteSRv6SIDEndpointBehaviorAndStructure struct { - validation - obj *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure - marshaller marshalBgpSrteSRv6SIDEndpointBehaviorAndStructure - unMarshaller unMarshalBgpSrteSRv6SIDEndpointBehaviorAndStructure -} - -func NewBgpSrteSRv6SIDEndpointBehaviorAndStructure() BgpSrteSRv6SIDEndpointBehaviorAndStructure { - obj := bgpSrteSRv6SIDEndpointBehaviorAndStructure{obj: &otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) msg() *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure { - return obj.obj -} - -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) setMsg(msg *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSRv6SIDEndpointBehaviorAndStructure { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSRv6SIDEndpointBehaviorAndStructure struct { - obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure -} - -type marshalBgpSrteSRv6SIDEndpointBehaviorAndStructure interface { - // ToProto marshals BgpSrteSRv6SIDEndpointBehaviorAndStructure to protobuf object *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure - ToProto() (*otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure, error) - // ToPbText marshals BgpSrteSRv6SIDEndpointBehaviorAndStructure to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSRv6SIDEndpointBehaviorAndStructure to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSRv6SIDEndpointBehaviorAndStructure to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSRv6SIDEndpointBehaviorAndStructure struct { - obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure -} - -type unMarshalBgpSrteSRv6SIDEndpointBehaviorAndStructure interface { - // FromProto unmarshals BgpSrteSRv6SIDEndpointBehaviorAndStructure from protobuf object *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure - FromProto(msg *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure) (BgpSrteSRv6SIDEndpointBehaviorAndStructure, error) - // FromPbText unmarshals BgpSrteSRv6SIDEndpointBehaviorAndStructure from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSRv6SIDEndpointBehaviorAndStructure from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSRv6SIDEndpointBehaviorAndStructure from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) Marshal() marshalBgpSrteSRv6SIDEndpointBehaviorAndStructure { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSRv6SIDEndpointBehaviorAndStructure{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) Unmarshal() unMarshalBgpSrteSRv6SIDEndpointBehaviorAndStructure { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSRv6SIDEndpointBehaviorAndStructure{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) ToProto() (*otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) FromProto(msg *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure) (BgpSrteSRv6SIDEndpointBehaviorAndStructure, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) 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 *unMarshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) 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 *marshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) 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 *unMarshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) 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 *marshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) 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 *unMarshalbgpSrteSRv6SIDEndpointBehaviorAndStructure) 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 *bgpSrteSRv6SIDEndpointBehaviorAndStructure) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) Clone() (BgpSrteSRv6SIDEndpointBehaviorAndStructure, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSRv6SIDEndpointBehaviorAndStructure() - 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 -} - -// BgpSrteSRv6SIDEndpointBehaviorAndStructure is configuration for SRv6 Endpoint Behavior and SID Structure. Its optional. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. -type BgpSrteSRv6SIDEndpointBehaviorAndStructure interface { - Validation - // msg marshals BgpSrteSRv6SIDEndpointBehaviorAndStructure to protobuf object *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure - // and doesn't set defaults - msg() *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure - // setMsg unmarshals BgpSrteSRv6SIDEndpointBehaviorAndStructure from protobuf object *otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure - // and doesn't set defaults - setMsg(*otg.BgpSrteSRv6SIDEndpointBehaviorAndStructure) BgpSrteSRv6SIDEndpointBehaviorAndStructure - // provides marshal interface - Marshal() marshalBgpSrteSRv6SIDEndpointBehaviorAndStructure - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSRv6SIDEndpointBehaviorAndStructure - // validate validates BgpSrteSRv6SIDEndpointBehaviorAndStructure - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSRv6SIDEndpointBehaviorAndStructure, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // LbLength returns uint32, set in BgpSrteSRv6SIDEndpointBehaviorAndStructure. - LbLength() uint32 - // SetLbLength assigns uint32 provided by user to BgpSrteSRv6SIDEndpointBehaviorAndStructure - SetLbLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure - // HasLbLength checks if LbLength has been set in BgpSrteSRv6SIDEndpointBehaviorAndStructure - HasLbLength() bool - // LnLength returns uint32, set in BgpSrteSRv6SIDEndpointBehaviorAndStructure. - LnLength() uint32 - // SetLnLength assigns uint32 provided by user to BgpSrteSRv6SIDEndpointBehaviorAndStructure - SetLnLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure - // HasLnLength checks if LnLength has been set in BgpSrteSRv6SIDEndpointBehaviorAndStructure - HasLnLength() bool - // FuncLength returns uint32, set in BgpSrteSRv6SIDEndpointBehaviorAndStructure. - FuncLength() uint32 - // SetFuncLength assigns uint32 provided by user to BgpSrteSRv6SIDEndpointBehaviorAndStructure - SetFuncLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure - // HasFuncLength checks if FuncLength has been set in BgpSrteSRv6SIDEndpointBehaviorAndStructure - HasFuncLength() bool - // ArgLength returns uint32, set in BgpSrteSRv6SIDEndpointBehaviorAndStructure. - ArgLength() uint32 - // SetArgLength assigns uint32 provided by user to BgpSrteSRv6SIDEndpointBehaviorAndStructure - SetArgLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure - // HasArgLength checks if ArgLength has been set in BgpSrteSRv6SIDEndpointBehaviorAndStructure - HasArgLength() bool -} - -// SRv6 SID Locator Block length in bits. -// LbLength returns a uint32 -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) LbLength() uint32 { - - return *obj.obj.LbLength - -} - -// SRv6 SID Locator Block length in bits. -// LbLength returns a uint32 -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) HasLbLength() bool { - return obj.obj.LbLength != nil -} - -// SRv6 SID Locator Block length in bits. -// SetLbLength sets the uint32 value in the BgpSrteSRv6SIDEndpointBehaviorAndStructure object -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) SetLbLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure { - - obj.obj.LbLength = &value - return obj -} - -// SRv6 SID Locator Node length in bits. -// LnLength returns a uint32 -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) LnLength() uint32 { - - return *obj.obj.LnLength - -} - -// SRv6 SID Locator Node length in bits. -// LnLength returns a uint32 -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) HasLnLength() bool { - return obj.obj.LnLength != nil -} - -// SRv6 SID Locator Node length in bits. -// SetLnLength sets the uint32 value in the BgpSrteSRv6SIDEndpointBehaviorAndStructure object -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) SetLnLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure { - - obj.obj.LnLength = &value - return obj -} - -// SRv6 SID Function length in bits. -// FuncLength returns a uint32 -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) FuncLength() uint32 { - - return *obj.obj.FuncLength - -} - -// SRv6 SID Function length in bits. -// FuncLength returns a uint32 -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) HasFuncLength() bool { - return obj.obj.FuncLength != nil -} - -// SRv6 SID Function length in bits. -// SetFuncLength sets the uint32 value in the BgpSrteSRv6SIDEndpointBehaviorAndStructure object -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) SetFuncLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure { - - obj.obj.FuncLength = &value - return obj -} - -// SRv6 SID Arguments length in bits. -// ArgLength returns a uint32 -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) ArgLength() uint32 { - - return *obj.obj.ArgLength - -} - -// SRv6 SID Arguments length in bits. -// ArgLength returns a uint32 -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) HasArgLength() bool { - return obj.obj.ArgLength != nil -} - -// SRv6 SID Arguments length in bits. -// SetArgLength sets the uint32 value in the BgpSrteSRv6SIDEndpointBehaviorAndStructure object -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) SetArgLength(value uint32) BgpSrteSRv6SIDEndpointBehaviorAndStructure { - - obj.obj.ArgLength = &value - return obj -} - -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.LbLength != nil { - - if *obj.obj.LbLength > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpSrteSRv6SIDEndpointBehaviorAndStructure.LbLength <= 128 but Got %d", *obj.obj.LbLength)) - } - - } - - if obj.obj.LnLength != nil { - - if *obj.obj.LnLength > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpSrteSRv6SIDEndpointBehaviorAndStructure.LnLength <= 128 but Got %d", *obj.obj.LnLength)) - } - - } - - if obj.obj.FuncLength != nil { - - if *obj.obj.FuncLength > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpSrteSRv6SIDEndpointBehaviorAndStructure.FuncLength <= 128 but Got %d", *obj.obj.FuncLength)) - } - - } - - if obj.obj.ArgLength != nil { - - if *obj.obj.ArgLength > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpSrteSRv6SIDEndpointBehaviorAndStructure.ArgLength <= 128 but Got %d", *obj.obj.ArgLength)) - } - - } - -} - -func (obj *bgpSrteSRv6SIDEndpointBehaviorAndStructure) setDefault() { - if obj.obj.LbLength == nil { - obj.SetLbLength(0) - } - if obj.obj.LnLength == nil { - obj.SetLnLength(0) - } - if obj.obj.FuncLength == nil { - obj.SetFuncLength(0) - } - if obj.obj.ArgLength == nil { - obj.SetArgLength(0) - } - -} - -// ***** BgpSrteSrMplsSid ***** -type bgpSrteSrMplsSid struct { - validation - obj *otg.BgpSrteSrMplsSid - marshaller marshalBgpSrteSrMplsSid - unMarshaller unMarshalBgpSrteSrMplsSid -} - -func NewBgpSrteSrMplsSid() BgpSrteSrMplsSid { - obj := bgpSrteSrMplsSid{obj: &otg.BgpSrteSrMplsSid{}} - obj.setDefault() - return &obj -} - -func (obj *bgpSrteSrMplsSid) msg() *otg.BgpSrteSrMplsSid { - return obj.obj -} - -func (obj *bgpSrteSrMplsSid) setMsg(msg *otg.BgpSrteSrMplsSid) BgpSrteSrMplsSid { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpSrteSrMplsSid struct { - obj *bgpSrteSrMplsSid -} - -type marshalBgpSrteSrMplsSid interface { - // ToProto marshals BgpSrteSrMplsSid to protobuf object *otg.BgpSrteSrMplsSid - ToProto() (*otg.BgpSrteSrMplsSid, error) - // ToPbText marshals BgpSrteSrMplsSid to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpSrteSrMplsSid to YAML text - ToYaml() (string, error) - // ToJson marshals BgpSrteSrMplsSid to JSON text - ToJson() (string, error) -} - -type unMarshalbgpSrteSrMplsSid struct { - obj *bgpSrteSrMplsSid -} - -type unMarshalBgpSrteSrMplsSid interface { - // FromProto unmarshals BgpSrteSrMplsSid from protobuf object *otg.BgpSrteSrMplsSid - FromProto(msg *otg.BgpSrteSrMplsSid) (BgpSrteSrMplsSid, error) - // FromPbText unmarshals BgpSrteSrMplsSid from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpSrteSrMplsSid from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpSrteSrMplsSid from JSON text - FromJson(value string) error -} - -func (obj *bgpSrteSrMplsSid) Marshal() marshalBgpSrteSrMplsSid { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpSrteSrMplsSid{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpSrteSrMplsSid) Unmarshal() unMarshalBgpSrteSrMplsSid { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpSrteSrMplsSid{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpSrteSrMplsSid) ToProto() (*otg.BgpSrteSrMplsSid, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpSrteSrMplsSid) FromProto(msg *otg.BgpSrteSrMplsSid) (BgpSrteSrMplsSid, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpSrteSrMplsSid) 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 *unMarshalbgpSrteSrMplsSid) 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 *marshalbgpSrteSrMplsSid) 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 *unMarshalbgpSrteSrMplsSid) 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 *marshalbgpSrteSrMplsSid) 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 *unMarshalbgpSrteSrMplsSid) 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 *bgpSrteSrMplsSid) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpSrteSrMplsSid) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpSrteSrMplsSid) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpSrteSrMplsSid) Clone() (BgpSrteSrMplsSid, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpSrteSrMplsSid() - 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 -} - -// BgpSrteSrMplsSid is configuration for SR-MPLS with Label, TC, Bottom-of-Stack and TTL. -type BgpSrteSrMplsSid interface { - Validation - // msg marshals BgpSrteSrMplsSid to protobuf object *otg.BgpSrteSrMplsSid - // and doesn't set defaults - msg() *otg.BgpSrteSrMplsSid - // setMsg unmarshals BgpSrteSrMplsSid from protobuf object *otg.BgpSrteSrMplsSid - // and doesn't set defaults - setMsg(*otg.BgpSrteSrMplsSid) BgpSrteSrMplsSid - // provides marshal interface - Marshal() marshalBgpSrteSrMplsSid - // provides unmarshal interface - Unmarshal() unMarshalBgpSrteSrMplsSid - // validate validates BgpSrteSrMplsSid - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpSrteSrMplsSid, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Label returns uint32, set in BgpSrteSrMplsSid. - Label() uint32 - // SetLabel assigns uint32 provided by user to BgpSrteSrMplsSid - SetLabel(value uint32) BgpSrteSrMplsSid - // HasLabel checks if Label has been set in BgpSrteSrMplsSid - HasLabel() bool - // Tc returns uint32, set in BgpSrteSrMplsSid. - Tc() uint32 - // SetTc assigns uint32 provided by user to BgpSrteSrMplsSid - SetTc(value uint32) BgpSrteSrMplsSid - // HasTc checks if Tc has been set in BgpSrteSrMplsSid - HasTc() bool - // SBit returns bool, set in BgpSrteSrMplsSid. - SBit() bool - // SetSBit assigns bool provided by user to BgpSrteSrMplsSid - SetSBit(value bool) BgpSrteSrMplsSid - // HasSBit checks if SBit has been set in BgpSrteSrMplsSid - HasSBit() bool - // Ttl returns uint32, set in BgpSrteSrMplsSid. - Ttl() uint32 - // SetTtl assigns uint32 provided by user to BgpSrteSrMplsSid - SetTtl(value uint32) BgpSrteSrMplsSid - // HasTtl checks if Ttl has been set in BgpSrteSrMplsSid - HasTtl() bool -} - -// Label value in [0, 2^20 -1]. -// Label returns a uint32 -func (obj *bgpSrteSrMplsSid) Label() uint32 { - - return *obj.obj.Label - -} - -// Label value in [0, 2^20 -1]. -// Label returns a uint32 -func (obj *bgpSrteSrMplsSid) HasLabel() bool { - return obj.obj.Label != nil -} - -// Label value in [0, 2^20 -1]. -// SetLabel sets the uint32 value in the BgpSrteSrMplsSid object -func (obj *bgpSrteSrMplsSid) SetLabel(value uint32) BgpSrteSrMplsSid { - - obj.obj.Label = &value - return obj -} - -// Traffic class in bits. -// Tc returns a uint32 -func (obj *bgpSrteSrMplsSid) Tc() uint32 { - - return *obj.obj.Tc - -} - -// Traffic class in bits. -// Tc returns a uint32 -func (obj *bgpSrteSrMplsSid) HasTc() bool { - return obj.obj.Tc != nil -} - -// Traffic class in bits. -// SetTc sets the uint32 value in the BgpSrteSrMplsSid object -func (obj *bgpSrteSrMplsSid) SetTc(value uint32) BgpSrteSrMplsSid { - - obj.obj.Tc = &value - return obj -} - -// Bottom-of-Stack bit. -// SBit returns a bool -func (obj *bgpSrteSrMplsSid) SBit() bool { - - return *obj.obj.SBit - -} - -// Bottom-of-Stack bit. -// SBit returns a bool -func (obj *bgpSrteSrMplsSid) HasSBit() bool { - return obj.obj.SBit != nil -} - -// Bottom-of-Stack bit. -// SetSBit sets the bool value in the BgpSrteSrMplsSid object -func (obj *bgpSrteSrMplsSid) SetSBit(value bool) BgpSrteSrMplsSid { - - obj.obj.SBit = &value - return obj -} - -// Time To Live. -// Ttl returns a uint32 -func (obj *bgpSrteSrMplsSid) Ttl() uint32 { - - return *obj.obj.Ttl - -} - -// Time To Live. -// Ttl returns a uint32 -func (obj *bgpSrteSrMplsSid) HasTtl() bool { - return obj.obj.Ttl != nil -} - -// Time To Live. -// SetTtl sets the uint32 value in the BgpSrteSrMplsSid object -func (obj *bgpSrteSrMplsSid) SetTtl(value uint32) BgpSrteSrMplsSid { - - obj.obj.Ttl = &value - return obj -} - -func (obj *bgpSrteSrMplsSid) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Label != nil { - - if *obj.obj.Label > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpSrteSrMplsSid.Label <= 1048575 but Got %d", *obj.obj.Label)) - } - - } - - if obj.obj.Tc != nil { - - if *obj.obj.Tc > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpSrteSrMplsSid.Tc <= 7 but Got %d", *obj.obj.Tc)) - } - - } - - if obj.obj.Ttl != nil { - - if *obj.obj.Ttl > 225 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpSrteSrMplsSid.Ttl <= 225 but Got %d", *obj.obj.Ttl)) - } - - } - -} - -func (obj *bgpSrteSrMplsSid) setDefault() { - -} - -// ***** BgpAttributesAsPathFourByteAsPath ***** -type bgpAttributesAsPathFourByteAsPath struct { - validation - obj *otg.BgpAttributesAsPathFourByteAsPath - marshaller marshalBgpAttributesAsPathFourByteAsPath - unMarshaller unMarshalBgpAttributesAsPathFourByteAsPath - segmentsHolder BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter -} - -func NewBgpAttributesAsPathFourByteAsPath() BgpAttributesAsPathFourByteAsPath { - obj := bgpAttributesAsPathFourByteAsPath{obj: &otg.BgpAttributesAsPathFourByteAsPath{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesAsPathFourByteAsPath) msg() *otg.BgpAttributesAsPathFourByteAsPath { - return obj.obj -} - -func (obj *bgpAttributesAsPathFourByteAsPath) setMsg(msg *otg.BgpAttributesAsPathFourByteAsPath) BgpAttributesAsPathFourByteAsPath { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesAsPathFourByteAsPath struct { - obj *bgpAttributesAsPathFourByteAsPath -} - -type marshalBgpAttributesAsPathFourByteAsPath interface { - // ToProto marshals BgpAttributesAsPathFourByteAsPath to protobuf object *otg.BgpAttributesAsPathFourByteAsPath - ToProto() (*otg.BgpAttributesAsPathFourByteAsPath, error) - // ToPbText marshals BgpAttributesAsPathFourByteAsPath to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesAsPathFourByteAsPath to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesAsPathFourByteAsPath to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesAsPathFourByteAsPath struct { - obj *bgpAttributesAsPathFourByteAsPath -} - -type unMarshalBgpAttributesAsPathFourByteAsPath interface { - // FromProto unmarshals BgpAttributesAsPathFourByteAsPath from protobuf object *otg.BgpAttributesAsPathFourByteAsPath - FromProto(msg *otg.BgpAttributesAsPathFourByteAsPath) (BgpAttributesAsPathFourByteAsPath, error) - // FromPbText unmarshals BgpAttributesAsPathFourByteAsPath from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesAsPathFourByteAsPath from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesAsPathFourByteAsPath from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesAsPathFourByteAsPath) Marshal() marshalBgpAttributesAsPathFourByteAsPath { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesAsPathFourByteAsPath{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesAsPathFourByteAsPath) Unmarshal() unMarshalBgpAttributesAsPathFourByteAsPath { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesAsPathFourByteAsPath{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesAsPathFourByteAsPath) ToProto() (*otg.BgpAttributesAsPathFourByteAsPath, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesAsPathFourByteAsPath) FromProto(msg *otg.BgpAttributesAsPathFourByteAsPath) (BgpAttributesAsPathFourByteAsPath, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesAsPathFourByteAsPath) 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 *unMarshalbgpAttributesAsPathFourByteAsPath) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesAsPathFourByteAsPath) 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 *unMarshalbgpAttributesAsPathFourByteAsPath) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesAsPathFourByteAsPath) 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 *unMarshalbgpAttributesAsPathFourByteAsPath) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesAsPathFourByteAsPath) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesAsPathFourByteAsPath) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesAsPathFourByteAsPath) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesAsPathFourByteAsPath) Clone() (BgpAttributesAsPathFourByteAsPath, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesAsPathFourByteAsPath() - 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 -} - -func (obj *bgpAttributesAsPathFourByteAsPath) setNil() { - obj.segmentsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesAsPathFourByteAsPath is aS Paths with 4 byte AS numbers can be exchanged only if both BGP speakers support 4 byte AS number extensions. -type BgpAttributesAsPathFourByteAsPath interface { - Validation - // msg marshals BgpAttributesAsPathFourByteAsPath to protobuf object *otg.BgpAttributesAsPathFourByteAsPath - // and doesn't set defaults - msg() *otg.BgpAttributesAsPathFourByteAsPath - // setMsg unmarshals BgpAttributesAsPathFourByteAsPath from protobuf object *otg.BgpAttributesAsPathFourByteAsPath - // and doesn't set defaults - setMsg(*otg.BgpAttributesAsPathFourByteAsPath) BgpAttributesAsPathFourByteAsPath - // provides marshal interface - Marshal() marshalBgpAttributesAsPathFourByteAsPath - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesAsPathFourByteAsPath - // validate validates BgpAttributesAsPathFourByteAsPath - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesAsPathFourByteAsPath, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Segments returns BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIterIter, set in BgpAttributesAsPathFourByteAsPath - Segments() BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter - setNil() -} - -// The AS path segments containing 4 byte AS numbers to be added in the AS Path attribute. By default, an empty AS path should always be included and for EBGP at minimum the local AS number should be present in the AS Path. -// Segments returns a []BgpAttributesFourByteAsPathSegment -func (obj *bgpAttributesAsPathFourByteAsPath) Segments() BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { - if len(obj.obj.Segments) == 0 { - obj.obj.Segments = []*otg.BgpAttributesFourByteAsPathSegment{} - } - if obj.segmentsHolder == nil { - obj.segmentsHolder = newBgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter(&obj.obj.Segments).setMsg(obj) - } - return obj.segmentsHolder -} - -type bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter struct { - obj *bgpAttributesAsPathFourByteAsPath - bgpAttributesFourByteAsPathSegmentSlice []BgpAttributesFourByteAsPathSegment - fieldPtr *[]*otg.BgpAttributesFourByteAsPathSegment -} - -func newBgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter(ptr *[]*otg.BgpAttributesFourByteAsPathSegment) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { - return &bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter{fieldPtr: ptr} -} - -type BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter interface { - setMsg(*bgpAttributesAsPathFourByteAsPath) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter - Items() []BgpAttributesFourByteAsPathSegment - Add() BgpAttributesFourByteAsPathSegment - Append(items ...BgpAttributesFourByteAsPathSegment) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter - Set(index int, newObj BgpAttributesFourByteAsPathSegment) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter - Clear() BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter - clearHolderSlice() BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter - appendHolderSlice(item BgpAttributesFourByteAsPathSegment) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter -} - -func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) setMsg(msg *bgpAttributesAsPathFourByteAsPath) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpAttributesFourByteAsPathSegment{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) Items() []BgpAttributesFourByteAsPathSegment { - return obj.bgpAttributesFourByteAsPathSegmentSlice -} - -func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) Add() BgpAttributesFourByteAsPathSegment { - newObj := &otg.BgpAttributesFourByteAsPathSegment{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpAttributesFourByteAsPathSegment{obj: newObj} - newLibObj.setDefault() - obj.bgpAttributesFourByteAsPathSegmentSlice = append(obj.bgpAttributesFourByteAsPathSegmentSlice, newLibObj) - return newLibObj -} - -func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) Append(items ...BgpAttributesFourByteAsPathSegment) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpAttributesFourByteAsPathSegmentSlice = append(obj.bgpAttributesFourByteAsPathSegmentSlice, item) - } - return obj -} - -func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) Set(index int, newObj BgpAttributesFourByteAsPathSegment) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpAttributesFourByteAsPathSegmentSlice[index] = newObj - return obj -} -func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) Clear() BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpAttributesFourByteAsPathSegment{} - obj.bgpAttributesFourByteAsPathSegmentSlice = []BgpAttributesFourByteAsPathSegment{} - } - return obj -} -func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) clearHolderSlice() BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { - if len(obj.bgpAttributesFourByteAsPathSegmentSlice) > 0 { - obj.bgpAttributesFourByteAsPathSegmentSlice = []BgpAttributesFourByteAsPathSegment{} - } - return obj -} -func (obj *bgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter) appendHolderSlice(item BgpAttributesFourByteAsPathSegment) BgpAttributesAsPathFourByteAsPathBgpAttributesFourByteAsPathSegmentIter { - obj.bgpAttributesFourByteAsPathSegmentSlice = append(obj.bgpAttributesFourByteAsPathSegmentSlice, item) - return obj -} - -func (obj *bgpAttributesAsPathFourByteAsPath) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Segments) != 0 { - - if set_default { - obj.Segments().clearHolderSlice() - for _, item := range obj.obj.Segments { - obj.Segments().appendHolderSlice(&bgpAttributesFourByteAsPathSegment{obj: item}) - } - } - for _, item := range obj.Segments().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpAttributesAsPathFourByteAsPath) setDefault() { - -} - -// ***** BgpAttributesAsPathTwoByteAsPath ***** -type bgpAttributesAsPathTwoByteAsPath struct { - validation - obj *otg.BgpAttributesAsPathTwoByteAsPath - marshaller marshalBgpAttributesAsPathTwoByteAsPath - unMarshaller unMarshalBgpAttributesAsPathTwoByteAsPath - segmentsHolder BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter -} - -func NewBgpAttributesAsPathTwoByteAsPath() BgpAttributesAsPathTwoByteAsPath { - obj := bgpAttributesAsPathTwoByteAsPath{obj: &otg.BgpAttributesAsPathTwoByteAsPath{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesAsPathTwoByteAsPath) msg() *otg.BgpAttributesAsPathTwoByteAsPath { - return obj.obj -} - -func (obj *bgpAttributesAsPathTwoByteAsPath) setMsg(msg *otg.BgpAttributesAsPathTwoByteAsPath) BgpAttributesAsPathTwoByteAsPath { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesAsPathTwoByteAsPath struct { - obj *bgpAttributesAsPathTwoByteAsPath -} - -type marshalBgpAttributesAsPathTwoByteAsPath interface { - // ToProto marshals BgpAttributesAsPathTwoByteAsPath to protobuf object *otg.BgpAttributesAsPathTwoByteAsPath - ToProto() (*otg.BgpAttributesAsPathTwoByteAsPath, error) - // ToPbText marshals BgpAttributesAsPathTwoByteAsPath to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesAsPathTwoByteAsPath to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesAsPathTwoByteAsPath to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesAsPathTwoByteAsPath struct { - obj *bgpAttributesAsPathTwoByteAsPath -} - -type unMarshalBgpAttributesAsPathTwoByteAsPath interface { - // FromProto unmarshals BgpAttributesAsPathTwoByteAsPath from protobuf object *otg.BgpAttributesAsPathTwoByteAsPath - FromProto(msg *otg.BgpAttributesAsPathTwoByteAsPath) (BgpAttributesAsPathTwoByteAsPath, error) - // FromPbText unmarshals BgpAttributesAsPathTwoByteAsPath from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesAsPathTwoByteAsPath from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesAsPathTwoByteAsPath from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesAsPathTwoByteAsPath) Marshal() marshalBgpAttributesAsPathTwoByteAsPath { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesAsPathTwoByteAsPath{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesAsPathTwoByteAsPath) Unmarshal() unMarshalBgpAttributesAsPathTwoByteAsPath { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesAsPathTwoByteAsPath{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesAsPathTwoByteAsPath) ToProto() (*otg.BgpAttributesAsPathTwoByteAsPath, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesAsPathTwoByteAsPath) FromProto(msg *otg.BgpAttributesAsPathTwoByteAsPath) (BgpAttributesAsPathTwoByteAsPath, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesAsPathTwoByteAsPath) 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 *unMarshalbgpAttributesAsPathTwoByteAsPath) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesAsPathTwoByteAsPath) 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 *unMarshalbgpAttributesAsPathTwoByteAsPath) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesAsPathTwoByteAsPath) 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 *unMarshalbgpAttributesAsPathTwoByteAsPath) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesAsPathTwoByteAsPath) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesAsPathTwoByteAsPath) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesAsPathTwoByteAsPath) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesAsPathTwoByteAsPath) Clone() (BgpAttributesAsPathTwoByteAsPath, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesAsPathTwoByteAsPath() - 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 -} - -func (obj *bgpAttributesAsPathTwoByteAsPath) setNil() { - obj.segmentsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesAsPathTwoByteAsPath is aS Paths with 2 byte AS numbers is used when any of the two scenarios occur : -// - An old BGP speaker and new BGP speaker are sending BGP Updates to one another. -// - Two old BGP speakers are sending BGP Updates to one another. -type BgpAttributesAsPathTwoByteAsPath interface { - Validation - // msg marshals BgpAttributesAsPathTwoByteAsPath to protobuf object *otg.BgpAttributesAsPathTwoByteAsPath - // and doesn't set defaults - msg() *otg.BgpAttributesAsPathTwoByteAsPath - // setMsg unmarshals BgpAttributesAsPathTwoByteAsPath from protobuf object *otg.BgpAttributesAsPathTwoByteAsPath - // and doesn't set defaults - setMsg(*otg.BgpAttributesAsPathTwoByteAsPath) BgpAttributesAsPathTwoByteAsPath - // provides marshal interface - Marshal() marshalBgpAttributesAsPathTwoByteAsPath - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesAsPathTwoByteAsPath - // validate validates BgpAttributesAsPathTwoByteAsPath - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesAsPathTwoByteAsPath, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Segments returns BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIterIter, set in BgpAttributesAsPathTwoByteAsPath - Segments() BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter - setNil() -} - -// The AS path segments containing 2 byte AS numbers to be added in the AS Path attribute. By default, an empty AS path should always be included and for EBGP the sender's AS number should be prepended to the AS Path. -// Segments returns a []BgpAttributesTwoByteAsPathSegment -func (obj *bgpAttributesAsPathTwoByteAsPath) Segments() BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { - if len(obj.obj.Segments) == 0 { - obj.obj.Segments = []*otg.BgpAttributesTwoByteAsPathSegment{} - } - if obj.segmentsHolder == nil { - obj.segmentsHolder = newBgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter(&obj.obj.Segments).setMsg(obj) - } - return obj.segmentsHolder -} - -type bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter struct { - obj *bgpAttributesAsPathTwoByteAsPath - bgpAttributesTwoByteAsPathSegmentSlice []BgpAttributesTwoByteAsPathSegment - fieldPtr *[]*otg.BgpAttributesTwoByteAsPathSegment -} - -func newBgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter(ptr *[]*otg.BgpAttributesTwoByteAsPathSegment) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { - return &bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter{fieldPtr: ptr} -} - -type BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter interface { - setMsg(*bgpAttributesAsPathTwoByteAsPath) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter - Items() []BgpAttributesTwoByteAsPathSegment - Add() BgpAttributesTwoByteAsPathSegment - Append(items ...BgpAttributesTwoByteAsPathSegment) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter - Set(index int, newObj BgpAttributesTwoByteAsPathSegment) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter - Clear() BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter - clearHolderSlice() BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter - appendHolderSlice(item BgpAttributesTwoByteAsPathSegment) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter -} - -func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) setMsg(msg *bgpAttributesAsPathTwoByteAsPath) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpAttributesTwoByteAsPathSegment{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) Items() []BgpAttributesTwoByteAsPathSegment { - return obj.bgpAttributesTwoByteAsPathSegmentSlice -} - -func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) Add() BgpAttributesTwoByteAsPathSegment { - newObj := &otg.BgpAttributesTwoByteAsPathSegment{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpAttributesTwoByteAsPathSegment{obj: newObj} - newLibObj.setDefault() - obj.bgpAttributesTwoByteAsPathSegmentSlice = append(obj.bgpAttributesTwoByteAsPathSegmentSlice, newLibObj) - return newLibObj -} - -func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) Append(items ...BgpAttributesTwoByteAsPathSegment) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpAttributesTwoByteAsPathSegmentSlice = append(obj.bgpAttributesTwoByteAsPathSegmentSlice, item) - } - return obj -} - -func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) Set(index int, newObj BgpAttributesTwoByteAsPathSegment) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpAttributesTwoByteAsPathSegmentSlice[index] = newObj - return obj -} -func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) Clear() BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpAttributesTwoByteAsPathSegment{} - obj.bgpAttributesTwoByteAsPathSegmentSlice = []BgpAttributesTwoByteAsPathSegment{} - } - return obj -} -func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) clearHolderSlice() BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { - if len(obj.bgpAttributesTwoByteAsPathSegmentSlice) > 0 { - obj.bgpAttributesTwoByteAsPathSegmentSlice = []BgpAttributesTwoByteAsPathSegment{} - } - return obj -} -func (obj *bgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter) appendHolderSlice(item BgpAttributesTwoByteAsPathSegment) BgpAttributesAsPathTwoByteAsPathBgpAttributesTwoByteAsPathSegmentIter { - obj.bgpAttributesTwoByteAsPathSegmentSlice = append(obj.bgpAttributesTwoByteAsPathSegmentSlice, item) - return obj -} - -func (obj *bgpAttributesAsPathTwoByteAsPath) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Segments) != 0 { - - if set_default { - obj.Segments().clearHolderSlice() - for _, item := range obj.obj.Segments { - obj.Segments().appendHolderSlice(&bgpAttributesTwoByteAsPathSegment{obj: item}) - } - } - for _, item := range obj.Segments().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpAttributesAsPathTwoByteAsPath) setDefault() { - -} - -// ***** BgpAttributesFourByteAsPathSegment ***** -type bgpAttributesFourByteAsPathSegment struct { - validation - obj *otg.BgpAttributesFourByteAsPathSegment - marshaller marshalBgpAttributesFourByteAsPathSegment - unMarshaller unMarshalBgpAttributesFourByteAsPathSegment -} - -func NewBgpAttributesFourByteAsPathSegment() BgpAttributesFourByteAsPathSegment { - obj := bgpAttributesFourByteAsPathSegment{obj: &otg.BgpAttributesFourByteAsPathSegment{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesFourByteAsPathSegment) msg() *otg.BgpAttributesFourByteAsPathSegment { - return obj.obj -} - -func (obj *bgpAttributesFourByteAsPathSegment) setMsg(msg *otg.BgpAttributesFourByteAsPathSegment) BgpAttributesFourByteAsPathSegment { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesFourByteAsPathSegment struct { - obj *bgpAttributesFourByteAsPathSegment -} - -type marshalBgpAttributesFourByteAsPathSegment interface { - // ToProto marshals BgpAttributesFourByteAsPathSegment to protobuf object *otg.BgpAttributesFourByteAsPathSegment - ToProto() (*otg.BgpAttributesFourByteAsPathSegment, error) - // ToPbText marshals BgpAttributesFourByteAsPathSegment to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesFourByteAsPathSegment to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesFourByteAsPathSegment to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesFourByteAsPathSegment struct { - obj *bgpAttributesFourByteAsPathSegment -} - -type unMarshalBgpAttributesFourByteAsPathSegment interface { - // FromProto unmarshals BgpAttributesFourByteAsPathSegment from protobuf object *otg.BgpAttributesFourByteAsPathSegment - FromProto(msg *otg.BgpAttributesFourByteAsPathSegment) (BgpAttributesFourByteAsPathSegment, error) - // FromPbText unmarshals BgpAttributesFourByteAsPathSegment from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesFourByteAsPathSegment from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesFourByteAsPathSegment from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesFourByteAsPathSegment) Marshal() marshalBgpAttributesFourByteAsPathSegment { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesFourByteAsPathSegment{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesFourByteAsPathSegment) Unmarshal() unMarshalBgpAttributesFourByteAsPathSegment { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesFourByteAsPathSegment{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesFourByteAsPathSegment) ToProto() (*otg.BgpAttributesFourByteAsPathSegment, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesFourByteAsPathSegment) FromProto(msg *otg.BgpAttributesFourByteAsPathSegment) (BgpAttributesFourByteAsPathSegment, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesFourByteAsPathSegment) 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 *unMarshalbgpAttributesFourByteAsPathSegment) 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 *marshalbgpAttributesFourByteAsPathSegment) 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 *unMarshalbgpAttributesFourByteAsPathSegment) 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 *marshalbgpAttributesFourByteAsPathSegment) 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 *unMarshalbgpAttributesFourByteAsPathSegment) 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 *bgpAttributesFourByteAsPathSegment) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesFourByteAsPathSegment) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesFourByteAsPathSegment) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesFourByteAsPathSegment) Clone() (BgpAttributesFourByteAsPathSegment, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesFourByteAsPathSegment() - 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 -} - -// BgpAttributesFourByteAsPathSegment is configuration for a single BGP AS path segment containing 4 byte AS numbers. -type BgpAttributesFourByteAsPathSegment interface { - Validation - // msg marshals BgpAttributesFourByteAsPathSegment to protobuf object *otg.BgpAttributesFourByteAsPathSegment - // and doesn't set defaults - msg() *otg.BgpAttributesFourByteAsPathSegment - // setMsg unmarshals BgpAttributesFourByteAsPathSegment from protobuf object *otg.BgpAttributesFourByteAsPathSegment - // and doesn't set defaults - setMsg(*otg.BgpAttributesFourByteAsPathSegment) BgpAttributesFourByteAsPathSegment - // provides marshal interface - Marshal() marshalBgpAttributesFourByteAsPathSegment - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesFourByteAsPathSegment - // validate validates BgpAttributesFourByteAsPathSegment - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesFourByteAsPathSegment, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Type returns BgpAttributesFourByteAsPathSegmentTypeEnum, set in BgpAttributesFourByteAsPathSegment - Type() BgpAttributesFourByteAsPathSegmentTypeEnum - // SetType assigns BgpAttributesFourByteAsPathSegmentTypeEnum provided by user to BgpAttributesFourByteAsPathSegment - SetType(value BgpAttributesFourByteAsPathSegmentTypeEnum) BgpAttributesFourByteAsPathSegment - // HasType checks if Type has been set in BgpAttributesFourByteAsPathSegment - HasType() bool - // AsNumbers returns []uint32, set in BgpAttributesFourByteAsPathSegment. - AsNumbers() []uint32 - // SetAsNumbers assigns []uint32 provided by user to BgpAttributesFourByteAsPathSegment - SetAsNumbers(value []uint32) BgpAttributesFourByteAsPathSegment -} - -type BgpAttributesFourByteAsPathSegmentTypeEnum string - -// Enum of Type on BgpAttributesFourByteAsPathSegment -var BgpAttributesFourByteAsPathSegmentType = struct { - AS_SEQ BgpAttributesFourByteAsPathSegmentTypeEnum - AS_SET BgpAttributesFourByteAsPathSegmentTypeEnum - AS_CONFED_SEQ BgpAttributesFourByteAsPathSegmentTypeEnum - AS_CONFED_SET BgpAttributesFourByteAsPathSegmentTypeEnum -}{ - AS_SEQ: BgpAttributesFourByteAsPathSegmentTypeEnum("as_seq"), - AS_SET: BgpAttributesFourByteAsPathSegmentTypeEnum("as_set"), - AS_CONFED_SEQ: BgpAttributesFourByteAsPathSegmentTypeEnum("as_confed_seq"), - AS_CONFED_SET: BgpAttributesFourByteAsPathSegmentTypeEnum("as_confed_set"), -} - -func (obj *bgpAttributesFourByteAsPathSegment) Type() BgpAttributesFourByteAsPathSegmentTypeEnum { - return BgpAttributesFourByteAsPathSegmentTypeEnum(obj.obj.Type.Enum().String()) -} - -// AS sequence is the most common type of AS_PATH, it contains the list -// of ASNs starting with the most recent ASN being added read from left -// to right. -// The other three AS_PATH types are used for Confederations -// - AS_SET is the type of AS_PATH attribute that summarizes routes using -// using the aggregate-address command, allowing AS_PATHs to be summarized -// in the update as well. -// - AS_CONFED_SEQ gives the list of ASNs in the path starting with the most -// recent ASN to be added reading left to right -// - AS_CONFED_SET will allow summarization of multiple AS PATHs to be sent -// in BGP Updates. -// Type returns a string -func (obj *bgpAttributesFourByteAsPathSegment) HasType() bool { - return obj.obj.Type != nil -} - -func (obj *bgpAttributesFourByteAsPathSegment) SetType(value BgpAttributesFourByteAsPathSegmentTypeEnum) BgpAttributesFourByteAsPathSegment { - intValue, ok := otg.BgpAttributesFourByteAsPathSegment_Type_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAttributesFourByteAsPathSegmentTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpAttributesFourByteAsPathSegment_Type_Enum(intValue) - obj.obj.Type = &enumValue - - return obj -} - -// The 4 byte AS numbers in this AS path segment. -// AsNumbers returns a []uint32 -func (obj *bgpAttributesFourByteAsPathSegment) AsNumbers() []uint32 { - if obj.obj.AsNumbers == nil { - obj.obj.AsNumbers = make([]uint32, 0) - } - return obj.obj.AsNumbers -} - -// The 4 byte AS numbers in this AS path segment. -// SetAsNumbers sets the []uint32 value in the BgpAttributesFourByteAsPathSegment object -func (obj *bgpAttributesFourByteAsPathSegment) SetAsNumbers(value []uint32) BgpAttributesFourByteAsPathSegment { - - if obj.obj.AsNumbers == nil { - obj.obj.AsNumbers = make([]uint32, 0) - } - obj.obj.AsNumbers = value - - return obj -} - -func (obj *bgpAttributesFourByteAsPathSegment) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpAttributesFourByteAsPathSegment) setDefault() { - if obj.obj.Type == nil { - obj.SetType(BgpAttributesFourByteAsPathSegmentType.AS_SEQ) - - } - -} - -// ***** BgpAttributesNextHopIpv6TwoAddresses ***** -type bgpAttributesNextHopIpv6TwoAddresses struct { - validation - obj *otg.BgpAttributesNextHopIpv6TwoAddresses - marshaller marshalBgpAttributesNextHopIpv6TwoAddresses - unMarshaller unMarshalBgpAttributesNextHopIpv6TwoAddresses -} - -func NewBgpAttributesNextHopIpv6TwoAddresses() BgpAttributesNextHopIpv6TwoAddresses { - obj := bgpAttributesNextHopIpv6TwoAddresses{obj: &otg.BgpAttributesNextHopIpv6TwoAddresses{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesNextHopIpv6TwoAddresses) msg() *otg.BgpAttributesNextHopIpv6TwoAddresses { - return obj.obj -} - -func (obj *bgpAttributesNextHopIpv6TwoAddresses) setMsg(msg *otg.BgpAttributesNextHopIpv6TwoAddresses) BgpAttributesNextHopIpv6TwoAddresses { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesNextHopIpv6TwoAddresses struct { - obj *bgpAttributesNextHopIpv6TwoAddresses -} - -type marshalBgpAttributesNextHopIpv6TwoAddresses interface { - // ToProto marshals BgpAttributesNextHopIpv6TwoAddresses to protobuf object *otg.BgpAttributesNextHopIpv6TwoAddresses - ToProto() (*otg.BgpAttributesNextHopIpv6TwoAddresses, error) - // ToPbText marshals BgpAttributesNextHopIpv6TwoAddresses to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesNextHopIpv6TwoAddresses to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesNextHopIpv6TwoAddresses to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesNextHopIpv6TwoAddresses struct { - obj *bgpAttributesNextHopIpv6TwoAddresses -} - -type unMarshalBgpAttributesNextHopIpv6TwoAddresses interface { - // FromProto unmarshals BgpAttributesNextHopIpv6TwoAddresses from protobuf object *otg.BgpAttributesNextHopIpv6TwoAddresses - FromProto(msg *otg.BgpAttributesNextHopIpv6TwoAddresses) (BgpAttributesNextHopIpv6TwoAddresses, error) - // FromPbText unmarshals BgpAttributesNextHopIpv6TwoAddresses from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesNextHopIpv6TwoAddresses from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesNextHopIpv6TwoAddresses from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesNextHopIpv6TwoAddresses) Marshal() marshalBgpAttributesNextHopIpv6TwoAddresses { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesNextHopIpv6TwoAddresses{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesNextHopIpv6TwoAddresses) Unmarshal() unMarshalBgpAttributesNextHopIpv6TwoAddresses { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesNextHopIpv6TwoAddresses{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesNextHopIpv6TwoAddresses) ToProto() (*otg.BgpAttributesNextHopIpv6TwoAddresses, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesNextHopIpv6TwoAddresses) FromProto(msg *otg.BgpAttributesNextHopIpv6TwoAddresses) (BgpAttributesNextHopIpv6TwoAddresses, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesNextHopIpv6TwoAddresses) 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 *unMarshalbgpAttributesNextHopIpv6TwoAddresses) 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 *marshalbgpAttributesNextHopIpv6TwoAddresses) 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 *unMarshalbgpAttributesNextHopIpv6TwoAddresses) 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 *marshalbgpAttributesNextHopIpv6TwoAddresses) 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 *unMarshalbgpAttributesNextHopIpv6TwoAddresses) 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 *bgpAttributesNextHopIpv6TwoAddresses) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesNextHopIpv6TwoAddresses) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesNextHopIpv6TwoAddresses) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesNextHopIpv6TwoAddresses) Clone() (BgpAttributesNextHopIpv6TwoAddresses, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesNextHopIpv6TwoAddresses() - 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 -} - -// BgpAttributesNextHopIpv6TwoAddresses is there is a specific scenario in which it is possible to receive a Global and Link Local address in the Next Hop -// field in a MP_REACH attribute or in the NEXT_HOP attribute(RFC2545: Section 3). -type BgpAttributesNextHopIpv6TwoAddresses interface { - Validation - // msg marshals BgpAttributesNextHopIpv6TwoAddresses to protobuf object *otg.BgpAttributesNextHopIpv6TwoAddresses - // and doesn't set defaults - msg() *otg.BgpAttributesNextHopIpv6TwoAddresses - // setMsg unmarshals BgpAttributesNextHopIpv6TwoAddresses from protobuf object *otg.BgpAttributesNextHopIpv6TwoAddresses - // and doesn't set defaults - setMsg(*otg.BgpAttributesNextHopIpv6TwoAddresses) BgpAttributesNextHopIpv6TwoAddresses - // provides marshal interface - Marshal() marshalBgpAttributesNextHopIpv6TwoAddresses - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesNextHopIpv6TwoAddresses - // validate validates BgpAttributesNextHopIpv6TwoAddresses - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesNextHopIpv6TwoAddresses, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // First returns string, set in BgpAttributesNextHopIpv6TwoAddresses. - First() string - // SetFirst assigns string provided by user to BgpAttributesNextHopIpv6TwoAddresses - SetFirst(value string) BgpAttributesNextHopIpv6TwoAddresses - // HasFirst checks if First has been set in BgpAttributesNextHopIpv6TwoAddresses - HasFirst() bool - // Second returns string, set in BgpAttributesNextHopIpv6TwoAddresses. - Second() string - // SetSecond assigns string provided by user to BgpAttributesNextHopIpv6TwoAddresses - SetSecond(value string) BgpAttributesNextHopIpv6TwoAddresses - // HasSecond checks if Second has been set in BgpAttributesNextHopIpv6TwoAddresses - HasSecond() bool -} - -// The first IPv6 next hop in the 32 byte IPv6 Next Hop. -// First returns a string -func (obj *bgpAttributesNextHopIpv6TwoAddresses) First() string { - - return *obj.obj.First - -} - -// The first IPv6 next hop in the 32 byte IPv6 Next Hop. -// First returns a string -func (obj *bgpAttributesNextHopIpv6TwoAddresses) HasFirst() bool { - return obj.obj.First != nil -} - -// The first IPv6 next hop in the 32 byte IPv6 Next Hop. -// SetFirst sets the string value in the BgpAttributesNextHopIpv6TwoAddresses object -func (obj *bgpAttributesNextHopIpv6TwoAddresses) SetFirst(value string) BgpAttributesNextHopIpv6TwoAddresses { - - obj.obj.First = &value - return obj -} - -// The second IPv6 next hop in the 32 byte IPv6 Next Hop. -// Second returns a string -func (obj *bgpAttributesNextHopIpv6TwoAddresses) Second() string { - - return *obj.obj.Second - -} - -// The second IPv6 next hop in the 32 byte IPv6 Next Hop. -// Second returns a string -func (obj *bgpAttributesNextHopIpv6TwoAddresses) HasSecond() bool { - return obj.obj.Second != nil -} - -// The second IPv6 next hop in the 32 byte IPv6 Next Hop. -// SetSecond sets the string value in the BgpAttributesNextHopIpv6TwoAddresses object -func (obj *bgpAttributesNextHopIpv6TwoAddresses) SetSecond(value string) BgpAttributesNextHopIpv6TwoAddresses { - - obj.obj.Second = &value - return obj -} - -func (obj *bgpAttributesNextHopIpv6TwoAddresses) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.First != nil { - - err := obj.validateIpv6(obj.First()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesNextHopIpv6TwoAddresses.First")) - } - - } - - if obj.obj.Second != nil { - - err := obj.validateIpv6(obj.Second()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesNextHopIpv6TwoAddresses.Second")) - } - - } - -} - -func (obj *bgpAttributesNextHopIpv6TwoAddresses) setDefault() { - if obj.obj.First == nil { - obj.SetFirst("0::0") - } - if obj.obj.Second == nil { - obj.SetSecond("0::0") - } - -} - -// ***** BgpAttributesCustomCommunity ***** -type bgpAttributesCustomCommunity struct { - validation - obj *otg.BgpAttributesCustomCommunity - marshaller marshalBgpAttributesCustomCommunity - unMarshaller unMarshalBgpAttributesCustomCommunity -} - -func NewBgpAttributesCustomCommunity() BgpAttributesCustomCommunity { - obj := bgpAttributesCustomCommunity{obj: &otg.BgpAttributesCustomCommunity{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesCustomCommunity) msg() *otg.BgpAttributesCustomCommunity { - return obj.obj -} - -func (obj *bgpAttributesCustomCommunity) setMsg(msg *otg.BgpAttributesCustomCommunity) BgpAttributesCustomCommunity { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesCustomCommunity struct { - obj *bgpAttributesCustomCommunity -} - -type marshalBgpAttributesCustomCommunity interface { - // ToProto marshals BgpAttributesCustomCommunity to protobuf object *otg.BgpAttributesCustomCommunity - ToProto() (*otg.BgpAttributesCustomCommunity, error) - // ToPbText marshals BgpAttributesCustomCommunity to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesCustomCommunity to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesCustomCommunity to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesCustomCommunity struct { - obj *bgpAttributesCustomCommunity -} - -type unMarshalBgpAttributesCustomCommunity interface { - // FromProto unmarshals BgpAttributesCustomCommunity from protobuf object *otg.BgpAttributesCustomCommunity - FromProto(msg *otg.BgpAttributesCustomCommunity) (BgpAttributesCustomCommunity, error) - // FromPbText unmarshals BgpAttributesCustomCommunity from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesCustomCommunity from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesCustomCommunity from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesCustomCommunity) Marshal() marshalBgpAttributesCustomCommunity { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesCustomCommunity{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesCustomCommunity) Unmarshal() unMarshalBgpAttributesCustomCommunity { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesCustomCommunity{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesCustomCommunity) ToProto() (*otg.BgpAttributesCustomCommunity, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesCustomCommunity) FromProto(msg *otg.BgpAttributesCustomCommunity) (BgpAttributesCustomCommunity, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesCustomCommunity) 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 *unMarshalbgpAttributesCustomCommunity) 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 *marshalbgpAttributesCustomCommunity) 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 *unMarshalbgpAttributesCustomCommunity) 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 *marshalbgpAttributesCustomCommunity) 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 *unMarshalbgpAttributesCustomCommunity) 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 *bgpAttributesCustomCommunity) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesCustomCommunity) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesCustomCommunity) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesCustomCommunity) Clone() (BgpAttributesCustomCommunity, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesCustomCommunity() - 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 -} - -// BgpAttributesCustomCommunity is user defined COMMUNITY attribute containing 2 byte AS and custom 2 byte value defined by the administrator of the domain. -type BgpAttributesCustomCommunity interface { - Validation - // msg marshals BgpAttributesCustomCommunity to protobuf object *otg.BgpAttributesCustomCommunity - // and doesn't set defaults - msg() *otg.BgpAttributesCustomCommunity - // setMsg unmarshals BgpAttributesCustomCommunity from protobuf object *otg.BgpAttributesCustomCommunity - // and doesn't set defaults - setMsg(*otg.BgpAttributesCustomCommunity) BgpAttributesCustomCommunity - // provides marshal interface - Marshal() marshalBgpAttributesCustomCommunity - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesCustomCommunity - // validate validates BgpAttributesCustomCommunity - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesCustomCommunity, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // AsNumber returns uint32, set in BgpAttributesCustomCommunity. - AsNumber() uint32 - // SetAsNumber assigns uint32 provided by user to BgpAttributesCustomCommunity - SetAsNumber(value uint32) BgpAttributesCustomCommunity - // HasAsNumber checks if AsNumber has been set in BgpAttributesCustomCommunity - HasAsNumber() bool - // Custom returns string, set in BgpAttributesCustomCommunity. - Custom() string - // SetCustom assigns string provided by user to BgpAttributesCustomCommunity - SetCustom(value string) BgpAttributesCustomCommunity - // HasCustom checks if Custom has been set in BgpAttributesCustomCommunity - HasCustom() bool -} - -// First two octets of the community value containing a 2 byte AS number. -// AsNumber returns a uint32 -func (obj *bgpAttributesCustomCommunity) AsNumber() uint32 { - - return *obj.obj.AsNumber - -} - -// First two octets of the community value containing a 2 byte AS number. -// AsNumber returns a uint32 -func (obj *bgpAttributesCustomCommunity) HasAsNumber() bool { - return obj.obj.AsNumber != nil -} - -// First two octets of the community value containing a 2 byte AS number. -// SetAsNumber sets the uint32 value in the BgpAttributesCustomCommunity object -func (obj *bgpAttributesCustomCommunity) SetAsNumber(value uint32) BgpAttributesCustomCommunity { - - obj.obj.AsNumber = &value - return obj -} - -// Last two octets of the community value in hex. If user provides less than 4 hex bytes, it should be left-padded with 0s. -// Custom returns a string -func (obj *bgpAttributesCustomCommunity) Custom() string { - - return *obj.obj.Custom - -} - -// Last two octets of the community value in hex. If user provides less than 4 hex bytes, it should be left-padded with 0s. -// Custom returns a string -func (obj *bgpAttributesCustomCommunity) HasCustom() bool { - return obj.obj.Custom != nil -} - -// Last two octets of the community value in hex. If user provides less than 4 hex bytes, it should be left-padded with 0s. -// SetCustom sets the string value in the BgpAttributesCustomCommunity object -func (obj *bgpAttributesCustomCommunity) SetCustom(value string) BgpAttributesCustomCommunity { - - obj.obj.Custom = &value - return obj -} - -func (obj *bgpAttributesCustomCommunity) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.AsNumber != nil { - - if *obj.obj.AsNumber > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesCustomCommunity.AsNumber <= 65535 but Got %d", *obj.obj.AsNumber)) - } - - } - - if obj.obj.Custom != nil { - - if len(*obj.obj.Custom) > 4 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "None <= length of BgpAttributesCustomCommunity.Custom <= 4 but Got %d", - len(*obj.obj.Custom))) - } - - } - -} - -func (obj *bgpAttributesCustomCommunity) setDefault() { - if obj.obj.AsNumber == nil { - obj.SetAsNumber(0) - } - if obj.obj.Custom == nil { - obj.SetCustom("0000") - } - -} - -// ***** BgpAttributesSegmentRoutingPolicy ***** -type bgpAttributesSegmentRoutingPolicy struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicy - marshaller marshalBgpAttributesSegmentRoutingPolicy - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicy - bindingSegmentIdentifierHolder BgpAttributesBsid - srv6BindingSegmentIdentifierHolder BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter - preferenceHolder BgpAttributesSrPolicyPreference - priorityHolder BgpAttributesSrPolicyPriority - policyNameHolder BgpAttributesSrPolicyPolicyName - policyCandidateNameHolder BgpAttributesSrPolicyPolicyCandidateName - explicitNullLabelPolicyHolder BgpAttributesSrPolicyExplicitNullPolicy - segmentListHolder BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter -} - -func NewBgpAttributesSegmentRoutingPolicy() BgpAttributesSegmentRoutingPolicy { - obj := bgpAttributesSegmentRoutingPolicy{obj: &otg.BgpAttributesSegmentRoutingPolicy{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicy) msg() *otg.BgpAttributesSegmentRoutingPolicy { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicy) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicy) BgpAttributesSegmentRoutingPolicy { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicy struct { - obj *bgpAttributesSegmentRoutingPolicy -} - -type marshalBgpAttributesSegmentRoutingPolicy interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicy to protobuf object *otg.BgpAttributesSegmentRoutingPolicy - ToProto() (*otg.BgpAttributesSegmentRoutingPolicy, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicy to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicy to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicy to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicy struct { - obj *bgpAttributesSegmentRoutingPolicy -} - -type unMarshalBgpAttributesSegmentRoutingPolicy interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicy from protobuf object *otg.BgpAttributesSegmentRoutingPolicy - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicy) (BgpAttributesSegmentRoutingPolicy, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicy from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicy from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicy from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicy) Marshal() marshalBgpAttributesSegmentRoutingPolicy { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicy{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicy) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicy { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicy{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicy) ToProto() (*otg.BgpAttributesSegmentRoutingPolicy, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicy) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicy) (BgpAttributesSegmentRoutingPolicy, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicy) 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 *unMarshalbgpAttributesSegmentRoutingPolicy) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSegmentRoutingPolicy) 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 *unMarshalbgpAttributesSegmentRoutingPolicy) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicy) 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 *unMarshalbgpAttributesSegmentRoutingPolicy) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSegmentRoutingPolicy) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicy) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicy) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicy) Clone() (BgpAttributesSegmentRoutingPolicy, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicy() - 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 -} - -func (obj *bgpAttributesSegmentRoutingPolicy) setNil() { - obj.bindingSegmentIdentifierHolder = nil - obj.srv6BindingSegmentIdentifierHolder = nil - obj.preferenceHolder = nil - obj.priorityHolder = nil - obj.policyNameHolder = nil - obj.policyCandidateNameHolder = nil - obj.explicitNullLabelPolicyHolder = nil - obj.segmentListHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSegmentRoutingPolicy is optional Segment Routing Policy information as defined in draft-ietf-idr-sr-policy-safi-02. -// This information is carried in TUNNEL_ENCAPSULATION attribute with type set to SR Policy (15). -type BgpAttributesSegmentRoutingPolicy interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicy to protobuf object *otg.BgpAttributesSegmentRoutingPolicy - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicy - // setMsg unmarshals BgpAttributesSegmentRoutingPolicy from protobuf object *otg.BgpAttributesSegmentRoutingPolicy - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicy) BgpAttributesSegmentRoutingPolicy - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicy - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicy - // validate validates BgpAttributesSegmentRoutingPolicy - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicy, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // BindingSegmentIdentifier returns BgpAttributesBsid, set in BgpAttributesSegmentRoutingPolicy. - // BgpAttributesBsid is the Binding Segment Identifier is an optional sub-tlv of type 13 that can be sent with a SR Policy - // Tunnel Encapsulation attribute. - // When the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that - // BSID if this value (label in MPLS, IPv6 address in SRv6) is available. - // - The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . - // - It is recommended that if SRv6 Binding SID is desired to be signalled, the SRv6 Binding SID sub-TLV that enables - // the specification of the SRv6 Endpoint Behavior should be used. - BindingSegmentIdentifier() BgpAttributesBsid - // SetBindingSegmentIdentifier assigns BgpAttributesBsid provided by user to BgpAttributesSegmentRoutingPolicy. - // BgpAttributesBsid is the Binding Segment Identifier is an optional sub-tlv of type 13 that can be sent with a SR Policy - // Tunnel Encapsulation attribute. - // When the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that - // BSID if this value (label in MPLS, IPv6 address in SRv6) is available. - // - The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . - // - It is recommended that if SRv6 Binding SID is desired to be signalled, the SRv6 Binding SID sub-TLV that enables - // the specification of the SRv6 Endpoint Behavior should be used. - SetBindingSegmentIdentifier(value BgpAttributesBsid) BgpAttributesSegmentRoutingPolicy - // HasBindingSegmentIdentifier checks if BindingSegmentIdentifier has been set in BgpAttributesSegmentRoutingPolicy - HasBindingSegmentIdentifier() bool - // Srv6BindingSegmentIdentifier returns BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIterIter, set in BgpAttributesSegmentRoutingPolicy - Srv6BindingSegmentIdentifier() BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter - // Preference returns BgpAttributesSrPolicyPreference, set in BgpAttributesSegmentRoutingPolicy. - // BgpAttributesSrPolicyPreference is optional Preference sub-tlv (Type 12) is used to select the best candidate path for an SR Policy. - // It is defined in Section 2.4.1 of draft-ietf-idr-sr-policy-safi-02 . - Preference() BgpAttributesSrPolicyPreference - // SetPreference assigns BgpAttributesSrPolicyPreference provided by user to BgpAttributesSegmentRoutingPolicy. - // BgpAttributesSrPolicyPreference is optional Preference sub-tlv (Type 12) is used to select the best candidate path for an SR Policy. - // It is defined in Section 2.4.1 of draft-ietf-idr-sr-policy-safi-02 . - SetPreference(value BgpAttributesSrPolicyPreference) BgpAttributesSegmentRoutingPolicy - // HasPreference checks if Preference has been set in BgpAttributesSegmentRoutingPolicy - HasPreference() bool - // Priority returns BgpAttributesSrPolicyPriority, set in BgpAttributesSegmentRoutingPolicy. - // BgpAttributesSrPolicyPriority is optional Priority sub-tlv (Type 15) used to select the order in which policies should be re-computed. - // - It is defined in Section 2.4.6 of draft-ietf-idr-sr-policy-safi-02 . - Priority() BgpAttributesSrPolicyPriority - // SetPriority assigns BgpAttributesSrPolicyPriority provided by user to BgpAttributesSegmentRoutingPolicy. - // BgpAttributesSrPolicyPriority is optional Priority sub-tlv (Type 15) used to select the order in which policies should be re-computed. - // - It is defined in Section 2.4.6 of draft-ietf-idr-sr-policy-safi-02 . - SetPriority(value BgpAttributesSrPolicyPriority) BgpAttributesSegmentRoutingPolicy - // HasPriority checks if Priority has been set in BgpAttributesSegmentRoutingPolicy - HasPriority() bool - // PolicyName returns BgpAttributesSrPolicyPolicyName, set in BgpAttributesSegmentRoutingPolicy. - // BgpAttributesSrPolicyPolicyName is optional Policy Name sub-tlv (Type 130) which carries the symbolic name for the SR Policy for which the - // candidate path is being advertised for debugging. - // - It is defined in Section 2.4.8 of draft-ietf-idr-sr-policy-safi-02 . - PolicyName() BgpAttributesSrPolicyPolicyName - // SetPolicyName assigns BgpAttributesSrPolicyPolicyName provided by user to BgpAttributesSegmentRoutingPolicy. - // BgpAttributesSrPolicyPolicyName is optional Policy Name sub-tlv (Type 130) which carries the symbolic name for the SR Policy for which the - // candidate path is being advertised for debugging. - // - It is defined in Section 2.4.8 of draft-ietf-idr-sr-policy-safi-02 . - SetPolicyName(value BgpAttributesSrPolicyPolicyName) BgpAttributesSegmentRoutingPolicy - // HasPolicyName checks if PolicyName has been set in BgpAttributesSegmentRoutingPolicy - HasPolicyName() bool - // PolicyCandidateName returns BgpAttributesSrPolicyPolicyCandidateName, set in BgpAttributesSegmentRoutingPolicy. - // BgpAttributesSrPolicyPolicyCandidateName is optional Policy Candidate Path Name sub-tlv (Type 129) which carries the symbolic name for the SR Policy candidate path - // for debugging. - // - It is defined in Section 2.4.7 of draft-ietf-idr-sr-policy-safi-02 . - PolicyCandidateName() BgpAttributesSrPolicyPolicyCandidateName - // SetPolicyCandidateName assigns BgpAttributesSrPolicyPolicyCandidateName provided by user to BgpAttributesSegmentRoutingPolicy. - // BgpAttributesSrPolicyPolicyCandidateName is optional Policy Candidate Path Name sub-tlv (Type 129) which carries the symbolic name for the SR Policy candidate path - // for debugging. - // - It is defined in Section 2.4.7 of draft-ietf-idr-sr-policy-safi-02 . - SetPolicyCandidateName(value BgpAttributesSrPolicyPolicyCandidateName) BgpAttributesSegmentRoutingPolicy - // HasPolicyCandidateName checks if PolicyCandidateName has been set in BgpAttributesSegmentRoutingPolicy - HasPolicyCandidateName() bool - // ExplicitNullLabelPolicy returns BgpAttributesSrPolicyExplicitNullPolicy, set in BgpAttributesSegmentRoutingPolicy. - // BgpAttributesSrPolicyExplicitNullPolicy is this is an optional sub-tlv (Type 14) which indicates whether an Explicit NULL Label must be pushed on an unlabeled IP - // packet before other labels for IPv4 or IPv6 flows. - // - It is defined in Section 2.4.5 of draft-ietf-idr-sr-policy-safi-02. - ExplicitNullLabelPolicy() BgpAttributesSrPolicyExplicitNullPolicy - // SetExplicitNullLabelPolicy assigns BgpAttributesSrPolicyExplicitNullPolicy provided by user to BgpAttributesSegmentRoutingPolicy. - // BgpAttributesSrPolicyExplicitNullPolicy is this is an optional sub-tlv (Type 14) which indicates whether an Explicit NULL Label must be pushed on an unlabeled IP - // packet before other labels for IPv4 or IPv6 flows. - // - It is defined in Section 2.4.5 of draft-ietf-idr-sr-policy-safi-02. - SetExplicitNullLabelPolicy(value BgpAttributesSrPolicyExplicitNullPolicy) BgpAttributesSegmentRoutingPolicy - // HasExplicitNullLabelPolicy checks if ExplicitNullLabelPolicy has been set in BgpAttributesSegmentRoutingPolicy - HasExplicitNullLabelPolicy() bool - // SegmentList returns BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIterIter, set in BgpAttributesSegmentRoutingPolicy - SegmentList() BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter - setNil() -} - -// description is TBD -// BindingSegmentIdentifier returns a BgpAttributesBsid -func (obj *bgpAttributesSegmentRoutingPolicy) BindingSegmentIdentifier() BgpAttributesBsid { - if obj.obj.BindingSegmentIdentifier == nil { - obj.obj.BindingSegmentIdentifier = NewBgpAttributesBsid().msg() - } - if obj.bindingSegmentIdentifierHolder == nil { - obj.bindingSegmentIdentifierHolder = &bgpAttributesBsid{obj: obj.obj.BindingSegmentIdentifier} - } - return obj.bindingSegmentIdentifierHolder -} - -// description is TBD -// BindingSegmentIdentifier returns a BgpAttributesBsid -func (obj *bgpAttributesSegmentRoutingPolicy) HasBindingSegmentIdentifier() bool { - return obj.obj.BindingSegmentIdentifier != nil -} - -// description is TBD -// SetBindingSegmentIdentifier sets the BgpAttributesBsid value in the BgpAttributesSegmentRoutingPolicy object -func (obj *bgpAttributesSegmentRoutingPolicy) SetBindingSegmentIdentifier(value BgpAttributesBsid) BgpAttributesSegmentRoutingPolicy { - - obj.bindingSegmentIdentifierHolder = nil - obj.obj.BindingSegmentIdentifier = value.msg() - - return obj -} - -// The SRv6 Binding SID sub-TLV is an optional sub-TLV of type 20 that is used to signal the SRv6 Binding SID -// related information of an SR Policy candidate path. -// - More than one SRv6 Binding SID sub-TLVs MAY be signaled in the same SR Policy encoding to indicate one -// or more SRv6 SIDs, each with potentially different SRv6 Endpoint Behaviors to be instantiated. -// - The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.3 . -// Srv6BindingSegmentIdentifier returns a []BgpAttributesSrv6Bsid -func (obj *bgpAttributesSegmentRoutingPolicy) Srv6BindingSegmentIdentifier() BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { - if len(obj.obj.Srv6BindingSegmentIdentifier) == 0 { - obj.obj.Srv6BindingSegmentIdentifier = []*otg.BgpAttributesSrv6Bsid{} - } - if obj.srv6BindingSegmentIdentifierHolder == nil { - obj.srv6BindingSegmentIdentifierHolder = newBgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter(&obj.obj.Srv6BindingSegmentIdentifier).setMsg(obj) - } - return obj.srv6BindingSegmentIdentifierHolder -} - -type bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter struct { - obj *bgpAttributesSegmentRoutingPolicy - bgpAttributesSrv6BsidSlice []BgpAttributesSrv6Bsid - fieldPtr *[]*otg.BgpAttributesSrv6Bsid -} - -func newBgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter(ptr *[]*otg.BgpAttributesSrv6Bsid) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { - return &bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter{fieldPtr: ptr} -} - -type BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter interface { - setMsg(*bgpAttributesSegmentRoutingPolicy) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter - Items() []BgpAttributesSrv6Bsid - Add() BgpAttributesSrv6Bsid - Append(items ...BgpAttributesSrv6Bsid) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter - Set(index int, newObj BgpAttributesSrv6Bsid) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter - Clear() BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter - clearHolderSlice() BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter - appendHolderSlice(item BgpAttributesSrv6Bsid) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter -} - -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) setMsg(msg *bgpAttributesSegmentRoutingPolicy) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpAttributesSrv6Bsid{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) Items() []BgpAttributesSrv6Bsid { - return obj.bgpAttributesSrv6BsidSlice -} - -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) Add() BgpAttributesSrv6Bsid { - newObj := &otg.BgpAttributesSrv6Bsid{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpAttributesSrv6Bsid{obj: newObj} - newLibObj.setDefault() - obj.bgpAttributesSrv6BsidSlice = append(obj.bgpAttributesSrv6BsidSlice, newLibObj) - return newLibObj -} - -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) Append(items ...BgpAttributesSrv6Bsid) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpAttributesSrv6BsidSlice = append(obj.bgpAttributesSrv6BsidSlice, item) - } - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) Set(index int, newObj BgpAttributesSrv6Bsid) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpAttributesSrv6BsidSlice[index] = newObj - return obj -} -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) Clear() BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpAttributesSrv6Bsid{} - obj.bgpAttributesSrv6BsidSlice = []BgpAttributesSrv6Bsid{} - } - return obj -} -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) clearHolderSlice() BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { - if len(obj.bgpAttributesSrv6BsidSlice) > 0 { - obj.bgpAttributesSrv6BsidSlice = []BgpAttributesSrv6Bsid{} - } - return obj -} -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter) appendHolderSlice(item BgpAttributesSrv6Bsid) BgpAttributesSegmentRoutingPolicyBgpAttributesSrv6BsidIter { - obj.bgpAttributesSrv6BsidSlice = append(obj.bgpAttributesSrv6BsidSlice, item) - return obj -} - -// description is TBD -// Preference returns a BgpAttributesSrPolicyPreference -func (obj *bgpAttributesSegmentRoutingPolicy) Preference() BgpAttributesSrPolicyPreference { - if obj.obj.Preference == nil { - obj.obj.Preference = NewBgpAttributesSrPolicyPreference().msg() - } - if obj.preferenceHolder == nil { - obj.preferenceHolder = &bgpAttributesSrPolicyPreference{obj: obj.obj.Preference} - } - return obj.preferenceHolder -} - -// description is TBD -// Preference returns a BgpAttributesSrPolicyPreference -func (obj *bgpAttributesSegmentRoutingPolicy) HasPreference() bool { - return obj.obj.Preference != nil -} - -// description is TBD -// SetPreference sets the BgpAttributesSrPolicyPreference value in the BgpAttributesSegmentRoutingPolicy object -func (obj *bgpAttributesSegmentRoutingPolicy) SetPreference(value BgpAttributesSrPolicyPreference) BgpAttributesSegmentRoutingPolicy { - - obj.preferenceHolder = nil - obj.obj.Preference = value.msg() - - return obj -} - -// description is TBD -// Priority returns a BgpAttributesSrPolicyPriority -func (obj *bgpAttributesSegmentRoutingPolicy) Priority() BgpAttributesSrPolicyPriority { - if obj.obj.Priority == nil { - obj.obj.Priority = NewBgpAttributesSrPolicyPriority().msg() - } - if obj.priorityHolder == nil { - obj.priorityHolder = &bgpAttributesSrPolicyPriority{obj: obj.obj.Priority} - } - return obj.priorityHolder -} - -// description is TBD -// Priority returns a BgpAttributesSrPolicyPriority -func (obj *bgpAttributesSegmentRoutingPolicy) HasPriority() bool { - return obj.obj.Priority != nil -} - -// description is TBD -// SetPriority sets the BgpAttributesSrPolicyPriority value in the BgpAttributesSegmentRoutingPolicy object -func (obj *bgpAttributesSegmentRoutingPolicy) SetPriority(value BgpAttributesSrPolicyPriority) BgpAttributesSegmentRoutingPolicy { - - obj.priorityHolder = nil - obj.obj.Priority = value.msg() - - return obj -} - -// description is TBD -// PolicyName returns a BgpAttributesSrPolicyPolicyName -func (obj *bgpAttributesSegmentRoutingPolicy) PolicyName() BgpAttributesSrPolicyPolicyName { - if obj.obj.PolicyName == nil { - obj.obj.PolicyName = NewBgpAttributesSrPolicyPolicyName().msg() - } - if obj.policyNameHolder == nil { - obj.policyNameHolder = &bgpAttributesSrPolicyPolicyName{obj: obj.obj.PolicyName} - } - return obj.policyNameHolder -} - -// description is TBD -// PolicyName returns a BgpAttributesSrPolicyPolicyName -func (obj *bgpAttributesSegmentRoutingPolicy) HasPolicyName() bool { - return obj.obj.PolicyName != nil -} - -// description is TBD -// SetPolicyName sets the BgpAttributesSrPolicyPolicyName value in the BgpAttributesSegmentRoutingPolicy object -func (obj *bgpAttributesSegmentRoutingPolicy) SetPolicyName(value BgpAttributesSrPolicyPolicyName) BgpAttributesSegmentRoutingPolicy { - - obj.policyNameHolder = nil - obj.obj.PolicyName = value.msg() - - return obj -} - -// description is TBD -// PolicyCandidateName returns a BgpAttributesSrPolicyPolicyCandidateName -func (obj *bgpAttributesSegmentRoutingPolicy) PolicyCandidateName() BgpAttributesSrPolicyPolicyCandidateName { - if obj.obj.PolicyCandidateName == nil { - obj.obj.PolicyCandidateName = NewBgpAttributesSrPolicyPolicyCandidateName().msg() - } - if obj.policyCandidateNameHolder == nil { - obj.policyCandidateNameHolder = &bgpAttributesSrPolicyPolicyCandidateName{obj: obj.obj.PolicyCandidateName} - } - return obj.policyCandidateNameHolder -} - -// description is TBD -// PolicyCandidateName returns a BgpAttributesSrPolicyPolicyCandidateName -func (obj *bgpAttributesSegmentRoutingPolicy) HasPolicyCandidateName() bool { - return obj.obj.PolicyCandidateName != nil -} - -// description is TBD -// SetPolicyCandidateName sets the BgpAttributesSrPolicyPolicyCandidateName value in the BgpAttributesSegmentRoutingPolicy object -func (obj *bgpAttributesSegmentRoutingPolicy) SetPolicyCandidateName(value BgpAttributesSrPolicyPolicyCandidateName) BgpAttributesSegmentRoutingPolicy { - - obj.policyCandidateNameHolder = nil - obj.obj.PolicyCandidateName = value.msg() - - return obj -} - -// description is TBD -// ExplicitNullLabelPolicy returns a BgpAttributesSrPolicyExplicitNullPolicy -func (obj *bgpAttributesSegmentRoutingPolicy) ExplicitNullLabelPolicy() BgpAttributesSrPolicyExplicitNullPolicy { - if obj.obj.ExplicitNullLabelPolicy == nil { - obj.obj.ExplicitNullLabelPolicy = NewBgpAttributesSrPolicyExplicitNullPolicy().msg() - } - if obj.explicitNullLabelPolicyHolder == nil { - obj.explicitNullLabelPolicyHolder = &bgpAttributesSrPolicyExplicitNullPolicy{obj: obj.obj.ExplicitNullLabelPolicy} - } - return obj.explicitNullLabelPolicyHolder -} - -// description is TBD -// ExplicitNullLabelPolicy returns a BgpAttributesSrPolicyExplicitNullPolicy -func (obj *bgpAttributesSegmentRoutingPolicy) HasExplicitNullLabelPolicy() bool { - return obj.obj.ExplicitNullLabelPolicy != nil -} - -// description is TBD -// SetExplicitNullLabelPolicy sets the BgpAttributesSrPolicyExplicitNullPolicy value in the BgpAttributesSegmentRoutingPolicy object -func (obj *bgpAttributesSegmentRoutingPolicy) SetExplicitNullLabelPolicy(value BgpAttributesSrPolicyExplicitNullPolicy) BgpAttributesSegmentRoutingPolicy { - - obj.explicitNullLabelPolicyHolder = nil - obj.obj.ExplicitNullLabelPolicy = value.msg() - - return obj -} - -// description is TBD -// SegmentList returns a []BgpAttributesSrPolicySegmentList -func (obj *bgpAttributesSegmentRoutingPolicy) SegmentList() BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { - if len(obj.obj.SegmentList) == 0 { - obj.obj.SegmentList = []*otg.BgpAttributesSrPolicySegmentList{} - } - if obj.segmentListHolder == nil { - obj.segmentListHolder = newBgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter(&obj.obj.SegmentList).setMsg(obj) - } - return obj.segmentListHolder -} - -type bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter struct { - obj *bgpAttributesSegmentRoutingPolicy - bgpAttributesSrPolicySegmentListSlice []BgpAttributesSrPolicySegmentList - fieldPtr *[]*otg.BgpAttributesSrPolicySegmentList -} - -func newBgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter(ptr *[]*otg.BgpAttributesSrPolicySegmentList) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { - return &bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter{fieldPtr: ptr} -} - -type BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter interface { - setMsg(*bgpAttributesSegmentRoutingPolicy) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter - Items() []BgpAttributesSrPolicySegmentList - Add() BgpAttributesSrPolicySegmentList - Append(items ...BgpAttributesSrPolicySegmentList) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter - Set(index int, newObj BgpAttributesSrPolicySegmentList) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter - Clear() BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter - clearHolderSlice() BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter - appendHolderSlice(item BgpAttributesSrPolicySegmentList) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter -} - -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) setMsg(msg *bgpAttributesSegmentRoutingPolicy) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpAttributesSrPolicySegmentList{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) Items() []BgpAttributesSrPolicySegmentList { - return obj.bgpAttributesSrPolicySegmentListSlice -} - -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) Add() BgpAttributesSrPolicySegmentList { - newObj := &otg.BgpAttributesSrPolicySegmentList{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpAttributesSrPolicySegmentList{obj: newObj} - newLibObj.setDefault() - obj.bgpAttributesSrPolicySegmentListSlice = append(obj.bgpAttributesSrPolicySegmentListSlice, newLibObj) - return newLibObj -} - -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) Append(items ...BgpAttributesSrPolicySegmentList) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpAttributesSrPolicySegmentListSlice = append(obj.bgpAttributesSrPolicySegmentListSlice, item) - } - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) Set(index int, newObj BgpAttributesSrPolicySegmentList) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpAttributesSrPolicySegmentListSlice[index] = newObj - return obj -} -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) Clear() BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpAttributesSrPolicySegmentList{} - obj.bgpAttributesSrPolicySegmentListSlice = []BgpAttributesSrPolicySegmentList{} - } - return obj -} -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) clearHolderSlice() BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { - if len(obj.bgpAttributesSrPolicySegmentListSlice) > 0 { - obj.bgpAttributesSrPolicySegmentListSlice = []BgpAttributesSrPolicySegmentList{} - } - return obj -} -func (obj *bgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter) appendHolderSlice(item BgpAttributesSrPolicySegmentList) BgpAttributesSegmentRoutingPolicyBgpAttributesSrPolicySegmentListIter { - obj.bgpAttributesSrPolicySegmentListSlice = append(obj.bgpAttributesSrPolicySegmentListSlice, item) - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicy) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.BindingSegmentIdentifier != nil { - - obj.BindingSegmentIdentifier().validateObj(vObj, set_default) - } - - if len(obj.obj.Srv6BindingSegmentIdentifier) != 0 { - - if set_default { - obj.Srv6BindingSegmentIdentifier().clearHolderSlice() - for _, item := range obj.obj.Srv6BindingSegmentIdentifier { - obj.Srv6BindingSegmentIdentifier().appendHolderSlice(&bgpAttributesSrv6Bsid{obj: item}) - } - } - for _, item := range obj.Srv6BindingSegmentIdentifier().Items() { - item.validateObj(vObj, set_default) - } - - } - - if obj.obj.Preference != nil { - - obj.Preference().validateObj(vObj, set_default) - } - - if obj.obj.Priority != nil { - - obj.Priority().validateObj(vObj, set_default) - } - - if obj.obj.PolicyName != nil { - - obj.PolicyName().validateObj(vObj, set_default) - } - - if obj.obj.PolicyCandidateName != nil { - - obj.PolicyCandidateName().validateObj(vObj, set_default) - } - - if obj.obj.ExplicitNullLabelPolicy != nil { - - obj.ExplicitNullLabelPolicy().validateObj(vObj, set_default) - } - - if len(obj.obj.SegmentList) != 0 { - - if set_default { - obj.SegmentList().clearHolderSlice() - for _, item := range obj.obj.SegmentList { - obj.SegmentList().appendHolderSlice(&bgpAttributesSrPolicySegmentList{obj: item}) - } - } - for _, item := range obj.SegmentList().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicy) setDefault() { - -} - -// ***** BgpOneIpv4NLRIPrefix ***** -type bgpOneIpv4NLRIPrefix struct { - validation - obj *otg.BgpOneIpv4NLRIPrefix - marshaller marshalBgpOneIpv4NLRIPrefix - unMarshaller unMarshalBgpOneIpv4NLRIPrefix - pathIdHolder BgpNLRIPrefixPathId -} - -func NewBgpOneIpv4NLRIPrefix() BgpOneIpv4NLRIPrefix { - obj := bgpOneIpv4NLRIPrefix{obj: &otg.BgpOneIpv4NLRIPrefix{}} - obj.setDefault() - return &obj -} - -func (obj *bgpOneIpv4NLRIPrefix) msg() *otg.BgpOneIpv4NLRIPrefix { - return obj.obj -} - -func (obj *bgpOneIpv4NLRIPrefix) setMsg(msg *otg.BgpOneIpv4NLRIPrefix) BgpOneIpv4NLRIPrefix { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpOneIpv4NLRIPrefix struct { - obj *bgpOneIpv4NLRIPrefix -} - -type marshalBgpOneIpv4NLRIPrefix interface { - // ToProto marshals BgpOneIpv4NLRIPrefix to protobuf object *otg.BgpOneIpv4NLRIPrefix - ToProto() (*otg.BgpOneIpv4NLRIPrefix, error) - // ToPbText marshals BgpOneIpv4NLRIPrefix to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpOneIpv4NLRIPrefix to YAML text - ToYaml() (string, error) - // ToJson marshals BgpOneIpv4NLRIPrefix to JSON text - ToJson() (string, error) -} - -type unMarshalbgpOneIpv4NLRIPrefix struct { - obj *bgpOneIpv4NLRIPrefix -} - -type unMarshalBgpOneIpv4NLRIPrefix interface { - // FromProto unmarshals BgpOneIpv4NLRIPrefix from protobuf object *otg.BgpOneIpv4NLRIPrefix - FromProto(msg *otg.BgpOneIpv4NLRIPrefix) (BgpOneIpv4NLRIPrefix, error) - // FromPbText unmarshals BgpOneIpv4NLRIPrefix from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpOneIpv4NLRIPrefix from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpOneIpv4NLRIPrefix from JSON text - FromJson(value string) error -} - -func (obj *bgpOneIpv4NLRIPrefix) Marshal() marshalBgpOneIpv4NLRIPrefix { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpOneIpv4NLRIPrefix{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpOneIpv4NLRIPrefix) Unmarshal() unMarshalBgpOneIpv4NLRIPrefix { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpOneIpv4NLRIPrefix{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpOneIpv4NLRIPrefix) ToProto() (*otg.BgpOneIpv4NLRIPrefix, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpOneIpv4NLRIPrefix) FromProto(msg *otg.BgpOneIpv4NLRIPrefix) (BgpOneIpv4NLRIPrefix, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpOneIpv4NLRIPrefix) 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 *unMarshalbgpOneIpv4NLRIPrefix) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpOneIpv4NLRIPrefix) 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 *unMarshalbgpOneIpv4NLRIPrefix) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpOneIpv4NLRIPrefix) 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 *unMarshalbgpOneIpv4NLRIPrefix) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpOneIpv4NLRIPrefix) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpOneIpv4NLRIPrefix) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpOneIpv4NLRIPrefix) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpOneIpv4NLRIPrefix) Clone() (BgpOneIpv4NLRIPrefix, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpOneIpv4NLRIPrefix() - 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 -} - -func (obj *bgpOneIpv4NLRIPrefix) setNil() { - obj.pathIdHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpOneIpv4NLRIPrefix is one IPv4 NLRI Prefix. -type BgpOneIpv4NLRIPrefix interface { - Validation - // msg marshals BgpOneIpv4NLRIPrefix to protobuf object *otg.BgpOneIpv4NLRIPrefix - // and doesn't set defaults - msg() *otg.BgpOneIpv4NLRIPrefix - // setMsg unmarshals BgpOneIpv4NLRIPrefix from protobuf object *otg.BgpOneIpv4NLRIPrefix - // and doesn't set defaults - setMsg(*otg.BgpOneIpv4NLRIPrefix) BgpOneIpv4NLRIPrefix - // provides marshal interface - Marshal() marshalBgpOneIpv4NLRIPrefix - // provides unmarshal interface - Unmarshal() unMarshalBgpOneIpv4NLRIPrefix - // validate validates BgpOneIpv4NLRIPrefix - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpOneIpv4NLRIPrefix, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Address returns string, set in BgpOneIpv4NLRIPrefix. - Address() string - // SetAddress assigns string provided by user to BgpOneIpv4NLRIPrefix - SetAddress(value string) BgpOneIpv4NLRIPrefix - // HasAddress checks if Address has been set in BgpOneIpv4NLRIPrefix - HasAddress() bool - // Prefix returns uint32, set in BgpOneIpv4NLRIPrefix. - Prefix() uint32 - // SetPrefix assigns uint32 provided by user to BgpOneIpv4NLRIPrefix - SetPrefix(value uint32) BgpOneIpv4NLRIPrefix - // HasPrefix checks if Prefix has been set in BgpOneIpv4NLRIPrefix - HasPrefix() bool - // PathId returns BgpNLRIPrefixPathId, set in BgpOneIpv4NLRIPrefix. - // BgpNLRIPrefixPathId is optional field in the NLRI carrying Path Id of the prefix. - PathId() BgpNLRIPrefixPathId - // SetPathId assigns BgpNLRIPrefixPathId provided by user to BgpOneIpv4NLRIPrefix. - // BgpNLRIPrefixPathId is optional field in the NLRI carrying Path Id of the prefix. - SetPathId(value BgpNLRIPrefixPathId) BgpOneIpv4NLRIPrefix - // HasPathId checks if PathId has been set in BgpOneIpv4NLRIPrefix - HasPathId() bool - setNil() -} - -// The IPv4 address of the network. -// Address returns a string -func (obj *bgpOneIpv4NLRIPrefix) Address() string { - - return *obj.obj.Address - -} - -// The IPv4 address of the network. -// Address returns a string -func (obj *bgpOneIpv4NLRIPrefix) HasAddress() bool { - return obj.obj.Address != nil -} - -// The IPv4 address of the network. -// SetAddress sets the string value in the BgpOneIpv4NLRIPrefix object -func (obj *bgpOneIpv4NLRIPrefix) SetAddress(value string) BgpOneIpv4NLRIPrefix { - - obj.obj.Address = &value - return obj -} - -// The IPv4 network prefix length to be applied to the address. -// Prefix returns a uint32 -func (obj *bgpOneIpv4NLRIPrefix) Prefix() uint32 { - - return *obj.obj.Prefix - -} - -// The IPv4 network prefix length to be applied to the address. -// Prefix returns a uint32 -func (obj *bgpOneIpv4NLRIPrefix) HasPrefix() bool { - return obj.obj.Prefix != nil -} - -// The IPv4 network prefix length to be applied to the address. -// SetPrefix sets the uint32 value in the BgpOneIpv4NLRIPrefix object -func (obj *bgpOneIpv4NLRIPrefix) SetPrefix(value uint32) BgpOneIpv4NLRIPrefix { - - obj.obj.Prefix = &value - return obj -} - -// description is TBD -// PathId returns a BgpNLRIPrefixPathId -func (obj *bgpOneIpv4NLRIPrefix) PathId() BgpNLRIPrefixPathId { - if obj.obj.PathId == nil { - obj.obj.PathId = NewBgpNLRIPrefixPathId().msg() - } - if obj.pathIdHolder == nil { - obj.pathIdHolder = &bgpNLRIPrefixPathId{obj: obj.obj.PathId} - } - return obj.pathIdHolder -} - -// description is TBD -// PathId returns a BgpNLRIPrefixPathId -func (obj *bgpOneIpv4NLRIPrefix) HasPathId() bool { - return obj.obj.PathId != nil -} - -// description is TBD -// SetPathId sets the BgpNLRIPrefixPathId value in the BgpOneIpv4NLRIPrefix object -func (obj *bgpOneIpv4NLRIPrefix) SetPathId(value BgpNLRIPrefixPathId) BgpOneIpv4NLRIPrefix { - - obj.pathIdHolder = nil - obj.obj.PathId = value.msg() - - return obj -} - -func (obj *bgpOneIpv4NLRIPrefix) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Address != nil { - - err := obj.validateIpv4(obj.Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpOneIpv4NLRIPrefix.Address")) - } - - } - - if obj.obj.Prefix != nil { - - if *obj.obj.Prefix > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpOneIpv4NLRIPrefix.Prefix <= 32 but Got %d", *obj.obj.Prefix)) - } - - } - - if obj.obj.PathId != nil { - - obj.PathId().validateObj(vObj, set_default) - } - -} - -func (obj *bgpOneIpv4NLRIPrefix) setDefault() { - if obj.obj.Address == nil { - obj.SetAddress("0.0.0.0") - } - if obj.obj.Prefix == nil { - obj.SetPrefix(24) - } - -} - -// ***** BgpOneIpv6NLRIPrefix ***** -type bgpOneIpv6NLRIPrefix struct { - validation - obj *otg.BgpOneIpv6NLRIPrefix - marshaller marshalBgpOneIpv6NLRIPrefix - unMarshaller unMarshalBgpOneIpv6NLRIPrefix - pathIdHolder BgpNLRIPrefixPathId -} - -func NewBgpOneIpv6NLRIPrefix() BgpOneIpv6NLRIPrefix { - obj := bgpOneIpv6NLRIPrefix{obj: &otg.BgpOneIpv6NLRIPrefix{}} - obj.setDefault() - return &obj -} - -func (obj *bgpOneIpv6NLRIPrefix) msg() *otg.BgpOneIpv6NLRIPrefix { - return obj.obj -} - -func (obj *bgpOneIpv6NLRIPrefix) setMsg(msg *otg.BgpOneIpv6NLRIPrefix) BgpOneIpv6NLRIPrefix { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpOneIpv6NLRIPrefix struct { - obj *bgpOneIpv6NLRIPrefix -} - -type marshalBgpOneIpv6NLRIPrefix interface { - // ToProto marshals BgpOneIpv6NLRIPrefix to protobuf object *otg.BgpOneIpv6NLRIPrefix - ToProto() (*otg.BgpOneIpv6NLRIPrefix, error) - // ToPbText marshals BgpOneIpv6NLRIPrefix to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpOneIpv6NLRIPrefix to YAML text - ToYaml() (string, error) - // ToJson marshals BgpOneIpv6NLRIPrefix to JSON text - ToJson() (string, error) -} - -type unMarshalbgpOneIpv6NLRIPrefix struct { - obj *bgpOneIpv6NLRIPrefix -} - -type unMarshalBgpOneIpv6NLRIPrefix interface { - // FromProto unmarshals BgpOneIpv6NLRIPrefix from protobuf object *otg.BgpOneIpv6NLRIPrefix - FromProto(msg *otg.BgpOneIpv6NLRIPrefix) (BgpOneIpv6NLRIPrefix, error) - // FromPbText unmarshals BgpOneIpv6NLRIPrefix from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpOneIpv6NLRIPrefix from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpOneIpv6NLRIPrefix from JSON text - FromJson(value string) error -} - -func (obj *bgpOneIpv6NLRIPrefix) Marshal() marshalBgpOneIpv6NLRIPrefix { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpOneIpv6NLRIPrefix{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpOneIpv6NLRIPrefix) Unmarshal() unMarshalBgpOneIpv6NLRIPrefix { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpOneIpv6NLRIPrefix{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpOneIpv6NLRIPrefix) ToProto() (*otg.BgpOneIpv6NLRIPrefix, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpOneIpv6NLRIPrefix) FromProto(msg *otg.BgpOneIpv6NLRIPrefix) (BgpOneIpv6NLRIPrefix, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpOneIpv6NLRIPrefix) 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 *unMarshalbgpOneIpv6NLRIPrefix) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpOneIpv6NLRIPrefix) 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 *unMarshalbgpOneIpv6NLRIPrefix) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpOneIpv6NLRIPrefix) 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 *unMarshalbgpOneIpv6NLRIPrefix) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpOneIpv6NLRIPrefix) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpOneIpv6NLRIPrefix) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpOneIpv6NLRIPrefix) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpOneIpv6NLRIPrefix) Clone() (BgpOneIpv6NLRIPrefix, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpOneIpv6NLRIPrefix() - 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 -} - -func (obj *bgpOneIpv6NLRIPrefix) setNil() { - obj.pathIdHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpOneIpv6NLRIPrefix is one IPv6 NLRI Prefix. -type BgpOneIpv6NLRIPrefix interface { - Validation - // msg marshals BgpOneIpv6NLRIPrefix to protobuf object *otg.BgpOneIpv6NLRIPrefix - // and doesn't set defaults - msg() *otg.BgpOneIpv6NLRIPrefix - // setMsg unmarshals BgpOneIpv6NLRIPrefix from protobuf object *otg.BgpOneIpv6NLRIPrefix - // and doesn't set defaults - setMsg(*otg.BgpOneIpv6NLRIPrefix) BgpOneIpv6NLRIPrefix - // provides marshal interface - Marshal() marshalBgpOneIpv6NLRIPrefix - // provides unmarshal interface - Unmarshal() unMarshalBgpOneIpv6NLRIPrefix - // validate validates BgpOneIpv6NLRIPrefix - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpOneIpv6NLRIPrefix, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Address returns string, set in BgpOneIpv6NLRIPrefix. - Address() string - // SetAddress assigns string provided by user to BgpOneIpv6NLRIPrefix - SetAddress(value string) BgpOneIpv6NLRIPrefix - // HasAddress checks if Address has been set in BgpOneIpv6NLRIPrefix - HasAddress() bool - // Prefix returns uint32, set in BgpOneIpv6NLRIPrefix. - Prefix() uint32 - // SetPrefix assigns uint32 provided by user to BgpOneIpv6NLRIPrefix - SetPrefix(value uint32) BgpOneIpv6NLRIPrefix - // HasPrefix checks if Prefix has been set in BgpOneIpv6NLRIPrefix - HasPrefix() bool - // PathId returns BgpNLRIPrefixPathId, set in BgpOneIpv6NLRIPrefix. - // BgpNLRIPrefixPathId is optional field in the NLRI carrying Path Id of the prefix. - PathId() BgpNLRIPrefixPathId - // SetPathId assigns BgpNLRIPrefixPathId provided by user to BgpOneIpv6NLRIPrefix. - // BgpNLRIPrefixPathId is optional field in the NLRI carrying Path Id of the prefix. - SetPathId(value BgpNLRIPrefixPathId) BgpOneIpv6NLRIPrefix - // HasPathId checks if PathId has been set in BgpOneIpv6NLRIPrefix - HasPathId() bool - setNil() -} - -// The IPv6 address of the network. -// Address returns a string -func (obj *bgpOneIpv6NLRIPrefix) Address() string { - - return *obj.obj.Address - -} - -// The IPv6 address of the network. -// Address returns a string -func (obj *bgpOneIpv6NLRIPrefix) HasAddress() bool { - return obj.obj.Address != nil -} - -// The IPv6 address of the network. -// SetAddress sets the string value in the BgpOneIpv6NLRIPrefix object -func (obj *bgpOneIpv6NLRIPrefix) SetAddress(value string) BgpOneIpv6NLRIPrefix { - - obj.obj.Address = &value - return obj -} - -// The IPv6 network prefix length to be applied to the address. -// Prefix returns a uint32 -func (obj *bgpOneIpv6NLRIPrefix) Prefix() uint32 { - - return *obj.obj.Prefix - -} - -// The IPv6 network prefix length to be applied to the address. -// Prefix returns a uint32 -func (obj *bgpOneIpv6NLRIPrefix) HasPrefix() bool { - return obj.obj.Prefix != nil -} - -// The IPv6 network prefix length to be applied to the address. -// SetPrefix sets the uint32 value in the BgpOneIpv6NLRIPrefix object -func (obj *bgpOneIpv6NLRIPrefix) SetPrefix(value uint32) BgpOneIpv6NLRIPrefix { - - obj.obj.Prefix = &value - return obj -} - -// description is TBD -// PathId returns a BgpNLRIPrefixPathId -func (obj *bgpOneIpv6NLRIPrefix) PathId() BgpNLRIPrefixPathId { - if obj.obj.PathId == nil { - obj.obj.PathId = NewBgpNLRIPrefixPathId().msg() - } - if obj.pathIdHolder == nil { - obj.pathIdHolder = &bgpNLRIPrefixPathId{obj: obj.obj.PathId} - } - return obj.pathIdHolder -} - -// description is TBD -// PathId returns a BgpNLRIPrefixPathId -func (obj *bgpOneIpv6NLRIPrefix) HasPathId() bool { - return obj.obj.PathId != nil -} - -// description is TBD -// SetPathId sets the BgpNLRIPrefixPathId value in the BgpOneIpv6NLRIPrefix object -func (obj *bgpOneIpv6NLRIPrefix) SetPathId(value BgpNLRIPrefixPathId) BgpOneIpv6NLRIPrefix { - - obj.pathIdHolder = nil - obj.obj.PathId = value.msg() - - return obj -} - -func (obj *bgpOneIpv6NLRIPrefix) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Address != nil { - - err := obj.validateIpv6(obj.Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpOneIpv6NLRIPrefix.Address")) - } - - } - - if obj.obj.Prefix != nil { - - if *obj.obj.Prefix > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpOneIpv6NLRIPrefix.Prefix <= 128 but Got %d", *obj.obj.Prefix)) - } - - } - - if obj.obj.PathId != nil { - - obj.PathId().validateObj(vObj, set_default) - } - -} - -func (obj *bgpOneIpv6NLRIPrefix) setDefault() { - if obj.obj.Address == nil { - obj.SetAddress("0::0") - } - if obj.obj.Prefix == nil { - obj.SetPrefix(64) - } - -} - -// ***** BgpIpv4SrPolicyNLRIPrefix ***** -type bgpIpv4SrPolicyNLRIPrefix struct { - validation - obj *otg.BgpIpv4SrPolicyNLRIPrefix - marshaller marshalBgpIpv4SrPolicyNLRIPrefix - unMarshaller unMarshalBgpIpv4SrPolicyNLRIPrefix -} - -func NewBgpIpv4SrPolicyNLRIPrefix() BgpIpv4SrPolicyNLRIPrefix { - obj := bgpIpv4SrPolicyNLRIPrefix{obj: &otg.BgpIpv4SrPolicyNLRIPrefix{}} - obj.setDefault() - return &obj -} - -func (obj *bgpIpv4SrPolicyNLRIPrefix) msg() *otg.BgpIpv4SrPolicyNLRIPrefix { - return obj.obj -} - -func (obj *bgpIpv4SrPolicyNLRIPrefix) setMsg(msg *otg.BgpIpv4SrPolicyNLRIPrefix) BgpIpv4SrPolicyNLRIPrefix { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpIpv4SrPolicyNLRIPrefix struct { - obj *bgpIpv4SrPolicyNLRIPrefix -} - -type marshalBgpIpv4SrPolicyNLRIPrefix interface { - // ToProto marshals BgpIpv4SrPolicyNLRIPrefix to protobuf object *otg.BgpIpv4SrPolicyNLRIPrefix - ToProto() (*otg.BgpIpv4SrPolicyNLRIPrefix, error) - // ToPbText marshals BgpIpv4SrPolicyNLRIPrefix to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpIpv4SrPolicyNLRIPrefix to YAML text - ToYaml() (string, error) - // ToJson marshals BgpIpv4SrPolicyNLRIPrefix to JSON text - ToJson() (string, error) -} - -type unMarshalbgpIpv4SrPolicyNLRIPrefix struct { - obj *bgpIpv4SrPolicyNLRIPrefix -} - -type unMarshalBgpIpv4SrPolicyNLRIPrefix interface { - // FromProto unmarshals BgpIpv4SrPolicyNLRIPrefix from protobuf object *otg.BgpIpv4SrPolicyNLRIPrefix - FromProto(msg *otg.BgpIpv4SrPolicyNLRIPrefix) (BgpIpv4SrPolicyNLRIPrefix, error) - // FromPbText unmarshals BgpIpv4SrPolicyNLRIPrefix from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpIpv4SrPolicyNLRIPrefix from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpIpv4SrPolicyNLRIPrefix from JSON text - FromJson(value string) error -} - -func (obj *bgpIpv4SrPolicyNLRIPrefix) Marshal() marshalBgpIpv4SrPolicyNLRIPrefix { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpIpv4SrPolicyNLRIPrefix{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpIpv4SrPolicyNLRIPrefix) Unmarshal() unMarshalBgpIpv4SrPolicyNLRIPrefix { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpIpv4SrPolicyNLRIPrefix{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpIpv4SrPolicyNLRIPrefix) ToProto() (*otg.BgpIpv4SrPolicyNLRIPrefix, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpIpv4SrPolicyNLRIPrefix) FromProto(msg *otg.BgpIpv4SrPolicyNLRIPrefix) (BgpIpv4SrPolicyNLRIPrefix, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpIpv4SrPolicyNLRIPrefix) 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 *unMarshalbgpIpv4SrPolicyNLRIPrefix) 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 *marshalbgpIpv4SrPolicyNLRIPrefix) 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 *unMarshalbgpIpv4SrPolicyNLRIPrefix) 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 *marshalbgpIpv4SrPolicyNLRIPrefix) 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 *unMarshalbgpIpv4SrPolicyNLRIPrefix) 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 *bgpIpv4SrPolicyNLRIPrefix) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpIpv4SrPolicyNLRIPrefix) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpIpv4SrPolicyNLRIPrefix) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpIpv4SrPolicyNLRIPrefix) Clone() (BgpIpv4SrPolicyNLRIPrefix, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpIpv4SrPolicyNLRIPrefix() - 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 -} - -// BgpIpv4SrPolicyNLRIPrefix is iPv4 Segment Routing Policy NLRI Prefix. -type BgpIpv4SrPolicyNLRIPrefix interface { - Validation - // msg marshals BgpIpv4SrPolicyNLRIPrefix to protobuf object *otg.BgpIpv4SrPolicyNLRIPrefix - // and doesn't set defaults - msg() *otg.BgpIpv4SrPolicyNLRIPrefix - // setMsg unmarshals BgpIpv4SrPolicyNLRIPrefix from protobuf object *otg.BgpIpv4SrPolicyNLRIPrefix - // and doesn't set defaults - setMsg(*otg.BgpIpv4SrPolicyNLRIPrefix) BgpIpv4SrPolicyNLRIPrefix - // provides marshal interface - Marshal() marshalBgpIpv4SrPolicyNLRIPrefix - // provides unmarshal interface - Unmarshal() unMarshalBgpIpv4SrPolicyNLRIPrefix - // validate validates BgpIpv4SrPolicyNLRIPrefix - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpIpv4SrPolicyNLRIPrefix, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Distinguisher returns uint32, set in BgpIpv4SrPolicyNLRIPrefix. - Distinguisher() uint32 - // SetDistinguisher assigns uint32 provided by user to BgpIpv4SrPolicyNLRIPrefix - SetDistinguisher(value uint32) BgpIpv4SrPolicyNLRIPrefix - // HasDistinguisher checks if Distinguisher has been set in BgpIpv4SrPolicyNLRIPrefix - HasDistinguisher() bool - // Color returns uint32, set in BgpIpv4SrPolicyNLRIPrefix. - Color() uint32 - // SetColor assigns uint32 provided by user to BgpIpv4SrPolicyNLRIPrefix - SetColor(value uint32) BgpIpv4SrPolicyNLRIPrefix - // HasColor checks if Color has been set in BgpIpv4SrPolicyNLRIPrefix - HasColor() bool - // Endpoint returns string, set in BgpIpv4SrPolicyNLRIPrefix. - Endpoint() string - // SetEndpoint assigns string provided by user to BgpIpv4SrPolicyNLRIPrefix - SetEndpoint(value string) BgpIpv4SrPolicyNLRIPrefix - // HasEndpoint checks if Endpoint has been set in BgpIpv4SrPolicyNLRIPrefix - HasEndpoint() bool -} - -// The 4-octet value uniquely identifying the policy in the context of tuple. The distinguisher has no semantic value and is solely used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment lists) with the same Color and Endpoint but meant for different headends. -// Distinguisher returns a uint32 -func (obj *bgpIpv4SrPolicyNLRIPrefix) Distinguisher() uint32 { - - return *obj.obj.Distinguisher - -} - -// The 4-octet value uniquely identifying the policy in the context of tuple. The distinguisher has no semantic value and is solely used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment lists) with the same Color and Endpoint but meant for different headends. -// Distinguisher returns a uint32 -func (obj *bgpIpv4SrPolicyNLRIPrefix) HasDistinguisher() bool { - return obj.obj.Distinguisher != nil -} - -// The 4-octet value uniquely identifying the policy in the context of tuple. The distinguisher has no semantic value and is solely used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment lists) with the same Color and Endpoint but meant for different headends. -// SetDistinguisher sets the uint32 value in the BgpIpv4SrPolicyNLRIPrefix object -func (obj *bgpIpv4SrPolicyNLRIPrefix) SetDistinguisher(value uint32) BgpIpv4SrPolicyNLRIPrefix { - - obj.obj.Distinguisher = &value - return obj -} - -// 4-octet value identifying (with the endpoint) the policy. The color is used to match the color of the destination prefixes to steer traffic into the SR Policy as specified in section 8 of RFC9256. -// Color returns a uint32 -func (obj *bgpIpv4SrPolicyNLRIPrefix) Color() uint32 { - - return *obj.obj.Color - -} - -// 4-octet value identifying (with the endpoint) the policy. The color is used to match the color of the destination prefixes to steer traffic into the SR Policy as specified in section 8 of RFC9256. -// Color returns a uint32 -func (obj *bgpIpv4SrPolicyNLRIPrefix) HasColor() bool { - return obj.obj.Color != nil -} - -// 4-octet value identifying (with the endpoint) the policy. The color is used to match the color of the destination prefixes to steer traffic into the SR Policy as specified in section 8 of RFC9256. -// SetColor sets the uint32 value in the BgpIpv4SrPolicyNLRIPrefix object -func (obj *bgpIpv4SrPolicyNLRIPrefix) SetColor(value uint32) BgpIpv4SrPolicyNLRIPrefix { - - obj.obj.Color = &value - return obj -} - -// Identifies the endpoint of a policy. The Endpoint is an IPv4 address and can be either a unicast or an unspecified address (0.0.0.0) as specified in section 2.1 of RFC9256. -// Endpoint returns a string -func (obj *bgpIpv4SrPolicyNLRIPrefix) Endpoint() string { - - return *obj.obj.Endpoint - -} - -// Identifies the endpoint of a policy. The Endpoint is an IPv4 address and can be either a unicast or an unspecified address (0.0.0.0) as specified in section 2.1 of RFC9256. -// Endpoint returns a string -func (obj *bgpIpv4SrPolicyNLRIPrefix) HasEndpoint() bool { - return obj.obj.Endpoint != nil -} - -// Identifies the endpoint of a policy. The Endpoint is an IPv4 address and can be either a unicast or an unspecified address (0.0.0.0) as specified in section 2.1 of RFC9256. -// SetEndpoint sets the string value in the BgpIpv4SrPolicyNLRIPrefix object -func (obj *bgpIpv4SrPolicyNLRIPrefix) SetEndpoint(value string) BgpIpv4SrPolicyNLRIPrefix { - - obj.obj.Endpoint = &value - return obj -} - -func (obj *bgpIpv4SrPolicyNLRIPrefix) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Endpoint != nil { - - err := obj.validateIpv4(obj.Endpoint()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpIpv4SrPolicyNLRIPrefix.Endpoint")) - } - - } - -} - -func (obj *bgpIpv4SrPolicyNLRIPrefix) setDefault() { - if obj.obj.Distinguisher == nil { - obj.SetDistinguisher(1) - } - if obj.obj.Color == nil { - obj.SetColor(1) - } - if obj.obj.Endpoint == nil { - obj.SetEndpoint("0.0.0.0") - } - -} - -// ***** BgpIpv6SrPolicyNLRIPrefix ***** -type bgpIpv6SrPolicyNLRIPrefix struct { - validation - obj *otg.BgpIpv6SrPolicyNLRIPrefix - marshaller marshalBgpIpv6SrPolicyNLRIPrefix - unMarshaller unMarshalBgpIpv6SrPolicyNLRIPrefix -} - -func NewBgpIpv6SrPolicyNLRIPrefix() BgpIpv6SrPolicyNLRIPrefix { - obj := bgpIpv6SrPolicyNLRIPrefix{obj: &otg.BgpIpv6SrPolicyNLRIPrefix{}} - obj.setDefault() - return &obj -} - -func (obj *bgpIpv6SrPolicyNLRIPrefix) msg() *otg.BgpIpv6SrPolicyNLRIPrefix { - return obj.obj -} - -func (obj *bgpIpv6SrPolicyNLRIPrefix) setMsg(msg *otg.BgpIpv6SrPolicyNLRIPrefix) BgpIpv6SrPolicyNLRIPrefix { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpIpv6SrPolicyNLRIPrefix struct { - obj *bgpIpv6SrPolicyNLRIPrefix -} - -type marshalBgpIpv6SrPolicyNLRIPrefix interface { - // ToProto marshals BgpIpv6SrPolicyNLRIPrefix to protobuf object *otg.BgpIpv6SrPolicyNLRIPrefix - ToProto() (*otg.BgpIpv6SrPolicyNLRIPrefix, error) - // ToPbText marshals BgpIpv6SrPolicyNLRIPrefix to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpIpv6SrPolicyNLRIPrefix to YAML text - ToYaml() (string, error) - // ToJson marshals BgpIpv6SrPolicyNLRIPrefix to JSON text - ToJson() (string, error) -} - -type unMarshalbgpIpv6SrPolicyNLRIPrefix struct { - obj *bgpIpv6SrPolicyNLRIPrefix -} - -type unMarshalBgpIpv6SrPolicyNLRIPrefix interface { - // FromProto unmarshals BgpIpv6SrPolicyNLRIPrefix from protobuf object *otg.BgpIpv6SrPolicyNLRIPrefix - FromProto(msg *otg.BgpIpv6SrPolicyNLRIPrefix) (BgpIpv6SrPolicyNLRIPrefix, error) - // FromPbText unmarshals BgpIpv6SrPolicyNLRIPrefix from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpIpv6SrPolicyNLRIPrefix from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpIpv6SrPolicyNLRIPrefix from JSON text - FromJson(value string) error -} - -func (obj *bgpIpv6SrPolicyNLRIPrefix) Marshal() marshalBgpIpv6SrPolicyNLRIPrefix { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpIpv6SrPolicyNLRIPrefix{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpIpv6SrPolicyNLRIPrefix) Unmarshal() unMarshalBgpIpv6SrPolicyNLRIPrefix { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpIpv6SrPolicyNLRIPrefix{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpIpv6SrPolicyNLRIPrefix) ToProto() (*otg.BgpIpv6SrPolicyNLRIPrefix, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpIpv6SrPolicyNLRIPrefix) FromProto(msg *otg.BgpIpv6SrPolicyNLRIPrefix) (BgpIpv6SrPolicyNLRIPrefix, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpIpv6SrPolicyNLRIPrefix) 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 *unMarshalbgpIpv6SrPolicyNLRIPrefix) 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 *marshalbgpIpv6SrPolicyNLRIPrefix) 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 *unMarshalbgpIpv6SrPolicyNLRIPrefix) 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 *marshalbgpIpv6SrPolicyNLRIPrefix) 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 *unMarshalbgpIpv6SrPolicyNLRIPrefix) 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 *bgpIpv6SrPolicyNLRIPrefix) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpIpv6SrPolicyNLRIPrefix) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpIpv6SrPolicyNLRIPrefix) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpIpv6SrPolicyNLRIPrefix) Clone() (BgpIpv6SrPolicyNLRIPrefix, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpIpv6SrPolicyNLRIPrefix() - 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 -} - -// BgpIpv6SrPolicyNLRIPrefix is one IPv6 Segment Routing Policy NLRI Prefix. -type BgpIpv6SrPolicyNLRIPrefix interface { - Validation - // msg marshals BgpIpv6SrPolicyNLRIPrefix to protobuf object *otg.BgpIpv6SrPolicyNLRIPrefix - // and doesn't set defaults - msg() *otg.BgpIpv6SrPolicyNLRIPrefix - // setMsg unmarshals BgpIpv6SrPolicyNLRIPrefix from protobuf object *otg.BgpIpv6SrPolicyNLRIPrefix - // and doesn't set defaults - setMsg(*otg.BgpIpv6SrPolicyNLRIPrefix) BgpIpv6SrPolicyNLRIPrefix - // provides marshal interface - Marshal() marshalBgpIpv6SrPolicyNLRIPrefix - // provides unmarshal interface - Unmarshal() unMarshalBgpIpv6SrPolicyNLRIPrefix - // validate validates BgpIpv6SrPolicyNLRIPrefix - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpIpv6SrPolicyNLRIPrefix, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Distinguisher returns uint32, set in BgpIpv6SrPolicyNLRIPrefix. - Distinguisher() uint32 - // SetDistinguisher assigns uint32 provided by user to BgpIpv6SrPolicyNLRIPrefix - SetDistinguisher(value uint32) BgpIpv6SrPolicyNLRIPrefix - // HasDistinguisher checks if Distinguisher has been set in BgpIpv6SrPolicyNLRIPrefix - HasDistinguisher() bool - // Color returns uint32, set in BgpIpv6SrPolicyNLRIPrefix. - Color() uint32 - // SetColor assigns uint32 provided by user to BgpIpv6SrPolicyNLRIPrefix - SetColor(value uint32) BgpIpv6SrPolicyNLRIPrefix - // HasColor checks if Color has been set in BgpIpv6SrPolicyNLRIPrefix - HasColor() bool - // Endpoint returns string, set in BgpIpv6SrPolicyNLRIPrefix. - Endpoint() string - // SetEndpoint assigns string provided by user to BgpIpv6SrPolicyNLRIPrefix - SetEndpoint(value string) BgpIpv6SrPolicyNLRIPrefix - // HasEndpoint checks if Endpoint has been set in BgpIpv6SrPolicyNLRIPrefix - HasEndpoint() bool -} - -// The 4-octet value uniquely identifying the policy in the context of tuple. The distinguisher has no semantic value and is solely used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment lists) with the same Color and Endpoint but meant for different headends. -// Distinguisher returns a uint32 -func (obj *bgpIpv6SrPolicyNLRIPrefix) Distinguisher() uint32 { - - return *obj.obj.Distinguisher - -} - -// The 4-octet value uniquely identifying the policy in the context of tuple. The distinguisher has no semantic value and is solely used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment lists) with the same Color and Endpoint but meant for different headends. -// Distinguisher returns a uint32 -func (obj *bgpIpv6SrPolicyNLRIPrefix) HasDistinguisher() bool { - return obj.obj.Distinguisher != nil -} - -// The 4-octet value uniquely identifying the policy in the context of tuple. The distinguisher has no semantic value and is solely used by the SR Policy originator to make unique (from an NLRI perspective) both for multiple candidate paths of the same SR Policy as well as candidate paths of different SR Policies (i.e. with different segment lists) with the same Color and Endpoint but meant for different headends. -// SetDistinguisher sets the uint32 value in the BgpIpv6SrPolicyNLRIPrefix object -func (obj *bgpIpv6SrPolicyNLRIPrefix) SetDistinguisher(value uint32) BgpIpv6SrPolicyNLRIPrefix { - - obj.obj.Distinguisher = &value - return obj -} - -// 4-octet value identifying (with the endpoint) the policy. The color is used to match the color of the destination prefixes to steer traffic into the SR Policy as specified in section 8 of RFC9256. -// Color returns a uint32 -func (obj *bgpIpv6SrPolicyNLRIPrefix) Color() uint32 { - - return *obj.obj.Color - -} - -// 4-octet value identifying (with the endpoint) the policy. The color is used to match the color of the destination prefixes to steer traffic into the SR Policy as specified in section 8 of RFC9256. -// Color returns a uint32 -func (obj *bgpIpv6SrPolicyNLRIPrefix) HasColor() bool { - return obj.obj.Color != nil -} - -// 4-octet value identifying (with the endpoint) the policy. The color is used to match the color of the destination prefixes to steer traffic into the SR Policy as specified in section 8 of RFC9256. -// SetColor sets the uint32 value in the BgpIpv6SrPolicyNLRIPrefix object -func (obj *bgpIpv6SrPolicyNLRIPrefix) SetColor(value uint32) BgpIpv6SrPolicyNLRIPrefix { - - obj.obj.Color = &value - return obj -} - -// Identifies the endpoint of a policy. The Endpoint may represent a single node or a set of nodes (e.g., an anycast address). The Endpoint is an IPv6 address and can be either a unicast or an unspecified address (0::0) as specified in section 2.1 of RFC9256. -// Endpoint returns a string -func (obj *bgpIpv6SrPolicyNLRIPrefix) Endpoint() string { - - return *obj.obj.Endpoint - -} - -// Identifies the endpoint of a policy. The Endpoint may represent a single node or a set of nodes (e.g., an anycast address). The Endpoint is an IPv6 address and can be either a unicast or an unspecified address (0::0) as specified in section 2.1 of RFC9256. -// Endpoint returns a string -func (obj *bgpIpv6SrPolicyNLRIPrefix) HasEndpoint() bool { - return obj.obj.Endpoint != nil -} - -// Identifies the endpoint of a policy. The Endpoint may represent a single node or a set of nodes (e.g., an anycast address). The Endpoint is an IPv6 address and can be either a unicast or an unspecified address (0::0) as specified in section 2.1 of RFC9256. -// SetEndpoint sets the string value in the BgpIpv6SrPolicyNLRIPrefix object -func (obj *bgpIpv6SrPolicyNLRIPrefix) SetEndpoint(value string) BgpIpv6SrPolicyNLRIPrefix { - - obj.obj.Endpoint = &value - return obj -} - -func (obj *bgpIpv6SrPolicyNLRIPrefix) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Endpoint != nil { - - err := obj.validateIpv6(obj.Endpoint()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpIpv6SrPolicyNLRIPrefix.Endpoint")) - } - - } - -} - -func (obj *bgpIpv6SrPolicyNLRIPrefix) setDefault() { - if obj.obj.Distinguisher == nil { - obj.SetDistinguisher(1) - } - if obj.obj.Color == nil { - obj.SetColor(1) - } - if obj.obj.Endpoint == nil { - obj.SetEndpoint("0::0") - } - -} - -// ***** FlowRSVPPathSessionLspTunnelIpv4 ***** -type flowRSVPPathSessionLspTunnelIpv4 struct { - validation - obj *otg.FlowRSVPPathSessionLspTunnelIpv4 - marshaller marshalFlowRSVPPathSessionLspTunnelIpv4 - unMarshaller unMarshalFlowRSVPPathSessionLspTunnelIpv4 - ipv4TunnelEndPointAddressHolder PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - reservedHolder PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - tunnelIdHolder PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - extendedTunnelIdHolder FlowRSVPPathSessionExtTunnelId -} - -func NewFlowRSVPPathSessionLspTunnelIpv4() FlowRSVPPathSessionLspTunnelIpv4 { - obj := flowRSVPPathSessionLspTunnelIpv4{obj: &otg.FlowRSVPPathSessionLspTunnelIpv4{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathSessionLspTunnelIpv4) msg() *otg.FlowRSVPPathSessionLspTunnelIpv4 { - return obj.obj -} - -func (obj *flowRSVPPathSessionLspTunnelIpv4) setMsg(msg *otg.FlowRSVPPathSessionLspTunnelIpv4) FlowRSVPPathSessionLspTunnelIpv4 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathSessionLspTunnelIpv4 struct { - obj *flowRSVPPathSessionLspTunnelIpv4 -} - -type marshalFlowRSVPPathSessionLspTunnelIpv4 interface { - // ToProto marshals FlowRSVPPathSessionLspTunnelIpv4 to protobuf object *otg.FlowRSVPPathSessionLspTunnelIpv4 - ToProto() (*otg.FlowRSVPPathSessionLspTunnelIpv4, error) - // ToPbText marshals FlowRSVPPathSessionLspTunnelIpv4 to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathSessionLspTunnelIpv4 to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathSessionLspTunnelIpv4 to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathSessionLspTunnelIpv4 struct { - obj *flowRSVPPathSessionLspTunnelIpv4 -} - -type unMarshalFlowRSVPPathSessionLspTunnelIpv4 interface { - // FromProto unmarshals FlowRSVPPathSessionLspTunnelIpv4 from protobuf object *otg.FlowRSVPPathSessionLspTunnelIpv4 - FromProto(msg *otg.FlowRSVPPathSessionLspTunnelIpv4) (FlowRSVPPathSessionLspTunnelIpv4, error) - // FromPbText unmarshals FlowRSVPPathSessionLspTunnelIpv4 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathSessionLspTunnelIpv4 from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathSessionLspTunnelIpv4 from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathSessionLspTunnelIpv4) Marshal() marshalFlowRSVPPathSessionLspTunnelIpv4 { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathSessionLspTunnelIpv4{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathSessionLspTunnelIpv4) Unmarshal() unMarshalFlowRSVPPathSessionLspTunnelIpv4 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathSessionLspTunnelIpv4{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathSessionLspTunnelIpv4) ToProto() (*otg.FlowRSVPPathSessionLspTunnelIpv4, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathSessionLspTunnelIpv4) FromProto(msg *otg.FlowRSVPPathSessionLspTunnelIpv4) (FlowRSVPPathSessionLspTunnelIpv4, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathSessionLspTunnelIpv4) 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 *unMarshalflowRSVPPathSessionLspTunnelIpv4) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathSessionLspTunnelIpv4) 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 *unMarshalflowRSVPPathSessionLspTunnelIpv4) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathSessionLspTunnelIpv4) 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 *unMarshalflowRSVPPathSessionLspTunnelIpv4) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathSessionLspTunnelIpv4) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathSessionLspTunnelIpv4) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathSessionLspTunnelIpv4) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathSessionLspTunnelIpv4) Clone() (FlowRSVPPathSessionLspTunnelIpv4, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathSessionLspTunnelIpv4() - 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 -} - -func (obj *flowRSVPPathSessionLspTunnelIpv4) setNil() { - obj.ipv4TunnelEndPointAddressHolder = nil - obj.reservedHolder = nil - obj.tunnelIdHolder = nil - obj.extendedTunnelIdHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathSessionLspTunnelIpv4 is class = SESSION, LSP_TUNNEL_IPv4 C-Type = 7. -type FlowRSVPPathSessionLspTunnelIpv4 interface { - Validation - // msg marshals FlowRSVPPathSessionLspTunnelIpv4 to protobuf object *otg.FlowRSVPPathSessionLspTunnelIpv4 - // and doesn't set defaults - msg() *otg.FlowRSVPPathSessionLspTunnelIpv4 - // setMsg unmarshals FlowRSVPPathSessionLspTunnelIpv4 from protobuf object *otg.FlowRSVPPathSessionLspTunnelIpv4 - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathSessionLspTunnelIpv4) FlowRSVPPathSessionLspTunnelIpv4 - // provides marshal interface - Marshal() marshalFlowRSVPPathSessionLspTunnelIpv4 - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathSessionLspTunnelIpv4 - // validate validates FlowRSVPPathSessionLspTunnelIpv4 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathSessionLspTunnelIpv4, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv4TunnelEndPointAddress returns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress, set in FlowRSVPPathSessionLspTunnelIpv4. - // PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress is iPv4 address of the egress node for the tunnel. - Ipv4TunnelEndPointAddress() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - // SetIpv4TunnelEndPointAddress assigns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress provided by user to FlowRSVPPathSessionLspTunnelIpv4. - // PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress is iPv4 address of the egress node for the tunnel. - SetIpv4TunnelEndPointAddress(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) FlowRSVPPathSessionLspTunnelIpv4 - // HasIpv4TunnelEndPointAddress checks if Ipv4TunnelEndPointAddress has been set in FlowRSVPPathSessionLspTunnelIpv4 - HasIpv4TunnelEndPointAddress() bool - // Reserved returns PatternFlowRSVPPathSessionLspTunnelIpv4Reserved, set in FlowRSVPPathSessionLspTunnelIpv4. - // PatternFlowRSVPPathSessionLspTunnelIpv4Reserved is reserved field, MUST be zero. - Reserved() PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - // SetReserved assigns PatternFlowRSVPPathSessionLspTunnelIpv4Reserved provided by user to FlowRSVPPathSessionLspTunnelIpv4. - // PatternFlowRSVPPathSessionLspTunnelIpv4Reserved is reserved field, MUST be zero. - SetReserved(value PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) FlowRSVPPathSessionLspTunnelIpv4 - // HasReserved checks if Reserved has been set in FlowRSVPPathSessionLspTunnelIpv4 - HasReserved() bool - // TunnelId returns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId, set in FlowRSVPPathSessionLspTunnelIpv4. - // PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId is a 16-bit identifier used in the SESSION that remains constant over the life of the tunnel. - TunnelId() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - // SetTunnelId assigns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId provided by user to FlowRSVPPathSessionLspTunnelIpv4. - // PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId is a 16-bit identifier used in the SESSION that remains constant over the life of the tunnel. - SetTunnelId(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) FlowRSVPPathSessionLspTunnelIpv4 - // HasTunnelId checks if TunnelId has been set in FlowRSVPPathSessionLspTunnelIpv4 - HasTunnelId() bool - // ExtendedTunnelId returns FlowRSVPPathSessionExtTunnelId, set in FlowRSVPPathSessionLspTunnelIpv4. - // FlowRSVPPathSessionExtTunnelId is description is TBD - ExtendedTunnelId() FlowRSVPPathSessionExtTunnelId - // SetExtendedTunnelId assigns FlowRSVPPathSessionExtTunnelId provided by user to FlowRSVPPathSessionLspTunnelIpv4. - // FlowRSVPPathSessionExtTunnelId is description is TBD - SetExtendedTunnelId(value FlowRSVPPathSessionExtTunnelId) FlowRSVPPathSessionLspTunnelIpv4 - // HasExtendedTunnelId checks if ExtendedTunnelId has been set in FlowRSVPPathSessionLspTunnelIpv4 - HasExtendedTunnelId() bool - setNil() -} - -// description is TBD -// Ipv4TunnelEndPointAddress returns a PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress -func (obj *flowRSVPPathSessionLspTunnelIpv4) Ipv4TunnelEndPointAddress() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { - if obj.obj.Ipv4TunnelEndPointAddress == nil { - obj.obj.Ipv4TunnelEndPointAddress = NewPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress().msg() - } - if obj.ipv4TunnelEndPointAddressHolder == nil { - obj.ipv4TunnelEndPointAddressHolder = &patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress{obj: obj.obj.Ipv4TunnelEndPointAddress} - } - return obj.ipv4TunnelEndPointAddressHolder -} - -// description is TBD -// Ipv4TunnelEndPointAddress returns a PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress -func (obj *flowRSVPPathSessionLspTunnelIpv4) HasIpv4TunnelEndPointAddress() bool { - return obj.obj.Ipv4TunnelEndPointAddress != nil -} - -// description is TBD -// SetIpv4TunnelEndPointAddress sets the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress value in the FlowRSVPPathSessionLspTunnelIpv4 object -func (obj *flowRSVPPathSessionLspTunnelIpv4) SetIpv4TunnelEndPointAddress(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) FlowRSVPPathSessionLspTunnelIpv4 { - - obj.ipv4TunnelEndPointAddressHolder = nil - obj.obj.Ipv4TunnelEndPointAddress = value.msg() - - return obj -} - -// description is TBD -// Reserved returns a PatternFlowRSVPPathSessionLspTunnelIpv4Reserved -func (obj *flowRSVPPathSessionLspTunnelIpv4) Reserved() PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { - if obj.obj.Reserved == nil { - obj.obj.Reserved = NewPatternFlowRSVPPathSessionLspTunnelIpv4Reserved().msg() - } - if obj.reservedHolder == nil { - obj.reservedHolder = &patternFlowRSVPPathSessionLspTunnelIpv4Reserved{obj: obj.obj.Reserved} - } - return obj.reservedHolder -} - -// description is TBD -// Reserved returns a PatternFlowRSVPPathSessionLspTunnelIpv4Reserved -func (obj *flowRSVPPathSessionLspTunnelIpv4) HasReserved() bool { - return obj.obj.Reserved != nil -} - -// description is TBD -// SetReserved sets the PatternFlowRSVPPathSessionLspTunnelIpv4Reserved value in the FlowRSVPPathSessionLspTunnelIpv4 object -func (obj *flowRSVPPathSessionLspTunnelIpv4) SetReserved(value PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) FlowRSVPPathSessionLspTunnelIpv4 { - - obj.reservedHolder = nil - obj.obj.Reserved = value.msg() - - return obj -} - -// description is TBD -// TunnelId returns a PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId -func (obj *flowRSVPPathSessionLspTunnelIpv4) TunnelId() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { - if obj.obj.TunnelId == nil { - obj.obj.TunnelId = NewPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId().msg() - } - if obj.tunnelIdHolder == nil { - obj.tunnelIdHolder = &patternFlowRSVPPathSessionLspTunnelIpv4TunnelId{obj: obj.obj.TunnelId} - } - return obj.tunnelIdHolder -} - -// description is TBD -// TunnelId returns a PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId -func (obj *flowRSVPPathSessionLspTunnelIpv4) HasTunnelId() bool { - return obj.obj.TunnelId != nil -} - -// description is TBD -// SetTunnelId sets the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId value in the FlowRSVPPathSessionLspTunnelIpv4 object -func (obj *flowRSVPPathSessionLspTunnelIpv4) SetTunnelId(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) FlowRSVPPathSessionLspTunnelIpv4 { - - obj.tunnelIdHolder = nil - obj.obj.TunnelId = value.msg() - - return obj -} - -// A 32-bit identifier used in the SESSION that remains constant over the life of the tunnel. Normally set to all zeros. Ingress nodes that wish to narrow the scope of a SESSION to the ingress-egress pair may place their IPv4 address here as a globally unique identifier. -// ExtendedTunnelId returns a FlowRSVPPathSessionExtTunnelId -func (obj *flowRSVPPathSessionLspTunnelIpv4) ExtendedTunnelId() FlowRSVPPathSessionExtTunnelId { - if obj.obj.ExtendedTunnelId == nil { - obj.obj.ExtendedTunnelId = NewFlowRSVPPathSessionExtTunnelId().msg() - } - if obj.extendedTunnelIdHolder == nil { - obj.extendedTunnelIdHolder = &flowRSVPPathSessionExtTunnelId{obj: obj.obj.ExtendedTunnelId} - } - return obj.extendedTunnelIdHolder -} - -// A 32-bit identifier used in the SESSION that remains constant over the life of the tunnel. Normally set to all zeros. Ingress nodes that wish to narrow the scope of a SESSION to the ingress-egress pair may place their IPv4 address here as a globally unique identifier. -// ExtendedTunnelId returns a FlowRSVPPathSessionExtTunnelId -func (obj *flowRSVPPathSessionLspTunnelIpv4) HasExtendedTunnelId() bool { - return obj.obj.ExtendedTunnelId != nil -} - -// A 32-bit identifier used in the SESSION that remains constant over the life of the tunnel. Normally set to all zeros. Ingress nodes that wish to narrow the scope of a SESSION to the ingress-egress pair may place their IPv4 address here as a globally unique identifier. -// SetExtendedTunnelId sets the FlowRSVPPathSessionExtTunnelId value in the FlowRSVPPathSessionLspTunnelIpv4 object -func (obj *flowRSVPPathSessionLspTunnelIpv4) SetExtendedTunnelId(value FlowRSVPPathSessionExtTunnelId) FlowRSVPPathSessionLspTunnelIpv4 { - - obj.extendedTunnelIdHolder = nil - obj.obj.ExtendedTunnelId = value.msg() - - return obj -} - -func (obj *flowRSVPPathSessionLspTunnelIpv4) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv4TunnelEndPointAddress != nil { - - obj.Ipv4TunnelEndPointAddress().validateObj(vObj, set_default) - } - - if obj.obj.Reserved != nil { - - obj.Reserved().validateObj(vObj, set_default) - } - - if obj.obj.TunnelId != nil { - - obj.TunnelId().validateObj(vObj, set_default) - } - - if obj.obj.ExtendedTunnelId != nil { - - obj.ExtendedTunnelId().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathSessionLspTunnelIpv4) setDefault() { - -} - -// ***** FlowRSVPPathRsvpHopIpv4 ***** -type flowRSVPPathRsvpHopIpv4 struct { - validation - obj *otg.FlowRSVPPathRsvpHopIpv4 - marshaller marshalFlowRSVPPathRsvpHopIpv4 - unMarshaller unMarshalFlowRSVPPathRsvpHopIpv4 - ipv4AddressHolder PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - logicalInterfaceHandleHolder PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle -} - -func NewFlowRSVPPathRsvpHopIpv4() FlowRSVPPathRsvpHopIpv4 { - obj := flowRSVPPathRsvpHopIpv4{obj: &otg.FlowRSVPPathRsvpHopIpv4{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathRsvpHopIpv4) msg() *otg.FlowRSVPPathRsvpHopIpv4 { - return obj.obj -} - -func (obj *flowRSVPPathRsvpHopIpv4) setMsg(msg *otg.FlowRSVPPathRsvpHopIpv4) FlowRSVPPathRsvpHopIpv4 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathRsvpHopIpv4 struct { - obj *flowRSVPPathRsvpHopIpv4 -} - -type marshalFlowRSVPPathRsvpHopIpv4 interface { - // ToProto marshals FlowRSVPPathRsvpHopIpv4 to protobuf object *otg.FlowRSVPPathRsvpHopIpv4 - ToProto() (*otg.FlowRSVPPathRsvpHopIpv4, error) - // ToPbText marshals FlowRSVPPathRsvpHopIpv4 to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathRsvpHopIpv4 to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathRsvpHopIpv4 to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathRsvpHopIpv4 struct { - obj *flowRSVPPathRsvpHopIpv4 -} - -type unMarshalFlowRSVPPathRsvpHopIpv4 interface { - // FromProto unmarshals FlowRSVPPathRsvpHopIpv4 from protobuf object *otg.FlowRSVPPathRsvpHopIpv4 - FromProto(msg *otg.FlowRSVPPathRsvpHopIpv4) (FlowRSVPPathRsvpHopIpv4, error) - // FromPbText unmarshals FlowRSVPPathRsvpHopIpv4 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathRsvpHopIpv4 from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathRsvpHopIpv4 from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathRsvpHopIpv4) Marshal() marshalFlowRSVPPathRsvpHopIpv4 { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathRsvpHopIpv4{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathRsvpHopIpv4) Unmarshal() unMarshalFlowRSVPPathRsvpHopIpv4 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathRsvpHopIpv4{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathRsvpHopIpv4) ToProto() (*otg.FlowRSVPPathRsvpHopIpv4, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathRsvpHopIpv4) FromProto(msg *otg.FlowRSVPPathRsvpHopIpv4) (FlowRSVPPathRsvpHopIpv4, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathRsvpHopIpv4) 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 *unMarshalflowRSVPPathRsvpHopIpv4) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathRsvpHopIpv4) 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 *unMarshalflowRSVPPathRsvpHopIpv4) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathRsvpHopIpv4) 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 *unMarshalflowRSVPPathRsvpHopIpv4) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathRsvpHopIpv4) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathRsvpHopIpv4) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathRsvpHopIpv4) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathRsvpHopIpv4) Clone() (FlowRSVPPathRsvpHopIpv4, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathRsvpHopIpv4() - 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 -} - -func (obj *flowRSVPPathRsvpHopIpv4) setNil() { - obj.ipv4AddressHolder = nil - obj.logicalInterfaceHandleHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathRsvpHopIpv4 is iPv4 RSVP_HOP object: Class = 3, C-Type = 1 -type FlowRSVPPathRsvpHopIpv4 interface { - Validation - // msg marshals FlowRSVPPathRsvpHopIpv4 to protobuf object *otg.FlowRSVPPathRsvpHopIpv4 - // and doesn't set defaults - msg() *otg.FlowRSVPPathRsvpHopIpv4 - // setMsg unmarshals FlowRSVPPathRsvpHopIpv4 from protobuf object *otg.FlowRSVPPathRsvpHopIpv4 - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathRsvpHopIpv4) FlowRSVPPathRsvpHopIpv4 - // provides marshal interface - Marshal() marshalFlowRSVPPathRsvpHopIpv4 - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathRsvpHopIpv4 - // validate validates FlowRSVPPathRsvpHopIpv4 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathRsvpHopIpv4, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv4Address returns PatternFlowRSVPPathRsvpHopIpv4Ipv4Address, set in FlowRSVPPathRsvpHopIpv4. - // PatternFlowRSVPPathRsvpHopIpv4Ipv4Address is the IPv4 address of the interface through which the last RSVP-knowledgeable hop forwarded this message. - Ipv4Address() PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - // SetIpv4Address assigns PatternFlowRSVPPathRsvpHopIpv4Ipv4Address provided by user to FlowRSVPPathRsvpHopIpv4. - // PatternFlowRSVPPathRsvpHopIpv4Ipv4Address is the IPv4 address of the interface through which the last RSVP-knowledgeable hop forwarded this message. - SetIpv4Address(value PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) FlowRSVPPathRsvpHopIpv4 - // HasIpv4Address checks if Ipv4Address has been set in FlowRSVPPathRsvpHopIpv4 - HasIpv4Address() bool - // LogicalInterfaceHandle returns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle, set in FlowRSVPPathRsvpHopIpv4. - // PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle is logical Interface Handle (LIH) is used to distinguish logical outgoing interfaces. A node receiving an LIH in a Path message saves its value and returns it in the HOP objects of subsequent Resv messages sent to the node that originated the LIH. The LIH should be identically zero if there is no logical interface handle. - LogicalInterfaceHandle() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - // SetLogicalInterfaceHandle assigns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle provided by user to FlowRSVPPathRsvpHopIpv4. - // PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle is logical Interface Handle (LIH) is used to distinguish logical outgoing interfaces. A node receiving an LIH in a Path message saves its value and returns it in the HOP objects of subsequent Resv messages sent to the node that originated the LIH. The LIH should be identically zero if there is no logical interface handle. - SetLogicalInterfaceHandle(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) FlowRSVPPathRsvpHopIpv4 - // HasLogicalInterfaceHandle checks if LogicalInterfaceHandle has been set in FlowRSVPPathRsvpHopIpv4 - HasLogicalInterfaceHandle() bool - setNil() -} - -// description is TBD -// Ipv4Address returns a PatternFlowRSVPPathRsvpHopIpv4Ipv4Address -func (obj *flowRSVPPathRsvpHopIpv4) Ipv4Address() PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { - if obj.obj.Ipv4Address == nil { - obj.obj.Ipv4Address = NewPatternFlowRSVPPathRsvpHopIpv4Ipv4Address().msg() - } - if obj.ipv4AddressHolder == nil { - obj.ipv4AddressHolder = &patternFlowRSVPPathRsvpHopIpv4Ipv4Address{obj: obj.obj.Ipv4Address} - } - return obj.ipv4AddressHolder -} - -// description is TBD -// Ipv4Address returns a PatternFlowRSVPPathRsvpHopIpv4Ipv4Address -func (obj *flowRSVPPathRsvpHopIpv4) HasIpv4Address() bool { - return obj.obj.Ipv4Address != nil -} - -// description is TBD -// SetIpv4Address sets the PatternFlowRSVPPathRsvpHopIpv4Ipv4Address value in the FlowRSVPPathRsvpHopIpv4 object -func (obj *flowRSVPPathRsvpHopIpv4) SetIpv4Address(value PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) FlowRSVPPathRsvpHopIpv4 { - - obj.ipv4AddressHolder = nil - obj.obj.Ipv4Address = value.msg() - - return obj -} - -// description is TBD -// LogicalInterfaceHandle returns a PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle -func (obj *flowRSVPPathRsvpHopIpv4) LogicalInterfaceHandle() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { - if obj.obj.LogicalInterfaceHandle == nil { - obj.obj.LogicalInterfaceHandle = NewPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle().msg() - } - if obj.logicalInterfaceHandleHolder == nil { - obj.logicalInterfaceHandleHolder = &patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle{obj: obj.obj.LogicalInterfaceHandle} - } - return obj.logicalInterfaceHandleHolder -} - -// description is TBD -// LogicalInterfaceHandle returns a PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle -func (obj *flowRSVPPathRsvpHopIpv4) HasLogicalInterfaceHandle() bool { - return obj.obj.LogicalInterfaceHandle != nil -} - -// description is TBD -// SetLogicalInterfaceHandle sets the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle value in the FlowRSVPPathRsvpHopIpv4 object -func (obj *flowRSVPPathRsvpHopIpv4) SetLogicalInterfaceHandle(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) FlowRSVPPathRsvpHopIpv4 { - - obj.logicalInterfaceHandleHolder = nil - obj.obj.LogicalInterfaceHandle = value.msg() - - return obj -} - -func (obj *flowRSVPPathRsvpHopIpv4) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv4Address != nil { - - obj.Ipv4Address().validateObj(vObj, set_default) - } - - if obj.obj.LogicalInterfaceHandle != nil { - - obj.LogicalInterfaceHandle().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathRsvpHopIpv4) setDefault() { - -} - -// ***** FlowRSVPPathTimeValuesType1 ***** -type flowRSVPPathTimeValuesType1 struct { - validation - obj *otg.FlowRSVPPathTimeValuesType1 - marshaller marshalFlowRSVPPathTimeValuesType1 - unMarshaller unMarshalFlowRSVPPathTimeValuesType1 - refreshPeriodRHolder PatternFlowRSVPPathTimeValuesType1RefreshPeriodR -} - -func NewFlowRSVPPathTimeValuesType1() FlowRSVPPathTimeValuesType1 { - obj := flowRSVPPathTimeValuesType1{obj: &otg.FlowRSVPPathTimeValuesType1{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathTimeValuesType1) msg() *otg.FlowRSVPPathTimeValuesType1 { - return obj.obj -} - -func (obj *flowRSVPPathTimeValuesType1) setMsg(msg *otg.FlowRSVPPathTimeValuesType1) FlowRSVPPathTimeValuesType1 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathTimeValuesType1 struct { - obj *flowRSVPPathTimeValuesType1 -} - -type marshalFlowRSVPPathTimeValuesType1 interface { - // ToProto marshals FlowRSVPPathTimeValuesType1 to protobuf object *otg.FlowRSVPPathTimeValuesType1 - ToProto() (*otg.FlowRSVPPathTimeValuesType1, error) - // ToPbText marshals FlowRSVPPathTimeValuesType1 to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathTimeValuesType1 to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathTimeValuesType1 to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathTimeValuesType1 struct { - obj *flowRSVPPathTimeValuesType1 -} - -type unMarshalFlowRSVPPathTimeValuesType1 interface { - // FromProto unmarshals FlowRSVPPathTimeValuesType1 from protobuf object *otg.FlowRSVPPathTimeValuesType1 - FromProto(msg *otg.FlowRSVPPathTimeValuesType1) (FlowRSVPPathTimeValuesType1, error) - // FromPbText unmarshals FlowRSVPPathTimeValuesType1 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathTimeValuesType1 from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathTimeValuesType1 from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathTimeValuesType1) Marshal() marshalFlowRSVPPathTimeValuesType1 { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathTimeValuesType1{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathTimeValuesType1) Unmarshal() unMarshalFlowRSVPPathTimeValuesType1 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathTimeValuesType1{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathTimeValuesType1) ToProto() (*otg.FlowRSVPPathTimeValuesType1, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathTimeValuesType1) FromProto(msg *otg.FlowRSVPPathTimeValuesType1) (FlowRSVPPathTimeValuesType1, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathTimeValuesType1) 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 *unMarshalflowRSVPPathTimeValuesType1) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathTimeValuesType1) 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 *unMarshalflowRSVPPathTimeValuesType1) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathTimeValuesType1) 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 *unMarshalflowRSVPPathTimeValuesType1) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathTimeValuesType1) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathTimeValuesType1) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathTimeValuesType1) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathTimeValuesType1) Clone() (FlowRSVPPathTimeValuesType1, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathTimeValuesType1() - 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 -} - -func (obj *flowRSVPPathTimeValuesType1) setNil() { - obj.refreshPeriodRHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathTimeValuesType1 is tIME_VALUES Object: Class = 5, C-Type = 1 -type FlowRSVPPathTimeValuesType1 interface { - Validation - // msg marshals FlowRSVPPathTimeValuesType1 to protobuf object *otg.FlowRSVPPathTimeValuesType1 - // and doesn't set defaults - msg() *otg.FlowRSVPPathTimeValuesType1 - // setMsg unmarshals FlowRSVPPathTimeValuesType1 from protobuf object *otg.FlowRSVPPathTimeValuesType1 - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathTimeValuesType1) FlowRSVPPathTimeValuesType1 - // provides marshal interface - Marshal() marshalFlowRSVPPathTimeValuesType1 - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathTimeValuesType1 - // validate validates FlowRSVPPathTimeValuesType1 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathTimeValuesType1, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // RefreshPeriodR returns PatternFlowRSVPPathTimeValuesType1RefreshPeriodR, set in FlowRSVPPathTimeValuesType1. - // PatternFlowRSVPPathTimeValuesType1RefreshPeriodR is the refresh timeout period R used to generate this message;in milliseconds. - RefreshPeriodR() PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - // SetRefreshPeriodR assigns PatternFlowRSVPPathTimeValuesType1RefreshPeriodR provided by user to FlowRSVPPathTimeValuesType1. - // PatternFlowRSVPPathTimeValuesType1RefreshPeriodR is the refresh timeout period R used to generate this message;in milliseconds. - SetRefreshPeriodR(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) FlowRSVPPathTimeValuesType1 - // HasRefreshPeriodR checks if RefreshPeriodR has been set in FlowRSVPPathTimeValuesType1 - HasRefreshPeriodR() bool - setNil() -} - -// description is TBD -// RefreshPeriodR returns a PatternFlowRSVPPathTimeValuesType1RefreshPeriodR -func (obj *flowRSVPPathTimeValuesType1) RefreshPeriodR() PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { - if obj.obj.RefreshPeriodR == nil { - obj.obj.RefreshPeriodR = NewPatternFlowRSVPPathTimeValuesType1RefreshPeriodR().msg() - } - if obj.refreshPeriodRHolder == nil { - obj.refreshPeriodRHolder = &patternFlowRSVPPathTimeValuesType1RefreshPeriodR{obj: obj.obj.RefreshPeriodR} - } - return obj.refreshPeriodRHolder -} - -// description is TBD -// RefreshPeriodR returns a PatternFlowRSVPPathTimeValuesType1RefreshPeriodR -func (obj *flowRSVPPathTimeValuesType1) HasRefreshPeriodR() bool { - return obj.obj.RefreshPeriodR != nil -} - -// description is TBD -// SetRefreshPeriodR sets the PatternFlowRSVPPathTimeValuesType1RefreshPeriodR value in the FlowRSVPPathTimeValuesType1 object -func (obj *flowRSVPPathTimeValuesType1) SetRefreshPeriodR(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) FlowRSVPPathTimeValuesType1 { - - obj.refreshPeriodRHolder = nil - obj.obj.RefreshPeriodR = value.msg() - - return obj -} - -func (obj *flowRSVPPathTimeValuesType1) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.RefreshPeriodR != nil { - - obj.RefreshPeriodR().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathTimeValuesType1) setDefault() { - -} - -// ***** FlowRSVPPathExplicitRouteType1 ***** -type flowRSVPPathExplicitRouteType1 struct { - validation - obj *otg.FlowRSVPPathExplicitRouteType1 - marshaller marshalFlowRSVPPathExplicitRouteType1 - unMarshaller unMarshalFlowRSVPPathExplicitRouteType1 - subobjectsHolder FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter -} - -func NewFlowRSVPPathExplicitRouteType1() FlowRSVPPathExplicitRouteType1 { - obj := flowRSVPPathExplicitRouteType1{obj: &otg.FlowRSVPPathExplicitRouteType1{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathExplicitRouteType1) msg() *otg.FlowRSVPPathExplicitRouteType1 { - return obj.obj -} - -func (obj *flowRSVPPathExplicitRouteType1) setMsg(msg *otg.FlowRSVPPathExplicitRouteType1) FlowRSVPPathExplicitRouteType1 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathExplicitRouteType1 struct { - obj *flowRSVPPathExplicitRouteType1 -} - -type marshalFlowRSVPPathExplicitRouteType1 interface { - // ToProto marshals FlowRSVPPathExplicitRouteType1 to protobuf object *otg.FlowRSVPPathExplicitRouteType1 - ToProto() (*otg.FlowRSVPPathExplicitRouteType1, error) - // ToPbText marshals FlowRSVPPathExplicitRouteType1 to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathExplicitRouteType1 to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathExplicitRouteType1 to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathExplicitRouteType1 struct { - obj *flowRSVPPathExplicitRouteType1 -} - -type unMarshalFlowRSVPPathExplicitRouteType1 interface { - // FromProto unmarshals FlowRSVPPathExplicitRouteType1 from protobuf object *otg.FlowRSVPPathExplicitRouteType1 - FromProto(msg *otg.FlowRSVPPathExplicitRouteType1) (FlowRSVPPathExplicitRouteType1, error) - // FromPbText unmarshals FlowRSVPPathExplicitRouteType1 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathExplicitRouteType1 from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathExplicitRouteType1 from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathExplicitRouteType1) Marshal() marshalFlowRSVPPathExplicitRouteType1 { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathExplicitRouteType1{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathExplicitRouteType1) Unmarshal() unMarshalFlowRSVPPathExplicitRouteType1 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathExplicitRouteType1{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathExplicitRouteType1) ToProto() (*otg.FlowRSVPPathExplicitRouteType1, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathExplicitRouteType1) FromProto(msg *otg.FlowRSVPPathExplicitRouteType1) (FlowRSVPPathExplicitRouteType1, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathExplicitRouteType1) 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 *unMarshalflowRSVPPathExplicitRouteType1) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathExplicitRouteType1) 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 *unMarshalflowRSVPPathExplicitRouteType1) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathExplicitRouteType1) 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 *unMarshalflowRSVPPathExplicitRouteType1) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathExplicitRouteType1) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathExplicitRouteType1) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathExplicitRouteType1) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathExplicitRouteType1) Clone() (FlowRSVPPathExplicitRouteType1, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathExplicitRouteType1() - 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 -} - -func (obj *flowRSVPPathExplicitRouteType1) setNil() { - obj.subobjectsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathExplicitRouteType1 is type1 Explicit Route has subobjects. Currently supported subobjects are IPv4 prefix and Autonomous system number. -type FlowRSVPPathExplicitRouteType1 interface { - Validation - // msg marshals FlowRSVPPathExplicitRouteType1 to protobuf object *otg.FlowRSVPPathExplicitRouteType1 - // and doesn't set defaults - msg() *otg.FlowRSVPPathExplicitRouteType1 - // setMsg unmarshals FlowRSVPPathExplicitRouteType1 from protobuf object *otg.FlowRSVPPathExplicitRouteType1 - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathExplicitRouteType1) FlowRSVPPathExplicitRouteType1 - // provides marshal interface - Marshal() marshalFlowRSVPPathExplicitRouteType1 - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathExplicitRouteType1 - // validate validates FlowRSVPPathExplicitRouteType1 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathExplicitRouteType1, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Subobjects returns FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIterIter, set in FlowRSVPPathExplicitRouteType1 - Subobjects() FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter - setNil() -} - -// description is TBD -// Subobjects returns a []FlowRSVPType1ExplicitRouteSubobjects -func (obj *flowRSVPPathExplicitRouteType1) Subobjects() FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { - if len(obj.obj.Subobjects) == 0 { - obj.obj.Subobjects = []*otg.FlowRSVPType1ExplicitRouteSubobjects{} - } - if obj.subobjectsHolder == nil { - obj.subobjectsHolder = newFlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter(&obj.obj.Subobjects).setMsg(obj) - } - return obj.subobjectsHolder -} - -type flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter struct { - obj *flowRSVPPathExplicitRouteType1 - flowRSVPType1ExplicitRouteSubobjectsSlice []FlowRSVPType1ExplicitRouteSubobjects - fieldPtr *[]*otg.FlowRSVPType1ExplicitRouteSubobjects -} - -func newFlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter(ptr *[]*otg.FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { - return &flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter{fieldPtr: ptr} -} - -type FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter interface { - setMsg(*flowRSVPPathExplicitRouteType1) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter - Items() []FlowRSVPType1ExplicitRouteSubobjects - Add() FlowRSVPType1ExplicitRouteSubobjects - Append(items ...FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter - Set(index int, newObj FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter - Clear() FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter - clearHolderSlice() FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter - appendHolderSlice(item FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter -} - -func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) setMsg(msg *flowRSVPPathExplicitRouteType1) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flowRSVPType1ExplicitRouteSubobjects{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) Items() []FlowRSVPType1ExplicitRouteSubobjects { - return obj.flowRSVPType1ExplicitRouteSubobjectsSlice -} - -func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) Add() FlowRSVPType1ExplicitRouteSubobjects { - newObj := &otg.FlowRSVPType1ExplicitRouteSubobjects{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flowRSVPType1ExplicitRouteSubobjects{obj: newObj} - newLibObj.setDefault() - obj.flowRSVPType1ExplicitRouteSubobjectsSlice = append(obj.flowRSVPType1ExplicitRouteSubobjectsSlice, newLibObj) - return newLibObj -} - -func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) Append(items ...FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowRSVPType1ExplicitRouteSubobjectsSlice = append(obj.flowRSVPType1ExplicitRouteSubobjectsSlice, item) - } - return obj -} - -func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) Set(index int, newObj FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowRSVPType1ExplicitRouteSubobjectsSlice[index] = newObj - return obj -} -func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) Clear() FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.FlowRSVPType1ExplicitRouteSubobjects{} - obj.flowRSVPType1ExplicitRouteSubobjectsSlice = []FlowRSVPType1ExplicitRouteSubobjects{} - } - return obj -} -func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) clearHolderSlice() FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { - if len(obj.flowRSVPType1ExplicitRouteSubobjectsSlice) > 0 { - obj.flowRSVPType1ExplicitRouteSubobjectsSlice = []FlowRSVPType1ExplicitRouteSubobjects{} - } - return obj -} -func (obj *flowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter) appendHolderSlice(item FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPPathExplicitRouteType1FlowRSVPType1ExplicitRouteSubobjectsIter { - obj.flowRSVPType1ExplicitRouteSubobjectsSlice = append(obj.flowRSVPType1ExplicitRouteSubobjectsSlice, item) - return obj -} - -func (obj *flowRSVPPathExplicitRouteType1) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Subobjects) != 0 { - - if set_default { - obj.Subobjects().clearHolderSlice() - for _, item := range obj.obj.Subobjects { - obj.Subobjects().appendHolderSlice(&flowRSVPType1ExplicitRouteSubobjects{obj: item}) - } - } - for _, item := range obj.Subobjects().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *flowRSVPPathExplicitRouteType1) setDefault() { - -} - -// ***** FlowRSVPPathLabelRequestWithoutLabelRange ***** -type flowRSVPPathLabelRequestWithoutLabelRange struct { - validation - obj *otg.FlowRSVPPathLabelRequestWithoutLabelRange - marshaller marshalFlowRSVPPathLabelRequestWithoutLabelRange - unMarshaller unMarshalFlowRSVPPathLabelRequestWithoutLabelRange - reservedHolder PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - l3PidHolder PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid -} - -func NewFlowRSVPPathLabelRequestWithoutLabelRange() FlowRSVPPathLabelRequestWithoutLabelRange { - obj := flowRSVPPathLabelRequestWithoutLabelRange{obj: &otg.FlowRSVPPathLabelRequestWithoutLabelRange{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) msg() *otg.FlowRSVPPathLabelRequestWithoutLabelRange { - return obj.obj -} - -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) setMsg(msg *otg.FlowRSVPPathLabelRequestWithoutLabelRange) FlowRSVPPathLabelRequestWithoutLabelRange { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathLabelRequestWithoutLabelRange struct { - obj *flowRSVPPathLabelRequestWithoutLabelRange -} - -type marshalFlowRSVPPathLabelRequestWithoutLabelRange interface { - // ToProto marshals FlowRSVPPathLabelRequestWithoutLabelRange to protobuf object *otg.FlowRSVPPathLabelRequestWithoutLabelRange - ToProto() (*otg.FlowRSVPPathLabelRequestWithoutLabelRange, error) - // ToPbText marshals FlowRSVPPathLabelRequestWithoutLabelRange to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathLabelRequestWithoutLabelRange to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathLabelRequestWithoutLabelRange to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathLabelRequestWithoutLabelRange struct { - obj *flowRSVPPathLabelRequestWithoutLabelRange -} - -type unMarshalFlowRSVPPathLabelRequestWithoutLabelRange interface { - // FromProto unmarshals FlowRSVPPathLabelRequestWithoutLabelRange from protobuf object *otg.FlowRSVPPathLabelRequestWithoutLabelRange - FromProto(msg *otg.FlowRSVPPathLabelRequestWithoutLabelRange) (FlowRSVPPathLabelRequestWithoutLabelRange, error) - // FromPbText unmarshals FlowRSVPPathLabelRequestWithoutLabelRange from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathLabelRequestWithoutLabelRange from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathLabelRequestWithoutLabelRange from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) Marshal() marshalFlowRSVPPathLabelRequestWithoutLabelRange { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathLabelRequestWithoutLabelRange{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) Unmarshal() unMarshalFlowRSVPPathLabelRequestWithoutLabelRange { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathLabelRequestWithoutLabelRange{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathLabelRequestWithoutLabelRange) ToProto() (*otg.FlowRSVPPathLabelRequestWithoutLabelRange, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathLabelRequestWithoutLabelRange) FromProto(msg *otg.FlowRSVPPathLabelRequestWithoutLabelRange) (FlowRSVPPathLabelRequestWithoutLabelRange, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathLabelRequestWithoutLabelRange) 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 *unMarshalflowRSVPPathLabelRequestWithoutLabelRange) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathLabelRequestWithoutLabelRange) 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 *unMarshalflowRSVPPathLabelRequestWithoutLabelRange) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathLabelRequestWithoutLabelRange) 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 *unMarshalflowRSVPPathLabelRequestWithoutLabelRange) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) Clone() (FlowRSVPPathLabelRequestWithoutLabelRange, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathLabelRequestWithoutLabelRange() - 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 -} - -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) setNil() { - obj.reservedHolder = nil - obj.l3PidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathLabelRequestWithoutLabelRange is class = LABEL_REQUEST, Without Label Range C-Type = 1 -type FlowRSVPPathLabelRequestWithoutLabelRange interface { - Validation - // msg marshals FlowRSVPPathLabelRequestWithoutLabelRange to protobuf object *otg.FlowRSVPPathLabelRequestWithoutLabelRange - // and doesn't set defaults - msg() *otg.FlowRSVPPathLabelRequestWithoutLabelRange - // setMsg unmarshals FlowRSVPPathLabelRequestWithoutLabelRange from protobuf object *otg.FlowRSVPPathLabelRequestWithoutLabelRange - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathLabelRequestWithoutLabelRange) FlowRSVPPathLabelRequestWithoutLabelRange - // provides marshal interface - Marshal() marshalFlowRSVPPathLabelRequestWithoutLabelRange - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathLabelRequestWithoutLabelRange - // validate validates FlowRSVPPathLabelRequestWithoutLabelRange - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathLabelRequestWithoutLabelRange, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Reserved returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved, set in FlowRSVPPathLabelRequestWithoutLabelRange. - // PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved is this field is reserved. It MUST be set to zero on transmission and MUST be ignored on receipt. - Reserved() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - // SetReserved assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved provided by user to FlowRSVPPathLabelRequestWithoutLabelRange. - // PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved is this field is reserved. It MUST be set to zero on transmission and MUST be ignored on receipt. - SetReserved(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) FlowRSVPPathLabelRequestWithoutLabelRange - // HasReserved checks if Reserved has been set in FlowRSVPPathLabelRequestWithoutLabelRange - HasReserved() bool - // L3Pid returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid, set in FlowRSVPPathLabelRequestWithoutLabelRange. - L3Pid() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - // SetL3Pid assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid provided by user to FlowRSVPPathLabelRequestWithoutLabelRange. - SetL3Pid(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) FlowRSVPPathLabelRequestWithoutLabelRange - // HasL3Pid checks if L3Pid has been set in FlowRSVPPathLabelRequestWithoutLabelRange - HasL3Pid() bool - setNil() -} - -// description is TBD -// Reserved returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) Reserved() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { - if obj.obj.Reserved == nil { - obj.obj.Reserved = NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved().msg() - } - if obj.reservedHolder == nil { - obj.reservedHolder = &patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved{obj: obj.obj.Reserved} - } - return obj.reservedHolder -} - -// description is TBD -// Reserved returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) HasReserved() bool { - return obj.obj.Reserved != nil -} - -// description is TBD -// SetReserved sets the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved value in the FlowRSVPPathLabelRequestWithoutLabelRange object -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) SetReserved(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) FlowRSVPPathLabelRequestWithoutLabelRange { - - obj.reservedHolder = nil - obj.obj.Reserved = value.msg() - - return obj -} - -// description is TBD -// L3Pid returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) L3Pid() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { - if obj.obj.L3Pid == nil { - obj.obj.L3Pid = NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid().msg() - } - if obj.l3PidHolder == nil { - obj.l3PidHolder = &patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid{obj: obj.obj.L3Pid} - } - return obj.l3PidHolder -} - -// description is TBD -// L3Pid returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) HasL3Pid() bool { - return obj.obj.L3Pid != nil -} - -// description is TBD -// SetL3Pid sets the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid value in the FlowRSVPPathLabelRequestWithoutLabelRange object -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) SetL3Pid(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) FlowRSVPPathLabelRequestWithoutLabelRange { - - obj.l3PidHolder = nil - obj.obj.L3Pid = value.msg() - - return obj -} - -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Reserved != nil { - - obj.Reserved().validateObj(vObj, set_default) - } - - if obj.obj.L3Pid != nil { - - obj.L3Pid().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathLabelRequestWithoutLabelRange) setDefault() { - -} - -// ***** FlowRSVPPathSessionAttributeLspTunnel ***** -type flowRSVPPathSessionAttributeLspTunnel struct { - validation - obj *otg.FlowRSVPPathSessionAttributeLspTunnel - marshaller marshalFlowRSVPPathSessionAttributeLspTunnel - unMarshaller unMarshalFlowRSVPPathSessionAttributeLspTunnel - flagsHolder FlowRSVPLspTunnelFlag - nameLengthHolder FlowRSVPSessionAttributeNameLength -} - -func NewFlowRSVPPathSessionAttributeLspTunnel() FlowRSVPPathSessionAttributeLspTunnel { - obj := flowRSVPPathSessionAttributeLspTunnel{obj: &otg.FlowRSVPPathSessionAttributeLspTunnel{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathSessionAttributeLspTunnel) msg() *otg.FlowRSVPPathSessionAttributeLspTunnel { - return obj.obj -} - -func (obj *flowRSVPPathSessionAttributeLspTunnel) setMsg(msg *otg.FlowRSVPPathSessionAttributeLspTunnel) FlowRSVPPathSessionAttributeLspTunnel { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathSessionAttributeLspTunnel struct { - obj *flowRSVPPathSessionAttributeLspTunnel -} - -type marshalFlowRSVPPathSessionAttributeLspTunnel interface { - // ToProto marshals FlowRSVPPathSessionAttributeLspTunnel to protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnel - ToProto() (*otg.FlowRSVPPathSessionAttributeLspTunnel, error) - // ToPbText marshals FlowRSVPPathSessionAttributeLspTunnel to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathSessionAttributeLspTunnel to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathSessionAttributeLspTunnel to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathSessionAttributeLspTunnel struct { - obj *flowRSVPPathSessionAttributeLspTunnel -} - -type unMarshalFlowRSVPPathSessionAttributeLspTunnel interface { - // FromProto unmarshals FlowRSVPPathSessionAttributeLspTunnel from protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnel - FromProto(msg *otg.FlowRSVPPathSessionAttributeLspTunnel) (FlowRSVPPathSessionAttributeLspTunnel, error) - // FromPbText unmarshals FlowRSVPPathSessionAttributeLspTunnel from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathSessionAttributeLspTunnel from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathSessionAttributeLspTunnel from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathSessionAttributeLspTunnel) Marshal() marshalFlowRSVPPathSessionAttributeLspTunnel { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathSessionAttributeLspTunnel{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathSessionAttributeLspTunnel) Unmarshal() unMarshalFlowRSVPPathSessionAttributeLspTunnel { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathSessionAttributeLspTunnel{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathSessionAttributeLspTunnel) ToProto() (*otg.FlowRSVPPathSessionAttributeLspTunnel, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathSessionAttributeLspTunnel) FromProto(msg *otg.FlowRSVPPathSessionAttributeLspTunnel) (FlowRSVPPathSessionAttributeLspTunnel, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathSessionAttributeLspTunnel) 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 *unMarshalflowRSVPPathSessionAttributeLspTunnel) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathSessionAttributeLspTunnel) 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 *unMarshalflowRSVPPathSessionAttributeLspTunnel) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathSessionAttributeLspTunnel) 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 *unMarshalflowRSVPPathSessionAttributeLspTunnel) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathSessionAttributeLspTunnel) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathSessionAttributeLspTunnel) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathSessionAttributeLspTunnel) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathSessionAttributeLspTunnel) Clone() (FlowRSVPPathSessionAttributeLspTunnel, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathSessionAttributeLspTunnel() - 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 -} - -func (obj *flowRSVPPathSessionAttributeLspTunnel) setNil() { - obj.flagsHolder = nil - obj.nameLengthHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathSessionAttributeLspTunnel is sESSION_ATTRIBUTE class = 207, LSP_TUNNEL_RA C-Type = 7, resource affinity information. -type FlowRSVPPathSessionAttributeLspTunnel interface { - Validation - // msg marshals FlowRSVPPathSessionAttributeLspTunnel to protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnel - // and doesn't set defaults - msg() *otg.FlowRSVPPathSessionAttributeLspTunnel - // setMsg unmarshals FlowRSVPPathSessionAttributeLspTunnel from protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnel - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathSessionAttributeLspTunnel) FlowRSVPPathSessionAttributeLspTunnel - // provides marshal interface - Marshal() marshalFlowRSVPPathSessionAttributeLspTunnel - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathSessionAttributeLspTunnel - // validate validates FlowRSVPPathSessionAttributeLspTunnel - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathSessionAttributeLspTunnel, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // SetupPriority returns uint32, set in FlowRSVPPathSessionAttributeLspTunnel. - SetupPriority() uint32 - // SetSetupPriority assigns uint32 provided by user to FlowRSVPPathSessionAttributeLspTunnel - SetSetupPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnel - // HasSetupPriority checks if SetupPriority has been set in FlowRSVPPathSessionAttributeLspTunnel - HasSetupPriority() bool - // HoldingPriority returns uint32, set in FlowRSVPPathSessionAttributeLspTunnel. - HoldingPriority() uint32 - // SetHoldingPriority assigns uint32 provided by user to FlowRSVPPathSessionAttributeLspTunnel - SetHoldingPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnel - // HasHoldingPriority checks if HoldingPriority has been set in FlowRSVPPathSessionAttributeLspTunnel - HasHoldingPriority() bool - // Flags returns FlowRSVPLspTunnelFlag, set in FlowRSVPPathSessionAttributeLspTunnel. - // FlowRSVPLspTunnelFlag is description is TBD - Flags() FlowRSVPLspTunnelFlag - // SetFlags assigns FlowRSVPLspTunnelFlag provided by user to FlowRSVPPathSessionAttributeLspTunnel. - // FlowRSVPLspTunnelFlag is description is TBD - SetFlags(value FlowRSVPLspTunnelFlag) FlowRSVPPathSessionAttributeLspTunnel - // HasFlags checks if Flags has been set in FlowRSVPPathSessionAttributeLspTunnel - HasFlags() bool - // NameLength returns FlowRSVPSessionAttributeNameLength, set in FlowRSVPPathSessionAttributeLspTunnel. - // FlowRSVPSessionAttributeNameLength is description is TBD - NameLength() FlowRSVPSessionAttributeNameLength - // SetNameLength assigns FlowRSVPSessionAttributeNameLength provided by user to FlowRSVPPathSessionAttributeLspTunnel. - // FlowRSVPSessionAttributeNameLength is description is TBD - SetNameLength(value FlowRSVPSessionAttributeNameLength) FlowRSVPPathSessionAttributeLspTunnel - // HasNameLength checks if NameLength has been set in FlowRSVPPathSessionAttributeLspTunnel - HasNameLength() bool - // SessionName returns string, set in FlowRSVPPathSessionAttributeLspTunnel. - SessionName() string - // SetSessionName assigns string provided by user to FlowRSVPPathSessionAttributeLspTunnel - SetSessionName(value string) FlowRSVPPathSessionAttributeLspTunnel - // HasSessionName checks if SessionName has been set in FlowRSVPPathSessionAttributeLspTunnel - HasSessionName() bool - setNil() -} - -// The priority of the session with respect to taking resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. -// SetupPriority returns a uint32 -func (obj *flowRSVPPathSessionAttributeLspTunnel) SetupPriority() uint32 { - - return *obj.obj.SetupPriority - -} - -// The priority of the session with respect to taking resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. -// SetupPriority returns a uint32 -func (obj *flowRSVPPathSessionAttributeLspTunnel) HasSetupPriority() bool { - return obj.obj.SetupPriority != nil -} - -// The priority of the session with respect to taking resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. -// SetSetupPriority sets the uint32 value in the FlowRSVPPathSessionAttributeLspTunnel object -func (obj *flowRSVPPathSessionAttributeLspTunnel) SetSetupPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnel { - - obj.obj.SetupPriority = &value - return obj -} - -// The priority of the session with respect to holding resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. -// HoldingPriority returns a uint32 -func (obj *flowRSVPPathSessionAttributeLspTunnel) HoldingPriority() uint32 { - - return *obj.obj.HoldingPriority - -} - -// The priority of the session with respect to holding resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. -// HoldingPriority returns a uint32 -func (obj *flowRSVPPathSessionAttributeLspTunnel) HasHoldingPriority() bool { - return obj.obj.HoldingPriority != nil -} - -// The priority of the session with respect to holding resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. -// SetHoldingPriority sets the uint32 value in the FlowRSVPPathSessionAttributeLspTunnel object -func (obj *flowRSVPPathSessionAttributeLspTunnel) SetHoldingPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnel { - - obj.obj.HoldingPriority = &value - return obj -} - -// 0x01 Local protection desired, 0x02 Label recording desired, 0x04 SE Style desired -// Flags returns a FlowRSVPLspTunnelFlag -func (obj *flowRSVPPathSessionAttributeLspTunnel) Flags() FlowRSVPLspTunnelFlag { - if obj.obj.Flags == nil { - obj.obj.Flags = NewFlowRSVPLspTunnelFlag().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &flowRSVPLspTunnelFlag{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// 0x01 Local protection desired, 0x02 Label recording desired, 0x04 SE Style desired -// Flags returns a FlowRSVPLspTunnelFlag -func (obj *flowRSVPPathSessionAttributeLspTunnel) HasFlags() bool { - return obj.obj.Flags != nil -} - -// 0x01 Local protection desired, 0x02 Label recording desired, 0x04 SE Style desired -// SetFlags sets the FlowRSVPLspTunnelFlag value in the FlowRSVPPathSessionAttributeLspTunnel object -func (obj *flowRSVPPathSessionAttributeLspTunnel) SetFlags(value FlowRSVPLspTunnelFlag) FlowRSVPPathSessionAttributeLspTunnel { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// The length of the display string before padding, in bytes. -// NameLength returns a FlowRSVPSessionAttributeNameLength -func (obj *flowRSVPPathSessionAttributeLspTunnel) NameLength() FlowRSVPSessionAttributeNameLength { - if obj.obj.NameLength == nil { - obj.obj.NameLength = NewFlowRSVPSessionAttributeNameLength().msg() - } - if obj.nameLengthHolder == nil { - obj.nameLengthHolder = &flowRSVPSessionAttributeNameLength{obj: obj.obj.NameLength} - } - return obj.nameLengthHolder -} - -// The length of the display string before padding, in bytes. -// NameLength returns a FlowRSVPSessionAttributeNameLength -func (obj *flowRSVPPathSessionAttributeLspTunnel) HasNameLength() bool { - return obj.obj.NameLength != nil -} - -// The length of the display string before padding, in bytes. -// SetNameLength sets the FlowRSVPSessionAttributeNameLength value in the FlowRSVPPathSessionAttributeLspTunnel object -func (obj *flowRSVPPathSessionAttributeLspTunnel) SetNameLength(value FlowRSVPSessionAttributeNameLength) FlowRSVPPathSessionAttributeLspTunnel { - - obj.nameLengthHolder = nil - obj.obj.NameLength = value.msg() - - return obj -} - -// A null padded string of characters. -// SessionName returns a string -func (obj *flowRSVPPathSessionAttributeLspTunnel) SessionName() string { - - return *obj.obj.SessionName - -} - -// A null padded string of characters. -// SessionName returns a string -func (obj *flowRSVPPathSessionAttributeLspTunnel) HasSessionName() bool { - return obj.obj.SessionName != nil -} - -// A null padded string of characters. -// SetSessionName sets the string value in the FlowRSVPPathSessionAttributeLspTunnel object -func (obj *flowRSVPPathSessionAttributeLspTunnel) SetSessionName(value string) FlowRSVPPathSessionAttributeLspTunnel { - - obj.obj.SessionName = &value - return obj -} - -func (obj *flowRSVPPathSessionAttributeLspTunnel) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.SetupPriority != nil { - - if *obj.obj.SetupPriority > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowRSVPPathSessionAttributeLspTunnel.SetupPriority <= 7 but Got %d", *obj.obj.SetupPriority)) - } - - } - - if obj.obj.HoldingPriority != nil { - - if *obj.obj.HoldingPriority > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowRSVPPathSessionAttributeLspTunnel.HoldingPriority <= 7 but Got %d", *obj.obj.HoldingPriority)) - } - - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.NameLength != nil { - - obj.NameLength().validateObj(vObj, set_default) - } - - if obj.obj.SessionName != nil { - - if len(*obj.obj.SessionName) < 0 || len(*obj.obj.SessionName) > 254 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of FlowRSVPPathSessionAttributeLspTunnel.SessionName <= 254 but Got %d", - len(*obj.obj.SessionName))) - } - - } - -} - -func (obj *flowRSVPPathSessionAttributeLspTunnel) setDefault() { - if obj.obj.SetupPriority == nil { - obj.SetSetupPriority(7) - } - if obj.obj.HoldingPriority == nil { - obj.SetHoldingPriority(7) - } - if obj.obj.SessionName == nil { - obj.SetSessionName("") - } - -} - -// ***** FlowRSVPPathSessionAttributeLspTunnelRa ***** -type flowRSVPPathSessionAttributeLspTunnelRa struct { - validation - obj *otg.FlowRSVPPathSessionAttributeLspTunnelRa - marshaller marshalFlowRSVPPathSessionAttributeLspTunnelRa - unMarshaller unMarshalFlowRSVPPathSessionAttributeLspTunnelRa - flagsHolder FlowRSVPLspTunnelFlag - nameLengthHolder FlowRSVPSessionAttributeNameLength -} - -func NewFlowRSVPPathSessionAttributeLspTunnelRa() FlowRSVPPathSessionAttributeLspTunnelRa { - obj := flowRSVPPathSessionAttributeLspTunnelRa{obj: &otg.FlowRSVPPathSessionAttributeLspTunnelRa{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) msg() *otg.FlowRSVPPathSessionAttributeLspTunnelRa { - return obj.obj -} - -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) setMsg(msg *otg.FlowRSVPPathSessionAttributeLspTunnelRa) FlowRSVPPathSessionAttributeLspTunnelRa { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathSessionAttributeLspTunnelRa struct { - obj *flowRSVPPathSessionAttributeLspTunnelRa -} - -type marshalFlowRSVPPathSessionAttributeLspTunnelRa interface { - // ToProto marshals FlowRSVPPathSessionAttributeLspTunnelRa to protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnelRa - ToProto() (*otg.FlowRSVPPathSessionAttributeLspTunnelRa, error) - // ToPbText marshals FlowRSVPPathSessionAttributeLspTunnelRa to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathSessionAttributeLspTunnelRa to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathSessionAttributeLspTunnelRa to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathSessionAttributeLspTunnelRa struct { - obj *flowRSVPPathSessionAttributeLspTunnelRa -} - -type unMarshalFlowRSVPPathSessionAttributeLspTunnelRa interface { - // FromProto unmarshals FlowRSVPPathSessionAttributeLspTunnelRa from protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnelRa - FromProto(msg *otg.FlowRSVPPathSessionAttributeLspTunnelRa) (FlowRSVPPathSessionAttributeLspTunnelRa, error) - // FromPbText unmarshals FlowRSVPPathSessionAttributeLspTunnelRa from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathSessionAttributeLspTunnelRa from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathSessionAttributeLspTunnelRa from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) Marshal() marshalFlowRSVPPathSessionAttributeLspTunnelRa { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathSessionAttributeLspTunnelRa{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) Unmarshal() unMarshalFlowRSVPPathSessionAttributeLspTunnelRa { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathSessionAttributeLspTunnelRa{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathSessionAttributeLspTunnelRa) ToProto() (*otg.FlowRSVPPathSessionAttributeLspTunnelRa, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathSessionAttributeLspTunnelRa) FromProto(msg *otg.FlowRSVPPathSessionAttributeLspTunnelRa) (FlowRSVPPathSessionAttributeLspTunnelRa, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathSessionAttributeLspTunnelRa) 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 *unMarshalflowRSVPPathSessionAttributeLspTunnelRa) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathSessionAttributeLspTunnelRa) 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 *unMarshalflowRSVPPathSessionAttributeLspTunnelRa) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathSessionAttributeLspTunnelRa) 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 *unMarshalflowRSVPPathSessionAttributeLspTunnelRa) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) Clone() (FlowRSVPPathSessionAttributeLspTunnelRa, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathSessionAttributeLspTunnelRa() - 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 -} - -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) setNil() { - obj.flagsHolder = nil - obj.nameLengthHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathSessionAttributeLspTunnelRa is sESSION_ATTRIBUTE class = 207, LSP_TUNNEL_RA C-Type = 1, it carries resource affinity information. -type FlowRSVPPathSessionAttributeLspTunnelRa interface { - Validation - // msg marshals FlowRSVPPathSessionAttributeLspTunnelRa to protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnelRa - // and doesn't set defaults - msg() *otg.FlowRSVPPathSessionAttributeLspTunnelRa - // setMsg unmarshals FlowRSVPPathSessionAttributeLspTunnelRa from protobuf object *otg.FlowRSVPPathSessionAttributeLspTunnelRa - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathSessionAttributeLspTunnelRa) FlowRSVPPathSessionAttributeLspTunnelRa - // provides marshal interface - Marshal() marshalFlowRSVPPathSessionAttributeLspTunnelRa - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathSessionAttributeLspTunnelRa - // validate validates FlowRSVPPathSessionAttributeLspTunnelRa - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathSessionAttributeLspTunnelRa, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // ExcludeAny returns string, set in FlowRSVPPathSessionAttributeLspTunnelRa. - ExcludeAny() string - // SetExcludeAny assigns string provided by user to FlowRSVPPathSessionAttributeLspTunnelRa - SetExcludeAny(value string) FlowRSVPPathSessionAttributeLspTunnelRa - // HasExcludeAny checks if ExcludeAny has been set in FlowRSVPPathSessionAttributeLspTunnelRa - HasExcludeAny() bool - // IncludeAny returns string, set in FlowRSVPPathSessionAttributeLspTunnelRa. - IncludeAny() string - // SetIncludeAny assigns string provided by user to FlowRSVPPathSessionAttributeLspTunnelRa - SetIncludeAny(value string) FlowRSVPPathSessionAttributeLspTunnelRa - // HasIncludeAny checks if IncludeAny has been set in FlowRSVPPathSessionAttributeLspTunnelRa - HasIncludeAny() bool - // IncludeAll returns string, set in FlowRSVPPathSessionAttributeLspTunnelRa. - IncludeAll() string - // SetIncludeAll assigns string provided by user to FlowRSVPPathSessionAttributeLspTunnelRa - SetIncludeAll(value string) FlowRSVPPathSessionAttributeLspTunnelRa - // HasIncludeAll checks if IncludeAll has been set in FlowRSVPPathSessionAttributeLspTunnelRa - HasIncludeAll() bool - // SetupPriority returns uint32, set in FlowRSVPPathSessionAttributeLspTunnelRa. - SetupPriority() uint32 - // SetSetupPriority assigns uint32 provided by user to FlowRSVPPathSessionAttributeLspTunnelRa - SetSetupPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnelRa - // HasSetupPriority checks if SetupPriority has been set in FlowRSVPPathSessionAttributeLspTunnelRa - HasSetupPriority() bool - // HoldingPriority returns uint32, set in FlowRSVPPathSessionAttributeLspTunnelRa. - HoldingPriority() uint32 - // SetHoldingPriority assigns uint32 provided by user to FlowRSVPPathSessionAttributeLspTunnelRa - SetHoldingPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnelRa - // HasHoldingPriority checks if HoldingPriority has been set in FlowRSVPPathSessionAttributeLspTunnelRa - HasHoldingPriority() bool - // Flags returns FlowRSVPLspTunnelFlag, set in FlowRSVPPathSessionAttributeLspTunnelRa. - // FlowRSVPLspTunnelFlag is description is TBD - Flags() FlowRSVPLspTunnelFlag - // SetFlags assigns FlowRSVPLspTunnelFlag provided by user to FlowRSVPPathSessionAttributeLspTunnelRa. - // FlowRSVPLspTunnelFlag is description is TBD - SetFlags(value FlowRSVPLspTunnelFlag) FlowRSVPPathSessionAttributeLspTunnelRa - // HasFlags checks if Flags has been set in FlowRSVPPathSessionAttributeLspTunnelRa - HasFlags() bool - // NameLength returns FlowRSVPSessionAttributeNameLength, set in FlowRSVPPathSessionAttributeLspTunnelRa. - // FlowRSVPSessionAttributeNameLength is description is TBD - NameLength() FlowRSVPSessionAttributeNameLength - // SetNameLength assigns FlowRSVPSessionAttributeNameLength provided by user to FlowRSVPPathSessionAttributeLspTunnelRa. - // FlowRSVPSessionAttributeNameLength is description is TBD - SetNameLength(value FlowRSVPSessionAttributeNameLength) FlowRSVPPathSessionAttributeLspTunnelRa - // HasNameLength checks if NameLength has been set in FlowRSVPPathSessionAttributeLspTunnelRa - HasNameLength() bool - // SessionName returns string, set in FlowRSVPPathSessionAttributeLspTunnelRa. - SessionName() string - // SetSessionName assigns string provided by user to FlowRSVPPathSessionAttributeLspTunnelRa - SetSessionName(value string) FlowRSVPPathSessionAttributeLspTunnelRa - // HasSessionName checks if SessionName has been set in FlowRSVPPathSessionAttributeLspTunnelRa - HasSessionName() bool - setNil() -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// ExcludeAny returns a string -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) ExcludeAny() string { - - return *obj.obj.ExcludeAny - -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// ExcludeAny returns a string -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasExcludeAny() bool { - return obj.obj.ExcludeAny != nil -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// SetExcludeAny sets the string value in the FlowRSVPPathSessionAttributeLspTunnelRa object -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetExcludeAny(value string) FlowRSVPPathSessionAttributeLspTunnelRa { - - obj.obj.ExcludeAny = &value - return obj -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// IncludeAny returns a string -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) IncludeAny() string { - - return *obj.obj.IncludeAny - -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// IncludeAny returns a string -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasIncludeAny() bool { - return obj.obj.IncludeAny != nil -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// SetIncludeAny sets the string value in the FlowRSVPPathSessionAttributeLspTunnelRa object -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetIncludeAny(value string) FlowRSVPPathSessionAttributeLspTunnelRa { - - obj.obj.IncludeAny = &value - return obj -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// IncludeAll returns a string -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) IncludeAll() string { - - return *obj.obj.IncludeAll - -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// IncludeAll returns a string -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasIncludeAll() bool { - return obj.obj.IncludeAll != nil -} - -// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. -// SetIncludeAll sets the string value in the FlowRSVPPathSessionAttributeLspTunnelRa object -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetIncludeAll(value string) FlowRSVPPathSessionAttributeLspTunnelRa { - - obj.obj.IncludeAll = &value - return obj -} - -// The priority of the session with respect to taking resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. -// SetupPriority returns a uint32 -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetupPriority() uint32 { - - return *obj.obj.SetupPriority - -} - -// The priority of the session with respect to taking resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. -// SetupPriority returns a uint32 -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasSetupPriority() bool { - return obj.obj.SetupPriority != nil -} - -// The priority of the session with respect to taking resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. -// SetSetupPriority sets the uint32 value in the FlowRSVPPathSessionAttributeLspTunnelRa object -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetSetupPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnelRa { - - obj.obj.SetupPriority = &value - return obj -} - -// The priority of the session with respect to holding resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. -// HoldingPriority returns a uint32 -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HoldingPriority() uint32 { - - return *obj.obj.HoldingPriority - -} - -// The priority of the session with respect to holding resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. -// HoldingPriority returns a uint32 -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasHoldingPriority() bool { - return obj.obj.HoldingPriority != nil -} - -// The priority of the session with respect to holding resources,in the range of 0 to 7. The value 0 is the highest priority. The Setup Priority is used in deciding whether this session can preempt another session. -// SetHoldingPriority sets the uint32 value in the FlowRSVPPathSessionAttributeLspTunnelRa object -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetHoldingPriority(value uint32) FlowRSVPPathSessionAttributeLspTunnelRa { - - obj.obj.HoldingPriority = &value - return obj -} - -// 0x01 Local protection desired, 0x02 Label recording desired, 0x04 SE Style desired -// Flags returns a FlowRSVPLspTunnelFlag -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) Flags() FlowRSVPLspTunnelFlag { - if obj.obj.Flags == nil { - obj.obj.Flags = NewFlowRSVPLspTunnelFlag().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &flowRSVPLspTunnelFlag{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// 0x01 Local protection desired, 0x02 Label recording desired, 0x04 SE Style desired -// Flags returns a FlowRSVPLspTunnelFlag -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasFlags() bool { - return obj.obj.Flags != nil -} - -// 0x01 Local protection desired, 0x02 Label recording desired, 0x04 SE Style desired -// SetFlags sets the FlowRSVPLspTunnelFlag value in the FlowRSVPPathSessionAttributeLspTunnelRa object -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetFlags(value FlowRSVPLspTunnelFlag) FlowRSVPPathSessionAttributeLspTunnelRa { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// The length of the display string before padding, in bytes. -// NameLength returns a FlowRSVPSessionAttributeNameLength -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) NameLength() FlowRSVPSessionAttributeNameLength { - if obj.obj.NameLength == nil { - obj.obj.NameLength = NewFlowRSVPSessionAttributeNameLength().msg() - } - if obj.nameLengthHolder == nil { - obj.nameLengthHolder = &flowRSVPSessionAttributeNameLength{obj: obj.obj.NameLength} - } - return obj.nameLengthHolder -} - -// The length of the display string before padding, in bytes. -// NameLength returns a FlowRSVPSessionAttributeNameLength -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasNameLength() bool { - return obj.obj.NameLength != nil -} - -// The length of the display string before padding, in bytes. -// SetNameLength sets the FlowRSVPSessionAttributeNameLength value in the FlowRSVPPathSessionAttributeLspTunnelRa object -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetNameLength(value FlowRSVPSessionAttributeNameLength) FlowRSVPPathSessionAttributeLspTunnelRa { - - obj.nameLengthHolder = nil - obj.obj.NameLength = value.msg() - - return obj -} - -// A null padded string of characters. -// SessionName returns a string -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SessionName() string { - - return *obj.obj.SessionName - -} - -// A null padded string of characters. -// SessionName returns a string -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) HasSessionName() bool { - return obj.obj.SessionName != nil -} - -// A null padded string of characters. -// SetSessionName sets the string value in the FlowRSVPPathSessionAttributeLspTunnelRa object -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) SetSessionName(value string) FlowRSVPPathSessionAttributeLspTunnelRa { - - obj.obj.SessionName = &value - return obj -} - -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.ExcludeAny != nil { - - if len(*obj.obj.ExcludeAny) < 0 || len(*obj.obj.ExcludeAny) > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of FlowRSVPPathSessionAttributeLspTunnelRa.ExcludeAny <= 8 but Got %d", - len(*obj.obj.ExcludeAny))) - } - - } - - if obj.obj.IncludeAny != nil { - - if len(*obj.obj.IncludeAny) < 0 || len(*obj.obj.IncludeAny) > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of FlowRSVPPathSessionAttributeLspTunnelRa.IncludeAny <= 8 but Got %d", - len(*obj.obj.IncludeAny))) - } - - } - - if obj.obj.IncludeAll != nil { - - if len(*obj.obj.IncludeAll) < 0 || len(*obj.obj.IncludeAll) > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of FlowRSVPPathSessionAttributeLspTunnelRa.IncludeAll <= 8 but Got %d", - len(*obj.obj.IncludeAll))) - } - - } - - if obj.obj.SetupPriority != nil { - - if *obj.obj.SetupPriority > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowRSVPPathSessionAttributeLspTunnelRa.SetupPriority <= 7 but Got %d", *obj.obj.SetupPriority)) - } - - } - - if obj.obj.HoldingPriority != nil { - - if *obj.obj.HoldingPriority > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowRSVPPathSessionAttributeLspTunnelRa.HoldingPriority <= 7 but Got %d", *obj.obj.HoldingPriority)) - } - - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.NameLength != nil { - - obj.NameLength().validateObj(vObj, set_default) - } - - if obj.obj.SessionName != nil { - - if len(*obj.obj.SessionName) < 0 || len(*obj.obj.SessionName) > 254 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "0 <= length of FlowRSVPPathSessionAttributeLspTunnelRa.SessionName <= 254 but Got %d", - len(*obj.obj.SessionName))) - } - - } - -} - -func (obj *flowRSVPPathSessionAttributeLspTunnelRa) setDefault() { - if obj.obj.ExcludeAny == nil { - obj.SetExcludeAny("00") - } - if obj.obj.IncludeAny == nil { - obj.SetIncludeAny("00") - } - if obj.obj.IncludeAll == nil { - obj.SetIncludeAll("00") - } - if obj.obj.SetupPriority == nil { - obj.SetSetupPriority(7) - } - if obj.obj.HoldingPriority == nil { - obj.SetHoldingPriority(7) - } - if obj.obj.SessionName == nil { - obj.SetSessionName("") - } - -} - -// ***** FlowRSVPPathSenderTemplateLspTunnelIpv4 ***** -type flowRSVPPathSenderTemplateLspTunnelIpv4 struct { - validation - obj *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 - marshaller marshalFlowRSVPPathSenderTemplateLspTunnelIpv4 - unMarshaller unMarshalFlowRSVPPathSenderTemplateLspTunnelIpv4 - ipv4TunnelSenderAddressHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - reservedHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - lspIdHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId -} - -func NewFlowRSVPPathSenderTemplateLspTunnelIpv4() FlowRSVPPathSenderTemplateLspTunnelIpv4 { - obj := flowRSVPPathSenderTemplateLspTunnelIpv4{obj: &otg.FlowRSVPPathSenderTemplateLspTunnelIpv4{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) msg() *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 { - return obj.obj -} - -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) setMsg(msg *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4) FlowRSVPPathSenderTemplateLspTunnelIpv4 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathSenderTemplateLspTunnelIpv4 struct { - obj *flowRSVPPathSenderTemplateLspTunnelIpv4 -} - -type marshalFlowRSVPPathSenderTemplateLspTunnelIpv4 interface { - // ToProto marshals FlowRSVPPathSenderTemplateLspTunnelIpv4 to protobuf object *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 - ToProto() (*otg.FlowRSVPPathSenderTemplateLspTunnelIpv4, error) - // ToPbText marshals FlowRSVPPathSenderTemplateLspTunnelIpv4 to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathSenderTemplateLspTunnelIpv4 to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathSenderTemplateLspTunnelIpv4 to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathSenderTemplateLspTunnelIpv4 struct { - obj *flowRSVPPathSenderTemplateLspTunnelIpv4 -} - -type unMarshalFlowRSVPPathSenderTemplateLspTunnelIpv4 interface { - // FromProto unmarshals FlowRSVPPathSenderTemplateLspTunnelIpv4 from protobuf object *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 - FromProto(msg *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4) (FlowRSVPPathSenderTemplateLspTunnelIpv4, error) - // FromPbText unmarshals FlowRSVPPathSenderTemplateLspTunnelIpv4 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathSenderTemplateLspTunnelIpv4 from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathSenderTemplateLspTunnelIpv4 from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) Marshal() marshalFlowRSVPPathSenderTemplateLspTunnelIpv4 { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathSenderTemplateLspTunnelIpv4{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) Unmarshal() unMarshalFlowRSVPPathSenderTemplateLspTunnelIpv4 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathSenderTemplateLspTunnelIpv4{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathSenderTemplateLspTunnelIpv4) ToProto() (*otg.FlowRSVPPathSenderTemplateLspTunnelIpv4, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathSenderTemplateLspTunnelIpv4) FromProto(msg *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4) (FlowRSVPPathSenderTemplateLspTunnelIpv4, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathSenderTemplateLspTunnelIpv4) 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 *unMarshalflowRSVPPathSenderTemplateLspTunnelIpv4) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathSenderTemplateLspTunnelIpv4) 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 *unMarshalflowRSVPPathSenderTemplateLspTunnelIpv4) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathSenderTemplateLspTunnelIpv4) 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 *unMarshalflowRSVPPathSenderTemplateLspTunnelIpv4) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) Clone() (FlowRSVPPathSenderTemplateLspTunnelIpv4, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathSenderTemplateLspTunnelIpv4() - 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 -} - -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) setNil() { - obj.ipv4TunnelSenderAddressHolder = nil - obj.reservedHolder = nil - obj.lspIdHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathSenderTemplateLspTunnelIpv4 is class = SENDER_TEMPLATE, LSP_TUNNEL_IPv4 C-Type = 7 -type FlowRSVPPathSenderTemplateLspTunnelIpv4 interface { - Validation - // msg marshals FlowRSVPPathSenderTemplateLspTunnelIpv4 to protobuf object *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 - // and doesn't set defaults - msg() *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 - // setMsg unmarshals FlowRSVPPathSenderTemplateLspTunnelIpv4 from protobuf object *otg.FlowRSVPPathSenderTemplateLspTunnelIpv4 - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathSenderTemplateLspTunnelIpv4) FlowRSVPPathSenderTemplateLspTunnelIpv4 - // provides marshal interface - Marshal() marshalFlowRSVPPathSenderTemplateLspTunnelIpv4 - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathSenderTemplateLspTunnelIpv4 - // validate validates FlowRSVPPathSenderTemplateLspTunnelIpv4 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathSenderTemplateLspTunnelIpv4, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ipv4TunnelSenderAddress returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress, set in FlowRSVPPathSenderTemplateLspTunnelIpv4. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress is iPv4 address for a sender node. - Ipv4TunnelSenderAddress() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - // SetIpv4TunnelSenderAddress assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress provided by user to FlowRSVPPathSenderTemplateLspTunnelIpv4. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress is iPv4 address for a sender node. - SetIpv4TunnelSenderAddress(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) FlowRSVPPathSenderTemplateLspTunnelIpv4 - // HasIpv4TunnelSenderAddress checks if Ipv4TunnelSenderAddress has been set in FlowRSVPPathSenderTemplateLspTunnelIpv4 - HasIpv4TunnelSenderAddress() bool - // Reserved returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved, set in FlowRSVPPathSenderTemplateLspTunnelIpv4. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved is reserved field, MUST be zero. - Reserved() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - // SetReserved assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved provided by user to FlowRSVPPathSenderTemplateLspTunnelIpv4. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved is reserved field, MUST be zero. - SetReserved(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) FlowRSVPPathSenderTemplateLspTunnelIpv4 - // HasReserved checks if Reserved has been set in FlowRSVPPathSenderTemplateLspTunnelIpv4 - HasReserved() bool - // LspId returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId, set in FlowRSVPPathSenderTemplateLspTunnelIpv4. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId is a 16-bit identifier used in the SENDER_TEMPLATE that can be changed to allow a sender to share resources with itself. - LspId() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - // SetLspId assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId provided by user to FlowRSVPPathSenderTemplateLspTunnelIpv4. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId is a 16-bit identifier used in the SENDER_TEMPLATE that can be changed to allow a sender to share resources with itself. - SetLspId(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) FlowRSVPPathSenderTemplateLspTunnelIpv4 - // HasLspId checks if LspId has been set in FlowRSVPPathSenderTemplateLspTunnelIpv4 - HasLspId() bool - setNil() -} - -// description is TBD -// Ipv4TunnelSenderAddress returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) Ipv4TunnelSenderAddress() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { - if obj.obj.Ipv4TunnelSenderAddress == nil { - obj.obj.Ipv4TunnelSenderAddress = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress().msg() - } - if obj.ipv4TunnelSenderAddressHolder == nil { - obj.ipv4TunnelSenderAddressHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress{obj: obj.obj.Ipv4TunnelSenderAddress} - } - return obj.ipv4TunnelSenderAddressHolder -} - -// description is TBD -// Ipv4TunnelSenderAddress returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) HasIpv4TunnelSenderAddress() bool { - return obj.obj.Ipv4TunnelSenderAddress != nil -} - -// description is TBD -// SetIpv4TunnelSenderAddress sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress value in the FlowRSVPPathSenderTemplateLspTunnelIpv4 object -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) SetIpv4TunnelSenderAddress(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) FlowRSVPPathSenderTemplateLspTunnelIpv4 { - - obj.ipv4TunnelSenderAddressHolder = nil - obj.obj.Ipv4TunnelSenderAddress = value.msg() - - return obj -} - -// description is TBD -// Reserved returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) Reserved() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { - if obj.obj.Reserved == nil { - obj.obj.Reserved = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved().msg() - } - if obj.reservedHolder == nil { - obj.reservedHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved{obj: obj.obj.Reserved} - } - return obj.reservedHolder -} - -// description is TBD -// Reserved returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) HasReserved() bool { - return obj.obj.Reserved != nil -} - -// description is TBD -// SetReserved sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved value in the FlowRSVPPathSenderTemplateLspTunnelIpv4 object -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) SetReserved(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) FlowRSVPPathSenderTemplateLspTunnelIpv4 { - - obj.reservedHolder = nil - obj.obj.Reserved = value.msg() - - return obj -} - -// description is TBD -// LspId returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) LspId() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { - if obj.obj.LspId == nil { - obj.obj.LspId = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId().msg() - } - if obj.lspIdHolder == nil { - obj.lspIdHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId{obj: obj.obj.LspId} - } - return obj.lspIdHolder -} - -// description is TBD -// LspId returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) HasLspId() bool { - return obj.obj.LspId != nil -} - -// description is TBD -// SetLspId sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId value in the FlowRSVPPathSenderTemplateLspTunnelIpv4 object -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) SetLspId(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) FlowRSVPPathSenderTemplateLspTunnelIpv4 { - - obj.lspIdHolder = nil - obj.obj.LspId = value.msg() - - return obj -} - -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv4TunnelSenderAddress != nil { - - obj.Ipv4TunnelSenderAddress().validateObj(vObj, set_default) - } - - if obj.obj.Reserved != nil { - - obj.Reserved().validateObj(vObj, set_default) - } - - if obj.obj.LspId != nil { - - obj.LspId().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathSenderTemplateLspTunnelIpv4) setDefault() { - -} - -// ***** FlowRSVPPathSenderTspecIntServ ***** -type flowRSVPPathSenderTspecIntServ struct { - validation - obj *otg.FlowRSVPPathSenderTspecIntServ - marshaller marshalFlowRSVPPathSenderTspecIntServ - unMarshaller unMarshalFlowRSVPPathSenderTspecIntServ - versionHolder PatternFlowRSVPPathSenderTspecIntServVersion - reserved1Holder PatternFlowRSVPPathSenderTspecIntServReserved1 - overallLengthHolder PatternFlowRSVPPathSenderTspecIntServOverallLength - serviceHeaderHolder PatternFlowRSVPPathSenderTspecIntServServiceHeader - zeroBitHolder PatternFlowRSVPPathSenderTspecIntServZeroBit - reserved2Holder PatternFlowRSVPPathSenderTspecIntServReserved2 - lengthOfServiceDataHolder PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - parameterIdTokenBucketTspecHolder PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - parameter_127FlagHolder PatternFlowRSVPPathSenderTspecIntServParameter127Flag - parameter_127LengthHolder PatternFlowRSVPPathSenderTspecIntServParameter127Length - minimumPolicedUnitHolder PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - maximumPacketSizeHolder PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize -} - -func NewFlowRSVPPathSenderTspecIntServ() FlowRSVPPathSenderTspecIntServ { - obj := flowRSVPPathSenderTspecIntServ{obj: &otg.FlowRSVPPathSenderTspecIntServ{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathSenderTspecIntServ) msg() *otg.FlowRSVPPathSenderTspecIntServ { - return obj.obj -} - -func (obj *flowRSVPPathSenderTspecIntServ) setMsg(msg *otg.FlowRSVPPathSenderTspecIntServ) FlowRSVPPathSenderTspecIntServ { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathSenderTspecIntServ struct { - obj *flowRSVPPathSenderTspecIntServ -} - -type marshalFlowRSVPPathSenderTspecIntServ interface { - // ToProto marshals FlowRSVPPathSenderTspecIntServ to protobuf object *otg.FlowRSVPPathSenderTspecIntServ - ToProto() (*otg.FlowRSVPPathSenderTspecIntServ, error) - // ToPbText marshals FlowRSVPPathSenderTspecIntServ to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathSenderTspecIntServ to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathSenderTspecIntServ to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathSenderTspecIntServ struct { - obj *flowRSVPPathSenderTspecIntServ -} - -type unMarshalFlowRSVPPathSenderTspecIntServ interface { - // FromProto unmarshals FlowRSVPPathSenderTspecIntServ from protobuf object *otg.FlowRSVPPathSenderTspecIntServ - FromProto(msg *otg.FlowRSVPPathSenderTspecIntServ) (FlowRSVPPathSenderTspecIntServ, error) - // FromPbText unmarshals FlowRSVPPathSenderTspecIntServ from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathSenderTspecIntServ from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathSenderTspecIntServ from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathSenderTspecIntServ) Marshal() marshalFlowRSVPPathSenderTspecIntServ { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathSenderTspecIntServ{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathSenderTspecIntServ) Unmarshal() unMarshalFlowRSVPPathSenderTspecIntServ { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathSenderTspecIntServ{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathSenderTspecIntServ) ToProto() (*otg.FlowRSVPPathSenderTspecIntServ, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathSenderTspecIntServ) FromProto(msg *otg.FlowRSVPPathSenderTspecIntServ) (FlowRSVPPathSenderTspecIntServ, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathSenderTspecIntServ) 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 *unMarshalflowRSVPPathSenderTspecIntServ) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathSenderTspecIntServ) 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 *unMarshalflowRSVPPathSenderTspecIntServ) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathSenderTspecIntServ) 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 *unMarshalflowRSVPPathSenderTspecIntServ) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathSenderTspecIntServ) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathSenderTspecIntServ) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathSenderTspecIntServ) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathSenderTspecIntServ) Clone() (FlowRSVPPathSenderTspecIntServ, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathSenderTspecIntServ() - 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 -} - -func (obj *flowRSVPPathSenderTspecIntServ) setNil() { - obj.versionHolder = nil - obj.reserved1Holder = nil - obj.overallLengthHolder = nil - obj.serviceHeaderHolder = nil - obj.zeroBitHolder = nil - obj.reserved2Holder = nil - obj.lengthOfServiceDataHolder = nil - obj.parameterIdTokenBucketTspecHolder = nil - obj.parameter_127FlagHolder = nil - obj.parameter_127LengthHolder = nil - obj.minimumPolicedUnitHolder = nil - obj.maximumPacketSizeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathSenderTspecIntServ is int-serv SENDER_TSPEC object: Class = 12, C-Type = 2 -type FlowRSVPPathSenderTspecIntServ interface { - Validation - // msg marshals FlowRSVPPathSenderTspecIntServ to protobuf object *otg.FlowRSVPPathSenderTspecIntServ - // and doesn't set defaults - msg() *otg.FlowRSVPPathSenderTspecIntServ - // setMsg unmarshals FlowRSVPPathSenderTspecIntServ from protobuf object *otg.FlowRSVPPathSenderTspecIntServ - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathSenderTspecIntServ) FlowRSVPPathSenderTspecIntServ - // provides marshal interface - Marshal() marshalFlowRSVPPathSenderTspecIntServ - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathSenderTspecIntServ - // validate validates FlowRSVPPathSenderTspecIntServ - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathSenderTspecIntServ, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Version returns PatternFlowRSVPPathSenderTspecIntServVersion, set in FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServVersion is message format version number. - Version() PatternFlowRSVPPathSenderTspecIntServVersion - // SetVersion assigns PatternFlowRSVPPathSenderTspecIntServVersion provided by user to FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServVersion is message format version number. - SetVersion(value PatternFlowRSVPPathSenderTspecIntServVersion) FlowRSVPPathSenderTspecIntServ - // HasVersion checks if Version has been set in FlowRSVPPathSenderTspecIntServ - HasVersion() bool - // Reserved1 returns PatternFlowRSVPPathSenderTspecIntServReserved1, set in FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServReserved1 is reserved. - Reserved1() PatternFlowRSVPPathSenderTspecIntServReserved1 - // SetReserved1 assigns PatternFlowRSVPPathSenderTspecIntServReserved1 provided by user to FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServReserved1 is reserved. - SetReserved1(value PatternFlowRSVPPathSenderTspecIntServReserved1) FlowRSVPPathSenderTspecIntServ - // HasReserved1 checks if Reserved1 has been set in FlowRSVPPathSenderTspecIntServ - HasReserved1() bool - // OverallLength returns PatternFlowRSVPPathSenderTspecIntServOverallLength, set in FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServOverallLength is overall length (7 words not including header). - OverallLength() PatternFlowRSVPPathSenderTspecIntServOverallLength - // SetOverallLength assigns PatternFlowRSVPPathSenderTspecIntServOverallLength provided by user to FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServOverallLength is overall length (7 words not including header). - SetOverallLength(value PatternFlowRSVPPathSenderTspecIntServOverallLength) FlowRSVPPathSenderTspecIntServ - // HasOverallLength checks if OverallLength has been set in FlowRSVPPathSenderTspecIntServ - HasOverallLength() bool - // ServiceHeader returns PatternFlowRSVPPathSenderTspecIntServServiceHeader, set in FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServServiceHeader is service header, service number - '1' (Generic information) if in a PATH message. - ServiceHeader() PatternFlowRSVPPathSenderTspecIntServServiceHeader - // SetServiceHeader assigns PatternFlowRSVPPathSenderTspecIntServServiceHeader provided by user to FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServServiceHeader is service header, service number - '1' (Generic information) if in a PATH message. - SetServiceHeader(value PatternFlowRSVPPathSenderTspecIntServServiceHeader) FlowRSVPPathSenderTspecIntServ - // HasServiceHeader checks if ServiceHeader has been set in FlowRSVPPathSenderTspecIntServ - HasServiceHeader() bool - // ZeroBit returns PatternFlowRSVPPathSenderTspecIntServZeroBit, set in FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServZeroBit is mUST be 0. - ZeroBit() PatternFlowRSVPPathSenderTspecIntServZeroBit - // SetZeroBit assigns PatternFlowRSVPPathSenderTspecIntServZeroBit provided by user to FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServZeroBit is mUST be 0. - SetZeroBit(value PatternFlowRSVPPathSenderTspecIntServZeroBit) FlowRSVPPathSenderTspecIntServ - // HasZeroBit checks if ZeroBit has been set in FlowRSVPPathSenderTspecIntServ - HasZeroBit() bool - // Reserved2 returns PatternFlowRSVPPathSenderTspecIntServReserved2, set in FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServReserved2 is reserved. - Reserved2() PatternFlowRSVPPathSenderTspecIntServReserved2 - // SetReserved2 assigns PatternFlowRSVPPathSenderTspecIntServReserved2 provided by user to FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServReserved2 is reserved. - SetReserved2(value PatternFlowRSVPPathSenderTspecIntServReserved2) FlowRSVPPathSenderTspecIntServ - // HasReserved2 checks if Reserved2 has been set in FlowRSVPPathSenderTspecIntServ - HasReserved2() bool - // LengthOfServiceData returns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData, set in FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData is length of service data, 6 words not including per-service header. - LengthOfServiceData() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - // SetLengthOfServiceData assigns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData provided by user to FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData is length of service data, 6 words not including per-service header. - SetLengthOfServiceData(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) FlowRSVPPathSenderTspecIntServ - // HasLengthOfServiceData checks if LengthOfServiceData has been set in FlowRSVPPathSenderTspecIntServ - HasLengthOfServiceData() bool - // ParameterIdTokenBucketTspec returns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec, set in FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec is parameter ID, parameter 127 (Token Bucket TSpec) - ParameterIdTokenBucketTspec() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - // SetParameterIdTokenBucketTspec assigns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec provided by user to FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec is parameter ID, parameter 127 (Token Bucket TSpec) - SetParameterIdTokenBucketTspec(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) FlowRSVPPathSenderTspecIntServ - // HasParameterIdTokenBucketTspec checks if ParameterIdTokenBucketTspec has been set in FlowRSVPPathSenderTspecIntServ - HasParameterIdTokenBucketTspec() bool - // Parameter127Flag returns PatternFlowRSVPPathSenderTspecIntServParameter127Flag, set in FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServParameter127Flag is parameter 127 flags (none set) - Parameter127Flag() PatternFlowRSVPPathSenderTspecIntServParameter127Flag - // SetParameter127Flag assigns PatternFlowRSVPPathSenderTspecIntServParameter127Flag provided by user to FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServParameter127Flag is parameter 127 flags (none set) - SetParameter127Flag(value PatternFlowRSVPPathSenderTspecIntServParameter127Flag) FlowRSVPPathSenderTspecIntServ - // HasParameter127Flag checks if Parameter127Flag has been set in FlowRSVPPathSenderTspecIntServ - HasParameter127Flag() bool - // Parameter127Length returns PatternFlowRSVPPathSenderTspecIntServParameter127Length, set in FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServParameter127Length is parameter 127 length, 5 words not including per-service header - Parameter127Length() PatternFlowRSVPPathSenderTspecIntServParameter127Length - // SetParameter127Length assigns PatternFlowRSVPPathSenderTspecIntServParameter127Length provided by user to FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServParameter127Length is parameter 127 length, 5 words not including per-service header - SetParameter127Length(value PatternFlowRSVPPathSenderTspecIntServParameter127Length) FlowRSVPPathSenderTspecIntServ - // HasParameter127Length checks if Parameter127Length has been set in FlowRSVPPathSenderTspecIntServ - HasParameter127Length() bool - // TokenBucketRate returns float32, set in FlowRSVPPathSenderTspecIntServ. - TokenBucketRate() float32 - // SetTokenBucketRate assigns float32 provided by user to FlowRSVPPathSenderTspecIntServ - SetTokenBucketRate(value float32) FlowRSVPPathSenderTspecIntServ - // HasTokenBucketRate checks if TokenBucketRate has been set in FlowRSVPPathSenderTspecIntServ - HasTokenBucketRate() bool - // TokenBucketSize returns float32, set in FlowRSVPPathSenderTspecIntServ. - TokenBucketSize() float32 - // SetTokenBucketSize assigns float32 provided by user to FlowRSVPPathSenderTspecIntServ - SetTokenBucketSize(value float32) FlowRSVPPathSenderTspecIntServ - // HasTokenBucketSize checks if TokenBucketSize has been set in FlowRSVPPathSenderTspecIntServ - HasTokenBucketSize() bool - // PeakDataRate returns float32, set in FlowRSVPPathSenderTspecIntServ. - PeakDataRate() float32 - // SetPeakDataRate assigns float32 provided by user to FlowRSVPPathSenderTspecIntServ - SetPeakDataRate(value float32) FlowRSVPPathSenderTspecIntServ - // HasPeakDataRate checks if PeakDataRate has been set in FlowRSVPPathSenderTspecIntServ - HasPeakDataRate() bool - // MinimumPolicedUnit returns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit, set in FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit is the minimum policed unit parameter should generally be set equal to the size of the smallest packet generated by the application. - MinimumPolicedUnit() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - // SetMinimumPolicedUnit assigns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit provided by user to FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit is the minimum policed unit parameter should generally be set equal to the size of the smallest packet generated by the application. - SetMinimumPolicedUnit(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) FlowRSVPPathSenderTspecIntServ - // HasMinimumPolicedUnit checks if MinimumPolicedUnit has been set in FlowRSVPPathSenderTspecIntServ - HasMinimumPolicedUnit() bool - // MaximumPacketSize returns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize, set in FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize is the maximum packet size parameter should be set to the size of the largest packet the application might wish to generate. This value must, by definition, be equal to or larger than the value of The minimum policed unit. - MaximumPacketSize() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - // SetMaximumPacketSize assigns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize provided by user to FlowRSVPPathSenderTspecIntServ. - // PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize is the maximum packet size parameter should be set to the size of the largest packet the application might wish to generate. This value must, by definition, be equal to or larger than the value of The minimum policed unit. - SetMaximumPacketSize(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) FlowRSVPPathSenderTspecIntServ - // HasMaximumPacketSize checks if MaximumPacketSize has been set in FlowRSVPPathSenderTspecIntServ - HasMaximumPacketSize() bool - setNil() -} - -// description is TBD -// Version returns a PatternFlowRSVPPathSenderTspecIntServVersion -func (obj *flowRSVPPathSenderTspecIntServ) Version() PatternFlowRSVPPathSenderTspecIntServVersion { - if obj.obj.Version == nil { - obj.obj.Version = NewPatternFlowRSVPPathSenderTspecIntServVersion().msg() - } - if obj.versionHolder == nil { - obj.versionHolder = &patternFlowRSVPPathSenderTspecIntServVersion{obj: obj.obj.Version} - } - return obj.versionHolder -} - -// description is TBD -// Version returns a PatternFlowRSVPPathSenderTspecIntServVersion -func (obj *flowRSVPPathSenderTspecIntServ) HasVersion() bool { - return obj.obj.Version != nil -} - -// description is TBD -// SetVersion sets the PatternFlowRSVPPathSenderTspecIntServVersion value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetVersion(value PatternFlowRSVPPathSenderTspecIntServVersion) FlowRSVPPathSenderTspecIntServ { - - obj.versionHolder = nil - obj.obj.Version = value.msg() - - return obj -} - -// description is TBD -// Reserved1 returns a PatternFlowRSVPPathSenderTspecIntServReserved1 -func (obj *flowRSVPPathSenderTspecIntServ) Reserved1() PatternFlowRSVPPathSenderTspecIntServReserved1 { - if obj.obj.Reserved1 == nil { - obj.obj.Reserved1 = NewPatternFlowRSVPPathSenderTspecIntServReserved1().msg() - } - if obj.reserved1Holder == nil { - obj.reserved1Holder = &patternFlowRSVPPathSenderTspecIntServReserved1{obj: obj.obj.Reserved1} - } - return obj.reserved1Holder -} - -// description is TBD -// Reserved1 returns a PatternFlowRSVPPathSenderTspecIntServReserved1 -func (obj *flowRSVPPathSenderTspecIntServ) HasReserved1() bool { - return obj.obj.Reserved1 != nil -} - -// description is TBD -// SetReserved1 sets the PatternFlowRSVPPathSenderTspecIntServReserved1 value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetReserved1(value PatternFlowRSVPPathSenderTspecIntServReserved1) FlowRSVPPathSenderTspecIntServ { - - obj.reserved1Holder = nil - obj.obj.Reserved1 = value.msg() - - return obj -} - -// description is TBD -// OverallLength returns a PatternFlowRSVPPathSenderTspecIntServOverallLength -func (obj *flowRSVPPathSenderTspecIntServ) OverallLength() PatternFlowRSVPPathSenderTspecIntServOverallLength { - if obj.obj.OverallLength == nil { - obj.obj.OverallLength = NewPatternFlowRSVPPathSenderTspecIntServOverallLength().msg() - } - if obj.overallLengthHolder == nil { - obj.overallLengthHolder = &patternFlowRSVPPathSenderTspecIntServOverallLength{obj: obj.obj.OverallLength} - } - return obj.overallLengthHolder -} - -// description is TBD -// OverallLength returns a PatternFlowRSVPPathSenderTspecIntServOverallLength -func (obj *flowRSVPPathSenderTspecIntServ) HasOverallLength() bool { - return obj.obj.OverallLength != nil -} - -// description is TBD -// SetOverallLength sets the PatternFlowRSVPPathSenderTspecIntServOverallLength value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetOverallLength(value PatternFlowRSVPPathSenderTspecIntServOverallLength) FlowRSVPPathSenderTspecIntServ { - - obj.overallLengthHolder = nil - obj.obj.OverallLength = value.msg() - - return obj -} - -// description is TBD -// ServiceHeader returns a PatternFlowRSVPPathSenderTspecIntServServiceHeader -func (obj *flowRSVPPathSenderTspecIntServ) ServiceHeader() PatternFlowRSVPPathSenderTspecIntServServiceHeader { - if obj.obj.ServiceHeader == nil { - obj.obj.ServiceHeader = NewPatternFlowRSVPPathSenderTspecIntServServiceHeader().msg() - } - if obj.serviceHeaderHolder == nil { - obj.serviceHeaderHolder = &patternFlowRSVPPathSenderTspecIntServServiceHeader{obj: obj.obj.ServiceHeader} - } - return obj.serviceHeaderHolder -} - -// description is TBD -// ServiceHeader returns a PatternFlowRSVPPathSenderTspecIntServServiceHeader -func (obj *flowRSVPPathSenderTspecIntServ) HasServiceHeader() bool { - return obj.obj.ServiceHeader != nil -} - -// description is TBD -// SetServiceHeader sets the PatternFlowRSVPPathSenderTspecIntServServiceHeader value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetServiceHeader(value PatternFlowRSVPPathSenderTspecIntServServiceHeader) FlowRSVPPathSenderTspecIntServ { - - obj.serviceHeaderHolder = nil - obj.obj.ServiceHeader = value.msg() - - return obj -} - -// description is TBD -// ZeroBit returns a PatternFlowRSVPPathSenderTspecIntServZeroBit -func (obj *flowRSVPPathSenderTspecIntServ) ZeroBit() PatternFlowRSVPPathSenderTspecIntServZeroBit { - if obj.obj.ZeroBit == nil { - obj.obj.ZeroBit = NewPatternFlowRSVPPathSenderTspecIntServZeroBit().msg() - } - if obj.zeroBitHolder == nil { - obj.zeroBitHolder = &patternFlowRSVPPathSenderTspecIntServZeroBit{obj: obj.obj.ZeroBit} - } - return obj.zeroBitHolder -} - -// description is TBD -// ZeroBit returns a PatternFlowRSVPPathSenderTspecIntServZeroBit -func (obj *flowRSVPPathSenderTspecIntServ) HasZeroBit() bool { - return obj.obj.ZeroBit != nil -} - -// description is TBD -// SetZeroBit sets the PatternFlowRSVPPathSenderTspecIntServZeroBit value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetZeroBit(value PatternFlowRSVPPathSenderTspecIntServZeroBit) FlowRSVPPathSenderTspecIntServ { - - obj.zeroBitHolder = nil - obj.obj.ZeroBit = value.msg() - - return obj -} - -// description is TBD -// Reserved2 returns a PatternFlowRSVPPathSenderTspecIntServReserved2 -func (obj *flowRSVPPathSenderTspecIntServ) Reserved2() PatternFlowRSVPPathSenderTspecIntServReserved2 { - if obj.obj.Reserved2 == nil { - obj.obj.Reserved2 = NewPatternFlowRSVPPathSenderTspecIntServReserved2().msg() - } - if obj.reserved2Holder == nil { - obj.reserved2Holder = &patternFlowRSVPPathSenderTspecIntServReserved2{obj: obj.obj.Reserved2} - } - return obj.reserved2Holder -} - -// description is TBD -// Reserved2 returns a PatternFlowRSVPPathSenderTspecIntServReserved2 -func (obj *flowRSVPPathSenderTspecIntServ) HasReserved2() bool { - return obj.obj.Reserved2 != nil -} - -// description is TBD -// SetReserved2 sets the PatternFlowRSVPPathSenderTspecIntServReserved2 value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetReserved2(value PatternFlowRSVPPathSenderTspecIntServReserved2) FlowRSVPPathSenderTspecIntServ { - - obj.reserved2Holder = nil - obj.obj.Reserved2 = value.msg() - - return obj -} - -// description is TBD -// LengthOfServiceData returns a PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData -func (obj *flowRSVPPathSenderTspecIntServ) LengthOfServiceData() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { - if obj.obj.LengthOfServiceData == nil { - obj.obj.LengthOfServiceData = NewPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData().msg() - } - if obj.lengthOfServiceDataHolder == nil { - obj.lengthOfServiceDataHolder = &patternFlowRSVPPathSenderTspecIntServLengthOfServiceData{obj: obj.obj.LengthOfServiceData} - } - return obj.lengthOfServiceDataHolder -} - -// description is TBD -// LengthOfServiceData returns a PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData -func (obj *flowRSVPPathSenderTspecIntServ) HasLengthOfServiceData() bool { - return obj.obj.LengthOfServiceData != nil -} - -// description is TBD -// SetLengthOfServiceData sets the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetLengthOfServiceData(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) FlowRSVPPathSenderTspecIntServ { - - obj.lengthOfServiceDataHolder = nil - obj.obj.LengthOfServiceData = value.msg() - - return obj -} - -// description is TBD -// ParameterIdTokenBucketTspec returns a PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec -func (obj *flowRSVPPathSenderTspecIntServ) ParameterIdTokenBucketTspec() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { - if obj.obj.ParameterIdTokenBucketTspec == nil { - obj.obj.ParameterIdTokenBucketTspec = NewPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec().msg() - } - if obj.parameterIdTokenBucketTspecHolder == nil { - obj.parameterIdTokenBucketTspecHolder = &patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec{obj: obj.obj.ParameterIdTokenBucketTspec} - } - return obj.parameterIdTokenBucketTspecHolder -} - -// description is TBD -// ParameterIdTokenBucketTspec returns a PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec -func (obj *flowRSVPPathSenderTspecIntServ) HasParameterIdTokenBucketTspec() bool { - return obj.obj.ParameterIdTokenBucketTspec != nil -} - -// description is TBD -// SetParameterIdTokenBucketTspec sets the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetParameterIdTokenBucketTspec(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) FlowRSVPPathSenderTspecIntServ { - - obj.parameterIdTokenBucketTspecHolder = nil - obj.obj.ParameterIdTokenBucketTspec = value.msg() - - return obj -} - -// description is TBD -// Parameter127Flag returns a PatternFlowRSVPPathSenderTspecIntServParameter127Flag -func (obj *flowRSVPPathSenderTspecIntServ) Parameter127Flag() PatternFlowRSVPPathSenderTspecIntServParameter127Flag { - if obj.obj.Parameter_127Flag == nil { - obj.obj.Parameter_127Flag = NewPatternFlowRSVPPathSenderTspecIntServParameter127Flag().msg() - } - if obj.parameter_127FlagHolder == nil { - obj.parameter_127FlagHolder = &patternFlowRSVPPathSenderTspecIntServParameter127Flag{obj: obj.obj.Parameter_127Flag} - } - return obj.parameter_127FlagHolder -} - -// description is TBD -// Parameter127Flag returns a PatternFlowRSVPPathSenderTspecIntServParameter127Flag -func (obj *flowRSVPPathSenderTspecIntServ) HasParameter127Flag() bool { - return obj.obj.Parameter_127Flag != nil -} - -// description is TBD -// SetParameter127Flag sets the PatternFlowRSVPPathSenderTspecIntServParameter127Flag value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetParameter127Flag(value PatternFlowRSVPPathSenderTspecIntServParameter127Flag) FlowRSVPPathSenderTspecIntServ { - - obj.parameter_127FlagHolder = nil - obj.obj.Parameter_127Flag = value.msg() - - return obj -} - -// description is TBD -// Parameter127Length returns a PatternFlowRSVPPathSenderTspecIntServParameter127Length -func (obj *flowRSVPPathSenderTspecIntServ) Parameter127Length() PatternFlowRSVPPathSenderTspecIntServParameter127Length { - if obj.obj.Parameter_127Length == nil { - obj.obj.Parameter_127Length = NewPatternFlowRSVPPathSenderTspecIntServParameter127Length().msg() - } - if obj.parameter_127LengthHolder == nil { - obj.parameter_127LengthHolder = &patternFlowRSVPPathSenderTspecIntServParameter127Length{obj: obj.obj.Parameter_127Length} - } - return obj.parameter_127LengthHolder -} - -// description is TBD -// Parameter127Length returns a PatternFlowRSVPPathSenderTspecIntServParameter127Length -func (obj *flowRSVPPathSenderTspecIntServ) HasParameter127Length() bool { - return obj.obj.Parameter_127Length != nil -} - -// description is TBD -// SetParameter127Length sets the PatternFlowRSVPPathSenderTspecIntServParameter127Length value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetParameter127Length(value PatternFlowRSVPPathSenderTspecIntServParameter127Length) FlowRSVPPathSenderTspecIntServ { - - obj.parameter_127LengthHolder = nil - obj.obj.Parameter_127Length = value.msg() - - return obj -} - -// Token bucket rate is set to sender's view of its generated traffic. -// TokenBucketRate returns a float32 -func (obj *flowRSVPPathSenderTspecIntServ) TokenBucketRate() float32 { - - return *obj.obj.TokenBucketRate - -} - -// Token bucket rate is set to sender's view of its generated traffic. -// TokenBucketRate returns a float32 -func (obj *flowRSVPPathSenderTspecIntServ) HasTokenBucketRate() bool { - return obj.obj.TokenBucketRate != nil -} - -// Token bucket rate is set to sender's view of its generated traffic. -// SetTokenBucketRate sets the float32 value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetTokenBucketRate(value float32) FlowRSVPPathSenderTspecIntServ { - - obj.obj.TokenBucketRate = &value - return obj -} - -// Token bucket size is set to sender's view of its generated traffic. -// TokenBucketSize returns a float32 -func (obj *flowRSVPPathSenderTspecIntServ) TokenBucketSize() float32 { - - return *obj.obj.TokenBucketSize - -} - -// Token bucket size is set to sender's view of its generated traffic. -// TokenBucketSize returns a float32 -func (obj *flowRSVPPathSenderTspecIntServ) HasTokenBucketSize() bool { - return obj.obj.TokenBucketSize != nil -} - -// Token bucket size is set to sender's view of its generated traffic. -// SetTokenBucketSize sets the float32 value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetTokenBucketSize(value float32) FlowRSVPPathSenderTspecIntServ { - - obj.obj.TokenBucketSize = &value - return obj -} - -// The peak rate may be set to the sender's peak traffic generation rate (if known and controlled), the physical interface line rate (if known), or positive infinity (if no better value is available). -// PeakDataRate returns a float32 -func (obj *flowRSVPPathSenderTspecIntServ) PeakDataRate() float32 { - - return *obj.obj.PeakDataRate - -} - -// The peak rate may be set to the sender's peak traffic generation rate (if known and controlled), the physical interface line rate (if known), or positive infinity (if no better value is available). -// PeakDataRate returns a float32 -func (obj *flowRSVPPathSenderTspecIntServ) HasPeakDataRate() bool { - return obj.obj.PeakDataRate != nil -} - -// The peak rate may be set to the sender's peak traffic generation rate (if known and controlled), the physical interface line rate (if known), or positive infinity (if no better value is available). -// SetPeakDataRate sets the float32 value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetPeakDataRate(value float32) FlowRSVPPathSenderTspecIntServ { - - obj.obj.PeakDataRate = &value - return obj -} - -// description is TBD -// MinimumPolicedUnit returns a PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit -func (obj *flowRSVPPathSenderTspecIntServ) MinimumPolicedUnit() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { - if obj.obj.MinimumPolicedUnit == nil { - obj.obj.MinimumPolicedUnit = NewPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit().msg() - } - if obj.minimumPolicedUnitHolder == nil { - obj.minimumPolicedUnitHolder = &patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit{obj: obj.obj.MinimumPolicedUnit} - } - return obj.minimumPolicedUnitHolder -} - -// description is TBD -// MinimumPolicedUnit returns a PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit -func (obj *flowRSVPPathSenderTspecIntServ) HasMinimumPolicedUnit() bool { - return obj.obj.MinimumPolicedUnit != nil -} - -// description is TBD -// SetMinimumPolicedUnit sets the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetMinimumPolicedUnit(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) FlowRSVPPathSenderTspecIntServ { - - obj.minimumPolicedUnitHolder = nil - obj.obj.MinimumPolicedUnit = value.msg() - - return obj -} - -// description is TBD -// MaximumPacketSize returns a PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize -func (obj *flowRSVPPathSenderTspecIntServ) MaximumPacketSize() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { - if obj.obj.MaximumPacketSize == nil { - obj.obj.MaximumPacketSize = NewPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize().msg() - } - if obj.maximumPacketSizeHolder == nil { - obj.maximumPacketSizeHolder = &patternFlowRSVPPathSenderTspecIntServMaximumPacketSize{obj: obj.obj.MaximumPacketSize} - } - return obj.maximumPacketSizeHolder -} - -// description is TBD -// MaximumPacketSize returns a PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize -func (obj *flowRSVPPathSenderTspecIntServ) HasMaximumPacketSize() bool { - return obj.obj.MaximumPacketSize != nil -} - -// description is TBD -// SetMaximumPacketSize sets the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize value in the FlowRSVPPathSenderTspecIntServ object -func (obj *flowRSVPPathSenderTspecIntServ) SetMaximumPacketSize(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) FlowRSVPPathSenderTspecIntServ { - - obj.maximumPacketSizeHolder = nil - obj.obj.MaximumPacketSize = value.msg() - - return obj -} - -func (obj *flowRSVPPathSenderTspecIntServ) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Version != nil { - - obj.Version().validateObj(vObj, set_default) - } - - if obj.obj.Reserved1 != nil { - - obj.Reserved1().validateObj(vObj, set_default) - } - - if obj.obj.OverallLength != nil { - - obj.OverallLength().validateObj(vObj, set_default) - } - - if obj.obj.ServiceHeader != nil { - - obj.ServiceHeader().validateObj(vObj, set_default) - } - - if obj.obj.ZeroBit != nil { - - obj.ZeroBit().validateObj(vObj, set_default) - } - - if obj.obj.Reserved2 != nil { - - obj.Reserved2().validateObj(vObj, set_default) - } - - if obj.obj.LengthOfServiceData != nil { - - obj.LengthOfServiceData().validateObj(vObj, set_default) - } - - if obj.obj.ParameterIdTokenBucketTspec != nil { - - obj.ParameterIdTokenBucketTspec().validateObj(vObj, set_default) - } - - if obj.obj.Parameter_127Flag != nil { - - obj.Parameter127Flag().validateObj(vObj, set_default) - } - - if obj.obj.Parameter_127Length != nil { - - obj.Parameter127Length().validateObj(vObj, set_default) - } - - if obj.obj.MinimumPolicedUnit != nil { - - obj.MinimumPolicedUnit().validateObj(vObj, set_default) - } - - if obj.obj.MaximumPacketSize != nil { - - obj.MaximumPacketSize().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathSenderTspecIntServ) setDefault() { - if obj.obj.TokenBucketRate == nil { - obj.SetTokenBucketRate(0) - } - if obj.obj.TokenBucketSize == nil { - obj.SetTokenBucketSize(0) - } - if obj.obj.PeakDataRate == nil { - obj.SetPeakDataRate(0) - } - -} - -// ***** FlowRSVPPathRecordRouteType1 ***** -type flowRSVPPathRecordRouteType1 struct { - validation - obj *otg.FlowRSVPPathRecordRouteType1 - marshaller marshalFlowRSVPPathRecordRouteType1 - unMarshaller unMarshalFlowRSVPPathRecordRouteType1 - subobjectsHolder FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter -} - -func NewFlowRSVPPathRecordRouteType1() FlowRSVPPathRecordRouteType1 { - obj := flowRSVPPathRecordRouteType1{obj: &otg.FlowRSVPPathRecordRouteType1{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathRecordRouteType1) msg() *otg.FlowRSVPPathRecordRouteType1 { - return obj.obj -} - -func (obj *flowRSVPPathRecordRouteType1) setMsg(msg *otg.FlowRSVPPathRecordRouteType1) FlowRSVPPathRecordRouteType1 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathRecordRouteType1 struct { - obj *flowRSVPPathRecordRouteType1 -} - -type marshalFlowRSVPPathRecordRouteType1 interface { - // ToProto marshals FlowRSVPPathRecordRouteType1 to protobuf object *otg.FlowRSVPPathRecordRouteType1 - ToProto() (*otg.FlowRSVPPathRecordRouteType1, error) - // ToPbText marshals FlowRSVPPathRecordRouteType1 to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathRecordRouteType1 to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathRecordRouteType1 to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathRecordRouteType1 struct { - obj *flowRSVPPathRecordRouteType1 -} - -type unMarshalFlowRSVPPathRecordRouteType1 interface { - // FromProto unmarshals FlowRSVPPathRecordRouteType1 from protobuf object *otg.FlowRSVPPathRecordRouteType1 - FromProto(msg *otg.FlowRSVPPathRecordRouteType1) (FlowRSVPPathRecordRouteType1, error) - // FromPbText unmarshals FlowRSVPPathRecordRouteType1 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathRecordRouteType1 from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathRecordRouteType1 from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathRecordRouteType1) Marshal() marshalFlowRSVPPathRecordRouteType1 { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathRecordRouteType1{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathRecordRouteType1) Unmarshal() unMarshalFlowRSVPPathRecordRouteType1 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathRecordRouteType1{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathRecordRouteType1) ToProto() (*otg.FlowRSVPPathRecordRouteType1, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathRecordRouteType1) FromProto(msg *otg.FlowRSVPPathRecordRouteType1) (FlowRSVPPathRecordRouteType1, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathRecordRouteType1) 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 *unMarshalflowRSVPPathRecordRouteType1) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathRecordRouteType1) 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 *unMarshalflowRSVPPathRecordRouteType1) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathRecordRouteType1) 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 *unMarshalflowRSVPPathRecordRouteType1) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathRecordRouteType1) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathRecordRouteType1) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathRecordRouteType1) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathRecordRouteType1) Clone() (FlowRSVPPathRecordRouteType1, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathRecordRouteType1() - 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 -} - -func (obj *flowRSVPPathRecordRouteType1) setNil() { - obj.subobjectsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathRecordRouteType1 is type1 record route has list of subobjects. Currently supported subobjects are IPv4 address(1) and Label(3). -type FlowRSVPPathRecordRouteType1 interface { - Validation - // msg marshals FlowRSVPPathRecordRouteType1 to protobuf object *otg.FlowRSVPPathRecordRouteType1 - // and doesn't set defaults - msg() *otg.FlowRSVPPathRecordRouteType1 - // setMsg unmarshals FlowRSVPPathRecordRouteType1 from protobuf object *otg.FlowRSVPPathRecordRouteType1 - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathRecordRouteType1) FlowRSVPPathRecordRouteType1 - // provides marshal interface - Marshal() marshalFlowRSVPPathRecordRouteType1 - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathRecordRouteType1 - // validate validates FlowRSVPPathRecordRouteType1 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathRecordRouteType1, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Subobjects returns FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIterIter, set in FlowRSVPPathRecordRouteType1 - Subobjects() FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter - setNil() -} - -// description is TBD -// Subobjects returns a []FlowRSVPType1RecordRouteSubobjects -func (obj *flowRSVPPathRecordRouteType1) Subobjects() FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { - if len(obj.obj.Subobjects) == 0 { - obj.obj.Subobjects = []*otg.FlowRSVPType1RecordRouteSubobjects{} - } - if obj.subobjectsHolder == nil { - obj.subobjectsHolder = newFlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter(&obj.obj.Subobjects).setMsg(obj) - } - return obj.subobjectsHolder -} - -type flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter struct { - obj *flowRSVPPathRecordRouteType1 - flowRSVPType1RecordRouteSubobjectsSlice []FlowRSVPType1RecordRouteSubobjects - fieldPtr *[]*otg.FlowRSVPType1RecordRouteSubobjects -} - -func newFlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter(ptr *[]*otg.FlowRSVPType1RecordRouteSubobjects) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { - return &flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter{fieldPtr: ptr} -} - -type FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter interface { - setMsg(*flowRSVPPathRecordRouteType1) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter - Items() []FlowRSVPType1RecordRouteSubobjects - Add() FlowRSVPType1RecordRouteSubobjects - Append(items ...FlowRSVPType1RecordRouteSubobjects) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter - Set(index int, newObj FlowRSVPType1RecordRouteSubobjects) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter - Clear() FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter - clearHolderSlice() FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter - appendHolderSlice(item FlowRSVPType1RecordRouteSubobjects) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter -} - -func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) setMsg(msg *flowRSVPPathRecordRouteType1) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&flowRSVPType1RecordRouteSubobjects{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) Items() []FlowRSVPType1RecordRouteSubobjects { - return obj.flowRSVPType1RecordRouteSubobjectsSlice -} - -func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) Add() FlowRSVPType1RecordRouteSubobjects { - newObj := &otg.FlowRSVPType1RecordRouteSubobjects{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &flowRSVPType1RecordRouteSubobjects{obj: newObj} - newLibObj.setDefault() - obj.flowRSVPType1RecordRouteSubobjectsSlice = append(obj.flowRSVPType1RecordRouteSubobjectsSlice, newLibObj) - return newLibObj -} - -func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) Append(items ...FlowRSVPType1RecordRouteSubobjects) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.flowRSVPType1RecordRouteSubobjectsSlice = append(obj.flowRSVPType1RecordRouteSubobjectsSlice, item) - } - return obj -} - -func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) Set(index int, newObj FlowRSVPType1RecordRouteSubobjects) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.flowRSVPType1RecordRouteSubobjectsSlice[index] = newObj - return obj -} -func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) Clear() FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.FlowRSVPType1RecordRouteSubobjects{} - obj.flowRSVPType1RecordRouteSubobjectsSlice = []FlowRSVPType1RecordRouteSubobjects{} - } - return obj -} -func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) clearHolderSlice() FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { - if len(obj.flowRSVPType1RecordRouteSubobjectsSlice) > 0 { - obj.flowRSVPType1RecordRouteSubobjectsSlice = []FlowRSVPType1RecordRouteSubobjects{} - } - return obj -} -func (obj *flowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter) appendHolderSlice(item FlowRSVPType1RecordRouteSubobjects) FlowRSVPPathRecordRouteType1FlowRSVPType1RecordRouteSubobjectsIter { - obj.flowRSVPType1RecordRouteSubobjectsSlice = append(obj.flowRSVPType1RecordRouteSubobjectsSlice, item) - return obj -} - -func (obj *flowRSVPPathRecordRouteType1) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if len(obj.obj.Subobjects) != 0 { - - if set_default { - obj.Subobjects().clearHolderSlice() - for _, item := range obj.obj.Subobjects { - obj.Subobjects().appendHolderSlice(&flowRSVPType1RecordRouteSubobjects{obj: item}) - } - } - for _, item := range obj.Subobjects().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *flowRSVPPathRecordRouteType1) setDefault() { - -} - -// ***** PatternFlowRSVPPathObjectsCustomTypeCounter ***** -type patternFlowRSVPPathObjectsCustomTypeCounter struct { - validation - obj *otg.PatternFlowRSVPPathObjectsCustomTypeCounter - marshaller marshalPatternFlowRSVPPathObjectsCustomTypeCounter - unMarshaller unMarshalPatternFlowRSVPPathObjectsCustomTypeCounter -} - -func NewPatternFlowRSVPPathObjectsCustomTypeCounter() PatternFlowRSVPPathObjectsCustomTypeCounter { - obj := patternFlowRSVPPathObjectsCustomTypeCounter{obj: &otg.PatternFlowRSVPPathObjectsCustomTypeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) msg() *otg.PatternFlowRSVPPathObjectsCustomTypeCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) setMsg(msg *otg.PatternFlowRSVPPathObjectsCustomTypeCounter) PatternFlowRSVPPathObjectsCustomTypeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathObjectsCustomTypeCounter struct { - obj *patternFlowRSVPPathObjectsCustomTypeCounter -} - -type marshalPatternFlowRSVPPathObjectsCustomTypeCounter interface { - // ToProto marshals PatternFlowRSVPPathObjectsCustomTypeCounter to protobuf object *otg.PatternFlowRSVPPathObjectsCustomTypeCounter - ToProto() (*otg.PatternFlowRSVPPathObjectsCustomTypeCounter, error) - // ToPbText marshals PatternFlowRSVPPathObjectsCustomTypeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathObjectsCustomTypeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathObjectsCustomTypeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathObjectsCustomTypeCounter struct { - obj *patternFlowRSVPPathObjectsCustomTypeCounter -} - -type unMarshalPatternFlowRSVPPathObjectsCustomTypeCounter interface { - // FromProto unmarshals PatternFlowRSVPPathObjectsCustomTypeCounter from protobuf object *otg.PatternFlowRSVPPathObjectsCustomTypeCounter - FromProto(msg *otg.PatternFlowRSVPPathObjectsCustomTypeCounter) (PatternFlowRSVPPathObjectsCustomTypeCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathObjectsCustomTypeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathObjectsCustomTypeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathObjectsCustomTypeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) Marshal() marshalPatternFlowRSVPPathObjectsCustomTypeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathObjectsCustomTypeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) Unmarshal() unMarshalPatternFlowRSVPPathObjectsCustomTypeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathObjectsCustomTypeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathObjectsCustomTypeCounter) ToProto() (*otg.PatternFlowRSVPPathObjectsCustomTypeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathObjectsCustomTypeCounter) FromProto(msg *otg.PatternFlowRSVPPathObjectsCustomTypeCounter) (PatternFlowRSVPPathObjectsCustomTypeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathObjectsCustomTypeCounter) 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 *unMarshalpatternFlowRSVPPathObjectsCustomTypeCounter) 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 *marshalpatternFlowRSVPPathObjectsCustomTypeCounter) 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 *unMarshalpatternFlowRSVPPathObjectsCustomTypeCounter) 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 *marshalpatternFlowRSVPPathObjectsCustomTypeCounter) 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 *unMarshalpatternFlowRSVPPathObjectsCustomTypeCounter) 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 *patternFlowRSVPPathObjectsCustomTypeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) Clone() (PatternFlowRSVPPathObjectsCustomTypeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathObjectsCustomTypeCounter() - 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 -} - -// PatternFlowRSVPPathObjectsCustomTypeCounter is integer counter pattern -type PatternFlowRSVPPathObjectsCustomTypeCounter interface { - Validation - // msg marshals PatternFlowRSVPPathObjectsCustomTypeCounter to protobuf object *otg.PatternFlowRSVPPathObjectsCustomTypeCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathObjectsCustomTypeCounter - // setMsg unmarshals PatternFlowRSVPPathObjectsCustomTypeCounter from protobuf object *otg.PatternFlowRSVPPathObjectsCustomTypeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathObjectsCustomTypeCounter) PatternFlowRSVPPathObjectsCustomTypeCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathObjectsCustomTypeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathObjectsCustomTypeCounter - // validate validates PatternFlowRSVPPathObjectsCustomTypeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathObjectsCustomTypeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathObjectsCustomTypeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathObjectsCustomTypeCounter - SetStart(value uint32) PatternFlowRSVPPathObjectsCustomTypeCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathObjectsCustomTypeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathObjectsCustomTypeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathObjectsCustomTypeCounter - SetStep(value uint32) PatternFlowRSVPPathObjectsCustomTypeCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathObjectsCustomTypeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathObjectsCustomTypeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathObjectsCustomTypeCounter - SetCount(value uint32) PatternFlowRSVPPathObjectsCustomTypeCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathObjectsCustomTypeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathObjectsCustomTypeCounter object -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) SetStart(value uint32) PatternFlowRSVPPathObjectsCustomTypeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathObjectsCustomTypeCounter object -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) SetStep(value uint32) PatternFlowRSVPPathObjectsCustomTypeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathObjectsCustomTypeCounter object -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) SetCount(value uint32) PatternFlowRSVPPathObjectsCustomTypeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathObjectsCustomTypeCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathObjectsCustomTypeCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathObjectsCustomTypeCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** BgpAttributesTwoByteAsPathSegment ***** -type bgpAttributesTwoByteAsPathSegment struct { - validation - obj *otg.BgpAttributesTwoByteAsPathSegment - marshaller marshalBgpAttributesTwoByteAsPathSegment - unMarshaller unMarshalBgpAttributesTwoByteAsPathSegment -} - -func NewBgpAttributesTwoByteAsPathSegment() BgpAttributesTwoByteAsPathSegment { - obj := bgpAttributesTwoByteAsPathSegment{obj: &otg.BgpAttributesTwoByteAsPathSegment{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesTwoByteAsPathSegment) msg() *otg.BgpAttributesTwoByteAsPathSegment { - return obj.obj -} - -func (obj *bgpAttributesTwoByteAsPathSegment) setMsg(msg *otg.BgpAttributesTwoByteAsPathSegment) BgpAttributesTwoByteAsPathSegment { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesTwoByteAsPathSegment struct { - obj *bgpAttributesTwoByteAsPathSegment -} - -type marshalBgpAttributesTwoByteAsPathSegment interface { - // ToProto marshals BgpAttributesTwoByteAsPathSegment to protobuf object *otg.BgpAttributesTwoByteAsPathSegment - ToProto() (*otg.BgpAttributesTwoByteAsPathSegment, error) - // ToPbText marshals BgpAttributesTwoByteAsPathSegment to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesTwoByteAsPathSegment to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesTwoByteAsPathSegment to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesTwoByteAsPathSegment struct { - obj *bgpAttributesTwoByteAsPathSegment -} - -type unMarshalBgpAttributesTwoByteAsPathSegment interface { - // FromProto unmarshals BgpAttributesTwoByteAsPathSegment from protobuf object *otg.BgpAttributesTwoByteAsPathSegment - FromProto(msg *otg.BgpAttributesTwoByteAsPathSegment) (BgpAttributesTwoByteAsPathSegment, error) - // FromPbText unmarshals BgpAttributesTwoByteAsPathSegment from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesTwoByteAsPathSegment from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesTwoByteAsPathSegment from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesTwoByteAsPathSegment) Marshal() marshalBgpAttributesTwoByteAsPathSegment { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesTwoByteAsPathSegment{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesTwoByteAsPathSegment) Unmarshal() unMarshalBgpAttributesTwoByteAsPathSegment { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesTwoByteAsPathSegment{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesTwoByteAsPathSegment) ToProto() (*otg.BgpAttributesTwoByteAsPathSegment, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesTwoByteAsPathSegment) FromProto(msg *otg.BgpAttributesTwoByteAsPathSegment) (BgpAttributesTwoByteAsPathSegment, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesTwoByteAsPathSegment) 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 *unMarshalbgpAttributesTwoByteAsPathSegment) 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 *marshalbgpAttributesTwoByteAsPathSegment) 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 *unMarshalbgpAttributesTwoByteAsPathSegment) 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 *marshalbgpAttributesTwoByteAsPathSegment) 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 *unMarshalbgpAttributesTwoByteAsPathSegment) 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 *bgpAttributesTwoByteAsPathSegment) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesTwoByteAsPathSegment) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesTwoByteAsPathSegment) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesTwoByteAsPathSegment) Clone() (BgpAttributesTwoByteAsPathSegment, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesTwoByteAsPathSegment() - 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 -} - -// BgpAttributesTwoByteAsPathSegment is configuration for a single BGP AS path segment containing 2 byte AS numbers. -type BgpAttributesTwoByteAsPathSegment interface { - Validation - // msg marshals BgpAttributesTwoByteAsPathSegment to protobuf object *otg.BgpAttributesTwoByteAsPathSegment - // and doesn't set defaults - msg() *otg.BgpAttributesTwoByteAsPathSegment - // setMsg unmarshals BgpAttributesTwoByteAsPathSegment from protobuf object *otg.BgpAttributesTwoByteAsPathSegment - // and doesn't set defaults - setMsg(*otg.BgpAttributesTwoByteAsPathSegment) BgpAttributesTwoByteAsPathSegment - // provides marshal interface - Marshal() marshalBgpAttributesTwoByteAsPathSegment - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesTwoByteAsPathSegment - // validate validates BgpAttributesTwoByteAsPathSegment - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesTwoByteAsPathSegment, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Type returns BgpAttributesTwoByteAsPathSegmentTypeEnum, set in BgpAttributesTwoByteAsPathSegment - Type() BgpAttributesTwoByteAsPathSegmentTypeEnum - // SetType assigns BgpAttributesTwoByteAsPathSegmentTypeEnum provided by user to BgpAttributesTwoByteAsPathSegment - SetType(value BgpAttributesTwoByteAsPathSegmentTypeEnum) BgpAttributesTwoByteAsPathSegment - // HasType checks if Type has been set in BgpAttributesTwoByteAsPathSegment - HasType() bool - // AsNumbers returns []uint32, set in BgpAttributesTwoByteAsPathSegment. - AsNumbers() []uint32 - // SetAsNumbers assigns []uint32 provided by user to BgpAttributesTwoByteAsPathSegment - SetAsNumbers(value []uint32) BgpAttributesTwoByteAsPathSegment -} - -type BgpAttributesTwoByteAsPathSegmentTypeEnum string - -// Enum of Type on BgpAttributesTwoByteAsPathSegment -var BgpAttributesTwoByteAsPathSegmentType = struct { - AS_SEQ BgpAttributesTwoByteAsPathSegmentTypeEnum - AS_SET BgpAttributesTwoByteAsPathSegmentTypeEnum - AS_CONFED_SEQ BgpAttributesTwoByteAsPathSegmentTypeEnum - AS_CONFED_SET BgpAttributesTwoByteAsPathSegmentTypeEnum -}{ - AS_SEQ: BgpAttributesTwoByteAsPathSegmentTypeEnum("as_seq"), - AS_SET: BgpAttributesTwoByteAsPathSegmentTypeEnum("as_set"), - AS_CONFED_SEQ: BgpAttributesTwoByteAsPathSegmentTypeEnum("as_confed_seq"), - AS_CONFED_SET: BgpAttributesTwoByteAsPathSegmentTypeEnum("as_confed_set"), -} - -func (obj *bgpAttributesTwoByteAsPathSegment) Type() BgpAttributesTwoByteAsPathSegmentTypeEnum { - return BgpAttributesTwoByteAsPathSegmentTypeEnum(obj.obj.Type.Enum().String()) -} - -// AS sequence is the most common type of AS_PATH, it contains the list -// of ASNs starting with the most recent ASN being added read from left -// to right. -// The other three AS_PATH types are used for Confederations -// - AS_SET is the type of AS_PATH attribute that summarizes routes using -// using the aggregate-address command, allowing AS_PATHs to be summarized -// in the update as well. -// - AS_CONFED_SEQ gives the list of ASNs in the path starting with the most -// recent ASN to be added reading left to right -// - AS_CONFED_SET will allow summarization of multiple AS PATHs to be sent -// in BGP Updates. -// Type returns a string -func (obj *bgpAttributesTwoByteAsPathSegment) HasType() bool { - return obj.obj.Type != nil -} - -func (obj *bgpAttributesTwoByteAsPathSegment) SetType(value BgpAttributesTwoByteAsPathSegmentTypeEnum) BgpAttributesTwoByteAsPathSegment { - intValue, ok := otg.BgpAttributesTwoByteAsPathSegment_Type_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAttributesTwoByteAsPathSegmentTypeEnum", string(value))) - return obj - } - enumValue := otg.BgpAttributesTwoByteAsPathSegment_Type_Enum(intValue) - obj.obj.Type = &enumValue - - return obj -} - -// The 2 byte AS numbers in this AS path segment. -// AsNumbers returns a []uint32 -func (obj *bgpAttributesTwoByteAsPathSegment) AsNumbers() []uint32 { - if obj.obj.AsNumbers == nil { - obj.obj.AsNumbers = make([]uint32, 0) - } - return obj.obj.AsNumbers -} - -// The 2 byte AS numbers in this AS path segment. -// SetAsNumbers sets the []uint32 value in the BgpAttributesTwoByteAsPathSegment object -func (obj *bgpAttributesTwoByteAsPathSegment) SetAsNumbers(value []uint32) BgpAttributesTwoByteAsPathSegment { - - if obj.obj.AsNumbers == nil { - obj.obj.AsNumbers = make([]uint32, 0) - } - obj.obj.AsNumbers = value - - return obj -} - -func (obj *bgpAttributesTwoByteAsPathSegment) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.AsNumbers != nil { - - for _, item := range obj.obj.AsNumbers { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= BgpAttributesTwoByteAsPathSegment.AsNumbers <= 65535 but Got %d", item)) - } - - } - - } - -} - -func (obj *bgpAttributesTwoByteAsPathSegment) setDefault() { - if obj.obj.Type == nil { - obj.SetType(BgpAttributesTwoByteAsPathSegmentType.AS_SEQ) - - } - -} - -// ***** BgpAttributesBsid ***** -type bgpAttributesBsid struct { - validation - obj *otg.BgpAttributesBsid - marshaller marshalBgpAttributesBsid - unMarshaller unMarshalBgpAttributesBsid - mplsHolder BgpAttributesBsidMpls - srv6Holder BgpAttributesBsidSrv6 -} - -func NewBgpAttributesBsid() BgpAttributesBsid { - obj := bgpAttributesBsid{obj: &otg.BgpAttributesBsid{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesBsid) msg() *otg.BgpAttributesBsid { - return obj.obj -} - -func (obj *bgpAttributesBsid) setMsg(msg *otg.BgpAttributesBsid) BgpAttributesBsid { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesBsid struct { - obj *bgpAttributesBsid -} - -type marshalBgpAttributesBsid interface { - // ToProto marshals BgpAttributesBsid to protobuf object *otg.BgpAttributesBsid - ToProto() (*otg.BgpAttributesBsid, error) - // ToPbText marshals BgpAttributesBsid to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesBsid to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesBsid to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesBsid struct { - obj *bgpAttributesBsid -} - -type unMarshalBgpAttributesBsid interface { - // FromProto unmarshals BgpAttributesBsid from protobuf object *otg.BgpAttributesBsid - FromProto(msg *otg.BgpAttributesBsid) (BgpAttributesBsid, error) - // FromPbText unmarshals BgpAttributesBsid from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesBsid from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesBsid from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesBsid) Marshal() marshalBgpAttributesBsid { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesBsid{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesBsid) Unmarshal() unMarshalBgpAttributesBsid { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesBsid{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesBsid) ToProto() (*otg.BgpAttributesBsid, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesBsid) FromProto(msg *otg.BgpAttributesBsid) (BgpAttributesBsid, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesBsid) 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 *unMarshalbgpAttributesBsid) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesBsid) 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 *unMarshalbgpAttributesBsid) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesBsid) 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 *unMarshalbgpAttributesBsid) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesBsid) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesBsid) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesBsid) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesBsid) Clone() (BgpAttributesBsid, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesBsid() - 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 -} - -func (obj *bgpAttributesBsid) setNil() { - obj.mplsHolder = nil - obj.srv6Holder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesBsid is the Binding Segment Identifier is an optional sub-tlv of type 13 that can be sent with a SR Policy -// Tunnel Encapsulation attribute. -// When the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that -// BSID if this value (label in MPLS, IPv6 address in SRv6) is available. -// - The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . -// - It is recommended that if SRv6 Binding SID is desired to be signalled, the SRv6 Binding SID sub-TLV that enables -// the specification of the SRv6 Endpoint Behavior should be used. -type BgpAttributesBsid interface { - Validation - // msg marshals BgpAttributesBsid to protobuf object *otg.BgpAttributesBsid - // and doesn't set defaults - msg() *otg.BgpAttributesBsid - // setMsg unmarshals BgpAttributesBsid from protobuf object *otg.BgpAttributesBsid - // and doesn't set defaults - setMsg(*otg.BgpAttributesBsid) BgpAttributesBsid - // provides marshal interface - Marshal() marshalBgpAttributesBsid - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesBsid - // validate validates BgpAttributesBsid - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesBsid, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpAttributesBsidChoiceEnum, set in BgpAttributesBsid - Choice() BgpAttributesBsidChoiceEnum - // setChoice assigns BgpAttributesBsidChoiceEnum provided by user to BgpAttributesBsid - setChoice(value BgpAttributesBsidChoiceEnum) BgpAttributesBsid - // Mpls returns BgpAttributesBsidMpls, set in BgpAttributesBsid. - // BgpAttributesBsidMpls is when the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that BSID defined - // as a MPLS label.The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . - Mpls() BgpAttributesBsidMpls - // SetMpls assigns BgpAttributesBsidMpls provided by user to BgpAttributesBsid. - // BgpAttributesBsidMpls is when the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that BSID defined - // as a MPLS label.The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . - SetMpls(value BgpAttributesBsidMpls) BgpAttributesBsid - // HasMpls checks if Mpls has been set in BgpAttributesBsid - HasMpls() bool - // Srv6 returns BgpAttributesBsidSrv6, set in BgpAttributesBsid. - // BgpAttributesBsidSrv6 is when the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that BSID defined - // as an IPv6 Address.The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . - Srv6() BgpAttributesBsidSrv6 - // SetSrv6 assigns BgpAttributesBsidSrv6 provided by user to BgpAttributesBsid. - // BgpAttributesBsidSrv6 is when the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that BSID defined - // as an IPv6 Address.The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . - SetSrv6(value BgpAttributesBsidSrv6) BgpAttributesBsid - // HasSrv6 checks if Srv6 has been set in BgpAttributesBsid - HasSrv6() bool - setNil() -} - -type BgpAttributesBsidChoiceEnum string - -// Enum of Choice on BgpAttributesBsid -var BgpAttributesBsidChoice = struct { - MPLS BgpAttributesBsidChoiceEnum - SRV6 BgpAttributesBsidChoiceEnum -}{ - MPLS: BgpAttributesBsidChoiceEnum("mpls"), - SRV6: BgpAttributesBsidChoiceEnum("srv6"), -} - -func (obj *bgpAttributesBsid) Choice() BgpAttributesBsidChoiceEnum { - return BgpAttributesBsidChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *bgpAttributesBsid) setChoice(value BgpAttributesBsidChoiceEnum) BgpAttributesBsid { - intValue, ok := otg.BgpAttributesBsid_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAttributesBsidChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpAttributesBsid_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Srv6 = nil - obj.srv6Holder = nil - obj.obj.Mpls = nil - obj.mplsHolder = nil - - if value == BgpAttributesBsidChoice.MPLS { - obj.obj.Mpls = NewBgpAttributesBsidMpls().msg() - } - - if value == BgpAttributesBsidChoice.SRV6 { - obj.obj.Srv6 = NewBgpAttributesBsidSrv6().msg() - } - - return obj -} - -// description is TBD -// Mpls returns a BgpAttributesBsidMpls -func (obj *bgpAttributesBsid) Mpls() BgpAttributesBsidMpls { - if obj.obj.Mpls == nil { - obj.setChoice(BgpAttributesBsidChoice.MPLS) - } - if obj.mplsHolder == nil { - obj.mplsHolder = &bgpAttributesBsidMpls{obj: obj.obj.Mpls} - } - return obj.mplsHolder -} - -// description is TBD -// Mpls returns a BgpAttributesBsidMpls -func (obj *bgpAttributesBsid) HasMpls() bool { - return obj.obj.Mpls != nil -} - -// description is TBD -// SetMpls sets the BgpAttributesBsidMpls value in the BgpAttributesBsid object -func (obj *bgpAttributesBsid) SetMpls(value BgpAttributesBsidMpls) BgpAttributesBsid { - obj.setChoice(BgpAttributesBsidChoice.MPLS) - obj.mplsHolder = nil - obj.obj.Mpls = value.msg() - - return obj -} - -// description is TBD -// Srv6 returns a BgpAttributesBsidSrv6 -func (obj *bgpAttributesBsid) Srv6() BgpAttributesBsidSrv6 { - if obj.obj.Srv6 == nil { - obj.setChoice(BgpAttributesBsidChoice.SRV6) - } - if obj.srv6Holder == nil { - obj.srv6Holder = &bgpAttributesBsidSrv6{obj: obj.obj.Srv6} - } - return obj.srv6Holder -} - -// description is TBD -// Srv6 returns a BgpAttributesBsidSrv6 -func (obj *bgpAttributesBsid) HasSrv6() bool { - return obj.obj.Srv6 != nil -} - -// description is TBD -// SetSrv6 sets the BgpAttributesBsidSrv6 value in the BgpAttributesBsid object -func (obj *bgpAttributesBsid) SetSrv6(value BgpAttributesBsidSrv6) BgpAttributesBsid { - obj.setChoice(BgpAttributesBsidChoice.SRV6) - obj.srv6Holder = nil - obj.obj.Srv6 = value.msg() - - return obj -} - -func (obj *bgpAttributesBsid) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface BgpAttributesBsid") - } - - if obj.obj.Mpls != nil { - - obj.Mpls().validateObj(vObj, set_default) - } - - if obj.obj.Srv6 != nil { - - obj.Srv6().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesBsid) setDefault() { - var choices_set int = 0 - var choice BgpAttributesBsidChoiceEnum - - if obj.obj.Mpls != nil { - choices_set += 1 - choice = BgpAttributesBsidChoice.MPLS - } - - if obj.obj.Srv6 != nil { - choices_set += 1 - choice = BgpAttributesBsidChoice.SRV6 - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesBsid") - } - } else { - intVal := otg.BgpAttributesBsid_Choice_Enum_value[string(choice)] - enumValue := otg.BgpAttributesBsid_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpAttributesSrv6Bsid ***** -type bgpAttributesSrv6Bsid struct { - validation - obj *otg.BgpAttributesSrv6Bsid - marshaller marshalBgpAttributesSrv6Bsid - unMarshaller unMarshalBgpAttributesSrv6Bsid - srv6EndpointBehaviorHolder BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -} - -func NewBgpAttributesSrv6Bsid() BgpAttributesSrv6Bsid { - obj := bgpAttributesSrv6Bsid{obj: &otg.BgpAttributesSrv6Bsid{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSrv6Bsid) msg() *otg.BgpAttributesSrv6Bsid { - return obj.obj -} - -func (obj *bgpAttributesSrv6Bsid) setMsg(msg *otg.BgpAttributesSrv6Bsid) BgpAttributesSrv6Bsid { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSrv6Bsid struct { - obj *bgpAttributesSrv6Bsid -} - -type marshalBgpAttributesSrv6Bsid interface { - // ToProto marshals BgpAttributesSrv6Bsid to protobuf object *otg.BgpAttributesSrv6Bsid - ToProto() (*otg.BgpAttributesSrv6Bsid, error) - // ToPbText marshals BgpAttributesSrv6Bsid to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSrv6Bsid to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSrv6Bsid to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSrv6Bsid struct { - obj *bgpAttributesSrv6Bsid -} - -type unMarshalBgpAttributesSrv6Bsid interface { - // FromProto unmarshals BgpAttributesSrv6Bsid from protobuf object *otg.BgpAttributesSrv6Bsid - FromProto(msg *otg.BgpAttributesSrv6Bsid) (BgpAttributesSrv6Bsid, error) - // FromPbText unmarshals BgpAttributesSrv6Bsid from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSrv6Bsid from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSrv6Bsid from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSrv6Bsid) Marshal() marshalBgpAttributesSrv6Bsid { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSrv6Bsid{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSrv6Bsid) Unmarshal() unMarshalBgpAttributesSrv6Bsid { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSrv6Bsid{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSrv6Bsid) ToProto() (*otg.BgpAttributesSrv6Bsid, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSrv6Bsid) FromProto(msg *otg.BgpAttributesSrv6Bsid) (BgpAttributesSrv6Bsid, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSrv6Bsid) 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 *unMarshalbgpAttributesSrv6Bsid) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSrv6Bsid) 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 *unMarshalbgpAttributesSrv6Bsid) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSrv6Bsid) 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 *unMarshalbgpAttributesSrv6Bsid) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSrv6Bsid) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSrv6Bsid) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSrv6Bsid) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSrv6Bsid) Clone() (BgpAttributesSrv6Bsid, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSrv6Bsid() - 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 -} - -func (obj *bgpAttributesSrv6Bsid) setNil() { - obj.srv6EndpointBehaviorHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSrv6Bsid is the SRv6 Binding SID sub-TLV is an optional sub-TLV of type 20 that is used to signal the SRv6 Binding SID -// related information of an SR Policy candidate path. -// - More than one SRv6 Binding SID sub-TLVs MAY be signaled in the same SR Policy encoding to indicate one or -// more SRv6 SIDs, each with potentially different SRv6 Endpoint Behaviors to be instantiated. -// - The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.3 . -type BgpAttributesSrv6Bsid interface { - Validation - // msg marshals BgpAttributesSrv6Bsid to protobuf object *otg.BgpAttributesSrv6Bsid - // and doesn't set defaults - msg() *otg.BgpAttributesSrv6Bsid - // setMsg unmarshals BgpAttributesSrv6Bsid from protobuf object *otg.BgpAttributesSrv6Bsid - // and doesn't set defaults - setMsg(*otg.BgpAttributesSrv6Bsid) BgpAttributesSrv6Bsid - // provides marshal interface - Marshal() marshalBgpAttributesSrv6Bsid - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSrv6Bsid - // validate validates BgpAttributesSrv6Bsid - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSrv6Bsid, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // FlagSpecifiedBsidOnly returns bool, set in BgpAttributesSrv6Bsid. - FlagSpecifiedBsidOnly() bool - // SetFlagSpecifiedBsidOnly assigns bool provided by user to BgpAttributesSrv6Bsid - SetFlagSpecifiedBsidOnly(value bool) BgpAttributesSrv6Bsid - // HasFlagSpecifiedBsidOnly checks if FlagSpecifiedBsidOnly has been set in BgpAttributesSrv6Bsid - HasFlagSpecifiedBsidOnly() bool - // FlagDropUponInvalid returns bool, set in BgpAttributesSrv6Bsid. - FlagDropUponInvalid() bool - // SetFlagDropUponInvalid assigns bool provided by user to BgpAttributesSrv6Bsid - SetFlagDropUponInvalid(value bool) BgpAttributesSrv6Bsid - // HasFlagDropUponInvalid checks if FlagDropUponInvalid has been set in BgpAttributesSrv6Bsid - HasFlagDropUponInvalid() bool - // FlagSrv6EndpointBehavior returns bool, set in BgpAttributesSrv6Bsid. - FlagSrv6EndpointBehavior() bool - // SetFlagSrv6EndpointBehavior assigns bool provided by user to BgpAttributesSrv6Bsid - SetFlagSrv6EndpointBehavior(value bool) BgpAttributesSrv6Bsid - // HasFlagSrv6EndpointBehavior checks if FlagSrv6EndpointBehavior has been set in BgpAttributesSrv6Bsid - HasFlagSrv6EndpointBehavior() bool - // Ipv6Addr returns string, set in BgpAttributesSrv6Bsid. - Ipv6Addr() string - // SetIpv6Addr assigns string provided by user to BgpAttributesSrv6Bsid - SetIpv6Addr(value string) BgpAttributesSrv6Bsid - // HasIpv6Addr checks if Ipv6Addr has been set in BgpAttributesSrv6Bsid - HasIpv6Addr() bool - // Srv6EndpointBehavior returns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, set in BgpAttributesSrv6Bsid. - // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 - Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // SetSrv6EndpointBehavior assigns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure provided by user to BgpAttributesSrv6Bsid. - // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 - SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSrv6Bsid - // HasSrv6EndpointBehavior checks if Srv6EndpointBehavior has been set in BgpAttributesSrv6Bsid - HasSrv6EndpointBehavior() bool - setNil() -} - -// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is -// described in section 6.2.3 in [RFC9256]. -// FlagSpecifiedBsidOnly returns a bool -func (obj *bgpAttributesSrv6Bsid) FlagSpecifiedBsidOnly() bool { - - return *obj.obj.FlagSpecifiedBsidOnly - -} - -// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is -// described in section 6.2.3 in [RFC9256]. -// FlagSpecifiedBsidOnly returns a bool -func (obj *bgpAttributesSrv6Bsid) HasFlagSpecifiedBsidOnly() bool { - return obj.obj.FlagSpecifiedBsidOnly != nil -} - -// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is -// described in section 6.2.3 in [RFC9256]. -// SetFlagSpecifiedBsidOnly sets the bool value in the BgpAttributesSrv6Bsid object -func (obj *bgpAttributesSrv6Bsid) SetFlagSpecifiedBsidOnly(value bool) BgpAttributesSrv6Bsid { - - obj.obj.FlagSpecifiedBsidOnly = &value - return obj -} - -// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. -// It's usage is described in section 8.2 in [RFC9256]. -// FlagDropUponInvalid returns a bool -func (obj *bgpAttributesSrv6Bsid) FlagDropUponInvalid() bool { - - return *obj.obj.FlagDropUponInvalid - -} - -// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. -// It's usage is described in section 8.2 in [RFC9256]. -// FlagDropUponInvalid returns a bool -func (obj *bgpAttributesSrv6Bsid) HasFlagDropUponInvalid() bool { - return obj.obj.FlagDropUponInvalid != nil -} - -// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. -// It's usage is described in section 8.2 in [RFC9256]. -// SetFlagDropUponInvalid sets the bool value in the BgpAttributesSrv6Bsid object -func (obj *bgpAttributesSrv6Bsid) SetFlagDropUponInvalid(value bool) BgpAttributesSrv6Bsid { - - obj.obj.FlagDropUponInvalid = &value - return obj -} - -// B-Flag: This flag, when set, indicates the presence of the SRv6 Endpoint Behavior -// and SID Structure encoding specified in Section 2.4.4.2.4 of draft-ietf-idr-sr-policy-safi-02. -// FlagSrv6EndpointBehavior returns a bool -func (obj *bgpAttributesSrv6Bsid) FlagSrv6EndpointBehavior() bool { - - return *obj.obj.FlagSrv6EndpointBehavior - -} - -// B-Flag: This flag, when set, indicates the presence of the SRv6 Endpoint Behavior -// and SID Structure encoding specified in Section 2.4.4.2.4 of draft-ietf-idr-sr-policy-safi-02. -// FlagSrv6EndpointBehavior returns a bool -func (obj *bgpAttributesSrv6Bsid) HasFlagSrv6EndpointBehavior() bool { - return obj.obj.FlagSrv6EndpointBehavior != nil -} - -// B-Flag: This flag, when set, indicates the presence of the SRv6 Endpoint Behavior -// and SID Structure encoding specified in Section 2.4.4.2.4 of draft-ietf-idr-sr-policy-safi-02. -// SetFlagSrv6EndpointBehavior sets the bool value in the BgpAttributesSrv6Bsid object -func (obj *bgpAttributesSrv6Bsid) SetFlagSrv6EndpointBehavior(value bool) BgpAttributesSrv6Bsid { - - obj.obj.FlagSrv6EndpointBehavior = &value - return obj -} - -// IPv6 address denoting the SRv6 SID. -// Ipv6Addr returns a string -func (obj *bgpAttributesSrv6Bsid) Ipv6Addr() string { - - return *obj.obj.Ipv6Addr - -} - -// IPv6 address denoting the SRv6 SID. -// Ipv6Addr returns a string -func (obj *bgpAttributesSrv6Bsid) HasIpv6Addr() bool { - return obj.obj.Ipv6Addr != nil -} - -// IPv6 address denoting the SRv6 SID. -// SetIpv6Addr sets the string value in the BgpAttributesSrv6Bsid object -func (obj *bgpAttributesSrv6Bsid) SetIpv6Addr(value string) BgpAttributesSrv6Bsid { - - obj.obj.Ipv6Addr = &value - return obj -} - -// description is TBD -// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -func (obj *bgpAttributesSrv6Bsid) Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - if obj.obj.Srv6EndpointBehavior == nil { - obj.obj.Srv6EndpointBehavior = NewBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure().msg() - } - if obj.srv6EndpointBehaviorHolder == nil { - obj.srv6EndpointBehaviorHolder = &bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6EndpointBehavior} - } - return obj.srv6EndpointBehaviorHolder -} - -// description is TBD -// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -func (obj *bgpAttributesSrv6Bsid) HasSrv6EndpointBehavior() bool { - return obj.obj.Srv6EndpointBehavior != nil -} - -// description is TBD -// SetSrv6EndpointBehavior sets the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure value in the BgpAttributesSrv6Bsid object -func (obj *bgpAttributesSrv6Bsid) SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSrv6Bsid { - - obj.srv6EndpointBehaviorHolder = nil - obj.obj.Srv6EndpointBehavior = value.msg() - - return obj -} - -func (obj *bgpAttributesSrv6Bsid) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv6Addr != nil { - - err := obj.validateIpv6(obj.Ipv6Addr()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSrv6Bsid.Ipv6Addr")) - } - - } - - if obj.obj.Srv6EndpointBehavior != nil { - - obj.Srv6EndpointBehavior().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesSrv6Bsid) setDefault() { - if obj.obj.FlagSpecifiedBsidOnly == nil { - obj.SetFlagSpecifiedBsidOnly(false) - } - if obj.obj.FlagDropUponInvalid == nil { - obj.SetFlagDropUponInvalid(false) - } - if obj.obj.FlagSrv6EndpointBehavior == nil { - obj.SetFlagSrv6EndpointBehavior(false) - } - if obj.obj.Ipv6Addr == nil { - obj.SetIpv6Addr("0::0") - } - -} - -// ***** BgpAttributesSrPolicyPreference ***** -type bgpAttributesSrPolicyPreference struct { - validation - obj *otg.BgpAttributesSrPolicyPreference - marshaller marshalBgpAttributesSrPolicyPreference - unMarshaller unMarshalBgpAttributesSrPolicyPreference -} - -func NewBgpAttributesSrPolicyPreference() BgpAttributesSrPolicyPreference { - obj := bgpAttributesSrPolicyPreference{obj: &otg.BgpAttributesSrPolicyPreference{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSrPolicyPreference) msg() *otg.BgpAttributesSrPolicyPreference { - return obj.obj -} - -func (obj *bgpAttributesSrPolicyPreference) setMsg(msg *otg.BgpAttributesSrPolicyPreference) BgpAttributesSrPolicyPreference { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSrPolicyPreference struct { - obj *bgpAttributesSrPolicyPreference -} - -type marshalBgpAttributesSrPolicyPreference interface { - // ToProto marshals BgpAttributesSrPolicyPreference to protobuf object *otg.BgpAttributesSrPolicyPreference - ToProto() (*otg.BgpAttributesSrPolicyPreference, error) - // ToPbText marshals BgpAttributesSrPolicyPreference to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSrPolicyPreference to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSrPolicyPreference to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSrPolicyPreference struct { - obj *bgpAttributesSrPolicyPreference -} - -type unMarshalBgpAttributesSrPolicyPreference interface { - // FromProto unmarshals BgpAttributesSrPolicyPreference from protobuf object *otg.BgpAttributesSrPolicyPreference - FromProto(msg *otg.BgpAttributesSrPolicyPreference) (BgpAttributesSrPolicyPreference, error) - // FromPbText unmarshals BgpAttributesSrPolicyPreference from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSrPolicyPreference from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSrPolicyPreference from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSrPolicyPreference) Marshal() marshalBgpAttributesSrPolicyPreference { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSrPolicyPreference{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSrPolicyPreference) Unmarshal() unMarshalBgpAttributesSrPolicyPreference { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSrPolicyPreference{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSrPolicyPreference) ToProto() (*otg.BgpAttributesSrPolicyPreference, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSrPolicyPreference) FromProto(msg *otg.BgpAttributesSrPolicyPreference) (BgpAttributesSrPolicyPreference, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSrPolicyPreference) 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 *unMarshalbgpAttributesSrPolicyPreference) 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 *marshalbgpAttributesSrPolicyPreference) 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 *unMarshalbgpAttributesSrPolicyPreference) 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 *marshalbgpAttributesSrPolicyPreference) 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 *unMarshalbgpAttributesSrPolicyPreference) 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 *bgpAttributesSrPolicyPreference) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSrPolicyPreference) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSrPolicyPreference) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSrPolicyPreference) Clone() (BgpAttributesSrPolicyPreference, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSrPolicyPreference() - 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 -} - -// BgpAttributesSrPolicyPreference is optional Preference sub-tlv (Type 12) is used to select the best candidate path for an SR Policy. -// It is defined in Section 2.4.1 of draft-ietf-idr-sr-policy-safi-02 . - -type BgpAttributesSrPolicyPreference interface { - Validation - // msg marshals BgpAttributesSrPolicyPreference to protobuf object *otg.BgpAttributesSrPolicyPreference - // and doesn't set defaults - msg() *otg.BgpAttributesSrPolicyPreference - // setMsg unmarshals BgpAttributesSrPolicyPreference from protobuf object *otg.BgpAttributesSrPolicyPreference - // and doesn't set defaults - setMsg(*otg.BgpAttributesSrPolicyPreference) BgpAttributesSrPolicyPreference - // provides marshal interface - Marshal() marshalBgpAttributesSrPolicyPreference - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSrPolicyPreference - // validate validates BgpAttributesSrPolicyPreference - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSrPolicyPreference, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Value returns uint32, set in BgpAttributesSrPolicyPreference. - Value() uint32 - // SetValue assigns uint32 provided by user to BgpAttributesSrPolicyPreference - SetValue(value uint32) BgpAttributesSrPolicyPreference - // HasValue checks if Value has been set in BgpAttributesSrPolicyPreference - HasValue() bool -} - -// Value to be carried in the Preference sub-tlv. -// Value returns a uint32 -func (obj *bgpAttributesSrPolicyPreference) Value() uint32 { - - return *obj.obj.Value - -} - -// Value to be carried in the Preference sub-tlv. -// Value returns a uint32 -func (obj *bgpAttributesSrPolicyPreference) HasValue() bool { - return obj.obj.Value != nil -} - -// Value to be carried in the Preference sub-tlv. -// SetValue sets the uint32 value in the BgpAttributesSrPolicyPreference object -func (obj *bgpAttributesSrPolicyPreference) SetValue(value uint32) BgpAttributesSrPolicyPreference { - - obj.obj.Value = &value - return obj -} - -func (obj *bgpAttributesSrPolicyPreference) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpAttributesSrPolicyPreference) setDefault() { - if obj.obj.Value == nil { - obj.SetValue(0) - } - -} - -// ***** BgpAttributesSrPolicyPriority ***** -type bgpAttributesSrPolicyPriority struct { - validation - obj *otg.BgpAttributesSrPolicyPriority - marshaller marshalBgpAttributesSrPolicyPriority - unMarshaller unMarshalBgpAttributesSrPolicyPriority -} - -func NewBgpAttributesSrPolicyPriority() BgpAttributesSrPolicyPriority { - obj := bgpAttributesSrPolicyPriority{obj: &otg.BgpAttributesSrPolicyPriority{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSrPolicyPriority) msg() *otg.BgpAttributesSrPolicyPriority { - return obj.obj -} - -func (obj *bgpAttributesSrPolicyPriority) setMsg(msg *otg.BgpAttributesSrPolicyPriority) BgpAttributesSrPolicyPriority { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSrPolicyPriority struct { - obj *bgpAttributesSrPolicyPriority -} - -type marshalBgpAttributesSrPolicyPriority interface { - // ToProto marshals BgpAttributesSrPolicyPriority to protobuf object *otg.BgpAttributesSrPolicyPriority - ToProto() (*otg.BgpAttributesSrPolicyPriority, error) - // ToPbText marshals BgpAttributesSrPolicyPriority to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSrPolicyPriority to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSrPolicyPriority to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSrPolicyPriority struct { - obj *bgpAttributesSrPolicyPriority -} - -type unMarshalBgpAttributesSrPolicyPriority interface { - // FromProto unmarshals BgpAttributesSrPolicyPriority from protobuf object *otg.BgpAttributesSrPolicyPriority - FromProto(msg *otg.BgpAttributesSrPolicyPriority) (BgpAttributesSrPolicyPriority, error) - // FromPbText unmarshals BgpAttributesSrPolicyPriority from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSrPolicyPriority from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSrPolicyPriority from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSrPolicyPriority) Marshal() marshalBgpAttributesSrPolicyPriority { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSrPolicyPriority{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSrPolicyPriority) Unmarshal() unMarshalBgpAttributesSrPolicyPriority { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSrPolicyPriority{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSrPolicyPriority) ToProto() (*otg.BgpAttributesSrPolicyPriority, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSrPolicyPriority) FromProto(msg *otg.BgpAttributesSrPolicyPriority) (BgpAttributesSrPolicyPriority, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSrPolicyPriority) 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 *unMarshalbgpAttributesSrPolicyPriority) 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 *marshalbgpAttributesSrPolicyPriority) 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 *unMarshalbgpAttributesSrPolicyPriority) 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 *marshalbgpAttributesSrPolicyPriority) 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 *unMarshalbgpAttributesSrPolicyPriority) 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 *bgpAttributesSrPolicyPriority) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSrPolicyPriority) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSrPolicyPriority) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSrPolicyPriority) Clone() (BgpAttributesSrPolicyPriority, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSrPolicyPriority() - 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 -} - -// BgpAttributesSrPolicyPriority is optional Priority sub-tlv (Type 15) used to select the order in which policies should be re-computed. -// - It is defined in Section 2.4.6 of draft-ietf-idr-sr-policy-safi-02 . -type BgpAttributesSrPolicyPriority interface { - Validation - // msg marshals BgpAttributesSrPolicyPriority to protobuf object *otg.BgpAttributesSrPolicyPriority - // and doesn't set defaults - msg() *otg.BgpAttributesSrPolicyPriority - // setMsg unmarshals BgpAttributesSrPolicyPriority from protobuf object *otg.BgpAttributesSrPolicyPriority - // and doesn't set defaults - setMsg(*otg.BgpAttributesSrPolicyPriority) BgpAttributesSrPolicyPriority - // provides marshal interface - Marshal() marshalBgpAttributesSrPolicyPriority - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSrPolicyPriority - // validate validates BgpAttributesSrPolicyPriority - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSrPolicyPriority, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Value returns uint32, set in BgpAttributesSrPolicyPriority. - Value() uint32 - // SetValue assigns uint32 provided by user to BgpAttributesSrPolicyPriority - SetValue(value uint32) BgpAttributesSrPolicyPriority - // HasValue checks if Value has been set in BgpAttributesSrPolicyPriority - HasValue() bool -} - -// Value to be carried in the Priority sub-tlv. -// Value returns a uint32 -func (obj *bgpAttributesSrPolicyPriority) Value() uint32 { - - return *obj.obj.Value - -} - -// Value to be carried in the Priority sub-tlv. -// Value returns a uint32 -func (obj *bgpAttributesSrPolicyPriority) HasValue() bool { - return obj.obj.Value != nil -} - -// Value to be carried in the Priority sub-tlv. -// SetValue sets the uint32 value in the BgpAttributesSrPolicyPriority object -func (obj *bgpAttributesSrPolicyPriority) SetValue(value uint32) BgpAttributesSrPolicyPriority { - - obj.obj.Value = &value - return obj -} - -func (obj *bgpAttributesSrPolicyPriority) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesSrPolicyPriority.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - -} - -func (obj *bgpAttributesSrPolicyPriority) setDefault() { - if obj.obj.Value == nil { - obj.SetValue(0) - } - -} - -// ***** BgpAttributesSrPolicyPolicyName ***** -type bgpAttributesSrPolicyPolicyName struct { - validation - obj *otg.BgpAttributesSrPolicyPolicyName - marshaller marshalBgpAttributesSrPolicyPolicyName - unMarshaller unMarshalBgpAttributesSrPolicyPolicyName -} - -func NewBgpAttributesSrPolicyPolicyName() BgpAttributesSrPolicyPolicyName { - obj := bgpAttributesSrPolicyPolicyName{obj: &otg.BgpAttributesSrPolicyPolicyName{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSrPolicyPolicyName) msg() *otg.BgpAttributesSrPolicyPolicyName { - return obj.obj -} - -func (obj *bgpAttributesSrPolicyPolicyName) setMsg(msg *otg.BgpAttributesSrPolicyPolicyName) BgpAttributesSrPolicyPolicyName { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSrPolicyPolicyName struct { - obj *bgpAttributesSrPolicyPolicyName -} - -type marshalBgpAttributesSrPolicyPolicyName interface { - // ToProto marshals BgpAttributesSrPolicyPolicyName to protobuf object *otg.BgpAttributesSrPolicyPolicyName - ToProto() (*otg.BgpAttributesSrPolicyPolicyName, error) - // ToPbText marshals BgpAttributesSrPolicyPolicyName to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSrPolicyPolicyName to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSrPolicyPolicyName to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSrPolicyPolicyName struct { - obj *bgpAttributesSrPolicyPolicyName -} - -type unMarshalBgpAttributesSrPolicyPolicyName interface { - // FromProto unmarshals BgpAttributesSrPolicyPolicyName from protobuf object *otg.BgpAttributesSrPolicyPolicyName - FromProto(msg *otg.BgpAttributesSrPolicyPolicyName) (BgpAttributesSrPolicyPolicyName, error) - // FromPbText unmarshals BgpAttributesSrPolicyPolicyName from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSrPolicyPolicyName from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSrPolicyPolicyName from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSrPolicyPolicyName) Marshal() marshalBgpAttributesSrPolicyPolicyName { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSrPolicyPolicyName{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSrPolicyPolicyName) Unmarshal() unMarshalBgpAttributesSrPolicyPolicyName { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSrPolicyPolicyName{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSrPolicyPolicyName) ToProto() (*otg.BgpAttributesSrPolicyPolicyName, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSrPolicyPolicyName) FromProto(msg *otg.BgpAttributesSrPolicyPolicyName) (BgpAttributesSrPolicyPolicyName, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSrPolicyPolicyName) 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 *unMarshalbgpAttributesSrPolicyPolicyName) 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 *marshalbgpAttributesSrPolicyPolicyName) 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 *unMarshalbgpAttributesSrPolicyPolicyName) 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 *marshalbgpAttributesSrPolicyPolicyName) 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 *unMarshalbgpAttributesSrPolicyPolicyName) 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 *bgpAttributesSrPolicyPolicyName) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSrPolicyPolicyName) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSrPolicyPolicyName) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSrPolicyPolicyName) Clone() (BgpAttributesSrPolicyPolicyName, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSrPolicyPolicyName() - 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 -} - -// BgpAttributesSrPolicyPolicyName is optional Policy Name sub-tlv (Type 130) which carries the symbolic name for the SR Policy for which the -// candidate path is being advertised for debugging. -// - It is defined in Section 2.4.8 of draft-ietf-idr-sr-policy-safi-02 . -type BgpAttributesSrPolicyPolicyName interface { - Validation - // msg marshals BgpAttributesSrPolicyPolicyName to protobuf object *otg.BgpAttributesSrPolicyPolicyName - // and doesn't set defaults - msg() *otg.BgpAttributesSrPolicyPolicyName - // setMsg unmarshals BgpAttributesSrPolicyPolicyName from protobuf object *otg.BgpAttributesSrPolicyPolicyName - // and doesn't set defaults - setMsg(*otg.BgpAttributesSrPolicyPolicyName) BgpAttributesSrPolicyPolicyName - // provides marshal interface - Marshal() marshalBgpAttributesSrPolicyPolicyName - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSrPolicyPolicyName - // validate validates BgpAttributesSrPolicyPolicyName - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSrPolicyPolicyName, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Value returns string, set in BgpAttributesSrPolicyPolicyName. - Value() string - // SetValue assigns string provided by user to BgpAttributesSrPolicyPolicyName - SetValue(value string) BgpAttributesSrPolicyPolicyName -} - -// Value of the symbolic policy name carried in the Policy Name sub-tlv. -// It is recommended that the size of the name is limited to 255 bytes. -// Value returns a string -func (obj *bgpAttributesSrPolicyPolicyName) Value() string { - - return *obj.obj.Value - -} - -// Value of the symbolic policy name carried in the Policy Name sub-tlv. -// It is recommended that the size of the name is limited to 255 bytes. -// SetValue sets the string value in the BgpAttributesSrPolicyPolicyName object -func (obj *bgpAttributesSrPolicyPolicyName) SetValue(value string) BgpAttributesSrPolicyPolicyName { - - obj.obj.Value = &value - return obj -} - -func (obj *bgpAttributesSrPolicyPolicyName) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Value is required - if obj.obj.Value == nil { - vObj.validationErrors = append(vObj.validationErrors, "Value is required field on interface BgpAttributesSrPolicyPolicyName") - } - if obj.obj.Value != nil { - - if len(*obj.obj.Value) > 500 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "None <= length of BgpAttributesSrPolicyPolicyName.Value <= 500 but Got %d", - len(*obj.obj.Value))) - } - - } - -} - -func (obj *bgpAttributesSrPolicyPolicyName) setDefault() { - -} - -// ***** BgpAttributesSrPolicyPolicyCandidateName ***** -type bgpAttributesSrPolicyPolicyCandidateName struct { - validation - obj *otg.BgpAttributesSrPolicyPolicyCandidateName - marshaller marshalBgpAttributesSrPolicyPolicyCandidateName - unMarshaller unMarshalBgpAttributesSrPolicyPolicyCandidateName -} - -func NewBgpAttributesSrPolicyPolicyCandidateName() BgpAttributesSrPolicyPolicyCandidateName { - obj := bgpAttributesSrPolicyPolicyCandidateName{obj: &otg.BgpAttributesSrPolicyPolicyCandidateName{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSrPolicyPolicyCandidateName) msg() *otg.BgpAttributesSrPolicyPolicyCandidateName { - return obj.obj -} - -func (obj *bgpAttributesSrPolicyPolicyCandidateName) setMsg(msg *otg.BgpAttributesSrPolicyPolicyCandidateName) BgpAttributesSrPolicyPolicyCandidateName { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSrPolicyPolicyCandidateName struct { - obj *bgpAttributesSrPolicyPolicyCandidateName -} - -type marshalBgpAttributesSrPolicyPolicyCandidateName interface { - // ToProto marshals BgpAttributesSrPolicyPolicyCandidateName to protobuf object *otg.BgpAttributesSrPolicyPolicyCandidateName - ToProto() (*otg.BgpAttributesSrPolicyPolicyCandidateName, error) - // ToPbText marshals BgpAttributesSrPolicyPolicyCandidateName to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSrPolicyPolicyCandidateName to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSrPolicyPolicyCandidateName to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSrPolicyPolicyCandidateName struct { - obj *bgpAttributesSrPolicyPolicyCandidateName -} - -type unMarshalBgpAttributesSrPolicyPolicyCandidateName interface { - // FromProto unmarshals BgpAttributesSrPolicyPolicyCandidateName from protobuf object *otg.BgpAttributesSrPolicyPolicyCandidateName - FromProto(msg *otg.BgpAttributesSrPolicyPolicyCandidateName) (BgpAttributesSrPolicyPolicyCandidateName, error) - // FromPbText unmarshals BgpAttributesSrPolicyPolicyCandidateName from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSrPolicyPolicyCandidateName from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSrPolicyPolicyCandidateName from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSrPolicyPolicyCandidateName) Marshal() marshalBgpAttributesSrPolicyPolicyCandidateName { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSrPolicyPolicyCandidateName{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSrPolicyPolicyCandidateName) Unmarshal() unMarshalBgpAttributesSrPolicyPolicyCandidateName { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSrPolicyPolicyCandidateName{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSrPolicyPolicyCandidateName) ToProto() (*otg.BgpAttributesSrPolicyPolicyCandidateName, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSrPolicyPolicyCandidateName) FromProto(msg *otg.BgpAttributesSrPolicyPolicyCandidateName) (BgpAttributesSrPolicyPolicyCandidateName, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSrPolicyPolicyCandidateName) 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 *unMarshalbgpAttributesSrPolicyPolicyCandidateName) 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 *marshalbgpAttributesSrPolicyPolicyCandidateName) 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 *unMarshalbgpAttributesSrPolicyPolicyCandidateName) 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 *marshalbgpAttributesSrPolicyPolicyCandidateName) 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 *unMarshalbgpAttributesSrPolicyPolicyCandidateName) 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 *bgpAttributesSrPolicyPolicyCandidateName) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSrPolicyPolicyCandidateName) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSrPolicyPolicyCandidateName) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSrPolicyPolicyCandidateName) Clone() (BgpAttributesSrPolicyPolicyCandidateName, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSrPolicyPolicyCandidateName() - 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 -} - -// BgpAttributesSrPolicyPolicyCandidateName is optional Policy Candidate Path Name sub-tlv (Type 129) which carries the symbolic name for the SR Policy candidate path -// for debugging. -// - It is defined in Section 2.4.7 of draft-ietf-idr-sr-policy-safi-02 . -type BgpAttributesSrPolicyPolicyCandidateName interface { - Validation - // msg marshals BgpAttributesSrPolicyPolicyCandidateName to protobuf object *otg.BgpAttributesSrPolicyPolicyCandidateName - // and doesn't set defaults - msg() *otg.BgpAttributesSrPolicyPolicyCandidateName - // setMsg unmarshals BgpAttributesSrPolicyPolicyCandidateName from protobuf object *otg.BgpAttributesSrPolicyPolicyCandidateName - // and doesn't set defaults - setMsg(*otg.BgpAttributesSrPolicyPolicyCandidateName) BgpAttributesSrPolicyPolicyCandidateName - // provides marshal interface - Marshal() marshalBgpAttributesSrPolicyPolicyCandidateName - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSrPolicyPolicyCandidateName - // validate validates BgpAttributesSrPolicyPolicyCandidateName - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSrPolicyPolicyCandidateName, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Value returns string, set in BgpAttributesSrPolicyPolicyCandidateName. - Value() string - // SetValue assigns string provided by user to BgpAttributesSrPolicyPolicyCandidateName - SetValue(value string) BgpAttributesSrPolicyPolicyCandidateName -} - -// Value of the symbolic Policy Candidate Path Name carried in the Policy Candidate Path Name sub-tlv. -// It is recommended that the size of the name is limited to 255 bytes. -// Value returns a string -func (obj *bgpAttributesSrPolicyPolicyCandidateName) Value() string { - - return *obj.obj.Value - -} - -// Value of the symbolic Policy Candidate Path Name carried in the Policy Candidate Path Name sub-tlv. -// It is recommended that the size of the name is limited to 255 bytes. -// SetValue sets the string value in the BgpAttributesSrPolicyPolicyCandidateName object -func (obj *bgpAttributesSrPolicyPolicyCandidateName) SetValue(value string) BgpAttributesSrPolicyPolicyCandidateName { - - obj.obj.Value = &value - return obj -} - -func (obj *bgpAttributesSrPolicyPolicyCandidateName) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Value is required - if obj.obj.Value == nil { - vObj.validationErrors = append(vObj.validationErrors, "Value is required field on interface BgpAttributesSrPolicyPolicyCandidateName") - } - if obj.obj.Value != nil { - - if len(*obj.obj.Value) > 500 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "None <= length of BgpAttributesSrPolicyPolicyCandidateName.Value <= 500 but Got %d", - len(*obj.obj.Value))) - } - - } - -} - -func (obj *bgpAttributesSrPolicyPolicyCandidateName) setDefault() { - -} - -// ***** BgpAttributesSrPolicyExplicitNullPolicy ***** -type bgpAttributesSrPolicyExplicitNullPolicy struct { - validation - obj *otg.BgpAttributesSrPolicyExplicitNullPolicy - marshaller marshalBgpAttributesSrPolicyExplicitNullPolicy - unMarshaller unMarshalBgpAttributesSrPolicyExplicitNullPolicy -} - -func NewBgpAttributesSrPolicyExplicitNullPolicy() BgpAttributesSrPolicyExplicitNullPolicy { - obj := bgpAttributesSrPolicyExplicitNullPolicy{obj: &otg.BgpAttributesSrPolicyExplicitNullPolicy{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) msg() *otg.BgpAttributesSrPolicyExplicitNullPolicy { - return obj.obj -} - -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) setMsg(msg *otg.BgpAttributesSrPolicyExplicitNullPolicy) BgpAttributesSrPolicyExplicitNullPolicy { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSrPolicyExplicitNullPolicy struct { - obj *bgpAttributesSrPolicyExplicitNullPolicy -} - -type marshalBgpAttributesSrPolicyExplicitNullPolicy interface { - // ToProto marshals BgpAttributesSrPolicyExplicitNullPolicy to protobuf object *otg.BgpAttributesSrPolicyExplicitNullPolicy - ToProto() (*otg.BgpAttributesSrPolicyExplicitNullPolicy, error) - // ToPbText marshals BgpAttributesSrPolicyExplicitNullPolicy to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSrPolicyExplicitNullPolicy to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSrPolicyExplicitNullPolicy to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSrPolicyExplicitNullPolicy struct { - obj *bgpAttributesSrPolicyExplicitNullPolicy -} - -type unMarshalBgpAttributesSrPolicyExplicitNullPolicy interface { - // FromProto unmarshals BgpAttributesSrPolicyExplicitNullPolicy from protobuf object *otg.BgpAttributesSrPolicyExplicitNullPolicy - FromProto(msg *otg.BgpAttributesSrPolicyExplicitNullPolicy) (BgpAttributesSrPolicyExplicitNullPolicy, error) - // FromPbText unmarshals BgpAttributesSrPolicyExplicitNullPolicy from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSrPolicyExplicitNullPolicy from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSrPolicyExplicitNullPolicy from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Marshal() marshalBgpAttributesSrPolicyExplicitNullPolicy { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSrPolicyExplicitNullPolicy{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Unmarshal() unMarshalBgpAttributesSrPolicyExplicitNullPolicy { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSrPolicyExplicitNullPolicy{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSrPolicyExplicitNullPolicy) ToProto() (*otg.BgpAttributesSrPolicyExplicitNullPolicy, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSrPolicyExplicitNullPolicy) FromProto(msg *otg.BgpAttributesSrPolicyExplicitNullPolicy) (BgpAttributesSrPolicyExplicitNullPolicy, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSrPolicyExplicitNullPolicy) 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 *unMarshalbgpAttributesSrPolicyExplicitNullPolicy) 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 *marshalbgpAttributesSrPolicyExplicitNullPolicy) 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 *unMarshalbgpAttributesSrPolicyExplicitNullPolicy) 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 *marshalbgpAttributesSrPolicyExplicitNullPolicy) 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 *unMarshalbgpAttributesSrPolicyExplicitNullPolicy) 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 *bgpAttributesSrPolicyExplicitNullPolicy) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Clone() (BgpAttributesSrPolicyExplicitNullPolicy, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSrPolicyExplicitNullPolicy() - 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 -} - -// BgpAttributesSrPolicyExplicitNullPolicy is this is an optional sub-tlv (Type 14) which indicates whether an Explicit NULL Label must be pushed on an unlabeled IP -// packet before other labels for IPv4 or IPv6 flows. -// - It is defined in Section 2.4.5 of draft-ietf-idr-sr-policy-safi-02. -type BgpAttributesSrPolicyExplicitNullPolicy interface { - Validation - // msg marshals BgpAttributesSrPolicyExplicitNullPolicy to protobuf object *otg.BgpAttributesSrPolicyExplicitNullPolicy - // and doesn't set defaults - msg() *otg.BgpAttributesSrPolicyExplicitNullPolicy - // setMsg unmarshals BgpAttributesSrPolicyExplicitNullPolicy from protobuf object *otg.BgpAttributesSrPolicyExplicitNullPolicy - // and doesn't set defaults - setMsg(*otg.BgpAttributesSrPolicyExplicitNullPolicy) BgpAttributesSrPolicyExplicitNullPolicy - // provides marshal interface - Marshal() marshalBgpAttributesSrPolicyExplicitNullPolicy - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSrPolicyExplicitNullPolicy - // validate validates BgpAttributesSrPolicyExplicitNullPolicy - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSrPolicyExplicitNullPolicy, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum, set in BgpAttributesSrPolicyExplicitNullPolicy - Choice() BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum - // setChoice assigns BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum provided by user to BgpAttributesSrPolicyExplicitNullPolicy - setChoice(value BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum) BgpAttributesSrPolicyExplicitNullPolicy - // HasChoice checks if Choice has been set in BgpAttributesSrPolicyExplicitNullPolicy - HasChoice() bool - // getter for PushIpv6 to set choice. - PushIpv6() - // getter for PushIpv4AndIpv6 to set choice. - PushIpv4AndIpv6() - // getter for Unknown to set choice. - Unknown() - // getter for DonotPush to set choice. - DonotPush() - // getter for PushIpv4 to set choice. - PushIpv4() -} - -type BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum string - -// Enum of Choice on BgpAttributesSrPolicyExplicitNullPolicy -var BgpAttributesSrPolicyExplicitNullPolicyChoice = struct { - UNKNOWN BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum - PUSH_IPV4 BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum - PUSH_IPV6 BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum - PUSH_IPV4_AND_IPV6 BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum - DONOT_PUSH BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum -}{ - UNKNOWN: BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum("unknown"), - PUSH_IPV4: BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum("push_ipv4"), - PUSH_IPV6: BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum("push_ipv6"), - PUSH_IPV4_AND_IPV6: BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum("push_ipv4_and_ipv6"), - DONOT_PUSH: BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum("donot_push"), -} - -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) Choice() BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum { - return BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// getter for PushIpv6 to set choice -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) PushIpv6() { - obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV6) -} - -// 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 PushIpv4 to set choice -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) PushIpv4() { - obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV4) -} - -// The Explicit NULL Label policy. -// Choice returns a string -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) setChoice(value BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum) BgpAttributesSrPolicyExplicitNullPolicy { - intValue, ok := otg.BgpAttributesSrPolicyExplicitNullPolicy_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpAttributesSrPolicyExplicitNullPolicy_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - - return obj -} - -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpAttributesSrPolicyExplicitNullPolicy) setDefault() { - var choices_set int = 0 - var choice BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(BgpAttributesSrPolicyExplicitNullPolicyChoice.PUSH_IPV4_AND_IPV6) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesSrPolicyExplicitNullPolicy") - } - } else { - intVal := otg.BgpAttributesSrPolicyExplicitNullPolicy_Choice_Enum_value[string(choice)] - enumValue := otg.BgpAttributesSrPolicyExplicitNullPolicy_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpAttributesSrPolicySegmentList ***** -type bgpAttributesSrPolicySegmentList struct { - validation - obj *otg.BgpAttributesSrPolicySegmentList - marshaller marshalBgpAttributesSrPolicySegmentList - unMarshaller unMarshalBgpAttributesSrPolicySegmentList - weightHolder BgpAttributesSegmentRoutingPolicySegmentListWeight - segmentsHolder BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter -} - -func NewBgpAttributesSrPolicySegmentList() BgpAttributesSrPolicySegmentList { - obj := bgpAttributesSrPolicySegmentList{obj: &otg.BgpAttributesSrPolicySegmentList{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSrPolicySegmentList) msg() *otg.BgpAttributesSrPolicySegmentList { - return obj.obj -} - -func (obj *bgpAttributesSrPolicySegmentList) setMsg(msg *otg.BgpAttributesSrPolicySegmentList) BgpAttributesSrPolicySegmentList { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSrPolicySegmentList struct { - obj *bgpAttributesSrPolicySegmentList -} - -type marshalBgpAttributesSrPolicySegmentList interface { - // ToProto marshals BgpAttributesSrPolicySegmentList to protobuf object *otg.BgpAttributesSrPolicySegmentList - ToProto() (*otg.BgpAttributesSrPolicySegmentList, error) - // ToPbText marshals BgpAttributesSrPolicySegmentList to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSrPolicySegmentList to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSrPolicySegmentList to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSrPolicySegmentList struct { - obj *bgpAttributesSrPolicySegmentList -} - -type unMarshalBgpAttributesSrPolicySegmentList interface { - // FromProto unmarshals BgpAttributesSrPolicySegmentList from protobuf object *otg.BgpAttributesSrPolicySegmentList - FromProto(msg *otg.BgpAttributesSrPolicySegmentList) (BgpAttributesSrPolicySegmentList, error) - // FromPbText unmarshals BgpAttributesSrPolicySegmentList from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSrPolicySegmentList from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSrPolicySegmentList from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSrPolicySegmentList) Marshal() marshalBgpAttributesSrPolicySegmentList { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSrPolicySegmentList{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSrPolicySegmentList) Unmarshal() unMarshalBgpAttributesSrPolicySegmentList { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSrPolicySegmentList{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSrPolicySegmentList) ToProto() (*otg.BgpAttributesSrPolicySegmentList, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSrPolicySegmentList) FromProto(msg *otg.BgpAttributesSrPolicySegmentList) (BgpAttributesSrPolicySegmentList, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSrPolicySegmentList) 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 *unMarshalbgpAttributesSrPolicySegmentList) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSrPolicySegmentList) 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 *unMarshalbgpAttributesSrPolicySegmentList) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSrPolicySegmentList) 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 *unMarshalbgpAttributesSrPolicySegmentList) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSrPolicySegmentList) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSrPolicySegmentList) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSrPolicySegmentList) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSrPolicySegmentList) Clone() (BgpAttributesSrPolicySegmentList, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSrPolicySegmentList() - 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 -} - -func (obj *bgpAttributesSrPolicySegmentList) setNil() { - obj.weightHolder = nil - obj.segmentsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSrPolicySegmentList is one optional SEGMENT_LIST sub-tlv encoded with type of 128. -// One sub-tlv (Type 128) encodes a single explicit path towards the endpoint as described in -// section 5.1 of [RFC9256]. -// The Segment List sub-TLV includes the elements of the paths (i.e., segments) as well -// as an optional Weight sub-TLV. -type BgpAttributesSrPolicySegmentList interface { - Validation - // msg marshals BgpAttributesSrPolicySegmentList to protobuf object *otg.BgpAttributesSrPolicySegmentList - // and doesn't set defaults - msg() *otg.BgpAttributesSrPolicySegmentList - // setMsg unmarshals BgpAttributesSrPolicySegmentList from protobuf object *otg.BgpAttributesSrPolicySegmentList - // and doesn't set defaults - setMsg(*otg.BgpAttributesSrPolicySegmentList) BgpAttributesSrPolicySegmentList - // provides marshal interface - Marshal() marshalBgpAttributesSrPolicySegmentList - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSrPolicySegmentList - // validate validates BgpAttributesSrPolicySegmentList - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSrPolicySegmentList, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Weight returns BgpAttributesSegmentRoutingPolicySegmentListWeight, set in BgpAttributesSrPolicySegmentList. - // BgpAttributesSegmentRoutingPolicySegmentListWeight is the optional Weight sub-TLV (Type 9) specifies the weight associated with a given segment list. The weight is used for weighted multipath. - Weight() BgpAttributesSegmentRoutingPolicySegmentListWeight - // SetWeight assigns BgpAttributesSegmentRoutingPolicySegmentListWeight provided by user to BgpAttributesSrPolicySegmentList. - // BgpAttributesSegmentRoutingPolicySegmentListWeight is the optional Weight sub-TLV (Type 9) specifies the weight associated with a given segment list. The weight is used for weighted multipath. - SetWeight(value BgpAttributesSegmentRoutingPolicySegmentListWeight) BgpAttributesSrPolicySegmentList - // HasWeight checks if Weight has been set in BgpAttributesSrPolicySegmentList - HasWeight() bool - // Segments returns BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIterIter, set in BgpAttributesSrPolicySegmentList - Segments() BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter - setNil() -} - -// description is TBD -// Weight returns a BgpAttributesSegmentRoutingPolicySegmentListWeight -func (obj *bgpAttributesSrPolicySegmentList) Weight() BgpAttributesSegmentRoutingPolicySegmentListWeight { - if obj.obj.Weight == nil { - obj.obj.Weight = NewBgpAttributesSegmentRoutingPolicySegmentListWeight().msg() - } - if obj.weightHolder == nil { - obj.weightHolder = &bgpAttributesSegmentRoutingPolicySegmentListWeight{obj: obj.obj.Weight} - } - return obj.weightHolder -} - -// description is TBD -// Weight returns a BgpAttributesSegmentRoutingPolicySegmentListWeight -func (obj *bgpAttributesSrPolicySegmentList) HasWeight() bool { - return obj.obj.Weight != nil -} - -// description is TBD -// SetWeight sets the BgpAttributesSegmentRoutingPolicySegmentListWeight value in the BgpAttributesSrPolicySegmentList object -func (obj *bgpAttributesSrPolicySegmentList) SetWeight(value BgpAttributesSegmentRoutingPolicySegmentListWeight) BgpAttributesSrPolicySegmentList { - - obj.weightHolder = nil - obj.obj.Weight = value.msg() - - return obj -} - -// description is TBD -// Segments returns a []BgpAttributesSegmentRoutingPolicySegmentListSegment -func (obj *bgpAttributesSrPolicySegmentList) Segments() BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { - if len(obj.obj.Segments) == 0 { - obj.obj.Segments = []*otg.BgpAttributesSegmentRoutingPolicySegmentListSegment{} - } - if obj.segmentsHolder == nil { - obj.segmentsHolder = newBgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter(&obj.obj.Segments).setMsg(obj) - } - return obj.segmentsHolder -} - -type bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter struct { - obj *bgpAttributesSrPolicySegmentList - bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice []BgpAttributesSegmentRoutingPolicySegmentListSegment - fieldPtr *[]*otg.BgpAttributesSegmentRoutingPolicySegmentListSegment -} - -func newBgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter(ptr *[]*otg.BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { - return &bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter{fieldPtr: ptr} -} - -type BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter interface { - setMsg(*bgpAttributesSrPolicySegmentList) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter - Items() []BgpAttributesSegmentRoutingPolicySegmentListSegment - Add() BgpAttributesSegmentRoutingPolicySegmentListSegment - Append(items ...BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter - Set(index int, newObj BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter - Clear() BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter - clearHolderSlice() BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter - appendHolderSlice(item BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter -} - -func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) setMsg(msg *bgpAttributesSrPolicySegmentList) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { - obj.clearHolderSlice() - for _, val := range *obj.fieldPtr { - obj.appendHolderSlice(&bgpAttributesSegmentRoutingPolicySegmentListSegment{obj: val}) - } - obj.obj = msg - return obj -} - -func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) Items() []BgpAttributesSegmentRoutingPolicySegmentListSegment { - return obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice -} - -func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) Add() BgpAttributesSegmentRoutingPolicySegmentListSegment { - newObj := &otg.BgpAttributesSegmentRoutingPolicySegmentListSegment{} - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - newLibObj := &bgpAttributesSegmentRoutingPolicySegmentListSegment{obj: newObj} - newLibObj.setDefault() - obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice = append(obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice, newLibObj) - return newLibObj -} - -func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) Append(items ...BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { - for _, item := range items { - newObj := item.msg() - *obj.fieldPtr = append(*obj.fieldPtr, newObj) - obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice = append(obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice, item) - } - return obj -} - -func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) Set(index int, newObj BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { - (*obj.fieldPtr)[index] = newObj.msg() - obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice[index] = newObj - return obj -} -func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) Clear() BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { - if len(*obj.fieldPtr) > 0 { - *obj.fieldPtr = []*otg.BgpAttributesSegmentRoutingPolicySegmentListSegment{} - obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice = []BgpAttributesSegmentRoutingPolicySegmentListSegment{} - } - return obj -} -func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) clearHolderSlice() BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { - if len(obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice) > 0 { - obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice = []BgpAttributesSegmentRoutingPolicySegmentListSegment{} - } - return obj -} -func (obj *bgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter) appendHolderSlice(item BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSrPolicySegmentListBgpAttributesSegmentRoutingPolicySegmentListSegmentIter { - obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice = append(obj.bgpAttributesSegmentRoutingPolicySegmentListSegmentSlice, item) - return obj -} - -func (obj *bgpAttributesSrPolicySegmentList) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Weight != nil { - - obj.Weight().validateObj(vObj, set_default) - } - - if len(obj.obj.Segments) != 0 { - - if set_default { - obj.Segments().clearHolderSlice() - for _, item := range obj.obj.Segments { - obj.Segments().appendHolderSlice(&bgpAttributesSegmentRoutingPolicySegmentListSegment{obj: item}) - } - } - for _, item := range obj.Segments().Items() { - item.validateObj(vObj, set_default) - } - - } - -} - -func (obj *bgpAttributesSrPolicySegmentList) setDefault() { - -} - -// ***** PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress ***** -type patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress struct { - validation - obj *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - marshaller marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - unMarshaller unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - incrementHolder PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - decrementHolder PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter -} - -func NewPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { - obj := patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress{obj: &otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { - return obj.obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) setMsg(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress struct { - obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress -} - -type marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress interface { - // ToProto marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress, error) - // ToPbText marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress struct { - obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress -} - -type unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress interface { - // FromProto unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress, error) - // FromPbText unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress() - 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 -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress is iPv4 address of the egress node for the tunnel. -type PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress interface { - Validation - // msg marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - // setMsg unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - // validate validates PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - Choice() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum - // setChoice assigns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - setChoice(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - HasChoice() bool - // Value returns string, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress. - Value() string - // SetValue assigns string provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - SetValue(value string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - // HasValue checks if Value has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - HasValue() bool - // Values returns []string, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress. - Values() []string - // SetValues assigns []string provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - SetValues(value []string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - // Increment returns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress. - // PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter is ipv4 counter pattern - Increment() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - // SetIncrement assigns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress. - // PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter is ipv4 counter pattern - SetIncrement(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress. - // PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter is ipv4 counter pattern - Decrement() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - // SetDecrement assigns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress. - // PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter is ipv4 counter pattern - SetDecrement(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress -var PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice = struct { - VALUE PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum - VALUES PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum - INCREMENT PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum - DECREMENT PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Choice() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum { - return PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) setChoice(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { - intValue, ok := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUE { - defaultValue := "0.0.0.0" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUES { - defaultValue := []string{"0.0.0.0"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter().msg() - } - - if value == PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) SetValue(value string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"0.0.0.0"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) SetValues(value []string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Increment() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter value in the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) SetIncrement(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Decrement() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter value in the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) SetDecrement(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv4(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateIpv4Slice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress") - } - } else { - intVal := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSessionLspTunnelIpv4Reserved ***** -type patternFlowRSVPPathSessionLspTunnelIpv4Reserved struct { - validation - obj *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - marshaller marshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved - unMarshaller unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved - incrementHolder PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - decrementHolder PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter -} - -func NewPatternFlowRSVPPathSessionLspTunnelIpv4Reserved() PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { - obj := patternFlowRSVPPathSessionLspTunnelIpv4Reserved{obj: &otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { - return obj.obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) setMsg(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved struct { - obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved -} - -type marshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved interface { - // ToProto marshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved, error) - // ToPbText marshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved struct { - obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved -} - -type unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved interface { - // FromProto unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) (PatternFlowRSVPPathSessionLspTunnelIpv4Reserved, error) - // FromPbText unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) (PatternFlowRSVPPathSessionLspTunnelIpv4Reserved, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4Reserved, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSessionLspTunnelIpv4Reserved() - 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 -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSessionLspTunnelIpv4Reserved is reserved field, MUST be zero. -type PatternFlowRSVPPathSessionLspTunnelIpv4Reserved interface { - Validation - // msg marshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - // setMsg unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved - // validate validates PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4Reserved, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum, set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - Choice() PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum - // setChoice assigns PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - setChoice(value PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - SetValue(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - // HasValue checks if Value has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - SetValues(value []uint32) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - // Increment returns PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved. - // PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter is integer counter pattern - Increment() PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - // SetIncrement assigns PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Reserved. - // PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved. - // PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - // SetDecrement assigns PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Reserved. - // PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSessionLspTunnelIpv4Reserved -var PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice = struct { - VALUE PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum - VALUES PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum - INCREMENT PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum - DECREMENT PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Choice() PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum { - return PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) setChoice(value PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { - intValue, ok := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter().msg() - } - - if value == PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4Reserved object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) SetValue(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4Reserved object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) SetValues(value []uint32) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Increment() PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter value in the PatternFlowRSVPPathSessionLspTunnelIpv4Reserved object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) SetIncrement(value PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Decrement() PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter value in the PatternFlowRSVPPathSessionLspTunnelIpv4Reserved object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) SetDecrement(value PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved") - } - } else { - intVal := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId ***** -type patternFlowRSVPPathSessionLspTunnelIpv4TunnelId struct { - validation - obj *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - marshaller marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - unMarshaller unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - incrementHolder PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - decrementHolder PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter -} - -func NewPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { - obj := patternFlowRSVPPathSessionLspTunnelIpv4TunnelId{obj: &otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { - return obj.obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) setMsg(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId struct { - obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId -} - -type marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId interface { - // ToProto marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId, error) - // ToPbText marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId struct { - obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId -} - -type unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId interface { - // FromProto unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId, error) - // FromPbText unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId() - 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 -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId is a 16-bit identifier used in the SESSION that remains constant over the life of the tunnel. -type PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId interface { - Validation - // msg marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - // setMsg unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - // validate validates PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - Choice() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum - // setChoice assigns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - setChoice(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - SetValue(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - // HasValue checks if Value has been set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - SetValues(value []uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - // Increment returns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId. - // PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter is integer counter pattern - Increment() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - // SetIncrement assigns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId. - // PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId. - // PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - // SetDecrement assigns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId. - // PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId -var PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice = struct { - VALUE PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum - VALUES PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum - INCREMENT PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum - DECREMENT PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Choice() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum { - return PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) setChoice(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { - intValue, ok := otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUE { - defaultValue := uint32(1) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUES { - defaultValue := []uint32{1} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter().msg() - } - - if value == PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) SetValue(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{1}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) SetValues(value []uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Increment() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter value in the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) SetIncrement(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Decrement() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter value in the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) SetDecrement(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId") - } - } else { - intVal := otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPPathSessionExtTunnelId ***** -type flowRSVPPathSessionExtTunnelId struct { - validation - obj *otg.FlowRSVPPathSessionExtTunnelId - marshaller marshalFlowRSVPPathSessionExtTunnelId - unMarshaller unMarshalFlowRSVPPathSessionExtTunnelId - asIntegerHolder PatternFlowRSVPPathSessionExtTunnelIdAsInteger - asIpv4Holder PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 -} - -func NewFlowRSVPPathSessionExtTunnelId() FlowRSVPPathSessionExtTunnelId { - obj := flowRSVPPathSessionExtTunnelId{obj: &otg.FlowRSVPPathSessionExtTunnelId{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathSessionExtTunnelId) msg() *otg.FlowRSVPPathSessionExtTunnelId { - return obj.obj -} - -func (obj *flowRSVPPathSessionExtTunnelId) setMsg(msg *otg.FlowRSVPPathSessionExtTunnelId) FlowRSVPPathSessionExtTunnelId { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathSessionExtTunnelId struct { - obj *flowRSVPPathSessionExtTunnelId -} - -type marshalFlowRSVPPathSessionExtTunnelId interface { - // ToProto marshals FlowRSVPPathSessionExtTunnelId to protobuf object *otg.FlowRSVPPathSessionExtTunnelId - ToProto() (*otg.FlowRSVPPathSessionExtTunnelId, error) - // ToPbText marshals FlowRSVPPathSessionExtTunnelId to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathSessionExtTunnelId to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathSessionExtTunnelId to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathSessionExtTunnelId struct { - obj *flowRSVPPathSessionExtTunnelId -} - -type unMarshalFlowRSVPPathSessionExtTunnelId interface { - // FromProto unmarshals FlowRSVPPathSessionExtTunnelId from protobuf object *otg.FlowRSVPPathSessionExtTunnelId - FromProto(msg *otg.FlowRSVPPathSessionExtTunnelId) (FlowRSVPPathSessionExtTunnelId, error) - // FromPbText unmarshals FlowRSVPPathSessionExtTunnelId from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathSessionExtTunnelId from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathSessionExtTunnelId from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathSessionExtTunnelId) Marshal() marshalFlowRSVPPathSessionExtTunnelId { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathSessionExtTunnelId{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathSessionExtTunnelId) Unmarshal() unMarshalFlowRSVPPathSessionExtTunnelId { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathSessionExtTunnelId{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathSessionExtTunnelId) ToProto() (*otg.FlowRSVPPathSessionExtTunnelId, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathSessionExtTunnelId) FromProto(msg *otg.FlowRSVPPathSessionExtTunnelId) (FlowRSVPPathSessionExtTunnelId, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathSessionExtTunnelId) 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 *unMarshalflowRSVPPathSessionExtTunnelId) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathSessionExtTunnelId) 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 *unMarshalflowRSVPPathSessionExtTunnelId) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathSessionExtTunnelId) 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 *unMarshalflowRSVPPathSessionExtTunnelId) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathSessionExtTunnelId) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathSessionExtTunnelId) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathSessionExtTunnelId) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathSessionExtTunnelId) Clone() (FlowRSVPPathSessionExtTunnelId, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathSessionExtTunnelId() - 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 -} - -func (obj *flowRSVPPathSessionExtTunnelId) setNil() { - obj.asIntegerHolder = nil - obj.asIpv4Holder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathSessionExtTunnelId is description is TBD -type FlowRSVPPathSessionExtTunnelId interface { - Validation - // msg marshals FlowRSVPPathSessionExtTunnelId to protobuf object *otg.FlowRSVPPathSessionExtTunnelId - // and doesn't set defaults - msg() *otg.FlowRSVPPathSessionExtTunnelId - // setMsg unmarshals FlowRSVPPathSessionExtTunnelId from protobuf object *otg.FlowRSVPPathSessionExtTunnelId - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathSessionExtTunnelId) FlowRSVPPathSessionExtTunnelId - // provides marshal interface - Marshal() marshalFlowRSVPPathSessionExtTunnelId - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathSessionExtTunnelId - // validate validates FlowRSVPPathSessionExtTunnelId - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathSessionExtTunnelId, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPPathSessionExtTunnelIdChoiceEnum, set in FlowRSVPPathSessionExtTunnelId - Choice() FlowRSVPPathSessionExtTunnelIdChoiceEnum - // setChoice assigns FlowRSVPPathSessionExtTunnelIdChoiceEnum provided by user to FlowRSVPPathSessionExtTunnelId - setChoice(value FlowRSVPPathSessionExtTunnelIdChoiceEnum) FlowRSVPPathSessionExtTunnelId - // HasChoice checks if Choice has been set in FlowRSVPPathSessionExtTunnelId - HasChoice() bool - // AsInteger returns PatternFlowRSVPPathSessionExtTunnelIdAsInteger, set in FlowRSVPPathSessionExtTunnelId. - // PatternFlowRSVPPathSessionExtTunnelIdAsInteger is tBD - AsInteger() PatternFlowRSVPPathSessionExtTunnelIdAsInteger - // SetAsInteger assigns PatternFlowRSVPPathSessionExtTunnelIdAsInteger provided by user to FlowRSVPPathSessionExtTunnelId. - // PatternFlowRSVPPathSessionExtTunnelIdAsInteger is tBD - SetAsInteger(value PatternFlowRSVPPathSessionExtTunnelIdAsInteger) FlowRSVPPathSessionExtTunnelId - // HasAsInteger checks if AsInteger has been set in FlowRSVPPathSessionExtTunnelId - HasAsInteger() bool - // AsIpv4 returns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4, set in FlowRSVPPathSessionExtTunnelId. - // PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 is iPv4 address of the ingress endpoint for the tunnel. - AsIpv4() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - // SetAsIpv4 assigns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 provided by user to FlowRSVPPathSessionExtTunnelId. - // PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 is iPv4 address of the ingress endpoint for the tunnel. - SetAsIpv4(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) FlowRSVPPathSessionExtTunnelId - // HasAsIpv4 checks if AsIpv4 has been set in FlowRSVPPathSessionExtTunnelId - HasAsIpv4() bool - setNil() -} - -type FlowRSVPPathSessionExtTunnelIdChoiceEnum string - -// Enum of Choice on FlowRSVPPathSessionExtTunnelId -var FlowRSVPPathSessionExtTunnelIdChoice = struct { - AS_INTEGER FlowRSVPPathSessionExtTunnelIdChoiceEnum - AS_IPV4 FlowRSVPPathSessionExtTunnelIdChoiceEnum -}{ - AS_INTEGER: FlowRSVPPathSessionExtTunnelIdChoiceEnum("as_integer"), - AS_IPV4: FlowRSVPPathSessionExtTunnelIdChoiceEnum("as_ipv4"), -} - -func (obj *flowRSVPPathSessionExtTunnelId) Choice() FlowRSVPPathSessionExtTunnelIdChoiceEnum { - return FlowRSVPPathSessionExtTunnelIdChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// 32 bit integer or IPv4 address. -// Choice returns a string -func (obj *flowRSVPPathSessionExtTunnelId) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPPathSessionExtTunnelId) setChoice(value FlowRSVPPathSessionExtTunnelIdChoiceEnum) FlowRSVPPathSessionExtTunnelId { - intValue, ok := otg.FlowRSVPPathSessionExtTunnelId_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPPathSessionExtTunnelIdChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPPathSessionExtTunnelId_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.AsIpv4 = nil - obj.asIpv4Holder = nil - obj.obj.AsInteger = nil - obj.asIntegerHolder = nil - - if value == FlowRSVPPathSessionExtTunnelIdChoice.AS_INTEGER { - obj.obj.AsInteger = NewPatternFlowRSVPPathSessionExtTunnelIdAsInteger().msg() - } - - if value == FlowRSVPPathSessionExtTunnelIdChoice.AS_IPV4 { - obj.obj.AsIpv4 = NewPatternFlowRSVPPathSessionExtTunnelIdAsIpv4().msg() - } - - return obj -} - -// description is TBD -// AsInteger returns a PatternFlowRSVPPathSessionExtTunnelIdAsInteger -func (obj *flowRSVPPathSessionExtTunnelId) AsInteger() PatternFlowRSVPPathSessionExtTunnelIdAsInteger { - if obj.obj.AsInteger == nil { - obj.setChoice(FlowRSVPPathSessionExtTunnelIdChoice.AS_INTEGER) - } - if obj.asIntegerHolder == nil { - obj.asIntegerHolder = &patternFlowRSVPPathSessionExtTunnelIdAsInteger{obj: obj.obj.AsInteger} - } - return obj.asIntegerHolder -} - -// description is TBD -// AsInteger returns a PatternFlowRSVPPathSessionExtTunnelIdAsInteger -func (obj *flowRSVPPathSessionExtTunnelId) HasAsInteger() bool { - return obj.obj.AsInteger != nil -} - -// description is TBD -// SetAsInteger sets the PatternFlowRSVPPathSessionExtTunnelIdAsInteger value in the FlowRSVPPathSessionExtTunnelId object -func (obj *flowRSVPPathSessionExtTunnelId) SetAsInteger(value PatternFlowRSVPPathSessionExtTunnelIdAsInteger) FlowRSVPPathSessionExtTunnelId { - obj.setChoice(FlowRSVPPathSessionExtTunnelIdChoice.AS_INTEGER) - obj.asIntegerHolder = nil - obj.obj.AsInteger = value.msg() - - return obj -} - -// description is TBD -// AsIpv4 returns a PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 -func (obj *flowRSVPPathSessionExtTunnelId) AsIpv4() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { - if obj.obj.AsIpv4 == nil { - obj.setChoice(FlowRSVPPathSessionExtTunnelIdChoice.AS_IPV4) - } - if obj.asIpv4Holder == nil { - obj.asIpv4Holder = &patternFlowRSVPPathSessionExtTunnelIdAsIpv4{obj: obj.obj.AsIpv4} - } - return obj.asIpv4Holder -} - -// description is TBD -// AsIpv4 returns a PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 -func (obj *flowRSVPPathSessionExtTunnelId) HasAsIpv4() bool { - return obj.obj.AsIpv4 != nil -} - -// description is TBD -// SetAsIpv4 sets the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 value in the FlowRSVPPathSessionExtTunnelId object -func (obj *flowRSVPPathSessionExtTunnelId) SetAsIpv4(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) FlowRSVPPathSessionExtTunnelId { - obj.setChoice(FlowRSVPPathSessionExtTunnelIdChoice.AS_IPV4) - obj.asIpv4Holder = nil - obj.obj.AsIpv4 = value.msg() - - return obj -} - -func (obj *flowRSVPPathSessionExtTunnelId) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.AsInteger != nil { - - obj.AsInteger().validateObj(vObj, set_default) - } - - if obj.obj.AsIpv4 != nil { - - obj.AsIpv4().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathSessionExtTunnelId) setDefault() { - var choices_set int = 0 - var choice FlowRSVPPathSessionExtTunnelIdChoiceEnum - - if obj.obj.AsInteger != nil { - choices_set += 1 - choice = FlowRSVPPathSessionExtTunnelIdChoice.AS_INTEGER - } - - if obj.obj.AsIpv4 != nil { - choices_set += 1 - choice = FlowRSVPPathSessionExtTunnelIdChoice.AS_IPV4 - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPPathSessionExtTunnelIdChoice.AS_INTEGER) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathSessionExtTunnelId") - } - } else { - intVal := otg.FlowRSVPPathSessionExtTunnelId_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPPathSessionExtTunnelId_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathRsvpHopIpv4Ipv4Address ***** -type patternFlowRSVPPathRsvpHopIpv4Ipv4Address struct { - validation - obj *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - marshaller marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address - unMarshaller unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address - incrementHolder PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - decrementHolder PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter -} - -func NewPatternFlowRSVPPathRsvpHopIpv4Ipv4Address() PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { - obj := patternFlowRSVPPathRsvpHopIpv4Ipv4Address{obj: &otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) msg() *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { - return obj.obj -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) setMsg(msg *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address struct { - obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address -} - -type marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address interface { - // ToProto marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address, error) - // ToPbText marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address struct { - obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address -} - -type unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address interface { - // FromProto unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) (PatternFlowRSVPPathRsvpHopIpv4Ipv4Address, error) - // FromPbText unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) (PatternFlowRSVPPathRsvpHopIpv4Ipv4Address, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Clone() (PatternFlowRSVPPathRsvpHopIpv4Ipv4Address, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathRsvpHopIpv4Ipv4Address() - 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 -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathRsvpHopIpv4Ipv4Address is the IPv4 address of the interface through which the last RSVP-knowledgeable hop forwarded this message. -type PatternFlowRSVPPathRsvpHopIpv4Ipv4Address interface { - Validation - // msg marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - // setMsg unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address - // validate validates PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathRsvpHopIpv4Ipv4Address, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - Choice() PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum - // setChoice assigns PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - setChoice(value PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - // HasChoice checks if Choice has been set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - HasChoice() bool - // Value returns string, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address. - Value() string - // SetValue assigns string provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - SetValue(value string) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - // HasValue checks if Value has been set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - HasValue() bool - // Values returns []string, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address. - Values() []string - // SetValues assigns []string provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - SetValues(value []string) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - // Increment returns PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address. - // PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter is ipv4 counter pattern - Increment() PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - // SetIncrement assigns PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4Address. - // PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter is ipv4 counter pattern - SetIncrement(value PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address. - // PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter is ipv4 counter pattern - Decrement() PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - // SetDecrement assigns PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4Address. - // PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter is ipv4 counter pattern - SetDecrement(value PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathRsvpHopIpv4Ipv4Address -var PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice = struct { - VALUE PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum - VALUES PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum - INCREMENT PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum - DECREMENT PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum -}{ - VALUE: PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum("value"), - VALUES: PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Choice() PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum { - return PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) setChoice(value PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { - intValue, ok := otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUE { - defaultValue := "0.0.0.0" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUES { - defaultValue := []string{"0.0.0.0"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter().msg() - } - - if value == PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowRSVPPathRsvpHopIpv4Ipv4Address object -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) SetValue(value string) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"0.0.0.0"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowRSVPPathRsvpHopIpv4Ipv4Address object -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) SetValues(value []string) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Increment() PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter value in the PatternFlowRSVPPathRsvpHopIpv4Ipv4Address object -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) SetIncrement(value PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Decrement() PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter value in the PatternFlowRSVPPathRsvpHopIpv4Ipv4Address object -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) SetDecrement(value PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv4(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateIpv4Slice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address") - } - } else { - intVal := otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle ***** -type patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle struct { - validation - obj *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - marshaller marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - unMarshaller unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - incrementHolder PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - decrementHolder PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter -} - -func NewPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { - obj := patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle{obj: &otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) msg() *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { - return obj.obj -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) setMsg(msg *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle struct { - obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle -} - -type marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle interface { - // ToProto marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle, error) - // ToPbText marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle struct { - obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle -} - -type unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle interface { - // FromProto unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle, error) - // FromPbText unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Clone() (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle() - 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 -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle is logical Interface Handle (LIH) is used to distinguish logical outgoing interfaces. A node receiving an LIH in a Path message saves its value and returns it in the HOP objects of subsequent Resv messages sent to the node that originated the LIH. The LIH should be identically zero if there is no logical interface handle. -type PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle interface { - Validation - // msg marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - // setMsg unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - // validate validates PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - Choice() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum - // setChoice assigns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - setChoice(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - // HasChoice checks if Choice has been set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - SetValue(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - // HasValue checks if Value has been set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - SetValues(value []uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - // Increment returns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle. - // PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter is integer counter pattern - Increment() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - // SetIncrement assigns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle. - // PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle. - // PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter is integer counter pattern - Decrement() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - // SetDecrement assigns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle. - // PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle -var PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice = struct { - VALUE PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum - VALUES PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum - INCREMENT PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum - DECREMENT PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum -}{ - VALUE: PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum("value"), - VALUES: PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Choice() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum { - return PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) setChoice(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { - intValue, ok := otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter().msg() - } - - if value == PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle object -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) SetValue(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle object -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) SetValues(value []uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Increment() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter value in the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle object -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) SetIncrement(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Decrement() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter value in the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle object -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) SetDecrement(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle") - } - } else { - intVal := otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathTimeValuesType1RefreshPeriodR ***** -type patternFlowRSVPPathTimeValuesType1RefreshPeriodR struct { - validation - obj *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - marshaller marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR - unMarshaller unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR - incrementHolder PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - decrementHolder PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter -} - -func NewPatternFlowRSVPPathTimeValuesType1RefreshPeriodR() PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { - obj := patternFlowRSVPPathTimeValuesType1RefreshPeriodR{obj: &otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) msg() *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { - return obj.obj -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) setMsg(msg *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR struct { - obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR -} - -type marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR interface { - // ToProto marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR to protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - ToProto() (*otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR, error) - // ToPbText marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR struct { - obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR -} - -type unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR interface { - // FromProto unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR from protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - FromProto(msg *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) (PatternFlowRSVPPathTimeValuesType1RefreshPeriodR, error) - // FromPbText unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Marshal() marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Unmarshal() unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) ToProto() (*otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) FromProto(msg *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) (PatternFlowRSVPPathTimeValuesType1RefreshPeriodR, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) 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 *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) 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 *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) 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 *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Clone() (PatternFlowRSVPPathTimeValuesType1RefreshPeriodR, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathTimeValuesType1RefreshPeriodR() - 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 -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathTimeValuesType1RefreshPeriodR is the refresh timeout period R used to generate this message;in milliseconds. -type PatternFlowRSVPPathTimeValuesType1RefreshPeriodR interface { - Validation - // msg marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR to protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - // setMsg unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR from protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR - // validate validates PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathTimeValuesType1RefreshPeriodR, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - Choice() PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum - // setChoice assigns PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - setChoice(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - // HasChoice checks if Choice has been set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - SetValue(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - // HasValue checks if Value has been set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - SetValues(value []uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - // Increment returns PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR. - // PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter is integer counter pattern - Increment() PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - // SetIncrement assigns PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodR. - // PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR. - // PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter is integer counter pattern - Decrement() PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - // SetDecrement assigns PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodR. - // PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathTimeValuesType1RefreshPeriodR -var PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice = struct { - VALUE PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum - VALUES PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum - INCREMENT PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum - DECREMENT PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum -}{ - VALUE: PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum("value"), - VALUES: PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Choice() PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum { - return PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) setChoice(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { - intValue, ok := otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUE { - defaultValue := uint32(30000) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUES { - defaultValue := []uint32{30000} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter().msg() - } - - if value == PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathTimeValuesType1RefreshPeriodR object -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) SetValue(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { - obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{30000}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathTimeValuesType1RefreshPeriodR object -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) SetValues(value []uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { - obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Increment() PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter value in the PatternFlowRSVPPathTimeValuesType1RefreshPeriodR object -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) SetIncrement(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { - obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Decrement() PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter value in the PatternFlowRSVPPathTimeValuesType1RefreshPeriodR object -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) SetDecrement(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { - obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR") - } - } else { - intVal := otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPType1ExplicitRouteSubobjects ***** -type flowRSVPType1ExplicitRouteSubobjects struct { - validation - obj *otg.FlowRSVPType1ExplicitRouteSubobjects - marshaller marshalFlowRSVPType1ExplicitRouteSubobjects - unMarshaller unMarshalFlowRSVPType1ExplicitRouteSubobjects - typeHolder FlowRSVPType1ExplicitRouteSubobjectsType -} - -func NewFlowRSVPType1ExplicitRouteSubobjects() FlowRSVPType1ExplicitRouteSubobjects { - obj := flowRSVPType1ExplicitRouteSubobjects{obj: &otg.FlowRSVPType1ExplicitRouteSubobjects{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPType1ExplicitRouteSubobjects) msg() *otg.FlowRSVPType1ExplicitRouteSubobjects { - return obj.obj -} - -func (obj *flowRSVPType1ExplicitRouteSubobjects) setMsg(msg *otg.FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPType1ExplicitRouteSubobjects { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPType1ExplicitRouteSubobjects struct { - obj *flowRSVPType1ExplicitRouteSubobjects -} - -type marshalFlowRSVPType1ExplicitRouteSubobjects interface { - // ToProto marshals FlowRSVPType1ExplicitRouteSubobjects to protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjects - ToProto() (*otg.FlowRSVPType1ExplicitRouteSubobjects, error) - // ToPbText marshals FlowRSVPType1ExplicitRouteSubobjects to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPType1ExplicitRouteSubobjects to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPType1ExplicitRouteSubobjects to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPType1ExplicitRouteSubobjects struct { - obj *flowRSVPType1ExplicitRouteSubobjects -} - -type unMarshalFlowRSVPType1ExplicitRouteSubobjects interface { - // FromProto unmarshals FlowRSVPType1ExplicitRouteSubobjects from protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjects - FromProto(msg *otg.FlowRSVPType1ExplicitRouteSubobjects) (FlowRSVPType1ExplicitRouteSubobjects, error) - // FromPbText unmarshals FlowRSVPType1ExplicitRouteSubobjects from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPType1ExplicitRouteSubobjects from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPType1ExplicitRouteSubobjects from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPType1ExplicitRouteSubobjects) Marshal() marshalFlowRSVPType1ExplicitRouteSubobjects { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPType1ExplicitRouteSubobjects{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPType1ExplicitRouteSubobjects) Unmarshal() unMarshalFlowRSVPType1ExplicitRouteSubobjects { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPType1ExplicitRouteSubobjects{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPType1ExplicitRouteSubobjects) ToProto() (*otg.FlowRSVPType1ExplicitRouteSubobjects, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPType1ExplicitRouteSubobjects) FromProto(msg *otg.FlowRSVPType1ExplicitRouteSubobjects) (FlowRSVPType1ExplicitRouteSubobjects, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPType1ExplicitRouteSubobjects) 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 *unMarshalflowRSVPType1ExplicitRouteSubobjects) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPType1ExplicitRouteSubobjects) 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 *unMarshalflowRSVPType1ExplicitRouteSubobjects) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPType1ExplicitRouteSubobjects) 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 *unMarshalflowRSVPType1ExplicitRouteSubobjects) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPType1ExplicitRouteSubobjects) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPType1ExplicitRouteSubobjects) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPType1ExplicitRouteSubobjects) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPType1ExplicitRouteSubobjects) Clone() (FlowRSVPType1ExplicitRouteSubobjects, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPType1ExplicitRouteSubobjects() - 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 -} - -func (obj *flowRSVPType1ExplicitRouteSubobjects) setNil() { - obj.typeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPType1ExplicitRouteSubobjects is type is specific to a subobject. -type FlowRSVPType1ExplicitRouteSubobjects interface { - Validation - // msg marshals FlowRSVPType1ExplicitRouteSubobjects to protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjects - // and doesn't set defaults - msg() *otg.FlowRSVPType1ExplicitRouteSubobjects - // setMsg unmarshals FlowRSVPType1ExplicitRouteSubobjects from protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjects - // and doesn't set defaults - setMsg(*otg.FlowRSVPType1ExplicitRouteSubobjects) FlowRSVPType1ExplicitRouteSubobjects - // provides marshal interface - Marshal() marshalFlowRSVPType1ExplicitRouteSubobjects - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPType1ExplicitRouteSubobjects - // validate validates FlowRSVPType1ExplicitRouteSubobjects - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPType1ExplicitRouteSubobjects, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Type returns FlowRSVPType1ExplicitRouteSubobjectsType, set in FlowRSVPType1ExplicitRouteSubobjects. - // FlowRSVPType1ExplicitRouteSubobjectsType is currently supported subobjects are IPv4 address(1) and Autonomous system number(32). - Type() FlowRSVPType1ExplicitRouteSubobjectsType - // SetType assigns FlowRSVPType1ExplicitRouteSubobjectsType provided by user to FlowRSVPType1ExplicitRouteSubobjects. - // FlowRSVPType1ExplicitRouteSubobjectsType is currently supported subobjects are IPv4 address(1) and Autonomous system number(32). - SetType(value FlowRSVPType1ExplicitRouteSubobjectsType) FlowRSVPType1ExplicitRouteSubobjects - // HasType checks if Type has been set in FlowRSVPType1ExplicitRouteSubobjects - HasType() bool - setNil() -} - -// description is TBD -// Type returns a FlowRSVPType1ExplicitRouteSubobjectsType -func (obj *flowRSVPType1ExplicitRouteSubobjects) Type() FlowRSVPType1ExplicitRouteSubobjectsType { - if obj.obj.Type == nil { - obj.obj.Type = NewFlowRSVPType1ExplicitRouteSubobjectsType().msg() - } - if obj.typeHolder == nil { - obj.typeHolder = &flowRSVPType1ExplicitRouteSubobjectsType{obj: obj.obj.Type} - } - return obj.typeHolder -} - -// description is TBD -// Type returns a FlowRSVPType1ExplicitRouteSubobjectsType -func (obj *flowRSVPType1ExplicitRouteSubobjects) HasType() bool { - return obj.obj.Type != nil -} - -// description is TBD -// SetType sets the FlowRSVPType1ExplicitRouteSubobjectsType value in the FlowRSVPType1ExplicitRouteSubobjects object -func (obj *flowRSVPType1ExplicitRouteSubobjects) SetType(value FlowRSVPType1ExplicitRouteSubobjectsType) FlowRSVPType1ExplicitRouteSubobjects { - - obj.typeHolder = nil - obj.obj.Type = value.msg() - - return obj -} - -func (obj *flowRSVPType1ExplicitRouteSubobjects) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Type != nil { - - obj.Type().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPType1ExplicitRouteSubobjects) setDefault() { - -} - -// ***** PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved ***** -type patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved struct { - validation - obj *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - marshaller marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - unMarshaller unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - incrementHolder PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - decrementHolder PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter -} - -func NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { - obj := patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved{obj: &otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { - return obj.obj -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) setMsg(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved struct { - obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved -} - -type marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved interface { - // ToProto marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved, error) - // ToPbText marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved struct { - obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved -} - -type unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved interface { - // FromProto unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved, error) - // FromPbText unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved() - 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 -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved is this field is reserved. It MUST be set to zero on transmission and MUST be ignored on receipt. -type PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved interface { - Validation - // msg marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - // setMsg unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - // validate validates PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - Choice() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum - // setChoice assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - setChoice(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - // HasChoice checks if Choice has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - SetValue(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - // HasValue checks if Value has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - SetValues(value []uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - // Increment returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved. - // PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter is integer counter pattern - Increment() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - // SetIncrement assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved. - // PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved. - // PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter is integer counter pattern - Decrement() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - // SetDecrement assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved. - // PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved -var PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice = struct { - VALUE PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum - VALUES PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum - INCREMENT PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum - DECREMENT PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum -}{ - VALUE: PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum("value"), - VALUES: PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Choice() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum { - return PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) setChoice(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { - intValue, ok := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter().msg() - } - - if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved object -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) SetValue(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved object -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) SetValues(value []uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Increment() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved object -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) SetIncrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Decrement() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved object -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) SetDecrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved") - } - } else { - intVal := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid ***** -type patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid struct { - validation - obj *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - marshaller marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - unMarshaller unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - incrementHolder PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - decrementHolder PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter -} - -func NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { - obj := patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid{obj: &otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { - return obj.obj -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) setMsg(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid struct { - obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid -} - -type marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid interface { - // ToProto marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid, error) - // ToPbText marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid struct { - obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid -} - -type unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid interface { - // FromProto unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid, error) - // FromPbText unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid() - 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 -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid is an identifier of the layer 3 protocol using this path. Standard Ethertype values are used e.g. The default value of 2048 ( 0x0800 ) represents Ethertype for IPv4. -type PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid interface { - Validation - // msg marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - // setMsg unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - // validate validates PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - Choice() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum - // setChoice assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - setChoice(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - // HasChoice checks if Choice has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - SetValue(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - // HasValue checks if Value has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - SetValues(value []uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - // Increment returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid. - Increment() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - // SetIncrement assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid. - SetIncrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid. - Decrement() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - // SetDecrement assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid. - SetDecrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid -var PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice = struct { - VALUE PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum - VALUES PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum - INCREMENT PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum - DECREMENT PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum -}{ - VALUE: PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum("value"), - VALUES: PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Choice() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum { - return PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) setChoice(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { - intValue, ok := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUE { - defaultValue := uint32(2048) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUES { - defaultValue := []uint32{2048} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter().msg() - } - - if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid object -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) SetValue(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{2048}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid object -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) SetValues(value []uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Increment() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid object -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) SetIncrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Decrement() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid object -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) SetDecrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid") - } - } else { - intVal := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPLspTunnelFlag ***** -type flowRSVPLspTunnelFlag struct { - validation - obj *otg.FlowRSVPLspTunnelFlag - marshaller marshalFlowRSVPLspTunnelFlag - unMarshaller unMarshalFlowRSVPLspTunnelFlag -} - -func NewFlowRSVPLspTunnelFlag() FlowRSVPLspTunnelFlag { - obj := flowRSVPLspTunnelFlag{obj: &otg.FlowRSVPLspTunnelFlag{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPLspTunnelFlag) msg() *otg.FlowRSVPLspTunnelFlag { - return obj.obj -} - -func (obj *flowRSVPLspTunnelFlag) setMsg(msg *otg.FlowRSVPLspTunnelFlag) FlowRSVPLspTunnelFlag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPLspTunnelFlag struct { - obj *flowRSVPLspTunnelFlag -} - -type marshalFlowRSVPLspTunnelFlag interface { - // ToProto marshals FlowRSVPLspTunnelFlag to protobuf object *otg.FlowRSVPLspTunnelFlag - ToProto() (*otg.FlowRSVPLspTunnelFlag, error) - // ToPbText marshals FlowRSVPLspTunnelFlag to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPLspTunnelFlag to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPLspTunnelFlag to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPLspTunnelFlag struct { - obj *flowRSVPLspTunnelFlag -} - -type unMarshalFlowRSVPLspTunnelFlag interface { - // FromProto unmarshals FlowRSVPLspTunnelFlag from protobuf object *otg.FlowRSVPLspTunnelFlag - FromProto(msg *otg.FlowRSVPLspTunnelFlag) (FlowRSVPLspTunnelFlag, error) - // FromPbText unmarshals FlowRSVPLspTunnelFlag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPLspTunnelFlag from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPLspTunnelFlag from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPLspTunnelFlag) Marshal() marshalFlowRSVPLspTunnelFlag { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPLspTunnelFlag{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPLspTunnelFlag) Unmarshal() unMarshalFlowRSVPLspTunnelFlag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPLspTunnelFlag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPLspTunnelFlag) ToProto() (*otg.FlowRSVPLspTunnelFlag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPLspTunnelFlag) FromProto(msg *otg.FlowRSVPLspTunnelFlag) (FlowRSVPLspTunnelFlag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPLspTunnelFlag) 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 *unMarshalflowRSVPLspTunnelFlag) 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 *marshalflowRSVPLspTunnelFlag) 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 *unMarshalflowRSVPLspTunnelFlag) 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 *marshalflowRSVPLspTunnelFlag) 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 *unMarshalflowRSVPLspTunnelFlag) 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 *flowRSVPLspTunnelFlag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPLspTunnelFlag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPLspTunnelFlag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPLspTunnelFlag) Clone() (FlowRSVPLspTunnelFlag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPLspTunnelFlag() - 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 -} - -// FlowRSVPLspTunnelFlag is description is TBD -type FlowRSVPLspTunnelFlag interface { - Validation - // msg marshals FlowRSVPLspTunnelFlag to protobuf object *otg.FlowRSVPLspTunnelFlag - // and doesn't set defaults - msg() *otg.FlowRSVPLspTunnelFlag - // setMsg unmarshals FlowRSVPLspTunnelFlag from protobuf object *otg.FlowRSVPLspTunnelFlag - // and doesn't set defaults - setMsg(*otg.FlowRSVPLspTunnelFlag) FlowRSVPLspTunnelFlag - // provides marshal interface - Marshal() marshalFlowRSVPLspTunnelFlag - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPLspTunnelFlag - // validate validates FlowRSVPLspTunnelFlag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPLspTunnelFlag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPLspTunnelFlagChoiceEnum, set in FlowRSVPLspTunnelFlag - Choice() FlowRSVPLspTunnelFlagChoiceEnum - // setChoice assigns FlowRSVPLspTunnelFlagChoiceEnum provided by user to FlowRSVPLspTunnelFlag - setChoice(value FlowRSVPLspTunnelFlagChoiceEnum) FlowRSVPLspTunnelFlag - // HasChoice checks if Choice has been set in FlowRSVPLspTunnelFlag - HasChoice() bool - // getter for SeStyleDesired to set choice. - SeStyleDesired() - // getter for LabelRecordingDesired to set choice. - LabelRecordingDesired() - // getter for LocalProtectionDesired to set choice. - LocalProtectionDesired() -} - -type FlowRSVPLspTunnelFlagChoiceEnum string - -// Enum of Choice on FlowRSVPLspTunnelFlag -var FlowRSVPLspTunnelFlagChoice = struct { - LOCAL_PROTECTION_DESIRED FlowRSVPLspTunnelFlagChoiceEnum - LABEL_RECORDING_DESIRED FlowRSVPLspTunnelFlagChoiceEnum - SE_STYLE_DESIRED FlowRSVPLspTunnelFlagChoiceEnum -}{ - LOCAL_PROTECTION_DESIRED: FlowRSVPLspTunnelFlagChoiceEnum("local_protection_desired"), - LABEL_RECORDING_DESIRED: FlowRSVPLspTunnelFlagChoiceEnum("label_recording_desired"), - SE_STYLE_DESIRED: FlowRSVPLspTunnelFlagChoiceEnum("se_style_desired"), -} - -func (obj *flowRSVPLspTunnelFlag) Choice() FlowRSVPLspTunnelFlagChoiceEnum { - return FlowRSVPLspTunnelFlagChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// getter for SeStyleDesired to set choice -func (obj *flowRSVPLspTunnelFlag) SeStyleDesired() { - obj.setChoice(FlowRSVPLspTunnelFlagChoice.SE_STYLE_DESIRED) -} - -// getter for LabelRecordingDesired to set choice -func (obj *flowRSVPLspTunnelFlag) LabelRecordingDesired() { - obj.setChoice(FlowRSVPLspTunnelFlagChoice.LABEL_RECORDING_DESIRED) -} - -// getter for LocalProtectionDesired to set choice -func (obj *flowRSVPLspTunnelFlag) LocalProtectionDesired() { - obj.setChoice(FlowRSVPLspTunnelFlagChoice.LOCAL_PROTECTION_DESIRED) -} - -// description is TBD -// Choice returns a string -func (obj *flowRSVPLspTunnelFlag) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPLspTunnelFlag) setChoice(value FlowRSVPLspTunnelFlagChoiceEnum) FlowRSVPLspTunnelFlag { - intValue, ok := otg.FlowRSVPLspTunnelFlag_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPLspTunnelFlagChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPLspTunnelFlag_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - - return obj -} - -func (obj *flowRSVPLspTunnelFlag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *flowRSVPLspTunnelFlag) setDefault() { - var choices_set int = 0 - var choice FlowRSVPLspTunnelFlagChoiceEnum - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPLspTunnelFlagChoice.LOCAL_PROTECTION_DESIRED) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPLspTunnelFlag") - } - } else { - intVal := otg.FlowRSVPLspTunnelFlag_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPLspTunnelFlag_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPSessionAttributeNameLength ***** -type flowRSVPSessionAttributeNameLength struct { - validation - obj *otg.FlowRSVPSessionAttributeNameLength - marshaller marshalFlowRSVPSessionAttributeNameLength - unMarshaller unMarshalFlowRSVPSessionAttributeNameLength -} - -func NewFlowRSVPSessionAttributeNameLength() FlowRSVPSessionAttributeNameLength { - obj := flowRSVPSessionAttributeNameLength{obj: &otg.FlowRSVPSessionAttributeNameLength{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPSessionAttributeNameLength) msg() *otg.FlowRSVPSessionAttributeNameLength { - return obj.obj -} - -func (obj *flowRSVPSessionAttributeNameLength) setMsg(msg *otg.FlowRSVPSessionAttributeNameLength) FlowRSVPSessionAttributeNameLength { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPSessionAttributeNameLength struct { - obj *flowRSVPSessionAttributeNameLength -} - -type marshalFlowRSVPSessionAttributeNameLength interface { - // ToProto marshals FlowRSVPSessionAttributeNameLength to protobuf object *otg.FlowRSVPSessionAttributeNameLength - ToProto() (*otg.FlowRSVPSessionAttributeNameLength, error) - // ToPbText marshals FlowRSVPSessionAttributeNameLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPSessionAttributeNameLength to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPSessionAttributeNameLength to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPSessionAttributeNameLength struct { - obj *flowRSVPSessionAttributeNameLength -} - -type unMarshalFlowRSVPSessionAttributeNameLength interface { - // FromProto unmarshals FlowRSVPSessionAttributeNameLength from protobuf object *otg.FlowRSVPSessionAttributeNameLength - FromProto(msg *otg.FlowRSVPSessionAttributeNameLength) (FlowRSVPSessionAttributeNameLength, error) - // FromPbText unmarshals FlowRSVPSessionAttributeNameLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPSessionAttributeNameLength from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPSessionAttributeNameLength from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPSessionAttributeNameLength) Marshal() marshalFlowRSVPSessionAttributeNameLength { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPSessionAttributeNameLength{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPSessionAttributeNameLength) Unmarshal() unMarshalFlowRSVPSessionAttributeNameLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPSessionAttributeNameLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPSessionAttributeNameLength) ToProto() (*otg.FlowRSVPSessionAttributeNameLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPSessionAttributeNameLength) FromProto(msg *otg.FlowRSVPSessionAttributeNameLength) (FlowRSVPSessionAttributeNameLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPSessionAttributeNameLength) 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 *unMarshalflowRSVPSessionAttributeNameLength) 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 *marshalflowRSVPSessionAttributeNameLength) 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 *unMarshalflowRSVPSessionAttributeNameLength) 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 *marshalflowRSVPSessionAttributeNameLength) 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 *unMarshalflowRSVPSessionAttributeNameLength) 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 *flowRSVPSessionAttributeNameLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPSessionAttributeNameLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPSessionAttributeNameLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPSessionAttributeNameLength) Clone() (FlowRSVPSessionAttributeNameLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPSessionAttributeNameLength() - 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 -} - -// FlowRSVPSessionAttributeNameLength is description is TBD -type FlowRSVPSessionAttributeNameLength interface { - Validation - // msg marshals FlowRSVPSessionAttributeNameLength to protobuf object *otg.FlowRSVPSessionAttributeNameLength - // and doesn't set defaults - msg() *otg.FlowRSVPSessionAttributeNameLength - // setMsg unmarshals FlowRSVPSessionAttributeNameLength from protobuf object *otg.FlowRSVPSessionAttributeNameLength - // and doesn't set defaults - setMsg(*otg.FlowRSVPSessionAttributeNameLength) FlowRSVPSessionAttributeNameLength - // provides marshal interface - Marshal() marshalFlowRSVPSessionAttributeNameLength - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPSessionAttributeNameLength - // validate validates FlowRSVPSessionAttributeNameLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPSessionAttributeNameLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPSessionAttributeNameLengthChoiceEnum, set in FlowRSVPSessionAttributeNameLength - Choice() FlowRSVPSessionAttributeNameLengthChoiceEnum - // setChoice assigns FlowRSVPSessionAttributeNameLengthChoiceEnum provided by user to FlowRSVPSessionAttributeNameLength - setChoice(value FlowRSVPSessionAttributeNameLengthChoiceEnum) FlowRSVPSessionAttributeNameLength - // HasChoice checks if Choice has been set in FlowRSVPSessionAttributeNameLength - HasChoice() bool - // Auto returns uint32, set in FlowRSVPSessionAttributeNameLength. - Auto() uint32 - // HasAuto checks if Auto has been set in FlowRSVPSessionAttributeNameLength - HasAuto() bool - // Value returns uint32, set in FlowRSVPSessionAttributeNameLength. - Value() uint32 - // SetValue assigns uint32 provided by user to FlowRSVPSessionAttributeNameLength - SetValue(value uint32) FlowRSVPSessionAttributeNameLength - // HasValue checks if Value has been set in FlowRSVPSessionAttributeNameLength - HasValue() bool -} - -type FlowRSVPSessionAttributeNameLengthChoiceEnum string - -// Enum of Choice on FlowRSVPSessionAttributeNameLength -var FlowRSVPSessionAttributeNameLengthChoice = struct { - AUTO FlowRSVPSessionAttributeNameLengthChoiceEnum - VALUE FlowRSVPSessionAttributeNameLengthChoiceEnum -}{ - AUTO: FlowRSVPSessionAttributeNameLengthChoiceEnum("auto"), - VALUE: FlowRSVPSessionAttributeNameLengthChoiceEnum("value"), -} - -func (obj *flowRSVPSessionAttributeNameLength) Choice() FlowRSVPSessionAttributeNameLengthChoiceEnum { - return FlowRSVPSessionAttributeNameLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// auto or configured value. -// Choice returns a string -func (obj *flowRSVPSessionAttributeNameLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPSessionAttributeNameLength) setChoice(value FlowRSVPSessionAttributeNameLengthChoiceEnum) FlowRSVPSessionAttributeNameLength { - intValue, ok := otg.FlowRSVPSessionAttributeNameLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPSessionAttributeNameLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPSessionAttributeNameLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Value = nil - obj.obj.Auto = nil - - if value == FlowRSVPSessionAttributeNameLengthChoice.AUTO { - defaultValue := uint32(0) - obj.obj.Auto = &defaultValue - } - - if value == FlowRSVPSessionAttributeNameLengthChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - return obj -} - -// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. -// Auto returns a uint32 -func (obj *flowRSVPSessionAttributeNameLength) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(FlowRSVPSessionAttributeNameLengthChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. -// Auto returns a uint32 -func (obj *flowRSVPSessionAttributeNameLength) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Value returns a uint32 -func (obj *flowRSVPSessionAttributeNameLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(FlowRSVPSessionAttributeNameLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *flowRSVPSessionAttributeNameLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the FlowRSVPSessionAttributeNameLength object -func (obj *flowRSVPSessionAttributeNameLength) SetValue(value uint32) FlowRSVPSessionAttributeNameLength { - obj.setChoice(FlowRSVPSessionAttributeNameLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -func (obj *flowRSVPSessionAttributeNameLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowRSVPSessionAttributeNameLength.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - -} - -func (obj *flowRSVPSessionAttributeNameLength) setDefault() { - var choices_set int = 0 - var choice FlowRSVPSessionAttributeNameLengthChoiceEnum - - if obj.obj.Auto != nil { - choices_set += 1 - choice = FlowRSVPSessionAttributeNameLengthChoice.AUTO - } - - if obj.obj.Value != nil { - choices_set += 1 - choice = FlowRSVPSessionAttributeNameLengthChoice.VALUE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPSessionAttributeNameLengthChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPSessionAttributeNameLength") - } - } else { - intVal := otg.FlowRSVPSessionAttributeNameLength_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPSessionAttributeNameLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress ***** -type patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress struct { - validation - obj *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - marshaller marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - unMarshaller unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - incrementHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - decrementHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter -} - -func NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { - obj := patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress{obj: &otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) setMsg(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress struct { - obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress -} - -type marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress interface { - // ToProto marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress, error) - // ToPbText marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress struct { - obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress -} - -type unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress() - 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 -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress is iPv4 address for a sender node. -type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - // setMsg unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - // validate validates PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - Choice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - setChoice(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - HasChoice() bool - // Value returns string, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress. - Value() string - // SetValue assigns string provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - SetValue(value string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - HasValue() bool - // Values returns []string, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress. - Values() []string - // SetValues assigns []string provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - SetValues(value []string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - // Increment returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter is ipv4 counter pattern - Increment() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - // SetIncrement assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter is ipv4 counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter is ipv4 counter pattern - Decrement() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - // SetDecrement assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter is ipv4 counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress -var PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice = struct { - VALUE PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum - VALUES PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Choice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum { - return PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) setChoice(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { - intValue, ok := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUE { - defaultValue := "0.0.0.0" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUES { - defaultValue := []string{"0.0.0.0"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter().msg() - } - - if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) SetValue(value string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"0.0.0.0"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) SetValues(value []string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Increment() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) SetIncrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Decrement() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) SetDecrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv4(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateIpv4Slice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved ***** -type patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved struct { - validation - obj *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - marshaller marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - unMarshaller unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - incrementHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - decrementHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter -} - -func NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { - obj := patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved{obj: &otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) setMsg(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved struct { - obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved -} - -type marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved interface { - // ToProto marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved, error) - // ToPbText marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved struct { - obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved -} - -type unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved() - 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 -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved is reserved field, MUST be zero. -type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - // setMsg unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - // validate validates PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - Choice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - setChoice(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - SetValue(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - SetValues(value []uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - // Increment returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter is integer counter pattern - Increment() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - // SetIncrement assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - // SetDecrement assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved -var PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice = struct { - VALUE PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum - VALUES PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Choice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum { - return PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) setChoice(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { - intValue, ok := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter().msg() - } - - if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) SetValue(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) SetValues(value []uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Increment() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) SetIncrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Decrement() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) SetDecrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId ***** -type patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId struct { - validation - obj *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - marshaller marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - unMarshaller unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - incrementHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - decrementHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter -} - -func NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { - obj := patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId{obj: &otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) setMsg(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId struct { - obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId -} - -type marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId interface { - // ToProto marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId, error) - // ToPbText marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId struct { - obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId -} - -type unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId() - 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 -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId is a 16-bit identifier used in the SENDER_TEMPLATE that can be changed to allow a sender to share resources with itself. -type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - // setMsg unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - // validate validates PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - Choice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - setChoice(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - SetValue(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - SetValues(value []uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - // Increment returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter is integer counter pattern - Increment() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - // SetIncrement assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - // SetDecrement assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId. - // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId -var PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice = struct { - VALUE PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum - VALUES PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Choice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum { - return PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) setChoice(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { - intValue, ok := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUE { - defaultValue := uint32(1) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUES { - defaultValue := []uint32{1} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter().msg() - } - - if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) SetValue(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{1}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) SetValues(value []uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Increment() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) SetIncrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Decrement() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) SetDecrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServVersion ***** -type patternFlowRSVPPathSenderTspecIntServVersion struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServVersion - marshaller marshalPatternFlowRSVPPathSenderTspecIntServVersion - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServVersion - incrementHolder PatternFlowRSVPPathSenderTspecIntServVersionCounter - decrementHolder PatternFlowRSVPPathSenderTspecIntServVersionCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServVersion() PatternFlowRSVPPathSenderTspecIntServVersion { - obj := patternFlowRSVPPathSenderTspecIntServVersion{obj: &otg.PatternFlowRSVPPathSenderTspecIntServVersion{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) msg() *otg.PatternFlowRSVPPathSenderTspecIntServVersion { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServVersion) PatternFlowRSVPPathSenderTspecIntServVersion { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServVersion struct { - obj *patternFlowRSVPPathSenderTspecIntServVersion -} - -type marshalPatternFlowRSVPPathSenderTspecIntServVersion interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServVersion to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersion - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServVersion, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServVersion to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServVersion to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServVersion to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServVersion struct { - obj *patternFlowRSVPPathSenderTspecIntServVersion -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServVersion interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServVersion from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersion - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServVersion) (PatternFlowRSVPPathSenderTspecIntServVersion, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServVersion from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServVersion from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServVersion from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServVersion { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServVersion{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServVersion { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServVersion{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServVersion) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServVersion, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServVersion) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServVersion) (PatternFlowRSVPPathSenderTspecIntServVersion, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServVersion) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServVersion) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServVersion) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServVersion) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServVersion) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServVersion) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Clone() (PatternFlowRSVPPathSenderTspecIntServVersion, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServVersion() - 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 -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTspecIntServVersion is message format version number. -type PatternFlowRSVPPathSenderTspecIntServVersion interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServVersion to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersion - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServVersion - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServVersion from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersion - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServVersion) PatternFlowRSVPPathSenderTspecIntServVersion - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServVersion - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServVersion - // validate validates PatternFlowRSVPPathSenderTspecIntServVersion - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServVersion, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServVersion - Choice() PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServVersion - setChoice(value PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum) PatternFlowRSVPPathSenderTspecIntServVersion - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServVersion - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServVersion. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServVersion - SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServVersion - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServVersion - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServVersion. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServVersion - SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServVersion - // Increment returns PatternFlowRSVPPathSenderTspecIntServVersionCounter, set in PatternFlowRSVPPathSenderTspecIntServVersion. - // PatternFlowRSVPPathSenderTspecIntServVersionCounter is integer counter pattern - Increment() PatternFlowRSVPPathSenderTspecIntServVersionCounter - // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServVersionCounter provided by user to PatternFlowRSVPPathSenderTspecIntServVersion. - // PatternFlowRSVPPathSenderTspecIntServVersionCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTspecIntServVersionCounter) PatternFlowRSVPPathSenderTspecIntServVersion - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServVersion - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTspecIntServVersionCounter, set in PatternFlowRSVPPathSenderTspecIntServVersion. - // PatternFlowRSVPPathSenderTspecIntServVersionCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSenderTspecIntServVersionCounter - // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServVersionCounter provided by user to PatternFlowRSVPPathSenderTspecIntServVersion. - // PatternFlowRSVPPathSenderTspecIntServVersionCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTspecIntServVersionCounter) PatternFlowRSVPPathSenderTspecIntServVersion - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServVersion - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServVersion -var PatternFlowRSVPPathSenderTspecIntServVersionChoice = struct { - VALUE PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum - VALUES PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Choice() PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum { - return PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) setChoice(value PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum) PatternFlowRSVPPathSenderTspecIntServVersion { - intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServVersion_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServVersion_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServVersionChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServVersionCounter().msg() - } - - if value == PatternFlowRSVPPathSenderTspecIntServVersionChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServVersionCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServVersion object -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServVersion { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServVersion object -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServVersion { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServVersionCounter -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Increment() PatternFlowRSVPPathSenderTspecIntServVersionCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServVersionCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServVersionCounter -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServVersionCounter value in the PatternFlowRSVPPathSenderTspecIntServVersion object -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServVersionCounter) PatternFlowRSVPPathSenderTspecIntServVersion { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServVersionCounter -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Decrement() PatternFlowRSVPPathSenderTspecIntServVersionCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServVersionCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServVersionCounter -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServVersionCounter value in the PatternFlowRSVPPathSenderTspecIntServVersion object -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServVersionCounter) PatternFlowRSVPPathSenderTspecIntServVersion { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServVersion.Value <= 15 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServVersion.Values <= 15 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersion) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServVersionChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServVersionChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServVersion") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTspecIntServVersion_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServVersion_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServReserved1 ***** -type patternFlowRSVPPathSenderTspecIntServReserved1 struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServReserved1 - marshaller marshalPatternFlowRSVPPathSenderTspecIntServReserved1 - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1 - incrementHolder PatternFlowRSVPPathSenderTspecIntServReserved1Counter - decrementHolder PatternFlowRSVPPathSenderTspecIntServReserved1Counter -} - -func NewPatternFlowRSVPPathSenderTspecIntServReserved1() PatternFlowRSVPPathSenderTspecIntServReserved1 { - obj := patternFlowRSVPPathSenderTspecIntServReserved1{obj: &otg.PatternFlowRSVPPathSenderTspecIntServReserved1{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved1 { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved1) PatternFlowRSVPPathSenderTspecIntServReserved1 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServReserved1 struct { - obj *patternFlowRSVPPathSenderTspecIntServReserved1 -} - -type marshalPatternFlowRSVPPathSenderTspecIntServReserved1 interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServReserved1 to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1 - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved1, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServReserved1 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServReserved1 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServReserved1 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1 struct { - obj *patternFlowRSVPPathSenderTspecIntServReserved1 -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1 interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1 from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1 - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved1) (PatternFlowRSVPPathSenderTspecIntServReserved1, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved1 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServReserved1{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved1) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved1, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved1) (PatternFlowRSVPPathSenderTspecIntServReserved1, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved1) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved1) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved1) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Clone() (PatternFlowRSVPPathSenderTspecIntServReserved1, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServReserved1() - 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 -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTspecIntServReserved1 is reserved. -type PatternFlowRSVPPathSenderTspecIntServReserved1 interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServReserved1 to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1 - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved1 - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1 from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1 - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServReserved1) PatternFlowRSVPPathSenderTspecIntServReserved1 - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved1 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1 - // validate validates PatternFlowRSVPPathSenderTspecIntServReserved1 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServReserved1, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServReserved1 - Choice() PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1 - setChoice(value PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum) PatternFlowRSVPPathSenderTspecIntServReserved1 - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServReserved1 - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved1. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1 - SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1 - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServReserved1 - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved1. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1 - SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServReserved1 - // Increment returns PatternFlowRSVPPathSenderTspecIntServReserved1Counter, set in PatternFlowRSVPPathSenderTspecIntServReserved1. - // PatternFlowRSVPPathSenderTspecIntServReserved1Counter is integer counter pattern - Increment() PatternFlowRSVPPathSenderTspecIntServReserved1Counter - // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServReserved1Counter provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1. - // PatternFlowRSVPPathSenderTspecIntServReserved1Counter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTspecIntServReserved1Counter) PatternFlowRSVPPathSenderTspecIntServReserved1 - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServReserved1 - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTspecIntServReserved1Counter, set in PatternFlowRSVPPathSenderTspecIntServReserved1. - // PatternFlowRSVPPathSenderTspecIntServReserved1Counter is integer counter pattern - Decrement() PatternFlowRSVPPathSenderTspecIntServReserved1Counter - // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServReserved1Counter provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1. - // PatternFlowRSVPPathSenderTspecIntServReserved1Counter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTspecIntServReserved1Counter) PatternFlowRSVPPathSenderTspecIntServReserved1 - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServReserved1 - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServReserved1 -var PatternFlowRSVPPathSenderTspecIntServReserved1Choice = struct { - VALUE PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum - VALUES PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Choice() PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum { - return PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) setChoice(value PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum) PatternFlowRSVPPathSenderTspecIntServReserved1 { - intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServReserved1_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServReserved1_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServReserved1Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServReserved1Counter().msg() - } - - if value == PatternFlowRSVPPathSenderTspecIntServReserved1Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServReserved1Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved1 object -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1 { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved1 object -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServReserved1 { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServReserved1Counter -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Increment() PatternFlowRSVPPathSenderTspecIntServReserved1Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServReserved1Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServReserved1Counter -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServReserved1Counter value in the PatternFlowRSVPPathSenderTspecIntServReserved1 object -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServReserved1Counter) PatternFlowRSVPPathSenderTspecIntServReserved1 { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServReserved1Counter -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Decrement() PatternFlowRSVPPathSenderTspecIntServReserved1Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServReserved1Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServReserved1Counter -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServReserved1Counter value in the PatternFlowRSVPPathSenderTspecIntServReserved1 object -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServReserved1Counter) PatternFlowRSVPPathSenderTspecIntServReserved1 { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved1.Value <= 4095 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServReserved1.Values <= 4095 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServReserved1Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServReserved1Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServReserved1") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTspecIntServReserved1_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServReserved1_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServOverallLength ***** -type patternFlowRSVPPathSenderTspecIntServOverallLength struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength - marshaller marshalPatternFlowRSVPPathSenderTspecIntServOverallLength - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLength - incrementHolder PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - decrementHolder PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServOverallLength() PatternFlowRSVPPathSenderTspecIntServOverallLength { - obj := patternFlowRSVPPathSenderTspecIntServOverallLength{obj: &otg.PatternFlowRSVPPathSenderTspecIntServOverallLength{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) msg() *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength) PatternFlowRSVPPathSenderTspecIntServOverallLength { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServOverallLength struct { - obj *patternFlowRSVPPathSenderTspecIntServOverallLength -} - -type marshalPatternFlowRSVPPathSenderTspecIntServOverallLength interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServOverallLength to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServOverallLength, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServOverallLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServOverallLength to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServOverallLength to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLength struct { - obj *patternFlowRSVPPathSenderTspecIntServOverallLength -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLength interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLength from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength) (PatternFlowRSVPPathSenderTspecIntServOverallLength, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLength from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLength from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServOverallLength { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServOverallLength{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServOverallLength) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServOverallLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLength) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength) (PatternFlowRSVPPathSenderTspecIntServOverallLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServOverallLength) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLength) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServOverallLength) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLength) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServOverallLength) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLength) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Clone() (PatternFlowRSVPPathSenderTspecIntServOverallLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServOverallLength() - 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 -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTspecIntServOverallLength is overall length (7 words not including header). -type PatternFlowRSVPPathSenderTspecIntServOverallLength interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServOverallLength to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLength from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServOverallLength) PatternFlowRSVPPathSenderTspecIntServOverallLength - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServOverallLength - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLength - // validate validates PatternFlowRSVPPathSenderTspecIntServOverallLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServOverallLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServOverallLength - Choice() PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLength - setChoice(value PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum) PatternFlowRSVPPathSenderTspecIntServOverallLength - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServOverallLength - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServOverallLength. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLength - SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLength - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServOverallLength - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServOverallLength. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLength - SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServOverallLength - // Increment returns PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, set in PatternFlowRSVPPathSenderTspecIntServOverallLength. - // PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter is integer counter pattern - Increment() PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLength. - // PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) PatternFlowRSVPPathSenderTspecIntServOverallLength - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServOverallLength - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, set in PatternFlowRSVPPathSenderTspecIntServOverallLength. - // PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLength. - // PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) PatternFlowRSVPPathSenderTspecIntServOverallLength - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServOverallLength - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServOverallLength -var PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice = struct { - VALUE PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum - VALUES PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Choice() PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum { - return PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) setChoice(value PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum) PatternFlowRSVPPathSenderTspecIntServOverallLength { - intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUE { - defaultValue := uint32(7) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUES { - defaultValue := []uint32{7} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter().msg() - } - - if value == PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServOverallLength object -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLength { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{7}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServOverallLength object -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServOverallLength { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Increment() PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServOverallLengthCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter value in the PatternFlowRSVPPathSenderTspecIntServOverallLength object -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) PatternFlowRSVPPathSenderTspecIntServOverallLength { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Decrement() PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServOverallLengthCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter value in the PatternFlowRSVPPathSenderTspecIntServOverallLength object -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) PatternFlowRSVPPathSenderTspecIntServOverallLength { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServOverallLength.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServOverallLength.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServOverallLength") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServServiceHeader ***** -type patternFlowRSVPPathSenderTspecIntServServiceHeader struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader - marshaller marshalPatternFlowRSVPPathSenderTspecIntServServiceHeader - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeader - incrementHolder PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - decrementHolder PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServServiceHeader() PatternFlowRSVPPathSenderTspecIntServServiceHeader { - obj := patternFlowRSVPPathSenderTspecIntServServiceHeader{obj: &otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) msg() *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader) PatternFlowRSVPPathSenderTspecIntServServiceHeader { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServServiceHeader struct { - obj *patternFlowRSVPPathSenderTspecIntServServiceHeader -} - -type marshalPatternFlowRSVPPathSenderTspecIntServServiceHeader interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServServiceHeader to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServServiceHeader to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServServiceHeader to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServServiceHeader to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeader struct { - obj *patternFlowRSVPPathSenderTspecIntServServiceHeader -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeader interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeader from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader) (PatternFlowRSVPPathSenderTspecIntServServiceHeader, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeader from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeader from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeader from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServServiceHeader { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServServiceHeader{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeader { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeader{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader) (PatternFlowRSVPPathSenderTspecIntServServiceHeader, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Clone() (PatternFlowRSVPPathSenderTspecIntServServiceHeader, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServServiceHeader() - 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 -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTspecIntServServiceHeader is service header, service number - '1' (Generic information) if in a PATH message. -type PatternFlowRSVPPathSenderTspecIntServServiceHeader interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServServiceHeader to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeader from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader) PatternFlowRSVPPathSenderTspecIntServServiceHeader - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServServiceHeader - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeader - // validate validates PatternFlowRSVPPathSenderTspecIntServServiceHeader - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServServiceHeader, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServServiceHeader - Choice() PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeader - setChoice(value PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum) PatternFlowRSVPPathSenderTspecIntServServiceHeader - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServServiceHeader - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServServiceHeader. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeader - SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeader - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServServiceHeader - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServServiceHeader. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeader - SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeader - // Increment returns PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, set in PatternFlowRSVPPathSenderTspecIntServServiceHeader. - // PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter is integer counter pattern - Increment() PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeader. - // PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) PatternFlowRSVPPathSenderTspecIntServServiceHeader - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServServiceHeader - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, set in PatternFlowRSVPPathSenderTspecIntServServiceHeader. - // PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeader. - // PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) PatternFlowRSVPPathSenderTspecIntServServiceHeader - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServServiceHeader - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServServiceHeader -var PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice = struct { - VALUE PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum - VALUES PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Choice() PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum { - return PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) setChoice(value PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum) PatternFlowRSVPPathSenderTspecIntServServiceHeader { - intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUE { - defaultValue := uint32(1) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUES { - defaultValue := []uint32{1} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter().msg() - } - - if value == PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServServiceHeader object -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeader { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{1}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServServiceHeader object -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeader { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Increment() PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter value in the PatternFlowRSVPPathSenderTspecIntServServiceHeader object -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) PatternFlowRSVPPathSenderTspecIntServServiceHeader { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Decrement() PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter value in the PatternFlowRSVPPathSenderTspecIntServServiceHeader object -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) PatternFlowRSVPPathSenderTspecIntServServiceHeader { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServServiceHeader.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServServiceHeader.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServServiceHeader") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServZeroBit ***** -type patternFlowRSVPPathSenderTspecIntServZeroBit struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit - marshaller marshalPatternFlowRSVPPathSenderTspecIntServZeroBit - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBit - incrementHolder PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - decrementHolder PatternFlowRSVPPathSenderTspecIntServZeroBitCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServZeroBit() PatternFlowRSVPPathSenderTspecIntServZeroBit { - obj := patternFlowRSVPPathSenderTspecIntServZeroBit{obj: &otg.PatternFlowRSVPPathSenderTspecIntServZeroBit{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) msg() *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit) PatternFlowRSVPPathSenderTspecIntServZeroBit { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServZeroBit struct { - obj *patternFlowRSVPPathSenderTspecIntServZeroBit -} - -type marshalPatternFlowRSVPPathSenderTspecIntServZeroBit interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServZeroBit to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServZeroBit, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServZeroBit to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServZeroBit to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServZeroBit to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBit struct { - obj *patternFlowRSVPPathSenderTspecIntServZeroBit -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBit interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBit from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit) (PatternFlowRSVPPathSenderTspecIntServZeroBit, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBit from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBit from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBit from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServZeroBit { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServZeroBit{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBit { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBit{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServZeroBit) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServZeroBit, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBit) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit) (PatternFlowRSVPPathSenderTspecIntServZeroBit, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServZeroBit) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBit) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServZeroBit) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBit) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServZeroBit) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBit) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Clone() (PatternFlowRSVPPathSenderTspecIntServZeroBit, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServZeroBit() - 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 -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTspecIntServZeroBit is mUST be 0. -type PatternFlowRSVPPathSenderTspecIntServZeroBit interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServZeroBit to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBit from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServZeroBit) PatternFlowRSVPPathSenderTspecIntServZeroBit - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServZeroBit - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBit - // validate validates PatternFlowRSVPPathSenderTspecIntServZeroBit - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServZeroBit, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServZeroBit - Choice() PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBit - setChoice(value PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum) PatternFlowRSVPPathSenderTspecIntServZeroBit - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServZeroBit - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServZeroBit. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBit - SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBit - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServZeroBit - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServZeroBit. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBit - SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServZeroBit - // Increment returns PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, set in PatternFlowRSVPPathSenderTspecIntServZeroBit. - // PatternFlowRSVPPathSenderTspecIntServZeroBitCounter is integer counter pattern - Increment() PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServZeroBitCounter provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBit. - // PatternFlowRSVPPathSenderTspecIntServZeroBitCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) PatternFlowRSVPPathSenderTspecIntServZeroBit - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServZeroBit - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, set in PatternFlowRSVPPathSenderTspecIntServZeroBit. - // PatternFlowRSVPPathSenderTspecIntServZeroBitCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServZeroBitCounter provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBit. - // PatternFlowRSVPPathSenderTspecIntServZeroBitCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) PatternFlowRSVPPathSenderTspecIntServZeroBit - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServZeroBit - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServZeroBit -var PatternFlowRSVPPathSenderTspecIntServZeroBitChoice = struct { - VALUE PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum - VALUES PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Choice() PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum { - return PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) setChoice(value PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum) PatternFlowRSVPPathSenderTspecIntServZeroBit { - intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServZeroBitCounter().msg() - } - - if value == PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServZeroBitCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServZeroBit object -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBit { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServZeroBit object -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServZeroBit { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServZeroBitCounter -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Increment() PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServZeroBitCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServZeroBitCounter -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServZeroBitCounter value in the PatternFlowRSVPPathSenderTspecIntServZeroBit object -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) PatternFlowRSVPPathSenderTspecIntServZeroBit { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServZeroBitCounter -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Decrement() PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServZeroBitCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServZeroBitCounter -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServZeroBitCounter value in the PatternFlowRSVPPathSenderTspecIntServZeroBit object -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) PatternFlowRSVPPathSenderTspecIntServZeroBit { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServZeroBit.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServZeroBit.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServZeroBit") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServReserved2 ***** -type patternFlowRSVPPathSenderTspecIntServReserved2 struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServReserved2 - marshaller marshalPatternFlowRSVPPathSenderTspecIntServReserved2 - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2 - incrementHolder PatternFlowRSVPPathSenderTspecIntServReserved2Counter - decrementHolder PatternFlowRSVPPathSenderTspecIntServReserved2Counter -} - -func NewPatternFlowRSVPPathSenderTspecIntServReserved2() PatternFlowRSVPPathSenderTspecIntServReserved2 { - obj := patternFlowRSVPPathSenderTspecIntServReserved2{obj: &otg.PatternFlowRSVPPathSenderTspecIntServReserved2{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved2 { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved2) PatternFlowRSVPPathSenderTspecIntServReserved2 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServReserved2 struct { - obj *patternFlowRSVPPathSenderTspecIntServReserved2 -} - -type marshalPatternFlowRSVPPathSenderTspecIntServReserved2 interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServReserved2 to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2 - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved2, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServReserved2 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServReserved2 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServReserved2 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2 struct { - obj *patternFlowRSVPPathSenderTspecIntServReserved2 -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2 interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2 from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2 - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved2) (PatternFlowRSVPPathSenderTspecIntServReserved2, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved2 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServReserved2{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved2) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved2, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved2) (PatternFlowRSVPPathSenderTspecIntServReserved2, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved2) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved2) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved2) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Clone() (PatternFlowRSVPPathSenderTspecIntServReserved2, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServReserved2() - 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 -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTspecIntServReserved2 is reserved. -type PatternFlowRSVPPathSenderTspecIntServReserved2 interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServReserved2 to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2 - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved2 - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2 from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2 - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServReserved2) PatternFlowRSVPPathSenderTspecIntServReserved2 - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved2 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2 - // validate validates PatternFlowRSVPPathSenderTspecIntServReserved2 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServReserved2, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServReserved2 - Choice() PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2 - setChoice(value PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum) PatternFlowRSVPPathSenderTspecIntServReserved2 - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServReserved2 - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved2. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2 - SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2 - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServReserved2 - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved2. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2 - SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServReserved2 - // Increment returns PatternFlowRSVPPathSenderTspecIntServReserved2Counter, set in PatternFlowRSVPPathSenderTspecIntServReserved2. - // PatternFlowRSVPPathSenderTspecIntServReserved2Counter is integer counter pattern - Increment() PatternFlowRSVPPathSenderTspecIntServReserved2Counter - // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServReserved2Counter provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2. - // PatternFlowRSVPPathSenderTspecIntServReserved2Counter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTspecIntServReserved2Counter) PatternFlowRSVPPathSenderTspecIntServReserved2 - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServReserved2 - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTspecIntServReserved2Counter, set in PatternFlowRSVPPathSenderTspecIntServReserved2. - // PatternFlowRSVPPathSenderTspecIntServReserved2Counter is integer counter pattern - Decrement() PatternFlowRSVPPathSenderTspecIntServReserved2Counter - // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServReserved2Counter provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2. - // PatternFlowRSVPPathSenderTspecIntServReserved2Counter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTspecIntServReserved2Counter) PatternFlowRSVPPathSenderTspecIntServReserved2 - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServReserved2 - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServReserved2 -var PatternFlowRSVPPathSenderTspecIntServReserved2Choice = struct { - VALUE PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum - VALUES PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Choice() PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum { - return PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) setChoice(value PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum) PatternFlowRSVPPathSenderTspecIntServReserved2 { - intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServReserved2_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServReserved2_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServReserved2Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServReserved2Counter().msg() - } - - if value == PatternFlowRSVPPathSenderTspecIntServReserved2Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServReserved2Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved2 object -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2 { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved2 object -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServReserved2 { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServReserved2Counter -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Increment() PatternFlowRSVPPathSenderTspecIntServReserved2Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServReserved2Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServReserved2Counter -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServReserved2Counter value in the PatternFlowRSVPPathSenderTspecIntServReserved2 object -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServReserved2Counter) PatternFlowRSVPPathSenderTspecIntServReserved2 { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServReserved2Counter -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Decrement() PatternFlowRSVPPathSenderTspecIntServReserved2Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServReserved2Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServReserved2Counter -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServReserved2Counter value in the PatternFlowRSVPPathSenderTspecIntServReserved2 object -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServReserved2Counter) PatternFlowRSVPPathSenderTspecIntServReserved2 { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 127 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved2.Value <= 127 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 127 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServReserved2.Values <= 127 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServReserved2Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServReserved2Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServReserved2") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTspecIntServReserved2_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServReserved2_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData ***** -type patternFlowRSVPPathSenderTspecIntServLengthOfServiceData struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - marshaller marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - incrementHolder PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - decrementHolder PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { - obj := patternFlowRSVPPathSenderTspecIntServLengthOfServiceData{obj: &otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) msg() *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData struct { - obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData -} - -type marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData struct { - obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Clone() (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData() - 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 -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData is length of service data, 6 words not including per-service header. -type PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - // validate validates PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - Choice() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - setChoice(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - // Increment returns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData. - // PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter is integer counter pattern - Increment() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData. - // PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData. - // PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData. - // PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData -var PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice = struct { - VALUE PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum - VALUES PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Choice() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum { - return PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) setChoice(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { - intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUE { - defaultValue := uint32(6) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUES { - defaultValue := []uint32{6} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter().msg() - } - - if value == PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData object -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{6}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData object -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Increment() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter value in the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData object -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Decrement() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter value in the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData object -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec ***** -type patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - marshaller marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - incrementHolder PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - decrementHolder PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { - obj := patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec{obj: &otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec struct { - obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec -} - -type marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec struct { - obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Clone() (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec() - 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 -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec is parameter ID, parameter 127 (Token Bucket TSpec) -type PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - // validate validates PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - Choice() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - setChoice(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - // Increment returns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec. - // PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter is integer counter pattern - Increment() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec. - // PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec. - // PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec. - // PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec -var PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice = struct { - VALUE PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum - VALUES PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Choice() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum { - return PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) setChoice(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { - intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUE { - defaultValue := uint32(127) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUES { - defaultValue := []uint32{127} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter().msg() - } - - if value == PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec object -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{127}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec object -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Increment() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter value in the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec object -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Decrement() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter value in the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec object -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServParameter127Flag ***** -type patternFlowRSVPPathSenderTspecIntServParameter127Flag struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag - marshaller marshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag - incrementHolder PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - decrementHolder PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServParameter127Flag() PatternFlowRSVPPathSenderTspecIntServParameter127Flag { - obj := patternFlowRSVPPathSenderTspecIntServParameter127Flag{obj: &otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag) PatternFlowRSVPPathSenderTspecIntServParameter127Flag { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag struct { - obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag -} - -type marshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag struct { - obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag) (PatternFlowRSVPPathSenderTspecIntServParameter127Flag, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag) (PatternFlowRSVPPathSenderTspecIntServParameter127Flag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127Flag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServParameter127Flag() - 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 -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTspecIntServParameter127Flag is parameter 127 flags (none set) -type PatternFlowRSVPPathSenderTspecIntServParameter127Flag interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag) PatternFlowRSVPPathSenderTspecIntServParameter127Flag - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag - // validate validates PatternFlowRSVPPathSenderTspecIntServParameter127Flag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127Flag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag - Choice() PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Flag - setChoice(value PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum) PatternFlowRSVPPathSenderTspecIntServParameter127Flag - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Flag - SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Flag - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Flag - SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Flag - // Increment returns PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag. - // PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter is integer counter pattern - Increment() PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Flag. - // PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Flag - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag. - // PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Flag. - // PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Flag - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServParameter127Flag -var PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice = struct { - VALUE PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum - VALUES PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Choice() PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum { - return PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) setChoice(value PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum) PatternFlowRSVPPathSenderTspecIntServParameter127Flag { - intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter().msg() - } - - if value == PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127Flag object -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Flag { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127Flag object -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Flag { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Increment() PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter value in the PatternFlowRSVPPathSenderTspecIntServParameter127Flag object -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Flag { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Decrement() PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter value in the PatternFlowRSVPPathSenderTspecIntServParameter127Flag object -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Flag { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127Flag.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServParameter127Flag.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServParameter127Flag") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServParameter127Length ***** -type patternFlowRSVPPathSenderTspecIntServParameter127Length struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length - marshaller marshalPatternFlowRSVPPathSenderTspecIntServParameter127Length - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Length - incrementHolder PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - decrementHolder PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServParameter127Length() PatternFlowRSVPPathSenderTspecIntServParameter127Length { - obj := patternFlowRSVPPathSenderTspecIntServParameter127Length{obj: &otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length) PatternFlowRSVPPathSenderTspecIntServParameter127Length { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServParameter127Length struct { - obj *patternFlowRSVPPathSenderTspecIntServParameter127Length -} - -type marshalPatternFlowRSVPPathSenderTspecIntServParameter127Length interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServParameter127Length to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServParameter127Length to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServParameter127Length to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServParameter127Length to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Length struct { - obj *patternFlowRSVPPathSenderTspecIntServParameter127Length -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Length interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Length from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length) (PatternFlowRSVPPathSenderTspecIntServParameter127Length, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Length from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Length from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Length from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127Length { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServParameter127Length{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Length { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Length{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length) (PatternFlowRSVPPathSenderTspecIntServParameter127Length, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127Length, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServParameter127Length() - 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 -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTspecIntServParameter127Length is parameter 127 length, 5 words not including per-service header -type PatternFlowRSVPPathSenderTspecIntServParameter127Length interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServParameter127Length to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Length from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length) PatternFlowRSVPPathSenderTspecIntServParameter127Length - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127Length - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Length - // validate validates PatternFlowRSVPPathSenderTspecIntServParameter127Length - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127Length, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServParameter127Length - Choice() PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Length - setChoice(value PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum) PatternFlowRSVPPathSenderTspecIntServParameter127Length - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Length - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127Length. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Length - SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Length - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Length - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127Length. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Length - SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Length - // Increment returns PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, set in PatternFlowRSVPPathSenderTspecIntServParameter127Length. - // PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter is integer counter pattern - Increment() PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Length. - // PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Length - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Length - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, set in PatternFlowRSVPPathSenderTspecIntServParameter127Length. - // PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Length. - // PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Length - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Length - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServParameter127Length -var PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice = struct { - VALUE PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum - VALUES PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Choice() PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum { - return PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) setChoice(value PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum) PatternFlowRSVPPathSenderTspecIntServParameter127Length { - intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUE { - defaultValue := uint32(5) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUES { - defaultValue := []uint32{5} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter().msg() - } - - if value == PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127Length object -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Length { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{5}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127Length object -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Length { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Increment() PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter value in the PatternFlowRSVPPathSenderTspecIntServParameter127Length object -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Length { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Decrement() PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter value in the PatternFlowRSVPPathSenderTspecIntServParameter127Length object -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Length { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127Length.Value <= 65535 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServParameter127Length.Values <= 65535 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServParameter127Length") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit ***** -type patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - marshaller marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - incrementHolder PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - decrementHolder PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { - obj := patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit{obj: &otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) msg() *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit struct { - obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit -} - -type marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit struct { - obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Clone() (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit() - 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 -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit is the minimum policed unit parameter should generally be set equal to the size of the smallest packet generated by the application. -type PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - // validate validates PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - Choice() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - setChoice(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - // Increment returns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit. - // PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter is integer counter pattern - Increment() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit. - // PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit. - // PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit. - // PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit -var PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice = struct { - VALUE PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum - VALUES PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Choice() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum { - return PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) setChoice(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { - intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter().msg() - } - - if value == PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit object -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit object -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Increment() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter value in the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit object -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Decrement() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter value in the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit object -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize ***** -type patternFlowRSVPPathSenderTspecIntServMaximumPacketSize struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - marshaller marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - incrementHolder PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - decrementHolder PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { - obj := patternFlowRSVPPathSenderTspecIntServMaximumPacketSize{obj: &otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) msg() *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize struct { - obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize -} - -type marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize struct { - obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Clone() (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize() - 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 -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize is the maximum packet size parameter should be set to the size of the largest packet the application might wish to generate. This value must, by definition, be equal to or larger than the value of The minimum policed unit. -type PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - // validate validates PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - Choice() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum - // setChoice assigns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - setChoice(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - // Increment returns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize. - // PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter is integer counter pattern - Increment() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize. - // PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize. - // PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize. - // PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize -var PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice = struct { - VALUE PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum - VALUES PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum - INCREMENT PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum - DECREMENT PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Choice() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum { - return PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) setChoice(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { - intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter().msg() - } - - if value == PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize object -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize object -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Increment() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter value in the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize object -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Decrement() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter value in the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize object -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize") - } - } else { - intVal := otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPType1RecordRouteSubobjects ***** -type flowRSVPType1RecordRouteSubobjects struct { - validation - obj *otg.FlowRSVPType1RecordRouteSubobjects - marshaller marshalFlowRSVPType1RecordRouteSubobjects - unMarshaller unMarshalFlowRSVPType1RecordRouteSubobjects - typeHolder FlowRSVPPathObjectsRecordRouteSubObjectType -} - -func NewFlowRSVPType1RecordRouteSubobjects() FlowRSVPType1RecordRouteSubobjects { - obj := flowRSVPType1RecordRouteSubobjects{obj: &otg.FlowRSVPType1RecordRouteSubobjects{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPType1RecordRouteSubobjects) msg() *otg.FlowRSVPType1RecordRouteSubobjects { - return obj.obj -} - -func (obj *flowRSVPType1RecordRouteSubobjects) setMsg(msg *otg.FlowRSVPType1RecordRouteSubobjects) FlowRSVPType1RecordRouteSubobjects { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPType1RecordRouteSubobjects struct { - obj *flowRSVPType1RecordRouteSubobjects -} - -type marshalFlowRSVPType1RecordRouteSubobjects interface { - // ToProto marshals FlowRSVPType1RecordRouteSubobjects to protobuf object *otg.FlowRSVPType1RecordRouteSubobjects - ToProto() (*otg.FlowRSVPType1RecordRouteSubobjects, error) - // ToPbText marshals FlowRSVPType1RecordRouteSubobjects to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPType1RecordRouteSubobjects to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPType1RecordRouteSubobjects to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPType1RecordRouteSubobjects struct { - obj *flowRSVPType1RecordRouteSubobjects -} - -type unMarshalFlowRSVPType1RecordRouteSubobjects interface { - // FromProto unmarshals FlowRSVPType1RecordRouteSubobjects from protobuf object *otg.FlowRSVPType1RecordRouteSubobjects - FromProto(msg *otg.FlowRSVPType1RecordRouteSubobjects) (FlowRSVPType1RecordRouteSubobjects, error) - // FromPbText unmarshals FlowRSVPType1RecordRouteSubobjects from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPType1RecordRouteSubobjects from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPType1RecordRouteSubobjects from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPType1RecordRouteSubobjects) Marshal() marshalFlowRSVPType1RecordRouteSubobjects { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPType1RecordRouteSubobjects{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPType1RecordRouteSubobjects) Unmarshal() unMarshalFlowRSVPType1RecordRouteSubobjects { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPType1RecordRouteSubobjects{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPType1RecordRouteSubobjects) ToProto() (*otg.FlowRSVPType1RecordRouteSubobjects, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPType1RecordRouteSubobjects) FromProto(msg *otg.FlowRSVPType1RecordRouteSubobjects) (FlowRSVPType1RecordRouteSubobjects, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPType1RecordRouteSubobjects) 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 *unMarshalflowRSVPType1RecordRouteSubobjects) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPType1RecordRouteSubobjects) 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 *unMarshalflowRSVPType1RecordRouteSubobjects) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPType1RecordRouteSubobjects) 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 *unMarshalflowRSVPType1RecordRouteSubobjects) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPType1RecordRouteSubobjects) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPType1RecordRouteSubobjects) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPType1RecordRouteSubobjects) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPType1RecordRouteSubobjects) Clone() (FlowRSVPType1RecordRouteSubobjects, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPType1RecordRouteSubobjects() - 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 -} - -func (obj *flowRSVPType1RecordRouteSubobjects) setNil() { - obj.typeHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPType1RecordRouteSubobjects is type is specific to a subobject. -type FlowRSVPType1RecordRouteSubobjects interface { - Validation - // msg marshals FlowRSVPType1RecordRouteSubobjects to protobuf object *otg.FlowRSVPType1RecordRouteSubobjects - // and doesn't set defaults - msg() *otg.FlowRSVPType1RecordRouteSubobjects - // setMsg unmarshals FlowRSVPType1RecordRouteSubobjects from protobuf object *otg.FlowRSVPType1RecordRouteSubobjects - // and doesn't set defaults - setMsg(*otg.FlowRSVPType1RecordRouteSubobjects) FlowRSVPType1RecordRouteSubobjects - // provides marshal interface - Marshal() marshalFlowRSVPType1RecordRouteSubobjects - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPType1RecordRouteSubobjects - // validate validates FlowRSVPType1RecordRouteSubobjects - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPType1RecordRouteSubobjects, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Type returns FlowRSVPPathObjectsRecordRouteSubObjectType, set in FlowRSVPType1RecordRouteSubobjects. - // FlowRSVPPathObjectsRecordRouteSubObjectType is currently supported subobjects are IPv4 address(1) and Label(3). - Type() FlowRSVPPathObjectsRecordRouteSubObjectType - // SetType assigns FlowRSVPPathObjectsRecordRouteSubObjectType provided by user to FlowRSVPType1RecordRouteSubobjects. - // FlowRSVPPathObjectsRecordRouteSubObjectType is currently supported subobjects are IPv4 address(1) and Label(3). - SetType(value FlowRSVPPathObjectsRecordRouteSubObjectType) FlowRSVPType1RecordRouteSubobjects - // HasType checks if Type has been set in FlowRSVPType1RecordRouteSubobjects - HasType() bool - setNil() -} - -// description is TBD -// Type returns a FlowRSVPPathObjectsRecordRouteSubObjectType -func (obj *flowRSVPType1RecordRouteSubobjects) Type() FlowRSVPPathObjectsRecordRouteSubObjectType { - if obj.obj.Type == nil { - obj.obj.Type = NewFlowRSVPPathObjectsRecordRouteSubObjectType().msg() - } - if obj.typeHolder == nil { - obj.typeHolder = &flowRSVPPathObjectsRecordRouteSubObjectType{obj: obj.obj.Type} - } - return obj.typeHolder -} - -// description is TBD -// Type returns a FlowRSVPPathObjectsRecordRouteSubObjectType -func (obj *flowRSVPType1RecordRouteSubobjects) HasType() bool { - return obj.obj.Type != nil -} - -// description is TBD -// SetType sets the FlowRSVPPathObjectsRecordRouteSubObjectType value in the FlowRSVPType1RecordRouteSubobjects object -func (obj *flowRSVPType1RecordRouteSubobjects) SetType(value FlowRSVPPathObjectsRecordRouteSubObjectType) FlowRSVPType1RecordRouteSubobjects { - - obj.typeHolder = nil - obj.obj.Type = value.msg() - - return obj -} - -func (obj *flowRSVPType1RecordRouteSubobjects) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Type != nil { - - obj.Type().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPType1RecordRouteSubobjects) setDefault() { - -} - -// ***** BgpAttributesBsidMpls ***** -type bgpAttributesBsidMpls struct { - validation - obj *otg.BgpAttributesBsidMpls - marshaller marshalBgpAttributesBsidMpls - unMarshaller unMarshalBgpAttributesBsidMpls - mplsSidHolder BgpAttributesSidMpls -} - -func NewBgpAttributesBsidMpls() BgpAttributesBsidMpls { - obj := bgpAttributesBsidMpls{obj: &otg.BgpAttributesBsidMpls{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesBsidMpls) msg() *otg.BgpAttributesBsidMpls { - return obj.obj -} - -func (obj *bgpAttributesBsidMpls) setMsg(msg *otg.BgpAttributesBsidMpls) BgpAttributesBsidMpls { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesBsidMpls struct { - obj *bgpAttributesBsidMpls -} - -type marshalBgpAttributesBsidMpls interface { - // ToProto marshals BgpAttributesBsidMpls to protobuf object *otg.BgpAttributesBsidMpls - ToProto() (*otg.BgpAttributesBsidMpls, error) - // ToPbText marshals BgpAttributesBsidMpls to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesBsidMpls to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesBsidMpls to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesBsidMpls struct { - obj *bgpAttributesBsidMpls -} - -type unMarshalBgpAttributesBsidMpls interface { - // FromProto unmarshals BgpAttributesBsidMpls from protobuf object *otg.BgpAttributesBsidMpls - FromProto(msg *otg.BgpAttributesBsidMpls) (BgpAttributesBsidMpls, error) - // FromPbText unmarshals BgpAttributesBsidMpls from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesBsidMpls from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesBsidMpls from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesBsidMpls) Marshal() marshalBgpAttributesBsidMpls { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesBsidMpls{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesBsidMpls) Unmarshal() unMarshalBgpAttributesBsidMpls { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesBsidMpls{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesBsidMpls) ToProto() (*otg.BgpAttributesBsidMpls, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesBsidMpls) FromProto(msg *otg.BgpAttributesBsidMpls) (BgpAttributesBsidMpls, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesBsidMpls) 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 *unMarshalbgpAttributesBsidMpls) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesBsidMpls) 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 *unMarshalbgpAttributesBsidMpls) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesBsidMpls) 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 *unMarshalbgpAttributesBsidMpls) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesBsidMpls) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesBsidMpls) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesBsidMpls) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesBsidMpls) Clone() (BgpAttributesBsidMpls, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesBsidMpls() - 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 -} - -func (obj *bgpAttributesBsidMpls) setNil() { - obj.mplsSidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesBsidMpls is when the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that BSID defined -// as a MPLS label.The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . -type BgpAttributesBsidMpls interface { - Validation - // msg marshals BgpAttributesBsidMpls to protobuf object *otg.BgpAttributesBsidMpls - // and doesn't set defaults - msg() *otg.BgpAttributesBsidMpls - // setMsg unmarshals BgpAttributesBsidMpls from protobuf object *otg.BgpAttributesBsidMpls - // and doesn't set defaults - setMsg(*otg.BgpAttributesBsidMpls) BgpAttributesBsidMpls - // provides marshal interface - Marshal() marshalBgpAttributesBsidMpls - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesBsidMpls - // validate validates BgpAttributesBsidMpls - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesBsidMpls, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // FlagSpecifiedBsidOnly returns bool, set in BgpAttributesBsidMpls. - FlagSpecifiedBsidOnly() bool - // SetFlagSpecifiedBsidOnly assigns bool provided by user to BgpAttributesBsidMpls - SetFlagSpecifiedBsidOnly(value bool) BgpAttributesBsidMpls - // HasFlagSpecifiedBsidOnly checks if FlagSpecifiedBsidOnly has been set in BgpAttributesBsidMpls - HasFlagSpecifiedBsidOnly() bool - // FlagDropUponInvalid returns bool, set in BgpAttributesBsidMpls. - FlagDropUponInvalid() bool - // SetFlagDropUponInvalid assigns bool provided by user to BgpAttributesBsidMpls - SetFlagDropUponInvalid(value bool) BgpAttributesBsidMpls - // HasFlagDropUponInvalid checks if FlagDropUponInvalid has been set in BgpAttributesBsidMpls - HasFlagDropUponInvalid() bool - // MplsSid returns BgpAttributesSidMpls, set in BgpAttributesBsidMpls. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - MplsSid() BgpAttributesSidMpls - // SetMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesBsidMpls. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - SetMplsSid(value BgpAttributesSidMpls) BgpAttributesBsidMpls - // HasMplsSid checks if MplsSid has been set in BgpAttributesBsidMpls - HasMplsSid() bool - setNil() -} - -// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is -// described in section 6.2.3 in [RFC9256]. -// FlagSpecifiedBsidOnly returns a bool -func (obj *bgpAttributesBsidMpls) FlagSpecifiedBsidOnly() bool { - - return *obj.obj.FlagSpecifiedBsidOnly - -} - -// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is -// described in section 6.2.3 in [RFC9256]. -// FlagSpecifiedBsidOnly returns a bool -func (obj *bgpAttributesBsidMpls) HasFlagSpecifiedBsidOnly() bool { - return obj.obj.FlagSpecifiedBsidOnly != nil -} - -// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is -// described in section 6.2.3 in [RFC9256]. -// SetFlagSpecifiedBsidOnly sets the bool value in the BgpAttributesBsidMpls object -func (obj *bgpAttributesBsidMpls) SetFlagSpecifiedBsidOnly(value bool) BgpAttributesBsidMpls { - - obj.obj.FlagSpecifiedBsidOnly = &value - return obj -} - -// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. -// It's usage is described in section 8.2 in [RFC9256]. -// FlagDropUponInvalid returns a bool -func (obj *bgpAttributesBsidMpls) FlagDropUponInvalid() bool { - - return *obj.obj.FlagDropUponInvalid - -} - -// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. -// It's usage is described in section 8.2 in [RFC9256]. -// FlagDropUponInvalid returns a bool -func (obj *bgpAttributesBsidMpls) HasFlagDropUponInvalid() bool { - return obj.obj.FlagDropUponInvalid != nil -} - -// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. -// It's usage is described in section 8.2 in [RFC9256]. -// SetFlagDropUponInvalid sets the bool value in the BgpAttributesBsidMpls object -func (obj *bgpAttributesBsidMpls) SetFlagDropUponInvalid(value bool) BgpAttributesBsidMpls { - - obj.obj.FlagDropUponInvalid = &value - return obj -} - -// description is TBD -// MplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesBsidMpls) MplsSid() BgpAttributesSidMpls { - if obj.obj.MplsSid == nil { - obj.obj.MplsSid = NewBgpAttributesSidMpls().msg() - } - if obj.mplsSidHolder == nil { - obj.mplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.MplsSid} - } - return obj.mplsSidHolder -} - -// description is TBD -// MplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesBsidMpls) HasMplsSid() bool { - return obj.obj.MplsSid != nil -} - -// description is TBD -// SetMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesBsidMpls object -func (obj *bgpAttributesBsidMpls) SetMplsSid(value BgpAttributesSidMpls) BgpAttributesBsidMpls { - - obj.mplsSidHolder = nil - obj.obj.MplsSid = value.msg() - - return obj -} - -func (obj *bgpAttributesBsidMpls) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.MplsSid != nil { - - obj.MplsSid().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesBsidMpls) setDefault() { - if obj.obj.FlagSpecifiedBsidOnly == nil { - obj.SetFlagSpecifiedBsidOnly(false) - } - if obj.obj.FlagDropUponInvalid == nil { - obj.SetFlagDropUponInvalid(false) - } - -} - -// ***** BgpAttributesBsidSrv6 ***** -type bgpAttributesBsidSrv6 struct { - validation - obj *otg.BgpAttributesBsidSrv6 - marshaller marshalBgpAttributesBsidSrv6 - unMarshaller unMarshalBgpAttributesBsidSrv6 -} - -func NewBgpAttributesBsidSrv6() BgpAttributesBsidSrv6 { - obj := bgpAttributesBsidSrv6{obj: &otg.BgpAttributesBsidSrv6{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesBsidSrv6) msg() *otg.BgpAttributesBsidSrv6 { - return obj.obj -} - -func (obj *bgpAttributesBsidSrv6) setMsg(msg *otg.BgpAttributesBsidSrv6) BgpAttributesBsidSrv6 { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesBsidSrv6 struct { - obj *bgpAttributesBsidSrv6 -} - -type marshalBgpAttributesBsidSrv6 interface { - // ToProto marshals BgpAttributesBsidSrv6 to protobuf object *otg.BgpAttributesBsidSrv6 - ToProto() (*otg.BgpAttributesBsidSrv6, error) - // ToPbText marshals BgpAttributesBsidSrv6 to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesBsidSrv6 to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesBsidSrv6 to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesBsidSrv6 struct { - obj *bgpAttributesBsidSrv6 -} - -type unMarshalBgpAttributesBsidSrv6 interface { - // FromProto unmarshals BgpAttributesBsidSrv6 from protobuf object *otg.BgpAttributesBsidSrv6 - FromProto(msg *otg.BgpAttributesBsidSrv6) (BgpAttributesBsidSrv6, error) - // FromPbText unmarshals BgpAttributesBsidSrv6 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesBsidSrv6 from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesBsidSrv6 from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesBsidSrv6) Marshal() marshalBgpAttributesBsidSrv6 { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesBsidSrv6{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesBsidSrv6) Unmarshal() unMarshalBgpAttributesBsidSrv6 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesBsidSrv6{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesBsidSrv6) ToProto() (*otg.BgpAttributesBsidSrv6, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesBsidSrv6) FromProto(msg *otg.BgpAttributesBsidSrv6) (BgpAttributesBsidSrv6, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesBsidSrv6) 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 *unMarshalbgpAttributesBsidSrv6) 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 *marshalbgpAttributesBsidSrv6) 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 *unMarshalbgpAttributesBsidSrv6) 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 *marshalbgpAttributesBsidSrv6) 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 *unMarshalbgpAttributesBsidSrv6) 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 *bgpAttributesBsidSrv6) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesBsidSrv6) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesBsidSrv6) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesBsidSrv6) Clone() (BgpAttributesBsidSrv6, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesBsidSrv6() - 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 -} - -// BgpAttributesBsidSrv6 is when the active candidate path has a specified Binding Segment Identifier, the SR Policy uses that BSID defined -// as an IPv6 Address.The format of the sub-TLV is defined in draft-ietf-idr-sr-policy-safi-02 Section 2.4.2 . -type BgpAttributesBsidSrv6 interface { - Validation - // msg marshals BgpAttributesBsidSrv6 to protobuf object *otg.BgpAttributesBsidSrv6 - // and doesn't set defaults - msg() *otg.BgpAttributesBsidSrv6 - // setMsg unmarshals BgpAttributesBsidSrv6 from protobuf object *otg.BgpAttributesBsidSrv6 - // and doesn't set defaults - setMsg(*otg.BgpAttributesBsidSrv6) BgpAttributesBsidSrv6 - // provides marshal interface - Marshal() marshalBgpAttributesBsidSrv6 - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesBsidSrv6 - // validate validates BgpAttributesBsidSrv6 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesBsidSrv6, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // FlagSpecifiedBsidOnly returns bool, set in BgpAttributesBsidSrv6. - FlagSpecifiedBsidOnly() bool - // SetFlagSpecifiedBsidOnly assigns bool provided by user to BgpAttributesBsidSrv6 - SetFlagSpecifiedBsidOnly(value bool) BgpAttributesBsidSrv6 - // HasFlagSpecifiedBsidOnly checks if FlagSpecifiedBsidOnly has been set in BgpAttributesBsidSrv6 - HasFlagSpecifiedBsidOnly() bool - // FlagDropUponInvalid returns bool, set in BgpAttributesBsidSrv6. - FlagDropUponInvalid() bool - // SetFlagDropUponInvalid assigns bool provided by user to BgpAttributesBsidSrv6 - SetFlagDropUponInvalid(value bool) BgpAttributesBsidSrv6 - // HasFlagDropUponInvalid checks if FlagDropUponInvalid has been set in BgpAttributesBsidSrv6 - HasFlagDropUponInvalid() bool - // Ipv6Addr returns string, set in BgpAttributesBsidSrv6. - Ipv6Addr() string - // SetIpv6Addr assigns string provided by user to BgpAttributesBsidSrv6 - SetIpv6Addr(value string) BgpAttributesBsidSrv6 - // HasIpv6Addr checks if Ipv6Addr has been set in BgpAttributesBsidSrv6 - HasIpv6Addr() bool -} - -// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is -// described in section 6.2.3 in [RFC9256]. -// FlagSpecifiedBsidOnly returns a bool -func (obj *bgpAttributesBsidSrv6) FlagSpecifiedBsidOnly() bool { - - return *obj.obj.FlagSpecifiedBsidOnly - -} - -// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is -// described in section 6.2.3 in [RFC9256]. -// FlagSpecifiedBsidOnly returns a bool -func (obj *bgpAttributesBsidSrv6) HasFlagSpecifiedBsidOnly() bool { - return obj.obj.FlagSpecifiedBsidOnly != nil -} - -// S-Flag: This flag encodes the "Specified-BSID-only" behavior. It's usage is -// described in section 6.2.3 in [RFC9256]. -// SetFlagSpecifiedBsidOnly sets the bool value in the BgpAttributesBsidSrv6 object -func (obj *bgpAttributesBsidSrv6) SetFlagSpecifiedBsidOnly(value bool) BgpAttributesBsidSrv6 { - - obj.obj.FlagSpecifiedBsidOnly = &value - return obj -} - -// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. -// It's usage is described in section 8.2 in [RFC9256]. -// FlagDropUponInvalid returns a bool -func (obj *bgpAttributesBsidSrv6) FlagDropUponInvalid() bool { - - return *obj.obj.FlagDropUponInvalid - -} - -// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. -// It's usage is described in section 8.2 in [RFC9256]. -// FlagDropUponInvalid returns a bool -func (obj *bgpAttributesBsidSrv6) HasFlagDropUponInvalid() bool { - return obj.obj.FlagDropUponInvalid != nil -} - -// I-Flag: This flag encodes the "Drop Upon Invalid" behavior. -// It's usage is described in section 8.2 in [RFC9256]. -// SetFlagDropUponInvalid sets the bool value in the BgpAttributesBsidSrv6 object -func (obj *bgpAttributesBsidSrv6) SetFlagDropUponInvalid(value bool) BgpAttributesBsidSrv6 { - - obj.obj.FlagDropUponInvalid = &value - return obj -} - -// IPv6 address denoting the SRv6 SID. -// Ipv6Addr returns a string -func (obj *bgpAttributesBsidSrv6) Ipv6Addr() string { - - return *obj.obj.Ipv6Addr - -} - -// IPv6 address denoting the SRv6 SID. -// Ipv6Addr returns a string -func (obj *bgpAttributesBsidSrv6) HasIpv6Addr() bool { - return obj.obj.Ipv6Addr != nil -} - -// IPv6 address denoting the SRv6 SID. -// SetIpv6Addr sets the string value in the BgpAttributesBsidSrv6 object -func (obj *bgpAttributesBsidSrv6) SetIpv6Addr(value string) BgpAttributesBsidSrv6 { - - obj.obj.Ipv6Addr = &value - return obj -} - -func (obj *bgpAttributesBsidSrv6) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv6Addr != nil { - - err := obj.validateIpv6(obj.Ipv6Addr()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesBsidSrv6.Ipv6Addr")) - } - - } - -} - -func (obj *bgpAttributesBsidSrv6) setDefault() { - if obj.obj.FlagSpecifiedBsidOnly == nil { - obj.SetFlagSpecifiedBsidOnly(false) - } - if obj.obj.FlagDropUponInvalid == nil { - obj.SetFlagDropUponInvalid(false) - } - if obj.obj.Ipv6Addr == nil { - obj.SetIpv6Addr("0::0") - } - -} - -// ***** BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure ***** -type bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - marshaller marshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -} - -func NewBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - obj := bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: &otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) msg() *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure struct { - obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -} - -type marshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure to protobuf object *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - ToProto() (*otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure struct { - obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -} - -type unMarshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure from protobuf object *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) (BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) Marshal() marshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) ToProto() (*otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) (BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) 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 *unMarshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) 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 *marshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) 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 *unMarshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) 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 *marshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) 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 *unMarshalbgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) 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 *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) Clone() (BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure() - 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 -} - -// BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 -type BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure to protobuf object *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // setMsg unmarshals BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure from protobuf object *otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // validate validates BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // EndpointBehaviour returns string, set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure. - EndpointBehaviour() string - // SetEndpointBehaviour assigns string provided by user to BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - SetEndpointBehaviour(value string) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // HasEndpointBehaviour checks if EndpointBehaviour has been set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - HasEndpointBehaviour() bool - // LbLength returns uint32, set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure. - LbLength() uint32 - // SetLbLength assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - SetLbLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // HasLbLength checks if LbLength has been set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - HasLbLength() bool - // LnLength returns uint32, set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure. - LnLength() uint32 - // SetLnLength assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - SetLnLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // HasLnLength checks if LnLength has been set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - HasLnLength() bool - // FuncLength returns uint32, set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure. - FuncLength() uint32 - // SetFuncLength assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - SetFuncLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // HasFuncLength checks if FuncLength has been set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - HasFuncLength() bool - // ArgLength returns uint32, set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure. - ArgLength() uint32 - // SetArgLength assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - SetArgLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // HasArgLength checks if ArgLength has been set in BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - HasArgLength() bool -} - -// This is a 2-octet field that is used to specify the SRv6 Endpoint Behavior code point for the SRv6 SID as defined -// in section 9.2 of [RFC8986]. When set with the value 0xFFFF (i.e., Opaque), the choice of SRv6 Endpoint Behavior is -// left to the headend. Well known 16-bit values for this field are available at -// https://www.iana.org/assignments/segment-routing/segment-routing.xhtml . -// EndpointBehaviour returns a string -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) EndpointBehaviour() string { - - return *obj.obj.EndpointBehaviour - -} - -// This is a 2-octet field that is used to specify the SRv6 Endpoint Behavior code point for the SRv6 SID as defined -// in section 9.2 of [RFC8986]. When set with the value 0xFFFF (i.e., Opaque), the choice of SRv6 Endpoint Behavior is -// left to the headend. Well known 16-bit values for this field are available at -// https://www.iana.org/assignments/segment-routing/segment-routing.xhtml . -// EndpointBehaviour returns a string -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) HasEndpointBehaviour() bool { - return obj.obj.EndpointBehaviour != nil -} - -// This is a 2-octet field that is used to specify the SRv6 Endpoint Behavior code point for the SRv6 SID as defined -// in section 9.2 of [RFC8986]. When set with the value 0xFFFF (i.e., Opaque), the choice of SRv6 Endpoint Behavior is -// left to the headend. Well known 16-bit values for this field are available at -// https://www.iana.org/assignments/segment-routing/segment-routing.xhtml . -// SetEndpointBehaviour sets the string value in the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure object -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) SetEndpointBehaviour(value string) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - - obj.obj.EndpointBehaviour = &value - return obj -} - -// SRv6 SID Locator Block length in bits. -// LbLength returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) LbLength() uint32 { - - return *obj.obj.LbLength - -} - -// SRv6 SID Locator Block length in bits. -// LbLength returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) HasLbLength() bool { - return obj.obj.LbLength != nil -} - -// SRv6 SID Locator Block length in bits. -// SetLbLength sets the uint32 value in the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure object -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) SetLbLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - - obj.obj.LbLength = &value - return obj -} - -// SRv6 SID Locator Node length in bits. -// LnLength returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) LnLength() uint32 { - - return *obj.obj.LnLength - -} - -// SRv6 SID Locator Node length in bits. -// LnLength returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) HasLnLength() bool { - return obj.obj.LnLength != nil -} - -// SRv6 SID Locator Node length in bits. -// SetLnLength sets the uint32 value in the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure object -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) SetLnLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - - obj.obj.LnLength = &value - return obj -} - -// SRv6 SID Function length in bits. -// FuncLength returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) FuncLength() uint32 { - - return *obj.obj.FuncLength - -} - -// SRv6 SID Function length in bits. -// FuncLength returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) HasFuncLength() bool { - return obj.obj.FuncLength != nil -} - -// SRv6 SID Function length in bits. -// SetFuncLength sets the uint32 value in the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure object -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) SetFuncLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - - obj.obj.FuncLength = &value - return obj -} - -// SRv6 SID Arguments length in bits. -// ArgLength returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) ArgLength() uint32 { - - return *obj.obj.ArgLength - -} - -// SRv6 SID Arguments length in bits. -// ArgLength returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) HasArgLength() bool { - return obj.obj.ArgLength != nil -} - -// SRv6 SID Arguments length in bits. -// SetArgLength sets the uint32 value in the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure object -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) SetArgLength(value uint32) BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - - obj.obj.ArgLength = &value - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.EndpointBehaviour != nil { - - if len(*obj.obj.EndpointBehaviour) > 4 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "None <= length of BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure.EndpointBehaviour <= 4 but Got %d", - len(*obj.obj.EndpointBehaviour))) - } - - } - - if obj.obj.LbLength != nil { - - if *obj.obj.LbLength > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure.LbLength <= 128 but Got %d", *obj.obj.LbLength)) - } - - } - - if obj.obj.LnLength != nil { - - if *obj.obj.LnLength > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure.LnLength <= 128 but Got %d", *obj.obj.LnLength)) - } - - } - - if obj.obj.FuncLength != nil { - - if *obj.obj.FuncLength > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure.FuncLength <= 128 but Got %d", *obj.obj.FuncLength)) - } - - } - - if obj.obj.ArgLength != nil { - - if *obj.obj.ArgLength > 128 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure.ArgLength <= 128 but Got %d", *obj.obj.ArgLength)) - } - - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) setDefault() { - if obj.obj.EndpointBehaviour == nil { - obj.SetEndpointBehaviour("ffff") - } - if obj.obj.LbLength == nil { - obj.SetLbLength(0) - } - if obj.obj.LnLength == nil { - obj.SetLnLength(0) - } - if obj.obj.FuncLength == nil { - obj.SetFuncLength(0) - } - if obj.obj.ArgLength == nil { - obj.SetArgLength(0) - } - -} - -// ***** BgpAttributesSegmentRoutingPolicySegmentListWeight ***** -type bgpAttributesSegmentRoutingPolicySegmentListWeight struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight - marshaller marshalBgpAttributesSegmentRoutingPolicySegmentListWeight - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicySegmentListWeight -} - -func NewBgpAttributesSegmentRoutingPolicySegmentListWeight() BgpAttributesSegmentRoutingPolicySegmentListWeight { - obj := bgpAttributesSegmentRoutingPolicySegmentListWeight{obj: &otg.BgpAttributesSegmentRoutingPolicySegmentListWeight{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) msg() *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight) BgpAttributesSegmentRoutingPolicySegmentListWeight { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicySegmentListWeight struct { - obj *bgpAttributesSegmentRoutingPolicySegmentListWeight -} - -type marshalBgpAttributesSegmentRoutingPolicySegmentListWeight interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicySegmentListWeight to protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight - ToProto() (*otg.BgpAttributesSegmentRoutingPolicySegmentListWeight, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicySegmentListWeight to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicySegmentListWeight to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicySegmentListWeight to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicySegmentListWeight struct { - obj *bgpAttributesSegmentRoutingPolicySegmentListWeight -} - -type unMarshalBgpAttributesSegmentRoutingPolicySegmentListWeight interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicySegmentListWeight from protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight) (BgpAttributesSegmentRoutingPolicySegmentListWeight, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicySegmentListWeight from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicySegmentListWeight from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicySegmentListWeight from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) Marshal() marshalBgpAttributesSegmentRoutingPolicySegmentListWeight { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicySegmentListWeight{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicySegmentListWeight { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicySegmentListWeight{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicySegmentListWeight) ToProto() (*otg.BgpAttributesSegmentRoutingPolicySegmentListWeight, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicySegmentListWeight) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight) (BgpAttributesSegmentRoutingPolicySegmentListWeight, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicySegmentListWeight) 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 *unMarshalbgpAttributesSegmentRoutingPolicySegmentListWeight) 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 *marshalbgpAttributesSegmentRoutingPolicySegmentListWeight) 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 *unMarshalbgpAttributesSegmentRoutingPolicySegmentListWeight) 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 *marshalbgpAttributesSegmentRoutingPolicySegmentListWeight) 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 *unMarshalbgpAttributesSegmentRoutingPolicySegmentListWeight) 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 *bgpAttributesSegmentRoutingPolicySegmentListWeight) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) Clone() (BgpAttributesSegmentRoutingPolicySegmentListWeight, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicySegmentListWeight() - 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 -} - -// BgpAttributesSegmentRoutingPolicySegmentListWeight is the optional Weight sub-TLV (Type 9) specifies the weight associated with a given segment list. The weight is used for weighted multipath. -type BgpAttributesSegmentRoutingPolicySegmentListWeight interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicySegmentListWeight to protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight - // setMsg unmarshals BgpAttributesSegmentRoutingPolicySegmentListWeight from protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListWeight - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicySegmentListWeight) BgpAttributesSegmentRoutingPolicySegmentListWeight - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicySegmentListWeight - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicySegmentListWeight - // validate validates BgpAttributesSegmentRoutingPolicySegmentListWeight - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicySegmentListWeight, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Value returns uint32, set in BgpAttributesSegmentRoutingPolicySegmentListWeight. - Value() uint32 - // SetValue assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicySegmentListWeight - SetValue(value uint32) BgpAttributesSegmentRoutingPolicySegmentListWeight - // HasValue checks if Value has been set in BgpAttributesSegmentRoutingPolicySegmentListWeight - HasValue() bool -} - -// Value of the weight. -// Value returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) Value() uint32 { - - return *obj.obj.Value - -} - -// Value of the weight. -// Value returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) HasValue() bool { - return obj.obj.Value != nil -} - -// Value of the weight. -// SetValue sets the uint32 value in the BgpAttributesSegmentRoutingPolicySegmentListWeight object -func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) SetValue(value uint32) BgpAttributesSegmentRoutingPolicySegmentListWeight { - - obj.obj.Value = &value - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListWeight) setDefault() { - if obj.obj.Value == nil { - obj.SetValue(0) - } - -} - -// ***** BgpAttributesSegmentRoutingPolicySegmentListSegment ***** -type bgpAttributesSegmentRoutingPolicySegmentListSegment struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment - marshaller marshalBgpAttributesSegmentRoutingPolicySegmentListSegment - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicySegmentListSegment - typeAHolder BgpAttributesSegmentRoutingPolicyTypeA - typeBHolder BgpAttributesSegmentRoutingPolicyTypeB - typeCHolder BgpAttributesSegmentRoutingPolicyTypeC - typeDHolder BgpAttributesSegmentRoutingPolicyTypeD - typeEHolder BgpAttributesSegmentRoutingPolicyTypeE - typeFHolder BgpAttributesSegmentRoutingPolicyTypeF - typeGHolder BgpAttributesSegmentRoutingPolicyTypeG - typeHHolder BgpAttributesSegmentRoutingPolicyTypeH - typeIHolder BgpAttributesSegmentRoutingPolicyTypeI - typeJHolder BgpAttributesSegmentRoutingPolicyTypeJ - typeKHolder BgpAttributesSegmentRoutingPolicyTypeK -} - -func NewBgpAttributesSegmentRoutingPolicySegmentListSegment() BgpAttributesSegmentRoutingPolicySegmentListSegment { - obj := bgpAttributesSegmentRoutingPolicySegmentListSegment{obj: &otg.BgpAttributesSegmentRoutingPolicySegmentListSegment{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) msg() *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSegmentRoutingPolicySegmentListSegment { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicySegmentListSegment struct { - obj *bgpAttributesSegmentRoutingPolicySegmentListSegment -} - -type marshalBgpAttributesSegmentRoutingPolicySegmentListSegment interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicySegmentListSegment to protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment - ToProto() (*otg.BgpAttributesSegmentRoutingPolicySegmentListSegment, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicySegmentListSegment to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicySegmentListSegment to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicySegmentListSegment to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicySegmentListSegment struct { - obj *bgpAttributesSegmentRoutingPolicySegmentListSegment -} - -type unMarshalBgpAttributesSegmentRoutingPolicySegmentListSegment interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicySegmentListSegment from protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment) (BgpAttributesSegmentRoutingPolicySegmentListSegment, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicySegmentListSegment from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicySegmentListSegment from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicySegmentListSegment from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) Marshal() marshalBgpAttributesSegmentRoutingPolicySegmentListSegment { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicySegmentListSegment{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicySegmentListSegment { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicySegmentListSegment{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicySegmentListSegment) ToProto() (*otg.BgpAttributesSegmentRoutingPolicySegmentListSegment, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicySegmentListSegment) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment) (BgpAttributesSegmentRoutingPolicySegmentListSegment, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicySegmentListSegment) 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 *unMarshalbgpAttributesSegmentRoutingPolicySegmentListSegment) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSegmentRoutingPolicySegmentListSegment) 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 *unMarshalbgpAttributesSegmentRoutingPolicySegmentListSegment) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicySegmentListSegment) 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 *unMarshalbgpAttributesSegmentRoutingPolicySegmentListSegment) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) Clone() (BgpAttributesSegmentRoutingPolicySegmentListSegment, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicySegmentListSegment() - 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 -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) setNil() { - obj.typeAHolder = nil - obj.typeBHolder = nil - obj.typeCHolder = nil - obj.typeDHolder = nil - obj.typeEHolder = nil - obj.typeFHolder = nil - obj.typeGHolder = nil - obj.typeHHolder = nil - obj.typeIHolder = nil - obj.typeJHolder = nil - obj.typeKHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSegmentRoutingPolicySegmentListSegment is a Segment sub-TLV describes a single segment in a segment list i.e., a single -// element of the explicit path. The Segment sub-TLVs are optional. -// Segment Types A and B are defined as described in 2.4.4.2. -// Segment Types C upto K are defined as described in in draft-ietf-idr-bgp-sr-segtypes-ext-03 . -type BgpAttributesSegmentRoutingPolicySegmentListSegment interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicySegmentListSegment to protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment - // setMsg unmarshals BgpAttributesSegmentRoutingPolicySegmentListSegment from protobuf object *otg.BgpAttributesSegmentRoutingPolicySegmentListSegment - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicySegmentListSegment) BgpAttributesSegmentRoutingPolicySegmentListSegment - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicySegmentListSegment - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicySegmentListSegment - // validate validates BgpAttributesSegmentRoutingPolicySegmentListSegment - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicySegmentListSegment, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum, set in BgpAttributesSegmentRoutingPolicySegmentListSegment - Choice() BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum - // setChoice assigns BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment - setChoice(value BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum) BgpAttributesSegmentRoutingPolicySegmentListSegment - // TypeA returns BgpAttributesSegmentRoutingPolicyTypeA, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeA is type A: SID only, in the form of MPLS Label. - // It is encoded as a Segment of Type 1 in the SEGMENT_LIST sub-tlv. - TypeA() BgpAttributesSegmentRoutingPolicyTypeA - // SetTypeA assigns BgpAttributesSegmentRoutingPolicyTypeA provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeA is type A: SID only, in the form of MPLS Label. - // It is encoded as a Segment of Type 1 in the SEGMENT_LIST sub-tlv. - SetTypeA(value BgpAttributesSegmentRoutingPolicyTypeA) BgpAttributesSegmentRoutingPolicySegmentListSegment - // HasTypeA checks if TypeA has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment - HasTypeA() bool - // TypeB returns BgpAttributesSegmentRoutingPolicyTypeB, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeB is type B: SID only, in the form of IPv6 address. - // It is encoded as a Segment of Type 13 in the SEGMENT_LIST sub-tlv. - TypeB() BgpAttributesSegmentRoutingPolicyTypeB - // SetTypeB assigns BgpAttributesSegmentRoutingPolicyTypeB provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeB is type B: SID only, in the form of IPv6 address. - // It is encoded as a Segment of Type 13 in the SEGMENT_LIST sub-tlv. - SetTypeB(value BgpAttributesSegmentRoutingPolicyTypeB) BgpAttributesSegmentRoutingPolicySegmentListSegment - // HasTypeB checks if TypeB has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment - HasTypeB() bool - // TypeC returns BgpAttributesSegmentRoutingPolicyTypeC, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeC is type C: IPv4 Node Address with optional SID. - // It is encoded as a Segment of Type 3 in the SEGMENT_LIST sub-tlv. - TypeC() BgpAttributesSegmentRoutingPolicyTypeC - // SetTypeC assigns BgpAttributesSegmentRoutingPolicyTypeC provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeC is type C: IPv4 Node Address with optional SID. - // It is encoded as a Segment of Type 3 in the SEGMENT_LIST sub-tlv. - SetTypeC(value BgpAttributesSegmentRoutingPolicyTypeC) BgpAttributesSegmentRoutingPolicySegmentListSegment - // HasTypeC checks if TypeC has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment - HasTypeC() bool - // TypeD returns BgpAttributesSegmentRoutingPolicyTypeD, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeD is type D: IPv6 Node Address with optional SID for SR MPLS. - // It is encoded as a Segment of Type 4 in the SEGMENT_LIST sub-tlv. - TypeD() BgpAttributesSegmentRoutingPolicyTypeD - // SetTypeD assigns BgpAttributesSegmentRoutingPolicyTypeD provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeD is type D: IPv6 Node Address with optional SID for SR MPLS. - // It is encoded as a Segment of Type 4 in the SEGMENT_LIST sub-tlv. - SetTypeD(value BgpAttributesSegmentRoutingPolicyTypeD) BgpAttributesSegmentRoutingPolicySegmentListSegment - // HasTypeD checks if TypeD has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment - HasTypeD() bool - // TypeE returns BgpAttributesSegmentRoutingPolicyTypeE, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeE is type E: IPv4 Address and Local Interface ID with optional SID - // It is encoded as a Segment of Type 5 in the SEGMENT_LIST sub-tlv. - TypeE() BgpAttributesSegmentRoutingPolicyTypeE - // SetTypeE assigns BgpAttributesSegmentRoutingPolicyTypeE provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeE is type E: IPv4 Address and Local Interface ID with optional SID - // It is encoded as a Segment of Type 5 in the SEGMENT_LIST sub-tlv. - SetTypeE(value BgpAttributesSegmentRoutingPolicyTypeE) BgpAttributesSegmentRoutingPolicySegmentListSegment - // HasTypeE checks if TypeE has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment - HasTypeE() bool - // TypeF returns BgpAttributesSegmentRoutingPolicyTypeF, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeF is type F: IPv4 Local and Remote addresses with optional SR-MPLS SID. - // It is encoded as a Segment of Type 6 in the SEGMENT_LIST sub-tlv. - TypeF() BgpAttributesSegmentRoutingPolicyTypeF - // SetTypeF assigns BgpAttributesSegmentRoutingPolicyTypeF provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeF is type F: IPv4 Local and Remote addresses with optional SR-MPLS SID. - // It is encoded as a Segment of Type 6 in the SEGMENT_LIST sub-tlv. - SetTypeF(value BgpAttributesSegmentRoutingPolicyTypeF) BgpAttributesSegmentRoutingPolicySegmentListSegment - // HasTypeF checks if TypeF has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment - HasTypeF() bool - // TypeG returns BgpAttributesSegmentRoutingPolicyTypeG, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeG is type G: IPv6 Address, Interface ID for local and remote pair with optional SID for SR MPLS. - // It is encoded as a Segment of Type 7 in the SEGMENT_LIST sub-tlv. - TypeG() BgpAttributesSegmentRoutingPolicyTypeG - // SetTypeG assigns BgpAttributesSegmentRoutingPolicyTypeG provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeG is type G: IPv6 Address, Interface ID for local and remote pair with optional SID for SR MPLS. - // It is encoded as a Segment of Type 7 in the SEGMENT_LIST sub-tlv. - SetTypeG(value BgpAttributesSegmentRoutingPolicyTypeG) BgpAttributesSegmentRoutingPolicySegmentListSegment - // HasTypeG checks if TypeG has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment - HasTypeG() bool - // TypeH returns BgpAttributesSegmentRoutingPolicyTypeH, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeH is type H: IPv6 Local and Remote addresses with optional SID for SR MPLS. - // It is encoded as a Segment of Type 8 in the SEGMENT_LIST sub-tlv. - TypeH() BgpAttributesSegmentRoutingPolicyTypeH - // SetTypeH assigns BgpAttributesSegmentRoutingPolicyTypeH provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeH is type H: IPv6 Local and Remote addresses with optional SID for SR MPLS. - // It is encoded as a Segment of Type 8 in the SEGMENT_LIST sub-tlv. - SetTypeH(value BgpAttributesSegmentRoutingPolicyTypeH) BgpAttributesSegmentRoutingPolicySegmentListSegment - // HasTypeH checks if TypeH has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment - HasTypeH() bool - // TypeI returns BgpAttributesSegmentRoutingPolicyTypeI, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeI is type I: IPv6 Node Address with optional SR Algorithm and optional SRv6 SID. - // It is encoded as a Segment of Type 14 in the SEGMENT_LIST sub-tlv. - TypeI() BgpAttributesSegmentRoutingPolicyTypeI - // SetTypeI assigns BgpAttributesSegmentRoutingPolicyTypeI provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeI is type I: IPv6 Node Address with optional SR Algorithm and optional SRv6 SID. - // It is encoded as a Segment of Type 14 in the SEGMENT_LIST sub-tlv. - SetTypeI(value BgpAttributesSegmentRoutingPolicyTypeI) BgpAttributesSegmentRoutingPolicySegmentListSegment - // HasTypeI checks if TypeI has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment - HasTypeI() bool - // TypeJ returns BgpAttributesSegmentRoutingPolicyTypeJ, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeJ is type J: IPv6 Address, Interface ID for local and remote pair for SRv6 with optional SID. - // It is encoded as a Segment of Type 15 in the SEGMENT_LIST sub-tlv. - TypeJ() BgpAttributesSegmentRoutingPolicyTypeJ - // SetTypeJ assigns BgpAttributesSegmentRoutingPolicyTypeJ provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeJ is type J: IPv6 Address, Interface ID for local and remote pair for SRv6 with optional SID. - // It is encoded as a Segment of Type 15 in the SEGMENT_LIST sub-tlv. - SetTypeJ(value BgpAttributesSegmentRoutingPolicyTypeJ) BgpAttributesSegmentRoutingPolicySegmentListSegment - // HasTypeJ checks if TypeJ has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment - HasTypeJ() bool - // TypeK returns BgpAttributesSegmentRoutingPolicyTypeK, set in BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeK is type K: IPv6 Local and Remote addresses for SRv6 with optional SID. - // It is encoded as a Segment of Type 16 in the SEGMENT_LIST sub-tlv. - TypeK() BgpAttributesSegmentRoutingPolicyTypeK - // SetTypeK assigns BgpAttributesSegmentRoutingPolicyTypeK provided by user to BgpAttributesSegmentRoutingPolicySegmentListSegment. - // BgpAttributesSegmentRoutingPolicyTypeK is type K: IPv6 Local and Remote addresses for SRv6 with optional SID. - // It is encoded as a Segment of Type 16 in the SEGMENT_LIST sub-tlv. - SetTypeK(value BgpAttributesSegmentRoutingPolicyTypeK) BgpAttributesSegmentRoutingPolicySegmentListSegment - // HasTypeK checks if TypeK has been set in BgpAttributesSegmentRoutingPolicySegmentListSegment - HasTypeK() bool - setNil() -} - -type BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum string - -// Enum of Choice on BgpAttributesSegmentRoutingPolicySegmentListSegment -var BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice = struct { - TYPE_A BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum - TYPE_B BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum - TYPE_C BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum - TYPE_D BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum - TYPE_E BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum - TYPE_F BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum - TYPE_G BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum - TYPE_H BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum - TYPE_I BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum - TYPE_J BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum - TYPE_K BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum -}{ - TYPE_A: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_a"), - TYPE_B: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_b"), - TYPE_C: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_c"), - TYPE_D: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_d"), - TYPE_E: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_e"), - TYPE_F: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_f"), - TYPE_G: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_g"), - TYPE_H: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_h"), - TYPE_I: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_i"), - TYPE_J: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_j"), - TYPE_K: BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum("type_k"), -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) Choice() BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum { - return BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum(obj.obj.Choice.Enum().String()) -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) setChoice(value BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum) BgpAttributesSegmentRoutingPolicySegmentListSegment { - intValue, ok := otg.BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum", string(value))) - return obj - } - enumValue := otg.BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.TypeK = nil - obj.typeKHolder = nil - obj.obj.TypeJ = nil - obj.typeJHolder = nil - obj.obj.TypeI = nil - obj.typeIHolder = nil - obj.obj.TypeH = nil - obj.typeHHolder = nil - obj.obj.TypeG = nil - obj.typeGHolder = nil - obj.obj.TypeF = nil - obj.typeFHolder = nil - obj.obj.TypeE = nil - obj.typeEHolder = nil - obj.obj.TypeD = nil - obj.typeDHolder = nil - obj.obj.TypeC = nil - obj.typeCHolder = nil - obj.obj.TypeB = nil - obj.typeBHolder = nil - obj.obj.TypeA = nil - obj.typeAHolder = nil - - if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_A { - obj.obj.TypeA = NewBgpAttributesSegmentRoutingPolicyTypeA().msg() - } - - if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_B { - obj.obj.TypeB = NewBgpAttributesSegmentRoutingPolicyTypeB().msg() - } - - if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_C { - obj.obj.TypeC = NewBgpAttributesSegmentRoutingPolicyTypeC().msg() - } - - if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_D { - obj.obj.TypeD = NewBgpAttributesSegmentRoutingPolicyTypeD().msg() - } - - if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_E { - obj.obj.TypeE = NewBgpAttributesSegmentRoutingPolicyTypeE().msg() - } - - if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_F { - obj.obj.TypeF = NewBgpAttributesSegmentRoutingPolicyTypeF().msg() - } - - if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_G { - obj.obj.TypeG = NewBgpAttributesSegmentRoutingPolicyTypeG().msg() - } - - if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_H { - obj.obj.TypeH = NewBgpAttributesSegmentRoutingPolicyTypeH().msg() - } - - if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_I { - obj.obj.TypeI = NewBgpAttributesSegmentRoutingPolicyTypeI().msg() - } - - if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_J { - obj.obj.TypeJ = NewBgpAttributesSegmentRoutingPolicyTypeJ().msg() - } - - if value == BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_K { - obj.obj.TypeK = NewBgpAttributesSegmentRoutingPolicyTypeK().msg() - } - - return obj -} - -// description is TBD -// TypeA returns a BgpAttributesSegmentRoutingPolicyTypeA -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeA() BgpAttributesSegmentRoutingPolicyTypeA { - if obj.obj.TypeA == nil { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_A) - } - if obj.typeAHolder == nil { - obj.typeAHolder = &bgpAttributesSegmentRoutingPolicyTypeA{obj: obj.obj.TypeA} - } - return obj.typeAHolder -} - -// description is TBD -// TypeA returns a BgpAttributesSegmentRoutingPolicyTypeA -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeA() bool { - return obj.obj.TypeA != nil -} - -// description is TBD -// SetTypeA sets the BgpAttributesSegmentRoutingPolicyTypeA value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeA(value BgpAttributesSegmentRoutingPolicyTypeA) BgpAttributesSegmentRoutingPolicySegmentListSegment { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_A) - obj.typeAHolder = nil - obj.obj.TypeA = value.msg() - - return obj -} - -// description is TBD -// TypeB returns a BgpAttributesSegmentRoutingPolicyTypeB -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeB() BgpAttributesSegmentRoutingPolicyTypeB { - if obj.obj.TypeB == nil { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_B) - } - if obj.typeBHolder == nil { - obj.typeBHolder = &bgpAttributesSegmentRoutingPolicyTypeB{obj: obj.obj.TypeB} - } - return obj.typeBHolder -} - -// description is TBD -// TypeB returns a BgpAttributesSegmentRoutingPolicyTypeB -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeB() bool { - return obj.obj.TypeB != nil -} - -// description is TBD -// SetTypeB sets the BgpAttributesSegmentRoutingPolicyTypeB value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeB(value BgpAttributesSegmentRoutingPolicyTypeB) BgpAttributesSegmentRoutingPolicySegmentListSegment { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_B) - obj.typeBHolder = nil - obj.obj.TypeB = value.msg() - - return obj -} - -// description is TBD -// TypeC returns a BgpAttributesSegmentRoutingPolicyTypeC -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeC() BgpAttributesSegmentRoutingPolicyTypeC { - if obj.obj.TypeC == nil { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_C) - } - if obj.typeCHolder == nil { - obj.typeCHolder = &bgpAttributesSegmentRoutingPolicyTypeC{obj: obj.obj.TypeC} - } - return obj.typeCHolder -} - -// description is TBD -// TypeC returns a BgpAttributesSegmentRoutingPolicyTypeC -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeC() bool { - return obj.obj.TypeC != nil -} - -// description is TBD -// SetTypeC sets the BgpAttributesSegmentRoutingPolicyTypeC value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeC(value BgpAttributesSegmentRoutingPolicyTypeC) BgpAttributesSegmentRoutingPolicySegmentListSegment { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_C) - obj.typeCHolder = nil - obj.obj.TypeC = value.msg() - - return obj -} - -// description is TBD -// TypeD returns a BgpAttributesSegmentRoutingPolicyTypeD -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeD() BgpAttributesSegmentRoutingPolicyTypeD { - if obj.obj.TypeD == nil { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_D) - } - if obj.typeDHolder == nil { - obj.typeDHolder = &bgpAttributesSegmentRoutingPolicyTypeD{obj: obj.obj.TypeD} - } - return obj.typeDHolder -} - -// description is TBD -// TypeD returns a BgpAttributesSegmentRoutingPolicyTypeD -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeD() bool { - return obj.obj.TypeD != nil -} - -// description is TBD -// SetTypeD sets the BgpAttributesSegmentRoutingPolicyTypeD value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeD(value BgpAttributesSegmentRoutingPolicyTypeD) BgpAttributesSegmentRoutingPolicySegmentListSegment { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_D) - obj.typeDHolder = nil - obj.obj.TypeD = value.msg() - - return obj -} - -// description is TBD -// TypeE returns a BgpAttributesSegmentRoutingPolicyTypeE -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeE() BgpAttributesSegmentRoutingPolicyTypeE { - if obj.obj.TypeE == nil { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_E) - } - if obj.typeEHolder == nil { - obj.typeEHolder = &bgpAttributesSegmentRoutingPolicyTypeE{obj: obj.obj.TypeE} - } - return obj.typeEHolder -} - -// description is TBD -// TypeE returns a BgpAttributesSegmentRoutingPolicyTypeE -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeE() bool { - return obj.obj.TypeE != nil -} - -// description is TBD -// SetTypeE sets the BgpAttributesSegmentRoutingPolicyTypeE value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeE(value BgpAttributesSegmentRoutingPolicyTypeE) BgpAttributesSegmentRoutingPolicySegmentListSegment { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_E) - obj.typeEHolder = nil - obj.obj.TypeE = value.msg() - - return obj -} - -// description is TBD -// TypeF returns a BgpAttributesSegmentRoutingPolicyTypeF -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeF() BgpAttributesSegmentRoutingPolicyTypeF { - if obj.obj.TypeF == nil { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_F) - } - if obj.typeFHolder == nil { - obj.typeFHolder = &bgpAttributesSegmentRoutingPolicyTypeF{obj: obj.obj.TypeF} - } - return obj.typeFHolder -} - -// description is TBD -// TypeF returns a BgpAttributesSegmentRoutingPolicyTypeF -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeF() bool { - return obj.obj.TypeF != nil -} - -// description is TBD -// SetTypeF sets the BgpAttributesSegmentRoutingPolicyTypeF value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeF(value BgpAttributesSegmentRoutingPolicyTypeF) BgpAttributesSegmentRoutingPolicySegmentListSegment { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_F) - obj.typeFHolder = nil - obj.obj.TypeF = value.msg() - - return obj -} - -// description is TBD -// TypeG returns a BgpAttributesSegmentRoutingPolicyTypeG -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeG() BgpAttributesSegmentRoutingPolicyTypeG { - if obj.obj.TypeG == nil { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_G) - } - if obj.typeGHolder == nil { - obj.typeGHolder = &bgpAttributesSegmentRoutingPolicyTypeG{obj: obj.obj.TypeG} - } - return obj.typeGHolder -} - -// description is TBD -// TypeG returns a BgpAttributesSegmentRoutingPolicyTypeG -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeG() bool { - return obj.obj.TypeG != nil -} - -// description is TBD -// SetTypeG sets the BgpAttributesSegmentRoutingPolicyTypeG value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeG(value BgpAttributesSegmentRoutingPolicyTypeG) BgpAttributesSegmentRoutingPolicySegmentListSegment { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_G) - obj.typeGHolder = nil - obj.obj.TypeG = value.msg() - - return obj -} - -// description is TBD -// TypeH returns a BgpAttributesSegmentRoutingPolicyTypeH -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeH() BgpAttributesSegmentRoutingPolicyTypeH { - if obj.obj.TypeH == nil { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_H) - } - if obj.typeHHolder == nil { - obj.typeHHolder = &bgpAttributesSegmentRoutingPolicyTypeH{obj: obj.obj.TypeH} - } - return obj.typeHHolder -} - -// description is TBD -// TypeH returns a BgpAttributesSegmentRoutingPolicyTypeH -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeH() bool { - return obj.obj.TypeH != nil -} - -// description is TBD -// SetTypeH sets the BgpAttributesSegmentRoutingPolicyTypeH value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeH(value BgpAttributesSegmentRoutingPolicyTypeH) BgpAttributesSegmentRoutingPolicySegmentListSegment { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_H) - obj.typeHHolder = nil - obj.obj.TypeH = value.msg() - - return obj -} - -// description is TBD -// TypeI returns a BgpAttributesSegmentRoutingPolicyTypeI -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeI() BgpAttributesSegmentRoutingPolicyTypeI { - if obj.obj.TypeI == nil { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_I) - } - if obj.typeIHolder == nil { - obj.typeIHolder = &bgpAttributesSegmentRoutingPolicyTypeI{obj: obj.obj.TypeI} - } - return obj.typeIHolder -} - -// description is TBD -// TypeI returns a BgpAttributesSegmentRoutingPolicyTypeI -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeI() bool { - return obj.obj.TypeI != nil -} - -// description is TBD -// SetTypeI sets the BgpAttributesSegmentRoutingPolicyTypeI value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeI(value BgpAttributesSegmentRoutingPolicyTypeI) BgpAttributesSegmentRoutingPolicySegmentListSegment { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_I) - obj.typeIHolder = nil - obj.obj.TypeI = value.msg() - - return obj -} - -// description is TBD -// TypeJ returns a BgpAttributesSegmentRoutingPolicyTypeJ -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeJ() BgpAttributesSegmentRoutingPolicyTypeJ { - if obj.obj.TypeJ == nil { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_J) - } - if obj.typeJHolder == nil { - obj.typeJHolder = &bgpAttributesSegmentRoutingPolicyTypeJ{obj: obj.obj.TypeJ} - } - return obj.typeJHolder -} - -// description is TBD -// TypeJ returns a BgpAttributesSegmentRoutingPolicyTypeJ -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeJ() bool { - return obj.obj.TypeJ != nil -} - -// description is TBD -// SetTypeJ sets the BgpAttributesSegmentRoutingPolicyTypeJ value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeJ(value BgpAttributesSegmentRoutingPolicyTypeJ) BgpAttributesSegmentRoutingPolicySegmentListSegment { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_J) - obj.typeJHolder = nil - obj.obj.TypeJ = value.msg() - - return obj -} - -// description is TBD -// TypeK returns a BgpAttributesSegmentRoutingPolicyTypeK -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) TypeK() BgpAttributesSegmentRoutingPolicyTypeK { - if obj.obj.TypeK == nil { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_K) - } - if obj.typeKHolder == nil { - obj.typeKHolder = &bgpAttributesSegmentRoutingPolicyTypeK{obj: obj.obj.TypeK} - } - return obj.typeKHolder -} - -// description is TBD -// TypeK returns a BgpAttributesSegmentRoutingPolicyTypeK -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) HasTypeK() bool { - return obj.obj.TypeK != nil -} - -// description is TBD -// SetTypeK sets the BgpAttributesSegmentRoutingPolicyTypeK value in the BgpAttributesSegmentRoutingPolicySegmentListSegment object -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) SetTypeK(value BgpAttributesSegmentRoutingPolicyTypeK) BgpAttributesSegmentRoutingPolicySegmentListSegment { - obj.setChoice(BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_K) - obj.typeKHolder = nil - obj.obj.TypeK = value.msg() - - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - // Choice is required - if obj.obj.Choice == nil { - vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface BgpAttributesSegmentRoutingPolicySegmentListSegment") - } - - if obj.obj.TypeA != nil { - - obj.TypeA().validateObj(vObj, set_default) - } - - if obj.obj.TypeB != nil { - - obj.TypeB().validateObj(vObj, set_default) - } - - if obj.obj.TypeC != nil { - - obj.TypeC().validateObj(vObj, set_default) - } - - if obj.obj.TypeD != nil { - - obj.TypeD().validateObj(vObj, set_default) - } - - if obj.obj.TypeE != nil { - - obj.TypeE().validateObj(vObj, set_default) - } - - if obj.obj.TypeF != nil { - - obj.TypeF().validateObj(vObj, set_default) - } - - if obj.obj.TypeG != nil { - - obj.TypeG().validateObj(vObj, set_default) - } - - if obj.obj.TypeH != nil { - - obj.TypeH().validateObj(vObj, set_default) - } - - if obj.obj.TypeI != nil { - - obj.TypeI().validateObj(vObj, set_default) - } - - if obj.obj.TypeJ != nil { - - obj.TypeJ().validateObj(vObj, set_default) - } - - if obj.obj.TypeK != nil { - - obj.TypeK().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicySegmentListSegment) setDefault() { - var choices_set int = 0 - var choice BgpAttributesSegmentRoutingPolicySegmentListSegmentChoiceEnum - - if obj.obj.TypeA != nil { - choices_set += 1 - choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_A - } - - if obj.obj.TypeB != nil { - choices_set += 1 - choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_B - } - - if obj.obj.TypeC != nil { - choices_set += 1 - choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_C - } - - if obj.obj.TypeD != nil { - choices_set += 1 - choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_D - } - - if obj.obj.TypeE != nil { - choices_set += 1 - choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_E - } - - if obj.obj.TypeF != nil { - choices_set += 1 - choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_F - } - - if obj.obj.TypeG != nil { - choices_set += 1 - choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_G - } - - if obj.obj.TypeH != nil { - choices_set += 1 - choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_H - } - - if obj.obj.TypeI != nil { - choices_set += 1 - choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_I - } - - if obj.obj.TypeJ != nil { - choices_set += 1 - choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_J - } - - if obj.obj.TypeK != nil { - choices_set += 1 - choice = BgpAttributesSegmentRoutingPolicySegmentListSegmentChoice.TYPE_K - } - if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in BgpAttributesSegmentRoutingPolicySegmentListSegment") - } - } else { - intVal := otg.BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice_Enum_value[string(choice)] - enumValue := otg.BgpAttributesSegmentRoutingPolicySegmentListSegment_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter ***** -type patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter struct { - validation - obj *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - marshaller marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - unMarshaller unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter -} - -func NewPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { - obj := patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter{obj: &otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) setMsg(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter struct { - obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter -} - -type marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter interface { - // ToProto marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, error) - // ToPbText marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter struct { - obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter -} - -type unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) 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 *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) 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 *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) 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 *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter() - 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 -} - -// PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter is ipv4 counter pattern -type PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - // setMsg unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - // validate validates PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - SetStart(value string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - HasStart() bool - // Step returns string, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - SetStep(value string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - SetCount(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) SetStart(value string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) SetStep(value string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) SetCount(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateIpv4(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateIpv4(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter.Step")) - } - - } - -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("0.0.0.0") - } - if obj.obj.Step == nil { - obj.SetStep("0.0.0.1") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter ***** -type patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter struct { - validation - obj *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - marshaller marshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - unMarshaller unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter -} - -func NewPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter() PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { - obj := patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter{obj: &otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) setMsg(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter struct { - obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter -} - -type marshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter interface { - // ToProto marshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, error) - // ToPbText marshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter struct { - obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter -} - -type unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) (PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) (PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) 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 *marshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) 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 *marshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) 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 *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter() - 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 -} - -// PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter is integer counter pattern -type PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - // setMsg unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - // validate validates PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - SetStart(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - SetStep(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - SetCount(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) SetStart(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) SetStep(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) SetCount(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter ***** -type patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter struct { - validation - obj *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - marshaller marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - unMarshaller unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter -} - -func NewPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { - obj := patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter{obj: &otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) setMsg(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter struct { - obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter -} - -type marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter interface { - // ToProto marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, error) - // ToPbText marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter struct { - obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter -} - -type unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) 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 *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) 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 *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) 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 *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter() - 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 -} - -// PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter is integer counter pattern -type PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - // setMsg unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - // validate validates PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - SetStart(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - SetStep(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - SetCount(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) SetStart(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) SetStep(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter object -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) SetCount(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSessionExtTunnelIdAsInteger ***** -type patternFlowRSVPPathSessionExtTunnelIdAsInteger struct { - validation - obj *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger - marshaller marshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger - unMarshaller unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger - incrementHolder PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - decrementHolder PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter -} - -func NewPatternFlowRSVPPathSessionExtTunnelIdAsInteger() PatternFlowRSVPPathSessionExtTunnelIdAsInteger { - obj := patternFlowRSVPPathSessionExtTunnelIdAsInteger{obj: &otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger { - return obj.obj -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) setMsg(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger) PatternFlowRSVPPathSessionExtTunnelIdAsInteger { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger struct { - obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger -} - -type marshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger interface { - // ToProto marshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger - ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger, error) - // ToPbText marshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger struct { - obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger -} - -type unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger interface { - // FromProto unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger - FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger) (PatternFlowRSVPPathSessionExtTunnelIdAsInteger, error) - // FromPbText unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger) (PatternFlowRSVPPathSessionExtTunnelIdAsInteger, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsInteger, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSessionExtTunnelIdAsInteger() - 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 -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSessionExtTunnelIdAsInteger is tBD -type PatternFlowRSVPPathSessionExtTunnelIdAsInteger interface { - Validation - // msg marshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger - // setMsg unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger) PatternFlowRSVPPathSessionExtTunnelIdAsInteger - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger - // validate validates PatternFlowRSVPPathSessionExtTunnelIdAsInteger - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsInteger, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum, set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger - Choice() PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum - // setChoice assigns PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsInteger - setChoice(value PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum) PatternFlowRSVPPathSessionExtTunnelIdAsInteger - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsInteger - SetValue(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsInteger - // HasValue checks if Value has been set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsInteger - SetValues(value []uint32) PatternFlowRSVPPathSessionExtTunnelIdAsInteger - // Increment returns PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger. - // PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter is integer counter pattern - Increment() PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - // SetIncrement assigns PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsInteger. - // PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) PatternFlowRSVPPathSessionExtTunnelIdAsInteger - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger. - // PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter is integer counter pattern - Decrement() PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - // SetDecrement assigns PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsInteger. - // PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) PatternFlowRSVPPathSessionExtTunnelIdAsInteger - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSessionExtTunnelIdAsInteger -var PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice = struct { - VALUE PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum - VALUES PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum - INCREMENT PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum - DECREMENT PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Choice() PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum { - return PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) setChoice(value PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum) PatternFlowRSVPPathSessionExtTunnelIdAsInteger { - intValue, ok := otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter().msg() - } - - if value == PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathSessionExtTunnelIdAsInteger object -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) SetValue(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsInteger { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathSessionExtTunnelIdAsInteger object -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) SetValues(value []uint32) PatternFlowRSVPPathSessionExtTunnelIdAsInteger { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Increment() PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter value in the PatternFlowRSVPPathSessionExtTunnelIdAsInteger object -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) SetIncrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) PatternFlowRSVPPathSessionExtTunnelIdAsInteger { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Decrement() PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter value in the PatternFlowRSVPPathSessionExtTunnelIdAsInteger object -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) SetDecrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) PatternFlowRSVPPathSessionExtTunnelIdAsInteger { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSessionExtTunnelIdAsInteger") - } - } else { - intVal := otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 ***** -type patternFlowRSVPPathSessionExtTunnelIdAsIpv4 struct { - validation - obj *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - marshaller marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - unMarshaller unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - incrementHolder PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - decrementHolder PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter -} - -func NewPatternFlowRSVPPathSessionExtTunnelIdAsIpv4() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { - obj := patternFlowRSVPPathSessionExtTunnelIdAsIpv4{obj: &otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { - return obj.obj -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) setMsg(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4 struct { - obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4 -} - -type marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 interface { - // ToProto marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4, error) - // ToPbText marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4 struct { - obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4 -} - -type unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 interface { - // FromProto unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4, error) - // FromPbText unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSessionExtTunnelIdAsIpv4() - 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 -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 is iPv4 address of the ingress endpoint for the tunnel. -type PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 interface { - Validation - // msg marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - // setMsg unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - // validate validates PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - Choice() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum - // setChoice assigns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - setChoice(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - // HasChoice checks if Choice has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - HasChoice() bool - // Value returns string, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4. - Value() string - // SetValue assigns string provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - SetValue(value string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - // HasValue checks if Value has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - HasValue() bool - // Values returns []string, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4. - Values() []string - // SetValues assigns []string provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - SetValues(value []string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - // Increment returns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4. - // PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter is ipv4 counter pattern - Increment() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - // SetIncrement assigns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4. - // PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter is ipv4 counter pattern - SetIncrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4. - // PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter is ipv4 counter pattern - Decrement() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - // SetDecrement assigns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4. - // PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter is ipv4 counter pattern - SetDecrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 -var PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice = struct { - VALUE PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum - VALUES PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum - INCREMENT PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum - DECREMENT PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum -}{ - VALUE: PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum("value"), - VALUES: PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Choice() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum { - return PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) setChoice(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { - intValue, ok := otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUE { - defaultValue := "0.0.0.0" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUES { - defaultValue := []string{"0.0.0.0"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter().msg() - } - - if value == PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 object -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) SetValue(value string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"0.0.0.0"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 object -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) SetValues(value []string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Increment() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter value in the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 object -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) SetIncrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Decrement() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter value in the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 object -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) SetDecrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv4(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateIpv4Slice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4") - } - } else { - intVal := otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter ***** -type patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter struct { - validation - obj *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - marshaller marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - unMarshaller unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter -} - -func NewPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter() PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { - obj := patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter{obj: &otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) msg() *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) setMsg(msg *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter struct { - obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter -} - -type marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter interface { - // ToProto marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, error) - // ToPbText marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter struct { - obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter -} - -type unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter interface { - // FromProto unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) (PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) (PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) 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 *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) 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 *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) 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 *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) Clone() (PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter() - 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 -} - -// PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter is ipv4 counter pattern -type PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter interface { - Validation - // msg marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - // setMsg unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - // validate validates PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - SetStart(value string) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - HasStart() bool - // Step returns string, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - SetStep(value string) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - SetCount(value uint32) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter object -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) SetStart(value string) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter object -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) SetStep(value string) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter object -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) SetCount(value uint32) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateIpv4(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateIpv4(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter.Step")) - } - - } - -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("0.0.0.0") - } - if obj.obj.Step == nil { - obj.SetStep("0.0.0.1") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter ***** -type patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter struct { - validation - obj *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - marshaller marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - unMarshaller unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter -} - -func NewPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { - obj := patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter{obj: &otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) msg() *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) setMsg(msg *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter struct { - obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter -} - -type marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter interface { - // ToProto marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, error) - // ToPbText marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter struct { - obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter -} - -type unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter interface { - // FromProto unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) 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 *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) 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 *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) 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 *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) Clone() (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter() - 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 -} - -// PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter is integer counter pattern -type PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter interface { - Validation - // msg marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - // setMsg unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - // validate validates PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - SetStart(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - SetStep(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - SetCount(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter object -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) SetStart(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter object -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) SetStep(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter object -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) SetCount(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter ***** -type patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter struct { - validation - obj *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - marshaller marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - unMarshaller unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter -} - -func NewPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter() PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { - obj := patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter{obj: &otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) msg() *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) setMsg(msg *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter struct { - obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter -} - -type marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter interface { - // ToProto marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter to protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - ToProto() (*otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, error) - // ToPbText marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter struct { - obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter -} - -type unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter interface { - // FromProto unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter from protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - FromProto(msg *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) (PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) Marshal() marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) Unmarshal() unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) ToProto() (*otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) FromProto(msg *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) (PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) 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 *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) 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 *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) 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 *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) 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 *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) 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 *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) 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 *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) Clone() (PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter() - 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 -} - -// PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter is integer counter pattern -type PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter interface { - Validation - // msg marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter to protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - // setMsg unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter from protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - // validate validates PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - SetStart(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - SetStep(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - SetCount(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter object -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) SetStart(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter object -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) SetStep(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter object -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) SetCount(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(30000) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** FlowRSVPType1ExplicitRouteSubobjectsType ***** -type flowRSVPType1ExplicitRouteSubobjectsType struct { - validation - obj *otg.FlowRSVPType1ExplicitRouteSubobjectsType - marshaller marshalFlowRSVPType1ExplicitRouteSubobjectsType - unMarshaller unMarshalFlowRSVPType1ExplicitRouteSubobjectsType - ipv4PrefixHolder FlowRSVPPathExplicitRouteType1Ipv4Prefix - asNumberHolder FlowRSVPPathExplicitRouteType1ASNumber -} - -func NewFlowRSVPType1ExplicitRouteSubobjectsType() FlowRSVPType1ExplicitRouteSubobjectsType { - obj := flowRSVPType1ExplicitRouteSubobjectsType{obj: &otg.FlowRSVPType1ExplicitRouteSubobjectsType{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) msg() *otg.FlowRSVPType1ExplicitRouteSubobjectsType { - return obj.obj -} - -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) setMsg(msg *otg.FlowRSVPType1ExplicitRouteSubobjectsType) FlowRSVPType1ExplicitRouteSubobjectsType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPType1ExplicitRouteSubobjectsType struct { - obj *flowRSVPType1ExplicitRouteSubobjectsType -} - -type marshalFlowRSVPType1ExplicitRouteSubobjectsType interface { - // ToProto marshals FlowRSVPType1ExplicitRouteSubobjectsType to protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjectsType - ToProto() (*otg.FlowRSVPType1ExplicitRouteSubobjectsType, error) - // ToPbText marshals FlowRSVPType1ExplicitRouteSubobjectsType to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPType1ExplicitRouteSubobjectsType to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPType1ExplicitRouteSubobjectsType to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPType1ExplicitRouteSubobjectsType struct { - obj *flowRSVPType1ExplicitRouteSubobjectsType -} - -type unMarshalFlowRSVPType1ExplicitRouteSubobjectsType interface { - // FromProto unmarshals FlowRSVPType1ExplicitRouteSubobjectsType from protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjectsType - FromProto(msg *otg.FlowRSVPType1ExplicitRouteSubobjectsType) (FlowRSVPType1ExplicitRouteSubobjectsType, error) - // FromPbText unmarshals FlowRSVPType1ExplicitRouteSubobjectsType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPType1ExplicitRouteSubobjectsType from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPType1ExplicitRouteSubobjectsType from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) Marshal() marshalFlowRSVPType1ExplicitRouteSubobjectsType { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPType1ExplicitRouteSubobjectsType{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) Unmarshal() unMarshalFlowRSVPType1ExplicitRouteSubobjectsType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPType1ExplicitRouteSubobjectsType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPType1ExplicitRouteSubobjectsType) ToProto() (*otg.FlowRSVPType1ExplicitRouteSubobjectsType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPType1ExplicitRouteSubobjectsType) FromProto(msg *otg.FlowRSVPType1ExplicitRouteSubobjectsType) (FlowRSVPType1ExplicitRouteSubobjectsType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPType1ExplicitRouteSubobjectsType) 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 *unMarshalflowRSVPType1ExplicitRouteSubobjectsType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPType1ExplicitRouteSubobjectsType) 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 *unMarshalflowRSVPType1ExplicitRouteSubobjectsType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPType1ExplicitRouteSubobjectsType) 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 *unMarshalflowRSVPType1ExplicitRouteSubobjectsType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) Clone() (FlowRSVPType1ExplicitRouteSubobjectsType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPType1ExplicitRouteSubobjectsType() - 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 -} - -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) setNil() { - obj.ipv4PrefixHolder = nil - obj.asNumberHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPType1ExplicitRouteSubobjectsType is currently supported subobjects are IPv4 address(1) and Autonomous system number(32). -type FlowRSVPType1ExplicitRouteSubobjectsType interface { - Validation - // msg marshals FlowRSVPType1ExplicitRouteSubobjectsType to protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjectsType - // and doesn't set defaults - msg() *otg.FlowRSVPType1ExplicitRouteSubobjectsType - // setMsg unmarshals FlowRSVPType1ExplicitRouteSubobjectsType from protobuf object *otg.FlowRSVPType1ExplicitRouteSubobjectsType - // and doesn't set defaults - setMsg(*otg.FlowRSVPType1ExplicitRouteSubobjectsType) FlowRSVPType1ExplicitRouteSubobjectsType - // provides marshal interface - Marshal() marshalFlowRSVPType1ExplicitRouteSubobjectsType - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPType1ExplicitRouteSubobjectsType - // validate validates FlowRSVPType1ExplicitRouteSubobjectsType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPType1ExplicitRouteSubobjectsType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum, set in FlowRSVPType1ExplicitRouteSubobjectsType - Choice() FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum - // setChoice assigns FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum provided by user to FlowRSVPType1ExplicitRouteSubobjectsType - setChoice(value FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum) FlowRSVPType1ExplicitRouteSubobjectsType - // HasChoice checks if Choice has been set in FlowRSVPType1ExplicitRouteSubobjectsType - HasChoice() bool - // Ipv4Prefix returns FlowRSVPPathExplicitRouteType1Ipv4Prefix, set in FlowRSVPType1ExplicitRouteSubobjectsType. - // FlowRSVPPathExplicitRouteType1Ipv4Prefix is class = EXPLICIT_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: IPv4 Prefix, C-Type: 1 - Ipv4Prefix() FlowRSVPPathExplicitRouteType1Ipv4Prefix - // SetIpv4Prefix assigns FlowRSVPPathExplicitRouteType1Ipv4Prefix provided by user to FlowRSVPType1ExplicitRouteSubobjectsType. - // FlowRSVPPathExplicitRouteType1Ipv4Prefix is class = EXPLICIT_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: IPv4 Prefix, C-Type: 1 - SetIpv4Prefix(value FlowRSVPPathExplicitRouteType1Ipv4Prefix) FlowRSVPType1ExplicitRouteSubobjectsType - // HasIpv4Prefix checks if Ipv4Prefix has been set in FlowRSVPType1ExplicitRouteSubobjectsType - HasIpv4Prefix() bool - // AsNumber returns FlowRSVPPathExplicitRouteType1ASNumber, set in FlowRSVPType1ExplicitRouteSubobjectsType. - // FlowRSVPPathExplicitRouteType1ASNumber is class = EXPLICIT_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: Autonomous system number, C-Type: 32 - AsNumber() FlowRSVPPathExplicitRouteType1ASNumber - // SetAsNumber assigns FlowRSVPPathExplicitRouteType1ASNumber provided by user to FlowRSVPType1ExplicitRouteSubobjectsType. - // FlowRSVPPathExplicitRouteType1ASNumber is class = EXPLICIT_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: Autonomous system number, C-Type: 32 - SetAsNumber(value FlowRSVPPathExplicitRouteType1ASNumber) FlowRSVPType1ExplicitRouteSubobjectsType - // HasAsNumber checks if AsNumber has been set in FlowRSVPType1ExplicitRouteSubobjectsType - HasAsNumber() bool - setNil() -} - -type FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum string - -// Enum of Choice on FlowRSVPType1ExplicitRouteSubobjectsType -var FlowRSVPType1ExplicitRouteSubobjectsTypeChoice = struct { - IPV4_PREFIX FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum - AS_NUMBER FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum -}{ - IPV4_PREFIX: FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum("ipv4_prefix"), - AS_NUMBER: FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum("as_number"), -} - -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) Choice() FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum { - return FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) setChoice(value FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum) FlowRSVPType1ExplicitRouteSubobjectsType { - intValue, ok := otg.FlowRSVPType1ExplicitRouteSubobjectsType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPType1ExplicitRouteSubobjectsType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.AsNumber = nil - obj.asNumberHolder = nil - obj.obj.Ipv4Prefix = nil - obj.ipv4PrefixHolder = nil - - if value == FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.IPV4_PREFIX { - obj.obj.Ipv4Prefix = NewFlowRSVPPathExplicitRouteType1Ipv4Prefix().msg() - } - - if value == FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.AS_NUMBER { - obj.obj.AsNumber = NewFlowRSVPPathExplicitRouteType1ASNumber().msg() - } - - return obj -} - -// description is TBD -// Ipv4Prefix returns a FlowRSVPPathExplicitRouteType1Ipv4Prefix -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) Ipv4Prefix() FlowRSVPPathExplicitRouteType1Ipv4Prefix { - if obj.obj.Ipv4Prefix == nil { - obj.setChoice(FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.IPV4_PREFIX) - } - if obj.ipv4PrefixHolder == nil { - obj.ipv4PrefixHolder = &flowRSVPPathExplicitRouteType1Ipv4Prefix{obj: obj.obj.Ipv4Prefix} - } - return obj.ipv4PrefixHolder -} - -// description is TBD -// Ipv4Prefix returns a FlowRSVPPathExplicitRouteType1Ipv4Prefix -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) HasIpv4Prefix() bool { - return obj.obj.Ipv4Prefix != nil -} - -// description is TBD -// SetIpv4Prefix sets the FlowRSVPPathExplicitRouteType1Ipv4Prefix value in the FlowRSVPType1ExplicitRouteSubobjectsType object -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) SetIpv4Prefix(value FlowRSVPPathExplicitRouteType1Ipv4Prefix) FlowRSVPType1ExplicitRouteSubobjectsType { - obj.setChoice(FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.IPV4_PREFIX) - obj.ipv4PrefixHolder = nil - obj.obj.Ipv4Prefix = value.msg() - - return obj -} - -// description is TBD -// AsNumber returns a FlowRSVPPathExplicitRouteType1ASNumber -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) AsNumber() FlowRSVPPathExplicitRouteType1ASNumber { - if obj.obj.AsNumber == nil { - obj.setChoice(FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.AS_NUMBER) - } - if obj.asNumberHolder == nil { - obj.asNumberHolder = &flowRSVPPathExplicitRouteType1ASNumber{obj: obj.obj.AsNumber} - } - return obj.asNumberHolder -} - -// description is TBD -// AsNumber returns a FlowRSVPPathExplicitRouteType1ASNumber -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) HasAsNumber() bool { - return obj.obj.AsNumber != nil -} - -// description is TBD -// SetAsNumber sets the FlowRSVPPathExplicitRouteType1ASNumber value in the FlowRSVPType1ExplicitRouteSubobjectsType object -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) SetAsNumber(value FlowRSVPPathExplicitRouteType1ASNumber) FlowRSVPType1ExplicitRouteSubobjectsType { - obj.setChoice(FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.AS_NUMBER) - obj.asNumberHolder = nil - obj.obj.AsNumber = value.msg() - - return obj -} - -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv4Prefix != nil { - - obj.Ipv4Prefix().validateObj(vObj, set_default) - } - - if obj.obj.AsNumber != nil { - - obj.AsNumber().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPType1ExplicitRouteSubobjectsType) setDefault() { - var choices_set int = 0 - var choice FlowRSVPType1ExplicitRouteSubobjectsTypeChoiceEnum - - if obj.obj.Ipv4Prefix != nil { - choices_set += 1 - choice = FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.IPV4_PREFIX - } - - if obj.obj.AsNumber != nil { - choices_set += 1 - choice = FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.AS_NUMBER - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPType1ExplicitRouteSubobjectsTypeChoice.IPV4_PREFIX) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPType1ExplicitRouteSubobjectsType") - } - } else { - intVal := otg.FlowRSVPType1ExplicitRouteSubobjectsType_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPType1ExplicitRouteSubobjectsType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter ***** -type patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter struct { - validation - obj *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - marshaller marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - unMarshaller unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter -} - -func NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { - obj := patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter{obj: &otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) setMsg(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter struct { - obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter -} - -type marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter interface { - // ToProto marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, error) - // ToPbText marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter struct { - obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter -} - -type unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter interface { - // FromProto unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) 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 *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) 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 *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) 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 *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter() - 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 -} - -// PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter is integer counter pattern -type PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter interface { - Validation - // msg marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - // setMsg unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - // validate validates PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - SetStart(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - SetStep(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - SetCount(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter object -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) SetStart(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter object -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) SetStep(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter object -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) SetCount(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter ***** -type patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter struct { - validation - obj *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - marshaller marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - unMarshaller unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter -} - -func NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { - obj := patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter{obj: &otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) setMsg(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter struct { - obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter -} - -type marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter interface { - // ToProto marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, error) - // ToPbText marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter struct { - obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter -} - -type unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter interface { - // FromProto unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) 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 *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) 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 *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) 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 *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter() - 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 -} - -// PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter is integer counter pattern -type PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter interface { - Validation - // msg marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - // setMsg unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - // validate validates PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - SetStart(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - SetStep(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - SetCount(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter object -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) SetStart(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter object -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) SetStep(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter object -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) SetCount(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(2048) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter ***** -type patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - marshaller marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - unMarshaller unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter -} - -func NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { - obj := patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter{obj: &otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter struct { - obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter -} - -type marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter interface { - // ToProto marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter struct { - obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter -} - -type unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) 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 *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) 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 *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) 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 *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter() - 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 -} - -// PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter is ipv4 counter pattern -type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - // setMsg unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - // validate validates PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - SetStart(value string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - HasStart() bool - // Step returns string, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - SetStep(value string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - SetCount(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) SetStart(value string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) SetStep(value string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateIpv4(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateIpv4(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter.Step")) - } - - } - -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("0.0.0.0") - } - if obj.obj.Step == nil { - obj.SetStep("0.0.0.1") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter ***** -type patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - marshaller marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - unMarshaller unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter -} - -func NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { - obj := patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter{obj: &otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter struct { - obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter -} - -type marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter interface { - // ToProto marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter struct { - obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter -} - -type unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) 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 *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) 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 *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) 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 *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter() - 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 -} - -// PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter is integer counter pattern -type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - // setMsg unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - // validate validates PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - SetStart(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - SetStep(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - SetCount(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter ***** -type patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - marshaller marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - unMarshaller unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter -} - -func NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { - obj := patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter{obj: &otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter struct { - obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter -} - -type marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter interface { - // ToProto marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter struct { - obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter -} - -type unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) 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 *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) 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 *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) 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 *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter() - 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 -} - -// PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter is integer counter pattern -type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - // setMsg unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - // validate validates PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - SetStart(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - SetStep(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - SetCount(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter object -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServVersionCounter ***** -type patternFlowRSVPPathSenderTspecIntServVersionCounter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter - marshaller marshalPatternFlowRSVPPathSenderTspecIntServVersionCounter - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServVersionCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServVersionCounter() PatternFlowRSVPPathSenderTspecIntServVersionCounter { - obj := patternFlowRSVPPathSenderTspecIntServVersionCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter) PatternFlowRSVPPathSenderTspecIntServVersionCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServVersionCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServVersionCounter -} - -type marshalPatternFlowRSVPPathSenderTspecIntServVersionCounter interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServVersionCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServVersionCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServVersionCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServVersionCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServVersionCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServVersionCounter -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServVersionCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServVersionCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter) (PatternFlowRSVPPathSenderTspecIntServVersionCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServVersionCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServVersionCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServVersionCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServVersionCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServVersionCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServVersionCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServVersionCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter) (PatternFlowRSVPPathSenderTspecIntServVersionCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) 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 *patternFlowRSVPPathSenderTspecIntServVersionCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServVersionCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServVersionCounter() - 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 -} - -// PatternFlowRSVPPathSenderTspecIntServVersionCounter is integer counter pattern -type PatternFlowRSVPPathSenderTspecIntServVersionCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServVersionCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServVersionCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter) PatternFlowRSVPPathSenderTspecIntServVersionCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServVersionCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServVersionCounter - // validate validates PatternFlowRSVPPathSenderTspecIntServVersionCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServVersionCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServVersionCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServVersionCounter - SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServVersionCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServVersionCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServVersionCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServVersionCounter - SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServVersionCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServVersionCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServVersionCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServVersionCounter - SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServVersionCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServVersionCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServVersionCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServVersionCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServVersionCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServVersionCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServVersionCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServVersionCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServVersionCounter.Start <= 15 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServVersionCounter.Step <= 15 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 15 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServVersionCounter.Count <= 15 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServReserved1Counter ***** -type patternFlowRSVPPathSenderTspecIntServReserved1Counter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter - marshaller marshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter -} - -func NewPatternFlowRSVPPathSenderTspecIntServReserved1Counter() PatternFlowRSVPPathSenderTspecIntServReserved1Counter { - obj := patternFlowRSVPPathSenderTspecIntServReserved1Counter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter) PatternFlowRSVPPathSenderTspecIntServReserved1Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter struct { - obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter -} - -type marshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter struct { - obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter) (PatternFlowRSVPPathSenderTspecIntServReserved1Counter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter) (PatternFlowRSVPPathSenderTspecIntServReserved1Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) 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 *patternFlowRSVPPathSenderTspecIntServReserved1Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) Clone() (PatternFlowRSVPPathSenderTspecIntServReserved1Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServReserved1Counter() - 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 -} - -// PatternFlowRSVPPathSenderTspecIntServReserved1Counter is integer counter pattern -type PatternFlowRSVPPathSenderTspecIntServReserved1Counter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter) PatternFlowRSVPPathSenderTspecIntServReserved1Counter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter - // validate validates PatternFlowRSVPPathSenderTspecIntServReserved1Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServReserved1Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved1Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1Counter - SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1Counter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServReserved1Counter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved1Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1Counter - SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1Counter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServReserved1Counter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved1Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1Counter - SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1Counter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServReserved1Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved1Counter object -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved1Counter object -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved1Counter object -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved1Counter.Start <= 4095 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved1Counter.Step <= 4095 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 4095 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved1Counter.Count <= 4095 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter ***** -type patternFlowRSVPPathSenderTspecIntServOverallLengthCounter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - marshaller marshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter() PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { - obj := patternFlowRSVPPathSenderTspecIntServOverallLengthCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter -} - -type marshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) (PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) (PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) 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 *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter() - 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 -} - -// PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter is integer counter pattern -type PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - // validate validates PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(7) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter ***** -type patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - marshaller marshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter() PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { - obj := patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter -} - -type marshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) (PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) (PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) 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 *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter() - 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 -} - -// PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter is integer counter pattern -type PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - // validate validates PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(1) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServZeroBitCounter ***** -type patternFlowRSVPPathSenderTspecIntServZeroBitCounter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - marshaller marshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServZeroBitCounter() PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { - obj := patternFlowRSVPPathSenderTspecIntServZeroBitCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter -} - -type marshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) (PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) (PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) 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 *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServZeroBitCounter() - 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 -} - -// PatternFlowRSVPPathSenderTspecIntServZeroBitCounter is integer counter pattern -type PatternFlowRSVPPathSenderTspecIntServZeroBitCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter - // validate validates PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServZeroBitCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServZeroBitCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServZeroBitCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServZeroBitCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServZeroBitCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServZeroBitCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServZeroBitCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServZeroBitCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServZeroBitCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServZeroBitCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServReserved2Counter ***** -type patternFlowRSVPPathSenderTspecIntServReserved2Counter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter - marshaller marshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter -} - -func NewPatternFlowRSVPPathSenderTspecIntServReserved2Counter() PatternFlowRSVPPathSenderTspecIntServReserved2Counter { - obj := patternFlowRSVPPathSenderTspecIntServReserved2Counter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter) PatternFlowRSVPPathSenderTspecIntServReserved2Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter struct { - obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter -} - -type marshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter struct { - obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter) (PatternFlowRSVPPathSenderTspecIntServReserved2Counter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter) (PatternFlowRSVPPathSenderTspecIntServReserved2Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) 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 *patternFlowRSVPPathSenderTspecIntServReserved2Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) Clone() (PatternFlowRSVPPathSenderTspecIntServReserved2Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServReserved2Counter() - 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 -} - -// PatternFlowRSVPPathSenderTspecIntServReserved2Counter is integer counter pattern -type PatternFlowRSVPPathSenderTspecIntServReserved2Counter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter) PatternFlowRSVPPathSenderTspecIntServReserved2Counter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter - // validate validates PatternFlowRSVPPathSenderTspecIntServReserved2Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServReserved2Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved2Counter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2Counter - SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2Counter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServReserved2Counter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved2Counter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2Counter - SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2Counter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServReserved2Counter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved2Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2Counter - SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2Counter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServReserved2Counter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved2Counter object -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved2Counter object -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved2Counter object -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 127 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved2Counter.Start <= 127 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 127 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved2Counter.Step <= 127 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 127 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved2Counter.Count <= 127 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter ***** -type patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - marshaller marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { - obj := patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter -} - -type marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) 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 *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter() - 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 -} - -// PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter is integer counter pattern -type PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - // validate validates PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(6) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter ***** -type patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - marshaller marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { - obj := patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter -} - -type marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) 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 *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter() - 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 -} - -// PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter is integer counter pattern -type PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - // validate validates PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(127) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter ***** -type patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - marshaller marshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter() PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { - obj := patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter -} - -type marshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) (PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) (PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) 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 *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter() - 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 -} - -// PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter is integer counter pattern -type PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - // validate validates PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter ***** -type patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - marshaller marshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter() PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { - obj := patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter -} - -type marshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) (PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) (PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) 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 *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter() - 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 -} - -// PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter is integer counter pattern -type PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - // validate validates PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter.Start <= 65535 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter.Step <= 65535 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter.Count <= 65535 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(5) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter ***** -type patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - marshaller marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { - obj := patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter -} - -type marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) 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 *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter() - 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 -} - -// PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter is integer counter pattern -type PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - // validate validates PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter ***** -type patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter struct { - validation - obj *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - marshaller marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter -} - -func NewPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { - obj := patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter -} - -type marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter interface { - // ToProto marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, error) - // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter struct { - obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter -} - -type unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) 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 *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter() - 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 -} - -// PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter is integer counter pattern -type PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - // validate validates PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter object -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** FlowRSVPPathObjectsRecordRouteSubObjectType ***** -type flowRSVPPathObjectsRecordRouteSubObjectType struct { - validation - obj *otg.FlowRSVPPathObjectsRecordRouteSubObjectType - marshaller marshalFlowRSVPPathObjectsRecordRouteSubObjectType - unMarshaller unMarshalFlowRSVPPathObjectsRecordRouteSubObjectType - ipv4AddressHolder FlowRSVPPathRecordRouteType1Ipv4Address - labelHolder FlowRSVPPathRecordRouteType1Label -} - -func NewFlowRSVPPathObjectsRecordRouteSubObjectType() FlowRSVPPathObjectsRecordRouteSubObjectType { - obj := flowRSVPPathObjectsRecordRouteSubObjectType{obj: &otg.FlowRSVPPathObjectsRecordRouteSubObjectType{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) msg() *otg.FlowRSVPPathObjectsRecordRouteSubObjectType { - return obj.obj -} - -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) setMsg(msg *otg.FlowRSVPPathObjectsRecordRouteSubObjectType) FlowRSVPPathObjectsRecordRouteSubObjectType { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathObjectsRecordRouteSubObjectType struct { - obj *flowRSVPPathObjectsRecordRouteSubObjectType -} - -type marshalFlowRSVPPathObjectsRecordRouteSubObjectType interface { - // ToProto marshals FlowRSVPPathObjectsRecordRouteSubObjectType to protobuf object *otg.FlowRSVPPathObjectsRecordRouteSubObjectType - ToProto() (*otg.FlowRSVPPathObjectsRecordRouteSubObjectType, error) - // ToPbText marshals FlowRSVPPathObjectsRecordRouteSubObjectType to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathObjectsRecordRouteSubObjectType to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathObjectsRecordRouteSubObjectType to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathObjectsRecordRouteSubObjectType struct { - obj *flowRSVPPathObjectsRecordRouteSubObjectType -} - -type unMarshalFlowRSVPPathObjectsRecordRouteSubObjectType interface { - // FromProto unmarshals FlowRSVPPathObjectsRecordRouteSubObjectType from protobuf object *otg.FlowRSVPPathObjectsRecordRouteSubObjectType - FromProto(msg *otg.FlowRSVPPathObjectsRecordRouteSubObjectType) (FlowRSVPPathObjectsRecordRouteSubObjectType, error) - // FromPbText unmarshals FlowRSVPPathObjectsRecordRouteSubObjectType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathObjectsRecordRouteSubObjectType from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathObjectsRecordRouteSubObjectType from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) Marshal() marshalFlowRSVPPathObjectsRecordRouteSubObjectType { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathObjectsRecordRouteSubObjectType{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) Unmarshal() unMarshalFlowRSVPPathObjectsRecordRouteSubObjectType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathObjectsRecordRouteSubObjectType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathObjectsRecordRouteSubObjectType) ToProto() (*otg.FlowRSVPPathObjectsRecordRouteSubObjectType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathObjectsRecordRouteSubObjectType) FromProto(msg *otg.FlowRSVPPathObjectsRecordRouteSubObjectType) (FlowRSVPPathObjectsRecordRouteSubObjectType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathObjectsRecordRouteSubObjectType) 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 *unMarshalflowRSVPPathObjectsRecordRouteSubObjectType) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathObjectsRecordRouteSubObjectType) 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 *unMarshalflowRSVPPathObjectsRecordRouteSubObjectType) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathObjectsRecordRouteSubObjectType) 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 *unMarshalflowRSVPPathObjectsRecordRouteSubObjectType) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) Clone() (FlowRSVPPathObjectsRecordRouteSubObjectType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathObjectsRecordRouteSubObjectType() - 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 -} - -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) setNil() { - obj.ipv4AddressHolder = nil - obj.labelHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathObjectsRecordRouteSubObjectType is currently supported subobjects are IPv4 address(1) and Label(3). -type FlowRSVPPathObjectsRecordRouteSubObjectType interface { - Validation - // msg marshals FlowRSVPPathObjectsRecordRouteSubObjectType to protobuf object *otg.FlowRSVPPathObjectsRecordRouteSubObjectType - // and doesn't set defaults - msg() *otg.FlowRSVPPathObjectsRecordRouteSubObjectType - // setMsg unmarshals FlowRSVPPathObjectsRecordRouteSubObjectType from protobuf object *otg.FlowRSVPPathObjectsRecordRouteSubObjectType - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathObjectsRecordRouteSubObjectType) FlowRSVPPathObjectsRecordRouteSubObjectType - // provides marshal interface - Marshal() marshalFlowRSVPPathObjectsRecordRouteSubObjectType - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathObjectsRecordRouteSubObjectType - // validate validates FlowRSVPPathObjectsRecordRouteSubObjectType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathObjectsRecordRouteSubObjectType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum, set in FlowRSVPPathObjectsRecordRouteSubObjectType - Choice() FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum - // setChoice assigns FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum provided by user to FlowRSVPPathObjectsRecordRouteSubObjectType - setChoice(value FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum) FlowRSVPPathObjectsRecordRouteSubObjectType - // HasChoice checks if Choice has been set in FlowRSVPPathObjectsRecordRouteSubObjectType - HasChoice() bool - // Ipv4Address returns FlowRSVPPathRecordRouteType1Ipv4Address, set in FlowRSVPPathObjectsRecordRouteSubObjectType. - // FlowRSVPPathRecordRouteType1Ipv4Address is class = RECORD_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: IPv4 Address, C-Type: 1 - Ipv4Address() FlowRSVPPathRecordRouteType1Ipv4Address - // SetIpv4Address assigns FlowRSVPPathRecordRouteType1Ipv4Address provided by user to FlowRSVPPathObjectsRecordRouteSubObjectType. - // FlowRSVPPathRecordRouteType1Ipv4Address is class = RECORD_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: IPv4 Address, C-Type: 1 - SetIpv4Address(value FlowRSVPPathRecordRouteType1Ipv4Address) FlowRSVPPathObjectsRecordRouteSubObjectType - // HasIpv4Address checks if Ipv4Address has been set in FlowRSVPPathObjectsRecordRouteSubObjectType - HasIpv4Address() bool - // Label returns FlowRSVPPathRecordRouteType1Label, set in FlowRSVPPathObjectsRecordRouteSubObjectType. - // FlowRSVPPathRecordRouteType1Label is class = RECORD_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: Label, C-Type: 3 - Label() FlowRSVPPathRecordRouteType1Label - // SetLabel assigns FlowRSVPPathRecordRouteType1Label provided by user to FlowRSVPPathObjectsRecordRouteSubObjectType. - // FlowRSVPPathRecordRouteType1Label is class = RECORD_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: Label, C-Type: 3 - SetLabel(value FlowRSVPPathRecordRouteType1Label) FlowRSVPPathObjectsRecordRouteSubObjectType - // HasLabel checks if Label has been set in FlowRSVPPathObjectsRecordRouteSubObjectType - HasLabel() bool - setNil() -} - -type FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum string - -// Enum of Choice on FlowRSVPPathObjectsRecordRouteSubObjectType -var FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice = struct { - IPV4_ADDRESS FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum - LABEL FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum -}{ - IPV4_ADDRESS: FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum("ipv4_address"), - LABEL: FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum("label"), -} - -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) Choice() FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum { - return FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) setChoice(value FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum) FlowRSVPPathObjectsRecordRouteSubObjectType { - intValue, ok := otg.FlowRSVPPathObjectsRecordRouteSubObjectType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPPathObjectsRecordRouteSubObjectType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Label = nil - obj.labelHolder = nil - obj.obj.Ipv4Address = nil - obj.ipv4AddressHolder = nil - - if value == FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.IPV4_ADDRESS { - obj.obj.Ipv4Address = NewFlowRSVPPathRecordRouteType1Ipv4Address().msg() - } - - if value == FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.LABEL { - obj.obj.Label = NewFlowRSVPPathRecordRouteType1Label().msg() - } - - return obj -} - -// description is TBD -// Ipv4Address returns a FlowRSVPPathRecordRouteType1Ipv4Address -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) Ipv4Address() FlowRSVPPathRecordRouteType1Ipv4Address { - if obj.obj.Ipv4Address == nil { - obj.setChoice(FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.IPV4_ADDRESS) - } - if obj.ipv4AddressHolder == nil { - obj.ipv4AddressHolder = &flowRSVPPathRecordRouteType1Ipv4Address{obj: obj.obj.Ipv4Address} - } - return obj.ipv4AddressHolder -} - -// description is TBD -// Ipv4Address returns a FlowRSVPPathRecordRouteType1Ipv4Address -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) HasIpv4Address() bool { - return obj.obj.Ipv4Address != nil -} - -// description is TBD -// SetIpv4Address sets the FlowRSVPPathRecordRouteType1Ipv4Address value in the FlowRSVPPathObjectsRecordRouteSubObjectType object -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) SetIpv4Address(value FlowRSVPPathRecordRouteType1Ipv4Address) FlowRSVPPathObjectsRecordRouteSubObjectType { - obj.setChoice(FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.IPV4_ADDRESS) - obj.ipv4AddressHolder = nil - obj.obj.Ipv4Address = value.msg() - - return obj -} - -// description is TBD -// Label returns a FlowRSVPPathRecordRouteType1Label -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) Label() FlowRSVPPathRecordRouteType1Label { - if obj.obj.Label == nil { - obj.setChoice(FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.LABEL) - } - if obj.labelHolder == nil { - obj.labelHolder = &flowRSVPPathRecordRouteType1Label{obj: obj.obj.Label} - } - return obj.labelHolder -} - -// description is TBD -// Label returns a FlowRSVPPathRecordRouteType1Label -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) HasLabel() bool { - return obj.obj.Label != nil -} - -// description is TBD -// SetLabel sets the FlowRSVPPathRecordRouteType1Label value in the FlowRSVPPathObjectsRecordRouteSubObjectType object -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) SetLabel(value FlowRSVPPathRecordRouteType1Label) FlowRSVPPathObjectsRecordRouteSubObjectType { - obj.setChoice(FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.LABEL) - obj.labelHolder = nil - obj.obj.Label = value.msg() - - return obj -} - -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ipv4Address != nil { - - obj.Ipv4Address().validateObj(vObj, set_default) - } - - if obj.obj.Label != nil { - - obj.Label().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathObjectsRecordRouteSubObjectType) setDefault() { - var choices_set int = 0 - var choice FlowRSVPPathObjectsRecordRouteSubObjectTypeChoiceEnum - - if obj.obj.Ipv4Address != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.IPV4_ADDRESS - } - - if obj.obj.Label != nil { - choices_set += 1 - choice = FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.LABEL - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPPathObjectsRecordRouteSubObjectTypeChoice.IPV4_ADDRESS) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathObjectsRecordRouteSubObjectType") - } - } else { - intVal := otg.FlowRSVPPathObjectsRecordRouteSubObjectType_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPPathObjectsRecordRouteSubObjectType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** BgpAttributesSidMpls ***** -type bgpAttributesSidMpls struct { - validation - obj *otg.BgpAttributesSidMpls - marshaller marshalBgpAttributesSidMpls - unMarshaller unMarshalBgpAttributesSidMpls -} - -func NewBgpAttributesSidMpls() BgpAttributesSidMpls { - obj := bgpAttributesSidMpls{obj: &otg.BgpAttributesSidMpls{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSidMpls) msg() *otg.BgpAttributesSidMpls { - return obj.obj -} - -func (obj *bgpAttributesSidMpls) setMsg(msg *otg.BgpAttributesSidMpls) BgpAttributesSidMpls { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSidMpls struct { - obj *bgpAttributesSidMpls -} - -type marshalBgpAttributesSidMpls interface { - // ToProto marshals BgpAttributesSidMpls to protobuf object *otg.BgpAttributesSidMpls - ToProto() (*otg.BgpAttributesSidMpls, error) - // ToPbText marshals BgpAttributesSidMpls to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSidMpls to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSidMpls to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSidMpls struct { - obj *bgpAttributesSidMpls -} - -type unMarshalBgpAttributesSidMpls interface { - // FromProto unmarshals BgpAttributesSidMpls from protobuf object *otg.BgpAttributesSidMpls - FromProto(msg *otg.BgpAttributesSidMpls) (BgpAttributesSidMpls, error) - // FromPbText unmarshals BgpAttributesSidMpls from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSidMpls from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSidMpls from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSidMpls) Marshal() marshalBgpAttributesSidMpls { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSidMpls{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSidMpls) Unmarshal() unMarshalBgpAttributesSidMpls { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSidMpls{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSidMpls) ToProto() (*otg.BgpAttributesSidMpls, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSidMpls) FromProto(msg *otg.BgpAttributesSidMpls) (BgpAttributesSidMpls, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSidMpls) 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 *unMarshalbgpAttributesSidMpls) 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 *marshalbgpAttributesSidMpls) 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 *unMarshalbgpAttributesSidMpls) 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 *marshalbgpAttributesSidMpls) 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 *unMarshalbgpAttributesSidMpls) 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 *bgpAttributesSidMpls) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSidMpls) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSidMpls) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSidMpls) Clone() (BgpAttributesSidMpls, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSidMpls() - 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 -} - -// BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence -// or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. -type BgpAttributesSidMpls interface { - Validation - // msg marshals BgpAttributesSidMpls to protobuf object *otg.BgpAttributesSidMpls - // and doesn't set defaults - msg() *otg.BgpAttributesSidMpls - // setMsg unmarshals BgpAttributesSidMpls from protobuf object *otg.BgpAttributesSidMpls - // and doesn't set defaults - setMsg(*otg.BgpAttributesSidMpls) BgpAttributesSidMpls - // provides marshal interface - Marshal() marshalBgpAttributesSidMpls - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSidMpls - // validate validates BgpAttributesSidMpls - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSidMpls, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Label returns uint32, set in BgpAttributesSidMpls. - Label() uint32 - // SetLabel assigns uint32 provided by user to BgpAttributesSidMpls - SetLabel(value uint32) BgpAttributesSidMpls - // HasLabel checks if Label has been set in BgpAttributesSidMpls - HasLabel() bool - // TrafficClass returns uint32, set in BgpAttributesSidMpls. - TrafficClass() uint32 - // SetTrafficClass assigns uint32 provided by user to BgpAttributesSidMpls - SetTrafficClass(value uint32) BgpAttributesSidMpls - // HasTrafficClass checks if TrafficClass has been set in BgpAttributesSidMpls - HasTrafficClass() bool - // FlagBos returns bool, set in BgpAttributesSidMpls. - FlagBos() bool - // SetFlagBos assigns bool provided by user to BgpAttributesSidMpls - SetFlagBos(value bool) BgpAttributesSidMpls - // HasFlagBos checks if FlagBos has been set in BgpAttributesSidMpls - HasFlagBos() bool - // Ttl returns uint32, set in BgpAttributesSidMpls. - Ttl() uint32 - // SetTtl assigns uint32 provided by user to BgpAttributesSidMpls - SetTtl(value uint32) BgpAttributesSidMpls - // HasTtl checks if Ttl has been set in BgpAttributesSidMpls - HasTtl() bool -} - -// 20 bit MPLS Label value. -// Label returns a uint32 -func (obj *bgpAttributesSidMpls) Label() uint32 { - - return *obj.obj.Label - -} - -// 20 bit MPLS Label value. -// Label returns a uint32 -func (obj *bgpAttributesSidMpls) HasLabel() bool { - return obj.obj.Label != nil -} - -// 20 bit MPLS Label value. -// SetLabel sets the uint32 value in the BgpAttributesSidMpls object -func (obj *bgpAttributesSidMpls) SetLabel(value uint32) BgpAttributesSidMpls { - - obj.obj.Label = &value - return obj -} - -// 3 bits of Traffic Class. -// TrafficClass returns a uint32 -func (obj *bgpAttributesSidMpls) TrafficClass() uint32 { - - return *obj.obj.TrafficClass - -} - -// 3 bits of Traffic Class. -// TrafficClass returns a uint32 -func (obj *bgpAttributesSidMpls) HasTrafficClass() bool { - return obj.obj.TrafficClass != nil -} - -// 3 bits of Traffic Class. -// SetTrafficClass sets the uint32 value in the BgpAttributesSidMpls object -func (obj *bgpAttributesSidMpls) SetTrafficClass(value uint32) BgpAttributesSidMpls { - - obj.obj.TrafficClass = &value - return obj -} - -// Bottom of Stack -// FlagBos returns a bool -func (obj *bgpAttributesSidMpls) FlagBos() bool { - - return *obj.obj.FlagBos - -} - -// Bottom of Stack -// FlagBos returns a bool -func (obj *bgpAttributesSidMpls) HasFlagBos() bool { - return obj.obj.FlagBos != nil -} - -// Bottom of Stack -// SetFlagBos sets the bool value in the BgpAttributesSidMpls object -func (obj *bgpAttributesSidMpls) SetFlagBos(value bool) BgpAttributesSidMpls { - - obj.obj.FlagBos = &value - return obj -} - -// 8 bits Time to Live -// Ttl returns a uint32 -func (obj *bgpAttributesSidMpls) Ttl() uint32 { - - return *obj.obj.Ttl - -} - -// 8 bits Time to Live -// Ttl returns a uint32 -func (obj *bgpAttributesSidMpls) HasTtl() bool { - return obj.obj.Ttl != nil -} - -// 8 bits Time to Live -// SetTtl sets the uint32 value in the BgpAttributesSidMpls object -func (obj *bgpAttributesSidMpls) SetTtl(value uint32) BgpAttributesSidMpls { - - obj.obj.Ttl = &value - return obj -} - -func (obj *bgpAttributesSidMpls) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Label != nil { - - if *obj.obj.Label > 1048576 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesSidMpls.Label <= 1048576 but Got %d", *obj.obj.Label)) - } - - } - - if obj.obj.TrafficClass != nil { - - if *obj.obj.TrafficClass > 7 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesSidMpls.TrafficClass <= 7 but Got %d", *obj.obj.TrafficClass)) - } - - } - - if obj.obj.Ttl != nil { - - if *obj.obj.Ttl > 63 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesSidMpls.Ttl <= 63 but Got %d", *obj.obj.Ttl)) - } - - } - -} - -func (obj *bgpAttributesSidMpls) setDefault() { - if obj.obj.Label == nil { - obj.SetLabel(16) - } - if obj.obj.TrafficClass == nil { - obj.SetTrafficClass(0) - } - if obj.obj.FlagBos == nil { - obj.SetFlagBos(true) - } - if obj.obj.Ttl == nil { - obj.SetTtl(63) - } - -} - -// ***** BgpAttributesSegmentRoutingPolicyTypeA ***** -type bgpAttributesSegmentRoutingPolicyTypeA struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicyTypeA - marshaller marshalBgpAttributesSegmentRoutingPolicyTypeA - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeA - flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags - mplsSidHolder BgpAttributesSidMpls -} - -func NewBgpAttributesSegmentRoutingPolicyTypeA() BgpAttributesSegmentRoutingPolicyTypeA { - obj := bgpAttributesSegmentRoutingPolicyTypeA{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeA{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeA { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeA) BgpAttributesSegmentRoutingPolicyTypeA { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicyTypeA struct { - obj *bgpAttributesSegmentRoutingPolicyTypeA -} - -type marshalBgpAttributesSegmentRoutingPolicyTypeA interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeA to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeA - ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeA, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeA to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeA to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeA to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicyTypeA struct { - obj *bgpAttributesSegmentRoutingPolicyTypeA -} - -type unMarshalBgpAttributesSegmentRoutingPolicyTypeA interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeA from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeA - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeA) (BgpAttributesSegmentRoutingPolicyTypeA, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeA from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeA from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeA from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeA { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeA{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeA { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeA{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeA) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeA, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeA) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeA) (BgpAttributesSegmentRoutingPolicyTypeA, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeA) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeA) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeA) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeA) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeA) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeA) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) Clone() (BgpAttributesSegmentRoutingPolicyTypeA, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicyTypeA() - 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 -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) setNil() { - obj.flagsHolder = nil - obj.mplsSidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSegmentRoutingPolicyTypeA is type A: SID only, in the form of MPLS Label. -// It is encoded as a Segment of Type 1 in the SEGMENT_LIST sub-tlv. -type BgpAttributesSegmentRoutingPolicyTypeA interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicyTypeA to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeA - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicyTypeA - // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeA from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeA - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeA) BgpAttributesSegmentRoutingPolicyTypeA - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeA - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeA - // validate validates BgpAttributesSegmentRoutingPolicyTypeA - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicyTypeA, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeA. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - Flags() BgpAttributesSegmentRoutingPolicyTypeFlags - // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeA. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeA - // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeA - HasFlags() bool - // MplsSid returns BgpAttributesSidMpls, set in BgpAttributesSegmentRoutingPolicyTypeA. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - MplsSid() BgpAttributesSidMpls - // SetMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesSegmentRoutingPolicyTypeA. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - SetMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeA - // HasMplsSid checks if MplsSid has been set in BgpAttributesSegmentRoutingPolicyTypeA - HasMplsSid() bool - setNil() -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { - if obj.obj.Flags == nil { - obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) HasFlags() bool { - return obj.obj.Flags != nil -} - -// description is TBD -// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeA object -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeA { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// description is TBD -// MplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) MplsSid() BgpAttributesSidMpls { - if obj.obj.MplsSid == nil { - obj.obj.MplsSid = NewBgpAttributesSidMpls().msg() - } - if obj.mplsSidHolder == nil { - obj.mplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.MplsSid} - } - return obj.mplsSidHolder -} - -// description is TBD -// MplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) HasMplsSid() bool { - return obj.obj.MplsSid != nil -} - -// description is TBD -// SetMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesSegmentRoutingPolicyTypeA object -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) SetMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeA { - - obj.mplsSidHolder = nil - obj.obj.MplsSid = value.msg() - - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.MplsSid != nil { - - obj.MplsSid().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeA) setDefault() { - -} - -// ***** BgpAttributesSegmentRoutingPolicyTypeB ***** -type bgpAttributesSegmentRoutingPolicyTypeB struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicyTypeB - marshaller marshalBgpAttributesSegmentRoutingPolicyTypeB - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeB - flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags - srv6EndpointBehaviorHolder BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -} - -func NewBgpAttributesSegmentRoutingPolicyTypeB() BgpAttributesSegmentRoutingPolicyTypeB { - obj := bgpAttributesSegmentRoutingPolicyTypeB{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeB{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeB { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeB) BgpAttributesSegmentRoutingPolicyTypeB { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicyTypeB struct { - obj *bgpAttributesSegmentRoutingPolicyTypeB -} - -type marshalBgpAttributesSegmentRoutingPolicyTypeB interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeB to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeB - ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeB, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeB to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeB to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeB to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicyTypeB struct { - obj *bgpAttributesSegmentRoutingPolicyTypeB -} - -type unMarshalBgpAttributesSegmentRoutingPolicyTypeB interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeB from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeB - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeB) (BgpAttributesSegmentRoutingPolicyTypeB, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeB from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeB from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeB from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeB { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeB{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeB { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeB{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeB) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeB, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeB) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeB) (BgpAttributesSegmentRoutingPolicyTypeB, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeB) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeB) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeB) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeB) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeB) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeB) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) Clone() (BgpAttributesSegmentRoutingPolicyTypeB, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicyTypeB() - 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 -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) setNil() { - obj.flagsHolder = nil - obj.srv6EndpointBehaviorHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSegmentRoutingPolicyTypeB is type B: SID only, in the form of IPv6 address. -// It is encoded as a Segment of Type 13 in the SEGMENT_LIST sub-tlv. -type BgpAttributesSegmentRoutingPolicyTypeB interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicyTypeB to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeB - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicyTypeB - // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeB from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeB - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeB) BgpAttributesSegmentRoutingPolicyTypeB - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeB - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeB - // validate validates BgpAttributesSegmentRoutingPolicyTypeB - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicyTypeB, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeB. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - Flags() BgpAttributesSegmentRoutingPolicyTypeFlags - // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeB. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeB - // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeB - HasFlags() bool - // Srv6Sid returns string, set in BgpAttributesSegmentRoutingPolicyTypeB. - Srv6Sid() string - // SetSrv6Sid assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeB - SetSrv6Sid(value string) BgpAttributesSegmentRoutingPolicyTypeB - // HasSrv6Sid checks if Srv6Sid has been set in BgpAttributesSegmentRoutingPolicyTypeB - HasSrv6Sid() bool - // Srv6EndpointBehavior returns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, set in BgpAttributesSegmentRoutingPolicyTypeB. - // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 - Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // SetSrv6EndpointBehavior assigns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure provided by user to BgpAttributesSegmentRoutingPolicyTypeB. - // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 - SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeB - // HasSrv6EndpointBehavior checks if Srv6EndpointBehavior has been set in BgpAttributesSegmentRoutingPolicyTypeB - HasSrv6EndpointBehavior() bool - setNil() -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { - if obj.obj.Flags == nil { - obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) HasFlags() bool { - return obj.obj.Flags != nil -} - -// description is TBD -// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeB object -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeB { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// SRv6 SID. -// Srv6Sid returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) Srv6Sid() string { - - return *obj.obj.Srv6Sid - -} - -// SRv6 SID. -// Srv6Sid returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) HasSrv6Sid() bool { - return obj.obj.Srv6Sid != nil -} - -// SRv6 SID. -// SetSrv6Sid sets the string value in the BgpAttributesSegmentRoutingPolicyTypeB object -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) SetSrv6Sid(value string) BgpAttributesSegmentRoutingPolicyTypeB { - - obj.obj.Srv6Sid = &value - return obj -} - -// description is TBD -// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - if obj.obj.Srv6EndpointBehavior == nil { - obj.obj.Srv6EndpointBehavior = NewBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure().msg() - } - if obj.srv6EndpointBehaviorHolder == nil { - obj.srv6EndpointBehaviorHolder = &bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6EndpointBehavior} - } - return obj.srv6EndpointBehaviorHolder -} - -// description is TBD -// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) HasSrv6EndpointBehavior() bool { - return obj.obj.Srv6EndpointBehavior != nil -} - -// description is TBD -// SetSrv6EndpointBehavior sets the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure value in the BgpAttributesSegmentRoutingPolicyTypeB object -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeB { - - obj.srv6EndpointBehaviorHolder = nil - obj.obj.Srv6EndpointBehavior = value.msg() - - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.Srv6Sid != nil { - - err := obj.validateIpv6(obj.Srv6Sid()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeB.Srv6Sid")) - } - - } - - if obj.obj.Srv6EndpointBehavior != nil { - - obj.Srv6EndpointBehavior().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeB) setDefault() { - if obj.obj.Srv6Sid == nil { - obj.SetSrv6Sid("0::0") - } - -} - -// ***** BgpAttributesSegmentRoutingPolicyTypeC ***** -type bgpAttributesSegmentRoutingPolicyTypeC struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicyTypeC - marshaller marshalBgpAttributesSegmentRoutingPolicyTypeC - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeC - flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags - srMplsSidHolder BgpAttributesSidMpls -} - -func NewBgpAttributesSegmentRoutingPolicyTypeC() BgpAttributesSegmentRoutingPolicyTypeC { - obj := bgpAttributesSegmentRoutingPolicyTypeC{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeC{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeC { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeC) BgpAttributesSegmentRoutingPolicyTypeC { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicyTypeC struct { - obj *bgpAttributesSegmentRoutingPolicyTypeC -} - -type marshalBgpAttributesSegmentRoutingPolicyTypeC interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeC to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeC - ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeC, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeC to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeC to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeC to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicyTypeC struct { - obj *bgpAttributesSegmentRoutingPolicyTypeC -} - -type unMarshalBgpAttributesSegmentRoutingPolicyTypeC interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeC from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeC - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeC) (BgpAttributesSegmentRoutingPolicyTypeC, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeC from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeC from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeC from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeC { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeC{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeC { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeC{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeC) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeC, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeC) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeC) (BgpAttributesSegmentRoutingPolicyTypeC, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeC) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeC) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeC) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeC) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeC) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeC) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) Clone() (BgpAttributesSegmentRoutingPolicyTypeC, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicyTypeC() - 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 -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) setNil() { - obj.flagsHolder = nil - obj.srMplsSidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSegmentRoutingPolicyTypeC is type C: IPv4 Node Address with optional SID. -// It is encoded as a Segment of Type 3 in the SEGMENT_LIST sub-tlv. -type BgpAttributesSegmentRoutingPolicyTypeC interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicyTypeC to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeC - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicyTypeC - // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeC from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeC - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeC) BgpAttributesSegmentRoutingPolicyTypeC - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeC - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeC - // validate validates BgpAttributesSegmentRoutingPolicyTypeC - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicyTypeC, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeC. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - Flags() BgpAttributesSegmentRoutingPolicyTypeFlags - // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeC. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeC - // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeC - HasFlags() bool - // SrAlgorithm returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeC. - SrAlgorithm() uint32 - // SetSrAlgorithm assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeC - SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeC - // HasSrAlgorithm checks if SrAlgorithm has been set in BgpAttributesSegmentRoutingPolicyTypeC - HasSrAlgorithm() bool - // Ipv4NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeC. - Ipv4NodeAddress() string - // SetIpv4NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeC - SetIpv4NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeC - // HasIpv4NodeAddress checks if Ipv4NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeC - HasIpv4NodeAddress() bool - // SrMplsSid returns BgpAttributesSidMpls, set in BgpAttributesSegmentRoutingPolicyTypeC. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - SrMplsSid() BgpAttributesSidMpls - // SetSrMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesSegmentRoutingPolicyTypeC. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeC - // HasSrMplsSid checks if SrMplsSid has been set in BgpAttributesSegmentRoutingPolicyTypeC - HasSrMplsSid() bool - setNil() -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { - if obj.obj.Flags == nil { - obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) HasFlags() bool { - return obj.obj.Flags != nil -} - -// description is TBD -// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeC object -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeC { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SrAlgorithm returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) SrAlgorithm() uint32 { - - return *obj.obj.SrAlgorithm - -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SrAlgorithm returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) HasSrAlgorithm() bool { - return obj.obj.SrAlgorithm != nil -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SetSrAlgorithm sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeC object -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeC { - - obj.obj.SrAlgorithm = &value - return obj -} - -// IPv4 address representing a node. -// Ipv4NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) Ipv4NodeAddress() string { - - return *obj.obj.Ipv4NodeAddress - -} - -// IPv4 address representing a node. -// Ipv4NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) HasIpv4NodeAddress() bool { - return obj.obj.Ipv4NodeAddress != nil -} - -// IPv4 address representing a node. -// SetIpv4NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeC object -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) SetIpv4NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeC { - - obj.obj.Ipv4NodeAddress = &value - return obj -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) SrMplsSid() BgpAttributesSidMpls { - if obj.obj.SrMplsSid == nil { - obj.obj.SrMplsSid = NewBgpAttributesSidMpls().msg() - } - if obj.srMplsSidHolder == nil { - obj.srMplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.SrMplsSid} - } - return obj.srMplsSidHolder -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) HasSrMplsSid() bool { - return obj.obj.SrMplsSid != nil -} - -// Optional SR-MPLS SID. -// SetSrMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesSegmentRoutingPolicyTypeC object -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeC { - - obj.srMplsSidHolder = nil - obj.obj.SrMplsSid = value.msg() - - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.SrAlgorithm != nil { - - if *obj.obj.SrAlgorithm > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicyTypeC.SrAlgorithm <= 255 but Got %d", *obj.obj.SrAlgorithm)) - } - - } - - if obj.obj.Ipv4NodeAddress != nil { - - err := obj.validateIpv4(obj.Ipv4NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeC.Ipv4NodeAddress")) - } - - } - - if obj.obj.SrMplsSid != nil { - - obj.SrMplsSid().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeC) setDefault() { - if obj.obj.SrAlgorithm == nil { - obj.SetSrAlgorithm(0) - } - if obj.obj.Ipv4NodeAddress == nil { - obj.SetIpv4NodeAddress("0.0.0.0") - } - -} - -// ***** BgpAttributesSegmentRoutingPolicyTypeD ***** -type bgpAttributesSegmentRoutingPolicyTypeD struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicyTypeD - marshaller marshalBgpAttributesSegmentRoutingPolicyTypeD - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeD - flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags - srMplsSidHolder BgpAttributesSidMpls -} - -func NewBgpAttributesSegmentRoutingPolicyTypeD() BgpAttributesSegmentRoutingPolicyTypeD { - obj := bgpAttributesSegmentRoutingPolicyTypeD{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeD{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeD { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeD) BgpAttributesSegmentRoutingPolicyTypeD { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicyTypeD struct { - obj *bgpAttributesSegmentRoutingPolicyTypeD -} - -type marshalBgpAttributesSegmentRoutingPolicyTypeD interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeD to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeD - ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeD, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeD to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeD to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeD to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicyTypeD struct { - obj *bgpAttributesSegmentRoutingPolicyTypeD -} - -type unMarshalBgpAttributesSegmentRoutingPolicyTypeD interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeD from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeD - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeD) (BgpAttributesSegmentRoutingPolicyTypeD, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeD from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeD from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeD from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeD { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeD{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeD { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeD{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeD) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeD, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeD) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeD) (BgpAttributesSegmentRoutingPolicyTypeD, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeD) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeD) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeD) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeD) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeD) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeD) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) Clone() (BgpAttributesSegmentRoutingPolicyTypeD, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicyTypeD() - 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 -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) setNil() { - obj.flagsHolder = nil - obj.srMplsSidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSegmentRoutingPolicyTypeD is type D: IPv6 Node Address with optional SID for SR MPLS. -// It is encoded as a Segment of Type 4 in the SEGMENT_LIST sub-tlv. -type BgpAttributesSegmentRoutingPolicyTypeD interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicyTypeD to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeD - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicyTypeD - // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeD from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeD - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeD) BgpAttributesSegmentRoutingPolicyTypeD - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeD - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeD - // validate validates BgpAttributesSegmentRoutingPolicyTypeD - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicyTypeD, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeD. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - Flags() BgpAttributesSegmentRoutingPolicyTypeFlags - // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeD. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeD - // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeD - HasFlags() bool - // SrAlgorithm returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeD. - SrAlgorithm() uint32 - // SetSrAlgorithm assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeD - SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeD - // HasSrAlgorithm checks if SrAlgorithm has been set in BgpAttributesSegmentRoutingPolicyTypeD - HasSrAlgorithm() bool - // Ipv6NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeD. - Ipv6NodeAddress() string - // SetIpv6NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeD - SetIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeD - // HasIpv6NodeAddress checks if Ipv6NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeD - HasIpv6NodeAddress() bool - // SrMplsSid returns BgpAttributesSidMpls, set in BgpAttributesSegmentRoutingPolicyTypeD. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - SrMplsSid() BgpAttributesSidMpls - // SetSrMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesSegmentRoutingPolicyTypeD. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeD - // HasSrMplsSid checks if SrMplsSid has been set in BgpAttributesSegmentRoutingPolicyTypeD - HasSrMplsSid() bool - setNil() -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { - if obj.obj.Flags == nil { - obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) HasFlags() bool { - return obj.obj.Flags != nil -} - -// description is TBD -// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeD object -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeD { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SrAlgorithm returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) SrAlgorithm() uint32 { - - return *obj.obj.SrAlgorithm - -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SrAlgorithm returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) HasSrAlgorithm() bool { - return obj.obj.SrAlgorithm != nil -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SetSrAlgorithm sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeD object -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeD { - - obj.obj.SrAlgorithm = &value - return obj -} - -// IPv6 address representing a node. -// Ipv6NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) Ipv6NodeAddress() string { - - return *obj.obj.Ipv6NodeAddress - -} - -// IPv6 address representing a node. -// Ipv6NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) HasIpv6NodeAddress() bool { - return obj.obj.Ipv6NodeAddress != nil -} - -// IPv6 address representing a node. -// SetIpv6NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeD object -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) SetIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeD { - - obj.obj.Ipv6NodeAddress = &value - return obj -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) SrMplsSid() BgpAttributesSidMpls { - if obj.obj.SrMplsSid == nil { - obj.obj.SrMplsSid = NewBgpAttributesSidMpls().msg() - } - if obj.srMplsSidHolder == nil { - obj.srMplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.SrMplsSid} - } - return obj.srMplsSidHolder -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) HasSrMplsSid() bool { - return obj.obj.SrMplsSid != nil -} - -// Optional SR-MPLS SID. -// SetSrMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesSegmentRoutingPolicyTypeD object -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeD { - - obj.srMplsSidHolder = nil - obj.obj.SrMplsSid = value.msg() - - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.SrAlgorithm != nil { - - if *obj.obj.SrAlgorithm > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicyTypeD.SrAlgorithm <= 255 but Got %d", *obj.obj.SrAlgorithm)) - } - - } - - if obj.obj.Ipv6NodeAddress != nil { - - err := obj.validateIpv6(obj.Ipv6NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeD.Ipv6NodeAddress")) - } - - } - - if obj.obj.SrMplsSid != nil { - - obj.SrMplsSid().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeD) setDefault() { - if obj.obj.SrAlgorithm == nil { - obj.SetSrAlgorithm(0) - } - if obj.obj.Ipv6NodeAddress == nil { - obj.SetIpv6NodeAddress("0::0") - } - -} - -// ***** BgpAttributesSegmentRoutingPolicyTypeE ***** -type bgpAttributesSegmentRoutingPolicyTypeE struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicyTypeE - marshaller marshalBgpAttributesSegmentRoutingPolicyTypeE - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeE - flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags - srMplsSidHolder BgpAttributesSidMpls -} - -func NewBgpAttributesSegmentRoutingPolicyTypeE() BgpAttributesSegmentRoutingPolicyTypeE { - obj := bgpAttributesSegmentRoutingPolicyTypeE{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeE{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeE { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeE) BgpAttributesSegmentRoutingPolicyTypeE { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicyTypeE struct { - obj *bgpAttributesSegmentRoutingPolicyTypeE -} - -type marshalBgpAttributesSegmentRoutingPolicyTypeE interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeE to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeE - ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeE, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeE to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeE to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeE to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicyTypeE struct { - obj *bgpAttributesSegmentRoutingPolicyTypeE -} - -type unMarshalBgpAttributesSegmentRoutingPolicyTypeE interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeE from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeE - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeE) (BgpAttributesSegmentRoutingPolicyTypeE, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeE from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeE from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeE from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeE { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeE{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeE { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeE{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeE) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeE, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeE) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeE) (BgpAttributesSegmentRoutingPolicyTypeE, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeE) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeE) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeE) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeE) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeE) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeE) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) Clone() (BgpAttributesSegmentRoutingPolicyTypeE, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicyTypeE() - 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 -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) setNil() { - obj.flagsHolder = nil - obj.srMplsSidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSegmentRoutingPolicyTypeE is type E: IPv4 Address and Local Interface ID with optional SID -// It is encoded as a Segment of Type 5 in the SEGMENT_LIST sub-tlv. -type BgpAttributesSegmentRoutingPolicyTypeE interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicyTypeE to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeE - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicyTypeE - // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeE from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeE - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeE) BgpAttributesSegmentRoutingPolicyTypeE - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeE - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeE - // validate validates BgpAttributesSegmentRoutingPolicyTypeE - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicyTypeE, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeE. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - Flags() BgpAttributesSegmentRoutingPolicyTypeFlags - // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeE. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeE - // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeE - HasFlags() bool - // LocalInterfaceId returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeE. - LocalInterfaceId() uint32 - // SetLocalInterfaceId assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeE - SetLocalInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeE - // HasLocalInterfaceId checks if LocalInterfaceId has been set in BgpAttributesSegmentRoutingPolicyTypeE - HasLocalInterfaceId() bool - // Ipv4NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeE. - Ipv4NodeAddress() string - // SetIpv4NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeE - SetIpv4NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeE - // HasIpv4NodeAddress checks if Ipv4NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeE - HasIpv4NodeAddress() bool - // SrMplsSid returns BgpAttributesSidMpls, set in BgpAttributesSegmentRoutingPolicyTypeE. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - SrMplsSid() BgpAttributesSidMpls - // SetSrMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesSegmentRoutingPolicyTypeE. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeE - // HasSrMplsSid checks if SrMplsSid has been set in BgpAttributesSegmentRoutingPolicyTypeE - HasSrMplsSid() bool - setNil() -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { - if obj.obj.Flags == nil { - obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) HasFlags() bool { - return obj.obj.Flags != nil -} - -// description is TBD -// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeE object -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeE { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// The Interface Index as defined in [RFC8664]. -// LocalInterfaceId returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) LocalInterfaceId() uint32 { - - return *obj.obj.LocalInterfaceId - -} - -// The Interface Index as defined in [RFC8664]. -// LocalInterfaceId returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) HasLocalInterfaceId() bool { - return obj.obj.LocalInterfaceId != nil -} - -// The Interface Index as defined in [RFC8664]. -// SetLocalInterfaceId sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeE object -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) SetLocalInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeE { - - obj.obj.LocalInterfaceId = &value - return obj -} - -// IPv4 address representing a node. -// Ipv4NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) Ipv4NodeAddress() string { - - return *obj.obj.Ipv4NodeAddress - -} - -// IPv4 address representing a node. -// Ipv4NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) HasIpv4NodeAddress() bool { - return obj.obj.Ipv4NodeAddress != nil -} - -// IPv4 address representing a node. -// SetIpv4NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeE object -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) SetIpv4NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeE { - - obj.obj.Ipv4NodeAddress = &value - return obj -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) SrMplsSid() BgpAttributesSidMpls { - if obj.obj.SrMplsSid == nil { - obj.obj.SrMplsSid = NewBgpAttributesSidMpls().msg() - } - if obj.srMplsSidHolder == nil { - obj.srMplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.SrMplsSid} - } - return obj.srMplsSidHolder -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) HasSrMplsSid() bool { - return obj.obj.SrMplsSid != nil -} - -// Optional SR-MPLS SID. -// SetSrMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesSegmentRoutingPolicyTypeE object -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeE { - - obj.srMplsSidHolder = nil - obj.obj.SrMplsSid = value.msg() - - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.Ipv4NodeAddress != nil { - - err := obj.validateIpv4(obj.Ipv4NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeE.Ipv4NodeAddress")) - } - - } - - if obj.obj.SrMplsSid != nil { - - obj.SrMplsSid().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeE) setDefault() { - if obj.obj.LocalInterfaceId == nil { - obj.SetLocalInterfaceId(0) - } - if obj.obj.Ipv4NodeAddress == nil { - obj.SetIpv4NodeAddress("0.0.0.0") - } - -} - -// ***** BgpAttributesSegmentRoutingPolicyTypeF ***** -type bgpAttributesSegmentRoutingPolicyTypeF struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicyTypeF - marshaller marshalBgpAttributesSegmentRoutingPolicyTypeF - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeF - flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags - srMplsSidHolder BgpAttributesSidMpls -} - -func NewBgpAttributesSegmentRoutingPolicyTypeF() BgpAttributesSegmentRoutingPolicyTypeF { - obj := bgpAttributesSegmentRoutingPolicyTypeF{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeF{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeF { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeF) BgpAttributesSegmentRoutingPolicyTypeF { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicyTypeF struct { - obj *bgpAttributesSegmentRoutingPolicyTypeF -} - -type marshalBgpAttributesSegmentRoutingPolicyTypeF interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeF to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeF - ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeF, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeF to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeF to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeF to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicyTypeF struct { - obj *bgpAttributesSegmentRoutingPolicyTypeF -} - -type unMarshalBgpAttributesSegmentRoutingPolicyTypeF interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeF from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeF - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeF) (BgpAttributesSegmentRoutingPolicyTypeF, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeF from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeF from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeF from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeF { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeF{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeF { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeF{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeF) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeF, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeF) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeF) (BgpAttributesSegmentRoutingPolicyTypeF, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeF) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeF) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeF) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeF) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeF) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeF) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) Clone() (BgpAttributesSegmentRoutingPolicyTypeF, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicyTypeF() - 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 -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) setNil() { - obj.flagsHolder = nil - obj.srMplsSidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSegmentRoutingPolicyTypeF is type F: IPv4 Local and Remote addresses with optional SR-MPLS SID. -// It is encoded as a Segment of Type 6 in the SEGMENT_LIST sub-tlv. -type BgpAttributesSegmentRoutingPolicyTypeF interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicyTypeF to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeF - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicyTypeF - // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeF from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeF - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeF) BgpAttributesSegmentRoutingPolicyTypeF - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeF - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeF - // validate validates BgpAttributesSegmentRoutingPolicyTypeF - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicyTypeF, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeF. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - Flags() BgpAttributesSegmentRoutingPolicyTypeFlags - // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeF. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeF - // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeF - HasFlags() bool - // LocalIpv4Address returns string, set in BgpAttributesSegmentRoutingPolicyTypeF. - LocalIpv4Address() string - // SetLocalIpv4Address assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeF - SetLocalIpv4Address(value string) BgpAttributesSegmentRoutingPolicyTypeF - // HasLocalIpv4Address checks if LocalIpv4Address has been set in BgpAttributesSegmentRoutingPolicyTypeF - HasLocalIpv4Address() bool - // RemoteIpv4Address returns string, set in BgpAttributesSegmentRoutingPolicyTypeF. - RemoteIpv4Address() string - // SetRemoteIpv4Address assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeF - SetRemoteIpv4Address(value string) BgpAttributesSegmentRoutingPolicyTypeF - // HasRemoteIpv4Address checks if RemoteIpv4Address has been set in BgpAttributesSegmentRoutingPolicyTypeF - HasRemoteIpv4Address() bool - // SrMplsSid returns BgpAttributesSidMpls, set in BgpAttributesSegmentRoutingPolicyTypeF. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - SrMplsSid() BgpAttributesSidMpls - // SetSrMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesSegmentRoutingPolicyTypeF. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeF - // HasSrMplsSid checks if SrMplsSid has been set in BgpAttributesSegmentRoutingPolicyTypeF - HasSrMplsSid() bool - setNil() -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { - if obj.obj.Flags == nil { - obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) HasFlags() bool { - return obj.obj.Flags != nil -} - -// description is TBD -// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeF object -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeF { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// Local IPv4 Address. -// LocalIpv4Address returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) LocalIpv4Address() string { - - return *obj.obj.LocalIpv4Address - -} - -// Local IPv4 Address. -// LocalIpv4Address returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) HasLocalIpv4Address() bool { - return obj.obj.LocalIpv4Address != nil -} - -// Local IPv4 Address. -// SetLocalIpv4Address sets the string value in the BgpAttributesSegmentRoutingPolicyTypeF object -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) SetLocalIpv4Address(value string) BgpAttributesSegmentRoutingPolicyTypeF { - - obj.obj.LocalIpv4Address = &value - return obj -} - -// Remote IPv4 Address. -// RemoteIpv4Address returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) RemoteIpv4Address() string { - - return *obj.obj.RemoteIpv4Address - -} - -// Remote IPv4 Address. -// RemoteIpv4Address returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) HasRemoteIpv4Address() bool { - return obj.obj.RemoteIpv4Address != nil -} - -// Remote IPv4 Address. -// SetRemoteIpv4Address sets the string value in the BgpAttributesSegmentRoutingPolicyTypeF object -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) SetRemoteIpv4Address(value string) BgpAttributesSegmentRoutingPolicyTypeF { - - obj.obj.RemoteIpv4Address = &value - return obj -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) SrMplsSid() BgpAttributesSidMpls { - if obj.obj.SrMplsSid == nil { - obj.obj.SrMplsSid = NewBgpAttributesSidMpls().msg() - } - if obj.srMplsSidHolder == nil { - obj.srMplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.SrMplsSid} - } - return obj.srMplsSidHolder -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) HasSrMplsSid() bool { - return obj.obj.SrMplsSid != nil -} - -// Optional SR-MPLS SID. -// SetSrMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesSegmentRoutingPolicyTypeF object -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeF { - - obj.srMplsSidHolder = nil - obj.obj.SrMplsSid = value.msg() - - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.LocalIpv4Address != nil { - - err := obj.validateIpv4(obj.LocalIpv4Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeF.LocalIpv4Address")) - } - - } - - if obj.obj.RemoteIpv4Address != nil { - - err := obj.validateIpv4(obj.RemoteIpv4Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeF.RemoteIpv4Address")) - } - - } - - if obj.obj.SrMplsSid != nil { - - obj.SrMplsSid().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeF) setDefault() { - if obj.obj.LocalIpv4Address == nil { - obj.SetLocalIpv4Address("0.0.0.0") - } - if obj.obj.RemoteIpv4Address == nil { - obj.SetRemoteIpv4Address("0.0.0.0") - } - -} - -// ***** BgpAttributesSegmentRoutingPolicyTypeG ***** -type bgpAttributesSegmentRoutingPolicyTypeG struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicyTypeG - marshaller marshalBgpAttributesSegmentRoutingPolicyTypeG - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeG - flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags - srMplsSidHolder BgpAttributesSidMpls -} - -func NewBgpAttributesSegmentRoutingPolicyTypeG() BgpAttributesSegmentRoutingPolicyTypeG { - obj := bgpAttributesSegmentRoutingPolicyTypeG{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeG{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeG { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeG) BgpAttributesSegmentRoutingPolicyTypeG { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicyTypeG struct { - obj *bgpAttributesSegmentRoutingPolicyTypeG -} - -type marshalBgpAttributesSegmentRoutingPolicyTypeG interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeG to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeG - ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeG, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeG to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeG to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeG to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicyTypeG struct { - obj *bgpAttributesSegmentRoutingPolicyTypeG -} - -type unMarshalBgpAttributesSegmentRoutingPolicyTypeG interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeG from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeG - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeG) (BgpAttributesSegmentRoutingPolicyTypeG, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeG from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeG from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeG from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeG { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeG{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeG { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeG{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeG) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeG, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeG) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeG) (BgpAttributesSegmentRoutingPolicyTypeG, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeG) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeG) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeG) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeG) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeG) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeG) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) Clone() (BgpAttributesSegmentRoutingPolicyTypeG, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicyTypeG() - 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 -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) setNil() { - obj.flagsHolder = nil - obj.srMplsSidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSegmentRoutingPolicyTypeG is type G: IPv6 Address, Interface ID for local and remote pair with optional SID for SR MPLS. -// It is encoded as a Segment of Type 7 in the SEGMENT_LIST sub-tlv. -type BgpAttributesSegmentRoutingPolicyTypeG interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicyTypeG to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeG - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicyTypeG - // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeG from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeG - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeG) BgpAttributesSegmentRoutingPolicyTypeG - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeG - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeG - // validate validates BgpAttributesSegmentRoutingPolicyTypeG - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicyTypeG, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeG. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - Flags() BgpAttributesSegmentRoutingPolicyTypeFlags - // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeG. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeG - // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeG - HasFlags() bool - // LocalInterfaceId returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeG. - LocalInterfaceId() uint32 - // SetLocalInterfaceId assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeG - SetLocalInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeG - // HasLocalInterfaceId checks if LocalInterfaceId has been set in BgpAttributesSegmentRoutingPolicyTypeG - HasLocalInterfaceId() bool - // LocalIpv6NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeG. - LocalIpv6NodeAddress() string - // SetLocalIpv6NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeG - SetLocalIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeG - // HasLocalIpv6NodeAddress checks if LocalIpv6NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeG - HasLocalIpv6NodeAddress() bool - // RemoteInterfaceId returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeG. - RemoteInterfaceId() uint32 - // SetRemoteInterfaceId assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeG - SetRemoteInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeG - // HasRemoteInterfaceId checks if RemoteInterfaceId has been set in BgpAttributesSegmentRoutingPolicyTypeG - HasRemoteInterfaceId() bool - // RemoteIpv6NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeG. - RemoteIpv6NodeAddress() string - // SetRemoteIpv6NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeG - SetRemoteIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeG - // HasRemoteIpv6NodeAddress checks if RemoteIpv6NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeG - HasRemoteIpv6NodeAddress() bool - // SrMplsSid returns BgpAttributesSidMpls, set in BgpAttributesSegmentRoutingPolicyTypeG. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - SrMplsSid() BgpAttributesSidMpls - // SetSrMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesSegmentRoutingPolicyTypeG. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeG - // HasSrMplsSid checks if SrMplsSid has been set in BgpAttributesSegmentRoutingPolicyTypeG - HasSrMplsSid() bool - setNil() -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { - if obj.obj.Flags == nil { - obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) HasFlags() bool { - return obj.obj.Flags != nil -} - -// description is TBD -// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeG object -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeG { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// The local Interface Index as defined in [RFC8664]. -// LocalInterfaceId returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) LocalInterfaceId() uint32 { - - return *obj.obj.LocalInterfaceId - -} - -// The local Interface Index as defined in [RFC8664]. -// LocalInterfaceId returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) HasLocalInterfaceId() bool { - return obj.obj.LocalInterfaceId != nil -} - -// The local Interface Index as defined in [RFC8664]. -// SetLocalInterfaceId sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeG object -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) SetLocalInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeG { - - obj.obj.LocalInterfaceId = &value - return obj -} - -// The IPv6 address representing the local node. -// LocalIpv6NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) LocalIpv6NodeAddress() string { - - return *obj.obj.LocalIpv6NodeAddress - -} - -// The IPv6 address representing the local node. -// LocalIpv6NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) HasLocalIpv6NodeAddress() bool { - return obj.obj.LocalIpv6NodeAddress != nil -} - -// The IPv6 address representing the local node. -// SetLocalIpv6NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeG object -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) SetLocalIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeG { - - obj.obj.LocalIpv6NodeAddress = &value - return obj -} - -// The remote Interface Index as defined in [RFC8664]. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. -// RemoteInterfaceId returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) RemoteInterfaceId() uint32 { - - return *obj.obj.RemoteInterfaceId - -} - -// The remote Interface Index as defined in [RFC8664]. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. -// RemoteInterfaceId returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) HasRemoteInterfaceId() bool { - return obj.obj.RemoteInterfaceId != nil -} - -// The remote Interface Index as defined in [RFC8664]. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. -// SetRemoteInterfaceId sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeG object -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) SetRemoteInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeG { - - obj.obj.RemoteInterfaceId = &value - return obj -} - -// IPv6 address representing the remote node. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. -// RemoteIpv6NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) RemoteIpv6NodeAddress() string { - - return *obj.obj.RemoteIpv6NodeAddress - -} - -// IPv6 address representing the remote node. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. -// RemoteIpv6NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) HasRemoteIpv6NodeAddress() bool { - return obj.obj.RemoteIpv6NodeAddress != nil -} - -// IPv6 address representing the remote node. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. -// SetRemoteIpv6NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeG object -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) SetRemoteIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeG { - - obj.obj.RemoteIpv6NodeAddress = &value - return obj -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) SrMplsSid() BgpAttributesSidMpls { - if obj.obj.SrMplsSid == nil { - obj.obj.SrMplsSid = NewBgpAttributesSidMpls().msg() - } - if obj.srMplsSidHolder == nil { - obj.srMplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.SrMplsSid} - } - return obj.srMplsSidHolder -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) HasSrMplsSid() bool { - return obj.obj.SrMplsSid != nil -} - -// Optional SR-MPLS SID. -// SetSrMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesSegmentRoutingPolicyTypeG object -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeG { - - obj.srMplsSidHolder = nil - obj.obj.SrMplsSid = value.msg() - - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.LocalIpv6NodeAddress != nil { - - err := obj.validateIpv6(obj.LocalIpv6NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeG.LocalIpv6NodeAddress")) - } - - } - - if obj.obj.RemoteIpv6NodeAddress != nil { - - err := obj.validateIpv6(obj.RemoteIpv6NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeG.RemoteIpv6NodeAddress")) - } - - } - - if obj.obj.SrMplsSid != nil { - - obj.SrMplsSid().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeG) setDefault() { - if obj.obj.LocalInterfaceId == nil { - obj.SetLocalInterfaceId(0) - } - if obj.obj.LocalIpv6NodeAddress == nil { - obj.SetLocalIpv6NodeAddress("0::0") - } - if obj.obj.RemoteInterfaceId == nil { - obj.SetRemoteInterfaceId(0) - } - if obj.obj.RemoteIpv6NodeAddress == nil { - obj.SetRemoteIpv6NodeAddress("0::0") - } - -} - -// ***** BgpAttributesSegmentRoutingPolicyTypeH ***** -type bgpAttributesSegmentRoutingPolicyTypeH struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicyTypeH - marshaller marshalBgpAttributesSegmentRoutingPolicyTypeH - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeH - flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags - srMplsSidHolder BgpAttributesSidMpls -} - -func NewBgpAttributesSegmentRoutingPolicyTypeH() BgpAttributesSegmentRoutingPolicyTypeH { - obj := bgpAttributesSegmentRoutingPolicyTypeH{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeH{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeH { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeH) BgpAttributesSegmentRoutingPolicyTypeH { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicyTypeH struct { - obj *bgpAttributesSegmentRoutingPolicyTypeH -} - -type marshalBgpAttributesSegmentRoutingPolicyTypeH interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeH to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeH - ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeH, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeH to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeH to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeH to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicyTypeH struct { - obj *bgpAttributesSegmentRoutingPolicyTypeH -} - -type unMarshalBgpAttributesSegmentRoutingPolicyTypeH interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeH from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeH - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeH) (BgpAttributesSegmentRoutingPolicyTypeH, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeH from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeH from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeH from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeH { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeH{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeH { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeH{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeH) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeH, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeH) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeH) (BgpAttributesSegmentRoutingPolicyTypeH, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeH) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeH) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeH) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeH) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeH) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeH) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) Clone() (BgpAttributesSegmentRoutingPolicyTypeH, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicyTypeH() - 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 -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) setNil() { - obj.flagsHolder = nil - obj.srMplsSidHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSegmentRoutingPolicyTypeH is type H: IPv6 Local and Remote addresses with optional SID for SR MPLS. -// It is encoded as a Segment of Type 8 in the SEGMENT_LIST sub-tlv. -type BgpAttributesSegmentRoutingPolicyTypeH interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicyTypeH to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeH - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicyTypeH - // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeH from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeH - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeH) BgpAttributesSegmentRoutingPolicyTypeH - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeH - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeH - // validate validates BgpAttributesSegmentRoutingPolicyTypeH - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicyTypeH, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeH. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - Flags() BgpAttributesSegmentRoutingPolicyTypeFlags - // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeH. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeH - // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeH - HasFlags() bool - // LocalIpv6Address returns string, set in BgpAttributesSegmentRoutingPolicyTypeH. - LocalIpv6Address() string - // SetLocalIpv6Address assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeH - SetLocalIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeH - // HasLocalIpv6Address checks if LocalIpv6Address has been set in BgpAttributesSegmentRoutingPolicyTypeH - HasLocalIpv6Address() bool - // RemoteIpv6Address returns string, set in BgpAttributesSegmentRoutingPolicyTypeH. - RemoteIpv6Address() string - // SetRemoteIpv6Address assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeH - SetRemoteIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeH - // HasRemoteIpv6Address checks if RemoteIpv6Address has been set in BgpAttributesSegmentRoutingPolicyTypeH - HasRemoteIpv6Address() bool - // SrMplsSid returns BgpAttributesSidMpls, set in BgpAttributesSegmentRoutingPolicyTypeH. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - SrMplsSid() BgpAttributesSidMpls - // SetSrMplsSid assigns BgpAttributesSidMpls provided by user to BgpAttributesSegmentRoutingPolicyTypeH. - // BgpAttributesSidMpls is this carries a 20 bit Multi Protocol Label Switching alongwith 3 bits traffic class, 1 bit indicating presence - // or absence of Bottom-Of-Stack and 8 bits carrying the Time to Live value. - SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeH - // HasSrMplsSid checks if SrMplsSid has been set in BgpAttributesSegmentRoutingPolicyTypeH - HasSrMplsSid() bool - setNil() -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { - if obj.obj.Flags == nil { - obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) HasFlags() bool { - return obj.obj.Flags != nil -} - -// description is TBD -// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeH object -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeH { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// Local IPv6 Address. -// LocalIpv6Address returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) LocalIpv6Address() string { - - return *obj.obj.LocalIpv6Address - -} - -// Local IPv6 Address. -// LocalIpv6Address returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) HasLocalIpv6Address() bool { - return obj.obj.LocalIpv6Address != nil -} - -// Local IPv6 Address. -// SetLocalIpv6Address sets the string value in the BgpAttributesSegmentRoutingPolicyTypeH object -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) SetLocalIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeH { - - obj.obj.LocalIpv6Address = &value - return obj -} - -// Remote IPv6 Address. -// RemoteIpv6Address returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) RemoteIpv6Address() string { - - return *obj.obj.RemoteIpv6Address - -} - -// Remote IPv6 Address. -// RemoteIpv6Address returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) HasRemoteIpv6Address() bool { - return obj.obj.RemoteIpv6Address != nil -} - -// Remote IPv6 Address. -// SetRemoteIpv6Address sets the string value in the BgpAttributesSegmentRoutingPolicyTypeH object -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) SetRemoteIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeH { - - obj.obj.RemoteIpv6Address = &value - return obj -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) SrMplsSid() BgpAttributesSidMpls { - if obj.obj.SrMplsSid == nil { - obj.obj.SrMplsSid = NewBgpAttributesSidMpls().msg() - } - if obj.srMplsSidHolder == nil { - obj.srMplsSidHolder = &bgpAttributesSidMpls{obj: obj.obj.SrMplsSid} - } - return obj.srMplsSidHolder -} - -// Optional SR-MPLS SID. -// SrMplsSid returns a BgpAttributesSidMpls -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) HasSrMplsSid() bool { - return obj.obj.SrMplsSid != nil -} - -// Optional SR-MPLS SID. -// SetSrMplsSid sets the BgpAttributesSidMpls value in the BgpAttributesSegmentRoutingPolicyTypeH object -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) SetSrMplsSid(value BgpAttributesSidMpls) BgpAttributesSegmentRoutingPolicyTypeH { - - obj.srMplsSidHolder = nil - obj.obj.SrMplsSid = value.msg() - - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.LocalIpv6Address != nil { - - err := obj.validateIpv6(obj.LocalIpv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeH.LocalIpv6Address")) - } - - } - - if obj.obj.RemoteIpv6Address != nil { - - err := obj.validateIpv6(obj.RemoteIpv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeH.RemoteIpv6Address")) - } - - } - - if obj.obj.SrMplsSid != nil { - - obj.SrMplsSid().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeH) setDefault() { - if obj.obj.LocalIpv6Address == nil { - obj.SetLocalIpv6Address("0::0") - } - if obj.obj.RemoteIpv6Address == nil { - obj.SetRemoteIpv6Address("0::0") - } - -} - -// ***** BgpAttributesSegmentRoutingPolicyTypeI ***** -type bgpAttributesSegmentRoutingPolicyTypeI struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicyTypeI - marshaller marshalBgpAttributesSegmentRoutingPolicyTypeI - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeI - flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags - srv6SidHolder BgpAttributesSidSrv6 - srv6EndpointBehaviorHolder BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -} - -func NewBgpAttributesSegmentRoutingPolicyTypeI() BgpAttributesSegmentRoutingPolicyTypeI { - obj := bgpAttributesSegmentRoutingPolicyTypeI{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeI{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeI { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeI) BgpAttributesSegmentRoutingPolicyTypeI { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicyTypeI struct { - obj *bgpAttributesSegmentRoutingPolicyTypeI -} - -type marshalBgpAttributesSegmentRoutingPolicyTypeI interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeI to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeI - ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeI, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeI to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeI to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeI to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicyTypeI struct { - obj *bgpAttributesSegmentRoutingPolicyTypeI -} - -type unMarshalBgpAttributesSegmentRoutingPolicyTypeI interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeI from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeI - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeI) (BgpAttributesSegmentRoutingPolicyTypeI, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeI from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeI from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeI from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeI { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeI{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeI { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeI{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeI) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeI, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeI) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeI) (BgpAttributesSegmentRoutingPolicyTypeI, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeI) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeI) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeI) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeI) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeI) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeI) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) Clone() (BgpAttributesSegmentRoutingPolicyTypeI, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicyTypeI() - 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 -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) setNil() { - obj.flagsHolder = nil - obj.srv6SidHolder = nil - obj.srv6EndpointBehaviorHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSegmentRoutingPolicyTypeI is type I: IPv6 Node Address with optional SR Algorithm and optional SRv6 SID. -// It is encoded as a Segment of Type 14 in the SEGMENT_LIST sub-tlv. -type BgpAttributesSegmentRoutingPolicyTypeI interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicyTypeI to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeI - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicyTypeI - // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeI from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeI - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeI) BgpAttributesSegmentRoutingPolicyTypeI - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeI - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeI - // validate validates BgpAttributesSegmentRoutingPolicyTypeI - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicyTypeI, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeI. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - Flags() BgpAttributesSegmentRoutingPolicyTypeFlags - // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeI. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeI - // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeI - HasFlags() bool - // SrAlgorithm returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeI. - SrAlgorithm() uint32 - // SetSrAlgorithm assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeI - SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeI - // HasSrAlgorithm checks if SrAlgorithm has been set in BgpAttributesSegmentRoutingPolicyTypeI - HasSrAlgorithm() bool - // Ipv6NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeI. - Ipv6NodeAddress() string - // SetIpv6NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeI - SetIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeI - // HasIpv6NodeAddress checks if Ipv6NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeI - HasIpv6NodeAddress() bool - // Srv6Sid returns BgpAttributesSidSrv6, set in BgpAttributesSegmentRoutingPolicyTypeI. - // BgpAttributesSidSrv6 is an IPv6 address denoting a SRv6 SID. - Srv6Sid() BgpAttributesSidSrv6 - // SetSrv6Sid assigns BgpAttributesSidSrv6 provided by user to BgpAttributesSegmentRoutingPolicyTypeI. - // BgpAttributesSidSrv6 is an IPv6 address denoting a SRv6 SID. - SetSrv6Sid(value BgpAttributesSidSrv6) BgpAttributesSegmentRoutingPolicyTypeI - // HasSrv6Sid checks if Srv6Sid has been set in BgpAttributesSegmentRoutingPolicyTypeI - HasSrv6Sid() bool - // Srv6EndpointBehavior returns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, set in BgpAttributesSegmentRoutingPolicyTypeI. - // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 - Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // SetSrv6EndpointBehavior assigns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure provided by user to BgpAttributesSegmentRoutingPolicyTypeI. - // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 - SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeI - // HasSrv6EndpointBehavior checks if Srv6EndpointBehavior has been set in BgpAttributesSegmentRoutingPolicyTypeI - HasSrv6EndpointBehavior() bool - setNil() -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { - if obj.obj.Flags == nil { - obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) HasFlags() bool { - return obj.obj.Flags != nil -} - -// description is TBD -// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeI object -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeI { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SrAlgorithm returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) SrAlgorithm() uint32 { - - return *obj.obj.SrAlgorithm - -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SrAlgorithm returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) HasSrAlgorithm() bool { - return obj.obj.SrAlgorithm != nil -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SetSrAlgorithm sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeI object -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeI { - - obj.obj.SrAlgorithm = &value - return obj -} - -// IPv6 address representing a node. -// Ipv6NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) Ipv6NodeAddress() string { - - return *obj.obj.Ipv6NodeAddress - -} - -// IPv6 address representing a node. -// Ipv6NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) HasIpv6NodeAddress() bool { - return obj.obj.Ipv6NodeAddress != nil -} - -// IPv6 address representing a node. -// SetIpv6NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeI object -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) SetIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeI { - - obj.obj.Ipv6NodeAddress = &value - return obj -} - -// description is TBD -// Srv6Sid returns a BgpAttributesSidSrv6 -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) Srv6Sid() BgpAttributesSidSrv6 { - if obj.obj.Srv6Sid == nil { - obj.obj.Srv6Sid = NewBgpAttributesSidSrv6().msg() - } - if obj.srv6SidHolder == nil { - obj.srv6SidHolder = &bgpAttributesSidSrv6{obj: obj.obj.Srv6Sid} - } - return obj.srv6SidHolder -} - -// description is TBD -// Srv6Sid returns a BgpAttributesSidSrv6 -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) HasSrv6Sid() bool { - return obj.obj.Srv6Sid != nil -} - -// description is TBD -// SetSrv6Sid sets the BgpAttributesSidSrv6 value in the BgpAttributesSegmentRoutingPolicyTypeI object -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) SetSrv6Sid(value BgpAttributesSidSrv6) BgpAttributesSegmentRoutingPolicyTypeI { - - obj.srv6SidHolder = nil - obj.obj.Srv6Sid = value.msg() - - return obj -} - -// description is TBD -// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - if obj.obj.Srv6EndpointBehavior == nil { - obj.obj.Srv6EndpointBehavior = NewBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure().msg() - } - if obj.srv6EndpointBehaviorHolder == nil { - obj.srv6EndpointBehaviorHolder = &bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6EndpointBehavior} - } - return obj.srv6EndpointBehaviorHolder -} - -// description is TBD -// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) HasSrv6EndpointBehavior() bool { - return obj.obj.Srv6EndpointBehavior != nil -} - -// description is TBD -// SetSrv6EndpointBehavior sets the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure value in the BgpAttributesSegmentRoutingPolicyTypeI object -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeI { - - obj.srv6EndpointBehaviorHolder = nil - obj.obj.Srv6EndpointBehavior = value.msg() - - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.SrAlgorithm != nil { - - if *obj.obj.SrAlgorithm > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicyTypeI.SrAlgorithm <= 255 but Got %d", *obj.obj.SrAlgorithm)) - } - - } - - if obj.obj.Ipv6NodeAddress != nil { - - err := obj.validateIpv6(obj.Ipv6NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeI.Ipv6NodeAddress")) - } - - } - - if obj.obj.Srv6Sid != nil { - - obj.Srv6Sid().validateObj(vObj, set_default) - } - - if obj.obj.Srv6EndpointBehavior != nil { - - obj.Srv6EndpointBehavior().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeI) setDefault() { - if obj.obj.SrAlgorithm == nil { - obj.SetSrAlgorithm(0) - } - if obj.obj.Ipv6NodeAddress == nil { - obj.SetIpv6NodeAddress("0::0") - } - -} - -// ***** BgpAttributesSegmentRoutingPolicyTypeJ ***** -type bgpAttributesSegmentRoutingPolicyTypeJ struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicyTypeJ - marshaller marshalBgpAttributesSegmentRoutingPolicyTypeJ - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeJ - flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags - srv6SidHolder BgpAttributesSidSrv6 - srv6EndpointBehaviorHolder BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -} - -func NewBgpAttributesSegmentRoutingPolicyTypeJ() BgpAttributesSegmentRoutingPolicyTypeJ { - obj := bgpAttributesSegmentRoutingPolicyTypeJ{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeJ{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeJ { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeJ) BgpAttributesSegmentRoutingPolicyTypeJ { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicyTypeJ struct { - obj *bgpAttributesSegmentRoutingPolicyTypeJ -} - -type marshalBgpAttributesSegmentRoutingPolicyTypeJ interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeJ to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeJ - ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeJ, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeJ to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeJ to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeJ to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicyTypeJ struct { - obj *bgpAttributesSegmentRoutingPolicyTypeJ -} - -type unMarshalBgpAttributesSegmentRoutingPolicyTypeJ interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeJ from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeJ - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeJ) (BgpAttributesSegmentRoutingPolicyTypeJ, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeJ from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeJ from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeJ from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeJ { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeJ{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeJ { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeJ{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeJ) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeJ, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeJ) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeJ) (BgpAttributesSegmentRoutingPolicyTypeJ, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeJ) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeJ) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeJ) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeJ) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeJ) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeJ) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) Clone() (BgpAttributesSegmentRoutingPolicyTypeJ, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicyTypeJ() - 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 -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) setNil() { - obj.flagsHolder = nil - obj.srv6SidHolder = nil - obj.srv6EndpointBehaviorHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSegmentRoutingPolicyTypeJ is type J: IPv6 Address, Interface ID for local and remote pair for SRv6 with optional SID. -// It is encoded as a Segment of Type 15 in the SEGMENT_LIST sub-tlv. -type BgpAttributesSegmentRoutingPolicyTypeJ interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicyTypeJ to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeJ - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicyTypeJ - // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeJ from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeJ - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeJ) BgpAttributesSegmentRoutingPolicyTypeJ - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeJ - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeJ - // validate validates BgpAttributesSegmentRoutingPolicyTypeJ - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicyTypeJ, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeJ. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - Flags() BgpAttributesSegmentRoutingPolicyTypeFlags - // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeJ. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeJ - // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeJ - HasFlags() bool - // SrAlgorithm returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeJ. - SrAlgorithm() uint32 - // SetSrAlgorithm assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeJ - SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeJ - // HasSrAlgorithm checks if SrAlgorithm has been set in BgpAttributesSegmentRoutingPolicyTypeJ - HasSrAlgorithm() bool - // LocalInterfaceId returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeJ. - LocalInterfaceId() uint32 - // SetLocalInterfaceId assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeJ - SetLocalInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeJ - // HasLocalInterfaceId checks if LocalInterfaceId has been set in BgpAttributesSegmentRoutingPolicyTypeJ - HasLocalInterfaceId() bool - // LocalIpv6NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeJ. - LocalIpv6NodeAddress() string - // SetLocalIpv6NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeJ - SetLocalIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeJ - // HasLocalIpv6NodeAddress checks if LocalIpv6NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeJ - HasLocalIpv6NodeAddress() bool - // RemoteInterfaceId returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeJ. - RemoteInterfaceId() uint32 - // SetRemoteInterfaceId assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeJ - SetRemoteInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeJ - // HasRemoteInterfaceId checks if RemoteInterfaceId has been set in BgpAttributesSegmentRoutingPolicyTypeJ - HasRemoteInterfaceId() bool - // RemoteIpv6NodeAddress returns string, set in BgpAttributesSegmentRoutingPolicyTypeJ. - RemoteIpv6NodeAddress() string - // SetRemoteIpv6NodeAddress assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeJ - SetRemoteIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeJ - // HasRemoteIpv6NodeAddress checks if RemoteIpv6NodeAddress has been set in BgpAttributesSegmentRoutingPolicyTypeJ - HasRemoteIpv6NodeAddress() bool - // Srv6Sid returns BgpAttributesSidSrv6, set in BgpAttributesSegmentRoutingPolicyTypeJ. - // BgpAttributesSidSrv6 is an IPv6 address denoting a SRv6 SID. - Srv6Sid() BgpAttributesSidSrv6 - // SetSrv6Sid assigns BgpAttributesSidSrv6 provided by user to BgpAttributesSegmentRoutingPolicyTypeJ. - // BgpAttributesSidSrv6 is an IPv6 address denoting a SRv6 SID. - SetSrv6Sid(value BgpAttributesSidSrv6) BgpAttributesSegmentRoutingPolicyTypeJ - // HasSrv6Sid checks if Srv6Sid has been set in BgpAttributesSegmentRoutingPolicyTypeJ - HasSrv6Sid() bool - // Srv6EndpointBehavior returns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, set in BgpAttributesSegmentRoutingPolicyTypeJ. - // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 - Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // SetSrv6EndpointBehavior assigns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure provided by user to BgpAttributesSegmentRoutingPolicyTypeJ. - // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 - SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeJ - // HasSrv6EndpointBehavior checks if Srv6EndpointBehavior has been set in BgpAttributesSegmentRoutingPolicyTypeJ - HasSrv6EndpointBehavior() bool - setNil() -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { - if obj.obj.Flags == nil { - obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasFlags() bool { - return obj.obj.Flags != nil -} - -// description is TBD -// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeJ object -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeJ { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SrAlgorithm returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SrAlgorithm() uint32 { - - return *obj.obj.SrAlgorithm - -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SrAlgorithm returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasSrAlgorithm() bool { - return obj.obj.SrAlgorithm != nil -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SetSrAlgorithm sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeJ object -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeJ { - - obj.obj.SrAlgorithm = &value - return obj -} - -// The local Interface Index as defined in [RFC8664]. -// LocalInterfaceId returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) LocalInterfaceId() uint32 { - - return *obj.obj.LocalInterfaceId - -} - -// The local Interface Index as defined in [RFC8664]. -// LocalInterfaceId returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasLocalInterfaceId() bool { - return obj.obj.LocalInterfaceId != nil -} - -// The local Interface Index as defined in [RFC8664]. -// SetLocalInterfaceId sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeJ object -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetLocalInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeJ { - - obj.obj.LocalInterfaceId = &value - return obj -} - -// The IPv6 address representing the local node. -// LocalIpv6NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) LocalIpv6NodeAddress() string { - - return *obj.obj.LocalIpv6NodeAddress - -} - -// The IPv6 address representing the local node. -// LocalIpv6NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasLocalIpv6NodeAddress() bool { - return obj.obj.LocalIpv6NodeAddress != nil -} - -// The IPv6 address representing the local node. -// SetLocalIpv6NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeJ object -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetLocalIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeJ { - - obj.obj.LocalIpv6NodeAddress = &value - return obj -} - -// The remote Interface Index as defined in [RFC8664]. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. -// RemoteInterfaceId returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) RemoteInterfaceId() uint32 { - - return *obj.obj.RemoteInterfaceId - -} - -// The remote Interface Index as defined in [RFC8664]. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. -// RemoteInterfaceId returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasRemoteInterfaceId() bool { - return obj.obj.RemoteInterfaceId != nil -} - -// The remote Interface Index as defined in [RFC8664]. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. -// SetRemoteInterfaceId sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeJ object -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetRemoteInterfaceId(value uint32) BgpAttributesSegmentRoutingPolicyTypeJ { - - obj.obj.RemoteInterfaceId = &value - return obj -} - -// IPv6 address representing the remote node. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. -// RemoteIpv6NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) RemoteIpv6NodeAddress() string { - - return *obj.obj.RemoteIpv6NodeAddress - -} - -// IPv6 address representing the remote node. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. -// RemoteIpv6NodeAddress returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasRemoteIpv6NodeAddress() bool { - return obj.obj.RemoteIpv6NodeAddress != nil -} - -// IPv6 address representing the remote node. The value MAY be set to zero when the local node address and interface identifiers are sufficient to describe the link. -// SetRemoteIpv6NodeAddress sets the string value in the BgpAttributesSegmentRoutingPolicyTypeJ object -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetRemoteIpv6NodeAddress(value string) BgpAttributesSegmentRoutingPolicyTypeJ { - - obj.obj.RemoteIpv6NodeAddress = &value - return obj -} - -// description is TBD -// Srv6Sid returns a BgpAttributesSidSrv6 -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) Srv6Sid() BgpAttributesSidSrv6 { - if obj.obj.Srv6Sid == nil { - obj.obj.Srv6Sid = NewBgpAttributesSidSrv6().msg() - } - if obj.srv6SidHolder == nil { - obj.srv6SidHolder = &bgpAttributesSidSrv6{obj: obj.obj.Srv6Sid} - } - return obj.srv6SidHolder -} - -// description is TBD -// Srv6Sid returns a BgpAttributesSidSrv6 -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasSrv6Sid() bool { - return obj.obj.Srv6Sid != nil -} - -// description is TBD -// SetSrv6Sid sets the BgpAttributesSidSrv6 value in the BgpAttributesSegmentRoutingPolicyTypeJ object -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetSrv6Sid(value BgpAttributesSidSrv6) BgpAttributesSegmentRoutingPolicyTypeJ { - - obj.srv6SidHolder = nil - obj.obj.Srv6Sid = value.msg() - - return obj -} - -// description is TBD -// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - if obj.obj.Srv6EndpointBehavior == nil { - obj.obj.Srv6EndpointBehavior = NewBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure().msg() - } - if obj.srv6EndpointBehaviorHolder == nil { - obj.srv6EndpointBehaviorHolder = &bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6EndpointBehavior} - } - return obj.srv6EndpointBehaviorHolder -} - -// description is TBD -// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) HasSrv6EndpointBehavior() bool { - return obj.obj.Srv6EndpointBehavior != nil -} - -// description is TBD -// SetSrv6EndpointBehavior sets the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure value in the BgpAttributesSegmentRoutingPolicyTypeJ object -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeJ { - - obj.srv6EndpointBehaviorHolder = nil - obj.obj.Srv6EndpointBehavior = value.msg() - - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.SrAlgorithm != nil { - - if *obj.obj.SrAlgorithm > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicyTypeJ.SrAlgorithm <= 255 but Got %d", *obj.obj.SrAlgorithm)) - } - - } - - if obj.obj.LocalIpv6NodeAddress != nil { - - err := obj.validateIpv6(obj.LocalIpv6NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeJ.LocalIpv6NodeAddress")) - } - - } - - if obj.obj.RemoteIpv6NodeAddress != nil { - - err := obj.validateIpv6(obj.RemoteIpv6NodeAddress()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeJ.RemoteIpv6NodeAddress")) - } - - } - - if obj.obj.Srv6Sid != nil { - - obj.Srv6Sid().validateObj(vObj, set_default) - } - - if obj.obj.Srv6EndpointBehavior != nil { - - obj.Srv6EndpointBehavior().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeJ) setDefault() { - if obj.obj.SrAlgorithm == nil { - obj.SetSrAlgorithm(0) - } - if obj.obj.LocalInterfaceId == nil { - obj.SetLocalInterfaceId(0) - } - if obj.obj.LocalIpv6NodeAddress == nil { - obj.SetLocalIpv6NodeAddress("0::0") - } - if obj.obj.RemoteInterfaceId == nil { - obj.SetRemoteInterfaceId(0) - } - if obj.obj.RemoteIpv6NodeAddress == nil { - obj.SetRemoteIpv6NodeAddress("0::0") - } - -} - -// ***** BgpAttributesSegmentRoutingPolicyTypeK ***** -type bgpAttributesSegmentRoutingPolicyTypeK struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicyTypeK - marshaller marshalBgpAttributesSegmentRoutingPolicyTypeK - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeK - flagsHolder BgpAttributesSegmentRoutingPolicyTypeFlags - srv6SidHolder BgpAttributesSidSrv6 - srv6EndpointBehaviorHolder BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -} - -func NewBgpAttributesSegmentRoutingPolicyTypeK() BgpAttributesSegmentRoutingPolicyTypeK { - obj := bgpAttributesSegmentRoutingPolicyTypeK{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeK{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeK { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeK) BgpAttributesSegmentRoutingPolicyTypeK { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicyTypeK struct { - obj *bgpAttributesSegmentRoutingPolicyTypeK -} - -type marshalBgpAttributesSegmentRoutingPolicyTypeK interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeK to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeK - ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeK, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeK to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeK to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeK to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicyTypeK struct { - obj *bgpAttributesSegmentRoutingPolicyTypeK -} - -type unMarshalBgpAttributesSegmentRoutingPolicyTypeK interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeK from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeK - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeK) (BgpAttributesSegmentRoutingPolicyTypeK, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeK from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeK from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeK from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeK { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeK{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeK { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeK{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeK) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeK, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeK) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeK) (BgpAttributesSegmentRoutingPolicyTypeK, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeK) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeK) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeK) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeK) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeK) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeK) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) Clone() (BgpAttributesSegmentRoutingPolicyTypeK, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicyTypeK() - 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 -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) setNil() { - obj.flagsHolder = nil - obj.srv6SidHolder = nil - obj.srv6EndpointBehaviorHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// BgpAttributesSegmentRoutingPolicyTypeK is type K: IPv6 Local and Remote addresses for SRv6 with optional SID. -// It is encoded as a Segment of Type 16 in the SEGMENT_LIST sub-tlv. -type BgpAttributesSegmentRoutingPolicyTypeK interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicyTypeK to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeK - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicyTypeK - // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeK from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeK - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeK) BgpAttributesSegmentRoutingPolicyTypeK - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeK - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeK - // validate validates BgpAttributesSegmentRoutingPolicyTypeK - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicyTypeK, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Flags returns BgpAttributesSegmentRoutingPolicyTypeFlags, set in BgpAttributesSegmentRoutingPolicyTypeK. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - Flags() BgpAttributesSegmentRoutingPolicyTypeFlags - // SetFlags assigns BgpAttributesSegmentRoutingPolicyTypeFlags provided by user to BgpAttributesSegmentRoutingPolicyTypeK. - // BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. - // - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 - // - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . - // - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . - // - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). - // This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. - SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeK - // HasFlags checks if Flags has been set in BgpAttributesSegmentRoutingPolicyTypeK - HasFlags() bool - // SrAlgorithm returns uint32, set in BgpAttributesSegmentRoutingPolicyTypeK. - SrAlgorithm() uint32 - // SetSrAlgorithm assigns uint32 provided by user to BgpAttributesSegmentRoutingPolicyTypeK - SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeK - // HasSrAlgorithm checks if SrAlgorithm has been set in BgpAttributesSegmentRoutingPolicyTypeK - HasSrAlgorithm() bool - // LocalIpv6Address returns string, set in BgpAttributesSegmentRoutingPolicyTypeK. - LocalIpv6Address() string - // SetLocalIpv6Address assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeK - SetLocalIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeK - // HasLocalIpv6Address checks if LocalIpv6Address has been set in BgpAttributesSegmentRoutingPolicyTypeK - HasLocalIpv6Address() bool - // RemoteIpv6Address returns string, set in BgpAttributesSegmentRoutingPolicyTypeK. - RemoteIpv6Address() string - // SetRemoteIpv6Address assigns string provided by user to BgpAttributesSegmentRoutingPolicyTypeK - SetRemoteIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeK - // HasRemoteIpv6Address checks if RemoteIpv6Address has been set in BgpAttributesSegmentRoutingPolicyTypeK - HasRemoteIpv6Address() bool - // Srv6Sid returns BgpAttributesSidSrv6, set in BgpAttributesSegmentRoutingPolicyTypeK. - // BgpAttributesSidSrv6 is an IPv6 address denoting a SRv6 SID. - Srv6Sid() BgpAttributesSidSrv6 - // SetSrv6Sid assigns BgpAttributesSidSrv6 provided by user to BgpAttributesSegmentRoutingPolicyTypeK. - // BgpAttributesSidSrv6 is an IPv6 address denoting a SRv6 SID. - SetSrv6Sid(value BgpAttributesSidSrv6) BgpAttributesSegmentRoutingPolicyTypeK - // HasSrv6Sid checks if Srv6Sid has been set in BgpAttributesSegmentRoutingPolicyTypeK - HasSrv6Sid() bool - // Srv6EndpointBehavior returns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure, set in BgpAttributesSegmentRoutingPolicyTypeK. - // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 - Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure - // SetSrv6EndpointBehavior assigns BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure provided by user to BgpAttributesSegmentRoutingPolicyTypeK. - // BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure is configuration for optional SRv6 Endpoint Behavior and SID Structure. Summation of lengths for Locator Block, Locator Node, Function, and Argument MUST be less than or equal to 128. - This is specified in draft-ietf-idr-sr-policy-safi-02 Section 2.4.4.2.4 - SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeK - // HasSrv6EndpointBehavior checks if Srv6EndpointBehavior has been set in BgpAttributesSegmentRoutingPolicyTypeK - HasSrv6EndpointBehavior() bool - setNil() -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) Flags() BgpAttributesSegmentRoutingPolicyTypeFlags { - if obj.obj.Flags == nil { - obj.obj.Flags = NewBgpAttributesSegmentRoutingPolicyTypeFlags().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &bgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// description is TBD -// Flags returns a BgpAttributesSegmentRoutingPolicyTypeFlags -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) HasFlags() bool { - return obj.obj.Flags != nil -} - -// description is TBD -// SetFlags sets the BgpAttributesSegmentRoutingPolicyTypeFlags value in the BgpAttributesSegmentRoutingPolicyTypeK object -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) SetFlags(value BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeK { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SrAlgorithm returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) SrAlgorithm() uint32 { - - return *obj.obj.SrAlgorithm - -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SrAlgorithm returns a uint32 -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) HasSrAlgorithm() bool { - return obj.obj.SrAlgorithm != nil -} - -// SR Algorithm identifier when A-Flag in on. If A-flag is not enabled, it should be set to 0 on transmission and ignored on receipt. -// SetSrAlgorithm sets the uint32 value in the BgpAttributesSegmentRoutingPolicyTypeK object -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) SetSrAlgorithm(value uint32) BgpAttributesSegmentRoutingPolicyTypeK { - - obj.obj.SrAlgorithm = &value - return obj -} - -// Local IPv6 Address. -// LocalIpv6Address returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) LocalIpv6Address() string { - - return *obj.obj.LocalIpv6Address - -} - -// Local IPv6 Address. -// LocalIpv6Address returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) HasLocalIpv6Address() bool { - return obj.obj.LocalIpv6Address != nil -} - -// Local IPv6 Address. -// SetLocalIpv6Address sets the string value in the BgpAttributesSegmentRoutingPolicyTypeK object -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) SetLocalIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeK { - - obj.obj.LocalIpv6Address = &value - return obj -} - -// Remote IPv6 Address. -// RemoteIpv6Address returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) RemoteIpv6Address() string { - - return *obj.obj.RemoteIpv6Address - -} - -// Remote IPv6 Address. -// RemoteIpv6Address returns a string -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) HasRemoteIpv6Address() bool { - return obj.obj.RemoteIpv6Address != nil -} - -// Remote IPv6 Address. -// SetRemoteIpv6Address sets the string value in the BgpAttributesSegmentRoutingPolicyTypeK object -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) SetRemoteIpv6Address(value string) BgpAttributesSegmentRoutingPolicyTypeK { - - obj.obj.RemoteIpv6Address = &value - return obj -} - -// description is TBD -// Srv6Sid returns a BgpAttributesSidSrv6 -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) Srv6Sid() BgpAttributesSidSrv6 { - if obj.obj.Srv6Sid == nil { - obj.obj.Srv6Sid = NewBgpAttributesSidSrv6().msg() - } - if obj.srv6SidHolder == nil { - obj.srv6SidHolder = &bgpAttributesSidSrv6{obj: obj.obj.Srv6Sid} - } - return obj.srv6SidHolder -} - -// description is TBD -// Srv6Sid returns a BgpAttributesSidSrv6 -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) HasSrv6Sid() bool { - return obj.obj.Srv6Sid != nil -} - -// description is TBD -// SetSrv6Sid sets the BgpAttributesSidSrv6 value in the BgpAttributesSegmentRoutingPolicyTypeK object -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) SetSrv6Sid(value BgpAttributesSidSrv6) BgpAttributesSegmentRoutingPolicyTypeK { - - obj.srv6SidHolder = nil - obj.obj.Srv6Sid = value.msg() - - return obj -} - -// description is TBD -// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) Srv6EndpointBehavior() BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure { - if obj.obj.Srv6EndpointBehavior == nil { - obj.obj.Srv6EndpointBehavior = NewBgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure().msg() - } - if obj.srv6EndpointBehaviorHolder == nil { - obj.srv6EndpointBehaviorHolder = &bgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure{obj: obj.obj.Srv6EndpointBehavior} - } - return obj.srv6EndpointBehaviorHolder -} - -// description is TBD -// Srv6EndpointBehavior returns a BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) HasSrv6EndpointBehavior() bool { - return obj.obj.Srv6EndpointBehavior != nil -} - -// description is TBD -// SetSrv6EndpointBehavior sets the BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure value in the BgpAttributesSegmentRoutingPolicyTypeK object -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) SetSrv6EndpointBehavior(value BgpAttributesSegmentRoutingPolicySRv6SIDEndpointBehaviorAndStructure) BgpAttributesSegmentRoutingPolicyTypeK { - - obj.srv6EndpointBehaviorHolder = nil - obj.obj.Srv6EndpointBehavior = value.msg() - - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.SrAlgorithm != nil { - - if *obj.obj.SrAlgorithm > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= BgpAttributesSegmentRoutingPolicyTypeK.SrAlgorithm <= 255 but Got %d", *obj.obj.SrAlgorithm)) - } - - } - - if obj.obj.LocalIpv6Address != nil { - - err := obj.validateIpv6(obj.LocalIpv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeK.LocalIpv6Address")) - } - - } - - if obj.obj.RemoteIpv6Address != nil { - - err := obj.validateIpv6(obj.RemoteIpv6Address()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSegmentRoutingPolicyTypeK.RemoteIpv6Address")) - } - - } - - if obj.obj.Srv6Sid != nil { - - obj.Srv6Sid().validateObj(vObj, set_default) - } - - if obj.obj.Srv6EndpointBehavior != nil { - - obj.Srv6EndpointBehavior().validateObj(vObj, set_default) - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeK) setDefault() { - if obj.obj.SrAlgorithm == nil { - obj.SetSrAlgorithm(0) - } - if obj.obj.LocalIpv6Address == nil { - obj.SetLocalIpv6Address("0::0") - } - if obj.obj.RemoteIpv6Address == nil { - obj.SetRemoteIpv6Address("0::0") - } - -} - -// ***** PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter ***** -type patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter struct { - validation - obj *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - marshaller marshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - unMarshaller unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter -} - -func NewPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter() PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { - obj := patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter{obj: &otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) setMsg(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter struct { - obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter -} - -type marshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter interface { - // ToProto marshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, error) - // ToPbText marshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter struct { - obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter -} - -type unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter interface { - // FromProto unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) (PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) (PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) 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 *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) 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 *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) 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 *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter() - 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 -} - -// PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter is integer counter pattern -type PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter interface { - Validation - // msg marshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - // setMsg unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - // validate validates PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - SetStart(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - SetStep(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - SetCount(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter object -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) SetStart(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter object -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) SetStep(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter object -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) SetCount(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter ***** -type patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter struct { - validation - obj *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - marshaller marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - unMarshaller unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter -} - -func NewPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { - obj := patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter{obj: &otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { - return obj.obj -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) setMsg(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter struct { - obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter -} - -type marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter interface { - // ToProto marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, error) - // ToPbText marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter struct { - obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter -} - -type unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter interface { - // FromProto unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, error) - // FromPbText unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) 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 *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) 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 *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) 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 *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter() - 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 -} - -// PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter is ipv4 counter pattern -type PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter interface { - Validation - // msg marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - // setMsg unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - // validate validates PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter. - Start() string - // SetStart assigns string provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - SetStart(value string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - // HasStart checks if Start has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - HasStart() bool - // Step returns string, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter. - Step() string - // SetStep assigns string provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - SetStep(value string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - // HasStep checks if Step has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - SetCount(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - // HasCount checks if Count has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter object -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) SetStart(value string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter object -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) SetStep(value string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter object -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) SetCount(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateIpv4(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateIpv4(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter.Step")) - } - - } - -} - -func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("0.0.0.0") - } - if obj.obj.Step == nil { - obj.SetStep("0.0.0.1") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** FlowRSVPPathExplicitRouteType1Ipv4Prefix ***** -type flowRSVPPathExplicitRouteType1Ipv4Prefix struct { - validation - obj *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix - marshaller marshalFlowRSVPPathExplicitRouteType1Ipv4Prefix - unMarshaller unMarshalFlowRSVPPathExplicitRouteType1Ipv4Prefix - lBitHolder PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - lengthHolder FlowRSVPExplicitRouteLength - ipv4AddressHolder PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address -} - -func NewFlowRSVPPathExplicitRouteType1Ipv4Prefix() FlowRSVPPathExplicitRouteType1Ipv4Prefix { - obj := flowRSVPPathExplicitRouteType1Ipv4Prefix{obj: &otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) msg() *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix { - return obj.obj -} - -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) setMsg(msg *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix) FlowRSVPPathExplicitRouteType1Ipv4Prefix { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathExplicitRouteType1Ipv4Prefix struct { - obj *flowRSVPPathExplicitRouteType1Ipv4Prefix -} - -type marshalFlowRSVPPathExplicitRouteType1Ipv4Prefix interface { - // ToProto marshals FlowRSVPPathExplicitRouteType1Ipv4Prefix to protobuf object *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix - ToProto() (*otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix, error) - // ToPbText marshals FlowRSVPPathExplicitRouteType1Ipv4Prefix to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathExplicitRouteType1Ipv4Prefix to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathExplicitRouteType1Ipv4Prefix to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathExplicitRouteType1Ipv4Prefix struct { - obj *flowRSVPPathExplicitRouteType1Ipv4Prefix -} - -type unMarshalFlowRSVPPathExplicitRouteType1Ipv4Prefix interface { - // FromProto unmarshals FlowRSVPPathExplicitRouteType1Ipv4Prefix from protobuf object *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix - FromProto(msg *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix) (FlowRSVPPathExplicitRouteType1Ipv4Prefix, error) - // FromPbText unmarshals FlowRSVPPathExplicitRouteType1Ipv4Prefix from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathExplicitRouteType1Ipv4Prefix from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathExplicitRouteType1Ipv4Prefix from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) Marshal() marshalFlowRSVPPathExplicitRouteType1Ipv4Prefix { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathExplicitRouteType1Ipv4Prefix{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) Unmarshal() unMarshalFlowRSVPPathExplicitRouteType1Ipv4Prefix { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathExplicitRouteType1Ipv4Prefix{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathExplicitRouteType1Ipv4Prefix) ToProto() (*otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathExplicitRouteType1Ipv4Prefix) FromProto(msg *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix) (FlowRSVPPathExplicitRouteType1Ipv4Prefix, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathExplicitRouteType1Ipv4Prefix) 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 *unMarshalflowRSVPPathExplicitRouteType1Ipv4Prefix) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathExplicitRouteType1Ipv4Prefix) 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 *unMarshalflowRSVPPathExplicitRouteType1Ipv4Prefix) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathExplicitRouteType1Ipv4Prefix) 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 *unMarshalflowRSVPPathExplicitRouteType1Ipv4Prefix) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) Clone() (FlowRSVPPathExplicitRouteType1Ipv4Prefix, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathExplicitRouteType1Ipv4Prefix() - 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 -} - -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) setNil() { - obj.lBitHolder = nil - obj.lengthHolder = nil - obj.ipv4AddressHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathExplicitRouteType1Ipv4Prefix is class = EXPLICIT_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: IPv4 Prefix, C-Type: 1 -type FlowRSVPPathExplicitRouteType1Ipv4Prefix interface { - Validation - // msg marshals FlowRSVPPathExplicitRouteType1Ipv4Prefix to protobuf object *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix - // and doesn't set defaults - msg() *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix - // setMsg unmarshals FlowRSVPPathExplicitRouteType1Ipv4Prefix from protobuf object *otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathExplicitRouteType1Ipv4Prefix) FlowRSVPPathExplicitRouteType1Ipv4Prefix - // provides marshal interface - Marshal() marshalFlowRSVPPathExplicitRouteType1Ipv4Prefix - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathExplicitRouteType1Ipv4Prefix - // validate validates FlowRSVPPathExplicitRouteType1Ipv4Prefix - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathExplicitRouteType1Ipv4Prefix, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // LBit returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit, set in FlowRSVPPathExplicitRouteType1Ipv4Prefix. - // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit is the L bit is an attribute of the subobject. The L bit is set if the subobject represents a loose hop in the explicit route. If the bit is not set, the subobject represents a strict hop in the explicit route. - LBit() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - // SetLBit assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit provided by user to FlowRSVPPathExplicitRouteType1Ipv4Prefix. - // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit is the L bit is an attribute of the subobject. The L bit is set if the subobject represents a loose hop in the explicit route. If the bit is not set, the subobject represents a strict hop in the explicit route. - SetLBit(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) FlowRSVPPathExplicitRouteType1Ipv4Prefix - // HasLBit checks if LBit has been set in FlowRSVPPathExplicitRouteType1Ipv4Prefix - HasLBit() bool - // Length returns FlowRSVPExplicitRouteLength, set in FlowRSVPPathExplicitRouteType1Ipv4Prefix. - // FlowRSVPExplicitRouteLength is description is TBD - Length() FlowRSVPExplicitRouteLength - // SetLength assigns FlowRSVPExplicitRouteLength provided by user to FlowRSVPPathExplicitRouteType1Ipv4Prefix. - // FlowRSVPExplicitRouteLength is description is TBD - SetLength(value FlowRSVPExplicitRouteLength) FlowRSVPPathExplicitRouteType1Ipv4Prefix - // HasLength checks if Length has been set in FlowRSVPPathExplicitRouteType1Ipv4Prefix - HasLength() bool - // Ipv4Address returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address, set in FlowRSVPPathExplicitRouteType1Ipv4Prefix. - // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address is this IPv4 address is treated as a prefix based on the prefix length value below. Bits beyond the prefix are ignored on receipt and SHOULD be set to zero on transmission. - Ipv4Address() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - // SetIpv4Address assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address provided by user to FlowRSVPPathExplicitRouteType1Ipv4Prefix. - // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address is this IPv4 address is treated as a prefix based on the prefix length value below. Bits beyond the prefix are ignored on receipt and SHOULD be set to zero on transmission. - SetIpv4Address(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) FlowRSVPPathExplicitRouteType1Ipv4Prefix - // HasIpv4Address checks if Ipv4Address has been set in FlowRSVPPathExplicitRouteType1Ipv4Prefix - HasIpv4Address() bool - // Prefix returns uint32, set in FlowRSVPPathExplicitRouteType1Ipv4Prefix. - Prefix() uint32 - // SetPrefix assigns uint32 provided by user to FlowRSVPPathExplicitRouteType1Ipv4Prefix - SetPrefix(value uint32) FlowRSVPPathExplicitRouteType1Ipv4Prefix - // HasPrefix checks if Prefix has been set in FlowRSVPPathExplicitRouteType1Ipv4Prefix - HasPrefix() bool - setNil() -} - -// description is TBD -// LBit returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) LBit() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { - if obj.obj.LBit == nil { - obj.obj.LBit = NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit().msg() - } - if obj.lBitHolder == nil { - obj.lBitHolder = &patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit{obj: obj.obj.LBit} - } - return obj.lBitHolder -} - -// description is TBD -// LBit returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) HasLBit() bool { - return obj.obj.LBit != nil -} - -// description is TBD -// SetLBit sets the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit value in the FlowRSVPPathExplicitRouteType1Ipv4Prefix object -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) SetLBit(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) FlowRSVPPathExplicitRouteType1Ipv4Prefix { - - obj.lBitHolder = nil - obj.obj.LBit = value.msg() - - return obj -} - -// The Length contains the total length of the subobject in bytes,including L,Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. -// Length returns a FlowRSVPExplicitRouteLength -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) Length() FlowRSVPExplicitRouteLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowRSVPExplicitRouteLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowRSVPExplicitRouteLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// The Length contains the total length of the subobject in bytes,including L,Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. -// Length returns a FlowRSVPExplicitRouteLength -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) HasLength() bool { - return obj.obj.Length != nil -} - -// The Length contains the total length of the subobject in bytes,including L,Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. -// SetLength sets the FlowRSVPExplicitRouteLength value in the FlowRSVPPathExplicitRouteType1Ipv4Prefix object -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) SetLength(value FlowRSVPExplicitRouteLength) FlowRSVPPathExplicitRouteType1Ipv4Prefix { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// description is TBD -// Ipv4Address returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) Ipv4Address() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { - if obj.obj.Ipv4Address == nil { - obj.obj.Ipv4Address = NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address().msg() - } - if obj.ipv4AddressHolder == nil { - obj.ipv4AddressHolder = &patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address{obj: obj.obj.Ipv4Address} - } - return obj.ipv4AddressHolder -} - -// description is TBD -// Ipv4Address returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) HasIpv4Address() bool { - return obj.obj.Ipv4Address != nil -} - -// description is TBD -// SetIpv4Address sets the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address value in the FlowRSVPPathExplicitRouteType1Ipv4Prefix object -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) SetIpv4Address(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) FlowRSVPPathExplicitRouteType1Ipv4Prefix { - - obj.ipv4AddressHolder = nil - obj.obj.Ipv4Address = value.msg() - - return obj -} - -// The prefix length of the IPv4 address. -// Prefix returns a uint32 -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) Prefix() uint32 { - - return *obj.obj.Prefix - -} - -// The prefix length of the IPv4 address. -// Prefix returns a uint32 -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) HasPrefix() bool { - return obj.obj.Prefix != nil -} - -// The prefix length of the IPv4 address. -// SetPrefix sets the uint32 value in the FlowRSVPPathExplicitRouteType1Ipv4Prefix object -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) SetPrefix(value uint32) FlowRSVPPathExplicitRouteType1Ipv4Prefix { - - obj.obj.Prefix = &value - return obj -} - -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.LBit != nil { - - obj.LBit().validateObj(vObj, set_default) - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.Ipv4Address != nil { - - obj.Ipv4Address().validateObj(vObj, set_default) - } - - if obj.obj.Prefix != nil { - - if *obj.obj.Prefix < 1 || *obj.obj.Prefix > 32 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("1 <= FlowRSVPPathExplicitRouteType1Ipv4Prefix.Prefix <= 32 but Got %d", *obj.obj.Prefix)) - } - - } - -} - -func (obj *flowRSVPPathExplicitRouteType1Ipv4Prefix) setDefault() { - if obj.obj.Prefix == nil { - obj.SetPrefix(32) - } - -} - -// ***** FlowRSVPPathExplicitRouteType1ASNumber ***** -type flowRSVPPathExplicitRouteType1ASNumber struct { - validation - obj *otg.FlowRSVPPathExplicitRouteType1ASNumber - marshaller marshalFlowRSVPPathExplicitRouteType1ASNumber - unMarshaller unMarshalFlowRSVPPathExplicitRouteType1ASNumber - lBitHolder PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - lengthHolder FlowRSVPExplicitRouteASNumberLength -} - -func NewFlowRSVPPathExplicitRouteType1ASNumber() FlowRSVPPathExplicitRouteType1ASNumber { - obj := flowRSVPPathExplicitRouteType1ASNumber{obj: &otg.FlowRSVPPathExplicitRouteType1ASNumber{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathExplicitRouteType1ASNumber) msg() *otg.FlowRSVPPathExplicitRouteType1ASNumber { - return obj.obj -} - -func (obj *flowRSVPPathExplicitRouteType1ASNumber) setMsg(msg *otg.FlowRSVPPathExplicitRouteType1ASNumber) FlowRSVPPathExplicitRouteType1ASNumber { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathExplicitRouteType1ASNumber struct { - obj *flowRSVPPathExplicitRouteType1ASNumber -} - -type marshalFlowRSVPPathExplicitRouteType1ASNumber interface { - // ToProto marshals FlowRSVPPathExplicitRouteType1ASNumber to protobuf object *otg.FlowRSVPPathExplicitRouteType1ASNumber - ToProto() (*otg.FlowRSVPPathExplicitRouteType1ASNumber, error) - // ToPbText marshals FlowRSVPPathExplicitRouteType1ASNumber to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathExplicitRouteType1ASNumber to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathExplicitRouteType1ASNumber to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathExplicitRouteType1ASNumber struct { - obj *flowRSVPPathExplicitRouteType1ASNumber -} - -type unMarshalFlowRSVPPathExplicitRouteType1ASNumber interface { - // FromProto unmarshals FlowRSVPPathExplicitRouteType1ASNumber from protobuf object *otg.FlowRSVPPathExplicitRouteType1ASNumber - FromProto(msg *otg.FlowRSVPPathExplicitRouteType1ASNumber) (FlowRSVPPathExplicitRouteType1ASNumber, error) - // FromPbText unmarshals FlowRSVPPathExplicitRouteType1ASNumber from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathExplicitRouteType1ASNumber from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathExplicitRouteType1ASNumber from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathExplicitRouteType1ASNumber) Marshal() marshalFlowRSVPPathExplicitRouteType1ASNumber { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathExplicitRouteType1ASNumber{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathExplicitRouteType1ASNumber) Unmarshal() unMarshalFlowRSVPPathExplicitRouteType1ASNumber { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathExplicitRouteType1ASNumber{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathExplicitRouteType1ASNumber) ToProto() (*otg.FlowRSVPPathExplicitRouteType1ASNumber, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathExplicitRouteType1ASNumber) FromProto(msg *otg.FlowRSVPPathExplicitRouteType1ASNumber) (FlowRSVPPathExplicitRouteType1ASNumber, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathExplicitRouteType1ASNumber) 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 *unMarshalflowRSVPPathExplicitRouteType1ASNumber) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathExplicitRouteType1ASNumber) 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 *unMarshalflowRSVPPathExplicitRouteType1ASNumber) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathExplicitRouteType1ASNumber) 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 *unMarshalflowRSVPPathExplicitRouteType1ASNumber) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathExplicitRouteType1ASNumber) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathExplicitRouteType1ASNumber) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathExplicitRouteType1ASNumber) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathExplicitRouteType1ASNumber) Clone() (FlowRSVPPathExplicitRouteType1ASNumber, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathExplicitRouteType1ASNumber() - 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 -} - -func (obj *flowRSVPPathExplicitRouteType1ASNumber) setNil() { - obj.lBitHolder = nil - obj.lengthHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathExplicitRouteType1ASNumber is class = EXPLICIT_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: Autonomous system number, C-Type: 32 -type FlowRSVPPathExplicitRouteType1ASNumber interface { - Validation - // msg marshals FlowRSVPPathExplicitRouteType1ASNumber to protobuf object *otg.FlowRSVPPathExplicitRouteType1ASNumber - // and doesn't set defaults - msg() *otg.FlowRSVPPathExplicitRouteType1ASNumber - // setMsg unmarshals FlowRSVPPathExplicitRouteType1ASNumber from protobuf object *otg.FlowRSVPPathExplicitRouteType1ASNumber - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathExplicitRouteType1ASNumber) FlowRSVPPathExplicitRouteType1ASNumber - // provides marshal interface - Marshal() marshalFlowRSVPPathExplicitRouteType1ASNumber - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathExplicitRouteType1ASNumber - // validate validates FlowRSVPPathExplicitRouteType1ASNumber - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathExplicitRouteType1ASNumber, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // LBit returns PatternFlowRSVPPathExplicitRouteType1ASNumberLBit, set in FlowRSVPPathExplicitRouteType1ASNumber. - // PatternFlowRSVPPathExplicitRouteType1ASNumberLBit is the L bit is an attribute of the subobject. The L bit is set if the subobject represents a loose hop in the explicit route. If the bit is not set, the subobject represents a strict hop in the explicit route. - LBit() PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - // SetLBit assigns PatternFlowRSVPPathExplicitRouteType1ASNumberLBit provided by user to FlowRSVPPathExplicitRouteType1ASNumber. - // PatternFlowRSVPPathExplicitRouteType1ASNumberLBit is the L bit is an attribute of the subobject. The L bit is set if the subobject represents a loose hop in the explicit route. If the bit is not set, the subobject represents a strict hop in the explicit route. - SetLBit(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) FlowRSVPPathExplicitRouteType1ASNumber - // HasLBit checks if LBit has been set in FlowRSVPPathExplicitRouteType1ASNumber - HasLBit() bool - // Length returns FlowRSVPExplicitRouteASNumberLength, set in FlowRSVPPathExplicitRouteType1ASNumber. - // FlowRSVPExplicitRouteASNumberLength is description is TBD - Length() FlowRSVPExplicitRouteASNumberLength - // SetLength assigns FlowRSVPExplicitRouteASNumberLength provided by user to FlowRSVPPathExplicitRouteType1ASNumber. - // FlowRSVPExplicitRouteASNumberLength is description is TBD - SetLength(value FlowRSVPExplicitRouteASNumberLength) FlowRSVPPathExplicitRouteType1ASNumber - // HasLength checks if Length has been set in FlowRSVPPathExplicitRouteType1ASNumber - HasLength() bool - // AsNumber returns uint32, set in FlowRSVPPathExplicitRouteType1ASNumber. - AsNumber() uint32 - // SetAsNumber assigns uint32 provided by user to FlowRSVPPathExplicitRouteType1ASNumber - SetAsNumber(value uint32) FlowRSVPPathExplicitRouteType1ASNumber - // HasAsNumber checks if AsNumber has been set in FlowRSVPPathExplicitRouteType1ASNumber - HasAsNumber() bool - setNil() -} - -// description is TBD -// LBit returns a PatternFlowRSVPPathExplicitRouteType1ASNumberLBit -func (obj *flowRSVPPathExplicitRouteType1ASNumber) LBit() PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { - if obj.obj.LBit == nil { - obj.obj.LBit = NewPatternFlowRSVPPathExplicitRouteType1ASNumberLBit().msg() - } - if obj.lBitHolder == nil { - obj.lBitHolder = &patternFlowRSVPPathExplicitRouteType1ASNumberLBit{obj: obj.obj.LBit} - } - return obj.lBitHolder -} - -// description is TBD -// LBit returns a PatternFlowRSVPPathExplicitRouteType1ASNumberLBit -func (obj *flowRSVPPathExplicitRouteType1ASNumber) HasLBit() bool { - return obj.obj.LBit != nil -} - -// description is TBD -// SetLBit sets the PatternFlowRSVPPathExplicitRouteType1ASNumberLBit value in the FlowRSVPPathExplicitRouteType1ASNumber object -func (obj *flowRSVPPathExplicitRouteType1ASNumber) SetLBit(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) FlowRSVPPathExplicitRouteType1ASNumber { - - obj.lBitHolder = nil - obj.obj.LBit = value.msg() - - return obj -} - -// The Length contains the total length of the subobject in bytes,including L, Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. -// Length returns a FlowRSVPExplicitRouteASNumberLength -func (obj *flowRSVPPathExplicitRouteType1ASNumber) Length() FlowRSVPExplicitRouteASNumberLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowRSVPExplicitRouteASNumberLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowRSVPExplicitRouteASNumberLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// The Length contains the total length of the subobject in bytes,including L, Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. -// Length returns a FlowRSVPExplicitRouteASNumberLength -func (obj *flowRSVPPathExplicitRouteType1ASNumber) HasLength() bool { - return obj.obj.Length != nil -} - -// The Length contains the total length of the subobject in bytes,including L, Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. -// SetLength sets the FlowRSVPExplicitRouteASNumberLength value in the FlowRSVPPathExplicitRouteType1ASNumber object -func (obj *flowRSVPPathExplicitRouteType1ASNumber) SetLength(value FlowRSVPExplicitRouteASNumberLength) FlowRSVPPathExplicitRouteType1ASNumber { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// Autonomous System number to be set in the ERO sub-object that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'as_number'. -// AsNumber returns a uint32 -func (obj *flowRSVPPathExplicitRouteType1ASNumber) AsNumber() uint32 { - - return *obj.obj.AsNumber - -} - -// Autonomous System number to be set in the ERO sub-object that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'as_number'. -// AsNumber returns a uint32 -func (obj *flowRSVPPathExplicitRouteType1ASNumber) HasAsNumber() bool { - return obj.obj.AsNumber != nil -} - -// Autonomous System number to be set in the ERO sub-object that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'as_number'. -// SetAsNumber sets the uint32 value in the FlowRSVPPathExplicitRouteType1ASNumber object -func (obj *flowRSVPPathExplicitRouteType1ASNumber) SetAsNumber(value uint32) FlowRSVPPathExplicitRouteType1ASNumber { - - obj.obj.AsNumber = &value - return obj -} - -func (obj *flowRSVPPathExplicitRouteType1ASNumber) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.LBit != nil { - - obj.LBit().validateObj(vObj, set_default) - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.AsNumber != nil { - - if *obj.obj.AsNumber > 65535 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowRSVPPathExplicitRouteType1ASNumber.AsNumber <= 65535 but Got %d", *obj.obj.AsNumber)) - } - - } - -} - -func (obj *flowRSVPPathExplicitRouteType1ASNumber) setDefault() { - if obj.obj.AsNumber == nil { - obj.SetAsNumber(0) - } - -} - -// ***** FlowRSVPPathRecordRouteType1Ipv4Address ***** -type flowRSVPPathRecordRouteType1Ipv4Address struct { - validation - obj *otg.FlowRSVPPathRecordRouteType1Ipv4Address - marshaller marshalFlowRSVPPathRecordRouteType1Ipv4Address - unMarshaller unMarshalFlowRSVPPathRecordRouteType1Ipv4Address - lengthHolder FlowRSVPRouteRecordLength - ipv4AddressHolder PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - prefixLengthHolder PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - flagsHolder FlowRSVPRecordRouteIPv4Flag -} - -func NewFlowRSVPPathRecordRouteType1Ipv4Address() FlowRSVPPathRecordRouteType1Ipv4Address { - obj := flowRSVPPathRecordRouteType1Ipv4Address{obj: &otg.FlowRSVPPathRecordRouteType1Ipv4Address{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) msg() *otg.FlowRSVPPathRecordRouteType1Ipv4Address { - return obj.obj -} - -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) setMsg(msg *otg.FlowRSVPPathRecordRouteType1Ipv4Address) FlowRSVPPathRecordRouteType1Ipv4Address { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathRecordRouteType1Ipv4Address struct { - obj *flowRSVPPathRecordRouteType1Ipv4Address -} - -type marshalFlowRSVPPathRecordRouteType1Ipv4Address interface { - // ToProto marshals FlowRSVPPathRecordRouteType1Ipv4Address to protobuf object *otg.FlowRSVPPathRecordRouteType1Ipv4Address - ToProto() (*otg.FlowRSVPPathRecordRouteType1Ipv4Address, error) - // ToPbText marshals FlowRSVPPathRecordRouteType1Ipv4Address to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathRecordRouteType1Ipv4Address to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathRecordRouteType1Ipv4Address to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathRecordRouteType1Ipv4Address struct { - obj *flowRSVPPathRecordRouteType1Ipv4Address -} - -type unMarshalFlowRSVPPathRecordRouteType1Ipv4Address interface { - // FromProto unmarshals FlowRSVPPathRecordRouteType1Ipv4Address from protobuf object *otg.FlowRSVPPathRecordRouteType1Ipv4Address - FromProto(msg *otg.FlowRSVPPathRecordRouteType1Ipv4Address) (FlowRSVPPathRecordRouteType1Ipv4Address, error) - // FromPbText unmarshals FlowRSVPPathRecordRouteType1Ipv4Address from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathRecordRouteType1Ipv4Address from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathRecordRouteType1Ipv4Address from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) Marshal() marshalFlowRSVPPathRecordRouteType1Ipv4Address { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathRecordRouteType1Ipv4Address{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) Unmarshal() unMarshalFlowRSVPPathRecordRouteType1Ipv4Address { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathRecordRouteType1Ipv4Address{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathRecordRouteType1Ipv4Address) ToProto() (*otg.FlowRSVPPathRecordRouteType1Ipv4Address, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathRecordRouteType1Ipv4Address) FromProto(msg *otg.FlowRSVPPathRecordRouteType1Ipv4Address) (FlowRSVPPathRecordRouteType1Ipv4Address, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathRecordRouteType1Ipv4Address) 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 *unMarshalflowRSVPPathRecordRouteType1Ipv4Address) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathRecordRouteType1Ipv4Address) 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 *unMarshalflowRSVPPathRecordRouteType1Ipv4Address) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathRecordRouteType1Ipv4Address) 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 *unMarshalflowRSVPPathRecordRouteType1Ipv4Address) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) Clone() (FlowRSVPPathRecordRouteType1Ipv4Address, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathRecordRouteType1Ipv4Address() - 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 -} - -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) setNil() { - obj.lengthHolder = nil - obj.ipv4AddressHolder = nil - obj.prefixLengthHolder = nil - obj.flagsHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathRecordRouteType1Ipv4Address is class = RECORD_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: IPv4 Address, C-Type: 1 -type FlowRSVPPathRecordRouteType1Ipv4Address interface { - Validation - // msg marshals FlowRSVPPathRecordRouteType1Ipv4Address to protobuf object *otg.FlowRSVPPathRecordRouteType1Ipv4Address - // and doesn't set defaults - msg() *otg.FlowRSVPPathRecordRouteType1Ipv4Address - // setMsg unmarshals FlowRSVPPathRecordRouteType1Ipv4Address from protobuf object *otg.FlowRSVPPathRecordRouteType1Ipv4Address - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathRecordRouteType1Ipv4Address) FlowRSVPPathRecordRouteType1Ipv4Address - // provides marshal interface - Marshal() marshalFlowRSVPPathRecordRouteType1Ipv4Address - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathRecordRouteType1Ipv4Address - // validate validates FlowRSVPPathRecordRouteType1Ipv4Address - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathRecordRouteType1Ipv4Address, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Length returns FlowRSVPRouteRecordLength, set in FlowRSVPPathRecordRouteType1Ipv4Address. - // FlowRSVPRouteRecordLength is description is TBD - Length() FlowRSVPRouteRecordLength - // SetLength assigns FlowRSVPRouteRecordLength provided by user to FlowRSVPPathRecordRouteType1Ipv4Address. - // FlowRSVPRouteRecordLength is description is TBD - SetLength(value FlowRSVPRouteRecordLength) FlowRSVPPathRecordRouteType1Ipv4Address - // HasLength checks if Length has been set in FlowRSVPPathRecordRouteType1Ipv4Address - HasLength() bool - // Ipv4Address returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address, set in FlowRSVPPathRecordRouteType1Ipv4Address. - // PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address is a 32-bit unicast, host address. Any network-reachable interface address is allowed here. Illegal addresses, such as certain loopback addresses, SHOULD NOT be used. - Ipv4Address() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - // SetIpv4Address assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address provided by user to FlowRSVPPathRecordRouteType1Ipv4Address. - // PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address is a 32-bit unicast, host address. Any network-reachable interface address is allowed here. Illegal addresses, such as certain loopback addresses, SHOULD NOT be used. - SetIpv4Address(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) FlowRSVPPathRecordRouteType1Ipv4Address - // HasIpv4Address checks if Ipv4Address has been set in FlowRSVPPathRecordRouteType1Ipv4Address - HasIpv4Address() bool - // PrefixLength returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength, set in FlowRSVPPathRecordRouteType1Ipv4Address. - // PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength is prefix-length of IPv4 address. - PrefixLength() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - // SetPrefixLength assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength provided by user to FlowRSVPPathRecordRouteType1Ipv4Address. - // PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength is prefix-length of IPv4 address. - SetPrefixLength(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) FlowRSVPPathRecordRouteType1Ipv4Address - // HasPrefixLength checks if PrefixLength has been set in FlowRSVPPathRecordRouteType1Ipv4Address - HasPrefixLength() bool - // Flags returns FlowRSVPRecordRouteIPv4Flag, set in FlowRSVPPathRecordRouteType1Ipv4Address. - // FlowRSVPRecordRouteIPv4Flag is description is TBD - Flags() FlowRSVPRecordRouteIPv4Flag - // SetFlags assigns FlowRSVPRecordRouteIPv4Flag provided by user to FlowRSVPPathRecordRouteType1Ipv4Address. - // FlowRSVPRecordRouteIPv4Flag is description is TBD - SetFlags(value FlowRSVPRecordRouteIPv4Flag) FlowRSVPPathRecordRouteType1Ipv4Address - // HasFlags checks if Flags has been set in FlowRSVPPathRecordRouteType1Ipv4Address - HasFlags() bool - setNil() -} - -// The Length contains the total length of the subobject in bytes, including the Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. -// Length returns a FlowRSVPRouteRecordLength -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) Length() FlowRSVPRouteRecordLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowRSVPRouteRecordLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowRSVPRouteRecordLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// The Length contains the total length of the subobject in bytes, including the Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. -// Length returns a FlowRSVPRouteRecordLength -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) HasLength() bool { - return obj.obj.Length != nil -} - -// The Length contains the total length of the subobject in bytes, including the Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. -// SetLength sets the FlowRSVPRouteRecordLength value in the FlowRSVPPathRecordRouteType1Ipv4Address object -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) SetLength(value FlowRSVPRouteRecordLength) FlowRSVPPathRecordRouteType1Ipv4Address { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// description is TBD -// Ipv4Address returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) Ipv4Address() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { - if obj.obj.Ipv4Address == nil { - obj.obj.Ipv4Address = NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address().msg() - } - if obj.ipv4AddressHolder == nil { - obj.ipv4AddressHolder = &patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address{obj: obj.obj.Ipv4Address} - } - return obj.ipv4AddressHolder -} - -// description is TBD -// Ipv4Address returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) HasIpv4Address() bool { - return obj.obj.Ipv4Address != nil -} - -// description is TBD -// SetIpv4Address sets the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address value in the FlowRSVPPathRecordRouteType1Ipv4Address object -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) SetIpv4Address(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) FlowRSVPPathRecordRouteType1Ipv4Address { - - obj.ipv4AddressHolder = nil - obj.obj.Ipv4Address = value.msg() - - return obj -} - -// description is TBD -// PrefixLength returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) PrefixLength() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { - if obj.obj.PrefixLength == nil { - obj.obj.PrefixLength = NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength().msg() - } - if obj.prefixLengthHolder == nil { - obj.prefixLengthHolder = &patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength{obj: obj.obj.PrefixLength} - } - return obj.prefixLengthHolder -} - -// description is TBD -// PrefixLength returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) HasPrefixLength() bool { - return obj.obj.PrefixLength != nil -} - -// description is TBD -// SetPrefixLength sets the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength value in the FlowRSVPPathRecordRouteType1Ipv4Address object -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) SetPrefixLength(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) FlowRSVPPathRecordRouteType1Ipv4Address { - - obj.prefixLengthHolder = nil - obj.obj.PrefixLength = value.msg() - - return obj -} - -// 0x01 local_protection_available, 0x02 local_protection_in_use -// Flags returns a FlowRSVPRecordRouteIPv4Flag -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) Flags() FlowRSVPRecordRouteIPv4Flag { - if obj.obj.Flags == nil { - obj.obj.Flags = NewFlowRSVPRecordRouteIPv4Flag().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &flowRSVPRecordRouteIPv4Flag{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// 0x01 local_protection_available, 0x02 local_protection_in_use -// Flags returns a FlowRSVPRecordRouteIPv4Flag -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) HasFlags() bool { - return obj.obj.Flags != nil -} - -// 0x01 local_protection_available, 0x02 local_protection_in_use -// SetFlags sets the FlowRSVPRecordRouteIPv4Flag value in the FlowRSVPPathRecordRouteType1Ipv4Address object -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) SetFlags(value FlowRSVPRecordRouteIPv4Flag) FlowRSVPPathRecordRouteType1Ipv4Address { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.Ipv4Address != nil { - - obj.Ipv4Address().validateObj(vObj, set_default) - } - - if obj.obj.PrefixLength != nil { - - obj.PrefixLength().validateObj(vObj, set_default) - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathRecordRouteType1Ipv4Address) setDefault() { - -} - -// ***** FlowRSVPPathRecordRouteType1Label ***** -type flowRSVPPathRecordRouteType1Label struct { - validation - obj *otg.FlowRSVPPathRecordRouteType1Label - marshaller marshalFlowRSVPPathRecordRouteType1Label - unMarshaller unMarshalFlowRSVPPathRecordRouteType1Label - lengthHolder FlowRSVPRouteRecordLength - flagsHolder PatternFlowRSVPPathRecordRouteType1LabelFlags - cTypeHolder PatternFlowRSVPPathRecordRouteType1LabelCType - labelHolder FlowRSVPPathRecordRouteLabel -} - -func NewFlowRSVPPathRecordRouteType1Label() FlowRSVPPathRecordRouteType1Label { - obj := flowRSVPPathRecordRouteType1Label{obj: &otg.FlowRSVPPathRecordRouteType1Label{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathRecordRouteType1Label) msg() *otg.FlowRSVPPathRecordRouteType1Label { - return obj.obj -} - -func (obj *flowRSVPPathRecordRouteType1Label) setMsg(msg *otg.FlowRSVPPathRecordRouteType1Label) FlowRSVPPathRecordRouteType1Label { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathRecordRouteType1Label struct { - obj *flowRSVPPathRecordRouteType1Label -} - -type marshalFlowRSVPPathRecordRouteType1Label interface { - // ToProto marshals FlowRSVPPathRecordRouteType1Label to protobuf object *otg.FlowRSVPPathRecordRouteType1Label - ToProto() (*otg.FlowRSVPPathRecordRouteType1Label, error) - // ToPbText marshals FlowRSVPPathRecordRouteType1Label to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathRecordRouteType1Label to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathRecordRouteType1Label to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathRecordRouteType1Label struct { - obj *flowRSVPPathRecordRouteType1Label -} - -type unMarshalFlowRSVPPathRecordRouteType1Label interface { - // FromProto unmarshals FlowRSVPPathRecordRouteType1Label from protobuf object *otg.FlowRSVPPathRecordRouteType1Label - FromProto(msg *otg.FlowRSVPPathRecordRouteType1Label) (FlowRSVPPathRecordRouteType1Label, error) - // FromPbText unmarshals FlowRSVPPathRecordRouteType1Label from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathRecordRouteType1Label from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathRecordRouteType1Label from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathRecordRouteType1Label) Marshal() marshalFlowRSVPPathRecordRouteType1Label { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathRecordRouteType1Label{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathRecordRouteType1Label) Unmarshal() unMarshalFlowRSVPPathRecordRouteType1Label { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathRecordRouteType1Label{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathRecordRouteType1Label) ToProto() (*otg.FlowRSVPPathRecordRouteType1Label, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathRecordRouteType1Label) FromProto(msg *otg.FlowRSVPPathRecordRouteType1Label) (FlowRSVPPathRecordRouteType1Label, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathRecordRouteType1Label) 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 *unMarshalflowRSVPPathRecordRouteType1Label) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalflowRSVPPathRecordRouteType1Label) 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 *unMarshalflowRSVPPathRecordRouteType1Label) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalflowRSVPPathRecordRouteType1Label) 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 *unMarshalflowRSVPPathRecordRouteType1Label) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *flowRSVPPathRecordRouteType1Label) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathRecordRouteType1Label) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathRecordRouteType1Label) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathRecordRouteType1Label) Clone() (FlowRSVPPathRecordRouteType1Label, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathRecordRouteType1Label() - 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 -} - -func (obj *flowRSVPPathRecordRouteType1Label) setNil() { - obj.lengthHolder = nil - obj.flagsHolder = nil - obj.cTypeHolder = nil - obj.labelHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// FlowRSVPPathRecordRouteType1Label is class = RECORD_ROUTE, Type1 ROUTE_RECORD C-Type = 1 Subobject: Label, C-Type: 3 -type FlowRSVPPathRecordRouteType1Label interface { - Validation - // msg marshals FlowRSVPPathRecordRouteType1Label to protobuf object *otg.FlowRSVPPathRecordRouteType1Label - // and doesn't set defaults - msg() *otg.FlowRSVPPathRecordRouteType1Label - // setMsg unmarshals FlowRSVPPathRecordRouteType1Label from protobuf object *otg.FlowRSVPPathRecordRouteType1Label - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathRecordRouteType1Label) FlowRSVPPathRecordRouteType1Label - // provides marshal interface - Marshal() marshalFlowRSVPPathRecordRouteType1Label - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathRecordRouteType1Label - // validate validates FlowRSVPPathRecordRouteType1Label - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathRecordRouteType1Label, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Length returns FlowRSVPRouteRecordLength, set in FlowRSVPPathRecordRouteType1Label. - // FlowRSVPRouteRecordLength is description is TBD - Length() FlowRSVPRouteRecordLength - // SetLength assigns FlowRSVPRouteRecordLength provided by user to FlowRSVPPathRecordRouteType1Label. - // FlowRSVPRouteRecordLength is description is TBD - SetLength(value FlowRSVPRouteRecordLength) FlowRSVPPathRecordRouteType1Label - // HasLength checks if Length has been set in FlowRSVPPathRecordRouteType1Label - HasLength() bool - // Flags returns PatternFlowRSVPPathRecordRouteType1LabelFlags, set in FlowRSVPPathRecordRouteType1Label. - // PatternFlowRSVPPathRecordRouteType1LabelFlags is 0x01 = Global label. This flag indicates that the label will be understood if received on any interface. - Flags() PatternFlowRSVPPathRecordRouteType1LabelFlags - // SetFlags assigns PatternFlowRSVPPathRecordRouteType1LabelFlags provided by user to FlowRSVPPathRecordRouteType1Label. - // PatternFlowRSVPPathRecordRouteType1LabelFlags is 0x01 = Global label. This flag indicates that the label will be understood if received on any interface. - SetFlags(value PatternFlowRSVPPathRecordRouteType1LabelFlags) FlowRSVPPathRecordRouteType1Label - // HasFlags checks if Flags has been set in FlowRSVPPathRecordRouteType1Label - HasFlags() bool - // CType returns PatternFlowRSVPPathRecordRouteType1LabelCType, set in FlowRSVPPathRecordRouteType1Label. - // PatternFlowRSVPPathRecordRouteType1LabelCType is the C-Type of the included Label Object. Copied from the Label object. - CType() PatternFlowRSVPPathRecordRouteType1LabelCType - // SetCType assigns PatternFlowRSVPPathRecordRouteType1LabelCType provided by user to FlowRSVPPathRecordRouteType1Label. - // PatternFlowRSVPPathRecordRouteType1LabelCType is the C-Type of the included Label Object. Copied from the Label object. - SetCType(value PatternFlowRSVPPathRecordRouteType1LabelCType) FlowRSVPPathRecordRouteType1Label - // HasCType checks if CType has been set in FlowRSVPPathRecordRouteType1Label - HasCType() bool - // Label returns FlowRSVPPathRecordRouteLabel, set in FlowRSVPPathRecordRouteType1Label. - // FlowRSVPPathRecordRouteLabel is description is TBD - Label() FlowRSVPPathRecordRouteLabel - // SetLabel assigns FlowRSVPPathRecordRouteLabel provided by user to FlowRSVPPathRecordRouteType1Label. - // FlowRSVPPathRecordRouteLabel is description is TBD - SetLabel(value FlowRSVPPathRecordRouteLabel) FlowRSVPPathRecordRouteType1Label - // HasLabel checks if Label has been set in FlowRSVPPathRecordRouteType1Label - HasLabel() bool - setNil() -} - -// The Length contains the total length of the subobject in bytes, including the Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. -// Length returns a FlowRSVPRouteRecordLength -func (obj *flowRSVPPathRecordRouteType1Label) Length() FlowRSVPRouteRecordLength { - if obj.obj.Length == nil { - obj.obj.Length = NewFlowRSVPRouteRecordLength().msg() - } - if obj.lengthHolder == nil { - obj.lengthHolder = &flowRSVPRouteRecordLength{obj: obj.obj.Length} - } - return obj.lengthHolder -} - -// The Length contains the total length of the subobject in bytes, including the Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. -// Length returns a FlowRSVPRouteRecordLength -func (obj *flowRSVPPathRecordRouteType1Label) HasLength() bool { - return obj.obj.Length != nil -} - -// The Length contains the total length of the subobject in bytes, including the Type and Length fields. The Length MUST be atleast 4, and MUST be a multiple of 4. -// SetLength sets the FlowRSVPRouteRecordLength value in the FlowRSVPPathRecordRouteType1Label object -func (obj *flowRSVPPathRecordRouteType1Label) SetLength(value FlowRSVPRouteRecordLength) FlowRSVPPathRecordRouteType1Label { - - obj.lengthHolder = nil - obj.obj.Length = value.msg() - - return obj -} - -// description is TBD -// Flags returns a PatternFlowRSVPPathRecordRouteType1LabelFlags -func (obj *flowRSVPPathRecordRouteType1Label) Flags() PatternFlowRSVPPathRecordRouteType1LabelFlags { - if obj.obj.Flags == nil { - obj.obj.Flags = NewPatternFlowRSVPPathRecordRouteType1LabelFlags().msg() - } - if obj.flagsHolder == nil { - obj.flagsHolder = &patternFlowRSVPPathRecordRouteType1LabelFlags{obj: obj.obj.Flags} - } - return obj.flagsHolder -} - -// description is TBD -// Flags returns a PatternFlowRSVPPathRecordRouteType1LabelFlags -func (obj *flowRSVPPathRecordRouteType1Label) HasFlags() bool { - return obj.obj.Flags != nil -} - -// description is TBD -// SetFlags sets the PatternFlowRSVPPathRecordRouteType1LabelFlags value in the FlowRSVPPathRecordRouteType1Label object -func (obj *flowRSVPPathRecordRouteType1Label) SetFlags(value PatternFlowRSVPPathRecordRouteType1LabelFlags) FlowRSVPPathRecordRouteType1Label { - - obj.flagsHolder = nil - obj.obj.Flags = value.msg() - - return obj -} - -// description is TBD -// CType returns a PatternFlowRSVPPathRecordRouteType1LabelCType -func (obj *flowRSVPPathRecordRouteType1Label) CType() PatternFlowRSVPPathRecordRouteType1LabelCType { - if obj.obj.CType == nil { - obj.obj.CType = NewPatternFlowRSVPPathRecordRouteType1LabelCType().msg() - } - if obj.cTypeHolder == nil { - obj.cTypeHolder = &patternFlowRSVPPathRecordRouteType1LabelCType{obj: obj.obj.CType} - } - return obj.cTypeHolder -} - -// description is TBD -// CType returns a PatternFlowRSVPPathRecordRouteType1LabelCType -func (obj *flowRSVPPathRecordRouteType1Label) HasCType() bool { - return obj.obj.CType != nil -} - -// description is TBD -// SetCType sets the PatternFlowRSVPPathRecordRouteType1LabelCType value in the FlowRSVPPathRecordRouteType1Label object -func (obj *flowRSVPPathRecordRouteType1Label) SetCType(value PatternFlowRSVPPathRecordRouteType1LabelCType) FlowRSVPPathRecordRouteType1Label { - - obj.cTypeHolder = nil - obj.obj.CType = value.msg() - - return obj -} - -// The contents of the Label Object. Copied from the Label Object. -// Label returns a FlowRSVPPathRecordRouteLabel -func (obj *flowRSVPPathRecordRouteType1Label) Label() FlowRSVPPathRecordRouteLabel { - if obj.obj.Label == nil { - obj.obj.Label = NewFlowRSVPPathRecordRouteLabel().msg() - } - if obj.labelHolder == nil { - obj.labelHolder = &flowRSVPPathRecordRouteLabel{obj: obj.obj.Label} - } - return obj.labelHolder -} - -// The contents of the Label Object. Copied from the Label Object. -// Label returns a FlowRSVPPathRecordRouteLabel -func (obj *flowRSVPPathRecordRouteType1Label) HasLabel() bool { - return obj.obj.Label != nil -} - -// The contents of the Label Object. Copied from the Label Object. -// SetLabel sets the FlowRSVPPathRecordRouteLabel value in the FlowRSVPPathRecordRouteType1Label object -func (obj *flowRSVPPathRecordRouteType1Label) SetLabel(value FlowRSVPPathRecordRouteLabel) FlowRSVPPathRecordRouteType1Label { - - obj.labelHolder = nil - obj.obj.Label = value.msg() - - return obj -} - -func (obj *flowRSVPPathRecordRouteType1Label) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Length != nil { - - obj.Length().validateObj(vObj, set_default) - } - - if obj.obj.Flags != nil { - - obj.Flags().validateObj(vObj, set_default) - } - - if obj.obj.CType != nil { - - obj.CType().validateObj(vObj, set_default) - } - - if obj.obj.Label != nil { - - obj.Label().validateObj(vObj, set_default) - } - -} - -func (obj *flowRSVPPathRecordRouteType1Label) setDefault() { - -} - -// ***** BgpAttributesSegmentRoutingPolicyTypeFlags ***** -type bgpAttributesSegmentRoutingPolicyTypeFlags struct { - validation - obj *otg.BgpAttributesSegmentRoutingPolicyTypeFlags - marshaller marshalBgpAttributesSegmentRoutingPolicyTypeFlags - unMarshaller unMarshalBgpAttributesSegmentRoutingPolicyTypeFlags -} - -func NewBgpAttributesSegmentRoutingPolicyTypeFlags() BgpAttributesSegmentRoutingPolicyTypeFlags { - obj := bgpAttributesSegmentRoutingPolicyTypeFlags{obj: &otg.BgpAttributesSegmentRoutingPolicyTypeFlags{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) msg() *otg.BgpAttributesSegmentRoutingPolicyTypeFlags { - return obj.obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) setMsg(msg *otg.BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeFlags { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSegmentRoutingPolicyTypeFlags struct { - obj *bgpAttributesSegmentRoutingPolicyTypeFlags -} - -type marshalBgpAttributesSegmentRoutingPolicyTypeFlags interface { - // ToProto marshals BgpAttributesSegmentRoutingPolicyTypeFlags to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeFlags - ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeFlags, error) - // ToPbText marshals BgpAttributesSegmentRoutingPolicyTypeFlags to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSegmentRoutingPolicyTypeFlags to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSegmentRoutingPolicyTypeFlags to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSegmentRoutingPolicyTypeFlags struct { - obj *bgpAttributesSegmentRoutingPolicyTypeFlags -} - -type unMarshalBgpAttributesSegmentRoutingPolicyTypeFlags interface { - // FromProto unmarshals BgpAttributesSegmentRoutingPolicyTypeFlags from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeFlags - FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeFlags) (BgpAttributesSegmentRoutingPolicyTypeFlags, error) - // FromPbText unmarshals BgpAttributesSegmentRoutingPolicyTypeFlags from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSegmentRoutingPolicyTypeFlags from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSegmentRoutingPolicyTypeFlags from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeFlags { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeFlags { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSegmentRoutingPolicyTypeFlags{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeFlags) ToProto() (*otg.BgpAttributesSegmentRoutingPolicyTypeFlags, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSegmentRoutingPolicyTypeFlags) FromProto(msg *otg.BgpAttributesSegmentRoutingPolicyTypeFlags) (BgpAttributesSegmentRoutingPolicyTypeFlags, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSegmentRoutingPolicyTypeFlags) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeFlags) 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 *marshalbgpAttributesSegmentRoutingPolicyTypeFlags) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeFlags) 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 *marshalbgpAttributesSegmentRoutingPolicyTypeFlags) 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 *unMarshalbgpAttributesSegmentRoutingPolicyTypeFlags) 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 *bgpAttributesSegmentRoutingPolicyTypeFlags) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) Clone() (BgpAttributesSegmentRoutingPolicyTypeFlags, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSegmentRoutingPolicyTypeFlags() - 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 -} - -// BgpAttributesSegmentRoutingPolicyTypeFlags is flags for each Segment in SEGMENT_LIST sub-tlv. -// - V-flag. Indicates verification is enabled. See section 5, of https://datatracker.ietf.org/doc/html/rfc9256 -// - A-flag. Indicates presence of SR Algorithm field applicable to Segment Types C, D , I , J and K . -// - B-Flag. Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding applicable to Segment Types B , I , J and K . -// - S-Flag: This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. (draft-ietf-idr-bgp-sr-segtypes-ext-03 Section 2.10). -// This flag is applicable for Segment Types C, D, E, F, G, H, I, J, and K. -type BgpAttributesSegmentRoutingPolicyTypeFlags interface { - Validation - // msg marshals BgpAttributesSegmentRoutingPolicyTypeFlags to protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeFlags - // and doesn't set defaults - msg() *otg.BgpAttributesSegmentRoutingPolicyTypeFlags - // setMsg unmarshals BgpAttributesSegmentRoutingPolicyTypeFlags from protobuf object *otg.BgpAttributesSegmentRoutingPolicyTypeFlags - // and doesn't set defaults - setMsg(*otg.BgpAttributesSegmentRoutingPolicyTypeFlags) BgpAttributesSegmentRoutingPolicyTypeFlags - // provides marshal interface - Marshal() marshalBgpAttributesSegmentRoutingPolicyTypeFlags - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSegmentRoutingPolicyTypeFlags - // validate validates BgpAttributesSegmentRoutingPolicyTypeFlags - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSegmentRoutingPolicyTypeFlags, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // VFlag returns bool, set in BgpAttributesSegmentRoutingPolicyTypeFlags. - VFlag() bool - // SetVFlag assigns bool provided by user to BgpAttributesSegmentRoutingPolicyTypeFlags - SetVFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags - // HasVFlag checks if VFlag has been set in BgpAttributesSegmentRoutingPolicyTypeFlags - HasVFlag() bool - // AFlag returns bool, set in BgpAttributesSegmentRoutingPolicyTypeFlags. - AFlag() bool - // SetAFlag assigns bool provided by user to BgpAttributesSegmentRoutingPolicyTypeFlags - SetAFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags - // HasAFlag checks if AFlag has been set in BgpAttributesSegmentRoutingPolicyTypeFlags - HasAFlag() bool - // SFlag returns bool, set in BgpAttributesSegmentRoutingPolicyTypeFlags. - SFlag() bool - // SetSFlag assigns bool provided by user to BgpAttributesSegmentRoutingPolicyTypeFlags - SetSFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags - // HasSFlag checks if SFlag has been set in BgpAttributesSegmentRoutingPolicyTypeFlags - HasSFlag() bool - // BFlag returns bool, set in BgpAttributesSegmentRoutingPolicyTypeFlags. - BFlag() bool - // SetBFlag assigns bool provided by user to BgpAttributesSegmentRoutingPolicyTypeFlags - SetBFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags - // HasBFlag checks if BFlag has been set in BgpAttributesSegmentRoutingPolicyTypeFlags - HasBFlag() bool -} - -// Indicates verification of segment data in is enabled. -// VFlag returns a bool -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) VFlag() bool { - - return *obj.obj.VFlag - -} - -// Indicates verification of segment data in is enabled. -// VFlag returns a bool -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) HasVFlag() bool { - return obj.obj.VFlag != nil -} - -// Indicates verification of segment data in is enabled. -// SetVFlag sets the bool value in the BgpAttributesSegmentRoutingPolicyTypeFlags object -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) SetVFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags { - - obj.obj.VFlag = &value - return obj -} - -// Indicates presence of SR Algorithm field applicable to Segment Types 3, 4, and 9. -// AFlag returns a bool -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) AFlag() bool { - - return *obj.obj.AFlag - -} - -// Indicates presence of SR Algorithm field applicable to Segment Types 3, 4, and 9. -// AFlag returns a bool -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) HasAFlag() bool { - return obj.obj.AFlag != nil -} - -// Indicates presence of SR Algorithm field applicable to Segment Types 3, 4, and 9. -// SetAFlag sets the bool value in the BgpAttributesSegmentRoutingPolicyTypeFlags object -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) SetAFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags { - - obj.obj.AFlag = &value - return obj -} - -// This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. -// SFlag returns a bool -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) SFlag() bool { - - return *obj.obj.SFlag - -} - -// This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. -// SFlag returns a bool -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) HasSFlag() bool { - return obj.obj.SFlag != nil -} - -// This flag, when set, indicates the presence of the SR-MPLS or SRv6 SID depending on the segment type. -// SetSFlag sets the bool value in the BgpAttributesSegmentRoutingPolicyTypeFlags object -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) SetSFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags { - - obj.obj.SFlag = &value - return obj -} - -// Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding specified in Section 2.4.4.2.4 -// of draft-ietf-idr-sr-policy-safi-02. -// BFlag returns a bool -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) BFlag() bool { - - return *obj.obj.BFlag - -} - -// Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding specified in Section 2.4.4.2.4 -// of draft-ietf-idr-sr-policy-safi-02. -// BFlag returns a bool -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) HasBFlag() bool { - return obj.obj.BFlag != nil -} - -// Indicates presence of SRv6 Endpoint Behavior and SID Structure encoding specified in Section 2.4.4.2.4 -// of draft-ietf-idr-sr-policy-safi-02. -// SetBFlag sets the bool value in the BgpAttributesSegmentRoutingPolicyTypeFlags object -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) SetBFlag(value bool) BgpAttributesSegmentRoutingPolicyTypeFlags { - - obj.obj.BFlag = &value - return obj -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *bgpAttributesSegmentRoutingPolicyTypeFlags) setDefault() { - if obj.obj.VFlag == nil { - obj.SetVFlag(false) - } - if obj.obj.AFlag == nil { - obj.SetAFlag(false) - } - if obj.obj.SFlag == nil { - obj.SetSFlag(false) - } - if obj.obj.BFlag == nil { - obj.SetBFlag(false) - } - -} - -// ***** BgpAttributesSidSrv6 ***** -type bgpAttributesSidSrv6 struct { - validation - obj *otg.BgpAttributesSidSrv6 - marshaller marshalBgpAttributesSidSrv6 - unMarshaller unMarshalBgpAttributesSidSrv6 -} - -func NewBgpAttributesSidSrv6() BgpAttributesSidSrv6 { - obj := bgpAttributesSidSrv6{obj: &otg.BgpAttributesSidSrv6{}} - obj.setDefault() - return &obj -} - -func (obj *bgpAttributesSidSrv6) msg() *otg.BgpAttributesSidSrv6 { - return obj.obj -} - -func (obj *bgpAttributesSidSrv6) setMsg(msg *otg.BgpAttributesSidSrv6) BgpAttributesSidSrv6 { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalbgpAttributesSidSrv6 struct { - obj *bgpAttributesSidSrv6 -} - -type marshalBgpAttributesSidSrv6 interface { - // ToProto marshals BgpAttributesSidSrv6 to protobuf object *otg.BgpAttributesSidSrv6 - ToProto() (*otg.BgpAttributesSidSrv6, error) - // ToPbText marshals BgpAttributesSidSrv6 to protobuf text - ToPbText() (string, error) - // ToYaml marshals BgpAttributesSidSrv6 to YAML text - ToYaml() (string, error) - // ToJson marshals BgpAttributesSidSrv6 to JSON text - ToJson() (string, error) -} - -type unMarshalbgpAttributesSidSrv6 struct { - obj *bgpAttributesSidSrv6 -} - -type unMarshalBgpAttributesSidSrv6 interface { - // FromProto unmarshals BgpAttributesSidSrv6 from protobuf object *otg.BgpAttributesSidSrv6 - FromProto(msg *otg.BgpAttributesSidSrv6) (BgpAttributesSidSrv6, error) - // FromPbText unmarshals BgpAttributesSidSrv6 from protobuf text - FromPbText(value string) error - // FromYaml unmarshals BgpAttributesSidSrv6 from YAML text - FromYaml(value string) error - // FromJson unmarshals BgpAttributesSidSrv6 from JSON text - FromJson(value string) error -} - -func (obj *bgpAttributesSidSrv6) Marshal() marshalBgpAttributesSidSrv6 { - if obj.marshaller == nil { - obj.marshaller = &marshalbgpAttributesSidSrv6{obj: obj} - } - return obj.marshaller -} - -func (obj *bgpAttributesSidSrv6) Unmarshal() unMarshalBgpAttributesSidSrv6 { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalbgpAttributesSidSrv6{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalbgpAttributesSidSrv6) ToProto() (*otg.BgpAttributesSidSrv6, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalbgpAttributesSidSrv6) FromProto(msg *otg.BgpAttributesSidSrv6) (BgpAttributesSidSrv6, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalbgpAttributesSidSrv6) 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 *unMarshalbgpAttributesSidSrv6) 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 *marshalbgpAttributesSidSrv6) 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 *unMarshalbgpAttributesSidSrv6) 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 *marshalbgpAttributesSidSrv6) 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 *unMarshalbgpAttributesSidSrv6) 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 *bgpAttributesSidSrv6) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *bgpAttributesSidSrv6) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *bgpAttributesSidSrv6) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *bgpAttributesSidSrv6) Clone() (BgpAttributesSidSrv6, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewBgpAttributesSidSrv6() - 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 -} - -// BgpAttributesSidSrv6 is an IPv6 address denoting a SRv6 SID. -type BgpAttributesSidSrv6 interface { - Validation - // msg marshals BgpAttributesSidSrv6 to protobuf object *otg.BgpAttributesSidSrv6 - // and doesn't set defaults - msg() *otg.BgpAttributesSidSrv6 - // setMsg unmarshals BgpAttributesSidSrv6 from protobuf object *otg.BgpAttributesSidSrv6 - // and doesn't set defaults - setMsg(*otg.BgpAttributesSidSrv6) BgpAttributesSidSrv6 - // provides marshal interface - Marshal() marshalBgpAttributesSidSrv6 - // provides unmarshal interface - Unmarshal() unMarshalBgpAttributesSidSrv6 - // validate validates BgpAttributesSidSrv6 - validate() error - // A stringer function - String() string - // Clones the object - Clone() (BgpAttributesSidSrv6, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Ip returns string, set in BgpAttributesSidSrv6. - Ip() string - // SetIp assigns string provided by user to BgpAttributesSidSrv6 - SetIp(value string) BgpAttributesSidSrv6 - // HasIp checks if Ip has been set in BgpAttributesSidSrv6 - HasIp() bool -} - -// description is TBD -// Ip returns a string -func (obj *bgpAttributesSidSrv6) Ip() string { - - return *obj.obj.Ip - -} - -// description is TBD -// Ip returns a string -func (obj *bgpAttributesSidSrv6) HasIp() bool { - return obj.obj.Ip != nil -} - -// description is TBD -// SetIp sets the string value in the BgpAttributesSidSrv6 object -func (obj *bgpAttributesSidSrv6) SetIp(value string) BgpAttributesSidSrv6 { - - obj.obj.Ip = &value - return obj -} - -func (obj *bgpAttributesSidSrv6) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Ip != nil { - - err := obj.validateIpv6(obj.Ip()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on BgpAttributesSidSrv6.Ip")) - } - - } - -} - -func (obj *bgpAttributesSidSrv6) setDefault() { - if obj.obj.Ip == nil { - obj.SetIp("0::0") - } - -} - -// ***** PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit ***** -type patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit struct { - validation - obj *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - marshaller marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - unMarshaller unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - incrementHolder PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - decrementHolder PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter -} - -func NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { - obj := patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit{obj: &otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { - return obj.obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) setMsg(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit struct { - obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit -} - -type marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit interface { - // ToProto marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit, error) - // ToPbText marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit struct { - obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit -} - -type unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit interface { - // FromProto unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit, error) - // FromPbText unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit() - 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 -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit is the L bit is an attribute of the subobject. The L bit is set if the subobject represents a loose hop in the explicit route. If the bit is not set, the subobject represents a strict hop in the explicit route. -type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit interface { - Validation - // msg marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - // setMsg unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - // validate validates PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - Choice() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum - // setChoice assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - setChoice(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - // HasChoice checks if Choice has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - SetValue(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - // HasValue checks if Value has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - SetValues(value []uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - // Increment returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit. - // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter is integer counter pattern - Increment() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - // SetIncrement assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit. - // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit. - // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter is integer counter pattern - Decrement() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - // SetDecrement assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit. - // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit -var PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice = struct { - VALUE PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum - VALUES PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum - INCREMENT PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum - DECREMENT PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum -}{ - VALUE: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum("value"), - VALUES: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Choice() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum { - return PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) setChoice(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { - intValue, ok := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter().msg() - } - - if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit object -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) SetValue(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit object -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) SetValues(value []uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Increment() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit object -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) SetIncrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Decrement() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit object -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) SetDecrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit") - } - } else { - intVal := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPExplicitRouteLength ***** -type flowRSVPExplicitRouteLength struct { - validation - obj *otg.FlowRSVPExplicitRouteLength - marshaller marshalFlowRSVPExplicitRouteLength - unMarshaller unMarshalFlowRSVPExplicitRouteLength -} - -func NewFlowRSVPExplicitRouteLength() FlowRSVPExplicitRouteLength { - obj := flowRSVPExplicitRouteLength{obj: &otg.FlowRSVPExplicitRouteLength{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPExplicitRouteLength) msg() *otg.FlowRSVPExplicitRouteLength { - return obj.obj -} - -func (obj *flowRSVPExplicitRouteLength) setMsg(msg *otg.FlowRSVPExplicitRouteLength) FlowRSVPExplicitRouteLength { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPExplicitRouteLength struct { - obj *flowRSVPExplicitRouteLength -} - -type marshalFlowRSVPExplicitRouteLength interface { - // ToProto marshals FlowRSVPExplicitRouteLength to protobuf object *otg.FlowRSVPExplicitRouteLength - ToProto() (*otg.FlowRSVPExplicitRouteLength, error) - // ToPbText marshals FlowRSVPExplicitRouteLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPExplicitRouteLength to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPExplicitRouteLength to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPExplicitRouteLength struct { - obj *flowRSVPExplicitRouteLength -} - -type unMarshalFlowRSVPExplicitRouteLength interface { - // FromProto unmarshals FlowRSVPExplicitRouteLength from protobuf object *otg.FlowRSVPExplicitRouteLength - FromProto(msg *otg.FlowRSVPExplicitRouteLength) (FlowRSVPExplicitRouteLength, error) - // FromPbText unmarshals FlowRSVPExplicitRouteLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPExplicitRouteLength from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPExplicitRouteLength from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPExplicitRouteLength) Marshal() marshalFlowRSVPExplicitRouteLength { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPExplicitRouteLength{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPExplicitRouteLength) Unmarshal() unMarshalFlowRSVPExplicitRouteLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPExplicitRouteLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPExplicitRouteLength) ToProto() (*otg.FlowRSVPExplicitRouteLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPExplicitRouteLength) FromProto(msg *otg.FlowRSVPExplicitRouteLength) (FlowRSVPExplicitRouteLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPExplicitRouteLength) 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 *unMarshalflowRSVPExplicitRouteLength) 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 *marshalflowRSVPExplicitRouteLength) 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 *unMarshalflowRSVPExplicitRouteLength) 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 *marshalflowRSVPExplicitRouteLength) 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 *unMarshalflowRSVPExplicitRouteLength) 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 *flowRSVPExplicitRouteLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPExplicitRouteLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPExplicitRouteLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPExplicitRouteLength) Clone() (FlowRSVPExplicitRouteLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPExplicitRouteLength() - 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 -} - -// FlowRSVPExplicitRouteLength is description is TBD -type FlowRSVPExplicitRouteLength interface { - Validation - // msg marshals FlowRSVPExplicitRouteLength to protobuf object *otg.FlowRSVPExplicitRouteLength - // and doesn't set defaults - msg() *otg.FlowRSVPExplicitRouteLength - // setMsg unmarshals FlowRSVPExplicitRouteLength from protobuf object *otg.FlowRSVPExplicitRouteLength - // and doesn't set defaults - setMsg(*otg.FlowRSVPExplicitRouteLength) FlowRSVPExplicitRouteLength - // provides marshal interface - Marshal() marshalFlowRSVPExplicitRouteLength - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPExplicitRouteLength - // validate validates FlowRSVPExplicitRouteLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPExplicitRouteLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPExplicitRouteLengthChoiceEnum, set in FlowRSVPExplicitRouteLength - Choice() FlowRSVPExplicitRouteLengthChoiceEnum - // setChoice assigns FlowRSVPExplicitRouteLengthChoiceEnum provided by user to FlowRSVPExplicitRouteLength - setChoice(value FlowRSVPExplicitRouteLengthChoiceEnum) FlowRSVPExplicitRouteLength - // HasChoice checks if Choice has been set in FlowRSVPExplicitRouteLength - HasChoice() bool - // Auto returns uint32, set in FlowRSVPExplicitRouteLength. - Auto() uint32 - // HasAuto checks if Auto has been set in FlowRSVPExplicitRouteLength - HasAuto() bool - // Value returns uint32, set in FlowRSVPExplicitRouteLength. - Value() uint32 - // SetValue assigns uint32 provided by user to FlowRSVPExplicitRouteLength - SetValue(value uint32) FlowRSVPExplicitRouteLength - // HasValue checks if Value has been set in FlowRSVPExplicitRouteLength - HasValue() bool -} - -type FlowRSVPExplicitRouteLengthChoiceEnum string - -// Enum of Choice on FlowRSVPExplicitRouteLength -var FlowRSVPExplicitRouteLengthChoice = struct { - AUTO FlowRSVPExplicitRouteLengthChoiceEnum - VALUE FlowRSVPExplicitRouteLengthChoiceEnum -}{ - AUTO: FlowRSVPExplicitRouteLengthChoiceEnum("auto"), - VALUE: FlowRSVPExplicitRouteLengthChoiceEnum("value"), -} - -func (obj *flowRSVPExplicitRouteLength) Choice() FlowRSVPExplicitRouteLengthChoiceEnum { - return FlowRSVPExplicitRouteLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// auto or configured value. -// Choice returns a string -func (obj *flowRSVPExplicitRouteLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPExplicitRouteLength) setChoice(value FlowRSVPExplicitRouteLengthChoiceEnum) FlowRSVPExplicitRouteLength { - intValue, ok := otg.FlowRSVPExplicitRouteLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPExplicitRouteLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPExplicitRouteLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Value = nil - obj.obj.Auto = nil - - if value == FlowRSVPExplicitRouteLengthChoice.AUTO { - defaultValue := uint32(8) - obj.obj.Auto = &defaultValue - } - - if value == FlowRSVPExplicitRouteLengthChoice.VALUE { - defaultValue := uint32(8) - obj.obj.Value = &defaultValue - } - - return obj -} - -// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. -// Auto returns a uint32 -func (obj *flowRSVPExplicitRouteLength) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(FlowRSVPExplicitRouteLengthChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. -// Auto returns a uint32 -func (obj *flowRSVPExplicitRouteLength) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Value returns a uint32 -func (obj *flowRSVPExplicitRouteLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(FlowRSVPExplicitRouteLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *flowRSVPExplicitRouteLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the FlowRSVPExplicitRouteLength object -func (obj *flowRSVPExplicitRouteLength) SetValue(value uint32) FlowRSVPExplicitRouteLength { - obj.setChoice(FlowRSVPExplicitRouteLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -func (obj *flowRSVPExplicitRouteLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowRSVPExplicitRouteLength.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - -} - -func (obj *flowRSVPExplicitRouteLength) setDefault() { - var choices_set int = 0 - var choice FlowRSVPExplicitRouteLengthChoiceEnum - - if obj.obj.Auto != nil { - choices_set += 1 - choice = FlowRSVPExplicitRouteLengthChoice.AUTO - } - - if obj.obj.Value != nil { - choices_set += 1 - choice = FlowRSVPExplicitRouteLengthChoice.VALUE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPExplicitRouteLengthChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPExplicitRouteLength") - } - } else { - intVal := otg.FlowRSVPExplicitRouteLength_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPExplicitRouteLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address ***** -type patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address struct { - validation - obj *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - marshaller marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - unMarshaller unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - incrementHolder PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - decrementHolder PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter -} - -func NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { - obj := patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address{obj: &otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { - return obj.obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) setMsg(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address struct { - obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address -} - -type marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address interface { - // ToProto marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address, error) - // ToPbText marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address struct { - obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address -} - -type unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address interface { - // FromProto unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address, error) - // FromPbText unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address() - 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 -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address is this IPv4 address is treated as a prefix based on the prefix length value below. Bits beyond the prefix are ignored on receipt and SHOULD be set to zero on transmission. -type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address interface { - Validation - // msg marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - // setMsg unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - // validate validates PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - Choice() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum - // setChoice assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - setChoice(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - // HasChoice checks if Choice has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - HasChoice() bool - // Value returns string, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address. - Value() string - // SetValue assigns string provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - SetValue(value string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - // HasValue checks if Value has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - HasValue() bool - // Values returns []string, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address. - Values() []string - // SetValues assigns []string provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - SetValues(value []string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - // Increment returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address. - // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter is ipv4 counter pattern - Increment() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - // SetIncrement assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address. - // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter is ipv4 counter pattern - SetIncrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address. - // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter is ipv4 counter pattern - Decrement() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - // SetDecrement assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address. - // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter is ipv4 counter pattern - SetDecrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address -var PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice = struct { - VALUE PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum - VALUES PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum - INCREMENT PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum - DECREMENT PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum -}{ - VALUE: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum("value"), - VALUES: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Choice() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum { - return PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) setChoice(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { - intValue, ok := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUE { - defaultValue := "0.0.0.0" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUES { - defaultValue := []string{"0.0.0.0"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter().msg() - } - - if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address object -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) SetValue(value string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"0.0.0.0"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address object -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) SetValues(value []string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Increment() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address object -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) SetIncrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Decrement() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address object -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) SetDecrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv4(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateIpv4Slice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address") - } - } else { - intVal := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathExplicitRouteType1ASNumberLBit ***** -type patternFlowRSVPPathExplicitRouteType1ASNumberLBit struct { - validation - obj *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - marshaller marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit - unMarshaller unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit - incrementHolder PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - decrementHolder PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter -} - -func NewPatternFlowRSVPPathExplicitRouteType1ASNumberLBit() PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { - obj := patternFlowRSVPPathExplicitRouteType1ASNumberLBit{obj: &otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) msg() *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { - return obj.obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) setMsg(msg *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit struct { - obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit -} - -type marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit interface { - // ToProto marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit, error) - // ToPbText marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit struct { - obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit -} - -type unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit interface { - // FromProto unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) (PatternFlowRSVPPathExplicitRouteType1ASNumberLBit, error) - // FromPbText unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Marshal() marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) (PatternFlowRSVPPathExplicitRouteType1ASNumberLBit, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Clone() (PatternFlowRSVPPathExplicitRouteType1ASNumberLBit, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathExplicitRouteType1ASNumberLBit() - 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 -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathExplicitRouteType1ASNumberLBit is the L bit is an attribute of the subobject. The L bit is set if the subobject represents a loose hop in the explicit route. If the bit is not set, the subobject represents a strict hop in the explicit route. -type PatternFlowRSVPPathExplicitRouteType1ASNumberLBit interface { - Validation - // msg marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - // setMsg unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit - // validate validates PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathExplicitRouteType1ASNumberLBit, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - Choice() PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum - // setChoice assigns PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - setChoice(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - // HasChoice checks if Choice has been set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - SetValue(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - // HasValue checks if Value has been set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - SetValues(value []uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - // Increment returns PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit. - // PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter is integer counter pattern - Increment() PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - // SetIncrement assigns PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBit. - // PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit. - // PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter is integer counter pattern - Decrement() PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - // SetDecrement assigns PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBit. - // PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathExplicitRouteType1ASNumberLBit -var PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice = struct { - VALUE PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum - VALUES PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum - INCREMENT PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum - DECREMENT PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum -}{ - VALUE: PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum("value"), - VALUES: PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Choice() PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum { - return PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) setChoice(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { - intValue, ok := otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUE { - defaultValue := uint32(0) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUES { - defaultValue := []uint32{0} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter().msg() - } - - if value == PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1ASNumberLBit object -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) SetValue(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{0}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathExplicitRouteType1ASNumberLBit object -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) SetValues(value []uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Increment() PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter value in the PatternFlowRSVPPathExplicitRouteType1ASNumberLBit object -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) SetIncrement(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Decrement() PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter value in the PatternFlowRSVPPathExplicitRouteType1ASNumberLBit object -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) SetDecrement(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.Value <= 1 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.Values <= 1 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit") - } - } else { - intVal := otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPExplicitRouteASNumberLength ***** -type flowRSVPExplicitRouteASNumberLength struct { - validation - obj *otg.FlowRSVPExplicitRouteASNumberLength - marshaller marshalFlowRSVPExplicitRouteASNumberLength - unMarshaller unMarshalFlowRSVPExplicitRouteASNumberLength -} - -func NewFlowRSVPExplicitRouteASNumberLength() FlowRSVPExplicitRouteASNumberLength { - obj := flowRSVPExplicitRouteASNumberLength{obj: &otg.FlowRSVPExplicitRouteASNumberLength{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPExplicitRouteASNumberLength) msg() *otg.FlowRSVPExplicitRouteASNumberLength { - return obj.obj -} - -func (obj *flowRSVPExplicitRouteASNumberLength) setMsg(msg *otg.FlowRSVPExplicitRouteASNumberLength) FlowRSVPExplicitRouteASNumberLength { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPExplicitRouteASNumberLength struct { - obj *flowRSVPExplicitRouteASNumberLength -} - -type marshalFlowRSVPExplicitRouteASNumberLength interface { - // ToProto marshals FlowRSVPExplicitRouteASNumberLength to protobuf object *otg.FlowRSVPExplicitRouteASNumberLength - ToProto() (*otg.FlowRSVPExplicitRouteASNumberLength, error) - // ToPbText marshals FlowRSVPExplicitRouteASNumberLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPExplicitRouteASNumberLength to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPExplicitRouteASNumberLength to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPExplicitRouteASNumberLength struct { - obj *flowRSVPExplicitRouteASNumberLength -} - -type unMarshalFlowRSVPExplicitRouteASNumberLength interface { - // FromProto unmarshals FlowRSVPExplicitRouteASNumberLength from protobuf object *otg.FlowRSVPExplicitRouteASNumberLength - FromProto(msg *otg.FlowRSVPExplicitRouteASNumberLength) (FlowRSVPExplicitRouteASNumberLength, error) - // FromPbText unmarshals FlowRSVPExplicitRouteASNumberLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPExplicitRouteASNumberLength from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPExplicitRouteASNumberLength from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPExplicitRouteASNumberLength) Marshal() marshalFlowRSVPExplicitRouteASNumberLength { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPExplicitRouteASNumberLength{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPExplicitRouteASNumberLength) Unmarshal() unMarshalFlowRSVPExplicitRouteASNumberLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPExplicitRouteASNumberLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPExplicitRouteASNumberLength) ToProto() (*otg.FlowRSVPExplicitRouteASNumberLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPExplicitRouteASNumberLength) FromProto(msg *otg.FlowRSVPExplicitRouteASNumberLength) (FlowRSVPExplicitRouteASNumberLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPExplicitRouteASNumberLength) 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 *unMarshalflowRSVPExplicitRouteASNumberLength) 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 *marshalflowRSVPExplicitRouteASNumberLength) 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 *unMarshalflowRSVPExplicitRouteASNumberLength) 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 *marshalflowRSVPExplicitRouteASNumberLength) 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 *unMarshalflowRSVPExplicitRouteASNumberLength) 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 *flowRSVPExplicitRouteASNumberLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPExplicitRouteASNumberLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPExplicitRouteASNumberLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPExplicitRouteASNumberLength) Clone() (FlowRSVPExplicitRouteASNumberLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPExplicitRouteASNumberLength() - 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 -} - -// FlowRSVPExplicitRouteASNumberLength is description is TBD -type FlowRSVPExplicitRouteASNumberLength interface { - Validation - // msg marshals FlowRSVPExplicitRouteASNumberLength to protobuf object *otg.FlowRSVPExplicitRouteASNumberLength - // and doesn't set defaults - msg() *otg.FlowRSVPExplicitRouteASNumberLength - // setMsg unmarshals FlowRSVPExplicitRouteASNumberLength from protobuf object *otg.FlowRSVPExplicitRouteASNumberLength - // and doesn't set defaults - setMsg(*otg.FlowRSVPExplicitRouteASNumberLength) FlowRSVPExplicitRouteASNumberLength - // provides marshal interface - Marshal() marshalFlowRSVPExplicitRouteASNumberLength - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPExplicitRouteASNumberLength - // validate validates FlowRSVPExplicitRouteASNumberLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPExplicitRouteASNumberLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPExplicitRouteASNumberLengthChoiceEnum, set in FlowRSVPExplicitRouteASNumberLength - Choice() FlowRSVPExplicitRouteASNumberLengthChoiceEnum - // setChoice assigns FlowRSVPExplicitRouteASNumberLengthChoiceEnum provided by user to FlowRSVPExplicitRouteASNumberLength - setChoice(value FlowRSVPExplicitRouteASNumberLengthChoiceEnum) FlowRSVPExplicitRouteASNumberLength - // HasChoice checks if Choice has been set in FlowRSVPExplicitRouteASNumberLength - HasChoice() bool - // Auto returns uint32, set in FlowRSVPExplicitRouteASNumberLength. - Auto() uint32 - // HasAuto checks if Auto has been set in FlowRSVPExplicitRouteASNumberLength - HasAuto() bool - // Value returns uint32, set in FlowRSVPExplicitRouteASNumberLength. - Value() uint32 - // SetValue assigns uint32 provided by user to FlowRSVPExplicitRouteASNumberLength - SetValue(value uint32) FlowRSVPExplicitRouteASNumberLength - // HasValue checks if Value has been set in FlowRSVPExplicitRouteASNumberLength - HasValue() bool -} - -type FlowRSVPExplicitRouteASNumberLengthChoiceEnum string - -// Enum of Choice on FlowRSVPExplicitRouteASNumberLength -var FlowRSVPExplicitRouteASNumberLengthChoice = struct { - AUTO FlowRSVPExplicitRouteASNumberLengthChoiceEnum - VALUE FlowRSVPExplicitRouteASNumberLengthChoiceEnum -}{ - AUTO: FlowRSVPExplicitRouteASNumberLengthChoiceEnum("auto"), - VALUE: FlowRSVPExplicitRouteASNumberLengthChoiceEnum("value"), -} - -func (obj *flowRSVPExplicitRouteASNumberLength) Choice() FlowRSVPExplicitRouteASNumberLengthChoiceEnum { - return FlowRSVPExplicitRouteASNumberLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// auto or configured value. -// Choice returns a string -func (obj *flowRSVPExplicitRouteASNumberLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPExplicitRouteASNumberLength) setChoice(value FlowRSVPExplicitRouteASNumberLengthChoiceEnum) FlowRSVPExplicitRouteASNumberLength { - intValue, ok := otg.FlowRSVPExplicitRouteASNumberLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPExplicitRouteASNumberLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPExplicitRouteASNumberLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Value = nil - obj.obj.Auto = nil - - if value == FlowRSVPExplicitRouteASNumberLengthChoice.AUTO { - defaultValue := uint32(4) - obj.obj.Auto = &defaultValue - } - - if value == FlowRSVPExplicitRouteASNumberLengthChoice.VALUE { - defaultValue := uint32(4) - obj.obj.Value = &defaultValue - } - - return obj -} - -// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. -// Auto returns a uint32 -func (obj *flowRSVPExplicitRouteASNumberLength) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(FlowRSVPExplicitRouteASNumberLengthChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. -// Auto returns a uint32 -func (obj *flowRSVPExplicitRouteASNumberLength) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Value returns a uint32 -func (obj *flowRSVPExplicitRouteASNumberLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(FlowRSVPExplicitRouteASNumberLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *flowRSVPExplicitRouteASNumberLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the FlowRSVPExplicitRouteASNumberLength object -func (obj *flowRSVPExplicitRouteASNumberLength) SetValue(value uint32) FlowRSVPExplicitRouteASNumberLength { - obj.setChoice(FlowRSVPExplicitRouteASNumberLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -func (obj *flowRSVPExplicitRouteASNumberLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowRSVPExplicitRouteASNumberLength.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - -} - -func (obj *flowRSVPExplicitRouteASNumberLength) setDefault() { - var choices_set int = 0 - var choice FlowRSVPExplicitRouteASNumberLengthChoiceEnum - - if obj.obj.Auto != nil { - choices_set += 1 - choice = FlowRSVPExplicitRouteASNumberLengthChoice.AUTO - } - - if obj.obj.Value != nil { - choices_set += 1 - choice = FlowRSVPExplicitRouteASNumberLengthChoice.VALUE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPExplicitRouteASNumberLengthChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPExplicitRouteASNumberLength") - } - } else { - intVal := otg.FlowRSVPExplicitRouteASNumberLength_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPExplicitRouteASNumberLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPRouteRecordLength ***** -type flowRSVPRouteRecordLength struct { - validation - obj *otg.FlowRSVPRouteRecordLength - marshaller marshalFlowRSVPRouteRecordLength - unMarshaller unMarshalFlowRSVPRouteRecordLength -} - -func NewFlowRSVPRouteRecordLength() FlowRSVPRouteRecordLength { - obj := flowRSVPRouteRecordLength{obj: &otg.FlowRSVPRouteRecordLength{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPRouteRecordLength) msg() *otg.FlowRSVPRouteRecordLength { - return obj.obj -} - -func (obj *flowRSVPRouteRecordLength) setMsg(msg *otg.FlowRSVPRouteRecordLength) FlowRSVPRouteRecordLength { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPRouteRecordLength struct { - obj *flowRSVPRouteRecordLength -} - -type marshalFlowRSVPRouteRecordLength interface { - // ToProto marshals FlowRSVPRouteRecordLength to protobuf object *otg.FlowRSVPRouteRecordLength - ToProto() (*otg.FlowRSVPRouteRecordLength, error) - // ToPbText marshals FlowRSVPRouteRecordLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPRouteRecordLength to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPRouteRecordLength to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPRouteRecordLength struct { - obj *flowRSVPRouteRecordLength -} - -type unMarshalFlowRSVPRouteRecordLength interface { - // FromProto unmarshals FlowRSVPRouteRecordLength from protobuf object *otg.FlowRSVPRouteRecordLength - FromProto(msg *otg.FlowRSVPRouteRecordLength) (FlowRSVPRouteRecordLength, error) - // FromPbText unmarshals FlowRSVPRouteRecordLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPRouteRecordLength from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPRouteRecordLength from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPRouteRecordLength) Marshal() marshalFlowRSVPRouteRecordLength { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPRouteRecordLength{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPRouteRecordLength) Unmarshal() unMarshalFlowRSVPRouteRecordLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPRouteRecordLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPRouteRecordLength) ToProto() (*otg.FlowRSVPRouteRecordLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPRouteRecordLength) FromProto(msg *otg.FlowRSVPRouteRecordLength) (FlowRSVPRouteRecordLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPRouteRecordLength) 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 *unMarshalflowRSVPRouteRecordLength) 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 *marshalflowRSVPRouteRecordLength) 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 *unMarshalflowRSVPRouteRecordLength) 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 *marshalflowRSVPRouteRecordLength) 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 *unMarshalflowRSVPRouteRecordLength) 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 *flowRSVPRouteRecordLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPRouteRecordLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPRouteRecordLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPRouteRecordLength) Clone() (FlowRSVPRouteRecordLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPRouteRecordLength() - 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 -} - -// FlowRSVPRouteRecordLength is description is TBD -type FlowRSVPRouteRecordLength interface { - Validation - // msg marshals FlowRSVPRouteRecordLength to protobuf object *otg.FlowRSVPRouteRecordLength - // and doesn't set defaults - msg() *otg.FlowRSVPRouteRecordLength - // setMsg unmarshals FlowRSVPRouteRecordLength from protobuf object *otg.FlowRSVPRouteRecordLength - // and doesn't set defaults - setMsg(*otg.FlowRSVPRouteRecordLength) FlowRSVPRouteRecordLength - // provides marshal interface - Marshal() marshalFlowRSVPRouteRecordLength - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPRouteRecordLength - // validate validates FlowRSVPRouteRecordLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPRouteRecordLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPRouteRecordLengthChoiceEnum, set in FlowRSVPRouteRecordLength - Choice() FlowRSVPRouteRecordLengthChoiceEnum - // setChoice assigns FlowRSVPRouteRecordLengthChoiceEnum provided by user to FlowRSVPRouteRecordLength - setChoice(value FlowRSVPRouteRecordLengthChoiceEnum) FlowRSVPRouteRecordLength - // HasChoice checks if Choice has been set in FlowRSVPRouteRecordLength - HasChoice() bool - // Auto returns uint32, set in FlowRSVPRouteRecordLength. - Auto() uint32 - // HasAuto checks if Auto has been set in FlowRSVPRouteRecordLength - HasAuto() bool - // Value returns uint32, set in FlowRSVPRouteRecordLength. - Value() uint32 - // SetValue assigns uint32 provided by user to FlowRSVPRouteRecordLength - SetValue(value uint32) FlowRSVPRouteRecordLength - // HasValue checks if Value has been set in FlowRSVPRouteRecordLength - HasValue() bool -} - -type FlowRSVPRouteRecordLengthChoiceEnum string - -// Enum of Choice on FlowRSVPRouteRecordLength -var FlowRSVPRouteRecordLengthChoice = struct { - AUTO FlowRSVPRouteRecordLengthChoiceEnum - VALUE FlowRSVPRouteRecordLengthChoiceEnum -}{ - AUTO: FlowRSVPRouteRecordLengthChoiceEnum("auto"), - VALUE: FlowRSVPRouteRecordLengthChoiceEnum("value"), -} - -func (obj *flowRSVPRouteRecordLength) Choice() FlowRSVPRouteRecordLengthChoiceEnum { - return FlowRSVPRouteRecordLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// auto or configured value. -// Choice returns a string -func (obj *flowRSVPRouteRecordLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPRouteRecordLength) setChoice(value FlowRSVPRouteRecordLengthChoiceEnum) FlowRSVPRouteRecordLength { - intValue, ok := otg.FlowRSVPRouteRecordLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPRouteRecordLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPRouteRecordLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Value = nil - obj.obj.Auto = nil - - if value == FlowRSVPRouteRecordLengthChoice.AUTO { - defaultValue := uint32(8) - obj.obj.Auto = &defaultValue - } - - if value == FlowRSVPRouteRecordLengthChoice.VALUE { - defaultValue := uint32(8) - obj.obj.Value = &defaultValue - } - - return obj -} - -// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. -// Auto returns a uint32 -func (obj *flowRSVPRouteRecordLength) Auto() uint32 { - - if obj.obj.Auto == nil { - obj.setChoice(FlowRSVPRouteRecordLengthChoice.AUTO) - } - - return *obj.obj.Auto - -} - -// The OTG implementation will provide a system generated value for this property. If the OTG implementation is unable to generate a value the default value must be used. -// Auto returns a uint32 -func (obj *flowRSVPRouteRecordLength) HasAuto() bool { - return obj.obj.Auto != nil -} - -// description is TBD -// Value returns a uint32 -func (obj *flowRSVPRouteRecordLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(FlowRSVPRouteRecordLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *flowRSVPRouteRecordLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the FlowRSVPRouteRecordLength object -func (obj *flowRSVPRouteRecordLength) SetValue(value uint32) FlowRSVPRouteRecordLength { - obj.setChoice(FlowRSVPRouteRecordLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -func (obj *flowRSVPRouteRecordLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowRSVPRouteRecordLength.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - -} - -func (obj *flowRSVPRouteRecordLength) setDefault() { - var choices_set int = 0 - var choice FlowRSVPRouteRecordLengthChoiceEnum - - if obj.obj.Auto != nil { - choices_set += 1 - choice = FlowRSVPRouteRecordLengthChoice.AUTO - } - - if obj.obj.Value != nil { - choices_set += 1 - choice = FlowRSVPRouteRecordLengthChoice.VALUE - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPRouteRecordLengthChoice.AUTO) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPRouteRecordLength") - } - } else { - intVal := otg.FlowRSVPRouteRecordLength_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPRouteRecordLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address ***** -type patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address struct { - validation - obj *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - marshaller marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - unMarshaller unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - incrementHolder PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - decrementHolder PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter -} - -func NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { - obj := patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address{obj: &otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { - return obj.obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) setMsg(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address struct { - obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address -} - -type marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address interface { - // ToProto marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address, error) - // ToPbText marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address struct { - obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address -} - -type unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address interface { - // FromProto unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address, error) - // FromPbText unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address() - 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 -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address is a 32-bit unicast, host address. Any network-reachable interface address is allowed here. Illegal addresses, such as certain loopback addresses, SHOULD NOT be used. -type PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address interface { - Validation - // msg marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - // setMsg unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - // validate validates PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - Choice() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum - // setChoice assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - setChoice(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - // HasChoice checks if Choice has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - HasChoice() bool - // Value returns string, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address. - Value() string - // SetValue assigns string provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - SetValue(value string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - // HasValue checks if Value has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - HasValue() bool - // Values returns []string, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address. - Values() []string - // SetValues assigns []string provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - SetValues(value []string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - // Increment returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address. - // PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter is ipv4 counter pattern - Increment() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - // SetIncrement assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address. - // PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter is ipv4 counter pattern - SetIncrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address. - // PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter is ipv4 counter pattern - Decrement() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - // SetDecrement assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address. - // PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter is ipv4 counter pattern - SetDecrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address -var PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice = struct { - VALUE PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum - VALUES PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum - INCREMENT PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum - DECREMENT PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum -}{ - VALUE: PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum("value"), - VALUES: PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Choice() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum { - return PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) setChoice(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { - intValue, ok := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUE { - defaultValue := "0.0.0.0" - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUES { - defaultValue := []string{"0.0.0.0"} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter().msg() - } - - if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a string -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Value() string { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a string -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the string value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address object -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) SetValue(value string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []string -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Values() []string { - if obj.obj.Values == nil { - obj.SetValues([]string{"0.0.0.0"}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []string value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address object -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) SetValues(value []string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]string, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Increment() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address object -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) SetIncrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Decrement() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address object -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) SetDecrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - err := obj.validateIpv4(obj.Value()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.Value")) - } - - } - - if obj.obj.Values != nil { - - err := obj.validateIpv4Slice(obj.Values()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.Values")) - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address") - } - } else { - intVal := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength ***** -type patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength struct { - validation - obj *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - marshaller marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - unMarshaller unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - incrementHolder PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - decrementHolder PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter -} - -func NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { - obj := patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength{obj: &otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { - return obj.obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) setMsg(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { - obj.setNil() - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength struct { - obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength -} - -type marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength interface { - // ToProto marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength, error) - // ToPbText marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength struct { - obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength -} - -type unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength interface { - // FromProto unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength, error) - // FromPbText unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) FromPbText(value string) error { - retObj := proto.Unmarshal([]byte(value), m.obj.msg()) - if retObj != nil { - return retObj - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return retObj -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) 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:]) - } - m.obj.setNil() - vErr := m.obj.validateToAndFrom() - if vErr != nil { - return vErr - } - return nil -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) 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:]) - } - m.obj.setNil() - err := m.obj.validateToAndFrom() - if err != nil { - return err - } - return nil -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength() - 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 -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) setNil() { - obj.incrementHolder = nil - obj.decrementHolder = nil - obj.validationErrors = nil - obj.warnings = nil - obj.constraints = make(map[string]map[string]Constraints) -} - -// PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength is prefix-length of IPv4 address. -type PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength interface { - Validation - // msg marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - // setMsg unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - // validate validates PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - Choice() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum - // setChoice assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - setChoice(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - // HasChoice checks if Choice has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - SetValue(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - // HasValue checks if Value has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - SetValues(value []uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - // Increment returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength. - // PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter is integer counter pattern - Increment() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - // SetIncrement assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength. - // PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter is integer counter pattern - SetIncrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - // HasIncrement checks if Increment has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - HasIncrement() bool - // Decrement returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength. - // PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter is integer counter pattern - Decrement() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - // SetDecrement assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength. - // PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter is integer counter pattern - SetDecrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength - HasDecrement() bool - setNil() -} - -type PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength -var PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice = struct { - VALUE PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum - VALUES PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum - INCREMENT PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum - DECREMENT PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum -}{ - VALUE: PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum("value"), - VALUES: PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum("values"), - INCREMENT: PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum("increment"), - DECREMENT: PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum("decrement"), -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Choice() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum { - return PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) setChoice(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { - intValue, ok := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Decrement = nil - obj.decrementHolder = nil - obj.obj.Increment = nil - obj.incrementHolder = nil - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUE { - defaultValue := uint32(32) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUES { - defaultValue := []uint32{32} - obj.obj.Values = defaultValue - } - - if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.INCREMENT { - obj.obj.Increment = NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter().msg() - } - - if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.DECREMENT { - obj.obj.Decrement = NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter().msg() - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength object -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) SetValue(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{32}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength object -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) SetValues(value []uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Increment() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { - if obj.obj.Increment == nil { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.INCREMENT) - } - if obj.incrementHolder == nil { - obj.incrementHolder = &patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter{obj: obj.obj.Increment} - } - return obj.incrementHolder -} - -// description is TBD -// Increment returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) HasIncrement() bool { - return obj.obj.Increment != nil -} - -// description is TBD -// SetIncrement sets the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength object -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) SetIncrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.INCREMENT) - obj.incrementHolder = nil - obj.obj.Increment = value.msg() - - return obj -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Decrement() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { - if obj.obj.Decrement == nil { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.DECREMENT) - } - if obj.decrementHolder == nil { - obj.decrementHolder = &patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter{obj: obj.obj.Decrement} - } - return obj.decrementHolder -} - -// description is TBD -// Decrement returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) HasDecrement() bool { - return obj.obj.Decrement != nil -} - -// description is TBD -// SetDecrement sets the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength object -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) SetDecrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.DECREMENT) - obj.decrementHolder = nil - obj.obj.Decrement = value.msg() - - return obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.Values <= 255 but Got %d", item)) - } - - } - - } - - if obj.obj.Increment != nil { - - obj.Increment().validateObj(vObj, set_default) - } - - if obj.obj.Decrement != nil { - - obj.Decrement().validateObj(vObj, set_default) - } - -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUES - } - - if obj.obj.Increment != nil { - choices_set += 1 - choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.INCREMENT - } - - if obj.obj.Decrement != nil { - choices_set += 1 - choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.DECREMENT - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength") - } - } else { - intVal := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPRecordRouteIPv4Flag ***** -type flowRSVPRecordRouteIPv4Flag struct { - validation - obj *otg.FlowRSVPRecordRouteIPv4Flag - marshaller marshalFlowRSVPRecordRouteIPv4Flag - unMarshaller unMarshalFlowRSVPRecordRouteIPv4Flag -} - -func NewFlowRSVPRecordRouteIPv4Flag() FlowRSVPRecordRouteIPv4Flag { - obj := flowRSVPRecordRouteIPv4Flag{obj: &otg.FlowRSVPRecordRouteIPv4Flag{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPRecordRouteIPv4Flag) msg() *otg.FlowRSVPRecordRouteIPv4Flag { - return obj.obj -} - -func (obj *flowRSVPRecordRouteIPv4Flag) setMsg(msg *otg.FlowRSVPRecordRouteIPv4Flag) FlowRSVPRecordRouteIPv4Flag { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPRecordRouteIPv4Flag struct { - obj *flowRSVPRecordRouteIPv4Flag -} - -type marshalFlowRSVPRecordRouteIPv4Flag interface { - // ToProto marshals FlowRSVPRecordRouteIPv4Flag to protobuf object *otg.FlowRSVPRecordRouteIPv4Flag - ToProto() (*otg.FlowRSVPRecordRouteIPv4Flag, error) - // ToPbText marshals FlowRSVPRecordRouteIPv4Flag to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPRecordRouteIPv4Flag to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPRecordRouteIPv4Flag to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPRecordRouteIPv4Flag struct { - obj *flowRSVPRecordRouteIPv4Flag -} - -type unMarshalFlowRSVPRecordRouteIPv4Flag interface { - // FromProto unmarshals FlowRSVPRecordRouteIPv4Flag from protobuf object *otg.FlowRSVPRecordRouteIPv4Flag - FromProto(msg *otg.FlowRSVPRecordRouteIPv4Flag) (FlowRSVPRecordRouteIPv4Flag, error) - // FromPbText unmarshals FlowRSVPRecordRouteIPv4Flag from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPRecordRouteIPv4Flag from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPRecordRouteIPv4Flag from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPRecordRouteIPv4Flag) Marshal() marshalFlowRSVPRecordRouteIPv4Flag { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPRecordRouteIPv4Flag{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPRecordRouteIPv4Flag) Unmarshal() unMarshalFlowRSVPRecordRouteIPv4Flag { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPRecordRouteIPv4Flag{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPRecordRouteIPv4Flag) ToProto() (*otg.FlowRSVPRecordRouteIPv4Flag, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPRecordRouteIPv4Flag) FromProto(msg *otg.FlowRSVPRecordRouteIPv4Flag) (FlowRSVPRecordRouteIPv4Flag, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPRecordRouteIPv4Flag) 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 *unMarshalflowRSVPRecordRouteIPv4Flag) 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 *marshalflowRSVPRecordRouteIPv4Flag) 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 *unMarshalflowRSVPRecordRouteIPv4Flag) 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 *marshalflowRSVPRecordRouteIPv4Flag) 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 *unMarshalflowRSVPRecordRouteIPv4Flag) 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 *flowRSVPRecordRouteIPv4Flag) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPRecordRouteIPv4Flag) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPRecordRouteIPv4Flag) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPRecordRouteIPv4Flag) Clone() (FlowRSVPRecordRouteIPv4Flag, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPRecordRouteIPv4Flag() - 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 -} - -// FlowRSVPRecordRouteIPv4Flag is description is TBD -type FlowRSVPRecordRouteIPv4Flag interface { - Validation - // msg marshals FlowRSVPRecordRouteIPv4Flag to protobuf object *otg.FlowRSVPRecordRouteIPv4Flag - // and doesn't set defaults - msg() *otg.FlowRSVPRecordRouteIPv4Flag - // setMsg unmarshals FlowRSVPRecordRouteIPv4Flag from protobuf object *otg.FlowRSVPRecordRouteIPv4Flag - // and doesn't set defaults - setMsg(*otg.FlowRSVPRecordRouteIPv4Flag) FlowRSVPRecordRouteIPv4Flag - // provides marshal interface - Marshal() marshalFlowRSVPRecordRouteIPv4Flag - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPRecordRouteIPv4Flag - // validate validates FlowRSVPRecordRouteIPv4Flag - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPRecordRouteIPv4Flag, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPRecordRouteIPv4FlagChoiceEnum, set in FlowRSVPRecordRouteIPv4Flag - Choice() FlowRSVPRecordRouteIPv4FlagChoiceEnum - // setChoice assigns FlowRSVPRecordRouteIPv4FlagChoiceEnum provided by user to FlowRSVPRecordRouteIPv4Flag - setChoice(value FlowRSVPRecordRouteIPv4FlagChoiceEnum) FlowRSVPRecordRouteIPv4Flag - // HasChoice checks if Choice has been set in FlowRSVPRecordRouteIPv4Flag - HasChoice() bool - // getter for LocalProtectionAvailable to set choice. - LocalProtectionAvailable() - // getter for LocalProtectionInUse to set choice. - LocalProtectionInUse() -} - -type FlowRSVPRecordRouteIPv4FlagChoiceEnum string - -// Enum of Choice on FlowRSVPRecordRouteIPv4Flag -var FlowRSVPRecordRouteIPv4FlagChoice = struct { - LOCAL_PROTECTION_AVAILABLE FlowRSVPRecordRouteIPv4FlagChoiceEnum - LOCAL_PROTECTION_IN_USE FlowRSVPRecordRouteIPv4FlagChoiceEnum -}{ - LOCAL_PROTECTION_AVAILABLE: FlowRSVPRecordRouteIPv4FlagChoiceEnum("local_protection_available"), - LOCAL_PROTECTION_IN_USE: FlowRSVPRecordRouteIPv4FlagChoiceEnum("local_protection_in_use"), -} - -func (obj *flowRSVPRecordRouteIPv4Flag) Choice() FlowRSVPRecordRouteIPv4FlagChoiceEnum { - return FlowRSVPRecordRouteIPv4FlagChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// 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 { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPRecordRouteIPv4Flag) setChoice(value FlowRSVPRecordRouteIPv4FlagChoiceEnum) FlowRSVPRecordRouteIPv4Flag { - intValue, ok := otg.FlowRSVPRecordRouteIPv4Flag_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPRecordRouteIPv4FlagChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPRecordRouteIPv4Flag_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - - return obj -} - -func (obj *flowRSVPRecordRouteIPv4Flag) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - -} - -func (obj *flowRSVPRecordRouteIPv4Flag) setDefault() { - var choices_set int = 0 - var choice FlowRSVPRecordRouteIPv4FlagChoiceEnum - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPRecordRouteIPv4FlagChoice.LOCAL_PROTECTION_AVAILABLE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPRecordRouteIPv4Flag") - } - } else { - intVal := otg.FlowRSVPRecordRouteIPv4Flag_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPRecordRouteIPv4Flag_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathRecordRouteType1LabelFlags ***** -type patternFlowRSVPPathRecordRouteType1LabelFlags struct { - validation - obj *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags - marshaller marshalPatternFlowRSVPPathRecordRouteType1LabelFlags - unMarshaller unMarshalPatternFlowRSVPPathRecordRouteType1LabelFlags -} - -func NewPatternFlowRSVPPathRecordRouteType1LabelFlags() PatternFlowRSVPPathRecordRouteType1LabelFlags { - obj := patternFlowRSVPPathRecordRouteType1LabelFlags{obj: &otg.PatternFlowRSVPPathRecordRouteType1LabelFlags{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) msg() *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags { - return obj.obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) setMsg(msg *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags) PatternFlowRSVPPathRecordRouteType1LabelFlags { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathRecordRouteType1LabelFlags struct { - obj *patternFlowRSVPPathRecordRouteType1LabelFlags -} - -type marshalPatternFlowRSVPPathRecordRouteType1LabelFlags interface { - // ToProto marshals PatternFlowRSVPPathRecordRouteType1LabelFlags to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags - ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1LabelFlags, error) - // ToPbText marshals PatternFlowRSVPPathRecordRouteType1LabelFlags to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathRecordRouteType1LabelFlags to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathRecordRouteType1LabelFlags to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathRecordRouteType1LabelFlags struct { - obj *patternFlowRSVPPathRecordRouteType1LabelFlags -} - -type unMarshalPatternFlowRSVPPathRecordRouteType1LabelFlags interface { - // FromProto unmarshals PatternFlowRSVPPathRecordRouteType1LabelFlags from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags - FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags) (PatternFlowRSVPPathRecordRouteType1LabelFlags, error) - // FromPbText unmarshals PatternFlowRSVPPathRecordRouteType1LabelFlags from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathRecordRouteType1LabelFlags from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathRecordRouteType1LabelFlags from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) Marshal() marshalPatternFlowRSVPPathRecordRouteType1LabelFlags { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathRecordRouteType1LabelFlags{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1LabelFlags { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathRecordRouteType1LabelFlags{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1LabelFlags) ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1LabelFlags, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathRecordRouteType1LabelFlags) FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags) (PatternFlowRSVPPathRecordRouteType1LabelFlags, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1LabelFlags) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1LabelFlags) 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 *marshalpatternFlowRSVPPathRecordRouteType1LabelFlags) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1LabelFlags) 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 *marshalpatternFlowRSVPPathRecordRouteType1LabelFlags) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1LabelFlags) 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 *patternFlowRSVPPathRecordRouteType1LabelFlags) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) Clone() (PatternFlowRSVPPathRecordRouteType1LabelFlags, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathRecordRouteType1LabelFlags() - 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 -} - -// PatternFlowRSVPPathRecordRouteType1LabelFlags is 0x01 = Global label. This flag indicates that the label will be understood if received on any interface. -type PatternFlowRSVPPathRecordRouteType1LabelFlags interface { - Validation - // msg marshals PatternFlowRSVPPathRecordRouteType1LabelFlags to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags - // setMsg unmarshals PatternFlowRSVPPathRecordRouteType1LabelFlags from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathRecordRouteType1LabelFlags) PatternFlowRSVPPathRecordRouteType1LabelFlags - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathRecordRouteType1LabelFlags - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1LabelFlags - // validate validates PatternFlowRSVPPathRecordRouteType1LabelFlags - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathRecordRouteType1LabelFlags, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum, set in PatternFlowRSVPPathRecordRouteType1LabelFlags - Choice() PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum - // setChoice assigns PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum provided by user to PatternFlowRSVPPathRecordRouteType1LabelFlags - setChoice(value PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum) PatternFlowRSVPPathRecordRouteType1LabelFlags - // HasChoice checks if Choice has been set in PatternFlowRSVPPathRecordRouteType1LabelFlags - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathRecordRouteType1LabelFlags. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathRecordRouteType1LabelFlags - SetValue(value uint32) PatternFlowRSVPPathRecordRouteType1LabelFlags - // HasValue checks if Value has been set in PatternFlowRSVPPathRecordRouteType1LabelFlags - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathRecordRouteType1LabelFlags. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathRecordRouteType1LabelFlags - SetValues(value []uint32) PatternFlowRSVPPathRecordRouteType1LabelFlags -} - -type PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathRecordRouteType1LabelFlags -var PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice = struct { - VALUE PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum - VALUES PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum -}{ - VALUE: PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum("value"), - VALUES: PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum("values"), -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) Choice() PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum { - return PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) setChoice(value PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum) PatternFlowRSVPPathRecordRouteType1LabelFlags { - intValue, ok := otg.PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUE { - defaultValue := uint32(1) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUES { - defaultValue := []uint32{1} - obj.obj.Values = defaultValue - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathRecordRouteType1LabelFlags object -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) SetValue(value uint32) PatternFlowRSVPPathRecordRouteType1LabelFlags { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{1}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathRecordRouteType1LabelFlags object -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) SetValues(value []uint32) PatternFlowRSVPPathRecordRouteType1LabelFlags { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathRecordRouteType1LabelFlags.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathRecordRouteType1LabelFlags.Values <= 255 but Got %d", item)) - } - - } - - } - -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUES - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathRecordRouteType1LabelFlags") - } - } else { - intVal := otg.PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathRecordRouteType1LabelCType ***** -type patternFlowRSVPPathRecordRouteType1LabelCType struct { - validation - obj *otg.PatternFlowRSVPPathRecordRouteType1LabelCType - marshaller marshalPatternFlowRSVPPathRecordRouteType1LabelCType - unMarshaller unMarshalPatternFlowRSVPPathRecordRouteType1LabelCType -} - -func NewPatternFlowRSVPPathRecordRouteType1LabelCType() PatternFlowRSVPPathRecordRouteType1LabelCType { - obj := patternFlowRSVPPathRecordRouteType1LabelCType{obj: &otg.PatternFlowRSVPPathRecordRouteType1LabelCType{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) msg() *otg.PatternFlowRSVPPathRecordRouteType1LabelCType { - return obj.obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) setMsg(msg *otg.PatternFlowRSVPPathRecordRouteType1LabelCType) PatternFlowRSVPPathRecordRouteType1LabelCType { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathRecordRouteType1LabelCType struct { - obj *patternFlowRSVPPathRecordRouteType1LabelCType -} - -type marshalPatternFlowRSVPPathRecordRouteType1LabelCType interface { - // ToProto marshals PatternFlowRSVPPathRecordRouteType1LabelCType to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelCType - ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1LabelCType, error) - // ToPbText marshals PatternFlowRSVPPathRecordRouteType1LabelCType to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathRecordRouteType1LabelCType to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathRecordRouteType1LabelCType to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathRecordRouteType1LabelCType struct { - obj *patternFlowRSVPPathRecordRouteType1LabelCType -} - -type unMarshalPatternFlowRSVPPathRecordRouteType1LabelCType interface { - // FromProto unmarshals PatternFlowRSVPPathRecordRouteType1LabelCType from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelCType - FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1LabelCType) (PatternFlowRSVPPathRecordRouteType1LabelCType, error) - // FromPbText unmarshals PatternFlowRSVPPathRecordRouteType1LabelCType from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathRecordRouteType1LabelCType from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathRecordRouteType1LabelCType from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) Marshal() marshalPatternFlowRSVPPathRecordRouteType1LabelCType { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathRecordRouteType1LabelCType{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1LabelCType { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathRecordRouteType1LabelCType{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1LabelCType) ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1LabelCType, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathRecordRouteType1LabelCType) FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1LabelCType) (PatternFlowRSVPPathRecordRouteType1LabelCType, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1LabelCType) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1LabelCType) 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 *marshalpatternFlowRSVPPathRecordRouteType1LabelCType) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1LabelCType) 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 *marshalpatternFlowRSVPPathRecordRouteType1LabelCType) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1LabelCType) 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 *patternFlowRSVPPathRecordRouteType1LabelCType) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) Clone() (PatternFlowRSVPPathRecordRouteType1LabelCType, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathRecordRouteType1LabelCType() - 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 -} - -// PatternFlowRSVPPathRecordRouteType1LabelCType is the C-Type of the included Label Object. Copied from the Label object. -type PatternFlowRSVPPathRecordRouteType1LabelCType interface { - Validation - // msg marshals PatternFlowRSVPPathRecordRouteType1LabelCType to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelCType - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathRecordRouteType1LabelCType - // setMsg unmarshals PatternFlowRSVPPathRecordRouteType1LabelCType from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelCType - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathRecordRouteType1LabelCType) PatternFlowRSVPPathRecordRouteType1LabelCType - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathRecordRouteType1LabelCType - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1LabelCType - // validate validates PatternFlowRSVPPathRecordRouteType1LabelCType - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathRecordRouteType1LabelCType, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum, set in PatternFlowRSVPPathRecordRouteType1LabelCType - Choice() PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum - // setChoice assigns PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum provided by user to PatternFlowRSVPPathRecordRouteType1LabelCType - setChoice(value PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum) PatternFlowRSVPPathRecordRouteType1LabelCType - // HasChoice checks if Choice has been set in PatternFlowRSVPPathRecordRouteType1LabelCType - HasChoice() bool - // Value returns uint32, set in PatternFlowRSVPPathRecordRouteType1LabelCType. - Value() uint32 - // SetValue assigns uint32 provided by user to PatternFlowRSVPPathRecordRouteType1LabelCType - SetValue(value uint32) PatternFlowRSVPPathRecordRouteType1LabelCType - // HasValue checks if Value has been set in PatternFlowRSVPPathRecordRouteType1LabelCType - HasValue() bool - // Values returns []uint32, set in PatternFlowRSVPPathRecordRouteType1LabelCType. - Values() []uint32 - // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathRecordRouteType1LabelCType - SetValues(value []uint32) PatternFlowRSVPPathRecordRouteType1LabelCType -} - -type PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum string - -// Enum of Choice on PatternFlowRSVPPathRecordRouteType1LabelCType -var PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice = struct { - VALUE PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum - VALUES PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum -}{ - VALUE: PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum("value"), - VALUES: PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum("values"), -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) Choice() PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum { - return PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// description is TBD -// Choice returns a string -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) setChoice(value PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum) PatternFlowRSVPPathRecordRouteType1LabelCType { - intValue, ok := otg.PatternFlowRSVPPathRecordRouteType1LabelCType_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum", string(value))) - return obj - } - enumValue := otg.PatternFlowRSVPPathRecordRouteType1LabelCType_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.Values = nil - obj.obj.Value = nil - - if value == PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUE { - defaultValue := uint32(1) - obj.obj.Value = &defaultValue - } - - if value == PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUES { - defaultValue := []uint32{1} - obj.obj.Values = defaultValue - } - - return obj -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) Value() uint32 { - - if obj.obj.Value == nil { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUE) - } - - return *obj.obj.Value - -} - -// description is TBD -// Value returns a uint32 -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) HasValue() bool { - return obj.obj.Value != nil -} - -// description is TBD -// SetValue sets the uint32 value in the PatternFlowRSVPPathRecordRouteType1LabelCType object -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) SetValue(value uint32) PatternFlowRSVPPathRecordRouteType1LabelCType { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUE) - obj.obj.Value = &value - return obj -} - -// description is TBD -// Values returns a []uint32 -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) Values() []uint32 { - if obj.obj.Values == nil { - obj.SetValues([]uint32{1}) - } - return obj.obj.Values -} - -// description is TBD -// SetValues sets the []uint32 value in the PatternFlowRSVPPathRecordRouteType1LabelCType object -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) SetValues(value []uint32) PatternFlowRSVPPathRecordRouteType1LabelCType { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUES) - if obj.obj.Values == nil { - obj.obj.Values = make([]uint32, 0) - } - obj.obj.Values = value - - return obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Value != nil { - - if *obj.obj.Value > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathRecordRouteType1LabelCType.Value <= 255 but Got %d", *obj.obj.Value)) - } - - } - - if obj.obj.Values != nil { - - for _, item := range obj.obj.Values { - if item > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathRecordRouteType1LabelCType.Values <= 255 but Got %d", item)) - } - - } - - } - -} - -func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) setDefault() { - var choices_set int = 0 - var choice PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum - - if obj.obj.Value != nil { - choices_set += 1 - choice = PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUE - } - - if len(obj.obj.Values) > 0 { - choices_set += 1 - choice = PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUES - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUE) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathRecordRouteType1LabelCType") - } - } else { - intVal := otg.PatternFlowRSVPPathRecordRouteType1LabelCType_Choice_Enum_value[string(choice)] - enumValue := otg.PatternFlowRSVPPathRecordRouteType1LabelCType_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** FlowRSVPPathRecordRouteLabel ***** -type flowRSVPPathRecordRouteLabel struct { - validation - obj *otg.FlowRSVPPathRecordRouteLabel - marshaller marshalFlowRSVPPathRecordRouteLabel - unMarshaller unMarshalFlowRSVPPathRecordRouteLabel -} - -func NewFlowRSVPPathRecordRouteLabel() FlowRSVPPathRecordRouteLabel { - obj := flowRSVPPathRecordRouteLabel{obj: &otg.FlowRSVPPathRecordRouteLabel{}} - obj.setDefault() - return &obj -} - -func (obj *flowRSVPPathRecordRouteLabel) msg() *otg.FlowRSVPPathRecordRouteLabel { - return obj.obj -} - -func (obj *flowRSVPPathRecordRouteLabel) setMsg(msg *otg.FlowRSVPPathRecordRouteLabel) FlowRSVPPathRecordRouteLabel { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalflowRSVPPathRecordRouteLabel struct { - obj *flowRSVPPathRecordRouteLabel -} - -type marshalFlowRSVPPathRecordRouteLabel interface { - // ToProto marshals FlowRSVPPathRecordRouteLabel to protobuf object *otg.FlowRSVPPathRecordRouteLabel - ToProto() (*otg.FlowRSVPPathRecordRouteLabel, error) - // ToPbText marshals FlowRSVPPathRecordRouteLabel to protobuf text - ToPbText() (string, error) - // ToYaml marshals FlowRSVPPathRecordRouteLabel to YAML text - ToYaml() (string, error) - // ToJson marshals FlowRSVPPathRecordRouteLabel to JSON text - ToJson() (string, error) -} - -type unMarshalflowRSVPPathRecordRouteLabel struct { - obj *flowRSVPPathRecordRouteLabel -} - -type unMarshalFlowRSVPPathRecordRouteLabel interface { - // FromProto unmarshals FlowRSVPPathRecordRouteLabel from protobuf object *otg.FlowRSVPPathRecordRouteLabel - FromProto(msg *otg.FlowRSVPPathRecordRouteLabel) (FlowRSVPPathRecordRouteLabel, error) - // FromPbText unmarshals FlowRSVPPathRecordRouteLabel from protobuf text - FromPbText(value string) error - // FromYaml unmarshals FlowRSVPPathRecordRouteLabel from YAML text - FromYaml(value string) error - // FromJson unmarshals FlowRSVPPathRecordRouteLabel from JSON text - FromJson(value string) error -} - -func (obj *flowRSVPPathRecordRouteLabel) Marshal() marshalFlowRSVPPathRecordRouteLabel { - if obj.marshaller == nil { - obj.marshaller = &marshalflowRSVPPathRecordRouteLabel{obj: obj} - } - return obj.marshaller -} - -func (obj *flowRSVPPathRecordRouteLabel) Unmarshal() unMarshalFlowRSVPPathRecordRouteLabel { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalflowRSVPPathRecordRouteLabel{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalflowRSVPPathRecordRouteLabel) ToProto() (*otg.FlowRSVPPathRecordRouteLabel, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalflowRSVPPathRecordRouteLabel) FromProto(msg *otg.FlowRSVPPathRecordRouteLabel) (FlowRSVPPathRecordRouteLabel, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalflowRSVPPathRecordRouteLabel) 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 *unMarshalflowRSVPPathRecordRouteLabel) 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 *marshalflowRSVPPathRecordRouteLabel) 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 *unMarshalflowRSVPPathRecordRouteLabel) 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 *marshalflowRSVPPathRecordRouteLabel) 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 *unMarshalflowRSVPPathRecordRouteLabel) 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 *flowRSVPPathRecordRouteLabel) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *flowRSVPPathRecordRouteLabel) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *flowRSVPPathRecordRouteLabel) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *flowRSVPPathRecordRouteLabel) Clone() (FlowRSVPPathRecordRouteLabel, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewFlowRSVPPathRecordRouteLabel() - 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 -} - -// FlowRSVPPathRecordRouteLabel is description is TBD -type FlowRSVPPathRecordRouteLabel interface { - Validation - // msg marshals FlowRSVPPathRecordRouteLabel to protobuf object *otg.FlowRSVPPathRecordRouteLabel - // and doesn't set defaults - msg() *otg.FlowRSVPPathRecordRouteLabel - // setMsg unmarshals FlowRSVPPathRecordRouteLabel from protobuf object *otg.FlowRSVPPathRecordRouteLabel - // and doesn't set defaults - setMsg(*otg.FlowRSVPPathRecordRouteLabel) FlowRSVPPathRecordRouteLabel - // provides marshal interface - Marshal() marshalFlowRSVPPathRecordRouteLabel - // provides unmarshal interface - Unmarshal() unMarshalFlowRSVPPathRecordRouteLabel - // validate validates FlowRSVPPathRecordRouteLabel - validate() error - // A stringer function - String() string - // Clones the object - Clone() (FlowRSVPPathRecordRouteLabel, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Choice returns FlowRSVPPathRecordRouteLabelChoiceEnum, set in FlowRSVPPathRecordRouteLabel - Choice() FlowRSVPPathRecordRouteLabelChoiceEnum - // setChoice assigns FlowRSVPPathRecordRouteLabelChoiceEnum provided by user to FlowRSVPPathRecordRouteLabel - setChoice(value FlowRSVPPathRecordRouteLabelChoiceEnum) FlowRSVPPathRecordRouteLabel - // HasChoice checks if Choice has been set in FlowRSVPPathRecordRouteLabel - HasChoice() bool - // AsInteger returns uint32, set in FlowRSVPPathRecordRouteLabel. - AsInteger() uint32 - // SetAsInteger assigns uint32 provided by user to FlowRSVPPathRecordRouteLabel - SetAsInteger(value uint32) FlowRSVPPathRecordRouteLabel - // HasAsInteger checks if AsInteger has been set in FlowRSVPPathRecordRouteLabel - HasAsInteger() bool - // AsHex returns string, set in FlowRSVPPathRecordRouteLabel. - AsHex() string - // SetAsHex assigns string provided by user to FlowRSVPPathRecordRouteLabel - SetAsHex(value string) FlowRSVPPathRecordRouteLabel - // HasAsHex checks if AsHex has been set in FlowRSVPPathRecordRouteLabel - HasAsHex() bool -} - -type FlowRSVPPathRecordRouteLabelChoiceEnum string - -// Enum of Choice on FlowRSVPPathRecordRouteLabel -var FlowRSVPPathRecordRouteLabelChoice = struct { - AS_INTEGER FlowRSVPPathRecordRouteLabelChoiceEnum - AS_HEX FlowRSVPPathRecordRouteLabelChoiceEnum -}{ - AS_INTEGER: FlowRSVPPathRecordRouteLabelChoiceEnum("as_integer"), - AS_HEX: FlowRSVPPathRecordRouteLabelChoiceEnum("as_hex"), -} - -func (obj *flowRSVPPathRecordRouteLabel) Choice() FlowRSVPPathRecordRouteLabelChoiceEnum { - return FlowRSVPPathRecordRouteLabelChoiceEnum(obj.obj.Choice.Enum().String()) -} - -// 32 bit integer or hex value. -// Choice returns a string -func (obj *flowRSVPPathRecordRouteLabel) HasChoice() bool { - return obj.obj.Choice != nil -} - -func (obj *flowRSVPPathRecordRouteLabel) setChoice(value FlowRSVPPathRecordRouteLabelChoiceEnum) FlowRSVPPathRecordRouteLabel { - intValue, ok := otg.FlowRSVPPathRecordRouteLabel_Choice_Enum_value[string(value)] - if !ok { - obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( - "%s is not a valid choice on FlowRSVPPathRecordRouteLabelChoiceEnum", string(value))) - return obj - } - enumValue := otg.FlowRSVPPathRecordRouteLabel_Choice_Enum(intValue) - obj.obj.Choice = &enumValue - obj.obj.AsHex = nil - obj.obj.AsInteger = nil - - if value == FlowRSVPPathRecordRouteLabelChoice.AS_INTEGER { - defaultValue := uint32(16) - obj.obj.AsInteger = &defaultValue - } - - if value == FlowRSVPPathRecordRouteLabelChoice.AS_HEX { - defaultValue := "10" - obj.obj.AsHex = &defaultValue - } - - return obj -} - -// description is TBD -// AsInteger returns a uint32 -func (obj *flowRSVPPathRecordRouteLabel) AsInteger() uint32 { - - if obj.obj.AsInteger == nil { - obj.setChoice(FlowRSVPPathRecordRouteLabelChoice.AS_INTEGER) - } - - return *obj.obj.AsInteger - -} - -// description is TBD -// AsInteger returns a uint32 -func (obj *flowRSVPPathRecordRouteLabel) HasAsInteger() bool { - return obj.obj.AsInteger != nil -} - -// description is TBD -// SetAsInteger sets the uint32 value in the FlowRSVPPathRecordRouteLabel object -func (obj *flowRSVPPathRecordRouteLabel) SetAsInteger(value uint32) FlowRSVPPathRecordRouteLabel { - obj.setChoice(FlowRSVPPathRecordRouteLabelChoice.AS_INTEGER) - obj.obj.AsInteger = &value - return obj -} - -// Value of the this field should not excced 4 bytes. Maximum length of this attribute is 8 (4 * 2 hex character per byte). -// AsHex returns a string -func (obj *flowRSVPPathRecordRouteLabel) AsHex() string { - - if obj.obj.AsHex == nil { - obj.setChoice(FlowRSVPPathRecordRouteLabelChoice.AS_HEX) - } - - return *obj.obj.AsHex - -} - -// Value of the this field should not excced 4 bytes. Maximum length of this attribute is 8 (4 * 2 hex character per byte). -// AsHex returns a string -func (obj *flowRSVPPathRecordRouteLabel) HasAsHex() bool { - return obj.obj.AsHex != nil -} - -// Value of the this field should not excced 4 bytes. Maximum length of this attribute is 8 (4 * 2 hex character per byte). -// SetAsHex sets the string value in the FlowRSVPPathRecordRouteLabel object -func (obj *flowRSVPPathRecordRouteLabel) SetAsHex(value string) FlowRSVPPathRecordRouteLabel { - obj.setChoice(FlowRSVPPathRecordRouteLabelChoice.AS_HEX) - obj.obj.AsHex = &value - return obj -} - -func (obj *flowRSVPPathRecordRouteLabel) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.AsInteger != nil { - - if *obj.obj.AsInteger > 1048575 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= FlowRSVPPathRecordRouteLabel.AsInteger <= 1048575 but Got %d", *obj.obj.AsInteger)) - } - - } - - if obj.obj.AsHex != nil { - - if len(*obj.obj.AsHex) > 8 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf( - "None <= length of FlowRSVPPathRecordRouteLabel.AsHex <= 8 but Got %d", - len(*obj.obj.AsHex))) - } - - } - -} - -func (obj *flowRSVPPathRecordRouteLabel) setDefault() { - var choices_set int = 0 - var choice FlowRSVPPathRecordRouteLabelChoiceEnum - - if obj.obj.AsInteger != nil { - choices_set += 1 - choice = FlowRSVPPathRecordRouteLabelChoice.AS_INTEGER - } - - if obj.obj.AsHex != nil { - choices_set += 1 - choice = FlowRSVPPathRecordRouteLabelChoice.AS_HEX - } - if choices_set == 0 { - if obj.obj.Choice == nil { - obj.setChoice(FlowRSVPPathRecordRouteLabelChoice.AS_INTEGER) - - } - - } else if choices_set == 1 && choice != "" { - if obj.obj.Choice != nil { - if obj.Choice() != choice { - obj.validationErrors = append(obj.validationErrors, "choice not matching with property in FlowRSVPPathRecordRouteLabel") - } - } else { - intVal := otg.FlowRSVPPathRecordRouteLabel_Choice_Enum_value[string(choice)] - enumValue := otg.FlowRSVPPathRecordRouteLabel_Choice_Enum(intVal) - obj.obj.Choice = &enumValue - } - } - -} - -// ***** PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter ***** -type patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter struct { - validation - obj *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - marshaller marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - unMarshaller unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter -} - -func NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { - obj := patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter{obj: &otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) setMsg(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter struct { - obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter -} - -type marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter interface { - // ToProto marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, error) - // ToPbText marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter struct { - obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter -} - -type unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter interface { - // FromProto unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) 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 *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) 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 *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) 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 *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter() - 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 -} - -// PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter is integer counter pattern -type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter interface { - Validation - // msg marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - // setMsg unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - // validate validates PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - SetStart(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - SetStep(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - SetCount(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter object -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) SetStart(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter object -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) SetStep(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter object -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) SetCount(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter ***** -type patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter struct { - validation - obj *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - marshaller marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - unMarshaller unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter -} - -func NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { - obj := patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter{obj: &otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) setMsg(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter struct { - obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter -} - -type marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter interface { - // ToProto marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, error) - // ToPbText marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter struct { - obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter -} - -type unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter interface { - // FromProto unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) 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 *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) 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 *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) 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 *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter() - 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 -} - -// PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter is ipv4 counter pattern -type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter interface { - Validation - // msg marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - // setMsg unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - // validate validates PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - SetStart(value string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - HasStart() bool - // Step returns string, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - SetStep(value string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - SetCount(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter object -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) SetStart(value string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter object -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) SetStep(value string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter object -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) SetCount(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateIpv4(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateIpv4(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter.Step")) - } - - } - -} - -func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("0.0.0.0") - } - if obj.obj.Step == nil { - obj.SetStep("0.0.0.1") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter ***** -type patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter struct { - validation - obj *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - marshaller marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - unMarshaller unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter -} - -func NewPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter() PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { - obj := patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter{obj: &otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) msg() *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) setMsg(msg *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter struct { - obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter -} - -type marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter interface { - // ToProto marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, error) - // ToPbText marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter struct { - obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter -} - -type unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter interface { - // FromProto unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) (PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) Marshal() marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) (PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) 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 *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) 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 *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) 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 *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) Clone() (PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter() - 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 -} - -// PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter is integer counter pattern -type PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter interface { - Validation - // msg marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - // setMsg unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - // validate validates PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - SetStart(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - SetStep(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - SetCount(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter object -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) SetStart(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter object -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) SetStep(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter object -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) SetCount(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter.Start <= 1 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter.Step <= 1 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 1 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter.Count <= 1 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(0) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter ***** -type patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter struct { - validation - obj *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - marshaller marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - unMarshaller unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter -} - -func NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { - obj := patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter{obj: &otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) setMsg(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter struct { - obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter -} - -type marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter interface { - // ToProto marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, error) - // ToPbText marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter struct { - obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter -} - -type unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter interface { - // FromProto unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) 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 *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) 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 *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) 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 *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter() - 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 -} - -// PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter is ipv4 counter pattern -type PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter interface { - Validation - // msg marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - // setMsg unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - // validate validates PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns string, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter. - Start() string - // SetStart assigns string provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - SetStart(value string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - HasStart() bool - // Step returns string, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter. - Step() string - // SetStep assigns string provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - SetStep(value string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - SetCount(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter - HasCount() bool -} - -// description is TBD -// Start returns a string -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Start() string { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a string -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the string value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter object -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) SetStart(value string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a string -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Step() string { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a string -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the string value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter object -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) SetStep(value string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter object -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) SetCount(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - err := obj.validateIpv4(obj.Start()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter.Start")) - } - - } - - if obj.obj.Step != nil { - - err := obj.validateIpv4(obj.Step()) - if err != nil { - vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter.Step")) - } - - } - -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart("0.0.0.0") - } - if obj.obj.Step == nil { - obj.SetStep("0.0.0.1") - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} - -// ***** PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter ***** -type patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter struct { - validation - obj *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - marshaller marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - unMarshaller unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter -} - -func NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { - obj := patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter{obj: &otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter{}} - obj.setDefault() - return &obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { - return obj.obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) setMsg(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { - - proto.Merge(obj.obj, msg) - return obj -} - -type marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter struct { - obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter -} - -type marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter interface { - // ToProto marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, error) - // ToPbText marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter to protobuf text - ToPbText() (string, error) - // ToYaml marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter to YAML text - ToYaml() (string, error) - // ToJson marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter to JSON text - ToJson() (string, error) -} - -type unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter struct { - obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter -} - -type unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter interface { - // FromProto unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, error) - // FromPbText unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter from protobuf text - FromPbText(value string) error - // FromYaml unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter from YAML text - FromYaml(value string) error - // FromJson unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter from JSON text - FromJson(value string) error -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { - if obj.marshaller == nil { - obj.marshaller = &marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter{obj: obj} - } - return obj.marshaller -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { - if obj.unMarshaller == nil { - obj.unMarshaller = &unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter{obj: obj} - } - return obj.unMarshaller -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, error) { - err := m.obj.validateToAndFrom() - if err != nil { - return nil, err - } - return m.obj.msg(), nil -} - -func (m *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, error) { - newObj := m.obj.setMsg(msg) - err := newObj.validateToAndFrom() - if err != nil { - return nil, err - } - return newObj, nil -} - -func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) 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 *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) 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 *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) 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 *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) validateToAndFrom() error { - // emptyVars() - obj.validateObj(&obj.validation, true) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) validate() error { - // emptyVars() - obj.validateObj(&obj.validation, false) - return obj.validationResult() -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) String() string { - str, err := obj.Marshal().ToYaml() - if err != nil { - return err.Error() - } - return str -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, error) { - vErr := obj.validate() - if vErr != nil { - return nil, vErr - } - newObj := NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter() - 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 -} - -// PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter is integer counter pattern -type PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter interface { - Validation - // msg marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - // and doesn't set defaults - msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - // setMsg unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - // and doesn't set defaults - setMsg(*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - // provides marshal interface - Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - // provides unmarshal interface - Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - // validate validates PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - validate() error - // A stringer function - String() string - // Clones the object - Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, error) - validateToAndFrom() error - validateObj(vObj *validation, set_default bool) - setDefault() - // Start returns uint32, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter. - Start() uint32 - // SetStart assigns uint32 provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - SetStart(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - // HasStart checks if Start has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - HasStart() bool - // Step returns uint32, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter. - Step() uint32 - // SetStep assigns uint32 provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - SetStep(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - // HasStep checks if Step has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - HasStep() bool - // Count returns uint32, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter. - Count() uint32 - // SetCount assigns uint32 provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - SetCount(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - // HasCount checks if Count has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter - HasCount() bool -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Start() uint32 { - - return *obj.obj.Start - -} - -// description is TBD -// Start returns a uint32 -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) HasStart() bool { - return obj.obj.Start != nil -} - -// description is TBD -// SetStart sets the uint32 value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter object -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) SetStart(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { - - obj.obj.Start = &value - return obj -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Step() uint32 { - - return *obj.obj.Step - -} - -// description is TBD -// Step returns a uint32 -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) HasStep() bool { - return obj.obj.Step != nil -} - -// description is TBD -// SetStep sets the uint32 value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter object -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) SetStep(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { - - obj.obj.Step = &value - return obj -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Count() uint32 { - - return *obj.obj.Count - -} - -// description is TBD -// Count returns a uint32 -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) HasCount() bool { - return obj.obj.Count != nil -} - -// description is TBD -// SetCount sets the uint32 value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter object -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) SetCount(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { - - obj.obj.Count = &value - return obj -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) validateObj(vObj *validation, set_default bool) { - if set_default { - obj.setDefault() - } - - if obj.obj.Start != nil { - - if *obj.obj.Start > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter.Start <= 255 but Got %d", *obj.obj.Start)) - } - - } - - if obj.obj.Step != nil { - - if *obj.obj.Step > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter.Step <= 255 but Got %d", *obj.obj.Step)) - } - - } - - if obj.obj.Count != nil { - - if *obj.obj.Count > 255 { - vObj.validationErrors = append( - vObj.validationErrors, - fmt.Sprintf("0 <= PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter.Count <= 255 but Got %d", *obj.obj.Count)) - } - - } - -} - -func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) setDefault() { - if obj.obj.Start == nil { - obj.SetStart(32) - } - if obj.obj.Step == nil { - obj.SetStep(1) - } - if obj.obj.Count == nil { - obj.SetCount(1) - } - -} diff --git a/gosnappi/isis_advanced.go b/gosnappi/isis_advanced.go new file mode 100644 index 00000000..3bc450d1 --- /dev/null +++ b/gosnappi/isis_advanced.go @@ -0,0 +1,661 @@ +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" +) + +// ***** IsisAdvanced ***** +type isisAdvanced struct { + validation + obj *otg.IsisAdvanced + marshaller marshalIsisAdvanced + unMarshaller unMarshalIsisAdvanced +} + +func NewIsisAdvanced() IsisAdvanced { + obj := isisAdvanced{obj: &otg.IsisAdvanced{}} + obj.setDefault() + return &obj +} + +func (obj *isisAdvanced) msg() *otg.IsisAdvanced { + return obj.obj +} + +func (obj *isisAdvanced) setMsg(msg *otg.IsisAdvanced) IsisAdvanced { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisAdvanced struct { + obj *isisAdvanced +} + +type marshalIsisAdvanced interface { + // ToProto marshals IsisAdvanced to protobuf object *otg.IsisAdvanced + ToProto() (*otg.IsisAdvanced, error) + // ToPbText marshals IsisAdvanced to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisAdvanced to YAML text + ToYaml() (string, error) + // ToJson marshals IsisAdvanced to JSON text + ToJson() (string, error) +} + +type unMarshalisisAdvanced struct { + obj *isisAdvanced +} + +type unMarshalIsisAdvanced interface { + // FromProto unmarshals IsisAdvanced from protobuf object *otg.IsisAdvanced + FromProto(msg *otg.IsisAdvanced) (IsisAdvanced, error) + // FromPbText unmarshals IsisAdvanced from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisAdvanced from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisAdvanced from JSON text + FromJson(value string) error +} + +func (obj *isisAdvanced) Marshal() marshalIsisAdvanced { + if obj.marshaller == nil { + obj.marshaller = &marshalisisAdvanced{obj: obj} + } + return obj.marshaller +} + +func (obj *isisAdvanced) Unmarshal() unMarshalIsisAdvanced { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisAdvanced{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisAdvanced) ToProto() (*otg.IsisAdvanced, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisAdvanced) FromProto(msg *otg.IsisAdvanced) (IsisAdvanced, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisAdvanced) 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 *unMarshalisisAdvanced) 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 *marshalisisAdvanced) 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 *unMarshalisisAdvanced) 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 *marshalisisAdvanced) 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 *unMarshalisisAdvanced) 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 *isisAdvanced) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisAdvanced) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisAdvanced) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisAdvanced) Clone() (IsisAdvanced, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisAdvanced() + 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 +} + +// IsisAdvanced is contains ISIS router advanced properties. +type IsisAdvanced interface { + Validation + // msg marshals IsisAdvanced to protobuf object *otg.IsisAdvanced + // and doesn't set defaults + msg() *otg.IsisAdvanced + // setMsg unmarshals IsisAdvanced from protobuf object *otg.IsisAdvanced + // and doesn't set defaults + setMsg(*otg.IsisAdvanced) IsisAdvanced + // provides marshal interface + Marshal() marshalIsisAdvanced + // provides unmarshal interface + Unmarshal() unMarshalIsisAdvanced + // validate validates IsisAdvanced + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisAdvanced, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // EnableHelloPadding returns bool, set in IsisAdvanced. + EnableHelloPadding() bool + // SetEnableHelloPadding assigns bool provided by user to IsisAdvanced + SetEnableHelloPadding(value bool) IsisAdvanced + // HasEnableHelloPadding checks if EnableHelloPadding has been set in IsisAdvanced + HasEnableHelloPadding() bool + // MaxAreaAddresses returns uint32, set in IsisAdvanced. + MaxAreaAddresses() uint32 + // SetMaxAreaAddresses assigns uint32 provided by user to IsisAdvanced + SetMaxAreaAddresses(value uint32) IsisAdvanced + // HasMaxAreaAddresses checks if MaxAreaAddresses has been set in IsisAdvanced + HasMaxAreaAddresses() bool + // AreaAddresses returns []string, set in IsisAdvanced. + AreaAddresses() []string + // SetAreaAddresses assigns []string provided by user to IsisAdvanced + SetAreaAddresses(value []string) IsisAdvanced + // LspRefreshRate returns uint32, set in IsisAdvanced. + LspRefreshRate() uint32 + // SetLspRefreshRate assigns uint32 provided by user to IsisAdvanced + SetLspRefreshRate(value uint32) IsisAdvanced + // HasLspRefreshRate checks if LspRefreshRate has been set in IsisAdvanced + HasLspRefreshRate() bool + // LspLifetime returns uint32, set in IsisAdvanced. + LspLifetime() uint32 + // SetLspLifetime assigns uint32 provided by user to IsisAdvanced + SetLspLifetime(value uint32) IsisAdvanced + // HasLspLifetime checks if LspLifetime has been set in IsisAdvanced + HasLspLifetime() bool + // PsnpInterval returns uint32, set in IsisAdvanced. + PsnpInterval() uint32 + // SetPsnpInterval assigns uint32 provided by user to IsisAdvanced + SetPsnpInterval(value uint32) IsisAdvanced + // HasPsnpInterval checks if PsnpInterval has been set in IsisAdvanced + HasPsnpInterval() bool + // CsnpInterval returns uint32, set in IsisAdvanced. + CsnpInterval() uint32 + // SetCsnpInterval assigns uint32 provided by user to IsisAdvanced + SetCsnpInterval(value uint32) IsisAdvanced + // HasCsnpInterval checks if CsnpInterval has been set in IsisAdvanced + HasCsnpInterval() bool + // MaxLspSize returns uint32, set in IsisAdvanced. + MaxLspSize() uint32 + // SetMaxLspSize assigns uint32 provided by user to IsisAdvanced + SetMaxLspSize(value uint32) IsisAdvanced + // HasMaxLspSize checks if MaxLspSize has been set in IsisAdvanced + HasMaxLspSize() bool + // LspMgroupMinTransInterval returns uint32, set in IsisAdvanced. + LspMgroupMinTransInterval() uint32 + // SetLspMgroupMinTransInterval assigns uint32 provided by user to IsisAdvanced + SetLspMgroupMinTransInterval(value uint32) IsisAdvanced + // HasLspMgroupMinTransInterval checks if LspMgroupMinTransInterval has been set in IsisAdvanced + HasLspMgroupMinTransInterval() bool + // EnableAttachedBit returns bool, set in IsisAdvanced. + EnableAttachedBit() bool + // SetEnableAttachedBit assigns bool provided by user to IsisAdvanced + SetEnableAttachedBit(value bool) IsisAdvanced + // HasEnableAttachedBit checks if EnableAttachedBit has been set in IsisAdvanced + HasEnableAttachedBit() bool +} + +// It enables padding of Hello message to MTU size. +// EnableHelloPadding returns a bool +func (obj *isisAdvanced) EnableHelloPadding() bool { + + return *obj.obj.EnableHelloPadding + +} + +// It enables padding of Hello message to MTU size. +// EnableHelloPadding returns a bool +func (obj *isisAdvanced) HasEnableHelloPadding() bool { + return obj.obj.EnableHelloPadding != nil +} + +// It enables padding of Hello message to MTU size. +// SetEnableHelloPadding sets the bool value in the IsisAdvanced object +func (obj *isisAdvanced) SetEnableHelloPadding(value bool) IsisAdvanced { + + obj.obj.EnableHelloPadding = &value + return obj +} + +// The Number of Area Addresses permitted, with a valid range from 0 to 254. A zero indicates a maximum of 3 addresses. +// MaxAreaAddresses returns a uint32 +func (obj *isisAdvanced) MaxAreaAddresses() uint32 { + + return *obj.obj.MaxAreaAddresses + +} + +// The Number of Area Addresses permitted, with a valid range from 0 to 254. A zero indicates a maximum of 3 addresses. +// MaxAreaAddresses returns a uint32 +func (obj *isisAdvanced) HasMaxAreaAddresses() bool { + return obj.obj.MaxAreaAddresses != nil +} + +// The Number of Area Addresses permitted, with a valid range from 0 to 254. A zero indicates a maximum of 3 addresses. +// SetMaxAreaAddresses sets the uint32 value in the IsisAdvanced object +func (obj *isisAdvanced) SetMaxAreaAddresses(value uint32) IsisAdvanced { + + obj.obj.MaxAreaAddresses = &value + return obj +} + +// Its combination of the ISP and HO-DSP.Usually all nodes within an area have the same area address. If no area addresses are configured, a default area of "490001" will be advertised. +// AreaAddresses returns a []string +func (obj *isisAdvanced) AreaAddresses() []string { + if obj.obj.AreaAddresses == nil { + obj.obj.AreaAddresses = make([]string, 0) + } + return obj.obj.AreaAddresses +} + +// Its combination of the ISP and HO-DSP.Usually all nodes within an area have the same area address. If no area addresses are configured, a default area of "490001" will be advertised. +// SetAreaAddresses sets the []string value in the IsisAdvanced object +func (obj *isisAdvanced) SetAreaAddresses(value []string) IsisAdvanced { + + if obj.obj.AreaAddresses == nil { + obj.obj.AreaAddresses = make([]string, 0) + } + obj.obj.AreaAddresses = value + + return obj +} + +// The rate at which LSPs are re-sent in seconds. +// LspRefreshRate returns a uint32 +func (obj *isisAdvanced) LspRefreshRate() uint32 { + + return *obj.obj.LspRefreshRate + +} + +// The rate at which LSPs are re-sent in seconds. +// LspRefreshRate returns a uint32 +func (obj *isisAdvanced) HasLspRefreshRate() bool { + return obj.obj.LspRefreshRate != nil +} + +// The rate at which LSPs are re-sent in seconds. +// SetLspRefreshRate sets the uint32 value in the IsisAdvanced object +func (obj *isisAdvanced) SetLspRefreshRate(value uint32) IsisAdvanced { + + obj.obj.LspRefreshRate = &value + return obj +} + +// The MaxAge for retaining a learned LSP on this router in seconds. +// LspLifetime returns a uint32 +func (obj *isisAdvanced) LspLifetime() uint32 { + + return *obj.obj.LspLifetime + +} + +// The MaxAge for retaining a learned LSP on this router in seconds. +// LspLifetime returns a uint32 +func (obj *isisAdvanced) HasLspLifetime() bool { + return obj.obj.LspLifetime != nil +} + +// The MaxAge for retaining a learned LSP on this router in seconds. +// SetLspLifetime sets the uint32 value in the IsisAdvanced object +func (obj *isisAdvanced) SetLspLifetime(value uint32) IsisAdvanced { + + obj.obj.LspLifetime = &value + return obj +} + +// The number of milliseconds between transmissions of Partial Sequence Number PDU. +// PsnpInterval returns a uint32 +func (obj *isisAdvanced) PsnpInterval() uint32 { + + return *obj.obj.PsnpInterval + +} + +// The number of milliseconds between transmissions of Partial Sequence Number PDU. +// PsnpInterval returns a uint32 +func (obj *isisAdvanced) HasPsnpInterval() bool { + return obj.obj.PsnpInterval != nil +} + +// The number of milliseconds between transmissions of Partial Sequence Number PDU. +// SetPsnpInterval sets the uint32 value in the IsisAdvanced object +func (obj *isisAdvanced) SetPsnpInterval(value uint32) IsisAdvanced { + + obj.obj.PsnpInterval = &value + return obj +} + +// The number of milliseconds between transmissions of Partial Sequence Number PDU. +// CsnpInterval returns a uint32 +func (obj *isisAdvanced) CsnpInterval() uint32 { + + return *obj.obj.CsnpInterval + +} + +// The number of milliseconds between transmissions of Partial Sequence Number PDU. +// CsnpInterval returns a uint32 +func (obj *isisAdvanced) HasCsnpInterval() bool { + return obj.obj.CsnpInterval != nil +} + +// The number of milliseconds between transmissions of Partial Sequence Number PDU. +// SetCsnpInterval sets the uint32 value in the IsisAdvanced object +func (obj *isisAdvanced) SetCsnpInterval(value uint32) IsisAdvanced { + + obj.obj.CsnpInterval = &value + return obj +} + +// The maximum size in bytes of any LSP that can be transmitted over a link of equal or less than maximum MTU size. +// MaxLspSize returns a uint32 +func (obj *isisAdvanced) MaxLspSize() uint32 { + + return *obj.obj.MaxLspSize + +} + +// The maximum size in bytes of any LSP that can be transmitted over a link of equal or less than maximum MTU size. +// MaxLspSize returns a uint32 +func (obj *isisAdvanced) HasMaxLspSize() bool { + return obj.obj.MaxLspSize != nil +} + +// The maximum size in bytes of any LSP that can be transmitted over a link of equal or less than maximum MTU size. +// SetMaxLspSize sets the uint32 value in the IsisAdvanced object +func (obj *isisAdvanced) SetMaxLspSize(value uint32) IsisAdvanced { + + obj.obj.MaxLspSize = &value + return obj +} + +// The number of seconds between transmissions of LSPs/MGROUP-PDUs. +// LspMgroupMinTransInterval returns a uint32 +func (obj *isisAdvanced) LspMgroupMinTransInterval() uint32 { + + return *obj.obj.LspMgroupMinTransInterval + +} + +// The number of seconds between transmissions of LSPs/MGROUP-PDUs. +// LspMgroupMinTransInterval returns a uint32 +func (obj *isisAdvanced) HasLspMgroupMinTransInterval() bool { + return obj.obj.LspMgroupMinTransInterval != nil +} + +// The number of seconds between transmissions of LSPs/MGROUP-PDUs. +// SetLspMgroupMinTransInterval sets the uint32 value in the IsisAdvanced object +func (obj *isisAdvanced) SetLspMgroupMinTransInterval(value uint32) IsisAdvanced { + + obj.obj.LspMgroupMinTransInterval = &value + return obj +} + +// If the Attached bit is enabled, it indicates that the ISIS router is attached to another area or the Level 2 backbone. The purpose of an Attached-Bit is to accomplish Inter-Area Routing. When an L1/L2 router is connected to more than one area, it sets the Attached-bit on its L1 LSP. This can cause a default route ( 0.0.0.0/0 ) to be installed by the receiving router. +// EnableAttachedBit returns a bool +func (obj *isisAdvanced) EnableAttachedBit() bool { + + return *obj.obj.EnableAttachedBit + +} + +// If the Attached bit is enabled, it indicates that the ISIS router is attached to another area or the Level 2 backbone. The purpose of an Attached-Bit is to accomplish Inter-Area Routing. When an L1/L2 router is connected to more than one area, it sets the Attached-bit on its L1 LSP. This can cause a default route ( 0.0.0.0/0 ) to be installed by the receiving router. +// EnableAttachedBit returns a bool +func (obj *isisAdvanced) HasEnableAttachedBit() bool { + return obj.obj.EnableAttachedBit != nil +} + +// If the Attached bit is enabled, it indicates that the ISIS router is attached to another area or the Level 2 backbone. The purpose of an Attached-Bit is to accomplish Inter-Area Routing. When an L1/L2 router is connected to more than one area, it sets the Attached-bit on its L1 LSP. This can cause a default route ( 0.0.0.0/0 ) to be installed by the receiving router. +// SetEnableAttachedBit sets the bool value in the IsisAdvanced object +func (obj *isisAdvanced) SetEnableAttachedBit(value bool) IsisAdvanced { + + obj.obj.EnableAttachedBit = &value + return obj +} + +func (obj *isisAdvanced) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.MaxAreaAddresses != nil { + + if *obj.obj.MaxAreaAddresses > 254 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= IsisAdvanced.MaxAreaAddresses <= 254 but Got %d", *obj.obj.MaxAreaAddresses)) + } + + } + + if obj.obj.AreaAddresses != nil { + + err := obj.validateHexSlice(obj.AreaAddresses()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on IsisAdvanced.AreaAddresses")) + } + + } + + if obj.obj.LspRefreshRate != nil { + + if *obj.obj.LspRefreshRate > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= IsisAdvanced.LspRefreshRate <= 65535 but Got %d", *obj.obj.LspRefreshRate)) + } + + } + + if obj.obj.LspLifetime != nil { + + if *obj.obj.LspLifetime > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= IsisAdvanced.LspLifetime <= 65535 but Got %d", *obj.obj.LspLifetime)) + } + + } + + if obj.obj.PsnpInterval != nil { + + if *obj.obj.PsnpInterval > 60000 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= IsisAdvanced.PsnpInterval <= 60000 but Got %d", *obj.obj.PsnpInterval)) + } + + } + + if obj.obj.CsnpInterval != nil { + + if *obj.obj.CsnpInterval < 1 || *obj.obj.CsnpInterval > 65535000 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= IsisAdvanced.CsnpInterval <= 65535000 but Got %d", *obj.obj.CsnpInterval)) + } + + } + + if obj.obj.MaxLspSize != nil { + + if *obj.obj.MaxLspSize < 64 || *obj.obj.MaxLspSize > 9216 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("64 <= IsisAdvanced.MaxLspSize <= 9216 but Got %d", *obj.obj.MaxLspSize)) + } + + } + + if obj.obj.LspMgroupMinTransInterval != nil { + + if *obj.obj.LspMgroupMinTransInterval < 1 || *obj.obj.LspMgroupMinTransInterval > 60000 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= IsisAdvanced.LspMgroupMinTransInterval <= 60000 but Got %d", *obj.obj.LspMgroupMinTransInterval)) + } + + } + +} + +func (obj *isisAdvanced) setDefault() { + if obj.obj.EnableHelloPadding == nil { + obj.SetEnableHelloPadding(true) + } + if obj.obj.MaxAreaAddresses == nil { + obj.SetMaxAreaAddresses(3) + } + if obj.obj.LspRefreshRate == nil { + obj.SetLspRefreshRate(600) + } + if obj.obj.LspLifetime == nil { + obj.SetLspLifetime(1200) + } + if obj.obj.PsnpInterval == nil { + obj.SetPsnpInterval(2000) + } + if obj.obj.CsnpInterval == nil { + obj.SetCsnpInterval(10000) + } + if obj.obj.MaxLspSize == nil { + obj.SetMaxLspSize(1492) + } + if obj.obj.LspMgroupMinTransInterval == nil { + obj.SetLspMgroupMinTransInterval(5000) + } + if obj.obj.EnableAttachedBit == nil { + obj.SetEnableAttachedBit(true) + } + +} diff --git a/gosnappi/isis_authentication.go b/gosnappi/isis_authentication.go new file mode 100644 index 00000000..ad456ec8 --- /dev/null +++ b/gosnappi/isis_authentication.go @@ -0,0 +1,408 @@ +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" +) + +// ***** IsisAuthentication ***** +type isisAuthentication struct { + validation + obj *otg.IsisAuthentication + marshaller marshalIsisAuthentication + unMarshaller unMarshalIsisAuthentication + areaAuthHolder IsisAuthenticationBase + domainAuthHolder IsisAuthenticationBase +} + +func NewIsisAuthentication() IsisAuthentication { + obj := isisAuthentication{obj: &otg.IsisAuthentication{}} + obj.setDefault() + return &obj +} + +func (obj *isisAuthentication) msg() *otg.IsisAuthentication { + return obj.obj +} + +func (obj *isisAuthentication) setMsg(msg *otg.IsisAuthentication) IsisAuthentication { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisAuthentication struct { + obj *isisAuthentication +} + +type marshalIsisAuthentication interface { + // ToProto marshals IsisAuthentication to protobuf object *otg.IsisAuthentication + ToProto() (*otg.IsisAuthentication, error) + // ToPbText marshals IsisAuthentication to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisAuthentication to YAML text + ToYaml() (string, error) + // ToJson marshals IsisAuthentication to JSON text + ToJson() (string, error) +} + +type unMarshalisisAuthentication struct { + obj *isisAuthentication +} + +type unMarshalIsisAuthentication interface { + // FromProto unmarshals IsisAuthentication from protobuf object *otg.IsisAuthentication + FromProto(msg *otg.IsisAuthentication) (IsisAuthentication, error) + // FromPbText unmarshals IsisAuthentication from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisAuthentication from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisAuthentication from JSON text + FromJson(value string) error +} + +func (obj *isisAuthentication) Marshal() marshalIsisAuthentication { + if obj.marshaller == nil { + obj.marshaller = &marshalisisAuthentication{obj: obj} + } + return obj.marshaller +} + +func (obj *isisAuthentication) Unmarshal() unMarshalIsisAuthentication { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisAuthentication{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisAuthentication) ToProto() (*otg.IsisAuthentication, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisAuthentication) FromProto(msg *otg.IsisAuthentication) (IsisAuthentication, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisAuthentication) 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 *unMarshalisisAuthentication) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisAuthentication) 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 *unMarshalisisAuthentication) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisAuthentication) 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 *unMarshalisisAuthentication) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisAuthentication) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisAuthentication) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisAuthentication) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisAuthentication) Clone() (IsisAuthentication, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisAuthentication() + 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 +} + +func (obj *isisAuthentication) setNil() { + obj.areaAuthHolder = nil + obj.domainAuthHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisAuthentication is this contains ISIS Area/Domain authentication properties. +type IsisAuthentication interface { + Validation + // msg marshals IsisAuthentication to protobuf object *otg.IsisAuthentication + // and doesn't set defaults + msg() *otg.IsisAuthentication + // setMsg unmarshals IsisAuthentication from protobuf object *otg.IsisAuthentication + // and doesn't set defaults + setMsg(*otg.IsisAuthentication) IsisAuthentication + // provides marshal interface + Marshal() marshalIsisAuthentication + // provides unmarshal interface + Unmarshal() unMarshalIsisAuthentication + // validate validates IsisAuthentication + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisAuthentication, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // IgnoreReceiveMd5 returns bool, set in IsisAuthentication. + IgnoreReceiveMd5() bool + // SetIgnoreReceiveMd5 assigns bool provided by user to IsisAuthentication + SetIgnoreReceiveMd5(value bool) IsisAuthentication + // HasIgnoreReceiveMd5 checks if IgnoreReceiveMd5 has been set in IsisAuthentication + HasIgnoreReceiveMd5() bool + // AreaAuth returns IsisAuthenticationBase, set in IsisAuthentication. + // IsisAuthenticationBase is optional container for ISIS authentication properties. + AreaAuth() IsisAuthenticationBase + // SetAreaAuth assigns IsisAuthenticationBase provided by user to IsisAuthentication. + // IsisAuthenticationBase is optional container for ISIS authentication properties. + SetAreaAuth(value IsisAuthenticationBase) IsisAuthentication + // HasAreaAuth checks if AreaAuth has been set in IsisAuthentication + HasAreaAuth() bool + // DomainAuth returns IsisAuthenticationBase, set in IsisAuthentication. + // IsisAuthenticationBase is optional container for ISIS authentication properties. + DomainAuth() IsisAuthenticationBase + // SetDomainAuth assigns IsisAuthenticationBase provided by user to IsisAuthentication. + // IsisAuthenticationBase is optional container for ISIS authentication properties. + SetDomainAuth(value IsisAuthenticationBase) IsisAuthentication + // HasDomainAuth checks if DomainAuth has been set in IsisAuthentication + HasDomainAuth() bool + setNil() +} + +// Do not verify MD5 checksum in received LSPs. +// IgnoreReceiveMd5 returns a bool +func (obj *isisAuthentication) IgnoreReceiveMd5() bool { + + return *obj.obj.IgnoreReceiveMd5 + +} + +// Do not verify MD5 checksum in received LSPs. +// IgnoreReceiveMd5 returns a bool +func (obj *isisAuthentication) HasIgnoreReceiveMd5() bool { + return obj.obj.IgnoreReceiveMd5 != nil +} + +// Do not verify MD5 checksum in received LSPs. +// SetIgnoreReceiveMd5 sets the bool value in the IsisAuthentication object +func (obj *isisAuthentication) SetIgnoreReceiveMd5(value bool) IsisAuthentication { + + obj.obj.IgnoreReceiveMd5 = &value + return obj +} + +// The Area authentication method used for the emulated ISIS router. +// This is used for L1 LSPs. +// AreaAuth returns a IsisAuthenticationBase +func (obj *isisAuthentication) AreaAuth() IsisAuthenticationBase { + if obj.obj.AreaAuth == nil { + obj.obj.AreaAuth = NewIsisAuthenticationBase().msg() + } + if obj.areaAuthHolder == nil { + obj.areaAuthHolder = &isisAuthenticationBase{obj: obj.obj.AreaAuth} + } + return obj.areaAuthHolder +} + +// The Area authentication method used for the emulated ISIS router. +// This is used for L1 LSPs. +// AreaAuth returns a IsisAuthenticationBase +func (obj *isisAuthentication) HasAreaAuth() bool { + return obj.obj.AreaAuth != nil +} + +// The Area authentication method used for the emulated ISIS router. +// This is used for L1 LSPs. +// SetAreaAuth sets the IsisAuthenticationBase value in the IsisAuthentication object +func (obj *isisAuthentication) SetAreaAuth(value IsisAuthenticationBase) IsisAuthentication { + + obj.areaAuthHolder = nil + obj.obj.AreaAuth = value.msg() + + return obj +} + +// The Domain authentication method used for the emulated ISIS router. +// This is used for L2 LSPs. +// DomainAuth returns a IsisAuthenticationBase +func (obj *isisAuthentication) DomainAuth() IsisAuthenticationBase { + if obj.obj.DomainAuth == nil { + obj.obj.DomainAuth = NewIsisAuthenticationBase().msg() + } + if obj.domainAuthHolder == nil { + obj.domainAuthHolder = &isisAuthenticationBase{obj: obj.obj.DomainAuth} + } + return obj.domainAuthHolder +} + +// The Domain authentication method used for the emulated ISIS router. +// This is used for L2 LSPs. +// DomainAuth returns a IsisAuthenticationBase +func (obj *isisAuthentication) HasDomainAuth() bool { + return obj.obj.DomainAuth != nil +} + +// The Domain authentication method used for the emulated ISIS router. +// This is used for L2 LSPs. +// SetDomainAuth sets the IsisAuthenticationBase value in the IsisAuthentication object +func (obj *isisAuthentication) SetDomainAuth(value IsisAuthenticationBase) IsisAuthentication { + + obj.domainAuthHolder = nil + obj.obj.DomainAuth = value.msg() + + return obj +} + +func (obj *isisAuthentication) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.AreaAuth != nil { + + obj.AreaAuth().validateObj(vObj, set_default) + } + + if obj.obj.DomainAuth != nil { + + obj.DomainAuth().validateObj(vObj, set_default) + } + +} + +func (obj *isisAuthentication) setDefault() { + if obj.obj.IgnoreReceiveMd5 == nil { + obj.SetIgnoreReceiveMd5(true) + } + +} diff --git a/gosnappi/isis_authentication_base.go b/gosnappi/isis_authentication_base.go new file mode 100644 index 00000000..bb78f997 --- /dev/null +++ b/gosnappi/isis_authentication_base.go @@ -0,0 +1,395 @@ +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" +) + +// ***** IsisAuthenticationBase ***** +type isisAuthenticationBase struct { + validation + obj *otg.IsisAuthenticationBase + marshaller marshalIsisAuthenticationBase + unMarshaller unMarshalIsisAuthenticationBase +} + +func NewIsisAuthenticationBase() IsisAuthenticationBase { + obj := isisAuthenticationBase{obj: &otg.IsisAuthenticationBase{}} + obj.setDefault() + return &obj +} + +func (obj *isisAuthenticationBase) msg() *otg.IsisAuthenticationBase { + return obj.obj +} + +func (obj *isisAuthenticationBase) setMsg(msg *otg.IsisAuthenticationBase) IsisAuthenticationBase { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisAuthenticationBase struct { + obj *isisAuthenticationBase +} + +type marshalIsisAuthenticationBase interface { + // ToProto marshals IsisAuthenticationBase to protobuf object *otg.IsisAuthenticationBase + ToProto() (*otg.IsisAuthenticationBase, error) + // ToPbText marshals IsisAuthenticationBase to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisAuthenticationBase to YAML text + ToYaml() (string, error) + // ToJson marshals IsisAuthenticationBase to JSON text + ToJson() (string, error) +} + +type unMarshalisisAuthenticationBase struct { + obj *isisAuthenticationBase +} + +type unMarshalIsisAuthenticationBase interface { + // FromProto unmarshals IsisAuthenticationBase from protobuf object *otg.IsisAuthenticationBase + FromProto(msg *otg.IsisAuthenticationBase) (IsisAuthenticationBase, error) + // FromPbText unmarshals IsisAuthenticationBase from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisAuthenticationBase from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisAuthenticationBase from JSON text + FromJson(value string) error +} + +func (obj *isisAuthenticationBase) Marshal() marshalIsisAuthenticationBase { + if obj.marshaller == nil { + obj.marshaller = &marshalisisAuthenticationBase{obj: obj} + } + return obj.marshaller +} + +func (obj *isisAuthenticationBase) Unmarshal() unMarshalIsisAuthenticationBase { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisAuthenticationBase{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisAuthenticationBase) ToProto() (*otg.IsisAuthenticationBase, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisAuthenticationBase) FromProto(msg *otg.IsisAuthenticationBase) (IsisAuthenticationBase, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisAuthenticationBase) 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 *unMarshalisisAuthenticationBase) 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 *marshalisisAuthenticationBase) 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 *unMarshalisisAuthenticationBase) 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 *marshalisisAuthenticationBase) 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 *unMarshalisisAuthenticationBase) 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 *isisAuthenticationBase) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisAuthenticationBase) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisAuthenticationBase) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisAuthenticationBase) Clone() (IsisAuthenticationBase, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisAuthenticationBase() + 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 +} + +// IsisAuthenticationBase is optional container for ISIS authentication properties. +type IsisAuthenticationBase interface { + Validation + // msg marshals IsisAuthenticationBase to protobuf object *otg.IsisAuthenticationBase + // and doesn't set defaults + msg() *otg.IsisAuthenticationBase + // setMsg unmarshals IsisAuthenticationBase from protobuf object *otg.IsisAuthenticationBase + // and doesn't set defaults + setMsg(*otg.IsisAuthenticationBase) IsisAuthenticationBase + // provides marshal interface + Marshal() marshalIsisAuthenticationBase + // provides unmarshal interface + Unmarshal() unMarshalIsisAuthenticationBase + // validate validates IsisAuthenticationBase + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisAuthenticationBase, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // AuthType returns IsisAuthenticationBaseAuthTypeEnum, set in IsisAuthenticationBase + AuthType() IsisAuthenticationBaseAuthTypeEnum + // SetAuthType assigns IsisAuthenticationBaseAuthTypeEnum provided by user to IsisAuthenticationBase + SetAuthType(value IsisAuthenticationBaseAuthTypeEnum) IsisAuthenticationBase + // Md5 returns string, set in IsisAuthenticationBase. + Md5() string + // SetMd5 assigns string provided by user to IsisAuthenticationBase + SetMd5(value string) IsisAuthenticationBase + // HasMd5 checks if Md5 has been set in IsisAuthenticationBase + HasMd5() bool + // Password returns string, set in IsisAuthenticationBase. + Password() string + // SetPassword assigns string provided by user to IsisAuthenticationBase + SetPassword(value string) IsisAuthenticationBase + // HasPassword checks if Password has been set in IsisAuthenticationBase + HasPassword() bool +} + +type IsisAuthenticationBaseAuthTypeEnum string + +// Enum of AuthType on IsisAuthenticationBase +var IsisAuthenticationBaseAuthType = struct { + MD5 IsisAuthenticationBaseAuthTypeEnum + PASSWORD IsisAuthenticationBaseAuthTypeEnum +}{ + MD5: IsisAuthenticationBaseAuthTypeEnum("md5"), + PASSWORD: IsisAuthenticationBaseAuthTypeEnum("password"), +} + +func (obj *isisAuthenticationBase) AuthType() IsisAuthenticationBaseAuthTypeEnum { + return IsisAuthenticationBaseAuthTypeEnum(obj.obj.AuthType.Enum().String()) +} + +func (obj *isisAuthenticationBase) SetAuthType(value IsisAuthenticationBaseAuthTypeEnum) IsisAuthenticationBase { + intValue, ok := otg.IsisAuthenticationBase_AuthType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on IsisAuthenticationBaseAuthTypeEnum", string(value))) + return obj + } + enumValue := otg.IsisAuthenticationBase_AuthType_Enum(intValue) + obj.obj.AuthType = &enumValue + + return obj +} + +// Authentication as an MD5 key. +// Md5 returns a string +func (obj *isisAuthenticationBase) Md5() string { + + return *obj.obj.Md5 + +} + +// Authentication as an MD5 key. +// Md5 returns a string +func (obj *isisAuthenticationBase) HasMd5() bool { + return obj.obj.Md5 != nil +} + +// Authentication as an MD5 key. +// SetMd5 sets the string value in the IsisAuthenticationBase object +func (obj *isisAuthenticationBase) SetMd5(value string) IsisAuthenticationBase { + + obj.obj.Md5 = &value + return obj +} + +// Authentication as a clear text password. +// Password returns a string +func (obj *isisAuthenticationBase) Password() string { + + return *obj.obj.Password + +} + +// Authentication as a clear text password. +// Password returns a string +func (obj *isisAuthenticationBase) HasPassword() bool { + return obj.obj.Password != nil +} + +// Authentication as a clear text password. +// SetPassword sets the string value in the IsisAuthenticationBase object +func (obj *isisAuthenticationBase) SetPassword(value string) IsisAuthenticationBase { + + obj.obj.Password = &value + return obj +} + +func (obj *isisAuthenticationBase) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // AuthType is required + if obj.obj.AuthType == nil { + vObj.validationErrors = append(vObj.validationErrors, "AuthType is required field on interface IsisAuthenticationBase") + } + + if obj.obj.Md5 != nil { + + if len(*obj.obj.Md5) < 0 || len(*obj.obj.Md5) > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of IsisAuthenticationBase.Md5 <= 255 but Got %d", + len(*obj.obj.Md5))) + } + + } + + if obj.obj.Password != nil { + + if len(*obj.obj.Password) < 0 || len(*obj.obj.Password) > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of IsisAuthenticationBase.Password <= 255 but Got %d", + len(*obj.obj.Password))) + } + + } + +} + +func (obj *isisAuthenticationBase) setDefault() { + +} diff --git a/gosnappi/isis_basic.go b/gosnappi/isis_basic.go new file mode 100644 index 00000000..b4e46536 --- /dev/null +++ b/gosnappi/isis_basic.go @@ -0,0 +1,405 @@ +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" +) + +// ***** IsisBasic ***** +type isisBasic struct { + validation + obj *otg.IsisBasic + marshaller marshalIsisBasic + unMarshaller unMarshalIsisBasic +} + +func NewIsisBasic() IsisBasic { + obj := isisBasic{obj: &otg.IsisBasic{}} + obj.setDefault() + return &obj +} + +func (obj *isisBasic) msg() *otg.IsisBasic { + return obj.obj +} + +func (obj *isisBasic) setMsg(msg *otg.IsisBasic) IsisBasic { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisBasic struct { + obj *isisBasic +} + +type marshalIsisBasic interface { + // ToProto marshals IsisBasic to protobuf object *otg.IsisBasic + ToProto() (*otg.IsisBasic, error) + // ToPbText marshals IsisBasic to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisBasic to YAML text + ToYaml() (string, error) + // ToJson marshals IsisBasic to JSON text + ToJson() (string, error) +} + +type unMarshalisisBasic struct { + obj *isisBasic +} + +type unMarshalIsisBasic interface { + // FromProto unmarshals IsisBasic from protobuf object *otg.IsisBasic + FromProto(msg *otg.IsisBasic) (IsisBasic, error) + // FromPbText unmarshals IsisBasic from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisBasic from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisBasic from JSON text + FromJson(value string) error +} + +func (obj *isisBasic) Marshal() marshalIsisBasic { + if obj.marshaller == nil { + obj.marshaller = &marshalisisBasic{obj: obj} + } + return obj.marshaller +} + +func (obj *isisBasic) Unmarshal() unMarshalIsisBasic { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisBasic{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisBasic) ToProto() (*otg.IsisBasic, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisBasic) FromProto(msg *otg.IsisBasic) (IsisBasic, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisBasic) 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 *unMarshalisisBasic) 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 *marshalisisBasic) 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 *unMarshalisisBasic) 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 *marshalisisBasic) 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 *unMarshalisisBasic) 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 *isisBasic) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisBasic) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisBasic) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisBasic) Clone() (IsisBasic, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisBasic() + 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 +} + +// IsisBasic is this contains ISIS router basic properties. +type IsisBasic interface { + Validation + // msg marshals IsisBasic to protobuf object *otg.IsisBasic + // and doesn't set defaults + msg() *otg.IsisBasic + // setMsg unmarshals IsisBasic from protobuf object *otg.IsisBasic + // and doesn't set defaults + setMsg(*otg.IsisBasic) IsisBasic + // provides marshal interface + Marshal() marshalIsisBasic + // provides unmarshal interface + Unmarshal() unMarshalIsisBasic + // validate validates IsisBasic + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisBasic, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv4TeRouterId returns string, set in IsisBasic. + Ipv4TeRouterId() string + // SetIpv4TeRouterId assigns string provided by user to IsisBasic + SetIpv4TeRouterId(value string) IsisBasic + // HasIpv4TeRouterId checks if Ipv4TeRouterId has been set in IsisBasic + HasIpv4TeRouterId() bool + // Hostname returns string, set in IsisBasic. + Hostname() string + // SetHostname assigns string provided by user to IsisBasic + SetHostname(value string) IsisBasic + // HasHostname checks if Hostname has been set in IsisBasic + HasHostname() bool + // EnableWideMetric returns bool, set in IsisBasic. + EnableWideMetric() bool + // SetEnableWideMetric assigns bool provided by user to IsisBasic + SetEnableWideMetric(value bool) IsisBasic + // HasEnableWideMetric checks if EnableWideMetric has been set in IsisBasic + HasEnableWideMetric() bool + // LearnedLspFilter returns bool, set in IsisBasic. + LearnedLspFilter() bool + // SetLearnedLspFilter assigns bool provided by user to IsisBasic + SetLearnedLspFilter(value bool) IsisBasic + // HasLearnedLspFilter checks if LearnedLspFilter has been set in IsisBasic + HasLearnedLspFilter() bool +} + +// IPv4 Traffic Engineering(TE) router id. This address should be configured as an IPv4 Loopback address in 'ipv4_loopbacks' in the Device. +// Ipv4TeRouterId returns a string +func (obj *isisBasic) Ipv4TeRouterId() string { + + return *obj.obj.Ipv4TeRouterId + +} + +// IPv4 Traffic Engineering(TE) router id. This address should be configured as an IPv4 Loopback address in 'ipv4_loopbacks' in the Device. +// Ipv4TeRouterId returns a string +func (obj *isisBasic) HasIpv4TeRouterId() bool { + return obj.obj.Ipv4TeRouterId != nil +} + +// IPv4 Traffic Engineering(TE) router id. This address should be configured as an IPv4 Loopback address in 'ipv4_loopbacks' in the Device. +// SetIpv4TeRouterId sets the string value in the IsisBasic object +func (obj *isisBasic) SetIpv4TeRouterId(value string) IsisBasic { + + obj.obj.Ipv4TeRouterId = &value + return obj +} + +// Host name for the router. The host name is transmitted in all the packets sent from the router. +// Hostname returns a string +func (obj *isisBasic) Hostname() string { + + return *obj.obj.Hostname + +} + +// Host name for the router. The host name is transmitted in all the packets sent from the router. +// Hostname returns a string +func (obj *isisBasic) HasHostname() bool { + return obj.obj.Hostname != nil +} + +// Host name for the router. The host name is transmitted in all the packets sent from the router. +// SetHostname sets the string value in the IsisBasic object +func (obj *isisBasic) SetHostname(value string) IsisBasic { + + obj.obj.Hostname = &value + return obj +} + +// When set to true, it allows sending of more detailed metric information for the routes using 32-bit wide values using TLV 135 IP reachability and more detailed reachability information for IS reachability by using TLV 22. The detailed usage is described in RFC3784. +// EnableWideMetric returns a bool +func (obj *isisBasic) EnableWideMetric() bool { + + return *obj.obj.EnableWideMetric + +} + +// When set to true, it allows sending of more detailed metric information for the routes using 32-bit wide values using TLV 135 IP reachability and more detailed reachability information for IS reachability by using TLV 22. The detailed usage is described in RFC3784. +// EnableWideMetric returns a bool +func (obj *isisBasic) HasEnableWideMetric() bool { + return obj.obj.EnableWideMetric != nil +} + +// When set to true, it allows sending of more detailed metric information for the routes using 32-bit wide values using TLV 135 IP reachability and more detailed reachability information for IS reachability by using TLV 22. The detailed usage is described in RFC3784. +// SetEnableWideMetric sets the bool value in the IsisBasic object +func (obj *isisBasic) SetEnableWideMetric(value bool) IsisBasic { + + obj.obj.EnableWideMetric = &value + return obj +} + +// Configuration for controlling storage of ISIS learned LSPs are received from the neighbors. +// LearnedLspFilter returns a bool +func (obj *isisBasic) LearnedLspFilter() bool { + + return *obj.obj.LearnedLspFilter + +} + +// Configuration for controlling storage of ISIS learned LSPs are received from the neighbors. +// LearnedLspFilter returns a bool +func (obj *isisBasic) HasLearnedLspFilter() bool { + return obj.obj.LearnedLspFilter != nil +} + +// Configuration for controlling storage of ISIS learned LSPs are received from the neighbors. +// SetLearnedLspFilter sets the bool value in the IsisBasic object +func (obj *isisBasic) SetLearnedLspFilter(value bool) IsisBasic { + + obj.obj.LearnedLspFilter = &value + return obj +} + +func (obj *isisBasic) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv4TeRouterId != nil { + + err := obj.validateIpv4(obj.Ipv4TeRouterId()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on IsisBasic.Ipv4TeRouterId")) + } + + } + +} + +func (obj *isisBasic) setDefault() { + if obj.obj.EnableWideMetric == nil { + obj.SetEnableWideMetric(true) + } + if obj.obj.LearnedLspFilter == nil { + obj.SetLearnedLspFilter(false) + } + +} diff --git a/gosnappi/isis_interface.go b/gosnappi/isis_interface.go new file mode 100644 index 00000000..cd93de1a --- /dev/null +++ b/gosnappi/isis_interface.go @@ -0,0 +1,943 @@ +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" +) + +// ***** IsisInterface ***** +type isisInterface struct { + validation + obj *otg.IsisInterface + marshaller marshalIsisInterface + unMarshaller unMarshalIsisInterface + l1SettingsHolder IsisInterfaceLevel + l2SettingsHolder IsisInterfaceLevel + multiTopologyIdsHolder IsisInterfaceIsisMTIter + trafficEngineeringHolder IsisInterfaceLinkStateTEIter + authenticationHolder IsisInterfaceAuthentication + advancedHolder IsisInterfaceAdvanced + linkProtectionHolder IsisInterfaceLinkProtection +} + +func NewIsisInterface() IsisInterface { + obj := isisInterface{obj: &otg.IsisInterface{}} + obj.setDefault() + return &obj +} + +func (obj *isisInterface) msg() *otg.IsisInterface { + return obj.obj +} + +func (obj *isisInterface) setMsg(msg *otg.IsisInterface) IsisInterface { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisInterface struct { + obj *isisInterface +} + +type marshalIsisInterface interface { + // ToProto marshals IsisInterface to protobuf object *otg.IsisInterface + ToProto() (*otg.IsisInterface, error) + // ToPbText marshals IsisInterface to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisInterface to YAML text + ToYaml() (string, error) + // ToJson marshals IsisInterface to JSON text + ToJson() (string, error) +} + +type unMarshalisisInterface struct { + obj *isisInterface +} + +type unMarshalIsisInterface interface { + // FromProto unmarshals IsisInterface from protobuf object *otg.IsisInterface + FromProto(msg *otg.IsisInterface) (IsisInterface, error) + // FromPbText unmarshals IsisInterface from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisInterface from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisInterface from JSON text + FromJson(value string) error +} + +func (obj *isisInterface) Marshal() marshalIsisInterface { + if obj.marshaller == nil { + obj.marshaller = &marshalisisInterface{obj: obj} + } + return obj.marshaller +} + +func (obj *isisInterface) Unmarshal() unMarshalIsisInterface { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisInterface{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisInterface) ToProto() (*otg.IsisInterface, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisInterface) FromProto(msg *otg.IsisInterface) (IsisInterface, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisInterface) 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 *unMarshalisisInterface) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisInterface) 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 *unMarshalisisInterface) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisInterface) 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 *unMarshalisisInterface) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisInterface) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisInterface) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisInterface) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisInterface) Clone() (IsisInterface, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisInterface() + 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 +} + +func (obj *isisInterface) setNil() { + obj.l1SettingsHolder = nil + obj.l2SettingsHolder = nil + obj.multiTopologyIdsHolder = nil + obj.trafficEngineeringHolder = nil + obj.authenticationHolder = nil + obj.advancedHolder = nil + obj.linkProtectionHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisInterface is configuration for single ISIS interface. +type IsisInterface interface { + Validation + // msg marshals IsisInterface to protobuf object *otg.IsisInterface + // and doesn't set defaults + msg() *otg.IsisInterface + // setMsg unmarshals IsisInterface from protobuf object *otg.IsisInterface + // and doesn't set defaults + setMsg(*otg.IsisInterface) IsisInterface + // provides marshal interface + Marshal() marshalIsisInterface + // provides unmarshal interface + Unmarshal() unMarshalIsisInterface + // validate validates IsisInterface + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisInterface, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // EthName returns string, set in IsisInterface. + EthName() string + // SetEthName assigns string provided by user to IsisInterface + SetEthName(value string) IsisInterface + // Metric returns uint32, set in IsisInterface. + Metric() uint32 + // SetMetric assigns uint32 provided by user to IsisInterface + SetMetric(value uint32) IsisInterface + // HasMetric checks if Metric has been set in IsisInterface + HasMetric() bool + // NetworkType returns IsisInterfaceNetworkTypeEnum, set in IsisInterface + NetworkType() IsisInterfaceNetworkTypeEnum + // SetNetworkType assigns IsisInterfaceNetworkTypeEnum provided by user to IsisInterface + SetNetworkType(value IsisInterfaceNetworkTypeEnum) IsisInterface + // HasNetworkType checks if NetworkType has been set in IsisInterface + HasNetworkType() bool + // LevelType returns IsisInterfaceLevelTypeEnum, set in IsisInterface + LevelType() IsisInterfaceLevelTypeEnum + // SetLevelType assigns IsisInterfaceLevelTypeEnum provided by user to IsisInterface + SetLevelType(value IsisInterfaceLevelTypeEnum) IsisInterface + // HasLevelType checks if LevelType has been set in IsisInterface + HasLevelType() bool + // L1Settings returns IsisInterfaceLevel, set in IsisInterface. + // IsisInterfaceLevel is configuration for the properties of Level 1 Hello. + L1Settings() IsisInterfaceLevel + // SetL1Settings assigns IsisInterfaceLevel provided by user to IsisInterface. + // IsisInterfaceLevel is configuration for the properties of Level 1 Hello. + SetL1Settings(value IsisInterfaceLevel) IsisInterface + // HasL1Settings checks if L1Settings has been set in IsisInterface + HasL1Settings() bool + // L2Settings returns IsisInterfaceLevel, set in IsisInterface. + // IsisInterfaceLevel is configuration for the properties of Level 1 Hello. + L2Settings() IsisInterfaceLevel + // SetL2Settings assigns IsisInterfaceLevel provided by user to IsisInterface. + // IsisInterfaceLevel is configuration for the properties of Level 1 Hello. + SetL2Settings(value IsisInterfaceLevel) IsisInterface + // HasL2Settings checks if L2Settings has been set in IsisInterface + HasL2Settings() bool + // MultiTopologyIds returns IsisInterfaceIsisMTIterIter, set in IsisInterface + MultiTopologyIds() IsisInterfaceIsisMTIter + // TrafficEngineering returns IsisInterfaceLinkStateTEIterIter, set in IsisInterface + TrafficEngineering() IsisInterfaceLinkStateTEIter + // Authentication returns IsisInterfaceAuthentication, set in IsisInterface. + // IsisInterfaceAuthentication is optional container for circuit authentication properties. + Authentication() IsisInterfaceAuthentication + // SetAuthentication assigns IsisInterfaceAuthentication provided by user to IsisInterface. + // IsisInterfaceAuthentication is optional container for circuit authentication properties. + SetAuthentication(value IsisInterfaceAuthentication) IsisInterface + // HasAuthentication checks if Authentication has been set in IsisInterface + HasAuthentication() bool + // Advanced returns IsisInterfaceAdvanced, set in IsisInterface. + // IsisInterfaceAdvanced is optional container for advanced interface properties. + Advanced() IsisInterfaceAdvanced + // SetAdvanced assigns IsisInterfaceAdvanced provided by user to IsisInterface. + // IsisInterfaceAdvanced is optional container for advanced interface properties. + SetAdvanced(value IsisInterfaceAdvanced) IsisInterface + // HasAdvanced checks if Advanced has been set in IsisInterface + HasAdvanced() bool + // LinkProtection returns IsisInterfaceLinkProtection, set in IsisInterface. + // IsisInterfaceLinkProtection is optional container for the link protection sub TLV (type 20). + LinkProtection() IsisInterfaceLinkProtection + // SetLinkProtection assigns IsisInterfaceLinkProtection provided by user to IsisInterface. + // IsisInterfaceLinkProtection is optional container for the link protection sub TLV (type 20). + SetLinkProtection(value IsisInterfaceLinkProtection) IsisInterface + // HasLinkProtection checks if LinkProtection has been set in IsisInterface + HasLinkProtection() bool + // SrlgValues returns []uint32, set in IsisInterface. + SrlgValues() []uint32 + // SetSrlgValues assigns []uint32 provided by user to IsisInterface + SetSrlgValues(value []uint32) IsisInterface + // Name returns string, set in IsisInterface. + Name() string + // SetName assigns string provided by user to IsisInterface + SetName(value string) IsisInterface + setNil() +} + +// The unique name of the Ethernet interface on which ISIS is running. Two ISIS interfaces cannot share the same Ethernet. +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// EthName returns a string +func (obj *isisInterface) EthName() string { + + return *obj.obj.EthName + +} + +// The unique name of the Ethernet interface on which ISIS is running. Two ISIS interfaces cannot share the same Ethernet. +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// SetEthName sets the string value in the IsisInterface object +func (obj *isisInterface) SetEthName(value string) IsisInterface { + + obj.obj.EthName = &value + return obj +} + +// The default metric cost for the interface. +// Metric returns a uint32 +func (obj *isisInterface) Metric() uint32 { + + return *obj.obj.Metric + +} + +// The default metric cost for the interface. +// Metric returns a uint32 +func (obj *isisInterface) HasMetric() bool { + return obj.obj.Metric != nil +} + +// The default metric cost for the interface. +// SetMetric sets the uint32 value in the IsisInterface object +func (obj *isisInterface) SetMetric(value uint32) IsisInterface { + + obj.obj.Metric = &value + return obj +} + +type IsisInterfaceNetworkTypeEnum string + +// Enum of NetworkType on IsisInterface +var IsisInterfaceNetworkType = struct { + BROADCAST IsisInterfaceNetworkTypeEnum + POINT_TO_POINT IsisInterfaceNetworkTypeEnum +}{ + BROADCAST: IsisInterfaceNetworkTypeEnum("broadcast"), + POINT_TO_POINT: IsisInterfaceNetworkTypeEnum("point_to_point"), +} + +func (obj *isisInterface) NetworkType() IsisInterfaceNetworkTypeEnum { + return IsisInterfaceNetworkTypeEnum(obj.obj.NetworkType.Enum().String()) +} + +// The type of network link. +// NetworkType returns a string +func (obj *isisInterface) HasNetworkType() bool { + return obj.obj.NetworkType != nil +} + +func (obj *isisInterface) SetNetworkType(value IsisInterfaceNetworkTypeEnum) IsisInterface { + intValue, ok := otg.IsisInterface_NetworkType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on IsisInterfaceNetworkTypeEnum", string(value))) + return obj + } + enumValue := otg.IsisInterface_NetworkType_Enum(intValue) + obj.obj.NetworkType = &enumValue + + return obj +} + +type IsisInterfaceLevelTypeEnum string + +// Enum of LevelType on IsisInterface +var IsisInterfaceLevelType = struct { + LEVEL_1 IsisInterfaceLevelTypeEnum + LEVEL_2 IsisInterfaceLevelTypeEnum + LEVEL_1_2 IsisInterfaceLevelTypeEnum +}{ + LEVEL_1: IsisInterfaceLevelTypeEnum("level_1"), + LEVEL_2: IsisInterfaceLevelTypeEnum("level_2"), + LEVEL_1_2: IsisInterfaceLevelTypeEnum("level_1_2"), +} + +func (obj *isisInterface) LevelType() IsisInterfaceLevelTypeEnum { + return IsisInterfaceLevelTypeEnum(obj.obj.LevelType.Enum().String()) +} + +// This indicates whether this router is participating in Level-1 (L1), +// Level-2 (L2) or both L1 and L2 domains on this interface. +// LevelType returns a string +func (obj *isisInterface) HasLevelType() bool { + return obj.obj.LevelType != nil +} + +func (obj *isisInterface) SetLevelType(value IsisInterfaceLevelTypeEnum) IsisInterface { + intValue, ok := otg.IsisInterface_LevelType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on IsisInterfaceLevelTypeEnum", string(value))) + return obj + } + enumValue := otg.IsisInterface_LevelType_Enum(intValue) + obj.obj.LevelType = &enumValue + + return obj +} + +// Settings of Level 1 Hello. +// L1Settings returns a IsisInterfaceLevel +func (obj *isisInterface) L1Settings() IsisInterfaceLevel { + if obj.obj.L1Settings == nil { + obj.obj.L1Settings = NewIsisInterfaceLevel().msg() + } + if obj.l1SettingsHolder == nil { + obj.l1SettingsHolder = &isisInterfaceLevel{obj: obj.obj.L1Settings} + } + return obj.l1SettingsHolder +} + +// Settings of Level 1 Hello. +// L1Settings returns a IsisInterfaceLevel +func (obj *isisInterface) HasL1Settings() bool { + return obj.obj.L1Settings != nil +} + +// Settings of Level 1 Hello. +// SetL1Settings sets the IsisInterfaceLevel value in the IsisInterface object +func (obj *isisInterface) SetL1Settings(value IsisInterfaceLevel) IsisInterface { + + obj.l1SettingsHolder = nil + obj.obj.L1Settings = value.msg() + + return obj +} + +// Settings of Level 2 Hello. +// L2Settings returns a IsisInterfaceLevel +func (obj *isisInterface) L2Settings() IsisInterfaceLevel { + if obj.obj.L2Settings == nil { + obj.obj.L2Settings = NewIsisInterfaceLevel().msg() + } + if obj.l2SettingsHolder == nil { + obj.l2SettingsHolder = &isisInterfaceLevel{obj: obj.obj.L2Settings} + } + return obj.l2SettingsHolder +} + +// Settings of Level 2 Hello. +// L2Settings returns a IsisInterfaceLevel +func (obj *isisInterface) HasL2Settings() bool { + return obj.obj.L2Settings != nil +} + +// Settings of Level 2 Hello. +// SetL2Settings sets the IsisInterfaceLevel value in the IsisInterface object +func (obj *isisInterface) SetL2Settings(value IsisInterfaceLevel) IsisInterface { + + obj.l2SettingsHolder = nil + obj.obj.L2Settings = value.msg() + + return obj +} + +// Contains the properties of multiple topologies. +// MultiTopologyIds returns a []IsisMT +func (obj *isisInterface) MultiTopologyIds() IsisInterfaceIsisMTIter { + if len(obj.obj.MultiTopologyIds) == 0 { + obj.obj.MultiTopologyIds = []*otg.IsisMT{} + } + if obj.multiTopologyIdsHolder == nil { + obj.multiTopologyIdsHolder = newIsisInterfaceIsisMTIter(&obj.obj.MultiTopologyIds).setMsg(obj) + } + return obj.multiTopologyIdsHolder +} + +type isisInterfaceIsisMTIter struct { + obj *isisInterface + isisMTSlice []IsisMT + fieldPtr *[]*otg.IsisMT +} + +func newIsisInterfaceIsisMTIter(ptr *[]*otg.IsisMT) IsisInterfaceIsisMTIter { + return &isisInterfaceIsisMTIter{fieldPtr: ptr} +} + +type IsisInterfaceIsisMTIter interface { + setMsg(*isisInterface) IsisInterfaceIsisMTIter + Items() []IsisMT + Add() IsisMT + Append(items ...IsisMT) IsisInterfaceIsisMTIter + Set(index int, newObj IsisMT) IsisInterfaceIsisMTIter + Clear() IsisInterfaceIsisMTIter + clearHolderSlice() IsisInterfaceIsisMTIter + appendHolderSlice(item IsisMT) IsisInterfaceIsisMTIter +} + +func (obj *isisInterfaceIsisMTIter) setMsg(msg *isisInterface) IsisInterfaceIsisMTIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisMT{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisInterfaceIsisMTIter) Items() []IsisMT { + return obj.isisMTSlice +} + +func (obj *isisInterfaceIsisMTIter) Add() IsisMT { + newObj := &otg.IsisMT{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisMT{obj: newObj} + newLibObj.setDefault() + obj.isisMTSlice = append(obj.isisMTSlice, newLibObj) + return newLibObj +} + +func (obj *isisInterfaceIsisMTIter) Append(items ...IsisMT) IsisInterfaceIsisMTIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisMTSlice = append(obj.isisMTSlice, item) + } + return obj +} + +func (obj *isisInterfaceIsisMTIter) Set(index int, newObj IsisMT) IsisInterfaceIsisMTIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisMTSlice[index] = newObj + return obj +} +func (obj *isisInterfaceIsisMTIter) Clear() IsisInterfaceIsisMTIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisMT{} + obj.isisMTSlice = []IsisMT{} + } + return obj +} +func (obj *isisInterfaceIsisMTIter) clearHolderSlice() IsisInterfaceIsisMTIter { + if len(obj.isisMTSlice) > 0 { + obj.isisMTSlice = []IsisMT{} + } + return obj +} +func (obj *isisInterfaceIsisMTIter) appendHolderSlice(item IsisMT) IsisInterfaceIsisMTIter { + obj.isisMTSlice = append(obj.isisMTSlice, item) + return obj +} + +// Contains a list of Traffic Engineering attributes. +// TrafficEngineering returns a []LinkStateTE +func (obj *isisInterface) TrafficEngineering() IsisInterfaceLinkStateTEIter { + if len(obj.obj.TrafficEngineering) == 0 { + obj.obj.TrafficEngineering = []*otg.LinkStateTE{} + } + if obj.trafficEngineeringHolder == nil { + obj.trafficEngineeringHolder = newIsisInterfaceLinkStateTEIter(&obj.obj.TrafficEngineering).setMsg(obj) + } + return obj.trafficEngineeringHolder +} + +type isisInterfaceLinkStateTEIter struct { + obj *isisInterface + linkStateTESlice []LinkStateTE + fieldPtr *[]*otg.LinkStateTE +} + +func newIsisInterfaceLinkStateTEIter(ptr *[]*otg.LinkStateTE) IsisInterfaceLinkStateTEIter { + return &isisInterfaceLinkStateTEIter{fieldPtr: ptr} +} + +type IsisInterfaceLinkStateTEIter interface { + setMsg(*isisInterface) IsisInterfaceLinkStateTEIter + Items() []LinkStateTE + Add() LinkStateTE + Append(items ...LinkStateTE) IsisInterfaceLinkStateTEIter + Set(index int, newObj LinkStateTE) IsisInterfaceLinkStateTEIter + Clear() IsisInterfaceLinkStateTEIter + clearHolderSlice() IsisInterfaceLinkStateTEIter + appendHolderSlice(item LinkStateTE) IsisInterfaceLinkStateTEIter +} + +func (obj *isisInterfaceLinkStateTEIter) setMsg(msg *isisInterface) IsisInterfaceLinkStateTEIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&linkStateTE{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisInterfaceLinkStateTEIter) Items() []LinkStateTE { + return obj.linkStateTESlice +} + +func (obj *isisInterfaceLinkStateTEIter) Add() LinkStateTE { + newObj := &otg.LinkStateTE{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &linkStateTE{obj: newObj} + newLibObj.setDefault() + obj.linkStateTESlice = append(obj.linkStateTESlice, newLibObj) + return newLibObj +} + +func (obj *isisInterfaceLinkStateTEIter) Append(items ...LinkStateTE) IsisInterfaceLinkStateTEIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.linkStateTESlice = append(obj.linkStateTESlice, item) + } + return obj +} + +func (obj *isisInterfaceLinkStateTEIter) Set(index int, newObj LinkStateTE) IsisInterfaceLinkStateTEIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.linkStateTESlice[index] = newObj + return obj +} +func (obj *isisInterfaceLinkStateTEIter) Clear() IsisInterfaceLinkStateTEIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.LinkStateTE{} + obj.linkStateTESlice = []LinkStateTE{} + } + return obj +} +func (obj *isisInterfaceLinkStateTEIter) clearHolderSlice() IsisInterfaceLinkStateTEIter { + if len(obj.linkStateTESlice) > 0 { + obj.linkStateTESlice = []LinkStateTE{} + } + return obj +} +func (obj *isisInterfaceLinkStateTEIter) appendHolderSlice(item LinkStateTE) IsisInterfaceLinkStateTEIter { + obj.linkStateTESlice = append(obj.linkStateTESlice, item) + return obj +} + +// The Circuit authentication method used for the interfaces on this emulated ISIS v4/v6 router. +// Authentication returns a IsisInterfaceAuthentication +func (obj *isisInterface) Authentication() IsisInterfaceAuthentication { + if obj.obj.Authentication == nil { + obj.obj.Authentication = NewIsisInterfaceAuthentication().msg() + } + if obj.authenticationHolder == nil { + obj.authenticationHolder = &isisInterfaceAuthentication{obj: obj.obj.Authentication} + } + return obj.authenticationHolder +} + +// The Circuit authentication method used for the interfaces on this emulated ISIS v4/v6 router. +// Authentication returns a IsisInterfaceAuthentication +func (obj *isisInterface) HasAuthentication() bool { + return obj.obj.Authentication != nil +} + +// The Circuit authentication method used for the interfaces on this emulated ISIS v4/v6 router. +// SetAuthentication sets the IsisInterfaceAuthentication value in the IsisInterface object +func (obj *isisInterface) SetAuthentication(value IsisInterfaceAuthentication) IsisInterface { + + obj.authenticationHolder = nil + obj.obj.Authentication = value.msg() + + return obj +} + +// Optional container for advanced interface properties. +// Advanced returns a IsisInterfaceAdvanced +func (obj *isisInterface) Advanced() IsisInterfaceAdvanced { + if obj.obj.Advanced == nil { + obj.obj.Advanced = NewIsisInterfaceAdvanced().msg() + } + if obj.advancedHolder == nil { + obj.advancedHolder = &isisInterfaceAdvanced{obj: obj.obj.Advanced} + } + return obj.advancedHolder +} + +// Optional container for advanced interface properties. +// Advanced returns a IsisInterfaceAdvanced +func (obj *isisInterface) HasAdvanced() bool { + return obj.obj.Advanced != nil +} + +// Optional container for advanced interface properties. +// SetAdvanced sets the IsisInterfaceAdvanced value in the IsisInterface object +func (obj *isisInterface) SetAdvanced(value IsisInterfaceAdvanced) IsisInterface { + + obj.advancedHolder = nil + obj.obj.Advanced = value.msg() + + return obj +} + +// Link protection on the ISIS link between two interfaces. +// LinkProtection returns a IsisInterfaceLinkProtection +func (obj *isisInterface) LinkProtection() IsisInterfaceLinkProtection { + if obj.obj.LinkProtection == nil { + obj.obj.LinkProtection = NewIsisInterfaceLinkProtection().msg() + } + if obj.linkProtectionHolder == nil { + obj.linkProtectionHolder = &isisInterfaceLinkProtection{obj: obj.obj.LinkProtection} + } + return obj.linkProtectionHolder +} + +// Link protection on the ISIS link between two interfaces. +// LinkProtection returns a IsisInterfaceLinkProtection +func (obj *isisInterface) HasLinkProtection() bool { + return obj.obj.LinkProtection != nil +} + +// Link protection on the ISIS link between two interfaces. +// SetLinkProtection sets the IsisInterfaceLinkProtection value in the IsisInterface object +func (obj *isisInterface) SetLinkProtection(value IsisInterfaceLinkProtection) IsisInterface { + + obj.linkProtectionHolder = nil + obj.obj.LinkProtection = value.msg() + + return obj +} + +// This contains list of SRLG values for the link between two interfaces. +// SrlgValues returns a []uint32 +func (obj *isisInterface) SrlgValues() []uint32 { + if obj.obj.SrlgValues == nil { + obj.obj.SrlgValues = make([]uint32, 0) + } + return obj.obj.SrlgValues +} + +// This contains list of SRLG values for the link between two interfaces. +// SetSrlgValues sets the []uint32 value in the IsisInterface object +func (obj *isisInterface) SetSrlgValues(value []uint32) IsisInterface { + + if obj.obj.SrlgValues == nil { + obj.obj.SrlgValues = make([]uint32, 0) + } + obj.obj.SrlgValues = value + + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *isisInterface) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the IsisInterface object +func (obj *isisInterface) SetName(value string) IsisInterface { + + obj.obj.Name = &value + return obj +} + +func (obj *isisInterface) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // EthName is required + if obj.obj.EthName == nil { + vObj.validationErrors = append(vObj.validationErrors, "EthName is required field on interface IsisInterface") + } + + if obj.obj.Metric != nil { + + if *obj.obj.Metric > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= IsisInterface.Metric <= 16777215 but Got %d", *obj.obj.Metric)) + } + + } + + if obj.obj.L1Settings != nil { + + obj.L1Settings().validateObj(vObj, set_default) + } + + if obj.obj.L2Settings != nil { + + obj.L2Settings().validateObj(vObj, set_default) + } + + if len(obj.obj.MultiTopologyIds) != 0 { + + if set_default { + obj.MultiTopologyIds().clearHolderSlice() + for _, item := range obj.obj.MultiTopologyIds { + obj.MultiTopologyIds().appendHolderSlice(&isisMT{obj: item}) + } + } + for _, item := range obj.MultiTopologyIds().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.TrafficEngineering) != 0 { + + if set_default { + obj.TrafficEngineering().clearHolderSlice() + for _, item := range obj.obj.TrafficEngineering { + obj.TrafficEngineering().appendHolderSlice(&linkStateTE{obj: item}) + } + } + for _, item := range obj.TrafficEngineering().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Authentication != nil { + + obj.Authentication().validateObj(vObj, set_default) + } + + if obj.obj.Advanced != nil { + + obj.Advanced().validateObj(vObj, set_default) + } + + if obj.obj.LinkProtection != nil { + + obj.LinkProtection().validateObj(vObj, set_default) + } + + if obj.obj.SrlgValues != nil { + + for _, item := range obj.obj.SrlgValues { + if item > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= IsisInterface.SrlgValues <= 16777215 but Got %d", item)) + } + + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface IsisInterface") + } +} + +func (obj *isisInterface) setDefault() { + if obj.obj.Metric == nil { + obj.SetMetric(10) + } + if obj.obj.NetworkType == nil { + obj.SetNetworkType(IsisInterfaceNetworkType.BROADCAST) + + } + if obj.obj.LevelType == nil { + obj.SetLevelType(IsisInterfaceLevelType.LEVEL_2) + + } + +} diff --git a/gosnappi/isis_interface_advanced.go b/gosnappi/isis_interface_advanced.go new file mode 100644 index 00000000..9367cd13 --- /dev/null +++ b/gosnappi/isis_interface_advanced.go @@ -0,0 +1,451 @@ +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" +) + +// ***** IsisInterfaceAdvanced ***** +type isisInterfaceAdvanced struct { + validation + obj *otg.IsisInterfaceAdvanced + marshaller marshalIsisInterfaceAdvanced + unMarshaller unMarshalIsisInterfaceAdvanced +} + +func NewIsisInterfaceAdvanced() IsisInterfaceAdvanced { + obj := isisInterfaceAdvanced{obj: &otg.IsisInterfaceAdvanced{}} + obj.setDefault() + return &obj +} + +func (obj *isisInterfaceAdvanced) msg() *otg.IsisInterfaceAdvanced { + return obj.obj +} + +func (obj *isisInterfaceAdvanced) setMsg(msg *otg.IsisInterfaceAdvanced) IsisInterfaceAdvanced { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisInterfaceAdvanced struct { + obj *isisInterfaceAdvanced +} + +type marshalIsisInterfaceAdvanced interface { + // ToProto marshals IsisInterfaceAdvanced to protobuf object *otg.IsisInterfaceAdvanced + ToProto() (*otg.IsisInterfaceAdvanced, error) + // ToPbText marshals IsisInterfaceAdvanced to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisInterfaceAdvanced to YAML text + ToYaml() (string, error) + // ToJson marshals IsisInterfaceAdvanced to JSON text + ToJson() (string, error) +} + +type unMarshalisisInterfaceAdvanced struct { + obj *isisInterfaceAdvanced +} + +type unMarshalIsisInterfaceAdvanced interface { + // FromProto unmarshals IsisInterfaceAdvanced from protobuf object *otg.IsisInterfaceAdvanced + FromProto(msg *otg.IsisInterfaceAdvanced) (IsisInterfaceAdvanced, error) + // FromPbText unmarshals IsisInterfaceAdvanced from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisInterfaceAdvanced from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisInterfaceAdvanced from JSON text + FromJson(value string) error +} + +func (obj *isisInterfaceAdvanced) Marshal() marshalIsisInterfaceAdvanced { + if obj.marshaller == nil { + obj.marshaller = &marshalisisInterfaceAdvanced{obj: obj} + } + return obj.marshaller +} + +func (obj *isisInterfaceAdvanced) Unmarshal() unMarshalIsisInterfaceAdvanced { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisInterfaceAdvanced{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisInterfaceAdvanced) ToProto() (*otg.IsisInterfaceAdvanced, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisInterfaceAdvanced) FromProto(msg *otg.IsisInterfaceAdvanced) (IsisInterfaceAdvanced, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisInterfaceAdvanced) 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 *unMarshalisisInterfaceAdvanced) 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 *marshalisisInterfaceAdvanced) 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 *unMarshalisisInterfaceAdvanced) 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 *marshalisisInterfaceAdvanced) 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 *unMarshalisisInterfaceAdvanced) 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 *isisInterfaceAdvanced) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisInterfaceAdvanced) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisInterfaceAdvanced) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisInterfaceAdvanced) Clone() (IsisInterfaceAdvanced, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisInterfaceAdvanced() + 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 +} + +// IsisInterfaceAdvanced is optional container for advanced interface properties. +type IsisInterfaceAdvanced interface { + Validation + // msg marshals IsisInterfaceAdvanced to protobuf object *otg.IsisInterfaceAdvanced + // and doesn't set defaults + msg() *otg.IsisInterfaceAdvanced + // setMsg unmarshals IsisInterfaceAdvanced from protobuf object *otg.IsisInterfaceAdvanced + // and doesn't set defaults + setMsg(*otg.IsisInterfaceAdvanced) IsisInterfaceAdvanced + // provides marshal interface + Marshal() marshalIsisInterfaceAdvanced + // provides unmarshal interface + Unmarshal() unMarshalIsisInterfaceAdvanced + // validate validates IsisInterfaceAdvanced + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisInterfaceAdvanced, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // AutoAdjustMtu returns bool, set in IsisInterfaceAdvanced. + AutoAdjustMtu() bool + // SetAutoAdjustMtu assigns bool provided by user to IsisInterfaceAdvanced + SetAutoAdjustMtu(value bool) IsisInterfaceAdvanced + // HasAutoAdjustMtu checks if AutoAdjustMtu has been set in IsisInterfaceAdvanced + HasAutoAdjustMtu() bool + // AutoAdjustArea returns bool, set in IsisInterfaceAdvanced. + AutoAdjustArea() bool + // SetAutoAdjustArea assigns bool provided by user to IsisInterfaceAdvanced + SetAutoAdjustArea(value bool) IsisInterfaceAdvanced + // HasAutoAdjustArea checks if AutoAdjustArea has been set in IsisInterfaceAdvanced + HasAutoAdjustArea() bool + // AutoAdjustSupportedProtocols returns bool, set in IsisInterfaceAdvanced. + AutoAdjustSupportedProtocols() bool + // SetAutoAdjustSupportedProtocols assigns bool provided by user to IsisInterfaceAdvanced + SetAutoAdjustSupportedProtocols(value bool) IsisInterfaceAdvanced + // HasAutoAdjustSupportedProtocols checks if AutoAdjustSupportedProtocols has been set in IsisInterfaceAdvanced + HasAutoAdjustSupportedProtocols() bool + // Enable3WayHandshake returns bool, set in IsisInterfaceAdvanced. + Enable3WayHandshake() bool + // SetEnable3WayHandshake assigns bool provided by user to IsisInterfaceAdvanced + SetEnable3WayHandshake(value bool) IsisInterfaceAdvanced + // HasEnable3WayHandshake checks if Enable3WayHandshake has been set in IsisInterfaceAdvanced + HasEnable3WayHandshake() bool + // P2PHellosToUnicastMac returns bool, set in IsisInterfaceAdvanced. + P2PHellosToUnicastMac() bool + // SetP2PHellosToUnicastMac assigns bool provided by user to IsisInterfaceAdvanced + SetP2PHellosToUnicastMac(value bool) IsisInterfaceAdvanced + // HasP2PHellosToUnicastMac checks if P2PHellosToUnicastMac has been set in IsisInterfaceAdvanced + HasP2PHellosToUnicastMac() bool +} + +// If a padded Hello message is received on the interface, the length of +// the Hello packets sent out on that interface is adjusted to match. +// AutoAdjustMtu returns a bool +func (obj *isisInterfaceAdvanced) AutoAdjustMtu() bool { + + return *obj.obj.AutoAdjustMtu + +} + +// If a padded Hello message is received on the interface, the length of +// the Hello packets sent out on that interface is adjusted to match. +// AutoAdjustMtu returns a bool +func (obj *isisInterfaceAdvanced) HasAutoAdjustMtu() bool { + return obj.obj.AutoAdjustMtu != nil +} + +// If a padded Hello message is received on the interface, the length of +// the Hello packets sent out on that interface is adjusted to match. +// SetAutoAdjustMtu sets the bool value in the IsisInterfaceAdvanced object +func (obj *isisInterfaceAdvanced) SetAutoAdjustMtu(value bool) IsisInterfaceAdvanced { + + obj.obj.AutoAdjustMtu = &value + return obj +} + +// If a Level 1 Hello is received on this emulated router for an area +// not currently in its area list, an area from the received Hello is +// added to that list. This ensures an area match for all future +// Level 1 Hellos from the source L1 router. +// AutoAdjustArea returns a bool +func (obj *isisInterfaceAdvanced) AutoAdjustArea() bool { + + return *obj.obj.AutoAdjustArea + +} + +// If a Level 1 Hello is received on this emulated router for an area +// not currently in its area list, an area from the received Hello is +// added to that list. This ensures an area match for all future +// Level 1 Hellos from the source L1 router. +// AutoAdjustArea returns a bool +func (obj *isisInterfaceAdvanced) HasAutoAdjustArea() bool { + return obj.obj.AutoAdjustArea != nil +} + +// If a Level 1 Hello is received on this emulated router for an area +// not currently in its area list, an area from the received Hello is +// added to that list. This ensures an area match for all future +// Level 1 Hellos from the source L1 router. +// SetAutoAdjustArea sets the bool value in the IsisInterfaceAdvanced object +func (obj *isisInterfaceAdvanced) SetAutoAdjustArea(value bool) IsisInterfaceAdvanced { + + obj.obj.AutoAdjustArea = &value + return obj +} + +// If a Hello message listing supported protocols is received on this +// emulated router, the supported protocols advertised by this router +// are changed to match exactly. +// AutoAdjustSupportedProtocols returns a bool +func (obj *isisInterfaceAdvanced) AutoAdjustSupportedProtocols() bool { + + return *obj.obj.AutoAdjustSupportedProtocols + +} + +// If a Hello message listing supported protocols is received on this +// emulated router, the supported protocols advertised by this router +// are changed to match exactly. +// AutoAdjustSupportedProtocols returns a bool +func (obj *isisInterfaceAdvanced) HasAutoAdjustSupportedProtocols() bool { + return obj.obj.AutoAdjustSupportedProtocols != nil +} + +// If a Hello message listing supported protocols is received on this +// emulated router, the supported protocols advertised by this router +// are changed to match exactly. +// SetAutoAdjustSupportedProtocols sets the bool value in the IsisInterfaceAdvanced object +func (obj *isisInterfaceAdvanced) SetAutoAdjustSupportedProtocols(value bool) IsisInterfaceAdvanced { + + obj.obj.AutoAdjustSupportedProtocols = &value + return obj +} + +// If it is true, the Point-to-Point circuit will include 3-way TLV in its Point-to-Point IIH and attempt to establish the adjacency as specified in RFC 5303. This field is not applicable if network_type is set to 'broadcast' type in ISIS interface. +// Enable3WayHandshake returns a bool +func (obj *isisInterfaceAdvanced) Enable3WayHandshake() bool { + + return *obj.obj.Enable_3WayHandshake + +} + +// If it is true, the Point-to-Point circuit will include 3-way TLV in its Point-to-Point IIH and attempt to establish the adjacency as specified in RFC 5303. This field is not applicable if network_type is set to 'broadcast' type in ISIS interface. +// Enable3WayHandshake returns a bool +func (obj *isisInterfaceAdvanced) HasEnable3WayHandshake() bool { + return obj.obj.Enable_3WayHandshake != nil +} + +// If it is true, the Point-to-Point circuit will include 3-way TLV in its Point-to-Point IIH and attempt to establish the adjacency as specified in RFC 5303. This field is not applicable if network_type is set to 'broadcast' type in ISIS interface. +// SetEnable3WayHandshake sets the bool value in the IsisInterfaceAdvanced object +func (obj *isisInterfaceAdvanced) SetEnable3WayHandshake(value bool) IsisInterfaceAdvanced { + + obj.obj.Enable_3WayHandshake = &value + return obj +} + +// If it is true, the Point-to-Point Hello messages will be sent to the unicast MAC address. +// P2PHellosToUnicastMac returns a bool +func (obj *isisInterfaceAdvanced) P2PHellosToUnicastMac() bool { + + return *obj.obj.P2PHellosToUnicastMac + +} + +// If it is true, the Point-to-Point Hello messages will be sent to the unicast MAC address. +// P2PHellosToUnicastMac returns a bool +func (obj *isisInterfaceAdvanced) HasP2PHellosToUnicastMac() bool { + return obj.obj.P2PHellosToUnicastMac != nil +} + +// If it is true, the Point-to-Point Hello messages will be sent to the unicast MAC address. +// SetP2PHellosToUnicastMac sets the bool value in the IsisInterfaceAdvanced object +func (obj *isisInterfaceAdvanced) SetP2PHellosToUnicastMac(value bool) IsisInterfaceAdvanced { + + obj.obj.P2PHellosToUnicastMac = &value + return obj +} + +func (obj *isisInterfaceAdvanced) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *isisInterfaceAdvanced) setDefault() { + if obj.obj.AutoAdjustMtu == nil { + obj.SetAutoAdjustMtu(true) + } + if obj.obj.AutoAdjustArea == nil { + obj.SetAutoAdjustArea(true) + } + if obj.obj.AutoAdjustSupportedProtocols == nil { + obj.SetAutoAdjustSupportedProtocols(false) + } + if obj.obj.Enable_3WayHandshake == nil { + obj.SetEnable3WayHandshake(true) + } + if obj.obj.P2PHellosToUnicastMac == nil { + obj.SetP2PHellosToUnicastMac(false) + } + +} diff --git a/gosnappi/isis_interface_authentication.go b/gosnappi/isis_interface_authentication.go new file mode 100644 index 00000000..ba833523 --- /dev/null +++ b/gosnappi/isis_interface_authentication.go @@ -0,0 +1,395 @@ +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" +) + +// ***** IsisInterfaceAuthentication ***** +type isisInterfaceAuthentication struct { + validation + obj *otg.IsisInterfaceAuthentication + marshaller marshalIsisInterfaceAuthentication + unMarshaller unMarshalIsisInterfaceAuthentication +} + +func NewIsisInterfaceAuthentication() IsisInterfaceAuthentication { + obj := isisInterfaceAuthentication{obj: &otg.IsisInterfaceAuthentication{}} + obj.setDefault() + return &obj +} + +func (obj *isisInterfaceAuthentication) msg() *otg.IsisInterfaceAuthentication { + return obj.obj +} + +func (obj *isisInterfaceAuthentication) setMsg(msg *otg.IsisInterfaceAuthentication) IsisInterfaceAuthentication { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisInterfaceAuthentication struct { + obj *isisInterfaceAuthentication +} + +type marshalIsisInterfaceAuthentication interface { + // ToProto marshals IsisInterfaceAuthentication to protobuf object *otg.IsisInterfaceAuthentication + ToProto() (*otg.IsisInterfaceAuthentication, error) + // ToPbText marshals IsisInterfaceAuthentication to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisInterfaceAuthentication to YAML text + ToYaml() (string, error) + // ToJson marshals IsisInterfaceAuthentication to JSON text + ToJson() (string, error) +} + +type unMarshalisisInterfaceAuthentication struct { + obj *isisInterfaceAuthentication +} + +type unMarshalIsisInterfaceAuthentication interface { + // FromProto unmarshals IsisInterfaceAuthentication from protobuf object *otg.IsisInterfaceAuthentication + FromProto(msg *otg.IsisInterfaceAuthentication) (IsisInterfaceAuthentication, error) + // FromPbText unmarshals IsisInterfaceAuthentication from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisInterfaceAuthentication from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisInterfaceAuthentication from JSON text + FromJson(value string) error +} + +func (obj *isisInterfaceAuthentication) Marshal() marshalIsisInterfaceAuthentication { + if obj.marshaller == nil { + obj.marshaller = &marshalisisInterfaceAuthentication{obj: obj} + } + return obj.marshaller +} + +func (obj *isisInterfaceAuthentication) Unmarshal() unMarshalIsisInterfaceAuthentication { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisInterfaceAuthentication{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisInterfaceAuthentication) ToProto() (*otg.IsisInterfaceAuthentication, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisInterfaceAuthentication) FromProto(msg *otg.IsisInterfaceAuthentication) (IsisInterfaceAuthentication, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisInterfaceAuthentication) 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 *unMarshalisisInterfaceAuthentication) 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 *marshalisisInterfaceAuthentication) 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 *unMarshalisisInterfaceAuthentication) 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 *marshalisisInterfaceAuthentication) 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 *unMarshalisisInterfaceAuthentication) 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 *isisInterfaceAuthentication) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisInterfaceAuthentication) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisInterfaceAuthentication) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisInterfaceAuthentication) Clone() (IsisInterfaceAuthentication, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisInterfaceAuthentication() + 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 +} + +// IsisInterfaceAuthentication is optional container for circuit authentication properties. +type IsisInterfaceAuthentication interface { + Validation + // msg marshals IsisInterfaceAuthentication to protobuf object *otg.IsisInterfaceAuthentication + // and doesn't set defaults + msg() *otg.IsisInterfaceAuthentication + // setMsg unmarshals IsisInterfaceAuthentication from protobuf object *otg.IsisInterfaceAuthentication + // and doesn't set defaults + setMsg(*otg.IsisInterfaceAuthentication) IsisInterfaceAuthentication + // provides marshal interface + Marshal() marshalIsisInterfaceAuthentication + // provides unmarshal interface + Unmarshal() unMarshalIsisInterfaceAuthentication + // validate validates IsisInterfaceAuthentication + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisInterfaceAuthentication, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // AuthType returns IsisInterfaceAuthenticationAuthTypeEnum, set in IsisInterfaceAuthentication + AuthType() IsisInterfaceAuthenticationAuthTypeEnum + // SetAuthType assigns IsisInterfaceAuthenticationAuthTypeEnum provided by user to IsisInterfaceAuthentication + SetAuthType(value IsisInterfaceAuthenticationAuthTypeEnum) IsisInterfaceAuthentication + // Md5 returns string, set in IsisInterfaceAuthentication. + Md5() string + // SetMd5 assigns string provided by user to IsisInterfaceAuthentication + SetMd5(value string) IsisInterfaceAuthentication + // HasMd5 checks if Md5 has been set in IsisInterfaceAuthentication + HasMd5() bool + // Password returns string, set in IsisInterfaceAuthentication. + Password() string + // SetPassword assigns string provided by user to IsisInterfaceAuthentication + SetPassword(value string) IsisInterfaceAuthentication + // HasPassword checks if Password has been set in IsisInterfaceAuthentication + HasPassword() bool +} + +type IsisInterfaceAuthenticationAuthTypeEnum string + +// Enum of AuthType on IsisInterfaceAuthentication +var IsisInterfaceAuthenticationAuthType = struct { + MD5 IsisInterfaceAuthenticationAuthTypeEnum + PASSWORD IsisInterfaceAuthenticationAuthTypeEnum +}{ + MD5: IsisInterfaceAuthenticationAuthTypeEnum("md5"), + PASSWORD: IsisInterfaceAuthenticationAuthTypeEnum("password"), +} + +func (obj *isisInterfaceAuthentication) AuthType() IsisInterfaceAuthenticationAuthTypeEnum { + return IsisInterfaceAuthenticationAuthTypeEnum(obj.obj.AuthType.Enum().String()) +} + +func (obj *isisInterfaceAuthentication) SetAuthType(value IsisInterfaceAuthenticationAuthTypeEnum) IsisInterfaceAuthentication { + intValue, ok := otg.IsisInterfaceAuthentication_AuthType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on IsisInterfaceAuthenticationAuthTypeEnum", string(value))) + return obj + } + enumValue := otg.IsisInterfaceAuthentication_AuthType_Enum(intValue) + obj.obj.AuthType = &enumValue + + return obj +} + +// MD5 key to be used for authentication. +// Md5 returns a string +func (obj *isisInterfaceAuthentication) Md5() string { + + return *obj.obj.Md5 + +} + +// MD5 key to be used for authentication. +// Md5 returns a string +func (obj *isisInterfaceAuthentication) HasMd5() bool { + return obj.obj.Md5 != nil +} + +// MD5 key to be used for authentication. +// SetMd5 sets the string value in the IsisInterfaceAuthentication object +func (obj *isisInterfaceAuthentication) SetMd5(value string) IsisInterfaceAuthentication { + + obj.obj.Md5 = &value + return obj +} + +// The password, in clear text, to be used for Authentication. +// Password returns a string +func (obj *isisInterfaceAuthentication) Password() string { + + return *obj.obj.Password + +} + +// The password, in clear text, to be used for Authentication. +// Password returns a string +func (obj *isisInterfaceAuthentication) HasPassword() bool { + return obj.obj.Password != nil +} + +// The password, in clear text, to be used for Authentication. +// SetPassword sets the string value in the IsisInterfaceAuthentication object +func (obj *isisInterfaceAuthentication) SetPassword(value string) IsisInterfaceAuthentication { + + obj.obj.Password = &value + return obj +} + +func (obj *isisInterfaceAuthentication) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // AuthType is required + if obj.obj.AuthType == nil { + vObj.validationErrors = append(vObj.validationErrors, "AuthType is required field on interface IsisInterfaceAuthentication") + } + + if obj.obj.Md5 != nil { + + if len(*obj.obj.Md5) < 0 || len(*obj.obj.Md5) > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of IsisInterfaceAuthentication.Md5 <= 255 but Got %d", + len(*obj.obj.Md5))) + } + + } + + if obj.obj.Password != nil { + + if len(*obj.obj.Password) < 0 || len(*obj.obj.Password) > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of IsisInterfaceAuthentication.Password <= 255 but Got %d", + len(*obj.obj.Password))) + } + + } + +} + +func (obj *isisInterfaceAuthentication) setDefault() { + +} diff --git a/gosnappi/isis_interface_level.go b/gosnappi/isis_interface_level.go new file mode 100644 index 00000000..0100c04a --- /dev/null +++ b/gosnappi/isis_interface_level.go @@ -0,0 +1,371 @@ +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" +) + +// ***** IsisInterfaceLevel ***** +type isisInterfaceLevel struct { + validation + obj *otg.IsisInterfaceLevel + marshaller marshalIsisInterfaceLevel + unMarshaller unMarshalIsisInterfaceLevel +} + +func NewIsisInterfaceLevel() IsisInterfaceLevel { + obj := isisInterfaceLevel{obj: &otg.IsisInterfaceLevel{}} + obj.setDefault() + return &obj +} + +func (obj *isisInterfaceLevel) msg() *otg.IsisInterfaceLevel { + return obj.obj +} + +func (obj *isisInterfaceLevel) setMsg(msg *otg.IsisInterfaceLevel) IsisInterfaceLevel { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisInterfaceLevel struct { + obj *isisInterfaceLevel +} + +type marshalIsisInterfaceLevel interface { + // ToProto marshals IsisInterfaceLevel to protobuf object *otg.IsisInterfaceLevel + ToProto() (*otg.IsisInterfaceLevel, error) + // ToPbText marshals IsisInterfaceLevel to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisInterfaceLevel to YAML text + ToYaml() (string, error) + // ToJson marshals IsisInterfaceLevel to JSON text + ToJson() (string, error) +} + +type unMarshalisisInterfaceLevel struct { + obj *isisInterfaceLevel +} + +type unMarshalIsisInterfaceLevel interface { + // FromProto unmarshals IsisInterfaceLevel from protobuf object *otg.IsisInterfaceLevel + FromProto(msg *otg.IsisInterfaceLevel) (IsisInterfaceLevel, error) + // FromPbText unmarshals IsisInterfaceLevel from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisInterfaceLevel from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisInterfaceLevel from JSON text + FromJson(value string) error +} + +func (obj *isisInterfaceLevel) Marshal() marshalIsisInterfaceLevel { + if obj.marshaller == nil { + obj.marshaller = &marshalisisInterfaceLevel{obj: obj} + } + return obj.marshaller +} + +func (obj *isisInterfaceLevel) Unmarshal() unMarshalIsisInterfaceLevel { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisInterfaceLevel{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisInterfaceLevel) ToProto() (*otg.IsisInterfaceLevel, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisInterfaceLevel) FromProto(msg *otg.IsisInterfaceLevel) (IsisInterfaceLevel, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisInterfaceLevel) 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 *unMarshalisisInterfaceLevel) 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 *marshalisisInterfaceLevel) 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 *unMarshalisisInterfaceLevel) 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 *marshalisisInterfaceLevel) 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 *unMarshalisisInterfaceLevel) 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 *isisInterfaceLevel) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisInterfaceLevel) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisInterfaceLevel) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisInterfaceLevel) Clone() (IsisInterfaceLevel, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisInterfaceLevel() + 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 +} + +// IsisInterfaceLevel is configuration for the properties of Level 1 Hello. +type IsisInterfaceLevel interface { + Validation + // msg marshals IsisInterfaceLevel to protobuf object *otg.IsisInterfaceLevel + // and doesn't set defaults + msg() *otg.IsisInterfaceLevel + // setMsg unmarshals IsisInterfaceLevel from protobuf object *otg.IsisInterfaceLevel + // and doesn't set defaults + setMsg(*otg.IsisInterfaceLevel) IsisInterfaceLevel + // provides marshal interface + Marshal() marshalIsisInterfaceLevel + // provides unmarshal interface + Unmarshal() unMarshalIsisInterfaceLevel + // validate validates IsisInterfaceLevel + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisInterfaceLevel, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Priority returns uint32, set in IsisInterfaceLevel. + Priority() uint32 + // SetPriority assigns uint32 provided by user to IsisInterfaceLevel + SetPriority(value uint32) IsisInterfaceLevel + // HasPriority checks if Priority has been set in IsisInterfaceLevel + HasPriority() bool + // HelloInterval returns uint32, set in IsisInterfaceLevel. + HelloInterval() uint32 + // SetHelloInterval assigns uint32 provided by user to IsisInterfaceLevel + SetHelloInterval(value uint32) IsisInterfaceLevel + // HasHelloInterval checks if HelloInterval has been set in IsisInterfaceLevel + HasHelloInterval() bool + // DeadInterval returns uint32, set in IsisInterfaceLevel. + DeadInterval() uint32 + // SetDeadInterval assigns uint32 provided by user to IsisInterfaceLevel + SetDeadInterval(value uint32) IsisInterfaceLevel + // HasDeadInterval checks if DeadInterval has been set in IsisInterfaceLevel + HasDeadInterval() bool +} + +// The Priority setting in Level 1 LAN Hellos for Designated Router election. +// Priority returns a uint32 +func (obj *isisInterfaceLevel) Priority() uint32 { + + return *obj.obj.Priority + +} + +// The Priority setting in Level 1 LAN Hellos for Designated Router election. +// Priority returns a uint32 +func (obj *isisInterfaceLevel) HasPriority() bool { + return obj.obj.Priority != nil +} + +// The Priority setting in Level 1 LAN Hellos for Designated Router election. +// SetPriority sets the uint32 value in the IsisInterfaceLevel object +func (obj *isisInterfaceLevel) SetPriority(value uint32) IsisInterfaceLevel { + + obj.obj.Priority = &value + return obj +} + +// The Hello interval for Level 1 Hello messages, in seconds. +// HelloInterval returns a uint32 +func (obj *isisInterfaceLevel) HelloInterval() uint32 { + + return *obj.obj.HelloInterval + +} + +// The Hello interval for Level 1 Hello messages, in seconds. +// HelloInterval returns a uint32 +func (obj *isisInterfaceLevel) HasHelloInterval() bool { + return obj.obj.HelloInterval != nil +} + +// The Hello interval for Level 1 Hello messages, in seconds. +// SetHelloInterval sets the uint32 value in the IsisInterfaceLevel object +func (obj *isisInterfaceLevel) SetHelloInterval(value uint32) IsisInterfaceLevel { + + obj.obj.HelloInterval = &value + return obj +} + +// The Dead (Holding Time) interval for Level 1 Hello messages, in seconds. +// DeadInterval returns a uint32 +func (obj *isisInterfaceLevel) DeadInterval() uint32 { + + return *obj.obj.DeadInterval + +} + +// The Dead (Holding Time) interval for Level 1 Hello messages, in seconds. +// DeadInterval returns a uint32 +func (obj *isisInterfaceLevel) HasDeadInterval() bool { + return obj.obj.DeadInterval != nil +} + +// The Dead (Holding Time) interval for Level 1 Hello messages, in seconds. +// SetDeadInterval sets the uint32 value in the IsisInterfaceLevel object +func (obj *isisInterfaceLevel) SetDeadInterval(value uint32) IsisInterfaceLevel { + + obj.obj.DeadInterval = &value + return obj +} + +func (obj *isisInterfaceLevel) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *isisInterfaceLevel) setDefault() { + if obj.obj.Priority == nil { + obj.SetPriority(0) + } + if obj.obj.HelloInterval == nil { + obj.SetHelloInterval(10) + } + if obj.obj.DeadInterval == nil { + obj.SetDeadInterval(30) + } + +} diff --git a/gosnappi/isis_interface_link_protection.go b/gosnappi/isis_interface_link_protection.go new file mode 100644 index 00000000..9531a35a --- /dev/null +++ b/gosnappi/isis_interface_link_protection.go @@ -0,0 +1,553 @@ +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" +) + +// ***** IsisInterfaceLinkProtection ***** +type isisInterfaceLinkProtection struct { + validation + obj *otg.IsisInterfaceLinkProtection + marshaller marshalIsisInterfaceLinkProtection + unMarshaller unMarshalIsisInterfaceLinkProtection +} + +func NewIsisInterfaceLinkProtection() IsisInterfaceLinkProtection { + obj := isisInterfaceLinkProtection{obj: &otg.IsisInterfaceLinkProtection{}} + obj.setDefault() + return &obj +} + +func (obj *isisInterfaceLinkProtection) msg() *otg.IsisInterfaceLinkProtection { + return obj.obj +} + +func (obj *isisInterfaceLinkProtection) setMsg(msg *otg.IsisInterfaceLinkProtection) IsisInterfaceLinkProtection { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisInterfaceLinkProtection struct { + obj *isisInterfaceLinkProtection +} + +type marshalIsisInterfaceLinkProtection interface { + // ToProto marshals IsisInterfaceLinkProtection to protobuf object *otg.IsisInterfaceLinkProtection + ToProto() (*otg.IsisInterfaceLinkProtection, error) + // ToPbText marshals IsisInterfaceLinkProtection to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisInterfaceLinkProtection to YAML text + ToYaml() (string, error) + // ToJson marshals IsisInterfaceLinkProtection to JSON text + ToJson() (string, error) +} + +type unMarshalisisInterfaceLinkProtection struct { + obj *isisInterfaceLinkProtection +} + +type unMarshalIsisInterfaceLinkProtection interface { + // FromProto unmarshals IsisInterfaceLinkProtection from protobuf object *otg.IsisInterfaceLinkProtection + FromProto(msg *otg.IsisInterfaceLinkProtection) (IsisInterfaceLinkProtection, error) + // FromPbText unmarshals IsisInterfaceLinkProtection from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisInterfaceLinkProtection from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisInterfaceLinkProtection from JSON text + FromJson(value string) error +} + +func (obj *isisInterfaceLinkProtection) Marshal() marshalIsisInterfaceLinkProtection { + if obj.marshaller == nil { + obj.marshaller = &marshalisisInterfaceLinkProtection{obj: obj} + } + return obj.marshaller +} + +func (obj *isisInterfaceLinkProtection) Unmarshal() unMarshalIsisInterfaceLinkProtection { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisInterfaceLinkProtection{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisInterfaceLinkProtection) ToProto() (*otg.IsisInterfaceLinkProtection, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisInterfaceLinkProtection) FromProto(msg *otg.IsisInterfaceLinkProtection) (IsisInterfaceLinkProtection, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisInterfaceLinkProtection) 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 *unMarshalisisInterfaceLinkProtection) 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 *marshalisisInterfaceLinkProtection) 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 *unMarshalisisInterfaceLinkProtection) 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 *marshalisisInterfaceLinkProtection) 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 *unMarshalisisInterfaceLinkProtection) 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 *isisInterfaceLinkProtection) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisInterfaceLinkProtection) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisInterfaceLinkProtection) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisInterfaceLinkProtection) Clone() (IsisInterfaceLinkProtection, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisInterfaceLinkProtection() + 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 +} + +// IsisInterfaceLinkProtection is optional container for the link protection sub TLV (type 20). +type IsisInterfaceLinkProtection interface { + Validation + // msg marshals IsisInterfaceLinkProtection to protobuf object *otg.IsisInterfaceLinkProtection + // and doesn't set defaults + msg() *otg.IsisInterfaceLinkProtection + // setMsg unmarshals IsisInterfaceLinkProtection from protobuf object *otg.IsisInterfaceLinkProtection + // and doesn't set defaults + setMsg(*otg.IsisInterfaceLinkProtection) IsisInterfaceLinkProtection + // provides marshal interface + Marshal() marshalIsisInterfaceLinkProtection + // provides unmarshal interface + Unmarshal() unMarshalIsisInterfaceLinkProtection + // validate validates IsisInterfaceLinkProtection + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisInterfaceLinkProtection, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ExtraTraffic returns bool, set in IsisInterfaceLinkProtection. + ExtraTraffic() bool + // SetExtraTraffic assigns bool provided by user to IsisInterfaceLinkProtection + SetExtraTraffic(value bool) IsisInterfaceLinkProtection + // HasExtraTraffic checks if ExtraTraffic has been set in IsisInterfaceLinkProtection + HasExtraTraffic() bool + // Unprotected returns bool, set in IsisInterfaceLinkProtection. + Unprotected() bool + // SetUnprotected assigns bool provided by user to IsisInterfaceLinkProtection + SetUnprotected(value bool) IsisInterfaceLinkProtection + // HasUnprotected checks if Unprotected has been set in IsisInterfaceLinkProtection + HasUnprotected() bool + // Shared returns bool, set in IsisInterfaceLinkProtection. + Shared() bool + // SetShared assigns bool provided by user to IsisInterfaceLinkProtection + SetShared(value bool) IsisInterfaceLinkProtection + // HasShared checks if Shared has been set in IsisInterfaceLinkProtection + HasShared() bool + // Dedicated1To1 returns bool, set in IsisInterfaceLinkProtection. + Dedicated1To1() bool + // SetDedicated1To1 assigns bool provided by user to IsisInterfaceLinkProtection + SetDedicated1To1(value bool) IsisInterfaceLinkProtection + // HasDedicated1To1 checks if Dedicated1To1 has been set in IsisInterfaceLinkProtection + HasDedicated1To1() bool + // Dedicated1Plus1 returns bool, set in IsisInterfaceLinkProtection. + Dedicated1Plus1() bool + // SetDedicated1Plus1 assigns bool provided by user to IsisInterfaceLinkProtection + SetDedicated1Plus1(value bool) IsisInterfaceLinkProtection + // HasDedicated1Plus1 checks if Dedicated1Plus1 has been set in IsisInterfaceLinkProtection + HasDedicated1Plus1() bool + // Enhanced returns bool, set in IsisInterfaceLinkProtection. + Enhanced() bool + // SetEnhanced assigns bool provided by user to IsisInterfaceLinkProtection + SetEnhanced(value bool) IsisInterfaceLinkProtection + // HasEnhanced checks if Enhanced has been set in IsisInterfaceLinkProtection + HasEnhanced() bool + // Reserved40 returns bool, set in IsisInterfaceLinkProtection. + Reserved40() bool + // SetReserved40 assigns bool provided by user to IsisInterfaceLinkProtection + SetReserved40(value bool) IsisInterfaceLinkProtection + // HasReserved40 checks if Reserved40 has been set in IsisInterfaceLinkProtection + HasReserved40() bool + // Reserved80 returns bool, set in IsisInterfaceLinkProtection. + Reserved80() bool + // SetReserved80 assigns bool provided by user to IsisInterfaceLinkProtection + SetReserved80(value bool) IsisInterfaceLinkProtection + // HasReserved80 checks if Reserved80 has been set in IsisInterfaceLinkProtection + HasReserved80() bool +} + +// Enable this to protect other link or links. LSPs on a link of this type are lost +// if any of the links fail. +// ExtraTraffic returns a bool +func (obj *isisInterfaceLinkProtection) ExtraTraffic() bool { + + return *obj.obj.ExtraTraffic + +} + +// Enable this to protect other link or links. LSPs on a link of this type are lost +// if any of the links fail. +// ExtraTraffic returns a bool +func (obj *isisInterfaceLinkProtection) HasExtraTraffic() bool { + return obj.obj.ExtraTraffic != nil +} + +// Enable this to protect other link or links. LSPs on a link of this type are lost +// if any of the links fail. +// SetExtraTraffic sets the bool value in the IsisInterfaceLinkProtection object +func (obj *isisInterfaceLinkProtection) SetExtraTraffic(value bool) IsisInterfaceLinkProtection { + + obj.obj.ExtraTraffic = &value + return obj +} + +// Enabling this signifies that there is no other link protecting this +// link. LSPs on a link of this type are lost if the link fails. +// Unprotected returns a bool +func (obj *isisInterfaceLinkProtection) Unprotected() bool { + + return *obj.obj.Unprotected + +} + +// Enabling this signifies that there is no other link protecting this +// link. LSPs on a link of this type are lost if the link fails. +// Unprotected returns a bool +func (obj *isisInterfaceLinkProtection) HasUnprotected() bool { + return obj.obj.Unprotected != nil +} + +// Enabling this signifies that there is no other link protecting this +// link. LSPs on a link of this type are lost if the link fails. +// SetUnprotected sets the bool value in the IsisInterfaceLinkProtection object +func (obj *isisInterfaceLinkProtection) SetUnprotected(value bool) IsisInterfaceLinkProtection { + + obj.obj.Unprotected = &value + return obj +} + +// Enable this to share the Extra Traffic links between one or more +// links of type Shared.There are one or more disjoint links of type +// Extra Traffic that are protecting this link. +// Shared returns a bool +func (obj *isisInterfaceLinkProtection) Shared() bool { + + return *obj.obj.Shared + +} + +// Enable this to share the Extra Traffic links between one or more +// links of type Shared.There are one or more disjoint links of type +// Extra Traffic that are protecting this link. +// Shared returns a bool +func (obj *isisInterfaceLinkProtection) HasShared() bool { + return obj.obj.Shared != nil +} + +// Enable this to share the Extra Traffic links between one or more +// links of type Shared.There are one or more disjoint links of type +// Extra Traffic that are protecting this link. +// SetShared sets the bool value in the IsisInterfaceLinkProtection object +func (obj *isisInterfaceLinkProtection) SetShared(value bool) IsisInterfaceLinkProtection { + + obj.obj.Shared = &value + return obj +} + +// Enabling this signifies that there is one dedicated disjoint link +// of type Extra Traffic that is protecting this link. +// Dedicated1To1 returns a bool +func (obj *isisInterfaceLinkProtection) Dedicated1To1() bool { + + return *obj.obj.Dedicated_1To_1 + +} + +// Enabling this signifies that there is one dedicated disjoint link +// of type Extra Traffic that is protecting this link. +// Dedicated1To1 returns a bool +func (obj *isisInterfaceLinkProtection) HasDedicated1To1() bool { + return obj.obj.Dedicated_1To_1 != nil +} + +// Enabling this signifies that there is one dedicated disjoint link +// of type Extra Traffic that is protecting this link. +// SetDedicated1To1 sets the bool value in the IsisInterfaceLinkProtection object +func (obj *isisInterfaceLinkProtection) SetDedicated1To1(value bool) IsisInterfaceLinkProtection { + + obj.obj.Dedicated_1To_1 = &value + return obj +} + +// Enabling this signifies that a dedicated disjoint link is protecting +// this link. However, the protecting link is not advertised in the +// link state database and is therefore not available for the routing +// of LSPs. +// Dedicated1Plus1 returns a bool +func (obj *isisInterfaceLinkProtection) Dedicated1Plus1() bool { + + return *obj.obj.Dedicated_1Plus_1 + +} + +// Enabling this signifies that a dedicated disjoint link is protecting +// this link. However, the protecting link is not advertised in the +// link state database and is therefore not available for the routing +// of LSPs. +// Dedicated1Plus1 returns a bool +func (obj *isisInterfaceLinkProtection) HasDedicated1Plus1() bool { + return obj.obj.Dedicated_1Plus_1 != nil +} + +// Enabling this signifies that a dedicated disjoint link is protecting +// this link. However, the protecting link is not advertised in the +// link state database and is therefore not available for the routing +// of LSPs. +// SetDedicated1Plus1 sets the bool value in the IsisInterfaceLinkProtection object +func (obj *isisInterfaceLinkProtection) SetDedicated1Plus1(value bool) IsisInterfaceLinkProtection { + + obj.obj.Dedicated_1Plus_1 = &value + return obj +} + +// Enabling this signifies that a protection scheme that is more +// reliable than Dedicated 1+1. +// Enhanced returns a bool +func (obj *isisInterfaceLinkProtection) Enhanced() bool { + + return *obj.obj.Enhanced + +} + +// Enabling this signifies that a protection scheme that is more +// reliable than Dedicated 1+1. +// Enhanced returns a bool +func (obj *isisInterfaceLinkProtection) HasEnhanced() bool { + return obj.obj.Enhanced != nil +} + +// Enabling this signifies that a protection scheme that is more +// reliable than Dedicated 1+1. +// SetEnhanced sets the bool value in the IsisInterfaceLinkProtection object +func (obj *isisInterfaceLinkProtection) SetEnhanced(value bool) IsisInterfaceLinkProtection { + + obj.obj.Enhanced = &value + return obj +} + +// This is a Protection Scheme with value 0x40. +// Reserved40 returns a bool +func (obj *isisInterfaceLinkProtection) Reserved40() bool { + + return *obj.obj.Reserved_40 + +} + +// This is a Protection Scheme with value 0x40. +// Reserved40 returns a bool +func (obj *isisInterfaceLinkProtection) HasReserved40() bool { + return obj.obj.Reserved_40 != nil +} + +// This is a Protection Scheme with value 0x40. +// SetReserved40 sets the bool value in the IsisInterfaceLinkProtection object +func (obj *isisInterfaceLinkProtection) SetReserved40(value bool) IsisInterfaceLinkProtection { + + obj.obj.Reserved_40 = &value + return obj +} + +// This is a Protection Scheme with value 0x80. +// Reserved80 returns a bool +func (obj *isisInterfaceLinkProtection) Reserved80() bool { + + return *obj.obj.Reserved_80 + +} + +// This is a Protection Scheme with value 0x80. +// Reserved80 returns a bool +func (obj *isisInterfaceLinkProtection) HasReserved80() bool { + return obj.obj.Reserved_80 != nil +} + +// This is a Protection Scheme with value 0x80. +// SetReserved80 sets the bool value in the IsisInterfaceLinkProtection object +func (obj *isisInterfaceLinkProtection) SetReserved80(value bool) IsisInterfaceLinkProtection { + + obj.obj.Reserved_80 = &value + return obj +} + +func (obj *isisInterfaceLinkProtection) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *isisInterfaceLinkProtection) setDefault() { + if obj.obj.ExtraTraffic == nil { + obj.SetExtraTraffic(false) + } + if obj.obj.Unprotected == nil { + obj.SetUnprotected(false) + } + if obj.obj.Shared == nil { + obj.SetShared(false) + } + if obj.obj.Dedicated_1To_1 == nil { + obj.SetDedicated1To1(false) + } + if obj.obj.Dedicated_1Plus_1 == nil { + obj.SetDedicated1Plus1(false) + } + if obj.obj.Enhanced == nil { + obj.SetEnhanced(false) + } + if obj.obj.Reserved_40 == nil { + obj.SetReserved40(false) + } + if obj.obj.Reserved_80 == nil { + obj.SetReserved80(false) + } + +} diff --git a/gosnappi/isis_lsp_extended_ipv4_reachability_tlv.go b/gosnappi/isis_lsp_extended_ipv4_reachability_tlv.go new file mode 100644 index 00000000..72bfc219 --- /dev/null +++ b/gosnappi/isis_lsp_extended_ipv4_reachability_tlv.go @@ -0,0 +1,391 @@ +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" +) + +// ***** IsisLspExtendedIpv4ReachabilityTlv ***** +type isisLspExtendedIpv4ReachabilityTlv struct { + validation + obj *otg.IsisLspExtendedIpv4ReachabilityTlv + marshaller marshalIsisLspExtendedIpv4ReachabilityTlv + unMarshaller unMarshalIsisLspExtendedIpv4ReachabilityTlv + prefixesHolder IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter +} + +func NewIsisLspExtendedIpv4ReachabilityTlv() IsisLspExtendedIpv4ReachabilityTlv { + obj := isisLspExtendedIpv4ReachabilityTlv{obj: &otg.IsisLspExtendedIpv4ReachabilityTlv{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspExtendedIpv4ReachabilityTlv) msg() *otg.IsisLspExtendedIpv4ReachabilityTlv { + return obj.obj +} + +func (obj *isisLspExtendedIpv4ReachabilityTlv) setMsg(msg *otg.IsisLspExtendedIpv4ReachabilityTlv) IsisLspExtendedIpv4ReachabilityTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspExtendedIpv4ReachabilityTlv struct { + obj *isisLspExtendedIpv4ReachabilityTlv +} + +type marshalIsisLspExtendedIpv4ReachabilityTlv interface { + // ToProto marshals IsisLspExtendedIpv4ReachabilityTlv to protobuf object *otg.IsisLspExtendedIpv4ReachabilityTlv + ToProto() (*otg.IsisLspExtendedIpv4ReachabilityTlv, error) + // ToPbText marshals IsisLspExtendedIpv4ReachabilityTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspExtendedIpv4ReachabilityTlv to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspExtendedIpv4ReachabilityTlv to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspExtendedIpv4ReachabilityTlv struct { + obj *isisLspExtendedIpv4ReachabilityTlv +} + +type unMarshalIsisLspExtendedIpv4ReachabilityTlv interface { + // FromProto unmarshals IsisLspExtendedIpv4ReachabilityTlv from protobuf object *otg.IsisLspExtendedIpv4ReachabilityTlv + FromProto(msg *otg.IsisLspExtendedIpv4ReachabilityTlv) (IsisLspExtendedIpv4ReachabilityTlv, error) + // FromPbText unmarshals IsisLspExtendedIpv4ReachabilityTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspExtendedIpv4ReachabilityTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspExtendedIpv4ReachabilityTlv from JSON text + FromJson(value string) error +} + +func (obj *isisLspExtendedIpv4ReachabilityTlv) Marshal() marshalIsisLspExtendedIpv4ReachabilityTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspExtendedIpv4ReachabilityTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspExtendedIpv4ReachabilityTlv) Unmarshal() unMarshalIsisLspExtendedIpv4ReachabilityTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspExtendedIpv4ReachabilityTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspExtendedIpv4ReachabilityTlv) ToProto() (*otg.IsisLspExtendedIpv4ReachabilityTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspExtendedIpv4ReachabilityTlv) FromProto(msg *otg.IsisLspExtendedIpv4ReachabilityTlv) (IsisLspExtendedIpv4ReachabilityTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspExtendedIpv4ReachabilityTlv) 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 *unMarshalisisLspExtendedIpv4ReachabilityTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisLspExtendedIpv4ReachabilityTlv) 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 *unMarshalisisLspExtendedIpv4ReachabilityTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisLspExtendedIpv4ReachabilityTlv) 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 *unMarshalisisLspExtendedIpv4ReachabilityTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisLspExtendedIpv4ReachabilityTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspExtendedIpv4ReachabilityTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspExtendedIpv4ReachabilityTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspExtendedIpv4ReachabilityTlv) Clone() (IsisLspExtendedIpv4ReachabilityTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspExtendedIpv4ReachabilityTlv() + 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 +} + +func (obj *isisLspExtendedIpv4ReachabilityTlv) setNil() { + obj.prefixesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisLspExtendedIpv4ReachabilityTlv is this container defines list of IPv4 extended reachability information in one Extended IPv4 External Reachability TLV. +// It is advertised when the 'wide metric' is enabled. +type IsisLspExtendedIpv4ReachabilityTlv interface { + Validation + // msg marshals IsisLspExtendedIpv4ReachabilityTlv to protobuf object *otg.IsisLspExtendedIpv4ReachabilityTlv + // and doesn't set defaults + msg() *otg.IsisLspExtendedIpv4ReachabilityTlv + // setMsg unmarshals IsisLspExtendedIpv4ReachabilityTlv from protobuf object *otg.IsisLspExtendedIpv4ReachabilityTlv + // and doesn't set defaults + setMsg(*otg.IsisLspExtendedIpv4ReachabilityTlv) IsisLspExtendedIpv4ReachabilityTlv + // provides marshal interface + Marshal() marshalIsisLspExtendedIpv4ReachabilityTlv + // provides unmarshal interface + Unmarshal() unMarshalIsisLspExtendedIpv4ReachabilityTlv + // validate validates IsisLspExtendedIpv4ReachabilityTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspExtendedIpv4ReachabilityTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Prefixes returns IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIterIter, set in IsisLspExtendedIpv4ReachabilityTlv + Prefixes() IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter + setNil() +} + +// IPv4 prefix contained within extended reachability TLVs. +// Prefixes returns a []IsisLspExtendedV4Prefix +func (obj *isisLspExtendedIpv4ReachabilityTlv) Prefixes() IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { + if len(obj.obj.Prefixes) == 0 { + obj.obj.Prefixes = []*otg.IsisLspExtendedV4Prefix{} + } + if obj.prefixesHolder == nil { + obj.prefixesHolder = newIsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter(&obj.obj.Prefixes).setMsg(obj) + } + return obj.prefixesHolder +} + +type isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter struct { + obj *isisLspExtendedIpv4ReachabilityTlv + isisLspExtendedV4PrefixSlice []IsisLspExtendedV4Prefix + fieldPtr *[]*otg.IsisLspExtendedV4Prefix +} + +func newIsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter(ptr *[]*otg.IsisLspExtendedV4Prefix) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { + return &isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter{fieldPtr: ptr} +} + +type IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter interface { + setMsg(*isisLspExtendedIpv4ReachabilityTlv) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter + Items() []IsisLspExtendedV4Prefix + Add() IsisLspExtendedV4Prefix + Append(items ...IsisLspExtendedV4Prefix) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter + Set(index int, newObj IsisLspExtendedV4Prefix) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter + Clear() IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter + clearHolderSlice() IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter + appendHolderSlice(item IsisLspExtendedV4Prefix) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter +} + +func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) setMsg(msg *isisLspExtendedIpv4ReachabilityTlv) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspExtendedV4Prefix{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) Items() []IsisLspExtendedV4Prefix { + return obj.isisLspExtendedV4PrefixSlice +} + +func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) Add() IsisLspExtendedV4Prefix { + newObj := &otg.IsisLspExtendedV4Prefix{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspExtendedV4Prefix{obj: newObj} + newLibObj.setDefault() + obj.isisLspExtendedV4PrefixSlice = append(obj.isisLspExtendedV4PrefixSlice, newLibObj) + return newLibObj +} + +func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) Append(items ...IsisLspExtendedV4Prefix) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspExtendedV4PrefixSlice = append(obj.isisLspExtendedV4PrefixSlice, item) + } + return obj +} + +func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) Set(index int, newObj IsisLspExtendedV4Prefix) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspExtendedV4PrefixSlice[index] = newObj + return obj +} +func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) Clear() IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspExtendedV4Prefix{} + obj.isisLspExtendedV4PrefixSlice = []IsisLspExtendedV4Prefix{} + } + return obj +} +func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) clearHolderSlice() IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { + if len(obj.isisLspExtendedV4PrefixSlice) > 0 { + obj.isisLspExtendedV4PrefixSlice = []IsisLspExtendedV4Prefix{} + } + return obj +} +func (obj *isisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter) appendHolderSlice(item IsisLspExtendedV4Prefix) IsisLspExtendedIpv4ReachabilityTlvIsisLspExtendedV4PrefixIter { + obj.isisLspExtendedV4PrefixSlice = append(obj.isisLspExtendedV4PrefixSlice, item) + return obj +} + +func (obj *isisLspExtendedIpv4ReachabilityTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Prefixes) != 0 { + + if set_default { + obj.Prefixes().clearHolderSlice() + for _, item := range obj.obj.Prefixes { + obj.Prefixes().appendHolderSlice(&isisLspExtendedV4Prefix{obj: item}) + } + } + for _, item := range obj.Prefixes().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *isisLspExtendedIpv4ReachabilityTlv) setDefault() { + +} diff --git a/gosnappi/isis_lsp_extended_is_reachability_tlv.go b/gosnappi/isis_lsp_extended_is_reachability_tlv.go new file mode 100644 index 00000000..0bac852b --- /dev/null +++ b/gosnappi/isis_lsp_extended_is_reachability_tlv.go @@ -0,0 +1,390 @@ +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" +) + +// ***** IsisLspExtendedIsReachabilityTlv ***** +type isisLspExtendedIsReachabilityTlv struct { + validation + obj *otg.IsisLspExtendedIsReachabilityTlv + marshaller marshalIsisLspExtendedIsReachabilityTlv + unMarshaller unMarshalIsisLspExtendedIsReachabilityTlv + neighborsHolder IsisLspExtendedIsReachabilityTlvIsisLspneighborIter +} + +func NewIsisLspExtendedIsReachabilityTlv() IsisLspExtendedIsReachabilityTlv { + obj := isisLspExtendedIsReachabilityTlv{obj: &otg.IsisLspExtendedIsReachabilityTlv{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspExtendedIsReachabilityTlv) msg() *otg.IsisLspExtendedIsReachabilityTlv { + return obj.obj +} + +func (obj *isisLspExtendedIsReachabilityTlv) setMsg(msg *otg.IsisLspExtendedIsReachabilityTlv) IsisLspExtendedIsReachabilityTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspExtendedIsReachabilityTlv struct { + obj *isisLspExtendedIsReachabilityTlv +} + +type marshalIsisLspExtendedIsReachabilityTlv interface { + // ToProto marshals IsisLspExtendedIsReachabilityTlv to protobuf object *otg.IsisLspExtendedIsReachabilityTlv + ToProto() (*otg.IsisLspExtendedIsReachabilityTlv, error) + // ToPbText marshals IsisLspExtendedIsReachabilityTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspExtendedIsReachabilityTlv to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspExtendedIsReachabilityTlv to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspExtendedIsReachabilityTlv struct { + obj *isisLspExtendedIsReachabilityTlv +} + +type unMarshalIsisLspExtendedIsReachabilityTlv interface { + // FromProto unmarshals IsisLspExtendedIsReachabilityTlv from protobuf object *otg.IsisLspExtendedIsReachabilityTlv + FromProto(msg *otg.IsisLspExtendedIsReachabilityTlv) (IsisLspExtendedIsReachabilityTlv, error) + // FromPbText unmarshals IsisLspExtendedIsReachabilityTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspExtendedIsReachabilityTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspExtendedIsReachabilityTlv from JSON text + FromJson(value string) error +} + +func (obj *isisLspExtendedIsReachabilityTlv) Marshal() marshalIsisLspExtendedIsReachabilityTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspExtendedIsReachabilityTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspExtendedIsReachabilityTlv) Unmarshal() unMarshalIsisLspExtendedIsReachabilityTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspExtendedIsReachabilityTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspExtendedIsReachabilityTlv) ToProto() (*otg.IsisLspExtendedIsReachabilityTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspExtendedIsReachabilityTlv) FromProto(msg *otg.IsisLspExtendedIsReachabilityTlv) (IsisLspExtendedIsReachabilityTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspExtendedIsReachabilityTlv) 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 *unMarshalisisLspExtendedIsReachabilityTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisLspExtendedIsReachabilityTlv) 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 *unMarshalisisLspExtendedIsReachabilityTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisLspExtendedIsReachabilityTlv) 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 *unMarshalisisLspExtendedIsReachabilityTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisLspExtendedIsReachabilityTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspExtendedIsReachabilityTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspExtendedIsReachabilityTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspExtendedIsReachabilityTlv) Clone() (IsisLspExtendedIsReachabilityTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspExtendedIsReachabilityTlv() + 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 +} + +func (obj *isisLspExtendedIsReachabilityTlv) setNil() { + obj.neighborsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisLspExtendedIsReachabilityTlv is this is list of ISIS neighbors and attributes in Extended-IS-Reachability TLV (type 22). +type IsisLspExtendedIsReachabilityTlv interface { + Validation + // msg marshals IsisLspExtendedIsReachabilityTlv to protobuf object *otg.IsisLspExtendedIsReachabilityTlv + // and doesn't set defaults + msg() *otg.IsisLspExtendedIsReachabilityTlv + // setMsg unmarshals IsisLspExtendedIsReachabilityTlv from protobuf object *otg.IsisLspExtendedIsReachabilityTlv + // and doesn't set defaults + setMsg(*otg.IsisLspExtendedIsReachabilityTlv) IsisLspExtendedIsReachabilityTlv + // provides marshal interface + Marshal() marshalIsisLspExtendedIsReachabilityTlv + // provides unmarshal interface + Unmarshal() unMarshalIsisLspExtendedIsReachabilityTlv + // validate validates IsisLspExtendedIsReachabilityTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspExtendedIsReachabilityTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Neighbors returns IsisLspExtendedIsReachabilityTlvIsisLspneighborIterIter, set in IsisLspExtendedIsReachabilityTlv + Neighbors() IsisLspExtendedIsReachabilityTlvIsisLspneighborIter + setNil() +} + +// This container describes IS neighbors. +// Neighbors returns a []IsisLspneighbor +func (obj *isisLspExtendedIsReachabilityTlv) Neighbors() IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { + if len(obj.obj.Neighbors) == 0 { + obj.obj.Neighbors = []*otg.IsisLspneighbor{} + } + if obj.neighborsHolder == nil { + obj.neighborsHolder = newIsisLspExtendedIsReachabilityTlvIsisLspneighborIter(&obj.obj.Neighbors).setMsg(obj) + } + return obj.neighborsHolder +} + +type isisLspExtendedIsReachabilityTlvIsisLspneighborIter struct { + obj *isisLspExtendedIsReachabilityTlv + isisLspneighborSlice []IsisLspneighbor + fieldPtr *[]*otg.IsisLspneighbor +} + +func newIsisLspExtendedIsReachabilityTlvIsisLspneighborIter(ptr *[]*otg.IsisLspneighbor) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { + return &isisLspExtendedIsReachabilityTlvIsisLspneighborIter{fieldPtr: ptr} +} + +type IsisLspExtendedIsReachabilityTlvIsisLspneighborIter interface { + setMsg(*isisLspExtendedIsReachabilityTlv) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter + Items() []IsisLspneighbor + Add() IsisLspneighbor + Append(items ...IsisLspneighbor) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter + Set(index int, newObj IsisLspneighbor) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter + Clear() IsisLspExtendedIsReachabilityTlvIsisLspneighborIter + clearHolderSlice() IsisLspExtendedIsReachabilityTlvIsisLspneighborIter + appendHolderSlice(item IsisLspneighbor) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter +} + +func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) setMsg(msg *isisLspExtendedIsReachabilityTlv) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspneighbor{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) Items() []IsisLspneighbor { + return obj.isisLspneighborSlice +} + +func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) Add() IsisLspneighbor { + newObj := &otg.IsisLspneighbor{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspneighbor{obj: newObj} + newLibObj.setDefault() + obj.isisLspneighborSlice = append(obj.isisLspneighborSlice, newLibObj) + return newLibObj +} + +func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) Append(items ...IsisLspneighbor) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspneighborSlice = append(obj.isisLspneighborSlice, item) + } + return obj +} + +func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) Set(index int, newObj IsisLspneighbor) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspneighborSlice[index] = newObj + return obj +} +func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) Clear() IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspneighbor{} + obj.isisLspneighborSlice = []IsisLspneighbor{} + } + return obj +} +func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) clearHolderSlice() IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { + if len(obj.isisLspneighborSlice) > 0 { + obj.isisLspneighborSlice = []IsisLspneighbor{} + } + return obj +} +func (obj *isisLspExtendedIsReachabilityTlvIsisLspneighborIter) appendHolderSlice(item IsisLspneighbor) IsisLspExtendedIsReachabilityTlvIsisLspneighborIter { + obj.isisLspneighborSlice = append(obj.isisLspneighborSlice, item) + return obj +} + +func (obj *isisLspExtendedIsReachabilityTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Neighbors) != 0 { + + if set_default { + obj.Neighbors().clearHolderSlice() + for _, item := range obj.obj.Neighbors { + obj.Neighbors().appendHolderSlice(&isisLspneighbor{obj: item}) + } + } + for _, item := range obj.Neighbors().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *isisLspExtendedIsReachabilityTlv) setDefault() { + +} diff --git a/gosnappi/isis_lsp_extended_v4_prefix.go b/gosnappi/isis_lsp_extended_v4_prefix.go new file mode 100644 index 00000000..e3a921da --- /dev/null +++ b/gosnappi/isis_lsp_extended_v4_prefix.go @@ -0,0 +1,474 @@ +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" +) + +// ***** IsisLspExtendedV4Prefix ***** +type isisLspExtendedV4Prefix struct { + validation + obj *otg.IsisLspExtendedV4Prefix + marshaller marshalIsisLspExtendedV4Prefix + unMarshaller unMarshalIsisLspExtendedV4Prefix + prefixAttributesHolder IsisLspPrefixAttributes +} + +func NewIsisLspExtendedV4Prefix() IsisLspExtendedV4Prefix { + obj := isisLspExtendedV4Prefix{obj: &otg.IsisLspExtendedV4Prefix{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspExtendedV4Prefix) msg() *otg.IsisLspExtendedV4Prefix { + return obj.obj +} + +func (obj *isisLspExtendedV4Prefix) setMsg(msg *otg.IsisLspExtendedV4Prefix) IsisLspExtendedV4Prefix { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspExtendedV4Prefix struct { + obj *isisLspExtendedV4Prefix +} + +type marshalIsisLspExtendedV4Prefix interface { + // ToProto marshals IsisLspExtendedV4Prefix to protobuf object *otg.IsisLspExtendedV4Prefix + ToProto() (*otg.IsisLspExtendedV4Prefix, error) + // ToPbText marshals IsisLspExtendedV4Prefix to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspExtendedV4Prefix to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspExtendedV4Prefix to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspExtendedV4Prefix struct { + obj *isisLspExtendedV4Prefix +} + +type unMarshalIsisLspExtendedV4Prefix interface { + // FromProto unmarshals IsisLspExtendedV4Prefix from protobuf object *otg.IsisLspExtendedV4Prefix + FromProto(msg *otg.IsisLspExtendedV4Prefix) (IsisLspExtendedV4Prefix, error) + // FromPbText unmarshals IsisLspExtendedV4Prefix from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspExtendedV4Prefix from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspExtendedV4Prefix from JSON text + FromJson(value string) error +} + +func (obj *isisLspExtendedV4Prefix) Marshal() marshalIsisLspExtendedV4Prefix { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspExtendedV4Prefix{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspExtendedV4Prefix) Unmarshal() unMarshalIsisLspExtendedV4Prefix { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspExtendedV4Prefix{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspExtendedV4Prefix) ToProto() (*otg.IsisLspExtendedV4Prefix, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspExtendedV4Prefix) FromProto(msg *otg.IsisLspExtendedV4Prefix) (IsisLspExtendedV4Prefix, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspExtendedV4Prefix) 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 *unMarshalisisLspExtendedV4Prefix) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisLspExtendedV4Prefix) 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 *unMarshalisisLspExtendedV4Prefix) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisLspExtendedV4Prefix) 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 *unMarshalisisLspExtendedV4Prefix) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisLspExtendedV4Prefix) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspExtendedV4Prefix) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspExtendedV4Prefix) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspExtendedV4Prefix) Clone() (IsisLspExtendedV4Prefix, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspExtendedV4Prefix() + 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 +} + +func (obj *isisLspExtendedV4Prefix) setNil() { + obj.prefixAttributesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisLspExtendedV4Prefix is this group defines attributes of an IPv4 standard prefix. +type IsisLspExtendedV4Prefix interface { + Validation + // msg marshals IsisLspExtendedV4Prefix to protobuf object *otg.IsisLspExtendedV4Prefix + // and doesn't set defaults + msg() *otg.IsisLspExtendedV4Prefix + // setMsg unmarshals IsisLspExtendedV4Prefix from protobuf object *otg.IsisLspExtendedV4Prefix + // and doesn't set defaults + setMsg(*otg.IsisLspExtendedV4Prefix) IsisLspExtendedV4Prefix + // provides marshal interface + Marshal() marshalIsisLspExtendedV4Prefix + // provides unmarshal interface + Unmarshal() unMarshalIsisLspExtendedV4Prefix + // validate validates IsisLspExtendedV4Prefix + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspExtendedV4Prefix, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv4Address returns string, set in IsisLspExtendedV4Prefix. + Ipv4Address() string + // SetIpv4Address assigns string provided by user to IsisLspExtendedV4Prefix + SetIpv4Address(value string) IsisLspExtendedV4Prefix + // HasIpv4Address checks if Ipv4Address has been set in IsisLspExtendedV4Prefix + HasIpv4Address() bool + // PrefixLength returns uint32, set in IsisLspExtendedV4Prefix. + PrefixLength() uint32 + // SetPrefixLength assigns uint32 provided by user to IsisLspExtendedV4Prefix + SetPrefixLength(value uint32) IsisLspExtendedV4Prefix + // HasPrefixLength checks if PrefixLength has been set in IsisLspExtendedV4Prefix + HasPrefixLength() bool + // Metric returns uint32, set in IsisLspExtendedV4Prefix. + Metric() uint32 + // SetMetric assigns uint32 provided by user to IsisLspExtendedV4Prefix + SetMetric(value uint32) IsisLspExtendedV4Prefix + // HasMetric checks if Metric has been set in IsisLspExtendedV4Prefix + HasMetric() bool + // RedistributionType returns IsisLspExtendedV4PrefixRedistributionTypeEnum, set in IsisLspExtendedV4Prefix + RedistributionType() IsisLspExtendedV4PrefixRedistributionTypeEnum + // SetRedistributionType assigns IsisLspExtendedV4PrefixRedistributionTypeEnum provided by user to IsisLspExtendedV4Prefix + SetRedistributionType(value IsisLspExtendedV4PrefixRedistributionTypeEnum) IsisLspExtendedV4Prefix + // HasRedistributionType checks if RedistributionType has been set in IsisLspExtendedV4Prefix + HasRedistributionType() bool + // PrefixAttributes returns IsisLspPrefixAttributes, set in IsisLspExtendedV4Prefix. + // IsisLspPrefixAttributes is this contains the properties of ISIS Prefix attributes for the extended IPv4 and IPv6 reachability. https://www.rfc-editor.org/rfc/rfc7794.html + PrefixAttributes() IsisLspPrefixAttributes + // SetPrefixAttributes assigns IsisLspPrefixAttributes provided by user to IsisLspExtendedV4Prefix. + // IsisLspPrefixAttributes is this contains the properties of ISIS Prefix attributes for the extended IPv4 and IPv6 reachability. https://www.rfc-editor.org/rfc/rfc7794.html + SetPrefixAttributes(value IsisLspPrefixAttributes) IsisLspExtendedV4Prefix + // HasPrefixAttributes checks if PrefixAttributes has been set in IsisLspExtendedV4Prefix + HasPrefixAttributes() bool + setNil() +} + +// An IPv4 unicast prefix reachable via the originator of this LSP. +// Ipv4Address returns a string +func (obj *isisLspExtendedV4Prefix) Ipv4Address() string { + + return *obj.obj.Ipv4Address + +} + +// An IPv4 unicast prefix reachable via the originator of this LSP. +// Ipv4Address returns a string +func (obj *isisLspExtendedV4Prefix) HasIpv4Address() bool { + return obj.obj.Ipv4Address != nil +} + +// An IPv4 unicast prefix reachable via the originator of this LSP. +// SetIpv4Address sets the string value in the IsisLspExtendedV4Prefix object +func (obj *isisLspExtendedV4Prefix) SetIpv4Address(value string) IsisLspExtendedV4Prefix { + + obj.obj.Ipv4Address = &value + return obj +} + +// The length of the IPv4 prefix. +// PrefixLength returns a uint32 +func (obj *isisLspExtendedV4Prefix) PrefixLength() uint32 { + + return *obj.obj.PrefixLength + +} + +// The length of the IPv4 prefix. +// PrefixLength returns a uint32 +func (obj *isisLspExtendedV4Prefix) HasPrefixLength() bool { + return obj.obj.PrefixLength != nil +} + +// The length of the IPv4 prefix. +// SetPrefixLength sets the uint32 value in the IsisLspExtendedV4Prefix object +func (obj *isisLspExtendedV4Prefix) SetPrefixLength(value uint32) IsisLspExtendedV4Prefix { + + obj.obj.PrefixLength = &value + return obj +} + +// ISIS wide metric. +// Metric returns a uint32 +func (obj *isisLspExtendedV4Prefix) Metric() uint32 { + + return *obj.obj.Metric + +} + +// ISIS wide metric. +// Metric returns a uint32 +func (obj *isisLspExtendedV4Prefix) HasMetric() bool { + return obj.obj.Metric != nil +} + +// ISIS wide metric. +// SetMetric sets the uint32 value in the IsisLspExtendedV4Prefix object +func (obj *isisLspExtendedV4Prefix) SetMetric(value uint32) IsisLspExtendedV4Prefix { + + obj.obj.Metric = &value + return obj +} + +type IsisLspExtendedV4PrefixRedistributionTypeEnum string + +// Enum of RedistributionType on IsisLspExtendedV4Prefix +var IsisLspExtendedV4PrefixRedistributionType = struct { + UP IsisLspExtendedV4PrefixRedistributionTypeEnum + DOWN IsisLspExtendedV4PrefixRedistributionTypeEnum +}{ + UP: IsisLspExtendedV4PrefixRedistributionTypeEnum("up"), + DOWN: IsisLspExtendedV4PrefixRedistributionTypeEnum("down"), +} + +func (obj *isisLspExtendedV4Prefix) RedistributionType() IsisLspExtendedV4PrefixRedistributionTypeEnum { + return IsisLspExtendedV4PrefixRedistributionTypeEnum(obj.obj.RedistributionType.Enum().String()) +} + +// Up (0)-used when a prefix is initially advertised within the ISIS L3 hierarchy, +// and for all other prefixes in L1 and L2 LSPs. (default) +// Down (1)-used when an L1/L2 router advertises L2 prefixes in L1 LSPs. +// The prefixes are being advertised from a higher level (L2) down to a lower level (L1). +// RedistributionType returns a string +func (obj *isisLspExtendedV4Prefix) HasRedistributionType() bool { + return obj.obj.RedistributionType != nil +} + +func (obj *isisLspExtendedV4Prefix) SetRedistributionType(value IsisLspExtendedV4PrefixRedistributionTypeEnum) IsisLspExtendedV4Prefix { + intValue, ok := otg.IsisLspExtendedV4Prefix_RedistributionType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on IsisLspExtendedV4PrefixRedistributionTypeEnum", string(value))) + return obj + } + enumValue := otg.IsisLspExtendedV4Prefix_RedistributionType_Enum(intValue) + obj.obj.RedistributionType = &enumValue + + return obj +} + +// description is TBD +// PrefixAttributes returns a IsisLspPrefixAttributes +func (obj *isisLspExtendedV4Prefix) PrefixAttributes() IsisLspPrefixAttributes { + if obj.obj.PrefixAttributes == nil { + obj.obj.PrefixAttributes = NewIsisLspPrefixAttributes().msg() + } + if obj.prefixAttributesHolder == nil { + obj.prefixAttributesHolder = &isisLspPrefixAttributes{obj: obj.obj.PrefixAttributes} + } + return obj.prefixAttributesHolder +} + +// description is TBD +// PrefixAttributes returns a IsisLspPrefixAttributes +func (obj *isisLspExtendedV4Prefix) HasPrefixAttributes() bool { + return obj.obj.PrefixAttributes != nil +} + +// description is TBD +// SetPrefixAttributes sets the IsisLspPrefixAttributes value in the IsisLspExtendedV4Prefix object +func (obj *isisLspExtendedV4Prefix) SetPrefixAttributes(value IsisLspPrefixAttributes) IsisLspExtendedV4Prefix { + + obj.prefixAttributesHolder = nil + obj.obj.PrefixAttributes = value.msg() + + return obj +} + +func (obj *isisLspExtendedV4Prefix) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv4Address != nil { + + err := obj.validateIpv4(obj.Ipv4Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on IsisLspExtendedV4Prefix.Ipv4Address")) + } + + } + + if obj.obj.PrefixLength != nil { + + if *obj.obj.PrefixLength > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= IsisLspExtendedV4Prefix.PrefixLength <= 32 but Got %d", *obj.obj.PrefixLength)) + } + + } + + if obj.obj.PrefixAttributes != nil { + + obj.PrefixAttributes().validateObj(vObj, set_default) + } + +} + +func (obj *isisLspExtendedV4Prefix) setDefault() { + +} diff --git a/gosnappi/isis_lsp_flags.go b/gosnappi/isis_lsp_flags.go new file mode 100644 index 00000000..696afacc --- /dev/null +++ b/gosnappi/isis_lsp_flags.go @@ -0,0 +1,458 @@ +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" +) + +// ***** IsisLspFlags ***** +type isisLspFlags struct { + validation + obj *otg.IsisLspFlags + marshaller marshalIsisLspFlags + unMarshaller unMarshalIsisLspFlags +} + +func NewIsisLspFlags() IsisLspFlags { + obj := isisLspFlags{obj: &otg.IsisLspFlags{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspFlags) msg() *otg.IsisLspFlags { + return obj.obj +} + +func (obj *isisLspFlags) setMsg(msg *otg.IsisLspFlags) IsisLspFlags { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspFlags struct { + obj *isisLspFlags +} + +type marshalIsisLspFlags interface { + // ToProto marshals IsisLspFlags to protobuf object *otg.IsisLspFlags + ToProto() (*otg.IsisLspFlags, error) + // ToPbText marshals IsisLspFlags to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspFlags to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspFlags to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspFlags struct { + obj *isisLspFlags +} + +type unMarshalIsisLspFlags interface { + // FromProto unmarshals IsisLspFlags from protobuf object *otg.IsisLspFlags + FromProto(msg *otg.IsisLspFlags) (IsisLspFlags, error) + // FromPbText unmarshals IsisLspFlags from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspFlags from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspFlags from JSON text + FromJson(value string) error +} + +func (obj *isisLspFlags) Marshal() marshalIsisLspFlags { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspFlags{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspFlags) Unmarshal() unMarshalIsisLspFlags { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspFlags{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspFlags) ToProto() (*otg.IsisLspFlags, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspFlags) FromProto(msg *otg.IsisLspFlags) (IsisLspFlags, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspFlags) 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 *unMarshalisisLspFlags) 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 *marshalisisLspFlags) 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 *unMarshalisisLspFlags) 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 *marshalisisLspFlags) 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 *unMarshalisisLspFlags) 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 *isisLspFlags) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspFlags) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspFlags) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspFlags) Clone() (IsisLspFlags, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspFlags() + 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 +} + +// IsisLspFlags is lSP Type flags. +type IsisLspFlags interface { + Validation + // msg marshals IsisLspFlags to protobuf object *otg.IsisLspFlags + // and doesn't set defaults + msg() *otg.IsisLspFlags + // setMsg unmarshals IsisLspFlags from protobuf object *otg.IsisLspFlags + // and doesn't set defaults + setMsg(*otg.IsisLspFlags) IsisLspFlags + // provides marshal interface + Marshal() marshalIsisLspFlags + // provides unmarshal interface + Unmarshal() unMarshalIsisLspFlags + // validate validates IsisLspFlags + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspFlags, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PartitionRepair returns bool, set in IsisLspFlags. + PartitionRepair() bool + // SetPartitionRepair assigns bool provided by user to IsisLspFlags + SetPartitionRepair(value bool) IsisLspFlags + // HasPartitionRepair checks if PartitionRepair has been set in IsisLspFlags + HasPartitionRepair() bool + // AttachedError returns bool, set in IsisLspFlags. + AttachedError() bool + // SetAttachedError assigns bool provided by user to IsisLspFlags + SetAttachedError(value bool) IsisLspFlags + // HasAttachedError checks if AttachedError has been set in IsisLspFlags + HasAttachedError() bool + // AttachedExpense returns bool, set in IsisLspFlags. + AttachedExpense() bool + // SetAttachedExpense assigns bool provided by user to IsisLspFlags + SetAttachedExpense(value bool) IsisLspFlags + // HasAttachedExpense checks if AttachedExpense has been set in IsisLspFlags + HasAttachedExpense() bool + // AttachedDelay returns bool, set in IsisLspFlags. + AttachedDelay() bool + // SetAttachedDelay assigns bool provided by user to IsisLspFlags + SetAttachedDelay(value bool) IsisLspFlags + // HasAttachedDelay checks if AttachedDelay has been set in IsisLspFlags + HasAttachedDelay() bool + // AttachedDefault returns bool, set in IsisLspFlags. + AttachedDefault() bool + // SetAttachedDefault assigns bool provided by user to IsisLspFlags + SetAttachedDefault(value bool) IsisLspFlags + // HasAttachedDefault checks if AttachedDefault has been set in IsisLspFlags + HasAttachedDefault() bool + // Overload returns bool, set in IsisLspFlags. + Overload() bool + // SetOverload assigns bool provided by user to IsisLspFlags + SetOverload(value bool) IsisLspFlags + // HasOverload checks if Overload has been set in IsisLspFlags + HasOverload() bool +} + +// When set, the originator supports partition repair. +// PartitionRepair returns a bool +func (obj *isisLspFlags) PartitionRepair() bool { + + return *obj.obj.PartitionRepair + +} + +// When set, the originator supports partition repair. +// PartitionRepair returns a bool +func (obj *isisLspFlags) HasPartitionRepair() bool { + return obj.obj.PartitionRepair != nil +} + +// When set, the originator supports partition repair. +// SetPartitionRepair sets the bool value in the IsisLspFlags object +func (obj *isisLspFlags) SetPartitionRepair(value bool) IsisLspFlags { + + obj.obj.PartitionRepair = &value + return obj +} + +// When set, the originator is attached to another area using the referred metric. +// AttachedError returns a bool +func (obj *isisLspFlags) AttachedError() bool { + + return *obj.obj.AttachedError + +} + +// When set, the originator is attached to another area using the referred metric. +// AttachedError returns a bool +func (obj *isisLspFlags) HasAttachedError() bool { + return obj.obj.AttachedError != nil +} + +// When set, the originator is attached to another area using the referred metric. +// SetAttachedError sets the bool value in the IsisLspFlags object +func (obj *isisLspFlags) SetAttachedError(value bool) IsisLspFlags { + + obj.obj.AttachedError = &value + return obj +} + +// When set, the originator is attached to another +// area using the referred metric. +// AttachedExpense returns a bool +func (obj *isisLspFlags) AttachedExpense() bool { + + return *obj.obj.AttachedExpense + +} + +// When set, the originator is attached to another +// area using the referred metric. +// AttachedExpense returns a bool +func (obj *isisLspFlags) HasAttachedExpense() bool { + return obj.obj.AttachedExpense != nil +} + +// When set, the originator is attached to another +// area using the referred metric. +// SetAttachedExpense sets the bool value in the IsisLspFlags object +func (obj *isisLspFlags) SetAttachedExpense(value bool) IsisLspFlags { + + obj.obj.AttachedExpense = &value + return obj +} + +// Delay Metric - when set, the originator is attached to another +// area using the referred metric. +// AttachedDelay returns a bool +func (obj *isisLspFlags) AttachedDelay() bool { + + return *obj.obj.AttachedDelay + +} + +// Delay Metric - when set, the originator is attached to another +// area using the referred metric. +// AttachedDelay returns a bool +func (obj *isisLspFlags) HasAttachedDelay() bool { + return obj.obj.AttachedDelay != nil +} + +// Delay Metric - when set, the originator is attached to another +// area using the referred metric. +// SetAttachedDelay sets the bool value in the IsisLspFlags object +func (obj *isisLspFlags) SetAttachedDelay(value bool) IsisLspFlags { + + obj.obj.AttachedDelay = &value + return obj +} + +// Default Metric - when set, the originator is attached to another +// area using the referred metric. +// AttachedDefault returns a bool +func (obj *isisLspFlags) AttachedDefault() bool { + + return *obj.obj.AttachedDefault + +} + +// Default Metric - when set, the originator is attached to another +// area using the referred metric. +// AttachedDefault returns a bool +func (obj *isisLspFlags) HasAttachedDefault() bool { + return obj.obj.AttachedDefault != nil +} + +// Default Metric - when set, the originator is attached to another +// area using the referred metric. +// SetAttachedDefault sets the bool value in the IsisLspFlags object +func (obj *isisLspFlags) SetAttachedDefault(value bool) IsisLspFlags { + + obj.obj.AttachedDefault = &value + return obj +} + +// Overload bit - when set, the originator is overloaded, and must +// be avoided in path calculation. +// Overload returns a bool +func (obj *isisLspFlags) Overload() bool { + + return *obj.obj.Overload + +} + +// Overload bit - when set, the originator is overloaded, and must +// be avoided in path calculation. +// Overload returns a bool +func (obj *isisLspFlags) HasOverload() bool { + return obj.obj.Overload != nil +} + +// Overload bit - when set, the originator is overloaded, and must +// be avoided in path calculation. +// SetOverload sets the bool value in the IsisLspFlags object +func (obj *isisLspFlags) SetOverload(value bool) IsisLspFlags { + + obj.obj.Overload = &value + return obj +} + +func (obj *isisLspFlags) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *isisLspFlags) setDefault() { + +} diff --git a/gosnappi/isis_lsp_hostname.go b/gosnappi/isis_lsp_hostname.go new file mode 100644 index 00000000..65a1734e --- /dev/null +++ b/gosnappi/isis_lsp_hostname.go @@ -0,0 +1,306 @@ +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" +) + +// ***** IsisLspHostname ***** +type isisLspHostname struct { + validation + obj *otg.IsisLspHostname + marshaller marshalIsisLspHostname + unMarshaller unMarshalIsisLspHostname +} + +func NewIsisLspHostname() IsisLspHostname { + obj := isisLspHostname{obj: &otg.IsisLspHostname{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspHostname) msg() *otg.IsisLspHostname { + return obj.obj +} + +func (obj *isisLspHostname) setMsg(msg *otg.IsisLspHostname) IsisLspHostname { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspHostname struct { + obj *isisLspHostname +} + +type marshalIsisLspHostname interface { + // ToProto marshals IsisLspHostname to protobuf object *otg.IsisLspHostname + ToProto() (*otg.IsisLspHostname, error) + // ToPbText marshals IsisLspHostname to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspHostname to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspHostname to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspHostname struct { + obj *isisLspHostname +} + +type unMarshalIsisLspHostname interface { + // FromProto unmarshals IsisLspHostname from protobuf object *otg.IsisLspHostname + FromProto(msg *otg.IsisLspHostname) (IsisLspHostname, error) + // FromPbText unmarshals IsisLspHostname from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspHostname from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspHostname from JSON text + FromJson(value string) error +} + +func (obj *isisLspHostname) Marshal() marshalIsisLspHostname { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspHostname{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspHostname) Unmarshal() unMarshalIsisLspHostname { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspHostname{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspHostname) ToProto() (*otg.IsisLspHostname, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspHostname) FromProto(msg *otg.IsisLspHostname) (IsisLspHostname, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspHostname) 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 *unMarshalisisLspHostname) 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 *marshalisisLspHostname) 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 *unMarshalisisLspHostname) 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 *marshalisisLspHostname) 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 *unMarshalisisLspHostname) 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 *isisLspHostname) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspHostname) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspHostname) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspHostname) Clone() (IsisLspHostname, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspHostname() + 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 +} + +// IsisLspHostname is it contains Hostname for the TLV 137. +type IsisLspHostname interface { + Validation + // msg marshals IsisLspHostname to protobuf object *otg.IsisLspHostname + // and doesn't set defaults + msg() *otg.IsisLspHostname + // setMsg unmarshals IsisLspHostname from protobuf object *otg.IsisLspHostname + // and doesn't set defaults + setMsg(*otg.IsisLspHostname) IsisLspHostname + // provides marshal interface + Marshal() marshalIsisLspHostname + // provides unmarshal interface + Unmarshal() unMarshalIsisLspHostname + // validate validates IsisLspHostname + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspHostname, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Hostname returns string, set in IsisLspHostname. + Hostname() string + // SetHostname assigns string provided by user to IsisLspHostname + SetHostname(value string) IsisLspHostname + // HasHostname checks if Hostname has been set in IsisLspHostname + HasHostname() bool +} + +// Hostname for an ISIS router. +// Hostname returns a string +func (obj *isisLspHostname) Hostname() string { + + return *obj.obj.Hostname + +} + +// Hostname for an ISIS router. +// Hostname returns a string +func (obj *isisLspHostname) HasHostname() bool { + return obj.obj.Hostname != nil +} + +// Hostname for an ISIS router. +// SetHostname sets the string value in the IsisLspHostname object +func (obj *isisLspHostname) SetHostname(value string) IsisLspHostname { + + obj.obj.Hostname = &value + return obj +} + +func (obj *isisLspHostname) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *isisLspHostname) setDefault() { + +} diff --git a/gosnappi/isis_lsp_ipv4_external_reachability_tlv.go b/gosnappi/isis_lsp_ipv4_external_reachability_tlv.go new file mode 100644 index 00000000..eb87f03f --- /dev/null +++ b/gosnappi/isis_lsp_ipv4_external_reachability_tlv.go @@ -0,0 +1,391 @@ +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" +) + +// ***** IsisLspIpv4ExternalReachabilityTlv ***** +type isisLspIpv4ExternalReachabilityTlv struct { + validation + obj *otg.IsisLspIpv4ExternalReachabilityTlv + marshaller marshalIsisLspIpv4ExternalReachabilityTlv + unMarshaller unMarshalIsisLspIpv4ExternalReachabilityTlv + prefixesHolder IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter +} + +func NewIsisLspIpv4ExternalReachabilityTlv() IsisLspIpv4ExternalReachabilityTlv { + obj := isisLspIpv4ExternalReachabilityTlv{obj: &otg.IsisLspIpv4ExternalReachabilityTlv{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspIpv4ExternalReachabilityTlv) msg() *otg.IsisLspIpv4ExternalReachabilityTlv { + return obj.obj +} + +func (obj *isisLspIpv4ExternalReachabilityTlv) setMsg(msg *otg.IsisLspIpv4ExternalReachabilityTlv) IsisLspIpv4ExternalReachabilityTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspIpv4ExternalReachabilityTlv struct { + obj *isisLspIpv4ExternalReachabilityTlv +} + +type marshalIsisLspIpv4ExternalReachabilityTlv interface { + // ToProto marshals IsisLspIpv4ExternalReachabilityTlv to protobuf object *otg.IsisLspIpv4ExternalReachabilityTlv + ToProto() (*otg.IsisLspIpv4ExternalReachabilityTlv, error) + // ToPbText marshals IsisLspIpv4ExternalReachabilityTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspIpv4ExternalReachabilityTlv to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspIpv4ExternalReachabilityTlv to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspIpv4ExternalReachabilityTlv struct { + obj *isisLspIpv4ExternalReachabilityTlv +} + +type unMarshalIsisLspIpv4ExternalReachabilityTlv interface { + // FromProto unmarshals IsisLspIpv4ExternalReachabilityTlv from protobuf object *otg.IsisLspIpv4ExternalReachabilityTlv + FromProto(msg *otg.IsisLspIpv4ExternalReachabilityTlv) (IsisLspIpv4ExternalReachabilityTlv, error) + // FromPbText unmarshals IsisLspIpv4ExternalReachabilityTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspIpv4ExternalReachabilityTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspIpv4ExternalReachabilityTlv from JSON text + FromJson(value string) error +} + +func (obj *isisLspIpv4ExternalReachabilityTlv) Marshal() marshalIsisLspIpv4ExternalReachabilityTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspIpv4ExternalReachabilityTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspIpv4ExternalReachabilityTlv) Unmarshal() unMarshalIsisLspIpv4ExternalReachabilityTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspIpv4ExternalReachabilityTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspIpv4ExternalReachabilityTlv) ToProto() (*otg.IsisLspIpv4ExternalReachabilityTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspIpv4ExternalReachabilityTlv) FromProto(msg *otg.IsisLspIpv4ExternalReachabilityTlv) (IsisLspIpv4ExternalReachabilityTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspIpv4ExternalReachabilityTlv) 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 *unMarshalisisLspIpv4ExternalReachabilityTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisLspIpv4ExternalReachabilityTlv) 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 *unMarshalisisLspIpv4ExternalReachabilityTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisLspIpv4ExternalReachabilityTlv) 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 *unMarshalisisLspIpv4ExternalReachabilityTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisLspIpv4ExternalReachabilityTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspIpv4ExternalReachabilityTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspIpv4ExternalReachabilityTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspIpv4ExternalReachabilityTlv) Clone() (IsisLspIpv4ExternalReachabilityTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspIpv4ExternalReachabilityTlv() + 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 +} + +func (obj *isisLspIpv4ExternalReachabilityTlv) setNil() { + obj.prefixesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisLspIpv4ExternalReachabilityTlv is this container defines list of IPv4 external reachability information in one IPv4 external reachability TLV. +// This is advertised when the origin-type is set 'external' in route range configurations. +type IsisLspIpv4ExternalReachabilityTlv interface { + Validation + // msg marshals IsisLspIpv4ExternalReachabilityTlv to protobuf object *otg.IsisLspIpv4ExternalReachabilityTlv + // and doesn't set defaults + msg() *otg.IsisLspIpv4ExternalReachabilityTlv + // setMsg unmarshals IsisLspIpv4ExternalReachabilityTlv from protobuf object *otg.IsisLspIpv4ExternalReachabilityTlv + // and doesn't set defaults + setMsg(*otg.IsisLspIpv4ExternalReachabilityTlv) IsisLspIpv4ExternalReachabilityTlv + // provides marshal interface + Marshal() marshalIsisLspIpv4ExternalReachabilityTlv + // provides unmarshal interface + Unmarshal() unMarshalIsisLspIpv4ExternalReachabilityTlv + // validate validates IsisLspIpv4ExternalReachabilityTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspIpv4ExternalReachabilityTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Prefixes returns IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIterIter, set in IsisLspIpv4ExternalReachabilityTlv + Prefixes() IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter + setNil() +} + +// Describes list of IPv4 prefixes in this TLV.. +// Prefixes returns a []IsisLspV4Prefix +func (obj *isisLspIpv4ExternalReachabilityTlv) Prefixes() IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { + if len(obj.obj.Prefixes) == 0 { + obj.obj.Prefixes = []*otg.IsisLspV4Prefix{} + } + if obj.prefixesHolder == nil { + obj.prefixesHolder = newIsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter(&obj.obj.Prefixes).setMsg(obj) + } + return obj.prefixesHolder +} + +type isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter struct { + obj *isisLspIpv4ExternalReachabilityTlv + isisLspV4PrefixSlice []IsisLspV4Prefix + fieldPtr *[]*otg.IsisLspV4Prefix +} + +func newIsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter(ptr *[]*otg.IsisLspV4Prefix) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { + return &isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter{fieldPtr: ptr} +} + +type IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter interface { + setMsg(*isisLspIpv4ExternalReachabilityTlv) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter + Items() []IsisLspV4Prefix + Add() IsisLspV4Prefix + Append(items ...IsisLspV4Prefix) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter + Set(index int, newObj IsisLspV4Prefix) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter + Clear() IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter + clearHolderSlice() IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter + appendHolderSlice(item IsisLspV4Prefix) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter +} + +func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) setMsg(msg *isisLspIpv4ExternalReachabilityTlv) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspV4Prefix{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) Items() []IsisLspV4Prefix { + return obj.isisLspV4PrefixSlice +} + +func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) Add() IsisLspV4Prefix { + newObj := &otg.IsisLspV4Prefix{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspV4Prefix{obj: newObj} + newLibObj.setDefault() + obj.isisLspV4PrefixSlice = append(obj.isisLspV4PrefixSlice, newLibObj) + return newLibObj +} + +func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) Append(items ...IsisLspV4Prefix) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspV4PrefixSlice = append(obj.isisLspV4PrefixSlice, item) + } + return obj +} + +func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) Set(index int, newObj IsisLspV4Prefix) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspV4PrefixSlice[index] = newObj + return obj +} +func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) Clear() IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspV4Prefix{} + obj.isisLspV4PrefixSlice = []IsisLspV4Prefix{} + } + return obj +} +func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) clearHolderSlice() IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { + if len(obj.isisLspV4PrefixSlice) > 0 { + obj.isisLspV4PrefixSlice = []IsisLspV4Prefix{} + } + return obj +} +func (obj *isisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter) appendHolderSlice(item IsisLspV4Prefix) IsisLspIpv4ExternalReachabilityTlvIsisLspV4PrefixIter { + obj.isisLspV4PrefixSlice = append(obj.isisLspV4PrefixSlice, item) + return obj +} + +func (obj *isisLspIpv4ExternalReachabilityTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Prefixes) != 0 { + + if set_default { + obj.Prefixes().clearHolderSlice() + for _, item := range obj.obj.Prefixes { + obj.Prefixes().appendHolderSlice(&isisLspV4Prefix{obj: item}) + } + } + for _, item := range obj.Prefixes().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *isisLspIpv4ExternalReachabilityTlv) setDefault() { + +} diff --git a/gosnappi/isis_lsp_ipv4_internal_reachability_tlv.go b/gosnappi/isis_lsp_ipv4_internal_reachability_tlv.go new file mode 100644 index 00000000..e703754e --- /dev/null +++ b/gosnappi/isis_lsp_ipv4_internal_reachability_tlv.go @@ -0,0 +1,391 @@ +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" +) + +// ***** IsisLspIpv4InternalReachabilityTlv ***** +type isisLspIpv4InternalReachabilityTlv struct { + validation + obj *otg.IsisLspIpv4InternalReachabilityTlv + marshaller marshalIsisLspIpv4InternalReachabilityTlv + unMarshaller unMarshalIsisLspIpv4InternalReachabilityTlv + prefixesHolder IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter +} + +func NewIsisLspIpv4InternalReachabilityTlv() IsisLspIpv4InternalReachabilityTlv { + obj := isisLspIpv4InternalReachabilityTlv{obj: &otg.IsisLspIpv4InternalReachabilityTlv{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspIpv4InternalReachabilityTlv) msg() *otg.IsisLspIpv4InternalReachabilityTlv { + return obj.obj +} + +func (obj *isisLspIpv4InternalReachabilityTlv) setMsg(msg *otg.IsisLspIpv4InternalReachabilityTlv) IsisLspIpv4InternalReachabilityTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspIpv4InternalReachabilityTlv struct { + obj *isisLspIpv4InternalReachabilityTlv +} + +type marshalIsisLspIpv4InternalReachabilityTlv interface { + // ToProto marshals IsisLspIpv4InternalReachabilityTlv to protobuf object *otg.IsisLspIpv4InternalReachabilityTlv + ToProto() (*otg.IsisLspIpv4InternalReachabilityTlv, error) + // ToPbText marshals IsisLspIpv4InternalReachabilityTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspIpv4InternalReachabilityTlv to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspIpv4InternalReachabilityTlv to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspIpv4InternalReachabilityTlv struct { + obj *isisLspIpv4InternalReachabilityTlv +} + +type unMarshalIsisLspIpv4InternalReachabilityTlv interface { + // FromProto unmarshals IsisLspIpv4InternalReachabilityTlv from protobuf object *otg.IsisLspIpv4InternalReachabilityTlv + FromProto(msg *otg.IsisLspIpv4InternalReachabilityTlv) (IsisLspIpv4InternalReachabilityTlv, error) + // FromPbText unmarshals IsisLspIpv4InternalReachabilityTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspIpv4InternalReachabilityTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspIpv4InternalReachabilityTlv from JSON text + FromJson(value string) error +} + +func (obj *isisLspIpv4InternalReachabilityTlv) Marshal() marshalIsisLspIpv4InternalReachabilityTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspIpv4InternalReachabilityTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspIpv4InternalReachabilityTlv) Unmarshal() unMarshalIsisLspIpv4InternalReachabilityTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspIpv4InternalReachabilityTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspIpv4InternalReachabilityTlv) ToProto() (*otg.IsisLspIpv4InternalReachabilityTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspIpv4InternalReachabilityTlv) FromProto(msg *otg.IsisLspIpv4InternalReachabilityTlv) (IsisLspIpv4InternalReachabilityTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspIpv4InternalReachabilityTlv) 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 *unMarshalisisLspIpv4InternalReachabilityTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisLspIpv4InternalReachabilityTlv) 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 *unMarshalisisLspIpv4InternalReachabilityTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisLspIpv4InternalReachabilityTlv) 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 *unMarshalisisLspIpv4InternalReachabilityTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisLspIpv4InternalReachabilityTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspIpv4InternalReachabilityTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspIpv4InternalReachabilityTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspIpv4InternalReachabilityTlv) Clone() (IsisLspIpv4InternalReachabilityTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspIpv4InternalReachabilityTlv() + 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 +} + +func (obj *isisLspIpv4InternalReachabilityTlv) setNil() { + obj.prefixesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisLspIpv4InternalReachabilityTlv is this container defines list of IPv4 internal reachability information in one IPv4 internal reachability TLV. +// This is advertised when the origin-type is set 'internal' in route range configurations. +type IsisLspIpv4InternalReachabilityTlv interface { + Validation + // msg marshals IsisLspIpv4InternalReachabilityTlv to protobuf object *otg.IsisLspIpv4InternalReachabilityTlv + // and doesn't set defaults + msg() *otg.IsisLspIpv4InternalReachabilityTlv + // setMsg unmarshals IsisLspIpv4InternalReachabilityTlv from protobuf object *otg.IsisLspIpv4InternalReachabilityTlv + // and doesn't set defaults + setMsg(*otg.IsisLspIpv4InternalReachabilityTlv) IsisLspIpv4InternalReachabilityTlv + // provides marshal interface + Marshal() marshalIsisLspIpv4InternalReachabilityTlv + // provides unmarshal interface + Unmarshal() unMarshalIsisLspIpv4InternalReachabilityTlv + // validate validates IsisLspIpv4InternalReachabilityTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspIpv4InternalReachabilityTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Prefixes returns IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIterIter, set in IsisLspIpv4InternalReachabilityTlv + Prefixes() IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter + setNil() +} + +// Describes list of IPv4 prefixes in this TLV. +// Prefixes returns a []IsisLspV4Prefix +func (obj *isisLspIpv4InternalReachabilityTlv) Prefixes() IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { + if len(obj.obj.Prefixes) == 0 { + obj.obj.Prefixes = []*otg.IsisLspV4Prefix{} + } + if obj.prefixesHolder == nil { + obj.prefixesHolder = newIsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter(&obj.obj.Prefixes).setMsg(obj) + } + return obj.prefixesHolder +} + +type isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter struct { + obj *isisLspIpv4InternalReachabilityTlv + isisLspV4PrefixSlice []IsisLspV4Prefix + fieldPtr *[]*otg.IsisLspV4Prefix +} + +func newIsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter(ptr *[]*otg.IsisLspV4Prefix) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { + return &isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter{fieldPtr: ptr} +} + +type IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter interface { + setMsg(*isisLspIpv4InternalReachabilityTlv) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter + Items() []IsisLspV4Prefix + Add() IsisLspV4Prefix + Append(items ...IsisLspV4Prefix) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter + Set(index int, newObj IsisLspV4Prefix) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter + Clear() IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter + clearHolderSlice() IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter + appendHolderSlice(item IsisLspV4Prefix) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter +} + +func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) setMsg(msg *isisLspIpv4InternalReachabilityTlv) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspV4Prefix{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) Items() []IsisLspV4Prefix { + return obj.isisLspV4PrefixSlice +} + +func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) Add() IsisLspV4Prefix { + newObj := &otg.IsisLspV4Prefix{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspV4Prefix{obj: newObj} + newLibObj.setDefault() + obj.isisLspV4PrefixSlice = append(obj.isisLspV4PrefixSlice, newLibObj) + return newLibObj +} + +func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) Append(items ...IsisLspV4Prefix) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspV4PrefixSlice = append(obj.isisLspV4PrefixSlice, item) + } + return obj +} + +func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) Set(index int, newObj IsisLspV4Prefix) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspV4PrefixSlice[index] = newObj + return obj +} +func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) Clear() IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspV4Prefix{} + obj.isisLspV4PrefixSlice = []IsisLspV4Prefix{} + } + return obj +} +func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) clearHolderSlice() IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { + if len(obj.isisLspV4PrefixSlice) > 0 { + obj.isisLspV4PrefixSlice = []IsisLspV4Prefix{} + } + return obj +} +func (obj *isisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter) appendHolderSlice(item IsisLspV4Prefix) IsisLspIpv4InternalReachabilityTlvIsisLspV4PrefixIter { + obj.isisLspV4PrefixSlice = append(obj.isisLspV4PrefixSlice, item) + return obj +} + +func (obj *isisLspIpv4InternalReachabilityTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Prefixes) != 0 { + + if set_default { + obj.Prefixes().clearHolderSlice() + for _, item := range obj.obj.Prefixes { + obj.Prefixes().appendHolderSlice(&isisLspV4Prefix{obj: item}) + } + } + for _, item := range obj.Prefixes().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *isisLspIpv4InternalReachabilityTlv) setDefault() { + +} diff --git a/gosnappi/isis_lsp_ipv6_reachability_tlv.go b/gosnappi/isis_lsp_ipv6_reachability_tlv.go new file mode 100644 index 00000000..4e913b87 --- /dev/null +++ b/gosnappi/isis_lsp_ipv6_reachability_tlv.go @@ -0,0 +1,390 @@ +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" +) + +// ***** IsisLspIpv6ReachabilityTlv ***** +type isisLspIpv6ReachabilityTlv struct { + validation + obj *otg.IsisLspIpv6ReachabilityTlv + marshaller marshalIsisLspIpv6ReachabilityTlv + unMarshaller unMarshalIsisLspIpv6ReachabilityTlv + prefixesHolder IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter +} + +func NewIsisLspIpv6ReachabilityTlv() IsisLspIpv6ReachabilityTlv { + obj := isisLspIpv6ReachabilityTlv{obj: &otg.IsisLspIpv6ReachabilityTlv{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspIpv6ReachabilityTlv) msg() *otg.IsisLspIpv6ReachabilityTlv { + return obj.obj +} + +func (obj *isisLspIpv6ReachabilityTlv) setMsg(msg *otg.IsisLspIpv6ReachabilityTlv) IsisLspIpv6ReachabilityTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspIpv6ReachabilityTlv struct { + obj *isisLspIpv6ReachabilityTlv +} + +type marshalIsisLspIpv6ReachabilityTlv interface { + // ToProto marshals IsisLspIpv6ReachabilityTlv to protobuf object *otg.IsisLspIpv6ReachabilityTlv + ToProto() (*otg.IsisLspIpv6ReachabilityTlv, error) + // ToPbText marshals IsisLspIpv6ReachabilityTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspIpv6ReachabilityTlv to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspIpv6ReachabilityTlv to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspIpv6ReachabilityTlv struct { + obj *isisLspIpv6ReachabilityTlv +} + +type unMarshalIsisLspIpv6ReachabilityTlv interface { + // FromProto unmarshals IsisLspIpv6ReachabilityTlv from protobuf object *otg.IsisLspIpv6ReachabilityTlv + FromProto(msg *otg.IsisLspIpv6ReachabilityTlv) (IsisLspIpv6ReachabilityTlv, error) + // FromPbText unmarshals IsisLspIpv6ReachabilityTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspIpv6ReachabilityTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspIpv6ReachabilityTlv from JSON text + FromJson(value string) error +} + +func (obj *isisLspIpv6ReachabilityTlv) Marshal() marshalIsisLspIpv6ReachabilityTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspIpv6ReachabilityTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspIpv6ReachabilityTlv) Unmarshal() unMarshalIsisLspIpv6ReachabilityTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspIpv6ReachabilityTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspIpv6ReachabilityTlv) ToProto() (*otg.IsisLspIpv6ReachabilityTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspIpv6ReachabilityTlv) FromProto(msg *otg.IsisLspIpv6ReachabilityTlv) (IsisLspIpv6ReachabilityTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspIpv6ReachabilityTlv) 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 *unMarshalisisLspIpv6ReachabilityTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisLspIpv6ReachabilityTlv) 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 *unMarshalisisLspIpv6ReachabilityTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisLspIpv6ReachabilityTlv) 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 *unMarshalisisLspIpv6ReachabilityTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisLspIpv6ReachabilityTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspIpv6ReachabilityTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspIpv6ReachabilityTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspIpv6ReachabilityTlv) Clone() (IsisLspIpv6ReachabilityTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspIpv6ReachabilityTlv() + 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 +} + +func (obj *isisLspIpv6ReachabilityTlv) setNil() { + obj.prefixesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisLspIpv6ReachabilityTlv is it defines list of IPv6 extended reachability information in one IPv6 Reachability TLV. +type IsisLspIpv6ReachabilityTlv interface { + Validation + // msg marshals IsisLspIpv6ReachabilityTlv to protobuf object *otg.IsisLspIpv6ReachabilityTlv + // and doesn't set defaults + msg() *otg.IsisLspIpv6ReachabilityTlv + // setMsg unmarshals IsisLspIpv6ReachabilityTlv from protobuf object *otg.IsisLspIpv6ReachabilityTlv + // and doesn't set defaults + setMsg(*otg.IsisLspIpv6ReachabilityTlv) IsisLspIpv6ReachabilityTlv + // provides marshal interface + Marshal() marshalIsisLspIpv6ReachabilityTlv + // provides unmarshal interface + Unmarshal() unMarshalIsisLspIpv6ReachabilityTlv + // validate validates IsisLspIpv6ReachabilityTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspIpv6ReachabilityTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Prefixes returns IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIterIter, set in IsisLspIpv6ReachabilityTlv + Prefixes() IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter + setNil() +} + +// IPv6 prefix contained within reachability TLVs. +// Prefixes returns a []IsisLspV6Prefix +func (obj *isisLspIpv6ReachabilityTlv) Prefixes() IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { + if len(obj.obj.Prefixes) == 0 { + obj.obj.Prefixes = []*otg.IsisLspV6Prefix{} + } + if obj.prefixesHolder == nil { + obj.prefixesHolder = newIsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter(&obj.obj.Prefixes).setMsg(obj) + } + return obj.prefixesHolder +} + +type isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter struct { + obj *isisLspIpv6ReachabilityTlv + isisLspV6PrefixSlice []IsisLspV6Prefix + fieldPtr *[]*otg.IsisLspV6Prefix +} + +func newIsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter(ptr *[]*otg.IsisLspV6Prefix) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { + return &isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter{fieldPtr: ptr} +} + +type IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter interface { + setMsg(*isisLspIpv6ReachabilityTlv) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter + Items() []IsisLspV6Prefix + Add() IsisLspV6Prefix + Append(items ...IsisLspV6Prefix) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter + Set(index int, newObj IsisLspV6Prefix) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter + Clear() IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter + clearHolderSlice() IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter + appendHolderSlice(item IsisLspV6Prefix) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter +} + +func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) setMsg(msg *isisLspIpv6ReachabilityTlv) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspV6Prefix{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) Items() []IsisLspV6Prefix { + return obj.isisLspV6PrefixSlice +} + +func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) Add() IsisLspV6Prefix { + newObj := &otg.IsisLspV6Prefix{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspV6Prefix{obj: newObj} + newLibObj.setDefault() + obj.isisLspV6PrefixSlice = append(obj.isisLspV6PrefixSlice, newLibObj) + return newLibObj +} + +func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) Append(items ...IsisLspV6Prefix) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspV6PrefixSlice = append(obj.isisLspV6PrefixSlice, item) + } + return obj +} + +func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) Set(index int, newObj IsisLspV6Prefix) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspV6PrefixSlice[index] = newObj + return obj +} +func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) Clear() IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspV6Prefix{} + obj.isisLspV6PrefixSlice = []IsisLspV6Prefix{} + } + return obj +} +func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) clearHolderSlice() IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { + if len(obj.isisLspV6PrefixSlice) > 0 { + obj.isisLspV6PrefixSlice = []IsisLspV6Prefix{} + } + return obj +} +func (obj *isisLspIpv6ReachabilityTlvIsisLspV6PrefixIter) appendHolderSlice(item IsisLspV6Prefix) IsisLspIpv6ReachabilityTlvIsisLspV6PrefixIter { + obj.isisLspV6PrefixSlice = append(obj.isisLspV6PrefixSlice, item) + return obj +} + +func (obj *isisLspIpv6ReachabilityTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Prefixes) != 0 { + + if set_default { + obj.Prefixes().clearHolderSlice() + for _, item := range obj.obj.Prefixes { + obj.Prefixes().appendHolderSlice(&isisLspV6Prefix{obj: item}) + } + } + for _, item := range obj.Prefixes().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *isisLspIpv6ReachabilityTlv) setDefault() { + +} diff --git a/gosnappi/isis_lsp_is_reachability_tlv.go b/gosnappi/isis_lsp_is_reachability_tlv.go new file mode 100644 index 00000000..a0621ca7 --- /dev/null +++ b/gosnappi/isis_lsp_is_reachability_tlv.go @@ -0,0 +1,390 @@ +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" +) + +// ***** IsisLspIsReachabilityTlv ***** +type isisLspIsReachabilityTlv struct { + validation + obj *otg.IsisLspIsReachabilityTlv + marshaller marshalIsisLspIsReachabilityTlv + unMarshaller unMarshalIsisLspIsReachabilityTlv + neighborsHolder IsisLspIsReachabilityTlvIsisLspneighborIter +} + +func NewIsisLspIsReachabilityTlv() IsisLspIsReachabilityTlv { + obj := isisLspIsReachabilityTlv{obj: &otg.IsisLspIsReachabilityTlv{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspIsReachabilityTlv) msg() *otg.IsisLspIsReachabilityTlv { + return obj.obj +} + +func (obj *isisLspIsReachabilityTlv) setMsg(msg *otg.IsisLspIsReachabilityTlv) IsisLspIsReachabilityTlv { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspIsReachabilityTlv struct { + obj *isisLspIsReachabilityTlv +} + +type marshalIsisLspIsReachabilityTlv interface { + // ToProto marshals IsisLspIsReachabilityTlv to protobuf object *otg.IsisLspIsReachabilityTlv + ToProto() (*otg.IsisLspIsReachabilityTlv, error) + // ToPbText marshals IsisLspIsReachabilityTlv to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspIsReachabilityTlv to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspIsReachabilityTlv to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspIsReachabilityTlv struct { + obj *isisLspIsReachabilityTlv +} + +type unMarshalIsisLspIsReachabilityTlv interface { + // FromProto unmarshals IsisLspIsReachabilityTlv from protobuf object *otg.IsisLspIsReachabilityTlv + FromProto(msg *otg.IsisLspIsReachabilityTlv) (IsisLspIsReachabilityTlv, error) + // FromPbText unmarshals IsisLspIsReachabilityTlv from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspIsReachabilityTlv from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspIsReachabilityTlv from JSON text + FromJson(value string) error +} + +func (obj *isisLspIsReachabilityTlv) Marshal() marshalIsisLspIsReachabilityTlv { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspIsReachabilityTlv{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspIsReachabilityTlv) Unmarshal() unMarshalIsisLspIsReachabilityTlv { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspIsReachabilityTlv{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspIsReachabilityTlv) ToProto() (*otg.IsisLspIsReachabilityTlv, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspIsReachabilityTlv) FromProto(msg *otg.IsisLspIsReachabilityTlv) (IsisLspIsReachabilityTlv, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspIsReachabilityTlv) 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 *unMarshalisisLspIsReachabilityTlv) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisLspIsReachabilityTlv) 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 *unMarshalisisLspIsReachabilityTlv) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisLspIsReachabilityTlv) 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 *unMarshalisisLspIsReachabilityTlv) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisLspIsReachabilityTlv) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspIsReachabilityTlv) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspIsReachabilityTlv) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspIsReachabilityTlv) Clone() (IsisLspIsReachabilityTlv, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspIsReachabilityTlv() + 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 +} + +func (obj *isisLspIsReachabilityTlv) setNil() { + obj.neighborsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisLspIsReachabilityTlv is this container describes list of ISIS neighbors and attributes in IS-Reachability TLV (type 2). +type IsisLspIsReachabilityTlv interface { + Validation + // msg marshals IsisLspIsReachabilityTlv to protobuf object *otg.IsisLspIsReachabilityTlv + // and doesn't set defaults + msg() *otg.IsisLspIsReachabilityTlv + // setMsg unmarshals IsisLspIsReachabilityTlv from protobuf object *otg.IsisLspIsReachabilityTlv + // and doesn't set defaults + setMsg(*otg.IsisLspIsReachabilityTlv) IsisLspIsReachabilityTlv + // provides marshal interface + Marshal() marshalIsisLspIsReachabilityTlv + // provides unmarshal interface + Unmarshal() unMarshalIsisLspIsReachabilityTlv + // validate validates IsisLspIsReachabilityTlv + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspIsReachabilityTlv, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Neighbors returns IsisLspIsReachabilityTlvIsisLspneighborIterIter, set in IsisLspIsReachabilityTlv + Neighbors() IsisLspIsReachabilityTlvIsisLspneighborIter + setNil() +} + +// This container describes Intermediate System (IS) neighbors. +// Neighbors returns a []IsisLspneighbor +func (obj *isisLspIsReachabilityTlv) Neighbors() IsisLspIsReachabilityTlvIsisLspneighborIter { + if len(obj.obj.Neighbors) == 0 { + obj.obj.Neighbors = []*otg.IsisLspneighbor{} + } + if obj.neighborsHolder == nil { + obj.neighborsHolder = newIsisLspIsReachabilityTlvIsisLspneighborIter(&obj.obj.Neighbors).setMsg(obj) + } + return obj.neighborsHolder +} + +type isisLspIsReachabilityTlvIsisLspneighborIter struct { + obj *isisLspIsReachabilityTlv + isisLspneighborSlice []IsisLspneighbor + fieldPtr *[]*otg.IsisLspneighbor +} + +func newIsisLspIsReachabilityTlvIsisLspneighborIter(ptr *[]*otg.IsisLspneighbor) IsisLspIsReachabilityTlvIsisLspneighborIter { + return &isisLspIsReachabilityTlvIsisLspneighborIter{fieldPtr: ptr} +} + +type IsisLspIsReachabilityTlvIsisLspneighborIter interface { + setMsg(*isisLspIsReachabilityTlv) IsisLspIsReachabilityTlvIsisLspneighborIter + Items() []IsisLspneighbor + Add() IsisLspneighbor + Append(items ...IsisLspneighbor) IsisLspIsReachabilityTlvIsisLspneighborIter + Set(index int, newObj IsisLspneighbor) IsisLspIsReachabilityTlvIsisLspneighborIter + Clear() IsisLspIsReachabilityTlvIsisLspneighborIter + clearHolderSlice() IsisLspIsReachabilityTlvIsisLspneighborIter + appendHolderSlice(item IsisLspneighbor) IsisLspIsReachabilityTlvIsisLspneighborIter +} + +func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) setMsg(msg *isisLspIsReachabilityTlv) IsisLspIsReachabilityTlvIsisLspneighborIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspneighbor{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) Items() []IsisLspneighbor { + return obj.isisLspneighborSlice +} + +func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) Add() IsisLspneighbor { + newObj := &otg.IsisLspneighbor{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspneighbor{obj: newObj} + newLibObj.setDefault() + obj.isisLspneighborSlice = append(obj.isisLspneighborSlice, newLibObj) + return newLibObj +} + +func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) Append(items ...IsisLspneighbor) IsisLspIsReachabilityTlvIsisLspneighborIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspneighborSlice = append(obj.isisLspneighborSlice, item) + } + return obj +} + +func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) Set(index int, newObj IsisLspneighbor) IsisLspIsReachabilityTlvIsisLspneighborIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspneighborSlice[index] = newObj + return obj +} +func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) Clear() IsisLspIsReachabilityTlvIsisLspneighborIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspneighbor{} + obj.isisLspneighborSlice = []IsisLspneighbor{} + } + return obj +} +func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) clearHolderSlice() IsisLspIsReachabilityTlvIsisLspneighborIter { + if len(obj.isisLspneighborSlice) > 0 { + obj.isisLspneighborSlice = []IsisLspneighbor{} + } + return obj +} +func (obj *isisLspIsReachabilityTlvIsisLspneighborIter) appendHolderSlice(item IsisLspneighbor) IsisLspIsReachabilityTlvIsisLspneighborIter { + obj.isisLspneighborSlice = append(obj.isisLspneighborSlice, item) + return obj +} + +func (obj *isisLspIsReachabilityTlv) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Neighbors) != 0 { + + if set_default { + obj.Neighbors().clearHolderSlice() + for _, item := range obj.obj.Neighbors { + obj.Neighbors().appendHolderSlice(&isisLspneighbor{obj: item}) + } + } + for _, item := range obj.Neighbors().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *isisLspIsReachabilityTlv) setDefault() { + +} diff --git a/gosnappi/isis_lsp_prefix_attributes.go b/gosnappi/isis_lsp_prefix_attributes.go new file mode 100644 index 00000000..bf72af90 --- /dev/null +++ b/gosnappi/isis_lsp_prefix_attributes.go @@ -0,0 +1,362 @@ +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" +) + +// ***** IsisLspPrefixAttributes ***** +type isisLspPrefixAttributes struct { + validation + obj *otg.IsisLspPrefixAttributes + marshaller marshalIsisLspPrefixAttributes + unMarshaller unMarshalIsisLspPrefixAttributes +} + +func NewIsisLspPrefixAttributes() IsisLspPrefixAttributes { + obj := isisLspPrefixAttributes{obj: &otg.IsisLspPrefixAttributes{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspPrefixAttributes) msg() *otg.IsisLspPrefixAttributes { + return obj.obj +} + +func (obj *isisLspPrefixAttributes) setMsg(msg *otg.IsisLspPrefixAttributes) IsisLspPrefixAttributes { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspPrefixAttributes struct { + obj *isisLspPrefixAttributes +} + +type marshalIsisLspPrefixAttributes interface { + // ToProto marshals IsisLspPrefixAttributes to protobuf object *otg.IsisLspPrefixAttributes + ToProto() (*otg.IsisLspPrefixAttributes, error) + // ToPbText marshals IsisLspPrefixAttributes to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspPrefixAttributes to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspPrefixAttributes to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspPrefixAttributes struct { + obj *isisLspPrefixAttributes +} + +type unMarshalIsisLspPrefixAttributes interface { + // FromProto unmarshals IsisLspPrefixAttributes from protobuf object *otg.IsisLspPrefixAttributes + FromProto(msg *otg.IsisLspPrefixAttributes) (IsisLspPrefixAttributes, error) + // FromPbText unmarshals IsisLspPrefixAttributes from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspPrefixAttributes from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspPrefixAttributes from JSON text + FromJson(value string) error +} + +func (obj *isisLspPrefixAttributes) Marshal() marshalIsisLspPrefixAttributes { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspPrefixAttributes{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspPrefixAttributes) Unmarshal() unMarshalIsisLspPrefixAttributes { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspPrefixAttributes{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspPrefixAttributes) ToProto() (*otg.IsisLspPrefixAttributes, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspPrefixAttributes) FromProto(msg *otg.IsisLspPrefixAttributes) (IsisLspPrefixAttributes, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspPrefixAttributes) 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 *unMarshalisisLspPrefixAttributes) 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 *marshalisisLspPrefixAttributes) 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 *unMarshalisisLspPrefixAttributes) 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 *marshalisisLspPrefixAttributes) 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 *unMarshalisisLspPrefixAttributes) 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 *isisLspPrefixAttributes) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspPrefixAttributes) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspPrefixAttributes) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspPrefixAttributes) Clone() (IsisLspPrefixAttributes, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspPrefixAttributes() + 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 +} + +// IsisLspPrefixAttributes is this contains the properties of ISIS Prefix attributes for the extended IPv4 and IPv6 reachability. https://www.rfc-editor.org/rfc/rfc7794.html +type IsisLspPrefixAttributes interface { + Validation + // msg marshals IsisLspPrefixAttributes to protobuf object *otg.IsisLspPrefixAttributes + // and doesn't set defaults + msg() *otg.IsisLspPrefixAttributes + // setMsg unmarshals IsisLspPrefixAttributes from protobuf object *otg.IsisLspPrefixAttributes + // and doesn't set defaults + setMsg(*otg.IsisLspPrefixAttributes) IsisLspPrefixAttributes + // provides marshal interface + Marshal() marshalIsisLspPrefixAttributes + // provides unmarshal interface + Unmarshal() unMarshalIsisLspPrefixAttributes + // validate validates IsisLspPrefixAttributes + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspPrefixAttributes, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // XFlag returns bool, set in IsisLspPrefixAttributes. + XFlag() bool + // SetXFlag assigns bool provided by user to IsisLspPrefixAttributes + SetXFlag(value bool) IsisLspPrefixAttributes + // HasXFlag checks if XFlag has been set in IsisLspPrefixAttributes + HasXFlag() bool + // RFlag returns bool, set in IsisLspPrefixAttributes. + RFlag() bool + // SetRFlag assigns bool provided by user to IsisLspPrefixAttributes + SetRFlag(value bool) IsisLspPrefixAttributes + // HasRFlag checks if RFlag has been set in IsisLspPrefixAttributes + HasRFlag() bool + // NFlag returns bool, set in IsisLspPrefixAttributes. + NFlag() bool + // SetNFlag assigns bool provided by user to IsisLspPrefixAttributes + SetNFlag(value bool) IsisLspPrefixAttributes + // HasNFlag checks if NFlag has been set in IsisLspPrefixAttributes + HasNFlag() bool +} + +// External Prefix Flag (Bit 0) +// XFlag returns a bool +func (obj *isisLspPrefixAttributes) XFlag() bool { + + return *obj.obj.XFlag + +} + +// External Prefix Flag (Bit 0) +// XFlag returns a bool +func (obj *isisLspPrefixAttributes) HasXFlag() bool { + return obj.obj.XFlag != nil +} + +// External Prefix Flag (Bit 0) +// SetXFlag sets the bool value in the IsisLspPrefixAttributes object +func (obj *isisLspPrefixAttributes) SetXFlag(value bool) IsisLspPrefixAttributes { + + obj.obj.XFlag = &value + return obj +} + +// Re-advertisement Flag (Bit 1) +// RFlag returns a bool +func (obj *isisLspPrefixAttributes) RFlag() bool { + + return *obj.obj.RFlag + +} + +// Re-advertisement Flag (Bit 1) +// RFlag returns a bool +func (obj *isisLspPrefixAttributes) HasRFlag() bool { + return obj.obj.RFlag != nil +} + +// Re-advertisement Flag (Bit 1) +// SetRFlag sets the bool value in the IsisLspPrefixAttributes object +func (obj *isisLspPrefixAttributes) SetRFlag(value bool) IsisLspPrefixAttributes { + + obj.obj.RFlag = &value + return obj +} + +// Node Flag (Bit 2) +// NFlag returns a bool +func (obj *isisLspPrefixAttributes) NFlag() bool { + + return *obj.obj.NFlag + +} + +// Node Flag (Bit 2) +// NFlag returns a bool +func (obj *isisLspPrefixAttributes) HasNFlag() bool { + return obj.obj.NFlag != nil +} + +// Node Flag (Bit 2) +// SetNFlag sets the bool value in the IsisLspPrefixAttributes object +func (obj *isisLspPrefixAttributes) SetNFlag(value bool) IsisLspPrefixAttributes { + + obj.obj.NFlag = &value + return obj +} + +func (obj *isisLspPrefixAttributes) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *isisLspPrefixAttributes) setDefault() { + +} diff --git a/gosnappi/isis_lsp_state.go b/gosnappi/isis_lsp_state.go new file mode 100644 index 00000000..6a87eeec --- /dev/null +++ b/gosnappi/isis_lsp_state.go @@ -0,0 +1,577 @@ +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" +) + +// ***** IsisLspState ***** +type isisLspState struct { + validation + obj *otg.IsisLspState + marshaller marshalIsisLspState + unMarshaller unMarshalIsisLspState + flagsHolder IsisLspFlags + tlvsHolder IsisLspTlvs +} + +func NewIsisLspState() IsisLspState { + obj := isisLspState{obj: &otg.IsisLspState{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspState) msg() *otg.IsisLspState { + return obj.obj +} + +func (obj *isisLspState) setMsg(msg *otg.IsisLspState) IsisLspState { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspState struct { + obj *isisLspState +} + +type marshalIsisLspState interface { + // ToProto marshals IsisLspState to protobuf object *otg.IsisLspState + ToProto() (*otg.IsisLspState, error) + // ToPbText marshals IsisLspState to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspState to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspState to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspState struct { + obj *isisLspState +} + +type unMarshalIsisLspState interface { + // FromProto unmarshals IsisLspState from protobuf object *otg.IsisLspState + FromProto(msg *otg.IsisLspState) (IsisLspState, error) + // FromPbText unmarshals IsisLspState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspState from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspState from JSON text + FromJson(value string) error +} + +func (obj *isisLspState) Marshal() marshalIsisLspState { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspState{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspState) Unmarshal() unMarshalIsisLspState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspState) ToProto() (*otg.IsisLspState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspState) FromProto(msg *otg.IsisLspState) (IsisLspState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspState) 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 *unMarshalisisLspState) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisLspState) 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 *unMarshalisisLspState) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisLspState) 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 *unMarshalisisLspState) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisLspState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspState) Clone() (IsisLspState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspState() + 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 +} + +func (obj *isisLspState) setNil() { + obj.flagsHolder = nil + obj.tlvsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisLspState is iSIS LSP. +type IsisLspState interface { + Validation + // msg marshals IsisLspState to protobuf object *otg.IsisLspState + // and doesn't set defaults + msg() *otg.IsisLspState + // setMsg unmarshals IsisLspState from protobuf object *otg.IsisLspState + // and doesn't set defaults + setMsg(*otg.IsisLspState) IsisLspState + // provides marshal interface + Marshal() marshalIsisLspState + // provides unmarshal interface + Unmarshal() unMarshalIsisLspState + // validate validates IsisLspState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // LspId returns string, set in IsisLspState. + LspId() string + // SetLspId assigns string provided by user to IsisLspState + SetLspId(value string) IsisLspState + // PduType returns IsisLspStatePduTypeEnum, set in IsisLspState + PduType() IsisLspStatePduTypeEnum + // SetPduType assigns IsisLspStatePduTypeEnum provided by user to IsisLspState + SetPduType(value IsisLspStatePduTypeEnum) IsisLspState + // HasPduType checks if PduType has been set in IsisLspState + HasPduType() bool + // RemainingLifetime returns uint32, set in IsisLspState. + RemainingLifetime() uint32 + // SetRemainingLifetime assigns uint32 provided by user to IsisLspState + SetRemainingLifetime(value uint32) IsisLspState + // HasRemainingLifetime checks if RemainingLifetime has been set in IsisLspState + HasRemainingLifetime() bool + // SequenceNumber returns uint64, set in IsisLspState. + SequenceNumber() uint64 + // SetSequenceNumber assigns uint64 provided by user to IsisLspState + SetSequenceNumber(value uint64) IsisLspState + // HasSequenceNumber checks if SequenceNumber has been set in IsisLspState + HasSequenceNumber() bool + // PduLength returns uint32, set in IsisLspState. + PduLength() uint32 + // SetPduLength assigns uint32 provided by user to IsisLspState + SetPduLength(value uint32) IsisLspState + // HasPduLength checks if PduLength has been set in IsisLspState + HasPduLength() bool + // Flags returns IsisLspFlags, set in IsisLspState. + // IsisLspFlags is lSP Type flags. + Flags() IsisLspFlags + // SetFlags assigns IsisLspFlags provided by user to IsisLspState. + // IsisLspFlags is lSP Type flags. + SetFlags(value IsisLspFlags) IsisLspState + // HasFlags checks if Flags has been set in IsisLspState + HasFlags() bool + // IsType returns uint32, set in IsisLspState. + IsType() uint32 + // SetIsType assigns uint32 provided by user to IsisLspState + SetIsType(value uint32) IsisLspState + // HasIsType checks if IsType has been set in IsisLspState + HasIsType() bool + // Tlvs returns IsisLspTlvs, set in IsisLspState. + // IsisLspTlvs is this contains the list of TLVs present in one LSP. + Tlvs() IsisLspTlvs + // SetTlvs assigns IsisLspTlvs provided by user to IsisLspState. + // IsisLspTlvs is this contains the list of TLVs present in one LSP. + SetTlvs(value IsisLspTlvs) IsisLspState + // HasTlvs checks if Tlvs has been set in IsisLspState + HasTlvs() bool + setNil() +} + +// LSP ID in the format, e.g. '640000000001-00-00'. LSP ID consists of the System ID of a neighbor, the Pseudonode ID, and the LSP number. The last two bytes represent Pseudonode ID and LSP number respectively. A pseudonode is a logical representation of the LAN which is generated by a Designated Intermediate System (DIS) on a LAN segment. If one LSP exceeds the maximum LSP size then it is sent in another LSP with the LSP number incremented by one. A router's learned LSP gets refreshed by 'remaining_lifetime'. Then the sequence number is incremented by 1. +// LspId returns a string +func (obj *isisLspState) LspId() string { + + return *obj.obj.LspId + +} + +// LSP ID in the format, e.g. '640000000001-00-00'. LSP ID consists of the System ID of a neighbor, the Pseudonode ID, and the LSP number. The last two bytes represent Pseudonode ID and LSP number respectively. A pseudonode is a logical representation of the LAN which is generated by a Designated Intermediate System (DIS) on a LAN segment. If one LSP exceeds the maximum LSP size then it is sent in another LSP with the LSP number incremented by one. A router's learned LSP gets refreshed by 'remaining_lifetime'. Then the sequence number is incremented by 1. +// SetLspId sets the string value in the IsisLspState object +func (obj *isisLspState) SetLspId(value string) IsisLspState { + + obj.obj.LspId = &value + return obj +} + +type IsisLspStatePduTypeEnum string + +// Enum of PduType on IsisLspState +var IsisLspStatePduType = struct { + LEVEL_1 IsisLspStatePduTypeEnum + LEVEL_2 IsisLspStatePduTypeEnum +}{ + LEVEL_1: IsisLspStatePduTypeEnum("level_1"), + LEVEL_2: IsisLspStatePduTypeEnum("level_2"), +} + +func (obj *isisLspState) PduType() IsisLspStatePduTypeEnum { + return IsisLspStatePduTypeEnum(obj.obj.PduType.Enum().String()) +} + +// Link State PDU type. +// PduType returns a string +func (obj *isisLspState) HasPduType() bool { + return obj.obj.PduType != nil +} + +func (obj *isisLspState) SetPduType(value IsisLspStatePduTypeEnum) IsisLspState { + intValue, ok := otg.IsisLspState_PduType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on IsisLspStatePduTypeEnum", string(value))) + return obj + } + enumValue := otg.IsisLspState_PduType_Enum(intValue) + obj.obj.PduType = &enumValue + + return obj +} + +// Remaining lifetime in seconds before LSP expires. +// RemainingLifetime returns a uint32 +func (obj *isisLspState) RemainingLifetime() uint32 { + + return *obj.obj.RemainingLifetime + +} + +// Remaining lifetime in seconds before LSP expires. +// RemainingLifetime returns a uint32 +func (obj *isisLspState) HasRemainingLifetime() bool { + return obj.obj.RemainingLifetime != nil +} + +// Remaining lifetime in seconds before LSP expires. +// SetRemainingLifetime sets the uint32 value in the IsisLspState object +func (obj *isisLspState) SetRemainingLifetime(value uint32) IsisLspState { + + obj.obj.RemainingLifetime = &value + return obj +} + +// Sequence number of the LSP. +// SequenceNumber returns a uint64 +func (obj *isisLspState) SequenceNumber() uint64 { + + return *obj.obj.SequenceNumber + +} + +// Sequence number of the LSP. +// SequenceNumber returns a uint64 +func (obj *isisLspState) HasSequenceNumber() bool { + return obj.obj.SequenceNumber != nil +} + +// Sequence number of the LSP. +// SetSequenceNumber sets the uint64 value in the IsisLspState object +func (obj *isisLspState) SetSequenceNumber(value uint64) IsisLspState { + + obj.obj.SequenceNumber = &value + return obj +} + +// Total length of the LSP. +// PduLength returns a uint32 +func (obj *isisLspState) PduLength() uint32 { + + return *obj.obj.PduLength + +} + +// Total length of the LSP. +// PduLength returns a uint32 +func (obj *isisLspState) HasPduLength() bool { + return obj.obj.PduLength != nil +} + +// Total length of the LSP. +// SetPduLength sets the uint32 value in the IsisLspState object +func (obj *isisLspState) SetPduLength(value uint32) IsisLspState { + + obj.obj.PduLength = &value + return obj +} + +// LSP Type-Block flags. +// Flags returns a IsisLspFlags +func (obj *isisLspState) Flags() IsisLspFlags { + if obj.obj.Flags == nil { + obj.obj.Flags = NewIsisLspFlags().msg() + } + if obj.flagsHolder == nil { + obj.flagsHolder = &isisLspFlags{obj: obj.obj.Flags} + } + return obj.flagsHolder +} + +// LSP Type-Block flags. +// Flags returns a IsisLspFlags +func (obj *isisLspState) HasFlags() bool { + return obj.obj.Flags != nil +} + +// LSP Type-Block flags. +// SetFlags sets the IsisLspFlags value in the IsisLspState object +func (obj *isisLspState) SetFlags(value IsisLspFlags) IsisLspState { + + obj.flagsHolder = nil + obj.obj.Flags = value.msg() + + return obj +} + +// IS Type - bits 1 and 2 indicate the type of Intermediate System. +// 1 - ( i.e. bit 1 set) Level 1 Intermediate system. +// 2 - Unused value. +// 3 - (i.e. bits 1 and 2 set) Level 2 Intermediate system. +// IsType returns a uint32 +func (obj *isisLspState) IsType() uint32 { + + return *obj.obj.IsType + +} + +// IS Type - bits 1 and 2 indicate the type of Intermediate System. +// 1 - ( i.e. bit 1 set) Level 1 Intermediate system. +// 2 - Unused value. +// 3 - (i.e. bits 1 and 2 set) Level 2 Intermediate system. +// IsType returns a uint32 +func (obj *isisLspState) HasIsType() bool { + return obj.obj.IsType != nil +} + +// IS Type - bits 1 and 2 indicate the type of Intermediate System. +// 1 - ( i.e. bit 1 set) Level 1 Intermediate system. +// 2 - Unused value. +// 3 - (i.e. bits 1 and 2 set) Level 2 Intermediate system. +// SetIsType sets the uint32 value in the IsisLspState object +func (obj *isisLspState) SetIsType(value uint32) IsisLspState { + + obj.obj.IsType = &value + return obj +} + +// It refers to Link State PDU State TLVs container. +// Tlvs returns a IsisLspTlvs +func (obj *isisLspState) Tlvs() IsisLspTlvs { + if obj.obj.Tlvs == nil { + obj.obj.Tlvs = NewIsisLspTlvs().msg() + } + if obj.tlvsHolder == nil { + obj.tlvsHolder = &isisLspTlvs{obj: obj.obj.Tlvs} + } + return obj.tlvsHolder +} + +// It refers to Link State PDU State TLVs container. +// Tlvs returns a IsisLspTlvs +func (obj *isisLspState) HasTlvs() bool { + return obj.obj.Tlvs != nil +} + +// It refers to Link State PDU State TLVs container. +// SetTlvs sets the IsisLspTlvs value in the IsisLspState object +func (obj *isisLspState) SetTlvs(value IsisLspTlvs) IsisLspState { + + obj.tlvsHolder = nil + obj.obj.Tlvs = value.msg() + + return obj +} + +func (obj *isisLspState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // LspId is required + if obj.obj.LspId == nil { + vObj.validationErrors = append(vObj.validationErrors, "LspId is required field on interface IsisLspState") + } + + if obj.obj.PduLength != nil { + + if *obj.obj.PduLength > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= IsisLspState.PduLength <= 65535 but Got %d", *obj.obj.PduLength)) + } + + } + + if obj.obj.Flags != nil { + + obj.Flags().validateObj(vObj, set_default) + } + + if obj.obj.IsType != nil { + + if *obj.obj.IsType > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= IsisLspState.IsType <= 3 but Got %d", *obj.obj.IsType)) + } + + } + + if obj.obj.Tlvs != nil { + + obj.Tlvs().validateObj(vObj, set_default) + } + +} + +func (obj *isisLspState) setDefault() { + +} diff --git a/gosnappi/isis_lsp_tlvs.go b/gosnappi/isis_lsp_tlvs.go new file mode 100644 index 00000000..a94999cd --- /dev/null +++ b/gosnappi/isis_lsp_tlvs.go @@ -0,0 +1,1020 @@ +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" +) + +// ***** IsisLspTlvs ***** +type isisLspTlvs struct { + validation + obj *otg.IsisLspTlvs + marshaller marshalIsisLspTlvs + unMarshaller unMarshalIsisLspTlvs + hostnameTlvsHolder IsisLspTlvsIsisLspHostnameIter + isReachabilityTlvsHolder IsisLspTlvsIsisLspIsReachabilityTlvIter + extendedIsReachabilityTlvsHolder IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter + ipv4InternalReachabilityTlvsHolder IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter + ipv4ExternalReachabilityTlvsHolder IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter + extendedIpv4ReachabilityTlvsHolder IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter + ipv6ReachabilityTlvsHolder IsisLspTlvsIsisLspIpv6ReachabilityTlvIter +} + +func NewIsisLspTlvs() IsisLspTlvs { + obj := isisLspTlvs{obj: &otg.IsisLspTlvs{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspTlvs) msg() *otg.IsisLspTlvs { + return obj.obj +} + +func (obj *isisLspTlvs) setMsg(msg *otg.IsisLspTlvs) IsisLspTlvs { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspTlvs struct { + obj *isisLspTlvs +} + +type marshalIsisLspTlvs interface { + // ToProto marshals IsisLspTlvs to protobuf object *otg.IsisLspTlvs + ToProto() (*otg.IsisLspTlvs, error) + // ToPbText marshals IsisLspTlvs to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspTlvs to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspTlvs to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspTlvs struct { + obj *isisLspTlvs +} + +type unMarshalIsisLspTlvs interface { + // FromProto unmarshals IsisLspTlvs from protobuf object *otg.IsisLspTlvs + FromProto(msg *otg.IsisLspTlvs) (IsisLspTlvs, error) + // FromPbText unmarshals IsisLspTlvs from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspTlvs from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspTlvs from JSON text + FromJson(value string) error +} + +func (obj *isisLspTlvs) Marshal() marshalIsisLspTlvs { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspTlvs{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspTlvs) Unmarshal() unMarshalIsisLspTlvs { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspTlvs{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspTlvs) ToProto() (*otg.IsisLspTlvs, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspTlvs) FromProto(msg *otg.IsisLspTlvs) (IsisLspTlvs, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspTlvs) 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 *unMarshalisisLspTlvs) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisLspTlvs) 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 *unMarshalisisLspTlvs) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisLspTlvs) 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 *unMarshalisisLspTlvs) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisLspTlvs) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspTlvs) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspTlvs) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspTlvs) Clone() (IsisLspTlvs, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspTlvs() + 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 +} + +func (obj *isisLspTlvs) setNil() { + obj.hostnameTlvsHolder = nil + obj.isReachabilityTlvsHolder = nil + obj.extendedIsReachabilityTlvsHolder = nil + obj.ipv4InternalReachabilityTlvsHolder = nil + obj.ipv4ExternalReachabilityTlvsHolder = nil + obj.extendedIpv4ReachabilityTlvsHolder = nil + obj.ipv6ReachabilityTlvsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisLspTlvs is this contains the list of TLVs present in one LSP. +type IsisLspTlvs interface { + Validation + // msg marshals IsisLspTlvs to protobuf object *otg.IsisLspTlvs + // and doesn't set defaults + msg() *otg.IsisLspTlvs + // setMsg unmarshals IsisLspTlvs from protobuf object *otg.IsisLspTlvs + // and doesn't set defaults + setMsg(*otg.IsisLspTlvs) IsisLspTlvs + // provides marshal interface + Marshal() marshalIsisLspTlvs + // provides unmarshal interface + Unmarshal() unMarshalIsisLspTlvs + // validate validates IsisLspTlvs + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspTlvs, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // HostnameTlvs returns IsisLspTlvsIsisLspHostnameIterIter, set in IsisLspTlvs + HostnameTlvs() IsisLspTlvsIsisLspHostnameIter + // IsReachabilityTlvs returns IsisLspTlvsIsisLspIsReachabilityTlvIterIter, set in IsisLspTlvs + IsReachabilityTlvs() IsisLspTlvsIsisLspIsReachabilityTlvIter + // ExtendedIsReachabilityTlvs returns IsisLspTlvsIsisLspExtendedIsReachabilityTlvIterIter, set in IsisLspTlvs + ExtendedIsReachabilityTlvs() IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter + // Ipv4InternalReachabilityTlvs returns IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIterIter, set in IsisLspTlvs + Ipv4InternalReachabilityTlvs() IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter + // Ipv4ExternalReachabilityTlvs returns IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIterIter, set in IsisLspTlvs + Ipv4ExternalReachabilityTlvs() IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter + // ExtendedIpv4ReachabilityTlvs returns IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIterIter, set in IsisLspTlvs + ExtendedIpv4ReachabilityTlvs() IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter + // Ipv6ReachabilityTlvs returns IsisLspTlvsIsisLspIpv6ReachabilityTlvIterIter, set in IsisLspTlvs + Ipv6ReachabilityTlvs() IsisLspTlvsIsisLspIpv6ReachabilityTlvIter + setNil() +} + +// Array of Hostname TLVs ( type 137) present in this LSP. +// HostnameTlvs returns a []IsisLspHostname +func (obj *isisLspTlvs) HostnameTlvs() IsisLspTlvsIsisLspHostnameIter { + if len(obj.obj.HostnameTlvs) == 0 { + obj.obj.HostnameTlvs = []*otg.IsisLspHostname{} + } + if obj.hostnameTlvsHolder == nil { + obj.hostnameTlvsHolder = newIsisLspTlvsIsisLspHostnameIter(&obj.obj.HostnameTlvs).setMsg(obj) + } + return obj.hostnameTlvsHolder +} + +type isisLspTlvsIsisLspHostnameIter struct { + obj *isisLspTlvs + isisLspHostnameSlice []IsisLspHostname + fieldPtr *[]*otg.IsisLspHostname +} + +func newIsisLspTlvsIsisLspHostnameIter(ptr *[]*otg.IsisLspHostname) IsisLspTlvsIsisLspHostnameIter { + return &isisLspTlvsIsisLspHostnameIter{fieldPtr: ptr} +} + +type IsisLspTlvsIsisLspHostnameIter interface { + setMsg(*isisLspTlvs) IsisLspTlvsIsisLspHostnameIter + Items() []IsisLspHostname + Add() IsisLspHostname + Append(items ...IsisLspHostname) IsisLspTlvsIsisLspHostnameIter + Set(index int, newObj IsisLspHostname) IsisLspTlvsIsisLspHostnameIter + Clear() IsisLspTlvsIsisLspHostnameIter + clearHolderSlice() IsisLspTlvsIsisLspHostnameIter + appendHolderSlice(item IsisLspHostname) IsisLspTlvsIsisLspHostnameIter +} + +func (obj *isisLspTlvsIsisLspHostnameIter) setMsg(msg *isisLspTlvs) IsisLspTlvsIsisLspHostnameIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspHostname{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisLspTlvsIsisLspHostnameIter) Items() []IsisLspHostname { + return obj.isisLspHostnameSlice +} + +func (obj *isisLspTlvsIsisLspHostnameIter) Add() IsisLspHostname { + newObj := &otg.IsisLspHostname{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspHostname{obj: newObj} + newLibObj.setDefault() + obj.isisLspHostnameSlice = append(obj.isisLspHostnameSlice, newLibObj) + return newLibObj +} + +func (obj *isisLspTlvsIsisLspHostnameIter) Append(items ...IsisLspHostname) IsisLspTlvsIsisLspHostnameIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspHostnameSlice = append(obj.isisLspHostnameSlice, item) + } + return obj +} + +func (obj *isisLspTlvsIsisLspHostnameIter) Set(index int, newObj IsisLspHostname) IsisLspTlvsIsisLspHostnameIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspHostnameSlice[index] = newObj + return obj +} +func (obj *isisLspTlvsIsisLspHostnameIter) Clear() IsisLspTlvsIsisLspHostnameIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspHostname{} + obj.isisLspHostnameSlice = []IsisLspHostname{} + } + return obj +} +func (obj *isisLspTlvsIsisLspHostnameIter) clearHolderSlice() IsisLspTlvsIsisLspHostnameIter { + if len(obj.isisLspHostnameSlice) > 0 { + obj.isisLspHostnameSlice = []IsisLspHostname{} + } + return obj +} +func (obj *isisLspTlvsIsisLspHostnameIter) appendHolderSlice(item IsisLspHostname) IsisLspTlvsIsisLspHostnameIter { + obj.isisLspHostnameSlice = append(obj.isisLspHostnameSlice, item) + return obj +} + +// Array of IS-Reachability TLVs (type 2) present in this LSP. +// IsReachabilityTlvs returns a []IsisLspIsReachabilityTlv +func (obj *isisLspTlvs) IsReachabilityTlvs() IsisLspTlvsIsisLspIsReachabilityTlvIter { + if len(obj.obj.IsReachabilityTlvs) == 0 { + obj.obj.IsReachabilityTlvs = []*otg.IsisLspIsReachabilityTlv{} + } + if obj.isReachabilityTlvsHolder == nil { + obj.isReachabilityTlvsHolder = newIsisLspTlvsIsisLspIsReachabilityTlvIter(&obj.obj.IsReachabilityTlvs).setMsg(obj) + } + return obj.isReachabilityTlvsHolder +} + +type isisLspTlvsIsisLspIsReachabilityTlvIter struct { + obj *isisLspTlvs + isisLspIsReachabilityTlvSlice []IsisLspIsReachabilityTlv + fieldPtr *[]*otg.IsisLspIsReachabilityTlv +} + +func newIsisLspTlvsIsisLspIsReachabilityTlvIter(ptr *[]*otg.IsisLspIsReachabilityTlv) IsisLspTlvsIsisLspIsReachabilityTlvIter { + return &isisLspTlvsIsisLspIsReachabilityTlvIter{fieldPtr: ptr} +} + +type IsisLspTlvsIsisLspIsReachabilityTlvIter interface { + setMsg(*isisLspTlvs) IsisLspTlvsIsisLspIsReachabilityTlvIter + Items() []IsisLspIsReachabilityTlv + Add() IsisLspIsReachabilityTlv + Append(items ...IsisLspIsReachabilityTlv) IsisLspTlvsIsisLspIsReachabilityTlvIter + Set(index int, newObj IsisLspIsReachabilityTlv) IsisLspTlvsIsisLspIsReachabilityTlvIter + Clear() IsisLspTlvsIsisLspIsReachabilityTlvIter + clearHolderSlice() IsisLspTlvsIsisLspIsReachabilityTlvIter + appendHolderSlice(item IsisLspIsReachabilityTlv) IsisLspTlvsIsisLspIsReachabilityTlvIter +} + +func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) setMsg(msg *isisLspTlvs) IsisLspTlvsIsisLspIsReachabilityTlvIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspIsReachabilityTlv{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) Items() []IsisLspIsReachabilityTlv { + return obj.isisLspIsReachabilityTlvSlice +} + +func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) Add() IsisLspIsReachabilityTlv { + newObj := &otg.IsisLspIsReachabilityTlv{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspIsReachabilityTlv{obj: newObj} + newLibObj.setDefault() + obj.isisLspIsReachabilityTlvSlice = append(obj.isisLspIsReachabilityTlvSlice, newLibObj) + return newLibObj +} + +func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) Append(items ...IsisLspIsReachabilityTlv) IsisLspTlvsIsisLspIsReachabilityTlvIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspIsReachabilityTlvSlice = append(obj.isisLspIsReachabilityTlvSlice, item) + } + return obj +} + +func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) Set(index int, newObj IsisLspIsReachabilityTlv) IsisLspTlvsIsisLspIsReachabilityTlvIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspIsReachabilityTlvSlice[index] = newObj + return obj +} +func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) Clear() IsisLspTlvsIsisLspIsReachabilityTlvIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspIsReachabilityTlv{} + obj.isisLspIsReachabilityTlvSlice = []IsisLspIsReachabilityTlv{} + } + return obj +} +func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) clearHolderSlice() IsisLspTlvsIsisLspIsReachabilityTlvIter { + if len(obj.isisLspIsReachabilityTlvSlice) > 0 { + obj.isisLspIsReachabilityTlvSlice = []IsisLspIsReachabilityTlv{} + } + return obj +} +func (obj *isisLspTlvsIsisLspIsReachabilityTlvIter) appendHolderSlice(item IsisLspIsReachabilityTlv) IsisLspTlvsIsisLspIsReachabilityTlvIter { + obj.isisLspIsReachabilityTlvSlice = append(obj.isisLspIsReachabilityTlvSlice, item) + return obj +} + +// Array of Extended IS-Reachability TLVs (type 22) present in this LSP. +// ExtendedIsReachabilityTlvs returns a []IsisLspExtendedIsReachabilityTlv +func (obj *isisLspTlvs) ExtendedIsReachabilityTlvs() IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { + if len(obj.obj.ExtendedIsReachabilityTlvs) == 0 { + obj.obj.ExtendedIsReachabilityTlvs = []*otg.IsisLspExtendedIsReachabilityTlv{} + } + if obj.extendedIsReachabilityTlvsHolder == nil { + obj.extendedIsReachabilityTlvsHolder = newIsisLspTlvsIsisLspExtendedIsReachabilityTlvIter(&obj.obj.ExtendedIsReachabilityTlvs).setMsg(obj) + } + return obj.extendedIsReachabilityTlvsHolder +} + +type isisLspTlvsIsisLspExtendedIsReachabilityTlvIter struct { + obj *isisLspTlvs + isisLspExtendedIsReachabilityTlvSlice []IsisLspExtendedIsReachabilityTlv + fieldPtr *[]*otg.IsisLspExtendedIsReachabilityTlv +} + +func newIsisLspTlvsIsisLspExtendedIsReachabilityTlvIter(ptr *[]*otg.IsisLspExtendedIsReachabilityTlv) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { + return &isisLspTlvsIsisLspExtendedIsReachabilityTlvIter{fieldPtr: ptr} +} + +type IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter interface { + setMsg(*isisLspTlvs) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter + Items() []IsisLspExtendedIsReachabilityTlv + Add() IsisLspExtendedIsReachabilityTlv + Append(items ...IsisLspExtendedIsReachabilityTlv) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter + Set(index int, newObj IsisLspExtendedIsReachabilityTlv) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter + Clear() IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter + clearHolderSlice() IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter + appendHolderSlice(item IsisLspExtendedIsReachabilityTlv) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter +} + +func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) setMsg(msg *isisLspTlvs) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspExtendedIsReachabilityTlv{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) Items() []IsisLspExtendedIsReachabilityTlv { + return obj.isisLspExtendedIsReachabilityTlvSlice +} + +func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) Add() IsisLspExtendedIsReachabilityTlv { + newObj := &otg.IsisLspExtendedIsReachabilityTlv{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspExtendedIsReachabilityTlv{obj: newObj} + newLibObj.setDefault() + obj.isisLspExtendedIsReachabilityTlvSlice = append(obj.isisLspExtendedIsReachabilityTlvSlice, newLibObj) + return newLibObj +} + +func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) Append(items ...IsisLspExtendedIsReachabilityTlv) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspExtendedIsReachabilityTlvSlice = append(obj.isisLspExtendedIsReachabilityTlvSlice, item) + } + return obj +} + +func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) Set(index int, newObj IsisLspExtendedIsReachabilityTlv) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspExtendedIsReachabilityTlvSlice[index] = newObj + return obj +} +func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) Clear() IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspExtendedIsReachabilityTlv{} + obj.isisLspExtendedIsReachabilityTlvSlice = []IsisLspExtendedIsReachabilityTlv{} + } + return obj +} +func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) clearHolderSlice() IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { + if len(obj.isisLspExtendedIsReachabilityTlvSlice) > 0 { + obj.isisLspExtendedIsReachabilityTlvSlice = []IsisLspExtendedIsReachabilityTlv{} + } + return obj +} +func (obj *isisLspTlvsIsisLspExtendedIsReachabilityTlvIter) appendHolderSlice(item IsisLspExtendedIsReachabilityTlv) IsisLspTlvsIsisLspExtendedIsReachabilityTlvIter { + obj.isisLspExtendedIsReachabilityTlvSlice = append(obj.isisLspExtendedIsReachabilityTlvSlice, item) + return obj +} + +// Array of IPv4 Internal Reachability TLVs (type 128) present in this LSP. +// Ipv4InternalReachabilityTlvs returns a []IsisLspIpv4InternalReachabilityTlv +func (obj *isisLspTlvs) Ipv4InternalReachabilityTlvs() IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { + if len(obj.obj.Ipv4InternalReachabilityTlvs) == 0 { + obj.obj.Ipv4InternalReachabilityTlvs = []*otg.IsisLspIpv4InternalReachabilityTlv{} + } + if obj.ipv4InternalReachabilityTlvsHolder == nil { + obj.ipv4InternalReachabilityTlvsHolder = newIsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter(&obj.obj.Ipv4InternalReachabilityTlvs).setMsg(obj) + } + return obj.ipv4InternalReachabilityTlvsHolder +} + +type isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter struct { + obj *isisLspTlvs + isisLspIpv4InternalReachabilityTlvSlice []IsisLspIpv4InternalReachabilityTlv + fieldPtr *[]*otg.IsisLspIpv4InternalReachabilityTlv +} + +func newIsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter(ptr *[]*otg.IsisLspIpv4InternalReachabilityTlv) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { + return &isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter{fieldPtr: ptr} +} + +type IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter interface { + setMsg(*isisLspTlvs) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter + Items() []IsisLspIpv4InternalReachabilityTlv + Add() IsisLspIpv4InternalReachabilityTlv + Append(items ...IsisLspIpv4InternalReachabilityTlv) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter + Set(index int, newObj IsisLspIpv4InternalReachabilityTlv) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter + Clear() IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter + clearHolderSlice() IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter + appendHolderSlice(item IsisLspIpv4InternalReachabilityTlv) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter +} + +func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) setMsg(msg *isisLspTlvs) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspIpv4InternalReachabilityTlv{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) Items() []IsisLspIpv4InternalReachabilityTlv { + return obj.isisLspIpv4InternalReachabilityTlvSlice +} + +func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) Add() IsisLspIpv4InternalReachabilityTlv { + newObj := &otg.IsisLspIpv4InternalReachabilityTlv{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspIpv4InternalReachabilityTlv{obj: newObj} + newLibObj.setDefault() + obj.isisLspIpv4InternalReachabilityTlvSlice = append(obj.isisLspIpv4InternalReachabilityTlvSlice, newLibObj) + return newLibObj +} + +func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) Append(items ...IsisLspIpv4InternalReachabilityTlv) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspIpv4InternalReachabilityTlvSlice = append(obj.isisLspIpv4InternalReachabilityTlvSlice, item) + } + return obj +} + +func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) Set(index int, newObj IsisLspIpv4InternalReachabilityTlv) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspIpv4InternalReachabilityTlvSlice[index] = newObj + return obj +} +func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) Clear() IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspIpv4InternalReachabilityTlv{} + obj.isisLspIpv4InternalReachabilityTlvSlice = []IsisLspIpv4InternalReachabilityTlv{} + } + return obj +} +func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) clearHolderSlice() IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { + if len(obj.isisLspIpv4InternalReachabilityTlvSlice) > 0 { + obj.isisLspIpv4InternalReachabilityTlvSlice = []IsisLspIpv4InternalReachabilityTlv{} + } + return obj +} +func (obj *isisLspTlvsIsisLspIpv4InternalReachabilityTlvIter) appendHolderSlice(item IsisLspIpv4InternalReachabilityTlv) IsisLspTlvsIsisLspIpv4InternalReachabilityTlvIter { + obj.isisLspIpv4InternalReachabilityTlvSlice = append(obj.isisLspIpv4InternalReachabilityTlvSlice, item) + return obj +} + +// Array of IPv4 External Reachability TLVs (type 130) present in this LSP. +// Ipv4ExternalReachabilityTlvs returns a []IsisLspIpv4ExternalReachabilityTlv +func (obj *isisLspTlvs) Ipv4ExternalReachabilityTlvs() IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { + if len(obj.obj.Ipv4ExternalReachabilityTlvs) == 0 { + obj.obj.Ipv4ExternalReachabilityTlvs = []*otg.IsisLspIpv4ExternalReachabilityTlv{} + } + if obj.ipv4ExternalReachabilityTlvsHolder == nil { + obj.ipv4ExternalReachabilityTlvsHolder = newIsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter(&obj.obj.Ipv4ExternalReachabilityTlvs).setMsg(obj) + } + return obj.ipv4ExternalReachabilityTlvsHolder +} + +type isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter struct { + obj *isisLspTlvs + isisLspIpv4ExternalReachabilityTlvSlice []IsisLspIpv4ExternalReachabilityTlv + fieldPtr *[]*otg.IsisLspIpv4ExternalReachabilityTlv +} + +func newIsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter(ptr *[]*otg.IsisLspIpv4ExternalReachabilityTlv) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { + return &isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter{fieldPtr: ptr} +} + +type IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter interface { + setMsg(*isisLspTlvs) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter + Items() []IsisLspIpv4ExternalReachabilityTlv + Add() IsisLspIpv4ExternalReachabilityTlv + Append(items ...IsisLspIpv4ExternalReachabilityTlv) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter + Set(index int, newObj IsisLspIpv4ExternalReachabilityTlv) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter + Clear() IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter + clearHolderSlice() IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter + appendHolderSlice(item IsisLspIpv4ExternalReachabilityTlv) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter +} + +func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) setMsg(msg *isisLspTlvs) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspIpv4ExternalReachabilityTlv{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) Items() []IsisLspIpv4ExternalReachabilityTlv { + return obj.isisLspIpv4ExternalReachabilityTlvSlice +} + +func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) Add() IsisLspIpv4ExternalReachabilityTlv { + newObj := &otg.IsisLspIpv4ExternalReachabilityTlv{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspIpv4ExternalReachabilityTlv{obj: newObj} + newLibObj.setDefault() + obj.isisLspIpv4ExternalReachabilityTlvSlice = append(obj.isisLspIpv4ExternalReachabilityTlvSlice, newLibObj) + return newLibObj +} + +func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) Append(items ...IsisLspIpv4ExternalReachabilityTlv) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspIpv4ExternalReachabilityTlvSlice = append(obj.isisLspIpv4ExternalReachabilityTlvSlice, item) + } + return obj +} + +func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) Set(index int, newObj IsisLspIpv4ExternalReachabilityTlv) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspIpv4ExternalReachabilityTlvSlice[index] = newObj + return obj +} +func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) Clear() IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspIpv4ExternalReachabilityTlv{} + obj.isisLspIpv4ExternalReachabilityTlvSlice = []IsisLspIpv4ExternalReachabilityTlv{} + } + return obj +} +func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) clearHolderSlice() IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { + if len(obj.isisLspIpv4ExternalReachabilityTlvSlice) > 0 { + obj.isisLspIpv4ExternalReachabilityTlvSlice = []IsisLspIpv4ExternalReachabilityTlv{} + } + return obj +} +func (obj *isisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter) appendHolderSlice(item IsisLspIpv4ExternalReachabilityTlv) IsisLspTlvsIsisLspIpv4ExternalReachabilityTlvIter { + obj.isisLspIpv4ExternalReachabilityTlvSlice = append(obj.isisLspIpv4ExternalReachabilityTlvSlice, item) + return obj +} + +// Array of IPv4 Extended Reachability TLVs (type 135) present in this LSP. +// ExtendedIpv4ReachabilityTlvs returns a []IsisLspExtendedIpv4ReachabilityTlv +func (obj *isisLspTlvs) ExtendedIpv4ReachabilityTlvs() IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { + if len(obj.obj.ExtendedIpv4ReachabilityTlvs) == 0 { + obj.obj.ExtendedIpv4ReachabilityTlvs = []*otg.IsisLspExtendedIpv4ReachabilityTlv{} + } + if obj.extendedIpv4ReachabilityTlvsHolder == nil { + obj.extendedIpv4ReachabilityTlvsHolder = newIsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter(&obj.obj.ExtendedIpv4ReachabilityTlvs).setMsg(obj) + } + return obj.extendedIpv4ReachabilityTlvsHolder +} + +type isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter struct { + obj *isisLspTlvs + isisLspExtendedIpv4ReachabilityTlvSlice []IsisLspExtendedIpv4ReachabilityTlv + fieldPtr *[]*otg.IsisLspExtendedIpv4ReachabilityTlv +} + +func newIsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter(ptr *[]*otg.IsisLspExtendedIpv4ReachabilityTlv) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { + return &isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter{fieldPtr: ptr} +} + +type IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter interface { + setMsg(*isisLspTlvs) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter + Items() []IsisLspExtendedIpv4ReachabilityTlv + Add() IsisLspExtendedIpv4ReachabilityTlv + Append(items ...IsisLspExtendedIpv4ReachabilityTlv) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter + Set(index int, newObj IsisLspExtendedIpv4ReachabilityTlv) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter + Clear() IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter + clearHolderSlice() IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter + appendHolderSlice(item IsisLspExtendedIpv4ReachabilityTlv) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter +} + +func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) setMsg(msg *isisLspTlvs) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspExtendedIpv4ReachabilityTlv{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) Items() []IsisLspExtendedIpv4ReachabilityTlv { + return obj.isisLspExtendedIpv4ReachabilityTlvSlice +} + +func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) Add() IsisLspExtendedIpv4ReachabilityTlv { + newObj := &otg.IsisLspExtendedIpv4ReachabilityTlv{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspExtendedIpv4ReachabilityTlv{obj: newObj} + newLibObj.setDefault() + obj.isisLspExtendedIpv4ReachabilityTlvSlice = append(obj.isisLspExtendedIpv4ReachabilityTlvSlice, newLibObj) + return newLibObj +} + +func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) Append(items ...IsisLspExtendedIpv4ReachabilityTlv) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspExtendedIpv4ReachabilityTlvSlice = append(obj.isisLspExtendedIpv4ReachabilityTlvSlice, item) + } + return obj +} + +func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) Set(index int, newObj IsisLspExtendedIpv4ReachabilityTlv) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspExtendedIpv4ReachabilityTlvSlice[index] = newObj + return obj +} +func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) Clear() IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspExtendedIpv4ReachabilityTlv{} + obj.isisLspExtendedIpv4ReachabilityTlvSlice = []IsisLspExtendedIpv4ReachabilityTlv{} + } + return obj +} +func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) clearHolderSlice() IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { + if len(obj.isisLspExtendedIpv4ReachabilityTlvSlice) > 0 { + obj.isisLspExtendedIpv4ReachabilityTlvSlice = []IsisLspExtendedIpv4ReachabilityTlv{} + } + return obj +} +func (obj *isisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter) appendHolderSlice(item IsisLspExtendedIpv4ReachabilityTlv) IsisLspTlvsIsisLspExtendedIpv4ReachabilityTlvIter { + obj.isisLspExtendedIpv4ReachabilityTlvSlice = append(obj.isisLspExtendedIpv4ReachabilityTlvSlice, item) + return obj +} + +// Array of IPv6 Reachability TLVs (type 236) present in this LSP. +// Ipv6ReachabilityTlvs returns a []IsisLspIpv6ReachabilityTlv +func (obj *isisLspTlvs) Ipv6ReachabilityTlvs() IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { + if len(obj.obj.Ipv6ReachabilityTlvs) == 0 { + obj.obj.Ipv6ReachabilityTlvs = []*otg.IsisLspIpv6ReachabilityTlv{} + } + if obj.ipv6ReachabilityTlvsHolder == nil { + obj.ipv6ReachabilityTlvsHolder = newIsisLspTlvsIsisLspIpv6ReachabilityTlvIter(&obj.obj.Ipv6ReachabilityTlvs).setMsg(obj) + } + return obj.ipv6ReachabilityTlvsHolder +} + +type isisLspTlvsIsisLspIpv6ReachabilityTlvIter struct { + obj *isisLspTlvs + isisLspIpv6ReachabilityTlvSlice []IsisLspIpv6ReachabilityTlv + fieldPtr *[]*otg.IsisLspIpv6ReachabilityTlv +} + +func newIsisLspTlvsIsisLspIpv6ReachabilityTlvIter(ptr *[]*otg.IsisLspIpv6ReachabilityTlv) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { + return &isisLspTlvsIsisLspIpv6ReachabilityTlvIter{fieldPtr: ptr} +} + +type IsisLspTlvsIsisLspIpv6ReachabilityTlvIter interface { + setMsg(*isisLspTlvs) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter + Items() []IsisLspIpv6ReachabilityTlv + Add() IsisLspIpv6ReachabilityTlv + Append(items ...IsisLspIpv6ReachabilityTlv) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter + Set(index int, newObj IsisLspIpv6ReachabilityTlv) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter + Clear() IsisLspTlvsIsisLspIpv6ReachabilityTlvIter + clearHolderSlice() IsisLspTlvsIsisLspIpv6ReachabilityTlvIter + appendHolderSlice(item IsisLspIpv6ReachabilityTlv) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter +} + +func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) setMsg(msg *isisLspTlvs) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspIpv6ReachabilityTlv{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) Items() []IsisLspIpv6ReachabilityTlv { + return obj.isisLspIpv6ReachabilityTlvSlice +} + +func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) Add() IsisLspIpv6ReachabilityTlv { + newObj := &otg.IsisLspIpv6ReachabilityTlv{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspIpv6ReachabilityTlv{obj: newObj} + newLibObj.setDefault() + obj.isisLspIpv6ReachabilityTlvSlice = append(obj.isisLspIpv6ReachabilityTlvSlice, newLibObj) + return newLibObj +} + +func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) Append(items ...IsisLspIpv6ReachabilityTlv) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspIpv6ReachabilityTlvSlice = append(obj.isisLspIpv6ReachabilityTlvSlice, item) + } + return obj +} + +func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) Set(index int, newObj IsisLspIpv6ReachabilityTlv) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspIpv6ReachabilityTlvSlice[index] = newObj + return obj +} +func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) Clear() IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspIpv6ReachabilityTlv{} + obj.isisLspIpv6ReachabilityTlvSlice = []IsisLspIpv6ReachabilityTlv{} + } + return obj +} +func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) clearHolderSlice() IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { + if len(obj.isisLspIpv6ReachabilityTlvSlice) > 0 { + obj.isisLspIpv6ReachabilityTlvSlice = []IsisLspIpv6ReachabilityTlv{} + } + return obj +} +func (obj *isisLspTlvsIsisLspIpv6ReachabilityTlvIter) appendHolderSlice(item IsisLspIpv6ReachabilityTlv) IsisLspTlvsIsisLspIpv6ReachabilityTlvIter { + obj.isisLspIpv6ReachabilityTlvSlice = append(obj.isisLspIpv6ReachabilityTlvSlice, item) + return obj +} + +func (obj *isisLspTlvs) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.HostnameTlvs) != 0 { + + if set_default { + obj.HostnameTlvs().clearHolderSlice() + for _, item := range obj.obj.HostnameTlvs { + obj.HostnameTlvs().appendHolderSlice(&isisLspHostname{obj: item}) + } + } + for _, item := range obj.HostnameTlvs().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.IsReachabilityTlvs) != 0 { + + if set_default { + obj.IsReachabilityTlvs().clearHolderSlice() + for _, item := range obj.obj.IsReachabilityTlvs { + obj.IsReachabilityTlvs().appendHolderSlice(&isisLspIsReachabilityTlv{obj: item}) + } + } + for _, item := range obj.IsReachabilityTlvs().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.ExtendedIsReachabilityTlvs) != 0 { + + if set_default { + obj.ExtendedIsReachabilityTlvs().clearHolderSlice() + for _, item := range obj.obj.ExtendedIsReachabilityTlvs { + obj.ExtendedIsReachabilityTlvs().appendHolderSlice(&isisLspExtendedIsReachabilityTlv{obj: item}) + } + } + for _, item := range obj.ExtendedIsReachabilityTlvs().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Ipv4InternalReachabilityTlvs) != 0 { + + if set_default { + obj.Ipv4InternalReachabilityTlvs().clearHolderSlice() + for _, item := range obj.obj.Ipv4InternalReachabilityTlvs { + obj.Ipv4InternalReachabilityTlvs().appendHolderSlice(&isisLspIpv4InternalReachabilityTlv{obj: item}) + } + } + for _, item := range obj.Ipv4InternalReachabilityTlvs().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Ipv4ExternalReachabilityTlvs) != 0 { + + if set_default { + obj.Ipv4ExternalReachabilityTlvs().clearHolderSlice() + for _, item := range obj.obj.Ipv4ExternalReachabilityTlvs { + obj.Ipv4ExternalReachabilityTlvs().appendHolderSlice(&isisLspIpv4ExternalReachabilityTlv{obj: item}) + } + } + for _, item := range obj.Ipv4ExternalReachabilityTlvs().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.ExtendedIpv4ReachabilityTlvs) != 0 { + + if set_default { + obj.ExtendedIpv4ReachabilityTlvs().clearHolderSlice() + for _, item := range obj.obj.ExtendedIpv4ReachabilityTlvs { + obj.ExtendedIpv4ReachabilityTlvs().appendHolderSlice(&isisLspExtendedIpv4ReachabilityTlv{obj: item}) + } + } + for _, item := range obj.ExtendedIpv4ReachabilityTlvs().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Ipv6ReachabilityTlvs) != 0 { + + if set_default { + obj.Ipv6ReachabilityTlvs().clearHolderSlice() + for _, item := range obj.obj.Ipv6ReachabilityTlvs { + obj.Ipv6ReachabilityTlvs().appendHolderSlice(&isisLspIpv6ReachabilityTlv{obj: item}) + } + } + for _, item := range obj.Ipv6ReachabilityTlvs().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *isisLspTlvs) setDefault() { + +} diff --git a/gosnappi/isis_lsp_v4_prefix.go b/gosnappi/isis_lsp_v4_prefix.go new file mode 100644 index 00000000..eb5e0b25 --- /dev/null +++ b/gosnappi/isis_lsp_v4_prefix.go @@ -0,0 +1,458 @@ +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" +) + +// ***** IsisLspV4Prefix ***** +type isisLspV4Prefix struct { + validation + obj *otg.IsisLspV4Prefix + marshaller marshalIsisLspV4Prefix + unMarshaller unMarshalIsisLspV4Prefix +} + +func NewIsisLspV4Prefix() IsisLspV4Prefix { + obj := isisLspV4Prefix{obj: &otg.IsisLspV4Prefix{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspV4Prefix) msg() *otg.IsisLspV4Prefix { + return obj.obj +} + +func (obj *isisLspV4Prefix) setMsg(msg *otg.IsisLspV4Prefix) IsisLspV4Prefix { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspV4Prefix struct { + obj *isisLspV4Prefix +} + +type marshalIsisLspV4Prefix interface { + // ToProto marshals IsisLspV4Prefix to protobuf object *otg.IsisLspV4Prefix + ToProto() (*otg.IsisLspV4Prefix, error) + // ToPbText marshals IsisLspV4Prefix to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspV4Prefix to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspV4Prefix to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspV4Prefix struct { + obj *isisLspV4Prefix +} + +type unMarshalIsisLspV4Prefix interface { + // FromProto unmarshals IsisLspV4Prefix from protobuf object *otg.IsisLspV4Prefix + FromProto(msg *otg.IsisLspV4Prefix) (IsisLspV4Prefix, error) + // FromPbText unmarshals IsisLspV4Prefix from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspV4Prefix from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspV4Prefix from JSON text + FromJson(value string) error +} + +func (obj *isisLspV4Prefix) Marshal() marshalIsisLspV4Prefix { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspV4Prefix{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspV4Prefix) Unmarshal() unMarshalIsisLspV4Prefix { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspV4Prefix{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspV4Prefix) ToProto() (*otg.IsisLspV4Prefix, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspV4Prefix) FromProto(msg *otg.IsisLspV4Prefix) (IsisLspV4Prefix, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspV4Prefix) 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 *unMarshalisisLspV4Prefix) 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 *marshalisisLspV4Prefix) 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 *unMarshalisisLspV4Prefix) 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 *marshalisisLspV4Prefix) 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 *unMarshalisisLspV4Prefix) 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 *isisLspV4Prefix) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspV4Prefix) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspV4Prefix) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspV4Prefix) Clone() (IsisLspV4Prefix, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspV4Prefix() + 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 +} + +// IsisLspV4Prefix is this group defines attributes of an IPv4 standard prefix. +type IsisLspV4Prefix interface { + Validation + // msg marshals IsisLspV4Prefix to protobuf object *otg.IsisLspV4Prefix + // and doesn't set defaults + msg() *otg.IsisLspV4Prefix + // setMsg unmarshals IsisLspV4Prefix from protobuf object *otg.IsisLspV4Prefix + // and doesn't set defaults + setMsg(*otg.IsisLspV4Prefix) IsisLspV4Prefix + // provides marshal interface + Marshal() marshalIsisLspV4Prefix + // provides unmarshal interface + Unmarshal() unMarshalIsisLspV4Prefix + // validate validates IsisLspV4Prefix + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspV4Prefix, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv4Address returns string, set in IsisLspV4Prefix. + Ipv4Address() string + // SetIpv4Address assigns string provided by user to IsisLspV4Prefix + SetIpv4Address(value string) IsisLspV4Prefix + // HasIpv4Address checks if Ipv4Address has been set in IsisLspV4Prefix + HasIpv4Address() bool + // PrefixLength returns uint32, set in IsisLspV4Prefix. + PrefixLength() uint32 + // SetPrefixLength assigns uint32 provided by user to IsisLspV4Prefix + SetPrefixLength(value uint32) IsisLspV4Prefix + // HasPrefixLength checks if PrefixLength has been set in IsisLspV4Prefix + HasPrefixLength() bool + // RedistributionType returns IsisLspV4PrefixRedistributionTypeEnum, set in IsisLspV4Prefix + RedistributionType() IsisLspV4PrefixRedistributionTypeEnum + // SetRedistributionType assigns IsisLspV4PrefixRedistributionTypeEnum provided by user to IsisLspV4Prefix + SetRedistributionType(value IsisLspV4PrefixRedistributionTypeEnum) IsisLspV4Prefix + // HasRedistributionType checks if RedistributionType has been set in IsisLspV4Prefix + HasRedistributionType() bool + // DefaultMetric returns uint32, set in IsisLspV4Prefix. + DefaultMetric() uint32 + // SetDefaultMetric assigns uint32 provided by user to IsisLspV4Prefix + SetDefaultMetric(value uint32) IsisLspV4Prefix + // HasDefaultMetric checks if DefaultMetric has been set in IsisLspV4Prefix + HasDefaultMetric() bool + // OriginType returns IsisLspV4PrefixOriginTypeEnum, set in IsisLspV4Prefix + OriginType() IsisLspV4PrefixOriginTypeEnum + // SetOriginType assigns IsisLspV4PrefixOriginTypeEnum provided by user to IsisLspV4Prefix + SetOriginType(value IsisLspV4PrefixOriginTypeEnum) IsisLspV4Prefix + // HasOriginType checks if OriginType has been set in IsisLspV4Prefix + HasOriginType() bool +} + +// An IPv4 unicast prefix reachable via the originator of this LSP. +// Ipv4Address returns a string +func (obj *isisLspV4Prefix) Ipv4Address() string { + + return *obj.obj.Ipv4Address + +} + +// An IPv4 unicast prefix reachable via the originator of this LSP. +// Ipv4Address returns a string +func (obj *isisLspV4Prefix) HasIpv4Address() bool { + return obj.obj.Ipv4Address != nil +} + +// An IPv4 unicast prefix reachable via the originator of this LSP. +// SetIpv4Address sets the string value in the IsisLspV4Prefix object +func (obj *isisLspV4Prefix) SetIpv4Address(value string) IsisLspV4Prefix { + + obj.obj.Ipv4Address = &value + return obj +} + +// The length of the IPv4 prefix. +// PrefixLength returns a uint32 +func (obj *isisLspV4Prefix) PrefixLength() uint32 { + + return *obj.obj.PrefixLength + +} + +// The length of the IPv4 prefix. +// PrefixLength returns a uint32 +func (obj *isisLspV4Prefix) HasPrefixLength() bool { + return obj.obj.PrefixLength != nil +} + +// The length of the IPv4 prefix. +// SetPrefixLength sets the uint32 value in the IsisLspV4Prefix object +func (obj *isisLspV4Prefix) SetPrefixLength(value uint32) IsisLspV4Prefix { + + obj.obj.PrefixLength = &value + return obj +} + +type IsisLspV4PrefixRedistributionTypeEnum string + +// Enum of RedistributionType on IsisLspV4Prefix +var IsisLspV4PrefixRedistributionType = struct { + UP IsisLspV4PrefixRedistributionTypeEnum + DOWN IsisLspV4PrefixRedistributionTypeEnum +}{ + UP: IsisLspV4PrefixRedistributionTypeEnum("up"), + DOWN: IsisLspV4PrefixRedistributionTypeEnum("down"), +} + +func (obj *isisLspV4Prefix) RedistributionType() IsisLspV4PrefixRedistributionTypeEnum { + return IsisLspV4PrefixRedistributionTypeEnum(obj.obj.RedistributionType.Enum().String()) +} + +// Up (0)-used when a prefix is initially advertised within the ISIS L3 hierarchy, +// and for all other prefixes in L1 and L2 LSPs. (default) +// Down (1)-used when an L1/L2 router advertises L2 prefixes in L1 LSPs. +// The prefixes are being advertised from a higher level (L2) down to a lower level (L1). +// RedistributionType returns a string +func (obj *isisLspV4Prefix) HasRedistributionType() bool { + return obj.obj.RedistributionType != nil +} + +func (obj *isisLspV4Prefix) SetRedistributionType(value IsisLspV4PrefixRedistributionTypeEnum) IsisLspV4Prefix { + intValue, ok := otg.IsisLspV4Prefix_RedistributionType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on IsisLspV4PrefixRedistributionTypeEnum", string(value))) + return obj + } + enumValue := otg.IsisLspV4Prefix_RedistributionType_Enum(intValue) + obj.obj.RedistributionType = &enumValue + + return obj +} + +// ISIS default metric value. +// DefaultMetric returns a uint32 +func (obj *isisLspV4Prefix) DefaultMetric() uint32 { + + return *obj.obj.DefaultMetric + +} + +// ISIS default metric value. +// DefaultMetric returns a uint32 +func (obj *isisLspV4Prefix) HasDefaultMetric() bool { + return obj.obj.DefaultMetric != nil +} + +// ISIS default metric value. +// SetDefaultMetric sets the uint32 value in the IsisLspV4Prefix object +func (obj *isisLspV4Prefix) SetDefaultMetric(value uint32) IsisLspV4Prefix { + + obj.obj.DefaultMetric = &value + return obj +} + +type IsisLspV4PrefixOriginTypeEnum string + +// Enum of OriginType on IsisLspV4Prefix +var IsisLspV4PrefixOriginType = struct { + INTERNAL IsisLspV4PrefixOriginTypeEnum + EXTERNAL IsisLspV4PrefixOriginTypeEnum +}{ + INTERNAL: IsisLspV4PrefixOriginTypeEnum("internal"), + EXTERNAL: IsisLspV4PrefixOriginTypeEnum("external"), +} + +func (obj *isisLspV4Prefix) OriginType() IsisLspV4PrefixOriginTypeEnum { + return IsisLspV4PrefixOriginTypeEnum(obj.obj.OriginType.Enum().String()) +} + +// The origin of the advertised route-internal or external to the ISIS area. Options include the following: +// Internal-for intra-area routes, through Level 1 LSPs. +// External-for inter-area routes redistributed within L1, through Level +// 1 LSPs. +// OriginType returns a string +func (obj *isisLspV4Prefix) HasOriginType() bool { + return obj.obj.OriginType != nil +} + +func (obj *isisLspV4Prefix) SetOriginType(value IsisLspV4PrefixOriginTypeEnum) IsisLspV4Prefix { + intValue, ok := otg.IsisLspV4Prefix_OriginType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on IsisLspV4PrefixOriginTypeEnum", string(value))) + return obj + } + enumValue := otg.IsisLspV4Prefix_OriginType_Enum(intValue) + obj.obj.OriginType = &enumValue + + return obj +} + +func (obj *isisLspV4Prefix) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.PrefixLength != nil { + + if *obj.obj.PrefixLength > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= IsisLspV4Prefix.PrefixLength <= 32 but Got %d", *obj.obj.PrefixLength)) + } + + } + +} + +func (obj *isisLspV4Prefix) setDefault() { + +} diff --git a/gosnappi/isis_lsp_v6_prefix.go b/gosnappi/isis_lsp_v6_prefix.go new file mode 100644 index 00000000..f91f5816 --- /dev/null +++ b/gosnappi/isis_lsp_v6_prefix.go @@ -0,0 +1,517 @@ +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" +) + +// ***** IsisLspV6Prefix ***** +type isisLspV6Prefix struct { + validation + obj *otg.IsisLspV6Prefix + marshaller marshalIsisLspV6Prefix + unMarshaller unMarshalIsisLspV6Prefix + prefixAttributesHolder IsisLspPrefixAttributes +} + +func NewIsisLspV6Prefix() IsisLspV6Prefix { + obj := isisLspV6Prefix{obj: &otg.IsisLspV6Prefix{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspV6Prefix) msg() *otg.IsisLspV6Prefix { + return obj.obj +} + +func (obj *isisLspV6Prefix) setMsg(msg *otg.IsisLspV6Prefix) IsisLspV6Prefix { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspV6Prefix struct { + obj *isisLspV6Prefix +} + +type marshalIsisLspV6Prefix interface { + // ToProto marshals IsisLspV6Prefix to protobuf object *otg.IsisLspV6Prefix + ToProto() (*otg.IsisLspV6Prefix, error) + // ToPbText marshals IsisLspV6Prefix to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspV6Prefix to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspV6Prefix to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspV6Prefix struct { + obj *isisLspV6Prefix +} + +type unMarshalIsisLspV6Prefix interface { + // FromProto unmarshals IsisLspV6Prefix from protobuf object *otg.IsisLspV6Prefix + FromProto(msg *otg.IsisLspV6Prefix) (IsisLspV6Prefix, error) + // FromPbText unmarshals IsisLspV6Prefix from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspV6Prefix from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspV6Prefix from JSON text + FromJson(value string) error +} + +func (obj *isisLspV6Prefix) Marshal() marshalIsisLspV6Prefix { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspV6Prefix{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspV6Prefix) Unmarshal() unMarshalIsisLspV6Prefix { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspV6Prefix{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspV6Prefix) ToProto() (*otg.IsisLspV6Prefix, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspV6Prefix) FromProto(msg *otg.IsisLspV6Prefix) (IsisLspV6Prefix, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspV6Prefix) 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 *unMarshalisisLspV6Prefix) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisLspV6Prefix) 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 *unMarshalisisLspV6Prefix) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisLspV6Prefix) 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 *unMarshalisisLspV6Prefix) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisLspV6Prefix) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspV6Prefix) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspV6Prefix) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspV6Prefix) Clone() (IsisLspV6Prefix, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspV6Prefix() + 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 +} + +func (obj *isisLspV6Prefix) setNil() { + obj.prefixAttributesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisLspV6Prefix is it defines attributes of an IPv6 standard prefix. +type IsisLspV6Prefix interface { + Validation + // msg marshals IsisLspV6Prefix to protobuf object *otg.IsisLspV6Prefix + // and doesn't set defaults + msg() *otg.IsisLspV6Prefix + // setMsg unmarshals IsisLspV6Prefix from protobuf object *otg.IsisLspV6Prefix + // and doesn't set defaults + setMsg(*otg.IsisLspV6Prefix) IsisLspV6Prefix + // provides marshal interface + Marshal() marshalIsisLspV6Prefix + // provides unmarshal interface + Unmarshal() unMarshalIsisLspV6Prefix + // validate validates IsisLspV6Prefix + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspV6Prefix, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv6Address returns string, set in IsisLspV6Prefix. + Ipv6Address() string + // SetIpv6Address assigns string provided by user to IsisLspV6Prefix + SetIpv6Address(value string) IsisLspV6Prefix + // HasIpv6Address checks if Ipv6Address has been set in IsisLspV6Prefix + HasIpv6Address() bool + // PrefixLength returns uint32, set in IsisLspV6Prefix. + PrefixLength() uint32 + // SetPrefixLength assigns uint32 provided by user to IsisLspV6Prefix + SetPrefixLength(value uint32) IsisLspV6Prefix + // HasPrefixLength checks if PrefixLength has been set in IsisLspV6Prefix + HasPrefixLength() bool + // Metric returns uint32, set in IsisLspV6Prefix. + Metric() uint32 + // SetMetric assigns uint32 provided by user to IsisLspV6Prefix + SetMetric(value uint32) IsisLspV6Prefix + // HasMetric checks if Metric has been set in IsisLspV6Prefix + HasMetric() bool + // RedistributionType returns IsisLspV6PrefixRedistributionTypeEnum, set in IsisLspV6Prefix + RedistributionType() IsisLspV6PrefixRedistributionTypeEnum + // SetRedistributionType assigns IsisLspV6PrefixRedistributionTypeEnum provided by user to IsisLspV6Prefix + SetRedistributionType(value IsisLspV6PrefixRedistributionTypeEnum) IsisLspV6Prefix + // HasRedistributionType checks if RedistributionType has been set in IsisLspV6Prefix + HasRedistributionType() bool + // OriginType returns IsisLspV6PrefixOriginTypeEnum, set in IsisLspV6Prefix + OriginType() IsisLspV6PrefixOriginTypeEnum + // SetOriginType assigns IsisLspV6PrefixOriginTypeEnum provided by user to IsisLspV6Prefix + SetOriginType(value IsisLspV6PrefixOriginTypeEnum) IsisLspV6Prefix + // HasOriginType checks if OriginType has been set in IsisLspV6Prefix + HasOriginType() bool + // PrefixAttributes returns IsisLspPrefixAttributes, set in IsisLspV6Prefix. + // IsisLspPrefixAttributes is this contains the properties of ISIS Prefix attributes for the extended IPv4 and IPv6 reachability. https://www.rfc-editor.org/rfc/rfc7794.html + PrefixAttributes() IsisLspPrefixAttributes + // SetPrefixAttributes assigns IsisLspPrefixAttributes provided by user to IsisLspV6Prefix. + // IsisLspPrefixAttributes is this contains the properties of ISIS Prefix attributes for the extended IPv4 and IPv6 reachability. https://www.rfc-editor.org/rfc/rfc7794.html + SetPrefixAttributes(value IsisLspPrefixAttributes) IsisLspV6Prefix + // HasPrefixAttributes checks if PrefixAttributes has been set in IsisLspV6Prefix + HasPrefixAttributes() bool + setNil() +} + +// An IPv6 unicast prefix reachable via the originator of this LSP. +// Ipv6Address returns a string +func (obj *isisLspV6Prefix) Ipv6Address() string { + + return *obj.obj.Ipv6Address + +} + +// An IPv6 unicast prefix reachable via the originator of this LSP. +// Ipv6Address returns a string +func (obj *isisLspV6Prefix) HasIpv6Address() bool { + return obj.obj.Ipv6Address != nil +} + +// An IPv6 unicast prefix reachable via the originator of this LSP. +// SetIpv6Address sets the string value in the IsisLspV6Prefix object +func (obj *isisLspV6Prefix) SetIpv6Address(value string) IsisLspV6Prefix { + + obj.obj.Ipv6Address = &value + return obj +} + +// The length of the IPv6 prefix. +// PrefixLength returns a uint32 +func (obj *isisLspV6Prefix) PrefixLength() uint32 { + + return *obj.obj.PrefixLength + +} + +// The length of the IPv6 prefix. +// PrefixLength returns a uint32 +func (obj *isisLspV6Prefix) HasPrefixLength() bool { + return obj.obj.PrefixLength != nil +} + +// The length of the IPv6 prefix. +// SetPrefixLength sets the uint32 value in the IsisLspV6Prefix object +func (obj *isisLspV6Prefix) SetPrefixLength(value uint32) IsisLspV6Prefix { + + obj.obj.PrefixLength = &value + return obj +} + +// ISIS wide metric. +// Metric returns a uint32 +func (obj *isisLspV6Prefix) Metric() uint32 { + + return *obj.obj.Metric + +} + +// ISIS wide metric. +// Metric returns a uint32 +func (obj *isisLspV6Prefix) HasMetric() bool { + return obj.obj.Metric != nil +} + +// ISIS wide metric. +// SetMetric sets the uint32 value in the IsisLspV6Prefix object +func (obj *isisLspV6Prefix) SetMetric(value uint32) IsisLspV6Prefix { + + obj.obj.Metric = &value + return obj +} + +type IsisLspV6PrefixRedistributionTypeEnum string + +// Enum of RedistributionType on IsisLspV6Prefix +var IsisLspV6PrefixRedistributionType = struct { + UP IsisLspV6PrefixRedistributionTypeEnum + DOWN IsisLspV6PrefixRedistributionTypeEnum +}{ + UP: IsisLspV6PrefixRedistributionTypeEnum("up"), + DOWN: IsisLspV6PrefixRedistributionTypeEnum("down"), +} + +func (obj *isisLspV6Prefix) RedistributionType() IsisLspV6PrefixRedistributionTypeEnum { + return IsisLspV6PrefixRedistributionTypeEnum(obj.obj.RedistributionType.Enum().String()) +} + +// Up (0)-used when a prefix is initially advertised within the ISIS L3 hierarchy, +// and for all other prefixes in L1 and L2 LSPs. (default) +// Down (1)-used when an L1/L2 router advertises L2 prefixes in L1 LSPs. +// The prefixes are being advertised from a higher level (L2) down to a lower level (L1). +// RedistributionType returns a string +func (obj *isisLspV6Prefix) HasRedistributionType() bool { + return obj.obj.RedistributionType != nil +} + +func (obj *isisLspV6Prefix) SetRedistributionType(value IsisLspV6PrefixRedistributionTypeEnum) IsisLspV6Prefix { + intValue, ok := otg.IsisLspV6Prefix_RedistributionType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on IsisLspV6PrefixRedistributionTypeEnum", string(value))) + return obj + } + enumValue := otg.IsisLspV6Prefix_RedistributionType_Enum(intValue) + obj.obj.RedistributionType = &enumValue + + return obj +} + +type IsisLspV6PrefixOriginTypeEnum string + +// Enum of OriginType on IsisLspV6Prefix +var IsisLspV6PrefixOriginType = struct { + INTERNAL IsisLspV6PrefixOriginTypeEnum + EXTERNAL IsisLspV6PrefixOriginTypeEnum +}{ + INTERNAL: IsisLspV6PrefixOriginTypeEnum("internal"), + EXTERNAL: IsisLspV6PrefixOriginTypeEnum("external"), +} + +func (obj *isisLspV6Prefix) OriginType() IsisLspV6PrefixOriginTypeEnum { + return IsisLspV6PrefixOriginTypeEnum(obj.obj.OriginType.Enum().String()) +} + +// The origin of the advertised route-internal or external to the ISIS area. Options include the following: +// Internal-for intra-area routes, through Level 1 LSPs. +// External-for inter-area routes redistributed within L1, through Level +// 1 LSPs. +// OriginType returns a string +func (obj *isisLspV6Prefix) HasOriginType() bool { + return obj.obj.OriginType != nil +} + +func (obj *isisLspV6Prefix) SetOriginType(value IsisLspV6PrefixOriginTypeEnum) IsisLspV6Prefix { + intValue, ok := otg.IsisLspV6Prefix_OriginType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on IsisLspV6PrefixOriginTypeEnum", string(value))) + return obj + } + enumValue := otg.IsisLspV6Prefix_OriginType_Enum(intValue) + obj.obj.OriginType = &enumValue + + return obj +} + +// description is TBD +// PrefixAttributes returns a IsisLspPrefixAttributes +func (obj *isisLspV6Prefix) PrefixAttributes() IsisLspPrefixAttributes { + if obj.obj.PrefixAttributes == nil { + obj.obj.PrefixAttributes = NewIsisLspPrefixAttributes().msg() + } + if obj.prefixAttributesHolder == nil { + obj.prefixAttributesHolder = &isisLspPrefixAttributes{obj: obj.obj.PrefixAttributes} + } + return obj.prefixAttributesHolder +} + +// description is TBD +// PrefixAttributes returns a IsisLspPrefixAttributes +func (obj *isisLspV6Prefix) HasPrefixAttributes() bool { + return obj.obj.PrefixAttributes != nil +} + +// description is TBD +// SetPrefixAttributes sets the IsisLspPrefixAttributes value in the IsisLspV6Prefix object +func (obj *isisLspV6Prefix) SetPrefixAttributes(value IsisLspPrefixAttributes) IsisLspV6Prefix { + + obj.prefixAttributesHolder = nil + obj.obj.PrefixAttributes = value.msg() + + return obj +} + +func (obj *isisLspV6Prefix) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv6Address != nil { + + err := obj.validateIpv6(obj.Ipv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on IsisLspV6Prefix.Ipv6Address")) + } + + } + + if obj.obj.PrefixLength != nil { + + if *obj.obj.PrefixLength > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= IsisLspV6Prefix.PrefixLength <= 128 but Got %d", *obj.obj.PrefixLength)) + } + + } + + if obj.obj.PrefixAttributes != nil { + + obj.PrefixAttributes().validateObj(vObj, set_default) + } + +} + +func (obj *isisLspV6Prefix) setDefault() { + +} diff --git a/gosnappi/isis_lspneighbor.go b/gosnappi/isis_lspneighbor.go new file mode 100644 index 00000000..8f8b78f9 --- /dev/null +++ b/gosnappi/isis_lspneighbor.go @@ -0,0 +1,315 @@ +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" +) + +// ***** IsisLspneighbor ***** +type isisLspneighbor struct { + validation + obj *otg.IsisLspneighbor + marshaller marshalIsisLspneighbor + unMarshaller unMarshalIsisLspneighbor +} + +func NewIsisLspneighbor() IsisLspneighbor { + obj := isisLspneighbor{obj: &otg.IsisLspneighbor{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspneighbor) msg() *otg.IsisLspneighbor { + return obj.obj +} + +func (obj *isisLspneighbor) setMsg(msg *otg.IsisLspneighbor) IsisLspneighbor { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspneighbor struct { + obj *isisLspneighbor +} + +type marshalIsisLspneighbor interface { + // ToProto marshals IsisLspneighbor to protobuf object *otg.IsisLspneighbor + ToProto() (*otg.IsisLspneighbor, error) + // ToPbText marshals IsisLspneighbor to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspneighbor to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspneighbor to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspneighbor struct { + obj *isisLspneighbor +} + +type unMarshalIsisLspneighbor interface { + // FromProto unmarshals IsisLspneighbor from protobuf object *otg.IsisLspneighbor + FromProto(msg *otg.IsisLspneighbor) (IsisLspneighbor, error) + // FromPbText unmarshals IsisLspneighbor from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspneighbor from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspneighbor from JSON text + FromJson(value string) error +} + +func (obj *isisLspneighbor) Marshal() marshalIsisLspneighbor { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspneighbor{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspneighbor) Unmarshal() unMarshalIsisLspneighbor { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspneighbor{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspneighbor) ToProto() (*otg.IsisLspneighbor, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspneighbor) FromProto(msg *otg.IsisLspneighbor) (IsisLspneighbor, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspneighbor) 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 *unMarshalisisLspneighbor) 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 *marshalisisLspneighbor) 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 *unMarshalisisLspneighbor) 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 *marshalisisLspneighbor) 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 *unMarshalisisLspneighbor) 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 *isisLspneighbor) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspneighbor) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspneighbor) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspneighbor) Clone() (IsisLspneighbor, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspneighbor() + 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 +} + +// IsisLspneighbor is this contains IS neighbors. +type IsisLspneighbor interface { + Validation + // msg marshals IsisLspneighbor to protobuf object *otg.IsisLspneighbor + // and doesn't set defaults + msg() *otg.IsisLspneighbor + // setMsg unmarshals IsisLspneighbor from protobuf object *otg.IsisLspneighbor + // and doesn't set defaults + setMsg(*otg.IsisLspneighbor) IsisLspneighbor + // provides marshal interface + Marshal() marshalIsisLspneighbor + // provides unmarshal interface + Unmarshal() unMarshalIsisLspneighbor + // validate validates IsisLspneighbor + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspneighbor, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // SystemId returns string, set in IsisLspneighbor. + SystemId() string + // SetSystemId assigns string provided by user to IsisLspneighbor + SetSystemId(value string) IsisLspneighbor + // HasSystemId checks if SystemId has been set in IsisLspneighbor + HasSystemId() bool +} + +// The System ID for this emulated ISIS router, e.g. "640100010000". +// SystemId returns a string +func (obj *isisLspneighbor) SystemId() string { + + return *obj.obj.SystemId + +} + +// The System ID for this emulated ISIS router, e.g. "640100010000". +// SystemId returns a string +func (obj *isisLspneighbor) HasSystemId() bool { + return obj.obj.SystemId != nil +} + +// The System ID for this emulated ISIS router, e.g. "640100010000". +// SetSystemId sets the string value in the IsisLspneighbor object +func (obj *isisLspneighbor) SetSystemId(value string) IsisLspneighbor { + + obj.obj.SystemId = &value + return obj +} + +func (obj *isisLspneighbor) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.SystemId != nil { + + err := obj.validateHex(obj.SystemId()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on IsisLspneighbor.SystemId")) + } + + } + +} + +func (obj *isisLspneighbor) setDefault() { + +} diff --git a/gosnappi/isis_lsps_state.go b/gosnappi/isis_lsps_state.go new file mode 100644 index 00000000..228ff4ee --- /dev/null +++ b/gosnappi/isis_lsps_state.go @@ -0,0 +1,418 @@ +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" +) + +// ***** IsisLspsState ***** +type isisLspsState struct { + validation + obj *otg.IsisLspsState + marshaller marshalIsisLspsState + unMarshaller unMarshalIsisLspsState + lspsHolder IsisLspsStateIsisLspStateIter +} + +func NewIsisLspsState() IsisLspsState { + obj := isisLspsState{obj: &otg.IsisLspsState{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspsState) msg() *otg.IsisLspsState { + return obj.obj +} + +func (obj *isisLspsState) setMsg(msg *otg.IsisLspsState) IsisLspsState { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspsState struct { + obj *isisLspsState +} + +type marshalIsisLspsState interface { + // ToProto marshals IsisLspsState to protobuf object *otg.IsisLspsState + ToProto() (*otg.IsisLspsState, error) + // ToPbText marshals IsisLspsState to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspsState to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspsState to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspsState struct { + obj *isisLspsState +} + +type unMarshalIsisLspsState interface { + // FromProto unmarshals IsisLspsState from protobuf object *otg.IsisLspsState + FromProto(msg *otg.IsisLspsState) (IsisLspsState, error) + // FromPbText unmarshals IsisLspsState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspsState from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspsState from JSON text + FromJson(value string) error +} + +func (obj *isisLspsState) Marshal() marshalIsisLspsState { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspsState{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspsState) Unmarshal() unMarshalIsisLspsState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspsState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspsState) ToProto() (*otg.IsisLspsState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspsState) FromProto(msg *otg.IsisLspsState) (IsisLspsState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspsState) 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 *unMarshalisisLspsState) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisLspsState) 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 *unMarshalisisLspsState) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisLspsState) 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 *unMarshalisisLspsState) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisLspsState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspsState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspsState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspsState) Clone() (IsisLspsState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspsState() + 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 +} + +func (obj *isisLspsState) setNil() { + obj.lspsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisLspsState is the result of ISIS LSP information that are retrieved. +type IsisLspsState interface { + Validation + // msg marshals IsisLspsState to protobuf object *otg.IsisLspsState + // and doesn't set defaults + msg() *otg.IsisLspsState + // setMsg unmarshals IsisLspsState from protobuf object *otg.IsisLspsState + // and doesn't set defaults + setMsg(*otg.IsisLspsState) IsisLspsState + // provides marshal interface + Marshal() marshalIsisLspsState + // provides unmarshal interface + Unmarshal() unMarshalIsisLspsState + // validate validates IsisLspsState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspsState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // IsisRouterName returns string, set in IsisLspsState. + IsisRouterName() string + // SetIsisRouterName assigns string provided by user to IsisLspsState + SetIsisRouterName(value string) IsisLspsState + // HasIsisRouterName checks if IsisRouterName has been set in IsisLspsState + HasIsisRouterName() bool + // Lsps returns IsisLspsStateIsisLspStateIterIter, set in IsisLspsState + Lsps() IsisLspsStateIsisLspStateIter + setNil() +} + +// The name of the ISIS Router. +// IsisRouterName returns a string +func (obj *isisLspsState) IsisRouterName() string { + + return *obj.obj.IsisRouterName + +} + +// The name of the ISIS Router. +// IsisRouterName returns a string +func (obj *isisLspsState) HasIsisRouterName() bool { + return obj.obj.IsisRouterName != nil +} + +// The name of the ISIS Router. +// SetIsisRouterName sets the string value in the IsisLspsState object +func (obj *isisLspsState) SetIsisRouterName(value string) IsisLspsState { + + obj.obj.IsisRouterName = &value + return obj +} + +// One or more LSPs that are learned by this ISIS router. +// Lsps returns a []IsisLspState +func (obj *isisLspsState) Lsps() IsisLspsStateIsisLspStateIter { + if len(obj.obj.Lsps) == 0 { + obj.obj.Lsps = []*otg.IsisLspState{} + } + if obj.lspsHolder == nil { + obj.lspsHolder = newIsisLspsStateIsisLspStateIter(&obj.obj.Lsps).setMsg(obj) + } + return obj.lspsHolder +} + +type isisLspsStateIsisLspStateIter struct { + obj *isisLspsState + isisLspStateSlice []IsisLspState + fieldPtr *[]*otg.IsisLspState +} + +func newIsisLspsStateIsisLspStateIter(ptr *[]*otg.IsisLspState) IsisLspsStateIsisLspStateIter { + return &isisLspsStateIsisLspStateIter{fieldPtr: ptr} +} + +type IsisLspsStateIsisLspStateIter interface { + setMsg(*isisLspsState) IsisLspsStateIsisLspStateIter + Items() []IsisLspState + Add() IsisLspState + Append(items ...IsisLspState) IsisLspsStateIsisLspStateIter + Set(index int, newObj IsisLspState) IsisLspsStateIsisLspStateIter + Clear() IsisLspsStateIsisLspStateIter + clearHolderSlice() IsisLspsStateIsisLspStateIter + appendHolderSlice(item IsisLspState) IsisLspsStateIsisLspStateIter +} + +func (obj *isisLspsStateIsisLspStateIter) setMsg(msg *isisLspsState) IsisLspsStateIsisLspStateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspState{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisLspsStateIsisLspStateIter) Items() []IsisLspState { + return obj.isisLspStateSlice +} + +func (obj *isisLspsStateIsisLspStateIter) Add() IsisLspState { + newObj := &otg.IsisLspState{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspState{obj: newObj} + newLibObj.setDefault() + obj.isisLspStateSlice = append(obj.isisLspStateSlice, newLibObj) + return newLibObj +} + +func (obj *isisLspsStateIsisLspStateIter) Append(items ...IsisLspState) IsisLspsStateIsisLspStateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspStateSlice = append(obj.isisLspStateSlice, item) + } + return obj +} + +func (obj *isisLspsStateIsisLspStateIter) Set(index int, newObj IsisLspState) IsisLspsStateIsisLspStateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspStateSlice[index] = newObj + return obj +} +func (obj *isisLspsStateIsisLspStateIter) Clear() IsisLspsStateIsisLspStateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspState{} + obj.isisLspStateSlice = []IsisLspState{} + } + return obj +} +func (obj *isisLspsStateIsisLspStateIter) clearHolderSlice() IsisLspsStateIsisLspStateIter { + if len(obj.isisLspStateSlice) > 0 { + obj.isisLspStateSlice = []IsisLspState{} + } + return obj +} +func (obj *isisLspsStateIsisLspStateIter) appendHolderSlice(item IsisLspState) IsisLspsStateIsisLspStateIter { + obj.isisLspStateSlice = append(obj.isisLspStateSlice, item) + return obj +} + +func (obj *isisLspsState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Lsps) != 0 { + + if set_default { + obj.Lsps().clearHolderSlice() + for _, item := range obj.obj.Lsps { + obj.Lsps().appendHolderSlice(&isisLspState{obj: item}) + } + } + for _, item := range obj.Lsps().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *isisLspsState) setDefault() { + +} diff --git a/gosnappi/isis_lsps_state_request.go b/gosnappi/isis_lsps_state_request.go new file mode 100644 index 00000000..2089395e --- /dev/null +++ b/gosnappi/isis_lsps_state_request.go @@ -0,0 +1,317 @@ +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" +) + +// ***** IsisLspsStateRequest ***** +type isisLspsStateRequest struct { + validation + obj *otg.IsisLspsStateRequest + marshaller marshalIsisLspsStateRequest + unMarshaller unMarshalIsisLspsStateRequest +} + +func NewIsisLspsStateRequest() IsisLspsStateRequest { + obj := isisLspsStateRequest{obj: &otg.IsisLspsStateRequest{}} + obj.setDefault() + return &obj +} + +func (obj *isisLspsStateRequest) msg() *otg.IsisLspsStateRequest { + return obj.obj +} + +func (obj *isisLspsStateRequest) setMsg(msg *otg.IsisLspsStateRequest) IsisLspsStateRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisLspsStateRequest struct { + obj *isisLspsStateRequest +} + +type marshalIsisLspsStateRequest interface { + // ToProto marshals IsisLspsStateRequest to protobuf object *otg.IsisLspsStateRequest + ToProto() (*otg.IsisLspsStateRequest, error) + // ToPbText marshals IsisLspsStateRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisLspsStateRequest to YAML text + ToYaml() (string, error) + // ToJson marshals IsisLspsStateRequest to JSON text + ToJson() (string, error) +} + +type unMarshalisisLspsStateRequest struct { + obj *isisLspsStateRequest +} + +type unMarshalIsisLspsStateRequest interface { + // FromProto unmarshals IsisLspsStateRequest from protobuf object *otg.IsisLspsStateRequest + FromProto(msg *otg.IsisLspsStateRequest) (IsisLspsStateRequest, error) + // FromPbText unmarshals IsisLspsStateRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisLspsStateRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisLspsStateRequest from JSON text + FromJson(value string) error +} + +func (obj *isisLspsStateRequest) Marshal() marshalIsisLspsStateRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalisisLspsStateRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *isisLspsStateRequest) Unmarshal() unMarshalIsisLspsStateRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisLspsStateRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisLspsStateRequest) ToProto() (*otg.IsisLspsStateRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisLspsStateRequest) FromProto(msg *otg.IsisLspsStateRequest) (IsisLspsStateRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisLspsStateRequest) 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 *unMarshalisisLspsStateRequest) 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 *marshalisisLspsStateRequest) 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 *unMarshalisisLspsStateRequest) 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 *marshalisisLspsStateRequest) 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 *unMarshalisisLspsStateRequest) 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 *isisLspsStateRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisLspsStateRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisLspsStateRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisLspsStateRequest) Clone() (IsisLspsStateRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisLspsStateRequest() + 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 +} + +// IsisLspsStateRequest is the request to retrieve ISIS Link State PDU (LSP) information learned by the router. +type IsisLspsStateRequest interface { + Validation + // msg marshals IsisLspsStateRequest to protobuf object *otg.IsisLspsStateRequest + // and doesn't set defaults + msg() *otg.IsisLspsStateRequest + // setMsg unmarshals IsisLspsStateRequest from protobuf object *otg.IsisLspsStateRequest + // and doesn't set defaults + setMsg(*otg.IsisLspsStateRequest) IsisLspsStateRequest + // provides marshal interface + Marshal() marshalIsisLspsStateRequest + // provides unmarshal interface + Unmarshal() unMarshalIsisLspsStateRequest + // validate validates IsisLspsStateRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisLspsStateRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // IsisRouterNames returns []string, set in IsisLspsStateRequest. + IsisRouterNames() []string + // SetIsisRouterNames assigns []string provided by user to IsisLspsStateRequest + SetIsisRouterNames(value []string) IsisLspsStateRequest +} + +// The names of ISIS routers for which learned information is requested. An empty list will return results for all ISIS routers. +// +// x-constraint: +// - /components/schemas/Device.IsisRouter/properties/name +// +// x-constraint: +// - /components/schemas/Device.IsisRouter/properties/name +// +// IsisRouterNames returns a []string +func (obj *isisLspsStateRequest) IsisRouterNames() []string { + if obj.obj.IsisRouterNames == nil { + obj.obj.IsisRouterNames = make([]string, 0) + } + return obj.obj.IsisRouterNames +} + +// The names of ISIS routers for which learned information is requested. An empty list will return results for all ISIS routers. +// +// x-constraint: +// - /components/schemas/Device.IsisRouter/properties/name +// +// x-constraint: +// - /components/schemas/Device.IsisRouter/properties/name +// +// SetIsisRouterNames sets the []string value in the IsisLspsStateRequest object +func (obj *isisLspsStateRequest) SetIsisRouterNames(value []string) IsisLspsStateRequest { + + if obj.obj.IsisRouterNames == nil { + obj.obj.IsisRouterNames = make([]string, 0) + } + obj.obj.IsisRouterNames = value + + return obj +} + +func (obj *isisLspsStateRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *isisLspsStateRequest) setDefault() { + +} diff --git a/gosnappi/isis_metric.go b/gosnappi/isis_metric.go new file mode 100644 index 00000000..76446185 --- /dev/null +++ b/gosnappi/isis_metric.go @@ -0,0 +1,1034 @@ +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" +) + +// ***** IsisMetric ***** +type isisMetric struct { + validation + obj *otg.IsisMetric + marshaller marshalIsisMetric + unMarshaller unMarshalIsisMetric +} + +func NewIsisMetric() IsisMetric { + obj := isisMetric{obj: &otg.IsisMetric{}} + obj.setDefault() + return &obj +} + +func (obj *isisMetric) msg() *otg.IsisMetric { + return obj.obj +} + +func (obj *isisMetric) setMsg(msg *otg.IsisMetric) IsisMetric { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisMetric struct { + obj *isisMetric +} + +type marshalIsisMetric interface { + // ToProto marshals IsisMetric to protobuf object *otg.IsisMetric + ToProto() (*otg.IsisMetric, error) + // ToPbText marshals IsisMetric to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisMetric to YAML text + ToYaml() (string, error) + // ToJson marshals IsisMetric to JSON text + ToJson() (string, error) +} + +type unMarshalisisMetric struct { + obj *isisMetric +} + +type unMarshalIsisMetric interface { + // FromProto unmarshals IsisMetric from protobuf object *otg.IsisMetric + FromProto(msg *otg.IsisMetric) (IsisMetric, error) + // FromPbText unmarshals IsisMetric from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisMetric from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisMetric from JSON text + FromJson(value string) error +} + +func (obj *isisMetric) Marshal() marshalIsisMetric { + if obj.marshaller == nil { + obj.marshaller = &marshalisisMetric{obj: obj} + } + return obj.marshaller +} + +func (obj *isisMetric) Unmarshal() unMarshalIsisMetric { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisMetric{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisMetric) ToProto() (*otg.IsisMetric, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisMetric) FromProto(msg *otg.IsisMetric) (IsisMetric, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisMetric) 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 *unMarshalisisMetric) 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 *marshalisisMetric) 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 *unMarshalisisMetric) 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 *marshalisisMetric) 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 *unMarshalisisMetric) 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 *isisMetric) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisMetric) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisMetric) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisMetric) Clone() (IsisMetric, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisMetric() + 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 +} + +// IsisMetric is iSIS per router statistics information. +type IsisMetric interface { + Validation + // msg marshals IsisMetric to protobuf object *otg.IsisMetric + // and doesn't set defaults + msg() *otg.IsisMetric + // setMsg unmarshals IsisMetric from protobuf object *otg.IsisMetric + // and doesn't set defaults + setMsg(*otg.IsisMetric) IsisMetric + // provides marshal interface + Marshal() marshalIsisMetric + // provides unmarshal interface + Unmarshal() unMarshalIsisMetric + // validate validates IsisMetric + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisMetric, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in IsisMetric. + Name() string + // SetName assigns string provided by user to IsisMetric + SetName(value string) IsisMetric + // HasName checks if Name has been set in IsisMetric + HasName() bool + // L1SessionsUp returns uint32, set in IsisMetric. + L1SessionsUp() uint32 + // SetL1SessionsUp assigns uint32 provided by user to IsisMetric + SetL1SessionsUp(value uint32) IsisMetric + // HasL1SessionsUp checks if L1SessionsUp has been set in IsisMetric + HasL1SessionsUp() bool + // L1SessionFlap returns uint64, set in IsisMetric. + L1SessionFlap() uint64 + // SetL1SessionFlap assigns uint64 provided by user to IsisMetric + SetL1SessionFlap(value uint64) IsisMetric + // HasL1SessionFlap checks if L1SessionFlap has been set in IsisMetric + HasL1SessionFlap() bool + // L1BroadcastHellosSent returns uint64, set in IsisMetric. + L1BroadcastHellosSent() uint64 + // SetL1BroadcastHellosSent assigns uint64 provided by user to IsisMetric + SetL1BroadcastHellosSent(value uint64) IsisMetric + // HasL1BroadcastHellosSent checks if L1BroadcastHellosSent has been set in IsisMetric + HasL1BroadcastHellosSent() bool + // L1BroadcastHellosReceived returns uint64, set in IsisMetric. + L1BroadcastHellosReceived() uint64 + // SetL1BroadcastHellosReceived assigns uint64 provided by user to IsisMetric + SetL1BroadcastHellosReceived(value uint64) IsisMetric + // HasL1BroadcastHellosReceived checks if L1BroadcastHellosReceived has been set in IsisMetric + HasL1BroadcastHellosReceived() bool + // L1PointToPointHellosSent returns uint64, set in IsisMetric. + L1PointToPointHellosSent() uint64 + // SetL1PointToPointHellosSent assigns uint64 provided by user to IsisMetric + SetL1PointToPointHellosSent(value uint64) IsisMetric + // HasL1PointToPointHellosSent checks if L1PointToPointHellosSent has been set in IsisMetric + HasL1PointToPointHellosSent() bool + // L1PointToPointHellosReceived returns uint64, set in IsisMetric. + L1PointToPointHellosReceived() uint64 + // SetL1PointToPointHellosReceived assigns uint64 provided by user to IsisMetric + SetL1PointToPointHellosReceived(value uint64) IsisMetric + // HasL1PointToPointHellosReceived checks if L1PointToPointHellosReceived has been set in IsisMetric + HasL1PointToPointHellosReceived() bool + // L1DatabaseSize returns uint64, set in IsisMetric. + L1DatabaseSize() uint64 + // SetL1DatabaseSize assigns uint64 provided by user to IsisMetric + SetL1DatabaseSize(value uint64) IsisMetric + // HasL1DatabaseSize checks if L1DatabaseSize has been set in IsisMetric + HasL1DatabaseSize() bool + // L1PsnpSent returns uint64, set in IsisMetric. + L1PsnpSent() uint64 + // SetL1PsnpSent assigns uint64 provided by user to IsisMetric + SetL1PsnpSent(value uint64) IsisMetric + // HasL1PsnpSent checks if L1PsnpSent has been set in IsisMetric + HasL1PsnpSent() bool + // L1PsnpReceived returns uint64, set in IsisMetric. + L1PsnpReceived() uint64 + // SetL1PsnpReceived assigns uint64 provided by user to IsisMetric + SetL1PsnpReceived(value uint64) IsisMetric + // HasL1PsnpReceived checks if L1PsnpReceived has been set in IsisMetric + HasL1PsnpReceived() bool + // L1CsnpSent returns uint64, set in IsisMetric. + L1CsnpSent() uint64 + // SetL1CsnpSent assigns uint64 provided by user to IsisMetric + SetL1CsnpSent(value uint64) IsisMetric + // HasL1CsnpSent checks if L1CsnpSent has been set in IsisMetric + HasL1CsnpSent() bool + // L1CsnpReceived returns uint64, set in IsisMetric. + L1CsnpReceived() uint64 + // SetL1CsnpReceived assigns uint64 provided by user to IsisMetric + SetL1CsnpReceived(value uint64) IsisMetric + // HasL1CsnpReceived checks if L1CsnpReceived has been set in IsisMetric + HasL1CsnpReceived() bool + // L1LspSent returns uint64, set in IsisMetric. + L1LspSent() uint64 + // SetL1LspSent assigns uint64 provided by user to IsisMetric + SetL1LspSent(value uint64) IsisMetric + // HasL1LspSent checks if L1LspSent has been set in IsisMetric + HasL1LspSent() bool + // L1LspReceived returns uint64, set in IsisMetric. + L1LspReceived() uint64 + // SetL1LspReceived assigns uint64 provided by user to IsisMetric + SetL1LspReceived(value uint64) IsisMetric + // HasL1LspReceived checks if L1LspReceived has been set in IsisMetric + HasL1LspReceived() bool + // L2SessionsUp returns uint32, set in IsisMetric. + L2SessionsUp() uint32 + // SetL2SessionsUp assigns uint32 provided by user to IsisMetric + SetL2SessionsUp(value uint32) IsisMetric + // HasL2SessionsUp checks if L2SessionsUp has been set in IsisMetric + HasL2SessionsUp() bool + // L2SessionFlap returns uint64, set in IsisMetric. + L2SessionFlap() uint64 + // SetL2SessionFlap assigns uint64 provided by user to IsisMetric + SetL2SessionFlap(value uint64) IsisMetric + // HasL2SessionFlap checks if L2SessionFlap has been set in IsisMetric + HasL2SessionFlap() bool + // L2BroadcastHellosSent returns uint64, set in IsisMetric. + L2BroadcastHellosSent() uint64 + // SetL2BroadcastHellosSent assigns uint64 provided by user to IsisMetric + SetL2BroadcastHellosSent(value uint64) IsisMetric + // HasL2BroadcastHellosSent checks if L2BroadcastHellosSent has been set in IsisMetric + HasL2BroadcastHellosSent() bool + // L2BroadcastHellosReceived returns uint64, set in IsisMetric. + L2BroadcastHellosReceived() uint64 + // SetL2BroadcastHellosReceived assigns uint64 provided by user to IsisMetric + SetL2BroadcastHellosReceived(value uint64) IsisMetric + // HasL2BroadcastHellosReceived checks if L2BroadcastHellosReceived has been set in IsisMetric + HasL2BroadcastHellosReceived() bool + // L2PointToPointHellosSent returns uint64, set in IsisMetric. + L2PointToPointHellosSent() uint64 + // SetL2PointToPointHellosSent assigns uint64 provided by user to IsisMetric + SetL2PointToPointHellosSent(value uint64) IsisMetric + // HasL2PointToPointHellosSent checks if L2PointToPointHellosSent has been set in IsisMetric + HasL2PointToPointHellosSent() bool + // L2PointToPointHellosReceived returns uint64, set in IsisMetric. + L2PointToPointHellosReceived() uint64 + // SetL2PointToPointHellosReceived assigns uint64 provided by user to IsisMetric + SetL2PointToPointHellosReceived(value uint64) IsisMetric + // HasL2PointToPointHellosReceived checks if L2PointToPointHellosReceived has been set in IsisMetric + HasL2PointToPointHellosReceived() bool + // L2DatabaseSize returns uint64, set in IsisMetric. + L2DatabaseSize() uint64 + // SetL2DatabaseSize assigns uint64 provided by user to IsisMetric + SetL2DatabaseSize(value uint64) IsisMetric + // HasL2DatabaseSize checks if L2DatabaseSize has been set in IsisMetric + HasL2DatabaseSize() bool + // L2PsnpSent returns uint64, set in IsisMetric. + L2PsnpSent() uint64 + // SetL2PsnpSent assigns uint64 provided by user to IsisMetric + SetL2PsnpSent(value uint64) IsisMetric + // HasL2PsnpSent checks if L2PsnpSent has been set in IsisMetric + HasL2PsnpSent() bool + // L2PsnpReceived returns uint64, set in IsisMetric. + L2PsnpReceived() uint64 + // SetL2PsnpReceived assigns uint64 provided by user to IsisMetric + SetL2PsnpReceived(value uint64) IsisMetric + // HasL2PsnpReceived checks if L2PsnpReceived has been set in IsisMetric + HasL2PsnpReceived() bool + // L2CsnpSent returns uint64, set in IsisMetric. + L2CsnpSent() uint64 + // SetL2CsnpSent assigns uint64 provided by user to IsisMetric + SetL2CsnpSent(value uint64) IsisMetric + // HasL2CsnpSent checks if L2CsnpSent has been set in IsisMetric + HasL2CsnpSent() bool + // L2CsnpReceived returns uint64, set in IsisMetric. + L2CsnpReceived() uint64 + // SetL2CsnpReceived assigns uint64 provided by user to IsisMetric + SetL2CsnpReceived(value uint64) IsisMetric + // HasL2CsnpReceived checks if L2CsnpReceived has been set in IsisMetric + HasL2CsnpReceived() bool + // L2LspSent returns uint64, set in IsisMetric. + L2LspSent() uint64 + // SetL2LspSent assigns uint64 provided by user to IsisMetric + SetL2LspSent(value uint64) IsisMetric + // HasL2LspSent checks if L2LspSent has been set in IsisMetric + HasL2LspSent() bool + // L2LspReceived returns uint64, set in IsisMetric. + L2LspReceived() uint64 + // SetL2LspReceived assigns uint64 provided by user to IsisMetric + SetL2LspReceived(value uint64) IsisMetric + // HasL2LspReceived checks if L2LspReceived has been set in IsisMetric + HasL2LspReceived() bool +} + +// The name of a configured ISIS router. +// Name returns a string +func (obj *isisMetric) Name() string { + + return *obj.obj.Name + +} + +// The name of a configured ISIS router. +// Name returns a string +func (obj *isisMetric) HasName() bool { + return obj.obj.Name != nil +} + +// The name of a configured ISIS router. +// SetName sets the string value in the IsisMetric object +func (obj *isisMetric) SetName(value string) IsisMetric { + + obj.obj.Name = &value + return obj +} + +// The number of Level 1 (L1) sessions that are fully up. +// L1SessionsUp returns a uint32 +func (obj *isisMetric) L1SessionsUp() uint32 { + + return *obj.obj.L1SessionsUp + +} + +// The number of Level 1 (L1) sessions that are fully up. +// L1SessionsUp returns a uint32 +func (obj *isisMetric) HasL1SessionsUp() bool { + return obj.obj.L1SessionsUp != nil +} + +// The number of Level 1 (L1) sessions that are fully up. +// SetL1SessionsUp sets the uint32 value in the IsisMetric object +func (obj *isisMetric) SetL1SessionsUp(value uint32) IsisMetric { + + obj.obj.L1SessionsUp = &value + return obj +} + +// The number of Level 1 Sessions Flap. +// L1SessionFlap returns a uint64 +func (obj *isisMetric) L1SessionFlap() uint64 { + + return *obj.obj.L1SessionFlap + +} + +// The number of Level 1 Sessions Flap. +// L1SessionFlap returns a uint64 +func (obj *isisMetric) HasL1SessionFlap() bool { + return obj.obj.L1SessionFlap != nil +} + +// The number of Level 1 Sessions Flap. +// SetL1SessionFlap sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL1SessionFlap(value uint64) IsisMetric { + + obj.obj.L1SessionFlap = &value + return obj +} + +// Number of Level 1 Hello messages sent. +// L1BroadcastHellosSent returns a uint64 +func (obj *isisMetric) L1BroadcastHellosSent() uint64 { + + return *obj.obj.L1BroadcastHellosSent + +} + +// Number of Level 1 Hello messages sent. +// L1BroadcastHellosSent returns a uint64 +func (obj *isisMetric) HasL1BroadcastHellosSent() bool { + return obj.obj.L1BroadcastHellosSent != nil +} + +// Number of Level 1 Hello messages sent. +// SetL1BroadcastHellosSent sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL1BroadcastHellosSent(value uint64) IsisMetric { + + obj.obj.L1BroadcastHellosSent = &value + return obj +} + +// Number of Level 1 Hello messages received. +// L1BroadcastHellosReceived returns a uint64 +func (obj *isisMetric) L1BroadcastHellosReceived() uint64 { + + return *obj.obj.L1BroadcastHellosReceived + +} + +// Number of Level 1 Hello messages received. +// L1BroadcastHellosReceived returns a uint64 +func (obj *isisMetric) HasL1BroadcastHellosReceived() bool { + return obj.obj.L1BroadcastHellosReceived != nil +} + +// Number of Level 1 Hello messages received. +// SetL1BroadcastHellosReceived sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL1BroadcastHellosReceived(value uint64) IsisMetric { + + obj.obj.L1BroadcastHellosReceived = &value + return obj +} + +// Number of Level 1 Point-to-Point(P2P) Hello messages sent. +// L1PointToPointHellosSent returns a uint64 +func (obj *isisMetric) L1PointToPointHellosSent() uint64 { + + return *obj.obj.L1PointToPointHellosSent + +} + +// Number of Level 1 Point-to-Point(P2P) Hello messages sent. +// L1PointToPointHellosSent returns a uint64 +func (obj *isisMetric) HasL1PointToPointHellosSent() bool { + return obj.obj.L1PointToPointHellosSent != nil +} + +// Number of Level 1 Point-to-Point(P2P) Hello messages sent. +// SetL1PointToPointHellosSent sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL1PointToPointHellosSent(value uint64) IsisMetric { + + obj.obj.L1PointToPointHellosSent = &value + return obj +} + +// Number of Level 1 Point-to-Point(P2P) Hello messages received. +// L1PointToPointHellosReceived returns a uint64 +func (obj *isisMetric) L1PointToPointHellosReceived() uint64 { + + return *obj.obj.L1PointToPointHellosReceived + +} + +// Number of Level 1 Point-to-Point(P2P) Hello messages received. +// L1PointToPointHellosReceived returns a uint64 +func (obj *isisMetric) HasL1PointToPointHellosReceived() bool { + return obj.obj.L1PointToPointHellosReceived != nil +} + +// Number of Level 1 Point-to-Point(P2P) Hello messages received. +// SetL1PointToPointHellosReceived sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL1PointToPointHellosReceived(value uint64) IsisMetric { + + obj.obj.L1PointToPointHellosReceived = &value + return obj +} + +// Number of Link State Updates (LSPs) in the Level 1 LSP Databases. +// L1DatabaseSize returns a uint64 +func (obj *isisMetric) L1DatabaseSize() uint64 { + + return *obj.obj.L1DatabaseSize + +} + +// Number of Link State Updates (LSPs) in the Level 1 LSP Databases. +// L1DatabaseSize returns a uint64 +func (obj *isisMetric) HasL1DatabaseSize() bool { + return obj.obj.L1DatabaseSize != nil +} + +// Number of Link State Updates (LSPs) in the Level 1 LSP Databases. +// SetL1DatabaseSize sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL1DatabaseSize(value uint64) IsisMetric { + + obj.obj.L1DatabaseSize = &value + return obj +} + +// Number of Level 1 (L1) Partial Sequence Number Packet (PSNPs) sent. +// L1PsnpSent returns a uint64 +func (obj *isisMetric) L1PsnpSent() uint64 { + + return *obj.obj.L1PsnpSent + +} + +// Number of Level 1 (L1) Partial Sequence Number Packet (PSNPs) sent. +// L1PsnpSent returns a uint64 +func (obj *isisMetric) HasL1PsnpSent() bool { + return obj.obj.L1PsnpSent != nil +} + +// Number of Level 1 (L1) Partial Sequence Number Packet (PSNPs) sent. +// SetL1PsnpSent sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL1PsnpSent(value uint64) IsisMetric { + + obj.obj.L1PsnpSent = &value + return obj +} + +// Number of Level 1 (L1) Complete Sequence Number Packet (PSNPs) received. +// L1PsnpReceived returns a uint64 +func (obj *isisMetric) L1PsnpReceived() uint64 { + + return *obj.obj.L1PsnpReceived + +} + +// Number of Level 1 (L1) Complete Sequence Number Packet (PSNPs) received. +// L1PsnpReceived returns a uint64 +func (obj *isisMetric) HasL1PsnpReceived() bool { + return obj.obj.L1PsnpReceived != nil +} + +// Number of Level 1 (L1) Complete Sequence Number Packet (PSNPs) received. +// SetL1PsnpReceived sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL1PsnpReceived(value uint64) IsisMetric { + + obj.obj.L1PsnpReceived = &value + return obj +} + +// Number of Level 1 (L1) Complete Sequence Number Packet (CSNPs) sent. +// L1CsnpSent returns a uint64 +func (obj *isisMetric) L1CsnpSent() uint64 { + + return *obj.obj.L1CsnpSent + +} + +// Number of Level 1 (L1) Complete Sequence Number Packet (CSNPs) sent. +// L1CsnpSent returns a uint64 +func (obj *isisMetric) HasL1CsnpSent() bool { + return obj.obj.L1CsnpSent != nil +} + +// Number of Level 1 (L1) Complete Sequence Number Packet (CSNPs) sent. +// SetL1CsnpSent sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL1CsnpSent(value uint64) IsisMetric { + + obj.obj.L1CsnpSent = &value + return obj +} + +// Number of Level 1 (L1) Complete Sequence Number Packet (CSNPs) received. +// L1CsnpReceived returns a uint64 +func (obj *isisMetric) L1CsnpReceived() uint64 { + + return *obj.obj.L1CsnpReceived + +} + +// Number of Level 1 (L1) Complete Sequence Number Packet (CSNPs) received. +// L1CsnpReceived returns a uint64 +func (obj *isisMetric) HasL1CsnpReceived() bool { + return obj.obj.L1CsnpReceived != nil +} + +// Number of Level 1 (L1) Complete Sequence Number Packet (CSNPs) received. +// SetL1CsnpReceived sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL1CsnpReceived(value uint64) IsisMetric { + + obj.obj.L1CsnpReceived = &value + return obj +} + +// Number of Level 1 (L1) Link State Protocol Data Units (LSPs) sent. +// L1LspSent returns a uint64 +func (obj *isisMetric) L1LspSent() uint64 { + + return *obj.obj.L1LspSent + +} + +// Number of Level 1 (L1) Link State Protocol Data Units (LSPs) sent. +// L1LspSent returns a uint64 +func (obj *isisMetric) HasL1LspSent() bool { + return obj.obj.L1LspSent != nil +} + +// Number of Level 1 (L1) Link State Protocol Data Units (LSPs) sent. +// SetL1LspSent sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL1LspSent(value uint64) IsisMetric { + + obj.obj.L1LspSent = &value + return obj +} + +// Number of Level 1 (L1) Link State Protocol Data Units (LSPs) received. +// L1LspReceived returns a uint64 +func (obj *isisMetric) L1LspReceived() uint64 { + + return *obj.obj.L1LspReceived + +} + +// Number of Level 1 (L1) Link State Protocol Data Units (LSPs) received. +// L1LspReceived returns a uint64 +func (obj *isisMetric) HasL1LspReceived() bool { + return obj.obj.L1LspReceived != nil +} + +// Number of Level 1 (L1) Link State Protocol Data Units (LSPs) received. +// SetL1LspReceived sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL1LspReceived(value uint64) IsisMetric { + + obj.obj.L1LspReceived = &value + return obj +} + +// The number of Level 2 (L2) sessions that are fully up. +// L2SessionsUp returns a uint32 +func (obj *isisMetric) L2SessionsUp() uint32 { + + return *obj.obj.L2SessionsUp + +} + +// The number of Level 2 (L2) sessions that are fully up. +// L2SessionsUp returns a uint32 +func (obj *isisMetric) HasL2SessionsUp() bool { + return obj.obj.L2SessionsUp != nil +} + +// The number of Level 2 (L2) sessions that are fully up. +// SetL2SessionsUp sets the uint32 value in the IsisMetric object +func (obj *isisMetric) SetL2SessionsUp(value uint32) IsisMetric { + + obj.obj.L2SessionsUp = &value + return obj +} + +// The number of Level 2 Sessions Flap. +// L2SessionFlap returns a uint64 +func (obj *isisMetric) L2SessionFlap() uint64 { + + return *obj.obj.L2SessionFlap + +} + +// The number of Level 2 Sessions Flap. +// L2SessionFlap returns a uint64 +func (obj *isisMetric) HasL2SessionFlap() bool { + return obj.obj.L2SessionFlap != nil +} + +// The number of Level 2 Sessions Flap. +// SetL2SessionFlap sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL2SessionFlap(value uint64) IsisMetric { + + obj.obj.L2SessionFlap = &value + return obj +} + +// Number of Level 2 Hello messages sent. +// L2BroadcastHellosSent returns a uint64 +func (obj *isisMetric) L2BroadcastHellosSent() uint64 { + + return *obj.obj.L2BroadcastHellosSent + +} + +// Number of Level 2 Hello messages sent. +// L2BroadcastHellosSent returns a uint64 +func (obj *isisMetric) HasL2BroadcastHellosSent() bool { + return obj.obj.L2BroadcastHellosSent != nil +} + +// Number of Level 2 Hello messages sent. +// SetL2BroadcastHellosSent sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL2BroadcastHellosSent(value uint64) IsisMetric { + + obj.obj.L2BroadcastHellosSent = &value + return obj +} + +// Number of Level 2 Hello messages received. +// L2BroadcastHellosReceived returns a uint64 +func (obj *isisMetric) L2BroadcastHellosReceived() uint64 { + + return *obj.obj.L2BroadcastHellosReceived + +} + +// Number of Level 2 Hello messages received. +// L2BroadcastHellosReceived returns a uint64 +func (obj *isisMetric) HasL2BroadcastHellosReceived() bool { + return obj.obj.L2BroadcastHellosReceived != nil +} + +// Number of Level 2 Hello messages received. +// SetL2BroadcastHellosReceived sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL2BroadcastHellosReceived(value uint64) IsisMetric { + + obj.obj.L2BroadcastHellosReceived = &value + return obj +} + +// Number of Level 2 Point-to-Point(P2P) Hello messages sent. +// L2PointToPointHellosSent returns a uint64 +func (obj *isisMetric) L2PointToPointHellosSent() uint64 { + + return *obj.obj.L2PointToPointHellosSent + +} + +// Number of Level 2 Point-to-Point(P2P) Hello messages sent. +// L2PointToPointHellosSent returns a uint64 +func (obj *isisMetric) HasL2PointToPointHellosSent() bool { + return obj.obj.L2PointToPointHellosSent != nil +} + +// Number of Level 2 Point-to-Point(P2P) Hello messages sent. +// SetL2PointToPointHellosSent sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL2PointToPointHellosSent(value uint64) IsisMetric { + + obj.obj.L2PointToPointHellosSent = &value + return obj +} + +// Number of Level 2 Point-to-Point(P2P) Hello messages received. +// L2PointToPointHellosReceived returns a uint64 +func (obj *isisMetric) L2PointToPointHellosReceived() uint64 { + + return *obj.obj.L2PointToPointHellosReceived + +} + +// Number of Level 2 Point-to-Point(P2P) Hello messages received. +// L2PointToPointHellosReceived returns a uint64 +func (obj *isisMetric) HasL2PointToPointHellosReceived() bool { + return obj.obj.L2PointToPointHellosReceived != nil +} + +// Number of Level 2 Point-to-Point(P2P) Hello messages received. +// SetL2PointToPointHellosReceived sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL2PointToPointHellosReceived(value uint64) IsisMetric { + + obj.obj.L2PointToPointHellosReceived = &value + return obj +} + +// Number of Link State Updates (LSPs) in the Level 2 LSP Databases. +// L2DatabaseSize returns a uint64 +func (obj *isisMetric) L2DatabaseSize() uint64 { + + return *obj.obj.L2DatabaseSize + +} + +// Number of Link State Updates (LSPs) in the Level 2 LSP Databases. +// L2DatabaseSize returns a uint64 +func (obj *isisMetric) HasL2DatabaseSize() bool { + return obj.obj.L2DatabaseSize != nil +} + +// Number of Link State Updates (LSPs) in the Level 2 LSP Databases. +// SetL2DatabaseSize sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL2DatabaseSize(value uint64) IsisMetric { + + obj.obj.L2DatabaseSize = &value + return obj +} + +// Number of Level 2 (L2) Partial Sequence Number Packet (PSNPs) sent. +// L2PsnpSent returns a uint64 +func (obj *isisMetric) L2PsnpSent() uint64 { + + return *obj.obj.L2PsnpSent + +} + +// Number of Level 2 (L2) Partial Sequence Number Packet (PSNPs) sent. +// L2PsnpSent returns a uint64 +func (obj *isisMetric) HasL2PsnpSent() bool { + return obj.obj.L2PsnpSent != nil +} + +// Number of Level 2 (L2) Partial Sequence Number Packet (PSNPs) sent. +// SetL2PsnpSent sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL2PsnpSent(value uint64) IsisMetric { + + obj.obj.L2PsnpSent = &value + return obj +} + +// Number of Level 2 (L2) Complete Sequence Number Packet (PSNPs) received. +// L2PsnpReceived returns a uint64 +func (obj *isisMetric) L2PsnpReceived() uint64 { + + return *obj.obj.L2PsnpReceived + +} + +// Number of Level 2 (L2) Complete Sequence Number Packet (PSNPs) received. +// L2PsnpReceived returns a uint64 +func (obj *isisMetric) HasL2PsnpReceived() bool { + return obj.obj.L2PsnpReceived != nil +} + +// Number of Level 2 (L2) Complete Sequence Number Packet (PSNPs) received. +// SetL2PsnpReceived sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL2PsnpReceived(value uint64) IsisMetric { + + obj.obj.L2PsnpReceived = &value + return obj +} + +// Number of Level 2 (L2) Complete Sequence Number Packet (CSNPs) sent. +// L2CsnpSent returns a uint64 +func (obj *isisMetric) L2CsnpSent() uint64 { + + return *obj.obj.L2CsnpSent + +} + +// Number of Level 2 (L2) Complete Sequence Number Packet (CSNPs) sent. +// L2CsnpSent returns a uint64 +func (obj *isisMetric) HasL2CsnpSent() bool { + return obj.obj.L2CsnpSent != nil +} + +// Number of Level 2 (L2) Complete Sequence Number Packet (CSNPs) sent. +// SetL2CsnpSent sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL2CsnpSent(value uint64) IsisMetric { + + obj.obj.L2CsnpSent = &value + return obj +} + +// Number of Level 2 (L2) Complete Sequence Number Packet (CSNPs) received. +// L2CsnpReceived returns a uint64 +func (obj *isisMetric) L2CsnpReceived() uint64 { + + return *obj.obj.L2CsnpReceived + +} + +// Number of Level 2 (L2) Complete Sequence Number Packet (CSNPs) received. +// L2CsnpReceived returns a uint64 +func (obj *isisMetric) HasL2CsnpReceived() bool { + return obj.obj.L2CsnpReceived != nil +} + +// Number of Level 2 (L2) Complete Sequence Number Packet (CSNPs) received. +// SetL2CsnpReceived sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL2CsnpReceived(value uint64) IsisMetric { + + obj.obj.L2CsnpReceived = &value + return obj +} + +// Number of Level 2 (L2) Link State Protocol Data Units (LSPs) sent. +// L2LspSent returns a uint64 +func (obj *isisMetric) L2LspSent() uint64 { + + return *obj.obj.L2LspSent + +} + +// Number of Level 2 (L2) Link State Protocol Data Units (LSPs) sent. +// L2LspSent returns a uint64 +func (obj *isisMetric) HasL2LspSent() bool { + return obj.obj.L2LspSent != nil +} + +// Number of Level 2 (L2) Link State Protocol Data Units (LSPs) sent. +// SetL2LspSent sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL2LspSent(value uint64) IsisMetric { + + obj.obj.L2LspSent = &value + return obj +} + +// Number of Level 2 (L2) Link State Protocol Data Units (LSPs) received. +// L2LspReceived returns a uint64 +func (obj *isisMetric) L2LspReceived() uint64 { + + return *obj.obj.L2LspReceived + +} + +// Number of Level 2 (L2) Link State Protocol Data Units (LSPs) received. +// L2LspReceived returns a uint64 +func (obj *isisMetric) HasL2LspReceived() bool { + return obj.obj.L2LspReceived != nil +} + +// Number of Level 2 (L2) Link State Protocol Data Units (LSPs) received. +// SetL2LspReceived sets the uint64 value in the IsisMetric object +func (obj *isisMetric) SetL2LspReceived(value uint64) IsisMetric { + + obj.obj.L2LspReceived = &value + return obj +} + +func (obj *isisMetric) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *isisMetric) setDefault() { + +} diff --git a/gosnappi/isis_metrics_request.go b/gosnappi/isis_metrics_request.go new file mode 100644 index 00000000..9f8d5bfd --- /dev/null +++ b/gosnappi/isis_metrics_request.go @@ -0,0 +1,401 @@ +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" +) + +// ***** IsisMetricsRequest ***** +type isisMetricsRequest struct { + validation + obj *otg.IsisMetricsRequest + marshaller marshalIsisMetricsRequest + unMarshaller unMarshalIsisMetricsRequest +} + +func NewIsisMetricsRequest() IsisMetricsRequest { + obj := isisMetricsRequest{obj: &otg.IsisMetricsRequest{}} + obj.setDefault() + return &obj +} + +func (obj *isisMetricsRequest) msg() *otg.IsisMetricsRequest { + return obj.obj +} + +func (obj *isisMetricsRequest) setMsg(msg *otg.IsisMetricsRequest) IsisMetricsRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisMetricsRequest struct { + obj *isisMetricsRequest +} + +type marshalIsisMetricsRequest interface { + // ToProto marshals IsisMetricsRequest to protobuf object *otg.IsisMetricsRequest + ToProto() (*otg.IsisMetricsRequest, error) + // ToPbText marshals IsisMetricsRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisMetricsRequest to YAML text + ToYaml() (string, error) + // ToJson marshals IsisMetricsRequest to JSON text + ToJson() (string, error) +} + +type unMarshalisisMetricsRequest struct { + obj *isisMetricsRequest +} + +type unMarshalIsisMetricsRequest interface { + // FromProto unmarshals IsisMetricsRequest from protobuf object *otg.IsisMetricsRequest + FromProto(msg *otg.IsisMetricsRequest) (IsisMetricsRequest, error) + // FromPbText unmarshals IsisMetricsRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisMetricsRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisMetricsRequest from JSON text + FromJson(value string) error +} + +func (obj *isisMetricsRequest) Marshal() marshalIsisMetricsRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalisisMetricsRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *isisMetricsRequest) Unmarshal() unMarshalIsisMetricsRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisMetricsRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisMetricsRequest) ToProto() (*otg.IsisMetricsRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisMetricsRequest) FromProto(msg *otg.IsisMetricsRequest) (IsisMetricsRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisMetricsRequest) 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 *unMarshalisisMetricsRequest) 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 *marshalisisMetricsRequest) 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 *unMarshalisisMetricsRequest) 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 *marshalisisMetricsRequest) 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 *unMarshalisisMetricsRequest) 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 *isisMetricsRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisMetricsRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisMetricsRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisMetricsRequest) Clone() (IsisMetricsRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisMetricsRequest() + 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 +} + +// IsisMetricsRequest is the request to retrieve ISIS per Router metrics/statistics. +type IsisMetricsRequest interface { + Validation + // msg marshals IsisMetricsRequest to protobuf object *otg.IsisMetricsRequest + // and doesn't set defaults + msg() *otg.IsisMetricsRequest + // setMsg unmarshals IsisMetricsRequest from protobuf object *otg.IsisMetricsRequest + // and doesn't set defaults + setMsg(*otg.IsisMetricsRequest) IsisMetricsRequest + // provides marshal interface + Marshal() marshalIsisMetricsRequest + // provides unmarshal interface + Unmarshal() unMarshalIsisMetricsRequest + // validate validates IsisMetricsRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisMetricsRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RouterNames returns []string, set in IsisMetricsRequest. + RouterNames() []string + // SetRouterNames assigns []string provided by user to IsisMetricsRequest + SetRouterNames(value []string) IsisMetricsRequest + // ColumnNames returns []IsisMetricsRequestColumnNamesEnum, set in IsisMetricsRequest + ColumnNames() []IsisMetricsRequestColumnNamesEnum + // SetColumnNames assigns []IsisMetricsRequestColumnNamesEnum provided by user to IsisMetricsRequest + SetColumnNames(value []IsisMetricsRequestColumnNamesEnum) IsisMetricsRequest +} + +// The names of ISIS Routers to return results for. An empty list will return results for all ISIS router. +// +// x-constraint: +// - /components/schemas/Device.IsisRouter/properties/name +// +// x-constraint: +// - /components/schemas/Device.IsisRouter/properties/name +// +// RouterNames returns a []string +func (obj *isisMetricsRequest) RouterNames() []string { + if obj.obj.RouterNames == nil { + obj.obj.RouterNames = make([]string, 0) + } + return obj.obj.RouterNames +} + +// The names of ISIS Routers to return results for. An empty list will return results for all ISIS router. +// +// x-constraint: +// - /components/schemas/Device.IsisRouter/properties/name +// +// x-constraint: +// - /components/schemas/Device.IsisRouter/properties/name +// +// SetRouterNames sets the []string value in the IsisMetricsRequest object +func (obj *isisMetricsRequest) SetRouterNames(value []string) IsisMetricsRequest { + + if obj.obj.RouterNames == nil { + obj.obj.RouterNames = make([]string, 0) + } + obj.obj.RouterNames = value + + return obj +} + +type IsisMetricsRequestColumnNamesEnum string + +// Enum of ColumnNames on IsisMetricsRequest +var IsisMetricsRequestColumnNames = struct { + L1_SESSIONS_UP IsisMetricsRequestColumnNamesEnum + L1_SESSION_FLAP IsisMetricsRequestColumnNamesEnum + L1_DATABASE_SIZE IsisMetricsRequestColumnNamesEnum + L1_BROADCAST_HELLOS_SENT IsisMetricsRequestColumnNamesEnum + L1_BROADCAST_HELLOS_RECEIVED IsisMetricsRequestColumnNamesEnum + L1_POINT_TO_POINT_HELLOS_SENT IsisMetricsRequestColumnNamesEnum + L1_POINT_TO_POINT_HELLOS_RECEIVED IsisMetricsRequestColumnNamesEnum + L1_PSNP_SENT IsisMetricsRequestColumnNamesEnum + L1_PSNP_RECEIVED IsisMetricsRequestColumnNamesEnum + L1_CSNP_SENT IsisMetricsRequestColumnNamesEnum + L1_CSNP_RECEIVED IsisMetricsRequestColumnNamesEnum + L1_LSP_SENT IsisMetricsRequestColumnNamesEnum + L1_LSP_RECEIVED IsisMetricsRequestColumnNamesEnum + L2_SESSIONS_UP IsisMetricsRequestColumnNamesEnum + L2_SESSION_FLAP IsisMetricsRequestColumnNamesEnum + L2_DATABASE_SIZE IsisMetricsRequestColumnNamesEnum + L2_BROADCAST_HELLOS_SENT IsisMetricsRequestColumnNamesEnum + L2_BROADCAST_HELLOS_RECEIVED IsisMetricsRequestColumnNamesEnum + L2_POINT_TO_POINT_HELLOS_SENT IsisMetricsRequestColumnNamesEnum + L2_POINT_TO_POINT_HELLOS_RECEIVED IsisMetricsRequestColumnNamesEnum + L2_PSNP_SENT IsisMetricsRequestColumnNamesEnum + L2_PSNP_RECEIVED IsisMetricsRequestColumnNamesEnum + L2_CSNP_SENT IsisMetricsRequestColumnNamesEnum + L2_CSNP_RECEIVED IsisMetricsRequestColumnNamesEnum + L2_LSP_SENT IsisMetricsRequestColumnNamesEnum + L2_LSP_RECEIVED IsisMetricsRequestColumnNamesEnum +}{ + L1_SESSIONS_UP: IsisMetricsRequestColumnNamesEnum("l1_sessions_up"), + L1_SESSION_FLAP: IsisMetricsRequestColumnNamesEnum("l1_session_flap"), + L1_DATABASE_SIZE: IsisMetricsRequestColumnNamesEnum("l1_database_size"), + L1_BROADCAST_HELLOS_SENT: IsisMetricsRequestColumnNamesEnum("l1_broadcast_hellos_sent"), + L1_BROADCAST_HELLOS_RECEIVED: IsisMetricsRequestColumnNamesEnum("l1_broadcast_hellos_received"), + L1_POINT_TO_POINT_HELLOS_SENT: IsisMetricsRequestColumnNamesEnum("l1_point_to_point_hellos_sent"), + L1_POINT_TO_POINT_HELLOS_RECEIVED: IsisMetricsRequestColumnNamesEnum("l1_point_to_point_hellos_received"), + L1_PSNP_SENT: IsisMetricsRequestColumnNamesEnum("l1_psnp_sent"), + L1_PSNP_RECEIVED: IsisMetricsRequestColumnNamesEnum("l1_psnp_received"), + L1_CSNP_SENT: IsisMetricsRequestColumnNamesEnum("l1_csnp_sent"), + L1_CSNP_RECEIVED: IsisMetricsRequestColumnNamesEnum("l1_csnp_received"), + L1_LSP_SENT: IsisMetricsRequestColumnNamesEnum("l1_lsp_sent"), + L1_LSP_RECEIVED: IsisMetricsRequestColumnNamesEnum("l1_lsp_received"), + L2_SESSIONS_UP: IsisMetricsRequestColumnNamesEnum("l2_sessions_up"), + L2_SESSION_FLAP: IsisMetricsRequestColumnNamesEnum("l2_session_flap"), + L2_DATABASE_SIZE: IsisMetricsRequestColumnNamesEnum("l2_database_size"), + L2_BROADCAST_HELLOS_SENT: IsisMetricsRequestColumnNamesEnum("l2_broadcast_hellos_sent"), + L2_BROADCAST_HELLOS_RECEIVED: IsisMetricsRequestColumnNamesEnum("l2_broadcast_hellos_received"), + L2_POINT_TO_POINT_HELLOS_SENT: IsisMetricsRequestColumnNamesEnum("l2_point_to_point_hellos_sent"), + L2_POINT_TO_POINT_HELLOS_RECEIVED: IsisMetricsRequestColumnNamesEnum("l2_point_to_point_hellos_received"), + L2_PSNP_SENT: IsisMetricsRequestColumnNamesEnum("l2_psnp_sent"), + L2_PSNP_RECEIVED: IsisMetricsRequestColumnNamesEnum("l2_psnp_received"), + L2_CSNP_SENT: IsisMetricsRequestColumnNamesEnum("l2_csnp_sent"), + L2_CSNP_RECEIVED: IsisMetricsRequestColumnNamesEnum("l2_csnp_received"), + L2_LSP_SENT: IsisMetricsRequestColumnNamesEnum("l2_lsp_sent"), + L2_LSP_RECEIVED: IsisMetricsRequestColumnNamesEnum("l2_lsp_received"), +} + +func (obj *isisMetricsRequest) ColumnNames() []IsisMetricsRequestColumnNamesEnum { + items := []IsisMetricsRequestColumnNamesEnum{} + for _, item := range obj.obj.ColumnNames { + items = append(items, IsisMetricsRequestColumnNamesEnum(item.String())) + } + return items +} + +// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned except for any result_groups. The name of the ISIS Router cannot be excluded. +// SetColumnNames sets the []string value in the IsisMetricsRequest object +func (obj *isisMetricsRequest) SetColumnNames(value []IsisMetricsRequestColumnNamesEnum) IsisMetricsRequest { + + items := []otg.IsisMetricsRequest_ColumnNames_Enum{} + for _, item := range value { + intValue := otg.IsisMetricsRequest_ColumnNames_Enum_value[string(item)] + items = append(items, otg.IsisMetricsRequest_ColumnNames_Enum(intValue)) + } + obj.obj.ColumnNames = items + return obj +} + +func (obj *isisMetricsRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *isisMetricsRequest) setDefault() { + +} diff --git a/gosnappi/isis_mt.go b/gosnappi/isis_mt.go new file mode 100644 index 00000000..9b4e5bf5 --- /dev/null +++ b/gosnappi/isis_mt.go @@ -0,0 +1,361 @@ +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" +) + +// ***** IsisMT ***** +type isisMT struct { + validation + obj *otg.IsisMT + marshaller marshalIsisMT + unMarshaller unMarshalIsisMT +} + +func NewIsisMT() IsisMT { + obj := isisMT{obj: &otg.IsisMT{}} + obj.setDefault() + return &obj +} + +func (obj *isisMT) msg() *otg.IsisMT { + return obj.obj +} + +func (obj *isisMT) setMsg(msg *otg.IsisMT) IsisMT { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisMT struct { + obj *isisMT +} + +type marshalIsisMT interface { + // ToProto marshals IsisMT to protobuf object *otg.IsisMT + ToProto() (*otg.IsisMT, error) + // ToPbText marshals IsisMT to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisMT to YAML text + ToYaml() (string, error) + // ToJson marshals IsisMT to JSON text + ToJson() (string, error) +} + +type unMarshalisisMT struct { + obj *isisMT +} + +type unMarshalIsisMT interface { + // FromProto unmarshals IsisMT from protobuf object *otg.IsisMT + FromProto(msg *otg.IsisMT) (IsisMT, error) + // FromPbText unmarshals IsisMT from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisMT from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisMT from JSON text + FromJson(value string) error +} + +func (obj *isisMT) Marshal() marshalIsisMT { + if obj.marshaller == nil { + obj.marshaller = &marshalisisMT{obj: obj} + } + return obj.marshaller +} + +func (obj *isisMT) Unmarshal() unMarshalIsisMT { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisMT{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisMT) ToProto() (*otg.IsisMT, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisMT) FromProto(msg *otg.IsisMT) (IsisMT, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisMT) 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 *unMarshalisisMT) 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 *marshalisisMT) 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 *unMarshalisisMT) 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 *marshalisisMT) 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 *unMarshalisisMT) 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 *isisMT) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisMT) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisMT) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisMT) Clone() (IsisMT, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisMT() + 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 +} + +// IsisMT is configuration of properties per interface per topology when multiple topologies are configured in an ISIS router. +// in a ISIS router. +type IsisMT interface { + Validation + // msg marshals IsisMT to protobuf object *otg.IsisMT + // and doesn't set defaults + msg() *otg.IsisMT + // setMsg unmarshals IsisMT from protobuf object *otg.IsisMT + // and doesn't set defaults + setMsg(*otg.IsisMT) IsisMT + // provides marshal interface + Marshal() marshalIsisMT + // provides unmarshal interface + Unmarshal() unMarshalIsisMT + // validate validates IsisMT + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisMT, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // MtId returns uint32, set in IsisMT. + MtId() uint32 + // SetMtId assigns uint32 provided by user to IsisMT + SetMtId(value uint32) IsisMT + // HasMtId checks if MtId has been set in IsisMT + HasMtId() bool + // LinkMetric returns uint32, set in IsisMT. + LinkMetric() uint32 + // SetLinkMetric assigns uint32 provided by user to IsisMT + SetLinkMetric(value uint32) IsisMT + // HasLinkMetric checks if LinkMetric has been set in IsisMT + HasLinkMetric() bool +} + +// The Multi Topology ID for one of the topologies supported on the ISIS interface. +// MtId returns a uint32 +func (obj *isisMT) MtId() uint32 { + + return *obj.obj.MtId + +} + +// The Multi Topology ID for one of the topologies supported on the ISIS interface. +// MtId returns a uint32 +func (obj *isisMT) HasMtId() bool { + return obj.obj.MtId != nil +} + +// The Multi Topology ID for one of the topologies supported on the ISIS interface. +// SetMtId sets the uint32 value in the IsisMT object +func (obj *isisMT) SetMtId(value uint32) IsisMT { + + obj.obj.MtId = &value + return obj +} + +// Specifies the link metric for this topology on the ISIS interface. +// LinkMetric returns a uint32 +func (obj *isisMT) LinkMetric() uint32 { + + return *obj.obj.LinkMetric + +} + +// Specifies the link metric for this topology on the ISIS interface. +// LinkMetric returns a uint32 +func (obj *isisMT) HasLinkMetric() bool { + return obj.obj.LinkMetric != nil +} + +// Specifies the link metric for this topology on the ISIS interface. +// SetLinkMetric sets the uint32 value in the IsisMT object +func (obj *isisMT) SetLinkMetric(value uint32) IsisMT { + + obj.obj.LinkMetric = &value + return obj +} + +func (obj *isisMT) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.MtId != nil { + + if *obj.obj.MtId > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= IsisMT.MtId <= 65535 but Got %d", *obj.obj.MtId)) + } + + } + + if obj.obj.LinkMetric != nil { + + if *obj.obj.LinkMetric > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= IsisMT.LinkMetric <= 16777215 but Got %d", *obj.obj.LinkMetric)) + } + + } + +} + +func (obj *isisMT) setDefault() { + if obj.obj.MtId == nil { + obj.SetMtId(0) + } + if obj.obj.LinkMetric == nil { + obj.SetLinkMetric(10) + } + +} diff --git a/gosnappi/isis_v4_route_range.go b/gosnappi/isis_v4_route_range.go new file mode 100644 index 00000000..61f9cde8 --- /dev/null +++ b/gosnappi/isis_v4_route_range.go @@ -0,0 +1,680 @@ +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" +) + +// ***** IsisV4RouteRange ***** +type isisV4RouteRange struct { + validation + obj *otg.IsisV4RouteRange + marshaller marshalIsisV4RouteRange + unMarshaller unMarshalIsisV4RouteRange + addressesHolder IsisV4RouteRangeV4RouteAddressIter +} + +func NewIsisV4RouteRange() IsisV4RouteRange { + obj := isisV4RouteRange{obj: &otg.IsisV4RouteRange{}} + obj.setDefault() + return &obj +} + +func (obj *isisV4RouteRange) msg() *otg.IsisV4RouteRange { + return obj.obj +} + +func (obj *isisV4RouteRange) setMsg(msg *otg.IsisV4RouteRange) IsisV4RouteRange { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisV4RouteRange struct { + obj *isisV4RouteRange +} + +type marshalIsisV4RouteRange interface { + // ToProto marshals IsisV4RouteRange to protobuf object *otg.IsisV4RouteRange + ToProto() (*otg.IsisV4RouteRange, error) + // ToPbText marshals IsisV4RouteRange to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisV4RouteRange to YAML text + ToYaml() (string, error) + // ToJson marshals IsisV4RouteRange to JSON text + ToJson() (string, error) +} + +type unMarshalisisV4RouteRange struct { + obj *isisV4RouteRange +} + +type unMarshalIsisV4RouteRange interface { + // FromProto unmarshals IsisV4RouteRange from protobuf object *otg.IsisV4RouteRange + FromProto(msg *otg.IsisV4RouteRange) (IsisV4RouteRange, error) + // FromPbText unmarshals IsisV4RouteRange from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisV4RouteRange from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisV4RouteRange from JSON text + FromJson(value string) error +} + +func (obj *isisV4RouteRange) Marshal() marshalIsisV4RouteRange { + if obj.marshaller == nil { + obj.marshaller = &marshalisisV4RouteRange{obj: obj} + } + return obj.marshaller +} + +func (obj *isisV4RouteRange) Unmarshal() unMarshalIsisV4RouteRange { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisV4RouteRange{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisV4RouteRange) ToProto() (*otg.IsisV4RouteRange, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisV4RouteRange) FromProto(msg *otg.IsisV4RouteRange) (IsisV4RouteRange, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisV4RouteRange) 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 *unMarshalisisV4RouteRange) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisV4RouteRange) 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 *unMarshalisisV4RouteRange) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisV4RouteRange) 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 *unMarshalisisV4RouteRange) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisV4RouteRange) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisV4RouteRange) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisV4RouteRange) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisV4RouteRange) Clone() (IsisV4RouteRange, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisV4RouteRange() + 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 +} + +func (obj *isisV4RouteRange) setNil() { + obj.addressesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisV4RouteRange is emulated ISIS IPv4 routes. +type IsisV4RouteRange interface { + Validation + // msg marshals IsisV4RouteRange to protobuf object *otg.IsisV4RouteRange + // and doesn't set defaults + msg() *otg.IsisV4RouteRange + // setMsg unmarshals IsisV4RouteRange from protobuf object *otg.IsisV4RouteRange + // and doesn't set defaults + setMsg(*otg.IsisV4RouteRange) IsisV4RouteRange + // provides marshal interface + Marshal() marshalIsisV4RouteRange + // provides unmarshal interface + Unmarshal() unMarshalIsisV4RouteRange + // validate validates IsisV4RouteRange + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisV4RouteRange, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Addresses returns IsisV4RouteRangeV4RouteAddressIterIter, set in IsisV4RouteRange + Addresses() IsisV4RouteRangeV4RouteAddressIter + // LinkMetric returns uint32, set in IsisV4RouteRange. + LinkMetric() uint32 + // SetLinkMetric assigns uint32 provided by user to IsisV4RouteRange + SetLinkMetric(value uint32) IsisV4RouteRange + // HasLinkMetric checks if LinkMetric has been set in IsisV4RouteRange + HasLinkMetric() bool + // OriginType returns IsisV4RouteRangeOriginTypeEnum, set in IsisV4RouteRange + OriginType() IsisV4RouteRangeOriginTypeEnum + // SetOriginType assigns IsisV4RouteRangeOriginTypeEnum provided by user to IsisV4RouteRange + SetOriginType(value IsisV4RouteRangeOriginTypeEnum) IsisV4RouteRange + // HasOriginType checks if OriginType has been set in IsisV4RouteRange + HasOriginType() bool + // RedistributionType returns IsisV4RouteRangeRedistributionTypeEnum, set in IsisV4RouteRange + RedistributionType() IsisV4RouteRangeRedistributionTypeEnum + // SetRedistributionType assigns IsisV4RouteRangeRedistributionTypeEnum provided by user to IsisV4RouteRange + SetRedistributionType(value IsisV4RouteRangeRedistributionTypeEnum) IsisV4RouteRange + // HasRedistributionType checks if RedistributionType has been set in IsisV4RouteRange + HasRedistributionType() bool + // Name returns string, set in IsisV4RouteRange. + Name() string + // SetName assigns string provided by user to IsisV4RouteRange + SetName(value string) IsisV4RouteRange + // PrefixAttrEnabled returns bool, set in IsisV4RouteRange. + PrefixAttrEnabled() bool + // SetPrefixAttrEnabled assigns bool provided by user to IsisV4RouteRange + SetPrefixAttrEnabled(value bool) IsisV4RouteRange + // HasPrefixAttrEnabled checks if PrefixAttrEnabled has been set in IsisV4RouteRange + HasPrefixAttrEnabled() bool + // XFlag returns bool, set in IsisV4RouteRange. + XFlag() bool + // SetXFlag assigns bool provided by user to IsisV4RouteRange + SetXFlag(value bool) IsisV4RouteRange + // HasXFlag checks if XFlag has been set in IsisV4RouteRange + HasXFlag() bool + // RFlag returns bool, set in IsisV4RouteRange. + RFlag() bool + // SetRFlag assigns bool provided by user to IsisV4RouteRange + SetRFlag(value bool) IsisV4RouteRange + // HasRFlag checks if RFlag has been set in IsisV4RouteRange + HasRFlag() bool + // NFlag returns bool, set in IsisV4RouteRange. + NFlag() bool + // SetNFlag assigns bool provided by user to IsisV4RouteRange + SetNFlag(value bool) IsisV4RouteRange + // HasNFlag checks if NFlag has been set in IsisV4RouteRange + HasNFlag() bool + setNil() +} + +// A list of group of IPv4 route addresses. +// Addresses returns a []V4RouteAddress +func (obj *isisV4RouteRange) Addresses() IsisV4RouteRangeV4RouteAddressIter { + if len(obj.obj.Addresses) == 0 { + obj.obj.Addresses = []*otg.V4RouteAddress{} + } + if obj.addressesHolder == nil { + obj.addressesHolder = newIsisV4RouteRangeV4RouteAddressIter(&obj.obj.Addresses).setMsg(obj) + } + return obj.addressesHolder +} + +type isisV4RouteRangeV4RouteAddressIter struct { + obj *isisV4RouteRange + v4RouteAddressSlice []V4RouteAddress + fieldPtr *[]*otg.V4RouteAddress +} + +func newIsisV4RouteRangeV4RouteAddressIter(ptr *[]*otg.V4RouteAddress) IsisV4RouteRangeV4RouteAddressIter { + return &isisV4RouteRangeV4RouteAddressIter{fieldPtr: ptr} +} + +type IsisV4RouteRangeV4RouteAddressIter interface { + setMsg(*isisV4RouteRange) IsisV4RouteRangeV4RouteAddressIter + Items() []V4RouteAddress + Add() V4RouteAddress + Append(items ...V4RouteAddress) IsisV4RouteRangeV4RouteAddressIter + Set(index int, newObj V4RouteAddress) IsisV4RouteRangeV4RouteAddressIter + Clear() IsisV4RouteRangeV4RouteAddressIter + clearHolderSlice() IsisV4RouteRangeV4RouteAddressIter + appendHolderSlice(item V4RouteAddress) IsisV4RouteRangeV4RouteAddressIter +} + +func (obj *isisV4RouteRangeV4RouteAddressIter) setMsg(msg *isisV4RouteRange) IsisV4RouteRangeV4RouteAddressIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&v4RouteAddress{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisV4RouteRangeV4RouteAddressIter) Items() []V4RouteAddress { + return obj.v4RouteAddressSlice +} + +func (obj *isisV4RouteRangeV4RouteAddressIter) Add() V4RouteAddress { + newObj := &otg.V4RouteAddress{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &v4RouteAddress{obj: newObj} + newLibObj.setDefault() + obj.v4RouteAddressSlice = append(obj.v4RouteAddressSlice, newLibObj) + return newLibObj +} + +func (obj *isisV4RouteRangeV4RouteAddressIter) Append(items ...V4RouteAddress) IsisV4RouteRangeV4RouteAddressIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.v4RouteAddressSlice = append(obj.v4RouteAddressSlice, item) + } + return obj +} + +func (obj *isisV4RouteRangeV4RouteAddressIter) Set(index int, newObj V4RouteAddress) IsisV4RouteRangeV4RouteAddressIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.v4RouteAddressSlice[index] = newObj + return obj +} +func (obj *isisV4RouteRangeV4RouteAddressIter) Clear() IsisV4RouteRangeV4RouteAddressIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.V4RouteAddress{} + obj.v4RouteAddressSlice = []V4RouteAddress{} + } + return obj +} +func (obj *isisV4RouteRangeV4RouteAddressIter) clearHolderSlice() IsisV4RouteRangeV4RouteAddressIter { + if len(obj.v4RouteAddressSlice) > 0 { + obj.v4RouteAddressSlice = []V4RouteAddress{} + } + return obj +} +func (obj *isisV4RouteRangeV4RouteAddressIter) appendHolderSlice(item V4RouteAddress) IsisV4RouteRangeV4RouteAddressIter { + obj.v4RouteAddressSlice = append(obj.v4RouteAddressSlice, item) + return obj +} + +// The user-defined metric associated with this route range. +// LinkMetric returns a uint32 +func (obj *isisV4RouteRange) LinkMetric() uint32 { + + return *obj.obj.LinkMetric + +} + +// The user-defined metric associated with this route range. +// LinkMetric returns a uint32 +func (obj *isisV4RouteRange) HasLinkMetric() bool { + return obj.obj.LinkMetric != nil +} + +// The user-defined metric associated with this route range. +// SetLinkMetric sets the uint32 value in the IsisV4RouteRange object +func (obj *isisV4RouteRange) SetLinkMetric(value uint32) IsisV4RouteRange { + + obj.obj.LinkMetric = &value + return obj +} + +type IsisV4RouteRangeOriginTypeEnum string + +// Enum of OriginType on IsisV4RouteRange +var IsisV4RouteRangeOriginType = struct { + INTERNAL IsisV4RouteRangeOriginTypeEnum + EXTERNAL IsisV4RouteRangeOriginTypeEnum +}{ + INTERNAL: IsisV4RouteRangeOriginTypeEnum("internal"), + EXTERNAL: IsisV4RouteRangeOriginTypeEnum("external"), +} + +func (obj *isisV4RouteRange) OriginType() IsisV4RouteRangeOriginTypeEnum { + return IsisV4RouteRangeOriginTypeEnum(obj.obj.OriginType.Enum().String()) +} + +// The origin of the advertised route-internal or external to the ISIS area. Options include the following: +// Internal-for intra-area routes, through Level 1 LSPs. +// External-for inter-area routes redistributed within L1, through Level +// 1 LSPs. +// OriginType returns a string +func (obj *isisV4RouteRange) HasOriginType() bool { + return obj.obj.OriginType != nil +} + +func (obj *isisV4RouteRange) SetOriginType(value IsisV4RouteRangeOriginTypeEnum) IsisV4RouteRange { + intValue, ok := otg.IsisV4RouteRange_OriginType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on IsisV4RouteRangeOriginTypeEnum", string(value))) + return obj + } + enumValue := otg.IsisV4RouteRange_OriginType_Enum(intValue) + obj.obj.OriginType = &enumValue + + return obj +} + +type IsisV4RouteRangeRedistributionTypeEnum string + +// Enum of RedistributionType on IsisV4RouteRange +var IsisV4RouteRangeRedistributionType = struct { + UP IsisV4RouteRangeRedistributionTypeEnum + DOWN IsisV4RouteRangeRedistributionTypeEnum +}{ + UP: IsisV4RouteRangeRedistributionTypeEnum("up"), + DOWN: IsisV4RouteRangeRedistributionTypeEnum("down"), +} + +func (obj *isisV4RouteRange) RedistributionType() IsisV4RouteRangeRedistributionTypeEnum { + return IsisV4RouteRangeRedistributionTypeEnum(obj.obj.RedistributionType.Enum().String()) +} + +// Defines the Up/Down (Redistribution) bit defined for TLVs 128 and 130 by RFC 2966. It is used for domain-wide advertisement of prefix information. +// +// Up (0)-used when a prefix is initially advertised within the ISIS L3 +// hierarchy, +// and for all other prefixes in L1 and L2 LSPs. (default) +// Down (1)-used when an L1/L2 router advertises L2 prefixes in L1 LSPs. +// +// The prefixes are being advertised from a higher level (L2) down to a lower level (L1). +// RedistributionType returns a string +func (obj *isisV4RouteRange) HasRedistributionType() bool { + return obj.obj.RedistributionType != nil +} + +func (obj *isisV4RouteRange) SetRedistributionType(value IsisV4RouteRangeRedistributionTypeEnum) IsisV4RouteRange { + intValue, ok := otg.IsisV4RouteRange_RedistributionType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on IsisV4RouteRangeRedistributionTypeEnum", string(value))) + return obj + } + enumValue := otg.IsisV4RouteRange_RedistributionType_Enum(intValue) + obj.obj.RedistributionType = &enumValue + + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *isisV4RouteRange) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the IsisV4RouteRange object +func (obj *isisV4RouteRange) SetName(value string) IsisV4RouteRange { + + obj.obj.Name = &value + return obj +} + +// Specifies whether the sub-TLV for IPv4/IPv6 Extended Reachability Attribute Flags +// will be advertised or not. +// PrefixAttrEnabled returns a bool +func (obj *isisV4RouteRange) PrefixAttrEnabled() bool { + + return *obj.obj.PrefixAttrEnabled + +} + +// Specifies whether the sub-TLV for IPv4/IPv6 Extended Reachability Attribute Flags +// will be advertised or not. +// PrefixAttrEnabled returns a bool +func (obj *isisV4RouteRange) HasPrefixAttrEnabled() bool { + return obj.obj.PrefixAttrEnabled != nil +} + +// Specifies whether the sub-TLV for IPv4/IPv6 Extended Reachability Attribute Flags +// will be advertised or not. +// SetPrefixAttrEnabled sets the bool value in the IsisV4RouteRange object +func (obj *isisV4RouteRange) SetPrefixAttrEnabled(value bool) IsisV4RouteRange { + + obj.obj.PrefixAttrEnabled = &value + return obj +} + +// External Prefix Flag (Bit 0) +// XFlag returns a bool +func (obj *isisV4RouteRange) XFlag() bool { + + return *obj.obj.XFlag + +} + +// External Prefix Flag (Bit 0) +// XFlag returns a bool +func (obj *isisV4RouteRange) HasXFlag() bool { + return obj.obj.XFlag != nil +} + +// External Prefix Flag (Bit 0) +// SetXFlag sets the bool value in the IsisV4RouteRange object +func (obj *isisV4RouteRange) SetXFlag(value bool) IsisV4RouteRange { + + obj.obj.XFlag = &value + return obj +} + +// Re-advertisement Flag (Bit 1) +// RFlag returns a bool +func (obj *isisV4RouteRange) RFlag() bool { + + return *obj.obj.RFlag + +} + +// Re-advertisement Flag (Bit 1) +// RFlag returns a bool +func (obj *isisV4RouteRange) HasRFlag() bool { + return obj.obj.RFlag != nil +} + +// Re-advertisement Flag (Bit 1) +// SetRFlag sets the bool value in the IsisV4RouteRange object +func (obj *isisV4RouteRange) SetRFlag(value bool) IsisV4RouteRange { + + obj.obj.RFlag = &value + return obj +} + +// Node Flag (Bit 2) +// NFlag returns a bool +func (obj *isisV4RouteRange) NFlag() bool { + + return *obj.obj.NFlag + +} + +// Node Flag (Bit 2) +// NFlag returns a bool +func (obj *isisV4RouteRange) HasNFlag() bool { + return obj.obj.NFlag != nil +} + +// Node Flag (Bit 2) +// SetNFlag sets the bool value in the IsisV4RouteRange object +func (obj *isisV4RouteRange) SetNFlag(value bool) IsisV4RouteRange { + + obj.obj.NFlag = &value + return obj +} + +func (obj *isisV4RouteRange) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Addresses) != 0 { + + if set_default { + obj.Addresses().clearHolderSlice() + for _, item := range obj.obj.Addresses { + obj.Addresses().appendHolderSlice(&v4RouteAddress{obj: item}) + } + } + for _, item := range obj.Addresses().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.LinkMetric != nil { + + if *obj.obj.LinkMetric > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= IsisV4RouteRange.LinkMetric <= 16777215 but Got %d", *obj.obj.LinkMetric)) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface IsisV4RouteRange") + } +} + +func (obj *isisV4RouteRange) setDefault() { + if obj.obj.LinkMetric == nil { + obj.SetLinkMetric(0) + } + if obj.obj.OriginType == nil { + obj.SetOriginType(IsisV4RouteRangeOriginType.INTERNAL) + + } + if obj.obj.RedistributionType == nil { + obj.SetRedistributionType(IsisV4RouteRangeRedistributionType.UP) + + } + if obj.obj.PrefixAttrEnabled == nil { + obj.SetPrefixAttrEnabled(false) + } + if obj.obj.XFlag == nil { + obj.SetXFlag(false) + } + if obj.obj.RFlag == nil { + obj.SetRFlag(false) + } + if obj.obj.NFlag == nil { + obj.SetNFlag(false) + } + +} diff --git a/gosnappi/isis_v6_route_range.go b/gosnappi/isis_v6_route_range.go new file mode 100644 index 00000000..4d3f9066 --- /dev/null +++ b/gosnappi/isis_v6_route_range.go @@ -0,0 +1,680 @@ +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" +) + +// ***** IsisV6RouteRange ***** +type isisV6RouteRange struct { + validation + obj *otg.IsisV6RouteRange + marshaller marshalIsisV6RouteRange + unMarshaller unMarshalIsisV6RouteRange + addressesHolder IsisV6RouteRangeV6RouteAddressIter +} + +func NewIsisV6RouteRange() IsisV6RouteRange { + obj := isisV6RouteRange{obj: &otg.IsisV6RouteRange{}} + obj.setDefault() + return &obj +} + +func (obj *isisV6RouteRange) msg() *otg.IsisV6RouteRange { + return obj.obj +} + +func (obj *isisV6RouteRange) setMsg(msg *otg.IsisV6RouteRange) IsisV6RouteRange { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalisisV6RouteRange struct { + obj *isisV6RouteRange +} + +type marshalIsisV6RouteRange interface { + // ToProto marshals IsisV6RouteRange to protobuf object *otg.IsisV6RouteRange + ToProto() (*otg.IsisV6RouteRange, error) + // ToPbText marshals IsisV6RouteRange to protobuf text + ToPbText() (string, error) + // ToYaml marshals IsisV6RouteRange to YAML text + ToYaml() (string, error) + // ToJson marshals IsisV6RouteRange to JSON text + ToJson() (string, error) +} + +type unMarshalisisV6RouteRange struct { + obj *isisV6RouteRange +} + +type unMarshalIsisV6RouteRange interface { + // FromProto unmarshals IsisV6RouteRange from protobuf object *otg.IsisV6RouteRange + FromProto(msg *otg.IsisV6RouteRange) (IsisV6RouteRange, error) + // FromPbText unmarshals IsisV6RouteRange from protobuf text + FromPbText(value string) error + // FromYaml unmarshals IsisV6RouteRange from YAML text + FromYaml(value string) error + // FromJson unmarshals IsisV6RouteRange from JSON text + FromJson(value string) error +} + +func (obj *isisV6RouteRange) Marshal() marshalIsisV6RouteRange { + if obj.marshaller == nil { + obj.marshaller = &marshalisisV6RouteRange{obj: obj} + } + return obj.marshaller +} + +func (obj *isisV6RouteRange) Unmarshal() unMarshalIsisV6RouteRange { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalisisV6RouteRange{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalisisV6RouteRange) ToProto() (*otg.IsisV6RouteRange, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalisisV6RouteRange) FromProto(msg *otg.IsisV6RouteRange) (IsisV6RouteRange, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalisisV6RouteRange) 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 *unMarshalisisV6RouteRange) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalisisV6RouteRange) 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 *unMarshalisisV6RouteRange) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalisisV6RouteRange) 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 *unMarshalisisV6RouteRange) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *isisV6RouteRange) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *isisV6RouteRange) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *isisV6RouteRange) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *isisV6RouteRange) Clone() (IsisV6RouteRange, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewIsisV6RouteRange() + 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 +} + +func (obj *isisV6RouteRange) setNil() { + obj.addressesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// IsisV6RouteRange is emulated ISIS IPv6 routes. +type IsisV6RouteRange interface { + Validation + // msg marshals IsisV6RouteRange to protobuf object *otg.IsisV6RouteRange + // and doesn't set defaults + msg() *otg.IsisV6RouteRange + // setMsg unmarshals IsisV6RouteRange from protobuf object *otg.IsisV6RouteRange + // and doesn't set defaults + setMsg(*otg.IsisV6RouteRange) IsisV6RouteRange + // provides marshal interface + Marshal() marshalIsisV6RouteRange + // provides unmarshal interface + Unmarshal() unMarshalIsisV6RouteRange + // validate validates IsisV6RouteRange + validate() error + // A stringer function + String() string + // Clones the object + Clone() (IsisV6RouteRange, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Addresses returns IsisV6RouteRangeV6RouteAddressIterIter, set in IsisV6RouteRange + Addresses() IsisV6RouteRangeV6RouteAddressIter + // LinkMetric returns uint32, set in IsisV6RouteRange. + LinkMetric() uint32 + // SetLinkMetric assigns uint32 provided by user to IsisV6RouteRange + SetLinkMetric(value uint32) IsisV6RouteRange + // HasLinkMetric checks if LinkMetric has been set in IsisV6RouteRange + HasLinkMetric() bool + // OriginType returns IsisV6RouteRangeOriginTypeEnum, set in IsisV6RouteRange + OriginType() IsisV6RouteRangeOriginTypeEnum + // SetOriginType assigns IsisV6RouteRangeOriginTypeEnum provided by user to IsisV6RouteRange + SetOriginType(value IsisV6RouteRangeOriginTypeEnum) IsisV6RouteRange + // HasOriginType checks if OriginType has been set in IsisV6RouteRange + HasOriginType() bool + // RedistributionType returns IsisV6RouteRangeRedistributionTypeEnum, set in IsisV6RouteRange + RedistributionType() IsisV6RouteRangeRedistributionTypeEnum + // SetRedistributionType assigns IsisV6RouteRangeRedistributionTypeEnum provided by user to IsisV6RouteRange + SetRedistributionType(value IsisV6RouteRangeRedistributionTypeEnum) IsisV6RouteRange + // HasRedistributionType checks if RedistributionType has been set in IsisV6RouteRange + HasRedistributionType() bool + // Name returns string, set in IsisV6RouteRange. + Name() string + // SetName assigns string provided by user to IsisV6RouteRange + SetName(value string) IsisV6RouteRange + // PrefixAttrEnabled returns bool, set in IsisV6RouteRange. + PrefixAttrEnabled() bool + // SetPrefixAttrEnabled assigns bool provided by user to IsisV6RouteRange + SetPrefixAttrEnabled(value bool) IsisV6RouteRange + // HasPrefixAttrEnabled checks if PrefixAttrEnabled has been set in IsisV6RouteRange + HasPrefixAttrEnabled() bool + // XFlag returns bool, set in IsisV6RouteRange. + XFlag() bool + // SetXFlag assigns bool provided by user to IsisV6RouteRange + SetXFlag(value bool) IsisV6RouteRange + // HasXFlag checks if XFlag has been set in IsisV6RouteRange + HasXFlag() bool + // RFlag returns bool, set in IsisV6RouteRange. + RFlag() bool + // SetRFlag assigns bool provided by user to IsisV6RouteRange + SetRFlag(value bool) IsisV6RouteRange + // HasRFlag checks if RFlag has been set in IsisV6RouteRange + HasRFlag() bool + // NFlag returns bool, set in IsisV6RouteRange. + NFlag() bool + // SetNFlag assigns bool provided by user to IsisV6RouteRange + SetNFlag(value bool) IsisV6RouteRange + // HasNFlag checks if NFlag has been set in IsisV6RouteRange + HasNFlag() bool + setNil() +} + +// A list of group of IPv6 route addresses. +// Addresses returns a []V6RouteAddress +func (obj *isisV6RouteRange) Addresses() IsisV6RouteRangeV6RouteAddressIter { + if len(obj.obj.Addresses) == 0 { + obj.obj.Addresses = []*otg.V6RouteAddress{} + } + if obj.addressesHolder == nil { + obj.addressesHolder = newIsisV6RouteRangeV6RouteAddressIter(&obj.obj.Addresses).setMsg(obj) + } + return obj.addressesHolder +} + +type isisV6RouteRangeV6RouteAddressIter struct { + obj *isisV6RouteRange + v6RouteAddressSlice []V6RouteAddress + fieldPtr *[]*otg.V6RouteAddress +} + +func newIsisV6RouteRangeV6RouteAddressIter(ptr *[]*otg.V6RouteAddress) IsisV6RouteRangeV6RouteAddressIter { + return &isisV6RouteRangeV6RouteAddressIter{fieldPtr: ptr} +} + +type IsisV6RouteRangeV6RouteAddressIter interface { + setMsg(*isisV6RouteRange) IsisV6RouteRangeV6RouteAddressIter + Items() []V6RouteAddress + Add() V6RouteAddress + Append(items ...V6RouteAddress) IsisV6RouteRangeV6RouteAddressIter + Set(index int, newObj V6RouteAddress) IsisV6RouteRangeV6RouteAddressIter + Clear() IsisV6RouteRangeV6RouteAddressIter + clearHolderSlice() IsisV6RouteRangeV6RouteAddressIter + appendHolderSlice(item V6RouteAddress) IsisV6RouteRangeV6RouteAddressIter +} + +func (obj *isisV6RouteRangeV6RouteAddressIter) setMsg(msg *isisV6RouteRange) IsisV6RouteRangeV6RouteAddressIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&v6RouteAddress{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *isisV6RouteRangeV6RouteAddressIter) Items() []V6RouteAddress { + return obj.v6RouteAddressSlice +} + +func (obj *isisV6RouteRangeV6RouteAddressIter) Add() V6RouteAddress { + newObj := &otg.V6RouteAddress{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &v6RouteAddress{obj: newObj} + newLibObj.setDefault() + obj.v6RouteAddressSlice = append(obj.v6RouteAddressSlice, newLibObj) + return newLibObj +} + +func (obj *isisV6RouteRangeV6RouteAddressIter) Append(items ...V6RouteAddress) IsisV6RouteRangeV6RouteAddressIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.v6RouteAddressSlice = append(obj.v6RouteAddressSlice, item) + } + return obj +} + +func (obj *isisV6RouteRangeV6RouteAddressIter) Set(index int, newObj V6RouteAddress) IsisV6RouteRangeV6RouteAddressIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.v6RouteAddressSlice[index] = newObj + return obj +} +func (obj *isisV6RouteRangeV6RouteAddressIter) Clear() IsisV6RouteRangeV6RouteAddressIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.V6RouteAddress{} + obj.v6RouteAddressSlice = []V6RouteAddress{} + } + return obj +} +func (obj *isisV6RouteRangeV6RouteAddressIter) clearHolderSlice() IsisV6RouteRangeV6RouteAddressIter { + if len(obj.v6RouteAddressSlice) > 0 { + obj.v6RouteAddressSlice = []V6RouteAddress{} + } + return obj +} +func (obj *isisV6RouteRangeV6RouteAddressIter) appendHolderSlice(item V6RouteAddress) IsisV6RouteRangeV6RouteAddressIter { + obj.v6RouteAddressSlice = append(obj.v6RouteAddressSlice, item) + return obj +} + +// The user-defined metric associated with this route range. +// LinkMetric returns a uint32 +func (obj *isisV6RouteRange) LinkMetric() uint32 { + + return *obj.obj.LinkMetric + +} + +// The user-defined metric associated with this route range. +// LinkMetric returns a uint32 +func (obj *isisV6RouteRange) HasLinkMetric() bool { + return obj.obj.LinkMetric != nil +} + +// The user-defined metric associated with this route range. +// SetLinkMetric sets the uint32 value in the IsisV6RouteRange object +func (obj *isisV6RouteRange) SetLinkMetric(value uint32) IsisV6RouteRange { + + obj.obj.LinkMetric = &value + return obj +} + +type IsisV6RouteRangeOriginTypeEnum string + +// Enum of OriginType on IsisV6RouteRange +var IsisV6RouteRangeOriginType = struct { + INTERNAL IsisV6RouteRangeOriginTypeEnum + EXTERNAL IsisV6RouteRangeOriginTypeEnum +}{ + INTERNAL: IsisV6RouteRangeOriginTypeEnum("internal"), + EXTERNAL: IsisV6RouteRangeOriginTypeEnum("external"), +} + +func (obj *isisV6RouteRange) OriginType() IsisV6RouteRangeOriginTypeEnum { + return IsisV6RouteRangeOriginTypeEnum(obj.obj.OriginType.Enum().String()) +} + +// The origin of the advertised route-internal or external to the ISIS area. Options include the following: +// Internal-for intra-area routes, through Level 1 LSPs. +// External-for inter-area routes redistributed within L1, through Level +// 1 LSPs. +// OriginType returns a string +func (obj *isisV6RouteRange) HasOriginType() bool { + return obj.obj.OriginType != nil +} + +func (obj *isisV6RouteRange) SetOriginType(value IsisV6RouteRangeOriginTypeEnum) IsisV6RouteRange { + intValue, ok := otg.IsisV6RouteRange_OriginType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on IsisV6RouteRangeOriginTypeEnum", string(value))) + return obj + } + enumValue := otg.IsisV6RouteRange_OriginType_Enum(intValue) + obj.obj.OriginType = &enumValue + + return obj +} + +type IsisV6RouteRangeRedistributionTypeEnum string + +// Enum of RedistributionType on IsisV6RouteRange +var IsisV6RouteRangeRedistributionType = struct { + UP IsisV6RouteRangeRedistributionTypeEnum + DOWN IsisV6RouteRangeRedistributionTypeEnum +}{ + UP: IsisV6RouteRangeRedistributionTypeEnum("up"), + DOWN: IsisV6RouteRangeRedistributionTypeEnum("down"), +} + +func (obj *isisV6RouteRange) RedistributionType() IsisV6RouteRangeRedistributionTypeEnum { + return IsisV6RouteRangeRedistributionTypeEnum(obj.obj.RedistributionType.Enum().String()) +} + +// Defines the Up/Down (Redistribution) bit defined for TLVs 128 and 130 by RFC 2966. It is used for domain-wide advertisement of prefix information. +// +// Up (0)-used when a prefix is initially advertised within the ISIS L3 +// hierarchy, +// and for all other prefixes in L1 and L2 LSPs. (default) +// Down (1)-used when an L1/L2 router advertises L2 prefixes in L1 LSPs. +// +// The prefixes are being advertised from a higher level (L2) down to a lower level (L1). +// RedistributionType returns a string +func (obj *isisV6RouteRange) HasRedistributionType() bool { + return obj.obj.RedistributionType != nil +} + +func (obj *isisV6RouteRange) SetRedistributionType(value IsisV6RouteRangeRedistributionTypeEnum) IsisV6RouteRange { + intValue, ok := otg.IsisV6RouteRange_RedistributionType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on IsisV6RouteRangeRedistributionTypeEnum", string(value))) + return obj + } + enumValue := otg.IsisV6RouteRange_RedistributionType_Enum(intValue) + obj.obj.RedistributionType = &enumValue + + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *isisV6RouteRange) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the IsisV6RouteRange object +func (obj *isisV6RouteRange) SetName(value string) IsisV6RouteRange { + + obj.obj.Name = &value + return obj +} + +// Specifies whether the sub-TLV for IPv4/IPv6 Extended Reachability Attribute Flags +// will be advertised or not. +// PrefixAttrEnabled returns a bool +func (obj *isisV6RouteRange) PrefixAttrEnabled() bool { + + return *obj.obj.PrefixAttrEnabled + +} + +// Specifies whether the sub-TLV for IPv4/IPv6 Extended Reachability Attribute Flags +// will be advertised or not. +// PrefixAttrEnabled returns a bool +func (obj *isisV6RouteRange) HasPrefixAttrEnabled() bool { + return obj.obj.PrefixAttrEnabled != nil +} + +// Specifies whether the sub-TLV for IPv4/IPv6 Extended Reachability Attribute Flags +// will be advertised or not. +// SetPrefixAttrEnabled sets the bool value in the IsisV6RouteRange object +func (obj *isisV6RouteRange) SetPrefixAttrEnabled(value bool) IsisV6RouteRange { + + obj.obj.PrefixAttrEnabled = &value + return obj +} + +// External Prefix Flag (Bit 0) +// XFlag returns a bool +func (obj *isisV6RouteRange) XFlag() bool { + + return *obj.obj.XFlag + +} + +// External Prefix Flag (Bit 0) +// XFlag returns a bool +func (obj *isisV6RouteRange) HasXFlag() bool { + return obj.obj.XFlag != nil +} + +// External Prefix Flag (Bit 0) +// SetXFlag sets the bool value in the IsisV6RouteRange object +func (obj *isisV6RouteRange) SetXFlag(value bool) IsisV6RouteRange { + + obj.obj.XFlag = &value + return obj +} + +// Re-advertisement Flag (Bit 1) +// RFlag returns a bool +func (obj *isisV6RouteRange) RFlag() bool { + + return *obj.obj.RFlag + +} + +// Re-advertisement Flag (Bit 1) +// RFlag returns a bool +func (obj *isisV6RouteRange) HasRFlag() bool { + return obj.obj.RFlag != nil +} + +// Re-advertisement Flag (Bit 1) +// SetRFlag sets the bool value in the IsisV6RouteRange object +func (obj *isisV6RouteRange) SetRFlag(value bool) IsisV6RouteRange { + + obj.obj.RFlag = &value + return obj +} + +// Node Flag (Bit 2) +// NFlag returns a bool +func (obj *isisV6RouteRange) NFlag() bool { + + return *obj.obj.NFlag + +} + +// Node Flag (Bit 2) +// NFlag returns a bool +func (obj *isisV6RouteRange) HasNFlag() bool { + return obj.obj.NFlag != nil +} + +// Node Flag (Bit 2) +// SetNFlag sets the bool value in the IsisV6RouteRange object +func (obj *isisV6RouteRange) SetNFlag(value bool) IsisV6RouteRange { + + obj.obj.NFlag = &value + return obj +} + +func (obj *isisV6RouteRange) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Addresses) != 0 { + + if set_default { + obj.Addresses().clearHolderSlice() + for _, item := range obj.obj.Addresses { + obj.Addresses().appendHolderSlice(&v6RouteAddress{obj: item}) + } + } + for _, item := range obj.Addresses().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.LinkMetric != nil { + + if *obj.obj.LinkMetric > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= IsisV6RouteRange.LinkMetric <= 16777215 but Got %d", *obj.obj.LinkMetric)) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface IsisV6RouteRange") + } +} + +func (obj *isisV6RouteRange) setDefault() { + if obj.obj.LinkMetric == nil { + obj.SetLinkMetric(0) + } + if obj.obj.OriginType == nil { + obj.SetOriginType(IsisV6RouteRangeOriginType.INTERNAL) + + } + if obj.obj.RedistributionType == nil { + obj.SetRedistributionType(IsisV6RouteRangeRedistributionType.UP) + + } + if obj.obj.PrefixAttrEnabled == nil { + obj.SetPrefixAttrEnabled(false) + } + if obj.obj.XFlag == nil { + obj.SetXFlag(false) + } + if obj.obj.RFlag == nil { + obj.SetRFlag(false) + } + if obj.obj.NFlag == nil { + obj.SetNFlag(false) + } + +} diff --git a/gosnappi/lacp_metric.go b/gosnappi/lacp_metric.go new file mode 100644 index 00000000..af4fdec1 --- /dev/null +++ b/gosnappi/lacp_metric.go @@ -0,0 +1,808 @@ +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" +) + +// ***** LacpMetric ***** +type lacpMetric struct { + validation + obj *otg.LacpMetric + marshaller marshalLacpMetric + unMarshaller unMarshalLacpMetric +} + +func NewLacpMetric() LacpMetric { + obj := lacpMetric{obj: &otg.LacpMetric{}} + obj.setDefault() + return &obj +} + +func (obj *lacpMetric) msg() *otg.LacpMetric { + return obj.obj +} + +func (obj *lacpMetric) setMsg(msg *otg.LacpMetric) LacpMetric { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallacpMetric struct { + obj *lacpMetric +} + +type marshalLacpMetric interface { + // ToProto marshals LacpMetric to protobuf object *otg.LacpMetric + ToProto() (*otg.LacpMetric, error) + // ToPbText marshals LacpMetric to protobuf text + ToPbText() (string, error) + // ToYaml marshals LacpMetric to YAML text + ToYaml() (string, error) + // ToJson marshals LacpMetric to JSON text + ToJson() (string, error) +} + +type unMarshallacpMetric struct { + obj *lacpMetric +} + +type unMarshalLacpMetric interface { + // FromProto unmarshals LacpMetric from protobuf object *otg.LacpMetric + FromProto(msg *otg.LacpMetric) (LacpMetric, error) + // FromPbText unmarshals LacpMetric from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LacpMetric from YAML text + FromYaml(value string) error + // FromJson unmarshals LacpMetric from JSON text + FromJson(value string) error +} + +func (obj *lacpMetric) Marshal() marshalLacpMetric { + if obj.marshaller == nil { + obj.marshaller = &marshallacpMetric{obj: obj} + } + return obj.marshaller +} + +func (obj *lacpMetric) Unmarshal() unMarshalLacpMetric { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallacpMetric{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallacpMetric) ToProto() (*otg.LacpMetric, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallacpMetric) FromProto(msg *otg.LacpMetric) (LacpMetric, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallacpMetric) 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 *unMarshallacpMetric) 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 *marshallacpMetric) 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 *unMarshallacpMetric) 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 *marshallacpMetric) 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 *unMarshallacpMetric) 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 *lacpMetric) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lacpMetric) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lacpMetric) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lacpMetric) Clone() (LacpMetric, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLacpMetric() + 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 +} + +// LacpMetric is lACP metrics (statistics) per LAG member. +type LacpMetric interface { + Validation + // msg marshals LacpMetric to protobuf object *otg.LacpMetric + // and doesn't set defaults + msg() *otg.LacpMetric + // setMsg unmarshals LacpMetric from protobuf object *otg.LacpMetric + // and doesn't set defaults + setMsg(*otg.LacpMetric) LacpMetric + // provides marshal interface + Marshal() marshalLacpMetric + // provides unmarshal interface + Unmarshal() unMarshalLacpMetric + // validate validates LacpMetric + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LacpMetric, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // LagName returns string, set in LacpMetric. + LagName() string + // SetLagName assigns string provided by user to LacpMetric + SetLagName(value string) LacpMetric + // HasLagName checks if LagName has been set in LacpMetric + HasLagName() bool + // LagMemberPortName returns string, set in LacpMetric. + LagMemberPortName() string + // SetLagMemberPortName assigns string provided by user to LacpMetric + SetLagMemberPortName(value string) LacpMetric + // HasLagMemberPortName checks if LagMemberPortName has been set in LacpMetric + HasLagMemberPortName() bool + // LacpPacketsRx returns uint64, set in LacpMetric. + LacpPacketsRx() uint64 + // SetLacpPacketsRx assigns uint64 provided by user to LacpMetric + SetLacpPacketsRx(value uint64) LacpMetric + // HasLacpPacketsRx checks if LacpPacketsRx has been set in LacpMetric + HasLacpPacketsRx() bool + // LacpPacketsTx returns uint64, set in LacpMetric. + LacpPacketsTx() uint64 + // SetLacpPacketsTx assigns uint64 provided by user to LacpMetric + SetLacpPacketsTx(value uint64) LacpMetric + // HasLacpPacketsTx checks if LacpPacketsTx has been set in LacpMetric + HasLacpPacketsTx() bool + // LacpRxErrors returns uint64, set in LacpMetric. + LacpRxErrors() uint64 + // SetLacpRxErrors assigns uint64 provided by user to LacpMetric + SetLacpRxErrors(value uint64) LacpMetric + // HasLacpRxErrors checks if LacpRxErrors has been set in LacpMetric + HasLacpRxErrors() bool + // Activity returns LacpMetricActivityEnum, set in LacpMetric + Activity() LacpMetricActivityEnum + // SetActivity assigns LacpMetricActivityEnum provided by user to LacpMetric + SetActivity(value LacpMetricActivityEnum) LacpMetric + // HasActivity checks if Activity has been set in LacpMetric + HasActivity() bool + // Timeout returns LacpMetricTimeoutEnum, set in LacpMetric + Timeout() LacpMetricTimeoutEnum + // SetTimeout assigns LacpMetricTimeoutEnum provided by user to LacpMetric + SetTimeout(value LacpMetricTimeoutEnum) LacpMetric + // HasTimeout checks if Timeout has been set in LacpMetric + HasTimeout() bool + // Synchronization returns LacpMetricSynchronizationEnum, set in LacpMetric + Synchronization() LacpMetricSynchronizationEnum + // SetSynchronization assigns LacpMetricSynchronizationEnum provided by user to LacpMetric + SetSynchronization(value LacpMetricSynchronizationEnum) LacpMetric + // HasSynchronization checks if Synchronization has been set in LacpMetric + HasSynchronization() bool + // Aggregatable returns bool, set in LacpMetric. + Aggregatable() bool + // SetAggregatable assigns bool provided by user to LacpMetric + SetAggregatable(value bool) LacpMetric + // HasAggregatable checks if Aggregatable has been set in LacpMetric + HasAggregatable() bool + // Collecting returns bool, set in LacpMetric. + Collecting() bool + // SetCollecting assigns bool provided by user to LacpMetric + SetCollecting(value bool) LacpMetric + // HasCollecting checks if Collecting has been set in LacpMetric + HasCollecting() bool + // Distributing returns bool, set in LacpMetric. + Distributing() bool + // SetDistributing assigns bool provided by user to LacpMetric + SetDistributing(value bool) LacpMetric + // HasDistributing checks if Distributing has been set in LacpMetric + HasDistributing() bool + // SystemId returns string, set in LacpMetric. + SystemId() string + // SetSystemId assigns string provided by user to LacpMetric + SetSystemId(value string) LacpMetric + // HasSystemId checks if SystemId has been set in LacpMetric + HasSystemId() bool + // OperKey returns uint32, set in LacpMetric. + OperKey() uint32 + // SetOperKey assigns uint32 provided by user to LacpMetric + SetOperKey(value uint32) LacpMetric + // HasOperKey checks if OperKey has been set in LacpMetric + HasOperKey() bool + // PartnerId returns string, set in LacpMetric. + PartnerId() string + // SetPartnerId assigns string provided by user to LacpMetric + SetPartnerId(value string) LacpMetric + // HasPartnerId checks if PartnerId has been set in LacpMetric + HasPartnerId() bool + // PartnerKey returns uint32, set in LacpMetric. + PartnerKey() uint32 + // SetPartnerKey assigns uint32 provided by user to LacpMetric + SetPartnerKey(value uint32) LacpMetric + // HasPartnerKey checks if PartnerKey has been set in LacpMetric + HasPartnerKey() bool + // PortNum returns uint32, set in LacpMetric. + PortNum() uint32 + // SetPortNum assigns uint32 provided by user to LacpMetric + SetPortNum(value uint32) LacpMetric + // HasPortNum checks if PortNum has been set in LacpMetric + HasPortNum() bool + // PartnerPortNum returns uint32, set in LacpMetric. + PartnerPortNum() uint32 + // SetPartnerPortNum assigns uint32 provided by user to LacpMetric + SetPartnerPortNum(value uint32) LacpMetric + // HasPartnerPortNum checks if PartnerPortNum has been set in LacpMetric + HasPartnerPortNum() bool +} + +// The name of a LAG (ports group) configured with LACP. +// LagName returns a string +func (obj *lacpMetric) LagName() string { + + return *obj.obj.LagName + +} + +// The name of a LAG (ports group) configured with LACP. +// LagName returns a string +func (obj *lacpMetric) HasLagName() bool { + return obj.obj.LagName != nil +} + +// The name of a LAG (ports group) configured with LACP. +// SetLagName sets the string value in the LacpMetric object +func (obj *lacpMetric) SetLagName(value string) LacpMetric { + + obj.obj.LagName = &value + return obj +} + +// The name of a LAG member (port) configured with LACP. +// LagMemberPortName returns a string +func (obj *lacpMetric) LagMemberPortName() string { + + return *obj.obj.LagMemberPortName + +} + +// The name of a LAG member (port) configured with LACP. +// LagMemberPortName returns a string +func (obj *lacpMetric) HasLagMemberPortName() bool { + return obj.obj.LagMemberPortName != nil +} + +// The name of a LAG member (port) configured with LACP. +// SetLagMemberPortName sets the string value in the LacpMetric object +func (obj *lacpMetric) SetLagMemberPortName(value string) LacpMetric { + + obj.obj.LagMemberPortName = &value + return obj +} + +// Number of LACPDUs received. +// LacpPacketsRx returns a uint64 +func (obj *lacpMetric) LacpPacketsRx() uint64 { + + return *obj.obj.LacpPacketsRx + +} + +// Number of LACPDUs received. +// LacpPacketsRx returns a uint64 +func (obj *lacpMetric) HasLacpPacketsRx() bool { + return obj.obj.LacpPacketsRx != nil +} + +// Number of LACPDUs received. +// SetLacpPacketsRx sets the uint64 value in the LacpMetric object +func (obj *lacpMetric) SetLacpPacketsRx(value uint64) LacpMetric { + + obj.obj.LacpPacketsRx = &value + return obj +} + +// Number of LACPDUs transmitted. +// LacpPacketsTx returns a uint64 +func (obj *lacpMetric) LacpPacketsTx() uint64 { + + return *obj.obj.LacpPacketsTx + +} + +// Number of LACPDUs transmitted. +// LacpPacketsTx returns a uint64 +func (obj *lacpMetric) HasLacpPacketsTx() bool { + return obj.obj.LacpPacketsTx != nil +} + +// Number of LACPDUs transmitted. +// SetLacpPacketsTx sets the uint64 value in the LacpMetric object +func (obj *lacpMetric) SetLacpPacketsTx(value uint64) LacpMetric { + + obj.obj.LacpPacketsTx = &value + return obj +} + +// Number of LACPDUs receive packet errors. +// LacpRxErrors returns a uint64 +func (obj *lacpMetric) LacpRxErrors() uint64 { + + return *obj.obj.LacpRxErrors + +} + +// Number of LACPDUs receive packet errors. +// LacpRxErrors returns a uint64 +func (obj *lacpMetric) HasLacpRxErrors() bool { + return obj.obj.LacpRxErrors != nil +} + +// Number of LACPDUs receive packet errors. +// SetLacpRxErrors sets the uint64 value in the LacpMetric object +func (obj *lacpMetric) SetLacpRxErrors(value uint64) LacpMetric { + + obj.obj.LacpRxErrors = &value + return obj +} + +type LacpMetricActivityEnum string + +// Enum of Activity on LacpMetric +var LacpMetricActivity = struct { + ACTIVE LacpMetricActivityEnum + PASSIVE LacpMetricActivityEnum +}{ + ACTIVE: LacpMetricActivityEnum("active"), + PASSIVE: LacpMetricActivityEnum("passive"), +} + +func (obj *lacpMetric) Activity() LacpMetricActivityEnum { + return LacpMetricActivityEnum(obj.obj.Activity.Enum().String()) +} + +// Indicates participant is active or passive. +// Activity returns a string +func (obj *lacpMetric) HasActivity() bool { + return obj.obj.Activity != nil +} + +func (obj *lacpMetric) SetActivity(value LacpMetricActivityEnum) LacpMetric { + intValue, ok := otg.LacpMetric_Activity_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LacpMetricActivityEnum", string(value))) + return obj + } + enumValue := otg.LacpMetric_Activity_Enum(intValue) + obj.obj.Activity = &enumValue + + return obj +} + +type LacpMetricTimeoutEnum string + +// Enum of Timeout on LacpMetric +var LacpMetricTimeout = struct { + SHORT LacpMetricTimeoutEnum + LONG LacpMetricTimeoutEnum +}{ + SHORT: LacpMetricTimeoutEnum("short"), + LONG: LacpMetricTimeoutEnum("long"), +} + +func (obj *lacpMetric) Timeout() LacpMetricTimeoutEnum { + return LacpMetricTimeoutEnum(obj.obj.Timeout.Enum().String()) +} + +// The timeout type (short or long) used by the participant. +// Timeout returns a string +func (obj *lacpMetric) HasTimeout() bool { + return obj.obj.Timeout != nil +} + +func (obj *lacpMetric) SetTimeout(value LacpMetricTimeoutEnum) LacpMetric { + intValue, ok := otg.LacpMetric_Timeout_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LacpMetricTimeoutEnum", string(value))) + return obj + } + enumValue := otg.LacpMetric_Timeout_Enum(intValue) + obj.obj.Timeout = &enumValue + + return obj +} + +type LacpMetricSynchronizationEnum string + +// Enum of Synchronization on LacpMetric +var LacpMetricSynchronization = struct { + IN_SYNC LacpMetricSynchronizationEnum + OUT_SYNC LacpMetricSynchronizationEnum +}{ + IN_SYNC: LacpMetricSynchronizationEnum("in_sync"), + OUT_SYNC: LacpMetricSynchronizationEnum("out_sync"), +} + +func (obj *lacpMetric) Synchronization() LacpMetricSynchronizationEnum { + return LacpMetricSynchronizationEnum(obj.obj.Synchronization.Enum().String()) +} + +// Indicates whether the participant is in-sync or out-of-sync. +// Synchronization returns a string +func (obj *lacpMetric) HasSynchronization() bool { + return obj.obj.Synchronization != nil +} + +func (obj *lacpMetric) SetSynchronization(value LacpMetricSynchronizationEnum) LacpMetric { + intValue, ok := otg.LacpMetric_Synchronization_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LacpMetricSynchronizationEnum", string(value))) + return obj + } + enumValue := otg.LacpMetric_Synchronization_Enum(intValue) + obj.obj.Synchronization = &enumValue + + return obj +} + +// A true value indicates that the participant will allow the link to be used as part of the aggregate. A false value indicates the link should be used as an individual link. +// Aggregatable returns a bool +func (obj *lacpMetric) Aggregatable() bool { + + return *obj.obj.Aggregatable + +} + +// A true value indicates that the participant will allow the link to be used as part of the aggregate. A false value indicates the link should be used as an individual link. +// Aggregatable returns a bool +func (obj *lacpMetric) HasAggregatable() bool { + return obj.obj.Aggregatable != nil +} + +// A true value indicates that the participant will allow the link to be used as part of the aggregate. A false value indicates the link should be used as an individual link. +// SetAggregatable sets the bool value in the LacpMetric object +func (obj *lacpMetric) SetAggregatable(value bool) LacpMetric { + + obj.obj.Aggregatable = &value + return obj +} + +// If true, the participant is collecting incoming frames on the link, otherwise false. +// Collecting returns a bool +func (obj *lacpMetric) Collecting() bool { + + return *obj.obj.Collecting + +} + +// If true, the participant is collecting incoming frames on the link, otherwise false. +// Collecting returns a bool +func (obj *lacpMetric) HasCollecting() bool { + return obj.obj.Collecting != nil +} + +// If true, the participant is collecting incoming frames on the link, otherwise false. +// SetCollecting sets the bool value in the LacpMetric object +func (obj *lacpMetric) SetCollecting(value bool) LacpMetric { + + obj.obj.Collecting = &value + return obj +} + +// When true, the participant is distributing outgoing frames; when false, distribution is disabled. +// Distributing returns a bool +func (obj *lacpMetric) Distributing() bool { + + return *obj.obj.Distributing + +} + +// When true, the participant is distributing outgoing frames; when false, distribution is disabled. +// Distributing returns a bool +func (obj *lacpMetric) HasDistributing() bool { + return obj.obj.Distributing != nil +} + +// When true, the participant is distributing outgoing frames; when false, distribution is disabled. +// SetDistributing sets the bool value in the LacpMetric object +func (obj *lacpMetric) SetDistributing(value bool) LacpMetric { + + obj.obj.Distributing = &value + return obj +} + +// MAC address that defines the local system ID for the aggregate interface. +// SystemId returns a string +func (obj *lacpMetric) SystemId() string { + + return *obj.obj.SystemId + +} + +// MAC address that defines the local system ID for the aggregate interface. +// SystemId returns a string +func (obj *lacpMetric) HasSystemId() bool { + return obj.obj.SystemId != nil +} + +// MAC address that defines the local system ID for the aggregate interface. +// SetSystemId sets the string value in the LacpMetric object +func (obj *lacpMetric) SetSystemId(value string) LacpMetric { + + obj.obj.SystemId = &value + return obj +} + +// Current operational value of the key for the aggregate interface. +// OperKey returns a uint32 +func (obj *lacpMetric) OperKey() uint32 { + + return *obj.obj.OperKey + +} + +// Current operational value of the key for the aggregate interface. +// OperKey returns a uint32 +func (obj *lacpMetric) HasOperKey() bool { + return obj.obj.OperKey != nil +} + +// Current operational value of the key for the aggregate interface. +// SetOperKey sets the uint32 value in the LacpMetric object +func (obj *lacpMetric) SetOperKey(value uint32) LacpMetric { + + obj.obj.OperKey = &value + return obj +} + +// MAC address representing the protocol partner's interface system ID. +// PartnerId returns a string +func (obj *lacpMetric) PartnerId() string { + + return *obj.obj.PartnerId + +} + +// MAC address representing the protocol partner's interface system ID. +// PartnerId returns a string +func (obj *lacpMetric) HasPartnerId() bool { + return obj.obj.PartnerId != nil +} + +// MAC address representing the protocol partner's interface system ID. +// SetPartnerId sets the string value in the LacpMetric object +func (obj *lacpMetric) SetPartnerId(value string) LacpMetric { + + obj.obj.PartnerId = &value + return obj +} + +// Operational value of the protocol partner's key. +// PartnerKey returns a uint32 +func (obj *lacpMetric) PartnerKey() uint32 { + + return *obj.obj.PartnerKey + +} + +// Operational value of the protocol partner's key. +// PartnerKey returns a uint32 +func (obj *lacpMetric) HasPartnerKey() bool { + return obj.obj.PartnerKey != nil +} + +// Operational value of the protocol partner's key. +// SetPartnerKey sets the uint32 value in the LacpMetric object +func (obj *lacpMetric) SetPartnerKey(value uint32) LacpMetric { + + obj.obj.PartnerKey = &value + return obj +} + +// Port number of the local (actor) aggregation member. +// PortNum returns a uint32 +func (obj *lacpMetric) PortNum() uint32 { + + return *obj.obj.PortNum + +} + +// Port number of the local (actor) aggregation member. +// PortNum returns a uint32 +func (obj *lacpMetric) HasPortNum() bool { + return obj.obj.PortNum != nil +} + +// Port number of the local (actor) aggregation member. +// SetPortNum sets the uint32 value in the LacpMetric object +func (obj *lacpMetric) SetPortNum(value uint32) LacpMetric { + + obj.obj.PortNum = &value + return obj +} + +// Port number of the partner (remote) port for this member port. +// PartnerPortNum returns a uint32 +func (obj *lacpMetric) PartnerPortNum() uint32 { + + return *obj.obj.PartnerPortNum + +} + +// Port number of the partner (remote) port for this member port. +// PartnerPortNum returns a uint32 +func (obj *lacpMetric) HasPartnerPortNum() bool { + return obj.obj.PartnerPortNum != nil +} + +// Port number of the partner (remote) port for this member port. +// SetPartnerPortNum sets the uint32 value in the LacpMetric object +func (obj *lacpMetric) SetPartnerPortNum(value uint32) LacpMetric { + + obj.obj.PartnerPortNum = &value + return obj +} + +func (obj *lacpMetric) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.SystemId != nil { + + err := obj.validateMac(obj.SystemId()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on LacpMetric.SystemId")) + } + + } + + if obj.obj.PartnerId != nil { + + err := obj.validateMac(obj.PartnerId()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on LacpMetric.PartnerId")) + } + + } + +} + +func (obj *lacpMetric) setDefault() { + +} diff --git a/gosnappi/lacp_metrics_request.go b/gosnappi/lacp_metrics_request.go new file mode 100644 index 00000000..998c38f9 --- /dev/null +++ b/gosnappi/lacp_metrics_request.go @@ -0,0 +1,418 @@ +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" +) + +// ***** LacpMetricsRequest ***** +type lacpMetricsRequest struct { + validation + obj *otg.LacpMetricsRequest + marshaller marshalLacpMetricsRequest + unMarshaller unMarshalLacpMetricsRequest +} + +func NewLacpMetricsRequest() LacpMetricsRequest { + obj := lacpMetricsRequest{obj: &otg.LacpMetricsRequest{}} + obj.setDefault() + return &obj +} + +func (obj *lacpMetricsRequest) msg() *otg.LacpMetricsRequest { + return obj.obj +} + +func (obj *lacpMetricsRequest) setMsg(msg *otg.LacpMetricsRequest) LacpMetricsRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallacpMetricsRequest struct { + obj *lacpMetricsRequest +} + +type marshalLacpMetricsRequest interface { + // ToProto marshals LacpMetricsRequest to protobuf object *otg.LacpMetricsRequest + ToProto() (*otg.LacpMetricsRequest, error) + // ToPbText marshals LacpMetricsRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals LacpMetricsRequest to YAML text + ToYaml() (string, error) + // ToJson marshals LacpMetricsRequest to JSON text + ToJson() (string, error) +} + +type unMarshallacpMetricsRequest struct { + obj *lacpMetricsRequest +} + +type unMarshalLacpMetricsRequest interface { + // FromProto unmarshals LacpMetricsRequest from protobuf object *otg.LacpMetricsRequest + FromProto(msg *otg.LacpMetricsRequest) (LacpMetricsRequest, error) + // FromPbText unmarshals LacpMetricsRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LacpMetricsRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals LacpMetricsRequest from JSON text + FromJson(value string) error +} + +func (obj *lacpMetricsRequest) Marshal() marshalLacpMetricsRequest { + if obj.marshaller == nil { + obj.marshaller = &marshallacpMetricsRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *lacpMetricsRequest) Unmarshal() unMarshalLacpMetricsRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallacpMetricsRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallacpMetricsRequest) ToProto() (*otg.LacpMetricsRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallacpMetricsRequest) FromProto(msg *otg.LacpMetricsRequest) (LacpMetricsRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallacpMetricsRequest) 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 *unMarshallacpMetricsRequest) 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 *marshallacpMetricsRequest) 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 *unMarshallacpMetricsRequest) 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 *marshallacpMetricsRequest) 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 *unMarshallacpMetricsRequest) 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 *lacpMetricsRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lacpMetricsRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lacpMetricsRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lacpMetricsRequest) Clone() (LacpMetricsRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLacpMetricsRequest() + 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 +} + +// LacpMetricsRequest is the request to retrieve LACP per LAG member metrics/statistics. +type LacpMetricsRequest interface { + Validation + // msg marshals LacpMetricsRequest to protobuf object *otg.LacpMetricsRequest + // and doesn't set defaults + msg() *otg.LacpMetricsRequest + // setMsg unmarshals LacpMetricsRequest from protobuf object *otg.LacpMetricsRequest + // and doesn't set defaults + setMsg(*otg.LacpMetricsRequest) LacpMetricsRequest + // provides marshal interface + Marshal() marshalLacpMetricsRequest + // provides unmarshal interface + Unmarshal() unMarshalLacpMetricsRequest + // validate validates LacpMetricsRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LacpMetricsRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // LagNames returns []string, set in LacpMetricsRequest. + LagNames() []string + // SetLagNames assigns []string provided by user to LacpMetricsRequest + SetLagNames(value []string) LacpMetricsRequest + // LagMemberPortNames returns []string, set in LacpMetricsRequest. + LagMemberPortNames() []string + // SetLagMemberPortNames assigns []string provided by user to LacpMetricsRequest + SetLagMemberPortNames(value []string) LacpMetricsRequest + // ColumnNames returns []LacpMetricsRequestColumnNamesEnum, set in LacpMetricsRequest + ColumnNames() []LacpMetricsRequestColumnNamesEnum + // SetColumnNames assigns []LacpMetricsRequestColumnNamesEnum provided by user to LacpMetricsRequest + SetColumnNames(value []LacpMetricsRequestColumnNamesEnum) LacpMetricsRequest +} + +// The names of LAG (ports group) for which LACP metrics to be returned. An empty list will return metrics for all LAGs. +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// LagNames returns a []string +func (obj *lacpMetricsRequest) LagNames() []string { + if obj.obj.LagNames == nil { + obj.obj.LagNames = make([]string, 0) + } + return obj.obj.LagNames +} + +// The names of LAG (ports group) for which LACP metrics to be returned. An empty list will return metrics for all LAGs. +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// SetLagNames sets the []string value in the LacpMetricsRequest object +func (obj *lacpMetricsRequest) SetLagNames(value []string) LacpMetricsRequest { + + if obj.obj.LagNames == nil { + obj.obj.LagNames = make([]string, 0) + } + obj.obj.LagNames = value + + return obj +} + +// The names of LAG members (ports) for which LACP metrics to be returned. An empty list will return metrics for all LAG members. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// LagMemberPortNames returns a []string +func (obj *lacpMetricsRequest) LagMemberPortNames() []string { + if obj.obj.LagMemberPortNames == nil { + obj.obj.LagMemberPortNames = make([]string, 0) + } + return obj.obj.LagMemberPortNames +} + +// The names of LAG members (ports) for which LACP metrics to be returned. An empty list will return metrics for all LAG members. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// SetLagMemberPortNames sets the []string value in the LacpMetricsRequest object +func (obj *lacpMetricsRequest) SetLagMemberPortNames(value []string) LacpMetricsRequest { + + if obj.obj.LagMemberPortNames == nil { + obj.obj.LagMemberPortNames = make([]string, 0) + } + obj.obj.LagMemberPortNames = value + + return obj +} + +type LacpMetricsRequestColumnNamesEnum string + +// Enum of ColumnNames on LacpMetricsRequest +var LacpMetricsRequestColumnNames = struct { + LACP_PACKETS_RX LacpMetricsRequestColumnNamesEnum + LACP_PACKETS_TX LacpMetricsRequestColumnNamesEnum + LACP_RX_ERRORS LacpMetricsRequestColumnNamesEnum + ACTIVITY LacpMetricsRequestColumnNamesEnum + TIMEOUT LacpMetricsRequestColumnNamesEnum + SYNCHRONIZATION LacpMetricsRequestColumnNamesEnum + AGGREGATABLE LacpMetricsRequestColumnNamesEnum + COLLECTING LacpMetricsRequestColumnNamesEnum + DISTRIBUTING LacpMetricsRequestColumnNamesEnum + SYSTEM_ID LacpMetricsRequestColumnNamesEnum + OPER_KEY LacpMetricsRequestColumnNamesEnum + PARTNER_ID LacpMetricsRequestColumnNamesEnum + PARTNER_KEY LacpMetricsRequestColumnNamesEnum + PORT_NUM LacpMetricsRequestColumnNamesEnum + PARTNER_PORT_NUM LacpMetricsRequestColumnNamesEnum +}{ + LACP_PACKETS_RX: LacpMetricsRequestColumnNamesEnum("lacp_packets_rx"), + LACP_PACKETS_TX: LacpMetricsRequestColumnNamesEnum("lacp_packets_tx"), + LACP_RX_ERRORS: LacpMetricsRequestColumnNamesEnum("lacp_rx_errors"), + ACTIVITY: LacpMetricsRequestColumnNamesEnum("activity"), + TIMEOUT: LacpMetricsRequestColumnNamesEnum("timeout"), + SYNCHRONIZATION: LacpMetricsRequestColumnNamesEnum("synchronization"), + AGGREGATABLE: LacpMetricsRequestColumnNamesEnum("aggregatable"), + COLLECTING: LacpMetricsRequestColumnNamesEnum("collecting"), + DISTRIBUTING: LacpMetricsRequestColumnNamesEnum("distributing"), + SYSTEM_ID: LacpMetricsRequestColumnNamesEnum("system_id"), + OPER_KEY: LacpMetricsRequestColumnNamesEnum("oper_key"), + PARTNER_ID: LacpMetricsRequestColumnNamesEnum("partner_id"), + PARTNER_KEY: LacpMetricsRequestColumnNamesEnum("partner_key"), + PORT_NUM: LacpMetricsRequestColumnNamesEnum("port_num"), + PARTNER_PORT_NUM: LacpMetricsRequestColumnNamesEnum("partner_port_num"), +} + +func (obj *lacpMetricsRequest) ColumnNames() []LacpMetricsRequestColumnNamesEnum { + items := []LacpMetricsRequestColumnNamesEnum{} + for _, item := range obj.obj.ColumnNames { + items = append(items, LacpMetricsRequestColumnNamesEnum(item.String())) + } + return items +} + +// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned. The name of LAG and LAG member can not be excluded. +// SetColumnNames sets the []string value in the LacpMetricsRequest object +func (obj *lacpMetricsRequest) SetColumnNames(value []LacpMetricsRequestColumnNamesEnum) LacpMetricsRequest { + + items := []otg.LacpMetricsRequest_ColumnNames_Enum{} + for _, item := range value { + intValue := otg.LacpMetricsRequest_ColumnNames_Enum_value[string(item)] + items = append(items, otg.LacpMetricsRequest_ColumnNames_Enum(intValue)) + } + obj.obj.ColumnNames = items + return obj +} + +func (obj *lacpMetricsRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *lacpMetricsRequest) setDefault() { + +} diff --git a/gosnappi/lag.go b/gosnappi/lag.go new file mode 100644 index 00000000..e6d96870 --- /dev/null +++ b/gosnappi/lag.go @@ -0,0 +1,501 @@ +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" +) + +// ***** Lag ***** +type lag struct { + validation + obj *otg.Lag + marshaller marshalLag + unMarshaller unMarshalLag + portsHolder LagLagPortIter + protocolHolder LagProtocol +} + +func NewLag() Lag { + obj := lag{obj: &otg.Lag{}} + obj.setDefault() + return &obj +} + +func (obj *lag) msg() *otg.Lag { + return obj.obj +} + +func (obj *lag) setMsg(msg *otg.Lag) Lag { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshallag struct { + obj *lag +} + +type marshalLag interface { + // ToProto marshals Lag to protobuf object *otg.Lag + ToProto() (*otg.Lag, error) + // ToPbText marshals Lag to protobuf text + ToPbText() (string, error) + // ToYaml marshals Lag to YAML text + ToYaml() (string, error) + // ToJson marshals Lag to JSON text + ToJson() (string, error) +} + +type unMarshallag struct { + obj *lag +} + +type unMarshalLag interface { + // FromProto unmarshals Lag from protobuf object *otg.Lag + FromProto(msg *otg.Lag) (Lag, error) + // FromPbText unmarshals Lag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Lag from YAML text + FromYaml(value string) error + // FromJson unmarshals Lag from JSON text + FromJson(value string) error +} + +func (obj *lag) Marshal() marshalLag { + if obj.marshaller == nil { + obj.marshaller = &marshallag{obj: obj} + } + return obj.marshaller +} + +func (obj *lag) Unmarshal() unMarshalLag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallag) ToProto() (*otg.Lag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallag) FromProto(msg *otg.Lag) (Lag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallag) 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 *unMarshallag) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshallag) 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 *unMarshallag) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshallag) 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 *unMarshallag) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *lag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lag) Clone() (Lag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLag() + 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 +} + +func (obj *lag) setNil() { + obj.portsHolder = nil + obj.protocolHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// Lag is the container for LAG (ports group) - aggregation of multiple LAG members (ports) +type Lag interface { + Validation + // msg marshals Lag to protobuf object *otg.Lag + // and doesn't set defaults + msg() *otg.Lag + // setMsg unmarshals Lag from protobuf object *otg.Lag + // and doesn't set defaults + setMsg(*otg.Lag) Lag + // provides marshal interface + Marshal() marshalLag + // provides unmarshal interface + Unmarshal() unMarshalLag + // validate validates Lag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Lag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ports returns LagLagPortIterIter, set in Lag + Ports() LagLagPortIter + // Protocol returns LagProtocol, set in Lag. + // LagProtocol is description is TBD + Protocol() LagProtocol + // SetProtocol assigns LagProtocol provided by user to Lag. + // LagProtocol is description is TBD + SetProtocol(value LagProtocol) Lag + // HasProtocol checks if Protocol has been set in Lag + HasProtocol() bool + // MinLinks returns uint32, set in Lag. + MinLinks() uint32 + // SetMinLinks assigns uint32 provided by user to Lag + SetMinLinks(value uint32) Lag + // HasMinLinks checks if MinLinks has been set in Lag + HasMinLinks() bool + // Name returns string, set in Lag. + Name() string + // SetName assigns string provided by user to Lag + SetName(value string) Lag + setNil() +} + +// description is TBD +// Ports returns a []LagPort +func (obj *lag) Ports() LagLagPortIter { + if len(obj.obj.Ports) == 0 { + obj.obj.Ports = []*otg.LagPort{} + } + if obj.portsHolder == nil { + obj.portsHolder = newLagLagPortIter(&obj.obj.Ports).setMsg(obj) + } + return obj.portsHolder +} + +type lagLagPortIter struct { + obj *lag + lagPortSlice []LagPort + fieldPtr *[]*otg.LagPort +} + +func newLagLagPortIter(ptr *[]*otg.LagPort) LagLagPortIter { + return &lagLagPortIter{fieldPtr: ptr} +} + +type LagLagPortIter interface { + setMsg(*lag) LagLagPortIter + Items() []LagPort + Add() LagPort + Append(items ...LagPort) LagLagPortIter + Set(index int, newObj LagPort) LagLagPortIter + Clear() LagLagPortIter + clearHolderSlice() LagLagPortIter + appendHolderSlice(item LagPort) LagLagPortIter +} + +func (obj *lagLagPortIter) setMsg(msg *lag) LagLagPortIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&lagPort{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *lagLagPortIter) Items() []LagPort { + return obj.lagPortSlice +} + +func (obj *lagLagPortIter) Add() LagPort { + newObj := &otg.LagPort{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &lagPort{obj: newObj} + newLibObj.setDefault() + obj.lagPortSlice = append(obj.lagPortSlice, newLibObj) + return newLibObj +} + +func (obj *lagLagPortIter) Append(items ...LagPort) LagLagPortIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.lagPortSlice = append(obj.lagPortSlice, item) + } + return obj +} + +func (obj *lagLagPortIter) Set(index int, newObj LagPort) LagLagPortIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.lagPortSlice[index] = newObj + return obj +} +func (obj *lagLagPortIter) Clear() LagLagPortIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.LagPort{} + obj.lagPortSlice = []LagPort{} + } + return obj +} +func (obj *lagLagPortIter) clearHolderSlice() LagLagPortIter { + if len(obj.lagPortSlice) > 0 { + obj.lagPortSlice = []LagPort{} + } + return obj +} +func (obj *lagLagPortIter) appendHolderSlice(item LagPort) LagLagPortIter { + obj.lagPortSlice = append(obj.lagPortSlice, item) + return obj +} + +// description is TBD +// Protocol returns a LagProtocol +func (obj *lag) Protocol() LagProtocol { + if obj.obj.Protocol == nil { + obj.obj.Protocol = NewLagProtocol().msg() + } + if obj.protocolHolder == nil { + obj.protocolHolder = &lagProtocol{obj: obj.obj.Protocol} + } + return obj.protocolHolder +} + +// description is TBD +// Protocol returns a LagProtocol +func (obj *lag) HasProtocol() bool { + return obj.obj.Protocol != nil +} + +// description is TBD +// SetProtocol sets the LagProtocol value in the Lag object +func (obj *lag) SetProtocol(value LagProtocol) Lag { + + obj.protocolHolder = nil + obj.obj.Protocol = value.msg() + + return obj +} + +// Specifies the mininum number of member interfaces that must be active for the aggregate interface to be available. +// If the aggregate interface is not available due to min-links criterion not being met, LACPDUs continue to be transmitted and received by the member interfaces if LACP is enabled, but other PDUs are not transmitted or received. +// MinLinks returns a uint32 +func (obj *lag) MinLinks() uint32 { + + return *obj.obj.MinLinks + +} + +// Specifies the mininum number of member interfaces that must be active for the aggregate interface to be available. +// If the aggregate interface is not available due to min-links criterion not being met, LACPDUs continue to be transmitted and received by the member interfaces if LACP is enabled, but other PDUs are not transmitted or received. +// MinLinks returns a uint32 +func (obj *lag) HasMinLinks() bool { + return obj.obj.MinLinks != nil +} + +// Specifies the mininum number of member interfaces that must be active for the aggregate interface to be available. +// If the aggregate interface is not available due to min-links criterion not being met, LACPDUs continue to be transmitted and received by the member interfaces if LACP is enabled, but other PDUs are not transmitted or received. +// SetMinLinks sets the uint32 value in the Lag object +func (obj *lag) SetMinLinks(value uint32) Lag { + + obj.obj.MinLinks = &value + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *lag) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the Lag object +func (obj *lag) SetName(value string) Lag { + + obj.obj.Name = &value + return obj +} + +func (obj *lag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Ports) != 0 { + + if set_default { + obj.Ports().clearHolderSlice() + for _, item := range obj.obj.Ports { + obj.Ports().appendHolderSlice(&lagPort{obj: item}) + } + } + for _, item := range obj.Ports().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Protocol != nil { + + obj.Protocol().validateObj(vObj, set_default) + } + + if obj.obj.MinLinks != nil { + + if *obj.obj.MinLinks > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= Lag.MinLinks <= 32 but Got %d", *obj.obj.MinLinks)) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface Lag") + } +} + +func (obj *lag) setDefault() { + if obj.obj.MinLinks == nil { + obj.SetMinLinks(1) + } + +} diff --git a/gosnappi/lag_metric.go b/gosnappi/lag_metric.go new file mode 100644 index 00000000..9e01854e --- /dev/null +++ b/gosnappi/lag_metric.go @@ -0,0 +1,629 @@ +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" +) + +// ***** LagMetric ***** +type lagMetric struct { + validation + obj *otg.LagMetric + marshaller marshalLagMetric + unMarshaller unMarshalLagMetric +} + +func NewLagMetric() LagMetric { + obj := lagMetric{obj: &otg.LagMetric{}} + obj.setDefault() + return &obj +} + +func (obj *lagMetric) msg() *otg.LagMetric { + return obj.obj +} + +func (obj *lagMetric) setMsg(msg *otg.LagMetric) LagMetric { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallagMetric struct { + obj *lagMetric +} + +type marshalLagMetric interface { + // ToProto marshals LagMetric to protobuf object *otg.LagMetric + ToProto() (*otg.LagMetric, error) + // ToPbText marshals LagMetric to protobuf text + ToPbText() (string, error) + // ToYaml marshals LagMetric to YAML text + ToYaml() (string, error) + // ToJson marshals LagMetric to JSON text + ToJson() (string, error) +} + +type unMarshallagMetric struct { + obj *lagMetric +} + +type unMarshalLagMetric interface { + // FromProto unmarshals LagMetric from protobuf object *otg.LagMetric + FromProto(msg *otg.LagMetric) (LagMetric, error) + // FromPbText unmarshals LagMetric from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LagMetric from YAML text + FromYaml(value string) error + // FromJson unmarshals LagMetric from JSON text + FromJson(value string) error +} + +func (obj *lagMetric) Marshal() marshalLagMetric { + if obj.marshaller == nil { + obj.marshaller = &marshallagMetric{obj: obj} + } + return obj.marshaller +} + +func (obj *lagMetric) Unmarshal() unMarshalLagMetric { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallagMetric{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallagMetric) ToProto() (*otg.LagMetric, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallagMetric) FromProto(msg *otg.LagMetric) (LagMetric, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallagMetric) 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 *unMarshallagMetric) 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 *marshallagMetric) 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 *unMarshallagMetric) 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 *marshallagMetric) 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 *unMarshallagMetric) 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 *lagMetric) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lagMetric) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lagMetric) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lagMetric) Clone() (LagMetric, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLagMetric() + 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 +} + +// LagMetric is description is TBD +type LagMetric interface { + Validation + // msg marshals LagMetric to protobuf object *otg.LagMetric + // and doesn't set defaults + msg() *otg.LagMetric + // setMsg unmarshals LagMetric from protobuf object *otg.LagMetric + // and doesn't set defaults + setMsg(*otg.LagMetric) LagMetric + // provides marshal interface + Marshal() marshalLagMetric + // provides unmarshal interface + Unmarshal() unMarshalLagMetric + // validate validates LagMetric + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LagMetric, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in LagMetric. + Name() string + // SetName assigns string provided by user to LagMetric + SetName(value string) LagMetric + // HasName checks if Name has been set in LagMetric + HasName() bool + // OperStatus returns LagMetricOperStatusEnum, set in LagMetric + OperStatus() LagMetricOperStatusEnum + // SetOperStatus assigns LagMetricOperStatusEnum provided by user to LagMetric + SetOperStatus(value LagMetricOperStatusEnum) LagMetric + // HasOperStatus checks if OperStatus has been set in LagMetric + HasOperStatus() bool + // MemberPortsUp returns uint32, set in LagMetric. + MemberPortsUp() uint32 + // SetMemberPortsUp assigns uint32 provided by user to LagMetric + SetMemberPortsUp(value uint32) LagMetric + // HasMemberPortsUp checks if MemberPortsUp has been set in LagMetric + HasMemberPortsUp() bool + // FramesTx returns uint64, set in LagMetric. + FramesTx() uint64 + // SetFramesTx assigns uint64 provided by user to LagMetric + SetFramesTx(value uint64) LagMetric + // HasFramesTx checks if FramesTx has been set in LagMetric + HasFramesTx() bool + // FramesRx returns uint64, set in LagMetric. + FramesRx() uint64 + // SetFramesRx assigns uint64 provided by user to LagMetric + SetFramesRx(value uint64) LagMetric + // HasFramesRx checks if FramesRx has been set in LagMetric + HasFramesRx() bool + // BytesTx returns uint64, set in LagMetric. + BytesTx() uint64 + // SetBytesTx assigns uint64 provided by user to LagMetric + SetBytesTx(value uint64) LagMetric + // HasBytesTx checks if BytesTx has been set in LagMetric + HasBytesTx() bool + // BytesRx returns uint64, set in LagMetric. + BytesRx() uint64 + // SetBytesRx assigns uint64 provided by user to LagMetric + SetBytesRx(value uint64) LagMetric + // HasBytesRx checks if BytesRx has been set in LagMetric + HasBytesRx() bool + // FramesTxRate returns float32, set in LagMetric. + FramesTxRate() float32 + // SetFramesTxRate assigns float32 provided by user to LagMetric + SetFramesTxRate(value float32) LagMetric + // HasFramesTxRate checks if FramesTxRate has been set in LagMetric + HasFramesTxRate() bool + // FramesRxRate returns float32, set in LagMetric. + FramesRxRate() float32 + // SetFramesRxRate assigns float32 provided by user to LagMetric + SetFramesRxRate(value float32) LagMetric + // HasFramesRxRate checks if FramesRxRate has been set in LagMetric + HasFramesRxRate() bool + // BytesTxRate returns float32, set in LagMetric. + BytesTxRate() float32 + // SetBytesTxRate assigns float32 provided by user to LagMetric + SetBytesTxRate(value float32) LagMetric + // HasBytesTxRate checks if BytesTxRate has been set in LagMetric + HasBytesTxRate() bool + // BytesRxRate returns float32, set in LagMetric. + BytesRxRate() float32 + // SetBytesRxRate assigns float32 provided by user to LagMetric + SetBytesRxRate(value float32) LagMetric + // HasBytesRxRate checks if BytesRxRate has been set in LagMetric + HasBytesRxRate() bool +} + +// The name of a configured LAG +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// Name returns a string +func (obj *lagMetric) Name() string { + + return *obj.obj.Name + +} + +// The name of a configured LAG +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// Name returns a string +func (obj *lagMetric) HasName() bool { + return obj.obj.Name != nil +} + +// The name of a configured LAG +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// SetName sets the string value in the LagMetric object +func (obj *lagMetric) SetName(value string) LagMetric { + + obj.obj.Name = &value + return obj +} + +type LagMetricOperStatusEnum string + +// Enum of OperStatus on LagMetric +var LagMetricOperStatus = struct { + UP LagMetricOperStatusEnum + DOWN LagMetricOperStatusEnum +}{ + UP: LagMetricOperStatusEnum("up"), + DOWN: LagMetricOperStatusEnum("down"), +} + +func (obj *lagMetric) OperStatus() LagMetricOperStatusEnum { + return LagMetricOperStatusEnum(obj.obj.OperStatus.Enum().String()) +} + +// The current operational state of the LAG. The state can be up or down. State 'up' indicates member_ports_up >= min_links. +// OperStatus returns a string +func (obj *lagMetric) HasOperStatus() bool { + return obj.obj.OperStatus != nil +} + +func (obj *lagMetric) SetOperStatus(value LagMetricOperStatusEnum) LagMetric { + intValue, ok := otg.LagMetric_OperStatus_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LagMetricOperStatusEnum", string(value))) + return obj + } + enumValue := otg.LagMetric_OperStatus_Enum(intValue) + obj.obj.OperStatus = &enumValue + + return obj +} + +// The number of LAG member ports up. +// MemberPortsUp returns a uint32 +func (obj *lagMetric) MemberPortsUp() uint32 { + + return *obj.obj.MemberPortsUp + +} + +// The number of LAG member ports up. +// MemberPortsUp returns a uint32 +func (obj *lagMetric) HasMemberPortsUp() bool { + return obj.obj.MemberPortsUp != nil +} + +// The number of LAG member ports up. +// SetMemberPortsUp sets the uint32 value in the LagMetric object +func (obj *lagMetric) SetMemberPortsUp(value uint32) LagMetric { + + obj.obj.MemberPortsUp = &value + return obj +} + +// The current total number of frames transmitted. +// FramesTx returns a uint64 +func (obj *lagMetric) FramesTx() uint64 { + + return *obj.obj.FramesTx + +} + +// The current total number of frames transmitted. +// FramesTx returns a uint64 +func (obj *lagMetric) HasFramesTx() bool { + return obj.obj.FramesTx != nil +} + +// The current total number of frames transmitted. +// SetFramesTx sets the uint64 value in the LagMetric object +func (obj *lagMetric) SetFramesTx(value uint64) LagMetric { + + obj.obj.FramesTx = &value + return obj +} + +// The current total number of valid frames received. +// FramesRx returns a uint64 +func (obj *lagMetric) FramesRx() uint64 { + + return *obj.obj.FramesRx + +} + +// The current total number of valid frames received. +// FramesRx returns a uint64 +func (obj *lagMetric) HasFramesRx() bool { + return obj.obj.FramesRx != nil +} + +// The current total number of valid frames received. +// SetFramesRx sets the uint64 value in the LagMetric object +func (obj *lagMetric) SetFramesRx(value uint64) LagMetric { + + obj.obj.FramesRx = &value + return obj +} + +// The current total number of bytes transmitted. +// BytesTx returns a uint64 +func (obj *lagMetric) BytesTx() uint64 { + + return *obj.obj.BytesTx + +} + +// The current total number of bytes transmitted. +// BytesTx returns a uint64 +func (obj *lagMetric) HasBytesTx() bool { + return obj.obj.BytesTx != nil +} + +// The current total number of bytes transmitted. +// SetBytesTx sets the uint64 value in the LagMetric object +func (obj *lagMetric) SetBytesTx(value uint64) LagMetric { + + obj.obj.BytesTx = &value + return obj +} + +// The current total number of valid bytes received. +// BytesRx returns a uint64 +func (obj *lagMetric) BytesRx() uint64 { + + return *obj.obj.BytesRx + +} + +// The current total number of valid bytes received. +// BytesRx returns a uint64 +func (obj *lagMetric) HasBytesRx() bool { + return obj.obj.BytesRx != nil +} + +// The current total number of valid bytes received. +// SetBytesRx sets the uint64 value in the LagMetric object +func (obj *lagMetric) SetBytesRx(value uint64) LagMetric { + + obj.obj.BytesRx = &value + return obj +} + +// The current rate of frames transmitted. +// FramesTxRate returns a float32 +func (obj *lagMetric) FramesTxRate() float32 { + + return *obj.obj.FramesTxRate + +} + +// The current rate of frames transmitted. +// FramesTxRate returns a float32 +func (obj *lagMetric) HasFramesTxRate() bool { + return obj.obj.FramesTxRate != nil +} + +// The current rate of frames transmitted. +// SetFramesTxRate sets the float32 value in the LagMetric object +func (obj *lagMetric) SetFramesTxRate(value float32) LagMetric { + + obj.obj.FramesTxRate = &value + return obj +} + +// The current rate of valid frames received. +// FramesRxRate returns a float32 +func (obj *lagMetric) FramesRxRate() float32 { + + return *obj.obj.FramesRxRate + +} + +// The current rate of valid frames received. +// FramesRxRate returns a float32 +func (obj *lagMetric) HasFramesRxRate() bool { + return obj.obj.FramesRxRate != nil +} + +// The current rate of valid frames received. +// SetFramesRxRate sets the float32 value in the LagMetric object +func (obj *lagMetric) SetFramesRxRate(value float32) LagMetric { + + obj.obj.FramesRxRate = &value + return obj +} + +// The current rate of bytes transmitted. +// BytesTxRate returns a float32 +func (obj *lagMetric) BytesTxRate() float32 { + + return *obj.obj.BytesTxRate + +} + +// The current rate of bytes transmitted. +// BytesTxRate returns a float32 +func (obj *lagMetric) HasBytesTxRate() bool { + return obj.obj.BytesTxRate != nil +} + +// The current rate of bytes transmitted. +// SetBytesTxRate sets the float32 value in the LagMetric object +func (obj *lagMetric) SetBytesTxRate(value float32) LagMetric { + + obj.obj.BytesTxRate = &value + return obj +} + +// The current rate of bytes received. +// BytesRxRate returns a float32 +func (obj *lagMetric) BytesRxRate() float32 { + + return *obj.obj.BytesRxRate + +} + +// The current rate of bytes received. +// BytesRxRate returns a float32 +func (obj *lagMetric) HasBytesRxRate() bool { + return obj.obj.BytesRxRate != nil +} + +// The current rate of bytes received. +// SetBytesRxRate sets the float32 value in the LagMetric object +func (obj *lagMetric) SetBytesRxRate(value float32) LagMetric { + + obj.obj.BytesRxRate = &value + return obj +} + +func (obj *lagMetric) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.BytesRx != nil { + + if *obj.obj.BytesRx > 18446744073709551615 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= LagMetric.BytesRx <= 18446744073709551615 but Got %d", *obj.obj.BytesRx)) + } + + } + +} + +func (obj *lagMetric) setDefault() { + +} diff --git a/gosnappi/lag_metrics_request.go b/gosnappi/lag_metrics_request.go new file mode 100644 index 00000000..b7d5c7bc --- /dev/null +++ b/gosnappi/lag_metrics_request.go @@ -0,0 +1,369 @@ +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" +) + +// ***** LagMetricsRequest ***** +type lagMetricsRequest struct { + validation + obj *otg.LagMetricsRequest + marshaller marshalLagMetricsRequest + unMarshaller unMarshalLagMetricsRequest +} + +func NewLagMetricsRequest() LagMetricsRequest { + obj := lagMetricsRequest{obj: &otg.LagMetricsRequest{}} + obj.setDefault() + return &obj +} + +func (obj *lagMetricsRequest) msg() *otg.LagMetricsRequest { + return obj.obj +} + +func (obj *lagMetricsRequest) setMsg(msg *otg.LagMetricsRequest) LagMetricsRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallagMetricsRequest struct { + obj *lagMetricsRequest +} + +type marshalLagMetricsRequest interface { + // ToProto marshals LagMetricsRequest to protobuf object *otg.LagMetricsRequest + ToProto() (*otg.LagMetricsRequest, error) + // ToPbText marshals LagMetricsRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals LagMetricsRequest to YAML text + ToYaml() (string, error) + // ToJson marshals LagMetricsRequest to JSON text + ToJson() (string, error) +} + +type unMarshallagMetricsRequest struct { + obj *lagMetricsRequest +} + +type unMarshalLagMetricsRequest interface { + // FromProto unmarshals LagMetricsRequest from protobuf object *otg.LagMetricsRequest + FromProto(msg *otg.LagMetricsRequest) (LagMetricsRequest, error) + // FromPbText unmarshals LagMetricsRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LagMetricsRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals LagMetricsRequest from JSON text + FromJson(value string) error +} + +func (obj *lagMetricsRequest) Marshal() marshalLagMetricsRequest { + if obj.marshaller == nil { + obj.marshaller = &marshallagMetricsRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *lagMetricsRequest) Unmarshal() unMarshalLagMetricsRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallagMetricsRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallagMetricsRequest) ToProto() (*otg.LagMetricsRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallagMetricsRequest) FromProto(msg *otg.LagMetricsRequest) (LagMetricsRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallagMetricsRequest) 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 *unMarshallagMetricsRequest) 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 *marshallagMetricsRequest) 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 *unMarshallagMetricsRequest) 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 *marshallagMetricsRequest) 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 *unMarshallagMetricsRequest) 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 *lagMetricsRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lagMetricsRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lagMetricsRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lagMetricsRequest) Clone() (LagMetricsRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLagMetricsRequest() + 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 +} + +// LagMetricsRequest is the request to retrieve per LAG metrics/statistics. +type LagMetricsRequest interface { + Validation + // msg marshals LagMetricsRequest to protobuf object *otg.LagMetricsRequest + // and doesn't set defaults + msg() *otg.LagMetricsRequest + // setMsg unmarshals LagMetricsRequest from protobuf object *otg.LagMetricsRequest + // and doesn't set defaults + setMsg(*otg.LagMetricsRequest) LagMetricsRequest + // provides marshal interface + Marshal() marshalLagMetricsRequest + // provides unmarshal interface + Unmarshal() unMarshalLagMetricsRequest + // validate validates LagMetricsRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LagMetricsRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // LagNames returns []string, set in LagMetricsRequest. + LagNames() []string + // SetLagNames assigns []string provided by user to LagMetricsRequest + SetLagNames(value []string) LagMetricsRequest + // ColumnNames returns []LagMetricsRequestColumnNamesEnum, set in LagMetricsRequest + ColumnNames() []LagMetricsRequestColumnNamesEnum + // SetColumnNames assigns []LagMetricsRequestColumnNamesEnum provided by user to LagMetricsRequest + SetColumnNames(value []LagMetricsRequestColumnNamesEnum) LagMetricsRequest +} + +// The names of LAGs to return results for. An empty list will return results for all LAGs. +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// LagNames returns a []string +func (obj *lagMetricsRequest) LagNames() []string { + if obj.obj.LagNames == nil { + obj.obj.LagNames = make([]string, 0) + } + return obj.obj.LagNames +} + +// The names of LAGs to return results for. An empty list will return results for all LAGs. +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// x-constraint: +// - /components/schemas/Lag/properties/name +// +// SetLagNames sets the []string value in the LagMetricsRequest object +func (obj *lagMetricsRequest) SetLagNames(value []string) LagMetricsRequest { + + if obj.obj.LagNames == nil { + obj.obj.LagNames = make([]string, 0) + } + obj.obj.LagNames = value + + return obj +} + +type LagMetricsRequestColumnNamesEnum string + +// Enum of ColumnNames on LagMetricsRequest +var LagMetricsRequestColumnNames = struct { + OPER_STATUS LagMetricsRequestColumnNamesEnum + MEMBER_PORTS_UP LagMetricsRequestColumnNamesEnum + FRAMES_TX LagMetricsRequestColumnNamesEnum + FRAMES_RX LagMetricsRequestColumnNamesEnum + BYTES_TX LagMetricsRequestColumnNamesEnum + BYTES_RX LagMetricsRequestColumnNamesEnum + FRAMES_TX_RATE LagMetricsRequestColumnNamesEnum + FRAMES_RX_RATE LagMetricsRequestColumnNamesEnum + BYTES_TX_RATE LagMetricsRequestColumnNamesEnum + BYTES_RX_RATE LagMetricsRequestColumnNamesEnum +}{ + OPER_STATUS: LagMetricsRequestColumnNamesEnum("oper_status"), + MEMBER_PORTS_UP: LagMetricsRequestColumnNamesEnum("member_ports_up"), + FRAMES_TX: LagMetricsRequestColumnNamesEnum("frames_tx"), + FRAMES_RX: LagMetricsRequestColumnNamesEnum("frames_rx"), + BYTES_TX: LagMetricsRequestColumnNamesEnum("bytes_tx"), + BYTES_RX: LagMetricsRequestColumnNamesEnum("bytes_rx"), + FRAMES_TX_RATE: LagMetricsRequestColumnNamesEnum("frames_tx_rate"), + FRAMES_RX_RATE: LagMetricsRequestColumnNamesEnum("frames_rx_rate"), + BYTES_TX_RATE: LagMetricsRequestColumnNamesEnum("bytes_tx_rate"), + BYTES_RX_RATE: LagMetricsRequestColumnNamesEnum("bytes_rx_rate"), +} + +func (obj *lagMetricsRequest) ColumnNames() []LagMetricsRequestColumnNamesEnum { + items := []LagMetricsRequestColumnNamesEnum{} + for _, item := range obj.obj.ColumnNames { + items = append(items, LagMetricsRequestColumnNamesEnum(item.String())) + } + return items +} + +// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned. The name of the LAG cannot be excluded. +// SetColumnNames sets the []string value in the LagMetricsRequest object +func (obj *lagMetricsRequest) SetColumnNames(value []LagMetricsRequestColumnNamesEnum) LagMetricsRequest { + + items := []otg.LagMetricsRequest_ColumnNames_Enum{} + for _, item := range value { + intValue := otg.LagMetricsRequest_ColumnNames_Enum_value[string(item)] + items = append(items, otg.LagMetricsRequest_ColumnNames_Enum(intValue)) + } + obj.obj.ColumnNames = items + return obj +} + +func (obj *lagMetricsRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *lagMetricsRequest) setDefault() { + +} diff --git a/gosnappi/lag_port.go b/gosnappi/lag_port.go new file mode 100644 index 00000000..07f25110 --- /dev/null +++ b/gosnappi/lag_port.go @@ -0,0 +1,407 @@ +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" +) + +// ***** LagPort ***** +type lagPort struct { + validation + obj *otg.LagPort + marshaller marshalLagPort + unMarshaller unMarshalLagPort + lacpHolder LagPortLacp + ethernetHolder DeviceEthernetBase +} + +func NewLagPort() LagPort { + obj := lagPort{obj: &otg.LagPort{}} + obj.setDefault() + return &obj +} + +func (obj *lagPort) msg() *otg.LagPort { + return obj.obj +} + +func (obj *lagPort) setMsg(msg *otg.LagPort) LagPort { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshallagPort struct { + obj *lagPort +} + +type marshalLagPort interface { + // ToProto marshals LagPort to protobuf object *otg.LagPort + ToProto() (*otg.LagPort, error) + // ToPbText marshals LagPort to protobuf text + ToPbText() (string, error) + // ToYaml marshals LagPort to YAML text + ToYaml() (string, error) + // ToJson marshals LagPort to JSON text + ToJson() (string, error) +} + +type unMarshallagPort struct { + obj *lagPort +} + +type unMarshalLagPort interface { + // FromProto unmarshals LagPort from protobuf object *otg.LagPort + FromProto(msg *otg.LagPort) (LagPort, error) + // FromPbText unmarshals LagPort from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LagPort from YAML text + FromYaml(value string) error + // FromJson unmarshals LagPort from JSON text + FromJson(value string) error +} + +func (obj *lagPort) Marshal() marshalLagPort { + if obj.marshaller == nil { + obj.marshaller = &marshallagPort{obj: obj} + } + return obj.marshaller +} + +func (obj *lagPort) Unmarshal() unMarshalLagPort { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallagPort{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallagPort) ToProto() (*otg.LagPort, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallagPort) FromProto(msg *otg.LagPort) (LagPort, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallagPort) 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 *unMarshallagPort) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshallagPort) 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 *unMarshallagPort) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshallagPort) 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 *unMarshallagPort) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *lagPort) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lagPort) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lagPort) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lagPort) Clone() (LagPort, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLagPort() + 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 +} + +func (obj *lagPort) setNil() { + obj.lacpHolder = nil + obj.ethernetHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// LagPort is the container for a port's ethernet interface and LAG protocol settings +type LagPort interface { + Validation + // msg marshals LagPort to protobuf object *otg.LagPort + // and doesn't set defaults + msg() *otg.LagPort + // setMsg unmarshals LagPort from protobuf object *otg.LagPort + // and doesn't set defaults + setMsg(*otg.LagPort) LagPort + // provides marshal interface + Marshal() marshalLagPort + // provides unmarshal interface + Unmarshal() unMarshalLagPort + // validate validates LagPort + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LagPort, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PortName returns string, set in LagPort. + PortName() string + // SetPortName assigns string provided by user to LagPort + SetPortName(value string) LagPort + // Lacp returns LagPortLacp, set in LagPort. + // LagPortLacp is the container for link aggregation control protocol settings of a LAG member (port). + Lacp() LagPortLacp + // SetLacp assigns LagPortLacp provided by user to LagPort. + // LagPortLacp is the container for link aggregation control protocol settings of a LAG member (port). + SetLacp(value LagPortLacp) LagPort + // HasLacp checks if Lacp has been set in LagPort + HasLacp() bool + // Ethernet returns DeviceEthernetBase, set in LagPort. + // DeviceEthernetBase is base Ethernet interface. + Ethernet() DeviceEthernetBase + // SetEthernet assigns DeviceEthernetBase provided by user to LagPort. + // DeviceEthernetBase is base Ethernet interface. + SetEthernet(value DeviceEthernetBase) LagPort + setNil() +} + +// The name of a port object that will be part of the LAG. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// PortName returns a string +func (obj *lagPort) PortName() string { + + return *obj.obj.PortName + +} + +// The name of a port object that will be part of the LAG. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// SetPortName sets the string value in the LagPort object +func (obj *lagPort) SetPortName(value string) LagPort { + + obj.obj.PortName = &value + return obj +} + +// description is TBD +// Lacp returns a LagPortLacp +func (obj *lagPort) Lacp() LagPortLacp { + if obj.obj.Lacp == nil { + obj.obj.Lacp = NewLagPortLacp().msg() + } + if obj.lacpHolder == nil { + obj.lacpHolder = &lagPortLacp{obj: obj.obj.Lacp} + } + return obj.lacpHolder +} + +// description is TBD +// Lacp returns a LagPortLacp +func (obj *lagPort) HasLacp() bool { + return obj.obj.Lacp != nil +} + +// description is TBD +// SetLacp sets the LagPortLacp value in the LagPort object +func (obj *lagPort) SetLacp(value LagPortLacp) LagPort { + + obj.lacpHolder = nil + obj.obj.Lacp = value.msg() + + return obj +} + +// description is TBD +// Ethernet returns a DeviceEthernetBase +func (obj *lagPort) Ethernet() DeviceEthernetBase { + if obj.obj.Ethernet == nil { + obj.obj.Ethernet = NewDeviceEthernetBase().msg() + } + if obj.ethernetHolder == nil { + obj.ethernetHolder = &deviceEthernetBase{obj: obj.obj.Ethernet} + } + return obj.ethernetHolder +} + +// description is TBD +// SetEthernet sets the DeviceEthernetBase value in the LagPort object +func (obj *lagPort) SetEthernet(value DeviceEthernetBase) LagPort { + + obj.ethernetHolder = nil + obj.obj.Ethernet = value.msg() + + return obj +} + +func (obj *lagPort) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // PortName is required + if obj.obj.PortName == nil { + vObj.validationErrors = append(vObj.validationErrors, "PortName is required field on interface LagPort") + } + + if obj.obj.Lacp != nil { + + obj.Lacp().validateObj(vObj, set_default) + } + + // Ethernet is required + if obj.obj.Ethernet == nil { + vObj.validationErrors = append(vObj.validationErrors, "Ethernet is required field on interface LagPort") + } + + if obj.obj.Ethernet != nil { + + obj.Ethernet().validateObj(vObj, set_default) + } + +} + +func (obj *lagPort) setDefault() { + +} diff --git a/gosnappi/lag_port_lacp.go b/gosnappi/lag_port_lacp.go new file mode 100644 index 00000000..bc506bbe --- /dev/null +++ b/gosnappi/lag_port_lacp.go @@ -0,0 +1,488 @@ +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" +) + +// ***** LagPortLacp ***** +type lagPortLacp struct { + validation + obj *otg.LagPortLacp + marshaller marshalLagPortLacp + unMarshaller unMarshalLagPortLacp +} + +func NewLagPortLacp() LagPortLacp { + obj := lagPortLacp{obj: &otg.LagPortLacp{}} + obj.setDefault() + return &obj +} + +func (obj *lagPortLacp) msg() *otg.LagPortLacp { + return obj.obj +} + +func (obj *lagPortLacp) setMsg(msg *otg.LagPortLacp) LagPortLacp { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallagPortLacp struct { + obj *lagPortLacp +} + +type marshalLagPortLacp interface { + // ToProto marshals LagPortLacp to protobuf object *otg.LagPortLacp + ToProto() (*otg.LagPortLacp, error) + // ToPbText marshals LagPortLacp to protobuf text + ToPbText() (string, error) + // ToYaml marshals LagPortLacp to YAML text + ToYaml() (string, error) + // ToJson marshals LagPortLacp to JSON text + ToJson() (string, error) +} + +type unMarshallagPortLacp struct { + obj *lagPortLacp +} + +type unMarshalLagPortLacp interface { + // FromProto unmarshals LagPortLacp from protobuf object *otg.LagPortLacp + FromProto(msg *otg.LagPortLacp) (LagPortLacp, error) + // FromPbText unmarshals LagPortLacp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LagPortLacp from YAML text + FromYaml(value string) error + // FromJson unmarshals LagPortLacp from JSON text + FromJson(value string) error +} + +func (obj *lagPortLacp) Marshal() marshalLagPortLacp { + if obj.marshaller == nil { + obj.marshaller = &marshallagPortLacp{obj: obj} + } + return obj.marshaller +} + +func (obj *lagPortLacp) Unmarshal() unMarshalLagPortLacp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallagPortLacp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallagPortLacp) ToProto() (*otg.LagPortLacp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallagPortLacp) FromProto(msg *otg.LagPortLacp) (LagPortLacp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallagPortLacp) 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 *unMarshallagPortLacp) 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 *marshallagPortLacp) 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 *unMarshallagPortLacp) 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 *marshallagPortLacp) 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 *unMarshallagPortLacp) 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 *lagPortLacp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lagPortLacp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lagPortLacp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lagPortLacp) Clone() (LagPortLacp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLagPortLacp() + 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 +} + +// LagPortLacp is the container for link aggregation control protocol settings of a LAG member (port). +type LagPortLacp interface { + Validation + // msg marshals LagPortLacp to protobuf object *otg.LagPortLacp + // and doesn't set defaults + msg() *otg.LagPortLacp + // setMsg unmarshals LagPortLacp from protobuf object *otg.LagPortLacp + // and doesn't set defaults + setMsg(*otg.LagPortLacp) LagPortLacp + // provides marshal interface + Marshal() marshalLagPortLacp + // provides unmarshal interface + Unmarshal() unMarshalLagPortLacp + // validate validates LagPortLacp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LagPortLacp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ActorPortNumber returns uint32, set in LagPortLacp. + ActorPortNumber() uint32 + // SetActorPortNumber assigns uint32 provided by user to LagPortLacp + SetActorPortNumber(value uint32) LagPortLacp + // HasActorPortNumber checks if ActorPortNumber has been set in LagPortLacp + HasActorPortNumber() bool + // ActorPortPriority returns uint32, set in LagPortLacp. + ActorPortPriority() uint32 + // SetActorPortPriority assigns uint32 provided by user to LagPortLacp + SetActorPortPriority(value uint32) LagPortLacp + // HasActorPortPriority checks if ActorPortPriority has been set in LagPortLacp + HasActorPortPriority() bool + // ActorActivity returns LagPortLacpActorActivityEnum, set in LagPortLacp + ActorActivity() LagPortLacpActorActivityEnum + // SetActorActivity assigns LagPortLacpActorActivityEnum provided by user to LagPortLacp + SetActorActivity(value LagPortLacpActorActivityEnum) LagPortLacp + // HasActorActivity checks if ActorActivity has been set in LagPortLacp + HasActorActivity() bool + // LacpduPeriodicTimeInterval returns uint32, set in LagPortLacp. + LacpduPeriodicTimeInterval() uint32 + // SetLacpduPeriodicTimeInterval assigns uint32 provided by user to LagPortLacp + SetLacpduPeriodicTimeInterval(value uint32) LagPortLacp + // HasLacpduPeriodicTimeInterval checks if LacpduPeriodicTimeInterval has been set in LagPortLacp + HasLacpduPeriodicTimeInterval() bool + // LacpduTimeout returns uint32, set in LagPortLacp. + LacpduTimeout() uint32 + // SetLacpduTimeout assigns uint32 provided by user to LagPortLacp + SetLacpduTimeout(value uint32) LagPortLacp + // HasLacpduTimeout checks if LacpduTimeout has been set in LagPortLacp + HasLacpduTimeout() bool +} + +// The actor port number +// ActorPortNumber returns a uint32 +func (obj *lagPortLacp) ActorPortNumber() uint32 { + + return *obj.obj.ActorPortNumber + +} + +// The actor port number +// ActorPortNumber returns a uint32 +func (obj *lagPortLacp) HasActorPortNumber() bool { + return obj.obj.ActorPortNumber != nil +} + +// The actor port number +// SetActorPortNumber sets the uint32 value in the LagPortLacp object +func (obj *lagPortLacp) SetActorPortNumber(value uint32) LagPortLacp { + + obj.obj.ActorPortNumber = &value + return obj +} + +// The actor port priority +// ActorPortPriority returns a uint32 +func (obj *lagPortLacp) ActorPortPriority() uint32 { + + return *obj.obj.ActorPortPriority + +} + +// The actor port priority +// ActorPortPriority returns a uint32 +func (obj *lagPortLacp) HasActorPortPriority() bool { + return obj.obj.ActorPortPriority != nil +} + +// The actor port priority +// SetActorPortPriority sets the uint32 value in the LagPortLacp object +func (obj *lagPortLacp) SetActorPortPriority(value uint32) LagPortLacp { + + obj.obj.ActorPortPriority = &value + return obj +} + +type LagPortLacpActorActivityEnum string + +// Enum of ActorActivity on LagPortLacp +var LagPortLacpActorActivity = struct { + PASSIVE LagPortLacpActorActivityEnum + ACTIVE LagPortLacpActorActivityEnum +}{ + PASSIVE: LagPortLacpActorActivityEnum("passive"), + ACTIVE: LagPortLacpActorActivityEnum("active"), +} + +func (obj *lagPortLacp) ActorActivity() LagPortLacpActorActivityEnum { + return LagPortLacpActorActivityEnum(obj.obj.ActorActivity.Enum().String()) +} + +// Sets the value of LACP actor activity as either passive or active. +// Passive indicates the port's preference for not transmitting LACPDUs unless its partner's control is Active. +// Active indicates the port's preference to participate in the protocol regardless of the partner's control value. +// ActorActivity returns a string +func (obj *lagPortLacp) HasActorActivity() bool { + return obj.obj.ActorActivity != nil +} + +func (obj *lagPortLacp) SetActorActivity(value LagPortLacpActorActivityEnum) LagPortLacp { + intValue, ok := otg.LagPortLacp_ActorActivity_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LagPortLacpActorActivityEnum", string(value))) + return obj + } + enumValue := otg.LagPortLacp_ActorActivity_Enum(intValue) + obj.obj.ActorActivity = &enumValue + + return obj +} + +// This field defines how frequently LACPDUs are sent to the link partner +// LacpduPeriodicTimeInterval returns a uint32 +func (obj *lagPortLacp) LacpduPeriodicTimeInterval() uint32 { + + return *obj.obj.LacpduPeriodicTimeInterval + +} + +// This field defines how frequently LACPDUs are sent to the link partner +// LacpduPeriodicTimeInterval returns a uint32 +func (obj *lagPortLacp) HasLacpduPeriodicTimeInterval() bool { + return obj.obj.LacpduPeriodicTimeInterval != nil +} + +// This field defines how frequently LACPDUs are sent to the link partner +// SetLacpduPeriodicTimeInterval sets the uint32 value in the LagPortLacp object +func (obj *lagPortLacp) SetLacpduPeriodicTimeInterval(value uint32) LagPortLacp { + + obj.obj.LacpduPeriodicTimeInterval = &value + return obj +} + +// This timer is used to detect whether received protocol information has expired +// LacpduTimeout returns a uint32 +func (obj *lagPortLacp) LacpduTimeout() uint32 { + + return *obj.obj.LacpduTimeout + +} + +// This timer is used to detect whether received protocol information has expired +// LacpduTimeout returns a uint32 +func (obj *lagPortLacp) HasLacpduTimeout() bool { + return obj.obj.LacpduTimeout != nil +} + +// This timer is used to detect whether received protocol information has expired +// SetLacpduTimeout sets the uint32 value in the LagPortLacp object +func (obj *lagPortLacp) SetLacpduTimeout(value uint32) LagPortLacp { + + obj.obj.LacpduTimeout = &value + return obj +} + +func (obj *lagPortLacp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.ActorPortNumber != nil { + + if *obj.obj.ActorPortNumber > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= LagPortLacp.ActorPortNumber <= 65535 but Got %d", *obj.obj.ActorPortNumber)) + } + + } + + if obj.obj.ActorPortPriority != nil { + + if *obj.obj.ActorPortPriority > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= LagPortLacp.ActorPortPriority <= 65535 but Got %d", *obj.obj.ActorPortPriority)) + } + + } + + if obj.obj.LacpduPeriodicTimeInterval != nil { + + if *obj.obj.LacpduPeriodicTimeInterval > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= LagPortLacp.LacpduPeriodicTimeInterval <= 65535 but Got %d", *obj.obj.LacpduPeriodicTimeInterval)) + } + + } + + if obj.obj.LacpduTimeout != nil { + + if *obj.obj.LacpduTimeout > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= LagPortLacp.LacpduTimeout <= 65535 but Got %d", *obj.obj.LacpduTimeout)) + } + + } + +} + +func (obj *lagPortLacp) setDefault() { + if obj.obj.ActorPortNumber == nil { + obj.SetActorPortNumber(0) + } + if obj.obj.ActorPortPriority == nil { + obj.SetActorPortPriority(1) + } + if obj.obj.ActorActivity == nil { + obj.SetActorActivity(LagPortLacpActorActivity.ACTIVE) + + } + if obj.obj.LacpduPeriodicTimeInterval == nil { + obj.SetLacpduPeriodicTimeInterval(0) + } + if obj.obj.LacpduTimeout == nil { + obj.SetLacpduTimeout(0) + } + +} diff --git a/gosnappi/lag_protocol.go b/gosnappi/lag_protocol.go new file mode 100644 index 00000000..5b072d11 --- /dev/null +++ b/gosnappi/lag_protocol.go @@ -0,0 +1,452 @@ +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" +) + +// ***** LagProtocol ***** +type lagProtocol struct { + validation + obj *otg.LagProtocol + marshaller marshalLagProtocol + unMarshaller unMarshalLagProtocol + lacpHolder LagProtocolLacp + staticHolder LagProtocolStatic +} + +func NewLagProtocol() LagProtocol { + obj := lagProtocol{obj: &otg.LagProtocol{}} + obj.setDefault() + return &obj +} + +func (obj *lagProtocol) msg() *otg.LagProtocol { + return obj.obj +} + +func (obj *lagProtocol) setMsg(msg *otg.LagProtocol) LagProtocol { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshallagProtocol struct { + obj *lagProtocol +} + +type marshalLagProtocol interface { + // ToProto marshals LagProtocol to protobuf object *otg.LagProtocol + ToProto() (*otg.LagProtocol, error) + // ToPbText marshals LagProtocol to protobuf text + ToPbText() (string, error) + // ToYaml marshals LagProtocol to YAML text + ToYaml() (string, error) + // ToJson marshals LagProtocol to JSON text + ToJson() (string, error) +} + +type unMarshallagProtocol struct { + obj *lagProtocol +} + +type unMarshalLagProtocol interface { + // FromProto unmarshals LagProtocol from protobuf object *otg.LagProtocol + FromProto(msg *otg.LagProtocol) (LagProtocol, error) + // FromPbText unmarshals LagProtocol from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LagProtocol from YAML text + FromYaml(value string) error + // FromJson unmarshals LagProtocol from JSON text + FromJson(value string) error +} + +func (obj *lagProtocol) Marshal() marshalLagProtocol { + if obj.marshaller == nil { + obj.marshaller = &marshallagProtocol{obj: obj} + } + return obj.marshaller +} + +func (obj *lagProtocol) Unmarshal() unMarshalLagProtocol { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallagProtocol{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallagProtocol) ToProto() (*otg.LagProtocol, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallagProtocol) FromProto(msg *otg.LagProtocol) (LagProtocol, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallagProtocol) 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 *unMarshallagProtocol) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshallagProtocol) 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 *unMarshallagProtocol) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshallagProtocol) 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 *unMarshallagProtocol) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *lagProtocol) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lagProtocol) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lagProtocol) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lagProtocol) Clone() (LagProtocol, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLagProtocol() + 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 +} + +func (obj *lagProtocol) setNil() { + obj.lacpHolder = nil + obj.staticHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// LagProtocol is description is TBD +type LagProtocol interface { + Validation + // msg marshals LagProtocol to protobuf object *otg.LagProtocol + // and doesn't set defaults + msg() *otg.LagProtocol + // setMsg unmarshals LagProtocol from protobuf object *otg.LagProtocol + // and doesn't set defaults + setMsg(*otg.LagProtocol) LagProtocol + // provides marshal interface + Marshal() marshalLagProtocol + // provides unmarshal interface + Unmarshal() unMarshalLagProtocol + // validate validates LagProtocol + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LagProtocol, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns LagProtocolChoiceEnum, set in LagProtocol + Choice() LagProtocolChoiceEnum + // setChoice assigns LagProtocolChoiceEnum provided by user to LagProtocol + setChoice(value LagProtocolChoiceEnum) LagProtocol + // HasChoice checks if Choice has been set in LagProtocol + HasChoice() bool + // Lacp returns LagProtocolLacp, set in LagProtocol. + // LagProtocolLacp is the container for link aggregation control protocol settings of a LAG (ports group). + Lacp() LagProtocolLacp + // SetLacp assigns LagProtocolLacp provided by user to LagProtocol. + // LagProtocolLacp is the container for link aggregation control protocol settings of a LAG (ports group). + SetLacp(value LagProtocolLacp) LagProtocol + // HasLacp checks if Lacp has been set in LagProtocol + HasLacp() bool + // Static returns LagProtocolStatic, set in LagProtocol. + // LagProtocolStatic is the container for static link aggregation protocol settings. + Static() LagProtocolStatic + // SetStatic assigns LagProtocolStatic provided by user to LagProtocol. + // LagProtocolStatic is the container for static link aggregation protocol settings. + SetStatic(value LagProtocolStatic) LagProtocol + // HasStatic checks if Static has been set in LagProtocol + HasStatic() bool + setNil() +} + +type LagProtocolChoiceEnum string + +// Enum of Choice on LagProtocol +var LagProtocolChoice = struct { + LACP LagProtocolChoiceEnum + STATIC LagProtocolChoiceEnum +}{ + LACP: LagProtocolChoiceEnum("lacp"), + STATIC: LagProtocolChoiceEnum("static"), +} + +func (obj *lagProtocol) Choice() LagProtocolChoiceEnum { + return LagProtocolChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The type of controlling protocol for the LAG (ports group). +// Choice returns a string +func (obj *lagProtocol) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *lagProtocol) setChoice(value LagProtocolChoiceEnum) LagProtocol { + intValue, ok := otg.LagProtocol_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LagProtocolChoiceEnum", string(value))) + return obj + } + enumValue := otg.LagProtocol_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Static = nil + obj.staticHolder = nil + obj.obj.Lacp = nil + obj.lacpHolder = nil + + if value == LagProtocolChoice.LACP { + obj.obj.Lacp = NewLagProtocolLacp().msg() + } + + if value == LagProtocolChoice.STATIC { + obj.obj.Static = NewLagProtocolStatic().msg() + } + + return obj +} + +// description is TBD +// Lacp returns a LagProtocolLacp +func (obj *lagProtocol) Lacp() LagProtocolLacp { + if obj.obj.Lacp == nil { + obj.setChoice(LagProtocolChoice.LACP) + } + if obj.lacpHolder == nil { + obj.lacpHolder = &lagProtocolLacp{obj: obj.obj.Lacp} + } + return obj.lacpHolder +} + +// description is TBD +// Lacp returns a LagProtocolLacp +func (obj *lagProtocol) HasLacp() bool { + return obj.obj.Lacp != nil +} + +// description is TBD +// SetLacp sets the LagProtocolLacp value in the LagProtocol object +func (obj *lagProtocol) SetLacp(value LagProtocolLacp) LagProtocol { + obj.setChoice(LagProtocolChoice.LACP) + obj.lacpHolder = nil + obj.obj.Lacp = value.msg() + + return obj +} + +// description is TBD +// Static returns a LagProtocolStatic +func (obj *lagProtocol) Static() LagProtocolStatic { + if obj.obj.Static == nil { + obj.setChoice(LagProtocolChoice.STATIC) + } + if obj.staticHolder == nil { + obj.staticHolder = &lagProtocolStatic{obj: obj.obj.Static} + } + return obj.staticHolder +} + +// description is TBD +// Static returns a LagProtocolStatic +func (obj *lagProtocol) HasStatic() bool { + return obj.obj.Static != nil +} + +// description is TBD +// SetStatic sets the LagProtocolStatic value in the LagProtocol object +func (obj *lagProtocol) SetStatic(value LagProtocolStatic) LagProtocol { + obj.setChoice(LagProtocolChoice.STATIC) + obj.staticHolder = nil + obj.obj.Static = value.msg() + + return obj +} + +func (obj *lagProtocol) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Lacp != nil { + + obj.Lacp().validateObj(vObj, set_default) + } + + if obj.obj.Static != nil { + + obj.Static().validateObj(vObj, set_default) + } + +} + +func (obj *lagProtocol) setDefault() { + var choices_set int = 0 + var choice LagProtocolChoiceEnum + + if obj.obj.Lacp != nil { + choices_set += 1 + choice = LagProtocolChoice.LACP + } + + if obj.obj.Static != nil { + choices_set += 1 + choice = LagProtocolChoice.STATIC + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(LagProtocolChoice.LACP) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in LagProtocol") + } + } else { + intVal := otg.LagProtocol_Choice_Enum_value[string(choice)] + enumValue := otg.LagProtocol_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/lag_protocol_lacp.go b/gosnappi/lag_protocol_lacp.go new file mode 100644 index 00000000..dfdd9f98 --- /dev/null +++ b/gosnappi/lag_protocol_lacp.go @@ -0,0 +1,400 @@ +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" +) + +// ***** LagProtocolLacp ***** +type lagProtocolLacp struct { + validation + obj *otg.LagProtocolLacp + marshaller marshalLagProtocolLacp + unMarshaller unMarshalLagProtocolLacp +} + +func NewLagProtocolLacp() LagProtocolLacp { + obj := lagProtocolLacp{obj: &otg.LagProtocolLacp{}} + obj.setDefault() + return &obj +} + +func (obj *lagProtocolLacp) msg() *otg.LagProtocolLacp { + return obj.obj +} + +func (obj *lagProtocolLacp) setMsg(msg *otg.LagProtocolLacp) LagProtocolLacp { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallagProtocolLacp struct { + obj *lagProtocolLacp +} + +type marshalLagProtocolLacp interface { + // ToProto marshals LagProtocolLacp to protobuf object *otg.LagProtocolLacp + ToProto() (*otg.LagProtocolLacp, error) + // ToPbText marshals LagProtocolLacp to protobuf text + ToPbText() (string, error) + // ToYaml marshals LagProtocolLacp to YAML text + ToYaml() (string, error) + // ToJson marshals LagProtocolLacp to JSON text + ToJson() (string, error) +} + +type unMarshallagProtocolLacp struct { + obj *lagProtocolLacp +} + +type unMarshalLagProtocolLacp interface { + // FromProto unmarshals LagProtocolLacp from protobuf object *otg.LagProtocolLacp + FromProto(msg *otg.LagProtocolLacp) (LagProtocolLacp, error) + // FromPbText unmarshals LagProtocolLacp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LagProtocolLacp from YAML text + FromYaml(value string) error + // FromJson unmarshals LagProtocolLacp from JSON text + FromJson(value string) error +} + +func (obj *lagProtocolLacp) Marshal() marshalLagProtocolLacp { + if obj.marshaller == nil { + obj.marshaller = &marshallagProtocolLacp{obj: obj} + } + return obj.marshaller +} + +func (obj *lagProtocolLacp) Unmarshal() unMarshalLagProtocolLacp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallagProtocolLacp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallagProtocolLacp) ToProto() (*otg.LagProtocolLacp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallagProtocolLacp) FromProto(msg *otg.LagProtocolLacp) (LagProtocolLacp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallagProtocolLacp) 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 *unMarshallagProtocolLacp) 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 *marshallagProtocolLacp) 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 *unMarshallagProtocolLacp) 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 *marshallagProtocolLacp) 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 *unMarshallagProtocolLacp) 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 *lagProtocolLacp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lagProtocolLacp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lagProtocolLacp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lagProtocolLacp) Clone() (LagProtocolLacp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLagProtocolLacp() + 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 +} + +// LagProtocolLacp is the container for link aggregation control protocol settings of a LAG (ports group). +type LagProtocolLacp interface { + Validation + // msg marshals LagProtocolLacp to protobuf object *otg.LagProtocolLacp + // and doesn't set defaults + msg() *otg.LagProtocolLacp + // setMsg unmarshals LagProtocolLacp from protobuf object *otg.LagProtocolLacp + // and doesn't set defaults + setMsg(*otg.LagProtocolLacp) LagProtocolLacp + // provides marshal interface + Marshal() marshalLagProtocolLacp + // provides unmarshal interface + Unmarshal() unMarshalLagProtocolLacp + // validate validates LagProtocolLacp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LagProtocolLacp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ActorSystemId returns string, set in LagProtocolLacp. + ActorSystemId() string + // SetActorSystemId assigns string provided by user to LagProtocolLacp + SetActorSystemId(value string) LagProtocolLacp + // HasActorSystemId checks if ActorSystemId has been set in LagProtocolLacp + HasActorSystemId() bool + // ActorSystemPriority returns uint32, set in LagProtocolLacp. + ActorSystemPriority() uint32 + // SetActorSystemPriority assigns uint32 provided by user to LagProtocolLacp + SetActorSystemPriority(value uint32) LagProtocolLacp + // HasActorSystemPriority checks if ActorSystemPriority has been set in LagProtocolLacp + HasActorSystemPriority() bool + // ActorKey returns uint32, set in LagProtocolLacp. + ActorKey() uint32 + // SetActorKey assigns uint32 provided by user to LagProtocolLacp + SetActorKey(value uint32) LagProtocolLacp + // HasActorKey checks if ActorKey has been set in LagProtocolLacp + HasActorKey() bool +} + +// The actor system id +// ActorSystemId returns a string +func (obj *lagProtocolLacp) ActorSystemId() string { + + return *obj.obj.ActorSystemId + +} + +// The actor system id +// ActorSystemId returns a string +func (obj *lagProtocolLacp) HasActorSystemId() bool { + return obj.obj.ActorSystemId != nil +} + +// The actor system id +// SetActorSystemId sets the string value in the LagProtocolLacp object +func (obj *lagProtocolLacp) SetActorSystemId(value string) LagProtocolLacp { + + obj.obj.ActorSystemId = &value + return obj +} + +// The actor system priority +// ActorSystemPriority returns a uint32 +func (obj *lagProtocolLacp) ActorSystemPriority() uint32 { + + return *obj.obj.ActorSystemPriority + +} + +// The actor system priority +// ActorSystemPriority returns a uint32 +func (obj *lagProtocolLacp) HasActorSystemPriority() bool { + return obj.obj.ActorSystemPriority != nil +} + +// The actor system priority +// SetActorSystemPriority sets the uint32 value in the LagProtocolLacp object +func (obj *lagProtocolLacp) SetActorSystemPriority(value uint32) LagProtocolLacp { + + obj.obj.ActorSystemPriority = &value + return obj +} + +// The actor key +// ActorKey returns a uint32 +func (obj *lagProtocolLacp) ActorKey() uint32 { + + return *obj.obj.ActorKey + +} + +// The actor key +// ActorKey returns a uint32 +func (obj *lagProtocolLacp) HasActorKey() bool { + return obj.obj.ActorKey != nil +} + +// The actor key +// SetActorKey sets the uint32 value in the LagProtocolLacp object +func (obj *lagProtocolLacp) SetActorKey(value uint32) LagProtocolLacp { + + obj.obj.ActorKey = &value + return obj +} + +func (obj *lagProtocolLacp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.ActorSystemId != nil { + + err := obj.validateMac(obj.ActorSystemId()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on LagProtocolLacp.ActorSystemId")) + } + + } + + if obj.obj.ActorSystemPriority != nil { + + if *obj.obj.ActorSystemPriority > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= LagProtocolLacp.ActorSystemPriority <= 65535 but Got %d", *obj.obj.ActorSystemPriority)) + } + + } + + if obj.obj.ActorKey != nil { + + if *obj.obj.ActorKey > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= LagProtocolLacp.ActorKey <= 65535 but Got %d", *obj.obj.ActorKey)) + } + + } + +} + +func (obj *lagProtocolLacp) setDefault() { + if obj.obj.ActorSystemId == nil { + obj.SetActorSystemId("00:00:00:00:00:00") + } + if obj.obj.ActorSystemPriority == nil { + obj.SetActorSystemPriority(0) + } + if obj.obj.ActorKey == nil { + obj.SetActorKey(0) + } + +} diff --git a/gosnappi/lag_protocol_static.go b/gosnappi/lag_protocol_static.go new file mode 100644 index 00000000..13b1d255 --- /dev/null +++ b/gosnappi/lag_protocol_static.go @@ -0,0 +1,319 @@ +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" +) + +// ***** LagProtocolStatic ***** +type lagProtocolStatic struct { + validation + obj *otg.LagProtocolStatic + marshaller marshalLagProtocolStatic + unMarshaller unMarshalLagProtocolStatic +} + +func NewLagProtocolStatic() LagProtocolStatic { + obj := lagProtocolStatic{obj: &otg.LagProtocolStatic{}} + obj.setDefault() + return &obj +} + +func (obj *lagProtocolStatic) msg() *otg.LagProtocolStatic { + return obj.obj +} + +func (obj *lagProtocolStatic) setMsg(msg *otg.LagProtocolStatic) LagProtocolStatic { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallagProtocolStatic struct { + obj *lagProtocolStatic +} + +type marshalLagProtocolStatic interface { + // ToProto marshals LagProtocolStatic to protobuf object *otg.LagProtocolStatic + ToProto() (*otg.LagProtocolStatic, error) + // ToPbText marshals LagProtocolStatic to protobuf text + ToPbText() (string, error) + // ToYaml marshals LagProtocolStatic to YAML text + ToYaml() (string, error) + // ToJson marshals LagProtocolStatic to JSON text + ToJson() (string, error) +} + +type unMarshallagProtocolStatic struct { + obj *lagProtocolStatic +} + +type unMarshalLagProtocolStatic interface { + // FromProto unmarshals LagProtocolStatic from protobuf object *otg.LagProtocolStatic + FromProto(msg *otg.LagProtocolStatic) (LagProtocolStatic, error) + // FromPbText unmarshals LagProtocolStatic from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LagProtocolStatic from YAML text + FromYaml(value string) error + // FromJson unmarshals LagProtocolStatic from JSON text + FromJson(value string) error +} + +func (obj *lagProtocolStatic) Marshal() marshalLagProtocolStatic { + if obj.marshaller == nil { + obj.marshaller = &marshallagProtocolStatic{obj: obj} + } + return obj.marshaller +} + +func (obj *lagProtocolStatic) Unmarshal() unMarshalLagProtocolStatic { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallagProtocolStatic{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallagProtocolStatic) ToProto() (*otg.LagProtocolStatic, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallagProtocolStatic) FromProto(msg *otg.LagProtocolStatic) (LagProtocolStatic, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallagProtocolStatic) 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 *unMarshallagProtocolStatic) 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 *marshallagProtocolStatic) 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 *unMarshallagProtocolStatic) 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 *marshallagProtocolStatic) 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 *unMarshallagProtocolStatic) 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 *lagProtocolStatic) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lagProtocolStatic) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lagProtocolStatic) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lagProtocolStatic) Clone() (LagProtocolStatic, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLagProtocolStatic() + 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 +} + +// LagProtocolStatic is the container for static link aggregation protocol settings. +type LagProtocolStatic interface { + Validation + // msg marshals LagProtocolStatic to protobuf object *otg.LagProtocolStatic + // and doesn't set defaults + msg() *otg.LagProtocolStatic + // setMsg unmarshals LagProtocolStatic from protobuf object *otg.LagProtocolStatic + // and doesn't set defaults + setMsg(*otg.LagProtocolStatic) LagProtocolStatic + // provides marshal interface + Marshal() marshalLagProtocolStatic + // provides unmarshal interface + Unmarshal() unMarshalLagProtocolStatic + // validate validates LagProtocolStatic + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LagProtocolStatic, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // LagId returns uint32, set in LagProtocolStatic. + LagId() uint32 + // SetLagId assigns uint32 provided by user to LagProtocolStatic + SetLagId(value uint32) LagProtocolStatic + // HasLagId checks if LagId has been set in LagProtocolStatic + HasLagId() bool +} + +// The static lag id +// LagId returns a uint32 +func (obj *lagProtocolStatic) LagId() uint32 { + + return *obj.obj.LagId + +} + +// The static lag id +// LagId returns a uint32 +func (obj *lagProtocolStatic) HasLagId() bool { + return obj.obj.LagId != nil +} + +// The static lag id +// SetLagId sets the uint32 value in the LagProtocolStatic object +func (obj *lagProtocolStatic) SetLagId(value uint32) LagProtocolStatic { + + obj.obj.LagId = &value + return obj +} + +func (obj *lagProtocolStatic) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.LagId != nil { + + if *obj.obj.LagId > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= LagProtocolStatic.LagId <= 65535 but Got %d", *obj.obj.LagId)) + } + + } + +} + +func (obj *lagProtocolStatic) setDefault() { + if obj.obj.LagId == nil { + obj.SetLagId(0) + } + +} diff --git a/gosnappi/layer1.go b/gosnappi/layer1.go new file mode 100644 index 00000000..6e6dfb57 --- /dev/null +++ b/gosnappi/layer1.go @@ -0,0 +1,711 @@ +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" +) + +// ***** Layer1 ***** +type layer1 struct { + validation + obj *otg.Layer1 + marshaller marshalLayer1 + unMarshaller unMarshalLayer1 + autoNegotiationHolder Layer1AutoNegotiation + flowControlHolder Layer1FlowControl +} + +func NewLayer1() Layer1 { + obj := layer1{obj: &otg.Layer1{}} + obj.setDefault() + return &obj +} + +func (obj *layer1) msg() *otg.Layer1 { + return obj.obj +} + +func (obj *layer1) setMsg(msg *otg.Layer1) Layer1 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshallayer1 struct { + obj *layer1 +} + +type marshalLayer1 interface { + // ToProto marshals Layer1 to protobuf object *otg.Layer1 + ToProto() (*otg.Layer1, error) + // ToPbText marshals Layer1 to protobuf text + ToPbText() (string, error) + // ToYaml marshals Layer1 to YAML text + ToYaml() (string, error) + // ToJson marshals Layer1 to JSON text + ToJson() (string, error) +} + +type unMarshallayer1 struct { + obj *layer1 +} + +type unMarshalLayer1 interface { + // FromProto unmarshals Layer1 from protobuf object *otg.Layer1 + FromProto(msg *otg.Layer1) (Layer1, error) + // FromPbText unmarshals Layer1 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Layer1 from YAML text + FromYaml(value string) error + // FromJson unmarshals Layer1 from JSON text + FromJson(value string) error +} + +func (obj *layer1) Marshal() marshalLayer1 { + if obj.marshaller == nil { + obj.marshaller = &marshallayer1{obj: obj} + } + return obj.marshaller +} + +func (obj *layer1) Unmarshal() unMarshalLayer1 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallayer1{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallayer1) ToProto() (*otg.Layer1, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallayer1) FromProto(msg *otg.Layer1) (Layer1, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallayer1) 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 *unMarshallayer1) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshallayer1) 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 *unMarshallayer1) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshallayer1) 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 *unMarshallayer1) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *layer1) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *layer1) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *layer1) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *layer1) Clone() (Layer1, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLayer1() + 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 +} + +func (obj *layer1) setNil() { + obj.autoNegotiationHolder = nil + obj.flowControlHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// Layer1 is a container for layer1 settings. +type Layer1 interface { + Validation + // msg marshals Layer1 to protobuf object *otg.Layer1 + // and doesn't set defaults + msg() *otg.Layer1 + // setMsg unmarshals Layer1 from protobuf object *otg.Layer1 + // and doesn't set defaults + setMsg(*otg.Layer1) Layer1 + // provides marshal interface + Marshal() marshalLayer1 + // provides unmarshal interface + Unmarshal() unMarshalLayer1 + // validate validates Layer1 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Layer1, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PortNames returns []string, set in Layer1. + PortNames() []string + // SetPortNames assigns []string provided by user to Layer1 + SetPortNames(value []string) Layer1 + // Speed returns Layer1SpeedEnum, set in Layer1 + Speed() Layer1SpeedEnum + // SetSpeed assigns Layer1SpeedEnum provided by user to Layer1 + SetSpeed(value Layer1SpeedEnum) Layer1 + // HasSpeed checks if Speed has been set in Layer1 + HasSpeed() bool + // Media returns Layer1MediaEnum, set in Layer1 + Media() Layer1MediaEnum + // SetMedia assigns Layer1MediaEnum provided by user to Layer1 + SetMedia(value Layer1MediaEnum) Layer1 + // HasMedia checks if Media has been set in Layer1 + HasMedia() bool + // Promiscuous returns bool, set in Layer1. + Promiscuous() bool + // SetPromiscuous assigns bool provided by user to Layer1 + SetPromiscuous(value bool) Layer1 + // HasPromiscuous checks if Promiscuous has been set in Layer1 + HasPromiscuous() bool + // Mtu returns uint32, set in Layer1. + Mtu() uint32 + // SetMtu assigns uint32 provided by user to Layer1 + SetMtu(value uint32) Layer1 + // HasMtu checks if Mtu has been set in Layer1 + HasMtu() bool + // IeeeMediaDefaults returns bool, set in Layer1. + IeeeMediaDefaults() bool + // SetIeeeMediaDefaults assigns bool provided by user to Layer1 + SetIeeeMediaDefaults(value bool) Layer1 + // HasIeeeMediaDefaults checks if IeeeMediaDefaults has been set in Layer1 + HasIeeeMediaDefaults() bool + // AutoNegotiate returns bool, set in Layer1. + AutoNegotiate() bool + // SetAutoNegotiate assigns bool provided by user to Layer1 + SetAutoNegotiate(value bool) Layer1 + // HasAutoNegotiate checks if AutoNegotiate has been set in Layer1 + HasAutoNegotiate() bool + // AutoNegotiation returns Layer1AutoNegotiation, set in Layer1. + // Layer1AutoNegotiation is configuration for auto negotiation settings + AutoNegotiation() Layer1AutoNegotiation + // SetAutoNegotiation assigns Layer1AutoNegotiation provided by user to Layer1. + // Layer1AutoNegotiation is configuration for auto negotiation settings + SetAutoNegotiation(value Layer1AutoNegotiation) Layer1 + // HasAutoNegotiation checks if AutoNegotiation has been set in Layer1 + HasAutoNegotiation() bool + // FlowControl returns Layer1FlowControl, set in Layer1. + // Layer1FlowControl is a container for layer1 receive flow control settings. + // To enable flow control settings on ports this object must be a valid + // object not a null value. + FlowControl() Layer1FlowControl + // SetFlowControl assigns Layer1FlowControl provided by user to Layer1. + // Layer1FlowControl is a container for layer1 receive flow control settings. + // To enable flow control settings on ports this object must be a valid + // object not a null value. + SetFlowControl(value Layer1FlowControl) Layer1 + // HasFlowControl checks if FlowControl has been set in Layer1 + HasFlowControl() bool + // Name returns string, set in Layer1. + Name() string + // SetName assigns string provided by user to Layer1 + SetName(value string) Layer1 + setNil() +} + +// A list of unique names of port objects that will share the +// choice settings. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// PortNames returns a []string +func (obj *layer1) PortNames() []string { + if obj.obj.PortNames == nil { + obj.obj.PortNames = make([]string, 0) + } + return obj.obj.PortNames +} + +// A list of unique names of port objects that will share the +// choice settings. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// SetPortNames sets the []string value in the Layer1 object +func (obj *layer1) SetPortNames(value []string) Layer1 { + + if obj.obj.PortNames == nil { + obj.obj.PortNames = make([]string, 0) + } + obj.obj.PortNames = value + + return obj +} + +type Layer1SpeedEnum string + +// Enum of Speed on Layer1 +var Layer1Speed = struct { + SPEED_10_FD_MBPS Layer1SpeedEnum + SPEED_10_HD_MBPS Layer1SpeedEnum + SPEED_100_FD_MBPS Layer1SpeedEnum + SPEED_100_HD_MBPS Layer1SpeedEnum + SPEED_1_GBPS Layer1SpeedEnum + SPEED_10_GBPS Layer1SpeedEnum + SPEED_25_GBPS Layer1SpeedEnum + SPEED_40_GBPS Layer1SpeedEnum + SPEED_50_GBPS Layer1SpeedEnum + SPEED_100_GBPS Layer1SpeedEnum + SPEED_200_GBPS Layer1SpeedEnum + SPEED_400_GBPS Layer1SpeedEnum + SPEED_800_GBPS Layer1SpeedEnum +}{ + SPEED_10_FD_MBPS: Layer1SpeedEnum("speed_10_fd_mbps"), + SPEED_10_HD_MBPS: Layer1SpeedEnum("speed_10_hd_mbps"), + SPEED_100_FD_MBPS: Layer1SpeedEnum("speed_100_fd_mbps"), + SPEED_100_HD_MBPS: Layer1SpeedEnum("speed_100_hd_mbps"), + SPEED_1_GBPS: Layer1SpeedEnum("speed_1_gbps"), + SPEED_10_GBPS: Layer1SpeedEnum("speed_10_gbps"), + SPEED_25_GBPS: Layer1SpeedEnum("speed_25_gbps"), + SPEED_40_GBPS: Layer1SpeedEnum("speed_40_gbps"), + SPEED_50_GBPS: Layer1SpeedEnum("speed_50_gbps"), + SPEED_100_GBPS: Layer1SpeedEnum("speed_100_gbps"), + SPEED_200_GBPS: Layer1SpeedEnum("speed_200_gbps"), + SPEED_400_GBPS: Layer1SpeedEnum("speed_400_gbps"), + SPEED_800_GBPS: Layer1SpeedEnum("speed_800_gbps"), +} + +func (obj *layer1) Speed() Layer1SpeedEnum { + return Layer1SpeedEnum(obj.obj.Speed.Enum().String()) +} + +// Set the speed if supported. When no speed is explicitly set, the current +// speed of underlying test interface shall be assumed. +// Speed returns a string +func (obj *layer1) HasSpeed() bool { + return obj.obj.Speed != nil +} + +func (obj *layer1) SetSpeed(value Layer1SpeedEnum) Layer1 { + intValue, ok := otg.Layer1_Speed_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on Layer1SpeedEnum", string(value))) + return obj + } + enumValue := otg.Layer1_Speed_Enum(intValue) + obj.obj.Speed = &enumValue + + return obj +} + +type Layer1MediaEnum string + +// Enum of Media on Layer1 +var Layer1Media = struct { + COPPER Layer1MediaEnum + FIBER Layer1MediaEnum + SGMII Layer1MediaEnum +}{ + COPPER: Layer1MediaEnum("copper"), + FIBER: Layer1MediaEnum("fiber"), + SGMII: Layer1MediaEnum("sgmii"), +} + +func (obj *layer1) Media() Layer1MediaEnum { + return Layer1MediaEnum(obj.obj.Media.Enum().String()) +} + +// Set the type of media for test interface if supported. When no media +// type is explicitly set, the current media type of underlying test +// interface shall be assumed. +// Media returns a string +func (obj *layer1) HasMedia() bool { + return obj.obj.Media != nil +} + +func (obj *layer1) SetMedia(value Layer1MediaEnum) Layer1 { + intValue, ok := otg.Layer1_Media_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on Layer1MediaEnum", string(value))) + return obj + } + enumValue := otg.Layer1_Media_Enum(intValue) + obj.obj.Media = &enumValue + + return obj +} + +// Enable promiscuous mode on test interface. A warning shall be raised if +// this field is set to `true`, even when it's not supported, ignoring +// the setting altogether. +// Promiscuous returns a bool +func (obj *layer1) Promiscuous() bool { + + return *obj.obj.Promiscuous + +} + +// Enable promiscuous mode on test interface. A warning shall be raised if +// this field is set to `true`, even when it's not supported, ignoring +// the setting altogether. +// Promiscuous returns a bool +func (obj *layer1) HasPromiscuous() bool { + return obj.obj.Promiscuous != nil +} + +// Enable promiscuous mode on test interface. A warning shall be raised if +// this field is set to `true`, even when it's not supported, ignoring +// the setting altogether. +// SetPromiscuous sets the bool value in the Layer1 object +func (obj *layer1) SetPromiscuous(value bool) Layer1 { + + obj.obj.Promiscuous = &value + return obj +} + +// Set the maximum transmission unit size. A warning shall be raised if +// the specified value is valid but not supported, ignoring the setting altogether. +// Mtu returns a uint32 +func (obj *layer1) Mtu() uint32 { + + return *obj.obj.Mtu + +} + +// Set the maximum transmission unit size. A warning shall be raised if +// the specified value is valid but not supported, ignoring the setting altogether. +// Mtu returns a uint32 +func (obj *layer1) HasMtu() bool { + return obj.obj.Mtu != nil +} + +// Set the maximum transmission unit size. A warning shall be raised if +// the specified value is valid but not supported, ignoring the setting altogether. +// SetMtu sets the uint32 value in the Layer1 object +func (obj *layer1) SetMtu(value uint32) Layer1 { + + obj.obj.Mtu = &value + return obj +} + +// Under Review: This field is currently under review for pending exploration on use cases +// +// Under Review: This field is currently under review for pending exploration on use cases +// +// Set to true to override the auto_negotiate, link_training +// and rs_fec settings for gigabit ethernet interfaces. +// IeeeMediaDefaults returns a bool +func (obj *layer1) IeeeMediaDefaults() bool { + + return *obj.obj.IeeeMediaDefaults + +} + +// Under Review: This field is currently under review for pending exploration on use cases +// +// Under Review: This field is currently under review for pending exploration on use cases +// +// Set to true to override the auto_negotiate, link_training +// and rs_fec settings for gigabit ethernet interfaces. +// IeeeMediaDefaults returns a bool +func (obj *layer1) HasIeeeMediaDefaults() bool { + return obj.obj.IeeeMediaDefaults != nil +} + +// Under Review: This field is currently under review for pending exploration on use cases +// +// Under Review: This field is currently under review for pending exploration on use cases +// +// Set to true to override the auto_negotiate, link_training +// and rs_fec settings for gigabit ethernet interfaces. +// SetIeeeMediaDefaults sets the bool value in the Layer1 object +func (obj *layer1) SetIeeeMediaDefaults(value bool) Layer1 { + + obj.obj.IeeeMediaDefaults = &value + return obj +} + +// Under Review: This field is currently under review for pending exploration on use cases, given that a separate configuration called `AutoNegotiation` already exists. +// +// Under Review: This field is currently under review for pending exploration on use cases, given that a separate configuration called `AutoNegotiation` already exists. +// +// Enable/disable auto negotiation. +// AutoNegotiate returns a bool +func (obj *layer1) AutoNegotiate() bool { + + return *obj.obj.AutoNegotiate + +} + +// Under Review: This field is currently under review for pending exploration on use cases, given that a separate configuration called `AutoNegotiation` already exists. +// +// Under Review: This field is currently under review for pending exploration on use cases, given that a separate configuration called `AutoNegotiation` already exists. +// +// Enable/disable auto negotiation. +// AutoNegotiate returns a bool +func (obj *layer1) HasAutoNegotiate() bool { + return obj.obj.AutoNegotiate != nil +} + +// Under Review: This field is currently under review for pending exploration on use cases, given that a separate configuration called `AutoNegotiation` already exists. +// +// Under Review: This field is currently under review for pending exploration on use cases, given that a separate configuration called `AutoNegotiation` already exists. +// +// Enable/disable auto negotiation. +// SetAutoNegotiate sets the bool value in the Layer1 object +func (obj *layer1) SetAutoNegotiate(value bool) Layer1 { + + obj.obj.AutoNegotiate = &value + return obj +} + +// description is TBD +// AutoNegotiation returns a Layer1AutoNegotiation +func (obj *layer1) AutoNegotiation() Layer1AutoNegotiation { + if obj.obj.AutoNegotiation == nil { + obj.obj.AutoNegotiation = NewLayer1AutoNegotiation().msg() + } + if obj.autoNegotiationHolder == nil { + obj.autoNegotiationHolder = &layer1AutoNegotiation{obj: obj.obj.AutoNegotiation} + } + return obj.autoNegotiationHolder +} + +// description is TBD +// AutoNegotiation returns a Layer1AutoNegotiation +func (obj *layer1) HasAutoNegotiation() bool { + return obj.obj.AutoNegotiation != nil +} + +// description is TBD +// SetAutoNegotiation sets the Layer1AutoNegotiation value in the Layer1 object +func (obj *layer1) SetAutoNegotiation(value Layer1AutoNegotiation) Layer1 { + + obj.autoNegotiationHolder = nil + obj.obj.AutoNegotiation = value.msg() + + return obj +} + +// description is TBD +// FlowControl returns a Layer1FlowControl +func (obj *layer1) FlowControl() Layer1FlowControl { + if obj.obj.FlowControl == nil { + obj.obj.FlowControl = NewLayer1FlowControl().msg() + } + if obj.flowControlHolder == nil { + obj.flowControlHolder = &layer1FlowControl{obj: obj.obj.FlowControl} + } + return obj.flowControlHolder +} + +// description is TBD +// FlowControl returns a Layer1FlowControl +func (obj *layer1) HasFlowControl() bool { + return obj.obj.FlowControl != nil +} + +// description is TBD +// SetFlowControl sets the Layer1FlowControl value in the Layer1 object +func (obj *layer1) SetFlowControl(value Layer1FlowControl) Layer1 { + + obj.flowControlHolder = nil + obj.obj.FlowControl = value.msg() + + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *layer1) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the Layer1 object +func (obj *layer1) SetName(value string) Layer1 { + + obj.obj.Name = &value + return obj +} + +func (obj *layer1) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Mtu != nil { + + if *obj.obj.Mtu < 64 || *obj.obj.Mtu > 9000 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("64 <= Layer1.Mtu <= 9000 but Got %d", *obj.obj.Mtu)) + } + + } + + if obj.obj.AutoNegotiation != nil { + + obj.AutoNegotiation().validateObj(vObj, set_default) + } + + if obj.obj.FlowControl != nil { + + obj.FlowControl().validateObj(vObj, set_default) + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface Layer1") + } +} + +func (obj *layer1) setDefault() { + if obj.obj.Promiscuous == nil { + obj.SetPromiscuous(true) + } + if obj.obj.Mtu == nil { + obj.SetMtu(1500) + } + +} diff --git a/gosnappi/layer1_auto_negotiation.go b/gosnappi/layer1_auto_negotiation.go new file mode 100644 index 00000000..b52a06dc --- /dev/null +++ b/gosnappi/layer1_auto_negotiation.go @@ -0,0 +1,510 @@ +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" +) + +// ***** Layer1AutoNegotiation ***** +type layer1AutoNegotiation struct { + validation + obj *otg.Layer1AutoNegotiation + marshaller marshalLayer1AutoNegotiation + unMarshaller unMarshalLayer1AutoNegotiation +} + +func NewLayer1AutoNegotiation() Layer1AutoNegotiation { + obj := layer1AutoNegotiation{obj: &otg.Layer1AutoNegotiation{}} + obj.setDefault() + return &obj +} + +func (obj *layer1AutoNegotiation) msg() *otg.Layer1AutoNegotiation { + return obj.obj +} + +func (obj *layer1AutoNegotiation) setMsg(msg *otg.Layer1AutoNegotiation) Layer1AutoNegotiation { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallayer1AutoNegotiation struct { + obj *layer1AutoNegotiation +} + +type marshalLayer1AutoNegotiation interface { + // ToProto marshals Layer1AutoNegotiation to protobuf object *otg.Layer1AutoNegotiation + ToProto() (*otg.Layer1AutoNegotiation, error) + // ToPbText marshals Layer1AutoNegotiation to protobuf text + ToPbText() (string, error) + // ToYaml marshals Layer1AutoNegotiation to YAML text + ToYaml() (string, error) + // ToJson marshals Layer1AutoNegotiation to JSON text + ToJson() (string, error) +} + +type unMarshallayer1AutoNegotiation struct { + obj *layer1AutoNegotiation +} + +type unMarshalLayer1AutoNegotiation interface { + // FromProto unmarshals Layer1AutoNegotiation from protobuf object *otg.Layer1AutoNegotiation + FromProto(msg *otg.Layer1AutoNegotiation) (Layer1AutoNegotiation, error) + // FromPbText unmarshals Layer1AutoNegotiation from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Layer1AutoNegotiation from YAML text + FromYaml(value string) error + // FromJson unmarshals Layer1AutoNegotiation from JSON text + FromJson(value string) error +} + +func (obj *layer1AutoNegotiation) Marshal() marshalLayer1AutoNegotiation { + if obj.marshaller == nil { + obj.marshaller = &marshallayer1AutoNegotiation{obj: obj} + } + return obj.marshaller +} + +func (obj *layer1AutoNegotiation) Unmarshal() unMarshalLayer1AutoNegotiation { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallayer1AutoNegotiation{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallayer1AutoNegotiation) ToProto() (*otg.Layer1AutoNegotiation, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallayer1AutoNegotiation) FromProto(msg *otg.Layer1AutoNegotiation) (Layer1AutoNegotiation, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallayer1AutoNegotiation) 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 *unMarshallayer1AutoNegotiation) 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 *marshallayer1AutoNegotiation) 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 *unMarshallayer1AutoNegotiation) 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 *marshallayer1AutoNegotiation) 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 *unMarshallayer1AutoNegotiation) 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 *layer1AutoNegotiation) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *layer1AutoNegotiation) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *layer1AutoNegotiation) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *layer1AutoNegotiation) Clone() (Layer1AutoNegotiation, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLayer1AutoNegotiation() + 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 +} + +// Layer1AutoNegotiation is configuration for auto negotiation settings +type Layer1AutoNegotiation interface { + Validation + // msg marshals Layer1AutoNegotiation to protobuf object *otg.Layer1AutoNegotiation + // and doesn't set defaults + msg() *otg.Layer1AutoNegotiation + // setMsg unmarshals Layer1AutoNegotiation from protobuf object *otg.Layer1AutoNegotiation + // and doesn't set defaults + setMsg(*otg.Layer1AutoNegotiation) Layer1AutoNegotiation + // provides marshal interface + Marshal() marshalLayer1AutoNegotiation + // provides unmarshal interface + Unmarshal() unMarshalLayer1AutoNegotiation + // validate validates Layer1AutoNegotiation + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Layer1AutoNegotiation, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Advertise1000Mbps returns bool, set in Layer1AutoNegotiation. + Advertise1000Mbps() bool + // SetAdvertise1000Mbps assigns bool provided by user to Layer1AutoNegotiation + SetAdvertise1000Mbps(value bool) Layer1AutoNegotiation + // HasAdvertise1000Mbps checks if Advertise1000Mbps has been set in Layer1AutoNegotiation + HasAdvertise1000Mbps() bool + // Advertise100FdMbps returns bool, set in Layer1AutoNegotiation. + Advertise100FdMbps() bool + // SetAdvertise100FdMbps assigns bool provided by user to Layer1AutoNegotiation + SetAdvertise100FdMbps(value bool) Layer1AutoNegotiation + // HasAdvertise100FdMbps checks if Advertise100FdMbps has been set in Layer1AutoNegotiation + HasAdvertise100FdMbps() bool + // Advertise100HdMbps returns bool, set in Layer1AutoNegotiation. + Advertise100HdMbps() bool + // SetAdvertise100HdMbps assigns bool provided by user to Layer1AutoNegotiation + SetAdvertise100HdMbps(value bool) Layer1AutoNegotiation + // HasAdvertise100HdMbps checks if Advertise100HdMbps has been set in Layer1AutoNegotiation + HasAdvertise100HdMbps() bool + // Advertise10FdMbps returns bool, set in Layer1AutoNegotiation. + Advertise10FdMbps() bool + // SetAdvertise10FdMbps assigns bool provided by user to Layer1AutoNegotiation + SetAdvertise10FdMbps(value bool) Layer1AutoNegotiation + // HasAdvertise10FdMbps checks if Advertise10FdMbps has been set in Layer1AutoNegotiation + HasAdvertise10FdMbps() bool + // Advertise10HdMbps returns bool, set in Layer1AutoNegotiation. + Advertise10HdMbps() bool + // SetAdvertise10HdMbps assigns bool provided by user to Layer1AutoNegotiation + SetAdvertise10HdMbps(value bool) Layer1AutoNegotiation + // HasAdvertise10HdMbps checks if Advertise10HdMbps has been set in Layer1AutoNegotiation + HasAdvertise10HdMbps() bool + // LinkTraining returns bool, set in Layer1AutoNegotiation. + LinkTraining() bool + // SetLinkTraining assigns bool provided by user to Layer1AutoNegotiation + SetLinkTraining(value bool) Layer1AutoNegotiation + // HasLinkTraining checks if LinkTraining has been set in Layer1AutoNegotiation + HasLinkTraining() bool + // RsFec returns bool, set in Layer1AutoNegotiation. + RsFec() bool + // SetRsFec assigns bool provided by user to Layer1AutoNegotiation + SetRsFec(value bool) Layer1AutoNegotiation + // HasRsFec checks if RsFec has been set in Layer1AutoNegotiation + HasRsFec() bool +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// Advertise1000Mbps returns a bool +func (obj *layer1AutoNegotiation) Advertise1000Mbps() bool { + + return *obj.obj.Advertise_1000Mbps + +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// Advertise1000Mbps returns a bool +func (obj *layer1AutoNegotiation) HasAdvertise1000Mbps() bool { + return obj.obj.Advertise_1000Mbps != nil +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// SetAdvertise1000Mbps sets the bool value in the Layer1AutoNegotiation object +func (obj *layer1AutoNegotiation) SetAdvertise1000Mbps(value bool) Layer1AutoNegotiation { + + obj.obj.Advertise_1000Mbps = &value + return obj +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// Advertise100FdMbps returns a bool +func (obj *layer1AutoNegotiation) Advertise100FdMbps() bool { + + return *obj.obj.Advertise_100FdMbps + +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// Advertise100FdMbps returns a bool +func (obj *layer1AutoNegotiation) HasAdvertise100FdMbps() bool { + return obj.obj.Advertise_100FdMbps != nil +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// SetAdvertise100FdMbps sets the bool value in the Layer1AutoNegotiation object +func (obj *layer1AutoNegotiation) SetAdvertise100FdMbps(value bool) Layer1AutoNegotiation { + + obj.obj.Advertise_100FdMbps = &value + return obj +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// Advertise100HdMbps returns a bool +func (obj *layer1AutoNegotiation) Advertise100HdMbps() bool { + + return *obj.obj.Advertise_100HdMbps + +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// Advertise100HdMbps returns a bool +func (obj *layer1AutoNegotiation) HasAdvertise100HdMbps() bool { + return obj.obj.Advertise_100HdMbps != nil +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// SetAdvertise100HdMbps sets the bool value in the Layer1AutoNegotiation object +func (obj *layer1AutoNegotiation) SetAdvertise100HdMbps(value bool) Layer1AutoNegotiation { + + obj.obj.Advertise_100HdMbps = &value + return obj +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// Advertise10FdMbps returns a bool +func (obj *layer1AutoNegotiation) Advertise10FdMbps() bool { + + return *obj.obj.Advertise_10FdMbps + +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// Advertise10FdMbps returns a bool +func (obj *layer1AutoNegotiation) HasAdvertise10FdMbps() bool { + return obj.obj.Advertise_10FdMbps != nil +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// SetAdvertise10FdMbps sets the bool value in the Layer1AutoNegotiation object +func (obj *layer1AutoNegotiation) SetAdvertise10FdMbps(value bool) Layer1AutoNegotiation { + + obj.obj.Advertise_10FdMbps = &value + return obj +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// Advertise10HdMbps returns a bool +func (obj *layer1AutoNegotiation) Advertise10HdMbps() bool { + + return *obj.obj.Advertise_10HdMbps + +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// Advertise10HdMbps returns a bool +func (obj *layer1AutoNegotiation) HasAdvertise10HdMbps() bool { + return obj.obj.Advertise_10HdMbps != nil +} + +// If auto_negotiate is true and the interface supports this option +// then this speed will be advertised. +// SetAdvertise10HdMbps sets the bool value in the Layer1AutoNegotiation object +func (obj *layer1AutoNegotiation) SetAdvertise10HdMbps(value bool) Layer1AutoNegotiation { + + obj.obj.Advertise_10HdMbps = &value + return obj +} + +// Enable/disable gigabit ethernet link training. +// LinkTraining returns a bool +func (obj *layer1AutoNegotiation) LinkTraining() bool { + + return *obj.obj.LinkTraining + +} + +// Enable/disable gigabit ethernet link training. +// LinkTraining returns a bool +func (obj *layer1AutoNegotiation) HasLinkTraining() bool { + return obj.obj.LinkTraining != nil +} + +// Enable/disable gigabit ethernet link training. +// SetLinkTraining sets the bool value in the Layer1AutoNegotiation object +func (obj *layer1AutoNegotiation) SetLinkTraining(value bool) Layer1AutoNegotiation { + + obj.obj.LinkTraining = &value + return obj +} + +// Enable/disable gigabit ethernet reed solomon forward error correction (RS FEC). +// RsFec returns a bool +func (obj *layer1AutoNegotiation) RsFec() bool { + + return *obj.obj.RsFec + +} + +// Enable/disable gigabit ethernet reed solomon forward error correction (RS FEC). +// RsFec returns a bool +func (obj *layer1AutoNegotiation) HasRsFec() bool { + return obj.obj.RsFec != nil +} + +// Enable/disable gigabit ethernet reed solomon forward error correction (RS FEC). +// SetRsFec sets the bool value in the Layer1AutoNegotiation object +func (obj *layer1AutoNegotiation) SetRsFec(value bool) Layer1AutoNegotiation { + + obj.obj.RsFec = &value + return obj +} + +func (obj *layer1AutoNegotiation) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *layer1AutoNegotiation) setDefault() { + if obj.obj.Advertise_1000Mbps == nil { + obj.SetAdvertise1000Mbps(true) + } + if obj.obj.Advertise_100FdMbps == nil { + obj.SetAdvertise100FdMbps(true) + } + if obj.obj.Advertise_100HdMbps == nil { + obj.SetAdvertise100HdMbps(true) + } + if obj.obj.Advertise_10FdMbps == nil { + obj.SetAdvertise10FdMbps(true) + } + if obj.obj.Advertise_10HdMbps == nil { + obj.SetAdvertise10HdMbps(true) + } + if obj.obj.LinkTraining == nil { + obj.SetLinkTraining(false) + } + if obj.obj.RsFec == nil { + obj.SetRsFec(false) + } + +} diff --git a/gosnappi/layer1_flow_control.go b/gosnappi/layer1_flow_control.go new file mode 100644 index 00000000..2f08c07f --- /dev/null +++ b/gosnappi/layer1_flow_control.go @@ -0,0 +1,494 @@ +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" +) + +// ***** Layer1FlowControl ***** +type layer1FlowControl struct { + validation + obj *otg.Layer1FlowControl + marshaller marshalLayer1FlowControl + unMarshaller unMarshalLayer1FlowControl + ieee_802_1QbbHolder Layer1Ieee8021Qbb + ieee_802_3XHolder Layer1Ieee8023X +} + +func NewLayer1FlowControl() Layer1FlowControl { + obj := layer1FlowControl{obj: &otg.Layer1FlowControl{}} + obj.setDefault() + return &obj +} + +func (obj *layer1FlowControl) msg() *otg.Layer1FlowControl { + return obj.obj +} + +func (obj *layer1FlowControl) setMsg(msg *otg.Layer1FlowControl) Layer1FlowControl { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshallayer1FlowControl struct { + obj *layer1FlowControl +} + +type marshalLayer1FlowControl interface { + // ToProto marshals Layer1FlowControl to protobuf object *otg.Layer1FlowControl + ToProto() (*otg.Layer1FlowControl, error) + // ToPbText marshals Layer1FlowControl to protobuf text + ToPbText() (string, error) + // ToYaml marshals Layer1FlowControl to YAML text + ToYaml() (string, error) + // ToJson marshals Layer1FlowControl to JSON text + ToJson() (string, error) +} + +type unMarshallayer1FlowControl struct { + obj *layer1FlowControl +} + +type unMarshalLayer1FlowControl interface { + // FromProto unmarshals Layer1FlowControl from protobuf object *otg.Layer1FlowControl + FromProto(msg *otg.Layer1FlowControl) (Layer1FlowControl, error) + // FromPbText unmarshals Layer1FlowControl from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Layer1FlowControl from YAML text + FromYaml(value string) error + // FromJson unmarshals Layer1FlowControl from JSON text + FromJson(value string) error +} + +func (obj *layer1FlowControl) Marshal() marshalLayer1FlowControl { + if obj.marshaller == nil { + obj.marshaller = &marshallayer1FlowControl{obj: obj} + } + return obj.marshaller +} + +func (obj *layer1FlowControl) Unmarshal() unMarshalLayer1FlowControl { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallayer1FlowControl{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallayer1FlowControl) ToProto() (*otg.Layer1FlowControl, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallayer1FlowControl) FromProto(msg *otg.Layer1FlowControl) (Layer1FlowControl, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallayer1FlowControl) 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 *unMarshallayer1FlowControl) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshallayer1FlowControl) 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 *unMarshallayer1FlowControl) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshallayer1FlowControl) 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 *unMarshallayer1FlowControl) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *layer1FlowControl) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *layer1FlowControl) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *layer1FlowControl) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *layer1FlowControl) Clone() (Layer1FlowControl, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLayer1FlowControl() + 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 +} + +func (obj *layer1FlowControl) setNil() { + obj.ieee_802_1QbbHolder = nil + obj.ieee_802_3XHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// Layer1FlowControl is a container for layer1 receive flow control settings. +// To enable flow control settings on ports this object must be a valid +// object not a null value. +type Layer1FlowControl interface { + Validation + // msg marshals Layer1FlowControl to protobuf object *otg.Layer1FlowControl + // and doesn't set defaults + msg() *otg.Layer1FlowControl + // setMsg unmarshals Layer1FlowControl from protobuf object *otg.Layer1FlowControl + // and doesn't set defaults + setMsg(*otg.Layer1FlowControl) Layer1FlowControl + // provides marshal interface + Marshal() marshalLayer1FlowControl + // provides unmarshal interface + Unmarshal() unMarshalLayer1FlowControl + // validate validates Layer1FlowControl + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Layer1FlowControl, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // DirectedAddress returns string, set in Layer1FlowControl. + DirectedAddress() string + // SetDirectedAddress assigns string provided by user to Layer1FlowControl + SetDirectedAddress(value string) Layer1FlowControl + // HasDirectedAddress checks if DirectedAddress has been set in Layer1FlowControl + HasDirectedAddress() bool + // Choice returns Layer1FlowControlChoiceEnum, set in Layer1FlowControl + Choice() Layer1FlowControlChoiceEnum + // setChoice assigns Layer1FlowControlChoiceEnum provided by user to Layer1FlowControl + setChoice(value Layer1FlowControlChoiceEnum) Layer1FlowControl + // HasChoice checks if Choice has been set in Layer1FlowControl + HasChoice() bool + // Ieee8021Qbb returns Layer1Ieee8021Qbb, set in Layer1FlowControl. + Ieee8021Qbb() Layer1Ieee8021Qbb + // SetIeee8021Qbb assigns Layer1Ieee8021Qbb provided by user to Layer1FlowControl. + SetIeee8021Qbb(value Layer1Ieee8021Qbb) Layer1FlowControl + // HasIeee8021Qbb checks if Ieee8021Qbb has been set in Layer1FlowControl + HasIeee8021Qbb() bool + // Ieee8023X returns Layer1Ieee8023X, set in Layer1FlowControl. + Ieee8023X() Layer1Ieee8023X + // SetIeee8023X assigns Layer1Ieee8023X provided by user to Layer1FlowControl. + SetIeee8023X(value Layer1Ieee8023X) Layer1FlowControl + // HasIeee8023X checks if Ieee8023X has been set in Layer1FlowControl + HasIeee8023X() bool + setNil() +} + +// The 48bit mac address that the layer1 port names will listen on +// for a directed pause. +// DirectedAddress returns a string +func (obj *layer1FlowControl) DirectedAddress() string { + + return *obj.obj.DirectedAddress + +} + +// The 48bit mac address that the layer1 port names will listen on +// for a directed pause. +// DirectedAddress returns a string +func (obj *layer1FlowControl) HasDirectedAddress() bool { + return obj.obj.DirectedAddress != nil +} + +// The 48bit mac address that the layer1 port names will listen on +// for a directed pause. +// SetDirectedAddress sets the string value in the Layer1FlowControl object +func (obj *layer1FlowControl) SetDirectedAddress(value string) Layer1FlowControl { + + obj.obj.DirectedAddress = &value + return obj +} + +type Layer1FlowControlChoiceEnum string + +// Enum of Choice on Layer1FlowControl +var Layer1FlowControlChoice = struct { + IEEE_802_1QBB Layer1FlowControlChoiceEnum + IEEE_802_3X Layer1FlowControlChoiceEnum +}{ + IEEE_802_1QBB: Layer1FlowControlChoiceEnum("ieee_802_1qbb"), + IEEE_802_3X: Layer1FlowControlChoiceEnum("ieee_802_3x"), +} + +func (obj *layer1FlowControl) Choice() Layer1FlowControlChoiceEnum { + return Layer1FlowControlChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The type of priority flow control. +// Choice returns a string +func (obj *layer1FlowControl) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *layer1FlowControl) setChoice(value Layer1FlowControlChoiceEnum) Layer1FlowControl { + intValue, ok := otg.Layer1FlowControl_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on Layer1FlowControlChoiceEnum", string(value))) + return obj + } + enumValue := otg.Layer1FlowControl_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Ieee_802_3X = nil + obj.ieee_802_3XHolder = nil + obj.obj.Ieee_802_1Qbb = nil + obj.ieee_802_1QbbHolder = nil + + if value == Layer1FlowControlChoice.IEEE_802_1QBB { + obj.obj.Ieee_802_1Qbb = NewLayer1Ieee8021Qbb().msg() + } + + if value == Layer1FlowControlChoice.IEEE_802_3X { + obj.obj.Ieee_802_3X = NewLayer1Ieee8023X().msg() + } + + return obj +} + +// description is TBD +// Ieee8021Qbb returns a Layer1Ieee8021Qbb +func (obj *layer1FlowControl) Ieee8021Qbb() Layer1Ieee8021Qbb { + if obj.obj.Ieee_802_1Qbb == nil { + obj.setChoice(Layer1FlowControlChoice.IEEE_802_1QBB) + } + if obj.ieee_802_1QbbHolder == nil { + obj.ieee_802_1QbbHolder = &layer1Ieee8021Qbb{obj: obj.obj.Ieee_802_1Qbb} + } + return obj.ieee_802_1QbbHolder +} + +// description is TBD +// Ieee8021Qbb returns a Layer1Ieee8021Qbb +func (obj *layer1FlowControl) HasIeee8021Qbb() bool { + return obj.obj.Ieee_802_1Qbb != nil +} + +// description is TBD +// SetIeee8021Qbb sets the Layer1Ieee8021Qbb value in the Layer1FlowControl object +func (obj *layer1FlowControl) SetIeee8021Qbb(value Layer1Ieee8021Qbb) Layer1FlowControl { + obj.setChoice(Layer1FlowControlChoice.IEEE_802_1QBB) + obj.ieee_802_1QbbHolder = nil + obj.obj.Ieee_802_1Qbb = value.msg() + + return obj +} + +// description is TBD +// Ieee8023X returns a Layer1Ieee8023X +func (obj *layer1FlowControl) Ieee8023X() Layer1Ieee8023X { + if obj.obj.Ieee_802_3X == nil { + obj.setChoice(Layer1FlowControlChoice.IEEE_802_3X) + } + if obj.ieee_802_3XHolder == nil { + obj.ieee_802_3XHolder = &layer1Ieee8023X{obj: obj.obj.Ieee_802_3X} + } + return obj.ieee_802_3XHolder +} + +// description is TBD +// Ieee8023X returns a Layer1Ieee8023X +func (obj *layer1FlowControl) HasIeee8023X() bool { + return obj.obj.Ieee_802_3X != nil +} + +// description is TBD +// SetIeee8023X sets the Layer1Ieee8023X value in the Layer1FlowControl object +func (obj *layer1FlowControl) SetIeee8023X(value Layer1Ieee8023X) Layer1FlowControl { + obj.setChoice(Layer1FlowControlChoice.IEEE_802_3X) + obj.ieee_802_3XHolder = nil + obj.obj.Ieee_802_3X = value.msg() + + return obj +} + +func (obj *layer1FlowControl) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.DirectedAddress != nil { + + err := obj.validateMac(obj.DirectedAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on Layer1FlowControl.DirectedAddress")) + } + + } + + if obj.obj.Ieee_802_1Qbb != nil { + + obj.Ieee8021Qbb().validateObj(vObj, set_default) + } + + if obj.obj.Ieee_802_3X != nil { + + obj.Ieee8023X().validateObj(vObj, set_default) + } + +} + +func (obj *layer1FlowControl) setDefault() { + var choices_set int = 0 + var choice Layer1FlowControlChoiceEnum + + if obj.obj.Ieee_802_1Qbb != nil { + choices_set += 1 + choice = Layer1FlowControlChoice.IEEE_802_1QBB + } + + if obj.obj.Ieee_802_3X != nil { + choices_set += 1 + choice = Layer1FlowControlChoice.IEEE_802_3X + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(Layer1FlowControlChoice.IEEE_802_1QBB) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in Layer1FlowControl") + } + } else { + intVal := otg.Layer1FlowControl_Choice_Enum_value[string(choice)] + enumValue := otg.Layer1FlowControl_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + + if obj.obj.DirectedAddress == nil { + obj.SetDirectedAddress("01:80:C2:00:00:01") + } + +} diff --git a/gosnappi/layer1_ieee8021_qbb.go b/gosnappi/layer1_ieee8021_qbb.go new file mode 100644 index 00000000..0ed54812 --- /dev/null +++ b/gosnappi/layer1_ieee8021_qbb.go @@ -0,0 +1,678 @@ +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" +) + +// ***** Layer1Ieee8021Qbb ***** +type layer1Ieee8021Qbb struct { + validation + obj *otg.Layer1Ieee8021Qbb + marshaller marshalLayer1Ieee8021Qbb + unMarshaller unMarshalLayer1Ieee8021Qbb +} + +func NewLayer1Ieee8021Qbb() Layer1Ieee8021Qbb { + obj := layer1Ieee8021Qbb{obj: &otg.Layer1Ieee8021Qbb{}} + obj.setDefault() + return &obj +} + +func (obj *layer1Ieee8021Qbb) msg() *otg.Layer1Ieee8021Qbb { + return obj.obj +} + +func (obj *layer1Ieee8021Qbb) setMsg(msg *otg.Layer1Ieee8021Qbb) Layer1Ieee8021Qbb { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallayer1Ieee8021Qbb struct { + obj *layer1Ieee8021Qbb +} + +type marshalLayer1Ieee8021Qbb interface { + // ToProto marshals Layer1Ieee8021Qbb to protobuf object *otg.Layer1Ieee8021Qbb + ToProto() (*otg.Layer1Ieee8021Qbb, error) + // ToPbText marshals Layer1Ieee8021Qbb to protobuf text + ToPbText() (string, error) + // ToYaml marshals Layer1Ieee8021Qbb to YAML text + ToYaml() (string, error) + // ToJson marshals Layer1Ieee8021Qbb to JSON text + ToJson() (string, error) +} + +type unMarshallayer1Ieee8021Qbb struct { + obj *layer1Ieee8021Qbb +} + +type unMarshalLayer1Ieee8021Qbb interface { + // FromProto unmarshals Layer1Ieee8021Qbb from protobuf object *otg.Layer1Ieee8021Qbb + FromProto(msg *otg.Layer1Ieee8021Qbb) (Layer1Ieee8021Qbb, error) + // FromPbText unmarshals Layer1Ieee8021Qbb from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Layer1Ieee8021Qbb from YAML text + FromYaml(value string) error + // FromJson unmarshals Layer1Ieee8021Qbb from JSON text + FromJson(value string) error +} + +func (obj *layer1Ieee8021Qbb) Marshal() marshalLayer1Ieee8021Qbb { + if obj.marshaller == nil { + obj.marshaller = &marshallayer1Ieee8021Qbb{obj: obj} + } + return obj.marshaller +} + +func (obj *layer1Ieee8021Qbb) Unmarshal() unMarshalLayer1Ieee8021Qbb { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallayer1Ieee8021Qbb{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallayer1Ieee8021Qbb) ToProto() (*otg.Layer1Ieee8021Qbb, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallayer1Ieee8021Qbb) FromProto(msg *otg.Layer1Ieee8021Qbb) (Layer1Ieee8021Qbb, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallayer1Ieee8021Qbb) 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 *unMarshallayer1Ieee8021Qbb) 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 *marshallayer1Ieee8021Qbb) 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 *unMarshallayer1Ieee8021Qbb) 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 *marshallayer1Ieee8021Qbb) 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 *unMarshallayer1Ieee8021Qbb) 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 *layer1Ieee8021Qbb) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *layer1Ieee8021Qbb) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *layer1Ieee8021Qbb) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *layer1Ieee8021Qbb) Clone() (Layer1Ieee8021Qbb, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLayer1Ieee8021Qbb() + 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 +} + +// Layer1Ieee8021Qbb is these settings enhance the existing 802.3x pause priority capabilities +// to enable flow control based on 802.1p priorities (classes of service). +type Layer1Ieee8021Qbb interface { + Validation + // msg marshals Layer1Ieee8021Qbb to protobuf object *otg.Layer1Ieee8021Qbb + // and doesn't set defaults + msg() *otg.Layer1Ieee8021Qbb + // setMsg unmarshals Layer1Ieee8021Qbb from protobuf object *otg.Layer1Ieee8021Qbb + // and doesn't set defaults + setMsg(*otg.Layer1Ieee8021Qbb) Layer1Ieee8021Qbb + // provides marshal interface + Marshal() marshalLayer1Ieee8021Qbb + // provides unmarshal interface + Unmarshal() unMarshalLayer1Ieee8021Qbb + // validate validates Layer1Ieee8021Qbb + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Layer1Ieee8021Qbb, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PfcDelay returns uint32, set in Layer1Ieee8021Qbb. + PfcDelay() uint32 + // SetPfcDelay assigns uint32 provided by user to Layer1Ieee8021Qbb + SetPfcDelay(value uint32) Layer1Ieee8021Qbb + // HasPfcDelay checks if PfcDelay has been set in Layer1Ieee8021Qbb + HasPfcDelay() bool + // PfcClass0 returns uint32, set in Layer1Ieee8021Qbb. + PfcClass0() uint32 + // SetPfcClass0 assigns uint32 provided by user to Layer1Ieee8021Qbb + SetPfcClass0(value uint32) Layer1Ieee8021Qbb + // HasPfcClass0 checks if PfcClass0 has been set in Layer1Ieee8021Qbb + HasPfcClass0() bool + // PfcClass1 returns uint32, set in Layer1Ieee8021Qbb. + PfcClass1() uint32 + // SetPfcClass1 assigns uint32 provided by user to Layer1Ieee8021Qbb + SetPfcClass1(value uint32) Layer1Ieee8021Qbb + // HasPfcClass1 checks if PfcClass1 has been set in Layer1Ieee8021Qbb + HasPfcClass1() bool + // PfcClass2 returns uint32, set in Layer1Ieee8021Qbb. + PfcClass2() uint32 + // SetPfcClass2 assigns uint32 provided by user to Layer1Ieee8021Qbb + SetPfcClass2(value uint32) Layer1Ieee8021Qbb + // HasPfcClass2 checks if PfcClass2 has been set in Layer1Ieee8021Qbb + HasPfcClass2() bool + // PfcClass3 returns uint32, set in Layer1Ieee8021Qbb. + PfcClass3() uint32 + // SetPfcClass3 assigns uint32 provided by user to Layer1Ieee8021Qbb + SetPfcClass3(value uint32) Layer1Ieee8021Qbb + // HasPfcClass3 checks if PfcClass3 has been set in Layer1Ieee8021Qbb + HasPfcClass3() bool + // PfcClass4 returns uint32, set in Layer1Ieee8021Qbb. + PfcClass4() uint32 + // SetPfcClass4 assigns uint32 provided by user to Layer1Ieee8021Qbb + SetPfcClass4(value uint32) Layer1Ieee8021Qbb + // HasPfcClass4 checks if PfcClass4 has been set in Layer1Ieee8021Qbb + HasPfcClass4() bool + // PfcClass5 returns uint32, set in Layer1Ieee8021Qbb. + PfcClass5() uint32 + // SetPfcClass5 assigns uint32 provided by user to Layer1Ieee8021Qbb + SetPfcClass5(value uint32) Layer1Ieee8021Qbb + // HasPfcClass5 checks if PfcClass5 has been set in Layer1Ieee8021Qbb + HasPfcClass5() bool + // PfcClass6 returns uint32, set in Layer1Ieee8021Qbb. + PfcClass6() uint32 + // SetPfcClass6 assigns uint32 provided by user to Layer1Ieee8021Qbb + SetPfcClass6(value uint32) Layer1Ieee8021Qbb + // HasPfcClass6 checks if PfcClass6 has been set in Layer1Ieee8021Qbb + HasPfcClass6() bool + // PfcClass7 returns uint32, set in Layer1Ieee8021Qbb. + PfcClass7() uint32 + // SetPfcClass7 assigns uint32 provided by user to Layer1Ieee8021Qbb + SetPfcClass7(value uint32) Layer1Ieee8021Qbb + // HasPfcClass7 checks if PfcClass7 has been set in Layer1Ieee8021Qbb + HasPfcClass7() bool +} + +// The upper limit on the transmit time of a queue after receiving a +// message to pause a specified priority. +// A value of 0 or null indicates that pfc delay will not be enabled. +// PfcDelay returns a uint32 +func (obj *layer1Ieee8021Qbb) PfcDelay() uint32 { + + return *obj.obj.PfcDelay + +} + +// The upper limit on the transmit time of a queue after receiving a +// message to pause a specified priority. +// A value of 0 or null indicates that pfc delay will not be enabled. +// PfcDelay returns a uint32 +func (obj *layer1Ieee8021Qbb) HasPfcDelay() bool { + return obj.obj.PfcDelay != nil +} + +// The upper limit on the transmit time of a queue after receiving a +// message to pause a specified priority. +// A value of 0 or null indicates that pfc delay will not be enabled. +// SetPfcDelay sets the uint32 value in the Layer1Ieee8021Qbb object +func (obj *layer1Ieee8021Qbb) SetPfcDelay(value uint32) Layer1Ieee8021Qbb { + + obj.obj.PfcDelay = &value + return obj +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass0 returns a uint32 +func (obj *layer1Ieee8021Qbb) PfcClass0() uint32 { + + return *obj.obj.PfcClass_0 + +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass0 returns a uint32 +func (obj *layer1Ieee8021Qbb) HasPfcClass0() bool { + return obj.obj.PfcClass_0 != nil +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// SetPfcClass0 sets the uint32 value in the Layer1Ieee8021Qbb object +func (obj *layer1Ieee8021Qbb) SetPfcClass0(value uint32) Layer1Ieee8021Qbb { + + obj.obj.PfcClass_0 = &value + return obj +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass1 returns a uint32 +func (obj *layer1Ieee8021Qbb) PfcClass1() uint32 { + + return *obj.obj.PfcClass_1 + +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass1 returns a uint32 +func (obj *layer1Ieee8021Qbb) HasPfcClass1() bool { + return obj.obj.PfcClass_1 != nil +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// SetPfcClass1 sets the uint32 value in the Layer1Ieee8021Qbb object +func (obj *layer1Ieee8021Qbb) SetPfcClass1(value uint32) Layer1Ieee8021Qbb { + + obj.obj.PfcClass_1 = &value + return obj +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass2 returns a uint32 +func (obj *layer1Ieee8021Qbb) PfcClass2() uint32 { + + return *obj.obj.PfcClass_2 + +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass2 returns a uint32 +func (obj *layer1Ieee8021Qbb) HasPfcClass2() bool { + return obj.obj.PfcClass_2 != nil +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// SetPfcClass2 sets the uint32 value in the Layer1Ieee8021Qbb object +func (obj *layer1Ieee8021Qbb) SetPfcClass2(value uint32) Layer1Ieee8021Qbb { + + obj.obj.PfcClass_2 = &value + return obj +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass3 returns a uint32 +func (obj *layer1Ieee8021Qbb) PfcClass3() uint32 { + + return *obj.obj.PfcClass_3 + +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass3 returns a uint32 +func (obj *layer1Ieee8021Qbb) HasPfcClass3() bool { + return obj.obj.PfcClass_3 != nil +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// SetPfcClass3 sets the uint32 value in the Layer1Ieee8021Qbb object +func (obj *layer1Ieee8021Qbb) SetPfcClass3(value uint32) Layer1Ieee8021Qbb { + + obj.obj.PfcClass_3 = &value + return obj +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass4 returns a uint32 +func (obj *layer1Ieee8021Qbb) PfcClass4() uint32 { + + return *obj.obj.PfcClass_4 + +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass4 returns a uint32 +func (obj *layer1Ieee8021Qbb) HasPfcClass4() bool { + return obj.obj.PfcClass_4 != nil +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// SetPfcClass4 sets the uint32 value in the Layer1Ieee8021Qbb object +func (obj *layer1Ieee8021Qbb) SetPfcClass4(value uint32) Layer1Ieee8021Qbb { + + obj.obj.PfcClass_4 = &value + return obj +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass5 returns a uint32 +func (obj *layer1Ieee8021Qbb) PfcClass5() uint32 { + + return *obj.obj.PfcClass_5 + +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass5 returns a uint32 +func (obj *layer1Ieee8021Qbb) HasPfcClass5() bool { + return obj.obj.PfcClass_5 != nil +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// SetPfcClass5 sets the uint32 value in the Layer1Ieee8021Qbb object +func (obj *layer1Ieee8021Qbb) SetPfcClass5(value uint32) Layer1Ieee8021Qbb { + + obj.obj.PfcClass_5 = &value + return obj +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass6 returns a uint32 +func (obj *layer1Ieee8021Qbb) PfcClass6() uint32 { + + return *obj.obj.PfcClass_6 + +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass6 returns a uint32 +func (obj *layer1Ieee8021Qbb) HasPfcClass6() bool { + return obj.obj.PfcClass_6 != nil +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// SetPfcClass6 sets the uint32 value in the Layer1Ieee8021Qbb object +func (obj *layer1Ieee8021Qbb) SetPfcClass6(value uint32) Layer1Ieee8021Qbb { + + obj.obj.PfcClass_6 = &value + return obj +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass7 returns a uint32 +func (obj *layer1Ieee8021Qbb) PfcClass7() uint32 { + + return *obj.obj.PfcClass_7 + +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// PfcClass7 returns a uint32 +func (obj *layer1Ieee8021Qbb) HasPfcClass7() bool { + return obj.obj.PfcClass_7 != nil +} + +// The valid values are null, 0 - 7. +// A null value indicates there is no setting for this pfc class. +// SetPfcClass7 sets the uint32 value in the Layer1Ieee8021Qbb object +func (obj *layer1Ieee8021Qbb) SetPfcClass7(value uint32) Layer1Ieee8021Qbb { + + obj.obj.PfcClass_7 = &value + return obj +} + +func (obj *layer1Ieee8021Qbb) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.PfcDelay != nil { + + if *obj.obj.PfcDelay > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcDelay <= 65535 but Got %d", *obj.obj.PfcDelay)) + } + + } + + if obj.obj.PfcClass_0 != nil { + + if *obj.obj.PfcClass_0 > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_0 <= 7 but Got %d", *obj.obj.PfcClass_0)) + } + + } + + if obj.obj.PfcClass_1 != nil { + + if *obj.obj.PfcClass_1 > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_1 <= 7 but Got %d", *obj.obj.PfcClass_1)) + } + + } + + if obj.obj.PfcClass_2 != nil { + + if *obj.obj.PfcClass_2 > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_2 <= 7 but Got %d", *obj.obj.PfcClass_2)) + } + + } + + if obj.obj.PfcClass_3 != nil { + + if *obj.obj.PfcClass_3 > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_3 <= 7 but Got %d", *obj.obj.PfcClass_3)) + } + + } + + if obj.obj.PfcClass_4 != nil { + + if *obj.obj.PfcClass_4 > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_4 <= 7 but Got %d", *obj.obj.PfcClass_4)) + } + + } + + if obj.obj.PfcClass_5 != nil { + + if *obj.obj.PfcClass_5 > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_5 <= 7 but Got %d", *obj.obj.PfcClass_5)) + } + + } + + if obj.obj.PfcClass_6 != nil { + + if *obj.obj.PfcClass_6 > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_6 <= 7 but Got %d", *obj.obj.PfcClass_6)) + } + + } + + if obj.obj.PfcClass_7 != nil { + + if *obj.obj.PfcClass_7 > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= Layer1Ieee8021Qbb.PfcClass_7 <= 7 but Got %d", *obj.obj.PfcClass_7)) + } + + } + +} + +func (obj *layer1Ieee8021Qbb) setDefault() { + if obj.obj.PfcDelay == nil { + obj.SetPfcDelay(0) + } + if obj.obj.PfcClass_0 == nil { + obj.SetPfcClass0(0) + } + if obj.obj.PfcClass_1 == nil { + obj.SetPfcClass1(1) + } + if obj.obj.PfcClass_2 == nil { + obj.SetPfcClass2(2) + } + if obj.obj.PfcClass_3 == nil { + obj.SetPfcClass3(3) + } + if obj.obj.PfcClass_4 == nil { + obj.SetPfcClass4(4) + } + if obj.obj.PfcClass_5 == nil { + obj.SetPfcClass5(5) + } + if obj.obj.PfcClass_6 == nil { + obj.SetPfcClass6(6) + } + if obj.obj.PfcClass_7 == nil { + obj.SetPfcClass7(7) + } + +} diff --git a/gosnappi/layer1_ieee8023_x.go b/gosnappi/layer1_ieee8023_x.go new file mode 100644 index 00000000..380bd1a9 --- /dev/null +++ b/gosnappi/layer1_ieee8023_x.go @@ -0,0 +1,278 @@ +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" +) + +// ***** Layer1Ieee8023X ***** +type layer1Ieee8023X struct { + validation + obj *otg.Layer1Ieee8023X + marshaller marshalLayer1Ieee8023X + unMarshaller unMarshalLayer1Ieee8023X +} + +func NewLayer1Ieee8023X() Layer1Ieee8023X { + obj := layer1Ieee8023X{obj: &otg.Layer1Ieee8023X{}} + obj.setDefault() + return &obj +} + +func (obj *layer1Ieee8023X) msg() *otg.Layer1Ieee8023X { + return obj.obj +} + +func (obj *layer1Ieee8023X) setMsg(msg *otg.Layer1Ieee8023X) Layer1Ieee8023X { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallayer1Ieee8023X struct { + obj *layer1Ieee8023X +} + +type marshalLayer1Ieee8023X interface { + // ToProto marshals Layer1Ieee8023X to protobuf object *otg.Layer1Ieee8023X + ToProto() (*otg.Layer1Ieee8023X, error) + // ToPbText marshals Layer1Ieee8023X to protobuf text + ToPbText() (string, error) + // ToYaml marshals Layer1Ieee8023X to YAML text + ToYaml() (string, error) + // ToJson marshals Layer1Ieee8023X to JSON text + ToJson() (string, error) +} + +type unMarshallayer1Ieee8023X struct { + obj *layer1Ieee8023X +} + +type unMarshalLayer1Ieee8023X interface { + // FromProto unmarshals Layer1Ieee8023X from protobuf object *otg.Layer1Ieee8023X + FromProto(msg *otg.Layer1Ieee8023X) (Layer1Ieee8023X, error) + // FromPbText unmarshals Layer1Ieee8023X from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Layer1Ieee8023X from YAML text + FromYaml(value string) error + // FromJson unmarshals Layer1Ieee8023X from JSON text + FromJson(value string) error +} + +func (obj *layer1Ieee8023X) Marshal() marshalLayer1Ieee8023X { + if obj.marshaller == nil { + obj.marshaller = &marshallayer1Ieee8023X{obj: obj} + } + return obj.marshaller +} + +func (obj *layer1Ieee8023X) Unmarshal() unMarshalLayer1Ieee8023X { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallayer1Ieee8023X{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallayer1Ieee8023X) ToProto() (*otg.Layer1Ieee8023X, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallayer1Ieee8023X) FromProto(msg *otg.Layer1Ieee8023X) (Layer1Ieee8023X, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallayer1Ieee8023X) 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 *unMarshallayer1Ieee8023X) 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 *marshallayer1Ieee8023X) 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 *unMarshallayer1Ieee8023X) 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 *marshallayer1Ieee8023X) 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 *unMarshallayer1Ieee8023X) 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 *layer1Ieee8023X) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *layer1Ieee8023X) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *layer1Ieee8023X) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *layer1Ieee8023X) Clone() (Layer1Ieee8023X, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLayer1Ieee8023X() + 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 +} + +// Layer1Ieee8023X is a container for ieee 802.3x rx pause settings +type Layer1Ieee8023X interface { + Validation + // msg marshals Layer1Ieee8023X to protobuf object *otg.Layer1Ieee8023X + // and doesn't set defaults + msg() *otg.Layer1Ieee8023X + // setMsg unmarshals Layer1Ieee8023X from protobuf object *otg.Layer1Ieee8023X + // and doesn't set defaults + setMsg(*otg.Layer1Ieee8023X) Layer1Ieee8023X + // provides marshal interface + Marshal() marshalLayer1Ieee8023X + // provides unmarshal interface + Unmarshal() unMarshalLayer1Ieee8023X + // validate validates Layer1Ieee8023X + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Layer1Ieee8023X, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() +} + +func (obj *layer1Ieee8023X) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *layer1Ieee8023X) setDefault() { + +} diff --git a/gosnappi/link_state_te.go b/gosnappi/link_state_te.go new file mode 100644 index 00000000..7bb82e39 --- /dev/null +++ b/gosnappi/link_state_te.go @@ -0,0 +1,486 @@ +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" +) + +// ***** LinkStateTE ***** +type linkStateTE struct { + validation + obj *otg.LinkStateTE + marshaller marshalLinkStateTE + unMarshaller unMarshalLinkStateTE + priorityBandwidthsHolder LinkStatepriorityBandwidths +} + +func NewLinkStateTE() LinkStateTE { + obj := linkStateTE{obj: &otg.LinkStateTE{}} + obj.setDefault() + return &obj +} + +func (obj *linkStateTE) msg() *otg.LinkStateTE { + return obj.obj +} + +func (obj *linkStateTE) setMsg(msg *otg.LinkStateTE) LinkStateTE { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshallinkStateTE struct { + obj *linkStateTE +} + +type marshalLinkStateTE interface { + // ToProto marshals LinkStateTE to protobuf object *otg.LinkStateTE + ToProto() (*otg.LinkStateTE, error) + // ToPbText marshals LinkStateTE to protobuf text + ToPbText() (string, error) + // ToYaml marshals LinkStateTE to YAML text + ToYaml() (string, error) + // ToJson marshals LinkStateTE to JSON text + ToJson() (string, error) +} + +type unMarshallinkStateTE struct { + obj *linkStateTE +} + +type unMarshalLinkStateTE interface { + // FromProto unmarshals LinkStateTE from protobuf object *otg.LinkStateTE + FromProto(msg *otg.LinkStateTE) (LinkStateTE, error) + // FromPbText unmarshals LinkStateTE from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LinkStateTE from YAML text + FromYaml(value string) error + // FromJson unmarshals LinkStateTE from JSON text + FromJson(value string) error +} + +func (obj *linkStateTE) Marshal() marshalLinkStateTE { + if obj.marshaller == nil { + obj.marshaller = &marshallinkStateTE{obj: obj} + } + return obj.marshaller +} + +func (obj *linkStateTE) Unmarshal() unMarshalLinkStateTE { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallinkStateTE{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallinkStateTE) ToProto() (*otg.LinkStateTE, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallinkStateTE) FromProto(msg *otg.LinkStateTE) (LinkStateTE, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallinkStateTE) 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 *unMarshallinkStateTE) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshallinkStateTE) 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 *unMarshallinkStateTE) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshallinkStateTE) 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 *unMarshallinkStateTE) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *linkStateTE) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *linkStateTE) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *linkStateTE) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *linkStateTE) Clone() (LinkStateTE, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLinkStateTE() + 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 +} + +func (obj *linkStateTE) setNil() { + obj.priorityBandwidthsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// LinkStateTE is a container for Traffic Engineering properties on a interface. +type LinkStateTE interface { + Validation + // msg marshals LinkStateTE to protobuf object *otg.LinkStateTE + // and doesn't set defaults + msg() *otg.LinkStateTE + // setMsg unmarshals LinkStateTE from protobuf object *otg.LinkStateTE + // and doesn't set defaults + setMsg(*otg.LinkStateTE) LinkStateTE + // provides marshal interface + Marshal() marshalLinkStateTE + // provides unmarshal interface + Unmarshal() unMarshalLinkStateTE + // validate validates LinkStateTE + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LinkStateTE, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // AdministrativeGroup returns string, set in LinkStateTE. + AdministrativeGroup() string + // SetAdministrativeGroup assigns string provided by user to LinkStateTE + SetAdministrativeGroup(value string) LinkStateTE + // HasAdministrativeGroup checks if AdministrativeGroup has been set in LinkStateTE + HasAdministrativeGroup() bool + // MetricLevel returns uint32, set in LinkStateTE. + MetricLevel() uint32 + // SetMetricLevel assigns uint32 provided by user to LinkStateTE + SetMetricLevel(value uint32) LinkStateTE + // HasMetricLevel checks if MetricLevel has been set in LinkStateTE + HasMetricLevel() bool + // MaxBandwith returns uint32, set in LinkStateTE. + MaxBandwith() uint32 + // SetMaxBandwith assigns uint32 provided by user to LinkStateTE + SetMaxBandwith(value uint32) LinkStateTE + // HasMaxBandwith checks if MaxBandwith has been set in LinkStateTE + HasMaxBandwith() bool + // MaxReservableBandwidth returns uint32, set in LinkStateTE. + MaxReservableBandwidth() uint32 + // SetMaxReservableBandwidth assigns uint32 provided by user to LinkStateTE + SetMaxReservableBandwidth(value uint32) LinkStateTE + // HasMaxReservableBandwidth checks if MaxReservableBandwidth has been set in LinkStateTE + HasMaxReservableBandwidth() bool + // PriorityBandwidths returns LinkStatepriorityBandwidths, set in LinkStateTE. + // LinkStatepriorityBandwidths is specifies the amount of bandwidth that can be reserved with a setup priority of 0 + // through 7, arranged in increasing order with priority 0 having highest priority. + // In ISIS, this is sent in sub-TLV (11) of Extended IS Reachability TLV. + PriorityBandwidths() LinkStatepriorityBandwidths + // SetPriorityBandwidths assigns LinkStatepriorityBandwidths provided by user to LinkStateTE. + // LinkStatepriorityBandwidths is specifies the amount of bandwidth that can be reserved with a setup priority of 0 + // through 7, arranged in increasing order with priority 0 having highest priority. + // In ISIS, this is sent in sub-TLV (11) of Extended IS Reachability TLV. + SetPriorityBandwidths(value LinkStatepriorityBandwidths) LinkStateTE + // HasPriorityBandwidths checks if PriorityBandwidths has been set in LinkStateTE + HasPriorityBandwidths() bool + setNil() +} + +// The Administrative group sub-TLV (sub-TLV 3). It is a 4-octet +// user-defined bit mask used to assign administrative group numbers +// to the interface, for use in assigning colors and resource classes. +// Each set bit corresponds to a single administrative group for this +// interface. The settings translate into Group numbers, which range +// from 0 to 31 (integers). +// AdministrativeGroup returns a string +func (obj *linkStateTE) AdministrativeGroup() string { + + return *obj.obj.AdministrativeGroup + +} + +// The Administrative group sub-TLV (sub-TLV 3). It is a 4-octet +// user-defined bit mask used to assign administrative group numbers +// to the interface, for use in assigning colors and resource classes. +// Each set bit corresponds to a single administrative group for this +// interface. The settings translate into Group numbers, which range +// from 0 to 31 (integers). +// AdministrativeGroup returns a string +func (obj *linkStateTE) HasAdministrativeGroup() bool { + return obj.obj.AdministrativeGroup != nil +} + +// The Administrative group sub-TLV (sub-TLV 3). It is a 4-octet +// user-defined bit mask used to assign administrative group numbers +// to the interface, for use in assigning colors and resource classes. +// Each set bit corresponds to a single administrative group for this +// interface. The settings translate into Group numbers, which range +// from 0 to 31 (integers). +// SetAdministrativeGroup sets the string value in the LinkStateTE object +func (obj *linkStateTE) SetAdministrativeGroup(value string) LinkStateTE { + + obj.obj.AdministrativeGroup = &value + return obj +} + +// The user-assigned link metric for Traffic Engineering. +// MetricLevel returns a uint32 +func (obj *linkStateTE) MetricLevel() uint32 { + + return *obj.obj.MetricLevel + +} + +// The user-assigned link metric for Traffic Engineering. +// MetricLevel returns a uint32 +func (obj *linkStateTE) HasMetricLevel() bool { + return obj.obj.MetricLevel != nil +} + +// The user-assigned link metric for Traffic Engineering. +// SetMetricLevel sets the uint32 value in the LinkStateTE object +func (obj *linkStateTE) SetMetricLevel(value uint32) LinkStateTE { + + obj.obj.MetricLevel = &value + return obj +} + +// The maximum link bandwidth (sub-TLV 9) in bytes/sec allowed for this +// link for a direction. +// MaxBandwith returns a uint32 +func (obj *linkStateTE) MaxBandwith() uint32 { + + return *obj.obj.MaxBandwith + +} + +// The maximum link bandwidth (sub-TLV 9) in bytes/sec allowed for this +// link for a direction. +// MaxBandwith returns a uint32 +func (obj *linkStateTE) HasMaxBandwith() bool { + return obj.obj.MaxBandwith != nil +} + +// The maximum link bandwidth (sub-TLV 9) in bytes/sec allowed for this +// link for a direction. +// SetMaxBandwith sets the uint32 value in the LinkStateTE object +func (obj *linkStateTE) SetMaxBandwith(value uint32) LinkStateTE { + + obj.obj.MaxBandwith = &value + return obj +} + +// The maximum link bandwidth (sub-TLV 10) in bytes/sec allowed for this +// link in a direction. +// MaxReservableBandwidth returns a uint32 +func (obj *linkStateTE) MaxReservableBandwidth() uint32 { + + return *obj.obj.MaxReservableBandwidth + +} + +// The maximum link bandwidth (sub-TLV 10) in bytes/sec allowed for this +// link in a direction. +// MaxReservableBandwidth returns a uint32 +func (obj *linkStateTE) HasMaxReservableBandwidth() bool { + return obj.obj.MaxReservableBandwidth != nil +} + +// The maximum link bandwidth (sub-TLV 10) in bytes/sec allowed for this +// link in a direction. +// SetMaxReservableBandwidth sets the uint32 value in the LinkStateTE object +func (obj *linkStateTE) SetMaxReservableBandwidth(value uint32) LinkStateTE { + + obj.obj.MaxReservableBandwidth = &value + return obj +} + +// Configuration of bandwidths of priority 0 through priority 7. +// PriorityBandwidths returns a LinkStatepriorityBandwidths +func (obj *linkStateTE) PriorityBandwidths() LinkStatepriorityBandwidths { + if obj.obj.PriorityBandwidths == nil { + obj.obj.PriorityBandwidths = NewLinkStatepriorityBandwidths().msg() + } + if obj.priorityBandwidthsHolder == nil { + obj.priorityBandwidthsHolder = &linkStatepriorityBandwidths{obj: obj.obj.PriorityBandwidths} + } + return obj.priorityBandwidthsHolder +} + +// Configuration of bandwidths of priority 0 through priority 7. +// PriorityBandwidths returns a LinkStatepriorityBandwidths +func (obj *linkStateTE) HasPriorityBandwidths() bool { + return obj.obj.PriorityBandwidths != nil +} + +// Configuration of bandwidths of priority 0 through priority 7. +// SetPriorityBandwidths sets the LinkStatepriorityBandwidths value in the LinkStateTE object +func (obj *linkStateTE) SetPriorityBandwidths(value LinkStatepriorityBandwidths) LinkStateTE { + + obj.priorityBandwidthsHolder = nil + obj.obj.PriorityBandwidths = value.msg() + + return obj +} + +func (obj *linkStateTE) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.AdministrativeGroup != nil { + + err := obj.validateHex(obj.AdministrativeGroup()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on LinkStateTE.AdministrativeGroup")) + } + + } + + if obj.obj.PriorityBandwidths != nil { + + obj.PriorityBandwidths().validateObj(vObj, set_default) + } + +} + +func (obj *linkStateTE) setDefault() { + if obj.obj.AdministrativeGroup == nil { + obj.SetAdministrativeGroup("00000000") + } + if obj.obj.MetricLevel == nil { + obj.SetMetricLevel(0) + } + if obj.obj.MaxBandwith == nil { + obj.SetMaxBandwith(125000000) + } + if obj.obj.MaxReservableBandwidth == nil { + obj.SetMaxReservableBandwidth(125000000) + } + +} diff --git a/gosnappi/link_statepriority_bandwidths.go b/gosnappi/link_statepriority_bandwidths.go new file mode 100644 index 00000000..3dc73809 --- /dev/null +++ b/gosnappi/link_statepriority_bandwidths.go @@ -0,0 +1,528 @@ +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" +) + +// ***** LinkStatepriorityBandwidths ***** +type linkStatepriorityBandwidths struct { + validation + obj *otg.LinkStatepriorityBandwidths + marshaller marshalLinkStatepriorityBandwidths + unMarshaller unMarshalLinkStatepriorityBandwidths +} + +func NewLinkStatepriorityBandwidths() LinkStatepriorityBandwidths { + obj := linkStatepriorityBandwidths{obj: &otg.LinkStatepriorityBandwidths{}} + obj.setDefault() + return &obj +} + +func (obj *linkStatepriorityBandwidths) msg() *otg.LinkStatepriorityBandwidths { + return obj.obj +} + +func (obj *linkStatepriorityBandwidths) setMsg(msg *otg.LinkStatepriorityBandwidths) LinkStatepriorityBandwidths { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallinkStatepriorityBandwidths struct { + obj *linkStatepriorityBandwidths +} + +type marshalLinkStatepriorityBandwidths interface { + // ToProto marshals LinkStatepriorityBandwidths to protobuf object *otg.LinkStatepriorityBandwidths + ToProto() (*otg.LinkStatepriorityBandwidths, error) + // ToPbText marshals LinkStatepriorityBandwidths to protobuf text + ToPbText() (string, error) + // ToYaml marshals LinkStatepriorityBandwidths to YAML text + ToYaml() (string, error) + // ToJson marshals LinkStatepriorityBandwidths to JSON text + ToJson() (string, error) +} + +type unMarshallinkStatepriorityBandwidths struct { + obj *linkStatepriorityBandwidths +} + +type unMarshalLinkStatepriorityBandwidths interface { + // FromProto unmarshals LinkStatepriorityBandwidths from protobuf object *otg.LinkStatepriorityBandwidths + FromProto(msg *otg.LinkStatepriorityBandwidths) (LinkStatepriorityBandwidths, error) + // FromPbText unmarshals LinkStatepriorityBandwidths from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LinkStatepriorityBandwidths from YAML text + FromYaml(value string) error + // FromJson unmarshals LinkStatepriorityBandwidths from JSON text + FromJson(value string) error +} + +func (obj *linkStatepriorityBandwidths) Marshal() marshalLinkStatepriorityBandwidths { + if obj.marshaller == nil { + obj.marshaller = &marshallinkStatepriorityBandwidths{obj: obj} + } + return obj.marshaller +} + +func (obj *linkStatepriorityBandwidths) Unmarshal() unMarshalLinkStatepriorityBandwidths { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallinkStatepriorityBandwidths{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallinkStatepriorityBandwidths) ToProto() (*otg.LinkStatepriorityBandwidths, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallinkStatepriorityBandwidths) FromProto(msg *otg.LinkStatepriorityBandwidths) (LinkStatepriorityBandwidths, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallinkStatepriorityBandwidths) 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 *unMarshallinkStatepriorityBandwidths) 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 *marshallinkStatepriorityBandwidths) 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 *unMarshallinkStatepriorityBandwidths) 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 *marshallinkStatepriorityBandwidths) 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 *unMarshallinkStatepriorityBandwidths) 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 *linkStatepriorityBandwidths) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *linkStatepriorityBandwidths) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *linkStatepriorityBandwidths) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *linkStatepriorityBandwidths) Clone() (LinkStatepriorityBandwidths, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLinkStatepriorityBandwidths() + 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 +} + +// LinkStatepriorityBandwidths is specifies the amount of bandwidth that can be reserved with a setup priority of 0 +// through 7, arranged in increasing order with priority 0 having highest priority. +// In ISIS, this is sent in sub-TLV (11) of Extended IS Reachability TLV. +type LinkStatepriorityBandwidths interface { + Validation + // msg marshals LinkStatepriorityBandwidths to protobuf object *otg.LinkStatepriorityBandwidths + // and doesn't set defaults + msg() *otg.LinkStatepriorityBandwidths + // setMsg unmarshals LinkStatepriorityBandwidths from protobuf object *otg.LinkStatepriorityBandwidths + // and doesn't set defaults + setMsg(*otg.LinkStatepriorityBandwidths) LinkStatepriorityBandwidths + // provides marshal interface + Marshal() marshalLinkStatepriorityBandwidths + // provides unmarshal interface + Unmarshal() unMarshalLinkStatepriorityBandwidths + // validate validates LinkStatepriorityBandwidths + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LinkStatepriorityBandwidths, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Pb0 returns uint32, set in LinkStatepriorityBandwidths. + Pb0() uint32 + // SetPb0 assigns uint32 provided by user to LinkStatepriorityBandwidths + SetPb0(value uint32) LinkStatepriorityBandwidths + // HasPb0 checks if Pb0 has been set in LinkStatepriorityBandwidths + HasPb0() bool + // Pb1 returns uint32, set in LinkStatepriorityBandwidths. + Pb1() uint32 + // SetPb1 assigns uint32 provided by user to LinkStatepriorityBandwidths + SetPb1(value uint32) LinkStatepriorityBandwidths + // HasPb1 checks if Pb1 has been set in LinkStatepriorityBandwidths + HasPb1() bool + // Pb2 returns uint32, set in LinkStatepriorityBandwidths. + Pb2() uint32 + // SetPb2 assigns uint32 provided by user to LinkStatepriorityBandwidths + SetPb2(value uint32) LinkStatepriorityBandwidths + // HasPb2 checks if Pb2 has been set in LinkStatepriorityBandwidths + HasPb2() bool + // Pb3 returns uint32, set in LinkStatepriorityBandwidths. + Pb3() uint32 + // SetPb3 assigns uint32 provided by user to LinkStatepriorityBandwidths + SetPb3(value uint32) LinkStatepriorityBandwidths + // HasPb3 checks if Pb3 has been set in LinkStatepriorityBandwidths + HasPb3() bool + // Pb4 returns uint32, set in LinkStatepriorityBandwidths. + Pb4() uint32 + // SetPb4 assigns uint32 provided by user to LinkStatepriorityBandwidths + SetPb4(value uint32) LinkStatepriorityBandwidths + // HasPb4 checks if Pb4 has been set in LinkStatepriorityBandwidths + HasPb4() bool + // Pb5 returns uint32, set in LinkStatepriorityBandwidths. + Pb5() uint32 + // SetPb5 assigns uint32 provided by user to LinkStatepriorityBandwidths + SetPb5(value uint32) LinkStatepriorityBandwidths + // HasPb5 checks if Pb5 has been set in LinkStatepriorityBandwidths + HasPb5() bool + // Pb6 returns uint32, set in LinkStatepriorityBandwidths. + Pb6() uint32 + // SetPb6 assigns uint32 provided by user to LinkStatepriorityBandwidths + SetPb6(value uint32) LinkStatepriorityBandwidths + // HasPb6 checks if Pb6 has been set in LinkStatepriorityBandwidths + HasPb6() bool + // Pb7 returns uint32, set in LinkStatepriorityBandwidths. + Pb7() uint32 + // SetPb7 assigns uint32 provided by user to LinkStatepriorityBandwidths + SetPb7(value uint32) LinkStatepriorityBandwidths + // HasPb7 checks if Pb7 has been set in LinkStatepriorityBandwidths + HasPb7() bool +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 0. +// Pb0 returns a uint32 +func (obj *linkStatepriorityBandwidths) Pb0() uint32 { + + return *obj.obj.Pb0 + +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 0. +// Pb0 returns a uint32 +func (obj *linkStatepriorityBandwidths) HasPb0() bool { + return obj.obj.Pb0 != nil +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 0. +// SetPb0 sets the uint32 value in the LinkStatepriorityBandwidths object +func (obj *linkStatepriorityBandwidths) SetPb0(value uint32) LinkStatepriorityBandwidths { + + obj.obj.Pb0 = &value + return obj +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 1. +// Pb1 returns a uint32 +func (obj *linkStatepriorityBandwidths) Pb1() uint32 { + + return *obj.obj.Pb1 + +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 1. +// Pb1 returns a uint32 +func (obj *linkStatepriorityBandwidths) HasPb1() bool { + return obj.obj.Pb1 != nil +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 1. +// SetPb1 sets the uint32 value in the LinkStatepriorityBandwidths object +func (obj *linkStatepriorityBandwidths) SetPb1(value uint32) LinkStatepriorityBandwidths { + + obj.obj.Pb1 = &value + return obj +} + +// Specify the amount of bandwidth that can be reserved for the Priority 2. +// Pb2 returns a uint32 +func (obj *linkStatepriorityBandwidths) Pb2() uint32 { + + return *obj.obj.Pb2 + +} + +// Specify the amount of bandwidth that can be reserved for the Priority 2. +// Pb2 returns a uint32 +func (obj *linkStatepriorityBandwidths) HasPb2() bool { + return obj.obj.Pb2 != nil +} + +// Specify the amount of bandwidth that can be reserved for the Priority 2. +// SetPb2 sets the uint32 value in the LinkStatepriorityBandwidths object +func (obj *linkStatepriorityBandwidths) SetPb2(value uint32) LinkStatepriorityBandwidths { + + obj.obj.Pb2 = &value + return obj +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 3. +// Pb3 returns a uint32 +func (obj *linkStatepriorityBandwidths) Pb3() uint32 { + + return *obj.obj.Pb3 + +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 3. +// Pb3 returns a uint32 +func (obj *linkStatepriorityBandwidths) HasPb3() bool { + return obj.obj.Pb3 != nil +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 3. +// SetPb3 sets the uint32 value in the LinkStatepriorityBandwidths object +func (obj *linkStatepriorityBandwidths) SetPb3(value uint32) LinkStatepriorityBandwidths { + + obj.obj.Pb3 = &value + return obj +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 4. +// Pb4 returns a uint32 +func (obj *linkStatepriorityBandwidths) Pb4() uint32 { + + return *obj.obj.Pb4 + +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 4. +// Pb4 returns a uint32 +func (obj *linkStatepriorityBandwidths) HasPb4() bool { + return obj.obj.Pb4 != nil +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 4. +// SetPb4 sets the uint32 value in the LinkStatepriorityBandwidths object +func (obj *linkStatepriorityBandwidths) SetPb4(value uint32) LinkStatepriorityBandwidths { + + obj.obj.Pb4 = &value + return obj +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 5. +// Pb5 returns a uint32 +func (obj *linkStatepriorityBandwidths) Pb5() uint32 { + + return *obj.obj.Pb5 + +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 5. +// Pb5 returns a uint32 +func (obj *linkStatepriorityBandwidths) HasPb5() bool { + return obj.obj.Pb5 != nil +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 5. +// SetPb5 sets the uint32 value in the LinkStatepriorityBandwidths object +func (obj *linkStatepriorityBandwidths) SetPb5(value uint32) LinkStatepriorityBandwidths { + + obj.obj.Pb5 = &value + return obj +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 6. +// Pb6 returns a uint32 +func (obj *linkStatepriorityBandwidths) Pb6() uint32 { + + return *obj.obj.Pb6 + +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 6. +// Pb6 returns a uint32 +func (obj *linkStatepriorityBandwidths) HasPb6() bool { + return obj.obj.Pb6 != nil +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 6. +// SetPb6 sets the uint32 value in the LinkStatepriorityBandwidths object +func (obj *linkStatepriorityBandwidths) SetPb6(value uint32) LinkStatepriorityBandwidths { + + obj.obj.Pb6 = &value + return obj +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 7. +// Pb7 returns a uint32 +func (obj *linkStatepriorityBandwidths) Pb7() uint32 { + + return *obj.obj.Pb7 + +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 7. +// Pb7 returns a uint32 +func (obj *linkStatepriorityBandwidths) HasPb7() bool { + return obj.obj.Pb7 != nil +} + +// Specifies the amount of bandwidth that can be reserved for the Priority 7. +// SetPb7 sets the uint32 value in the LinkStatepriorityBandwidths object +func (obj *linkStatepriorityBandwidths) SetPb7(value uint32) LinkStatepriorityBandwidths { + + obj.obj.Pb7 = &value + return obj +} + +func (obj *linkStatepriorityBandwidths) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *linkStatepriorityBandwidths) setDefault() { + if obj.obj.Pb0 == nil { + obj.SetPb0(125000000) + } + if obj.obj.Pb1 == nil { + obj.SetPb1(125000000) + } + if obj.obj.Pb2 == nil { + obj.SetPb2(125000000) + } + if obj.obj.Pb3 == nil { + obj.SetPb3(125000000) + } + if obj.obj.Pb4 == nil { + obj.SetPb4(125000000) + } + if obj.obj.Pb5 == nil { + obj.SetPb5(125000000) + } + if obj.obj.Pb6 == nil { + obj.SetPb6(125000000) + } + if obj.obj.Pb7 == nil { + obj.SetPb7(125000000) + } + +} diff --git a/gosnappi/lldp.go b/gosnappi/lldp.go new file mode 100644 index 00000000..7f02c404 --- /dev/null +++ b/gosnappi/lldp.go @@ -0,0 +1,560 @@ +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" +) + +// ***** Lldp ***** +type lldp struct { + validation + obj *otg.Lldp + marshaller marshalLldp + unMarshaller unMarshalLldp + connectionHolder LldpConnection + chassisIdHolder LldpChassisId + portIdHolder LldpPortId + systemNameHolder LldpSystemName +} + +func NewLldp() Lldp { + obj := lldp{obj: &otg.Lldp{}} + obj.setDefault() + return &obj +} + +func (obj *lldp) msg() *otg.Lldp { + return obj.obj +} + +func (obj *lldp) setMsg(msg *otg.Lldp) Lldp { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshallldp struct { + obj *lldp +} + +type marshalLldp interface { + // ToProto marshals Lldp to protobuf object *otg.Lldp + ToProto() (*otg.Lldp, error) + // ToPbText marshals Lldp to protobuf text + ToPbText() (string, error) + // ToYaml marshals Lldp to YAML text + ToYaml() (string, error) + // ToJson marshals Lldp to JSON text + ToJson() (string, error) +} + +type unMarshallldp struct { + obj *lldp +} + +type unMarshalLldp interface { + // FromProto unmarshals Lldp from protobuf object *otg.Lldp + FromProto(msg *otg.Lldp) (Lldp, error) + // FromPbText unmarshals Lldp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Lldp from YAML text + FromYaml(value string) error + // FromJson unmarshals Lldp from JSON text + FromJson(value string) error +} + +func (obj *lldp) Marshal() marshalLldp { + if obj.marshaller == nil { + obj.marshaller = &marshallldp{obj: obj} + } + return obj.marshaller +} + +func (obj *lldp) Unmarshal() unMarshalLldp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallldp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallldp) ToProto() (*otg.Lldp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallldp) FromProto(msg *otg.Lldp) (Lldp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallldp) 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 *unMarshallldp) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshallldp) 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 *unMarshallldp) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshallldp) 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 *unMarshallldp) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *lldp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lldp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lldp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lldp) Clone() (Lldp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLldp() + 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 +} + +func (obj *lldp) setNil() { + obj.connectionHolder = nil + obj.chassisIdHolder = nil + obj.portIdHolder = nil + obj.systemNameHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// Lldp is configuration of LLDP protocol IEEE Ref: https://www.ieee802.org/1/files/public/docs2002/lldp-protocol-00.pdf +type Lldp interface { + Validation + // msg marshals Lldp to protobuf object *otg.Lldp + // and doesn't set defaults + msg() *otg.Lldp + // setMsg unmarshals Lldp from protobuf object *otg.Lldp + // and doesn't set defaults + setMsg(*otg.Lldp) Lldp + // provides marshal interface + Marshal() marshalLldp + // provides unmarshal interface + Unmarshal() unMarshalLldp + // validate validates Lldp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Lldp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Connection returns LldpConnection, set in Lldp. + // LldpConnection is lLDP connection to a test port. In future if more connection options arise LLDP connection object will be enhanced. + Connection() LldpConnection + // SetConnection assigns LldpConnection provided by user to Lldp. + // LldpConnection is lLDP connection to a test port. In future if more connection options arise LLDP connection object will be enhanced. + SetConnection(value LldpConnection) Lldp + // ChassisId returns LldpChassisId, set in Lldp. + // LldpChassisId is the Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. This field identifies the format and source of the chassis identifier string. It is based on the enumerator defined by the LldpChassisIdSubtype object from IEEE 802.1AB MIB. + ChassisId() LldpChassisId + // SetChassisId assigns LldpChassisId provided by user to Lldp. + // LldpChassisId is the Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. This field identifies the format and source of the chassis identifier string. It is based on the enumerator defined by the LldpChassisIdSubtype object from IEEE 802.1AB MIB. + SetChassisId(value LldpChassisId) Lldp + // HasChassisId checks if ChassisId has been set in Lldp + HasChassisId() bool + // PortId returns LldpPortId, set in Lldp. + // LldpPortId is the Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent.This field identifies the format and source of the port identifier string. It is based on the enumerator defined by the PtopoPortIdType object from RFC2922. + PortId() LldpPortId + // SetPortId assigns LldpPortId provided by user to Lldp. + // LldpPortId is the Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent.This field identifies the format and source of the port identifier string. It is based on the enumerator defined by the PtopoPortIdType object from RFC2922. + SetPortId(value LldpPortId) Lldp + // HasPortId checks if PortId has been set in Lldp + HasPortId() bool + // SystemName returns LldpSystemName, set in Lldp. + // LldpSystemName is the system Name configured in the System Name TLV. + SystemName() LldpSystemName + // SetSystemName assigns LldpSystemName provided by user to Lldp. + // LldpSystemName is the system Name configured in the System Name TLV. + SetSystemName(value LldpSystemName) Lldp + // HasSystemName checks if SystemName has been set in Lldp + HasSystemName() bool + // HoldTime returns uint32, set in Lldp. + HoldTime() uint32 + // SetHoldTime assigns uint32 provided by user to Lldp + SetHoldTime(value uint32) Lldp + // HasHoldTime checks if HoldTime has been set in Lldp + HasHoldTime() bool + // AdvertisementInterval returns uint32, set in Lldp. + AdvertisementInterval() uint32 + // SetAdvertisementInterval assigns uint32 provided by user to Lldp + SetAdvertisementInterval(value uint32) Lldp + // HasAdvertisementInterval checks if AdvertisementInterval has been set in Lldp + HasAdvertisementInterval() bool + // Name returns string, set in Lldp. + Name() string + // SetName assigns string provided by user to Lldp + SetName(value string) Lldp + setNil() +} + +// The unique name of the object on which LLDP is running. +// Connection returns a LldpConnection +func (obj *lldp) Connection() LldpConnection { + if obj.obj.Connection == nil { + obj.obj.Connection = NewLldpConnection().msg() + } + if obj.connectionHolder == nil { + obj.connectionHolder = &lldpConnection{obj: obj.obj.Connection} + } + return obj.connectionHolder +} + +// The unique name of the object on which LLDP is running. +// SetConnection sets the LldpConnection value in the Lldp object +func (obj *lldp) SetConnection(value LldpConnection) Lldp { + + obj.connectionHolder = nil + obj.obj.Connection = value.msg() + + return obj +} + +// The Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. If mac address is specified it should be in colon seperated mac address format. +// ChassisId returns a LldpChassisId +func (obj *lldp) ChassisId() LldpChassisId { + if obj.obj.ChassisId == nil { + obj.obj.ChassisId = NewLldpChassisId().msg() + } + if obj.chassisIdHolder == nil { + obj.chassisIdHolder = &lldpChassisId{obj: obj.obj.ChassisId} + } + return obj.chassisIdHolder +} + +// The Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. If mac address is specified it should be in colon seperated mac address format. +// ChassisId returns a LldpChassisId +func (obj *lldp) HasChassisId() bool { + return obj.obj.ChassisId != nil +} + +// The Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. If mac address is specified it should be in colon seperated mac address format. +// SetChassisId sets the LldpChassisId value in the Lldp object +func (obj *lldp) SetChassisId(value LldpChassisId) Lldp { + + obj.chassisIdHolder = nil + obj.obj.ChassisId = value.msg() + + return obj +} + +// The Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent. If the specified port is an IEEE 802.3 Repeater port, then this TLV is optional. +// PortId returns a LldpPortId +func (obj *lldp) PortId() LldpPortId { + if obj.obj.PortId == nil { + obj.obj.PortId = NewLldpPortId().msg() + } + if obj.portIdHolder == nil { + obj.portIdHolder = &lldpPortId{obj: obj.obj.PortId} + } + return obj.portIdHolder +} + +// The Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent. If the specified port is an IEEE 802.3 Repeater port, then this TLV is optional. +// PortId returns a LldpPortId +func (obj *lldp) HasPortId() bool { + return obj.obj.PortId != nil +} + +// The Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent. If the specified port is an IEEE 802.3 Repeater port, then this TLV is optional. +// SetPortId sets the LldpPortId value in the Lldp object +func (obj *lldp) SetPortId(value LldpPortId) Lldp { + + obj.portIdHolder = nil + obj.obj.PortId = value.msg() + + return obj +} + +// The system name field shall contain an alpha-numeric string that indicates the system's administratively assigned name. The system name should be the system's fully qualified domain name. If implementations support IETF RFC 3418, the sysName object should be used for this field. +// SystemName returns a LldpSystemName +func (obj *lldp) SystemName() LldpSystemName { + if obj.obj.SystemName == nil { + obj.obj.SystemName = NewLldpSystemName().msg() + } + if obj.systemNameHolder == nil { + obj.systemNameHolder = &lldpSystemName{obj: obj.obj.SystemName} + } + return obj.systemNameHolder +} + +// The system name field shall contain an alpha-numeric string that indicates the system's administratively assigned name. The system name should be the system's fully qualified domain name. If implementations support IETF RFC 3418, the sysName object should be used for this field. +// SystemName returns a LldpSystemName +func (obj *lldp) HasSystemName() bool { + return obj.obj.SystemName != nil +} + +// The system name field shall contain an alpha-numeric string that indicates the system's administratively assigned name. The system name should be the system's fully qualified domain name. If implementations support IETF RFC 3418, the sysName object should be used for this field. +// SetSystemName sets the LldpSystemName value in the Lldp object +func (obj *lldp) SetSystemName(value LldpSystemName) Lldp { + + obj.systemNameHolder = nil + obj.obj.SystemName = value.msg() + + return obj +} + +// Specifies the amount of time in seconds a receiving device should maintain LLDP information sent by the device before discarding it. +// HoldTime returns a uint32 +func (obj *lldp) HoldTime() uint32 { + + return *obj.obj.HoldTime + +} + +// Specifies the amount of time in seconds a receiving device should maintain LLDP information sent by the device before discarding it. +// HoldTime returns a uint32 +func (obj *lldp) HasHoldTime() bool { + return obj.obj.HoldTime != nil +} + +// Specifies the amount of time in seconds a receiving device should maintain LLDP information sent by the device before discarding it. +// SetHoldTime sets the uint32 value in the Lldp object +func (obj *lldp) SetHoldTime(value uint32) Lldp { + + obj.obj.HoldTime = &value + return obj +} + +// Set the transmission frequency of LLDP updates in seconds. +// AdvertisementInterval returns a uint32 +func (obj *lldp) AdvertisementInterval() uint32 { + + return *obj.obj.AdvertisementInterval + +} + +// Set the transmission frequency of LLDP updates in seconds. +// AdvertisementInterval returns a uint32 +func (obj *lldp) HasAdvertisementInterval() bool { + return obj.obj.AdvertisementInterval != nil +} + +// Set the transmission frequency of LLDP updates in seconds. +// SetAdvertisementInterval sets the uint32 value in the Lldp object +func (obj *lldp) SetAdvertisementInterval(value uint32) Lldp { + + obj.obj.AdvertisementInterval = &value + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *lldp) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the Lldp object +func (obj *lldp) SetName(value string) Lldp { + + obj.obj.Name = &value + return obj +} + +func (obj *lldp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Connection is required + if obj.obj.Connection == nil { + vObj.validationErrors = append(vObj.validationErrors, "Connection is required field on interface Lldp") + } + + if obj.obj.Connection != nil { + + obj.Connection().validateObj(vObj, set_default) + } + + if obj.obj.ChassisId != nil { + + obj.ChassisId().validateObj(vObj, set_default) + } + + if obj.obj.PortId != nil { + + obj.PortId().validateObj(vObj, set_default) + } + + if obj.obj.SystemName != nil { + + obj.SystemName().validateObj(vObj, set_default) + } + + if obj.obj.HoldTime != nil { + + if *obj.obj.HoldTime < 10 || *obj.obj.HoldTime > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("10 <= Lldp.HoldTime <= 65535 but Got %d", *obj.obj.HoldTime)) + } + + } + + if obj.obj.AdvertisementInterval != nil { + + if *obj.obj.AdvertisementInterval < 5 || *obj.obj.AdvertisementInterval > 65534 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("5 <= Lldp.AdvertisementInterval <= 65534 but Got %d", *obj.obj.AdvertisementInterval)) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface Lldp") + } +} + +func (obj *lldp) setDefault() { + if obj.obj.HoldTime == nil { + obj.SetHoldTime(120) + } + if obj.obj.AdvertisementInterval == nil { + obj.SetAdvertisementInterval(30) + } + +} diff --git a/gosnappi/lldp_capability_state.go b/gosnappi/lldp_capability_state.go new file mode 100644 index 00000000..3bf844fb --- /dev/null +++ b/gosnappi/lldp_capability_state.go @@ -0,0 +1,364 @@ +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" +) + +// ***** LldpCapabilityState ***** +type lldpCapabilityState struct { + validation + obj *otg.LldpCapabilityState + marshaller marshalLldpCapabilityState + unMarshaller unMarshalLldpCapabilityState +} + +func NewLldpCapabilityState() LldpCapabilityState { + obj := lldpCapabilityState{obj: &otg.LldpCapabilityState{}} + obj.setDefault() + return &obj +} + +func (obj *lldpCapabilityState) msg() *otg.LldpCapabilityState { + return obj.obj +} + +func (obj *lldpCapabilityState) setMsg(msg *otg.LldpCapabilityState) LldpCapabilityState { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallldpCapabilityState struct { + obj *lldpCapabilityState +} + +type marshalLldpCapabilityState interface { + // ToProto marshals LldpCapabilityState to protobuf object *otg.LldpCapabilityState + ToProto() (*otg.LldpCapabilityState, error) + // ToPbText marshals LldpCapabilityState to protobuf text + ToPbText() (string, error) + // ToYaml marshals LldpCapabilityState to YAML text + ToYaml() (string, error) + // ToJson marshals LldpCapabilityState to JSON text + ToJson() (string, error) +} + +type unMarshallldpCapabilityState struct { + obj *lldpCapabilityState +} + +type unMarshalLldpCapabilityState interface { + // FromProto unmarshals LldpCapabilityState from protobuf object *otg.LldpCapabilityState + FromProto(msg *otg.LldpCapabilityState) (LldpCapabilityState, error) + // FromPbText unmarshals LldpCapabilityState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LldpCapabilityState from YAML text + FromYaml(value string) error + // FromJson unmarshals LldpCapabilityState from JSON text + FromJson(value string) error +} + +func (obj *lldpCapabilityState) Marshal() marshalLldpCapabilityState { + if obj.marshaller == nil { + obj.marshaller = &marshallldpCapabilityState{obj: obj} + } + return obj.marshaller +} + +func (obj *lldpCapabilityState) Unmarshal() unMarshalLldpCapabilityState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallldpCapabilityState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallldpCapabilityState) ToProto() (*otg.LldpCapabilityState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallldpCapabilityState) FromProto(msg *otg.LldpCapabilityState) (LldpCapabilityState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallldpCapabilityState) 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 *unMarshallldpCapabilityState) 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 *marshallldpCapabilityState) 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 *unMarshallldpCapabilityState) 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 *marshallldpCapabilityState) 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 *unMarshallldpCapabilityState) 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 *lldpCapabilityState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lldpCapabilityState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lldpCapabilityState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lldpCapabilityState) Clone() (LldpCapabilityState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLldpCapabilityState() + 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 +} + +// LldpCapabilityState is lLDP system capability advertised by the neighbor +type LldpCapabilityState interface { + Validation + // msg marshals LldpCapabilityState to protobuf object *otg.LldpCapabilityState + // and doesn't set defaults + msg() *otg.LldpCapabilityState + // setMsg unmarshals LldpCapabilityState from protobuf object *otg.LldpCapabilityState + // and doesn't set defaults + setMsg(*otg.LldpCapabilityState) LldpCapabilityState + // provides marshal interface + Marshal() marshalLldpCapabilityState + // provides unmarshal interface + Unmarshal() unMarshalLldpCapabilityState + // validate validates LldpCapabilityState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LldpCapabilityState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // CapabilityName returns LldpCapabilityStateCapabilityNameEnum, set in LldpCapabilityState + CapabilityName() LldpCapabilityStateCapabilityNameEnum + // SetCapabilityName assigns LldpCapabilityStateCapabilityNameEnum provided by user to LldpCapabilityState + SetCapabilityName(value LldpCapabilityStateCapabilityNameEnum) LldpCapabilityState + // HasCapabilityName checks if CapabilityName has been set in LldpCapabilityState + HasCapabilityName() bool + // CapabilityEnabled returns bool, set in LldpCapabilityState. + CapabilityEnabled() bool + // SetCapabilityEnabled assigns bool provided by user to LldpCapabilityState + SetCapabilityEnabled(value bool) LldpCapabilityState + // HasCapabilityEnabled checks if CapabilityEnabled has been set in LldpCapabilityState + HasCapabilityEnabled() bool +} + +type LldpCapabilityStateCapabilityNameEnum string + +// Enum of CapabilityName on LldpCapabilityState +var LldpCapabilityStateCapabilityName = struct { + MAC_BRIDGE LldpCapabilityStateCapabilityNameEnum + TWO_PORT_MAC_RELAY LldpCapabilityStateCapabilityNameEnum + REPEATER LldpCapabilityStateCapabilityNameEnum + DOCSIS_CABLE_DEVICE LldpCapabilityStateCapabilityNameEnum + S_VLAN LldpCapabilityStateCapabilityNameEnum + TELEPHONE LldpCapabilityStateCapabilityNameEnum + OTHER LldpCapabilityStateCapabilityNameEnum + ROUTER LldpCapabilityStateCapabilityNameEnum + C_VLAN LldpCapabilityStateCapabilityNameEnum + STATION_ONLY LldpCapabilityStateCapabilityNameEnum + WLAN_ACCESS_POINT LldpCapabilityStateCapabilityNameEnum +}{ + MAC_BRIDGE: LldpCapabilityStateCapabilityNameEnum("mac_bridge"), + TWO_PORT_MAC_RELAY: LldpCapabilityStateCapabilityNameEnum("two_port_mac_relay"), + REPEATER: LldpCapabilityStateCapabilityNameEnum("repeater"), + DOCSIS_CABLE_DEVICE: LldpCapabilityStateCapabilityNameEnum("docsis_cable_device"), + S_VLAN: LldpCapabilityStateCapabilityNameEnum("s_vlan"), + TELEPHONE: LldpCapabilityStateCapabilityNameEnum("telephone"), + OTHER: LldpCapabilityStateCapabilityNameEnum("other"), + ROUTER: LldpCapabilityStateCapabilityNameEnum("router"), + C_VLAN: LldpCapabilityStateCapabilityNameEnum("c_vlan"), + STATION_ONLY: LldpCapabilityStateCapabilityNameEnum("station_only"), + WLAN_ACCESS_POINT: LldpCapabilityStateCapabilityNameEnum("wlan_access_point"), +} + +func (obj *lldpCapabilityState) CapabilityName() LldpCapabilityStateCapabilityNameEnum { + return LldpCapabilityStateCapabilityNameEnum(obj.obj.CapabilityName.Enum().String()) +} + +// Name of the system capability advertised by the neighbor. Capabilities are represented in a bitmap that defines the primary functions of the system. The capabilities are defined in IEEE 802.1AB. +// CapabilityName returns a string +func (obj *lldpCapabilityState) HasCapabilityName() bool { + return obj.obj.CapabilityName != nil +} + +func (obj *lldpCapabilityState) SetCapabilityName(value LldpCapabilityStateCapabilityNameEnum) LldpCapabilityState { + intValue, ok := otg.LldpCapabilityState_CapabilityName_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LldpCapabilityStateCapabilityNameEnum", string(value))) + return obj + } + enumValue := otg.LldpCapabilityState_CapabilityName_Enum(intValue) + obj.obj.CapabilityName = &enumValue + + return obj +} + +// Indicates whether the corresponding system capability is enabled on the neighbor. +// CapabilityEnabled returns a bool +func (obj *lldpCapabilityState) CapabilityEnabled() bool { + + return *obj.obj.CapabilityEnabled + +} + +// Indicates whether the corresponding system capability is enabled on the neighbor. +// CapabilityEnabled returns a bool +func (obj *lldpCapabilityState) HasCapabilityEnabled() bool { + return obj.obj.CapabilityEnabled != nil +} + +// Indicates whether the corresponding system capability is enabled on the neighbor. +// SetCapabilityEnabled sets the bool value in the LldpCapabilityState object +func (obj *lldpCapabilityState) SetCapabilityEnabled(value bool) LldpCapabilityState { + + obj.obj.CapabilityEnabled = &value + return obj +} + +func (obj *lldpCapabilityState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *lldpCapabilityState) setDefault() { + +} diff --git a/gosnappi/lldp_chassis_id.go b/gosnappi/lldp_chassis_id.go new file mode 100644 index 00000000..6a3b37ab --- /dev/null +++ b/gosnappi/lldp_chassis_id.go @@ -0,0 +1,476 @@ +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" +) + +// ***** LldpChassisId ***** +type lldpChassisId struct { + validation + obj *otg.LldpChassisId + marshaller marshalLldpChassisId + unMarshaller unMarshalLldpChassisId + macAddressSubtypeHolder LldpChassisMacSubType +} + +func NewLldpChassisId() LldpChassisId { + obj := lldpChassisId{obj: &otg.LldpChassisId{}} + obj.setDefault() + return &obj +} + +func (obj *lldpChassisId) msg() *otg.LldpChassisId { + return obj.obj +} + +func (obj *lldpChassisId) setMsg(msg *otg.LldpChassisId) LldpChassisId { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshallldpChassisId struct { + obj *lldpChassisId +} + +type marshalLldpChassisId interface { + // ToProto marshals LldpChassisId to protobuf object *otg.LldpChassisId + ToProto() (*otg.LldpChassisId, error) + // ToPbText marshals LldpChassisId to protobuf text + ToPbText() (string, error) + // ToYaml marshals LldpChassisId to YAML text + ToYaml() (string, error) + // ToJson marshals LldpChassisId to JSON text + ToJson() (string, error) +} + +type unMarshallldpChassisId struct { + obj *lldpChassisId +} + +type unMarshalLldpChassisId interface { + // FromProto unmarshals LldpChassisId from protobuf object *otg.LldpChassisId + FromProto(msg *otg.LldpChassisId) (LldpChassisId, error) + // FromPbText unmarshals LldpChassisId from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LldpChassisId from YAML text + FromYaml(value string) error + // FromJson unmarshals LldpChassisId from JSON text + FromJson(value string) error +} + +func (obj *lldpChassisId) Marshal() marshalLldpChassisId { + if obj.marshaller == nil { + obj.marshaller = &marshallldpChassisId{obj: obj} + } + return obj.marshaller +} + +func (obj *lldpChassisId) Unmarshal() unMarshalLldpChassisId { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallldpChassisId{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallldpChassisId) ToProto() (*otg.LldpChassisId, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallldpChassisId) FromProto(msg *otg.LldpChassisId) (LldpChassisId, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallldpChassisId) 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 *unMarshallldpChassisId) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshallldpChassisId) 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 *unMarshallldpChassisId) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshallldpChassisId) 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 *unMarshallldpChassisId) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *lldpChassisId) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lldpChassisId) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lldpChassisId) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lldpChassisId) Clone() (LldpChassisId, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLldpChassisId() + 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 +} + +func (obj *lldpChassisId) setNil() { + obj.macAddressSubtypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// LldpChassisId is the Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. This field identifies the format and source of the chassis identifier string. It is based on the enumerator defined by the LldpChassisIdSubtype object from IEEE 802.1AB MIB. +type LldpChassisId interface { + Validation + // msg marshals LldpChassisId to protobuf object *otg.LldpChassisId + // and doesn't set defaults + msg() *otg.LldpChassisId + // setMsg unmarshals LldpChassisId from protobuf object *otg.LldpChassisId + // and doesn't set defaults + setMsg(*otg.LldpChassisId) LldpChassisId + // provides marshal interface + Marshal() marshalLldpChassisId + // provides unmarshal interface + Unmarshal() unMarshalLldpChassisId + // validate validates LldpChassisId + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LldpChassisId, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns LldpChassisIdChoiceEnum, set in LldpChassisId + Choice() LldpChassisIdChoiceEnum + // setChoice assigns LldpChassisIdChoiceEnum provided by user to LldpChassisId + setChoice(value LldpChassisIdChoiceEnum) LldpChassisId + // HasChoice checks if Choice has been set in LldpChassisId + HasChoice() bool + // MacAddressSubtype returns LldpChassisMacSubType, set in LldpChassisId. + // LldpChassisMacSubType is the MAC address configured in the Chassis ID TLV. + MacAddressSubtype() LldpChassisMacSubType + // SetMacAddressSubtype assigns LldpChassisMacSubType provided by user to LldpChassisId. + // LldpChassisMacSubType is the MAC address configured in the Chassis ID TLV. + SetMacAddressSubtype(value LldpChassisMacSubType) LldpChassisId + // HasMacAddressSubtype checks if MacAddressSubtype has been set in LldpChassisId + HasMacAddressSubtype() bool + // InterfaceNameSubtype returns string, set in LldpChassisId. + InterfaceNameSubtype() string + // SetInterfaceNameSubtype assigns string provided by user to LldpChassisId + SetInterfaceNameSubtype(value string) LldpChassisId + // HasInterfaceNameSubtype checks if InterfaceNameSubtype has been set in LldpChassisId + HasInterfaceNameSubtype() bool + // LocalSubtype returns string, set in LldpChassisId. + LocalSubtype() string + // SetLocalSubtype assigns string provided by user to LldpChassisId + SetLocalSubtype(value string) LldpChassisId + // HasLocalSubtype checks if LocalSubtype has been set in LldpChassisId + HasLocalSubtype() bool + setNil() +} + +type LldpChassisIdChoiceEnum string + +// Enum of Choice on LldpChassisId +var LldpChassisIdChoice = struct { + MAC_ADDRESS_SUBTYPE LldpChassisIdChoiceEnum + INTERFACE_NAME_SUBTYPE LldpChassisIdChoiceEnum + LOCAL_SUBTYPE LldpChassisIdChoiceEnum +}{ + MAC_ADDRESS_SUBTYPE: LldpChassisIdChoiceEnum("mac_address_subtype"), + INTERFACE_NAME_SUBTYPE: LldpChassisIdChoiceEnum("interface_name_subtype"), + LOCAL_SUBTYPE: LldpChassisIdChoiceEnum("local_subtype"), +} + +func (obj *lldpChassisId) Choice() LldpChassisIdChoiceEnum { + return LldpChassisIdChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// Chassis ID subtype to be used in Chassis ID TLV. +// Choice returns a string +func (obj *lldpChassisId) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *lldpChassisId) setChoice(value LldpChassisIdChoiceEnum) LldpChassisId { + intValue, ok := otg.LldpChassisId_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LldpChassisIdChoiceEnum", string(value))) + return obj + } + enumValue := otg.LldpChassisId_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.LocalSubtype = nil + obj.obj.InterfaceNameSubtype = nil + obj.obj.MacAddressSubtype = nil + obj.macAddressSubtypeHolder = nil + + if value == LldpChassisIdChoice.MAC_ADDRESS_SUBTYPE { + obj.obj.MacAddressSubtype = NewLldpChassisMacSubType().msg() + } + + return obj +} + +// description is TBD +// MacAddressSubtype returns a LldpChassisMacSubType +func (obj *lldpChassisId) MacAddressSubtype() LldpChassisMacSubType { + if obj.obj.MacAddressSubtype == nil { + obj.setChoice(LldpChassisIdChoice.MAC_ADDRESS_SUBTYPE) + } + if obj.macAddressSubtypeHolder == nil { + obj.macAddressSubtypeHolder = &lldpChassisMacSubType{obj: obj.obj.MacAddressSubtype} + } + return obj.macAddressSubtypeHolder +} + +// description is TBD +// MacAddressSubtype returns a LldpChassisMacSubType +func (obj *lldpChassisId) HasMacAddressSubtype() bool { + return obj.obj.MacAddressSubtype != nil +} + +// description is TBD +// SetMacAddressSubtype sets the LldpChassisMacSubType value in the LldpChassisId object +func (obj *lldpChassisId) SetMacAddressSubtype(value LldpChassisMacSubType) LldpChassisId { + obj.setChoice(LldpChassisIdChoice.MAC_ADDRESS_SUBTYPE) + obj.macAddressSubtypeHolder = nil + obj.obj.MacAddressSubtype = value.msg() + + return obj +} + +// Name of an interface of the chassis that uniquely identifies the chassis. +// InterfaceNameSubtype returns a string +func (obj *lldpChassisId) InterfaceNameSubtype() string { + + if obj.obj.InterfaceNameSubtype == nil { + obj.setChoice(LldpChassisIdChoice.INTERFACE_NAME_SUBTYPE) + } + + return *obj.obj.InterfaceNameSubtype + +} + +// Name of an interface of the chassis that uniquely identifies the chassis. +// InterfaceNameSubtype returns a string +func (obj *lldpChassisId) HasInterfaceNameSubtype() bool { + return obj.obj.InterfaceNameSubtype != nil +} + +// Name of an interface of the chassis that uniquely identifies the chassis. +// SetInterfaceNameSubtype sets the string value in the LldpChassisId object +func (obj *lldpChassisId) SetInterfaceNameSubtype(value string) LldpChassisId { + obj.setChoice(LldpChassisIdChoice.INTERFACE_NAME_SUBTYPE) + obj.obj.InterfaceNameSubtype = &value + return obj +} + +// Locally assigned name of the chassis. +// LocalSubtype returns a string +func (obj *lldpChassisId) LocalSubtype() string { + + if obj.obj.LocalSubtype == nil { + obj.setChoice(LldpChassisIdChoice.LOCAL_SUBTYPE) + } + + return *obj.obj.LocalSubtype + +} + +// Locally assigned name of the chassis. +// LocalSubtype returns a string +func (obj *lldpChassisId) HasLocalSubtype() bool { + return obj.obj.LocalSubtype != nil +} + +// Locally assigned name of the chassis. +// SetLocalSubtype sets the string value in the LldpChassisId object +func (obj *lldpChassisId) SetLocalSubtype(value string) LldpChassisId { + obj.setChoice(LldpChassisIdChoice.LOCAL_SUBTYPE) + obj.obj.LocalSubtype = &value + return obj +} + +func (obj *lldpChassisId) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.MacAddressSubtype != nil { + + obj.MacAddressSubtype().validateObj(vObj, set_default) + } + +} + +func (obj *lldpChassisId) setDefault() { + var choices_set int = 0 + var choice LldpChassisIdChoiceEnum + + if obj.obj.MacAddressSubtype != nil { + choices_set += 1 + choice = LldpChassisIdChoice.MAC_ADDRESS_SUBTYPE + } + + if obj.obj.InterfaceNameSubtype != nil { + choices_set += 1 + choice = LldpChassisIdChoice.INTERFACE_NAME_SUBTYPE + } + + if obj.obj.LocalSubtype != nil { + choices_set += 1 + choice = LldpChassisIdChoice.LOCAL_SUBTYPE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(LldpChassisIdChoice.MAC_ADDRESS_SUBTYPE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in LldpChassisId") + } + } else { + intVal := otg.LldpChassisId_Choice_Enum_value[string(choice)] + enumValue := otg.LldpChassisId_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/lldp_chassis_mac_sub_type.go b/gosnappi/lldp_chassis_mac_sub_type.go new file mode 100644 index 00000000..34e5af08 --- /dev/null +++ b/gosnappi/lldp_chassis_mac_sub_type.go @@ -0,0 +1,420 @@ +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" +) + +// ***** LldpChassisMacSubType ***** +type lldpChassisMacSubType struct { + validation + obj *otg.LldpChassisMacSubType + marshaller marshalLldpChassisMacSubType + unMarshaller unMarshalLldpChassisMacSubType +} + +func NewLldpChassisMacSubType() LldpChassisMacSubType { + obj := lldpChassisMacSubType{obj: &otg.LldpChassisMacSubType{}} + obj.setDefault() + return &obj +} + +func (obj *lldpChassisMacSubType) msg() *otg.LldpChassisMacSubType { + return obj.obj +} + +func (obj *lldpChassisMacSubType) setMsg(msg *otg.LldpChassisMacSubType) LldpChassisMacSubType { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallldpChassisMacSubType struct { + obj *lldpChassisMacSubType +} + +type marshalLldpChassisMacSubType interface { + // ToProto marshals LldpChassisMacSubType to protobuf object *otg.LldpChassisMacSubType + ToProto() (*otg.LldpChassisMacSubType, error) + // ToPbText marshals LldpChassisMacSubType to protobuf text + ToPbText() (string, error) + // ToYaml marshals LldpChassisMacSubType to YAML text + ToYaml() (string, error) + // ToJson marshals LldpChassisMacSubType to JSON text + ToJson() (string, error) +} + +type unMarshallldpChassisMacSubType struct { + obj *lldpChassisMacSubType +} + +type unMarshalLldpChassisMacSubType interface { + // FromProto unmarshals LldpChassisMacSubType from protobuf object *otg.LldpChassisMacSubType + FromProto(msg *otg.LldpChassisMacSubType) (LldpChassisMacSubType, error) + // FromPbText unmarshals LldpChassisMacSubType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LldpChassisMacSubType from YAML text + FromYaml(value string) error + // FromJson unmarshals LldpChassisMacSubType from JSON text + FromJson(value string) error +} + +func (obj *lldpChassisMacSubType) Marshal() marshalLldpChassisMacSubType { + if obj.marshaller == nil { + obj.marshaller = &marshallldpChassisMacSubType{obj: obj} + } + return obj.marshaller +} + +func (obj *lldpChassisMacSubType) Unmarshal() unMarshalLldpChassisMacSubType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallldpChassisMacSubType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallldpChassisMacSubType) ToProto() (*otg.LldpChassisMacSubType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallldpChassisMacSubType) FromProto(msg *otg.LldpChassisMacSubType) (LldpChassisMacSubType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallldpChassisMacSubType) 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 *unMarshallldpChassisMacSubType) 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 *marshallldpChassisMacSubType) 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 *unMarshallldpChassisMacSubType) 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 *marshallldpChassisMacSubType) 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 *unMarshallldpChassisMacSubType) 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 *lldpChassisMacSubType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lldpChassisMacSubType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lldpChassisMacSubType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lldpChassisMacSubType) Clone() (LldpChassisMacSubType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLldpChassisMacSubType() + 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 +} + +// LldpChassisMacSubType is the MAC address configured in the Chassis ID TLV. +type LldpChassisMacSubType interface { + Validation + // msg marshals LldpChassisMacSubType to protobuf object *otg.LldpChassisMacSubType + // and doesn't set defaults + msg() *otg.LldpChassisMacSubType + // setMsg unmarshals LldpChassisMacSubType from protobuf object *otg.LldpChassisMacSubType + // and doesn't set defaults + setMsg(*otg.LldpChassisMacSubType) LldpChassisMacSubType + // provides marshal interface + Marshal() marshalLldpChassisMacSubType + // provides unmarshal interface + Unmarshal() unMarshalLldpChassisMacSubType + // validate validates LldpChassisMacSubType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LldpChassisMacSubType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns LldpChassisMacSubTypeChoiceEnum, set in LldpChassisMacSubType + Choice() LldpChassisMacSubTypeChoiceEnum + // setChoice assigns LldpChassisMacSubTypeChoiceEnum provided by user to LldpChassisMacSubType + setChoice(value LldpChassisMacSubTypeChoiceEnum) LldpChassisMacSubType + // HasChoice checks if Choice has been set in LldpChassisMacSubType + HasChoice() bool + // Auto returns string, set in LldpChassisMacSubType. + Auto() string + // HasAuto checks if Auto has been set in LldpChassisMacSubType + HasAuto() bool + // Value returns string, set in LldpChassisMacSubType. + Value() string + // SetValue assigns string provided by user to LldpChassisMacSubType + SetValue(value string) LldpChassisMacSubType + // HasValue checks if Value has been set in LldpChassisMacSubType + HasValue() bool +} + +type LldpChassisMacSubTypeChoiceEnum string + +// Enum of Choice on LldpChassisMacSubType +var LldpChassisMacSubTypeChoice = struct { + AUTO LldpChassisMacSubTypeChoiceEnum + VALUE LldpChassisMacSubTypeChoiceEnum +}{ + AUTO: LldpChassisMacSubTypeChoiceEnum("auto"), + VALUE: LldpChassisMacSubTypeChoiceEnum("value"), +} + +func (obj *lldpChassisMacSubType) Choice() LldpChassisMacSubTypeChoiceEnum { + return LldpChassisMacSubTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// In auto mode the system generated value is set for this property, while if the choice is selected as value, a user configured value will be used for this property. +// Choice returns a string +func (obj *lldpChassisMacSubType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *lldpChassisMacSubType) setChoice(value LldpChassisMacSubTypeChoiceEnum) LldpChassisMacSubType { + intValue, ok := otg.LldpChassisMacSubType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LldpChassisMacSubTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.LldpChassisMacSubType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Value = nil + obj.obj.Auto = nil + return obj +} + +// The OTG implementation must provide a system generated value for this property. +// Auto returns a string +func (obj *lldpChassisMacSubType) Auto() string { + + if obj.obj.Auto == nil { + obj.setChoice(LldpChassisMacSubTypeChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation must provide a system generated value for this property. +// Auto returns a string +func (obj *lldpChassisMacSubType) HasAuto() bool { + return obj.obj.Auto != nil +} + +// User must specify a value if mode is not auto. +// Value returns a string +func (obj *lldpChassisMacSubType) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(LldpChassisMacSubTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// User must specify a value if mode is not auto. +// Value returns a string +func (obj *lldpChassisMacSubType) HasValue() bool { + return obj.obj.Value != nil +} + +// User must specify a value if mode is not auto. +// SetValue sets the string value in the LldpChassisMacSubType object +func (obj *lldpChassisMacSubType) SetValue(value string) LldpChassisMacSubType { + obj.setChoice(LldpChassisMacSubTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +func (obj *lldpChassisMacSubType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Auto != nil { + + err := obj.validateMac(obj.Auto()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on LldpChassisMacSubType.Auto")) + } + + } + + if obj.obj.Value != nil { + + err := obj.validateMac(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on LldpChassisMacSubType.Value")) + } + + } + +} + +func (obj *lldpChassisMacSubType) setDefault() { + var choices_set int = 0 + var choice LldpChassisMacSubTypeChoiceEnum + + if obj.obj.Auto != nil { + choices_set += 1 + choice = LldpChassisMacSubTypeChoice.AUTO + } + + if obj.obj.Value != nil { + choices_set += 1 + choice = LldpChassisMacSubTypeChoice.VALUE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(LldpChassisMacSubTypeChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in LldpChassisMacSubType") + } + } else { + intVal := otg.LldpChassisMacSubType_Choice_Enum_value[string(choice)] + enumValue := otg.LldpChassisMacSubType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/lldp_connection.go b/gosnappi/lldp_connection.go new file mode 100644 index 00000000..cdbd74ff --- /dev/null +++ b/gosnappi/lldp_connection.go @@ -0,0 +1,387 @@ +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" +) + +// ***** LldpConnection ***** +type lldpConnection struct { + validation + obj *otg.LldpConnection + marshaller marshalLldpConnection + unMarshaller unMarshalLldpConnection +} + +func NewLldpConnection() LldpConnection { + obj := lldpConnection{obj: &otg.LldpConnection{}} + obj.setDefault() + return &obj +} + +func (obj *lldpConnection) msg() *otg.LldpConnection { + return obj.obj +} + +func (obj *lldpConnection) setMsg(msg *otg.LldpConnection) LldpConnection { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallldpConnection struct { + obj *lldpConnection +} + +type marshalLldpConnection interface { + // ToProto marshals LldpConnection to protobuf object *otg.LldpConnection + ToProto() (*otg.LldpConnection, error) + // ToPbText marshals LldpConnection to protobuf text + ToPbText() (string, error) + // ToYaml marshals LldpConnection to YAML text + ToYaml() (string, error) + // ToJson marshals LldpConnection to JSON text + ToJson() (string, error) +} + +type unMarshallldpConnection struct { + obj *lldpConnection +} + +type unMarshalLldpConnection interface { + // FromProto unmarshals LldpConnection from protobuf object *otg.LldpConnection + FromProto(msg *otg.LldpConnection) (LldpConnection, error) + // FromPbText unmarshals LldpConnection from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LldpConnection from YAML text + FromYaml(value string) error + // FromJson unmarshals LldpConnection from JSON text + FromJson(value string) error +} + +func (obj *lldpConnection) Marshal() marshalLldpConnection { + if obj.marshaller == nil { + obj.marshaller = &marshallldpConnection{obj: obj} + } + return obj.marshaller +} + +func (obj *lldpConnection) Unmarshal() unMarshalLldpConnection { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallldpConnection{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallldpConnection) ToProto() (*otg.LldpConnection, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallldpConnection) FromProto(msg *otg.LldpConnection) (LldpConnection, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallldpConnection) 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 *unMarshallldpConnection) 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 *marshallldpConnection) 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 *unMarshallldpConnection) 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 *marshallldpConnection) 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 *unMarshallldpConnection) 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 *lldpConnection) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lldpConnection) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lldpConnection) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lldpConnection) Clone() (LldpConnection, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLldpConnection() + 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 +} + +// LldpConnection is lLDP connection to a test port. In future if more connection options arise LLDP connection object will be enhanced. +type LldpConnection interface { + Validation + // msg marshals LldpConnection to protobuf object *otg.LldpConnection + // and doesn't set defaults + msg() *otg.LldpConnection + // setMsg unmarshals LldpConnection from protobuf object *otg.LldpConnection + // and doesn't set defaults + setMsg(*otg.LldpConnection) LldpConnection + // provides marshal interface + Marshal() marshalLldpConnection + // provides unmarshal interface + Unmarshal() unMarshalLldpConnection + // validate validates LldpConnection + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LldpConnection, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns LldpConnectionChoiceEnum, set in LldpConnection + Choice() LldpConnectionChoiceEnum + // setChoice assigns LldpConnectionChoiceEnum provided by user to LldpConnection + setChoice(value LldpConnectionChoiceEnum) LldpConnection + // HasChoice checks if Choice has been set in LldpConnection + HasChoice() bool + // PortName returns string, set in LldpConnection. + PortName() string + // SetPortName assigns string provided by user to LldpConnection + SetPortName(value string) LldpConnection + // HasPortName checks if PortName has been set in LldpConnection + HasPortName() bool +} + +type LldpConnectionChoiceEnum string + +// Enum of Choice on LldpConnection +var LldpConnectionChoice = struct { + PORT_NAME LldpConnectionChoiceEnum +}{ + PORT_NAME: LldpConnectionChoiceEnum("port_name"), +} + +func (obj *lldpConnection) Choice() LldpConnectionChoiceEnum { + return LldpConnectionChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The name of the test port or other connection objects on which LLDP is configured. +// Choice returns a string +func (obj *lldpConnection) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *lldpConnection) setChoice(value LldpConnectionChoiceEnum) LldpConnection { + intValue, ok := otg.LldpConnection_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LldpConnectionChoiceEnum", string(value))) + return obj + } + enumValue := otg.LldpConnection_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.PortName = nil + return obj +} + +// Name of the test port on which LLDP is configured on. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// PortName returns a string +func (obj *lldpConnection) PortName() string { + + if obj.obj.PortName == nil { + obj.setChoice(LldpConnectionChoice.PORT_NAME) + } + + return *obj.obj.PortName + +} + +// Name of the test port on which LLDP is configured on. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// PortName returns a string +func (obj *lldpConnection) HasPortName() bool { + return obj.obj.PortName != nil +} + +// Name of the test port on which LLDP is configured on. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// SetPortName sets the string value in the LldpConnection object +func (obj *lldpConnection) SetPortName(value string) LldpConnection { + obj.setChoice(LldpConnectionChoice.PORT_NAME) + obj.obj.PortName = &value + return obj +} + +func (obj *lldpConnection) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *lldpConnection) setDefault() { + var choices_set int = 0 + var choice LldpConnectionChoiceEnum + + if obj.obj.PortName != nil { + choices_set += 1 + choice = LldpConnectionChoice.PORT_NAME + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in LldpConnection") + } + } else { + intVal := otg.LldpConnection_Choice_Enum_value[string(choice)] + enumValue := otg.LldpConnection_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/lldp_custom_tlv_state.go b/gosnappi/lldp_custom_tlv_state.go new file mode 100644 index 00000000..6d3b38ae --- /dev/null +++ b/gosnappi/lldp_custom_tlv_state.go @@ -0,0 +1,362 @@ +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" +) + +// ***** LldpCustomTLVState ***** +type lldpCustomTLVState struct { + validation + obj *otg.LldpCustomTLVState + marshaller marshalLldpCustomTLVState + unMarshaller unMarshalLldpCustomTLVState +} + +func NewLldpCustomTLVState() LldpCustomTLVState { + obj := lldpCustomTLVState{obj: &otg.LldpCustomTLVState{}} + obj.setDefault() + return &obj +} + +func (obj *lldpCustomTLVState) msg() *otg.LldpCustomTLVState { + return obj.obj +} + +func (obj *lldpCustomTLVState) setMsg(msg *otg.LldpCustomTLVState) LldpCustomTLVState { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallldpCustomTLVState struct { + obj *lldpCustomTLVState +} + +type marshalLldpCustomTLVState interface { + // ToProto marshals LldpCustomTLVState to protobuf object *otg.LldpCustomTLVState + ToProto() (*otg.LldpCustomTLVState, error) + // ToPbText marshals LldpCustomTLVState to protobuf text + ToPbText() (string, error) + // ToYaml marshals LldpCustomTLVState to YAML text + ToYaml() (string, error) + // ToJson marshals LldpCustomTLVState to JSON text + ToJson() (string, error) +} + +type unMarshallldpCustomTLVState struct { + obj *lldpCustomTLVState +} + +type unMarshalLldpCustomTLVState interface { + // FromProto unmarshals LldpCustomTLVState from protobuf object *otg.LldpCustomTLVState + FromProto(msg *otg.LldpCustomTLVState) (LldpCustomTLVState, error) + // FromPbText unmarshals LldpCustomTLVState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LldpCustomTLVState from YAML text + FromYaml(value string) error + // FromJson unmarshals LldpCustomTLVState from JSON text + FromJson(value string) error +} + +func (obj *lldpCustomTLVState) Marshal() marshalLldpCustomTLVState { + if obj.marshaller == nil { + obj.marshaller = &marshallldpCustomTLVState{obj: obj} + } + return obj.marshaller +} + +func (obj *lldpCustomTLVState) Unmarshal() unMarshalLldpCustomTLVState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallldpCustomTLVState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallldpCustomTLVState) ToProto() (*otg.LldpCustomTLVState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallldpCustomTLVState) FromProto(msg *otg.LldpCustomTLVState) (LldpCustomTLVState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallldpCustomTLVState) 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 *unMarshallldpCustomTLVState) 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 *marshallldpCustomTLVState) 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 *unMarshallldpCustomTLVState) 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 *marshallldpCustomTLVState) 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 *unMarshallldpCustomTLVState) 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 *lldpCustomTLVState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lldpCustomTLVState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lldpCustomTLVState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lldpCustomTLVState) Clone() (LldpCustomTLVState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLldpCustomTLVState() + 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 +} + +// LldpCustomTLVState is custom TLV received from a neighbor.Custom TLVs are organization specific TLVs advertised with TLV type 127. +type LldpCustomTLVState interface { + Validation + // msg marshals LldpCustomTLVState to protobuf object *otg.LldpCustomTLVState + // and doesn't set defaults + msg() *otg.LldpCustomTLVState + // setMsg unmarshals LldpCustomTLVState from protobuf object *otg.LldpCustomTLVState + // and doesn't set defaults + setMsg(*otg.LldpCustomTLVState) LldpCustomTLVState + // provides marshal interface + Marshal() marshalLldpCustomTLVState + // provides unmarshal interface + Unmarshal() unMarshalLldpCustomTLVState + // validate validates LldpCustomTLVState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LldpCustomTLVState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // CustomType returns uint32, set in LldpCustomTLVState. + CustomType() uint32 + // SetCustomType assigns uint32 provided by user to LldpCustomTLVState + SetCustomType(value uint32) LldpCustomTLVState + // HasCustomType checks if CustomType has been set in LldpCustomTLVState + HasCustomType() bool + // Oui returns string, set in LldpCustomTLVState. + Oui() string + // SetOui assigns string provided by user to LldpCustomTLVState + SetOui(value string) LldpCustomTLVState + // HasOui checks if Oui has been set in LldpCustomTLVState + HasOui() bool + // OuiSubtype returns string, set in LldpCustomTLVState. + OuiSubtype() string + // SetOuiSubtype assigns string provided by user to LldpCustomTLVState + SetOuiSubtype(value string) LldpCustomTLVState + // HasOuiSubtype checks if OuiSubtype has been set in LldpCustomTLVState + HasOuiSubtype() bool +} + +// The integer value identifying the type of information contained in the value field. +// CustomType returns a uint32 +func (obj *lldpCustomTLVState) CustomType() uint32 { + + return *obj.obj.CustomType + +} + +// The integer value identifying the type of information contained in the value field. +// CustomType returns a uint32 +func (obj *lldpCustomTLVState) HasCustomType() bool { + return obj.obj.CustomType != nil +} + +// The integer value identifying the type of information contained in the value field. +// SetCustomType sets the uint32 value in the LldpCustomTLVState object +func (obj *lldpCustomTLVState) SetCustomType(value uint32) LldpCustomTLVState { + + obj.obj.CustomType = &value + return obj +} + +// The organizationally unique identifier field shall contain the organization's OUI as defined in Clause 9 of IEEE Std 802. The high-order octet is 0 and the low-order 3 octets are the SMI Network Management Private Enterprise Code of the Vendor in network byte order, as defined in the 'Assigned Numbers' RFC [RFC3232]. +// Oui returns a string +func (obj *lldpCustomTLVState) Oui() string { + + return *obj.obj.Oui + +} + +// The organizationally unique identifier field shall contain the organization's OUI as defined in Clause 9 of IEEE Std 802. The high-order octet is 0 and the low-order 3 octets are the SMI Network Management Private Enterprise Code of the Vendor in network byte order, as defined in the 'Assigned Numbers' RFC [RFC3232]. +// Oui returns a string +func (obj *lldpCustomTLVState) HasOui() bool { + return obj.obj.Oui != nil +} + +// The organizationally unique identifier field shall contain the organization's OUI as defined in Clause 9 of IEEE Std 802. The high-order octet is 0 and the low-order 3 octets are the SMI Network Management Private Enterprise Code of the Vendor in network byte order, as defined in the 'Assigned Numbers' RFC [RFC3232]. +// SetOui sets the string value in the LldpCustomTLVState object +func (obj *lldpCustomTLVState) SetOui(value string) LldpCustomTLVState { + + obj.obj.Oui = &value + return obj +} + +// The organizationally defined subtype field shall contain a unique subtype value assigned by the defining organization. +// OuiSubtype returns a string +func (obj *lldpCustomTLVState) OuiSubtype() string { + + return *obj.obj.OuiSubtype + +} + +// The organizationally defined subtype field shall contain a unique subtype value assigned by the defining organization. +// OuiSubtype returns a string +func (obj *lldpCustomTLVState) HasOuiSubtype() bool { + return obj.obj.OuiSubtype != nil +} + +// The organizationally defined subtype field shall contain a unique subtype value assigned by the defining organization. +// SetOuiSubtype sets the string value in the LldpCustomTLVState object +func (obj *lldpCustomTLVState) SetOuiSubtype(value string) LldpCustomTLVState { + + obj.obj.OuiSubtype = &value + return obj +} + +func (obj *lldpCustomTLVState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *lldpCustomTLVState) setDefault() { + +} diff --git a/gosnappi/lldp_metric.go b/gosnappi/lldp_metric.go new file mode 100644 index 00000000..8dc519f7 --- /dev/null +++ b/gosnappi/lldp_metric.go @@ -0,0 +1,474 @@ +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" +) + +// ***** LldpMetric ***** +type lldpMetric struct { + validation + obj *otg.LldpMetric + marshaller marshalLldpMetric + unMarshaller unMarshalLldpMetric +} + +func NewLldpMetric() LldpMetric { + obj := lldpMetric{obj: &otg.LldpMetric{}} + obj.setDefault() + return &obj +} + +func (obj *lldpMetric) msg() *otg.LldpMetric { + return obj.obj +} + +func (obj *lldpMetric) setMsg(msg *otg.LldpMetric) LldpMetric { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallldpMetric struct { + obj *lldpMetric +} + +type marshalLldpMetric interface { + // ToProto marshals LldpMetric to protobuf object *otg.LldpMetric + ToProto() (*otg.LldpMetric, error) + // ToPbText marshals LldpMetric to protobuf text + ToPbText() (string, error) + // ToYaml marshals LldpMetric to YAML text + ToYaml() (string, error) + // ToJson marshals LldpMetric to JSON text + ToJson() (string, error) +} + +type unMarshallldpMetric struct { + obj *lldpMetric +} + +type unMarshalLldpMetric interface { + // FromProto unmarshals LldpMetric from protobuf object *otg.LldpMetric + FromProto(msg *otg.LldpMetric) (LldpMetric, error) + // FromPbText unmarshals LldpMetric from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LldpMetric from YAML text + FromYaml(value string) error + // FromJson unmarshals LldpMetric from JSON text + FromJson(value string) error +} + +func (obj *lldpMetric) Marshal() marshalLldpMetric { + if obj.marshaller == nil { + obj.marshaller = &marshallldpMetric{obj: obj} + } + return obj.marshaller +} + +func (obj *lldpMetric) Unmarshal() unMarshalLldpMetric { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallldpMetric{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallldpMetric) ToProto() (*otg.LldpMetric, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallldpMetric) FromProto(msg *otg.LldpMetric) (LldpMetric, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallldpMetric) 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 *unMarshallldpMetric) 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 *marshallldpMetric) 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 *unMarshallldpMetric) 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 *marshallldpMetric) 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 *unMarshallldpMetric) 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 *lldpMetric) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lldpMetric) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lldpMetric) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lldpMetric) Clone() (LldpMetric, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLldpMetric() + 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 +} + +// LldpMetric is lLDP per instance statistics information. +type LldpMetric interface { + Validation + // msg marshals LldpMetric to protobuf object *otg.LldpMetric + // and doesn't set defaults + msg() *otg.LldpMetric + // setMsg unmarshals LldpMetric from protobuf object *otg.LldpMetric + // and doesn't set defaults + setMsg(*otg.LldpMetric) LldpMetric + // provides marshal interface + Marshal() marshalLldpMetric + // provides unmarshal interface + Unmarshal() unMarshalLldpMetric + // validate validates LldpMetric + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LldpMetric, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in LldpMetric. + Name() string + // SetName assigns string provided by user to LldpMetric + SetName(value string) LldpMetric + // HasName checks if Name has been set in LldpMetric + HasName() bool + // FramesRx returns uint64, set in LldpMetric. + FramesRx() uint64 + // SetFramesRx assigns uint64 provided by user to LldpMetric + SetFramesRx(value uint64) LldpMetric + // HasFramesRx checks if FramesRx has been set in LldpMetric + HasFramesRx() bool + // FramesTx returns uint64, set in LldpMetric. + FramesTx() uint64 + // SetFramesTx assigns uint64 provided by user to LldpMetric + SetFramesTx(value uint64) LldpMetric + // HasFramesTx checks if FramesTx has been set in LldpMetric + HasFramesTx() bool + // FramesErrorRx returns uint64, set in LldpMetric. + FramesErrorRx() uint64 + // SetFramesErrorRx assigns uint64 provided by user to LldpMetric + SetFramesErrorRx(value uint64) LldpMetric + // HasFramesErrorRx checks if FramesErrorRx has been set in LldpMetric + HasFramesErrorRx() bool + // FramesDiscard returns uint64, set in LldpMetric. + FramesDiscard() uint64 + // SetFramesDiscard assigns uint64 provided by user to LldpMetric + SetFramesDiscard(value uint64) LldpMetric + // HasFramesDiscard checks if FramesDiscard has been set in LldpMetric + HasFramesDiscard() bool + // TlvsDiscard returns uint64, set in LldpMetric. + TlvsDiscard() uint64 + // SetTlvsDiscard assigns uint64 provided by user to LldpMetric + SetTlvsDiscard(value uint64) LldpMetric + // HasTlvsDiscard checks if TlvsDiscard has been set in LldpMetric + HasTlvsDiscard() bool + // TlvsUnknown returns uint64, set in LldpMetric. + TlvsUnknown() uint64 + // SetTlvsUnknown assigns uint64 provided by user to LldpMetric + SetTlvsUnknown(value uint64) LldpMetric + // HasTlvsUnknown checks if TlvsUnknown has been set in LldpMetric + HasTlvsUnknown() bool +} + +// The name of the configured LLDP instance. +// Name returns a string +func (obj *lldpMetric) Name() string { + + return *obj.obj.Name + +} + +// The name of the configured LLDP instance. +// Name returns a string +func (obj *lldpMetric) HasName() bool { + return obj.obj.Name != nil +} + +// The name of the configured LLDP instance. +// SetName sets the string value in the LldpMetric object +func (obj *lldpMetric) SetName(value string) LldpMetric { + + obj.obj.Name = &value + return obj +} + +// Number of LLDP frames received. +// FramesRx returns a uint64 +func (obj *lldpMetric) FramesRx() uint64 { + + return *obj.obj.FramesRx + +} + +// Number of LLDP frames received. +// FramesRx returns a uint64 +func (obj *lldpMetric) HasFramesRx() bool { + return obj.obj.FramesRx != nil +} + +// Number of LLDP frames received. +// SetFramesRx sets the uint64 value in the LldpMetric object +func (obj *lldpMetric) SetFramesRx(value uint64) LldpMetric { + + obj.obj.FramesRx = &value + return obj +} + +// Number of LLDP frames transmitted. +// FramesTx returns a uint64 +func (obj *lldpMetric) FramesTx() uint64 { + + return *obj.obj.FramesTx + +} + +// Number of LLDP frames transmitted. +// FramesTx returns a uint64 +func (obj *lldpMetric) HasFramesTx() bool { + return obj.obj.FramesTx != nil +} + +// Number of LLDP frames transmitted. +// SetFramesTx sets the uint64 value in the LldpMetric object +func (obj *lldpMetric) SetFramesTx(value uint64) LldpMetric { + + obj.obj.FramesTx = &value + return obj +} + +// Number of LLDP frames received with packet errors. This stat should be incremented based on statsFramesInErrorsTotal increment rule in section 10.3.2 of IEEE Std 802.1 AB-2005. +// FramesErrorRx returns a uint64 +func (obj *lldpMetric) FramesErrorRx() uint64 { + + return *obj.obj.FramesErrorRx + +} + +// Number of LLDP frames received with packet errors. This stat should be incremented based on statsFramesInErrorsTotal increment rule in section 10.3.2 of IEEE Std 802.1 AB-2005. +// FramesErrorRx returns a uint64 +func (obj *lldpMetric) HasFramesErrorRx() bool { + return obj.obj.FramesErrorRx != nil +} + +// Number of LLDP frames received with packet errors. This stat should be incremented based on statsFramesInErrorsTotal increment rule in section 10.3.2 of IEEE Std 802.1 AB-2005. +// SetFramesErrorRx sets the uint64 value in the LldpMetric object +func (obj *lldpMetric) SetFramesErrorRx(value uint64) LldpMetric { + + obj.obj.FramesErrorRx = &value + return obj +} + +// Number of LLDP frames received that are discarded. This stat should be incremented when one or more of the three mandatory TLVs at the beginning of the LLDPDU is missing, out of order or contains an out of range information string length. This stat should follow the validation rules in section 10.3.2 of IEEE Std 802.1 AB-2005. +// FramesDiscard returns a uint64 +func (obj *lldpMetric) FramesDiscard() uint64 { + + return *obj.obj.FramesDiscard + +} + +// Number of LLDP frames received that are discarded. This stat should be incremented when one or more of the three mandatory TLVs at the beginning of the LLDPDU is missing, out of order or contains an out of range information string length. This stat should follow the validation rules in section 10.3.2 of IEEE Std 802.1 AB-2005. +// FramesDiscard returns a uint64 +func (obj *lldpMetric) HasFramesDiscard() bool { + return obj.obj.FramesDiscard != nil +} + +// Number of LLDP frames received that are discarded. This stat should be incremented when one or more of the three mandatory TLVs at the beginning of the LLDPDU is missing, out of order or contains an out of range information string length. This stat should follow the validation rules in section 10.3.2 of IEEE Std 802.1 AB-2005. +// SetFramesDiscard sets the uint64 value in the LldpMetric object +func (obj *lldpMetric) SetFramesDiscard(value uint64) LldpMetric { + + obj.obj.FramesDiscard = &value + return obj +} + +// Number of LLDP tlvs received that are discarded. If any TLV contains an error condition specific for that particular TLV or if any TLV extends past the physical end of the frame then these TLVs will be discarded. +// TlvsDiscard returns a uint64 +func (obj *lldpMetric) TlvsDiscard() uint64 { + + return *obj.obj.TlvsDiscard + +} + +// Number of LLDP tlvs received that are discarded. If any TLV contains an error condition specific for that particular TLV or if any TLV extends past the physical end of the frame then these TLVs will be discarded. +// TlvsDiscard returns a uint64 +func (obj *lldpMetric) HasTlvsDiscard() bool { + return obj.obj.TlvsDiscard != nil +} + +// Number of LLDP tlvs received that are discarded. If any TLV contains an error condition specific for that particular TLV or if any TLV extends past the physical end of the frame then these TLVs will be discarded. +// SetTlvsDiscard sets the uint64 value in the LldpMetric object +func (obj *lldpMetric) SetTlvsDiscard(value uint64) LldpMetric { + + obj.obj.TlvsDiscard = &value + return obj +} + +// Number of LLDP unknown tlvs received. If the OUI of the organizationlly specific TLV and/or organizationally defined subtype are not recognized,or if TLV type value is in the range of reserved TLV types then these TLVs will be considered as unknown TLVs. +// TlvsUnknown returns a uint64 +func (obj *lldpMetric) TlvsUnknown() uint64 { + + return *obj.obj.TlvsUnknown + +} + +// Number of LLDP unknown tlvs received. If the OUI of the organizationlly specific TLV and/or organizationally defined subtype are not recognized,or if TLV type value is in the range of reserved TLV types then these TLVs will be considered as unknown TLVs. +// TlvsUnknown returns a uint64 +func (obj *lldpMetric) HasTlvsUnknown() bool { + return obj.obj.TlvsUnknown != nil +} + +// Number of LLDP unknown tlvs received. If the OUI of the organizationlly specific TLV and/or organizationally defined subtype are not recognized,or if TLV type value is in the range of reserved TLV types then these TLVs will be considered as unknown TLVs. +// SetTlvsUnknown sets the uint64 value in the LldpMetric object +func (obj *lldpMetric) SetTlvsUnknown(value uint64) LldpMetric { + + obj.obj.TlvsUnknown = &value + return obj +} + +func (obj *lldpMetric) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *lldpMetric) setDefault() { + +} diff --git a/gosnappi/lldp_metrics_request.go b/gosnappi/lldp_metrics_request.go new file mode 100644 index 00000000..c5d42d8c --- /dev/null +++ b/gosnappi/lldp_metrics_request.go @@ -0,0 +1,361 @@ +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" +) + +// ***** LldpMetricsRequest ***** +type lldpMetricsRequest struct { + validation + obj *otg.LldpMetricsRequest + marshaller marshalLldpMetricsRequest + unMarshaller unMarshalLldpMetricsRequest +} + +func NewLldpMetricsRequest() LldpMetricsRequest { + obj := lldpMetricsRequest{obj: &otg.LldpMetricsRequest{}} + obj.setDefault() + return &obj +} + +func (obj *lldpMetricsRequest) msg() *otg.LldpMetricsRequest { + return obj.obj +} + +func (obj *lldpMetricsRequest) setMsg(msg *otg.LldpMetricsRequest) LldpMetricsRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallldpMetricsRequest struct { + obj *lldpMetricsRequest +} + +type marshalLldpMetricsRequest interface { + // ToProto marshals LldpMetricsRequest to protobuf object *otg.LldpMetricsRequest + ToProto() (*otg.LldpMetricsRequest, error) + // ToPbText marshals LldpMetricsRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals LldpMetricsRequest to YAML text + ToYaml() (string, error) + // ToJson marshals LldpMetricsRequest to JSON text + ToJson() (string, error) +} + +type unMarshallldpMetricsRequest struct { + obj *lldpMetricsRequest +} + +type unMarshalLldpMetricsRequest interface { + // FromProto unmarshals LldpMetricsRequest from protobuf object *otg.LldpMetricsRequest + FromProto(msg *otg.LldpMetricsRequest) (LldpMetricsRequest, error) + // FromPbText unmarshals LldpMetricsRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LldpMetricsRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals LldpMetricsRequest from JSON text + FromJson(value string) error +} + +func (obj *lldpMetricsRequest) Marshal() marshalLldpMetricsRequest { + if obj.marshaller == nil { + obj.marshaller = &marshallldpMetricsRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *lldpMetricsRequest) Unmarshal() unMarshalLldpMetricsRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallldpMetricsRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallldpMetricsRequest) ToProto() (*otg.LldpMetricsRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallldpMetricsRequest) FromProto(msg *otg.LldpMetricsRequest) (LldpMetricsRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallldpMetricsRequest) 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 *unMarshallldpMetricsRequest) 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 *marshallldpMetricsRequest) 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 *unMarshallldpMetricsRequest) 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 *marshallldpMetricsRequest) 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 *unMarshallldpMetricsRequest) 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 *lldpMetricsRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lldpMetricsRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lldpMetricsRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lldpMetricsRequest) Clone() (LldpMetricsRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLldpMetricsRequest() + 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 +} + +// LldpMetricsRequest is the request to retrieve LLDP per instance metrics/statistics. +type LldpMetricsRequest interface { + Validation + // msg marshals LldpMetricsRequest to protobuf object *otg.LldpMetricsRequest + // and doesn't set defaults + msg() *otg.LldpMetricsRequest + // setMsg unmarshals LldpMetricsRequest from protobuf object *otg.LldpMetricsRequest + // and doesn't set defaults + setMsg(*otg.LldpMetricsRequest) LldpMetricsRequest + // provides marshal interface + Marshal() marshalLldpMetricsRequest + // provides unmarshal interface + Unmarshal() unMarshalLldpMetricsRequest + // validate validates LldpMetricsRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LldpMetricsRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // LldpNames returns []string, set in LldpMetricsRequest. + LldpNames() []string + // SetLldpNames assigns []string provided by user to LldpMetricsRequest + SetLldpNames(value []string) LldpMetricsRequest + // ColumnNames returns []LldpMetricsRequestColumnNamesEnum, set in LldpMetricsRequest + ColumnNames() []LldpMetricsRequestColumnNamesEnum + // SetColumnNames assigns []LldpMetricsRequestColumnNamesEnum provided by user to LldpMetricsRequest + SetColumnNames(value []LldpMetricsRequestColumnNamesEnum) LldpMetricsRequest +} + +// The names of LLDP instances to return results for. An empty list will return results for all LLDP instances. +// +// x-constraint: +// - /components/schemas/Lldp/properties/name +// +// x-constraint: +// - /components/schemas/Lldp/properties/name +// +// LldpNames returns a []string +func (obj *lldpMetricsRequest) LldpNames() []string { + if obj.obj.LldpNames == nil { + obj.obj.LldpNames = make([]string, 0) + } + return obj.obj.LldpNames +} + +// The names of LLDP instances to return results for. An empty list will return results for all LLDP instances. +// +// x-constraint: +// - /components/schemas/Lldp/properties/name +// +// x-constraint: +// - /components/schemas/Lldp/properties/name +// +// SetLldpNames sets the []string value in the LldpMetricsRequest object +func (obj *lldpMetricsRequest) SetLldpNames(value []string) LldpMetricsRequest { + + if obj.obj.LldpNames == nil { + obj.obj.LldpNames = make([]string, 0) + } + obj.obj.LldpNames = value + + return obj +} + +type LldpMetricsRequestColumnNamesEnum string + +// Enum of ColumnNames on LldpMetricsRequest +var LldpMetricsRequestColumnNames = struct { + FRAMES_RX LldpMetricsRequestColumnNamesEnum + FRAMES_TX LldpMetricsRequestColumnNamesEnum + FRAMES_ERROR_RX LldpMetricsRequestColumnNamesEnum + FRAMES_DISCARD LldpMetricsRequestColumnNamesEnum + TLVS_DISCARD LldpMetricsRequestColumnNamesEnum + TLVS_UNKNOWN LldpMetricsRequestColumnNamesEnum +}{ + FRAMES_RX: LldpMetricsRequestColumnNamesEnum("frames_rx"), + FRAMES_TX: LldpMetricsRequestColumnNamesEnum("frames_tx"), + FRAMES_ERROR_RX: LldpMetricsRequestColumnNamesEnum("frames_error_rx"), + FRAMES_DISCARD: LldpMetricsRequestColumnNamesEnum("frames_discard"), + TLVS_DISCARD: LldpMetricsRequestColumnNamesEnum("tlvs_discard"), + TLVS_UNKNOWN: LldpMetricsRequestColumnNamesEnum("tlvs_unknown"), +} + +func (obj *lldpMetricsRequest) ColumnNames() []LldpMetricsRequestColumnNamesEnum { + items := []LldpMetricsRequestColumnNamesEnum{} + for _, item := range obj.obj.ColumnNames { + items = append(items, LldpMetricsRequestColumnNamesEnum(item.String())) + } + return items +} + +// The requested list of column names for the result set. If the list is empty then metrics for all columns will be returned. The name of LLDP instance can not be excluded. +// SetColumnNames sets the []string value in the LldpMetricsRequest object +func (obj *lldpMetricsRequest) SetColumnNames(value []LldpMetricsRequestColumnNamesEnum) LldpMetricsRequest { + + items := []otg.LldpMetricsRequest_ColumnNames_Enum{} + for _, item := range value { + intValue := otg.LldpMetricsRequest_ColumnNames_Enum_value[string(item)] + items = append(items, otg.LldpMetricsRequest_ColumnNames_Enum(intValue)) + } + obj.obj.ColumnNames = items + return obj +} + +func (obj *lldpMetricsRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *lldpMetricsRequest) setDefault() { + +} diff --git a/gosnappi/lldp_neighbors_state.go b/gosnappi/lldp_neighbors_state.go new file mode 100644 index 00000000..44de3edc --- /dev/null +++ b/gosnappi/lldp_neighbors_state.go @@ -0,0 +1,931 @@ +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" +) + +// ***** LldpNeighborsState ***** +type lldpNeighborsState struct { + validation + obj *otg.LldpNeighborsState + marshaller marshalLldpNeighborsState + unMarshaller unMarshalLldpNeighborsState + customTlvsHolder LldpNeighborsStateLldpCustomTLVStateIter + capabilitiesHolder LldpNeighborsStateLldpCapabilityStateIter +} + +func NewLldpNeighborsState() LldpNeighborsState { + obj := lldpNeighborsState{obj: &otg.LldpNeighborsState{}} + obj.setDefault() + return &obj +} + +func (obj *lldpNeighborsState) msg() *otg.LldpNeighborsState { + return obj.obj +} + +func (obj *lldpNeighborsState) setMsg(msg *otg.LldpNeighborsState) LldpNeighborsState { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshallldpNeighborsState struct { + obj *lldpNeighborsState +} + +type marshalLldpNeighborsState interface { + // ToProto marshals LldpNeighborsState to protobuf object *otg.LldpNeighborsState + ToProto() (*otg.LldpNeighborsState, error) + // ToPbText marshals LldpNeighborsState to protobuf text + ToPbText() (string, error) + // ToYaml marshals LldpNeighborsState to YAML text + ToYaml() (string, error) + // ToJson marshals LldpNeighborsState to JSON text + ToJson() (string, error) +} + +type unMarshallldpNeighborsState struct { + obj *lldpNeighborsState +} + +type unMarshalLldpNeighborsState interface { + // FromProto unmarshals LldpNeighborsState from protobuf object *otg.LldpNeighborsState + FromProto(msg *otg.LldpNeighborsState) (LldpNeighborsState, error) + // FromPbText unmarshals LldpNeighborsState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LldpNeighborsState from YAML text + FromYaml(value string) error + // FromJson unmarshals LldpNeighborsState from JSON text + FromJson(value string) error +} + +func (obj *lldpNeighborsState) Marshal() marshalLldpNeighborsState { + if obj.marshaller == nil { + obj.marshaller = &marshallldpNeighborsState{obj: obj} + } + return obj.marshaller +} + +func (obj *lldpNeighborsState) Unmarshal() unMarshalLldpNeighborsState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallldpNeighborsState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallldpNeighborsState) ToProto() (*otg.LldpNeighborsState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallldpNeighborsState) FromProto(msg *otg.LldpNeighborsState) (LldpNeighborsState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallldpNeighborsState) 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 *unMarshallldpNeighborsState) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshallldpNeighborsState) 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 *unMarshallldpNeighborsState) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshallldpNeighborsState) 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 *unMarshallldpNeighborsState) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *lldpNeighborsState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lldpNeighborsState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lldpNeighborsState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lldpNeighborsState) Clone() (LldpNeighborsState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLldpNeighborsState() + 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 +} + +func (obj *lldpNeighborsState) setNil() { + obj.customTlvsHolder = nil + obj.capabilitiesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// LldpNeighborsState is lLDP neighbor information. +type LldpNeighborsState interface { + Validation + // msg marshals LldpNeighborsState to protobuf object *otg.LldpNeighborsState + // and doesn't set defaults + msg() *otg.LldpNeighborsState + // setMsg unmarshals LldpNeighborsState from protobuf object *otg.LldpNeighborsState + // and doesn't set defaults + setMsg(*otg.LldpNeighborsState) LldpNeighborsState + // provides marshal interface + Marshal() marshalLldpNeighborsState + // provides unmarshal interface + Unmarshal() unMarshalLldpNeighborsState + // validate validates LldpNeighborsState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LldpNeighborsState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // LldpName returns string, set in LldpNeighborsState. + LldpName() string + // SetLldpName assigns string provided by user to LldpNeighborsState + SetLldpName(value string) LldpNeighborsState + // HasLldpName checks if LldpName has been set in LldpNeighborsState + HasLldpName() bool + // SystemName returns string, set in LldpNeighborsState. + SystemName() string + // SetSystemName assigns string provided by user to LldpNeighborsState + SetSystemName(value string) LldpNeighborsState + // HasSystemName checks if SystemName has been set in LldpNeighborsState + HasSystemName() bool + // SystemDescription returns string, set in LldpNeighborsState. + SystemDescription() string + // SetSystemDescription assigns string provided by user to LldpNeighborsState + SetSystemDescription(value string) LldpNeighborsState + // HasSystemDescription checks if SystemDescription has been set in LldpNeighborsState + HasSystemDescription() bool + // ChassisId returns string, set in LldpNeighborsState. + ChassisId() string + // SetChassisId assigns string provided by user to LldpNeighborsState + SetChassisId(value string) LldpNeighborsState + // HasChassisId checks if ChassisId has been set in LldpNeighborsState + HasChassisId() bool + // ChassisIdType returns LldpNeighborsStateChassisIdTypeEnum, set in LldpNeighborsState + ChassisIdType() LldpNeighborsStateChassisIdTypeEnum + // SetChassisIdType assigns LldpNeighborsStateChassisIdTypeEnum provided by user to LldpNeighborsState + SetChassisIdType(value LldpNeighborsStateChassisIdTypeEnum) LldpNeighborsState + // HasChassisIdType checks if ChassisIdType has been set in LldpNeighborsState + HasChassisIdType() bool + // NeighborId returns string, set in LldpNeighborsState. + NeighborId() string + // SetNeighborId assigns string provided by user to LldpNeighborsState + SetNeighborId(value string) LldpNeighborsState + // HasNeighborId checks if NeighborId has been set in LldpNeighborsState + HasNeighborId() bool + // Age returns uint32, set in LldpNeighborsState. + Age() uint32 + // SetAge assigns uint32 provided by user to LldpNeighborsState + SetAge(value uint32) LldpNeighborsState + // HasAge checks if Age has been set in LldpNeighborsState + HasAge() bool + // LastUpdate returns uint32, set in LldpNeighborsState. + LastUpdate() uint32 + // SetLastUpdate assigns uint32 provided by user to LldpNeighborsState + SetLastUpdate(value uint32) LldpNeighborsState + // HasLastUpdate checks if LastUpdate has been set in LldpNeighborsState + HasLastUpdate() bool + // Ttl returns uint32, set in LldpNeighborsState. + Ttl() uint32 + // SetTtl assigns uint32 provided by user to LldpNeighborsState + SetTtl(value uint32) LldpNeighborsState + // HasTtl checks if Ttl has been set in LldpNeighborsState + HasTtl() bool + // PortId returns string, set in LldpNeighborsState. + PortId() string + // SetPortId assigns string provided by user to LldpNeighborsState + SetPortId(value string) LldpNeighborsState + // HasPortId checks if PortId has been set in LldpNeighborsState + HasPortId() bool + // PortIdType returns LldpNeighborsStatePortIdTypeEnum, set in LldpNeighborsState + PortIdType() LldpNeighborsStatePortIdTypeEnum + // SetPortIdType assigns LldpNeighborsStatePortIdTypeEnum provided by user to LldpNeighborsState + SetPortIdType(value LldpNeighborsStatePortIdTypeEnum) LldpNeighborsState + // HasPortIdType checks if PortIdType has been set in LldpNeighborsState + HasPortIdType() bool + // PortDescription returns string, set in LldpNeighborsState. + PortDescription() string + // SetPortDescription assigns string provided by user to LldpNeighborsState + SetPortDescription(value string) LldpNeighborsState + // HasPortDescription checks if PortDescription has been set in LldpNeighborsState + HasPortDescription() bool + // ManagementAddress returns string, set in LldpNeighborsState. + ManagementAddress() string + // SetManagementAddress assigns string provided by user to LldpNeighborsState + SetManagementAddress(value string) LldpNeighborsState + // HasManagementAddress checks if ManagementAddress has been set in LldpNeighborsState + HasManagementAddress() bool + // ManagementAddressType returns string, set in LldpNeighborsState. + ManagementAddressType() string + // SetManagementAddressType assigns string provided by user to LldpNeighborsState + SetManagementAddressType(value string) LldpNeighborsState + // HasManagementAddressType checks if ManagementAddressType has been set in LldpNeighborsState + HasManagementAddressType() bool + // CustomTlvs returns LldpNeighborsStateLldpCustomTLVStateIterIter, set in LldpNeighborsState + CustomTlvs() LldpNeighborsStateLldpCustomTLVStateIter + // Capabilities returns LldpNeighborsStateLldpCapabilityStateIterIter, set in LldpNeighborsState + Capabilities() LldpNeighborsStateLldpCapabilityStateIter + setNil() +} + +// The name of the LLDP instance. +// LldpName returns a string +func (obj *lldpNeighborsState) LldpName() string { + + return *obj.obj.LldpName + +} + +// The name of the LLDP instance. +// LldpName returns a string +func (obj *lldpNeighborsState) HasLldpName() bool { + return obj.obj.LldpName != nil +} + +// The name of the LLDP instance. +// SetLldpName sets the string value in the LldpNeighborsState object +func (obj *lldpNeighborsState) SetLldpName(value string) LldpNeighborsState { + + obj.obj.LldpName = &value + return obj +} + +// The system name field shall contain an alpha-numeric string that indicates the system's administratively assigned name. The system name should be the system's fully qualified domain name. If implementations support IETF RFC 3418, the sysName object should be used for this field. +// SystemName returns a string +func (obj *lldpNeighborsState) SystemName() string { + + return *obj.obj.SystemName + +} + +// The system name field shall contain an alpha-numeric string that indicates the system's administratively assigned name. The system name should be the system's fully qualified domain name. If implementations support IETF RFC 3418, the sysName object should be used for this field. +// SystemName returns a string +func (obj *lldpNeighborsState) HasSystemName() bool { + return obj.obj.SystemName != nil +} + +// The system name field shall contain an alpha-numeric string that indicates the system's administratively assigned name. The system name should be the system's fully qualified domain name. If implementations support IETF RFC 3418, the sysName object should be used for this field. +// SetSystemName sets the string value in the LldpNeighborsState object +func (obj *lldpNeighborsState) SetSystemName(value string) LldpNeighborsState { + + obj.obj.SystemName = &value + return obj +} + +// The system description field shall contain an alpha-numeric string that is the textual description of the network entity. The system description should include the full name and version identification of the system's hardware type, software operating system, and networking software. If implementations support IETF RFC 3418, the sysDescr object should be used for this field. +// SystemDescription returns a string +func (obj *lldpNeighborsState) SystemDescription() string { + + return *obj.obj.SystemDescription + +} + +// The system description field shall contain an alpha-numeric string that is the textual description of the network entity. The system description should include the full name and version identification of the system's hardware type, software operating system, and networking software. If implementations support IETF RFC 3418, the sysDescr object should be used for this field. +// SystemDescription returns a string +func (obj *lldpNeighborsState) HasSystemDescription() bool { + return obj.obj.SystemDescription != nil +} + +// The system description field shall contain an alpha-numeric string that is the textual description of the network entity. The system description should include the full name and version identification of the system's hardware type, software operating system, and networking software. If implementations support IETF RFC 3418, the sysDescr object should be used for this field. +// SetSystemDescription sets the string value in the LldpNeighborsState object +func (obj *lldpNeighborsState) SetSystemDescription(value string) LldpNeighborsState { + + obj.obj.SystemDescription = &value + return obj +} + +// The Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. +// ChassisId returns a string +func (obj *lldpNeighborsState) ChassisId() string { + + return *obj.obj.ChassisId + +} + +// The Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. +// ChassisId returns a string +func (obj *lldpNeighborsState) HasChassisId() bool { + return obj.obj.ChassisId != nil +} + +// The Chassis ID is a mandatory TLV which identifies the chassis component of the endpoint identifier associated with the transmitting LLDP agent. +// SetChassisId sets the string value in the LldpNeighborsState object +func (obj *lldpNeighborsState) SetChassisId(value string) LldpNeighborsState { + + obj.obj.ChassisId = &value + return obj +} + +type LldpNeighborsStateChassisIdTypeEnum string + +// Enum of ChassisIdType on LldpNeighborsState +var LldpNeighborsStateChassisIdType = struct { + PORT_COMPONENT LldpNeighborsStateChassisIdTypeEnum + NETWORK_ADDRESS LldpNeighborsStateChassisIdTypeEnum + CHASSIS_COMPONENT LldpNeighborsStateChassisIdTypeEnum + MAC_ADDRESS LldpNeighborsStateChassisIdTypeEnum + INTERFACE_NAME LldpNeighborsStateChassisIdTypeEnum + LOCAL LldpNeighborsStateChassisIdTypeEnum + INTERFACE_ALIAS LldpNeighborsStateChassisIdTypeEnum +}{ + PORT_COMPONENT: LldpNeighborsStateChassisIdTypeEnum("port_component"), + NETWORK_ADDRESS: LldpNeighborsStateChassisIdTypeEnum("network_address"), + CHASSIS_COMPONENT: LldpNeighborsStateChassisIdTypeEnum("chassis_component"), + MAC_ADDRESS: LldpNeighborsStateChassisIdTypeEnum("mac_address"), + INTERFACE_NAME: LldpNeighborsStateChassisIdTypeEnum("interface_name"), + LOCAL: LldpNeighborsStateChassisIdTypeEnum("local"), + INTERFACE_ALIAS: LldpNeighborsStateChassisIdTypeEnum("interface_alias"), +} + +func (obj *lldpNeighborsState) ChassisIdType() LldpNeighborsStateChassisIdTypeEnum { + return LldpNeighborsStateChassisIdTypeEnum(obj.obj.ChassisIdType.Enum().String()) +} + +// This field identifies the format and source of the chassis identifier string. It is an enumerator defined by the LldpChassisIdSubtype object from IEEE 802.1AB MIB. +// ChassisIdType returns a string +func (obj *lldpNeighborsState) HasChassisIdType() bool { + return obj.obj.ChassisIdType != nil +} + +func (obj *lldpNeighborsState) SetChassisIdType(value LldpNeighborsStateChassisIdTypeEnum) LldpNeighborsState { + intValue, ok := otg.LldpNeighborsState_ChassisIdType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LldpNeighborsStateChassisIdTypeEnum", string(value))) + return obj + } + enumValue := otg.LldpNeighborsState_ChassisIdType_Enum(intValue) + obj.obj.ChassisIdType = &enumValue + + return obj +} + +// System generated identifier for the neighbor on the LLDP instance. +// NeighborId returns a string +func (obj *lldpNeighborsState) NeighborId() string { + + return *obj.obj.NeighborId + +} + +// System generated identifier for the neighbor on the LLDP instance. +// NeighborId returns a string +func (obj *lldpNeighborsState) HasNeighborId() bool { + return obj.obj.NeighborId != nil +} + +// System generated identifier for the neighbor on the LLDP instance. +// SetNeighborId sets the string value in the LldpNeighborsState object +func (obj *lldpNeighborsState) SetNeighborId(value string) LldpNeighborsState { + + obj.obj.NeighborId = &value + return obj +} + +// Age since discovery in seconds. +// Age returns a uint32 +func (obj *lldpNeighborsState) Age() uint32 { + + return *obj.obj.Age + +} + +// Age since discovery in seconds. +// Age returns a uint32 +func (obj *lldpNeighborsState) HasAge() bool { + return obj.obj.Age != nil +} + +// Age since discovery in seconds. +// SetAge sets the uint32 value in the LldpNeighborsState object +func (obj *lldpNeighborsState) SetAge(value uint32) LldpNeighborsState { + + obj.obj.Age = &value + return obj +} + +// Seconds since last update received. +// LastUpdate returns a uint32 +func (obj *lldpNeighborsState) LastUpdate() uint32 { + + return *obj.obj.LastUpdate + +} + +// Seconds since last update received. +// LastUpdate returns a uint32 +func (obj *lldpNeighborsState) HasLastUpdate() bool { + return obj.obj.LastUpdate != nil +} + +// Seconds since last update received. +// SetLastUpdate sets the uint32 value in the LldpNeighborsState object +func (obj *lldpNeighborsState) SetLastUpdate(value uint32) LldpNeighborsState { + + obj.obj.LastUpdate = &value + return obj +} + +// The time-to-live (TTL) in seconds is a mandatory TLV which indicates how long information from the neighbor should be considered valid. +// Ttl returns a uint32 +func (obj *lldpNeighborsState) Ttl() uint32 { + + return *obj.obj.Ttl + +} + +// The time-to-live (TTL) in seconds is a mandatory TLV which indicates how long information from the neighbor should be considered valid. +// Ttl returns a uint32 +func (obj *lldpNeighborsState) HasTtl() bool { + return obj.obj.Ttl != nil +} + +// The time-to-live (TTL) in seconds is a mandatory TLV which indicates how long information from the neighbor should be considered valid. +// SetTtl sets the uint32 value in the LldpNeighborsState object +func (obj *lldpNeighborsState) SetTtl(value uint32) LldpNeighborsState { + + obj.obj.Ttl = &value + return obj +} + +// The Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent. If the specified port is an IEEE 802.3 Repeater port, then this TLV is optional. +// PortId returns a string +func (obj *lldpNeighborsState) PortId() string { + + return *obj.obj.PortId + +} + +// The Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent. If the specified port is an IEEE 802.3 Repeater port, then this TLV is optional. +// PortId returns a string +func (obj *lldpNeighborsState) HasPortId() bool { + return obj.obj.PortId != nil +} + +// The Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent. If the specified port is an IEEE 802.3 Repeater port, then this TLV is optional. +// SetPortId sets the string value in the LldpNeighborsState object +func (obj *lldpNeighborsState) SetPortId(value string) LldpNeighborsState { + + obj.obj.PortId = &value + return obj +} + +type LldpNeighborsStatePortIdTypeEnum string + +// Enum of PortIdType on LldpNeighborsState +var LldpNeighborsStatePortIdType = struct { + PORT_COMPONENT LldpNeighborsStatePortIdTypeEnum + NETWORK_ADDRESS LldpNeighborsStatePortIdTypeEnum + AGENT_CIRCUIT_ID LldpNeighborsStatePortIdTypeEnum + MAC_ADDRESS LldpNeighborsStatePortIdTypeEnum + INTERFACE_NAME LldpNeighborsStatePortIdTypeEnum + LOCAL LldpNeighborsStatePortIdTypeEnum + INTERFACE_ALIAS LldpNeighborsStatePortIdTypeEnum +}{ + PORT_COMPONENT: LldpNeighborsStatePortIdTypeEnum("port_component"), + NETWORK_ADDRESS: LldpNeighborsStatePortIdTypeEnum("network_address"), + AGENT_CIRCUIT_ID: LldpNeighborsStatePortIdTypeEnum("agent_circuit_id"), + MAC_ADDRESS: LldpNeighborsStatePortIdTypeEnum("mac_address"), + INTERFACE_NAME: LldpNeighborsStatePortIdTypeEnum("interface_name"), + LOCAL: LldpNeighborsStatePortIdTypeEnum("local"), + INTERFACE_ALIAS: LldpNeighborsStatePortIdTypeEnum("interface_alias"), +} + +func (obj *lldpNeighborsState) PortIdType() LldpNeighborsStatePortIdTypeEnum { + return LldpNeighborsStatePortIdTypeEnum(obj.obj.PortIdType.Enum().String()) +} + +// This field identifies the format and source of the port identifier string. It is an enumerator defined by the PtopoPortIdType object from RFC2922. +// PortIdType returns a string +func (obj *lldpNeighborsState) HasPortIdType() bool { + return obj.obj.PortIdType != nil +} + +func (obj *lldpNeighborsState) SetPortIdType(value LldpNeighborsStatePortIdTypeEnum) LldpNeighborsState { + intValue, ok := otg.LldpNeighborsState_PortIdType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LldpNeighborsStatePortIdTypeEnum", string(value))) + return obj + } + enumValue := otg.LldpNeighborsState_PortIdType_Enum(intValue) + obj.obj.PortIdType = &enumValue + + return obj +} + +// The binary string containing the actual port identifier for the port which this LLDP PDU was transmitted. The source and format of this field is defined by PtopoPortId from RFC2922. +// PortDescription returns a string +func (obj *lldpNeighborsState) PortDescription() string { + + return *obj.obj.PortDescription + +} + +// The binary string containing the actual port identifier for the port which this LLDP PDU was transmitted. The source and format of this field is defined by PtopoPortId from RFC2922. +// PortDescription returns a string +func (obj *lldpNeighborsState) HasPortDescription() bool { + return obj.obj.PortDescription != nil +} + +// The binary string containing the actual port identifier for the port which this LLDP PDU was transmitted. The source and format of this field is defined by PtopoPortId from RFC2922. +// SetPortDescription sets the string value in the LldpNeighborsState object +func (obj *lldpNeighborsState) SetPortDescription(value string) LldpNeighborsState { + + obj.obj.PortDescription = &value + return obj +} + +// The Management Address is a mandatory TLV which identifies a network address associated with the local LLDP agent, which can be used to reach the agent on the port identified in the Port ID TLV. +// ManagementAddress returns a string +func (obj *lldpNeighborsState) ManagementAddress() string { + + return *obj.obj.ManagementAddress + +} + +// The Management Address is a mandatory TLV which identifies a network address associated with the local LLDP agent, which can be used to reach the agent on the port identified in the Port ID TLV. +// ManagementAddress returns a string +func (obj *lldpNeighborsState) HasManagementAddress() bool { + return obj.obj.ManagementAddress != nil +} + +// The Management Address is a mandatory TLV which identifies a network address associated with the local LLDP agent, which can be used to reach the agent on the port identified in the Port ID TLV. +// SetManagementAddress sets the string value in the LldpNeighborsState object +func (obj *lldpNeighborsState) SetManagementAddress(value string) LldpNeighborsState { + + obj.obj.ManagementAddress = &value + return obj +} + +// The enumerated value for the network address type identified in this TLV. This enumeration is defined in the 'Assigned Numbers' RFC [RFC3232] and the ianaAddressFamilyNumbers object. +// ManagementAddressType returns a string +func (obj *lldpNeighborsState) ManagementAddressType() string { + + return *obj.obj.ManagementAddressType + +} + +// The enumerated value for the network address type identified in this TLV. This enumeration is defined in the 'Assigned Numbers' RFC [RFC3232] and the ianaAddressFamilyNumbers object. +// ManagementAddressType returns a string +func (obj *lldpNeighborsState) HasManagementAddressType() bool { + return obj.obj.ManagementAddressType != nil +} + +// The enumerated value for the network address type identified in this TLV. This enumeration is defined in the 'Assigned Numbers' RFC [RFC3232] and the ianaAddressFamilyNumbers object. +// SetManagementAddressType sets the string value in the LldpNeighborsState object +func (obj *lldpNeighborsState) SetManagementAddressType(value string) LldpNeighborsState { + + obj.obj.ManagementAddressType = &value + return obj +} + +// description is TBD +// CustomTlvs returns a []LldpCustomTLVState +func (obj *lldpNeighborsState) CustomTlvs() LldpNeighborsStateLldpCustomTLVStateIter { + if len(obj.obj.CustomTlvs) == 0 { + obj.obj.CustomTlvs = []*otg.LldpCustomTLVState{} + } + if obj.customTlvsHolder == nil { + obj.customTlvsHolder = newLldpNeighborsStateLldpCustomTLVStateIter(&obj.obj.CustomTlvs).setMsg(obj) + } + return obj.customTlvsHolder +} + +type lldpNeighborsStateLldpCustomTLVStateIter struct { + obj *lldpNeighborsState + lldpCustomTLVStateSlice []LldpCustomTLVState + fieldPtr *[]*otg.LldpCustomTLVState +} + +func newLldpNeighborsStateLldpCustomTLVStateIter(ptr *[]*otg.LldpCustomTLVState) LldpNeighborsStateLldpCustomTLVStateIter { + return &lldpNeighborsStateLldpCustomTLVStateIter{fieldPtr: ptr} +} + +type LldpNeighborsStateLldpCustomTLVStateIter interface { + setMsg(*lldpNeighborsState) LldpNeighborsStateLldpCustomTLVStateIter + Items() []LldpCustomTLVState + Add() LldpCustomTLVState + Append(items ...LldpCustomTLVState) LldpNeighborsStateLldpCustomTLVStateIter + Set(index int, newObj LldpCustomTLVState) LldpNeighborsStateLldpCustomTLVStateIter + Clear() LldpNeighborsStateLldpCustomTLVStateIter + clearHolderSlice() LldpNeighborsStateLldpCustomTLVStateIter + appendHolderSlice(item LldpCustomTLVState) LldpNeighborsStateLldpCustomTLVStateIter +} + +func (obj *lldpNeighborsStateLldpCustomTLVStateIter) setMsg(msg *lldpNeighborsState) LldpNeighborsStateLldpCustomTLVStateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&lldpCustomTLVState{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *lldpNeighborsStateLldpCustomTLVStateIter) Items() []LldpCustomTLVState { + return obj.lldpCustomTLVStateSlice +} + +func (obj *lldpNeighborsStateLldpCustomTLVStateIter) Add() LldpCustomTLVState { + newObj := &otg.LldpCustomTLVState{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &lldpCustomTLVState{obj: newObj} + newLibObj.setDefault() + obj.lldpCustomTLVStateSlice = append(obj.lldpCustomTLVStateSlice, newLibObj) + return newLibObj +} + +func (obj *lldpNeighborsStateLldpCustomTLVStateIter) Append(items ...LldpCustomTLVState) LldpNeighborsStateLldpCustomTLVStateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.lldpCustomTLVStateSlice = append(obj.lldpCustomTLVStateSlice, item) + } + return obj +} + +func (obj *lldpNeighborsStateLldpCustomTLVStateIter) Set(index int, newObj LldpCustomTLVState) LldpNeighborsStateLldpCustomTLVStateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.lldpCustomTLVStateSlice[index] = newObj + return obj +} +func (obj *lldpNeighborsStateLldpCustomTLVStateIter) Clear() LldpNeighborsStateLldpCustomTLVStateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.LldpCustomTLVState{} + obj.lldpCustomTLVStateSlice = []LldpCustomTLVState{} + } + return obj +} +func (obj *lldpNeighborsStateLldpCustomTLVStateIter) clearHolderSlice() LldpNeighborsStateLldpCustomTLVStateIter { + if len(obj.lldpCustomTLVStateSlice) > 0 { + obj.lldpCustomTLVStateSlice = []LldpCustomTLVState{} + } + return obj +} +func (obj *lldpNeighborsStateLldpCustomTLVStateIter) appendHolderSlice(item LldpCustomTLVState) LldpNeighborsStateLldpCustomTLVStateIter { + obj.lldpCustomTLVStateSlice = append(obj.lldpCustomTLVStateSlice, item) + return obj +} + +// description is TBD +// Capabilities returns a []LldpCapabilityState +func (obj *lldpNeighborsState) Capabilities() LldpNeighborsStateLldpCapabilityStateIter { + if len(obj.obj.Capabilities) == 0 { + obj.obj.Capabilities = []*otg.LldpCapabilityState{} + } + if obj.capabilitiesHolder == nil { + obj.capabilitiesHolder = newLldpNeighborsStateLldpCapabilityStateIter(&obj.obj.Capabilities).setMsg(obj) + } + return obj.capabilitiesHolder +} + +type lldpNeighborsStateLldpCapabilityStateIter struct { + obj *lldpNeighborsState + lldpCapabilityStateSlice []LldpCapabilityState + fieldPtr *[]*otg.LldpCapabilityState +} + +func newLldpNeighborsStateLldpCapabilityStateIter(ptr *[]*otg.LldpCapabilityState) LldpNeighborsStateLldpCapabilityStateIter { + return &lldpNeighborsStateLldpCapabilityStateIter{fieldPtr: ptr} +} + +type LldpNeighborsStateLldpCapabilityStateIter interface { + setMsg(*lldpNeighborsState) LldpNeighborsStateLldpCapabilityStateIter + Items() []LldpCapabilityState + Add() LldpCapabilityState + Append(items ...LldpCapabilityState) LldpNeighborsStateLldpCapabilityStateIter + Set(index int, newObj LldpCapabilityState) LldpNeighborsStateLldpCapabilityStateIter + Clear() LldpNeighborsStateLldpCapabilityStateIter + clearHolderSlice() LldpNeighborsStateLldpCapabilityStateIter + appendHolderSlice(item LldpCapabilityState) LldpNeighborsStateLldpCapabilityStateIter +} + +func (obj *lldpNeighborsStateLldpCapabilityStateIter) setMsg(msg *lldpNeighborsState) LldpNeighborsStateLldpCapabilityStateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&lldpCapabilityState{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *lldpNeighborsStateLldpCapabilityStateIter) Items() []LldpCapabilityState { + return obj.lldpCapabilityStateSlice +} + +func (obj *lldpNeighborsStateLldpCapabilityStateIter) Add() LldpCapabilityState { + newObj := &otg.LldpCapabilityState{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &lldpCapabilityState{obj: newObj} + newLibObj.setDefault() + obj.lldpCapabilityStateSlice = append(obj.lldpCapabilityStateSlice, newLibObj) + return newLibObj +} + +func (obj *lldpNeighborsStateLldpCapabilityStateIter) Append(items ...LldpCapabilityState) LldpNeighborsStateLldpCapabilityStateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.lldpCapabilityStateSlice = append(obj.lldpCapabilityStateSlice, item) + } + return obj +} + +func (obj *lldpNeighborsStateLldpCapabilityStateIter) Set(index int, newObj LldpCapabilityState) LldpNeighborsStateLldpCapabilityStateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.lldpCapabilityStateSlice[index] = newObj + return obj +} +func (obj *lldpNeighborsStateLldpCapabilityStateIter) Clear() LldpNeighborsStateLldpCapabilityStateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.LldpCapabilityState{} + obj.lldpCapabilityStateSlice = []LldpCapabilityState{} + } + return obj +} +func (obj *lldpNeighborsStateLldpCapabilityStateIter) clearHolderSlice() LldpNeighborsStateLldpCapabilityStateIter { + if len(obj.lldpCapabilityStateSlice) > 0 { + obj.lldpCapabilityStateSlice = []LldpCapabilityState{} + } + return obj +} +func (obj *lldpNeighborsStateLldpCapabilityStateIter) appendHolderSlice(item LldpCapabilityState) LldpNeighborsStateLldpCapabilityStateIter { + obj.lldpCapabilityStateSlice = append(obj.lldpCapabilityStateSlice, item) + return obj +} + +func (obj *lldpNeighborsState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.CustomTlvs) != 0 { + + if set_default { + obj.CustomTlvs().clearHolderSlice() + for _, item := range obj.obj.CustomTlvs { + obj.CustomTlvs().appendHolderSlice(&lldpCustomTLVState{obj: item}) + } + } + for _, item := range obj.CustomTlvs().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Capabilities) != 0 { + + if set_default { + obj.Capabilities().clearHolderSlice() + for _, item := range obj.obj.Capabilities { + obj.Capabilities().appendHolderSlice(&lldpCapabilityState{obj: item}) + } + } + for _, item := range obj.Capabilities().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *lldpNeighborsState) setDefault() { + +} diff --git a/gosnappi/lldp_neighbors_state_request.go b/gosnappi/lldp_neighbors_state_request.go new file mode 100644 index 00000000..87eb348a --- /dev/null +++ b/gosnappi/lldp_neighbors_state_request.go @@ -0,0 +1,342 @@ +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" +) + +// ***** LldpNeighborsStateRequest ***** +type lldpNeighborsStateRequest struct { + validation + obj *otg.LldpNeighborsStateRequest + marshaller marshalLldpNeighborsStateRequest + unMarshaller unMarshalLldpNeighborsStateRequest +} + +func NewLldpNeighborsStateRequest() LldpNeighborsStateRequest { + obj := lldpNeighborsStateRequest{obj: &otg.LldpNeighborsStateRequest{}} + obj.setDefault() + return &obj +} + +func (obj *lldpNeighborsStateRequest) msg() *otg.LldpNeighborsStateRequest { + return obj.obj +} + +func (obj *lldpNeighborsStateRequest) setMsg(msg *otg.LldpNeighborsStateRequest) LldpNeighborsStateRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallldpNeighborsStateRequest struct { + obj *lldpNeighborsStateRequest +} + +type marshalLldpNeighborsStateRequest interface { + // ToProto marshals LldpNeighborsStateRequest to protobuf object *otg.LldpNeighborsStateRequest + ToProto() (*otg.LldpNeighborsStateRequest, error) + // ToPbText marshals LldpNeighborsStateRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals LldpNeighborsStateRequest to YAML text + ToYaml() (string, error) + // ToJson marshals LldpNeighborsStateRequest to JSON text + ToJson() (string, error) +} + +type unMarshallldpNeighborsStateRequest struct { + obj *lldpNeighborsStateRequest +} + +type unMarshalLldpNeighborsStateRequest interface { + // FromProto unmarshals LldpNeighborsStateRequest from protobuf object *otg.LldpNeighborsStateRequest + FromProto(msg *otg.LldpNeighborsStateRequest) (LldpNeighborsStateRequest, error) + // FromPbText unmarshals LldpNeighborsStateRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LldpNeighborsStateRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals LldpNeighborsStateRequest from JSON text + FromJson(value string) error +} + +func (obj *lldpNeighborsStateRequest) Marshal() marshalLldpNeighborsStateRequest { + if obj.marshaller == nil { + obj.marshaller = &marshallldpNeighborsStateRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *lldpNeighborsStateRequest) Unmarshal() unMarshalLldpNeighborsStateRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallldpNeighborsStateRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallldpNeighborsStateRequest) ToProto() (*otg.LldpNeighborsStateRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallldpNeighborsStateRequest) FromProto(msg *otg.LldpNeighborsStateRequest) (LldpNeighborsStateRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallldpNeighborsStateRequest) 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 *unMarshallldpNeighborsStateRequest) 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 *marshallldpNeighborsStateRequest) 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 *unMarshallldpNeighborsStateRequest) 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 *marshallldpNeighborsStateRequest) 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 *unMarshallldpNeighborsStateRequest) 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 *lldpNeighborsStateRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lldpNeighborsStateRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lldpNeighborsStateRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lldpNeighborsStateRequest) Clone() (LldpNeighborsStateRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLldpNeighborsStateRequest() + 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 +} + +// LldpNeighborsStateRequest is the request to retrieve LLDP neighbor information for a given instance. +type LldpNeighborsStateRequest interface { + Validation + // msg marshals LldpNeighborsStateRequest to protobuf object *otg.LldpNeighborsStateRequest + // and doesn't set defaults + msg() *otg.LldpNeighborsStateRequest + // setMsg unmarshals LldpNeighborsStateRequest from protobuf object *otg.LldpNeighborsStateRequest + // and doesn't set defaults + setMsg(*otg.LldpNeighborsStateRequest) LldpNeighborsStateRequest + // provides marshal interface + Marshal() marshalLldpNeighborsStateRequest + // provides unmarshal interface + Unmarshal() unMarshalLldpNeighborsStateRequest + // validate validates LldpNeighborsStateRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LldpNeighborsStateRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // LldpNames returns []string, set in LldpNeighborsStateRequest. + LldpNames() []string + // SetLldpNames assigns []string provided by user to LldpNeighborsStateRequest + SetLldpNames(value []string) LldpNeighborsStateRequest + // NeighborIdFilters returns []string, set in LldpNeighborsStateRequest. + NeighborIdFilters() []string + // SetNeighborIdFilters assigns []string provided by user to LldpNeighborsStateRequest + SetNeighborIdFilters(value []string) LldpNeighborsStateRequest +} + +// The names of LLDP instances for which neighbor information will be retrieved. If no names are specified then the results will contain neighbor information for all configured LLDP instances. +// +// x-constraint: +// - /components/schemas/Lldp/properties/name +// +// x-constraint: +// - /components/schemas/Lldp/properties/name +// +// LldpNames returns a []string +func (obj *lldpNeighborsStateRequest) LldpNames() []string { + if obj.obj.LldpNames == nil { + obj.obj.LldpNames = make([]string, 0) + } + return obj.obj.LldpNames +} + +// The names of LLDP instances for which neighbor information will be retrieved. If no names are specified then the results will contain neighbor information for all configured LLDP instances. +// +// x-constraint: +// - /components/schemas/Lldp/properties/name +// +// x-constraint: +// - /components/schemas/Lldp/properties/name +// +// SetLldpNames sets the []string value in the LldpNeighborsStateRequest object +func (obj *lldpNeighborsStateRequest) SetLldpNames(value []string) LldpNeighborsStateRequest { + + if obj.obj.LldpNames == nil { + obj.obj.LldpNames = make([]string, 0) + } + obj.obj.LldpNames = value + + return obj +} + +// Specify the neighbors for which information will be returned. If empty or missing then information for all neighbors will be returned. +// NeighborIdFilters returns a []string +func (obj *lldpNeighborsStateRequest) NeighborIdFilters() []string { + if obj.obj.NeighborIdFilters == nil { + obj.obj.NeighborIdFilters = make([]string, 0) + } + return obj.obj.NeighborIdFilters +} + +// Specify the neighbors for which information will be returned. If empty or missing then information for all neighbors will be returned. +// SetNeighborIdFilters sets the []string value in the LldpNeighborsStateRequest object +func (obj *lldpNeighborsStateRequest) SetNeighborIdFilters(value []string) LldpNeighborsStateRequest { + + if obj.obj.NeighborIdFilters == nil { + obj.obj.NeighborIdFilters = make([]string, 0) + } + obj.obj.NeighborIdFilters = value + + return obj +} + +func (obj *lldpNeighborsStateRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *lldpNeighborsStateRequest) setDefault() { + +} diff --git a/gosnappi/lldp_port_id.go b/gosnappi/lldp_port_id.go new file mode 100644 index 00000000..e9a7bb3e --- /dev/null +++ b/gosnappi/lldp_port_id.go @@ -0,0 +1,476 @@ +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" +) + +// ***** LldpPortId ***** +type lldpPortId struct { + validation + obj *otg.LldpPortId + marshaller marshalLldpPortId + unMarshaller unMarshalLldpPortId + interfaceNameSubtypeHolder LldpPortInterfaceNameSubType +} + +func NewLldpPortId() LldpPortId { + obj := lldpPortId{obj: &otg.LldpPortId{}} + obj.setDefault() + return &obj +} + +func (obj *lldpPortId) msg() *otg.LldpPortId { + return obj.obj +} + +func (obj *lldpPortId) setMsg(msg *otg.LldpPortId) LldpPortId { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshallldpPortId struct { + obj *lldpPortId +} + +type marshalLldpPortId interface { + // ToProto marshals LldpPortId to protobuf object *otg.LldpPortId + ToProto() (*otg.LldpPortId, error) + // ToPbText marshals LldpPortId to protobuf text + ToPbText() (string, error) + // ToYaml marshals LldpPortId to YAML text + ToYaml() (string, error) + // ToJson marshals LldpPortId to JSON text + ToJson() (string, error) +} + +type unMarshallldpPortId struct { + obj *lldpPortId +} + +type unMarshalLldpPortId interface { + // FromProto unmarshals LldpPortId from protobuf object *otg.LldpPortId + FromProto(msg *otg.LldpPortId) (LldpPortId, error) + // FromPbText unmarshals LldpPortId from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LldpPortId from YAML text + FromYaml(value string) error + // FromJson unmarshals LldpPortId from JSON text + FromJson(value string) error +} + +func (obj *lldpPortId) Marshal() marshalLldpPortId { + if obj.marshaller == nil { + obj.marshaller = &marshallldpPortId{obj: obj} + } + return obj.marshaller +} + +func (obj *lldpPortId) Unmarshal() unMarshalLldpPortId { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallldpPortId{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallldpPortId) ToProto() (*otg.LldpPortId, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallldpPortId) FromProto(msg *otg.LldpPortId) (LldpPortId, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallldpPortId) 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 *unMarshallldpPortId) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshallldpPortId) 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 *unMarshallldpPortId) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshallldpPortId) 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 *unMarshallldpPortId) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *lldpPortId) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lldpPortId) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lldpPortId) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lldpPortId) Clone() (LldpPortId, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLldpPortId() + 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 +} + +func (obj *lldpPortId) setNil() { + obj.interfaceNameSubtypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// LldpPortId is the Port ID is a mandatory TLV which identifies the port component of the endpoint identifier associated with the transmitting LLDP agent.This field identifies the format and source of the port identifier string. It is based on the enumerator defined by the PtopoPortIdType object from RFC2922. +type LldpPortId interface { + Validation + // msg marshals LldpPortId to protobuf object *otg.LldpPortId + // and doesn't set defaults + msg() *otg.LldpPortId + // setMsg unmarshals LldpPortId from protobuf object *otg.LldpPortId + // and doesn't set defaults + setMsg(*otg.LldpPortId) LldpPortId + // provides marshal interface + Marshal() marshalLldpPortId + // provides unmarshal interface + Unmarshal() unMarshalLldpPortId + // validate validates LldpPortId + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LldpPortId, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns LldpPortIdChoiceEnum, set in LldpPortId + Choice() LldpPortIdChoiceEnum + // setChoice assigns LldpPortIdChoiceEnum provided by user to LldpPortId + setChoice(value LldpPortIdChoiceEnum) LldpPortId + // HasChoice checks if Choice has been set in LldpPortId + HasChoice() bool + // MacAddressSubtype returns string, set in LldpPortId. + MacAddressSubtype() string + // SetMacAddressSubtype assigns string provided by user to LldpPortId + SetMacAddressSubtype(value string) LldpPortId + // HasMacAddressSubtype checks if MacAddressSubtype has been set in LldpPortId + HasMacAddressSubtype() bool + // InterfaceNameSubtype returns LldpPortInterfaceNameSubType, set in LldpPortId. + // LldpPortInterfaceNameSubType is the interface name configured in the Port ID TLV. + InterfaceNameSubtype() LldpPortInterfaceNameSubType + // SetInterfaceNameSubtype assigns LldpPortInterfaceNameSubType provided by user to LldpPortId. + // LldpPortInterfaceNameSubType is the interface name configured in the Port ID TLV. + SetInterfaceNameSubtype(value LldpPortInterfaceNameSubType) LldpPortId + // HasInterfaceNameSubtype checks if InterfaceNameSubtype has been set in LldpPortId + HasInterfaceNameSubtype() bool + // LocalSubtype returns string, set in LldpPortId. + LocalSubtype() string + // SetLocalSubtype assigns string provided by user to LldpPortId + SetLocalSubtype(value string) LldpPortId + // HasLocalSubtype checks if LocalSubtype has been set in LldpPortId + HasLocalSubtype() bool + setNil() +} + +type LldpPortIdChoiceEnum string + +// Enum of Choice on LldpPortId +var LldpPortIdChoice = struct { + MAC_ADDRESS_SUBTYPE LldpPortIdChoiceEnum + INTERFACE_NAME_SUBTYPE LldpPortIdChoiceEnum + LOCAL_SUBTYPE LldpPortIdChoiceEnum +}{ + MAC_ADDRESS_SUBTYPE: LldpPortIdChoiceEnum("mac_address_subtype"), + INTERFACE_NAME_SUBTYPE: LldpPortIdChoiceEnum("interface_name_subtype"), + LOCAL_SUBTYPE: LldpPortIdChoiceEnum("local_subtype"), +} + +func (obj *lldpPortId) Choice() LldpPortIdChoiceEnum { + return LldpPortIdChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// Port ID subtype to be used in Port ID TLV. +// Choice returns a string +func (obj *lldpPortId) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *lldpPortId) setChoice(value LldpPortIdChoiceEnum) LldpPortId { + intValue, ok := otg.LldpPortId_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LldpPortIdChoiceEnum", string(value))) + return obj + } + enumValue := otg.LldpPortId_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.LocalSubtype = nil + obj.obj.InterfaceNameSubtype = nil + obj.interfaceNameSubtypeHolder = nil + obj.obj.MacAddressSubtype = nil + + if value == LldpPortIdChoice.INTERFACE_NAME_SUBTYPE { + obj.obj.InterfaceNameSubtype = NewLldpPortInterfaceNameSubType().msg() + } + + return obj +} + +// The MAC Address configured in the Port ID TLV. +// MacAddressSubtype returns a string +func (obj *lldpPortId) MacAddressSubtype() string { + + if obj.obj.MacAddressSubtype == nil { + obj.setChoice(LldpPortIdChoice.MAC_ADDRESS_SUBTYPE) + } + + return *obj.obj.MacAddressSubtype + +} + +// The MAC Address configured in the Port ID TLV. +// MacAddressSubtype returns a string +func (obj *lldpPortId) HasMacAddressSubtype() bool { + return obj.obj.MacAddressSubtype != nil +} + +// The MAC Address configured in the Port ID TLV. +// SetMacAddressSubtype sets the string value in the LldpPortId object +func (obj *lldpPortId) SetMacAddressSubtype(value string) LldpPortId { + obj.setChoice(LldpPortIdChoice.MAC_ADDRESS_SUBTYPE) + obj.obj.MacAddressSubtype = &value + return obj +} + +// description is TBD +// InterfaceNameSubtype returns a LldpPortInterfaceNameSubType +func (obj *lldpPortId) InterfaceNameSubtype() LldpPortInterfaceNameSubType { + if obj.obj.InterfaceNameSubtype == nil { + obj.setChoice(LldpPortIdChoice.INTERFACE_NAME_SUBTYPE) + } + if obj.interfaceNameSubtypeHolder == nil { + obj.interfaceNameSubtypeHolder = &lldpPortInterfaceNameSubType{obj: obj.obj.InterfaceNameSubtype} + } + return obj.interfaceNameSubtypeHolder +} + +// description is TBD +// InterfaceNameSubtype returns a LldpPortInterfaceNameSubType +func (obj *lldpPortId) HasInterfaceNameSubtype() bool { + return obj.obj.InterfaceNameSubtype != nil +} + +// description is TBD +// SetInterfaceNameSubtype sets the LldpPortInterfaceNameSubType value in the LldpPortId object +func (obj *lldpPortId) SetInterfaceNameSubtype(value LldpPortInterfaceNameSubType) LldpPortId { + obj.setChoice(LldpPortIdChoice.INTERFACE_NAME_SUBTYPE) + obj.interfaceNameSubtypeHolder = nil + obj.obj.InterfaceNameSubtype = value.msg() + + return obj +} + +// The Locally assigned name configured in the Port ID TLV. +// LocalSubtype returns a string +func (obj *lldpPortId) LocalSubtype() string { + + if obj.obj.LocalSubtype == nil { + obj.setChoice(LldpPortIdChoice.LOCAL_SUBTYPE) + } + + return *obj.obj.LocalSubtype + +} + +// The Locally assigned name configured in the Port ID TLV. +// LocalSubtype returns a string +func (obj *lldpPortId) HasLocalSubtype() bool { + return obj.obj.LocalSubtype != nil +} + +// The Locally assigned name configured in the Port ID TLV. +// SetLocalSubtype sets the string value in the LldpPortId object +func (obj *lldpPortId) SetLocalSubtype(value string) LldpPortId { + obj.setChoice(LldpPortIdChoice.LOCAL_SUBTYPE) + obj.obj.LocalSubtype = &value + return obj +} + +func (obj *lldpPortId) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.InterfaceNameSubtype != nil { + + obj.InterfaceNameSubtype().validateObj(vObj, set_default) + } + +} + +func (obj *lldpPortId) setDefault() { + var choices_set int = 0 + var choice LldpPortIdChoiceEnum + + if obj.obj.MacAddressSubtype != nil { + choices_set += 1 + choice = LldpPortIdChoice.MAC_ADDRESS_SUBTYPE + } + + if obj.obj.InterfaceNameSubtype != nil { + choices_set += 1 + choice = LldpPortIdChoice.INTERFACE_NAME_SUBTYPE + } + + if obj.obj.LocalSubtype != nil { + choices_set += 1 + choice = LldpPortIdChoice.LOCAL_SUBTYPE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(LldpPortIdChoice.INTERFACE_NAME_SUBTYPE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in LldpPortId") + } + } else { + intVal := otg.LldpPortId_Choice_Enum_value[string(choice)] + enumValue := otg.LldpPortId_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/lldp_port_interface_name_sub_type.go b/gosnappi/lldp_port_interface_name_sub_type.go new file mode 100644 index 00000000..5b91c989 --- /dev/null +++ b/gosnappi/lldp_port_interface_name_sub_type.go @@ -0,0 +1,402 @@ +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" +) + +// ***** LldpPortInterfaceNameSubType ***** +type lldpPortInterfaceNameSubType struct { + validation + obj *otg.LldpPortInterfaceNameSubType + marshaller marshalLldpPortInterfaceNameSubType + unMarshaller unMarshalLldpPortInterfaceNameSubType +} + +func NewLldpPortInterfaceNameSubType() LldpPortInterfaceNameSubType { + obj := lldpPortInterfaceNameSubType{obj: &otg.LldpPortInterfaceNameSubType{}} + obj.setDefault() + return &obj +} + +func (obj *lldpPortInterfaceNameSubType) msg() *otg.LldpPortInterfaceNameSubType { + return obj.obj +} + +func (obj *lldpPortInterfaceNameSubType) setMsg(msg *otg.LldpPortInterfaceNameSubType) LldpPortInterfaceNameSubType { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallldpPortInterfaceNameSubType struct { + obj *lldpPortInterfaceNameSubType +} + +type marshalLldpPortInterfaceNameSubType interface { + // ToProto marshals LldpPortInterfaceNameSubType to protobuf object *otg.LldpPortInterfaceNameSubType + ToProto() (*otg.LldpPortInterfaceNameSubType, error) + // ToPbText marshals LldpPortInterfaceNameSubType to protobuf text + ToPbText() (string, error) + // ToYaml marshals LldpPortInterfaceNameSubType to YAML text + ToYaml() (string, error) + // ToJson marshals LldpPortInterfaceNameSubType to JSON text + ToJson() (string, error) +} + +type unMarshallldpPortInterfaceNameSubType struct { + obj *lldpPortInterfaceNameSubType +} + +type unMarshalLldpPortInterfaceNameSubType interface { + // FromProto unmarshals LldpPortInterfaceNameSubType from protobuf object *otg.LldpPortInterfaceNameSubType + FromProto(msg *otg.LldpPortInterfaceNameSubType) (LldpPortInterfaceNameSubType, error) + // FromPbText unmarshals LldpPortInterfaceNameSubType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LldpPortInterfaceNameSubType from YAML text + FromYaml(value string) error + // FromJson unmarshals LldpPortInterfaceNameSubType from JSON text + FromJson(value string) error +} + +func (obj *lldpPortInterfaceNameSubType) Marshal() marshalLldpPortInterfaceNameSubType { + if obj.marshaller == nil { + obj.marshaller = &marshallldpPortInterfaceNameSubType{obj: obj} + } + return obj.marshaller +} + +func (obj *lldpPortInterfaceNameSubType) Unmarshal() unMarshalLldpPortInterfaceNameSubType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallldpPortInterfaceNameSubType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallldpPortInterfaceNameSubType) ToProto() (*otg.LldpPortInterfaceNameSubType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallldpPortInterfaceNameSubType) FromProto(msg *otg.LldpPortInterfaceNameSubType) (LldpPortInterfaceNameSubType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallldpPortInterfaceNameSubType) 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 *unMarshallldpPortInterfaceNameSubType) 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 *marshallldpPortInterfaceNameSubType) 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 *unMarshallldpPortInterfaceNameSubType) 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 *marshallldpPortInterfaceNameSubType) 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 *unMarshallldpPortInterfaceNameSubType) 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 *lldpPortInterfaceNameSubType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lldpPortInterfaceNameSubType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lldpPortInterfaceNameSubType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lldpPortInterfaceNameSubType) Clone() (LldpPortInterfaceNameSubType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLldpPortInterfaceNameSubType() + 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 +} + +// LldpPortInterfaceNameSubType is the interface name configured in the Port ID TLV. +type LldpPortInterfaceNameSubType interface { + Validation + // msg marshals LldpPortInterfaceNameSubType to protobuf object *otg.LldpPortInterfaceNameSubType + // and doesn't set defaults + msg() *otg.LldpPortInterfaceNameSubType + // setMsg unmarshals LldpPortInterfaceNameSubType from protobuf object *otg.LldpPortInterfaceNameSubType + // and doesn't set defaults + setMsg(*otg.LldpPortInterfaceNameSubType) LldpPortInterfaceNameSubType + // provides marshal interface + Marshal() marshalLldpPortInterfaceNameSubType + // provides unmarshal interface + Unmarshal() unMarshalLldpPortInterfaceNameSubType + // validate validates LldpPortInterfaceNameSubType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LldpPortInterfaceNameSubType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns LldpPortInterfaceNameSubTypeChoiceEnum, set in LldpPortInterfaceNameSubType + Choice() LldpPortInterfaceNameSubTypeChoiceEnum + // setChoice assigns LldpPortInterfaceNameSubTypeChoiceEnum provided by user to LldpPortInterfaceNameSubType + setChoice(value LldpPortInterfaceNameSubTypeChoiceEnum) LldpPortInterfaceNameSubType + // HasChoice checks if Choice has been set in LldpPortInterfaceNameSubType + HasChoice() bool + // Auto returns string, set in LldpPortInterfaceNameSubType. + Auto() string + // HasAuto checks if Auto has been set in LldpPortInterfaceNameSubType + HasAuto() bool + // Value returns string, set in LldpPortInterfaceNameSubType. + Value() string + // SetValue assigns string provided by user to LldpPortInterfaceNameSubType + SetValue(value string) LldpPortInterfaceNameSubType + // HasValue checks if Value has been set in LldpPortInterfaceNameSubType + HasValue() bool +} + +type LldpPortInterfaceNameSubTypeChoiceEnum string + +// Enum of Choice on LldpPortInterfaceNameSubType +var LldpPortInterfaceNameSubTypeChoice = struct { + AUTO LldpPortInterfaceNameSubTypeChoiceEnum + VALUE LldpPortInterfaceNameSubTypeChoiceEnum +}{ + AUTO: LldpPortInterfaceNameSubTypeChoiceEnum("auto"), + VALUE: LldpPortInterfaceNameSubTypeChoiceEnum("value"), +} + +func (obj *lldpPortInterfaceNameSubType) Choice() LldpPortInterfaceNameSubTypeChoiceEnum { + return LldpPortInterfaceNameSubTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// In auto mode the system generated value is set for this property, while if the choice is selected as value, a user configured value will be used for this property. +// Choice returns a string +func (obj *lldpPortInterfaceNameSubType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *lldpPortInterfaceNameSubType) setChoice(value LldpPortInterfaceNameSubTypeChoiceEnum) LldpPortInterfaceNameSubType { + intValue, ok := otg.LldpPortInterfaceNameSubType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LldpPortInterfaceNameSubTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.LldpPortInterfaceNameSubType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Value = nil + obj.obj.Auto = nil + return obj +} + +// The OTG implementation must provide a system generated value for this property. +// Auto returns a string +func (obj *lldpPortInterfaceNameSubType) Auto() string { + + if obj.obj.Auto == nil { + obj.setChoice(LldpPortInterfaceNameSubTypeChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation must provide a system generated value for this property. +// Auto returns a string +func (obj *lldpPortInterfaceNameSubType) HasAuto() bool { + return obj.obj.Auto != nil +} + +// User must specify a value if mode is not auto. +// Value returns a string +func (obj *lldpPortInterfaceNameSubType) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(LldpPortInterfaceNameSubTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// User must specify a value if mode is not auto. +// Value returns a string +func (obj *lldpPortInterfaceNameSubType) HasValue() bool { + return obj.obj.Value != nil +} + +// User must specify a value if mode is not auto. +// SetValue sets the string value in the LldpPortInterfaceNameSubType object +func (obj *lldpPortInterfaceNameSubType) SetValue(value string) LldpPortInterfaceNameSubType { + obj.setChoice(LldpPortInterfaceNameSubTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +func (obj *lldpPortInterfaceNameSubType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *lldpPortInterfaceNameSubType) setDefault() { + var choices_set int = 0 + var choice LldpPortInterfaceNameSubTypeChoiceEnum + + if obj.obj.Auto != nil { + choices_set += 1 + choice = LldpPortInterfaceNameSubTypeChoice.AUTO + } + + if obj.obj.Value != nil { + choices_set += 1 + choice = LldpPortInterfaceNameSubTypeChoice.VALUE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(LldpPortInterfaceNameSubTypeChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in LldpPortInterfaceNameSubType") + } + } else { + intVal := otg.LldpPortInterfaceNameSubType_Choice_Enum_value[string(choice)] + enumValue := otg.LldpPortInterfaceNameSubType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/lldp_system_name.go b/gosnappi/lldp_system_name.go new file mode 100644 index 00000000..2ffd6b46 --- /dev/null +++ b/gosnappi/lldp_system_name.go @@ -0,0 +1,402 @@ +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" +) + +// ***** LldpSystemName ***** +type lldpSystemName struct { + validation + obj *otg.LldpSystemName + marshaller marshalLldpSystemName + unMarshaller unMarshalLldpSystemName +} + +func NewLldpSystemName() LldpSystemName { + obj := lldpSystemName{obj: &otg.LldpSystemName{}} + obj.setDefault() + return &obj +} + +func (obj *lldpSystemName) msg() *otg.LldpSystemName { + return obj.obj +} + +func (obj *lldpSystemName) setMsg(msg *otg.LldpSystemName) LldpSystemName { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshallldpSystemName struct { + obj *lldpSystemName +} + +type marshalLldpSystemName interface { + // ToProto marshals LldpSystemName to protobuf object *otg.LldpSystemName + ToProto() (*otg.LldpSystemName, error) + // ToPbText marshals LldpSystemName to protobuf text + ToPbText() (string, error) + // ToYaml marshals LldpSystemName to YAML text + ToYaml() (string, error) + // ToJson marshals LldpSystemName to JSON text + ToJson() (string, error) +} + +type unMarshallldpSystemName struct { + obj *lldpSystemName +} + +type unMarshalLldpSystemName interface { + // FromProto unmarshals LldpSystemName from protobuf object *otg.LldpSystemName + FromProto(msg *otg.LldpSystemName) (LldpSystemName, error) + // FromPbText unmarshals LldpSystemName from protobuf text + FromPbText(value string) error + // FromYaml unmarshals LldpSystemName from YAML text + FromYaml(value string) error + // FromJson unmarshals LldpSystemName from JSON text + FromJson(value string) error +} + +func (obj *lldpSystemName) Marshal() marshalLldpSystemName { + if obj.marshaller == nil { + obj.marshaller = &marshallldpSystemName{obj: obj} + } + return obj.marshaller +} + +func (obj *lldpSystemName) Unmarshal() unMarshalLldpSystemName { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshallldpSystemName{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshallldpSystemName) ToProto() (*otg.LldpSystemName, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshallldpSystemName) FromProto(msg *otg.LldpSystemName) (LldpSystemName, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshallldpSystemName) 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 *unMarshallldpSystemName) 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 *marshallldpSystemName) 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 *unMarshallldpSystemName) 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 *marshallldpSystemName) 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 *unMarshallldpSystemName) 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 *lldpSystemName) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *lldpSystemName) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *lldpSystemName) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *lldpSystemName) Clone() (LldpSystemName, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewLldpSystemName() + 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 +} + +// LldpSystemName is the system Name configured in the System Name TLV. +type LldpSystemName interface { + Validation + // msg marshals LldpSystemName to protobuf object *otg.LldpSystemName + // and doesn't set defaults + msg() *otg.LldpSystemName + // setMsg unmarshals LldpSystemName from protobuf object *otg.LldpSystemName + // and doesn't set defaults + setMsg(*otg.LldpSystemName) LldpSystemName + // provides marshal interface + Marshal() marshalLldpSystemName + // provides unmarshal interface + Unmarshal() unMarshalLldpSystemName + // validate validates LldpSystemName + validate() error + // A stringer function + String() string + // Clones the object + Clone() (LldpSystemName, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns LldpSystemNameChoiceEnum, set in LldpSystemName + Choice() LldpSystemNameChoiceEnum + // setChoice assigns LldpSystemNameChoiceEnum provided by user to LldpSystemName + setChoice(value LldpSystemNameChoiceEnum) LldpSystemName + // HasChoice checks if Choice has been set in LldpSystemName + HasChoice() bool + // Auto returns string, set in LldpSystemName. + Auto() string + // HasAuto checks if Auto has been set in LldpSystemName + HasAuto() bool + // Value returns string, set in LldpSystemName. + Value() string + // SetValue assigns string provided by user to LldpSystemName + SetValue(value string) LldpSystemName + // HasValue checks if Value has been set in LldpSystemName + HasValue() bool +} + +type LldpSystemNameChoiceEnum string + +// Enum of Choice on LldpSystemName +var LldpSystemNameChoice = struct { + AUTO LldpSystemNameChoiceEnum + VALUE LldpSystemNameChoiceEnum +}{ + AUTO: LldpSystemNameChoiceEnum("auto"), + VALUE: LldpSystemNameChoiceEnum("value"), +} + +func (obj *lldpSystemName) Choice() LldpSystemNameChoiceEnum { + return LldpSystemNameChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// In auto mode the system generated value is set for this property, while if the choice is selected as value, a user configured value will be used for this property. +// Choice returns a string +func (obj *lldpSystemName) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *lldpSystemName) setChoice(value LldpSystemNameChoiceEnum) LldpSystemName { + intValue, ok := otg.LldpSystemName_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on LldpSystemNameChoiceEnum", string(value))) + return obj + } + enumValue := otg.LldpSystemName_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Value = nil + obj.obj.Auto = nil + return obj +} + +// The OTG implementation must provide a system generated value for this property. +// Auto returns a string +func (obj *lldpSystemName) Auto() string { + + if obj.obj.Auto == nil { + obj.setChoice(LldpSystemNameChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation must provide a system generated value for this property. +// Auto returns a string +func (obj *lldpSystemName) HasAuto() bool { + return obj.obj.Auto != nil +} + +// User must specify a value if mode is not auto. +// Value returns a string +func (obj *lldpSystemName) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(LldpSystemNameChoice.VALUE) + } + + return *obj.obj.Value + +} + +// User must specify a value if mode is not auto. +// Value returns a string +func (obj *lldpSystemName) HasValue() bool { + return obj.obj.Value != nil +} + +// User must specify a value if mode is not auto. +// SetValue sets the string value in the LldpSystemName object +func (obj *lldpSystemName) SetValue(value string) LldpSystemName { + obj.setChoice(LldpSystemNameChoice.VALUE) + obj.obj.Value = &value + return obj +} + +func (obj *lldpSystemName) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *lldpSystemName) setDefault() { + var choices_set int = 0 + var choice LldpSystemNameChoiceEnum + + if obj.obj.Auto != nil { + choices_set += 1 + choice = LldpSystemNameChoice.AUTO + } + + if obj.obj.Value != nil { + choices_set += 1 + choice = LldpSystemNameChoice.VALUE + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(LldpSystemNameChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in LldpSystemName") + } + } else { + intVal := otg.LldpSystemName_Choice_Enum_value[string(choice)] + enumValue := otg.LldpSystemName_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/mac_route_address.go b/gosnappi/mac_route_address.go new file mode 100644 index 00000000..a8ba2865 --- /dev/null +++ b/gosnappi/mac_route_address.go @@ -0,0 +1,434 @@ +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/metric_latency.go b/gosnappi/metric_latency.go new file mode 100644 index 00000000..aa7f74db --- /dev/null +++ b/gosnappi/metric_latency.go @@ -0,0 +1,366 @@ +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" +) + +// ***** MetricLatency ***** +type metricLatency struct { + validation + obj *otg.MetricLatency + marshaller marshalMetricLatency + unMarshaller unMarshalMetricLatency +} + +func NewMetricLatency() MetricLatency { + obj := metricLatency{obj: &otg.MetricLatency{}} + obj.setDefault() + return &obj +} + +func (obj *metricLatency) msg() *otg.MetricLatency { + return obj.obj +} + +func (obj *metricLatency) setMsg(msg *otg.MetricLatency) MetricLatency { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalmetricLatency struct { + obj *metricLatency +} + +type marshalMetricLatency interface { + // ToProto marshals MetricLatency to protobuf object *otg.MetricLatency + ToProto() (*otg.MetricLatency, error) + // ToPbText marshals MetricLatency to protobuf text + ToPbText() (string, error) + // ToYaml marshals MetricLatency to YAML text + ToYaml() (string, error) + // ToJson marshals MetricLatency to JSON text + ToJson() (string, error) +} + +type unMarshalmetricLatency struct { + obj *metricLatency +} + +type unMarshalMetricLatency interface { + // FromProto unmarshals MetricLatency from protobuf object *otg.MetricLatency + FromProto(msg *otg.MetricLatency) (MetricLatency, error) + // FromPbText unmarshals MetricLatency from protobuf text + FromPbText(value string) error + // FromYaml unmarshals MetricLatency from YAML text + FromYaml(value string) error + // FromJson unmarshals MetricLatency from JSON text + FromJson(value string) error +} + +func (obj *metricLatency) Marshal() marshalMetricLatency { + if obj.marshaller == nil { + obj.marshaller = &marshalmetricLatency{obj: obj} + } + return obj.marshaller +} + +func (obj *metricLatency) Unmarshal() unMarshalMetricLatency { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalmetricLatency{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalmetricLatency) ToProto() (*otg.MetricLatency, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalmetricLatency) FromProto(msg *otg.MetricLatency) (MetricLatency, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalmetricLatency) 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 *unMarshalmetricLatency) 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 *marshalmetricLatency) 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 *unMarshalmetricLatency) 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 *marshalmetricLatency) 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 *unMarshalmetricLatency) 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 *metricLatency) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *metricLatency) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *metricLatency) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *metricLatency) Clone() (MetricLatency, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewMetricLatency() + 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 +} + +// MetricLatency is the container for latency metrics. +// The min/max/avg values are dependent on the type of latency measurement +// mode that is configured. +// The container will be empty if the latency has not been configured for +// the flow. +type MetricLatency interface { + Validation + // msg marshals MetricLatency to protobuf object *otg.MetricLatency + // and doesn't set defaults + msg() *otg.MetricLatency + // setMsg unmarshals MetricLatency from protobuf object *otg.MetricLatency + // and doesn't set defaults + setMsg(*otg.MetricLatency) MetricLatency + // provides marshal interface + Marshal() marshalMetricLatency + // provides unmarshal interface + Unmarshal() unMarshalMetricLatency + // validate validates MetricLatency + validate() error + // A stringer function + String() string + // Clones the object + Clone() (MetricLatency, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // MinimumNs returns float64, set in MetricLatency. + MinimumNs() float64 + // SetMinimumNs assigns float64 provided by user to MetricLatency + SetMinimumNs(value float64) MetricLatency + // HasMinimumNs checks if MinimumNs has been set in MetricLatency + HasMinimumNs() bool + // MaximumNs returns float64, set in MetricLatency. + MaximumNs() float64 + // SetMaximumNs assigns float64 provided by user to MetricLatency + SetMaximumNs(value float64) MetricLatency + // HasMaximumNs checks if MaximumNs has been set in MetricLatency + HasMaximumNs() bool + // AverageNs returns float64, set in MetricLatency. + AverageNs() float64 + // SetAverageNs assigns float64 provided by user to MetricLatency + SetAverageNs(value float64) MetricLatency + // HasAverageNs checks if AverageNs has been set in MetricLatency + HasAverageNs() bool +} + +// Minimum latency in nanoseconds +// MinimumNs returns a float64 +func (obj *metricLatency) MinimumNs() float64 { + + return *obj.obj.MinimumNs + +} + +// Minimum latency in nanoseconds +// MinimumNs returns a float64 +func (obj *metricLatency) HasMinimumNs() bool { + return obj.obj.MinimumNs != nil +} + +// Minimum latency in nanoseconds +// SetMinimumNs sets the float64 value in the MetricLatency object +func (obj *metricLatency) SetMinimumNs(value float64) MetricLatency { + + obj.obj.MinimumNs = &value + return obj +} + +// Maximum latency in nanoseconds +// MaximumNs returns a float64 +func (obj *metricLatency) MaximumNs() float64 { + + return *obj.obj.MaximumNs + +} + +// Maximum latency in nanoseconds +// MaximumNs returns a float64 +func (obj *metricLatency) HasMaximumNs() bool { + return obj.obj.MaximumNs != nil +} + +// Maximum latency in nanoseconds +// SetMaximumNs sets the float64 value in the MetricLatency object +func (obj *metricLatency) SetMaximumNs(value float64) MetricLatency { + + obj.obj.MaximumNs = &value + return obj +} + +// Average latency in nanoseconds +// AverageNs returns a float64 +func (obj *metricLatency) AverageNs() float64 { + + return *obj.obj.AverageNs + +} + +// Average latency in nanoseconds +// AverageNs returns a float64 +func (obj *metricLatency) HasAverageNs() bool { + return obj.obj.AverageNs != nil +} + +// Average latency in nanoseconds +// SetAverageNs sets the float64 value in the MetricLatency object +func (obj *metricLatency) SetAverageNs(value float64) MetricLatency { + + obj.obj.AverageNs = &value + return obj +} + +func (obj *metricLatency) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *metricLatency) setDefault() { + +} diff --git a/gosnappi/metric_timestamp.go b/gosnappi/metric_timestamp.go new file mode 100644 index 00000000..f2f637fc --- /dev/null +++ b/gosnappi/metric_timestamp.go @@ -0,0 +1,336 @@ +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" +) + +// ***** MetricTimestamp ***** +type metricTimestamp struct { + validation + obj *otg.MetricTimestamp + marshaller marshalMetricTimestamp + unMarshaller unMarshalMetricTimestamp +} + +func NewMetricTimestamp() MetricTimestamp { + obj := metricTimestamp{obj: &otg.MetricTimestamp{}} + obj.setDefault() + return &obj +} + +func (obj *metricTimestamp) msg() *otg.MetricTimestamp { + return obj.obj +} + +func (obj *metricTimestamp) setMsg(msg *otg.MetricTimestamp) MetricTimestamp { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalmetricTimestamp struct { + obj *metricTimestamp +} + +type marshalMetricTimestamp interface { + // ToProto marshals MetricTimestamp to protobuf object *otg.MetricTimestamp + ToProto() (*otg.MetricTimestamp, error) + // ToPbText marshals MetricTimestamp to protobuf text + ToPbText() (string, error) + // ToYaml marshals MetricTimestamp to YAML text + ToYaml() (string, error) + // ToJson marshals MetricTimestamp to JSON text + ToJson() (string, error) +} + +type unMarshalmetricTimestamp struct { + obj *metricTimestamp +} + +type unMarshalMetricTimestamp interface { + // FromProto unmarshals MetricTimestamp from protobuf object *otg.MetricTimestamp + FromProto(msg *otg.MetricTimestamp) (MetricTimestamp, error) + // FromPbText unmarshals MetricTimestamp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals MetricTimestamp from YAML text + FromYaml(value string) error + // FromJson unmarshals MetricTimestamp from JSON text + FromJson(value string) error +} + +func (obj *metricTimestamp) Marshal() marshalMetricTimestamp { + if obj.marshaller == nil { + obj.marshaller = &marshalmetricTimestamp{obj: obj} + } + return obj.marshaller +} + +func (obj *metricTimestamp) Unmarshal() unMarshalMetricTimestamp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalmetricTimestamp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalmetricTimestamp) ToProto() (*otg.MetricTimestamp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalmetricTimestamp) FromProto(msg *otg.MetricTimestamp) (MetricTimestamp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalmetricTimestamp) 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 *unMarshalmetricTimestamp) 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 *marshalmetricTimestamp) 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 *unMarshalmetricTimestamp) 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 *marshalmetricTimestamp) 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 *unMarshalmetricTimestamp) 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 *metricTimestamp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *metricTimestamp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *metricTimestamp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *metricTimestamp) Clone() (MetricTimestamp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewMetricTimestamp() + 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 +} + +// MetricTimestamp is the container for timestamp metrics. +// The container will be empty if the timestamp has not been configured for +// the flow. +type MetricTimestamp interface { + Validation + // msg marshals MetricTimestamp to protobuf object *otg.MetricTimestamp + // and doesn't set defaults + msg() *otg.MetricTimestamp + // setMsg unmarshals MetricTimestamp from protobuf object *otg.MetricTimestamp + // and doesn't set defaults + setMsg(*otg.MetricTimestamp) MetricTimestamp + // provides marshal interface + Marshal() marshalMetricTimestamp + // provides unmarshal interface + Unmarshal() unMarshalMetricTimestamp + // validate validates MetricTimestamp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (MetricTimestamp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // FirstTimestampNs returns float64, set in MetricTimestamp. + FirstTimestampNs() float64 + // SetFirstTimestampNs assigns float64 provided by user to MetricTimestamp + SetFirstTimestampNs(value float64) MetricTimestamp + // HasFirstTimestampNs checks if FirstTimestampNs has been set in MetricTimestamp + HasFirstTimestampNs() bool + // LastTimestampNs returns float64, set in MetricTimestamp. + LastTimestampNs() float64 + // SetLastTimestampNs assigns float64 provided by user to MetricTimestamp + SetLastTimestampNs(value float64) MetricTimestamp + // HasLastTimestampNs checks if LastTimestampNs has been set in MetricTimestamp + HasLastTimestampNs() bool +} + +// First timestamp in nanoseconds +// FirstTimestampNs returns a float64 +func (obj *metricTimestamp) FirstTimestampNs() float64 { + + return *obj.obj.FirstTimestampNs + +} + +// First timestamp in nanoseconds +// FirstTimestampNs returns a float64 +func (obj *metricTimestamp) HasFirstTimestampNs() bool { + return obj.obj.FirstTimestampNs != nil +} + +// First timestamp in nanoseconds +// SetFirstTimestampNs sets the float64 value in the MetricTimestamp object +func (obj *metricTimestamp) SetFirstTimestampNs(value float64) MetricTimestamp { + + obj.obj.FirstTimestampNs = &value + return obj +} + +// Last timestamp in nanoseconds +// LastTimestampNs returns a float64 +func (obj *metricTimestamp) LastTimestampNs() float64 { + + return *obj.obj.LastTimestampNs + +} + +// Last timestamp in nanoseconds +// LastTimestampNs returns a float64 +func (obj *metricTimestamp) HasLastTimestampNs() bool { + return obj.obj.LastTimestampNs != nil +} + +// Last timestamp in nanoseconds +// SetLastTimestampNs sets the float64 value in the MetricTimestamp object +func (obj *metricTimestamp) SetLastTimestampNs(value float64) MetricTimestamp { + + obj.obj.LastTimestampNs = &value + return obj +} + +func (obj *metricTimestamp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *metricTimestamp) setDefault() { + +} diff --git a/gosnappi/metrics_request.go b/gosnappi/metrics_request.go new file mode 100644 index 00000000..01ee3581 --- /dev/null +++ b/gosnappi/metrics_request.go @@ -0,0 +1,956 @@ +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" +) + +// ***** MetricsRequest ***** +type metricsRequest struct { + validation + obj *otg.MetricsRequest + marshaller marshalMetricsRequest + unMarshaller unMarshalMetricsRequest + portHolder PortMetricsRequest + flowHolder FlowMetricsRequest + bgpv4Holder Bgpv4MetricsRequest + bgpv6Holder Bgpv6MetricsRequest + isisHolder IsisMetricsRequest + lagHolder LagMetricsRequest + lacpHolder LacpMetricsRequest + lldpHolder LldpMetricsRequest + rsvpHolder RsvpMetricsRequest + dhcpv4ClientHolder Dhcpv4ClientMetricsRequest + dhcpv4ServerHolder Dhcpv4ServerMetricsRequest +} + +func NewMetricsRequest() MetricsRequest { + obj := metricsRequest{obj: &otg.MetricsRequest{}} + obj.setDefault() + return &obj +} + +func (obj *metricsRequest) msg() *otg.MetricsRequest { + return obj.obj +} + +func (obj *metricsRequest) setMsg(msg *otg.MetricsRequest) MetricsRequest { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalmetricsRequest struct { + obj *metricsRequest +} + +type marshalMetricsRequest interface { + // ToProto marshals MetricsRequest to protobuf object *otg.MetricsRequest + ToProto() (*otg.MetricsRequest, error) + // ToPbText marshals MetricsRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals MetricsRequest to YAML text + ToYaml() (string, error) + // ToJson marshals MetricsRequest to JSON text + ToJson() (string, error) +} + +type unMarshalmetricsRequest struct { + obj *metricsRequest +} + +type unMarshalMetricsRequest interface { + // FromProto unmarshals MetricsRequest from protobuf object *otg.MetricsRequest + FromProto(msg *otg.MetricsRequest) (MetricsRequest, error) + // FromPbText unmarshals MetricsRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals MetricsRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals MetricsRequest from JSON text + FromJson(value string) error +} + +func (obj *metricsRequest) Marshal() marshalMetricsRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalmetricsRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *metricsRequest) Unmarshal() unMarshalMetricsRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalmetricsRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalmetricsRequest) ToProto() (*otg.MetricsRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalmetricsRequest) FromProto(msg *otg.MetricsRequest) (MetricsRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalmetricsRequest) 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 *unMarshalmetricsRequest) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalmetricsRequest) 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 *unMarshalmetricsRequest) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalmetricsRequest) 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 *unMarshalmetricsRequest) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *metricsRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *metricsRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *metricsRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *metricsRequest) Clone() (MetricsRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewMetricsRequest() + 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 +} + +func (obj *metricsRequest) setNil() { + obj.portHolder = nil + obj.flowHolder = nil + obj.bgpv4Holder = nil + obj.bgpv6Holder = nil + obj.isisHolder = nil + obj.lagHolder = nil + obj.lacpHolder = nil + obj.lldpHolder = nil + obj.rsvpHolder = nil + obj.dhcpv4ClientHolder = nil + obj.dhcpv4ServerHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// MetricsRequest is request to traffic generator for metrics of choice. +type MetricsRequest interface { + Validation + // msg marshals MetricsRequest to protobuf object *otg.MetricsRequest + // and doesn't set defaults + msg() *otg.MetricsRequest + // setMsg unmarshals MetricsRequest from protobuf object *otg.MetricsRequest + // and doesn't set defaults + setMsg(*otg.MetricsRequest) MetricsRequest + // provides marshal interface + Marshal() marshalMetricsRequest + // provides unmarshal interface + Unmarshal() unMarshalMetricsRequest + // validate validates MetricsRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (MetricsRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns MetricsRequestChoiceEnum, set in MetricsRequest + Choice() MetricsRequestChoiceEnum + // setChoice assigns MetricsRequestChoiceEnum provided by user to MetricsRequest + setChoice(value MetricsRequestChoiceEnum) MetricsRequest + // HasChoice checks if Choice has been set in MetricsRequest + HasChoice() bool + // Port returns PortMetricsRequest, set in MetricsRequest. + // PortMetricsRequest is the port result request to the traffic generator + Port() PortMetricsRequest + // SetPort assigns PortMetricsRequest provided by user to MetricsRequest. + // PortMetricsRequest is the port result request to the traffic generator + SetPort(value PortMetricsRequest) MetricsRequest + // HasPort checks if Port has been set in MetricsRequest + HasPort() bool + // Flow returns FlowMetricsRequest, set in MetricsRequest. + // FlowMetricsRequest is the container for a flow metric request. + Flow() FlowMetricsRequest + // SetFlow assigns FlowMetricsRequest provided by user to MetricsRequest. + // FlowMetricsRequest is the container for a flow metric request. + SetFlow(value FlowMetricsRequest) MetricsRequest + // HasFlow checks if Flow has been set in MetricsRequest + HasFlow() bool + // Bgpv4 returns Bgpv4MetricsRequest, set in MetricsRequest. + // Bgpv4MetricsRequest is the request to retrieve BGPv4 per peer metrics/statistics. + Bgpv4() Bgpv4MetricsRequest + // SetBgpv4 assigns Bgpv4MetricsRequest provided by user to MetricsRequest. + // Bgpv4MetricsRequest is the request to retrieve BGPv4 per peer metrics/statistics. + SetBgpv4(value Bgpv4MetricsRequest) MetricsRequest + // HasBgpv4 checks if Bgpv4 has been set in MetricsRequest + HasBgpv4() bool + // Bgpv6 returns Bgpv6MetricsRequest, set in MetricsRequest. + // Bgpv6MetricsRequest is the request to retrieve BGPv6 per peer metrics/statistics. + Bgpv6() Bgpv6MetricsRequest + // SetBgpv6 assigns Bgpv6MetricsRequest provided by user to MetricsRequest. + // Bgpv6MetricsRequest is the request to retrieve BGPv6 per peer metrics/statistics. + SetBgpv6(value Bgpv6MetricsRequest) MetricsRequest + // HasBgpv6 checks if Bgpv6 has been set in MetricsRequest + HasBgpv6() bool + // Isis returns IsisMetricsRequest, set in MetricsRequest. + // IsisMetricsRequest is the request to retrieve ISIS per Router metrics/statistics. + Isis() IsisMetricsRequest + // SetIsis assigns IsisMetricsRequest provided by user to MetricsRequest. + // IsisMetricsRequest is the request to retrieve ISIS per Router metrics/statistics. + SetIsis(value IsisMetricsRequest) MetricsRequest + // HasIsis checks if Isis has been set in MetricsRequest + HasIsis() bool + // Lag returns LagMetricsRequest, set in MetricsRequest. + // LagMetricsRequest is the request to retrieve per LAG metrics/statistics. + Lag() LagMetricsRequest + // SetLag assigns LagMetricsRequest provided by user to MetricsRequest. + // LagMetricsRequest is the request to retrieve per LAG metrics/statistics. + SetLag(value LagMetricsRequest) MetricsRequest + // HasLag checks if Lag has been set in MetricsRequest + HasLag() bool + // Lacp returns LacpMetricsRequest, set in MetricsRequest. + // LacpMetricsRequest is the request to retrieve LACP per LAG member metrics/statistics. + Lacp() LacpMetricsRequest + // SetLacp assigns LacpMetricsRequest provided by user to MetricsRequest. + // LacpMetricsRequest is the request to retrieve LACP per LAG member metrics/statistics. + SetLacp(value LacpMetricsRequest) MetricsRequest + // HasLacp checks if Lacp has been set in MetricsRequest + HasLacp() bool + // Lldp returns LldpMetricsRequest, set in MetricsRequest. + // LldpMetricsRequest is the request to retrieve LLDP per instance metrics/statistics. + Lldp() LldpMetricsRequest + // SetLldp assigns LldpMetricsRequest provided by user to MetricsRequest. + // LldpMetricsRequest is the request to retrieve LLDP per instance metrics/statistics. + SetLldp(value LldpMetricsRequest) MetricsRequest + // HasLldp checks if Lldp has been set in MetricsRequest + HasLldp() bool + // Rsvp returns RsvpMetricsRequest, set in MetricsRequest. + // RsvpMetricsRequest is the request to retrieve RSVP-TE per Router metrics/statistics. + Rsvp() RsvpMetricsRequest + // SetRsvp assigns RsvpMetricsRequest provided by user to MetricsRequest. + // RsvpMetricsRequest is the request to retrieve RSVP-TE per Router metrics/statistics. + SetRsvp(value RsvpMetricsRequest) MetricsRequest + // HasRsvp checks if Rsvp has been set in MetricsRequest + HasRsvp() bool + // Dhcpv4Client returns Dhcpv4ClientMetricsRequest, set in MetricsRequest. + // Dhcpv4ClientMetricsRequest is the request to retrieve DHCPv4 per client metrics/statistics. + Dhcpv4Client() Dhcpv4ClientMetricsRequest + // SetDhcpv4Client assigns Dhcpv4ClientMetricsRequest provided by user to MetricsRequest. + // Dhcpv4ClientMetricsRequest is the request to retrieve DHCPv4 per client metrics/statistics. + SetDhcpv4Client(value Dhcpv4ClientMetricsRequest) MetricsRequest + // HasDhcpv4Client checks if Dhcpv4Client has been set in MetricsRequest + HasDhcpv4Client() bool + // Dhcpv4Server returns Dhcpv4ServerMetricsRequest, set in MetricsRequest. + // Dhcpv4ServerMetricsRequest is the request to retrieve DHCPv4 per Server metrics/statistics. + Dhcpv4Server() Dhcpv4ServerMetricsRequest + // SetDhcpv4Server assigns Dhcpv4ServerMetricsRequest provided by user to MetricsRequest. + // Dhcpv4ServerMetricsRequest is the request to retrieve DHCPv4 per Server metrics/statistics. + SetDhcpv4Server(value Dhcpv4ServerMetricsRequest) MetricsRequest + // HasDhcpv4Server checks if Dhcpv4Server has been set in MetricsRequest + HasDhcpv4Server() bool + setNil() +} + +type MetricsRequestChoiceEnum string + +// Enum of Choice on MetricsRequest +var MetricsRequestChoice = struct { + PORT MetricsRequestChoiceEnum + FLOW MetricsRequestChoiceEnum + BGPV4 MetricsRequestChoiceEnum + BGPV6 MetricsRequestChoiceEnum + ISIS MetricsRequestChoiceEnum + LAG MetricsRequestChoiceEnum + LACP MetricsRequestChoiceEnum + LLDP MetricsRequestChoiceEnum + RSVP MetricsRequestChoiceEnum + DHCPV4_CLIENT MetricsRequestChoiceEnum + DHCPV4_SERVER MetricsRequestChoiceEnum +}{ + PORT: MetricsRequestChoiceEnum("port"), + FLOW: MetricsRequestChoiceEnum("flow"), + BGPV4: MetricsRequestChoiceEnum("bgpv4"), + BGPV6: MetricsRequestChoiceEnum("bgpv6"), + ISIS: MetricsRequestChoiceEnum("isis"), + LAG: MetricsRequestChoiceEnum("lag"), + LACP: MetricsRequestChoiceEnum("lacp"), + LLDP: MetricsRequestChoiceEnum("lldp"), + RSVP: MetricsRequestChoiceEnum("rsvp"), + DHCPV4_CLIENT: MetricsRequestChoiceEnum("dhcpv4_client"), + DHCPV4_SERVER: MetricsRequestChoiceEnum("dhcpv4_server"), +} + +func (obj *metricsRequest) Choice() MetricsRequestChoiceEnum { + return MetricsRequestChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *metricsRequest) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *metricsRequest) setChoice(value MetricsRequestChoiceEnum) MetricsRequest { + intValue, ok := otg.MetricsRequest_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on MetricsRequestChoiceEnum", string(value))) + return obj + } + enumValue := otg.MetricsRequest_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Dhcpv4Server = nil + obj.dhcpv4ServerHolder = nil + obj.obj.Dhcpv4Client = nil + obj.dhcpv4ClientHolder = nil + obj.obj.Rsvp = nil + obj.rsvpHolder = nil + obj.obj.Lldp = nil + obj.lldpHolder = nil + obj.obj.Lacp = nil + obj.lacpHolder = nil + obj.obj.Lag = nil + obj.lagHolder = nil + obj.obj.Isis = nil + obj.isisHolder = nil + obj.obj.Bgpv6 = nil + obj.bgpv6Holder = nil + obj.obj.Bgpv4 = nil + obj.bgpv4Holder = nil + obj.obj.Flow = nil + obj.flowHolder = nil + obj.obj.Port = nil + obj.portHolder = nil + + if value == MetricsRequestChoice.PORT { + obj.obj.Port = NewPortMetricsRequest().msg() + } + + if value == MetricsRequestChoice.FLOW { + obj.obj.Flow = NewFlowMetricsRequest().msg() + } + + if value == MetricsRequestChoice.BGPV4 { + obj.obj.Bgpv4 = NewBgpv4MetricsRequest().msg() + } + + if value == MetricsRequestChoice.BGPV6 { + obj.obj.Bgpv6 = NewBgpv6MetricsRequest().msg() + } + + if value == MetricsRequestChoice.ISIS { + obj.obj.Isis = NewIsisMetricsRequest().msg() + } + + if value == MetricsRequestChoice.LAG { + obj.obj.Lag = NewLagMetricsRequest().msg() + } + + if value == MetricsRequestChoice.LACP { + obj.obj.Lacp = NewLacpMetricsRequest().msg() + } + + if value == MetricsRequestChoice.LLDP { + obj.obj.Lldp = NewLldpMetricsRequest().msg() + } + + if value == MetricsRequestChoice.RSVP { + obj.obj.Rsvp = NewRsvpMetricsRequest().msg() + } + + if value == MetricsRequestChoice.DHCPV4_CLIENT { + obj.obj.Dhcpv4Client = NewDhcpv4ClientMetricsRequest().msg() + } + + if value == MetricsRequestChoice.DHCPV4_SERVER { + obj.obj.Dhcpv4Server = NewDhcpv4ServerMetricsRequest().msg() + } + + return obj +} + +// description is TBD +// Port returns a PortMetricsRequest +func (obj *metricsRequest) Port() PortMetricsRequest { + if obj.obj.Port == nil { + obj.setChoice(MetricsRequestChoice.PORT) + } + if obj.portHolder == nil { + obj.portHolder = &portMetricsRequest{obj: obj.obj.Port} + } + return obj.portHolder +} + +// description is TBD +// Port returns a PortMetricsRequest +func (obj *metricsRequest) HasPort() bool { + return obj.obj.Port != nil +} + +// description is TBD +// SetPort sets the PortMetricsRequest value in the MetricsRequest object +func (obj *metricsRequest) SetPort(value PortMetricsRequest) MetricsRequest { + obj.setChoice(MetricsRequestChoice.PORT) + obj.portHolder = nil + obj.obj.Port = value.msg() + + return obj +} + +// description is TBD +// Flow returns a FlowMetricsRequest +func (obj *metricsRequest) Flow() FlowMetricsRequest { + if obj.obj.Flow == nil { + obj.setChoice(MetricsRequestChoice.FLOW) + } + if obj.flowHolder == nil { + obj.flowHolder = &flowMetricsRequest{obj: obj.obj.Flow} + } + return obj.flowHolder +} + +// description is TBD +// Flow returns a FlowMetricsRequest +func (obj *metricsRequest) HasFlow() bool { + return obj.obj.Flow != nil +} + +// description is TBD +// SetFlow sets the FlowMetricsRequest value in the MetricsRequest object +func (obj *metricsRequest) SetFlow(value FlowMetricsRequest) MetricsRequest { + obj.setChoice(MetricsRequestChoice.FLOW) + obj.flowHolder = nil + obj.obj.Flow = value.msg() + + return obj +} + +// description is TBD +// Bgpv4 returns a Bgpv4MetricsRequest +func (obj *metricsRequest) Bgpv4() Bgpv4MetricsRequest { + if obj.obj.Bgpv4 == nil { + obj.setChoice(MetricsRequestChoice.BGPV4) + } + if obj.bgpv4Holder == nil { + obj.bgpv4Holder = &bgpv4MetricsRequest{obj: obj.obj.Bgpv4} + } + return obj.bgpv4Holder +} + +// description is TBD +// Bgpv4 returns a Bgpv4MetricsRequest +func (obj *metricsRequest) HasBgpv4() bool { + return obj.obj.Bgpv4 != nil +} + +// description is TBD +// SetBgpv4 sets the Bgpv4MetricsRequest value in the MetricsRequest object +func (obj *metricsRequest) SetBgpv4(value Bgpv4MetricsRequest) MetricsRequest { + obj.setChoice(MetricsRequestChoice.BGPV4) + obj.bgpv4Holder = nil + obj.obj.Bgpv4 = value.msg() + + return obj +} + +// description is TBD +// Bgpv6 returns a Bgpv6MetricsRequest +func (obj *metricsRequest) Bgpv6() Bgpv6MetricsRequest { + if obj.obj.Bgpv6 == nil { + obj.setChoice(MetricsRequestChoice.BGPV6) + } + if obj.bgpv6Holder == nil { + obj.bgpv6Holder = &bgpv6MetricsRequest{obj: obj.obj.Bgpv6} + } + return obj.bgpv6Holder +} + +// description is TBD +// Bgpv6 returns a Bgpv6MetricsRequest +func (obj *metricsRequest) HasBgpv6() bool { + return obj.obj.Bgpv6 != nil +} + +// description is TBD +// SetBgpv6 sets the Bgpv6MetricsRequest value in the MetricsRequest object +func (obj *metricsRequest) SetBgpv6(value Bgpv6MetricsRequest) MetricsRequest { + obj.setChoice(MetricsRequestChoice.BGPV6) + obj.bgpv6Holder = nil + obj.obj.Bgpv6 = value.msg() + + return obj +} + +// description is TBD +// Isis returns a IsisMetricsRequest +func (obj *metricsRequest) Isis() IsisMetricsRequest { + if obj.obj.Isis == nil { + obj.setChoice(MetricsRequestChoice.ISIS) + } + if obj.isisHolder == nil { + obj.isisHolder = &isisMetricsRequest{obj: obj.obj.Isis} + } + return obj.isisHolder +} + +// description is TBD +// Isis returns a IsisMetricsRequest +func (obj *metricsRequest) HasIsis() bool { + return obj.obj.Isis != nil +} + +// description is TBD +// SetIsis sets the IsisMetricsRequest value in the MetricsRequest object +func (obj *metricsRequest) SetIsis(value IsisMetricsRequest) MetricsRequest { + obj.setChoice(MetricsRequestChoice.ISIS) + obj.isisHolder = nil + obj.obj.Isis = value.msg() + + return obj +} + +// description is TBD +// Lag returns a LagMetricsRequest +func (obj *metricsRequest) Lag() LagMetricsRequest { + if obj.obj.Lag == nil { + obj.setChoice(MetricsRequestChoice.LAG) + } + if obj.lagHolder == nil { + obj.lagHolder = &lagMetricsRequest{obj: obj.obj.Lag} + } + return obj.lagHolder +} + +// description is TBD +// Lag returns a LagMetricsRequest +func (obj *metricsRequest) HasLag() bool { + return obj.obj.Lag != nil +} + +// description is TBD +// SetLag sets the LagMetricsRequest value in the MetricsRequest object +func (obj *metricsRequest) SetLag(value LagMetricsRequest) MetricsRequest { + obj.setChoice(MetricsRequestChoice.LAG) + obj.lagHolder = nil + obj.obj.Lag = value.msg() + + return obj +} + +// description is TBD +// Lacp returns a LacpMetricsRequest +func (obj *metricsRequest) Lacp() LacpMetricsRequest { + if obj.obj.Lacp == nil { + obj.setChoice(MetricsRequestChoice.LACP) + } + if obj.lacpHolder == nil { + obj.lacpHolder = &lacpMetricsRequest{obj: obj.obj.Lacp} + } + return obj.lacpHolder +} + +// description is TBD +// Lacp returns a LacpMetricsRequest +func (obj *metricsRequest) HasLacp() bool { + return obj.obj.Lacp != nil +} + +// description is TBD +// SetLacp sets the LacpMetricsRequest value in the MetricsRequest object +func (obj *metricsRequest) SetLacp(value LacpMetricsRequest) MetricsRequest { + obj.setChoice(MetricsRequestChoice.LACP) + obj.lacpHolder = nil + obj.obj.Lacp = value.msg() + + return obj +} + +// description is TBD +// Lldp returns a LldpMetricsRequest +func (obj *metricsRequest) Lldp() LldpMetricsRequest { + if obj.obj.Lldp == nil { + obj.setChoice(MetricsRequestChoice.LLDP) + } + if obj.lldpHolder == nil { + obj.lldpHolder = &lldpMetricsRequest{obj: obj.obj.Lldp} + } + return obj.lldpHolder +} + +// description is TBD +// Lldp returns a LldpMetricsRequest +func (obj *metricsRequest) HasLldp() bool { + return obj.obj.Lldp != nil +} + +// description is TBD +// SetLldp sets the LldpMetricsRequest value in the MetricsRequest object +func (obj *metricsRequest) SetLldp(value LldpMetricsRequest) MetricsRequest { + obj.setChoice(MetricsRequestChoice.LLDP) + obj.lldpHolder = nil + obj.obj.Lldp = value.msg() + + return obj +} + +// description is TBD +// Rsvp returns a RsvpMetricsRequest +func (obj *metricsRequest) Rsvp() RsvpMetricsRequest { + if obj.obj.Rsvp == nil { + obj.setChoice(MetricsRequestChoice.RSVP) + } + if obj.rsvpHolder == nil { + obj.rsvpHolder = &rsvpMetricsRequest{obj: obj.obj.Rsvp} + } + return obj.rsvpHolder +} + +// description is TBD +// Rsvp returns a RsvpMetricsRequest +func (obj *metricsRequest) HasRsvp() bool { + return obj.obj.Rsvp != nil +} + +// description is TBD +// SetRsvp sets the RsvpMetricsRequest value in the MetricsRequest object +func (obj *metricsRequest) SetRsvp(value RsvpMetricsRequest) MetricsRequest { + obj.setChoice(MetricsRequestChoice.RSVP) + obj.rsvpHolder = nil + obj.obj.Rsvp = value.msg() + + return obj +} + +// description is TBD +// Dhcpv4Client returns a Dhcpv4ClientMetricsRequest +func (obj *metricsRequest) Dhcpv4Client() Dhcpv4ClientMetricsRequest { + if obj.obj.Dhcpv4Client == nil { + obj.setChoice(MetricsRequestChoice.DHCPV4_CLIENT) + } + if obj.dhcpv4ClientHolder == nil { + obj.dhcpv4ClientHolder = &dhcpv4ClientMetricsRequest{obj: obj.obj.Dhcpv4Client} + } + return obj.dhcpv4ClientHolder +} + +// description is TBD +// Dhcpv4Client returns a Dhcpv4ClientMetricsRequest +func (obj *metricsRequest) HasDhcpv4Client() bool { + return obj.obj.Dhcpv4Client != nil +} + +// description is TBD +// SetDhcpv4Client sets the Dhcpv4ClientMetricsRequest value in the MetricsRequest object +func (obj *metricsRequest) SetDhcpv4Client(value Dhcpv4ClientMetricsRequest) MetricsRequest { + obj.setChoice(MetricsRequestChoice.DHCPV4_CLIENT) + obj.dhcpv4ClientHolder = nil + obj.obj.Dhcpv4Client = value.msg() + + return obj +} + +// description is TBD +// Dhcpv4Server returns a Dhcpv4ServerMetricsRequest +func (obj *metricsRequest) Dhcpv4Server() Dhcpv4ServerMetricsRequest { + if obj.obj.Dhcpv4Server == nil { + obj.setChoice(MetricsRequestChoice.DHCPV4_SERVER) + } + if obj.dhcpv4ServerHolder == nil { + obj.dhcpv4ServerHolder = &dhcpv4ServerMetricsRequest{obj: obj.obj.Dhcpv4Server} + } + return obj.dhcpv4ServerHolder +} + +// description is TBD +// Dhcpv4Server returns a Dhcpv4ServerMetricsRequest +func (obj *metricsRequest) HasDhcpv4Server() bool { + return obj.obj.Dhcpv4Server != nil +} + +// description is TBD +// SetDhcpv4Server sets the Dhcpv4ServerMetricsRequest value in the MetricsRequest object +func (obj *metricsRequest) SetDhcpv4Server(value Dhcpv4ServerMetricsRequest) MetricsRequest { + obj.setChoice(MetricsRequestChoice.DHCPV4_SERVER) + obj.dhcpv4ServerHolder = nil + obj.obj.Dhcpv4Server = value.msg() + + return obj +} + +func (obj *metricsRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Port != nil { + + obj.Port().validateObj(vObj, set_default) + } + + if obj.obj.Flow != nil { + + obj.Flow().validateObj(vObj, set_default) + } + + if obj.obj.Bgpv4 != nil { + + obj.Bgpv4().validateObj(vObj, set_default) + } + + if obj.obj.Bgpv6 != nil { + + obj.Bgpv6().validateObj(vObj, set_default) + } + + if obj.obj.Isis != nil { + + obj.Isis().validateObj(vObj, set_default) + } + + if obj.obj.Lag != nil { + + obj.Lag().validateObj(vObj, set_default) + } + + if obj.obj.Lacp != nil { + + obj.Lacp().validateObj(vObj, set_default) + } + + if obj.obj.Lldp != nil { + + obj.Lldp().validateObj(vObj, set_default) + } + + if obj.obj.Rsvp != nil { + + obj.Rsvp().validateObj(vObj, set_default) + } + + if obj.obj.Dhcpv4Client != nil { + + obj.Dhcpv4Client().validateObj(vObj, set_default) + } + + if obj.obj.Dhcpv4Server != nil { + + obj.Dhcpv4Server().validateObj(vObj, set_default) + } + +} + +func (obj *metricsRequest) setDefault() { + var choices_set int = 0 + var choice MetricsRequestChoiceEnum + + if obj.obj.Port != nil { + choices_set += 1 + choice = MetricsRequestChoice.PORT + } + + if obj.obj.Flow != nil { + choices_set += 1 + choice = MetricsRequestChoice.FLOW + } + + if obj.obj.Bgpv4 != nil { + choices_set += 1 + choice = MetricsRequestChoice.BGPV4 + } + + if obj.obj.Bgpv6 != nil { + choices_set += 1 + choice = MetricsRequestChoice.BGPV6 + } + + if obj.obj.Isis != nil { + choices_set += 1 + choice = MetricsRequestChoice.ISIS + } + + if obj.obj.Lag != nil { + choices_set += 1 + choice = MetricsRequestChoice.LAG + } + + if obj.obj.Lacp != nil { + choices_set += 1 + choice = MetricsRequestChoice.LACP + } + + if obj.obj.Lldp != nil { + choices_set += 1 + choice = MetricsRequestChoice.LLDP + } + + if obj.obj.Rsvp != nil { + choices_set += 1 + choice = MetricsRequestChoice.RSVP + } + + if obj.obj.Dhcpv4Client != nil { + choices_set += 1 + choice = MetricsRequestChoice.DHCPV4_CLIENT + } + + if obj.obj.Dhcpv4Server != nil { + choices_set += 1 + choice = MetricsRequestChoice.DHCPV4_SERVER + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(MetricsRequestChoice.PORT) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in MetricsRequest") + } + } else { + intVal := otg.MetricsRequest_Choice_Enum_value[string(choice)] + enumValue := otg.MetricsRequest_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/metrics_response.go b/gosnappi/metrics_response.go new file mode 100644 index 00000000..7719521c --- /dev/null +++ b/gosnappi/metrics_response.go @@ -0,0 +1,1630 @@ +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" +) + +// ***** MetricsResponse ***** +type metricsResponse struct { + validation + obj *otg.MetricsResponse + marshaller marshalMetricsResponse + unMarshaller unMarshalMetricsResponse + portMetricsHolder MetricsResponsePortMetricIter + flowMetricsHolder MetricsResponseFlowMetricIter + bgpv4MetricsHolder MetricsResponseBgpv4MetricIter + bgpv6MetricsHolder MetricsResponseBgpv6MetricIter + isisMetricsHolder MetricsResponseIsisMetricIter + lagMetricsHolder MetricsResponseLagMetricIter + lacpMetricsHolder MetricsResponseLacpMetricIter + lldpMetricsHolder MetricsResponseLldpMetricIter + rsvpMetricsHolder MetricsResponseRsvpMetricIter + dhcpv4ClientMetricsHolder MetricsResponseDhcpv4ClientMetricIter + dhcpv4ServerMetricsHolder MetricsResponseDhcpv4ServerMetricIter +} + +func NewMetricsResponse() MetricsResponse { + obj := metricsResponse{obj: &otg.MetricsResponse{}} + obj.setDefault() + return &obj +} + +func (obj *metricsResponse) msg() *otg.MetricsResponse { + return obj.obj +} + +func (obj *metricsResponse) setMsg(msg *otg.MetricsResponse) MetricsResponse { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalmetricsResponse struct { + obj *metricsResponse +} + +type marshalMetricsResponse interface { + // ToProto marshals MetricsResponse to protobuf object *otg.MetricsResponse + ToProto() (*otg.MetricsResponse, error) + // ToPbText marshals MetricsResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals MetricsResponse to YAML text + ToYaml() (string, error) + // ToJson marshals MetricsResponse to JSON text + ToJson() (string, error) +} + +type unMarshalmetricsResponse struct { + obj *metricsResponse +} + +type unMarshalMetricsResponse interface { + // FromProto unmarshals MetricsResponse from protobuf object *otg.MetricsResponse + FromProto(msg *otg.MetricsResponse) (MetricsResponse, error) + // FromPbText unmarshals MetricsResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals MetricsResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals MetricsResponse from JSON text + FromJson(value string) error +} + +func (obj *metricsResponse) Marshal() marshalMetricsResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalmetricsResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *metricsResponse) Unmarshal() unMarshalMetricsResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalmetricsResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalmetricsResponse) ToProto() (*otg.MetricsResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalmetricsResponse) FromProto(msg *otg.MetricsResponse) (MetricsResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalmetricsResponse) 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 *unMarshalmetricsResponse) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalmetricsResponse) 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 *unMarshalmetricsResponse) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalmetricsResponse) 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 *unMarshalmetricsResponse) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *metricsResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *metricsResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *metricsResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *metricsResponse) Clone() (MetricsResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewMetricsResponse() + 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 +} + +func (obj *metricsResponse) setNil() { + obj.portMetricsHolder = nil + obj.flowMetricsHolder = nil + obj.bgpv4MetricsHolder = nil + obj.bgpv6MetricsHolder = nil + obj.isisMetricsHolder = nil + obj.lagMetricsHolder = nil + obj.lacpMetricsHolder = nil + obj.lldpMetricsHolder = nil + obj.rsvpMetricsHolder = nil + obj.dhcpv4ClientMetricsHolder = nil + obj.dhcpv4ServerMetricsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// MetricsResponse is response containing chosen traffic generator metrics. +type MetricsResponse interface { + Validation + // msg marshals MetricsResponse to protobuf object *otg.MetricsResponse + // and doesn't set defaults + msg() *otg.MetricsResponse + // setMsg unmarshals MetricsResponse from protobuf object *otg.MetricsResponse + // and doesn't set defaults + setMsg(*otg.MetricsResponse) MetricsResponse + // provides marshal interface + Marshal() marshalMetricsResponse + // provides unmarshal interface + Unmarshal() unMarshalMetricsResponse + // validate validates MetricsResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (MetricsResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns MetricsResponseChoiceEnum, set in MetricsResponse + Choice() MetricsResponseChoiceEnum + // setChoice assigns MetricsResponseChoiceEnum provided by user to MetricsResponse + 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() + // PortMetrics returns MetricsResponsePortMetricIterIter, set in MetricsResponse + PortMetrics() MetricsResponsePortMetricIter + // FlowMetrics returns MetricsResponseFlowMetricIterIter, set in MetricsResponse + FlowMetrics() MetricsResponseFlowMetricIter + // Bgpv4Metrics returns MetricsResponseBgpv4MetricIterIter, set in MetricsResponse + Bgpv4Metrics() MetricsResponseBgpv4MetricIter + // Bgpv6Metrics returns MetricsResponseBgpv6MetricIterIter, set in MetricsResponse + Bgpv6Metrics() MetricsResponseBgpv6MetricIter + // IsisMetrics returns MetricsResponseIsisMetricIterIter, set in MetricsResponse + IsisMetrics() MetricsResponseIsisMetricIter + // LagMetrics returns MetricsResponseLagMetricIterIter, set in MetricsResponse + LagMetrics() MetricsResponseLagMetricIter + // LacpMetrics returns MetricsResponseLacpMetricIterIter, set in MetricsResponse + LacpMetrics() MetricsResponseLacpMetricIter + // LldpMetrics returns MetricsResponseLldpMetricIterIter, set in MetricsResponse + LldpMetrics() MetricsResponseLldpMetricIter + // RsvpMetrics returns MetricsResponseRsvpMetricIterIter, set in MetricsResponse + RsvpMetrics() MetricsResponseRsvpMetricIter + // Dhcpv4ClientMetrics returns MetricsResponseDhcpv4ClientMetricIterIter, set in MetricsResponse + Dhcpv4ClientMetrics() MetricsResponseDhcpv4ClientMetricIter + // Dhcpv4ServerMetrics returns MetricsResponseDhcpv4ServerMetricIterIter, set in MetricsResponse + Dhcpv4ServerMetrics() MetricsResponseDhcpv4ServerMetricIter + setNil() +} + +type MetricsResponseChoiceEnum string + +// Enum of Choice on MetricsResponse +var MetricsResponseChoice = struct { + FLOW_METRICS MetricsResponseChoiceEnum + PORT_METRICS MetricsResponseChoiceEnum + BGPV4_METRICS MetricsResponseChoiceEnum + BGPV6_METRICS MetricsResponseChoiceEnum + ISIS_METRICS MetricsResponseChoiceEnum + LAG_METRICS MetricsResponseChoiceEnum + LACP_METRICS MetricsResponseChoiceEnum + LLDP_METRICS MetricsResponseChoiceEnum + RSVP_METRICS MetricsResponseChoiceEnum + DHCPV4_CLIENT MetricsResponseChoiceEnum + DHCPV4_SERVER MetricsResponseChoiceEnum +}{ + FLOW_METRICS: MetricsResponseChoiceEnum("flow_metrics"), + PORT_METRICS: MetricsResponseChoiceEnum("port_metrics"), + BGPV4_METRICS: MetricsResponseChoiceEnum("bgpv4_metrics"), + BGPV6_METRICS: MetricsResponseChoiceEnum("bgpv6_metrics"), + ISIS_METRICS: MetricsResponseChoiceEnum("isis_metrics"), + LAG_METRICS: MetricsResponseChoiceEnum("lag_metrics"), + LACP_METRICS: MetricsResponseChoiceEnum("lacp_metrics"), + LLDP_METRICS: MetricsResponseChoiceEnum("lldp_metrics"), + RSVP_METRICS: MetricsResponseChoiceEnum("rsvp_metrics"), + DHCPV4_CLIENT: MetricsResponseChoiceEnum("dhcpv4_client"), + DHCPV4_SERVER: MetricsResponseChoiceEnum("dhcpv4_server"), +} + +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) +} + +// description is TBD +// Choice returns a string +func (obj *metricsResponse) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *metricsResponse) setChoice(value MetricsResponseChoiceEnum) MetricsResponse { + intValue, ok := otg.MetricsResponse_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on MetricsResponseChoiceEnum", string(value))) + return obj + } + enumValue := otg.MetricsResponse_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.RsvpMetrics = nil + obj.rsvpMetricsHolder = nil + obj.obj.LldpMetrics = nil + obj.lldpMetricsHolder = nil + obj.obj.LacpMetrics = nil + obj.lacpMetricsHolder = nil + obj.obj.LagMetrics = nil + obj.lagMetricsHolder = nil + obj.obj.IsisMetrics = nil + obj.isisMetricsHolder = nil + obj.obj.Bgpv6Metrics = nil + obj.bgpv6MetricsHolder = nil + obj.obj.Bgpv4Metrics = nil + obj.bgpv4MetricsHolder = nil + obj.obj.FlowMetrics = nil + obj.flowMetricsHolder = nil + obj.obj.PortMetrics = nil + obj.portMetricsHolder = nil + + if value == MetricsResponseChoice.PORT_METRICS { + obj.obj.PortMetrics = []*otg.PortMetric{} + } + + if value == MetricsResponseChoice.FLOW_METRICS { + obj.obj.FlowMetrics = []*otg.FlowMetric{} + } + + if value == MetricsResponseChoice.BGPV4_METRICS { + obj.obj.Bgpv4Metrics = []*otg.Bgpv4Metric{} + } + + if value == MetricsResponseChoice.BGPV6_METRICS { + obj.obj.Bgpv6Metrics = []*otg.Bgpv6Metric{} + } + + if value == MetricsResponseChoice.ISIS_METRICS { + obj.obj.IsisMetrics = []*otg.IsisMetric{} + } + + if value == MetricsResponseChoice.LAG_METRICS { + obj.obj.LagMetrics = []*otg.LagMetric{} + } + + if value == MetricsResponseChoice.LACP_METRICS { + obj.obj.LacpMetrics = []*otg.LacpMetric{} + } + + if value == MetricsResponseChoice.LLDP_METRICS { + obj.obj.LldpMetrics = []*otg.LldpMetric{} + } + + if value == MetricsResponseChoice.RSVP_METRICS { + obj.obj.RsvpMetrics = []*otg.RsvpMetric{} + } + + return obj +} + +// description is TBD +// PortMetrics returns a []PortMetric +func (obj *metricsResponse) PortMetrics() MetricsResponsePortMetricIter { + if len(obj.obj.PortMetrics) == 0 { + obj.setChoice(MetricsResponseChoice.PORT_METRICS) + } + if obj.portMetricsHolder == nil { + obj.portMetricsHolder = newMetricsResponsePortMetricIter(&obj.obj.PortMetrics).setMsg(obj) + } + return obj.portMetricsHolder +} + +type metricsResponsePortMetricIter struct { + obj *metricsResponse + portMetricSlice []PortMetric + fieldPtr *[]*otg.PortMetric +} + +func newMetricsResponsePortMetricIter(ptr *[]*otg.PortMetric) MetricsResponsePortMetricIter { + return &metricsResponsePortMetricIter{fieldPtr: ptr} +} + +type MetricsResponsePortMetricIter interface { + setMsg(*metricsResponse) MetricsResponsePortMetricIter + Items() []PortMetric + Add() PortMetric + Append(items ...PortMetric) MetricsResponsePortMetricIter + Set(index int, newObj PortMetric) MetricsResponsePortMetricIter + Clear() MetricsResponsePortMetricIter + clearHolderSlice() MetricsResponsePortMetricIter + appendHolderSlice(item PortMetric) MetricsResponsePortMetricIter +} + +func (obj *metricsResponsePortMetricIter) setMsg(msg *metricsResponse) MetricsResponsePortMetricIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&portMetric{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *metricsResponsePortMetricIter) Items() []PortMetric { + return obj.portMetricSlice +} + +func (obj *metricsResponsePortMetricIter) Add() PortMetric { + newObj := &otg.PortMetric{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &portMetric{obj: newObj} + newLibObj.setDefault() + obj.portMetricSlice = append(obj.portMetricSlice, newLibObj) + return newLibObj +} + +func (obj *metricsResponsePortMetricIter) Append(items ...PortMetric) MetricsResponsePortMetricIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.portMetricSlice = append(obj.portMetricSlice, item) + } + return obj +} + +func (obj *metricsResponsePortMetricIter) Set(index int, newObj PortMetric) MetricsResponsePortMetricIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.portMetricSlice[index] = newObj + return obj +} +func (obj *metricsResponsePortMetricIter) Clear() MetricsResponsePortMetricIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PortMetric{} + obj.portMetricSlice = []PortMetric{} + } + return obj +} +func (obj *metricsResponsePortMetricIter) clearHolderSlice() MetricsResponsePortMetricIter { + if len(obj.portMetricSlice) > 0 { + obj.portMetricSlice = []PortMetric{} + } + return obj +} +func (obj *metricsResponsePortMetricIter) appendHolderSlice(item PortMetric) MetricsResponsePortMetricIter { + obj.portMetricSlice = append(obj.portMetricSlice, item) + return obj +} + +// description is TBD +// FlowMetrics returns a []FlowMetric +func (obj *metricsResponse) FlowMetrics() MetricsResponseFlowMetricIter { + if len(obj.obj.FlowMetrics) == 0 { + obj.setChoice(MetricsResponseChoice.FLOW_METRICS) + } + if obj.flowMetricsHolder == nil { + obj.flowMetricsHolder = newMetricsResponseFlowMetricIter(&obj.obj.FlowMetrics).setMsg(obj) + } + return obj.flowMetricsHolder +} + +type metricsResponseFlowMetricIter struct { + obj *metricsResponse + flowMetricSlice []FlowMetric + fieldPtr *[]*otg.FlowMetric +} + +func newMetricsResponseFlowMetricIter(ptr *[]*otg.FlowMetric) MetricsResponseFlowMetricIter { + return &metricsResponseFlowMetricIter{fieldPtr: ptr} +} + +type MetricsResponseFlowMetricIter interface { + setMsg(*metricsResponse) MetricsResponseFlowMetricIter + Items() []FlowMetric + Add() FlowMetric + Append(items ...FlowMetric) MetricsResponseFlowMetricIter + Set(index int, newObj FlowMetric) MetricsResponseFlowMetricIter + Clear() MetricsResponseFlowMetricIter + clearHolderSlice() MetricsResponseFlowMetricIter + appendHolderSlice(item FlowMetric) MetricsResponseFlowMetricIter +} + +func (obj *metricsResponseFlowMetricIter) setMsg(msg *metricsResponse) MetricsResponseFlowMetricIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&flowMetric{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *metricsResponseFlowMetricIter) Items() []FlowMetric { + return obj.flowMetricSlice +} + +func (obj *metricsResponseFlowMetricIter) Add() FlowMetric { + newObj := &otg.FlowMetric{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &flowMetric{obj: newObj} + newLibObj.setDefault() + obj.flowMetricSlice = append(obj.flowMetricSlice, newLibObj) + return newLibObj +} + +func (obj *metricsResponseFlowMetricIter) Append(items ...FlowMetric) MetricsResponseFlowMetricIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.flowMetricSlice = append(obj.flowMetricSlice, item) + } + return obj +} + +func (obj *metricsResponseFlowMetricIter) Set(index int, newObj FlowMetric) MetricsResponseFlowMetricIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.flowMetricSlice[index] = newObj + return obj +} +func (obj *metricsResponseFlowMetricIter) Clear() MetricsResponseFlowMetricIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.FlowMetric{} + obj.flowMetricSlice = []FlowMetric{} + } + return obj +} +func (obj *metricsResponseFlowMetricIter) clearHolderSlice() MetricsResponseFlowMetricIter { + if len(obj.flowMetricSlice) > 0 { + obj.flowMetricSlice = []FlowMetric{} + } + return obj +} +func (obj *metricsResponseFlowMetricIter) appendHolderSlice(item FlowMetric) MetricsResponseFlowMetricIter { + obj.flowMetricSlice = append(obj.flowMetricSlice, item) + return obj +} + +// description is TBD +// Bgpv4Metrics returns a []Bgpv4Metric +func (obj *metricsResponse) Bgpv4Metrics() MetricsResponseBgpv4MetricIter { + if len(obj.obj.Bgpv4Metrics) == 0 { + obj.setChoice(MetricsResponseChoice.BGPV4_METRICS) + } + if obj.bgpv4MetricsHolder == nil { + obj.bgpv4MetricsHolder = newMetricsResponseBgpv4MetricIter(&obj.obj.Bgpv4Metrics).setMsg(obj) + } + return obj.bgpv4MetricsHolder +} + +type metricsResponseBgpv4MetricIter struct { + obj *metricsResponse + bgpv4MetricSlice []Bgpv4Metric + fieldPtr *[]*otg.Bgpv4Metric +} + +func newMetricsResponseBgpv4MetricIter(ptr *[]*otg.Bgpv4Metric) MetricsResponseBgpv4MetricIter { + return &metricsResponseBgpv4MetricIter{fieldPtr: ptr} +} + +type MetricsResponseBgpv4MetricIter interface { + setMsg(*metricsResponse) MetricsResponseBgpv4MetricIter + Items() []Bgpv4Metric + Add() Bgpv4Metric + Append(items ...Bgpv4Metric) MetricsResponseBgpv4MetricIter + Set(index int, newObj Bgpv4Metric) MetricsResponseBgpv4MetricIter + Clear() MetricsResponseBgpv4MetricIter + clearHolderSlice() MetricsResponseBgpv4MetricIter + appendHolderSlice(item Bgpv4Metric) MetricsResponseBgpv4MetricIter +} + +func (obj *metricsResponseBgpv4MetricIter) setMsg(msg *metricsResponse) MetricsResponseBgpv4MetricIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpv4Metric{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *metricsResponseBgpv4MetricIter) Items() []Bgpv4Metric { + return obj.bgpv4MetricSlice +} + +func (obj *metricsResponseBgpv4MetricIter) Add() Bgpv4Metric { + newObj := &otg.Bgpv4Metric{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpv4Metric{obj: newObj} + newLibObj.setDefault() + obj.bgpv4MetricSlice = append(obj.bgpv4MetricSlice, newLibObj) + return newLibObj +} + +func (obj *metricsResponseBgpv4MetricIter) Append(items ...Bgpv4Metric) MetricsResponseBgpv4MetricIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpv4MetricSlice = append(obj.bgpv4MetricSlice, item) + } + return obj +} + +func (obj *metricsResponseBgpv4MetricIter) Set(index int, newObj Bgpv4Metric) MetricsResponseBgpv4MetricIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpv4MetricSlice[index] = newObj + return obj +} +func (obj *metricsResponseBgpv4MetricIter) Clear() MetricsResponseBgpv4MetricIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Bgpv4Metric{} + obj.bgpv4MetricSlice = []Bgpv4Metric{} + } + return obj +} +func (obj *metricsResponseBgpv4MetricIter) clearHolderSlice() MetricsResponseBgpv4MetricIter { + if len(obj.bgpv4MetricSlice) > 0 { + obj.bgpv4MetricSlice = []Bgpv4Metric{} + } + return obj +} +func (obj *metricsResponseBgpv4MetricIter) appendHolderSlice(item Bgpv4Metric) MetricsResponseBgpv4MetricIter { + obj.bgpv4MetricSlice = append(obj.bgpv4MetricSlice, item) + return obj +} + +// description is TBD +// Bgpv6Metrics returns a []Bgpv6Metric +func (obj *metricsResponse) Bgpv6Metrics() MetricsResponseBgpv6MetricIter { + if len(obj.obj.Bgpv6Metrics) == 0 { + obj.setChoice(MetricsResponseChoice.BGPV6_METRICS) + } + if obj.bgpv6MetricsHolder == nil { + obj.bgpv6MetricsHolder = newMetricsResponseBgpv6MetricIter(&obj.obj.Bgpv6Metrics).setMsg(obj) + } + return obj.bgpv6MetricsHolder +} + +type metricsResponseBgpv6MetricIter struct { + obj *metricsResponse + bgpv6MetricSlice []Bgpv6Metric + fieldPtr *[]*otg.Bgpv6Metric +} + +func newMetricsResponseBgpv6MetricIter(ptr *[]*otg.Bgpv6Metric) MetricsResponseBgpv6MetricIter { + return &metricsResponseBgpv6MetricIter{fieldPtr: ptr} +} + +type MetricsResponseBgpv6MetricIter interface { + setMsg(*metricsResponse) MetricsResponseBgpv6MetricIter + Items() []Bgpv6Metric + Add() Bgpv6Metric + Append(items ...Bgpv6Metric) MetricsResponseBgpv6MetricIter + Set(index int, newObj Bgpv6Metric) MetricsResponseBgpv6MetricIter + Clear() MetricsResponseBgpv6MetricIter + clearHolderSlice() MetricsResponseBgpv6MetricIter + appendHolderSlice(item Bgpv6Metric) MetricsResponseBgpv6MetricIter +} + +func (obj *metricsResponseBgpv6MetricIter) setMsg(msg *metricsResponse) MetricsResponseBgpv6MetricIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpv6Metric{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *metricsResponseBgpv6MetricIter) Items() []Bgpv6Metric { + return obj.bgpv6MetricSlice +} + +func (obj *metricsResponseBgpv6MetricIter) Add() Bgpv6Metric { + newObj := &otg.Bgpv6Metric{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpv6Metric{obj: newObj} + newLibObj.setDefault() + obj.bgpv6MetricSlice = append(obj.bgpv6MetricSlice, newLibObj) + return newLibObj +} + +func (obj *metricsResponseBgpv6MetricIter) Append(items ...Bgpv6Metric) MetricsResponseBgpv6MetricIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpv6MetricSlice = append(obj.bgpv6MetricSlice, item) + } + return obj +} + +func (obj *metricsResponseBgpv6MetricIter) Set(index int, newObj Bgpv6Metric) MetricsResponseBgpv6MetricIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpv6MetricSlice[index] = newObj + return obj +} +func (obj *metricsResponseBgpv6MetricIter) Clear() MetricsResponseBgpv6MetricIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Bgpv6Metric{} + obj.bgpv6MetricSlice = []Bgpv6Metric{} + } + return obj +} +func (obj *metricsResponseBgpv6MetricIter) clearHolderSlice() MetricsResponseBgpv6MetricIter { + if len(obj.bgpv6MetricSlice) > 0 { + obj.bgpv6MetricSlice = []Bgpv6Metric{} + } + return obj +} +func (obj *metricsResponseBgpv6MetricIter) appendHolderSlice(item Bgpv6Metric) MetricsResponseBgpv6MetricIter { + obj.bgpv6MetricSlice = append(obj.bgpv6MetricSlice, item) + return obj +} + +// description is TBD +// IsisMetrics returns a []IsisMetric +func (obj *metricsResponse) IsisMetrics() MetricsResponseIsisMetricIter { + if len(obj.obj.IsisMetrics) == 0 { + obj.setChoice(MetricsResponseChoice.ISIS_METRICS) + } + if obj.isisMetricsHolder == nil { + obj.isisMetricsHolder = newMetricsResponseIsisMetricIter(&obj.obj.IsisMetrics).setMsg(obj) + } + return obj.isisMetricsHolder +} + +type metricsResponseIsisMetricIter struct { + obj *metricsResponse + isisMetricSlice []IsisMetric + fieldPtr *[]*otg.IsisMetric +} + +func newMetricsResponseIsisMetricIter(ptr *[]*otg.IsisMetric) MetricsResponseIsisMetricIter { + return &metricsResponseIsisMetricIter{fieldPtr: ptr} +} + +type MetricsResponseIsisMetricIter interface { + setMsg(*metricsResponse) MetricsResponseIsisMetricIter + Items() []IsisMetric + Add() IsisMetric + Append(items ...IsisMetric) MetricsResponseIsisMetricIter + Set(index int, newObj IsisMetric) MetricsResponseIsisMetricIter + Clear() MetricsResponseIsisMetricIter + clearHolderSlice() MetricsResponseIsisMetricIter + appendHolderSlice(item IsisMetric) MetricsResponseIsisMetricIter +} + +func (obj *metricsResponseIsisMetricIter) setMsg(msg *metricsResponse) MetricsResponseIsisMetricIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisMetric{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *metricsResponseIsisMetricIter) Items() []IsisMetric { + return obj.isisMetricSlice +} + +func (obj *metricsResponseIsisMetricIter) Add() IsisMetric { + newObj := &otg.IsisMetric{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisMetric{obj: newObj} + newLibObj.setDefault() + obj.isisMetricSlice = append(obj.isisMetricSlice, newLibObj) + return newLibObj +} + +func (obj *metricsResponseIsisMetricIter) Append(items ...IsisMetric) MetricsResponseIsisMetricIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisMetricSlice = append(obj.isisMetricSlice, item) + } + return obj +} + +func (obj *metricsResponseIsisMetricIter) Set(index int, newObj IsisMetric) MetricsResponseIsisMetricIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisMetricSlice[index] = newObj + return obj +} +func (obj *metricsResponseIsisMetricIter) Clear() MetricsResponseIsisMetricIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisMetric{} + obj.isisMetricSlice = []IsisMetric{} + } + return obj +} +func (obj *metricsResponseIsisMetricIter) clearHolderSlice() MetricsResponseIsisMetricIter { + if len(obj.isisMetricSlice) > 0 { + obj.isisMetricSlice = []IsisMetric{} + } + return obj +} +func (obj *metricsResponseIsisMetricIter) appendHolderSlice(item IsisMetric) MetricsResponseIsisMetricIter { + obj.isisMetricSlice = append(obj.isisMetricSlice, item) + return obj +} + +// description is TBD +// LagMetrics returns a []LagMetric +func (obj *metricsResponse) LagMetrics() MetricsResponseLagMetricIter { + if len(obj.obj.LagMetrics) == 0 { + obj.setChoice(MetricsResponseChoice.LAG_METRICS) + } + if obj.lagMetricsHolder == nil { + obj.lagMetricsHolder = newMetricsResponseLagMetricIter(&obj.obj.LagMetrics).setMsg(obj) + } + return obj.lagMetricsHolder +} + +type metricsResponseLagMetricIter struct { + obj *metricsResponse + lagMetricSlice []LagMetric + fieldPtr *[]*otg.LagMetric +} + +func newMetricsResponseLagMetricIter(ptr *[]*otg.LagMetric) MetricsResponseLagMetricIter { + return &metricsResponseLagMetricIter{fieldPtr: ptr} +} + +type MetricsResponseLagMetricIter interface { + setMsg(*metricsResponse) MetricsResponseLagMetricIter + Items() []LagMetric + Add() LagMetric + Append(items ...LagMetric) MetricsResponseLagMetricIter + Set(index int, newObj LagMetric) MetricsResponseLagMetricIter + Clear() MetricsResponseLagMetricIter + clearHolderSlice() MetricsResponseLagMetricIter + appendHolderSlice(item LagMetric) MetricsResponseLagMetricIter +} + +func (obj *metricsResponseLagMetricIter) setMsg(msg *metricsResponse) MetricsResponseLagMetricIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&lagMetric{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *metricsResponseLagMetricIter) Items() []LagMetric { + return obj.lagMetricSlice +} + +func (obj *metricsResponseLagMetricIter) Add() LagMetric { + newObj := &otg.LagMetric{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &lagMetric{obj: newObj} + newLibObj.setDefault() + obj.lagMetricSlice = append(obj.lagMetricSlice, newLibObj) + return newLibObj +} + +func (obj *metricsResponseLagMetricIter) Append(items ...LagMetric) MetricsResponseLagMetricIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.lagMetricSlice = append(obj.lagMetricSlice, item) + } + return obj +} + +func (obj *metricsResponseLagMetricIter) Set(index int, newObj LagMetric) MetricsResponseLagMetricIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.lagMetricSlice[index] = newObj + return obj +} +func (obj *metricsResponseLagMetricIter) Clear() MetricsResponseLagMetricIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.LagMetric{} + obj.lagMetricSlice = []LagMetric{} + } + return obj +} +func (obj *metricsResponseLagMetricIter) clearHolderSlice() MetricsResponseLagMetricIter { + if len(obj.lagMetricSlice) > 0 { + obj.lagMetricSlice = []LagMetric{} + } + return obj +} +func (obj *metricsResponseLagMetricIter) appendHolderSlice(item LagMetric) MetricsResponseLagMetricIter { + obj.lagMetricSlice = append(obj.lagMetricSlice, item) + return obj +} + +// description is TBD +// LacpMetrics returns a []LacpMetric +func (obj *metricsResponse) LacpMetrics() MetricsResponseLacpMetricIter { + if len(obj.obj.LacpMetrics) == 0 { + obj.setChoice(MetricsResponseChoice.LACP_METRICS) + } + if obj.lacpMetricsHolder == nil { + obj.lacpMetricsHolder = newMetricsResponseLacpMetricIter(&obj.obj.LacpMetrics).setMsg(obj) + } + return obj.lacpMetricsHolder +} + +type metricsResponseLacpMetricIter struct { + obj *metricsResponse + lacpMetricSlice []LacpMetric + fieldPtr *[]*otg.LacpMetric +} + +func newMetricsResponseLacpMetricIter(ptr *[]*otg.LacpMetric) MetricsResponseLacpMetricIter { + return &metricsResponseLacpMetricIter{fieldPtr: ptr} +} + +type MetricsResponseLacpMetricIter interface { + setMsg(*metricsResponse) MetricsResponseLacpMetricIter + Items() []LacpMetric + Add() LacpMetric + Append(items ...LacpMetric) MetricsResponseLacpMetricIter + Set(index int, newObj LacpMetric) MetricsResponseLacpMetricIter + Clear() MetricsResponseLacpMetricIter + clearHolderSlice() MetricsResponseLacpMetricIter + appendHolderSlice(item LacpMetric) MetricsResponseLacpMetricIter +} + +func (obj *metricsResponseLacpMetricIter) setMsg(msg *metricsResponse) MetricsResponseLacpMetricIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&lacpMetric{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *metricsResponseLacpMetricIter) Items() []LacpMetric { + return obj.lacpMetricSlice +} + +func (obj *metricsResponseLacpMetricIter) Add() LacpMetric { + newObj := &otg.LacpMetric{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &lacpMetric{obj: newObj} + newLibObj.setDefault() + obj.lacpMetricSlice = append(obj.lacpMetricSlice, newLibObj) + return newLibObj +} + +func (obj *metricsResponseLacpMetricIter) Append(items ...LacpMetric) MetricsResponseLacpMetricIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.lacpMetricSlice = append(obj.lacpMetricSlice, item) + } + return obj +} + +func (obj *metricsResponseLacpMetricIter) Set(index int, newObj LacpMetric) MetricsResponseLacpMetricIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.lacpMetricSlice[index] = newObj + return obj +} +func (obj *metricsResponseLacpMetricIter) Clear() MetricsResponseLacpMetricIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.LacpMetric{} + obj.lacpMetricSlice = []LacpMetric{} + } + return obj +} +func (obj *metricsResponseLacpMetricIter) clearHolderSlice() MetricsResponseLacpMetricIter { + if len(obj.lacpMetricSlice) > 0 { + obj.lacpMetricSlice = []LacpMetric{} + } + return obj +} +func (obj *metricsResponseLacpMetricIter) appendHolderSlice(item LacpMetric) MetricsResponseLacpMetricIter { + obj.lacpMetricSlice = append(obj.lacpMetricSlice, item) + return obj +} + +// description is TBD +// LldpMetrics returns a []LldpMetric +func (obj *metricsResponse) LldpMetrics() MetricsResponseLldpMetricIter { + if len(obj.obj.LldpMetrics) == 0 { + obj.setChoice(MetricsResponseChoice.LLDP_METRICS) + } + if obj.lldpMetricsHolder == nil { + obj.lldpMetricsHolder = newMetricsResponseLldpMetricIter(&obj.obj.LldpMetrics).setMsg(obj) + } + return obj.lldpMetricsHolder +} + +type metricsResponseLldpMetricIter struct { + obj *metricsResponse + lldpMetricSlice []LldpMetric + fieldPtr *[]*otg.LldpMetric +} + +func newMetricsResponseLldpMetricIter(ptr *[]*otg.LldpMetric) MetricsResponseLldpMetricIter { + return &metricsResponseLldpMetricIter{fieldPtr: ptr} +} + +type MetricsResponseLldpMetricIter interface { + setMsg(*metricsResponse) MetricsResponseLldpMetricIter + Items() []LldpMetric + Add() LldpMetric + Append(items ...LldpMetric) MetricsResponseLldpMetricIter + Set(index int, newObj LldpMetric) MetricsResponseLldpMetricIter + Clear() MetricsResponseLldpMetricIter + clearHolderSlice() MetricsResponseLldpMetricIter + appendHolderSlice(item LldpMetric) MetricsResponseLldpMetricIter +} + +func (obj *metricsResponseLldpMetricIter) setMsg(msg *metricsResponse) MetricsResponseLldpMetricIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&lldpMetric{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *metricsResponseLldpMetricIter) Items() []LldpMetric { + return obj.lldpMetricSlice +} + +func (obj *metricsResponseLldpMetricIter) Add() LldpMetric { + newObj := &otg.LldpMetric{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &lldpMetric{obj: newObj} + newLibObj.setDefault() + obj.lldpMetricSlice = append(obj.lldpMetricSlice, newLibObj) + return newLibObj +} + +func (obj *metricsResponseLldpMetricIter) Append(items ...LldpMetric) MetricsResponseLldpMetricIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.lldpMetricSlice = append(obj.lldpMetricSlice, item) + } + return obj +} + +func (obj *metricsResponseLldpMetricIter) Set(index int, newObj LldpMetric) MetricsResponseLldpMetricIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.lldpMetricSlice[index] = newObj + return obj +} +func (obj *metricsResponseLldpMetricIter) Clear() MetricsResponseLldpMetricIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.LldpMetric{} + obj.lldpMetricSlice = []LldpMetric{} + } + return obj +} +func (obj *metricsResponseLldpMetricIter) clearHolderSlice() MetricsResponseLldpMetricIter { + if len(obj.lldpMetricSlice) > 0 { + obj.lldpMetricSlice = []LldpMetric{} + } + return obj +} +func (obj *metricsResponseLldpMetricIter) appendHolderSlice(item LldpMetric) MetricsResponseLldpMetricIter { + obj.lldpMetricSlice = append(obj.lldpMetricSlice, item) + return obj +} + +// description is TBD +// RsvpMetrics returns a []RsvpMetric +func (obj *metricsResponse) RsvpMetrics() MetricsResponseRsvpMetricIter { + if len(obj.obj.RsvpMetrics) == 0 { + obj.setChoice(MetricsResponseChoice.RSVP_METRICS) + } + if obj.rsvpMetricsHolder == nil { + obj.rsvpMetricsHolder = newMetricsResponseRsvpMetricIter(&obj.obj.RsvpMetrics).setMsg(obj) + } + return obj.rsvpMetricsHolder +} + +type metricsResponseRsvpMetricIter struct { + obj *metricsResponse + rsvpMetricSlice []RsvpMetric + fieldPtr *[]*otg.RsvpMetric +} + +func newMetricsResponseRsvpMetricIter(ptr *[]*otg.RsvpMetric) MetricsResponseRsvpMetricIter { + return &metricsResponseRsvpMetricIter{fieldPtr: ptr} +} + +type MetricsResponseRsvpMetricIter interface { + setMsg(*metricsResponse) MetricsResponseRsvpMetricIter + Items() []RsvpMetric + Add() RsvpMetric + Append(items ...RsvpMetric) MetricsResponseRsvpMetricIter + Set(index int, newObj RsvpMetric) MetricsResponseRsvpMetricIter + Clear() MetricsResponseRsvpMetricIter + clearHolderSlice() MetricsResponseRsvpMetricIter + appendHolderSlice(item RsvpMetric) MetricsResponseRsvpMetricIter +} + +func (obj *metricsResponseRsvpMetricIter) setMsg(msg *metricsResponse) MetricsResponseRsvpMetricIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&rsvpMetric{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *metricsResponseRsvpMetricIter) Items() []RsvpMetric { + return obj.rsvpMetricSlice +} + +func (obj *metricsResponseRsvpMetricIter) Add() RsvpMetric { + newObj := &otg.RsvpMetric{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &rsvpMetric{obj: newObj} + newLibObj.setDefault() + obj.rsvpMetricSlice = append(obj.rsvpMetricSlice, newLibObj) + return newLibObj +} + +func (obj *metricsResponseRsvpMetricIter) Append(items ...RsvpMetric) MetricsResponseRsvpMetricIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.rsvpMetricSlice = append(obj.rsvpMetricSlice, item) + } + return obj +} + +func (obj *metricsResponseRsvpMetricIter) Set(index int, newObj RsvpMetric) MetricsResponseRsvpMetricIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.rsvpMetricSlice[index] = newObj + return obj +} +func (obj *metricsResponseRsvpMetricIter) Clear() MetricsResponseRsvpMetricIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.RsvpMetric{} + obj.rsvpMetricSlice = []RsvpMetric{} + } + return obj +} +func (obj *metricsResponseRsvpMetricIter) clearHolderSlice() MetricsResponseRsvpMetricIter { + if len(obj.rsvpMetricSlice) > 0 { + obj.rsvpMetricSlice = []RsvpMetric{} + } + return obj +} +func (obj *metricsResponseRsvpMetricIter) appendHolderSlice(item RsvpMetric) MetricsResponseRsvpMetricIter { + obj.rsvpMetricSlice = append(obj.rsvpMetricSlice, item) + return obj +} + +// description is TBD +// Dhcpv4ClientMetrics returns a []Dhcpv4ClientMetric +func (obj *metricsResponse) Dhcpv4ClientMetrics() MetricsResponseDhcpv4ClientMetricIter { + if len(obj.obj.Dhcpv4ClientMetrics) == 0 { + obj.obj.Dhcpv4ClientMetrics = []*otg.Dhcpv4ClientMetric{} + } + if obj.dhcpv4ClientMetricsHolder == nil { + obj.dhcpv4ClientMetricsHolder = newMetricsResponseDhcpv4ClientMetricIter(&obj.obj.Dhcpv4ClientMetrics).setMsg(obj) + } + return obj.dhcpv4ClientMetricsHolder +} + +type metricsResponseDhcpv4ClientMetricIter struct { + obj *metricsResponse + dhcpv4ClientMetricSlice []Dhcpv4ClientMetric + fieldPtr *[]*otg.Dhcpv4ClientMetric +} + +func newMetricsResponseDhcpv4ClientMetricIter(ptr *[]*otg.Dhcpv4ClientMetric) MetricsResponseDhcpv4ClientMetricIter { + return &metricsResponseDhcpv4ClientMetricIter{fieldPtr: ptr} +} + +type MetricsResponseDhcpv4ClientMetricIter interface { + setMsg(*metricsResponse) MetricsResponseDhcpv4ClientMetricIter + Items() []Dhcpv4ClientMetric + Add() Dhcpv4ClientMetric + Append(items ...Dhcpv4ClientMetric) MetricsResponseDhcpv4ClientMetricIter + Set(index int, newObj Dhcpv4ClientMetric) MetricsResponseDhcpv4ClientMetricIter + Clear() MetricsResponseDhcpv4ClientMetricIter + clearHolderSlice() MetricsResponseDhcpv4ClientMetricIter + appendHolderSlice(item Dhcpv4ClientMetric) MetricsResponseDhcpv4ClientMetricIter +} + +func (obj *metricsResponseDhcpv4ClientMetricIter) setMsg(msg *metricsResponse) MetricsResponseDhcpv4ClientMetricIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&dhcpv4ClientMetric{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *metricsResponseDhcpv4ClientMetricIter) Items() []Dhcpv4ClientMetric { + return obj.dhcpv4ClientMetricSlice +} + +func (obj *metricsResponseDhcpv4ClientMetricIter) Add() Dhcpv4ClientMetric { + newObj := &otg.Dhcpv4ClientMetric{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &dhcpv4ClientMetric{obj: newObj} + newLibObj.setDefault() + obj.dhcpv4ClientMetricSlice = append(obj.dhcpv4ClientMetricSlice, newLibObj) + return newLibObj +} + +func (obj *metricsResponseDhcpv4ClientMetricIter) Append(items ...Dhcpv4ClientMetric) MetricsResponseDhcpv4ClientMetricIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.dhcpv4ClientMetricSlice = append(obj.dhcpv4ClientMetricSlice, item) + } + return obj +} + +func (obj *metricsResponseDhcpv4ClientMetricIter) Set(index int, newObj Dhcpv4ClientMetric) MetricsResponseDhcpv4ClientMetricIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.dhcpv4ClientMetricSlice[index] = newObj + return obj +} +func (obj *metricsResponseDhcpv4ClientMetricIter) Clear() MetricsResponseDhcpv4ClientMetricIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Dhcpv4ClientMetric{} + obj.dhcpv4ClientMetricSlice = []Dhcpv4ClientMetric{} + } + return obj +} +func (obj *metricsResponseDhcpv4ClientMetricIter) clearHolderSlice() MetricsResponseDhcpv4ClientMetricIter { + if len(obj.dhcpv4ClientMetricSlice) > 0 { + obj.dhcpv4ClientMetricSlice = []Dhcpv4ClientMetric{} + } + return obj +} +func (obj *metricsResponseDhcpv4ClientMetricIter) appendHolderSlice(item Dhcpv4ClientMetric) MetricsResponseDhcpv4ClientMetricIter { + obj.dhcpv4ClientMetricSlice = append(obj.dhcpv4ClientMetricSlice, item) + return obj +} + +// description is TBD +// Dhcpv4ServerMetrics returns a []Dhcpv4ServerMetric +func (obj *metricsResponse) Dhcpv4ServerMetrics() MetricsResponseDhcpv4ServerMetricIter { + if len(obj.obj.Dhcpv4ServerMetrics) == 0 { + obj.obj.Dhcpv4ServerMetrics = []*otg.Dhcpv4ServerMetric{} + } + if obj.dhcpv4ServerMetricsHolder == nil { + obj.dhcpv4ServerMetricsHolder = newMetricsResponseDhcpv4ServerMetricIter(&obj.obj.Dhcpv4ServerMetrics).setMsg(obj) + } + return obj.dhcpv4ServerMetricsHolder +} + +type metricsResponseDhcpv4ServerMetricIter struct { + obj *metricsResponse + dhcpv4ServerMetricSlice []Dhcpv4ServerMetric + fieldPtr *[]*otg.Dhcpv4ServerMetric +} + +func newMetricsResponseDhcpv4ServerMetricIter(ptr *[]*otg.Dhcpv4ServerMetric) MetricsResponseDhcpv4ServerMetricIter { + return &metricsResponseDhcpv4ServerMetricIter{fieldPtr: ptr} +} + +type MetricsResponseDhcpv4ServerMetricIter interface { + setMsg(*metricsResponse) MetricsResponseDhcpv4ServerMetricIter + Items() []Dhcpv4ServerMetric + Add() Dhcpv4ServerMetric + Append(items ...Dhcpv4ServerMetric) MetricsResponseDhcpv4ServerMetricIter + Set(index int, newObj Dhcpv4ServerMetric) MetricsResponseDhcpv4ServerMetricIter + Clear() MetricsResponseDhcpv4ServerMetricIter + clearHolderSlice() MetricsResponseDhcpv4ServerMetricIter + appendHolderSlice(item Dhcpv4ServerMetric) MetricsResponseDhcpv4ServerMetricIter +} + +func (obj *metricsResponseDhcpv4ServerMetricIter) setMsg(msg *metricsResponse) MetricsResponseDhcpv4ServerMetricIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&dhcpv4ServerMetric{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *metricsResponseDhcpv4ServerMetricIter) Items() []Dhcpv4ServerMetric { + return obj.dhcpv4ServerMetricSlice +} + +func (obj *metricsResponseDhcpv4ServerMetricIter) Add() Dhcpv4ServerMetric { + newObj := &otg.Dhcpv4ServerMetric{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &dhcpv4ServerMetric{obj: newObj} + newLibObj.setDefault() + obj.dhcpv4ServerMetricSlice = append(obj.dhcpv4ServerMetricSlice, newLibObj) + return newLibObj +} + +func (obj *metricsResponseDhcpv4ServerMetricIter) Append(items ...Dhcpv4ServerMetric) MetricsResponseDhcpv4ServerMetricIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.dhcpv4ServerMetricSlice = append(obj.dhcpv4ServerMetricSlice, item) + } + return obj +} + +func (obj *metricsResponseDhcpv4ServerMetricIter) Set(index int, newObj Dhcpv4ServerMetric) MetricsResponseDhcpv4ServerMetricIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.dhcpv4ServerMetricSlice[index] = newObj + return obj +} +func (obj *metricsResponseDhcpv4ServerMetricIter) Clear() MetricsResponseDhcpv4ServerMetricIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Dhcpv4ServerMetric{} + obj.dhcpv4ServerMetricSlice = []Dhcpv4ServerMetric{} + } + return obj +} +func (obj *metricsResponseDhcpv4ServerMetricIter) clearHolderSlice() MetricsResponseDhcpv4ServerMetricIter { + if len(obj.dhcpv4ServerMetricSlice) > 0 { + obj.dhcpv4ServerMetricSlice = []Dhcpv4ServerMetric{} + } + return obj +} +func (obj *metricsResponseDhcpv4ServerMetricIter) appendHolderSlice(item Dhcpv4ServerMetric) MetricsResponseDhcpv4ServerMetricIter { + obj.dhcpv4ServerMetricSlice = append(obj.dhcpv4ServerMetricSlice, item) + return obj +} + +func (obj *metricsResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.PortMetrics) != 0 { + + if set_default { + obj.PortMetrics().clearHolderSlice() + for _, item := range obj.obj.PortMetrics { + obj.PortMetrics().appendHolderSlice(&portMetric{obj: item}) + } + } + for _, item := range obj.PortMetrics().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.FlowMetrics) != 0 { + + if set_default { + obj.FlowMetrics().clearHolderSlice() + for _, item := range obj.obj.FlowMetrics { + obj.FlowMetrics().appendHolderSlice(&flowMetric{obj: item}) + } + } + for _, item := range obj.FlowMetrics().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Bgpv4Metrics) != 0 { + + if set_default { + obj.Bgpv4Metrics().clearHolderSlice() + for _, item := range obj.obj.Bgpv4Metrics { + obj.Bgpv4Metrics().appendHolderSlice(&bgpv4Metric{obj: item}) + } + } + for _, item := range obj.Bgpv4Metrics().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Bgpv6Metrics) != 0 { + + if set_default { + obj.Bgpv6Metrics().clearHolderSlice() + for _, item := range obj.obj.Bgpv6Metrics { + obj.Bgpv6Metrics().appendHolderSlice(&bgpv6Metric{obj: item}) + } + } + for _, item := range obj.Bgpv6Metrics().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.IsisMetrics) != 0 { + + if set_default { + obj.IsisMetrics().clearHolderSlice() + for _, item := range obj.obj.IsisMetrics { + obj.IsisMetrics().appendHolderSlice(&isisMetric{obj: item}) + } + } + for _, item := range obj.IsisMetrics().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.LagMetrics) != 0 { + + if set_default { + obj.LagMetrics().clearHolderSlice() + for _, item := range obj.obj.LagMetrics { + obj.LagMetrics().appendHolderSlice(&lagMetric{obj: item}) + } + } + for _, item := range obj.LagMetrics().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.LacpMetrics) != 0 { + + if set_default { + obj.LacpMetrics().clearHolderSlice() + for _, item := range obj.obj.LacpMetrics { + obj.LacpMetrics().appendHolderSlice(&lacpMetric{obj: item}) + } + } + for _, item := range obj.LacpMetrics().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.LldpMetrics) != 0 { + + if set_default { + obj.LldpMetrics().clearHolderSlice() + for _, item := range obj.obj.LldpMetrics { + obj.LldpMetrics().appendHolderSlice(&lldpMetric{obj: item}) + } + } + for _, item := range obj.LldpMetrics().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.RsvpMetrics) != 0 { + + if set_default { + obj.RsvpMetrics().clearHolderSlice() + for _, item := range obj.obj.RsvpMetrics { + obj.RsvpMetrics().appendHolderSlice(&rsvpMetric{obj: item}) + } + } + for _, item := range obj.RsvpMetrics().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Dhcpv4ClientMetrics) != 0 { + + if set_default { + obj.Dhcpv4ClientMetrics().clearHolderSlice() + for _, item := range obj.obj.Dhcpv4ClientMetrics { + obj.Dhcpv4ClientMetrics().appendHolderSlice(&dhcpv4ClientMetric{obj: item}) + } + } + for _, item := range obj.Dhcpv4ClientMetrics().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Dhcpv4ServerMetrics) != 0 { + + if set_default { + obj.Dhcpv4ServerMetrics().clearHolderSlice() + for _, item := range obj.obj.Dhcpv4ServerMetrics { + obj.Dhcpv4ServerMetrics().appendHolderSlice(&dhcpv4ServerMetric{obj: item}) + } + } + for _, item := range obj.Dhcpv4ServerMetrics().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *metricsResponse) setDefault() { + var choices_set int = 0 + var choice MetricsResponseChoiceEnum + + if len(obj.obj.FlowMetrics) > 0 { + choices_set += 1 + choice = MetricsResponseChoice.FLOW_METRICS + } + + if len(obj.obj.PortMetrics) > 0 { + choices_set += 1 + choice = MetricsResponseChoice.PORT_METRICS + } + + if len(obj.obj.Bgpv4Metrics) > 0 { + choices_set += 1 + choice = MetricsResponseChoice.BGPV4_METRICS + } + + if len(obj.obj.Bgpv6Metrics) > 0 { + choices_set += 1 + choice = MetricsResponseChoice.BGPV6_METRICS + } + + if len(obj.obj.IsisMetrics) > 0 { + choices_set += 1 + choice = MetricsResponseChoice.ISIS_METRICS + } + + if len(obj.obj.LagMetrics) > 0 { + choices_set += 1 + choice = MetricsResponseChoice.LAG_METRICS + } + + if len(obj.obj.LacpMetrics) > 0 { + choices_set += 1 + choice = MetricsResponseChoice.LACP_METRICS + } + + if len(obj.obj.LldpMetrics) > 0 { + choices_set += 1 + choice = MetricsResponseChoice.LLDP_METRICS + } + + if len(obj.obj.RsvpMetrics) > 0 { + choices_set += 1 + choice = MetricsResponseChoice.RSVP_METRICS + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(MetricsResponseChoice.PORT_METRICS) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in MetricsResponse") + } + } else { + intVal := otg.MetricsResponse_Choice_Enum_value[string(choice)] + enumValue := otg.MetricsResponse_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/neighborsv4_state.go b/gosnappi/neighborsv4_state.go new file mode 100644 index 00000000..46ad8fca --- /dev/null +++ b/gosnappi/neighborsv4_state.go @@ -0,0 +1,373 @@ +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" +) + +// ***** Neighborsv4State ***** +type neighborsv4State struct { + validation + obj *otg.Neighborsv4State + marshaller marshalNeighborsv4State + unMarshaller unMarshalNeighborsv4State +} + +func NewNeighborsv4State() Neighborsv4State { + obj := neighborsv4State{obj: &otg.Neighborsv4State{}} + obj.setDefault() + return &obj +} + +func (obj *neighborsv4State) msg() *otg.Neighborsv4State { + return obj.obj +} + +func (obj *neighborsv4State) setMsg(msg *otg.Neighborsv4State) Neighborsv4State { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalneighborsv4State struct { + obj *neighborsv4State +} + +type marshalNeighborsv4State interface { + // ToProto marshals Neighborsv4State to protobuf object *otg.Neighborsv4State + ToProto() (*otg.Neighborsv4State, error) + // ToPbText marshals Neighborsv4State to protobuf text + ToPbText() (string, error) + // ToYaml marshals Neighborsv4State to YAML text + ToYaml() (string, error) + // ToJson marshals Neighborsv4State to JSON text + ToJson() (string, error) +} + +type unMarshalneighborsv4State struct { + obj *neighborsv4State +} + +type unMarshalNeighborsv4State interface { + // FromProto unmarshals Neighborsv4State from protobuf object *otg.Neighborsv4State + FromProto(msg *otg.Neighborsv4State) (Neighborsv4State, error) + // FromPbText unmarshals Neighborsv4State from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Neighborsv4State from YAML text + FromYaml(value string) error + // FromJson unmarshals Neighborsv4State from JSON text + FromJson(value string) error +} + +func (obj *neighborsv4State) Marshal() marshalNeighborsv4State { + if obj.marshaller == nil { + obj.marshaller = &marshalneighborsv4State{obj: obj} + } + return obj.marshaller +} + +func (obj *neighborsv4State) Unmarshal() unMarshalNeighborsv4State { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalneighborsv4State{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalneighborsv4State) ToProto() (*otg.Neighborsv4State, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalneighborsv4State) FromProto(msg *otg.Neighborsv4State) (Neighborsv4State, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalneighborsv4State) 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 *unMarshalneighborsv4State) 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 *marshalneighborsv4State) 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 *unMarshalneighborsv4State) 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 *marshalneighborsv4State) 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 *unMarshalneighborsv4State) 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 *neighborsv4State) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *neighborsv4State) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *neighborsv4State) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *neighborsv4State) Clone() (Neighborsv4State, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewNeighborsv4State() + 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 +} + +// Neighborsv4State is iPv4 Neighbor state (ARP cache entry). +type Neighborsv4State interface { + Validation + // msg marshals Neighborsv4State to protobuf object *otg.Neighborsv4State + // and doesn't set defaults + msg() *otg.Neighborsv4State + // setMsg unmarshals Neighborsv4State from protobuf object *otg.Neighborsv4State + // and doesn't set defaults + setMsg(*otg.Neighborsv4State) Neighborsv4State + // provides marshal interface + Marshal() marshalNeighborsv4State + // provides unmarshal interface + Unmarshal() unMarshalNeighborsv4State + // validate validates Neighborsv4State + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Neighborsv4State, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // EthernetName returns string, set in Neighborsv4State. + EthernetName() string + // SetEthernetName assigns string provided by user to Neighborsv4State + SetEthernetName(value string) Neighborsv4State + // Ipv4Address returns string, set in Neighborsv4State. + Ipv4Address() string + // SetIpv4Address assigns string provided by user to Neighborsv4State + SetIpv4Address(value string) Neighborsv4State + // LinkLayerAddress returns string, set in Neighborsv4State. + LinkLayerAddress() string + // SetLinkLayerAddress assigns string provided by user to Neighborsv4State + SetLinkLayerAddress(value string) Neighborsv4State + // HasLinkLayerAddress checks if LinkLayerAddress has been set in Neighborsv4State + HasLinkLayerAddress() bool +} + +// The name of the Ethernet interface associated with the Neighbor state (ARP cache entry). +// EthernetName returns a string +func (obj *neighborsv4State) EthernetName() string { + + return *obj.obj.EthernetName + +} + +// The name of the Ethernet interface associated with the Neighbor state (ARP cache entry). +// SetEthernetName sets the string value in the Neighborsv4State object +func (obj *neighborsv4State) SetEthernetName(value string) Neighborsv4State { + + obj.obj.EthernetName = &value + return obj +} + +// The IPv4 address of the neighbor. +// Ipv4Address returns a string +func (obj *neighborsv4State) Ipv4Address() string { + + return *obj.obj.Ipv4Address + +} + +// The IPv4 address of the neighbor. +// SetIpv4Address sets the string value in the Neighborsv4State object +func (obj *neighborsv4State) SetIpv4Address(value string) Neighborsv4State { + + obj.obj.Ipv4Address = &value + return obj +} + +// The link-layer address (MAC) of the neighbor. +// LinkLayerAddress returns a string +func (obj *neighborsv4State) LinkLayerAddress() string { + + return *obj.obj.LinkLayerAddress + +} + +// The link-layer address (MAC) of the neighbor. +// LinkLayerAddress returns a string +func (obj *neighborsv4State) HasLinkLayerAddress() bool { + return obj.obj.LinkLayerAddress != nil +} + +// The link-layer address (MAC) of the neighbor. +// SetLinkLayerAddress sets the string value in the Neighborsv4State object +func (obj *neighborsv4State) SetLinkLayerAddress(value string) Neighborsv4State { + + obj.obj.LinkLayerAddress = &value + return obj +} + +func (obj *neighborsv4State) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // EthernetName is required + if obj.obj.EthernetName == nil { + vObj.validationErrors = append(vObj.validationErrors, "EthernetName is required field on interface Neighborsv4State") + } + + // Ipv4Address is required + if obj.obj.Ipv4Address == nil { + vObj.validationErrors = append(vObj.validationErrors, "Ipv4Address is required field on interface Neighborsv4State") + } + if obj.obj.Ipv4Address != nil { + + err := obj.validateIpv4(obj.Ipv4Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on Neighborsv4State.Ipv4Address")) + } + + } + + if obj.obj.LinkLayerAddress != nil { + + err := obj.validateMac(obj.LinkLayerAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on Neighborsv4State.LinkLayerAddress")) + } + + } + +} + +func (obj *neighborsv4State) setDefault() { + +} diff --git a/gosnappi/neighborsv4_states_request.go b/gosnappi/neighborsv4_states_request.go new file mode 100644 index 00000000..b4a71c89 --- /dev/null +++ b/gosnappi/neighborsv4_states_request.go @@ -0,0 +1,317 @@ +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" +) + +// ***** Neighborsv4StatesRequest ***** +type neighborsv4StatesRequest struct { + validation + obj *otg.Neighborsv4StatesRequest + marshaller marshalNeighborsv4StatesRequest + unMarshaller unMarshalNeighborsv4StatesRequest +} + +func NewNeighborsv4StatesRequest() Neighborsv4StatesRequest { + obj := neighborsv4StatesRequest{obj: &otg.Neighborsv4StatesRequest{}} + obj.setDefault() + return &obj +} + +func (obj *neighborsv4StatesRequest) msg() *otg.Neighborsv4StatesRequest { + return obj.obj +} + +func (obj *neighborsv4StatesRequest) setMsg(msg *otg.Neighborsv4StatesRequest) Neighborsv4StatesRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalneighborsv4StatesRequest struct { + obj *neighborsv4StatesRequest +} + +type marshalNeighborsv4StatesRequest interface { + // ToProto marshals Neighborsv4StatesRequest to protobuf object *otg.Neighborsv4StatesRequest + ToProto() (*otg.Neighborsv4StatesRequest, error) + // ToPbText marshals Neighborsv4StatesRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals Neighborsv4StatesRequest to YAML text + ToYaml() (string, error) + // ToJson marshals Neighborsv4StatesRequest to JSON text + ToJson() (string, error) +} + +type unMarshalneighborsv4StatesRequest struct { + obj *neighborsv4StatesRequest +} + +type unMarshalNeighborsv4StatesRequest interface { + // FromProto unmarshals Neighborsv4StatesRequest from protobuf object *otg.Neighborsv4StatesRequest + FromProto(msg *otg.Neighborsv4StatesRequest) (Neighborsv4StatesRequest, error) + // FromPbText unmarshals Neighborsv4StatesRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Neighborsv4StatesRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals Neighborsv4StatesRequest from JSON text + FromJson(value string) error +} + +func (obj *neighborsv4StatesRequest) Marshal() marshalNeighborsv4StatesRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalneighborsv4StatesRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *neighborsv4StatesRequest) Unmarshal() unMarshalNeighborsv4StatesRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalneighborsv4StatesRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalneighborsv4StatesRequest) ToProto() (*otg.Neighborsv4StatesRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalneighborsv4StatesRequest) FromProto(msg *otg.Neighborsv4StatesRequest) (Neighborsv4StatesRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalneighborsv4StatesRequest) 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 *unMarshalneighborsv4StatesRequest) 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 *marshalneighborsv4StatesRequest) 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 *unMarshalneighborsv4StatesRequest) 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 *marshalneighborsv4StatesRequest) 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 *unMarshalneighborsv4StatesRequest) 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 *neighborsv4StatesRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *neighborsv4StatesRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *neighborsv4StatesRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *neighborsv4StatesRequest) Clone() (Neighborsv4StatesRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewNeighborsv4StatesRequest() + 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 +} + +// Neighborsv4StatesRequest is the request to retrieve IPv4 Neighbor state (ARP cache entries) of a network interface(s). +type Neighborsv4StatesRequest interface { + Validation + // msg marshals Neighborsv4StatesRequest to protobuf object *otg.Neighborsv4StatesRequest + // and doesn't set defaults + msg() *otg.Neighborsv4StatesRequest + // setMsg unmarshals Neighborsv4StatesRequest from protobuf object *otg.Neighborsv4StatesRequest + // and doesn't set defaults + setMsg(*otg.Neighborsv4StatesRequest) Neighborsv4StatesRequest + // provides marshal interface + Marshal() marshalNeighborsv4StatesRequest + // provides unmarshal interface + Unmarshal() unMarshalNeighborsv4StatesRequest + // validate validates Neighborsv4StatesRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Neighborsv4StatesRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // EthernetNames returns []string, set in Neighborsv4StatesRequest. + EthernetNames() []string + // SetEthernetNames assigns []string provided by user to Neighborsv4StatesRequest + SetEthernetNames(value []string) Neighborsv4StatesRequest +} + +// The names of Ethernet interfaces for which Neighbor state (ARP cache entries) will be retrieved. If no names are specified then the results will contain Neighbor state (ARP cache entries) for all available Ethernet interfaces. +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// EthernetNames returns a []string +func (obj *neighborsv4StatesRequest) EthernetNames() []string { + if obj.obj.EthernetNames == nil { + obj.obj.EthernetNames = make([]string, 0) + } + return obj.obj.EthernetNames +} + +// The names of Ethernet interfaces for which Neighbor state (ARP cache entries) will be retrieved. If no names are specified then the results will contain Neighbor state (ARP cache entries) for all available Ethernet interfaces. +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// SetEthernetNames sets the []string value in the Neighborsv4StatesRequest object +func (obj *neighborsv4StatesRequest) SetEthernetNames(value []string) Neighborsv4StatesRequest { + + if obj.obj.EthernetNames == nil { + obj.obj.EthernetNames = make([]string, 0) + } + obj.obj.EthernetNames = value + + return obj +} + +func (obj *neighborsv4StatesRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *neighborsv4StatesRequest) setDefault() { + +} diff --git a/gosnappi/neighborsv6_state.go b/gosnappi/neighborsv6_state.go new file mode 100644 index 00000000..8cdbc5fc --- /dev/null +++ b/gosnappi/neighborsv6_state.go @@ -0,0 +1,373 @@ +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" +) + +// ***** Neighborsv6State ***** +type neighborsv6State struct { + validation + obj *otg.Neighborsv6State + marshaller marshalNeighborsv6State + unMarshaller unMarshalNeighborsv6State +} + +func NewNeighborsv6State() Neighborsv6State { + obj := neighborsv6State{obj: &otg.Neighborsv6State{}} + obj.setDefault() + return &obj +} + +func (obj *neighborsv6State) msg() *otg.Neighborsv6State { + return obj.obj +} + +func (obj *neighborsv6State) setMsg(msg *otg.Neighborsv6State) Neighborsv6State { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalneighborsv6State struct { + obj *neighborsv6State +} + +type marshalNeighborsv6State interface { + // ToProto marshals Neighborsv6State to protobuf object *otg.Neighborsv6State + ToProto() (*otg.Neighborsv6State, error) + // ToPbText marshals Neighborsv6State to protobuf text + ToPbText() (string, error) + // ToYaml marshals Neighborsv6State to YAML text + ToYaml() (string, error) + // ToJson marshals Neighborsv6State to JSON text + ToJson() (string, error) +} + +type unMarshalneighborsv6State struct { + obj *neighborsv6State +} + +type unMarshalNeighborsv6State interface { + // FromProto unmarshals Neighborsv6State from protobuf object *otg.Neighborsv6State + FromProto(msg *otg.Neighborsv6State) (Neighborsv6State, error) + // FromPbText unmarshals Neighborsv6State from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Neighborsv6State from YAML text + FromYaml(value string) error + // FromJson unmarshals Neighborsv6State from JSON text + FromJson(value string) error +} + +func (obj *neighborsv6State) Marshal() marshalNeighborsv6State { + if obj.marshaller == nil { + obj.marshaller = &marshalneighborsv6State{obj: obj} + } + return obj.marshaller +} + +func (obj *neighborsv6State) Unmarshal() unMarshalNeighborsv6State { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalneighborsv6State{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalneighborsv6State) ToProto() (*otg.Neighborsv6State, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalneighborsv6State) FromProto(msg *otg.Neighborsv6State) (Neighborsv6State, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalneighborsv6State) 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 *unMarshalneighborsv6State) 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 *marshalneighborsv6State) 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 *unMarshalneighborsv6State) 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 *marshalneighborsv6State) 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 *unMarshalneighborsv6State) 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 *neighborsv6State) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *neighborsv6State) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *neighborsv6State) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *neighborsv6State) Clone() (Neighborsv6State, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewNeighborsv6State() + 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 +} + +// Neighborsv6State is iPv6 Neighbor state (NDISC cache entry). +type Neighborsv6State interface { + Validation + // msg marshals Neighborsv6State to protobuf object *otg.Neighborsv6State + // and doesn't set defaults + msg() *otg.Neighborsv6State + // setMsg unmarshals Neighborsv6State from protobuf object *otg.Neighborsv6State + // and doesn't set defaults + setMsg(*otg.Neighborsv6State) Neighborsv6State + // provides marshal interface + Marshal() marshalNeighborsv6State + // provides unmarshal interface + Unmarshal() unMarshalNeighborsv6State + // validate validates Neighborsv6State + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Neighborsv6State, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // EthernetName returns string, set in Neighborsv6State. + EthernetName() string + // SetEthernetName assigns string provided by user to Neighborsv6State + SetEthernetName(value string) Neighborsv6State + // Ipv6Address returns string, set in Neighborsv6State. + Ipv6Address() string + // SetIpv6Address assigns string provided by user to Neighborsv6State + SetIpv6Address(value string) Neighborsv6State + // LinkLayerAddress returns string, set in Neighborsv6State. + LinkLayerAddress() string + // SetLinkLayerAddress assigns string provided by user to Neighborsv6State + SetLinkLayerAddress(value string) Neighborsv6State + // HasLinkLayerAddress checks if LinkLayerAddress has been set in Neighborsv6State + HasLinkLayerAddress() bool +} + +// The name of the Ethernet interface associated with the Neighbor state (NDISC cache entry). +// EthernetName returns a string +func (obj *neighborsv6State) EthernetName() string { + + return *obj.obj.EthernetName + +} + +// The name of the Ethernet interface associated with the Neighbor state (NDISC cache entry). +// SetEthernetName sets the string value in the Neighborsv6State object +func (obj *neighborsv6State) SetEthernetName(value string) Neighborsv6State { + + obj.obj.EthernetName = &value + return obj +} + +// The IPv6 address of the neighbor. +// Ipv6Address returns a string +func (obj *neighborsv6State) Ipv6Address() string { + + return *obj.obj.Ipv6Address + +} + +// The IPv6 address of the neighbor. +// SetIpv6Address sets the string value in the Neighborsv6State object +func (obj *neighborsv6State) SetIpv6Address(value string) Neighborsv6State { + + obj.obj.Ipv6Address = &value + return obj +} + +// The link-layer address (MAC) of the neighbor. +// LinkLayerAddress returns a string +func (obj *neighborsv6State) LinkLayerAddress() string { + + return *obj.obj.LinkLayerAddress + +} + +// The link-layer address (MAC) of the neighbor. +// LinkLayerAddress returns a string +func (obj *neighborsv6State) HasLinkLayerAddress() bool { + return obj.obj.LinkLayerAddress != nil +} + +// The link-layer address (MAC) of the neighbor. +// SetLinkLayerAddress sets the string value in the Neighborsv6State object +func (obj *neighborsv6State) SetLinkLayerAddress(value string) Neighborsv6State { + + obj.obj.LinkLayerAddress = &value + return obj +} + +func (obj *neighborsv6State) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // EthernetName is required + if obj.obj.EthernetName == nil { + vObj.validationErrors = append(vObj.validationErrors, "EthernetName is required field on interface Neighborsv6State") + } + + // Ipv6Address is required + if obj.obj.Ipv6Address == nil { + vObj.validationErrors = append(vObj.validationErrors, "Ipv6Address is required field on interface Neighborsv6State") + } + if obj.obj.Ipv6Address != nil { + + err := obj.validateIpv6(obj.Ipv6Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on Neighborsv6State.Ipv6Address")) + } + + } + + if obj.obj.LinkLayerAddress != nil { + + err := obj.validateMac(obj.LinkLayerAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on Neighborsv6State.LinkLayerAddress")) + } + + } + +} + +func (obj *neighborsv6State) setDefault() { + +} diff --git a/gosnappi/neighborsv6_states_request.go b/gosnappi/neighborsv6_states_request.go new file mode 100644 index 00000000..60f8bfce --- /dev/null +++ b/gosnappi/neighborsv6_states_request.go @@ -0,0 +1,317 @@ +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" +) + +// ***** Neighborsv6StatesRequest ***** +type neighborsv6StatesRequest struct { + validation + obj *otg.Neighborsv6StatesRequest + marshaller marshalNeighborsv6StatesRequest + unMarshaller unMarshalNeighborsv6StatesRequest +} + +func NewNeighborsv6StatesRequest() Neighborsv6StatesRequest { + obj := neighborsv6StatesRequest{obj: &otg.Neighborsv6StatesRequest{}} + obj.setDefault() + return &obj +} + +func (obj *neighborsv6StatesRequest) msg() *otg.Neighborsv6StatesRequest { + return obj.obj +} + +func (obj *neighborsv6StatesRequest) setMsg(msg *otg.Neighborsv6StatesRequest) Neighborsv6StatesRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalneighborsv6StatesRequest struct { + obj *neighborsv6StatesRequest +} + +type marshalNeighborsv6StatesRequest interface { + // ToProto marshals Neighborsv6StatesRequest to protobuf object *otg.Neighborsv6StatesRequest + ToProto() (*otg.Neighborsv6StatesRequest, error) + // ToPbText marshals Neighborsv6StatesRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals Neighborsv6StatesRequest to YAML text + ToYaml() (string, error) + // ToJson marshals Neighborsv6StatesRequest to JSON text + ToJson() (string, error) +} + +type unMarshalneighborsv6StatesRequest struct { + obj *neighborsv6StatesRequest +} + +type unMarshalNeighborsv6StatesRequest interface { + // FromProto unmarshals Neighborsv6StatesRequest from protobuf object *otg.Neighborsv6StatesRequest + FromProto(msg *otg.Neighborsv6StatesRequest) (Neighborsv6StatesRequest, error) + // FromPbText unmarshals Neighborsv6StatesRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Neighborsv6StatesRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals Neighborsv6StatesRequest from JSON text + FromJson(value string) error +} + +func (obj *neighborsv6StatesRequest) Marshal() marshalNeighborsv6StatesRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalneighborsv6StatesRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *neighborsv6StatesRequest) Unmarshal() unMarshalNeighborsv6StatesRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalneighborsv6StatesRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalneighborsv6StatesRequest) ToProto() (*otg.Neighborsv6StatesRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalneighborsv6StatesRequest) FromProto(msg *otg.Neighborsv6StatesRequest) (Neighborsv6StatesRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalneighborsv6StatesRequest) 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 *unMarshalneighborsv6StatesRequest) 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 *marshalneighborsv6StatesRequest) 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 *unMarshalneighborsv6StatesRequest) 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 *marshalneighborsv6StatesRequest) 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 *unMarshalneighborsv6StatesRequest) 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 *neighborsv6StatesRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *neighborsv6StatesRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *neighborsv6StatesRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *neighborsv6StatesRequest) Clone() (Neighborsv6StatesRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewNeighborsv6StatesRequest() + 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 +} + +// Neighborsv6StatesRequest is the request to retrieve IPv6 Neighbor state (NDISC cache entries) of a network interface(s). +type Neighborsv6StatesRequest interface { + Validation + // msg marshals Neighborsv6StatesRequest to protobuf object *otg.Neighborsv6StatesRequest + // and doesn't set defaults + msg() *otg.Neighborsv6StatesRequest + // setMsg unmarshals Neighborsv6StatesRequest from protobuf object *otg.Neighborsv6StatesRequest + // and doesn't set defaults + setMsg(*otg.Neighborsv6StatesRequest) Neighborsv6StatesRequest + // provides marshal interface + Marshal() marshalNeighborsv6StatesRequest + // provides unmarshal interface + Unmarshal() unMarshalNeighborsv6StatesRequest + // validate validates Neighborsv6StatesRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Neighborsv6StatesRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // EthernetNames returns []string, set in Neighborsv6StatesRequest. + EthernetNames() []string + // SetEthernetNames assigns []string provided by user to Neighborsv6StatesRequest + SetEthernetNames(value []string) Neighborsv6StatesRequest +} + +// The names of Ethernet interfaces for which Neighbor state (NDISC cache entries) will be retrieved. If no names are specified then the results will contain Neighbor state (NDISC cache entries) for all available Ethernet interfaces. +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// EthernetNames returns a []string +func (obj *neighborsv6StatesRequest) EthernetNames() []string { + if obj.obj.EthernetNames == nil { + obj.obj.EthernetNames = make([]string, 0) + } + return obj.obj.EthernetNames +} + +// The names of Ethernet interfaces for which Neighbor state (NDISC cache entries) will be retrieved. If no names are specified then the results will contain Neighbor state (NDISC cache entries) for all available Ethernet interfaces. +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ethernet/properties/name +// +// SetEthernetNames sets the []string value in the Neighborsv6StatesRequest object +func (obj *neighborsv6StatesRequest) SetEthernetNames(value []string) Neighborsv6StatesRequest { + + if obj.obj.EthernetNames == nil { + obj.obj.EthernetNames = make([]string, 0) + } + obj.obj.EthernetNames = value + + return obj +} + +func (obj *neighborsv6StatesRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *neighborsv6StatesRequest) setDefault() { + +} diff --git a/gosnappi/pattern_flow_arp_hardware_length.go b/gosnappi/pattern_flow_arp_hardware_length.go new file mode 100644 index 00000000..3016d3bf --- /dev/null +++ b/gosnappi/pattern_flow_arp_hardware_length.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowArpHardwareLength ***** +type patternFlowArpHardwareLength struct { + validation + obj *otg.PatternFlowArpHardwareLength + marshaller marshalPatternFlowArpHardwareLength + unMarshaller unMarshalPatternFlowArpHardwareLength + incrementHolder PatternFlowArpHardwareLengthCounter + decrementHolder PatternFlowArpHardwareLengthCounter + metricTagsHolder PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter +} + +func NewPatternFlowArpHardwareLength() PatternFlowArpHardwareLength { + obj := patternFlowArpHardwareLength{obj: &otg.PatternFlowArpHardwareLength{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpHardwareLength) msg() *otg.PatternFlowArpHardwareLength { + return obj.obj +} + +func (obj *patternFlowArpHardwareLength) setMsg(msg *otg.PatternFlowArpHardwareLength) PatternFlowArpHardwareLength { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpHardwareLength struct { + obj *patternFlowArpHardwareLength +} + +type marshalPatternFlowArpHardwareLength interface { + // ToProto marshals PatternFlowArpHardwareLength to protobuf object *otg.PatternFlowArpHardwareLength + ToProto() (*otg.PatternFlowArpHardwareLength, error) + // ToPbText marshals PatternFlowArpHardwareLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpHardwareLength to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpHardwareLength to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpHardwareLength struct { + obj *patternFlowArpHardwareLength +} + +type unMarshalPatternFlowArpHardwareLength interface { + // FromProto unmarshals PatternFlowArpHardwareLength from protobuf object *otg.PatternFlowArpHardwareLength + FromProto(msg *otg.PatternFlowArpHardwareLength) (PatternFlowArpHardwareLength, error) + // FromPbText unmarshals PatternFlowArpHardwareLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpHardwareLength from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpHardwareLength from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpHardwareLength) Marshal() marshalPatternFlowArpHardwareLength { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpHardwareLength{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpHardwareLength) Unmarshal() unMarshalPatternFlowArpHardwareLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpHardwareLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpHardwareLength) ToProto() (*otg.PatternFlowArpHardwareLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpHardwareLength) FromProto(msg *otg.PatternFlowArpHardwareLength) (PatternFlowArpHardwareLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpHardwareLength) 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 *unMarshalpatternFlowArpHardwareLength) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowArpHardwareLength) 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 *unMarshalpatternFlowArpHardwareLength) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowArpHardwareLength) 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 *unMarshalpatternFlowArpHardwareLength) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowArpHardwareLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpHardwareLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpHardwareLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpHardwareLength) Clone() (PatternFlowArpHardwareLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpHardwareLength() + 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 +} + +func (obj *patternFlowArpHardwareLength) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowArpHardwareLength is length (in octets) of a hardware address +type PatternFlowArpHardwareLength interface { + Validation + // msg marshals PatternFlowArpHardwareLength to protobuf object *otg.PatternFlowArpHardwareLength + // and doesn't set defaults + msg() *otg.PatternFlowArpHardwareLength + // setMsg unmarshals PatternFlowArpHardwareLength from protobuf object *otg.PatternFlowArpHardwareLength + // and doesn't set defaults + setMsg(*otg.PatternFlowArpHardwareLength) PatternFlowArpHardwareLength + // provides marshal interface + Marshal() marshalPatternFlowArpHardwareLength + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpHardwareLength + // validate validates PatternFlowArpHardwareLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpHardwareLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowArpHardwareLengthChoiceEnum, set in PatternFlowArpHardwareLength + Choice() PatternFlowArpHardwareLengthChoiceEnum + // setChoice assigns PatternFlowArpHardwareLengthChoiceEnum provided by user to PatternFlowArpHardwareLength + setChoice(value PatternFlowArpHardwareLengthChoiceEnum) PatternFlowArpHardwareLength + // HasChoice checks if Choice has been set in PatternFlowArpHardwareLength + HasChoice() bool + // Value returns uint32, set in PatternFlowArpHardwareLength. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowArpHardwareLength + SetValue(value uint32) PatternFlowArpHardwareLength + // HasValue checks if Value has been set in PatternFlowArpHardwareLength + HasValue() bool + // Values returns []uint32, set in PatternFlowArpHardwareLength. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowArpHardwareLength + SetValues(value []uint32) PatternFlowArpHardwareLength + // Increment returns PatternFlowArpHardwareLengthCounter, set in PatternFlowArpHardwareLength. + // PatternFlowArpHardwareLengthCounter is integer counter pattern + Increment() PatternFlowArpHardwareLengthCounter + // SetIncrement assigns PatternFlowArpHardwareLengthCounter provided by user to PatternFlowArpHardwareLength. + // PatternFlowArpHardwareLengthCounter is integer counter pattern + SetIncrement(value PatternFlowArpHardwareLengthCounter) PatternFlowArpHardwareLength + // HasIncrement checks if Increment has been set in PatternFlowArpHardwareLength + HasIncrement() bool + // Decrement returns PatternFlowArpHardwareLengthCounter, set in PatternFlowArpHardwareLength. + // PatternFlowArpHardwareLengthCounter is integer counter pattern + Decrement() PatternFlowArpHardwareLengthCounter + // SetDecrement assigns PatternFlowArpHardwareLengthCounter provided by user to PatternFlowArpHardwareLength. + // PatternFlowArpHardwareLengthCounter is integer counter pattern + SetDecrement(value PatternFlowArpHardwareLengthCounter) PatternFlowArpHardwareLength + // HasDecrement checks if Decrement has been set in PatternFlowArpHardwareLength + HasDecrement() bool + // MetricTags returns PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIterIter, set in PatternFlowArpHardwareLength + MetricTags() PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter + setNil() +} + +type PatternFlowArpHardwareLengthChoiceEnum string + +// Enum of Choice on PatternFlowArpHardwareLength +var PatternFlowArpHardwareLengthChoice = struct { + VALUE PatternFlowArpHardwareLengthChoiceEnum + VALUES PatternFlowArpHardwareLengthChoiceEnum + INCREMENT PatternFlowArpHardwareLengthChoiceEnum + DECREMENT PatternFlowArpHardwareLengthChoiceEnum +}{ + VALUE: PatternFlowArpHardwareLengthChoiceEnum("value"), + VALUES: PatternFlowArpHardwareLengthChoiceEnum("values"), + INCREMENT: PatternFlowArpHardwareLengthChoiceEnum("increment"), + DECREMENT: PatternFlowArpHardwareLengthChoiceEnum("decrement"), +} + +func (obj *patternFlowArpHardwareLength) Choice() PatternFlowArpHardwareLengthChoiceEnum { + return PatternFlowArpHardwareLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowArpHardwareLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowArpHardwareLength) setChoice(value PatternFlowArpHardwareLengthChoiceEnum) PatternFlowArpHardwareLength { + intValue, ok := otg.PatternFlowArpHardwareLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowArpHardwareLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowArpHardwareLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowArpHardwareLengthChoice.VALUE { + defaultValue := uint32(6) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowArpHardwareLengthChoice.VALUES { + defaultValue := []uint32{6} + obj.obj.Values = defaultValue + } + + if value == PatternFlowArpHardwareLengthChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowArpHardwareLengthCounter().msg() + } + + if value == PatternFlowArpHardwareLengthChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowArpHardwareLengthCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowArpHardwareLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowArpHardwareLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowArpHardwareLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowArpHardwareLength object +func (obj *patternFlowArpHardwareLength) SetValue(value uint32) PatternFlowArpHardwareLength { + obj.setChoice(PatternFlowArpHardwareLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowArpHardwareLength) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{6}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowArpHardwareLength object +func (obj *patternFlowArpHardwareLength) SetValues(value []uint32) PatternFlowArpHardwareLength { + obj.setChoice(PatternFlowArpHardwareLengthChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowArpHardwareLengthCounter +func (obj *patternFlowArpHardwareLength) Increment() PatternFlowArpHardwareLengthCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowArpHardwareLengthChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowArpHardwareLengthCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowArpHardwareLengthCounter +func (obj *patternFlowArpHardwareLength) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowArpHardwareLengthCounter value in the PatternFlowArpHardwareLength object +func (obj *patternFlowArpHardwareLength) SetIncrement(value PatternFlowArpHardwareLengthCounter) PatternFlowArpHardwareLength { + obj.setChoice(PatternFlowArpHardwareLengthChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowArpHardwareLengthCounter +func (obj *patternFlowArpHardwareLength) Decrement() PatternFlowArpHardwareLengthCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowArpHardwareLengthChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowArpHardwareLengthCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowArpHardwareLengthCounter +func (obj *patternFlowArpHardwareLength) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowArpHardwareLengthCounter value in the PatternFlowArpHardwareLength object +func (obj *patternFlowArpHardwareLength) SetDecrement(value PatternFlowArpHardwareLengthCounter) PatternFlowArpHardwareLength { + obj.setChoice(PatternFlowArpHardwareLengthChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowArpHardwareLengthMetricTag +func (obj *patternFlowArpHardwareLength) MetricTags() PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowArpHardwareLengthMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter struct { + obj *patternFlowArpHardwareLength + patternFlowArpHardwareLengthMetricTagSlice []PatternFlowArpHardwareLengthMetricTag + fieldPtr *[]*otg.PatternFlowArpHardwareLengthMetricTag +} + +func newPatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter(ptr *[]*otg.PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { + return &patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter interface { + setMsg(*patternFlowArpHardwareLength) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter + Items() []PatternFlowArpHardwareLengthMetricTag + Add() PatternFlowArpHardwareLengthMetricTag + Append(items ...PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter + Set(index int, newObj PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter + Clear() PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter + clearHolderSlice() PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter + appendHolderSlice(item PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter +} + +func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) setMsg(msg *patternFlowArpHardwareLength) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowArpHardwareLengthMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) Items() []PatternFlowArpHardwareLengthMetricTag { + return obj.patternFlowArpHardwareLengthMetricTagSlice +} + +func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) Add() PatternFlowArpHardwareLengthMetricTag { + newObj := &otg.PatternFlowArpHardwareLengthMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowArpHardwareLengthMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowArpHardwareLengthMetricTagSlice = append(obj.patternFlowArpHardwareLengthMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) Append(items ...PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowArpHardwareLengthMetricTagSlice = append(obj.patternFlowArpHardwareLengthMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) Set(index int, newObj PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowArpHardwareLengthMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) Clear() PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowArpHardwareLengthMetricTag{} + obj.patternFlowArpHardwareLengthMetricTagSlice = []PatternFlowArpHardwareLengthMetricTag{} + } + return obj +} +func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) clearHolderSlice() PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { + if len(obj.patternFlowArpHardwareLengthMetricTagSlice) > 0 { + obj.patternFlowArpHardwareLengthMetricTagSlice = []PatternFlowArpHardwareLengthMetricTag{} + } + return obj +} +func (obj *patternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter) appendHolderSlice(item PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthPatternFlowArpHardwareLengthMetricTagIter { + obj.patternFlowArpHardwareLengthMetricTagSlice = append(obj.patternFlowArpHardwareLengthMetricTagSlice, item) + return obj +} + +func (obj *patternFlowArpHardwareLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpHardwareLength.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowArpHardwareLength.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowArpHardwareLengthMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowArpHardwareLength) setDefault() { + var choices_set int = 0 + var choice PatternFlowArpHardwareLengthChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowArpHardwareLengthChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowArpHardwareLengthChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowArpHardwareLengthChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowArpHardwareLengthChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowArpHardwareLengthChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpHardwareLength") + } + } else { + intVal := otg.PatternFlowArpHardwareLength_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowArpHardwareLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_arp_hardware_length_counter.go b/gosnappi/pattern_flow_arp_hardware_length_counter.go new file mode 100644 index 00000000..63da983c --- /dev/null +++ b/gosnappi/pattern_flow_arp_hardware_length_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowArpHardwareLengthCounter ***** +type patternFlowArpHardwareLengthCounter struct { + validation + obj *otg.PatternFlowArpHardwareLengthCounter + marshaller marshalPatternFlowArpHardwareLengthCounter + unMarshaller unMarshalPatternFlowArpHardwareLengthCounter +} + +func NewPatternFlowArpHardwareLengthCounter() PatternFlowArpHardwareLengthCounter { + obj := patternFlowArpHardwareLengthCounter{obj: &otg.PatternFlowArpHardwareLengthCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpHardwareLengthCounter) msg() *otg.PatternFlowArpHardwareLengthCounter { + return obj.obj +} + +func (obj *patternFlowArpHardwareLengthCounter) setMsg(msg *otg.PatternFlowArpHardwareLengthCounter) PatternFlowArpHardwareLengthCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpHardwareLengthCounter struct { + obj *patternFlowArpHardwareLengthCounter +} + +type marshalPatternFlowArpHardwareLengthCounter interface { + // ToProto marshals PatternFlowArpHardwareLengthCounter to protobuf object *otg.PatternFlowArpHardwareLengthCounter + ToProto() (*otg.PatternFlowArpHardwareLengthCounter, error) + // ToPbText marshals PatternFlowArpHardwareLengthCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpHardwareLengthCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpHardwareLengthCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpHardwareLengthCounter struct { + obj *patternFlowArpHardwareLengthCounter +} + +type unMarshalPatternFlowArpHardwareLengthCounter interface { + // FromProto unmarshals PatternFlowArpHardwareLengthCounter from protobuf object *otg.PatternFlowArpHardwareLengthCounter + FromProto(msg *otg.PatternFlowArpHardwareLengthCounter) (PatternFlowArpHardwareLengthCounter, error) + // FromPbText unmarshals PatternFlowArpHardwareLengthCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpHardwareLengthCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpHardwareLengthCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpHardwareLengthCounter) Marshal() marshalPatternFlowArpHardwareLengthCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpHardwareLengthCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpHardwareLengthCounter) Unmarshal() unMarshalPatternFlowArpHardwareLengthCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpHardwareLengthCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpHardwareLengthCounter) ToProto() (*otg.PatternFlowArpHardwareLengthCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpHardwareLengthCounter) FromProto(msg *otg.PatternFlowArpHardwareLengthCounter) (PatternFlowArpHardwareLengthCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpHardwareLengthCounter) 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 *unMarshalpatternFlowArpHardwareLengthCounter) 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 *marshalpatternFlowArpHardwareLengthCounter) 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 *unMarshalpatternFlowArpHardwareLengthCounter) 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 *marshalpatternFlowArpHardwareLengthCounter) 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 *unMarshalpatternFlowArpHardwareLengthCounter) 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 *patternFlowArpHardwareLengthCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpHardwareLengthCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpHardwareLengthCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpHardwareLengthCounter) Clone() (PatternFlowArpHardwareLengthCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpHardwareLengthCounter() + 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 +} + +// PatternFlowArpHardwareLengthCounter is integer counter pattern +type PatternFlowArpHardwareLengthCounter interface { + Validation + // msg marshals PatternFlowArpHardwareLengthCounter to protobuf object *otg.PatternFlowArpHardwareLengthCounter + // and doesn't set defaults + msg() *otg.PatternFlowArpHardwareLengthCounter + // setMsg unmarshals PatternFlowArpHardwareLengthCounter from protobuf object *otg.PatternFlowArpHardwareLengthCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowArpHardwareLengthCounter) PatternFlowArpHardwareLengthCounter + // provides marshal interface + Marshal() marshalPatternFlowArpHardwareLengthCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpHardwareLengthCounter + // validate validates PatternFlowArpHardwareLengthCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpHardwareLengthCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowArpHardwareLengthCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowArpHardwareLengthCounter + SetStart(value uint32) PatternFlowArpHardwareLengthCounter + // HasStart checks if Start has been set in PatternFlowArpHardwareLengthCounter + HasStart() bool + // Step returns uint32, set in PatternFlowArpHardwareLengthCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowArpHardwareLengthCounter + SetStep(value uint32) PatternFlowArpHardwareLengthCounter + // HasStep checks if Step has been set in PatternFlowArpHardwareLengthCounter + HasStep() bool + // Count returns uint32, set in PatternFlowArpHardwareLengthCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowArpHardwareLengthCounter + SetCount(value uint32) PatternFlowArpHardwareLengthCounter + // HasCount checks if Count has been set in PatternFlowArpHardwareLengthCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowArpHardwareLengthCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowArpHardwareLengthCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowArpHardwareLengthCounter object +func (obj *patternFlowArpHardwareLengthCounter) SetStart(value uint32) PatternFlowArpHardwareLengthCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowArpHardwareLengthCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowArpHardwareLengthCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowArpHardwareLengthCounter object +func (obj *patternFlowArpHardwareLengthCounter) SetStep(value uint32) PatternFlowArpHardwareLengthCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpHardwareLengthCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpHardwareLengthCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowArpHardwareLengthCounter object +func (obj *patternFlowArpHardwareLengthCounter) SetCount(value uint32) PatternFlowArpHardwareLengthCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowArpHardwareLengthCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpHardwareLengthCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpHardwareLengthCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpHardwareLengthCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowArpHardwareLengthCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(6) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_arp_hardware_length_metric_tag.go b/gosnappi/pattern_flow_arp_hardware_length_metric_tag.go new file mode 100644 index 00000000..f521db42 --- /dev/null +++ b/gosnappi/pattern_flow_arp_hardware_length_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowArpHardwareLengthMetricTag ***** +type patternFlowArpHardwareLengthMetricTag struct { + validation + obj *otg.PatternFlowArpHardwareLengthMetricTag + marshaller marshalPatternFlowArpHardwareLengthMetricTag + unMarshaller unMarshalPatternFlowArpHardwareLengthMetricTag +} + +func NewPatternFlowArpHardwareLengthMetricTag() PatternFlowArpHardwareLengthMetricTag { + obj := patternFlowArpHardwareLengthMetricTag{obj: &otg.PatternFlowArpHardwareLengthMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpHardwareLengthMetricTag) msg() *otg.PatternFlowArpHardwareLengthMetricTag { + return obj.obj +} + +func (obj *patternFlowArpHardwareLengthMetricTag) setMsg(msg *otg.PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpHardwareLengthMetricTag struct { + obj *patternFlowArpHardwareLengthMetricTag +} + +type marshalPatternFlowArpHardwareLengthMetricTag interface { + // ToProto marshals PatternFlowArpHardwareLengthMetricTag to protobuf object *otg.PatternFlowArpHardwareLengthMetricTag + ToProto() (*otg.PatternFlowArpHardwareLengthMetricTag, error) + // ToPbText marshals PatternFlowArpHardwareLengthMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpHardwareLengthMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpHardwareLengthMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpHardwareLengthMetricTag struct { + obj *patternFlowArpHardwareLengthMetricTag +} + +type unMarshalPatternFlowArpHardwareLengthMetricTag interface { + // FromProto unmarshals PatternFlowArpHardwareLengthMetricTag from protobuf object *otg.PatternFlowArpHardwareLengthMetricTag + FromProto(msg *otg.PatternFlowArpHardwareLengthMetricTag) (PatternFlowArpHardwareLengthMetricTag, error) + // FromPbText unmarshals PatternFlowArpHardwareLengthMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpHardwareLengthMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpHardwareLengthMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpHardwareLengthMetricTag) Marshal() marshalPatternFlowArpHardwareLengthMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpHardwareLengthMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpHardwareLengthMetricTag) Unmarshal() unMarshalPatternFlowArpHardwareLengthMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpHardwareLengthMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpHardwareLengthMetricTag) ToProto() (*otg.PatternFlowArpHardwareLengthMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpHardwareLengthMetricTag) FromProto(msg *otg.PatternFlowArpHardwareLengthMetricTag) (PatternFlowArpHardwareLengthMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpHardwareLengthMetricTag) 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 *unMarshalpatternFlowArpHardwareLengthMetricTag) 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 *marshalpatternFlowArpHardwareLengthMetricTag) 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 *unMarshalpatternFlowArpHardwareLengthMetricTag) 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 *marshalpatternFlowArpHardwareLengthMetricTag) 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 *unMarshalpatternFlowArpHardwareLengthMetricTag) 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 *patternFlowArpHardwareLengthMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpHardwareLengthMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpHardwareLengthMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpHardwareLengthMetricTag) Clone() (PatternFlowArpHardwareLengthMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpHardwareLengthMetricTag() + 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 +} + +// PatternFlowArpHardwareLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowArpHardwareLengthMetricTag interface { + Validation + // msg marshals PatternFlowArpHardwareLengthMetricTag to protobuf object *otg.PatternFlowArpHardwareLengthMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowArpHardwareLengthMetricTag + // setMsg unmarshals PatternFlowArpHardwareLengthMetricTag from protobuf object *otg.PatternFlowArpHardwareLengthMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowArpHardwareLengthMetricTag) PatternFlowArpHardwareLengthMetricTag + // provides marshal interface + Marshal() marshalPatternFlowArpHardwareLengthMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpHardwareLengthMetricTag + // validate validates PatternFlowArpHardwareLengthMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpHardwareLengthMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowArpHardwareLengthMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowArpHardwareLengthMetricTag + SetName(value string) PatternFlowArpHardwareLengthMetricTag + // Offset returns uint32, set in PatternFlowArpHardwareLengthMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowArpHardwareLengthMetricTag + SetOffset(value uint32) PatternFlowArpHardwareLengthMetricTag + // HasOffset checks if Offset has been set in PatternFlowArpHardwareLengthMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowArpHardwareLengthMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowArpHardwareLengthMetricTag + SetLength(value uint32) PatternFlowArpHardwareLengthMetricTag + // HasLength checks if Length has been set in PatternFlowArpHardwareLengthMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowArpHardwareLengthMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowArpHardwareLengthMetricTag object +func (obj *patternFlowArpHardwareLengthMetricTag) SetName(value string) PatternFlowArpHardwareLengthMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpHardwareLengthMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpHardwareLengthMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowArpHardwareLengthMetricTag object +func (obj *patternFlowArpHardwareLengthMetricTag) SetOffset(value uint32) PatternFlowArpHardwareLengthMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpHardwareLengthMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpHardwareLengthMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowArpHardwareLengthMetricTag object +func (obj *patternFlowArpHardwareLengthMetricTag) SetLength(value uint32) PatternFlowArpHardwareLengthMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowArpHardwareLengthMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpHardwareLengthMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpHardwareLengthMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowArpHardwareLengthMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowArpHardwareLengthMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_arp_hardware_type.go b/gosnappi/pattern_flow_arp_hardware_type.go new file mode 100644 index 00000000..39a525e7 --- /dev/null +++ b/gosnappi/pattern_flow_arp_hardware_type.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowArpHardwareType ***** +type patternFlowArpHardwareType struct { + validation + obj *otg.PatternFlowArpHardwareType + marshaller marshalPatternFlowArpHardwareType + unMarshaller unMarshalPatternFlowArpHardwareType + incrementHolder PatternFlowArpHardwareTypeCounter + decrementHolder PatternFlowArpHardwareTypeCounter + metricTagsHolder PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter +} + +func NewPatternFlowArpHardwareType() PatternFlowArpHardwareType { + obj := patternFlowArpHardwareType{obj: &otg.PatternFlowArpHardwareType{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpHardwareType) msg() *otg.PatternFlowArpHardwareType { + return obj.obj +} + +func (obj *patternFlowArpHardwareType) setMsg(msg *otg.PatternFlowArpHardwareType) PatternFlowArpHardwareType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpHardwareType struct { + obj *patternFlowArpHardwareType +} + +type marshalPatternFlowArpHardwareType interface { + // ToProto marshals PatternFlowArpHardwareType to protobuf object *otg.PatternFlowArpHardwareType + ToProto() (*otg.PatternFlowArpHardwareType, error) + // ToPbText marshals PatternFlowArpHardwareType to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpHardwareType to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpHardwareType to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpHardwareType struct { + obj *patternFlowArpHardwareType +} + +type unMarshalPatternFlowArpHardwareType interface { + // FromProto unmarshals PatternFlowArpHardwareType from protobuf object *otg.PatternFlowArpHardwareType + FromProto(msg *otg.PatternFlowArpHardwareType) (PatternFlowArpHardwareType, error) + // FromPbText unmarshals PatternFlowArpHardwareType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpHardwareType from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpHardwareType from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpHardwareType) Marshal() marshalPatternFlowArpHardwareType { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpHardwareType{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpHardwareType) Unmarshal() unMarshalPatternFlowArpHardwareType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpHardwareType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpHardwareType) ToProto() (*otg.PatternFlowArpHardwareType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpHardwareType) FromProto(msg *otg.PatternFlowArpHardwareType) (PatternFlowArpHardwareType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpHardwareType) 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 *unMarshalpatternFlowArpHardwareType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowArpHardwareType) 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 *unMarshalpatternFlowArpHardwareType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowArpHardwareType) 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 *unMarshalpatternFlowArpHardwareType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowArpHardwareType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpHardwareType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpHardwareType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpHardwareType) Clone() (PatternFlowArpHardwareType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpHardwareType() + 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 +} + +func (obj *patternFlowArpHardwareType) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowArpHardwareType is network link protocol type +type PatternFlowArpHardwareType interface { + Validation + // msg marshals PatternFlowArpHardwareType to protobuf object *otg.PatternFlowArpHardwareType + // and doesn't set defaults + msg() *otg.PatternFlowArpHardwareType + // setMsg unmarshals PatternFlowArpHardwareType from protobuf object *otg.PatternFlowArpHardwareType + // and doesn't set defaults + setMsg(*otg.PatternFlowArpHardwareType) PatternFlowArpHardwareType + // provides marshal interface + Marshal() marshalPatternFlowArpHardwareType + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpHardwareType + // validate validates PatternFlowArpHardwareType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpHardwareType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowArpHardwareTypeChoiceEnum, set in PatternFlowArpHardwareType + Choice() PatternFlowArpHardwareTypeChoiceEnum + // setChoice assigns PatternFlowArpHardwareTypeChoiceEnum provided by user to PatternFlowArpHardwareType + setChoice(value PatternFlowArpHardwareTypeChoiceEnum) PatternFlowArpHardwareType + // HasChoice checks if Choice has been set in PatternFlowArpHardwareType + HasChoice() bool + // Value returns uint32, set in PatternFlowArpHardwareType. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowArpHardwareType + SetValue(value uint32) PatternFlowArpHardwareType + // HasValue checks if Value has been set in PatternFlowArpHardwareType + HasValue() bool + // Values returns []uint32, set in PatternFlowArpHardwareType. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowArpHardwareType + SetValues(value []uint32) PatternFlowArpHardwareType + // Increment returns PatternFlowArpHardwareTypeCounter, set in PatternFlowArpHardwareType. + // PatternFlowArpHardwareTypeCounter is integer counter pattern + Increment() PatternFlowArpHardwareTypeCounter + // SetIncrement assigns PatternFlowArpHardwareTypeCounter provided by user to PatternFlowArpHardwareType. + // PatternFlowArpHardwareTypeCounter is integer counter pattern + SetIncrement(value PatternFlowArpHardwareTypeCounter) PatternFlowArpHardwareType + // HasIncrement checks if Increment has been set in PatternFlowArpHardwareType + HasIncrement() bool + // Decrement returns PatternFlowArpHardwareTypeCounter, set in PatternFlowArpHardwareType. + // PatternFlowArpHardwareTypeCounter is integer counter pattern + Decrement() PatternFlowArpHardwareTypeCounter + // SetDecrement assigns PatternFlowArpHardwareTypeCounter provided by user to PatternFlowArpHardwareType. + // PatternFlowArpHardwareTypeCounter is integer counter pattern + SetDecrement(value PatternFlowArpHardwareTypeCounter) PatternFlowArpHardwareType + // HasDecrement checks if Decrement has been set in PatternFlowArpHardwareType + HasDecrement() bool + // MetricTags returns PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIterIter, set in PatternFlowArpHardwareType + MetricTags() PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter + setNil() +} + +type PatternFlowArpHardwareTypeChoiceEnum string + +// Enum of Choice on PatternFlowArpHardwareType +var PatternFlowArpHardwareTypeChoice = struct { + VALUE PatternFlowArpHardwareTypeChoiceEnum + VALUES PatternFlowArpHardwareTypeChoiceEnum + INCREMENT PatternFlowArpHardwareTypeChoiceEnum + DECREMENT PatternFlowArpHardwareTypeChoiceEnum +}{ + VALUE: PatternFlowArpHardwareTypeChoiceEnum("value"), + VALUES: PatternFlowArpHardwareTypeChoiceEnum("values"), + INCREMENT: PatternFlowArpHardwareTypeChoiceEnum("increment"), + DECREMENT: PatternFlowArpHardwareTypeChoiceEnum("decrement"), +} + +func (obj *patternFlowArpHardwareType) Choice() PatternFlowArpHardwareTypeChoiceEnum { + return PatternFlowArpHardwareTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowArpHardwareType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowArpHardwareType) setChoice(value PatternFlowArpHardwareTypeChoiceEnum) PatternFlowArpHardwareType { + intValue, ok := otg.PatternFlowArpHardwareType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowArpHardwareTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowArpHardwareType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowArpHardwareTypeChoice.VALUE { + defaultValue := uint32(1) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowArpHardwareTypeChoice.VALUES { + defaultValue := []uint32{1} + obj.obj.Values = defaultValue + } + + if value == PatternFlowArpHardwareTypeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowArpHardwareTypeCounter().msg() + } + + if value == PatternFlowArpHardwareTypeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowArpHardwareTypeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowArpHardwareType) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowArpHardwareTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowArpHardwareType) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowArpHardwareType object +func (obj *patternFlowArpHardwareType) SetValue(value uint32) PatternFlowArpHardwareType { + obj.setChoice(PatternFlowArpHardwareTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowArpHardwareType) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{1}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowArpHardwareType object +func (obj *patternFlowArpHardwareType) SetValues(value []uint32) PatternFlowArpHardwareType { + obj.setChoice(PatternFlowArpHardwareTypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowArpHardwareTypeCounter +func (obj *patternFlowArpHardwareType) Increment() PatternFlowArpHardwareTypeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowArpHardwareTypeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowArpHardwareTypeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowArpHardwareTypeCounter +func (obj *patternFlowArpHardwareType) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowArpHardwareTypeCounter value in the PatternFlowArpHardwareType object +func (obj *patternFlowArpHardwareType) SetIncrement(value PatternFlowArpHardwareTypeCounter) PatternFlowArpHardwareType { + obj.setChoice(PatternFlowArpHardwareTypeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowArpHardwareTypeCounter +func (obj *patternFlowArpHardwareType) Decrement() PatternFlowArpHardwareTypeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowArpHardwareTypeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowArpHardwareTypeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowArpHardwareTypeCounter +func (obj *patternFlowArpHardwareType) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowArpHardwareTypeCounter value in the PatternFlowArpHardwareType object +func (obj *patternFlowArpHardwareType) SetDecrement(value PatternFlowArpHardwareTypeCounter) PatternFlowArpHardwareType { + obj.setChoice(PatternFlowArpHardwareTypeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowArpHardwareTypeMetricTag +func (obj *patternFlowArpHardwareType) MetricTags() PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowArpHardwareTypeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter struct { + obj *patternFlowArpHardwareType + patternFlowArpHardwareTypeMetricTagSlice []PatternFlowArpHardwareTypeMetricTag + fieldPtr *[]*otg.PatternFlowArpHardwareTypeMetricTag +} + +func newPatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter(ptr *[]*otg.PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { + return &patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter interface { + setMsg(*patternFlowArpHardwareType) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter + Items() []PatternFlowArpHardwareTypeMetricTag + Add() PatternFlowArpHardwareTypeMetricTag + Append(items ...PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter + Set(index int, newObj PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter + Clear() PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter + clearHolderSlice() PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter + appendHolderSlice(item PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter +} + +func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) setMsg(msg *patternFlowArpHardwareType) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowArpHardwareTypeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) Items() []PatternFlowArpHardwareTypeMetricTag { + return obj.patternFlowArpHardwareTypeMetricTagSlice +} + +func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) Add() PatternFlowArpHardwareTypeMetricTag { + newObj := &otg.PatternFlowArpHardwareTypeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowArpHardwareTypeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowArpHardwareTypeMetricTagSlice = append(obj.patternFlowArpHardwareTypeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) Append(items ...PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowArpHardwareTypeMetricTagSlice = append(obj.patternFlowArpHardwareTypeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) Set(index int, newObj PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowArpHardwareTypeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) Clear() PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowArpHardwareTypeMetricTag{} + obj.patternFlowArpHardwareTypeMetricTagSlice = []PatternFlowArpHardwareTypeMetricTag{} + } + return obj +} +func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) clearHolderSlice() PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { + if len(obj.patternFlowArpHardwareTypeMetricTagSlice) > 0 { + obj.patternFlowArpHardwareTypeMetricTagSlice = []PatternFlowArpHardwareTypeMetricTag{} + } + return obj +} +func (obj *patternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter) appendHolderSlice(item PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypePatternFlowArpHardwareTypeMetricTagIter { + obj.patternFlowArpHardwareTypeMetricTagSlice = append(obj.patternFlowArpHardwareTypeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowArpHardwareType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpHardwareType.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowArpHardwareType.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowArpHardwareTypeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowArpHardwareType) setDefault() { + var choices_set int = 0 + var choice PatternFlowArpHardwareTypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowArpHardwareTypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowArpHardwareTypeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowArpHardwareTypeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowArpHardwareTypeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowArpHardwareTypeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpHardwareType") + } + } else { + intVal := otg.PatternFlowArpHardwareType_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowArpHardwareType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_arp_hardware_type_counter.go b/gosnappi/pattern_flow_arp_hardware_type_counter.go new file mode 100644 index 00000000..d42aed19 --- /dev/null +++ b/gosnappi/pattern_flow_arp_hardware_type_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowArpHardwareTypeCounter ***** +type patternFlowArpHardwareTypeCounter struct { + validation + obj *otg.PatternFlowArpHardwareTypeCounter + marshaller marshalPatternFlowArpHardwareTypeCounter + unMarshaller unMarshalPatternFlowArpHardwareTypeCounter +} + +func NewPatternFlowArpHardwareTypeCounter() PatternFlowArpHardwareTypeCounter { + obj := patternFlowArpHardwareTypeCounter{obj: &otg.PatternFlowArpHardwareTypeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpHardwareTypeCounter) msg() *otg.PatternFlowArpHardwareTypeCounter { + return obj.obj +} + +func (obj *patternFlowArpHardwareTypeCounter) setMsg(msg *otg.PatternFlowArpHardwareTypeCounter) PatternFlowArpHardwareTypeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpHardwareTypeCounter struct { + obj *patternFlowArpHardwareTypeCounter +} + +type marshalPatternFlowArpHardwareTypeCounter interface { + // ToProto marshals PatternFlowArpHardwareTypeCounter to protobuf object *otg.PatternFlowArpHardwareTypeCounter + ToProto() (*otg.PatternFlowArpHardwareTypeCounter, error) + // ToPbText marshals PatternFlowArpHardwareTypeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpHardwareTypeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpHardwareTypeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpHardwareTypeCounter struct { + obj *patternFlowArpHardwareTypeCounter +} + +type unMarshalPatternFlowArpHardwareTypeCounter interface { + // FromProto unmarshals PatternFlowArpHardwareTypeCounter from protobuf object *otg.PatternFlowArpHardwareTypeCounter + FromProto(msg *otg.PatternFlowArpHardwareTypeCounter) (PatternFlowArpHardwareTypeCounter, error) + // FromPbText unmarshals PatternFlowArpHardwareTypeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpHardwareTypeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpHardwareTypeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpHardwareTypeCounter) Marshal() marshalPatternFlowArpHardwareTypeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpHardwareTypeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpHardwareTypeCounter) Unmarshal() unMarshalPatternFlowArpHardwareTypeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpHardwareTypeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpHardwareTypeCounter) ToProto() (*otg.PatternFlowArpHardwareTypeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpHardwareTypeCounter) FromProto(msg *otg.PatternFlowArpHardwareTypeCounter) (PatternFlowArpHardwareTypeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpHardwareTypeCounter) 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 *unMarshalpatternFlowArpHardwareTypeCounter) 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 *marshalpatternFlowArpHardwareTypeCounter) 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 *unMarshalpatternFlowArpHardwareTypeCounter) 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 *marshalpatternFlowArpHardwareTypeCounter) 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 *unMarshalpatternFlowArpHardwareTypeCounter) 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 *patternFlowArpHardwareTypeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpHardwareTypeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpHardwareTypeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpHardwareTypeCounter) Clone() (PatternFlowArpHardwareTypeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpHardwareTypeCounter() + 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 +} + +// PatternFlowArpHardwareTypeCounter is integer counter pattern +type PatternFlowArpHardwareTypeCounter interface { + Validation + // msg marshals PatternFlowArpHardwareTypeCounter to protobuf object *otg.PatternFlowArpHardwareTypeCounter + // and doesn't set defaults + msg() *otg.PatternFlowArpHardwareTypeCounter + // setMsg unmarshals PatternFlowArpHardwareTypeCounter from protobuf object *otg.PatternFlowArpHardwareTypeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowArpHardwareTypeCounter) PatternFlowArpHardwareTypeCounter + // provides marshal interface + Marshal() marshalPatternFlowArpHardwareTypeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpHardwareTypeCounter + // validate validates PatternFlowArpHardwareTypeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpHardwareTypeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowArpHardwareTypeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowArpHardwareTypeCounter + SetStart(value uint32) PatternFlowArpHardwareTypeCounter + // HasStart checks if Start has been set in PatternFlowArpHardwareTypeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowArpHardwareTypeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowArpHardwareTypeCounter + SetStep(value uint32) PatternFlowArpHardwareTypeCounter + // HasStep checks if Step has been set in PatternFlowArpHardwareTypeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowArpHardwareTypeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowArpHardwareTypeCounter + SetCount(value uint32) PatternFlowArpHardwareTypeCounter + // HasCount checks if Count has been set in PatternFlowArpHardwareTypeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowArpHardwareTypeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowArpHardwareTypeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowArpHardwareTypeCounter object +func (obj *patternFlowArpHardwareTypeCounter) SetStart(value uint32) PatternFlowArpHardwareTypeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowArpHardwareTypeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowArpHardwareTypeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowArpHardwareTypeCounter object +func (obj *patternFlowArpHardwareTypeCounter) SetStep(value uint32) PatternFlowArpHardwareTypeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpHardwareTypeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpHardwareTypeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowArpHardwareTypeCounter object +func (obj *patternFlowArpHardwareTypeCounter) SetCount(value uint32) PatternFlowArpHardwareTypeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowArpHardwareTypeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpHardwareTypeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpHardwareTypeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpHardwareTypeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowArpHardwareTypeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_arp_hardware_type_metric_tag.go b/gosnappi/pattern_flow_arp_hardware_type_metric_tag.go new file mode 100644 index 00000000..7b42a8d1 --- /dev/null +++ b/gosnappi/pattern_flow_arp_hardware_type_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowArpHardwareTypeMetricTag ***** +type patternFlowArpHardwareTypeMetricTag struct { + validation + obj *otg.PatternFlowArpHardwareTypeMetricTag + marshaller marshalPatternFlowArpHardwareTypeMetricTag + unMarshaller unMarshalPatternFlowArpHardwareTypeMetricTag +} + +func NewPatternFlowArpHardwareTypeMetricTag() PatternFlowArpHardwareTypeMetricTag { + obj := patternFlowArpHardwareTypeMetricTag{obj: &otg.PatternFlowArpHardwareTypeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpHardwareTypeMetricTag) msg() *otg.PatternFlowArpHardwareTypeMetricTag { + return obj.obj +} + +func (obj *patternFlowArpHardwareTypeMetricTag) setMsg(msg *otg.PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpHardwareTypeMetricTag struct { + obj *patternFlowArpHardwareTypeMetricTag +} + +type marshalPatternFlowArpHardwareTypeMetricTag interface { + // ToProto marshals PatternFlowArpHardwareTypeMetricTag to protobuf object *otg.PatternFlowArpHardwareTypeMetricTag + ToProto() (*otg.PatternFlowArpHardwareTypeMetricTag, error) + // ToPbText marshals PatternFlowArpHardwareTypeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpHardwareTypeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpHardwareTypeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpHardwareTypeMetricTag struct { + obj *patternFlowArpHardwareTypeMetricTag +} + +type unMarshalPatternFlowArpHardwareTypeMetricTag interface { + // FromProto unmarshals PatternFlowArpHardwareTypeMetricTag from protobuf object *otg.PatternFlowArpHardwareTypeMetricTag + FromProto(msg *otg.PatternFlowArpHardwareTypeMetricTag) (PatternFlowArpHardwareTypeMetricTag, error) + // FromPbText unmarshals PatternFlowArpHardwareTypeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpHardwareTypeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpHardwareTypeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpHardwareTypeMetricTag) Marshal() marshalPatternFlowArpHardwareTypeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpHardwareTypeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpHardwareTypeMetricTag) Unmarshal() unMarshalPatternFlowArpHardwareTypeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpHardwareTypeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpHardwareTypeMetricTag) ToProto() (*otg.PatternFlowArpHardwareTypeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpHardwareTypeMetricTag) FromProto(msg *otg.PatternFlowArpHardwareTypeMetricTag) (PatternFlowArpHardwareTypeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpHardwareTypeMetricTag) 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 *unMarshalpatternFlowArpHardwareTypeMetricTag) 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 *marshalpatternFlowArpHardwareTypeMetricTag) 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 *unMarshalpatternFlowArpHardwareTypeMetricTag) 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 *marshalpatternFlowArpHardwareTypeMetricTag) 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 *unMarshalpatternFlowArpHardwareTypeMetricTag) 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 *patternFlowArpHardwareTypeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpHardwareTypeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpHardwareTypeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpHardwareTypeMetricTag) Clone() (PatternFlowArpHardwareTypeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpHardwareTypeMetricTag() + 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 +} + +// PatternFlowArpHardwareTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowArpHardwareTypeMetricTag interface { + Validation + // msg marshals PatternFlowArpHardwareTypeMetricTag to protobuf object *otg.PatternFlowArpHardwareTypeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowArpHardwareTypeMetricTag + // setMsg unmarshals PatternFlowArpHardwareTypeMetricTag from protobuf object *otg.PatternFlowArpHardwareTypeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowArpHardwareTypeMetricTag) PatternFlowArpHardwareTypeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowArpHardwareTypeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpHardwareTypeMetricTag + // validate validates PatternFlowArpHardwareTypeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpHardwareTypeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowArpHardwareTypeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowArpHardwareTypeMetricTag + SetName(value string) PatternFlowArpHardwareTypeMetricTag + // Offset returns uint32, set in PatternFlowArpHardwareTypeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowArpHardwareTypeMetricTag + SetOffset(value uint32) PatternFlowArpHardwareTypeMetricTag + // HasOffset checks if Offset has been set in PatternFlowArpHardwareTypeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowArpHardwareTypeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowArpHardwareTypeMetricTag + SetLength(value uint32) PatternFlowArpHardwareTypeMetricTag + // HasLength checks if Length has been set in PatternFlowArpHardwareTypeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowArpHardwareTypeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowArpHardwareTypeMetricTag object +func (obj *patternFlowArpHardwareTypeMetricTag) SetName(value string) PatternFlowArpHardwareTypeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpHardwareTypeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpHardwareTypeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowArpHardwareTypeMetricTag object +func (obj *patternFlowArpHardwareTypeMetricTag) SetOffset(value uint32) PatternFlowArpHardwareTypeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpHardwareTypeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpHardwareTypeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowArpHardwareTypeMetricTag object +func (obj *patternFlowArpHardwareTypeMetricTag) SetLength(value uint32) PatternFlowArpHardwareTypeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowArpHardwareTypeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpHardwareTypeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpHardwareTypeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowArpHardwareTypeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowArpHardwareTypeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_arp_operation.go b/gosnappi/pattern_flow_arp_operation.go new file mode 100644 index 00000000..ae1ff2de --- /dev/null +++ b/gosnappi/pattern_flow_arp_operation.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowArpOperation ***** +type patternFlowArpOperation struct { + validation + obj *otg.PatternFlowArpOperation + marshaller marshalPatternFlowArpOperation + unMarshaller unMarshalPatternFlowArpOperation + incrementHolder PatternFlowArpOperationCounter + decrementHolder PatternFlowArpOperationCounter + metricTagsHolder PatternFlowArpOperationPatternFlowArpOperationMetricTagIter +} + +func NewPatternFlowArpOperation() PatternFlowArpOperation { + obj := patternFlowArpOperation{obj: &otg.PatternFlowArpOperation{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpOperation) msg() *otg.PatternFlowArpOperation { + return obj.obj +} + +func (obj *patternFlowArpOperation) setMsg(msg *otg.PatternFlowArpOperation) PatternFlowArpOperation { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpOperation struct { + obj *patternFlowArpOperation +} + +type marshalPatternFlowArpOperation interface { + // ToProto marshals PatternFlowArpOperation to protobuf object *otg.PatternFlowArpOperation + ToProto() (*otg.PatternFlowArpOperation, error) + // ToPbText marshals PatternFlowArpOperation to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpOperation to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpOperation to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpOperation struct { + obj *patternFlowArpOperation +} + +type unMarshalPatternFlowArpOperation interface { + // FromProto unmarshals PatternFlowArpOperation from protobuf object *otg.PatternFlowArpOperation + FromProto(msg *otg.PatternFlowArpOperation) (PatternFlowArpOperation, error) + // FromPbText unmarshals PatternFlowArpOperation from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpOperation from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpOperation from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpOperation) Marshal() marshalPatternFlowArpOperation { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpOperation{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpOperation) Unmarshal() unMarshalPatternFlowArpOperation { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpOperation{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpOperation) ToProto() (*otg.PatternFlowArpOperation, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpOperation) FromProto(msg *otg.PatternFlowArpOperation) (PatternFlowArpOperation, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpOperation) 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 *unMarshalpatternFlowArpOperation) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowArpOperation) 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 *unMarshalpatternFlowArpOperation) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowArpOperation) 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 *unMarshalpatternFlowArpOperation) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowArpOperation) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpOperation) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpOperation) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpOperation) Clone() (PatternFlowArpOperation, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpOperation() + 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 +} + +func (obj *patternFlowArpOperation) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowArpOperation is the operation that the sender is performing +type PatternFlowArpOperation interface { + Validation + // msg marshals PatternFlowArpOperation to protobuf object *otg.PatternFlowArpOperation + // and doesn't set defaults + msg() *otg.PatternFlowArpOperation + // setMsg unmarshals PatternFlowArpOperation from protobuf object *otg.PatternFlowArpOperation + // and doesn't set defaults + setMsg(*otg.PatternFlowArpOperation) PatternFlowArpOperation + // provides marshal interface + Marshal() marshalPatternFlowArpOperation + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpOperation + // validate validates PatternFlowArpOperation + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpOperation, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowArpOperationChoiceEnum, set in PatternFlowArpOperation + Choice() PatternFlowArpOperationChoiceEnum + // setChoice assigns PatternFlowArpOperationChoiceEnum provided by user to PatternFlowArpOperation + setChoice(value PatternFlowArpOperationChoiceEnum) PatternFlowArpOperation + // HasChoice checks if Choice has been set in PatternFlowArpOperation + HasChoice() bool + // Value returns uint32, set in PatternFlowArpOperation. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowArpOperation + SetValue(value uint32) PatternFlowArpOperation + // HasValue checks if Value has been set in PatternFlowArpOperation + HasValue() bool + // Values returns []uint32, set in PatternFlowArpOperation. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowArpOperation + SetValues(value []uint32) PatternFlowArpOperation + // Increment returns PatternFlowArpOperationCounter, set in PatternFlowArpOperation. + // PatternFlowArpOperationCounter is integer counter pattern + Increment() PatternFlowArpOperationCounter + // SetIncrement assigns PatternFlowArpOperationCounter provided by user to PatternFlowArpOperation. + // PatternFlowArpOperationCounter is integer counter pattern + SetIncrement(value PatternFlowArpOperationCounter) PatternFlowArpOperation + // HasIncrement checks if Increment has been set in PatternFlowArpOperation + HasIncrement() bool + // Decrement returns PatternFlowArpOperationCounter, set in PatternFlowArpOperation. + // PatternFlowArpOperationCounter is integer counter pattern + Decrement() PatternFlowArpOperationCounter + // SetDecrement assigns PatternFlowArpOperationCounter provided by user to PatternFlowArpOperation. + // PatternFlowArpOperationCounter is integer counter pattern + SetDecrement(value PatternFlowArpOperationCounter) PatternFlowArpOperation + // HasDecrement checks if Decrement has been set in PatternFlowArpOperation + HasDecrement() bool + // MetricTags returns PatternFlowArpOperationPatternFlowArpOperationMetricTagIterIter, set in PatternFlowArpOperation + MetricTags() PatternFlowArpOperationPatternFlowArpOperationMetricTagIter + setNil() +} + +type PatternFlowArpOperationChoiceEnum string + +// Enum of Choice on PatternFlowArpOperation +var PatternFlowArpOperationChoice = struct { + VALUE PatternFlowArpOperationChoiceEnum + VALUES PatternFlowArpOperationChoiceEnum + INCREMENT PatternFlowArpOperationChoiceEnum + DECREMENT PatternFlowArpOperationChoiceEnum +}{ + VALUE: PatternFlowArpOperationChoiceEnum("value"), + VALUES: PatternFlowArpOperationChoiceEnum("values"), + INCREMENT: PatternFlowArpOperationChoiceEnum("increment"), + DECREMENT: PatternFlowArpOperationChoiceEnum("decrement"), +} + +func (obj *patternFlowArpOperation) Choice() PatternFlowArpOperationChoiceEnum { + return PatternFlowArpOperationChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowArpOperation) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowArpOperation) setChoice(value PatternFlowArpOperationChoiceEnum) PatternFlowArpOperation { + intValue, ok := otg.PatternFlowArpOperation_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowArpOperationChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowArpOperation_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowArpOperationChoice.VALUE { + defaultValue := uint32(1) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowArpOperationChoice.VALUES { + defaultValue := []uint32{1} + obj.obj.Values = defaultValue + } + + if value == PatternFlowArpOperationChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowArpOperationCounter().msg() + } + + if value == PatternFlowArpOperationChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowArpOperationCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowArpOperation) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowArpOperationChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowArpOperation) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowArpOperation object +func (obj *patternFlowArpOperation) SetValue(value uint32) PatternFlowArpOperation { + obj.setChoice(PatternFlowArpOperationChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowArpOperation) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{1}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowArpOperation object +func (obj *patternFlowArpOperation) SetValues(value []uint32) PatternFlowArpOperation { + obj.setChoice(PatternFlowArpOperationChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowArpOperationCounter +func (obj *patternFlowArpOperation) Increment() PatternFlowArpOperationCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowArpOperationChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowArpOperationCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowArpOperationCounter +func (obj *patternFlowArpOperation) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowArpOperationCounter value in the PatternFlowArpOperation object +func (obj *patternFlowArpOperation) SetIncrement(value PatternFlowArpOperationCounter) PatternFlowArpOperation { + obj.setChoice(PatternFlowArpOperationChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowArpOperationCounter +func (obj *patternFlowArpOperation) Decrement() PatternFlowArpOperationCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowArpOperationChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowArpOperationCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowArpOperationCounter +func (obj *patternFlowArpOperation) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowArpOperationCounter value in the PatternFlowArpOperation object +func (obj *patternFlowArpOperation) SetDecrement(value PatternFlowArpOperationCounter) PatternFlowArpOperation { + obj.setChoice(PatternFlowArpOperationChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowArpOperationMetricTag +func (obj *patternFlowArpOperation) MetricTags() PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowArpOperationMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowArpOperationPatternFlowArpOperationMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowArpOperationPatternFlowArpOperationMetricTagIter struct { + obj *patternFlowArpOperation + patternFlowArpOperationMetricTagSlice []PatternFlowArpOperationMetricTag + fieldPtr *[]*otg.PatternFlowArpOperationMetricTag +} + +func newPatternFlowArpOperationPatternFlowArpOperationMetricTagIter(ptr *[]*otg.PatternFlowArpOperationMetricTag) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { + return &patternFlowArpOperationPatternFlowArpOperationMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowArpOperationPatternFlowArpOperationMetricTagIter interface { + setMsg(*patternFlowArpOperation) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter + Items() []PatternFlowArpOperationMetricTag + Add() PatternFlowArpOperationMetricTag + Append(items ...PatternFlowArpOperationMetricTag) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter + Set(index int, newObj PatternFlowArpOperationMetricTag) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter + Clear() PatternFlowArpOperationPatternFlowArpOperationMetricTagIter + clearHolderSlice() PatternFlowArpOperationPatternFlowArpOperationMetricTagIter + appendHolderSlice(item PatternFlowArpOperationMetricTag) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter +} + +func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) setMsg(msg *patternFlowArpOperation) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowArpOperationMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) Items() []PatternFlowArpOperationMetricTag { + return obj.patternFlowArpOperationMetricTagSlice +} + +func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) Add() PatternFlowArpOperationMetricTag { + newObj := &otg.PatternFlowArpOperationMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowArpOperationMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowArpOperationMetricTagSlice = append(obj.patternFlowArpOperationMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) Append(items ...PatternFlowArpOperationMetricTag) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowArpOperationMetricTagSlice = append(obj.patternFlowArpOperationMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) Set(index int, newObj PatternFlowArpOperationMetricTag) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowArpOperationMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) Clear() PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowArpOperationMetricTag{} + obj.patternFlowArpOperationMetricTagSlice = []PatternFlowArpOperationMetricTag{} + } + return obj +} +func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) clearHolderSlice() PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { + if len(obj.patternFlowArpOperationMetricTagSlice) > 0 { + obj.patternFlowArpOperationMetricTagSlice = []PatternFlowArpOperationMetricTag{} + } + return obj +} +func (obj *patternFlowArpOperationPatternFlowArpOperationMetricTagIter) appendHolderSlice(item PatternFlowArpOperationMetricTag) PatternFlowArpOperationPatternFlowArpOperationMetricTagIter { + obj.patternFlowArpOperationMetricTagSlice = append(obj.patternFlowArpOperationMetricTagSlice, item) + return obj +} + +func (obj *patternFlowArpOperation) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpOperation.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowArpOperation.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowArpOperationMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowArpOperation) setDefault() { + var choices_set int = 0 + var choice PatternFlowArpOperationChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowArpOperationChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowArpOperationChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowArpOperationChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowArpOperationChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowArpOperationChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpOperation") + } + } else { + intVal := otg.PatternFlowArpOperation_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowArpOperation_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_arp_operation_counter.go b/gosnappi/pattern_flow_arp_operation_counter.go new file mode 100644 index 00000000..67320942 --- /dev/null +++ b/gosnappi/pattern_flow_arp_operation_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowArpOperationCounter ***** +type patternFlowArpOperationCounter struct { + validation + obj *otg.PatternFlowArpOperationCounter + marshaller marshalPatternFlowArpOperationCounter + unMarshaller unMarshalPatternFlowArpOperationCounter +} + +func NewPatternFlowArpOperationCounter() PatternFlowArpOperationCounter { + obj := patternFlowArpOperationCounter{obj: &otg.PatternFlowArpOperationCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpOperationCounter) msg() *otg.PatternFlowArpOperationCounter { + return obj.obj +} + +func (obj *patternFlowArpOperationCounter) setMsg(msg *otg.PatternFlowArpOperationCounter) PatternFlowArpOperationCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpOperationCounter struct { + obj *patternFlowArpOperationCounter +} + +type marshalPatternFlowArpOperationCounter interface { + // ToProto marshals PatternFlowArpOperationCounter to protobuf object *otg.PatternFlowArpOperationCounter + ToProto() (*otg.PatternFlowArpOperationCounter, error) + // ToPbText marshals PatternFlowArpOperationCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpOperationCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpOperationCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpOperationCounter struct { + obj *patternFlowArpOperationCounter +} + +type unMarshalPatternFlowArpOperationCounter interface { + // FromProto unmarshals PatternFlowArpOperationCounter from protobuf object *otg.PatternFlowArpOperationCounter + FromProto(msg *otg.PatternFlowArpOperationCounter) (PatternFlowArpOperationCounter, error) + // FromPbText unmarshals PatternFlowArpOperationCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpOperationCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpOperationCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpOperationCounter) Marshal() marshalPatternFlowArpOperationCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpOperationCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpOperationCounter) Unmarshal() unMarshalPatternFlowArpOperationCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpOperationCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpOperationCounter) ToProto() (*otg.PatternFlowArpOperationCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpOperationCounter) FromProto(msg *otg.PatternFlowArpOperationCounter) (PatternFlowArpOperationCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpOperationCounter) 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 *unMarshalpatternFlowArpOperationCounter) 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 *marshalpatternFlowArpOperationCounter) 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 *unMarshalpatternFlowArpOperationCounter) 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 *marshalpatternFlowArpOperationCounter) 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 *unMarshalpatternFlowArpOperationCounter) 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 *patternFlowArpOperationCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpOperationCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpOperationCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpOperationCounter) Clone() (PatternFlowArpOperationCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpOperationCounter() + 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 +} + +// PatternFlowArpOperationCounter is integer counter pattern +type PatternFlowArpOperationCounter interface { + Validation + // msg marshals PatternFlowArpOperationCounter to protobuf object *otg.PatternFlowArpOperationCounter + // and doesn't set defaults + msg() *otg.PatternFlowArpOperationCounter + // setMsg unmarshals PatternFlowArpOperationCounter from protobuf object *otg.PatternFlowArpOperationCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowArpOperationCounter) PatternFlowArpOperationCounter + // provides marshal interface + Marshal() marshalPatternFlowArpOperationCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpOperationCounter + // validate validates PatternFlowArpOperationCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpOperationCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowArpOperationCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowArpOperationCounter + SetStart(value uint32) PatternFlowArpOperationCounter + // HasStart checks if Start has been set in PatternFlowArpOperationCounter + HasStart() bool + // Step returns uint32, set in PatternFlowArpOperationCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowArpOperationCounter + SetStep(value uint32) PatternFlowArpOperationCounter + // HasStep checks if Step has been set in PatternFlowArpOperationCounter + HasStep() bool + // Count returns uint32, set in PatternFlowArpOperationCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowArpOperationCounter + SetCount(value uint32) PatternFlowArpOperationCounter + // HasCount checks if Count has been set in PatternFlowArpOperationCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowArpOperationCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowArpOperationCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowArpOperationCounter object +func (obj *patternFlowArpOperationCounter) SetStart(value uint32) PatternFlowArpOperationCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowArpOperationCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowArpOperationCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowArpOperationCounter object +func (obj *patternFlowArpOperationCounter) SetStep(value uint32) PatternFlowArpOperationCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpOperationCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpOperationCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowArpOperationCounter object +func (obj *patternFlowArpOperationCounter) SetCount(value uint32) PatternFlowArpOperationCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowArpOperationCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpOperationCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpOperationCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpOperationCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowArpOperationCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_arp_operation_metric_tag.go b/gosnappi/pattern_flow_arp_operation_metric_tag.go new file mode 100644 index 00000000..6eb19333 --- /dev/null +++ b/gosnappi/pattern_flow_arp_operation_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowArpOperationMetricTag ***** +type patternFlowArpOperationMetricTag struct { + validation + obj *otg.PatternFlowArpOperationMetricTag + marshaller marshalPatternFlowArpOperationMetricTag + unMarshaller unMarshalPatternFlowArpOperationMetricTag +} + +func NewPatternFlowArpOperationMetricTag() PatternFlowArpOperationMetricTag { + obj := patternFlowArpOperationMetricTag{obj: &otg.PatternFlowArpOperationMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpOperationMetricTag) msg() *otg.PatternFlowArpOperationMetricTag { + return obj.obj +} + +func (obj *patternFlowArpOperationMetricTag) setMsg(msg *otg.PatternFlowArpOperationMetricTag) PatternFlowArpOperationMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpOperationMetricTag struct { + obj *patternFlowArpOperationMetricTag +} + +type marshalPatternFlowArpOperationMetricTag interface { + // ToProto marshals PatternFlowArpOperationMetricTag to protobuf object *otg.PatternFlowArpOperationMetricTag + ToProto() (*otg.PatternFlowArpOperationMetricTag, error) + // ToPbText marshals PatternFlowArpOperationMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpOperationMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpOperationMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpOperationMetricTag struct { + obj *patternFlowArpOperationMetricTag +} + +type unMarshalPatternFlowArpOperationMetricTag interface { + // FromProto unmarshals PatternFlowArpOperationMetricTag from protobuf object *otg.PatternFlowArpOperationMetricTag + FromProto(msg *otg.PatternFlowArpOperationMetricTag) (PatternFlowArpOperationMetricTag, error) + // FromPbText unmarshals PatternFlowArpOperationMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpOperationMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpOperationMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpOperationMetricTag) Marshal() marshalPatternFlowArpOperationMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpOperationMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpOperationMetricTag) Unmarshal() unMarshalPatternFlowArpOperationMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpOperationMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpOperationMetricTag) ToProto() (*otg.PatternFlowArpOperationMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpOperationMetricTag) FromProto(msg *otg.PatternFlowArpOperationMetricTag) (PatternFlowArpOperationMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpOperationMetricTag) 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 *unMarshalpatternFlowArpOperationMetricTag) 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 *marshalpatternFlowArpOperationMetricTag) 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 *unMarshalpatternFlowArpOperationMetricTag) 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 *marshalpatternFlowArpOperationMetricTag) 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 *unMarshalpatternFlowArpOperationMetricTag) 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 *patternFlowArpOperationMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpOperationMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpOperationMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpOperationMetricTag) Clone() (PatternFlowArpOperationMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpOperationMetricTag() + 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 +} + +// PatternFlowArpOperationMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowArpOperationMetricTag interface { + Validation + // msg marshals PatternFlowArpOperationMetricTag to protobuf object *otg.PatternFlowArpOperationMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowArpOperationMetricTag + // setMsg unmarshals PatternFlowArpOperationMetricTag from protobuf object *otg.PatternFlowArpOperationMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowArpOperationMetricTag) PatternFlowArpOperationMetricTag + // provides marshal interface + Marshal() marshalPatternFlowArpOperationMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpOperationMetricTag + // validate validates PatternFlowArpOperationMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpOperationMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowArpOperationMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowArpOperationMetricTag + SetName(value string) PatternFlowArpOperationMetricTag + // Offset returns uint32, set in PatternFlowArpOperationMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowArpOperationMetricTag + SetOffset(value uint32) PatternFlowArpOperationMetricTag + // HasOffset checks if Offset has been set in PatternFlowArpOperationMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowArpOperationMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowArpOperationMetricTag + SetLength(value uint32) PatternFlowArpOperationMetricTag + // HasLength checks if Length has been set in PatternFlowArpOperationMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowArpOperationMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowArpOperationMetricTag object +func (obj *patternFlowArpOperationMetricTag) SetName(value string) PatternFlowArpOperationMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpOperationMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpOperationMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowArpOperationMetricTag object +func (obj *patternFlowArpOperationMetricTag) SetOffset(value uint32) PatternFlowArpOperationMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpOperationMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpOperationMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowArpOperationMetricTag object +func (obj *patternFlowArpOperationMetricTag) SetLength(value uint32) PatternFlowArpOperationMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowArpOperationMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpOperationMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpOperationMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowArpOperationMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowArpOperationMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_arp_protocol_length.go b/gosnappi/pattern_flow_arp_protocol_length.go new file mode 100644 index 00000000..d7a2c832 --- /dev/null +++ b/gosnappi/pattern_flow_arp_protocol_length.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowArpProtocolLength ***** +type patternFlowArpProtocolLength struct { + validation + obj *otg.PatternFlowArpProtocolLength + marshaller marshalPatternFlowArpProtocolLength + unMarshaller unMarshalPatternFlowArpProtocolLength + incrementHolder PatternFlowArpProtocolLengthCounter + decrementHolder PatternFlowArpProtocolLengthCounter + metricTagsHolder PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter +} + +func NewPatternFlowArpProtocolLength() PatternFlowArpProtocolLength { + obj := patternFlowArpProtocolLength{obj: &otg.PatternFlowArpProtocolLength{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpProtocolLength) msg() *otg.PatternFlowArpProtocolLength { + return obj.obj +} + +func (obj *patternFlowArpProtocolLength) setMsg(msg *otg.PatternFlowArpProtocolLength) PatternFlowArpProtocolLength { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpProtocolLength struct { + obj *patternFlowArpProtocolLength +} + +type marshalPatternFlowArpProtocolLength interface { + // ToProto marshals PatternFlowArpProtocolLength to protobuf object *otg.PatternFlowArpProtocolLength + ToProto() (*otg.PatternFlowArpProtocolLength, error) + // ToPbText marshals PatternFlowArpProtocolLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpProtocolLength to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpProtocolLength to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpProtocolLength struct { + obj *patternFlowArpProtocolLength +} + +type unMarshalPatternFlowArpProtocolLength interface { + // FromProto unmarshals PatternFlowArpProtocolLength from protobuf object *otg.PatternFlowArpProtocolLength + FromProto(msg *otg.PatternFlowArpProtocolLength) (PatternFlowArpProtocolLength, error) + // FromPbText unmarshals PatternFlowArpProtocolLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpProtocolLength from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpProtocolLength from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpProtocolLength) Marshal() marshalPatternFlowArpProtocolLength { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpProtocolLength{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpProtocolLength) Unmarshal() unMarshalPatternFlowArpProtocolLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpProtocolLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpProtocolLength) ToProto() (*otg.PatternFlowArpProtocolLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpProtocolLength) FromProto(msg *otg.PatternFlowArpProtocolLength) (PatternFlowArpProtocolLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpProtocolLength) 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 *unMarshalpatternFlowArpProtocolLength) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowArpProtocolLength) 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 *unMarshalpatternFlowArpProtocolLength) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowArpProtocolLength) 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 *unMarshalpatternFlowArpProtocolLength) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowArpProtocolLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpProtocolLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpProtocolLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpProtocolLength) Clone() (PatternFlowArpProtocolLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpProtocolLength() + 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 +} + +func (obj *patternFlowArpProtocolLength) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowArpProtocolLength is length (in octets) of internetwork addresses +type PatternFlowArpProtocolLength interface { + Validation + // msg marshals PatternFlowArpProtocolLength to protobuf object *otg.PatternFlowArpProtocolLength + // and doesn't set defaults + msg() *otg.PatternFlowArpProtocolLength + // setMsg unmarshals PatternFlowArpProtocolLength from protobuf object *otg.PatternFlowArpProtocolLength + // and doesn't set defaults + setMsg(*otg.PatternFlowArpProtocolLength) PatternFlowArpProtocolLength + // provides marshal interface + Marshal() marshalPatternFlowArpProtocolLength + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpProtocolLength + // validate validates PatternFlowArpProtocolLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpProtocolLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowArpProtocolLengthChoiceEnum, set in PatternFlowArpProtocolLength + Choice() PatternFlowArpProtocolLengthChoiceEnum + // setChoice assigns PatternFlowArpProtocolLengthChoiceEnum provided by user to PatternFlowArpProtocolLength + setChoice(value PatternFlowArpProtocolLengthChoiceEnum) PatternFlowArpProtocolLength + // HasChoice checks if Choice has been set in PatternFlowArpProtocolLength + HasChoice() bool + // Value returns uint32, set in PatternFlowArpProtocolLength. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowArpProtocolLength + SetValue(value uint32) PatternFlowArpProtocolLength + // HasValue checks if Value has been set in PatternFlowArpProtocolLength + HasValue() bool + // Values returns []uint32, set in PatternFlowArpProtocolLength. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowArpProtocolLength + SetValues(value []uint32) PatternFlowArpProtocolLength + // Increment returns PatternFlowArpProtocolLengthCounter, set in PatternFlowArpProtocolLength. + // PatternFlowArpProtocolLengthCounter is integer counter pattern + Increment() PatternFlowArpProtocolLengthCounter + // SetIncrement assigns PatternFlowArpProtocolLengthCounter provided by user to PatternFlowArpProtocolLength. + // PatternFlowArpProtocolLengthCounter is integer counter pattern + SetIncrement(value PatternFlowArpProtocolLengthCounter) PatternFlowArpProtocolLength + // HasIncrement checks if Increment has been set in PatternFlowArpProtocolLength + HasIncrement() bool + // Decrement returns PatternFlowArpProtocolLengthCounter, set in PatternFlowArpProtocolLength. + // PatternFlowArpProtocolLengthCounter is integer counter pattern + Decrement() PatternFlowArpProtocolLengthCounter + // SetDecrement assigns PatternFlowArpProtocolLengthCounter provided by user to PatternFlowArpProtocolLength. + // PatternFlowArpProtocolLengthCounter is integer counter pattern + SetDecrement(value PatternFlowArpProtocolLengthCounter) PatternFlowArpProtocolLength + // HasDecrement checks if Decrement has been set in PatternFlowArpProtocolLength + HasDecrement() bool + // MetricTags returns PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIterIter, set in PatternFlowArpProtocolLength + MetricTags() PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter + setNil() +} + +type PatternFlowArpProtocolLengthChoiceEnum string + +// Enum of Choice on PatternFlowArpProtocolLength +var PatternFlowArpProtocolLengthChoice = struct { + VALUE PatternFlowArpProtocolLengthChoiceEnum + VALUES PatternFlowArpProtocolLengthChoiceEnum + INCREMENT PatternFlowArpProtocolLengthChoiceEnum + DECREMENT PatternFlowArpProtocolLengthChoiceEnum +}{ + VALUE: PatternFlowArpProtocolLengthChoiceEnum("value"), + VALUES: PatternFlowArpProtocolLengthChoiceEnum("values"), + INCREMENT: PatternFlowArpProtocolLengthChoiceEnum("increment"), + DECREMENT: PatternFlowArpProtocolLengthChoiceEnum("decrement"), +} + +func (obj *patternFlowArpProtocolLength) Choice() PatternFlowArpProtocolLengthChoiceEnum { + return PatternFlowArpProtocolLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowArpProtocolLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowArpProtocolLength) setChoice(value PatternFlowArpProtocolLengthChoiceEnum) PatternFlowArpProtocolLength { + intValue, ok := otg.PatternFlowArpProtocolLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowArpProtocolLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowArpProtocolLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowArpProtocolLengthChoice.VALUE { + defaultValue := uint32(4) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowArpProtocolLengthChoice.VALUES { + defaultValue := []uint32{4} + obj.obj.Values = defaultValue + } + + if value == PatternFlowArpProtocolLengthChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowArpProtocolLengthCounter().msg() + } + + if value == PatternFlowArpProtocolLengthChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowArpProtocolLengthCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowArpProtocolLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowArpProtocolLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowArpProtocolLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowArpProtocolLength object +func (obj *patternFlowArpProtocolLength) SetValue(value uint32) PatternFlowArpProtocolLength { + obj.setChoice(PatternFlowArpProtocolLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowArpProtocolLength) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{4}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowArpProtocolLength object +func (obj *patternFlowArpProtocolLength) SetValues(value []uint32) PatternFlowArpProtocolLength { + obj.setChoice(PatternFlowArpProtocolLengthChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowArpProtocolLengthCounter +func (obj *patternFlowArpProtocolLength) Increment() PatternFlowArpProtocolLengthCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowArpProtocolLengthChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowArpProtocolLengthCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowArpProtocolLengthCounter +func (obj *patternFlowArpProtocolLength) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowArpProtocolLengthCounter value in the PatternFlowArpProtocolLength object +func (obj *patternFlowArpProtocolLength) SetIncrement(value PatternFlowArpProtocolLengthCounter) PatternFlowArpProtocolLength { + obj.setChoice(PatternFlowArpProtocolLengthChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowArpProtocolLengthCounter +func (obj *patternFlowArpProtocolLength) Decrement() PatternFlowArpProtocolLengthCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowArpProtocolLengthChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowArpProtocolLengthCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowArpProtocolLengthCounter +func (obj *patternFlowArpProtocolLength) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowArpProtocolLengthCounter value in the PatternFlowArpProtocolLength object +func (obj *patternFlowArpProtocolLength) SetDecrement(value PatternFlowArpProtocolLengthCounter) PatternFlowArpProtocolLength { + obj.setChoice(PatternFlowArpProtocolLengthChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowArpProtocolLengthMetricTag +func (obj *patternFlowArpProtocolLength) MetricTags() PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowArpProtocolLengthMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter struct { + obj *patternFlowArpProtocolLength + patternFlowArpProtocolLengthMetricTagSlice []PatternFlowArpProtocolLengthMetricTag + fieldPtr *[]*otg.PatternFlowArpProtocolLengthMetricTag +} + +func newPatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter(ptr *[]*otg.PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { + return &patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter interface { + setMsg(*patternFlowArpProtocolLength) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter + Items() []PatternFlowArpProtocolLengthMetricTag + Add() PatternFlowArpProtocolLengthMetricTag + Append(items ...PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter + Set(index int, newObj PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter + Clear() PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter + clearHolderSlice() PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter + appendHolderSlice(item PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter +} + +func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) setMsg(msg *patternFlowArpProtocolLength) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowArpProtocolLengthMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) Items() []PatternFlowArpProtocolLengthMetricTag { + return obj.patternFlowArpProtocolLengthMetricTagSlice +} + +func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) Add() PatternFlowArpProtocolLengthMetricTag { + newObj := &otg.PatternFlowArpProtocolLengthMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowArpProtocolLengthMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowArpProtocolLengthMetricTagSlice = append(obj.patternFlowArpProtocolLengthMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) Append(items ...PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowArpProtocolLengthMetricTagSlice = append(obj.patternFlowArpProtocolLengthMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) Set(index int, newObj PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowArpProtocolLengthMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) Clear() PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowArpProtocolLengthMetricTag{} + obj.patternFlowArpProtocolLengthMetricTagSlice = []PatternFlowArpProtocolLengthMetricTag{} + } + return obj +} +func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) clearHolderSlice() PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { + if len(obj.patternFlowArpProtocolLengthMetricTagSlice) > 0 { + obj.patternFlowArpProtocolLengthMetricTagSlice = []PatternFlowArpProtocolLengthMetricTag{} + } + return obj +} +func (obj *patternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter) appendHolderSlice(item PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthPatternFlowArpProtocolLengthMetricTagIter { + obj.patternFlowArpProtocolLengthMetricTagSlice = append(obj.patternFlowArpProtocolLengthMetricTagSlice, item) + return obj +} + +func (obj *patternFlowArpProtocolLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpProtocolLength.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowArpProtocolLength.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowArpProtocolLengthMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowArpProtocolLength) setDefault() { + var choices_set int = 0 + var choice PatternFlowArpProtocolLengthChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowArpProtocolLengthChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowArpProtocolLengthChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowArpProtocolLengthChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowArpProtocolLengthChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowArpProtocolLengthChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpProtocolLength") + } + } else { + intVal := otg.PatternFlowArpProtocolLength_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowArpProtocolLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_arp_protocol_length_counter.go b/gosnappi/pattern_flow_arp_protocol_length_counter.go new file mode 100644 index 00000000..af3f40fc --- /dev/null +++ b/gosnappi/pattern_flow_arp_protocol_length_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowArpProtocolLengthCounter ***** +type patternFlowArpProtocolLengthCounter struct { + validation + obj *otg.PatternFlowArpProtocolLengthCounter + marshaller marshalPatternFlowArpProtocolLengthCounter + unMarshaller unMarshalPatternFlowArpProtocolLengthCounter +} + +func NewPatternFlowArpProtocolLengthCounter() PatternFlowArpProtocolLengthCounter { + obj := patternFlowArpProtocolLengthCounter{obj: &otg.PatternFlowArpProtocolLengthCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpProtocolLengthCounter) msg() *otg.PatternFlowArpProtocolLengthCounter { + return obj.obj +} + +func (obj *patternFlowArpProtocolLengthCounter) setMsg(msg *otg.PatternFlowArpProtocolLengthCounter) PatternFlowArpProtocolLengthCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpProtocolLengthCounter struct { + obj *patternFlowArpProtocolLengthCounter +} + +type marshalPatternFlowArpProtocolLengthCounter interface { + // ToProto marshals PatternFlowArpProtocolLengthCounter to protobuf object *otg.PatternFlowArpProtocolLengthCounter + ToProto() (*otg.PatternFlowArpProtocolLengthCounter, error) + // ToPbText marshals PatternFlowArpProtocolLengthCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpProtocolLengthCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpProtocolLengthCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpProtocolLengthCounter struct { + obj *patternFlowArpProtocolLengthCounter +} + +type unMarshalPatternFlowArpProtocolLengthCounter interface { + // FromProto unmarshals PatternFlowArpProtocolLengthCounter from protobuf object *otg.PatternFlowArpProtocolLengthCounter + FromProto(msg *otg.PatternFlowArpProtocolLengthCounter) (PatternFlowArpProtocolLengthCounter, error) + // FromPbText unmarshals PatternFlowArpProtocolLengthCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpProtocolLengthCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpProtocolLengthCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpProtocolLengthCounter) Marshal() marshalPatternFlowArpProtocolLengthCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpProtocolLengthCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpProtocolLengthCounter) Unmarshal() unMarshalPatternFlowArpProtocolLengthCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpProtocolLengthCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpProtocolLengthCounter) ToProto() (*otg.PatternFlowArpProtocolLengthCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpProtocolLengthCounter) FromProto(msg *otg.PatternFlowArpProtocolLengthCounter) (PatternFlowArpProtocolLengthCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpProtocolLengthCounter) 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 *unMarshalpatternFlowArpProtocolLengthCounter) 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 *marshalpatternFlowArpProtocolLengthCounter) 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 *unMarshalpatternFlowArpProtocolLengthCounter) 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 *marshalpatternFlowArpProtocolLengthCounter) 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 *unMarshalpatternFlowArpProtocolLengthCounter) 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 *patternFlowArpProtocolLengthCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpProtocolLengthCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpProtocolLengthCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpProtocolLengthCounter) Clone() (PatternFlowArpProtocolLengthCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpProtocolLengthCounter() + 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 +} + +// PatternFlowArpProtocolLengthCounter is integer counter pattern +type PatternFlowArpProtocolLengthCounter interface { + Validation + // msg marshals PatternFlowArpProtocolLengthCounter to protobuf object *otg.PatternFlowArpProtocolLengthCounter + // and doesn't set defaults + msg() *otg.PatternFlowArpProtocolLengthCounter + // setMsg unmarshals PatternFlowArpProtocolLengthCounter from protobuf object *otg.PatternFlowArpProtocolLengthCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowArpProtocolLengthCounter) PatternFlowArpProtocolLengthCounter + // provides marshal interface + Marshal() marshalPatternFlowArpProtocolLengthCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpProtocolLengthCounter + // validate validates PatternFlowArpProtocolLengthCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpProtocolLengthCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowArpProtocolLengthCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowArpProtocolLengthCounter + SetStart(value uint32) PatternFlowArpProtocolLengthCounter + // HasStart checks if Start has been set in PatternFlowArpProtocolLengthCounter + HasStart() bool + // Step returns uint32, set in PatternFlowArpProtocolLengthCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowArpProtocolLengthCounter + SetStep(value uint32) PatternFlowArpProtocolLengthCounter + // HasStep checks if Step has been set in PatternFlowArpProtocolLengthCounter + HasStep() bool + // Count returns uint32, set in PatternFlowArpProtocolLengthCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowArpProtocolLengthCounter + SetCount(value uint32) PatternFlowArpProtocolLengthCounter + // HasCount checks if Count has been set in PatternFlowArpProtocolLengthCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowArpProtocolLengthCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowArpProtocolLengthCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowArpProtocolLengthCounter object +func (obj *patternFlowArpProtocolLengthCounter) SetStart(value uint32) PatternFlowArpProtocolLengthCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowArpProtocolLengthCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowArpProtocolLengthCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowArpProtocolLengthCounter object +func (obj *patternFlowArpProtocolLengthCounter) SetStep(value uint32) PatternFlowArpProtocolLengthCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpProtocolLengthCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpProtocolLengthCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowArpProtocolLengthCounter object +func (obj *patternFlowArpProtocolLengthCounter) SetCount(value uint32) PatternFlowArpProtocolLengthCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowArpProtocolLengthCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpProtocolLengthCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpProtocolLengthCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpProtocolLengthCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowArpProtocolLengthCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(4) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_arp_protocol_length_metric_tag.go b/gosnappi/pattern_flow_arp_protocol_length_metric_tag.go new file mode 100644 index 00000000..d505aff1 --- /dev/null +++ b/gosnappi/pattern_flow_arp_protocol_length_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowArpProtocolLengthMetricTag ***** +type patternFlowArpProtocolLengthMetricTag struct { + validation + obj *otg.PatternFlowArpProtocolLengthMetricTag + marshaller marshalPatternFlowArpProtocolLengthMetricTag + unMarshaller unMarshalPatternFlowArpProtocolLengthMetricTag +} + +func NewPatternFlowArpProtocolLengthMetricTag() PatternFlowArpProtocolLengthMetricTag { + obj := patternFlowArpProtocolLengthMetricTag{obj: &otg.PatternFlowArpProtocolLengthMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpProtocolLengthMetricTag) msg() *otg.PatternFlowArpProtocolLengthMetricTag { + return obj.obj +} + +func (obj *patternFlowArpProtocolLengthMetricTag) setMsg(msg *otg.PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpProtocolLengthMetricTag struct { + obj *patternFlowArpProtocolLengthMetricTag +} + +type marshalPatternFlowArpProtocolLengthMetricTag interface { + // ToProto marshals PatternFlowArpProtocolLengthMetricTag to protobuf object *otg.PatternFlowArpProtocolLengthMetricTag + ToProto() (*otg.PatternFlowArpProtocolLengthMetricTag, error) + // ToPbText marshals PatternFlowArpProtocolLengthMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpProtocolLengthMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpProtocolLengthMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpProtocolLengthMetricTag struct { + obj *patternFlowArpProtocolLengthMetricTag +} + +type unMarshalPatternFlowArpProtocolLengthMetricTag interface { + // FromProto unmarshals PatternFlowArpProtocolLengthMetricTag from protobuf object *otg.PatternFlowArpProtocolLengthMetricTag + FromProto(msg *otg.PatternFlowArpProtocolLengthMetricTag) (PatternFlowArpProtocolLengthMetricTag, error) + // FromPbText unmarshals PatternFlowArpProtocolLengthMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpProtocolLengthMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpProtocolLengthMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpProtocolLengthMetricTag) Marshal() marshalPatternFlowArpProtocolLengthMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpProtocolLengthMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpProtocolLengthMetricTag) Unmarshal() unMarshalPatternFlowArpProtocolLengthMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpProtocolLengthMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpProtocolLengthMetricTag) ToProto() (*otg.PatternFlowArpProtocolLengthMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpProtocolLengthMetricTag) FromProto(msg *otg.PatternFlowArpProtocolLengthMetricTag) (PatternFlowArpProtocolLengthMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpProtocolLengthMetricTag) 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 *unMarshalpatternFlowArpProtocolLengthMetricTag) 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 *marshalpatternFlowArpProtocolLengthMetricTag) 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 *unMarshalpatternFlowArpProtocolLengthMetricTag) 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 *marshalpatternFlowArpProtocolLengthMetricTag) 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 *unMarshalpatternFlowArpProtocolLengthMetricTag) 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 *patternFlowArpProtocolLengthMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpProtocolLengthMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpProtocolLengthMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpProtocolLengthMetricTag) Clone() (PatternFlowArpProtocolLengthMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpProtocolLengthMetricTag() + 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 +} + +// PatternFlowArpProtocolLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowArpProtocolLengthMetricTag interface { + Validation + // msg marshals PatternFlowArpProtocolLengthMetricTag to protobuf object *otg.PatternFlowArpProtocolLengthMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowArpProtocolLengthMetricTag + // setMsg unmarshals PatternFlowArpProtocolLengthMetricTag from protobuf object *otg.PatternFlowArpProtocolLengthMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowArpProtocolLengthMetricTag) PatternFlowArpProtocolLengthMetricTag + // provides marshal interface + Marshal() marshalPatternFlowArpProtocolLengthMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpProtocolLengthMetricTag + // validate validates PatternFlowArpProtocolLengthMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpProtocolLengthMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowArpProtocolLengthMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowArpProtocolLengthMetricTag + SetName(value string) PatternFlowArpProtocolLengthMetricTag + // Offset returns uint32, set in PatternFlowArpProtocolLengthMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowArpProtocolLengthMetricTag + SetOffset(value uint32) PatternFlowArpProtocolLengthMetricTag + // HasOffset checks if Offset has been set in PatternFlowArpProtocolLengthMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowArpProtocolLengthMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowArpProtocolLengthMetricTag + SetLength(value uint32) PatternFlowArpProtocolLengthMetricTag + // HasLength checks if Length has been set in PatternFlowArpProtocolLengthMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowArpProtocolLengthMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowArpProtocolLengthMetricTag object +func (obj *patternFlowArpProtocolLengthMetricTag) SetName(value string) PatternFlowArpProtocolLengthMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpProtocolLengthMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpProtocolLengthMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowArpProtocolLengthMetricTag object +func (obj *patternFlowArpProtocolLengthMetricTag) SetOffset(value uint32) PatternFlowArpProtocolLengthMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpProtocolLengthMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpProtocolLengthMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowArpProtocolLengthMetricTag object +func (obj *patternFlowArpProtocolLengthMetricTag) SetLength(value uint32) PatternFlowArpProtocolLengthMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowArpProtocolLengthMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpProtocolLengthMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpProtocolLengthMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowArpProtocolLengthMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowArpProtocolLengthMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_arp_protocol_type.go b/gosnappi/pattern_flow_arp_protocol_type.go new file mode 100644 index 00000000..a059dc72 --- /dev/null +++ b/gosnappi/pattern_flow_arp_protocol_type.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowArpProtocolType ***** +type patternFlowArpProtocolType struct { + validation + obj *otg.PatternFlowArpProtocolType + marshaller marshalPatternFlowArpProtocolType + unMarshaller unMarshalPatternFlowArpProtocolType + incrementHolder PatternFlowArpProtocolTypeCounter + decrementHolder PatternFlowArpProtocolTypeCounter + metricTagsHolder PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter +} + +func NewPatternFlowArpProtocolType() PatternFlowArpProtocolType { + obj := patternFlowArpProtocolType{obj: &otg.PatternFlowArpProtocolType{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpProtocolType) msg() *otg.PatternFlowArpProtocolType { + return obj.obj +} + +func (obj *patternFlowArpProtocolType) setMsg(msg *otg.PatternFlowArpProtocolType) PatternFlowArpProtocolType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpProtocolType struct { + obj *patternFlowArpProtocolType +} + +type marshalPatternFlowArpProtocolType interface { + // ToProto marshals PatternFlowArpProtocolType to protobuf object *otg.PatternFlowArpProtocolType + ToProto() (*otg.PatternFlowArpProtocolType, error) + // ToPbText marshals PatternFlowArpProtocolType to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpProtocolType to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpProtocolType to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpProtocolType struct { + obj *patternFlowArpProtocolType +} + +type unMarshalPatternFlowArpProtocolType interface { + // FromProto unmarshals PatternFlowArpProtocolType from protobuf object *otg.PatternFlowArpProtocolType + FromProto(msg *otg.PatternFlowArpProtocolType) (PatternFlowArpProtocolType, error) + // FromPbText unmarshals PatternFlowArpProtocolType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpProtocolType from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpProtocolType from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpProtocolType) Marshal() marshalPatternFlowArpProtocolType { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpProtocolType{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpProtocolType) Unmarshal() unMarshalPatternFlowArpProtocolType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpProtocolType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpProtocolType) ToProto() (*otg.PatternFlowArpProtocolType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpProtocolType) FromProto(msg *otg.PatternFlowArpProtocolType) (PatternFlowArpProtocolType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpProtocolType) 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 *unMarshalpatternFlowArpProtocolType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowArpProtocolType) 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 *unMarshalpatternFlowArpProtocolType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowArpProtocolType) 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 *unMarshalpatternFlowArpProtocolType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowArpProtocolType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpProtocolType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpProtocolType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpProtocolType) Clone() (PatternFlowArpProtocolType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpProtocolType() + 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 +} + +func (obj *patternFlowArpProtocolType) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowArpProtocolType is the internetwork protocol for which the ARP request is intended +type PatternFlowArpProtocolType interface { + Validation + // msg marshals PatternFlowArpProtocolType to protobuf object *otg.PatternFlowArpProtocolType + // and doesn't set defaults + msg() *otg.PatternFlowArpProtocolType + // setMsg unmarshals PatternFlowArpProtocolType from protobuf object *otg.PatternFlowArpProtocolType + // and doesn't set defaults + setMsg(*otg.PatternFlowArpProtocolType) PatternFlowArpProtocolType + // provides marshal interface + Marshal() marshalPatternFlowArpProtocolType + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpProtocolType + // validate validates PatternFlowArpProtocolType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpProtocolType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowArpProtocolTypeChoiceEnum, set in PatternFlowArpProtocolType + Choice() PatternFlowArpProtocolTypeChoiceEnum + // setChoice assigns PatternFlowArpProtocolTypeChoiceEnum provided by user to PatternFlowArpProtocolType + setChoice(value PatternFlowArpProtocolTypeChoiceEnum) PatternFlowArpProtocolType + // HasChoice checks if Choice has been set in PatternFlowArpProtocolType + HasChoice() bool + // Value returns uint32, set in PatternFlowArpProtocolType. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowArpProtocolType + SetValue(value uint32) PatternFlowArpProtocolType + // HasValue checks if Value has been set in PatternFlowArpProtocolType + HasValue() bool + // Values returns []uint32, set in PatternFlowArpProtocolType. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowArpProtocolType + SetValues(value []uint32) PatternFlowArpProtocolType + // Increment returns PatternFlowArpProtocolTypeCounter, set in PatternFlowArpProtocolType. + // PatternFlowArpProtocolTypeCounter is integer counter pattern + Increment() PatternFlowArpProtocolTypeCounter + // SetIncrement assigns PatternFlowArpProtocolTypeCounter provided by user to PatternFlowArpProtocolType. + // PatternFlowArpProtocolTypeCounter is integer counter pattern + SetIncrement(value PatternFlowArpProtocolTypeCounter) PatternFlowArpProtocolType + // HasIncrement checks if Increment has been set in PatternFlowArpProtocolType + HasIncrement() bool + // Decrement returns PatternFlowArpProtocolTypeCounter, set in PatternFlowArpProtocolType. + // PatternFlowArpProtocolTypeCounter is integer counter pattern + Decrement() PatternFlowArpProtocolTypeCounter + // SetDecrement assigns PatternFlowArpProtocolTypeCounter provided by user to PatternFlowArpProtocolType. + // PatternFlowArpProtocolTypeCounter is integer counter pattern + SetDecrement(value PatternFlowArpProtocolTypeCounter) PatternFlowArpProtocolType + // HasDecrement checks if Decrement has been set in PatternFlowArpProtocolType + HasDecrement() bool + // MetricTags returns PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIterIter, set in PatternFlowArpProtocolType + MetricTags() PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter + setNil() +} + +type PatternFlowArpProtocolTypeChoiceEnum string + +// Enum of Choice on PatternFlowArpProtocolType +var PatternFlowArpProtocolTypeChoice = struct { + VALUE PatternFlowArpProtocolTypeChoiceEnum + VALUES PatternFlowArpProtocolTypeChoiceEnum + INCREMENT PatternFlowArpProtocolTypeChoiceEnum + DECREMENT PatternFlowArpProtocolTypeChoiceEnum +}{ + VALUE: PatternFlowArpProtocolTypeChoiceEnum("value"), + VALUES: PatternFlowArpProtocolTypeChoiceEnum("values"), + INCREMENT: PatternFlowArpProtocolTypeChoiceEnum("increment"), + DECREMENT: PatternFlowArpProtocolTypeChoiceEnum("decrement"), +} + +func (obj *patternFlowArpProtocolType) Choice() PatternFlowArpProtocolTypeChoiceEnum { + return PatternFlowArpProtocolTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowArpProtocolType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowArpProtocolType) setChoice(value PatternFlowArpProtocolTypeChoiceEnum) PatternFlowArpProtocolType { + intValue, ok := otg.PatternFlowArpProtocolType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowArpProtocolTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowArpProtocolType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowArpProtocolTypeChoice.VALUE { + defaultValue := uint32(2048) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowArpProtocolTypeChoice.VALUES { + defaultValue := []uint32{2048} + obj.obj.Values = defaultValue + } + + if value == PatternFlowArpProtocolTypeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowArpProtocolTypeCounter().msg() + } + + if value == PatternFlowArpProtocolTypeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowArpProtocolTypeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowArpProtocolType) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowArpProtocolTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowArpProtocolType) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowArpProtocolType object +func (obj *patternFlowArpProtocolType) SetValue(value uint32) PatternFlowArpProtocolType { + obj.setChoice(PatternFlowArpProtocolTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowArpProtocolType) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{2048}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowArpProtocolType object +func (obj *patternFlowArpProtocolType) SetValues(value []uint32) PatternFlowArpProtocolType { + obj.setChoice(PatternFlowArpProtocolTypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowArpProtocolTypeCounter +func (obj *patternFlowArpProtocolType) Increment() PatternFlowArpProtocolTypeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowArpProtocolTypeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowArpProtocolTypeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowArpProtocolTypeCounter +func (obj *patternFlowArpProtocolType) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowArpProtocolTypeCounter value in the PatternFlowArpProtocolType object +func (obj *patternFlowArpProtocolType) SetIncrement(value PatternFlowArpProtocolTypeCounter) PatternFlowArpProtocolType { + obj.setChoice(PatternFlowArpProtocolTypeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowArpProtocolTypeCounter +func (obj *patternFlowArpProtocolType) Decrement() PatternFlowArpProtocolTypeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowArpProtocolTypeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowArpProtocolTypeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowArpProtocolTypeCounter +func (obj *patternFlowArpProtocolType) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowArpProtocolTypeCounter value in the PatternFlowArpProtocolType object +func (obj *patternFlowArpProtocolType) SetDecrement(value PatternFlowArpProtocolTypeCounter) PatternFlowArpProtocolType { + obj.setChoice(PatternFlowArpProtocolTypeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowArpProtocolTypeMetricTag +func (obj *patternFlowArpProtocolType) MetricTags() PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowArpProtocolTypeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter struct { + obj *patternFlowArpProtocolType + patternFlowArpProtocolTypeMetricTagSlice []PatternFlowArpProtocolTypeMetricTag + fieldPtr *[]*otg.PatternFlowArpProtocolTypeMetricTag +} + +func newPatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter(ptr *[]*otg.PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { + return &patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter interface { + setMsg(*patternFlowArpProtocolType) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter + Items() []PatternFlowArpProtocolTypeMetricTag + Add() PatternFlowArpProtocolTypeMetricTag + Append(items ...PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter + Set(index int, newObj PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter + Clear() PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter + clearHolderSlice() PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter + appendHolderSlice(item PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter +} + +func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) setMsg(msg *patternFlowArpProtocolType) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowArpProtocolTypeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) Items() []PatternFlowArpProtocolTypeMetricTag { + return obj.patternFlowArpProtocolTypeMetricTagSlice +} + +func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) Add() PatternFlowArpProtocolTypeMetricTag { + newObj := &otg.PatternFlowArpProtocolTypeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowArpProtocolTypeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowArpProtocolTypeMetricTagSlice = append(obj.patternFlowArpProtocolTypeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) Append(items ...PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowArpProtocolTypeMetricTagSlice = append(obj.patternFlowArpProtocolTypeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) Set(index int, newObj PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowArpProtocolTypeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) Clear() PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowArpProtocolTypeMetricTag{} + obj.patternFlowArpProtocolTypeMetricTagSlice = []PatternFlowArpProtocolTypeMetricTag{} + } + return obj +} +func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) clearHolderSlice() PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { + if len(obj.patternFlowArpProtocolTypeMetricTagSlice) > 0 { + obj.patternFlowArpProtocolTypeMetricTagSlice = []PatternFlowArpProtocolTypeMetricTag{} + } + return obj +} +func (obj *patternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter) appendHolderSlice(item PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypePatternFlowArpProtocolTypeMetricTagIter { + obj.patternFlowArpProtocolTypeMetricTagSlice = append(obj.patternFlowArpProtocolTypeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowArpProtocolType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpProtocolType.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowArpProtocolType.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowArpProtocolTypeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowArpProtocolType) setDefault() { + var choices_set int = 0 + var choice PatternFlowArpProtocolTypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowArpProtocolTypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowArpProtocolTypeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowArpProtocolTypeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowArpProtocolTypeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowArpProtocolTypeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpProtocolType") + } + } else { + intVal := otg.PatternFlowArpProtocolType_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowArpProtocolType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_arp_protocol_type_counter.go b/gosnappi/pattern_flow_arp_protocol_type_counter.go new file mode 100644 index 00000000..629366d2 --- /dev/null +++ b/gosnappi/pattern_flow_arp_protocol_type_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowArpProtocolTypeCounter ***** +type patternFlowArpProtocolTypeCounter struct { + validation + obj *otg.PatternFlowArpProtocolTypeCounter + marshaller marshalPatternFlowArpProtocolTypeCounter + unMarshaller unMarshalPatternFlowArpProtocolTypeCounter +} + +func NewPatternFlowArpProtocolTypeCounter() PatternFlowArpProtocolTypeCounter { + obj := patternFlowArpProtocolTypeCounter{obj: &otg.PatternFlowArpProtocolTypeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpProtocolTypeCounter) msg() *otg.PatternFlowArpProtocolTypeCounter { + return obj.obj +} + +func (obj *patternFlowArpProtocolTypeCounter) setMsg(msg *otg.PatternFlowArpProtocolTypeCounter) PatternFlowArpProtocolTypeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpProtocolTypeCounter struct { + obj *patternFlowArpProtocolTypeCounter +} + +type marshalPatternFlowArpProtocolTypeCounter interface { + // ToProto marshals PatternFlowArpProtocolTypeCounter to protobuf object *otg.PatternFlowArpProtocolTypeCounter + ToProto() (*otg.PatternFlowArpProtocolTypeCounter, error) + // ToPbText marshals PatternFlowArpProtocolTypeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpProtocolTypeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpProtocolTypeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpProtocolTypeCounter struct { + obj *patternFlowArpProtocolTypeCounter +} + +type unMarshalPatternFlowArpProtocolTypeCounter interface { + // FromProto unmarshals PatternFlowArpProtocolTypeCounter from protobuf object *otg.PatternFlowArpProtocolTypeCounter + FromProto(msg *otg.PatternFlowArpProtocolTypeCounter) (PatternFlowArpProtocolTypeCounter, error) + // FromPbText unmarshals PatternFlowArpProtocolTypeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpProtocolTypeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpProtocolTypeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpProtocolTypeCounter) Marshal() marshalPatternFlowArpProtocolTypeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpProtocolTypeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpProtocolTypeCounter) Unmarshal() unMarshalPatternFlowArpProtocolTypeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpProtocolTypeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpProtocolTypeCounter) ToProto() (*otg.PatternFlowArpProtocolTypeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpProtocolTypeCounter) FromProto(msg *otg.PatternFlowArpProtocolTypeCounter) (PatternFlowArpProtocolTypeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpProtocolTypeCounter) 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 *unMarshalpatternFlowArpProtocolTypeCounter) 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 *marshalpatternFlowArpProtocolTypeCounter) 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 *unMarshalpatternFlowArpProtocolTypeCounter) 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 *marshalpatternFlowArpProtocolTypeCounter) 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 *unMarshalpatternFlowArpProtocolTypeCounter) 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 *patternFlowArpProtocolTypeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpProtocolTypeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpProtocolTypeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpProtocolTypeCounter) Clone() (PatternFlowArpProtocolTypeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpProtocolTypeCounter() + 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 +} + +// PatternFlowArpProtocolTypeCounter is integer counter pattern +type PatternFlowArpProtocolTypeCounter interface { + Validation + // msg marshals PatternFlowArpProtocolTypeCounter to protobuf object *otg.PatternFlowArpProtocolTypeCounter + // and doesn't set defaults + msg() *otg.PatternFlowArpProtocolTypeCounter + // setMsg unmarshals PatternFlowArpProtocolTypeCounter from protobuf object *otg.PatternFlowArpProtocolTypeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowArpProtocolTypeCounter) PatternFlowArpProtocolTypeCounter + // provides marshal interface + Marshal() marshalPatternFlowArpProtocolTypeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpProtocolTypeCounter + // validate validates PatternFlowArpProtocolTypeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpProtocolTypeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowArpProtocolTypeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowArpProtocolTypeCounter + SetStart(value uint32) PatternFlowArpProtocolTypeCounter + // HasStart checks if Start has been set in PatternFlowArpProtocolTypeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowArpProtocolTypeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowArpProtocolTypeCounter + SetStep(value uint32) PatternFlowArpProtocolTypeCounter + // HasStep checks if Step has been set in PatternFlowArpProtocolTypeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowArpProtocolTypeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowArpProtocolTypeCounter + SetCount(value uint32) PatternFlowArpProtocolTypeCounter + // HasCount checks if Count has been set in PatternFlowArpProtocolTypeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowArpProtocolTypeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowArpProtocolTypeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowArpProtocolTypeCounter object +func (obj *patternFlowArpProtocolTypeCounter) SetStart(value uint32) PatternFlowArpProtocolTypeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowArpProtocolTypeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowArpProtocolTypeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowArpProtocolTypeCounter object +func (obj *patternFlowArpProtocolTypeCounter) SetStep(value uint32) PatternFlowArpProtocolTypeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpProtocolTypeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpProtocolTypeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowArpProtocolTypeCounter object +func (obj *patternFlowArpProtocolTypeCounter) SetCount(value uint32) PatternFlowArpProtocolTypeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowArpProtocolTypeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpProtocolTypeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpProtocolTypeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpProtocolTypeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowArpProtocolTypeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(2048) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_arp_protocol_type_metric_tag.go b/gosnappi/pattern_flow_arp_protocol_type_metric_tag.go new file mode 100644 index 00000000..cf51bf4d --- /dev/null +++ b/gosnappi/pattern_flow_arp_protocol_type_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowArpProtocolTypeMetricTag ***** +type patternFlowArpProtocolTypeMetricTag struct { + validation + obj *otg.PatternFlowArpProtocolTypeMetricTag + marshaller marshalPatternFlowArpProtocolTypeMetricTag + unMarshaller unMarshalPatternFlowArpProtocolTypeMetricTag +} + +func NewPatternFlowArpProtocolTypeMetricTag() PatternFlowArpProtocolTypeMetricTag { + obj := patternFlowArpProtocolTypeMetricTag{obj: &otg.PatternFlowArpProtocolTypeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpProtocolTypeMetricTag) msg() *otg.PatternFlowArpProtocolTypeMetricTag { + return obj.obj +} + +func (obj *patternFlowArpProtocolTypeMetricTag) setMsg(msg *otg.PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpProtocolTypeMetricTag struct { + obj *patternFlowArpProtocolTypeMetricTag +} + +type marshalPatternFlowArpProtocolTypeMetricTag interface { + // ToProto marshals PatternFlowArpProtocolTypeMetricTag to protobuf object *otg.PatternFlowArpProtocolTypeMetricTag + ToProto() (*otg.PatternFlowArpProtocolTypeMetricTag, error) + // ToPbText marshals PatternFlowArpProtocolTypeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpProtocolTypeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpProtocolTypeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpProtocolTypeMetricTag struct { + obj *patternFlowArpProtocolTypeMetricTag +} + +type unMarshalPatternFlowArpProtocolTypeMetricTag interface { + // FromProto unmarshals PatternFlowArpProtocolTypeMetricTag from protobuf object *otg.PatternFlowArpProtocolTypeMetricTag + FromProto(msg *otg.PatternFlowArpProtocolTypeMetricTag) (PatternFlowArpProtocolTypeMetricTag, error) + // FromPbText unmarshals PatternFlowArpProtocolTypeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpProtocolTypeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpProtocolTypeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpProtocolTypeMetricTag) Marshal() marshalPatternFlowArpProtocolTypeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpProtocolTypeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpProtocolTypeMetricTag) Unmarshal() unMarshalPatternFlowArpProtocolTypeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpProtocolTypeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpProtocolTypeMetricTag) ToProto() (*otg.PatternFlowArpProtocolTypeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpProtocolTypeMetricTag) FromProto(msg *otg.PatternFlowArpProtocolTypeMetricTag) (PatternFlowArpProtocolTypeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpProtocolTypeMetricTag) 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 *unMarshalpatternFlowArpProtocolTypeMetricTag) 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 *marshalpatternFlowArpProtocolTypeMetricTag) 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 *unMarshalpatternFlowArpProtocolTypeMetricTag) 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 *marshalpatternFlowArpProtocolTypeMetricTag) 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 *unMarshalpatternFlowArpProtocolTypeMetricTag) 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 *patternFlowArpProtocolTypeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpProtocolTypeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpProtocolTypeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpProtocolTypeMetricTag) Clone() (PatternFlowArpProtocolTypeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpProtocolTypeMetricTag() + 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 +} + +// PatternFlowArpProtocolTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowArpProtocolTypeMetricTag interface { + Validation + // msg marshals PatternFlowArpProtocolTypeMetricTag to protobuf object *otg.PatternFlowArpProtocolTypeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowArpProtocolTypeMetricTag + // setMsg unmarshals PatternFlowArpProtocolTypeMetricTag from protobuf object *otg.PatternFlowArpProtocolTypeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowArpProtocolTypeMetricTag) PatternFlowArpProtocolTypeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowArpProtocolTypeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpProtocolTypeMetricTag + // validate validates PatternFlowArpProtocolTypeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpProtocolTypeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowArpProtocolTypeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowArpProtocolTypeMetricTag + SetName(value string) PatternFlowArpProtocolTypeMetricTag + // Offset returns uint32, set in PatternFlowArpProtocolTypeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowArpProtocolTypeMetricTag + SetOffset(value uint32) PatternFlowArpProtocolTypeMetricTag + // HasOffset checks if Offset has been set in PatternFlowArpProtocolTypeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowArpProtocolTypeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowArpProtocolTypeMetricTag + SetLength(value uint32) PatternFlowArpProtocolTypeMetricTag + // HasLength checks if Length has been set in PatternFlowArpProtocolTypeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowArpProtocolTypeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowArpProtocolTypeMetricTag object +func (obj *patternFlowArpProtocolTypeMetricTag) SetName(value string) PatternFlowArpProtocolTypeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpProtocolTypeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpProtocolTypeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowArpProtocolTypeMetricTag object +func (obj *patternFlowArpProtocolTypeMetricTag) SetOffset(value uint32) PatternFlowArpProtocolTypeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpProtocolTypeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpProtocolTypeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowArpProtocolTypeMetricTag object +func (obj *patternFlowArpProtocolTypeMetricTag) SetLength(value uint32) PatternFlowArpProtocolTypeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowArpProtocolTypeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpProtocolTypeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpProtocolTypeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowArpProtocolTypeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowArpProtocolTypeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_arp_sender_hardware_addr.go b/gosnappi/pattern_flow_arp_sender_hardware_addr.go new file mode 100644 index 00000000..c9cbb05a --- /dev/null +++ b/gosnappi/pattern_flow_arp_sender_hardware_addr.go @@ -0,0 +1,658 @@ +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" +) + +// ***** PatternFlowArpSenderHardwareAddr ***** +type patternFlowArpSenderHardwareAddr struct { + validation + obj *otg.PatternFlowArpSenderHardwareAddr + marshaller marshalPatternFlowArpSenderHardwareAddr + unMarshaller unMarshalPatternFlowArpSenderHardwareAddr + incrementHolder PatternFlowArpSenderHardwareAddrCounter + decrementHolder PatternFlowArpSenderHardwareAddrCounter + metricTagsHolder PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter +} + +func NewPatternFlowArpSenderHardwareAddr() PatternFlowArpSenderHardwareAddr { + obj := patternFlowArpSenderHardwareAddr{obj: &otg.PatternFlowArpSenderHardwareAddr{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpSenderHardwareAddr) msg() *otg.PatternFlowArpSenderHardwareAddr { + return obj.obj +} + +func (obj *patternFlowArpSenderHardwareAddr) setMsg(msg *otg.PatternFlowArpSenderHardwareAddr) PatternFlowArpSenderHardwareAddr { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpSenderHardwareAddr struct { + obj *patternFlowArpSenderHardwareAddr +} + +type marshalPatternFlowArpSenderHardwareAddr interface { + // ToProto marshals PatternFlowArpSenderHardwareAddr to protobuf object *otg.PatternFlowArpSenderHardwareAddr + ToProto() (*otg.PatternFlowArpSenderHardwareAddr, error) + // ToPbText marshals PatternFlowArpSenderHardwareAddr to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpSenderHardwareAddr to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpSenderHardwareAddr to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpSenderHardwareAddr struct { + obj *patternFlowArpSenderHardwareAddr +} + +type unMarshalPatternFlowArpSenderHardwareAddr interface { + // FromProto unmarshals PatternFlowArpSenderHardwareAddr from protobuf object *otg.PatternFlowArpSenderHardwareAddr + FromProto(msg *otg.PatternFlowArpSenderHardwareAddr) (PatternFlowArpSenderHardwareAddr, error) + // FromPbText unmarshals PatternFlowArpSenderHardwareAddr from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpSenderHardwareAddr from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpSenderHardwareAddr from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpSenderHardwareAddr) Marshal() marshalPatternFlowArpSenderHardwareAddr { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpSenderHardwareAddr{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpSenderHardwareAddr) Unmarshal() unMarshalPatternFlowArpSenderHardwareAddr { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpSenderHardwareAddr{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpSenderHardwareAddr) ToProto() (*otg.PatternFlowArpSenderHardwareAddr, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpSenderHardwareAddr) FromProto(msg *otg.PatternFlowArpSenderHardwareAddr) (PatternFlowArpSenderHardwareAddr, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpSenderHardwareAddr) 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 *unMarshalpatternFlowArpSenderHardwareAddr) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowArpSenderHardwareAddr) 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 *unMarshalpatternFlowArpSenderHardwareAddr) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowArpSenderHardwareAddr) 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 *unMarshalpatternFlowArpSenderHardwareAddr) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowArpSenderHardwareAddr) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpSenderHardwareAddr) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpSenderHardwareAddr) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpSenderHardwareAddr) Clone() (PatternFlowArpSenderHardwareAddr, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpSenderHardwareAddr() + 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 +} + +func (obj *patternFlowArpSenderHardwareAddr) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowArpSenderHardwareAddr is media address of the sender +type PatternFlowArpSenderHardwareAddr interface { + Validation + // msg marshals PatternFlowArpSenderHardwareAddr to protobuf object *otg.PatternFlowArpSenderHardwareAddr + // and doesn't set defaults + msg() *otg.PatternFlowArpSenderHardwareAddr + // setMsg unmarshals PatternFlowArpSenderHardwareAddr from protobuf object *otg.PatternFlowArpSenderHardwareAddr + // and doesn't set defaults + setMsg(*otg.PatternFlowArpSenderHardwareAddr) PatternFlowArpSenderHardwareAddr + // provides marshal interface + Marshal() marshalPatternFlowArpSenderHardwareAddr + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpSenderHardwareAddr + // validate validates PatternFlowArpSenderHardwareAddr + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpSenderHardwareAddr, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowArpSenderHardwareAddrChoiceEnum, set in PatternFlowArpSenderHardwareAddr + Choice() PatternFlowArpSenderHardwareAddrChoiceEnum + // setChoice assigns PatternFlowArpSenderHardwareAddrChoiceEnum provided by user to PatternFlowArpSenderHardwareAddr + setChoice(value PatternFlowArpSenderHardwareAddrChoiceEnum) PatternFlowArpSenderHardwareAddr + // HasChoice checks if Choice has been set in PatternFlowArpSenderHardwareAddr + HasChoice() bool + // Value returns string, set in PatternFlowArpSenderHardwareAddr. + Value() string + // SetValue assigns string provided by user to PatternFlowArpSenderHardwareAddr + SetValue(value string) PatternFlowArpSenderHardwareAddr + // HasValue checks if Value has been set in PatternFlowArpSenderHardwareAddr + HasValue() bool + // Values returns []string, set in PatternFlowArpSenderHardwareAddr. + Values() []string + // SetValues assigns []string provided by user to PatternFlowArpSenderHardwareAddr + SetValues(value []string) PatternFlowArpSenderHardwareAddr + // Increment returns PatternFlowArpSenderHardwareAddrCounter, set in PatternFlowArpSenderHardwareAddr. + // PatternFlowArpSenderHardwareAddrCounter is mac counter pattern + Increment() PatternFlowArpSenderHardwareAddrCounter + // SetIncrement assigns PatternFlowArpSenderHardwareAddrCounter provided by user to PatternFlowArpSenderHardwareAddr. + // PatternFlowArpSenderHardwareAddrCounter is mac counter pattern + SetIncrement(value PatternFlowArpSenderHardwareAddrCounter) PatternFlowArpSenderHardwareAddr + // HasIncrement checks if Increment has been set in PatternFlowArpSenderHardwareAddr + HasIncrement() bool + // Decrement returns PatternFlowArpSenderHardwareAddrCounter, set in PatternFlowArpSenderHardwareAddr. + // PatternFlowArpSenderHardwareAddrCounter is mac counter pattern + Decrement() PatternFlowArpSenderHardwareAddrCounter + // SetDecrement assigns PatternFlowArpSenderHardwareAddrCounter provided by user to PatternFlowArpSenderHardwareAddr. + // PatternFlowArpSenderHardwareAddrCounter is mac counter pattern + SetDecrement(value PatternFlowArpSenderHardwareAddrCounter) PatternFlowArpSenderHardwareAddr + // HasDecrement checks if Decrement has been set in PatternFlowArpSenderHardwareAddr + HasDecrement() bool + // MetricTags returns PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIterIter, set in PatternFlowArpSenderHardwareAddr + MetricTags() PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter + setNil() +} + +type PatternFlowArpSenderHardwareAddrChoiceEnum string + +// Enum of Choice on PatternFlowArpSenderHardwareAddr +var PatternFlowArpSenderHardwareAddrChoice = struct { + VALUE PatternFlowArpSenderHardwareAddrChoiceEnum + VALUES PatternFlowArpSenderHardwareAddrChoiceEnum + INCREMENT PatternFlowArpSenderHardwareAddrChoiceEnum + DECREMENT PatternFlowArpSenderHardwareAddrChoiceEnum +}{ + VALUE: PatternFlowArpSenderHardwareAddrChoiceEnum("value"), + VALUES: PatternFlowArpSenderHardwareAddrChoiceEnum("values"), + INCREMENT: PatternFlowArpSenderHardwareAddrChoiceEnum("increment"), + DECREMENT: PatternFlowArpSenderHardwareAddrChoiceEnum("decrement"), +} + +func (obj *patternFlowArpSenderHardwareAddr) Choice() PatternFlowArpSenderHardwareAddrChoiceEnum { + return PatternFlowArpSenderHardwareAddrChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowArpSenderHardwareAddr) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowArpSenderHardwareAddr) setChoice(value PatternFlowArpSenderHardwareAddrChoiceEnum) PatternFlowArpSenderHardwareAddr { + intValue, ok := otg.PatternFlowArpSenderHardwareAddr_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowArpSenderHardwareAddrChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowArpSenderHardwareAddr_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowArpSenderHardwareAddrChoice.VALUE { + defaultValue := "00:00:00:00:00:00" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowArpSenderHardwareAddrChoice.VALUES { + defaultValue := []string{"00:00:00:00:00:00"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowArpSenderHardwareAddrChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowArpSenderHardwareAddrCounter().msg() + } + + if value == PatternFlowArpSenderHardwareAddrChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowArpSenderHardwareAddrCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowArpSenderHardwareAddr) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowArpSenderHardwareAddr) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowArpSenderHardwareAddr object +func (obj *patternFlowArpSenderHardwareAddr) SetValue(value string) PatternFlowArpSenderHardwareAddr { + obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowArpSenderHardwareAddr) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"00:00:00:00:00:00"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowArpSenderHardwareAddr object +func (obj *patternFlowArpSenderHardwareAddr) SetValues(value []string) PatternFlowArpSenderHardwareAddr { + obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowArpSenderHardwareAddrCounter +func (obj *patternFlowArpSenderHardwareAddr) Increment() PatternFlowArpSenderHardwareAddrCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowArpSenderHardwareAddrCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowArpSenderHardwareAddrCounter +func (obj *patternFlowArpSenderHardwareAddr) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowArpSenderHardwareAddrCounter value in the PatternFlowArpSenderHardwareAddr object +func (obj *patternFlowArpSenderHardwareAddr) SetIncrement(value PatternFlowArpSenderHardwareAddrCounter) PatternFlowArpSenderHardwareAddr { + obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowArpSenderHardwareAddrCounter +func (obj *patternFlowArpSenderHardwareAddr) Decrement() PatternFlowArpSenderHardwareAddrCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowArpSenderHardwareAddrCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowArpSenderHardwareAddrCounter +func (obj *patternFlowArpSenderHardwareAddr) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowArpSenderHardwareAddrCounter value in the PatternFlowArpSenderHardwareAddr object +func (obj *patternFlowArpSenderHardwareAddr) SetDecrement(value PatternFlowArpSenderHardwareAddrCounter) PatternFlowArpSenderHardwareAddr { + obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowArpSenderHardwareAddrMetricTag +func (obj *patternFlowArpSenderHardwareAddr) MetricTags() PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowArpSenderHardwareAddrMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter struct { + obj *patternFlowArpSenderHardwareAddr + patternFlowArpSenderHardwareAddrMetricTagSlice []PatternFlowArpSenderHardwareAddrMetricTag + fieldPtr *[]*otg.PatternFlowArpSenderHardwareAddrMetricTag +} + +func newPatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter(ptr *[]*otg.PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { + return &patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter interface { + setMsg(*patternFlowArpSenderHardwareAddr) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter + Items() []PatternFlowArpSenderHardwareAddrMetricTag + Add() PatternFlowArpSenderHardwareAddrMetricTag + Append(items ...PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter + Set(index int, newObj PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter + Clear() PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter + clearHolderSlice() PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter + appendHolderSlice(item PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter +} + +func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) setMsg(msg *patternFlowArpSenderHardwareAddr) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowArpSenderHardwareAddrMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) Items() []PatternFlowArpSenderHardwareAddrMetricTag { + return obj.patternFlowArpSenderHardwareAddrMetricTagSlice +} + +func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) Add() PatternFlowArpSenderHardwareAddrMetricTag { + newObj := &otg.PatternFlowArpSenderHardwareAddrMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowArpSenderHardwareAddrMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowArpSenderHardwareAddrMetricTagSlice = append(obj.patternFlowArpSenderHardwareAddrMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) Append(items ...PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowArpSenderHardwareAddrMetricTagSlice = append(obj.patternFlowArpSenderHardwareAddrMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) Set(index int, newObj PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowArpSenderHardwareAddrMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) Clear() PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowArpSenderHardwareAddrMetricTag{} + obj.patternFlowArpSenderHardwareAddrMetricTagSlice = []PatternFlowArpSenderHardwareAddrMetricTag{} + } + return obj +} +func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) clearHolderSlice() PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { + if len(obj.patternFlowArpSenderHardwareAddrMetricTagSlice) > 0 { + obj.patternFlowArpSenderHardwareAddrMetricTagSlice = []PatternFlowArpSenderHardwareAddrMetricTag{} + } + return obj +} +func (obj *patternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter) appendHolderSlice(item PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrPatternFlowArpSenderHardwareAddrMetricTagIter { + obj.patternFlowArpSenderHardwareAddrMetricTagSlice = append(obj.patternFlowArpSenderHardwareAddrMetricTagSlice, item) + return obj +} + +func (obj *patternFlowArpSenderHardwareAddr) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateMac(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderHardwareAddr.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateMacSlice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderHardwareAddr.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowArpSenderHardwareAddrMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowArpSenderHardwareAddr) setDefault() { + var choices_set int = 0 + var choice PatternFlowArpSenderHardwareAddrChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowArpSenderHardwareAddrChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowArpSenderHardwareAddrChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowArpSenderHardwareAddrChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowArpSenderHardwareAddrChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowArpSenderHardwareAddrChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpSenderHardwareAddr") + } + } else { + intVal := otg.PatternFlowArpSenderHardwareAddr_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowArpSenderHardwareAddr_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_arp_sender_hardware_addr_counter.go b/gosnappi/pattern_flow_arp_sender_hardware_addr_counter.go new file mode 100644 index 00000000..2ab461a1 --- /dev/null +++ b/gosnappi/pattern_flow_arp_sender_hardware_addr_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowArpSenderHardwareAddrCounter ***** +type patternFlowArpSenderHardwareAddrCounter struct { + validation + obj *otg.PatternFlowArpSenderHardwareAddrCounter + marshaller marshalPatternFlowArpSenderHardwareAddrCounter + unMarshaller unMarshalPatternFlowArpSenderHardwareAddrCounter +} + +func NewPatternFlowArpSenderHardwareAddrCounter() PatternFlowArpSenderHardwareAddrCounter { + obj := patternFlowArpSenderHardwareAddrCounter{obj: &otg.PatternFlowArpSenderHardwareAddrCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpSenderHardwareAddrCounter) msg() *otg.PatternFlowArpSenderHardwareAddrCounter { + return obj.obj +} + +func (obj *patternFlowArpSenderHardwareAddrCounter) setMsg(msg *otg.PatternFlowArpSenderHardwareAddrCounter) PatternFlowArpSenderHardwareAddrCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpSenderHardwareAddrCounter struct { + obj *patternFlowArpSenderHardwareAddrCounter +} + +type marshalPatternFlowArpSenderHardwareAddrCounter interface { + // ToProto marshals PatternFlowArpSenderHardwareAddrCounter to protobuf object *otg.PatternFlowArpSenderHardwareAddrCounter + ToProto() (*otg.PatternFlowArpSenderHardwareAddrCounter, error) + // ToPbText marshals PatternFlowArpSenderHardwareAddrCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpSenderHardwareAddrCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpSenderHardwareAddrCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpSenderHardwareAddrCounter struct { + obj *patternFlowArpSenderHardwareAddrCounter +} + +type unMarshalPatternFlowArpSenderHardwareAddrCounter interface { + // FromProto unmarshals PatternFlowArpSenderHardwareAddrCounter from protobuf object *otg.PatternFlowArpSenderHardwareAddrCounter + FromProto(msg *otg.PatternFlowArpSenderHardwareAddrCounter) (PatternFlowArpSenderHardwareAddrCounter, error) + // FromPbText unmarshals PatternFlowArpSenderHardwareAddrCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpSenderHardwareAddrCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpSenderHardwareAddrCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpSenderHardwareAddrCounter) Marshal() marshalPatternFlowArpSenderHardwareAddrCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpSenderHardwareAddrCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpSenderHardwareAddrCounter) Unmarshal() unMarshalPatternFlowArpSenderHardwareAddrCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpSenderHardwareAddrCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpSenderHardwareAddrCounter) ToProto() (*otg.PatternFlowArpSenderHardwareAddrCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpSenderHardwareAddrCounter) FromProto(msg *otg.PatternFlowArpSenderHardwareAddrCounter) (PatternFlowArpSenderHardwareAddrCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpSenderHardwareAddrCounter) 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 *unMarshalpatternFlowArpSenderHardwareAddrCounter) 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 *marshalpatternFlowArpSenderHardwareAddrCounter) 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 *unMarshalpatternFlowArpSenderHardwareAddrCounter) 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 *marshalpatternFlowArpSenderHardwareAddrCounter) 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 *unMarshalpatternFlowArpSenderHardwareAddrCounter) 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 *patternFlowArpSenderHardwareAddrCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpSenderHardwareAddrCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpSenderHardwareAddrCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpSenderHardwareAddrCounter) Clone() (PatternFlowArpSenderHardwareAddrCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpSenderHardwareAddrCounter() + 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 +} + +// PatternFlowArpSenderHardwareAddrCounter is mac counter pattern +type PatternFlowArpSenderHardwareAddrCounter interface { + Validation + // msg marshals PatternFlowArpSenderHardwareAddrCounter to protobuf object *otg.PatternFlowArpSenderHardwareAddrCounter + // and doesn't set defaults + msg() *otg.PatternFlowArpSenderHardwareAddrCounter + // setMsg unmarshals PatternFlowArpSenderHardwareAddrCounter from protobuf object *otg.PatternFlowArpSenderHardwareAddrCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowArpSenderHardwareAddrCounter) PatternFlowArpSenderHardwareAddrCounter + // provides marshal interface + Marshal() marshalPatternFlowArpSenderHardwareAddrCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpSenderHardwareAddrCounter + // validate validates PatternFlowArpSenderHardwareAddrCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpSenderHardwareAddrCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowArpSenderHardwareAddrCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowArpSenderHardwareAddrCounter + SetStart(value string) PatternFlowArpSenderHardwareAddrCounter + // HasStart checks if Start has been set in PatternFlowArpSenderHardwareAddrCounter + HasStart() bool + // Step returns string, set in PatternFlowArpSenderHardwareAddrCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowArpSenderHardwareAddrCounter + SetStep(value string) PatternFlowArpSenderHardwareAddrCounter + // HasStep checks if Step has been set in PatternFlowArpSenderHardwareAddrCounter + HasStep() bool + // Count returns uint32, set in PatternFlowArpSenderHardwareAddrCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowArpSenderHardwareAddrCounter + SetCount(value uint32) PatternFlowArpSenderHardwareAddrCounter + // HasCount checks if Count has been set in PatternFlowArpSenderHardwareAddrCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowArpSenderHardwareAddrCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowArpSenderHardwareAddrCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowArpSenderHardwareAddrCounter object +func (obj *patternFlowArpSenderHardwareAddrCounter) SetStart(value string) PatternFlowArpSenderHardwareAddrCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowArpSenderHardwareAddrCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowArpSenderHardwareAddrCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowArpSenderHardwareAddrCounter object +func (obj *patternFlowArpSenderHardwareAddrCounter) SetStep(value string) PatternFlowArpSenderHardwareAddrCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpSenderHardwareAddrCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpSenderHardwareAddrCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowArpSenderHardwareAddrCounter object +func (obj *patternFlowArpSenderHardwareAddrCounter) SetCount(value uint32) PatternFlowArpSenderHardwareAddrCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowArpSenderHardwareAddrCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateMac(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderHardwareAddrCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateMac(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderHardwareAddrCounter.Step")) + } + + } + +} + +func (obj *patternFlowArpSenderHardwareAddrCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("00:00:00:00:00:00") + } + if obj.obj.Step == nil { + obj.SetStep("00:00:00:00:00:01") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_arp_sender_hardware_addr_metric_tag.go b/gosnappi/pattern_flow_arp_sender_hardware_addr_metric_tag.go new file mode 100644 index 00000000..d1d07531 --- /dev/null +++ b/gosnappi/pattern_flow_arp_sender_hardware_addr_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowArpSenderHardwareAddrMetricTag ***** +type patternFlowArpSenderHardwareAddrMetricTag struct { + validation + obj *otg.PatternFlowArpSenderHardwareAddrMetricTag + marshaller marshalPatternFlowArpSenderHardwareAddrMetricTag + unMarshaller unMarshalPatternFlowArpSenderHardwareAddrMetricTag +} + +func NewPatternFlowArpSenderHardwareAddrMetricTag() PatternFlowArpSenderHardwareAddrMetricTag { + obj := patternFlowArpSenderHardwareAddrMetricTag{obj: &otg.PatternFlowArpSenderHardwareAddrMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpSenderHardwareAddrMetricTag) msg() *otg.PatternFlowArpSenderHardwareAddrMetricTag { + return obj.obj +} + +func (obj *patternFlowArpSenderHardwareAddrMetricTag) setMsg(msg *otg.PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpSenderHardwareAddrMetricTag struct { + obj *patternFlowArpSenderHardwareAddrMetricTag +} + +type marshalPatternFlowArpSenderHardwareAddrMetricTag interface { + // ToProto marshals PatternFlowArpSenderHardwareAddrMetricTag to protobuf object *otg.PatternFlowArpSenderHardwareAddrMetricTag + ToProto() (*otg.PatternFlowArpSenderHardwareAddrMetricTag, error) + // ToPbText marshals PatternFlowArpSenderHardwareAddrMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpSenderHardwareAddrMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpSenderHardwareAddrMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpSenderHardwareAddrMetricTag struct { + obj *patternFlowArpSenderHardwareAddrMetricTag +} + +type unMarshalPatternFlowArpSenderHardwareAddrMetricTag interface { + // FromProto unmarshals PatternFlowArpSenderHardwareAddrMetricTag from protobuf object *otg.PatternFlowArpSenderHardwareAddrMetricTag + FromProto(msg *otg.PatternFlowArpSenderHardwareAddrMetricTag) (PatternFlowArpSenderHardwareAddrMetricTag, error) + // FromPbText unmarshals PatternFlowArpSenderHardwareAddrMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpSenderHardwareAddrMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpSenderHardwareAddrMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpSenderHardwareAddrMetricTag) Marshal() marshalPatternFlowArpSenderHardwareAddrMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpSenderHardwareAddrMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpSenderHardwareAddrMetricTag) Unmarshal() unMarshalPatternFlowArpSenderHardwareAddrMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpSenderHardwareAddrMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpSenderHardwareAddrMetricTag) ToProto() (*otg.PatternFlowArpSenderHardwareAddrMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpSenderHardwareAddrMetricTag) FromProto(msg *otg.PatternFlowArpSenderHardwareAddrMetricTag) (PatternFlowArpSenderHardwareAddrMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpSenderHardwareAddrMetricTag) 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 *unMarshalpatternFlowArpSenderHardwareAddrMetricTag) 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 *marshalpatternFlowArpSenderHardwareAddrMetricTag) 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 *unMarshalpatternFlowArpSenderHardwareAddrMetricTag) 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 *marshalpatternFlowArpSenderHardwareAddrMetricTag) 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 *unMarshalpatternFlowArpSenderHardwareAddrMetricTag) 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 *patternFlowArpSenderHardwareAddrMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpSenderHardwareAddrMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpSenderHardwareAddrMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpSenderHardwareAddrMetricTag) Clone() (PatternFlowArpSenderHardwareAddrMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpSenderHardwareAddrMetricTag() + 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 +} + +// PatternFlowArpSenderHardwareAddrMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowArpSenderHardwareAddrMetricTag interface { + Validation + // msg marshals PatternFlowArpSenderHardwareAddrMetricTag to protobuf object *otg.PatternFlowArpSenderHardwareAddrMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowArpSenderHardwareAddrMetricTag + // setMsg unmarshals PatternFlowArpSenderHardwareAddrMetricTag from protobuf object *otg.PatternFlowArpSenderHardwareAddrMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowArpSenderHardwareAddrMetricTag) PatternFlowArpSenderHardwareAddrMetricTag + // provides marshal interface + Marshal() marshalPatternFlowArpSenderHardwareAddrMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpSenderHardwareAddrMetricTag + // validate validates PatternFlowArpSenderHardwareAddrMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpSenderHardwareAddrMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowArpSenderHardwareAddrMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowArpSenderHardwareAddrMetricTag + SetName(value string) PatternFlowArpSenderHardwareAddrMetricTag + // Offset returns uint32, set in PatternFlowArpSenderHardwareAddrMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowArpSenderHardwareAddrMetricTag + SetOffset(value uint32) PatternFlowArpSenderHardwareAddrMetricTag + // HasOffset checks if Offset has been set in PatternFlowArpSenderHardwareAddrMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowArpSenderHardwareAddrMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowArpSenderHardwareAddrMetricTag + SetLength(value uint32) PatternFlowArpSenderHardwareAddrMetricTag + // HasLength checks if Length has been set in PatternFlowArpSenderHardwareAddrMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowArpSenderHardwareAddrMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowArpSenderHardwareAddrMetricTag object +func (obj *patternFlowArpSenderHardwareAddrMetricTag) SetName(value string) PatternFlowArpSenderHardwareAddrMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpSenderHardwareAddrMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpSenderHardwareAddrMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowArpSenderHardwareAddrMetricTag object +func (obj *patternFlowArpSenderHardwareAddrMetricTag) SetOffset(value uint32) PatternFlowArpSenderHardwareAddrMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpSenderHardwareAddrMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpSenderHardwareAddrMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowArpSenderHardwareAddrMetricTag object +func (obj *patternFlowArpSenderHardwareAddrMetricTag) SetLength(value uint32) PatternFlowArpSenderHardwareAddrMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowArpSenderHardwareAddrMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpSenderHardwareAddrMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 47 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpSenderHardwareAddrMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 48 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowArpSenderHardwareAddrMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowArpSenderHardwareAddrMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(48) + } + +} diff --git a/gosnappi/pattern_flow_arp_sender_protocol_addr.go b/gosnappi/pattern_flow_arp_sender_protocol_addr.go new file mode 100644 index 00000000..45824f52 --- /dev/null +++ b/gosnappi/pattern_flow_arp_sender_protocol_addr.go @@ -0,0 +1,658 @@ +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" +) + +// ***** PatternFlowArpSenderProtocolAddr ***** +type patternFlowArpSenderProtocolAddr struct { + validation + obj *otg.PatternFlowArpSenderProtocolAddr + marshaller marshalPatternFlowArpSenderProtocolAddr + unMarshaller unMarshalPatternFlowArpSenderProtocolAddr + incrementHolder PatternFlowArpSenderProtocolAddrCounter + decrementHolder PatternFlowArpSenderProtocolAddrCounter + metricTagsHolder PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter +} + +func NewPatternFlowArpSenderProtocolAddr() PatternFlowArpSenderProtocolAddr { + obj := patternFlowArpSenderProtocolAddr{obj: &otg.PatternFlowArpSenderProtocolAddr{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpSenderProtocolAddr) msg() *otg.PatternFlowArpSenderProtocolAddr { + return obj.obj +} + +func (obj *patternFlowArpSenderProtocolAddr) setMsg(msg *otg.PatternFlowArpSenderProtocolAddr) PatternFlowArpSenderProtocolAddr { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpSenderProtocolAddr struct { + obj *patternFlowArpSenderProtocolAddr +} + +type marshalPatternFlowArpSenderProtocolAddr interface { + // ToProto marshals PatternFlowArpSenderProtocolAddr to protobuf object *otg.PatternFlowArpSenderProtocolAddr + ToProto() (*otg.PatternFlowArpSenderProtocolAddr, error) + // ToPbText marshals PatternFlowArpSenderProtocolAddr to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpSenderProtocolAddr to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpSenderProtocolAddr to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpSenderProtocolAddr struct { + obj *patternFlowArpSenderProtocolAddr +} + +type unMarshalPatternFlowArpSenderProtocolAddr interface { + // FromProto unmarshals PatternFlowArpSenderProtocolAddr from protobuf object *otg.PatternFlowArpSenderProtocolAddr + FromProto(msg *otg.PatternFlowArpSenderProtocolAddr) (PatternFlowArpSenderProtocolAddr, error) + // FromPbText unmarshals PatternFlowArpSenderProtocolAddr from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpSenderProtocolAddr from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpSenderProtocolAddr from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpSenderProtocolAddr) Marshal() marshalPatternFlowArpSenderProtocolAddr { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpSenderProtocolAddr{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpSenderProtocolAddr) Unmarshal() unMarshalPatternFlowArpSenderProtocolAddr { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpSenderProtocolAddr{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpSenderProtocolAddr) ToProto() (*otg.PatternFlowArpSenderProtocolAddr, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpSenderProtocolAddr) FromProto(msg *otg.PatternFlowArpSenderProtocolAddr) (PatternFlowArpSenderProtocolAddr, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpSenderProtocolAddr) 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 *unMarshalpatternFlowArpSenderProtocolAddr) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowArpSenderProtocolAddr) 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 *unMarshalpatternFlowArpSenderProtocolAddr) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowArpSenderProtocolAddr) 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 *unMarshalpatternFlowArpSenderProtocolAddr) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowArpSenderProtocolAddr) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpSenderProtocolAddr) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpSenderProtocolAddr) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpSenderProtocolAddr) Clone() (PatternFlowArpSenderProtocolAddr, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpSenderProtocolAddr() + 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 +} + +func (obj *patternFlowArpSenderProtocolAddr) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowArpSenderProtocolAddr is internetwork address of the sender +type PatternFlowArpSenderProtocolAddr interface { + Validation + // msg marshals PatternFlowArpSenderProtocolAddr to protobuf object *otg.PatternFlowArpSenderProtocolAddr + // and doesn't set defaults + msg() *otg.PatternFlowArpSenderProtocolAddr + // setMsg unmarshals PatternFlowArpSenderProtocolAddr from protobuf object *otg.PatternFlowArpSenderProtocolAddr + // and doesn't set defaults + setMsg(*otg.PatternFlowArpSenderProtocolAddr) PatternFlowArpSenderProtocolAddr + // provides marshal interface + Marshal() marshalPatternFlowArpSenderProtocolAddr + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpSenderProtocolAddr + // validate validates PatternFlowArpSenderProtocolAddr + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpSenderProtocolAddr, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowArpSenderProtocolAddrChoiceEnum, set in PatternFlowArpSenderProtocolAddr + Choice() PatternFlowArpSenderProtocolAddrChoiceEnum + // setChoice assigns PatternFlowArpSenderProtocolAddrChoiceEnum provided by user to PatternFlowArpSenderProtocolAddr + setChoice(value PatternFlowArpSenderProtocolAddrChoiceEnum) PatternFlowArpSenderProtocolAddr + // HasChoice checks if Choice has been set in PatternFlowArpSenderProtocolAddr + HasChoice() bool + // Value returns string, set in PatternFlowArpSenderProtocolAddr. + Value() string + // SetValue assigns string provided by user to PatternFlowArpSenderProtocolAddr + SetValue(value string) PatternFlowArpSenderProtocolAddr + // HasValue checks if Value has been set in PatternFlowArpSenderProtocolAddr + HasValue() bool + // Values returns []string, set in PatternFlowArpSenderProtocolAddr. + Values() []string + // SetValues assigns []string provided by user to PatternFlowArpSenderProtocolAddr + SetValues(value []string) PatternFlowArpSenderProtocolAddr + // Increment returns PatternFlowArpSenderProtocolAddrCounter, set in PatternFlowArpSenderProtocolAddr. + // PatternFlowArpSenderProtocolAddrCounter is ipv4 counter pattern + Increment() PatternFlowArpSenderProtocolAddrCounter + // SetIncrement assigns PatternFlowArpSenderProtocolAddrCounter provided by user to PatternFlowArpSenderProtocolAddr. + // PatternFlowArpSenderProtocolAddrCounter is ipv4 counter pattern + SetIncrement(value PatternFlowArpSenderProtocolAddrCounter) PatternFlowArpSenderProtocolAddr + // HasIncrement checks if Increment has been set in PatternFlowArpSenderProtocolAddr + HasIncrement() bool + // Decrement returns PatternFlowArpSenderProtocolAddrCounter, set in PatternFlowArpSenderProtocolAddr. + // PatternFlowArpSenderProtocolAddrCounter is ipv4 counter pattern + Decrement() PatternFlowArpSenderProtocolAddrCounter + // SetDecrement assigns PatternFlowArpSenderProtocolAddrCounter provided by user to PatternFlowArpSenderProtocolAddr. + // PatternFlowArpSenderProtocolAddrCounter is ipv4 counter pattern + SetDecrement(value PatternFlowArpSenderProtocolAddrCounter) PatternFlowArpSenderProtocolAddr + // HasDecrement checks if Decrement has been set in PatternFlowArpSenderProtocolAddr + HasDecrement() bool + // MetricTags returns PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIterIter, set in PatternFlowArpSenderProtocolAddr + MetricTags() PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter + setNil() +} + +type PatternFlowArpSenderProtocolAddrChoiceEnum string + +// Enum of Choice on PatternFlowArpSenderProtocolAddr +var PatternFlowArpSenderProtocolAddrChoice = struct { + VALUE PatternFlowArpSenderProtocolAddrChoiceEnum + VALUES PatternFlowArpSenderProtocolAddrChoiceEnum + INCREMENT PatternFlowArpSenderProtocolAddrChoiceEnum + DECREMENT PatternFlowArpSenderProtocolAddrChoiceEnum +}{ + VALUE: PatternFlowArpSenderProtocolAddrChoiceEnum("value"), + VALUES: PatternFlowArpSenderProtocolAddrChoiceEnum("values"), + INCREMENT: PatternFlowArpSenderProtocolAddrChoiceEnum("increment"), + DECREMENT: PatternFlowArpSenderProtocolAddrChoiceEnum("decrement"), +} + +func (obj *patternFlowArpSenderProtocolAddr) Choice() PatternFlowArpSenderProtocolAddrChoiceEnum { + return PatternFlowArpSenderProtocolAddrChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowArpSenderProtocolAddr) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowArpSenderProtocolAddr) setChoice(value PatternFlowArpSenderProtocolAddrChoiceEnum) PatternFlowArpSenderProtocolAddr { + intValue, ok := otg.PatternFlowArpSenderProtocolAddr_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowArpSenderProtocolAddrChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowArpSenderProtocolAddr_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowArpSenderProtocolAddrChoice.VALUE { + defaultValue := "0.0.0.0" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowArpSenderProtocolAddrChoice.VALUES { + defaultValue := []string{"0.0.0.0"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowArpSenderProtocolAddrChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowArpSenderProtocolAddrCounter().msg() + } + + if value == PatternFlowArpSenderProtocolAddrChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowArpSenderProtocolAddrCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowArpSenderProtocolAddr) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowArpSenderProtocolAddr) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowArpSenderProtocolAddr object +func (obj *patternFlowArpSenderProtocolAddr) SetValue(value string) PatternFlowArpSenderProtocolAddr { + obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowArpSenderProtocolAddr) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"0.0.0.0"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowArpSenderProtocolAddr object +func (obj *patternFlowArpSenderProtocolAddr) SetValues(value []string) PatternFlowArpSenderProtocolAddr { + obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowArpSenderProtocolAddrCounter +func (obj *patternFlowArpSenderProtocolAddr) Increment() PatternFlowArpSenderProtocolAddrCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowArpSenderProtocolAddrCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowArpSenderProtocolAddrCounter +func (obj *patternFlowArpSenderProtocolAddr) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowArpSenderProtocolAddrCounter value in the PatternFlowArpSenderProtocolAddr object +func (obj *patternFlowArpSenderProtocolAddr) SetIncrement(value PatternFlowArpSenderProtocolAddrCounter) PatternFlowArpSenderProtocolAddr { + obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowArpSenderProtocolAddrCounter +func (obj *patternFlowArpSenderProtocolAddr) Decrement() PatternFlowArpSenderProtocolAddrCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowArpSenderProtocolAddrCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowArpSenderProtocolAddrCounter +func (obj *patternFlowArpSenderProtocolAddr) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowArpSenderProtocolAddrCounter value in the PatternFlowArpSenderProtocolAddr object +func (obj *patternFlowArpSenderProtocolAddr) SetDecrement(value PatternFlowArpSenderProtocolAddrCounter) PatternFlowArpSenderProtocolAddr { + obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowArpSenderProtocolAddrMetricTag +func (obj *patternFlowArpSenderProtocolAddr) MetricTags() PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowArpSenderProtocolAddrMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter struct { + obj *patternFlowArpSenderProtocolAddr + patternFlowArpSenderProtocolAddrMetricTagSlice []PatternFlowArpSenderProtocolAddrMetricTag + fieldPtr *[]*otg.PatternFlowArpSenderProtocolAddrMetricTag +} + +func newPatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter(ptr *[]*otg.PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { + return &patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter interface { + setMsg(*patternFlowArpSenderProtocolAddr) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter + Items() []PatternFlowArpSenderProtocolAddrMetricTag + Add() PatternFlowArpSenderProtocolAddrMetricTag + Append(items ...PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter + Set(index int, newObj PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter + Clear() PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter + clearHolderSlice() PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter + appendHolderSlice(item PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter +} + +func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) setMsg(msg *patternFlowArpSenderProtocolAddr) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowArpSenderProtocolAddrMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) Items() []PatternFlowArpSenderProtocolAddrMetricTag { + return obj.patternFlowArpSenderProtocolAddrMetricTagSlice +} + +func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) Add() PatternFlowArpSenderProtocolAddrMetricTag { + newObj := &otg.PatternFlowArpSenderProtocolAddrMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowArpSenderProtocolAddrMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowArpSenderProtocolAddrMetricTagSlice = append(obj.patternFlowArpSenderProtocolAddrMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) Append(items ...PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowArpSenderProtocolAddrMetricTagSlice = append(obj.patternFlowArpSenderProtocolAddrMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) Set(index int, newObj PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowArpSenderProtocolAddrMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) Clear() PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowArpSenderProtocolAddrMetricTag{} + obj.patternFlowArpSenderProtocolAddrMetricTagSlice = []PatternFlowArpSenderProtocolAddrMetricTag{} + } + return obj +} +func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) clearHolderSlice() PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { + if len(obj.patternFlowArpSenderProtocolAddrMetricTagSlice) > 0 { + obj.patternFlowArpSenderProtocolAddrMetricTagSlice = []PatternFlowArpSenderProtocolAddrMetricTag{} + } + return obj +} +func (obj *patternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter) appendHolderSlice(item PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrPatternFlowArpSenderProtocolAddrMetricTagIter { + obj.patternFlowArpSenderProtocolAddrMetricTagSlice = append(obj.patternFlowArpSenderProtocolAddrMetricTagSlice, item) + return obj +} + +func (obj *patternFlowArpSenderProtocolAddr) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv4(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderProtocolAddr.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateIpv4Slice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderProtocolAddr.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowArpSenderProtocolAddrMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowArpSenderProtocolAddr) setDefault() { + var choices_set int = 0 + var choice PatternFlowArpSenderProtocolAddrChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowArpSenderProtocolAddrChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowArpSenderProtocolAddrChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowArpSenderProtocolAddrChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowArpSenderProtocolAddrChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowArpSenderProtocolAddrChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpSenderProtocolAddr") + } + } else { + intVal := otg.PatternFlowArpSenderProtocolAddr_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowArpSenderProtocolAddr_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_arp_sender_protocol_addr_counter.go b/gosnappi/pattern_flow_arp_sender_protocol_addr_counter.go new file mode 100644 index 00000000..d4bf738c --- /dev/null +++ b/gosnappi/pattern_flow_arp_sender_protocol_addr_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowArpSenderProtocolAddrCounter ***** +type patternFlowArpSenderProtocolAddrCounter struct { + validation + obj *otg.PatternFlowArpSenderProtocolAddrCounter + marshaller marshalPatternFlowArpSenderProtocolAddrCounter + unMarshaller unMarshalPatternFlowArpSenderProtocolAddrCounter +} + +func NewPatternFlowArpSenderProtocolAddrCounter() PatternFlowArpSenderProtocolAddrCounter { + obj := patternFlowArpSenderProtocolAddrCounter{obj: &otg.PatternFlowArpSenderProtocolAddrCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpSenderProtocolAddrCounter) msg() *otg.PatternFlowArpSenderProtocolAddrCounter { + return obj.obj +} + +func (obj *patternFlowArpSenderProtocolAddrCounter) setMsg(msg *otg.PatternFlowArpSenderProtocolAddrCounter) PatternFlowArpSenderProtocolAddrCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpSenderProtocolAddrCounter struct { + obj *patternFlowArpSenderProtocolAddrCounter +} + +type marshalPatternFlowArpSenderProtocolAddrCounter interface { + // ToProto marshals PatternFlowArpSenderProtocolAddrCounter to protobuf object *otg.PatternFlowArpSenderProtocolAddrCounter + ToProto() (*otg.PatternFlowArpSenderProtocolAddrCounter, error) + // ToPbText marshals PatternFlowArpSenderProtocolAddrCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpSenderProtocolAddrCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpSenderProtocolAddrCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpSenderProtocolAddrCounter struct { + obj *patternFlowArpSenderProtocolAddrCounter +} + +type unMarshalPatternFlowArpSenderProtocolAddrCounter interface { + // FromProto unmarshals PatternFlowArpSenderProtocolAddrCounter from protobuf object *otg.PatternFlowArpSenderProtocolAddrCounter + FromProto(msg *otg.PatternFlowArpSenderProtocolAddrCounter) (PatternFlowArpSenderProtocolAddrCounter, error) + // FromPbText unmarshals PatternFlowArpSenderProtocolAddrCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpSenderProtocolAddrCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpSenderProtocolAddrCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpSenderProtocolAddrCounter) Marshal() marshalPatternFlowArpSenderProtocolAddrCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpSenderProtocolAddrCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpSenderProtocolAddrCounter) Unmarshal() unMarshalPatternFlowArpSenderProtocolAddrCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpSenderProtocolAddrCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpSenderProtocolAddrCounter) ToProto() (*otg.PatternFlowArpSenderProtocolAddrCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpSenderProtocolAddrCounter) FromProto(msg *otg.PatternFlowArpSenderProtocolAddrCounter) (PatternFlowArpSenderProtocolAddrCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpSenderProtocolAddrCounter) 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 *unMarshalpatternFlowArpSenderProtocolAddrCounter) 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 *marshalpatternFlowArpSenderProtocolAddrCounter) 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 *unMarshalpatternFlowArpSenderProtocolAddrCounter) 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 *marshalpatternFlowArpSenderProtocolAddrCounter) 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 *unMarshalpatternFlowArpSenderProtocolAddrCounter) 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 *patternFlowArpSenderProtocolAddrCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpSenderProtocolAddrCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpSenderProtocolAddrCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpSenderProtocolAddrCounter) Clone() (PatternFlowArpSenderProtocolAddrCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpSenderProtocolAddrCounter() + 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 +} + +// PatternFlowArpSenderProtocolAddrCounter is ipv4 counter pattern +type PatternFlowArpSenderProtocolAddrCounter interface { + Validation + // msg marshals PatternFlowArpSenderProtocolAddrCounter to protobuf object *otg.PatternFlowArpSenderProtocolAddrCounter + // and doesn't set defaults + msg() *otg.PatternFlowArpSenderProtocolAddrCounter + // setMsg unmarshals PatternFlowArpSenderProtocolAddrCounter from protobuf object *otg.PatternFlowArpSenderProtocolAddrCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowArpSenderProtocolAddrCounter) PatternFlowArpSenderProtocolAddrCounter + // provides marshal interface + Marshal() marshalPatternFlowArpSenderProtocolAddrCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpSenderProtocolAddrCounter + // validate validates PatternFlowArpSenderProtocolAddrCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpSenderProtocolAddrCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowArpSenderProtocolAddrCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowArpSenderProtocolAddrCounter + SetStart(value string) PatternFlowArpSenderProtocolAddrCounter + // HasStart checks if Start has been set in PatternFlowArpSenderProtocolAddrCounter + HasStart() bool + // Step returns string, set in PatternFlowArpSenderProtocolAddrCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowArpSenderProtocolAddrCounter + SetStep(value string) PatternFlowArpSenderProtocolAddrCounter + // HasStep checks if Step has been set in PatternFlowArpSenderProtocolAddrCounter + HasStep() bool + // Count returns uint32, set in PatternFlowArpSenderProtocolAddrCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowArpSenderProtocolAddrCounter + SetCount(value uint32) PatternFlowArpSenderProtocolAddrCounter + // HasCount checks if Count has been set in PatternFlowArpSenderProtocolAddrCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowArpSenderProtocolAddrCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowArpSenderProtocolAddrCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowArpSenderProtocolAddrCounter object +func (obj *patternFlowArpSenderProtocolAddrCounter) SetStart(value string) PatternFlowArpSenderProtocolAddrCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowArpSenderProtocolAddrCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowArpSenderProtocolAddrCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowArpSenderProtocolAddrCounter object +func (obj *patternFlowArpSenderProtocolAddrCounter) SetStep(value string) PatternFlowArpSenderProtocolAddrCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpSenderProtocolAddrCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpSenderProtocolAddrCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowArpSenderProtocolAddrCounter object +func (obj *patternFlowArpSenderProtocolAddrCounter) SetCount(value uint32) PatternFlowArpSenderProtocolAddrCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowArpSenderProtocolAddrCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateIpv4(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderProtocolAddrCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateIpv4(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpSenderProtocolAddrCounter.Step")) + } + + } + +} + +func (obj *patternFlowArpSenderProtocolAddrCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("0.0.0.0") + } + if obj.obj.Step == nil { + obj.SetStep("0.0.0.1") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_arp_sender_protocol_addr_metric_tag.go b/gosnappi/pattern_flow_arp_sender_protocol_addr_metric_tag.go new file mode 100644 index 00000000..f1fea2bc --- /dev/null +++ b/gosnappi/pattern_flow_arp_sender_protocol_addr_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowArpSenderProtocolAddrMetricTag ***** +type patternFlowArpSenderProtocolAddrMetricTag struct { + validation + obj *otg.PatternFlowArpSenderProtocolAddrMetricTag + marshaller marshalPatternFlowArpSenderProtocolAddrMetricTag + unMarshaller unMarshalPatternFlowArpSenderProtocolAddrMetricTag +} + +func NewPatternFlowArpSenderProtocolAddrMetricTag() PatternFlowArpSenderProtocolAddrMetricTag { + obj := patternFlowArpSenderProtocolAddrMetricTag{obj: &otg.PatternFlowArpSenderProtocolAddrMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpSenderProtocolAddrMetricTag) msg() *otg.PatternFlowArpSenderProtocolAddrMetricTag { + return obj.obj +} + +func (obj *patternFlowArpSenderProtocolAddrMetricTag) setMsg(msg *otg.PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpSenderProtocolAddrMetricTag struct { + obj *patternFlowArpSenderProtocolAddrMetricTag +} + +type marshalPatternFlowArpSenderProtocolAddrMetricTag interface { + // ToProto marshals PatternFlowArpSenderProtocolAddrMetricTag to protobuf object *otg.PatternFlowArpSenderProtocolAddrMetricTag + ToProto() (*otg.PatternFlowArpSenderProtocolAddrMetricTag, error) + // ToPbText marshals PatternFlowArpSenderProtocolAddrMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpSenderProtocolAddrMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpSenderProtocolAddrMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpSenderProtocolAddrMetricTag struct { + obj *patternFlowArpSenderProtocolAddrMetricTag +} + +type unMarshalPatternFlowArpSenderProtocolAddrMetricTag interface { + // FromProto unmarshals PatternFlowArpSenderProtocolAddrMetricTag from protobuf object *otg.PatternFlowArpSenderProtocolAddrMetricTag + FromProto(msg *otg.PatternFlowArpSenderProtocolAddrMetricTag) (PatternFlowArpSenderProtocolAddrMetricTag, error) + // FromPbText unmarshals PatternFlowArpSenderProtocolAddrMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpSenderProtocolAddrMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpSenderProtocolAddrMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpSenderProtocolAddrMetricTag) Marshal() marshalPatternFlowArpSenderProtocolAddrMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpSenderProtocolAddrMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpSenderProtocolAddrMetricTag) Unmarshal() unMarshalPatternFlowArpSenderProtocolAddrMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpSenderProtocolAddrMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpSenderProtocolAddrMetricTag) ToProto() (*otg.PatternFlowArpSenderProtocolAddrMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpSenderProtocolAddrMetricTag) FromProto(msg *otg.PatternFlowArpSenderProtocolAddrMetricTag) (PatternFlowArpSenderProtocolAddrMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpSenderProtocolAddrMetricTag) 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 *unMarshalpatternFlowArpSenderProtocolAddrMetricTag) 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 *marshalpatternFlowArpSenderProtocolAddrMetricTag) 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 *unMarshalpatternFlowArpSenderProtocolAddrMetricTag) 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 *marshalpatternFlowArpSenderProtocolAddrMetricTag) 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 *unMarshalpatternFlowArpSenderProtocolAddrMetricTag) 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 *patternFlowArpSenderProtocolAddrMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpSenderProtocolAddrMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpSenderProtocolAddrMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpSenderProtocolAddrMetricTag) Clone() (PatternFlowArpSenderProtocolAddrMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpSenderProtocolAddrMetricTag() + 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 +} + +// PatternFlowArpSenderProtocolAddrMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowArpSenderProtocolAddrMetricTag interface { + Validation + // msg marshals PatternFlowArpSenderProtocolAddrMetricTag to protobuf object *otg.PatternFlowArpSenderProtocolAddrMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowArpSenderProtocolAddrMetricTag + // setMsg unmarshals PatternFlowArpSenderProtocolAddrMetricTag from protobuf object *otg.PatternFlowArpSenderProtocolAddrMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowArpSenderProtocolAddrMetricTag) PatternFlowArpSenderProtocolAddrMetricTag + // provides marshal interface + Marshal() marshalPatternFlowArpSenderProtocolAddrMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpSenderProtocolAddrMetricTag + // validate validates PatternFlowArpSenderProtocolAddrMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpSenderProtocolAddrMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowArpSenderProtocolAddrMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowArpSenderProtocolAddrMetricTag + SetName(value string) PatternFlowArpSenderProtocolAddrMetricTag + // Offset returns uint32, set in PatternFlowArpSenderProtocolAddrMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowArpSenderProtocolAddrMetricTag + SetOffset(value uint32) PatternFlowArpSenderProtocolAddrMetricTag + // HasOffset checks if Offset has been set in PatternFlowArpSenderProtocolAddrMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowArpSenderProtocolAddrMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowArpSenderProtocolAddrMetricTag + SetLength(value uint32) PatternFlowArpSenderProtocolAddrMetricTag + // HasLength checks if Length has been set in PatternFlowArpSenderProtocolAddrMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowArpSenderProtocolAddrMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowArpSenderProtocolAddrMetricTag object +func (obj *patternFlowArpSenderProtocolAddrMetricTag) SetName(value string) PatternFlowArpSenderProtocolAddrMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpSenderProtocolAddrMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpSenderProtocolAddrMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowArpSenderProtocolAddrMetricTag object +func (obj *patternFlowArpSenderProtocolAddrMetricTag) SetOffset(value uint32) PatternFlowArpSenderProtocolAddrMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpSenderProtocolAddrMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpSenderProtocolAddrMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowArpSenderProtocolAddrMetricTag object +func (obj *patternFlowArpSenderProtocolAddrMetricTag) SetLength(value uint32) PatternFlowArpSenderProtocolAddrMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowArpSenderProtocolAddrMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpSenderProtocolAddrMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpSenderProtocolAddrMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowArpSenderProtocolAddrMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowArpSenderProtocolAddrMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(32) + } + +} diff --git a/gosnappi/pattern_flow_arp_target_hardware_addr.go b/gosnappi/pattern_flow_arp_target_hardware_addr.go new file mode 100644 index 00000000..d65b35ff --- /dev/null +++ b/gosnappi/pattern_flow_arp_target_hardware_addr.go @@ -0,0 +1,658 @@ +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" +) + +// ***** PatternFlowArpTargetHardwareAddr ***** +type patternFlowArpTargetHardwareAddr struct { + validation + obj *otg.PatternFlowArpTargetHardwareAddr + marshaller marshalPatternFlowArpTargetHardwareAddr + unMarshaller unMarshalPatternFlowArpTargetHardwareAddr + incrementHolder PatternFlowArpTargetHardwareAddrCounter + decrementHolder PatternFlowArpTargetHardwareAddrCounter + metricTagsHolder PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter +} + +func NewPatternFlowArpTargetHardwareAddr() PatternFlowArpTargetHardwareAddr { + obj := patternFlowArpTargetHardwareAddr{obj: &otg.PatternFlowArpTargetHardwareAddr{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpTargetHardwareAddr) msg() *otg.PatternFlowArpTargetHardwareAddr { + return obj.obj +} + +func (obj *patternFlowArpTargetHardwareAddr) setMsg(msg *otg.PatternFlowArpTargetHardwareAddr) PatternFlowArpTargetHardwareAddr { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpTargetHardwareAddr struct { + obj *patternFlowArpTargetHardwareAddr +} + +type marshalPatternFlowArpTargetHardwareAddr interface { + // ToProto marshals PatternFlowArpTargetHardwareAddr to protobuf object *otg.PatternFlowArpTargetHardwareAddr + ToProto() (*otg.PatternFlowArpTargetHardwareAddr, error) + // ToPbText marshals PatternFlowArpTargetHardwareAddr to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpTargetHardwareAddr to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpTargetHardwareAddr to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpTargetHardwareAddr struct { + obj *patternFlowArpTargetHardwareAddr +} + +type unMarshalPatternFlowArpTargetHardwareAddr interface { + // FromProto unmarshals PatternFlowArpTargetHardwareAddr from protobuf object *otg.PatternFlowArpTargetHardwareAddr + FromProto(msg *otg.PatternFlowArpTargetHardwareAddr) (PatternFlowArpTargetHardwareAddr, error) + // FromPbText unmarshals PatternFlowArpTargetHardwareAddr from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpTargetHardwareAddr from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpTargetHardwareAddr from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpTargetHardwareAddr) Marshal() marshalPatternFlowArpTargetHardwareAddr { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpTargetHardwareAddr{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpTargetHardwareAddr) Unmarshal() unMarshalPatternFlowArpTargetHardwareAddr { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpTargetHardwareAddr{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpTargetHardwareAddr) ToProto() (*otg.PatternFlowArpTargetHardwareAddr, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpTargetHardwareAddr) FromProto(msg *otg.PatternFlowArpTargetHardwareAddr) (PatternFlowArpTargetHardwareAddr, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpTargetHardwareAddr) 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 *unMarshalpatternFlowArpTargetHardwareAddr) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowArpTargetHardwareAddr) 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 *unMarshalpatternFlowArpTargetHardwareAddr) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowArpTargetHardwareAddr) 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 *unMarshalpatternFlowArpTargetHardwareAddr) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowArpTargetHardwareAddr) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpTargetHardwareAddr) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpTargetHardwareAddr) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpTargetHardwareAddr) Clone() (PatternFlowArpTargetHardwareAddr, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpTargetHardwareAddr() + 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 +} + +func (obj *patternFlowArpTargetHardwareAddr) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowArpTargetHardwareAddr is media address of the target +type PatternFlowArpTargetHardwareAddr interface { + Validation + // msg marshals PatternFlowArpTargetHardwareAddr to protobuf object *otg.PatternFlowArpTargetHardwareAddr + // and doesn't set defaults + msg() *otg.PatternFlowArpTargetHardwareAddr + // setMsg unmarshals PatternFlowArpTargetHardwareAddr from protobuf object *otg.PatternFlowArpTargetHardwareAddr + // and doesn't set defaults + setMsg(*otg.PatternFlowArpTargetHardwareAddr) PatternFlowArpTargetHardwareAddr + // provides marshal interface + Marshal() marshalPatternFlowArpTargetHardwareAddr + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpTargetHardwareAddr + // validate validates PatternFlowArpTargetHardwareAddr + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpTargetHardwareAddr, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowArpTargetHardwareAddrChoiceEnum, set in PatternFlowArpTargetHardwareAddr + Choice() PatternFlowArpTargetHardwareAddrChoiceEnum + // setChoice assigns PatternFlowArpTargetHardwareAddrChoiceEnum provided by user to PatternFlowArpTargetHardwareAddr + setChoice(value PatternFlowArpTargetHardwareAddrChoiceEnum) PatternFlowArpTargetHardwareAddr + // HasChoice checks if Choice has been set in PatternFlowArpTargetHardwareAddr + HasChoice() bool + // Value returns string, set in PatternFlowArpTargetHardwareAddr. + Value() string + // SetValue assigns string provided by user to PatternFlowArpTargetHardwareAddr + SetValue(value string) PatternFlowArpTargetHardwareAddr + // HasValue checks if Value has been set in PatternFlowArpTargetHardwareAddr + HasValue() bool + // Values returns []string, set in PatternFlowArpTargetHardwareAddr. + Values() []string + // SetValues assigns []string provided by user to PatternFlowArpTargetHardwareAddr + SetValues(value []string) PatternFlowArpTargetHardwareAddr + // Increment returns PatternFlowArpTargetHardwareAddrCounter, set in PatternFlowArpTargetHardwareAddr. + // PatternFlowArpTargetHardwareAddrCounter is mac counter pattern + Increment() PatternFlowArpTargetHardwareAddrCounter + // SetIncrement assigns PatternFlowArpTargetHardwareAddrCounter provided by user to PatternFlowArpTargetHardwareAddr. + // PatternFlowArpTargetHardwareAddrCounter is mac counter pattern + SetIncrement(value PatternFlowArpTargetHardwareAddrCounter) PatternFlowArpTargetHardwareAddr + // HasIncrement checks if Increment has been set in PatternFlowArpTargetHardwareAddr + HasIncrement() bool + // Decrement returns PatternFlowArpTargetHardwareAddrCounter, set in PatternFlowArpTargetHardwareAddr. + // PatternFlowArpTargetHardwareAddrCounter is mac counter pattern + Decrement() PatternFlowArpTargetHardwareAddrCounter + // SetDecrement assigns PatternFlowArpTargetHardwareAddrCounter provided by user to PatternFlowArpTargetHardwareAddr. + // PatternFlowArpTargetHardwareAddrCounter is mac counter pattern + SetDecrement(value PatternFlowArpTargetHardwareAddrCounter) PatternFlowArpTargetHardwareAddr + // HasDecrement checks if Decrement has been set in PatternFlowArpTargetHardwareAddr + HasDecrement() bool + // MetricTags returns PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIterIter, set in PatternFlowArpTargetHardwareAddr + MetricTags() PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter + setNil() +} + +type PatternFlowArpTargetHardwareAddrChoiceEnum string + +// Enum of Choice on PatternFlowArpTargetHardwareAddr +var PatternFlowArpTargetHardwareAddrChoice = struct { + VALUE PatternFlowArpTargetHardwareAddrChoiceEnum + VALUES PatternFlowArpTargetHardwareAddrChoiceEnum + INCREMENT PatternFlowArpTargetHardwareAddrChoiceEnum + DECREMENT PatternFlowArpTargetHardwareAddrChoiceEnum +}{ + VALUE: PatternFlowArpTargetHardwareAddrChoiceEnum("value"), + VALUES: PatternFlowArpTargetHardwareAddrChoiceEnum("values"), + INCREMENT: PatternFlowArpTargetHardwareAddrChoiceEnum("increment"), + DECREMENT: PatternFlowArpTargetHardwareAddrChoiceEnum("decrement"), +} + +func (obj *patternFlowArpTargetHardwareAddr) Choice() PatternFlowArpTargetHardwareAddrChoiceEnum { + return PatternFlowArpTargetHardwareAddrChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowArpTargetHardwareAddr) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowArpTargetHardwareAddr) setChoice(value PatternFlowArpTargetHardwareAddrChoiceEnum) PatternFlowArpTargetHardwareAddr { + intValue, ok := otg.PatternFlowArpTargetHardwareAddr_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowArpTargetHardwareAddrChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowArpTargetHardwareAddr_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowArpTargetHardwareAddrChoice.VALUE { + defaultValue := "00:00:00:00:00:00" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowArpTargetHardwareAddrChoice.VALUES { + defaultValue := []string{"00:00:00:00:00:00"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowArpTargetHardwareAddrChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowArpTargetHardwareAddrCounter().msg() + } + + if value == PatternFlowArpTargetHardwareAddrChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowArpTargetHardwareAddrCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowArpTargetHardwareAddr) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowArpTargetHardwareAddr) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowArpTargetHardwareAddr object +func (obj *patternFlowArpTargetHardwareAddr) SetValue(value string) PatternFlowArpTargetHardwareAddr { + obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowArpTargetHardwareAddr) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"00:00:00:00:00:00"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowArpTargetHardwareAddr object +func (obj *patternFlowArpTargetHardwareAddr) SetValues(value []string) PatternFlowArpTargetHardwareAddr { + obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowArpTargetHardwareAddrCounter +func (obj *patternFlowArpTargetHardwareAddr) Increment() PatternFlowArpTargetHardwareAddrCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowArpTargetHardwareAddrCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowArpTargetHardwareAddrCounter +func (obj *patternFlowArpTargetHardwareAddr) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowArpTargetHardwareAddrCounter value in the PatternFlowArpTargetHardwareAddr object +func (obj *patternFlowArpTargetHardwareAddr) SetIncrement(value PatternFlowArpTargetHardwareAddrCounter) PatternFlowArpTargetHardwareAddr { + obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowArpTargetHardwareAddrCounter +func (obj *patternFlowArpTargetHardwareAddr) Decrement() PatternFlowArpTargetHardwareAddrCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowArpTargetHardwareAddrCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowArpTargetHardwareAddrCounter +func (obj *patternFlowArpTargetHardwareAddr) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowArpTargetHardwareAddrCounter value in the PatternFlowArpTargetHardwareAddr object +func (obj *patternFlowArpTargetHardwareAddr) SetDecrement(value PatternFlowArpTargetHardwareAddrCounter) PatternFlowArpTargetHardwareAddr { + obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowArpTargetHardwareAddrMetricTag +func (obj *patternFlowArpTargetHardwareAddr) MetricTags() PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowArpTargetHardwareAddrMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter struct { + obj *patternFlowArpTargetHardwareAddr + patternFlowArpTargetHardwareAddrMetricTagSlice []PatternFlowArpTargetHardwareAddrMetricTag + fieldPtr *[]*otg.PatternFlowArpTargetHardwareAddrMetricTag +} + +func newPatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter(ptr *[]*otg.PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { + return &patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter interface { + setMsg(*patternFlowArpTargetHardwareAddr) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter + Items() []PatternFlowArpTargetHardwareAddrMetricTag + Add() PatternFlowArpTargetHardwareAddrMetricTag + Append(items ...PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter + Set(index int, newObj PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter + Clear() PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter + clearHolderSlice() PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter + appendHolderSlice(item PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter +} + +func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) setMsg(msg *patternFlowArpTargetHardwareAddr) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowArpTargetHardwareAddrMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) Items() []PatternFlowArpTargetHardwareAddrMetricTag { + return obj.patternFlowArpTargetHardwareAddrMetricTagSlice +} + +func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) Add() PatternFlowArpTargetHardwareAddrMetricTag { + newObj := &otg.PatternFlowArpTargetHardwareAddrMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowArpTargetHardwareAddrMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowArpTargetHardwareAddrMetricTagSlice = append(obj.patternFlowArpTargetHardwareAddrMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) Append(items ...PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowArpTargetHardwareAddrMetricTagSlice = append(obj.patternFlowArpTargetHardwareAddrMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) Set(index int, newObj PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowArpTargetHardwareAddrMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) Clear() PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowArpTargetHardwareAddrMetricTag{} + obj.patternFlowArpTargetHardwareAddrMetricTagSlice = []PatternFlowArpTargetHardwareAddrMetricTag{} + } + return obj +} +func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) clearHolderSlice() PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { + if len(obj.patternFlowArpTargetHardwareAddrMetricTagSlice) > 0 { + obj.patternFlowArpTargetHardwareAddrMetricTagSlice = []PatternFlowArpTargetHardwareAddrMetricTag{} + } + return obj +} +func (obj *patternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter) appendHolderSlice(item PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrPatternFlowArpTargetHardwareAddrMetricTagIter { + obj.patternFlowArpTargetHardwareAddrMetricTagSlice = append(obj.patternFlowArpTargetHardwareAddrMetricTagSlice, item) + return obj +} + +func (obj *patternFlowArpTargetHardwareAddr) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateMac(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetHardwareAddr.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateMacSlice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetHardwareAddr.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowArpTargetHardwareAddrMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowArpTargetHardwareAddr) setDefault() { + var choices_set int = 0 + var choice PatternFlowArpTargetHardwareAddrChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowArpTargetHardwareAddrChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowArpTargetHardwareAddrChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowArpTargetHardwareAddrChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowArpTargetHardwareAddrChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowArpTargetHardwareAddrChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpTargetHardwareAddr") + } + } else { + intVal := otg.PatternFlowArpTargetHardwareAddr_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowArpTargetHardwareAddr_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_arp_target_hardware_addr_counter.go b/gosnappi/pattern_flow_arp_target_hardware_addr_counter.go new file mode 100644 index 00000000..9fa87d0b --- /dev/null +++ b/gosnappi/pattern_flow_arp_target_hardware_addr_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowArpTargetHardwareAddrCounter ***** +type patternFlowArpTargetHardwareAddrCounter struct { + validation + obj *otg.PatternFlowArpTargetHardwareAddrCounter + marshaller marshalPatternFlowArpTargetHardwareAddrCounter + unMarshaller unMarshalPatternFlowArpTargetHardwareAddrCounter +} + +func NewPatternFlowArpTargetHardwareAddrCounter() PatternFlowArpTargetHardwareAddrCounter { + obj := patternFlowArpTargetHardwareAddrCounter{obj: &otg.PatternFlowArpTargetHardwareAddrCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpTargetHardwareAddrCounter) msg() *otg.PatternFlowArpTargetHardwareAddrCounter { + return obj.obj +} + +func (obj *patternFlowArpTargetHardwareAddrCounter) setMsg(msg *otg.PatternFlowArpTargetHardwareAddrCounter) PatternFlowArpTargetHardwareAddrCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpTargetHardwareAddrCounter struct { + obj *patternFlowArpTargetHardwareAddrCounter +} + +type marshalPatternFlowArpTargetHardwareAddrCounter interface { + // ToProto marshals PatternFlowArpTargetHardwareAddrCounter to protobuf object *otg.PatternFlowArpTargetHardwareAddrCounter + ToProto() (*otg.PatternFlowArpTargetHardwareAddrCounter, error) + // ToPbText marshals PatternFlowArpTargetHardwareAddrCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpTargetHardwareAddrCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpTargetHardwareAddrCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpTargetHardwareAddrCounter struct { + obj *patternFlowArpTargetHardwareAddrCounter +} + +type unMarshalPatternFlowArpTargetHardwareAddrCounter interface { + // FromProto unmarshals PatternFlowArpTargetHardwareAddrCounter from protobuf object *otg.PatternFlowArpTargetHardwareAddrCounter + FromProto(msg *otg.PatternFlowArpTargetHardwareAddrCounter) (PatternFlowArpTargetHardwareAddrCounter, error) + // FromPbText unmarshals PatternFlowArpTargetHardwareAddrCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpTargetHardwareAddrCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpTargetHardwareAddrCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpTargetHardwareAddrCounter) Marshal() marshalPatternFlowArpTargetHardwareAddrCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpTargetHardwareAddrCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpTargetHardwareAddrCounter) Unmarshal() unMarshalPatternFlowArpTargetHardwareAddrCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpTargetHardwareAddrCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpTargetHardwareAddrCounter) ToProto() (*otg.PatternFlowArpTargetHardwareAddrCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpTargetHardwareAddrCounter) FromProto(msg *otg.PatternFlowArpTargetHardwareAddrCounter) (PatternFlowArpTargetHardwareAddrCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpTargetHardwareAddrCounter) 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 *unMarshalpatternFlowArpTargetHardwareAddrCounter) 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 *marshalpatternFlowArpTargetHardwareAddrCounter) 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 *unMarshalpatternFlowArpTargetHardwareAddrCounter) 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 *marshalpatternFlowArpTargetHardwareAddrCounter) 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 *unMarshalpatternFlowArpTargetHardwareAddrCounter) 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 *patternFlowArpTargetHardwareAddrCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpTargetHardwareAddrCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpTargetHardwareAddrCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpTargetHardwareAddrCounter) Clone() (PatternFlowArpTargetHardwareAddrCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpTargetHardwareAddrCounter() + 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 +} + +// PatternFlowArpTargetHardwareAddrCounter is mac counter pattern +type PatternFlowArpTargetHardwareAddrCounter interface { + Validation + // msg marshals PatternFlowArpTargetHardwareAddrCounter to protobuf object *otg.PatternFlowArpTargetHardwareAddrCounter + // and doesn't set defaults + msg() *otg.PatternFlowArpTargetHardwareAddrCounter + // setMsg unmarshals PatternFlowArpTargetHardwareAddrCounter from protobuf object *otg.PatternFlowArpTargetHardwareAddrCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowArpTargetHardwareAddrCounter) PatternFlowArpTargetHardwareAddrCounter + // provides marshal interface + Marshal() marshalPatternFlowArpTargetHardwareAddrCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpTargetHardwareAddrCounter + // validate validates PatternFlowArpTargetHardwareAddrCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpTargetHardwareAddrCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowArpTargetHardwareAddrCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowArpTargetHardwareAddrCounter + SetStart(value string) PatternFlowArpTargetHardwareAddrCounter + // HasStart checks if Start has been set in PatternFlowArpTargetHardwareAddrCounter + HasStart() bool + // Step returns string, set in PatternFlowArpTargetHardwareAddrCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowArpTargetHardwareAddrCounter + SetStep(value string) PatternFlowArpTargetHardwareAddrCounter + // HasStep checks if Step has been set in PatternFlowArpTargetHardwareAddrCounter + HasStep() bool + // Count returns uint32, set in PatternFlowArpTargetHardwareAddrCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowArpTargetHardwareAddrCounter + SetCount(value uint32) PatternFlowArpTargetHardwareAddrCounter + // HasCount checks if Count has been set in PatternFlowArpTargetHardwareAddrCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowArpTargetHardwareAddrCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowArpTargetHardwareAddrCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowArpTargetHardwareAddrCounter object +func (obj *patternFlowArpTargetHardwareAddrCounter) SetStart(value string) PatternFlowArpTargetHardwareAddrCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowArpTargetHardwareAddrCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowArpTargetHardwareAddrCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowArpTargetHardwareAddrCounter object +func (obj *patternFlowArpTargetHardwareAddrCounter) SetStep(value string) PatternFlowArpTargetHardwareAddrCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpTargetHardwareAddrCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpTargetHardwareAddrCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowArpTargetHardwareAddrCounter object +func (obj *patternFlowArpTargetHardwareAddrCounter) SetCount(value uint32) PatternFlowArpTargetHardwareAddrCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowArpTargetHardwareAddrCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateMac(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetHardwareAddrCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateMac(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetHardwareAddrCounter.Step")) + } + + } + +} + +func (obj *patternFlowArpTargetHardwareAddrCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("00:00:00:00:00:00") + } + if obj.obj.Step == nil { + obj.SetStep("00:00:00:00:00:01") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_arp_target_hardware_addr_metric_tag.go b/gosnappi/pattern_flow_arp_target_hardware_addr_metric_tag.go new file mode 100644 index 00000000..5d3d602f --- /dev/null +++ b/gosnappi/pattern_flow_arp_target_hardware_addr_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowArpTargetHardwareAddrMetricTag ***** +type patternFlowArpTargetHardwareAddrMetricTag struct { + validation + obj *otg.PatternFlowArpTargetHardwareAddrMetricTag + marshaller marshalPatternFlowArpTargetHardwareAddrMetricTag + unMarshaller unMarshalPatternFlowArpTargetHardwareAddrMetricTag +} + +func NewPatternFlowArpTargetHardwareAddrMetricTag() PatternFlowArpTargetHardwareAddrMetricTag { + obj := patternFlowArpTargetHardwareAddrMetricTag{obj: &otg.PatternFlowArpTargetHardwareAddrMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpTargetHardwareAddrMetricTag) msg() *otg.PatternFlowArpTargetHardwareAddrMetricTag { + return obj.obj +} + +func (obj *patternFlowArpTargetHardwareAddrMetricTag) setMsg(msg *otg.PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpTargetHardwareAddrMetricTag struct { + obj *patternFlowArpTargetHardwareAddrMetricTag +} + +type marshalPatternFlowArpTargetHardwareAddrMetricTag interface { + // ToProto marshals PatternFlowArpTargetHardwareAddrMetricTag to protobuf object *otg.PatternFlowArpTargetHardwareAddrMetricTag + ToProto() (*otg.PatternFlowArpTargetHardwareAddrMetricTag, error) + // ToPbText marshals PatternFlowArpTargetHardwareAddrMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpTargetHardwareAddrMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpTargetHardwareAddrMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpTargetHardwareAddrMetricTag struct { + obj *patternFlowArpTargetHardwareAddrMetricTag +} + +type unMarshalPatternFlowArpTargetHardwareAddrMetricTag interface { + // FromProto unmarshals PatternFlowArpTargetHardwareAddrMetricTag from protobuf object *otg.PatternFlowArpTargetHardwareAddrMetricTag + FromProto(msg *otg.PatternFlowArpTargetHardwareAddrMetricTag) (PatternFlowArpTargetHardwareAddrMetricTag, error) + // FromPbText unmarshals PatternFlowArpTargetHardwareAddrMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpTargetHardwareAddrMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpTargetHardwareAddrMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpTargetHardwareAddrMetricTag) Marshal() marshalPatternFlowArpTargetHardwareAddrMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpTargetHardwareAddrMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpTargetHardwareAddrMetricTag) Unmarshal() unMarshalPatternFlowArpTargetHardwareAddrMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpTargetHardwareAddrMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpTargetHardwareAddrMetricTag) ToProto() (*otg.PatternFlowArpTargetHardwareAddrMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpTargetHardwareAddrMetricTag) FromProto(msg *otg.PatternFlowArpTargetHardwareAddrMetricTag) (PatternFlowArpTargetHardwareAddrMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpTargetHardwareAddrMetricTag) 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 *unMarshalpatternFlowArpTargetHardwareAddrMetricTag) 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 *marshalpatternFlowArpTargetHardwareAddrMetricTag) 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 *unMarshalpatternFlowArpTargetHardwareAddrMetricTag) 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 *marshalpatternFlowArpTargetHardwareAddrMetricTag) 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 *unMarshalpatternFlowArpTargetHardwareAddrMetricTag) 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 *patternFlowArpTargetHardwareAddrMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpTargetHardwareAddrMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpTargetHardwareAddrMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpTargetHardwareAddrMetricTag) Clone() (PatternFlowArpTargetHardwareAddrMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpTargetHardwareAddrMetricTag() + 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 +} + +// PatternFlowArpTargetHardwareAddrMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowArpTargetHardwareAddrMetricTag interface { + Validation + // msg marshals PatternFlowArpTargetHardwareAddrMetricTag to protobuf object *otg.PatternFlowArpTargetHardwareAddrMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowArpTargetHardwareAddrMetricTag + // setMsg unmarshals PatternFlowArpTargetHardwareAddrMetricTag from protobuf object *otg.PatternFlowArpTargetHardwareAddrMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowArpTargetHardwareAddrMetricTag) PatternFlowArpTargetHardwareAddrMetricTag + // provides marshal interface + Marshal() marshalPatternFlowArpTargetHardwareAddrMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpTargetHardwareAddrMetricTag + // validate validates PatternFlowArpTargetHardwareAddrMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpTargetHardwareAddrMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowArpTargetHardwareAddrMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowArpTargetHardwareAddrMetricTag + SetName(value string) PatternFlowArpTargetHardwareAddrMetricTag + // Offset returns uint32, set in PatternFlowArpTargetHardwareAddrMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowArpTargetHardwareAddrMetricTag + SetOffset(value uint32) PatternFlowArpTargetHardwareAddrMetricTag + // HasOffset checks if Offset has been set in PatternFlowArpTargetHardwareAddrMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowArpTargetHardwareAddrMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowArpTargetHardwareAddrMetricTag + SetLength(value uint32) PatternFlowArpTargetHardwareAddrMetricTag + // HasLength checks if Length has been set in PatternFlowArpTargetHardwareAddrMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowArpTargetHardwareAddrMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowArpTargetHardwareAddrMetricTag object +func (obj *patternFlowArpTargetHardwareAddrMetricTag) SetName(value string) PatternFlowArpTargetHardwareAddrMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpTargetHardwareAddrMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpTargetHardwareAddrMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowArpTargetHardwareAddrMetricTag object +func (obj *patternFlowArpTargetHardwareAddrMetricTag) SetOffset(value uint32) PatternFlowArpTargetHardwareAddrMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpTargetHardwareAddrMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpTargetHardwareAddrMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowArpTargetHardwareAddrMetricTag object +func (obj *patternFlowArpTargetHardwareAddrMetricTag) SetLength(value uint32) PatternFlowArpTargetHardwareAddrMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowArpTargetHardwareAddrMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpTargetHardwareAddrMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 47 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpTargetHardwareAddrMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 48 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowArpTargetHardwareAddrMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowArpTargetHardwareAddrMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(48) + } + +} diff --git a/gosnappi/pattern_flow_arp_target_protocol_addr.go b/gosnappi/pattern_flow_arp_target_protocol_addr.go new file mode 100644 index 00000000..6787a3ca --- /dev/null +++ b/gosnappi/pattern_flow_arp_target_protocol_addr.go @@ -0,0 +1,658 @@ +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" +) + +// ***** PatternFlowArpTargetProtocolAddr ***** +type patternFlowArpTargetProtocolAddr struct { + validation + obj *otg.PatternFlowArpTargetProtocolAddr + marshaller marshalPatternFlowArpTargetProtocolAddr + unMarshaller unMarshalPatternFlowArpTargetProtocolAddr + incrementHolder PatternFlowArpTargetProtocolAddrCounter + decrementHolder PatternFlowArpTargetProtocolAddrCounter + metricTagsHolder PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter +} + +func NewPatternFlowArpTargetProtocolAddr() PatternFlowArpTargetProtocolAddr { + obj := patternFlowArpTargetProtocolAddr{obj: &otg.PatternFlowArpTargetProtocolAddr{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpTargetProtocolAddr) msg() *otg.PatternFlowArpTargetProtocolAddr { + return obj.obj +} + +func (obj *patternFlowArpTargetProtocolAddr) setMsg(msg *otg.PatternFlowArpTargetProtocolAddr) PatternFlowArpTargetProtocolAddr { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpTargetProtocolAddr struct { + obj *patternFlowArpTargetProtocolAddr +} + +type marshalPatternFlowArpTargetProtocolAddr interface { + // ToProto marshals PatternFlowArpTargetProtocolAddr to protobuf object *otg.PatternFlowArpTargetProtocolAddr + ToProto() (*otg.PatternFlowArpTargetProtocolAddr, error) + // ToPbText marshals PatternFlowArpTargetProtocolAddr to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpTargetProtocolAddr to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpTargetProtocolAddr to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpTargetProtocolAddr struct { + obj *patternFlowArpTargetProtocolAddr +} + +type unMarshalPatternFlowArpTargetProtocolAddr interface { + // FromProto unmarshals PatternFlowArpTargetProtocolAddr from protobuf object *otg.PatternFlowArpTargetProtocolAddr + FromProto(msg *otg.PatternFlowArpTargetProtocolAddr) (PatternFlowArpTargetProtocolAddr, error) + // FromPbText unmarshals PatternFlowArpTargetProtocolAddr from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpTargetProtocolAddr from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpTargetProtocolAddr from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpTargetProtocolAddr) Marshal() marshalPatternFlowArpTargetProtocolAddr { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpTargetProtocolAddr{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpTargetProtocolAddr) Unmarshal() unMarshalPatternFlowArpTargetProtocolAddr { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpTargetProtocolAddr{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpTargetProtocolAddr) ToProto() (*otg.PatternFlowArpTargetProtocolAddr, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpTargetProtocolAddr) FromProto(msg *otg.PatternFlowArpTargetProtocolAddr) (PatternFlowArpTargetProtocolAddr, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpTargetProtocolAddr) 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 *unMarshalpatternFlowArpTargetProtocolAddr) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowArpTargetProtocolAddr) 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 *unMarshalpatternFlowArpTargetProtocolAddr) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowArpTargetProtocolAddr) 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 *unMarshalpatternFlowArpTargetProtocolAddr) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowArpTargetProtocolAddr) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpTargetProtocolAddr) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpTargetProtocolAddr) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpTargetProtocolAddr) Clone() (PatternFlowArpTargetProtocolAddr, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpTargetProtocolAddr() + 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 +} + +func (obj *patternFlowArpTargetProtocolAddr) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowArpTargetProtocolAddr is internetwork address of the target +type PatternFlowArpTargetProtocolAddr interface { + Validation + // msg marshals PatternFlowArpTargetProtocolAddr to protobuf object *otg.PatternFlowArpTargetProtocolAddr + // and doesn't set defaults + msg() *otg.PatternFlowArpTargetProtocolAddr + // setMsg unmarshals PatternFlowArpTargetProtocolAddr from protobuf object *otg.PatternFlowArpTargetProtocolAddr + // and doesn't set defaults + setMsg(*otg.PatternFlowArpTargetProtocolAddr) PatternFlowArpTargetProtocolAddr + // provides marshal interface + Marshal() marshalPatternFlowArpTargetProtocolAddr + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpTargetProtocolAddr + // validate validates PatternFlowArpTargetProtocolAddr + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpTargetProtocolAddr, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowArpTargetProtocolAddrChoiceEnum, set in PatternFlowArpTargetProtocolAddr + Choice() PatternFlowArpTargetProtocolAddrChoiceEnum + // setChoice assigns PatternFlowArpTargetProtocolAddrChoiceEnum provided by user to PatternFlowArpTargetProtocolAddr + setChoice(value PatternFlowArpTargetProtocolAddrChoiceEnum) PatternFlowArpTargetProtocolAddr + // HasChoice checks if Choice has been set in PatternFlowArpTargetProtocolAddr + HasChoice() bool + // Value returns string, set in PatternFlowArpTargetProtocolAddr. + Value() string + // SetValue assigns string provided by user to PatternFlowArpTargetProtocolAddr + SetValue(value string) PatternFlowArpTargetProtocolAddr + // HasValue checks if Value has been set in PatternFlowArpTargetProtocolAddr + HasValue() bool + // Values returns []string, set in PatternFlowArpTargetProtocolAddr. + Values() []string + // SetValues assigns []string provided by user to PatternFlowArpTargetProtocolAddr + SetValues(value []string) PatternFlowArpTargetProtocolAddr + // Increment returns PatternFlowArpTargetProtocolAddrCounter, set in PatternFlowArpTargetProtocolAddr. + // PatternFlowArpTargetProtocolAddrCounter is ipv4 counter pattern + Increment() PatternFlowArpTargetProtocolAddrCounter + // SetIncrement assigns PatternFlowArpTargetProtocolAddrCounter provided by user to PatternFlowArpTargetProtocolAddr. + // PatternFlowArpTargetProtocolAddrCounter is ipv4 counter pattern + SetIncrement(value PatternFlowArpTargetProtocolAddrCounter) PatternFlowArpTargetProtocolAddr + // HasIncrement checks if Increment has been set in PatternFlowArpTargetProtocolAddr + HasIncrement() bool + // Decrement returns PatternFlowArpTargetProtocolAddrCounter, set in PatternFlowArpTargetProtocolAddr. + // PatternFlowArpTargetProtocolAddrCounter is ipv4 counter pattern + Decrement() PatternFlowArpTargetProtocolAddrCounter + // SetDecrement assigns PatternFlowArpTargetProtocolAddrCounter provided by user to PatternFlowArpTargetProtocolAddr. + // PatternFlowArpTargetProtocolAddrCounter is ipv4 counter pattern + SetDecrement(value PatternFlowArpTargetProtocolAddrCounter) PatternFlowArpTargetProtocolAddr + // HasDecrement checks if Decrement has been set in PatternFlowArpTargetProtocolAddr + HasDecrement() bool + // MetricTags returns PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIterIter, set in PatternFlowArpTargetProtocolAddr + MetricTags() PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter + setNil() +} + +type PatternFlowArpTargetProtocolAddrChoiceEnum string + +// Enum of Choice on PatternFlowArpTargetProtocolAddr +var PatternFlowArpTargetProtocolAddrChoice = struct { + VALUE PatternFlowArpTargetProtocolAddrChoiceEnum + VALUES PatternFlowArpTargetProtocolAddrChoiceEnum + INCREMENT PatternFlowArpTargetProtocolAddrChoiceEnum + DECREMENT PatternFlowArpTargetProtocolAddrChoiceEnum +}{ + VALUE: PatternFlowArpTargetProtocolAddrChoiceEnum("value"), + VALUES: PatternFlowArpTargetProtocolAddrChoiceEnum("values"), + INCREMENT: PatternFlowArpTargetProtocolAddrChoiceEnum("increment"), + DECREMENT: PatternFlowArpTargetProtocolAddrChoiceEnum("decrement"), +} + +func (obj *patternFlowArpTargetProtocolAddr) Choice() PatternFlowArpTargetProtocolAddrChoiceEnum { + return PatternFlowArpTargetProtocolAddrChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowArpTargetProtocolAddr) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowArpTargetProtocolAddr) setChoice(value PatternFlowArpTargetProtocolAddrChoiceEnum) PatternFlowArpTargetProtocolAddr { + intValue, ok := otg.PatternFlowArpTargetProtocolAddr_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowArpTargetProtocolAddrChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowArpTargetProtocolAddr_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowArpTargetProtocolAddrChoice.VALUE { + defaultValue := "0.0.0.0" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowArpTargetProtocolAddrChoice.VALUES { + defaultValue := []string{"0.0.0.0"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowArpTargetProtocolAddrChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowArpTargetProtocolAddrCounter().msg() + } + + if value == PatternFlowArpTargetProtocolAddrChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowArpTargetProtocolAddrCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowArpTargetProtocolAddr) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowArpTargetProtocolAddr) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowArpTargetProtocolAddr object +func (obj *patternFlowArpTargetProtocolAddr) SetValue(value string) PatternFlowArpTargetProtocolAddr { + obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowArpTargetProtocolAddr) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"0.0.0.0"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowArpTargetProtocolAddr object +func (obj *patternFlowArpTargetProtocolAddr) SetValues(value []string) PatternFlowArpTargetProtocolAddr { + obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowArpTargetProtocolAddrCounter +func (obj *patternFlowArpTargetProtocolAddr) Increment() PatternFlowArpTargetProtocolAddrCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowArpTargetProtocolAddrCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowArpTargetProtocolAddrCounter +func (obj *patternFlowArpTargetProtocolAddr) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowArpTargetProtocolAddrCounter value in the PatternFlowArpTargetProtocolAddr object +func (obj *patternFlowArpTargetProtocolAddr) SetIncrement(value PatternFlowArpTargetProtocolAddrCounter) PatternFlowArpTargetProtocolAddr { + obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowArpTargetProtocolAddrCounter +func (obj *patternFlowArpTargetProtocolAddr) Decrement() PatternFlowArpTargetProtocolAddrCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowArpTargetProtocolAddrCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowArpTargetProtocolAddrCounter +func (obj *patternFlowArpTargetProtocolAddr) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowArpTargetProtocolAddrCounter value in the PatternFlowArpTargetProtocolAddr object +func (obj *patternFlowArpTargetProtocolAddr) SetDecrement(value PatternFlowArpTargetProtocolAddrCounter) PatternFlowArpTargetProtocolAddr { + obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowArpTargetProtocolAddrMetricTag +func (obj *patternFlowArpTargetProtocolAddr) MetricTags() PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowArpTargetProtocolAddrMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter struct { + obj *patternFlowArpTargetProtocolAddr + patternFlowArpTargetProtocolAddrMetricTagSlice []PatternFlowArpTargetProtocolAddrMetricTag + fieldPtr *[]*otg.PatternFlowArpTargetProtocolAddrMetricTag +} + +func newPatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter(ptr *[]*otg.PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { + return &patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter interface { + setMsg(*patternFlowArpTargetProtocolAddr) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter + Items() []PatternFlowArpTargetProtocolAddrMetricTag + Add() PatternFlowArpTargetProtocolAddrMetricTag + Append(items ...PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter + Set(index int, newObj PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter + Clear() PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter + clearHolderSlice() PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter + appendHolderSlice(item PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter +} + +func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) setMsg(msg *patternFlowArpTargetProtocolAddr) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowArpTargetProtocolAddrMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) Items() []PatternFlowArpTargetProtocolAddrMetricTag { + return obj.patternFlowArpTargetProtocolAddrMetricTagSlice +} + +func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) Add() PatternFlowArpTargetProtocolAddrMetricTag { + newObj := &otg.PatternFlowArpTargetProtocolAddrMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowArpTargetProtocolAddrMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowArpTargetProtocolAddrMetricTagSlice = append(obj.patternFlowArpTargetProtocolAddrMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) Append(items ...PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowArpTargetProtocolAddrMetricTagSlice = append(obj.patternFlowArpTargetProtocolAddrMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) Set(index int, newObj PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowArpTargetProtocolAddrMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) Clear() PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowArpTargetProtocolAddrMetricTag{} + obj.patternFlowArpTargetProtocolAddrMetricTagSlice = []PatternFlowArpTargetProtocolAddrMetricTag{} + } + return obj +} +func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) clearHolderSlice() PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { + if len(obj.patternFlowArpTargetProtocolAddrMetricTagSlice) > 0 { + obj.patternFlowArpTargetProtocolAddrMetricTagSlice = []PatternFlowArpTargetProtocolAddrMetricTag{} + } + return obj +} +func (obj *patternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter) appendHolderSlice(item PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrPatternFlowArpTargetProtocolAddrMetricTagIter { + obj.patternFlowArpTargetProtocolAddrMetricTagSlice = append(obj.patternFlowArpTargetProtocolAddrMetricTagSlice, item) + return obj +} + +func (obj *patternFlowArpTargetProtocolAddr) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv4(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetProtocolAddr.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateIpv4Slice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetProtocolAddr.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowArpTargetProtocolAddrMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowArpTargetProtocolAddr) setDefault() { + var choices_set int = 0 + var choice PatternFlowArpTargetProtocolAddrChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowArpTargetProtocolAddrChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowArpTargetProtocolAddrChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowArpTargetProtocolAddrChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowArpTargetProtocolAddrChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowArpTargetProtocolAddrChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowArpTargetProtocolAddr") + } + } else { + intVal := otg.PatternFlowArpTargetProtocolAddr_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowArpTargetProtocolAddr_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_arp_target_protocol_addr_counter.go b/gosnappi/pattern_flow_arp_target_protocol_addr_counter.go new file mode 100644 index 00000000..23092092 --- /dev/null +++ b/gosnappi/pattern_flow_arp_target_protocol_addr_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowArpTargetProtocolAddrCounter ***** +type patternFlowArpTargetProtocolAddrCounter struct { + validation + obj *otg.PatternFlowArpTargetProtocolAddrCounter + marshaller marshalPatternFlowArpTargetProtocolAddrCounter + unMarshaller unMarshalPatternFlowArpTargetProtocolAddrCounter +} + +func NewPatternFlowArpTargetProtocolAddrCounter() PatternFlowArpTargetProtocolAddrCounter { + obj := patternFlowArpTargetProtocolAddrCounter{obj: &otg.PatternFlowArpTargetProtocolAddrCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpTargetProtocolAddrCounter) msg() *otg.PatternFlowArpTargetProtocolAddrCounter { + return obj.obj +} + +func (obj *patternFlowArpTargetProtocolAddrCounter) setMsg(msg *otg.PatternFlowArpTargetProtocolAddrCounter) PatternFlowArpTargetProtocolAddrCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpTargetProtocolAddrCounter struct { + obj *patternFlowArpTargetProtocolAddrCounter +} + +type marshalPatternFlowArpTargetProtocolAddrCounter interface { + // ToProto marshals PatternFlowArpTargetProtocolAddrCounter to protobuf object *otg.PatternFlowArpTargetProtocolAddrCounter + ToProto() (*otg.PatternFlowArpTargetProtocolAddrCounter, error) + // ToPbText marshals PatternFlowArpTargetProtocolAddrCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpTargetProtocolAddrCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpTargetProtocolAddrCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpTargetProtocolAddrCounter struct { + obj *patternFlowArpTargetProtocolAddrCounter +} + +type unMarshalPatternFlowArpTargetProtocolAddrCounter interface { + // FromProto unmarshals PatternFlowArpTargetProtocolAddrCounter from protobuf object *otg.PatternFlowArpTargetProtocolAddrCounter + FromProto(msg *otg.PatternFlowArpTargetProtocolAddrCounter) (PatternFlowArpTargetProtocolAddrCounter, error) + // FromPbText unmarshals PatternFlowArpTargetProtocolAddrCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpTargetProtocolAddrCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpTargetProtocolAddrCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpTargetProtocolAddrCounter) Marshal() marshalPatternFlowArpTargetProtocolAddrCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpTargetProtocolAddrCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpTargetProtocolAddrCounter) Unmarshal() unMarshalPatternFlowArpTargetProtocolAddrCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpTargetProtocolAddrCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpTargetProtocolAddrCounter) ToProto() (*otg.PatternFlowArpTargetProtocolAddrCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpTargetProtocolAddrCounter) FromProto(msg *otg.PatternFlowArpTargetProtocolAddrCounter) (PatternFlowArpTargetProtocolAddrCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpTargetProtocolAddrCounter) 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 *unMarshalpatternFlowArpTargetProtocolAddrCounter) 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 *marshalpatternFlowArpTargetProtocolAddrCounter) 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 *unMarshalpatternFlowArpTargetProtocolAddrCounter) 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 *marshalpatternFlowArpTargetProtocolAddrCounter) 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 *unMarshalpatternFlowArpTargetProtocolAddrCounter) 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 *patternFlowArpTargetProtocolAddrCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpTargetProtocolAddrCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpTargetProtocolAddrCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpTargetProtocolAddrCounter) Clone() (PatternFlowArpTargetProtocolAddrCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpTargetProtocolAddrCounter() + 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 +} + +// PatternFlowArpTargetProtocolAddrCounter is ipv4 counter pattern +type PatternFlowArpTargetProtocolAddrCounter interface { + Validation + // msg marshals PatternFlowArpTargetProtocolAddrCounter to protobuf object *otg.PatternFlowArpTargetProtocolAddrCounter + // and doesn't set defaults + msg() *otg.PatternFlowArpTargetProtocolAddrCounter + // setMsg unmarshals PatternFlowArpTargetProtocolAddrCounter from protobuf object *otg.PatternFlowArpTargetProtocolAddrCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowArpTargetProtocolAddrCounter) PatternFlowArpTargetProtocolAddrCounter + // provides marshal interface + Marshal() marshalPatternFlowArpTargetProtocolAddrCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpTargetProtocolAddrCounter + // validate validates PatternFlowArpTargetProtocolAddrCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpTargetProtocolAddrCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowArpTargetProtocolAddrCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowArpTargetProtocolAddrCounter + SetStart(value string) PatternFlowArpTargetProtocolAddrCounter + // HasStart checks if Start has been set in PatternFlowArpTargetProtocolAddrCounter + HasStart() bool + // Step returns string, set in PatternFlowArpTargetProtocolAddrCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowArpTargetProtocolAddrCounter + SetStep(value string) PatternFlowArpTargetProtocolAddrCounter + // HasStep checks if Step has been set in PatternFlowArpTargetProtocolAddrCounter + HasStep() bool + // Count returns uint32, set in PatternFlowArpTargetProtocolAddrCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowArpTargetProtocolAddrCounter + SetCount(value uint32) PatternFlowArpTargetProtocolAddrCounter + // HasCount checks if Count has been set in PatternFlowArpTargetProtocolAddrCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowArpTargetProtocolAddrCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowArpTargetProtocolAddrCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowArpTargetProtocolAddrCounter object +func (obj *patternFlowArpTargetProtocolAddrCounter) SetStart(value string) PatternFlowArpTargetProtocolAddrCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowArpTargetProtocolAddrCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowArpTargetProtocolAddrCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowArpTargetProtocolAddrCounter object +func (obj *patternFlowArpTargetProtocolAddrCounter) SetStep(value string) PatternFlowArpTargetProtocolAddrCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpTargetProtocolAddrCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowArpTargetProtocolAddrCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowArpTargetProtocolAddrCounter object +func (obj *patternFlowArpTargetProtocolAddrCounter) SetCount(value uint32) PatternFlowArpTargetProtocolAddrCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowArpTargetProtocolAddrCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateIpv4(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetProtocolAddrCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateIpv4(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowArpTargetProtocolAddrCounter.Step")) + } + + } + +} + +func (obj *patternFlowArpTargetProtocolAddrCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("0.0.0.0") + } + if obj.obj.Step == nil { + obj.SetStep("0.0.0.1") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_arp_target_protocol_addr_metric_tag.go b/gosnappi/pattern_flow_arp_target_protocol_addr_metric_tag.go new file mode 100644 index 00000000..42a4d54d --- /dev/null +++ b/gosnappi/pattern_flow_arp_target_protocol_addr_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowArpTargetProtocolAddrMetricTag ***** +type patternFlowArpTargetProtocolAddrMetricTag struct { + validation + obj *otg.PatternFlowArpTargetProtocolAddrMetricTag + marshaller marshalPatternFlowArpTargetProtocolAddrMetricTag + unMarshaller unMarshalPatternFlowArpTargetProtocolAddrMetricTag +} + +func NewPatternFlowArpTargetProtocolAddrMetricTag() PatternFlowArpTargetProtocolAddrMetricTag { + obj := patternFlowArpTargetProtocolAddrMetricTag{obj: &otg.PatternFlowArpTargetProtocolAddrMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowArpTargetProtocolAddrMetricTag) msg() *otg.PatternFlowArpTargetProtocolAddrMetricTag { + return obj.obj +} + +func (obj *patternFlowArpTargetProtocolAddrMetricTag) setMsg(msg *otg.PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowArpTargetProtocolAddrMetricTag struct { + obj *patternFlowArpTargetProtocolAddrMetricTag +} + +type marshalPatternFlowArpTargetProtocolAddrMetricTag interface { + // ToProto marshals PatternFlowArpTargetProtocolAddrMetricTag to protobuf object *otg.PatternFlowArpTargetProtocolAddrMetricTag + ToProto() (*otg.PatternFlowArpTargetProtocolAddrMetricTag, error) + // ToPbText marshals PatternFlowArpTargetProtocolAddrMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowArpTargetProtocolAddrMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowArpTargetProtocolAddrMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowArpTargetProtocolAddrMetricTag struct { + obj *patternFlowArpTargetProtocolAddrMetricTag +} + +type unMarshalPatternFlowArpTargetProtocolAddrMetricTag interface { + // FromProto unmarshals PatternFlowArpTargetProtocolAddrMetricTag from protobuf object *otg.PatternFlowArpTargetProtocolAddrMetricTag + FromProto(msg *otg.PatternFlowArpTargetProtocolAddrMetricTag) (PatternFlowArpTargetProtocolAddrMetricTag, error) + // FromPbText unmarshals PatternFlowArpTargetProtocolAddrMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowArpTargetProtocolAddrMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowArpTargetProtocolAddrMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowArpTargetProtocolAddrMetricTag) Marshal() marshalPatternFlowArpTargetProtocolAddrMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowArpTargetProtocolAddrMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowArpTargetProtocolAddrMetricTag) Unmarshal() unMarshalPatternFlowArpTargetProtocolAddrMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowArpTargetProtocolAddrMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowArpTargetProtocolAddrMetricTag) ToProto() (*otg.PatternFlowArpTargetProtocolAddrMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowArpTargetProtocolAddrMetricTag) FromProto(msg *otg.PatternFlowArpTargetProtocolAddrMetricTag) (PatternFlowArpTargetProtocolAddrMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowArpTargetProtocolAddrMetricTag) 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 *unMarshalpatternFlowArpTargetProtocolAddrMetricTag) 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 *marshalpatternFlowArpTargetProtocolAddrMetricTag) 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 *unMarshalpatternFlowArpTargetProtocolAddrMetricTag) 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 *marshalpatternFlowArpTargetProtocolAddrMetricTag) 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 *unMarshalpatternFlowArpTargetProtocolAddrMetricTag) 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 *patternFlowArpTargetProtocolAddrMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowArpTargetProtocolAddrMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowArpTargetProtocolAddrMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowArpTargetProtocolAddrMetricTag) Clone() (PatternFlowArpTargetProtocolAddrMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowArpTargetProtocolAddrMetricTag() + 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 +} + +// PatternFlowArpTargetProtocolAddrMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowArpTargetProtocolAddrMetricTag interface { + Validation + // msg marshals PatternFlowArpTargetProtocolAddrMetricTag to protobuf object *otg.PatternFlowArpTargetProtocolAddrMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowArpTargetProtocolAddrMetricTag + // setMsg unmarshals PatternFlowArpTargetProtocolAddrMetricTag from protobuf object *otg.PatternFlowArpTargetProtocolAddrMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowArpTargetProtocolAddrMetricTag) PatternFlowArpTargetProtocolAddrMetricTag + // provides marshal interface + Marshal() marshalPatternFlowArpTargetProtocolAddrMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowArpTargetProtocolAddrMetricTag + // validate validates PatternFlowArpTargetProtocolAddrMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowArpTargetProtocolAddrMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowArpTargetProtocolAddrMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowArpTargetProtocolAddrMetricTag + SetName(value string) PatternFlowArpTargetProtocolAddrMetricTag + // Offset returns uint32, set in PatternFlowArpTargetProtocolAddrMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowArpTargetProtocolAddrMetricTag + SetOffset(value uint32) PatternFlowArpTargetProtocolAddrMetricTag + // HasOffset checks if Offset has been set in PatternFlowArpTargetProtocolAddrMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowArpTargetProtocolAddrMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowArpTargetProtocolAddrMetricTag + SetLength(value uint32) PatternFlowArpTargetProtocolAddrMetricTag + // HasLength checks if Length has been set in PatternFlowArpTargetProtocolAddrMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowArpTargetProtocolAddrMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowArpTargetProtocolAddrMetricTag object +func (obj *patternFlowArpTargetProtocolAddrMetricTag) SetName(value string) PatternFlowArpTargetProtocolAddrMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpTargetProtocolAddrMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowArpTargetProtocolAddrMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowArpTargetProtocolAddrMetricTag object +func (obj *patternFlowArpTargetProtocolAddrMetricTag) SetOffset(value uint32) PatternFlowArpTargetProtocolAddrMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpTargetProtocolAddrMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowArpTargetProtocolAddrMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowArpTargetProtocolAddrMetricTag object +func (obj *patternFlowArpTargetProtocolAddrMetricTag) SetLength(value uint32) PatternFlowArpTargetProtocolAddrMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowArpTargetProtocolAddrMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowArpTargetProtocolAddrMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowArpTargetProtocolAddrMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowArpTargetProtocolAddrMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowArpTargetProtocolAddrMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(32) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_dst.go b/gosnappi/pattern_flow_ethernet_dst.go new file mode 100644 index 00000000..095650a4 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_dst.go @@ -0,0 +1,706 @@ +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" +) + +// ***** PatternFlowEthernetDst ***** +type patternFlowEthernetDst struct { + validation + obj *otg.PatternFlowEthernetDst + marshaller marshalPatternFlowEthernetDst + unMarshaller unMarshalPatternFlowEthernetDst + incrementHolder PatternFlowEthernetDstCounter + decrementHolder PatternFlowEthernetDstCounter + metricTagsHolder PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter +} + +func NewPatternFlowEthernetDst() PatternFlowEthernetDst { + obj := patternFlowEthernetDst{obj: &otg.PatternFlowEthernetDst{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetDst) msg() *otg.PatternFlowEthernetDst { + return obj.obj +} + +func (obj *patternFlowEthernetDst) setMsg(msg *otg.PatternFlowEthernetDst) PatternFlowEthernetDst { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetDst struct { + obj *patternFlowEthernetDst +} + +type marshalPatternFlowEthernetDst interface { + // ToProto marshals PatternFlowEthernetDst to protobuf object *otg.PatternFlowEthernetDst + ToProto() (*otg.PatternFlowEthernetDst, error) + // ToPbText marshals PatternFlowEthernetDst to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetDst to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetDst to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetDst struct { + obj *patternFlowEthernetDst +} + +type unMarshalPatternFlowEthernetDst interface { + // FromProto unmarshals PatternFlowEthernetDst from protobuf object *otg.PatternFlowEthernetDst + FromProto(msg *otg.PatternFlowEthernetDst) (PatternFlowEthernetDst, error) + // FromPbText unmarshals PatternFlowEthernetDst from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetDst from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetDst from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetDst) Marshal() marshalPatternFlowEthernetDst { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetDst{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetDst) Unmarshal() unMarshalPatternFlowEthernetDst { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetDst{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetDst) ToProto() (*otg.PatternFlowEthernetDst, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetDst) FromProto(msg *otg.PatternFlowEthernetDst) (PatternFlowEthernetDst, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetDst) 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 *unMarshalpatternFlowEthernetDst) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowEthernetDst) 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 *unMarshalpatternFlowEthernetDst) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowEthernetDst) 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 *unMarshalpatternFlowEthernetDst) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowEthernetDst) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetDst) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetDst) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetDst) Clone() (PatternFlowEthernetDst, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetDst() + 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 +} + +func (obj *patternFlowEthernetDst) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowEthernetDst is destination MAC address +type PatternFlowEthernetDst interface { + Validation + // msg marshals PatternFlowEthernetDst to protobuf object *otg.PatternFlowEthernetDst + // and doesn't set defaults + msg() *otg.PatternFlowEthernetDst + // setMsg unmarshals PatternFlowEthernetDst from protobuf object *otg.PatternFlowEthernetDst + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetDst) PatternFlowEthernetDst + // provides marshal interface + Marshal() marshalPatternFlowEthernetDst + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetDst + // validate validates PatternFlowEthernetDst + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetDst, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowEthernetDstChoiceEnum, set in PatternFlowEthernetDst + Choice() PatternFlowEthernetDstChoiceEnum + // setChoice assigns PatternFlowEthernetDstChoiceEnum provided by user to PatternFlowEthernetDst + setChoice(value PatternFlowEthernetDstChoiceEnum) PatternFlowEthernetDst + // HasChoice checks if Choice has been set in PatternFlowEthernetDst + HasChoice() bool + // Value returns string, set in PatternFlowEthernetDst. + Value() string + // SetValue assigns string provided by user to PatternFlowEthernetDst + SetValue(value string) PatternFlowEthernetDst + // HasValue checks if Value has been set in PatternFlowEthernetDst + HasValue() bool + // Values returns []string, set in PatternFlowEthernetDst. + Values() []string + // SetValues assigns []string provided by user to PatternFlowEthernetDst + SetValues(value []string) PatternFlowEthernetDst + // Auto returns string, set in PatternFlowEthernetDst. + Auto() string + // HasAuto checks if Auto has been set in PatternFlowEthernetDst + HasAuto() bool + // Increment returns PatternFlowEthernetDstCounter, set in PatternFlowEthernetDst. + // PatternFlowEthernetDstCounter is mac counter pattern + Increment() PatternFlowEthernetDstCounter + // SetIncrement assigns PatternFlowEthernetDstCounter provided by user to PatternFlowEthernetDst. + // PatternFlowEthernetDstCounter is mac counter pattern + SetIncrement(value PatternFlowEthernetDstCounter) PatternFlowEthernetDst + // HasIncrement checks if Increment has been set in PatternFlowEthernetDst + HasIncrement() bool + // Decrement returns PatternFlowEthernetDstCounter, set in PatternFlowEthernetDst. + // PatternFlowEthernetDstCounter is mac counter pattern + Decrement() PatternFlowEthernetDstCounter + // SetDecrement assigns PatternFlowEthernetDstCounter provided by user to PatternFlowEthernetDst. + // PatternFlowEthernetDstCounter is mac counter pattern + SetDecrement(value PatternFlowEthernetDstCounter) PatternFlowEthernetDst + // HasDecrement checks if Decrement has been set in PatternFlowEthernetDst + HasDecrement() bool + // MetricTags returns PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIterIter, set in PatternFlowEthernetDst + MetricTags() PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter + setNil() +} + +type PatternFlowEthernetDstChoiceEnum string + +// Enum of Choice on PatternFlowEthernetDst +var PatternFlowEthernetDstChoice = struct { + VALUE PatternFlowEthernetDstChoiceEnum + VALUES PatternFlowEthernetDstChoiceEnum + AUTO PatternFlowEthernetDstChoiceEnum + INCREMENT PatternFlowEthernetDstChoiceEnum + DECREMENT PatternFlowEthernetDstChoiceEnum +}{ + VALUE: PatternFlowEthernetDstChoiceEnum("value"), + VALUES: PatternFlowEthernetDstChoiceEnum("values"), + AUTO: PatternFlowEthernetDstChoiceEnum("auto"), + INCREMENT: PatternFlowEthernetDstChoiceEnum("increment"), + DECREMENT: PatternFlowEthernetDstChoiceEnum("decrement"), +} + +func (obj *patternFlowEthernetDst) Choice() PatternFlowEthernetDstChoiceEnum { + return PatternFlowEthernetDstChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowEthernetDst) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowEthernetDst) setChoice(value PatternFlowEthernetDstChoiceEnum) PatternFlowEthernetDst { + intValue, ok := otg.PatternFlowEthernetDst_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowEthernetDstChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowEthernetDst_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Auto = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowEthernetDstChoice.VALUE { + defaultValue := "00:00:00:00:00:00" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowEthernetDstChoice.VALUES { + defaultValue := []string{"00:00:00:00:00:00"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowEthernetDstChoice.AUTO { + defaultValue := "00:00:00:00:00:00" + obj.obj.Auto = &defaultValue + } + + if value == PatternFlowEthernetDstChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowEthernetDstCounter().msg() + } + + if value == PatternFlowEthernetDstChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowEthernetDstCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowEthernetDst) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowEthernetDstChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowEthernetDst) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowEthernetDst object +func (obj *patternFlowEthernetDst) SetValue(value string) PatternFlowEthernetDst { + obj.setChoice(PatternFlowEthernetDstChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowEthernetDst) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"00:00:00:00:00:00"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowEthernetDst object +func (obj *patternFlowEthernetDst) SetValues(value []string) PatternFlowEthernetDst { + obj.setChoice(PatternFlowEthernetDstChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a string +func (obj *patternFlowEthernetDst) Auto() string { + + if obj.obj.Auto == nil { + obj.setChoice(PatternFlowEthernetDstChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a string +func (obj *patternFlowEthernetDst) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Increment returns a PatternFlowEthernetDstCounter +func (obj *patternFlowEthernetDst) Increment() PatternFlowEthernetDstCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowEthernetDstChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowEthernetDstCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowEthernetDstCounter +func (obj *patternFlowEthernetDst) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowEthernetDstCounter value in the PatternFlowEthernetDst object +func (obj *patternFlowEthernetDst) SetIncrement(value PatternFlowEthernetDstCounter) PatternFlowEthernetDst { + obj.setChoice(PatternFlowEthernetDstChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowEthernetDstCounter +func (obj *patternFlowEthernetDst) Decrement() PatternFlowEthernetDstCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowEthernetDstChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowEthernetDstCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowEthernetDstCounter +func (obj *patternFlowEthernetDst) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowEthernetDstCounter value in the PatternFlowEthernetDst object +func (obj *patternFlowEthernetDst) SetDecrement(value PatternFlowEthernetDstCounter) PatternFlowEthernetDst { + obj.setChoice(PatternFlowEthernetDstChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowEthernetDstMetricTag +func (obj *patternFlowEthernetDst) MetricTags() PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowEthernetDstMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter struct { + obj *patternFlowEthernetDst + patternFlowEthernetDstMetricTagSlice []PatternFlowEthernetDstMetricTag + fieldPtr *[]*otg.PatternFlowEthernetDstMetricTag +} + +func newPatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter(ptr *[]*otg.PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { + return &patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter interface { + setMsg(*patternFlowEthernetDst) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter + Items() []PatternFlowEthernetDstMetricTag + Add() PatternFlowEthernetDstMetricTag + Append(items ...PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter + Set(index int, newObj PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter + Clear() PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter + clearHolderSlice() PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter + appendHolderSlice(item PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter +} + +func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) setMsg(msg *patternFlowEthernetDst) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowEthernetDstMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) Items() []PatternFlowEthernetDstMetricTag { + return obj.patternFlowEthernetDstMetricTagSlice +} + +func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) Add() PatternFlowEthernetDstMetricTag { + newObj := &otg.PatternFlowEthernetDstMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowEthernetDstMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowEthernetDstMetricTagSlice = append(obj.patternFlowEthernetDstMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) Append(items ...PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowEthernetDstMetricTagSlice = append(obj.patternFlowEthernetDstMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) Set(index int, newObj PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowEthernetDstMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) Clear() PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowEthernetDstMetricTag{} + obj.patternFlowEthernetDstMetricTagSlice = []PatternFlowEthernetDstMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) clearHolderSlice() PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { + if len(obj.patternFlowEthernetDstMetricTagSlice) > 0 { + obj.patternFlowEthernetDstMetricTagSlice = []PatternFlowEthernetDstMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetDstPatternFlowEthernetDstMetricTagIter) appendHolderSlice(item PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstPatternFlowEthernetDstMetricTagIter { + obj.patternFlowEthernetDstMetricTagSlice = append(obj.patternFlowEthernetDstMetricTagSlice, item) + return obj +} + +func (obj *patternFlowEthernetDst) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateMac(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetDst.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateMacSlice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetDst.Values")) + } + + } + + if obj.obj.Auto != nil { + + err := obj.validateMac(obj.Auto()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetDst.Auto")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowEthernetDstMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowEthernetDst) setDefault() { + var choices_set int = 0 + var choice PatternFlowEthernetDstChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowEthernetDstChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowEthernetDstChoice.VALUES + } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowEthernetDstChoice.AUTO + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowEthernetDstChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowEthernetDstChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowEthernetDstChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetDst") + } + } else { + intVal := otg.PatternFlowEthernetDst_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowEthernetDst_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ethernet_dst_counter.go b/gosnappi/pattern_flow_ethernet_dst_counter.go new file mode 100644 index 00000000..25bdb540 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_dst_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowEthernetDstCounter ***** +type patternFlowEthernetDstCounter struct { + validation + obj *otg.PatternFlowEthernetDstCounter + marshaller marshalPatternFlowEthernetDstCounter + unMarshaller unMarshalPatternFlowEthernetDstCounter +} + +func NewPatternFlowEthernetDstCounter() PatternFlowEthernetDstCounter { + obj := patternFlowEthernetDstCounter{obj: &otg.PatternFlowEthernetDstCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetDstCounter) msg() *otg.PatternFlowEthernetDstCounter { + return obj.obj +} + +func (obj *patternFlowEthernetDstCounter) setMsg(msg *otg.PatternFlowEthernetDstCounter) PatternFlowEthernetDstCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetDstCounter struct { + obj *patternFlowEthernetDstCounter +} + +type marshalPatternFlowEthernetDstCounter interface { + // ToProto marshals PatternFlowEthernetDstCounter to protobuf object *otg.PatternFlowEthernetDstCounter + ToProto() (*otg.PatternFlowEthernetDstCounter, error) + // ToPbText marshals PatternFlowEthernetDstCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetDstCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetDstCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetDstCounter struct { + obj *patternFlowEthernetDstCounter +} + +type unMarshalPatternFlowEthernetDstCounter interface { + // FromProto unmarshals PatternFlowEthernetDstCounter from protobuf object *otg.PatternFlowEthernetDstCounter + FromProto(msg *otg.PatternFlowEthernetDstCounter) (PatternFlowEthernetDstCounter, error) + // FromPbText unmarshals PatternFlowEthernetDstCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetDstCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetDstCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetDstCounter) Marshal() marshalPatternFlowEthernetDstCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetDstCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetDstCounter) Unmarshal() unMarshalPatternFlowEthernetDstCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetDstCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetDstCounter) ToProto() (*otg.PatternFlowEthernetDstCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetDstCounter) FromProto(msg *otg.PatternFlowEthernetDstCounter) (PatternFlowEthernetDstCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetDstCounter) 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 *unMarshalpatternFlowEthernetDstCounter) 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 *marshalpatternFlowEthernetDstCounter) 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 *unMarshalpatternFlowEthernetDstCounter) 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 *marshalpatternFlowEthernetDstCounter) 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 *unMarshalpatternFlowEthernetDstCounter) 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 *patternFlowEthernetDstCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetDstCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetDstCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetDstCounter) Clone() (PatternFlowEthernetDstCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetDstCounter() + 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 +} + +// PatternFlowEthernetDstCounter is mac counter pattern +type PatternFlowEthernetDstCounter interface { + Validation + // msg marshals PatternFlowEthernetDstCounter to protobuf object *otg.PatternFlowEthernetDstCounter + // and doesn't set defaults + msg() *otg.PatternFlowEthernetDstCounter + // setMsg unmarshals PatternFlowEthernetDstCounter from protobuf object *otg.PatternFlowEthernetDstCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetDstCounter) PatternFlowEthernetDstCounter + // provides marshal interface + Marshal() marshalPatternFlowEthernetDstCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetDstCounter + // validate validates PatternFlowEthernetDstCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetDstCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowEthernetDstCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowEthernetDstCounter + SetStart(value string) PatternFlowEthernetDstCounter + // HasStart checks if Start has been set in PatternFlowEthernetDstCounter + HasStart() bool + // Step returns string, set in PatternFlowEthernetDstCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowEthernetDstCounter + SetStep(value string) PatternFlowEthernetDstCounter + // HasStep checks if Step has been set in PatternFlowEthernetDstCounter + HasStep() bool + // Count returns uint32, set in PatternFlowEthernetDstCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowEthernetDstCounter + SetCount(value uint32) PatternFlowEthernetDstCounter + // HasCount checks if Count has been set in PatternFlowEthernetDstCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowEthernetDstCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowEthernetDstCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowEthernetDstCounter object +func (obj *patternFlowEthernetDstCounter) SetStart(value string) PatternFlowEthernetDstCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowEthernetDstCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowEthernetDstCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowEthernetDstCounter object +func (obj *patternFlowEthernetDstCounter) SetStep(value string) PatternFlowEthernetDstCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetDstCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetDstCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowEthernetDstCounter object +func (obj *patternFlowEthernetDstCounter) SetCount(value uint32) PatternFlowEthernetDstCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowEthernetDstCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateMac(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetDstCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateMac(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetDstCounter.Step")) + } + + } + +} + +func (obj *patternFlowEthernetDstCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("00:00:00:00:00:00") + } + if obj.obj.Step == nil { + obj.SetStep("00:00:00:00:00:01") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_dst_metric_tag.go b/gosnappi/pattern_flow_ethernet_dst_metric_tag.go new file mode 100644 index 00000000..16c0d64b --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_dst_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowEthernetDstMetricTag ***** +type patternFlowEthernetDstMetricTag struct { + validation + obj *otg.PatternFlowEthernetDstMetricTag + marshaller marshalPatternFlowEthernetDstMetricTag + unMarshaller unMarshalPatternFlowEthernetDstMetricTag +} + +func NewPatternFlowEthernetDstMetricTag() PatternFlowEthernetDstMetricTag { + obj := patternFlowEthernetDstMetricTag{obj: &otg.PatternFlowEthernetDstMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetDstMetricTag) msg() *otg.PatternFlowEthernetDstMetricTag { + return obj.obj +} + +func (obj *patternFlowEthernetDstMetricTag) setMsg(msg *otg.PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetDstMetricTag struct { + obj *patternFlowEthernetDstMetricTag +} + +type marshalPatternFlowEthernetDstMetricTag interface { + // ToProto marshals PatternFlowEthernetDstMetricTag to protobuf object *otg.PatternFlowEthernetDstMetricTag + ToProto() (*otg.PatternFlowEthernetDstMetricTag, error) + // ToPbText marshals PatternFlowEthernetDstMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetDstMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetDstMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetDstMetricTag struct { + obj *patternFlowEthernetDstMetricTag +} + +type unMarshalPatternFlowEthernetDstMetricTag interface { + // FromProto unmarshals PatternFlowEthernetDstMetricTag from protobuf object *otg.PatternFlowEthernetDstMetricTag + FromProto(msg *otg.PatternFlowEthernetDstMetricTag) (PatternFlowEthernetDstMetricTag, error) + // FromPbText unmarshals PatternFlowEthernetDstMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetDstMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetDstMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetDstMetricTag) Marshal() marshalPatternFlowEthernetDstMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetDstMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetDstMetricTag) Unmarshal() unMarshalPatternFlowEthernetDstMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetDstMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetDstMetricTag) ToProto() (*otg.PatternFlowEthernetDstMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetDstMetricTag) FromProto(msg *otg.PatternFlowEthernetDstMetricTag) (PatternFlowEthernetDstMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetDstMetricTag) 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 *unMarshalpatternFlowEthernetDstMetricTag) 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 *marshalpatternFlowEthernetDstMetricTag) 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 *unMarshalpatternFlowEthernetDstMetricTag) 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 *marshalpatternFlowEthernetDstMetricTag) 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 *unMarshalpatternFlowEthernetDstMetricTag) 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 *patternFlowEthernetDstMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetDstMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetDstMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetDstMetricTag) Clone() (PatternFlowEthernetDstMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetDstMetricTag() + 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 +} + +// PatternFlowEthernetDstMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowEthernetDstMetricTag interface { + Validation + // msg marshals PatternFlowEthernetDstMetricTag to protobuf object *otg.PatternFlowEthernetDstMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowEthernetDstMetricTag + // setMsg unmarshals PatternFlowEthernetDstMetricTag from protobuf object *otg.PatternFlowEthernetDstMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetDstMetricTag) PatternFlowEthernetDstMetricTag + // provides marshal interface + Marshal() marshalPatternFlowEthernetDstMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetDstMetricTag + // validate validates PatternFlowEthernetDstMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetDstMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowEthernetDstMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowEthernetDstMetricTag + SetName(value string) PatternFlowEthernetDstMetricTag + // Offset returns uint32, set in PatternFlowEthernetDstMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowEthernetDstMetricTag + SetOffset(value uint32) PatternFlowEthernetDstMetricTag + // HasOffset checks if Offset has been set in PatternFlowEthernetDstMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowEthernetDstMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowEthernetDstMetricTag + SetLength(value uint32) PatternFlowEthernetDstMetricTag + // HasLength checks if Length has been set in PatternFlowEthernetDstMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowEthernetDstMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowEthernetDstMetricTag object +func (obj *patternFlowEthernetDstMetricTag) SetName(value string) PatternFlowEthernetDstMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetDstMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetDstMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowEthernetDstMetricTag object +func (obj *patternFlowEthernetDstMetricTag) SetOffset(value uint32) PatternFlowEthernetDstMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetDstMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetDstMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowEthernetDstMetricTag object +func (obj *patternFlowEthernetDstMetricTag) SetLength(value uint32) PatternFlowEthernetDstMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowEthernetDstMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetDstMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 47 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetDstMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 48 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowEthernetDstMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowEthernetDstMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(48) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_ether_type.go b/gosnappi/pattern_flow_ethernet_ether_type.go new file mode 100644 index 00000000..c2ef6f07 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_ether_type.go @@ -0,0 +1,712 @@ +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" +) + +// ***** PatternFlowEthernetEtherType ***** +type patternFlowEthernetEtherType struct { + validation + obj *otg.PatternFlowEthernetEtherType + marshaller marshalPatternFlowEthernetEtherType + unMarshaller unMarshalPatternFlowEthernetEtherType + incrementHolder PatternFlowEthernetEtherTypeCounter + decrementHolder PatternFlowEthernetEtherTypeCounter + metricTagsHolder PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter +} + +func NewPatternFlowEthernetEtherType() PatternFlowEthernetEtherType { + obj := patternFlowEthernetEtherType{obj: &otg.PatternFlowEthernetEtherType{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetEtherType) msg() *otg.PatternFlowEthernetEtherType { + return obj.obj +} + +func (obj *patternFlowEthernetEtherType) setMsg(msg *otg.PatternFlowEthernetEtherType) PatternFlowEthernetEtherType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetEtherType struct { + obj *patternFlowEthernetEtherType +} + +type marshalPatternFlowEthernetEtherType interface { + // ToProto marshals PatternFlowEthernetEtherType to protobuf object *otg.PatternFlowEthernetEtherType + ToProto() (*otg.PatternFlowEthernetEtherType, error) + // ToPbText marshals PatternFlowEthernetEtherType to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetEtherType to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetEtherType to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetEtherType struct { + obj *patternFlowEthernetEtherType +} + +type unMarshalPatternFlowEthernetEtherType interface { + // FromProto unmarshals PatternFlowEthernetEtherType from protobuf object *otg.PatternFlowEthernetEtherType + FromProto(msg *otg.PatternFlowEthernetEtherType) (PatternFlowEthernetEtherType, error) + // FromPbText unmarshals PatternFlowEthernetEtherType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetEtherType from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetEtherType from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetEtherType) Marshal() marshalPatternFlowEthernetEtherType { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetEtherType{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetEtherType) Unmarshal() unMarshalPatternFlowEthernetEtherType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetEtherType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetEtherType) ToProto() (*otg.PatternFlowEthernetEtherType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetEtherType) FromProto(msg *otg.PatternFlowEthernetEtherType) (PatternFlowEthernetEtherType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetEtherType) 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 *unMarshalpatternFlowEthernetEtherType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowEthernetEtherType) 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 *unMarshalpatternFlowEthernetEtherType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowEthernetEtherType) 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 *unMarshalpatternFlowEthernetEtherType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowEthernetEtherType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetEtherType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetEtherType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetEtherType) Clone() (PatternFlowEthernetEtherType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetEtherType() + 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 +} + +func (obj *patternFlowEthernetEtherType) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowEthernetEtherType is ethernet type +type PatternFlowEthernetEtherType interface { + Validation + // msg marshals PatternFlowEthernetEtherType to protobuf object *otg.PatternFlowEthernetEtherType + // and doesn't set defaults + msg() *otg.PatternFlowEthernetEtherType + // setMsg unmarshals PatternFlowEthernetEtherType from protobuf object *otg.PatternFlowEthernetEtherType + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetEtherType) PatternFlowEthernetEtherType + // provides marshal interface + Marshal() marshalPatternFlowEthernetEtherType + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetEtherType + // validate validates PatternFlowEthernetEtherType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetEtherType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowEthernetEtherTypeChoiceEnum, set in PatternFlowEthernetEtherType + Choice() PatternFlowEthernetEtherTypeChoiceEnum + // setChoice assigns PatternFlowEthernetEtherTypeChoiceEnum provided by user to PatternFlowEthernetEtherType + setChoice(value PatternFlowEthernetEtherTypeChoiceEnum) PatternFlowEthernetEtherType + // HasChoice checks if Choice has been set in PatternFlowEthernetEtherType + HasChoice() bool + // Value returns uint32, set in PatternFlowEthernetEtherType. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowEthernetEtherType + SetValue(value uint32) PatternFlowEthernetEtherType + // HasValue checks if Value has been set in PatternFlowEthernetEtherType + HasValue() bool + // Values returns []uint32, set in PatternFlowEthernetEtherType. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowEthernetEtherType + SetValues(value []uint32) PatternFlowEthernetEtherType + // Auto returns uint32, set in PatternFlowEthernetEtherType. + Auto() uint32 + // HasAuto checks if Auto has been set in PatternFlowEthernetEtherType + HasAuto() bool + // Increment returns PatternFlowEthernetEtherTypeCounter, set in PatternFlowEthernetEtherType. + // PatternFlowEthernetEtherTypeCounter is integer counter pattern + Increment() PatternFlowEthernetEtherTypeCounter + // SetIncrement assigns PatternFlowEthernetEtherTypeCounter provided by user to PatternFlowEthernetEtherType. + // PatternFlowEthernetEtherTypeCounter is integer counter pattern + SetIncrement(value PatternFlowEthernetEtherTypeCounter) PatternFlowEthernetEtherType + // HasIncrement checks if Increment has been set in PatternFlowEthernetEtherType + HasIncrement() bool + // Decrement returns PatternFlowEthernetEtherTypeCounter, set in PatternFlowEthernetEtherType. + // PatternFlowEthernetEtherTypeCounter is integer counter pattern + Decrement() PatternFlowEthernetEtherTypeCounter + // SetDecrement assigns PatternFlowEthernetEtherTypeCounter provided by user to PatternFlowEthernetEtherType. + // PatternFlowEthernetEtherTypeCounter is integer counter pattern + SetDecrement(value PatternFlowEthernetEtherTypeCounter) PatternFlowEthernetEtherType + // HasDecrement checks if Decrement has been set in PatternFlowEthernetEtherType + HasDecrement() bool + // MetricTags returns PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIterIter, set in PatternFlowEthernetEtherType + MetricTags() PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter + setNil() +} + +type PatternFlowEthernetEtherTypeChoiceEnum string + +// Enum of Choice on PatternFlowEthernetEtherType +var PatternFlowEthernetEtherTypeChoice = struct { + VALUE PatternFlowEthernetEtherTypeChoiceEnum + VALUES PatternFlowEthernetEtherTypeChoiceEnum + AUTO PatternFlowEthernetEtherTypeChoiceEnum + INCREMENT PatternFlowEthernetEtherTypeChoiceEnum + DECREMENT PatternFlowEthernetEtherTypeChoiceEnum +}{ + VALUE: PatternFlowEthernetEtherTypeChoiceEnum("value"), + VALUES: PatternFlowEthernetEtherTypeChoiceEnum("values"), + AUTO: PatternFlowEthernetEtherTypeChoiceEnum("auto"), + INCREMENT: PatternFlowEthernetEtherTypeChoiceEnum("increment"), + DECREMENT: PatternFlowEthernetEtherTypeChoiceEnum("decrement"), +} + +func (obj *patternFlowEthernetEtherType) Choice() PatternFlowEthernetEtherTypeChoiceEnum { + return PatternFlowEthernetEtherTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowEthernetEtherType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowEthernetEtherType) setChoice(value PatternFlowEthernetEtherTypeChoiceEnum) PatternFlowEthernetEtherType { + intValue, ok := otg.PatternFlowEthernetEtherType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowEthernetEtherTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowEthernetEtherType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Auto = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowEthernetEtherTypeChoice.VALUE { + defaultValue := uint32(65535) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowEthernetEtherTypeChoice.VALUES { + defaultValue := []uint32{65535} + obj.obj.Values = defaultValue + } + + if value == PatternFlowEthernetEtherTypeChoice.AUTO { + defaultValue := uint32(65535) + obj.obj.Auto = &defaultValue + } + + if value == PatternFlowEthernetEtherTypeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowEthernetEtherTypeCounter().msg() + } + + if value == PatternFlowEthernetEtherTypeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowEthernetEtherTypeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowEthernetEtherType) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowEthernetEtherTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowEthernetEtherType) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowEthernetEtherType object +func (obj *patternFlowEthernetEtherType) SetValue(value uint32) PatternFlowEthernetEtherType { + obj.setChoice(PatternFlowEthernetEtherTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowEthernetEtherType) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{65535}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowEthernetEtherType object +func (obj *patternFlowEthernetEtherType) SetValues(value []uint32) PatternFlowEthernetEtherType { + obj.setChoice(PatternFlowEthernetEtherTypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowEthernetEtherType) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(PatternFlowEthernetEtherTypeChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowEthernetEtherType) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Increment returns a PatternFlowEthernetEtherTypeCounter +func (obj *patternFlowEthernetEtherType) Increment() PatternFlowEthernetEtherTypeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowEthernetEtherTypeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowEthernetEtherTypeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowEthernetEtherTypeCounter +func (obj *patternFlowEthernetEtherType) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowEthernetEtherTypeCounter value in the PatternFlowEthernetEtherType object +func (obj *patternFlowEthernetEtherType) SetIncrement(value PatternFlowEthernetEtherTypeCounter) PatternFlowEthernetEtherType { + obj.setChoice(PatternFlowEthernetEtherTypeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowEthernetEtherTypeCounter +func (obj *patternFlowEthernetEtherType) Decrement() PatternFlowEthernetEtherTypeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowEthernetEtherTypeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowEthernetEtherTypeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowEthernetEtherTypeCounter +func (obj *patternFlowEthernetEtherType) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowEthernetEtherTypeCounter value in the PatternFlowEthernetEtherType object +func (obj *patternFlowEthernetEtherType) SetDecrement(value PatternFlowEthernetEtherTypeCounter) PatternFlowEthernetEtherType { + obj.setChoice(PatternFlowEthernetEtherTypeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowEthernetEtherTypeMetricTag +func (obj *patternFlowEthernetEtherType) MetricTags() PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowEthernetEtherTypeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter struct { + obj *patternFlowEthernetEtherType + patternFlowEthernetEtherTypeMetricTagSlice []PatternFlowEthernetEtherTypeMetricTag + fieldPtr *[]*otg.PatternFlowEthernetEtherTypeMetricTag +} + +func newPatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter(ptr *[]*otg.PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { + return &patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter interface { + setMsg(*patternFlowEthernetEtherType) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter + Items() []PatternFlowEthernetEtherTypeMetricTag + Add() PatternFlowEthernetEtherTypeMetricTag + Append(items ...PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter + Set(index int, newObj PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter + Clear() PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter + clearHolderSlice() PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter + appendHolderSlice(item PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter +} + +func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) setMsg(msg *patternFlowEthernetEtherType) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowEthernetEtherTypeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) Items() []PatternFlowEthernetEtherTypeMetricTag { + return obj.patternFlowEthernetEtherTypeMetricTagSlice +} + +func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) Add() PatternFlowEthernetEtherTypeMetricTag { + newObj := &otg.PatternFlowEthernetEtherTypeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowEthernetEtherTypeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowEthernetEtherTypeMetricTagSlice = append(obj.patternFlowEthernetEtherTypeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) Append(items ...PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowEthernetEtherTypeMetricTagSlice = append(obj.patternFlowEthernetEtherTypeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) Set(index int, newObj PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowEthernetEtherTypeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) Clear() PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowEthernetEtherTypeMetricTag{} + obj.patternFlowEthernetEtherTypeMetricTagSlice = []PatternFlowEthernetEtherTypeMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) clearHolderSlice() PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { + if len(obj.patternFlowEthernetEtherTypeMetricTagSlice) > 0 { + obj.patternFlowEthernetEtherTypeMetricTagSlice = []PatternFlowEthernetEtherTypeMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter) appendHolderSlice(item PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypePatternFlowEthernetEtherTypeMetricTagIter { + obj.patternFlowEthernetEtherTypeMetricTagSlice = append(obj.patternFlowEthernetEtherTypeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowEthernetEtherType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetEtherType.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowEthernetEtherType.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Auto != nil { + + if *obj.obj.Auto > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetEtherType.Auto <= 65535 but Got %d", *obj.obj.Auto)) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowEthernetEtherTypeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowEthernetEtherType) setDefault() { + var choices_set int = 0 + var choice PatternFlowEthernetEtherTypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowEthernetEtherTypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowEthernetEtherTypeChoice.VALUES + } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowEthernetEtherTypeChoice.AUTO + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowEthernetEtherTypeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowEthernetEtherTypeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowEthernetEtherTypeChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetEtherType") + } + } else { + intVal := otg.PatternFlowEthernetEtherType_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowEthernetEtherType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ethernet_ether_type_counter.go b/gosnappi/pattern_flow_ethernet_ether_type_counter.go new file mode 100644 index 00000000..4e6efee8 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_ether_type_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowEthernetEtherTypeCounter ***** +type patternFlowEthernetEtherTypeCounter struct { + validation + obj *otg.PatternFlowEthernetEtherTypeCounter + marshaller marshalPatternFlowEthernetEtherTypeCounter + unMarshaller unMarshalPatternFlowEthernetEtherTypeCounter +} + +func NewPatternFlowEthernetEtherTypeCounter() PatternFlowEthernetEtherTypeCounter { + obj := patternFlowEthernetEtherTypeCounter{obj: &otg.PatternFlowEthernetEtherTypeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetEtherTypeCounter) msg() *otg.PatternFlowEthernetEtherTypeCounter { + return obj.obj +} + +func (obj *patternFlowEthernetEtherTypeCounter) setMsg(msg *otg.PatternFlowEthernetEtherTypeCounter) PatternFlowEthernetEtherTypeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetEtherTypeCounter struct { + obj *patternFlowEthernetEtherTypeCounter +} + +type marshalPatternFlowEthernetEtherTypeCounter interface { + // ToProto marshals PatternFlowEthernetEtherTypeCounter to protobuf object *otg.PatternFlowEthernetEtherTypeCounter + ToProto() (*otg.PatternFlowEthernetEtherTypeCounter, error) + // ToPbText marshals PatternFlowEthernetEtherTypeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetEtherTypeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetEtherTypeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetEtherTypeCounter struct { + obj *patternFlowEthernetEtherTypeCounter +} + +type unMarshalPatternFlowEthernetEtherTypeCounter interface { + // FromProto unmarshals PatternFlowEthernetEtherTypeCounter from protobuf object *otg.PatternFlowEthernetEtherTypeCounter + FromProto(msg *otg.PatternFlowEthernetEtherTypeCounter) (PatternFlowEthernetEtherTypeCounter, error) + // FromPbText unmarshals PatternFlowEthernetEtherTypeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetEtherTypeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetEtherTypeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetEtherTypeCounter) Marshal() marshalPatternFlowEthernetEtherTypeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetEtherTypeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetEtherTypeCounter) Unmarshal() unMarshalPatternFlowEthernetEtherTypeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetEtherTypeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetEtherTypeCounter) ToProto() (*otg.PatternFlowEthernetEtherTypeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetEtherTypeCounter) FromProto(msg *otg.PatternFlowEthernetEtherTypeCounter) (PatternFlowEthernetEtherTypeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetEtherTypeCounter) 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 *unMarshalpatternFlowEthernetEtherTypeCounter) 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 *marshalpatternFlowEthernetEtherTypeCounter) 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 *unMarshalpatternFlowEthernetEtherTypeCounter) 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 *marshalpatternFlowEthernetEtherTypeCounter) 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 *unMarshalpatternFlowEthernetEtherTypeCounter) 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 *patternFlowEthernetEtherTypeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetEtherTypeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetEtherTypeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetEtherTypeCounter) Clone() (PatternFlowEthernetEtherTypeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetEtherTypeCounter() + 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 +} + +// PatternFlowEthernetEtherTypeCounter is integer counter pattern +type PatternFlowEthernetEtherTypeCounter interface { + Validation + // msg marshals PatternFlowEthernetEtherTypeCounter to protobuf object *otg.PatternFlowEthernetEtherTypeCounter + // and doesn't set defaults + msg() *otg.PatternFlowEthernetEtherTypeCounter + // setMsg unmarshals PatternFlowEthernetEtherTypeCounter from protobuf object *otg.PatternFlowEthernetEtherTypeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetEtherTypeCounter) PatternFlowEthernetEtherTypeCounter + // provides marshal interface + Marshal() marshalPatternFlowEthernetEtherTypeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetEtherTypeCounter + // validate validates PatternFlowEthernetEtherTypeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetEtherTypeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowEthernetEtherTypeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowEthernetEtherTypeCounter + SetStart(value uint32) PatternFlowEthernetEtherTypeCounter + // HasStart checks if Start has been set in PatternFlowEthernetEtherTypeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowEthernetEtherTypeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowEthernetEtherTypeCounter + SetStep(value uint32) PatternFlowEthernetEtherTypeCounter + // HasStep checks if Step has been set in PatternFlowEthernetEtherTypeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowEthernetEtherTypeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowEthernetEtherTypeCounter + SetCount(value uint32) PatternFlowEthernetEtherTypeCounter + // HasCount checks if Count has been set in PatternFlowEthernetEtherTypeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowEthernetEtherTypeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowEthernetEtherTypeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowEthernetEtherTypeCounter object +func (obj *patternFlowEthernetEtherTypeCounter) SetStart(value uint32) PatternFlowEthernetEtherTypeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowEthernetEtherTypeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowEthernetEtherTypeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowEthernetEtherTypeCounter object +func (obj *patternFlowEthernetEtherTypeCounter) SetStep(value uint32) PatternFlowEthernetEtherTypeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetEtherTypeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetEtherTypeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowEthernetEtherTypeCounter object +func (obj *patternFlowEthernetEtherTypeCounter) SetCount(value uint32) PatternFlowEthernetEtherTypeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowEthernetEtherTypeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetEtherTypeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetEtherTypeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetEtherTypeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowEthernetEtherTypeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(65535) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_ether_type_metric_tag.go b/gosnappi/pattern_flow_ethernet_ether_type_metric_tag.go new file mode 100644 index 00000000..6681c7db --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_ether_type_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowEthernetEtherTypeMetricTag ***** +type patternFlowEthernetEtherTypeMetricTag struct { + validation + obj *otg.PatternFlowEthernetEtherTypeMetricTag + marshaller marshalPatternFlowEthernetEtherTypeMetricTag + unMarshaller unMarshalPatternFlowEthernetEtherTypeMetricTag +} + +func NewPatternFlowEthernetEtherTypeMetricTag() PatternFlowEthernetEtherTypeMetricTag { + obj := patternFlowEthernetEtherTypeMetricTag{obj: &otg.PatternFlowEthernetEtherTypeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetEtherTypeMetricTag) msg() *otg.PatternFlowEthernetEtherTypeMetricTag { + return obj.obj +} + +func (obj *patternFlowEthernetEtherTypeMetricTag) setMsg(msg *otg.PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetEtherTypeMetricTag struct { + obj *patternFlowEthernetEtherTypeMetricTag +} + +type marshalPatternFlowEthernetEtherTypeMetricTag interface { + // ToProto marshals PatternFlowEthernetEtherTypeMetricTag to protobuf object *otg.PatternFlowEthernetEtherTypeMetricTag + ToProto() (*otg.PatternFlowEthernetEtherTypeMetricTag, error) + // ToPbText marshals PatternFlowEthernetEtherTypeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetEtherTypeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetEtherTypeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetEtherTypeMetricTag struct { + obj *patternFlowEthernetEtherTypeMetricTag +} + +type unMarshalPatternFlowEthernetEtherTypeMetricTag interface { + // FromProto unmarshals PatternFlowEthernetEtherTypeMetricTag from protobuf object *otg.PatternFlowEthernetEtherTypeMetricTag + FromProto(msg *otg.PatternFlowEthernetEtherTypeMetricTag) (PatternFlowEthernetEtherTypeMetricTag, error) + // FromPbText unmarshals PatternFlowEthernetEtherTypeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetEtherTypeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetEtherTypeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetEtherTypeMetricTag) Marshal() marshalPatternFlowEthernetEtherTypeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetEtherTypeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetEtherTypeMetricTag) Unmarshal() unMarshalPatternFlowEthernetEtherTypeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetEtherTypeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetEtherTypeMetricTag) ToProto() (*otg.PatternFlowEthernetEtherTypeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetEtherTypeMetricTag) FromProto(msg *otg.PatternFlowEthernetEtherTypeMetricTag) (PatternFlowEthernetEtherTypeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetEtherTypeMetricTag) 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 *unMarshalpatternFlowEthernetEtherTypeMetricTag) 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 *marshalpatternFlowEthernetEtherTypeMetricTag) 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 *unMarshalpatternFlowEthernetEtherTypeMetricTag) 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 *marshalpatternFlowEthernetEtherTypeMetricTag) 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 *unMarshalpatternFlowEthernetEtherTypeMetricTag) 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 *patternFlowEthernetEtherTypeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetEtherTypeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetEtherTypeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetEtherTypeMetricTag) Clone() (PatternFlowEthernetEtherTypeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetEtherTypeMetricTag() + 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 +} + +// PatternFlowEthernetEtherTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowEthernetEtherTypeMetricTag interface { + Validation + // msg marshals PatternFlowEthernetEtherTypeMetricTag to protobuf object *otg.PatternFlowEthernetEtherTypeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowEthernetEtherTypeMetricTag + // setMsg unmarshals PatternFlowEthernetEtherTypeMetricTag from protobuf object *otg.PatternFlowEthernetEtherTypeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetEtherTypeMetricTag) PatternFlowEthernetEtherTypeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowEthernetEtherTypeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetEtherTypeMetricTag + // validate validates PatternFlowEthernetEtherTypeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetEtherTypeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowEthernetEtherTypeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowEthernetEtherTypeMetricTag + SetName(value string) PatternFlowEthernetEtherTypeMetricTag + // Offset returns uint32, set in PatternFlowEthernetEtherTypeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowEthernetEtherTypeMetricTag + SetOffset(value uint32) PatternFlowEthernetEtherTypeMetricTag + // HasOffset checks if Offset has been set in PatternFlowEthernetEtherTypeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowEthernetEtherTypeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowEthernetEtherTypeMetricTag + SetLength(value uint32) PatternFlowEthernetEtherTypeMetricTag + // HasLength checks if Length has been set in PatternFlowEthernetEtherTypeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowEthernetEtherTypeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowEthernetEtherTypeMetricTag object +func (obj *patternFlowEthernetEtherTypeMetricTag) SetName(value string) PatternFlowEthernetEtherTypeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetEtherTypeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetEtherTypeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowEthernetEtherTypeMetricTag object +func (obj *patternFlowEthernetEtherTypeMetricTag) SetOffset(value uint32) PatternFlowEthernetEtherTypeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetEtherTypeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetEtherTypeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowEthernetEtherTypeMetricTag object +func (obj *patternFlowEthernetEtherTypeMetricTag) SetLength(value uint32) PatternFlowEthernetEtherTypeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowEthernetEtherTypeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetEtherTypeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetEtherTypeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowEthernetEtherTypeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowEthernetEtherTypeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_control_op_code.go b/gosnappi/pattern_flow_ethernet_pause_control_op_code.go new file mode 100644 index 00000000..fbc2de1d --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_control_op_code.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowEthernetPauseControlOpCode ***** +type patternFlowEthernetPauseControlOpCode struct { + validation + obj *otg.PatternFlowEthernetPauseControlOpCode + marshaller marshalPatternFlowEthernetPauseControlOpCode + unMarshaller unMarshalPatternFlowEthernetPauseControlOpCode + incrementHolder PatternFlowEthernetPauseControlOpCodeCounter + decrementHolder PatternFlowEthernetPauseControlOpCodeCounter + metricTagsHolder PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter +} + +func NewPatternFlowEthernetPauseControlOpCode() PatternFlowEthernetPauseControlOpCode { + obj := patternFlowEthernetPauseControlOpCode{obj: &otg.PatternFlowEthernetPauseControlOpCode{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseControlOpCode) msg() *otg.PatternFlowEthernetPauseControlOpCode { + return obj.obj +} + +func (obj *patternFlowEthernetPauseControlOpCode) setMsg(msg *otg.PatternFlowEthernetPauseControlOpCode) PatternFlowEthernetPauseControlOpCode { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseControlOpCode struct { + obj *patternFlowEthernetPauseControlOpCode +} + +type marshalPatternFlowEthernetPauseControlOpCode interface { + // ToProto marshals PatternFlowEthernetPauseControlOpCode to protobuf object *otg.PatternFlowEthernetPauseControlOpCode + ToProto() (*otg.PatternFlowEthernetPauseControlOpCode, error) + // ToPbText marshals PatternFlowEthernetPauseControlOpCode to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseControlOpCode to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseControlOpCode to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseControlOpCode struct { + obj *patternFlowEthernetPauseControlOpCode +} + +type unMarshalPatternFlowEthernetPauseControlOpCode interface { + // FromProto unmarshals PatternFlowEthernetPauseControlOpCode from protobuf object *otg.PatternFlowEthernetPauseControlOpCode + FromProto(msg *otg.PatternFlowEthernetPauseControlOpCode) (PatternFlowEthernetPauseControlOpCode, error) + // FromPbText unmarshals PatternFlowEthernetPauseControlOpCode from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseControlOpCode from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseControlOpCode from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseControlOpCode) Marshal() marshalPatternFlowEthernetPauseControlOpCode { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseControlOpCode{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseControlOpCode) Unmarshal() unMarshalPatternFlowEthernetPauseControlOpCode { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseControlOpCode{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseControlOpCode) ToProto() (*otg.PatternFlowEthernetPauseControlOpCode, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseControlOpCode) FromProto(msg *otg.PatternFlowEthernetPauseControlOpCode) (PatternFlowEthernetPauseControlOpCode, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseControlOpCode) 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 *unMarshalpatternFlowEthernetPauseControlOpCode) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowEthernetPauseControlOpCode) 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 *unMarshalpatternFlowEthernetPauseControlOpCode) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowEthernetPauseControlOpCode) 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 *unMarshalpatternFlowEthernetPauseControlOpCode) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowEthernetPauseControlOpCode) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseControlOpCode) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseControlOpCode) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseControlOpCode) Clone() (PatternFlowEthernetPauseControlOpCode, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseControlOpCode() + 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 +} + +func (obj *patternFlowEthernetPauseControlOpCode) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowEthernetPauseControlOpCode is control operation code +type PatternFlowEthernetPauseControlOpCode interface { + Validation + // msg marshals PatternFlowEthernetPauseControlOpCode to protobuf object *otg.PatternFlowEthernetPauseControlOpCode + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseControlOpCode + // setMsg unmarshals PatternFlowEthernetPauseControlOpCode from protobuf object *otg.PatternFlowEthernetPauseControlOpCode + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseControlOpCode) PatternFlowEthernetPauseControlOpCode + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseControlOpCode + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseControlOpCode + // validate validates PatternFlowEthernetPauseControlOpCode + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseControlOpCode, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowEthernetPauseControlOpCodeChoiceEnum, set in PatternFlowEthernetPauseControlOpCode + Choice() PatternFlowEthernetPauseControlOpCodeChoiceEnum + // setChoice assigns PatternFlowEthernetPauseControlOpCodeChoiceEnum provided by user to PatternFlowEthernetPauseControlOpCode + setChoice(value PatternFlowEthernetPauseControlOpCodeChoiceEnum) PatternFlowEthernetPauseControlOpCode + // HasChoice checks if Choice has been set in PatternFlowEthernetPauseControlOpCode + HasChoice() bool + // Value returns uint32, set in PatternFlowEthernetPauseControlOpCode. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowEthernetPauseControlOpCode + SetValue(value uint32) PatternFlowEthernetPauseControlOpCode + // HasValue checks if Value has been set in PatternFlowEthernetPauseControlOpCode + HasValue() bool + // Values returns []uint32, set in PatternFlowEthernetPauseControlOpCode. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowEthernetPauseControlOpCode + SetValues(value []uint32) PatternFlowEthernetPauseControlOpCode + // Increment returns PatternFlowEthernetPauseControlOpCodeCounter, set in PatternFlowEthernetPauseControlOpCode. + // PatternFlowEthernetPauseControlOpCodeCounter is integer counter pattern + Increment() PatternFlowEthernetPauseControlOpCodeCounter + // SetIncrement assigns PatternFlowEthernetPauseControlOpCodeCounter provided by user to PatternFlowEthernetPauseControlOpCode. + // PatternFlowEthernetPauseControlOpCodeCounter is integer counter pattern + SetIncrement(value PatternFlowEthernetPauseControlOpCodeCounter) PatternFlowEthernetPauseControlOpCode + // HasIncrement checks if Increment has been set in PatternFlowEthernetPauseControlOpCode + HasIncrement() bool + // Decrement returns PatternFlowEthernetPauseControlOpCodeCounter, set in PatternFlowEthernetPauseControlOpCode. + // PatternFlowEthernetPauseControlOpCodeCounter is integer counter pattern + Decrement() PatternFlowEthernetPauseControlOpCodeCounter + // SetDecrement assigns PatternFlowEthernetPauseControlOpCodeCounter provided by user to PatternFlowEthernetPauseControlOpCode. + // PatternFlowEthernetPauseControlOpCodeCounter is integer counter pattern + SetDecrement(value PatternFlowEthernetPauseControlOpCodeCounter) PatternFlowEthernetPauseControlOpCode + // HasDecrement checks if Decrement has been set in PatternFlowEthernetPauseControlOpCode + HasDecrement() bool + // MetricTags returns PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIterIter, set in PatternFlowEthernetPauseControlOpCode + MetricTags() PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter + setNil() +} + +type PatternFlowEthernetPauseControlOpCodeChoiceEnum string + +// Enum of Choice on PatternFlowEthernetPauseControlOpCode +var PatternFlowEthernetPauseControlOpCodeChoice = struct { + VALUE PatternFlowEthernetPauseControlOpCodeChoiceEnum + VALUES PatternFlowEthernetPauseControlOpCodeChoiceEnum + INCREMENT PatternFlowEthernetPauseControlOpCodeChoiceEnum + DECREMENT PatternFlowEthernetPauseControlOpCodeChoiceEnum +}{ + VALUE: PatternFlowEthernetPauseControlOpCodeChoiceEnum("value"), + VALUES: PatternFlowEthernetPauseControlOpCodeChoiceEnum("values"), + INCREMENT: PatternFlowEthernetPauseControlOpCodeChoiceEnum("increment"), + DECREMENT: PatternFlowEthernetPauseControlOpCodeChoiceEnum("decrement"), +} + +func (obj *patternFlowEthernetPauseControlOpCode) Choice() PatternFlowEthernetPauseControlOpCodeChoiceEnum { + return PatternFlowEthernetPauseControlOpCodeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowEthernetPauseControlOpCode) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowEthernetPauseControlOpCode) setChoice(value PatternFlowEthernetPauseControlOpCodeChoiceEnum) PatternFlowEthernetPauseControlOpCode { + intValue, ok := otg.PatternFlowEthernetPauseControlOpCode_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowEthernetPauseControlOpCodeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowEthernetPauseControlOpCode_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowEthernetPauseControlOpCodeChoice.VALUE { + defaultValue := uint32(1) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowEthernetPauseControlOpCodeChoice.VALUES { + defaultValue := []uint32{1} + obj.obj.Values = defaultValue + } + + if value == PatternFlowEthernetPauseControlOpCodeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowEthernetPauseControlOpCodeCounter().msg() + } + + if value == PatternFlowEthernetPauseControlOpCodeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowEthernetPauseControlOpCodeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowEthernetPauseControlOpCode) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowEthernetPauseControlOpCode) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowEthernetPauseControlOpCode object +func (obj *patternFlowEthernetPauseControlOpCode) SetValue(value uint32) PatternFlowEthernetPauseControlOpCode { + obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowEthernetPauseControlOpCode) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{1}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowEthernetPauseControlOpCode object +func (obj *patternFlowEthernetPauseControlOpCode) SetValues(value []uint32) PatternFlowEthernetPauseControlOpCode { + obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowEthernetPauseControlOpCodeCounter +func (obj *patternFlowEthernetPauseControlOpCode) Increment() PatternFlowEthernetPauseControlOpCodeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowEthernetPauseControlOpCodeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowEthernetPauseControlOpCodeCounter +func (obj *patternFlowEthernetPauseControlOpCode) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowEthernetPauseControlOpCodeCounter value in the PatternFlowEthernetPauseControlOpCode object +func (obj *patternFlowEthernetPauseControlOpCode) SetIncrement(value PatternFlowEthernetPauseControlOpCodeCounter) PatternFlowEthernetPauseControlOpCode { + obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowEthernetPauseControlOpCodeCounter +func (obj *patternFlowEthernetPauseControlOpCode) Decrement() PatternFlowEthernetPauseControlOpCodeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowEthernetPauseControlOpCodeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowEthernetPauseControlOpCodeCounter +func (obj *patternFlowEthernetPauseControlOpCode) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowEthernetPauseControlOpCodeCounter value in the PatternFlowEthernetPauseControlOpCode object +func (obj *patternFlowEthernetPauseControlOpCode) SetDecrement(value PatternFlowEthernetPauseControlOpCodeCounter) PatternFlowEthernetPauseControlOpCode { + obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowEthernetPauseControlOpCodeMetricTag +func (obj *patternFlowEthernetPauseControlOpCode) MetricTags() PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowEthernetPauseControlOpCodeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter struct { + obj *patternFlowEthernetPauseControlOpCode + patternFlowEthernetPauseControlOpCodeMetricTagSlice []PatternFlowEthernetPauseControlOpCodeMetricTag + fieldPtr *[]*otg.PatternFlowEthernetPauseControlOpCodeMetricTag +} + +func newPatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter(ptr *[]*otg.PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { + return &patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter interface { + setMsg(*patternFlowEthernetPauseControlOpCode) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter + Items() []PatternFlowEthernetPauseControlOpCodeMetricTag + Add() PatternFlowEthernetPauseControlOpCodeMetricTag + Append(items ...PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter + Set(index int, newObj PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter + Clear() PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter + clearHolderSlice() PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter + appendHolderSlice(item PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter +} + +func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) setMsg(msg *patternFlowEthernetPauseControlOpCode) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowEthernetPauseControlOpCodeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) Items() []PatternFlowEthernetPauseControlOpCodeMetricTag { + return obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice +} + +func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) Add() PatternFlowEthernetPauseControlOpCodeMetricTag { + newObj := &otg.PatternFlowEthernetPauseControlOpCodeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowEthernetPauseControlOpCodeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice = append(obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) Append(items ...PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice = append(obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) Set(index int, newObj PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) Clear() PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowEthernetPauseControlOpCodeMetricTag{} + obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice = []PatternFlowEthernetPauseControlOpCodeMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) clearHolderSlice() PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { + if len(obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice) > 0 { + obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice = []PatternFlowEthernetPauseControlOpCodeMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter) appendHolderSlice(item PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodePatternFlowEthernetPauseControlOpCodeMetricTagIter { + obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice = append(obj.patternFlowEthernetPauseControlOpCodeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowEthernetPauseControlOpCode) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseControlOpCode.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowEthernetPauseControlOpCode.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowEthernetPauseControlOpCodeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowEthernetPauseControlOpCode) setDefault() { + var choices_set int = 0 + var choice PatternFlowEthernetPauseControlOpCodeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseControlOpCodeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowEthernetPauseControlOpCodeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseControlOpCodeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseControlOpCodeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowEthernetPauseControlOpCodeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetPauseControlOpCode") + } + } else { + intVal := otg.PatternFlowEthernetPauseControlOpCode_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowEthernetPauseControlOpCode_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_control_op_code_counter.go b/gosnappi/pattern_flow_ethernet_pause_control_op_code_counter.go new file mode 100644 index 00000000..a2e2d060 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_control_op_code_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowEthernetPauseControlOpCodeCounter ***** +type patternFlowEthernetPauseControlOpCodeCounter struct { + validation + obj *otg.PatternFlowEthernetPauseControlOpCodeCounter + marshaller marshalPatternFlowEthernetPauseControlOpCodeCounter + unMarshaller unMarshalPatternFlowEthernetPauseControlOpCodeCounter +} + +func NewPatternFlowEthernetPauseControlOpCodeCounter() PatternFlowEthernetPauseControlOpCodeCounter { + obj := patternFlowEthernetPauseControlOpCodeCounter{obj: &otg.PatternFlowEthernetPauseControlOpCodeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseControlOpCodeCounter) msg() *otg.PatternFlowEthernetPauseControlOpCodeCounter { + return obj.obj +} + +func (obj *patternFlowEthernetPauseControlOpCodeCounter) setMsg(msg *otg.PatternFlowEthernetPauseControlOpCodeCounter) PatternFlowEthernetPauseControlOpCodeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseControlOpCodeCounter struct { + obj *patternFlowEthernetPauseControlOpCodeCounter +} + +type marshalPatternFlowEthernetPauseControlOpCodeCounter interface { + // ToProto marshals PatternFlowEthernetPauseControlOpCodeCounter to protobuf object *otg.PatternFlowEthernetPauseControlOpCodeCounter + ToProto() (*otg.PatternFlowEthernetPauseControlOpCodeCounter, error) + // ToPbText marshals PatternFlowEthernetPauseControlOpCodeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseControlOpCodeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseControlOpCodeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseControlOpCodeCounter struct { + obj *patternFlowEthernetPauseControlOpCodeCounter +} + +type unMarshalPatternFlowEthernetPauseControlOpCodeCounter interface { + // FromProto unmarshals PatternFlowEthernetPauseControlOpCodeCounter from protobuf object *otg.PatternFlowEthernetPauseControlOpCodeCounter + FromProto(msg *otg.PatternFlowEthernetPauseControlOpCodeCounter) (PatternFlowEthernetPauseControlOpCodeCounter, error) + // FromPbText unmarshals PatternFlowEthernetPauseControlOpCodeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseControlOpCodeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseControlOpCodeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseControlOpCodeCounter) Marshal() marshalPatternFlowEthernetPauseControlOpCodeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseControlOpCodeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseControlOpCodeCounter) Unmarshal() unMarshalPatternFlowEthernetPauseControlOpCodeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseControlOpCodeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseControlOpCodeCounter) ToProto() (*otg.PatternFlowEthernetPauseControlOpCodeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseControlOpCodeCounter) FromProto(msg *otg.PatternFlowEthernetPauseControlOpCodeCounter) (PatternFlowEthernetPauseControlOpCodeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseControlOpCodeCounter) 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 *unMarshalpatternFlowEthernetPauseControlOpCodeCounter) 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 *marshalpatternFlowEthernetPauseControlOpCodeCounter) 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 *unMarshalpatternFlowEthernetPauseControlOpCodeCounter) 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 *marshalpatternFlowEthernetPauseControlOpCodeCounter) 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 *unMarshalpatternFlowEthernetPauseControlOpCodeCounter) 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 *patternFlowEthernetPauseControlOpCodeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseControlOpCodeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseControlOpCodeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseControlOpCodeCounter) Clone() (PatternFlowEthernetPauseControlOpCodeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseControlOpCodeCounter() + 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 +} + +// PatternFlowEthernetPauseControlOpCodeCounter is integer counter pattern +type PatternFlowEthernetPauseControlOpCodeCounter interface { + Validation + // msg marshals PatternFlowEthernetPauseControlOpCodeCounter to protobuf object *otg.PatternFlowEthernetPauseControlOpCodeCounter + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseControlOpCodeCounter + // setMsg unmarshals PatternFlowEthernetPauseControlOpCodeCounter from protobuf object *otg.PatternFlowEthernetPauseControlOpCodeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseControlOpCodeCounter) PatternFlowEthernetPauseControlOpCodeCounter + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseControlOpCodeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseControlOpCodeCounter + // validate validates PatternFlowEthernetPauseControlOpCodeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseControlOpCodeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowEthernetPauseControlOpCodeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowEthernetPauseControlOpCodeCounter + SetStart(value uint32) PatternFlowEthernetPauseControlOpCodeCounter + // HasStart checks if Start has been set in PatternFlowEthernetPauseControlOpCodeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowEthernetPauseControlOpCodeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowEthernetPauseControlOpCodeCounter + SetStep(value uint32) PatternFlowEthernetPauseControlOpCodeCounter + // HasStep checks if Step has been set in PatternFlowEthernetPauseControlOpCodeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowEthernetPauseControlOpCodeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowEthernetPauseControlOpCodeCounter + SetCount(value uint32) PatternFlowEthernetPauseControlOpCodeCounter + // HasCount checks if Count has been set in PatternFlowEthernetPauseControlOpCodeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowEthernetPauseControlOpCodeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowEthernetPauseControlOpCodeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowEthernetPauseControlOpCodeCounter object +func (obj *patternFlowEthernetPauseControlOpCodeCounter) SetStart(value uint32) PatternFlowEthernetPauseControlOpCodeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowEthernetPauseControlOpCodeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowEthernetPauseControlOpCodeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowEthernetPauseControlOpCodeCounter object +func (obj *patternFlowEthernetPauseControlOpCodeCounter) SetStep(value uint32) PatternFlowEthernetPauseControlOpCodeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetPauseControlOpCodeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetPauseControlOpCodeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowEthernetPauseControlOpCodeCounter object +func (obj *patternFlowEthernetPauseControlOpCodeCounter) SetCount(value uint32) PatternFlowEthernetPauseControlOpCodeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowEthernetPauseControlOpCodeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseControlOpCodeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseControlOpCodeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseControlOpCodeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowEthernetPauseControlOpCodeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_control_op_code_metric_tag.go b/gosnappi/pattern_flow_ethernet_pause_control_op_code_metric_tag.go new file mode 100644 index 00000000..db32f463 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_control_op_code_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowEthernetPauseControlOpCodeMetricTag ***** +type patternFlowEthernetPauseControlOpCodeMetricTag struct { + validation + obj *otg.PatternFlowEthernetPauseControlOpCodeMetricTag + marshaller marshalPatternFlowEthernetPauseControlOpCodeMetricTag + unMarshaller unMarshalPatternFlowEthernetPauseControlOpCodeMetricTag +} + +func NewPatternFlowEthernetPauseControlOpCodeMetricTag() PatternFlowEthernetPauseControlOpCodeMetricTag { + obj := patternFlowEthernetPauseControlOpCodeMetricTag{obj: &otg.PatternFlowEthernetPauseControlOpCodeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) msg() *otg.PatternFlowEthernetPauseControlOpCodeMetricTag { + return obj.obj +} + +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) setMsg(msg *otg.PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseControlOpCodeMetricTag struct { + obj *patternFlowEthernetPauseControlOpCodeMetricTag +} + +type marshalPatternFlowEthernetPauseControlOpCodeMetricTag interface { + // ToProto marshals PatternFlowEthernetPauseControlOpCodeMetricTag to protobuf object *otg.PatternFlowEthernetPauseControlOpCodeMetricTag + ToProto() (*otg.PatternFlowEthernetPauseControlOpCodeMetricTag, error) + // ToPbText marshals PatternFlowEthernetPauseControlOpCodeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseControlOpCodeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseControlOpCodeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseControlOpCodeMetricTag struct { + obj *patternFlowEthernetPauseControlOpCodeMetricTag +} + +type unMarshalPatternFlowEthernetPauseControlOpCodeMetricTag interface { + // FromProto unmarshals PatternFlowEthernetPauseControlOpCodeMetricTag from protobuf object *otg.PatternFlowEthernetPauseControlOpCodeMetricTag + FromProto(msg *otg.PatternFlowEthernetPauseControlOpCodeMetricTag) (PatternFlowEthernetPauseControlOpCodeMetricTag, error) + // FromPbText unmarshals PatternFlowEthernetPauseControlOpCodeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseControlOpCodeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseControlOpCodeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) Marshal() marshalPatternFlowEthernetPauseControlOpCodeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseControlOpCodeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) Unmarshal() unMarshalPatternFlowEthernetPauseControlOpCodeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseControlOpCodeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseControlOpCodeMetricTag) ToProto() (*otg.PatternFlowEthernetPauseControlOpCodeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseControlOpCodeMetricTag) FromProto(msg *otg.PatternFlowEthernetPauseControlOpCodeMetricTag) (PatternFlowEthernetPauseControlOpCodeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseControlOpCodeMetricTag) 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 *unMarshalpatternFlowEthernetPauseControlOpCodeMetricTag) 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 *marshalpatternFlowEthernetPauseControlOpCodeMetricTag) 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 *unMarshalpatternFlowEthernetPauseControlOpCodeMetricTag) 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 *marshalpatternFlowEthernetPauseControlOpCodeMetricTag) 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 *unMarshalpatternFlowEthernetPauseControlOpCodeMetricTag) 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 *patternFlowEthernetPauseControlOpCodeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) Clone() (PatternFlowEthernetPauseControlOpCodeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseControlOpCodeMetricTag() + 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 +} + +// PatternFlowEthernetPauseControlOpCodeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowEthernetPauseControlOpCodeMetricTag interface { + Validation + // msg marshals PatternFlowEthernetPauseControlOpCodeMetricTag to protobuf object *otg.PatternFlowEthernetPauseControlOpCodeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseControlOpCodeMetricTag + // setMsg unmarshals PatternFlowEthernetPauseControlOpCodeMetricTag from protobuf object *otg.PatternFlowEthernetPauseControlOpCodeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseControlOpCodeMetricTag) PatternFlowEthernetPauseControlOpCodeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseControlOpCodeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseControlOpCodeMetricTag + // validate validates PatternFlowEthernetPauseControlOpCodeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseControlOpCodeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowEthernetPauseControlOpCodeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowEthernetPauseControlOpCodeMetricTag + SetName(value string) PatternFlowEthernetPauseControlOpCodeMetricTag + // Offset returns uint32, set in PatternFlowEthernetPauseControlOpCodeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowEthernetPauseControlOpCodeMetricTag + SetOffset(value uint32) PatternFlowEthernetPauseControlOpCodeMetricTag + // HasOffset checks if Offset has been set in PatternFlowEthernetPauseControlOpCodeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowEthernetPauseControlOpCodeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowEthernetPauseControlOpCodeMetricTag + SetLength(value uint32) PatternFlowEthernetPauseControlOpCodeMetricTag + // HasLength checks if Length has been set in PatternFlowEthernetPauseControlOpCodeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowEthernetPauseControlOpCodeMetricTag object +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) SetName(value string) PatternFlowEthernetPauseControlOpCodeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowEthernetPauseControlOpCodeMetricTag object +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) SetOffset(value uint32) PatternFlowEthernetPauseControlOpCodeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowEthernetPauseControlOpCodeMetricTag object +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) SetLength(value uint32) PatternFlowEthernetPauseControlOpCodeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetPauseControlOpCodeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseControlOpCodeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowEthernetPauseControlOpCodeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowEthernetPauseControlOpCodeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_dst.go b/gosnappi/pattern_flow_ethernet_pause_dst.go new file mode 100644 index 00000000..93b7b636 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_dst.go @@ -0,0 +1,658 @@ +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" +) + +// ***** PatternFlowEthernetPauseDst ***** +type patternFlowEthernetPauseDst struct { + validation + obj *otg.PatternFlowEthernetPauseDst + marshaller marshalPatternFlowEthernetPauseDst + unMarshaller unMarshalPatternFlowEthernetPauseDst + incrementHolder PatternFlowEthernetPauseDstCounter + decrementHolder PatternFlowEthernetPauseDstCounter + metricTagsHolder PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter +} + +func NewPatternFlowEthernetPauseDst() PatternFlowEthernetPauseDst { + obj := patternFlowEthernetPauseDst{obj: &otg.PatternFlowEthernetPauseDst{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseDst) msg() *otg.PatternFlowEthernetPauseDst { + return obj.obj +} + +func (obj *patternFlowEthernetPauseDst) setMsg(msg *otg.PatternFlowEthernetPauseDst) PatternFlowEthernetPauseDst { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseDst struct { + obj *patternFlowEthernetPauseDst +} + +type marshalPatternFlowEthernetPauseDst interface { + // ToProto marshals PatternFlowEthernetPauseDst to protobuf object *otg.PatternFlowEthernetPauseDst + ToProto() (*otg.PatternFlowEthernetPauseDst, error) + // ToPbText marshals PatternFlowEthernetPauseDst to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseDst to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseDst to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseDst struct { + obj *patternFlowEthernetPauseDst +} + +type unMarshalPatternFlowEthernetPauseDst interface { + // FromProto unmarshals PatternFlowEthernetPauseDst from protobuf object *otg.PatternFlowEthernetPauseDst + FromProto(msg *otg.PatternFlowEthernetPauseDst) (PatternFlowEthernetPauseDst, error) + // FromPbText unmarshals PatternFlowEthernetPauseDst from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseDst from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseDst from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseDst) Marshal() marshalPatternFlowEthernetPauseDst { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseDst{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseDst) Unmarshal() unMarshalPatternFlowEthernetPauseDst { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseDst{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseDst) ToProto() (*otg.PatternFlowEthernetPauseDst, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseDst) FromProto(msg *otg.PatternFlowEthernetPauseDst) (PatternFlowEthernetPauseDst, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseDst) 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 *unMarshalpatternFlowEthernetPauseDst) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowEthernetPauseDst) 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 *unMarshalpatternFlowEthernetPauseDst) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowEthernetPauseDst) 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 *unMarshalpatternFlowEthernetPauseDst) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowEthernetPauseDst) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseDst) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseDst) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseDst) Clone() (PatternFlowEthernetPauseDst, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseDst() + 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 +} + +func (obj *patternFlowEthernetPauseDst) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowEthernetPauseDst is destination MAC address +type PatternFlowEthernetPauseDst interface { + Validation + // msg marshals PatternFlowEthernetPauseDst to protobuf object *otg.PatternFlowEthernetPauseDst + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseDst + // setMsg unmarshals PatternFlowEthernetPauseDst from protobuf object *otg.PatternFlowEthernetPauseDst + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseDst) PatternFlowEthernetPauseDst + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseDst + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseDst + // validate validates PatternFlowEthernetPauseDst + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseDst, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowEthernetPauseDstChoiceEnum, set in PatternFlowEthernetPauseDst + Choice() PatternFlowEthernetPauseDstChoiceEnum + // setChoice assigns PatternFlowEthernetPauseDstChoiceEnum provided by user to PatternFlowEthernetPauseDst + setChoice(value PatternFlowEthernetPauseDstChoiceEnum) PatternFlowEthernetPauseDst + // HasChoice checks if Choice has been set in PatternFlowEthernetPauseDst + HasChoice() bool + // Value returns string, set in PatternFlowEthernetPauseDst. + Value() string + // SetValue assigns string provided by user to PatternFlowEthernetPauseDst + SetValue(value string) PatternFlowEthernetPauseDst + // HasValue checks if Value has been set in PatternFlowEthernetPauseDst + HasValue() bool + // Values returns []string, set in PatternFlowEthernetPauseDst. + Values() []string + // SetValues assigns []string provided by user to PatternFlowEthernetPauseDst + SetValues(value []string) PatternFlowEthernetPauseDst + // Increment returns PatternFlowEthernetPauseDstCounter, set in PatternFlowEthernetPauseDst. + // PatternFlowEthernetPauseDstCounter is mac counter pattern + Increment() PatternFlowEthernetPauseDstCounter + // SetIncrement assigns PatternFlowEthernetPauseDstCounter provided by user to PatternFlowEthernetPauseDst. + // PatternFlowEthernetPauseDstCounter is mac counter pattern + SetIncrement(value PatternFlowEthernetPauseDstCounter) PatternFlowEthernetPauseDst + // HasIncrement checks if Increment has been set in PatternFlowEthernetPauseDst + HasIncrement() bool + // Decrement returns PatternFlowEthernetPauseDstCounter, set in PatternFlowEthernetPauseDst. + // PatternFlowEthernetPauseDstCounter is mac counter pattern + Decrement() PatternFlowEthernetPauseDstCounter + // SetDecrement assigns PatternFlowEthernetPauseDstCounter provided by user to PatternFlowEthernetPauseDst. + // PatternFlowEthernetPauseDstCounter is mac counter pattern + SetDecrement(value PatternFlowEthernetPauseDstCounter) PatternFlowEthernetPauseDst + // HasDecrement checks if Decrement has been set in PatternFlowEthernetPauseDst + HasDecrement() bool + // MetricTags returns PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIterIter, set in PatternFlowEthernetPauseDst + MetricTags() PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter + setNil() +} + +type PatternFlowEthernetPauseDstChoiceEnum string + +// Enum of Choice on PatternFlowEthernetPauseDst +var PatternFlowEthernetPauseDstChoice = struct { + VALUE PatternFlowEthernetPauseDstChoiceEnum + VALUES PatternFlowEthernetPauseDstChoiceEnum + INCREMENT PatternFlowEthernetPauseDstChoiceEnum + DECREMENT PatternFlowEthernetPauseDstChoiceEnum +}{ + VALUE: PatternFlowEthernetPauseDstChoiceEnum("value"), + VALUES: PatternFlowEthernetPauseDstChoiceEnum("values"), + INCREMENT: PatternFlowEthernetPauseDstChoiceEnum("increment"), + DECREMENT: PatternFlowEthernetPauseDstChoiceEnum("decrement"), +} + +func (obj *patternFlowEthernetPauseDst) Choice() PatternFlowEthernetPauseDstChoiceEnum { + return PatternFlowEthernetPauseDstChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowEthernetPauseDst) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowEthernetPauseDst) setChoice(value PatternFlowEthernetPauseDstChoiceEnum) PatternFlowEthernetPauseDst { + intValue, ok := otg.PatternFlowEthernetPauseDst_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowEthernetPauseDstChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowEthernetPauseDst_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowEthernetPauseDstChoice.VALUE { + defaultValue := "01:80:c2:00:00:01" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowEthernetPauseDstChoice.VALUES { + defaultValue := []string{"01:80:c2:00:00:01"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowEthernetPauseDstChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowEthernetPauseDstCounter().msg() + } + + if value == PatternFlowEthernetPauseDstChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowEthernetPauseDstCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowEthernetPauseDst) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowEthernetPauseDstChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowEthernetPauseDst) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowEthernetPauseDst object +func (obj *patternFlowEthernetPauseDst) SetValue(value string) PatternFlowEthernetPauseDst { + obj.setChoice(PatternFlowEthernetPauseDstChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowEthernetPauseDst) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"01:80:c2:00:00:01"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowEthernetPauseDst object +func (obj *patternFlowEthernetPauseDst) SetValues(value []string) PatternFlowEthernetPauseDst { + obj.setChoice(PatternFlowEthernetPauseDstChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowEthernetPauseDstCounter +func (obj *patternFlowEthernetPauseDst) Increment() PatternFlowEthernetPauseDstCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowEthernetPauseDstChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowEthernetPauseDstCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowEthernetPauseDstCounter +func (obj *patternFlowEthernetPauseDst) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowEthernetPauseDstCounter value in the PatternFlowEthernetPauseDst object +func (obj *patternFlowEthernetPauseDst) SetIncrement(value PatternFlowEthernetPauseDstCounter) PatternFlowEthernetPauseDst { + obj.setChoice(PatternFlowEthernetPauseDstChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowEthernetPauseDstCounter +func (obj *patternFlowEthernetPauseDst) Decrement() PatternFlowEthernetPauseDstCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowEthernetPauseDstChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowEthernetPauseDstCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowEthernetPauseDstCounter +func (obj *patternFlowEthernetPauseDst) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowEthernetPauseDstCounter value in the PatternFlowEthernetPauseDst object +func (obj *patternFlowEthernetPauseDst) SetDecrement(value PatternFlowEthernetPauseDstCounter) PatternFlowEthernetPauseDst { + obj.setChoice(PatternFlowEthernetPauseDstChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowEthernetPauseDstMetricTag +func (obj *patternFlowEthernetPauseDst) MetricTags() PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowEthernetPauseDstMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter struct { + obj *patternFlowEthernetPauseDst + patternFlowEthernetPauseDstMetricTagSlice []PatternFlowEthernetPauseDstMetricTag + fieldPtr *[]*otg.PatternFlowEthernetPauseDstMetricTag +} + +func newPatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter(ptr *[]*otg.PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { + return &patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter interface { + setMsg(*patternFlowEthernetPauseDst) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter + Items() []PatternFlowEthernetPauseDstMetricTag + Add() PatternFlowEthernetPauseDstMetricTag + Append(items ...PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter + Set(index int, newObj PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter + Clear() PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter + clearHolderSlice() PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter + appendHolderSlice(item PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter +} + +func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) setMsg(msg *patternFlowEthernetPauseDst) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowEthernetPauseDstMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) Items() []PatternFlowEthernetPauseDstMetricTag { + return obj.patternFlowEthernetPauseDstMetricTagSlice +} + +func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) Add() PatternFlowEthernetPauseDstMetricTag { + newObj := &otg.PatternFlowEthernetPauseDstMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowEthernetPauseDstMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowEthernetPauseDstMetricTagSlice = append(obj.patternFlowEthernetPauseDstMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) Append(items ...PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowEthernetPauseDstMetricTagSlice = append(obj.patternFlowEthernetPauseDstMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) Set(index int, newObj PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowEthernetPauseDstMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) Clear() PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowEthernetPauseDstMetricTag{} + obj.patternFlowEthernetPauseDstMetricTagSlice = []PatternFlowEthernetPauseDstMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) clearHolderSlice() PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { + if len(obj.patternFlowEthernetPauseDstMetricTagSlice) > 0 { + obj.patternFlowEthernetPauseDstMetricTagSlice = []PatternFlowEthernetPauseDstMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter) appendHolderSlice(item PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstPatternFlowEthernetPauseDstMetricTagIter { + obj.patternFlowEthernetPauseDstMetricTagSlice = append(obj.patternFlowEthernetPauseDstMetricTagSlice, item) + return obj +} + +func (obj *patternFlowEthernetPauseDst) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateMac(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseDst.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateMacSlice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseDst.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowEthernetPauseDstMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowEthernetPauseDst) setDefault() { + var choices_set int = 0 + var choice PatternFlowEthernetPauseDstChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseDstChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowEthernetPauseDstChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseDstChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseDstChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowEthernetPauseDstChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetPauseDst") + } + } else { + intVal := otg.PatternFlowEthernetPauseDst_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowEthernetPauseDst_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_dst_counter.go b/gosnappi/pattern_flow_ethernet_pause_dst_counter.go new file mode 100644 index 00000000..ce786b89 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_dst_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowEthernetPauseDstCounter ***** +type patternFlowEthernetPauseDstCounter struct { + validation + obj *otg.PatternFlowEthernetPauseDstCounter + marshaller marshalPatternFlowEthernetPauseDstCounter + unMarshaller unMarshalPatternFlowEthernetPauseDstCounter +} + +func NewPatternFlowEthernetPauseDstCounter() PatternFlowEthernetPauseDstCounter { + obj := patternFlowEthernetPauseDstCounter{obj: &otg.PatternFlowEthernetPauseDstCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseDstCounter) msg() *otg.PatternFlowEthernetPauseDstCounter { + return obj.obj +} + +func (obj *patternFlowEthernetPauseDstCounter) setMsg(msg *otg.PatternFlowEthernetPauseDstCounter) PatternFlowEthernetPauseDstCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseDstCounter struct { + obj *patternFlowEthernetPauseDstCounter +} + +type marshalPatternFlowEthernetPauseDstCounter interface { + // ToProto marshals PatternFlowEthernetPauseDstCounter to protobuf object *otg.PatternFlowEthernetPauseDstCounter + ToProto() (*otg.PatternFlowEthernetPauseDstCounter, error) + // ToPbText marshals PatternFlowEthernetPauseDstCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseDstCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseDstCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseDstCounter struct { + obj *patternFlowEthernetPauseDstCounter +} + +type unMarshalPatternFlowEthernetPauseDstCounter interface { + // FromProto unmarshals PatternFlowEthernetPauseDstCounter from protobuf object *otg.PatternFlowEthernetPauseDstCounter + FromProto(msg *otg.PatternFlowEthernetPauseDstCounter) (PatternFlowEthernetPauseDstCounter, error) + // FromPbText unmarshals PatternFlowEthernetPauseDstCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseDstCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseDstCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseDstCounter) Marshal() marshalPatternFlowEthernetPauseDstCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseDstCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseDstCounter) Unmarshal() unMarshalPatternFlowEthernetPauseDstCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseDstCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseDstCounter) ToProto() (*otg.PatternFlowEthernetPauseDstCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseDstCounter) FromProto(msg *otg.PatternFlowEthernetPauseDstCounter) (PatternFlowEthernetPauseDstCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseDstCounter) 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 *unMarshalpatternFlowEthernetPauseDstCounter) 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 *marshalpatternFlowEthernetPauseDstCounter) 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 *unMarshalpatternFlowEthernetPauseDstCounter) 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 *marshalpatternFlowEthernetPauseDstCounter) 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 *unMarshalpatternFlowEthernetPauseDstCounter) 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 *patternFlowEthernetPauseDstCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseDstCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseDstCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseDstCounter) Clone() (PatternFlowEthernetPauseDstCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseDstCounter() + 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 +} + +// PatternFlowEthernetPauseDstCounter is mac counter pattern +type PatternFlowEthernetPauseDstCounter interface { + Validation + // msg marshals PatternFlowEthernetPauseDstCounter to protobuf object *otg.PatternFlowEthernetPauseDstCounter + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseDstCounter + // setMsg unmarshals PatternFlowEthernetPauseDstCounter from protobuf object *otg.PatternFlowEthernetPauseDstCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseDstCounter) PatternFlowEthernetPauseDstCounter + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseDstCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseDstCounter + // validate validates PatternFlowEthernetPauseDstCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseDstCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowEthernetPauseDstCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowEthernetPauseDstCounter + SetStart(value string) PatternFlowEthernetPauseDstCounter + // HasStart checks if Start has been set in PatternFlowEthernetPauseDstCounter + HasStart() bool + // Step returns string, set in PatternFlowEthernetPauseDstCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowEthernetPauseDstCounter + SetStep(value string) PatternFlowEthernetPauseDstCounter + // HasStep checks if Step has been set in PatternFlowEthernetPauseDstCounter + HasStep() bool + // Count returns uint32, set in PatternFlowEthernetPauseDstCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowEthernetPauseDstCounter + SetCount(value uint32) PatternFlowEthernetPauseDstCounter + // HasCount checks if Count has been set in PatternFlowEthernetPauseDstCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowEthernetPauseDstCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowEthernetPauseDstCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowEthernetPauseDstCounter object +func (obj *patternFlowEthernetPauseDstCounter) SetStart(value string) PatternFlowEthernetPauseDstCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowEthernetPauseDstCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowEthernetPauseDstCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowEthernetPauseDstCounter object +func (obj *patternFlowEthernetPauseDstCounter) SetStep(value string) PatternFlowEthernetPauseDstCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetPauseDstCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetPauseDstCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowEthernetPauseDstCounter object +func (obj *patternFlowEthernetPauseDstCounter) SetCount(value uint32) PatternFlowEthernetPauseDstCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowEthernetPauseDstCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateMac(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseDstCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateMac(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseDstCounter.Step")) + } + + } + +} + +func (obj *patternFlowEthernetPauseDstCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("01:80:c2:00:00:01") + } + if obj.obj.Step == nil { + obj.SetStep("00:00:00:00:00:01") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_dst_metric_tag.go b/gosnappi/pattern_flow_ethernet_pause_dst_metric_tag.go new file mode 100644 index 00000000..3d202857 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_dst_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowEthernetPauseDstMetricTag ***** +type patternFlowEthernetPauseDstMetricTag struct { + validation + obj *otg.PatternFlowEthernetPauseDstMetricTag + marshaller marshalPatternFlowEthernetPauseDstMetricTag + unMarshaller unMarshalPatternFlowEthernetPauseDstMetricTag +} + +func NewPatternFlowEthernetPauseDstMetricTag() PatternFlowEthernetPauseDstMetricTag { + obj := patternFlowEthernetPauseDstMetricTag{obj: &otg.PatternFlowEthernetPauseDstMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseDstMetricTag) msg() *otg.PatternFlowEthernetPauseDstMetricTag { + return obj.obj +} + +func (obj *patternFlowEthernetPauseDstMetricTag) setMsg(msg *otg.PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseDstMetricTag struct { + obj *patternFlowEthernetPauseDstMetricTag +} + +type marshalPatternFlowEthernetPauseDstMetricTag interface { + // ToProto marshals PatternFlowEthernetPauseDstMetricTag to protobuf object *otg.PatternFlowEthernetPauseDstMetricTag + ToProto() (*otg.PatternFlowEthernetPauseDstMetricTag, error) + // ToPbText marshals PatternFlowEthernetPauseDstMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseDstMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseDstMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseDstMetricTag struct { + obj *patternFlowEthernetPauseDstMetricTag +} + +type unMarshalPatternFlowEthernetPauseDstMetricTag interface { + // FromProto unmarshals PatternFlowEthernetPauseDstMetricTag from protobuf object *otg.PatternFlowEthernetPauseDstMetricTag + FromProto(msg *otg.PatternFlowEthernetPauseDstMetricTag) (PatternFlowEthernetPauseDstMetricTag, error) + // FromPbText unmarshals PatternFlowEthernetPauseDstMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseDstMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseDstMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseDstMetricTag) Marshal() marshalPatternFlowEthernetPauseDstMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseDstMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseDstMetricTag) Unmarshal() unMarshalPatternFlowEthernetPauseDstMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseDstMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseDstMetricTag) ToProto() (*otg.PatternFlowEthernetPauseDstMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseDstMetricTag) FromProto(msg *otg.PatternFlowEthernetPauseDstMetricTag) (PatternFlowEthernetPauseDstMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseDstMetricTag) 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 *unMarshalpatternFlowEthernetPauseDstMetricTag) 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 *marshalpatternFlowEthernetPauseDstMetricTag) 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 *unMarshalpatternFlowEthernetPauseDstMetricTag) 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 *marshalpatternFlowEthernetPauseDstMetricTag) 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 *unMarshalpatternFlowEthernetPauseDstMetricTag) 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 *patternFlowEthernetPauseDstMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseDstMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseDstMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseDstMetricTag) Clone() (PatternFlowEthernetPauseDstMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseDstMetricTag() + 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 +} + +// PatternFlowEthernetPauseDstMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowEthernetPauseDstMetricTag interface { + Validation + // msg marshals PatternFlowEthernetPauseDstMetricTag to protobuf object *otg.PatternFlowEthernetPauseDstMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseDstMetricTag + // setMsg unmarshals PatternFlowEthernetPauseDstMetricTag from protobuf object *otg.PatternFlowEthernetPauseDstMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseDstMetricTag) PatternFlowEthernetPauseDstMetricTag + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseDstMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseDstMetricTag + // validate validates PatternFlowEthernetPauseDstMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseDstMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowEthernetPauseDstMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowEthernetPauseDstMetricTag + SetName(value string) PatternFlowEthernetPauseDstMetricTag + // Offset returns uint32, set in PatternFlowEthernetPauseDstMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowEthernetPauseDstMetricTag + SetOffset(value uint32) PatternFlowEthernetPauseDstMetricTag + // HasOffset checks if Offset has been set in PatternFlowEthernetPauseDstMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowEthernetPauseDstMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowEthernetPauseDstMetricTag + SetLength(value uint32) PatternFlowEthernetPauseDstMetricTag + // HasLength checks if Length has been set in PatternFlowEthernetPauseDstMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowEthernetPauseDstMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowEthernetPauseDstMetricTag object +func (obj *patternFlowEthernetPauseDstMetricTag) SetName(value string) PatternFlowEthernetPauseDstMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetPauseDstMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetPauseDstMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowEthernetPauseDstMetricTag object +func (obj *patternFlowEthernetPauseDstMetricTag) SetOffset(value uint32) PatternFlowEthernetPauseDstMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetPauseDstMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetPauseDstMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowEthernetPauseDstMetricTag object +func (obj *patternFlowEthernetPauseDstMetricTag) SetLength(value uint32) PatternFlowEthernetPauseDstMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowEthernetPauseDstMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetPauseDstMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 47 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseDstMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 48 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowEthernetPauseDstMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowEthernetPauseDstMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(48) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_ether_type.go b/gosnappi/pattern_flow_ethernet_pause_ether_type.go new file mode 100644 index 00000000..52d469b0 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_ether_type.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowEthernetPauseEtherType ***** +type patternFlowEthernetPauseEtherType struct { + validation + obj *otg.PatternFlowEthernetPauseEtherType + marshaller marshalPatternFlowEthernetPauseEtherType + unMarshaller unMarshalPatternFlowEthernetPauseEtherType + incrementHolder PatternFlowEthernetPauseEtherTypeCounter + decrementHolder PatternFlowEthernetPauseEtherTypeCounter + metricTagsHolder PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter +} + +func NewPatternFlowEthernetPauseEtherType() PatternFlowEthernetPauseEtherType { + obj := patternFlowEthernetPauseEtherType{obj: &otg.PatternFlowEthernetPauseEtherType{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseEtherType) msg() *otg.PatternFlowEthernetPauseEtherType { + return obj.obj +} + +func (obj *patternFlowEthernetPauseEtherType) setMsg(msg *otg.PatternFlowEthernetPauseEtherType) PatternFlowEthernetPauseEtherType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseEtherType struct { + obj *patternFlowEthernetPauseEtherType +} + +type marshalPatternFlowEthernetPauseEtherType interface { + // ToProto marshals PatternFlowEthernetPauseEtherType to protobuf object *otg.PatternFlowEthernetPauseEtherType + ToProto() (*otg.PatternFlowEthernetPauseEtherType, error) + // ToPbText marshals PatternFlowEthernetPauseEtherType to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseEtherType to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseEtherType to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseEtherType struct { + obj *patternFlowEthernetPauseEtherType +} + +type unMarshalPatternFlowEthernetPauseEtherType interface { + // FromProto unmarshals PatternFlowEthernetPauseEtherType from protobuf object *otg.PatternFlowEthernetPauseEtherType + FromProto(msg *otg.PatternFlowEthernetPauseEtherType) (PatternFlowEthernetPauseEtherType, error) + // FromPbText unmarshals PatternFlowEthernetPauseEtherType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseEtherType from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseEtherType from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseEtherType) Marshal() marshalPatternFlowEthernetPauseEtherType { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseEtherType{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseEtherType) Unmarshal() unMarshalPatternFlowEthernetPauseEtherType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseEtherType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseEtherType) ToProto() (*otg.PatternFlowEthernetPauseEtherType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseEtherType) FromProto(msg *otg.PatternFlowEthernetPauseEtherType) (PatternFlowEthernetPauseEtherType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseEtherType) 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 *unMarshalpatternFlowEthernetPauseEtherType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowEthernetPauseEtherType) 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 *unMarshalpatternFlowEthernetPauseEtherType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowEthernetPauseEtherType) 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 *unMarshalpatternFlowEthernetPauseEtherType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowEthernetPauseEtherType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseEtherType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseEtherType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseEtherType) Clone() (PatternFlowEthernetPauseEtherType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseEtherType() + 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 +} + +func (obj *patternFlowEthernetPauseEtherType) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowEthernetPauseEtherType is ethernet type +type PatternFlowEthernetPauseEtherType interface { + Validation + // msg marshals PatternFlowEthernetPauseEtherType to protobuf object *otg.PatternFlowEthernetPauseEtherType + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseEtherType + // setMsg unmarshals PatternFlowEthernetPauseEtherType from protobuf object *otg.PatternFlowEthernetPauseEtherType + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseEtherType) PatternFlowEthernetPauseEtherType + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseEtherType + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseEtherType + // validate validates PatternFlowEthernetPauseEtherType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseEtherType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowEthernetPauseEtherTypeChoiceEnum, set in PatternFlowEthernetPauseEtherType + Choice() PatternFlowEthernetPauseEtherTypeChoiceEnum + // setChoice assigns PatternFlowEthernetPauseEtherTypeChoiceEnum provided by user to PatternFlowEthernetPauseEtherType + setChoice(value PatternFlowEthernetPauseEtherTypeChoiceEnum) PatternFlowEthernetPauseEtherType + // HasChoice checks if Choice has been set in PatternFlowEthernetPauseEtherType + HasChoice() bool + // Value returns uint32, set in PatternFlowEthernetPauseEtherType. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowEthernetPauseEtherType + SetValue(value uint32) PatternFlowEthernetPauseEtherType + // HasValue checks if Value has been set in PatternFlowEthernetPauseEtherType + HasValue() bool + // Values returns []uint32, set in PatternFlowEthernetPauseEtherType. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowEthernetPauseEtherType + SetValues(value []uint32) PatternFlowEthernetPauseEtherType + // Increment returns PatternFlowEthernetPauseEtherTypeCounter, set in PatternFlowEthernetPauseEtherType. + // PatternFlowEthernetPauseEtherTypeCounter is integer counter pattern + Increment() PatternFlowEthernetPauseEtherTypeCounter + // SetIncrement assigns PatternFlowEthernetPauseEtherTypeCounter provided by user to PatternFlowEthernetPauseEtherType. + // PatternFlowEthernetPauseEtherTypeCounter is integer counter pattern + SetIncrement(value PatternFlowEthernetPauseEtherTypeCounter) PatternFlowEthernetPauseEtherType + // HasIncrement checks if Increment has been set in PatternFlowEthernetPauseEtherType + HasIncrement() bool + // Decrement returns PatternFlowEthernetPauseEtherTypeCounter, set in PatternFlowEthernetPauseEtherType. + // PatternFlowEthernetPauseEtherTypeCounter is integer counter pattern + Decrement() PatternFlowEthernetPauseEtherTypeCounter + // SetDecrement assigns PatternFlowEthernetPauseEtherTypeCounter provided by user to PatternFlowEthernetPauseEtherType. + // PatternFlowEthernetPauseEtherTypeCounter is integer counter pattern + SetDecrement(value PatternFlowEthernetPauseEtherTypeCounter) PatternFlowEthernetPauseEtherType + // HasDecrement checks if Decrement has been set in PatternFlowEthernetPauseEtherType + HasDecrement() bool + // MetricTags returns PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIterIter, set in PatternFlowEthernetPauseEtherType + MetricTags() PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter + setNil() +} + +type PatternFlowEthernetPauseEtherTypeChoiceEnum string + +// Enum of Choice on PatternFlowEthernetPauseEtherType +var PatternFlowEthernetPauseEtherTypeChoice = struct { + VALUE PatternFlowEthernetPauseEtherTypeChoiceEnum + VALUES PatternFlowEthernetPauseEtherTypeChoiceEnum + INCREMENT PatternFlowEthernetPauseEtherTypeChoiceEnum + DECREMENT PatternFlowEthernetPauseEtherTypeChoiceEnum +}{ + VALUE: PatternFlowEthernetPauseEtherTypeChoiceEnum("value"), + VALUES: PatternFlowEthernetPauseEtherTypeChoiceEnum("values"), + INCREMENT: PatternFlowEthernetPauseEtherTypeChoiceEnum("increment"), + DECREMENT: PatternFlowEthernetPauseEtherTypeChoiceEnum("decrement"), +} + +func (obj *patternFlowEthernetPauseEtherType) Choice() PatternFlowEthernetPauseEtherTypeChoiceEnum { + return PatternFlowEthernetPauseEtherTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowEthernetPauseEtherType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowEthernetPauseEtherType) setChoice(value PatternFlowEthernetPauseEtherTypeChoiceEnum) PatternFlowEthernetPauseEtherType { + intValue, ok := otg.PatternFlowEthernetPauseEtherType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowEthernetPauseEtherTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowEthernetPauseEtherType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowEthernetPauseEtherTypeChoice.VALUE { + defaultValue := uint32(34824) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowEthernetPauseEtherTypeChoice.VALUES { + defaultValue := []uint32{34824} + obj.obj.Values = defaultValue + } + + if value == PatternFlowEthernetPauseEtherTypeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowEthernetPauseEtherTypeCounter().msg() + } + + if value == PatternFlowEthernetPauseEtherTypeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowEthernetPauseEtherTypeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowEthernetPauseEtherType) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowEthernetPauseEtherType) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowEthernetPauseEtherType object +func (obj *patternFlowEthernetPauseEtherType) SetValue(value uint32) PatternFlowEthernetPauseEtherType { + obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowEthernetPauseEtherType) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{34824}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowEthernetPauseEtherType object +func (obj *patternFlowEthernetPauseEtherType) SetValues(value []uint32) PatternFlowEthernetPauseEtherType { + obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowEthernetPauseEtherTypeCounter +func (obj *patternFlowEthernetPauseEtherType) Increment() PatternFlowEthernetPauseEtherTypeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowEthernetPauseEtherTypeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowEthernetPauseEtherTypeCounter +func (obj *patternFlowEthernetPauseEtherType) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowEthernetPauseEtherTypeCounter value in the PatternFlowEthernetPauseEtherType object +func (obj *patternFlowEthernetPauseEtherType) SetIncrement(value PatternFlowEthernetPauseEtherTypeCounter) PatternFlowEthernetPauseEtherType { + obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowEthernetPauseEtherTypeCounter +func (obj *patternFlowEthernetPauseEtherType) Decrement() PatternFlowEthernetPauseEtherTypeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowEthernetPauseEtherTypeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowEthernetPauseEtherTypeCounter +func (obj *patternFlowEthernetPauseEtherType) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowEthernetPauseEtherTypeCounter value in the PatternFlowEthernetPauseEtherType object +func (obj *patternFlowEthernetPauseEtherType) SetDecrement(value PatternFlowEthernetPauseEtherTypeCounter) PatternFlowEthernetPauseEtherType { + obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowEthernetPauseEtherTypeMetricTag +func (obj *patternFlowEthernetPauseEtherType) MetricTags() PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowEthernetPauseEtherTypeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter struct { + obj *patternFlowEthernetPauseEtherType + patternFlowEthernetPauseEtherTypeMetricTagSlice []PatternFlowEthernetPauseEtherTypeMetricTag + fieldPtr *[]*otg.PatternFlowEthernetPauseEtherTypeMetricTag +} + +func newPatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter(ptr *[]*otg.PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { + return &patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter interface { + setMsg(*patternFlowEthernetPauseEtherType) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter + Items() []PatternFlowEthernetPauseEtherTypeMetricTag + Add() PatternFlowEthernetPauseEtherTypeMetricTag + Append(items ...PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter + Set(index int, newObj PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter + Clear() PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter + clearHolderSlice() PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter + appendHolderSlice(item PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter +} + +func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) setMsg(msg *patternFlowEthernetPauseEtherType) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowEthernetPauseEtherTypeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) Items() []PatternFlowEthernetPauseEtherTypeMetricTag { + return obj.patternFlowEthernetPauseEtherTypeMetricTagSlice +} + +func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) Add() PatternFlowEthernetPauseEtherTypeMetricTag { + newObj := &otg.PatternFlowEthernetPauseEtherTypeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowEthernetPauseEtherTypeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowEthernetPauseEtherTypeMetricTagSlice = append(obj.patternFlowEthernetPauseEtherTypeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) Append(items ...PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowEthernetPauseEtherTypeMetricTagSlice = append(obj.patternFlowEthernetPauseEtherTypeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) Set(index int, newObj PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowEthernetPauseEtherTypeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) Clear() PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowEthernetPauseEtherTypeMetricTag{} + obj.patternFlowEthernetPauseEtherTypeMetricTagSlice = []PatternFlowEthernetPauseEtherTypeMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) clearHolderSlice() PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { + if len(obj.patternFlowEthernetPauseEtherTypeMetricTagSlice) > 0 { + obj.patternFlowEthernetPauseEtherTypeMetricTagSlice = []PatternFlowEthernetPauseEtherTypeMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter) appendHolderSlice(item PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypePatternFlowEthernetPauseEtherTypeMetricTagIter { + obj.patternFlowEthernetPauseEtherTypeMetricTagSlice = append(obj.patternFlowEthernetPauseEtherTypeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowEthernetPauseEtherType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseEtherType.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowEthernetPauseEtherType.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowEthernetPauseEtherTypeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowEthernetPauseEtherType) setDefault() { + var choices_set int = 0 + var choice PatternFlowEthernetPauseEtherTypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseEtherTypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowEthernetPauseEtherTypeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseEtherTypeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseEtherTypeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowEthernetPauseEtherTypeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetPauseEtherType") + } + } else { + intVal := otg.PatternFlowEthernetPauseEtherType_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowEthernetPauseEtherType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_ether_type_counter.go b/gosnappi/pattern_flow_ethernet_pause_ether_type_counter.go new file mode 100644 index 00000000..983489ba --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_ether_type_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowEthernetPauseEtherTypeCounter ***** +type patternFlowEthernetPauseEtherTypeCounter struct { + validation + obj *otg.PatternFlowEthernetPauseEtherTypeCounter + marshaller marshalPatternFlowEthernetPauseEtherTypeCounter + unMarshaller unMarshalPatternFlowEthernetPauseEtherTypeCounter +} + +func NewPatternFlowEthernetPauseEtherTypeCounter() PatternFlowEthernetPauseEtherTypeCounter { + obj := patternFlowEthernetPauseEtherTypeCounter{obj: &otg.PatternFlowEthernetPauseEtherTypeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseEtherTypeCounter) msg() *otg.PatternFlowEthernetPauseEtherTypeCounter { + return obj.obj +} + +func (obj *patternFlowEthernetPauseEtherTypeCounter) setMsg(msg *otg.PatternFlowEthernetPauseEtherTypeCounter) PatternFlowEthernetPauseEtherTypeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseEtherTypeCounter struct { + obj *patternFlowEthernetPauseEtherTypeCounter +} + +type marshalPatternFlowEthernetPauseEtherTypeCounter interface { + // ToProto marshals PatternFlowEthernetPauseEtherTypeCounter to protobuf object *otg.PatternFlowEthernetPauseEtherTypeCounter + ToProto() (*otg.PatternFlowEthernetPauseEtherTypeCounter, error) + // ToPbText marshals PatternFlowEthernetPauseEtherTypeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseEtherTypeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseEtherTypeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseEtherTypeCounter struct { + obj *patternFlowEthernetPauseEtherTypeCounter +} + +type unMarshalPatternFlowEthernetPauseEtherTypeCounter interface { + // FromProto unmarshals PatternFlowEthernetPauseEtherTypeCounter from protobuf object *otg.PatternFlowEthernetPauseEtherTypeCounter + FromProto(msg *otg.PatternFlowEthernetPauseEtherTypeCounter) (PatternFlowEthernetPauseEtherTypeCounter, error) + // FromPbText unmarshals PatternFlowEthernetPauseEtherTypeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseEtherTypeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseEtherTypeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseEtherTypeCounter) Marshal() marshalPatternFlowEthernetPauseEtherTypeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseEtherTypeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseEtherTypeCounter) Unmarshal() unMarshalPatternFlowEthernetPauseEtherTypeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseEtherTypeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseEtherTypeCounter) ToProto() (*otg.PatternFlowEthernetPauseEtherTypeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseEtherTypeCounter) FromProto(msg *otg.PatternFlowEthernetPauseEtherTypeCounter) (PatternFlowEthernetPauseEtherTypeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseEtherTypeCounter) 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 *unMarshalpatternFlowEthernetPauseEtherTypeCounter) 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 *marshalpatternFlowEthernetPauseEtherTypeCounter) 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 *unMarshalpatternFlowEthernetPauseEtherTypeCounter) 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 *marshalpatternFlowEthernetPauseEtherTypeCounter) 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 *unMarshalpatternFlowEthernetPauseEtherTypeCounter) 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 *patternFlowEthernetPauseEtherTypeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseEtherTypeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseEtherTypeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseEtherTypeCounter) Clone() (PatternFlowEthernetPauseEtherTypeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseEtherTypeCounter() + 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 +} + +// PatternFlowEthernetPauseEtherTypeCounter is integer counter pattern +type PatternFlowEthernetPauseEtherTypeCounter interface { + Validation + // msg marshals PatternFlowEthernetPauseEtherTypeCounter to protobuf object *otg.PatternFlowEthernetPauseEtherTypeCounter + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseEtherTypeCounter + // setMsg unmarshals PatternFlowEthernetPauseEtherTypeCounter from protobuf object *otg.PatternFlowEthernetPauseEtherTypeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseEtherTypeCounter) PatternFlowEthernetPauseEtherTypeCounter + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseEtherTypeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseEtherTypeCounter + // validate validates PatternFlowEthernetPauseEtherTypeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseEtherTypeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowEthernetPauseEtherTypeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowEthernetPauseEtherTypeCounter + SetStart(value uint32) PatternFlowEthernetPauseEtherTypeCounter + // HasStart checks if Start has been set in PatternFlowEthernetPauseEtherTypeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowEthernetPauseEtherTypeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowEthernetPauseEtherTypeCounter + SetStep(value uint32) PatternFlowEthernetPauseEtherTypeCounter + // HasStep checks if Step has been set in PatternFlowEthernetPauseEtherTypeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowEthernetPauseEtherTypeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowEthernetPauseEtherTypeCounter + SetCount(value uint32) PatternFlowEthernetPauseEtherTypeCounter + // HasCount checks if Count has been set in PatternFlowEthernetPauseEtherTypeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowEthernetPauseEtherTypeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowEthernetPauseEtherTypeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowEthernetPauseEtherTypeCounter object +func (obj *patternFlowEthernetPauseEtherTypeCounter) SetStart(value uint32) PatternFlowEthernetPauseEtherTypeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowEthernetPauseEtherTypeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowEthernetPauseEtherTypeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowEthernetPauseEtherTypeCounter object +func (obj *patternFlowEthernetPauseEtherTypeCounter) SetStep(value uint32) PatternFlowEthernetPauseEtherTypeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetPauseEtherTypeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetPauseEtherTypeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowEthernetPauseEtherTypeCounter object +func (obj *patternFlowEthernetPauseEtherTypeCounter) SetCount(value uint32) PatternFlowEthernetPauseEtherTypeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowEthernetPauseEtherTypeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseEtherTypeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseEtherTypeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseEtherTypeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowEthernetPauseEtherTypeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(34824) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_ether_type_metric_tag.go b/gosnappi/pattern_flow_ethernet_pause_ether_type_metric_tag.go new file mode 100644 index 00000000..5a59337c --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_ether_type_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowEthernetPauseEtherTypeMetricTag ***** +type patternFlowEthernetPauseEtherTypeMetricTag struct { + validation + obj *otg.PatternFlowEthernetPauseEtherTypeMetricTag + marshaller marshalPatternFlowEthernetPauseEtherTypeMetricTag + unMarshaller unMarshalPatternFlowEthernetPauseEtherTypeMetricTag +} + +func NewPatternFlowEthernetPauseEtherTypeMetricTag() PatternFlowEthernetPauseEtherTypeMetricTag { + obj := patternFlowEthernetPauseEtherTypeMetricTag{obj: &otg.PatternFlowEthernetPauseEtherTypeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) msg() *otg.PatternFlowEthernetPauseEtherTypeMetricTag { + return obj.obj +} + +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) setMsg(msg *otg.PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseEtherTypeMetricTag struct { + obj *patternFlowEthernetPauseEtherTypeMetricTag +} + +type marshalPatternFlowEthernetPauseEtherTypeMetricTag interface { + // ToProto marshals PatternFlowEthernetPauseEtherTypeMetricTag to protobuf object *otg.PatternFlowEthernetPauseEtherTypeMetricTag + ToProto() (*otg.PatternFlowEthernetPauseEtherTypeMetricTag, error) + // ToPbText marshals PatternFlowEthernetPauseEtherTypeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseEtherTypeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseEtherTypeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseEtherTypeMetricTag struct { + obj *patternFlowEthernetPauseEtherTypeMetricTag +} + +type unMarshalPatternFlowEthernetPauseEtherTypeMetricTag interface { + // FromProto unmarshals PatternFlowEthernetPauseEtherTypeMetricTag from protobuf object *otg.PatternFlowEthernetPauseEtherTypeMetricTag + FromProto(msg *otg.PatternFlowEthernetPauseEtherTypeMetricTag) (PatternFlowEthernetPauseEtherTypeMetricTag, error) + // FromPbText unmarshals PatternFlowEthernetPauseEtherTypeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseEtherTypeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseEtherTypeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) Marshal() marshalPatternFlowEthernetPauseEtherTypeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseEtherTypeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) Unmarshal() unMarshalPatternFlowEthernetPauseEtherTypeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseEtherTypeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseEtherTypeMetricTag) ToProto() (*otg.PatternFlowEthernetPauseEtherTypeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseEtherTypeMetricTag) FromProto(msg *otg.PatternFlowEthernetPauseEtherTypeMetricTag) (PatternFlowEthernetPauseEtherTypeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseEtherTypeMetricTag) 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 *unMarshalpatternFlowEthernetPauseEtherTypeMetricTag) 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 *marshalpatternFlowEthernetPauseEtherTypeMetricTag) 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 *unMarshalpatternFlowEthernetPauseEtherTypeMetricTag) 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 *marshalpatternFlowEthernetPauseEtherTypeMetricTag) 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 *unMarshalpatternFlowEthernetPauseEtherTypeMetricTag) 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 *patternFlowEthernetPauseEtherTypeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) Clone() (PatternFlowEthernetPauseEtherTypeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseEtherTypeMetricTag() + 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 +} + +// PatternFlowEthernetPauseEtherTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowEthernetPauseEtherTypeMetricTag interface { + Validation + // msg marshals PatternFlowEthernetPauseEtherTypeMetricTag to protobuf object *otg.PatternFlowEthernetPauseEtherTypeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseEtherTypeMetricTag + // setMsg unmarshals PatternFlowEthernetPauseEtherTypeMetricTag from protobuf object *otg.PatternFlowEthernetPauseEtherTypeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseEtherTypeMetricTag) PatternFlowEthernetPauseEtherTypeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseEtherTypeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseEtherTypeMetricTag + // validate validates PatternFlowEthernetPauseEtherTypeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseEtherTypeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowEthernetPauseEtherTypeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowEthernetPauseEtherTypeMetricTag + SetName(value string) PatternFlowEthernetPauseEtherTypeMetricTag + // Offset returns uint32, set in PatternFlowEthernetPauseEtherTypeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowEthernetPauseEtherTypeMetricTag + SetOffset(value uint32) PatternFlowEthernetPauseEtherTypeMetricTag + // HasOffset checks if Offset has been set in PatternFlowEthernetPauseEtherTypeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowEthernetPauseEtherTypeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowEthernetPauseEtherTypeMetricTag + SetLength(value uint32) PatternFlowEthernetPauseEtherTypeMetricTag + // HasLength checks if Length has been set in PatternFlowEthernetPauseEtherTypeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowEthernetPauseEtherTypeMetricTag object +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) SetName(value string) PatternFlowEthernetPauseEtherTypeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowEthernetPauseEtherTypeMetricTag object +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) SetOffset(value uint32) PatternFlowEthernetPauseEtherTypeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowEthernetPauseEtherTypeMetricTag object +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) SetLength(value uint32) PatternFlowEthernetPauseEtherTypeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetPauseEtherTypeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseEtherTypeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowEthernetPauseEtherTypeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowEthernetPauseEtherTypeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_src.go b/gosnappi/pattern_flow_ethernet_pause_src.go new file mode 100644 index 00000000..314e1f1e --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_src.go @@ -0,0 +1,658 @@ +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" +) + +// ***** PatternFlowEthernetPauseSrc ***** +type patternFlowEthernetPauseSrc struct { + validation + obj *otg.PatternFlowEthernetPauseSrc + marshaller marshalPatternFlowEthernetPauseSrc + unMarshaller unMarshalPatternFlowEthernetPauseSrc + incrementHolder PatternFlowEthernetPauseSrcCounter + decrementHolder PatternFlowEthernetPauseSrcCounter + metricTagsHolder PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter +} + +func NewPatternFlowEthernetPauseSrc() PatternFlowEthernetPauseSrc { + obj := patternFlowEthernetPauseSrc{obj: &otg.PatternFlowEthernetPauseSrc{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseSrc) msg() *otg.PatternFlowEthernetPauseSrc { + return obj.obj +} + +func (obj *patternFlowEthernetPauseSrc) setMsg(msg *otg.PatternFlowEthernetPauseSrc) PatternFlowEthernetPauseSrc { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseSrc struct { + obj *patternFlowEthernetPauseSrc +} + +type marshalPatternFlowEthernetPauseSrc interface { + // ToProto marshals PatternFlowEthernetPauseSrc to protobuf object *otg.PatternFlowEthernetPauseSrc + ToProto() (*otg.PatternFlowEthernetPauseSrc, error) + // ToPbText marshals PatternFlowEthernetPauseSrc to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseSrc to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseSrc to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseSrc struct { + obj *patternFlowEthernetPauseSrc +} + +type unMarshalPatternFlowEthernetPauseSrc interface { + // FromProto unmarshals PatternFlowEthernetPauseSrc from protobuf object *otg.PatternFlowEthernetPauseSrc + FromProto(msg *otg.PatternFlowEthernetPauseSrc) (PatternFlowEthernetPauseSrc, error) + // FromPbText unmarshals PatternFlowEthernetPauseSrc from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseSrc from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseSrc from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseSrc) Marshal() marshalPatternFlowEthernetPauseSrc { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseSrc{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseSrc) Unmarshal() unMarshalPatternFlowEthernetPauseSrc { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseSrc{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseSrc) ToProto() (*otg.PatternFlowEthernetPauseSrc, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseSrc) FromProto(msg *otg.PatternFlowEthernetPauseSrc) (PatternFlowEthernetPauseSrc, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseSrc) 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 *unMarshalpatternFlowEthernetPauseSrc) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowEthernetPauseSrc) 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 *unMarshalpatternFlowEthernetPauseSrc) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowEthernetPauseSrc) 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 *unMarshalpatternFlowEthernetPauseSrc) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowEthernetPauseSrc) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseSrc) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseSrc) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseSrc) Clone() (PatternFlowEthernetPauseSrc, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseSrc() + 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 +} + +func (obj *patternFlowEthernetPauseSrc) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowEthernetPauseSrc is source MAC address +type PatternFlowEthernetPauseSrc interface { + Validation + // msg marshals PatternFlowEthernetPauseSrc to protobuf object *otg.PatternFlowEthernetPauseSrc + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseSrc + // setMsg unmarshals PatternFlowEthernetPauseSrc from protobuf object *otg.PatternFlowEthernetPauseSrc + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseSrc) PatternFlowEthernetPauseSrc + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseSrc + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseSrc + // validate validates PatternFlowEthernetPauseSrc + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseSrc, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowEthernetPauseSrcChoiceEnum, set in PatternFlowEthernetPauseSrc + Choice() PatternFlowEthernetPauseSrcChoiceEnum + // setChoice assigns PatternFlowEthernetPauseSrcChoiceEnum provided by user to PatternFlowEthernetPauseSrc + setChoice(value PatternFlowEthernetPauseSrcChoiceEnum) PatternFlowEthernetPauseSrc + // HasChoice checks if Choice has been set in PatternFlowEthernetPauseSrc + HasChoice() bool + // Value returns string, set in PatternFlowEthernetPauseSrc. + Value() string + // SetValue assigns string provided by user to PatternFlowEthernetPauseSrc + SetValue(value string) PatternFlowEthernetPauseSrc + // HasValue checks if Value has been set in PatternFlowEthernetPauseSrc + HasValue() bool + // Values returns []string, set in PatternFlowEthernetPauseSrc. + Values() []string + // SetValues assigns []string provided by user to PatternFlowEthernetPauseSrc + SetValues(value []string) PatternFlowEthernetPauseSrc + // Increment returns PatternFlowEthernetPauseSrcCounter, set in PatternFlowEthernetPauseSrc. + // PatternFlowEthernetPauseSrcCounter is mac counter pattern + Increment() PatternFlowEthernetPauseSrcCounter + // SetIncrement assigns PatternFlowEthernetPauseSrcCounter provided by user to PatternFlowEthernetPauseSrc. + // PatternFlowEthernetPauseSrcCounter is mac counter pattern + SetIncrement(value PatternFlowEthernetPauseSrcCounter) PatternFlowEthernetPauseSrc + // HasIncrement checks if Increment has been set in PatternFlowEthernetPauseSrc + HasIncrement() bool + // Decrement returns PatternFlowEthernetPauseSrcCounter, set in PatternFlowEthernetPauseSrc. + // PatternFlowEthernetPauseSrcCounter is mac counter pattern + Decrement() PatternFlowEthernetPauseSrcCounter + // SetDecrement assigns PatternFlowEthernetPauseSrcCounter provided by user to PatternFlowEthernetPauseSrc. + // PatternFlowEthernetPauseSrcCounter is mac counter pattern + SetDecrement(value PatternFlowEthernetPauseSrcCounter) PatternFlowEthernetPauseSrc + // HasDecrement checks if Decrement has been set in PatternFlowEthernetPauseSrc + HasDecrement() bool + // MetricTags returns PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIterIter, set in PatternFlowEthernetPauseSrc + MetricTags() PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter + setNil() +} + +type PatternFlowEthernetPauseSrcChoiceEnum string + +// Enum of Choice on PatternFlowEthernetPauseSrc +var PatternFlowEthernetPauseSrcChoice = struct { + VALUE PatternFlowEthernetPauseSrcChoiceEnum + VALUES PatternFlowEthernetPauseSrcChoiceEnum + INCREMENT PatternFlowEthernetPauseSrcChoiceEnum + DECREMENT PatternFlowEthernetPauseSrcChoiceEnum +}{ + VALUE: PatternFlowEthernetPauseSrcChoiceEnum("value"), + VALUES: PatternFlowEthernetPauseSrcChoiceEnum("values"), + INCREMENT: PatternFlowEthernetPauseSrcChoiceEnum("increment"), + DECREMENT: PatternFlowEthernetPauseSrcChoiceEnum("decrement"), +} + +func (obj *patternFlowEthernetPauseSrc) Choice() PatternFlowEthernetPauseSrcChoiceEnum { + return PatternFlowEthernetPauseSrcChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowEthernetPauseSrc) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowEthernetPauseSrc) setChoice(value PatternFlowEthernetPauseSrcChoiceEnum) PatternFlowEthernetPauseSrc { + intValue, ok := otg.PatternFlowEthernetPauseSrc_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowEthernetPauseSrcChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowEthernetPauseSrc_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowEthernetPauseSrcChoice.VALUE { + defaultValue := "00:00:00:00:00:00" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowEthernetPauseSrcChoice.VALUES { + defaultValue := []string{"00:00:00:00:00:00"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowEthernetPauseSrcChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowEthernetPauseSrcCounter().msg() + } + + if value == PatternFlowEthernetPauseSrcChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowEthernetPauseSrcCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowEthernetPauseSrc) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowEthernetPauseSrcChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowEthernetPauseSrc) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowEthernetPauseSrc object +func (obj *patternFlowEthernetPauseSrc) SetValue(value string) PatternFlowEthernetPauseSrc { + obj.setChoice(PatternFlowEthernetPauseSrcChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowEthernetPauseSrc) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"00:00:00:00:00:00"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowEthernetPauseSrc object +func (obj *patternFlowEthernetPauseSrc) SetValues(value []string) PatternFlowEthernetPauseSrc { + obj.setChoice(PatternFlowEthernetPauseSrcChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowEthernetPauseSrcCounter +func (obj *patternFlowEthernetPauseSrc) Increment() PatternFlowEthernetPauseSrcCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowEthernetPauseSrcChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowEthernetPauseSrcCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowEthernetPauseSrcCounter +func (obj *patternFlowEthernetPauseSrc) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowEthernetPauseSrcCounter value in the PatternFlowEthernetPauseSrc object +func (obj *patternFlowEthernetPauseSrc) SetIncrement(value PatternFlowEthernetPauseSrcCounter) PatternFlowEthernetPauseSrc { + obj.setChoice(PatternFlowEthernetPauseSrcChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowEthernetPauseSrcCounter +func (obj *patternFlowEthernetPauseSrc) Decrement() PatternFlowEthernetPauseSrcCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowEthernetPauseSrcChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowEthernetPauseSrcCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowEthernetPauseSrcCounter +func (obj *patternFlowEthernetPauseSrc) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowEthernetPauseSrcCounter value in the PatternFlowEthernetPauseSrc object +func (obj *patternFlowEthernetPauseSrc) SetDecrement(value PatternFlowEthernetPauseSrcCounter) PatternFlowEthernetPauseSrc { + obj.setChoice(PatternFlowEthernetPauseSrcChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowEthernetPauseSrcMetricTag +func (obj *patternFlowEthernetPauseSrc) MetricTags() PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowEthernetPauseSrcMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter struct { + obj *patternFlowEthernetPauseSrc + patternFlowEthernetPauseSrcMetricTagSlice []PatternFlowEthernetPauseSrcMetricTag + fieldPtr *[]*otg.PatternFlowEthernetPauseSrcMetricTag +} + +func newPatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter(ptr *[]*otg.PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { + return &patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter interface { + setMsg(*patternFlowEthernetPauseSrc) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter + Items() []PatternFlowEthernetPauseSrcMetricTag + Add() PatternFlowEthernetPauseSrcMetricTag + Append(items ...PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter + Set(index int, newObj PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter + Clear() PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter + clearHolderSlice() PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter + appendHolderSlice(item PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter +} + +func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) setMsg(msg *patternFlowEthernetPauseSrc) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowEthernetPauseSrcMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) Items() []PatternFlowEthernetPauseSrcMetricTag { + return obj.patternFlowEthernetPauseSrcMetricTagSlice +} + +func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) Add() PatternFlowEthernetPauseSrcMetricTag { + newObj := &otg.PatternFlowEthernetPauseSrcMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowEthernetPauseSrcMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowEthernetPauseSrcMetricTagSlice = append(obj.patternFlowEthernetPauseSrcMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) Append(items ...PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowEthernetPauseSrcMetricTagSlice = append(obj.patternFlowEthernetPauseSrcMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) Set(index int, newObj PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowEthernetPauseSrcMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) Clear() PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowEthernetPauseSrcMetricTag{} + obj.patternFlowEthernetPauseSrcMetricTagSlice = []PatternFlowEthernetPauseSrcMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) clearHolderSlice() PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { + if len(obj.patternFlowEthernetPauseSrcMetricTagSlice) > 0 { + obj.patternFlowEthernetPauseSrcMetricTagSlice = []PatternFlowEthernetPauseSrcMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter) appendHolderSlice(item PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcPatternFlowEthernetPauseSrcMetricTagIter { + obj.patternFlowEthernetPauseSrcMetricTagSlice = append(obj.patternFlowEthernetPauseSrcMetricTagSlice, item) + return obj +} + +func (obj *patternFlowEthernetPauseSrc) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateMac(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseSrc.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateMacSlice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseSrc.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowEthernetPauseSrcMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowEthernetPauseSrc) setDefault() { + var choices_set int = 0 + var choice PatternFlowEthernetPauseSrcChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseSrcChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowEthernetPauseSrcChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseSrcChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseSrcChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowEthernetPauseSrcChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetPauseSrc") + } + } else { + intVal := otg.PatternFlowEthernetPauseSrc_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowEthernetPauseSrc_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_src_counter.go b/gosnappi/pattern_flow_ethernet_pause_src_counter.go new file mode 100644 index 00000000..dbeb9bfa --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_src_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowEthernetPauseSrcCounter ***** +type patternFlowEthernetPauseSrcCounter struct { + validation + obj *otg.PatternFlowEthernetPauseSrcCounter + marshaller marshalPatternFlowEthernetPauseSrcCounter + unMarshaller unMarshalPatternFlowEthernetPauseSrcCounter +} + +func NewPatternFlowEthernetPauseSrcCounter() PatternFlowEthernetPauseSrcCounter { + obj := patternFlowEthernetPauseSrcCounter{obj: &otg.PatternFlowEthernetPauseSrcCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseSrcCounter) msg() *otg.PatternFlowEthernetPauseSrcCounter { + return obj.obj +} + +func (obj *patternFlowEthernetPauseSrcCounter) setMsg(msg *otg.PatternFlowEthernetPauseSrcCounter) PatternFlowEthernetPauseSrcCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseSrcCounter struct { + obj *patternFlowEthernetPauseSrcCounter +} + +type marshalPatternFlowEthernetPauseSrcCounter interface { + // ToProto marshals PatternFlowEthernetPauseSrcCounter to protobuf object *otg.PatternFlowEthernetPauseSrcCounter + ToProto() (*otg.PatternFlowEthernetPauseSrcCounter, error) + // ToPbText marshals PatternFlowEthernetPauseSrcCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseSrcCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseSrcCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseSrcCounter struct { + obj *patternFlowEthernetPauseSrcCounter +} + +type unMarshalPatternFlowEthernetPauseSrcCounter interface { + // FromProto unmarshals PatternFlowEthernetPauseSrcCounter from protobuf object *otg.PatternFlowEthernetPauseSrcCounter + FromProto(msg *otg.PatternFlowEthernetPauseSrcCounter) (PatternFlowEthernetPauseSrcCounter, error) + // FromPbText unmarshals PatternFlowEthernetPauseSrcCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseSrcCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseSrcCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseSrcCounter) Marshal() marshalPatternFlowEthernetPauseSrcCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseSrcCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseSrcCounter) Unmarshal() unMarshalPatternFlowEthernetPauseSrcCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseSrcCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseSrcCounter) ToProto() (*otg.PatternFlowEthernetPauseSrcCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseSrcCounter) FromProto(msg *otg.PatternFlowEthernetPauseSrcCounter) (PatternFlowEthernetPauseSrcCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseSrcCounter) 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 *unMarshalpatternFlowEthernetPauseSrcCounter) 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 *marshalpatternFlowEthernetPauseSrcCounter) 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 *unMarshalpatternFlowEthernetPauseSrcCounter) 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 *marshalpatternFlowEthernetPauseSrcCounter) 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 *unMarshalpatternFlowEthernetPauseSrcCounter) 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 *patternFlowEthernetPauseSrcCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseSrcCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseSrcCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseSrcCounter) Clone() (PatternFlowEthernetPauseSrcCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseSrcCounter() + 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 +} + +// PatternFlowEthernetPauseSrcCounter is mac counter pattern +type PatternFlowEthernetPauseSrcCounter interface { + Validation + // msg marshals PatternFlowEthernetPauseSrcCounter to protobuf object *otg.PatternFlowEthernetPauseSrcCounter + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseSrcCounter + // setMsg unmarshals PatternFlowEthernetPauseSrcCounter from protobuf object *otg.PatternFlowEthernetPauseSrcCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseSrcCounter) PatternFlowEthernetPauseSrcCounter + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseSrcCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseSrcCounter + // validate validates PatternFlowEthernetPauseSrcCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseSrcCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowEthernetPauseSrcCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowEthernetPauseSrcCounter + SetStart(value string) PatternFlowEthernetPauseSrcCounter + // HasStart checks if Start has been set in PatternFlowEthernetPauseSrcCounter + HasStart() bool + // Step returns string, set in PatternFlowEthernetPauseSrcCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowEthernetPauseSrcCounter + SetStep(value string) PatternFlowEthernetPauseSrcCounter + // HasStep checks if Step has been set in PatternFlowEthernetPauseSrcCounter + HasStep() bool + // Count returns uint32, set in PatternFlowEthernetPauseSrcCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowEthernetPauseSrcCounter + SetCount(value uint32) PatternFlowEthernetPauseSrcCounter + // HasCount checks if Count has been set in PatternFlowEthernetPauseSrcCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowEthernetPauseSrcCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowEthernetPauseSrcCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowEthernetPauseSrcCounter object +func (obj *patternFlowEthernetPauseSrcCounter) SetStart(value string) PatternFlowEthernetPauseSrcCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowEthernetPauseSrcCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowEthernetPauseSrcCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowEthernetPauseSrcCounter object +func (obj *patternFlowEthernetPauseSrcCounter) SetStep(value string) PatternFlowEthernetPauseSrcCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetPauseSrcCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetPauseSrcCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowEthernetPauseSrcCounter object +func (obj *patternFlowEthernetPauseSrcCounter) SetCount(value uint32) PatternFlowEthernetPauseSrcCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowEthernetPauseSrcCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateMac(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseSrcCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateMac(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetPauseSrcCounter.Step")) + } + + } + +} + +func (obj *patternFlowEthernetPauseSrcCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("00:00:00:00:00:00") + } + if obj.obj.Step == nil { + obj.SetStep("00:00:00:00:00:01") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_src_metric_tag.go b/gosnappi/pattern_flow_ethernet_pause_src_metric_tag.go new file mode 100644 index 00000000..d8b2ca3e --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_src_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowEthernetPauseSrcMetricTag ***** +type patternFlowEthernetPauseSrcMetricTag struct { + validation + obj *otg.PatternFlowEthernetPauseSrcMetricTag + marshaller marshalPatternFlowEthernetPauseSrcMetricTag + unMarshaller unMarshalPatternFlowEthernetPauseSrcMetricTag +} + +func NewPatternFlowEthernetPauseSrcMetricTag() PatternFlowEthernetPauseSrcMetricTag { + obj := patternFlowEthernetPauseSrcMetricTag{obj: &otg.PatternFlowEthernetPauseSrcMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseSrcMetricTag) msg() *otg.PatternFlowEthernetPauseSrcMetricTag { + return obj.obj +} + +func (obj *patternFlowEthernetPauseSrcMetricTag) setMsg(msg *otg.PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseSrcMetricTag struct { + obj *patternFlowEthernetPauseSrcMetricTag +} + +type marshalPatternFlowEthernetPauseSrcMetricTag interface { + // ToProto marshals PatternFlowEthernetPauseSrcMetricTag to protobuf object *otg.PatternFlowEthernetPauseSrcMetricTag + ToProto() (*otg.PatternFlowEthernetPauseSrcMetricTag, error) + // ToPbText marshals PatternFlowEthernetPauseSrcMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseSrcMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseSrcMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseSrcMetricTag struct { + obj *patternFlowEthernetPauseSrcMetricTag +} + +type unMarshalPatternFlowEthernetPauseSrcMetricTag interface { + // FromProto unmarshals PatternFlowEthernetPauseSrcMetricTag from protobuf object *otg.PatternFlowEthernetPauseSrcMetricTag + FromProto(msg *otg.PatternFlowEthernetPauseSrcMetricTag) (PatternFlowEthernetPauseSrcMetricTag, error) + // FromPbText unmarshals PatternFlowEthernetPauseSrcMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseSrcMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseSrcMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseSrcMetricTag) Marshal() marshalPatternFlowEthernetPauseSrcMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseSrcMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseSrcMetricTag) Unmarshal() unMarshalPatternFlowEthernetPauseSrcMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseSrcMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseSrcMetricTag) ToProto() (*otg.PatternFlowEthernetPauseSrcMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseSrcMetricTag) FromProto(msg *otg.PatternFlowEthernetPauseSrcMetricTag) (PatternFlowEthernetPauseSrcMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseSrcMetricTag) 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 *unMarshalpatternFlowEthernetPauseSrcMetricTag) 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 *marshalpatternFlowEthernetPauseSrcMetricTag) 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 *unMarshalpatternFlowEthernetPauseSrcMetricTag) 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 *marshalpatternFlowEthernetPauseSrcMetricTag) 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 *unMarshalpatternFlowEthernetPauseSrcMetricTag) 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 *patternFlowEthernetPauseSrcMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseSrcMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseSrcMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseSrcMetricTag) Clone() (PatternFlowEthernetPauseSrcMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseSrcMetricTag() + 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 +} + +// PatternFlowEthernetPauseSrcMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowEthernetPauseSrcMetricTag interface { + Validation + // msg marshals PatternFlowEthernetPauseSrcMetricTag to protobuf object *otg.PatternFlowEthernetPauseSrcMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseSrcMetricTag + // setMsg unmarshals PatternFlowEthernetPauseSrcMetricTag from protobuf object *otg.PatternFlowEthernetPauseSrcMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseSrcMetricTag) PatternFlowEthernetPauseSrcMetricTag + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseSrcMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseSrcMetricTag + // validate validates PatternFlowEthernetPauseSrcMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseSrcMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowEthernetPauseSrcMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowEthernetPauseSrcMetricTag + SetName(value string) PatternFlowEthernetPauseSrcMetricTag + // Offset returns uint32, set in PatternFlowEthernetPauseSrcMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowEthernetPauseSrcMetricTag + SetOffset(value uint32) PatternFlowEthernetPauseSrcMetricTag + // HasOffset checks if Offset has been set in PatternFlowEthernetPauseSrcMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowEthernetPauseSrcMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowEthernetPauseSrcMetricTag + SetLength(value uint32) PatternFlowEthernetPauseSrcMetricTag + // HasLength checks if Length has been set in PatternFlowEthernetPauseSrcMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowEthernetPauseSrcMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowEthernetPauseSrcMetricTag object +func (obj *patternFlowEthernetPauseSrcMetricTag) SetName(value string) PatternFlowEthernetPauseSrcMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetPauseSrcMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetPauseSrcMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowEthernetPauseSrcMetricTag object +func (obj *patternFlowEthernetPauseSrcMetricTag) SetOffset(value uint32) PatternFlowEthernetPauseSrcMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetPauseSrcMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetPauseSrcMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowEthernetPauseSrcMetricTag object +func (obj *patternFlowEthernetPauseSrcMetricTag) SetLength(value uint32) PatternFlowEthernetPauseSrcMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowEthernetPauseSrcMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetPauseSrcMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 47 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseSrcMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 48 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowEthernetPauseSrcMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowEthernetPauseSrcMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(48) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_time.go b/gosnappi/pattern_flow_ethernet_pause_time.go new file mode 100644 index 00000000..3ae97818 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_time.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowEthernetPauseTime ***** +type patternFlowEthernetPauseTime struct { + validation + obj *otg.PatternFlowEthernetPauseTime + marshaller marshalPatternFlowEthernetPauseTime + unMarshaller unMarshalPatternFlowEthernetPauseTime + incrementHolder PatternFlowEthernetPauseTimeCounter + decrementHolder PatternFlowEthernetPauseTimeCounter + metricTagsHolder PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter +} + +func NewPatternFlowEthernetPauseTime() PatternFlowEthernetPauseTime { + obj := patternFlowEthernetPauseTime{obj: &otg.PatternFlowEthernetPauseTime{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseTime) msg() *otg.PatternFlowEthernetPauseTime { + return obj.obj +} + +func (obj *patternFlowEthernetPauseTime) setMsg(msg *otg.PatternFlowEthernetPauseTime) PatternFlowEthernetPauseTime { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseTime struct { + obj *patternFlowEthernetPauseTime +} + +type marshalPatternFlowEthernetPauseTime interface { + // ToProto marshals PatternFlowEthernetPauseTime to protobuf object *otg.PatternFlowEthernetPauseTime + ToProto() (*otg.PatternFlowEthernetPauseTime, error) + // ToPbText marshals PatternFlowEthernetPauseTime to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseTime to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseTime to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseTime struct { + obj *patternFlowEthernetPauseTime +} + +type unMarshalPatternFlowEthernetPauseTime interface { + // FromProto unmarshals PatternFlowEthernetPauseTime from protobuf object *otg.PatternFlowEthernetPauseTime + FromProto(msg *otg.PatternFlowEthernetPauseTime) (PatternFlowEthernetPauseTime, error) + // FromPbText unmarshals PatternFlowEthernetPauseTime from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseTime from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseTime from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseTime) Marshal() marshalPatternFlowEthernetPauseTime { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseTime{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseTime) Unmarshal() unMarshalPatternFlowEthernetPauseTime { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseTime{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseTime) ToProto() (*otg.PatternFlowEthernetPauseTime, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseTime) FromProto(msg *otg.PatternFlowEthernetPauseTime) (PatternFlowEthernetPauseTime, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseTime) 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 *unMarshalpatternFlowEthernetPauseTime) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowEthernetPauseTime) 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 *unMarshalpatternFlowEthernetPauseTime) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowEthernetPauseTime) 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 *unMarshalpatternFlowEthernetPauseTime) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowEthernetPauseTime) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseTime) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseTime) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseTime) Clone() (PatternFlowEthernetPauseTime, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseTime() + 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 +} + +func (obj *patternFlowEthernetPauseTime) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowEthernetPauseTime is time +type PatternFlowEthernetPauseTime interface { + Validation + // msg marshals PatternFlowEthernetPauseTime to protobuf object *otg.PatternFlowEthernetPauseTime + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseTime + // setMsg unmarshals PatternFlowEthernetPauseTime from protobuf object *otg.PatternFlowEthernetPauseTime + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseTime) PatternFlowEthernetPauseTime + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseTime + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseTime + // validate validates PatternFlowEthernetPauseTime + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseTime, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowEthernetPauseTimeChoiceEnum, set in PatternFlowEthernetPauseTime + Choice() PatternFlowEthernetPauseTimeChoiceEnum + // setChoice assigns PatternFlowEthernetPauseTimeChoiceEnum provided by user to PatternFlowEthernetPauseTime + setChoice(value PatternFlowEthernetPauseTimeChoiceEnum) PatternFlowEthernetPauseTime + // HasChoice checks if Choice has been set in PatternFlowEthernetPauseTime + HasChoice() bool + // Value returns uint32, set in PatternFlowEthernetPauseTime. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowEthernetPauseTime + SetValue(value uint32) PatternFlowEthernetPauseTime + // HasValue checks if Value has been set in PatternFlowEthernetPauseTime + HasValue() bool + // Values returns []uint32, set in PatternFlowEthernetPauseTime. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowEthernetPauseTime + SetValues(value []uint32) PatternFlowEthernetPauseTime + // Increment returns PatternFlowEthernetPauseTimeCounter, set in PatternFlowEthernetPauseTime. + // PatternFlowEthernetPauseTimeCounter is integer counter pattern + Increment() PatternFlowEthernetPauseTimeCounter + // SetIncrement assigns PatternFlowEthernetPauseTimeCounter provided by user to PatternFlowEthernetPauseTime. + // PatternFlowEthernetPauseTimeCounter is integer counter pattern + SetIncrement(value PatternFlowEthernetPauseTimeCounter) PatternFlowEthernetPauseTime + // HasIncrement checks if Increment has been set in PatternFlowEthernetPauseTime + HasIncrement() bool + // Decrement returns PatternFlowEthernetPauseTimeCounter, set in PatternFlowEthernetPauseTime. + // PatternFlowEthernetPauseTimeCounter is integer counter pattern + Decrement() PatternFlowEthernetPauseTimeCounter + // SetDecrement assigns PatternFlowEthernetPauseTimeCounter provided by user to PatternFlowEthernetPauseTime. + // PatternFlowEthernetPauseTimeCounter is integer counter pattern + SetDecrement(value PatternFlowEthernetPauseTimeCounter) PatternFlowEthernetPauseTime + // HasDecrement checks if Decrement has been set in PatternFlowEthernetPauseTime + HasDecrement() bool + // MetricTags returns PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIterIter, set in PatternFlowEthernetPauseTime + MetricTags() PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter + setNil() +} + +type PatternFlowEthernetPauseTimeChoiceEnum string + +// Enum of Choice on PatternFlowEthernetPauseTime +var PatternFlowEthernetPauseTimeChoice = struct { + VALUE PatternFlowEthernetPauseTimeChoiceEnum + VALUES PatternFlowEthernetPauseTimeChoiceEnum + INCREMENT PatternFlowEthernetPauseTimeChoiceEnum + DECREMENT PatternFlowEthernetPauseTimeChoiceEnum +}{ + VALUE: PatternFlowEthernetPauseTimeChoiceEnum("value"), + VALUES: PatternFlowEthernetPauseTimeChoiceEnum("values"), + INCREMENT: PatternFlowEthernetPauseTimeChoiceEnum("increment"), + DECREMENT: PatternFlowEthernetPauseTimeChoiceEnum("decrement"), +} + +func (obj *patternFlowEthernetPauseTime) Choice() PatternFlowEthernetPauseTimeChoiceEnum { + return PatternFlowEthernetPauseTimeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowEthernetPauseTime) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowEthernetPauseTime) setChoice(value PatternFlowEthernetPauseTimeChoiceEnum) PatternFlowEthernetPauseTime { + intValue, ok := otg.PatternFlowEthernetPauseTime_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowEthernetPauseTimeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowEthernetPauseTime_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowEthernetPauseTimeChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowEthernetPauseTimeChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowEthernetPauseTimeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowEthernetPauseTimeCounter().msg() + } + + if value == PatternFlowEthernetPauseTimeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowEthernetPauseTimeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowEthernetPauseTime) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowEthernetPauseTimeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowEthernetPauseTime) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowEthernetPauseTime object +func (obj *patternFlowEthernetPauseTime) SetValue(value uint32) PatternFlowEthernetPauseTime { + obj.setChoice(PatternFlowEthernetPauseTimeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowEthernetPauseTime) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowEthernetPauseTime object +func (obj *patternFlowEthernetPauseTime) SetValues(value []uint32) PatternFlowEthernetPauseTime { + obj.setChoice(PatternFlowEthernetPauseTimeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowEthernetPauseTimeCounter +func (obj *patternFlowEthernetPauseTime) Increment() PatternFlowEthernetPauseTimeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowEthernetPauseTimeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowEthernetPauseTimeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowEthernetPauseTimeCounter +func (obj *patternFlowEthernetPauseTime) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowEthernetPauseTimeCounter value in the PatternFlowEthernetPauseTime object +func (obj *patternFlowEthernetPauseTime) SetIncrement(value PatternFlowEthernetPauseTimeCounter) PatternFlowEthernetPauseTime { + obj.setChoice(PatternFlowEthernetPauseTimeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowEthernetPauseTimeCounter +func (obj *patternFlowEthernetPauseTime) Decrement() PatternFlowEthernetPauseTimeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowEthernetPauseTimeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowEthernetPauseTimeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowEthernetPauseTimeCounter +func (obj *patternFlowEthernetPauseTime) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowEthernetPauseTimeCounter value in the PatternFlowEthernetPauseTime object +func (obj *patternFlowEthernetPauseTime) SetDecrement(value PatternFlowEthernetPauseTimeCounter) PatternFlowEthernetPauseTime { + obj.setChoice(PatternFlowEthernetPauseTimeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowEthernetPauseTimeMetricTag +func (obj *patternFlowEthernetPauseTime) MetricTags() PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowEthernetPauseTimeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter struct { + obj *patternFlowEthernetPauseTime + patternFlowEthernetPauseTimeMetricTagSlice []PatternFlowEthernetPauseTimeMetricTag + fieldPtr *[]*otg.PatternFlowEthernetPauseTimeMetricTag +} + +func newPatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter(ptr *[]*otg.PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { + return &patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter interface { + setMsg(*patternFlowEthernetPauseTime) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter + Items() []PatternFlowEthernetPauseTimeMetricTag + Add() PatternFlowEthernetPauseTimeMetricTag + Append(items ...PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter + Set(index int, newObj PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter + Clear() PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter + clearHolderSlice() PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter + appendHolderSlice(item PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter +} + +func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) setMsg(msg *patternFlowEthernetPauseTime) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowEthernetPauseTimeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) Items() []PatternFlowEthernetPauseTimeMetricTag { + return obj.patternFlowEthernetPauseTimeMetricTagSlice +} + +func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) Add() PatternFlowEthernetPauseTimeMetricTag { + newObj := &otg.PatternFlowEthernetPauseTimeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowEthernetPauseTimeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowEthernetPauseTimeMetricTagSlice = append(obj.patternFlowEthernetPauseTimeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) Append(items ...PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowEthernetPauseTimeMetricTagSlice = append(obj.patternFlowEthernetPauseTimeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) Set(index int, newObj PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowEthernetPauseTimeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) Clear() PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowEthernetPauseTimeMetricTag{} + obj.patternFlowEthernetPauseTimeMetricTagSlice = []PatternFlowEthernetPauseTimeMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) clearHolderSlice() PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { + if len(obj.patternFlowEthernetPauseTimeMetricTagSlice) > 0 { + obj.patternFlowEthernetPauseTimeMetricTagSlice = []PatternFlowEthernetPauseTimeMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter) appendHolderSlice(item PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimePatternFlowEthernetPauseTimeMetricTagIter { + obj.patternFlowEthernetPauseTimeMetricTagSlice = append(obj.patternFlowEthernetPauseTimeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowEthernetPauseTime) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseTime.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowEthernetPauseTime.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowEthernetPauseTimeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowEthernetPauseTime) setDefault() { + var choices_set int = 0 + var choice PatternFlowEthernetPauseTimeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseTimeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowEthernetPauseTimeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseTimeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowEthernetPauseTimeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowEthernetPauseTimeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetPauseTime") + } + } else { + intVal := otg.PatternFlowEthernetPauseTime_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowEthernetPauseTime_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_time_counter.go b/gosnappi/pattern_flow_ethernet_pause_time_counter.go new file mode 100644 index 00000000..18aba2da --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_time_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowEthernetPauseTimeCounter ***** +type patternFlowEthernetPauseTimeCounter struct { + validation + obj *otg.PatternFlowEthernetPauseTimeCounter + marshaller marshalPatternFlowEthernetPauseTimeCounter + unMarshaller unMarshalPatternFlowEthernetPauseTimeCounter +} + +func NewPatternFlowEthernetPauseTimeCounter() PatternFlowEthernetPauseTimeCounter { + obj := patternFlowEthernetPauseTimeCounter{obj: &otg.PatternFlowEthernetPauseTimeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseTimeCounter) msg() *otg.PatternFlowEthernetPauseTimeCounter { + return obj.obj +} + +func (obj *patternFlowEthernetPauseTimeCounter) setMsg(msg *otg.PatternFlowEthernetPauseTimeCounter) PatternFlowEthernetPauseTimeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseTimeCounter struct { + obj *patternFlowEthernetPauseTimeCounter +} + +type marshalPatternFlowEthernetPauseTimeCounter interface { + // ToProto marshals PatternFlowEthernetPauseTimeCounter to protobuf object *otg.PatternFlowEthernetPauseTimeCounter + ToProto() (*otg.PatternFlowEthernetPauseTimeCounter, error) + // ToPbText marshals PatternFlowEthernetPauseTimeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseTimeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseTimeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseTimeCounter struct { + obj *patternFlowEthernetPauseTimeCounter +} + +type unMarshalPatternFlowEthernetPauseTimeCounter interface { + // FromProto unmarshals PatternFlowEthernetPauseTimeCounter from protobuf object *otg.PatternFlowEthernetPauseTimeCounter + FromProto(msg *otg.PatternFlowEthernetPauseTimeCounter) (PatternFlowEthernetPauseTimeCounter, error) + // FromPbText unmarshals PatternFlowEthernetPauseTimeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseTimeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseTimeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseTimeCounter) Marshal() marshalPatternFlowEthernetPauseTimeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseTimeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseTimeCounter) Unmarshal() unMarshalPatternFlowEthernetPauseTimeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseTimeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseTimeCounter) ToProto() (*otg.PatternFlowEthernetPauseTimeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseTimeCounter) FromProto(msg *otg.PatternFlowEthernetPauseTimeCounter) (PatternFlowEthernetPauseTimeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseTimeCounter) 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 *unMarshalpatternFlowEthernetPauseTimeCounter) 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 *marshalpatternFlowEthernetPauseTimeCounter) 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 *unMarshalpatternFlowEthernetPauseTimeCounter) 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 *marshalpatternFlowEthernetPauseTimeCounter) 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 *unMarshalpatternFlowEthernetPauseTimeCounter) 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 *patternFlowEthernetPauseTimeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseTimeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseTimeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseTimeCounter) Clone() (PatternFlowEthernetPauseTimeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseTimeCounter() + 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 +} + +// PatternFlowEthernetPauseTimeCounter is integer counter pattern +type PatternFlowEthernetPauseTimeCounter interface { + Validation + // msg marshals PatternFlowEthernetPauseTimeCounter to protobuf object *otg.PatternFlowEthernetPauseTimeCounter + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseTimeCounter + // setMsg unmarshals PatternFlowEthernetPauseTimeCounter from protobuf object *otg.PatternFlowEthernetPauseTimeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseTimeCounter) PatternFlowEthernetPauseTimeCounter + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseTimeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseTimeCounter + // validate validates PatternFlowEthernetPauseTimeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseTimeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowEthernetPauseTimeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowEthernetPauseTimeCounter + SetStart(value uint32) PatternFlowEthernetPauseTimeCounter + // HasStart checks if Start has been set in PatternFlowEthernetPauseTimeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowEthernetPauseTimeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowEthernetPauseTimeCounter + SetStep(value uint32) PatternFlowEthernetPauseTimeCounter + // HasStep checks if Step has been set in PatternFlowEthernetPauseTimeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowEthernetPauseTimeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowEthernetPauseTimeCounter + SetCount(value uint32) PatternFlowEthernetPauseTimeCounter + // HasCount checks if Count has been set in PatternFlowEthernetPauseTimeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowEthernetPauseTimeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowEthernetPauseTimeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowEthernetPauseTimeCounter object +func (obj *patternFlowEthernetPauseTimeCounter) SetStart(value uint32) PatternFlowEthernetPauseTimeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowEthernetPauseTimeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowEthernetPauseTimeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowEthernetPauseTimeCounter object +func (obj *patternFlowEthernetPauseTimeCounter) SetStep(value uint32) PatternFlowEthernetPauseTimeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetPauseTimeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetPauseTimeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowEthernetPauseTimeCounter object +func (obj *patternFlowEthernetPauseTimeCounter) SetCount(value uint32) PatternFlowEthernetPauseTimeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowEthernetPauseTimeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseTimeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseTimeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseTimeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowEthernetPauseTimeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pause_time_metric_tag.go b/gosnappi/pattern_flow_ethernet_pause_time_metric_tag.go new file mode 100644 index 00000000..b8f06048 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pause_time_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowEthernetPauseTimeMetricTag ***** +type patternFlowEthernetPauseTimeMetricTag struct { + validation + obj *otg.PatternFlowEthernetPauseTimeMetricTag + marshaller marshalPatternFlowEthernetPauseTimeMetricTag + unMarshaller unMarshalPatternFlowEthernetPauseTimeMetricTag +} + +func NewPatternFlowEthernetPauseTimeMetricTag() PatternFlowEthernetPauseTimeMetricTag { + obj := patternFlowEthernetPauseTimeMetricTag{obj: &otg.PatternFlowEthernetPauseTimeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPauseTimeMetricTag) msg() *otg.PatternFlowEthernetPauseTimeMetricTag { + return obj.obj +} + +func (obj *patternFlowEthernetPauseTimeMetricTag) setMsg(msg *otg.PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPauseTimeMetricTag struct { + obj *patternFlowEthernetPauseTimeMetricTag +} + +type marshalPatternFlowEthernetPauseTimeMetricTag interface { + // ToProto marshals PatternFlowEthernetPauseTimeMetricTag to protobuf object *otg.PatternFlowEthernetPauseTimeMetricTag + ToProto() (*otg.PatternFlowEthernetPauseTimeMetricTag, error) + // ToPbText marshals PatternFlowEthernetPauseTimeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPauseTimeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPauseTimeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPauseTimeMetricTag struct { + obj *patternFlowEthernetPauseTimeMetricTag +} + +type unMarshalPatternFlowEthernetPauseTimeMetricTag interface { + // FromProto unmarshals PatternFlowEthernetPauseTimeMetricTag from protobuf object *otg.PatternFlowEthernetPauseTimeMetricTag + FromProto(msg *otg.PatternFlowEthernetPauseTimeMetricTag) (PatternFlowEthernetPauseTimeMetricTag, error) + // FromPbText unmarshals PatternFlowEthernetPauseTimeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPauseTimeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPauseTimeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPauseTimeMetricTag) Marshal() marshalPatternFlowEthernetPauseTimeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPauseTimeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPauseTimeMetricTag) Unmarshal() unMarshalPatternFlowEthernetPauseTimeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPauseTimeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPauseTimeMetricTag) ToProto() (*otg.PatternFlowEthernetPauseTimeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPauseTimeMetricTag) FromProto(msg *otg.PatternFlowEthernetPauseTimeMetricTag) (PatternFlowEthernetPauseTimeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPauseTimeMetricTag) 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 *unMarshalpatternFlowEthernetPauseTimeMetricTag) 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 *marshalpatternFlowEthernetPauseTimeMetricTag) 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 *unMarshalpatternFlowEthernetPauseTimeMetricTag) 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 *marshalpatternFlowEthernetPauseTimeMetricTag) 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 *unMarshalpatternFlowEthernetPauseTimeMetricTag) 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 *patternFlowEthernetPauseTimeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseTimeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPauseTimeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPauseTimeMetricTag) Clone() (PatternFlowEthernetPauseTimeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPauseTimeMetricTag() + 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 +} + +// PatternFlowEthernetPauseTimeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowEthernetPauseTimeMetricTag interface { + Validation + // msg marshals PatternFlowEthernetPauseTimeMetricTag to protobuf object *otg.PatternFlowEthernetPauseTimeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPauseTimeMetricTag + // setMsg unmarshals PatternFlowEthernetPauseTimeMetricTag from protobuf object *otg.PatternFlowEthernetPauseTimeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPauseTimeMetricTag) PatternFlowEthernetPauseTimeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowEthernetPauseTimeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPauseTimeMetricTag + // validate validates PatternFlowEthernetPauseTimeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPauseTimeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowEthernetPauseTimeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowEthernetPauseTimeMetricTag + SetName(value string) PatternFlowEthernetPauseTimeMetricTag + // Offset returns uint32, set in PatternFlowEthernetPauseTimeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowEthernetPauseTimeMetricTag + SetOffset(value uint32) PatternFlowEthernetPauseTimeMetricTag + // HasOffset checks if Offset has been set in PatternFlowEthernetPauseTimeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowEthernetPauseTimeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowEthernetPauseTimeMetricTag + SetLength(value uint32) PatternFlowEthernetPauseTimeMetricTag + // HasLength checks if Length has been set in PatternFlowEthernetPauseTimeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowEthernetPauseTimeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowEthernetPauseTimeMetricTag object +func (obj *patternFlowEthernetPauseTimeMetricTag) SetName(value string) PatternFlowEthernetPauseTimeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetPauseTimeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetPauseTimeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowEthernetPauseTimeMetricTag object +func (obj *patternFlowEthernetPauseTimeMetricTag) SetOffset(value uint32) PatternFlowEthernetPauseTimeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetPauseTimeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetPauseTimeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowEthernetPauseTimeMetricTag object +func (obj *patternFlowEthernetPauseTimeMetricTag) SetLength(value uint32) PatternFlowEthernetPauseTimeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowEthernetPauseTimeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetPauseTimeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPauseTimeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowEthernetPauseTimeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowEthernetPauseTimeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pfc_queue.go b/gosnappi/pattern_flow_ethernet_pfc_queue.go new file mode 100644 index 00000000..f07be22d --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pfc_queue.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowEthernetPfcQueue ***** +type patternFlowEthernetPfcQueue struct { + validation + obj *otg.PatternFlowEthernetPfcQueue + marshaller marshalPatternFlowEthernetPfcQueue + unMarshaller unMarshalPatternFlowEthernetPfcQueue + incrementHolder PatternFlowEthernetPfcQueueCounter + decrementHolder PatternFlowEthernetPfcQueueCounter + metricTagsHolder PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter +} + +func NewPatternFlowEthernetPfcQueue() PatternFlowEthernetPfcQueue { + obj := patternFlowEthernetPfcQueue{obj: &otg.PatternFlowEthernetPfcQueue{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPfcQueue) msg() *otg.PatternFlowEthernetPfcQueue { + return obj.obj +} + +func (obj *patternFlowEthernetPfcQueue) setMsg(msg *otg.PatternFlowEthernetPfcQueue) PatternFlowEthernetPfcQueue { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPfcQueue struct { + obj *patternFlowEthernetPfcQueue +} + +type marshalPatternFlowEthernetPfcQueue interface { + // ToProto marshals PatternFlowEthernetPfcQueue to protobuf object *otg.PatternFlowEthernetPfcQueue + ToProto() (*otg.PatternFlowEthernetPfcQueue, error) + // ToPbText marshals PatternFlowEthernetPfcQueue to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPfcQueue to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPfcQueue to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPfcQueue struct { + obj *patternFlowEthernetPfcQueue +} + +type unMarshalPatternFlowEthernetPfcQueue interface { + // FromProto unmarshals PatternFlowEthernetPfcQueue from protobuf object *otg.PatternFlowEthernetPfcQueue + FromProto(msg *otg.PatternFlowEthernetPfcQueue) (PatternFlowEthernetPfcQueue, error) + // FromPbText unmarshals PatternFlowEthernetPfcQueue from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPfcQueue from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPfcQueue from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPfcQueue) Marshal() marshalPatternFlowEthernetPfcQueue { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPfcQueue{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPfcQueue) Unmarshal() unMarshalPatternFlowEthernetPfcQueue { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPfcQueue{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPfcQueue) ToProto() (*otg.PatternFlowEthernetPfcQueue, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPfcQueue) FromProto(msg *otg.PatternFlowEthernetPfcQueue) (PatternFlowEthernetPfcQueue, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPfcQueue) 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 *unMarshalpatternFlowEthernetPfcQueue) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowEthernetPfcQueue) 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 *unMarshalpatternFlowEthernetPfcQueue) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowEthernetPfcQueue) 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 *unMarshalpatternFlowEthernetPfcQueue) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowEthernetPfcQueue) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPfcQueue) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPfcQueue) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPfcQueue) Clone() (PatternFlowEthernetPfcQueue, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPfcQueue() + 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 +} + +func (obj *patternFlowEthernetPfcQueue) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowEthernetPfcQueue is priority flow control queue +type PatternFlowEthernetPfcQueue interface { + Validation + // msg marshals PatternFlowEthernetPfcQueue to protobuf object *otg.PatternFlowEthernetPfcQueue + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPfcQueue + // setMsg unmarshals PatternFlowEthernetPfcQueue from protobuf object *otg.PatternFlowEthernetPfcQueue + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPfcQueue) PatternFlowEthernetPfcQueue + // provides marshal interface + Marshal() marshalPatternFlowEthernetPfcQueue + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPfcQueue + // validate validates PatternFlowEthernetPfcQueue + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPfcQueue, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowEthernetPfcQueueChoiceEnum, set in PatternFlowEthernetPfcQueue + Choice() PatternFlowEthernetPfcQueueChoiceEnum + // setChoice assigns PatternFlowEthernetPfcQueueChoiceEnum provided by user to PatternFlowEthernetPfcQueue + setChoice(value PatternFlowEthernetPfcQueueChoiceEnum) PatternFlowEthernetPfcQueue + // HasChoice checks if Choice has been set in PatternFlowEthernetPfcQueue + HasChoice() bool + // Value returns uint32, set in PatternFlowEthernetPfcQueue. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowEthernetPfcQueue + SetValue(value uint32) PatternFlowEthernetPfcQueue + // HasValue checks if Value has been set in PatternFlowEthernetPfcQueue + HasValue() bool + // Values returns []uint32, set in PatternFlowEthernetPfcQueue. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowEthernetPfcQueue + SetValues(value []uint32) PatternFlowEthernetPfcQueue + // Increment returns PatternFlowEthernetPfcQueueCounter, set in PatternFlowEthernetPfcQueue. + // PatternFlowEthernetPfcQueueCounter is integer counter pattern + Increment() PatternFlowEthernetPfcQueueCounter + // SetIncrement assigns PatternFlowEthernetPfcQueueCounter provided by user to PatternFlowEthernetPfcQueue. + // PatternFlowEthernetPfcQueueCounter is integer counter pattern + SetIncrement(value PatternFlowEthernetPfcQueueCounter) PatternFlowEthernetPfcQueue + // HasIncrement checks if Increment has been set in PatternFlowEthernetPfcQueue + HasIncrement() bool + // Decrement returns PatternFlowEthernetPfcQueueCounter, set in PatternFlowEthernetPfcQueue. + // PatternFlowEthernetPfcQueueCounter is integer counter pattern + Decrement() PatternFlowEthernetPfcQueueCounter + // SetDecrement assigns PatternFlowEthernetPfcQueueCounter provided by user to PatternFlowEthernetPfcQueue. + // PatternFlowEthernetPfcQueueCounter is integer counter pattern + SetDecrement(value PatternFlowEthernetPfcQueueCounter) PatternFlowEthernetPfcQueue + // HasDecrement checks if Decrement has been set in PatternFlowEthernetPfcQueue + HasDecrement() bool + // MetricTags returns PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIterIter, set in PatternFlowEthernetPfcQueue + MetricTags() PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter + setNil() +} + +type PatternFlowEthernetPfcQueueChoiceEnum string + +// Enum of Choice on PatternFlowEthernetPfcQueue +var PatternFlowEthernetPfcQueueChoice = struct { + VALUE PatternFlowEthernetPfcQueueChoiceEnum + VALUES PatternFlowEthernetPfcQueueChoiceEnum + INCREMENT PatternFlowEthernetPfcQueueChoiceEnum + DECREMENT PatternFlowEthernetPfcQueueChoiceEnum +}{ + VALUE: PatternFlowEthernetPfcQueueChoiceEnum("value"), + VALUES: PatternFlowEthernetPfcQueueChoiceEnum("values"), + INCREMENT: PatternFlowEthernetPfcQueueChoiceEnum("increment"), + DECREMENT: PatternFlowEthernetPfcQueueChoiceEnum("decrement"), +} + +func (obj *patternFlowEthernetPfcQueue) Choice() PatternFlowEthernetPfcQueueChoiceEnum { + return PatternFlowEthernetPfcQueueChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowEthernetPfcQueue) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowEthernetPfcQueue) setChoice(value PatternFlowEthernetPfcQueueChoiceEnum) PatternFlowEthernetPfcQueue { + intValue, ok := otg.PatternFlowEthernetPfcQueue_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowEthernetPfcQueueChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowEthernetPfcQueue_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowEthernetPfcQueueChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowEthernetPfcQueueChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowEthernetPfcQueueChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowEthernetPfcQueueCounter().msg() + } + + if value == PatternFlowEthernetPfcQueueChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowEthernetPfcQueueCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowEthernetPfcQueue) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowEthernetPfcQueueChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowEthernetPfcQueue) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowEthernetPfcQueue object +func (obj *patternFlowEthernetPfcQueue) SetValue(value uint32) PatternFlowEthernetPfcQueue { + obj.setChoice(PatternFlowEthernetPfcQueueChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowEthernetPfcQueue) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowEthernetPfcQueue object +func (obj *patternFlowEthernetPfcQueue) SetValues(value []uint32) PatternFlowEthernetPfcQueue { + obj.setChoice(PatternFlowEthernetPfcQueueChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowEthernetPfcQueueCounter +func (obj *patternFlowEthernetPfcQueue) Increment() PatternFlowEthernetPfcQueueCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowEthernetPfcQueueChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowEthernetPfcQueueCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowEthernetPfcQueueCounter +func (obj *patternFlowEthernetPfcQueue) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowEthernetPfcQueueCounter value in the PatternFlowEthernetPfcQueue object +func (obj *patternFlowEthernetPfcQueue) SetIncrement(value PatternFlowEthernetPfcQueueCounter) PatternFlowEthernetPfcQueue { + obj.setChoice(PatternFlowEthernetPfcQueueChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowEthernetPfcQueueCounter +func (obj *patternFlowEthernetPfcQueue) Decrement() PatternFlowEthernetPfcQueueCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowEthernetPfcQueueChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowEthernetPfcQueueCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowEthernetPfcQueueCounter +func (obj *patternFlowEthernetPfcQueue) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowEthernetPfcQueueCounter value in the PatternFlowEthernetPfcQueue object +func (obj *patternFlowEthernetPfcQueue) SetDecrement(value PatternFlowEthernetPfcQueueCounter) PatternFlowEthernetPfcQueue { + obj.setChoice(PatternFlowEthernetPfcQueueChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowEthernetPfcQueueMetricTag +func (obj *patternFlowEthernetPfcQueue) MetricTags() PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowEthernetPfcQueueMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter struct { + obj *patternFlowEthernetPfcQueue + patternFlowEthernetPfcQueueMetricTagSlice []PatternFlowEthernetPfcQueueMetricTag + fieldPtr *[]*otg.PatternFlowEthernetPfcQueueMetricTag +} + +func newPatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter(ptr *[]*otg.PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { + return &patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter interface { + setMsg(*patternFlowEthernetPfcQueue) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter + Items() []PatternFlowEthernetPfcQueueMetricTag + Add() PatternFlowEthernetPfcQueueMetricTag + Append(items ...PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter + Set(index int, newObj PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter + Clear() PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter + clearHolderSlice() PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter + appendHolderSlice(item PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter +} + +func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) setMsg(msg *patternFlowEthernetPfcQueue) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowEthernetPfcQueueMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) Items() []PatternFlowEthernetPfcQueueMetricTag { + return obj.patternFlowEthernetPfcQueueMetricTagSlice +} + +func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) Add() PatternFlowEthernetPfcQueueMetricTag { + newObj := &otg.PatternFlowEthernetPfcQueueMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowEthernetPfcQueueMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowEthernetPfcQueueMetricTagSlice = append(obj.patternFlowEthernetPfcQueueMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) Append(items ...PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowEthernetPfcQueueMetricTagSlice = append(obj.patternFlowEthernetPfcQueueMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) Set(index int, newObj PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowEthernetPfcQueueMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) Clear() PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowEthernetPfcQueueMetricTag{} + obj.patternFlowEthernetPfcQueueMetricTagSlice = []PatternFlowEthernetPfcQueueMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) clearHolderSlice() PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { + if len(obj.patternFlowEthernetPfcQueueMetricTagSlice) > 0 { + obj.patternFlowEthernetPfcQueueMetricTagSlice = []PatternFlowEthernetPfcQueueMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter) appendHolderSlice(item PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueuePatternFlowEthernetPfcQueueMetricTagIter { + obj.patternFlowEthernetPfcQueueMetricTagSlice = append(obj.patternFlowEthernetPfcQueueMetricTagSlice, item) + return obj +} + +func (obj *patternFlowEthernetPfcQueue) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPfcQueue.Value <= 7 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowEthernetPfcQueue.Values <= 7 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowEthernetPfcQueueMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowEthernetPfcQueue) setDefault() { + var choices_set int = 0 + var choice PatternFlowEthernetPfcQueueChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowEthernetPfcQueueChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowEthernetPfcQueueChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowEthernetPfcQueueChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowEthernetPfcQueueChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowEthernetPfcQueueChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetPfcQueue") + } + } else { + intVal := otg.PatternFlowEthernetPfcQueue_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowEthernetPfcQueue_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pfc_queue_counter.go b/gosnappi/pattern_flow_ethernet_pfc_queue_counter.go new file mode 100644 index 00000000..a0cf3d29 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pfc_queue_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowEthernetPfcQueueCounter ***** +type patternFlowEthernetPfcQueueCounter struct { + validation + obj *otg.PatternFlowEthernetPfcQueueCounter + marshaller marshalPatternFlowEthernetPfcQueueCounter + unMarshaller unMarshalPatternFlowEthernetPfcQueueCounter +} + +func NewPatternFlowEthernetPfcQueueCounter() PatternFlowEthernetPfcQueueCounter { + obj := patternFlowEthernetPfcQueueCounter{obj: &otg.PatternFlowEthernetPfcQueueCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPfcQueueCounter) msg() *otg.PatternFlowEthernetPfcQueueCounter { + return obj.obj +} + +func (obj *patternFlowEthernetPfcQueueCounter) setMsg(msg *otg.PatternFlowEthernetPfcQueueCounter) PatternFlowEthernetPfcQueueCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPfcQueueCounter struct { + obj *patternFlowEthernetPfcQueueCounter +} + +type marshalPatternFlowEthernetPfcQueueCounter interface { + // ToProto marshals PatternFlowEthernetPfcQueueCounter to protobuf object *otg.PatternFlowEthernetPfcQueueCounter + ToProto() (*otg.PatternFlowEthernetPfcQueueCounter, error) + // ToPbText marshals PatternFlowEthernetPfcQueueCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPfcQueueCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPfcQueueCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPfcQueueCounter struct { + obj *patternFlowEthernetPfcQueueCounter +} + +type unMarshalPatternFlowEthernetPfcQueueCounter interface { + // FromProto unmarshals PatternFlowEthernetPfcQueueCounter from protobuf object *otg.PatternFlowEthernetPfcQueueCounter + FromProto(msg *otg.PatternFlowEthernetPfcQueueCounter) (PatternFlowEthernetPfcQueueCounter, error) + // FromPbText unmarshals PatternFlowEthernetPfcQueueCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPfcQueueCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPfcQueueCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPfcQueueCounter) Marshal() marshalPatternFlowEthernetPfcQueueCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPfcQueueCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPfcQueueCounter) Unmarshal() unMarshalPatternFlowEthernetPfcQueueCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPfcQueueCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPfcQueueCounter) ToProto() (*otg.PatternFlowEthernetPfcQueueCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPfcQueueCounter) FromProto(msg *otg.PatternFlowEthernetPfcQueueCounter) (PatternFlowEthernetPfcQueueCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPfcQueueCounter) 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 *unMarshalpatternFlowEthernetPfcQueueCounter) 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 *marshalpatternFlowEthernetPfcQueueCounter) 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 *unMarshalpatternFlowEthernetPfcQueueCounter) 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 *marshalpatternFlowEthernetPfcQueueCounter) 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 *unMarshalpatternFlowEthernetPfcQueueCounter) 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 *patternFlowEthernetPfcQueueCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPfcQueueCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPfcQueueCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPfcQueueCounter) Clone() (PatternFlowEthernetPfcQueueCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPfcQueueCounter() + 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 +} + +// PatternFlowEthernetPfcQueueCounter is integer counter pattern +type PatternFlowEthernetPfcQueueCounter interface { + Validation + // msg marshals PatternFlowEthernetPfcQueueCounter to protobuf object *otg.PatternFlowEthernetPfcQueueCounter + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPfcQueueCounter + // setMsg unmarshals PatternFlowEthernetPfcQueueCounter from protobuf object *otg.PatternFlowEthernetPfcQueueCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPfcQueueCounter) PatternFlowEthernetPfcQueueCounter + // provides marshal interface + Marshal() marshalPatternFlowEthernetPfcQueueCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPfcQueueCounter + // validate validates PatternFlowEthernetPfcQueueCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPfcQueueCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowEthernetPfcQueueCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowEthernetPfcQueueCounter + SetStart(value uint32) PatternFlowEthernetPfcQueueCounter + // HasStart checks if Start has been set in PatternFlowEthernetPfcQueueCounter + HasStart() bool + // Step returns uint32, set in PatternFlowEthernetPfcQueueCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowEthernetPfcQueueCounter + SetStep(value uint32) PatternFlowEthernetPfcQueueCounter + // HasStep checks if Step has been set in PatternFlowEthernetPfcQueueCounter + HasStep() bool + // Count returns uint32, set in PatternFlowEthernetPfcQueueCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowEthernetPfcQueueCounter + SetCount(value uint32) PatternFlowEthernetPfcQueueCounter + // HasCount checks if Count has been set in PatternFlowEthernetPfcQueueCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowEthernetPfcQueueCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowEthernetPfcQueueCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowEthernetPfcQueueCounter object +func (obj *patternFlowEthernetPfcQueueCounter) SetStart(value uint32) PatternFlowEthernetPfcQueueCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowEthernetPfcQueueCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowEthernetPfcQueueCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowEthernetPfcQueueCounter object +func (obj *patternFlowEthernetPfcQueueCounter) SetStep(value uint32) PatternFlowEthernetPfcQueueCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetPfcQueueCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetPfcQueueCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowEthernetPfcQueueCounter object +func (obj *patternFlowEthernetPfcQueueCounter) SetCount(value uint32) PatternFlowEthernetPfcQueueCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowEthernetPfcQueueCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPfcQueueCounter.Start <= 7 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPfcQueueCounter.Step <= 7 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPfcQueueCounter.Count <= 7 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowEthernetPfcQueueCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_pfc_queue_metric_tag.go b/gosnappi/pattern_flow_ethernet_pfc_queue_metric_tag.go new file mode 100644 index 00000000..ab663d61 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_pfc_queue_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowEthernetPfcQueueMetricTag ***** +type patternFlowEthernetPfcQueueMetricTag struct { + validation + obj *otg.PatternFlowEthernetPfcQueueMetricTag + marshaller marshalPatternFlowEthernetPfcQueueMetricTag + unMarshaller unMarshalPatternFlowEthernetPfcQueueMetricTag +} + +func NewPatternFlowEthernetPfcQueueMetricTag() PatternFlowEthernetPfcQueueMetricTag { + obj := patternFlowEthernetPfcQueueMetricTag{obj: &otg.PatternFlowEthernetPfcQueueMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetPfcQueueMetricTag) msg() *otg.PatternFlowEthernetPfcQueueMetricTag { + return obj.obj +} + +func (obj *patternFlowEthernetPfcQueueMetricTag) setMsg(msg *otg.PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueueMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetPfcQueueMetricTag struct { + obj *patternFlowEthernetPfcQueueMetricTag +} + +type marshalPatternFlowEthernetPfcQueueMetricTag interface { + // ToProto marshals PatternFlowEthernetPfcQueueMetricTag to protobuf object *otg.PatternFlowEthernetPfcQueueMetricTag + ToProto() (*otg.PatternFlowEthernetPfcQueueMetricTag, error) + // ToPbText marshals PatternFlowEthernetPfcQueueMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetPfcQueueMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetPfcQueueMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetPfcQueueMetricTag struct { + obj *patternFlowEthernetPfcQueueMetricTag +} + +type unMarshalPatternFlowEthernetPfcQueueMetricTag interface { + // FromProto unmarshals PatternFlowEthernetPfcQueueMetricTag from protobuf object *otg.PatternFlowEthernetPfcQueueMetricTag + FromProto(msg *otg.PatternFlowEthernetPfcQueueMetricTag) (PatternFlowEthernetPfcQueueMetricTag, error) + // FromPbText unmarshals PatternFlowEthernetPfcQueueMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetPfcQueueMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetPfcQueueMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetPfcQueueMetricTag) Marshal() marshalPatternFlowEthernetPfcQueueMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetPfcQueueMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetPfcQueueMetricTag) Unmarshal() unMarshalPatternFlowEthernetPfcQueueMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetPfcQueueMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetPfcQueueMetricTag) ToProto() (*otg.PatternFlowEthernetPfcQueueMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetPfcQueueMetricTag) FromProto(msg *otg.PatternFlowEthernetPfcQueueMetricTag) (PatternFlowEthernetPfcQueueMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetPfcQueueMetricTag) 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 *unMarshalpatternFlowEthernetPfcQueueMetricTag) 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 *marshalpatternFlowEthernetPfcQueueMetricTag) 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 *unMarshalpatternFlowEthernetPfcQueueMetricTag) 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 *marshalpatternFlowEthernetPfcQueueMetricTag) 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 *unMarshalpatternFlowEthernetPfcQueueMetricTag) 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 *patternFlowEthernetPfcQueueMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPfcQueueMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetPfcQueueMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetPfcQueueMetricTag) Clone() (PatternFlowEthernetPfcQueueMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetPfcQueueMetricTag() + 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 +} + +// PatternFlowEthernetPfcQueueMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowEthernetPfcQueueMetricTag interface { + Validation + // msg marshals PatternFlowEthernetPfcQueueMetricTag to protobuf object *otg.PatternFlowEthernetPfcQueueMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowEthernetPfcQueueMetricTag + // setMsg unmarshals PatternFlowEthernetPfcQueueMetricTag from protobuf object *otg.PatternFlowEthernetPfcQueueMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetPfcQueueMetricTag) PatternFlowEthernetPfcQueueMetricTag + // provides marshal interface + Marshal() marshalPatternFlowEthernetPfcQueueMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetPfcQueueMetricTag + // validate validates PatternFlowEthernetPfcQueueMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetPfcQueueMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowEthernetPfcQueueMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowEthernetPfcQueueMetricTag + SetName(value string) PatternFlowEthernetPfcQueueMetricTag + // Offset returns uint32, set in PatternFlowEthernetPfcQueueMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowEthernetPfcQueueMetricTag + SetOffset(value uint32) PatternFlowEthernetPfcQueueMetricTag + // HasOffset checks if Offset has been set in PatternFlowEthernetPfcQueueMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowEthernetPfcQueueMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowEthernetPfcQueueMetricTag + SetLength(value uint32) PatternFlowEthernetPfcQueueMetricTag + // HasLength checks if Length has been set in PatternFlowEthernetPfcQueueMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowEthernetPfcQueueMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowEthernetPfcQueueMetricTag object +func (obj *patternFlowEthernetPfcQueueMetricTag) SetName(value string) PatternFlowEthernetPfcQueueMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetPfcQueueMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetPfcQueueMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowEthernetPfcQueueMetricTag object +func (obj *patternFlowEthernetPfcQueueMetricTag) SetOffset(value uint32) PatternFlowEthernetPfcQueueMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetPfcQueueMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetPfcQueueMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowEthernetPfcQueueMetricTag object +func (obj *patternFlowEthernetPfcQueueMetricTag) SetLength(value uint32) PatternFlowEthernetPfcQueueMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowEthernetPfcQueueMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetPfcQueueMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 2 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetPfcQueueMetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowEthernetPfcQueueMetricTag.Length <= 3 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowEthernetPfcQueueMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(3) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_src.go b/gosnappi/pattern_flow_ethernet_src.go new file mode 100644 index 00000000..4b9ffde7 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_src.go @@ -0,0 +1,658 @@ +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" +) + +// ***** PatternFlowEthernetSrc ***** +type patternFlowEthernetSrc struct { + validation + obj *otg.PatternFlowEthernetSrc + marshaller marshalPatternFlowEthernetSrc + unMarshaller unMarshalPatternFlowEthernetSrc + incrementHolder PatternFlowEthernetSrcCounter + decrementHolder PatternFlowEthernetSrcCounter + metricTagsHolder PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter +} + +func NewPatternFlowEthernetSrc() PatternFlowEthernetSrc { + obj := patternFlowEthernetSrc{obj: &otg.PatternFlowEthernetSrc{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetSrc) msg() *otg.PatternFlowEthernetSrc { + return obj.obj +} + +func (obj *patternFlowEthernetSrc) setMsg(msg *otg.PatternFlowEthernetSrc) PatternFlowEthernetSrc { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetSrc struct { + obj *patternFlowEthernetSrc +} + +type marshalPatternFlowEthernetSrc interface { + // ToProto marshals PatternFlowEthernetSrc to protobuf object *otg.PatternFlowEthernetSrc + ToProto() (*otg.PatternFlowEthernetSrc, error) + // ToPbText marshals PatternFlowEthernetSrc to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetSrc to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetSrc to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetSrc struct { + obj *patternFlowEthernetSrc +} + +type unMarshalPatternFlowEthernetSrc interface { + // FromProto unmarshals PatternFlowEthernetSrc from protobuf object *otg.PatternFlowEthernetSrc + FromProto(msg *otg.PatternFlowEthernetSrc) (PatternFlowEthernetSrc, error) + // FromPbText unmarshals PatternFlowEthernetSrc from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetSrc from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetSrc from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetSrc) Marshal() marshalPatternFlowEthernetSrc { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetSrc{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetSrc) Unmarshal() unMarshalPatternFlowEthernetSrc { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetSrc{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetSrc) ToProto() (*otg.PatternFlowEthernetSrc, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetSrc) FromProto(msg *otg.PatternFlowEthernetSrc) (PatternFlowEthernetSrc, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetSrc) 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 *unMarshalpatternFlowEthernetSrc) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowEthernetSrc) 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 *unMarshalpatternFlowEthernetSrc) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowEthernetSrc) 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 *unMarshalpatternFlowEthernetSrc) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowEthernetSrc) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetSrc) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetSrc) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetSrc) Clone() (PatternFlowEthernetSrc, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetSrc() + 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 +} + +func (obj *patternFlowEthernetSrc) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowEthernetSrc is source MAC address +type PatternFlowEthernetSrc interface { + Validation + // msg marshals PatternFlowEthernetSrc to protobuf object *otg.PatternFlowEthernetSrc + // and doesn't set defaults + msg() *otg.PatternFlowEthernetSrc + // setMsg unmarshals PatternFlowEthernetSrc from protobuf object *otg.PatternFlowEthernetSrc + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetSrc) PatternFlowEthernetSrc + // provides marshal interface + Marshal() marshalPatternFlowEthernetSrc + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetSrc + // validate validates PatternFlowEthernetSrc + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetSrc, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowEthernetSrcChoiceEnum, set in PatternFlowEthernetSrc + Choice() PatternFlowEthernetSrcChoiceEnum + // setChoice assigns PatternFlowEthernetSrcChoiceEnum provided by user to PatternFlowEthernetSrc + setChoice(value PatternFlowEthernetSrcChoiceEnum) PatternFlowEthernetSrc + // HasChoice checks if Choice has been set in PatternFlowEthernetSrc + HasChoice() bool + // Value returns string, set in PatternFlowEthernetSrc. + Value() string + // SetValue assigns string provided by user to PatternFlowEthernetSrc + SetValue(value string) PatternFlowEthernetSrc + // HasValue checks if Value has been set in PatternFlowEthernetSrc + HasValue() bool + // Values returns []string, set in PatternFlowEthernetSrc. + Values() []string + // SetValues assigns []string provided by user to PatternFlowEthernetSrc + SetValues(value []string) PatternFlowEthernetSrc + // Increment returns PatternFlowEthernetSrcCounter, set in PatternFlowEthernetSrc. + // PatternFlowEthernetSrcCounter is mac counter pattern + Increment() PatternFlowEthernetSrcCounter + // SetIncrement assigns PatternFlowEthernetSrcCounter provided by user to PatternFlowEthernetSrc. + // PatternFlowEthernetSrcCounter is mac counter pattern + SetIncrement(value PatternFlowEthernetSrcCounter) PatternFlowEthernetSrc + // HasIncrement checks if Increment has been set in PatternFlowEthernetSrc + HasIncrement() bool + // Decrement returns PatternFlowEthernetSrcCounter, set in PatternFlowEthernetSrc. + // PatternFlowEthernetSrcCounter is mac counter pattern + Decrement() PatternFlowEthernetSrcCounter + // SetDecrement assigns PatternFlowEthernetSrcCounter provided by user to PatternFlowEthernetSrc. + // PatternFlowEthernetSrcCounter is mac counter pattern + SetDecrement(value PatternFlowEthernetSrcCounter) PatternFlowEthernetSrc + // HasDecrement checks if Decrement has been set in PatternFlowEthernetSrc + HasDecrement() bool + // MetricTags returns PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIterIter, set in PatternFlowEthernetSrc + MetricTags() PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter + setNil() +} + +type PatternFlowEthernetSrcChoiceEnum string + +// Enum of Choice on PatternFlowEthernetSrc +var PatternFlowEthernetSrcChoice = struct { + VALUE PatternFlowEthernetSrcChoiceEnum + VALUES PatternFlowEthernetSrcChoiceEnum + INCREMENT PatternFlowEthernetSrcChoiceEnum + DECREMENT PatternFlowEthernetSrcChoiceEnum +}{ + VALUE: PatternFlowEthernetSrcChoiceEnum("value"), + VALUES: PatternFlowEthernetSrcChoiceEnum("values"), + INCREMENT: PatternFlowEthernetSrcChoiceEnum("increment"), + DECREMENT: PatternFlowEthernetSrcChoiceEnum("decrement"), +} + +func (obj *patternFlowEthernetSrc) Choice() PatternFlowEthernetSrcChoiceEnum { + return PatternFlowEthernetSrcChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowEthernetSrc) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowEthernetSrc) setChoice(value PatternFlowEthernetSrcChoiceEnum) PatternFlowEthernetSrc { + intValue, ok := otg.PatternFlowEthernetSrc_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowEthernetSrcChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowEthernetSrc_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowEthernetSrcChoice.VALUE { + defaultValue := "00:00:00:00:00:00" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowEthernetSrcChoice.VALUES { + defaultValue := []string{"00:00:00:00:00:00"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowEthernetSrcChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowEthernetSrcCounter().msg() + } + + if value == PatternFlowEthernetSrcChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowEthernetSrcCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowEthernetSrc) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowEthernetSrcChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowEthernetSrc) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowEthernetSrc object +func (obj *patternFlowEthernetSrc) SetValue(value string) PatternFlowEthernetSrc { + obj.setChoice(PatternFlowEthernetSrcChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowEthernetSrc) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"00:00:00:00:00:00"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowEthernetSrc object +func (obj *patternFlowEthernetSrc) SetValues(value []string) PatternFlowEthernetSrc { + obj.setChoice(PatternFlowEthernetSrcChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowEthernetSrcCounter +func (obj *patternFlowEthernetSrc) Increment() PatternFlowEthernetSrcCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowEthernetSrcChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowEthernetSrcCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowEthernetSrcCounter +func (obj *patternFlowEthernetSrc) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowEthernetSrcCounter value in the PatternFlowEthernetSrc object +func (obj *patternFlowEthernetSrc) SetIncrement(value PatternFlowEthernetSrcCounter) PatternFlowEthernetSrc { + obj.setChoice(PatternFlowEthernetSrcChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowEthernetSrcCounter +func (obj *patternFlowEthernetSrc) Decrement() PatternFlowEthernetSrcCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowEthernetSrcChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowEthernetSrcCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowEthernetSrcCounter +func (obj *patternFlowEthernetSrc) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowEthernetSrcCounter value in the PatternFlowEthernetSrc object +func (obj *patternFlowEthernetSrc) SetDecrement(value PatternFlowEthernetSrcCounter) PatternFlowEthernetSrc { + obj.setChoice(PatternFlowEthernetSrcChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowEthernetSrcMetricTag +func (obj *patternFlowEthernetSrc) MetricTags() PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowEthernetSrcMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter struct { + obj *patternFlowEthernetSrc + patternFlowEthernetSrcMetricTagSlice []PatternFlowEthernetSrcMetricTag + fieldPtr *[]*otg.PatternFlowEthernetSrcMetricTag +} + +func newPatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter(ptr *[]*otg.PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { + return &patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter interface { + setMsg(*patternFlowEthernetSrc) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter + Items() []PatternFlowEthernetSrcMetricTag + Add() PatternFlowEthernetSrcMetricTag + Append(items ...PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter + Set(index int, newObj PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter + Clear() PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter + clearHolderSlice() PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter + appendHolderSlice(item PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter +} + +func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) setMsg(msg *patternFlowEthernetSrc) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowEthernetSrcMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) Items() []PatternFlowEthernetSrcMetricTag { + return obj.patternFlowEthernetSrcMetricTagSlice +} + +func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) Add() PatternFlowEthernetSrcMetricTag { + newObj := &otg.PatternFlowEthernetSrcMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowEthernetSrcMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowEthernetSrcMetricTagSlice = append(obj.patternFlowEthernetSrcMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) Append(items ...PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowEthernetSrcMetricTagSlice = append(obj.patternFlowEthernetSrcMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) Set(index int, newObj PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowEthernetSrcMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) Clear() PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowEthernetSrcMetricTag{} + obj.patternFlowEthernetSrcMetricTagSlice = []PatternFlowEthernetSrcMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) clearHolderSlice() PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { + if len(obj.patternFlowEthernetSrcMetricTagSlice) > 0 { + obj.patternFlowEthernetSrcMetricTagSlice = []PatternFlowEthernetSrcMetricTag{} + } + return obj +} +func (obj *patternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter) appendHolderSlice(item PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcPatternFlowEthernetSrcMetricTagIter { + obj.patternFlowEthernetSrcMetricTagSlice = append(obj.patternFlowEthernetSrcMetricTagSlice, item) + return obj +} + +func (obj *patternFlowEthernetSrc) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateMac(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetSrc.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateMacSlice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetSrc.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowEthernetSrcMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowEthernetSrc) setDefault() { + var choices_set int = 0 + var choice PatternFlowEthernetSrcChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowEthernetSrcChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowEthernetSrcChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowEthernetSrcChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowEthernetSrcChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowEthernetSrcChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowEthernetSrc") + } + } else { + intVal := otg.PatternFlowEthernetSrc_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowEthernetSrc_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ethernet_src_counter.go b/gosnappi/pattern_flow_ethernet_src_counter.go new file mode 100644 index 00000000..e48af7b4 --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_src_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowEthernetSrcCounter ***** +type patternFlowEthernetSrcCounter struct { + validation + obj *otg.PatternFlowEthernetSrcCounter + marshaller marshalPatternFlowEthernetSrcCounter + unMarshaller unMarshalPatternFlowEthernetSrcCounter +} + +func NewPatternFlowEthernetSrcCounter() PatternFlowEthernetSrcCounter { + obj := patternFlowEthernetSrcCounter{obj: &otg.PatternFlowEthernetSrcCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetSrcCounter) msg() *otg.PatternFlowEthernetSrcCounter { + return obj.obj +} + +func (obj *patternFlowEthernetSrcCounter) setMsg(msg *otg.PatternFlowEthernetSrcCounter) PatternFlowEthernetSrcCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetSrcCounter struct { + obj *patternFlowEthernetSrcCounter +} + +type marshalPatternFlowEthernetSrcCounter interface { + // ToProto marshals PatternFlowEthernetSrcCounter to protobuf object *otg.PatternFlowEthernetSrcCounter + ToProto() (*otg.PatternFlowEthernetSrcCounter, error) + // ToPbText marshals PatternFlowEthernetSrcCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetSrcCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetSrcCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetSrcCounter struct { + obj *patternFlowEthernetSrcCounter +} + +type unMarshalPatternFlowEthernetSrcCounter interface { + // FromProto unmarshals PatternFlowEthernetSrcCounter from protobuf object *otg.PatternFlowEthernetSrcCounter + FromProto(msg *otg.PatternFlowEthernetSrcCounter) (PatternFlowEthernetSrcCounter, error) + // FromPbText unmarshals PatternFlowEthernetSrcCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetSrcCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetSrcCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetSrcCounter) Marshal() marshalPatternFlowEthernetSrcCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetSrcCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetSrcCounter) Unmarshal() unMarshalPatternFlowEthernetSrcCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetSrcCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetSrcCounter) ToProto() (*otg.PatternFlowEthernetSrcCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetSrcCounter) FromProto(msg *otg.PatternFlowEthernetSrcCounter) (PatternFlowEthernetSrcCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetSrcCounter) 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 *unMarshalpatternFlowEthernetSrcCounter) 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 *marshalpatternFlowEthernetSrcCounter) 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 *unMarshalpatternFlowEthernetSrcCounter) 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 *marshalpatternFlowEthernetSrcCounter) 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 *unMarshalpatternFlowEthernetSrcCounter) 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 *patternFlowEthernetSrcCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetSrcCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetSrcCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetSrcCounter) Clone() (PatternFlowEthernetSrcCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetSrcCounter() + 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 +} + +// PatternFlowEthernetSrcCounter is mac counter pattern +type PatternFlowEthernetSrcCounter interface { + Validation + // msg marshals PatternFlowEthernetSrcCounter to protobuf object *otg.PatternFlowEthernetSrcCounter + // and doesn't set defaults + msg() *otg.PatternFlowEthernetSrcCounter + // setMsg unmarshals PatternFlowEthernetSrcCounter from protobuf object *otg.PatternFlowEthernetSrcCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetSrcCounter) PatternFlowEthernetSrcCounter + // provides marshal interface + Marshal() marshalPatternFlowEthernetSrcCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetSrcCounter + // validate validates PatternFlowEthernetSrcCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetSrcCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowEthernetSrcCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowEthernetSrcCounter + SetStart(value string) PatternFlowEthernetSrcCounter + // HasStart checks if Start has been set in PatternFlowEthernetSrcCounter + HasStart() bool + // Step returns string, set in PatternFlowEthernetSrcCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowEthernetSrcCounter + SetStep(value string) PatternFlowEthernetSrcCounter + // HasStep checks if Step has been set in PatternFlowEthernetSrcCounter + HasStep() bool + // Count returns uint32, set in PatternFlowEthernetSrcCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowEthernetSrcCounter + SetCount(value uint32) PatternFlowEthernetSrcCounter + // HasCount checks if Count has been set in PatternFlowEthernetSrcCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowEthernetSrcCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowEthernetSrcCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowEthernetSrcCounter object +func (obj *patternFlowEthernetSrcCounter) SetStart(value string) PatternFlowEthernetSrcCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowEthernetSrcCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowEthernetSrcCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowEthernetSrcCounter object +func (obj *patternFlowEthernetSrcCounter) SetStep(value string) PatternFlowEthernetSrcCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetSrcCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowEthernetSrcCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowEthernetSrcCounter object +func (obj *patternFlowEthernetSrcCounter) SetCount(value uint32) PatternFlowEthernetSrcCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowEthernetSrcCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateMac(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetSrcCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateMac(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowEthernetSrcCounter.Step")) + } + + } + +} + +func (obj *patternFlowEthernetSrcCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("00:00:00:00:00:00") + } + if obj.obj.Step == nil { + obj.SetStep("00:00:00:00:00:01") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ethernet_src_metric_tag.go b/gosnappi/pattern_flow_ethernet_src_metric_tag.go new file mode 100644 index 00000000..15108d3f --- /dev/null +++ b/gosnappi/pattern_flow_ethernet_src_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowEthernetSrcMetricTag ***** +type patternFlowEthernetSrcMetricTag struct { + validation + obj *otg.PatternFlowEthernetSrcMetricTag + marshaller marshalPatternFlowEthernetSrcMetricTag + unMarshaller unMarshalPatternFlowEthernetSrcMetricTag +} + +func NewPatternFlowEthernetSrcMetricTag() PatternFlowEthernetSrcMetricTag { + obj := patternFlowEthernetSrcMetricTag{obj: &otg.PatternFlowEthernetSrcMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowEthernetSrcMetricTag) msg() *otg.PatternFlowEthernetSrcMetricTag { + return obj.obj +} + +func (obj *patternFlowEthernetSrcMetricTag) setMsg(msg *otg.PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowEthernetSrcMetricTag struct { + obj *patternFlowEthernetSrcMetricTag +} + +type marshalPatternFlowEthernetSrcMetricTag interface { + // ToProto marshals PatternFlowEthernetSrcMetricTag to protobuf object *otg.PatternFlowEthernetSrcMetricTag + ToProto() (*otg.PatternFlowEthernetSrcMetricTag, error) + // ToPbText marshals PatternFlowEthernetSrcMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowEthernetSrcMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowEthernetSrcMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowEthernetSrcMetricTag struct { + obj *patternFlowEthernetSrcMetricTag +} + +type unMarshalPatternFlowEthernetSrcMetricTag interface { + // FromProto unmarshals PatternFlowEthernetSrcMetricTag from protobuf object *otg.PatternFlowEthernetSrcMetricTag + FromProto(msg *otg.PatternFlowEthernetSrcMetricTag) (PatternFlowEthernetSrcMetricTag, error) + // FromPbText unmarshals PatternFlowEthernetSrcMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowEthernetSrcMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowEthernetSrcMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowEthernetSrcMetricTag) Marshal() marshalPatternFlowEthernetSrcMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowEthernetSrcMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowEthernetSrcMetricTag) Unmarshal() unMarshalPatternFlowEthernetSrcMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowEthernetSrcMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowEthernetSrcMetricTag) ToProto() (*otg.PatternFlowEthernetSrcMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowEthernetSrcMetricTag) FromProto(msg *otg.PatternFlowEthernetSrcMetricTag) (PatternFlowEthernetSrcMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowEthernetSrcMetricTag) 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 *unMarshalpatternFlowEthernetSrcMetricTag) 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 *marshalpatternFlowEthernetSrcMetricTag) 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 *unMarshalpatternFlowEthernetSrcMetricTag) 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 *marshalpatternFlowEthernetSrcMetricTag) 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 *unMarshalpatternFlowEthernetSrcMetricTag) 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 *patternFlowEthernetSrcMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowEthernetSrcMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowEthernetSrcMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowEthernetSrcMetricTag) Clone() (PatternFlowEthernetSrcMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowEthernetSrcMetricTag() + 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 +} + +// PatternFlowEthernetSrcMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowEthernetSrcMetricTag interface { + Validation + // msg marshals PatternFlowEthernetSrcMetricTag to protobuf object *otg.PatternFlowEthernetSrcMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowEthernetSrcMetricTag + // setMsg unmarshals PatternFlowEthernetSrcMetricTag from protobuf object *otg.PatternFlowEthernetSrcMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowEthernetSrcMetricTag) PatternFlowEthernetSrcMetricTag + // provides marshal interface + Marshal() marshalPatternFlowEthernetSrcMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowEthernetSrcMetricTag + // validate validates PatternFlowEthernetSrcMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowEthernetSrcMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowEthernetSrcMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowEthernetSrcMetricTag + SetName(value string) PatternFlowEthernetSrcMetricTag + // Offset returns uint32, set in PatternFlowEthernetSrcMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowEthernetSrcMetricTag + SetOffset(value uint32) PatternFlowEthernetSrcMetricTag + // HasOffset checks if Offset has been set in PatternFlowEthernetSrcMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowEthernetSrcMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowEthernetSrcMetricTag + SetLength(value uint32) PatternFlowEthernetSrcMetricTag + // HasLength checks if Length has been set in PatternFlowEthernetSrcMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowEthernetSrcMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowEthernetSrcMetricTag object +func (obj *patternFlowEthernetSrcMetricTag) SetName(value string) PatternFlowEthernetSrcMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetSrcMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowEthernetSrcMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowEthernetSrcMetricTag object +func (obj *patternFlowEthernetSrcMetricTag) SetOffset(value uint32) PatternFlowEthernetSrcMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetSrcMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowEthernetSrcMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowEthernetSrcMetricTag object +func (obj *patternFlowEthernetSrcMetricTag) SetLength(value uint32) PatternFlowEthernetSrcMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowEthernetSrcMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowEthernetSrcMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 47 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowEthernetSrcMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 48 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowEthernetSrcMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowEthernetSrcMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(48) + } + +} diff --git a/gosnappi/pattern_flow_gre_checksum.go b/gosnappi/pattern_flow_gre_checksum.go new file mode 100644 index 00000000..2b9f4c24 --- /dev/null +++ b/gosnappi/pattern_flow_gre_checksum.go @@ -0,0 +1,434 @@ +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" +) + +// ***** PatternFlowGreChecksum ***** +type patternFlowGreChecksum struct { + validation + obj *otg.PatternFlowGreChecksum + marshaller marshalPatternFlowGreChecksum + unMarshaller unMarshalPatternFlowGreChecksum +} + +func NewPatternFlowGreChecksum() PatternFlowGreChecksum { + obj := patternFlowGreChecksum{obj: &otg.PatternFlowGreChecksum{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreChecksum) msg() *otg.PatternFlowGreChecksum { + return obj.obj +} + +func (obj *patternFlowGreChecksum) setMsg(msg *otg.PatternFlowGreChecksum) PatternFlowGreChecksum { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreChecksum struct { + obj *patternFlowGreChecksum +} + +type marshalPatternFlowGreChecksum interface { + // ToProto marshals PatternFlowGreChecksum to protobuf object *otg.PatternFlowGreChecksum + ToProto() (*otg.PatternFlowGreChecksum, error) + // ToPbText marshals PatternFlowGreChecksum to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreChecksum to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreChecksum to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreChecksum struct { + obj *patternFlowGreChecksum +} + +type unMarshalPatternFlowGreChecksum interface { + // FromProto unmarshals PatternFlowGreChecksum from protobuf object *otg.PatternFlowGreChecksum + FromProto(msg *otg.PatternFlowGreChecksum) (PatternFlowGreChecksum, error) + // FromPbText unmarshals PatternFlowGreChecksum from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreChecksum from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreChecksum from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreChecksum) Marshal() marshalPatternFlowGreChecksum { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreChecksum{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreChecksum) Unmarshal() unMarshalPatternFlowGreChecksum { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreChecksum{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreChecksum) ToProto() (*otg.PatternFlowGreChecksum, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreChecksum) FromProto(msg *otg.PatternFlowGreChecksum) (PatternFlowGreChecksum, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreChecksum) 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 *unMarshalpatternFlowGreChecksum) 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 *marshalpatternFlowGreChecksum) 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 *unMarshalpatternFlowGreChecksum) 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 *marshalpatternFlowGreChecksum) 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 *unMarshalpatternFlowGreChecksum) 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 *patternFlowGreChecksum) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreChecksum) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreChecksum) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreChecksum) Clone() (PatternFlowGreChecksum, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreChecksum() + 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 +} + +// PatternFlowGreChecksum is optional checksum of GRE header and payload. Only present if the checksum_present bit is set. +type PatternFlowGreChecksum interface { + Validation + // msg marshals PatternFlowGreChecksum to protobuf object *otg.PatternFlowGreChecksum + // and doesn't set defaults + msg() *otg.PatternFlowGreChecksum + // setMsg unmarshals PatternFlowGreChecksum from protobuf object *otg.PatternFlowGreChecksum + // and doesn't set defaults + setMsg(*otg.PatternFlowGreChecksum) PatternFlowGreChecksum + // provides marshal interface + Marshal() marshalPatternFlowGreChecksum + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreChecksum + // validate validates PatternFlowGreChecksum + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreChecksum, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGreChecksumChoiceEnum, set in PatternFlowGreChecksum + Choice() PatternFlowGreChecksumChoiceEnum + // setChoice assigns PatternFlowGreChecksumChoiceEnum provided by user to PatternFlowGreChecksum + setChoice(value PatternFlowGreChecksumChoiceEnum) PatternFlowGreChecksum + // HasChoice checks if Choice has been set in PatternFlowGreChecksum + HasChoice() bool + // Generated returns PatternFlowGreChecksumGeneratedEnum, set in PatternFlowGreChecksum + Generated() PatternFlowGreChecksumGeneratedEnum + // SetGenerated assigns PatternFlowGreChecksumGeneratedEnum provided by user to PatternFlowGreChecksum + SetGenerated(value PatternFlowGreChecksumGeneratedEnum) PatternFlowGreChecksum + // HasGenerated checks if Generated has been set in PatternFlowGreChecksum + HasGenerated() bool + // Custom returns uint32, set in PatternFlowGreChecksum. + Custom() uint32 + // SetCustom assigns uint32 provided by user to PatternFlowGreChecksum + SetCustom(value uint32) PatternFlowGreChecksum + // HasCustom checks if Custom has been set in PatternFlowGreChecksum + HasCustom() bool +} + +type PatternFlowGreChecksumChoiceEnum string + +// Enum of Choice on PatternFlowGreChecksum +var PatternFlowGreChecksumChoice = struct { + GENERATED PatternFlowGreChecksumChoiceEnum + CUSTOM PatternFlowGreChecksumChoiceEnum +}{ + GENERATED: PatternFlowGreChecksumChoiceEnum("generated"), + CUSTOM: PatternFlowGreChecksumChoiceEnum("custom"), +} + +func (obj *patternFlowGreChecksum) Choice() PatternFlowGreChecksumChoiceEnum { + return PatternFlowGreChecksumChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The type of checksum +// Choice returns a string +func (obj *patternFlowGreChecksum) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGreChecksum) setChoice(value PatternFlowGreChecksumChoiceEnum) PatternFlowGreChecksum { + intValue, ok := otg.PatternFlowGreChecksum_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGreChecksumChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGreChecksum_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Custom = nil + obj.obj.Generated = otg.PatternFlowGreChecksum_Generated_unspecified.Enum() + return obj +} + +type PatternFlowGreChecksumGeneratedEnum string + +// Enum of Generated on PatternFlowGreChecksum +var PatternFlowGreChecksumGenerated = struct { + GOOD PatternFlowGreChecksumGeneratedEnum + BAD PatternFlowGreChecksumGeneratedEnum +}{ + GOOD: PatternFlowGreChecksumGeneratedEnum("good"), + BAD: PatternFlowGreChecksumGeneratedEnum("bad"), +} + +func (obj *patternFlowGreChecksum) Generated() PatternFlowGreChecksumGeneratedEnum { + return PatternFlowGreChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) +} + +// A system generated checksum value +// Generated returns a string +func (obj *patternFlowGreChecksum) HasGenerated() bool { + return obj.obj.Generated != nil +} + +func (obj *patternFlowGreChecksum) SetGenerated(value PatternFlowGreChecksumGeneratedEnum) PatternFlowGreChecksum { + intValue, ok := otg.PatternFlowGreChecksum_Generated_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGreChecksumGeneratedEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGreChecksum_Generated_Enum(intValue) + obj.obj.Generated = &enumValue + + return obj +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowGreChecksum) Custom() uint32 { + + if obj.obj.Custom == nil { + obj.setChoice(PatternFlowGreChecksumChoice.CUSTOM) + } + + return *obj.obj.Custom + +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowGreChecksum) HasCustom() bool { + return obj.obj.Custom != nil +} + +// A custom checksum value +// SetCustom sets the uint32 value in the PatternFlowGreChecksum object +func (obj *patternFlowGreChecksum) SetCustom(value uint32) PatternFlowGreChecksum { + obj.setChoice(PatternFlowGreChecksumChoice.CUSTOM) + obj.obj.Custom = &value + return obj +} + +func (obj *patternFlowGreChecksum) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Custom != nil { + + if *obj.obj.Custom > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreChecksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) + } + + } + +} + +func (obj *patternFlowGreChecksum) setDefault() { + var choices_set int = 0 + var choice PatternFlowGreChecksumChoiceEnum + + if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { + choices_set += 1 + choice = PatternFlowGreChecksumChoice.GENERATED + } + + if obj.obj.Custom != nil { + choices_set += 1 + choice = PatternFlowGreChecksumChoice.CUSTOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGreChecksumChoice.GENERATED) + if obj.obj.Generated.Number() == 0 { + obj.SetGenerated(PatternFlowGreChecksumGenerated.GOOD) + + } + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGreChecksum") + } + } else { + intVal := otg.PatternFlowGreChecksum_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGreChecksum_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gre_checksum_present.go b/gosnappi/pattern_flow_gre_checksum_present.go new file mode 100644 index 00000000..a1c52131 --- /dev/null +++ b/gosnappi/pattern_flow_gre_checksum_present.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGreChecksumPresent ***** +type patternFlowGreChecksumPresent struct { + validation + obj *otg.PatternFlowGreChecksumPresent + marshaller marshalPatternFlowGreChecksumPresent + unMarshaller unMarshalPatternFlowGreChecksumPresent + incrementHolder PatternFlowGreChecksumPresentCounter + decrementHolder PatternFlowGreChecksumPresentCounter + metricTagsHolder PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter +} + +func NewPatternFlowGreChecksumPresent() PatternFlowGreChecksumPresent { + obj := patternFlowGreChecksumPresent{obj: &otg.PatternFlowGreChecksumPresent{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreChecksumPresent) msg() *otg.PatternFlowGreChecksumPresent { + return obj.obj +} + +func (obj *patternFlowGreChecksumPresent) setMsg(msg *otg.PatternFlowGreChecksumPresent) PatternFlowGreChecksumPresent { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreChecksumPresent struct { + obj *patternFlowGreChecksumPresent +} + +type marshalPatternFlowGreChecksumPresent interface { + // ToProto marshals PatternFlowGreChecksumPresent to protobuf object *otg.PatternFlowGreChecksumPresent + ToProto() (*otg.PatternFlowGreChecksumPresent, error) + // ToPbText marshals PatternFlowGreChecksumPresent to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreChecksumPresent to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreChecksumPresent to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreChecksumPresent struct { + obj *patternFlowGreChecksumPresent +} + +type unMarshalPatternFlowGreChecksumPresent interface { + // FromProto unmarshals PatternFlowGreChecksumPresent from protobuf object *otg.PatternFlowGreChecksumPresent + FromProto(msg *otg.PatternFlowGreChecksumPresent) (PatternFlowGreChecksumPresent, error) + // FromPbText unmarshals PatternFlowGreChecksumPresent from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreChecksumPresent from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreChecksumPresent from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreChecksumPresent) Marshal() marshalPatternFlowGreChecksumPresent { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreChecksumPresent{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreChecksumPresent) Unmarshal() unMarshalPatternFlowGreChecksumPresent { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreChecksumPresent{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreChecksumPresent) ToProto() (*otg.PatternFlowGreChecksumPresent, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreChecksumPresent) FromProto(msg *otg.PatternFlowGreChecksumPresent) (PatternFlowGreChecksumPresent, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreChecksumPresent) 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 *unMarshalpatternFlowGreChecksumPresent) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGreChecksumPresent) 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 *unMarshalpatternFlowGreChecksumPresent) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGreChecksumPresent) 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 *unMarshalpatternFlowGreChecksumPresent) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGreChecksumPresent) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreChecksumPresent) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreChecksumPresent) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreChecksumPresent) Clone() (PatternFlowGreChecksumPresent, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreChecksumPresent() + 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 +} + +func (obj *patternFlowGreChecksumPresent) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGreChecksumPresent is checksum present bit +type PatternFlowGreChecksumPresent interface { + Validation + // msg marshals PatternFlowGreChecksumPresent to protobuf object *otg.PatternFlowGreChecksumPresent + // and doesn't set defaults + msg() *otg.PatternFlowGreChecksumPresent + // setMsg unmarshals PatternFlowGreChecksumPresent from protobuf object *otg.PatternFlowGreChecksumPresent + // and doesn't set defaults + setMsg(*otg.PatternFlowGreChecksumPresent) PatternFlowGreChecksumPresent + // provides marshal interface + Marshal() marshalPatternFlowGreChecksumPresent + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreChecksumPresent + // validate validates PatternFlowGreChecksumPresent + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreChecksumPresent, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGreChecksumPresentChoiceEnum, set in PatternFlowGreChecksumPresent + Choice() PatternFlowGreChecksumPresentChoiceEnum + // setChoice assigns PatternFlowGreChecksumPresentChoiceEnum provided by user to PatternFlowGreChecksumPresent + setChoice(value PatternFlowGreChecksumPresentChoiceEnum) PatternFlowGreChecksumPresent + // HasChoice checks if Choice has been set in PatternFlowGreChecksumPresent + HasChoice() bool + // Value returns uint32, set in PatternFlowGreChecksumPresent. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGreChecksumPresent + SetValue(value uint32) PatternFlowGreChecksumPresent + // HasValue checks if Value has been set in PatternFlowGreChecksumPresent + HasValue() bool + // Values returns []uint32, set in PatternFlowGreChecksumPresent. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGreChecksumPresent + SetValues(value []uint32) PatternFlowGreChecksumPresent + // Increment returns PatternFlowGreChecksumPresentCounter, set in PatternFlowGreChecksumPresent. + // PatternFlowGreChecksumPresentCounter is integer counter pattern + Increment() PatternFlowGreChecksumPresentCounter + // SetIncrement assigns PatternFlowGreChecksumPresentCounter provided by user to PatternFlowGreChecksumPresent. + // PatternFlowGreChecksumPresentCounter is integer counter pattern + SetIncrement(value PatternFlowGreChecksumPresentCounter) PatternFlowGreChecksumPresent + // HasIncrement checks if Increment has been set in PatternFlowGreChecksumPresent + HasIncrement() bool + // Decrement returns PatternFlowGreChecksumPresentCounter, set in PatternFlowGreChecksumPresent. + // PatternFlowGreChecksumPresentCounter is integer counter pattern + Decrement() PatternFlowGreChecksumPresentCounter + // SetDecrement assigns PatternFlowGreChecksumPresentCounter provided by user to PatternFlowGreChecksumPresent. + // PatternFlowGreChecksumPresentCounter is integer counter pattern + SetDecrement(value PatternFlowGreChecksumPresentCounter) PatternFlowGreChecksumPresent + // HasDecrement checks if Decrement has been set in PatternFlowGreChecksumPresent + HasDecrement() bool + // MetricTags returns PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIterIter, set in PatternFlowGreChecksumPresent + MetricTags() PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter + setNil() +} + +type PatternFlowGreChecksumPresentChoiceEnum string + +// Enum of Choice on PatternFlowGreChecksumPresent +var PatternFlowGreChecksumPresentChoice = struct { + VALUE PatternFlowGreChecksumPresentChoiceEnum + VALUES PatternFlowGreChecksumPresentChoiceEnum + INCREMENT PatternFlowGreChecksumPresentChoiceEnum + DECREMENT PatternFlowGreChecksumPresentChoiceEnum +}{ + VALUE: PatternFlowGreChecksumPresentChoiceEnum("value"), + VALUES: PatternFlowGreChecksumPresentChoiceEnum("values"), + INCREMENT: PatternFlowGreChecksumPresentChoiceEnum("increment"), + DECREMENT: PatternFlowGreChecksumPresentChoiceEnum("decrement"), +} + +func (obj *patternFlowGreChecksumPresent) Choice() PatternFlowGreChecksumPresentChoiceEnum { + return PatternFlowGreChecksumPresentChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGreChecksumPresent) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGreChecksumPresent) setChoice(value PatternFlowGreChecksumPresentChoiceEnum) PatternFlowGreChecksumPresent { + intValue, ok := otg.PatternFlowGreChecksumPresent_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGreChecksumPresentChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGreChecksumPresent_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGreChecksumPresentChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGreChecksumPresentChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGreChecksumPresentChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGreChecksumPresentCounter().msg() + } + + if value == PatternFlowGreChecksumPresentChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGreChecksumPresentCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGreChecksumPresent) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGreChecksumPresentChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGreChecksumPresent) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGreChecksumPresent object +func (obj *patternFlowGreChecksumPresent) SetValue(value uint32) PatternFlowGreChecksumPresent { + obj.setChoice(PatternFlowGreChecksumPresentChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGreChecksumPresent) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGreChecksumPresent object +func (obj *patternFlowGreChecksumPresent) SetValues(value []uint32) PatternFlowGreChecksumPresent { + obj.setChoice(PatternFlowGreChecksumPresentChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGreChecksumPresentCounter +func (obj *patternFlowGreChecksumPresent) Increment() PatternFlowGreChecksumPresentCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGreChecksumPresentChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGreChecksumPresentCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGreChecksumPresentCounter +func (obj *patternFlowGreChecksumPresent) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGreChecksumPresentCounter value in the PatternFlowGreChecksumPresent object +func (obj *patternFlowGreChecksumPresent) SetIncrement(value PatternFlowGreChecksumPresentCounter) PatternFlowGreChecksumPresent { + obj.setChoice(PatternFlowGreChecksumPresentChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGreChecksumPresentCounter +func (obj *patternFlowGreChecksumPresent) Decrement() PatternFlowGreChecksumPresentCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGreChecksumPresentChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGreChecksumPresentCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGreChecksumPresentCounter +func (obj *patternFlowGreChecksumPresent) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGreChecksumPresentCounter value in the PatternFlowGreChecksumPresent object +func (obj *patternFlowGreChecksumPresent) SetDecrement(value PatternFlowGreChecksumPresentCounter) PatternFlowGreChecksumPresent { + obj.setChoice(PatternFlowGreChecksumPresentChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGreChecksumPresentMetricTag +func (obj *patternFlowGreChecksumPresent) MetricTags() PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGreChecksumPresentMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter struct { + obj *patternFlowGreChecksumPresent + patternFlowGreChecksumPresentMetricTagSlice []PatternFlowGreChecksumPresentMetricTag + fieldPtr *[]*otg.PatternFlowGreChecksumPresentMetricTag +} + +func newPatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter(ptr *[]*otg.PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { + return &patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter interface { + setMsg(*patternFlowGreChecksumPresent) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter + Items() []PatternFlowGreChecksumPresentMetricTag + Add() PatternFlowGreChecksumPresentMetricTag + Append(items ...PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter + Set(index int, newObj PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter + Clear() PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter + clearHolderSlice() PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter + appendHolderSlice(item PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter +} + +func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) setMsg(msg *patternFlowGreChecksumPresent) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGreChecksumPresentMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) Items() []PatternFlowGreChecksumPresentMetricTag { + return obj.patternFlowGreChecksumPresentMetricTagSlice +} + +func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) Add() PatternFlowGreChecksumPresentMetricTag { + newObj := &otg.PatternFlowGreChecksumPresentMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGreChecksumPresentMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGreChecksumPresentMetricTagSlice = append(obj.patternFlowGreChecksumPresentMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) Append(items ...PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGreChecksumPresentMetricTagSlice = append(obj.patternFlowGreChecksumPresentMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) Set(index int, newObj PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGreChecksumPresentMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) Clear() PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGreChecksumPresentMetricTag{} + obj.patternFlowGreChecksumPresentMetricTagSlice = []PatternFlowGreChecksumPresentMetricTag{} + } + return obj +} +func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) clearHolderSlice() PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { + if len(obj.patternFlowGreChecksumPresentMetricTagSlice) > 0 { + obj.patternFlowGreChecksumPresentMetricTagSlice = []PatternFlowGreChecksumPresentMetricTag{} + } + return obj +} +func (obj *patternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter) appendHolderSlice(item PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentPatternFlowGreChecksumPresentMetricTagIter { + obj.patternFlowGreChecksumPresentMetricTagSlice = append(obj.patternFlowGreChecksumPresentMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGreChecksumPresent) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreChecksumPresent.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGreChecksumPresent.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGreChecksumPresentMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGreChecksumPresent) setDefault() { + var choices_set int = 0 + var choice PatternFlowGreChecksumPresentChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGreChecksumPresentChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGreChecksumPresentChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGreChecksumPresentChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGreChecksumPresentChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGreChecksumPresentChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGreChecksumPresent") + } + } else { + intVal := otg.PatternFlowGreChecksumPresent_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGreChecksumPresent_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gre_checksum_present_counter.go b/gosnappi/pattern_flow_gre_checksum_present_counter.go new file mode 100644 index 00000000..a55d5f77 --- /dev/null +++ b/gosnappi/pattern_flow_gre_checksum_present_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGreChecksumPresentCounter ***** +type patternFlowGreChecksumPresentCounter struct { + validation + obj *otg.PatternFlowGreChecksumPresentCounter + marshaller marshalPatternFlowGreChecksumPresentCounter + unMarshaller unMarshalPatternFlowGreChecksumPresentCounter +} + +func NewPatternFlowGreChecksumPresentCounter() PatternFlowGreChecksumPresentCounter { + obj := patternFlowGreChecksumPresentCounter{obj: &otg.PatternFlowGreChecksumPresentCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreChecksumPresentCounter) msg() *otg.PatternFlowGreChecksumPresentCounter { + return obj.obj +} + +func (obj *patternFlowGreChecksumPresentCounter) setMsg(msg *otg.PatternFlowGreChecksumPresentCounter) PatternFlowGreChecksumPresentCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreChecksumPresentCounter struct { + obj *patternFlowGreChecksumPresentCounter +} + +type marshalPatternFlowGreChecksumPresentCounter interface { + // ToProto marshals PatternFlowGreChecksumPresentCounter to protobuf object *otg.PatternFlowGreChecksumPresentCounter + ToProto() (*otg.PatternFlowGreChecksumPresentCounter, error) + // ToPbText marshals PatternFlowGreChecksumPresentCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreChecksumPresentCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreChecksumPresentCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreChecksumPresentCounter struct { + obj *patternFlowGreChecksumPresentCounter +} + +type unMarshalPatternFlowGreChecksumPresentCounter interface { + // FromProto unmarshals PatternFlowGreChecksumPresentCounter from protobuf object *otg.PatternFlowGreChecksumPresentCounter + FromProto(msg *otg.PatternFlowGreChecksumPresentCounter) (PatternFlowGreChecksumPresentCounter, error) + // FromPbText unmarshals PatternFlowGreChecksumPresentCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreChecksumPresentCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreChecksumPresentCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreChecksumPresentCounter) Marshal() marshalPatternFlowGreChecksumPresentCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreChecksumPresentCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreChecksumPresentCounter) Unmarshal() unMarshalPatternFlowGreChecksumPresentCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreChecksumPresentCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreChecksumPresentCounter) ToProto() (*otg.PatternFlowGreChecksumPresentCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreChecksumPresentCounter) FromProto(msg *otg.PatternFlowGreChecksumPresentCounter) (PatternFlowGreChecksumPresentCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreChecksumPresentCounter) 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 *unMarshalpatternFlowGreChecksumPresentCounter) 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 *marshalpatternFlowGreChecksumPresentCounter) 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 *unMarshalpatternFlowGreChecksumPresentCounter) 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 *marshalpatternFlowGreChecksumPresentCounter) 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 *unMarshalpatternFlowGreChecksumPresentCounter) 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 *patternFlowGreChecksumPresentCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreChecksumPresentCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreChecksumPresentCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreChecksumPresentCounter) Clone() (PatternFlowGreChecksumPresentCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreChecksumPresentCounter() + 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 +} + +// PatternFlowGreChecksumPresentCounter is integer counter pattern +type PatternFlowGreChecksumPresentCounter interface { + Validation + // msg marshals PatternFlowGreChecksumPresentCounter to protobuf object *otg.PatternFlowGreChecksumPresentCounter + // and doesn't set defaults + msg() *otg.PatternFlowGreChecksumPresentCounter + // setMsg unmarshals PatternFlowGreChecksumPresentCounter from protobuf object *otg.PatternFlowGreChecksumPresentCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGreChecksumPresentCounter) PatternFlowGreChecksumPresentCounter + // provides marshal interface + Marshal() marshalPatternFlowGreChecksumPresentCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreChecksumPresentCounter + // validate validates PatternFlowGreChecksumPresentCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreChecksumPresentCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGreChecksumPresentCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGreChecksumPresentCounter + SetStart(value uint32) PatternFlowGreChecksumPresentCounter + // HasStart checks if Start has been set in PatternFlowGreChecksumPresentCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGreChecksumPresentCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGreChecksumPresentCounter + SetStep(value uint32) PatternFlowGreChecksumPresentCounter + // HasStep checks if Step has been set in PatternFlowGreChecksumPresentCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGreChecksumPresentCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGreChecksumPresentCounter + SetCount(value uint32) PatternFlowGreChecksumPresentCounter + // HasCount checks if Count has been set in PatternFlowGreChecksumPresentCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGreChecksumPresentCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGreChecksumPresentCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGreChecksumPresentCounter object +func (obj *patternFlowGreChecksumPresentCounter) SetStart(value uint32) PatternFlowGreChecksumPresentCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGreChecksumPresentCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGreChecksumPresentCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGreChecksumPresentCounter object +func (obj *patternFlowGreChecksumPresentCounter) SetStep(value uint32) PatternFlowGreChecksumPresentCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGreChecksumPresentCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGreChecksumPresentCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGreChecksumPresentCounter object +func (obj *patternFlowGreChecksumPresentCounter) SetCount(value uint32) PatternFlowGreChecksumPresentCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGreChecksumPresentCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreChecksumPresentCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreChecksumPresentCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreChecksumPresentCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGreChecksumPresentCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gre_checksum_present_metric_tag.go b/gosnappi/pattern_flow_gre_checksum_present_metric_tag.go new file mode 100644 index 00000000..d6179002 --- /dev/null +++ b/gosnappi/pattern_flow_gre_checksum_present_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGreChecksumPresentMetricTag ***** +type patternFlowGreChecksumPresentMetricTag struct { + validation + obj *otg.PatternFlowGreChecksumPresentMetricTag + marshaller marshalPatternFlowGreChecksumPresentMetricTag + unMarshaller unMarshalPatternFlowGreChecksumPresentMetricTag +} + +func NewPatternFlowGreChecksumPresentMetricTag() PatternFlowGreChecksumPresentMetricTag { + obj := patternFlowGreChecksumPresentMetricTag{obj: &otg.PatternFlowGreChecksumPresentMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreChecksumPresentMetricTag) msg() *otg.PatternFlowGreChecksumPresentMetricTag { + return obj.obj +} + +func (obj *patternFlowGreChecksumPresentMetricTag) setMsg(msg *otg.PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreChecksumPresentMetricTag struct { + obj *patternFlowGreChecksumPresentMetricTag +} + +type marshalPatternFlowGreChecksumPresentMetricTag interface { + // ToProto marshals PatternFlowGreChecksumPresentMetricTag to protobuf object *otg.PatternFlowGreChecksumPresentMetricTag + ToProto() (*otg.PatternFlowGreChecksumPresentMetricTag, error) + // ToPbText marshals PatternFlowGreChecksumPresentMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreChecksumPresentMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreChecksumPresentMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreChecksumPresentMetricTag struct { + obj *patternFlowGreChecksumPresentMetricTag +} + +type unMarshalPatternFlowGreChecksumPresentMetricTag interface { + // FromProto unmarshals PatternFlowGreChecksumPresentMetricTag from protobuf object *otg.PatternFlowGreChecksumPresentMetricTag + FromProto(msg *otg.PatternFlowGreChecksumPresentMetricTag) (PatternFlowGreChecksumPresentMetricTag, error) + // FromPbText unmarshals PatternFlowGreChecksumPresentMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreChecksumPresentMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreChecksumPresentMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreChecksumPresentMetricTag) Marshal() marshalPatternFlowGreChecksumPresentMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreChecksumPresentMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreChecksumPresentMetricTag) Unmarshal() unMarshalPatternFlowGreChecksumPresentMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreChecksumPresentMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreChecksumPresentMetricTag) ToProto() (*otg.PatternFlowGreChecksumPresentMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreChecksumPresentMetricTag) FromProto(msg *otg.PatternFlowGreChecksumPresentMetricTag) (PatternFlowGreChecksumPresentMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreChecksumPresentMetricTag) 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 *unMarshalpatternFlowGreChecksumPresentMetricTag) 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 *marshalpatternFlowGreChecksumPresentMetricTag) 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 *unMarshalpatternFlowGreChecksumPresentMetricTag) 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 *marshalpatternFlowGreChecksumPresentMetricTag) 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 *unMarshalpatternFlowGreChecksumPresentMetricTag) 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 *patternFlowGreChecksumPresentMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreChecksumPresentMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreChecksumPresentMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreChecksumPresentMetricTag) Clone() (PatternFlowGreChecksumPresentMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreChecksumPresentMetricTag() + 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 +} + +// PatternFlowGreChecksumPresentMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGreChecksumPresentMetricTag interface { + Validation + // msg marshals PatternFlowGreChecksumPresentMetricTag to protobuf object *otg.PatternFlowGreChecksumPresentMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGreChecksumPresentMetricTag + // setMsg unmarshals PatternFlowGreChecksumPresentMetricTag from protobuf object *otg.PatternFlowGreChecksumPresentMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGreChecksumPresentMetricTag) PatternFlowGreChecksumPresentMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGreChecksumPresentMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreChecksumPresentMetricTag + // validate validates PatternFlowGreChecksumPresentMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreChecksumPresentMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGreChecksumPresentMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGreChecksumPresentMetricTag + SetName(value string) PatternFlowGreChecksumPresentMetricTag + // Offset returns uint32, set in PatternFlowGreChecksumPresentMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGreChecksumPresentMetricTag + SetOffset(value uint32) PatternFlowGreChecksumPresentMetricTag + // HasOffset checks if Offset has been set in PatternFlowGreChecksumPresentMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGreChecksumPresentMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGreChecksumPresentMetricTag + SetLength(value uint32) PatternFlowGreChecksumPresentMetricTag + // HasLength checks if Length has been set in PatternFlowGreChecksumPresentMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGreChecksumPresentMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGreChecksumPresentMetricTag object +func (obj *patternFlowGreChecksumPresentMetricTag) SetName(value string) PatternFlowGreChecksumPresentMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGreChecksumPresentMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGreChecksumPresentMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGreChecksumPresentMetricTag object +func (obj *patternFlowGreChecksumPresentMetricTag) SetOffset(value uint32) PatternFlowGreChecksumPresentMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGreChecksumPresentMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGreChecksumPresentMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGreChecksumPresentMetricTag object +func (obj *patternFlowGreChecksumPresentMetricTag) SetLength(value uint32) PatternFlowGreChecksumPresentMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGreChecksumPresentMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGreChecksumPresentMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreChecksumPresentMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGreChecksumPresentMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGreChecksumPresentMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_gre_protocol.go b/gosnappi/pattern_flow_gre_protocol.go new file mode 100644 index 00000000..a659d147 --- /dev/null +++ b/gosnappi/pattern_flow_gre_protocol.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGreProtocol ***** +type patternFlowGreProtocol struct { + validation + obj *otg.PatternFlowGreProtocol + marshaller marshalPatternFlowGreProtocol + unMarshaller unMarshalPatternFlowGreProtocol + incrementHolder PatternFlowGreProtocolCounter + decrementHolder PatternFlowGreProtocolCounter + metricTagsHolder PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter +} + +func NewPatternFlowGreProtocol() PatternFlowGreProtocol { + obj := patternFlowGreProtocol{obj: &otg.PatternFlowGreProtocol{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreProtocol) msg() *otg.PatternFlowGreProtocol { + return obj.obj +} + +func (obj *patternFlowGreProtocol) setMsg(msg *otg.PatternFlowGreProtocol) PatternFlowGreProtocol { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreProtocol struct { + obj *patternFlowGreProtocol +} + +type marshalPatternFlowGreProtocol interface { + // ToProto marshals PatternFlowGreProtocol to protobuf object *otg.PatternFlowGreProtocol + ToProto() (*otg.PatternFlowGreProtocol, error) + // ToPbText marshals PatternFlowGreProtocol to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreProtocol to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreProtocol to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreProtocol struct { + obj *patternFlowGreProtocol +} + +type unMarshalPatternFlowGreProtocol interface { + // FromProto unmarshals PatternFlowGreProtocol from protobuf object *otg.PatternFlowGreProtocol + FromProto(msg *otg.PatternFlowGreProtocol) (PatternFlowGreProtocol, error) + // FromPbText unmarshals PatternFlowGreProtocol from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreProtocol from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreProtocol from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreProtocol) Marshal() marshalPatternFlowGreProtocol { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreProtocol{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreProtocol) Unmarshal() unMarshalPatternFlowGreProtocol { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreProtocol{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreProtocol) ToProto() (*otg.PatternFlowGreProtocol, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreProtocol) FromProto(msg *otg.PatternFlowGreProtocol) (PatternFlowGreProtocol, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreProtocol) 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 *unMarshalpatternFlowGreProtocol) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGreProtocol) 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 *unMarshalpatternFlowGreProtocol) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGreProtocol) 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 *unMarshalpatternFlowGreProtocol) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGreProtocol) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreProtocol) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreProtocol) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreProtocol) Clone() (PatternFlowGreProtocol, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreProtocol() + 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 +} + +func (obj *patternFlowGreProtocol) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGreProtocol is protocol type of encapsulated payload +type PatternFlowGreProtocol interface { + Validation + // msg marshals PatternFlowGreProtocol to protobuf object *otg.PatternFlowGreProtocol + // and doesn't set defaults + msg() *otg.PatternFlowGreProtocol + // setMsg unmarshals PatternFlowGreProtocol from protobuf object *otg.PatternFlowGreProtocol + // and doesn't set defaults + setMsg(*otg.PatternFlowGreProtocol) PatternFlowGreProtocol + // provides marshal interface + Marshal() marshalPatternFlowGreProtocol + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreProtocol + // validate validates PatternFlowGreProtocol + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreProtocol, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGreProtocolChoiceEnum, set in PatternFlowGreProtocol + Choice() PatternFlowGreProtocolChoiceEnum + // setChoice assigns PatternFlowGreProtocolChoiceEnum provided by user to PatternFlowGreProtocol + setChoice(value PatternFlowGreProtocolChoiceEnum) PatternFlowGreProtocol + // HasChoice checks if Choice has been set in PatternFlowGreProtocol + HasChoice() bool + // Value returns uint32, set in PatternFlowGreProtocol. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGreProtocol + SetValue(value uint32) PatternFlowGreProtocol + // HasValue checks if Value has been set in PatternFlowGreProtocol + HasValue() bool + // Values returns []uint32, set in PatternFlowGreProtocol. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGreProtocol + SetValues(value []uint32) PatternFlowGreProtocol + // Increment returns PatternFlowGreProtocolCounter, set in PatternFlowGreProtocol. + // PatternFlowGreProtocolCounter is integer counter pattern + Increment() PatternFlowGreProtocolCounter + // SetIncrement assigns PatternFlowGreProtocolCounter provided by user to PatternFlowGreProtocol. + // PatternFlowGreProtocolCounter is integer counter pattern + SetIncrement(value PatternFlowGreProtocolCounter) PatternFlowGreProtocol + // HasIncrement checks if Increment has been set in PatternFlowGreProtocol + HasIncrement() bool + // Decrement returns PatternFlowGreProtocolCounter, set in PatternFlowGreProtocol. + // PatternFlowGreProtocolCounter is integer counter pattern + Decrement() PatternFlowGreProtocolCounter + // SetDecrement assigns PatternFlowGreProtocolCounter provided by user to PatternFlowGreProtocol. + // PatternFlowGreProtocolCounter is integer counter pattern + SetDecrement(value PatternFlowGreProtocolCounter) PatternFlowGreProtocol + // HasDecrement checks if Decrement has been set in PatternFlowGreProtocol + HasDecrement() bool + // MetricTags returns PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIterIter, set in PatternFlowGreProtocol + MetricTags() PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter + setNil() +} + +type PatternFlowGreProtocolChoiceEnum string + +// Enum of Choice on PatternFlowGreProtocol +var PatternFlowGreProtocolChoice = struct { + VALUE PatternFlowGreProtocolChoiceEnum + VALUES PatternFlowGreProtocolChoiceEnum + INCREMENT PatternFlowGreProtocolChoiceEnum + DECREMENT PatternFlowGreProtocolChoiceEnum +}{ + VALUE: PatternFlowGreProtocolChoiceEnum("value"), + VALUES: PatternFlowGreProtocolChoiceEnum("values"), + INCREMENT: PatternFlowGreProtocolChoiceEnum("increment"), + DECREMENT: PatternFlowGreProtocolChoiceEnum("decrement"), +} + +func (obj *patternFlowGreProtocol) Choice() PatternFlowGreProtocolChoiceEnum { + return PatternFlowGreProtocolChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGreProtocol) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGreProtocol) setChoice(value PatternFlowGreProtocolChoiceEnum) PatternFlowGreProtocol { + intValue, ok := otg.PatternFlowGreProtocol_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGreProtocolChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGreProtocol_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGreProtocolChoice.VALUE { + defaultValue := uint32(2048) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGreProtocolChoice.VALUES { + defaultValue := []uint32{2048} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGreProtocolChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGreProtocolCounter().msg() + } + + if value == PatternFlowGreProtocolChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGreProtocolCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGreProtocol) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGreProtocolChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGreProtocol) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGreProtocol object +func (obj *patternFlowGreProtocol) SetValue(value uint32) PatternFlowGreProtocol { + obj.setChoice(PatternFlowGreProtocolChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGreProtocol) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{2048}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGreProtocol object +func (obj *patternFlowGreProtocol) SetValues(value []uint32) PatternFlowGreProtocol { + obj.setChoice(PatternFlowGreProtocolChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGreProtocolCounter +func (obj *patternFlowGreProtocol) Increment() PatternFlowGreProtocolCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGreProtocolChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGreProtocolCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGreProtocolCounter +func (obj *patternFlowGreProtocol) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGreProtocolCounter value in the PatternFlowGreProtocol object +func (obj *patternFlowGreProtocol) SetIncrement(value PatternFlowGreProtocolCounter) PatternFlowGreProtocol { + obj.setChoice(PatternFlowGreProtocolChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGreProtocolCounter +func (obj *patternFlowGreProtocol) Decrement() PatternFlowGreProtocolCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGreProtocolChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGreProtocolCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGreProtocolCounter +func (obj *patternFlowGreProtocol) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGreProtocolCounter value in the PatternFlowGreProtocol object +func (obj *patternFlowGreProtocol) SetDecrement(value PatternFlowGreProtocolCounter) PatternFlowGreProtocol { + obj.setChoice(PatternFlowGreProtocolChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGreProtocolMetricTag +func (obj *patternFlowGreProtocol) MetricTags() PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGreProtocolMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter struct { + obj *patternFlowGreProtocol + patternFlowGreProtocolMetricTagSlice []PatternFlowGreProtocolMetricTag + fieldPtr *[]*otg.PatternFlowGreProtocolMetricTag +} + +func newPatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter(ptr *[]*otg.PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { + return &patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter interface { + setMsg(*patternFlowGreProtocol) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter + Items() []PatternFlowGreProtocolMetricTag + Add() PatternFlowGreProtocolMetricTag + Append(items ...PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter + Set(index int, newObj PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter + Clear() PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter + clearHolderSlice() PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter + appendHolderSlice(item PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter +} + +func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) setMsg(msg *patternFlowGreProtocol) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGreProtocolMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) Items() []PatternFlowGreProtocolMetricTag { + return obj.patternFlowGreProtocolMetricTagSlice +} + +func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) Add() PatternFlowGreProtocolMetricTag { + newObj := &otg.PatternFlowGreProtocolMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGreProtocolMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGreProtocolMetricTagSlice = append(obj.patternFlowGreProtocolMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) Append(items ...PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGreProtocolMetricTagSlice = append(obj.patternFlowGreProtocolMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) Set(index int, newObj PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGreProtocolMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) Clear() PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGreProtocolMetricTag{} + obj.patternFlowGreProtocolMetricTagSlice = []PatternFlowGreProtocolMetricTag{} + } + return obj +} +func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) clearHolderSlice() PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { + if len(obj.patternFlowGreProtocolMetricTagSlice) > 0 { + obj.patternFlowGreProtocolMetricTagSlice = []PatternFlowGreProtocolMetricTag{} + } + return obj +} +func (obj *patternFlowGreProtocolPatternFlowGreProtocolMetricTagIter) appendHolderSlice(item PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolPatternFlowGreProtocolMetricTagIter { + obj.patternFlowGreProtocolMetricTagSlice = append(obj.patternFlowGreProtocolMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGreProtocol) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreProtocol.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGreProtocol.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGreProtocolMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGreProtocol) setDefault() { + var choices_set int = 0 + var choice PatternFlowGreProtocolChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGreProtocolChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGreProtocolChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGreProtocolChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGreProtocolChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGreProtocolChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGreProtocol") + } + } else { + intVal := otg.PatternFlowGreProtocol_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGreProtocol_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gre_protocol_counter.go b/gosnappi/pattern_flow_gre_protocol_counter.go new file mode 100644 index 00000000..e853ed92 --- /dev/null +++ b/gosnappi/pattern_flow_gre_protocol_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGreProtocolCounter ***** +type patternFlowGreProtocolCounter struct { + validation + obj *otg.PatternFlowGreProtocolCounter + marshaller marshalPatternFlowGreProtocolCounter + unMarshaller unMarshalPatternFlowGreProtocolCounter +} + +func NewPatternFlowGreProtocolCounter() PatternFlowGreProtocolCounter { + obj := patternFlowGreProtocolCounter{obj: &otg.PatternFlowGreProtocolCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreProtocolCounter) msg() *otg.PatternFlowGreProtocolCounter { + return obj.obj +} + +func (obj *patternFlowGreProtocolCounter) setMsg(msg *otg.PatternFlowGreProtocolCounter) PatternFlowGreProtocolCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreProtocolCounter struct { + obj *patternFlowGreProtocolCounter +} + +type marshalPatternFlowGreProtocolCounter interface { + // ToProto marshals PatternFlowGreProtocolCounter to protobuf object *otg.PatternFlowGreProtocolCounter + ToProto() (*otg.PatternFlowGreProtocolCounter, error) + // ToPbText marshals PatternFlowGreProtocolCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreProtocolCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreProtocolCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreProtocolCounter struct { + obj *patternFlowGreProtocolCounter +} + +type unMarshalPatternFlowGreProtocolCounter interface { + // FromProto unmarshals PatternFlowGreProtocolCounter from protobuf object *otg.PatternFlowGreProtocolCounter + FromProto(msg *otg.PatternFlowGreProtocolCounter) (PatternFlowGreProtocolCounter, error) + // FromPbText unmarshals PatternFlowGreProtocolCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreProtocolCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreProtocolCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreProtocolCounter) Marshal() marshalPatternFlowGreProtocolCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreProtocolCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreProtocolCounter) Unmarshal() unMarshalPatternFlowGreProtocolCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreProtocolCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreProtocolCounter) ToProto() (*otg.PatternFlowGreProtocolCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreProtocolCounter) FromProto(msg *otg.PatternFlowGreProtocolCounter) (PatternFlowGreProtocolCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreProtocolCounter) 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 *unMarshalpatternFlowGreProtocolCounter) 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 *marshalpatternFlowGreProtocolCounter) 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 *unMarshalpatternFlowGreProtocolCounter) 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 *marshalpatternFlowGreProtocolCounter) 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 *unMarshalpatternFlowGreProtocolCounter) 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 *patternFlowGreProtocolCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreProtocolCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreProtocolCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreProtocolCounter) Clone() (PatternFlowGreProtocolCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreProtocolCounter() + 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 +} + +// PatternFlowGreProtocolCounter is integer counter pattern +type PatternFlowGreProtocolCounter interface { + Validation + // msg marshals PatternFlowGreProtocolCounter to protobuf object *otg.PatternFlowGreProtocolCounter + // and doesn't set defaults + msg() *otg.PatternFlowGreProtocolCounter + // setMsg unmarshals PatternFlowGreProtocolCounter from protobuf object *otg.PatternFlowGreProtocolCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGreProtocolCounter) PatternFlowGreProtocolCounter + // provides marshal interface + Marshal() marshalPatternFlowGreProtocolCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreProtocolCounter + // validate validates PatternFlowGreProtocolCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreProtocolCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGreProtocolCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGreProtocolCounter + SetStart(value uint32) PatternFlowGreProtocolCounter + // HasStart checks if Start has been set in PatternFlowGreProtocolCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGreProtocolCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGreProtocolCounter + SetStep(value uint32) PatternFlowGreProtocolCounter + // HasStep checks if Step has been set in PatternFlowGreProtocolCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGreProtocolCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGreProtocolCounter + SetCount(value uint32) PatternFlowGreProtocolCounter + // HasCount checks if Count has been set in PatternFlowGreProtocolCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGreProtocolCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGreProtocolCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGreProtocolCounter object +func (obj *patternFlowGreProtocolCounter) SetStart(value uint32) PatternFlowGreProtocolCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGreProtocolCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGreProtocolCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGreProtocolCounter object +func (obj *patternFlowGreProtocolCounter) SetStep(value uint32) PatternFlowGreProtocolCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGreProtocolCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGreProtocolCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGreProtocolCounter object +func (obj *patternFlowGreProtocolCounter) SetCount(value uint32) PatternFlowGreProtocolCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGreProtocolCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreProtocolCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreProtocolCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreProtocolCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGreProtocolCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(2048) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gre_protocol_metric_tag.go b/gosnappi/pattern_flow_gre_protocol_metric_tag.go new file mode 100644 index 00000000..46758e17 --- /dev/null +++ b/gosnappi/pattern_flow_gre_protocol_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGreProtocolMetricTag ***** +type patternFlowGreProtocolMetricTag struct { + validation + obj *otg.PatternFlowGreProtocolMetricTag + marshaller marshalPatternFlowGreProtocolMetricTag + unMarshaller unMarshalPatternFlowGreProtocolMetricTag +} + +func NewPatternFlowGreProtocolMetricTag() PatternFlowGreProtocolMetricTag { + obj := patternFlowGreProtocolMetricTag{obj: &otg.PatternFlowGreProtocolMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreProtocolMetricTag) msg() *otg.PatternFlowGreProtocolMetricTag { + return obj.obj +} + +func (obj *patternFlowGreProtocolMetricTag) setMsg(msg *otg.PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreProtocolMetricTag struct { + obj *patternFlowGreProtocolMetricTag +} + +type marshalPatternFlowGreProtocolMetricTag interface { + // ToProto marshals PatternFlowGreProtocolMetricTag to protobuf object *otg.PatternFlowGreProtocolMetricTag + ToProto() (*otg.PatternFlowGreProtocolMetricTag, error) + // ToPbText marshals PatternFlowGreProtocolMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreProtocolMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreProtocolMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreProtocolMetricTag struct { + obj *patternFlowGreProtocolMetricTag +} + +type unMarshalPatternFlowGreProtocolMetricTag interface { + // FromProto unmarshals PatternFlowGreProtocolMetricTag from protobuf object *otg.PatternFlowGreProtocolMetricTag + FromProto(msg *otg.PatternFlowGreProtocolMetricTag) (PatternFlowGreProtocolMetricTag, error) + // FromPbText unmarshals PatternFlowGreProtocolMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreProtocolMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreProtocolMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreProtocolMetricTag) Marshal() marshalPatternFlowGreProtocolMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreProtocolMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreProtocolMetricTag) Unmarshal() unMarshalPatternFlowGreProtocolMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreProtocolMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreProtocolMetricTag) ToProto() (*otg.PatternFlowGreProtocolMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreProtocolMetricTag) FromProto(msg *otg.PatternFlowGreProtocolMetricTag) (PatternFlowGreProtocolMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreProtocolMetricTag) 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 *unMarshalpatternFlowGreProtocolMetricTag) 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 *marshalpatternFlowGreProtocolMetricTag) 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 *unMarshalpatternFlowGreProtocolMetricTag) 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 *marshalpatternFlowGreProtocolMetricTag) 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 *unMarshalpatternFlowGreProtocolMetricTag) 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 *patternFlowGreProtocolMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreProtocolMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreProtocolMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreProtocolMetricTag) Clone() (PatternFlowGreProtocolMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreProtocolMetricTag() + 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 +} + +// PatternFlowGreProtocolMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGreProtocolMetricTag interface { + Validation + // msg marshals PatternFlowGreProtocolMetricTag to protobuf object *otg.PatternFlowGreProtocolMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGreProtocolMetricTag + // setMsg unmarshals PatternFlowGreProtocolMetricTag from protobuf object *otg.PatternFlowGreProtocolMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGreProtocolMetricTag) PatternFlowGreProtocolMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGreProtocolMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreProtocolMetricTag + // validate validates PatternFlowGreProtocolMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreProtocolMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGreProtocolMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGreProtocolMetricTag + SetName(value string) PatternFlowGreProtocolMetricTag + // Offset returns uint32, set in PatternFlowGreProtocolMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGreProtocolMetricTag + SetOffset(value uint32) PatternFlowGreProtocolMetricTag + // HasOffset checks if Offset has been set in PatternFlowGreProtocolMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGreProtocolMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGreProtocolMetricTag + SetLength(value uint32) PatternFlowGreProtocolMetricTag + // HasLength checks if Length has been set in PatternFlowGreProtocolMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGreProtocolMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGreProtocolMetricTag object +func (obj *patternFlowGreProtocolMetricTag) SetName(value string) PatternFlowGreProtocolMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGreProtocolMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGreProtocolMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGreProtocolMetricTag object +func (obj *patternFlowGreProtocolMetricTag) SetOffset(value uint32) PatternFlowGreProtocolMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGreProtocolMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGreProtocolMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGreProtocolMetricTag object +func (obj *patternFlowGreProtocolMetricTag) SetLength(value uint32) PatternFlowGreProtocolMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGreProtocolMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGreProtocolMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreProtocolMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGreProtocolMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGreProtocolMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_gre_reserved0.go b/gosnappi/pattern_flow_gre_reserved0.go new file mode 100644 index 00000000..361262a7 --- /dev/null +++ b/gosnappi/pattern_flow_gre_reserved0.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGreReserved0 ***** +type patternFlowGreReserved0 struct { + validation + obj *otg.PatternFlowGreReserved0 + marshaller marshalPatternFlowGreReserved0 + unMarshaller unMarshalPatternFlowGreReserved0 + incrementHolder PatternFlowGreReserved0Counter + decrementHolder PatternFlowGreReserved0Counter + metricTagsHolder PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter +} + +func NewPatternFlowGreReserved0() PatternFlowGreReserved0 { + obj := patternFlowGreReserved0{obj: &otg.PatternFlowGreReserved0{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreReserved0) msg() *otg.PatternFlowGreReserved0 { + return obj.obj +} + +func (obj *patternFlowGreReserved0) setMsg(msg *otg.PatternFlowGreReserved0) PatternFlowGreReserved0 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreReserved0 struct { + obj *patternFlowGreReserved0 +} + +type marshalPatternFlowGreReserved0 interface { + // ToProto marshals PatternFlowGreReserved0 to protobuf object *otg.PatternFlowGreReserved0 + ToProto() (*otg.PatternFlowGreReserved0, error) + // ToPbText marshals PatternFlowGreReserved0 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreReserved0 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreReserved0 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreReserved0 struct { + obj *patternFlowGreReserved0 +} + +type unMarshalPatternFlowGreReserved0 interface { + // FromProto unmarshals PatternFlowGreReserved0 from protobuf object *otg.PatternFlowGreReserved0 + FromProto(msg *otg.PatternFlowGreReserved0) (PatternFlowGreReserved0, error) + // FromPbText unmarshals PatternFlowGreReserved0 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreReserved0 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreReserved0 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreReserved0) Marshal() marshalPatternFlowGreReserved0 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreReserved0{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreReserved0) Unmarshal() unMarshalPatternFlowGreReserved0 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreReserved0{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreReserved0) ToProto() (*otg.PatternFlowGreReserved0, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreReserved0) FromProto(msg *otg.PatternFlowGreReserved0) (PatternFlowGreReserved0, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreReserved0) 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 *unMarshalpatternFlowGreReserved0) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGreReserved0) 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 *unMarshalpatternFlowGreReserved0) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGreReserved0) 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 *unMarshalpatternFlowGreReserved0) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGreReserved0) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreReserved0) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreReserved0) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreReserved0) Clone() (PatternFlowGreReserved0, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreReserved0() + 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 +} + +func (obj *patternFlowGreReserved0) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGreReserved0 is reserved bits +type PatternFlowGreReserved0 interface { + Validation + // msg marshals PatternFlowGreReserved0 to protobuf object *otg.PatternFlowGreReserved0 + // and doesn't set defaults + msg() *otg.PatternFlowGreReserved0 + // setMsg unmarshals PatternFlowGreReserved0 from protobuf object *otg.PatternFlowGreReserved0 + // and doesn't set defaults + setMsg(*otg.PatternFlowGreReserved0) PatternFlowGreReserved0 + // provides marshal interface + Marshal() marshalPatternFlowGreReserved0 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreReserved0 + // validate validates PatternFlowGreReserved0 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreReserved0, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGreReserved0ChoiceEnum, set in PatternFlowGreReserved0 + Choice() PatternFlowGreReserved0ChoiceEnum + // setChoice assigns PatternFlowGreReserved0ChoiceEnum provided by user to PatternFlowGreReserved0 + setChoice(value PatternFlowGreReserved0ChoiceEnum) PatternFlowGreReserved0 + // HasChoice checks if Choice has been set in PatternFlowGreReserved0 + HasChoice() bool + // Value returns uint32, set in PatternFlowGreReserved0. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGreReserved0 + SetValue(value uint32) PatternFlowGreReserved0 + // HasValue checks if Value has been set in PatternFlowGreReserved0 + HasValue() bool + // Values returns []uint32, set in PatternFlowGreReserved0. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGreReserved0 + SetValues(value []uint32) PatternFlowGreReserved0 + // Increment returns PatternFlowGreReserved0Counter, set in PatternFlowGreReserved0. + // PatternFlowGreReserved0Counter is integer counter pattern + Increment() PatternFlowGreReserved0Counter + // SetIncrement assigns PatternFlowGreReserved0Counter provided by user to PatternFlowGreReserved0. + // PatternFlowGreReserved0Counter is integer counter pattern + SetIncrement(value PatternFlowGreReserved0Counter) PatternFlowGreReserved0 + // HasIncrement checks if Increment has been set in PatternFlowGreReserved0 + HasIncrement() bool + // Decrement returns PatternFlowGreReserved0Counter, set in PatternFlowGreReserved0. + // PatternFlowGreReserved0Counter is integer counter pattern + Decrement() PatternFlowGreReserved0Counter + // SetDecrement assigns PatternFlowGreReserved0Counter provided by user to PatternFlowGreReserved0. + // PatternFlowGreReserved0Counter is integer counter pattern + SetDecrement(value PatternFlowGreReserved0Counter) PatternFlowGreReserved0 + // HasDecrement checks if Decrement has been set in PatternFlowGreReserved0 + HasDecrement() bool + // MetricTags returns PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIterIter, set in PatternFlowGreReserved0 + MetricTags() PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter + setNil() +} + +type PatternFlowGreReserved0ChoiceEnum string + +// Enum of Choice on PatternFlowGreReserved0 +var PatternFlowGreReserved0Choice = struct { + VALUE PatternFlowGreReserved0ChoiceEnum + VALUES PatternFlowGreReserved0ChoiceEnum + INCREMENT PatternFlowGreReserved0ChoiceEnum + DECREMENT PatternFlowGreReserved0ChoiceEnum +}{ + VALUE: PatternFlowGreReserved0ChoiceEnum("value"), + VALUES: PatternFlowGreReserved0ChoiceEnum("values"), + INCREMENT: PatternFlowGreReserved0ChoiceEnum("increment"), + DECREMENT: PatternFlowGreReserved0ChoiceEnum("decrement"), +} + +func (obj *patternFlowGreReserved0) Choice() PatternFlowGreReserved0ChoiceEnum { + return PatternFlowGreReserved0ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGreReserved0) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGreReserved0) setChoice(value PatternFlowGreReserved0ChoiceEnum) PatternFlowGreReserved0 { + intValue, ok := otg.PatternFlowGreReserved0_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGreReserved0ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGreReserved0_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGreReserved0Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGreReserved0Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGreReserved0Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowGreReserved0Counter().msg() + } + + if value == PatternFlowGreReserved0Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGreReserved0Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGreReserved0) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGreReserved0Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGreReserved0) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGreReserved0 object +func (obj *patternFlowGreReserved0) SetValue(value uint32) PatternFlowGreReserved0 { + obj.setChoice(PatternFlowGreReserved0Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGreReserved0) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGreReserved0 object +func (obj *patternFlowGreReserved0) SetValues(value []uint32) PatternFlowGreReserved0 { + obj.setChoice(PatternFlowGreReserved0Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGreReserved0Counter +func (obj *patternFlowGreReserved0) Increment() PatternFlowGreReserved0Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGreReserved0Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGreReserved0Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGreReserved0Counter +func (obj *patternFlowGreReserved0) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGreReserved0Counter value in the PatternFlowGreReserved0 object +func (obj *patternFlowGreReserved0) SetIncrement(value PatternFlowGreReserved0Counter) PatternFlowGreReserved0 { + obj.setChoice(PatternFlowGreReserved0Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGreReserved0Counter +func (obj *patternFlowGreReserved0) Decrement() PatternFlowGreReserved0Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGreReserved0Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGreReserved0Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGreReserved0Counter +func (obj *patternFlowGreReserved0) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGreReserved0Counter value in the PatternFlowGreReserved0 object +func (obj *patternFlowGreReserved0) SetDecrement(value PatternFlowGreReserved0Counter) PatternFlowGreReserved0 { + obj.setChoice(PatternFlowGreReserved0Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGreReserved0MetricTag +func (obj *patternFlowGreReserved0) MetricTags() PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGreReserved0MetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter struct { + obj *patternFlowGreReserved0 + patternFlowGreReserved0MetricTagSlice []PatternFlowGreReserved0MetricTag + fieldPtr *[]*otg.PatternFlowGreReserved0MetricTag +} + +func newPatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter(ptr *[]*otg.PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { + return &patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter interface { + setMsg(*patternFlowGreReserved0) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter + Items() []PatternFlowGreReserved0MetricTag + Add() PatternFlowGreReserved0MetricTag + Append(items ...PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter + Set(index int, newObj PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter + Clear() PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter + clearHolderSlice() PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter + appendHolderSlice(item PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter +} + +func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) setMsg(msg *patternFlowGreReserved0) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGreReserved0MetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) Items() []PatternFlowGreReserved0MetricTag { + return obj.patternFlowGreReserved0MetricTagSlice +} + +func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) Add() PatternFlowGreReserved0MetricTag { + newObj := &otg.PatternFlowGreReserved0MetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGreReserved0MetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGreReserved0MetricTagSlice = append(obj.patternFlowGreReserved0MetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) Append(items ...PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGreReserved0MetricTagSlice = append(obj.patternFlowGreReserved0MetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) Set(index int, newObj PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGreReserved0MetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) Clear() PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGreReserved0MetricTag{} + obj.patternFlowGreReserved0MetricTagSlice = []PatternFlowGreReserved0MetricTag{} + } + return obj +} +func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) clearHolderSlice() PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { + if len(obj.patternFlowGreReserved0MetricTagSlice) > 0 { + obj.patternFlowGreReserved0MetricTagSlice = []PatternFlowGreReserved0MetricTag{} + } + return obj +} +func (obj *patternFlowGreReserved0PatternFlowGreReserved0MetricTagIter) appendHolderSlice(item PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0PatternFlowGreReserved0MetricTagIter { + obj.patternFlowGreReserved0MetricTagSlice = append(obj.patternFlowGreReserved0MetricTagSlice, item) + return obj +} + +func (obj *patternFlowGreReserved0) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreReserved0.Value <= 4095 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGreReserved0.Values <= 4095 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGreReserved0MetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGreReserved0) setDefault() { + var choices_set int = 0 + var choice PatternFlowGreReserved0ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGreReserved0Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGreReserved0Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGreReserved0Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGreReserved0Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGreReserved0Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGreReserved0") + } + } else { + intVal := otg.PatternFlowGreReserved0_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGreReserved0_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gre_reserved0_counter.go b/gosnappi/pattern_flow_gre_reserved0_counter.go new file mode 100644 index 00000000..25796ac7 --- /dev/null +++ b/gosnappi/pattern_flow_gre_reserved0_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGreReserved0Counter ***** +type patternFlowGreReserved0Counter struct { + validation + obj *otg.PatternFlowGreReserved0Counter + marshaller marshalPatternFlowGreReserved0Counter + unMarshaller unMarshalPatternFlowGreReserved0Counter +} + +func NewPatternFlowGreReserved0Counter() PatternFlowGreReserved0Counter { + obj := patternFlowGreReserved0Counter{obj: &otg.PatternFlowGreReserved0Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreReserved0Counter) msg() *otg.PatternFlowGreReserved0Counter { + return obj.obj +} + +func (obj *patternFlowGreReserved0Counter) setMsg(msg *otg.PatternFlowGreReserved0Counter) PatternFlowGreReserved0Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreReserved0Counter struct { + obj *patternFlowGreReserved0Counter +} + +type marshalPatternFlowGreReserved0Counter interface { + // ToProto marshals PatternFlowGreReserved0Counter to protobuf object *otg.PatternFlowGreReserved0Counter + ToProto() (*otg.PatternFlowGreReserved0Counter, error) + // ToPbText marshals PatternFlowGreReserved0Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreReserved0Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreReserved0Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreReserved0Counter struct { + obj *patternFlowGreReserved0Counter +} + +type unMarshalPatternFlowGreReserved0Counter interface { + // FromProto unmarshals PatternFlowGreReserved0Counter from protobuf object *otg.PatternFlowGreReserved0Counter + FromProto(msg *otg.PatternFlowGreReserved0Counter) (PatternFlowGreReserved0Counter, error) + // FromPbText unmarshals PatternFlowGreReserved0Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreReserved0Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreReserved0Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreReserved0Counter) Marshal() marshalPatternFlowGreReserved0Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreReserved0Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreReserved0Counter) Unmarshal() unMarshalPatternFlowGreReserved0Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreReserved0Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreReserved0Counter) ToProto() (*otg.PatternFlowGreReserved0Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreReserved0Counter) FromProto(msg *otg.PatternFlowGreReserved0Counter) (PatternFlowGreReserved0Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreReserved0Counter) 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 *unMarshalpatternFlowGreReserved0Counter) 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 *marshalpatternFlowGreReserved0Counter) 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 *unMarshalpatternFlowGreReserved0Counter) 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 *marshalpatternFlowGreReserved0Counter) 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 *unMarshalpatternFlowGreReserved0Counter) 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 *patternFlowGreReserved0Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreReserved0Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreReserved0Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreReserved0Counter) Clone() (PatternFlowGreReserved0Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreReserved0Counter() + 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 +} + +// PatternFlowGreReserved0Counter is integer counter pattern +type PatternFlowGreReserved0Counter interface { + Validation + // msg marshals PatternFlowGreReserved0Counter to protobuf object *otg.PatternFlowGreReserved0Counter + // and doesn't set defaults + msg() *otg.PatternFlowGreReserved0Counter + // setMsg unmarshals PatternFlowGreReserved0Counter from protobuf object *otg.PatternFlowGreReserved0Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowGreReserved0Counter) PatternFlowGreReserved0Counter + // provides marshal interface + Marshal() marshalPatternFlowGreReserved0Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreReserved0Counter + // validate validates PatternFlowGreReserved0Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreReserved0Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGreReserved0Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGreReserved0Counter + SetStart(value uint32) PatternFlowGreReserved0Counter + // HasStart checks if Start has been set in PatternFlowGreReserved0Counter + HasStart() bool + // Step returns uint32, set in PatternFlowGreReserved0Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGreReserved0Counter + SetStep(value uint32) PatternFlowGreReserved0Counter + // HasStep checks if Step has been set in PatternFlowGreReserved0Counter + HasStep() bool + // Count returns uint32, set in PatternFlowGreReserved0Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGreReserved0Counter + SetCount(value uint32) PatternFlowGreReserved0Counter + // HasCount checks if Count has been set in PatternFlowGreReserved0Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGreReserved0Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGreReserved0Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGreReserved0Counter object +func (obj *patternFlowGreReserved0Counter) SetStart(value uint32) PatternFlowGreReserved0Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGreReserved0Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGreReserved0Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGreReserved0Counter object +func (obj *patternFlowGreReserved0Counter) SetStep(value uint32) PatternFlowGreReserved0Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGreReserved0Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGreReserved0Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGreReserved0Counter object +func (obj *patternFlowGreReserved0Counter) SetCount(value uint32) PatternFlowGreReserved0Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGreReserved0Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreReserved0Counter.Start <= 4095 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreReserved0Counter.Step <= 4095 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreReserved0Counter.Count <= 4095 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGreReserved0Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gre_reserved0_metric_tag.go b/gosnappi/pattern_flow_gre_reserved0_metric_tag.go new file mode 100644 index 00000000..015de8b2 --- /dev/null +++ b/gosnappi/pattern_flow_gre_reserved0_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGreReserved0MetricTag ***** +type patternFlowGreReserved0MetricTag struct { + validation + obj *otg.PatternFlowGreReserved0MetricTag + marshaller marshalPatternFlowGreReserved0MetricTag + unMarshaller unMarshalPatternFlowGreReserved0MetricTag +} + +func NewPatternFlowGreReserved0MetricTag() PatternFlowGreReserved0MetricTag { + obj := patternFlowGreReserved0MetricTag{obj: &otg.PatternFlowGreReserved0MetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreReserved0MetricTag) msg() *otg.PatternFlowGreReserved0MetricTag { + return obj.obj +} + +func (obj *patternFlowGreReserved0MetricTag) setMsg(msg *otg.PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0MetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreReserved0MetricTag struct { + obj *patternFlowGreReserved0MetricTag +} + +type marshalPatternFlowGreReserved0MetricTag interface { + // ToProto marshals PatternFlowGreReserved0MetricTag to protobuf object *otg.PatternFlowGreReserved0MetricTag + ToProto() (*otg.PatternFlowGreReserved0MetricTag, error) + // ToPbText marshals PatternFlowGreReserved0MetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreReserved0MetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreReserved0MetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreReserved0MetricTag struct { + obj *patternFlowGreReserved0MetricTag +} + +type unMarshalPatternFlowGreReserved0MetricTag interface { + // FromProto unmarshals PatternFlowGreReserved0MetricTag from protobuf object *otg.PatternFlowGreReserved0MetricTag + FromProto(msg *otg.PatternFlowGreReserved0MetricTag) (PatternFlowGreReserved0MetricTag, error) + // FromPbText unmarshals PatternFlowGreReserved0MetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreReserved0MetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreReserved0MetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreReserved0MetricTag) Marshal() marshalPatternFlowGreReserved0MetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreReserved0MetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreReserved0MetricTag) Unmarshal() unMarshalPatternFlowGreReserved0MetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreReserved0MetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreReserved0MetricTag) ToProto() (*otg.PatternFlowGreReserved0MetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreReserved0MetricTag) FromProto(msg *otg.PatternFlowGreReserved0MetricTag) (PatternFlowGreReserved0MetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreReserved0MetricTag) 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 *unMarshalpatternFlowGreReserved0MetricTag) 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 *marshalpatternFlowGreReserved0MetricTag) 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 *unMarshalpatternFlowGreReserved0MetricTag) 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 *marshalpatternFlowGreReserved0MetricTag) 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 *unMarshalpatternFlowGreReserved0MetricTag) 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 *patternFlowGreReserved0MetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreReserved0MetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreReserved0MetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreReserved0MetricTag) Clone() (PatternFlowGreReserved0MetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreReserved0MetricTag() + 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 +} + +// PatternFlowGreReserved0MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGreReserved0MetricTag interface { + Validation + // msg marshals PatternFlowGreReserved0MetricTag to protobuf object *otg.PatternFlowGreReserved0MetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGreReserved0MetricTag + // setMsg unmarshals PatternFlowGreReserved0MetricTag from protobuf object *otg.PatternFlowGreReserved0MetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGreReserved0MetricTag) PatternFlowGreReserved0MetricTag + // provides marshal interface + Marshal() marshalPatternFlowGreReserved0MetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreReserved0MetricTag + // validate validates PatternFlowGreReserved0MetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreReserved0MetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGreReserved0MetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGreReserved0MetricTag + SetName(value string) PatternFlowGreReserved0MetricTag + // Offset returns uint32, set in PatternFlowGreReserved0MetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGreReserved0MetricTag + SetOffset(value uint32) PatternFlowGreReserved0MetricTag + // HasOffset checks if Offset has been set in PatternFlowGreReserved0MetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGreReserved0MetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGreReserved0MetricTag + SetLength(value uint32) PatternFlowGreReserved0MetricTag + // HasLength checks if Length has been set in PatternFlowGreReserved0MetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGreReserved0MetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGreReserved0MetricTag object +func (obj *patternFlowGreReserved0MetricTag) SetName(value string) PatternFlowGreReserved0MetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGreReserved0MetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGreReserved0MetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGreReserved0MetricTag object +func (obj *patternFlowGreReserved0MetricTag) SetOffset(value uint32) PatternFlowGreReserved0MetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGreReserved0MetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGreReserved0MetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGreReserved0MetricTag object +func (obj *patternFlowGreReserved0MetricTag) SetLength(value uint32) PatternFlowGreReserved0MetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGreReserved0MetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGreReserved0MetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 11 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreReserved0MetricTag.Offset <= 11 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 12 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGreReserved0MetricTag.Length <= 12 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGreReserved0MetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(12) + } + +} diff --git a/gosnappi/pattern_flow_gre_reserved1.go b/gosnappi/pattern_flow_gre_reserved1.go new file mode 100644 index 00000000..2ceb0aea --- /dev/null +++ b/gosnappi/pattern_flow_gre_reserved1.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGreReserved1 ***** +type patternFlowGreReserved1 struct { + validation + obj *otg.PatternFlowGreReserved1 + marshaller marshalPatternFlowGreReserved1 + unMarshaller unMarshalPatternFlowGreReserved1 + incrementHolder PatternFlowGreReserved1Counter + decrementHolder PatternFlowGreReserved1Counter + metricTagsHolder PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter +} + +func NewPatternFlowGreReserved1() PatternFlowGreReserved1 { + obj := patternFlowGreReserved1{obj: &otg.PatternFlowGreReserved1{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreReserved1) msg() *otg.PatternFlowGreReserved1 { + return obj.obj +} + +func (obj *patternFlowGreReserved1) setMsg(msg *otg.PatternFlowGreReserved1) PatternFlowGreReserved1 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreReserved1 struct { + obj *patternFlowGreReserved1 +} + +type marshalPatternFlowGreReserved1 interface { + // ToProto marshals PatternFlowGreReserved1 to protobuf object *otg.PatternFlowGreReserved1 + ToProto() (*otg.PatternFlowGreReserved1, error) + // ToPbText marshals PatternFlowGreReserved1 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreReserved1 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreReserved1 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreReserved1 struct { + obj *patternFlowGreReserved1 +} + +type unMarshalPatternFlowGreReserved1 interface { + // FromProto unmarshals PatternFlowGreReserved1 from protobuf object *otg.PatternFlowGreReserved1 + FromProto(msg *otg.PatternFlowGreReserved1) (PatternFlowGreReserved1, error) + // FromPbText unmarshals PatternFlowGreReserved1 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreReserved1 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreReserved1 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreReserved1) Marshal() marshalPatternFlowGreReserved1 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreReserved1{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreReserved1) Unmarshal() unMarshalPatternFlowGreReserved1 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreReserved1{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreReserved1) ToProto() (*otg.PatternFlowGreReserved1, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreReserved1) FromProto(msg *otg.PatternFlowGreReserved1) (PatternFlowGreReserved1, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreReserved1) 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 *unMarshalpatternFlowGreReserved1) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGreReserved1) 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 *unMarshalpatternFlowGreReserved1) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGreReserved1) 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 *unMarshalpatternFlowGreReserved1) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGreReserved1) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreReserved1) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreReserved1) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreReserved1) Clone() (PatternFlowGreReserved1, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreReserved1() + 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 +} + +func (obj *patternFlowGreReserved1) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGreReserved1 is optional reserved field. Only present if the checksum_present bit is set. +type PatternFlowGreReserved1 interface { + Validation + // msg marshals PatternFlowGreReserved1 to protobuf object *otg.PatternFlowGreReserved1 + // and doesn't set defaults + msg() *otg.PatternFlowGreReserved1 + // setMsg unmarshals PatternFlowGreReserved1 from protobuf object *otg.PatternFlowGreReserved1 + // and doesn't set defaults + setMsg(*otg.PatternFlowGreReserved1) PatternFlowGreReserved1 + // provides marshal interface + Marshal() marshalPatternFlowGreReserved1 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreReserved1 + // validate validates PatternFlowGreReserved1 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreReserved1, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGreReserved1ChoiceEnum, set in PatternFlowGreReserved1 + Choice() PatternFlowGreReserved1ChoiceEnum + // setChoice assigns PatternFlowGreReserved1ChoiceEnum provided by user to PatternFlowGreReserved1 + setChoice(value PatternFlowGreReserved1ChoiceEnum) PatternFlowGreReserved1 + // HasChoice checks if Choice has been set in PatternFlowGreReserved1 + HasChoice() bool + // Value returns uint32, set in PatternFlowGreReserved1. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGreReserved1 + SetValue(value uint32) PatternFlowGreReserved1 + // HasValue checks if Value has been set in PatternFlowGreReserved1 + HasValue() bool + // Values returns []uint32, set in PatternFlowGreReserved1. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGreReserved1 + SetValues(value []uint32) PatternFlowGreReserved1 + // Increment returns PatternFlowGreReserved1Counter, set in PatternFlowGreReserved1. + // PatternFlowGreReserved1Counter is integer counter pattern + Increment() PatternFlowGreReserved1Counter + // SetIncrement assigns PatternFlowGreReserved1Counter provided by user to PatternFlowGreReserved1. + // PatternFlowGreReserved1Counter is integer counter pattern + SetIncrement(value PatternFlowGreReserved1Counter) PatternFlowGreReserved1 + // HasIncrement checks if Increment has been set in PatternFlowGreReserved1 + HasIncrement() bool + // Decrement returns PatternFlowGreReserved1Counter, set in PatternFlowGreReserved1. + // PatternFlowGreReserved1Counter is integer counter pattern + Decrement() PatternFlowGreReserved1Counter + // SetDecrement assigns PatternFlowGreReserved1Counter provided by user to PatternFlowGreReserved1. + // PatternFlowGreReserved1Counter is integer counter pattern + SetDecrement(value PatternFlowGreReserved1Counter) PatternFlowGreReserved1 + // HasDecrement checks if Decrement has been set in PatternFlowGreReserved1 + HasDecrement() bool + // MetricTags returns PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIterIter, set in PatternFlowGreReserved1 + MetricTags() PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter + setNil() +} + +type PatternFlowGreReserved1ChoiceEnum string + +// Enum of Choice on PatternFlowGreReserved1 +var PatternFlowGreReserved1Choice = struct { + VALUE PatternFlowGreReserved1ChoiceEnum + VALUES PatternFlowGreReserved1ChoiceEnum + INCREMENT PatternFlowGreReserved1ChoiceEnum + DECREMENT PatternFlowGreReserved1ChoiceEnum +}{ + VALUE: PatternFlowGreReserved1ChoiceEnum("value"), + VALUES: PatternFlowGreReserved1ChoiceEnum("values"), + INCREMENT: PatternFlowGreReserved1ChoiceEnum("increment"), + DECREMENT: PatternFlowGreReserved1ChoiceEnum("decrement"), +} + +func (obj *patternFlowGreReserved1) Choice() PatternFlowGreReserved1ChoiceEnum { + return PatternFlowGreReserved1ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGreReserved1) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGreReserved1) setChoice(value PatternFlowGreReserved1ChoiceEnum) PatternFlowGreReserved1 { + intValue, ok := otg.PatternFlowGreReserved1_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGreReserved1ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGreReserved1_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGreReserved1Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGreReserved1Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGreReserved1Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowGreReserved1Counter().msg() + } + + if value == PatternFlowGreReserved1Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGreReserved1Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGreReserved1) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGreReserved1Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGreReserved1) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGreReserved1 object +func (obj *patternFlowGreReserved1) SetValue(value uint32) PatternFlowGreReserved1 { + obj.setChoice(PatternFlowGreReserved1Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGreReserved1) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGreReserved1 object +func (obj *patternFlowGreReserved1) SetValues(value []uint32) PatternFlowGreReserved1 { + obj.setChoice(PatternFlowGreReserved1Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGreReserved1Counter +func (obj *patternFlowGreReserved1) Increment() PatternFlowGreReserved1Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGreReserved1Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGreReserved1Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGreReserved1Counter +func (obj *patternFlowGreReserved1) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGreReserved1Counter value in the PatternFlowGreReserved1 object +func (obj *patternFlowGreReserved1) SetIncrement(value PatternFlowGreReserved1Counter) PatternFlowGreReserved1 { + obj.setChoice(PatternFlowGreReserved1Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGreReserved1Counter +func (obj *patternFlowGreReserved1) Decrement() PatternFlowGreReserved1Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGreReserved1Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGreReserved1Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGreReserved1Counter +func (obj *patternFlowGreReserved1) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGreReserved1Counter value in the PatternFlowGreReserved1 object +func (obj *patternFlowGreReserved1) SetDecrement(value PatternFlowGreReserved1Counter) PatternFlowGreReserved1 { + obj.setChoice(PatternFlowGreReserved1Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGreReserved1MetricTag +func (obj *patternFlowGreReserved1) MetricTags() PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGreReserved1MetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter struct { + obj *patternFlowGreReserved1 + patternFlowGreReserved1MetricTagSlice []PatternFlowGreReserved1MetricTag + fieldPtr *[]*otg.PatternFlowGreReserved1MetricTag +} + +func newPatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter(ptr *[]*otg.PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { + return &patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter interface { + setMsg(*patternFlowGreReserved1) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter + Items() []PatternFlowGreReserved1MetricTag + Add() PatternFlowGreReserved1MetricTag + Append(items ...PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter + Set(index int, newObj PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter + Clear() PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter + clearHolderSlice() PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter + appendHolderSlice(item PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter +} + +func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) setMsg(msg *patternFlowGreReserved1) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGreReserved1MetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) Items() []PatternFlowGreReserved1MetricTag { + return obj.patternFlowGreReserved1MetricTagSlice +} + +func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) Add() PatternFlowGreReserved1MetricTag { + newObj := &otg.PatternFlowGreReserved1MetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGreReserved1MetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGreReserved1MetricTagSlice = append(obj.patternFlowGreReserved1MetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) Append(items ...PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGreReserved1MetricTagSlice = append(obj.patternFlowGreReserved1MetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) Set(index int, newObj PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGreReserved1MetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) Clear() PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGreReserved1MetricTag{} + obj.patternFlowGreReserved1MetricTagSlice = []PatternFlowGreReserved1MetricTag{} + } + return obj +} +func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) clearHolderSlice() PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { + if len(obj.patternFlowGreReserved1MetricTagSlice) > 0 { + obj.patternFlowGreReserved1MetricTagSlice = []PatternFlowGreReserved1MetricTag{} + } + return obj +} +func (obj *patternFlowGreReserved1PatternFlowGreReserved1MetricTagIter) appendHolderSlice(item PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1PatternFlowGreReserved1MetricTagIter { + obj.patternFlowGreReserved1MetricTagSlice = append(obj.patternFlowGreReserved1MetricTagSlice, item) + return obj +} + +func (obj *patternFlowGreReserved1) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreReserved1.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGreReserved1.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGreReserved1MetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGreReserved1) setDefault() { + var choices_set int = 0 + var choice PatternFlowGreReserved1ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGreReserved1Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGreReserved1Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGreReserved1Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGreReserved1Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGreReserved1Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGreReserved1") + } + } else { + intVal := otg.PatternFlowGreReserved1_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGreReserved1_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gre_reserved1_counter.go b/gosnappi/pattern_flow_gre_reserved1_counter.go new file mode 100644 index 00000000..363b3b4a --- /dev/null +++ b/gosnappi/pattern_flow_gre_reserved1_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGreReserved1Counter ***** +type patternFlowGreReserved1Counter struct { + validation + obj *otg.PatternFlowGreReserved1Counter + marshaller marshalPatternFlowGreReserved1Counter + unMarshaller unMarshalPatternFlowGreReserved1Counter +} + +func NewPatternFlowGreReserved1Counter() PatternFlowGreReserved1Counter { + obj := patternFlowGreReserved1Counter{obj: &otg.PatternFlowGreReserved1Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreReserved1Counter) msg() *otg.PatternFlowGreReserved1Counter { + return obj.obj +} + +func (obj *patternFlowGreReserved1Counter) setMsg(msg *otg.PatternFlowGreReserved1Counter) PatternFlowGreReserved1Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreReserved1Counter struct { + obj *patternFlowGreReserved1Counter +} + +type marshalPatternFlowGreReserved1Counter interface { + // ToProto marshals PatternFlowGreReserved1Counter to protobuf object *otg.PatternFlowGreReserved1Counter + ToProto() (*otg.PatternFlowGreReserved1Counter, error) + // ToPbText marshals PatternFlowGreReserved1Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreReserved1Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreReserved1Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreReserved1Counter struct { + obj *patternFlowGreReserved1Counter +} + +type unMarshalPatternFlowGreReserved1Counter interface { + // FromProto unmarshals PatternFlowGreReserved1Counter from protobuf object *otg.PatternFlowGreReserved1Counter + FromProto(msg *otg.PatternFlowGreReserved1Counter) (PatternFlowGreReserved1Counter, error) + // FromPbText unmarshals PatternFlowGreReserved1Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreReserved1Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreReserved1Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreReserved1Counter) Marshal() marshalPatternFlowGreReserved1Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreReserved1Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreReserved1Counter) Unmarshal() unMarshalPatternFlowGreReserved1Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreReserved1Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreReserved1Counter) ToProto() (*otg.PatternFlowGreReserved1Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreReserved1Counter) FromProto(msg *otg.PatternFlowGreReserved1Counter) (PatternFlowGreReserved1Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreReserved1Counter) 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 *unMarshalpatternFlowGreReserved1Counter) 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 *marshalpatternFlowGreReserved1Counter) 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 *unMarshalpatternFlowGreReserved1Counter) 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 *marshalpatternFlowGreReserved1Counter) 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 *unMarshalpatternFlowGreReserved1Counter) 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 *patternFlowGreReserved1Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreReserved1Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreReserved1Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreReserved1Counter) Clone() (PatternFlowGreReserved1Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreReserved1Counter() + 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 +} + +// PatternFlowGreReserved1Counter is integer counter pattern +type PatternFlowGreReserved1Counter interface { + Validation + // msg marshals PatternFlowGreReserved1Counter to protobuf object *otg.PatternFlowGreReserved1Counter + // and doesn't set defaults + msg() *otg.PatternFlowGreReserved1Counter + // setMsg unmarshals PatternFlowGreReserved1Counter from protobuf object *otg.PatternFlowGreReserved1Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowGreReserved1Counter) PatternFlowGreReserved1Counter + // provides marshal interface + Marshal() marshalPatternFlowGreReserved1Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreReserved1Counter + // validate validates PatternFlowGreReserved1Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreReserved1Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGreReserved1Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGreReserved1Counter + SetStart(value uint32) PatternFlowGreReserved1Counter + // HasStart checks if Start has been set in PatternFlowGreReserved1Counter + HasStart() bool + // Step returns uint32, set in PatternFlowGreReserved1Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGreReserved1Counter + SetStep(value uint32) PatternFlowGreReserved1Counter + // HasStep checks if Step has been set in PatternFlowGreReserved1Counter + HasStep() bool + // Count returns uint32, set in PatternFlowGreReserved1Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGreReserved1Counter + SetCount(value uint32) PatternFlowGreReserved1Counter + // HasCount checks if Count has been set in PatternFlowGreReserved1Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGreReserved1Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGreReserved1Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGreReserved1Counter object +func (obj *patternFlowGreReserved1Counter) SetStart(value uint32) PatternFlowGreReserved1Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGreReserved1Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGreReserved1Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGreReserved1Counter object +func (obj *patternFlowGreReserved1Counter) SetStep(value uint32) PatternFlowGreReserved1Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGreReserved1Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGreReserved1Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGreReserved1Counter object +func (obj *patternFlowGreReserved1Counter) SetCount(value uint32) PatternFlowGreReserved1Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGreReserved1Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreReserved1Counter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreReserved1Counter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreReserved1Counter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGreReserved1Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gre_reserved1_metric_tag.go b/gosnappi/pattern_flow_gre_reserved1_metric_tag.go new file mode 100644 index 00000000..b4fd5dd9 --- /dev/null +++ b/gosnappi/pattern_flow_gre_reserved1_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGreReserved1MetricTag ***** +type patternFlowGreReserved1MetricTag struct { + validation + obj *otg.PatternFlowGreReserved1MetricTag + marshaller marshalPatternFlowGreReserved1MetricTag + unMarshaller unMarshalPatternFlowGreReserved1MetricTag +} + +func NewPatternFlowGreReserved1MetricTag() PatternFlowGreReserved1MetricTag { + obj := patternFlowGreReserved1MetricTag{obj: &otg.PatternFlowGreReserved1MetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreReserved1MetricTag) msg() *otg.PatternFlowGreReserved1MetricTag { + return obj.obj +} + +func (obj *patternFlowGreReserved1MetricTag) setMsg(msg *otg.PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1MetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreReserved1MetricTag struct { + obj *patternFlowGreReserved1MetricTag +} + +type marshalPatternFlowGreReserved1MetricTag interface { + // ToProto marshals PatternFlowGreReserved1MetricTag to protobuf object *otg.PatternFlowGreReserved1MetricTag + ToProto() (*otg.PatternFlowGreReserved1MetricTag, error) + // ToPbText marshals PatternFlowGreReserved1MetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreReserved1MetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreReserved1MetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreReserved1MetricTag struct { + obj *patternFlowGreReserved1MetricTag +} + +type unMarshalPatternFlowGreReserved1MetricTag interface { + // FromProto unmarshals PatternFlowGreReserved1MetricTag from protobuf object *otg.PatternFlowGreReserved1MetricTag + FromProto(msg *otg.PatternFlowGreReserved1MetricTag) (PatternFlowGreReserved1MetricTag, error) + // FromPbText unmarshals PatternFlowGreReserved1MetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreReserved1MetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreReserved1MetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreReserved1MetricTag) Marshal() marshalPatternFlowGreReserved1MetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreReserved1MetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreReserved1MetricTag) Unmarshal() unMarshalPatternFlowGreReserved1MetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreReserved1MetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreReserved1MetricTag) ToProto() (*otg.PatternFlowGreReserved1MetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreReserved1MetricTag) FromProto(msg *otg.PatternFlowGreReserved1MetricTag) (PatternFlowGreReserved1MetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreReserved1MetricTag) 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 *unMarshalpatternFlowGreReserved1MetricTag) 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 *marshalpatternFlowGreReserved1MetricTag) 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 *unMarshalpatternFlowGreReserved1MetricTag) 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 *marshalpatternFlowGreReserved1MetricTag) 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 *unMarshalpatternFlowGreReserved1MetricTag) 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 *patternFlowGreReserved1MetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreReserved1MetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreReserved1MetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreReserved1MetricTag) Clone() (PatternFlowGreReserved1MetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreReserved1MetricTag() + 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 +} + +// PatternFlowGreReserved1MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGreReserved1MetricTag interface { + Validation + // msg marshals PatternFlowGreReserved1MetricTag to protobuf object *otg.PatternFlowGreReserved1MetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGreReserved1MetricTag + // setMsg unmarshals PatternFlowGreReserved1MetricTag from protobuf object *otg.PatternFlowGreReserved1MetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGreReserved1MetricTag) PatternFlowGreReserved1MetricTag + // provides marshal interface + Marshal() marshalPatternFlowGreReserved1MetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreReserved1MetricTag + // validate validates PatternFlowGreReserved1MetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreReserved1MetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGreReserved1MetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGreReserved1MetricTag + SetName(value string) PatternFlowGreReserved1MetricTag + // Offset returns uint32, set in PatternFlowGreReserved1MetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGreReserved1MetricTag + SetOffset(value uint32) PatternFlowGreReserved1MetricTag + // HasOffset checks if Offset has been set in PatternFlowGreReserved1MetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGreReserved1MetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGreReserved1MetricTag + SetLength(value uint32) PatternFlowGreReserved1MetricTag + // HasLength checks if Length has been set in PatternFlowGreReserved1MetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGreReserved1MetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGreReserved1MetricTag object +func (obj *patternFlowGreReserved1MetricTag) SetName(value string) PatternFlowGreReserved1MetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGreReserved1MetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGreReserved1MetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGreReserved1MetricTag object +func (obj *patternFlowGreReserved1MetricTag) SetOffset(value uint32) PatternFlowGreReserved1MetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGreReserved1MetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGreReserved1MetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGreReserved1MetricTag object +func (obj *patternFlowGreReserved1MetricTag) SetLength(value uint32) PatternFlowGreReserved1MetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGreReserved1MetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGreReserved1MetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreReserved1MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGreReserved1MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGreReserved1MetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_gre_version.go b/gosnappi/pattern_flow_gre_version.go new file mode 100644 index 00000000..bdfdbcf9 --- /dev/null +++ b/gosnappi/pattern_flow_gre_version.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGreVersion ***** +type patternFlowGreVersion struct { + validation + obj *otg.PatternFlowGreVersion + marshaller marshalPatternFlowGreVersion + unMarshaller unMarshalPatternFlowGreVersion + incrementHolder PatternFlowGreVersionCounter + decrementHolder PatternFlowGreVersionCounter + metricTagsHolder PatternFlowGreVersionPatternFlowGreVersionMetricTagIter +} + +func NewPatternFlowGreVersion() PatternFlowGreVersion { + obj := patternFlowGreVersion{obj: &otg.PatternFlowGreVersion{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreVersion) msg() *otg.PatternFlowGreVersion { + return obj.obj +} + +func (obj *patternFlowGreVersion) setMsg(msg *otg.PatternFlowGreVersion) PatternFlowGreVersion { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreVersion struct { + obj *patternFlowGreVersion +} + +type marshalPatternFlowGreVersion interface { + // ToProto marshals PatternFlowGreVersion to protobuf object *otg.PatternFlowGreVersion + ToProto() (*otg.PatternFlowGreVersion, error) + // ToPbText marshals PatternFlowGreVersion to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreVersion to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreVersion to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreVersion struct { + obj *patternFlowGreVersion +} + +type unMarshalPatternFlowGreVersion interface { + // FromProto unmarshals PatternFlowGreVersion from protobuf object *otg.PatternFlowGreVersion + FromProto(msg *otg.PatternFlowGreVersion) (PatternFlowGreVersion, error) + // FromPbText unmarshals PatternFlowGreVersion from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreVersion from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreVersion from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreVersion) Marshal() marshalPatternFlowGreVersion { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreVersion{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreVersion) Unmarshal() unMarshalPatternFlowGreVersion { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreVersion{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreVersion) ToProto() (*otg.PatternFlowGreVersion, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreVersion) FromProto(msg *otg.PatternFlowGreVersion) (PatternFlowGreVersion, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreVersion) 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 *unMarshalpatternFlowGreVersion) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGreVersion) 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 *unMarshalpatternFlowGreVersion) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGreVersion) 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 *unMarshalpatternFlowGreVersion) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGreVersion) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreVersion) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreVersion) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreVersion) Clone() (PatternFlowGreVersion, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreVersion() + 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 +} + +func (obj *patternFlowGreVersion) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGreVersion is gRE version number +type PatternFlowGreVersion interface { + Validation + // msg marshals PatternFlowGreVersion to protobuf object *otg.PatternFlowGreVersion + // and doesn't set defaults + msg() *otg.PatternFlowGreVersion + // setMsg unmarshals PatternFlowGreVersion from protobuf object *otg.PatternFlowGreVersion + // and doesn't set defaults + setMsg(*otg.PatternFlowGreVersion) PatternFlowGreVersion + // provides marshal interface + Marshal() marshalPatternFlowGreVersion + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreVersion + // validate validates PatternFlowGreVersion + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreVersion, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGreVersionChoiceEnum, set in PatternFlowGreVersion + Choice() PatternFlowGreVersionChoiceEnum + // setChoice assigns PatternFlowGreVersionChoiceEnum provided by user to PatternFlowGreVersion + setChoice(value PatternFlowGreVersionChoiceEnum) PatternFlowGreVersion + // HasChoice checks if Choice has been set in PatternFlowGreVersion + HasChoice() bool + // Value returns uint32, set in PatternFlowGreVersion. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGreVersion + SetValue(value uint32) PatternFlowGreVersion + // HasValue checks if Value has been set in PatternFlowGreVersion + HasValue() bool + // Values returns []uint32, set in PatternFlowGreVersion. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGreVersion + SetValues(value []uint32) PatternFlowGreVersion + // Increment returns PatternFlowGreVersionCounter, set in PatternFlowGreVersion. + // PatternFlowGreVersionCounter is integer counter pattern + Increment() PatternFlowGreVersionCounter + // SetIncrement assigns PatternFlowGreVersionCounter provided by user to PatternFlowGreVersion. + // PatternFlowGreVersionCounter is integer counter pattern + SetIncrement(value PatternFlowGreVersionCounter) PatternFlowGreVersion + // HasIncrement checks if Increment has been set in PatternFlowGreVersion + HasIncrement() bool + // Decrement returns PatternFlowGreVersionCounter, set in PatternFlowGreVersion. + // PatternFlowGreVersionCounter is integer counter pattern + Decrement() PatternFlowGreVersionCounter + // SetDecrement assigns PatternFlowGreVersionCounter provided by user to PatternFlowGreVersion. + // PatternFlowGreVersionCounter is integer counter pattern + SetDecrement(value PatternFlowGreVersionCounter) PatternFlowGreVersion + // HasDecrement checks if Decrement has been set in PatternFlowGreVersion + HasDecrement() bool + // MetricTags returns PatternFlowGreVersionPatternFlowGreVersionMetricTagIterIter, set in PatternFlowGreVersion + MetricTags() PatternFlowGreVersionPatternFlowGreVersionMetricTagIter + setNil() +} + +type PatternFlowGreVersionChoiceEnum string + +// Enum of Choice on PatternFlowGreVersion +var PatternFlowGreVersionChoice = struct { + VALUE PatternFlowGreVersionChoiceEnum + VALUES PatternFlowGreVersionChoiceEnum + INCREMENT PatternFlowGreVersionChoiceEnum + DECREMENT PatternFlowGreVersionChoiceEnum +}{ + VALUE: PatternFlowGreVersionChoiceEnum("value"), + VALUES: PatternFlowGreVersionChoiceEnum("values"), + INCREMENT: PatternFlowGreVersionChoiceEnum("increment"), + DECREMENT: PatternFlowGreVersionChoiceEnum("decrement"), +} + +func (obj *patternFlowGreVersion) Choice() PatternFlowGreVersionChoiceEnum { + return PatternFlowGreVersionChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGreVersion) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGreVersion) setChoice(value PatternFlowGreVersionChoiceEnum) PatternFlowGreVersion { + intValue, ok := otg.PatternFlowGreVersion_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGreVersionChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGreVersion_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGreVersionChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGreVersionChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGreVersionChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGreVersionCounter().msg() + } + + if value == PatternFlowGreVersionChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGreVersionCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGreVersion) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGreVersionChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGreVersion) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGreVersion object +func (obj *patternFlowGreVersion) SetValue(value uint32) PatternFlowGreVersion { + obj.setChoice(PatternFlowGreVersionChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGreVersion) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGreVersion object +func (obj *patternFlowGreVersion) SetValues(value []uint32) PatternFlowGreVersion { + obj.setChoice(PatternFlowGreVersionChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGreVersionCounter +func (obj *patternFlowGreVersion) Increment() PatternFlowGreVersionCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGreVersionChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGreVersionCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGreVersionCounter +func (obj *patternFlowGreVersion) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGreVersionCounter value in the PatternFlowGreVersion object +func (obj *patternFlowGreVersion) SetIncrement(value PatternFlowGreVersionCounter) PatternFlowGreVersion { + obj.setChoice(PatternFlowGreVersionChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGreVersionCounter +func (obj *patternFlowGreVersion) Decrement() PatternFlowGreVersionCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGreVersionChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGreVersionCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGreVersionCounter +func (obj *patternFlowGreVersion) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGreVersionCounter value in the PatternFlowGreVersion object +func (obj *patternFlowGreVersion) SetDecrement(value PatternFlowGreVersionCounter) PatternFlowGreVersion { + obj.setChoice(PatternFlowGreVersionChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGreVersionMetricTag +func (obj *patternFlowGreVersion) MetricTags() PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGreVersionMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGreVersionPatternFlowGreVersionMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGreVersionPatternFlowGreVersionMetricTagIter struct { + obj *patternFlowGreVersion + patternFlowGreVersionMetricTagSlice []PatternFlowGreVersionMetricTag + fieldPtr *[]*otg.PatternFlowGreVersionMetricTag +} + +func newPatternFlowGreVersionPatternFlowGreVersionMetricTagIter(ptr *[]*otg.PatternFlowGreVersionMetricTag) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { + return &patternFlowGreVersionPatternFlowGreVersionMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGreVersionPatternFlowGreVersionMetricTagIter interface { + setMsg(*patternFlowGreVersion) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter + Items() []PatternFlowGreVersionMetricTag + Add() PatternFlowGreVersionMetricTag + Append(items ...PatternFlowGreVersionMetricTag) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter + Set(index int, newObj PatternFlowGreVersionMetricTag) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter + Clear() PatternFlowGreVersionPatternFlowGreVersionMetricTagIter + clearHolderSlice() PatternFlowGreVersionPatternFlowGreVersionMetricTagIter + appendHolderSlice(item PatternFlowGreVersionMetricTag) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter +} + +func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) setMsg(msg *patternFlowGreVersion) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGreVersionMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) Items() []PatternFlowGreVersionMetricTag { + return obj.patternFlowGreVersionMetricTagSlice +} + +func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) Add() PatternFlowGreVersionMetricTag { + newObj := &otg.PatternFlowGreVersionMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGreVersionMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGreVersionMetricTagSlice = append(obj.patternFlowGreVersionMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) Append(items ...PatternFlowGreVersionMetricTag) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGreVersionMetricTagSlice = append(obj.patternFlowGreVersionMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) Set(index int, newObj PatternFlowGreVersionMetricTag) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGreVersionMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) Clear() PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGreVersionMetricTag{} + obj.patternFlowGreVersionMetricTagSlice = []PatternFlowGreVersionMetricTag{} + } + return obj +} +func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) clearHolderSlice() PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { + if len(obj.patternFlowGreVersionMetricTagSlice) > 0 { + obj.patternFlowGreVersionMetricTagSlice = []PatternFlowGreVersionMetricTag{} + } + return obj +} +func (obj *patternFlowGreVersionPatternFlowGreVersionMetricTagIter) appendHolderSlice(item PatternFlowGreVersionMetricTag) PatternFlowGreVersionPatternFlowGreVersionMetricTagIter { + obj.patternFlowGreVersionMetricTagSlice = append(obj.patternFlowGreVersionMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGreVersion) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreVersion.Value <= 7 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGreVersion.Values <= 7 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGreVersionMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGreVersion) setDefault() { + var choices_set int = 0 + var choice PatternFlowGreVersionChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGreVersionChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGreVersionChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGreVersionChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGreVersionChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGreVersionChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGreVersion") + } + } else { + intVal := otg.PatternFlowGreVersion_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGreVersion_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gre_version_counter.go b/gosnappi/pattern_flow_gre_version_counter.go new file mode 100644 index 00000000..980ee42a --- /dev/null +++ b/gosnappi/pattern_flow_gre_version_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGreVersionCounter ***** +type patternFlowGreVersionCounter struct { + validation + obj *otg.PatternFlowGreVersionCounter + marshaller marshalPatternFlowGreVersionCounter + unMarshaller unMarshalPatternFlowGreVersionCounter +} + +func NewPatternFlowGreVersionCounter() PatternFlowGreVersionCounter { + obj := patternFlowGreVersionCounter{obj: &otg.PatternFlowGreVersionCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreVersionCounter) msg() *otg.PatternFlowGreVersionCounter { + return obj.obj +} + +func (obj *patternFlowGreVersionCounter) setMsg(msg *otg.PatternFlowGreVersionCounter) PatternFlowGreVersionCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreVersionCounter struct { + obj *patternFlowGreVersionCounter +} + +type marshalPatternFlowGreVersionCounter interface { + // ToProto marshals PatternFlowGreVersionCounter to protobuf object *otg.PatternFlowGreVersionCounter + ToProto() (*otg.PatternFlowGreVersionCounter, error) + // ToPbText marshals PatternFlowGreVersionCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreVersionCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreVersionCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreVersionCounter struct { + obj *patternFlowGreVersionCounter +} + +type unMarshalPatternFlowGreVersionCounter interface { + // FromProto unmarshals PatternFlowGreVersionCounter from protobuf object *otg.PatternFlowGreVersionCounter + FromProto(msg *otg.PatternFlowGreVersionCounter) (PatternFlowGreVersionCounter, error) + // FromPbText unmarshals PatternFlowGreVersionCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreVersionCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreVersionCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreVersionCounter) Marshal() marshalPatternFlowGreVersionCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreVersionCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreVersionCounter) Unmarshal() unMarshalPatternFlowGreVersionCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreVersionCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreVersionCounter) ToProto() (*otg.PatternFlowGreVersionCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreVersionCounter) FromProto(msg *otg.PatternFlowGreVersionCounter) (PatternFlowGreVersionCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreVersionCounter) 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 *unMarshalpatternFlowGreVersionCounter) 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 *marshalpatternFlowGreVersionCounter) 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 *unMarshalpatternFlowGreVersionCounter) 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 *marshalpatternFlowGreVersionCounter) 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 *unMarshalpatternFlowGreVersionCounter) 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 *patternFlowGreVersionCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreVersionCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreVersionCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreVersionCounter) Clone() (PatternFlowGreVersionCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreVersionCounter() + 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 +} + +// PatternFlowGreVersionCounter is integer counter pattern +type PatternFlowGreVersionCounter interface { + Validation + // msg marshals PatternFlowGreVersionCounter to protobuf object *otg.PatternFlowGreVersionCounter + // and doesn't set defaults + msg() *otg.PatternFlowGreVersionCounter + // setMsg unmarshals PatternFlowGreVersionCounter from protobuf object *otg.PatternFlowGreVersionCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGreVersionCounter) PatternFlowGreVersionCounter + // provides marshal interface + Marshal() marshalPatternFlowGreVersionCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreVersionCounter + // validate validates PatternFlowGreVersionCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreVersionCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGreVersionCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGreVersionCounter + SetStart(value uint32) PatternFlowGreVersionCounter + // HasStart checks if Start has been set in PatternFlowGreVersionCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGreVersionCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGreVersionCounter + SetStep(value uint32) PatternFlowGreVersionCounter + // HasStep checks if Step has been set in PatternFlowGreVersionCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGreVersionCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGreVersionCounter + SetCount(value uint32) PatternFlowGreVersionCounter + // HasCount checks if Count has been set in PatternFlowGreVersionCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGreVersionCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGreVersionCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGreVersionCounter object +func (obj *patternFlowGreVersionCounter) SetStart(value uint32) PatternFlowGreVersionCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGreVersionCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGreVersionCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGreVersionCounter object +func (obj *patternFlowGreVersionCounter) SetStep(value uint32) PatternFlowGreVersionCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGreVersionCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGreVersionCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGreVersionCounter object +func (obj *patternFlowGreVersionCounter) SetCount(value uint32) PatternFlowGreVersionCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGreVersionCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreVersionCounter.Start <= 7 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreVersionCounter.Step <= 7 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreVersionCounter.Count <= 7 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGreVersionCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gre_version_metric_tag.go b/gosnappi/pattern_flow_gre_version_metric_tag.go new file mode 100644 index 00000000..350e4218 --- /dev/null +++ b/gosnappi/pattern_flow_gre_version_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGreVersionMetricTag ***** +type patternFlowGreVersionMetricTag struct { + validation + obj *otg.PatternFlowGreVersionMetricTag + marshaller marshalPatternFlowGreVersionMetricTag + unMarshaller unMarshalPatternFlowGreVersionMetricTag +} + +func NewPatternFlowGreVersionMetricTag() PatternFlowGreVersionMetricTag { + obj := patternFlowGreVersionMetricTag{obj: &otg.PatternFlowGreVersionMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGreVersionMetricTag) msg() *otg.PatternFlowGreVersionMetricTag { + return obj.obj +} + +func (obj *patternFlowGreVersionMetricTag) setMsg(msg *otg.PatternFlowGreVersionMetricTag) PatternFlowGreVersionMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGreVersionMetricTag struct { + obj *patternFlowGreVersionMetricTag +} + +type marshalPatternFlowGreVersionMetricTag interface { + // ToProto marshals PatternFlowGreVersionMetricTag to protobuf object *otg.PatternFlowGreVersionMetricTag + ToProto() (*otg.PatternFlowGreVersionMetricTag, error) + // ToPbText marshals PatternFlowGreVersionMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGreVersionMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGreVersionMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGreVersionMetricTag struct { + obj *patternFlowGreVersionMetricTag +} + +type unMarshalPatternFlowGreVersionMetricTag interface { + // FromProto unmarshals PatternFlowGreVersionMetricTag from protobuf object *otg.PatternFlowGreVersionMetricTag + FromProto(msg *otg.PatternFlowGreVersionMetricTag) (PatternFlowGreVersionMetricTag, error) + // FromPbText unmarshals PatternFlowGreVersionMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGreVersionMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGreVersionMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGreVersionMetricTag) Marshal() marshalPatternFlowGreVersionMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGreVersionMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGreVersionMetricTag) Unmarshal() unMarshalPatternFlowGreVersionMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGreVersionMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGreVersionMetricTag) ToProto() (*otg.PatternFlowGreVersionMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGreVersionMetricTag) FromProto(msg *otg.PatternFlowGreVersionMetricTag) (PatternFlowGreVersionMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGreVersionMetricTag) 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 *unMarshalpatternFlowGreVersionMetricTag) 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 *marshalpatternFlowGreVersionMetricTag) 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 *unMarshalpatternFlowGreVersionMetricTag) 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 *marshalpatternFlowGreVersionMetricTag) 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 *unMarshalpatternFlowGreVersionMetricTag) 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 *patternFlowGreVersionMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGreVersionMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGreVersionMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGreVersionMetricTag) Clone() (PatternFlowGreVersionMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGreVersionMetricTag() + 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 +} + +// PatternFlowGreVersionMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGreVersionMetricTag interface { + Validation + // msg marshals PatternFlowGreVersionMetricTag to protobuf object *otg.PatternFlowGreVersionMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGreVersionMetricTag + // setMsg unmarshals PatternFlowGreVersionMetricTag from protobuf object *otg.PatternFlowGreVersionMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGreVersionMetricTag) PatternFlowGreVersionMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGreVersionMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGreVersionMetricTag + // validate validates PatternFlowGreVersionMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGreVersionMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGreVersionMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGreVersionMetricTag + SetName(value string) PatternFlowGreVersionMetricTag + // Offset returns uint32, set in PatternFlowGreVersionMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGreVersionMetricTag + SetOffset(value uint32) PatternFlowGreVersionMetricTag + // HasOffset checks if Offset has been set in PatternFlowGreVersionMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGreVersionMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGreVersionMetricTag + SetLength(value uint32) PatternFlowGreVersionMetricTag + // HasLength checks if Length has been set in PatternFlowGreVersionMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGreVersionMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGreVersionMetricTag object +func (obj *patternFlowGreVersionMetricTag) SetName(value string) PatternFlowGreVersionMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGreVersionMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGreVersionMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGreVersionMetricTag object +func (obj *patternFlowGreVersionMetricTag) SetOffset(value uint32) PatternFlowGreVersionMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGreVersionMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGreVersionMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGreVersionMetricTag object +func (obj *patternFlowGreVersionMetricTag) SetLength(value uint32) PatternFlowGreVersionMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGreVersionMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGreVersionMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 2 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGreVersionMetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGreVersionMetricTag.Length <= 3 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGreVersionMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(3) + } + +} diff --git a/gosnappi/pattern_flow_gtp_extension_contents.go b/gosnappi/pattern_flow_gtp_extension_contents.go new file mode 100644 index 00000000..426d4d04 --- /dev/null +++ b/gosnappi/pattern_flow_gtp_extension_contents.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpExtensionContents ***** +type patternFlowGtpExtensionContents struct { + validation + obj *otg.PatternFlowGtpExtensionContents + marshaller marshalPatternFlowGtpExtensionContents + unMarshaller unMarshalPatternFlowGtpExtensionContents + incrementHolder PatternFlowGtpExtensionContentsCounter + decrementHolder PatternFlowGtpExtensionContentsCounter + metricTagsHolder PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter +} + +func NewPatternFlowGtpExtensionContents() PatternFlowGtpExtensionContents { + obj := patternFlowGtpExtensionContents{obj: &otg.PatternFlowGtpExtensionContents{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpExtensionContents) msg() *otg.PatternFlowGtpExtensionContents { + return obj.obj +} + +func (obj *patternFlowGtpExtensionContents) setMsg(msg *otg.PatternFlowGtpExtensionContents) PatternFlowGtpExtensionContents { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpExtensionContents struct { + obj *patternFlowGtpExtensionContents +} + +type marshalPatternFlowGtpExtensionContents interface { + // ToProto marshals PatternFlowGtpExtensionContents to protobuf object *otg.PatternFlowGtpExtensionContents + ToProto() (*otg.PatternFlowGtpExtensionContents, error) + // ToPbText marshals PatternFlowGtpExtensionContents to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpExtensionContents to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpExtensionContents to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpExtensionContents struct { + obj *patternFlowGtpExtensionContents +} + +type unMarshalPatternFlowGtpExtensionContents interface { + // FromProto unmarshals PatternFlowGtpExtensionContents from protobuf object *otg.PatternFlowGtpExtensionContents + FromProto(msg *otg.PatternFlowGtpExtensionContents) (PatternFlowGtpExtensionContents, error) + // FromPbText unmarshals PatternFlowGtpExtensionContents from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpExtensionContents from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpExtensionContents from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpExtensionContents) Marshal() marshalPatternFlowGtpExtensionContents { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpExtensionContents{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpExtensionContents) Unmarshal() unMarshalPatternFlowGtpExtensionContents { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpExtensionContents{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpExtensionContents) ToProto() (*otg.PatternFlowGtpExtensionContents, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpExtensionContents) FromProto(msg *otg.PatternFlowGtpExtensionContents) (PatternFlowGtpExtensionContents, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpExtensionContents) 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 *unMarshalpatternFlowGtpExtensionContents) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpExtensionContents) 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 *unMarshalpatternFlowGtpExtensionContents) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpExtensionContents) 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 *unMarshalpatternFlowGtpExtensionContents) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpExtensionContents) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionContents) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionContents) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpExtensionContents) Clone() (PatternFlowGtpExtensionContents, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpExtensionContents() + 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 +} + +func (obj *patternFlowGtpExtensionContents) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpExtensionContents is the extension header contents +type PatternFlowGtpExtensionContents interface { + Validation + // msg marshals PatternFlowGtpExtensionContents to protobuf object *otg.PatternFlowGtpExtensionContents + // and doesn't set defaults + msg() *otg.PatternFlowGtpExtensionContents + // setMsg unmarshals PatternFlowGtpExtensionContents from protobuf object *otg.PatternFlowGtpExtensionContents + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpExtensionContents) PatternFlowGtpExtensionContents + // provides marshal interface + Marshal() marshalPatternFlowGtpExtensionContents + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpExtensionContents + // validate validates PatternFlowGtpExtensionContents + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpExtensionContents, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpExtensionContentsChoiceEnum, set in PatternFlowGtpExtensionContents + Choice() PatternFlowGtpExtensionContentsChoiceEnum + // setChoice assigns PatternFlowGtpExtensionContentsChoiceEnum provided by user to PatternFlowGtpExtensionContents + setChoice(value PatternFlowGtpExtensionContentsChoiceEnum) PatternFlowGtpExtensionContents + // HasChoice checks if Choice has been set in PatternFlowGtpExtensionContents + HasChoice() bool + // Value returns uint64, set in PatternFlowGtpExtensionContents. + Value() uint64 + // SetValue assigns uint64 provided by user to PatternFlowGtpExtensionContents + SetValue(value uint64) PatternFlowGtpExtensionContents + // HasValue checks if Value has been set in PatternFlowGtpExtensionContents + HasValue() bool + // Values returns []uint64, set in PatternFlowGtpExtensionContents. + Values() []uint64 + // SetValues assigns []uint64 provided by user to PatternFlowGtpExtensionContents + SetValues(value []uint64) PatternFlowGtpExtensionContents + // Increment returns PatternFlowGtpExtensionContentsCounter, set in PatternFlowGtpExtensionContents. + // PatternFlowGtpExtensionContentsCounter is integer counter pattern + Increment() PatternFlowGtpExtensionContentsCounter + // SetIncrement assigns PatternFlowGtpExtensionContentsCounter provided by user to PatternFlowGtpExtensionContents. + // PatternFlowGtpExtensionContentsCounter is integer counter pattern + SetIncrement(value PatternFlowGtpExtensionContentsCounter) PatternFlowGtpExtensionContents + // HasIncrement checks if Increment has been set in PatternFlowGtpExtensionContents + HasIncrement() bool + // Decrement returns PatternFlowGtpExtensionContentsCounter, set in PatternFlowGtpExtensionContents. + // PatternFlowGtpExtensionContentsCounter is integer counter pattern + Decrement() PatternFlowGtpExtensionContentsCounter + // SetDecrement assigns PatternFlowGtpExtensionContentsCounter provided by user to PatternFlowGtpExtensionContents. + // PatternFlowGtpExtensionContentsCounter is integer counter pattern + SetDecrement(value PatternFlowGtpExtensionContentsCounter) PatternFlowGtpExtensionContents + // HasDecrement checks if Decrement has been set in PatternFlowGtpExtensionContents + HasDecrement() bool + // MetricTags returns PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIterIter, set in PatternFlowGtpExtensionContents + MetricTags() PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter + setNil() +} + +type PatternFlowGtpExtensionContentsChoiceEnum string + +// Enum of Choice on PatternFlowGtpExtensionContents +var PatternFlowGtpExtensionContentsChoice = struct { + VALUE PatternFlowGtpExtensionContentsChoiceEnum + VALUES PatternFlowGtpExtensionContentsChoiceEnum + INCREMENT PatternFlowGtpExtensionContentsChoiceEnum + DECREMENT PatternFlowGtpExtensionContentsChoiceEnum +}{ + VALUE: PatternFlowGtpExtensionContentsChoiceEnum("value"), + VALUES: PatternFlowGtpExtensionContentsChoiceEnum("values"), + INCREMENT: PatternFlowGtpExtensionContentsChoiceEnum("increment"), + DECREMENT: PatternFlowGtpExtensionContentsChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpExtensionContents) Choice() PatternFlowGtpExtensionContentsChoiceEnum { + return PatternFlowGtpExtensionContentsChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpExtensionContents) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpExtensionContents) setChoice(value PatternFlowGtpExtensionContentsChoiceEnum) PatternFlowGtpExtensionContents { + intValue, ok := otg.PatternFlowGtpExtensionContents_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpExtensionContentsChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpExtensionContents_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpExtensionContentsChoice.VALUE { + defaultValue := uint64(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpExtensionContentsChoice.VALUES { + defaultValue := []uint64{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpExtensionContentsChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpExtensionContentsCounter().msg() + } + + if value == PatternFlowGtpExtensionContentsChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpExtensionContentsCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint64 +func (obj *patternFlowGtpExtensionContents) Value() uint64 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpExtensionContentsChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint64 +func (obj *patternFlowGtpExtensionContents) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint64 value in the PatternFlowGtpExtensionContents object +func (obj *patternFlowGtpExtensionContents) SetValue(value uint64) PatternFlowGtpExtensionContents { + obj.setChoice(PatternFlowGtpExtensionContentsChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint64 +func (obj *patternFlowGtpExtensionContents) Values() []uint64 { + if obj.obj.Values == nil { + obj.SetValues([]uint64{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint64 value in the PatternFlowGtpExtensionContents object +func (obj *patternFlowGtpExtensionContents) SetValues(value []uint64) PatternFlowGtpExtensionContents { + obj.setChoice(PatternFlowGtpExtensionContentsChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint64, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpExtensionContentsCounter +func (obj *patternFlowGtpExtensionContents) Increment() PatternFlowGtpExtensionContentsCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpExtensionContentsChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpExtensionContentsCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpExtensionContentsCounter +func (obj *patternFlowGtpExtensionContents) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpExtensionContentsCounter value in the PatternFlowGtpExtensionContents object +func (obj *patternFlowGtpExtensionContents) SetIncrement(value PatternFlowGtpExtensionContentsCounter) PatternFlowGtpExtensionContents { + obj.setChoice(PatternFlowGtpExtensionContentsChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpExtensionContentsCounter +func (obj *patternFlowGtpExtensionContents) Decrement() PatternFlowGtpExtensionContentsCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpExtensionContentsChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpExtensionContentsCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpExtensionContentsCounter +func (obj *patternFlowGtpExtensionContents) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpExtensionContentsCounter value in the PatternFlowGtpExtensionContents object +func (obj *patternFlowGtpExtensionContents) SetDecrement(value PatternFlowGtpExtensionContentsCounter) PatternFlowGtpExtensionContents { + obj.setChoice(PatternFlowGtpExtensionContentsChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpExtensionContentsMetricTag +func (obj *patternFlowGtpExtensionContents) MetricTags() PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpExtensionContentsMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter struct { + obj *patternFlowGtpExtensionContents + patternFlowGtpExtensionContentsMetricTagSlice []PatternFlowGtpExtensionContentsMetricTag + fieldPtr *[]*otg.PatternFlowGtpExtensionContentsMetricTag +} + +func newPatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter(ptr *[]*otg.PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { + return &patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter interface { + setMsg(*patternFlowGtpExtensionContents) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter + Items() []PatternFlowGtpExtensionContentsMetricTag + Add() PatternFlowGtpExtensionContentsMetricTag + Append(items ...PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter + Set(index int, newObj PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter + Clear() PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter + clearHolderSlice() PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter + appendHolderSlice(item PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter +} + +func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) setMsg(msg *patternFlowGtpExtensionContents) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpExtensionContentsMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) Items() []PatternFlowGtpExtensionContentsMetricTag { + return obj.patternFlowGtpExtensionContentsMetricTagSlice +} + +func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) Add() PatternFlowGtpExtensionContentsMetricTag { + newObj := &otg.PatternFlowGtpExtensionContentsMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpExtensionContentsMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpExtensionContentsMetricTagSlice = append(obj.patternFlowGtpExtensionContentsMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) Append(items ...PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpExtensionContentsMetricTagSlice = append(obj.patternFlowGtpExtensionContentsMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) Set(index int, newObj PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpExtensionContentsMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) Clear() PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpExtensionContentsMetricTag{} + obj.patternFlowGtpExtensionContentsMetricTagSlice = []PatternFlowGtpExtensionContentsMetricTag{} + } + return obj +} +func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) clearHolderSlice() PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { + if len(obj.patternFlowGtpExtensionContentsMetricTagSlice) > 0 { + obj.patternFlowGtpExtensionContentsMetricTagSlice = []PatternFlowGtpExtensionContentsMetricTag{} + } + return obj +} +func (obj *patternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter) appendHolderSlice(item PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsPatternFlowGtpExtensionContentsMetricTagIter { + obj.patternFlowGtpExtensionContentsMetricTagSlice = append(obj.patternFlowGtpExtensionContentsMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpExtensionContents) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 281474976710655 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionContents.Value <= 281474976710655 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 281474976710655 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint64) <= PatternFlowGtpExtensionContents.Values <= 281474976710655 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpExtensionContentsMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpExtensionContents) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpExtensionContentsChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpExtensionContentsChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpExtensionContentsChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpExtensionContentsChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpExtensionContentsChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpExtensionContentsChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpExtensionContents") + } + } else { + intVal := otg.PatternFlowGtpExtensionContents_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpExtensionContents_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtp_extension_contents_counter.go b/gosnappi/pattern_flow_gtp_extension_contents_counter.go new file mode 100644 index 00000000..fda6182f --- /dev/null +++ b/gosnappi/pattern_flow_gtp_extension_contents_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpExtensionContentsCounter ***** +type patternFlowGtpExtensionContentsCounter struct { + validation + obj *otg.PatternFlowGtpExtensionContentsCounter + marshaller marshalPatternFlowGtpExtensionContentsCounter + unMarshaller unMarshalPatternFlowGtpExtensionContentsCounter +} + +func NewPatternFlowGtpExtensionContentsCounter() PatternFlowGtpExtensionContentsCounter { + obj := patternFlowGtpExtensionContentsCounter{obj: &otg.PatternFlowGtpExtensionContentsCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpExtensionContentsCounter) msg() *otg.PatternFlowGtpExtensionContentsCounter { + return obj.obj +} + +func (obj *patternFlowGtpExtensionContentsCounter) setMsg(msg *otg.PatternFlowGtpExtensionContentsCounter) PatternFlowGtpExtensionContentsCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpExtensionContentsCounter struct { + obj *patternFlowGtpExtensionContentsCounter +} + +type marshalPatternFlowGtpExtensionContentsCounter interface { + // ToProto marshals PatternFlowGtpExtensionContentsCounter to protobuf object *otg.PatternFlowGtpExtensionContentsCounter + ToProto() (*otg.PatternFlowGtpExtensionContentsCounter, error) + // ToPbText marshals PatternFlowGtpExtensionContentsCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpExtensionContentsCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpExtensionContentsCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpExtensionContentsCounter struct { + obj *patternFlowGtpExtensionContentsCounter +} + +type unMarshalPatternFlowGtpExtensionContentsCounter interface { + // FromProto unmarshals PatternFlowGtpExtensionContentsCounter from protobuf object *otg.PatternFlowGtpExtensionContentsCounter + FromProto(msg *otg.PatternFlowGtpExtensionContentsCounter) (PatternFlowGtpExtensionContentsCounter, error) + // FromPbText unmarshals PatternFlowGtpExtensionContentsCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpExtensionContentsCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpExtensionContentsCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpExtensionContentsCounter) Marshal() marshalPatternFlowGtpExtensionContentsCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpExtensionContentsCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpExtensionContentsCounter) Unmarshal() unMarshalPatternFlowGtpExtensionContentsCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpExtensionContentsCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpExtensionContentsCounter) ToProto() (*otg.PatternFlowGtpExtensionContentsCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpExtensionContentsCounter) FromProto(msg *otg.PatternFlowGtpExtensionContentsCounter) (PatternFlowGtpExtensionContentsCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpExtensionContentsCounter) 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 *unMarshalpatternFlowGtpExtensionContentsCounter) 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 *marshalpatternFlowGtpExtensionContentsCounter) 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 *unMarshalpatternFlowGtpExtensionContentsCounter) 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 *marshalpatternFlowGtpExtensionContentsCounter) 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 *unMarshalpatternFlowGtpExtensionContentsCounter) 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 *patternFlowGtpExtensionContentsCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionContentsCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionContentsCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpExtensionContentsCounter) Clone() (PatternFlowGtpExtensionContentsCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpExtensionContentsCounter() + 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 +} + +// PatternFlowGtpExtensionContentsCounter is integer counter pattern +type PatternFlowGtpExtensionContentsCounter interface { + Validation + // msg marshals PatternFlowGtpExtensionContentsCounter to protobuf object *otg.PatternFlowGtpExtensionContentsCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpExtensionContentsCounter + // setMsg unmarshals PatternFlowGtpExtensionContentsCounter from protobuf object *otg.PatternFlowGtpExtensionContentsCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpExtensionContentsCounter) PatternFlowGtpExtensionContentsCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpExtensionContentsCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpExtensionContentsCounter + // validate validates PatternFlowGtpExtensionContentsCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpExtensionContentsCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint64, set in PatternFlowGtpExtensionContentsCounter. + Start() uint64 + // SetStart assigns uint64 provided by user to PatternFlowGtpExtensionContentsCounter + SetStart(value uint64) PatternFlowGtpExtensionContentsCounter + // HasStart checks if Start has been set in PatternFlowGtpExtensionContentsCounter + HasStart() bool + // Step returns uint64, set in PatternFlowGtpExtensionContentsCounter. + Step() uint64 + // SetStep assigns uint64 provided by user to PatternFlowGtpExtensionContentsCounter + SetStep(value uint64) PatternFlowGtpExtensionContentsCounter + // HasStep checks if Step has been set in PatternFlowGtpExtensionContentsCounter + HasStep() bool + // Count returns uint64, set in PatternFlowGtpExtensionContentsCounter. + Count() uint64 + // SetCount assigns uint64 provided by user to PatternFlowGtpExtensionContentsCounter + SetCount(value uint64) PatternFlowGtpExtensionContentsCounter + // HasCount checks if Count has been set in PatternFlowGtpExtensionContentsCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint64 +func (obj *patternFlowGtpExtensionContentsCounter) Start() uint64 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint64 +func (obj *patternFlowGtpExtensionContentsCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint64 value in the PatternFlowGtpExtensionContentsCounter object +func (obj *patternFlowGtpExtensionContentsCounter) SetStart(value uint64) PatternFlowGtpExtensionContentsCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint64 +func (obj *patternFlowGtpExtensionContentsCounter) Step() uint64 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint64 +func (obj *patternFlowGtpExtensionContentsCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint64 value in the PatternFlowGtpExtensionContentsCounter object +func (obj *patternFlowGtpExtensionContentsCounter) SetStep(value uint64) PatternFlowGtpExtensionContentsCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint64 +func (obj *patternFlowGtpExtensionContentsCounter) Count() uint64 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint64 +func (obj *patternFlowGtpExtensionContentsCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint64 value in the PatternFlowGtpExtensionContentsCounter object +func (obj *patternFlowGtpExtensionContentsCounter) SetCount(value uint64) PatternFlowGtpExtensionContentsCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpExtensionContentsCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 281474976710655 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionContentsCounter.Start <= 281474976710655 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 281474976710655 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionContentsCounter.Step <= 281474976710655 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 281474976710655 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionContentsCounter.Count <= 281474976710655 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpExtensionContentsCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtp_extension_contents_metric_tag.go b/gosnappi/pattern_flow_gtp_extension_contents_metric_tag.go new file mode 100644 index 00000000..3956f7a9 --- /dev/null +++ b/gosnappi/pattern_flow_gtp_extension_contents_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpExtensionContentsMetricTag ***** +type patternFlowGtpExtensionContentsMetricTag struct { + validation + obj *otg.PatternFlowGtpExtensionContentsMetricTag + marshaller marshalPatternFlowGtpExtensionContentsMetricTag + unMarshaller unMarshalPatternFlowGtpExtensionContentsMetricTag +} + +func NewPatternFlowGtpExtensionContentsMetricTag() PatternFlowGtpExtensionContentsMetricTag { + obj := patternFlowGtpExtensionContentsMetricTag{obj: &otg.PatternFlowGtpExtensionContentsMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpExtensionContentsMetricTag) msg() *otg.PatternFlowGtpExtensionContentsMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpExtensionContentsMetricTag) setMsg(msg *otg.PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpExtensionContentsMetricTag struct { + obj *patternFlowGtpExtensionContentsMetricTag +} + +type marshalPatternFlowGtpExtensionContentsMetricTag interface { + // ToProto marshals PatternFlowGtpExtensionContentsMetricTag to protobuf object *otg.PatternFlowGtpExtensionContentsMetricTag + ToProto() (*otg.PatternFlowGtpExtensionContentsMetricTag, error) + // ToPbText marshals PatternFlowGtpExtensionContentsMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpExtensionContentsMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpExtensionContentsMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpExtensionContentsMetricTag struct { + obj *patternFlowGtpExtensionContentsMetricTag +} + +type unMarshalPatternFlowGtpExtensionContentsMetricTag interface { + // FromProto unmarshals PatternFlowGtpExtensionContentsMetricTag from protobuf object *otg.PatternFlowGtpExtensionContentsMetricTag + FromProto(msg *otg.PatternFlowGtpExtensionContentsMetricTag) (PatternFlowGtpExtensionContentsMetricTag, error) + // FromPbText unmarshals PatternFlowGtpExtensionContentsMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpExtensionContentsMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpExtensionContentsMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpExtensionContentsMetricTag) Marshal() marshalPatternFlowGtpExtensionContentsMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpExtensionContentsMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpExtensionContentsMetricTag) Unmarshal() unMarshalPatternFlowGtpExtensionContentsMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpExtensionContentsMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpExtensionContentsMetricTag) ToProto() (*otg.PatternFlowGtpExtensionContentsMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpExtensionContentsMetricTag) FromProto(msg *otg.PatternFlowGtpExtensionContentsMetricTag) (PatternFlowGtpExtensionContentsMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpExtensionContentsMetricTag) 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 *unMarshalpatternFlowGtpExtensionContentsMetricTag) 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 *marshalpatternFlowGtpExtensionContentsMetricTag) 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 *unMarshalpatternFlowGtpExtensionContentsMetricTag) 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 *marshalpatternFlowGtpExtensionContentsMetricTag) 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 *unMarshalpatternFlowGtpExtensionContentsMetricTag) 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 *patternFlowGtpExtensionContentsMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionContentsMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionContentsMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpExtensionContentsMetricTag) Clone() (PatternFlowGtpExtensionContentsMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpExtensionContentsMetricTag() + 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 +} + +// PatternFlowGtpExtensionContentsMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpExtensionContentsMetricTag interface { + Validation + // msg marshals PatternFlowGtpExtensionContentsMetricTag to protobuf object *otg.PatternFlowGtpExtensionContentsMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpExtensionContentsMetricTag + // setMsg unmarshals PatternFlowGtpExtensionContentsMetricTag from protobuf object *otg.PatternFlowGtpExtensionContentsMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpExtensionContentsMetricTag) PatternFlowGtpExtensionContentsMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpExtensionContentsMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpExtensionContentsMetricTag + // validate validates PatternFlowGtpExtensionContentsMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpExtensionContentsMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpExtensionContentsMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpExtensionContentsMetricTag + SetName(value string) PatternFlowGtpExtensionContentsMetricTag + // Offset returns uint64, set in PatternFlowGtpExtensionContentsMetricTag. + Offset() uint64 + // SetOffset assigns uint64 provided by user to PatternFlowGtpExtensionContentsMetricTag + SetOffset(value uint64) PatternFlowGtpExtensionContentsMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpExtensionContentsMetricTag + HasOffset() bool + // Length returns uint64, set in PatternFlowGtpExtensionContentsMetricTag. + Length() uint64 + // SetLength assigns uint64 provided by user to PatternFlowGtpExtensionContentsMetricTag + SetLength(value uint64) PatternFlowGtpExtensionContentsMetricTag + // HasLength checks if Length has been set in PatternFlowGtpExtensionContentsMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpExtensionContentsMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpExtensionContentsMetricTag object +func (obj *patternFlowGtpExtensionContentsMetricTag) SetName(value string) PatternFlowGtpExtensionContentsMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint64 +func (obj *patternFlowGtpExtensionContentsMetricTag) Offset() uint64 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint64 +func (obj *patternFlowGtpExtensionContentsMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint64 value in the PatternFlowGtpExtensionContentsMetricTag object +func (obj *patternFlowGtpExtensionContentsMetricTag) SetOffset(value uint64) PatternFlowGtpExtensionContentsMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint64 +func (obj *patternFlowGtpExtensionContentsMetricTag) Length() uint64 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint64 +func (obj *patternFlowGtpExtensionContentsMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint64 value in the PatternFlowGtpExtensionContentsMetricTag object +func (obj *patternFlowGtpExtensionContentsMetricTag) SetLength(value uint64) PatternFlowGtpExtensionContentsMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpExtensionContentsMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpExtensionContentsMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 47 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionContentsMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 48 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpExtensionContentsMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpExtensionContentsMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(48) + } + +} diff --git a/gosnappi/pattern_flow_gtp_extension_extension_length.go b/gosnappi/pattern_flow_gtp_extension_extension_length.go new file mode 100644 index 00000000..e160bada --- /dev/null +++ b/gosnappi/pattern_flow_gtp_extension_extension_length.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpExtensionExtensionLength ***** +type patternFlowGtpExtensionExtensionLength struct { + validation + obj *otg.PatternFlowGtpExtensionExtensionLength + marshaller marshalPatternFlowGtpExtensionExtensionLength + unMarshaller unMarshalPatternFlowGtpExtensionExtensionLength + incrementHolder PatternFlowGtpExtensionExtensionLengthCounter + decrementHolder PatternFlowGtpExtensionExtensionLengthCounter + metricTagsHolder PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter +} + +func NewPatternFlowGtpExtensionExtensionLength() PatternFlowGtpExtensionExtensionLength { + obj := patternFlowGtpExtensionExtensionLength{obj: &otg.PatternFlowGtpExtensionExtensionLength{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpExtensionExtensionLength) msg() *otg.PatternFlowGtpExtensionExtensionLength { + return obj.obj +} + +func (obj *patternFlowGtpExtensionExtensionLength) setMsg(msg *otg.PatternFlowGtpExtensionExtensionLength) PatternFlowGtpExtensionExtensionLength { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpExtensionExtensionLength struct { + obj *patternFlowGtpExtensionExtensionLength +} + +type marshalPatternFlowGtpExtensionExtensionLength interface { + // ToProto marshals PatternFlowGtpExtensionExtensionLength to protobuf object *otg.PatternFlowGtpExtensionExtensionLength + ToProto() (*otg.PatternFlowGtpExtensionExtensionLength, error) + // ToPbText marshals PatternFlowGtpExtensionExtensionLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpExtensionExtensionLength to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpExtensionExtensionLength to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpExtensionExtensionLength struct { + obj *patternFlowGtpExtensionExtensionLength +} + +type unMarshalPatternFlowGtpExtensionExtensionLength interface { + // FromProto unmarshals PatternFlowGtpExtensionExtensionLength from protobuf object *otg.PatternFlowGtpExtensionExtensionLength + FromProto(msg *otg.PatternFlowGtpExtensionExtensionLength) (PatternFlowGtpExtensionExtensionLength, error) + // FromPbText unmarshals PatternFlowGtpExtensionExtensionLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpExtensionExtensionLength from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpExtensionExtensionLength from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpExtensionExtensionLength) Marshal() marshalPatternFlowGtpExtensionExtensionLength { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpExtensionExtensionLength{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpExtensionExtensionLength) Unmarshal() unMarshalPatternFlowGtpExtensionExtensionLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpExtensionExtensionLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpExtensionExtensionLength) ToProto() (*otg.PatternFlowGtpExtensionExtensionLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpExtensionExtensionLength) FromProto(msg *otg.PatternFlowGtpExtensionExtensionLength) (PatternFlowGtpExtensionExtensionLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpExtensionExtensionLength) 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 *unMarshalpatternFlowGtpExtensionExtensionLength) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpExtensionExtensionLength) 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 *unMarshalpatternFlowGtpExtensionExtensionLength) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpExtensionExtensionLength) 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 *unMarshalpatternFlowGtpExtensionExtensionLength) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpExtensionExtensionLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionExtensionLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionExtensionLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpExtensionExtensionLength) Clone() (PatternFlowGtpExtensionExtensionLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpExtensionExtensionLength() + 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 +} + +func (obj *patternFlowGtpExtensionExtensionLength) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpExtensionExtensionLength is this field states the length of this extension header, including the length, the contents, and the next extension header field, in 4-octet units, so the length of the extension must always be a multiple of 4. +type PatternFlowGtpExtensionExtensionLength interface { + Validation + // msg marshals PatternFlowGtpExtensionExtensionLength to protobuf object *otg.PatternFlowGtpExtensionExtensionLength + // and doesn't set defaults + msg() *otg.PatternFlowGtpExtensionExtensionLength + // setMsg unmarshals PatternFlowGtpExtensionExtensionLength from protobuf object *otg.PatternFlowGtpExtensionExtensionLength + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpExtensionExtensionLength) PatternFlowGtpExtensionExtensionLength + // provides marshal interface + Marshal() marshalPatternFlowGtpExtensionExtensionLength + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpExtensionExtensionLength + // validate validates PatternFlowGtpExtensionExtensionLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpExtensionExtensionLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpExtensionExtensionLengthChoiceEnum, set in PatternFlowGtpExtensionExtensionLength + Choice() PatternFlowGtpExtensionExtensionLengthChoiceEnum + // setChoice assigns PatternFlowGtpExtensionExtensionLengthChoiceEnum provided by user to PatternFlowGtpExtensionExtensionLength + setChoice(value PatternFlowGtpExtensionExtensionLengthChoiceEnum) PatternFlowGtpExtensionExtensionLength + // HasChoice checks if Choice has been set in PatternFlowGtpExtensionExtensionLength + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpExtensionExtensionLength. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpExtensionExtensionLength + SetValue(value uint32) PatternFlowGtpExtensionExtensionLength + // HasValue checks if Value has been set in PatternFlowGtpExtensionExtensionLength + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpExtensionExtensionLength. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpExtensionExtensionLength + SetValues(value []uint32) PatternFlowGtpExtensionExtensionLength + // Increment returns PatternFlowGtpExtensionExtensionLengthCounter, set in PatternFlowGtpExtensionExtensionLength. + // PatternFlowGtpExtensionExtensionLengthCounter is integer counter pattern + Increment() PatternFlowGtpExtensionExtensionLengthCounter + // SetIncrement assigns PatternFlowGtpExtensionExtensionLengthCounter provided by user to PatternFlowGtpExtensionExtensionLength. + // PatternFlowGtpExtensionExtensionLengthCounter is integer counter pattern + SetIncrement(value PatternFlowGtpExtensionExtensionLengthCounter) PatternFlowGtpExtensionExtensionLength + // HasIncrement checks if Increment has been set in PatternFlowGtpExtensionExtensionLength + HasIncrement() bool + // Decrement returns PatternFlowGtpExtensionExtensionLengthCounter, set in PatternFlowGtpExtensionExtensionLength. + // PatternFlowGtpExtensionExtensionLengthCounter is integer counter pattern + Decrement() PatternFlowGtpExtensionExtensionLengthCounter + // SetDecrement assigns PatternFlowGtpExtensionExtensionLengthCounter provided by user to PatternFlowGtpExtensionExtensionLength. + // PatternFlowGtpExtensionExtensionLengthCounter is integer counter pattern + SetDecrement(value PatternFlowGtpExtensionExtensionLengthCounter) PatternFlowGtpExtensionExtensionLength + // HasDecrement checks if Decrement has been set in PatternFlowGtpExtensionExtensionLength + HasDecrement() bool + // MetricTags returns PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIterIter, set in PatternFlowGtpExtensionExtensionLength + MetricTags() PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter + setNil() +} + +type PatternFlowGtpExtensionExtensionLengthChoiceEnum string + +// Enum of Choice on PatternFlowGtpExtensionExtensionLength +var PatternFlowGtpExtensionExtensionLengthChoice = struct { + VALUE PatternFlowGtpExtensionExtensionLengthChoiceEnum + VALUES PatternFlowGtpExtensionExtensionLengthChoiceEnum + INCREMENT PatternFlowGtpExtensionExtensionLengthChoiceEnum + DECREMENT PatternFlowGtpExtensionExtensionLengthChoiceEnum +}{ + VALUE: PatternFlowGtpExtensionExtensionLengthChoiceEnum("value"), + VALUES: PatternFlowGtpExtensionExtensionLengthChoiceEnum("values"), + INCREMENT: PatternFlowGtpExtensionExtensionLengthChoiceEnum("increment"), + DECREMENT: PatternFlowGtpExtensionExtensionLengthChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpExtensionExtensionLength) Choice() PatternFlowGtpExtensionExtensionLengthChoiceEnum { + return PatternFlowGtpExtensionExtensionLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpExtensionExtensionLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpExtensionExtensionLength) setChoice(value PatternFlowGtpExtensionExtensionLengthChoiceEnum) PatternFlowGtpExtensionExtensionLength { + intValue, ok := otg.PatternFlowGtpExtensionExtensionLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpExtensionExtensionLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpExtensionExtensionLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpExtensionExtensionLengthChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpExtensionExtensionLengthChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpExtensionExtensionLengthChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpExtensionExtensionLengthCounter().msg() + } + + if value == PatternFlowGtpExtensionExtensionLengthChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpExtensionExtensionLengthCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpExtensionExtensionLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpExtensionExtensionLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpExtensionExtensionLength object +func (obj *patternFlowGtpExtensionExtensionLength) SetValue(value uint32) PatternFlowGtpExtensionExtensionLength { + obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpExtensionExtensionLength) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpExtensionExtensionLength object +func (obj *patternFlowGtpExtensionExtensionLength) SetValues(value []uint32) PatternFlowGtpExtensionExtensionLength { + obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpExtensionExtensionLengthCounter +func (obj *patternFlowGtpExtensionExtensionLength) Increment() PatternFlowGtpExtensionExtensionLengthCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpExtensionExtensionLengthCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpExtensionExtensionLengthCounter +func (obj *patternFlowGtpExtensionExtensionLength) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpExtensionExtensionLengthCounter value in the PatternFlowGtpExtensionExtensionLength object +func (obj *patternFlowGtpExtensionExtensionLength) SetIncrement(value PatternFlowGtpExtensionExtensionLengthCounter) PatternFlowGtpExtensionExtensionLength { + obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpExtensionExtensionLengthCounter +func (obj *patternFlowGtpExtensionExtensionLength) Decrement() PatternFlowGtpExtensionExtensionLengthCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpExtensionExtensionLengthCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpExtensionExtensionLengthCounter +func (obj *patternFlowGtpExtensionExtensionLength) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpExtensionExtensionLengthCounter value in the PatternFlowGtpExtensionExtensionLength object +func (obj *patternFlowGtpExtensionExtensionLength) SetDecrement(value PatternFlowGtpExtensionExtensionLengthCounter) PatternFlowGtpExtensionExtensionLength { + obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpExtensionExtensionLengthMetricTag +func (obj *patternFlowGtpExtensionExtensionLength) MetricTags() PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpExtensionExtensionLengthMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter struct { + obj *patternFlowGtpExtensionExtensionLength + patternFlowGtpExtensionExtensionLengthMetricTagSlice []PatternFlowGtpExtensionExtensionLengthMetricTag + fieldPtr *[]*otg.PatternFlowGtpExtensionExtensionLengthMetricTag +} + +func newPatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter(ptr *[]*otg.PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { + return &patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter interface { + setMsg(*patternFlowGtpExtensionExtensionLength) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter + Items() []PatternFlowGtpExtensionExtensionLengthMetricTag + Add() PatternFlowGtpExtensionExtensionLengthMetricTag + Append(items ...PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter + Set(index int, newObj PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter + Clear() PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter + clearHolderSlice() PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter + appendHolderSlice(item PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter +} + +func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) setMsg(msg *patternFlowGtpExtensionExtensionLength) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpExtensionExtensionLengthMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) Items() []PatternFlowGtpExtensionExtensionLengthMetricTag { + return obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice +} + +func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) Add() PatternFlowGtpExtensionExtensionLengthMetricTag { + newObj := &otg.PatternFlowGtpExtensionExtensionLengthMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpExtensionExtensionLengthMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice = append(obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) Append(items ...PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice = append(obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) Set(index int, newObj PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) Clear() PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpExtensionExtensionLengthMetricTag{} + obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice = []PatternFlowGtpExtensionExtensionLengthMetricTag{} + } + return obj +} +func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) clearHolderSlice() PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { + if len(obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice) > 0 { + obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice = []PatternFlowGtpExtensionExtensionLengthMetricTag{} + } + return obj +} +func (obj *patternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter) appendHolderSlice(item PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthPatternFlowGtpExtensionExtensionLengthMetricTagIter { + obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice = append(obj.patternFlowGtpExtensionExtensionLengthMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpExtensionExtensionLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionExtensionLength.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpExtensionExtensionLength.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpExtensionExtensionLengthMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpExtensionExtensionLength) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpExtensionExtensionLengthChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpExtensionExtensionLengthChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpExtensionExtensionLengthChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpExtensionExtensionLengthChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpExtensionExtensionLengthChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpExtensionExtensionLengthChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpExtensionExtensionLength") + } + } else { + intVal := otg.PatternFlowGtpExtensionExtensionLength_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpExtensionExtensionLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtp_extension_extension_length_counter.go b/gosnappi/pattern_flow_gtp_extension_extension_length_counter.go new file mode 100644 index 00000000..6f4e8baa --- /dev/null +++ b/gosnappi/pattern_flow_gtp_extension_extension_length_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpExtensionExtensionLengthCounter ***** +type patternFlowGtpExtensionExtensionLengthCounter struct { + validation + obj *otg.PatternFlowGtpExtensionExtensionLengthCounter + marshaller marshalPatternFlowGtpExtensionExtensionLengthCounter + unMarshaller unMarshalPatternFlowGtpExtensionExtensionLengthCounter +} + +func NewPatternFlowGtpExtensionExtensionLengthCounter() PatternFlowGtpExtensionExtensionLengthCounter { + obj := patternFlowGtpExtensionExtensionLengthCounter{obj: &otg.PatternFlowGtpExtensionExtensionLengthCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpExtensionExtensionLengthCounter) msg() *otg.PatternFlowGtpExtensionExtensionLengthCounter { + return obj.obj +} + +func (obj *patternFlowGtpExtensionExtensionLengthCounter) setMsg(msg *otg.PatternFlowGtpExtensionExtensionLengthCounter) PatternFlowGtpExtensionExtensionLengthCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpExtensionExtensionLengthCounter struct { + obj *patternFlowGtpExtensionExtensionLengthCounter +} + +type marshalPatternFlowGtpExtensionExtensionLengthCounter interface { + // ToProto marshals PatternFlowGtpExtensionExtensionLengthCounter to protobuf object *otg.PatternFlowGtpExtensionExtensionLengthCounter + ToProto() (*otg.PatternFlowGtpExtensionExtensionLengthCounter, error) + // ToPbText marshals PatternFlowGtpExtensionExtensionLengthCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpExtensionExtensionLengthCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpExtensionExtensionLengthCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpExtensionExtensionLengthCounter struct { + obj *patternFlowGtpExtensionExtensionLengthCounter +} + +type unMarshalPatternFlowGtpExtensionExtensionLengthCounter interface { + // FromProto unmarshals PatternFlowGtpExtensionExtensionLengthCounter from protobuf object *otg.PatternFlowGtpExtensionExtensionLengthCounter + FromProto(msg *otg.PatternFlowGtpExtensionExtensionLengthCounter) (PatternFlowGtpExtensionExtensionLengthCounter, error) + // FromPbText unmarshals PatternFlowGtpExtensionExtensionLengthCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpExtensionExtensionLengthCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpExtensionExtensionLengthCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpExtensionExtensionLengthCounter) Marshal() marshalPatternFlowGtpExtensionExtensionLengthCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpExtensionExtensionLengthCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpExtensionExtensionLengthCounter) Unmarshal() unMarshalPatternFlowGtpExtensionExtensionLengthCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpExtensionExtensionLengthCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpExtensionExtensionLengthCounter) ToProto() (*otg.PatternFlowGtpExtensionExtensionLengthCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpExtensionExtensionLengthCounter) FromProto(msg *otg.PatternFlowGtpExtensionExtensionLengthCounter) (PatternFlowGtpExtensionExtensionLengthCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpExtensionExtensionLengthCounter) 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 *unMarshalpatternFlowGtpExtensionExtensionLengthCounter) 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 *marshalpatternFlowGtpExtensionExtensionLengthCounter) 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 *unMarshalpatternFlowGtpExtensionExtensionLengthCounter) 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 *marshalpatternFlowGtpExtensionExtensionLengthCounter) 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 *unMarshalpatternFlowGtpExtensionExtensionLengthCounter) 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 *patternFlowGtpExtensionExtensionLengthCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionExtensionLengthCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionExtensionLengthCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpExtensionExtensionLengthCounter) Clone() (PatternFlowGtpExtensionExtensionLengthCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpExtensionExtensionLengthCounter() + 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 +} + +// PatternFlowGtpExtensionExtensionLengthCounter is integer counter pattern +type PatternFlowGtpExtensionExtensionLengthCounter interface { + Validation + // msg marshals PatternFlowGtpExtensionExtensionLengthCounter to protobuf object *otg.PatternFlowGtpExtensionExtensionLengthCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpExtensionExtensionLengthCounter + // setMsg unmarshals PatternFlowGtpExtensionExtensionLengthCounter from protobuf object *otg.PatternFlowGtpExtensionExtensionLengthCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpExtensionExtensionLengthCounter) PatternFlowGtpExtensionExtensionLengthCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpExtensionExtensionLengthCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpExtensionExtensionLengthCounter + // validate validates PatternFlowGtpExtensionExtensionLengthCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpExtensionExtensionLengthCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpExtensionExtensionLengthCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpExtensionExtensionLengthCounter + SetStart(value uint32) PatternFlowGtpExtensionExtensionLengthCounter + // HasStart checks if Start has been set in PatternFlowGtpExtensionExtensionLengthCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpExtensionExtensionLengthCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpExtensionExtensionLengthCounter + SetStep(value uint32) PatternFlowGtpExtensionExtensionLengthCounter + // HasStep checks if Step has been set in PatternFlowGtpExtensionExtensionLengthCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpExtensionExtensionLengthCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpExtensionExtensionLengthCounter + SetCount(value uint32) PatternFlowGtpExtensionExtensionLengthCounter + // HasCount checks if Count has been set in PatternFlowGtpExtensionExtensionLengthCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpExtensionExtensionLengthCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpExtensionExtensionLengthCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpExtensionExtensionLengthCounter object +func (obj *patternFlowGtpExtensionExtensionLengthCounter) SetStart(value uint32) PatternFlowGtpExtensionExtensionLengthCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpExtensionExtensionLengthCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpExtensionExtensionLengthCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpExtensionExtensionLengthCounter object +func (obj *patternFlowGtpExtensionExtensionLengthCounter) SetStep(value uint32) PatternFlowGtpExtensionExtensionLengthCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpExtensionExtensionLengthCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpExtensionExtensionLengthCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpExtensionExtensionLengthCounter object +func (obj *patternFlowGtpExtensionExtensionLengthCounter) SetCount(value uint32) PatternFlowGtpExtensionExtensionLengthCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpExtensionExtensionLengthCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionExtensionLengthCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionExtensionLengthCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionExtensionLengthCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpExtensionExtensionLengthCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtp_extension_extension_length_metric_tag.go b/gosnappi/pattern_flow_gtp_extension_extension_length_metric_tag.go new file mode 100644 index 00000000..ed05e991 --- /dev/null +++ b/gosnappi/pattern_flow_gtp_extension_extension_length_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpExtensionExtensionLengthMetricTag ***** +type patternFlowGtpExtensionExtensionLengthMetricTag struct { + validation + obj *otg.PatternFlowGtpExtensionExtensionLengthMetricTag + marshaller marshalPatternFlowGtpExtensionExtensionLengthMetricTag + unMarshaller unMarshalPatternFlowGtpExtensionExtensionLengthMetricTag +} + +func NewPatternFlowGtpExtensionExtensionLengthMetricTag() PatternFlowGtpExtensionExtensionLengthMetricTag { + obj := patternFlowGtpExtensionExtensionLengthMetricTag{obj: &otg.PatternFlowGtpExtensionExtensionLengthMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) msg() *otg.PatternFlowGtpExtensionExtensionLengthMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) setMsg(msg *otg.PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpExtensionExtensionLengthMetricTag struct { + obj *patternFlowGtpExtensionExtensionLengthMetricTag +} + +type marshalPatternFlowGtpExtensionExtensionLengthMetricTag interface { + // ToProto marshals PatternFlowGtpExtensionExtensionLengthMetricTag to protobuf object *otg.PatternFlowGtpExtensionExtensionLengthMetricTag + ToProto() (*otg.PatternFlowGtpExtensionExtensionLengthMetricTag, error) + // ToPbText marshals PatternFlowGtpExtensionExtensionLengthMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpExtensionExtensionLengthMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpExtensionExtensionLengthMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpExtensionExtensionLengthMetricTag struct { + obj *patternFlowGtpExtensionExtensionLengthMetricTag +} + +type unMarshalPatternFlowGtpExtensionExtensionLengthMetricTag interface { + // FromProto unmarshals PatternFlowGtpExtensionExtensionLengthMetricTag from protobuf object *otg.PatternFlowGtpExtensionExtensionLengthMetricTag + FromProto(msg *otg.PatternFlowGtpExtensionExtensionLengthMetricTag) (PatternFlowGtpExtensionExtensionLengthMetricTag, error) + // FromPbText unmarshals PatternFlowGtpExtensionExtensionLengthMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpExtensionExtensionLengthMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpExtensionExtensionLengthMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) Marshal() marshalPatternFlowGtpExtensionExtensionLengthMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpExtensionExtensionLengthMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) Unmarshal() unMarshalPatternFlowGtpExtensionExtensionLengthMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpExtensionExtensionLengthMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpExtensionExtensionLengthMetricTag) ToProto() (*otg.PatternFlowGtpExtensionExtensionLengthMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpExtensionExtensionLengthMetricTag) FromProto(msg *otg.PatternFlowGtpExtensionExtensionLengthMetricTag) (PatternFlowGtpExtensionExtensionLengthMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpExtensionExtensionLengthMetricTag) 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 *unMarshalpatternFlowGtpExtensionExtensionLengthMetricTag) 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 *marshalpatternFlowGtpExtensionExtensionLengthMetricTag) 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 *unMarshalpatternFlowGtpExtensionExtensionLengthMetricTag) 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 *marshalpatternFlowGtpExtensionExtensionLengthMetricTag) 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 *unMarshalpatternFlowGtpExtensionExtensionLengthMetricTag) 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 *patternFlowGtpExtensionExtensionLengthMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) Clone() (PatternFlowGtpExtensionExtensionLengthMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpExtensionExtensionLengthMetricTag() + 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 +} + +// PatternFlowGtpExtensionExtensionLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpExtensionExtensionLengthMetricTag interface { + Validation + // msg marshals PatternFlowGtpExtensionExtensionLengthMetricTag to protobuf object *otg.PatternFlowGtpExtensionExtensionLengthMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpExtensionExtensionLengthMetricTag + // setMsg unmarshals PatternFlowGtpExtensionExtensionLengthMetricTag from protobuf object *otg.PatternFlowGtpExtensionExtensionLengthMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpExtensionExtensionLengthMetricTag) PatternFlowGtpExtensionExtensionLengthMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpExtensionExtensionLengthMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpExtensionExtensionLengthMetricTag + // validate validates PatternFlowGtpExtensionExtensionLengthMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpExtensionExtensionLengthMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpExtensionExtensionLengthMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpExtensionExtensionLengthMetricTag + SetName(value string) PatternFlowGtpExtensionExtensionLengthMetricTag + // Offset returns uint32, set in PatternFlowGtpExtensionExtensionLengthMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpExtensionExtensionLengthMetricTag + SetOffset(value uint32) PatternFlowGtpExtensionExtensionLengthMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpExtensionExtensionLengthMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpExtensionExtensionLengthMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpExtensionExtensionLengthMetricTag + SetLength(value uint32) PatternFlowGtpExtensionExtensionLengthMetricTag + // HasLength checks if Length has been set in PatternFlowGtpExtensionExtensionLengthMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpExtensionExtensionLengthMetricTag object +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) SetName(value string) PatternFlowGtpExtensionExtensionLengthMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpExtensionExtensionLengthMetricTag object +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) SetOffset(value uint32) PatternFlowGtpExtensionExtensionLengthMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpExtensionExtensionLengthMetricTag object +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) SetLength(value uint32) PatternFlowGtpExtensionExtensionLengthMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpExtensionExtensionLengthMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionExtensionLengthMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpExtensionExtensionLengthMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpExtensionExtensionLengthMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_gtp_extension_next_extension_header.go b/gosnappi/pattern_flow_gtp_extension_next_extension_header.go new file mode 100644 index 00000000..156c7264 --- /dev/null +++ b/gosnappi/pattern_flow_gtp_extension_next_extension_header.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpExtensionNextExtensionHeader ***** +type patternFlowGtpExtensionNextExtensionHeader struct { + validation + obj *otg.PatternFlowGtpExtensionNextExtensionHeader + marshaller marshalPatternFlowGtpExtensionNextExtensionHeader + unMarshaller unMarshalPatternFlowGtpExtensionNextExtensionHeader + incrementHolder PatternFlowGtpExtensionNextExtensionHeaderCounter + decrementHolder PatternFlowGtpExtensionNextExtensionHeaderCounter + metricTagsHolder PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter +} + +func NewPatternFlowGtpExtensionNextExtensionHeader() PatternFlowGtpExtensionNextExtensionHeader { + obj := patternFlowGtpExtensionNextExtensionHeader{obj: &otg.PatternFlowGtpExtensionNextExtensionHeader{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpExtensionNextExtensionHeader) msg() *otg.PatternFlowGtpExtensionNextExtensionHeader { + return obj.obj +} + +func (obj *patternFlowGtpExtensionNextExtensionHeader) setMsg(msg *otg.PatternFlowGtpExtensionNextExtensionHeader) PatternFlowGtpExtensionNextExtensionHeader { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpExtensionNextExtensionHeader struct { + obj *patternFlowGtpExtensionNextExtensionHeader +} + +type marshalPatternFlowGtpExtensionNextExtensionHeader interface { + // ToProto marshals PatternFlowGtpExtensionNextExtensionHeader to protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeader + ToProto() (*otg.PatternFlowGtpExtensionNextExtensionHeader, error) + // ToPbText marshals PatternFlowGtpExtensionNextExtensionHeader to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpExtensionNextExtensionHeader to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpExtensionNextExtensionHeader to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpExtensionNextExtensionHeader struct { + obj *patternFlowGtpExtensionNextExtensionHeader +} + +type unMarshalPatternFlowGtpExtensionNextExtensionHeader interface { + // FromProto unmarshals PatternFlowGtpExtensionNextExtensionHeader from protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeader + FromProto(msg *otg.PatternFlowGtpExtensionNextExtensionHeader) (PatternFlowGtpExtensionNextExtensionHeader, error) + // FromPbText unmarshals PatternFlowGtpExtensionNextExtensionHeader from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpExtensionNextExtensionHeader from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpExtensionNextExtensionHeader from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpExtensionNextExtensionHeader) Marshal() marshalPatternFlowGtpExtensionNextExtensionHeader { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpExtensionNextExtensionHeader{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpExtensionNextExtensionHeader) Unmarshal() unMarshalPatternFlowGtpExtensionNextExtensionHeader { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpExtensionNextExtensionHeader{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpExtensionNextExtensionHeader) ToProto() (*otg.PatternFlowGtpExtensionNextExtensionHeader, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpExtensionNextExtensionHeader) FromProto(msg *otg.PatternFlowGtpExtensionNextExtensionHeader) (PatternFlowGtpExtensionNextExtensionHeader, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpExtensionNextExtensionHeader) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeader) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpExtensionNextExtensionHeader) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeader) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpExtensionNextExtensionHeader) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeader) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpExtensionNextExtensionHeader) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionNextExtensionHeader) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionNextExtensionHeader) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpExtensionNextExtensionHeader) Clone() (PatternFlowGtpExtensionNextExtensionHeader, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpExtensionNextExtensionHeader() + 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 +} + +func (obj *patternFlowGtpExtensionNextExtensionHeader) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpExtensionNextExtensionHeader is it states the type of the next extension, or 0 if no next extension exists. This permits chaining several next extension headers. +type PatternFlowGtpExtensionNextExtensionHeader interface { + Validation + // msg marshals PatternFlowGtpExtensionNextExtensionHeader to protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeader + // and doesn't set defaults + msg() *otg.PatternFlowGtpExtensionNextExtensionHeader + // setMsg unmarshals PatternFlowGtpExtensionNextExtensionHeader from protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeader + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpExtensionNextExtensionHeader) PatternFlowGtpExtensionNextExtensionHeader + // provides marshal interface + Marshal() marshalPatternFlowGtpExtensionNextExtensionHeader + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpExtensionNextExtensionHeader + // validate validates PatternFlowGtpExtensionNextExtensionHeader + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpExtensionNextExtensionHeader, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum, set in PatternFlowGtpExtensionNextExtensionHeader + Choice() PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum + // setChoice assigns PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum provided by user to PatternFlowGtpExtensionNextExtensionHeader + setChoice(value PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum) PatternFlowGtpExtensionNextExtensionHeader + // HasChoice checks if Choice has been set in PatternFlowGtpExtensionNextExtensionHeader + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpExtensionNextExtensionHeader. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpExtensionNextExtensionHeader + SetValue(value uint32) PatternFlowGtpExtensionNextExtensionHeader + // HasValue checks if Value has been set in PatternFlowGtpExtensionNextExtensionHeader + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpExtensionNextExtensionHeader. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpExtensionNextExtensionHeader + SetValues(value []uint32) PatternFlowGtpExtensionNextExtensionHeader + // Increment returns PatternFlowGtpExtensionNextExtensionHeaderCounter, set in PatternFlowGtpExtensionNextExtensionHeader. + // PatternFlowGtpExtensionNextExtensionHeaderCounter is integer counter pattern + Increment() PatternFlowGtpExtensionNextExtensionHeaderCounter + // SetIncrement assigns PatternFlowGtpExtensionNextExtensionHeaderCounter provided by user to PatternFlowGtpExtensionNextExtensionHeader. + // PatternFlowGtpExtensionNextExtensionHeaderCounter is integer counter pattern + SetIncrement(value PatternFlowGtpExtensionNextExtensionHeaderCounter) PatternFlowGtpExtensionNextExtensionHeader + // HasIncrement checks if Increment has been set in PatternFlowGtpExtensionNextExtensionHeader + HasIncrement() bool + // Decrement returns PatternFlowGtpExtensionNextExtensionHeaderCounter, set in PatternFlowGtpExtensionNextExtensionHeader. + // PatternFlowGtpExtensionNextExtensionHeaderCounter is integer counter pattern + Decrement() PatternFlowGtpExtensionNextExtensionHeaderCounter + // SetDecrement assigns PatternFlowGtpExtensionNextExtensionHeaderCounter provided by user to PatternFlowGtpExtensionNextExtensionHeader. + // PatternFlowGtpExtensionNextExtensionHeaderCounter is integer counter pattern + SetDecrement(value PatternFlowGtpExtensionNextExtensionHeaderCounter) PatternFlowGtpExtensionNextExtensionHeader + // HasDecrement checks if Decrement has been set in PatternFlowGtpExtensionNextExtensionHeader + HasDecrement() bool + // MetricTags returns PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIterIter, set in PatternFlowGtpExtensionNextExtensionHeader + MetricTags() PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter + setNil() +} + +type PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum string + +// Enum of Choice on PatternFlowGtpExtensionNextExtensionHeader +var PatternFlowGtpExtensionNextExtensionHeaderChoice = struct { + VALUE PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum + VALUES PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum + INCREMENT PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum + DECREMENT PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum +}{ + VALUE: PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum("value"), + VALUES: PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum("values"), + INCREMENT: PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum("increment"), + DECREMENT: PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpExtensionNextExtensionHeader) Choice() PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum { + return PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpExtensionNextExtensionHeader) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpExtensionNextExtensionHeader) setChoice(value PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum) PatternFlowGtpExtensionNextExtensionHeader { + intValue, ok := otg.PatternFlowGtpExtensionNextExtensionHeader_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpExtensionNextExtensionHeader_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpExtensionNextExtensionHeaderChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpExtensionNextExtensionHeaderCounter().msg() + } + + if value == PatternFlowGtpExtensionNextExtensionHeaderChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpExtensionNextExtensionHeaderCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpExtensionNextExtensionHeader) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpExtensionNextExtensionHeader) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpExtensionNextExtensionHeader object +func (obj *patternFlowGtpExtensionNextExtensionHeader) SetValue(value uint32) PatternFlowGtpExtensionNextExtensionHeader { + obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpExtensionNextExtensionHeader) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpExtensionNextExtensionHeader object +func (obj *patternFlowGtpExtensionNextExtensionHeader) SetValues(value []uint32) PatternFlowGtpExtensionNextExtensionHeader { + obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpExtensionNextExtensionHeaderCounter +func (obj *patternFlowGtpExtensionNextExtensionHeader) Increment() PatternFlowGtpExtensionNextExtensionHeaderCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpExtensionNextExtensionHeaderCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpExtensionNextExtensionHeaderCounter +func (obj *patternFlowGtpExtensionNextExtensionHeader) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpExtensionNextExtensionHeaderCounter value in the PatternFlowGtpExtensionNextExtensionHeader object +func (obj *patternFlowGtpExtensionNextExtensionHeader) SetIncrement(value PatternFlowGtpExtensionNextExtensionHeaderCounter) PatternFlowGtpExtensionNextExtensionHeader { + obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpExtensionNextExtensionHeaderCounter +func (obj *patternFlowGtpExtensionNextExtensionHeader) Decrement() PatternFlowGtpExtensionNextExtensionHeaderCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpExtensionNextExtensionHeaderCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpExtensionNextExtensionHeaderCounter +func (obj *patternFlowGtpExtensionNextExtensionHeader) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpExtensionNextExtensionHeaderCounter value in the PatternFlowGtpExtensionNextExtensionHeader object +func (obj *patternFlowGtpExtensionNextExtensionHeader) SetDecrement(value PatternFlowGtpExtensionNextExtensionHeaderCounter) PatternFlowGtpExtensionNextExtensionHeader { + obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpExtensionNextExtensionHeaderMetricTag +func (obj *patternFlowGtpExtensionNextExtensionHeader) MetricTags() PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter struct { + obj *patternFlowGtpExtensionNextExtensionHeader + patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice []PatternFlowGtpExtensionNextExtensionHeaderMetricTag + fieldPtr *[]*otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag +} + +func newPatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter(ptr *[]*otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { + return &patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter interface { + setMsg(*patternFlowGtpExtensionNextExtensionHeader) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter + Items() []PatternFlowGtpExtensionNextExtensionHeaderMetricTag + Add() PatternFlowGtpExtensionNextExtensionHeaderMetricTag + Append(items ...PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter + Set(index int, newObj PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter + Clear() PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter + clearHolderSlice() PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter + appendHolderSlice(item PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) setMsg(msg *patternFlowGtpExtensionNextExtensionHeader) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpExtensionNextExtensionHeaderMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) Items() []PatternFlowGtpExtensionNextExtensionHeaderMetricTag { + return obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) Add() PatternFlowGtpExtensionNextExtensionHeaderMetricTag { + newObj := &otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpExtensionNextExtensionHeaderMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice = append(obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) Append(items ...PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice = append(obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) Set(index int, newObj PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) Clear() PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag{} + obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice = []PatternFlowGtpExtensionNextExtensionHeaderMetricTag{} + } + return obj +} +func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) clearHolderSlice() PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { + if len(obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice) > 0 { + obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice = []PatternFlowGtpExtensionNextExtensionHeaderMetricTag{} + } + return obj +} +func (obj *patternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter) appendHolderSlice(item PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderPatternFlowGtpExtensionNextExtensionHeaderMetricTagIter { + obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice = append(obj.patternFlowGtpExtensionNextExtensionHeaderMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpExtensionNextExtensionHeader) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionNextExtensionHeader.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpExtensionNextExtensionHeader.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpExtensionNextExtensionHeaderMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpExtensionNextExtensionHeader) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpExtensionNextExtensionHeaderChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpExtensionNextExtensionHeaderChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpExtensionNextExtensionHeaderChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpExtensionNextExtensionHeaderChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpExtensionNextExtensionHeader") + } + } else { + intVal := otg.PatternFlowGtpExtensionNextExtensionHeader_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpExtensionNextExtensionHeader_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtp_extension_next_extension_header_counter.go b/gosnappi/pattern_flow_gtp_extension_next_extension_header_counter.go new file mode 100644 index 00000000..165deef7 --- /dev/null +++ b/gosnappi/pattern_flow_gtp_extension_next_extension_header_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpExtensionNextExtensionHeaderCounter ***** +type patternFlowGtpExtensionNextExtensionHeaderCounter struct { + validation + obj *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter + marshaller marshalPatternFlowGtpExtensionNextExtensionHeaderCounter + unMarshaller unMarshalPatternFlowGtpExtensionNextExtensionHeaderCounter +} + +func NewPatternFlowGtpExtensionNextExtensionHeaderCounter() PatternFlowGtpExtensionNextExtensionHeaderCounter { + obj := patternFlowGtpExtensionNextExtensionHeaderCounter{obj: &otg.PatternFlowGtpExtensionNextExtensionHeaderCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) msg() *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter { + return obj.obj +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) setMsg(msg *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter) PatternFlowGtpExtensionNextExtensionHeaderCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpExtensionNextExtensionHeaderCounter struct { + obj *patternFlowGtpExtensionNextExtensionHeaderCounter +} + +type marshalPatternFlowGtpExtensionNextExtensionHeaderCounter interface { + // ToProto marshals PatternFlowGtpExtensionNextExtensionHeaderCounter to protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter + ToProto() (*otg.PatternFlowGtpExtensionNextExtensionHeaderCounter, error) + // ToPbText marshals PatternFlowGtpExtensionNextExtensionHeaderCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpExtensionNextExtensionHeaderCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpExtensionNextExtensionHeaderCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpExtensionNextExtensionHeaderCounter struct { + obj *patternFlowGtpExtensionNextExtensionHeaderCounter +} + +type unMarshalPatternFlowGtpExtensionNextExtensionHeaderCounter interface { + // FromProto unmarshals PatternFlowGtpExtensionNextExtensionHeaderCounter from protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter + FromProto(msg *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter) (PatternFlowGtpExtensionNextExtensionHeaderCounter, error) + // FromPbText unmarshals PatternFlowGtpExtensionNextExtensionHeaderCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpExtensionNextExtensionHeaderCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpExtensionNextExtensionHeaderCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) Marshal() marshalPatternFlowGtpExtensionNextExtensionHeaderCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpExtensionNextExtensionHeaderCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) Unmarshal() unMarshalPatternFlowGtpExtensionNextExtensionHeaderCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpExtensionNextExtensionHeaderCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpExtensionNextExtensionHeaderCounter) ToProto() (*otg.PatternFlowGtpExtensionNextExtensionHeaderCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpExtensionNextExtensionHeaderCounter) FromProto(msg *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter) (PatternFlowGtpExtensionNextExtensionHeaderCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpExtensionNextExtensionHeaderCounter) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeaderCounter) 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 *marshalpatternFlowGtpExtensionNextExtensionHeaderCounter) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeaderCounter) 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 *marshalpatternFlowGtpExtensionNextExtensionHeaderCounter) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeaderCounter) 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 *patternFlowGtpExtensionNextExtensionHeaderCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) Clone() (PatternFlowGtpExtensionNextExtensionHeaderCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpExtensionNextExtensionHeaderCounter() + 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 +} + +// PatternFlowGtpExtensionNextExtensionHeaderCounter is integer counter pattern +type PatternFlowGtpExtensionNextExtensionHeaderCounter interface { + Validation + // msg marshals PatternFlowGtpExtensionNextExtensionHeaderCounter to protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter + // setMsg unmarshals PatternFlowGtpExtensionNextExtensionHeaderCounter from protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpExtensionNextExtensionHeaderCounter) PatternFlowGtpExtensionNextExtensionHeaderCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpExtensionNextExtensionHeaderCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpExtensionNextExtensionHeaderCounter + // validate validates PatternFlowGtpExtensionNextExtensionHeaderCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpExtensionNextExtensionHeaderCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpExtensionNextExtensionHeaderCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpExtensionNextExtensionHeaderCounter + SetStart(value uint32) PatternFlowGtpExtensionNextExtensionHeaderCounter + // HasStart checks if Start has been set in PatternFlowGtpExtensionNextExtensionHeaderCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpExtensionNextExtensionHeaderCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpExtensionNextExtensionHeaderCounter + SetStep(value uint32) PatternFlowGtpExtensionNextExtensionHeaderCounter + // HasStep checks if Step has been set in PatternFlowGtpExtensionNextExtensionHeaderCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpExtensionNextExtensionHeaderCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpExtensionNextExtensionHeaderCounter + SetCount(value uint32) PatternFlowGtpExtensionNextExtensionHeaderCounter + // HasCount checks if Count has been set in PatternFlowGtpExtensionNextExtensionHeaderCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpExtensionNextExtensionHeaderCounter object +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) SetStart(value uint32) PatternFlowGtpExtensionNextExtensionHeaderCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpExtensionNextExtensionHeaderCounter object +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) SetStep(value uint32) PatternFlowGtpExtensionNextExtensionHeaderCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpExtensionNextExtensionHeaderCounter object +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) SetCount(value uint32) PatternFlowGtpExtensionNextExtensionHeaderCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionNextExtensionHeaderCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionNextExtensionHeaderCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionNextExtensionHeaderCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtp_extension_next_extension_header_metric_tag.go b/gosnappi/pattern_flow_gtp_extension_next_extension_header_metric_tag.go new file mode 100644 index 00000000..21d39e35 --- /dev/null +++ b/gosnappi/pattern_flow_gtp_extension_next_extension_header_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpExtensionNextExtensionHeaderMetricTag ***** +type patternFlowGtpExtensionNextExtensionHeaderMetricTag struct { + validation + obj *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag + marshaller marshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag + unMarshaller unMarshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag +} + +func NewPatternFlowGtpExtensionNextExtensionHeaderMetricTag() PatternFlowGtpExtensionNextExtensionHeaderMetricTag { + obj := patternFlowGtpExtensionNextExtensionHeaderMetricTag{obj: &otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) msg() *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) setMsg(msg *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag struct { + obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag +} + +type marshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag interface { + // ToProto marshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag to protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag + ToProto() (*otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag, error) + // ToPbText marshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag struct { + obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag +} + +type unMarshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag interface { + // FromProto unmarshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag from protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag + FromProto(msg *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag) (PatternFlowGtpExtensionNextExtensionHeaderMetricTag, error) + // FromPbText unmarshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) Marshal() marshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) Unmarshal() unMarshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) ToProto() (*otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) FromProto(msg *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag) (PatternFlowGtpExtensionNextExtensionHeaderMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) 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 *marshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) 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 *marshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) 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 *unMarshalpatternFlowGtpExtensionNextExtensionHeaderMetricTag) 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 *patternFlowGtpExtensionNextExtensionHeaderMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) Clone() (PatternFlowGtpExtensionNextExtensionHeaderMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpExtensionNextExtensionHeaderMetricTag() + 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 +} + +// PatternFlowGtpExtensionNextExtensionHeaderMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpExtensionNextExtensionHeaderMetricTag interface { + Validation + // msg marshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag to protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag + // setMsg unmarshals PatternFlowGtpExtensionNextExtensionHeaderMetricTag from protobuf object *otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpExtensionNextExtensionHeaderMetricTag) PatternFlowGtpExtensionNextExtensionHeaderMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpExtensionNextExtensionHeaderMetricTag + // validate validates PatternFlowGtpExtensionNextExtensionHeaderMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpExtensionNextExtensionHeaderMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpExtensionNextExtensionHeaderMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpExtensionNextExtensionHeaderMetricTag + SetName(value string) PatternFlowGtpExtensionNextExtensionHeaderMetricTag + // Offset returns uint32, set in PatternFlowGtpExtensionNextExtensionHeaderMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpExtensionNextExtensionHeaderMetricTag + SetOffset(value uint32) PatternFlowGtpExtensionNextExtensionHeaderMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpExtensionNextExtensionHeaderMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpExtensionNextExtensionHeaderMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpExtensionNextExtensionHeaderMetricTag + SetLength(value uint32) PatternFlowGtpExtensionNextExtensionHeaderMetricTag + // HasLength checks if Length has been set in PatternFlowGtpExtensionNextExtensionHeaderMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpExtensionNextExtensionHeaderMetricTag object +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) SetName(value string) PatternFlowGtpExtensionNextExtensionHeaderMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpExtensionNextExtensionHeaderMetricTag object +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) SetOffset(value uint32) PatternFlowGtpExtensionNextExtensionHeaderMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpExtensionNextExtensionHeaderMetricTag object +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) SetLength(value uint32) PatternFlowGtpExtensionNextExtensionHeaderMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpExtensionNextExtensionHeaderMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpExtensionNextExtensionHeaderMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpExtensionNextExtensionHeaderMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpExtensionNextExtensionHeaderMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_e_flag.go b/gosnappi/pattern_flow_gtpv1_e_flag.go new file mode 100644 index 00000000..1a8b0a57 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_e_flag.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv1EFlag ***** +type patternFlowGtpv1EFlag struct { + validation + obj *otg.PatternFlowGtpv1EFlag + marshaller marshalPatternFlowGtpv1EFlag + unMarshaller unMarshalPatternFlowGtpv1EFlag + incrementHolder PatternFlowGtpv1EFlagCounter + decrementHolder PatternFlowGtpv1EFlagCounter + metricTagsHolder PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter +} + +func NewPatternFlowGtpv1EFlag() PatternFlowGtpv1EFlag { + obj := patternFlowGtpv1EFlag{obj: &otg.PatternFlowGtpv1EFlag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1EFlag) msg() *otg.PatternFlowGtpv1EFlag { + return obj.obj +} + +func (obj *patternFlowGtpv1EFlag) setMsg(msg *otg.PatternFlowGtpv1EFlag) PatternFlowGtpv1EFlag { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1EFlag struct { + obj *patternFlowGtpv1EFlag +} + +type marshalPatternFlowGtpv1EFlag interface { + // ToProto marshals PatternFlowGtpv1EFlag to protobuf object *otg.PatternFlowGtpv1EFlag + ToProto() (*otg.PatternFlowGtpv1EFlag, error) + // ToPbText marshals PatternFlowGtpv1EFlag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1EFlag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1EFlag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1EFlag struct { + obj *patternFlowGtpv1EFlag +} + +type unMarshalPatternFlowGtpv1EFlag interface { + // FromProto unmarshals PatternFlowGtpv1EFlag from protobuf object *otg.PatternFlowGtpv1EFlag + FromProto(msg *otg.PatternFlowGtpv1EFlag) (PatternFlowGtpv1EFlag, error) + // FromPbText unmarshals PatternFlowGtpv1EFlag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1EFlag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1EFlag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1EFlag) Marshal() marshalPatternFlowGtpv1EFlag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1EFlag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1EFlag) Unmarshal() unMarshalPatternFlowGtpv1EFlag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1EFlag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1EFlag) ToProto() (*otg.PatternFlowGtpv1EFlag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1EFlag) FromProto(msg *otg.PatternFlowGtpv1EFlag) (PatternFlowGtpv1EFlag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1EFlag) 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 *unMarshalpatternFlowGtpv1EFlag) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv1EFlag) 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 *unMarshalpatternFlowGtpv1EFlag) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv1EFlag) 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 *unMarshalpatternFlowGtpv1EFlag) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv1EFlag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1EFlag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1EFlag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1EFlag) Clone() (PatternFlowGtpv1EFlag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1EFlag() + 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 +} + +func (obj *patternFlowGtpv1EFlag) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv1EFlag is extension header field present +type PatternFlowGtpv1EFlag interface { + Validation + // msg marshals PatternFlowGtpv1EFlag to protobuf object *otg.PatternFlowGtpv1EFlag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1EFlag + // setMsg unmarshals PatternFlowGtpv1EFlag from protobuf object *otg.PatternFlowGtpv1EFlag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1EFlag) PatternFlowGtpv1EFlag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1EFlag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1EFlag + // validate validates PatternFlowGtpv1EFlag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1EFlag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv1EFlagChoiceEnum, set in PatternFlowGtpv1EFlag + Choice() PatternFlowGtpv1EFlagChoiceEnum + // setChoice assigns PatternFlowGtpv1EFlagChoiceEnum provided by user to PatternFlowGtpv1EFlag + setChoice(value PatternFlowGtpv1EFlagChoiceEnum) PatternFlowGtpv1EFlag + // HasChoice checks if Choice has been set in PatternFlowGtpv1EFlag + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv1EFlag. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv1EFlag + SetValue(value uint32) PatternFlowGtpv1EFlag + // HasValue checks if Value has been set in PatternFlowGtpv1EFlag + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv1EFlag. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv1EFlag + SetValues(value []uint32) PatternFlowGtpv1EFlag + // Increment returns PatternFlowGtpv1EFlagCounter, set in PatternFlowGtpv1EFlag. + // PatternFlowGtpv1EFlagCounter is integer counter pattern + Increment() PatternFlowGtpv1EFlagCounter + // SetIncrement assigns PatternFlowGtpv1EFlagCounter provided by user to PatternFlowGtpv1EFlag. + // PatternFlowGtpv1EFlagCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv1EFlagCounter) PatternFlowGtpv1EFlag + // HasIncrement checks if Increment has been set in PatternFlowGtpv1EFlag + HasIncrement() bool + // Decrement returns PatternFlowGtpv1EFlagCounter, set in PatternFlowGtpv1EFlag. + // PatternFlowGtpv1EFlagCounter is integer counter pattern + Decrement() PatternFlowGtpv1EFlagCounter + // SetDecrement assigns PatternFlowGtpv1EFlagCounter provided by user to PatternFlowGtpv1EFlag. + // PatternFlowGtpv1EFlagCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv1EFlagCounter) PatternFlowGtpv1EFlag + // HasDecrement checks if Decrement has been set in PatternFlowGtpv1EFlag + HasDecrement() bool + // MetricTags returns PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIterIter, set in PatternFlowGtpv1EFlag + MetricTags() PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter + setNil() +} + +type PatternFlowGtpv1EFlagChoiceEnum string + +// Enum of Choice on PatternFlowGtpv1EFlag +var PatternFlowGtpv1EFlagChoice = struct { + VALUE PatternFlowGtpv1EFlagChoiceEnum + VALUES PatternFlowGtpv1EFlagChoiceEnum + INCREMENT PatternFlowGtpv1EFlagChoiceEnum + DECREMENT PatternFlowGtpv1EFlagChoiceEnum +}{ + VALUE: PatternFlowGtpv1EFlagChoiceEnum("value"), + VALUES: PatternFlowGtpv1EFlagChoiceEnum("values"), + INCREMENT: PatternFlowGtpv1EFlagChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv1EFlagChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv1EFlag) Choice() PatternFlowGtpv1EFlagChoiceEnum { + return PatternFlowGtpv1EFlagChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv1EFlag) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv1EFlag) setChoice(value PatternFlowGtpv1EFlagChoiceEnum) PatternFlowGtpv1EFlag { + intValue, ok := otg.PatternFlowGtpv1EFlag_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv1EFlagChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv1EFlag_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv1EFlagChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv1EFlagChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv1EFlagChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv1EFlagCounter().msg() + } + + if value == PatternFlowGtpv1EFlagChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv1EFlagCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1EFlag) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv1EFlagChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1EFlag) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv1EFlag object +func (obj *patternFlowGtpv1EFlag) SetValue(value uint32) PatternFlowGtpv1EFlag { + obj.setChoice(PatternFlowGtpv1EFlagChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv1EFlag) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv1EFlag object +func (obj *patternFlowGtpv1EFlag) SetValues(value []uint32) PatternFlowGtpv1EFlag { + obj.setChoice(PatternFlowGtpv1EFlagChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv1EFlagCounter +func (obj *patternFlowGtpv1EFlag) Increment() PatternFlowGtpv1EFlagCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv1EFlagChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv1EFlagCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv1EFlagCounter +func (obj *patternFlowGtpv1EFlag) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv1EFlagCounter value in the PatternFlowGtpv1EFlag object +func (obj *patternFlowGtpv1EFlag) SetIncrement(value PatternFlowGtpv1EFlagCounter) PatternFlowGtpv1EFlag { + obj.setChoice(PatternFlowGtpv1EFlagChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1EFlagCounter +func (obj *patternFlowGtpv1EFlag) Decrement() PatternFlowGtpv1EFlagCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv1EFlagChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv1EFlagCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1EFlagCounter +func (obj *patternFlowGtpv1EFlag) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv1EFlagCounter value in the PatternFlowGtpv1EFlag object +func (obj *patternFlowGtpv1EFlag) SetDecrement(value PatternFlowGtpv1EFlagCounter) PatternFlowGtpv1EFlag { + obj.setChoice(PatternFlowGtpv1EFlagChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv1EFlagMetricTag +func (obj *patternFlowGtpv1EFlag) MetricTags() PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv1EFlagMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter struct { + obj *patternFlowGtpv1EFlag + patternFlowGtpv1EFlagMetricTagSlice []PatternFlowGtpv1EFlagMetricTag + fieldPtr *[]*otg.PatternFlowGtpv1EFlagMetricTag +} + +func newPatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter(ptr *[]*otg.PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { + return &patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter interface { + setMsg(*patternFlowGtpv1EFlag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter + Items() []PatternFlowGtpv1EFlagMetricTag + Add() PatternFlowGtpv1EFlagMetricTag + Append(items ...PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter + Set(index int, newObj PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter + Clear() PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter + clearHolderSlice() PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter + appendHolderSlice(item PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter +} + +func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) setMsg(msg *patternFlowGtpv1EFlag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv1EFlagMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) Items() []PatternFlowGtpv1EFlagMetricTag { + return obj.patternFlowGtpv1EFlagMetricTagSlice +} + +func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) Add() PatternFlowGtpv1EFlagMetricTag { + newObj := &otg.PatternFlowGtpv1EFlagMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv1EFlagMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv1EFlagMetricTagSlice = append(obj.patternFlowGtpv1EFlagMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) Append(items ...PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv1EFlagMetricTagSlice = append(obj.patternFlowGtpv1EFlagMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) Set(index int, newObj PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv1EFlagMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) Clear() PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv1EFlagMetricTag{} + obj.patternFlowGtpv1EFlagMetricTagSlice = []PatternFlowGtpv1EFlagMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) clearHolderSlice() PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { + if len(obj.patternFlowGtpv1EFlagMetricTagSlice) > 0 { + obj.patternFlowGtpv1EFlagMetricTagSlice = []PatternFlowGtpv1EFlagMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter) appendHolderSlice(item PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagPatternFlowGtpv1EFlagMetricTagIter { + obj.patternFlowGtpv1EFlagMetricTagSlice = append(obj.patternFlowGtpv1EFlagMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv1EFlag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1EFlag.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv1EFlag.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv1EFlagMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv1EFlag) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv1EFlagChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv1EFlagChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv1EFlagChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv1EFlagChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv1EFlagChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv1EFlagChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1EFlag") + } + } else { + intVal := otg.PatternFlowGtpv1EFlag_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv1EFlag_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_e_flag_counter.go b/gosnappi/pattern_flow_gtpv1_e_flag_counter.go new file mode 100644 index 00000000..360074c1 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_e_flag_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv1EFlagCounter ***** +type patternFlowGtpv1EFlagCounter struct { + validation + obj *otg.PatternFlowGtpv1EFlagCounter + marshaller marshalPatternFlowGtpv1EFlagCounter + unMarshaller unMarshalPatternFlowGtpv1EFlagCounter +} + +func NewPatternFlowGtpv1EFlagCounter() PatternFlowGtpv1EFlagCounter { + obj := patternFlowGtpv1EFlagCounter{obj: &otg.PatternFlowGtpv1EFlagCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1EFlagCounter) msg() *otg.PatternFlowGtpv1EFlagCounter { + return obj.obj +} + +func (obj *patternFlowGtpv1EFlagCounter) setMsg(msg *otg.PatternFlowGtpv1EFlagCounter) PatternFlowGtpv1EFlagCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1EFlagCounter struct { + obj *patternFlowGtpv1EFlagCounter +} + +type marshalPatternFlowGtpv1EFlagCounter interface { + // ToProto marshals PatternFlowGtpv1EFlagCounter to protobuf object *otg.PatternFlowGtpv1EFlagCounter + ToProto() (*otg.PatternFlowGtpv1EFlagCounter, error) + // ToPbText marshals PatternFlowGtpv1EFlagCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1EFlagCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1EFlagCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1EFlagCounter struct { + obj *patternFlowGtpv1EFlagCounter +} + +type unMarshalPatternFlowGtpv1EFlagCounter interface { + // FromProto unmarshals PatternFlowGtpv1EFlagCounter from protobuf object *otg.PatternFlowGtpv1EFlagCounter + FromProto(msg *otg.PatternFlowGtpv1EFlagCounter) (PatternFlowGtpv1EFlagCounter, error) + // FromPbText unmarshals PatternFlowGtpv1EFlagCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1EFlagCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1EFlagCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1EFlagCounter) Marshal() marshalPatternFlowGtpv1EFlagCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1EFlagCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1EFlagCounter) Unmarshal() unMarshalPatternFlowGtpv1EFlagCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1EFlagCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1EFlagCounter) ToProto() (*otg.PatternFlowGtpv1EFlagCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1EFlagCounter) FromProto(msg *otg.PatternFlowGtpv1EFlagCounter) (PatternFlowGtpv1EFlagCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1EFlagCounter) 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 *unMarshalpatternFlowGtpv1EFlagCounter) 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 *marshalpatternFlowGtpv1EFlagCounter) 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 *unMarshalpatternFlowGtpv1EFlagCounter) 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 *marshalpatternFlowGtpv1EFlagCounter) 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 *unMarshalpatternFlowGtpv1EFlagCounter) 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 *patternFlowGtpv1EFlagCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1EFlagCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1EFlagCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1EFlagCounter) Clone() (PatternFlowGtpv1EFlagCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1EFlagCounter() + 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 +} + +// PatternFlowGtpv1EFlagCounter is integer counter pattern +type PatternFlowGtpv1EFlagCounter interface { + Validation + // msg marshals PatternFlowGtpv1EFlagCounter to protobuf object *otg.PatternFlowGtpv1EFlagCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1EFlagCounter + // setMsg unmarshals PatternFlowGtpv1EFlagCounter from protobuf object *otg.PatternFlowGtpv1EFlagCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1EFlagCounter) PatternFlowGtpv1EFlagCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv1EFlagCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1EFlagCounter + // validate validates PatternFlowGtpv1EFlagCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1EFlagCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv1EFlagCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv1EFlagCounter + SetStart(value uint32) PatternFlowGtpv1EFlagCounter + // HasStart checks if Start has been set in PatternFlowGtpv1EFlagCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv1EFlagCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv1EFlagCounter + SetStep(value uint32) PatternFlowGtpv1EFlagCounter + // HasStep checks if Step has been set in PatternFlowGtpv1EFlagCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv1EFlagCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv1EFlagCounter + SetCount(value uint32) PatternFlowGtpv1EFlagCounter + // HasCount checks if Count has been set in PatternFlowGtpv1EFlagCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1EFlagCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1EFlagCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv1EFlagCounter object +func (obj *patternFlowGtpv1EFlagCounter) SetStart(value uint32) PatternFlowGtpv1EFlagCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1EFlagCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1EFlagCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv1EFlagCounter object +func (obj *patternFlowGtpv1EFlagCounter) SetStep(value uint32) PatternFlowGtpv1EFlagCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1EFlagCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1EFlagCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv1EFlagCounter object +func (obj *patternFlowGtpv1EFlagCounter) SetCount(value uint32) PatternFlowGtpv1EFlagCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv1EFlagCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1EFlagCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1EFlagCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1EFlagCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv1EFlagCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_e_flag_metric_tag.go b/gosnappi/pattern_flow_gtpv1_e_flag_metric_tag.go new file mode 100644 index 00000000..c684c7be --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_e_flag_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv1EFlagMetricTag ***** +type patternFlowGtpv1EFlagMetricTag struct { + validation + obj *otg.PatternFlowGtpv1EFlagMetricTag + marshaller marshalPatternFlowGtpv1EFlagMetricTag + unMarshaller unMarshalPatternFlowGtpv1EFlagMetricTag +} + +func NewPatternFlowGtpv1EFlagMetricTag() PatternFlowGtpv1EFlagMetricTag { + obj := patternFlowGtpv1EFlagMetricTag{obj: &otg.PatternFlowGtpv1EFlagMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1EFlagMetricTag) msg() *otg.PatternFlowGtpv1EFlagMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv1EFlagMetricTag) setMsg(msg *otg.PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1EFlagMetricTag struct { + obj *patternFlowGtpv1EFlagMetricTag +} + +type marshalPatternFlowGtpv1EFlagMetricTag interface { + // ToProto marshals PatternFlowGtpv1EFlagMetricTag to protobuf object *otg.PatternFlowGtpv1EFlagMetricTag + ToProto() (*otg.PatternFlowGtpv1EFlagMetricTag, error) + // ToPbText marshals PatternFlowGtpv1EFlagMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1EFlagMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1EFlagMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1EFlagMetricTag struct { + obj *patternFlowGtpv1EFlagMetricTag +} + +type unMarshalPatternFlowGtpv1EFlagMetricTag interface { + // FromProto unmarshals PatternFlowGtpv1EFlagMetricTag from protobuf object *otg.PatternFlowGtpv1EFlagMetricTag + FromProto(msg *otg.PatternFlowGtpv1EFlagMetricTag) (PatternFlowGtpv1EFlagMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv1EFlagMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1EFlagMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1EFlagMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1EFlagMetricTag) Marshal() marshalPatternFlowGtpv1EFlagMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1EFlagMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1EFlagMetricTag) Unmarshal() unMarshalPatternFlowGtpv1EFlagMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1EFlagMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1EFlagMetricTag) ToProto() (*otg.PatternFlowGtpv1EFlagMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1EFlagMetricTag) FromProto(msg *otg.PatternFlowGtpv1EFlagMetricTag) (PatternFlowGtpv1EFlagMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1EFlagMetricTag) 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 *unMarshalpatternFlowGtpv1EFlagMetricTag) 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 *marshalpatternFlowGtpv1EFlagMetricTag) 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 *unMarshalpatternFlowGtpv1EFlagMetricTag) 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 *marshalpatternFlowGtpv1EFlagMetricTag) 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 *unMarshalpatternFlowGtpv1EFlagMetricTag) 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 *patternFlowGtpv1EFlagMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1EFlagMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1EFlagMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1EFlagMetricTag) Clone() (PatternFlowGtpv1EFlagMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1EFlagMetricTag() + 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 +} + +// PatternFlowGtpv1EFlagMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv1EFlagMetricTag interface { + Validation + // msg marshals PatternFlowGtpv1EFlagMetricTag to protobuf object *otg.PatternFlowGtpv1EFlagMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1EFlagMetricTag + // setMsg unmarshals PatternFlowGtpv1EFlagMetricTag from protobuf object *otg.PatternFlowGtpv1EFlagMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1EFlagMetricTag) PatternFlowGtpv1EFlagMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1EFlagMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1EFlagMetricTag + // validate validates PatternFlowGtpv1EFlagMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1EFlagMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv1EFlagMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv1EFlagMetricTag + SetName(value string) PatternFlowGtpv1EFlagMetricTag + // Offset returns uint32, set in PatternFlowGtpv1EFlagMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv1EFlagMetricTag + SetOffset(value uint32) PatternFlowGtpv1EFlagMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv1EFlagMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv1EFlagMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv1EFlagMetricTag + SetLength(value uint32) PatternFlowGtpv1EFlagMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv1EFlagMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv1EFlagMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv1EFlagMetricTag object +func (obj *patternFlowGtpv1EFlagMetricTag) SetName(value string) PatternFlowGtpv1EFlagMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1EFlagMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1EFlagMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv1EFlagMetricTag object +func (obj *patternFlowGtpv1EFlagMetricTag) SetOffset(value uint32) PatternFlowGtpv1EFlagMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1EFlagMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1EFlagMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv1EFlagMetricTag object +func (obj *patternFlowGtpv1EFlagMetricTag) SetLength(value uint32) PatternFlowGtpv1EFlagMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv1EFlagMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1EFlagMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1EFlagMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv1EFlagMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv1EFlagMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_message_length.go b/gosnappi/pattern_flow_gtpv1_message_length.go new file mode 100644 index 00000000..3c7313b2 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_message_length.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv1MessageLength ***** +type patternFlowGtpv1MessageLength struct { + validation + obj *otg.PatternFlowGtpv1MessageLength + marshaller marshalPatternFlowGtpv1MessageLength + unMarshaller unMarshalPatternFlowGtpv1MessageLength + incrementHolder PatternFlowGtpv1MessageLengthCounter + decrementHolder PatternFlowGtpv1MessageLengthCounter + metricTagsHolder PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter +} + +func NewPatternFlowGtpv1MessageLength() PatternFlowGtpv1MessageLength { + obj := patternFlowGtpv1MessageLength{obj: &otg.PatternFlowGtpv1MessageLength{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1MessageLength) msg() *otg.PatternFlowGtpv1MessageLength { + return obj.obj +} + +func (obj *patternFlowGtpv1MessageLength) setMsg(msg *otg.PatternFlowGtpv1MessageLength) PatternFlowGtpv1MessageLength { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1MessageLength struct { + obj *patternFlowGtpv1MessageLength +} + +type marshalPatternFlowGtpv1MessageLength interface { + // ToProto marshals PatternFlowGtpv1MessageLength to protobuf object *otg.PatternFlowGtpv1MessageLength + ToProto() (*otg.PatternFlowGtpv1MessageLength, error) + // ToPbText marshals PatternFlowGtpv1MessageLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1MessageLength to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1MessageLength to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1MessageLength struct { + obj *patternFlowGtpv1MessageLength +} + +type unMarshalPatternFlowGtpv1MessageLength interface { + // FromProto unmarshals PatternFlowGtpv1MessageLength from protobuf object *otg.PatternFlowGtpv1MessageLength + FromProto(msg *otg.PatternFlowGtpv1MessageLength) (PatternFlowGtpv1MessageLength, error) + // FromPbText unmarshals PatternFlowGtpv1MessageLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1MessageLength from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1MessageLength from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1MessageLength) Marshal() marshalPatternFlowGtpv1MessageLength { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1MessageLength{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1MessageLength) Unmarshal() unMarshalPatternFlowGtpv1MessageLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1MessageLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1MessageLength) ToProto() (*otg.PatternFlowGtpv1MessageLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1MessageLength) FromProto(msg *otg.PatternFlowGtpv1MessageLength) (PatternFlowGtpv1MessageLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1MessageLength) 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 *unMarshalpatternFlowGtpv1MessageLength) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv1MessageLength) 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 *unMarshalpatternFlowGtpv1MessageLength) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv1MessageLength) 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 *unMarshalpatternFlowGtpv1MessageLength) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv1MessageLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1MessageLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1MessageLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1MessageLength) Clone() (PatternFlowGtpv1MessageLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1MessageLength() + 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 +} + +func (obj *patternFlowGtpv1MessageLength) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv1MessageLength is the length of the payload (the bytes following the mandatory 8-byte GTP header) in bytes that includes any optional fields +type PatternFlowGtpv1MessageLength interface { + Validation + // msg marshals PatternFlowGtpv1MessageLength to protobuf object *otg.PatternFlowGtpv1MessageLength + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1MessageLength + // setMsg unmarshals PatternFlowGtpv1MessageLength from protobuf object *otg.PatternFlowGtpv1MessageLength + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1MessageLength) PatternFlowGtpv1MessageLength + // provides marshal interface + Marshal() marshalPatternFlowGtpv1MessageLength + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1MessageLength + // validate validates PatternFlowGtpv1MessageLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1MessageLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv1MessageLengthChoiceEnum, set in PatternFlowGtpv1MessageLength + Choice() PatternFlowGtpv1MessageLengthChoiceEnum + // setChoice assigns PatternFlowGtpv1MessageLengthChoiceEnum provided by user to PatternFlowGtpv1MessageLength + setChoice(value PatternFlowGtpv1MessageLengthChoiceEnum) PatternFlowGtpv1MessageLength + // HasChoice checks if Choice has been set in PatternFlowGtpv1MessageLength + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv1MessageLength. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv1MessageLength + SetValue(value uint32) PatternFlowGtpv1MessageLength + // HasValue checks if Value has been set in PatternFlowGtpv1MessageLength + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv1MessageLength. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv1MessageLength + SetValues(value []uint32) PatternFlowGtpv1MessageLength + // Increment returns PatternFlowGtpv1MessageLengthCounter, set in PatternFlowGtpv1MessageLength. + // PatternFlowGtpv1MessageLengthCounter is integer counter pattern + Increment() PatternFlowGtpv1MessageLengthCounter + // SetIncrement assigns PatternFlowGtpv1MessageLengthCounter provided by user to PatternFlowGtpv1MessageLength. + // PatternFlowGtpv1MessageLengthCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv1MessageLengthCounter) PatternFlowGtpv1MessageLength + // HasIncrement checks if Increment has been set in PatternFlowGtpv1MessageLength + HasIncrement() bool + // Decrement returns PatternFlowGtpv1MessageLengthCounter, set in PatternFlowGtpv1MessageLength. + // PatternFlowGtpv1MessageLengthCounter is integer counter pattern + Decrement() PatternFlowGtpv1MessageLengthCounter + // SetDecrement assigns PatternFlowGtpv1MessageLengthCounter provided by user to PatternFlowGtpv1MessageLength. + // PatternFlowGtpv1MessageLengthCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv1MessageLengthCounter) PatternFlowGtpv1MessageLength + // HasDecrement checks if Decrement has been set in PatternFlowGtpv1MessageLength + HasDecrement() bool + // MetricTags returns PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIterIter, set in PatternFlowGtpv1MessageLength + MetricTags() PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter + setNil() +} + +type PatternFlowGtpv1MessageLengthChoiceEnum string + +// Enum of Choice on PatternFlowGtpv1MessageLength +var PatternFlowGtpv1MessageLengthChoice = struct { + VALUE PatternFlowGtpv1MessageLengthChoiceEnum + VALUES PatternFlowGtpv1MessageLengthChoiceEnum + INCREMENT PatternFlowGtpv1MessageLengthChoiceEnum + DECREMENT PatternFlowGtpv1MessageLengthChoiceEnum +}{ + VALUE: PatternFlowGtpv1MessageLengthChoiceEnum("value"), + VALUES: PatternFlowGtpv1MessageLengthChoiceEnum("values"), + INCREMENT: PatternFlowGtpv1MessageLengthChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv1MessageLengthChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv1MessageLength) Choice() PatternFlowGtpv1MessageLengthChoiceEnum { + return PatternFlowGtpv1MessageLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv1MessageLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv1MessageLength) setChoice(value PatternFlowGtpv1MessageLengthChoiceEnum) PatternFlowGtpv1MessageLength { + intValue, ok := otg.PatternFlowGtpv1MessageLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv1MessageLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv1MessageLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv1MessageLengthChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv1MessageLengthChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv1MessageLengthChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv1MessageLengthCounter().msg() + } + + if value == PatternFlowGtpv1MessageLengthChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv1MessageLengthCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1MessageLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv1MessageLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1MessageLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv1MessageLength object +func (obj *patternFlowGtpv1MessageLength) SetValue(value uint32) PatternFlowGtpv1MessageLength { + obj.setChoice(PatternFlowGtpv1MessageLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv1MessageLength) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv1MessageLength object +func (obj *patternFlowGtpv1MessageLength) SetValues(value []uint32) PatternFlowGtpv1MessageLength { + obj.setChoice(PatternFlowGtpv1MessageLengthChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv1MessageLengthCounter +func (obj *patternFlowGtpv1MessageLength) Increment() PatternFlowGtpv1MessageLengthCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv1MessageLengthChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv1MessageLengthCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv1MessageLengthCounter +func (obj *patternFlowGtpv1MessageLength) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv1MessageLengthCounter value in the PatternFlowGtpv1MessageLength object +func (obj *patternFlowGtpv1MessageLength) SetIncrement(value PatternFlowGtpv1MessageLengthCounter) PatternFlowGtpv1MessageLength { + obj.setChoice(PatternFlowGtpv1MessageLengthChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1MessageLengthCounter +func (obj *patternFlowGtpv1MessageLength) Decrement() PatternFlowGtpv1MessageLengthCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv1MessageLengthChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv1MessageLengthCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1MessageLengthCounter +func (obj *patternFlowGtpv1MessageLength) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv1MessageLengthCounter value in the PatternFlowGtpv1MessageLength object +func (obj *patternFlowGtpv1MessageLength) SetDecrement(value PatternFlowGtpv1MessageLengthCounter) PatternFlowGtpv1MessageLength { + obj.setChoice(PatternFlowGtpv1MessageLengthChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv1MessageLengthMetricTag +func (obj *patternFlowGtpv1MessageLength) MetricTags() PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv1MessageLengthMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter struct { + obj *patternFlowGtpv1MessageLength + patternFlowGtpv1MessageLengthMetricTagSlice []PatternFlowGtpv1MessageLengthMetricTag + fieldPtr *[]*otg.PatternFlowGtpv1MessageLengthMetricTag +} + +func newPatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter(ptr *[]*otg.PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { + return &patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter interface { + setMsg(*patternFlowGtpv1MessageLength) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter + Items() []PatternFlowGtpv1MessageLengthMetricTag + Add() PatternFlowGtpv1MessageLengthMetricTag + Append(items ...PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter + Set(index int, newObj PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter + Clear() PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter + clearHolderSlice() PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter + appendHolderSlice(item PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter +} + +func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) setMsg(msg *patternFlowGtpv1MessageLength) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv1MessageLengthMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) Items() []PatternFlowGtpv1MessageLengthMetricTag { + return obj.patternFlowGtpv1MessageLengthMetricTagSlice +} + +func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) Add() PatternFlowGtpv1MessageLengthMetricTag { + newObj := &otg.PatternFlowGtpv1MessageLengthMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv1MessageLengthMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv1MessageLengthMetricTagSlice = append(obj.patternFlowGtpv1MessageLengthMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) Append(items ...PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv1MessageLengthMetricTagSlice = append(obj.patternFlowGtpv1MessageLengthMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) Set(index int, newObj PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv1MessageLengthMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) Clear() PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv1MessageLengthMetricTag{} + obj.patternFlowGtpv1MessageLengthMetricTagSlice = []PatternFlowGtpv1MessageLengthMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) clearHolderSlice() PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { + if len(obj.patternFlowGtpv1MessageLengthMetricTagSlice) > 0 { + obj.patternFlowGtpv1MessageLengthMetricTagSlice = []PatternFlowGtpv1MessageLengthMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter) appendHolderSlice(item PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthPatternFlowGtpv1MessageLengthMetricTagIter { + obj.patternFlowGtpv1MessageLengthMetricTagSlice = append(obj.patternFlowGtpv1MessageLengthMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv1MessageLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1MessageLength.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv1MessageLength.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv1MessageLengthMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv1MessageLength) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv1MessageLengthChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv1MessageLengthChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv1MessageLengthChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv1MessageLengthChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv1MessageLengthChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv1MessageLengthChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1MessageLength") + } + } else { + intVal := otg.PatternFlowGtpv1MessageLength_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv1MessageLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_message_length_counter.go b/gosnappi/pattern_flow_gtpv1_message_length_counter.go new file mode 100644 index 00000000..b935ab36 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_message_length_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv1MessageLengthCounter ***** +type patternFlowGtpv1MessageLengthCounter struct { + validation + obj *otg.PatternFlowGtpv1MessageLengthCounter + marshaller marshalPatternFlowGtpv1MessageLengthCounter + unMarshaller unMarshalPatternFlowGtpv1MessageLengthCounter +} + +func NewPatternFlowGtpv1MessageLengthCounter() PatternFlowGtpv1MessageLengthCounter { + obj := patternFlowGtpv1MessageLengthCounter{obj: &otg.PatternFlowGtpv1MessageLengthCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1MessageLengthCounter) msg() *otg.PatternFlowGtpv1MessageLengthCounter { + return obj.obj +} + +func (obj *patternFlowGtpv1MessageLengthCounter) setMsg(msg *otg.PatternFlowGtpv1MessageLengthCounter) PatternFlowGtpv1MessageLengthCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1MessageLengthCounter struct { + obj *patternFlowGtpv1MessageLengthCounter +} + +type marshalPatternFlowGtpv1MessageLengthCounter interface { + // ToProto marshals PatternFlowGtpv1MessageLengthCounter to protobuf object *otg.PatternFlowGtpv1MessageLengthCounter + ToProto() (*otg.PatternFlowGtpv1MessageLengthCounter, error) + // ToPbText marshals PatternFlowGtpv1MessageLengthCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1MessageLengthCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1MessageLengthCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1MessageLengthCounter struct { + obj *patternFlowGtpv1MessageLengthCounter +} + +type unMarshalPatternFlowGtpv1MessageLengthCounter interface { + // FromProto unmarshals PatternFlowGtpv1MessageLengthCounter from protobuf object *otg.PatternFlowGtpv1MessageLengthCounter + FromProto(msg *otg.PatternFlowGtpv1MessageLengthCounter) (PatternFlowGtpv1MessageLengthCounter, error) + // FromPbText unmarshals PatternFlowGtpv1MessageLengthCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1MessageLengthCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1MessageLengthCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1MessageLengthCounter) Marshal() marshalPatternFlowGtpv1MessageLengthCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1MessageLengthCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1MessageLengthCounter) Unmarshal() unMarshalPatternFlowGtpv1MessageLengthCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1MessageLengthCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1MessageLengthCounter) ToProto() (*otg.PatternFlowGtpv1MessageLengthCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1MessageLengthCounter) FromProto(msg *otg.PatternFlowGtpv1MessageLengthCounter) (PatternFlowGtpv1MessageLengthCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1MessageLengthCounter) 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 *unMarshalpatternFlowGtpv1MessageLengthCounter) 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 *marshalpatternFlowGtpv1MessageLengthCounter) 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 *unMarshalpatternFlowGtpv1MessageLengthCounter) 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 *marshalpatternFlowGtpv1MessageLengthCounter) 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 *unMarshalpatternFlowGtpv1MessageLengthCounter) 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 *patternFlowGtpv1MessageLengthCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1MessageLengthCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1MessageLengthCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1MessageLengthCounter) Clone() (PatternFlowGtpv1MessageLengthCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1MessageLengthCounter() + 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 +} + +// PatternFlowGtpv1MessageLengthCounter is integer counter pattern +type PatternFlowGtpv1MessageLengthCounter interface { + Validation + // msg marshals PatternFlowGtpv1MessageLengthCounter to protobuf object *otg.PatternFlowGtpv1MessageLengthCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1MessageLengthCounter + // setMsg unmarshals PatternFlowGtpv1MessageLengthCounter from protobuf object *otg.PatternFlowGtpv1MessageLengthCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1MessageLengthCounter) PatternFlowGtpv1MessageLengthCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv1MessageLengthCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1MessageLengthCounter + // validate validates PatternFlowGtpv1MessageLengthCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1MessageLengthCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv1MessageLengthCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv1MessageLengthCounter + SetStart(value uint32) PatternFlowGtpv1MessageLengthCounter + // HasStart checks if Start has been set in PatternFlowGtpv1MessageLengthCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv1MessageLengthCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv1MessageLengthCounter + SetStep(value uint32) PatternFlowGtpv1MessageLengthCounter + // HasStep checks if Step has been set in PatternFlowGtpv1MessageLengthCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv1MessageLengthCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv1MessageLengthCounter + SetCount(value uint32) PatternFlowGtpv1MessageLengthCounter + // HasCount checks if Count has been set in PatternFlowGtpv1MessageLengthCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1MessageLengthCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1MessageLengthCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv1MessageLengthCounter object +func (obj *patternFlowGtpv1MessageLengthCounter) SetStart(value uint32) PatternFlowGtpv1MessageLengthCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1MessageLengthCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1MessageLengthCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv1MessageLengthCounter object +func (obj *patternFlowGtpv1MessageLengthCounter) SetStep(value uint32) PatternFlowGtpv1MessageLengthCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1MessageLengthCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1MessageLengthCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv1MessageLengthCounter object +func (obj *patternFlowGtpv1MessageLengthCounter) SetCount(value uint32) PatternFlowGtpv1MessageLengthCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv1MessageLengthCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1MessageLengthCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1MessageLengthCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1MessageLengthCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv1MessageLengthCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_message_length_metric_tag.go b/gosnappi/pattern_flow_gtpv1_message_length_metric_tag.go new file mode 100644 index 00000000..e85ade64 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_message_length_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv1MessageLengthMetricTag ***** +type patternFlowGtpv1MessageLengthMetricTag struct { + validation + obj *otg.PatternFlowGtpv1MessageLengthMetricTag + marshaller marshalPatternFlowGtpv1MessageLengthMetricTag + unMarshaller unMarshalPatternFlowGtpv1MessageLengthMetricTag +} + +func NewPatternFlowGtpv1MessageLengthMetricTag() PatternFlowGtpv1MessageLengthMetricTag { + obj := patternFlowGtpv1MessageLengthMetricTag{obj: &otg.PatternFlowGtpv1MessageLengthMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1MessageLengthMetricTag) msg() *otg.PatternFlowGtpv1MessageLengthMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv1MessageLengthMetricTag) setMsg(msg *otg.PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1MessageLengthMetricTag struct { + obj *patternFlowGtpv1MessageLengthMetricTag +} + +type marshalPatternFlowGtpv1MessageLengthMetricTag interface { + // ToProto marshals PatternFlowGtpv1MessageLengthMetricTag to protobuf object *otg.PatternFlowGtpv1MessageLengthMetricTag + ToProto() (*otg.PatternFlowGtpv1MessageLengthMetricTag, error) + // ToPbText marshals PatternFlowGtpv1MessageLengthMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1MessageLengthMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1MessageLengthMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1MessageLengthMetricTag struct { + obj *patternFlowGtpv1MessageLengthMetricTag +} + +type unMarshalPatternFlowGtpv1MessageLengthMetricTag interface { + // FromProto unmarshals PatternFlowGtpv1MessageLengthMetricTag from protobuf object *otg.PatternFlowGtpv1MessageLengthMetricTag + FromProto(msg *otg.PatternFlowGtpv1MessageLengthMetricTag) (PatternFlowGtpv1MessageLengthMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv1MessageLengthMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1MessageLengthMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1MessageLengthMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1MessageLengthMetricTag) Marshal() marshalPatternFlowGtpv1MessageLengthMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1MessageLengthMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1MessageLengthMetricTag) Unmarshal() unMarshalPatternFlowGtpv1MessageLengthMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1MessageLengthMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1MessageLengthMetricTag) ToProto() (*otg.PatternFlowGtpv1MessageLengthMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1MessageLengthMetricTag) FromProto(msg *otg.PatternFlowGtpv1MessageLengthMetricTag) (PatternFlowGtpv1MessageLengthMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1MessageLengthMetricTag) 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 *unMarshalpatternFlowGtpv1MessageLengthMetricTag) 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 *marshalpatternFlowGtpv1MessageLengthMetricTag) 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 *unMarshalpatternFlowGtpv1MessageLengthMetricTag) 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 *marshalpatternFlowGtpv1MessageLengthMetricTag) 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 *unMarshalpatternFlowGtpv1MessageLengthMetricTag) 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 *patternFlowGtpv1MessageLengthMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1MessageLengthMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1MessageLengthMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1MessageLengthMetricTag) Clone() (PatternFlowGtpv1MessageLengthMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1MessageLengthMetricTag() + 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 +} + +// PatternFlowGtpv1MessageLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv1MessageLengthMetricTag interface { + Validation + // msg marshals PatternFlowGtpv1MessageLengthMetricTag to protobuf object *otg.PatternFlowGtpv1MessageLengthMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1MessageLengthMetricTag + // setMsg unmarshals PatternFlowGtpv1MessageLengthMetricTag from protobuf object *otg.PatternFlowGtpv1MessageLengthMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1MessageLengthMetricTag) PatternFlowGtpv1MessageLengthMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1MessageLengthMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1MessageLengthMetricTag + // validate validates PatternFlowGtpv1MessageLengthMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1MessageLengthMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv1MessageLengthMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv1MessageLengthMetricTag + SetName(value string) PatternFlowGtpv1MessageLengthMetricTag + // Offset returns uint32, set in PatternFlowGtpv1MessageLengthMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv1MessageLengthMetricTag + SetOffset(value uint32) PatternFlowGtpv1MessageLengthMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv1MessageLengthMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv1MessageLengthMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv1MessageLengthMetricTag + SetLength(value uint32) PatternFlowGtpv1MessageLengthMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv1MessageLengthMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv1MessageLengthMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv1MessageLengthMetricTag object +func (obj *patternFlowGtpv1MessageLengthMetricTag) SetName(value string) PatternFlowGtpv1MessageLengthMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1MessageLengthMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1MessageLengthMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv1MessageLengthMetricTag object +func (obj *patternFlowGtpv1MessageLengthMetricTag) SetOffset(value uint32) PatternFlowGtpv1MessageLengthMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1MessageLengthMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1MessageLengthMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv1MessageLengthMetricTag object +func (obj *patternFlowGtpv1MessageLengthMetricTag) SetLength(value uint32) PatternFlowGtpv1MessageLengthMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv1MessageLengthMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1MessageLengthMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1MessageLengthMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv1MessageLengthMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv1MessageLengthMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_message_type.go b/gosnappi/pattern_flow_gtpv1_message_type.go new file mode 100644 index 00000000..12fd003e --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_message_type.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv1MessageType ***** +type patternFlowGtpv1MessageType struct { + validation + obj *otg.PatternFlowGtpv1MessageType + marshaller marshalPatternFlowGtpv1MessageType + unMarshaller unMarshalPatternFlowGtpv1MessageType + incrementHolder PatternFlowGtpv1MessageTypeCounter + decrementHolder PatternFlowGtpv1MessageTypeCounter + metricTagsHolder PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter +} + +func NewPatternFlowGtpv1MessageType() PatternFlowGtpv1MessageType { + obj := patternFlowGtpv1MessageType{obj: &otg.PatternFlowGtpv1MessageType{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1MessageType) msg() *otg.PatternFlowGtpv1MessageType { + return obj.obj +} + +func (obj *patternFlowGtpv1MessageType) setMsg(msg *otg.PatternFlowGtpv1MessageType) PatternFlowGtpv1MessageType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1MessageType struct { + obj *patternFlowGtpv1MessageType +} + +type marshalPatternFlowGtpv1MessageType interface { + // ToProto marshals PatternFlowGtpv1MessageType to protobuf object *otg.PatternFlowGtpv1MessageType + ToProto() (*otg.PatternFlowGtpv1MessageType, error) + // ToPbText marshals PatternFlowGtpv1MessageType to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1MessageType to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1MessageType to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1MessageType struct { + obj *patternFlowGtpv1MessageType +} + +type unMarshalPatternFlowGtpv1MessageType interface { + // FromProto unmarshals PatternFlowGtpv1MessageType from protobuf object *otg.PatternFlowGtpv1MessageType + FromProto(msg *otg.PatternFlowGtpv1MessageType) (PatternFlowGtpv1MessageType, error) + // FromPbText unmarshals PatternFlowGtpv1MessageType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1MessageType from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1MessageType from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1MessageType) Marshal() marshalPatternFlowGtpv1MessageType { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1MessageType{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1MessageType) Unmarshal() unMarshalPatternFlowGtpv1MessageType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1MessageType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1MessageType) ToProto() (*otg.PatternFlowGtpv1MessageType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1MessageType) FromProto(msg *otg.PatternFlowGtpv1MessageType) (PatternFlowGtpv1MessageType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1MessageType) 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 *unMarshalpatternFlowGtpv1MessageType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv1MessageType) 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 *unMarshalpatternFlowGtpv1MessageType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv1MessageType) 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 *unMarshalpatternFlowGtpv1MessageType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv1MessageType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1MessageType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1MessageType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1MessageType) Clone() (PatternFlowGtpv1MessageType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1MessageType() + 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 +} + +func (obj *patternFlowGtpv1MessageType) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv1MessageType is the type of GTP message Different types of messages are defined in 3GPP TS 29.060 section 7.1 +type PatternFlowGtpv1MessageType interface { + Validation + // msg marshals PatternFlowGtpv1MessageType to protobuf object *otg.PatternFlowGtpv1MessageType + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1MessageType + // setMsg unmarshals PatternFlowGtpv1MessageType from protobuf object *otg.PatternFlowGtpv1MessageType + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1MessageType) PatternFlowGtpv1MessageType + // provides marshal interface + Marshal() marshalPatternFlowGtpv1MessageType + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1MessageType + // validate validates PatternFlowGtpv1MessageType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1MessageType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv1MessageTypeChoiceEnum, set in PatternFlowGtpv1MessageType + Choice() PatternFlowGtpv1MessageTypeChoiceEnum + // setChoice assigns PatternFlowGtpv1MessageTypeChoiceEnum provided by user to PatternFlowGtpv1MessageType + setChoice(value PatternFlowGtpv1MessageTypeChoiceEnum) PatternFlowGtpv1MessageType + // HasChoice checks if Choice has been set in PatternFlowGtpv1MessageType + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv1MessageType. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv1MessageType + SetValue(value uint32) PatternFlowGtpv1MessageType + // HasValue checks if Value has been set in PatternFlowGtpv1MessageType + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv1MessageType. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv1MessageType + SetValues(value []uint32) PatternFlowGtpv1MessageType + // Increment returns PatternFlowGtpv1MessageTypeCounter, set in PatternFlowGtpv1MessageType. + // PatternFlowGtpv1MessageTypeCounter is integer counter pattern + Increment() PatternFlowGtpv1MessageTypeCounter + // SetIncrement assigns PatternFlowGtpv1MessageTypeCounter provided by user to PatternFlowGtpv1MessageType. + // PatternFlowGtpv1MessageTypeCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv1MessageTypeCounter) PatternFlowGtpv1MessageType + // HasIncrement checks if Increment has been set in PatternFlowGtpv1MessageType + HasIncrement() bool + // Decrement returns PatternFlowGtpv1MessageTypeCounter, set in PatternFlowGtpv1MessageType. + // PatternFlowGtpv1MessageTypeCounter is integer counter pattern + Decrement() PatternFlowGtpv1MessageTypeCounter + // SetDecrement assigns PatternFlowGtpv1MessageTypeCounter provided by user to PatternFlowGtpv1MessageType. + // PatternFlowGtpv1MessageTypeCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv1MessageTypeCounter) PatternFlowGtpv1MessageType + // HasDecrement checks if Decrement has been set in PatternFlowGtpv1MessageType + HasDecrement() bool + // MetricTags returns PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIterIter, set in PatternFlowGtpv1MessageType + MetricTags() PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter + setNil() +} + +type PatternFlowGtpv1MessageTypeChoiceEnum string + +// Enum of Choice on PatternFlowGtpv1MessageType +var PatternFlowGtpv1MessageTypeChoice = struct { + VALUE PatternFlowGtpv1MessageTypeChoiceEnum + VALUES PatternFlowGtpv1MessageTypeChoiceEnum + INCREMENT PatternFlowGtpv1MessageTypeChoiceEnum + DECREMENT PatternFlowGtpv1MessageTypeChoiceEnum +}{ + VALUE: PatternFlowGtpv1MessageTypeChoiceEnum("value"), + VALUES: PatternFlowGtpv1MessageTypeChoiceEnum("values"), + INCREMENT: PatternFlowGtpv1MessageTypeChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv1MessageTypeChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv1MessageType) Choice() PatternFlowGtpv1MessageTypeChoiceEnum { + return PatternFlowGtpv1MessageTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv1MessageType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv1MessageType) setChoice(value PatternFlowGtpv1MessageTypeChoiceEnum) PatternFlowGtpv1MessageType { + intValue, ok := otg.PatternFlowGtpv1MessageType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv1MessageTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv1MessageType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv1MessageTypeChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv1MessageTypeChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv1MessageTypeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv1MessageTypeCounter().msg() + } + + if value == PatternFlowGtpv1MessageTypeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv1MessageTypeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1MessageType) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv1MessageTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1MessageType) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv1MessageType object +func (obj *patternFlowGtpv1MessageType) SetValue(value uint32) PatternFlowGtpv1MessageType { + obj.setChoice(PatternFlowGtpv1MessageTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv1MessageType) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv1MessageType object +func (obj *patternFlowGtpv1MessageType) SetValues(value []uint32) PatternFlowGtpv1MessageType { + obj.setChoice(PatternFlowGtpv1MessageTypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv1MessageTypeCounter +func (obj *patternFlowGtpv1MessageType) Increment() PatternFlowGtpv1MessageTypeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv1MessageTypeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv1MessageTypeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv1MessageTypeCounter +func (obj *patternFlowGtpv1MessageType) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv1MessageTypeCounter value in the PatternFlowGtpv1MessageType object +func (obj *patternFlowGtpv1MessageType) SetIncrement(value PatternFlowGtpv1MessageTypeCounter) PatternFlowGtpv1MessageType { + obj.setChoice(PatternFlowGtpv1MessageTypeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1MessageTypeCounter +func (obj *patternFlowGtpv1MessageType) Decrement() PatternFlowGtpv1MessageTypeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv1MessageTypeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv1MessageTypeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1MessageTypeCounter +func (obj *patternFlowGtpv1MessageType) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv1MessageTypeCounter value in the PatternFlowGtpv1MessageType object +func (obj *patternFlowGtpv1MessageType) SetDecrement(value PatternFlowGtpv1MessageTypeCounter) PatternFlowGtpv1MessageType { + obj.setChoice(PatternFlowGtpv1MessageTypeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv1MessageTypeMetricTag +func (obj *patternFlowGtpv1MessageType) MetricTags() PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv1MessageTypeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter struct { + obj *patternFlowGtpv1MessageType + patternFlowGtpv1MessageTypeMetricTagSlice []PatternFlowGtpv1MessageTypeMetricTag + fieldPtr *[]*otg.PatternFlowGtpv1MessageTypeMetricTag +} + +func newPatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter(ptr *[]*otg.PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { + return &patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter interface { + setMsg(*patternFlowGtpv1MessageType) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter + Items() []PatternFlowGtpv1MessageTypeMetricTag + Add() PatternFlowGtpv1MessageTypeMetricTag + Append(items ...PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter + Set(index int, newObj PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter + Clear() PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter + clearHolderSlice() PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter + appendHolderSlice(item PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter +} + +func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) setMsg(msg *patternFlowGtpv1MessageType) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv1MessageTypeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) Items() []PatternFlowGtpv1MessageTypeMetricTag { + return obj.patternFlowGtpv1MessageTypeMetricTagSlice +} + +func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) Add() PatternFlowGtpv1MessageTypeMetricTag { + newObj := &otg.PatternFlowGtpv1MessageTypeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv1MessageTypeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv1MessageTypeMetricTagSlice = append(obj.patternFlowGtpv1MessageTypeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) Append(items ...PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv1MessageTypeMetricTagSlice = append(obj.patternFlowGtpv1MessageTypeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) Set(index int, newObj PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv1MessageTypeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) Clear() PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv1MessageTypeMetricTag{} + obj.patternFlowGtpv1MessageTypeMetricTagSlice = []PatternFlowGtpv1MessageTypeMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) clearHolderSlice() PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { + if len(obj.patternFlowGtpv1MessageTypeMetricTagSlice) > 0 { + obj.patternFlowGtpv1MessageTypeMetricTagSlice = []PatternFlowGtpv1MessageTypeMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter) appendHolderSlice(item PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypePatternFlowGtpv1MessageTypeMetricTagIter { + obj.patternFlowGtpv1MessageTypeMetricTagSlice = append(obj.patternFlowGtpv1MessageTypeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv1MessageType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1MessageType.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv1MessageType.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv1MessageTypeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv1MessageType) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv1MessageTypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv1MessageTypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv1MessageTypeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv1MessageTypeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv1MessageTypeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv1MessageTypeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1MessageType") + } + } else { + intVal := otg.PatternFlowGtpv1MessageType_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv1MessageType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_message_type_counter.go b/gosnappi/pattern_flow_gtpv1_message_type_counter.go new file mode 100644 index 00000000..7a1fb026 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_message_type_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv1MessageTypeCounter ***** +type patternFlowGtpv1MessageTypeCounter struct { + validation + obj *otg.PatternFlowGtpv1MessageTypeCounter + marshaller marshalPatternFlowGtpv1MessageTypeCounter + unMarshaller unMarshalPatternFlowGtpv1MessageTypeCounter +} + +func NewPatternFlowGtpv1MessageTypeCounter() PatternFlowGtpv1MessageTypeCounter { + obj := patternFlowGtpv1MessageTypeCounter{obj: &otg.PatternFlowGtpv1MessageTypeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1MessageTypeCounter) msg() *otg.PatternFlowGtpv1MessageTypeCounter { + return obj.obj +} + +func (obj *patternFlowGtpv1MessageTypeCounter) setMsg(msg *otg.PatternFlowGtpv1MessageTypeCounter) PatternFlowGtpv1MessageTypeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1MessageTypeCounter struct { + obj *patternFlowGtpv1MessageTypeCounter +} + +type marshalPatternFlowGtpv1MessageTypeCounter interface { + // ToProto marshals PatternFlowGtpv1MessageTypeCounter to protobuf object *otg.PatternFlowGtpv1MessageTypeCounter + ToProto() (*otg.PatternFlowGtpv1MessageTypeCounter, error) + // ToPbText marshals PatternFlowGtpv1MessageTypeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1MessageTypeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1MessageTypeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1MessageTypeCounter struct { + obj *patternFlowGtpv1MessageTypeCounter +} + +type unMarshalPatternFlowGtpv1MessageTypeCounter interface { + // FromProto unmarshals PatternFlowGtpv1MessageTypeCounter from protobuf object *otg.PatternFlowGtpv1MessageTypeCounter + FromProto(msg *otg.PatternFlowGtpv1MessageTypeCounter) (PatternFlowGtpv1MessageTypeCounter, error) + // FromPbText unmarshals PatternFlowGtpv1MessageTypeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1MessageTypeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1MessageTypeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1MessageTypeCounter) Marshal() marshalPatternFlowGtpv1MessageTypeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1MessageTypeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1MessageTypeCounter) Unmarshal() unMarshalPatternFlowGtpv1MessageTypeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1MessageTypeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1MessageTypeCounter) ToProto() (*otg.PatternFlowGtpv1MessageTypeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1MessageTypeCounter) FromProto(msg *otg.PatternFlowGtpv1MessageTypeCounter) (PatternFlowGtpv1MessageTypeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1MessageTypeCounter) 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 *unMarshalpatternFlowGtpv1MessageTypeCounter) 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 *marshalpatternFlowGtpv1MessageTypeCounter) 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 *unMarshalpatternFlowGtpv1MessageTypeCounter) 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 *marshalpatternFlowGtpv1MessageTypeCounter) 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 *unMarshalpatternFlowGtpv1MessageTypeCounter) 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 *patternFlowGtpv1MessageTypeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1MessageTypeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1MessageTypeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1MessageTypeCounter) Clone() (PatternFlowGtpv1MessageTypeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1MessageTypeCounter() + 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 +} + +// PatternFlowGtpv1MessageTypeCounter is integer counter pattern +type PatternFlowGtpv1MessageTypeCounter interface { + Validation + // msg marshals PatternFlowGtpv1MessageTypeCounter to protobuf object *otg.PatternFlowGtpv1MessageTypeCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1MessageTypeCounter + // setMsg unmarshals PatternFlowGtpv1MessageTypeCounter from protobuf object *otg.PatternFlowGtpv1MessageTypeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1MessageTypeCounter) PatternFlowGtpv1MessageTypeCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv1MessageTypeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1MessageTypeCounter + // validate validates PatternFlowGtpv1MessageTypeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1MessageTypeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv1MessageTypeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv1MessageTypeCounter + SetStart(value uint32) PatternFlowGtpv1MessageTypeCounter + // HasStart checks if Start has been set in PatternFlowGtpv1MessageTypeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv1MessageTypeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv1MessageTypeCounter + SetStep(value uint32) PatternFlowGtpv1MessageTypeCounter + // HasStep checks if Step has been set in PatternFlowGtpv1MessageTypeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv1MessageTypeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv1MessageTypeCounter + SetCount(value uint32) PatternFlowGtpv1MessageTypeCounter + // HasCount checks if Count has been set in PatternFlowGtpv1MessageTypeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1MessageTypeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1MessageTypeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv1MessageTypeCounter object +func (obj *patternFlowGtpv1MessageTypeCounter) SetStart(value uint32) PatternFlowGtpv1MessageTypeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1MessageTypeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1MessageTypeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv1MessageTypeCounter object +func (obj *patternFlowGtpv1MessageTypeCounter) SetStep(value uint32) PatternFlowGtpv1MessageTypeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1MessageTypeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1MessageTypeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv1MessageTypeCounter object +func (obj *patternFlowGtpv1MessageTypeCounter) SetCount(value uint32) PatternFlowGtpv1MessageTypeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv1MessageTypeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1MessageTypeCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1MessageTypeCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1MessageTypeCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv1MessageTypeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_message_type_metric_tag.go b/gosnappi/pattern_flow_gtpv1_message_type_metric_tag.go new file mode 100644 index 00000000..6920c70d --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_message_type_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv1MessageTypeMetricTag ***** +type patternFlowGtpv1MessageTypeMetricTag struct { + validation + obj *otg.PatternFlowGtpv1MessageTypeMetricTag + marshaller marshalPatternFlowGtpv1MessageTypeMetricTag + unMarshaller unMarshalPatternFlowGtpv1MessageTypeMetricTag +} + +func NewPatternFlowGtpv1MessageTypeMetricTag() PatternFlowGtpv1MessageTypeMetricTag { + obj := patternFlowGtpv1MessageTypeMetricTag{obj: &otg.PatternFlowGtpv1MessageTypeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1MessageTypeMetricTag) msg() *otg.PatternFlowGtpv1MessageTypeMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv1MessageTypeMetricTag) setMsg(msg *otg.PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1MessageTypeMetricTag struct { + obj *patternFlowGtpv1MessageTypeMetricTag +} + +type marshalPatternFlowGtpv1MessageTypeMetricTag interface { + // ToProto marshals PatternFlowGtpv1MessageTypeMetricTag to protobuf object *otg.PatternFlowGtpv1MessageTypeMetricTag + ToProto() (*otg.PatternFlowGtpv1MessageTypeMetricTag, error) + // ToPbText marshals PatternFlowGtpv1MessageTypeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1MessageTypeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1MessageTypeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1MessageTypeMetricTag struct { + obj *patternFlowGtpv1MessageTypeMetricTag +} + +type unMarshalPatternFlowGtpv1MessageTypeMetricTag interface { + // FromProto unmarshals PatternFlowGtpv1MessageTypeMetricTag from protobuf object *otg.PatternFlowGtpv1MessageTypeMetricTag + FromProto(msg *otg.PatternFlowGtpv1MessageTypeMetricTag) (PatternFlowGtpv1MessageTypeMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv1MessageTypeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1MessageTypeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1MessageTypeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1MessageTypeMetricTag) Marshal() marshalPatternFlowGtpv1MessageTypeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1MessageTypeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1MessageTypeMetricTag) Unmarshal() unMarshalPatternFlowGtpv1MessageTypeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1MessageTypeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1MessageTypeMetricTag) ToProto() (*otg.PatternFlowGtpv1MessageTypeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1MessageTypeMetricTag) FromProto(msg *otg.PatternFlowGtpv1MessageTypeMetricTag) (PatternFlowGtpv1MessageTypeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1MessageTypeMetricTag) 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 *unMarshalpatternFlowGtpv1MessageTypeMetricTag) 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 *marshalpatternFlowGtpv1MessageTypeMetricTag) 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 *unMarshalpatternFlowGtpv1MessageTypeMetricTag) 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 *marshalpatternFlowGtpv1MessageTypeMetricTag) 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 *unMarshalpatternFlowGtpv1MessageTypeMetricTag) 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 *patternFlowGtpv1MessageTypeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1MessageTypeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1MessageTypeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1MessageTypeMetricTag) Clone() (PatternFlowGtpv1MessageTypeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1MessageTypeMetricTag() + 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 +} + +// PatternFlowGtpv1MessageTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv1MessageTypeMetricTag interface { + Validation + // msg marshals PatternFlowGtpv1MessageTypeMetricTag to protobuf object *otg.PatternFlowGtpv1MessageTypeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1MessageTypeMetricTag + // setMsg unmarshals PatternFlowGtpv1MessageTypeMetricTag from protobuf object *otg.PatternFlowGtpv1MessageTypeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1MessageTypeMetricTag) PatternFlowGtpv1MessageTypeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1MessageTypeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1MessageTypeMetricTag + // validate validates PatternFlowGtpv1MessageTypeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1MessageTypeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv1MessageTypeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv1MessageTypeMetricTag + SetName(value string) PatternFlowGtpv1MessageTypeMetricTag + // Offset returns uint32, set in PatternFlowGtpv1MessageTypeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv1MessageTypeMetricTag + SetOffset(value uint32) PatternFlowGtpv1MessageTypeMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv1MessageTypeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv1MessageTypeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv1MessageTypeMetricTag + SetLength(value uint32) PatternFlowGtpv1MessageTypeMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv1MessageTypeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv1MessageTypeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv1MessageTypeMetricTag object +func (obj *patternFlowGtpv1MessageTypeMetricTag) SetName(value string) PatternFlowGtpv1MessageTypeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1MessageTypeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1MessageTypeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv1MessageTypeMetricTag object +func (obj *patternFlowGtpv1MessageTypeMetricTag) SetOffset(value uint32) PatternFlowGtpv1MessageTypeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1MessageTypeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1MessageTypeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv1MessageTypeMetricTag object +func (obj *patternFlowGtpv1MessageTypeMetricTag) SetLength(value uint32) PatternFlowGtpv1MessageTypeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv1MessageTypeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1MessageTypeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1MessageTypeMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv1MessageTypeMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv1MessageTypeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_n_pdu_number.go b/gosnappi/pattern_flow_gtpv1_n_pdu_number.go new file mode 100644 index 00000000..a006f386 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_n_pdu_number.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv1NPduNumber ***** +type patternFlowGtpv1NPduNumber struct { + validation + obj *otg.PatternFlowGtpv1NPduNumber + marshaller marshalPatternFlowGtpv1NPduNumber + unMarshaller unMarshalPatternFlowGtpv1NPduNumber + incrementHolder PatternFlowGtpv1NPduNumberCounter + decrementHolder PatternFlowGtpv1NPduNumberCounter + metricTagsHolder PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter +} + +func NewPatternFlowGtpv1NPduNumber() PatternFlowGtpv1NPduNumber { + obj := patternFlowGtpv1NPduNumber{obj: &otg.PatternFlowGtpv1NPduNumber{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1NPduNumber) msg() *otg.PatternFlowGtpv1NPduNumber { + return obj.obj +} + +func (obj *patternFlowGtpv1NPduNumber) setMsg(msg *otg.PatternFlowGtpv1NPduNumber) PatternFlowGtpv1NPduNumber { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1NPduNumber struct { + obj *patternFlowGtpv1NPduNumber +} + +type marshalPatternFlowGtpv1NPduNumber interface { + // ToProto marshals PatternFlowGtpv1NPduNumber to protobuf object *otg.PatternFlowGtpv1NPduNumber + ToProto() (*otg.PatternFlowGtpv1NPduNumber, error) + // ToPbText marshals PatternFlowGtpv1NPduNumber to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1NPduNumber to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1NPduNumber to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1NPduNumber struct { + obj *patternFlowGtpv1NPduNumber +} + +type unMarshalPatternFlowGtpv1NPduNumber interface { + // FromProto unmarshals PatternFlowGtpv1NPduNumber from protobuf object *otg.PatternFlowGtpv1NPduNumber + FromProto(msg *otg.PatternFlowGtpv1NPduNumber) (PatternFlowGtpv1NPduNumber, error) + // FromPbText unmarshals PatternFlowGtpv1NPduNumber from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1NPduNumber from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1NPduNumber from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1NPduNumber) Marshal() marshalPatternFlowGtpv1NPduNumber { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1NPduNumber{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1NPduNumber) Unmarshal() unMarshalPatternFlowGtpv1NPduNumber { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1NPduNumber{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1NPduNumber) ToProto() (*otg.PatternFlowGtpv1NPduNumber, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1NPduNumber) FromProto(msg *otg.PatternFlowGtpv1NPduNumber) (PatternFlowGtpv1NPduNumber, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1NPduNumber) 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 *unMarshalpatternFlowGtpv1NPduNumber) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv1NPduNumber) 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 *unMarshalpatternFlowGtpv1NPduNumber) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv1NPduNumber) 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 *unMarshalpatternFlowGtpv1NPduNumber) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv1NPduNumber) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1NPduNumber) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1NPduNumber) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1NPduNumber) Clone() (PatternFlowGtpv1NPduNumber, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1NPduNumber() + 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 +} + +func (obj *patternFlowGtpv1NPduNumber) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv1NPduNumber is n-PDU number. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the pn_flag bit is on. +type PatternFlowGtpv1NPduNumber interface { + Validation + // msg marshals PatternFlowGtpv1NPduNumber to protobuf object *otg.PatternFlowGtpv1NPduNumber + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1NPduNumber + // setMsg unmarshals PatternFlowGtpv1NPduNumber from protobuf object *otg.PatternFlowGtpv1NPduNumber + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1NPduNumber) PatternFlowGtpv1NPduNumber + // provides marshal interface + Marshal() marshalPatternFlowGtpv1NPduNumber + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1NPduNumber + // validate validates PatternFlowGtpv1NPduNumber + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1NPduNumber, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv1NPduNumberChoiceEnum, set in PatternFlowGtpv1NPduNumber + Choice() PatternFlowGtpv1NPduNumberChoiceEnum + // setChoice assigns PatternFlowGtpv1NPduNumberChoiceEnum provided by user to PatternFlowGtpv1NPduNumber + setChoice(value PatternFlowGtpv1NPduNumberChoiceEnum) PatternFlowGtpv1NPduNumber + // HasChoice checks if Choice has been set in PatternFlowGtpv1NPduNumber + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv1NPduNumber. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv1NPduNumber + SetValue(value uint32) PatternFlowGtpv1NPduNumber + // HasValue checks if Value has been set in PatternFlowGtpv1NPduNumber + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv1NPduNumber. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv1NPduNumber + SetValues(value []uint32) PatternFlowGtpv1NPduNumber + // Increment returns PatternFlowGtpv1NPduNumberCounter, set in PatternFlowGtpv1NPduNumber. + // PatternFlowGtpv1NPduNumberCounter is integer counter pattern + Increment() PatternFlowGtpv1NPduNumberCounter + // SetIncrement assigns PatternFlowGtpv1NPduNumberCounter provided by user to PatternFlowGtpv1NPduNumber. + // PatternFlowGtpv1NPduNumberCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv1NPduNumberCounter) PatternFlowGtpv1NPduNumber + // HasIncrement checks if Increment has been set in PatternFlowGtpv1NPduNumber + HasIncrement() bool + // Decrement returns PatternFlowGtpv1NPduNumberCounter, set in PatternFlowGtpv1NPduNumber. + // PatternFlowGtpv1NPduNumberCounter is integer counter pattern + Decrement() PatternFlowGtpv1NPduNumberCounter + // SetDecrement assigns PatternFlowGtpv1NPduNumberCounter provided by user to PatternFlowGtpv1NPduNumber. + // PatternFlowGtpv1NPduNumberCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv1NPduNumberCounter) PatternFlowGtpv1NPduNumber + // HasDecrement checks if Decrement has been set in PatternFlowGtpv1NPduNumber + HasDecrement() bool + // MetricTags returns PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIterIter, set in PatternFlowGtpv1NPduNumber + MetricTags() PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter + setNil() +} + +type PatternFlowGtpv1NPduNumberChoiceEnum string + +// Enum of Choice on PatternFlowGtpv1NPduNumber +var PatternFlowGtpv1NPduNumberChoice = struct { + VALUE PatternFlowGtpv1NPduNumberChoiceEnum + VALUES PatternFlowGtpv1NPduNumberChoiceEnum + INCREMENT PatternFlowGtpv1NPduNumberChoiceEnum + DECREMENT PatternFlowGtpv1NPduNumberChoiceEnum +}{ + VALUE: PatternFlowGtpv1NPduNumberChoiceEnum("value"), + VALUES: PatternFlowGtpv1NPduNumberChoiceEnum("values"), + INCREMENT: PatternFlowGtpv1NPduNumberChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv1NPduNumberChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv1NPduNumber) Choice() PatternFlowGtpv1NPduNumberChoiceEnum { + return PatternFlowGtpv1NPduNumberChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv1NPduNumber) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv1NPduNumber) setChoice(value PatternFlowGtpv1NPduNumberChoiceEnum) PatternFlowGtpv1NPduNumber { + intValue, ok := otg.PatternFlowGtpv1NPduNumber_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv1NPduNumberChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv1NPduNumber_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv1NPduNumberChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv1NPduNumberChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv1NPduNumberChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv1NPduNumberCounter().msg() + } + + if value == PatternFlowGtpv1NPduNumberChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv1NPduNumberCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1NPduNumber) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv1NPduNumberChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1NPduNumber) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv1NPduNumber object +func (obj *patternFlowGtpv1NPduNumber) SetValue(value uint32) PatternFlowGtpv1NPduNumber { + obj.setChoice(PatternFlowGtpv1NPduNumberChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv1NPduNumber) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv1NPduNumber object +func (obj *patternFlowGtpv1NPduNumber) SetValues(value []uint32) PatternFlowGtpv1NPduNumber { + obj.setChoice(PatternFlowGtpv1NPduNumberChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv1NPduNumberCounter +func (obj *patternFlowGtpv1NPduNumber) Increment() PatternFlowGtpv1NPduNumberCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv1NPduNumberChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv1NPduNumberCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv1NPduNumberCounter +func (obj *patternFlowGtpv1NPduNumber) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv1NPduNumberCounter value in the PatternFlowGtpv1NPduNumber object +func (obj *patternFlowGtpv1NPduNumber) SetIncrement(value PatternFlowGtpv1NPduNumberCounter) PatternFlowGtpv1NPduNumber { + obj.setChoice(PatternFlowGtpv1NPduNumberChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1NPduNumberCounter +func (obj *patternFlowGtpv1NPduNumber) Decrement() PatternFlowGtpv1NPduNumberCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv1NPduNumberChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv1NPduNumberCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1NPduNumberCounter +func (obj *patternFlowGtpv1NPduNumber) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv1NPduNumberCounter value in the PatternFlowGtpv1NPduNumber object +func (obj *patternFlowGtpv1NPduNumber) SetDecrement(value PatternFlowGtpv1NPduNumberCounter) PatternFlowGtpv1NPduNumber { + obj.setChoice(PatternFlowGtpv1NPduNumberChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv1NPduNumberMetricTag +func (obj *patternFlowGtpv1NPduNumber) MetricTags() PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv1NPduNumberMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter struct { + obj *patternFlowGtpv1NPduNumber + patternFlowGtpv1NPduNumberMetricTagSlice []PatternFlowGtpv1NPduNumberMetricTag + fieldPtr *[]*otg.PatternFlowGtpv1NPduNumberMetricTag +} + +func newPatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter(ptr *[]*otg.PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { + return &patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter interface { + setMsg(*patternFlowGtpv1NPduNumber) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter + Items() []PatternFlowGtpv1NPduNumberMetricTag + Add() PatternFlowGtpv1NPduNumberMetricTag + Append(items ...PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter + Set(index int, newObj PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter + Clear() PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter + clearHolderSlice() PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter + appendHolderSlice(item PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter +} + +func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) setMsg(msg *patternFlowGtpv1NPduNumber) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv1NPduNumberMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) Items() []PatternFlowGtpv1NPduNumberMetricTag { + return obj.patternFlowGtpv1NPduNumberMetricTagSlice +} + +func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) Add() PatternFlowGtpv1NPduNumberMetricTag { + newObj := &otg.PatternFlowGtpv1NPduNumberMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv1NPduNumberMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv1NPduNumberMetricTagSlice = append(obj.patternFlowGtpv1NPduNumberMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) Append(items ...PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv1NPduNumberMetricTagSlice = append(obj.patternFlowGtpv1NPduNumberMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) Set(index int, newObj PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv1NPduNumberMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) Clear() PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv1NPduNumberMetricTag{} + obj.patternFlowGtpv1NPduNumberMetricTagSlice = []PatternFlowGtpv1NPduNumberMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) clearHolderSlice() PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { + if len(obj.patternFlowGtpv1NPduNumberMetricTagSlice) > 0 { + obj.patternFlowGtpv1NPduNumberMetricTagSlice = []PatternFlowGtpv1NPduNumberMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter) appendHolderSlice(item PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberPatternFlowGtpv1NPduNumberMetricTagIter { + obj.patternFlowGtpv1NPduNumberMetricTagSlice = append(obj.patternFlowGtpv1NPduNumberMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv1NPduNumber) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1NPduNumber.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv1NPduNumber.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv1NPduNumberMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv1NPduNumber) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv1NPduNumberChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv1NPduNumberChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv1NPduNumberChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv1NPduNumberChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv1NPduNumberChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv1NPduNumberChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1NPduNumber") + } + } else { + intVal := otg.PatternFlowGtpv1NPduNumber_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv1NPduNumber_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_n_pdu_number_counter.go b/gosnappi/pattern_flow_gtpv1_n_pdu_number_counter.go new file mode 100644 index 00000000..435b2c6b --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_n_pdu_number_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv1NPduNumberCounter ***** +type patternFlowGtpv1NPduNumberCounter struct { + validation + obj *otg.PatternFlowGtpv1NPduNumberCounter + marshaller marshalPatternFlowGtpv1NPduNumberCounter + unMarshaller unMarshalPatternFlowGtpv1NPduNumberCounter +} + +func NewPatternFlowGtpv1NPduNumberCounter() PatternFlowGtpv1NPduNumberCounter { + obj := patternFlowGtpv1NPduNumberCounter{obj: &otg.PatternFlowGtpv1NPduNumberCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1NPduNumberCounter) msg() *otg.PatternFlowGtpv1NPduNumberCounter { + return obj.obj +} + +func (obj *patternFlowGtpv1NPduNumberCounter) setMsg(msg *otg.PatternFlowGtpv1NPduNumberCounter) PatternFlowGtpv1NPduNumberCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1NPduNumberCounter struct { + obj *patternFlowGtpv1NPduNumberCounter +} + +type marshalPatternFlowGtpv1NPduNumberCounter interface { + // ToProto marshals PatternFlowGtpv1NPduNumberCounter to protobuf object *otg.PatternFlowGtpv1NPduNumberCounter + ToProto() (*otg.PatternFlowGtpv1NPduNumberCounter, error) + // ToPbText marshals PatternFlowGtpv1NPduNumberCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1NPduNumberCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1NPduNumberCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1NPduNumberCounter struct { + obj *patternFlowGtpv1NPduNumberCounter +} + +type unMarshalPatternFlowGtpv1NPduNumberCounter interface { + // FromProto unmarshals PatternFlowGtpv1NPduNumberCounter from protobuf object *otg.PatternFlowGtpv1NPduNumberCounter + FromProto(msg *otg.PatternFlowGtpv1NPduNumberCounter) (PatternFlowGtpv1NPduNumberCounter, error) + // FromPbText unmarshals PatternFlowGtpv1NPduNumberCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1NPduNumberCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1NPduNumberCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1NPduNumberCounter) Marshal() marshalPatternFlowGtpv1NPduNumberCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1NPduNumberCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1NPduNumberCounter) Unmarshal() unMarshalPatternFlowGtpv1NPduNumberCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1NPduNumberCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1NPduNumberCounter) ToProto() (*otg.PatternFlowGtpv1NPduNumberCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1NPduNumberCounter) FromProto(msg *otg.PatternFlowGtpv1NPduNumberCounter) (PatternFlowGtpv1NPduNumberCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1NPduNumberCounter) 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 *unMarshalpatternFlowGtpv1NPduNumberCounter) 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 *marshalpatternFlowGtpv1NPduNumberCounter) 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 *unMarshalpatternFlowGtpv1NPduNumberCounter) 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 *marshalpatternFlowGtpv1NPduNumberCounter) 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 *unMarshalpatternFlowGtpv1NPduNumberCounter) 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 *patternFlowGtpv1NPduNumberCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1NPduNumberCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1NPduNumberCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1NPduNumberCounter) Clone() (PatternFlowGtpv1NPduNumberCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1NPduNumberCounter() + 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 +} + +// PatternFlowGtpv1NPduNumberCounter is integer counter pattern +type PatternFlowGtpv1NPduNumberCounter interface { + Validation + // msg marshals PatternFlowGtpv1NPduNumberCounter to protobuf object *otg.PatternFlowGtpv1NPduNumberCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1NPduNumberCounter + // setMsg unmarshals PatternFlowGtpv1NPduNumberCounter from protobuf object *otg.PatternFlowGtpv1NPduNumberCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1NPduNumberCounter) PatternFlowGtpv1NPduNumberCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv1NPduNumberCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1NPduNumberCounter + // validate validates PatternFlowGtpv1NPduNumberCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1NPduNumberCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv1NPduNumberCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv1NPduNumberCounter + SetStart(value uint32) PatternFlowGtpv1NPduNumberCounter + // HasStart checks if Start has been set in PatternFlowGtpv1NPduNumberCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv1NPduNumberCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv1NPduNumberCounter + SetStep(value uint32) PatternFlowGtpv1NPduNumberCounter + // HasStep checks if Step has been set in PatternFlowGtpv1NPduNumberCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv1NPduNumberCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv1NPduNumberCounter + SetCount(value uint32) PatternFlowGtpv1NPduNumberCounter + // HasCount checks if Count has been set in PatternFlowGtpv1NPduNumberCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1NPduNumberCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1NPduNumberCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv1NPduNumberCounter object +func (obj *patternFlowGtpv1NPduNumberCounter) SetStart(value uint32) PatternFlowGtpv1NPduNumberCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1NPduNumberCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1NPduNumberCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv1NPduNumberCounter object +func (obj *patternFlowGtpv1NPduNumberCounter) SetStep(value uint32) PatternFlowGtpv1NPduNumberCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1NPduNumberCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1NPduNumberCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv1NPduNumberCounter object +func (obj *patternFlowGtpv1NPduNumberCounter) SetCount(value uint32) PatternFlowGtpv1NPduNumberCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv1NPduNumberCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1NPduNumberCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1NPduNumberCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1NPduNumberCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv1NPduNumberCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_n_pdu_number_metric_tag.go b/gosnappi/pattern_flow_gtpv1_n_pdu_number_metric_tag.go new file mode 100644 index 00000000..f1447dab --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_n_pdu_number_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv1NPduNumberMetricTag ***** +type patternFlowGtpv1NPduNumberMetricTag struct { + validation + obj *otg.PatternFlowGtpv1NPduNumberMetricTag + marshaller marshalPatternFlowGtpv1NPduNumberMetricTag + unMarshaller unMarshalPatternFlowGtpv1NPduNumberMetricTag +} + +func NewPatternFlowGtpv1NPduNumberMetricTag() PatternFlowGtpv1NPduNumberMetricTag { + obj := patternFlowGtpv1NPduNumberMetricTag{obj: &otg.PatternFlowGtpv1NPduNumberMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1NPduNumberMetricTag) msg() *otg.PatternFlowGtpv1NPduNumberMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv1NPduNumberMetricTag) setMsg(msg *otg.PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1NPduNumberMetricTag struct { + obj *patternFlowGtpv1NPduNumberMetricTag +} + +type marshalPatternFlowGtpv1NPduNumberMetricTag interface { + // ToProto marshals PatternFlowGtpv1NPduNumberMetricTag to protobuf object *otg.PatternFlowGtpv1NPduNumberMetricTag + ToProto() (*otg.PatternFlowGtpv1NPduNumberMetricTag, error) + // ToPbText marshals PatternFlowGtpv1NPduNumberMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1NPduNumberMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1NPduNumberMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1NPduNumberMetricTag struct { + obj *patternFlowGtpv1NPduNumberMetricTag +} + +type unMarshalPatternFlowGtpv1NPduNumberMetricTag interface { + // FromProto unmarshals PatternFlowGtpv1NPduNumberMetricTag from protobuf object *otg.PatternFlowGtpv1NPduNumberMetricTag + FromProto(msg *otg.PatternFlowGtpv1NPduNumberMetricTag) (PatternFlowGtpv1NPduNumberMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv1NPduNumberMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1NPduNumberMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1NPduNumberMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1NPduNumberMetricTag) Marshal() marshalPatternFlowGtpv1NPduNumberMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1NPduNumberMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1NPduNumberMetricTag) Unmarshal() unMarshalPatternFlowGtpv1NPduNumberMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1NPduNumberMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1NPduNumberMetricTag) ToProto() (*otg.PatternFlowGtpv1NPduNumberMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1NPduNumberMetricTag) FromProto(msg *otg.PatternFlowGtpv1NPduNumberMetricTag) (PatternFlowGtpv1NPduNumberMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1NPduNumberMetricTag) 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 *unMarshalpatternFlowGtpv1NPduNumberMetricTag) 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 *marshalpatternFlowGtpv1NPduNumberMetricTag) 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 *unMarshalpatternFlowGtpv1NPduNumberMetricTag) 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 *marshalpatternFlowGtpv1NPduNumberMetricTag) 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 *unMarshalpatternFlowGtpv1NPduNumberMetricTag) 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 *patternFlowGtpv1NPduNumberMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1NPduNumberMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1NPduNumberMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1NPduNumberMetricTag) Clone() (PatternFlowGtpv1NPduNumberMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1NPduNumberMetricTag() + 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 +} + +// PatternFlowGtpv1NPduNumberMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv1NPduNumberMetricTag interface { + Validation + // msg marshals PatternFlowGtpv1NPduNumberMetricTag to protobuf object *otg.PatternFlowGtpv1NPduNumberMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1NPduNumberMetricTag + // setMsg unmarshals PatternFlowGtpv1NPduNumberMetricTag from protobuf object *otg.PatternFlowGtpv1NPduNumberMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1NPduNumberMetricTag) PatternFlowGtpv1NPduNumberMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1NPduNumberMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1NPduNumberMetricTag + // validate validates PatternFlowGtpv1NPduNumberMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1NPduNumberMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv1NPduNumberMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv1NPduNumberMetricTag + SetName(value string) PatternFlowGtpv1NPduNumberMetricTag + // Offset returns uint32, set in PatternFlowGtpv1NPduNumberMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv1NPduNumberMetricTag + SetOffset(value uint32) PatternFlowGtpv1NPduNumberMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv1NPduNumberMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv1NPduNumberMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv1NPduNumberMetricTag + SetLength(value uint32) PatternFlowGtpv1NPduNumberMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv1NPduNumberMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv1NPduNumberMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv1NPduNumberMetricTag object +func (obj *patternFlowGtpv1NPduNumberMetricTag) SetName(value string) PatternFlowGtpv1NPduNumberMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1NPduNumberMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1NPduNumberMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv1NPduNumberMetricTag object +func (obj *patternFlowGtpv1NPduNumberMetricTag) SetOffset(value uint32) PatternFlowGtpv1NPduNumberMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1NPduNumberMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1NPduNumberMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv1NPduNumberMetricTag object +func (obj *patternFlowGtpv1NPduNumberMetricTag) SetLength(value uint32) PatternFlowGtpv1NPduNumberMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv1NPduNumberMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1NPduNumberMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1NPduNumberMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv1NPduNumberMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv1NPduNumberMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_next_extension_header_type.go b/gosnappi/pattern_flow_gtpv1_next_extension_header_type.go new file mode 100644 index 00000000..a08f6e89 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_next_extension_header_type.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv1NextExtensionHeaderType ***** +type patternFlowGtpv1NextExtensionHeaderType struct { + validation + obj *otg.PatternFlowGtpv1NextExtensionHeaderType + marshaller marshalPatternFlowGtpv1NextExtensionHeaderType + unMarshaller unMarshalPatternFlowGtpv1NextExtensionHeaderType + incrementHolder PatternFlowGtpv1NextExtensionHeaderTypeCounter + decrementHolder PatternFlowGtpv1NextExtensionHeaderTypeCounter + metricTagsHolder PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter +} + +func NewPatternFlowGtpv1NextExtensionHeaderType() PatternFlowGtpv1NextExtensionHeaderType { + obj := patternFlowGtpv1NextExtensionHeaderType{obj: &otg.PatternFlowGtpv1NextExtensionHeaderType{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1NextExtensionHeaderType) msg() *otg.PatternFlowGtpv1NextExtensionHeaderType { + return obj.obj +} + +func (obj *patternFlowGtpv1NextExtensionHeaderType) setMsg(msg *otg.PatternFlowGtpv1NextExtensionHeaderType) PatternFlowGtpv1NextExtensionHeaderType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1NextExtensionHeaderType struct { + obj *patternFlowGtpv1NextExtensionHeaderType +} + +type marshalPatternFlowGtpv1NextExtensionHeaderType interface { + // ToProto marshals PatternFlowGtpv1NextExtensionHeaderType to protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderType + ToProto() (*otg.PatternFlowGtpv1NextExtensionHeaderType, error) + // ToPbText marshals PatternFlowGtpv1NextExtensionHeaderType to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1NextExtensionHeaderType to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1NextExtensionHeaderType to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1NextExtensionHeaderType struct { + obj *patternFlowGtpv1NextExtensionHeaderType +} + +type unMarshalPatternFlowGtpv1NextExtensionHeaderType interface { + // FromProto unmarshals PatternFlowGtpv1NextExtensionHeaderType from protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderType + FromProto(msg *otg.PatternFlowGtpv1NextExtensionHeaderType) (PatternFlowGtpv1NextExtensionHeaderType, error) + // FromPbText unmarshals PatternFlowGtpv1NextExtensionHeaderType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1NextExtensionHeaderType from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1NextExtensionHeaderType from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1NextExtensionHeaderType) Marshal() marshalPatternFlowGtpv1NextExtensionHeaderType { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1NextExtensionHeaderType{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1NextExtensionHeaderType) Unmarshal() unMarshalPatternFlowGtpv1NextExtensionHeaderType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1NextExtensionHeaderType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1NextExtensionHeaderType) ToProto() (*otg.PatternFlowGtpv1NextExtensionHeaderType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1NextExtensionHeaderType) FromProto(msg *otg.PatternFlowGtpv1NextExtensionHeaderType) (PatternFlowGtpv1NextExtensionHeaderType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1NextExtensionHeaderType) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv1NextExtensionHeaderType) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv1NextExtensionHeaderType) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv1NextExtensionHeaderType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1NextExtensionHeaderType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1NextExtensionHeaderType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1NextExtensionHeaderType) Clone() (PatternFlowGtpv1NextExtensionHeaderType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1NextExtensionHeaderType() + 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 +} + +func (obj *patternFlowGtpv1NextExtensionHeaderType) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv1NextExtensionHeaderType is next extension header. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the e_flag bit is on. +type PatternFlowGtpv1NextExtensionHeaderType interface { + Validation + // msg marshals PatternFlowGtpv1NextExtensionHeaderType to protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderType + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1NextExtensionHeaderType + // setMsg unmarshals PatternFlowGtpv1NextExtensionHeaderType from protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderType + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1NextExtensionHeaderType) PatternFlowGtpv1NextExtensionHeaderType + // provides marshal interface + Marshal() marshalPatternFlowGtpv1NextExtensionHeaderType + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1NextExtensionHeaderType + // validate validates PatternFlowGtpv1NextExtensionHeaderType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1NextExtensionHeaderType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum, set in PatternFlowGtpv1NextExtensionHeaderType + Choice() PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum + // setChoice assigns PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum provided by user to PatternFlowGtpv1NextExtensionHeaderType + setChoice(value PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum) PatternFlowGtpv1NextExtensionHeaderType + // HasChoice checks if Choice has been set in PatternFlowGtpv1NextExtensionHeaderType + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv1NextExtensionHeaderType. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv1NextExtensionHeaderType + SetValue(value uint32) PatternFlowGtpv1NextExtensionHeaderType + // HasValue checks if Value has been set in PatternFlowGtpv1NextExtensionHeaderType + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv1NextExtensionHeaderType. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv1NextExtensionHeaderType + SetValues(value []uint32) PatternFlowGtpv1NextExtensionHeaderType + // Increment returns PatternFlowGtpv1NextExtensionHeaderTypeCounter, set in PatternFlowGtpv1NextExtensionHeaderType. + // PatternFlowGtpv1NextExtensionHeaderTypeCounter is integer counter pattern + Increment() PatternFlowGtpv1NextExtensionHeaderTypeCounter + // SetIncrement assigns PatternFlowGtpv1NextExtensionHeaderTypeCounter provided by user to PatternFlowGtpv1NextExtensionHeaderType. + // PatternFlowGtpv1NextExtensionHeaderTypeCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv1NextExtensionHeaderTypeCounter) PatternFlowGtpv1NextExtensionHeaderType + // HasIncrement checks if Increment has been set in PatternFlowGtpv1NextExtensionHeaderType + HasIncrement() bool + // Decrement returns PatternFlowGtpv1NextExtensionHeaderTypeCounter, set in PatternFlowGtpv1NextExtensionHeaderType. + // PatternFlowGtpv1NextExtensionHeaderTypeCounter is integer counter pattern + Decrement() PatternFlowGtpv1NextExtensionHeaderTypeCounter + // SetDecrement assigns PatternFlowGtpv1NextExtensionHeaderTypeCounter provided by user to PatternFlowGtpv1NextExtensionHeaderType. + // PatternFlowGtpv1NextExtensionHeaderTypeCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv1NextExtensionHeaderTypeCounter) PatternFlowGtpv1NextExtensionHeaderType + // HasDecrement checks if Decrement has been set in PatternFlowGtpv1NextExtensionHeaderType + HasDecrement() bool + // MetricTags returns PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIterIter, set in PatternFlowGtpv1NextExtensionHeaderType + MetricTags() PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter + setNil() +} + +type PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum string + +// Enum of Choice on PatternFlowGtpv1NextExtensionHeaderType +var PatternFlowGtpv1NextExtensionHeaderTypeChoice = struct { + VALUE PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum + VALUES PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum + INCREMENT PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum + DECREMENT PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum +}{ + VALUE: PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum("value"), + VALUES: PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum("values"), + INCREMENT: PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv1NextExtensionHeaderType) Choice() PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum { + return PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv1NextExtensionHeaderType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv1NextExtensionHeaderType) setChoice(value PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum) PatternFlowGtpv1NextExtensionHeaderType { + intValue, ok := otg.PatternFlowGtpv1NextExtensionHeaderType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv1NextExtensionHeaderType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv1NextExtensionHeaderTypeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv1NextExtensionHeaderTypeCounter().msg() + } + + if value == PatternFlowGtpv1NextExtensionHeaderTypeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv1NextExtensionHeaderTypeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1NextExtensionHeaderType) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1NextExtensionHeaderType) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv1NextExtensionHeaderType object +func (obj *patternFlowGtpv1NextExtensionHeaderType) SetValue(value uint32) PatternFlowGtpv1NextExtensionHeaderType { + obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv1NextExtensionHeaderType) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv1NextExtensionHeaderType object +func (obj *patternFlowGtpv1NextExtensionHeaderType) SetValues(value []uint32) PatternFlowGtpv1NextExtensionHeaderType { + obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv1NextExtensionHeaderTypeCounter +func (obj *patternFlowGtpv1NextExtensionHeaderType) Increment() PatternFlowGtpv1NextExtensionHeaderTypeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv1NextExtensionHeaderTypeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv1NextExtensionHeaderTypeCounter +func (obj *patternFlowGtpv1NextExtensionHeaderType) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv1NextExtensionHeaderTypeCounter value in the PatternFlowGtpv1NextExtensionHeaderType object +func (obj *patternFlowGtpv1NextExtensionHeaderType) SetIncrement(value PatternFlowGtpv1NextExtensionHeaderTypeCounter) PatternFlowGtpv1NextExtensionHeaderType { + obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1NextExtensionHeaderTypeCounter +func (obj *patternFlowGtpv1NextExtensionHeaderType) Decrement() PatternFlowGtpv1NextExtensionHeaderTypeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv1NextExtensionHeaderTypeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1NextExtensionHeaderTypeCounter +func (obj *patternFlowGtpv1NextExtensionHeaderType) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv1NextExtensionHeaderTypeCounter value in the PatternFlowGtpv1NextExtensionHeaderType object +func (obj *patternFlowGtpv1NextExtensionHeaderType) SetDecrement(value PatternFlowGtpv1NextExtensionHeaderTypeCounter) PatternFlowGtpv1NextExtensionHeaderType { + obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv1NextExtensionHeaderTypeMetricTag +func (obj *patternFlowGtpv1NextExtensionHeaderType) MetricTags() PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter struct { + obj *patternFlowGtpv1NextExtensionHeaderType + patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice []PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + fieldPtr *[]*otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag +} + +func newPatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter(ptr *[]*otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { + return &patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter interface { + setMsg(*patternFlowGtpv1NextExtensionHeaderType) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter + Items() []PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + Add() PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + Append(items ...PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter + Set(index int, newObj PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter + Clear() PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter + clearHolderSlice() PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter + appendHolderSlice(item PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) setMsg(msg *patternFlowGtpv1NextExtensionHeaderType) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv1NextExtensionHeaderTypeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) Items() []PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { + return obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) Add() PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { + newObj := &otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv1NextExtensionHeaderTypeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice = append(obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) Append(items ...PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice = append(obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) Set(index int, newObj PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) Clear() PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag{} + obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice = []PatternFlowGtpv1NextExtensionHeaderTypeMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) clearHolderSlice() PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { + if len(obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice) > 0 { + obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice = []PatternFlowGtpv1NextExtensionHeaderTypeMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter) appendHolderSlice(item PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypePatternFlowGtpv1NextExtensionHeaderTypeMetricTagIter { + obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice = append(obj.patternFlowGtpv1NextExtensionHeaderTypeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv1NextExtensionHeaderType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1NextExtensionHeaderType.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv1NextExtensionHeaderType.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv1NextExtensionHeaderTypeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv1NextExtensionHeaderType) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv1NextExtensionHeaderTypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv1NextExtensionHeaderTypeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv1NextExtensionHeaderTypeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv1NextExtensionHeaderTypeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1NextExtensionHeaderType") + } + } else { + intVal := otg.PatternFlowGtpv1NextExtensionHeaderType_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv1NextExtensionHeaderType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_next_extension_header_type_counter.go b/gosnappi/pattern_flow_gtpv1_next_extension_header_type_counter.go new file mode 100644 index 00000000..9435dd8d --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_next_extension_header_type_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv1NextExtensionHeaderTypeCounter ***** +type patternFlowGtpv1NextExtensionHeaderTypeCounter struct { + validation + obj *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter + marshaller marshalPatternFlowGtpv1NextExtensionHeaderTypeCounter + unMarshaller unMarshalPatternFlowGtpv1NextExtensionHeaderTypeCounter +} + +func NewPatternFlowGtpv1NextExtensionHeaderTypeCounter() PatternFlowGtpv1NextExtensionHeaderTypeCounter { + obj := patternFlowGtpv1NextExtensionHeaderTypeCounter{obj: &otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) msg() *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter { + return obj.obj +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) setMsg(msg *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter) PatternFlowGtpv1NextExtensionHeaderTypeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1NextExtensionHeaderTypeCounter struct { + obj *patternFlowGtpv1NextExtensionHeaderTypeCounter +} + +type marshalPatternFlowGtpv1NextExtensionHeaderTypeCounter interface { + // ToProto marshals PatternFlowGtpv1NextExtensionHeaderTypeCounter to protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter + ToProto() (*otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter, error) + // ToPbText marshals PatternFlowGtpv1NextExtensionHeaderTypeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1NextExtensionHeaderTypeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1NextExtensionHeaderTypeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1NextExtensionHeaderTypeCounter struct { + obj *patternFlowGtpv1NextExtensionHeaderTypeCounter +} + +type unMarshalPatternFlowGtpv1NextExtensionHeaderTypeCounter interface { + // FromProto unmarshals PatternFlowGtpv1NextExtensionHeaderTypeCounter from protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter + FromProto(msg *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter) (PatternFlowGtpv1NextExtensionHeaderTypeCounter, error) + // FromPbText unmarshals PatternFlowGtpv1NextExtensionHeaderTypeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1NextExtensionHeaderTypeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1NextExtensionHeaderTypeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) Marshal() marshalPatternFlowGtpv1NextExtensionHeaderTypeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1NextExtensionHeaderTypeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) Unmarshal() unMarshalPatternFlowGtpv1NextExtensionHeaderTypeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1NextExtensionHeaderTypeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) ToProto() (*otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) FromProto(msg *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter) (PatternFlowGtpv1NextExtensionHeaderTypeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) 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 *marshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) 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 *marshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeCounter) 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 *patternFlowGtpv1NextExtensionHeaderTypeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) Clone() (PatternFlowGtpv1NextExtensionHeaderTypeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1NextExtensionHeaderTypeCounter() + 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 +} + +// PatternFlowGtpv1NextExtensionHeaderTypeCounter is integer counter pattern +type PatternFlowGtpv1NextExtensionHeaderTypeCounter interface { + Validation + // msg marshals PatternFlowGtpv1NextExtensionHeaderTypeCounter to protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter + // setMsg unmarshals PatternFlowGtpv1NextExtensionHeaderTypeCounter from protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1NextExtensionHeaderTypeCounter) PatternFlowGtpv1NextExtensionHeaderTypeCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv1NextExtensionHeaderTypeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1NextExtensionHeaderTypeCounter + // validate validates PatternFlowGtpv1NextExtensionHeaderTypeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1NextExtensionHeaderTypeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv1NextExtensionHeaderTypeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv1NextExtensionHeaderTypeCounter + SetStart(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeCounter + // HasStart checks if Start has been set in PatternFlowGtpv1NextExtensionHeaderTypeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv1NextExtensionHeaderTypeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv1NextExtensionHeaderTypeCounter + SetStep(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeCounter + // HasStep checks if Step has been set in PatternFlowGtpv1NextExtensionHeaderTypeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv1NextExtensionHeaderTypeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv1NextExtensionHeaderTypeCounter + SetCount(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeCounter + // HasCount checks if Count has been set in PatternFlowGtpv1NextExtensionHeaderTypeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv1NextExtensionHeaderTypeCounter object +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) SetStart(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv1NextExtensionHeaderTypeCounter object +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) SetStep(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv1NextExtensionHeaderTypeCounter object +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) SetCount(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1NextExtensionHeaderTypeCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1NextExtensionHeaderTypeCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1NextExtensionHeaderTypeCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_next_extension_header_type_metric_tag.go b/gosnappi/pattern_flow_gtpv1_next_extension_header_type_metric_tag.go new file mode 100644 index 00000000..7c121ae5 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_next_extension_header_type_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv1NextExtensionHeaderTypeMetricTag ***** +type patternFlowGtpv1NextExtensionHeaderTypeMetricTag struct { + validation + obj *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + marshaller marshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag + unMarshaller unMarshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag +} + +func NewPatternFlowGtpv1NextExtensionHeaderTypeMetricTag() PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { + obj := patternFlowGtpv1NextExtensionHeaderTypeMetricTag{obj: &otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) msg() *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) setMsg(msg *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag struct { + obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag +} + +type marshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag interface { + // ToProto marshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag to protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + ToProto() (*otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag, error) + // ToPbText marshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag struct { + obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag +} + +type unMarshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag interface { + // FromProto unmarshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag from protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + FromProto(msg *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) (PatternFlowGtpv1NextExtensionHeaderTypeMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) Marshal() marshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) Unmarshal() unMarshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) ToProto() (*otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) FromProto(msg *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) (PatternFlowGtpv1NextExtensionHeaderTypeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) 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 *marshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) 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 *marshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) 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 *unMarshalpatternFlowGtpv1NextExtensionHeaderTypeMetricTag) 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 *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) Clone() (PatternFlowGtpv1NextExtensionHeaderTypeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1NextExtensionHeaderTypeMetricTag() + 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 +} + +// PatternFlowGtpv1NextExtensionHeaderTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv1NextExtensionHeaderTypeMetricTag interface { + Validation + // msg marshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag to protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + // setMsg unmarshals PatternFlowGtpv1NextExtensionHeaderTypeMetricTag from protobuf object *otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1NextExtensionHeaderTypeMetricTag) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1NextExtensionHeaderTypeMetricTag + // validate validates PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1NextExtensionHeaderTypeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv1NextExtensionHeaderTypeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + SetName(value string) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + // Offset returns uint32, set in PatternFlowGtpv1NextExtensionHeaderTypeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + SetOffset(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv1NextExtensionHeaderTypeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + SetLength(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv1NextExtensionHeaderTypeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv1NextExtensionHeaderTypeMetricTag object +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) SetName(value string) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv1NextExtensionHeaderTypeMetricTag object +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) SetOffset(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv1NextExtensionHeaderTypeMetricTag object +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) SetLength(value uint32) PatternFlowGtpv1NextExtensionHeaderTypeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1NextExtensionHeaderTypeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1NextExtensionHeaderTypeMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv1NextExtensionHeaderTypeMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv1NextExtensionHeaderTypeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_pn_flag.go b/gosnappi/pattern_flow_gtpv1_pn_flag.go new file mode 100644 index 00000000..43cbc95e --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_pn_flag.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv1PnFlag ***** +type patternFlowGtpv1PnFlag struct { + validation + obj *otg.PatternFlowGtpv1PnFlag + marshaller marshalPatternFlowGtpv1PnFlag + unMarshaller unMarshalPatternFlowGtpv1PnFlag + incrementHolder PatternFlowGtpv1PnFlagCounter + decrementHolder PatternFlowGtpv1PnFlagCounter + metricTagsHolder PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter +} + +func NewPatternFlowGtpv1PnFlag() PatternFlowGtpv1PnFlag { + obj := patternFlowGtpv1PnFlag{obj: &otg.PatternFlowGtpv1PnFlag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1PnFlag) msg() *otg.PatternFlowGtpv1PnFlag { + return obj.obj +} + +func (obj *patternFlowGtpv1PnFlag) setMsg(msg *otg.PatternFlowGtpv1PnFlag) PatternFlowGtpv1PnFlag { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1PnFlag struct { + obj *patternFlowGtpv1PnFlag +} + +type marshalPatternFlowGtpv1PnFlag interface { + // ToProto marshals PatternFlowGtpv1PnFlag to protobuf object *otg.PatternFlowGtpv1PnFlag + ToProto() (*otg.PatternFlowGtpv1PnFlag, error) + // ToPbText marshals PatternFlowGtpv1PnFlag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1PnFlag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1PnFlag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1PnFlag struct { + obj *patternFlowGtpv1PnFlag +} + +type unMarshalPatternFlowGtpv1PnFlag interface { + // FromProto unmarshals PatternFlowGtpv1PnFlag from protobuf object *otg.PatternFlowGtpv1PnFlag + FromProto(msg *otg.PatternFlowGtpv1PnFlag) (PatternFlowGtpv1PnFlag, error) + // FromPbText unmarshals PatternFlowGtpv1PnFlag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1PnFlag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1PnFlag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1PnFlag) Marshal() marshalPatternFlowGtpv1PnFlag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1PnFlag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1PnFlag) Unmarshal() unMarshalPatternFlowGtpv1PnFlag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1PnFlag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1PnFlag) ToProto() (*otg.PatternFlowGtpv1PnFlag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1PnFlag) FromProto(msg *otg.PatternFlowGtpv1PnFlag) (PatternFlowGtpv1PnFlag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1PnFlag) 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 *unMarshalpatternFlowGtpv1PnFlag) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv1PnFlag) 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 *unMarshalpatternFlowGtpv1PnFlag) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv1PnFlag) 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 *unMarshalpatternFlowGtpv1PnFlag) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv1PnFlag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1PnFlag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1PnFlag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1PnFlag) Clone() (PatternFlowGtpv1PnFlag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1PnFlag() + 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 +} + +func (obj *patternFlowGtpv1PnFlag) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv1PnFlag is n-PDU field present +type PatternFlowGtpv1PnFlag interface { + Validation + // msg marshals PatternFlowGtpv1PnFlag to protobuf object *otg.PatternFlowGtpv1PnFlag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1PnFlag + // setMsg unmarshals PatternFlowGtpv1PnFlag from protobuf object *otg.PatternFlowGtpv1PnFlag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1PnFlag) PatternFlowGtpv1PnFlag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1PnFlag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1PnFlag + // validate validates PatternFlowGtpv1PnFlag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1PnFlag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv1PnFlagChoiceEnum, set in PatternFlowGtpv1PnFlag + Choice() PatternFlowGtpv1PnFlagChoiceEnum + // setChoice assigns PatternFlowGtpv1PnFlagChoiceEnum provided by user to PatternFlowGtpv1PnFlag + setChoice(value PatternFlowGtpv1PnFlagChoiceEnum) PatternFlowGtpv1PnFlag + // HasChoice checks if Choice has been set in PatternFlowGtpv1PnFlag + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv1PnFlag. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv1PnFlag + SetValue(value uint32) PatternFlowGtpv1PnFlag + // HasValue checks if Value has been set in PatternFlowGtpv1PnFlag + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv1PnFlag. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv1PnFlag + SetValues(value []uint32) PatternFlowGtpv1PnFlag + // Increment returns PatternFlowGtpv1PnFlagCounter, set in PatternFlowGtpv1PnFlag. + // PatternFlowGtpv1PnFlagCounter is integer counter pattern + Increment() PatternFlowGtpv1PnFlagCounter + // SetIncrement assigns PatternFlowGtpv1PnFlagCounter provided by user to PatternFlowGtpv1PnFlag. + // PatternFlowGtpv1PnFlagCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv1PnFlagCounter) PatternFlowGtpv1PnFlag + // HasIncrement checks if Increment has been set in PatternFlowGtpv1PnFlag + HasIncrement() bool + // Decrement returns PatternFlowGtpv1PnFlagCounter, set in PatternFlowGtpv1PnFlag. + // PatternFlowGtpv1PnFlagCounter is integer counter pattern + Decrement() PatternFlowGtpv1PnFlagCounter + // SetDecrement assigns PatternFlowGtpv1PnFlagCounter provided by user to PatternFlowGtpv1PnFlag. + // PatternFlowGtpv1PnFlagCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv1PnFlagCounter) PatternFlowGtpv1PnFlag + // HasDecrement checks if Decrement has been set in PatternFlowGtpv1PnFlag + HasDecrement() bool + // MetricTags returns PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIterIter, set in PatternFlowGtpv1PnFlag + MetricTags() PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter + setNil() +} + +type PatternFlowGtpv1PnFlagChoiceEnum string + +// Enum of Choice on PatternFlowGtpv1PnFlag +var PatternFlowGtpv1PnFlagChoice = struct { + VALUE PatternFlowGtpv1PnFlagChoiceEnum + VALUES PatternFlowGtpv1PnFlagChoiceEnum + INCREMENT PatternFlowGtpv1PnFlagChoiceEnum + DECREMENT PatternFlowGtpv1PnFlagChoiceEnum +}{ + VALUE: PatternFlowGtpv1PnFlagChoiceEnum("value"), + VALUES: PatternFlowGtpv1PnFlagChoiceEnum("values"), + INCREMENT: PatternFlowGtpv1PnFlagChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv1PnFlagChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv1PnFlag) Choice() PatternFlowGtpv1PnFlagChoiceEnum { + return PatternFlowGtpv1PnFlagChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv1PnFlag) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv1PnFlag) setChoice(value PatternFlowGtpv1PnFlagChoiceEnum) PatternFlowGtpv1PnFlag { + intValue, ok := otg.PatternFlowGtpv1PnFlag_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv1PnFlagChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv1PnFlag_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv1PnFlagChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv1PnFlagChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv1PnFlagChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv1PnFlagCounter().msg() + } + + if value == PatternFlowGtpv1PnFlagChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv1PnFlagCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1PnFlag) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv1PnFlagChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1PnFlag) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv1PnFlag object +func (obj *patternFlowGtpv1PnFlag) SetValue(value uint32) PatternFlowGtpv1PnFlag { + obj.setChoice(PatternFlowGtpv1PnFlagChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv1PnFlag) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv1PnFlag object +func (obj *patternFlowGtpv1PnFlag) SetValues(value []uint32) PatternFlowGtpv1PnFlag { + obj.setChoice(PatternFlowGtpv1PnFlagChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv1PnFlagCounter +func (obj *patternFlowGtpv1PnFlag) Increment() PatternFlowGtpv1PnFlagCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv1PnFlagChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv1PnFlagCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv1PnFlagCounter +func (obj *patternFlowGtpv1PnFlag) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv1PnFlagCounter value in the PatternFlowGtpv1PnFlag object +func (obj *patternFlowGtpv1PnFlag) SetIncrement(value PatternFlowGtpv1PnFlagCounter) PatternFlowGtpv1PnFlag { + obj.setChoice(PatternFlowGtpv1PnFlagChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1PnFlagCounter +func (obj *patternFlowGtpv1PnFlag) Decrement() PatternFlowGtpv1PnFlagCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv1PnFlagChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv1PnFlagCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1PnFlagCounter +func (obj *patternFlowGtpv1PnFlag) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv1PnFlagCounter value in the PatternFlowGtpv1PnFlag object +func (obj *patternFlowGtpv1PnFlag) SetDecrement(value PatternFlowGtpv1PnFlagCounter) PatternFlowGtpv1PnFlag { + obj.setChoice(PatternFlowGtpv1PnFlagChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv1PnFlagMetricTag +func (obj *patternFlowGtpv1PnFlag) MetricTags() PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv1PnFlagMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter struct { + obj *patternFlowGtpv1PnFlag + patternFlowGtpv1PnFlagMetricTagSlice []PatternFlowGtpv1PnFlagMetricTag + fieldPtr *[]*otg.PatternFlowGtpv1PnFlagMetricTag +} + +func newPatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter(ptr *[]*otg.PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { + return &patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter interface { + setMsg(*patternFlowGtpv1PnFlag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter + Items() []PatternFlowGtpv1PnFlagMetricTag + Add() PatternFlowGtpv1PnFlagMetricTag + Append(items ...PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter + Set(index int, newObj PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter + Clear() PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter + clearHolderSlice() PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter + appendHolderSlice(item PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter +} + +func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) setMsg(msg *patternFlowGtpv1PnFlag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv1PnFlagMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) Items() []PatternFlowGtpv1PnFlagMetricTag { + return obj.patternFlowGtpv1PnFlagMetricTagSlice +} + +func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) Add() PatternFlowGtpv1PnFlagMetricTag { + newObj := &otg.PatternFlowGtpv1PnFlagMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv1PnFlagMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv1PnFlagMetricTagSlice = append(obj.patternFlowGtpv1PnFlagMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) Append(items ...PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv1PnFlagMetricTagSlice = append(obj.patternFlowGtpv1PnFlagMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) Set(index int, newObj PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv1PnFlagMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) Clear() PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv1PnFlagMetricTag{} + obj.patternFlowGtpv1PnFlagMetricTagSlice = []PatternFlowGtpv1PnFlagMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) clearHolderSlice() PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { + if len(obj.patternFlowGtpv1PnFlagMetricTagSlice) > 0 { + obj.patternFlowGtpv1PnFlagMetricTagSlice = []PatternFlowGtpv1PnFlagMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter) appendHolderSlice(item PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagPatternFlowGtpv1PnFlagMetricTagIter { + obj.patternFlowGtpv1PnFlagMetricTagSlice = append(obj.patternFlowGtpv1PnFlagMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv1PnFlag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1PnFlag.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv1PnFlag.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv1PnFlagMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv1PnFlag) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv1PnFlagChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv1PnFlagChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv1PnFlagChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv1PnFlagChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv1PnFlagChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv1PnFlagChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1PnFlag") + } + } else { + intVal := otg.PatternFlowGtpv1PnFlag_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv1PnFlag_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_pn_flag_counter.go b/gosnappi/pattern_flow_gtpv1_pn_flag_counter.go new file mode 100644 index 00000000..ac079bce --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_pn_flag_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv1PnFlagCounter ***** +type patternFlowGtpv1PnFlagCounter struct { + validation + obj *otg.PatternFlowGtpv1PnFlagCounter + marshaller marshalPatternFlowGtpv1PnFlagCounter + unMarshaller unMarshalPatternFlowGtpv1PnFlagCounter +} + +func NewPatternFlowGtpv1PnFlagCounter() PatternFlowGtpv1PnFlagCounter { + obj := patternFlowGtpv1PnFlagCounter{obj: &otg.PatternFlowGtpv1PnFlagCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1PnFlagCounter) msg() *otg.PatternFlowGtpv1PnFlagCounter { + return obj.obj +} + +func (obj *patternFlowGtpv1PnFlagCounter) setMsg(msg *otg.PatternFlowGtpv1PnFlagCounter) PatternFlowGtpv1PnFlagCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1PnFlagCounter struct { + obj *patternFlowGtpv1PnFlagCounter +} + +type marshalPatternFlowGtpv1PnFlagCounter interface { + // ToProto marshals PatternFlowGtpv1PnFlagCounter to protobuf object *otg.PatternFlowGtpv1PnFlagCounter + ToProto() (*otg.PatternFlowGtpv1PnFlagCounter, error) + // ToPbText marshals PatternFlowGtpv1PnFlagCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1PnFlagCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1PnFlagCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1PnFlagCounter struct { + obj *patternFlowGtpv1PnFlagCounter +} + +type unMarshalPatternFlowGtpv1PnFlagCounter interface { + // FromProto unmarshals PatternFlowGtpv1PnFlagCounter from protobuf object *otg.PatternFlowGtpv1PnFlagCounter + FromProto(msg *otg.PatternFlowGtpv1PnFlagCounter) (PatternFlowGtpv1PnFlagCounter, error) + // FromPbText unmarshals PatternFlowGtpv1PnFlagCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1PnFlagCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1PnFlagCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1PnFlagCounter) Marshal() marshalPatternFlowGtpv1PnFlagCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1PnFlagCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1PnFlagCounter) Unmarshal() unMarshalPatternFlowGtpv1PnFlagCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1PnFlagCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1PnFlagCounter) ToProto() (*otg.PatternFlowGtpv1PnFlagCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1PnFlagCounter) FromProto(msg *otg.PatternFlowGtpv1PnFlagCounter) (PatternFlowGtpv1PnFlagCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1PnFlagCounter) 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 *unMarshalpatternFlowGtpv1PnFlagCounter) 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 *marshalpatternFlowGtpv1PnFlagCounter) 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 *unMarshalpatternFlowGtpv1PnFlagCounter) 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 *marshalpatternFlowGtpv1PnFlagCounter) 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 *unMarshalpatternFlowGtpv1PnFlagCounter) 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 *patternFlowGtpv1PnFlagCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1PnFlagCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1PnFlagCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1PnFlagCounter) Clone() (PatternFlowGtpv1PnFlagCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1PnFlagCounter() + 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 +} + +// PatternFlowGtpv1PnFlagCounter is integer counter pattern +type PatternFlowGtpv1PnFlagCounter interface { + Validation + // msg marshals PatternFlowGtpv1PnFlagCounter to protobuf object *otg.PatternFlowGtpv1PnFlagCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1PnFlagCounter + // setMsg unmarshals PatternFlowGtpv1PnFlagCounter from protobuf object *otg.PatternFlowGtpv1PnFlagCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1PnFlagCounter) PatternFlowGtpv1PnFlagCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv1PnFlagCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1PnFlagCounter + // validate validates PatternFlowGtpv1PnFlagCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1PnFlagCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv1PnFlagCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv1PnFlagCounter + SetStart(value uint32) PatternFlowGtpv1PnFlagCounter + // HasStart checks if Start has been set in PatternFlowGtpv1PnFlagCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv1PnFlagCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv1PnFlagCounter + SetStep(value uint32) PatternFlowGtpv1PnFlagCounter + // HasStep checks if Step has been set in PatternFlowGtpv1PnFlagCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv1PnFlagCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv1PnFlagCounter + SetCount(value uint32) PatternFlowGtpv1PnFlagCounter + // HasCount checks if Count has been set in PatternFlowGtpv1PnFlagCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1PnFlagCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1PnFlagCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv1PnFlagCounter object +func (obj *patternFlowGtpv1PnFlagCounter) SetStart(value uint32) PatternFlowGtpv1PnFlagCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1PnFlagCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1PnFlagCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv1PnFlagCounter object +func (obj *patternFlowGtpv1PnFlagCounter) SetStep(value uint32) PatternFlowGtpv1PnFlagCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1PnFlagCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1PnFlagCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv1PnFlagCounter object +func (obj *patternFlowGtpv1PnFlagCounter) SetCount(value uint32) PatternFlowGtpv1PnFlagCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv1PnFlagCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1PnFlagCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1PnFlagCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1PnFlagCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv1PnFlagCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_pn_flag_metric_tag.go b/gosnappi/pattern_flow_gtpv1_pn_flag_metric_tag.go new file mode 100644 index 00000000..f3ec5e30 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_pn_flag_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv1PnFlagMetricTag ***** +type patternFlowGtpv1PnFlagMetricTag struct { + validation + obj *otg.PatternFlowGtpv1PnFlagMetricTag + marshaller marshalPatternFlowGtpv1PnFlagMetricTag + unMarshaller unMarshalPatternFlowGtpv1PnFlagMetricTag +} + +func NewPatternFlowGtpv1PnFlagMetricTag() PatternFlowGtpv1PnFlagMetricTag { + obj := patternFlowGtpv1PnFlagMetricTag{obj: &otg.PatternFlowGtpv1PnFlagMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1PnFlagMetricTag) msg() *otg.PatternFlowGtpv1PnFlagMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv1PnFlagMetricTag) setMsg(msg *otg.PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1PnFlagMetricTag struct { + obj *patternFlowGtpv1PnFlagMetricTag +} + +type marshalPatternFlowGtpv1PnFlagMetricTag interface { + // ToProto marshals PatternFlowGtpv1PnFlagMetricTag to protobuf object *otg.PatternFlowGtpv1PnFlagMetricTag + ToProto() (*otg.PatternFlowGtpv1PnFlagMetricTag, error) + // ToPbText marshals PatternFlowGtpv1PnFlagMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1PnFlagMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1PnFlagMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1PnFlagMetricTag struct { + obj *patternFlowGtpv1PnFlagMetricTag +} + +type unMarshalPatternFlowGtpv1PnFlagMetricTag interface { + // FromProto unmarshals PatternFlowGtpv1PnFlagMetricTag from protobuf object *otg.PatternFlowGtpv1PnFlagMetricTag + FromProto(msg *otg.PatternFlowGtpv1PnFlagMetricTag) (PatternFlowGtpv1PnFlagMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv1PnFlagMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1PnFlagMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1PnFlagMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1PnFlagMetricTag) Marshal() marshalPatternFlowGtpv1PnFlagMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1PnFlagMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1PnFlagMetricTag) Unmarshal() unMarshalPatternFlowGtpv1PnFlagMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1PnFlagMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1PnFlagMetricTag) ToProto() (*otg.PatternFlowGtpv1PnFlagMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1PnFlagMetricTag) FromProto(msg *otg.PatternFlowGtpv1PnFlagMetricTag) (PatternFlowGtpv1PnFlagMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1PnFlagMetricTag) 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 *unMarshalpatternFlowGtpv1PnFlagMetricTag) 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 *marshalpatternFlowGtpv1PnFlagMetricTag) 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 *unMarshalpatternFlowGtpv1PnFlagMetricTag) 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 *marshalpatternFlowGtpv1PnFlagMetricTag) 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 *unMarshalpatternFlowGtpv1PnFlagMetricTag) 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 *patternFlowGtpv1PnFlagMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1PnFlagMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1PnFlagMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1PnFlagMetricTag) Clone() (PatternFlowGtpv1PnFlagMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1PnFlagMetricTag() + 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 +} + +// PatternFlowGtpv1PnFlagMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv1PnFlagMetricTag interface { + Validation + // msg marshals PatternFlowGtpv1PnFlagMetricTag to protobuf object *otg.PatternFlowGtpv1PnFlagMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1PnFlagMetricTag + // setMsg unmarshals PatternFlowGtpv1PnFlagMetricTag from protobuf object *otg.PatternFlowGtpv1PnFlagMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1PnFlagMetricTag) PatternFlowGtpv1PnFlagMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1PnFlagMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1PnFlagMetricTag + // validate validates PatternFlowGtpv1PnFlagMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1PnFlagMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv1PnFlagMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv1PnFlagMetricTag + SetName(value string) PatternFlowGtpv1PnFlagMetricTag + // Offset returns uint32, set in PatternFlowGtpv1PnFlagMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv1PnFlagMetricTag + SetOffset(value uint32) PatternFlowGtpv1PnFlagMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv1PnFlagMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv1PnFlagMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv1PnFlagMetricTag + SetLength(value uint32) PatternFlowGtpv1PnFlagMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv1PnFlagMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv1PnFlagMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv1PnFlagMetricTag object +func (obj *patternFlowGtpv1PnFlagMetricTag) SetName(value string) PatternFlowGtpv1PnFlagMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1PnFlagMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1PnFlagMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv1PnFlagMetricTag object +func (obj *patternFlowGtpv1PnFlagMetricTag) SetOffset(value uint32) PatternFlowGtpv1PnFlagMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1PnFlagMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1PnFlagMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv1PnFlagMetricTag object +func (obj *patternFlowGtpv1PnFlagMetricTag) SetLength(value uint32) PatternFlowGtpv1PnFlagMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv1PnFlagMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1PnFlagMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1PnFlagMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv1PnFlagMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv1PnFlagMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_protocol_type.go b/gosnappi/pattern_flow_gtpv1_protocol_type.go new file mode 100644 index 00000000..c93ecee0 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_protocol_type.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv1ProtocolType ***** +type patternFlowGtpv1ProtocolType struct { + validation + obj *otg.PatternFlowGtpv1ProtocolType + marshaller marshalPatternFlowGtpv1ProtocolType + unMarshaller unMarshalPatternFlowGtpv1ProtocolType + incrementHolder PatternFlowGtpv1ProtocolTypeCounter + decrementHolder PatternFlowGtpv1ProtocolTypeCounter + metricTagsHolder PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter +} + +func NewPatternFlowGtpv1ProtocolType() PatternFlowGtpv1ProtocolType { + obj := patternFlowGtpv1ProtocolType{obj: &otg.PatternFlowGtpv1ProtocolType{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1ProtocolType) msg() *otg.PatternFlowGtpv1ProtocolType { + return obj.obj +} + +func (obj *patternFlowGtpv1ProtocolType) setMsg(msg *otg.PatternFlowGtpv1ProtocolType) PatternFlowGtpv1ProtocolType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1ProtocolType struct { + obj *patternFlowGtpv1ProtocolType +} + +type marshalPatternFlowGtpv1ProtocolType interface { + // ToProto marshals PatternFlowGtpv1ProtocolType to protobuf object *otg.PatternFlowGtpv1ProtocolType + ToProto() (*otg.PatternFlowGtpv1ProtocolType, error) + // ToPbText marshals PatternFlowGtpv1ProtocolType to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1ProtocolType to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1ProtocolType to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1ProtocolType struct { + obj *patternFlowGtpv1ProtocolType +} + +type unMarshalPatternFlowGtpv1ProtocolType interface { + // FromProto unmarshals PatternFlowGtpv1ProtocolType from protobuf object *otg.PatternFlowGtpv1ProtocolType + FromProto(msg *otg.PatternFlowGtpv1ProtocolType) (PatternFlowGtpv1ProtocolType, error) + // FromPbText unmarshals PatternFlowGtpv1ProtocolType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1ProtocolType from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1ProtocolType from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1ProtocolType) Marshal() marshalPatternFlowGtpv1ProtocolType { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1ProtocolType{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1ProtocolType) Unmarshal() unMarshalPatternFlowGtpv1ProtocolType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1ProtocolType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1ProtocolType) ToProto() (*otg.PatternFlowGtpv1ProtocolType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1ProtocolType) FromProto(msg *otg.PatternFlowGtpv1ProtocolType) (PatternFlowGtpv1ProtocolType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1ProtocolType) 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 *unMarshalpatternFlowGtpv1ProtocolType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv1ProtocolType) 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 *unMarshalpatternFlowGtpv1ProtocolType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv1ProtocolType) 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 *unMarshalpatternFlowGtpv1ProtocolType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv1ProtocolType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1ProtocolType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1ProtocolType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1ProtocolType) Clone() (PatternFlowGtpv1ProtocolType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1ProtocolType() + 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 +} + +func (obj *patternFlowGtpv1ProtocolType) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv1ProtocolType is protocol type, GTP is 1, GTP' is 0 +type PatternFlowGtpv1ProtocolType interface { + Validation + // msg marshals PatternFlowGtpv1ProtocolType to protobuf object *otg.PatternFlowGtpv1ProtocolType + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1ProtocolType + // setMsg unmarshals PatternFlowGtpv1ProtocolType from protobuf object *otg.PatternFlowGtpv1ProtocolType + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1ProtocolType) PatternFlowGtpv1ProtocolType + // provides marshal interface + Marshal() marshalPatternFlowGtpv1ProtocolType + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1ProtocolType + // validate validates PatternFlowGtpv1ProtocolType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1ProtocolType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv1ProtocolTypeChoiceEnum, set in PatternFlowGtpv1ProtocolType + Choice() PatternFlowGtpv1ProtocolTypeChoiceEnum + // setChoice assigns PatternFlowGtpv1ProtocolTypeChoiceEnum provided by user to PatternFlowGtpv1ProtocolType + setChoice(value PatternFlowGtpv1ProtocolTypeChoiceEnum) PatternFlowGtpv1ProtocolType + // HasChoice checks if Choice has been set in PatternFlowGtpv1ProtocolType + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv1ProtocolType. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv1ProtocolType + SetValue(value uint32) PatternFlowGtpv1ProtocolType + // HasValue checks if Value has been set in PatternFlowGtpv1ProtocolType + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv1ProtocolType. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv1ProtocolType + SetValues(value []uint32) PatternFlowGtpv1ProtocolType + // Increment returns PatternFlowGtpv1ProtocolTypeCounter, set in PatternFlowGtpv1ProtocolType. + // PatternFlowGtpv1ProtocolTypeCounter is integer counter pattern + Increment() PatternFlowGtpv1ProtocolTypeCounter + // SetIncrement assigns PatternFlowGtpv1ProtocolTypeCounter provided by user to PatternFlowGtpv1ProtocolType. + // PatternFlowGtpv1ProtocolTypeCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv1ProtocolTypeCounter) PatternFlowGtpv1ProtocolType + // HasIncrement checks if Increment has been set in PatternFlowGtpv1ProtocolType + HasIncrement() bool + // Decrement returns PatternFlowGtpv1ProtocolTypeCounter, set in PatternFlowGtpv1ProtocolType. + // PatternFlowGtpv1ProtocolTypeCounter is integer counter pattern + Decrement() PatternFlowGtpv1ProtocolTypeCounter + // SetDecrement assigns PatternFlowGtpv1ProtocolTypeCounter provided by user to PatternFlowGtpv1ProtocolType. + // PatternFlowGtpv1ProtocolTypeCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv1ProtocolTypeCounter) PatternFlowGtpv1ProtocolType + // HasDecrement checks if Decrement has been set in PatternFlowGtpv1ProtocolType + HasDecrement() bool + // MetricTags returns PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIterIter, set in PatternFlowGtpv1ProtocolType + MetricTags() PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter + setNil() +} + +type PatternFlowGtpv1ProtocolTypeChoiceEnum string + +// Enum of Choice on PatternFlowGtpv1ProtocolType +var PatternFlowGtpv1ProtocolTypeChoice = struct { + VALUE PatternFlowGtpv1ProtocolTypeChoiceEnum + VALUES PatternFlowGtpv1ProtocolTypeChoiceEnum + INCREMENT PatternFlowGtpv1ProtocolTypeChoiceEnum + DECREMENT PatternFlowGtpv1ProtocolTypeChoiceEnum +}{ + VALUE: PatternFlowGtpv1ProtocolTypeChoiceEnum("value"), + VALUES: PatternFlowGtpv1ProtocolTypeChoiceEnum("values"), + INCREMENT: PatternFlowGtpv1ProtocolTypeChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv1ProtocolTypeChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv1ProtocolType) Choice() PatternFlowGtpv1ProtocolTypeChoiceEnum { + return PatternFlowGtpv1ProtocolTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv1ProtocolType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv1ProtocolType) setChoice(value PatternFlowGtpv1ProtocolTypeChoiceEnum) PatternFlowGtpv1ProtocolType { + intValue, ok := otg.PatternFlowGtpv1ProtocolType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv1ProtocolTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv1ProtocolType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv1ProtocolTypeChoice.VALUE { + defaultValue := uint32(1) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv1ProtocolTypeChoice.VALUES { + defaultValue := []uint32{1} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv1ProtocolTypeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv1ProtocolTypeCounter().msg() + } + + if value == PatternFlowGtpv1ProtocolTypeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv1ProtocolTypeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1ProtocolType) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1ProtocolType) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv1ProtocolType object +func (obj *patternFlowGtpv1ProtocolType) SetValue(value uint32) PatternFlowGtpv1ProtocolType { + obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv1ProtocolType) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{1}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv1ProtocolType object +func (obj *patternFlowGtpv1ProtocolType) SetValues(value []uint32) PatternFlowGtpv1ProtocolType { + obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv1ProtocolTypeCounter +func (obj *patternFlowGtpv1ProtocolType) Increment() PatternFlowGtpv1ProtocolTypeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv1ProtocolTypeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv1ProtocolTypeCounter +func (obj *patternFlowGtpv1ProtocolType) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv1ProtocolTypeCounter value in the PatternFlowGtpv1ProtocolType object +func (obj *patternFlowGtpv1ProtocolType) SetIncrement(value PatternFlowGtpv1ProtocolTypeCounter) PatternFlowGtpv1ProtocolType { + obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1ProtocolTypeCounter +func (obj *patternFlowGtpv1ProtocolType) Decrement() PatternFlowGtpv1ProtocolTypeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv1ProtocolTypeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1ProtocolTypeCounter +func (obj *patternFlowGtpv1ProtocolType) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv1ProtocolTypeCounter value in the PatternFlowGtpv1ProtocolType object +func (obj *patternFlowGtpv1ProtocolType) SetDecrement(value PatternFlowGtpv1ProtocolTypeCounter) PatternFlowGtpv1ProtocolType { + obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv1ProtocolTypeMetricTag +func (obj *patternFlowGtpv1ProtocolType) MetricTags() PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv1ProtocolTypeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter struct { + obj *patternFlowGtpv1ProtocolType + patternFlowGtpv1ProtocolTypeMetricTagSlice []PatternFlowGtpv1ProtocolTypeMetricTag + fieldPtr *[]*otg.PatternFlowGtpv1ProtocolTypeMetricTag +} + +func newPatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter(ptr *[]*otg.PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { + return &patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter interface { + setMsg(*patternFlowGtpv1ProtocolType) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter + Items() []PatternFlowGtpv1ProtocolTypeMetricTag + Add() PatternFlowGtpv1ProtocolTypeMetricTag + Append(items ...PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter + Set(index int, newObj PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter + Clear() PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter + clearHolderSlice() PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter + appendHolderSlice(item PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter +} + +func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) setMsg(msg *patternFlowGtpv1ProtocolType) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv1ProtocolTypeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) Items() []PatternFlowGtpv1ProtocolTypeMetricTag { + return obj.patternFlowGtpv1ProtocolTypeMetricTagSlice +} + +func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) Add() PatternFlowGtpv1ProtocolTypeMetricTag { + newObj := &otg.PatternFlowGtpv1ProtocolTypeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv1ProtocolTypeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv1ProtocolTypeMetricTagSlice = append(obj.patternFlowGtpv1ProtocolTypeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) Append(items ...PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv1ProtocolTypeMetricTagSlice = append(obj.patternFlowGtpv1ProtocolTypeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) Set(index int, newObj PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv1ProtocolTypeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) Clear() PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv1ProtocolTypeMetricTag{} + obj.patternFlowGtpv1ProtocolTypeMetricTagSlice = []PatternFlowGtpv1ProtocolTypeMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) clearHolderSlice() PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { + if len(obj.patternFlowGtpv1ProtocolTypeMetricTagSlice) > 0 { + obj.patternFlowGtpv1ProtocolTypeMetricTagSlice = []PatternFlowGtpv1ProtocolTypeMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter) appendHolderSlice(item PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypePatternFlowGtpv1ProtocolTypeMetricTagIter { + obj.patternFlowGtpv1ProtocolTypeMetricTagSlice = append(obj.patternFlowGtpv1ProtocolTypeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv1ProtocolType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1ProtocolType.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv1ProtocolType.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv1ProtocolTypeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv1ProtocolType) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv1ProtocolTypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv1ProtocolTypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv1ProtocolTypeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv1ProtocolTypeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv1ProtocolTypeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv1ProtocolTypeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1ProtocolType") + } + } else { + intVal := otg.PatternFlowGtpv1ProtocolType_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv1ProtocolType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_protocol_type_counter.go b/gosnappi/pattern_flow_gtpv1_protocol_type_counter.go new file mode 100644 index 00000000..f16d3914 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_protocol_type_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv1ProtocolTypeCounter ***** +type patternFlowGtpv1ProtocolTypeCounter struct { + validation + obj *otg.PatternFlowGtpv1ProtocolTypeCounter + marshaller marshalPatternFlowGtpv1ProtocolTypeCounter + unMarshaller unMarshalPatternFlowGtpv1ProtocolTypeCounter +} + +func NewPatternFlowGtpv1ProtocolTypeCounter() PatternFlowGtpv1ProtocolTypeCounter { + obj := patternFlowGtpv1ProtocolTypeCounter{obj: &otg.PatternFlowGtpv1ProtocolTypeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1ProtocolTypeCounter) msg() *otg.PatternFlowGtpv1ProtocolTypeCounter { + return obj.obj +} + +func (obj *patternFlowGtpv1ProtocolTypeCounter) setMsg(msg *otg.PatternFlowGtpv1ProtocolTypeCounter) PatternFlowGtpv1ProtocolTypeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1ProtocolTypeCounter struct { + obj *patternFlowGtpv1ProtocolTypeCounter +} + +type marshalPatternFlowGtpv1ProtocolTypeCounter interface { + // ToProto marshals PatternFlowGtpv1ProtocolTypeCounter to protobuf object *otg.PatternFlowGtpv1ProtocolTypeCounter + ToProto() (*otg.PatternFlowGtpv1ProtocolTypeCounter, error) + // ToPbText marshals PatternFlowGtpv1ProtocolTypeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1ProtocolTypeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1ProtocolTypeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1ProtocolTypeCounter struct { + obj *patternFlowGtpv1ProtocolTypeCounter +} + +type unMarshalPatternFlowGtpv1ProtocolTypeCounter interface { + // FromProto unmarshals PatternFlowGtpv1ProtocolTypeCounter from protobuf object *otg.PatternFlowGtpv1ProtocolTypeCounter + FromProto(msg *otg.PatternFlowGtpv1ProtocolTypeCounter) (PatternFlowGtpv1ProtocolTypeCounter, error) + // FromPbText unmarshals PatternFlowGtpv1ProtocolTypeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1ProtocolTypeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1ProtocolTypeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1ProtocolTypeCounter) Marshal() marshalPatternFlowGtpv1ProtocolTypeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1ProtocolTypeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1ProtocolTypeCounter) Unmarshal() unMarshalPatternFlowGtpv1ProtocolTypeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1ProtocolTypeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1ProtocolTypeCounter) ToProto() (*otg.PatternFlowGtpv1ProtocolTypeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1ProtocolTypeCounter) FromProto(msg *otg.PatternFlowGtpv1ProtocolTypeCounter) (PatternFlowGtpv1ProtocolTypeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1ProtocolTypeCounter) 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 *unMarshalpatternFlowGtpv1ProtocolTypeCounter) 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 *marshalpatternFlowGtpv1ProtocolTypeCounter) 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 *unMarshalpatternFlowGtpv1ProtocolTypeCounter) 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 *marshalpatternFlowGtpv1ProtocolTypeCounter) 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 *unMarshalpatternFlowGtpv1ProtocolTypeCounter) 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 *patternFlowGtpv1ProtocolTypeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1ProtocolTypeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1ProtocolTypeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1ProtocolTypeCounter) Clone() (PatternFlowGtpv1ProtocolTypeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1ProtocolTypeCounter() + 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 +} + +// PatternFlowGtpv1ProtocolTypeCounter is integer counter pattern +type PatternFlowGtpv1ProtocolTypeCounter interface { + Validation + // msg marshals PatternFlowGtpv1ProtocolTypeCounter to protobuf object *otg.PatternFlowGtpv1ProtocolTypeCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1ProtocolTypeCounter + // setMsg unmarshals PatternFlowGtpv1ProtocolTypeCounter from protobuf object *otg.PatternFlowGtpv1ProtocolTypeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1ProtocolTypeCounter) PatternFlowGtpv1ProtocolTypeCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv1ProtocolTypeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1ProtocolTypeCounter + // validate validates PatternFlowGtpv1ProtocolTypeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1ProtocolTypeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv1ProtocolTypeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv1ProtocolTypeCounter + SetStart(value uint32) PatternFlowGtpv1ProtocolTypeCounter + // HasStart checks if Start has been set in PatternFlowGtpv1ProtocolTypeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv1ProtocolTypeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv1ProtocolTypeCounter + SetStep(value uint32) PatternFlowGtpv1ProtocolTypeCounter + // HasStep checks if Step has been set in PatternFlowGtpv1ProtocolTypeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv1ProtocolTypeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv1ProtocolTypeCounter + SetCount(value uint32) PatternFlowGtpv1ProtocolTypeCounter + // HasCount checks if Count has been set in PatternFlowGtpv1ProtocolTypeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1ProtocolTypeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1ProtocolTypeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv1ProtocolTypeCounter object +func (obj *patternFlowGtpv1ProtocolTypeCounter) SetStart(value uint32) PatternFlowGtpv1ProtocolTypeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1ProtocolTypeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1ProtocolTypeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv1ProtocolTypeCounter object +func (obj *patternFlowGtpv1ProtocolTypeCounter) SetStep(value uint32) PatternFlowGtpv1ProtocolTypeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1ProtocolTypeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1ProtocolTypeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv1ProtocolTypeCounter object +func (obj *patternFlowGtpv1ProtocolTypeCounter) SetCount(value uint32) PatternFlowGtpv1ProtocolTypeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv1ProtocolTypeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1ProtocolTypeCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1ProtocolTypeCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1ProtocolTypeCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv1ProtocolTypeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_protocol_type_metric_tag.go b/gosnappi/pattern_flow_gtpv1_protocol_type_metric_tag.go new file mode 100644 index 00000000..45c0be02 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_protocol_type_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv1ProtocolTypeMetricTag ***** +type patternFlowGtpv1ProtocolTypeMetricTag struct { + validation + obj *otg.PatternFlowGtpv1ProtocolTypeMetricTag + marshaller marshalPatternFlowGtpv1ProtocolTypeMetricTag + unMarshaller unMarshalPatternFlowGtpv1ProtocolTypeMetricTag +} + +func NewPatternFlowGtpv1ProtocolTypeMetricTag() PatternFlowGtpv1ProtocolTypeMetricTag { + obj := patternFlowGtpv1ProtocolTypeMetricTag{obj: &otg.PatternFlowGtpv1ProtocolTypeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) msg() *otg.PatternFlowGtpv1ProtocolTypeMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) setMsg(msg *otg.PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1ProtocolTypeMetricTag struct { + obj *patternFlowGtpv1ProtocolTypeMetricTag +} + +type marshalPatternFlowGtpv1ProtocolTypeMetricTag interface { + // ToProto marshals PatternFlowGtpv1ProtocolTypeMetricTag to protobuf object *otg.PatternFlowGtpv1ProtocolTypeMetricTag + ToProto() (*otg.PatternFlowGtpv1ProtocolTypeMetricTag, error) + // ToPbText marshals PatternFlowGtpv1ProtocolTypeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1ProtocolTypeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1ProtocolTypeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1ProtocolTypeMetricTag struct { + obj *patternFlowGtpv1ProtocolTypeMetricTag +} + +type unMarshalPatternFlowGtpv1ProtocolTypeMetricTag interface { + // FromProto unmarshals PatternFlowGtpv1ProtocolTypeMetricTag from protobuf object *otg.PatternFlowGtpv1ProtocolTypeMetricTag + FromProto(msg *otg.PatternFlowGtpv1ProtocolTypeMetricTag) (PatternFlowGtpv1ProtocolTypeMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv1ProtocolTypeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1ProtocolTypeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1ProtocolTypeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) Marshal() marshalPatternFlowGtpv1ProtocolTypeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1ProtocolTypeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) Unmarshal() unMarshalPatternFlowGtpv1ProtocolTypeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1ProtocolTypeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1ProtocolTypeMetricTag) ToProto() (*otg.PatternFlowGtpv1ProtocolTypeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1ProtocolTypeMetricTag) FromProto(msg *otg.PatternFlowGtpv1ProtocolTypeMetricTag) (PatternFlowGtpv1ProtocolTypeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1ProtocolTypeMetricTag) 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 *unMarshalpatternFlowGtpv1ProtocolTypeMetricTag) 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 *marshalpatternFlowGtpv1ProtocolTypeMetricTag) 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 *unMarshalpatternFlowGtpv1ProtocolTypeMetricTag) 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 *marshalpatternFlowGtpv1ProtocolTypeMetricTag) 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 *unMarshalpatternFlowGtpv1ProtocolTypeMetricTag) 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 *patternFlowGtpv1ProtocolTypeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) Clone() (PatternFlowGtpv1ProtocolTypeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1ProtocolTypeMetricTag() + 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 +} + +// PatternFlowGtpv1ProtocolTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv1ProtocolTypeMetricTag interface { + Validation + // msg marshals PatternFlowGtpv1ProtocolTypeMetricTag to protobuf object *otg.PatternFlowGtpv1ProtocolTypeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1ProtocolTypeMetricTag + // setMsg unmarshals PatternFlowGtpv1ProtocolTypeMetricTag from protobuf object *otg.PatternFlowGtpv1ProtocolTypeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1ProtocolTypeMetricTag) PatternFlowGtpv1ProtocolTypeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1ProtocolTypeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1ProtocolTypeMetricTag + // validate validates PatternFlowGtpv1ProtocolTypeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1ProtocolTypeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv1ProtocolTypeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv1ProtocolTypeMetricTag + SetName(value string) PatternFlowGtpv1ProtocolTypeMetricTag + // Offset returns uint32, set in PatternFlowGtpv1ProtocolTypeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv1ProtocolTypeMetricTag + SetOffset(value uint32) PatternFlowGtpv1ProtocolTypeMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv1ProtocolTypeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv1ProtocolTypeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv1ProtocolTypeMetricTag + SetLength(value uint32) PatternFlowGtpv1ProtocolTypeMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv1ProtocolTypeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv1ProtocolTypeMetricTag object +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) SetName(value string) PatternFlowGtpv1ProtocolTypeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv1ProtocolTypeMetricTag object +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) SetOffset(value uint32) PatternFlowGtpv1ProtocolTypeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv1ProtocolTypeMetricTag object +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) SetLength(value uint32) PatternFlowGtpv1ProtocolTypeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1ProtocolTypeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1ProtocolTypeMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv1ProtocolTypeMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv1ProtocolTypeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_reserved.go b/gosnappi/pattern_flow_gtpv1_reserved.go new file mode 100644 index 00000000..425b5bcb --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_reserved.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv1Reserved ***** +type patternFlowGtpv1Reserved struct { + validation + obj *otg.PatternFlowGtpv1Reserved + marshaller marshalPatternFlowGtpv1Reserved + unMarshaller unMarshalPatternFlowGtpv1Reserved + incrementHolder PatternFlowGtpv1ReservedCounter + decrementHolder PatternFlowGtpv1ReservedCounter + metricTagsHolder PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter +} + +func NewPatternFlowGtpv1Reserved() PatternFlowGtpv1Reserved { + obj := patternFlowGtpv1Reserved{obj: &otg.PatternFlowGtpv1Reserved{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1Reserved) msg() *otg.PatternFlowGtpv1Reserved { + return obj.obj +} + +func (obj *patternFlowGtpv1Reserved) setMsg(msg *otg.PatternFlowGtpv1Reserved) PatternFlowGtpv1Reserved { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1Reserved struct { + obj *patternFlowGtpv1Reserved +} + +type marshalPatternFlowGtpv1Reserved interface { + // ToProto marshals PatternFlowGtpv1Reserved to protobuf object *otg.PatternFlowGtpv1Reserved + ToProto() (*otg.PatternFlowGtpv1Reserved, error) + // ToPbText marshals PatternFlowGtpv1Reserved to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1Reserved to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1Reserved to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1Reserved struct { + obj *patternFlowGtpv1Reserved +} + +type unMarshalPatternFlowGtpv1Reserved interface { + // FromProto unmarshals PatternFlowGtpv1Reserved from protobuf object *otg.PatternFlowGtpv1Reserved + FromProto(msg *otg.PatternFlowGtpv1Reserved) (PatternFlowGtpv1Reserved, error) + // FromPbText unmarshals PatternFlowGtpv1Reserved from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1Reserved from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1Reserved from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1Reserved) Marshal() marshalPatternFlowGtpv1Reserved { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1Reserved{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1Reserved) Unmarshal() unMarshalPatternFlowGtpv1Reserved { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1Reserved{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1Reserved) ToProto() (*otg.PatternFlowGtpv1Reserved, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1Reserved) FromProto(msg *otg.PatternFlowGtpv1Reserved) (PatternFlowGtpv1Reserved, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1Reserved) 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 *unMarshalpatternFlowGtpv1Reserved) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv1Reserved) 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 *unMarshalpatternFlowGtpv1Reserved) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv1Reserved) 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 *unMarshalpatternFlowGtpv1Reserved) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv1Reserved) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1Reserved) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1Reserved) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1Reserved) Clone() (PatternFlowGtpv1Reserved, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1Reserved() + 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 +} + +func (obj *patternFlowGtpv1Reserved) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv1Reserved is reserved field +type PatternFlowGtpv1Reserved interface { + Validation + // msg marshals PatternFlowGtpv1Reserved to protobuf object *otg.PatternFlowGtpv1Reserved + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1Reserved + // setMsg unmarshals PatternFlowGtpv1Reserved from protobuf object *otg.PatternFlowGtpv1Reserved + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1Reserved) PatternFlowGtpv1Reserved + // provides marshal interface + Marshal() marshalPatternFlowGtpv1Reserved + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1Reserved + // validate validates PatternFlowGtpv1Reserved + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1Reserved, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv1ReservedChoiceEnum, set in PatternFlowGtpv1Reserved + Choice() PatternFlowGtpv1ReservedChoiceEnum + // setChoice assigns PatternFlowGtpv1ReservedChoiceEnum provided by user to PatternFlowGtpv1Reserved + setChoice(value PatternFlowGtpv1ReservedChoiceEnum) PatternFlowGtpv1Reserved + // HasChoice checks if Choice has been set in PatternFlowGtpv1Reserved + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv1Reserved. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv1Reserved + SetValue(value uint32) PatternFlowGtpv1Reserved + // HasValue checks if Value has been set in PatternFlowGtpv1Reserved + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv1Reserved. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv1Reserved + SetValues(value []uint32) PatternFlowGtpv1Reserved + // Increment returns PatternFlowGtpv1ReservedCounter, set in PatternFlowGtpv1Reserved. + // PatternFlowGtpv1ReservedCounter is integer counter pattern + Increment() PatternFlowGtpv1ReservedCounter + // SetIncrement assigns PatternFlowGtpv1ReservedCounter provided by user to PatternFlowGtpv1Reserved. + // PatternFlowGtpv1ReservedCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv1ReservedCounter) PatternFlowGtpv1Reserved + // HasIncrement checks if Increment has been set in PatternFlowGtpv1Reserved + HasIncrement() bool + // Decrement returns PatternFlowGtpv1ReservedCounter, set in PatternFlowGtpv1Reserved. + // PatternFlowGtpv1ReservedCounter is integer counter pattern + Decrement() PatternFlowGtpv1ReservedCounter + // SetDecrement assigns PatternFlowGtpv1ReservedCounter provided by user to PatternFlowGtpv1Reserved. + // PatternFlowGtpv1ReservedCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv1ReservedCounter) PatternFlowGtpv1Reserved + // HasDecrement checks if Decrement has been set in PatternFlowGtpv1Reserved + HasDecrement() bool + // MetricTags returns PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIterIter, set in PatternFlowGtpv1Reserved + MetricTags() PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter + setNil() +} + +type PatternFlowGtpv1ReservedChoiceEnum string + +// Enum of Choice on PatternFlowGtpv1Reserved +var PatternFlowGtpv1ReservedChoice = struct { + VALUE PatternFlowGtpv1ReservedChoiceEnum + VALUES PatternFlowGtpv1ReservedChoiceEnum + INCREMENT PatternFlowGtpv1ReservedChoiceEnum + DECREMENT PatternFlowGtpv1ReservedChoiceEnum +}{ + VALUE: PatternFlowGtpv1ReservedChoiceEnum("value"), + VALUES: PatternFlowGtpv1ReservedChoiceEnum("values"), + INCREMENT: PatternFlowGtpv1ReservedChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv1ReservedChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv1Reserved) Choice() PatternFlowGtpv1ReservedChoiceEnum { + return PatternFlowGtpv1ReservedChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv1Reserved) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv1Reserved) setChoice(value PatternFlowGtpv1ReservedChoiceEnum) PatternFlowGtpv1Reserved { + intValue, ok := otg.PatternFlowGtpv1Reserved_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv1ReservedChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv1Reserved_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv1ReservedChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv1ReservedChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv1ReservedChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv1ReservedCounter().msg() + } + + if value == PatternFlowGtpv1ReservedChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv1ReservedCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1Reserved) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv1ReservedChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1Reserved) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv1Reserved object +func (obj *patternFlowGtpv1Reserved) SetValue(value uint32) PatternFlowGtpv1Reserved { + obj.setChoice(PatternFlowGtpv1ReservedChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv1Reserved) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv1Reserved object +func (obj *patternFlowGtpv1Reserved) SetValues(value []uint32) PatternFlowGtpv1Reserved { + obj.setChoice(PatternFlowGtpv1ReservedChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv1ReservedCounter +func (obj *patternFlowGtpv1Reserved) Increment() PatternFlowGtpv1ReservedCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv1ReservedChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv1ReservedCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv1ReservedCounter +func (obj *patternFlowGtpv1Reserved) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv1ReservedCounter value in the PatternFlowGtpv1Reserved object +func (obj *patternFlowGtpv1Reserved) SetIncrement(value PatternFlowGtpv1ReservedCounter) PatternFlowGtpv1Reserved { + obj.setChoice(PatternFlowGtpv1ReservedChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1ReservedCounter +func (obj *patternFlowGtpv1Reserved) Decrement() PatternFlowGtpv1ReservedCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv1ReservedChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv1ReservedCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1ReservedCounter +func (obj *patternFlowGtpv1Reserved) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv1ReservedCounter value in the PatternFlowGtpv1Reserved object +func (obj *patternFlowGtpv1Reserved) SetDecrement(value PatternFlowGtpv1ReservedCounter) PatternFlowGtpv1Reserved { + obj.setChoice(PatternFlowGtpv1ReservedChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv1ReservedMetricTag +func (obj *patternFlowGtpv1Reserved) MetricTags() PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv1ReservedMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter struct { + obj *patternFlowGtpv1Reserved + patternFlowGtpv1ReservedMetricTagSlice []PatternFlowGtpv1ReservedMetricTag + fieldPtr *[]*otg.PatternFlowGtpv1ReservedMetricTag +} + +func newPatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter(ptr *[]*otg.PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { + return &patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter interface { + setMsg(*patternFlowGtpv1Reserved) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter + Items() []PatternFlowGtpv1ReservedMetricTag + Add() PatternFlowGtpv1ReservedMetricTag + Append(items ...PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter + Set(index int, newObj PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter + Clear() PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter + clearHolderSlice() PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter + appendHolderSlice(item PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter +} + +func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) setMsg(msg *patternFlowGtpv1Reserved) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv1ReservedMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) Items() []PatternFlowGtpv1ReservedMetricTag { + return obj.patternFlowGtpv1ReservedMetricTagSlice +} + +func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) Add() PatternFlowGtpv1ReservedMetricTag { + newObj := &otg.PatternFlowGtpv1ReservedMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv1ReservedMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv1ReservedMetricTagSlice = append(obj.patternFlowGtpv1ReservedMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) Append(items ...PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv1ReservedMetricTagSlice = append(obj.patternFlowGtpv1ReservedMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) Set(index int, newObj PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv1ReservedMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) Clear() PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv1ReservedMetricTag{} + obj.patternFlowGtpv1ReservedMetricTagSlice = []PatternFlowGtpv1ReservedMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) clearHolderSlice() PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { + if len(obj.patternFlowGtpv1ReservedMetricTagSlice) > 0 { + obj.patternFlowGtpv1ReservedMetricTagSlice = []PatternFlowGtpv1ReservedMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter) appendHolderSlice(item PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedPatternFlowGtpv1ReservedMetricTagIter { + obj.patternFlowGtpv1ReservedMetricTagSlice = append(obj.patternFlowGtpv1ReservedMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv1Reserved) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1Reserved.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv1Reserved.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv1ReservedMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv1Reserved) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv1ReservedChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv1ReservedChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv1ReservedChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv1ReservedChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv1ReservedChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv1ReservedChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1Reserved") + } + } else { + intVal := otg.PatternFlowGtpv1Reserved_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv1Reserved_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_reserved_counter.go b/gosnappi/pattern_flow_gtpv1_reserved_counter.go new file mode 100644 index 00000000..e889f7dc --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_reserved_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv1ReservedCounter ***** +type patternFlowGtpv1ReservedCounter struct { + validation + obj *otg.PatternFlowGtpv1ReservedCounter + marshaller marshalPatternFlowGtpv1ReservedCounter + unMarshaller unMarshalPatternFlowGtpv1ReservedCounter +} + +func NewPatternFlowGtpv1ReservedCounter() PatternFlowGtpv1ReservedCounter { + obj := patternFlowGtpv1ReservedCounter{obj: &otg.PatternFlowGtpv1ReservedCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1ReservedCounter) msg() *otg.PatternFlowGtpv1ReservedCounter { + return obj.obj +} + +func (obj *patternFlowGtpv1ReservedCounter) setMsg(msg *otg.PatternFlowGtpv1ReservedCounter) PatternFlowGtpv1ReservedCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1ReservedCounter struct { + obj *patternFlowGtpv1ReservedCounter +} + +type marshalPatternFlowGtpv1ReservedCounter interface { + // ToProto marshals PatternFlowGtpv1ReservedCounter to protobuf object *otg.PatternFlowGtpv1ReservedCounter + ToProto() (*otg.PatternFlowGtpv1ReservedCounter, error) + // ToPbText marshals PatternFlowGtpv1ReservedCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1ReservedCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1ReservedCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1ReservedCounter struct { + obj *patternFlowGtpv1ReservedCounter +} + +type unMarshalPatternFlowGtpv1ReservedCounter interface { + // FromProto unmarshals PatternFlowGtpv1ReservedCounter from protobuf object *otg.PatternFlowGtpv1ReservedCounter + FromProto(msg *otg.PatternFlowGtpv1ReservedCounter) (PatternFlowGtpv1ReservedCounter, error) + // FromPbText unmarshals PatternFlowGtpv1ReservedCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1ReservedCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1ReservedCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1ReservedCounter) Marshal() marshalPatternFlowGtpv1ReservedCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1ReservedCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1ReservedCounter) Unmarshal() unMarshalPatternFlowGtpv1ReservedCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1ReservedCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1ReservedCounter) ToProto() (*otg.PatternFlowGtpv1ReservedCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1ReservedCounter) FromProto(msg *otg.PatternFlowGtpv1ReservedCounter) (PatternFlowGtpv1ReservedCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1ReservedCounter) 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 *unMarshalpatternFlowGtpv1ReservedCounter) 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 *marshalpatternFlowGtpv1ReservedCounter) 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 *unMarshalpatternFlowGtpv1ReservedCounter) 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 *marshalpatternFlowGtpv1ReservedCounter) 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 *unMarshalpatternFlowGtpv1ReservedCounter) 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 *patternFlowGtpv1ReservedCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1ReservedCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1ReservedCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1ReservedCounter) Clone() (PatternFlowGtpv1ReservedCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1ReservedCounter() + 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 +} + +// PatternFlowGtpv1ReservedCounter is integer counter pattern +type PatternFlowGtpv1ReservedCounter interface { + Validation + // msg marshals PatternFlowGtpv1ReservedCounter to protobuf object *otg.PatternFlowGtpv1ReservedCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1ReservedCounter + // setMsg unmarshals PatternFlowGtpv1ReservedCounter from protobuf object *otg.PatternFlowGtpv1ReservedCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1ReservedCounter) PatternFlowGtpv1ReservedCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv1ReservedCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1ReservedCounter + // validate validates PatternFlowGtpv1ReservedCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1ReservedCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv1ReservedCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv1ReservedCounter + SetStart(value uint32) PatternFlowGtpv1ReservedCounter + // HasStart checks if Start has been set in PatternFlowGtpv1ReservedCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv1ReservedCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv1ReservedCounter + SetStep(value uint32) PatternFlowGtpv1ReservedCounter + // HasStep checks if Step has been set in PatternFlowGtpv1ReservedCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv1ReservedCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv1ReservedCounter + SetCount(value uint32) PatternFlowGtpv1ReservedCounter + // HasCount checks if Count has been set in PatternFlowGtpv1ReservedCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1ReservedCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1ReservedCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv1ReservedCounter object +func (obj *patternFlowGtpv1ReservedCounter) SetStart(value uint32) PatternFlowGtpv1ReservedCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1ReservedCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1ReservedCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv1ReservedCounter object +func (obj *patternFlowGtpv1ReservedCounter) SetStep(value uint32) PatternFlowGtpv1ReservedCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1ReservedCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1ReservedCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv1ReservedCounter object +func (obj *patternFlowGtpv1ReservedCounter) SetCount(value uint32) PatternFlowGtpv1ReservedCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv1ReservedCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1ReservedCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1ReservedCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1ReservedCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv1ReservedCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_reserved_metric_tag.go b/gosnappi/pattern_flow_gtpv1_reserved_metric_tag.go new file mode 100644 index 00000000..b792d8fa --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_reserved_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv1ReservedMetricTag ***** +type patternFlowGtpv1ReservedMetricTag struct { + validation + obj *otg.PatternFlowGtpv1ReservedMetricTag + marshaller marshalPatternFlowGtpv1ReservedMetricTag + unMarshaller unMarshalPatternFlowGtpv1ReservedMetricTag +} + +func NewPatternFlowGtpv1ReservedMetricTag() PatternFlowGtpv1ReservedMetricTag { + obj := patternFlowGtpv1ReservedMetricTag{obj: &otg.PatternFlowGtpv1ReservedMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1ReservedMetricTag) msg() *otg.PatternFlowGtpv1ReservedMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv1ReservedMetricTag) setMsg(msg *otg.PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1ReservedMetricTag struct { + obj *patternFlowGtpv1ReservedMetricTag +} + +type marshalPatternFlowGtpv1ReservedMetricTag interface { + // ToProto marshals PatternFlowGtpv1ReservedMetricTag to protobuf object *otg.PatternFlowGtpv1ReservedMetricTag + ToProto() (*otg.PatternFlowGtpv1ReservedMetricTag, error) + // ToPbText marshals PatternFlowGtpv1ReservedMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1ReservedMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1ReservedMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1ReservedMetricTag struct { + obj *patternFlowGtpv1ReservedMetricTag +} + +type unMarshalPatternFlowGtpv1ReservedMetricTag interface { + // FromProto unmarshals PatternFlowGtpv1ReservedMetricTag from protobuf object *otg.PatternFlowGtpv1ReservedMetricTag + FromProto(msg *otg.PatternFlowGtpv1ReservedMetricTag) (PatternFlowGtpv1ReservedMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv1ReservedMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1ReservedMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1ReservedMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1ReservedMetricTag) Marshal() marshalPatternFlowGtpv1ReservedMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1ReservedMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1ReservedMetricTag) Unmarshal() unMarshalPatternFlowGtpv1ReservedMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1ReservedMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1ReservedMetricTag) ToProto() (*otg.PatternFlowGtpv1ReservedMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1ReservedMetricTag) FromProto(msg *otg.PatternFlowGtpv1ReservedMetricTag) (PatternFlowGtpv1ReservedMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1ReservedMetricTag) 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 *unMarshalpatternFlowGtpv1ReservedMetricTag) 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 *marshalpatternFlowGtpv1ReservedMetricTag) 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 *unMarshalpatternFlowGtpv1ReservedMetricTag) 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 *marshalpatternFlowGtpv1ReservedMetricTag) 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 *unMarshalpatternFlowGtpv1ReservedMetricTag) 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 *patternFlowGtpv1ReservedMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1ReservedMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1ReservedMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1ReservedMetricTag) Clone() (PatternFlowGtpv1ReservedMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1ReservedMetricTag() + 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 +} + +// PatternFlowGtpv1ReservedMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv1ReservedMetricTag interface { + Validation + // msg marshals PatternFlowGtpv1ReservedMetricTag to protobuf object *otg.PatternFlowGtpv1ReservedMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1ReservedMetricTag + // setMsg unmarshals PatternFlowGtpv1ReservedMetricTag from protobuf object *otg.PatternFlowGtpv1ReservedMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1ReservedMetricTag) PatternFlowGtpv1ReservedMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1ReservedMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1ReservedMetricTag + // validate validates PatternFlowGtpv1ReservedMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1ReservedMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv1ReservedMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv1ReservedMetricTag + SetName(value string) PatternFlowGtpv1ReservedMetricTag + // Offset returns uint32, set in PatternFlowGtpv1ReservedMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv1ReservedMetricTag + SetOffset(value uint32) PatternFlowGtpv1ReservedMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv1ReservedMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv1ReservedMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv1ReservedMetricTag + SetLength(value uint32) PatternFlowGtpv1ReservedMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv1ReservedMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv1ReservedMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv1ReservedMetricTag object +func (obj *patternFlowGtpv1ReservedMetricTag) SetName(value string) PatternFlowGtpv1ReservedMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1ReservedMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1ReservedMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv1ReservedMetricTag object +func (obj *patternFlowGtpv1ReservedMetricTag) SetOffset(value uint32) PatternFlowGtpv1ReservedMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1ReservedMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1ReservedMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv1ReservedMetricTag object +func (obj *patternFlowGtpv1ReservedMetricTag) SetLength(value uint32) PatternFlowGtpv1ReservedMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv1ReservedMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1ReservedMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1ReservedMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv1ReservedMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv1ReservedMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_s_flag.go b/gosnappi/pattern_flow_gtpv1_s_flag.go new file mode 100644 index 00000000..53c6fd67 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_s_flag.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv1SFlag ***** +type patternFlowGtpv1SFlag struct { + validation + obj *otg.PatternFlowGtpv1SFlag + marshaller marshalPatternFlowGtpv1SFlag + unMarshaller unMarshalPatternFlowGtpv1SFlag + incrementHolder PatternFlowGtpv1SFlagCounter + decrementHolder PatternFlowGtpv1SFlagCounter + metricTagsHolder PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter +} + +func NewPatternFlowGtpv1SFlag() PatternFlowGtpv1SFlag { + obj := patternFlowGtpv1SFlag{obj: &otg.PatternFlowGtpv1SFlag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1SFlag) msg() *otg.PatternFlowGtpv1SFlag { + return obj.obj +} + +func (obj *patternFlowGtpv1SFlag) setMsg(msg *otg.PatternFlowGtpv1SFlag) PatternFlowGtpv1SFlag { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1SFlag struct { + obj *patternFlowGtpv1SFlag +} + +type marshalPatternFlowGtpv1SFlag interface { + // ToProto marshals PatternFlowGtpv1SFlag to protobuf object *otg.PatternFlowGtpv1SFlag + ToProto() (*otg.PatternFlowGtpv1SFlag, error) + // ToPbText marshals PatternFlowGtpv1SFlag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1SFlag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1SFlag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1SFlag struct { + obj *patternFlowGtpv1SFlag +} + +type unMarshalPatternFlowGtpv1SFlag interface { + // FromProto unmarshals PatternFlowGtpv1SFlag from protobuf object *otg.PatternFlowGtpv1SFlag + FromProto(msg *otg.PatternFlowGtpv1SFlag) (PatternFlowGtpv1SFlag, error) + // FromPbText unmarshals PatternFlowGtpv1SFlag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1SFlag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1SFlag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1SFlag) Marshal() marshalPatternFlowGtpv1SFlag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1SFlag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1SFlag) Unmarshal() unMarshalPatternFlowGtpv1SFlag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1SFlag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1SFlag) ToProto() (*otg.PatternFlowGtpv1SFlag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1SFlag) FromProto(msg *otg.PatternFlowGtpv1SFlag) (PatternFlowGtpv1SFlag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1SFlag) 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 *unMarshalpatternFlowGtpv1SFlag) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv1SFlag) 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 *unMarshalpatternFlowGtpv1SFlag) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv1SFlag) 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 *unMarshalpatternFlowGtpv1SFlag) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv1SFlag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1SFlag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1SFlag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1SFlag) Clone() (PatternFlowGtpv1SFlag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1SFlag() + 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 +} + +func (obj *patternFlowGtpv1SFlag) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv1SFlag is sequence number field present +type PatternFlowGtpv1SFlag interface { + Validation + // msg marshals PatternFlowGtpv1SFlag to protobuf object *otg.PatternFlowGtpv1SFlag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1SFlag + // setMsg unmarshals PatternFlowGtpv1SFlag from protobuf object *otg.PatternFlowGtpv1SFlag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1SFlag) PatternFlowGtpv1SFlag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1SFlag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1SFlag + // validate validates PatternFlowGtpv1SFlag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1SFlag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv1SFlagChoiceEnum, set in PatternFlowGtpv1SFlag + Choice() PatternFlowGtpv1SFlagChoiceEnum + // setChoice assigns PatternFlowGtpv1SFlagChoiceEnum provided by user to PatternFlowGtpv1SFlag + setChoice(value PatternFlowGtpv1SFlagChoiceEnum) PatternFlowGtpv1SFlag + // HasChoice checks if Choice has been set in PatternFlowGtpv1SFlag + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv1SFlag. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv1SFlag + SetValue(value uint32) PatternFlowGtpv1SFlag + // HasValue checks if Value has been set in PatternFlowGtpv1SFlag + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv1SFlag. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv1SFlag + SetValues(value []uint32) PatternFlowGtpv1SFlag + // Increment returns PatternFlowGtpv1SFlagCounter, set in PatternFlowGtpv1SFlag. + // PatternFlowGtpv1SFlagCounter is integer counter pattern + Increment() PatternFlowGtpv1SFlagCounter + // SetIncrement assigns PatternFlowGtpv1SFlagCounter provided by user to PatternFlowGtpv1SFlag. + // PatternFlowGtpv1SFlagCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv1SFlagCounter) PatternFlowGtpv1SFlag + // HasIncrement checks if Increment has been set in PatternFlowGtpv1SFlag + HasIncrement() bool + // Decrement returns PatternFlowGtpv1SFlagCounter, set in PatternFlowGtpv1SFlag. + // PatternFlowGtpv1SFlagCounter is integer counter pattern + Decrement() PatternFlowGtpv1SFlagCounter + // SetDecrement assigns PatternFlowGtpv1SFlagCounter provided by user to PatternFlowGtpv1SFlag. + // PatternFlowGtpv1SFlagCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv1SFlagCounter) PatternFlowGtpv1SFlag + // HasDecrement checks if Decrement has been set in PatternFlowGtpv1SFlag + HasDecrement() bool + // MetricTags returns PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIterIter, set in PatternFlowGtpv1SFlag + MetricTags() PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter + setNil() +} + +type PatternFlowGtpv1SFlagChoiceEnum string + +// Enum of Choice on PatternFlowGtpv1SFlag +var PatternFlowGtpv1SFlagChoice = struct { + VALUE PatternFlowGtpv1SFlagChoiceEnum + VALUES PatternFlowGtpv1SFlagChoiceEnum + INCREMENT PatternFlowGtpv1SFlagChoiceEnum + DECREMENT PatternFlowGtpv1SFlagChoiceEnum +}{ + VALUE: PatternFlowGtpv1SFlagChoiceEnum("value"), + VALUES: PatternFlowGtpv1SFlagChoiceEnum("values"), + INCREMENT: PatternFlowGtpv1SFlagChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv1SFlagChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv1SFlag) Choice() PatternFlowGtpv1SFlagChoiceEnum { + return PatternFlowGtpv1SFlagChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv1SFlag) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv1SFlag) setChoice(value PatternFlowGtpv1SFlagChoiceEnum) PatternFlowGtpv1SFlag { + intValue, ok := otg.PatternFlowGtpv1SFlag_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv1SFlagChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv1SFlag_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv1SFlagChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv1SFlagChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv1SFlagChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv1SFlagCounter().msg() + } + + if value == PatternFlowGtpv1SFlagChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv1SFlagCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1SFlag) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv1SFlagChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1SFlag) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv1SFlag object +func (obj *patternFlowGtpv1SFlag) SetValue(value uint32) PatternFlowGtpv1SFlag { + obj.setChoice(PatternFlowGtpv1SFlagChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv1SFlag) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv1SFlag object +func (obj *patternFlowGtpv1SFlag) SetValues(value []uint32) PatternFlowGtpv1SFlag { + obj.setChoice(PatternFlowGtpv1SFlagChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv1SFlagCounter +func (obj *patternFlowGtpv1SFlag) Increment() PatternFlowGtpv1SFlagCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv1SFlagChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv1SFlagCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv1SFlagCounter +func (obj *patternFlowGtpv1SFlag) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv1SFlagCounter value in the PatternFlowGtpv1SFlag object +func (obj *patternFlowGtpv1SFlag) SetIncrement(value PatternFlowGtpv1SFlagCounter) PatternFlowGtpv1SFlag { + obj.setChoice(PatternFlowGtpv1SFlagChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1SFlagCounter +func (obj *patternFlowGtpv1SFlag) Decrement() PatternFlowGtpv1SFlagCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv1SFlagChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv1SFlagCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1SFlagCounter +func (obj *patternFlowGtpv1SFlag) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv1SFlagCounter value in the PatternFlowGtpv1SFlag object +func (obj *patternFlowGtpv1SFlag) SetDecrement(value PatternFlowGtpv1SFlagCounter) PatternFlowGtpv1SFlag { + obj.setChoice(PatternFlowGtpv1SFlagChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv1SFlagMetricTag +func (obj *patternFlowGtpv1SFlag) MetricTags() PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv1SFlagMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter struct { + obj *patternFlowGtpv1SFlag + patternFlowGtpv1SFlagMetricTagSlice []PatternFlowGtpv1SFlagMetricTag + fieldPtr *[]*otg.PatternFlowGtpv1SFlagMetricTag +} + +func newPatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter(ptr *[]*otg.PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { + return &patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter interface { + setMsg(*patternFlowGtpv1SFlag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter + Items() []PatternFlowGtpv1SFlagMetricTag + Add() PatternFlowGtpv1SFlagMetricTag + Append(items ...PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter + Set(index int, newObj PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter + Clear() PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter + clearHolderSlice() PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter + appendHolderSlice(item PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter +} + +func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) setMsg(msg *patternFlowGtpv1SFlag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv1SFlagMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) Items() []PatternFlowGtpv1SFlagMetricTag { + return obj.patternFlowGtpv1SFlagMetricTagSlice +} + +func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) Add() PatternFlowGtpv1SFlagMetricTag { + newObj := &otg.PatternFlowGtpv1SFlagMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv1SFlagMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv1SFlagMetricTagSlice = append(obj.patternFlowGtpv1SFlagMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) Append(items ...PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv1SFlagMetricTagSlice = append(obj.patternFlowGtpv1SFlagMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) Set(index int, newObj PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv1SFlagMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) Clear() PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv1SFlagMetricTag{} + obj.patternFlowGtpv1SFlagMetricTagSlice = []PatternFlowGtpv1SFlagMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) clearHolderSlice() PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { + if len(obj.patternFlowGtpv1SFlagMetricTagSlice) > 0 { + obj.patternFlowGtpv1SFlagMetricTagSlice = []PatternFlowGtpv1SFlagMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter) appendHolderSlice(item PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagPatternFlowGtpv1SFlagMetricTagIter { + obj.patternFlowGtpv1SFlagMetricTagSlice = append(obj.patternFlowGtpv1SFlagMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv1SFlag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1SFlag.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv1SFlag.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv1SFlagMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv1SFlag) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv1SFlagChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv1SFlagChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv1SFlagChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv1SFlagChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv1SFlagChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv1SFlagChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1SFlag") + } + } else { + intVal := otg.PatternFlowGtpv1SFlag_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv1SFlag_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_s_flag_counter.go b/gosnappi/pattern_flow_gtpv1_s_flag_counter.go new file mode 100644 index 00000000..c0d14a20 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_s_flag_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv1SFlagCounter ***** +type patternFlowGtpv1SFlagCounter struct { + validation + obj *otg.PatternFlowGtpv1SFlagCounter + marshaller marshalPatternFlowGtpv1SFlagCounter + unMarshaller unMarshalPatternFlowGtpv1SFlagCounter +} + +func NewPatternFlowGtpv1SFlagCounter() PatternFlowGtpv1SFlagCounter { + obj := patternFlowGtpv1SFlagCounter{obj: &otg.PatternFlowGtpv1SFlagCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1SFlagCounter) msg() *otg.PatternFlowGtpv1SFlagCounter { + return obj.obj +} + +func (obj *patternFlowGtpv1SFlagCounter) setMsg(msg *otg.PatternFlowGtpv1SFlagCounter) PatternFlowGtpv1SFlagCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1SFlagCounter struct { + obj *patternFlowGtpv1SFlagCounter +} + +type marshalPatternFlowGtpv1SFlagCounter interface { + // ToProto marshals PatternFlowGtpv1SFlagCounter to protobuf object *otg.PatternFlowGtpv1SFlagCounter + ToProto() (*otg.PatternFlowGtpv1SFlagCounter, error) + // ToPbText marshals PatternFlowGtpv1SFlagCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1SFlagCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1SFlagCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1SFlagCounter struct { + obj *patternFlowGtpv1SFlagCounter +} + +type unMarshalPatternFlowGtpv1SFlagCounter interface { + // FromProto unmarshals PatternFlowGtpv1SFlagCounter from protobuf object *otg.PatternFlowGtpv1SFlagCounter + FromProto(msg *otg.PatternFlowGtpv1SFlagCounter) (PatternFlowGtpv1SFlagCounter, error) + // FromPbText unmarshals PatternFlowGtpv1SFlagCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1SFlagCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1SFlagCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1SFlagCounter) Marshal() marshalPatternFlowGtpv1SFlagCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1SFlagCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1SFlagCounter) Unmarshal() unMarshalPatternFlowGtpv1SFlagCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1SFlagCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1SFlagCounter) ToProto() (*otg.PatternFlowGtpv1SFlagCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1SFlagCounter) FromProto(msg *otg.PatternFlowGtpv1SFlagCounter) (PatternFlowGtpv1SFlagCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1SFlagCounter) 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 *unMarshalpatternFlowGtpv1SFlagCounter) 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 *marshalpatternFlowGtpv1SFlagCounter) 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 *unMarshalpatternFlowGtpv1SFlagCounter) 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 *marshalpatternFlowGtpv1SFlagCounter) 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 *unMarshalpatternFlowGtpv1SFlagCounter) 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 *patternFlowGtpv1SFlagCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1SFlagCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1SFlagCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1SFlagCounter) Clone() (PatternFlowGtpv1SFlagCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1SFlagCounter() + 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 +} + +// PatternFlowGtpv1SFlagCounter is integer counter pattern +type PatternFlowGtpv1SFlagCounter interface { + Validation + // msg marshals PatternFlowGtpv1SFlagCounter to protobuf object *otg.PatternFlowGtpv1SFlagCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1SFlagCounter + // setMsg unmarshals PatternFlowGtpv1SFlagCounter from protobuf object *otg.PatternFlowGtpv1SFlagCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1SFlagCounter) PatternFlowGtpv1SFlagCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv1SFlagCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1SFlagCounter + // validate validates PatternFlowGtpv1SFlagCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1SFlagCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv1SFlagCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv1SFlagCounter + SetStart(value uint32) PatternFlowGtpv1SFlagCounter + // HasStart checks if Start has been set in PatternFlowGtpv1SFlagCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv1SFlagCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv1SFlagCounter + SetStep(value uint32) PatternFlowGtpv1SFlagCounter + // HasStep checks if Step has been set in PatternFlowGtpv1SFlagCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv1SFlagCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv1SFlagCounter + SetCount(value uint32) PatternFlowGtpv1SFlagCounter + // HasCount checks if Count has been set in PatternFlowGtpv1SFlagCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1SFlagCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1SFlagCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv1SFlagCounter object +func (obj *patternFlowGtpv1SFlagCounter) SetStart(value uint32) PatternFlowGtpv1SFlagCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1SFlagCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1SFlagCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv1SFlagCounter object +func (obj *patternFlowGtpv1SFlagCounter) SetStep(value uint32) PatternFlowGtpv1SFlagCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1SFlagCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1SFlagCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv1SFlagCounter object +func (obj *patternFlowGtpv1SFlagCounter) SetCount(value uint32) PatternFlowGtpv1SFlagCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv1SFlagCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1SFlagCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1SFlagCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1SFlagCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv1SFlagCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_s_flag_metric_tag.go b/gosnappi/pattern_flow_gtpv1_s_flag_metric_tag.go new file mode 100644 index 00000000..e9077733 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_s_flag_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv1SFlagMetricTag ***** +type patternFlowGtpv1SFlagMetricTag struct { + validation + obj *otg.PatternFlowGtpv1SFlagMetricTag + marshaller marshalPatternFlowGtpv1SFlagMetricTag + unMarshaller unMarshalPatternFlowGtpv1SFlagMetricTag +} + +func NewPatternFlowGtpv1SFlagMetricTag() PatternFlowGtpv1SFlagMetricTag { + obj := patternFlowGtpv1SFlagMetricTag{obj: &otg.PatternFlowGtpv1SFlagMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1SFlagMetricTag) msg() *otg.PatternFlowGtpv1SFlagMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv1SFlagMetricTag) setMsg(msg *otg.PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1SFlagMetricTag struct { + obj *patternFlowGtpv1SFlagMetricTag +} + +type marshalPatternFlowGtpv1SFlagMetricTag interface { + // ToProto marshals PatternFlowGtpv1SFlagMetricTag to protobuf object *otg.PatternFlowGtpv1SFlagMetricTag + ToProto() (*otg.PatternFlowGtpv1SFlagMetricTag, error) + // ToPbText marshals PatternFlowGtpv1SFlagMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1SFlagMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1SFlagMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1SFlagMetricTag struct { + obj *patternFlowGtpv1SFlagMetricTag +} + +type unMarshalPatternFlowGtpv1SFlagMetricTag interface { + // FromProto unmarshals PatternFlowGtpv1SFlagMetricTag from protobuf object *otg.PatternFlowGtpv1SFlagMetricTag + FromProto(msg *otg.PatternFlowGtpv1SFlagMetricTag) (PatternFlowGtpv1SFlagMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv1SFlagMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1SFlagMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1SFlagMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1SFlagMetricTag) Marshal() marshalPatternFlowGtpv1SFlagMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1SFlagMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1SFlagMetricTag) Unmarshal() unMarshalPatternFlowGtpv1SFlagMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1SFlagMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1SFlagMetricTag) ToProto() (*otg.PatternFlowGtpv1SFlagMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1SFlagMetricTag) FromProto(msg *otg.PatternFlowGtpv1SFlagMetricTag) (PatternFlowGtpv1SFlagMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1SFlagMetricTag) 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 *unMarshalpatternFlowGtpv1SFlagMetricTag) 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 *marshalpatternFlowGtpv1SFlagMetricTag) 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 *unMarshalpatternFlowGtpv1SFlagMetricTag) 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 *marshalpatternFlowGtpv1SFlagMetricTag) 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 *unMarshalpatternFlowGtpv1SFlagMetricTag) 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 *patternFlowGtpv1SFlagMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1SFlagMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1SFlagMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1SFlagMetricTag) Clone() (PatternFlowGtpv1SFlagMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1SFlagMetricTag() + 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 +} + +// PatternFlowGtpv1SFlagMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv1SFlagMetricTag interface { + Validation + // msg marshals PatternFlowGtpv1SFlagMetricTag to protobuf object *otg.PatternFlowGtpv1SFlagMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1SFlagMetricTag + // setMsg unmarshals PatternFlowGtpv1SFlagMetricTag from protobuf object *otg.PatternFlowGtpv1SFlagMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1SFlagMetricTag) PatternFlowGtpv1SFlagMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1SFlagMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1SFlagMetricTag + // validate validates PatternFlowGtpv1SFlagMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1SFlagMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv1SFlagMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv1SFlagMetricTag + SetName(value string) PatternFlowGtpv1SFlagMetricTag + // Offset returns uint32, set in PatternFlowGtpv1SFlagMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv1SFlagMetricTag + SetOffset(value uint32) PatternFlowGtpv1SFlagMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv1SFlagMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv1SFlagMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv1SFlagMetricTag + SetLength(value uint32) PatternFlowGtpv1SFlagMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv1SFlagMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv1SFlagMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv1SFlagMetricTag object +func (obj *patternFlowGtpv1SFlagMetricTag) SetName(value string) PatternFlowGtpv1SFlagMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1SFlagMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1SFlagMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv1SFlagMetricTag object +func (obj *patternFlowGtpv1SFlagMetricTag) SetOffset(value uint32) PatternFlowGtpv1SFlagMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1SFlagMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1SFlagMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv1SFlagMetricTag object +func (obj *patternFlowGtpv1SFlagMetricTag) SetLength(value uint32) PatternFlowGtpv1SFlagMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv1SFlagMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1SFlagMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1SFlagMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv1SFlagMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv1SFlagMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_squence_number.go b/gosnappi/pattern_flow_gtpv1_squence_number.go new file mode 100644 index 00000000..d938aa6e --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_squence_number.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv1SquenceNumber ***** +type patternFlowGtpv1SquenceNumber struct { + validation + obj *otg.PatternFlowGtpv1SquenceNumber + marshaller marshalPatternFlowGtpv1SquenceNumber + unMarshaller unMarshalPatternFlowGtpv1SquenceNumber + incrementHolder PatternFlowGtpv1SquenceNumberCounter + decrementHolder PatternFlowGtpv1SquenceNumberCounter + metricTagsHolder PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter +} + +func NewPatternFlowGtpv1SquenceNumber() PatternFlowGtpv1SquenceNumber { + obj := patternFlowGtpv1SquenceNumber{obj: &otg.PatternFlowGtpv1SquenceNumber{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1SquenceNumber) msg() *otg.PatternFlowGtpv1SquenceNumber { + return obj.obj +} + +func (obj *patternFlowGtpv1SquenceNumber) setMsg(msg *otg.PatternFlowGtpv1SquenceNumber) PatternFlowGtpv1SquenceNumber { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1SquenceNumber struct { + obj *patternFlowGtpv1SquenceNumber +} + +type marshalPatternFlowGtpv1SquenceNumber interface { + // ToProto marshals PatternFlowGtpv1SquenceNumber to protobuf object *otg.PatternFlowGtpv1SquenceNumber + ToProto() (*otg.PatternFlowGtpv1SquenceNumber, error) + // ToPbText marshals PatternFlowGtpv1SquenceNumber to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1SquenceNumber to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1SquenceNumber to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1SquenceNumber struct { + obj *patternFlowGtpv1SquenceNumber +} + +type unMarshalPatternFlowGtpv1SquenceNumber interface { + // FromProto unmarshals PatternFlowGtpv1SquenceNumber from protobuf object *otg.PatternFlowGtpv1SquenceNumber + FromProto(msg *otg.PatternFlowGtpv1SquenceNumber) (PatternFlowGtpv1SquenceNumber, error) + // FromPbText unmarshals PatternFlowGtpv1SquenceNumber from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1SquenceNumber from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1SquenceNumber from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1SquenceNumber) Marshal() marshalPatternFlowGtpv1SquenceNumber { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1SquenceNumber{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1SquenceNumber) Unmarshal() unMarshalPatternFlowGtpv1SquenceNumber { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1SquenceNumber{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1SquenceNumber) ToProto() (*otg.PatternFlowGtpv1SquenceNumber, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1SquenceNumber) FromProto(msg *otg.PatternFlowGtpv1SquenceNumber) (PatternFlowGtpv1SquenceNumber, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1SquenceNumber) 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 *unMarshalpatternFlowGtpv1SquenceNumber) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv1SquenceNumber) 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 *unMarshalpatternFlowGtpv1SquenceNumber) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv1SquenceNumber) 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 *unMarshalpatternFlowGtpv1SquenceNumber) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv1SquenceNumber) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1SquenceNumber) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1SquenceNumber) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1SquenceNumber) Clone() (PatternFlowGtpv1SquenceNumber, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1SquenceNumber() + 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 +} + +func (obj *patternFlowGtpv1SquenceNumber) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv1SquenceNumber is sequence number. Exists if any of the e_flag, s_flag, or pn_flag bits are on. Must be interpreted only if the s_flag bit is on. +type PatternFlowGtpv1SquenceNumber interface { + Validation + // msg marshals PatternFlowGtpv1SquenceNumber to protobuf object *otg.PatternFlowGtpv1SquenceNumber + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1SquenceNumber + // setMsg unmarshals PatternFlowGtpv1SquenceNumber from protobuf object *otg.PatternFlowGtpv1SquenceNumber + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1SquenceNumber) PatternFlowGtpv1SquenceNumber + // provides marshal interface + Marshal() marshalPatternFlowGtpv1SquenceNumber + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1SquenceNumber + // validate validates PatternFlowGtpv1SquenceNumber + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1SquenceNumber, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv1SquenceNumberChoiceEnum, set in PatternFlowGtpv1SquenceNumber + Choice() PatternFlowGtpv1SquenceNumberChoiceEnum + // setChoice assigns PatternFlowGtpv1SquenceNumberChoiceEnum provided by user to PatternFlowGtpv1SquenceNumber + setChoice(value PatternFlowGtpv1SquenceNumberChoiceEnum) PatternFlowGtpv1SquenceNumber + // HasChoice checks if Choice has been set in PatternFlowGtpv1SquenceNumber + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv1SquenceNumber. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv1SquenceNumber + SetValue(value uint32) PatternFlowGtpv1SquenceNumber + // HasValue checks if Value has been set in PatternFlowGtpv1SquenceNumber + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv1SquenceNumber. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv1SquenceNumber + SetValues(value []uint32) PatternFlowGtpv1SquenceNumber + // Increment returns PatternFlowGtpv1SquenceNumberCounter, set in PatternFlowGtpv1SquenceNumber. + // PatternFlowGtpv1SquenceNumberCounter is integer counter pattern + Increment() PatternFlowGtpv1SquenceNumberCounter + // SetIncrement assigns PatternFlowGtpv1SquenceNumberCounter provided by user to PatternFlowGtpv1SquenceNumber. + // PatternFlowGtpv1SquenceNumberCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv1SquenceNumberCounter) PatternFlowGtpv1SquenceNumber + // HasIncrement checks if Increment has been set in PatternFlowGtpv1SquenceNumber + HasIncrement() bool + // Decrement returns PatternFlowGtpv1SquenceNumberCounter, set in PatternFlowGtpv1SquenceNumber. + // PatternFlowGtpv1SquenceNumberCounter is integer counter pattern + Decrement() PatternFlowGtpv1SquenceNumberCounter + // SetDecrement assigns PatternFlowGtpv1SquenceNumberCounter provided by user to PatternFlowGtpv1SquenceNumber. + // PatternFlowGtpv1SquenceNumberCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv1SquenceNumberCounter) PatternFlowGtpv1SquenceNumber + // HasDecrement checks if Decrement has been set in PatternFlowGtpv1SquenceNumber + HasDecrement() bool + // MetricTags returns PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIterIter, set in PatternFlowGtpv1SquenceNumber + MetricTags() PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter + setNil() +} + +type PatternFlowGtpv1SquenceNumberChoiceEnum string + +// Enum of Choice on PatternFlowGtpv1SquenceNumber +var PatternFlowGtpv1SquenceNumberChoice = struct { + VALUE PatternFlowGtpv1SquenceNumberChoiceEnum + VALUES PatternFlowGtpv1SquenceNumberChoiceEnum + INCREMENT PatternFlowGtpv1SquenceNumberChoiceEnum + DECREMENT PatternFlowGtpv1SquenceNumberChoiceEnum +}{ + VALUE: PatternFlowGtpv1SquenceNumberChoiceEnum("value"), + VALUES: PatternFlowGtpv1SquenceNumberChoiceEnum("values"), + INCREMENT: PatternFlowGtpv1SquenceNumberChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv1SquenceNumberChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv1SquenceNumber) Choice() PatternFlowGtpv1SquenceNumberChoiceEnum { + return PatternFlowGtpv1SquenceNumberChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv1SquenceNumber) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv1SquenceNumber) setChoice(value PatternFlowGtpv1SquenceNumberChoiceEnum) PatternFlowGtpv1SquenceNumber { + intValue, ok := otg.PatternFlowGtpv1SquenceNumber_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv1SquenceNumberChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv1SquenceNumber_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv1SquenceNumberChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv1SquenceNumberChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv1SquenceNumberChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv1SquenceNumberCounter().msg() + } + + if value == PatternFlowGtpv1SquenceNumberChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv1SquenceNumberCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1SquenceNumber) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1SquenceNumber) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv1SquenceNumber object +func (obj *patternFlowGtpv1SquenceNumber) SetValue(value uint32) PatternFlowGtpv1SquenceNumber { + obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv1SquenceNumber) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv1SquenceNumber object +func (obj *patternFlowGtpv1SquenceNumber) SetValues(value []uint32) PatternFlowGtpv1SquenceNumber { + obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv1SquenceNumberCounter +func (obj *patternFlowGtpv1SquenceNumber) Increment() PatternFlowGtpv1SquenceNumberCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv1SquenceNumberCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv1SquenceNumberCounter +func (obj *patternFlowGtpv1SquenceNumber) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv1SquenceNumberCounter value in the PatternFlowGtpv1SquenceNumber object +func (obj *patternFlowGtpv1SquenceNumber) SetIncrement(value PatternFlowGtpv1SquenceNumberCounter) PatternFlowGtpv1SquenceNumber { + obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1SquenceNumberCounter +func (obj *patternFlowGtpv1SquenceNumber) Decrement() PatternFlowGtpv1SquenceNumberCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv1SquenceNumberCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1SquenceNumberCounter +func (obj *patternFlowGtpv1SquenceNumber) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv1SquenceNumberCounter value in the PatternFlowGtpv1SquenceNumber object +func (obj *patternFlowGtpv1SquenceNumber) SetDecrement(value PatternFlowGtpv1SquenceNumberCounter) PatternFlowGtpv1SquenceNumber { + obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv1SquenceNumberMetricTag +func (obj *patternFlowGtpv1SquenceNumber) MetricTags() PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv1SquenceNumberMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter struct { + obj *patternFlowGtpv1SquenceNumber + patternFlowGtpv1SquenceNumberMetricTagSlice []PatternFlowGtpv1SquenceNumberMetricTag + fieldPtr *[]*otg.PatternFlowGtpv1SquenceNumberMetricTag +} + +func newPatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter(ptr *[]*otg.PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { + return &patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter interface { + setMsg(*patternFlowGtpv1SquenceNumber) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter + Items() []PatternFlowGtpv1SquenceNumberMetricTag + Add() PatternFlowGtpv1SquenceNumberMetricTag + Append(items ...PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter + Set(index int, newObj PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter + Clear() PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter + clearHolderSlice() PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter + appendHolderSlice(item PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter +} + +func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) setMsg(msg *patternFlowGtpv1SquenceNumber) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv1SquenceNumberMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) Items() []PatternFlowGtpv1SquenceNumberMetricTag { + return obj.patternFlowGtpv1SquenceNumberMetricTagSlice +} + +func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) Add() PatternFlowGtpv1SquenceNumberMetricTag { + newObj := &otg.PatternFlowGtpv1SquenceNumberMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv1SquenceNumberMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv1SquenceNumberMetricTagSlice = append(obj.patternFlowGtpv1SquenceNumberMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) Append(items ...PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv1SquenceNumberMetricTagSlice = append(obj.patternFlowGtpv1SquenceNumberMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) Set(index int, newObj PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv1SquenceNumberMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) Clear() PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv1SquenceNumberMetricTag{} + obj.patternFlowGtpv1SquenceNumberMetricTagSlice = []PatternFlowGtpv1SquenceNumberMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) clearHolderSlice() PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { + if len(obj.patternFlowGtpv1SquenceNumberMetricTagSlice) > 0 { + obj.patternFlowGtpv1SquenceNumberMetricTagSlice = []PatternFlowGtpv1SquenceNumberMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter) appendHolderSlice(item PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberPatternFlowGtpv1SquenceNumberMetricTagIter { + obj.patternFlowGtpv1SquenceNumberMetricTagSlice = append(obj.patternFlowGtpv1SquenceNumberMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv1SquenceNumber) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1SquenceNumber.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv1SquenceNumber.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv1SquenceNumberMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv1SquenceNumber) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv1SquenceNumberChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv1SquenceNumberChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv1SquenceNumberChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv1SquenceNumberChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv1SquenceNumberChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv1SquenceNumberChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1SquenceNumber") + } + } else { + intVal := otg.PatternFlowGtpv1SquenceNumber_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv1SquenceNumber_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_squence_number_counter.go b/gosnappi/pattern_flow_gtpv1_squence_number_counter.go new file mode 100644 index 00000000..8c94ac24 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_squence_number_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv1SquenceNumberCounter ***** +type patternFlowGtpv1SquenceNumberCounter struct { + validation + obj *otg.PatternFlowGtpv1SquenceNumberCounter + marshaller marshalPatternFlowGtpv1SquenceNumberCounter + unMarshaller unMarshalPatternFlowGtpv1SquenceNumberCounter +} + +func NewPatternFlowGtpv1SquenceNumberCounter() PatternFlowGtpv1SquenceNumberCounter { + obj := patternFlowGtpv1SquenceNumberCounter{obj: &otg.PatternFlowGtpv1SquenceNumberCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1SquenceNumberCounter) msg() *otg.PatternFlowGtpv1SquenceNumberCounter { + return obj.obj +} + +func (obj *patternFlowGtpv1SquenceNumberCounter) setMsg(msg *otg.PatternFlowGtpv1SquenceNumberCounter) PatternFlowGtpv1SquenceNumberCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1SquenceNumberCounter struct { + obj *patternFlowGtpv1SquenceNumberCounter +} + +type marshalPatternFlowGtpv1SquenceNumberCounter interface { + // ToProto marshals PatternFlowGtpv1SquenceNumberCounter to protobuf object *otg.PatternFlowGtpv1SquenceNumberCounter + ToProto() (*otg.PatternFlowGtpv1SquenceNumberCounter, error) + // ToPbText marshals PatternFlowGtpv1SquenceNumberCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1SquenceNumberCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1SquenceNumberCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1SquenceNumberCounter struct { + obj *patternFlowGtpv1SquenceNumberCounter +} + +type unMarshalPatternFlowGtpv1SquenceNumberCounter interface { + // FromProto unmarshals PatternFlowGtpv1SquenceNumberCounter from protobuf object *otg.PatternFlowGtpv1SquenceNumberCounter + FromProto(msg *otg.PatternFlowGtpv1SquenceNumberCounter) (PatternFlowGtpv1SquenceNumberCounter, error) + // FromPbText unmarshals PatternFlowGtpv1SquenceNumberCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1SquenceNumberCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1SquenceNumberCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1SquenceNumberCounter) Marshal() marshalPatternFlowGtpv1SquenceNumberCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1SquenceNumberCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1SquenceNumberCounter) Unmarshal() unMarshalPatternFlowGtpv1SquenceNumberCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1SquenceNumberCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1SquenceNumberCounter) ToProto() (*otg.PatternFlowGtpv1SquenceNumberCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1SquenceNumberCounter) FromProto(msg *otg.PatternFlowGtpv1SquenceNumberCounter) (PatternFlowGtpv1SquenceNumberCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1SquenceNumberCounter) 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 *unMarshalpatternFlowGtpv1SquenceNumberCounter) 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 *marshalpatternFlowGtpv1SquenceNumberCounter) 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 *unMarshalpatternFlowGtpv1SquenceNumberCounter) 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 *marshalpatternFlowGtpv1SquenceNumberCounter) 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 *unMarshalpatternFlowGtpv1SquenceNumberCounter) 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 *patternFlowGtpv1SquenceNumberCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1SquenceNumberCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1SquenceNumberCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1SquenceNumberCounter) Clone() (PatternFlowGtpv1SquenceNumberCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1SquenceNumberCounter() + 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 +} + +// PatternFlowGtpv1SquenceNumberCounter is integer counter pattern +type PatternFlowGtpv1SquenceNumberCounter interface { + Validation + // msg marshals PatternFlowGtpv1SquenceNumberCounter to protobuf object *otg.PatternFlowGtpv1SquenceNumberCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1SquenceNumberCounter + // setMsg unmarshals PatternFlowGtpv1SquenceNumberCounter from protobuf object *otg.PatternFlowGtpv1SquenceNumberCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1SquenceNumberCounter) PatternFlowGtpv1SquenceNumberCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv1SquenceNumberCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1SquenceNumberCounter + // validate validates PatternFlowGtpv1SquenceNumberCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1SquenceNumberCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv1SquenceNumberCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv1SquenceNumberCounter + SetStart(value uint32) PatternFlowGtpv1SquenceNumberCounter + // HasStart checks if Start has been set in PatternFlowGtpv1SquenceNumberCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv1SquenceNumberCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv1SquenceNumberCounter + SetStep(value uint32) PatternFlowGtpv1SquenceNumberCounter + // HasStep checks if Step has been set in PatternFlowGtpv1SquenceNumberCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv1SquenceNumberCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv1SquenceNumberCounter + SetCount(value uint32) PatternFlowGtpv1SquenceNumberCounter + // HasCount checks if Count has been set in PatternFlowGtpv1SquenceNumberCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1SquenceNumberCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1SquenceNumberCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv1SquenceNumberCounter object +func (obj *patternFlowGtpv1SquenceNumberCounter) SetStart(value uint32) PatternFlowGtpv1SquenceNumberCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1SquenceNumberCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1SquenceNumberCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv1SquenceNumberCounter object +func (obj *patternFlowGtpv1SquenceNumberCounter) SetStep(value uint32) PatternFlowGtpv1SquenceNumberCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1SquenceNumberCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1SquenceNumberCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv1SquenceNumberCounter object +func (obj *patternFlowGtpv1SquenceNumberCounter) SetCount(value uint32) PatternFlowGtpv1SquenceNumberCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv1SquenceNumberCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1SquenceNumberCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1SquenceNumberCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1SquenceNumberCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv1SquenceNumberCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_squence_number_metric_tag.go b/gosnappi/pattern_flow_gtpv1_squence_number_metric_tag.go new file mode 100644 index 00000000..5a120d21 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_squence_number_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv1SquenceNumberMetricTag ***** +type patternFlowGtpv1SquenceNumberMetricTag struct { + validation + obj *otg.PatternFlowGtpv1SquenceNumberMetricTag + marshaller marshalPatternFlowGtpv1SquenceNumberMetricTag + unMarshaller unMarshalPatternFlowGtpv1SquenceNumberMetricTag +} + +func NewPatternFlowGtpv1SquenceNumberMetricTag() PatternFlowGtpv1SquenceNumberMetricTag { + obj := patternFlowGtpv1SquenceNumberMetricTag{obj: &otg.PatternFlowGtpv1SquenceNumberMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1SquenceNumberMetricTag) msg() *otg.PatternFlowGtpv1SquenceNumberMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv1SquenceNumberMetricTag) setMsg(msg *otg.PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1SquenceNumberMetricTag struct { + obj *patternFlowGtpv1SquenceNumberMetricTag +} + +type marshalPatternFlowGtpv1SquenceNumberMetricTag interface { + // ToProto marshals PatternFlowGtpv1SquenceNumberMetricTag to protobuf object *otg.PatternFlowGtpv1SquenceNumberMetricTag + ToProto() (*otg.PatternFlowGtpv1SquenceNumberMetricTag, error) + // ToPbText marshals PatternFlowGtpv1SquenceNumberMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1SquenceNumberMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1SquenceNumberMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1SquenceNumberMetricTag struct { + obj *patternFlowGtpv1SquenceNumberMetricTag +} + +type unMarshalPatternFlowGtpv1SquenceNumberMetricTag interface { + // FromProto unmarshals PatternFlowGtpv1SquenceNumberMetricTag from protobuf object *otg.PatternFlowGtpv1SquenceNumberMetricTag + FromProto(msg *otg.PatternFlowGtpv1SquenceNumberMetricTag) (PatternFlowGtpv1SquenceNumberMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv1SquenceNumberMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1SquenceNumberMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1SquenceNumberMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1SquenceNumberMetricTag) Marshal() marshalPatternFlowGtpv1SquenceNumberMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1SquenceNumberMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1SquenceNumberMetricTag) Unmarshal() unMarshalPatternFlowGtpv1SquenceNumberMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1SquenceNumberMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1SquenceNumberMetricTag) ToProto() (*otg.PatternFlowGtpv1SquenceNumberMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1SquenceNumberMetricTag) FromProto(msg *otg.PatternFlowGtpv1SquenceNumberMetricTag) (PatternFlowGtpv1SquenceNumberMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1SquenceNumberMetricTag) 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 *unMarshalpatternFlowGtpv1SquenceNumberMetricTag) 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 *marshalpatternFlowGtpv1SquenceNumberMetricTag) 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 *unMarshalpatternFlowGtpv1SquenceNumberMetricTag) 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 *marshalpatternFlowGtpv1SquenceNumberMetricTag) 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 *unMarshalpatternFlowGtpv1SquenceNumberMetricTag) 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 *patternFlowGtpv1SquenceNumberMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1SquenceNumberMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1SquenceNumberMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1SquenceNumberMetricTag) Clone() (PatternFlowGtpv1SquenceNumberMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1SquenceNumberMetricTag() + 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 +} + +// PatternFlowGtpv1SquenceNumberMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv1SquenceNumberMetricTag interface { + Validation + // msg marshals PatternFlowGtpv1SquenceNumberMetricTag to protobuf object *otg.PatternFlowGtpv1SquenceNumberMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1SquenceNumberMetricTag + // setMsg unmarshals PatternFlowGtpv1SquenceNumberMetricTag from protobuf object *otg.PatternFlowGtpv1SquenceNumberMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1SquenceNumberMetricTag) PatternFlowGtpv1SquenceNumberMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1SquenceNumberMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1SquenceNumberMetricTag + // validate validates PatternFlowGtpv1SquenceNumberMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1SquenceNumberMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv1SquenceNumberMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv1SquenceNumberMetricTag + SetName(value string) PatternFlowGtpv1SquenceNumberMetricTag + // Offset returns uint32, set in PatternFlowGtpv1SquenceNumberMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv1SquenceNumberMetricTag + SetOffset(value uint32) PatternFlowGtpv1SquenceNumberMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv1SquenceNumberMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv1SquenceNumberMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv1SquenceNumberMetricTag + SetLength(value uint32) PatternFlowGtpv1SquenceNumberMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv1SquenceNumberMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv1SquenceNumberMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv1SquenceNumberMetricTag object +func (obj *patternFlowGtpv1SquenceNumberMetricTag) SetName(value string) PatternFlowGtpv1SquenceNumberMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1SquenceNumberMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1SquenceNumberMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv1SquenceNumberMetricTag object +func (obj *patternFlowGtpv1SquenceNumberMetricTag) SetOffset(value uint32) PatternFlowGtpv1SquenceNumberMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1SquenceNumberMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1SquenceNumberMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv1SquenceNumberMetricTag object +func (obj *patternFlowGtpv1SquenceNumberMetricTag) SetLength(value uint32) PatternFlowGtpv1SquenceNumberMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv1SquenceNumberMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1SquenceNumberMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1SquenceNumberMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv1SquenceNumberMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv1SquenceNumberMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_teid.go b/gosnappi/pattern_flow_gtpv1_teid.go new file mode 100644 index 00000000..7b9df3dc --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_teid.go @@ -0,0 +1,640 @@ +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" +) + +// ***** PatternFlowGtpv1Teid ***** +type patternFlowGtpv1Teid struct { + validation + obj *otg.PatternFlowGtpv1Teid + marshaller marshalPatternFlowGtpv1Teid + unMarshaller unMarshalPatternFlowGtpv1Teid + incrementHolder PatternFlowGtpv1TeidCounter + decrementHolder PatternFlowGtpv1TeidCounter + metricTagsHolder PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter +} + +func NewPatternFlowGtpv1Teid() PatternFlowGtpv1Teid { + obj := patternFlowGtpv1Teid{obj: &otg.PatternFlowGtpv1Teid{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1Teid) msg() *otg.PatternFlowGtpv1Teid { + return obj.obj +} + +func (obj *patternFlowGtpv1Teid) setMsg(msg *otg.PatternFlowGtpv1Teid) PatternFlowGtpv1Teid { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1Teid struct { + obj *patternFlowGtpv1Teid +} + +type marshalPatternFlowGtpv1Teid interface { + // ToProto marshals PatternFlowGtpv1Teid to protobuf object *otg.PatternFlowGtpv1Teid + ToProto() (*otg.PatternFlowGtpv1Teid, error) + // ToPbText marshals PatternFlowGtpv1Teid to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1Teid to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1Teid to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1Teid struct { + obj *patternFlowGtpv1Teid +} + +type unMarshalPatternFlowGtpv1Teid interface { + // FromProto unmarshals PatternFlowGtpv1Teid from protobuf object *otg.PatternFlowGtpv1Teid + FromProto(msg *otg.PatternFlowGtpv1Teid) (PatternFlowGtpv1Teid, error) + // FromPbText unmarshals PatternFlowGtpv1Teid from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1Teid from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1Teid from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1Teid) Marshal() marshalPatternFlowGtpv1Teid { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1Teid{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1Teid) Unmarshal() unMarshalPatternFlowGtpv1Teid { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1Teid{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1Teid) ToProto() (*otg.PatternFlowGtpv1Teid, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1Teid) FromProto(msg *otg.PatternFlowGtpv1Teid) (PatternFlowGtpv1Teid, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1Teid) 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 *unMarshalpatternFlowGtpv1Teid) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv1Teid) 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 *unMarshalpatternFlowGtpv1Teid) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv1Teid) 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 *unMarshalpatternFlowGtpv1Teid) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv1Teid) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1Teid) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1Teid) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1Teid) Clone() (PatternFlowGtpv1Teid, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1Teid() + 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 +} + +func (obj *patternFlowGtpv1Teid) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv1Teid is tunnel endpoint identifier (TEID) used to multiplex connections in the same GTP tunnel +type PatternFlowGtpv1Teid interface { + Validation + // msg marshals PatternFlowGtpv1Teid to protobuf object *otg.PatternFlowGtpv1Teid + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1Teid + // setMsg unmarshals PatternFlowGtpv1Teid from protobuf object *otg.PatternFlowGtpv1Teid + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1Teid) PatternFlowGtpv1Teid + // provides marshal interface + Marshal() marshalPatternFlowGtpv1Teid + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1Teid + // validate validates PatternFlowGtpv1Teid + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1Teid, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv1TeidChoiceEnum, set in PatternFlowGtpv1Teid + Choice() PatternFlowGtpv1TeidChoiceEnum + // setChoice assigns PatternFlowGtpv1TeidChoiceEnum provided by user to PatternFlowGtpv1Teid + setChoice(value PatternFlowGtpv1TeidChoiceEnum) PatternFlowGtpv1Teid + // HasChoice checks if Choice has been set in PatternFlowGtpv1Teid + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv1Teid. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv1Teid + SetValue(value uint32) PatternFlowGtpv1Teid + // HasValue checks if Value has been set in PatternFlowGtpv1Teid + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv1Teid. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv1Teid + SetValues(value []uint32) PatternFlowGtpv1Teid + // Increment returns PatternFlowGtpv1TeidCounter, set in PatternFlowGtpv1Teid. + // PatternFlowGtpv1TeidCounter is integer counter pattern + Increment() PatternFlowGtpv1TeidCounter + // SetIncrement assigns PatternFlowGtpv1TeidCounter provided by user to PatternFlowGtpv1Teid. + // PatternFlowGtpv1TeidCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv1TeidCounter) PatternFlowGtpv1Teid + // HasIncrement checks if Increment has been set in PatternFlowGtpv1Teid + HasIncrement() bool + // Decrement returns PatternFlowGtpv1TeidCounter, set in PatternFlowGtpv1Teid. + // PatternFlowGtpv1TeidCounter is integer counter pattern + Decrement() PatternFlowGtpv1TeidCounter + // SetDecrement assigns PatternFlowGtpv1TeidCounter provided by user to PatternFlowGtpv1Teid. + // PatternFlowGtpv1TeidCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv1TeidCounter) PatternFlowGtpv1Teid + // HasDecrement checks if Decrement has been set in PatternFlowGtpv1Teid + HasDecrement() bool + // MetricTags returns PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIterIter, set in PatternFlowGtpv1Teid + MetricTags() PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter + setNil() +} + +type PatternFlowGtpv1TeidChoiceEnum string + +// Enum of Choice on PatternFlowGtpv1Teid +var PatternFlowGtpv1TeidChoice = struct { + VALUE PatternFlowGtpv1TeidChoiceEnum + VALUES PatternFlowGtpv1TeidChoiceEnum + INCREMENT PatternFlowGtpv1TeidChoiceEnum + DECREMENT PatternFlowGtpv1TeidChoiceEnum +}{ + VALUE: PatternFlowGtpv1TeidChoiceEnum("value"), + VALUES: PatternFlowGtpv1TeidChoiceEnum("values"), + INCREMENT: PatternFlowGtpv1TeidChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv1TeidChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv1Teid) Choice() PatternFlowGtpv1TeidChoiceEnum { + return PatternFlowGtpv1TeidChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv1Teid) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv1Teid) setChoice(value PatternFlowGtpv1TeidChoiceEnum) PatternFlowGtpv1Teid { + intValue, ok := otg.PatternFlowGtpv1Teid_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv1TeidChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv1Teid_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv1TeidChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv1TeidChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv1TeidChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv1TeidCounter().msg() + } + + if value == PatternFlowGtpv1TeidChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv1TeidCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1Teid) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv1TeidChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1Teid) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv1Teid object +func (obj *patternFlowGtpv1Teid) SetValue(value uint32) PatternFlowGtpv1Teid { + obj.setChoice(PatternFlowGtpv1TeidChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv1Teid) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv1Teid object +func (obj *patternFlowGtpv1Teid) SetValues(value []uint32) PatternFlowGtpv1Teid { + obj.setChoice(PatternFlowGtpv1TeidChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv1TeidCounter +func (obj *patternFlowGtpv1Teid) Increment() PatternFlowGtpv1TeidCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv1TeidChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv1TeidCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv1TeidCounter +func (obj *patternFlowGtpv1Teid) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv1TeidCounter value in the PatternFlowGtpv1Teid object +func (obj *patternFlowGtpv1Teid) SetIncrement(value PatternFlowGtpv1TeidCounter) PatternFlowGtpv1Teid { + obj.setChoice(PatternFlowGtpv1TeidChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1TeidCounter +func (obj *patternFlowGtpv1Teid) Decrement() PatternFlowGtpv1TeidCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv1TeidChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv1TeidCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1TeidCounter +func (obj *patternFlowGtpv1Teid) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv1TeidCounter value in the PatternFlowGtpv1Teid object +func (obj *patternFlowGtpv1Teid) SetDecrement(value PatternFlowGtpv1TeidCounter) PatternFlowGtpv1Teid { + obj.setChoice(PatternFlowGtpv1TeidChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv1TeidMetricTag +func (obj *patternFlowGtpv1Teid) MetricTags() PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv1TeidMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter struct { + obj *patternFlowGtpv1Teid + patternFlowGtpv1TeidMetricTagSlice []PatternFlowGtpv1TeidMetricTag + fieldPtr *[]*otg.PatternFlowGtpv1TeidMetricTag +} + +func newPatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter(ptr *[]*otg.PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { + return &patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter interface { + setMsg(*patternFlowGtpv1Teid) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter + Items() []PatternFlowGtpv1TeidMetricTag + Add() PatternFlowGtpv1TeidMetricTag + Append(items ...PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter + Set(index int, newObj PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter + Clear() PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter + clearHolderSlice() PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter + appendHolderSlice(item PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter +} + +func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) setMsg(msg *patternFlowGtpv1Teid) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv1TeidMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) Items() []PatternFlowGtpv1TeidMetricTag { + return obj.patternFlowGtpv1TeidMetricTagSlice +} + +func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) Add() PatternFlowGtpv1TeidMetricTag { + newObj := &otg.PatternFlowGtpv1TeidMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv1TeidMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv1TeidMetricTagSlice = append(obj.patternFlowGtpv1TeidMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) Append(items ...PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv1TeidMetricTagSlice = append(obj.patternFlowGtpv1TeidMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) Set(index int, newObj PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv1TeidMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) Clear() PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv1TeidMetricTag{} + obj.patternFlowGtpv1TeidMetricTagSlice = []PatternFlowGtpv1TeidMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) clearHolderSlice() PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { + if len(obj.patternFlowGtpv1TeidMetricTagSlice) > 0 { + obj.patternFlowGtpv1TeidMetricTagSlice = []PatternFlowGtpv1TeidMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter) appendHolderSlice(item PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidPatternFlowGtpv1TeidMetricTagIter { + obj.patternFlowGtpv1TeidMetricTagSlice = append(obj.patternFlowGtpv1TeidMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv1Teid) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv1TeidMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv1Teid) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv1TeidChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv1TeidChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv1TeidChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv1TeidChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv1TeidChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv1TeidChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1Teid") + } + } else { + intVal := otg.PatternFlowGtpv1Teid_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv1Teid_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_teid_counter.go b/gosnappi/pattern_flow_gtpv1_teid_counter.go new file mode 100644 index 00000000..f50cb5ff --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_teid_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowGtpv1TeidCounter ***** +type patternFlowGtpv1TeidCounter struct { + validation + obj *otg.PatternFlowGtpv1TeidCounter + marshaller marshalPatternFlowGtpv1TeidCounter + unMarshaller unMarshalPatternFlowGtpv1TeidCounter +} + +func NewPatternFlowGtpv1TeidCounter() PatternFlowGtpv1TeidCounter { + obj := patternFlowGtpv1TeidCounter{obj: &otg.PatternFlowGtpv1TeidCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1TeidCounter) msg() *otg.PatternFlowGtpv1TeidCounter { + return obj.obj +} + +func (obj *patternFlowGtpv1TeidCounter) setMsg(msg *otg.PatternFlowGtpv1TeidCounter) PatternFlowGtpv1TeidCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1TeidCounter struct { + obj *patternFlowGtpv1TeidCounter +} + +type marshalPatternFlowGtpv1TeidCounter interface { + // ToProto marshals PatternFlowGtpv1TeidCounter to protobuf object *otg.PatternFlowGtpv1TeidCounter + ToProto() (*otg.PatternFlowGtpv1TeidCounter, error) + // ToPbText marshals PatternFlowGtpv1TeidCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1TeidCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1TeidCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1TeidCounter struct { + obj *patternFlowGtpv1TeidCounter +} + +type unMarshalPatternFlowGtpv1TeidCounter interface { + // FromProto unmarshals PatternFlowGtpv1TeidCounter from protobuf object *otg.PatternFlowGtpv1TeidCounter + FromProto(msg *otg.PatternFlowGtpv1TeidCounter) (PatternFlowGtpv1TeidCounter, error) + // FromPbText unmarshals PatternFlowGtpv1TeidCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1TeidCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1TeidCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1TeidCounter) Marshal() marshalPatternFlowGtpv1TeidCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1TeidCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1TeidCounter) Unmarshal() unMarshalPatternFlowGtpv1TeidCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1TeidCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1TeidCounter) ToProto() (*otg.PatternFlowGtpv1TeidCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1TeidCounter) FromProto(msg *otg.PatternFlowGtpv1TeidCounter) (PatternFlowGtpv1TeidCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1TeidCounter) 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 *unMarshalpatternFlowGtpv1TeidCounter) 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 *marshalpatternFlowGtpv1TeidCounter) 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 *unMarshalpatternFlowGtpv1TeidCounter) 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 *marshalpatternFlowGtpv1TeidCounter) 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 *unMarshalpatternFlowGtpv1TeidCounter) 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 *patternFlowGtpv1TeidCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1TeidCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1TeidCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1TeidCounter) Clone() (PatternFlowGtpv1TeidCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1TeidCounter() + 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 +} + +// PatternFlowGtpv1TeidCounter is integer counter pattern +type PatternFlowGtpv1TeidCounter interface { + Validation + // msg marshals PatternFlowGtpv1TeidCounter to protobuf object *otg.PatternFlowGtpv1TeidCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1TeidCounter + // setMsg unmarshals PatternFlowGtpv1TeidCounter from protobuf object *otg.PatternFlowGtpv1TeidCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1TeidCounter) PatternFlowGtpv1TeidCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv1TeidCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1TeidCounter + // validate validates PatternFlowGtpv1TeidCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1TeidCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv1TeidCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv1TeidCounter + SetStart(value uint32) PatternFlowGtpv1TeidCounter + // HasStart checks if Start has been set in PatternFlowGtpv1TeidCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv1TeidCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv1TeidCounter + SetStep(value uint32) PatternFlowGtpv1TeidCounter + // HasStep checks if Step has been set in PatternFlowGtpv1TeidCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv1TeidCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv1TeidCounter + SetCount(value uint32) PatternFlowGtpv1TeidCounter + // HasCount checks if Count has been set in PatternFlowGtpv1TeidCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1TeidCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1TeidCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv1TeidCounter object +func (obj *patternFlowGtpv1TeidCounter) SetStart(value uint32) PatternFlowGtpv1TeidCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1TeidCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1TeidCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv1TeidCounter object +func (obj *patternFlowGtpv1TeidCounter) SetStep(value uint32) PatternFlowGtpv1TeidCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1TeidCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1TeidCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv1TeidCounter object +func (obj *patternFlowGtpv1TeidCounter) SetCount(value uint32) PatternFlowGtpv1TeidCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv1TeidCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowGtpv1TeidCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_teid_metric_tag.go b/gosnappi/pattern_flow_gtpv1_teid_metric_tag.go new file mode 100644 index 00000000..f78a8913 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_teid_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv1TeidMetricTag ***** +type patternFlowGtpv1TeidMetricTag struct { + validation + obj *otg.PatternFlowGtpv1TeidMetricTag + marshaller marshalPatternFlowGtpv1TeidMetricTag + unMarshaller unMarshalPatternFlowGtpv1TeidMetricTag +} + +func NewPatternFlowGtpv1TeidMetricTag() PatternFlowGtpv1TeidMetricTag { + obj := patternFlowGtpv1TeidMetricTag{obj: &otg.PatternFlowGtpv1TeidMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1TeidMetricTag) msg() *otg.PatternFlowGtpv1TeidMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv1TeidMetricTag) setMsg(msg *otg.PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1TeidMetricTag struct { + obj *patternFlowGtpv1TeidMetricTag +} + +type marshalPatternFlowGtpv1TeidMetricTag interface { + // ToProto marshals PatternFlowGtpv1TeidMetricTag to protobuf object *otg.PatternFlowGtpv1TeidMetricTag + ToProto() (*otg.PatternFlowGtpv1TeidMetricTag, error) + // ToPbText marshals PatternFlowGtpv1TeidMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1TeidMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1TeidMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1TeidMetricTag struct { + obj *patternFlowGtpv1TeidMetricTag +} + +type unMarshalPatternFlowGtpv1TeidMetricTag interface { + // FromProto unmarshals PatternFlowGtpv1TeidMetricTag from protobuf object *otg.PatternFlowGtpv1TeidMetricTag + FromProto(msg *otg.PatternFlowGtpv1TeidMetricTag) (PatternFlowGtpv1TeidMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv1TeidMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1TeidMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1TeidMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1TeidMetricTag) Marshal() marshalPatternFlowGtpv1TeidMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1TeidMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1TeidMetricTag) Unmarshal() unMarshalPatternFlowGtpv1TeidMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1TeidMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1TeidMetricTag) ToProto() (*otg.PatternFlowGtpv1TeidMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1TeidMetricTag) FromProto(msg *otg.PatternFlowGtpv1TeidMetricTag) (PatternFlowGtpv1TeidMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1TeidMetricTag) 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 *unMarshalpatternFlowGtpv1TeidMetricTag) 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 *marshalpatternFlowGtpv1TeidMetricTag) 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 *unMarshalpatternFlowGtpv1TeidMetricTag) 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 *marshalpatternFlowGtpv1TeidMetricTag) 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 *unMarshalpatternFlowGtpv1TeidMetricTag) 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 *patternFlowGtpv1TeidMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1TeidMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1TeidMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1TeidMetricTag) Clone() (PatternFlowGtpv1TeidMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1TeidMetricTag() + 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 +} + +// PatternFlowGtpv1TeidMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv1TeidMetricTag interface { + Validation + // msg marshals PatternFlowGtpv1TeidMetricTag to protobuf object *otg.PatternFlowGtpv1TeidMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1TeidMetricTag + // setMsg unmarshals PatternFlowGtpv1TeidMetricTag from protobuf object *otg.PatternFlowGtpv1TeidMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1TeidMetricTag) PatternFlowGtpv1TeidMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1TeidMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1TeidMetricTag + // validate validates PatternFlowGtpv1TeidMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1TeidMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv1TeidMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv1TeidMetricTag + SetName(value string) PatternFlowGtpv1TeidMetricTag + // Offset returns uint32, set in PatternFlowGtpv1TeidMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv1TeidMetricTag + SetOffset(value uint32) PatternFlowGtpv1TeidMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv1TeidMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv1TeidMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv1TeidMetricTag + SetLength(value uint32) PatternFlowGtpv1TeidMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv1TeidMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv1TeidMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv1TeidMetricTag object +func (obj *patternFlowGtpv1TeidMetricTag) SetName(value string) PatternFlowGtpv1TeidMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1TeidMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1TeidMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv1TeidMetricTag object +func (obj *patternFlowGtpv1TeidMetricTag) SetOffset(value uint32) PatternFlowGtpv1TeidMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1TeidMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1TeidMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv1TeidMetricTag object +func (obj *patternFlowGtpv1TeidMetricTag) SetLength(value uint32) PatternFlowGtpv1TeidMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv1TeidMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1TeidMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1TeidMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv1TeidMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv1TeidMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(32) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_version.go b/gosnappi/pattern_flow_gtpv1_version.go new file mode 100644 index 00000000..3420be77 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_version.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv1Version ***** +type patternFlowGtpv1Version struct { + validation + obj *otg.PatternFlowGtpv1Version + marshaller marshalPatternFlowGtpv1Version + unMarshaller unMarshalPatternFlowGtpv1Version + incrementHolder PatternFlowGtpv1VersionCounter + decrementHolder PatternFlowGtpv1VersionCounter + metricTagsHolder PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter +} + +func NewPatternFlowGtpv1Version() PatternFlowGtpv1Version { + obj := patternFlowGtpv1Version{obj: &otg.PatternFlowGtpv1Version{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1Version) msg() *otg.PatternFlowGtpv1Version { + return obj.obj +} + +func (obj *patternFlowGtpv1Version) setMsg(msg *otg.PatternFlowGtpv1Version) PatternFlowGtpv1Version { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1Version struct { + obj *patternFlowGtpv1Version +} + +type marshalPatternFlowGtpv1Version interface { + // ToProto marshals PatternFlowGtpv1Version to protobuf object *otg.PatternFlowGtpv1Version + ToProto() (*otg.PatternFlowGtpv1Version, error) + // ToPbText marshals PatternFlowGtpv1Version to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1Version to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1Version to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1Version struct { + obj *patternFlowGtpv1Version +} + +type unMarshalPatternFlowGtpv1Version interface { + // FromProto unmarshals PatternFlowGtpv1Version from protobuf object *otg.PatternFlowGtpv1Version + FromProto(msg *otg.PatternFlowGtpv1Version) (PatternFlowGtpv1Version, error) + // FromPbText unmarshals PatternFlowGtpv1Version from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1Version from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1Version from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1Version) Marshal() marshalPatternFlowGtpv1Version { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1Version{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1Version) Unmarshal() unMarshalPatternFlowGtpv1Version { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1Version{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1Version) ToProto() (*otg.PatternFlowGtpv1Version, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1Version) FromProto(msg *otg.PatternFlowGtpv1Version) (PatternFlowGtpv1Version, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1Version) 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 *unMarshalpatternFlowGtpv1Version) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv1Version) 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 *unMarshalpatternFlowGtpv1Version) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv1Version) 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 *unMarshalpatternFlowGtpv1Version) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv1Version) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1Version) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1Version) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1Version) Clone() (PatternFlowGtpv1Version, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1Version() + 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 +} + +func (obj *patternFlowGtpv1Version) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv1Version is gTPv1 version +type PatternFlowGtpv1Version interface { + Validation + // msg marshals PatternFlowGtpv1Version to protobuf object *otg.PatternFlowGtpv1Version + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1Version + // setMsg unmarshals PatternFlowGtpv1Version from protobuf object *otg.PatternFlowGtpv1Version + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1Version) PatternFlowGtpv1Version + // provides marshal interface + Marshal() marshalPatternFlowGtpv1Version + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1Version + // validate validates PatternFlowGtpv1Version + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1Version, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv1VersionChoiceEnum, set in PatternFlowGtpv1Version + Choice() PatternFlowGtpv1VersionChoiceEnum + // setChoice assigns PatternFlowGtpv1VersionChoiceEnum provided by user to PatternFlowGtpv1Version + setChoice(value PatternFlowGtpv1VersionChoiceEnum) PatternFlowGtpv1Version + // HasChoice checks if Choice has been set in PatternFlowGtpv1Version + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv1Version. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv1Version + SetValue(value uint32) PatternFlowGtpv1Version + // HasValue checks if Value has been set in PatternFlowGtpv1Version + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv1Version. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv1Version + SetValues(value []uint32) PatternFlowGtpv1Version + // Increment returns PatternFlowGtpv1VersionCounter, set in PatternFlowGtpv1Version. + // PatternFlowGtpv1VersionCounter is integer counter pattern + Increment() PatternFlowGtpv1VersionCounter + // SetIncrement assigns PatternFlowGtpv1VersionCounter provided by user to PatternFlowGtpv1Version. + // PatternFlowGtpv1VersionCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv1VersionCounter) PatternFlowGtpv1Version + // HasIncrement checks if Increment has been set in PatternFlowGtpv1Version + HasIncrement() bool + // Decrement returns PatternFlowGtpv1VersionCounter, set in PatternFlowGtpv1Version. + // PatternFlowGtpv1VersionCounter is integer counter pattern + Decrement() PatternFlowGtpv1VersionCounter + // SetDecrement assigns PatternFlowGtpv1VersionCounter provided by user to PatternFlowGtpv1Version. + // PatternFlowGtpv1VersionCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv1VersionCounter) PatternFlowGtpv1Version + // HasDecrement checks if Decrement has been set in PatternFlowGtpv1Version + HasDecrement() bool + // MetricTags returns PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIterIter, set in PatternFlowGtpv1Version + MetricTags() PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter + setNil() +} + +type PatternFlowGtpv1VersionChoiceEnum string + +// Enum of Choice on PatternFlowGtpv1Version +var PatternFlowGtpv1VersionChoice = struct { + VALUE PatternFlowGtpv1VersionChoiceEnum + VALUES PatternFlowGtpv1VersionChoiceEnum + INCREMENT PatternFlowGtpv1VersionChoiceEnum + DECREMENT PatternFlowGtpv1VersionChoiceEnum +}{ + VALUE: PatternFlowGtpv1VersionChoiceEnum("value"), + VALUES: PatternFlowGtpv1VersionChoiceEnum("values"), + INCREMENT: PatternFlowGtpv1VersionChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv1VersionChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv1Version) Choice() PatternFlowGtpv1VersionChoiceEnum { + return PatternFlowGtpv1VersionChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv1Version) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv1Version) setChoice(value PatternFlowGtpv1VersionChoiceEnum) PatternFlowGtpv1Version { + intValue, ok := otg.PatternFlowGtpv1Version_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv1VersionChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv1Version_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv1VersionChoice.VALUE { + defaultValue := uint32(1) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv1VersionChoice.VALUES { + defaultValue := []uint32{1} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv1VersionChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv1VersionCounter().msg() + } + + if value == PatternFlowGtpv1VersionChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv1VersionCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1Version) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv1VersionChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv1Version) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv1Version object +func (obj *patternFlowGtpv1Version) SetValue(value uint32) PatternFlowGtpv1Version { + obj.setChoice(PatternFlowGtpv1VersionChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv1Version) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{1}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv1Version object +func (obj *patternFlowGtpv1Version) SetValues(value []uint32) PatternFlowGtpv1Version { + obj.setChoice(PatternFlowGtpv1VersionChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv1VersionCounter +func (obj *patternFlowGtpv1Version) Increment() PatternFlowGtpv1VersionCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv1VersionChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv1VersionCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv1VersionCounter +func (obj *patternFlowGtpv1Version) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv1VersionCounter value in the PatternFlowGtpv1Version object +func (obj *patternFlowGtpv1Version) SetIncrement(value PatternFlowGtpv1VersionCounter) PatternFlowGtpv1Version { + obj.setChoice(PatternFlowGtpv1VersionChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1VersionCounter +func (obj *patternFlowGtpv1Version) Decrement() PatternFlowGtpv1VersionCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv1VersionChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv1VersionCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv1VersionCounter +func (obj *patternFlowGtpv1Version) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv1VersionCounter value in the PatternFlowGtpv1Version object +func (obj *patternFlowGtpv1Version) SetDecrement(value PatternFlowGtpv1VersionCounter) PatternFlowGtpv1Version { + obj.setChoice(PatternFlowGtpv1VersionChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv1VersionMetricTag +func (obj *patternFlowGtpv1Version) MetricTags() PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv1VersionMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter struct { + obj *patternFlowGtpv1Version + patternFlowGtpv1VersionMetricTagSlice []PatternFlowGtpv1VersionMetricTag + fieldPtr *[]*otg.PatternFlowGtpv1VersionMetricTag +} + +func newPatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter(ptr *[]*otg.PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { + return &patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter interface { + setMsg(*patternFlowGtpv1Version) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter + Items() []PatternFlowGtpv1VersionMetricTag + Add() PatternFlowGtpv1VersionMetricTag + Append(items ...PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter + Set(index int, newObj PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter + Clear() PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter + clearHolderSlice() PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter + appendHolderSlice(item PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter +} + +func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) setMsg(msg *patternFlowGtpv1Version) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv1VersionMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) Items() []PatternFlowGtpv1VersionMetricTag { + return obj.patternFlowGtpv1VersionMetricTagSlice +} + +func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) Add() PatternFlowGtpv1VersionMetricTag { + newObj := &otg.PatternFlowGtpv1VersionMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv1VersionMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv1VersionMetricTagSlice = append(obj.patternFlowGtpv1VersionMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) Append(items ...PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv1VersionMetricTagSlice = append(obj.patternFlowGtpv1VersionMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) Set(index int, newObj PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv1VersionMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) Clear() PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv1VersionMetricTag{} + obj.patternFlowGtpv1VersionMetricTagSlice = []PatternFlowGtpv1VersionMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) clearHolderSlice() PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { + if len(obj.patternFlowGtpv1VersionMetricTagSlice) > 0 { + obj.patternFlowGtpv1VersionMetricTagSlice = []PatternFlowGtpv1VersionMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter) appendHolderSlice(item PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionPatternFlowGtpv1VersionMetricTagIter { + obj.patternFlowGtpv1VersionMetricTagSlice = append(obj.patternFlowGtpv1VersionMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv1Version) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1Version.Value <= 7 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv1Version.Values <= 7 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv1VersionMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv1Version) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv1VersionChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv1VersionChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv1VersionChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv1VersionChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv1VersionChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv1VersionChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv1Version") + } + } else { + intVal := otg.PatternFlowGtpv1Version_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv1Version_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_version_counter.go b/gosnappi/pattern_flow_gtpv1_version_counter.go new file mode 100644 index 00000000..069e2573 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_version_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv1VersionCounter ***** +type patternFlowGtpv1VersionCounter struct { + validation + obj *otg.PatternFlowGtpv1VersionCounter + marshaller marshalPatternFlowGtpv1VersionCounter + unMarshaller unMarshalPatternFlowGtpv1VersionCounter +} + +func NewPatternFlowGtpv1VersionCounter() PatternFlowGtpv1VersionCounter { + obj := patternFlowGtpv1VersionCounter{obj: &otg.PatternFlowGtpv1VersionCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1VersionCounter) msg() *otg.PatternFlowGtpv1VersionCounter { + return obj.obj +} + +func (obj *patternFlowGtpv1VersionCounter) setMsg(msg *otg.PatternFlowGtpv1VersionCounter) PatternFlowGtpv1VersionCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1VersionCounter struct { + obj *patternFlowGtpv1VersionCounter +} + +type marshalPatternFlowGtpv1VersionCounter interface { + // ToProto marshals PatternFlowGtpv1VersionCounter to protobuf object *otg.PatternFlowGtpv1VersionCounter + ToProto() (*otg.PatternFlowGtpv1VersionCounter, error) + // ToPbText marshals PatternFlowGtpv1VersionCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1VersionCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1VersionCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1VersionCounter struct { + obj *patternFlowGtpv1VersionCounter +} + +type unMarshalPatternFlowGtpv1VersionCounter interface { + // FromProto unmarshals PatternFlowGtpv1VersionCounter from protobuf object *otg.PatternFlowGtpv1VersionCounter + FromProto(msg *otg.PatternFlowGtpv1VersionCounter) (PatternFlowGtpv1VersionCounter, error) + // FromPbText unmarshals PatternFlowGtpv1VersionCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1VersionCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1VersionCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1VersionCounter) Marshal() marshalPatternFlowGtpv1VersionCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1VersionCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1VersionCounter) Unmarshal() unMarshalPatternFlowGtpv1VersionCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1VersionCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1VersionCounter) ToProto() (*otg.PatternFlowGtpv1VersionCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1VersionCounter) FromProto(msg *otg.PatternFlowGtpv1VersionCounter) (PatternFlowGtpv1VersionCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1VersionCounter) 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 *unMarshalpatternFlowGtpv1VersionCounter) 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 *marshalpatternFlowGtpv1VersionCounter) 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 *unMarshalpatternFlowGtpv1VersionCounter) 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 *marshalpatternFlowGtpv1VersionCounter) 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 *unMarshalpatternFlowGtpv1VersionCounter) 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 *patternFlowGtpv1VersionCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1VersionCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1VersionCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1VersionCounter) Clone() (PatternFlowGtpv1VersionCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1VersionCounter() + 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 +} + +// PatternFlowGtpv1VersionCounter is integer counter pattern +type PatternFlowGtpv1VersionCounter interface { + Validation + // msg marshals PatternFlowGtpv1VersionCounter to protobuf object *otg.PatternFlowGtpv1VersionCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1VersionCounter + // setMsg unmarshals PatternFlowGtpv1VersionCounter from protobuf object *otg.PatternFlowGtpv1VersionCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1VersionCounter) PatternFlowGtpv1VersionCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv1VersionCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1VersionCounter + // validate validates PatternFlowGtpv1VersionCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1VersionCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv1VersionCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv1VersionCounter + SetStart(value uint32) PatternFlowGtpv1VersionCounter + // HasStart checks if Start has been set in PatternFlowGtpv1VersionCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv1VersionCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv1VersionCounter + SetStep(value uint32) PatternFlowGtpv1VersionCounter + // HasStep checks if Step has been set in PatternFlowGtpv1VersionCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv1VersionCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv1VersionCounter + SetCount(value uint32) PatternFlowGtpv1VersionCounter + // HasCount checks if Count has been set in PatternFlowGtpv1VersionCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1VersionCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv1VersionCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv1VersionCounter object +func (obj *patternFlowGtpv1VersionCounter) SetStart(value uint32) PatternFlowGtpv1VersionCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1VersionCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv1VersionCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv1VersionCounter object +func (obj *patternFlowGtpv1VersionCounter) SetStep(value uint32) PatternFlowGtpv1VersionCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1VersionCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv1VersionCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv1VersionCounter object +func (obj *patternFlowGtpv1VersionCounter) SetCount(value uint32) PatternFlowGtpv1VersionCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv1VersionCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1VersionCounter.Start <= 7 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1VersionCounter.Step <= 7 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1VersionCounter.Count <= 7 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv1VersionCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv1_version_metric_tag.go b/gosnappi/pattern_flow_gtpv1_version_metric_tag.go new file mode 100644 index 00000000..57b0130b --- /dev/null +++ b/gosnappi/pattern_flow_gtpv1_version_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv1VersionMetricTag ***** +type patternFlowGtpv1VersionMetricTag struct { + validation + obj *otg.PatternFlowGtpv1VersionMetricTag + marshaller marshalPatternFlowGtpv1VersionMetricTag + unMarshaller unMarshalPatternFlowGtpv1VersionMetricTag +} + +func NewPatternFlowGtpv1VersionMetricTag() PatternFlowGtpv1VersionMetricTag { + obj := patternFlowGtpv1VersionMetricTag{obj: &otg.PatternFlowGtpv1VersionMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv1VersionMetricTag) msg() *otg.PatternFlowGtpv1VersionMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv1VersionMetricTag) setMsg(msg *otg.PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv1VersionMetricTag struct { + obj *patternFlowGtpv1VersionMetricTag +} + +type marshalPatternFlowGtpv1VersionMetricTag interface { + // ToProto marshals PatternFlowGtpv1VersionMetricTag to protobuf object *otg.PatternFlowGtpv1VersionMetricTag + ToProto() (*otg.PatternFlowGtpv1VersionMetricTag, error) + // ToPbText marshals PatternFlowGtpv1VersionMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv1VersionMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv1VersionMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv1VersionMetricTag struct { + obj *patternFlowGtpv1VersionMetricTag +} + +type unMarshalPatternFlowGtpv1VersionMetricTag interface { + // FromProto unmarshals PatternFlowGtpv1VersionMetricTag from protobuf object *otg.PatternFlowGtpv1VersionMetricTag + FromProto(msg *otg.PatternFlowGtpv1VersionMetricTag) (PatternFlowGtpv1VersionMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv1VersionMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv1VersionMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv1VersionMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv1VersionMetricTag) Marshal() marshalPatternFlowGtpv1VersionMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv1VersionMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv1VersionMetricTag) Unmarshal() unMarshalPatternFlowGtpv1VersionMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv1VersionMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv1VersionMetricTag) ToProto() (*otg.PatternFlowGtpv1VersionMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv1VersionMetricTag) FromProto(msg *otg.PatternFlowGtpv1VersionMetricTag) (PatternFlowGtpv1VersionMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv1VersionMetricTag) 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 *unMarshalpatternFlowGtpv1VersionMetricTag) 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 *marshalpatternFlowGtpv1VersionMetricTag) 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 *unMarshalpatternFlowGtpv1VersionMetricTag) 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 *marshalpatternFlowGtpv1VersionMetricTag) 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 *unMarshalpatternFlowGtpv1VersionMetricTag) 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 *patternFlowGtpv1VersionMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1VersionMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv1VersionMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv1VersionMetricTag) Clone() (PatternFlowGtpv1VersionMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv1VersionMetricTag() + 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 +} + +// PatternFlowGtpv1VersionMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv1VersionMetricTag interface { + Validation + // msg marshals PatternFlowGtpv1VersionMetricTag to protobuf object *otg.PatternFlowGtpv1VersionMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv1VersionMetricTag + // setMsg unmarshals PatternFlowGtpv1VersionMetricTag from protobuf object *otg.PatternFlowGtpv1VersionMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv1VersionMetricTag) PatternFlowGtpv1VersionMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv1VersionMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv1VersionMetricTag + // validate validates PatternFlowGtpv1VersionMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv1VersionMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv1VersionMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv1VersionMetricTag + SetName(value string) PatternFlowGtpv1VersionMetricTag + // Offset returns uint32, set in PatternFlowGtpv1VersionMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv1VersionMetricTag + SetOffset(value uint32) PatternFlowGtpv1VersionMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv1VersionMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv1VersionMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv1VersionMetricTag + SetLength(value uint32) PatternFlowGtpv1VersionMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv1VersionMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv1VersionMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv1VersionMetricTag object +func (obj *patternFlowGtpv1VersionMetricTag) SetName(value string) PatternFlowGtpv1VersionMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1VersionMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv1VersionMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv1VersionMetricTag object +func (obj *patternFlowGtpv1VersionMetricTag) SetOffset(value uint32) PatternFlowGtpv1VersionMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1VersionMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv1VersionMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv1VersionMetricTag object +func (obj *patternFlowGtpv1VersionMetricTag) SetLength(value uint32) PatternFlowGtpv1VersionMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv1VersionMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv1VersionMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 2 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv1VersionMetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv1VersionMetricTag.Length <= 3 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv1VersionMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(3) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_message_length.go b/gosnappi/pattern_flow_gtpv2_message_length.go new file mode 100644 index 00000000..2c4d790a --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_message_length.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv2MessageLength ***** +type patternFlowGtpv2MessageLength struct { + validation + obj *otg.PatternFlowGtpv2MessageLength + marshaller marshalPatternFlowGtpv2MessageLength + unMarshaller unMarshalPatternFlowGtpv2MessageLength + incrementHolder PatternFlowGtpv2MessageLengthCounter + decrementHolder PatternFlowGtpv2MessageLengthCounter + metricTagsHolder PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter +} + +func NewPatternFlowGtpv2MessageLength() PatternFlowGtpv2MessageLength { + obj := patternFlowGtpv2MessageLength{obj: &otg.PatternFlowGtpv2MessageLength{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2MessageLength) msg() *otg.PatternFlowGtpv2MessageLength { + return obj.obj +} + +func (obj *patternFlowGtpv2MessageLength) setMsg(msg *otg.PatternFlowGtpv2MessageLength) PatternFlowGtpv2MessageLength { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2MessageLength struct { + obj *patternFlowGtpv2MessageLength +} + +type marshalPatternFlowGtpv2MessageLength interface { + // ToProto marshals PatternFlowGtpv2MessageLength to protobuf object *otg.PatternFlowGtpv2MessageLength + ToProto() (*otg.PatternFlowGtpv2MessageLength, error) + // ToPbText marshals PatternFlowGtpv2MessageLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2MessageLength to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2MessageLength to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2MessageLength struct { + obj *patternFlowGtpv2MessageLength +} + +type unMarshalPatternFlowGtpv2MessageLength interface { + // FromProto unmarshals PatternFlowGtpv2MessageLength from protobuf object *otg.PatternFlowGtpv2MessageLength + FromProto(msg *otg.PatternFlowGtpv2MessageLength) (PatternFlowGtpv2MessageLength, error) + // FromPbText unmarshals PatternFlowGtpv2MessageLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2MessageLength from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2MessageLength from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2MessageLength) Marshal() marshalPatternFlowGtpv2MessageLength { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2MessageLength{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2MessageLength) Unmarshal() unMarshalPatternFlowGtpv2MessageLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2MessageLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2MessageLength) ToProto() (*otg.PatternFlowGtpv2MessageLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2MessageLength) FromProto(msg *otg.PatternFlowGtpv2MessageLength) (PatternFlowGtpv2MessageLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2MessageLength) 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 *unMarshalpatternFlowGtpv2MessageLength) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv2MessageLength) 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 *unMarshalpatternFlowGtpv2MessageLength) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv2MessageLength) 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 *unMarshalpatternFlowGtpv2MessageLength) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv2MessageLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2MessageLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2MessageLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2MessageLength) Clone() (PatternFlowGtpv2MessageLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2MessageLength() + 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 +} + +func (obj *patternFlowGtpv2MessageLength) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv2MessageLength is a 16-bit field that indicates the length of the payload in bytes, excluding the mandatory GTP-c header (first 4 bytes). Includes the TEID and sequence_number if they are present. +type PatternFlowGtpv2MessageLength interface { + Validation + // msg marshals PatternFlowGtpv2MessageLength to protobuf object *otg.PatternFlowGtpv2MessageLength + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2MessageLength + // setMsg unmarshals PatternFlowGtpv2MessageLength from protobuf object *otg.PatternFlowGtpv2MessageLength + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2MessageLength) PatternFlowGtpv2MessageLength + // provides marshal interface + Marshal() marshalPatternFlowGtpv2MessageLength + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2MessageLength + // validate validates PatternFlowGtpv2MessageLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2MessageLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv2MessageLengthChoiceEnum, set in PatternFlowGtpv2MessageLength + Choice() PatternFlowGtpv2MessageLengthChoiceEnum + // setChoice assigns PatternFlowGtpv2MessageLengthChoiceEnum provided by user to PatternFlowGtpv2MessageLength + setChoice(value PatternFlowGtpv2MessageLengthChoiceEnum) PatternFlowGtpv2MessageLength + // HasChoice checks if Choice has been set in PatternFlowGtpv2MessageLength + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv2MessageLength. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv2MessageLength + SetValue(value uint32) PatternFlowGtpv2MessageLength + // HasValue checks if Value has been set in PatternFlowGtpv2MessageLength + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv2MessageLength. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv2MessageLength + SetValues(value []uint32) PatternFlowGtpv2MessageLength + // Increment returns PatternFlowGtpv2MessageLengthCounter, set in PatternFlowGtpv2MessageLength. + // PatternFlowGtpv2MessageLengthCounter is integer counter pattern + Increment() PatternFlowGtpv2MessageLengthCounter + // SetIncrement assigns PatternFlowGtpv2MessageLengthCounter provided by user to PatternFlowGtpv2MessageLength. + // PatternFlowGtpv2MessageLengthCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv2MessageLengthCounter) PatternFlowGtpv2MessageLength + // HasIncrement checks if Increment has been set in PatternFlowGtpv2MessageLength + HasIncrement() bool + // Decrement returns PatternFlowGtpv2MessageLengthCounter, set in PatternFlowGtpv2MessageLength. + // PatternFlowGtpv2MessageLengthCounter is integer counter pattern + Decrement() PatternFlowGtpv2MessageLengthCounter + // SetDecrement assigns PatternFlowGtpv2MessageLengthCounter provided by user to PatternFlowGtpv2MessageLength. + // PatternFlowGtpv2MessageLengthCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv2MessageLengthCounter) PatternFlowGtpv2MessageLength + // HasDecrement checks if Decrement has been set in PatternFlowGtpv2MessageLength + HasDecrement() bool + // MetricTags returns PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIterIter, set in PatternFlowGtpv2MessageLength + MetricTags() PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter + setNil() +} + +type PatternFlowGtpv2MessageLengthChoiceEnum string + +// Enum of Choice on PatternFlowGtpv2MessageLength +var PatternFlowGtpv2MessageLengthChoice = struct { + VALUE PatternFlowGtpv2MessageLengthChoiceEnum + VALUES PatternFlowGtpv2MessageLengthChoiceEnum + INCREMENT PatternFlowGtpv2MessageLengthChoiceEnum + DECREMENT PatternFlowGtpv2MessageLengthChoiceEnum +}{ + VALUE: PatternFlowGtpv2MessageLengthChoiceEnum("value"), + VALUES: PatternFlowGtpv2MessageLengthChoiceEnum("values"), + INCREMENT: PatternFlowGtpv2MessageLengthChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv2MessageLengthChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv2MessageLength) Choice() PatternFlowGtpv2MessageLengthChoiceEnum { + return PatternFlowGtpv2MessageLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv2MessageLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv2MessageLength) setChoice(value PatternFlowGtpv2MessageLengthChoiceEnum) PatternFlowGtpv2MessageLength { + intValue, ok := otg.PatternFlowGtpv2MessageLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv2MessageLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv2MessageLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv2MessageLengthChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv2MessageLengthChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv2MessageLengthChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv2MessageLengthCounter().msg() + } + + if value == PatternFlowGtpv2MessageLengthChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv2MessageLengthCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2MessageLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv2MessageLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2MessageLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv2MessageLength object +func (obj *patternFlowGtpv2MessageLength) SetValue(value uint32) PatternFlowGtpv2MessageLength { + obj.setChoice(PatternFlowGtpv2MessageLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv2MessageLength) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv2MessageLength object +func (obj *patternFlowGtpv2MessageLength) SetValues(value []uint32) PatternFlowGtpv2MessageLength { + obj.setChoice(PatternFlowGtpv2MessageLengthChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv2MessageLengthCounter +func (obj *patternFlowGtpv2MessageLength) Increment() PatternFlowGtpv2MessageLengthCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv2MessageLengthChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv2MessageLengthCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv2MessageLengthCounter +func (obj *patternFlowGtpv2MessageLength) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv2MessageLengthCounter value in the PatternFlowGtpv2MessageLength object +func (obj *patternFlowGtpv2MessageLength) SetIncrement(value PatternFlowGtpv2MessageLengthCounter) PatternFlowGtpv2MessageLength { + obj.setChoice(PatternFlowGtpv2MessageLengthChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2MessageLengthCounter +func (obj *patternFlowGtpv2MessageLength) Decrement() PatternFlowGtpv2MessageLengthCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv2MessageLengthChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv2MessageLengthCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2MessageLengthCounter +func (obj *patternFlowGtpv2MessageLength) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv2MessageLengthCounter value in the PatternFlowGtpv2MessageLength object +func (obj *patternFlowGtpv2MessageLength) SetDecrement(value PatternFlowGtpv2MessageLengthCounter) PatternFlowGtpv2MessageLength { + obj.setChoice(PatternFlowGtpv2MessageLengthChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv2MessageLengthMetricTag +func (obj *patternFlowGtpv2MessageLength) MetricTags() PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv2MessageLengthMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter struct { + obj *patternFlowGtpv2MessageLength + patternFlowGtpv2MessageLengthMetricTagSlice []PatternFlowGtpv2MessageLengthMetricTag + fieldPtr *[]*otg.PatternFlowGtpv2MessageLengthMetricTag +} + +func newPatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter(ptr *[]*otg.PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { + return &patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter interface { + setMsg(*patternFlowGtpv2MessageLength) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter + Items() []PatternFlowGtpv2MessageLengthMetricTag + Add() PatternFlowGtpv2MessageLengthMetricTag + Append(items ...PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter + Set(index int, newObj PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter + Clear() PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter + clearHolderSlice() PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter + appendHolderSlice(item PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter +} + +func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) setMsg(msg *patternFlowGtpv2MessageLength) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv2MessageLengthMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) Items() []PatternFlowGtpv2MessageLengthMetricTag { + return obj.patternFlowGtpv2MessageLengthMetricTagSlice +} + +func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) Add() PatternFlowGtpv2MessageLengthMetricTag { + newObj := &otg.PatternFlowGtpv2MessageLengthMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv2MessageLengthMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv2MessageLengthMetricTagSlice = append(obj.patternFlowGtpv2MessageLengthMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) Append(items ...PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv2MessageLengthMetricTagSlice = append(obj.patternFlowGtpv2MessageLengthMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) Set(index int, newObj PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv2MessageLengthMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) Clear() PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv2MessageLengthMetricTag{} + obj.patternFlowGtpv2MessageLengthMetricTagSlice = []PatternFlowGtpv2MessageLengthMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) clearHolderSlice() PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { + if len(obj.patternFlowGtpv2MessageLengthMetricTagSlice) > 0 { + obj.patternFlowGtpv2MessageLengthMetricTagSlice = []PatternFlowGtpv2MessageLengthMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter) appendHolderSlice(item PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthPatternFlowGtpv2MessageLengthMetricTagIter { + obj.patternFlowGtpv2MessageLengthMetricTagSlice = append(obj.patternFlowGtpv2MessageLengthMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv2MessageLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2MessageLength.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv2MessageLength.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv2MessageLengthMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv2MessageLength) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv2MessageLengthChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv2MessageLengthChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv2MessageLengthChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv2MessageLengthChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv2MessageLengthChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv2MessageLengthChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2MessageLength") + } + } else { + intVal := otg.PatternFlowGtpv2MessageLength_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv2MessageLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_message_length_counter.go b/gosnappi/pattern_flow_gtpv2_message_length_counter.go new file mode 100644 index 00000000..0a755e59 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_message_length_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv2MessageLengthCounter ***** +type patternFlowGtpv2MessageLengthCounter struct { + validation + obj *otg.PatternFlowGtpv2MessageLengthCounter + marshaller marshalPatternFlowGtpv2MessageLengthCounter + unMarshaller unMarshalPatternFlowGtpv2MessageLengthCounter +} + +func NewPatternFlowGtpv2MessageLengthCounter() PatternFlowGtpv2MessageLengthCounter { + obj := patternFlowGtpv2MessageLengthCounter{obj: &otg.PatternFlowGtpv2MessageLengthCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2MessageLengthCounter) msg() *otg.PatternFlowGtpv2MessageLengthCounter { + return obj.obj +} + +func (obj *patternFlowGtpv2MessageLengthCounter) setMsg(msg *otg.PatternFlowGtpv2MessageLengthCounter) PatternFlowGtpv2MessageLengthCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2MessageLengthCounter struct { + obj *patternFlowGtpv2MessageLengthCounter +} + +type marshalPatternFlowGtpv2MessageLengthCounter interface { + // ToProto marshals PatternFlowGtpv2MessageLengthCounter to protobuf object *otg.PatternFlowGtpv2MessageLengthCounter + ToProto() (*otg.PatternFlowGtpv2MessageLengthCounter, error) + // ToPbText marshals PatternFlowGtpv2MessageLengthCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2MessageLengthCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2MessageLengthCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2MessageLengthCounter struct { + obj *patternFlowGtpv2MessageLengthCounter +} + +type unMarshalPatternFlowGtpv2MessageLengthCounter interface { + // FromProto unmarshals PatternFlowGtpv2MessageLengthCounter from protobuf object *otg.PatternFlowGtpv2MessageLengthCounter + FromProto(msg *otg.PatternFlowGtpv2MessageLengthCounter) (PatternFlowGtpv2MessageLengthCounter, error) + // FromPbText unmarshals PatternFlowGtpv2MessageLengthCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2MessageLengthCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2MessageLengthCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2MessageLengthCounter) Marshal() marshalPatternFlowGtpv2MessageLengthCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2MessageLengthCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2MessageLengthCounter) Unmarshal() unMarshalPatternFlowGtpv2MessageLengthCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2MessageLengthCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2MessageLengthCounter) ToProto() (*otg.PatternFlowGtpv2MessageLengthCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2MessageLengthCounter) FromProto(msg *otg.PatternFlowGtpv2MessageLengthCounter) (PatternFlowGtpv2MessageLengthCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2MessageLengthCounter) 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 *unMarshalpatternFlowGtpv2MessageLengthCounter) 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 *marshalpatternFlowGtpv2MessageLengthCounter) 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 *unMarshalpatternFlowGtpv2MessageLengthCounter) 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 *marshalpatternFlowGtpv2MessageLengthCounter) 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 *unMarshalpatternFlowGtpv2MessageLengthCounter) 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 *patternFlowGtpv2MessageLengthCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2MessageLengthCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2MessageLengthCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2MessageLengthCounter) Clone() (PatternFlowGtpv2MessageLengthCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2MessageLengthCounter() + 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 +} + +// PatternFlowGtpv2MessageLengthCounter is integer counter pattern +type PatternFlowGtpv2MessageLengthCounter interface { + Validation + // msg marshals PatternFlowGtpv2MessageLengthCounter to protobuf object *otg.PatternFlowGtpv2MessageLengthCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2MessageLengthCounter + // setMsg unmarshals PatternFlowGtpv2MessageLengthCounter from protobuf object *otg.PatternFlowGtpv2MessageLengthCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2MessageLengthCounter) PatternFlowGtpv2MessageLengthCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv2MessageLengthCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2MessageLengthCounter + // validate validates PatternFlowGtpv2MessageLengthCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2MessageLengthCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv2MessageLengthCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv2MessageLengthCounter + SetStart(value uint32) PatternFlowGtpv2MessageLengthCounter + // HasStart checks if Start has been set in PatternFlowGtpv2MessageLengthCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv2MessageLengthCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv2MessageLengthCounter + SetStep(value uint32) PatternFlowGtpv2MessageLengthCounter + // HasStep checks if Step has been set in PatternFlowGtpv2MessageLengthCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv2MessageLengthCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv2MessageLengthCounter + SetCount(value uint32) PatternFlowGtpv2MessageLengthCounter + // HasCount checks if Count has been set in PatternFlowGtpv2MessageLengthCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2MessageLengthCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2MessageLengthCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv2MessageLengthCounter object +func (obj *patternFlowGtpv2MessageLengthCounter) SetStart(value uint32) PatternFlowGtpv2MessageLengthCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2MessageLengthCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2MessageLengthCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv2MessageLengthCounter object +func (obj *patternFlowGtpv2MessageLengthCounter) SetStep(value uint32) PatternFlowGtpv2MessageLengthCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2MessageLengthCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2MessageLengthCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv2MessageLengthCounter object +func (obj *patternFlowGtpv2MessageLengthCounter) SetCount(value uint32) PatternFlowGtpv2MessageLengthCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv2MessageLengthCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2MessageLengthCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2MessageLengthCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2MessageLengthCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv2MessageLengthCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_message_length_metric_tag.go b/gosnappi/pattern_flow_gtpv2_message_length_metric_tag.go new file mode 100644 index 00000000..76c4332d --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_message_length_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv2MessageLengthMetricTag ***** +type patternFlowGtpv2MessageLengthMetricTag struct { + validation + obj *otg.PatternFlowGtpv2MessageLengthMetricTag + marshaller marshalPatternFlowGtpv2MessageLengthMetricTag + unMarshaller unMarshalPatternFlowGtpv2MessageLengthMetricTag +} + +func NewPatternFlowGtpv2MessageLengthMetricTag() PatternFlowGtpv2MessageLengthMetricTag { + obj := patternFlowGtpv2MessageLengthMetricTag{obj: &otg.PatternFlowGtpv2MessageLengthMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2MessageLengthMetricTag) msg() *otg.PatternFlowGtpv2MessageLengthMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv2MessageLengthMetricTag) setMsg(msg *otg.PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2MessageLengthMetricTag struct { + obj *patternFlowGtpv2MessageLengthMetricTag +} + +type marshalPatternFlowGtpv2MessageLengthMetricTag interface { + // ToProto marshals PatternFlowGtpv2MessageLengthMetricTag to protobuf object *otg.PatternFlowGtpv2MessageLengthMetricTag + ToProto() (*otg.PatternFlowGtpv2MessageLengthMetricTag, error) + // ToPbText marshals PatternFlowGtpv2MessageLengthMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2MessageLengthMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2MessageLengthMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2MessageLengthMetricTag struct { + obj *patternFlowGtpv2MessageLengthMetricTag +} + +type unMarshalPatternFlowGtpv2MessageLengthMetricTag interface { + // FromProto unmarshals PatternFlowGtpv2MessageLengthMetricTag from protobuf object *otg.PatternFlowGtpv2MessageLengthMetricTag + FromProto(msg *otg.PatternFlowGtpv2MessageLengthMetricTag) (PatternFlowGtpv2MessageLengthMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv2MessageLengthMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2MessageLengthMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2MessageLengthMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2MessageLengthMetricTag) Marshal() marshalPatternFlowGtpv2MessageLengthMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2MessageLengthMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2MessageLengthMetricTag) Unmarshal() unMarshalPatternFlowGtpv2MessageLengthMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2MessageLengthMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2MessageLengthMetricTag) ToProto() (*otg.PatternFlowGtpv2MessageLengthMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2MessageLengthMetricTag) FromProto(msg *otg.PatternFlowGtpv2MessageLengthMetricTag) (PatternFlowGtpv2MessageLengthMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2MessageLengthMetricTag) 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 *unMarshalpatternFlowGtpv2MessageLengthMetricTag) 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 *marshalpatternFlowGtpv2MessageLengthMetricTag) 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 *unMarshalpatternFlowGtpv2MessageLengthMetricTag) 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 *marshalpatternFlowGtpv2MessageLengthMetricTag) 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 *unMarshalpatternFlowGtpv2MessageLengthMetricTag) 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 *patternFlowGtpv2MessageLengthMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2MessageLengthMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2MessageLengthMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2MessageLengthMetricTag) Clone() (PatternFlowGtpv2MessageLengthMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2MessageLengthMetricTag() + 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 +} + +// PatternFlowGtpv2MessageLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv2MessageLengthMetricTag interface { + Validation + // msg marshals PatternFlowGtpv2MessageLengthMetricTag to protobuf object *otg.PatternFlowGtpv2MessageLengthMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2MessageLengthMetricTag + // setMsg unmarshals PatternFlowGtpv2MessageLengthMetricTag from protobuf object *otg.PatternFlowGtpv2MessageLengthMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2MessageLengthMetricTag) PatternFlowGtpv2MessageLengthMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv2MessageLengthMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2MessageLengthMetricTag + // validate validates PatternFlowGtpv2MessageLengthMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2MessageLengthMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv2MessageLengthMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv2MessageLengthMetricTag + SetName(value string) PatternFlowGtpv2MessageLengthMetricTag + // Offset returns uint32, set in PatternFlowGtpv2MessageLengthMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv2MessageLengthMetricTag + SetOffset(value uint32) PatternFlowGtpv2MessageLengthMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv2MessageLengthMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv2MessageLengthMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv2MessageLengthMetricTag + SetLength(value uint32) PatternFlowGtpv2MessageLengthMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv2MessageLengthMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv2MessageLengthMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv2MessageLengthMetricTag object +func (obj *patternFlowGtpv2MessageLengthMetricTag) SetName(value string) PatternFlowGtpv2MessageLengthMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2MessageLengthMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2MessageLengthMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv2MessageLengthMetricTag object +func (obj *patternFlowGtpv2MessageLengthMetricTag) SetOffset(value uint32) PatternFlowGtpv2MessageLengthMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2MessageLengthMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2MessageLengthMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv2MessageLengthMetricTag object +func (obj *patternFlowGtpv2MessageLengthMetricTag) SetLength(value uint32) PatternFlowGtpv2MessageLengthMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv2MessageLengthMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2MessageLengthMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2MessageLengthMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv2MessageLengthMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv2MessageLengthMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_message_type.go b/gosnappi/pattern_flow_gtpv2_message_type.go new file mode 100644 index 00000000..f22d3383 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_message_type.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv2MessageType ***** +type patternFlowGtpv2MessageType struct { + validation + obj *otg.PatternFlowGtpv2MessageType + marshaller marshalPatternFlowGtpv2MessageType + unMarshaller unMarshalPatternFlowGtpv2MessageType + incrementHolder PatternFlowGtpv2MessageTypeCounter + decrementHolder PatternFlowGtpv2MessageTypeCounter + metricTagsHolder PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter +} + +func NewPatternFlowGtpv2MessageType() PatternFlowGtpv2MessageType { + obj := patternFlowGtpv2MessageType{obj: &otg.PatternFlowGtpv2MessageType{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2MessageType) msg() *otg.PatternFlowGtpv2MessageType { + return obj.obj +} + +func (obj *patternFlowGtpv2MessageType) setMsg(msg *otg.PatternFlowGtpv2MessageType) PatternFlowGtpv2MessageType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2MessageType struct { + obj *patternFlowGtpv2MessageType +} + +type marshalPatternFlowGtpv2MessageType interface { + // ToProto marshals PatternFlowGtpv2MessageType to protobuf object *otg.PatternFlowGtpv2MessageType + ToProto() (*otg.PatternFlowGtpv2MessageType, error) + // ToPbText marshals PatternFlowGtpv2MessageType to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2MessageType to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2MessageType to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2MessageType struct { + obj *patternFlowGtpv2MessageType +} + +type unMarshalPatternFlowGtpv2MessageType interface { + // FromProto unmarshals PatternFlowGtpv2MessageType from protobuf object *otg.PatternFlowGtpv2MessageType + FromProto(msg *otg.PatternFlowGtpv2MessageType) (PatternFlowGtpv2MessageType, error) + // FromPbText unmarshals PatternFlowGtpv2MessageType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2MessageType from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2MessageType from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2MessageType) Marshal() marshalPatternFlowGtpv2MessageType { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2MessageType{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2MessageType) Unmarshal() unMarshalPatternFlowGtpv2MessageType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2MessageType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2MessageType) ToProto() (*otg.PatternFlowGtpv2MessageType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2MessageType) FromProto(msg *otg.PatternFlowGtpv2MessageType) (PatternFlowGtpv2MessageType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2MessageType) 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 *unMarshalpatternFlowGtpv2MessageType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv2MessageType) 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 *unMarshalpatternFlowGtpv2MessageType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv2MessageType) 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 *unMarshalpatternFlowGtpv2MessageType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv2MessageType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2MessageType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2MessageType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2MessageType) Clone() (PatternFlowGtpv2MessageType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2MessageType() + 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 +} + +func (obj *patternFlowGtpv2MessageType) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv2MessageType is an 8-bit field that indicates the type of GTP message. Different types of messages are defined in 3GPP TS 29.060 section 7.1 +type PatternFlowGtpv2MessageType interface { + Validation + // msg marshals PatternFlowGtpv2MessageType to protobuf object *otg.PatternFlowGtpv2MessageType + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2MessageType + // setMsg unmarshals PatternFlowGtpv2MessageType from protobuf object *otg.PatternFlowGtpv2MessageType + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2MessageType) PatternFlowGtpv2MessageType + // provides marshal interface + Marshal() marshalPatternFlowGtpv2MessageType + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2MessageType + // validate validates PatternFlowGtpv2MessageType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2MessageType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv2MessageTypeChoiceEnum, set in PatternFlowGtpv2MessageType + Choice() PatternFlowGtpv2MessageTypeChoiceEnum + // setChoice assigns PatternFlowGtpv2MessageTypeChoiceEnum provided by user to PatternFlowGtpv2MessageType + setChoice(value PatternFlowGtpv2MessageTypeChoiceEnum) PatternFlowGtpv2MessageType + // HasChoice checks if Choice has been set in PatternFlowGtpv2MessageType + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv2MessageType. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv2MessageType + SetValue(value uint32) PatternFlowGtpv2MessageType + // HasValue checks if Value has been set in PatternFlowGtpv2MessageType + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv2MessageType. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv2MessageType + SetValues(value []uint32) PatternFlowGtpv2MessageType + // Increment returns PatternFlowGtpv2MessageTypeCounter, set in PatternFlowGtpv2MessageType. + // PatternFlowGtpv2MessageTypeCounter is integer counter pattern + Increment() PatternFlowGtpv2MessageTypeCounter + // SetIncrement assigns PatternFlowGtpv2MessageTypeCounter provided by user to PatternFlowGtpv2MessageType. + // PatternFlowGtpv2MessageTypeCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv2MessageTypeCounter) PatternFlowGtpv2MessageType + // HasIncrement checks if Increment has been set in PatternFlowGtpv2MessageType + HasIncrement() bool + // Decrement returns PatternFlowGtpv2MessageTypeCounter, set in PatternFlowGtpv2MessageType. + // PatternFlowGtpv2MessageTypeCounter is integer counter pattern + Decrement() PatternFlowGtpv2MessageTypeCounter + // SetDecrement assigns PatternFlowGtpv2MessageTypeCounter provided by user to PatternFlowGtpv2MessageType. + // PatternFlowGtpv2MessageTypeCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv2MessageTypeCounter) PatternFlowGtpv2MessageType + // HasDecrement checks if Decrement has been set in PatternFlowGtpv2MessageType + HasDecrement() bool + // MetricTags returns PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIterIter, set in PatternFlowGtpv2MessageType + MetricTags() PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter + setNil() +} + +type PatternFlowGtpv2MessageTypeChoiceEnum string + +// Enum of Choice on PatternFlowGtpv2MessageType +var PatternFlowGtpv2MessageTypeChoice = struct { + VALUE PatternFlowGtpv2MessageTypeChoiceEnum + VALUES PatternFlowGtpv2MessageTypeChoiceEnum + INCREMENT PatternFlowGtpv2MessageTypeChoiceEnum + DECREMENT PatternFlowGtpv2MessageTypeChoiceEnum +}{ + VALUE: PatternFlowGtpv2MessageTypeChoiceEnum("value"), + VALUES: PatternFlowGtpv2MessageTypeChoiceEnum("values"), + INCREMENT: PatternFlowGtpv2MessageTypeChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv2MessageTypeChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv2MessageType) Choice() PatternFlowGtpv2MessageTypeChoiceEnum { + return PatternFlowGtpv2MessageTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv2MessageType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv2MessageType) setChoice(value PatternFlowGtpv2MessageTypeChoiceEnum) PatternFlowGtpv2MessageType { + intValue, ok := otg.PatternFlowGtpv2MessageType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv2MessageTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv2MessageType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv2MessageTypeChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv2MessageTypeChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv2MessageTypeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv2MessageTypeCounter().msg() + } + + if value == PatternFlowGtpv2MessageTypeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv2MessageTypeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2MessageType) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv2MessageTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2MessageType) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv2MessageType object +func (obj *patternFlowGtpv2MessageType) SetValue(value uint32) PatternFlowGtpv2MessageType { + obj.setChoice(PatternFlowGtpv2MessageTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv2MessageType) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv2MessageType object +func (obj *patternFlowGtpv2MessageType) SetValues(value []uint32) PatternFlowGtpv2MessageType { + obj.setChoice(PatternFlowGtpv2MessageTypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv2MessageTypeCounter +func (obj *patternFlowGtpv2MessageType) Increment() PatternFlowGtpv2MessageTypeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv2MessageTypeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv2MessageTypeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv2MessageTypeCounter +func (obj *patternFlowGtpv2MessageType) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv2MessageTypeCounter value in the PatternFlowGtpv2MessageType object +func (obj *patternFlowGtpv2MessageType) SetIncrement(value PatternFlowGtpv2MessageTypeCounter) PatternFlowGtpv2MessageType { + obj.setChoice(PatternFlowGtpv2MessageTypeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2MessageTypeCounter +func (obj *patternFlowGtpv2MessageType) Decrement() PatternFlowGtpv2MessageTypeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv2MessageTypeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv2MessageTypeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2MessageTypeCounter +func (obj *patternFlowGtpv2MessageType) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv2MessageTypeCounter value in the PatternFlowGtpv2MessageType object +func (obj *patternFlowGtpv2MessageType) SetDecrement(value PatternFlowGtpv2MessageTypeCounter) PatternFlowGtpv2MessageType { + obj.setChoice(PatternFlowGtpv2MessageTypeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv2MessageTypeMetricTag +func (obj *patternFlowGtpv2MessageType) MetricTags() PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv2MessageTypeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter struct { + obj *patternFlowGtpv2MessageType + patternFlowGtpv2MessageTypeMetricTagSlice []PatternFlowGtpv2MessageTypeMetricTag + fieldPtr *[]*otg.PatternFlowGtpv2MessageTypeMetricTag +} + +func newPatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter(ptr *[]*otg.PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { + return &patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter interface { + setMsg(*patternFlowGtpv2MessageType) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter + Items() []PatternFlowGtpv2MessageTypeMetricTag + Add() PatternFlowGtpv2MessageTypeMetricTag + Append(items ...PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter + Set(index int, newObj PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter + Clear() PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter + clearHolderSlice() PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter + appendHolderSlice(item PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter +} + +func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) setMsg(msg *patternFlowGtpv2MessageType) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv2MessageTypeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) Items() []PatternFlowGtpv2MessageTypeMetricTag { + return obj.patternFlowGtpv2MessageTypeMetricTagSlice +} + +func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) Add() PatternFlowGtpv2MessageTypeMetricTag { + newObj := &otg.PatternFlowGtpv2MessageTypeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv2MessageTypeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv2MessageTypeMetricTagSlice = append(obj.patternFlowGtpv2MessageTypeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) Append(items ...PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv2MessageTypeMetricTagSlice = append(obj.patternFlowGtpv2MessageTypeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) Set(index int, newObj PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv2MessageTypeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) Clear() PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv2MessageTypeMetricTag{} + obj.patternFlowGtpv2MessageTypeMetricTagSlice = []PatternFlowGtpv2MessageTypeMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) clearHolderSlice() PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { + if len(obj.patternFlowGtpv2MessageTypeMetricTagSlice) > 0 { + obj.patternFlowGtpv2MessageTypeMetricTagSlice = []PatternFlowGtpv2MessageTypeMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter) appendHolderSlice(item PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypePatternFlowGtpv2MessageTypeMetricTagIter { + obj.patternFlowGtpv2MessageTypeMetricTagSlice = append(obj.patternFlowGtpv2MessageTypeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv2MessageType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2MessageType.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv2MessageType.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv2MessageTypeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv2MessageType) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv2MessageTypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv2MessageTypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv2MessageTypeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv2MessageTypeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv2MessageTypeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv2MessageTypeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2MessageType") + } + } else { + intVal := otg.PatternFlowGtpv2MessageType_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv2MessageType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_message_type_counter.go b/gosnappi/pattern_flow_gtpv2_message_type_counter.go new file mode 100644 index 00000000..bf55ce1f --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_message_type_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv2MessageTypeCounter ***** +type patternFlowGtpv2MessageTypeCounter struct { + validation + obj *otg.PatternFlowGtpv2MessageTypeCounter + marshaller marshalPatternFlowGtpv2MessageTypeCounter + unMarshaller unMarshalPatternFlowGtpv2MessageTypeCounter +} + +func NewPatternFlowGtpv2MessageTypeCounter() PatternFlowGtpv2MessageTypeCounter { + obj := patternFlowGtpv2MessageTypeCounter{obj: &otg.PatternFlowGtpv2MessageTypeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2MessageTypeCounter) msg() *otg.PatternFlowGtpv2MessageTypeCounter { + return obj.obj +} + +func (obj *patternFlowGtpv2MessageTypeCounter) setMsg(msg *otg.PatternFlowGtpv2MessageTypeCounter) PatternFlowGtpv2MessageTypeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2MessageTypeCounter struct { + obj *patternFlowGtpv2MessageTypeCounter +} + +type marshalPatternFlowGtpv2MessageTypeCounter interface { + // ToProto marshals PatternFlowGtpv2MessageTypeCounter to protobuf object *otg.PatternFlowGtpv2MessageTypeCounter + ToProto() (*otg.PatternFlowGtpv2MessageTypeCounter, error) + // ToPbText marshals PatternFlowGtpv2MessageTypeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2MessageTypeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2MessageTypeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2MessageTypeCounter struct { + obj *patternFlowGtpv2MessageTypeCounter +} + +type unMarshalPatternFlowGtpv2MessageTypeCounter interface { + // FromProto unmarshals PatternFlowGtpv2MessageTypeCounter from protobuf object *otg.PatternFlowGtpv2MessageTypeCounter + FromProto(msg *otg.PatternFlowGtpv2MessageTypeCounter) (PatternFlowGtpv2MessageTypeCounter, error) + // FromPbText unmarshals PatternFlowGtpv2MessageTypeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2MessageTypeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2MessageTypeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2MessageTypeCounter) Marshal() marshalPatternFlowGtpv2MessageTypeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2MessageTypeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2MessageTypeCounter) Unmarshal() unMarshalPatternFlowGtpv2MessageTypeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2MessageTypeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2MessageTypeCounter) ToProto() (*otg.PatternFlowGtpv2MessageTypeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2MessageTypeCounter) FromProto(msg *otg.PatternFlowGtpv2MessageTypeCounter) (PatternFlowGtpv2MessageTypeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2MessageTypeCounter) 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 *unMarshalpatternFlowGtpv2MessageTypeCounter) 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 *marshalpatternFlowGtpv2MessageTypeCounter) 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 *unMarshalpatternFlowGtpv2MessageTypeCounter) 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 *marshalpatternFlowGtpv2MessageTypeCounter) 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 *unMarshalpatternFlowGtpv2MessageTypeCounter) 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 *patternFlowGtpv2MessageTypeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2MessageTypeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2MessageTypeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2MessageTypeCounter) Clone() (PatternFlowGtpv2MessageTypeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2MessageTypeCounter() + 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 +} + +// PatternFlowGtpv2MessageTypeCounter is integer counter pattern +type PatternFlowGtpv2MessageTypeCounter interface { + Validation + // msg marshals PatternFlowGtpv2MessageTypeCounter to protobuf object *otg.PatternFlowGtpv2MessageTypeCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2MessageTypeCounter + // setMsg unmarshals PatternFlowGtpv2MessageTypeCounter from protobuf object *otg.PatternFlowGtpv2MessageTypeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2MessageTypeCounter) PatternFlowGtpv2MessageTypeCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv2MessageTypeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2MessageTypeCounter + // validate validates PatternFlowGtpv2MessageTypeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2MessageTypeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv2MessageTypeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv2MessageTypeCounter + SetStart(value uint32) PatternFlowGtpv2MessageTypeCounter + // HasStart checks if Start has been set in PatternFlowGtpv2MessageTypeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv2MessageTypeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv2MessageTypeCounter + SetStep(value uint32) PatternFlowGtpv2MessageTypeCounter + // HasStep checks if Step has been set in PatternFlowGtpv2MessageTypeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv2MessageTypeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv2MessageTypeCounter + SetCount(value uint32) PatternFlowGtpv2MessageTypeCounter + // HasCount checks if Count has been set in PatternFlowGtpv2MessageTypeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2MessageTypeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2MessageTypeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv2MessageTypeCounter object +func (obj *patternFlowGtpv2MessageTypeCounter) SetStart(value uint32) PatternFlowGtpv2MessageTypeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2MessageTypeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2MessageTypeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv2MessageTypeCounter object +func (obj *patternFlowGtpv2MessageTypeCounter) SetStep(value uint32) PatternFlowGtpv2MessageTypeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2MessageTypeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2MessageTypeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv2MessageTypeCounter object +func (obj *patternFlowGtpv2MessageTypeCounter) SetCount(value uint32) PatternFlowGtpv2MessageTypeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv2MessageTypeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2MessageTypeCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2MessageTypeCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2MessageTypeCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv2MessageTypeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_message_type_metric_tag.go b/gosnappi/pattern_flow_gtpv2_message_type_metric_tag.go new file mode 100644 index 00000000..35d14948 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_message_type_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv2MessageTypeMetricTag ***** +type patternFlowGtpv2MessageTypeMetricTag struct { + validation + obj *otg.PatternFlowGtpv2MessageTypeMetricTag + marshaller marshalPatternFlowGtpv2MessageTypeMetricTag + unMarshaller unMarshalPatternFlowGtpv2MessageTypeMetricTag +} + +func NewPatternFlowGtpv2MessageTypeMetricTag() PatternFlowGtpv2MessageTypeMetricTag { + obj := patternFlowGtpv2MessageTypeMetricTag{obj: &otg.PatternFlowGtpv2MessageTypeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2MessageTypeMetricTag) msg() *otg.PatternFlowGtpv2MessageTypeMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv2MessageTypeMetricTag) setMsg(msg *otg.PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2MessageTypeMetricTag struct { + obj *patternFlowGtpv2MessageTypeMetricTag +} + +type marshalPatternFlowGtpv2MessageTypeMetricTag interface { + // ToProto marshals PatternFlowGtpv2MessageTypeMetricTag to protobuf object *otg.PatternFlowGtpv2MessageTypeMetricTag + ToProto() (*otg.PatternFlowGtpv2MessageTypeMetricTag, error) + // ToPbText marshals PatternFlowGtpv2MessageTypeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2MessageTypeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2MessageTypeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2MessageTypeMetricTag struct { + obj *patternFlowGtpv2MessageTypeMetricTag +} + +type unMarshalPatternFlowGtpv2MessageTypeMetricTag interface { + // FromProto unmarshals PatternFlowGtpv2MessageTypeMetricTag from protobuf object *otg.PatternFlowGtpv2MessageTypeMetricTag + FromProto(msg *otg.PatternFlowGtpv2MessageTypeMetricTag) (PatternFlowGtpv2MessageTypeMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv2MessageTypeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2MessageTypeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2MessageTypeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2MessageTypeMetricTag) Marshal() marshalPatternFlowGtpv2MessageTypeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2MessageTypeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2MessageTypeMetricTag) Unmarshal() unMarshalPatternFlowGtpv2MessageTypeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2MessageTypeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2MessageTypeMetricTag) ToProto() (*otg.PatternFlowGtpv2MessageTypeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2MessageTypeMetricTag) FromProto(msg *otg.PatternFlowGtpv2MessageTypeMetricTag) (PatternFlowGtpv2MessageTypeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2MessageTypeMetricTag) 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 *unMarshalpatternFlowGtpv2MessageTypeMetricTag) 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 *marshalpatternFlowGtpv2MessageTypeMetricTag) 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 *unMarshalpatternFlowGtpv2MessageTypeMetricTag) 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 *marshalpatternFlowGtpv2MessageTypeMetricTag) 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 *unMarshalpatternFlowGtpv2MessageTypeMetricTag) 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 *patternFlowGtpv2MessageTypeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2MessageTypeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2MessageTypeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2MessageTypeMetricTag) Clone() (PatternFlowGtpv2MessageTypeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2MessageTypeMetricTag() + 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 +} + +// PatternFlowGtpv2MessageTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv2MessageTypeMetricTag interface { + Validation + // msg marshals PatternFlowGtpv2MessageTypeMetricTag to protobuf object *otg.PatternFlowGtpv2MessageTypeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2MessageTypeMetricTag + // setMsg unmarshals PatternFlowGtpv2MessageTypeMetricTag from protobuf object *otg.PatternFlowGtpv2MessageTypeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2MessageTypeMetricTag) PatternFlowGtpv2MessageTypeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv2MessageTypeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2MessageTypeMetricTag + // validate validates PatternFlowGtpv2MessageTypeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2MessageTypeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv2MessageTypeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv2MessageTypeMetricTag + SetName(value string) PatternFlowGtpv2MessageTypeMetricTag + // Offset returns uint32, set in PatternFlowGtpv2MessageTypeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv2MessageTypeMetricTag + SetOffset(value uint32) PatternFlowGtpv2MessageTypeMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv2MessageTypeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv2MessageTypeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv2MessageTypeMetricTag + SetLength(value uint32) PatternFlowGtpv2MessageTypeMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv2MessageTypeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv2MessageTypeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv2MessageTypeMetricTag object +func (obj *patternFlowGtpv2MessageTypeMetricTag) SetName(value string) PatternFlowGtpv2MessageTypeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2MessageTypeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2MessageTypeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv2MessageTypeMetricTag object +func (obj *patternFlowGtpv2MessageTypeMetricTag) SetOffset(value uint32) PatternFlowGtpv2MessageTypeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2MessageTypeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2MessageTypeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv2MessageTypeMetricTag object +func (obj *patternFlowGtpv2MessageTypeMetricTag) SetLength(value uint32) PatternFlowGtpv2MessageTypeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv2MessageTypeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2MessageTypeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2MessageTypeMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv2MessageTypeMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv2MessageTypeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_piggybacking_flag.go b/gosnappi/pattern_flow_gtpv2_piggybacking_flag.go new file mode 100644 index 00000000..00d48844 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_piggybacking_flag.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv2PiggybackingFlag ***** +type patternFlowGtpv2PiggybackingFlag struct { + validation + obj *otg.PatternFlowGtpv2PiggybackingFlag + marshaller marshalPatternFlowGtpv2PiggybackingFlag + unMarshaller unMarshalPatternFlowGtpv2PiggybackingFlag + incrementHolder PatternFlowGtpv2PiggybackingFlagCounter + decrementHolder PatternFlowGtpv2PiggybackingFlagCounter + metricTagsHolder PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter +} + +func NewPatternFlowGtpv2PiggybackingFlag() PatternFlowGtpv2PiggybackingFlag { + obj := patternFlowGtpv2PiggybackingFlag{obj: &otg.PatternFlowGtpv2PiggybackingFlag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2PiggybackingFlag) msg() *otg.PatternFlowGtpv2PiggybackingFlag { + return obj.obj +} + +func (obj *patternFlowGtpv2PiggybackingFlag) setMsg(msg *otg.PatternFlowGtpv2PiggybackingFlag) PatternFlowGtpv2PiggybackingFlag { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2PiggybackingFlag struct { + obj *patternFlowGtpv2PiggybackingFlag +} + +type marshalPatternFlowGtpv2PiggybackingFlag interface { + // ToProto marshals PatternFlowGtpv2PiggybackingFlag to protobuf object *otg.PatternFlowGtpv2PiggybackingFlag + ToProto() (*otg.PatternFlowGtpv2PiggybackingFlag, error) + // ToPbText marshals PatternFlowGtpv2PiggybackingFlag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2PiggybackingFlag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2PiggybackingFlag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2PiggybackingFlag struct { + obj *patternFlowGtpv2PiggybackingFlag +} + +type unMarshalPatternFlowGtpv2PiggybackingFlag interface { + // FromProto unmarshals PatternFlowGtpv2PiggybackingFlag from protobuf object *otg.PatternFlowGtpv2PiggybackingFlag + FromProto(msg *otg.PatternFlowGtpv2PiggybackingFlag) (PatternFlowGtpv2PiggybackingFlag, error) + // FromPbText unmarshals PatternFlowGtpv2PiggybackingFlag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2PiggybackingFlag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2PiggybackingFlag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2PiggybackingFlag) Marshal() marshalPatternFlowGtpv2PiggybackingFlag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2PiggybackingFlag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2PiggybackingFlag) Unmarshal() unMarshalPatternFlowGtpv2PiggybackingFlag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2PiggybackingFlag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2PiggybackingFlag) ToProto() (*otg.PatternFlowGtpv2PiggybackingFlag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2PiggybackingFlag) FromProto(msg *otg.PatternFlowGtpv2PiggybackingFlag) (PatternFlowGtpv2PiggybackingFlag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2PiggybackingFlag) 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 *unMarshalpatternFlowGtpv2PiggybackingFlag) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv2PiggybackingFlag) 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 *unMarshalpatternFlowGtpv2PiggybackingFlag) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv2PiggybackingFlag) 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 *unMarshalpatternFlowGtpv2PiggybackingFlag) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv2PiggybackingFlag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2PiggybackingFlag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2PiggybackingFlag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2PiggybackingFlag) Clone() (PatternFlowGtpv2PiggybackingFlag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2PiggybackingFlag() + 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 +} + +func (obj *patternFlowGtpv2PiggybackingFlag) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv2PiggybackingFlag is if piggybacking_flag is set to 1 then another GTP-C message with its own header shall be present at the end of the current message +type PatternFlowGtpv2PiggybackingFlag interface { + Validation + // msg marshals PatternFlowGtpv2PiggybackingFlag to protobuf object *otg.PatternFlowGtpv2PiggybackingFlag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2PiggybackingFlag + // setMsg unmarshals PatternFlowGtpv2PiggybackingFlag from protobuf object *otg.PatternFlowGtpv2PiggybackingFlag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2PiggybackingFlag) PatternFlowGtpv2PiggybackingFlag + // provides marshal interface + Marshal() marshalPatternFlowGtpv2PiggybackingFlag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2PiggybackingFlag + // validate validates PatternFlowGtpv2PiggybackingFlag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2PiggybackingFlag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv2PiggybackingFlagChoiceEnum, set in PatternFlowGtpv2PiggybackingFlag + Choice() PatternFlowGtpv2PiggybackingFlagChoiceEnum + // setChoice assigns PatternFlowGtpv2PiggybackingFlagChoiceEnum provided by user to PatternFlowGtpv2PiggybackingFlag + setChoice(value PatternFlowGtpv2PiggybackingFlagChoiceEnum) PatternFlowGtpv2PiggybackingFlag + // HasChoice checks if Choice has been set in PatternFlowGtpv2PiggybackingFlag + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv2PiggybackingFlag. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv2PiggybackingFlag + SetValue(value uint32) PatternFlowGtpv2PiggybackingFlag + // HasValue checks if Value has been set in PatternFlowGtpv2PiggybackingFlag + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv2PiggybackingFlag. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv2PiggybackingFlag + SetValues(value []uint32) PatternFlowGtpv2PiggybackingFlag + // Increment returns PatternFlowGtpv2PiggybackingFlagCounter, set in PatternFlowGtpv2PiggybackingFlag. + // PatternFlowGtpv2PiggybackingFlagCounter is integer counter pattern + Increment() PatternFlowGtpv2PiggybackingFlagCounter + // SetIncrement assigns PatternFlowGtpv2PiggybackingFlagCounter provided by user to PatternFlowGtpv2PiggybackingFlag. + // PatternFlowGtpv2PiggybackingFlagCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv2PiggybackingFlagCounter) PatternFlowGtpv2PiggybackingFlag + // HasIncrement checks if Increment has been set in PatternFlowGtpv2PiggybackingFlag + HasIncrement() bool + // Decrement returns PatternFlowGtpv2PiggybackingFlagCounter, set in PatternFlowGtpv2PiggybackingFlag. + // PatternFlowGtpv2PiggybackingFlagCounter is integer counter pattern + Decrement() PatternFlowGtpv2PiggybackingFlagCounter + // SetDecrement assigns PatternFlowGtpv2PiggybackingFlagCounter provided by user to PatternFlowGtpv2PiggybackingFlag. + // PatternFlowGtpv2PiggybackingFlagCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv2PiggybackingFlagCounter) PatternFlowGtpv2PiggybackingFlag + // HasDecrement checks if Decrement has been set in PatternFlowGtpv2PiggybackingFlag + HasDecrement() bool + // MetricTags returns PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIterIter, set in PatternFlowGtpv2PiggybackingFlag + MetricTags() PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter + setNil() +} + +type PatternFlowGtpv2PiggybackingFlagChoiceEnum string + +// Enum of Choice on PatternFlowGtpv2PiggybackingFlag +var PatternFlowGtpv2PiggybackingFlagChoice = struct { + VALUE PatternFlowGtpv2PiggybackingFlagChoiceEnum + VALUES PatternFlowGtpv2PiggybackingFlagChoiceEnum + INCREMENT PatternFlowGtpv2PiggybackingFlagChoiceEnum + DECREMENT PatternFlowGtpv2PiggybackingFlagChoiceEnum +}{ + VALUE: PatternFlowGtpv2PiggybackingFlagChoiceEnum("value"), + VALUES: PatternFlowGtpv2PiggybackingFlagChoiceEnum("values"), + INCREMENT: PatternFlowGtpv2PiggybackingFlagChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv2PiggybackingFlagChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv2PiggybackingFlag) Choice() PatternFlowGtpv2PiggybackingFlagChoiceEnum { + return PatternFlowGtpv2PiggybackingFlagChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv2PiggybackingFlag) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv2PiggybackingFlag) setChoice(value PatternFlowGtpv2PiggybackingFlagChoiceEnum) PatternFlowGtpv2PiggybackingFlag { + intValue, ok := otg.PatternFlowGtpv2PiggybackingFlag_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv2PiggybackingFlagChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv2PiggybackingFlag_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv2PiggybackingFlagChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv2PiggybackingFlagChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv2PiggybackingFlagChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv2PiggybackingFlagCounter().msg() + } + + if value == PatternFlowGtpv2PiggybackingFlagChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv2PiggybackingFlagCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2PiggybackingFlag) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2PiggybackingFlag) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv2PiggybackingFlag object +func (obj *patternFlowGtpv2PiggybackingFlag) SetValue(value uint32) PatternFlowGtpv2PiggybackingFlag { + obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv2PiggybackingFlag) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv2PiggybackingFlag object +func (obj *patternFlowGtpv2PiggybackingFlag) SetValues(value []uint32) PatternFlowGtpv2PiggybackingFlag { + obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv2PiggybackingFlagCounter +func (obj *patternFlowGtpv2PiggybackingFlag) Increment() PatternFlowGtpv2PiggybackingFlagCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv2PiggybackingFlagCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv2PiggybackingFlagCounter +func (obj *patternFlowGtpv2PiggybackingFlag) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv2PiggybackingFlagCounter value in the PatternFlowGtpv2PiggybackingFlag object +func (obj *patternFlowGtpv2PiggybackingFlag) SetIncrement(value PatternFlowGtpv2PiggybackingFlagCounter) PatternFlowGtpv2PiggybackingFlag { + obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2PiggybackingFlagCounter +func (obj *patternFlowGtpv2PiggybackingFlag) Decrement() PatternFlowGtpv2PiggybackingFlagCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv2PiggybackingFlagCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2PiggybackingFlagCounter +func (obj *patternFlowGtpv2PiggybackingFlag) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv2PiggybackingFlagCounter value in the PatternFlowGtpv2PiggybackingFlag object +func (obj *patternFlowGtpv2PiggybackingFlag) SetDecrement(value PatternFlowGtpv2PiggybackingFlagCounter) PatternFlowGtpv2PiggybackingFlag { + obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv2PiggybackingFlagMetricTag +func (obj *patternFlowGtpv2PiggybackingFlag) MetricTags() PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv2PiggybackingFlagMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter struct { + obj *patternFlowGtpv2PiggybackingFlag + patternFlowGtpv2PiggybackingFlagMetricTagSlice []PatternFlowGtpv2PiggybackingFlagMetricTag + fieldPtr *[]*otg.PatternFlowGtpv2PiggybackingFlagMetricTag +} + +func newPatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter(ptr *[]*otg.PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { + return &patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter interface { + setMsg(*patternFlowGtpv2PiggybackingFlag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter + Items() []PatternFlowGtpv2PiggybackingFlagMetricTag + Add() PatternFlowGtpv2PiggybackingFlagMetricTag + Append(items ...PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter + Set(index int, newObj PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter + Clear() PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter + clearHolderSlice() PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter + appendHolderSlice(item PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter +} + +func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) setMsg(msg *patternFlowGtpv2PiggybackingFlag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv2PiggybackingFlagMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) Items() []PatternFlowGtpv2PiggybackingFlagMetricTag { + return obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice +} + +func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) Add() PatternFlowGtpv2PiggybackingFlagMetricTag { + newObj := &otg.PatternFlowGtpv2PiggybackingFlagMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv2PiggybackingFlagMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice = append(obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) Append(items ...PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice = append(obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) Set(index int, newObj PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) Clear() PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv2PiggybackingFlagMetricTag{} + obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice = []PatternFlowGtpv2PiggybackingFlagMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) clearHolderSlice() PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { + if len(obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice) > 0 { + obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice = []PatternFlowGtpv2PiggybackingFlagMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter) appendHolderSlice(item PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagPatternFlowGtpv2PiggybackingFlagMetricTagIter { + obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice = append(obj.patternFlowGtpv2PiggybackingFlagMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv2PiggybackingFlag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2PiggybackingFlag.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv2PiggybackingFlag.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv2PiggybackingFlagMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv2PiggybackingFlag) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv2PiggybackingFlagChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv2PiggybackingFlagChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv2PiggybackingFlagChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv2PiggybackingFlagChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv2PiggybackingFlagChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv2PiggybackingFlagChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2PiggybackingFlag") + } + } else { + intVal := otg.PatternFlowGtpv2PiggybackingFlag_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv2PiggybackingFlag_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_piggybacking_flag_counter.go b/gosnappi/pattern_flow_gtpv2_piggybacking_flag_counter.go new file mode 100644 index 00000000..165be078 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_piggybacking_flag_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv2PiggybackingFlagCounter ***** +type patternFlowGtpv2PiggybackingFlagCounter struct { + validation + obj *otg.PatternFlowGtpv2PiggybackingFlagCounter + marshaller marshalPatternFlowGtpv2PiggybackingFlagCounter + unMarshaller unMarshalPatternFlowGtpv2PiggybackingFlagCounter +} + +func NewPatternFlowGtpv2PiggybackingFlagCounter() PatternFlowGtpv2PiggybackingFlagCounter { + obj := patternFlowGtpv2PiggybackingFlagCounter{obj: &otg.PatternFlowGtpv2PiggybackingFlagCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2PiggybackingFlagCounter) msg() *otg.PatternFlowGtpv2PiggybackingFlagCounter { + return obj.obj +} + +func (obj *patternFlowGtpv2PiggybackingFlagCounter) setMsg(msg *otg.PatternFlowGtpv2PiggybackingFlagCounter) PatternFlowGtpv2PiggybackingFlagCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2PiggybackingFlagCounter struct { + obj *patternFlowGtpv2PiggybackingFlagCounter +} + +type marshalPatternFlowGtpv2PiggybackingFlagCounter interface { + // ToProto marshals PatternFlowGtpv2PiggybackingFlagCounter to protobuf object *otg.PatternFlowGtpv2PiggybackingFlagCounter + ToProto() (*otg.PatternFlowGtpv2PiggybackingFlagCounter, error) + // ToPbText marshals PatternFlowGtpv2PiggybackingFlagCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2PiggybackingFlagCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2PiggybackingFlagCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2PiggybackingFlagCounter struct { + obj *patternFlowGtpv2PiggybackingFlagCounter +} + +type unMarshalPatternFlowGtpv2PiggybackingFlagCounter interface { + // FromProto unmarshals PatternFlowGtpv2PiggybackingFlagCounter from protobuf object *otg.PatternFlowGtpv2PiggybackingFlagCounter + FromProto(msg *otg.PatternFlowGtpv2PiggybackingFlagCounter) (PatternFlowGtpv2PiggybackingFlagCounter, error) + // FromPbText unmarshals PatternFlowGtpv2PiggybackingFlagCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2PiggybackingFlagCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2PiggybackingFlagCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2PiggybackingFlagCounter) Marshal() marshalPatternFlowGtpv2PiggybackingFlagCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2PiggybackingFlagCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2PiggybackingFlagCounter) Unmarshal() unMarshalPatternFlowGtpv2PiggybackingFlagCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2PiggybackingFlagCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2PiggybackingFlagCounter) ToProto() (*otg.PatternFlowGtpv2PiggybackingFlagCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2PiggybackingFlagCounter) FromProto(msg *otg.PatternFlowGtpv2PiggybackingFlagCounter) (PatternFlowGtpv2PiggybackingFlagCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2PiggybackingFlagCounter) 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 *unMarshalpatternFlowGtpv2PiggybackingFlagCounter) 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 *marshalpatternFlowGtpv2PiggybackingFlagCounter) 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 *unMarshalpatternFlowGtpv2PiggybackingFlagCounter) 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 *marshalpatternFlowGtpv2PiggybackingFlagCounter) 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 *unMarshalpatternFlowGtpv2PiggybackingFlagCounter) 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 *patternFlowGtpv2PiggybackingFlagCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2PiggybackingFlagCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2PiggybackingFlagCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2PiggybackingFlagCounter) Clone() (PatternFlowGtpv2PiggybackingFlagCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2PiggybackingFlagCounter() + 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 +} + +// PatternFlowGtpv2PiggybackingFlagCounter is integer counter pattern +type PatternFlowGtpv2PiggybackingFlagCounter interface { + Validation + // msg marshals PatternFlowGtpv2PiggybackingFlagCounter to protobuf object *otg.PatternFlowGtpv2PiggybackingFlagCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2PiggybackingFlagCounter + // setMsg unmarshals PatternFlowGtpv2PiggybackingFlagCounter from protobuf object *otg.PatternFlowGtpv2PiggybackingFlagCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2PiggybackingFlagCounter) PatternFlowGtpv2PiggybackingFlagCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv2PiggybackingFlagCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2PiggybackingFlagCounter + // validate validates PatternFlowGtpv2PiggybackingFlagCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2PiggybackingFlagCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv2PiggybackingFlagCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv2PiggybackingFlagCounter + SetStart(value uint32) PatternFlowGtpv2PiggybackingFlagCounter + // HasStart checks if Start has been set in PatternFlowGtpv2PiggybackingFlagCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv2PiggybackingFlagCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv2PiggybackingFlagCounter + SetStep(value uint32) PatternFlowGtpv2PiggybackingFlagCounter + // HasStep checks if Step has been set in PatternFlowGtpv2PiggybackingFlagCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv2PiggybackingFlagCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv2PiggybackingFlagCounter + SetCount(value uint32) PatternFlowGtpv2PiggybackingFlagCounter + // HasCount checks if Count has been set in PatternFlowGtpv2PiggybackingFlagCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2PiggybackingFlagCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2PiggybackingFlagCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv2PiggybackingFlagCounter object +func (obj *patternFlowGtpv2PiggybackingFlagCounter) SetStart(value uint32) PatternFlowGtpv2PiggybackingFlagCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2PiggybackingFlagCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2PiggybackingFlagCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv2PiggybackingFlagCounter object +func (obj *patternFlowGtpv2PiggybackingFlagCounter) SetStep(value uint32) PatternFlowGtpv2PiggybackingFlagCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2PiggybackingFlagCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2PiggybackingFlagCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv2PiggybackingFlagCounter object +func (obj *patternFlowGtpv2PiggybackingFlagCounter) SetCount(value uint32) PatternFlowGtpv2PiggybackingFlagCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv2PiggybackingFlagCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2PiggybackingFlagCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2PiggybackingFlagCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2PiggybackingFlagCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv2PiggybackingFlagCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_piggybacking_flag_metric_tag.go b/gosnappi/pattern_flow_gtpv2_piggybacking_flag_metric_tag.go new file mode 100644 index 00000000..d717c9c9 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_piggybacking_flag_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv2PiggybackingFlagMetricTag ***** +type patternFlowGtpv2PiggybackingFlagMetricTag struct { + validation + obj *otg.PatternFlowGtpv2PiggybackingFlagMetricTag + marshaller marshalPatternFlowGtpv2PiggybackingFlagMetricTag + unMarshaller unMarshalPatternFlowGtpv2PiggybackingFlagMetricTag +} + +func NewPatternFlowGtpv2PiggybackingFlagMetricTag() PatternFlowGtpv2PiggybackingFlagMetricTag { + obj := patternFlowGtpv2PiggybackingFlagMetricTag{obj: &otg.PatternFlowGtpv2PiggybackingFlagMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) msg() *otg.PatternFlowGtpv2PiggybackingFlagMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) setMsg(msg *otg.PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2PiggybackingFlagMetricTag struct { + obj *patternFlowGtpv2PiggybackingFlagMetricTag +} + +type marshalPatternFlowGtpv2PiggybackingFlagMetricTag interface { + // ToProto marshals PatternFlowGtpv2PiggybackingFlagMetricTag to protobuf object *otg.PatternFlowGtpv2PiggybackingFlagMetricTag + ToProto() (*otg.PatternFlowGtpv2PiggybackingFlagMetricTag, error) + // ToPbText marshals PatternFlowGtpv2PiggybackingFlagMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2PiggybackingFlagMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2PiggybackingFlagMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2PiggybackingFlagMetricTag struct { + obj *patternFlowGtpv2PiggybackingFlagMetricTag +} + +type unMarshalPatternFlowGtpv2PiggybackingFlagMetricTag interface { + // FromProto unmarshals PatternFlowGtpv2PiggybackingFlagMetricTag from protobuf object *otg.PatternFlowGtpv2PiggybackingFlagMetricTag + FromProto(msg *otg.PatternFlowGtpv2PiggybackingFlagMetricTag) (PatternFlowGtpv2PiggybackingFlagMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv2PiggybackingFlagMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2PiggybackingFlagMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2PiggybackingFlagMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) Marshal() marshalPatternFlowGtpv2PiggybackingFlagMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2PiggybackingFlagMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) Unmarshal() unMarshalPatternFlowGtpv2PiggybackingFlagMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2PiggybackingFlagMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2PiggybackingFlagMetricTag) ToProto() (*otg.PatternFlowGtpv2PiggybackingFlagMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2PiggybackingFlagMetricTag) FromProto(msg *otg.PatternFlowGtpv2PiggybackingFlagMetricTag) (PatternFlowGtpv2PiggybackingFlagMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2PiggybackingFlagMetricTag) 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 *unMarshalpatternFlowGtpv2PiggybackingFlagMetricTag) 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 *marshalpatternFlowGtpv2PiggybackingFlagMetricTag) 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 *unMarshalpatternFlowGtpv2PiggybackingFlagMetricTag) 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 *marshalpatternFlowGtpv2PiggybackingFlagMetricTag) 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 *unMarshalpatternFlowGtpv2PiggybackingFlagMetricTag) 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 *patternFlowGtpv2PiggybackingFlagMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) Clone() (PatternFlowGtpv2PiggybackingFlagMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2PiggybackingFlagMetricTag() + 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 +} + +// PatternFlowGtpv2PiggybackingFlagMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv2PiggybackingFlagMetricTag interface { + Validation + // msg marshals PatternFlowGtpv2PiggybackingFlagMetricTag to protobuf object *otg.PatternFlowGtpv2PiggybackingFlagMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2PiggybackingFlagMetricTag + // setMsg unmarshals PatternFlowGtpv2PiggybackingFlagMetricTag from protobuf object *otg.PatternFlowGtpv2PiggybackingFlagMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2PiggybackingFlagMetricTag) PatternFlowGtpv2PiggybackingFlagMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv2PiggybackingFlagMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2PiggybackingFlagMetricTag + // validate validates PatternFlowGtpv2PiggybackingFlagMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2PiggybackingFlagMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv2PiggybackingFlagMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv2PiggybackingFlagMetricTag + SetName(value string) PatternFlowGtpv2PiggybackingFlagMetricTag + // Offset returns uint32, set in PatternFlowGtpv2PiggybackingFlagMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv2PiggybackingFlagMetricTag + SetOffset(value uint32) PatternFlowGtpv2PiggybackingFlagMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv2PiggybackingFlagMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv2PiggybackingFlagMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv2PiggybackingFlagMetricTag + SetLength(value uint32) PatternFlowGtpv2PiggybackingFlagMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv2PiggybackingFlagMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv2PiggybackingFlagMetricTag object +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) SetName(value string) PatternFlowGtpv2PiggybackingFlagMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv2PiggybackingFlagMetricTag object +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) SetOffset(value uint32) PatternFlowGtpv2PiggybackingFlagMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv2PiggybackingFlagMetricTag object +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) SetLength(value uint32) PatternFlowGtpv2PiggybackingFlagMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2PiggybackingFlagMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2PiggybackingFlagMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv2PiggybackingFlagMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv2PiggybackingFlagMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_sequence_number.go b/gosnappi/pattern_flow_gtpv2_sequence_number.go new file mode 100644 index 00000000..5fe205a2 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_sequence_number.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv2SequenceNumber ***** +type patternFlowGtpv2SequenceNumber struct { + validation + obj *otg.PatternFlowGtpv2SequenceNumber + marshaller marshalPatternFlowGtpv2SequenceNumber + unMarshaller unMarshalPatternFlowGtpv2SequenceNumber + incrementHolder PatternFlowGtpv2SequenceNumberCounter + decrementHolder PatternFlowGtpv2SequenceNumberCounter + metricTagsHolder PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter +} + +func NewPatternFlowGtpv2SequenceNumber() PatternFlowGtpv2SequenceNumber { + obj := patternFlowGtpv2SequenceNumber{obj: &otg.PatternFlowGtpv2SequenceNumber{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2SequenceNumber) msg() *otg.PatternFlowGtpv2SequenceNumber { + return obj.obj +} + +func (obj *patternFlowGtpv2SequenceNumber) setMsg(msg *otg.PatternFlowGtpv2SequenceNumber) PatternFlowGtpv2SequenceNumber { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2SequenceNumber struct { + obj *patternFlowGtpv2SequenceNumber +} + +type marshalPatternFlowGtpv2SequenceNumber interface { + // ToProto marshals PatternFlowGtpv2SequenceNumber to protobuf object *otg.PatternFlowGtpv2SequenceNumber + ToProto() (*otg.PatternFlowGtpv2SequenceNumber, error) + // ToPbText marshals PatternFlowGtpv2SequenceNumber to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2SequenceNumber to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2SequenceNumber to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2SequenceNumber struct { + obj *patternFlowGtpv2SequenceNumber +} + +type unMarshalPatternFlowGtpv2SequenceNumber interface { + // FromProto unmarshals PatternFlowGtpv2SequenceNumber from protobuf object *otg.PatternFlowGtpv2SequenceNumber + FromProto(msg *otg.PatternFlowGtpv2SequenceNumber) (PatternFlowGtpv2SequenceNumber, error) + // FromPbText unmarshals PatternFlowGtpv2SequenceNumber from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2SequenceNumber from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2SequenceNumber from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2SequenceNumber) Marshal() marshalPatternFlowGtpv2SequenceNumber { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2SequenceNumber{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2SequenceNumber) Unmarshal() unMarshalPatternFlowGtpv2SequenceNumber { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2SequenceNumber{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2SequenceNumber) ToProto() (*otg.PatternFlowGtpv2SequenceNumber, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2SequenceNumber) FromProto(msg *otg.PatternFlowGtpv2SequenceNumber) (PatternFlowGtpv2SequenceNumber, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2SequenceNumber) 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 *unMarshalpatternFlowGtpv2SequenceNumber) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv2SequenceNumber) 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 *unMarshalpatternFlowGtpv2SequenceNumber) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv2SequenceNumber) 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 *unMarshalpatternFlowGtpv2SequenceNumber) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv2SequenceNumber) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2SequenceNumber) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2SequenceNumber) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2SequenceNumber) Clone() (PatternFlowGtpv2SequenceNumber, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2SequenceNumber() + 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 +} + +func (obj *patternFlowGtpv2SequenceNumber) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv2SequenceNumber is the sequence number +type PatternFlowGtpv2SequenceNumber interface { + Validation + // msg marshals PatternFlowGtpv2SequenceNumber to protobuf object *otg.PatternFlowGtpv2SequenceNumber + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2SequenceNumber + // setMsg unmarshals PatternFlowGtpv2SequenceNumber from protobuf object *otg.PatternFlowGtpv2SequenceNumber + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2SequenceNumber) PatternFlowGtpv2SequenceNumber + // provides marshal interface + Marshal() marshalPatternFlowGtpv2SequenceNumber + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2SequenceNumber + // validate validates PatternFlowGtpv2SequenceNumber + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2SequenceNumber, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv2SequenceNumberChoiceEnum, set in PatternFlowGtpv2SequenceNumber + Choice() PatternFlowGtpv2SequenceNumberChoiceEnum + // setChoice assigns PatternFlowGtpv2SequenceNumberChoiceEnum provided by user to PatternFlowGtpv2SequenceNumber + setChoice(value PatternFlowGtpv2SequenceNumberChoiceEnum) PatternFlowGtpv2SequenceNumber + // HasChoice checks if Choice has been set in PatternFlowGtpv2SequenceNumber + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv2SequenceNumber. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv2SequenceNumber + SetValue(value uint32) PatternFlowGtpv2SequenceNumber + // HasValue checks if Value has been set in PatternFlowGtpv2SequenceNumber + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv2SequenceNumber. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv2SequenceNumber + SetValues(value []uint32) PatternFlowGtpv2SequenceNumber + // Increment returns PatternFlowGtpv2SequenceNumberCounter, set in PatternFlowGtpv2SequenceNumber. + // PatternFlowGtpv2SequenceNumberCounter is integer counter pattern + Increment() PatternFlowGtpv2SequenceNumberCounter + // SetIncrement assigns PatternFlowGtpv2SequenceNumberCounter provided by user to PatternFlowGtpv2SequenceNumber. + // PatternFlowGtpv2SequenceNumberCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv2SequenceNumberCounter) PatternFlowGtpv2SequenceNumber + // HasIncrement checks if Increment has been set in PatternFlowGtpv2SequenceNumber + HasIncrement() bool + // Decrement returns PatternFlowGtpv2SequenceNumberCounter, set in PatternFlowGtpv2SequenceNumber. + // PatternFlowGtpv2SequenceNumberCounter is integer counter pattern + Decrement() PatternFlowGtpv2SequenceNumberCounter + // SetDecrement assigns PatternFlowGtpv2SequenceNumberCounter provided by user to PatternFlowGtpv2SequenceNumber. + // PatternFlowGtpv2SequenceNumberCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv2SequenceNumberCounter) PatternFlowGtpv2SequenceNumber + // HasDecrement checks if Decrement has been set in PatternFlowGtpv2SequenceNumber + HasDecrement() bool + // MetricTags returns PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIterIter, set in PatternFlowGtpv2SequenceNumber + MetricTags() PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter + setNil() +} + +type PatternFlowGtpv2SequenceNumberChoiceEnum string + +// Enum of Choice on PatternFlowGtpv2SequenceNumber +var PatternFlowGtpv2SequenceNumberChoice = struct { + VALUE PatternFlowGtpv2SequenceNumberChoiceEnum + VALUES PatternFlowGtpv2SequenceNumberChoiceEnum + INCREMENT PatternFlowGtpv2SequenceNumberChoiceEnum + DECREMENT PatternFlowGtpv2SequenceNumberChoiceEnum +}{ + VALUE: PatternFlowGtpv2SequenceNumberChoiceEnum("value"), + VALUES: PatternFlowGtpv2SequenceNumberChoiceEnum("values"), + INCREMENT: PatternFlowGtpv2SequenceNumberChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv2SequenceNumberChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv2SequenceNumber) Choice() PatternFlowGtpv2SequenceNumberChoiceEnum { + return PatternFlowGtpv2SequenceNumberChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv2SequenceNumber) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv2SequenceNumber) setChoice(value PatternFlowGtpv2SequenceNumberChoiceEnum) PatternFlowGtpv2SequenceNumber { + intValue, ok := otg.PatternFlowGtpv2SequenceNumber_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv2SequenceNumberChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv2SequenceNumber_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv2SequenceNumberChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv2SequenceNumberChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv2SequenceNumberChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv2SequenceNumberCounter().msg() + } + + if value == PatternFlowGtpv2SequenceNumberChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv2SequenceNumberCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2SequenceNumber) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2SequenceNumber) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv2SequenceNumber object +func (obj *patternFlowGtpv2SequenceNumber) SetValue(value uint32) PatternFlowGtpv2SequenceNumber { + obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv2SequenceNumber) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv2SequenceNumber object +func (obj *patternFlowGtpv2SequenceNumber) SetValues(value []uint32) PatternFlowGtpv2SequenceNumber { + obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv2SequenceNumberCounter +func (obj *patternFlowGtpv2SequenceNumber) Increment() PatternFlowGtpv2SequenceNumberCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv2SequenceNumberCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv2SequenceNumberCounter +func (obj *patternFlowGtpv2SequenceNumber) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv2SequenceNumberCounter value in the PatternFlowGtpv2SequenceNumber object +func (obj *patternFlowGtpv2SequenceNumber) SetIncrement(value PatternFlowGtpv2SequenceNumberCounter) PatternFlowGtpv2SequenceNumber { + obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2SequenceNumberCounter +func (obj *patternFlowGtpv2SequenceNumber) Decrement() PatternFlowGtpv2SequenceNumberCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv2SequenceNumberCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2SequenceNumberCounter +func (obj *patternFlowGtpv2SequenceNumber) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv2SequenceNumberCounter value in the PatternFlowGtpv2SequenceNumber object +func (obj *patternFlowGtpv2SequenceNumber) SetDecrement(value PatternFlowGtpv2SequenceNumberCounter) PatternFlowGtpv2SequenceNumber { + obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv2SequenceNumberMetricTag +func (obj *patternFlowGtpv2SequenceNumber) MetricTags() PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv2SequenceNumberMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter struct { + obj *patternFlowGtpv2SequenceNumber + patternFlowGtpv2SequenceNumberMetricTagSlice []PatternFlowGtpv2SequenceNumberMetricTag + fieldPtr *[]*otg.PatternFlowGtpv2SequenceNumberMetricTag +} + +func newPatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter(ptr *[]*otg.PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { + return &patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter interface { + setMsg(*patternFlowGtpv2SequenceNumber) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter + Items() []PatternFlowGtpv2SequenceNumberMetricTag + Add() PatternFlowGtpv2SequenceNumberMetricTag + Append(items ...PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter + Set(index int, newObj PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter + Clear() PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter + clearHolderSlice() PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter + appendHolderSlice(item PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter +} + +func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) setMsg(msg *patternFlowGtpv2SequenceNumber) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv2SequenceNumberMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) Items() []PatternFlowGtpv2SequenceNumberMetricTag { + return obj.patternFlowGtpv2SequenceNumberMetricTagSlice +} + +func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) Add() PatternFlowGtpv2SequenceNumberMetricTag { + newObj := &otg.PatternFlowGtpv2SequenceNumberMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv2SequenceNumberMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv2SequenceNumberMetricTagSlice = append(obj.patternFlowGtpv2SequenceNumberMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) Append(items ...PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv2SequenceNumberMetricTagSlice = append(obj.patternFlowGtpv2SequenceNumberMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) Set(index int, newObj PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv2SequenceNumberMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) Clear() PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv2SequenceNumberMetricTag{} + obj.patternFlowGtpv2SequenceNumberMetricTagSlice = []PatternFlowGtpv2SequenceNumberMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) clearHolderSlice() PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { + if len(obj.patternFlowGtpv2SequenceNumberMetricTagSlice) > 0 { + obj.patternFlowGtpv2SequenceNumberMetricTagSlice = []PatternFlowGtpv2SequenceNumberMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter) appendHolderSlice(item PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberPatternFlowGtpv2SequenceNumberMetricTagIter { + obj.patternFlowGtpv2SequenceNumberMetricTagSlice = append(obj.patternFlowGtpv2SequenceNumberMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv2SequenceNumber) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2SequenceNumber.Value <= 16777215 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv2SequenceNumber.Values <= 16777215 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv2SequenceNumberMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv2SequenceNumber) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv2SequenceNumberChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv2SequenceNumberChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv2SequenceNumberChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv2SequenceNumberChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv2SequenceNumberChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv2SequenceNumberChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2SequenceNumber") + } + } else { + intVal := otg.PatternFlowGtpv2SequenceNumber_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv2SequenceNumber_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_sequence_number_counter.go b/gosnappi/pattern_flow_gtpv2_sequence_number_counter.go new file mode 100644 index 00000000..11ef696d --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_sequence_number_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv2SequenceNumberCounter ***** +type patternFlowGtpv2SequenceNumberCounter struct { + validation + obj *otg.PatternFlowGtpv2SequenceNumberCounter + marshaller marshalPatternFlowGtpv2SequenceNumberCounter + unMarshaller unMarshalPatternFlowGtpv2SequenceNumberCounter +} + +func NewPatternFlowGtpv2SequenceNumberCounter() PatternFlowGtpv2SequenceNumberCounter { + obj := patternFlowGtpv2SequenceNumberCounter{obj: &otg.PatternFlowGtpv2SequenceNumberCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2SequenceNumberCounter) msg() *otg.PatternFlowGtpv2SequenceNumberCounter { + return obj.obj +} + +func (obj *patternFlowGtpv2SequenceNumberCounter) setMsg(msg *otg.PatternFlowGtpv2SequenceNumberCounter) PatternFlowGtpv2SequenceNumberCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2SequenceNumberCounter struct { + obj *patternFlowGtpv2SequenceNumberCounter +} + +type marshalPatternFlowGtpv2SequenceNumberCounter interface { + // ToProto marshals PatternFlowGtpv2SequenceNumberCounter to protobuf object *otg.PatternFlowGtpv2SequenceNumberCounter + ToProto() (*otg.PatternFlowGtpv2SequenceNumberCounter, error) + // ToPbText marshals PatternFlowGtpv2SequenceNumberCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2SequenceNumberCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2SequenceNumberCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2SequenceNumberCounter struct { + obj *patternFlowGtpv2SequenceNumberCounter +} + +type unMarshalPatternFlowGtpv2SequenceNumberCounter interface { + // FromProto unmarshals PatternFlowGtpv2SequenceNumberCounter from protobuf object *otg.PatternFlowGtpv2SequenceNumberCounter + FromProto(msg *otg.PatternFlowGtpv2SequenceNumberCounter) (PatternFlowGtpv2SequenceNumberCounter, error) + // FromPbText unmarshals PatternFlowGtpv2SequenceNumberCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2SequenceNumberCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2SequenceNumberCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2SequenceNumberCounter) Marshal() marshalPatternFlowGtpv2SequenceNumberCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2SequenceNumberCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2SequenceNumberCounter) Unmarshal() unMarshalPatternFlowGtpv2SequenceNumberCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2SequenceNumberCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2SequenceNumberCounter) ToProto() (*otg.PatternFlowGtpv2SequenceNumberCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2SequenceNumberCounter) FromProto(msg *otg.PatternFlowGtpv2SequenceNumberCounter) (PatternFlowGtpv2SequenceNumberCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2SequenceNumberCounter) 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 *unMarshalpatternFlowGtpv2SequenceNumberCounter) 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 *marshalpatternFlowGtpv2SequenceNumberCounter) 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 *unMarshalpatternFlowGtpv2SequenceNumberCounter) 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 *marshalpatternFlowGtpv2SequenceNumberCounter) 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 *unMarshalpatternFlowGtpv2SequenceNumberCounter) 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 *patternFlowGtpv2SequenceNumberCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2SequenceNumberCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2SequenceNumberCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2SequenceNumberCounter) Clone() (PatternFlowGtpv2SequenceNumberCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2SequenceNumberCounter() + 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 +} + +// PatternFlowGtpv2SequenceNumberCounter is integer counter pattern +type PatternFlowGtpv2SequenceNumberCounter interface { + Validation + // msg marshals PatternFlowGtpv2SequenceNumberCounter to protobuf object *otg.PatternFlowGtpv2SequenceNumberCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2SequenceNumberCounter + // setMsg unmarshals PatternFlowGtpv2SequenceNumberCounter from protobuf object *otg.PatternFlowGtpv2SequenceNumberCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2SequenceNumberCounter) PatternFlowGtpv2SequenceNumberCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv2SequenceNumberCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2SequenceNumberCounter + // validate validates PatternFlowGtpv2SequenceNumberCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2SequenceNumberCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv2SequenceNumberCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv2SequenceNumberCounter + SetStart(value uint32) PatternFlowGtpv2SequenceNumberCounter + // HasStart checks if Start has been set in PatternFlowGtpv2SequenceNumberCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv2SequenceNumberCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv2SequenceNumberCounter + SetStep(value uint32) PatternFlowGtpv2SequenceNumberCounter + // HasStep checks if Step has been set in PatternFlowGtpv2SequenceNumberCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv2SequenceNumberCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv2SequenceNumberCounter + SetCount(value uint32) PatternFlowGtpv2SequenceNumberCounter + // HasCount checks if Count has been set in PatternFlowGtpv2SequenceNumberCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2SequenceNumberCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2SequenceNumberCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv2SequenceNumberCounter object +func (obj *patternFlowGtpv2SequenceNumberCounter) SetStart(value uint32) PatternFlowGtpv2SequenceNumberCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2SequenceNumberCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2SequenceNumberCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv2SequenceNumberCounter object +func (obj *patternFlowGtpv2SequenceNumberCounter) SetStep(value uint32) PatternFlowGtpv2SequenceNumberCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2SequenceNumberCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2SequenceNumberCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv2SequenceNumberCounter object +func (obj *patternFlowGtpv2SequenceNumberCounter) SetCount(value uint32) PatternFlowGtpv2SequenceNumberCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv2SequenceNumberCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2SequenceNumberCounter.Start <= 16777215 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2SequenceNumberCounter.Step <= 16777215 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2SequenceNumberCounter.Count <= 16777215 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv2SequenceNumberCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_sequence_number_metric_tag.go b/gosnappi/pattern_flow_gtpv2_sequence_number_metric_tag.go new file mode 100644 index 00000000..9d4906b8 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_sequence_number_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv2SequenceNumberMetricTag ***** +type patternFlowGtpv2SequenceNumberMetricTag struct { + validation + obj *otg.PatternFlowGtpv2SequenceNumberMetricTag + marshaller marshalPatternFlowGtpv2SequenceNumberMetricTag + unMarshaller unMarshalPatternFlowGtpv2SequenceNumberMetricTag +} + +func NewPatternFlowGtpv2SequenceNumberMetricTag() PatternFlowGtpv2SequenceNumberMetricTag { + obj := patternFlowGtpv2SequenceNumberMetricTag{obj: &otg.PatternFlowGtpv2SequenceNumberMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2SequenceNumberMetricTag) msg() *otg.PatternFlowGtpv2SequenceNumberMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv2SequenceNumberMetricTag) setMsg(msg *otg.PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2SequenceNumberMetricTag struct { + obj *patternFlowGtpv2SequenceNumberMetricTag +} + +type marshalPatternFlowGtpv2SequenceNumberMetricTag interface { + // ToProto marshals PatternFlowGtpv2SequenceNumberMetricTag to protobuf object *otg.PatternFlowGtpv2SequenceNumberMetricTag + ToProto() (*otg.PatternFlowGtpv2SequenceNumberMetricTag, error) + // ToPbText marshals PatternFlowGtpv2SequenceNumberMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2SequenceNumberMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2SequenceNumberMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2SequenceNumberMetricTag struct { + obj *patternFlowGtpv2SequenceNumberMetricTag +} + +type unMarshalPatternFlowGtpv2SequenceNumberMetricTag interface { + // FromProto unmarshals PatternFlowGtpv2SequenceNumberMetricTag from protobuf object *otg.PatternFlowGtpv2SequenceNumberMetricTag + FromProto(msg *otg.PatternFlowGtpv2SequenceNumberMetricTag) (PatternFlowGtpv2SequenceNumberMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv2SequenceNumberMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2SequenceNumberMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2SequenceNumberMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2SequenceNumberMetricTag) Marshal() marshalPatternFlowGtpv2SequenceNumberMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2SequenceNumberMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2SequenceNumberMetricTag) Unmarshal() unMarshalPatternFlowGtpv2SequenceNumberMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2SequenceNumberMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2SequenceNumberMetricTag) ToProto() (*otg.PatternFlowGtpv2SequenceNumberMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2SequenceNumberMetricTag) FromProto(msg *otg.PatternFlowGtpv2SequenceNumberMetricTag) (PatternFlowGtpv2SequenceNumberMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2SequenceNumberMetricTag) 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 *unMarshalpatternFlowGtpv2SequenceNumberMetricTag) 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 *marshalpatternFlowGtpv2SequenceNumberMetricTag) 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 *unMarshalpatternFlowGtpv2SequenceNumberMetricTag) 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 *marshalpatternFlowGtpv2SequenceNumberMetricTag) 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 *unMarshalpatternFlowGtpv2SequenceNumberMetricTag) 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 *patternFlowGtpv2SequenceNumberMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2SequenceNumberMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2SequenceNumberMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2SequenceNumberMetricTag) Clone() (PatternFlowGtpv2SequenceNumberMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2SequenceNumberMetricTag() + 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 +} + +// PatternFlowGtpv2SequenceNumberMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv2SequenceNumberMetricTag interface { + Validation + // msg marshals PatternFlowGtpv2SequenceNumberMetricTag to protobuf object *otg.PatternFlowGtpv2SequenceNumberMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2SequenceNumberMetricTag + // setMsg unmarshals PatternFlowGtpv2SequenceNumberMetricTag from protobuf object *otg.PatternFlowGtpv2SequenceNumberMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2SequenceNumberMetricTag) PatternFlowGtpv2SequenceNumberMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv2SequenceNumberMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2SequenceNumberMetricTag + // validate validates PatternFlowGtpv2SequenceNumberMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2SequenceNumberMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv2SequenceNumberMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv2SequenceNumberMetricTag + SetName(value string) PatternFlowGtpv2SequenceNumberMetricTag + // Offset returns uint32, set in PatternFlowGtpv2SequenceNumberMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv2SequenceNumberMetricTag + SetOffset(value uint32) PatternFlowGtpv2SequenceNumberMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv2SequenceNumberMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv2SequenceNumberMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv2SequenceNumberMetricTag + SetLength(value uint32) PatternFlowGtpv2SequenceNumberMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv2SequenceNumberMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv2SequenceNumberMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv2SequenceNumberMetricTag object +func (obj *patternFlowGtpv2SequenceNumberMetricTag) SetName(value string) PatternFlowGtpv2SequenceNumberMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2SequenceNumberMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2SequenceNumberMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv2SequenceNumberMetricTag object +func (obj *patternFlowGtpv2SequenceNumberMetricTag) SetOffset(value uint32) PatternFlowGtpv2SequenceNumberMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2SequenceNumberMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2SequenceNumberMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv2SequenceNumberMetricTag object +func (obj *patternFlowGtpv2SequenceNumberMetricTag) SetLength(value uint32) PatternFlowGtpv2SequenceNumberMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv2SequenceNumberMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2SequenceNumberMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 23 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2SequenceNumberMetricTag.Offset <= 23 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 24 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv2SequenceNumberMetricTag.Length <= 24 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv2SequenceNumberMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(24) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_spare1.go b/gosnappi/pattern_flow_gtpv2_spare1.go new file mode 100644 index 00000000..367cb766 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_spare1.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv2Spare1 ***** +type patternFlowGtpv2Spare1 struct { + validation + obj *otg.PatternFlowGtpv2Spare1 + marshaller marshalPatternFlowGtpv2Spare1 + unMarshaller unMarshalPatternFlowGtpv2Spare1 + incrementHolder PatternFlowGtpv2Spare1Counter + decrementHolder PatternFlowGtpv2Spare1Counter + metricTagsHolder PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter +} + +func NewPatternFlowGtpv2Spare1() PatternFlowGtpv2Spare1 { + obj := patternFlowGtpv2Spare1{obj: &otg.PatternFlowGtpv2Spare1{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2Spare1) msg() *otg.PatternFlowGtpv2Spare1 { + return obj.obj +} + +func (obj *patternFlowGtpv2Spare1) setMsg(msg *otg.PatternFlowGtpv2Spare1) PatternFlowGtpv2Spare1 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2Spare1 struct { + obj *patternFlowGtpv2Spare1 +} + +type marshalPatternFlowGtpv2Spare1 interface { + // ToProto marshals PatternFlowGtpv2Spare1 to protobuf object *otg.PatternFlowGtpv2Spare1 + ToProto() (*otg.PatternFlowGtpv2Spare1, error) + // ToPbText marshals PatternFlowGtpv2Spare1 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2Spare1 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2Spare1 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2Spare1 struct { + obj *patternFlowGtpv2Spare1 +} + +type unMarshalPatternFlowGtpv2Spare1 interface { + // FromProto unmarshals PatternFlowGtpv2Spare1 from protobuf object *otg.PatternFlowGtpv2Spare1 + FromProto(msg *otg.PatternFlowGtpv2Spare1) (PatternFlowGtpv2Spare1, error) + // FromPbText unmarshals PatternFlowGtpv2Spare1 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2Spare1 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2Spare1 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2Spare1) Marshal() marshalPatternFlowGtpv2Spare1 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2Spare1{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2Spare1) Unmarshal() unMarshalPatternFlowGtpv2Spare1 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2Spare1{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2Spare1) ToProto() (*otg.PatternFlowGtpv2Spare1, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2Spare1) FromProto(msg *otg.PatternFlowGtpv2Spare1) (PatternFlowGtpv2Spare1, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2Spare1) 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 *unMarshalpatternFlowGtpv2Spare1) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv2Spare1) 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 *unMarshalpatternFlowGtpv2Spare1) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv2Spare1) 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 *unMarshalpatternFlowGtpv2Spare1) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv2Spare1) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Spare1) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Spare1) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2Spare1) Clone() (PatternFlowGtpv2Spare1, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2Spare1() + 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 +} + +func (obj *patternFlowGtpv2Spare1) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv2Spare1 is a 3-bit reserved field (must be 0). +type PatternFlowGtpv2Spare1 interface { + Validation + // msg marshals PatternFlowGtpv2Spare1 to protobuf object *otg.PatternFlowGtpv2Spare1 + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2Spare1 + // setMsg unmarshals PatternFlowGtpv2Spare1 from protobuf object *otg.PatternFlowGtpv2Spare1 + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2Spare1) PatternFlowGtpv2Spare1 + // provides marshal interface + Marshal() marshalPatternFlowGtpv2Spare1 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2Spare1 + // validate validates PatternFlowGtpv2Spare1 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2Spare1, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv2Spare1ChoiceEnum, set in PatternFlowGtpv2Spare1 + Choice() PatternFlowGtpv2Spare1ChoiceEnum + // setChoice assigns PatternFlowGtpv2Spare1ChoiceEnum provided by user to PatternFlowGtpv2Spare1 + setChoice(value PatternFlowGtpv2Spare1ChoiceEnum) PatternFlowGtpv2Spare1 + // HasChoice checks if Choice has been set in PatternFlowGtpv2Spare1 + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv2Spare1. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv2Spare1 + SetValue(value uint32) PatternFlowGtpv2Spare1 + // HasValue checks if Value has been set in PatternFlowGtpv2Spare1 + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv2Spare1. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv2Spare1 + SetValues(value []uint32) PatternFlowGtpv2Spare1 + // Increment returns PatternFlowGtpv2Spare1Counter, set in PatternFlowGtpv2Spare1. + // PatternFlowGtpv2Spare1Counter is integer counter pattern + Increment() PatternFlowGtpv2Spare1Counter + // SetIncrement assigns PatternFlowGtpv2Spare1Counter provided by user to PatternFlowGtpv2Spare1. + // PatternFlowGtpv2Spare1Counter is integer counter pattern + SetIncrement(value PatternFlowGtpv2Spare1Counter) PatternFlowGtpv2Spare1 + // HasIncrement checks if Increment has been set in PatternFlowGtpv2Spare1 + HasIncrement() bool + // Decrement returns PatternFlowGtpv2Spare1Counter, set in PatternFlowGtpv2Spare1. + // PatternFlowGtpv2Spare1Counter is integer counter pattern + Decrement() PatternFlowGtpv2Spare1Counter + // SetDecrement assigns PatternFlowGtpv2Spare1Counter provided by user to PatternFlowGtpv2Spare1. + // PatternFlowGtpv2Spare1Counter is integer counter pattern + SetDecrement(value PatternFlowGtpv2Spare1Counter) PatternFlowGtpv2Spare1 + // HasDecrement checks if Decrement has been set in PatternFlowGtpv2Spare1 + HasDecrement() bool + // MetricTags returns PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIterIter, set in PatternFlowGtpv2Spare1 + MetricTags() PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter + setNil() +} + +type PatternFlowGtpv2Spare1ChoiceEnum string + +// Enum of Choice on PatternFlowGtpv2Spare1 +var PatternFlowGtpv2Spare1Choice = struct { + VALUE PatternFlowGtpv2Spare1ChoiceEnum + VALUES PatternFlowGtpv2Spare1ChoiceEnum + INCREMENT PatternFlowGtpv2Spare1ChoiceEnum + DECREMENT PatternFlowGtpv2Spare1ChoiceEnum +}{ + VALUE: PatternFlowGtpv2Spare1ChoiceEnum("value"), + VALUES: PatternFlowGtpv2Spare1ChoiceEnum("values"), + INCREMENT: PatternFlowGtpv2Spare1ChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv2Spare1ChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv2Spare1) Choice() PatternFlowGtpv2Spare1ChoiceEnum { + return PatternFlowGtpv2Spare1ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv2Spare1) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv2Spare1) setChoice(value PatternFlowGtpv2Spare1ChoiceEnum) PatternFlowGtpv2Spare1 { + intValue, ok := otg.PatternFlowGtpv2Spare1_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv2Spare1ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv2Spare1_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv2Spare1Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv2Spare1Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv2Spare1Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv2Spare1Counter().msg() + } + + if value == PatternFlowGtpv2Spare1Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv2Spare1Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2Spare1) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv2Spare1Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2Spare1) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv2Spare1 object +func (obj *patternFlowGtpv2Spare1) SetValue(value uint32) PatternFlowGtpv2Spare1 { + obj.setChoice(PatternFlowGtpv2Spare1Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv2Spare1) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv2Spare1 object +func (obj *patternFlowGtpv2Spare1) SetValues(value []uint32) PatternFlowGtpv2Spare1 { + obj.setChoice(PatternFlowGtpv2Spare1Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv2Spare1Counter +func (obj *patternFlowGtpv2Spare1) Increment() PatternFlowGtpv2Spare1Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv2Spare1Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv2Spare1Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv2Spare1Counter +func (obj *patternFlowGtpv2Spare1) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv2Spare1Counter value in the PatternFlowGtpv2Spare1 object +func (obj *patternFlowGtpv2Spare1) SetIncrement(value PatternFlowGtpv2Spare1Counter) PatternFlowGtpv2Spare1 { + obj.setChoice(PatternFlowGtpv2Spare1Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2Spare1Counter +func (obj *patternFlowGtpv2Spare1) Decrement() PatternFlowGtpv2Spare1Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv2Spare1Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv2Spare1Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2Spare1Counter +func (obj *patternFlowGtpv2Spare1) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv2Spare1Counter value in the PatternFlowGtpv2Spare1 object +func (obj *patternFlowGtpv2Spare1) SetDecrement(value PatternFlowGtpv2Spare1Counter) PatternFlowGtpv2Spare1 { + obj.setChoice(PatternFlowGtpv2Spare1Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv2Spare1MetricTag +func (obj *patternFlowGtpv2Spare1) MetricTags() PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv2Spare1MetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter struct { + obj *patternFlowGtpv2Spare1 + patternFlowGtpv2Spare1MetricTagSlice []PatternFlowGtpv2Spare1MetricTag + fieldPtr *[]*otg.PatternFlowGtpv2Spare1MetricTag +} + +func newPatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter(ptr *[]*otg.PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { + return &patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter interface { + setMsg(*patternFlowGtpv2Spare1) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter + Items() []PatternFlowGtpv2Spare1MetricTag + Add() PatternFlowGtpv2Spare1MetricTag + Append(items ...PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter + Set(index int, newObj PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter + Clear() PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter + clearHolderSlice() PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter + appendHolderSlice(item PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter +} + +func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) setMsg(msg *patternFlowGtpv2Spare1) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv2Spare1MetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) Items() []PatternFlowGtpv2Spare1MetricTag { + return obj.patternFlowGtpv2Spare1MetricTagSlice +} + +func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) Add() PatternFlowGtpv2Spare1MetricTag { + newObj := &otg.PatternFlowGtpv2Spare1MetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv2Spare1MetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv2Spare1MetricTagSlice = append(obj.patternFlowGtpv2Spare1MetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) Append(items ...PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv2Spare1MetricTagSlice = append(obj.patternFlowGtpv2Spare1MetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) Set(index int, newObj PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv2Spare1MetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) Clear() PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv2Spare1MetricTag{} + obj.patternFlowGtpv2Spare1MetricTagSlice = []PatternFlowGtpv2Spare1MetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) clearHolderSlice() PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { + if len(obj.patternFlowGtpv2Spare1MetricTagSlice) > 0 { + obj.patternFlowGtpv2Spare1MetricTagSlice = []PatternFlowGtpv2Spare1MetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter) appendHolderSlice(item PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1PatternFlowGtpv2Spare1MetricTagIter { + obj.patternFlowGtpv2Spare1MetricTagSlice = append(obj.patternFlowGtpv2Spare1MetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv2Spare1) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2Spare1.Value <= 7 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv2Spare1.Values <= 7 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv2Spare1MetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv2Spare1) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv2Spare1ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv2Spare1Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv2Spare1Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv2Spare1Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv2Spare1Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv2Spare1Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2Spare1") + } + } else { + intVal := otg.PatternFlowGtpv2Spare1_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv2Spare1_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_spare1_counter.go b/gosnappi/pattern_flow_gtpv2_spare1_counter.go new file mode 100644 index 00000000..fa3e3084 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_spare1_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv2Spare1Counter ***** +type patternFlowGtpv2Spare1Counter struct { + validation + obj *otg.PatternFlowGtpv2Spare1Counter + marshaller marshalPatternFlowGtpv2Spare1Counter + unMarshaller unMarshalPatternFlowGtpv2Spare1Counter +} + +func NewPatternFlowGtpv2Spare1Counter() PatternFlowGtpv2Spare1Counter { + obj := patternFlowGtpv2Spare1Counter{obj: &otg.PatternFlowGtpv2Spare1Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2Spare1Counter) msg() *otg.PatternFlowGtpv2Spare1Counter { + return obj.obj +} + +func (obj *patternFlowGtpv2Spare1Counter) setMsg(msg *otg.PatternFlowGtpv2Spare1Counter) PatternFlowGtpv2Spare1Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2Spare1Counter struct { + obj *patternFlowGtpv2Spare1Counter +} + +type marshalPatternFlowGtpv2Spare1Counter interface { + // ToProto marshals PatternFlowGtpv2Spare1Counter to protobuf object *otg.PatternFlowGtpv2Spare1Counter + ToProto() (*otg.PatternFlowGtpv2Spare1Counter, error) + // ToPbText marshals PatternFlowGtpv2Spare1Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2Spare1Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2Spare1Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2Spare1Counter struct { + obj *patternFlowGtpv2Spare1Counter +} + +type unMarshalPatternFlowGtpv2Spare1Counter interface { + // FromProto unmarshals PatternFlowGtpv2Spare1Counter from protobuf object *otg.PatternFlowGtpv2Spare1Counter + FromProto(msg *otg.PatternFlowGtpv2Spare1Counter) (PatternFlowGtpv2Spare1Counter, error) + // FromPbText unmarshals PatternFlowGtpv2Spare1Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2Spare1Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2Spare1Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2Spare1Counter) Marshal() marshalPatternFlowGtpv2Spare1Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2Spare1Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2Spare1Counter) Unmarshal() unMarshalPatternFlowGtpv2Spare1Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2Spare1Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2Spare1Counter) ToProto() (*otg.PatternFlowGtpv2Spare1Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2Spare1Counter) FromProto(msg *otg.PatternFlowGtpv2Spare1Counter) (PatternFlowGtpv2Spare1Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2Spare1Counter) 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 *unMarshalpatternFlowGtpv2Spare1Counter) 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 *marshalpatternFlowGtpv2Spare1Counter) 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 *unMarshalpatternFlowGtpv2Spare1Counter) 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 *marshalpatternFlowGtpv2Spare1Counter) 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 *unMarshalpatternFlowGtpv2Spare1Counter) 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 *patternFlowGtpv2Spare1Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Spare1Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Spare1Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2Spare1Counter) Clone() (PatternFlowGtpv2Spare1Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2Spare1Counter() + 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 +} + +// PatternFlowGtpv2Spare1Counter is integer counter pattern +type PatternFlowGtpv2Spare1Counter interface { + Validation + // msg marshals PatternFlowGtpv2Spare1Counter to protobuf object *otg.PatternFlowGtpv2Spare1Counter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2Spare1Counter + // setMsg unmarshals PatternFlowGtpv2Spare1Counter from protobuf object *otg.PatternFlowGtpv2Spare1Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2Spare1Counter) PatternFlowGtpv2Spare1Counter + // provides marshal interface + Marshal() marshalPatternFlowGtpv2Spare1Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2Spare1Counter + // validate validates PatternFlowGtpv2Spare1Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2Spare1Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv2Spare1Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv2Spare1Counter + SetStart(value uint32) PatternFlowGtpv2Spare1Counter + // HasStart checks if Start has been set in PatternFlowGtpv2Spare1Counter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv2Spare1Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv2Spare1Counter + SetStep(value uint32) PatternFlowGtpv2Spare1Counter + // HasStep checks if Step has been set in PatternFlowGtpv2Spare1Counter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv2Spare1Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv2Spare1Counter + SetCount(value uint32) PatternFlowGtpv2Spare1Counter + // HasCount checks if Count has been set in PatternFlowGtpv2Spare1Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2Spare1Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2Spare1Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv2Spare1Counter object +func (obj *patternFlowGtpv2Spare1Counter) SetStart(value uint32) PatternFlowGtpv2Spare1Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2Spare1Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2Spare1Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv2Spare1Counter object +func (obj *patternFlowGtpv2Spare1Counter) SetStep(value uint32) PatternFlowGtpv2Spare1Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2Spare1Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2Spare1Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv2Spare1Counter object +func (obj *patternFlowGtpv2Spare1Counter) SetCount(value uint32) PatternFlowGtpv2Spare1Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv2Spare1Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2Spare1Counter.Start <= 7 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2Spare1Counter.Step <= 7 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2Spare1Counter.Count <= 7 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv2Spare1Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_spare1_metric_tag.go b/gosnappi/pattern_flow_gtpv2_spare1_metric_tag.go new file mode 100644 index 00000000..7fc55807 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_spare1_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv2Spare1MetricTag ***** +type patternFlowGtpv2Spare1MetricTag struct { + validation + obj *otg.PatternFlowGtpv2Spare1MetricTag + marshaller marshalPatternFlowGtpv2Spare1MetricTag + unMarshaller unMarshalPatternFlowGtpv2Spare1MetricTag +} + +func NewPatternFlowGtpv2Spare1MetricTag() PatternFlowGtpv2Spare1MetricTag { + obj := patternFlowGtpv2Spare1MetricTag{obj: &otg.PatternFlowGtpv2Spare1MetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2Spare1MetricTag) msg() *otg.PatternFlowGtpv2Spare1MetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv2Spare1MetricTag) setMsg(msg *otg.PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1MetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2Spare1MetricTag struct { + obj *patternFlowGtpv2Spare1MetricTag +} + +type marshalPatternFlowGtpv2Spare1MetricTag interface { + // ToProto marshals PatternFlowGtpv2Spare1MetricTag to protobuf object *otg.PatternFlowGtpv2Spare1MetricTag + ToProto() (*otg.PatternFlowGtpv2Spare1MetricTag, error) + // ToPbText marshals PatternFlowGtpv2Spare1MetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2Spare1MetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2Spare1MetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2Spare1MetricTag struct { + obj *patternFlowGtpv2Spare1MetricTag +} + +type unMarshalPatternFlowGtpv2Spare1MetricTag interface { + // FromProto unmarshals PatternFlowGtpv2Spare1MetricTag from protobuf object *otg.PatternFlowGtpv2Spare1MetricTag + FromProto(msg *otg.PatternFlowGtpv2Spare1MetricTag) (PatternFlowGtpv2Spare1MetricTag, error) + // FromPbText unmarshals PatternFlowGtpv2Spare1MetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2Spare1MetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2Spare1MetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2Spare1MetricTag) Marshal() marshalPatternFlowGtpv2Spare1MetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2Spare1MetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2Spare1MetricTag) Unmarshal() unMarshalPatternFlowGtpv2Spare1MetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2Spare1MetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2Spare1MetricTag) ToProto() (*otg.PatternFlowGtpv2Spare1MetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2Spare1MetricTag) FromProto(msg *otg.PatternFlowGtpv2Spare1MetricTag) (PatternFlowGtpv2Spare1MetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2Spare1MetricTag) 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 *unMarshalpatternFlowGtpv2Spare1MetricTag) 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 *marshalpatternFlowGtpv2Spare1MetricTag) 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 *unMarshalpatternFlowGtpv2Spare1MetricTag) 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 *marshalpatternFlowGtpv2Spare1MetricTag) 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 *unMarshalpatternFlowGtpv2Spare1MetricTag) 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 *patternFlowGtpv2Spare1MetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Spare1MetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Spare1MetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2Spare1MetricTag) Clone() (PatternFlowGtpv2Spare1MetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2Spare1MetricTag() + 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 +} + +// PatternFlowGtpv2Spare1MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv2Spare1MetricTag interface { + Validation + // msg marshals PatternFlowGtpv2Spare1MetricTag to protobuf object *otg.PatternFlowGtpv2Spare1MetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2Spare1MetricTag + // setMsg unmarshals PatternFlowGtpv2Spare1MetricTag from protobuf object *otg.PatternFlowGtpv2Spare1MetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2Spare1MetricTag) PatternFlowGtpv2Spare1MetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv2Spare1MetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2Spare1MetricTag + // validate validates PatternFlowGtpv2Spare1MetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2Spare1MetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv2Spare1MetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv2Spare1MetricTag + SetName(value string) PatternFlowGtpv2Spare1MetricTag + // Offset returns uint32, set in PatternFlowGtpv2Spare1MetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv2Spare1MetricTag + SetOffset(value uint32) PatternFlowGtpv2Spare1MetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv2Spare1MetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv2Spare1MetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv2Spare1MetricTag + SetLength(value uint32) PatternFlowGtpv2Spare1MetricTag + // HasLength checks if Length has been set in PatternFlowGtpv2Spare1MetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv2Spare1MetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv2Spare1MetricTag object +func (obj *patternFlowGtpv2Spare1MetricTag) SetName(value string) PatternFlowGtpv2Spare1MetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2Spare1MetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2Spare1MetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv2Spare1MetricTag object +func (obj *patternFlowGtpv2Spare1MetricTag) SetOffset(value uint32) PatternFlowGtpv2Spare1MetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2Spare1MetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2Spare1MetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv2Spare1MetricTag object +func (obj *patternFlowGtpv2Spare1MetricTag) SetLength(value uint32) PatternFlowGtpv2Spare1MetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv2Spare1MetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2Spare1MetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 2 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2Spare1MetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv2Spare1MetricTag.Length <= 3 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv2Spare1MetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(3) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_spare2.go b/gosnappi/pattern_flow_gtpv2_spare2.go new file mode 100644 index 00000000..447e615b --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_spare2.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv2Spare2 ***** +type patternFlowGtpv2Spare2 struct { + validation + obj *otg.PatternFlowGtpv2Spare2 + marshaller marshalPatternFlowGtpv2Spare2 + unMarshaller unMarshalPatternFlowGtpv2Spare2 + incrementHolder PatternFlowGtpv2Spare2Counter + decrementHolder PatternFlowGtpv2Spare2Counter + metricTagsHolder PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter +} + +func NewPatternFlowGtpv2Spare2() PatternFlowGtpv2Spare2 { + obj := patternFlowGtpv2Spare2{obj: &otg.PatternFlowGtpv2Spare2{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2Spare2) msg() *otg.PatternFlowGtpv2Spare2 { + return obj.obj +} + +func (obj *patternFlowGtpv2Spare2) setMsg(msg *otg.PatternFlowGtpv2Spare2) PatternFlowGtpv2Spare2 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2Spare2 struct { + obj *patternFlowGtpv2Spare2 +} + +type marshalPatternFlowGtpv2Spare2 interface { + // ToProto marshals PatternFlowGtpv2Spare2 to protobuf object *otg.PatternFlowGtpv2Spare2 + ToProto() (*otg.PatternFlowGtpv2Spare2, error) + // ToPbText marshals PatternFlowGtpv2Spare2 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2Spare2 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2Spare2 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2Spare2 struct { + obj *patternFlowGtpv2Spare2 +} + +type unMarshalPatternFlowGtpv2Spare2 interface { + // FromProto unmarshals PatternFlowGtpv2Spare2 from protobuf object *otg.PatternFlowGtpv2Spare2 + FromProto(msg *otg.PatternFlowGtpv2Spare2) (PatternFlowGtpv2Spare2, error) + // FromPbText unmarshals PatternFlowGtpv2Spare2 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2Spare2 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2Spare2 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2Spare2) Marshal() marshalPatternFlowGtpv2Spare2 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2Spare2{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2Spare2) Unmarshal() unMarshalPatternFlowGtpv2Spare2 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2Spare2{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2Spare2) ToProto() (*otg.PatternFlowGtpv2Spare2, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2Spare2) FromProto(msg *otg.PatternFlowGtpv2Spare2) (PatternFlowGtpv2Spare2, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2Spare2) 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 *unMarshalpatternFlowGtpv2Spare2) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv2Spare2) 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 *unMarshalpatternFlowGtpv2Spare2) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv2Spare2) 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 *unMarshalpatternFlowGtpv2Spare2) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv2Spare2) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Spare2) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Spare2) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2Spare2) Clone() (PatternFlowGtpv2Spare2, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2Spare2() + 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 +} + +func (obj *patternFlowGtpv2Spare2) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv2Spare2 is reserved field +type PatternFlowGtpv2Spare2 interface { + Validation + // msg marshals PatternFlowGtpv2Spare2 to protobuf object *otg.PatternFlowGtpv2Spare2 + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2Spare2 + // setMsg unmarshals PatternFlowGtpv2Spare2 from protobuf object *otg.PatternFlowGtpv2Spare2 + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2Spare2) PatternFlowGtpv2Spare2 + // provides marshal interface + Marshal() marshalPatternFlowGtpv2Spare2 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2Spare2 + // validate validates PatternFlowGtpv2Spare2 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2Spare2, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv2Spare2ChoiceEnum, set in PatternFlowGtpv2Spare2 + Choice() PatternFlowGtpv2Spare2ChoiceEnum + // setChoice assigns PatternFlowGtpv2Spare2ChoiceEnum provided by user to PatternFlowGtpv2Spare2 + setChoice(value PatternFlowGtpv2Spare2ChoiceEnum) PatternFlowGtpv2Spare2 + // HasChoice checks if Choice has been set in PatternFlowGtpv2Spare2 + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv2Spare2. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv2Spare2 + SetValue(value uint32) PatternFlowGtpv2Spare2 + // HasValue checks if Value has been set in PatternFlowGtpv2Spare2 + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv2Spare2. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv2Spare2 + SetValues(value []uint32) PatternFlowGtpv2Spare2 + // Increment returns PatternFlowGtpv2Spare2Counter, set in PatternFlowGtpv2Spare2. + // PatternFlowGtpv2Spare2Counter is integer counter pattern + Increment() PatternFlowGtpv2Spare2Counter + // SetIncrement assigns PatternFlowGtpv2Spare2Counter provided by user to PatternFlowGtpv2Spare2. + // PatternFlowGtpv2Spare2Counter is integer counter pattern + SetIncrement(value PatternFlowGtpv2Spare2Counter) PatternFlowGtpv2Spare2 + // HasIncrement checks if Increment has been set in PatternFlowGtpv2Spare2 + HasIncrement() bool + // Decrement returns PatternFlowGtpv2Spare2Counter, set in PatternFlowGtpv2Spare2. + // PatternFlowGtpv2Spare2Counter is integer counter pattern + Decrement() PatternFlowGtpv2Spare2Counter + // SetDecrement assigns PatternFlowGtpv2Spare2Counter provided by user to PatternFlowGtpv2Spare2. + // PatternFlowGtpv2Spare2Counter is integer counter pattern + SetDecrement(value PatternFlowGtpv2Spare2Counter) PatternFlowGtpv2Spare2 + // HasDecrement checks if Decrement has been set in PatternFlowGtpv2Spare2 + HasDecrement() bool + // MetricTags returns PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIterIter, set in PatternFlowGtpv2Spare2 + MetricTags() PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter + setNil() +} + +type PatternFlowGtpv2Spare2ChoiceEnum string + +// Enum of Choice on PatternFlowGtpv2Spare2 +var PatternFlowGtpv2Spare2Choice = struct { + VALUE PatternFlowGtpv2Spare2ChoiceEnum + VALUES PatternFlowGtpv2Spare2ChoiceEnum + INCREMENT PatternFlowGtpv2Spare2ChoiceEnum + DECREMENT PatternFlowGtpv2Spare2ChoiceEnum +}{ + VALUE: PatternFlowGtpv2Spare2ChoiceEnum("value"), + VALUES: PatternFlowGtpv2Spare2ChoiceEnum("values"), + INCREMENT: PatternFlowGtpv2Spare2ChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv2Spare2ChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv2Spare2) Choice() PatternFlowGtpv2Spare2ChoiceEnum { + return PatternFlowGtpv2Spare2ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv2Spare2) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv2Spare2) setChoice(value PatternFlowGtpv2Spare2ChoiceEnum) PatternFlowGtpv2Spare2 { + intValue, ok := otg.PatternFlowGtpv2Spare2_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv2Spare2ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv2Spare2_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv2Spare2Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv2Spare2Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv2Spare2Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv2Spare2Counter().msg() + } + + if value == PatternFlowGtpv2Spare2Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv2Spare2Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2Spare2) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv2Spare2Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2Spare2) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv2Spare2 object +func (obj *patternFlowGtpv2Spare2) SetValue(value uint32) PatternFlowGtpv2Spare2 { + obj.setChoice(PatternFlowGtpv2Spare2Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv2Spare2) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv2Spare2 object +func (obj *patternFlowGtpv2Spare2) SetValues(value []uint32) PatternFlowGtpv2Spare2 { + obj.setChoice(PatternFlowGtpv2Spare2Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv2Spare2Counter +func (obj *patternFlowGtpv2Spare2) Increment() PatternFlowGtpv2Spare2Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv2Spare2Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv2Spare2Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv2Spare2Counter +func (obj *patternFlowGtpv2Spare2) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv2Spare2Counter value in the PatternFlowGtpv2Spare2 object +func (obj *patternFlowGtpv2Spare2) SetIncrement(value PatternFlowGtpv2Spare2Counter) PatternFlowGtpv2Spare2 { + obj.setChoice(PatternFlowGtpv2Spare2Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2Spare2Counter +func (obj *patternFlowGtpv2Spare2) Decrement() PatternFlowGtpv2Spare2Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv2Spare2Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv2Spare2Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2Spare2Counter +func (obj *patternFlowGtpv2Spare2) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv2Spare2Counter value in the PatternFlowGtpv2Spare2 object +func (obj *patternFlowGtpv2Spare2) SetDecrement(value PatternFlowGtpv2Spare2Counter) PatternFlowGtpv2Spare2 { + obj.setChoice(PatternFlowGtpv2Spare2Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv2Spare2MetricTag +func (obj *patternFlowGtpv2Spare2) MetricTags() PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv2Spare2MetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter struct { + obj *patternFlowGtpv2Spare2 + patternFlowGtpv2Spare2MetricTagSlice []PatternFlowGtpv2Spare2MetricTag + fieldPtr *[]*otg.PatternFlowGtpv2Spare2MetricTag +} + +func newPatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter(ptr *[]*otg.PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { + return &patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter interface { + setMsg(*patternFlowGtpv2Spare2) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter + Items() []PatternFlowGtpv2Spare2MetricTag + Add() PatternFlowGtpv2Spare2MetricTag + Append(items ...PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter + Set(index int, newObj PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter + Clear() PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter + clearHolderSlice() PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter + appendHolderSlice(item PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter +} + +func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) setMsg(msg *patternFlowGtpv2Spare2) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv2Spare2MetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) Items() []PatternFlowGtpv2Spare2MetricTag { + return obj.patternFlowGtpv2Spare2MetricTagSlice +} + +func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) Add() PatternFlowGtpv2Spare2MetricTag { + newObj := &otg.PatternFlowGtpv2Spare2MetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv2Spare2MetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv2Spare2MetricTagSlice = append(obj.patternFlowGtpv2Spare2MetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) Append(items ...PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv2Spare2MetricTagSlice = append(obj.patternFlowGtpv2Spare2MetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) Set(index int, newObj PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv2Spare2MetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) Clear() PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv2Spare2MetricTag{} + obj.patternFlowGtpv2Spare2MetricTagSlice = []PatternFlowGtpv2Spare2MetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) clearHolderSlice() PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { + if len(obj.patternFlowGtpv2Spare2MetricTagSlice) > 0 { + obj.patternFlowGtpv2Spare2MetricTagSlice = []PatternFlowGtpv2Spare2MetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter) appendHolderSlice(item PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2PatternFlowGtpv2Spare2MetricTagIter { + obj.patternFlowGtpv2Spare2MetricTagSlice = append(obj.patternFlowGtpv2Spare2MetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv2Spare2) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2Spare2.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv2Spare2.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv2Spare2MetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv2Spare2) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv2Spare2ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv2Spare2Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv2Spare2Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv2Spare2Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv2Spare2Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv2Spare2Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2Spare2") + } + } else { + intVal := otg.PatternFlowGtpv2Spare2_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv2Spare2_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_spare2_counter.go b/gosnappi/pattern_flow_gtpv2_spare2_counter.go new file mode 100644 index 00000000..a18754f4 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_spare2_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv2Spare2Counter ***** +type patternFlowGtpv2Spare2Counter struct { + validation + obj *otg.PatternFlowGtpv2Spare2Counter + marshaller marshalPatternFlowGtpv2Spare2Counter + unMarshaller unMarshalPatternFlowGtpv2Spare2Counter +} + +func NewPatternFlowGtpv2Spare2Counter() PatternFlowGtpv2Spare2Counter { + obj := patternFlowGtpv2Spare2Counter{obj: &otg.PatternFlowGtpv2Spare2Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2Spare2Counter) msg() *otg.PatternFlowGtpv2Spare2Counter { + return obj.obj +} + +func (obj *patternFlowGtpv2Spare2Counter) setMsg(msg *otg.PatternFlowGtpv2Spare2Counter) PatternFlowGtpv2Spare2Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2Spare2Counter struct { + obj *patternFlowGtpv2Spare2Counter +} + +type marshalPatternFlowGtpv2Spare2Counter interface { + // ToProto marshals PatternFlowGtpv2Spare2Counter to protobuf object *otg.PatternFlowGtpv2Spare2Counter + ToProto() (*otg.PatternFlowGtpv2Spare2Counter, error) + // ToPbText marshals PatternFlowGtpv2Spare2Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2Spare2Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2Spare2Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2Spare2Counter struct { + obj *patternFlowGtpv2Spare2Counter +} + +type unMarshalPatternFlowGtpv2Spare2Counter interface { + // FromProto unmarshals PatternFlowGtpv2Spare2Counter from protobuf object *otg.PatternFlowGtpv2Spare2Counter + FromProto(msg *otg.PatternFlowGtpv2Spare2Counter) (PatternFlowGtpv2Spare2Counter, error) + // FromPbText unmarshals PatternFlowGtpv2Spare2Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2Spare2Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2Spare2Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2Spare2Counter) Marshal() marshalPatternFlowGtpv2Spare2Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2Spare2Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2Spare2Counter) Unmarshal() unMarshalPatternFlowGtpv2Spare2Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2Spare2Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2Spare2Counter) ToProto() (*otg.PatternFlowGtpv2Spare2Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2Spare2Counter) FromProto(msg *otg.PatternFlowGtpv2Spare2Counter) (PatternFlowGtpv2Spare2Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2Spare2Counter) 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 *unMarshalpatternFlowGtpv2Spare2Counter) 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 *marshalpatternFlowGtpv2Spare2Counter) 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 *unMarshalpatternFlowGtpv2Spare2Counter) 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 *marshalpatternFlowGtpv2Spare2Counter) 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 *unMarshalpatternFlowGtpv2Spare2Counter) 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 *patternFlowGtpv2Spare2Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Spare2Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Spare2Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2Spare2Counter) Clone() (PatternFlowGtpv2Spare2Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2Spare2Counter() + 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 +} + +// PatternFlowGtpv2Spare2Counter is integer counter pattern +type PatternFlowGtpv2Spare2Counter interface { + Validation + // msg marshals PatternFlowGtpv2Spare2Counter to protobuf object *otg.PatternFlowGtpv2Spare2Counter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2Spare2Counter + // setMsg unmarshals PatternFlowGtpv2Spare2Counter from protobuf object *otg.PatternFlowGtpv2Spare2Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2Spare2Counter) PatternFlowGtpv2Spare2Counter + // provides marshal interface + Marshal() marshalPatternFlowGtpv2Spare2Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2Spare2Counter + // validate validates PatternFlowGtpv2Spare2Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2Spare2Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv2Spare2Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv2Spare2Counter + SetStart(value uint32) PatternFlowGtpv2Spare2Counter + // HasStart checks if Start has been set in PatternFlowGtpv2Spare2Counter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv2Spare2Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv2Spare2Counter + SetStep(value uint32) PatternFlowGtpv2Spare2Counter + // HasStep checks if Step has been set in PatternFlowGtpv2Spare2Counter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv2Spare2Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv2Spare2Counter + SetCount(value uint32) PatternFlowGtpv2Spare2Counter + // HasCount checks if Count has been set in PatternFlowGtpv2Spare2Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2Spare2Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2Spare2Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv2Spare2Counter object +func (obj *patternFlowGtpv2Spare2Counter) SetStart(value uint32) PatternFlowGtpv2Spare2Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2Spare2Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2Spare2Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv2Spare2Counter object +func (obj *patternFlowGtpv2Spare2Counter) SetStep(value uint32) PatternFlowGtpv2Spare2Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2Spare2Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2Spare2Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv2Spare2Counter object +func (obj *patternFlowGtpv2Spare2Counter) SetCount(value uint32) PatternFlowGtpv2Spare2Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv2Spare2Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2Spare2Counter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2Spare2Counter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2Spare2Counter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv2Spare2Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_spare2_metric_tag.go b/gosnappi/pattern_flow_gtpv2_spare2_metric_tag.go new file mode 100644 index 00000000..c0d487c8 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_spare2_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv2Spare2MetricTag ***** +type patternFlowGtpv2Spare2MetricTag struct { + validation + obj *otg.PatternFlowGtpv2Spare2MetricTag + marshaller marshalPatternFlowGtpv2Spare2MetricTag + unMarshaller unMarshalPatternFlowGtpv2Spare2MetricTag +} + +func NewPatternFlowGtpv2Spare2MetricTag() PatternFlowGtpv2Spare2MetricTag { + obj := patternFlowGtpv2Spare2MetricTag{obj: &otg.PatternFlowGtpv2Spare2MetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2Spare2MetricTag) msg() *otg.PatternFlowGtpv2Spare2MetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv2Spare2MetricTag) setMsg(msg *otg.PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2MetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2Spare2MetricTag struct { + obj *patternFlowGtpv2Spare2MetricTag +} + +type marshalPatternFlowGtpv2Spare2MetricTag interface { + // ToProto marshals PatternFlowGtpv2Spare2MetricTag to protobuf object *otg.PatternFlowGtpv2Spare2MetricTag + ToProto() (*otg.PatternFlowGtpv2Spare2MetricTag, error) + // ToPbText marshals PatternFlowGtpv2Spare2MetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2Spare2MetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2Spare2MetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2Spare2MetricTag struct { + obj *patternFlowGtpv2Spare2MetricTag +} + +type unMarshalPatternFlowGtpv2Spare2MetricTag interface { + // FromProto unmarshals PatternFlowGtpv2Spare2MetricTag from protobuf object *otg.PatternFlowGtpv2Spare2MetricTag + FromProto(msg *otg.PatternFlowGtpv2Spare2MetricTag) (PatternFlowGtpv2Spare2MetricTag, error) + // FromPbText unmarshals PatternFlowGtpv2Spare2MetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2Spare2MetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2Spare2MetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2Spare2MetricTag) Marshal() marshalPatternFlowGtpv2Spare2MetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2Spare2MetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2Spare2MetricTag) Unmarshal() unMarshalPatternFlowGtpv2Spare2MetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2Spare2MetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2Spare2MetricTag) ToProto() (*otg.PatternFlowGtpv2Spare2MetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2Spare2MetricTag) FromProto(msg *otg.PatternFlowGtpv2Spare2MetricTag) (PatternFlowGtpv2Spare2MetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2Spare2MetricTag) 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 *unMarshalpatternFlowGtpv2Spare2MetricTag) 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 *marshalpatternFlowGtpv2Spare2MetricTag) 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 *unMarshalpatternFlowGtpv2Spare2MetricTag) 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 *marshalpatternFlowGtpv2Spare2MetricTag) 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 *unMarshalpatternFlowGtpv2Spare2MetricTag) 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 *patternFlowGtpv2Spare2MetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Spare2MetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Spare2MetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2Spare2MetricTag) Clone() (PatternFlowGtpv2Spare2MetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2Spare2MetricTag() + 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 +} + +// PatternFlowGtpv2Spare2MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv2Spare2MetricTag interface { + Validation + // msg marshals PatternFlowGtpv2Spare2MetricTag to protobuf object *otg.PatternFlowGtpv2Spare2MetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2Spare2MetricTag + // setMsg unmarshals PatternFlowGtpv2Spare2MetricTag from protobuf object *otg.PatternFlowGtpv2Spare2MetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2Spare2MetricTag) PatternFlowGtpv2Spare2MetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv2Spare2MetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2Spare2MetricTag + // validate validates PatternFlowGtpv2Spare2MetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2Spare2MetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv2Spare2MetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv2Spare2MetricTag + SetName(value string) PatternFlowGtpv2Spare2MetricTag + // Offset returns uint32, set in PatternFlowGtpv2Spare2MetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv2Spare2MetricTag + SetOffset(value uint32) PatternFlowGtpv2Spare2MetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv2Spare2MetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv2Spare2MetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv2Spare2MetricTag + SetLength(value uint32) PatternFlowGtpv2Spare2MetricTag + // HasLength checks if Length has been set in PatternFlowGtpv2Spare2MetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv2Spare2MetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv2Spare2MetricTag object +func (obj *patternFlowGtpv2Spare2MetricTag) SetName(value string) PatternFlowGtpv2Spare2MetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2Spare2MetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2Spare2MetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv2Spare2MetricTag object +func (obj *patternFlowGtpv2Spare2MetricTag) SetOffset(value uint32) PatternFlowGtpv2Spare2MetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2Spare2MetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2Spare2MetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv2Spare2MetricTag object +func (obj *patternFlowGtpv2Spare2MetricTag) SetLength(value uint32) PatternFlowGtpv2Spare2MetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv2Spare2MetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2Spare2MetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2Spare2MetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv2Spare2MetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv2Spare2MetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_teid.go b/gosnappi/pattern_flow_gtpv2_teid.go new file mode 100644 index 00000000..99032d6b --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_teid.go @@ -0,0 +1,640 @@ +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" +) + +// ***** PatternFlowGtpv2Teid ***** +type patternFlowGtpv2Teid struct { + validation + obj *otg.PatternFlowGtpv2Teid + marshaller marshalPatternFlowGtpv2Teid + unMarshaller unMarshalPatternFlowGtpv2Teid + incrementHolder PatternFlowGtpv2TeidCounter + decrementHolder PatternFlowGtpv2TeidCounter + metricTagsHolder PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter +} + +func NewPatternFlowGtpv2Teid() PatternFlowGtpv2Teid { + obj := patternFlowGtpv2Teid{obj: &otg.PatternFlowGtpv2Teid{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2Teid) msg() *otg.PatternFlowGtpv2Teid { + return obj.obj +} + +func (obj *patternFlowGtpv2Teid) setMsg(msg *otg.PatternFlowGtpv2Teid) PatternFlowGtpv2Teid { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2Teid struct { + obj *patternFlowGtpv2Teid +} + +type marshalPatternFlowGtpv2Teid interface { + // ToProto marshals PatternFlowGtpv2Teid to protobuf object *otg.PatternFlowGtpv2Teid + ToProto() (*otg.PatternFlowGtpv2Teid, error) + // ToPbText marshals PatternFlowGtpv2Teid to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2Teid to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2Teid to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2Teid struct { + obj *patternFlowGtpv2Teid +} + +type unMarshalPatternFlowGtpv2Teid interface { + // FromProto unmarshals PatternFlowGtpv2Teid from protobuf object *otg.PatternFlowGtpv2Teid + FromProto(msg *otg.PatternFlowGtpv2Teid) (PatternFlowGtpv2Teid, error) + // FromPbText unmarshals PatternFlowGtpv2Teid from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2Teid from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2Teid from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2Teid) Marshal() marshalPatternFlowGtpv2Teid { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2Teid{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2Teid) Unmarshal() unMarshalPatternFlowGtpv2Teid { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2Teid{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2Teid) ToProto() (*otg.PatternFlowGtpv2Teid, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2Teid) FromProto(msg *otg.PatternFlowGtpv2Teid) (PatternFlowGtpv2Teid, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2Teid) 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 *unMarshalpatternFlowGtpv2Teid) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv2Teid) 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 *unMarshalpatternFlowGtpv2Teid) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv2Teid) 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 *unMarshalpatternFlowGtpv2Teid) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv2Teid) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Teid) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Teid) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2Teid) Clone() (PatternFlowGtpv2Teid, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2Teid() + 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 +} + +func (obj *patternFlowGtpv2Teid) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv2Teid is tunnel endpoint identifier. A 32-bit (4-octet) field used to multiplex different connections in the same GTP tunnel. Is present only if the teid_flag is set. +type PatternFlowGtpv2Teid interface { + Validation + // msg marshals PatternFlowGtpv2Teid to protobuf object *otg.PatternFlowGtpv2Teid + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2Teid + // setMsg unmarshals PatternFlowGtpv2Teid from protobuf object *otg.PatternFlowGtpv2Teid + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2Teid) PatternFlowGtpv2Teid + // provides marshal interface + Marshal() marshalPatternFlowGtpv2Teid + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2Teid + // validate validates PatternFlowGtpv2Teid + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2Teid, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv2TeidChoiceEnum, set in PatternFlowGtpv2Teid + Choice() PatternFlowGtpv2TeidChoiceEnum + // setChoice assigns PatternFlowGtpv2TeidChoiceEnum provided by user to PatternFlowGtpv2Teid + setChoice(value PatternFlowGtpv2TeidChoiceEnum) PatternFlowGtpv2Teid + // HasChoice checks if Choice has been set in PatternFlowGtpv2Teid + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv2Teid. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv2Teid + SetValue(value uint32) PatternFlowGtpv2Teid + // HasValue checks if Value has been set in PatternFlowGtpv2Teid + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv2Teid. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv2Teid + SetValues(value []uint32) PatternFlowGtpv2Teid + // Increment returns PatternFlowGtpv2TeidCounter, set in PatternFlowGtpv2Teid. + // PatternFlowGtpv2TeidCounter is integer counter pattern + Increment() PatternFlowGtpv2TeidCounter + // SetIncrement assigns PatternFlowGtpv2TeidCounter provided by user to PatternFlowGtpv2Teid. + // PatternFlowGtpv2TeidCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv2TeidCounter) PatternFlowGtpv2Teid + // HasIncrement checks if Increment has been set in PatternFlowGtpv2Teid + HasIncrement() bool + // Decrement returns PatternFlowGtpv2TeidCounter, set in PatternFlowGtpv2Teid. + // PatternFlowGtpv2TeidCounter is integer counter pattern + Decrement() PatternFlowGtpv2TeidCounter + // SetDecrement assigns PatternFlowGtpv2TeidCounter provided by user to PatternFlowGtpv2Teid. + // PatternFlowGtpv2TeidCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv2TeidCounter) PatternFlowGtpv2Teid + // HasDecrement checks if Decrement has been set in PatternFlowGtpv2Teid + HasDecrement() bool + // MetricTags returns PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIterIter, set in PatternFlowGtpv2Teid + MetricTags() PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter + setNil() +} + +type PatternFlowGtpv2TeidChoiceEnum string + +// Enum of Choice on PatternFlowGtpv2Teid +var PatternFlowGtpv2TeidChoice = struct { + VALUE PatternFlowGtpv2TeidChoiceEnum + VALUES PatternFlowGtpv2TeidChoiceEnum + INCREMENT PatternFlowGtpv2TeidChoiceEnum + DECREMENT PatternFlowGtpv2TeidChoiceEnum +}{ + VALUE: PatternFlowGtpv2TeidChoiceEnum("value"), + VALUES: PatternFlowGtpv2TeidChoiceEnum("values"), + INCREMENT: PatternFlowGtpv2TeidChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv2TeidChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv2Teid) Choice() PatternFlowGtpv2TeidChoiceEnum { + return PatternFlowGtpv2TeidChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv2Teid) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv2Teid) setChoice(value PatternFlowGtpv2TeidChoiceEnum) PatternFlowGtpv2Teid { + intValue, ok := otg.PatternFlowGtpv2Teid_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv2TeidChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv2Teid_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv2TeidChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv2TeidChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv2TeidChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv2TeidCounter().msg() + } + + if value == PatternFlowGtpv2TeidChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv2TeidCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2Teid) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv2TeidChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2Teid) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv2Teid object +func (obj *patternFlowGtpv2Teid) SetValue(value uint32) PatternFlowGtpv2Teid { + obj.setChoice(PatternFlowGtpv2TeidChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv2Teid) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv2Teid object +func (obj *patternFlowGtpv2Teid) SetValues(value []uint32) PatternFlowGtpv2Teid { + obj.setChoice(PatternFlowGtpv2TeidChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv2TeidCounter +func (obj *patternFlowGtpv2Teid) Increment() PatternFlowGtpv2TeidCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv2TeidChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv2TeidCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv2TeidCounter +func (obj *patternFlowGtpv2Teid) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv2TeidCounter value in the PatternFlowGtpv2Teid object +func (obj *patternFlowGtpv2Teid) SetIncrement(value PatternFlowGtpv2TeidCounter) PatternFlowGtpv2Teid { + obj.setChoice(PatternFlowGtpv2TeidChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2TeidCounter +func (obj *patternFlowGtpv2Teid) Decrement() PatternFlowGtpv2TeidCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv2TeidChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv2TeidCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2TeidCounter +func (obj *patternFlowGtpv2Teid) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv2TeidCounter value in the PatternFlowGtpv2Teid object +func (obj *patternFlowGtpv2Teid) SetDecrement(value PatternFlowGtpv2TeidCounter) PatternFlowGtpv2Teid { + obj.setChoice(PatternFlowGtpv2TeidChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv2TeidMetricTag +func (obj *patternFlowGtpv2Teid) MetricTags() PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv2TeidMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter struct { + obj *patternFlowGtpv2Teid + patternFlowGtpv2TeidMetricTagSlice []PatternFlowGtpv2TeidMetricTag + fieldPtr *[]*otg.PatternFlowGtpv2TeidMetricTag +} + +func newPatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter(ptr *[]*otg.PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { + return &patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter interface { + setMsg(*patternFlowGtpv2Teid) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter + Items() []PatternFlowGtpv2TeidMetricTag + Add() PatternFlowGtpv2TeidMetricTag + Append(items ...PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter + Set(index int, newObj PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter + Clear() PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter + clearHolderSlice() PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter + appendHolderSlice(item PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter +} + +func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) setMsg(msg *patternFlowGtpv2Teid) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv2TeidMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) Items() []PatternFlowGtpv2TeidMetricTag { + return obj.patternFlowGtpv2TeidMetricTagSlice +} + +func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) Add() PatternFlowGtpv2TeidMetricTag { + newObj := &otg.PatternFlowGtpv2TeidMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv2TeidMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv2TeidMetricTagSlice = append(obj.patternFlowGtpv2TeidMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) Append(items ...PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv2TeidMetricTagSlice = append(obj.patternFlowGtpv2TeidMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) Set(index int, newObj PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv2TeidMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) Clear() PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv2TeidMetricTag{} + obj.patternFlowGtpv2TeidMetricTagSlice = []PatternFlowGtpv2TeidMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) clearHolderSlice() PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { + if len(obj.patternFlowGtpv2TeidMetricTagSlice) > 0 { + obj.patternFlowGtpv2TeidMetricTagSlice = []PatternFlowGtpv2TeidMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter) appendHolderSlice(item PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidPatternFlowGtpv2TeidMetricTagIter { + obj.patternFlowGtpv2TeidMetricTagSlice = append(obj.patternFlowGtpv2TeidMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv2Teid) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv2TeidMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv2Teid) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv2TeidChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv2TeidChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv2TeidChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv2TeidChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv2TeidChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv2TeidChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2Teid") + } + } else { + intVal := otg.PatternFlowGtpv2Teid_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv2Teid_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_teid_counter.go b/gosnappi/pattern_flow_gtpv2_teid_counter.go new file mode 100644 index 00000000..66c71c8c --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_teid_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowGtpv2TeidCounter ***** +type patternFlowGtpv2TeidCounter struct { + validation + obj *otg.PatternFlowGtpv2TeidCounter + marshaller marshalPatternFlowGtpv2TeidCounter + unMarshaller unMarshalPatternFlowGtpv2TeidCounter +} + +func NewPatternFlowGtpv2TeidCounter() PatternFlowGtpv2TeidCounter { + obj := patternFlowGtpv2TeidCounter{obj: &otg.PatternFlowGtpv2TeidCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2TeidCounter) msg() *otg.PatternFlowGtpv2TeidCounter { + return obj.obj +} + +func (obj *patternFlowGtpv2TeidCounter) setMsg(msg *otg.PatternFlowGtpv2TeidCounter) PatternFlowGtpv2TeidCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2TeidCounter struct { + obj *patternFlowGtpv2TeidCounter +} + +type marshalPatternFlowGtpv2TeidCounter interface { + // ToProto marshals PatternFlowGtpv2TeidCounter to protobuf object *otg.PatternFlowGtpv2TeidCounter + ToProto() (*otg.PatternFlowGtpv2TeidCounter, error) + // ToPbText marshals PatternFlowGtpv2TeidCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2TeidCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2TeidCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2TeidCounter struct { + obj *patternFlowGtpv2TeidCounter +} + +type unMarshalPatternFlowGtpv2TeidCounter interface { + // FromProto unmarshals PatternFlowGtpv2TeidCounter from protobuf object *otg.PatternFlowGtpv2TeidCounter + FromProto(msg *otg.PatternFlowGtpv2TeidCounter) (PatternFlowGtpv2TeidCounter, error) + // FromPbText unmarshals PatternFlowGtpv2TeidCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2TeidCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2TeidCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2TeidCounter) Marshal() marshalPatternFlowGtpv2TeidCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2TeidCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2TeidCounter) Unmarshal() unMarshalPatternFlowGtpv2TeidCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2TeidCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2TeidCounter) ToProto() (*otg.PatternFlowGtpv2TeidCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2TeidCounter) FromProto(msg *otg.PatternFlowGtpv2TeidCounter) (PatternFlowGtpv2TeidCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2TeidCounter) 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 *unMarshalpatternFlowGtpv2TeidCounter) 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 *marshalpatternFlowGtpv2TeidCounter) 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 *unMarshalpatternFlowGtpv2TeidCounter) 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 *marshalpatternFlowGtpv2TeidCounter) 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 *unMarshalpatternFlowGtpv2TeidCounter) 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 *patternFlowGtpv2TeidCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2TeidCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2TeidCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2TeidCounter) Clone() (PatternFlowGtpv2TeidCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2TeidCounter() + 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 +} + +// PatternFlowGtpv2TeidCounter is integer counter pattern +type PatternFlowGtpv2TeidCounter interface { + Validation + // msg marshals PatternFlowGtpv2TeidCounter to protobuf object *otg.PatternFlowGtpv2TeidCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2TeidCounter + // setMsg unmarshals PatternFlowGtpv2TeidCounter from protobuf object *otg.PatternFlowGtpv2TeidCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2TeidCounter) PatternFlowGtpv2TeidCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv2TeidCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2TeidCounter + // validate validates PatternFlowGtpv2TeidCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2TeidCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv2TeidCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv2TeidCounter + SetStart(value uint32) PatternFlowGtpv2TeidCounter + // HasStart checks if Start has been set in PatternFlowGtpv2TeidCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv2TeidCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv2TeidCounter + SetStep(value uint32) PatternFlowGtpv2TeidCounter + // HasStep checks if Step has been set in PatternFlowGtpv2TeidCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv2TeidCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv2TeidCounter + SetCount(value uint32) PatternFlowGtpv2TeidCounter + // HasCount checks if Count has been set in PatternFlowGtpv2TeidCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2TeidCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2TeidCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv2TeidCounter object +func (obj *patternFlowGtpv2TeidCounter) SetStart(value uint32) PatternFlowGtpv2TeidCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2TeidCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2TeidCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv2TeidCounter object +func (obj *patternFlowGtpv2TeidCounter) SetStep(value uint32) PatternFlowGtpv2TeidCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2TeidCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2TeidCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv2TeidCounter object +func (obj *patternFlowGtpv2TeidCounter) SetCount(value uint32) PatternFlowGtpv2TeidCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv2TeidCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowGtpv2TeidCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_teid_flag.go b/gosnappi/pattern_flow_gtpv2_teid_flag.go new file mode 100644 index 00000000..8393504d --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_teid_flag.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv2TeidFlag ***** +type patternFlowGtpv2TeidFlag struct { + validation + obj *otg.PatternFlowGtpv2TeidFlag + marshaller marshalPatternFlowGtpv2TeidFlag + unMarshaller unMarshalPatternFlowGtpv2TeidFlag + incrementHolder PatternFlowGtpv2TeidFlagCounter + decrementHolder PatternFlowGtpv2TeidFlagCounter + metricTagsHolder PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter +} + +func NewPatternFlowGtpv2TeidFlag() PatternFlowGtpv2TeidFlag { + obj := patternFlowGtpv2TeidFlag{obj: &otg.PatternFlowGtpv2TeidFlag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2TeidFlag) msg() *otg.PatternFlowGtpv2TeidFlag { + return obj.obj +} + +func (obj *patternFlowGtpv2TeidFlag) setMsg(msg *otg.PatternFlowGtpv2TeidFlag) PatternFlowGtpv2TeidFlag { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2TeidFlag struct { + obj *patternFlowGtpv2TeidFlag +} + +type marshalPatternFlowGtpv2TeidFlag interface { + // ToProto marshals PatternFlowGtpv2TeidFlag to protobuf object *otg.PatternFlowGtpv2TeidFlag + ToProto() (*otg.PatternFlowGtpv2TeidFlag, error) + // ToPbText marshals PatternFlowGtpv2TeidFlag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2TeidFlag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2TeidFlag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2TeidFlag struct { + obj *patternFlowGtpv2TeidFlag +} + +type unMarshalPatternFlowGtpv2TeidFlag interface { + // FromProto unmarshals PatternFlowGtpv2TeidFlag from protobuf object *otg.PatternFlowGtpv2TeidFlag + FromProto(msg *otg.PatternFlowGtpv2TeidFlag) (PatternFlowGtpv2TeidFlag, error) + // FromPbText unmarshals PatternFlowGtpv2TeidFlag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2TeidFlag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2TeidFlag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2TeidFlag) Marshal() marshalPatternFlowGtpv2TeidFlag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2TeidFlag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2TeidFlag) Unmarshal() unMarshalPatternFlowGtpv2TeidFlag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2TeidFlag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2TeidFlag) ToProto() (*otg.PatternFlowGtpv2TeidFlag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2TeidFlag) FromProto(msg *otg.PatternFlowGtpv2TeidFlag) (PatternFlowGtpv2TeidFlag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2TeidFlag) 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 *unMarshalpatternFlowGtpv2TeidFlag) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv2TeidFlag) 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 *unMarshalpatternFlowGtpv2TeidFlag) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv2TeidFlag) 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 *unMarshalpatternFlowGtpv2TeidFlag) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv2TeidFlag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2TeidFlag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2TeidFlag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2TeidFlag) Clone() (PatternFlowGtpv2TeidFlag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2TeidFlag() + 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 +} + +func (obj *patternFlowGtpv2TeidFlag) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv2TeidFlag is if teid_flag is set to 1 then the TEID field will be present between the message length and the sequence number. All messages except Echo and Echo reply require TEID to be present +type PatternFlowGtpv2TeidFlag interface { + Validation + // msg marshals PatternFlowGtpv2TeidFlag to protobuf object *otg.PatternFlowGtpv2TeidFlag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2TeidFlag + // setMsg unmarshals PatternFlowGtpv2TeidFlag from protobuf object *otg.PatternFlowGtpv2TeidFlag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2TeidFlag) PatternFlowGtpv2TeidFlag + // provides marshal interface + Marshal() marshalPatternFlowGtpv2TeidFlag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2TeidFlag + // validate validates PatternFlowGtpv2TeidFlag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2TeidFlag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv2TeidFlagChoiceEnum, set in PatternFlowGtpv2TeidFlag + Choice() PatternFlowGtpv2TeidFlagChoiceEnum + // setChoice assigns PatternFlowGtpv2TeidFlagChoiceEnum provided by user to PatternFlowGtpv2TeidFlag + setChoice(value PatternFlowGtpv2TeidFlagChoiceEnum) PatternFlowGtpv2TeidFlag + // HasChoice checks if Choice has been set in PatternFlowGtpv2TeidFlag + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv2TeidFlag. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv2TeidFlag + SetValue(value uint32) PatternFlowGtpv2TeidFlag + // HasValue checks if Value has been set in PatternFlowGtpv2TeidFlag + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv2TeidFlag. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv2TeidFlag + SetValues(value []uint32) PatternFlowGtpv2TeidFlag + // Increment returns PatternFlowGtpv2TeidFlagCounter, set in PatternFlowGtpv2TeidFlag. + // PatternFlowGtpv2TeidFlagCounter is integer counter pattern + Increment() PatternFlowGtpv2TeidFlagCounter + // SetIncrement assigns PatternFlowGtpv2TeidFlagCounter provided by user to PatternFlowGtpv2TeidFlag. + // PatternFlowGtpv2TeidFlagCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv2TeidFlagCounter) PatternFlowGtpv2TeidFlag + // HasIncrement checks if Increment has been set in PatternFlowGtpv2TeidFlag + HasIncrement() bool + // Decrement returns PatternFlowGtpv2TeidFlagCounter, set in PatternFlowGtpv2TeidFlag. + // PatternFlowGtpv2TeidFlagCounter is integer counter pattern + Decrement() PatternFlowGtpv2TeidFlagCounter + // SetDecrement assigns PatternFlowGtpv2TeidFlagCounter provided by user to PatternFlowGtpv2TeidFlag. + // PatternFlowGtpv2TeidFlagCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv2TeidFlagCounter) PatternFlowGtpv2TeidFlag + // HasDecrement checks if Decrement has been set in PatternFlowGtpv2TeidFlag + HasDecrement() bool + // MetricTags returns PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIterIter, set in PatternFlowGtpv2TeidFlag + MetricTags() PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter + setNil() +} + +type PatternFlowGtpv2TeidFlagChoiceEnum string + +// Enum of Choice on PatternFlowGtpv2TeidFlag +var PatternFlowGtpv2TeidFlagChoice = struct { + VALUE PatternFlowGtpv2TeidFlagChoiceEnum + VALUES PatternFlowGtpv2TeidFlagChoiceEnum + INCREMENT PatternFlowGtpv2TeidFlagChoiceEnum + DECREMENT PatternFlowGtpv2TeidFlagChoiceEnum +}{ + VALUE: PatternFlowGtpv2TeidFlagChoiceEnum("value"), + VALUES: PatternFlowGtpv2TeidFlagChoiceEnum("values"), + INCREMENT: PatternFlowGtpv2TeidFlagChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv2TeidFlagChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv2TeidFlag) Choice() PatternFlowGtpv2TeidFlagChoiceEnum { + return PatternFlowGtpv2TeidFlagChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv2TeidFlag) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv2TeidFlag) setChoice(value PatternFlowGtpv2TeidFlagChoiceEnum) PatternFlowGtpv2TeidFlag { + intValue, ok := otg.PatternFlowGtpv2TeidFlag_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv2TeidFlagChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv2TeidFlag_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv2TeidFlagChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv2TeidFlagChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv2TeidFlagChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv2TeidFlagCounter().msg() + } + + if value == PatternFlowGtpv2TeidFlagChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv2TeidFlagCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2TeidFlag) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv2TeidFlagChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2TeidFlag) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv2TeidFlag object +func (obj *patternFlowGtpv2TeidFlag) SetValue(value uint32) PatternFlowGtpv2TeidFlag { + obj.setChoice(PatternFlowGtpv2TeidFlagChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv2TeidFlag) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv2TeidFlag object +func (obj *patternFlowGtpv2TeidFlag) SetValues(value []uint32) PatternFlowGtpv2TeidFlag { + obj.setChoice(PatternFlowGtpv2TeidFlagChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv2TeidFlagCounter +func (obj *patternFlowGtpv2TeidFlag) Increment() PatternFlowGtpv2TeidFlagCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv2TeidFlagChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv2TeidFlagCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv2TeidFlagCounter +func (obj *patternFlowGtpv2TeidFlag) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv2TeidFlagCounter value in the PatternFlowGtpv2TeidFlag object +func (obj *patternFlowGtpv2TeidFlag) SetIncrement(value PatternFlowGtpv2TeidFlagCounter) PatternFlowGtpv2TeidFlag { + obj.setChoice(PatternFlowGtpv2TeidFlagChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2TeidFlagCounter +func (obj *patternFlowGtpv2TeidFlag) Decrement() PatternFlowGtpv2TeidFlagCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv2TeidFlagChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv2TeidFlagCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2TeidFlagCounter +func (obj *patternFlowGtpv2TeidFlag) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv2TeidFlagCounter value in the PatternFlowGtpv2TeidFlag object +func (obj *patternFlowGtpv2TeidFlag) SetDecrement(value PatternFlowGtpv2TeidFlagCounter) PatternFlowGtpv2TeidFlag { + obj.setChoice(PatternFlowGtpv2TeidFlagChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv2TeidFlagMetricTag +func (obj *patternFlowGtpv2TeidFlag) MetricTags() PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv2TeidFlagMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter struct { + obj *patternFlowGtpv2TeidFlag + patternFlowGtpv2TeidFlagMetricTagSlice []PatternFlowGtpv2TeidFlagMetricTag + fieldPtr *[]*otg.PatternFlowGtpv2TeidFlagMetricTag +} + +func newPatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter(ptr *[]*otg.PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { + return &patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter interface { + setMsg(*patternFlowGtpv2TeidFlag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter + Items() []PatternFlowGtpv2TeidFlagMetricTag + Add() PatternFlowGtpv2TeidFlagMetricTag + Append(items ...PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter + Set(index int, newObj PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter + Clear() PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter + clearHolderSlice() PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter + appendHolderSlice(item PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter +} + +func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) setMsg(msg *patternFlowGtpv2TeidFlag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv2TeidFlagMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) Items() []PatternFlowGtpv2TeidFlagMetricTag { + return obj.patternFlowGtpv2TeidFlagMetricTagSlice +} + +func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) Add() PatternFlowGtpv2TeidFlagMetricTag { + newObj := &otg.PatternFlowGtpv2TeidFlagMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv2TeidFlagMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv2TeidFlagMetricTagSlice = append(obj.patternFlowGtpv2TeidFlagMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) Append(items ...PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv2TeidFlagMetricTagSlice = append(obj.patternFlowGtpv2TeidFlagMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) Set(index int, newObj PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv2TeidFlagMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) Clear() PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv2TeidFlagMetricTag{} + obj.patternFlowGtpv2TeidFlagMetricTagSlice = []PatternFlowGtpv2TeidFlagMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) clearHolderSlice() PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { + if len(obj.patternFlowGtpv2TeidFlagMetricTagSlice) > 0 { + obj.patternFlowGtpv2TeidFlagMetricTagSlice = []PatternFlowGtpv2TeidFlagMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter) appendHolderSlice(item PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagPatternFlowGtpv2TeidFlagMetricTagIter { + obj.patternFlowGtpv2TeidFlagMetricTagSlice = append(obj.patternFlowGtpv2TeidFlagMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv2TeidFlag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2TeidFlag.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv2TeidFlag.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv2TeidFlagMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv2TeidFlag) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv2TeidFlagChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv2TeidFlagChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv2TeidFlagChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv2TeidFlagChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv2TeidFlagChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv2TeidFlagChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2TeidFlag") + } + } else { + intVal := otg.PatternFlowGtpv2TeidFlag_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv2TeidFlag_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_teid_flag_counter.go b/gosnappi/pattern_flow_gtpv2_teid_flag_counter.go new file mode 100644 index 00000000..1e0e3a12 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_teid_flag_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv2TeidFlagCounter ***** +type patternFlowGtpv2TeidFlagCounter struct { + validation + obj *otg.PatternFlowGtpv2TeidFlagCounter + marshaller marshalPatternFlowGtpv2TeidFlagCounter + unMarshaller unMarshalPatternFlowGtpv2TeidFlagCounter +} + +func NewPatternFlowGtpv2TeidFlagCounter() PatternFlowGtpv2TeidFlagCounter { + obj := patternFlowGtpv2TeidFlagCounter{obj: &otg.PatternFlowGtpv2TeidFlagCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2TeidFlagCounter) msg() *otg.PatternFlowGtpv2TeidFlagCounter { + return obj.obj +} + +func (obj *patternFlowGtpv2TeidFlagCounter) setMsg(msg *otg.PatternFlowGtpv2TeidFlagCounter) PatternFlowGtpv2TeidFlagCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2TeidFlagCounter struct { + obj *patternFlowGtpv2TeidFlagCounter +} + +type marshalPatternFlowGtpv2TeidFlagCounter interface { + // ToProto marshals PatternFlowGtpv2TeidFlagCounter to protobuf object *otg.PatternFlowGtpv2TeidFlagCounter + ToProto() (*otg.PatternFlowGtpv2TeidFlagCounter, error) + // ToPbText marshals PatternFlowGtpv2TeidFlagCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2TeidFlagCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2TeidFlagCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2TeidFlagCounter struct { + obj *patternFlowGtpv2TeidFlagCounter +} + +type unMarshalPatternFlowGtpv2TeidFlagCounter interface { + // FromProto unmarshals PatternFlowGtpv2TeidFlagCounter from protobuf object *otg.PatternFlowGtpv2TeidFlagCounter + FromProto(msg *otg.PatternFlowGtpv2TeidFlagCounter) (PatternFlowGtpv2TeidFlagCounter, error) + // FromPbText unmarshals PatternFlowGtpv2TeidFlagCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2TeidFlagCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2TeidFlagCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2TeidFlagCounter) Marshal() marshalPatternFlowGtpv2TeidFlagCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2TeidFlagCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2TeidFlagCounter) Unmarshal() unMarshalPatternFlowGtpv2TeidFlagCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2TeidFlagCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2TeidFlagCounter) ToProto() (*otg.PatternFlowGtpv2TeidFlagCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2TeidFlagCounter) FromProto(msg *otg.PatternFlowGtpv2TeidFlagCounter) (PatternFlowGtpv2TeidFlagCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2TeidFlagCounter) 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 *unMarshalpatternFlowGtpv2TeidFlagCounter) 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 *marshalpatternFlowGtpv2TeidFlagCounter) 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 *unMarshalpatternFlowGtpv2TeidFlagCounter) 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 *marshalpatternFlowGtpv2TeidFlagCounter) 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 *unMarshalpatternFlowGtpv2TeidFlagCounter) 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 *patternFlowGtpv2TeidFlagCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2TeidFlagCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2TeidFlagCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2TeidFlagCounter) Clone() (PatternFlowGtpv2TeidFlagCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2TeidFlagCounter() + 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 +} + +// PatternFlowGtpv2TeidFlagCounter is integer counter pattern +type PatternFlowGtpv2TeidFlagCounter interface { + Validation + // msg marshals PatternFlowGtpv2TeidFlagCounter to protobuf object *otg.PatternFlowGtpv2TeidFlagCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2TeidFlagCounter + // setMsg unmarshals PatternFlowGtpv2TeidFlagCounter from protobuf object *otg.PatternFlowGtpv2TeidFlagCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2TeidFlagCounter) PatternFlowGtpv2TeidFlagCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv2TeidFlagCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2TeidFlagCounter + // validate validates PatternFlowGtpv2TeidFlagCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2TeidFlagCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv2TeidFlagCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv2TeidFlagCounter + SetStart(value uint32) PatternFlowGtpv2TeidFlagCounter + // HasStart checks if Start has been set in PatternFlowGtpv2TeidFlagCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv2TeidFlagCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv2TeidFlagCounter + SetStep(value uint32) PatternFlowGtpv2TeidFlagCounter + // HasStep checks if Step has been set in PatternFlowGtpv2TeidFlagCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv2TeidFlagCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv2TeidFlagCounter + SetCount(value uint32) PatternFlowGtpv2TeidFlagCounter + // HasCount checks if Count has been set in PatternFlowGtpv2TeidFlagCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2TeidFlagCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2TeidFlagCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv2TeidFlagCounter object +func (obj *patternFlowGtpv2TeidFlagCounter) SetStart(value uint32) PatternFlowGtpv2TeidFlagCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2TeidFlagCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2TeidFlagCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv2TeidFlagCounter object +func (obj *patternFlowGtpv2TeidFlagCounter) SetStep(value uint32) PatternFlowGtpv2TeidFlagCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2TeidFlagCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2TeidFlagCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv2TeidFlagCounter object +func (obj *patternFlowGtpv2TeidFlagCounter) SetCount(value uint32) PatternFlowGtpv2TeidFlagCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv2TeidFlagCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2TeidFlagCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2TeidFlagCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2TeidFlagCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv2TeidFlagCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_teid_flag_metric_tag.go b/gosnappi/pattern_flow_gtpv2_teid_flag_metric_tag.go new file mode 100644 index 00000000..82ce73ec --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_teid_flag_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv2TeidFlagMetricTag ***** +type patternFlowGtpv2TeidFlagMetricTag struct { + validation + obj *otg.PatternFlowGtpv2TeidFlagMetricTag + marshaller marshalPatternFlowGtpv2TeidFlagMetricTag + unMarshaller unMarshalPatternFlowGtpv2TeidFlagMetricTag +} + +func NewPatternFlowGtpv2TeidFlagMetricTag() PatternFlowGtpv2TeidFlagMetricTag { + obj := patternFlowGtpv2TeidFlagMetricTag{obj: &otg.PatternFlowGtpv2TeidFlagMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2TeidFlagMetricTag) msg() *otg.PatternFlowGtpv2TeidFlagMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv2TeidFlagMetricTag) setMsg(msg *otg.PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2TeidFlagMetricTag struct { + obj *patternFlowGtpv2TeidFlagMetricTag +} + +type marshalPatternFlowGtpv2TeidFlagMetricTag interface { + // ToProto marshals PatternFlowGtpv2TeidFlagMetricTag to protobuf object *otg.PatternFlowGtpv2TeidFlagMetricTag + ToProto() (*otg.PatternFlowGtpv2TeidFlagMetricTag, error) + // ToPbText marshals PatternFlowGtpv2TeidFlagMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2TeidFlagMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2TeidFlagMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2TeidFlagMetricTag struct { + obj *patternFlowGtpv2TeidFlagMetricTag +} + +type unMarshalPatternFlowGtpv2TeidFlagMetricTag interface { + // FromProto unmarshals PatternFlowGtpv2TeidFlagMetricTag from protobuf object *otg.PatternFlowGtpv2TeidFlagMetricTag + FromProto(msg *otg.PatternFlowGtpv2TeidFlagMetricTag) (PatternFlowGtpv2TeidFlagMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv2TeidFlagMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2TeidFlagMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2TeidFlagMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2TeidFlagMetricTag) Marshal() marshalPatternFlowGtpv2TeidFlagMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2TeidFlagMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2TeidFlagMetricTag) Unmarshal() unMarshalPatternFlowGtpv2TeidFlagMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2TeidFlagMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2TeidFlagMetricTag) ToProto() (*otg.PatternFlowGtpv2TeidFlagMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2TeidFlagMetricTag) FromProto(msg *otg.PatternFlowGtpv2TeidFlagMetricTag) (PatternFlowGtpv2TeidFlagMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2TeidFlagMetricTag) 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 *unMarshalpatternFlowGtpv2TeidFlagMetricTag) 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 *marshalpatternFlowGtpv2TeidFlagMetricTag) 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 *unMarshalpatternFlowGtpv2TeidFlagMetricTag) 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 *marshalpatternFlowGtpv2TeidFlagMetricTag) 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 *unMarshalpatternFlowGtpv2TeidFlagMetricTag) 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 *patternFlowGtpv2TeidFlagMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2TeidFlagMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2TeidFlagMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2TeidFlagMetricTag) Clone() (PatternFlowGtpv2TeidFlagMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2TeidFlagMetricTag() + 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 +} + +// PatternFlowGtpv2TeidFlagMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv2TeidFlagMetricTag interface { + Validation + // msg marshals PatternFlowGtpv2TeidFlagMetricTag to protobuf object *otg.PatternFlowGtpv2TeidFlagMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2TeidFlagMetricTag + // setMsg unmarshals PatternFlowGtpv2TeidFlagMetricTag from protobuf object *otg.PatternFlowGtpv2TeidFlagMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2TeidFlagMetricTag) PatternFlowGtpv2TeidFlagMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv2TeidFlagMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2TeidFlagMetricTag + // validate validates PatternFlowGtpv2TeidFlagMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2TeidFlagMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv2TeidFlagMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv2TeidFlagMetricTag + SetName(value string) PatternFlowGtpv2TeidFlagMetricTag + // Offset returns uint32, set in PatternFlowGtpv2TeidFlagMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv2TeidFlagMetricTag + SetOffset(value uint32) PatternFlowGtpv2TeidFlagMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv2TeidFlagMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv2TeidFlagMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv2TeidFlagMetricTag + SetLength(value uint32) PatternFlowGtpv2TeidFlagMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv2TeidFlagMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv2TeidFlagMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv2TeidFlagMetricTag object +func (obj *patternFlowGtpv2TeidFlagMetricTag) SetName(value string) PatternFlowGtpv2TeidFlagMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2TeidFlagMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2TeidFlagMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv2TeidFlagMetricTag object +func (obj *patternFlowGtpv2TeidFlagMetricTag) SetOffset(value uint32) PatternFlowGtpv2TeidFlagMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2TeidFlagMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2TeidFlagMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv2TeidFlagMetricTag object +func (obj *patternFlowGtpv2TeidFlagMetricTag) SetLength(value uint32) PatternFlowGtpv2TeidFlagMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv2TeidFlagMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2TeidFlagMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2TeidFlagMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv2TeidFlagMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv2TeidFlagMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_teid_metric_tag.go b/gosnappi/pattern_flow_gtpv2_teid_metric_tag.go new file mode 100644 index 00000000..bf86a694 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_teid_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv2TeidMetricTag ***** +type patternFlowGtpv2TeidMetricTag struct { + validation + obj *otg.PatternFlowGtpv2TeidMetricTag + marshaller marshalPatternFlowGtpv2TeidMetricTag + unMarshaller unMarshalPatternFlowGtpv2TeidMetricTag +} + +func NewPatternFlowGtpv2TeidMetricTag() PatternFlowGtpv2TeidMetricTag { + obj := patternFlowGtpv2TeidMetricTag{obj: &otg.PatternFlowGtpv2TeidMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2TeidMetricTag) msg() *otg.PatternFlowGtpv2TeidMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv2TeidMetricTag) setMsg(msg *otg.PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2TeidMetricTag struct { + obj *patternFlowGtpv2TeidMetricTag +} + +type marshalPatternFlowGtpv2TeidMetricTag interface { + // ToProto marshals PatternFlowGtpv2TeidMetricTag to protobuf object *otg.PatternFlowGtpv2TeidMetricTag + ToProto() (*otg.PatternFlowGtpv2TeidMetricTag, error) + // ToPbText marshals PatternFlowGtpv2TeidMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2TeidMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2TeidMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2TeidMetricTag struct { + obj *patternFlowGtpv2TeidMetricTag +} + +type unMarshalPatternFlowGtpv2TeidMetricTag interface { + // FromProto unmarshals PatternFlowGtpv2TeidMetricTag from protobuf object *otg.PatternFlowGtpv2TeidMetricTag + FromProto(msg *otg.PatternFlowGtpv2TeidMetricTag) (PatternFlowGtpv2TeidMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv2TeidMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2TeidMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2TeidMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2TeidMetricTag) Marshal() marshalPatternFlowGtpv2TeidMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2TeidMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2TeidMetricTag) Unmarshal() unMarshalPatternFlowGtpv2TeidMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2TeidMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2TeidMetricTag) ToProto() (*otg.PatternFlowGtpv2TeidMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2TeidMetricTag) FromProto(msg *otg.PatternFlowGtpv2TeidMetricTag) (PatternFlowGtpv2TeidMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2TeidMetricTag) 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 *unMarshalpatternFlowGtpv2TeidMetricTag) 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 *marshalpatternFlowGtpv2TeidMetricTag) 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 *unMarshalpatternFlowGtpv2TeidMetricTag) 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 *marshalpatternFlowGtpv2TeidMetricTag) 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 *unMarshalpatternFlowGtpv2TeidMetricTag) 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 *patternFlowGtpv2TeidMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2TeidMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2TeidMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2TeidMetricTag) Clone() (PatternFlowGtpv2TeidMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2TeidMetricTag() + 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 +} + +// PatternFlowGtpv2TeidMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv2TeidMetricTag interface { + Validation + // msg marshals PatternFlowGtpv2TeidMetricTag to protobuf object *otg.PatternFlowGtpv2TeidMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2TeidMetricTag + // setMsg unmarshals PatternFlowGtpv2TeidMetricTag from protobuf object *otg.PatternFlowGtpv2TeidMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2TeidMetricTag) PatternFlowGtpv2TeidMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv2TeidMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2TeidMetricTag + // validate validates PatternFlowGtpv2TeidMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2TeidMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv2TeidMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv2TeidMetricTag + SetName(value string) PatternFlowGtpv2TeidMetricTag + // Offset returns uint32, set in PatternFlowGtpv2TeidMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv2TeidMetricTag + SetOffset(value uint32) PatternFlowGtpv2TeidMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv2TeidMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv2TeidMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv2TeidMetricTag + SetLength(value uint32) PatternFlowGtpv2TeidMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv2TeidMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv2TeidMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv2TeidMetricTag object +func (obj *patternFlowGtpv2TeidMetricTag) SetName(value string) PatternFlowGtpv2TeidMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2TeidMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2TeidMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv2TeidMetricTag object +func (obj *patternFlowGtpv2TeidMetricTag) SetOffset(value uint32) PatternFlowGtpv2TeidMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2TeidMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2TeidMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv2TeidMetricTag object +func (obj *patternFlowGtpv2TeidMetricTag) SetLength(value uint32) PatternFlowGtpv2TeidMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv2TeidMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2TeidMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2TeidMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv2TeidMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv2TeidMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(32) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_version.go b/gosnappi/pattern_flow_gtpv2_version.go new file mode 100644 index 00000000..3f1ff4d9 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_version.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowGtpv2Version ***** +type patternFlowGtpv2Version struct { + validation + obj *otg.PatternFlowGtpv2Version + marshaller marshalPatternFlowGtpv2Version + unMarshaller unMarshalPatternFlowGtpv2Version + incrementHolder PatternFlowGtpv2VersionCounter + decrementHolder PatternFlowGtpv2VersionCounter + metricTagsHolder PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter +} + +func NewPatternFlowGtpv2Version() PatternFlowGtpv2Version { + obj := patternFlowGtpv2Version{obj: &otg.PatternFlowGtpv2Version{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2Version) msg() *otg.PatternFlowGtpv2Version { + return obj.obj +} + +func (obj *patternFlowGtpv2Version) setMsg(msg *otg.PatternFlowGtpv2Version) PatternFlowGtpv2Version { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2Version struct { + obj *patternFlowGtpv2Version +} + +type marshalPatternFlowGtpv2Version interface { + // ToProto marshals PatternFlowGtpv2Version to protobuf object *otg.PatternFlowGtpv2Version + ToProto() (*otg.PatternFlowGtpv2Version, error) + // ToPbText marshals PatternFlowGtpv2Version to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2Version to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2Version to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2Version struct { + obj *patternFlowGtpv2Version +} + +type unMarshalPatternFlowGtpv2Version interface { + // FromProto unmarshals PatternFlowGtpv2Version from protobuf object *otg.PatternFlowGtpv2Version + FromProto(msg *otg.PatternFlowGtpv2Version) (PatternFlowGtpv2Version, error) + // FromPbText unmarshals PatternFlowGtpv2Version from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2Version from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2Version from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2Version) Marshal() marshalPatternFlowGtpv2Version { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2Version{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2Version) Unmarshal() unMarshalPatternFlowGtpv2Version { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2Version{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2Version) ToProto() (*otg.PatternFlowGtpv2Version, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2Version) FromProto(msg *otg.PatternFlowGtpv2Version) (PatternFlowGtpv2Version, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2Version) 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 *unMarshalpatternFlowGtpv2Version) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowGtpv2Version) 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 *unMarshalpatternFlowGtpv2Version) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowGtpv2Version) 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 *unMarshalpatternFlowGtpv2Version) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowGtpv2Version) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Version) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2Version) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2Version) Clone() (PatternFlowGtpv2Version, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2Version() + 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 +} + +func (obj *patternFlowGtpv2Version) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowGtpv2Version is version number +type PatternFlowGtpv2Version interface { + Validation + // msg marshals PatternFlowGtpv2Version to protobuf object *otg.PatternFlowGtpv2Version + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2Version + // setMsg unmarshals PatternFlowGtpv2Version from protobuf object *otg.PatternFlowGtpv2Version + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2Version) PatternFlowGtpv2Version + // provides marshal interface + Marshal() marshalPatternFlowGtpv2Version + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2Version + // validate validates PatternFlowGtpv2Version + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2Version, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowGtpv2VersionChoiceEnum, set in PatternFlowGtpv2Version + Choice() PatternFlowGtpv2VersionChoiceEnum + // setChoice assigns PatternFlowGtpv2VersionChoiceEnum provided by user to PatternFlowGtpv2Version + setChoice(value PatternFlowGtpv2VersionChoiceEnum) PatternFlowGtpv2Version + // HasChoice checks if Choice has been set in PatternFlowGtpv2Version + HasChoice() bool + // Value returns uint32, set in PatternFlowGtpv2Version. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowGtpv2Version + SetValue(value uint32) PatternFlowGtpv2Version + // HasValue checks if Value has been set in PatternFlowGtpv2Version + HasValue() bool + // Values returns []uint32, set in PatternFlowGtpv2Version. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowGtpv2Version + SetValues(value []uint32) PatternFlowGtpv2Version + // Increment returns PatternFlowGtpv2VersionCounter, set in PatternFlowGtpv2Version. + // PatternFlowGtpv2VersionCounter is integer counter pattern + Increment() PatternFlowGtpv2VersionCounter + // SetIncrement assigns PatternFlowGtpv2VersionCounter provided by user to PatternFlowGtpv2Version. + // PatternFlowGtpv2VersionCounter is integer counter pattern + SetIncrement(value PatternFlowGtpv2VersionCounter) PatternFlowGtpv2Version + // HasIncrement checks if Increment has been set in PatternFlowGtpv2Version + HasIncrement() bool + // Decrement returns PatternFlowGtpv2VersionCounter, set in PatternFlowGtpv2Version. + // PatternFlowGtpv2VersionCounter is integer counter pattern + Decrement() PatternFlowGtpv2VersionCounter + // SetDecrement assigns PatternFlowGtpv2VersionCounter provided by user to PatternFlowGtpv2Version. + // PatternFlowGtpv2VersionCounter is integer counter pattern + SetDecrement(value PatternFlowGtpv2VersionCounter) PatternFlowGtpv2Version + // HasDecrement checks if Decrement has been set in PatternFlowGtpv2Version + HasDecrement() bool + // MetricTags returns PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIterIter, set in PatternFlowGtpv2Version + MetricTags() PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter + setNil() +} + +type PatternFlowGtpv2VersionChoiceEnum string + +// Enum of Choice on PatternFlowGtpv2Version +var PatternFlowGtpv2VersionChoice = struct { + VALUE PatternFlowGtpv2VersionChoiceEnum + VALUES PatternFlowGtpv2VersionChoiceEnum + INCREMENT PatternFlowGtpv2VersionChoiceEnum + DECREMENT PatternFlowGtpv2VersionChoiceEnum +}{ + VALUE: PatternFlowGtpv2VersionChoiceEnum("value"), + VALUES: PatternFlowGtpv2VersionChoiceEnum("values"), + INCREMENT: PatternFlowGtpv2VersionChoiceEnum("increment"), + DECREMENT: PatternFlowGtpv2VersionChoiceEnum("decrement"), +} + +func (obj *patternFlowGtpv2Version) Choice() PatternFlowGtpv2VersionChoiceEnum { + return PatternFlowGtpv2VersionChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowGtpv2Version) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowGtpv2Version) setChoice(value PatternFlowGtpv2VersionChoiceEnum) PatternFlowGtpv2Version { + intValue, ok := otg.PatternFlowGtpv2Version_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowGtpv2VersionChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowGtpv2Version_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowGtpv2VersionChoice.VALUE { + defaultValue := uint32(2) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowGtpv2VersionChoice.VALUES { + defaultValue := []uint32{2} + obj.obj.Values = defaultValue + } + + if value == PatternFlowGtpv2VersionChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowGtpv2VersionCounter().msg() + } + + if value == PatternFlowGtpv2VersionChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowGtpv2VersionCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2Version) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowGtpv2VersionChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowGtpv2Version) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowGtpv2Version object +func (obj *patternFlowGtpv2Version) SetValue(value uint32) PatternFlowGtpv2Version { + obj.setChoice(PatternFlowGtpv2VersionChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowGtpv2Version) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{2}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowGtpv2Version object +func (obj *patternFlowGtpv2Version) SetValues(value []uint32) PatternFlowGtpv2Version { + obj.setChoice(PatternFlowGtpv2VersionChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowGtpv2VersionCounter +func (obj *patternFlowGtpv2Version) Increment() PatternFlowGtpv2VersionCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowGtpv2VersionChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowGtpv2VersionCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowGtpv2VersionCounter +func (obj *patternFlowGtpv2Version) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowGtpv2VersionCounter value in the PatternFlowGtpv2Version object +func (obj *patternFlowGtpv2Version) SetIncrement(value PatternFlowGtpv2VersionCounter) PatternFlowGtpv2Version { + obj.setChoice(PatternFlowGtpv2VersionChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2VersionCounter +func (obj *patternFlowGtpv2Version) Decrement() PatternFlowGtpv2VersionCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowGtpv2VersionChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowGtpv2VersionCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowGtpv2VersionCounter +func (obj *patternFlowGtpv2Version) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowGtpv2VersionCounter value in the PatternFlowGtpv2Version object +func (obj *patternFlowGtpv2Version) SetDecrement(value PatternFlowGtpv2VersionCounter) PatternFlowGtpv2Version { + obj.setChoice(PatternFlowGtpv2VersionChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowGtpv2VersionMetricTag +func (obj *patternFlowGtpv2Version) MetricTags() PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowGtpv2VersionMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter struct { + obj *patternFlowGtpv2Version + patternFlowGtpv2VersionMetricTagSlice []PatternFlowGtpv2VersionMetricTag + fieldPtr *[]*otg.PatternFlowGtpv2VersionMetricTag +} + +func newPatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter(ptr *[]*otg.PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { + return &patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter interface { + setMsg(*patternFlowGtpv2Version) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter + Items() []PatternFlowGtpv2VersionMetricTag + Add() PatternFlowGtpv2VersionMetricTag + Append(items ...PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter + Set(index int, newObj PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter + Clear() PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter + clearHolderSlice() PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter + appendHolderSlice(item PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter +} + +func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) setMsg(msg *patternFlowGtpv2Version) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowGtpv2VersionMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) Items() []PatternFlowGtpv2VersionMetricTag { + return obj.patternFlowGtpv2VersionMetricTagSlice +} + +func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) Add() PatternFlowGtpv2VersionMetricTag { + newObj := &otg.PatternFlowGtpv2VersionMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowGtpv2VersionMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowGtpv2VersionMetricTagSlice = append(obj.patternFlowGtpv2VersionMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) Append(items ...PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowGtpv2VersionMetricTagSlice = append(obj.patternFlowGtpv2VersionMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) Set(index int, newObj PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowGtpv2VersionMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) Clear() PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowGtpv2VersionMetricTag{} + obj.patternFlowGtpv2VersionMetricTagSlice = []PatternFlowGtpv2VersionMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) clearHolderSlice() PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { + if len(obj.patternFlowGtpv2VersionMetricTagSlice) > 0 { + obj.patternFlowGtpv2VersionMetricTagSlice = []PatternFlowGtpv2VersionMetricTag{} + } + return obj +} +func (obj *patternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter) appendHolderSlice(item PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionPatternFlowGtpv2VersionMetricTagIter { + obj.patternFlowGtpv2VersionMetricTagSlice = append(obj.patternFlowGtpv2VersionMetricTagSlice, item) + return obj +} + +func (obj *patternFlowGtpv2Version) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2Version.Value <= 7 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowGtpv2Version.Values <= 7 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowGtpv2VersionMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowGtpv2Version) setDefault() { + var choices_set int = 0 + var choice PatternFlowGtpv2VersionChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowGtpv2VersionChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowGtpv2VersionChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowGtpv2VersionChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowGtpv2VersionChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowGtpv2VersionChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowGtpv2Version") + } + } else { + intVal := otg.PatternFlowGtpv2Version_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowGtpv2Version_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_version_counter.go b/gosnappi/pattern_flow_gtpv2_version_counter.go new file mode 100644 index 00000000..05a7bd43 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_version_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowGtpv2VersionCounter ***** +type patternFlowGtpv2VersionCounter struct { + validation + obj *otg.PatternFlowGtpv2VersionCounter + marshaller marshalPatternFlowGtpv2VersionCounter + unMarshaller unMarshalPatternFlowGtpv2VersionCounter +} + +func NewPatternFlowGtpv2VersionCounter() PatternFlowGtpv2VersionCounter { + obj := patternFlowGtpv2VersionCounter{obj: &otg.PatternFlowGtpv2VersionCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2VersionCounter) msg() *otg.PatternFlowGtpv2VersionCounter { + return obj.obj +} + +func (obj *patternFlowGtpv2VersionCounter) setMsg(msg *otg.PatternFlowGtpv2VersionCounter) PatternFlowGtpv2VersionCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2VersionCounter struct { + obj *patternFlowGtpv2VersionCounter +} + +type marshalPatternFlowGtpv2VersionCounter interface { + // ToProto marshals PatternFlowGtpv2VersionCounter to protobuf object *otg.PatternFlowGtpv2VersionCounter + ToProto() (*otg.PatternFlowGtpv2VersionCounter, error) + // ToPbText marshals PatternFlowGtpv2VersionCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2VersionCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2VersionCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2VersionCounter struct { + obj *patternFlowGtpv2VersionCounter +} + +type unMarshalPatternFlowGtpv2VersionCounter interface { + // FromProto unmarshals PatternFlowGtpv2VersionCounter from protobuf object *otg.PatternFlowGtpv2VersionCounter + FromProto(msg *otg.PatternFlowGtpv2VersionCounter) (PatternFlowGtpv2VersionCounter, error) + // FromPbText unmarshals PatternFlowGtpv2VersionCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2VersionCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2VersionCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2VersionCounter) Marshal() marshalPatternFlowGtpv2VersionCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2VersionCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2VersionCounter) Unmarshal() unMarshalPatternFlowGtpv2VersionCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2VersionCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2VersionCounter) ToProto() (*otg.PatternFlowGtpv2VersionCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2VersionCounter) FromProto(msg *otg.PatternFlowGtpv2VersionCounter) (PatternFlowGtpv2VersionCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2VersionCounter) 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 *unMarshalpatternFlowGtpv2VersionCounter) 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 *marshalpatternFlowGtpv2VersionCounter) 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 *unMarshalpatternFlowGtpv2VersionCounter) 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 *marshalpatternFlowGtpv2VersionCounter) 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 *unMarshalpatternFlowGtpv2VersionCounter) 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 *patternFlowGtpv2VersionCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2VersionCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2VersionCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2VersionCounter) Clone() (PatternFlowGtpv2VersionCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2VersionCounter() + 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 +} + +// PatternFlowGtpv2VersionCounter is integer counter pattern +type PatternFlowGtpv2VersionCounter interface { + Validation + // msg marshals PatternFlowGtpv2VersionCounter to protobuf object *otg.PatternFlowGtpv2VersionCounter + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2VersionCounter + // setMsg unmarshals PatternFlowGtpv2VersionCounter from protobuf object *otg.PatternFlowGtpv2VersionCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2VersionCounter) PatternFlowGtpv2VersionCounter + // provides marshal interface + Marshal() marshalPatternFlowGtpv2VersionCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2VersionCounter + // validate validates PatternFlowGtpv2VersionCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2VersionCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowGtpv2VersionCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowGtpv2VersionCounter + SetStart(value uint32) PatternFlowGtpv2VersionCounter + // HasStart checks if Start has been set in PatternFlowGtpv2VersionCounter + HasStart() bool + // Step returns uint32, set in PatternFlowGtpv2VersionCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowGtpv2VersionCounter + SetStep(value uint32) PatternFlowGtpv2VersionCounter + // HasStep checks if Step has been set in PatternFlowGtpv2VersionCounter + HasStep() bool + // Count returns uint32, set in PatternFlowGtpv2VersionCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowGtpv2VersionCounter + SetCount(value uint32) PatternFlowGtpv2VersionCounter + // HasCount checks if Count has been set in PatternFlowGtpv2VersionCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2VersionCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowGtpv2VersionCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowGtpv2VersionCounter object +func (obj *patternFlowGtpv2VersionCounter) SetStart(value uint32) PatternFlowGtpv2VersionCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2VersionCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowGtpv2VersionCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowGtpv2VersionCounter object +func (obj *patternFlowGtpv2VersionCounter) SetStep(value uint32) PatternFlowGtpv2VersionCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2VersionCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowGtpv2VersionCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowGtpv2VersionCounter object +func (obj *patternFlowGtpv2VersionCounter) SetCount(value uint32) PatternFlowGtpv2VersionCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowGtpv2VersionCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2VersionCounter.Start <= 7 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2VersionCounter.Step <= 7 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2VersionCounter.Count <= 7 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowGtpv2VersionCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(2) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_gtpv2_version_metric_tag.go b/gosnappi/pattern_flow_gtpv2_version_metric_tag.go new file mode 100644 index 00000000..d8a20973 --- /dev/null +++ b/gosnappi/pattern_flow_gtpv2_version_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowGtpv2VersionMetricTag ***** +type patternFlowGtpv2VersionMetricTag struct { + validation + obj *otg.PatternFlowGtpv2VersionMetricTag + marshaller marshalPatternFlowGtpv2VersionMetricTag + unMarshaller unMarshalPatternFlowGtpv2VersionMetricTag +} + +func NewPatternFlowGtpv2VersionMetricTag() PatternFlowGtpv2VersionMetricTag { + obj := patternFlowGtpv2VersionMetricTag{obj: &otg.PatternFlowGtpv2VersionMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowGtpv2VersionMetricTag) msg() *otg.PatternFlowGtpv2VersionMetricTag { + return obj.obj +} + +func (obj *patternFlowGtpv2VersionMetricTag) setMsg(msg *otg.PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowGtpv2VersionMetricTag struct { + obj *patternFlowGtpv2VersionMetricTag +} + +type marshalPatternFlowGtpv2VersionMetricTag interface { + // ToProto marshals PatternFlowGtpv2VersionMetricTag to protobuf object *otg.PatternFlowGtpv2VersionMetricTag + ToProto() (*otg.PatternFlowGtpv2VersionMetricTag, error) + // ToPbText marshals PatternFlowGtpv2VersionMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowGtpv2VersionMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowGtpv2VersionMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowGtpv2VersionMetricTag struct { + obj *patternFlowGtpv2VersionMetricTag +} + +type unMarshalPatternFlowGtpv2VersionMetricTag interface { + // FromProto unmarshals PatternFlowGtpv2VersionMetricTag from protobuf object *otg.PatternFlowGtpv2VersionMetricTag + FromProto(msg *otg.PatternFlowGtpv2VersionMetricTag) (PatternFlowGtpv2VersionMetricTag, error) + // FromPbText unmarshals PatternFlowGtpv2VersionMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowGtpv2VersionMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowGtpv2VersionMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowGtpv2VersionMetricTag) Marshal() marshalPatternFlowGtpv2VersionMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowGtpv2VersionMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowGtpv2VersionMetricTag) Unmarshal() unMarshalPatternFlowGtpv2VersionMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowGtpv2VersionMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowGtpv2VersionMetricTag) ToProto() (*otg.PatternFlowGtpv2VersionMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowGtpv2VersionMetricTag) FromProto(msg *otg.PatternFlowGtpv2VersionMetricTag) (PatternFlowGtpv2VersionMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowGtpv2VersionMetricTag) 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 *unMarshalpatternFlowGtpv2VersionMetricTag) 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 *marshalpatternFlowGtpv2VersionMetricTag) 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 *unMarshalpatternFlowGtpv2VersionMetricTag) 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 *marshalpatternFlowGtpv2VersionMetricTag) 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 *unMarshalpatternFlowGtpv2VersionMetricTag) 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 *patternFlowGtpv2VersionMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2VersionMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowGtpv2VersionMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowGtpv2VersionMetricTag) Clone() (PatternFlowGtpv2VersionMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowGtpv2VersionMetricTag() + 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 +} + +// PatternFlowGtpv2VersionMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowGtpv2VersionMetricTag interface { + Validation + // msg marshals PatternFlowGtpv2VersionMetricTag to protobuf object *otg.PatternFlowGtpv2VersionMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowGtpv2VersionMetricTag + // setMsg unmarshals PatternFlowGtpv2VersionMetricTag from protobuf object *otg.PatternFlowGtpv2VersionMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowGtpv2VersionMetricTag) PatternFlowGtpv2VersionMetricTag + // provides marshal interface + Marshal() marshalPatternFlowGtpv2VersionMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowGtpv2VersionMetricTag + // validate validates PatternFlowGtpv2VersionMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowGtpv2VersionMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowGtpv2VersionMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowGtpv2VersionMetricTag + SetName(value string) PatternFlowGtpv2VersionMetricTag + // Offset returns uint32, set in PatternFlowGtpv2VersionMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowGtpv2VersionMetricTag + SetOffset(value uint32) PatternFlowGtpv2VersionMetricTag + // HasOffset checks if Offset has been set in PatternFlowGtpv2VersionMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowGtpv2VersionMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowGtpv2VersionMetricTag + SetLength(value uint32) PatternFlowGtpv2VersionMetricTag + // HasLength checks if Length has been set in PatternFlowGtpv2VersionMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowGtpv2VersionMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowGtpv2VersionMetricTag object +func (obj *patternFlowGtpv2VersionMetricTag) SetName(value string) PatternFlowGtpv2VersionMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2VersionMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowGtpv2VersionMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowGtpv2VersionMetricTag object +func (obj *patternFlowGtpv2VersionMetricTag) SetOffset(value uint32) PatternFlowGtpv2VersionMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2VersionMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowGtpv2VersionMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowGtpv2VersionMetricTag object +func (obj *patternFlowGtpv2VersionMetricTag) SetLength(value uint32) PatternFlowGtpv2VersionMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowGtpv2VersionMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowGtpv2VersionMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 2 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowGtpv2VersionMetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowGtpv2VersionMetricTag.Length <= 3 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowGtpv2VersionMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(3) + } + +} diff --git a/gosnappi/pattern_flow_icmp_echo_checksum.go b/gosnappi/pattern_flow_icmp_echo_checksum.go new file mode 100644 index 00000000..a7915be9 --- /dev/null +++ b/gosnappi/pattern_flow_icmp_echo_checksum.go @@ -0,0 +1,434 @@ +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" +) + +// ***** PatternFlowIcmpEchoChecksum ***** +type patternFlowIcmpEchoChecksum struct { + validation + obj *otg.PatternFlowIcmpEchoChecksum + marshaller marshalPatternFlowIcmpEchoChecksum + unMarshaller unMarshalPatternFlowIcmpEchoChecksum +} + +func NewPatternFlowIcmpEchoChecksum() PatternFlowIcmpEchoChecksum { + obj := patternFlowIcmpEchoChecksum{obj: &otg.PatternFlowIcmpEchoChecksum{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpEchoChecksum) msg() *otg.PatternFlowIcmpEchoChecksum { + return obj.obj +} + +func (obj *patternFlowIcmpEchoChecksum) setMsg(msg *otg.PatternFlowIcmpEchoChecksum) PatternFlowIcmpEchoChecksum { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpEchoChecksum struct { + obj *patternFlowIcmpEchoChecksum +} + +type marshalPatternFlowIcmpEchoChecksum interface { + // ToProto marshals PatternFlowIcmpEchoChecksum to protobuf object *otg.PatternFlowIcmpEchoChecksum + ToProto() (*otg.PatternFlowIcmpEchoChecksum, error) + // ToPbText marshals PatternFlowIcmpEchoChecksum to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpEchoChecksum to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpEchoChecksum to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpEchoChecksum struct { + obj *patternFlowIcmpEchoChecksum +} + +type unMarshalPatternFlowIcmpEchoChecksum interface { + // FromProto unmarshals PatternFlowIcmpEchoChecksum from protobuf object *otg.PatternFlowIcmpEchoChecksum + FromProto(msg *otg.PatternFlowIcmpEchoChecksum) (PatternFlowIcmpEchoChecksum, error) + // FromPbText unmarshals PatternFlowIcmpEchoChecksum from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpEchoChecksum from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpEchoChecksum from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpEchoChecksum) Marshal() marshalPatternFlowIcmpEchoChecksum { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpEchoChecksum{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpEchoChecksum) Unmarshal() unMarshalPatternFlowIcmpEchoChecksum { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpEchoChecksum{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpEchoChecksum) ToProto() (*otg.PatternFlowIcmpEchoChecksum, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpEchoChecksum) FromProto(msg *otg.PatternFlowIcmpEchoChecksum) (PatternFlowIcmpEchoChecksum, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpEchoChecksum) 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 *unMarshalpatternFlowIcmpEchoChecksum) 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 *marshalpatternFlowIcmpEchoChecksum) 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 *unMarshalpatternFlowIcmpEchoChecksum) 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 *marshalpatternFlowIcmpEchoChecksum) 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 *unMarshalpatternFlowIcmpEchoChecksum) 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 *patternFlowIcmpEchoChecksum) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoChecksum) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoChecksum) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpEchoChecksum) Clone() (PatternFlowIcmpEchoChecksum, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpEchoChecksum() + 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 +} + +// PatternFlowIcmpEchoChecksum is iCMP checksum +type PatternFlowIcmpEchoChecksum interface { + Validation + // msg marshals PatternFlowIcmpEchoChecksum to protobuf object *otg.PatternFlowIcmpEchoChecksum + // and doesn't set defaults + msg() *otg.PatternFlowIcmpEchoChecksum + // setMsg unmarshals PatternFlowIcmpEchoChecksum from protobuf object *otg.PatternFlowIcmpEchoChecksum + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpEchoChecksum) PatternFlowIcmpEchoChecksum + // provides marshal interface + Marshal() marshalPatternFlowIcmpEchoChecksum + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpEchoChecksum + // validate validates PatternFlowIcmpEchoChecksum + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpEchoChecksum, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIcmpEchoChecksumChoiceEnum, set in PatternFlowIcmpEchoChecksum + Choice() PatternFlowIcmpEchoChecksumChoiceEnum + // setChoice assigns PatternFlowIcmpEchoChecksumChoiceEnum provided by user to PatternFlowIcmpEchoChecksum + setChoice(value PatternFlowIcmpEchoChecksumChoiceEnum) PatternFlowIcmpEchoChecksum + // HasChoice checks if Choice has been set in PatternFlowIcmpEchoChecksum + HasChoice() bool + // Generated returns PatternFlowIcmpEchoChecksumGeneratedEnum, set in PatternFlowIcmpEchoChecksum + Generated() PatternFlowIcmpEchoChecksumGeneratedEnum + // SetGenerated assigns PatternFlowIcmpEchoChecksumGeneratedEnum provided by user to PatternFlowIcmpEchoChecksum + SetGenerated(value PatternFlowIcmpEchoChecksumGeneratedEnum) PatternFlowIcmpEchoChecksum + // HasGenerated checks if Generated has been set in PatternFlowIcmpEchoChecksum + HasGenerated() bool + // Custom returns uint32, set in PatternFlowIcmpEchoChecksum. + Custom() uint32 + // SetCustom assigns uint32 provided by user to PatternFlowIcmpEchoChecksum + SetCustom(value uint32) PatternFlowIcmpEchoChecksum + // HasCustom checks if Custom has been set in PatternFlowIcmpEchoChecksum + HasCustom() bool +} + +type PatternFlowIcmpEchoChecksumChoiceEnum string + +// Enum of Choice on PatternFlowIcmpEchoChecksum +var PatternFlowIcmpEchoChecksumChoice = struct { + GENERATED PatternFlowIcmpEchoChecksumChoiceEnum + CUSTOM PatternFlowIcmpEchoChecksumChoiceEnum +}{ + GENERATED: PatternFlowIcmpEchoChecksumChoiceEnum("generated"), + CUSTOM: PatternFlowIcmpEchoChecksumChoiceEnum("custom"), +} + +func (obj *patternFlowIcmpEchoChecksum) Choice() PatternFlowIcmpEchoChecksumChoiceEnum { + return PatternFlowIcmpEchoChecksumChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The type of checksum +// Choice returns a string +func (obj *patternFlowIcmpEchoChecksum) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIcmpEchoChecksum) setChoice(value PatternFlowIcmpEchoChecksumChoiceEnum) PatternFlowIcmpEchoChecksum { + intValue, ok := otg.PatternFlowIcmpEchoChecksum_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIcmpEchoChecksumChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIcmpEchoChecksum_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Custom = nil + obj.obj.Generated = otg.PatternFlowIcmpEchoChecksum_Generated_unspecified.Enum() + return obj +} + +type PatternFlowIcmpEchoChecksumGeneratedEnum string + +// Enum of Generated on PatternFlowIcmpEchoChecksum +var PatternFlowIcmpEchoChecksumGenerated = struct { + GOOD PatternFlowIcmpEchoChecksumGeneratedEnum + BAD PatternFlowIcmpEchoChecksumGeneratedEnum +}{ + GOOD: PatternFlowIcmpEchoChecksumGeneratedEnum("good"), + BAD: PatternFlowIcmpEchoChecksumGeneratedEnum("bad"), +} + +func (obj *patternFlowIcmpEchoChecksum) Generated() PatternFlowIcmpEchoChecksumGeneratedEnum { + return PatternFlowIcmpEchoChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) +} + +// A system generated checksum value +// Generated returns a string +func (obj *patternFlowIcmpEchoChecksum) HasGenerated() bool { + return obj.obj.Generated != nil +} + +func (obj *patternFlowIcmpEchoChecksum) SetGenerated(value PatternFlowIcmpEchoChecksumGeneratedEnum) PatternFlowIcmpEchoChecksum { + intValue, ok := otg.PatternFlowIcmpEchoChecksum_Generated_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIcmpEchoChecksumGeneratedEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIcmpEchoChecksum_Generated_Enum(intValue) + obj.obj.Generated = &enumValue + + return obj +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowIcmpEchoChecksum) Custom() uint32 { + + if obj.obj.Custom == nil { + obj.setChoice(PatternFlowIcmpEchoChecksumChoice.CUSTOM) + } + + return *obj.obj.Custom + +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowIcmpEchoChecksum) HasCustom() bool { + return obj.obj.Custom != nil +} + +// A custom checksum value +// SetCustom sets the uint32 value in the PatternFlowIcmpEchoChecksum object +func (obj *patternFlowIcmpEchoChecksum) SetCustom(value uint32) PatternFlowIcmpEchoChecksum { + obj.setChoice(PatternFlowIcmpEchoChecksumChoice.CUSTOM) + obj.obj.Custom = &value + return obj +} + +func (obj *patternFlowIcmpEchoChecksum) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Custom != nil { + + if *obj.obj.Custom > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoChecksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) + } + + } + +} + +func (obj *patternFlowIcmpEchoChecksum) setDefault() { + var choices_set int = 0 + var choice PatternFlowIcmpEchoChecksumChoiceEnum + + if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { + choices_set += 1 + choice = PatternFlowIcmpEchoChecksumChoice.GENERATED + } + + if obj.obj.Custom != nil { + choices_set += 1 + choice = PatternFlowIcmpEchoChecksumChoice.CUSTOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIcmpEchoChecksumChoice.GENERATED) + if obj.obj.Generated.Number() == 0 { + obj.SetGenerated(PatternFlowIcmpEchoChecksumGenerated.GOOD) + + } + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpEchoChecksum") + } + } else { + intVal := otg.PatternFlowIcmpEchoChecksum_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIcmpEchoChecksum_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_icmp_echo_code.go b/gosnappi/pattern_flow_icmp_echo_code.go new file mode 100644 index 00000000..1869813e --- /dev/null +++ b/gosnappi/pattern_flow_icmp_echo_code.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIcmpEchoCode ***** +type patternFlowIcmpEchoCode struct { + validation + obj *otg.PatternFlowIcmpEchoCode + marshaller marshalPatternFlowIcmpEchoCode + unMarshaller unMarshalPatternFlowIcmpEchoCode + incrementHolder PatternFlowIcmpEchoCodeCounter + decrementHolder PatternFlowIcmpEchoCodeCounter + metricTagsHolder PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter +} + +func NewPatternFlowIcmpEchoCode() PatternFlowIcmpEchoCode { + obj := patternFlowIcmpEchoCode{obj: &otg.PatternFlowIcmpEchoCode{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpEchoCode) msg() *otg.PatternFlowIcmpEchoCode { + return obj.obj +} + +func (obj *patternFlowIcmpEchoCode) setMsg(msg *otg.PatternFlowIcmpEchoCode) PatternFlowIcmpEchoCode { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpEchoCode struct { + obj *patternFlowIcmpEchoCode +} + +type marshalPatternFlowIcmpEchoCode interface { + // ToProto marshals PatternFlowIcmpEchoCode to protobuf object *otg.PatternFlowIcmpEchoCode + ToProto() (*otg.PatternFlowIcmpEchoCode, error) + // ToPbText marshals PatternFlowIcmpEchoCode to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpEchoCode to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpEchoCode to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpEchoCode struct { + obj *patternFlowIcmpEchoCode +} + +type unMarshalPatternFlowIcmpEchoCode interface { + // FromProto unmarshals PatternFlowIcmpEchoCode from protobuf object *otg.PatternFlowIcmpEchoCode + FromProto(msg *otg.PatternFlowIcmpEchoCode) (PatternFlowIcmpEchoCode, error) + // FromPbText unmarshals PatternFlowIcmpEchoCode from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpEchoCode from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpEchoCode from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpEchoCode) Marshal() marshalPatternFlowIcmpEchoCode { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpEchoCode{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpEchoCode) Unmarshal() unMarshalPatternFlowIcmpEchoCode { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpEchoCode{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpEchoCode) ToProto() (*otg.PatternFlowIcmpEchoCode, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpEchoCode) FromProto(msg *otg.PatternFlowIcmpEchoCode) (PatternFlowIcmpEchoCode, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpEchoCode) 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 *unMarshalpatternFlowIcmpEchoCode) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIcmpEchoCode) 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 *unMarshalpatternFlowIcmpEchoCode) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIcmpEchoCode) 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 *unMarshalpatternFlowIcmpEchoCode) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIcmpEchoCode) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoCode) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoCode) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpEchoCode) Clone() (PatternFlowIcmpEchoCode, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpEchoCode() + 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 +} + +func (obj *patternFlowIcmpEchoCode) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIcmpEchoCode is the ICMP subtype. The default code for ICMP echo request and reply is 0. +type PatternFlowIcmpEchoCode interface { + Validation + // msg marshals PatternFlowIcmpEchoCode to protobuf object *otg.PatternFlowIcmpEchoCode + // and doesn't set defaults + msg() *otg.PatternFlowIcmpEchoCode + // setMsg unmarshals PatternFlowIcmpEchoCode from protobuf object *otg.PatternFlowIcmpEchoCode + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpEchoCode) PatternFlowIcmpEchoCode + // provides marshal interface + Marshal() marshalPatternFlowIcmpEchoCode + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpEchoCode + // validate validates PatternFlowIcmpEchoCode + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpEchoCode, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIcmpEchoCodeChoiceEnum, set in PatternFlowIcmpEchoCode + Choice() PatternFlowIcmpEchoCodeChoiceEnum + // setChoice assigns PatternFlowIcmpEchoCodeChoiceEnum provided by user to PatternFlowIcmpEchoCode + setChoice(value PatternFlowIcmpEchoCodeChoiceEnum) PatternFlowIcmpEchoCode + // HasChoice checks if Choice has been set in PatternFlowIcmpEchoCode + HasChoice() bool + // Value returns uint32, set in PatternFlowIcmpEchoCode. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIcmpEchoCode + SetValue(value uint32) PatternFlowIcmpEchoCode + // HasValue checks if Value has been set in PatternFlowIcmpEchoCode + HasValue() bool + // Values returns []uint32, set in PatternFlowIcmpEchoCode. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIcmpEchoCode + SetValues(value []uint32) PatternFlowIcmpEchoCode + // Increment returns PatternFlowIcmpEchoCodeCounter, set in PatternFlowIcmpEchoCode. + // PatternFlowIcmpEchoCodeCounter is integer counter pattern + Increment() PatternFlowIcmpEchoCodeCounter + // SetIncrement assigns PatternFlowIcmpEchoCodeCounter provided by user to PatternFlowIcmpEchoCode. + // PatternFlowIcmpEchoCodeCounter is integer counter pattern + SetIncrement(value PatternFlowIcmpEchoCodeCounter) PatternFlowIcmpEchoCode + // HasIncrement checks if Increment has been set in PatternFlowIcmpEchoCode + HasIncrement() bool + // Decrement returns PatternFlowIcmpEchoCodeCounter, set in PatternFlowIcmpEchoCode. + // PatternFlowIcmpEchoCodeCounter is integer counter pattern + Decrement() PatternFlowIcmpEchoCodeCounter + // SetDecrement assigns PatternFlowIcmpEchoCodeCounter provided by user to PatternFlowIcmpEchoCode. + // PatternFlowIcmpEchoCodeCounter is integer counter pattern + SetDecrement(value PatternFlowIcmpEchoCodeCounter) PatternFlowIcmpEchoCode + // HasDecrement checks if Decrement has been set in PatternFlowIcmpEchoCode + HasDecrement() bool + // MetricTags returns PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIterIter, set in PatternFlowIcmpEchoCode + MetricTags() PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter + setNil() +} + +type PatternFlowIcmpEchoCodeChoiceEnum string + +// Enum of Choice on PatternFlowIcmpEchoCode +var PatternFlowIcmpEchoCodeChoice = struct { + VALUE PatternFlowIcmpEchoCodeChoiceEnum + VALUES PatternFlowIcmpEchoCodeChoiceEnum + INCREMENT PatternFlowIcmpEchoCodeChoiceEnum + DECREMENT PatternFlowIcmpEchoCodeChoiceEnum +}{ + VALUE: PatternFlowIcmpEchoCodeChoiceEnum("value"), + VALUES: PatternFlowIcmpEchoCodeChoiceEnum("values"), + INCREMENT: PatternFlowIcmpEchoCodeChoiceEnum("increment"), + DECREMENT: PatternFlowIcmpEchoCodeChoiceEnum("decrement"), +} + +func (obj *patternFlowIcmpEchoCode) Choice() PatternFlowIcmpEchoCodeChoiceEnum { + return PatternFlowIcmpEchoCodeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIcmpEchoCode) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIcmpEchoCode) setChoice(value PatternFlowIcmpEchoCodeChoiceEnum) PatternFlowIcmpEchoCode { + intValue, ok := otg.PatternFlowIcmpEchoCode_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIcmpEchoCodeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIcmpEchoCode_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIcmpEchoCodeChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIcmpEchoCodeChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIcmpEchoCodeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIcmpEchoCodeCounter().msg() + } + + if value == PatternFlowIcmpEchoCodeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIcmpEchoCodeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpEchoCode) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIcmpEchoCodeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpEchoCode) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIcmpEchoCode object +func (obj *patternFlowIcmpEchoCode) SetValue(value uint32) PatternFlowIcmpEchoCode { + obj.setChoice(PatternFlowIcmpEchoCodeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIcmpEchoCode) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIcmpEchoCode object +func (obj *patternFlowIcmpEchoCode) SetValues(value []uint32) PatternFlowIcmpEchoCode { + obj.setChoice(PatternFlowIcmpEchoCodeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIcmpEchoCodeCounter +func (obj *patternFlowIcmpEchoCode) Increment() PatternFlowIcmpEchoCodeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIcmpEchoCodeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIcmpEchoCodeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIcmpEchoCodeCounter +func (obj *patternFlowIcmpEchoCode) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIcmpEchoCodeCounter value in the PatternFlowIcmpEchoCode object +func (obj *patternFlowIcmpEchoCode) SetIncrement(value PatternFlowIcmpEchoCodeCounter) PatternFlowIcmpEchoCode { + obj.setChoice(PatternFlowIcmpEchoCodeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIcmpEchoCodeCounter +func (obj *patternFlowIcmpEchoCode) Decrement() PatternFlowIcmpEchoCodeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIcmpEchoCodeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIcmpEchoCodeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIcmpEchoCodeCounter +func (obj *patternFlowIcmpEchoCode) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIcmpEchoCodeCounter value in the PatternFlowIcmpEchoCode object +func (obj *patternFlowIcmpEchoCode) SetDecrement(value PatternFlowIcmpEchoCodeCounter) PatternFlowIcmpEchoCode { + obj.setChoice(PatternFlowIcmpEchoCodeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIcmpEchoCodeMetricTag +func (obj *patternFlowIcmpEchoCode) MetricTags() PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIcmpEchoCodeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter struct { + obj *patternFlowIcmpEchoCode + patternFlowIcmpEchoCodeMetricTagSlice []PatternFlowIcmpEchoCodeMetricTag + fieldPtr *[]*otg.PatternFlowIcmpEchoCodeMetricTag +} + +func newPatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter(ptr *[]*otg.PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { + return &patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter interface { + setMsg(*patternFlowIcmpEchoCode) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter + Items() []PatternFlowIcmpEchoCodeMetricTag + Add() PatternFlowIcmpEchoCodeMetricTag + Append(items ...PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter + Set(index int, newObj PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter + Clear() PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter + clearHolderSlice() PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter + appendHolderSlice(item PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter +} + +func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) setMsg(msg *patternFlowIcmpEchoCode) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIcmpEchoCodeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) Items() []PatternFlowIcmpEchoCodeMetricTag { + return obj.patternFlowIcmpEchoCodeMetricTagSlice +} + +func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) Add() PatternFlowIcmpEchoCodeMetricTag { + newObj := &otg.PatternFlowIcmpEchoCodeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIcmpEchoCodeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIcmpEchoCodeMetricTagSlice = append(obj.patternFlowIcmpEchoCodeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) Append(items ...PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIcmpEchoCodeMetricTagSlice = append(obj.patternFlowIcmpEchoCodeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) Set(index int, newObj PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIcmpEchoCodeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) Clear() PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIcmpEchoCodeMetricTag{} + obj.patternFlowIcmpEchoCodeMetricTagSlice = []PatternFlowIcmpEchoCodeMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) clearHolderSlice() PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { + if len(obj.patternFlowIcmpEchoCodeMetricTagSlice) > 0 { + obj.patternFlowIcmpEchoCodeMetricTagSlice = []PatternFlowIcmpEchoCodeMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter) appendHolderSlice(item PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodePatternFlowIcmpEchoCodeMetricTagIter { + obj.patternFlowIcmpEchoCodeMetricTagSlice = append(obj.patternFlowIcmpEchoCodeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIcmpEchoCode) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoCode.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIcmpEchoCode.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIcmpEchoCodeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIcmpEchoCode) setDefault() { + var choices_set int = 0 + var choice PatternFlowIcmpEchoCodeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIcmpEchoCodeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIcmpEchoCodeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIcmpEchoCodeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIcmpEchoCodeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIcmpEchoCodeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpEchoCode") + } + } else { + intVal := otg.PatternFlowIcmpEchoCode_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIcmpEchoCode_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_icmp_echo_code_counter.go b/gosnappi/pattern_flow_icmp_echo_code_counter.go new file mode 100644 index 00000000..4a7ee044 --- /dev/null +++ b/gosnappi/pattern_flow_icmp_echo_code_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIcmpEchoCodeCounter ***** +type patternFlowIcmpEchoCodeCounter struct { + validation + obj *otg.PatternFlowIcmpEchoCodeCounter + marshaller marshalPatternFlowIcmpEchoCodeCounter + unMarshaller unMarshalPatternFlowIcmpEchoCodeCounter +} + +func NewPatternFlowIcmpEchoCodeCounter() PatternFlowIcmpEchoCodeCounter { + obj := patternFlowIcmpEchoCodeCounter{obj: &otg.PatternFlowIcmpEchoCodeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpEchoCodeCounter) msg() *otg.PatternFlowIcmpEchoCodeCounter { + return obj.obj +} + +func (obj *patternFlowIcmpEchoCodeCounter) setMsg(msg *otg.PatternFlowIcmpEchoCodeCounter) PatternFlowIcmpEchoCodeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpEchoCodeCounter struct { + obj *patternFlowIcmpEchoCodeCounter +} + +type marshalPatternFlowIcmpEchoCodeCounter interface { + // ToProto marshals PatternFlowIcmpEchoCodeCounter to protobuf object *otg.PatternFlowIcmpEchoCodeCounter + ToProto() (*otg.PatternFlowIcmpEchoCodeCounter, error) + // ToPbText marshals PatternFlowIcmpEchoCodeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpEchoCodeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpEchoCodeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpEchoCodeCounter struct { + obj *patternFlowIcmpEchoCodeCounter +} + +type unMarshalPatternFlowIcmpEchoCodeCounter interface { + // FromProto unmarshals PatternFlowIcmpEchoCodeCounter from protobuf object *otg.PatternFlowIcmpEchoCodeCounter + FromProto(msg *otg.PatternFlowIcmpEchoCodeCounter) (PatternFlowIcmpEchoCodeCounter, error) + // FromPbText unmarshals PatternFlowIcmpEchoCodeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpEchoCodeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpEchoCodeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpEchoCodeCounter) Marshal() marshalPatternFlowIcmpEchoCodeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpEchoCodeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpEchoCodeCounter) Unmarshal() unMarshalPatternFlowIcmpEchoCodeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpEchoCodeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpEchoCodeCounter) ToProto() (*otg.PatternFlowIcmpEchoCodeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpEchoCodeCounter) FromProto(msg *otg.PatternFlowIcmpEchoCodeCounter) (PatternFlowIcmpEchoCodeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpEchoCodeCounter) 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 *unMarshalpatternFlowIcmpEchoCodeCounter) 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 *marshalpatternFlowIcmpEchoCodeCounter) 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 *unMarshalpatternFlowIcmpEchoCodeCounter) 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 *marshalpatternFlowIcmpEchoCodeCounter) 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 *unMarshalpatternFlowIcmpEchoCodeCounter) 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 *patternFlowIcmpEchoCodeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoCodeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoCodeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpEchoCodeCounter) Clone() (PatternFlowIcmpEchoCodeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpEchoCodeCounter() + 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 +} + +// PatternFlowIcmpEchoCodeCounter is integer counter pattern +type PatternFlowIcmpEchoCodeCounter interface { + Validation + // msg marshals PatternFlowIcmpEchoCodeCounter to protobuf object *otg.PatternFlowIcmpEchoCodeCounter + // and doesn't set defaults + msg() *otg.PatternFlowIcmpEchoCodeCounter + // setMsg unmarshals PatternFlowIcmpEchoCodeCounter from protobuf object *otg.PatternFlowIcmpEchoCodeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpEchoCodeCounter) PatternFlowIcmpEchoCodeCounter + // provides marshal interface + Marshal() marshalPatternFlowIcmpEchoCodeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpEchoCodeCounter + // validate validates PatternFlowIcmpEchoCodeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpEchoCodeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIcmpEchoCodeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIcmpEchoCodeCounter + SetStart(value uint32) PatternFlowIcmpEchoCodeCounter + // HasStart checks if Start has been set in PatternFlowIcmpEchoCodeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIcmpEchoCodeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIcmpEchoCodeCounter + SetStep(value uint32) PatternFlowIcmpEchoCodeCounter + // HasStep checks if Step has been set in PatternFlowIcmpEchoCodeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIcmpEchoCodeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIcmpEchoCodeCounter + SetCount(value uint32) PatternFlowIcmpEchoCodeCounter + // HasCount checks if Count has been set in PatternFlowIcmpEchoCodeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpEchoCodeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpEchoCodeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIcmpEchoCodeCounter object +func (obj *patternFlowIcmpEchoCodeCounter) SetStart(value uint32) PatternFlowIcmpEchoCodeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpEchoCodeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpEchoCodeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIcmpEchoCodeCounter object +func (obj *patternFlowIcmpEchoCodeCounter) SetStep(value uint32) PatternFlowIcmpEchoCodeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpEchoCodeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpEchoCodeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIcmpEchoCodeCounter object +func (obj *patternFlowIcmpEchoCodeCounter) SetCount(value uint32) PatternFlowIcmpEchoCodeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIcmpEchoCodeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoCodeCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoCodeCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoCodeCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIcmpEchoCodeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_icmp_echo_code_metric_tag.go b/gosnappi/pattern_flow_icmp_echo_code_metric_tag.go new file mode 100644 index 00000000..ad689519 --- /dev/null +++ b/gosnappi/pattern_flow_icmp_echo_code_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIcmpEchoCodeMetricTag ***** +type patternFlowIcmpEchoCodeMetricTag struct { + validation + obj *otg.PatternFlowIcmpEchoCodeMetricTag + marshaller marshalPatternFlowIcmpEchoCodeMetricTag + unMarshaller unMarshalPatternFlowIcmpEchoCodeMetricTag +} + +func NewPatternFlowIcmpEchoCodeMetricTag() PatternFlowIcmpEchoCodeMetricTag { + obj := patternFlowIcmpEchoCodeMetricTag{obj: &otg.PatternFlowIcmpEchoCodeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpEchoCodeMetricTag) msg() *otg.PatternFlowIcmpEchoCodeMetricTag { + return obj.obj +} + +func (obj *patternFlowIcmpEchoCodeMetricTag) setMsg(msg *otg.PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpEchoCodeMetricTag struct { + obj *patternFlowIcmpEchoCodeMetricTag +} + +type marshalPatternFlowIcmpEchoCodeMetricTag interface { + // ToProto marshals PatternFlowIcmpEchoCodeMetricTag to protobuf object *otg.PatternFlowIcmpEchoCodeMetricTag + ToProto() (*otg.PatternFlowIcmpEchoCodeMetricTag, error) + // ToPbText marshals PatternFlowIcmpEchoCodeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpEchoCodeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpEchoCodeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpEchoCodeMetricTag struct { + obj *patternFlowIcmpEchoCodeMetricTag +} + +type unMarshalPatternFlowIcmpEchoCodeMetricTag interface { + // FromProto unmarshals PatternFlowIcmpEchoCodeMetricTag from protobuf object *otg.PatternFlowIcmpEchoCodeMetricTag + FromProto(msg *otg.PatternFlowIcmpEchoCodeMetricTag) (PatternFlowIcmpEchoCodeMetricTag, error) + // FromPbText unmarshals PatternFlowIcmpEchoCodeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpEchoCodeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpEchoCodeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpEchoCodeMetricTag) Marshal() marshalPatternFlowIcmpEchoCodeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpEchoCodeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpEchoCodeMetricTag) Unmarshal() unMarshalPatternFlowIcmpEchoCodeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpEchoCodeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpEchoCodeMetricTag) ToProto() (*otg.PatternFlowIcmpEchoCodeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpEchoCodeMetricTag) FromProto(msg *otg.PatternFlowIcmpEchoCodeMetricTag) (PatternFlowIcmpEchoCodeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpEchoCodeMetricTag) 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 *unMarshalpatternFlowIcmpEchoCodeMetricTag) 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 *marshalpatternFlowIcmpEchoCodeMetricTag) 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 *unMarshalpatternFlowIcmpEchoCodeMetricTag) 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 *marshalpatternFlowIcmpEchoCodeMetricTag) 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 *unMarshalpatternFlowIcmpEchoCodeMetricTag) 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 *patternFlowIcmpEchoCodeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoCodeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoCodeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpEchoCodeMetricTag) Clone() (PatternFlowIcmpEchoCodeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpEchoCodeMetricTag() + 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 +} + +// PatternFlowIcmpEchoCodeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIcmpEchoCodeMetricTag interface { + Validation + // msg marshals PatternFlowIcmpEchoCodeMetricTag to protobuf object *otg.PatternFlowIcmpEchoCodeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIcmpEchoCodeMetricTag + // setMsg unmarshals PatternFlowIcmpEchoCodeMetricTag from protobuf object *otg.PatternFlowIcmpEchoCodeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpEchoCodeMetricTag) PatternFlowIcmpEchoCodeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIcmpEchoCodeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpEchoCodeMetricTag + // validate validates PatternFlowIcmpEchoCodeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpEchoCodeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIcmpEchoCodeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIcmpEchoCodeMetricTag + SetName(value string) PatternFlowIcmpEchoCodeMetricTag + // Offset returns uint32, set in PatternFlowIcmpEchoCodeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIcmpEchoCodeMetricTag + SetOffset(value uint32) PatternFlowIcmpEchoCodeMetricTag + // HasOffset checks if Offset has been set in PatternFlowIcmpEchoCodeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIcmpEchoCodeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIcmpEchoCodeMetricTag + SetLength(value uint32) PatternFlowIcmpEchoCodeMetricTag + // HasLength checks if Length has been set in PatternFlowIcmpEchoCodeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIcmpEchoCodeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIcmpEchoCodeMetricTag object +func (obj *patternFlowIcmpEchoCodeMetricTag) SetName(value string) PatternFlowIcmpEchoCodeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpEchoCodeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpEchoCodeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIcmpEchoCodeMetricTag object +func (obj *patternFlowIcmpEchoCodeMetricTag) SetOffset(value uint32) PatternFlowIcmpEchoCodeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpEchoCodeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpEchoCodeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIcmpEchoCodeMetricTag object +func (obj *patternFlowIcmpEchoCodeMetricTag) SetLength(value uint32) PatternFlowIcmpEchoCodeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIcmpEchoCodeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpEchoCodeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoCodeMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIcmpEchoCodeMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIcmpEchoCodeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_icmp_echo_identifier.go b/gosnappi/pattern_flow_icmp_echo_identifier.go new file mode 100644 index 00000000..83302521 --- /dev/null +++ b/gosnappi/pattern_flow_icmp_echo_identifier.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIcmpEchoIdentifier ***** +type patternFlowIcmpEchoIdentifier struct { + validation + obj *otg.PatternFlowIcmpEchoIdentifier + marshaller marshalPatternFlowIcmpEchoIdentifier + unMarshaller unMarshalPatternFlowIcmpEchoIdentifier + incrementHolder PatternFlowIcmpEchoIdentifierCounter + decrementHolder PatternFlowIcmpEchoIdentifierCounter + metricTagsHolder PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter +} + +func NewPatternFlowIcmpEchoIdentifier() PatternFlowIcmpEchoIdentifier { + obj := patternFlowIcmpEchoIdentifier{obj: &otg.PatternFlowIcmpEchoIdentifier{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpEchoIdentifier) msg() *otg.PatternFlowIcmpEchoIdentifier { + return obj.obj +} + +func (obj *patternFlowIcmpEchoIdentifier) setMsg(msg *otg.PatternFlowIcmpEchoIdentifier) PatternFlowIcmpEchoIdentifier { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpEchoIdentifier struct { + obj *patternFlowIcmpEchoIdentifier +} + +type marshalPatternFlowIcmpEchoIdentifier interface { + // ToProto marshals PatternFlowIcmpEchoIdentifier to protobuf object *otg.PatternFlowIcmpEchoIdentifier + ToProto() (*otg.PatternFlowIcmpEchoIdentifier, error) + // ToPbText marshals PatternFlowIcmpEchoIdentifier to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpEchoIdentifier to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpEchoIdentifier to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpEchoIdentifier struct { + obj *patternFlowIcmpEchoIdentifier +} + +type unMarshalPatternFlowIcmpEchoIdentifier interface { + // FromProto unmarshals PatternFlowIcmpEchoIdentifier from protobuf object *otg.PatternFlowIcmpEchoIdentifier + FromProto(msg *otg.PatternFlowIcmpEchoIdentifier) (PatternFlowIcmpEchoIdentifier, error) + // FromPbText unmarshals PatternFlowIcmpEchoIdentifier from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpEchoIdentifier from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpEchoIdentifier from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpEchoIdentifier) Marshal() marshalPatternFlowIcmpEchoIdentifier { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpEchoIdentifier{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpEchoIdentifier) Unmarshal() unMarshalPatternFlowIcmpEchoIdentifier { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpEchoIdentifier{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpEchoIdentifier) ToProto() (*otg.PatternFlowIcmpEchoIdentifier, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpEchoIdentifier) FromProto(msg *otg.PatternFlowIcmpEchoIdentifier) (PatternFlowIcmpEchoIdentifier, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpEchoIdentifier) 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 *unMarshalpatternFlowIcmpEchoIdentifier) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIcmpEchoIdentifier) 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 *unMarshalpatternFlowIcmpEchoIdentifier) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIcmpEchoIdentifier) 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 *unMarshalpatternFlowIcmpEchoIdentifier) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIcmpEchoIdentifier) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoIdentifier) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoIdentifier) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpEchoIdentifier) Clone() (PatternFlowIcmpEchoIdentifier, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpEchoIdentifier() + 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 +} + +func (obj *patternFlowIcmpEchoIdentifier) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIcmpEchoIdentifier is iCMP identifier +type PatternFlowIcmpEchoIdentifier interface { + Validation + // msg marshals PatternFlowIcmpEchoIdentifier to protobuf object *otg.PatternFlowIcmpEchoIdentifier + // and doesn't set defaults + msg() *otg.PatternFlowIcmpEchoIdentifier + // setMsg unmarshals PatternFlowIcmpEchoIdentifier from protobuf object *otg.PatternFlowIcmpEchoIdentifier + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpEchoIdentifier) PatternFlowIcmpEchoIdentifier + // provides marshal interface + Marshal() marshalPatternFlowIcmpEchoIdentifier + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpEchoIdentifier + // validate validates PatternFlowIcmpEchoIdentifier + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpEchoIdentifier, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIcmpEchoIdentifierChoiceEnum, set in PatternFlowIcmpEchoIdentifier + Choice() PatternFlowIcmpEchoIdentifierChoiceEnum + // setChoice assigns PatternFlowIcmpEchoIdentifierChoiceEnum provided by user to PatternFlowIcmpEchoIdentifier + setChoice(value PatternFlowIcmpEchoIdentifierChoiceEnum) PatternFlowIcmpEchoIdentifier + // HasChoice checks if Choice has been set in PatternFlowIcmpEchoIdentifier + HasChoice() bool + // Value returns uint32, set in PatternFlowIcmpEchoIdentifier. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIcmpEchoIdentifier + SetValue(value uint32) PatternFlowIcmpEchoIdentifier + // HasValue checks if Value has been set in PatternFlowIcmpEchoIdentifier + HasValue() bool + // Values returns []uint32, set in PatternFlowIcmpEchoIdentifier. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIcmpEchoIdentifier + SetValues(value []uint32) PatternFlowIcmpEchoIdentifier + // Increment returns PatternFlowIcmpEchoIdentifierCounter, set in PatternFlowIcmpEchoIdentifier. + // PatternFlowIcmpEchoIdentifierCounter is integer counter pattern + Increment() PatternFlowIcmpEchoIdentifierCounter + // SetIncrement assigns PatternFlowIcmpEchoIdentifierCounter provided by user to PatternFlowIcmpEchoIdentifier. + // PatternFlowIcmpEchoIdentifierCounter is integer counter pattern + SetIncrement(value PatternFlowIcmpEchoIdentifierCounter) PatternFlowIcmpEchoIdentifier + // HasIncrement checks if Increment has been set in PatternFlowIcmpEchoIdentifier + HasIncrement() bool + // Decrement returns PatternFlowIcmpEchoIdentifierCounter, set in PatternFlowIcmpEchoIdentifier. + // PatternFlowIcmpEchoIdentifierCounter is integer counter pattern + Decrement() PatternFlowIcmpEchoIdentifierCounter + // SetDecrement assigns PatternFlowIcmpEchoIdentifierCounter provided by user to PatternFlowIcmpEchoIdentifier. + // PatternFlowIcmpEchoIdentifierCounter is integer counter pattern + SetDecrement(value PatternFlowIcmpEchoIdentifierCounter) PatternFlowIcmpEchoIdentifier + // HasDecrement checks if Decrement has been set in PatternFlowIcmpEchoIdentifier + HasDecrement() bool + // MetricTags returns PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIterIter, set in PatternFlowIcmpEchoIdentifier + MetricTags() PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter + setNil() +} + +type PatternFlowIcmpEchoIdentifierChoiceEnum string + +// Enum of Choice on PatternFlowIcmpEchoIdentifier +var PatternFlowIcmpEchoIdentifierChoice = struct { + VALUE PatternFlowIcmpEchoIdentifierChoiceEnum + VALUES PatternFlowIcmpEchoIdentifierChoiceEnum + INCREMENT PatternFlowIcmpEchoIdentifierChoiceEnum + DECREMENT PatternFlowIcmpEchoIdentifierChoiceEnum +}{ + VALUE: PatternFlowIcmpEchoIdentifierChoiceEnum("value"), + VALUES: PatternFlowIcmpEchoIdentifierChoiceEnum("values"), + INCREMENT: PatternFlowIcmpEchoIdentifierChoiceEnum("increment"), + DECREMENT: PatternFlowIcmpEchoIdentifierChoiceEnum("decrement"), +} + +func (obj *patternFlowIcmpEchoIdentifier) Choice() PatternFlowIcmpEchoIdentifierChoiceEnum { + return PatternFlowIcmpEchoIdentifierChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIcmpEchoIdentifier) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIcmpEchoIdentifier) setChoice(value PatternFlowIcmpEchoIdentifierChoiceEnum) PatternFlowIcmpEchoIdentifier { + intValue, ok := otg.PatternFlowIcmpEchoIdentifier_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIcmpEchoIdentifierChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIcmpEchoIdentifier_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIcmpEchoIdentifierChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIcmpEchoIdentifierChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIcmpEchoIdentifierChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIcmpEchoIdentifierCounter().msg() + } + + if value == PatternFlowIcmpEchoIdentifierChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIcmpEchoIdentifierCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpEchoIdentifier) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpEchoIdentifier) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIcmpEchoIdentifier object +func (obj *patternFlowIcmpEchoIdentifier) SetValue(value uint32) PatternFlowIcmpEchoIdentifier { + obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIcmpEchoIdentifier) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIcmpEchoIdentifier object +func (obj *patternFlowIcmpEchoIdentifier) SetValues(value []uint32) PatternFlowIcmpEchoIdentifier { + obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIcmpEchoIdentifierCounter +func (obj *patternFlowIcmpEchoIdentifier) Increment() PatternFlowIcmpEchoIdentifierCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIcmpEchoIdentifierCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIcmpEchoIdentifierCounter +func (obj *patternFlowIcmpEchoIdentifier) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIcmpEchoIdentifierCounter value in the PatternFlowIcmpEchoIdentifier object +func (obj *patternFlowIcmpEchoIdentifier) SetIncrement(value PatternFlowIcmpEchoIdentifierCounter) PatternFlowIcmpEchoIdentifier { + obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIcmpEchoIdentifierCounter +func (obj *patternFlowIcmpEchoIdentifier) Decrement() PatternFlowIcmpEchoIdentifierCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIcmpEchoIdentifierCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIcmpEchoIdentifierCounter +func (obj *patternFlowIcmpEchoIdentifier) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIcmpEchoIdentifierCounter value in the PatternFlowIcmpEchoIdentifier object +func (obj *patternFlowIcmpEchoIdentifier) SetDecrement(value PatternFlowIcmpEchoIdentifierCounter) PatternFlowIcmpEchoIdentifier { + obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIcmpEchoIdentifierMetricTag +func (obj *patternFlowIcmpEchoIdentifier) MetricTags() PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIcmpEchoIdentifierMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter struct { + obj *patternFlowIcmpEchoIdentifier + patternFlowIcmpEchoIdentifierMetricTagSlice []PatternFlowIcmpEchoIdentifierMetricTag + fieldPtr *[]*otg.PatternFlowIcmpEchoIdentifierMetricTag +} + +func newPatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter(ptr *[]*otg.PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { + return &patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter interface { + setMsg(*patternFlowIcmpEchoIdentifier) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter + Items() []PatternFlowIcmpEchoIdentifierMetricTag + Add() PatternFlowIcmpEchoIdentifierMetricTag + Append(items ...PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter + Set(index int, newObj PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter + Clear() PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter + clearHolderSlice() PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter + appendHolderSlice(item PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter +} + +func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) setMsg(msg *patternFlowIcmpEchoIdentifier) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIcmpEchoIdentifierMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) Items() []PatternFlowIcmpEchoIdentifierMetricTag { + return obj.patternFlowIcmpEchoIdentifierMetricTagSlice +} + +func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) Add() PatternFlowIcmpEchoIdentifierMetricTag { + newObj := &otg.PatternFlowIcmpEchoIdentifierMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIcmpEchoIdentifierMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIcmpEchoIdentifierMetricTagSlice = append(obj.patternFlowIcmpEchoIdentifierMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) Append(items ...PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIcmpEchoIdentifierMetricTagSlice = append(obj.patternFlowIcmpEchoIdentifierMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) Set(index int, newObj PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIcmpEchoIdentifierMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) Clear() PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIcmpEchoIdentifierMetricTag{} + obj.patternFlowIcmpEchoIdentifierMetricTagSlice = []PatternFlowIcmpEchoIdentifierMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) clearHolderSlice() PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { + if len(obj.patternFlowIcmpEchoIdentifierMetricTagSlice) > 0 { + obj.patternFlowIcmpEchoIdentifierMetricTagSlice = []PatternFlowIcmpEchoIdentifierMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter) appendHolderSlice(item PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierPatternFlowIcmpEchoIdentifierMetricTagIter { + obj.patternFlowIcmpEchoIdentifierMetricTagSlice = append(obj.patternFlowIcmpEchoIdentifierMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIcmpEchoIdentifier) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoIdentifier.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIcmpEchoIdentifier.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIcmpEchoIdentifierMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIcmpEchoIdentifier) setDefault() { + var choices_set int = 0 + var choice PatternFlowIcmpEchoIdentifierChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIcmpEchoIdentifierChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIcmpEchoIdentifierChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIcmpEchoIdentifierChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIcmpEchoIdentifierChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIcmpEchoIdentifierChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpEchoIdentifier") + } + } else { + intVal := otg.PatternFlowIcmpEchoIdentifier_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIcmpEchoIdentifier_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_icmp_echo_identifier_counter.go b/gosnappi/pattern_flow_icmp_echo_identifier_counter.go new file mode 100644 index 00000000..76755877 --- /dev/null +++ b/gosnappi/pattern_flow_icmp_echo_identifier_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIcmpEchoIdentifierCounter ***** +type patternFlowIcmpEchoIdentifierCounter struct { + validation + obj *otg.PatternFlowIcmpEchoIdentifierCounter + marshaller marshalPatternFlowIcmpEchoIdentifierCounter + unMarshaller unMarshalPatternFlowIcmpEchoIdentifierCounter +} + +func NewPatternFlowIcmpEchoIdentifierCounter() PatternFlowIcmpEchoIdentifierCounter { + obj := patternFlowIcmpEchoIdentifierCounter{obj: &otg.PatternFlowIcmpEchoIdentifierCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpEchoIdentifierCounter) msg() *otg.PatternFlowIcmpEchoIdentifierCounter { + return obj.obj +} + +func (obj *patternFlowIcmpEchoIdentifierCounter) setMsg(msg *otg.PatternFlowIcmpEchoIdentifierCounter) PatternFlowIcmpEchoIdentifierCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpEchoIdentifierCounter struct { + obj *patternFlowIcmpEchoIdentifierCounter +} + +type marshalPatternFlowIcmpEchoIdentifierCounter interface { + // ToProto marshals PatternFlowIcmpEchoIdentifierCounter to protobuf object *otg.PatternFlowIcmpEchoIdentifierCounter + ToProto() (*otg.PatternFlowIcmpEchoIdentifierCounter, error) + // ToPbText marshals PatternFlowIcmpEchoIdentifierCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpEchoIdentifierCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpEchoIdentifierCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpEchoIdentifierCounter struct { + obj *patternFlowIcmpEchoIdentifierCounter +} + +type unMarshalPatternFlowIcmpEchoIdentifierCounter interface { + // FromProto unmarshals PatternFlowIcmpEchoIdentifierCounter from protobuf object *otg.PatternFlowIcmpEchoIdentifierCounter + FromProto(msg *otg.PatternFlowIcmpEchoIdentifierCounter) (PatternFlowIcmpEchoIdentifierCounter, error) + // FromPbText unmarshals PatternFlowIcmpEchoIdentifierCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpEchoIdentifierCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpEchoIdentifierCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpEchoIdentifierCounter) Marshal() marshalPatternFlowIcmpEchoIdentifierCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpEchoIdentifierCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpEchoIdentifierCounter) Unmarshal() unMarshalPatternFlowIcmpEchoIdentifierCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpEchoIdentifierCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpEchoIdentifierCounter) ToProto() (*otg.PatternFlowIcmpEchoIdentifierCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpEchoIdentifierCounter) FromProto(msg *otg.PatternFlowIcmpEchoIdentifierCounter) (PatternFlowIcmpEchoIdentifierCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpEchoIdentifierCounter) 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 *unMarshalpatternFlowIcmpEchoIdentifierCounter) 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 *marshalpatternFlowIcmpEchoIdentifierCounter) 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 *unMarshalpatternFlowIcmpEchoIdentifierCounter) 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 *marshalpatternFlowIcmpEchoIdentifierCounter) 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 *unMarshalpatternFlowIcmpEchoIdentifierCounter) 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 *patternFlowIcmpEchoIdentifierCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoIdentifierCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoIdentifierCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpEchoIdentifierCounter) Clone() (PatternFlowIcmpEchoIdentifierCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpEchoIdentifierCounter() + 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 +} + +// PatternFlowIcmpEchoIdentifierCounter is integer counter pattern +type PatternFlowIcmpEchoIdentifierCounter interface { + Validation + // msg marshals PatternFlowIcmpEchoIdentifierCounter to protobuf object *otg.PatternFlowIcmpEchoIdentifierCounter + // and doesn't set defaults + msg() *otg.PatternFlowIcmpEchoIdentifierCounter + // setMsg unmarshals PatternFlowIcmpEchoIdentifierCounter from protobuf object *otg.PatternFlowIcmpEchoIdentifierCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpEchoIdentifierCounter) PatternFlowIcmpEchoIdentifierCounter + // provides marshal interface + Marshal() marshalPatternFlowIcmpEchoIdentifierCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpEchoIdentifierCounter + // validate validates PatternFlowIcmpEchoIdentifierCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpEchoIdentifierCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIcmpEchoIdentifierCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIcmpEchoIdentifierCounter + SetStart(value uint32) PatternFlowIcmpEchoIdentifierCounter + // HasStart checks if Start has been set in PatternFlowIcmpEchoIdentifierCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIcmpEchoIdentifierCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIcmpEchoIdentifierCounter + SetStep(value uint32) PatternFlowIcmpEchoIdentifierCounter + // HasStep checks if Step has been set in PatternFlowIcmpEchoIdentifierCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIcmpEchoIdentifierCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIcmpEchoIdentifierCounter + SetCount(value uint32) PatternFlowIcmpEchoIdentifierCounter + // HasCount checks if Count has been set in PatternFlowIcmpEchoIdentifierCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpEchoIdentifierCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpEchoIdentifierCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIcmpEchoIdentifierCounter object +func (obj *patternFlowIcmpEchoIdentifierCounter) SetStart(value uint32) PatternFlowIcmpEchoIdentifierCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpEchoIdentifierCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpEchoIdentifierCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIcmpEchoIdentifierCounter object +func (obj *patternFlowIcmpEchoIdentifierCounter) SetStep(value uint32) PatternFlowIcmpEchoIdentifierCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpEchoIdentifierCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpEchoIdentifierCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIcmpEchoIdentifierCounter object +func (obj *patternFlowIcmpEchoIdentifierCounter) SetCount(value uint32) PatternFlowIcmpEchoIdentifierCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIcmpEchoIdentifierCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoIdentifierCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoIdentifierCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoIdentifierCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIcmpEchoIdentifierCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_icmp_echo_identifier_metric_tag.go b/gosnappi/pattern_flow_icmp_echo_identifier_metric_tag.go new file mode 100644 index 00000000..dd85a2ff --- /dev/null +++ b/gosnappi/pattern_flow_icmp_echo_identifier_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIcmpEchoIdentifierMetricTag ***** +type patternFlowIcmpEchoIdentifierMetricTag struct { + validation + obj *otg.PatternFlowIcmpEchoIdentifierMetricTag + marshaller marshalPatternFlowIcmpEchoIdentifierMetricTag + unMarshaller unMarshalPatternFlowIcmpEchoIdentifierMetricTag +} + +func NewPatternFlowIcmpEchoIdentifierMetricTag() PatternFlowIcmpEchoIdentifierMetricTag { + obj := patternFlowIcmpEchoIdentifierMetricTag{obj: &otg.PatternFlowIcmpEchoIdentifierMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpEchoIdentifierMetricTag) msg() *otg.PatternFlowIcmpEchoIdentifierMetricTag { + return obj.obj +} + +func (obj *patternFlowIcmpEchoIdentifierMetricTag) setMsg(msg *otg.PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpEchoIdentifierMetricTag struct { + obj *patternFlowIcmpEchoIdentifierMetricTag +} + +type marshalPatternFlowIcmpEchoIdentifierMetricTag interface { + // ToProto marshals PatternFlowIcmpEchoIdentifierMetricTag to protobuf object *otg.PatternFlowIcmpEchoIdentifierMetricTag + ToProto() (*otg.PatternFlowIcmpEchoIdentifierMetricTag, error) + // ToPbText marshals PatternFlowIcmpEchoIdentifierMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpEchoIdentifierMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpEchoIdentifierMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpEchoIdentifierMetricTag struct { + obj *patternFlowIcmpEchoIdentifierMetricTag +} + +type unMarshalPatternFlowIcmpEchoIdentifierMetricTag interface { + // FromProto unmarshals PatternFlowIcmpEchoIdentifierMetricTag from protobuf object *otg.PatternFlowIcmpEchoIdentifierMetricTag + FromProto(msg *otg.PatternFlowIcmpEchoIdentifierMetricTag) (PatternFlowIcmpEchoIdentifierMetricTag, error) + // FromPbText unmarshals PatternFlowIcmpEchoIdentifierMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpEchoIdentifierMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpEchoIdentifierMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpEchoIdentifierMetricTag) Marshal() marshalPatternFlowIcmpEchoIdentifierMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpEchoIdentifierMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpEchoIdentifierMetricTag) Unmarshal() unMarshalPatternFlowIcmpEchoIdentifierMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpEchoIdentifierMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpEchoIdentifierMetricTag) ToProto() (*otg.PatternFlowIcmpEchoIdentifierMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpEchoIdentifierMetricTag) FromProto(msg *otg.PatternFlowIcmpEchoIdentifierMetricTag) (PatternFlowIcmpEchoIdentifierMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpEchoIdentifierMetricTag) 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 *unMarshalpatternFlowIcmpEchoIdentifierMetricTag) 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 *marshalpatternFlowIcmpEchoIdentifierMetricTag) 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 *unMarshalpatternFlowIcmpEchoIdentifierMetricTag) 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 *marshalpatternFlowIcmpEchoIdentifierMetricTag) 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 *unMarshalpatternFlowIcmpEchoIdentifierMetricTag) 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 *patternFlowIcmpEchoIdentifierMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoIdentifierMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoIdentifierMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpEchoIdentifierMetricTag) Clone() (PatternFlowIcmpEchoIdentifierMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpEchoIdentifierMetricTag() + 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 +} + +// PatternFlowIcmpEchoIdentifierMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIcmpEchoIdentifierMetricTag interface { + Validation + // msg marshals PatternFlowIcmpEchoIdentifierMetricTag to protobuf object *otg.PatternFlowIcmpEchoIdentifierMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIcmpEchoIdentifierMetricTag + // setMsg unmarshals PatternFlowIcmpEchoIdentifierMetricTag from protobuf object *otg.PatternFlowIcmpEchoIdentifierMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpEchoIdentifierMetricTag) PatternFlowIcmpEchoIdentifierMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIcmpEchoIdentifierMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpEchoIdentifierMetricTag + // validate validates PatternFlowIcmpEchoIdentifierMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpEchoIdentifierMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIcmpEchoIdentifierMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIcmpEchoIdentifierMetricTag + SetName(value string) PatternFlowIcmpEchoIdentifierMetricTag + // Offset returns uint32, set in PatternFlowIcmpEchoIdentifierMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIcmpEchoIdentifierMetricTag + SetOffset(value uint32) PatternFlowIcmpEchoIdentifierMetricTag + // HasOffset checks if Offset has been set in PatternFlowIcmpEchoIdentifierMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIcmpEchoIdentifierMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIcmpEchoIdentifierMetricTag + SetLength(value uint32) PatternFlowIcmpEchoIdentifierMetricTag + // HasLength checks if Length has been set in PatternFlowIcmpEchoIdentifierMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIcmpEchoIdentifierMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIcmpEchoIdentifierMetricTag object +func (obj *patternFlowIcmpEchoIdentifierMetricTag) SetName(value string) PatternFlowIcmpEchoIdentifierMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpEchoIdentifierMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpEchoIdentifierMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIcmpEchoIdentifierMetricTag object +func (obj *patternFlowIcmpEchoIdentifierMetricTag) SetOffset(value uint32) PatternFlowIcmpEchoIdentifierMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpEchoIdentifierMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpEchoIdentifierMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIcmpEchoIdentifierMetricTag object +func (obj *patternFlowIcmpEchoIdentifierMetricTag) SetLength(value uint32) PatternFlowIcmpEchoIdentifierMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIcmpEchoIdentifierMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpEchoIdentifierMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoIdentifierMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIcmpEchoIdentifierMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIcmpEchoIdentifierMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_icmp_echo_sequence_number.go b/gosnappi/pattern_flow_icmp_echo_sequence_number.go new file mode 100644 index 00000000..8ec4e49b --- /dev/null +++ b/gosnappi/pattern_flow_icmp_echo_sequence_number.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIcmpEchoSequenceNumber ***** +type patternFlowIcmpEchoSequenceNumber struct { + validation + obj *otg.PatternFlowIcmpEchoSequenceNumber + marshaller marshalPatternFlowIcmpEchoSequenceNumber + unMarshaller unMarshalPatternFlowIcmpEchoSequenceNumber + incrementHolder PatternFlowIcmpEchoSequenceNumberCounter + decrementHolder PatternFlowIcmpEchoSequenceNumberCounter + metricTagsHolder PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter +} + +func NewPatternFlowIcmpEchoSequenceNumber() PatternFlowIcmpEchoSequenceNumber { + obj := patternFlowIcmpEchoSequenceNumber{obj: &otg.PatternFlowIcmpEchoSequenceNumber{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpEchoSequenceNumber) msg() *otg.PatternFlowIcmpEchoSequenceNumber { + return obj.obj +} + +func (obj *patternFlowIcmpEchoSequenceNumber) setMsg(msg *otg.PatternFlowIcmpEchoSequenceNumber) PatternFlowIcmpEchoSequenceNumber { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpEchoSequenceNumber struct { + obj *patternFlowIcmpEchoSequenceNumber +} + +type marshalPatternFlowIcmpEchoSequenceNumber interface { + // ToProto marshals PatternFlowIcmpEchoSequenceNumber to protobuf object *otg.PatternFlowIcmpEchoSequenceNumber + ToProto() (*otg.PatternFlowIcmpEchoSequenceNumber, error) + // ToPbText marshals PatternFlowIcmpEchoSequenceNumber to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpEchoSequenceNumber to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpEchoSequenceNumber to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpEchoSequenceNumber struct { + obj *patternFlowIcmpEchoSequenceNumber +} + +type unMarshalPatternFlowIcmpEchoSequenceNumber interface { + // FromProto unmarshals PatternFlowIcmpEchoSequenceNumber from protobuf object *otg.PatternFlowIcmpEchoSequenceNumber + FromProto(msg *otg.PatternFlowIcmpEchoSequenceNumber) (PatternFlowIcmpEchoSequenceNumber, error) + // FromPbText unmarshals PatternFlowIcmpEchoSequenceNumber from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpEchoSequenceNumber from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpEchoSequenceNumber from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpEchoSequenceNumber) Marshal() marshalPatternFlowIcmpEchoSequenceNumber { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpEchoSequenceNumber{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpEchoSequenceNumber) Unmarshal() unMarshalPatternFlowIcmpEchoSequenceNumber { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpEchoSequenceNumber{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpEchoSequenceNumber) ToProto() (*otg.PatternFlowIcmpEchoSequenceNumber, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpEchoSequenceNumber) FromProto(msg *otg.PatternFlowIcmpEchoSequenceNumber) (PatternFlowIcmpEchoSequenceNumber, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpEchoSequenceNumber) 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 *unMarshalpatternFlowIcmpEchoSequenceNumber) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIcmpEchoSequenceNumber) 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 *unMarshalpatternFlowIcmpEchoSequenceNumber) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIcmpEchoSequenceNumber) 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 *unMarshalpatternFlowIcmpEchoSequenceNumber) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIcmpEchoSequenceNumber) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoSequenceNumber) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoSequenceNumber) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpEchoSequenceNumber) Clone() (PatternFlowIcmpEchoSequenceNumber, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpEchoSequenceNumber() + 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 +} + +func (obj *patternFlowIcmpEchoSequenceNumber) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIcmpEchoSequenceNumber is iCMP sequence number +type PatternFlowIcmpEchoSequenceNumber interface { + Validation + // msg marshals PatternFlowIcmpEchoSequenceNumber to protobuf object *otg.PatternFlowIcmpEchoSequenceNumber + // and doesn't set defaults + msg() *otg.PatternFlowIcmpEchoSequenceNumber + // setMsg unmarshals PatternFlowIcmpEchoSequenceNumber from protobuf object *otg.PatternFlowIcmpEchoSequenceNumber + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpEchoSequenceNumber) PatternFlowIcmpEchoSequenceNumber + // provides marshal interface + Marshal() marshalPatternFlowIcmpEchoSequenceNumber + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpEchoSequenceNumber + // validate validates PatternFlowIcmpEchoSequenceNumber + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpEchoSequenceNumber, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIcmpEchoSequenceNumberChoiceEnum, set in PatternFlowIcmpEchoSequenceNumber + Choice() PatternFlowIcmpEchoSequenceNumberChoiceEnum + // setChoice assigns PatternFlowIcmpEchoSequenceNumberChoiceEnum provided by user to PatternFlowIcmpEchoSequenceNumber + setChoice(value PatternFlowIcmpEchoSequenceNumberChoiceEnum) PatternFlowIcmpEchoSequenceNumber + // HasChoice checks if Choice has been set in PatternFlowIcmpEchoSequenceNumber + HasChoice() bool + // Value returns uint32, set in PatternFlowIcmpEchoSequenceNumber. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIcmpEchoSequenceNumber + SetValue(value uint32) PatternFlowIcmpEchoSequenceNumber + // HasValue checks if Value has been set in PatternFlowIcmpEchoSequenceNumber + HasValue() bool + // Values returns []uint32, set in PatternFlowIcmpEchoSequenceNumber. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIcmpEchoSequenceNumber + SetValues(value []uint32) PatternFlowIcmpEchoSequenceNumber + // Increment returns PatternFlowIcmpEchoSequenceNumberCounter, set in PatternFlowIcmpEchoSequenceNumber. + // PatternFlowIcmpEchoSequenceNumberCounter is integer counter pattern + Increment() PatternFlowIcmpEchoSequenceNumberCounter + // SetIncrement assigns PatternFlowIcmpEchoSequenceNumberCounter provided by user to PatternFlowIcmpEchoSequenceNumber. + // PatternFlowIcmpEchoSequenceNumberCounter is integer counter pattern + SetIncrement(value PatternFlowIcmpEchoSequenceNumberCounter) PatternFlowIcmpEchoSequenceNumber + // HasIncrement checks if Increment has been set in PatternFlowIcmpEchoSequenceNumber + HasIncrement() bool + // Decrement returns PatternFlowIcmpEchoSequenceNumberCounter, set in PatternFlowIcmpEchoSequenceNumber. + // PatternFlowIcmpEchoSequenceNumberCounter is integer counter pattern + Decrement() PatternFlowIcmpEchoSequenceNumberCounter + // SetDecrement assigns PatternFlowIcmpEchoSequenceNumberCounter provided by user to PatternFlowIcmpEchoSequenceNumber. + // PatternFlowIcmpEchoSequenceNumberCounter is integer counter pattern + SetDecrement(value PatternFlowIcmpEchoSequenceNumberCounter) PatternFlowIcmpEchoSequenceNumber + // HasDecrement checks if Decrement has been set in PatternFlowIcmpEchoSequenceNumber + HasDecrement() bool + // MetricTags returns PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIterIter, set in PatternFlowIcmpEchoSequenceNumber + MetricTags() PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter + setNil() +} + +type PatternFlowIcmpEchoSequenceNumberChoiceEnum string + +// Enum of Choice on PatternFlowIcmpEchoSequenceNumber +var PatternFlowIcmpEchoSequenceNumberChoice = struct { + VALUE PatternFlowIcmpEchoSequenceNumberChoiceEnum + VALUES PatternFlowIcmpEchoSequenceNumberChoiceEnum + INCREMENT PatternFlowIcmpEchoSequenceNumberChoiceEnum + DECREMENT PatternFlowIcmpEchoSequenceNumberChoiceEnum +}{ + VALUE: PatternFlowIcmpEchoSequenceNumberChoiceEnum("value"), + VALUES: PatternFlowIcmpEchoSequenceNumberChoiceEnum("values"), + INCREMENT: PatternFlowIcmpEchoSequenceNumberChoiceEnum("increment"), + DECREMENT: PatternFlowIcmpEchoSequenceNumberChoiceEnum("decrement"), +} + +func (obj *patternFlowIcmpEchoSequenceNumber) Choice() PatternFlowIcmpEchoSequenceNumberChoiceEnum { + return PatternFlowIcmpEchoSequenceNumberChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIcmpEchoSequenceNumber) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIcmpEchoSequenceNumber) setChoice(value PatternFlowIcmpEchoSequenceNumberChoiceEnum) PatternFlowIcmpEchoSequenceNumber { + intValue, ok := otg.PatternFlowIcmpEchoSequenceNumber_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIcmpEchoSequenceNumberChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIcmpEchoSequenceNumber_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIcmpEchoSequenceNumberChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIcmpEchoSequenceNumberChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIcmpEchoSequenceNumberChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIcmpEchoSequenceNumberCounter().msg() + } + + if value == PatternFlowIcmpEchoSequenceNumberChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIcmpEchoSequenceNumberCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpEchoSequenceNumber) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpEchoSequenceNumber) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIcmpEchoSequenceNumber object +func (obj *patternFlowIcmpEchoSequenceNumber) SetValue(value uint32) PatternFlowIcmpEchoSequenceNumber { + obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIcmpEchoSequenceNumber) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIcmpEchoSequenceNumber object +func (obj *patternFlowIcmpEchoSequenceNumber) SetValues(value []uint32) PatternFlowIcmpEchoSequenceNumber { + obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIcmpEchoSequenceNumberCounter +func (obj *patternFlowIcmpEchoSequenceNumber) Increment() PatternFlowIcmpEchoSequenceNumberCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIcmpEchoSequenceNumberCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIcmpEchoSequenceNumberCounter +func (obj *patternFlowIcmpEchoSequenceNumber) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIcmpEchoSequenceNumberCounter value in the PatternFlowIcmpEchoSequenceNumber object +func (obj *patternFlowIcmpEchoSequenceNumber) SetIncrement(value PatternFlowIcmpEchoSequenceNumberCounter) PatternFlowIcmpEchoSequenceNumber { + obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIcmpEchoSequenceNumberCounter +func (obj *patternFlowIcmpEchoSequenceNumber) Decrement() PatternFlowIcmpEchoSequenceNumberCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIcmpEchoSequenceNumberCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIcmpEchoSequenceNumberCounter +func (obj *patternFlowIcmpEchoSequenceNumber) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIcmpEchoSequenceNumberCounter value in the PatternFlowIcmpEchoSequenceNumber object +func (obj *patternFlowIcmpEchoSequenceNumber) SetDecrement(value PatternFlowIcmpEchoSequenceNumberCounter) PatternFlowIcmpEchoSequenceNumber { + obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIcmpEchoSequenceNumberMetricTag +func (obj *patternFlowIcmpEchoSequenceNumber) MetricTags() PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIcmpEchoSequenceNumberMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter struct { + obj *patternFlowIcmpEchoSequenceNumber + patternFlowIcmpEchoSequenceNumberMetricTagSlice []PatternFlowIcmpEchoSequenceNumberMetricTag + fieldPtr *[]*otg.PatternFlowIcmpEchoSequenceNumberMetricTag +} + +func newPatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter(ptr *[]*otg.PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { + return &patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter interface { + setMsg(*patternFlowIcmpEchoSequenceNumber) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter + Items() []PatternFlowIcmpEchoSequenceNumberMetricTag + Add() PatternFlowIcmpEchoSequenceNumberMetricTag + Append(items ...PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter + Set(index int, newObj PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter + Clear() PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter + clearHolderSlice() PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter + appendHolderSlice(item PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter +} + +func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) setMsg(msg *patternFlowIcmpEchoSequenceNumber) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIcmpEchoSequenceNumberMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) Items() []PatternFlowIcmpEchoSequenceNumberMetricTag { + return obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice +} + +func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) Add() PatternFlowIcmpEchoSequenceNumberMetricTag { + newObj := &otg.PatternFlowIcmpEchoSequenceNumberMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIcmpEchoSequenceNumberMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice = append(obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) Append(items ...PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice = append(obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) Set(index int, newObj PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) Clear() PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIcmpEchoSequenceNumberMetricTag{} + obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice = []PatternFlowIcmpEchoSequenceNumberMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) clearHolderSlice() PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { + if len(obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice) > 0 { + obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice = []PatternFlowIcmpEchoSequenceNumberMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter) appendHolderSlice(item PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberPatternFlowIcmpEchoSequenceNumberMetricTagIter { + obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice = append(obj.patternFlowIcmpEchoSequenceNumberMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIcmpEchoSequenceNumber) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoSequenceNumber.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIcmpEchoSequenceNumber.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIcmpEchoSequenceNumberMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIcmpEchoSequenceNumber) setDefault() { + var choices_set int = 0 + var choice PatternFlowIcmpEchoSequenceNumberChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIcmpEchoSequenceNumberChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIcmpEchoSequenceNumberChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIcmpEchoSequenceNumberChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIcmpEchoSequenceNumberChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIcmpEchoSequenceNumberChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpEchoSequenceNumber") + } + } else { + intVal := otg.PatternFlowIcmpEchoSequenceNumber_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIcmpEchoSequenceNumber_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_icmp_echo_sequence_number_counter.go b/gosnappi/pattern_flow_icmp_echo_sequence_number_counter.go new file mode 100644 index 00000000..002ba3b6 --- /dev/null +++ b/gosnappi/pattern_flow_icmp_echo_sequence_number_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIcmpEchoSequenceNumberCounter ***** +type patternFlowIcmpEchoSequenceNumberCounter struct { + validation + obj *otg.PatternFlowIcmpEchoSequenceNumberCounter + marshaller marshalPatternFlowIcmpEchoSequenceNumberCounter + unMarshaller unMarshalPatternFlowIcmpEchoSequenceNumberCounter +} + +func NewPatternFlowIcmpEchoSequenceNumberCounter() PatternFlowIcmpEchoSequenceNumberCounter { + obj := patternFlowIcmpEchoSequenceNumberCounter{obj: &otg.PatternFlowIcmpEchoSequenceNumberCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpEchoSequenceNumberCounter) msg() *otg.PatternFlowIcmpEchoSequenceNumberCounter { + return obj.obj +} + +func (obj *patternFlowIcmpEchoSequenceNumberCounter) setMsg(msg *otg.PatternFlowIcmpEchoSequenceNumberCounter) PatternFlowIcmpEchoSequenceNumberCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpEchoSequenceNumberCounter struct { + obj *patternFlowIcmpEchoSequenceNumberCounter +} + +type marshalPatternFlowIcmpEchoSequenceNumberCounter interface { + // ToProto marshals PatternFlowIcmpEchoSequenceNumberCounter to protobuf object *otg.PatternFlowIcmpEchoSequenceNumberCounter + ToProto() (*otg.PatternFlowIcmpEchoSequenceNumberCounter, error) + // ToPbText marshals PatternFlowIcmpEchoSequenceNumberCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpEchoSequenceNumberCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpEchoSequenceNumberCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpEchoSequenceNumberCounter struct { + obj *patternFlowIcmpEchoSequenceNumberCounter +} + +type unMarshalPatternFlowIcmpEchoSequenceNumberCounter interface { + // FromProto unmarshals PatternFlowIcmpEchoSequenceNumberCounter from protobuf object *otg.PatternFlowIcmpEchoSequenceNumberCounter + FromProto(msg *otg.PatternFlowIcmpEchoSequenceNumberCounter) (PatternFlowIcmpEchoSequenceNumberCounter, error) + // FromPbText unmarshals PatternFlowIcmpEchoSequenceNumberCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpEchoSequenceNumberCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpEchoSequenceNumberCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpEchoSequenceNumberCounter) Marshal() marshalPatternFlowIcmpEchoSequenceNumberCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpEchoSequenceNumberCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpEchoSequenceNumberCounter) Unmarshal() unMarshalPatternFlowIcmpEchoSequenceNumberCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpEchoSequenceNumberCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpEchoSequenceNumberCounter) ToProto() (*otg.PatternFlowIcmpEchoSequenceNumberCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpEchoSequenceNumberCounter) FromProto(msg *otg.PatternFlowIcmpEchoSequenceNumberCounter) (PatternFlowIcmpEchoSequenceNumberCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpEchoSequenceNumberCounter) 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 *unMarshalpatternFlowIcmpEchoSequenceNumberCounter) 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 *marshalpatternFlowIcmpEchoSequenceNumberCounter) 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 *unMarshalpatternFlowIcmpEchoSequenceNumberCounter) 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 *marshalpatternFlowIcmpEchoSequenceNumberCounter) 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 *unMarshalpatternFlowIcmpEchoSequenceNumberCounter) 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 *patternFlowIcmpEchoSequenceNumberCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoSequenceNumberCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoSequenceNumberCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpEchoSequenceNumberCounter) Clone() (PatternFlowIcmpEchoSequenceNumberCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpEchoSequenceNumberCounter() + 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 +} + +// PatternFlowIcmpEchoSequenceNumberCounter is integer counter pattern +type PatternFlowIcmpEchoSequenceNumberCounter interface { + Validation + // msg marshals PatternFlowIcmpEchoSequenceNumberCounter to protobuf object *otg.PatternFlowIcmpEchoSequenceNumberCounter + // and doesn't set defaults + msg() *otg.PatternFlowIcmpEchoSequenceNumberCounter + // setMsg unmarshals PatternFlowIcmpEchoSequenceNumberCounter from protobuf object *otg.PatternFlowIcmpEchoSequenceNumberCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpEchoSequenceNumberCounter) PatternFlowIcmpEchoSequenceNumberCounter + // provides marshal interface + Marshal() marshalPatternFlowIcmpEchoSequenceNumberCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpEchoSequenceNumberCounter + // validate validates PatternFlowIcmpEchoSequenceNumberCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpEchoSequenceNumberCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIcmpEchoSequenceNumberCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIcmpEchoSequenceNumberCounter + SetStart(value uint32) PatternFlowIcmpEchoSequenceNumberCounter + // HasStart checks if Start has been set in PatternFlowIcmpEchoSequenceNumberCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIcmpEchoSequenceNumberCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIcmpEchoSequenceNumberCounter + SetStep(value uint32) PatternFlowIcmpEchoSequenceNumberCounter + // HasStep checks if Step has been set in PatternFlowIcmpEchoSequenceNumberCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIcmpEchoSequenceNumberCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIcmpEchoSequenceNumberCounter + SetCount(value uint32) PatternFlowIcmpEchoSequenceNumberCounter + // HasCount checks if Count has been set in PatternFlowIcmpEchoSequenceNumberCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpEchoSequenceNumberCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpEchoSequenceNumberCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIcmpEchoSequenceNumberCounter object +func (obj *patternFlowIcmpEchoSequenceNumberCounter) SetStart(value uint32) PatternFlowIcmpEchoSequenceNumberCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpEchoSequenceNumberCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpEchoSequenceNumberCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIcmpEchoSequenceNumberCounter object +func (obj *patternFlowIcmpEchoSequenceNumberCounter) SetStep(value uint32) PatternFlowIcmpEchoSequenceNumberCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpEchoSequenceNumberCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpEchoSequenceNumberCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIcmpEchoSequenceNumberCounter object +func (obj *patternFlowIcmpEchoSequenceNumberCounter) SetCount(value uint32) PatternFlowIcmpEchoSequenceNumberCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIcmpEchoSequenceNumberCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoSequenceNumberCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoSequenceNumberCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoSequenceNumberCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIcmpEchoSequenceNumberCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_icmp_echo_sequence_number_metric_tag.go b/gosnappi/pattern_flow_icmp_echo_sequence_number_metric_tag.go new file mode 100644 index 00000000..27a81b29 --- /dev/null +++ b/gosnappi/pattern_flow_icmp_echo_sequence_number_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIcmpEchoSequenceNumberMetricTag ***** +type patternFlowIcmpEchoSequenceNumberMetricTag struct { + validation + obj *otg.PatternFlowIcmpEchoSequenceNumberMetricTag + marshaller marshalPatternFlowIcmpEchoSequenceNumberMetricTag + unMarshaller unMarshalPatternFlowIcmpEchoSequenceNumberMetricTag +} + +func NewPatternFlowIcmpEchoSequenceNumberMetricTag() PatternFlowIcmpEchoSequenceNumberMetricTag { + obj := patternFlowIcmpEchoSequenceNumberMetricTag{obj: &otg.PatternFlowIcmpEchoSequenceNumberMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) msg() *otg.PatternFlowIcmpEchoSequenceNumberMetricTag { + return obj.obj +} + +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) setMsg(msg *otg.PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpEchoSequenceNumberMetricTag struct { + obj *patternFlowIcmpEchoSequenceNumberMetricTag +} + +type marshalPatternFlowIcmpEchoSequenceNumberMetricTag interface { + // ToProto marshals PatternFlowIcmpEchoSequenceNumberMetricTag to protobuf object *otg.PatternFlowIcmpEchoSequenceNumberMetricTag + ToProto() (*otg.PatternFlowIcmpEchoSequenceNumberMetricTag, error) + // ToPbText marshals PatternFlowIcmpEchoSequenceNumberMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpEchoSequenceNumberMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpEchoSequenceNumberMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpEchoSequenceNumberMetricTag struct { + obj *patternFlowIcmpEchoSequenceNumberMetricTag +} + +type unMarshalPatternFlowIcmpEchoSequenceNumberMetricTag interface { + // FromProto unmarshals PatternFlowIcmpEchoSequenceNumberMetricTag from protobuf object *otg.PatternFlowIcmpEchoSequenceNumberMetricTag + FromProto(msg *otg.PatternFlowIcmpEchoSequenceNumberMetricTag) (PatternFlowIcmpEchoSequenceNumberMetricTag, error) + // FromPbText unmarshals PatternFlowIcmpEchoSequenceNumberMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpEchoSequenceNumberMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpEchoSequenceNumberMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) Marshal() marshalPatternFlowIcmpEchoSequenceNumberMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpEchoSequenceNumberMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) Unmarshal() unMarshalPatternFlowIcmpEchoSequenceNumberMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpEchoSequenceNumberMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpEchoSequenceNumberMetricTag) ToProto() (*otg.PatternFlowIcmpEchoSequenceNumberMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpEchoSequenceNumberMetricTag) FromProto(msg *otg.PatternFlowIcmpEchoSequenceNumberMetricTag) (PatternFlowIcmpEchoSequenceNumberMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpEchoSequenceNumberMetricTag) 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 *unMarshalpatternFlowIcmpEchoSequenceNumberMetricTag) 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 *marshalpatternFlowIcmpEchoSequenceNumberMetricTag) 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 *unMarshalpatternFlowIcmpEchoSequenceNumberMetricTag) 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 *marshalpatternFlowIcmpEchoSequenceNumberMetricTag) 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 *unMarshalpatternFlowIcmpEchoSequenceNumberMetricTag) 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 *patternFlowIcmpEchoSequenceNumberMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) Clone() (PatternFlowIcmpEchoSequenceNumberMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpEchoSequenceNumberMetricTag() + 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 +} + +// PatternFlowIcmpEchoSequenceNumberMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIcmpEchoSequenceNumberMetricTag interface { + Validation + // msg marshals PatternFlowIcmpEchoSequenceNumberMetricTag to protobuf object *otg.PatternFlowIcmpEchoSequenceNumberMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIcmpEchoSequenceNumberMetricTag + // setMsg unmarshals PatternFlowIcmpEchoSequenceNumberMetricTag from protobuf object *otg.PatternFlowIcmpEchoSequenceNumberMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpEchoSequenceNumberMetricTag) PatternFlowIcmpEchoSequenceNumberMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIcmpEchoSequenceNumberMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpEchoSequenceNumberMetricTag + // validate validates PatternFlowIcmpEchoSequenceNumberMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpEchoSequenceNumberMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIcmpEchoSequenceNumberMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIcmpEchoSequenceNumberMetricTag + SetName(value string) PatternFlowIcmpEchoSequenceNumberMetricTag + // Offset returns uint32, set in PatternFlowIcmpEchoSequenceNumberMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIcmpEchoSequenceNumberMetricTag + SetOffset(value uint32) PatternFlowIcmpEchoSequenceNumberMetricTag + // HasOffset checks if Offset has been set in PatternFlowIcmpEchoSequenceNumberMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIcmpEchoSequenceNumberMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIcmpEchoSequenceNumberMetricTag + SetLength(value uint32) PatternFlowIcmpEchoSequenceNumberMetricTag + // HasLength checks if Length has been set in PatternFlowIcmpEchoSequenceNumberMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIcmpEchoSequenceNumberMetricTag object +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) SetName(value string) PatternFlowIcmpEchoSequenceNumberMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIcmpEchoSequenceNumberMetricTag object +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) SetOffset(value uint32) PatternFlowIcmpEchoSequenceNumberMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIcmpEchoSequenceNumberMetricTag object +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) SetLength(value uint32) PatternFlowIcmpEchoSequenceNumberMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpEchoSequenceNumberMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoSequenceNumberMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIcmpEchoSequenceNumberMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIcmpEchoSequenceNumberMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_icmp_echo_type.go b/gosnappi/pattern_flow_icmp_echo_type.go new file mode 100644 index 00000000..a99fa413 --- /dev/null +++ b/gosnappi/pattern_flow_icmp_echo_type.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIcmpEchoType ***** +type patternFlowIcmpEchoType struct { + validation + obj *otg.PatternFlowIcmpEchoType + marshaller marshalPatternFlowIcmpEchoType + unMarshaller unMarshalPatternFlowIcmpEchoType + incrementHolder PatternFlowIcmpEchoTypeCounter + decrementHolder PatternFlowIcmpEchoTypeCounter + metricTagsHolder PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter +} + +func NewPatternFlowIcmpEchoType() PatternFlowIcmpEchoType { + obj := patternFlowIcmpEchoType{obj: &otg.PatternFlowIcmpEchoType{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpEchoType) msg() *otg.PatternFlowIcmpEchoType { + return obj.obj +} + +func (obj *patternFlowIcmpEchoType) setMsg(msg *otg.PatternFlowIcmpEchoType) PatternFlowIcmpEchoType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpEchoType struct { + obj *patternFlowIcmpEchoType +} + +type marshalPatternFlowIcmpEchoType interface { + // ToProto marshals PatternFlowIcmpEchoType to protobuf object *otg.PatternFlowIcmpEchoType + ToProto() (*otg.PatternFlowIcmpEchoType, error) + // ToPbText marshals PatternFlowIcmpEchoType to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpEchoType to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpEchoType to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpEchoType struct { + obj *patternFlowIcmpEchoType +} + +type unMarshalPatternFlowIcmpEchoType interface { + // FromProto unmarshals PatternFlowIcmpEchoType from protobuf object *otg.PatternFlowIcmpEchoType + FromProto(msg *otg.PatternFlowIcmpEchoType) (PatternFlowIcmpEchoType, error) + // FromPbText unmarshals PatternFlowIcmpEchoType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpEchoType from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpEchoType from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpEchoType) Marshal() marshalPatternFlowIcmpEchoType { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpEchoType{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpEchoType) Unmarshal() unMarshalPatternFlowIcmpEchoType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpEchoType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpEchoType) ToProto() (*otg.PatternFlowIcmpEchoType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpEchoType) FromProto(msg *otg.PatternFlowIcmpEchoType) (PatternFlowIcmpEchoType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpEchoType) 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 *unMarshalpatternFlowIcmpEchoType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIcmpEchoType) 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 *unMarshalpatternFlowIcmpEchoType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIcmpEchoType) 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 *unMarshalpatternFlowIcmpEchoType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIcmpEchoType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpEchoType) Clone() (PatternFlowIcmpEchoType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpEchoType() + 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 +} + +func (obj *patternFlowIcmpEchoType) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIcmpEchoType is the type of ICMP echo packet +type PatternFlowIcmpEchoType interface { + Validation + // msg marshals PatternFlowIcmpEchoType to protobuf object *otg.PatternFlowIcmpEchoType + // and doesn't set defaults + msg() *otg.PatternFlowIcmpEchoType + // setMsg unmarshals PatternFlowIcmpEchoType from protobuf object *otg.PatternFlowIcmpEchoType + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpEchoType) PatternFlowIcmpEchoType + // provides marshal interface + Marshal() marshalPatternFlowIcmpEchoType + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpEchoType + // validate validates PatternFlowIcmpEchoType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpEchoType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIcmpEchoTypeChoiceEnum, set in PatternFlowIcmpEchoType + Choice() PatternFlowIcmpEchoTypeChoiceEnum + // setChoice assigns PatternFlowIcmpEchoTypeChoiceEnum provided by user to PatternFlowIcmpEchoType + setChoice(value PatternFlowIcmpEchoTypeChoiceEnum) PatternFlowIcmpEchoType + // HasChoice checks if Choice has been set in PatternFlowIcmpEchoType + HasChoice() bool + // Value returns uint32, set in PatternFlowIcmpEchoType. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIcmpEchoType + SetValue(value uint32) PatternFlowIcmpEchoType + // HasValue checks if Value has been set in PatternFlowIcmpEchoType + HasValue() bool + // Values returns []uint32, set in PatternFlowIcmpEchoType. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIcmpEchoType + SetValues(value []uint32) PatternFlowIcmpEchoType + // Increment returns PatternFlowIcmpEchoTypeCounter, set in PatternFlowIcmpEchoType. + // PatternFlowIcmpEchoTypeCounter is integer counter pattern + Increment() PatternFlowIcmpEchoTypeCounter + // SetIncrement assigns PatternFlowIcmpEchoTypeCounter provided by user to PatternFlowIcmpEchoType. + // PatternFlowIcmpEchoTypeCounter is integer counter pattern + SetIncrement(value PatternFlowIcmpEchoTypeCounter) PatternFlowIcmpEchoType + // HasIncrement checks if Increment has been set in PatternFlowIcmpEchoType + HasIncrement() bool + // Decrement returns PatternFlowIcmpEchoTypeCounter, set in PatternFlowIcmpEchoType. + // PatternFlowIcmpEchoTypeCounter is integer counter pattern + Decrement() PatternFlowIcmpEchoTypeCounter + // SetDecrement assigns PatternFlowIcmpEchoTypeCounter provided by user to PatternFlowIcmpEchoType. + // PatternFlowIcmpEchoTypeCounter is integer counter pattern + SetDecrement(value PatternFlowIcmpEchoTypeCounter) PatternFlowIcmpEchoType + // HasDecrement checks if Decrement has been set in PatternFlowIcmpEchoType + HasDecrement() bool + // MetricTags returns PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIterIter, set in PatternFlowIcmpEchoType + MetricTags() PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter + setNil() +} + +type PatternFlowIcmpEchoTypeChoiceEnum string + +// Enum of Choice on PatternFlowIcmpEchoType +var PatternFlowIcmpEchoTypeChoice = struct { + VALUE PatternFlowIcmpEchoTypeChoiceEnum + VALUES PatternFlowIcmpEchoTypeChoiceEnum + INCREMENT PatternFlowIcmpEchoTypeChoiceEnum + DECREMENT PatternFlowIcmpEchoTypeChoiceEnum +}{ + VALUE: PatternFlowIcmpEchoTypeChoiceEnum("value"), + VALUES: PatternFlowIcmpEchoTypeChoiceEnum("values"), + INCREMENT: PatternFlowIcmpEchoTypeChoiceEnum("increment"), + DECREMENT: PatternFlowIcmpEchoTypeChoiceEnum("decrement"), +} + +func (obj *patternFlowIcmpEchoType) Choice() PatternFlowIcmpEchoTypeChoiceEnum { + return PatternFlowIcmpEchoTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIcmpEchoType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIcmpEchoType) setChoice(value PatternFlowIcmpEchoTypeChoiceEnum) PatternFlowIcmpEchoType { + intValue, ok := otg.PatternFlowIcmpEchoType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIcmpEchoTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIcmpEchoType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIcmpEchoTypeChoice.VALUE { + defaultValue := uint32(8) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIcmpEchoTypeChoice.VALUES { + defaultValue := []uint32{8} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIcmpEchoTypeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIcmpEchoTypeCounter().msg() + } + + if value == PatternFlowIcmpEchoTypeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIcmpEchoTypeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpEchoType) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIcmpEchoTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpEchoType) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIcmpEchoType object +func (obj *patternFlowIcmpEchoType) SetValue(value uint32) PatternFlowIcmpEchoType { + obj.setChoice(PatternFlowIcmpEchoTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIcmpEchoType) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{8}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIcmpEchoType object +func (obj *patternFlowIcmpEchoType) SetValues(value []uint32) PatternFlowIcmpEchoType { + obj.setChoice(PatternFlowIcmpEchoTypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIcmpEchoTypeCounter +func (obj *patternFlowIcmpEchoType) Increment() PatternFlowIcmpEchoTypeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIcmpEchoTypeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIcmpEchoTypeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIcmpEchoTypeCounter +func (obj *patternFlowIcmpEchoType) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIcmpEchoTypeCounter value in the PatternFlowIcmpEchoType object +func (obj *patternFlowIcmpEchoType) SetIncrement(value PatternFlowIcmpEchoTypeCounter) PatternFlowIcmpEchoType { + obj.setChoice(PatternFlowIcmpEchoTypeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIcmpEchoTypeCounter +func (obj *patternFlowIcmpEchoType) Decrement() PatternFlowIcmpEchoTypeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIcmpEchoTypeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIcmpEchoTypeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIcmpEchoTypeCounter +func (obj *patternFlowIcmpEchoType) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIcmpEchoTypeCounter value in the PatternFlowIcmpEchoType object +func (obj *patternFlowIcmpEchoType) SetDecrement(value PatternFlowIcmpEchoTypeCounter) PatternFlowIcmpEchoType { + obj.setChoice(PatternFlowIcmpEchoTypeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIcmpEchoTypeMetricTag +func (obj *patternFlowIcmpEchoType) MetricTags() PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIcmpEchoTypeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter struct { + obj *patternFlowIcmpEchoType + patternFlowIcmpEchoTypeMetricTagSlice []PatternFlowIcmpEchoTypeMetricTag + fieldPtr *[]*otg.PatternFlowIcmpEchoTypeMetricTag +} + +func newPatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter(ptr *[]*otg.PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { + return &patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter interface { + setMsg(*patternFlowIcmpEchoType) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter + Items() []PatternFlowIcmpEchoTypeMetricTag + Add() PatternFlowIcmpEchoTypeMetricTag + Append(items ...PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter + Set(index int, newObj PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter + Clear() PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter + clearHolderSlice() PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter + appendHolderSlice(item PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter +} + +func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) setMsg(msg *patternFlowIcmpEchoType) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIcmpEchoTypeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) Items() []PatternFlowIcmpEchoTypeMetricTag { + return obj.patternFlowIcmpEchoTypeMetricTagSlice +} + +func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) Add() PatternFlowIcmpEchoTypeMetricTag { + newObj := &otg.PatternFlowIcmpEchoTypeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIcmpEchoTypeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIcmpEchoTypeMetricTagSlice = append(obj.patternFlowIcmpEchoTypeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) Append(items ...PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIcmpEchoTypeMetricTagSlice = append(obj.patternFlowIcmpEchoTypeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) Set(index int, newObj PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIcmpEchoTypeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) Clear() PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIcmpEchoTypeMetricTag{} + obj.patternFlowIcmpEchoTypeMetricTagSlice = []PatternFlowIcmpEchoTypeMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) clearHolderSlice() PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { + if len(obj.patternFlowIcmpEchoTypeMetricTagSlice) > 0 { + obj.patternFlowIcmpEchoTypeMetricTagSlice = []PatternFlowIcmpEchoTypeMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter) appendHolderSlice(item PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypePatternFlowIcmpEchoTypeMetricTagIter { + obj.patternFlowIcmpEchoTypeMetricTagSlice = append(obj.patternFlowIcmpEchoTypeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIcmpEchoType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoType.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIcmpEchoType.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIcmpEchoTypeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIcmpEchoType) setDefault() { + var choices_set int = 0 + var choice PatternFlowIcmpEchoTypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIcmpEchoTypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIcmpEchoTypeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIcmpEchoTypeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIcmpEchoTypeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIcmpEchoTypeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpEchoType") + } + } else { + intVal := otg.PatternFlowIcmpEchoType_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIcmpEchoType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_icmp_echo_type_counter.go b/gosnappi/pattern_flow_icmp_echo_type_counter.go new file mode 100644 index 00000000..739ccdee --- /dev/null +++ b/gosnappi/pattern_flow_icmp_echo_type_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIcmpEchoTypeCounter ***** +type patternFlowIcmpEchoTypeCounter struct { + validation + obj *otg.PatternFlowIcmpEchoTypeCounter + marshaller marshalPatternFlowIcmpEchoTypeCounter + unMarshaller unMarshalPatternFlowIcmpEchoTypeCounter +} + +func NewPatternFlowIcmpEchoTypeCounter() PatternFlowIcmpEchoTypeCounter { + obj := patternFlowIcmpEchoTypeCounter{obj: &otg.PatternFlowIcmpEchoTypeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpEchoTypeCounter) msg() *otg.PatternFlowIcmpEchoTypeCounter { + return obj.obj +} + +func (obj *patternFlowIcmpEchoTypeCounter) setMsg(msg *otg.PatternFlowIcmpEchoTypeCounter) PatternFlowIcmpEchoTypeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpEchoTypeCounter struct { + obj *patternFlowIcmpEchoTypeCounter +} + +type marshalPatternFlowIcmpEchoTypeCounter interface { + // ToProto marshals PatternFlowIcmpEchoTypeCounter to protobuf object *otg.PatternFlowIcmpEchoTypeCounter + ToProto() (*otg.PatternFlowIcmpEchoTypeCounter, error) + // ToPbText marshals PatternFlowIcmpEchoTypeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpEchoTypeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpEchoTypeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpEchoTypeCounter struct { + obj *patternFlowIcmpEchoTypeCounter +} + +type unMarshalPatternFlowIcmpEchoTypeCounter interface { + // FromProto unmarshals PatternFlowIcmpEchoTypeCounter from protobuf object *otg.PatternFlowIcmpEchoTypeCounter + FromProto(msg *otg.PatternFlowIcmpEchoTypeCounter) (PatternFlowIcmpEchoTypeCounter, error) + // FromPbText unmarshals PatternFlowIcmpEchoTypeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpEchoTypeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpEchoTypeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpEchoTypeCounter) Marshal() marshalPatternFlowIcmpEchoTypeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpEchoTypeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpEchoTypeCounter) Unmarshal() unMarshalPatternFlowIcmpEchoTypeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpEchoTypeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpEchoTypeCounter) ToProto() (*otg.PatternFlowIcmpEchoTypeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpEchoTypeCounter) FromProto(msg *otg.PatternFlowIcmpEchoTypeCounter) (PatternFlowIcmpEchoTypeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpEchoTypeCounter) 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 *unMarshalpatternFlowIcmpEchoTypeCounter) 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 *marshalpatternFlowIcmpEchoTypeCounter) 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 *unMarshalpatternFlowIcmpEchoTypeCounter) 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 *marshalpatternFlowIcmpEchoTypeCounter) 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 *unMarshalpatternFlowIcmpEchoTypeCounter) 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 *patternFlowIcmpEchoTypeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoTypeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoTypeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpEchoTypeCounter) Clone() (PatternFlowIcmpEchoTypeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpEchoTypeCounter() + 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 +} + +// PatternFlowIcmpEchoTypeCounter is integer counter pattern +type PatternFlowIcmpEchoTypeCounter interface { + Validation + // msg marshals PatternFlowIcmpEchoTypeCounter to protobuf object *otg.PatternFlowIcmpEchoTypeCounter + // and doesn't set defaults + msg() *otg.PatternFlowIcmpEchoTypeCounter + // setMsg unmarshals PatternFlowIcmpEchoTypeCounter from protobuf object *otg.PatternFlowIcmpEchoTypeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpEchoTypeCounter) PatternFlowIcmpEchoTypeCounter + // provides marshal interface + Marshal() marshalPatternFlowIcmpEchoTypeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpEchoTypeCounter + // validate validates PatternFlowIcmpEchoTypeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpEchoTypeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIcmpEchoTypeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIcmpEchoTypeCounter + SetStart(value uint32) PatternFlowIcmpEchoTypeCounter + // HasStart checks if Start has been set in PatternFlowIcmpEchoTypeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIcmpEchoTypeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIcmpEchoTypeCounter + SetStep(value uint32) PatternFlowIcmpEchoTypeCounter + // HasStep checks if Step has been set in PatternFlowIcmpEchoTypeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIcmpEchoTypeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIcmpEchoTypeCounter + SetCount(value uint32) PatternFlowIcmpEchoTypeCounter + // HasCount checks if Count has been set in PatternFlowIcmpEchoTypeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpEchoTypeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpEchoTypeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIcmpEchoTypeCounter object +func (obj *patternFlowIcmpEchoTypeCounter) SetStart(value uint32) PatternFlowIcmpEchoTypeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpEchoTypeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpEchoTypeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIcmpEchoTypeCounter object +func (obj *patternFlowIcmpEchoTypeCounter) SetStep(value uint32) PatternFlowIcmpEchoTypeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpEchoTypeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpEchoTypeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIcmpEchoTypeCounter object +func (obj *patternFlowIcmpEchoTypeCounter) SetCount(value uint32) PatternFlowIcmpEchoTypeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIcmpEchoTypeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoTypeCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoTypeCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoTypeCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIcmpEchoTypeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(8) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_icmp_echo_type_metric_tag.go b/gosnappi/pattern_flow_icmp_echo_type_metric_tag.go new file mode 100644 index 00000000..75b4d885 --- /dev/null +++ b/gosnappi/pattern_flow_icmp_echo_type_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIcmpEchoTypeMetricTag ***** +type patternFlowIcmpEchoTypeMetricTag struct { + validation + obj *otg.PatternFlowIcmpEchoTypeMetricTag + marshaller marshalPatternFlowIcmpEchoTypeMetricTag + unMarshaller unMarshalPatternFlowIcmpEchoTypeMetricTag +} + +func NewPatternFlowIcmpEchoTypeMetricTag() PatternFlowIcmpEchoTypeMetricTag { + obj := patternFlowIcmpEchoTypeMetricTag{obj: &otg.PatternFlowIcmpEchoTypeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpEchoTypeMetricTag) msg() *otg.PatternFlowIcmpEchoTypeMetricTag { + return obj.obj +} + +func (obj *patternFlowIcmpEchoTypeMetricTag) setMsg(msg *otg.PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpEchoTypeMetricTag struct { + obj *patternFlowIcmpEchoTypeMetricTag +} + +type marshalPatternFlowIcmpEchoTypeMetricTag interface { + // ToProto marshals PatternFlowIcmpEchoTypeMetricTag to protobuf object *otg.PatternFlowIcmpEchoTypeMetricTag + ToProto() (*otg.PatternFlowIcmpEchoTypeMetricTag, error) + // ToPbText marshals PatternFlowIcmpEchoTypeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpEchoTypeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpEchoTypeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpEchoTypeMetricTag struct { + obj *patternFlowIcmpEchoTypeMetricTag +} + +type unMarshalPatternFlowIcmpEchoTypeMetricTag interface { + // FromProto unmarshals PatternFlowIcmpEchoTypeMetricTag from protobuf object *otg.PatternFlowIcmpEchoTypeMetricTag + FromProto(msg *otg.PatternFlowIcmpEchoTypeMetricTag) (PatternFlowIcmpEchoTypeMetricTag, error) + // FromPbText unmarshals PatternFlowIcmpEchoTypeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpEchoTypeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpEchoTypeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpEchoTypeMetricTag) Marshal() marshalPatternFlowIcmpEchoTypeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpEchoTypeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpEchoTypeMetricTag) Unmarshal() unMarshalPatternFlowIcmpEchoTypeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpEchoTypeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpEchoTypeMetricTag) ToProto() (*otg.PatternFlowIcmpEchoTypeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpEchoTypeMetricTag) FromProto(msg *otg.PatternFlowIcmpEchoTypeMetricTag) (PatternFlowIcmpEchoTypeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpEchoTypeMetricTag) 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 *unMarshalpatternFlowIcmpEchoTypeMetricTag) 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 *marshalpatternFlowIcmpEchoTypeMetricTag) 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 *unMarshalpatternFlowIcmpEchoTypeMetricTag) 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 *marshalpatternFlowIcmpEchoTypeMetricTag) 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 *unMarshalpatternFlowIcmpEchoTypeMetricTag) 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 *patternFlowIcmpEchoTypeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoTypeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpEchoTypeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpEchoTypeMetricTag) Clone() (PatternFlowIcmpEchoTypeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpEchoTypeMetricTag() + 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 +} + +// PatternFlowIcmpEchoTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIcmpEchoTypeMetricTag interface { + Validation + // msg marshals PatternFlowIcmpEchoTypeMetricTag to protobuf object *otg.PatternFlowIcmpEchoTypeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIcmpEchoTypeMetricTag + // setMsg unmarshals PatternFlowIcmpEchoTypeMetricTag from protobuf object *otg.PatternFlowIcmpEchoTypeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpEchoTypeMetricTag) PatternFlowIcmpEchoTypeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIcmpEchoTypeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpEchoTypeMetricTag + // validate validates PatternFlowIcmpEchoTypeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpEchoTypeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIcmpEchoTypeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIcmpEchoTypeMetricTag + SetName(value string) PatternFlowIcmpEchoTypeMetricTag + // Offset returns uint32, set in PatternFlowIcmpEchoTypeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIcmpEchoTypeMetricTag + SetOffset(value uint32) PatternFlowIcmpEchoTypeMetricTag + // HasOffset checks if Offset has been set in PatternFlowIcmpEchoTypeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIcmpEchoTypeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIcmpEchoTypeMetricTag + SetLength(value uint32) PatternFlowIcmpEchoTypeMetricTag + // HasLength checks if Length has been set in PatternFlowIcmpEchoTypeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIcmpEchoTypeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIcmpEchoTypeMetricTag object +func (obj *patternFlowIcmpEchoTypeMetricTag) SetName(value string) PatternFlowIcmpEchoTypeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpEchoTypeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpEchoTypeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIcmpEchoTypeMetricTag object +func (obj *patternFlowIcmpEchoTypeMetricTag) SetOffset(value uint32) PatternFlowIcmpEchoTypeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpEchoTypeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpEchoTypeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIcmpEchoTypeMetricTag object +func (obj *patternFlowIcmpEchoTypeMetricTag) SetLength(value uint32) PatternFlowIcmpEchoTypeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIcmpEchoTypeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpEchoTypeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpEchoTypeMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIcmpEchoTypeMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIcmpEchoTypeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_icmpv6_echo_checksum.go b/gosnappi/pattern_flow_icmpv6_echo_checksum.go new file mode 100644 index 00000000..17918dd1 --- /dev/null +++ b/gosnappi/pattern_flow_icmpv6_echo_checksum.go @@ -0,0 +1,434 @@ +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" +) + +// ***** PatternFlowIcmpv6EchoChecksum ***** +type patternFlowIcmpv6EchoChecksum struct { + validation + obj *otg.PatternFlowIcmpv6EchoChecksum + marshaller marshalPatternFlowIcmpv6EchoChecksum + unMarshaller unMarshalPatternFlowIcmpv6EchoChecksum +} + +func NewPatternFlowIcmpv6EchoChecksum() PatternFlowIcmpv6EchoChecksum { + obj := patternFlowIcmpv6EchoChecksum{obj: &otg.PatternFlowIcmpv6EchoChecksum{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpv6EchoChecksum) msg() *otg.PatternFlowIcmpv6EchoChecksum { + return obj.obj +} + +func (obj *patternFlowIcmpv6EchoChecksum) setMsg(msg *otg.PatternFlowIcmpv6EchoChecksum) PatternFlowIcmpv6EchoChecksum { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpv6EchoChecksum struct { + obj *patternFlowIcmpv6EchoChecksum +} + +type marshalPatternFlowIcmpv6EchoChecksum interface { + // ToProto marshals PatternFlowIcmpv6EchoChecksum to protobuf object *otg.PatternFlowIcmpv6EchoChecksum + ToProto() (*otg.PatternFlowIcmpv6EchoChecksum, error) + // ToPbText marshals PatternFlowIcmpv6EchoChecksum to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpv6EchoChecksum to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpv6EchoChecksum to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpv6EchoChecksum struct { + obj *patternFlowIcmpv6EchoChecksum +} + +type unMarshalPatternFlowIcmpv6EchoChecksum interface { + // FromProto unmarshals PatternFlowIcmpv6EchoChecksum from protobuf object *otg.PatternFlowIcmpv6EchoChecksum + FromProto(msg *otg.PatternFlowIcmpv6EchoChecksum) (PatternFlowIcmpv6EchoChecksum, error) + // FromPbText unmarshals PatternFlowIcmpv6EchoChecksum from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpv6EchoChecksum from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpv6EchoChecksum from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpv6EchoChecksum) Marshal() marshalPatternFlowIcmpv6EchoChecksum { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpv6EchoChecksum{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpv6EchoChecksum) Unmarshal() unMarshalPatternFlowIcmpv6EchoChecksum { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoChecksum{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpv6EchoChecksum) ToProto() (*otg.PatternFlowIcmpv6EchoChecksum, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpv6EchoChecksum) FromProto(msg *otg.PatternFlowIcmpv6EchoChecksum) (PatternFlowIcmpv6EchoChecksum, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpv6EchoChecksum) 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 *unMarshalpatternFlowIcmpv6EchoChecksum) 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 *marshalpatternFlowIcmpv6EchoChecksum) 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 *unMarshalpatternFlowIcmpv6EchoChecksum) 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 *marshalpatternFlowIcmpv6EchoChecksum) 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 *unMarshalpatternFlowIcmpv6EchoChecksum) 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 *patternFlowIcmpv6EchoChecksum) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoChecksum) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoChecksum) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpv6EchoChecksum) Clone() (PatternFlowIcmpv6EchoChecksum, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpv6EchoChecksum() + 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 +} + +// PatternFlowIcmpv6EchoChecksum is iCMPv6 checksum +type PatternFlowIcmpv6EchoChecksum interface { + Validation + // msg marshals PatternFlowIcmpv6EchoChecksum to protobuf object *otg.PatternFlowIcmpv6EchoChecksum + // and doesn't set defaults + msg() *otg.PatternFlowIcmpv6EchoChecksum + // setMsg unmarshals PatternFlowIcmpv6EchoChecksum from protobuf object *otg.PatternFlowIcmpv6EchoChecksum + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpv6EchoChecksum) PatternFlowIcmpv6EchoChecksum + // provides marshal interface + Marshal() marshalPatternFlowIcmpv6EchoChecksum + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpv6EchoChecksum + // validate validates PatternFlowIcmpv6EchoChecksum + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpv6EchoChecksum, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIcmpv6EchoChecksumChoiceEnum, set in PatternFlowIcmpv6EchoChecksum + Choice() PatternFlowIcmpv6EchoChecksumChoiceEnum + // setChoice assigns PatternFlowIcmpv6EchoChecksumChoiceEnum provided by user to PatternFlowIcmpv6EchoChecksum + setChoice(value PatternFlowIcmpv6EchoChecksumChoiceEnum) PatternFlowIcmpv6EchoChecksum + // HasChoice checks if Choice has been set in PatternFlowIcmpv6EchoChecksum + HasChoice() bool + // Generated returns PatternFlowIcmpv6EchoChecksumGeneratedEnum, set in PatternFlowIcmpv6EchoChecksum + Generated() PatternFlowIcmpv6EchoChecksumGeneratedEnum + // SetGenerated assigns PatternFlowIcmpv6EchoChecksumGeneratedEnum provided by user to PatternFlowIcmpv6EchoChecksum + SetGenerated(value PatternFlowIcmpv6EchoChecksumGeneratedEnum) PatternFlowIcmpv6EchoChecksum + // HasGenerated checks if Generated has been set in PatternFlowIcmpv6EchoChecksum + HasGenerated() bool + // Custom returns uint32, set in PatternFlowIcmpv6EchoChecksum. + Custom() uint32 + // SetCustom assigns uint32 provided by user to PatternFlowIcmpv6EchoChecksum + SetCustom(value uint32) PatternFlowIcmpv6EchoChecksum + // HasCustom checks if Custom has been set in PatternFlowIcmpv6EchoChecksum + HasCustom() bool +} + +type PatternFlowIcmpv6EchoChecksumChoiceEnum string + +// Enum of Choice on PatternFlowIcmpv6EchoChecksum +var PatternFlowIcmpv6EchoChecksumChoice = struct { + GENERATED PatternFlowIcmpv6EchoChecksumChoiceEnum + CUSTOM PatternFlowIcmpv6EchoChecksumChoiceEnum +}{ + GENERATED: PatternFlowIcmpv6EchoChecksumChoiceEnum("generated"), + CUSTOM: PatternFlowIcmpv6EchoChecksumChoiceEnum("custom"), +} + +func (obj *patternFlowIcmpv6EchoChecksum) Choice() PatternFlowIcmpv6EchoChecksumChoiceEnum { + return PatternFlowIcmpv6EchoChecksumChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The type of checksum +// Choice returns a string +func (obj *patternFlowIcmpv6EchoChecksum) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIcmpv6EchoChecksum) setChoice(value PatternFlowIcmpv6EchoChecksumChoiceEnum) PatternFlowIcmpv6EchoChecksum { + intValue, ok := otg.PatternFlowIcmpv6EchoChecksum_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIcmpv6EchoChecksumChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIcmpv6EchoChecksum_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Custom = nil + obj.obj.Generated = otg.PatternFlowIcmpv6EchoChecksum_Generated_unspecified.Enum() + return obj +} + +type PatternFlowIcmpv6EchoChecksumGeneratedEnum string + +// Enum of Generated on PatternFlowIcmpv6EchoChecksum +var PatternFlowIcmpv6EchoChecksumGenerated = struct { + GOOD PatternFlowIcmpv6EchoChecksumGeneratedEnum + BAD PatternFlowIcmpv6EchoChecksumGeneratedEnum +}{ + GOOD: PatternFlowIcmpv6EchoChecksumGeneratedEnum("good"), + BAD: PatternFlowIcmpv6EchoChecksumGeneratedEnum("bad"), +} + +func (obj *patternFlowIcmpv6EchoChecksum) Generated() PatternFlowIcmpv6EchoChecksumGeneratedEnum { + return PatternFlowIcmpv6EchoChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) +} + +// A system generated checksum value +// Generated returns a string +func (obj *patternFlowIcmpv6EchoChecksum) HasGenerated() bool { + return obj.obj.Generated != nil +} + +func (obj *patternFlowIcmpv6EchoChecksum) SetGenerated(value PatternFlowIcmpv6EchoChecksumGeneratedEnum) PatternFlowIcmpv6EchoChecksum { + intValue, ok := otg.PatternFlowIcmpv6EchoChecksum_Generated_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIcmpv6EchoChecksumGeneratedEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIcmpv6EchoChecksum_Generated_Enum(intValue) + obj.obj.Generated = &enumValue + + return obj +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowIcmpv6EchoChecksum) Custom() uint32 { + + if obj.obj.Custom == nil { + obj.setChoice(PatternFlowIcmpv6EchoChecksumChoice.CUSTOM) + } + + return *obj.obj.Custom + +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowIcmpv6EchoChecksum) HasCustom() bool { + return obj.obj.Custom != nil +} + +// A custom checksum value +// SetCustom sets the uint32 value in the PatternFlowIcmpv6EchoChecksum object +func (obj *patternFlowIcmpv6EchoChecksum) SetCustom(value uint32) PatternFlowIcmpv6EchoChecksum { + obj.setChoice(PatternFlowIcmpv6EchoChecksumChoice.CUSTOM) + obj.obj.Custom = &value + return obj +} + +func (obj *patternFlowIcmpv6EchoChecksum) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Custom != nil { + + if *obj.obj.Custom > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoChecksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) + } + + } + +} + +func (obj *patternFlowIcmpv6EchoChecksum) setDefault() { + var choices_set int = 0 + var choice PatternFlowIcmpv6EchoChecksumChoiceEnum + + if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { + choices_set += 1 + choice = PatternFlowIcmpv6EchoChecksumChoice.GENERATED + } + + if obj.obj.Custom != nil { + choices_set += 1 + choice = PatternFlowIcmpv6EchoChecksumChoice.CUSTOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIcmpv6EchoChecksumChoice.GENERATED) + if obj.obj.Generated.Number() == 0 { + obj.SetGenerated(PatternFlowIcmpv6EchoChecksumGenerated.GOOD) + + } + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpv6EchoChecksum") + } + } else { + intVal := otg.PatternFlowIcmpv6EchoChecksum_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIcmpv6EchoChecksum_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_icmpv6_echo_code.go b/gosnappi/pattern_flow_icmpv6_echo_code.go new file mode 100644 index 00000000..958da1c8 --- /dev/null +++ b/gosnappi/pattern_flow_icmpv6_echo_code.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIcmpv6EchoCode ***** +type patternFlowIcmpv6EchoCode struct { + validation + obj *otg.PatternFlowIcmpv6EchoCode + marshaller marshalPatternFlowIcmpv6EchoCode + unMarshaller unMarshalPatternFlowIcmpv6EchoCode + incrementHolder PatternFlowIcmpv6EchoCodeCounter + decrementHolder PatternFlowIcmpv6EchoCodeCounter + metricTagsHolder PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter +} + +func NewPatternFlowIcmpv6EchoCode() PatternFlowIcmpv6EchoCode { + obj := patternFlowIcmpv6EchoCode{obj: &otg.PatternFlowIcmpv6EchoCode{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpv6EchoCode) msg() *otg.PatternFlowIcmpv6EchoCode { + return obj.obj +} + +func (obj *patternFlowIcmpv6EchoCode) setMsg(msg *otg.PatternFlowIcmpv6EchoCode) PatternFlowIcmpv6EchoCode { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpv6EchoCode struct { + obj *patternFlowIcmpv6EchoCode +} + +type marshalPatternFlowIcmpv6EchoCode interface { + // ToProto marshals PatternFlowIcmpv6EchoCode to protobuf object *otg.PatternFlowIcmpv6EchoCode + ToProto() (*otg.PatternFlowIcmpv6EchoCode, error) + // ToPbText marshals PatternFlowIcmpv6EchoCode to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpv6EchoCode to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpv6EchoCode to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpv6EchoCode struct { + obj *patternFlowIcmpv6EchoCode +} + +type unMarshalPatternFlowIcmpv6EchoCode interface { + // FromProto unmarshals PatternFlowIcmpv6EchoCode from protobuf object *otg.PatternFlowIcmpv6EchoCode + FromProto(msg *otg.PatternFlowIcmpv6EchoCode) (PatternFlowIcmpv6EchoCode, error) + // FromPbText unmarshals PatternFlowIcmpv6EchoCode from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpv6EchoCode from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpv6EchoCode from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpv6EchoCode) Marshal() marshalPatternFlowIcmpv6EchoCode { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpv6EchoCode{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpv6EchoCode) Unmarshal() unMarshalPatternFlowIcmpv6EchoCode { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoCode{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpv6EchoCode) ToProto() (*otg.PatternFlowIcmpv6EchoCode, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpv6EchoCode) FromProto(msg *otg.PatternFlowIcmpv6EchoCode) (PatternFlowIcmpv6EchoCode, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpv6EchoCode) 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 *unMarshalpatternFlowIcmpv6EchoCode) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIcmpv6EchoCode) 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 *unMarshalpatternFlowIcmpv6EchoCode) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIcmpv6EchoCode) 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 *unMarshalpatternFlowIcmpv6EchoCode) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIcmpv6EchoCode) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoCode) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoCode) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpv6EchoCode) Clone() (PatternFlowIcmpv6EchoCode, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpv6EchoCode() + 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 +} + +func (obj *patternFlowIcmpv6EchoCode) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIcmpv6EchoCode is iCMPv6 echo sub type +type PatternFlowIcmpv6EchoCode interface { + Validation + // msg marshals PatternFlowIcmpv6EchoCode to protobuf object *otg.PatternFlowIcmpv6EchoCode + // and doesn't set defaults + msg() *otg.PatternFlowIcmpv6EchoCode + // setMsg unmarshals PatternFlowIcmpv6EchoCode from protobuf object *otg.PatternFlowIcmpv6EchoCode + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpv6EchoCode) PatternFlowIcmpv6EchoCode + // provides marshal interface + Marshal() marshalPatternFlowIcmpv6EchoCode + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpv6EchoCode + // validate validates PatternFlowIcmpv6EchoCode + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpv6EchoCode, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIcmpv6EchoCodeChoiceEnum, set in PatternFlowIcmpv6EchoCode + Choice() PatternFlowIcmpv6EchoCodeChoiceEnum + // setChoice assigns PatternFlowIcmpv6EchoCodeChoiceEnum provided by user to PatternFlowIcmpv6EchoCode + setChoice(value PatternFlowIcmpv6EchoCodeChoiceEnum) PatternFlowIcmpv6EchoCode + // HasChoice checks if Choice has been set in PatternFlowIcmpv6EchoCode + HasChoice() bool + // Value returns uint32, set in PatternFlowIcmpv6EchoCode. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIcmpv6EchoCode + SetValue(value uint32) PatternFlowIcmpv6EchoCode + // HasValue checks if Value has been set in PatternFlowIcmpv6EchoCode + HasValue() bool + // Values returns []uint32, set in PatternFlowIcmpv6EchoCode. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIcmpv6EchoCode + SetValues(value []uint32) PatternFlowIcmpv6EchoCode + // Increment returns PatternFlowIcmpv6EchoCodeCounter, set in PatternFlowIcmpv6EchoCode. + // PatternFlowIcmpv6EchoCodeCounter is integer counter pattern + Increment() PatternFlowIcmpv6EchoCodeCounter + // SetIncrement assigns PatternFlowIcmpv6EchoCodeCounter provided by user to PatternFlowIcmpv6EchoCode. + // PatternFlowIcmpv6EchoCodeCounter is integer counter pattern + SetIncrement(value PatternFlowIcmpv6EchoCodeCounter) PatternFlowIcmpv6EchoCode + // HasIncrement checks if Increment has been set in PatternFlowIcmpv6EchoCode + HasIncrement() bool + // Decrement returns PatternFlowIcmpv6EchoCodeCounter, set in PatternFlowIcmpv6EchoCode. + // PatternFlowIcmpv6EchoCodeCounter is integer counter pattern + Decrement() PatternFlowIcmpv6EchoCodeCounter + // SetDecrement assigns PatternFlowIcmpv6EchoCodeCounter provided by user to PatternFlowIcmpv6EchoCode. + // PatternFlowIcmpv6EchoCodeCounter is integer counter pattern + SetDecrement(value PatternFlowIcmpv6EchoCodeCounter) PatternFlowIcmpv6EchoCode + // HasDecrement checks if Decrement has been set in PatternFlowIcmpv6EchoCode + HasDecrement() bool + // MetricTags returns PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIterIter, set in PatternFlowIcmpv6EchoCode + MetricTags() PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter + setNil() +} + +type PatternFlowIcmpv6EchoCodeChoiceEnum string + +// Enum of Choice on PatternFlowIcmpv6EchoCode +var PatternFlowIcmpv6EchoCodeChoice = struct { + VALUE PatternFlowIcmpv6EchoCodeChoiceEnum + VALUES PatternFlowIcmpv6EchoCodeChoiceEnum + INCREMENT PatternFlowIcmpv6EchoCodeChoiceEnum + DECREMENT PatternFlowIcmpv6EchoCodeChoiceEnum +}{ + VALUE: PatternFlowIcmpv6EchoCodeChoiceEnum("value"), + VALUES: PatternFlowIcmpv6EchoCodeChoiceEnum("values"), + INCREMENT: PatternFlowIcmpv6EchoCodeChoiceEnum("increment"), + DECREMENT: PatternFlowIcmpv6EchoCodeChoiceEnum("decrement"), +} + +func (obj *patternFlowIcmpv6EchoCode) Choice() PatternFlowIcmpv6EchoCodeChoiceEnum { + return PatternFlowIcmpv6EchoCodeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIcmpv6EchoCode) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIcmpv6EchoCode) setChoice(value PatternFlowIcmpv6EchoCodeChoiceEnum) PatternFlowIcmpv6EchoCode { + intValue, ok := otg.PatternFlowIcmpv6EchoCode_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIcmpv6EchoCodeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIcmpv6EchoCode_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIcmpv6EchoCodeChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIcmpv6EchoCodeChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIcmpv6EchoCodeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIcmpv6EchoCodeCounter().msg() + } + + if value == PatternFlowIcmpv6EchoCodeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIcmpv6EchoCodeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpv6EchoCode) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpv6EchoCode) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIcmpv6EchoCode object +func (obj *patternFlowIcmpv6EchoCode) SetValue(value uint32) PatternFlowIcmpv6EchoCode { + obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIcmpv6EchoCode) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIcmpv6EchoCode object +func (obj *patternFlowIcmpv6EchoCode) SetValues(value []uint32) PatternFlowIcmpv6EchoCode { + obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIcmpv6EchoCodeCounter +func (obj *patternFlowIcmpv6EchoCode) Increment() PatternFlowIcmpv6EchoCodeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIcmpv6EchoCodeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIcmpv6EchoCodeCounter +func (obj *patternFlowIcmpv6EchoCode) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIcmpv6EchoCodeCounter value in the PatternFlowIcmpv6EchoCode object +func (obj *patternFlowIcmpv6EchoCode) SetIncrement(value PatternFlowIcmpv6EchoCodeCounter) PatternFlowIcmpv6EchoCode { + obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIcmpv6EchoCodeCounter +func (obj *patternFlowIcmpv6EchoCode) Decrement() PatternFlowIcmpv6EchoCodeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIcmpv6EchoCodeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIcmpv6EchoCodeCounter +func (obj *patternFlowIcmpv6EchoCode) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIcmpv6EchoCodeCounter value in the PatternFlowIcmpv6EchoCode object +func (obj *patternFlowIcmpv6EchoCode) SetDecrement(value PatternFlowIcmpv6EchoCodeCounter) PatternFlowIcmpv6EchoCode { + obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIcmpv6EchoCodeMetricTag +func (obj *patternFlowIcmpv6EchoCode) MetricTags() PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIcmpv6EchoCodeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter struct { + obj *patternFlowIcmpv6EchoCode + patternFlowIcmpv6EchoCodeMetricTagSlice []PatternFlowIcmpv6EchoCodeMetricTag + fieldPtr *[]*otg.PatternFlowIcmpv6EchoCodeMetricTag +} + +func newPatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter(ptr *[]*otg.PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { + return &patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter interface { + setMsg(*patternFlowIcmpv6EchoCode) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter + Items() []PatternFlowIcmpv6EchoCodeMetricTag + Add() PatternFlowIcmpv6EchoCodeMetricTag + Append(items ...PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter + Set(index int, newObj PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter + Clear() PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter + clearHolderSlice() PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter + appendHolderSlice(item PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter +} + +func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) setMsg(msg *patternFlowIcmpv6EchoCode) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIcmpv6EchoCodeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) Items() []PatternFlowIcmpv6EchoCodeMetricTag { + return obj.patternFlowIcmpv6EchoCodeMetricTagSlice +} + +func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) Add() PatternFlowIcmpv6EchoCodeMetricTag { + newObj := &otg.PatternFlowIcmpv6EchoCodeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIcmpv6EchoCodeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIcmpv6EchoCodeMetricTagSlice = append(obj.patternFlowIcmpv6EchoCodeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) Append(items ...PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIcmpv6EchoCodeMetricTagSlice = append(obj.patternFlowIcmpv6EchoCodeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) Set(index int, newObj PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIcmpv6EchoCodeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) Clear() PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIcmpv6EchoCodeMetricTag{} + obj.patternFlowIcmpv6EchoCodeMetricTagSlice = []PatternFlowIcmpv6EchoCodeMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) clearHolderSlice() PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { + if len(obj.patternFlowIcmpv6EchoCodeMetricTagSlice) > 0 { + obj.patternFlowIcmpv6EchoCodeMetricTagSlice = []PatternFlowIcmpv6EchoCodeMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter) appendHolderSlice(item PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodePatternFlowIcmpv6EchoCodeMetricTagIter { + obj.patternFlowIcmpv6EchoCodeMetricTagSlice = append(obj.patternFlowIcmpv6EchoCodeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIcmpv6EchoCode) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoCode.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIcmpv6EchoCode.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIcmpv6EchoCodeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIcmpv6EchoCode) setDefault() { + var choices_set int = 0 + var choice PatternFlowIcmpv6EchoCodeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIcmpv6EchoCodeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIcmpv6EchoCodeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIcmpv6EchoCodeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIcmpv6EchoCodeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIcmpv6EchoCodeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpv6EchoCode") + } + } else { + intVal := otg.PatternFlowIcmpv6EchoCode_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIcmpv6EchoCode_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_icmpv6_echo_code_counter.go b/gosnappi/pattern_flow_icmpv6_echo_code_counter.go new file mode 100644 index 00000000..9ef3b123 --- /dev/null +++ b/gosnappi/pattern_flow_icmpv6_echo_code_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIcmpv6EchoCodeCounter ***** +type patternFlowIcmpv6EchoCodeCounter struct { + validation + obj *otg.PatternFlowIcmpv6EchoCodeCounter + marshaller marshalPatternFlowIcmpv6EchoCodeCounter + unMarshaller unMarshalPatternFlowIcmpv6EchoCodeCounter +} + +func NewPatternFlowIcmpv6EchoCodeCounter() PatternFlowIcmpv6EchoCodeCounter { + obj := patternFlowIcmpv6EchoCodeCounter{obj: &otg.PatternFlowIcmpv6EchoCodeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpv6EchoCodeCounter) msg() *otg.PatternFlowIcmpv6EchoCodeCounter { + return obj.obj +} + +func (obj *patternFlowIcmpv6EchoCodeCounter) setMsg(msg *otg.PatternFlowIcmpv6EchoCodeCounter) PatternFlowIcmpv6EchoCodeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpv6EchoCodeCounter struct { + obj *patternFlowIcmpv6EchoCodeCounter +} + +type marshalPatternFlowIcmpv6EchoCodeCounter interface { + // ToProto marshals PatternFlowIcmpv6EchoCodeCounter to protobuf object *otg.PatternFlowIcmpv6EchoCodeCounter + ToProto() (*otg.PatternFlowIcmpv6EchoCodeCounter, error) + // ToPbText marshals PatternFlowIcmpv6EchoCodeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpv6EchoCodeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpv6EchoCodeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpv6EchoCodeCounter struct { + obj *patternFlowIcmpv6EchoCodeCounter +} + +type unMarshalPatternFlowIcmpv6EchoCodeCounter interface { + // FromProto unmarshals PatternFlowIcmpv6EchoCodeCounter from protobuf object *otg.PatternFlowIcmpv6EchoCodeCounter + FromProto(msg *otg.PatternFlowIcmpv6EchoCodeCounter) (PatternFlowIcmpv6EchoCodeCounter, error) + // FromPbText unmarshals PatternFlowIcmpv6EchoCodeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpv6EchoCodeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpv6EchoCodeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpv6EchoCodeCounter) Marshal() marshalPatternFlowIcmpv6EchoCodeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpv6EchoCodeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpv6EchoCodeCounter) Unmarshal() unMarshalPatternFlowIcmpv6EchoCodeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoCodeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpv6EchoCodeCounter) ToProto() (*otg.PatternFlowIcmpv6EchoCodeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpv6EchoCodeCounter) FromProto(msg *otg.PatternFlowIcmpv6EchoCodeCounter) (PatternFlowIcmpv6EchoCodeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpv6EchoCodeCounter) 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 *unMarshalpatternFlowIcmpv6EchoCodeCounter) 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 *marshalpatternFlowIcmpv6EchoCodeCounter) 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 *unMarshalpatternFlowIcmpv6EchoCodeCounter) 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 *marshalpatternFlowIcmpv6EchoCodeCounter) 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 *unMarshalpatternFlowIcmpv6EchoCodeCounter) 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 *patternFlowIcmpv6EchoCodeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoCodeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoCodeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpv6EchoCodeCounter) Clone() (PatternFlowIcmpv6EchoCodeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpv6EchoCodeCounter() + 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 +} + +// PatternFlowIcmpv6EchoCodeCounter is integer counter pattern +type PatternFlowIcmpv6EchoCodeCounter interface { + Validation + // msg marshals PatternFlowIcmpv6EchoCodeCounter to protobuf object *otg.PatternFlowIcmpv6EchoCodeCounter + // and doesn't set defaults + msg() *otg.PatternFlowIcmpv6EchoCodeCounter + // setMsg unmarshals PatternFlowIcmpv6EchoCodeCounter from protobuf object *otg.PatternFlowIcmpv6EchoCodeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpv6EchoCodeCounter) PatternFlowIcmpv6EchoCodeCounter + // provides marshal interface + Marshal() marshalPatternFlowIcmpv6EchoCodeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpv6EchoCodeCounter + // validate validates PatternFlowIcmpv6EchoCodeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpv6EchoCodeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIcmpv6EchoCodeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIcmpv6EchoCodeCounter + SetStart(value uint32) PatternFlowIcmpv6EchoCodeCounter + // HasStart checks if Start has been set in PatternFlowIcmpv6EchoCodeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIcmpv6EchoCodeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIcmpv6EchoCodeCounter + SetStep(value uint32) PatternFlowIcmpv6EchoCodeCounter + // HasStep checks if Step has been set in PatternFlowIcmpv6EchoCodeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIcmpv6EchoCodeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIcmpv6EchoCodeCounter + SetCount(value uint32) PatternFlowIcmpv6EchoCodeCounter + // HasCount checks if Count has been set in PatternFlowIcmpv6EchoCodeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpv6EchoCodeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpv6EchoCodeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIcmpv6EchoCodeCounter object +func (obj *patternFlowIcmpv6EchoCodeCounter) SetStart(value uint32) PatternFlowIcmpv6EchoCodeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpv6EchoCodeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpv6EchoCodeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIcmpv6EchoCodeCounter object +func (obj *patternFlowIcmpv6EchoCodeCounter) SetStep(value uint32) PatternFlowIcmpv6EchoCodeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpv6EchoCodeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpv6EchoCodeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIcmpv6EchoCodeCounter object +func (obj *patternFlowIcmpv6EchoCodeCounter) SetCount(value uint32) PatternFlowIcmpv6EchoCodeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIcmpv6EchoCodeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoCodeCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoCodeCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoCodeCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIcmpv6EchoCodeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_icmpv6_echo_code_metric_tag.go b/gosnappi/pattern_flow_icmpv6_echo_code_metric_tag.go new file mode 100644 index 00000000..7af2a28c --- /dev/null +++ b/gosnappi/pattern_flow_icmpv6_echo_code_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIcmpv6EchoCodeMetricTag ***** +type patternFlowIcmpv6EchoCodeMetricTag struct { + validation + obj *otg.PatternFlowIcmpv6EchoCodeMetricTag + marshaller marshalPatternFlowIcmpv6EchoCodeMetricTag + unMarshaller unMarshalPatternFlowIcmpv6EchoCodeMetricTag +} + +func NewPatternFlowIcmpv6EchoCodeMetricTag() PatternFlowIcmpv6EchoCodeMetricTag { + obj := patternFlowIcmpv6EchoCodeMetricTag{obj: &otg.PatternFlowIcmpv6EchoCodeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpv6EchoCodeMetricTag) msg() *otg.PatternFlowIcmpv6EchoCodeMetricTag { + return obj.obj +} + +func (obj *patternFlowIcmpv6EchoCodeMetricTag) setMsg(msg *otg.PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpv6EchoCodeMetricTag struct { + obj *patternFlowIcmpv6EchoCodeMetricTag +} + +type marshalPatternFlowIcmpv6EchoCodeMetricTag interface { + // ToProto marshals PatternFlowIcmpv6EchoCodeMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoCodeMetricTag + ToProto() (*otg.PatternFlowIcmpv6EchoCodeMetricTag, error) + // ToPbText marshals PatternFlowIcmpv6EchoCodeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpv6EchoCodeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpv6EchoCodeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpv6EchoCodeMetricTag struct { + obj *patternFlowIcmpv6EchoCodeMetricTag +} + +type unMarshalPatternFlowIcmpv6EchoCodeMetricTag interface { + // FromProto unmarshals PatternFlowIcmpv6EchoCodeMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoCodeMetricTag + FromProto(msg *otg.PatternFlowIcmpv6EchoCodeMetricTag) (PatternFlowIcmpv6EchoCodeMetricTag, error) + // FromPbText unmarshals PatternFlowIcmpv6EchoCodeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpv6EchoCodeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpv6EchoCodeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpv6EchoCodeMetricTag) Marshal() marshalPatternFlowIcmpv6EchoCodeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpv6EchoCodeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpv6EchoCodeMetricTag) Unmarshal() unMarshalPatternFlowIcmpv6EchoCodeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoCodeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpv6EchoCodeMetricTag) ToProto() (*otg.PatternFlowIcmpv6EchoCodeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpv6EchoCodeMetricTag) FromProto(msg *otg.PatternFlowIcmpv6EchoCodeMetricTag) (PatternFlowIcmpv6EchoCodeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpv6EchoCodeMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoCodeMetricTag) 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 *marshalpatternFlowIcmpv6EchoCodeMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoCodeMetricTag) 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 *marshalpatternFlowIcmpv6EchoCodeMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoCodeMetricTag) 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 *patternFlowIcmpv6EchoCodeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoCodeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoCodeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpv6EchoCodeMetricTag) Clone() (PatternFlowIcmpv6EchoCodeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpv6EchoCodeMetricTag() + 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 +} + +// PatternFlowIcmpv6EchoCodeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIcmpv6EchoCodeMetricTag interface { + Validation + // msg marshals PatternFlowIcmpv6EchoCodeMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoCodeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIcmpv6EchoCodeMetricTag + // setMsg unmarshals PatternFlowIcmpv6EchoCodeMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoCodeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpv6EchoCodeMetricTag) PatternFlowIcmpv6EchoCodeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIcmpv6EchoCodeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpv6EchoCodeMetricTag + // validate validates PatternFlowIcmpv6EchoCodeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpv6EchoCodeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIcmpv6EchoCodeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIcmpv6EchoCodeMetricTag + SetName(value string) PatternFlowIcmpv6EchoCodeMetricTag + // Offset returns uint32, set in PatternFlowIcmpv6EchoCodeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIcmpv6EchoCodeMetricTag + SetOffset(value uint32) PatternFlowIcmpv6EchoCodeMetricTag + // HasOffset checks if Offset has been set in PatternFlowIcmpv6EchoCodeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIcmpv6EchoCodeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIcmpv6EchoCodeMetricTag + SetLength(value uint32) PatternFlowIcmpv6EchoCodeMetricTag + // HasLength checks if Length has been set in PatternFlowIcmpv6EchoCodeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIcmpv6EchoCodeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIcmpv6EchoCodeMetricTag object +func (obj *patternFlowIcmpv6EchoCodeMetricTag) SetName(value string) PatternFlowIcmpv6EchoCodeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpv6EchoCodeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpv6EchoCodeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIcmpv6EchoCodeMetricTag object +func (obj *patternFlowIcmpv6EchoCodeMetricTag) SetOffset(value uint32) PatternFlowIcmpv6EchoCodeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpv6EchoCodeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpv6EchoCodeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIcmpv6EchoCodeMetricTag object +func (obj *patternFlowIcmpv6EchoCodeMetricTag) SetLength(value uint32) PatternFlowIcmpv6EchoCodeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIcmpv6EchoCodeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpv6EchoCodeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoCodeMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIcmpv6EchoCodeMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIcmpv6EchoCodeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_icmpv6_echo_identifier.go b/gosnappi/pattern_flow_icmpv6_echo_identifier.go new file mode 100644 index 00000000..546f860d --- /dev/null +++ b/gosnappi/pattern_flow_icmpv6_echo_identifier.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIcmpv6EchoIdentifier ***** +type patternFlowIcmpv6EchoIdentifier struct { + validation + obj *otg.PatternFlowIcmpv6EchoIdentifier + marshaller marshalPatternFlowIcmpv6EchoIdentifier + unMarshaller unMarshalPatternFlowIcmpv6EchoIdentifier + incrementHolder PatternFlowIcmpv6EchoIdentifierCounter + decrementHolder PatternFlowIcmpv6EchoIdentifierCounter + metricTagsHolder PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter +} + +func NewPatternFlowIcmpv6EchoIdentifier() PatternFlowIcmpv6EchoIdentifier { + obj := patternFlowIcmpv6EchoIdentifier{obj: &otg.PatternFlowIcmpv6EchoIdentifier{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpv6EchoIdentifier) msg() *otg.PatternFlowIcmpv6EchoIdentifier { + return obj.obj +} + +func (obj *patternFlowIcmpv6EchoIdentifier) setMsg(msg *otg.PatternFlowIcmpv6EchoIdentifier) PatternFlowIcmpv6EchoIdentifier { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpv6EchoIdentifier struct { + obj *patternFlowIcmpv6EchoIdentifier +} + +type marshalPatternFlowIcmpv6EchoIdentifier interface { + // ToProto marshals PatternFlowIcmpv6EchoIdentifier to protobuf object *otg.PatternFlowIcmpv6EchoIdentifier + ToProto() (*otg.PatternFlowIcmpv6EchoIdentifier, error) + // ToPbText marshals PatternFlowIcmpv6EchoIdentifier to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpv6EchoIdentifier to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpv6EchoIdentifier to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpv6EchoIdentifier struct { + obj *patternFlowIcmpv6EchoIdentifier +} + +type unMarshalPatternFlowIcmpv6EchoIdentifier interface { + // FromProto unmarshals PatternFlowIcmpv6EchoIdentifier from protobuf object *otg.PatternFlowIcmpv6EchoIdentifier + FromProto(msg *otg.PatternFlowIcmpv6EchoIdentifier) (PatternFlowIcmpv6EchoIdentifier, error) + // FromPbText unmarshals PatternFlowIcmpv6EchoIdentifier from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpv6EchoIdentifier from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpv6EchoIdentifier from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpv6EchoIdentifier) Marshal() marshalPatternFlowIcmpv6EchoIdentifier { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpv6EchoIdentifier{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpv6EchoIdentifier) Unmarshal() unMarshalPatternFlowIcmpv6EchoIdentifier { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoIdentifier{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpv6EchoIdentifier) ToProto() (*otg.PatternFlowIcmpv6EchoIdentifier, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpv6EchoIdentifier) FromProto(msg *otg.PatternFlowIcmpv6EchoIdentifier) (PatternFlowIcmpv6EchoIdentifier, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpv6EchoIdentifier) 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 *unMarshalpatternFlowIcmpv6EchoIdentifier) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIcmpv6EchoIdentifier) 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 *unMarshalpatternFlowIcmpv6EchoIdentifier) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIcmpv6EchoIdentifier) 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 *unMarshalpatternFlowIcmpv6EchoIdentifier) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIcmpv6EchoIdentifier) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoIdentifier) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoIdentifier) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpv6EchoIdentifier) Clone() (PatternFlowIcmpv6EchoIdentifier, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpv6EchoIdentifier() + 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 +} + +func (obj *patternFlowIcmpv6EchoIdentifier) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIcmpv6EchoIdentifier is iCMPv6 echo identifier +type PatternFlowIcmpv6EchoIdentifier interface { + Validation + // msg marshals PatternFlowIcmpv6EchoIdentifier to protobuf object *otg.PatternFlowIcmpv6EchoIdentifier + // and doesn't set defaults + msg() *otg.PatternFlowIcmpv6EchoIdentifier + // setMsg unmarshals PatternFlowIcmpv6EchoIdentifier from protobuf object *otg.PatternFlowIcmpv6EchoIdentifier + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpv6EchoIdentifier) PatternFlowIcmpv6EchoIdentifier + // provides marshal interface + Marshal() marshalPatternFlowIcmpv6EchoIdentifier + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpv6EchoIdentifier + // validate validates PatternFlowIcmpv6EchoIdentifier + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpv6EchoIdentifier, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIcmpv6EchoIdentifierChoiceEnum, set in PatternFlowIcmpv6EchoIdentifier + Choice() PatternFlowIcmpv6EchoIdentifierChoiceEnum + // setChoice assigns PatternFlowIcmpv6EchoIdentifierChoiceEnum provided by user to PatternFlowIcmpv6EchoIdentifier + setChoice(value PatternFlowIcmpv6EchoIdentifierChoiceEnum) PatternFlowIcmpv6EchoIdentifier + // HasChoice checks if Choice has been set in PatternFlowIcmpv6EchoIdentifier + HasChoice() bool + // Value returns uint32, set in PatternFlowIcmpv6EchoIdentifier. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIcmpv6EchoIdentifier + SetValue(value uint32) PatternFlowIcmpv6EchoIdentifier + // HasValue checks if Value has been set in PatternFlowIcmpv6EchoIdentifier + HasValue() bool + // Values returns []uint32, set in PatternFlowIcmpv6EchoIdentifier. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIcmpv6EchoIdentifier + SetValues(value []uint32) PatternFlowIcmpv6EchoIdentifier + // Increment returns PatternFlowIcmpv6EchoIdentifierCounter, set in PatternFlowIcmpv6EchoIdentifier. + // PatternFlowIcmpv6EchoIdentifierCounter is integer counter pattern + Increment() PatternFlowIcmpv6EchoIdentifierCounter + // SetIncrement assigns PatternFlowIcmpv6EchoIdentifierCounter provided by user to PatternFlowIcmpv6EchoIdentifier. + // PatternFlowIcmpv6EchoIdentifierCounter is integer counter pattern + SetIncrement(value PatternFlowIcmpv6EchoIdentifierCounter) PatternFlowIcmpv6EchoIdentifier + // HasIncrement checks if Increment has been set in PatternFlowIcmpv6EchoIdentifier + HasIncrement() bool + // Decrement returns PatternFlowIcmpv6EchoIdentifierCounter, set in PatternFlowIcmpv6EchoIdentifier. + // PatternFlowIcmpv6EchoIdentifierCounter is integer counter pattern + Decrement() PatternFlowIcmpv6EchoIdentifierCounter + // SetDecrement assigns PatternFlowIcmpv6EchoIdentifierCounter provided by user to PatternFlowIcmpv6EchoIdentifier. + // PatternFlowIcmpv6EchoIdentifierCounter is integer counter pattern + SetDecrement(value PatternFlowIcmpv6EchoIdentifierCounter) PatternFlowIcmpv6EchoIdentifier + // HasDecrement checks if Decrement has been set in PatternFlowIcmpv6EchoIdentifier + HasDecrement() bool + // MetricTags returns PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIterIter, set in PatternFlowIcmpv6EchoIdentifier + MetricTags() PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter + setNil() +} + +type PatternFlowIcmpv6EchoIdentifierChoiceEnum string + +// Enum of Choice on PatternFlowIcmpv6EchoIdentifier +var PatternFlowIcmpv6EchoIdentifierChoice = struct { + VALUE PatternFlowIcmpv6EchoIdentifierChoiceEnum + VALUES PatternFlowIcmpv6EchoIdentifierChoiceEnum + INCREMENT PatternFlowIcmpv6EchoIdentifierChoiceEnum + DECREMENT PatternFlowIcmpv6EchoIdentifierChoiceEnum +}{ + VALUE: PatternFlowIcmpv6EchoIdentifierChoiceEnum("value"), + VALUES: PatternFlowIcmpv6EchoIdentifierChoiceEnum("values"), + INCREMENT: PatternFlowIcmpv6EchoIdentifierChoiceEnum("increment"), + DECREMENT: PatternFlowIcmpv6EchoIdentifierChoiceEnum("decrement"), +} + +func (obj *patternFlowIcmpv6EchoIdentifier) Choice() PatternFlowIcmpv6EchoIdentifierChoiceEnum { + return PatternFlowIcmpv6EchoIdentifierChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIcmpv6EchoIdentifier) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIcmpv6EchoIdentifier) setChoice(value PatternFlowIcmpv6EchoIdentifierChoiceEnum) PatternFlowIcmpv6EchoIdentifier { + intValue, ok := otg.PatternFlowIcmpv6EchoIdentifier_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIcmpv6EchoIdentifierChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIcmpv6EchoIdentifier_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIcmpv6EchoIdentifierChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIcmpv6EchoIdentifierChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIcmpv6EchoIdentifierChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIcmpv6EchoIdentifierCounter().msg() + } + + if value == PatternFlowIcmpv6EchoIdentifierChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIcmpv6EchoIdentifierCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpv6EchoIdentifier) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpv6EchoIdentifier) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIcmpv6EchoIdentifier object +func (obj *patternFlowIcmpv6EchoIdentifier) SetValue(value uint32) PatternFlowIcmpv6EchoIdentifier { + obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIcmpv6EchoIdentifier) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIcmpv6EchoIdentifier object +func (obj *patternFlowIcmpv6EchoIdentifier) SetValues(value []uint32) PatternFlowIcmpv6EchoIdentifier { + obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIcmpv6EchoIdentifierCounter +func (obj *patternFlowIcmpv6EchoIdentifier) Increment() PatternFlowIcmpv6EchoIdentifierCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIcmpv6EchoIdentifierCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIcmpv6EchoIdentifierCounter +func (obj *patternFlowIcmpv6EchoIdentifier) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIcmpv6EchoIdentifierCounter value in the PatternFlowIcmpv6EchoIdentifier object +func (obj *patternFlowIcmpv6EchoIdentifier) SetIncrement(value PatternFlowIcmpv6EchoIdentifierCounter) PatternFlowIcmpv6EchoIdentifier { + obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIcmpv6EchoIdentifierCounter +func (obj *patternFlowIcmpv6EchoIdentifier) Decrement() PatternFlowIcmpv6EchoIdentifierCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIcmpv6EchoIdentifierCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIcmpv6EchoIdentifierCounter +func (obj *patternFlowIcmpv6EchoIdentifier) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIcmpv6EchoIdentifierCounter value in the PatternFlowIcmpv6EchoIdentifier object +func (obj *patternFlowIcmpv6EchoIdentifier) SetDecrement(value PatternFlowIcmpv6EchoIdentifierCounter) PatternFlowIcmpv6EchoIdentifier { + obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIcmpv6EchoIdentifierMetricTag +func (obj *patternFlowIcmpv6EchoIdentifier) MetricTags() PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIcmpv6EchoIdentifierMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter struct { + obj *patternFlowIcmpv6EchoIdentifier + patternFlowIcmpv6EchoIdentifierMetricTagSlice []PatternFlowIcmpv6EchoIdentifierMetricTag + fieldPtr *[]*otg.PatternFlowIcmpv6EchoIdentifierMetricTag +} + +func newPatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter(ptr *[]*otg.PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { + return &patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter interface { + setMsg(*patternFlowIcmpv6EchoIdentifier) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter + Items() []PatternFlowIcmpv6EchoIdentifierMetricTag + Add() PatternFlowIcmpv6EchoIdentifierMetricTag + Append(items ...PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter + Set(index int, newObj PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter + Clear() PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter + clearHolderSlice() PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter + appendHolderSlice(item PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter +} + +func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) setMsg(msg *patternFlowIcmpv6EchoIdentifier) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIcmpv6EchoIdentifierMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) Items() []PatternFlowIcmpv6EchoIdentifierMetricTag { + return obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice +} + +func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) Add() PatternFlowIcmpv6EchoIdentifierMetricTag { + newObj := &otg.PatternFlowIcmpv6EchoIdentifierMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIcmpv6EchoIdentifierMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice = append(obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) Append(items ...PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice = append(obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) Set(index int, newObj PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) Clear() PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIcmpv6EchoIdentifierMetricTag{} + obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice = []PatternFlowIcmpv6EchoIdentifierMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) clearHolderSlice() PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { + if len(obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice) > 0 { + obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice = []PatternFlowIcmpv6EchoIdentifierMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter) appendHolderSlice(item PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierPatternFlowIcmpv6EchoIdentifierMetricTagIter { + obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice = append(obj.patternFlowIcmpv6EchoIdentifierMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIcmpv6EchoIdentifier) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoIdentifier.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIcmpv6EchoIdentifier.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIcmpv6EchoIdentifierMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIcmpv6EchoIdentifier) setDefault() { + var choices_set int = 0 + var choice PatternFlowIcmpv6EchoIdentifierChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIcmpv6EchoIdentifierChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIcmpv6EchoIdentifierChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIcmpv6EchoIdentifierChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIcmpv6EchoIdentifierChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIcmpv6EchoIdentifierChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpv6EchoIdentifier") + } + } else { + intVal := otg.PatternFlowIcmpv6EchoIdentifier_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIcmpv6EchoIdentifier_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_icmpv6_echo_identifier_counter.go b/gosnappi/pattern_flow_icmpv6_echo_identifier_counter.go new file mode 100644 index 00000000..5a0f75ed --- /dev/null +++ b/gosnappi/pattern_flow_icmpv6_echo_identifier_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIcmpv6EchoIdentifierCounter ***** +type patternFlowIcmpv6EchoIdentifierCounter struct { + validation + obj *otg.PatternFlowIcmpv6EchoIdentifierCounter + marshaller marshalPatternFlowIcmpv6EchoIdentifierCounter + unMarshaller unMarshalPatternFlowIcmpv6EchoIdentifierCounter +} + +func NewPatternFlowIcmpv6EchoIdentifierCounter() PatternFlowIcmpv6EchoIdentifierCounter { + obj := patternFlowIcmpv6EchoIdentifierCounter{obj: &otg.PatternFlowIcmpv6EchoIdentifierCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpv6EchoIdentifierCounter) msg() *otg.PatternFlowIcmpv6EchoIdentifierCounter { + return obj.obj +} + +func (obj *patternFlowIcmpv6EchoIdentifierCounter) setMsg(msg *otg.PatternFlowIcmpv6EchoIdentifierCounter) PatternFlowIcmpv6EchoIdentifierCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpv6EchoIdentifierCounter struct { + obj *patternFlowIcmpv6EchoIdentifierCounter +} + +type marshalPatternFlowIcmpv6EchoIdentifierCounter interface { + // ToProto marshals PatternFlowIcmpv6EchoIdentifierCounter to protobuf object *otg.PatternFlowIcmpv6EchoIdentifierCounter + ToProto() (*otg.PatternFlowIcmpv6EchoIdentifierCounter, error) + // ToPbText marshals PatternFlowIcmpv6EchoIdentifierCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpv6EchoIdentifierCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpv6EchoIdentifierCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpv6EchoIdentifierCounter struct { + obj *patternFlowIcmpv6EchoIdentifierCounter +} + +type unMarshalPatternFlowIcmpv6EchoIdentifierCounter interface { + // FromProto unmarshals PatternFlowIcmpv6EchoIdentifierCounter from protobuf object *otg.PatternFlowIcmpv6EchoIdentifierCounter + FromProto(msg *otg.PatternFlowIcmpv6EchoIdentifierCounter) (PatternFlowIcmpv6EchoIdentifierCounter, error) + // FromPbText unmarshals PatternFlowIcmpv6EchoIdentifierCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpv6EchoIdentifierCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpv6EchoIdentifierCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpv6EchoIdentifierCounter) Marshal() marshalPatternFlowIcmpv6EchoIdentifierCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpv6EchoIdentifierCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpv6EchoIdentifierCounter) Unmarshal() unMarshalPatternFlowIcmpv6EchoIdentifierCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoIdentifierCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpv6EchoIdentifierCounter) ToProto() (*otg.PatternFlowIcmpv6EchoIdentifierCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpv6EchoIdentifierCounter) FromProto(msg *otg.PatternFlowIcmpv6EchoIdentifierCounter) (PatternFlowIcmpv6EchoIdentifierCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpv6EchoIdentifierCounter) 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 *unMarshalpatternFlowIcmpv6EchoIdentifierCounter) 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 *marshalpatternFlowIcmpv6EchoIdentifierCounter) 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 *unMarshalpatternFlowIcmpv6EchoIdentifierCounter) 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 *marshalpatternFlowIcmpv6EchoIdentifierCounter) 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 *unMarshalpatternFlowIcmpv6EchoIdentifierCounter) 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 *patternFlowIcmpv6EchoIdentifierCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoIdentifierCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoIdentifierCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpv6EchoIdentifierCounter) Clone() (PatternFlowIcmpv6EchoIdentifierCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpv6EchoIdentifierCounter() + 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 +} + +// PatternFlowIcmpv6EchoIdentifierCounter is integer counter pattern +type PatternFlowIcmpv6EchoIdentifierCounter interface { + Validation + // msg marshals PatternFlowIcmpv6EchoIdentifierCounter to protobuf object *otg.PatternFlowIcmpv6EchoIdentifierCounter + // and doesn't set defaults + msg() *otg.PatternFlowIcmpv6EchoIdentifierCounter + // setMsg unmarshals PatternFlowIcmpv6EchoIdentifierCounter from protobuf object *otg.PatternFlowIcmpv6EchoIdentifierCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpv6EchoIdentifierCounter) PatternFlowIcmpv6EchoIdentifierCounter + // provides marshal interface + Marshal() marshalPatternFlowIcmpv6EchoIdentifierCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpv6EchoIdentifierCounter + // validate validates PatternFlowIcmpv6EchoIdentifierCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpv6EchoIdentifierCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIcmpv6EchoIdentifierCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIcmpv6EchoIdentifierCounter + SetStart(value uint32) PatternFlowIcmpv6EchoIdentifierCounter + // HasStart checks if Start has been set in PatternFlowIcmpv6EchoIdentifierCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIcmpv6EchoIdentifierCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIcmpv6EchoIdentifierCounter + SetStep(value uint32) PatternFlowIcmpv6EchoIdentifierCounter + // HasStep checks if Step has been set in PatternFlowIcmpv6EchoIdentifierCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIcmpv6EchoIdentifierCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIcmpv6EchoIdentifierCounter + SetCount(value uint32) PatternFlowIcmpv6EchoIdentifierCounter + // HasCount checks if Count has been set in PatternFlowIcmpv6EchoIdentifierCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpv6EchoIdentifierCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpv6EchoIdentifierCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIcmpv6EchoIdentifierCounter object +func (obj *patternFlowIcmpv6EchoIdentifierCounter) SetStart(value uint32) PatternFlowIcmpv6EchoIdentifierCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpv6EchoIdentifierCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpv6EchoIdentifierCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIcmpv6EchoIdentifierCounter object +func (obj *patternFlowIcmpv6EchoIdentifierCounter) SetStep(value uint32) PatternFlowIcmpv6EchoIdentifierCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpv6EchoIdentifierCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpv6EchoIdentifierCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIcmpv6EchoIdentifierCounter object +func (obj *patternFlowIcmpv6EchoIdentifierCounter) SetCount(value uint32) PatternFlowIcmpv6EchoIdentifierCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIcmpv6EchoIdentifierCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoIdentifierCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoIdentifierCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoIdentifierCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIcmpv6EchoIdentifierCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_icmpv6_echo_identifier_metric_tag.go b/gosnappi/pattern_flow_icmpv6_echo_identifier_metric_tag.go new file mode 100644 index 00000000..1059f8d1 --- /dev/null +++ b/gosnappi/pattern_flow_icmpv6_echo_identifier_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIcmpv6EchoIdentifierMetricTag ***** +type patternFlowIcmpv6EchoIdentifierMetricTag struct { + validation + obj *otg.PatternFlowIcmpv6EchoIdentifierMetricTag + marshaller marshalPatternFlowIcmpv6EchoIdentifierMetricTag + unMarshaller unMarshalPatternFlowIcmpv6EchoIdentifierMetricTag +} + +func NewPatternFlowIcmpv6EchoIdentifierMetricTag() PatternFlowIcmpv6EchoIdentifierMetricTag { + obj := patternFlowIcmpv6EchoIdentifierMetricTag{obj: &otg.PatternFlowIcmpv6EchoIdentifierMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) msg() *otg.PatternFlowIcmpv6EchoIdentifierMetricTag { + return obj.obj +} + +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) setMsg(msg *otg.PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpv6EchoIdentifierMetricTag struct { + obj *patternFlowIcmpv6EchoIdentifierMetricTag +} + +type marshalPatternFlowIcmpv6EchoIdentifierMetricTag interface { + // ToProto marshals PatternFlowIcmpv6EchoIdentifierMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoIdentifierMetricTag + ToProto() (*otg.PatternFlowIcmpv6EchoIdentifierMetricTag, error) + // ToPbText marshals PatternFlowIcmpv6EchoIdentifierMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpv6EchoIdentifierMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpv6EchoIdentifierMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpv6EchoIdentifierMetricTag struct { + obj *patternFlowIcmpv6EchoIdentifierMetricTag +} + +type unMarshalPatternFlowIcmpv6EchoIdentifierMetricTag interface { + // FromProto unmarshals PatternFlowIcmpv6EchoIdentifierMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoIdentifierMetricTag + FromProto(msg *otg.PatternFlowIcmpv6EchoIdentifierMetricTag) (PatternFlowIcmpv6EchoIdentifierMetricTag, error) + // FromPbText unmarshals PatternFlowIcmpv6EchoIdentifierMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpv6EchoIdentifierMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpv6EchoIdentifierMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) Marshal() marshalPatternFlowIcmpv6EchoIdentifierMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpv6EchoIdentifierMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) Unmarshal() unMarshalPatternFlowIcmpv6EchoIdentifierMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoIdentifierMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpv6EchoIdentifierMetricTag) ToProto() (*otg.PatternFlowIcmpv6EchoIdentifierMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpv6EchoIdentifierMetricTag) FromProto(msg *otg.PatternFlowIcmpv6EchoIdentifierMetricTag) (PatternFlowIcmpv6EchoIdentifierMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpv6EchoIdentifierMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoIdentifierMetricTag) 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 *marshalpatternFlowIcmpv6EchoIdentifierMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoIdentifierMetricTag) 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 *marshalpatternFlowIcmpv6EchoIdentifierMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoIdentifierMetricTag) 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 *patternFlowIcmpv6EchoIdentifierMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) Clone() (PatternFlowIcmpv6EchoIdentifierMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpv6EchoIdentifierMetricTag() + 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 +} + +// PatternFlowIcmpv6EchoIdentifierMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIcmpv6EchoIdentifierMetricTag interface { + Validation + // msg marshals PatternFlowIcmpv6EchoIdentifierMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoIdentifierMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIcmpv6EchoIdentifierMetricTag + // setMsg unmarshals PatternFlowIcmpv6EchoIdentifierMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoIdentifierMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpv6EchoIdentifierMetricTag) PatternFlowIcmpv6EchoIdentifierMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIcmpv6EchoIdentifierMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpv6EchoIdentifierMetricTag + // validate validates PatternFlowIcmpv6EchoIdentifierMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpv6EchoIdentifierMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIcmpv6EchoIdentifierMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIcmpv6EchoIdentifierMetricTag + SetName(value string) PatternFlowIcmpv6EchoIdentifierMetricTag + // Offset returns uint32, set in PatternFlowIcmpv6EchoIdentifierMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIcmpv6EchoIdentifierMetricTag + SetOffset(value uint32) PatternFlowIcmpv6EchoIdentifierMetricTag + // HasOffset checks if Offset has been set in PatternFlowIcmpv6EchoIdentifierMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIcmpv6EchoIdentifierMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIcmpv6EchoIdentifierMetricTag + SetLength(value uint32) PatternFlowIcmpv6EchoIdentifierMetricTag + // HasLength checks if Length has been set in PatternFlowIcmpv6EchoIdentifierMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIcmpv6EchoIdentifierMetricTag object +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) SetName(value string) PatternFlowIcmpv6EchoIdentifierMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIcmpv6EchoIdentifierMetricTag object +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) SetOffset(value uint32) PatternFlowIcmpv6EchoIdentifierMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIcmpv6EchoIdentifierMetricTag object +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) SetLength(value uint32) PatternFlowIcmpv6EchoIdentifierMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpv6EchoIdentifierMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoIdentifierMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIcmpv6EchoIdentifierMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIcmpv6EchoIdentifierMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_icmpv6_echo_sequence_number.go b/gosnappi/pattern_flow_icmpv6_echo_sequence_number.go new file mode 100644 index 00000000..a42c012a --- /dev/null +++ b/gosnappi/pattern_flow_icmpv6_echo_sequence_number.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIcmpv6EchoSequenceNumber ***** +type patternFlowIcmpv6EchoSequenceNumber struct { + validation + obj *otg.PatternFlowIcmpv6EchoSequenceNumber + marshaller marshalPatternFlowIcmpv6EchoSequenceNumber + unMarshaller unMarshalPatternFlowIcmpv6EchoSequenceNumber + incrementHolder PatternFlowIcmpv6EchoSequenceNumberCounter + decrementHolder PatternFlowIcmpv6EchoSequenceNumberCounter + metricTagsHolder PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter +} + +func NewPatternFlowIcmpv6EchoSequenceNumber() PatternFlowIcmpv6EchoSequenceNumber { + obj := patternFlowIcmpv6EchoSequenceNumber{obj: &otg.PatternFlowIcmpv6EchoSequenceNumber{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpv6EchoSequenceNumber) msg() *otg.PatternFlowIcmpv6EchoSequenceNumber { + return obj.obj +} + +func (obj *patternFlowIcmpv6EchoSequenceNumber) setMsg(msg *otg.PatternFlowIcmpv6EchoSequenceNumber) PatternFlowIcmpv6EchoSequenceNumber { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpv6EchoSequenceNumber struct { + obj *patternFlowIcmpv6EchoSequenceNumber +} + +type marshalPatternFlowIcmpv6EchoSequenceNumber interface { + // ToProto marshals PatternFlowIcmpv6EchoSequenceNumber to protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumber + ToProto() (*otg.PatternFlowIcmpv6EchoSequenceNumber, error) + // ToPbText marshals PatternFlowIcmpv6EchoSequenceNumber to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpv6EchoSequenceNumber to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpv6EchoSequenceNumber to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpv6EchoSequenceNumber struct { + obj *patternFlowIcmpv6EchoSequenceNumber +} + +type unMarshalPatternFlowIcmpv6EchoSequenceNumber interface { + // FromProto unmarshals PatternFlowIcmpv6EchoSequenceNumber from protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumber + FromProto(msg *otg.PatternFlowIcmpv6EchoSequenceNumber) (PatternFlowIcmpv6EchoSequenceNumber, error) + // FromPbText unmarshals PatternFlowIcmpv6EchoSequenceNumber from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpv6EchoSequenceNumber from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpv6EchoSequenceNumber from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpv6EchoSequenceNumber) Marshal() marshalPatternFlowIcmpv6EchoSequenceNumber { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpv6EchoSequenceNumber{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpv6EchoSequenceNumber) Unmarshal() unMarshalPatternFlowIcmpv6EchoSequenceNumber { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoSequenceNumber{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpv6EchoSequenceNumber) ToProto() (*otg.PatternFlowIcmpv6EchoSequenceNumber, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpv6EchoSequenceNumber) FromProto(msg *otg.PatternFlowIcmpv6EchoSequenceNumber) (PatternFlowIcmpv6EchoSequenceNumber, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpv6EchoSequenceNumber) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumber) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIcmpv6EchoSequenceNumber) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumber) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIcmpv6EchoSequenceNumber) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumber) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIcmpv6EchoSequenceNumber) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoSequenceNumber) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoSequenceNumber) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpv6EchoSequenceNumber) Clone() (PatternFlowIcmpv6EchoSequenceNumber, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpv6EchoSequenceNumber() + 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 +} + +func (obj *patternFlowIcmpv6EchoSequenceNumber) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIcmpv6EchoSequenceNumber is iCMPv6 echo sequence number +type PatternFlowIcmpv6EchoSequenceNumber interface { + Validation + // msg marshals PatternFlowIcmpv6EchoSequenceNumber to protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumber + // and doesn't set defaults + msg() *otg.PatternFlowIcmpv6EchoSequenceNumber + // setMsg unmarshals PatternFlowIcmpv6EchoSequenceNumber from protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumber + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpv6EchoSequenceNumber) PatternFlowIcmpv6EchoSequenceNumber + // provides marshal interface + Marshal() marshalPatternFlowIcmpv6EchoSequenceNumber + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpv6EchoSequenceNumber + // validate validates PatternFlowIcmpv6EchoSequenceNumber + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpv6EchoSequenceNumber, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIcmpv6EchoSequenceNumberChoiceEnum, set in PatternFlowIcmpv6EchoSequenceNumber + Choice() PatternFlowIcmpv6EchoSequenceNumberChoiceEnum + // setChoice assigns PatternFlowIcmpv6EchoSequenceNumberChoiceEnum provided by user to PatternFlowIcmpv6EchoSequenceNumber + setChoice(value PatternFlowIcmpv6EchoSequenceNumberChoiceEnum) PatternFlowIcmpv6EchoSequenceNumber + // HasChoice checks if Choice has been set in PatternFlowIcmpv6EchoSequenceNumber + HasChoice() bool + // Value returns uint32, set in PatternFlowIcmpv6EchoSequenceNumber. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIcmpv6EchoSequenceNumber + SetValue(value uint32) PatternFlowIcmpv6EchoSequenceNumber + // HasValue checks if Value has been set in PatternFlowIcmpv6EchoSequenceNumber + HasValue() bool + // Values returns []uint32, set in PatternFlowIcmpv6EchoSequenceNumber. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIcmpv6EchoSequenceNumber + SetValues(value []uint32) PatternFlowIcmpv6EchoSequenceNumber + // Increment returns PatternFlowIcmpv6EchoSequenceNumberCounter, set in PatternFlowIcmpv6EchoSequenceNumber. + // PatternFlowIcmpv6EchoSequenceNumberCounter is integer counter pattern + Increment() PatternFlowIcmpv6EchoSequenceNumberCounter + // SetIncrement assigns PatternFlowIcmpv6EchoSequenceNumberCounter provided by user to PatternFlowIcmpv6EchoSequenceNumber. + // PatternFlowIcmpv6EchoSequenceNumberCounter is integer counter pattern + SetIncrement(value PatternFlowIcmpv6EchoSequenceNumberCounter) PatternFlowIcmpv6EchoSequenceNumber + // HasIncrement checks if Increment has been set in PatternFlowIcmpv6EchoSequenceNumber + HasIncrement() bool + // Decrement returns PatternFlowIcmpv6EchoSequenceNumberCounter, set in PatternFlowIcmpv6EchoSequenceNumber. + // PatternFlowIcmpv6EchoSequenceNumberCounter is integer counter pattern + Decrement() PatternFlowIcmpv6EchoSequenceNumberCounter + // SetDecrement assigns PatternFlowIcmpv6EchoSequenceNumberCounter provided by user to PatternFlowIcmpv6EchoSequenceNumber. + // PatternFlowIcmpv6EchoSequenceNumberCounter is integer counter pattern + SetDecrement(value PatternFlowIcmpv6EchoSequenceNumberCounter) PatternFlowIcmpv6EchoSequenceNumber + // HasDecrement checks if Decrement has been set in PatternFlowIcmpv6EchoSequenceNumber + HasDecrement() bool + // MetricTags returns PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIterIter, set in PatternFlowIcmpv6EchoSequenceNumber + MetricTags() PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter + setNil() +} + +type PatternFlowIcmpv6EchoSequenceNumberChoiceEnum string + +// Enum of Choice on PatternFlowIcmpv6EchoSequenceNumber +var PatternFlowIcmpv6EchoSequenceNumberChoice = struct { + VALUE PatternFlowIcmpv6EchoSequenceNumberChoiceEnum + VALUES PatternFlowIcmpv6EchoSequenceNumberChoiceEnum + INCREMENT PatternFlowIcmpv6EchoSequenceNumberChoiceEnum + DECREMENT PatternFlowIcmpv6EchoSequenceNumberChoiceEnum +}{ + VALUE: PatternFlowIcmpv6EchoSequenceNumberChoiceEnum("value"), + VALUES: PatternFlowIcmpv6EchoSequenceNumberChoiceEnum("values"), + INCREMENT: PatternFlowIcmpv6EchoSequenceNumberChoiceEnum("increment"), + DECREMENT: PatternFlowIcmpv6EchoSequenceNumberChoiceEnum("decrement"), +} + +func (obj *patternFlowIcmpv6EchoSequenceNumber) Choice() PatternFlowIcmpv6EchoSequenceNumberChoiceEnum { + return PatternFlowIcmpv6EchoSequenceNumberChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIcmpv6EchoSequenceNumber) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIcmpv6EchoSequenceNumber) setChoice(value PatternFlowIcmpv6EchoSequenceNumberChoiceEnum) PatternFlowIcmpv6EchoSequenceNumber { + intValue, ok := otg.PatternFlowIcmpv6EchoSequenceNumber_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIcmpv6EchoSequenceNumberChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIcmpv6EchoSequenceNumber_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIcmpv6EchoSequenceNumberChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIcmpv6EchoSequenceNumberChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIcmpv6EchoSequenceNumberChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIcmpv6EchoSequenceNumberCounter().msg() + } + + if value == PatternFlowIcmpv6EchoSequenceNumberChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIcmpv6EchoSequenceNumberCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpv6EchoSequenceNumber) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpv6EchoSequenceNumber) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIcmpv6EchoSequenceNumber object +func (obj *patternFlowIcmpv6EchoSequenceNumber) SetValue(value uint32) PatternFlowIcmpv6EchoSequenceNumber { + obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIcmpv6EchoSequenceNumber) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIcmpv6EchoSequenceNumber object +func (obj *patternFlowIcmpv6EchoSequenceNumber) SetValues(value []uint32) PatternFlowIcmpv6EchoSequenceNumber { + obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIcmpv6EchoSequenceNumberCounter +func (obj *patternFlowIcmpv6EchoSequenceNumber) Increment() PatternFlowIcmpv6EchoSequenceNumberCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIcmpv6EchoSequenceNumberCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIcmpv6EchoSequenceNumberCounter +func (obj *patternFlowIcmpv6EchoSequenceNumber) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIcmpv6EchoSequenceNumberCounter value in the PatternFlowIcmpv6EchoSequenceNumber object +func (obj *patternFlowIcmpv6EchoSequenceNumber) SetIncrement(value PatternFlowIcmpv6EchoSequenceNumberCounter) PatternFlowIcmpv6EchoSequenceNumber { + obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIcmpv6EchoSequenceNumberCounter +func (obj *patternFlowIcmpv6EchoSequenceNumber) Decrement() PatternFlowIcmpv6EchoSequenceNumberCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIcmpv6EchoSequenceNumberCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIcmpv6EchoSequenceNumberCounter +func (obj *patternFlowIcmpv6EchoSequenceNumber) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIcmpv6EchoSequenceNumberCounter value in the PatternFlowIcmpv6EchoSequenceNumber object +func (obj *patternFlowIcmpv6EchoSequenceNumber) SetDecrement(value PatternFlowIcmpv6EchoSequenceNumberCounter) PatternFlowIcmpv6EchoSequenceNumber { + obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIcmpv6EchoSequenceNumberMetricTag +func (obj *patternFlowIcmpv6EchoSequenceNumber) MetricTags() PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter struct { + obj *patternFlowIcmpv6EchoSequenceNumber + patternFlowIcmpv6EchoSequenceNumberMetricTagSlice []PatternFlowIcmpv6EchoSequenceNumberMetricTag + fieldPtr *[]*otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag +} + +func newPatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter(ptr *[]*otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { + return &patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter interface { + setMsg(*patternFlowIcmpv6EchoSequenceNumber) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter + Items() []PatternFlowIcmpv6EchoSequenceNumberMetricTag + Add() PatternFlowIcmpv6EchoSequenceNumberMetricTag + Append(items ...PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter + Set(index int, newObj PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter + Clear() PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter + clearHolderSlice() PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter + appendHolderSlice(item PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) setMsg(msg *patternFlowIcmpv6EchoSequenceNumber) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIcmpv6EchoSequenceNumberMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) Items() []PatternFlowIcmpv6EchoSequenceNumberMetricTag { + return obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) Add() PatternFlowIcmpv6EchoSequenceNumberMetricTag { + newObj := &otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIcmpv6EchoSequenceNumberMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice = append(obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) Append(items ...PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice = append(obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) Set(index int, newObj PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) Clear() PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag{} + obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice = []PatternFlowIcmpv6EchoSequenceNumberMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) clearHolderSlice() PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { + if len(obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice) > 0 { + obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice = []PatternFlowIcmpv6EchoSequenceNumberMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter) appendHolderSlice(item PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberPatternFlowIcmpv6EchoSequenceNumberMetricTagIter { + obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice = append(obj.patternFlowIcmpv6EchoSequenceNumberMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIcmpv6EchoSequenceNumber) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoSequenceNumber.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIcmpv6EchoSequenceNumber.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIcmpv6EchoSequenceNumberMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIcmpv6EchoSequenceNumber) setDefault() { + var choices_set int = 0 + var choice PatternFlowIcmpv6EchoSequenceNumberChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIcmpv6EchoSequenceNumberChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIcmpv6EchoSequenceNumberChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIcmpv6EchoSequenceNumberChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIcmpv6EchoSequenceNumberChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIcmpv6EchoSequenceNumberChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpv6EchoSequenceNumber") + } + } else { + intVal := otg.PatternFlowIcmpv6EchoSequenceNumber_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIcmpv6EchoSequenceNumber_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_icmpv6_echo_sequence_number_counter.go b/gosnappi/pattern_flow_icmpv6_echo_sequence_number_counter.go new file mode 100644 index 00000000..e606846b --- /dev/null +++ b/gosnappi/pattern_flow_icmpv6_echo_sequence_number_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIcmpv6EchoSequenceNumberCounter ***** +type patternFlowIcmpv6EchoSequenceNumberCounter struct { + validation + obj *otg.PatternFlowIcmpv6EchoSequenceNumberCounter + marshaller marshalPatternFlowIcmpv6EchoSequenceNumberCounter + unMarshaller unMarshalPatternFlowIcmpv6EchoSequenceNumberCounter +} + +func NewPatternFlowIcmpv6EchoSequenceNumberCounter() PatternFlowIcmpv6EchoSequenceNumberCounter { + obj := patternFlowIcmpv6EchoSequenceNumberCounter{obj: &otg.PatternFlowIcmpv6EchoSequenceNumberCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) msg() *otg.PatternFlowIcmpv6EchoSequenceNumberCounter { + return obj.obj +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) setMsg(msg *otg.PatternFlowIcmpv6EchoSequenceNumberCounter) PatternFlowIcmpv6EchoSequenceNumberCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpv6EchoSequenceNumberCounter struct { + obj *patternFlowIcmpv6EchoSequenceNumberCounter +} + +type marshalPatternFlowIcmpv6EchoSequenceNumberCounter interface { + // ToProto marshals PatternFlowIcmpv6EchoSequenceNumberCounter to protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberCounter + ToProto() (*otg.PatternFlowIcmpv6EchoSequenceNumberCounter, error) + // ToPbText marshals PatternFlowIcmpv6EchoSequenceNumberCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpv6EchoSequenceNumberCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpv6EchoSequenceNumberCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpv6EchoSequenceNumberCounter struct { + obj *patternFlowIcmpv6EchoSequenceNumberCounter +} + +type unMarshalPatternFlowIcmpv6EchoSequenceNumberCounter interface { + // FromProto unmarshals PatternFlowIcmpv6EchoSequenceNumberCounter from protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberCounter + FromProto(msg *otg.PatternFlowIcmpv6EchoSequenceNumberCounter) (PatternFlowIcmpv6EchoSequenceNumberCounter, error) + // FromPbText unmarshals PatternFlowIcmpv6EchoSequenceNumberCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpv6EchoSequenceNumberCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpv6EchoSequenceNumberCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) Marshal() marshalPatternFlowIcmpv6EchoSequenceNumberCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpv6EchoSequenceNumberCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) Unmarshal() unMarshalPatternFlowIcmpv6EchoSequenceNumberCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoSequenceNumberCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpv6EchoSequenceNumberCounter) ToProto() (*otg.PatternFlowIcmpv6EchoSequenceNumberCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpv6EchoSequenceNumberCounter) FromProto(msg *otg.PatternFlowIcmpv6EchoSequenceNumberCounter) (PatternFlowIcmpv6EchoSequenceNumberCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpv6EchoSequenceNumberCounter) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumberCounter) 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 *marshalpatternFlowIcmpv6EchoSequenceNumberCounter) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumberCounter) 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 *marshalpatternFlowIcmpv6EchoSequenceNumberCounter) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumberCounter) 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 *patternFlowIcmpv6EchoSequenceNumberCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) Clone() (PatternFlowIcmpv6EchoSequenceNumberCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpv6EchoSequenceNumberCounter() + 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 +} + +// PatternFlowIcmpv6EchoSequenceNumberCounter is integer counter pattern +type PatternFlowIcmpv6EchoSequenceNumberCounter interface { + Validation + // msg marshals PatternFlowIcmpv6EchoSequenceNumberCounter to protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberCounter + // and doesn't set defaults + msg() *otg.PatternFlowIcmpv6EchoSequenceNumberCounter + // setMsg unmarshals PatternFlowIcmpv6EchoSequenceNumberCounter from protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpv6EchoSequenceNumberCounter) PatternFlowIcmpv6EchoSequenceNumberCounter + // provides marshal interface + Marshal() marshalPatternFlowIcmpv6EchoSequenceNumberCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpv6EchoSequenceNumberCounter + // validate validates PatternFlowIcmpv6EchoSequenceNumberCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpv6EchoSequenceNumberCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIcmpv6EchoSequenceNumberCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIcmpv6EchoSequenceNumberCounter + SetStart(value uint32) PatternFlowIcmpv6EchoSequenceNumberCounter + // HasStart checks if Start has been set in PatternFlowIcmpv6EchoSequenceNumberCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIcmpv6EchoSequenceNumberCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIcmpv6EchoSequenceNumberCounter + SetStep(value uint32) PatternFlowIcmpv6EchoSequenceNumberCounter + // HasStep checks if Step has been set in PatternFlowIcmpv6EchoSequenceNumberCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIcmpv6EchoSequenceNumberCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIcmpv6EchoSequenceNumberCounter + SetCount(value uint32) PatternFlowIcmpv6EchoSequenceNumberCounter + // HasCount checks if Count has been set in PatternFlowIcmpv6EchoSequenceNumberCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIcmpv6EchoSequenceNumberCounter object +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) SetStart(value uint32) PatternFlowIcmpv6EchoSequenceNumberCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIcmpv6EchoSequenceNumberCounter object +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) SetStep(value uint32) PatternFlowIcmpv6EchoSequenceNumberCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIcmpv6EchoSequenceNumberCounter object +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) SetCount(value uint32) PatternFlowIcmpv6EchoSequenceNumberCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoSequenceNumberCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoSequenceNumberCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoSequenceNumberCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_icmpv6_echo_sequence_number_metric_tag.go b/gosnappi/pattern_flow_icmpv6_echo_sequence_number_metric_tag.go new file mode 100644 index 00000000..a6ab3caf --- /dev/null +++ b/gosnappi/pattern_flow_icmpv6_echo_sequence_number_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIcmpv6EchoSequenceNumberMetricTag ***** +type patternFlowIcmpv6EchoSequenceNumberMetricTag struct { + validation + obj *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag + marshaller marshalPatternFlowIcmpv6EchoSequenceNumberMetricTag + unMarshaller unMarshalPatternFlowIcmpv6EchoSequenceNumberMetricTag +} + +func NewPatternFlowIcmpv6EchoSequenceNumberMetricTag() PatternFlowIcmpv6EchoSequenceNumberMetricTag { + obj := patternFlowIcmpv6EchoSequenceNumberMetricTag{obj: &otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) msg() *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag { + return obj.obj +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) setMsg(msg *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpv6EchoSequenceNumberMetricTag struct { + obj *patternFlowIcmpv6EchoSequenceNumberMetricTag +} + +type marshalPatternFlowIcmpv6EchoSequenceNumberMetricTag interface { + // ToProto marshals PatternFlowIcmpv6EchoSequenceNumberMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag + ToProto() (*otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag, error) + // ToPbText marshals PatternFlowIcmpv6EchoSequenceNumberMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpv6EchoSequenceNumberMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpv6EchoSequenceNumberMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpv6EchoSequenceNumberMetricTag struct { + obj *patternFlowIcmpv6EchoSequenceNumberMetricTag +} + +type unMarshalPatternFlowIcmpv6EchoSequenceNumberMetricTag interface { + // FromProto unmarshals PatternFlowIcmpv6EchoSequenceNumberMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag + FromProto(msg *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag) (PatternFlowIcmpv6EchoSequenceNumberMetricTag, error) + // FromPbText unmarshals PatternFlowIcmpv6EchoSequenceNumberMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpv6EchoSequenceNumberMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpv6EchoSequenceNumberMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) Marshal() marshalPatternFlowIcmpv6EchoSequenceNumberMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpv6EchoSequenceNumberMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) Unmarshal() unMarshalPatternFlowIcmpv6EchoSequenceNumberMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoSequenceNumberMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) ToProto() (*otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) FromProto(msg *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag) (PatternFlowIcmpv6EchoSequenceNumberMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) 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 *marshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) 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 *marshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoSequenceNumberMetricTag) 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 *patternFlowIcmpv6EchoSequenceNumberMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) Clone() (PatternFlowIcmpv6EchoSequenceNumberMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpv6EchoSequenceNumberMetricTag() + 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 +} + +// PatternFlowIcmpv6EchoSequenceNumberMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIcmpv6EchoSequenceNumberMetricTag interface { + Validation + // msg marshals PatternFlowIcmpv6EchoSequenceNumberMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag + // setMsg unmarshals PatternFlowIcmpv6EchoSequenceNumberMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpv6EchoSequenceNumberMetricTag) PatternFlowIcmpv6EchoSequenceNumberMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIcmpv6EchoSequenceNumberMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpv6EchoSequenceNumberMetricTag + // validate validates PatternFlowIcmpv6EchoSequenceNumberMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpv6EchoSequenceNumberMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIcmpv6EchoSequenceNumberMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIcmpv6EchoSequenceNumberMetricTag + SetName(value string) PatternFlowIcmpv6EchoSequenceNumberMetricTag + // Offset returns uint32, set in PatternFlowIcmpv6EchoSequenceNumberMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIcmpv6EchoSequenceNumberMetricTag + SetOffset(value uint32) PatternFlowIcmpv6EchoSequenceNumberMetricTag + // HasOffset checks if Offset has been set in PatternFlowIcmpv6EchoSequenceNumberMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIcmpv6EchoSequenceNumberMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIcmpv6EchoSequenceNumberMetricTag + SetLength(value uint32) PatternFlowIcmpv6EchoSequenceNumberMetricTag + // HasLength checks if Length has been set in PatternFlowIcmpv6EchoSequenceNumberMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIcmpv6EchoSequenceNumberMetricTag object +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) SetName(value string) PatternFlowIcmpv6EchoSequenceNumberMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIcmpv6EchoSequenceNumberMetricTag object +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) SetOffset(value uint32) PatternFlowIcmpv6EchoSequenceNumberMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIcmpv6EchoSequenceNumberMetricTag object +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) SetLength(value uint32) PatternFlowIcmpv6EchoSequenceNumberMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpv6EchoSequenceNumberMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoSequenceNumberMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIcmpv6EchoSequenceNumberMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIcmpv6EchoSequenceNumberMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_icmpv6_echo_type.go b/gosnappi/pattern_flow_icmpv6_echo_type.go new file mode 100644 index 00000000..fb039404 --- /dev/null +++ b/gosnappi/pattern_flow_icmpv6_echo_type.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIcmpv6EchoType ***** +type patternFlowIcmpv6EchoType struct { + validation + obj *otg.PatternFlowIcmpv6EchoType + marshaller marshalPatternFlowIcmpv6EchoType + unMarshaller unMarshalPatternFlowIcmpv6EchoType + incrementHolder PatternFlowIcmpv6EchoTypeCounter + decrementHolder PatternFlowIcmpv6EchoTypeCounter + metricTagsHolder PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter +} + +func NewPatternFlowIcmpv6EchoType() PatternFlowIcmpv6EchoType { + obj := patternFlowIcmpv6EchoType{obj: &otg.PatternFlowIcmpv6EchoType{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpv6EchoType) msg() *otg.PatternFlowIcmpv6EchoType { + return obj.obj +} + +func (obj *patternFlowIcmpv6EchoType) setMsg(msg *otg.PatternFlowIcmpv6EchoType) PatternFlowIcmpv6EchoType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpv6EchoType struct { + obj *patternFlowIcmpv6EchoType +} + +type marshalPatternFlowIcmpv6EchoType interface { + // ToProto marshals PatternFlowIcmpv6EchoType to protobuf object *otg.PatternFlowIcmpv6EchoType + ToProto() (*otg.PatternFlowIcmpv6EchoType, error) + // ToPbText marshals PatternFlowIcmpv6EchoType to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpv6EchoType to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpv6EchoType to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpv6EchoType struct { + obj *patternFlowIcmpv6EchoType +} + +type unMarshalPatternFlowIcmpv6EchoType interface { + // FromProto unmarshals PatternFlowIcmpv6EchoType from protobuf object *otg.PatternFlowIcmpv6EchoType + FromProto(msg *otg.PatternFlowIcmpv6EchoType) (PatternFlowIcmpv6EchoType, error) + // FromPbText unmarshals PatternFlowIcmpv6EchoType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpv6EchoType from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpv6EchoType from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpv6EchoType) Marshal() marshalPatternFlowIcmpv6EchoType { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpv6EchoType{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpv6EchoType) Unmarshal() unMarshalPatternFlowIcmpv6EchoType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpv6EchoType) ToProto() (*otg.PatternFlowIcmpv6EchoType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpv6EchoType) FromProto(msg *otg.PatternFlowIcmpv6EchoType) (PatternFlowIcmpv6EchoType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpv6EchoType) 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 *unMarshalpatternFlowIcmpv6EchoType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIcmpv6EchoType) 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 *unMarshalpatternFlowIcmpv6EchoType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIcmpv6EchoType) 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 *unMarshalpatternFlowIcmpv6EchoType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIcmpv6EchoType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpv6EchoType) Clone() (PatternFlowIcmpv6EchoType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpv6EchoType() + 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 +} + +func (obj *patternFlowIcmpv6EchoType) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIcmpv6EchoType is iCMPv6 echo type +type PatternFlowIcmpv6EchoType interface { + Validation + // msg marshals PatternFlowIcmpv6EchoType to protobuf object *otg.PatternFlowIcmpv6EchoType + // and doesn't set defaults + msg() *otg.PatternFlowIcmpv6EchoType + // setMsg unmarshals PatternFlowIcmpv6EchoType from protobuf object *otg.PatternFlowIcmpv6EchoType + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpv6EchoType) PatternFlowIcmpv6EchoType + // provides marshal interface + Marshal() marshalPatternFlowIcmpv6EchoType + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpv6EchoType + // validate validates PatternFlowIcmpv6EchoType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpv6EchoType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIcmpv6EchoTypeChoiceEnum, set in PatternFlowIcmpv6EchoType + Choice() PatternFlowIcmpv6EchoTypeChoiceEnum + // setChoice assigns PatternFlowIcmpv6EchoTypeChoiceEnum provided by user to PatternFlowIcmpv6EchoType + setChoice(value PatternFlowIcmpv6EchoTypeChoiceEnum) PatternFlowIcmpv6EchoType + // HasChoice checks if Choice has been set in PatternFlowIcmpv6EchoType + HasChoice() bool + // Value returns uint32, set in PatternFlowIcmpv6EchoType. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIcmpv6EchoType + SetValue(value uint32) PatternFlowIcmpv6EchoType + // HasValue checks if Value has been set in PatternFlowIcmpv6EchoType + HasValue() bool + // Values returns []uint32, set in PatternFlowIcmpv6EchoType. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIcmpv6EchoType + SetValues(value []uint32) PatternFlowIcmpv6EchoType + // Increment returns PatternFlowIcmpv6EchoTypeCounter, set in PatternFlowIcmpv6EchoType. + // PatternFlowIcmpv6EchoTypeCounter is integer counter pattern + Increment() PatternFlowIcmpv6EchoTypeCounter + // SetIncrement assigns PatternFlowIcmpv6EchoTypeCounter provided by user to PatternFlowIcmpv6EchoType. + // PatternFlowIcmpv6EchoTypeCounter is integer counter pattern + SetIncrement(value PatternFlowIcmpv6EchoTypeCounter) PatternFlowIcmpv6EchoType + // HasIncrement checks if Increment has been set in PatternFlowIcmpv6EchoType + HasIncrement() bool + // Decrement returns PatternFlowIcmpv6EchoTypeCounter, set in PatternFlowIcmpv6EchoType. + // PatternFlowIcmpv6EchoTypeCounter is integer counter pattern + Decrement() PatternFlowIcmpv6EchoTypeCounter + // SetDecrement assigns PatternFlowIcmpv6EchoTypeCounter provided by user to PatternFlowIcmpv6EchoType. + // PatternFlowIcmpv6EchoTypeCounter is integer counter pattern + SetDecrement(value PatternFlowIcmpv6EchoTypeCounter) PatternFlowIcmpv6EchoType + // HasDecrement checks if Decrement has been set in PatternFlowIcmpv6EchoType + HasDecrement() bool + // MetricTags returns PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIterIter, set in PatternFlowIcmpv6EchoType + MetricTags() PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter + setNil() +} + +type PatternFlowIcmpv6EchoTypeChoiceEnum string + +// Enum of Choice on PatternFlowIcmpv6EchoType +var PatternFlowIcmpv6EchoTypeChoice = struct { + VALUE PatternFlowIcmpv6EchoTypeChoiceEnum + VALUES PatternFlowIcmpv6EchoTypeChoiceEnum + INCREMENT PatternFlowIcmpv6EchoTypeChoiceEnum + DECREMENT PatternFlowIcmpv6EchoTypeChoiceEnum +}{ + VALUE: PatternFlowIcmpv6EchoTypeChoiceEnum("value"), + VALUES: PatternFlowIcmpv6EchoTypeChoiceEnum("values"), + INCREMENT: PatternFlowIcmpv6EchoTypeChoiceEnum("increment"), + DECREMENT: PatternFlowIcmpv6EchoTypeChoiceEnum("decrement"), +} + +func (obj *patternFlowIcmpv6EchoType) Choice() PatternFlowIcmpv6EchoTypeChoiceEnum { + return PatternFlowIcmpv6EchoTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIcmpv6EchoType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIcmpv6EchoType) setChoice(value PatternFlowIcmpv6EchoTypeChoiceEnum) PatternFlowIcmpv6EchoType { + intValue, ok := otg.PatternFlowIcmpv6EchoType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIcmpv6EchoTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIcmpv6EchoType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIcmpv6EchoTypeChoice.VALUE { + defaultValue := uint32(128) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIcmpv6EchoTypeChoice.VALUES { + defaultValue := []uint32{128} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIcmpv6EchoTypeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIcmpv6EchoTypeCounter().msg() + } + + if value == PatternFlowIcmpv6EchoTypeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIcmpv6EchoTypeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpv6EchoType) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIcmpv6EchoType) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIcmpv6EchoType object +func (obj *patternFlowIcmpv6EchoType) SetValue(value uint32) PatternFlowIcmpv6EchoType { + obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIcmpv6EchoType) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{128}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIcmpv6EchoType object +func (obj *patternFlowIcmpv6EchoType) SetValues(value []uint32) PatternFlowIcmpv6EchoType { + obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIcmpv6EchoTypeCounter +func (obj *patternFlowIcmpv6EchoType) Increment() PatternFlowIcmpv6EchoTypeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIcmpv6EchoTypeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIcmpv6EchoTypeCounter +func (obj *patternFlowIcmpv6EchoType) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIcmpv6EchoTypeCounter value in the PatternFlowIcmpv6EchoType object +func (obj *patternFlowIcmpv6EchoType) SetIncrement(value PatternFlowIcmpv6EchoTypeCounter) PatternFlowIcmpv6EchoType { + obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIcmpv6EchoTypeCounter +func (obj *patternFlowIcmpv6EchoType) Decrement() PatternFlowIcmpv6EchoTypeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIcmpv6EchoTypeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIcmpv6EchoTypeCounter +func (obj *patternFlowIcmpv6EchoType) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIcmpv6EchoTypeCounter value in the PatternFlowIcmpv6EchoType object +func (obj *patternFlowIcmpv6EchoType) SetDecrement(value PatternFlowIcmpv6EchoTypeCounter) PatternFlowIcmpv6EchoType { + obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIcmpv6EchoTypeMetricTag +func (obj *patternFlowIcmpv6EchoType) MetricTags() PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIcmpv6EchoTypeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter struct { + obj *patternFlowIcmpv6EchoType + patternFlowIcmpv6EchoTypeMetricTagSlice []PatternFlowIcmpv6EchoTypeMetricTag + fieldPtr *[]*otg.PatternFlowIcmpv6EchoTypeMetricTag +} + +func newPatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter(ptr *[]*otg.PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { + return &patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter interface { + setMsg(*patternFlowIcmpv6EchoType) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter + Items() []PatternFlowIcmpv6EchoTypeMetricTag + Add() PatternFlowIcmpv6EchoTypeMetricTag + Append(items ...PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter + Set(index int, newObj PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter + Clear() PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter + clearHolderSlice() PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter + appendHolderSlice(item PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter +} + +func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) setMsg(msg *patternFlowIcmpv6EchoType) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIcmpv6EchoTypeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) Items() []PatternFlowIcmpv6EchoTypeMetricTag { + return obj.patternFlowIcmpv6EchoTypeMetricTagSlice +} + +func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) Add() PatternFlowIcmpv6EchoTypeMetricTag { + newObj := &otg.PatternFlowIcmpv6EchoTypeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIcmpv6EchoTypeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIcmpv6EchoTypeMetricTagSlice = append(obj.patternFlowIcmpv6EchoTypeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) Append(items ...PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIcmpv6EchoTypeMetricTagSlice = append(obj.patternFlowIcmpv6EchoTypeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) Set(index int, newObj PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIcmpv6EchoTypeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) Clear() PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIcmpv6EchoTypeMetricTag{} + obj.patternFlowIcmpv6EchoTypeMetricTagSlice = []PatternFlowIcmpv6EchoTypeMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) clearHolderSlice() PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { + if len(obj.patternFlowIcmpv6EchoTypeMetricTagSlice) > 0 { + obj.patternFlowIcmpv6EchoTypeMetricTagSlice = []PatternFlowIcmpv6EchoTypeMetricTag{} + } + return obj +} +func (obj *patternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter) appendHolderSlice(item PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypePatternFlowIcmpv6EchoTypeMetricTagIter { + obj.patternFlowIcmpv6EchoTypeMetricTagSlice = append(obj.patternFlowIcmpv6EchoTypeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIcmpv6EchoType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoType.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIcmpv6EchoType.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIcmpv6EchoTypeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIcmpv6EchoType) setDefault() { + var choices_set int = 0 + var choice PatternFlowIcmpv6EchoTypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIcmpv6EchoTypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIcmpv6EchoTypeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIcmpv6EchoTypeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIcmpv6EchoTypeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIcmpv6EchoTypeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIcmpv6EchoType") + } + } else { + intVal := otg.PatternFlowIcmpv6EchoType_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIcmpv6EchoType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_icmpv6_echo_type_counter.go b/gosnappi/pattern_flow_icmpv6_echo_type_counter.go new file mode 100644 index 00000000..50d16674 --- /dev/null +++ b/gosnappi/pattern_flow_icmpv6_echo_type_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIcmpv6EchoTypeCounter ***** +type patternFlowIcmpv6EchoTypeCounter struct { + validation + obj *otg.PatternFlowIcmpv6EchoTypeCounter + marshaller marshalPatternFlowIcmpv6EchoTypeCounter + unMarshaller unMarshalPatternFlowIcmpv6EchoTypeCounter +} + +func NewPatternFlowIcmpv6EchoTypeCounter() PatternFlowIcmpv6EchoTypeCounter { + obj := patternFlowIcmpv6EchoTypeCounter{obj: &otg.PatternFlowIcmpv6EchoTypeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpv6EchoTypeCounter) msg() *otg.PatternFlowIcmpv6EchoTypeCounter { + return obj.obj +} + +func (obj *patternFlowIcmpv6EchoTypeCounter) setMsg(msg *otg.PatternFlowIcmpv6EchoTypeCounter) PatternFlowIcmpv6EchoTypeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpv6EchoTypeCounter struct { + obj *patternFlowIcmpv6EchoTypeCounter +} + +type marshalPatternFlowIcmpv6EchoTypeCounter interface { + // ToProto marshals PatternFlowIcmpv6EchoTypeCounter to protobuf object *otg.PatternFlowIcmpv6EchoTypeCounter + ToProto() (*otg.PatternFlowIcmpv6EchoTypeCounter, error) + // ToPbText marshals PatternFlowIcmpv6EchoTypeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpv6EchoTypeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpv6EchoTypeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpv6EchoTypeCounter struct { + obj *patternFlowIcmpv6EchoTypeCounter +} + +type unMarshalPatternFlowIcmpv6EchoTypeCounter interface { + // FromProto unmarshals PatternFlowIcmpv6EchoTypeCounter from protobuf object *otg.PatternFlowIcmpv6EchoTypeCounter + FromProto(msg *otg.PatternFlowIcmpv6EchoTypeCounter) (PatternFlowIcmpv6EchoTypeCounter, error) + // FromPbText unmarshals PatternFlowIcmpv6EchoTypeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpv6EchoTypeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpv6EchoTypeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpv6EchoTypeCounter) Marshal() marshalPatternFlowIcmpv6EchoTypeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpv6EchoTypeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpv6EchoTypeCounter) Unmarshal() unMarshalPatternFlowIcmpv6EchoTypeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoTypeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpv6EchoTypeCounter) ToProto() (*otg.PatternFlowIcmpv6EchoTypeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpv6EchoTypeCounter) FromProto(msg *otg.PatternFlowIcmpv6EchoTypeCounter) (PatternFlowIcmpv6EchoTypeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpv6EchoTypeCounter) 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 *unMarshalpatternFlowIcmpv6EchoTypeCounter) 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 *marshalpatternFlowIcmpv6EchoTypeCounter) 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 *unMarshalpatternFlowIcmpv6EchoTypeCounter) 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 *marshalpatternFlowIcmpv6EchoTypeCounter) 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 *unMarshalpatternFlowIcmpv6EchoTypeCounter) 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 *patternFlowIcmpv6EchoTypeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoTypeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoTypeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpv6EchoTypeCounter) Clone() (PatternFlowIcmpv6EchoTypeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpv6EchoTypeCounter() + 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 +} + +// PatternFlowIcmpv6EchoTypeCounter is integer counter pattern +type PatternFlowIcmpv6EchoTypeCounter interface { + Validation + // msg marshals PatternFlowIcmpv6EchoTypeCounter to protobuf object *otg.PatternFlowIcmpv6EchoTypeCounter + // and doesn't set defaults + msg() *otg.PatternFlowIcmpv6EchoTypeCounter + // setMsg unmarshals PatternFlowIcmpv6EchoTypeCounter from protobuf object *otg.PatternFlowIcmpv6EchoTypeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpv6EchoTypeCounter) PatternFlowIcmpv6EchoTypeCounter + // provides marshal interface + Marshal() marshalPatternFlowIcmpv6EchoTypeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpv6EchoTypeCounter + // validate validates PatternFlowIcmpv6EchoTypeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpv6EchoTypeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIcmpv6EchoTypeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIcmpv6EchoTypeCounter + SetStart(value uint32) PatternFlowIcmpv6EchoTypeCounter + // HasStart checks if Start has been set in PatternFlowIcmpv6EchoTypeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIcmpv6EchoTypeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIcmpv6EchoTypeCounter + SetStep(value uint32) PatternFlowIcmpv6EchoTypeCounter + // HasStep checks if Step has been set in PatternFlowIcmpv6EchoTypeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIcmpv6EchoTypeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIcmpv6EchoTypeCounter + SetCount(value uint32) PatternFlowIcmpv6EchoTypeCounter + // HasCount checks if Count has been set in PatternFlowIcmpv6EchoTypeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpv6EchoTypeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIcmpv6EchoTypeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIcmpv6EchoTypeCounter object +func (obj *patternFlowIcmpv6EchoTypeCounter) SetStart(value uint32) PatternFlowIcmpv6EchoTypeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpv6EchoTypeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIcmpv6EchoTypeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIcmpv6EchoTypeCounter object +func (obj *patternFlowIcmpv6EchoTypeCounter) SetStep(value uint32) PatternFlowIcmpv6EchoTypeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpv6EchoTypeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIcmpv6EchoTypeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIcmpv6EchoTypeCounter object +func (obj *patternFlowIcmpv6EchoTypeCounter) SetCount(value uint32) PatternFlowIcmpv6EchoTypeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIcmpv6EchoTypeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoTypeCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoTypeCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoTypeCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIcmpv6EchoTypeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(128) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_icmpv6_echo_type_metric_tag.go b/gosnappi/pattern_flow_icmpv6_echo_type_metric_tag.go new file mode 100644 index 00000000..40cdedce --- /dev/null +++ b/gosnappi/pattern_flow_icmpv6_echo_type_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIcmpv6EchoTypeMetricTag ***** +type patternFlowIcmpv6EchoTypeMetricTag struct { + validation + obj *otg.PatternFlowIcmpv6EchoTypeMetricTag + marshaller marshalPatternFlowIcmpv6EchoTypeMetricTag + unMarshaller unMarshalPatternFlowIcmpv6EchoTypeMetricTag +} + +func NewPatternFlowIcmpv6EchoTypeMetricTag() PatternFlowIcmpv6EchoTypeMetricTag { + obj := patternFlowIcmpv6EchoTypeMetricTag{obj: &otg.PatternFlowIcmpv6EchoTypeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIcmpv6EchoTypeMetricTag) msg() *otg.PatternFlowIcmpv6EchoTypeMetricTag { + return obj.obj +} + +func (obj *patternFlowIcmpv6EchoTypeMetricTag) setMsg(msg *otg.PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIcmpv6EchoTypeMetricTag struct { + obj *patternFlowIcmpv6EchoTypeMetricTag +} + +type marshalPatternFlowIcmpv6EchoTypeMetricTag interface { + // ToProto marshals PatternFlowIcmpv6EchoTypeMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoTypeMetricTag + ToProto() (*otg.PatternFlowIcmpv6EchoTypeMetricTag, error) + // ToPbText marshals PatternFlowIcmpv6EchoTypeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIcmpv6EchoTypeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIcmpv6EchoTypeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIcmpv6EchoTypeMetricTag struct { + obj *patternFlowIcmpv6EchoTypeMetricTag +} + +type unMarshalPatternFlowIcmpv6EchoTypeMetricTag interface { + // FromProto unmarshals PatternFlowIcmpv6EchoTypeMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoTypeMetricTag + FromProto(msg *otg.PatternFlowIcmpv6EchoTypeMetricTag) (PatternFlowIcmpv6EchoTypeMetricTag, error) + // FromPbText unmarshals PatternFlowIcmpv6EchoTypeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIcmpv6EchoTypeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIcmpv6EchoTypeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIcmpv6EchoTypeMetricTag) Marshal() marshalPatternFlowIcmpv6EchoTypeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIcmpv6EchoTypeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIcmpv6EchoTypeMetricTag) Unmarshal() unMarshalPatternFlowIcmpv6EchoTypeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIcmpv6EchoTypeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIcmpv6EchoTypeMetricTag) ToProto() (*otg.PatternFlowIcmpv6EchoTypeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIcmpv6EchoTypeMetricTag) FromProto(msg *otg.PatternFlowIcmpv6EchoTypeMetricTag) (PatternFlowIcmpv6EchoTypeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIcmpv6EchoTypeMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoTypeMetricTag) 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 *marshalpatternFlowIcmpv6EchoTypeMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoTypeMetricTag) 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 *marshalpatternFlowIcmpv6EchoTypeMetricTag) 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 *unMarshalpatternFlowIcmpv6EchoTypeMetricTag) 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 *patternFlowIcmpv6EchoTypeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoTypeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIcmpv6EchoTypeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIcmpv6EchoTypeMetricTag) Clone() (PatternFlowIcmpv6EchoTypeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIcmpv6EchoTypeMetricTag() + 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 +} + +// PatternFlowIcmpv6EchoTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIcmpv6EchoTypeMetricTag interface { + Validation + // msg marshals PatternFlowIcmpv6EchoTypeMetricTag to protobuf object *otg.PatternFlowIcmpv6EchoTypeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIcmpv6EchoTypeMetricTag + // setMsg unmarshals PatternFlowIcmpv6EchoTypeMetricTag from protobuf object *otg.PatternFlowIcmpv6EchoTypeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIcmpv6EchoTypeMetricTag) PatternFlowIcmpv6EchoTypeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIcmpv6EchoTypeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIcmpv6EchoTypeMetricTag + // validate validates PatternFlowIcmpv6EchoTypeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIcmpv6EchoTypeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIcmpv6EchoTypeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIcmpv6EchoTypeMetricTag + SetName(value string) PatternFlowIcmpv6EchoTypeMetricTag + // Offset returns uint32, set in PatternFlowIcmpv6EchoTypeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIcmpv6EchoTypeMetricTag + SetOffset(value uint32) PatternFlowIcmpv6EchoTypeMetricTag + // HasOffset checks if Offset has been set in PatternFlowIcmpv6EchoTypeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIcmpv6EchoTypeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIcmpv6EchoTypeMetricTag + SetLength(value uint32) PatternFlowIcmpv6EchoTypeMetricTag + // HasLength checks if Length has been set in PatternFlowIcmpv6EchoTypeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIcmpv6EchoTypeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIcmpv6EchoTypeMetricTag object +func (obj *patternFlowIcmpv6EchoTypeMetricTag) SetName(value string) PatternFlowIcmpv6EchoTypeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpv6EchoTypeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIcmpv6EchoTypeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIcmpv6EchoTypeMetricTag object +func (obj *patternFlowIcmpv6EchoTypeMetricTag) SetOffset(value uint32) PatternFlowIcmpv6EchoTypeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpv6EchoTypeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIcmpv6EchoTypeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIcmpv6EchoTypeMetricTag object +func (obj *patternFlowIcmpv6EchoTypeMetricTag) SetLength(value uint32) PatternFlowIcmpv6EchoTypeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIcmpv6EchoTypeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIcmpv6EchoTypeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIcmpv6EchoTypeMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIcmpv6EchoTypeMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIcmpv6EchoTypeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_igmpv1_checksum.go b/gosnappi/pattern_flow_igmpv1_checksum.go new file mode 100644 index 00000000..415ec802 --- /dev/null +++ b/gosnappi/pattern_flow_igmpv1_checksum.go @@ -0,0 +1,434 @@ +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" +) + +// ***** PatternFlowIgmpv1Checksum ***** +type patternFlowIgmpv1Checksum struct { + validation + obj *otg.PatternFlowIgmpv1Checksum + marshaller marshalPatternFlowIgmpv1Checksum + unMarshaller unMarshalPatternFlowIgmpv1Checksum +} + +func NewPatternFlowIgmpv1Checksum() PatternFlowIgmpv1Checksum { + obj := patternFlowIgmpv1Checksum{obj: &otg.PatternFlowIgmpv1Checksum{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIgmpv1Checksum) msg() *otg.PatternFlowIgmpv1Checksum { + return obj.obj +} + +func (obj *patternFlowIgmpv1Checksum) setMsg(msg *otg.PatternFlowIgmpv1Checksum) PatternFlowIgmpv1Checksum { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIgmpv1Checksum struct { + obj *patternFlowIgmpv1Checksum +} + +type marshalPatternFlowIgmpv1Checksum interface { + // ToProto marshals PatternFlowIgmpv1Checksum to protobuf object *otg.PatternFlowIgmpv1Checksum + ToProto() (*otg.PatternFlowIgmpv1Checksum, error) + // ToPbText marshals PatternFlowIgmpv1Checksum to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIgmpv1Checksum to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIgmpv1Checksum to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIgmpv1Checksum struct { + obj *patternFlowIgmpv1Checksum +} + +type unMarshalPatternFlowIgmpv1Checksum interface { + // FromProto unmarshals PatternFlowIgmpv1Checksum from protobuf object *otg.PatternFlowIgmpv1Checksum + FromProto(msg *otg.PatternFlowIgmpv1Checksum) (PatternFlowIgmpv1Checksum, error) + // FromPbText unmarshals PatternFlowIgmpv1Checksum from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIgmpv1Checksum from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIgmpv1Checksum from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIgmpv1Checksum) Marshal() marshalPatternFlowIgmpv1Checksum { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIgmpv1Checksum{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIgmpv1Checksum) Unmarshal() unMarshalPatternFlowIgmpv1Checksum { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIgmpv1Checksum{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIgmpv1Checksum) ToProto() (*otg.PatternFlowIgmpv1Checksum, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIgmpv1Checksum) FromProto(msg *otg.PatternFlowIgmpv1Checksum) (PatternFlowIgmpv1Checksum, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIgmpv1Checksum) 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 *unMarshalpatternFlowIgmpv1Checksum) 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 *marshalpatternFlowIgmpv1Checksum) 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 *unMarshalpatternFlowIgmpv1Checksum) 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 *marshalpatternFlowIgmpv1Checksum) 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 *unMarshalpatternFlowIgmpv1Checksum) 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 *patternFlowIgmpv1Checksum) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1Checksum) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1Checksum) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIgmpv1Checksum) Clone() (PatternFlowIgmpv1Checksum, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIgmpv1Checksum() + 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 +} + +// PatternFlowIgmpv1Checksum is checksum +type PatternFlowIgmpv1Checksum interface { + Validation + // msg marshals PatternFlowIgmpv1Checksum to protobuf object *otg.PatternFlowIgmpv1Checksum + // and doesn't set defaults + msg() *otg.PatternFlowIgmpv1Checksum + // setMsg unmarshals PatternFlowIgmpv1Checksum from protobuf object *otg.PatternFlowIgmpv1Checksum + // and doesn't set defaults + setMsg(*otg.PatternFlowIgmpv1Checksum) PatternFlowIgmpv1Checksum + // provides marshal interface + Marshal() marshalPatternFlowIgmpv1Checksum + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIgmpv1Checksum + // validate validates PatternFlowIgmpv1Checksum + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIgmpv1Checksum, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIgmpv1ChecksumChoiceEnum, set in PatternFlowIgmpv1Checksum + Choice() PatternFlowIgmpv1ChecksumChoiceEnum + // setChoice assigns PatternFlowIgmpv1ChecksumChoiceEnum provided by user to PatternFlowIgmpv1Checksum + setChoice(value PatternFlowIgmpv1ChecksumChoiceEnum) PatternFlowIgmpv1Checksum + // HasChoice checks if Choice has been set in PatternFlowIgmpv1Checksum + HasChoice() bool + // Generated returns PatternFlowIgmpv1ChecksumGeneratedEnum, set in PatternFlowIgmpv1Checksum + Generated() PatternFlowIgmpv1ChecksumGeneratedEnum + // SetGenerated assigns PatternFlowIgmpv1ChecksumGeneratedEnum provided by user to PatternFlowIgmpv1Checksum + SetGenerated(value PatternFlowIgmpv1ChecksumGeneratedEnum) PatternFlowIgmpv1Checksum + // HasGenerated checks if Generated has been set in PatternFlowIgmpv1Checksum + HasGenerated() bool + // Custom returns uint32, set in PatternFlowIgmpv1Checksum. + Custom() uint32 + // SetCustom assigns uint32 provided by user to PatternFlowIgmpv1Checksum + SetCustom(value uint32) PatternFlowIgmpv1Checksum + // HasCustom checks if Custom has been set in PatternFlowIgmpv1Checksum + HasCustom() bool +} + +type PatternFlowIgmpv1ChecksumChoiceEnum string + +// Enum of Choice on PatternFlowIgmpv1Checksum +var PatternFlowIgmpv1ChecksumChoice = struct { + GENERATED PatternFlowIgmpv1ChecksumChoiceEnum + CUSTOM PatternFlowIgmpv1ChecksumChoiceEnum +}{ + GENERATED: PatternFlowIgmpv1ChecksumChoiceEnum("generated"), + CUSTOM: PatternFlowIgmpv1ChecksumChoiceEnum("custom"), +} + +func (obj *patternFlowIgmpv1Checksum) Choice() PatternFlowIgmpv1ChecksumChoiceEnum { + return PatternFlowIgmpv1ChecksumChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The type of checksum +// Choice returns a string +func (obj *patternFlowIgmpv1Checksum) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIgmpv1Checksum) setChoice(value PatternFlowIgmpv1ChecksumChoiceEnum) PatternFlowIgmpv1Checksum { + intValue, ok := otg.PatternFlowIgmpv1Checksum_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIgmpv1ChecksumChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIgmpv1Checksum_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Custom = nil + obj.obj.Generated = otg.PatternFlowIgmpv1Checksum_Generated_unspecified.Enum() + return obj +} + +type PatternFlowIgmpv1ChecksumGeneratedEnum string + +// Enum of Generated on PatternFlowIgmpv1Checksum +var PatternFlowIgmpv1ChecksumGenerated = struct { + GOOD PatternFlowIgmpv1ChecksumGeneratedEnum + BAD PatternFlowIgmpv1ChecksumGeneratedEnum +}{ + GOOD: PatternFlowIgmpv1ChecksumGeneratedEnum("good"), + BAD: PatternFlowIgmpv1ChecksumGeneratedEnum("bad"), +} + +func (obj *patternFlowIgmpv1Checksum) Generated() PatternFlowIgmpv1ChecksumGeneratedEnum { + return PatternFlowIgmpv1ChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) +} + +// A system generated checksum value +// Generated returns a string +func (obj *patternFlowIgmpv1Checksum) HasGenerated() bool { + return obj.obj.Generated != nil +} + +func (obj *patternFlowIgmpv1Checksum) SetGenerated(value PatternFlowIgmpv1ChecksumGeneratedEnum) PatternFlowIgmpv1Checksum { + intValue, ok := otg.PatternFlowIgmpv1Checksum_Generated_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIgmpv1ChecksumGeneratedEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIgmpv1Checksum_Generated_Enum(intValue) + obj.obj.Generated = &enumValue + + return obj +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowIgmpv1Checksum) Custom() uint32 { + + if obj.obj.Custom == nil { + obj.setChoice(PatternFlowIgmpv1ChecksumChoice.CUSTOM) + } + + return *obj.obj.Custom + +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowIgmpv1Checksum) HasCustom() bool { + return obj.obj.Custom != nil +} + +// A custom checksum value +// SetCustom sets the uint32 value in the PatternFlowIgmpv1Checksum object +func (obj *patternFlowIgmpv1Checksum) SetCustom(value uint32) PatternFlowIgmpv1Checksum { + obj.setChoice(PatternFlowIgmpv1ChecksumChoice.CUSTOM) + obj.obj.Custom = &value + return obj +} + +func (obj *patternFlowIgmpv1Checksum) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Custom != nil { + + if *obj.obj.Custom > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1Checksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) + } + + } + +} + +func (obj *patternFlowIgmpv1Checksum) setDefault() { + var choices_set int = 0 + var choice PatternFlowIgmpv1ChecksumChoiceEnum + + if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { + choices_set += 1 + choice = PatternFlowIgmpv1ChecksumChoice.GENERATED + } + + if obj.obj.Custom != nil { + choices_set += 1 + choice = PatternFlowIgmpv1ChecksumChoice.CUSTOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIgmpv1ChecksumChoice.GENERATED) + if obj.obj.Generated.Number() == 0 { + obj.SetGenerated(PatternFlowIgmpv1ChecksumGenerated.GOOD) + + } + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIgmpv1Checksum") + } + } else { + intVal := otg.PatternFlowIgmpv1Checksum_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIgmpv1Checksum_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_igmpv1_group_address.go b/gosnappi/pattern_flow_igmpv1_group_address.go new file mode 100644 index 00000000..46e13eb6 --- /dev/null +++ b/gosnappi/pattern_flow_igmpv1_group_address.go @@ -0,0 +1,658 @@ +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" +) + +// ***** PatternFlowIgmpv1GroupAddress ***** +type patternFlowIgmpv1GroupAddress struct { + validation + obj *otg.PatternFlowIgmpv1GroupAddress + marshaller marshalPatternFlowIgmpv1GroupAddress + unMarshaller unMarshalPatternFlowIgmpv1GroupAddress + incrementHolder PatternFlowIgmpv1GroupAddressCounter + decrementHolder PatternFlowIgmpv1GroupAddressCounter + metricTagsHolder PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter +} + +func NewPatternFlowIgmpv1GroupAddress() PatternFlowIgmpv1GroupAddress { + obj := patternFlowIgmpv1GroupAddress{obj: &otg.PatternFlowIgmpv1GroupAddress{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIgmpv1GroupAddress) msg() *otg.PatternFlowIgmpv1GroupAddress { + return obj.obj +} + +func (obj *patternFlowIgmpv1GroupAddress) setMsg(msg *otg.PatternFlowIgmpv1GroupAddress) PatternFlowIgmpv1GroupAddress { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIgmpv1GroupAddress struct { + obj *patternFlowIgmpv1GroupAddress +} + +type marshalPatternFlowIgmpv1GroupAddress interface { + // ToProto marshals PatternFlowIgmpv1GroupAddress to protobuf object *otg.PatternFlowIgmpv1GroupAddress + ToProto() (*otg.PatternFlowIgmpv1GroupAddress, error) + // ToPbText marshals PatternFlowIgmpv1GroupAddress to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIgmpv1GroupAddress to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIgmpv1GroupAddress to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIgmpv1GroupAddress struct { + obj *patternFlowIgmpv1GroupAddress +} + +type unMarshalPatternFlowIgmpv1GroupAddress interface { + // FromProto unmarshals PatternFlowIgmpv1GroupAddress from protobuf object *otg.PatternFlowIgmpv1GroupAddress + FromProto(msg *otg.PatternFlowIgmpv1GroupAddress) (PatternFlowIgmpv1GroupAddress, error) + // FromPbText unmarshals PatternFlowIgmpv1GroupAddress from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIgmpv1GroupAddress from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIgmpv1GroupAddress from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIgmpv1GroupAddress) Marshal() marshalPatternFlowIgmpv1GroupAddress { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIgmpv1GroupAddress{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIgmpv1GroupAddress) Unmarshal() unMarshalPatternFlowIgmpv1GroupAddress { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIgmpv1GroupAddress{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIgmpv1GroupAddress) ToProto() (*otg.PatternFlowIgmpv1GroupAddress, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIgmpv1GroupAddress) FromProto(msg *otg.PatternFlowIgmpv1GroupAddress) (PatternFlowIgmpv1GroupAddress, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIgmpv1GroupAddress) 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 *unMarshalpatternFlowIgmpv1GroupAddress) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIgmpv1GroupAddress) 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 *unMarshalpatternFlowIgmpv1GroupAddress) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIgmpv1GroupAddress) 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 *unMarshalpatternFlowIgmpv1GroupAddress) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIgmpv1GroupAddress) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1GroupAddress) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1GroupAddress) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIgmpv1GroupAddress) Clone() (PatternFlowIgmpv1GroupAddress, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIgmpv1GroupAddress() + 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 +} + +func (obj *patternFlowIgmpv1GroupAddress) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIgmpv1GroupAddress is group address +type PatternFlowIgmpv1GroupAddress interface { + Validation + // msg marshals PatternFlowIgmpv1GroupAddress to protobuf object *otg.PatternFlowIgmpv1GroupAddress + // and doesn't set defaults + msg() *otg.PatternFlowIgmpv1GroupAddress + // setMsg unmarshals PatternFlowIgmpv1GroupAddress from protobuf object *otg.PatternFlowIgmpv1GroupAddress + // and doesn't set defaults + setMsg(*otg.PatternFlowIgmpv1GroupAddress) PatternFlowIgmpv1GroupAddress + // provides marshal interface + Marshal() marshalPatternFlowIgmpv1GroupAddress + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIgmpv1GroupAddress + // validate validates PatternFlowIgmpv1GroupAddress + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIgmpv1GroupAddress, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIgmpv1GroupAddressChoiceEnum, set in PatternFlowIgmpv1GroupAddress + Choice() PatternFlowIgmpv1GroupAddressChoiceEnum + // setChoice assigns PatternFlowIgmpv1GroupAddressChoiceEnum provided by user to PatternFlowIgmpv1GroupAddress + setChoice(value PatternFlowIgmpv1GroupAddressChoiceEnum) PatternFlowIgmpv1GroupAddress + // HasChoice checks if Choice has been set in PatternFlowIgmpv1GroupAddress + HasChoice() bool + // Value returns string, set in PatternFlowIgmpv1GroupAddress. + Value() string + // SetValue assigns string provided by user to PatternFlowIgmpv1GroupAddress + SetValue(value string) PatternFlowIgmpv1GroupAddress + // HasValue checks if Value has been set in PatternFlowIgmpv1GroupAddress + HasValue() bool + // Values returns []string, set in PatternFlowIgmpv1GroupAddress. + Values() []string + // SetValues assigns []string provided by user to PatternFlowIgmpv1GroupAddress + SetValues(value []string) PatternFlowIgmpv1GroupAddress + // Increment returns PatternFlowIgmpv1GroupAddressCounter, set in PatternFlowIgmpv1GroupAddress. + // PatternFlowIgmpv1GroupAddressCounter is ipv4 counter pattern + Increment() PatternFlowIgmpv1GroupAddressCounter + // SetIncrement assigns PatternFlowIgmpv1GroupAddressCounter provided by user to PatternFlowIgmpv1GroupAddress. + // PatternFlowIgmpv1GroupAddressCounter is ipv4 counter pattern + SetIncrement(value PatternFlowIgmpv1GroupAddressCounter) PatternFlowIgmpv1GroupAddress + // HasIncrement checks if Increment has been set in PatternFlowIgmpv1GroupAddress + HasIncrement() bool + // Decrement returns PatternFlowIgmpv1GroupAddressCounter, set in PatternFlowIgmpv1GroupAddress. + // PatternFlowIgmpv1GroupAddressCounter is ipv4 counter pattern + Decrement() PatternFlowIgmpv1GroupAddressCounter + // SetDecrement assigns PatternFlowIgmpv1GroupAddressCounter provided by user to PatternFlowIgmpv1GroupAddress. + // PatternFlowIgmpv1GroupAddressCounter is ipv4 counter pattern + SetDecrement(value PatternFlowIgmpv1GroupAddressCounter) PatternFlowIgmpv1GroupAddress + // HasDecrement checks if Decrement has been set in PatternFlowIgmpv1GroupAddress + HasDecrement() bool + // MetricTags returns PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIterIter, set in PatternFlowIgmpv1GroupAddress + MetricTags() PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter + setNil() +} + +type PatternFlowIgmpv1GroupAddressChoiceEnum string + +// Enum of Choice on PatternFlowIgmpv1GroupAddress +var PatternFlowIgmpv1GroupAddressChoice = struct { + VALUE PatternFlowIgmpv1GroupAddressChoiceEnum + VALUES PatternFlowIgmpv1GroupAddressChoiceEnum + INCREMENT PatternFlowIgmpv1GroupAddressChoiceEnum + DECREMENT PatternFlowIgmpv1GroupAddressChoiceEnum +}{ + VALUE: PatternFlowIgmpv1GroupAddressChoiceEnum("value"), + VALUES: PatternFlowIgmpv1GroupAddressChoiceEnum("values"), + INCREMENT: PatternFlowIgmpv1GroupAddressChoiceEnum("increment"), + DECREMENT: PatternFlowIgmpv1GroupAddressChoiceEnum("decrement"), +} + +func (obj *patternFlowIgmpv1GroupAddress) Choice() PatternFlowIgmpv1GroupAddressChoiceEnum { + return PatternFlowIgmpv1GroupAddressChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIgmpv1GroupAddress) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIgmpv1GroupAddress) setChoice(value PatternFlowIgmpv1GroupAddressChoiceEnum) PatternFlowIgmpv1GroupAddress { + intValue, ok := otg.PatternFlowIgmpv1GroupAddress_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIgmpv1GroupAddressChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIgmpv1GroupAddress_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIgmpv1GroupAddressChoice.VALUE { + defaultValue := "0.0.0.0" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIgmpv1GroupAddressChoice.VALUES { + defaultValue := []string{"0.0.0.0"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIgmpv1GroupAddressChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIgmpv1GroupAddressCounter().msg() + } + + if value == PatternFlowIgmpv1GroupAddressChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIgmpv1GroupAddressCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowIgmpv1GroupAddress) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowIgmpv1GroupAddress) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowIgmpv1GroupAddress object +func (obj *patternFlowIgmpv1GroupAddress) SetValue(value string) PatternFlowIgmpv1GroupAddress { + obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowIgmpv1GroupAddress) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"0.0.0.0"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowIgmpv1GroupAddress object +func (obj *patternFlowIgmpv1GroupAddress) SetValues(value []string) PatternFlowIgmpv1GroupAddress { + obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIgmpv1GroupAddressCounter +func (obj *patternFlowIgmpv1GroupAddress) Increment() PatternFlowIgmpv1GroupAddressCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIgmpv1GroupAddressCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIgmpv1GroupAddressCounter +func (obj *patternFlowIgmpv1GroupAddress) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIgmpv1GroupAddressCounter value in the PatternFlowIgmpv1GroupAddress object +func (obj *patternFlowIgmpv1GroupAddress) SetIncrement(value PatternFlowIgmpv1GroupAddressCounter) PatternFlowIgmpv1GroupAddress { + obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIgmpv1GroupAddressCounter +func (obj *patternFlowIgmpv1GroupAddress) Decrement() PatternFlowIgmpv1GroupAddressCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIgmpv1GroupAddressCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIgmpv1GroupAddressCounter +func (obj *patternFlowIgmpv1GroupAddress) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIgmpv1GroupAddressCounter value in the PatternFlowIgmpv1GroupAddress object +func (obj *patternFlowIgmpv1GroupAddress) SetDecrement(value PatternFlowIgmpv1GroupAddressCounter) PatternFlowIgmpv1GroupAddress { + obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIgmpv1GroupAddressMetricTag +func (obj *patternFlowIgmpv1GroupAddress) MetricTags() PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIgmpv1GroupAddressMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter struct { + obj *patternFlowIgmpv1GroupAddress + patternFlowIgmpv1GroupAddressMetricTagSlice []PatternFlowIgmpv1GroupAddressMetricTag + fieldPtr *[]*otg.PatternFlowIgmpv1GroupAddressMetricTag +} + +func newPatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter(ptr *[]*otg.PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { + return &patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter interface { + setMsg(*patternFlowIgmpv1GroupAddress) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter + Items() []PatternFlowIgmpv1GroupAddressMetricTag + Add() PatternFlowIgmpv1GroupAddressMetricTag + Append(items ...PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter + Set(index int, newObj PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter + Clear() PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter + clearHolderSlice() PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter + appendHolderSlice(item PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter +} + +func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) setMsg(msg *patternFlowIgmpv1GroupAddress) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIgmpv1GroupAddressMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) Items() []PatternFlowIgmpv1GroupAddressMetricTag { + return obj.patternFlowIgmpv1GroupAddressMetricTagSlice +} + +func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) Add() PatternFlowIgmpv1GroupAddressMetricTag { + newObj := &otg.PatternFlowIgmpv1GroupAddressMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIgmpv1GroupAddressMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIgmpv1GroupAddressMetricTagSlice = append(obj.patternFlowIgmpv1GroupAddressMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) Append(items ...PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIgmpv1GroupAddressMetricTagSlice = append(obj.patternFlowIgmpv1GroupAddressMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) Set(index int, newObj PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIgmpv1GroupAddressMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) Clear() PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIgmpv1GroupAddressMetricTag{} + obj.patternFlowIgmpv1GroupAddressMetricTagSlice = []PatternFlowIgmpv1GroupAddressMetricTag{} + } + return obj +} +func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) clearHolderSlice() PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { + if len(obj.patternFlowIgmpv1GroupAddressMetricTagSlice) > 0 { + obj.patternFlowIgmpv1GroupAddressMetricTagSlice = []PatternFlowIgmpv1GroupAddressMetricTag{} + } + return obj +} +func (obj *patternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter) appendHolderSlice(item PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressPatternFlowIgmpv1GroupAddressMetricTagIter { + obj.patternFlowIgmpv1GroupAddressMetricTagSlice = append(obj.patternFlowIgmpv1GroupAddressMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIgmpv1GroupAddress) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv4(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIgmpv1GroupAddress.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateIpv4Slice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIgmpv1GroupAddress.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIgmpv1GroupAddressMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIgmpv1GroupAddress) setDefault() { + var choices_set int = 0 + var choice PatternFlowIgmpv1GroupAddressChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIgmpv1GroupAddressChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIgmpv1GroupAddressChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIgmpv1GroupAddressChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIgmpv1GroupAddressChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIgmpv1GroupAddressChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIgmpv1GroupAddress") + } + } else { + intVal := otg.PatternFlowIgmpv1GroupAddress_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIgmpv1GroupAddress_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_igmpv1_group_address_counter.go b/gosnappi/pattern_flow_igmpv1_group_address_counter.go new file mode 100644 index 00000000..1d6df1a4 --- /dev/null +++ b/gosnappi/pattern_flow_igmpv1_group_address_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowIgmpv1GroupAddressCounter ***** +type patternFlowIgmpv1GroupAddressCounter struct { + validation + obj *otg.PatternFlowIgmpv1GroupAddressCounter + marshaller marshalPatternFlowIgmpv1GroupAddressCounter + unMarshaller unMarshalPatternFlowIgmpv1GroupAddressCounter +} + +func NewPatternFlowIgmpv1GroupAddressCounter() PatternFlowIgmpv1GroupAddressCounter { + obj := patternFlowIgmpv1GroupAddressCounter{obj: &otg.PatternFlowIgmpv1GroupAddressCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIgmpv1GroupAddressCounter) msg() *otg.PatternFlowIgmpv1GroupAddressCounter { + return obj.obj +} + +func (obj *patternFlowIgmpv1GroupAddressCounter) setMsg(msg *otg.PatternFlowIgmpv1GroupAddressCounter) PatternFlowIgmpv1GroupAddressCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIgmpv1GroupAddressCounter struct { + obj *patternFlowIgmpv1GroupAddressCounter +} + +type marshalPatternFlowIgmpv1GroupAddressCounter interface { + // ToProto marshals PatternFlowIgmpv1GroupAddressCounter to protobuf object *otg.PatternFlowIgmpv1GroupAddressCounter + ToProto() (*otg.PatternFlowIgmpv1GroupAddressCounter, error) + // ToPbText marshals PatternFlowIgmpv1GroupAddressCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIgmpv1GroupAddressCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIgmpv1GroupAddressCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIgmpv1GroupAddressCounter struct { + obj *patternFlowIgmpv1GroupAddressCounter +} + +type unMarshalPatternFlowIgmpv1GroupAddressCounter interface { + // FromProto unmarshals PatternFlowIgmpv1GroupAddressCounter from protobuf object *otg.PatternFlowIgmpv1GroupAddressCounter + FromProto(msg *otg.PatternFlowIgmpv1GroupAddressCounter) (PatternFlowIgmpv1GroupAddressCounter, error) + // FromPbText unmarshals PatternFlowIgmpv1GroupAddressCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIgmpv1GroupAddressCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIgmpv1GroupAddressCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIgmpv1GroupAddressCounter) Marshal() marshalPatternFlowIgmpv1GroupAddressCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIgmpv1GroupAddressCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIgmpv1GroupAddressCounter) Unmarshal() unMarshalPatternFlowIgmpv1GroupAddressCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIgmpv1GroupAddressCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIgmpv1GroupAddressCounter) ToProto() (*otg.PatternFlowIgmpv1GroupAddressCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIgmpv1GroupAddressCounter) FromProto(msg *otg.PatternFlowIgmpv1GroupAddressCounter) (PatternFlowIgmpv1GroupAddressCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIgmpv1GroupAddressCounter) 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 *unMarshalpatternFlowIgmpv1GroupAddressCounter) 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 *marshalpatternFlowIgmpv1GroupAddressCounter) 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 *unMarshalpatternFlowIgmpv1GroupAddressCounter) 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 *marshalpatternFlowIgmpv1GroupAddressCounter) 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 *unMarshalpatternFlowIgmpv1GroupAddressCounter) 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 *patternFlowIgmpv1GroupAddressCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1GroupAddressCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1GroupAddressCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIgmpv1GroupAddressCounter) Clone() (PatternFlowIgmpv1GroupAddressCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIgmpv1GroupAddressCounter() + 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 +} + +// PatternFlowIgmpv1GroupAddressCounter is ipv4 counter pattern +type PatternFlowIgmpv1GroupAddressCounter interface { + Validation + // msg marshals PatternFlowIgmpv1GroupAddressCounter to protobuf object *otg.PatternFlowIgmpv1GroupAddressCounter + // and doesn't set defaults + msg() *otg.PatternFlowIgmpv1GroupAddressCounter + // setMsg unmarshals PatternFlowIgmpv1GroupAddressCounter from protobuf object *otg.PatternFlowIgmpv1GroupAddressCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIgmpv1GroupAddressCounter) PatternFlowIgmpv1GroupAddressCounter + // provides marshal interface + Marshal() marshalPatternFlowIgmpv1GroupAddressCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIgmpv1GroupAddressCounter + // validate validates PatternFlowIgmpv1GroupAddressCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIgmpv1GroupAddressCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowIgmpv1GroupAddressCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowIgmpv1GroupAddressCounter + SetStart(value string) PatternFlowIgmpv1GroupAddressCounter + // HasStart checks if Start has been set in PatternFlowIgmpv1GroupAddressCounter + HasStart() bool + // Step returns string, set in PatternFlowIgmpv1GroupAddressCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowIgmpv1GroupAddressCounter + SetStep(value string) PatternFlowIgmpv1GroupAddressCounter + // HasStep checks if Step has been set in PatternFlowIgmpv1GroupAddressCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIgmpv1GroupAddressCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIgmpv1GroupAddressCounter + SetCount(value uint32) PatternFlowIgmpv1GroupAddressCounter + // HasCount checks if Count has been set in PatternFlowIgmpv1GroupAddressCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowIgmpv1GroupAddressCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowIgmpv1GroupAddressCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowIgmpv1GroupAddressCounter object +func (obj *patternFlowIgmpv1GroupAddressCounter) SetStart(value string) PatternFlowIgmpv1GroupAddressCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowIgmpv1GroupAddressCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowIgmpv1GroupAddressCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowIgmpv1GroupAddressCounter object +func (obj *patternFlowIgmpv1GroupAddressCounter) SetStep(value string) PatternFlowIgmpv1GroupAddressCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIgmpv1GroupAddressCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIgmpv1GroupAddressCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIgmpv1GroupAddressCounter object +func (obj *patternFlowIgmpv1GroupAddressCounter) SetCount(value uint32) PatternFlowIgmpv1GroupAddressCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIgmpv1GroupAddressCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateIpv4(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIgmpv1GroupAddressCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateIpv4(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIgmpv1GroupAddressCounter.Step")) + } + + } + +} + +func (obj *patternFlowIgmpv1GroupAddressCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("0.0.0.0") + } + if obj.obj.Step == nil { + obj.SetStep("0.0.0.1") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_igmpv1_group_address_metric_tag.go b/gosnappi/pattern_flow_igmpv1_group_address_metric_tag.go new file mode 100644 index 00000000..84ad3a57 --- /dev/null +++ b/gosnappi/pattern_flow_igmpv1_group_address_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIgmpv1GroupAddressMetricTag ***** +type patternFlowIgmpv1GroupAddressMetricTag struct { + validation + obj *otg.PatternFlowIgmpv1GroupAddressMetricTag + marshaller marshalPatternFlowIgmpv1GroupAddressMetricTag + unMarshaller unMarshalPatternFlowIgmpv1GroupAddressMetricTag +} + +func NewPatternFlowIgmpv1GroupAddressMetricTag() PatternFlowIgmpv1GroupAddressMetricTag { + obj := patternFlowIgmpv1GroupAddressMetricTag{obj: &otg.PatternFlowIgmpv1GroupAddressMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIgmpv1GroupAddressMetricTag) msg() *otg.PatternFlowIgmpv1GroupAddressMetricTag { + return obj.obj +} + +func (obj *patternFlowIgmpv1GroupAddressMetricTag) setMsg(msg *otg.PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIgmpv1GroupAddressMetricTag struct { + obj *patternFlowIgmpv1GroupAddressMetricTag +} + +type marshalPatternFlowIgmpv1GroupAddressMetricTag interface { + // ToProto marshals PatternFlowIgmpv1GroupAddressMetricTag to protobuf object *otg.PatternFlowIgmpv1GroupAddressMetricTag + ToProto() (*otg.PatternFlowIgmpv1GroupAddressMetricTag, error) + // ToPbText marshals PatternFlowIgmpv1GroupAddressMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIgmpv1GroupAddressMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIgmpv1GroupAddressMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIgmpv1GroupAddressMetricTag struct { + obj *patternFlowIgmpv1GroupAddressMetricTag +} + +type unMarshalPatternFlowIgmpv1GroupAddressMetricTag interface { + // FromProto unmarshals PatternFlowIgmpv1GroupAddressMetricTag from protobuf object *otg.PatternFlowIgmpv1GroupAddressMetricTag + FromProto(msg *otg.PatternFlowIgmpv1GroupAddressMetricTag) (PatternFlowIgmpv1GroupAddressMetricTag, error) + // FromPbText unmarshals PatternFlowIgmpv1GroupAddressMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIgmpv1GroupAddressMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIgmpv1GroupAddressMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIgmpv1GroupAddressMetricTag) Marshal() marshalPatternFlowIgmpv1GroupAddressMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIgmpv1GroupAddressMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIgmpv1GroupAddressMetricTag) Unmarshal() unMarshalPatternFlowIgmpv1GroupAddressMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIgmpv1GroupAddressMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIgmpv1GroupAddressMetricTag) ToProto() (*otg.PatternFlowIgmpv1GroupAddressMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIgmpv1GroupAddressMetricTag) FromProto(msg *otg.PatternFlowIgmpv1GroupAddressMetricTag) (PatternFlowIgmpv1GroupAddressMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIgmpv1GroupAddressMetricTag) 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 *unMarshalpatternFlowIgmpv1GroupAddressMetricTag) 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 *marshalpatternFlowIgmpv1GroupAddressMetricTag) 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 *unMarshalpatternFlowIgmpv1GroupAddressMetricTag) 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 *marshalpatternFlowIgmpv1GroupAddressMetricTag) 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 *unMarshalpatternFlowIgmpv1GroupAddressMetricTag) 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 *patternFlowIgmpv1GroupAddressMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1GroupAddressMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1GroupAddressMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIgmpv1GroupAddressMetricTag) Clone() (PatternFlowIgmpv1GroupAddressMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIgmpv1GroupAddressMetricTag() + 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 +} + +// PatternFlowIgmpv1GroupAddressMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIgmpv1GroupAddressMetricTag interface { + Validation + // msg marshals PatternFlowIgmpv1GroupAddressMetricTag to protobuf object *otg.PatternFlowIgmpv1GroupAddressMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIgmpv1GroupAddressMetricTag + // setMsg unmarshals PatternFlowIgmpv1GroupAddressMetricTag from protobuf object *otg.PatternFlowIgmpv1GroupAddressMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIgmpv1GroupAddressMetricTag) PatternFlowIgmpv1GroupAddressMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIgmpv1GroupAddressMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIgmpv1GroupAddressMetricTag + // validate validates PatternFlowIgmpv1GroupAddressMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIgmpv1GroupAddressMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIgmpv1GroupAddressMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIgmpv1GroupAddressMetricTag + SetName(value string) PatternFlowIgmpv1GroupAddressMetricTag + // Offset returns uint32, set in PatternFlowIgmpv1GroupAddressMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIgmpv1GroupAddressMetricTag + SetOffset(value uint32) PatternFlowIgmpv1GroupAddressMetricTag + // HasOffset checks if Offset has been set in PatternFlowIgmpv1GroupAddressMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIgmpv1GroupAddressMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIgmpv1GroupAddressMetricTag + SetLength(value uint32) PatternFlowIgmpv1GroupAddressMetricTag + // HasLength checks if Length has been set in PatternFlowIgmpv1GroupAddressMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIgmpv1GroupAddressMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIgmpv1GroupAddressMetricTag object +func (obj *patternFlowIgmpv1GroupAddressMetricTag) SetName(value string) PatternFlowIgmpv1GroupAddressMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIgmpv1GroupAddressMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIgmpv1GroupAddressMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIgmpv1GroupAddressMetricTag object +func (obj *patternFlowIgmpv1GroupAddressMetricTag) SetOffset(value uint32) PatternFlowIgmpv1GroupAddressMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIgmpv1GroupAddressMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIgmpv1GroupAddressMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIgmpv1GroupAddressMetricTag object +func (obj *patternFlowIgmpv1GroupAddressMetricTag) SetLength(value uint32) PatternFlowIgmpv1GroupAddressMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIgmpv1GroupAddressMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIgmpv1GroupAddressMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1GroupAddressMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIgmpv1GroupAddressMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIgmpv1GroupAddressMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(32) + } + +} diff --git a/gosnappi/pattern_flow_igmpv1_type.go b/gosnappi/pattern_flow_igmpv1_type.go new file mode 100644 index 00000000..2054fa67 --- /dev/null +++ b/gosnappi/pattern_flow_igmpv1_type.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIgmpv1Type ***** +type patternFlowIgmpv1Type struct { + validation + obj *otg.PatternFlowIgmpv1Type + marshaller marshalPatternFlowIgmpv1Type + unMarshaller unMarshalPatternFlowIgmpv1Type + incrementHolder PatternFlowIgmpv1TypeCounter + decrementHolder PatternFlowIgmpv1TypeCounter + metricTagsHolder PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter +} + +func NewPatternFlowIgmpv1Type() PatternFlowIgmpv1Type { + obj := patternFlowIgmpv1Type{obj: &otg.PatternFlowIgmpv1Type{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIgmpv1Type) msg() *otg.PatternFlowIgmpv1Type { + return obj.obj +} + +func (obj *patternFlowIgmpv1Type) setMsg(msg *otg.PatternFlowIgmpv1Type) PatternFlowIgmpv1Type { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIgmpv1Type struct { + obj *patternFlowIgmpv1Type +} + +type marshalPatternFlowIgmpv1Type interface { + // ToProto marshals PatternFlowIgmpv1Type to protobuf object *otg.PatternFlowIgmpv1Type + ToProto() (*otg.PatternFlowIgmpv1Type, error) + // ToPbText marshals PatternFlowIgmpv1Type to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIgmpv1Type to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIgmpv1Type to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIgmpv1Type struct { + obj *patternFlowIgmpv1Type +} + +type unMarshalPatternFlowIgmpv1Type interface { + // FromProto unmarshals PatternFlowIgmpv1Type from protobuf object *otg.PatternFlowIgmpv1Type + FromProto(msg *otg.PatternFlowIgmpv1Type) (PatternFlowIgmpv1Type, error) + // FromPbText unmarshals PatternFlowIgmpv1Type from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIgmpv1Type from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIgmpv1Type from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIgmpv1Type) Marshal() marshalPatternFlowIgmpv1Type { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIgmpv1Type{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIgmpv1Type) Unmarshal() unMarshalPatternFlowIgmpv1Type { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIgmpv1Type{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIgmpv1Type) ToProto() (*otg.PatternFlowIgmpv1Type, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIgmpv1Type) FromProto(msg *otg.PatternFlowIgmpv1Type) (PatternFlowIgmpv1Type, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIgmpv1Type) 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 *unMarshalpatternFlowIgmpv1Type) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIgmpv1Type) 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 *unMarshalpatternFlowIgmpv1Type) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIgmpv1Type) 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 *unMarshalpatternFlowIgmpv1Type) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIgmpv1Type) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1Type) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1Type) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIgmpv1Type) Clone() (PatternFlowIgmpv1Type, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIgmpv1Type() + 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 +} + +func (obj *patternFlowIgmpv1Type) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIgmpv1Type is type of message +type PatternFlowIgmpv1Type interface { + Validation + // msg marshals PatternFlowIgmpv1Type to protobuf object *otg.PatternFlowIgmpv1Type + // and doesn't set defaults + msg() *otg.PatternFlowIgmpv1Type + // setMsg unmarshals PatternFlowIgmpv1Type from protobuf object *otg.PatternFlowIgmpv1Type + // and doesn't set defaults + setMsg(*otg.PatternFlowIgmpv1Type) PatternFlowIgmpv1Type + // provides marshal interface + Marshal() marshalPatternFlowIgmpv1Type + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIgmpv1Type + // validate validates PatternFlowIgmpv1Type + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIgmpv1Type, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIgmpv1TypeChoiceEnum, set in PatternFlowIgmpv1Type + Choice() PatternFlowIgmpv1TypeChoiceEnum + // setChoice assigns PatternFlowIgmpv1TypeChoiceEnum provided by user to PatternFlowIgmpv1Type + setChoice(value PatternFlowIgmpv1TypeChoiceEnum) PatternFlowIgmpv1Type + // HasChoice checks if Choice has been set in PatternFlowIgmpv1Type + HasChoice() bool + // Value returns uint32, set in PatternFlowIgmpv1Type. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIgmpv1Type + SetValue(value uint32) PatternFlowIgmpv1Type + // HasValue checks if Value has been set in PatternFlowIgmpv1Type + HasValue() bool + // Values returns []uint32, set in PatternFlowIgmpv1Type. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIgmpv1Type + SetValues(value []uint32) PatternFlowIgmpv1Type + // Increment returns PatternFlowIgmpv1TypeCounter, set in PatternFlowIgmpv1Type. + // PatternFlowIgmpv1TypeCounter is integer counter pattern + Increment() PatternFlowIgmpv1TypeCounter + // SetIncrement assigns PatternFlowIgmpv1TypeCounter provided by user to PatternFlowIgmpv1Type. + // PatternFlowIgmpv1TypeCounter is integer counter pattern + SetIncrement(value PatternFlowIgmpv1TypeCounter) PatternFlowIgmpv1Type + // HasIncrement checks if Increment has been set in PatternFlowIgmpv1Type + HasIncrement() bool + // Decrement returns PatternFlowIgmpv1TypeCounter, set in PatternFlowIgmpv1Type. + // PatternFlowIgmpv1TypeCounter is integer counter pattern + Decrement() PatternFlowIgmpv1TypeCounter + // SetDecrement assigns PatternFlowIgmpv1TypeCounter provided by user to PatternFlowIgmpv1Type. + // PatternFlowIgmpv1TypeCounter is integer counter pattern + SetDecrement(value PatternFlowIgmpv1TypeCounter) PatternFlowIgmpv1Type + // HasDecrement checks if Decrement has been set in PatternFlowIgmpv1Type + HasDecrement() bool + // MetricTags returns PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIterIter, set in PatternFlowIgmpv1Type + MetricTags() PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter + setNil() +} + +type PatternFlowIgmpv1TypeChoiceEnum string + +// Enum of Choice on PatternFlowIgmpv1Type +var PatternFlowIgmpv1TypeChoice = struct { + VALUE PatternFlowIgmpv1TypeChoiceEnum + VALUES PatternFlowIgmpv1TypeChoiceEnum + INCREMENT PatternFlowIgmpv1TypeChoiceEnum + DECREMENT PatternFlowIgmpv1TypeChoiceEnum +}{ + VALUE: PatternFlowIgmpv1TypeChoiceEnum("value"), + VALUES: PatternFlowIgmpv1TypeChoiceEnum("values"), + INCREMENT: PatternFlowIgmpv1TypeChoiceEnum("increment"), + DECREMENT: PatternFlowIgmpv1TypeChoiceEnum("decrement"), +} + +func (obj *patternFlowIgmpv1Type) Choice() PatternFlowIgmpv1TypeChoiceEnum { + return PatternFlowIgmpv1TypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIgmpv1Type) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIgmpv1Type) setChoice(value PatternFlowIgmpv1TypeChoiceEnum) PatternFlowIgmpv1Type { + intValue, ok := otg.PatternFlowIgmpv1Type_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIgmpv1TypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIgmpv1Type_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIgmpv1TypeChoice.VALUE { + defaultValue := uint32(1) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIgmpv1TypeChoice.VALUES { + defaultValue := []uint32{1} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIgmpv1TypeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIgmpv1TypeCounter().msg() + } + + if value == PatternFlowIgmpv1TypeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIgmpv1TypeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIgmpv1Type) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIgmpv1TypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIgmpv1Type) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIgmpv1Type object +func (obj *patternFlowIgmpv1Type) SetValue(value uint32) PatternFlowIgmpv1Type { + obj.setChoice(PatternFlowIgmpv1TypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIgmpv1Type) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{1}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIgmpv1Type object +func (obj *patternFlowIgmpv1Type) SetValues(value []uint32) PatternFlowIgmpv1Type { + obj.setChoice(PatternFlowIgmpv1TypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIgmpv1TypeCounter +func (obj *patternFlowIgmpv1Type) Increment() PatternFlowIgmpv1TypeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIgmpv1TypeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIgmpv1TypeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIgmpv1TypeCounter +func (obj *patternFlowIgmpv1Type) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIgmpv1TypeCounter value in the PatternFlowIgmpv1Type object +func (obj *patternFlowIgmpv1Type) SetIncrement(value PatternFlowIgmpv1TypeCounter) PatternFlowIgmpv1Type { + obj.setChoice(PatternFlowIgmpv1TypeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIgmpv1TypeCounter +func (obj *patternFlowIgmpv1Type) Decrement() PatternFlowIgmpv1TypeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIgmpv1TypeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIgmpv1TypeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIgmpv1TypeCounter +func (obj *patternFlowIgmpv1Type) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIgmpv1TypeCounter value in the PatternFlowIgmpv1Type object +func (obj *patternFlowIgmpv1Type) SetDecrement(value PatternFlowIgmpv1TypeCounter) PatternFlowIgmpv1Type { + obj.setChoice(PatternFlowIgmpv1TypeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIgmpv1TypeMetricTag +func (obj *patternFlowIgmpv1Type) MetricTags() PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIgmpv1TypeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter struct { + obj *patternFlowIgmpv1Type + patternFlowIgmpv1TypeMetricTagSlice []PatternFlowIgmpv1TypeMetricTag + fieldPtr *[]*otg.PatternFlowIgmpv1TypeMetricTag +} + +func newPatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter(ptr *[]*otg.PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { + return &patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter interface { + setMsg(*patternFlowIgmpv1Type) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter + Items() []PatternFlowIgmpv1TypeMetricTag + Add() PatternFlowIgmpv1TypeMetricTag + Append(items ...PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter + Set(index int, newObj PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter + Clear() PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter + clearHolderSlice() PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter + appendHolderSlice(item PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter +} + +func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) setMsg(msg *patternFlowIgmpv1Type) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIgmpv1TypeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) Items() []PatternFlowIgmpv1TypeMetricTag { + return obj.patternFlowIgmpv1TypeMetricTagSlice +} + +func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) Add() PatternFlowIgmpv1TypeMetricTag { + newObj := &otg.PatternFlowIgmpv1TypeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIgmpv1TypeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIgmpv1TypeMetricTagSlice = append(obj.patternFlowIgmpv1TypeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) Append(items ...PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIgmpv1TypeMetricTagSlice = append(obj.patternFlowIgmpv1TypeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) Set(index int, newObj PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIgmpv1TypeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) Clear() PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIgmpv1TypeMetricTag{} + obj.patternFlowIgmpv1TypeMetricTagSlice = []PatternFlowIgmpv1TypeMetricTag{} + } + return obj +} +func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) clearHolderSlice() PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { + if len(obj.patternFlowIgmpv1TypeMetricTagSlice) > 0 { + obj.patternFlowIgmpv1TypeMetricTagSlice = []PatternFlowIgmpv1TypeMetricTag{} + } + return obj +} +func (obj *patternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter) appendHolderSlice(item PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypePatternFlowIgmpv1TypeMetricTagIter { + obj.patternFlowIgmpv1TypeMetricTagSlice = append(obj.patternFlowIgmpv1TypeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIgmpv1Type) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1Type.Value <= 15 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIgmpv1Type.Values <= 15 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIgmpv1TypeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIgmpv1Type) setDefault() { + var choices_set int = 0 + var choice PatternFlowIgmpv1TypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIgmpv1TypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIgmpv1TypeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIgmpv1TypeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIgmpv1TypeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIgmpv1TypeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIgmpv1Type") + } + } else { + intVal := otg.PatternFlowIgmpv1Type_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIgmpv1Type_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_igmpv1_type_counter.go b/gosnappi/pattern_flow_igmpv1_type_counter.go new file mode 100644 index 00000000..ccc7e247 --- /dev/null +++ b/gosnappi/pattern_flow_igmpv1_type_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIgmpv1TypeCounter ***** +type patternFlowIgmpv1TypeCounter struct { + validation + obj *otg.PatternFlowIgmpv1TypeCounter + marshaller marshalPatternFlowIgmpv1TypeCounter + unMarshaller unMarshalPatternFlowIgmpv1TypeCounter +} + +func NewPatternFlowIgmpv1TypeCounter() PatternFlowIgmpv1TypeCounter { + obj := patternFlowIgmpv1TypeCounter{obj: &otg.PatternFlowIgmpv1TypeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIgmpv1TypeCounter) msg() *otg.PatternFlowIgmpv1TypeCounter { + return obj.obj +} + +func (obj *patternFlowIgmpv1TypeCounter) setMsg(msg *otg.PatternFlowIgmpv1TypeCounter) PatternFlowIgmpv1TypeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIgmpv1TypeCounter struct { + obj *patternFlowIgmpv1TypeCounter +} + +type marshalPatternFlowIgmpv1TypeCounter interface { + // ToProto marshals PatternFlowIgmpv1TypeCounter to protobuf object *otg.PatternFlowIgmpv1TypeCounter + ToProto() (*otg.PatternFlowIgmpv1TypeCounter, error) + // ToPbText marshals PatternFlowIgmpv1TypeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIgmpv1TypeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIgmpv1TypeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIgmpv1TypeCounter struct { + obj *patternFlowIgmpv1TypeCounter +} + +type unMarshalPatternFlowIgmpv1TypeCounter interface { + // FromProto unmarshals PatternFlowIgmpv1TypeCounter from protobuf object *otg.PatternFlowIgmpv1TypeCounter + FromProto(msg *otg.PatternFlowIgmpv1TypeCounter) (PatternFlowIgmpv1TypeCounter, error) + // FromPbText unmarshals PatternFlowIgmpv1TypeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIgmpv1TypeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIgmpv1TypeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIgmpv1TypeCounter) Marshal() marshalPatternFlowIgmpv1TypeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIgmpv1TypeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIgmpv1TypeCounter) Unmarshal() unMarshalPatternFlowIgmpv1TypeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIgmpv1TypeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIgmpv1TypeCounter) ToProto() (*otg.PatternFlowIgmpv1TypeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIgmpv1TypeCounter) FromProto(msg *otg.PatternFlowIgmpv1TypeCounter) (PatternFlowIgmpv1TypeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIgmpv1TypeCounter) 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 *unMarshalpatternFlowIgmpv1TypeCounter) 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 *marshalpatternFlowIgmpv1TypeCounter) 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 *unMarshalpatternFlowIgmpv1TypeCounter) 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 *marshalpatternFlowIgmpv1TypeCounter) 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 *unMarshalpatternFlowIgmpv1TypeCounter) 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 *patternFlowIgmpv1TypeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1TypeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1TypeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIgmpv1TypeCounter) Clone() (PatternFlowIgmpv1TypeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIgmpv1TypeCounter() + 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 +} + +// PatternFlowIgmpv1TypeCounter is integer counter pattern +type PatternFlowIgmpv1TypeCounter interface { + Validation + // msg marshals PatternFlowIgmpv1TypeCounter to protobuf object *otg.PatternFlowIgmpv1TypeCounter + // and doesn't set defaults + msg() *otg.PatternFlowIgmpv1TypeCounter + // setMsg unmarshals PatternFlowIgmpv1TypeCounter from protobuf object *otg.PatternFlowIgmpv1TypeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIgmpv1TypeCounter) PatternFlowIgmpv1TypeCounter + // provides marshal interface + Marshal() marshalPatternFlowIgmpv1TypeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIgmpv1TypeCounter + // validate validates PatternFlowIgmpv1TypeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIgmpv1TypeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIgmpv1TypeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIgmpv1TypeCounter + SetStart(value uint32) PatternFlowIgmpv1TypeCounter + // HasStart checks if Start has been set in PatternFlowIgmpv1TypeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIgmpv1TypeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIgmpv1TypeCounter + SetStep(value uint32) PatternFlowIgmpv1TypeCounter + // HasStep checks if Step has been set in PatternFlowIgmpv1TypeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIgmpv1TypeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIgmpv1TypeCounter + SetCount(value uint32) PatternFlowIgmpv1TypeCounter + // HasCount checks if Count has been set in PatternFlowIgmpv1TypeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIgmpv1TypeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIgmpv1TypeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIgmpv1TypeCounter object +func (obj *patternFlowIgmpv1TypeCounter) SetStart(value uint32) PatternFlowIgmpv1TypeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIgmpv1TypeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIgmpv1TypeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIgmpv1TypeCounter object +func (obj *patternFlowIgmpv1TypeCounter) SetStep(value uint32) PatternFlowIgmpv1TypeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIgmpv1TypeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIgmpv1TypeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIgmpv1TypeCounter object +func (obj *patternFlowIgmpv1TypeCounter) SetCount(value uint32) PatternFlowIgmpv1TypeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIgmpv1TypeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1TypeCounter.Start <= 15 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1TypeCounter.Step <= 15 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1TypeCounter.Count <= 15 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIgmpv1TypeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_igmpv1_type_metric_tag.go b/gosnappi/pattern_flow_igmpv1_type_metric_tag.go new file mode 100644 index 00000000..28cc4401 --- /dev/null +++ b/gosnappi/pattern_flow_igmpv1_type_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIgmpv1TypeMetricTag ***** +type patternFlowIgmpv1TypeMetricTag struct { + validation + obj *otg.PatternFlowIgmpv1TypeMetricTag + marshaller marshalPatternFlowIgmpv1TypeMetricTag + unMarshaller unMarshalPatternFlowIgmpv1TypeMetricTag +} + +func NewPatternFlowIgmpv1TypeMetricTag() PatternFlowIgmpv1TypeMetricTag { + obj := patternFlowIgmpv1TypeMetricTag{obj: &otg.PatternFlowIgmpv1TypeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIgmpv1TypeMetricTag) msg() *otg.PatternFlowIgmpv1TypeMetricTag { + return obj.obj +} + +func (obj *patternFlowIgmpv1TypeMetricTag) setMsg(msg *otg.PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIgmpv1TypeMetricTag struct { + obj *patternFlowIgmpv1TypeMetricTag +} + +type marshalPatternFlowIgmpv1TypeMetricTag interface { + // ToProto marshals PatternFlowIgmpv1TypeMetricTag to protobuf object *otg.PatternFlowIgmpv1TypeMetricTag + ToProto() (*otg.PatternFlowIgmpv1TypeMetricTag, error) + // ToPbText marshals PatternFlowIgmpv1TypeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIgmpv1TypeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIgmpv1TypeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIgmpv1TypeMetricTag struct { + obj *patternFlowIgmpv1TypeMetricTag +} + +type unMarshalPatternFlowIgmpv1TypeMetricTag interface { + // FromProto unmarshals PatternFlowIgmpv1TypeMetricTag from protobuf object *otg.PatternFlowIgmpv1TypeMetricTag + FromProto(msg *otg.PatternFlowIgmpv1TypeMetricTag) (PatternFlowIgmpv1TypeMetricTag, error) + // FromPbText unmarshals PatternFlowIgmpv1TypeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIgmpv1TypeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIgmpv1TypeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIgmpv1TypeMetricTag) Marshal() marshalPatternFlowIgmpv1TypeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIgmpv1TypeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIgmpv1TypeMetricTag) Unmarshal() unMarshalPatternFlowIgmpv1TypeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIgmpv1TypeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIgmpv1TypeMetricTag) ToProto() (*otg.PatternFlowIgmpv1TypeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIgmpv1TypeMetricTag) FromProto(msg *otg.PatternFlowIgmpv1TypeMetricTag) (PatternFlowIgmpv1TypeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIgmpv1TypeMetricTag) 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 *unMarshalpatternFlowIgmpv1TypeMetricTag) 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 *marshalpatternFlowIgmpv1TypeMetricTag) 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 *unMarshalpatternFlowIgmpv1TypeMetricTag) 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 *marshalpatternFlowIgmpv1TypeMetricTag) 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 *unMarshalpatternFlowIgmpv1TypeMetricTag) 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 *patternFlowIgmpv1TypeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1TypeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1TypeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIgmpv1TypeMetricTag) Clone() (PatternFlowIgmpv1TypeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIgmpv1TypeMetricTag() + 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 +} + +// PatternFlowIgmpv1TypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIgmpv1TypeMetricTag interface { + Validation + // msg marshals PatternFlowIgmpv1TypeMetricTag to protobuf object *otg.PatternFlowIgmpv1TypeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIgmpv1TypeMetricTag + // setMsg unmarshals PatternFlowIgmpv1TypeMetricTag from protobuf object *otg.PatternFlowIgmpv1TypeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIgmpv1TypeMetricTag) PatternFlowIgmpv1TypeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIgmpv1TypeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIgmpv1TypeMetricTag + // validate validates PatternFlowIgmpv1TypeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIgmpv1TypeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIgmpv1TypeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIgmpv1TypeMetricTag + SetName(value string) PatternFlowIgmpv1TypeMetricTag + // Offset returns uint32, set in PatternFlowIgmpv1TypeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIgmpv1TypeMetricTag + SetOffset(value uint32) PatternFlowIgmpv1TypeMetricTag + // HasOffset checks if Offset has been set in PatternFlowIgmpv1TypeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIgmpv1TypeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIgmpv1TypeMetricTag + SetLength(value uint32) PatternFlowIgmpv1TypeMetricTag + // HasLength checks if Length has been set in PatternFlowIgmpv1TypeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIgmpv1TypeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIgmpv1TypeMetricTag object +func (obj *patternFlowIgmpv1TypeMetricTag) SetName(value string) PatternFlowIgmpv1TypeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIgmpv1TypeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIgmpv1TypeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIgmpv1TypeMetricTag object +func (obj *patternFlowIgmpv1TypeMetricTag) SetOffset(value uint32) PatternFlowIgmpv1TypeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIgmpv1TypeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIgmpv1TypeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIgmpv1TypeMetricTag object +func (obj *patternFlowIgmpv1TypeMetricTag) SetLength(value uint32) PatternFlowIgmpv1TypeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIgmpv1TypeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIgmpv1TypeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1TypeMetricTag.Offset <= 3 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 4 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIgmpv1TypeMetricTag.Length <= 4 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIgmpv1TypeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(4) + } + +} diff --git a/gosnappi/pattern_flow_igmpv1_unused.go b/gosnappi/pattern_flow_igmpv1_unused.go new file mode 100644 index 00000000..9d3a4c9b --- /dev/null +++ b/gosnappi/pattern_flow_igmpv1_unused.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIgmpv1Unused ***** +type patternFlowIgmpv1Unused struct { + validation + obj *otg.PatternFlowIgmpv1Unused + marshaller marshalPatternFlowIgmpv1Unused + unMarshaller unMarshalPatternFlowIgmpv1Unused + incrementHolder PatternFlowIgmpv1UnusedCounter + decrementHolder PatternFlowIgmpv1UnusedCounter + metricTagsHolder PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter +} + +func NewPatternFlowIgmpv1Unused() PatternFlowIgmpv1Unused { + obj := patternFlowIgmpv1Unused{obj: &otg.PatternFlowIgmpv1Unused{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIgmpv1Unused) msg() *otg.PatternFlowIgmpv1Unused { + return obj.obj +} + +func (obj *patternFlowIgmpv1Unused) setMsg(msg *otg.PatternFlowIgmpv1Unused) PatternFlowIgmpv1Unused { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIgmpv1Unused struct { + obj *patternFlowIgmpv1Unused +} + +type marshalPatternFlowIgmpv1Unused interface { + // ToProto marshals PatternFlowIgmpv1Unused to protobuf object *otg.PatternFlowIgmpv1Unused + ToProto() (*otg.PatternFlowIgmpv1Unused, error) + // ToPbText marshals PatternFlowIgmpv1Unused to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIgmpv1Unused to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIgmpv1Unused to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIgmpv1Unused struct { + obj *patternFlowIgmpv1Unused +} + +type unMarshalPatternFlowIgmpv1Unused interface { + // FromProto unmarshals PatternFlowIgmpv1Unused from protobuf object *otg.PatternFlowIgmpv1Unused + FromProto(msg *otg.PatternFlowIgmpv1Unused) (PatternFlowIgmpv1Unused, error) + // FromPbText unmarshals PatternFlowIgmpv1Unused from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIgmpv1Unused from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIgmpv1Unused from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIgmpv1Unused) Marshal() marshalPatternFlowIgmpv1Unused { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIgmpv1Unused{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIgmpv1Unused) Unmarshal() unMarshalPatternFlowIgmpv1Unused { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIgmpv1Unused{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIgmpv1Unused) ToProto() (*otg.PatternFlowIgmpv1Unused, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIgmpv1Unused) FromProto(msg *otg.PatternFlowIgmpv1Unused) (PatternFlowIgmpv1Unused, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIgmpv1Unused) 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 *unMarshalpatternFlowIgmpv1Unused) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIgmpv1Unused) 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 *unMarshalpatternFlowIgmpv1Unused) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIgmpv1Unused) 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 *unMarshalpatternFlowIgmpv1Unused) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIgmpv1Unused) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1Unused) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1Unused) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIgmpv1Unused) Clone() (PatternFlowIgmpv1Unused, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIgmpv1Unused() + 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 +} + +func (obj *patternFlowIgmpv1Unused) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIgmpv1Unused is unused +type PatternFlowIgmpv1Unused interface { + Validation + // msg marshals PatternFlowIgmpv1Unused to protobuf object *otg.PatternFlowIgmpv1Unused + // and doesn't set defaults + msg() *otg.PatternFlowIgmpv1Unused + // setMsg unmarshals PatternFlowIgmpv1Unused from protobuf object *otg.PatternFlowIgmpv1Unused + // and doesn't set defaults + setMsg(*otg.PatternFlowIgmpv1Unused) PatternFlowIgmpv1Unused + // provides marshal interface + Marshal() marshalPatternFlowIgmpv1Unused + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIgmpv1Unused + // validate validates PatternFlowIgmpv1Unused + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIgmpv1Unused, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIgmpv1UnusedChoiceEnum, set in PatternFlowIgmpv1Unused + Choice() PatternFlowIgmpv1UnusedChoiceEnum + // setChoice assigns PatternFlowIgmpv1UnusedChoiceEnum provided by user to PatternFlowIgmpv1Unused + setChoice(value PatternFlowIgmpv1UnusedChoiceEnum) PatternFlowIgmpv1Unused + // HasChoice checks if Choice has been set in PatternFlowIgmpv1Unused + HasChoice() bool + // Value returns uint32, set in PatternFlowIgmpv1Unused. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIgmpv1Unused + SetValue(value uint32) PatternFlowIgmpv1Unused + // HasValue checks if Value has been set in PatternFlowIgmpv1Unused + HasValue() bool + // Values returns []uint32, set in PatternFlowIgmpv1Unused. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIgmpv1Unused + SetValues(value []uint32) PatternFlowIgmpv1Unused + // Increment returns PatternFlowIgmpv1UnusedCounter, set in PatternFlowIgmpv1Unused. + // PatternFlowIgmpv1UnusedCounter is integer counter pattern + Increment() PatternFlowIgmpv1UnusedCounter + // SetIncrement assigns PatternFlowIgmpv1UnusedCounter provided by user to PatternFlowIgmpv1Unused. + // PatternFlowIgmpv1UnusedCounter is integer counter pattern + SetIncrement(value PatternFlowIgmpv1UnusedCounter) PatternFlowIgmpv1Unused + // HasIncrement checks if Increment has been set in PatternFlowIgmpv1Unused + HasIncrement() bool + // Decrement returns PatternFlowIgmpv1UnusedCounter, set in PatternFlowIgmpv1Unused. + // PatternFlowIgmpv1UnusedCounter is integer counter pattern + Decrement() PatternFlowIgmpv1UnusedCounter + // SetDecrement assigns PatternFlowIgmpv1UnusedCounter provided by user to PatternFlowIgmpv1Unused. + // PatternFlowIgmpv1UnusedCounter is integer counter pattern + SetDecrement(value PatternFlowIgmpv1UnusedCounter) PatternFlowIgmpv1Unused + // HasDecrement checks if Decrement has been set in PatternFlowIgmpv1Unused + HasDecrement() bool + // MetricTags returns PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIterIter, set in PatternFlowIgmpv1Unused + MetricTags() PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter + setNil() +} + +type PatternFlowIgmpv1UnusedChoiceEnum string + +// Enum of Choice on PatternFlowIgmpv1Unused +var PatternFlowIgmpv1UnusedChoice = struct { + VALUE PatternFlowIgmpv1UnusedChoiceEnum + VALUES PatternFlowIgmpv1UnusedChoiceEnum + INCREMENT PatternFlowIgmpv1UnusedChoiceEnum + DECREMENT PatternFlowIgmpv1UnusedChoiceEnum +}{ + VALUE: PatternFlowIgmpv1UnusedChoiceEnum("value"), + VALUES: PatternFlowIgmpv1UnusedChoiceEnum("values"), + INCREMENT: PatternFlowIgmpv1UnusedChoiceEnum("increment"), + DECREMENT: PatternFlowIgmpv1UnusedChoiceEnum("decrement"), +} + +func (obj *patternFlowIgmpv1Unused) Choice() PatternFlowIgmpv1UnusedChoiceEnum { + return PatternFlowIgmpv1UnusedChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIgmpv1Unused) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIgmpv1Unused) setChoice(value PatternFlowIgmpv1UnusedChoiceEnum) PatternFlowIgmpv1Unused { + intValue, ok := otg.PatternFlowIgmpv1Unused_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIgmpv1UnusedChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIgmpv1Unused_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIgmpv1UnusedChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIgmpv1UnusedChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIgmpv1UnusedChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIgmpv1UnusedCounter().msg() + } + + if value == PatternFlowIgmpv1UnusedChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIgmpv1UnusedCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIgmpv1Unused) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIgmpv1UnusedChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIgmpv1Unused) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIgmpv1Unused object +func (obj *patternFlowIgmpv1Unused) SetValue(value uint32) PatternFlowIgmpv1Unused { + obj.setChoice(PatternFlowIgmpv1UnusedChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIgmpv1Unused) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIgmpv1Unused object +func (obj *patternFlowIgmpv1Unused) SetValues(value []uint32) PatternFlowIgmpv1Unused { + obj.setChoice(PatternFlowIgmpv1UnusedChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIgmpv1UnusedCounter +func (obj *patternFlowIgmpv1Unused) Increment() PatternFlowIgmpv1UnusedCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIgmpv1UnusedChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIgmpv1UnusedCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIgmpv1UnusedCounter +func (obj *patternFlowIgmpv1Unused) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIgmpv1UnusedCounter value in the PatternFlowIgmpv1Unused object +func (obj *patternFlowIgmpv1Unused) SetIncrement(value PatternFlowIgmpv1UnusedCounter) PatternFlowIgmpv1Unused { + obj.setChoice(PatternFlowIgmpv1UnusedChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIgmpv1UnusedCounter +func (obj *patternFlowIgmpv1Unused) Decrement() PatternFlowIgmpv1UnusedCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIgmpv1UnusedChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIgmpv1UnusedCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIgmpv1UnusedCounter +func (obj *patternFlowIgmpv1Unused) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIgmpv1UnusedCounter value in the PatternFlowIgmpv1Unused object +func (obj *patternFlowIgmpv1Unused) SetDecrement(value PatternFlowIgmpv1UnusedCounter) PatternFlowIgmpv1Unused { + obj.setChoice(PatternFlowIgmpv1UnusedChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIgmpv1UnusedMetricTag +func (obj *patternFlowIgmpv1Unused) MetricTags() PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIgmpv1UnusedMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter struct { + obj *patternFlowIgmpv1Unused + patternFlowIgmpv1UnusedMetricTagSlice []PatternFlowIgmpv1UnusedMetricTag + fieldPtr *[]*otg.PatternFlowIgmpv1UnusedMetricTag +} + +func newPatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter(ptr *[]*otg.PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { + return &patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter interface { + setMsg(*patternFlowIgmpv1Unused) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter + Items() []PatternFlowIgmpv1UnusedMetricTag + Add() PatternFlowIgmpv1UnusedMetricTag + Append(items ...PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter + Set(index int, newObj PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter + Clear() PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter + clearHolderSlice() PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter + appendHolderSlice(item PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter +} + +func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) setMsg(msg *patternFlowIgmpv1Unused) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIgmpv1UnusedMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) Items() []PatternFlowIgmpv1UnusedMetricTag { + return obj.patternFlowIgmpv1UnusedMetricTagSlice +} + +func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) Add() PatternFlowIgmpv1UnusedMetricTag { + newObj := &otg.PatternFlowIgmpv1UnusedMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIgmpv1UnusedMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIgmpv1UnusedMetricTagSlice = append(obj.patternFlowIgmpv1UnusedMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) Append(items ...PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIgmpv1UnusedMetricTagSlice = append(obj.patternFlowIgmpv1UnusedMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) Set(index int, newObj PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIgmpv1UnusedMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) Clear() PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIgmpv1UnusedMetricTag{} + obj.patternFlowIgmpv1UnusedMetricTagSlice = []PatternFlowIgmpv1UnusedMetricTag{} + } + return obj +} +func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) clearHolderSlice() PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { + if len(obj.patternFlowIgmpv1UnusedMetricTagSlice) > 0 { + obj.patternFlowIgmpv1UnusedMetricTagSlice = []PatternFlowIgmpv1UnusedMetricTag{} + } + return obj +} +func (obj *patternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter) appendHolderSlice(item PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedPatternFlowIgmpv1UnusedMetricTagIter { + obj.patternFlowIgmpv1UnusedMetricTagSlice = append(obj.patternFlowIgmpv1UnusedMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIgmpv1Unused) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1Unused.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIgmpv1Unused.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIgmpv1UnusedMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIgmpv1Unused) setDefault() { + var choices_set int = 0 + var choice PatternFlowIgmpv1UnusedChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIgmpv1UnusedChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIgmpv1UnusedChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIgmpv1UnusedChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIgmpv1UnusedChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIgmpv1UnusedChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIgmpv1Unused") + } + } else { + intVal := otg.PatternFlowIgmpv1Unused_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIgmpv1Unused_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_igmpv1_unused_counter.go b/gosnappi/pattern_flow_igmpv1_unused_counter.go new file mode 100644 index 00000000..6aa1a9d5 --- /dev/null +++ b/gosnappi/pattern_flow_igmpv1_unused_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIgmpv1UnusedCounter ***** +type patternFlowIgmpv1UnusedCounter struct { + validation + obj *otg.PatternFlowIgmpv1UnusedCounter + marshaller marshalPatternFlowIgmpv1UnusedCounter + unMarshaller unMarshalPatternFlowIgmpv1UnusedCounter +} + +func NewPatternFlowIgmpv1UnusedCounter() PatternFlowIgmpv1UnusedCounter { + obj := patternFlowIgmpv1UnusedCounter{obj: &otg.PatternFlowIgmpv1UnusedCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIgmpv1UnusedCounter) msg() *otg.PatternFlowIgmpv1UnusedCounter { + return obj.obj +} + +func (obj *patternFlowIgmpv1UnusedCounter) setMsg(msg *otg.PatternFlowIgmpv1UnusedCounter) PatternFlowIgmpv1UnusedCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIgmpv1UnusedCounter struct { + obj *patternFlowIgmpv1UnusedCounter +} + +type marshalPatternFlowIgmpv1UnusedCounter interface { + // ToProto marshals PatternFlowIgmpv1UnusedCounter to protobuf object *otg.PatternFlowIgmpv1UnusedCounter + ToProto() (*otg.PatternFlowIgmpv1UnusedCounter, error) + // ToPbText marshals PatternFlowIgmpv1UnusedCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIgmpv1UnusedCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIgmpv1UnusedCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIgmpv1UnusedCounter struct { + obj *patternFlowIgmpv1UnusedCounter +} + +type unMarshalPatternFlowIgmpv1UnusedCounter interface { + // FromProto unmarshals PatternFlowIgmpv1UnusedCounter from protobuf object *otg.PatternFlowIgmpv1UnusedCounter + FromProto(msg *otg.PatternFlowIgmpv1UnusedCounter) (PatternFlowIgmpv1UnusedCounter, error) + // FromPbText unmarshals PatternFlowIgmpv1UnusedCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIgmpv1UnusedCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIgmpv1UnusedCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIgmpv1UnusedCounter) Marshal() marshalPatternFlowIgmpv1UnusedCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIgmpv1UnusedCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIgmpv1UnusedCounter) Unmarshal() unMarshalPatternFlowIgmpv1UnusedCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIgmpv1UnusedCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIgmpv1UnusedCounter) ToProto() (*otg.PatternFlowIgmpv1UnusedCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIgmpv1UnusedCounter) FromProto(msg *otg.PatternFlowIgmpv1UnusedCounter) (PatternFlowIgmpv1UnusedCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIgmpv1UnusedCounter) 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 *unMarshalpatternFlowIgmpv1UnusedCounter) 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 *marshalpatternFlowIgmpv1UnusedCounter) 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 *unMarshalpatternFlowIgmpv1UnusedCounter) 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 *marshalpatternFlowIgmpv1UnusedCounter) 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 *unMarshalpatternFlowIgmpv1UnusedCounter) 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 *patternFlowIgmpv1UnusedCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1UnusedCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1UnusedCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIgmpv1UnusedCounter) Clone() (PatternFlowIgmpv1UnusedCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIgmpv1UnusedCounter() + 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 +} + +// PatternFlowIgmpv1UnusedCounter is integer counter pattern +type PatternFlowIgmpv1UnusedCounter interface { + Validation + // msg marshals PatternFlowIgmpv1UnusedCounter to protobuf object *otg.PatternFlowIgmpv1UnusedCounter + // and doesn't set defaults + msg() *otg.PatternFlowIgmpv1UnusedCounter + // setMsg unmarshals PatternFlowIgmpv1UnusedCounter from protobuf object *otg.PatternFlowIgmpv1UnusedCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIgmpv1UnusedCounter) PatternFlowIgmpv1UnusedCounter + // provides marshal interface + Marshal() marshalPatternFlowIgmpv1UnusedCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIgmpv1UnusedCounter + // validate validates PatternFlowIgmpv1UnusedCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIgmpv1UnusedCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIgmpv1UnusedCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIgmpv1UnusedCounter + SetStart(value uint32) PatternFlowIgmpv1UnusedCounter + // HasStart checks if Start has been set in PatternFlowIgmpv1UnusedCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIgmpv1UnusedCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIgmpv1UnusedCounter + SetStep(value uint32) PatternFlowIgmpv1UnusedCounter + // HasStep checks if Step has been set in PatternFlowIgmpv1UnusedCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIgmpv1UnusedCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIgmpv1UnusedCounter + SetCount(value uint32) PatternFlowIgmpv1UnusedCounter + // HasCount checks if Count has been set in PatternFlowIgmpv1UnusedCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIgmpv1UnusedCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIgmpv1UnusedCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIgmpv1UnusedCounter object +func (obj *patternFlowIgmpv1UnusedCounter) SetStart(value uint32) PatternFlowIgmpv1UnusedCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIgmpv1UnusedCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIgmpv1UnusedCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIgmpv1UnusedCounter object +func (obj *patternFlowIgmpv1UnusedCounter) SetStep(value uint32) PatternFlowIgmpv1UnusedCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIgmpv1UnusedCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIgmpv1UnusedCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIgmpv1UnusedCounter object +func (obj *patternFlowIgmpv1UnusedCounter) SetCount(value uint32) PatternFlowIgmpv1UnusedCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIgmpv1UnusedCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1UnusedCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1UnusedCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1UnusedCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIgmpv1UnusedCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_igmpv1_unused_metric_tag.go b/gosnappi/pattern_flow_igmpv1_unused_metric_tag.go new file mode 100644 index 00000000..59ac6146 --- /dev/null +++ b/gosnappi/pattern_flow_igmpv1_unused_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIgmpv1UnusedMetricTag ***** +type patternFlowIgmpv1UnusedMetricTag struct { + validation + obj *otg.PatternFlowIgmpv1UnusedMetricTag + marshaller marshalPatternFlowIgmpv1UnusedMetricTag + unMarshaller unMarshalPatternFlowIgmpv1UnusedMetricTag +} + +func NewPatternFlowIgmpv1UnusedMetricTag() PatternFlowIgmpv1UnusedMetricTag { + obj := patternFlowIgmpv1UnusedMetricTag{obj: &otg.PatternFlowIgmpv1UnusedMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIgmpv1UnusedMetricTag) msg() *otg.PatternFlowIgmpv1UnusedMetricTag { + return obj.obj +} + +func (obj *patternFlowIgmpv1UnusedMetricTag) setMsg(msg *otg.PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIgmpv1UnusedMetricTag struct { + obj *patternFlowIgmpv1UnusedMetricTag +} + +type marshalPatternFlowIgmpv1UnusedMetricTag interface { + // ToProto marshals PatternFlowIgmpv1UnusedMetricTag to protobuf object *otg.PatternFlowIgmpv1UnusedMetricTag + ToProto() (*otg.PatternFlowIgmpv1UnusedMetricTag, error) + // ToPbText marshals PatternFlowIgmpv1UnusedMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIgmpv1UnusedMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIgmpv1UnusedMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIgmpv1UnusedMetricTag struct { + obj *patternFlowIgmpv1UnusedMetricTag +} + +type unMarshalPatternFlowIgmpv1UnusedMetricTag interface { + // FromProto unmarshals PatternFlowIgmpv1UnusedMetricTag from protobuf object *otg.PatternFlowIgmpv1UnusedMetricTag + FromProto(msg *otg.PatternFlowIgmpv1UnusedMetricTag) (PatternFlowIgmpv1UnusedMetricTag, error) + // FromPbText unmarshals PatternFlowIgmpv1UnusedMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIgmpv1UnusedMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIgmpv1UnusedMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIgmpv1UnusedMetricTag) Marshal() marshalPatternFlowIgmpv1UnusedMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIgmpv1UnusedMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIgmpv1UnusedMetricTag) Unmarshal() unMarshalPatternFlowIgmpv1UnusedMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIgmpv1UnusedMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIgmpv1UnusedMetricTag) ToProto() (*otg.PatternFlowIgmpv1UnusedMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIgmpv1UnusedMetricTag) FromProto(msg *otg.PatternFlowIgmpv1UnusedMetricTag) (PatternFlowIgmpv1UnusedMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIgmpv1UnusedMetricTag) 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 *unMarshalpatternFlowIgmpv1UnusedMetricTag) 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 *marshalpatternFlowIgmpv1UnusedMetricTag) 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 *unMarshalpatternFlowIgmpv1UnusedMetricTag) 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 *marshalpatternFlowIgmpv1UnusedMetricTag) 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 *unMarshalpatternFlowIgmpv1UnusedMetricTag) 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 *patternFlowIgmpv1UnusedMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1UnusedMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1UnusedMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIgmpv1UnusedMetricTag) Clone() (PatternFlowIgmpv1UnusedMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIgmpv1UnusedMetricTag() + 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 +} + +// PatternFlowIgmpv1UnusedMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIgmpv1UnusedMetricTag interface { + Validation + // msg marshals PatternFlowIgmpv1UnusedMetricTag to protobuf object *otg.PatternFlowIgmpv1UnusedMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIgmpv1UnusedMetricTag + // setMsg unmarshals PatternFlowIgmpv1UnusedMetricTag from protobuf object *otg.PatternFlowIgmpv1UnusedMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIgmpv1UnusedMetricTag) PatternFlowIgmpv1UnusedMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIgmpv1UnusedMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIgmpv1UnusedMetricTag + // validate validates PatternFlowIgmpv1UnusedMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIgmpv1UnusedMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIgmpv1UnusedMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIgmpv1UnusedMetricTag + SetName(value string) PatternFlowIgmpv1UnusedMetricTag + // Offset returns uint32, set in PatternFlowIgmpv1UnusedMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIgmpv1UnusedMetricTag + SetOffset(value uint32) PatternFlowIgmpv1UnusedMetricTag + // HasOffset checks if Offset has been set in PatternFlowIgmpv1UnusedMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIgmpv1UnusedMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIgmpv1UnusedMetricTag + SetLength(value uint32) PatternFlowIgmpv1UnusedMetricTag + // HasLength checks if Length has been set in PatternFlowIgmpv1UnusedMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIgmpv1UnusedMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIgmpv1UnusedMetricTag object +func (obj *patternFlowIgmpv1UnusedMetricTag) SetName(value string) PatternFlowIgmpv1UnusedMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIgmpv1UnusedMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIgmpv1UnusedMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIgmpv1UnusedMetricTag object +func (obj *patternFlowIgmpv1UnusedMetricTag) SetOffset(value uint32) PatternFlowIgmpv1UnusedMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIgmpv1UnusedMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIgmpv1UnusedMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIgmpv1UnusedMetricTag object +func (obj *patternFlowIgmpv1UnusedMetricTag) SetLength(value uint32) PatternFlowIgmpv1UnusedMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIgmpv1UnusedMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIgmpv1UnusedMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1UnusedMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIgmpv1UnusedMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIgmpv1UnusedMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_igmpv1_version.go b/gosnappi/pattern_flow_igmpv1_version.go new file mode 100644 index 00000000..a3509367 --- /dev/null +++ b/gosnappi/pattern_flow_igmpv1_version.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIgmpv1Version ***** +type patternFlowIgmpv1Version struct { + validation + obj *otg.PatternFlowIgmpv1Version + marshaller marshalPatternFlowIgmpv1Version + unMarshaller unMarshalPatternFlowIgmpv1Version + incrementHolder PatternFlowIgmpv1VersionCounter + decrementHolder PatternFlowIgmpv1VersionCounter + metricTagsHolder PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter +} + +func NewPatternFlowIgmpv1Version() PatternFlowIgmpv1Version { + obj := patternFlowIgmpv1Version{obj: &otg.PatternFlowIgmpv1Version{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIgmpv1Version) msg() *otg.PatternFlowIgmpv1Version { + return obj.obj +} + +func (obj *patternFlowIgmpv1Version) setMsg(msg *otg.PatternFlowIgmpv1Version) PatternFlowIgmpv1Version { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIgmpv1Version struct { + obj *patternFlowIgmpv1Version +} + +type marshalPatternFlowIgmpv1Version interface { + // ToProto marshals PatternFlowIgmpv1Version to protobuf object *otg.PatternFlowIgmpv1Version + ToProto() (*otg.PatternFlowIgmpv1Version, error) + // ToPbText marshals PatternFlowIgmpv1Version to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIgmpv1Version to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIgmpv1Version to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIgmpv1Version struct { + obj *patternFlowIgmpv1Version +} + +type unMarshalPatternFlowIgmpv1Version interface { + // FromProto unmarshals PatternFlowIgmpv1Version from protobuf object *otg.PatternFlowIgmpv1Version + FromProto(msg *otg.PatternFlowIgmpv1Version) (PatternFlowIgmpv1Version, error) + // FromPbText unmarshals PatternFlowIgmpv1Version from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIgmpv1Version from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIgmpv1Version from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIgmpv1Version) Marshal() marshalPatternFlowIgmpv1Version { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIgmpv1Version{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIgmpv1Version) Unmarshal() unMarshalPatternFlowIgmpv1Version { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIgmpv1Version{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIgmpv1Version) ToProto() (*otg.PatternFlowIgmpv1Version, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIgmpv1Version) FromProto(msg *otg.PatternFlowIgmpv1Version) (PatternFlowIgmpv1Version, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIgmpv1Version) 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 *unMarshalpatternFlowIgmpv1Version) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIgmpv1Version) 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 *unMarshalpatternFlowIgmpv1Version) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIgmpv1Version) 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 *unMarshalpatternFlowIgmpv1Version) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIgmpv1Version) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1Version) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1Version) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIgmpv1Version) Clone() (PatternFlowIgmpv1Version, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIgmpv1Version() + 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 +} + +func (obj *patternFlowIgmpv1Version) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIgmpv1Version is version number +type PatternFlowIgmpv1Version interface { + Validation + // msg marshals PatternFlowIgmpv1Version to protobuf object *otg.PatternFlowIgmpv1Version + // and doesn't set defaults + msg() *otg.PatternFlowIgmpv1Version + // setMsg unmarshals PatternFlowIgmpv1Version from protobuf object *otg.PatternFlowIgmpv1Version + // and doesn't set defaults + setMsg(*otg.PatternFlowIgmpv1Version) PatternFlowIgmpv1Version + // provides marshal interface + Marshal() marshalPatternFlowIgmpv1Version + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIgmpv1Version + // validate validates PatternFlowIgmpv1Version + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIgmpv1Version, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIgmpv1VersionChoiceEnum, set in PatternFlowIgmpv1Version + Choice() PatternFlowIgmpv1VersionChoiceEnum + // setChoice assigns PatternFlowIgmpv1VersionChoiceEnum provided by user to PatternFlowIgmpv1Version + setChoice(value PatternFlowIgmpv1VersionChoiceEnum) PatternFlowIgmpv1Version + // HasChoice checks if Choice has been set in PatternFlowIgmpv1Version + HasChoice() bool + // Value returns uint32, set in PatternFlowIgmpv1Version. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIgmpv1Version + SetValue(value uint32) PatternFlowIgmpv1Version + // HasValue checks if Value has been set in PatternFlowIgmpv1Version + HasValue() bool + // Values returns []uint32, set in PatternFlowIgmpv1Version. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIgmpv1Version + SetValues(value []uint32) PatternFlowIgmpv1Version + // Increment returns PatternFlowIgmpv1VersionCounter, set in PatternFlowIgmpv1Version. + // PatternFlowIgmpv1VersionCounter is integer counter pattern + Increment() PatternFlowIgmpv1VersionCounter + // SetIncrement assigns PatternFlowIgmpv1VersionCounter provided by user to PatternFlowIgmpv1Version. + // PatternFlowIgmpv1VersionCounter is integer counter pattern + SetIncrement(value PatternFlowIgmpv1VersionCounter) PatternFlowIgmpv1Version + // HasIncrement checks if Increment has been set in PatternFlowIgmpv1Version + HasIncrement() bool + // Decrement returns PatternFlowIgmpv1VersionCounter, set in PatternFlowIgmpv1Version. + // PatternFlowIgmpv1VersionCounter is integer counter pattern + Decrement() PatternFlowIgmpv1VersionCounter + // SetDecrement assigns PatternFlowIgmpv1VersionCounter provided by user to PatternFlowIgmpv1Version. + // PatternFlowIgmpv1VersionCounter is integer counter pattern + SetDecrement(value PatternFlowIgmpv1VersionCounter) PatternFlowIgmpv1Version + // HasDecrement checks if Decrement has been set in PatternFlowIgmpv1Version + HasDecrement() bool + // MetricTags returns PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIterIter, set in PatternFlowIgmpv1Version + MetricTags() PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter + setNil() +} + +type PatternFlowIgmpv1VersionChoiceEnum string + +// Enum of Choice on PatternFlowIgmpv1Version +var PatternFlowIgmpv1VersionChoice = struct { + VALUE PatternFlowIgmpv1VersionChoiceEnum + VALUES PatternFlowIgmpv1VersionChoiceEnum + INCREMENT PatternFlowIgmpv1VersionChoiceEnum + DECREMENT PatternFlowIgmpv1VersionChoiceEnum +}{ + VALUE: PatternFlowIgmpv1VersionChoiceEnum("value"), + VALUES: PatternFlowIgmpv1VersionChoiceEnum("values"), + INCREMENT: PatternFlowIgmpv1VersionChoiceEnum("increment"), + DECREMENT: PatternFlowIgmpv1VersionChoiceEnum("decrement"), +} + +func (obj *patternFlowIgmpv1Version) Choice() PatternFlowIgmpv1VersionChoiceEnum { + return PatternFlowIgmpv1VersionChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIgmpv1Version) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIgmpv1Version) setChoice(value PatternFlowIgmpv1VersionChoiceEnum) PatternFlowIgmpv1Version { + intValue, ok := otg.PatternFlowIgmpv1Version_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIgmpv1VersionChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIgmpv1Version_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIgmpv1VersionChoice.VALUE { + defaultValue := uint32(1) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIgmpv1VersionChoice.VALUES { + defaultValue := []uint32{1} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIgmpv1VersionChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIgmpv1VersionCounter().msg() + } + + if value == PatternFlowIgmpv1VersionChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIgmpv1VersionCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIgmpv1Version) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIgmpv1VersionChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIgmpv1Version) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIgmpv1Version object +func (obj *patternFlowIgmpv1Version) SetValue(value uint32) PatternFlowIgmpv1Version { + obj.setChoice(PatternFlowIgmpv1VersionChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIgmpv1Version) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{1}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIgmpv1Version object +func (obj *patternFlowIgmpv1Version) SetValues(value []uint32) PatternFlowIgmpv1Version { + obj.setChoice(PatternFlowIgmpv1VersionChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIgmpv1VersionCounter +func (obj *patternFlowIgmpv1Version) Increment() PatternFlowIgmpv1VersionCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIgmpv1VersionChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIgmpv1VersionCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIgmpv1VersionCounter +func (obj *patternFlowIgmpv1Version) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIgmpv1VersionCounter value in the PatternFlowIgmpv1Version object +func (obj *patternFlowIgmpv1Version) SetIncrement(value PatternFlowIgmpv1VersionCounter) PatternFlowIgmpv1Version { + obj.setChoice(PatternFlowIgmpv1VersionChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIgmpv1VersionCounter +func (obj *patternFlowIgmpv1Version) Decrement() PatternFlowIgmpv1VersionCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIgmpv1VersionChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIgmpv1VersionCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIgmpv1VersionCounter +func (obj *patternFlowIgmpv1Version) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIgmpv1VersionCounter value in the PatternFlowIgmpv1Version object +func (obj *patternFlowIgmpv1Version) SetDecrement(value PatternFlowIgmpv1VersionCounter) PatternFlowIgmpv1Version { + obj.setChoice(PatternFlowIgmpv1VersionChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIgmpv1VersionMetricTag +func (obj *patternFlowIgmpv1Version) MetricTags() PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIgmpv1VersionMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter struct { + obj *patternFlowIgmpv1Version + patternFlowIgmpv1VersionMetricTagSlice []PatternFlowIgmpv1VersionMetricTag + fieldPtr *[]*otg.PatternFlowIgmpv1VersionMetricTag +} + +func newPatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter(ptr *[]*otg.PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { + return &patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter interface { + setMsg(*patternFlowIgmpv1Version) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter + Items() []PatternFlowIgmpv1VersionMetricTag + Add() PatternFlowIgmpv1VersionMetricTag + Append(items ...PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter + Set(index int, newObj PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter + Clear() PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter + clearHolderSlice() PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter + appendHolderSlice(item PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter +} + +func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) setMsg(msg *patternFlowIgmpv1Version) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIgmpv1VersionMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) Items() []PatternFlowIgmpv1VersionMetricTag { + return obj.patternFlowIgmpv1VersionMetricTagSlice +} + +func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) Add() PatternFlowIgmpv1VersionMetricTag { + newObj := &otg.PatternFlowIgmpv1VersionMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIgmpv1VersionMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIgmpv1VersionMetricTagSlice = append(obj.patternFlowIgmpv1VersionMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) Append(items ...PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIgmpv1VersionMetricTagSlice = append(obj.patternFlowIgmpv1VersionMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) Set(index int, newObj PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIgmpv1VersionMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) Clear() PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIgmpv1VersionMetricTag{} + obj.patternFlowIgmpv1VersionMetricTagSlice = []PatternFlowIgmpv1VersionMetricTag{} + } + return obj +} +func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) clearHolderSlice() PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { + if len(obj.patternFlowIgmpv1VersionMetricTagSlice) > 0 { + obj.patternFlowIgmpv1VersionMetricTagSlice = []PatternFlowIgmpv1VersionMetricTag{} + } + return obj +} +func (obj *patternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter) appendHolderSlice(item PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionPatternFlowIgmpv1VersionMetricTagIter { + obj.patternFlowIgmpv1VersionMetricTagSlice = append(obj.patternFlowIgmpv1VersionMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIgmpv1Version) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1Version.Value <= 15 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIgmpv1Version.Values <= 15 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIgmpv1VersionMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIgmpv1Version) setDefault() { + var choices_set int = 0 + var choice PatternFlowIgmpv1VersionChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIgmpv1VersionChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIgmpv1VersionChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIgmpv1VersionChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIgmpv1VersionChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIgmpv1VersionChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIgmpv1Version") + } + } else { + intVal := otg.PatternFlowIgmpv1Version_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIgmpv1Version_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_igmpv1_version_counter.go b/gosnappi/pattern_flow_igmpv1_version_counter.go new file mode 100644 index 00000000..a1eed87b --- /dev/null +++ b/gosnappi/pattern_flow_igmpv1_version_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIgmpv1VersionCounter ***** +type patternFlowIgmpv1VersionCounter struct { + validation + obj *otg.PatternFlowIgmpv1VersionCounter + marshaller marshalPatternFlowIgmpv1VersionCounter + unMarshaller unMarshalPatternFlowIgmpv1VersionCounter +} + +func NewPatternFlowIgmpv1VersionCounter() PatternFlowIgmpv1VersionCounter { + obj := patternFlowIgmpv1VersionCounter{obj: &otg.PatternFlowIgmpv1VersionCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIgmpv1VersionCounter) msg() *otg.PatternFlowIgmpv1VersionCounter { + return obj.obj +} + +func (obj *patternFlowIgmpv1VersionCounter) setMsg(msg *otg.PatternFlowIgmpv1VersionCounter) PatternFlowIgmpv1VersionCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIgmpv1VersionCounter struct { + obj *patternFlowIgmpv1VersionCounter +} + +type marshalPatternFlowIgmpv1VersionCounter interface { + // ToProto marshals PatternFlowIgmpv1VersionCounter to protobuf object *otg.PatternFlowIgmpv1VersionCounter + ToProto() (*otg.PatternFlowIgmpv1VersionCounter, error) + // ToPbText marshals PatternFlowIgmpv1VersionCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIgmpv1VersionCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIgmpv1VersionCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIgmpv1VersionCounter struct { + obj *patternFlowIgmpv1VersionCounter +} + +type unMarshalPatternFlowIgmpv1VersionCounter interface { + // FromProto unmarshals PatternFlowIgmpv1VersionCounter from protobuf object *otg.PatternFlowIgmpv1VersionCounter + FromProto(msg *otg.PatternFlowIgmpv1VersionCounter) (PatternFlowIgmpv1VersionCounter, error) + // FromPbText unmarshals PatternFlowIgmpv1VersionCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIgmpv1VersionCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIgmpv1VersionCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIgmpv1VersionCounter) Marshal() marshalPatternFlowIgmpv1VersionCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIgmpv1VersionCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIgmpv1VersionCounter) Unmarshal() unMarshalPatternFlowIgmpv1VersionCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIgmpv1VersionCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIgmpv1VersionCounter) ToProto() (*otg.PatternFlowIgmpv1VersionCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIgmpv1VersionCounter) FromProto(msg *otg.PatternFlowIgmpv1VersionCounter) (PatternFlowIgmpv1VersionCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIgmpv1VersionCounter) 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 *unMarshalpatternFlowIgmpv1VersionCounter) 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 *marshalpatternFlowIgmpv1VersionCounter) 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 *unMarshalpatternFlowIgmpv1VersionCounter) 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 *marshalpatternFlowIgmpv1VersionCounter) 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 *unMarshalpatternFlowIgmpv1VersionCounter) 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 *patternFlowIgmpv1VersionCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1VersionCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1VersionCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIgmpv1VersionCounter) Clone() (PatternFlowIgmpv1VersionCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIgmpv1VersionCounter() + 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 +} + +// PatternFlowIgmpv1VersionCounter is integer counter pattern +type PatternFlowIgmpv1VersionCounter interface { + Validation + // msg marshals PatternFlowIgmpv1VersionCounter to protobuf object *otg.PatternFlowIgmpv1VersionCounter + // and doesn't set defaults + msg() *otg.PatternFlowIgmpv1VersionCounter + // setMsg unmarshals PatternFlowIgmpv1VersionCounter from protobuf object *otg.PatternFlowIgmpv1VersionCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIgmpv1VersionCounter) PatternFlowIgmpv1VersionCounter + // provides marshal interface + Marshal() marshalPatternFlowIgmpv1VersionCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIgmpv1VersionCounter + // validate validates PatternFlowIgmpv1VersionCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIgmpv1VersionCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIgmpv1VersionCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIgmpv1VersionCounter + SetStart(value uint32) PatternFlowIgmpv1VersionCounter + // HasStart checks if Start has been set in PatternFlowIgmpv1VersionCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIgmpv1VersionCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIgmpv1VersionCounter + SetStep(value uint32) PatternFlowIgmpv1VersionCounter + // HasStep checks if Step has been set in PatternFlowIgmpv1VersionCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIgmpv1VersionCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIgmpv1VersionCounter + SetCount(value uint32) PatternFlowIgmpv1VersionCounter + // HasCount checks if Count has been set in PatternFlowIgmpv1VersionCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIgmpv1VersionCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIgmpv1VersionCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIgmpv1VersionCounter object +func (obj *patternFlowIgmpv1VersionCounter) SetStart(value uint32) PatternFlowIgmpv1VersionCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIgmpv1VersionCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIgmpv1VersionCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIgmpv1VersionCounter object +func (obj *patternFlowIgmpv1VersionCounter) SetStep(value uint32) PatternFlowIgmpv1VersionCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIgmpv1VersionCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIgmpv1VersionCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIgmpv1VersionCounter object +func (obj *patternFlowIgmpv1VersionCounter) SetCount(value uint32) PatternFlowIgmpv1VersionCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIgmpv1VersionCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1VersionCounter.Start <= 15 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1VersionCounter.Step <= 15 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1VersionCounter.Count <= 15 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIgmpv1VersionCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_igmpv1_version_metric_tag.go b/gosnappi/pattern_flow_igmpv1_version_metric_tag.go new file mode 100644 index 00000000..7f428146 --- /dev/null +++ b/gosnappi/pattern_flow_igmpv1_version_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIgmpv1VersionMetricTag ***** +type patternFlowIgmpv1VersionMetricTag struct { + validation + obj *otg.PatternFlowIgmpv1VersionMetricTag + marshaller marshalPatternFlowIgmpv1VersionMetricTag + unMarshaller unMarshalPatternFlowIgmpv1VersionMetricTag +} + +func NewPatternFlowIgmpv1VersionMetricTag() PatternFlowIgmpv1VersionMetricTag { + obj := patternFlowIgmpv1VersionMetricTag{obj: &otg.PatternFlowIgmpv1VersionMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIgmpv1VersionMetricTag) msg() *otg.PatternFlowIgmpv1VersionMetricTag { + return obj.obj +} + +func (obj *patternFlowIgmpv1VersionMetricTag) setMsg(msg *otg.PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIgmpv1VersionMetricTag struct { + obj *patternFlowIgmpv1VersionMetricTag +} + +type marshalPatternFlowIgmpv1VersionMetricTag interface { + // ToProto marshals PatternFlowIgmpv1VersionMetricTag to protobuf object *otg.PatternFlowIgmpv1VersionMetricTag + ToProto() (*otg.PatternFlowIgmpv1VersionMetricTag, error) + // ToPbText marshals PatternFlowIgmpv1VersionMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIgmpv1VersionMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIgmpv1VersionMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIgmpv1VersionMetricTag struct { + obj *patternFlowIgmpv1VersionMetricTag +} + +type unMarshalPatternFlowIgmpv1VersionMetricTag interface { + // FromProto unmarshals PatternFlowIgmpv1VersionMetricTag from protobuf object *otg.PatternFlowIgmpv1VersionMetricTag + FromProto(msg *otg.PatternFlowIgmpv1VersionMetricTag) (PatternFlowIgmpv1VersionMetricTag, error) + // FromPbText unmarshals PatternFlowIgmpv1VersionMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIgmpv1VersionMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIgmpv1VersionMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIgmpv1VersionMetricTag) Marshal() marshalPatternFlowIgmpv1VersionMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIgmpv1VersionMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIgmpv1VersionMetricTag) Unmarshal() unMarshalPatternFlowIgmpv1VersionMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIgmpv1VersionMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIgmpv1VersionMetricTag) ToProto() (*otg.PatternFlowIgmpv1VersionMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIgmpv1VersionMetricTag) FromProto(msg *otg.PatternFlowIgmpv1VersionMetricTag) (PatternFlowIgmpv1VersionMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIgmpv1VersionMetricTag) 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 *unMarshalpatternFlowIgmpv1VersionMetricTag) 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 *marshalpatternFlowIgmpv1VersionMetricTag) 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 *unMarshalpatternFlowIgmpv1VersionMetricTag) 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 *marshalpatternFlowIgmpv1VersionMetricTag) 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 *unMarshalpatternFlowIgmpv1VersionMetricTag) 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 *patternFlowIgmpv1VersionMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1VersionMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIgmpv1VersionMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIgmpv1VersionMetricTag) Clone() (PatternFlowIgmpv1VersionMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIgmpv1VersionMetricTag() + 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 +} + +// PatternFlowIgmpv1VersionMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIgmpv1VersionMetricTag interface { + Validation + // msg marshals PatternFlowIgmpv1VersionMetricTag to protobuf object *otg.PatternFlowIgmpv1VersionMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIgmpv1VersionMetricTag + // setMsg unmarshals PatternFlowIgmpv1VersionMetricTag from protobuf object *otg.PatternFlowIgmpv1VersionMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIgmpv1VersionMetricTag) PatternFlowIgmpv1VersionMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIgmpv1VersionMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIgmpv1VersionMetricTag + // validate validates PatternFlowIgmpv1VersionMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIgmpv1VersionMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIgmpv1VersionMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIgmpv1VersionMetricTag + SetName(value string) PatternFlowIgmpv1VersionMetricTag + // Offset returns uint32, set in PatternFlowIgmpv1VersionMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIgmpv1VersionMetricTag + SetOffset(value uint32) PatternFlowIgmpv1VersionMetricTag + // HasOffset checks if Offset has been set in PatternFlowIgmpv1VersionMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIgmpv1VersionMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIgmpv1VersionMetricTag + SetLength(value uint32) PatternFlowIgmpv1VersionMetricTag + // HasLength checks if Length has been set in PatternFlowIgmpv1VersionMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIgmpv1VersionMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIgmpv1VersionMetricTag object +func (obj *patternFlowIgmpv1VersionMetricTag) SetName(value string) PatternFlowIgmpv1VersionMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIgmpv1VersionMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIgmpv1VersionMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIgmpv1VersionMetricTag object +func (obj *patternFlowIgmpv1VersionMetricTag) SetOffset(value uint32) PatternFlowIgmpv1VersionMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIgmpv1VersionMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIgmpv1VersionMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIgmpv1VersionMetricTag object +func (obj *patternFlowIgmpv1VersionMetricTag) SetLength(value uint32) PatternFlowIgmpv1VersionMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIgmpv1VersionMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIgmpv1VersionMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIgmpv1VersionMetricTag.Offset <= 3 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 4 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIgmpv1VersionMetricTag.Length <= 4 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIgmpv1VersionMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(4) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_dont_fragment.go b/gosnappi/pattern_flow_ipv4_dont_fragment.go new file mode 100644 index 00000000..6c369495 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_dont_fragment.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4DontFragment ***** +type patternFlowIpv4DontFragment struct { + validation + obj *otg.PatternFlowIpv4DontFragment + marshaller marshalPatternFlowIpv4DontFragment + unMarshaller unMarshalPatternFlowIpv4DontFragment + incrementHolder PatternFlowIpv4DontFragmentCounter + decrementHolder PatternFlowIpv4DontFragmentCounter + metricTagsHolder PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter +} + +func NewPatternFlowIpv4DontFragment() PatternFlowIpv4DontFragment { + obj := patternFlowIpv4DontFragment{obj: &otg.PatternFlowIpv4DontFragment{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4DontFragment) msg() *otg.PatternFlowIpv4DontFragment { + return obj.obj +} + +func (obj *patternFlowIpv4DontFragment) setMsg(msg *otg.PatternFlowIpv4DontFragment) PatternFlowIpv4DontFragment { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4DontFragment struct { + obj *patternFlowIpv4DontFragment +} + +type marshalPatternFlowIpv4DontFragment interface { + // ToProto marshals PatternFlowIpv4DontFragment to protobuf object *otg.PatternFlowIpv4DontFragment + ToProto() (*otg.PatternFlowIpv4DontFragment, error) + // ToPbText marshals PatternFlowIpv4DontFragment to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4DontFragment to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4DontFragment to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4DontFragment struct { + obj *patternFlowIpv4DontFragment +} + +type unMarshalPatternFlowIpv4DontFragment interface { + // FromProto unmarshals PatternFlowIpv4DontFragment from protobuf object *otg.PatternFlowIpv4DontFragment + FromProto(msg *otg.PatternFlowIpv4DontFragment) (PatternFlowIpv4DontFragment, error) + // FromPbText unmarshals PatternFlowIpv4DontFragment from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4DontFragment from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4DontFragment from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4DontFragment) Marshal() marshalPatternFlowIpv4DontFragment { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4DontFragment{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4DontFragment) Unmarshal() unMarshalPatternFlowIpv4DontFragment { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4DontFragment{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4DontFragment) ToProto() (*otg.PatternFlowIpv4DontFragment, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4DontFragment) FromProto(msg *otg.PatternFlowIpv4DontFragment) (PatternFlowIpv4DontFragment, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4DontFragment) 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 *unMarshalpatternFlowIpv4DontFragment) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4DontFragment) 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 *unMarshalpatternFlowIpv4DontFragment) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4DontFragment) 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 *unMarshalpatternFlowIpv4DontFragment) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4DontFragment) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DontFragment) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DontFragment) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4DontFragment) Clone() (PatternFlowIpv4DontFragment, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4DontFragment() + 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 +} + +func (obj *patternFlowIpv4DontFragment) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4DontFragment is dont fragment flag If the dont_fragment flag is set and fragmentation is required to route the packet then the packet is dropped. +type PatternFlowIpv4DontFragment interface { + Validation + // msg marshals PatternFlowIpv4DontFragment to protobuf object *otg.PatternFlowIpv4DontFragment + // and doesn't set defaults + msg() *otg.PatternFlowIpv4DontFragment + // setMsg unmarshals PatternFlowIpv4DontFragment from protobuf object *otg.PatternFlowIpv4DontFragment + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4DontFragment) PatternFlowIpv4DontFragment + // provides marshal interface + Marshal() marshalPatternFlowIpv4DontFragment + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4DontFragment + // validate validates PatternFlowIpv4DontFragment + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4DontFragment, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4DontFragmentChoiceEnum, set in PatternFlowIpv4DontFragment + Choice() PatternFlowIpv4DontFragmentChoiceEnum + // setChoice assigns PatternFlowIpv4DontFragmentChoiceEnum provided by user to PatternFlowIpv4DontFragment + setChoice(value PatternFlowIpv4DontFragmentChoiceEnum) PatternFlowIpv4DontFragment + // HasChoice checks if Choice has been set in PatternFlowIpv4DontFragment + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4DontFragment. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4DontFragment + SetValue(value uint32) PatternFlowIpv4DontFragment + // HasValue checks if Value has been set in PatternFlowIpv4DontFragment + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4DontFragment. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4DontFragment + SetValues(value []uint32) PatternFlowIpv4DontFragment + // Increment returns PatternFlowIpv4DontFragmentCounter, set in PatternFlowIpv4DontFragment. + // PatternFlowIpv4DontFragmentCounter is integer counter pattern + Increment() PatternFlowIpv4DontFragmentCounter + // SetIncrement assigns PatternFlowIpv4DontFragmentCounter provided by user to PatternFlowIpv4DontFragment. + // PatternFlowIpv4DontFragmentCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4DontFragmentCounter) PatternFlowIpv4DontFragment + // HasIncrement checks if Increment has been set in PatternFlowIpv4DontFragment + HasIncrement() bool + // Decrement returns PatternFlowIpv4DontFragmentCounter, set in PatternFlowIpv4DontFragment. + // PatternFlowIpv4DontFragmentCounter is integer counter pattern + Decrement() PatternFlowIpv4DontFragmentCounter + // SetDecrement assigns PatternFlowIpv4DontFragmentCounter provided by user to PatternFlowIpv4DontFragment. + // PatternFlowIpv4DontFragmentCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4DontFragmentCounter) PatternFlowIpv4DontFragment + // HasDecrement checks if Decrement has been set in PatternFlowIpv4DontFragment + HasDecrement() bool + // MetricTags returns PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIterIter, set in PatternFlowIpv4DontFragment + MetricTags() PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter + setNil() +} + +type PatternFlowIpv4DontFragmentChoiceEnum string + +// Enum of Choice on PatternFlowIpv4DontFragment +var PatternFlowIpv4DontFragmentChoice = struct { + VALUE PatternFlowIpv4DontFragmentChoiceEnum + VALUES PatternFlowIpv4DontFragmentChoiceEnum + INCREMENT PatternFlowIpv4DontFragmentChoiceEnum + DECREMENT PatternFlowIpv4DontFragmentChoiceEnum +}{ + VALUE: PatternFlowIpv4DontFragmentChoiceEnum("value"), + VALUES: PatternFlowIpv4DontFragmentChoiceEnum("values"), + INCREMENT: PatternFlowIpv4DontFragmentChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4DontFragmentChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4DontFragment) Choice() PatternFlowIpv4DontFragmentChoiceEnum { + return PatternFlowIpv4DontFragmentChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4DontFragment) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4DontFragment) setChoice(value PatternFlowIpv4DontFragmentChoiceEnum) PatternFlowIpv4DontFragment { + intValue, ok := otg.PatternFlowIpv4DontFragment_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4DontFragmentChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4DontFragment_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4DontFragmentChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4DontFragmentChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4DontFragmentChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4DontFragmentCounter().msg() + } + + if value == PatternFlowIpv4DontFragmentChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4DontFragmentCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4DontFragment) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4DontFragmentChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4DontFragment) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4DontFragment object +func (obj *patternFlowIpv4DontFragment) SetValue(value uint32) PatternFlowIpv4DontFragment { + obj.setChoice(PatternFlowIpv4DontFragmentChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4DontFragment) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4DontFragment object +func (obj *patternFlowIpv4DontFragment) SetValues(value []uint32) PatternFlowIpv4DontFragment { + obj.setChoice(PatternFlowIpv4DontFragmentChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4DontFragmentCounter +func (obj *patternFlowIpv4DontFragment) Increment() PatternFlowIpv4DontFragmentCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4DontFragmentChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4DontFragmentCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4DontFragmentCounter +func (obj *patternFlowIpv4DontFragment) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4DontFragmentCounter value in the PatternFlowIpv4DontFragment object +func (obj *patternFlowIpv4DontFragment) SetIncrement(value PatternFlowIpv4DontFragmentCounter) PatternFlowIpv4DontFragment { + obj.setChoice(PatternFlowIpv4DontFragmentChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4DontFragmentCounter +func (obj *patternFlowIpv4DontFragment) Decrement() PatternFlowIpv4DontFragmentCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4DontFragmentChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4DontFragmentCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4DontFragmentCounter +func (obj *patternFlowIpv4DontFragment) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4DontFragmentCounter value in the PatternFlowIpv4DontFragment object +func (obj *patternFlowIpv4DontFragment) SetDecrement(value PatternFlowIpv4DontFragmentCounter) PatternFlowIpv4DontFragment { + obj.setChoice(PatternFlowIpv4DontFragmentChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4DontFragmentMetricTag +func (obj *patternFlowIpv4DontFragment) MetricTags() PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4DontFragmentMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter struct { + obj *patternFlowIpv4DontFragment + patternFlowIpv4DontFragmentMetricTagSlice []PatternFlowIpv4DontFragmentMetricTag + fieldPtr *[]*otg.PatternFlowIpv4DontFragmentMetricTag +} + +func newPatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter(ptr *[]*otg.PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { + return &patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter interface { + setMsg(*patternFlowIpv4DontFragment) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter + Items() []PatternFlowIpv4DontFragmentMetricTag + Add() PatternFlowIpv4DontFragmentMetricTag + Append(items ...PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter + Set(index int, newObj PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter + Clear() PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter + clearHolderSlice() PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter + appendHolderSlice(item PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter +} + +func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) setMsg(msg *patternFlowIpv4DontFragment) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4DontFragmentMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) Items() []PatternFlowIpv4DontFragmentMetricTag { + return obj.patternFlowIpv4DontFragmentMetricTagSlice +} + +func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) Add() PatternFlowIpv4DontFragmentMetricTag { + newObj := &otg.PatternFlowIpv4DontFragmentMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4DontFragmentMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4DontFragmentMetricTagSlice = append(obj.patternFlowIpv4DontFragmentMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) Append(items ...PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4DontFragmentMetricTagSlice = append(obj.patternFlowIpv4DontFragmentMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) Set(index int, newObj PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4DontFragmentMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) Clear() PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4DontFragmentMetricTag{} + obj.patternFlowIpv4DontFragmentMetricTagSlice = []PatternFlowIpv4DontFragmentMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) clearHolderSlice() PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { + if len(obj.patternFlowIpv4DontFragmentMetricTagSlice) > 0 { + obj.patternFlowIpv4DontFragmentMetricTagSlice = []PatternFlowIpv4DontFragmentMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter) appendHolderSlice(item PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentPatternFlowIpv4DontFragmentMetricTagIter { + obj.patternFlowIpv4DontFragmentMetricTagSlice = append(obj.patternFlowIpv4DontFragmentMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4DontFragment) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DontFragment.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4DontFragment.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4DontFragmentMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4DontFragment) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4DontFragmentChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4DontFragmentChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4DontFragmentChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4DontFragmentChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4DontFragmentChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4DontFragmentChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4DontFragment") + } + } else { + intVal := otg.PatternFlowIpv4DontFragment_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4DontFragment_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_dont_fragment_counter.go b/gosnappi/pattern_flow_ipv4_dont_fragment_counter.go new file mode 100644 index 00000000..353a592c --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_dont_fragment_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4DontFragmentCounter ***** +type patternFlowIpv4DontFragmentCounter struct { + validation + obj *otg.PatternFlowIpv4DontFragmentCounter + marshaller marshalPatternFlowIpv4DontFragmentCounter + unMarshaller unMarshalPatternFlowIpv4DontFragmentCounter +} + +func NewPatternFlowIpv4DontFragmentCounter() PatternFlowIpv4DontFragmentCounter { + obj := patternFlowIpv4DontFragmentCounter{obj: &otg.PatternFlowIpv4DontFragmentCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4DontFragmentCounter) msg() *otg.PatternFlowIpv4DontFragmentCounter { + return obj.obj +} + +func (obj *patternFlowIpv4DontFragmentCounter) setMsg(msg *otg.PatternFlowIpv4DontFragmentCounter) PatternFlowIpv4DontFragmentCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4DontFragmentCounter struct { + obj *patternFlowIpv4DontFragmentCounter +} + +type marshalPatternFlowIpv4DontFragmentCounter interface { + // ToProto marshals PatternFlowIpv4DontFragmentCounter to protobuf object *otg.PatternFlowIpv4DontFragmentCounter + ToProto() (*otg.PatternFlowIpv4DontFragmentCounter, error) + // ToPbText marshals PatternFlowIpv4DontFragmentCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4DontFragmentCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4DontFragmentCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4DontFragmentCounter struct { + obj *patternFlowIpv4DontFragmentCounter +} + +type unMarshalPatternFlowIpv4DontFragmentCounter interface { + // FromProto unmarshals PatternFlowIpv4DontFragmentCounter from protobuf object *otg.PatternFlowIpv4DontFragmentCounter + FromProto(msg *otg.PatternFlowIpv4DontFragmentCounter) (PatternFlowIpv4DontFragmentCounter, error) + // FromPbText unmarshals PatternFlowIpv4DontFragmentCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4DontFragmentCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4DontFragmentCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4DontFragmentCounter) Marshal() marshalPatternFlowIpv4DontFragmentCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4DontFragmentCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4DontFragmentCounter) Unmarshal() unMarshalPatternFlowIpv4DontFragmentCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4DontFragmentCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4DontFragmentCounter) ToProto() (*otg.PatternFlowIpv4DontFragmentCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4DontFragmentCounter) FromProto(msg *otg.PatternFlowIpv4DontFragmentCounter) (PatternFlowIpv4DontFragmentCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4DontFragmentCounter) 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 *unMarshalpatternFlowIpv4DontFragmentCounter) 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 *marshalpatternFlowIpv4DontFragmentCounter) 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 *unMarshalpatternFlowIpv4DontFragmentCounter) 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 *marshalpatternFlowIpv4DontFragmentCounter) 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 *unMarshalpatternFlowIpv4DontFragmentCounter) 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 *patternFlowIpv4DontFragmentCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DontFragmentCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DontFragmentCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4DontFragmentCounter) Clone() (PatternFlowIpv4DontFragmentCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4DontFragmentCounter() + 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 +} + +// PatternFlowIpv4DontFragmentCounter is integer counter pattern +type PatternFlowIpv4DontFragmentCounter interface { + Validation + // msg marshals PatternFlowIpv4DontFragmentCounter to protobuf object *otg.PatternFlowIpv4DontFragmentCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4DontFragmentCounter + // setMsg unmarshals PatternFlowIpv4DontFragmentCounter from protobuf object *otg.PatternFlowIpv4DontFragmentCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4DontFragmentCounter) PatternFlowIpv4DontFragmentCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4DontFragmentCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4DontFragmentCounter + // validate validates PatternFlowIpv4DontFragmentCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4DontFragmentCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4DontFragmentCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4DontFragmentCounter + SetStart(value uint32) PatternFlowIpv4DontFragmentCounter + // HasStart checks if Start has been set in PatternFlowIpv4DontFragmentCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4DontFragmentCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4DontFragmentCounter + SetStep(value uint32) PatternFlowIpv4DontFragmentCounter + // HasStep checks if Step has been set in PatternFlowIpv4DontFragmentCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4DontFragmentCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4DontFragmentCounter + SetCount(value uint32) PatternFlowIpv4DontFragmentCounter + // HasCount checks if Count has been set in PatternFlowIpv4DontFragmentCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4DontFragmentCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4DontFragmentCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4DontFragmentCounter object +func (obj *patternFlowIpv4DontFragmentCounter) SetStart(value uint32) PatternFlowIpv4DontFragmentCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4DontFragmentCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4DontFragmentCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4DontFragmentCounter object +func (obj *patternFlowIpv4DontFragmentCounter) SetStep(value uint32) PatternFlowIpv4DontFragmentCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4DontFragmentCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4DontFragmentCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4DontFragmentCounter object +func (obj *patternFlowIpv4DontFragmentCounter) SetCount(value uint32) PatternFlowIpv4DontFragmentCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4DontFragmentCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DontFragmentCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DontFragmentCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DontFragmentCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4DontFragmentCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_dont_fragment_metric_tag.go b/gosnappi/pattern_flow_ipv4_dont_fragment_metric_tag.go new file mode 100644 index 00000000..a3fa8987 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_dont_fragment_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4DontFragmentMetricTag ***** +type patternFlowIpv4DontFragmentMetricTag struct { + validation + obj *otg.PatternFlowIpv4DontFragmentMetricTag + marshaller marshalPatternFlowIpv4DontFragmentMetricTag + unMarshaller unMarshalPatternFlowIpv4DontFragmentMetricTag +} + +func NewPatternFlowIpv4DontFragmentMetricTag() PatternFlowIpv4DontFragmentMetricTag { + obj := patternFlowIpv4DontFragmentMetricTag{obj: &otg.PatternFlowIpv4DontFragmentMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4DontFragmentMetricTag) msg() *otg.PatternFlowIpv4DontFragmentMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4DontFragmentMetricTag) setMsg(msg *otg.PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4DontFragmentMetricTag struct { + obj *patternFlowIpv4DontFragmentMetricTag +} + +type marshalPatternFlowIpv4DontFragmentMetricTag interface { + // ToProto marshals PatternFlowIpv4DontFragmentMetricTag to protobuf object *otg.PatternFlowIpv4DontFragmentMetricTag + ToProto() (*otg.PatternFlowIpv4DontFragmentMetricTag, error) + // ToPbText marshals PatternFlowIpv4DontFragmentMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4DontFragmentMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4DontFragmentMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4DontFragmentMetricTag struct { + obj *patternFlowIpv4DontFragmentMetricTag +} + +type unMarshalPatternFlowIpv4DontFragmentMetricTag interface { + // FromProto unmarshals PatternFlowIpv4DontFragmentMetricTag from protobuf object *otg.PatternFlowIpv4DontFragmentMetricTag + FromProto(msg *otg.PatternFlowIpv4DontFragmentMetricTag) (PatternFlowIpv4DontFragmentMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4DontFragmentMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4DontFragmentMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4DontFragmentMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4DontFragmentMetricTag) Marshal() marshalPatternFlowIpv4DontFragmentMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4DontFragmentMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4DontFragmentMetricTag) Unmarshal() unMarshalPatternFlowIpv4DontFragmentMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4DontFragmentMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4DontFragmentMetricTag) ToProto() (*otg.PatternFlowIpv4DontFragmentMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4DontFragmentMetricTag) FromProto(msg *otg.PatternFlowIpv4DontFragmentMetricTag) (PatternFlowIpv4DontFragmentMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4DontFragmentMetricTag) 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 *unMarshalpatternFlowIpv4DontFragmentMetricTag) 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 *marshalpatternFlowIpv4DontFragmentMetricTag) 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 *unMarshalpatternFlowIpv4DontFragmentMetricTag) 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 *marshalpatternFlowIpv4DontFragmentMetricTag) 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 *unMarshalpatternFlowIpv4DontFragmentMetricTag) 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 *patternFlowIpv4DontFragmentMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DontFragmentMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DontFragmentMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4DontFragmentMetricTag) Clone() (PatternFlowIpv4DontFragmentMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4DontFragmentMetricTag() + 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 +} + +// PatternFlowIpv4DontFragmentMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4DontFragmentMetricTag interface { + Validation + // msg marshals PatternFlowIpv4DontFragmentMetricTag to protobuf object *otg.PatternFlowIpv4DontFragmentMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4DontFragmentMetricTag + // setMsg unmarshals PatternFlowIpv4DontFragmentMetricTag from protobuf object *otg.PatternFlowIpv4DontFragmentMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4DontFragmentMetricTag) PatternFlowIpv4DontFragmentMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4DontFragmentMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4DontFragmentMetricTag + // validate validates PatternFlowIpv4DontFragmentMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4DontFragmentMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4DontFragmentMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4DontFragmentMetricTag + SetName(value string) PatternFlowIpv4DontFragmentMetricTag + // Offset returns uint32, set in PatternFlowIpv4DontFragmentMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4DontFragmentMetricTag + SetOffset(value uint32) PatternFlowIpv4DontFragmentMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4DontFragmentMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4DontFragmentMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4DontFragmentMetricTag + SetLength(value uint32) PatternFlowIpv4DontFragmentMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4DontFragmentMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4DontFragmentMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4DontFragmentMetricTag object +func (obj *patternFlowIpv4DontFragmentMetricTag) SetName(value string) PatternFlowIpv4DontFragmentMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4DontFragmentMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4DontFragmentMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4DontFragmentMetricTag object +func (obj *patternFlowIpv4DontFragmentMetricTag) SetOffset(value uint32) PatternFlowIpv4DontFragmentMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4DontFragmentMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4DontFragmentMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4DontFragmentMetricTag object +func (obj *patternFlowIpv4DontFragmentMetricTag) SetLength(value uint32) PatternFlowIpv4DontFragmentMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4DontFragmentMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4DontFragmentMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DontFragmentMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4DontFragmentMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4DontFragmentMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_dscp_ecn.go b/gosnappi/pattern_flow_ipv4_dscp_ecn.go new file mode 100644 index 00000000..c80baf83 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_dscp_ecn.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4DscpEcn ***** +type patternFlowIpv4DscpEcn struct { + validation + obj *otg.PatternFlowIpv4DscpEcn + marshaller marshalPatternFlowIpv4DscpEcn + unMarshaller unMarshalPatternFlowIpv4DscpEcn + incrementHolder PatternFlowIpv4DscpEcnCounter + decrementHolder PatternFlowIpv4DscpEcnCounter + metricTagsHolder PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter +} + +func NewPatternFlowIpv4DscpEcn() PatternFlowIpv4DscpEcn { + obj := patternFlowIpv4DscpEcn{obj: &otg.PatternFlowIpv4DscpEcn{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4DscpEcn) msg() *otg.PatternFlowIpv4DscpEcn { + return obj.obj +} + +func (obj *patternFlowIpv4DscpEcn) setMsg(msg *otg.PatternFlowIpv4DscpEcn) PatternFlowIpv4DscpEcn { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4DscpEcn struct { + obj *patternFlowIpv4DscpEcn +} + +type marshalPatternFlowIpv4DscpEcn interface { + // ToProto marshals PatternFlowIpv4DscpEcn to protobuf object *otg.PatternFlowIpv4DscpEcn + ToProto() (*otg.PatternFlowIpv4DscpEcn, error) + // ToPbText marshals PatternFlowIpv4DscpEcn to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4DscpEcn to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4DscpEcn to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4DscpEcn struct { + obj *patternFlowIpv4DscpEcn +} + +type unMarshalPatternFlowIpv4DscpEcn interface { + // FromProto unmarshals PatternFlowIpv4DscpEcn from protobuf object *otg.PatternFlowIpv4DscpEcn + FromProto(msg *otg.PatternFlowIpv4DscpEcn) (PatternFlowIpv4DscpEcn, error) + // FromPbText unmarshals PatternFlowIpv4DscpEcn from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4DscpEcn from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4DscpEcn from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4DscpEcn) Marshal() marshalPatternFlowIpv4DscpEcn { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4DscpEcn{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4DscpEcn) Unmarshal() unMarshalPatternFlowIpv4DscpEcn { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4DscpEcn{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4DscpEcn) ToProto() (*otg.PatternFlowIpv4DscpEcn, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4DscpEcn) FromProto(msg *otg.PatternFlowIpv4DscpEcn) (PatternFlowIpv4DscpEcn, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4DscpEcn) 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 *unMarshalpatternFlowIpv4DscpEcn) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4DscpEcn) 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 *unMarshalpatternFlowIpv4DscpEcn) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4DscpEcn) 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 *unMarshalpatternFlowIpv4DscpEcn) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4DscpEcn) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DscpEcn) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DscpEcn) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4DscpEcn) Clone() (PatternFlowIpv4DscpEcn, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4DscpEcn() + 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 +} + +func (obj *patternFlowIpv4DscpEcn) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4DscpEcn is explicit congestion notification +type PatternFlowIpv4DscpEcn interface { + Validation + // msg marshals PatternFlowIpv4DscpEcn to protobuf object *otg.PatternFlowIpv4DscpEcn + // and doesn't set defaults + msg() *otg.PatternFlowIpv4DscpEcn + // setMsg unmarshals PatternFlowIpv4DscpEcn from protobuf object *otg.PatternFlowIpv4DscpEcn + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4DscpEcn) PatternFlowIpv4DscpEcn + // provides marshal interface + Marshal() marshalPatternFlowIpv4DscpEcn + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4DscpEcn + // validate validates PatternFlowIpv4DscpEcn + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4DscpEcn, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4DscpEcnChoiceEnum, set in PatternFlowIpv4DscpEcn + Choice() PatternFlowIpv4DscpEcnChoiceEnum + // setChoice assigns PatternFlowIpv4DscpEcnChoiceEnum provided by user to PatternFlowIpv4DscpEcn + setChoice(value PatternFlowIpv4DscpEcnChoiceEnum) PatternFlowIpv4DscpEcn + // HasChoice checks if Choice has been set in PatternFlowIpv4DscpEcn + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4DscpEcn. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4DscpEcn + SetValue(value uint32) PatternFlowIpv4DscpEcn + // HasValue checks if Value has been set in PatternFlowIpv4DscpEcn + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4DscpEcn. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4DscpEcn + SetValues(value []uint32) PatternFlowIpv4DscpEcn + // Increment returns PatternFlowIpv4DscpEcnCounter, set in PatternFlowIpv4DscpEcn. + // PatternFlowIpv4DscpEcnCounter is integer counter pattern + Increment() PatternFlowIpv4DscpEcnCounter + // SetIncrement assigns PatternFlowIpv4DscpEcnCounter provided by user to PatternFlowIpv4DscpEcn. + // PatternFlowIpv4DscpEcnCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4DscpEcnCounter) PatternFlowIpv4DscpEcn + // HasIncrement checks if Increment has been set in PatternFlowIpv4DscpEcn + HasIncrement() bool + // Decrement returns PatternFlowIpv4DscpEcnCounter, set in PatternFlowIpv4DscpEcn. + // PatternFlowIpv4DscpEcnCounter is integer counter pattern + Decrement() PatternFlowIpv4DscpEcnCounter + // SetDecrement assigns PatternFlowIpv4DscpEcnCounter provided by user to PatternFlowIpv4DscpEcn. + // PatternFlowIpv4DscpEcnCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4DscpEcnCounter) PatternFlowIpv4DscpEcn + // HasDecrement checks if Decrement has been set in PatternFlowIpv4DscpEcn + HasDecrement() bool + // MetricTags returns PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIterIter, set in PatternFlowIpv4DscpEcn + MetricTags() PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter + setNil() +} + +type PatternFlowIpv4DscpEcnChoiceEnum string + +// Enum of Choice on PatternFlowIpv4DscpEcn +var PatternFlowIpv4DscpEcnChoice = struct { + VALUE PatternFlowIpv4DscpEcnChoiceEnum + VALUES PatternFlowIpv4DscpEcnChoiceEnum + INCREMENT PatternFlowIpv4DscpEcnChoiceEnum + DECREMENT PatternFlowIpv4DscpEcnChoiceEnum +}{ + VALUE: PatternFlowIpv4DscpEcnChoiceEnum("value"), + VALUES: PatternFlowIpv4DscpEcnChoiceEnum("values"), + INCREMENT: PatternFlowIpv4DscpEcnChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4DscpEcnChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4DscpEcn) Choice() PatternFlowIpv4DscpEcnChoiceEnum { + return PatternFlowIpv4DscpEcnChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4DscpEcn) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4DscpEcn) setChoice(value PatternFlowIpv4DscpEcnChoiceEnum) PatternFlowIpv4DscpEcn { + intValue, ok := otg.PatternFlowIpv4DscpEcn_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4DscpEcnChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4DscpEcn_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4DscpEcnChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4DscpEcnChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4DscpEcnChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4DscpEcnCounter().msg() + } + + if value == PatternFlowIpv4DscpEcnChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4DscpEcnCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4DscpEcn) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4DscpEcnChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4DscpEcn) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4DscpEcn object +func (obj *patternFlowIpv4DscpEcn) SetValue(value uint32) PatternFlowIpv4DscpEcn { + obj.setChoice(PatternFlowIpv4DscpEcnChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4DscpEcn) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4DscpEcn object +func (obj *patternFlowIpv4DscpEcn) SetValues(value []uint32) PatternFlowIpv4DscpEcn { + obj.setChoice(PatternFlowIpv4DscpEcnChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4DscpEcnCounter +func (obj *patternFlowIpv4DscpEcn) Increment() PatternFlowIpv4DscpEcnCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4DscpEcnChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4DscpEcnCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4DscpEcnCounter +func (obj *patternFlowIpv4DscpEcn) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4DscpEcnCounter value in the PatternFlowIpv4DscpEcn object +func (obj *patternFlowIpv4DscpEcn) SetIncrement(value PatternFlowIpv4DscpEcnCounter) PatternFlowIpv4DscpEcn { + obj.setChoice(PatternFlowIpv4DscpEcnChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4DscpEcnCounter +func (obj *patternFlowIpv4DscpEcn) Decrement() PatternFlowIpv4DscpEcnCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4DscpEcnChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4DscpEcnCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4DscpEcnCounter +func (obj *patternFlowIpv4DscpEcn) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4DscpEcnCounter value in the PatternFlowIpv4DscpEcn object +func (obj *patternFlowIpv4DscpEcn) SetDecrement(value PatternFlowIpv4DscpEcnCounter) PatternFlowIpv4DscpEcn { + obj.setChoice(PatternFlowIpv4DscpEcnChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4DscpEcnMetricTag +func (obj *patternFlowIpv4DscpEcn) MetricTags() PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4DscpEcnMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter struct { + obj *patternFlowIpv4DscpEcn + patternFlowIpv4DscpEcnMetricTagSlice []PatternFlowIpv4DscpEcnMetricTag + fieldPtr *[]*otg.PatternFlowIpv4DscpEcnMetricTag +} + +func newPatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter(ptr *[]*otg.PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { + return &patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter interface { + setMsg(*patternFlowIpv4DscpEcn) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter + Items() []PatternFlowIpv4DscpEcnMetricTag + Add() PatternFlowIpv4DscpEcnMetricTag + Append(items ...PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter + Set(index int, newObj PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter + Clear() PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter + clearHolderSlice() PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter + appendHolderSlice(item PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter +} + +func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) setMsg(msg *patternFlowIpv4DscpEcn) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4DscpEcnMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) Items() []PatternFlowIpv4DscpEcnMetricTag { + return obj.patternFlowIpv4DscpEcnMetricTagSlice +} + +func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) Add() PatternFlowIpv4DscpEcnMetricTag { + newObj := &otg.PatternFlowIpv4DscpEcnMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4DscpEcnMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4DscpEcnMetricTagSlice = append(obj.patternFlowIpv4DscpEcnMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) Append(items ...PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4DscpEcnMetricTagSlice = append(obj.patternFlowIpv4DscpEcnMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) Set(index int, newObj PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4DscpEcnMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) Clear() PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4DscpEcnMetricTag{} + obj.patternFlowIpv4DscpEcnMetricTagSlice = []PatternFlowIpv4DscpEcnMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) clearHolderSlice() PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { + if len(obj.patternFlowIpv4DscpEcnMetricTagSlice) > 0 { + obj.patternFlowIpv4DscpEcnMetricTagSlice = []PatternFlowIpv4DscpEcnMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter) appendHolderSlice(item PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnPatternFlowIpv4DscpEcnMetricTagIter { + obj.patternFlowIpv4DscpEcnMetricTagSlice = append(obj.patternFlowIpv4DscpEcnMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4DscpEcn) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DscpEcn.Value <= 3 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4DscpEcn.Values <= 3 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4DscpEcnMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4DscpEcn) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4DscpEcnChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4DscpEcnChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4DscpEcnChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4DscpEcnChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4DscpEcnChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4DscpEcnChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4DscpEcn") + } + } else { + intVal := otg.PatternFlowIpv4DscpEcn_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4DscpEcn_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_dscp_ecn_counter.go b/gosnappi/pattern_flow_ipv4_dscp_ecn_counter.go new file mode 100644 index 00000000..6868753a --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_dscp_ecn_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4DscpEcnCounter ***** +type patternFlowIpv4DscpEcnCounter struct { + validation + obj *otg.PatternFlowIpv4DscpEcnCounter + marshaller marshalPatternFlowIpv4DscpEcnCounter + unMarshaller unMarshalPatternFlowIpv4DscpEcnCounter +} + +func NewPatternFlowIpv4DscpEcnCounter() PatternFlowIpv4DscpEcnCounter { + obj := patternFlowIpv4DscpEcnCounter{obj: &otg.PatternFlowIpv4DscpEcnCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4DscpEcnCounter) msg() *otg.PatternFlowIpv4DscpEcnCounter { + return obj.obj +} + +func (obj *patternFlowIpv4DscpEcnCounter) setMsg(msg *otg.PatternFlowIpv4DscpEcnCounter) PatternFlowIpv4DscpEcnCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4DscpEcnCounter struct { + obj *patternFlowIpv4DscpEcnCounter +} + +type marshalPatternFlowIpv4DscpEcnCounter interface { + // ToProto marshals PatternFlowIpv4DscpEcnCounter to protobuf object *otg.PatternFlowIpv4DscpEcnCounter + ToProto() (*otg.PatternFlowIpv4DscpEcnCounter, error) + // ToPbText marshals PatternFlowIpv4DscpEcnCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4DscpEcnCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4DscpEcnCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4DscpEcnCounter struct { + obj *patternFlowIpv4DscpEcnCounter +} + +type unMarshalPatternFlowIpv4DscpEcnCounter interface { + // FromProto unmarshals PatternFlowIpv4DscpEcnCounter from protobuf object *otg.PatternFlowIpv4DscpEcnCounter + FromProto(msg *otg.PatternFlowIpv4DscpEcnCounter) (PatternFlowIpv4DscpEcnCounter, error) + // FromPbText unmarshals PatternFlowIpv4DscpEcnCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4DscpEcnCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4DscpEcnCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4DscpEcnCounter) Marshal() marshalPatternFlowIpv4DscpEcnCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4DscpEcnCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4DscpEcnCounter) Unmarshal() unMarshalPatternFlowIpv4DscpEcnCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4DscpEcnCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4DscpEcnCounter) ToProto() (*otg.PatternFlowIpv4DscpEcnCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4DscpEcnCounter) FromProto(msg *otg.PatternFlowIpv4DscpEcnCounter) (PatternFlowIpv4DscpEcnCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4DscpEcnCounter) 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 *unMarshalpatternFlowIpv4DscpEcnCounter) 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 *marshalpatternFlowIpv4DscpEcnCounter) 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 *unMarshalpatternFlowIpv4DscpEcnCounter) 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 *marshalpatternFlowIpv4DscpEcnCounter) 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 *unMarshalpatternFlowIpv4DscpEcnCounter) 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 *patternFlowIpv4DscpEcnCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DscpEcnCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DscpEcnCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4DscpEcnCounter) Clone() (PatternFlowIpv4DscpEcnCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4DscpEcnCounter() + 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 +} + +// PatternFlowIpv4DscpEcnCounter is integer counter pattern +type PatternFlowIpv4DscpEcnCounter interface { + Validation + // msg marshals PatternFlowIpv4DscpEcnCounter to protobuf object *otg.PatternFlowIpv4DscpEcnCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4DscpEcnCounter + // setMsg unmarshals PatternFlowIpv4DscpEcnCounter from protobuf object *otg.PatternFlowIpv4DscpEcnCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4DscpEcnCounter) PatternFlowIpv4DscpEcnCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4DscpEcnCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4DscpEcnCounter + // validate validates PatternFlowIpv4DscpEcnCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4DscpEcnCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4DscpEcnCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4DscpEcnCounter + SetStart(value uint32) PatternFlowIpv4DscpEcnCounter + // HasStart checks if Start has been set in PatternFlowIpv4DscpEcnCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4DscpEcnCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4DscpEcnCounter + SetStep(value uint32) PatternFlowIpv4DscpEcnCounter + // HasStep checks if Step has been set in PatternFlowIpv4DscpEcnCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4DscpEcnCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4DscpEcnCounter + SetCount(value uint32) PatternFlowIpv4DscpEcnCounter + // HasCount checks if Count has been set in PatternFlowIpv4DscpEcnCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4DscpEcnCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4DscpEcnCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4DscpEcnCounter object +func (obj *patternFlowIpv4DscpEcnCounter) SetStart(value uint32) PatternFlowIpv4DscpEcnCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4DscpEcnCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4DscpEcnCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4DscpEcnCounter object +func (obj *patternFlowIpv4DscpEcnCounter) SetStep(value uint32) PatternFlowIpv4DscpEcnCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4DscpEcnCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4DscpEcnCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4DscpEcnCounter object +func (obj *patternFlowIpv4DscpEcnCounter) SetCount(value uint32) PatternFlowIpv4DscpEcnCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4DscpEcnCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DscpEcnCounter.Start <= 3 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DscpEcnCounter.Step <= 3 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DscpEcnCounter.Count <= 3 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4DscpEcnCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_dscp_ecn_metric_tag.go b/gosnappi/pattern_flow_ipv4_dscp_ecn_metric_tag.go new file mode 100644 index 00000000..39faca66 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_dscp_ecn_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4DscpEcnMetricTag ***** +type patternFlowIpv4DscpEcnMetricTag struct { + validation + obj *otg.PatternFlowIpv4DscpEcnMetricTag + marshaller marshalPatternFlowIpv4DscpEcnMetricTag + unMarshaller unMarshalPatternFlowIpv4DscpEcnMetricTag +} + +func NewPatternFlowIpv4DscpEcnMetricTag() PatternFlowIpv4DscpEcnMetricTag { + obj := patternFlowIpv4DscpEcnMetricTag{obj: &otg.PatternFlowIpv4DscpEcnMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4DscpEcnMetricTag) msg() *otg.PatternFlowIpv4DscpEcnMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4DscpEcnMetricTag) setMsg(msg *otg.PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4DscpEcnMetricTag struct { + obj *patternFlowIpv4DscpEcnMetricTag +} + +type marshalPatternFlowIpv4DscpEcnMetricTag interface { + // ToProto marshals PatternFlowIpv4DscpEcnMetricTag to protobuf object *otg.PatternFlowIpv4DscpEcnMetricTag + ToProto() (*otg.PatternFlowIpv4DscpEcnMetricTag, error) + // ToPbText marshals PatternFlowIpv4DscpEcnMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4DscpEcnMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4DscpEcnMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4DscpEcnMetricTag struct { + obj *patternFlowIpv4DscpEcnMetricTag +} + +type unMarshalPatternFlowIpv4DscpEcnMetricTag interface { + // FromProto unmarshals PatternFlowIpv4DscpEcnMetricTag from protobuf object *otg.PatternFlowIpv4DscpEcnMetricTag + FromProto(msg *otg.PatternFlowIpv4DscpEcnMetricTag) (PatternFlowIpv4DscpEcnMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4DscpEcnMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4DscpEcnMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4DscpEcnMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4DscpEcnMetricTag) Marshal() marshalPatternFlowIpv4DscpEcnMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4DscpEcnMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4DscpEcnMetricTag) Unmarshal() unMarshalPatternFlowIpv4DscpEcnMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4DscpEcnMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4DscpEcnMetricTag) ToProto() (*otg.PatternFlowIpv4DscpEcnMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4DscpEcnMetricTag) FromProto(msg *otg.PatternFlowIpv4DscpEcnMetricTag) (PatternFlowIpv4DscpEcnMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4DscpEcnMetricTag) 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 *unMarshalpatternFlowIpv4DscpEcnMetricTag) 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 *marshalpatternFlowIpv4DscpEcnMetricTag) 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 *unMarshalpatternFlowIpv4DscpEcnMetricTag) 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 *marshalpatternFlowIpv4DscpEcnMetricTag) 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 *unMarshalpatternFlowIpv4DscpEcnMetricTag) 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 *patternFlowIpv4DscpEcnMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DscpEcnMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DscpEcnMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4DscpEcnMetricTag) Clone() (PatternFlowIpv4DscpEcnMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4DscpEcnMetricTag() + 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 +} + +// PatternFlowIpv4DscpEcnMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4DscpEcnMetricTag interface { + Validation + // msg marshals PatternFlowIpv4DscpEcnMetricTag to protobuf object *otg.PatternFlowIpv4DscpEcnMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4DscpEcnMetricTag + // setMsg unmarshals PatternFlowIpv4DscpEcnMetricTag from protobuf object *otg.PatternFlowIpv4DscpEcnMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4DscpEcnMetricTag) PatternFlowIpv4DscpEcnMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4DscpEcnMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4DscpEcnMetricTag + // validate validates PatternFlowIpv4DscpEcnMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4DscpEcnMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4DscpEcnMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4DscpEcnMetricTag + SetName(value string) PatternFlowIpv4DscpEcnMetricTag + // Offset returns uint32, set in PatternFlowIpv4DscpEcnMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4DscpEcnMetricTag + SetOffset(value uint32) PatternFlowIpv4DscpEcnMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4DscpEcnMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4DscpEcnMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4DscpEcnMetricTag + SetLength(value uint32) PatternFlowIpv4DscpEcnMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4DscpEcnMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4DscpEcnMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4DscpEcnMetricTag object +func (obj *patternFlowIpv4DscpEcnMetricTag) SetName(value string) PatternFlowIpv4DscpEcnMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4DscpEcnMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4DscpEcnMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4DscpEcnMetricTag object +func (obj *patternFlowIpv4DscpEcnMetricTag) SetOffset(value uint32) PatternFlowIpv4DscpEcnMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4DscpEcnMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4DscpEcnMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4DscpEcnMetricTag object +func (obj *patternFlowIpv4DscpEcnMetricTag) SetLength(value uint32) PatternFlowIpv4DscpEcnMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4DscpEcnMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4DscpEcnMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DscpEcnMetricTag.Offset <= 1 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 2 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4DscpEcnMetricTag.Length <= 2 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4DscpEcnMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(2) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_dscp_phb.go b/gosnappi/pattern_flow_ipv4_dscp_phb.go new file mode 100644 index 00000000..940d2281 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_dscp_phb.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4DscpPhb ***** +type patternFlowIpv4DscpPhb struct { + validation + obj *otg.PatternFlowIpv4DscpPhb + marshaller marshalPatternFlowIpv4DscpPhb + unMarshaller unMarshalPatternFlowIpv4DscpPhb + incrementHolder PatternFlowIpv4DscpPhbCounter + decrementHolder PatternFlowIpv4DscpPhbCounter + metricTagsHolder PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter +} + +func NewPatternFlowIpv4DscpPhb() PatternFlowIpv4DscpPhb { + obj := patternFlowIpv4DscpPhb{obj: &otg.PatternFlowIpv4DscpPhb{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4DscpPhb) msg() *otg.PatternFlowIpv4DscpPhb { + return obj.obj +} + +func (obj *patternFlowIpv4DscpPhb) setMsg(msg *otg.PatternFlowIpv4DscpPhb) PatternFlowIpv4DscpPhb { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4DscpPhb struct { + obj *patternFlowIpv4DscpPhb +} + +type marshalPatternFlowIpv4DscpPhb interface { + // ToProto marshals PatternFlowIpv4DscpPhb to protobuf object *otg.PatternFlowIpv4DscpPhb + ToProto() (*otg.PatternFlowIpv4DscpPhb, error) + // ToPbText marshals PatternFlowIpv4DscpPhb to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4DscpPhb to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4DscpPhb to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4DscpPhb struct { + obj *patternFlowIpv4DscpPhb +} + +type unMarshalPatternFlowIpv4DscpPhb interface { + // FromProto unmarshals PatternFlowIpv4DscpPhb from protobuf object *otg.PatternFlowIpv4DscpPhb + FromProto(msg *otg.PatternFlowIpv4DscpPhb) (PatternFlowIpv4DscpPhb, error) + // FromPbText unmarshals PatternFlowIpv4DscpPhb from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4DscpPhb from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4DscpPhb from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4DscpPhb) Marshal() marshalPatternFlowIpv4DscpPhb { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4DscpPhb{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4DscpPhb) Unmarshal() unMarshalPatternFlowIpv4DscpPhb { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4DscpPhb{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4DscpPhb) ToProto() (*otg.PatternFlowIpv4DscpPhb, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4DscpPhb) FromProto(msg *otg.PatternFlowIpv4DscpPhb) (PatternFlowIpv4DscpPhb, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4DscpPhb) 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 *unMarshalpatternFlowIpv4DscpPhb) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4DscpPhb) 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 *unMarshalpatternFlowIpv4DscpPhb) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4DscpPhb) 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 *unMarshalpatternFlowIpv4DscpPhb) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4DscpPhb) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DscpPhb) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DscpPhb) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4DscpPhb) Clone() (PatternFlowIpv4DscpPhb, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4DscpPhb() + 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 +} + +func (obj *patternFlowIpv4DscpPhb) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4DscpPhb is per hop behavior +type PatternFlowIpv4DscpPhb interface { + Validation + // msg marshals PatternFlowIpv4DscpPhb to protobuf object *otg.PatternFlowIpv4DscpPhb + // and doesn't set defaults + msg() *otg.PatternFlowIpv4DscpPhb + // setMsg unmarshals PatternFlowIpv4DscpPhb from protobuf object *otg.PatternFlowIpv4DscpPhb + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4DscpPhb) PatternFlowIpv4DscpPhb + // provides marshal interface + Marshal() marshalPatternFlowIpv4DscpPhb + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4DscpPhb + // validate validates PatternFlowIpv4DscpPhb + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4DscpPhb, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4DscpPhbChoiceEnum, set in PatternFlowIpv4DscpPhb + Choice() PatternFlowIpv4DscpPhbChoiceEnum + // setChoice assigns PatternFlowIpv4DscpPhbChoiceEnum provided by user to PatternFlowIpv4DscpPhb + setChoice(value PatternFlowIpv4DscpPhbChoiceEnum) PatternFlowIpv4DscpPhb + // HasChoice checks if Choice has been set in PatternFlowIpv4DscpPhb + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4DscpPhb. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4DscpPhb + SetValue(value uint32) PatternFlowIpv4DscpPhb + // HasValue checks if Value has been set in PatternFlowIpv4DscpPhb + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4DscpPhb. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4DscpPhb + SetValues(value []uint32) PatternFlowIpv4DscpPhb + // Increment returns PatternFlowIpv4DscpPhbCounter, set in PatternFlowIpv4DscpPhb. + // PatternFlowIpv4DscpPhbCounter is integer counter pattern + Increment() PatternFlowIpv4DscpPhbCounter + // SetIncrement assigns PatternFlowIpv4DscpPhbCounter provided by user to PatternFlowIpv4DscpPhb. + // PatternFlowIpv4DscpPhbCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4DscpPhbCounter) PatternFlowIpv4DscpPhb + // HasIncrement checks if Increment has been set in PatternFlowIpv4DscpPhb + HasIncrement() bool + // Decrement returns PatternFlowIpv4DscpPhbCounter, set in PatternFlowIpv4DscpPhb. + // PatternFlowIpv4DscpPhbCounter is integer counter pattern + Decrement() PatternFlowIpv4DscpPhbCounter + // SetDecrement assigns PatternFlowIpv4DscpPhbCounter provided by user to PatternFlowIpv4DscpPhb. + // PatternFlowIpv4DscpPhbCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4DscpPhbCounter) PatternFlowIpv4DscpPhb + // HasDecrement checks if Decrement has been set in PatternFlowIpv4DscpPhb + HasDecrement() bool + // MetricTags returns PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIterIter, set in PatternFlowIpv4DscpPhb + MetricTags() PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter + setNil() +} + +type PatternFlowIpv4DscpPhbChoiceEnum string + +// Enum of Choice on PatternFlowIpv4DscpPhb +var PatternFlowIpv4DscpPhbChoice = struct { + VALUE PatternFlowIpv4DscpPhbChoiceEnum + VALUES PatternFlowIpv4DscpPhbChoiceEnum + INCREMENT PatternFlowIpv4DscpPhbChoiceEnum + DECREMENT PatternFlowIpv4DscpPhbChoiceEnum +}{ + VALUE: PatternFlowIpv4DscpPhbChoiceEnum("value"), + VALUES: PatternFlowIpv4DscpPhbChoiceEnum("values"), + INCREMENT: PatternFlowIpv4DscpPhbChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4DscpPhbChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4DscpPhb) Choice() PatternFlowIpv4DscpPhbChoiceEnum { + return PatternFlowIpv4DscpPhbChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4DscpPhb) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4DscpPhb) setChoice(value PatternFlowIpv4DscpPhbChoiceEnum) PatternFlowIpv4DscpPhb { + intValue, ok := otg.PatternFlowIpv4DscpPhb_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4DscpPhbChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4DscpPhb_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4DscpPhbChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4DscpPhbChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4DscpPhbChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4DscpPhbCounter().msg() + } + + if value == PatternFlowIpv4DscpPhbChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4DscpPhbCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4DscpPhb) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4DscpPhbChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4DscpPhb) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4DscpPhb object +func (obj *patternFlowIpv4DscpPhb) SetValue(value uint32) PatternFlowIpv4DscpPhb { + obj.setChoice(PatternFlowIpv4DscpPhbChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4DscpPhb) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4DscpPhb object +func (obj *patternFlowIpv4DscpPhb) SetValues(value []uint32) PatternFlowIpv4DscpPhb { + obj.setChoice(PatternFlowIpv4DscpPhbChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4DscpPhbCounter +func (obj *patternFlowIpv4DscpPhb) Increment() PatternFlowIpv4DscpPhbCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4DscpPhbChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4DscpPhbCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4DscpPhbCounter +func (obj *patternFlowIpv4DscpPhb) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4DscpPhbCounter value in the PatternFlowIpv4DscpPhb object +func (obj *patternFlowIpv4DscpPhb) SetIncrement(value PatternFlowIpv4DscpPhbCounter) PatternFlowIpv4DscpPhb { + obj.setChoice(PatternFlowIpv4DscpPhbChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4DscpPhbCounter +func (obj *patternFlowIpv4DscpPhb) Decrement() PatternFlowIpv4DscpPhbCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4DscpPhbChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4DscpPhbCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4DscpPhbCounter +func (obj *patternFlowIpv4DscpPhb) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4DscpPhbCounter value in the PatternFlowIpv4DscpPhb object +func (obj *patternFlowIpv4DscpPhb) SetDecrement(value PatternFlowIpv4DscpPhbCounter) PatternFlowIpv4DscpPhb { + obj.setChoice(PatternFlowIpv4DscpPhbChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4DscpPhbMetricTag +func (obj *patternFlowIpv4DscpPhb) MetricTags() PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4DscpPhbMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter struct { + obj *patternFlowIpv4DscpPhb + patternFlowIpv4DscpPhbMetricTagSlice []PatternFlowIpv4DscpPhbMetricTag + fieldPtr *[]*otg.PatternFlowIpv4DscpPhbMetricTag +} + +func newPatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter(ptr *[]*otg.PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { + return &patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter interface { + setMsg(*patternFlowIpv4DscpPhb) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter + Items() []PatternFlowIpv4DscpPhbMetricTag + Add() PatternFlowIpv4DscpPhbMetricTag + Append(items ...PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter + Set(index int, newObj PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter + Clear() PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter + clearHolderSlice() PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter + appendHolderSlice(item PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter +} + +func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) setMsg(msg *patternFlowIpv4DscpPhb) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4DscpPhbMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) Items() []PatternFlowIpv4DscpPhbMetricTag { + return obj.patternFlowIpv4DscpPhbMetricTagSlice +} + +func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) Add() PatternFlowIpv4DscpPhbMetricTag { + newObj := &otg.PatternFlowIpv4DscpPhbMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4DscpPhbMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4DscpPhbMetricTagSlice = append(obj.patternFlowIpv4DscpPhbMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) Append(items ...PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4DscpPhbMetricTagSlice = append(obj.patternFlowIpv4DscpPhbMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) Set(index int, newObj PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4DscpPhbMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) Clear() PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4DscpPhbMetricTag{} + obj.patternFlowIpv4DscpPhbMetricTagSlice = []PatternFlowIpv4DscpPhbMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) clearHolderSlice() PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { + if len(obj.patternFlowIpv4DscpPhbMetricTagSlice) > 0 { + obj.patternFlowIpv4DscpPhbMetricTagSlice = []PatternFlowIpv4DscpPhbMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter) appendHolderSlice(item PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbPatternFlowIpv4DscpPhbMetricTagIter { + obj.patternFlowIpv4DscpPhbMetricTagSlice = append(obj.patternFlowIpv4DscpPhbMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4DscpPhb) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 63 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DscpPhb.Value <= 63 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 63 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4DscpPhb.Values <= 63 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4DscpPhbMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4DscpPhb) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4DscpPhbChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4DscpPhbChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4DscpPhbChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4DscpPhbChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4DscpPhbChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4DscpPhbChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4DscpPhb") + } + } else { + intVal := otg.PatternFlowIpv4DscpPhb_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4DscpPhb_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_dscp_phb_counter.go b/gosnappi/pattern_flow_ipv4_dscp_phb_counter.go new file mode 100644 index 00000000..fa870c7f --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_dscp_phb_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4DscpPhbCounter ***** +type patternFlowIpv4DscpPhbCounter struct { + validation + obj *otg.PatternFlowIpv4DscpPhbCounter + marshaller marshalPatternFlowIpv4DscpPhbCounter + unMarshaller unMarshalPatternFlowIpv4DscpPhbCounter +} + +func NewPatternFlowIpv4DscpPhbCounter() PatternFlowIpv4DscpPhbCounter { + obj := patternFlowIpv4DscpPhbCounter{obj: &otg.PatternFlowIpv4DscpPhbCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4DscpPhbCounter) msg() *otg.PatternFlowIpv4DscpPhbCounter { + return obj.obj +} + +func (obj *patternFlowIpv4DscpPhbCounter) setMsg(msg *otg.PatternFlowIpv4DscpPhbCounter) PatternFlowIpv4DscpPhbCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4DscpPhbCounter struct { + obj *patternFlowIpv4DscpPhbCounter +} + +type marshalPatternFlowIpv4DscpPhbCounter interface { + // ToProto marshals PatternFlowIpv4DscpPhbCounter to protobuf object *otg.PatternFlowIpv4DscpPhbCounter + ToProto() (*otg.PatternFlowIpv4DscpPhbCounter, error) + // ToPbText marshals PatternFlowIpv4DscpPhbCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4DscpPhbCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4DscpPhbCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4DscpPhbCounter struct { + obj *patternFlowIpv4DscpPhbCounter +} + +type unMarshalPatternFlowIpv4DscpPhbCounter interface { + // FromProto unmarshals PatternFlowIpv4DscpPhbCounter from protobuf object *otg.PatternFlowIpv4DscpPhbCounter + FromProto(msg *otg.PatternFlowIpv4DscpPhbCounter) (PatternFlowIpv4DscpPhbCounter, error) + // FromPbText unmarshals PatternFlowIpv4DscpPhbCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4DscpPhbCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4DscpPhbCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4DscpPhbCounter) Marshal() marshalPatternFlowIpv4DscpPhbCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4DscpPhbCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4DscpPhbCounter) Unmarshal() unMarshalPatternFlowIpv4DscpPhbCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4DscpPhbCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4DscpPhbCounter) ToProto() (*otg.PatternFlowIpv4DscpPhbCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4DscpPhbCounter) FromProto(msg *otg.PatternFlowIpv4DscpPhbCounter) (PatternFlowIpv4DscpPhbCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4DscpPhbCounter) 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 *unMarshalpatternFlowIpv4DscpPhbCounter) 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 *marshalpatternFlowIpv4DscpPhbCounter) 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 *unMarshalpatternFlowIpv4DscpPhbCounter) 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 *marshalpatternFlowIpv4DscpPhbCounter) 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 *unMarshalpatternFlowIpv4DscpPhbCounter) 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 *patternFlowIpv4DscpPhbCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DscpPhbCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DscpPhbCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4DscpPhbCounter) Clone() (PatternFlowIpv4DscpPhbCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4DscpPhbCounter() + 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 +} + +// PatternFlowIpv4DscpPhbCounter is integer counter pattern +type PatternFlowIpv4DscpPhbCounter interface { + Validation + // msg marshals PatternFlowIpv4DscpPhbCounter to protobuf object *otg.PatternFlowIpv4DscpPhbCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4DscpPhbCounter + // setMsg unmarshals PatternFlowIpv4DscpPhbCounter from protobuf object *otg.PatternFlowIpv4DscpPhbCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4DscpPhbCounter) PatternFlowIpv4DscpPhbCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4DscpPhbCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4DscpPhbCounter + // validate validates PatternFlowIpv4DscpPhbCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4DscpPhbCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4DscpPhbCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4DscpPhbCounter + SetStart(value uint32) PatternFlowIpv4DscpPhbCounter + // HasStart checks if Start has been set in PatternFlowIpv4DscpPhbCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4DscpPhbCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4DscpPhbCounter + SetStep(value uint32) PatternFlowIpv4DscpPhbCounter + // HasStep checks if Step has been set in PatternFlowIpv4DscpPhbCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4DscpPhbCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4DscpPhbCounter + SetCount(value uint32) PatternFlowIpv4DscpPhbCounter + // HasCount checks if Count has been set in PatternFlowIpv4DscpPhbCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4DscpPhbCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4DscpPhbCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4DscpPhbCounter object +func (obj *patternFlowIpv4DscpPhbCounter) SetStart(value uint32) PatternFlowIpv4DscpPhbCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4DscpPhbCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4DscpPhbCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4DscpPhbCounter object +func (obj *patternFlowIpv4DscpPhbCounter) SetStep(value uint32) PatternFlowIpv4DscpPhbCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4DscpPhbCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4DscpPhbCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4DscpPhbCounter object +func (obj *patternFlowIpv4DscpPhbCounter) SetCount(value uint32) PatternFlowIpv4DscpPhbCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4DscpPhbCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 63 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DscpPhbCounter.Start <= 63 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 63 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DscpPhbCounter.Step <= 63 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 63 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DscpPhbCounter.Count <= 63 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4DscpPhbCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_dscp_phb_metric_tag.go b/gosnappi/pattern_flow_ipv4_dscp_phb_metric_tag.go new file mode 100644 index 00000000..c1b212e9 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_dscp_phb_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4DscpPhbMetricTag ***** +type patternFlowIpv4DscpPhbMetricTag struct { + validation + obj *otg.PatternFlowIpv4DscpPhbMetricTag + marshaller marshalPatternFlowIpv4DscpPhbMetricTag + unMarshaller unMarshalPatternFlowIpv4DscpPhbMetricTag +} + +func NewPatternFlowIpv4DscpPhbMetricTag() PatternFlowIpv4DscpPhbMetricTag { + obj := patternFlowIpv4DscpPhbMetricTag{obj: &otg.PatternFlowIpv4DscpPhbMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4DscpPhbMetricTag) msg() *otg.PatternFlowIpv4DscpPhbMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4DscpPhbMetricTag) setMsg(msg *otg.PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4DscpPhbMetricTag struct { + obj *patternFlowIpv4DscpPhbMetricTag +} + +type marshalPatternFlowIpv4DscpPhbMetricTag interface { + // ToProto marshals PatternFlowIpv4DscpPhbMetricTag to protobuf object *otg.PatternFlowIpv4DscpPhbMetricTag + ToProto() (*otg.PatternFlowIpv4DscpPhbMetricTag, error) + // ToPbText marshals PatternFlowIpv4DscpPhbMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4DscpPhbMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4DscpPhbMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4DscpPhbMetricTag struct { + obj *patternFlowIpv4DscpPhbMetricTag +} + +type unMarshalPatternFlowIpv4DscpPhbMetricTag interface { + // FromProto unmarshals PatternFlowIpv4DscpPhbMetricTag from protobuf object *otg.PatternFlowIpv4DscpPhbMetricTag + FromProto(msg *otg.PatternFlowIpv4DscpPhbMetricTag) (PatternFlowIpv4DscpPhbMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4DscpPhbMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4DscpPhbMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4DscpPhbMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4DscpPhbMetricTag) Marshal() marshalPatternFlowIpv4DscpPhbMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4DscpPhbMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4DscpPhbMetricTag) Unmarshal() unMarshalPatternFlowIpv4DscpPhbMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4DscpPhbMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4DscpPhbMetricTag) ToProto() (*otg.PatternFlowIpv4DscpPhbMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4DscpPhbMetricTag) FromProto(msg *otg.PatternFlowIpv4DscpPhbMetricTag) (PatternFlowIpv4DscpPhbMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4DscpPhbMetricTag) 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 *unMarshalpatternFlowIpv4DscpPhbMetricTag) 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 *marshalpatternFlowIpv4DscpPhbMetricTag) 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 *unMarshalpatternFlowIpv4DscpPhbMetricTag) 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 *marshalpatternFlowIpv4DscpPhbMetricTag) 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 *unMarshalpatternFlowIpv4DscpPhbMetricTag) 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 *patternFlowIpv4DscpPhbMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DscpPhbMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DscpPhbMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4DscpPhbMetricTag) Clone() (PatternFlowIpv4DscpPhbMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4DscpPhbMetricTag() + 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 +} + +// PatternFlowIpv4DscpPhbMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4DscpPhbMetricTag interface { + Validation + // msg marshals PatternFlowIpv4DscpPhbMetricTag to protobuf object *otg.PatternFlowIpv4DscpPhbMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4DscpPhbMetricTag + // setMsg unmarshals PatternFlowIpv4DscpPhbMetricTag from protobuf object *otg.PatternFlowIpv4DscpPhbMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4DscpPhbMetricTag) PatternFlowIpv4DscpPhbMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4DscpPhbMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4DscpPhbMetricTag + // validate validates PatternFlowIpv4DscpPhbMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4DscpPhbMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4DscpPhbMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4DscpPhbMetricTag + SetName(value string) PatternFlowIpv4DscpPhbMetricTag + // Offset returns uint32, set in PatternFlowIpv4DscpPhbMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4DscpPhbMetricTag + SetOffset(value uint32) PatternFlowIpv4DscpPhbMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4DscpPhbMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4DscpPhbMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4DscpPhbMetricTag + SetLength(value uint32) PatternFlowIpv4DscpPhbMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4DscpPhbMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4DscpPhbMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4DscpPhbMetricTag object +func (obj *patternFlowIpv4DscpPhbMetricTag) SetName(value string) PatternFlowIpv4DscpPhbMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4DscpPhbMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4DscpPhbMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4DscpPhbMetricTag object +func (obj *patternFlowIpv4DscpPhbMetricTag) SetOffset(value uint32) PatternFlowIpv4DscpPhbMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4DscpPhbMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4DscpPhbMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4DscpPhbMetricTag object +func (obj *patternFlowIpv4DscpPhbMetricTag) SetLength(value uint32) PatternFlowIpv4DscpPhbMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4DscpPhbMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4DscpPhbMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 5 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DscpPhbMetricTag.Offset <= 5 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 6 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4DscpPhbMetricTag.Length <= 6 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4DscpPhbMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(6) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_dst.go b/gosnappi/pattern_flow_ipv4_dst.go new file mode 100644 index 00000000..936aecf2 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_dst.go @@ -0,0 +1,757 @@ +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" +) + +// ***** PatternFlowIpv4Dst ***** +type patternFlowIpv4Dst struct { + validation + obj *otg.PatternFlowIpv4Dst + marshaller marshalPatternFlowIpv4Dst + unMarshaller unMarshalPatternFlowIpv4Dst + incrementHolder PatternFlowIpv4DstCounter + decrementHolder PatternFlowIpv4DstCounter + metricTagsHolder PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter + autoHolder FlowIpv4Auto + randomHolder PatternFlowIpv4DstRandom +} + +func NewPatternFlowIpv4Dst() PatternFlowIpv4Dst { + obj := patternFlowIpv4Dst{obj: &otg.PatternFlowIpv4Dst{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4Dst) msg() *otg.PatternFlowIpv4Dst { + return obj.obj +} + +func (obj *patternFlowIpv4Dst) setMsg(msg *otg.PatternFlowIpv4Dst) PatternFlowIpv4Dst { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4Dst struct { + obj *patternFlowIpv4Dst +} + +type marshalPatternFlowIpv4Dst interface { + // ToProto marshals PatternFlowIpv4Dst to protobuf object *otg.PatternFlowIpv4Dst + ToProto() (*otg.PatternFlowIpv4Dst, error) + // ToPbText marshals PatternFlowIpv4Dst to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4Dst to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4Dst to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4Dst struct { + obj *patternFlowIpv4Dst +} + +type unMarshalPatternFlowIpv4Dst interface { + // FromProto unmarshals PatternFlowIpv4Dst from protobuf object *otg.PatternFlowIpv4Dst + FromProto(msg *otg.PatternFlowIpv4Dst) (PatternFlowIpv4Dst, error) + // FromPbText unmarshals PatternFlowIpv4Dst from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4Dst from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4Dst from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4Dst) Marshal() marshalPatternFlowIpv4Dst { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4Dst{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4Dst) Unmarshal() unMarshalPatternFlowIpv4Dst { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4Dst{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4Dst) ToProto() (*otg.PatternFlowIpv4Dst, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4Dst) FromProto(msg *otg.PatternFlowIpv4Dst) (PatternFlowIpv4Dst, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4Dst) 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 *unMarshalpatternFlowIpv4Dst) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4Dst) 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 *unMarshalpatternFlowIpv4Dst) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4Dst) 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 *unMarshalpatternFlowIpv4Dst) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4Dst) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4Dst) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4Dst) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4Dst) Clone() (PatternFlowIpv4Dst, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4Dst() + 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 +} + +func (obj *patternFlowIpv4Dst) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.autoHolder = nil + obj.randomHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4Dst is destination address +type PatternFlowIpv4Dst interface { + Validation + // msg marshals PatternFlowIpv4Dst to protobuf object *otg.PatternFlowIpv4Dst + // and doesn't set defaults + msg() *otg.PatternFlowIpv4Dst + // setMsg unmarshals PatternFlowIpv4Dst from protobuf object *otg.PatternFlowIpv4Dst + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4Dst) PatternFlowIpv4Dst + // provides marshal interface + Marshal() marshalPatternFlowIpv4Dst + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4Dst + // validate validates PatternFlowIpv4Dst + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4Dst, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4DstChoiceEnum, set in PatternFlowIpv4Dst + Choice() PatternFlowIpv4DstChoiceEnum + // setChoice assigns PatternFlowIpv4DstChoiceEnum provided by user to PatternFlowIpv4Dst + setChoice(value PatternFlowIpv4DstChoiceEnum) PatternFlowIpv4Dst + // HasChoice checks if Choice has been set in PatternFlowIpv4Dst + HasChoice() bool + // Value returns string, set in PatternFlowIpv4Dst. + Value() string + // SetValue assigns string provided by user to PatternFlowIpv4Dst + SetValue(value string) PatternFlowIpv4Dst + // HasValue checks if Value has been set in PatternFlowIpv4Dst + HasValue() bool + // Values returns []string, set in PatternFlowIpv4Dst. + Values() []string + // SetValues assigns []string provided by user to PatternFlowIpv4Dst + SetValues(value []string) PatternFlowIpv4Dst + // Increment returns PatternFlowIpv4DstCounter, set in PatternFlowIpv4Dst. + // PatternFlowIpv4DstCounter is ipv4 counter pattern + Increment() PatternFlowIpv4DstCounter + // SetIncrement assigns PatternFlowIpv4DstCounter provided by user to PatternFlowIpv4Dst. + // PatternFlowIpv4DstCounter is ipv4 counter pattern + SetIncrement(value PatternFlowIpv4DstCounter) PatternFlowIpv4Dst + // HasIncrement checks if Increment has been set in PatternFlowIpv4Dst + HasIncrement() bool + // Decrement returns PatternFlowIpv4DstCounter, set in PatternFlowIpv4Dst. + // PatternFlowIpv4DstCounter is ipv4 counter pattern + Decrement() PatternFlowIpv4DstCounter + // SetDecrement assigns PatternFlowIpv4DstCounter provided by user to PatternFlowIpv4Dst. + // PatternFlowIpv4DstCounter is ipv4 counter pattern + SetDecrement(value PatternFlowIpv4DstCounter) PatternFlowIpv4Dst + // HasDecrement checks if Decrement has been set in PatternFlowIpv4Dst + HasDecrement() bool + // MetricTags returns PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIterIter, set in PatternFlowIpv4Dst + MetricTags() PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter + // Auto returns FlowIpv4Auto, set in PatternFlowIpv4Dst. + // FlowIpv4Auto is the OTG implementation can provide a system generated, value for this property. + Auto() FlowIpv4Auto + // HasAuto checks if Auto has been set in PatternFlowIpv4Dst + HasAuto() bool + // Random returns PatternFlowIpv4DstRandom, set in PatternFlowIpv4Dst. + // PatternFlowIpv4DstRandom is ipv4 random pattern + Random() PatternFlowIpv4DstRandom + // SetRandom assigns PatternFlowIpv4DstRandom provided by user to PatternFlowIpv4Dst. + // PatternFlowIpv4DstRandom is ipv4 random pattern + SetRandom(value PatternFlowIpv4DstRandom) PatternFlowIpv4Dst + // HasRandom checks if Random has been set in PatternFlowIpv4Dst + HasRandom() bool + setNil() +} + +type PatternFlowIpv4DstChoiceEnum string + +// Enum of Choice on PatternFlowIpv4Dst +var PatternFlowIpv4DstChoice = struct { + VALUE PatternFlowIpv4DstChoiceEnum + VALUES PatternFlowIpv4DstChoiceEnum + INCREMENT PatternFlowIpv4DstChoiceEnum + DECREMENT PatternFlowIpv4DstChoiceEnum + AUTO PatternFlowIpv4DstChoiceEnum + RANDOM PatternFlowIpv4DstChoiceEnum +}{ + VALUE: PatternFlowIpv4DstChoiceEnum("value"), + VALUES: PatternFlowIpv4DstChoiceEnum("values"), + INCREMENT: PatternFlowIpv4DstChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4DstChoiceEnum("decrement"), + AUTO: PatternFlowIpv4DstChoiceEnum("auto"), + RANDOM: PatternFlowIpv4DstChoiceEnum("random"), +} + +func (obj *patternFlowIpv4Dst) Choice() PatternFlowIpv4DstChoiceEnum { + return PatternFlowIpv4DstChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4Dst) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4Dst) setChoice(value PatternFlowIpv4DstChoiceEnum) PatternFlowIpv4Dst { + intValue, ok := otg.PatternFlowIpv4Dst_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4DstChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4Dst_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Random = nil + obj.randomHolder = nil + obj.obj.Auto = nil + obj.autoHolder = nil + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4DstChoice.VALUE { + defaultValue := "0.0.0.0" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4DstChoice.VALUES { + defaultValue := []string{"0.0.0.0"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4DstChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4DstCounter().msg() + } + + if value == PatternFlowIpv4DstChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4DstCounter().msg() + } + + if value == PatternFlowIpv4DstChoice.AUTO { + obj.obj.Auto = NewFlowIpv4Auto().msg() + } + + if value == PatternFlowIpv4DstChoice.RANDOM { + obj.obj.Random = NewPatternFlowIpv4DstRandom().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowIpv4Dst) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4DstChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowIpv4Dst) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowIpv4Dst object +func (obj *patternFlowIpv4Dst) SetValue(value string) PatternFlowIpv4Dst { + obj.setChoice(PatternFlowIpv4DstChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowIpv4Dst) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"0.0.0.0"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowIpv4Dst object +func (obj *patternFlowIpv4Dst) SetValues(value []string) PatternFlowIpv4Dst { + obj.setChoice(PatternFlowIpv4DstChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4DstCounter +func (obj *patternFlowIpv4Dst) Increment() PatternFlowIpv4DstCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4DstChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4DstCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4DstCounter +func (obj *patternFlowIpv4Dst) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4DstCounter value in the PatternFlowIpv4Dst object +func (obj *patternFlowIpv4Dst) SetIncrement(value PatternFlowIpv4DstCounter) PatternFlowIpv4Dst { + obj.setChoice(PatternFlowIpv4DstChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4DstCounter +func (obj *patternFlowIpv4Dst) Decrement() PatternFlowIpv4DstCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4DstChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4DstCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4DstCounter +func (obj *patternFlowIpv4Dst) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4DstCounter value in the PatternFlowIpv4Dst object +func (obj *patternFlowIpv4Dst) SetDecrement(value PatternFlowIpv4DstCounter) PatternFlowIpv4Dst { + obj.setChoice(PatternFlowIpv4DstChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4DstMetricTag +func (obj *patternFlowIpv4Dst) MetricTags() PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4DstMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter struct { + obj *patternFlowIpv4Dst + patternFlowIpv4DstMetricTagSlice []PatternFlowIpv4DstMetricTag + fieldPtr *[]*otg.PatternFlowIpv4DstMetricTag +} + +func newPatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter(ptr *[]*otg.PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { + return &patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter interface { + setMsg(*patternFlowIpv4Dst) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter + Items() []PatternFlowIpv4DstMetricTag + Add() PatternFlowIpv4DstMetricTag + Append(items ...PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter + Set(index int, newObj PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter + Clear() PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter + clearHolderSlice() PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter + appendHolderSlice(item PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter +} + +func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) setMsg(msg *patternFlowIpv4Dst) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4DstMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) Items() []PatternFlowIpv4DstMetricTag { + return obj.patternFlowIpv4DstMetricTagSlice +} + +func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) Add() PatternFlowIpv4DstMetricTag { + newObj := &otg.PatternFlowIpv4DstMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4DstMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4DstMetricTagSlice = append(obj.patternFlowIpv4DstMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) Append(items ...PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4DstMetricTagSlice = append(obj.patternFlowIpv4DstMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) Set(index int, newObj PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4DstMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) Clear() PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4DstMetricTag{} + obj.patternFlowIpv4DstMetricTagSlice = []PatternFlowIpv4DstMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) clearHolderSlice() PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { + if len(obj.patternFlowIpv4DstMetricTagSlice) > 0 { + obj.patternFlowIpv4DstMetricTagSlice = []PatternFlowIpv4DstMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4DstPatternFlowIpv4DstMetricTagIter) appendHolderSlice(item PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstPatternFlowIpv4DstMetricTagIter { + obj.patternFlowIpv4DstMetricTagSlice = append(obj.patternFlowIpv4DstMetricTagSlice, item) + return obj +} + +// description is TBD +// Auto returns a FlowIpv4Auto +func (obj *patternFlowIpv4Dst) Auto() FlowIpv4Auto { + if obj.obj.Auto == nil { + obj.setChoice(PatternFlowIpv4DstChoice.AUTO) + } + if obj.autoHolder == nil { + obj.autoHolder = &flowIpv4Auto{obj: obj.obj.Auto} + } + return obj.autoHolder +} + +// description is TBD +// Auto returns a FlowIpv4Auto +func (obj *patternFlowIpv4Dst) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Random returns a PatternFlowIpv4DstRandom +func (obj *patternFlowIpv4Dst) Random() PatternFlowIpv4DstRandom { + if obj.obj.Random == nil { + obj.setChoice(PatternFlowIpv4DstChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &patternFlowIpv4DstRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a PatternFlowIpv4DstRandom +func (obj *patternFlowIpv4Dst) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the PatternFlowIpv4DstRandom value in the PatternFlowIpv4Dst object +func (obj *patternFlowIpv4Dst) SetRandom(value PatternFlowIpv4DstRandom) PatternFlowIpv4Dst { + obj.setChoice(PatternFlowIpv4DstChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + +func (obj *patternFlowIpv4Dst) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv4(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4Dst.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateIpv4Slice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4Dst.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4DstMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Auto != nil { + + obj.Auto().validateObj(vObj, set_default) + } + + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowIpv4Dst) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4DstChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4DstChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4DstChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4DstChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4DstChoice.DECREMENT + } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowIpv4DstChoice.AUTO + } + + if obj.obj.Random != nil { + choices_set += 1 + choice = PatternFlowIpv4DstChoice.RANDOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4DstChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4Dst") + } + } else { + intVal := otg.PatternFlowIpv4Dst_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4Dst_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_dst_counter.go b/gosnappi/pattern_flow_ipv4_dst_counter.go new file mode 100644 index 00000000..aab6c775 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_dst_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowIpv4DstCounter ***** +type patternFlowIpv4DstCounter struct { + validation + obj *otg.PatternFlowIpv4DstCounter + marshaller marshalPatternFlowIpv4DstCounter + unMarshaller unMarshalPatternFlowIpv4DstCounter +} + +func NewPatternFlowIpv4DstCounter() PatternFlowIpv4DstCounter { + obj := patternFlowIpv4DstCounter{obj: &otg.PatternFlowIpv4DstCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4DstCounter) msg() *otg.PatternFlowIpv4DstCounter { + return obj.obj +} + +func (obj *patternFlowIpv4DstCounter) setMsg(msg *otg.PatternFlowIpv4DstCounter) PatternFlowIpv4DstCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4DstCounter struct { + obj *patternFlowIpv4DstCounter +} + +type marshalPatternFlowIpv4DstCounter interface { + // ToProto marshals PatternFlowIpv4DstCounter to protobuf object *otg.PatternFlowIpv4DstCounter + ToProto() (*otg.PatternFlowIpv4DstCounter, error) + // ToPbText marshals PatternFlowIpv4DstCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4DstCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4DstCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4DstCounter struct { + obj *patternFlowIpv4DstCounter +} + +type unMarshalPatternFlowIpv4DstCounter interface { + // FromProto unmarshals PatternFlowIpv4DstCounter from protobuf object *otg.PatternFlowIpv4DstCounter + FromProto(msg *otg.PatternFlowIpv4DstCounter) (PatternFlowIpv4DstCounter, error) + // FromPbText unmarshals PatternFlowIpv4DstCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4DstCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4DstCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4DstCounter) Marshal() marshalPatternFlowIpv4DstCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4DstCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4DstCounter) Unmarshal() unMarshalPatternFlowIpv4DstCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4DstCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4DstCounter) ToProto() (*otg.PatternFlowIpv4DstCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4DstCounter) FromProto(msg *otg.PatternFlowIpv4DstCounter) (PatternFlowIpv4DstCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4DstCounter) 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 *unMarshalpatternFlowIpv4DstCounter) 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 *marshalpatternFlowIpv4DstCounter) 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 *unMarshalpatternFlowIpv4DstCounter) 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 *marshalpatternFlowIpv4DstCounter) 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 *unMarshalpatternFlowIpv4DstCounter) 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 *patternFlowIpv4DstCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DstCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DstCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4DstCounter) Clone() (PatternFlowIpv4DstCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4DstCounter() + 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 +} + +// PatternFlowIpv4DstCounter is ipv4 counter pattern +type PatternFlowIpv4DstCounter interface { + Validation + // msg marshals PatternFlowIpv4DstCounter to protobuf object *otg.PatternFlowIpv4DstCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4DstCounter + // setMsg unmarshals PatternFlowIpv4DstCounter from protobuf object *otg.PatternFlowIpv4DstCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4DstCounter) PatternFlowIpv4DstCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4DstCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4DstCounter + // validate validates PatternFlowIpv4DstCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4DstCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowIpv4DstCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowIpv4DstCounter + SetStart(value string) PatternFlowIpv4DstCounter + // HasStart checks if Start has been set in PatternFlowIpv4DstCounter + HasStart() bool + // Step returns string, set in PatternFlowIpv4DstCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowIpv4DstCounter + SetStep(value string) PatternFlowIpv4DstCounter + // HasStep checks if Step has been set in PatternFlowIpv4DstCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4DstCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4DstCounter + SetCount(value uint32) PatternFlowIpv4DstCounter + // HasCount checks if Count has been set in PatternFlowIpv4DstCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowIpv4DstCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowIpv4DstCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowIpv4DstCounter object +func (obj *patternFlowIpv4DstCounter) SetStart(value string) PatternFlowIpv4DstCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowIpv4DstCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowIpv4DstCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowIpv4DstCounter object +func (obj *patternFlowIpv4DstCounter) SetStep(value string) PatternFlowIpv4DstCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4DstCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4DstCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4DstCounter object +func (obj *patternFlowIpv4DstCounter) SetCount(value uint32) PatternFlowIpv4DstCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4DstCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateIpv4(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4DstCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateIpv4(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4DstCounter.Step")) + } + + } + +} + +func (obj *patternFlowIpv4DstCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("0.0.0.0") + } + if obj.obj.Step == nil { + obj.SetStep("0.0.0.1") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_dst_metric_tag.go b/gosnappi/pattern_flow_ipv4_dst_metric_tag.go new file mode 100644 index 00000000..ad86cdc4 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_dst_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4DstMetricTag ***** +type patternFlowIpv4DstMetricTag struct { + validation + obj *otg.PatternFlowIpv4DstMetricTag + marshaller marshalPatternFlowIpv4DstMetricTag + unMarshaller unMarshalPatternFlowIpv4DstMetricTag +} + +func NewPatternFlowIpv4DstMetricTag() PatternFlowIpv4DstMetricTag { + obj := patternFlowIpv4DstMetricTag{obj: &otg.PatternFlowIpv4DstMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4DstMetricTag) msg() *otg.PatternFlowIpv4DstMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4DstMetricTag) setMsg(msg *otg.PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4DstMetricTag struct { + obj *patternFlowIpv4DstMetricTag +} + +type marshalPatternFlowIpv4DstMetricTag interface { + // ToProto marshals PatternFlowIpv4DstMetricTag to protobuf object *otg.PatternFlowIpv4DstMetricTag + ToProto() (*otg.PatternFlowIpv4DstMetricTag, error) + // ToPbText marshals PatternFlowIpv4DstMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4DstMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4DstMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4DstMetricTag struct { + obj *patternFlowIpv4DstMetricTag +} + +type unMarshalPatternFlowIpv4DstMetricTag interface { + // FromProto unmarshals PatternFlowIpv4DstMetricTag from protobuf object *otg.PatternFlowIpv4DstMetricTag + FromProto(msg *otg.PatternFlowIpv4DstMetricTag) (PatternFlowIpv4DstMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4DstMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4DstMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4DstMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4DstMetricTag) Marshal() marshalPatternFlowIpv4DstMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4DstMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4DstMetricTag) Unmarshal() unMarshalPatternFlowIpv4DstMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4DstMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4DstMetricTag) ToProto() (*otg.PatternFlowIpv4DstMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4DstMetricTag) FromProto(msg *otg.PatternFlowIpv4DstMetricTag) (PatternFlowIpv4DstMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4DstMetricTag) 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 *unMarshalpatternFlowIpv4DstMetricTag) 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 *marshalpatternFlowIpv4DstMetricTag) 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 *unMarshalpatternFlowIpv4DstMetricTag) 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 *marshalpatternFlowIpv4DstMetricTag) 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 *unMarshalpatternFlowIpv4DstMetricTag) 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 *patternFlowIpv4DstMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DstMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DstMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4DstMetricTag) Clone() (PatternFlowIpv4DstMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4DstMetricTag() + 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 +} + +// PatternFlowIpv4DstMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4DstMetricTag interface { + Validation + // msg marshals PatternFlowIpv4DstMetricTag to protobuf object *otg.PatternFlowIpv4DstMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4DstMetricTag + // setMsg unmarshals PatternFlowIpv4DstMetricTag from protobuf object *otg.PatternFlowIpv4DstMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4DstMetricTag) PatternFlowIpv4DstMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4DstMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4DstMetricTag + // validate validates PatternFlowIpv4DstMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4DstMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4DstMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4DstMetricTag + SetName(value string) PatternFlowIpv4DstMetricTag + // Offset returns uint32, set in PatternFlowIpv4DstMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4DstMetricTag + SetOffset(value uint32) PatternFlowIpv4DstMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4DstMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4DstMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4DstMetricTag + SetLength(value uint32) PatternFlowIpv4DstMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4DstMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4DstMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4DstMetricTag object +func (obj *patternFlowIpv4DstMetricTag) SetName(value string) PatternFlowIpv4DstMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4DstMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4DstMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4DstMetricTag object +func (obj *patternFlowIpv4DstMetricTag) SetOffset(value uint32) PatternFlowIpv4DstMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4DstMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4DstMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4DstMetricTag object +func (obj *patternFlowIpv4DstMetricTag) SetLength(value uint32) PatternFlowIpv4DstMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4DstMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4DstMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4DstMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4DstMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4DstMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(32) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_dst_random.go b/gosnappi/pattern_flow_ipv4_dst_random.go new file mode 100644 index 00000000..7d11d88d --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_dst_random.go @@ -0,0 +1,420 @@ +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" +) + +// ***** PatternFlowIpv4DstRandom ***** +type patternFlowIpv4DstRandom struct { + validation + obj *otg.PatternFlowIpv4DstRandom + marshaller marshalPatternFlowIpv4DstRandom + unMarshaller unMarshalPatternFlowIpv4DstRandom +} + +func NewPatternFlowIpv4DstRandom() PatternFlowIpv4DstRandom { + obj := patternFlowIpv4DstRandom{obj: &otg.PatternFlowIpv4DstRandom{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4DstRandom) msg() *otg.PatternFlowIpv4DstRandom { + return obj.obj +} + +func (obj *patternFlowIpv4DstRandom) setMsg(msg *otg.PatternFlowIpv4DstRandom) PatternFlowIpv4DstRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4DstRandom struct { + obj *patternFlowIpv4DstRandom +} + +type marshalPatternFlowIpv4DstRandom interface { + // ToProto marshals PatternFlowIpv4DstRandom to protobuf object *otg.PatternFlowIpv4DstRandom + ToProto() (*otg.PatternFlowIpv4DstRandom, error) + // ToPbText marshals PatternFlowIpv4DstRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4DstRandom to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4DstRandom to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4DstRandom struct { + obj *patternFlowIpv4DstRandom +} + +type unMarshalPatternFlowIpv4DstRandom interface { + // FromProto unmarshals PatternFlowIpv4DstRandom from protobuf object *otg.PatternFlowIpv4DstRandom + FromProto(msg *otg.PatternFlowIpv4DstRandom) (PatternFlowIpv4DstRandom, error) + // FromPbText unmarshals PatternFlowIpv4DstRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4DstRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4DstRandom from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4DstRandom) Marshal() marshalPatternFlowIpv4DstRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4DstRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4DstRandom) Unmarshal() unMarshalPatternFlowIpv4DstRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4DstRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4DstRandom) ToProto() (*otg.PatternFlowIpv4DstRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4DstRandom) FromProto(msg *otg.PatternFlowIpv4DstRandom) (PatternFlowIpv4DstRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4DstRandom) 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 *unMarshalpatternFlowIpv4DstRandom) 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 *marshalpatternFlowIpv4DstRandom) 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 *unMarshalpatternFlowIpv4DstRandom) 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 *marshalpatternFlowIpv4DstRandom) 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 *unMarshalpatternFlowIpv4DstRandom) 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 *patternFlowIpv4DstRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DstRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4DstRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4DstRandom) Clone() (PatternFlowIpv4DstRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4DstRandom() + 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 +} + +// PatternFlowIpv4DstRandom is ipv4 random pattern +type PatternFlowIpv4DstRandom interface { + Validation + // msg marshals PatternFlowIpv4DstRandom to protobuf object *otg.PatternFlowIpv4DstRandom + // and doesn't set defaults + msg() *otg.PatternFlowIpv4DstRandom + // setMsg unmarshals PatternFlowIpv4DstRandom from protobuf object *otg.PatternFlowIpv4DstRandom + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4DstRandom) PatternFlowIpv4DstRandom + // provides marshal interface + Marshal() marshalPatternFlowIpv4DstRandom + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4DstRandom + // validate validates PatternFlowIpv4DstRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4DstRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns string, set in PatternFlowIpv4DstRandom. + Min() string + // SetMin assigns string provided by user to PatternFlowIpv4DstRandom + SetMin(value string) PatternFlowIpv4DstRandom + // HasMin checks if Min has been set in PatternFlowIpv4DstRandom + HasMin() bool + // Max returns string, set in PatternFlowIpv4DstRandom. + Max() string + // SetMax assigns string provided by user to PatternFlowIpv4DstRandom + SetMax(value string) PatternFlowIpv4DstRandom + // HasMax checks if Max has been set in PatternFlowIpv4DstRandom + HasMax() bool + // Seed returns uint32, set in PatternFlowIpv4DstRandom. + Seed() uint32 + // SetSeed assigns uint32 provided by user to PatternFlowIpv4DstRandom + SetSeed(value uint32) PatternFlowIpv4DstRandom + // HasSeed checks if Seed has been set in PatternFlowIpv4DstRandom + HasSeed() bool + // Count returns uint32, set in PatternFlowIpv4DstRandom. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4DstRandom + SetCount(value uint32) PatternFlowIpv4DstRandom + // HasCount checks if Count has been set in PatternFlowIpv4DstRandom + HasCount() bool +} + +// The minimum possible value generated by the random value generator. +// Min returns a string +func (obj *patternFlowIpv4DstRandom) Min() string { + + return *obj.obj.Min + +} + +// The minimum possible value generated by the random value generator. +// Min returns a string +func (obj *patternFlowIpv4DstRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// The minimum possible value generated by the random value generator. +// SetMin sets the string value in the PatternFlowIpv4DstRandom object +func (obj *patternFlowIpv4DstRandom) SetMin(value string) PatternFlowIpv4DstRandom { + + obj.obj.Min = &value + return obj +} + +// The maximum possible value generated by the random value generator. +// Max returns a string +func (obj *patternFlowIpv4DstRandom) Max() string { + + return *obj.obj.Max + +} + +// The maximum possible value generated by the random value generator. +// Max returns a string +func (obj *patternFlowIpv4DstRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// The maximum possible value generated by the random value generator. +// SetMax sets the string value in the PatternFlowIpv4DstRandom object +func (obj *patternFlowIpv4DstRandom) SetMax(value string) PatternFlowIpv4DstRandom { + + obj.obj.Max = &value + return obj +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowIpv4DstRandom) Seed() uint32 { + + return *obj.obj.Seed + +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowIpv4DstRandom) HasSeed() bool { + return obj.obj.Seed != nil +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// SetSeed sets the uint32 value in the PatternFlowIpv4DstRandom object +func (obj *patternFlowIpv4DstRandom) SetSeed(value uint32) PatternFlowIpv4DstRandom { + + obj.obj.Seed = &value + return obj +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowIpv4DstRandom) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowIpv4DstRandom) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of values to be generated by the random value generator. +// SetCount sets the uint32 value in the PatternFlowIpv4DstRandom object +func (obj *patternFlowIpv4DstRandom) SetCount(value uint32) PatternFlowIpv4DstRandom { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4DstRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Min != nil { + + err := obj.validateIpv4(obj.Min()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4DstRandom.Min")) + } + + } + + if obj.obj.Max != nil { + + err := obj.validateIpv4(obj.Max()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4DstRandom.Max")) + } + + } + +} + +func (obj *patternFlowIpv4DstRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin("0.0.0.0") + } + if obj.obj.Max == nil { + obj.SetMax("255.255.255.255") + } + if obj.obj.Seed == nil { + obj.SetSeed(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_fragment_offset.go b/gosnappi/pattern_flow_ipv4_fragment_offset.go new file mode 100644 index 00000000..a28fc070 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_fragment_offset.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4FragmentOffset ***** +type patternFlowIpv4FragmentOffset struct { + validation + obj *otg.PatternFlowIpv4FragmentOffset + marshaller marshalPatternFlowIpv4FragmentOffset + unMarshaller unMarshalPatternFlowIpv4FragmentOffset + incrementHolder PatternFlowIpv4FragmentOffsetCounter + decrementHolder PatternFlowIpv4FragmentOffsetCounter + metricTagsHolder PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter +} + +func NewPatternFlowIpv4FragmentOffset() PatternFlowIpv4FragmentOffset { + obj := patternFlowIpv4FragmentOffset{obj: &otg.PatternFlowIpv4FragmentOffset{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4FragmentOffset) msg() *otg.PatternFlowIpv4FragmentOffset { + return obj.obj +} + +func (obj *patternFlowIpv4FragmentOffset) setMsg(msg *otg.PatternFlowIpv4FragmentOffset) PatternFlowIpv4FragmentOffset { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4FragmentOffset struct { + obj *patternFlowIpv4FragmentOffset +} + +type marshalPatternFlowIpv4FragmentOffset interface { + // ToProto marshals PatternFlowIpv4FragmentOffset to protobuf object *otg.PatternFlowIpv4FragmentOffset + ToProto() (*otg.PatternFlowIpv4FragmentOffset, error) + // ToPbText marshals PatternFlowIpv4FragmentOffset to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4FragmentOffset to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4FragmentOffset to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4FragmentOffset struct { + obj *patternFlowIpv4FragmentOffset +} + +type unMarshalPatternFlowIpv4FragmentOffset interface { + // FromProto unmarshals PatternFlowIpv4FragmentOffset from protobuf object *otg.PatternFlowIpv4FragmentOffset + FromProto(msg *otg.PatternFlowIpv4FragmentOffset) (PatternFlowIpv4FragmentOffset, error) + // FromPbText unmarshals PatternFlowIpv4FragmentOffset from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4FragmentOffset from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4FragmentOffset from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4FragmentOffset) Marshal() marshalPatternFlowIpv4FragmentOffset { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4FragmentOffset{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4FragmentOffset) Unmarshal() unMarshalPatternFlowIpv4FragmentOffset { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4FragmentOffset{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4FragmentOffset) ToProto() (*otg.PatternFlowIpv4FragmentOffset, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4FragmentOffset) FromProto(msg *otg.PatternFlowIpv4FragmentOffset) (PatternFlowIpv4FragmentOffset, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4FragmentOffset) 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 *unMarshalpatternFlowIpv4FragmentOffset) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4FragmentOffset) 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 *unMarshalpatternFlowIpv4FragmentOffset) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4FragmentOffset) 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 *unMarshalpatternFlowIpv4FragmentOffset) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4FragmentOffset) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4FragmentOffset) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4FragmentOffset) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4FragmentOffset) Clone() (PatternFlowIpv4FragmentOffset, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4FragmentOffset() + 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 +} + +func (obj *patternFlowIpv4FragmentOffset) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4FragmentOffset is fragment offset +type PatternFlowIpv4FragmentOffset interface { + Validation + // msg marshals PatternFlowIpv4FragmentOffset to protobuf object *otg.PatternFlowIpv4FragmentOffset + // and doesn't set defaults + msg() *otg.PatternFlowIpv4FragmentOffset + // setMsg unmarshals PatternFlowIpv4FragmentOffset from protobuf object *otg.PatternFlowIpv4FragmentOffset + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4FragmentOffset) PatternFlowIpv4FragmentOffset + // provides marshal interface + Marshal() marshalPatternFlowIpv4FragmentOffset + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4FragmentOffset + // validate validates PatternFlowIpv4FragmentOffset + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4FragmentOffset, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4FragmentOffsetChoiceEnum, set in PatternFlowIpv4FragmentOffset + Choice() PatternFlowIpv4FragmentOffsetChoiceEnum + // setChoice assigns PatternFlowIpv4FragmentOffsetChoiceEnum provided by user to PatternFlowIpv4FragmentOffset + setChoice(value PatternFlowIpv4FragmentOffsetChoiceEnum) PatternFlowIpv4FragmentOffset + // HasChoice checks if Choice has been set in PatternFlowIpv4FragmentOffset + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4FragmentOffset. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4FragmentOffset + SetValue(value uint32) PatternFlowIpv4FragmentOffset + // HasValue checks if Value has been set in PatternFlowIpv4FragmentOffset + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4FragmentOffset. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4FragmentOffset + SetValues(value []uint32) PatternFlowIpv4FragmentOffset + // Increment returns PatternFlowIpv4FragmentOffsetCounter, set in PatternFlowIpv4FragmentOffset. + // PatternFlowIpv4FragmentOffsetCounter is integer counter pattern + Increment() PatternFlowIpv4FragmentOffsetCounter + // SetIncrement assigns PatternFlowIpv4FragmentOffsetCounter provided by user to PatternFlowIpv4FragmentOffset. + // PatternFlowIpv4FragmentOffsetCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4FragmentOffsetCounter) PatternFlowIpv4FragmentOffset + // HasIncrement checks if Increment has been set in PatternFlowIpv4FragmentOffset + HasIncrement() bool + // Decrement returns PatternFlowIpv4FragmentOffsetCounter, set in PatternFlowIpv4FragmentOffset. + // PatternFlowIpv4FragmentOffsetCounter is integer counter pattern + Decrement() PatternFlowIpv4FragmentOffsetCounter + // SetDecrement assigns PatternFlowIpv4FragmentOffsetCounter provided by user to PatternFlowIpv4FragmentOffset. + // PatternFlowIpv4FragmentOffsetCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4FragmentOffsetCounter) PatternFlowIpv4FragmentOffset + // HasDecrement checks if Decrement has been set in PatternFlowIpv4FragmentOffset + HasDecrement() bool + // MetricTags returns PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIterIter, set in PatternFlowIpv4FragmentOffset + MetricTags() PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter + setNil() +} + +type PatternFlowIpv4FragmentOffsetChoiceEnum string + +// Enum of Choice on PatternFlowIpv4FragmentOffset +var PatternFlowIpv4FragmentOffsetChoice = struct { + VALUE PatternFlowIpv4FragmentOffsetChoiceEnum + VALUES PatternFlowIpv4FragmentOffsetChoiceEnum + INCREMENT PatternFlowIpv4FragmentOffsetChoiceEnum + DECREMENT PatternFlowIpv4FragmentOffsetChoiceEnum +}{ + VALUE: PatternFlowIpv4FragmentOffsetChoiceEnum("value"), + VALUES: PatternFlowIpv4FragmentOffsetChoiceEnum("values"), + INCREMENT: PatternFlowIpv4FragmentOffsetChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4FragmentOffsetChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4FragmentOffset) Choice() PatternFlowIpv4FragmentOffsetChoiceEnum { + return PatternFlowIpv4FragmentOffsetChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4FragmentOffset) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4FragmentOffset) setChoice(value PatternFlowIpv4FragmentOffsetChoiceEnum) PatternFlowIpv4FragmentOffset { + intValue, ok := otg.PatternFlowIpv4FragmentOffset_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4FragmentOffsetChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4FragmentOffset_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4FragmentOffsetChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4FragmentOffsetChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4FragmentOffsetChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4FragmentOffsetCounter().msg() + } + + if value == PatternFlowIpv4FragmentOffsetChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4FragmentOffsetCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4FragmentOffset) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4FragmentOffset) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4FragmentOffset object +func (obj *patternFlowIpv4FragmentOffset) SetValue(value uint32) PatternFlowIpv4FragmentOffset { + obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4FragmentOffset) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4FragmentOffset object +func (obj *patternFlowIpv4FragmentOffset) SetValues(value []uint32) PatternFlowIpv4FragmentOffset { + obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4FragmentOffsetCounter +func (obj *patternFlowIpv4FragmentOffset) Increment() PatternFlowIpv4FragmentOffsetCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4FragmentOffsetCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4FragmentOffsetCounter +func (obj *patternFlowIpv4FragmentOffset) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4FragmentOffsetCounter value in the PatternFlowIpv4FragmentOffset object +func (obj *patternFlowIpv4FragmentOffset) SetIncrement(value PatternFlowIpv4FragmentOffsetCounter) PatternFlowIpv4FragmentOffset { + obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4FragmentOffsetCounter +func (obj *patternFlowIpv4FragmentOffset) Decrement() PatternFlowIpv4FragmentOffsetCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4FragmentOffsetCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4FragmentOffsetCounter +func (obj *patternFlowIpv4FragmentOffset) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4FragmentOffsetCounter value in the PatternFlowIpv4FragmentOffset object +func (obj *patternFlowIpv4FragmentOffset) SetDecrement(value PatternFlowIpv4FragmentOffsetCounter) PatternFlowIpv4FragmentOffset { + obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4FragmentOffsetMetricTag +func (obj *patternFlowIpv4FragmentOffset) MetricTags() PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4FragmentOffsetMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter struct { + obj *patternFlowIpv4FragmentOffset + patternFlowIpv4FragmentOffsetMetricTagSlice []PatternFlowIpv4FragmentOffsetMetricTag + fieldPtr *[]*otg.PatternFlowIpv4FragmentOffsetMetricTag +} + +func newPatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter(ptr *[]*otg.PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { + return &patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter interface { + setMsg(*patternFlowIpv4FragmentOffset) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter + Items() []PatternFlowIpv4FragmentOffsetMetricTag + Add() PatternFlowIpv4FragmentOffsetMetricTag + Append(items ...PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter + Set(index int, newObj PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter + Clear() PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter + clearHolderSlice() PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter + appendHolderSlice(item PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter +} + +func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) setMsg(msg *patternFlowIpv4FragmentOffset) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4FragmentOffsetMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) Items() []PatternFlowIpv4FragmentOffsetMetricTag { + return obj.patternFlowIpv4FragmentOffsetMetricTagSlice +} + +func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) Add() PatternFlowIpv4FragmentOffsetMetricTag { + newObj := &otg.PatternFlowIpv4FragmentOffsetMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4FragmentOffsetMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4FragmentOffsetMetricTagSlice = append(obj.patternFlowIpv4FragmentOffsetMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) Append(items ...PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4FragmentOffsetMetricTagSlice = append(obj.patternFlowIpv4FragmentOffsetMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) Set(index int, newObj PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4FragmentOffsetMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) Clear() PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4FragmentOffsetMetricTag{} + obj.patternFlowIpv4FragmentOffsetMetricTagSlice = []PatternFlowIpv4FragmentOffsetMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) clearHolderSlice() PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { + if len(obj.patternFlowIpv4FragmentOffsetMetricTagSlice) > 0 { + obj.patternFlowIpv4FragmentOffsetMetricTagSlice = []PatternFlowIpv4FragmentOffsetMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter) appendHolderSlice(item PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetPatternFlowIpv4FragmentOffsetMetricTagIter { + obj.patternFlowIpv4FragmentOffsetMetricTagSlice = append(obj.patternFlowIpv4FragmentOffsetMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4FragmentOffset) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4FragmentOffset.Value <= 31 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4FragmentOffset.Values <= 31 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4FragmentOffsetMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4FragmentOffset) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4FragmentOffsetChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4FragmentOffsetChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4FragmentOffsetChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4FragmentOffsetChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4FragmentOffsetChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4FragmentOffsetChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4FragmentOffset") + } + } else { + intVal := otg.PatternFlowIpv4FragmentOffset_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4FragmentOffset_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_fragment_offset_counter.go b/gosnappi/pattern_flow_ipv4_fragment_offset_counter.go new file mode 100644 index 00000000..2057563c --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_fragment_offset_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4FragmentOffsetCounter ***** +type patternFlowIpv4FragmentOffsetCounter struct { + validation + obj *otg.PatternFlowIpv4FragmentOffsetCounter + marshaller marshalPatternFlowIpv4FragmentOffsetCounter + unMarshaller unMarshalPatternFlowIpv4FragmentOffsetCounter +} + +func NewPatternFlowIpv4FragmentOffsetCounter() PatternFlowIpv4FragmentOffsetCounter { + obj := patternFlowIpv4FragmentOffsetCounter{obj: &otg.PatternFlowIpv4FragmentOffsetCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4FragmentOffsetCounter) msg() *otg.PatternFlowIpv4FragmentOffsetCounter { + return obj.obj +} + +func (obj *patternFlowIpv4FragmentOffsetCounter) setMsg(msg *otg.PatternFlowIpv4FragmentOffsetCounter) PatternFlowIpv4FragmentOffsetCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4FragmentOffsetCounter struct { + obj *patternFlowIpv4FragmentOffsetCounter +} + +type marshalPatternFlowIpv4FragmentOffsetCounter interface { + // ToProto marshals PatternFlowIpv4FragmentOffsetCounter to protobuf object *otg.PatternFlowIpv4FragmentOffsetCounter + ToProto() (*otg.PatternFlowIpv4FragmentOffsetCounter, error) + // ToPbText marshals PatternFlowIpv4FragmentOffsetCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4FragmentOffsetCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4FragmentOffsetCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4FragmentOffsetCounter struct { + obj *patternFlowIpv4FragmentOffsetCounter +} + +type unMarshalPatternFlowIpv4FragmentOffsetCounter interface { + // FromProto unmarshals PatternFlowIpv4FragmentOffsetCounter from protobuf object *otg.PatternFlowIpv4FragmentOffsetCounter + FromProto(msg *otg.PatternFlowIpv4FragmentOffsetCounter) (PatternFlowIpv4FragmentOffsetCounter, error) + // FromPbText unmarshals PatternFlowIpv4FragmentOffsetCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4FragmentOffsetCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4FragmentOffsetCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4FragmentOffsetCounter) Marshal() marshalPatternFlowIpv4FragmentOffsetCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4FragmentOffsetCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4FragmentOffsetCounter) Unmarshal() unMarshalPatternFlowIpv4FragmentOffsetCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4FragmentOffsetCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4FragmentOffsetCounter) ToProto() (*otg.PatternFlowIpv4FragmentOffsetCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4FragmentOffsetCounter) FromProto(msg *otg.PatternFlowIpv4FragmentOffsetCounter) (PatternFlowIpv4FragmentOffsetCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4FragmentOffsetCounter) 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 *unMarshalpatternFlowIpv4FragmentOffsetCounter) 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 *marshalpatternFlowIpv4FragmentOffsetCounter) 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 *unMarshalpatternFlowIpv4FragmentOffsetCounter) 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 *marshalpatternFlowIpv4FragmentOffsetCounter) 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 *unMarshalpatternFlowIpv4FragmentOffsetCounter) 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 *patternFlowIpv4FragmentOffsetCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4FragmentOffsetCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4FragmentOffsetCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4FragmentOffsetCounter) Clone() (PatternFlowIpv4FragmentOffsetCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4FragmentOffsetCounter() + 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 +} + +// PatternFlowIpv4FragmentOffsetCounter is integer counter pattern +type PatternFlowIpv4FragmentOffsetCounter interface { + Validation + // msg marshals PatternFlowIpv4FragmentOffsetCounter to protobuf object *otg.PatternFlowIpv4FragmentOffsetCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4FragmentOffsetCounter + // setMsg unmarshals PatternFlowIpv4FragmentOffsetCounter from protobuf object *otg.PatternFlowIpv4FragmentOffsetCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4FragmentOffsetCounter) PatternFlowIpv4FragmentOffsetCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4FragmentOffsetCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4FragmentOffsetCounter + // validate validates PatternFlowIpv4FragmentOffsetCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4FragmentOffsetCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4FragmentOffsetCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4FragmentOffsetCounter + SetStart(value uint32) PatternFlowIpv4FragmentOffsetCounter + // HasStart checks if Start has been set in PatternFlowIpv4FragmentOffsetCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4FragmentOffsetCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4FragmentOffsetCounter + SetStep(value uint32) PatternFlowIpv4FragmentOffsetCounter + // HasStep checks if Step has been set in PatternFlowIpv4FragmentOffsetCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4FragmentOffsetCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4FragmentOffsetCounter + SetCount(value uint32) PatternFlowIpv4FragmentOffsetCounter + // HasCount checks if Count has been set in PatternFlowIpv4FragmentOffsetCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4FragmentOffsetCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4FragmentOffsetCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4FragmentOffsetCounter object +func (obj *patternFlowIpv4FragmentOffsetCounter) SetStart(value uint32) PatternFlowIpv4FragmentOffsetCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4FragmentOffsetCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4FragmentOffsetCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4FragmentOffsetCounter object +func (obj *patternFlowIpv4FragmentOffsetCounter) SetStep(value uint32) PatternFlowIpv4FragmentOffsetCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4FragmentOffsetCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4FragmentOffsetCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4FragmentOffsetCounter object +func (obj *patternFlowIpv4FragmentOffsetCounter) SetCount(value uint32) PatternFlowIpv4FragmentOffsetCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4FragmentOffsetCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4FragmentOffsetCounter.Start <= 31 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4FragmentOffsetCounter.Step <= 31 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4FragmentOffsetCounter.Count <= 31 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4FragmentOffsetCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_fragment_offset_metric_tag.go b/gosnappi/pattern_flow_ipv4_fragment_offset_metric_tag.go new file mode 100644 index 00000000..6c72bb18 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_fragment_offset_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4FragmentOffsetMetricTag ***** +type patternFlowIpv4FragmentOffsetMetricTag struct { + validation + obj *otg.PatternFlowIpv4FragmentOffsetMetricTag + marshaller marshalPatternFlowIpv4FragmentOffsetMetricTag + unMarshaller unMarshalPatternFlowIpv4FragmentOffsetMetricTag +} + +func NewPatternFlowIpv4FragmentOffsetMetricTag() PatternFlowIpv4FragmentOffsetMetricTag { + obj := patternFlowIpv4FragmentOffsetMetricTag{obj: &otg.PatternFlowIpv4FragmentOffsetMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4FragmentOffsetMetricTag) msg() *otg.PatternFlowIpv4FragmentOffsetMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4FragmentOffsetMetricTag) setMsg(msg *otg.PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4FragmentOffsetMetricTag struct { + obj *patternFlowIpv4FragmentOffsetMetricTag +} + +type marshalPatternFlowIpv4FragmentOffsetMetricTag interface { + // ToProto marshals PatternFlowIpv4FragmentOffsetMetricTag to protobuf object *otg.PatternFlowIpv4FragmentOffsetMetricTag + ToProto() (*otg.PatternFlowIpv4FragmentOffsetMetricTag, error) + // ToPbText marshals PatternFlowIpv4FragmentOffsetMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4FragmentOffsetMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4FragmentOffsetMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4FragmentOffsetMetricTag struct { + obj *patternFlowIpv4FragmentOffsetMetricTag +} + +type unMarshalPatternFlowIpv4FragmentOffsetMetricTag interface { + // FromProto unmarshals PatternFlowIpv4FragmentOffsetMetricTag from protobuf object *otg.PatternFlowIpv4FragmentOffsetMetricTag + FromProto(msg *otg.PatternFlowIpv4FragmentOffsetMetricTag) (PatternFlowIpv4FragmentOffsetMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4FragmentOffsetMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4FragmentOffsetMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4FragmentOffsetMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4FragmentOffsetMetricTag) Marshal() marshalPatternFlowIpv4FragmentOffsetMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4FragmentOffsetMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4FragmentOffsetMetricTag) Unmarshal() unMarshalPatternFlowIpv4FragmentOffsetMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4FragmentOffsetMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4FragmentOffsetMetricTag) ToProto() (*otg.PatternFlowIpv4FragmentOffsetMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4FragmentOffsetMetricTag) FromProto(msg *otg.PatternFlowIpv4FragmentOffsetMetricTag) (PatternFlowIpv4FragmentOffsetMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4FragmentOffsetMetricTag) 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 *unMarshalpatternFlowIpv4FragmentOffsetMetricTag) 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 *marshalpatternFlowIpv4FragmentOffsetMetricTag) 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 *unMarshalpatternFlowIpv4FragmentOffsetMetricTag) 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 *marshalpatternFlowIpv4FragmentOffsetMetricTag) 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 *unMarshalpatternFlowIpv4FragmentOffsetMetricTag) 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 *patternFlowIpv4FragmentOffsetMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4FragmentOffsetMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4FragmentOffsetMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4FragmentOffsetMetricTag) Clone() (PatternFlowIpv4FragmentOffsetMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4FragmentOffsetMetricTag() + 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 +} + +// PatternFlowIpv4FragmentOffsetMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4FragmentOffsetMetricTag interface { + Validation + // msg marshals PatternFlowIpv4FragmentOffsetMetricTag to protobuf object *otg.PatternFlowIpv4FragmentOffsetMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4FragmentOffsetMetricTag + // setMsg unmarshals PatternFlowIpv4FragmentOffsetMetricTag from protobuf object *otg.PatternFlowIpv4FragmentOffsetMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4FragmentOffsetMetricTag) PatternFlowIpv4FragmentOffsetMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4FragmentOffsetMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4FragmentOffsetMetricTag + // validate validates PatternFlowIpv4FragmentOffsetMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4FragmentOffsetMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4FragmentOffsetMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4FragmentOffsetMetricTag + SetName(value string) PatternFlowIpv4FragmentOffsetMetricTag + // Offset returns uint32, set in PatternFlowIpv4FragmentOffsetMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4FragmentOffsetMetricTag + SetOffset(value uint32) PatternFlowIpv4FragmentOffsetMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4FragmentOffsetMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4FragmentOffsetMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4FragmentOffsetMetricTag + SetLength(value uint32) PatternFlowIpv4FragmentOffsetMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4FragmentOffsetMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4FragmentOffsetMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4FragmentOffsetMetricTag object +func (obj *patternFlowIpv4FragmentOffsetMetricTag) SetName(value string) PatternFlowIpv4FragmentOffsetMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4FragmentOffsetMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4FragmentOffsetMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4FragmentOffsetMetricTag object +func (obj *patternFlowIpv4FragmentOffsetMetricTag) SetOffset(value uint32) PatternFlowIpv4FragmentOffsetMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4FragmentOffsetMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4FragmentOffsetMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4FragmentOffsetMetricTag object +func (obj *patternFlowIpv4FragmentOffsetMetricTag) SetLength(value uint32) PatternFlowIpv4FragmentOffsetMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4FragmentOffsetMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4FragmentOffsetMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 4 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4FragmentOffsetMetricTag.Offset <= 4 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 5 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4FragmentOffsetMetricTag.Length <= 5 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4FragmentOffsetMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(5) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_header_checksum.go b/gosnappi/pattern_flow_ipv4_header_checksum.go new file mode 100644 index 00000000..e6d6319e --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_header_checksum.go @@ -0,0 +1,434 @@ +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" +) + +// ***** PatternFlowIpv4HeaderChecksum ***** +type patternFlowIpv4HeaderChecksum struct { + validation + obj *otg.PatternFlowIpv4HeaderChecksum + marshaller marshalPatternFlowIpv4HeaderChecksum + unMarshaller unMarshalPatternFlowIpv4HeaderChecksum +} + +func NewPatternFlowIpv4HeaderChecksum() PatternFlowIpv4HeaderChecksum { + obj := patternFlowIpv4HeaderChecksum{obj: &otg.PatternFlowIpv4HeaderChecksum{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4HeaderChecksum) msg() *otg.PatternFlowIpv4HeaderChecksum { + return obj.obj +} + +func (obj *patternFlowIpv4HeaderChecksum) setMsg(msg *otg.PatternFlowIpv4HeaderChecksum) PatternFlowIpv4HeaderChecksum { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4HeaderChecksum struct { + obj *patternFlowIpv4HeaderChecksum +} + +type marshalPatternFlowIpv4HeaderChecksum interface { + // ToProto marshals PatternFlowIpv4HeaderChecksum to protobuf object *otg.PatternFlowIpv4HeaderChecksum + ToProto() (*otg.PatternFlowIpv4HeaderChecksum, error) + // ToPbText marshals PatternFlowIpv4HeaderChecksum to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4HeaderChecksum to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4HeaderChecksum to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4HeaderChecksum struct { + obj *patternFlowIpv4HeaderChecksum +} + +type unMarshalPatternFlowIpv4HeaderChecksum interface { + // FromProto unmarshals PatternFlowIpv4HeaderChecksum from protobuf object *otg.PatternFlowIpv4HeaderChecksum + FromProto(msg *otg.PatternFlowIpv4HeaderChecksum) (PatternFlowIpv4HeaderChecksum, error) + // FromPbText unmarshals PatternFlowIpv4HeaderChecksum from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4HeaderChecksum from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4HeaderChecksum from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4HeaderChecksum) Marshal() marshalPatternFlowIpv4HeaderChecksum { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4HeaderChecksum{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4HeaderChecksum) Unmarshal() unMarshalPatternFlowIpv4HeaderChecksum { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4HeaderChecksum{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4HeaderChecksum) ToProto() (*otg.PatternFlowIpv4HeaderChecksum, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4HeaderChecksum) FromProto(msg *otg.PatternFlowIpv4HeaderChecksum) (PatternFlowIpv4HeaderChecksum, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4HeaderChecksum) 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 *unMarshalpatternFlowIpv4HeaderChecksum) 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 *marshalpatternFlowIpv4HeaderChecksum) 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 *unMarshalpatternFlowIpv4HeaderChecksum) 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 *marshalpatternFlowIpv4HeaderChecksum) 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 *unMarshalpatternFlowIpv4HeaderChecksum) 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 *patternFlowIpv4HeaderChecksum) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4HeaderChecksum) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4HeaderChecksum) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4HeaderChecksum) Clone() (PatternFlowIpv4HeaderChecksum, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4HeaderChecksum() + 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 +} + +// PatternFlowIpv4HeaderChecksum is header checksum +type PatternFlowIpv4HeaderChecksum interface { + Validation + // msg marshals PatternFlowIpv4HeaderChecksum to protobuf object *otg.PatternFlowIpv4HeaderChecksum + // and doesn't set defaults + msg() *otg.PatternFlowIpv4HeaderChecksum + // setMsg unmarshals PatternFlowIpv4HeaderChecksum from protobuf object *otg.PatternFlowIpv4HeaderChecksum + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4HeaderChecksum) PatternFlowIpv4HeaderChecksum + // provides marshal interface + Marshal() marshalPatternFlowIpv4HeaderChecksum + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4HeaderChecksum + // validate validates PatternFlowIpv4HeaderChecksum + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4HeaderChecksum, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4HeaderChecksumChoiceEnum, set in PatternFlowIpv4HeaderChecksum + Choice() PatternFlowIpv4HeaderChecksumChoiceEnum + // setChoice assigns PatternFlowIpv4HeaderChecksumChoiceEnum provided by user to PatternFlowIpv4HeaderChecksum + setChoice(value PatternFlowIpv4HeaderChecksumChoiceEnum) PatternFlowIpv4HeaderChecksum + // HasChoice checks if Choice has been set in PatternFlowIpv4HeaderChecksum + HasChoice() bool + // Generated returns PatternFlowIpv4HeaderChecksumGeneratedEnum, set in PatternFlowIpv4HeaderChecksum + Generated() PatternFlowIpv4HeaderChecksumGeneratedEnum + // SetGenerated assigns PatternFlowIpv4HeaderChecksumGeneratedEnum provided by user to PatternFlowIpv4HeaderChecksum + SetGenerated(value PatternFlowIpv4HeaderChecksumGeneratedEnum) PatternFlowIpv4HeaderChecksum + // HasGenerated checks if Generated has been set in PatternFlowIpv4HeaderChecksum + HasGenerated() bool + // Custom returns uint32, set in PatternFlowIpv4HeaderChecksum. + Custom() uint32 + // SetCustom assigns uint32 provided by user to PatternFlowIpv4HeaderChecksum + SetCustom(value uint32) PatternFlowIpv4HeaderChecksum + // HasCustom checks if Custom has been set in PatternFlowIpv4HeaderChecksum + HasCustom() bool +} + +type PatternFlowIpv4HeaderChecksumChoiceEnum string + +// Enum of Choice on PatternFlowIpv4HeaderChecksum +var PatternFlowIpv4HeaderChecksumChoice = struct { + GENERATED PatternFlowIpv4HeaderChecksumChoiceEnum + CUSTOM PatternFlowIpv4HeaderChecksumChoiceEnum +}{ + GENERATED: PatternFlowIpv4HeaderChecksumChoiceEnum("generated"), + CUSTOM: PatternFlowIpv4HeaderChecksumChoiceEnum("custom"), +} + +func (obj *patternFlowIpv4HeaderChecksum) Choice() PatternFlowIpv4HeaderChecksumChoiceEnum { + return PatternFlowIpv4HeaderChecksumChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The type of checksum +// Choice returns a string +func (obj *patternFlowIpv4HeaderChecksum) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4HeaderChecksum) setChoice(value PatternFlowIpv4HeaderChecksumChoiceEnum) PatternFlowIpv4HeaderChecksum { + intValue, ok := otg.PatternFlowIpv4HeaderChecksum_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4HeaderChecksumChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4HeaderChecksum_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Custom = nil + obj.obj.Generated = otg.PatternFlowIpv4HeaderChecksum_Generated_unspecified.Enum() + return obj +} + +type PatternFlowIpv4HeaderChecksumGeneratedEnum string + +// Enum of Generated on PatternFlowIpv4HeaderChecksum +var PatternFlowIpv4HeaderChecksumGenerated = struct { + GOOD PatternFlowIpv4HeaderChecksumGeneratedEnum + BAD PatternFlowIpv4HeaderChecksumGeneratedEnum +}{ + GOOD: PatternFlowIpv4HeaderChecksumGeneratedEnum("good"), + BAD: PatternFlowIpv4HeaderChecksumGeneratedEnum("bad"), +} + +func (obj *patternFlowIpv4HeaderChecksum) Generated() PatternFlowIpv4HeaderChecksumGeneratedEnum { + return PatternFlowIpv4HeaderChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) +} + +// A system generated checksum value +// Generated returns a string +func (obj *patternFlowIpv4HeaderChecksum) HasGenerated() bool { + return obj.obj.Generated != nil +} + +func (obj *patternFlowIpv4HeaderChecksum) SetGenerated(value PatternFlowIpv4HeaderChecksumGeneratedEnum) PatternFlowIpv4HeaderChecksum { + intValue, ok := otg.PatternFlowIpv4HeaderChecksum_Generated_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4HeaderChecksumGeneratedEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4HeaderChecksum_Generated_Enum(intValue) + obj.obj.Generated = &enumValue + + return obj +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowIpv4HeaderChecksum) Custom() uint32 { + + if obj.obj.Custom == nil { + obj.setChoice(PatternFlowIpv4HeaderChecksumChoice.CUSTOM) + } + + return *obj.obj.Custom + +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowIpv4HeaderChecksum) HasCustom() bool { + return obj.obj.Custom != nil +} + +// A custom checksum value +// SetCustom sets the uint32 value in the PatternFlowIpv4HeaderChecksum object +func (obj *patternFlowIpv4HeaderChecksum) SetCustom(value uint32) PatternFlowIpv4HeaderChecksum { + obj.setChoice(PatternFlowIpv4HeaderChecksumChoice.CUSTOM) + obj.obj.Custom = &value + return obj +} + +func (obj *patternFlowIpv4HeaderChecksum) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Custom != nil { + + if *obj.obj.Custom > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4HeaderChecksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) + } + + } + +} + +func (obj *patternFlowIpv4HeaderChecksum) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4HeaderChecksumChoiceEnum + + if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { + choices_set += 1 + choice = PatternFlowIpv4HeaderChecksumChoice.GENERATED + } + + if obj.obj.Custom != nil { + choices_set += 1 + choice = PatternFlowIpv4HeaderChecksumChoice.CUSTOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4HeaderChecksumChoice.GENERATED) + if obj.obj.Generated.Number() == 0 { + obj.SetGenerated(PatternFlowIpv4HeaderChecksumGenerated.GOOD) + + } + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4HeaderChecksum") + } + } else { + intVal := otg.PatternFlowIpv4HeaderChecksum_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4HeaderChecksum_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_header_length.go b/gosnappi/pattern_flow_ipv4_header_length.go new file mode 100644 index 00000000..b3bfaac0 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_header_length.go @@ -0,0 +1,712 @@ +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" +) + +// ***** PatternFlowIpv4HeaderLength ***** +type patternFlowIpv4HeaderLength struct { + validation + obj *otg.PatternFlowIpv4HeaderLength + marshaller marshalPatternFlowIpv4HeaderLength + unMarshaller unMarshalPatternFlowIpv4HeaderLength + incrementHolder PatternFlowIpv4HeaderLengthCounter + decrementHolder PatternFlowIpv4HeaderLengthCounter + metricTagsHolder PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter +} + +func NewPatternFlowIpv4HeaderLength() PatternFlowIpv4HeaderLength { + obj := patternFlowIpv4HeaderLength{obj: &otg.PatternFlowIpv4HeaderLength{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4HeaderLength) msg() *otg.PatternFlowIpv4HeaderLength { + return obj.obj +} + +func (obj *patternFlowIpv4HeaderLength) setMsg(msg *otg.PatternFlowIpv4HeaderLength) PatternFlowIpv4HeaderLength { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4HeaderLength struct { + obj *patternFlowIpv4HeaderLength +} + +type marshalPatternFlowIpv4HeaderLength interface { + // ToProto marshals PatternFlowIpv4HeaderLength to protobuf object *otg.PatternFlowIpv4HeaderLength + ToProto() (*otg.PatternFlowIpv4HeaderLength, error) + // ToPbText marshals PatternFlowIpv4HeaderLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4HeaderLength to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4HeaderLength to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4HeaderLength struct { + obj *patternFlowIpv4HeaderLength +} + +type unMarshalPatternFlowIpv4HeaderLength interface { + // FromProto unmarshals PatternFlowIpv4HeaderLength from protobuf object *otg.PatternFlowIpv4HeaderLength + FromProto(msg *otg.PatternFlowIpv4HeaderLength) (PatternFlowIpv4HeaderLength, error) + // FromPbText unmarshals PatternFlowIpv4HeaderLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4HeaderLength from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4HeaderLength from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4HeaderLength) Marshal() marshalPatternFlowIpv4HeaderLength { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4HeaderLength{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4HeaderLength) Unmarshal() unMarshalPatternFlowIpv4HeaderLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4HeaderLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4HeaderLength) ToProto() (*otg.PatternFlowIpv4HeaderLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4HeaderLength) FromProto(msg *otg.PatternFlowIpv4HeaderLength) (PatternFlowIpv4HeaderLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4HeaderLength) 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 *unMarshalpatternFlowIpv4HeaderLength) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4HeaderLength) 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 *unMarshalpatternFlowIpv4HeaderLength) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4HeaderLength) 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 *unMarshalpatternFlowIpv4HeaderLength) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4HeaderLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4HeaderLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4HeaderLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4HeaderLength) Clone() (PatternFlowIpv4HeaderLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4HeaderLength() + 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 +} + +func (obj *patternFlowIpv4HeaderLength) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4HeaderLength is header length +type PatternFlowIpv4HeaderLength interface { + Validation + // msg marshals PatternFlowIpv4HeaderLength to protobuf object *otg.PatternFlowIpv4HeaderLength + // and doesn't set defaults + msg() *otg.PatternFlowIpv4HeaderLength + // setMsg unmarshals PatternFlowIpv4HeaderLength from protobuf object *otg.PatternFlowIpv4HeaderLength + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4HeaderLength) PatternFlowIpv4HeaderLength + // provides marshal interface + Marshal() marshalPatternFlowIpv4HeaderLength + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4HeaderLength + // validate validates PatternFlowIpv4HeaderLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4HeaderLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4HeaderLengthChoiceEnum, set in PatternFlowIpv4HeaderLength + Choice() PatternFlowIpv4HeaderLengthChoiceEnum + // setChoice assigns PatternFlowIpv4HeaderLengthChoiceEnum provided by user to PatternFlowIpv4HeaderLength + setChoice(value PatternFlowIpv4HeaderLengthChoiceEnum) PatternFlowIpv4HeaderLength + // HasChoice checks if Choice has been set in PatternFlowIpv4HeaderLength + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4HeaderLength. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4HeaderLength + SetValue(value uint32) PatternFlowIpv4HeaderLength + // HasValue checks if Value has been set in PatternFlowIpv4HeaderLength + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4HeaderLength. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4HeaderLength + SetValues(value []uint32) PatternFlowIpv4HeaderLength + // Auto returns uint32, set in PatternFlowIpv4HeaderLength. + Auto() uint32 + // HasAuto checks if Auto has been set in PatternFlowIpv4HeaderLength + HasAuto() bool + // Increment returns PatternFlowIpv4HeaderLengthCounter, set in PatternFlowIpv4HeaderLength. + // PatternFlowIpv4HeaderLengthCounter is integer counter pattern + Increment() PatternFlowIpv4HeaderLengthCounter + // SetIncrement assigns PatternFlowIpv4HeaderLengthCounter provided by user to PatternFlowIpv4HeaderLength. + // PatternFlowIpv4HeaderLengthCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4HeaderLengthCounter) PatternFlowIpv4HeaderLength + // HasIncrement checks if Increment has been set in PatternFlowIpv4HeaderLength + HasIncrement() bool + // Decrement returns PatternFlowIpv4HeaderLengthCounter, set in PatternFlowIpv4HeaderLength. + // PatternFlowIpv4HeaderLengthCounter is integer counter pattern + Decrement() PatternFlowIpv4HeaderLengthCounter + // SetDecrement assigns PatternFlowIpv4HeaderLengthCounter provided by user to PatternFlowIpv4HeaderLength. + // PatternFlowIpv4HeaderLengthCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4HeaderLengthCounter) PatternFlowIpv4HeaderLength + // HasDecrement checks if Decrement has been set in PatternFlowIpv4HeaderLength + HasDecrement() bool + // MetricTags returns PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIterIter, set in PatternFlowIpv4HeaderLength + MetricTags() PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter + setNil() +} + +type PatternFlowIpv4HeaderLengthChoiceEnum string + +// Enum of Choice on PatternFlowIpv4HeaderLength +var PatternFlowIpv4HeaderLengthChoice = struct { + VALUE PatternFlowIpv4HeaderLengthChoiceEnum + VALUES PatternFlowIpv4HeaderLengthChoiceEnum + AUTO PatternFlowIpv4HeaderLengthChoiceEnum + INCREMENT PatternFlowIpv4HeaderLengthChoiceEnum + DECREMENT PatternFlowIpv4HeaderLengthChoiceEnum +}{ + VALUE: PatternFlowIpv4HeaderLengthChoiceEnum("value"), + VALUES: PatternFlowIpv4HeaderLengthChoiceEnum("values"), + AUTO: PatternFlowIpv4HeaderLengthChoiceEnum("auto"), + INCREMENT: PatternFlowIpv4HeaderLengthChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4HeaderLengthChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4HeaderLength) Choice() PatternFlowIpv4HeaderLengthChoiceEnum { + return PatternFlowIpv4HeaderLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4HeaderLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4HeaderLength) setChoice(value PatternFlowIpv4HeaderLengthChoiceEnum) PatternFlowIpv4HeaderLength { + intValue, ok := otg.PatternFlowIpv4HeaderLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4HeaderLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4HeaderLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Auto = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4HeaderLengthChoice.VALUE { + defaultValue := uint32(5) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4HeaderLengthChoice.VALUES { + defaultValue := []uint32{5} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4HeaderLengthChoice.AUTO { + defaultValue := uint32(5) + obj.obj.Auto = &defaultValue + } + + if value == PatternFlowIpv4HeaderLengthChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4HeaderLengthCounter().msg() + } + + if value == PatternFlowIpv4HeaderLengthChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4HeaderLengthCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4HeaderLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4HeaderLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4HeaderLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4HeaderLength object +func (obj *patternFlowIpv4HeaderLength) SetValue(value uint32) PatternFlowIpv4HeaderLength { + obj.setChoice(PatternFlowIpv4HeaderLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4HeaderLength) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{5}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4HeaderLength object +func (obj *patternFlowIpv4HeaderLength) SetValues(value []uint32) PatternFlowIpv4HeaderLength { + obj.setChoice(PatternFlowIpv4HeaderLengthChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowIpv4HeaderLength) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(PatternFlowIpv4HeaderLengthChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowIpv4HeaderLength) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Increment returns a PatternFlowIpv4HeaderLengthCounter +func (obj *patternFlowIpv4HeaderLength) Increment() PatternFlowIpv4HeaderLengthCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4HeaderLengthChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4HeaderLengthCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4HeaderLengthCounter +func (obj *patternFlowIpv4HeaderLength) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4HeaderLengthCounter value in the PatternFlowIpv4HeaderLength object +func (obj *patternFlowIpv4HeaderLength) SetIncrement(value PatternFlowIpv4HeaderLengthCounter) PatternFlowIpv4HeaderLength { + obj.setChoice(PatternFlowIpv4HeaderLengthChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4HeaderLengthCounter +func (obj *patternFlowIpv4HeaderLength) Decrement() PatternFlowIpv4HeaderLengthCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4HeaderLengthChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4HeaderLengthCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4HeaderLengthCounter +func (obj *patternFlowIpv4HeaderLength) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4HeaderLengthCounter value in the PatternFlowIpv4HeaderLength object +func (obj *patternFlowIpv4HeaderLength) SetDecrement(value PatternFlowIpv4HeaderLengthCounter) PatternFlowIpv4HeaderLength { + obj.setChoice(PatternFlowIpv4HeaderLengthChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4HeaderLengthMetricTag +func (obj *patternFlowIpv4HeaderLength) MetricTags() PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4HeaderLengthMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter struct { + obj *patternFlowIpv4HeaderLength + patternFlowIpv4HeaderLengthMetricTagSlice []PatternFlowIpv4HeaderLengthMetricTag + fieldPtr *[]*otg.PatternFlowIpv4HeaderLengthMetricTag +} + +func newPatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter(ptr *[]*otg.PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { + return &patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter interface { + setMsg(*patternFlowIpv4HeaderLength) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter + Items() []PatternFlowIpv4HeaderLengthMetricTag + Add() PatternFlowIpv4HeaderLengthMetricTag + Append(items ...PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter + Set(index int, newObj PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter + Clear() PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter + clearHolderSlice() PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter + appendHolderSlice(item PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter +} + +func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) setMsg(msg *patternFlowIpv4HeaderLength) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4HeaderLengthMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) Items() []PatternFlowIpv4HeaderLengthMetricTag { + return obj.patternFlowIpv4HeaderLengthMetricTagSlice +} + +func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) Add() PatternFlowIpv4HeaderLengthMetricTag { + newObj := &otg.PatternFlowIpv4HeaderLengthMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4HeaderLengthMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4HeaderLengthMetricTagSlice = append(obj.patternFlowIpv4HeaderLengthMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) Append(items ...PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4HeaderLengthMetricTagSlice = append(obj.patternFlowIpv4HeaderLengthMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) Set(index int, newObj PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4HeaderLengthMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) Clear() PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4HeaderLengthMetricTag{} + obj.patternFlowIpv4HeaderLengthMetricTagSlice = []PatternFlowIpv4HeaderLengthMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) clearHolderSlice() PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { + if len(obj.patternFlowIpv4HeaderLengthMetricTagSlice) > 0 { + obj.patternFlowIpv4HeaderLengthMetricTagSlice = []PatternFlowIpv4HeaderLengthMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter) appendHolderSlice(item PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthPatternFlowIpv4HeaderLengthMetricTagIter { + obj.patternFlowIpv4HeaderLengthMetricTagSlice = append(obj.patternFlowIpv4HeaderLengthMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4HeaderLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4HeaderLength.Value <= 15 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4HeaderLength.Values <= 15 but Got %d", item)) + } + + } + + } + + if obj.obj.Auto != nil { + + if *obj.obj.Auto > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4HeaderLength.Auto <= 15 but Got %d", *obj.obj.Auto)) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4HeaderLengthMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4HeaderLength) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4HeaderLengthChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4HeaderLengthChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4HeaderLengthChoice.VALUES + } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowIpv4HeaderLengthChoice.AUTO + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4HeaderLengthChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4HeaderLengthChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4HeaderLengthChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4HeaderLength") + } + } else { + intVal := otg.PatternFlowIpv4HeaderLength_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4HeaderLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_header_length_counter.go b/gosnappi/pattern_flow_ipv4_header_length_counter.go new file mode 100644 index 00000000..4a5e0a91 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_header_length_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4HeaderLengthCounter ***** +type patternFlowIpv4HeaderLengthCounter struct { + validation + obj *otg.PatternFlowIpv4HeaderLengthCounter + marshaller marshalPatternFlowIpv4HeaderLengthCounter + unMarshaller unMarshalPatternFlowIpv4HeaderLengthCounter +} + +func NewPatternFlowIpv4HeaderLengthCounter() PatternFlowIpv4HeaderLengthCounter { + obj := patternFlowIpv4HeaderLengthCounter{obj: &otg.PatternFlowIpv4HeaderLengthCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4HeaderLengthCounter) msg() *otg.PatternFlowIpv4HeaderLengthCounter { + return obj.obj +} + +func (obj *patternFlowIpv4HeaderLengthCounter) setMsg(msg *otg.PatternFlowIpv4HeaderLengthCounter) PatternFlowIpv4HeaderLengthCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4HeaderLengthCounter struct { + obj *patternFlowIpv4HeaderLengthCounter +} + +type marshalPatternFlowIpv4HeaderLengthCounter interface { + // ToProto marshals PatternFlowIpv4HeaderLengthCounter to protobuf object *otg.PatternFlowIpv4HeaderLengthCounter + ToProto() (*otg.PatternFlowIpv4HeaderLengthCounter, error) + // ToPbText marshals PatternFlowIpv4HeaderLengthCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4HeaderLengthCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4HeaderLengthCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4HeaderLengthCounter struct { + obj *patternFlowIpv4HeaderLengthCounter +} + +type unMarshalPatternFlowIpv4HeaderLengthCounter interface { + // FromProto unmarshals PatternFlowIpv4HeaderLengthCounter from protobuf object *otg.PatternFlowIpv4HeaderLengthCounter + FromProto(msg *otg.PatternFlowIpv4HeaderLengthCounter) (PatternFlowIpv4HeaderLengthCounter, error) + // FromPbText unmarshals PatternFlowIpv4HeaderLengthCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4HeaderLengthCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4HeaderLengthCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4HeaderLengthCounter) Marshal() marshalPatternFlowIpv4HeaderLengthCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4HeaderLengthCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4HeaderLengthCounter) Unmarshal() unMarshalPatternFlowIpv4HeaderLengthCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4HeaderLengthCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4HeaderLengthCounter) ToProto() (*otg.PatternFlowIpv4HeaderLengthCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4HeaderLengthCounter) FromProto(msg *otg.PatternFlowIpv4HeaderLengthCounter) (PatternFlowIpv4HeaderLengthCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4HeaderLengthCounter) 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 *unMarshalpatternFlowIpv4HeaderLengthCounter) 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 *marshalpatternFlowIpv4HeaderLengthCounter) 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 *unMarshalpatternFlowIpv4HeaderLengthCounter) 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 *marshalpatternFlowIpv4HeaderLengthCounter) 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 *unMarshalpatternFlowIpv4HeaderLengthCounter) 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 *patternFlowIpv4HeaderLengthCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4HeaderLengthCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4HeaderLengthCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4HeaderLengthCounter) Clone() (PatternFlowIpv4HeaderLengthCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4HeaderLengthCounter() + 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 +} + +// PatternFlowIpv4HeaderLengthCounter is integer counter pattern +type PatternFlowIpv4HeaderLengthCounter interface { + Validation + // msg marshals PatternFlowIpv4HeaderLengthCounter to protobuf object *otg.PatternFlowIpv4HeaderLengthCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4HeaderLengthCounter + // setMsg unmarshals PatternFlowIpv4HeaderLengthCounter from protobuf object *otg.PatternFlowIpv4HeaderLengthCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4HeaderLengthCounter) PatternFlowIpv4HeaderLengthCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4HeaderLengthCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4HeaderLengthCounter + // validate validates PatternFlowIpv4HeaderLengthCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4HeaderLengthCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4HeaderLengthCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4HeaderLengthCounter + SetStart(value uint32) PatternFlowIpv4HeaderLengthCounter + // HasStart checks if Start has been set in PatternFlowIpv4HeaderLengthCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4HeaderLengthCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4HeaderLengthCounter + SetStep(value uint32) PatternFlowIpv4HeaderLengthCounter + // HasStep checks if Step has been set in PatternFlowIpv4HeaderLengthCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4HeaderLengthCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4HeaderLengthCounter + SetCount(value uint32) PatternFlowIpv4HeaderLengthCounter + // HasCount checks if Count has been set in PatternFlowIpv4HeaderLengthCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4HeaderLengthCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4HeaderLengthCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4HeaderLengthCounter object +func (obj *patternFlowIpv4HeaderLengthCounter) SetStart(value uint32) PatternFlowIpv4HeaderLengthCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4HeaderLengthCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4HeaderLengthCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4HeaderLengthCounter object +func (obj *patternFlowIpv4HeaderLengthCounter) SetStep(value uint32) PatternFlowIpv4HeaderLengthCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4HeaderLengthCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4HeaderLengthCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4HeaderLengthCounter object +func (obj *patternFlowIpv4HeaderLengthCounter) SetCount(value uint32) PatternFlowIpv4HeaderLengthCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4HeaderLengthCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4HeaderLengthCounter.Start <= 15 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4HeaderLengthCounter.Step <= 15 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4HeaderLengthCounter.Count <= 15 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4HeaderLengthCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(5) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_header_length_metric_tag.go b/gosnappi/pattern_flow_ipv4_header_length_metric_tag.go new file mode 100644 index 00000000..e77f13c7 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_header_length_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4HeaderLengthMetricTag ***** +type patternFlowIpv4HeaderLengthMetricTag struct { + validation + obj *otg.PatternFlowIpv4HeaderLengthMetricTag + marshaller marshalPatternFlowIpv4HeaderLengthMetricTag + unMarshaller unMarshalPatternFlowIpv4HeaderLengthMetricTag +} + +func NewPatternFlowIpv4HeaderLengthMetricTag() PatternFlowIpv4HeaderLengthMetricTag { + obj := patternFlowIpv4HeaderLengthMetricTag{obj: &otg.PatternFlowIpv4HeaderLengthMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4HeaderLengthMetricTag) msg() *otg.PatternFlowIpv4HeaderLengthMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4HeaderLengthMetricTag) setMsg(msg *otg.PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4HeaderLengthMetricTag struct { + obj *patternFlowIpv4HeaderLengthMetricTag +} + +type marshalPatternFlowIpv4HeaderLengthMetricTag interface { + // ToProto marshals PatternFlowIpv4HeaderLengthMetricTag to protobuf object *otg.PatternFlowIpv4HeaderLengthMetricTag + ToProto() (*otg.PatternFlowIpv4HeaderLengthMetricTag, error) + // ToPbText marshals PatternFlowIpv4HeaderLengthMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4HeaderLengthMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4HeaderLengthMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4HeaderLengthMetricTag struct { + obj *patternFlowIpv4HeaderLengthMetricTag +} + +type unMarshalPatternFlowIpv4HeaderLengthMetricTag interface { + // FromProto unmarshals PatternFlowIpv4HeaderLengthMetricTag from protobuf object *otg.PatternFlowIpv4HeaderLengthMetricTag + FromProto(msg *otg.PatternFlowIpv4HeaderLengthMetricTag) (PatternFlowIpv4HeaderLengthMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4HeaderLengthMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4HeaderLengthMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4HeaderLengthMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4HeaderLengthMetricTag) Marshal() marshalPatternFlowIpv4HeaderLengthMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4HeaderLengthMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4HeaderLengthMetricTag) Unmarshal() unMarshalPatternFlowIpv4HeaderLengthMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4HeaderLengthMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4HeaderLengthMetricTag) ToProto() (*otg.PatternFlowIpv4HeaderLengthMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4HeaderLengthMetricTag) FromProto(msg *otg.PatternFlowIpv4HeaderLengthMetricTag) (PatternFlowIpv4HeaderLengthMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4HeaderLengthMetricTag) 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 *unMarshalpatternFlowIpv4HeaderLengthMetricTag) 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 *marshalpatternFlowIpv4HeaderLengthMetricTag) 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 *unMarshalpatternFlowIpv4HeaderLengthMetricTag) 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 *marshalpatternFlowIpv4HeaderLengthMetricTag) 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 *unMarshalpatternFlowIpv4HeaderLengthMetricTag) 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 *patternFlowIpv4HeaderLengthMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4HeaderLengthMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4HeaderLengthMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4HeaderLengthMetricTag) Clone() (PatternFlowIpv4HeaderLengthMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4HeaderLengthMetricTag() + 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 +} + +// PatternFlowIpv4HeaderLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4HeaderLengthMetricTag interface { + Validation + // msg marshals PatternFlowIpv4HeaderLengthMetricTag to protobuf object *otg.PatternFlowIpv4HeaderLengthMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4HeaderLengthMetricTag + // setMsg unmarshals PatternFlowIpv4HeaderLengthMetricTag from protobuf object *otg.PatternFlowIpv4HeaderLengthMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4HeaderLengthMetricTag) PatternFlowIpv4HeaderLengthMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4HeaderLengthMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4HeaderLengthMetricTag + // validate validates PatternFlowIpv4HeaderLengthMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4HeaderLengthMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4HeaderLengthMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4HeaderLengthMetricTag + SetName(value string) PatternFlowIpv4HeaderLengthMetricTag + // Offset returns uint32, set in PatternFlowIpv4HeaderLengthMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4HeaderLengthMetricTag + SetOffset(value uint32) PatternFlowIpv4HeaderLengthMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4HeaderLengthMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4HeaderLengthMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4HeaderLengthMetricTag + SetLength(value uint32) PatternFlowIpv4HeaderLengthMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4HeaderLengthMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4HeaderLengthMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4HeaderLengthMetricTag object +func (obj *patternFlowIpv4HeaderLengthMetricTag) SetName(value string) PatternFlowIpv4HeaderLengthMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4HeaderLengthMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4HeaderLengthMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4HeaderLengthMetricTag object +func (obj *patternFlowIpv4HeaderLengthMetricTag) SetOffset(value uint32) PatternFlowIpv4HeaderLengthMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4HeaderLengthMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4HeaderLengthMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4HeaderLengthMetricTag object +func (obj *patternFlowIpv4HeaderLengthMetricTag) SetLength(value uint32) PatternFlowIpv4HeaderLengthMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4HeaderLengthMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4HeaderLengthMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4HeaderLengthMetricTag.Offset <= 3 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 4 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4HeaderLengthMetricTag.Length <= 4 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4HeaderLengthMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(4) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_identification.go b/gosnappi/pattern_flow_ipv4_identification.go new file mode 100644 index 00000000..87083b4a --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_identification.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4Identification ***** +type patternFlowIpv4Identification struct { + validation + obj *otg.PatternFlowIpv4Identification + marshaller marshalPatternFlowIpv4Identification + unMarshaller unMarshalPatternFlowIpv4Identification + incrementHolder PatternFlowIpv4IdentificationCounter + decrementHolder PatternFlowIpv4IdentificationCounter + metricTagsHolder PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter +} + +func NewPatternFlowIpv4Identification() PatternFlowIpv4Identification { + obj := patternFlowIpv4Identification{obj: &otg.PatternFlowIpv4Identification{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4Identification) msg() *otg.PatternFlowIpv4Identification { + return obj.obj +} + +func (obj *patternFlowIpv4Identification) setMsg(msg *otg.PatternFlowIpv4Identification) PatternFlowIpv4Identification { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4Identification struct { + obj *patternFlowIpv4Identification +} + +type marshalPatternFlowIpv4Identification interface { + // ToProto marshals PatternFlowIpv4Identification to protobuf object *otg.PatternFlowIpv4Identification + ToProto() (*otg.PatternFlowIpv4Identification, error) + // ToPbText marshals PatternFlowIpv4Identification to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4Identification to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4Identification to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4Identification struct { + obj *patternFlowIpv4Identification +} + +type unMarshalPatternFlowIpv4Identification interface { + // FromProto unmarshals PatternFlowIpv4Identification from protobuf object *otg.PatternFlowIpv4Identification + FromProto(msg *otg.PatternFlowIpv4Identification) (PatternFlowIpv4Identification, error) + // FromPbText unmarshals PatternFlowIpv4Identification from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4Identification from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4Identification from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4Identification) Marshal() marshalPatternFlowIpv4Identification { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4Identification{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4Identification) Unmarshal() unMarshalPatternFlowIpv4Identification { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4Identification{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4Identification) ToProto() (*otg.PatternFlowIpv4Identification, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4Identification) FromProto(msg *otg.PatternFlowIpv4Identification) (PatternFlowIpv4Identification, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4Identification) 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 *unMarshalpatternFlowIpv4Identification) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4Identification) 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 *unMarshalpatternFlowIpv4Identification) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4Identification) 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 *unMarshalpatternFlowIpv4Identification) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4Identification) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4Identification) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4Identification) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4Identification) Clone() (PatternFlowIpv4Identification, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4Identification() + 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 +} + +func (obj *patternFlowIpv4Identification) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4Identification is identification +type PatternFlowIpv4Identification interface { + Validation + // msg marshals PatternFlowIpv4Identification to protobuf object *otg.PatternFlowIpv4Identification + // and doesn't set defaults + msg() *otg.PatternFlowIpv4Identification + // setMsg unmarshals PatternFlowIpv4Identification from protobuf object *otg.PatternFlowIpv4Identification + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4Identification) PatternFlowIpv4Identification + // provides marshal interface + Marshal() marshalPatternFlowIpv4Identification + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4Identification + // validate validates PatternFlowIpv4Identification + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4Identification, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4IdentificationChoiceEnum, set in PatternFlowIpv4Identification + Choice() PatternFlowIpv4IdentificationChoiceEnum + // setChoice assigns PatternFlowIpv4IdentificationChoiceEnum provided by user to PatternFlowIpv4Identification + setChoice(value PatternFlowIpv4IdentificationChoiceEnum) PatternFlowIpv4Identification + // HasChoice checks if Choice has been set in PatternFlowIpv4Identification + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4Identification. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4Identification + SetValue(value uint32) PatternFlowIpv4Identification + // HasValue checks if Value has been set in PatternFlowIpv4Identification + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4Identification. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4Identification + SetValues(value []uint32) PatternFlowIpv4Identification + // Increment returns PatternFlowIpv4IdentificationCounter, set in PatternFlowIpv4Identification. + // PatternFlowIpv4IdentificationCounter is integer counter pattern + Increment() PatternFlowIpv4IdentificationCounter + // SetIncrement assigns PatternFlowIpv4IdentificationCounter provided by user to PatternFlowIpv4Identification. + // PatternFlowIpv4IdentificationCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4IdentificationCounter) PatternFlowIpv4Identification + // HasIncrement checks if Increment has been set in PatternFlowIpv4Identification + HasIncrement() bool + // Decrement returns PatternFlowIpv4IdentificationCounter, set in PatternFlowIpv4Identification. + // PatternFlowIpv4IdentificationCounter is integer counter pattern + Decrement() PatternFlowIpv4IdentificationCounter + // SetDecrement assigns PatternFlowIpv4IdentificationCounter provided by user to PatternFlowIpv4Identification. + // PatternFlowIpv4IdentificationCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4IdentificationCounter) PatternFlowIpv4Identification + // HasDecrement checks if Decrement has been set in PatternFlowIpv4Identification + HasDecrement() bool + // MetricTags returns PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIterIter, set in PatternFlowIpv4Identification + MetricTags() PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter + setNil() +} + +type PatternFlowIpv4IdentificationChoiceEnum string + +// Enum of Choice on PatternFlowIpv4Identification +var PatternFlowIpv4IdentificationChoice = struct { + VALUE PatternFlowIpv4IdentificationChoiceEnum + VALUES PatternFlowIpv4IdentificationChoiceEnum + INCREMENT PatternFlowIpv4IdentificationChoiceEnum + DECREMENT PatternFlowIpv4IdentificationChoiceEnum +}{ + VALUE: PatternFlowIpv4IdentificationChoiceEnum("value"), + VALUES: PatternFlowIpv4IdentificationChoiceEnum("values"), + INCREMENT: PatternFlowIpv4IdentificationChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4IdentificationChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4Identification) Choice() PatternFlowIpv4IdentificationChoiceEnum { + return PatternFlowIpv4IdentificationChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4Identification) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4Identification) setChoice(value PatternFlowIpv4IdentificationChoiceEnum) PatternFlowIpv4Identification { + intValue, ok := otg.PatternFlowIpv4Identification_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4IdentificationChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4Identification_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4IdentificationChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4IdentificationChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4IdentificationChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4IdentificationCounter().msg() + } + + if value == PatternFlowIpv4IdentificationChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4IdentificationCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4Identification) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4IdentificationChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4Identification) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4Identification object +func (obj *patternFlowIpv4Identification) SetValue(value uint32) PatternFlowIpv4Identification { + obj.setChoice(PatternFlowIpv4IdentificationChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4Identification) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4Identification object +func (obj *patternFlowIpv4Identification) SetValues(value []uint32) PatternFlowIpv4Identification { + obj.setChoice(PatternFlowIpv4IdentificationChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4IdentificationCounter +func (obj *patternFlowIpv4Identification) Increment() PatternFlowIpv4IdentificationCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4IdentificationChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4IdentificationCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4IdentificationCounter +func (obj *patternFlowIpv4Identification) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4IdentificationCounter value in the PatternFlowIpv4Identification object +func (obj *patternFlowIpv4Identification) SetIncrement(value PatternFlowIpv4IdentificationCounter) PatternFlowIpv4Identification { + obj.setChoice(PatternFlowIpv4IdentificationChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4IdentificationCounter +func (obj *patternFlowIpv4Identification) Decrement() PatternFlowIpv4IdentificationCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4IdentificationChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4IdentificationCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4IdentificationCounter +func (obj *patternFlowIpv4Identification) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4IdentificationCounter value in the PatternFlowIpv4Identification object +func (obj *patternFlowIpv4Identification) SetDecrement(value PatternFlowIpv4IdentificationCounter) PatternFlowIpv4Identification { + obj.setChoice(PatternFlowIpv4IdentificationChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4IdentificationMetricTag +func (obj *patternFlowIpv4Identification) MetricTags() PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4IdentificationMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter struct { + obj *patternFlowIpv4Identification + patternFlowIpv4IdentificationMetricTagSlice []PatternFlowIpv4IdentificationMetricTag + fieldPtr *[]*otg.PatternFlowIpv4IdentificationMetricTag +} + +func newPatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter(ptr *[]*otg.PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { + return &patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter interface { + setMsg(*patternFlowIpv4Identification) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter + Items() []PatternFlowIpv4IdentificationMetricTag + Add() PatternFlowIpv4IdentificationMetricTag + Append(items ...PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter + Set(index int, newObj PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter + Clear() PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter + clearHolderSlice() PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter + appendHolderSlice(item PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter +} + +func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) setMsg(msg *patternFlowIpv4Identification) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4IdentificationMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) Items() []PatternFlowIpv4IdentificationMetricTag { + return obj.patternFlowIpv4IdentificationMetricTagSlice +} + +func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) Add() PatternFlowIpv4IdentificationMetricTag { + newObj := &otg.PatternFlowIpv4IdentificationMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4IdentificationMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4IdentificationMetricTagSlice = append(obj.patternFlowIpv4IdentificationMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) Append(items ...PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4IdentificationMetricTagSlice = append(obj.patternFlowIpv4IdentificationMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) Set(index int, newObj PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4IdentificationMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) Clear() PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4IdentificationMetricTag{} + obj.patternFlowIpv4IdentificationMetricTagSlice = []PatternFlowIpv4IdentificationMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) clearHolderSlice() PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { + if len(obj.patternFlowIpv4IdentificationMetricTagSlice) > 0 { + obj.patternFlowIpv4IdentificationMetricTagSlice = []PatternFlowIpv4IdentificationMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter) appendHolderSlice(item PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationPatternFlowIpv4IdentificationMetricTagIter { + obj.patternFlowIpv4IdentificationMetricTagSlice = append(obj.patternFlowIpv4IdentificationMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4Identification) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4Identification.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4Identification.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4IdentificationMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4Identification) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4IdentificationChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4IdentificationChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4IdentificationChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4IdentificationChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4IdentificationChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4IdentificationChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4Identification") + } + } else { + intVal := otg.PatternFlowIpv4Identification_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4Identification_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_identification_counter.go b/gosnappi/pattern_flow_ipv4_identification_counter.go new file mode 100644 index 00000000..c51e842c --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_identification_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4IdentificationCounter ***** +type patternFlowIpv4IdentificationCounter struct { + validation + obj *otg.PatternFlowIpv4IdentificationCounter + marshaller marshalPatternFlowIpv4IdentificationCounter + unMarshaller unMarshalPatternFlowIpv4IdentificationCounter +} + +func NewPatternFlowIpv4IdentificationCounter() PatternFlowIpv4IdentificationCounter { + obj := patternFlowIpv4IdentificationCounter{obj: &otg.PatternFlowIpv4IdentificationCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4IdentificationCounter) msg() *otg.PatternFlowIpv4IdentificationCounter { + return obj.obj +} + +func (obj *patternFlowIpv4IdentificationCounter) setMsg(msg *otg.PatternFlowIpv4IdentificationCounter) PatternFlowIpv4IdentificationCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4IdentificationCounter struct { + obj *patternFlowIpv4IdentificationCounter +} + +type marshalPatternFlowIpv4IdentificationCounter interface { + // ToProto marshals PatternFlowIpv4IdentificationCounter to protobuf object *otg.PatternFlowIpv4IdentificationCounter + ToProto() (*otg.PatternFlowIpv4IdentificationCounter, error) + // ToPbText marshals PatternFlowIpv4IdentificationCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4IdentificationCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4IdentificationCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4IdentificationCounter struct { + obj *patternFlowIpv4IdentificationCounter +} + +type unMarshalPatternFlowIpv4IdentificationCounter interface { + // FromProto unmarshals PatternFlowIpv4IdentificationCounter from protobuf object *otg.PatternFlowIpv4IdentificationCounter + FromProto(msg *otg.PatternFlowIpv4IdentificationCounter) (PatternFlowIpv4IdentificationCounter, error) + // FromPbText unmarshals PatternFlowIpv4IdentificationCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4IdentificationCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4IdentificationCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4IdentificationCounter) Marshal() marshalPatternFlowIpv4IdentificationCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4IdentificationCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4IdentificationCounter) Unmarshal() unMarshalPatternFlowIpv4IdentificationCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4IdentificationCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4IdentificationCounter) ToProto() (*otg.PatternFlowIpv4IdentificationCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4IdentificationCounter) FromProto(msg *otg.PatternFlowIpv4IdentificationCounter) (PatternFlowIpv4IdentificationCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4IdentificationCounter) 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 *unMarshalpatternFlowIpv4IdentificationCounter) 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 *marshalpatternFlowIpv4IdentificationCounter) 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 *unMarshalpatternFlowIpv4IdentificationCounter) 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 *marshalpatternFlowIpv4IdentificationCounter) 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 *unMarshalpatternFlowIpv4IdentificationCounter) 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 *patternFlowIpv4IdentificationCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4IdentificationCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4IdentificationCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4IdentificationCounter) Clone() (PatternFlowIpv4IdentificationCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4IdentificationCounter() + 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 +} + +// PatternFlowIpv4IdentificationCounter is integer counter pattern +type PatternFlowIpv4IdentificationCounter interface { + Validation + // msg marshals PatternFlowIpv4IdentificationCounter to protobuf object *otg.PatternFlowIpv4IdentificationCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4IdentificationCounter + // setMsg unmarshals PatternFlowIpv4IdentificationCounter from protobuf object *otg.PatternFlowIpv4IdentificationCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4IdentificationCounter) PatternFlowIpv4IdentificationCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4IdentificationCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4IdentificationCounter + // validate validates PatternFlowIpv4IdentificationCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4IdentificationCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4IdentificationCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4IdentificationCounter + SetStart(value uint32) PatternFlowIpv4IdentificationCounter + // HasStart checks if Start has been set in PatternFlowIpv4IdentificationCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4IdentificationCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4IdentificationCounter + SetStep(value uint32) PatternFlowIpv4IdentificationCounter + // HasStep checks if Step has been set in PatternFlowIpv4IdentificationCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4IdentificationCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4IdentificationCounter + SetCount(value uint32) PatternFlowIpv4IdentificationCounter + // HasCount checks if Count has been set in PatternFlowIpv4IdentificationCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4IdentificationCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4IdentificationCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4IdentificationCounter object +func (obj *patternFlowIpv4IdentificationCounter) SetStart(value uint32) PatternFlowIpv4IdentificationCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4IdentificationCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4IdentificationCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4IdentificationCounter object +func (obj *patternFlowIpv4IdentificationCounter) SetStep(value uint32) PatternFlowIpv4IdentificationCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4IdentificationCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4IdentificationCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4IdentificationCounter object +func (obj *patternFlowIpv4IdentificationCounter) SetCount(value uint32) PatternFlowIpv4IdentificationCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4IdentificationCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4IdentificationCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4IdentificationCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4IdentificationCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4IdentificationCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_identification_metric_tag.go b/gosnappi/pattern_flow_ipv4_identification_metric_tag.go new file mode 100644 index 00000000..d2968eb3 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_identification_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4IdentificationMetricTag ***** +type patternFlowIpv4IdentificationMetricTag struct { + validation + obj *otg.PatternFlowIpv4IdentificationMetricTag + marshaller marshalPatternFlowIpv4IdentificationMetricTag + unMarshaller unMarshalPatternFlowIpv4IdentificationMetricTag +} + +func NewPatternFlowIpv4IdentificationMetricTag() PatternFlowIpv4IdentificationMetricTag { + obj := patternFlowIpv4IdentificationMetricTag{obj: &otg.PatternFlowIpv4IdentificationMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4IdentificationMetricTag) msg() *otg.PatternFlowIpv4IdentificationMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4IdentificationMetricTag) setMsg(msg *otg.PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4IdentificationMetricTag struct { + obj *patternFlowIpv4IdentificationMetricTag +} + +type marshalPatternFlowIpv4IdentificationMetricTag interface { + // ToProto marshals PatternFlowIpv4IdentificationMetricTag to protobuf object *otg.PatternFlowIpv4IdentificationMetricTag + ToProto() (*otg.PatternFlowIpv4IdentificationMetricTag, error) + // ToPbText marshals PatternFlowIpv4IdentificationMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4IdentificationMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4IdentificationMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4IdentificationMetricTag struct { + obj *patternFlowIpv4IdentificationMetricTag +} + +type unMarshalPatternFlowIpv4IdentificationMetricTag interface { + // FromProto unmarshals PatternFlowIpv4IdentificationMetricTag from protobuf object *otg.PatternFlowIpv4IdentificationMetricTag + FromProto(msg *otg.PatternFlowIpv4IdentificationMetricTag) (PatternFlowIpv4IdentificationMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4IdentificationMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4IdentificationMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4IdentificationMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4IdentificationMetricTag) Marshal() marshalPatternFlowIpv4IdentificationMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4IdentificationMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4IdentificationMetricTag) Unmarshal() unMarshalPatternFlowIpv4IdentificationMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4IdentificationMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4IdentificationMetricTag) ToProto() (*otg.PatternFlowIpv4IdentificationMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4IdentificationMetricTag) FromProto(msg *otg.PatternFlowIpv4IdentificationMetricTag) (PatternFlowIpv4IdentificationMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4IdentificationMetricTag) 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 *unMarshalpatternFlowIpv4IdentificationMetricTag) 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 *marshalpatternFlowIpv4IdentificationMetricTag) 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 *unMarshalpatternFlowIpv4IdentificationMetricTag) 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 *marshalpatternFlowIpv4IdentificationMetricTag) 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 *unMarshalpatternFlowIpv4IdentificationMetricTag) 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 *patternFlowIpv4IdentificationMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4IdentificationMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4IdentificationMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4IdentificationMetricTag) Clone() (PatternFlowIpv4IdentificationMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4IdentificationMetricTag() + 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 +} + +// PatternFlowIpv4IdentificationMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4IdentificationMetricTag interface { + Validation + // msg marshals PatternFlowIpv4IdentificationMetricTag to protobuf object *otg.PatternFlowIpv4IdentificationMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4IdentificationMetricTag + // setMsg unmarshals PatternFlowIpv4IdentificationMetricTag from protobuf object *otg.PatternFlowIpv4IdentificationMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4IdentificationMetricTag) PatternFlowIpv4IdentificationMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4IdentificationMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4IdentificationMetricTag + // validate validates PatternFlowIpv4IdentificationMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4IdentificationMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4IdentificationMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4IdentificationMetricTag + SetName(value string) PatternFlowIpv4IdentificationMetricTag + // Offset returns uint32, set in PatternFlowIpv4IdentificationMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4IdentificationMetricTag + SetOffset(value uint32) PatternFlowIpv4IdentificationMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4IdentificationMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4IdentificationMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4IdentificationMetricTag + SetLength(value uint32) PatternFlowIpv4IdentificationMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4IdentificationMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4IdentificationMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4IdentificationMetricTag object +func (obj *patternFlowIpv4IdentificationMetricTag) SetName(value string) PatternFlowIpv4IdentificationMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4IdentificationMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4IdentificationMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4IdentificationMetricTag object +func (obj *patternFlowIpv4IdentificationMetricTag) SetOffset(value uint32) PatternFlowIpv4IdentificationMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4IdentificationMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4IdentificationMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4IdentificationMetricTag object +func (obj *patternFlowIpv4IdentificationMetricTag) SetLength(value uint32) PatternFlowIpv4IdentificationMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4IdentificationMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4IdentificationMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4IdentificationMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4IdentificationMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4IdentificationMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_more_fragments.go b/gosnappi/pattern_flow_ipv4_more_fragments.go new file mode 100644 index 00000000..f2d9fd6a --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_more_fragments.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4MoreFragments ***** +type patternFlowIpv4MoreFragments struct { + validation + obj *otg.PatternFlowIpv4MoreFragments + marshaller marshalPatternFlowIpv4MoreFragments + unMarshaller unMarshalPatternFlowIpv4MoreFragments + incrementHolder PatternFlowIpv4MoreFragmentsCounter + decrementHolder PatternFlowIpv4MoreFragmentsCounter + metricTagsHolder PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter +} + +func NewPatternFlowIpv4MoreFragments() PatternFlowIpv4MoreFragments { + obj := patternFlowIpv4MoreFragments{obj: &otg.PatternFlowIpv4MoreFragments{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4MoreFragments) msg() *otg.PatternFlowIpv4MoreFragments { + return obj.obj +} + +func (obj *patternFlowIpv4MoreFragments) setMsg(msg *otg.PatternFlowIpv4MoreFragments) PatternFlowIpv4MoreFragments { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4MoreFragments struct { + obj *patternFlowIpv4MoreFragments +} + +type marshalPatternFlowIpv4MoreFragments interface { + // ToProto marshals PatternFlowIpv4MoreFragments to protobuf object *otg.PatternFlowIpv4MoreFragments + ToProto() (*otg.PatternFlowIpv4MoreFragments, error) + // ToPbText marshals PatternFlowIpv4MoreFragments to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4MoreFragments to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4MoreFragments to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4MoreFragments struct { + obj *patternFlowIpv4MoreFragments +} + +type unMarshalPatternFlowIpv4MoreFragments interface { + // FromProto unmarshals PatternFlowIpv4MoreFragments from protobuf object *otg.PatternFlowIpv4MoreFragments + FromProto(msg *otg.PatternFlowIpv4MoreFragments) (PatternFlowIpv4MoreFragments, error) + // FromPbText unmarshals PatternFlowIpv4MoreFragments from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4MoreFragments from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4MoreFragments from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4MoreFragments) Marshal() marshalPatternFlowIpv4MoreFragments { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4MoreFragments{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4MoreFragments) Unmarshal() unMarshalPatternFlowIpv4MoreFragments { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4MoreFragments{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4MoreFragments) ToProto() (*otg.PatternFlowIpv4MoreFragments, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4MoreFragments) FromProto(msg *otg.PatternFlowIpv4MoreFragments) (PatternFlowIpv4MoreFragments, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4MoreFragments) 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 *unMarshalpatternFlowIpv4MoreFragments) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4MoreFragments) 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 *unMarshalpatternFlowIpv4MoreFragments) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4MoreFragments) 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 *unMarshalpatternFlowIpv4MoreFragments) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4MoreFragments) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4MoreFragments) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4MoreFragments) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4MoreFragments) Clone() (PatternFlowIpv4MoreFragments, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4MoreFragments() + 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 +} + +func (obj *patternFlowIpv4MoreFragments) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4MoreFragments is more fragments flag +type PatternFlowIpv4MoreFragments interface { + Validation + // msg marshals PatternFlowIpv4MoreFragments to protobuf object *otg.PatternFlowIpv4MoreFragments + // and doesn't set defaults + msg() *otg.PatternFlowIpv4MoreFragments + // setMsg unmarshals PatternFlowIpv4MoreFragments from protobuf object *otg.PatternFlowIpv4MoreFragments + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4MoreFragments) PatternFlowIpv4MoreFragments + // provides marshal interface + Marshal() marshalPatternFlowIpv4MoreFragments + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4MoreFragments + // validate validates PatternFlowIpv4MoreFragments + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4MoreFragments, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4MoreFragmentsChoiceEnum, set in PatternFlowIpv4MoreFragments + Choice() PatternFlowIpv4MoreFragmentsChoiceEnum + // setChoice assigns PatternFlowIpv4MoreFragmentsChoiceEnum provided by user to PatternFlowIpv4MoreFragments + setChoice(value PatternFlowIpv4MoreFragmentsChoiceEnum) PatternFlowIpv4MoreFragments + // HasChoice checks if Choice has been set in PatternFlowIpv4MoreFragments + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4MoreFragments. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4MoreFragments + SetValue(value uint32) PatternFlowIpv4MoreFragments + // HasValue checks if Value has been set in PatternFlowIpv4MoreFragments + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4MoreFragments. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4MoreFragments + SetValues(value []uint32) PatternFlowIpv4MoreFragments + // Increment returns PatternFlowIpv4MoreFragmentsCounter, set in PatternFlowIpv4MoreFragments. + // PatternFlowIpv4MoreFragmentsCounter is integer counter pattern + Increment() PatternFlowIpv4MoreFragmentsCounter + // SetIncrement assigns PatternFlowIpv4MoreFragmentsCounter provided by user to PatternFlowIpv4MoreFragments. + // PatternFlowIpv4MoreFragmentsCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4MoreFragmentsCounter) PatternFlowIpv4MoreFragments + // HasIncrement checks if Increment has been set in PatternFlowIpv4MoreFragments + HasIncrement() bool + // Decrement returns PatternFlowIpv4MoreFragmentsCounter, set in PatternFlowIpv4MoreFragments. + // PatternFlowIpv4MoreFragmentsCounter is integer counter pattern + Decrement() PatternFlowIpv4MoreFragmentsCounter + // SetDecrement assigns PatternFlowIpv4MoreFragmentsCounter provided by user to PatternFlowIpv4MoreFragments. + // PatternFlowIpv4MoreFragmentsCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4MoreFragmentsCounter) PatternFlowIpv4MoreFragments + // HasDecrement checks if Decrement has been set in PatternFlowIpv4MoreFragments + HasDecrement() bool + // MetricTags returns PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIterIter, set in PatternFlowIpv4MoreFragments + MetricTags() PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter + setNil() +} + +type PatternFlowIpv4MoreFragmentsChoiceEnum string + +// Enum of Choice on PatternFlowIpv4MoreFragments +var PatternFlowIpv4MoreFragmentsChoice = struct { + VALUE PatternFlowIpv4MoreFragmentsChoiceEnum + VALUES PatternFlowIpv4MoreFragmentsChoiceEnum + INCREMENT PatternFlowIpv4MoreFragmentsChoiceEnum + DECREMENT PatternFlowIpv4MoreFragmentsChoiceEnum +}{ + VALUE: PatternFlowIpv4MoreFragmentsChoiceEnum("value"), + VALUES: PatternFlowIpv4MoreFragmentsChoiceEnum("values"), + INCREMENT: PatternFlowIpv4MoreFragmentsChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4MoreFragmentsChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4MoreFragments) Choice() PatternFlowIpv4MoreFragmentsChoiceEnum { + return PatternFlowIpv4MoreFragmentsChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4MoreFragments) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4MoreFragments) setChoice(value PatternFlowIpv4MoreFragmentsChoiceEnum) PatternFlowIpv4MoreFragments { + intValue, ok := otg.PatternFlowIpv4MoreFragments_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4MoreFragmentsChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4MoreFragments_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4MoreFragmentsChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4MoreFragmentsChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4MoreFragmentsChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4MoreFragmentsCounter().msg() + } + + if value == PatternFlowIpv4MoreFragmentsChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4MoreFragmentsCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4MoreFragments) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4MoreFragments) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4MoreFragments object +func (obj *patternFlowIpv4MoreFragments) SetValue(value uint32) PatternFlowIpv4MoreFragments { + obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4MoreFragments) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4MoreFragments object +func (obj *patternFlowIpv4MoreFragments) SetValues(value []uint32) PatternFlowIpv4MoreFragments { + obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4MoreFragmentsCounter +func (obj *patternFlowIpv4MoreFragments) Increment() PatternFlowIpv4MoreFragmentsCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4MoreFragmentsCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4MoreFragmentsCounter +func (obj *patternFlowIpv4MoreFragments) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4MoreFragmentsCounter value in the PatternFlowIpv4MoreFragments object +func (obj *patternFlowIpv4MoreFragments) SetIncrement(value PatternFlowIpv4MoreFragmentsCounter) PatternFlowIpv4MoreFragments { + obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4MoreFragmentsCounter +func (obj *patternFlowIpv4MoreFragments) Decrement() PatternFlowIpv4MoreFragmentsCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4MoreFragmentsCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4MoreFragmentsCounter +func (obj *patternFlowIpv4MoreFragments) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4MoreFragmentsCounter value in the PatternFlowIpv4MoreFragments object +func (obj *patternFlowIpv4MoreFragments) SetDecrement(value PatternFlowIpv4MoreFragmentsCounter) PatternFlowIpv4MoreFragments { + obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4MoreFragmentsMetricTag +func (obj *patternFlowIpv4MoreFragments) MetricTags() PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4MoreFragmentsMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter struct { + obj *patternFlowIpv4MoreFragments + patternFlowIpv4MoreFragmentsMetricTagSlice []PatternFlowIpv4MoreFragmentsMetricTag + fieldPtr *[]*otg.PatternFlowIpv4MoreFragmentsMetricTag +} + +func newPatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter(ptr *[]*otg.PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { + return &patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter interface { + setMsg(*patternFlowIpv4MoreFragments) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter + Items() []PatternFlowIpv4MoreFragmentsMetricTag + Add() PatternFlowIpv4MoreFragmentsMetricTag + Append(items ...PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter + Set(index int, newObj PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter + Clear() PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter + clearHolderSlice() PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter + appendHolderSlice(item PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter +} + +func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) setMsg(msg *patternFlowIpv4MoreFragments) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4MoreFragmentsMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) Items() []PatternFlowIpv4MoreFragmentsMetricTag { + return obj.patternFlowIpv4MoreFragmentsMetricTagSlice +} + +func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) Add() PatternFlowIpv4MoreFragmentsMetricTag { + newObj := &otg.PatternFlowIpv4MoreFragmentsMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4MoreFragmentsMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4MoreFragmentsMetricTagSlice = append(obj.patternFlowIpv4MoreFragmentsMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) Append(items ...PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4MoreFragmentsMetricTagSlice = append(obj.patternFlowIpv4MoreFragmentsMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) Set(index int, newObj PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4MoreFragmentsMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) Clear() PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4MoreFragmentsMetricTag{} + obj.patternFlowIpv4MoreFragmentsMetricTagSlice = []PatternFlowIpv4MoreFragmentsMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) clearHolderSlice() PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { + if len(obj.patternFlowIpv4MoreFragmentsMetricTagSlice) > 0 { + obj.patternFlowIpv4MoreFragmentsMetricTagSlice = []PatternFlowIpv4MoreFragmentsMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter) appendHolderSlice(item PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsPatternFlowIpv4MoreFragmentsMetricTagIter { + obj.patternFlowIpv4MoreFragmentsMetricTagSlice = append(obj.patternFlowIpv4MoreFragmentsMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4MoreFragments) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4MoreFragments.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4MoreFragments.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4MoreFragmentsMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4MoreFragments) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4MoreFragmentsChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4MoreFragmentsChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4MoreFragmentsChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4MoreFragmentsChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4MoreFragmentsChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4MoreFragmentsChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4MoreFragments") + } + } else { + intVal := otg.PatternFlowIpv4MoreFragments_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4MoreFragments_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_more_fragments_counter.go b/gosnappi/pattern_flow_ipv4_more_fragments_counter.go new file mode 100644 index 00000000..d00b9ae3 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_more_fragments_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4MoreFragmentsCounter ***** +type patternFlowIpv4MoreFragmentsCounter struct { + validation + obj *otg.PatternFlowIpv4MoreFragmentsCounter + marshaller marshalPatternFlowIpv4MoreFragmentsCounter + unMarshaller unMarshalPatternFlowIpv4MoreFragmentsCounter +} + +func NewPatternFlowIpv4MoreFragmentsCounter() PatternFlowIpv4MoreFragmentsCounter { + obj := patternFlowIpv4MoreFragmentsCounter{obj: &otg.PatternFlowIpv4MoreFragmentsCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4MoreFragmentsCounter) msg() *otg.PatternFlowIpv4MoreFragmentsCounter { + return obj.obj +} + +func (obj *patternFlowIpv4MoreFragmentsCounter) setMsg(msg *otg.PatternFlowIpv4MoreFragmentsCounter) PatternFlowIpv4MoreFragmentsCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4MoreFragmentsCounter struct { + obj *patternFlowIpv4MoreFragmentsCounter +} + +type marshalPatternFlowIpv4MoreFragmentsCounter interface { + // ToProto marshals PatternFlowIpv4MoreFragmentsCounter to protobuf object *otg.PatternFlowIpv4MoreFragmentsCounter + ToProto() (*otg.PatternFlowIpv4MoreFragmentsCounter, error) + // ToPbText marshals PatternFlowIpv4MoreFragmentsCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4MoreFragmentsCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4MoreFragmentsCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4MoreFragmentsCounter struct { + obj *patternFlowIpv4MoreFragmentsCounter +} + +type unMarshalPatternFlowIpv4MoreFragmentsCounter interface { + // FromProto unmarshals PatternFlowIpv4MoreFragmentsCounter from protobuf object *otg.PatternFlowIpv4MoreFragmentsCounter + FromProto(msg *otg.PatternFlowIpv4MoreFragmentsCounter) (PatternFlowIpv4MoreFragmentsCounter, error) + // FromPbText unmarshals PatternFlowIpv4MoreFragmentsCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4MoreFragmentsCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4MoreFragmentsCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4MoreFragmentsCounter) Marshal() marshalPatternFlowIpv4MoreFragmentsCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4MoreFragmentsCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4MoreFragmentsCounter) Unmarshal() unMarshalPatternFlowIpv4MoreFragmentsCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4MoreFragmentsCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4MoreFragmentsCounter) ToProto() (*otg.PatternFlowIpv4MoreFragmentsCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4MoreFragmentsCounter) FromProto(msg *otg.PatternFlowIpv4MoreFragmentsCounter) (PatternFlowIpv4MoreFragmentsCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4MoreFragmentsCounter) 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 *unMarshalpatternFlowIpv4MoreFragmentsCounter) 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 *marshalpatternFlowIpv4MoreFragmentsCounter) 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 *unMarshalpatternFlowIpv4MoreFragmentsCounter) 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 *marshalpatternFlowIpv4MoreFragmentsCounter) 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 *unMarshalpatternFlowIpv4MoreFragmentsCounter) 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 *patternFlowIpv4MoreFragmentsCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4MoreFragmentsCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4MoreFragmentsCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4MoreFragmentsCounter) Clone() (PatternFlowIpv4MoreFragmentsCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4MoreFragmentsCounter() + 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 +} + +// PatternFlowIpv4MoreFragmentsCounter is integer counter pattern +type PatternFlowIpv4MoreFragmentsCounter interface { + Validation + // msg marshals PatternFlowIpv4MoreFragmentsCounter to protobuf object *otg.PatternFlowIpv4MoreFragmentsCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4MoreFragmentsCounter + // setMsg unmarshals PatternFlowIpv4MoreFragmentsCounter from protobuf object *otg.PatternFlowIpv4MoreFragmentsCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4MoreFragmentsCounter) PatternFlowIpv4MoreFragmentsCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4MoreFragmentsCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4MoreFragmentsCounter + // validate validates PatternFlowIpv4MoreFragmentsCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4MoreFragmentsCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4MoreFragmentsCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4MoreFragmentsCounter + SetStart(value uint32) PatternFlowIpv4MoreFragmentsCounter + // HasStart checks if Start has been set in PatternFlowIpv4MoreFragmentsCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4MoreFragmentsCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4MoreFragmentsCounter + SetStep(value uint32) PatternFlowIpv4MoreFragmentsCounter + // HasStep checks if Step has been set in PatternFlowIpv4MoreFragmentsCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4MoreFragmentsCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4MoreFragmentsCounter + SetCount(value uint32) PatternFlowIpv4MoreFragmentsCounter + // HasCount checks if Count has been set in PatternFlowIpv4MoreFragmentsCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4MoreFragmentsCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4MoreFragmentsCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4MoreFragmentsCounter object +func (obj *patternFlowIpv4MoreFragmentsCounter) SetStart(value uint32) PatternFlowIpv4MoreFragmentsCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4MoreFragmentsCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4MoreFragmentsCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4MoreFragmentsCounter object +func (obj *patternFlowIpv4MoreFragmentsCounter) SetStep(value uint32) PatternFlowIpv4MoreFragmentsCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4MoreFragmentsCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4MoreFragmentsCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4MoreFragmentsCounter object +func (obj *patternFlowIpv4MoreFragmentsCounter) SetCount(value uint32) PatternFlowIpv4MoreFragmentsCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4MoreFragmentsCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4MoreFragmentsCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4MoreFragmentsCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4MoreFragmentsCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4MoreFragmentsCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_more_fragments_metric_tag.go b/gosnappi/pattern_flow_ipv4_more_fragments_metric_tag.go new file mode 100644 index 00000000..d0b80548 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_more_fragments_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4MoreFragmentsMetricTag ***** +type patternFlowIpv4MoreFragmentsMetricTag struct { + validation + obj *otg.PatternFlowIpv4MoreFragmentsMetricTag + marshaller marshalPatternFlowIpv4MoreFragmentsMetricTag + unMarshaller unMarshalPatternFlowIpv4MoreFragmentsMetricTag +} + +func NewPatternFlowIpv4MoreFragmentsMetricTag() PatternFlowIpv4MoreFragmentsMetricTag { + obj := patternFlowIpv4MoreFragmentsMetricTag{obj: &otg.PatternFlowIpv4MoreFragmentsMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4MoreFragmentsMetricTag) msg() *otg.PatternFlowIpv4MoreFragmentsMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4MoreFragmentsMetricTag) setMsg(msg *otg.PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4MoreFragmentsMetricTag struct { + obj *patternFlowIpv4MoreFragmentsMetricTag +} + +type marshalPatternFlowIpv4MoreFragmentsMetricTag interface { + // ToProto marshals PatternFlowIpv4MoreFragmentsMetricTag to protobuf object *otg.PatternFlowIpv4MoreFragmentsMetricTag + ToProto() (*otg.PatternFlowIpv4MoreFragmentsMetricTag, error) + // ToPbText marshals PatternFlowIpv4MoreFragmentsMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4MoreFragmentsMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4MoreFragmentsMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4MoreFragmentsMetricTag struct { + obj *patternFlowIpv4MoreFragmentsMetricTag +} + +type unMarshalPatternFlowIpv4MoreFragmentsMetricTag interface { + // FromProto unmarshals PatternFlowIpv4MoreFragmentsMetricTag from protobuf object *otg.PatternFlowIpv4MoreFragmentsMetricTag + FromProto(msg *otg.PatternFlowIpv4MoreFragmentsMetricTag) (PatternFlowIpv4MoreFragmentsMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4MoreFragmentsMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4MoreFragmentsMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4MoreFragmentsMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4MoreFragmentsMetricTag) Marshal() marshalPatternFlowIpv4MoreFragmentsMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4MoreFragmentsMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4MoreFragmentsMetricTag) Unmarshal() unMarshalPatternFlowIpv4MoreFragmentsMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4MoreFragmentsMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4MoreFragmentsMetricTag) ToProto() (*otg.PatternFlowIpv4MoreFragmentsMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4MoreFragmentsMetricTag) FromProto(msg *otg.PatternFlowIpv4MoreFragmentsMetricTag) (PatternFlowIpv4MoreFragmentsMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4MoreFragmentsMetricTag) 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 *unMarshalpatternFlowIpv4MoreFragmentsMetricTag) 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 *marshalpatternFlowIpv4MoreFragmentsMetricTag) 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 *unMarshalpatternFlowIpv4MoreFragmentsMetricTag) 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 *marshalpatternFlowIpv4MoreFragmentsMetricTag) 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 *unMarshalpatternFlowIpv4MoreFragmentsMetricTag) 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 *patternFlowIpv4MoreFragmentsMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4MoreFragmentsMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4MoreFragmentsMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4MoreFragmentsMetricTag) Clone() (PatternFlowIpv4MoreFragmentsMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4MoreFragmentsMetricTag() + 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 +} + +// PatternFlowIpv4MoreFragmentsMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4MoreFragmentsMetricTag interface { + Validation + // msg marshals PatternFlowIpv4MoreFragmentsMetricTag to protobuf object *otg.PatternFlowIpv4MoreFragmentsMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4MoreFragmentsMetricTag + // setMsg unmarshals PatternFlowIpv4MoreFragmentsMetricTag from protobuf object *otg.PatternFlowIpv4MoreFragmentsMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4MoreFragmentsMetricTag) PatternFlowIpv4MoreFragmentsMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4MoreFragmentsMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4MoreFragmentsMetricTag + // validate validates PatternFlowIpv4MoreFragmentsMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4MoreFragmentsMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4MoreFragmentsMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4MoreFragmentsMetricTag + SetName(value string) PatternFlowIpv4MoreFragmentsMetricTag + // Offset returns uint32, set in PatternFlowIpv4MoreFragmentsMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4MoreFragmentsMetricTag + SetOffset(value uint32) PatternFlowIpv4MoreFragmentsMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4MoreFragmentsMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4MoreFragmentsMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4MoreFragmentsMetricTag + SetLength(value uint32) PatternFlowIpv4MoreFragmentsMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4MoreFragmentsMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4MoreFragmentsMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4MoreFragmentsMetricTag object +func (obj *patternFlowIpv4MoreFragmentsMetricTag) SetName(value string) PatternFlowIpv4MoreFragmentsMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4MoreFragmentsMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4MoreFragmentsMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4MoreFragmentsMetricTag object +func (obj *patternFlowIpv4MoreFragmentsMetricTag) SetOffset(value uint32) PatternFlowIpv4MoreFragmentsMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4MoreFragmentsMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4MoreFragmentsMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4MoreFragmentsMetricTag object +func (obj *patternFlowIpv4MoreFragmentsMetricTag) SetLength(value uint32) PatternFlowIpv4MoreFragmentsMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4MoreFragmentsMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4MoreFragmentsMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4MoreFragmentsMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4MoreFragmentsMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4MoreFragmentsMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_options_custom_type_copied_flag.go b/gosnappi/pattern_flow_ipv4_options_custom_type_copied_flag.go new file mode 100644 index 00000000..f11470ad --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_options_custom_type_copied_flag.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowIpv4OptionsCustomTypeCopiedFlag ***** +type patternFlowIpv4OptionsCustomTypeCopiedFlag struct { + validation + obj *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag + marshaller marshalPatternFlowIpv4OptionsCustomTypeCopiedFlag + unMarshaller unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlag + incrementHolder PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + decrementHolder PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter +} + +func NewPatternFlowIpv4OptionsCustomTypeCopiedFlag() PatternFlowIpv4OptionsCustomTypeCopiedFlag { + obj := patternFlowIpv4OptionsCustomTypeCopiedFlag{obj: &otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) msg() *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag { + return obj.obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) setMsg(msg *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag) PatternFlowIpv4OptionsCustomTypeCopiedFlag { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4OptionsCustomTypeCopiedFlag struct { + obj *patternFlowIpv4OptionsCustomTypeCopiedFlag +} + +type marshalPatternFlowIpv4OptionsCustomTypeCopiedFlag interface { + // ToProto marshals PatternFlowIpv4OptionsCustomTypeCopiedFlag to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag + ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag, error) + // ToPbText marshals PatternFlowIpv4OptionsCustomTypeCopiedFlag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4OptionsCustomTypeCopiedFlag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4OptionsCustomTypeCopiedFlag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlag struct { + obj *patternFlowIpv4OptionsCustomTypeCopiedFlag +} + +type unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlag interface { + // FromProto unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlag from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag + FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag) (PatternFlowIpv4OptionsCustomTypeCopiedFlag, error) + // FromPbText unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Marshal() marshalPatternFlowIpv4OptionsCustomTypeCopiedFlag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4OptionsCustomTypeCopiedFlag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag) (PatternFlowIpv4OptionsCustomTypeCopiedFlag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlag) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Clone() (PatternFlowIpv4OptionsCustomTypeCopiedFlag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4OptionsCustomTypeCopiedFlag() + 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 +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4OptionsCustomTypeCopiedFlag is this flag indicates this option is copied to all fragments on fragmentations. +type PatternFlowIpv4OptionsCustomTypeCopiedFlag interface { + Validation + // msg marshals PatternFlowIpv4OptionsCustomTypeCopiedFlag to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag + // setMsg unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlag from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag) PatternFlowIpv4OptionsCustomTypeCopiedFlag + // provides marshal interface + Marshal() marshalPatternFlowIpv4OptionsCustomTypeCopiedFlag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlag + // validate validates PatternFlowIpv4OptionsCustomTypeCopiedFlag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4OptionsCustomTypeCopiedFlag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum, set in PatternFlowIpv4OptionsCustomTypeCopiedFlag + Choice() PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum + // setChoice assigns PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlag + setChoice(value PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum) PatternFlowIpv4OptionsCustomTypeCopiedFlag + // HasChoice checks if Choice has been set in PatternFlowIpv4OptionsCustomTypeCopiedFlag + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4OptionsCustomTypeCopiedFlag. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlag + SetValue(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlag + // HasValue checks if Value has been set in PatternFlowIpv4OptionsCustomTypeCopiedFlag + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4OptionsCustomTypeCopiedFlag. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlag + SetValues(value []uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlag + // Increment returns PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, set in PatternFlowIpv4OptionsCustomTypeCopiedFlag. + // PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter is integer counter pattern + Increment() PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + // SetIncrement assigns PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlag. + // PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) PatternFlowIpv4OptionsCustomTypeCopiedFlag + // HasIncrement checks if Increment has been set in PatternFlowIpv4OptionsCustomTypeCopiedFlag + HasIncrement() bool + // Decrement returns PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, set in PatternFlowIpv4OptionsCustomTypeCopiedFlag. + // PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter is integer counter pattern + Decrement() PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + // SetDecrement assigns PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlag. + // PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) PatternFlowIpv4OptionsCustomTypeCopiedFlag + // HasDecrement checks if Decrement has been set in PatternFlowIpv4OptionsCustomTypeCopiedFlag + HasDecrement() bool + setNil() +} + +type PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum string + +// Enum of Choice on PatternFlowIpv4OptionsCustomTypeCopiedFlag +var PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice = struct { + VALUE PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum + VALUES PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum + INCREMENT PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum + DECREMENT PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum +}{ + VALUE: PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum("value"), + VALUES: PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum("values"), + INCREMENT: PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Choice() PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum { + return PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) setChoice(value PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum) PatternFlowIpv4OptionsCustomTypeCopiedFlag { + intValue, ok := otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter().msg() + } + + if value == PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeCopiedFlag object +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) SetValue(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlag { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4OptionsCustomTypeCopiedFlag object +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) SetValues(value []uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlag { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Increment() PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4OptionsCustomTypeCopiedFlagCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter value in the PatternFlowIpv4OptionsCustomTypeCopiedFlag object +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) SetIncrement(value PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) PatternFlowIpv4OptionsCustomTypeCopiedFlag { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) Decrement() PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4OptionsCustomTypeCopiedFlagCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter value in the PatternFlowIpv4OptionsCustomTypeCopiedFlag object +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) SetDecrement(value PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) PatternFlowIpv4OptionsCustomTypeCopiedFlag { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeCopiedFlag.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4OptionsCustomTypeCopiedFlag.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlag) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4OptionsCustomTypeCopiedFlagChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeCopiedFlagChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4OptionsCustomTypeCopiedFlag") + } + } else { + intVal := otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4OptionsCustomTypeCopiedFlag_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_options_custom_type_copied_flag_counter.go b/gosnappi/pattern_flow_ipv4_options_custom_type_copied_flag_counter.go new file mode 100644 index 00000000..ca5d338e --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_options_custom_type_copied_flag_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter ***** +type patternFlowIpv4OptionsCustomTypeCopiedFlagCounter struct { + validation + obj *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + marshaller marshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + unMarshaller unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter +} + +func NewPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter() PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { + obj := patternFlowIpv4OptionsCustomTypeCopiedFlagCounter{obj: &otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) msg() *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { + return obj.obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) setMsg(msg *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter struct { + obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter +} + +type marshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter interface { + // ToProto marshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, error) + // ToPbText marshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter struct { + obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter +} + +type unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter interface { + // FromProto unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) (PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, error) + // FromPbText unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) Marshal() marshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) (PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) 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 *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) 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 *marshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) 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 *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) Clone() (PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter() + 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 +} + +// PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter is integer counter pattern +type PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter interface { + Validation + // msg marshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + // setMsg unmarshals PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + // validate validates PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + SetStart(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + // HasStart checks if Start has been set in PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + SetStep(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + // HasStep checks if Step has been set in PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + SetCount(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + // HasCount checks if Count has been set in PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter object +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) SetStart(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter object +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) SetStep(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter object +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) SetCount(value uint32) PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeCopiedFlagCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4OptionsCustomTypeCopiedFlagCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_options_custom_type_option_class.go b/gosnappi/pattern_flow_ipv4_options_custom_type_option_class.go new file mode 100644 index 00000000..b6153b6b --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_options_custom_type_option_class.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowIpv4OptionsCustomTypeOptionClass ***** +type patternFlowIpv4OptionsCustomTypeOptionClass struct { + validation + obj *otg.PatternFlowIpv4OptionsCustomTypeOptionClass + marshaller marshalPatternFlowIpv4OptionsCustomTypeOptionClass + unMarshaller unMarshalPatternFlowIpv4OptionsCustomTypeOptionClass + incrementHolder PatternFlowIpv4OptionsCustomTypeOptionClassCounter + decrementHolder PatternFlowIpv4OptionsCustomTypeOptionClassCounter +} + +func NewPatternFlowIpv4OptionsCustomTypeOptionClass() PatternFlowIpv4OptionsCustomTypeOptionClass { + obj := patternFlowIpv4OptionsCustomTypeOptionClass{obj: &otg.PatternFlowIpv4OptionsCustomTypeOptionClass{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionClass { + return obj.obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) setMsg(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionClass) PatternFlowIpv4OptionsCustomTypeOptionClass { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4OptionsCustomTypeOptionClass struct { + obj *patternFlowIpv4OptionsCustomTypeOptionClass +} + +type marshalPatternFlowIpv4OptionsCustomTypeOptionClass interface { + // ToProto marshals PatternFlowIpv4OptionsCustomTypeOptionClass to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClass + ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionClass, error) + // ToPbText marshals PatternFlowIpv4OptionsCustomTypeOptionClass to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4OptionsCustomTypeOptionClass to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4OptionsCustomTypeOptionClass to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4OptionsCustomTypeOptionClass struct { + obj *patternFlowIpv4OptionsCustomTypeOptionClass +} + +type unMarshalPatternFlowIpv4OptionsCustomTypeOptionClass interface { + // FromProto unmarshals PatternFlowIpv4OptionsCustomTypeOptionClass from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClass + FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionClass) (PatternFlowIpv4OptionsCustomTypeOptionClass, error) + // FromPbText unmarshals PatternFlowIpv4OptionsCustomTypeOptionClass from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4OptionsCustomTypeOptionClass from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4OptionsCustomTypeOptionClass from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionClass { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4OptionsCustomTypeOptionClass{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionClass { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4OptionsCustomTypeOptionClass{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionClass) ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionClass, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClass) FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionClass) (PatternFlowIpv4OptionsCustomTypeOptionClass, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionClass) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClass) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionClass) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClass) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionClass) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClass) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Clone() (PatternFlowIpv4OptionsCustomTypeOptionClass, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4OptionsCustomTypeOptionClass() + 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 +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4OptionsCustomTypeOptionClass is option class [Ref:https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-1]. +type PatternFlowIpv4OptionsCustomTypeOptionClass interface { + Validation + // msg marshals PatternFlowIpv4OptionsCustomTypeOptionClass to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClass + // and doesn't set defaults + msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionClass + // setMsg unmarshals PatternFlowIpv4OptionsCustomTypeOptionClass from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClass + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4OptionsCustomTypeOptionClass) PatternFlowIpv4OptionsCustomTypeOptionClass + // provides marshal interface + Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionClass + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionClass + // validate validates PatternFlowIpv4OptionsCustomTypeOptionClass + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4OptionsCustomTypeOptionClass, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum, set in PatternFlowIpv4OptionsCustomTypeOptionClass + Choice() PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum + // setChoice assigns PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum provided by user to PatternFlowIpv4OptionsCustomTypeOptionClass + setChoice(value PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum) PatternFlowIpv4OptionsCustomTypeOptionClass + // HasChoice checks if Choice has been set in PatternFlowIpv4OptionsCustomTypeOptionClass + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionClass. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionClass + SetValue(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClass + // HasValue checks if Value has been set in PatternFlowIpv4OptionsCustomTypeOptionClass + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4OptionsCustomTypeOptionClass. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionClass + SetValues(value []uint32) PatternFlowIpv4OptionsCustomTypeOptionClass + // Increment returns PatternFlowIpv4OptionsCustomTypeOptionClassCounter, set in PatternFlowIpv4OptionsCustomTypeOptionClass. + // PatternFlowIpv4OptionsCustomTypeOptionClassCounter is integer counter pattern + Increment() PatternFlowIpv4OptionsCustomTypeOptionClassCounter + // SetIncrement assigns PatternFlowIpv4OptionsCustomTypeOptionClassCounter provided by user to PatternFlowIpv4OptionsCustomTypeOptionClass. + // PatternFlowIpv4OptionsCustomTypeOptionClassCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4OptionsCustomTypeOptionClassCounter) PatternFlowIpv4OptionsCustomTypeOptionClass + // HasIncrement checks if Increment has been set in PatternFlowIpv4OptionsCustomTypeOptionClass + HasIncrement() bool + // Decrement returns PatternFlowIpv4OptionsCustomTypeOptionClassCounter, set in PatternFlowIpv4OptionsCustomTypeOptionClass. + // PatternFlowIpv4OptionsCustomTypeOptionClassCounter is integer counter pattern + Decrement() PatternFlowIpv4OptionsCustomTypeOptionClassCounter + // SetDecrement assigns PatternFlowIpv4OptionsCustomTypeOptionClassCounter provided by user to PatternFlowIpv4OptionsCustomTypeOptionClass. + // PatternFlowIpv4OptionsCustomTypeOptionClassCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4OptionsCustomTypeOptionClassCounter) PatternFlowIpv4OptionsCustomTypeOptionClass + // HasDecrement checks if Decrement has been set in PatternFlowIpv4OptionsCustomTypeOptionClass + HasDecrement() bool + setNil() +} + +type PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum string + +// Enum of Choice on PatternFlowIpv4OptionsCustomTypeOptionClass +var PatternFlowIpv4OptionsCustomTypeOptionClassChoice = struct { + VALUE PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum + VALUES PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum + INCREMENT PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum + DECREMENT PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum +}{ + VALUE: PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum("value"), + VALUES: PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum("values"), + INCREMENT: PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Choice() PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum { + return PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) setChoice(value PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum) PatternFlowIpv4OptionsCustomTypeOptionClass { + intValue, ok := otg.PatternFlowIpv4OptionsCustomTypeOptionClass_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4OptionsCustomTypeOptionClass_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4OptionsCustomTypeOptionClassChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4OptionsCustomTypeOptionClassCounter().msg() + } + + if value == PatternFlowIpv4OptionsCustomTypeOptionClassChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4OptionsCustomTypeOptionClassCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionClass object +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) SetValue(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClass { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionClass object +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) SetValues(value []uint32) PatternFlowIpv4OptionsCustomTypeOptionClass { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4OptionsCustomTypeOptionClassCounter +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Increment() PatternFlowIpv4OptionsCustomTypeOptionClassCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4OptionsCustomTypeOptionClassCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4OptionsCustomTypeOptionClassCounter +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4OptionsCustomTypeOptionClassCounter value in the PatternFlowIpv4OptionsCustomTypeOptionClass object +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) SetIncrement(value PatternFlowIpv4OptionsCustomTypeOptionClassCounter) PatternFlowIpv4OptionsCustomTypeOptionClass { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4OptionsCustomTypeOptionClassCounter +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) Decrement() PatternFlowIpv4OptionsCustomTypeOptionClassCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4OptionsCustomTypeOptionClassCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4OptionsCustomTypeOptionClassCounter +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4OptionsCustomTypeOptionClassCounter value in the PatternFlowIpv4OptionsCustomTypeOptionClass object +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) SetDecrement(value PatternFlowIpv4OptionsCustomTypeOptionClassCounter) PatternFlowIpv4OptionsCustomTypeOptionClass { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionClass.Value <= 3 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4OptionsCustomTypeOptionClass.Values <= 3 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClass) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4OptionsCustomTypeOptionClassChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4OptionsCustomTypeOptionClassChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4OptionsCustomTypeOptionClassChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionClassChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4OptionsCustomTypeOptionClass") + } + } else { + intVal := otg.PatternFlowIpv4OptionsCustomTypeOptionClass_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4OptionsCustomTypeOptionClass_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_options_custom_type_option_class_counter.go b/gosnappi/pattern_flow_ipv4_options_custom_type_option_class_counter.go new file mode 100644 index 00000000..6c47864a --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_options_custom_type_option_class_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4OptionsCustomTypeOptionClassCounter ***** +type patternFlowIpv4OptionsCustomTypeOptionClassCounter struct { + validation + obj *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter + marshaller marshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter + unMarshaller unMarshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter +} + +func NewPatternFlowIpv4OptionsCustomTypeOptionClassCounter() PatternFlowIpv4OptionsCustomTypeOptionClassCounter { + obj := patternFlowIpv4OptionsCustomTypeOptionClassCounter{obj: &otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter { + return obj.obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) setMsg(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter) PatternFlowIpv4OptionsCustomTypeOptionClassCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter struct { + obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter +} + +type marshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter interface { + // ToProto marshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter + ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter, error) + // ToPbText marshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter struct { + obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter +} + +type unMarshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter interface { + // FromProto unmarshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter + FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter) (PatternFlowIpv4OptionsCustomTypeOptionClassCounter, error) + // FromPbText unmarshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter) (PatternFlowIpv4OptionsCustomTypeOptionClassCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) 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 *marshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) 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 *marshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionClassCounter) 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 *patternFlowIpv4OptionsCustomTypeOptionClassCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) Clone() (PatternFlowIpv4OptionsCustomTypeOptionClassCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4OptionsCustomTypeOptionClassCounter() + 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 +} + +// PatternFlowIpv4OptionsCustomTypeOptionClassCounter is integer counter pattern +type PatternFlowIpv4OptionsCustomTypeOptionClassCounter interface { + Validation + // msg marshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter + // setMsg unmarshals PatternFlowIpv4OptionsCustomTypeOptionClassCounter from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4OptionsCustomTypeOptionClassCounter) PatternFlowIpv4OptionsCustomTypeOptionClassCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionClassCounter + // validate validates PatternFlowIpv4OptionsCustomTypeOptionClassCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4OptionsCustomTypeOptionClassCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionClassCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionClassCounter + SetStart(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClassCounter + // HasStart checks if Start has been set in PatternFlowIpv4OptionsCustomTypeOptionClassCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionClassCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionClassCounter + SetStep(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClassCounter + // HasStep checks if Step has been set in PatternFlowIpv4OptionsCustomTypeOptionClassCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionClassCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionClassCounter + SetCount(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClassCounter + // HasCount checks if Count has been set in PatternFlowIpv4OptionsCustomTypeOptionClassCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionClassCounter object +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) SetStart(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClassCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionClassCounter object +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) SetStep(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClassCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionClassCounter object +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) SetCount(value uint32) PatternFlowIpv4OptionsCustomTypeOptionClassCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionClassCounter.Start <= 3 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionClassCounter.Step <= 3 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionClassCounter.Count <= 3 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionClassCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_options_custom_type_option_number.go b/gosnappi/pattern_flow_ipv4_options_custom_type_option_number.go new file mode 100644 index 00000000..ab87c076 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_options_custom_type_option_number.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowIpv4OptionsCustomTypeOptionNumber ***** +type patternFlowIpv4OptionsCustomTypeOptionNumber struct { + validation + obj *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber + marshaller marshalPatternFlowIpv4OptionsCustomTypeOptionNumber + unMarshaller unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumber + incrementHolder PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + decrementHolder PatternFlowIpv4OptionsCustomTypeOptionNumberCounter +} + +func NewPatternFlowIpv4OptionsCustomTypeOptionNumber() PatternFlowIpv4OptionsCustomTypeOptionNumber { + obj := patternFlowIpv4OptionsCustomTypeOptionNumber{obj: &otg.PatternFlowIpv4OptionsCustomTypeOptionNumber{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber { + return obj.obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) setMsg(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber) PatternFlowIpv4OptionsCustomTypeOptionNumber { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4OptionsCustomTypeOptionNumber struct { + obj *patternFlowIpv4OptionsCustomTypeOptionNumber +} + +type marshalPatternFlowIpv4OptionsCustomTypeOptionNumber interface { + // ToProto marshals PatternFlowIpv4OptionsCustomTypeOptionNumber to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber + ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionNumber, error) + // ToPbText marshals PatternFlowIpv4OptionsCustomTypeOptionNumber to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4OptionsCustomTypeOptionNumber to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4OptionsCustomTypeOptionNumber to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumber struct { + obj *patternFlowIpv4OptionsCustomTypeOptionNumber +} + +type unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumber interface { + // FromProto unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumber from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber + FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber) (PatternFlowIpv4OptionsCustomTypeOptionNumber, error) + // FromPbText unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumber from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumber from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumber from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionNumber { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4OptionsCustomTypeOptionNumber{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumber { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumber{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionNumber) ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionNumber, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumber) FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber) (PatternFlowIpv4OptionsCustomTypeOptionNumber, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionNumber) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumber) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionNumber) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumber) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionNumber) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumber) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Clone() (PatternFlowIpv4OptionsCustomTypeOptionNumber, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4OptionsCustomTypeOptionNumber() + 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 +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4OptionsCustomTypeOptionNumber is option Number [Ref:https://www.iana.org/assignments/ip-parameters/ip-parameters.xhtml#ip-parameters-1]. +type PatternFlowIpv4OptionsCustomTypeOptionNumber interface { + Validation + // msg marshals PatternFlowIpv4OptionsCustomTypeOptionNumber to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber + // and doesn't set defaults + msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber + // setMsg unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumber from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumber + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4OptionsCustomTypeOptionNumber) PatternFlowIpv4OptionsCustomTypeOptionNumber + // provides marshal interface + Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionNumber + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumber + // validate validates PatternFlowIpv4OptionsCustomTypeOptionNumber + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4OptionsCustomTypeOptionNumber, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum, set in PatternFlowIpv4OptionsCustomTypeOptionNumber + Choice() PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum + // setChoice assigns PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumber + setChoice(value PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum) PatternFlowIpv4OptionsCustomTypeOptionNumber + // HasChoice checks if Choice has been set in PatternFlowIpv4OptionsCustomTypeOptionNumber + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionNumber. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumber + SetValue(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumber + // HasValue checks if Value has been set in PatternFlowIpv4OptionsCustomTypeOptionNumber + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4OptionsCustomTypeOptionNumber. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumber + SetValues(value []uint32) PatternFlowIpv4OptionsCustomTypeOptionNumber + // Increment returns PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, set in PatternFlowIpv4OptionsCustomTypeOptionNumber. + // PatternFlowIpv4OptionsCustomTypeOptionNumberCounter is integer counter pattern + Increment() PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + // SetIncrement assigns PatternFlowIpv4OptionsCustomTypeOptionNumberCounter provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumber. + // PatternFlowIpv4OptionsCustomTypeOptionNumberCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) PatternFlowIpv4OptionsCustomTypeOptionNumber + // HasIncrement checks if Increment has been set in PatternFlowIpv4OptionsCustomTypeOptionNumber + HasIncrement() bool + // Decrement returns PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, set in PatternFlowIpv4OptionsCustomTypeOptionNumber. + // PatternFlowIpv4OptionsCustomTypeOptionNumberCounter is integer counter pattern + Decrement() PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + // SetDecrement assigns PatternFlowIpv4OptionsCustomTypeOptionNumberCounter provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumber. + // PatternFlowIpv4OptionsCustomTypeOptionNumberCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) PatternFlowIpv4OptionsCustomTypeOptionNumber + // HasDecrement checks if Decrement has been set in PatternFlowIpv4OptionsCustomTypeOptionNumber + HasDecrement() bool + setNil() +} + +type PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum string + +// Enum of Choice on PatternFlowIpv4OptionsCustomTypeOptionNumber +var PatternFlowIpv4OptionsCustomTypeOptionNumberChoice = struct { + VALUE PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum + VALUES PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum + INCREMENT PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum + DECREMENT PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum +}{ + VALUE: PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum("value"), + VALUES: PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum("values"), + INCREMENT: PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Choice() PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum { + return PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) setChoice(value PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum) PatternFlowIpv4OptionsCustomTypeOptionNumber { + intValue, ok := otg.PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4OptionsCustomTypeOptionNumberCounter().msg() + } + + if value == PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4OptionsCustomTypeOptionNumberCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionNumber object +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) SetValue(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumber { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionNumber object +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) SetValues(value []uint32) PatternFlowIpv4OptionsCustomTypeOptionNumber { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4OptionsCustomTypeOptionNumberCounter +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Increment() PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4OptionsCustomTypeOptionNumberCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4OptionsCustomTypeOptionNumberCounter +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4OptionsCustomTypeOptionNumberCounter value in the PatternFlowIpv4OptionsCustomTypeOptionNumber object +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) SetIncrement(value PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) PatternFlowIpv4OptionsCustomTypeOptionNumber { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4OptionsCustomTypeOptionNumberCounter +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) Decrement() PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4OptionsCustomTypeOptionNumberCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4OptionsCustomTypeOptionNumberCounter +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4OptionsCustomTypeOptionNumberCounter value in the PatternFlowIpv4OptionsCustomTypeOptionNumber object +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) SetDecrement(value PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) PatternFlowIpv4OptionsCustomTypeOptionNumber { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionNumber.Value <= 31 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4OptionsCustomTypeOptionNumber.Values <= 31 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumber) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4OptionsCustomTypeOptionNumberChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4OptionsCustomTypeOptionNumberChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4OptionsCustomTypeOptionNumber") + } + } else { + intVal := otg.PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4OptionsCustomTypeOptionNumber_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_options_custom_type_option_number_counter.go b/gosnappi/pattern_flow_ipv4_options_custom_type_option_number_counter.go new file mode 100644 index 00000000..500aa3d4 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_options_custom_type_option_number_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4OptionsCustomTypeOptionNumberCounter ***** +type patternFlowIpv4OptionsCustomTypeOptionNumberCounter struct { + validation + obj *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + marshaller marshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter + unMarshaller unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter +} + +func NewPatternFlowIpv4OptionsCustomTypeOptionNumberCounter() PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { + obj := patternFlowIpv4OptionsCustomTypeOptionNumberCounter{obj: &otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { + return obj.obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) setMsg(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter struct { + obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter +} + +type marshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter interface { + // ToProto marshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, error) + // ToPbText marshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter struct { + obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter +} + +type unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter interface { + // FromProto unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) (PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, error) + // FromPbText unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) ToProto() (*otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) FromProto(msg *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) (PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) 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 *marshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) 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 *marshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) 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 *unMarshalpatternFlowIpv4OptionsCustomTypeOptionNumberCounter) 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 *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) Clone() (PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4OptionsCustomTypeOptionNumberCounter() + 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 +} + +// PatternFlowIpv4OptionsCustomTypeOptionNumberCounter is integer counter pattern +type PatternFlowIpv4OptionsCustomTypeOptionNumberCounter interface { + Validation + // msg marshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter to protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + // setMsg unmarshals PatternFlowIpv4OptionsCustomTypeOptionNumberCounter from protobuf object *otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4OptionsCustomTypeOptionNumberCounter) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4OptionsCustomTypeOptionNumberCounter + // validate validates PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4OptionsCustomTypeOptionNumberCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionNumberCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + SetStart(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + // HasStart checks if Start has been set in PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionNumberCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + SetStep(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + // HasStep checks if Step has been set in PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4OptionsCustomTypeOptionNumberCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + SetCount(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + // HasCount checks if Count has been set in PatternFlowIpv4OptionsCustomTypeOptionNumberCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionNumberCounter object +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) SetStart(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionNumberCounter object +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) SetStep(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4OptionsCustomTypeOptionNumberCounter object +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) SetCount(value uint32) PatternFlowIpv4OptionsCustomTypeOptionNumberCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionNumberCounter.Start <= 31 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionNumberCounter.Step <= 31 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4OptionsCustomTypeOptionNumberCounter.Count <= 31 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4OptionsCustomTypeOptionNumberCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_priority_raw.go b/gosnappi/pattern_flow_ipv4_priority_raw.go new file mode 100644 index 00000000..0906d31c --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_priority_raw.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4PriorityRaw ***** +type patternFlowIpv4PriorityRaw struct { + validation + obj *otg.PatternFlowIpv4PriorityRaw + marshaller marshalPatternFlowIpv4PriorityRaw + unMarshaller unMarshalPatternFlowIpv4PriorityRaw + incrementHolder PatternFlowIpv4PriorityRawCounter + decrementHolder PatternFlowIpv4PriorityRawCounter + metricTagsHolder PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter +} + +func NewPatternFlowIpv4PriorityRaw() PatternFlowIpv4PriorityRaw { + obj := patternFlowIpv4PriorityRaw{obj: &otg.PatternFlowIpv4PriorityRaw{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4PriorityRaw) msg() *otg.PatternFlowIpv4PriorityRaw { + return obj.obj +} + +func (obj *patternFlowIpv4PriorityRaw) setMsg(msg *otg.PatternFlowIpv4PriorityRaw) PatternFlowIpv4PriorityRaw { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4PriorityRaw struct { + obj *patternFlowIpv4PriorityRaw +} + +type marshalPatternFlowIpv4PriorityRaw interface { + // ToProto marshals PatternFlowIpv4PriorityRaw to protobuf object *otg.PatternFlowIpv4PriorityRaw + ToProto() (*otg.PatternFlowIpv4PriorityRaw, error) + // ToPbText marshals PatternFlowIpv4PriorityRaw to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4PriorityRaw to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4PriorityRaw to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4PriorityRaw struct { + obj *patternFlowIpv4PriorityRaw +} + +type unMarshalPatternFlowIpv4PriorityRaw interface { + // FromProto unmarshals PatternFlowIpv4PriorityRaw from protobuf object *otg.PatternFlowIpv4PriorityRaw + FromProto(msg *otg.PatternFlowIpv4PriorityRaw) (PatternFlowIpv4PriorityRaw, error) + // FromPbText unmarshals PatternFlowIpv4PriorityRaw from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4PriorityRaw from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4PriorityRaw from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4PriorityRaw) Marshal() marshalPatternFlowIpv4PriorityRaw { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4PriorityRaw{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4PriorityRaw) Unmarshal() unMarshalPatternFlowIpv4PriorityRaw { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4PriorityRaw{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4PriorityRaw) ToProto() (*otg.PatternFlowIpv4PriorityRaw, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4PriorityRaw) FromProto(msg *otg.PatternFlowIpv4PriorityRaw) (PatternFlowIpv4PriorityRaw, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4PriorityRaw) 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 *unMarshalpatternFlowIpv4PriorityRaw) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4PriorityRaw) 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 *unMarshalpatternFlowIpv4PriorityRaw) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4PriorityRaw) 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 *unMarshalpatternFlowIpv4PriorityRaw) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4PriorityRaw) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4PriorityRaw) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4PriorityRaw) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4PriorityRaw) Clone() (PatternFlowIpv4PriorityRaw, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4PriorityRaw() + 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 +} + +func (obj *patternFlowIpv4PriorityRaw) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4PriorityRaw is raw priority +type PatternFlowIpv4PriorityRaw interface { + Validation + // msg marshals PatternFlowIpv4PriorityRaw to protobuf object *otg.PatternFlowIpv4PriorityRaw + // and doesn't set defaults + msg() *otg.PatternFlowIpv4PriorityRaw + // setMsg unmarshals PatternFlowIpv4PriorityRaw from protobuf object *otg.PatternFlowIpv4PriorityRaw + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4PriorityRaw) PatternFlowIpv4PriorityRaw + // provides marshal interface + Marshal() marshalPatternFlowIpv4PriorityRaw + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4PriorityRaw + // validate validates PatternFlowIpv4PriorityRaw + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4PriorityRaw, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4PriorityRawChoiceEnum, set in PatternFlowIpv4PriorityRaw + Choice() PatternFlowIpv4PriorityRawChoiceEnum + // setChoice assigns PatternFlowIpv4PriorityRawChoiceEnum provided by user to PatternFlowIpv4PriorityRaw + setChoice(value PatternFlowIpv4PriorityRawChoiceEnum) PatternFlowIpv4PriorityRaw + // HasChoice checks if Choice has been set in PatternFlowIpv4PriorityRaw + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4PriorityRaw. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4PriorityRaw + SetValue(value uint32) PatternFlowIpv4PriorityRaw + // HasValue checks if Value has been set in PatternFlowIpv4PriorityRaw + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4PriorityRaw. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4PriorityRaw + SetValues(value []uint32) PatternFlowIpv4PriorityRaw + // Increment returns PatternFlowIpv4PriorityRawCounter, set in PatternFlowIpv4PriorityRaw. + // PatternFlowIpv4PriorityRawCounter is integer counter pattern + Increment() PatternFlowIpv4PriorityRawCounter + // SetIncrement assigns PatternFlowIpv4PriorityRawCounter provided by user to PatternFlowIpv4PriorityRaw. + // PatternFlowIpv4PriorityRawCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4PriorityRawCounter) PatternFlowIpv4PriorityRaw + // HasIncrement checks if Increment has been set in PatternFlowIpv4PriorityRaw + HasIncrement() bool + // Decrement returns PatternFlowIpv4PriorityRawCounter, set in PatternFlowIpv4PriorityRaw. + // PatternFlowIpv4PriorityRawCounter is integer counter pattern + Decrement() PatternFlowIpv4PriorityRawCounter + // SetDecrement assigns PatternFlowIpv4PriorityRawCounter provided by user to PatternFlowIpv4PriorityRaw. + // PatternFlowIpv4PriorityRawCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4PriorityRawCounter) PatternFlowIpv4PriorityRaw + // HasDecrement checks if Decrement has been set in PatternFlowIpv4PriorityRaw + HasDecrement() bool + // MetricTags returns PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIterIter, set in PatternFlowIpv4PriorityRaw + MetricTags() PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter + setNil() +} + +type PatternFlowIpv4PriorityRawChoiceEnum string + +// Enum of Choice on PatternFlowIpv4PriorityRaw +var PatternFlowIpv4PriorityRawChoice = struct { + VALUE PatternFlowIpv4PriorityRawChoiceEnum + VALUES PatternFlowIpv4PriorityRawChoiceEnum + INCREMENT PatternFlowIpv4PriorityRawChoiceEnum + DECREMENT PatternFlowIpv4PriorityRawChoiceEnum +}{ + VALUE: PatternFlowIpv4PriorityRawChoiceEnum("value"), + VALUES: PatternFlowIpv4PriorityRawChoiceEnum("values"), + INCREMENT: PatternFlowIpv4PriorityRawChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4PriorityRawChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4PriorityRaw) Choice() PatternFlowIpv4PriorityRawChoiceEnum { + return PatternFlowIpv4PriorityRawChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4PriorityRaw) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4PriorityRaw) setChoice(value PatternFlowIpv4PriorityRawChoiceEnum) PatternFlowIpv4PriorityRaw { + intValue, ok := otg.PatternFlowIpv4PriorityRaw_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4PriorityRawChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4PriorityRaw_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4PriorityRawChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4PriorityRawChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4PriorityRawChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4PriorityRawCounter().msg() + } + + if value == PatternFlowIpv4PriorityRawChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4PriorityRawCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4PriorityRaw) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4PriorityRawChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4PriorityRaw) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4PriorityRaw object +func (obj *patternFlowIpv4PriorityRaw) SetValue(value uint32) PatternFlowIpv4PriorityRaw { + obj.setChoice(PatternFlowIpv4PriorityRawChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4PriorityRaw) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4PriorityRaw object +func (obj *patternFlowIpv4PriorityRaw) SetValues(value []uint32) PatternFlowIpv4PriorityRaw { + obj.setChoice(PatternFlowIpv4PriorityRawChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4PriorityRawCounter +func (obj *patternFlowIpv4PriorityRaw) Increment() PatternFlowIpv4PriorityRawCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4PriorityRawChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4PriorityRawCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4PriorityRawCounter +func (obj *patternFlowIpv4PriorityRaw) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4PriorityRawCounter value in the PatternFlowIpv4PriorityRaw object +func (obj *patternFlowIpv4PriorityRaw) SetIncrement(value PatternFlowIpv4PriorityRawCounter) PatternFlowIpv4PriorityRaw { + obj.setChoice(PatternFlowIpv4PriorityRawChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4PriorityRawCounter +func (obj *patternFlowIpv4PriorityRaw) Decrement() PatternFlowIpv4PriorityRawCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4PriorityRawChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4PriorityRawCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4PriorityRawCounter +func (obj *patternFlowIpv4PriorityRaw) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4PriorityRawCounter value in the PatternFlowIpv4PriorityRaw object +func (obj *patternFlowIpv4PriorityRaw) SetDecrement(value PatternFlowIpv4PriorityRawCounter) PatternFlowIpv4PriorityRaw { + obj.setChoice(PatternFlowIpv4PriorityRawChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4PriorityRawMetricTag +func (obj *patternFlowIpv4PriorityRaw) MetricTags() PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4PriorityRawMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter struct { + obj *patternFlowIpv4PriorityRaw + patternFlowIpv4PriorityRawMetricTagSlice []PatternFlowIpv4PriorityRawMetricTag + fieldPtr *[]*otg.PatternFlowIpv4PriorityRawMetricTag +} + +func newPatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter(ptr *[]*otg.PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { + return &patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter interface { + setMsg(*patternFlowIpv4PriorityRaw) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter + Items() []PatternFlowIpv4PriorityRawMetricTag + Add() PatternFlowIpv4PriorityRawMetricTag + Append(items ...PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter + Set(index int, newObj PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter + Clear() PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter + clearHolderSlice() PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter + appendHolderSlice(item PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter +} + +func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) setMsg(msg *patternFlowIpv4PriorityRaw) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4PriorityRawMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) Items() []PatternFlowIpv4PriorityRawMetricTag { + return obj.patternFlowIpv4PriorityRawMetricTagSlice +} + +func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) Add() PatternFlowIpv4PriorityRawMetricTag { + newObj := &otg.PatternFlowIpv4PriorityRawMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4PriorityRawMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4PriorityRawMetricTagSlice = append(obj.patternFlowIpv4PriorityRawMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) Append(items ...PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4PriorityRawMetricTagSlice = append(obj.patternFlowIpv4PriorityRawMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) Set(index int, newObj PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4PriorityRawMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) Clear() PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4PriorityRawMetricTag{} + obj.patternFlowIpv4PriorityRawMetricTagSlice = []PatternFlowIpv4PriorityRawMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) clearHolderSlice() PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { + if len(obj.patternFlowIpv4PriorityRawMetricTagSlice) > 0 { + obj.patternFlowIpv4PriorityRawMetricTagSlice = []PatternFlowIpv4PriorityRawMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter) appendHolderSlice(item PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawPatternFlowIpv4PriorityRawMetricTagIter { + obj.patternFlowIpv4PriorityRawMetricTagSlice = append(obj.patternFlowIpv4PriorityRawMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4PriorityRaw) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4PriorityRaw.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4PriorityRaw.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4PriorityRawMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4PriorityRaw) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4PriorityRawChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4PriorityRawChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4PriorityRawChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4PriorityRawChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4PriorityRawChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4PriorityRawChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4PriorityRaw") + } + } else { + intVal := otg.PatternFlowIpv4PriorityRaw_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4PriorityRaw_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_priority_raw_counter.go b/gosnappi/pattern_flow_ipv4_priority_raw_counter.go new file mode 100644 index 00000000..c80b2286 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_priority_raw_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4PriorityRawCounter ***** +type patternFlowIpv4PriorityRawCounter struct { + validation + obj *otg.PatternFlowIpv4PriorityRawCounter + marshaller marshalPatternFlowIpv4PriorityRawCounter + unMarshaller unMarshalPatternFlowIpv4PriorityRawCounter +} + +func NewPatternFlowIpv4PriorityRawCounter() PatternFlowIpv4PriorityRawCounter { + obj := patternFlowIpv4PriorityRawCounter{obj: &otg.PatternFlowIpv4PriorityRawCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4PriorityRawCounter) msg() *otg.PatternFlowIpv4PriorityRawCounter { + return obj.obj +} + +func (obj *patternFlowIpv4PriorityRawCounter) setMsg(msg *otg.PatternFlowIpv4PriorityRawCounter) PatternFlowIpv4PriorityRawCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4PriorityRawCounter struct { + obj *patternFlowIpv4PriorityRawCounter +} + +type marshalPatternFlowIpv4PriorityRawCounter interface { + // ToProto marshals PatternFlowIpv4PriorityRawCounter to protobuf object *otg.PatternFlowIpv4PriorityRawCounter + ToProto() (*otg.PatternFlowIpv4PriorityRawCounter, error) + // ToPbText marshals PatternFlowIpv4PriorityRawCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4PriorityRawCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4PriorityRawCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4PriorityRawCounter struct { + obj *patternFlowIpv4PriorityRawCounter +} + +type unMarshalPatternFlowIpv4PriorityRawCounter interface { + // FromProto unmarshals PatternFlowIpv4PriorityRawCounter from protobuf object *otg.PatternFlowIpv4PriorityRawCounter + FromProto(msg *otg.PatternFlowIpv4PriorityRawCounter) (PatternFlowIpv4PriorityRawCounter, error) + // FromPbText unmarshals PatternFlowIpv4PriorityRawCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4PriorityRawCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4PriorityRawCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4PriorityRawCounter) Marshal() marshalPatternFlowIpv4PriorityRawCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4PriorityRawCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4PriorityRawCounter) Unmarshal() unMarshalPatternFlowIpv4PriorityRawCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4PriorityRawCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4PriorityRawCounter) ToProto() (*otg.PatternFlowIpv4PriorityRawCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4PriorityRawCounter) FromProto(msg *otg.PatternFlowIpv4PriorityRawCounter) (PatternFlowIpv4PriorityRawCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4PriorityRawCounter) 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 *unMarshalpatternFlowIpv4PriorityRawCounter) 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 *marshalpatternFlowIpv4PriorityRawCounter) 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 *unMarshalpatternFlowIpv4PriorityRawCounter) 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 *marshalpatternFlowIpv4PriorityRawCounter) 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 *unMarshalpatternFlowIpv4PriorityRawCounter) 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 *patternFlowIpv4PriorityRawCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4PriorityRawCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4PriorityRawCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4PriorityRawCounter) Clone() (PatternFlowIpv4PriorityRawCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4PriorityRawCounter() + 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 +} + +// PatternFlowIpv4PriorityRawCounter is integer counter pattern +type PatternFlowIpv4PriorityRawCounter interface { + Validation + // msg marshals PatternFlowIpv4PriorityRawCounter to protobuf object *otg.PatternFlowIpv4PriorityRawCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4PriorityRawCounter + // setMsg unmarshals PatternFlowIpv4PriorityRawCounter from protobuf object *otg.PatternFlowIpv4PriorityRawCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4PriorityRawCounter) PatternFlowIpv4PriorityRawCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4PriorityRawCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4PriorityRawCounter + // validate validates PatternFlowIpv4PriorityRawCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4PriorityRawCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4PriorityRawCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4PriorityRawCounter + SetStart(value uint32) PatternFlowIpv4PriorityRawCounter + // HasStart checks if Start has been set in PatternFlowIpv4PriorityRawCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4PriorityRawCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4PriorityRawCounter + SetStep(value uint32) PatternFlowIpv4PriorityRawCounter + // HasStep checks if Step has been set in PatternFlowIpv4PriorityRawCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4PriorityRawCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4PriorityRawCounter + SetCount(value uint32) PatternFlowIpv4PriorityRawCounter + // HasCount checks if Count has been set in PatternFlowIpv4PriorityRawCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4PriorityRawCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4PriorityRawCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4PriorityRawCounter object +func (obj *patternFlowIpv4PriorityRawCounter) SetStart(value uint32) PatternFlowIpv4PriorityRawCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4PriorityRawCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4PriorityRawCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4PriorityRawCounter object +func (obj *patternFlowIpv4PriorityRawCounter) SetStep(value uint32) PatternFlowIpv4PriorityRawCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4PriorityRawCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4PriorityRawCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4PriorityRawCounter object +func (obj *patternFlowIpv4PriorityRawCounter) SetCount(value uint32) PatternFlowIpv4PriorityRawCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4PriorityRawCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4PriorityRawCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4PriorityRawCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4PriorityRawCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4PriorityRawCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_priority_raw_metric_tag.go b/gosnappi/pattern_flow_ipv4_priority_raw_metric_tag.go new file mode 100644 index 00000000..00cb3ccc --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_priority_raw_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4PriorityRawMetricTag ***** +type patternFlowIpv4PriorityRawMetricTag struct { + validation + obj *otg.PatternFlowIpv4PriorityRawMetricTag + marshaller marshalPatternFlowIpv4PriorityRawMetricTag + unMarshaller unMarshalPatternFlowIpv4PriorityRawMetricTag +} + +func NewPatternFlowIpv4PriorityRawMetricTag() PatternFlowIpv4PriorityRawMetricTag { + obj := patternFlowIpv4PriorityRawMetricTag{obj: &otg.PatternFlowIpv4PriorityRawMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4PriorityRawMetricTag) msg() *otg.PatternFlowIpv4PriorityRawMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4PriorityRawMetricTag) setMsg(msg *otg.PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4PriorityRawMetricTag struct { + obj *patternFlowIpv4PriorityRawMetricTag +} + +type marshalPatternFlowIpv4PriorityRawMetricTag interface { + // ToProto marshals PatternFlowIpv4PriorityRawMetricTag to protobuf object *otg.PatternFlowIpv4PriorityRawMetricTag + ToProto() (*otg.PatternFlowIpv4PriorityRawMetricTag, error) + // ToPbText marshals PatternFlowIpv4PriorityRawMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4PriorityRawMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4PriorityRawMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4PriorityRawMetricTag struct { + obj *patternFlowIpv4PriorityRawMetricTag +} + +type unMarshalPatternFlowIpv4PriorityRawMetricTag interface { + // FromProto unmarshals PatternFlowIpv4PriorityRawMetricTag from protobuf object *otg.PatternFlowIpv4PriorityRawMetricTag + FromProto(msg *otg.PatternFlowIpv4PriorityRawMetricTag) (PatternFlowIpv4PriorityRawMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4PriorityRawMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4PriorityRawMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4PriorityRawMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4PriorityRawMetricTag) Marshal() marshalPatternFlowIpv4PriorityRawMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4PriorityRawMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4PriorityRawMetricTag) Unmarshal() unMarshalPatternFlowIpv4PriorityRawMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4PriorityRawMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4PriorityRawMetricTag) ToProto() (*otg.PatternFlowIpv4PriorityRawMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4PriorityRawMetricTag) FromProto(msg *otg.PatternFlowIpv4PriorityRawMetricTag) (PatternFlowIpv4PriorityRawMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4PriorityRawMetricTag) 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 *unMarshalpatternFlowIpv4PriorityRawMetricTag) 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 *marshalpatternFlowIpv4PriorityRawMetricTag) 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 *unMarshalpatternFlowIpv4PriorityRawMetricTag) 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 *marshalpatternFlowIpv4PriorityRawMetricTag) 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 *unMarshalpatternFlowIpv4PriorityRawMetricTag) 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 *patternFlowIpv4PriorityRawMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4PriorityRawMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4PriorityRawMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4PriorityRawMetricTag) Clone() (PatternFlowIpv4PriorityRawMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4PriorityRawMetricTag() + 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 +} + +// PatternFlowIpv4PriorityRawMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4PriorityRawMetricTag interface { + Validation + // msg marshals PatternFlowIpv4PriorityRawMetricTag to protobuf object *otg.PatternFlowIpv4PriorityRawMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4PriorityRawMetricTag + // setMsg unmarshals PatternFlowIpv4PriorityRawMetricTag from protobuf object *otg.PatternFlowIpv4PriorityRawMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4PriorityRawMetricTag) PatternFlowIpv4PriorityRawMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4PriorityRawMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4PriorityRawMetricTag + // validate validates PatternFlowIpv4PriorityRawMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4PriorityRawMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4PriorityRawMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4PriorityRawMetricTag + SetName(value string) PatternFlowIpv4PriorityRawMetricTag + // Offset returns uint32, set in PatternFlowIpv4PriorityRawMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4PriorityRawMetricTag + SetOffset(value uint32) PatternFlowIpv4PriorityRawMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4PriorityRawMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4PriorityRawMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4PriorityRawMetricTag + SetLength(value uint32) PatternFlowIpv4PriorityRawMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4PriorityRawMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4PriorityRawMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4PriorityRawMetricTag object +func (obj *patternFlowIpv4PriorityRawMetricTag) SetName(value string) PatternFlowIpv4PriorityRawMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4PriorityRawMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4PriorityRawMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4PriorityRawMetricTag object +func (obj *patternFlowIpv4PriorityRawMetricTag) SetOffset(value uint32) PatternFlowIpv4PriorityRawMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4PriorityRawMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4PriorityRawMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4PriorityRawMetricTag object +func (obj *patternFlowIpv4PriorityRawMetricTag) SetLength(value uint32) PatternFlowIpv4PriorityRawMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4PriorityRawMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4PriorityRawMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4PriorityRawMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4PriorityRawMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4PriorityRawMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_protocol.go b/gosnappi/pattern_flow_ipv4_protocol.go new file mode 100644 index 00000000..3ec02538 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_protocol.go @@ -0,0 +1,712 @@ +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" +) + +// ***** PatternFlowIpv4Protocol ***** +type patternFlowIpv4Protocol struct { + validation + obj *otg.PatternFlowIpv4Protocol + marshaller marshalPatternFlowIpv4Protocol + unMarshaller unMarshalPatternFlowIpv4Protocol + incrementHolder PatternFlowIpv4ProtocolCounter + decrementHolder PatternFlowIpv4ProtocolCounter + metricTagsHolder PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter +} + +func NewPatternFlowIpv4Protocol() PatternFlowIpv4Protocol { + obj := patternFlowIpv4Protocol{obj: &otg.PatternFlowIpv4Protocol{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4Protocol) msg() *otg.PatternFlowIpv4Protocol { + return obj.obj +} + +func (obj *patternFlowIpv4Protocol) setMsg(msg *otg.PatternFlowIpv4Protocol) PatternFlowIpv4Protocol { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4Protocol struct { + obj *patternFlowIpv4Protocol +} + +type marshalPatternFlowIpv4Protocol interface { + // ToProto marshals PatternFlowIpv4Protocol to protobuf object *otg.PatternFlowIpv4Protocol + ToProto() (*otg.PatternFlowIpv4Protocol, error) + // ToPbText marshals PatternFlowIpv4Protocol to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4Protocol to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4Protocol to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4Protocol struct { + obj *patternFlowIpv4Protocol +} + +type unMarshalPatternFlowIpv4Protocol interface { + // FromProto unmarshals PatternFlowIpv4Protocol from protobuf object *otg.PatternFlowIpv4Protocol + FromProto(msg *otg.PatternFlowIpv4Protocol) (PatternFlowIpv4Protocol, error) + // FromPbText unmarshals PatternFlowIpv4Protocol from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4Protocol from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4Protocol from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4Protocol) Marshal() marshalPatternFlowIpv4Protocol { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4Protocol{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4Protocol) Unmarshal() unMarshalPatternFlowIpv4Protocol { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4Protocol{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4Protocol) ToProto() (*otg.PatternFlowIpv4Protocol, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4Protocol) FromProto(msg *otg.PatternFlowIpv4Protocol) (PatternFlowIpv4Protocol, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4Protocol) 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 *unMarshalpatternFlowIpv4Protocol) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4Protocol) 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 *unMarshalpatternFlowIpv4Protocol) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4Protocol) 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 *unMarshalpatternFlowIpv4Protocol) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4Protocol) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4Protocol) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4Protocol) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4Protocol) Clone() (PatternFlowIpv4Protocol, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4Protocol() + 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 +} + +func (obj *patternFlowIpv4Protocol) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4Protocol is protocol, default is 61 any host internal protocol +type PatternFlowIpv4Protocol interface { + Validation + // msg marshals PatternFlowIpv4Protocol to protobuf object *otg.PatternFlowIpv4Protocol + // and doesn't set defaults + msg() *otg.PatternFlowIpv4Protocol + // setMsg unmarshals PatternFlowIpv4Protocol from protobuf object *otg.PatternFlowIpv4Protocol + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4Protocol) PatternFlowIpv4Protocol + // provides marshal interface + Marshal() marshalPatternFlowIpv4Protocol + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4Protocol + // validate validates PatternFlowIpv4Protocol + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4Protocol, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4ProtocolChoiceEnum, set in PatternFlowIpv4Protocol + Choice() PatternFlowIpv4ProtocolChoiceEnum + // setChoice assigns PatternFlowIpv4ProtocolChoiceEnum provided by user to PatternFlowIpv4Protocol + setChoice(value PatternFlowIpv4ProtocolChoiceEnum) PatternFlowIpv4Protocol + // HasChoice checks if Choice has been set in PatternFlowIpv4Protocol + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4Protocol. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4Protocol + SetValue(value uint32) PatternFlowIpv4Protocol + // HasValue checks if Value has been set in PatternFlowIpv4Protocol + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4Protocol. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4Protocol + SetValues(value []uint32) PatternFlowIpv4Protocol + // Auto returns uint32, set in PatternFlowIpv4Protocol. + Auto() uint32 + // HasAuto checks if Auto has been set in PatternFlowIpv4Protocol + HasAuto() bool + // Increment returns PatternFlowIpv4ProtocolCounter, set in PatternFlowIpv4Protocol. + // PatternFlowIpv4ProtocolCounter is integer counter pattern + Increment() PatternFlowIpv4ProtocolCounter + // SetIncrement assigns PatternFlowIpv4ProtocolCounter provided by user to PatternFlowIpv4Protocol. + // PatternFlowIpv4ProtocolCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4ProtocolCounter) PatternFlowIpv4Protocol + // HasIncrement checks if Increment has been set in PatternFlowIpv4Protocol + HasIncrement() bool + // Decrement returns PatternFlowIpv4ProtocolCounter, set in PatternFlowIpv4Protocol. + // PatternFlowIpv4ProtocolCounter is integer counter pattern + Decrement() PatternFlowIpv4ProtocolCounter + // SetDecrement assigns PatternFlowIpv4ProtocolCounter provided by user to PatternFlowIpv4Protocol. + // PatternFlowIpv4ProtocolCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4ProtocolCounter) PatternFlowIpv4Protocol + // HasDecrement checks if Decrement has been set in PatternFlowIpv4Protocol + HasDecrement() bool + // MetricTags returns PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIterIter, set in PatternFlowIpv4Protocol + MetricTags() PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter + setNil() +} + +type PatternFlowIpv4ProtocolChoiceEnum string + +// Enum of Choice on PatternFlowIpv4Protocol +var PatternFlowIpv4ProtocolChoice = struct { + VALUE PatternFlowIpv4ProtocolChoiceEnum + VALUES PatternFlowIpv4ProtocolChoiceEnum + AUTO PatternFlowIpv4ProtocolChoiceEnum + INCREMENT PatternFlowIpv4ProtocolChoiceEnum + DECREMENT PatternFlowIpv4ProtocolChoiceEnum +}{ + VALUE: PatternFlowIpv4ProtocolChoiceEnum("value"), + VALUES: PatternFlowIpv4ProtocolChoiceEnum("values"), + AUTO: PatternFlowIpv4ProtocolChoiceEnum("auto"), + INCREMENT: PatternFlowIpv4ProtocolChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4ProtocolChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4Protocol) Choice() PatternFlowIpv4ProtocolChoiceEnum { + return PatternFlowIpv4ProtocolChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4Protocol) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4Protocol) setChoice(value PatternFlowIpv4ProtocolChoiceEnum) PatternFlowIpv4Protocol { + intValue, ok := otg.PatternFlowIpv4Protocol_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4ProtocolChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4Protocol_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Auto = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4ProtocolChoice.VALUE { + defaultValue := uint32(61) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4ProtocolChoice.VALUES { + defaultValue := []uint32{61} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4ProtocolChoice.AUTO { + defaultValue := uint32(61) + obj.obj.Auto = &defaultValue + } + + if value == PatternFlowIpv4ProtocolChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4ProtocolCounter().msg() + } + + if value == PatternFlowIpv4ProtocolChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4ProtocolCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4Protocol) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4ProtocolChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4Protocol) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4Protocol object +func (obj *patternFlowIpv4Protocol) SetValue(value uint32) PatternFlowIpv4Protocol { + obj.setChoice(PatternFlowIpv4ProtocolChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4Protocol) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{61}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4Protocol object +func (obj *patternFlowIpv4Protocol) SetValues(value []uint32) PatternFlowIpv4Protocol { + obj.setChoice(PatternFlowIpv4ProtocolChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowIpv4Protocol) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(PatternFlowIpv4ProtocolChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowIpv4Protocol) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Increment returns a PatternFlowIpv4ProtocolCounter +func (obj *patternFlowIpv4Protocol) Increment() PatternFlowIpv4ProtocolCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4ProtocolChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4ProtocolCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4ProtocolCounter +func (obj *patternFlowIpv4Protocol) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4ProtocolCounter value in the PatternFlowIpv4Protocol object +func (obj *patternFlowIpv4Protocol) SetIncrement(value PatternFlowIpv4ProtocolCounter) PatternFlowIpv4Protocol { + obj.setChoice(PatternFlowIpv4ProtocolChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4ProtocolCounter +func (obj *patternFlowIpv4Protocol) Decrement() PatternFlowIpv4ProtocolCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4ProtocolChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4ProtocolCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4ProtocolCounter +func (obj *patternFlowIpv4Protocol) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4ProtocolCounter value in the PatternFlowIpv4Protocol object +func (obj *patternFlowIpv4Protocol) SetDecrement(value PatternFlowIpv4ProtocolCounter) PatternFlowIpv4Protocol { + obj.setChoice(PatternFlowIpv4ProtocolChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4ProtocolMetricTag +func (obj *patternFlowIpv4Protocol) MetricTags() PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4ProtocolMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter struct { + obj *patternFlowIpv4Protocol + patternFlowIpv4ProtocolMetricTagSlice []PatternFlowIpv4ProtocolMetricTag + fieldPtr *[]*otg.PatternFlowIpv4ProtocolMetricTag +} + +func newPatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter(ptr *[]*otg.PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { + return &patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter interface { + setMsg(*patternFlowIpv4Protocol) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter + Items() []PatternFlowIpv4ProtocolMetricTag + Add() PatternFlowIpv4ProtocolMetricTag + Append(items ...PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter + Set(index int, newObj PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter + Clear() PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter + clearHolderSlice() PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter + appendHolderSlice(item PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter +} + +func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) setMsg(msg *patternFlowIpv4Protocol) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4ProtocolMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) Items() []PatternFlowIpv4ProtocolMetricTag { + return obj.patternFlowIpv4ProtocolMetricTagSlice +} + +func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) Add() PatternFlowIpv4ProtocolMetricTag { + newObj := &otg.PatternFlowIpv4ProtocolMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4ProtocolMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4ProtocolMetricTagSlice = append(obj.patternFlowIpv4ProtocolMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) Append(items ...PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4ProtocolMetricTagSlice = append(obj.patternFlowIpv4ProtocolMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) Set(index int, newObj PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4ProtocolMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) Clear() PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4ProtocolMetricTag{} + obj.patternFlowIpv4ProtocolMetricTagSlice = []PatternFlowIpv4ProtocolMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) clearHolderSlice() PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { + if len(obj.patternFlowIpv4ProtocolMetricTagSlice) > 0 { + obj.patternFlowIpv4ProtocolMetricTagSlice = []PatternFlowIpv4ProtocolMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter) appendHolderSlice(item PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolPatternFlowIpv4ProtocolMetricTagIter { + obj.patternFlowIpv4ProtocolMetricTagSlice = append(obj.patternFlowIpv4ProtocolMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4Protocol) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4Protocol.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4Protocol.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Auto != nil { + + if *obj.obj.Auto > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4Protocol.Auto <= 255 but Got %d", *obj.obj.Auto)) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4ProtocolMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4Protocol) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4ProtocolChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4ProtocolChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4ProtocolChoice.VALUES + } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowIpv4ProtocolChoice.AUTO + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4ProtocolChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4ProtocolChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4ProtocolChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4Protocol") + } + } else { + intVal := otg.PatternFlowIpv4Protocol_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4Protocol_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_protocol_counter.go b/gosnappi/pattern_flow_ipv4_protocol_counter.go new file mode 100644 index 00000000..d97d323e --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_protocol_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4ProtocolCounter ***** +type patternFlowIpv4ProtocolCounter struct { + validation + obj *otg.PatternFlowIpv4ProtocolCounter + marshaller marshalPatternFlowIpv4ProtocolCounter + unMarshaller unMarshalPatternFlowIpv4ProtocolCounter +} + +func NewPatternFlowIpv4ProtocolCounter() PatternFlowIpv4ProtocolCounter { + obj := patternFlowIpv4ProtocolCounter{obj: &otg.PatternFlowIpv4ProtocolCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4ProtocolCounter) msg() *otg.PatternFlowIpv4ProtocolCounter { + return obj.obj +} + +func (obj *patternFlowIpv4ProtocolCounter) setMsg(msg *otg.PatternFlowIpv4ProtocolCounter) PatternFlowIpv4ProtocolCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4ProtocolCounter struct { + obj *patternFlowIpv4ProtocolCounter +} + +type marshalPatternFlowIpv4ProtocolCounter interface { + // ToProto marshals PatternFlowIpv4ProtocolCounter to protobuf object *otg.PatternFlowIpv4ProtocolCounter + ToProto() (*otg.PatternFlowIpv4ProtocolCounter, error) + // ToPbText marshals PatternFlowIpv4ProtocolCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4ProtocolCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4ProtocolCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4ProtocolCounter struct { + obj *patternFlowIpv4ProtocolCounter +} + +type unMarshalPatternFlowIpv4ProtocolCounter interface { + // FromProto unmarshals PatternFlowIpv4ProtocolCounter from protobuf object *otg.PatternFlowIpv4ProtocolCounter + FromProto(msg *otg.PatternFlowIpv4ProtocolCounter) (PatternFlowIpv4ProtocolCounter, error) + // FromPbText unmarshals PatternFlowIpv4ProtocolCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4ProtocolCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4ProtocolCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4ProtocolCounter) Marshal() marshalPatternFlowIpv4ProtocolCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4ProtocolCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4ProtocolCounter) Unmarshal() unMarshalPatternFlowIpv4ProtocolCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4ProtocolCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4ProtocolCounter) ToProto() (*otg.PatternFlowIpv4ProtocolCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4ProtocolCounter) FromProto(msg *otg.PatternFlowIpv4ProtocolCounter) (PatternFlowIpv4ProtocolCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4ProtocolCounter) 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 *unMarshalpatternFlowIpv4ProtocolCounter) 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 *marshalpatternFlowIpv4ProtocolCounter) 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 *unMarshalpatternFlowIpv4ProtocolCounter) 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 *marshalpatternFlowIpv4ProtocolCounter) 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 *unMarshalpatternFlowIpv4ProtocolCounter) 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 *patternFlowIpv4ProtocolCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4ProtocolCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4ProtocolCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4ProtocolCounter) Clone() (PatternFlowIpv4ProtocolCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4ProtocolCounter() + 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 +} + +// PatternFlowIpv4ProtocolCounter is integer counter pattern +type PatternFlowIpv4ProtocolCounter interface { + Validation + // msg marshals PatternFlowIpv4ProtocolCounter to protobuf object *otg.PatternFlowIpv4ProtocolCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4ProtocolCounter + // setMsg unmarshals PatternFlowIpv4ProtocolCounter from protobuf object *otg.PatternFlowIpv4ProtocolCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4ProtocolCounter) PatternFlowIpv4ProtocolCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4ProtocolCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4ProtocolCounter + // validate validates PatternFlowIpv4ProtocolCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4ProtocolCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4ProtocolCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4ProtocolCounter + SetStart(value uint32) PatternFlowIpv4ProtocolCounter + // HasStart checks if Start has been set in PatternFlowIpv4ProtocolCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4ProtocolCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4ProtocolCounter + SetStep(value uint32) PatternFlowIpv4ProtocolCounter + // HasStep checks if Step has been set in PatternFlowIpv4ProtocolCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4ProtocolCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4ProtocolCounter + SetCount(value uint32) PatternFlowIpv4ProtocolCounter + // HasCount checks if Count has been set in PatternFlowIpv4ProtocolCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4ProtocolCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4ProtocolCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4ProtocolCounter object +func (obj *patternFlowIpv4ProtocolCounter) SetStart(value uint32) PatternFlowIpv4ProtocolCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4ProtocolCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4ProtocolCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4ProtocolCounter object +func (obj *patternFlowIpv4ProtocolCounter) SetStep(value uint32) PatternFlowIpv4ProtocolCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4ProtocolCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4ProtocolCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4ProtocolCounter object +func (obj *patternFlowIpv4ProtocolCounter) SetCount(value uint32) PatternFlowIpv4ProtocolCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4ProtocolCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4ProtocolCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4ProtocolCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4ProtocolCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4ProtocolCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(61) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_protocol_metric_tag.go b/gosnappi/pattern_flow_ipv4_protocol_metric_tag.go new file mode 100644 index 00000000..2da57732 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_protocol_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4ProtocolMetricTag ***** +type patternFlowIpv4ProtocolMetricTag struct { + validation + obj *otg.PatternFlowIpv4ProtocolMetricTag + marshaller marshalPatternFlowIpv4ProtocolMetricTag + unMarshaller unMarshalPatternFlowIpv4ProtocolMetricTag +} + +func NewPatternFlowIpv4ProtocolMetricTag() PatternFlowIpv4ProtocolMetricTag { + obj := patternFlowIpv4ProtocolMetricTag{obj: &otg.PatternFlowIpv4ProtocolMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4ProtocolMetricTag) msg() *otg.PatternFlowIpv4ProtocolMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4ProtocolMetricTag) setMsg(msg *otg.PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4ProtocolMetricTag struct { + obj *patternFlowIpv4ProtocolMetricTag +} + +type marshalPatternFlowIpv4ProtocolMetricTag interface { + // ToProto marshals PatternFlowIpv4ProtocolMetricTag to protobuf object *otg.PatternFlowIpv4ProtocolMetricTag + ToProto() (*otg.PatternFlowIpv4ProtocolMetricTag, error) + // ToPbText marshals PatternFlowIpv4ProtocolMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4ProtocolMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4ProtocolMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4ProtocolMetricTag struct { + obj *patternFlowIpv4ProtocolMetricTag +} + +type unMarshalPatternFlowIpv4ProtocolMetricTag interface { + // FromProto unmarshals PatternFlowIpv4ProtocolMetricTag from protobuf object *otg.PatternFlowIpv4ProtocolMetricTag + FromProto(msg *otg.PatternFlowIpv4ProtocolMetricTag) (PatternFlowIpv4ProtocolMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4ProtocolMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4ProtocolMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4ProtocolMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4ProtocolMetricTag) Marshal() marshalPatternFlowIpv4ProtocolMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4ProtocolMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4ProtocolMetricTag) Unmarshal() unMarshalPatternFlowIpv4ProtocolMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4ProtocolMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4ProtocolMetricTag) ToProto() (*otg.PatternFlowIpv4ProtocolMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4ProtocolMetricTag) FromProto(msg *otg.PatternFlowIpv4ProtocolMetricTag) (PatternFlowIpv4ProtocolMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4ProtocolMetricTag) 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 *unMarshalpatternFlowIpv4ProtocolMetricTag) 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 *marshalpatternFlowIpv4ProtocolMetricTag) 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 *unMarshalpatternFlowIpv4ProtocolMetricTag) 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 *marshalpatternFlowIpv4ProtocolMetricTag) 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 *unMarshalpatternFlowIpv4ProtocolMetricTag) 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 *patternFlowIpv4ProtocolMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4ProtocolMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4ProtocolMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4ProtocolMetricTag) Clone() (PatternFlowIpv4ProtocolMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4ProtocolMetricTag() + 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 +} + +// PatternFlowIpv4ProtocolMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4ProtocolMetricTag interface { + Validation + // msg marshals PatternFlowIpv4ProtocolMetricTag to protobuf object *otg.PatternFlowIpv4ProtocolMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4ProtocolMetricTag + // setMsg unmarshals PatternFlowIpv4ProtocolMetricTag from protobuf object *otg.PatternFlowIpv4ProtocolMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4ProtocolMetricTag) PatternFlowIpv4ProtocolMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4ProtocolMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4ProtocolMetricTag + // validate validates PatternFlowIpv4ProtocolMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4ProtocolMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4ProtocolMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4ProtocolMetricTag + SetName(value string) PatternFlowIpv4ProtocolMetricTag + // Offset returns uint32, set in PatternFlowIpv4ProtocolMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4ProtocolMetricTag + SetOffset(value uint32) PatternFlowIpv4ProtocolMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4ProtocolMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4ProtocolMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4ProtocolMetricTag + SetLength(value uint32) PatternFlowIpv4ProtocolMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4ProtocolMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4ProtocolMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4ProtocolMetricTag object +func (obj *patternFlowIpv4ProtocolMetricTag) SetName(value string) PatternFlowIpv4ProtocolMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4ProtocolMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4ProtocolMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4ProtocolMetricTag object +func (obj *patternFlowIpv4ProtocolMetricTag) SetOffset(value uint32) PatternFlowIpv4ProtocolMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4ProtocolMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4ProtocolMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4ProtocolMetricTag object +func (obj *patternFlowIpv4ProtocolMetricTag) SetLength(value uint32) PatternFlowIpv4ProtocolMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4ProtocolMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4ProtocolMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4ProtocolMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4ProtocolMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4ProtocolMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_reserved.go b/gosnappi/pattern_flow_ipv4_reserved.go new file mode 100644 index 00000000..aacc2bd9 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_reserved.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4Reserved ***** +type patternFlowIpv4Reserved struct { + validation + obj *otg.PatternFlowIpv4Reserved + marshaller marshalPatternFlowIpv4Reserved + unMarshaller unMarshalPatternFlowIpv4Reserved + incrementHolder PatternFlowIpv4ReservedCounter + decrementHolder PatternFlowIpv4ReservedCounter + metricTagsHolder PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter +} + +func NewPatternFlowIpv4Reserved() PatternFlowIpv4Reserved { + obj := patternFlowIpv4Reserved{obj: &otg.PatternFlowIpv4Reserved{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4Reserved) msg() *otg.PatternFlowIpv4Reserved { + return obj.obj +} + +func (obj *patternFlowIpv4Reserved) setMsg(msg *otg.PatternFlowIpv4Reserved) PatternFlowIpv4Reserved { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4Reserved struct { + obj *patternFlowIpv4Reserved +} + +type marshalPatternFlowIpv4Reserved interface { + // ToProto marshals PatternFlowIpv4Reserved to protobuf object *otg.PatternFlowIpv4Reserved + ToProto() (*otg.PatternFlowIpv4Reserved, error) + // ToPbText marshals PatternFlowIpv4Reserved to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4Reserved to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4Reserved to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4Reserved struct { + obj *patternFlowIpv4Reserved +} + +type unMarshalPatternFlowIpv4Reserved interface { + // FromProto unmarshals PatternFlowIpv4Reserved from protobuf object *otg.PatternFlowIpv4Reserved + FromProto(msg *otg.PatternFlowIpv4Reserved) (PatternFlowIpv4Reserved, error) + // FromPbText unmarshals PatternFlowIpv4Reserved from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4Reserved from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4Reserved from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4Reserved) Marshal() marshalPatternFlowIpv4Reserved { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4Reserved{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4Reserved) Unmarshal() unMarshalPatternFlowIpv4Reserved { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4Reserved{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4Reserved) ToProto() (*otg.PatternFlowIpv4Reserved, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4Reserved) FromProto(msg *otg.PatternFlowIpv4Reserved) (PatternFlowIpv4Reserved, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4Reserved) 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 *unMarshalpatternFlowIpv4Reserved) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4Reserved) 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 *unMarshalpatternFlowIpv4Reserved) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4Reserved) 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 *unMarshalpatternFlowIpv4Reserved) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4Reserved) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4Reserved) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4Reserved) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4Reserved) Clone() (PatternFlowIpv4Reserved, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4Reserved() + 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 +} + +func (obj *patternFlowIpv4Reserved) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4Reserved is reserved flag. +type PatternFlowIpv4Reserved interface { + Validation + // msg marshals PatternFlowIpv4Reserved to protobuf object *otg.PatternFlowIpv4Reserved + // and doesn't set defaults + msg() *otg.PatternFlowIpv4Reserved + // setMsg unmarshals PatternFlowIpv4Reserved from protobuf object *otg.PatternFlowIpv4Reserved + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4Reserved) PatternFlowIpv4Reserved + // provides marshal interface + Marshal() marshalPatternFlowIpv4Reserved + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4Reserved + // validate validates PatternFlowIpv4Reserved + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4Reserved, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4ReservedChoiceEnum, set in PatternFlowIpv4Reserved + Choice() PatternFlowIpv4ReservedChoiceEnum + // setChoice assigns PatternFlowIpv4ReservedChoiceEnum provided by user to PatternFlowIpv4Reserved + setChoice(value PatternFlowIpv4ReservedChoiceEnum) PatternFlowIpv4Reserved + // HasChoice checks if Choice has been set in PatternFlowIpv4Reserved + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4Reserved. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4Reserved + SetValue(value uint32) PatternFlowIpv4Reserved + // HasValue checks if Value has been set in PatternFlowIpv4Reserved + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4Reserved. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4Reserved + SetValues(value []uint32) PatternFlowIpv4Reserved + // Increment returns PatternFlowIpv4ReservedCounter, set in PatternFlowIpv4Reserved. + // PatternFlowIpv4ReservedCounter is integer counter pattern + Increment() PatternFlowIpv4ReservedCounter + // SetIncrement assigns PatternFlowIpv4ReservedCounter provided by user to PatternFlowIpv4Reserved. + // PatternFlowIpv4ReservedCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4ReservedCounter) PatternFlowIpv4Reserved + // HasIncrement checks if Increment has been set in PatternFlowIpv4Reserved + HasIncrement() bool + // Decrement returns PatternFlowIpv4ReservedCounter, set in PatternFlowIpv4Reserved. + // PatternFlowIpv4ReservedCounter is integer counter pattern + Decrement() PatternFlowIpv4ReservedCounter + // SetDecrement assigns PatternFlowIpv4ReservedCounter provided by user to PatternFlowIpv4Reserved. + // PatternFlowIpv4ReservedCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4ReservedCounter) PatternFlowIpv4Reserved + // HasDecrement checks if Decrement has been set in PatternFlowIpv4Reserved + HasDecrement() bool + // MetricTags returns PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIterIter, set in PatternFlowIpv4Reserved + MetricTags() PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter + setNil() +} + +type PatternFlowIpv4ReservedChoiceEnum string + +// Enum of Choice on PatternFlowIpv4Reserved +var PatternFlowIpv4ReservedChoice = struct { + VALUE PatternFlowIpv4ReservedChoiceEnum + VALUES PatternFlowIpv4ReservedChoiceEnum + INCREMENT PatternFlowIpv4ReservedChoiceEnum + DECREMENT PatternFlowIpv4ReservedChoiceEnum +}{ + VALUE: PatternFlowIpv4ReservedChoiceEnum("value"), + VALUES: PatternFlowIpv4ReservedChoiceEnum("values"), + INCREMENT: PatternFlowIpv4ReservedChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4ReservedChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4Reserved) Choice() PatternFlowIpv4ReservedChoiceEnum { + return PatternFlowIpv4ReservedChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4Reserved) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4Reserved) setChoice(value PatternFlowIpv4ReservedChoiceEnum) PatternFlowIpv4Reserved { + intValue, ok := otg.PatternFlowIpv4Reserved_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4ReservedChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4Reserved_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4ReservedChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4ReservedChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4ReservedChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4ReservedCounter().msg() + } + + if value == PatternFlowIpv4ReservedChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4ReservedCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4Reserved) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4ReservedChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4Reserved) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4Reserved object +func (obj *patternFlowIpv4Reserved) SetValue(value uint32) PatternFlowIpv4Reserved { + obj.setChoice(PatternFlowIpv4ReservedChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4Reserved) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4Reserved object +func (obj *patternFlowIpv4Reserved) SetValues(value []uint32) PatternFlowIpv4Reserved { + obj.setChoice(PatternFlowIpv4ReservedChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4ReservedCounter +func (obj *patternFlowIpv4Reserved) Increment() PatternFlowIpv4ReservedCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4ReservedChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4ReservedCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4ReservedCounter +func (obj *patternFlowIpv4Reserved) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4ReservedCounter value in the PatternFlowIpv4Reserved object +func (obj *patternFlowIpv4Reserved) SetIncrement(value PatternFlowIpv4ReservedCounter) PatternFlowIpv4Reserved { + obj.setChoice(PatternFlowIpv4ReservedChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4ReservedCounter +func (obj *patternFlowIpv4Reserved) Decrement() PatternFlowIpv4ReservedCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4ReservedChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4ReservedCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4ReservedCounter +func (obj *patternFlowIpv4Reserved) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4ReservedCounter value in the PatternFlowIpv4Reserved object +func (obj *patternFlowIpv4Reserved) SetDecrement(value PatternFlowIpv4ReservedCounter) PatternFlowIpv4Reserved { + obj.setChoice(PatternFlowIpv4ReservedChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4ReservedMetricTag +func (obj *patternFlowIpv4Reserved) MetricTags() PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4ReservedMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter struct { + obj *patternFlowIpv4Reserved + patternFlowIpv4ReservedMetricTagSlice []PatternFlowIpv4ReservedMetricTag + fieldPtr *[]*otg.PatternFlowIpv4ReservedMetricTag +} + +func newPatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter(ptr *[]*otg.PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { + return &patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter interface { + setMsg(*patternFlowIpv4Reserved) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter + Items() []PatternFlowIpv4ReservedMetricTag + Add() PatternFlowIpv4ReservedMetricTag + Append(items ...PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter + Set(index int, newObj PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter + Clear() PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter + clearHolderSlice() PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter + appendHolderSlice(item PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter +} + +func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) setMsg(msg *patternFlowIpv4Reserved) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4ReservedMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) Items() []PatternFlowIpv4ReservedMetricTag { + return obj.patternFlowIpv4ReservedMetricTagSlice +} + +func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) Add() PatternFlowIpv4ReservedMetricTag { + newObj := &otg.PatternFlowIpv4ReservedMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4ReservedMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4ReservedMetricTagSlice = append(obj.patternFlowIpv4ReservedMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) Append(items ...PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4ReservedMetricTagSlice = append(obj.patternFlowIpv4ReservedMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) Set(index int, newObj PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4ReservedMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) Clear() PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4ReservedMetricTag{} + obj.patternFlowIpv4ReservedMetricTagSlice = []PatternFlowIpv4ReservedMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) clearHolderSlice() PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { + if len(obj.patternFlowIpv4ReservedMetricTagSlice) > 0 { + obj.patternFlowIpv4ReservedMetricTagSlice = []PatternFlowIpv4ReservedMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter) appendHolderSlice(item PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedPatternFlowIpv4ReservedMetricTagIter { + obj.patternFlowIpv4ReservedMetricTagSlice = append(obj.patternFlowIpv4ReservedMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4Reserved) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4Reserved.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4Reserved.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4ReservedMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4Reserved) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4ReservedChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4ReservedChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4ReservedChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4ReservedChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4ReservedChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4ReservedChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4Reserved") + } + } else { + intVal := otg.PatternFlowIpv4Reserved_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4Reserved_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_reserved_counter.go b/gosnappi/pattern_flow_ipv4_reserved_counter.go new file mode 100644 index 00000000..a9005b4b --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_reserved_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4ReservedCounter ***** +type patternFlowIpv4ReservedCounter struct { + validation + obj *otg.PatternFlowIpv4ReservedCounter + marshaller marshalPatternFlowIpv4ReservedCounter + unMarshaller unMarshalPatternFlowIpv4ReservedCounter +} + +func NewPatternFlowIpv4ReservedCounter() PatternFlowIpv4ReservedCounter { + obj := patternFlowIpv4ReservedCounter{obj: &otg.PatternFlowIpv4ReservedCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4ReservedCounter) msg() *otg.PatternFlowIpv4ReservedCounter { + return obj.obj +} + +func (obj *patternFlowIpv4ReservedCounter) setMsg(msg *otg.PatternFlowIpv4ReservedCounter) PatternFlowIpv4ReservedCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4ReservedCounter struct { + obj *patternFlowIpv4ReservedCounter +} + +type marshalPatternFlowIpv4ReservedCounter interface { + // ToProto marshals PatternFlowIpv4ReservedCounter to protobuf object *otg.PatternFlowIpv4ReservedCounter + ToProto() (*otg.PatternFlowIpv4ReservedCounter, error) + // ToPbText marshals PatternFlowIpv4ReservedCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4ReservedCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4ReservedCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4ReservedCounter struct { + obj *patternFlowIpv4ReservedCounter +} + +type unMarshalPatternFlowIpv4ReservedCounter interface { + // FromProto unmarshals PatternFlowIpv4ReservedCounter from protobuf object *otg.PatternFlowIpv4ReservedCounter + FromProto(msg *otg.PatternFlowIpv4ReservedCounter) (PatternFlowIpv4ReservedCounter, error) + // FromPbText unmarshals PatternFlowIpv4ReservedCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4ReservedCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4ReservedCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4ReservedCounter) Marshal() marshalPatternFlowIpv4ReservedCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4ReservedCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4ReservedCounter) Unmarshal() unMarshalPatternFlowIpv4ReservedCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4ReservedCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4ReservedCounter) ToProto() (*otg.PatternFlowIpv4ReservedCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4ReservedCounter) FromProto(msg *otg.PatternFlowIpv4ReservedCounter) (PatternFlowIpv4ReservedCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4ReservedCounter) 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 *unMarshalpatternFlowIpv4ReservedCounter) 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 *marshalpatternFlowIpv4ReservedCounter) 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 *unMarshalpatternFlowIpv4ReservedCounter) 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 *marshalpatternFlowIpv4ReservedCounter) 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 *unMarshalpatternFlowIpv4ReservedCounter) 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 *patternFlowIpv4ReservedCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4ReservedCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4ReservedCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4ReservedCounter) Clone() (PatternFlowIpv4ReservedCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4ReservedCounter() + 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 +} + +// PatternFlowIpv4ReservedCounter is integer counter pattern +type PatternFlowIpv4ReservedCounter interface { + Validation + // msg marshals PatternFlowIpv4ReservedCounter to protobuf object *otg.PatternFlowIpv4ReservedCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4ReservedCounter + // setMsg unmarshals PatternFlowIpv4ReservedCounter from protobuf object *otg.PatternFlowIpv4ReservedCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4ReservedCounter) PatternFlowIpv4ReservedCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4ReservedCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4ReservedCounter + // validate validates PatternFlowIpv4ReservedCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4ReservedCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4ReservedCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4ReservedCounter + SetStart(value uint32) PatternFlowIpv4ReservedCounter + // HasStart checks if Start has been set in PatternFlowIpv4ReservedCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4ReservedCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4ReservedCounter + SetStep(value uint32) PatternFlowIpv4ReservedCounter + // HasStep checks if Step has been set in PatternFlowIpv4ReservedCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4ReservedCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4ReservedCounter + SetCount(value uint32) PatternFlowIpv4ReservedCounter + // HasCount checks if Count has been set in PatternFlowIpv4ReservedCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4ReservedCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4ReservedCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4ReservedCounter object +func (obj *patternFlowIpv4ReservedCounter) SetStart(value uint32) PatternFlowIpv4ReservedCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4ReservedCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4ReservedCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4ReservedCounter object +func (obj *patternFlowIpv4ReservedCounter) SetStep(value uint32) PatternFlowIpv4ReservedCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4ReservedCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4ReservedCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4ReservedCounter object +func (obj *patternFlowIpv4ReservedCounter) SetCount(value uint32) PatternFlowIpv4ReservedCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4ReservedCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4ReservedCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4ReservedCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4ReservedCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4ReservedCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_reserved_metric_tag.go b/gosnappi/pattern_flow_ipv4_reserved_metric_tag.go new file mode 100644 index 00000000..80fe9d4b --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_reserved_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4ReservedMetricTag ***** +type patternFlowIpv4ReservedMetricTag struct { + validation + obj *otg.PatternFlowIpv4ReservedMetricTag + marshaller marshalPatternFlowIpv4ReservedMetricTag + unMarshaller unMarshalPatternFlowIpv4ReservedMetricTag +} + +func NewPatternFlowIpv4ReservedMetricTag() PatternFlowIpv4ReservedMetricTag { + obj := patternFlowIpv4ReservedMetricTag{obj: &otg.PatternFlowIpv4ReservedMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4ReservedMetricTag) msg() *otg.PatternFlowIpv4ReservedMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4ReservedMetricTag) setMsg(msg *otg.PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4ReservedMetricTag struct { + obj *patternFlowIpv4ReservedMetricTag +} + +type marshalPatternFlowIpv4ReservedMetricTag interface { + // ToProto marshals PatternFlowIpv4ReservedMetricTag to protobuf object *otg.PatternFlowIpv4ReservedMetricTag + ToProto() (*otg.PatternFlowIpv4ReservedMetricTag, error) + // ToPbText marshals PatternFlowIpv4ReservedMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4ReservedMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4ReservedMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4ReservedMetricTag struct { + obj *patternFlowIpv4ReservedMetricTag +} + +type unMarshalPatternFlowIpv4ReservedMetricTag interface { + // FromProto unmarshals PatternFlowIpv4ReservedMetricTag from protobuf object *otg.PatternFlowIpv4ReservedMetricTag + FromProto(msg *otg.PatternFlowIpv4ReservedMetricTag) (PatternFlowIpv4ReservedMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4ReservedMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4ReservedMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4ReservedMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4ReservedMetricTag) Marshal() marshalPatternFlowIpv4ReservedMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4ReservedMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4ReservedMetricTag) Unmarshal() unMarshalPatternFlowIpv4ReservedMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4ReservedMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4ReservedMetricTag) ToProto() (*otg.PatternFlowIpv4ReservedMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4ReservedMetricTag) FromProto(msg *otg.PatternFlowIpv4ReservedMetricTag) (PatternFlowIpv4ReservedMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4ReservedMetricTag) 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 *unMarshalpatternFlowIpv4ReservedMetricTag) 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 *marshalpatternFlowIpv4ReservedMetricTag) 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 *unMarshalpatternFlowIpv4ReservedMetricTag) 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 *marshalpatternFlowIpv4ReservedMetricTag) 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 *unMarshalpatternFlowIpv4ReservedMetricTag) 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 *patternFlowIpv4ReservedMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4ReservedMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4ReservedMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4ReservedMetricTag) Clone() (PatternFlowIpv4ReservedMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4ReservedMetricTag() + 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 +} + +// PatternFlowIpv4ReservedMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4ReservedMetricTag interface { + Validation + // msg marshals PatternFlowIpv4ReservedMetricTag to protobuf object *otg.PatternFlowIpv4ReservedMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4ReservedMetricTag + // setMsg unmarshals PatternFlowIpv4ReservedMetricTag from protobuf object *otg.PatternFlowIpv4ReservedMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4ReservedMetricTag) PatternFlowIpv4ReservedMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4ReservedMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4ReservedMetricTag + // validate validates PatternFlowIpv4ReservedMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4ReservedMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4ReservedMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4ReservedMetricTag + SetName(value string) PatternFlowIpv4ReservedMetricTag + // Offset returns uint32, set in PatternFlowIpv4ReservedMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4ReservedMetricTag + SetOffset(value uint32) PatternFlowIpv4ReservedMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4ReservedMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4ReservedMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4ReservedMetricTag + SetLength(value uint32) PatternFlowIpv4ReservedMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4ReservedMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4ReservedMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4ReservedMetricTag object +func (obj *patternFlowIpv4ReservedMetricTag) SetName(value string) PatternFlowIpv4ReservedMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4ReservedMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4ReservedMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4ReservedMetricTag object +func (obj *patternFlowIpv4ReservedMetricTag) SetOffset(value uint32) PatternFlowIpv4ReservedMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4ReservedMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4ReservedMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4ReservedMetricTag object +func (obj *patternFlowIpv4ReservedMetricTag) SetLength(value uint32) PatternFlowIpv4ReservedMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4ReservedMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4ReservedMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4ReservedMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4ReservedMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4ReservedMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_src.go b/gosnappi/pattern_flow_ipv4_src.go new file mode 100644 index 00000000..968e1648 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_src.go @@ -0,0 +1,757 @@ +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" +) + +// ***** PatternFlowIpv4Src ***** +type patternFlowIpv4Src struct { + validation + obj *otg.PatternFlowIpv4Src + marshaller marshalPatternFlowIpv4Src + unMarshaller unMarshalPatternFlowIpv4Src + incrementHolder PatternFlowIpv4SrcCounter + decrementHolder PatternFlowIpv4SrcCounter + metricTagsHolder PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter + autoHolder FlowIpv4Auto + randomHolder PatternFlowIpv4SrcRandom +} + +func NewPatternFlowIpv4Src() PatternFlowIpv4Src { + obj := patternFlowIpv4Src{obj: &otg.PatternFlowIpv4Src{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4Src) msg() *otg.PatternFlowIpv4Src { + return obj.obj +} + +func (obj *patternFlowIpv4Src) setMsg(msg *otg.PatternFlowIpv4Src) PatternFlowIpv4Src { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4Src struct { + obj *patternFlowIpv4Src +} + +type marshalPatternFlowIpv4Src interface { + // ToProto marshals PatternFlowIpv4Src to protobuf object *otg.PatternFlowIpv4Src + ToProto() (*otg.PatternFlowIpv4Src, error) + // ToPbText marshals PatternFlowIpv4Src to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4Src to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4Src to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4Src struct { + obj *patternFlowIpv4Src +} + +type unMarshalPatternFlowIpv4Src interface { + // FromProto unmarshals PatternFlowIpv4Src from protobuf object *otg.PatternFlowIpv4Src + FromProto(msg *otg.PatternFlowIpv4Src) (PatternFlowIpv4Src, error) + // FromPbText unmarshals PatternFlowIpv4Src from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4Src from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4Src from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4Src) Marshal() marshalPatternFlowIpv4Src { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4Src{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4Src) Unmarshal() unMarshalPatternFlowIpv4Src { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4Src{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4Src) ToProto() (*otg.PatternFlowIpv4Src, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4Src) FromProto(msg *otg.PatternFlowIpv4Src) (PatternFlowIpv4Src, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4Src) 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 *unMarshalpatternFlowIpv4Src) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4Src) 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 *unMarshalpatternFlowIpv4Src) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4Src) 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 *unMarshalpatternFlowIpv4Src) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4Src) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4Src) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4Src) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4Src) Clone() (PatternFlowIpv4Src, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4Src() + 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 +} + +func (obj *patternFlowIpv4Src) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.autoHolder = nil + obj.randomHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4Src is source address +type PatternFlowIpv4Src interface { + Validation + // msg marshals PatternFlowIpv4Src to protobuf object *otg.PatternFlowIpv4Src + // and doesn't set defaults + msg() *otg.PatternFlowIpv4Src + // setMsg unmarshals PatternFlowIpv4Src from protobuf object *otg.PatternFlowIpv4Src + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4Src) PatternFlowIpv4Src + // provides marshal interface + Marshal() marshalPatternFlowIpv4Src + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4Src + // validate validates PatternFlowIpv4Src + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4Src, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4SrcChoiceEnum, set in PatternFlowIpv4Src + Choice() PatternFlowIpv4SrcChoiceEnum + // setChoice assigns PatternFlowIpv4SrcChoiceEnum provided by user to PatternFlowIpv4Src + setChoice(value PatternFlowIpv4SrcChoiceEnum) PatternFlowIpv4Src + // HasChoice checks if Choice has been set in PatternFlowIpv4Src + HasChoice() bool + // Value returns string, set in PatternFlowIpv4Src. + Value() string + // SetValue assigns string provided by user to PatternFlowIpv4Src + SetValue(value string) PatternFlowIpv4Src + // HasValue checks if Value has been set in PatternFlowIpv4Src + HasValue() bool + // Values returns []string, set in PatternFlowIpv4Src. + Values() []string + // SetValues assigns []string provided by user to PatternFlowIpv4Src + SetValues(value []string) PatternFlowIpv4Src + // Increment returns PatternFlowIpv4SrcCounter, set in PatternFlowIpv4Src. + // PatternFlowIpv4SrcCounter is ipv4 counter pattern + Increment() PatternFlowIpv4SrcCounter + // SetIncrement assigns PatternFlowIpv4SrcCounter provided by user to PatternFlowIpv4Src. + // PatternFlowIpv4SrcCounter is ipv4 counter pattern + SetIncrement(value PatternFlowIpv4SrcCounter) PatternFlowIpv4Src + // HasIncrement checks if Increment has been set in PatternFlowIpv4Src + HasIncrement() bool + // Decrement returns PatternFlowIpv4SrcCounter, set in PatternFlowIpv4Src. + // PatternFlowIpv4SrcCounter is ipv4 counter pattern + Decrement() PatternFlowIpv4SrcCounter + // SetDecrement assigns PatternFlowIpv4SrcCounter provided by user to PatternFlowIpv4Src. + // PatternFlowIpv4SrcCounter is ipv4 counter pattern + SetDecrement(value PatternFlowIpv4SrcCounter) PatternFlowIpv4Src + // HasDecrement checks if Decrement has been set in PatternFlowIpv4Src + HasDecrement() bool + // MetricTags returns PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIterIter, set in PatternFlowIpv4Src + MetricTags() PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter + // Auto returns FlowIpv4Auto, set in PatternFlowIpv4Src. + // FlowIpv4Auto is the OTG implementation can provide a system generated, value for this property. + Auto() FlowIpv4Auto + // HasAuto checks if Auto has been set in PatternFlowIpv4Src + HasAuto() bool + // Random returns PatternFlowIpv4SrcRandom, set in PatternFlowIpv4Src. + // PatternFlowIpv4SrcRandom is ipv4 random pattern + Random() PatternFlowIpv4SrcRandom + // SetRandom assigns PatternFlowIpv4SrcRandom provided by user to PatternFlowIpv4Src. + // PatternFlowIpv4SrcRandom is ipv4 random pattern + SetRandom(value PatternFlowIpv4SrcRandom) PatternFlowIpv4Src + // HasRandom checks if Random has been set in PatternFlowIpv4Src + HasRandom() bool + setNil() +} + +type PatternFlowIpv4SrcChoiceEnum string + +// Enum of Choice on PatternFlowIpv4Src +var PatternFlowIpv4SrcChoice = struct { + VALUE PatternFlowIpv4SrcChoiceEnum + VALUES PatternFlowIpv4SrcChoiceEnum + INCREMENT PatternFlowIpv4SrcChoiceEnum + DECREMENT PatternFlowIpv4SrcChoiceEnum + AUTO PatternFlowIpv4SrcChoiceEnum + RANDOM PatternFlowIpv4SrcChoiceEnum +}{ + VALUE: PatternFlowIpv4SrcChoiceEnum("value"), + VALUES: PatternFlowIpv4SrcChoiceEnum("values"), + INCREMENT: PatternFlowIpv4SrcChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4SrcChoiceEnum("decrement"), + AUTO: PatternFlowIpv4SrcChoiceEnum("auto"), + RANDOM: PatternFlowIpv4SrcChoiceEnum("random"), +} + +func (obj *patternFlowIpv4Src) Choice() PatternFlowIpv4SrcChoiceEnum { + return PatternFlowIpv4SrcChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4Src) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4Src) setChoice(value PatternFlowIpv4SrcChoiceEnum) PatternFlowIpv4Src { + intValue, ok := otg.PatternFlowIpv4Src_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4SrcChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4Src_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Random = nil + obj.randomHolder = nil + obj.obj.Auto = nil + obj.autoHolder = nil + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4SrcChoice.VALUE { + defaultValue := "0.0.0.0" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4SrcChoice.VALUES { + defaultValue := []string{"0.0.0.0"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4SrcChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4SrcCounter().msg() + } + + if value == PatternFlowIpv4SrcChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4SrcCounter().msg() + } + + if value == PatternFlowIpv4SrcChoice.AUTO { + obj.obj.Auto = NewFlowIpv4Auto().msg() + } + + if value == PatternFlowIpv4SrcChoice.RANDOM { + obj.obj.Random = NewPatternFlowIpv4SrcRandom().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowIpv4Src) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4SrcChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowIpv4Src) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowIpv4Src object +func (obj *patternFlowIpv4Src) SetValue(value string) PatternFlowIpv4Src { + obj.setChoice(PatternFlowIpv4SrcChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowIpv4Src) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"0.0.0.0"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowIpv4Src object +func (obj *patternFlowIpv4Src) SetValues(value []string) PatternFlowIpv4Src { + obj.setChoice(PatternFlowIpv4SrcChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4SrcCounter +func (obj *patternFlowIpv4Src) Increment() PatternFlowIpv4SrcCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4SrcChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4SrcCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4SrcCounter +func (obj *patternFlowIpv4Src) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4SrcCounter value in the PatternFlowIpv4Src object +func (obj *patternFlowIpv4Src) SetIncrement(value PatternFlowIpv4SrcCounter) PatternFlowIpv4Src { + obj.setChoice(PatternFlowIpv4SrcChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4SrcCounter +func (obj *patternFlowIpv4Src) Decrement() PatternFlowIpv4SrcCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4SrcChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4SrcCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4SrcCounter +func (obj *patternFlowIpv4Src) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4SrcCounter value in the PatternFlowIpv4Src object +func (obj *patternFlowIpv4Src) SetDecrement(value PatternFlowIpv4SrcCounter) PatternFlowIpv4Src { + obj.setChoice(PatternFlowIpv4SrcChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4SrcMetricTag +func (obj *patternFlowIpv4Src) MetricTags() PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4SrcMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter struct { + obj *patternFlowIpv4Src + patternFlowIpv4SrcMetricTagSlice []PatternFlowIpv4SrcMetricTag + fieldPtr *[]*otg.PatternFlowIpv4SrcMetricTag +} + +func newPatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter(ptr *[]*otg.PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { + return &patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter interface { + setMsg(*patternFlowIpv4Src) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter + Items() []PatternFlowIpv4SrcMetricTag + Add() PatternFlowIpv4SrcMetricTag + Append(items ...PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter + Set(index int, newObj PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter + Clear() PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter + clearHolderSlice() PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter + appendHolderSlice(item PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter +} + +func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) setMsg(msg *patternFlowIpv4Src) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4SrcMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) Items() []PatternFlowIpv4SrcMetricTag { + return obj.patternFlowIpv4SrcMetricTagSlice +} + +func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) Add() PatternFlowIpv4SrcMetricTag { + newObj := &otg.PatternFlowIpv4SrcMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4SrcMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4SrcMetricTagSlice = append(obj.patternFlowIpv4SrcMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) Append(items ...PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4SrcMetricTagSlice = append(obj.patternFlowIpv4SrcMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) Set(index int, newObj PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4SrcMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) Clear() PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4SrcMetricTag{} + obj.patternFlowIpv4SrcMetricTagSlice = []PatternFlowIpv4SrcMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) clearHolderSlice() PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { + if len(obj.patternFlowIpv4SrcMetricTagSlice) > 0 { + obj.patternFlowIpv4SrcMetricTagSlice = []PatternFlowIpv4SrcMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter) appendHolderSlice(item PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcPatternFlowIpv4SrcMetricTagIter { + obj.patternFlowIpv4SrcMetricTagSlice = append(obj.patternFlowIpv4SrcMetricTagSlice, item) + return obj +} + +// description is TBD +// Auto returns a FlowIpv4Auto +func (obj *patternFlowIpv4Src) Auto() FlowIpv4Auto { + if obj.obj.Auto == nil { + obj.setChoice(PatternFlowIpv4SrcChoice.AUTO) + } + if obj.autoHolder == nil { + obj.autoHolder = &flowIpv4Auto{obj: obj.obj.Auto} + } + return obj.autoHolder +} + +// description is TBD +// Auto returns a FlowIpv4Auto +func (obj *patternFlowIpv4Src) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Random returns a PatternFlowIpv4SrcRandom +func (obj *patternFlowIpv4Src) Random() PatternFlowIpv4SrcRandom { + if obj.obj.Random == nil { + obj.setChoice(PatternFlowIpv4SrcChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &patternFlowIpv4SrcRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a PatternFlowIpv4SrcRandom +func (obj *patternFlowIpv4Src) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the PatternFlowIpv4SrcRandom value in the PatternFlowIpv4Src object +func (obj *patternFlowIpv4Src) SetRandom(value PatternFlowIpv4SrcRandom) PatternFlowIpv4Src { + obj.setChoice(PatternFlowIpv4SrcChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + +func (obj *patternFlowIpv4Src) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv4(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4Src.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateIpv4Slice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4Src.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4SrcMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Auto != nil { + + obj.Auto().validateObj(vObj, set_default) + } + + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowIpv4Src) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4SrcChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4SrcChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4SrcChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4SrcChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4SrcChoice.DECREMENT + } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowIpv4SrcChoice.AUTO + } + + if obj.obj.Random != nil { + choices_set += 1 + choice = PatternFlowIpv4SrcChoice.RANDOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4SrcChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4Src") + } + } else { + intVal := otg.PatternFlowIpv4Src_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4Src_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_src_counter.go b/gosnappi/pattern_flow_ipv4_src_counter.go new file mode 100644 index 00000000..f94d136b --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_src_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowIpv4SrcCounter ***** +type patternFlowIpv4SrcCounter struct { + validation + obj *otg.PatternFlowIpv4SrcCounter + marshaller marshalPatternFlowIpv4SrcCounter + unMarshaller unMarshalPatternFlowIpv4SrcCounter +} + +func NewPatternFlowIpv4SrcCounter() PatternFlowIpv4SrcCounter { + obj := patternFlowIpv4SrcCounter{obj: &otg.PatternFlowIpv4SrcCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4SrcCounter) msg() *otg.PatternFlowIpv4SrcCounter { + return obj.obj +} + +func (obj *patternFlowIpv4SrcCounter) setMsg(msg *otg.PatternFlowIpv4SrcCounter) PatternFlowIpv4SrcCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4SrcCounter struct { + obj *patternFlowIpv4SrcCounter +} + +type marshalPatternFlowIpv4SrcCounter interface { + // ToProto marshals PatternFlowIpv4SrcCounter to protobuf object *otg.PatternFlowIpv4SrcCounter + ToProto() (*otg.PatternFlowIpv4SrcCounter, error) + // ToPbText marshals PatternFlowIpv4SrcCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4SrcCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4SrcCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4SrcCounter struct { + obj *patternFlowIpv4SrcCounter +} + +type unMarshalPatternFlowIpv4SrcCounter interface { + // FromProto unmarshals PatternFlowIpv4SrcCounter from protobuf object *otg.PatternFlowIpv4SrcCounter + FromProto(msg *otg.PatternFlowIpv4SrcCounter) (PatternFlowIpv4SrcCounter, error) + // FromPbText unmarshals PatternFlowIpv4SrcCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4SrcCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4SrcCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4SrcCounter) Marshal() marshalPatternFlowIpv4SrcCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4SrcCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4SrcCounter) Unmarshal() unMarshalPatternFlowIpv4SrcCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4SrcCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4SrcCounter) ToProto() (*otg.PatternFlowIpv4SrcCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4SrcCounter) FromProto(msg *otg.PatternFlowIpv4SrcCounter) (PatternFlowIpv4SrcCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4SrcCounter) 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 *unMarshalpatternFlowIpv4SrcCounter) 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 *marshalpatternFlowIpv4SrcCounter) 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 *unMarshalpatternFlowIpv4SrcCounter) 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 *marshalpatternFlowIpv4SrcCounter) 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 *unMarshalpatternFlowIpv4SrcCounter) 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 *patternFlowIpv4SrcCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4SrcCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4SrcCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4SrcCounter) Clone() (PatternFlowIpv4SrcCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4SrcCounter() + 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 +} + +// PatternFlowIpv4SrcCounter is ipv4 counter pattern +type PatternFlowIpv4SrcCounter interface { + Validation + // msg marshals PatternFlowIpv4SrcCounter to protobuf object *otg.PatternFlowIpv4SrcCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4SrcCounter + // setMsg unmarshals PatternFlowIpv4SrcCounter from protobuf object *otg.PatternFlowIpv4SrcCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4SrcCounter) PatternFlowIpv4SrcCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4SrcCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4SrcCounter + // validate validates PatternFlowIpv4SrcCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4SrcCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowIpv4SrcCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowIpv4SrcCounter + SetStart(value string) PatternFlowIpv4SrcCounter + // HasStart checks if Start has been set in PatternFlowIpv4SrcCounter + HasStart() bool + // Step returns string, set in PatternFlowIpv4SrcCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowIpv4SrcCounter + SetStep(value string) PatternFlowIpv4SrcCounter + // HasStep checks if Step has been set in PatternFlowIpv4SrcCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4SrcCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4SrcCounter + SetCount(value uint32) PatternFlowIpv4SrcCounter + // HasCount checks if Count has been set in PatternFlowIpv4SrcCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowIpv4SrcCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowIpv4SrcCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowIpv4SrcCounter object +func (obj *patternFlowIpv4SrcCounter) SetStart(value string) PatternFlowIpv4SrcCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowIpv4SrcCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowIpv4SrcCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowIpv4SrcCounter object +func (obj *patternFlowIpv4SrcCounter) SetStep(value string) PatternFlowIpv4SrcCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4SrcCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4SrcCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4SrcCounter object +func (obj *patternFlowIpv4SrcCounter) SetCount(value uint32) PatternFlowIpv4SrcCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4SrcCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateIpv4(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4SrcCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateIpv4(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4SrcCounter.Step")) + } + + } + +} + +func (obj *patternFlowIpv4SrcCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("0.0.0.0") + } + if obj.obj.Step == nil { + obj.SetStep("0.0.0.1") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_src_metric_tag.go b/gosnappi/pattern_flow_ipv4_src_metric_tag.go new file mode 100644 index 00000000..1e2a79b4 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_src_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4SrcMetricTag ***** +type patternFlowIpv4SrcMetricTag struct { + validation + obj *otg.PatternFlowIpv4SrcMetricTag + marshaller marshalPatternFlowIpv4SrcMetricTag + unMarshaller unMarshalPatternFlowIpv4SrcMetricTag +} + +func NewPatternFlowIpv4SrcMetricTag() PatternFlowIpv4SrcMetricTag { + obj := patternFlowIpv4SrcMetricTag{obj: &otg.PatternFlowIpv4SrcMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4SrcMetricTag) msg() *otg.PatternFlowIpv4SrcMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4SrcMetricTag) setMsg(msg *otg.PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4SrcMetricTag struct { + obj *patternFlowIpv4SrcMetricTag +} + +type marshalPatternFlowIpv4SrcMetricTag interface { + // ToProto marshals PatternFlowIpv4SrcMetricTag to protobuf object *otg.PatternFlowIpv4SrcMetricTag + ToProto() (*otg.PatternFlowIpv4SrcMetricTag, error) + // ToPbText marshals PatternFlowIpv4SrcMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4SrcMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4SrcMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4SrcMetricTag struct { + obj *patternFlowIpv4SrcMetricTag +} + +type unMarshalPatternFlowIpv4SrcMetricTag interface { + // FromProto unmarshals PatternFlowIpv4SrcMetricTag from protobuf object *otg.PatternFlowIpv4SrcMetricTag + FromProto(msg *otg.PatternFlowIpv4SrcMetricTag) (PatternFlowIpv4SrcMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4SrcMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4SrcMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4SrcMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4SrcMetricTag) Marshal() marshalPatternFlowIpv4SrcMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4SrcMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4SrcMetricTag) Unmarshal() unMarshalPatternFlowIpv4SrcMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4SrcMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4SrcMetricTag) ToProto() (*otg.PatternFlowIpv4SrcMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4SrcMetricTag) FromProto(msg *otg.PatternFlowIpv4SrcMetricTag) (PatternFlowIpv4SrcMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4SrcMetricTag) 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 *unMarshalpatternFlowIpv4SrcMetricTag) 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 *marshalpatternFlowIpv4SrcMetricTag) 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 *unMarshalpatternFlowIpv4SrcMetricTag) 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 *marshalpatternFlowIpv4SrcMetricTag) 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 *unMarshalpatternFlowIpv4SrcMetricTag) 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 *patternFlowIpv4SrcMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4SrcMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4SrcMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4SrcMetricTag) Clone() (PatternFlowIpv4SrcMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4SrcMetricTag() + 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 +} + +// PatternFlowIpv4SrcMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4SrcMetricTag interface { + Validation + // msg marshals PatternFlowIpv4SrcMetricTag to protobuf object *otg.PatternFlowIpv4SrcMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4SrcMetricTag + // setMsg unmarshals PatternFlowIpv4SrcMetricTag from protobuf object *otg.PatternFlowIpv4SrcMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4SrcMetricTag) PatternFlowIpv4SrcMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4SrcMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4SrcMetricTag + // validate validates PatternFlowIpv4SrcMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4SrcMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4SrcMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4SrcMetricTag + SetName(value string) PatternFlowIpv4SrcMetricTag + // Offset returns uint32, set in PatternFlowIpv4SrcMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4SrcMetricTag + SetOffset(value uint32) PatternFlowIpv4SrcMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4SrcMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4SrcMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4SrcMetricTag + SetLength(value uint32) PatternFlowIpv4SrcMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4SrcMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4SrcMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4SrcMetricTag object +func (obj *patternFlowIpv4SrcMetricTag) SetName(value string) PatternFlowIpv4SrcMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4SrcMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4SrcMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4SrcMetricTag object +func (obj *patternFlowIpv4SrcMetricTag) SetOffset(value uint32) PatternFlowIpv4SrcMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4SrcMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4SrcMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4SrcMetricTag object +func (obj *patternFlowIpv4SrcMetricTag) SetLength(value uint32) PatternFlowIpv4SrcMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4SrcMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4SrcMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4SrcMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4SrcMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4SrcMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(32) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_src_random.go b/gosnappi/pattern_flow_ipv4_src_random.go new file mode 100644 index 00000000..5d18561c --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_src_random.go @@ -0,0 +1,420 @@ +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" +) + +// ***** PatternFlowIpv4SrcRandom ***** +type patternFlowIpv4SrcRandom struct { + validation + obj *otg.PatternFlowIpv4SrcRandom + marshaller marshalPatternFlowIpv4SrcRandom + unMarshaller unMarshalPatternFlowIpv4SrcRandom +} + +func NewPatternFlowIpv4SrcRandom() PatternFlowIpv4SrcRandom { + obj := patternFlowIpv4SrcRandom{obj: &otg.PatternFlowIpv4SrcRandom{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4SrcRandom) msg() *otg.PatternFlowIpv4SrcRandom { + return obj.obj +} + +func (obj *patternFlowIpv4SrcRandom) setMsg(msg *otg.PatternFlowIpv4SrcRandom) PatternFlowIpv4SrcRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4SrcRandom struct { + obj *patternFlowIpv4SrcRandom +} + +type marshalPatternFlowIpv4SrcRandom interface { + // ToProto marshals PatternFlowIpv4SrcRandom to protobuf object *otg.PatternFlowIpv4SrcRandom + ToProto() (*otg.PatternFlowIpv4SrcRandom, error) + // ToPbText marshals PatternFlowIpv4SrcRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4SrcRandom to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4SrcRandom to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4SrcRandom struct { + obj *patternFlowIpv4SrcRandom +} + +type unMarshalPatternFlowIpv4SrcRandom interface { + // FromProto unmarshals PatternFlowIpv4SrcRandom from protobuf object *otg.PatternFlowIpv4SrcRandom + FromProto(msg *otg.PatternFlowIpv4SrcRandom) (PatternFlowIpv4SrcRandom, error) + // FromPbText unmarshals PatternFlowIpv4SrcRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4SrcRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4SrcRandom from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4SrcRandom) Marshal() marshalPatternFlowIpv4SrcRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4SrcRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4SrcRandom) Unmarshal() unMarshalPatternFlowIpv4SrcRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4SrcRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4SrcRandom) ToProto() (*otg.PatternFlowIpv4SrcRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4SrcRandom) FromProto(msg *otg.PatternFlowIpv4SrcRandom) (PatternFlowIpv4SrcRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4SrcRandom) 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 *unMarshalpatternFlowIpv4SrcRandom) 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 *marshalpatternFlowIpv4SrcRandom) 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 *unMarshalpatternFlowIpv4SrcRandom) 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 *marshalpatternFlowIpv4SrcRandom) 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 *unMarshalpatternFlowIpv4SrcRandom) 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 *patternFlowIpv4SrcRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4SrcRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4SrcRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4SrcRandom) Clone() (PatternFlowIpv4SrcRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4SrcRandom() + 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 +} + +// PatternFlowIpv4SrcRandom is ipv4 random pattern +type PatternFlowIpv4SrcRandom interface { + Validation + // msg marshals PatternFlowIpv4SrcRandom to protobuf object *otg.PatternFlowIpv4SrcRandom + // and doesn't set defaults + msg() *otg.PatternFlowIpv4SrcRandom + // setMsg unmarshals PatternFlowIpv4SrcRandom from protobuf object *otg.PatternFlowIpv4SrcRandom + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4SrcRandom) PatternFlowIpv4SrcRandom + // provides marshal interface + Marshal() marshalPatternFlowIpv4SrcRandom + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4SrcRandom + // validate validates PatternFlowIpv4SrcRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4SrcRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns string, set in PatternFlowIpv4SrcRandom. + Min() string + // SetMin assigns string provided by user to PatternFlowIpv4SrcRandom + SetMin(value string) PatternFlowIpv4SrcRandom + // HasMin checks if Min has been set in PatternFlowIpv4SrcRandom + HasMin() bool + // Max returns string, set in PatternFlowIpv4SrcRandom. + Max() string + // SetMax assigns string provided by user to PatternFlowIpv4SrcRandom + SetMax(value string) PatternFlowIpv4SrcRandom + // HasMax checks if Max has been set in PatternFlowIpv4SrcRandom + HasMax() bool + // Seed returns uint32, set in PatternFlowIpv4SrcRandom. + Seed() uint32 + // SetSeed assigns uint32 provided by user to PatternFlowIpv4SrcRandom + SetSeed(value uint32) PatternFlowIpv4SrcRandom + // HasSeed checks if Seed has been set in PatternFlowIpv4SrcRandom + HasSeed() bool + // Count returns uint32, set in PatternFlowIpv4SrcRandom. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4SrcRandom + SetCount(value uint32) PatternFlowIpv4SrcRandom + // HasCount checks if Count has been set in PatternFlowIpv4SrcRandom + HasCount() bool +} + +// The minimum possible value generated by the random value generator. +// Min returns a string +func (obj *patternFlowIpv4SrcRandom) Min() string { + + return *obj.obj.Min + +} + +// The minimum possible value generated by the random value generator. +// Min returns a string +func (obj *patternFlowIpv4SrcRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// The minimum possible value generated by the random value generator. +// SetMin sets the string value in the PatternFlowIpv4SrcRandom object +func (obj *patternFlowIpv4SrcRandom) SetMin(value string) PatternFlowIpv4SrcRandom { + + obj.obj.Min = &value + return obj +} + +// The maximum possible value generated by the random value generator. +// Max returns a string +func (obj *patternFlowIpv4SrcRandom) Max() string { + + return *obj.obj.Max + +} + +// The maximum possible value generated by the random value generator. +// Max returns a string +func (obj *patternFlowIpv4SrcRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// The maximum possible value generated by the random value generator. +// SetMax sets the string value in the PatternFlowIpv4SrcRandom object +func (obj *patternFlowIpv4SrcRandom) SetMax(value string) PatternFlowIpv4SrcRandom { + + obj.obj.Max = &value + return obj +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowIpv4SrcRandom) Seed() uint32 { + + return *obj.obj.Seed + +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowIpv4SrcRandom) HasSeed() bool { + return obj.obj.Seed != nil +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// SetSeed sets the uint32 value in the PatternFlowIpv4SrcRandom object +func (obj *patternFlowIpv4SrcRandom) SetSeed(value uint32) PatternFlowIpv4SrcRandom { + + obj.obj.Seed = &value + return obj +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowIpv4SrcRandom) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowIpv4SrcRandom) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of values to be generated by the random value generator. +// SetCount sets the uint32 value in the PatternFlowIpv4SrcRandom object +func (obj *patternFlowIpv4SrcRandom) SetCount(value uint32) PatternFlowIpv4SrcRandom { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4SrcRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Min != nil { + + err := obj.validateIpv4(obj.Min()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4SrcRandom.Min")) + } + + } + + if obj.obj.Max != nil { + + err := obj.validateIpv4(obj.Max()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv4SrcRandom.Max")) + } + + } + +} + +func (obj *patternFlowIpv4SrcRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin("0.0.0.0") + } + if obj.obj.Max == nil { + obj.SetMax("255.255.255.255") + } + if obj.obj.Seed == nil { + obj.SetSeed(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_time_to_live.go b/gosnappi/pattern_flow_ipv4_time_to_live.go new file mode 100644 index 00000000..b7b9f79d --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_time_to_live.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4TimeToLive ***** +type patternFlowIpv4TimeToLive struct { + validation + obj *otg.PatternFlowIpv4TimeToLive + marshaller marshalPatternFlowIpv4TimeToLive + unMarshaller unMarshalPatternFlowIpv4TimeToLive + incrementHolder PatternFlowIpv4TimeToLiveCounter + decrementHolder PatternFlowIpv4TimeToLiveCounter + metricTagsHolder PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter +} + +func NewPatternFlowIpv4TimeToLive() PatternFlowIpv4TimeToLive { + obj := patternFlowIpv4TimeToLive{obj: &otg.PatternFlowIpv4TimeToLive{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TimeToLive) msg() *otg.PatternFlowIpv4TimeToLive { + return obj.obj +} + +func (obj *patternFlowIpv4TimeToLive) setMsg(msg *otg.PatternFlowIpv4TimeToLive) PatternFlowIpv4TimeToLive { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TimeToLive struct { + obj *patternFlowIpv4TimeToLive +} + +type marshalPatternFlowIpv4TimeToLive interface { + // ToProto marshals PatternFlowIpv4TimeToLive to protobuf object *otg.PatternFlowIpv4TimeToLive + ToProto() (*otg.PatternFlowIpv4TimeToLive, error) + // ToPbText marshals PatternFlowIpv4TimeToLive to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TimeToLive to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TimeToLive to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TimeToLive struct { + obj *patternFlowIpv4TimeToLive +} + +type unMarshalPatternFlowIpv4TimeToLive interface { + // FromProto unmarshals PatternFlowIpv4TimeToLive from protobuf object *otg.PatternFlowIpv4TimeToLive + FromProto(msg *otg.PatternFlowIpv4TimeToLive) (PatternFlowIpv4TimeToLive, error) + // FromPbText unmarshals PatternFlowIpv4TimeToLive from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TimeToLive from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TimeToLive from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TimeToLive) Marshal() marshalPatternFlowIpv4TimeToLive { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TimeToLive{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TimeToLive) Unmarshal() unMarshalPatternFlowIpv4TimeToLive { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TimeToLive{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TimeToLive) ToProto() (*otg.PatternFlowIpv4TimeToLive, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TimeToLive) FromProto(msg *otg.PatternFlowIpv4TimeToLive) (PatternFlowIpv4TimeToLive, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TimeToLive) 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 *unMarshalpatternFlowIpv4TimeToLive) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4TimeToLive) 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 *unMarshalpatternFlowIpv4TimeToLive) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4TimeToLive) 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 *unMarshalpatternFlowIpv4TimeToLive) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4TimeToLive) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TimeToLive) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TimeToLive) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TimeToLive) Clone() (PatternFlowIpv4TimeToLive, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TimeToLive() + 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 +} + +func (obj *patternFlowIpv4TimeToLive) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4TimeToLive is time to live +type PatternFlowIpv4TimeToLive interface { + Validation + // msg marshals PatternFlowIpv4TimeToLive to protobuf object *otg.PatternFlowIpv4TimeToLive + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TimeToLive + // setMsg unmarshals PatternFlowIpv4TimeToLive from protobuf object *otg.PatternFlowIpv4TimeToLive + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TimeToLive) PatternFlowIpv4TimeToLive + // provides marshal interface + Marshal() marshalPatternFlowIpv4TimeToLive + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TimeToLive + // validate validates PatternFlowIpv4TimeToLive + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TimeToLive, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4TimeToLiveChoiceEnum, set in PatternFlowIpv4TimeToLive + Choice() PatternFlowIpv4TimeToLiveChoiceEnum + // setChoice assigns PatternFlowIpv4TimeToLiveChoiceEnum provided by user to PatternFlowIpv4TimeToLive + setChoice(value PatternFlowIpv4TimeToLiveChoiceEnum) PatternFlowIpv4TimeToLive + // HasChoice checks if Choice has been set in PatternFlowIpv4TimeToLive + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4TimeToLive. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4TimeToLive + SetValue(value uint32) PatternFlowIpv4TimeToLive + // HasValue checks if Value has been set in PatternFlowIpv4TimeToLive + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4TimeToLive. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4TimeToLive + SetValues(value []uint32) PatternFlowIpv4TimeToLive + // Increment returns PatternFlowIpv4TimeToLiveCounter, set in PatternFlowIpv4TimeToLive. + // PatternFlowIpv4TimeToLiveCounter is integer counter pattern + Increment() PatternFlowIpv4TimeToLiveCounter + // SetIncrement assigns PatternFlowIpv4TimeToLiveCounter provided by user to PatternFlowIpv4TimeToLive. + // PatternFlowIpv4TimeToLiveCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4TimeToLiveCounter) PatternFlowIpv4TimeToLive + // HasIncrement checks if Increment has been set in PatternFlowIpv4TimeToLive + HasIncrement() bool + // Decrement returns PatternFlowIpv4TimeToLiveCounter, set in PatternFlowIpv4TimeToLive. + // PatternFlowIpv4TimeToLiveCounter is integer counter pattern + Decrement() PatternFlowIpv4TimeToLiveCounter + // SetDecrement assigns PatternFlowIpv4TimeToLiveCounter provided by user to PatternFlowIpv4TimeToLive. + // PatternFlowIpv4TimeToLiveCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4TimeToLiveCounter) PatternFlowIpv4TimeToLive + // HasDecrement checks if Decrement has been set in PatternFlowIpv4TimeToLive + HasDecrement() bool + // MetricTags returns PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIterIter, set in PatternFlowIpv4TimeToLive + MetricTags() PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter + setNil() +} + +type PatternFlowIpv4TimeToLiveChoiceEnum string + +// Enum of Choice on PatternFlowIpv4TimeToLive +var PatternFlowIpv4TimeToLiveChoice = struct { + VALUE PatternFlowIpv4TimeToLiveChoiceEnum + VALUES PatternFlowIpv4TimeToLiveChoiceEnum + INCREMENT PatternFlowIpv4TimeToLiveChoiceEnum + DECREMENT PatternFlowIpv4TimeToLiveChoiceEnum +}{ + VALUE: PatternFlowIpv4TimeToLiveChoiceEnum("value"), + VALUES: PatternFlowIpv4TimeToLiveChoiceEnum("values"), + INCREMENT: PatternFlowIpv4TimeToLiveChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4TimeToLiveChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4TimeToLive) Choice() PatternFlowIpv4TimeToLiveChoiceEnum { + return PatternFlowIpv4TimeToLiveChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4TimeToLive) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4TimeToLive) setChoice(value PatternFlowIpv4TimeToLiveChoiceEnum) PatternFlowIpv4TimeToLive { + intValue, ok := otg.PatternFlowIpv4TimeToLive_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4TimeToLiveChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4TimeToLive_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4TimeToLiveChoice.VALUE { + defaultValue := uint32(64) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4TimeToLiveChoice.VALUES { + defaultValue := []uint32{64} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4TimeToLiveChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4TimeToLiveCounter().msg() + } + + if value == PatternFlowIpv4TimeToLiveChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4TimeToLiveCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TimeToLive) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4TimeToLiveChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TimeToLive) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4TimeToLive object +func (obj *patternFlowIpv4TimeToLive) SetValue(value uint32) PatternFlowIpv4TimeToLive { + obj.setChoice(PatternFlowIpv4TimeToLiveChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4TimeToLive) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{64}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4TimeToLive object +func (obj *patternFlowIpv4TimeToLive) SetValues(value []uint32) PatternFlowIpv4TimeToLive { + obj.setChoice(PatternFlowIpv4TimeToLiveChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4TimeToLiveCounter +func (obj *patternFlowIpv4TimeToLive) Increment() PatternFlowIpv4TimeToLiveCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4TimeToLiveChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4TimeToLiveCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4TimeToLiveCounter +func (obj *patternFlowIpv4TimeToLive) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4TimeToLiveCounter value in the PatternFlowIpv4TimeToLive object +func (obj *patternFlowIpv4TimeToLive) SetIncrement(value PatternFlowIpv4TimeToLiveCounter) PatternFlowIpv4TimeToLive { + obj.setChoice(PatternFlowIpv4TimeToLiveChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TimeToLiveCounter +func (obj *patternFlowIpv4TimeToLive) Decrement() PatternFlowIpv4TimeToLiveCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4TimeToLiveChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4TimeToLiveCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TimeToLiveCounter +func (obj *patternFlowIpv4TimeToLive) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4TimeToLiveCounter value in the PatternFlowIpv4TimeToLive object +func (obj *patternFlowIpv4TimeToLive) SetDecrement(value PatternFlowIpv4TimeToLiveCounter) PatternFlowIpv4TimeToLive { + obj.setChoice(PatternFlowIpv4TimeToLiveChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4TimeToLiveMetricTag +func (obj *patternFlowIpv4TimeToLive) MetricTags() PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4TimeToLiveMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter struct { + obj *patternFlowIpv4TimeToLive + patternFlowIpv4TimeToLiveMetricTagSlice []PatternFlowIpv4TimeToLiveMetricTag + fieldPtr *[]*otg.PatternFlowIpv4TimeToLiveMetricTag +} + +func newPatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter(ptr *[]*otg.PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { + return &patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter interface { + setMsg(*patternFlowIpv4TimeToLive) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter + Items() []PatternFlowIpv4TimeToLiveMetricTag + Add() PatternFlowIpv4TimeToLiveMetricTag + Append(items ...PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter + Set(index int, newObj PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter + Clear() PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter + clearHolderSlice() PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter + appendHolderSlice(item PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter +} + +func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) setMsg(msg *patternFlowIpv4TimeToLive) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4TimeToLiveMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) Items() []PatternFlowIpv4TimeToLiveMetricTag { + return obj.patternFlowIpv4TimeToLiveMetricTagSlice +} + +func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) Add() PatternFlowIpv4TimeToLiveMetricTag { + newObj := &otg.PatternFlowIpv4TimeToLiveMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4TimeToLiveMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4TimeToLiveMetricTagSlice = append(obj.patternFlowIpv4TimeToLiveMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) Append(items ...PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4TimeToLiveMetricTagSlice = append(obj.patternFlowIpv4TimeToLiveMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) Set(index int, newObj PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4TimeToLiveMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) Clear() PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4TimeToLiveMetricTag{} + obj.patternFlowIpv4TimeToLiveMetricTagSlice = []PatternFlowIpv4TimeToLiveMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) clearHolderSlice() PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { + if len(obj.patternFlowIpv4TimeToLiveMetricTagSlice) > 0 { + obj.patternFlowIpv4TimeToLiveMetricTagSlice = []PatternFlowIpv4TimeToLiveMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter) appendHolderSlice(item PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLivePatternFlowIpv4TimeToLiveMetricTagIter { + obj.patternFlowIpv4TimeToLiveMetricTagSlice = append(obj.patternFlowIpv4TimeToLiveMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4TimeToLive) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TimeToLive.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4TimeToLive.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4TimeToLiveMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4TimeToLive) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4TimeToLiveChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4TimeToLiveChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4TimeToLiveChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4TimeToLiveChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4TimeToLiveChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4TimeToLiveChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TimeToLive") + } + } else { + intVal := otg.PatternFlowIpv4TimeToLive_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4TimeToLive_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_time_to_live_counter.go b/gosnappi/pattern_flow_ipv4_time_to_live_counter.go new file mode 100644 index 00000000..333ab10f --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_time_to_live_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4TimeToLiveCounter ***** +type patternFlowIpv4TimeToLiveCounter struct { + validation + obj *otg.PatternFlowIpv4TimeToLiveCounter + marshaller marshalPatternFlowIpv4TimeToLiveCounter + unMarshaller unMarshalPatternFlowIpv4TimeToLiveCounter +} + +func NewPatternFlowIpv4TimeToLiveCounter() PatternFlowIpv4TimeToLiveCounter { + obj := patternFlowIpv4TimeToLiveCounter{obj: &otg.PatternFlowIpv4TimeToLiveCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TimeToLiveCounter) msg() *otg.PatternFlowIpv4TimeToLiveCounter { + return obj.obj +} + +func (obj *patternFlowIpv4TimeToLiveCounter) setMsg(msg *otg.PatternFlowIpv4TimeToLiveCounter) PatternFlowIpv4TimeToLiveCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TimeToLiveCounter struct { + obj *patternFlowIpv4TimeToLiveCounter +} + +type marshalPatternFlowIpv4TimeToLiveCounter interface { + // ToProto marshals PatternFlowIpv4TimeToLiveCounter to protobuf object *otg.PatternFlowIpv4TimeToLiveCounter + ToProto() (*otg.PatternFlowIpv4TimeToLiveCounter, error) + // ToPbText marshals PatternFlowIpv4TimeToLiveCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TimeToLiveCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TimeToLiveCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TimeToLiveCounter struct { + obj *patternFlowIpv4TimeToLiveCounter +} + +type unMarshalPatternFlowIpv4TimeToLiveCounter interface { + // FromProto unmarshals PatternFlowIpv4TimeToLiveCounter from protobuf object *otg.PatternFlowIpv4TimeToLiveCounter + FromProto(msg *otg.PatternFlowIpv4TimeToLiveCounter) (PatternFlowIpv4TimeToLiveCounter, error) + // FromPbText unmarshals PatternFlowIpv4TimeToLiveCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TimeToLiveCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TimeToLiveCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TimeToLiveCounter) Marshal() marshalPatternFlowIpv4TimeToLiveCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TimeToLiveCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TimeToLiveCounter) Unmarshal() unMarshalPatternFlowIpv4TimeToLiveCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TimeToLiveCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TimeToLiveCounter) ToProto() (*otg.PatternFlowIpv4TimeToLiveCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TimeToLiveCounter) FromProto(msg *otg.PatternFlowIpv4TimeToLiveCounter) (PatternFlowIpv4TimeToLiveCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TimeToLiveCounter) 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 *unMarshalpatternFlowIpv4TimeToLiveCounter) 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 *marshalpatternFlowIpv4TimeToLiveCounter) 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 *unMarshalpatternFlowIpv4TimeToLiveCounter) 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 *marshalpatternFlowIpv4TimeToLiveCounter) 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 *unMarshalpatternFlowIpv4TimeToLiveCounter) 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 *patternFlowIpv4TimeToLiveCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TimeToLiveCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TimeToLiveCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TimeToLiveCounter) Clone() (PatternFlowIpv4TimeToLiveCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TimeToLiveCounter() + 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 +} + +// PatternFlowIpv4TimeToLiveCounter is integer counter pattern +type PatternFlowIpv4TimeToLiveCounter interface { + Validation + // msg marshals PatternFlowIpv4TimeToLiveCounter to protobuf object *otg.PatternFlowIpv4TimeToLiveCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TimeToLiveCounter + // setMsg unmarshals PatternFlowIpv4TimeToLiveCounter from protobuf object *otg.PatternFlowIpv4TimeToLiveCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TimeToLiveCounter) PatternFlowIpv4TimeToLiveCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4TimeToLiveCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TimeToLiveCounter + // validate validates PatternFlowIpv4TimeToLiveCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TimeToLiveCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4TimeToLiveCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4TimeToLiveCounter + SetStart(value uint32) PatternFlowIpv4TimeToLiveCounter + // HasStart checks if Start has been set in PatternFlowIpv4TimeToLiveCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4TimeToLiveCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4TimeToLiveCounter + SetStep(value uint32) PatternFlowIpv4TimeToLiveCounter + // HasStep checks if Step has been set in PatternFlowIpv4TimeToLiveCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4TimeToLiveCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4TimeToLiveCounter + SetCount(value uint32) PatternFlowIpv4TimeToLiveCounter + // HasCount checks if Count has been set in PatternFlowIpv4TimeToLiveCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TimeToLiveCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TimeToLiveCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4TimeToLiveCounter object +func (obj *patternFlowIpv4TimeToLiveCounter) SetStart(value uint32) PatternFlowIpv4TimeToLiveCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TimeToLiveCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TimeToLiveCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4TimeToLiveCounter object +func (obj *patternFlowIpv4TimeToLiveCounter) SetStep(value uint32) PatternFlowIpv4TimeToLiveCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TimeToLiveCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TimeToLiveCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4TimeToLiveCounter object +func (obj *patternFlowIpv4TimeToLiveCounter) SetCount(value uint32) PatternFlowIpv4TimeToLiveCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4TimeToLiveCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TimeToLiveCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TimeToLiveCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TimeToLiveCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4TimeToLiveCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(64) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_time_to_live_metric_tag.go b/gosnappi/pattern_flow_ipv4_time_to_live_metric_tag.go new file mode 100644 index 00000000..6f6197f3 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_time_to_live_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4TimeToLiveMetricTag ***** +type patternFlowIpv4TimeToLiveMetricTag struct { + validation + obj *otg.PatternFlowIpv4TimeToLiveMetricTag + marshaller marshalPatternFlowIpv4TimeToLiveMetricTag + unMarshaller unMarshalPatternFlowIpv4TimeToLiveMetricTag +} + +func NewPatternFlowIpv4TimeToLiveMetricTag() PatternFlowIpv4TimeToLiveMetricTag { + obj := patternFlowIpv4TimeToLiveMetricTag{obj: &otg.PatternFlowIpv4TimeToLiveMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TimeToLiveMetricTag) msg() *otg.PatternFlowIpv4TimeToLiveMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4TimeToLiveMetricTag) setMsg(msg *otg.PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLiveMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TimeToLiveMetricTag struct { + obj *patternFlowIpv4TimeToLiveMetricTag +} + +type marshalPatternFlowIpv4TimeToLiveMetricTag interface { + // ToProto marshals PatternFlowIpv4TimeToLiveMetricTag to protobuf object *otg.PatternFlowIpv4TimeToLiveMetricTag + ToProto() (*otg.PatternFlowIpv4TimeToLiveMetricTag, error) + // ToPbText marshals PatternFlowIpv4TimeToLiveMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TimeToLiveMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TimeToLiveMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TimeToLiveMetricTag struct { + obj *patternFlowIpv4TimeToLiveMetricTag +} + +type unMarshalPatternFlowIpv4TimeToLiveMetricTag interface { + // FromProto unmarshals PatternFlowIpv4TimeToLiveMetricTag from protobuf object *otg.PatternFlowIpv4TimeToLiveMetricTag + FromProto(msg *otg.PatternFlowIpv4TimeToLiveMetricTag) (PatternFlowIpv4TimeToLiveMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4TimeToLiveMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TimeToLiveMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TimeToLiveMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TimeToLiveMetricTag) Marshal() marshalPatternFlowIpv4TimeToLiveMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TimeToLiveMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TimeToLiveMetricTag) Unmarshal() unMarshalPatternFlowIpv4TimeToLiveMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TimeToLiveMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TimeToLiveMetricTag) ToProto() (*otg.PatternFlowIpv4TimeToLiveMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TimeToLiveMetricTag) FromProto(msg *otg.PatternFlowIpv4TimeToLiveMetricTag) (PatternFlowIpv4TimeToLiveMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TimeToLiveMetricTag) 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 *unMarshalpatternFlowIpv4TimeToLiveMetricTag) 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 *marshalpatternFlowIpv4TimeToLiveMetricTag) 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 *unMarshalpatternFlowIpv4TimeToLiveMetricTag) 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 *marshalpatternFlowIpv4TimeToLiveMetricTag) 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 *unMarshalpatternFlowIpv4TimeToLiveMetricTag) 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 *patternFlowIpv4TimeToLiveMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TimeToLiveMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TimeToLiveMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TimeToLiveMetricTag) Clone() (PatternFlowIpv4TimeToLiveMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TimeToLiveMetricTag() + 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 +} + +// PatternFlowIpv4TimeToLiveMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4TimeToLiveMetricTag interface { + Validation + // msg marshals PatternFlowIpv4TimeToLiveMetricTag to protobuf object *otg.PatternFlowIpv4TimeToLiveMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TimeToLiveMetricTag + // setMsg unmarshals PatternFlowIpv4TimeToLiveMetricTag from protobuf object *otg.PatternFlowIpv4TimeToLiveMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TimeToLiveMetricTag) PatternFlowIpv4TimeToLiveMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4TimeToLiveMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TimeToLiveMetricTag + // validate validates PatternFlowIpv4TimeToLiveMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TimeToLiveMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4TimeToLiveMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4TimeToLiveMetricTag + SetName(value string) PatternFlowIpv4TimeToLiveMetricTag + // Offset returns uint32, set in PatternFlowIpv4TimeToLiveMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4TimeToLiveMetricTag + SetOffset(value uint32) PatternFlowIpv4TimeToLiveMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4TimeToLiveMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4TimeToLiveMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4TimeToLiveMetricTag + SetLength(value uint32) PatternFlowIpv4TimeToLiveMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4TimeToLiveMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4TimeToLiveMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4TimeToLiveMetricTag object +func (obj *patternFlowIpv4TimeToLiveMetricTag) SetName(value string) PatternFlowIpv4TimeToLiveMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TimeToLiveMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TimeToLiveMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4TimeToLiveMetricTag object +func (obj *patternFlowIpv4TimeToLiveMetricTag) SetOffset(value uint32) PatternFlowIpv4TimeToLiveMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TimeToLiveMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TimeToLiveMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4TimeToLiveMetricTag object +func (obj *patternFlowIpv4TimeToLiveMetricTag) SetLength(value uint32) PatternFlowIpv4TimeToLiveMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4TimeToLiveMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TimeToLiveMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TimeToLiveMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4TimeToLiveMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4TimeToLiveMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_delay.go b/gosnappi/pattern_flow_ipv4_tos_delay.go new file mode 100644 index 00000000..367c9f7d --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_delay.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4TosDelay ***** +type patternFlowIpv4TosDelay struct { + validation + obj *otg.PatternFlowIpv4TosDelay + marshaller marshalPatternFlowIpv4TosDelay + unMarshaller unMarshalPatternFlowIpv4TosDelay + incrementHolder PatternFlowIpv4TosDelayCounter + decrementHolder PatternFlowIpv4TosDelayCounter + metricTagsHolder PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter +} + +func NewPatternFlowIpv4TosDelay() PatternFlowIpv4TosDelay { + obj := patternFlowIpv4TosDelay{obj: &otg.PatternFlowIpv4TosDelay{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosDelay) msg() *otg.PatternFlowIpv4TosDelay { + return obj.obj +} + +func (obj *patternFlowIpv4TosDelay) setMsg(msg *otg.PatternFlowIpv4TosDelay) PatternFlowIpv4TosDelay { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosDelay struct { + obj *patternFlowIpv4TosDelay +} + +type marshalPatternFlowIpv4TosDelay interface { + // ToProto marshals PatternFlowIpv4TosDelay to protobuf object *otg.PatternFlowIpv4TosDelay + ToProto() (*otg.PatternFlowIpv4TosDelay, error) + // ToPbText marshals PatternFlowIpv4TosDelay to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosDelay to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosDelay to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosDelay struct { + obj *patternFlowIpv4TosDelay +} + +type unMarshalPatternFlowIpv4TosDelay interface { + // FromProto unmarshals PatternFlowIpv4TosDelay from protobuf object *otg.PatternFlowIpv4TosDelay + FromProto(msg *otg.PatternFlowIpv4TosDelay) (PatternFlowIpv4TosDelay, error) + // FromPbText unmarshals PatternFlowIpv4TosDelay from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosDelay from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosDelay from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosDelay) Marshal() marshalPatternFlowIpv4TosDelay { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosDelay{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosDelay) Unmarshal() unMarshalPatternFlowIpv4TosDelay { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosDelay{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosDelay) ToProto() (*otg.PatternFlowIpv4TosDelay, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosDelay) FromProto(msg *otg.PatternFlowIpv4TosDelay) (PatternFlowIpv4TosDelay, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosDelay) 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 *unMarshalpatternFlowIpv4TosDelay) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4TosDelay) 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 *unMarshalpatternFlowIpv4TosDelay) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4TosDelay) 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 *unMarshalpatternFlowIpv4TosDelay) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4TosDelay) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosDelay) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosDelay) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosDelay) Clone() (PatternFlowIpv4TosDelay, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosDelay() + 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 +} + +func (obj *patternFlowIpv4TosDelay) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4TosDelay is delay +type PatternFlowIpv4TosDelay interface { + Validation + // msg marshals PatternFlowIpv4TosDelay to protobuf object *otg.PatternFlowIpv4TosDelay + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosDelay + // setMsg unmarshals PatternFlowIpv4TosDelay from protobuf object *otg.PatternFlowIpv4TosDelay + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosDelay) PatternFlowIpv4TosDelay + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosDelay + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosDelay + // validate validates PatternFlowIpv4TosDelay + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosDelay, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4TosDelayChoiceEnum, set in PatternFlowIpv4TosDelay + Choice() PatternFlowIpv4TosDelayChoiceEnum + // setChoice assigns PatternFlowIpv4TosDelayChoiceEnum provided by user to PatternFlowIpv4TosDelay + setChoice(value PatternFlowIpv4TosDelayChoiceEnum) PatternFlowIpv4TosDelay + // HasChoice checks if Choice has been set in PatternFlowIpv4TosDelay + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4TosDelay. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4TosDelay + SetValue(value uint32) PatternFlowIpv4TosDelay + // HasValue checks if Value has been set in PatternFlowIpv4TosDelay + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4TosDelay. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4TosDelay + SetValues(value []uint32) PatternFlowIpv4TosDelay + // Increment returns PatternFlowIpv4TosDelayCounter, set in PatternFlowIpv4TosDelay. + // PatternFlowIpv4TosDelayCounter is integer counter pattern + Increment() PatternFlowIpv4TosDelayCounter + // SetIncrement assigns PatternFlowIpv4TosDelayCounter provided by user to PatternFlowIpv4TosDelay. + // PatternFlowIpv4TosDelayCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4TosDelayCounter) PatternFlowIpv4TosDelay + // HasIncrement checks if Increment has been set in PatternFlowIpv4TosDelay + HasIncrement() bool + // Decrement returns PatternFlowIpv4TosDelayCounter, set in PatternFlowIpv4TosDelay. + // PatternFlowIpv4TosDelayCounter is integer counter pattern + Decrement() PatternFlowIpv4TosDelayCounter + // SetDecrement assigns PatternFlowIpv4TosDelayCounter provided by user to PatternFlowIpv4TosDelay. + // PatternFlowIpv4TosDelayCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4TosDelayCounter) PatternFlowIpv4TosDelay + // HasDecrement checks if Decrement has been set in PatternFlowIpv4TosDelay + HasDecrement() bool + // MetricTags returns PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIterIter, set in PatternFlowIpv4TosDelay + MetricTags() PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter + setNil() +} + +type PatternFlowIpv4TosDelayChoiceEnum string + +// Enum of Choice on PatternFlowIpv4TosDelay +var PatternFlowIpv4TosDelayChoice = struct { + VALUE PatternFlowIpv4TosDelayChoiceEnum + VALUES PatternFlowIpv4TosDelayChoiceEnum + INCREMENT PatternFlowIpv4TosDelayChoiceEnum + DECREMENT PatternFlowIpv4TosDelayChoiceEnum +}{ + VALUE: PatternFlowIpv4TosDelayChoiceEnum("value"), + VALUES: PatternFlowIpv4TosDelayChoiceEnum("values"), + INCREMENT: PatternFlowIpv4TosDelayChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4TosDelayChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4TosDelay) Choice() PatternFlowIpv4TosDelayChoiceEnum { + return PatternFlowIpv4TosDelayChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4TosDelay) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4TosDelay) setChoice(value PatternFlowIpv4TosDelayChoiceEnum) PatternFlowIpv4TosDelay { + intValue, ok := otg.PatternFlowIpv4TosDelay_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4TosDelayChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4TosDelay_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4TosDelayChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4TosDelayChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4TosDelayChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4TosDelayCounter().msg() + } + + if value == PatternFlowIpv4TosDelayChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4TosDelayCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TosDelay) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4TosDelayChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TosDelay) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4TosDelay object +func (obj *patternFlowIpv4TosDelay) SetValue(value uint32) PatternFlowIpv4TosDelay { + obj.setChoice(PatternFlowIpv4TosDelayChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4TosDelay) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4TosDelay object +func (obj *patternFlowIpv4TosDelay) SetValues(value []uint32) PatternFlowIpv4TosDelay { + obj.setChoice(PatternFlowIpv4TosDelayChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4TosDelayCounter +func (obj *patternFlowIpv4TosDelay) Increment() PatternFlowIpv4TosDelayCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4TosDelayChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4TosDelayCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4TosDelayCounter +func (obj *patternFlowIpv4TosDelay) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4TosDelayCounter value in the PatternFlowIpv4TosDelay object +func (obj *patternFlowIpv4TosDelay) SetIncrement(value PatternFlowIpv4TosDelayCounter) PatternFlowIpv4TosDelay { + obj.setChoice(PatternFlowIpv4TosDelayChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TosDelayCounter +func (obj *patternFlowIpv4TosDelay) Decrement() PatternFlowIpv4TosDelayCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4TosDelayChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4TosDelayCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TosDelayCounter +func (obj *patternFlowIpv4TosDelay) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4TosDelayCounter value in the PatternFlowIpv4TosDelay object +func (obj *patternFlowIpv4TosDelay) SetDecrement(value PatternFlowIpv4TosDelayCounter) PatternFlowIpv4TosDelay { + obj.setChoice(PatternFlowIpv4TosDelayChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4TosDelayMetricTag +func (obj *patternFlowIpv4TosDelay) MetricTags() PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4TosDelayMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter struct { + obj *patternFlowIpv4TosDelay + patternFlowIpv4TosDelayMetricTagSlice []PatternFlowIpv4TosDelayMetricTag + fieldPtr *[]*otg.PatternFlowIpv4TosDelayMetricTag +} + +func newPatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter(ptr *[]*otg.PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { + return &patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter interface { + setMsg(*patternFlowIpv4TosDelay) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter + Items() []PatternFlowIpv4TosDelayMetricTag + Add() PatternFlowIpv4TosDelayMetricTag + Append(items ...PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter + Set(index int, newObj PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter + Clear() PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter + clearHolderSlice() PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter + appendHolderSlice(item PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter +} + +func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) setMsg(msg *patternFlowIpv4TosDelay) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4TosDelayMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) Items() []PatternFlowIpv4TosDelayMetricTag { + return obj.patternFlowIpv4TosDelayMetricTagSlice +} + +func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) Add() PatternFlowIpv4TosDelayMetricTag { + newObj := &otg.PatternFlowIpv4TosDelayMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4TosDelayMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4TosDelayMetricTagSlice = append(obj.patternFlowIpv4TosDelayMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) Append(items ...PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4TosDelayMetricTagSlice = append(obj.patternFlowIpv4TosDelayMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) Set(index int, newObj PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4TosDelayMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) Clear() PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4TosDelayMetricTag{} + obj.patternFlowIpv4TosDelayMetricTagSlice = []PatternFlowIpv4TosDelayMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) clearHolderSlice() PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { + if len(obj.patternFlowIpv4TosDelayMetricTagSlice) > 0 { + obj.patternFlowIpv4TosDelayMetricTagSlice = []PatternFlowIpv4TosDelayMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter) appendHolderSlice(item PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayPatternFlowIpv4TosDelayMetricTagIter { + obj.patternFlowIpv4TosDelayMetricTagSlice = append(obj.patternFlowIpv4TosDelayMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4TosDelay) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosDelay.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4TosDelay.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4TosDelayMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4TosDelay) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4TosDelayChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4TosDelayChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4TosDelayChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4TosDelayChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4TosDelayChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4TosDelayChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TosDelay") + } + } else { + intVal := otg.PatternFlowIpv4TosDelay_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4TosDelay_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_delay_counter.go b/gosnappi/pattern_flow_ipv4_tos_delay_counter.go new file mode 100644 index 00000000..8c4b5dfc --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_delay_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4TosDelayCounter ***** +type patternFlowIpv4TosDelayCounter struct { + validation + obj *otg.PatternFlowIpv4TosDelayCounter + marshaller marshalPatternFlowIpv4TosDelayCounter + unMarshaller unMarshalPatternFlowIpv4TosDelayCounter +} + +func NewPatternFlowIpv4TosDelayCounter() PatternFlowIpv4TosDelayCounter { + obj := patternFlowIpv4TosDelayCounter{obj: &otg.PatternFlowIpv4TosDelayCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosDelayCounter) msg() *otg.PatternFlowIpv4TosDelayCounter { + return obj.obj +} + +func (obj *patternFlowIpv4TosDelayCounter) setMsg(msg *otg.PatternFlowIpv4TosDelayCounter) PatternFlowIpv4TosDelayCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosDelayCounter struct { + obj *patternFlowIpv4TosDelayCounter +} + +type marshalPatternFlowIpv4TosDelayCounter interface { + // ToProto marshals PatternFlowIpv4TosDelayCounter to protobuf object *otg.PatternFlowIpv4TosDelayCounter + ToProto() (*otg.PatternFlowIpv4TosDelayCounter, error) + // ToPbText marshals PatternFlowIpv4TosDelayCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosDelayCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosDelayCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosDelayCounter struct { + obj *patternFlowIpv4TosDelayCounter +} + +type unMarshalPatternFlowIpv4TosDelayCounter interface { + // FromProto unmarshals PatternFlowIpv4TosDelayCounter from protobuf object *otg.PatternFlowIpv4TosDelayCounter + FromProto(msg *otg.PatternFlowIpv4TosDelayCounter) (PatternFlowIpv4TosDelayCounter, error) + // FromPbText unmarshals PatternFlowIpv4TosDelayCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosDelayCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosDelayCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosDelayCounter) Marshal() marshalPatternFlowIpv4TosDelayCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosDelayCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosDelayCounter) Unmarshal() unMarshalPatternFlowIpv4TosDelayCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosDelayCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosDelayCounter) ToProto() (*otg.PatternFlowIpv4TosDelayCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosDelayCounter) FromProto(msg *otg.PatternFlowIpv4TosDelayCounter) (PatternFlowIpv4TosDelayCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosDelayCounter) 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 *unMarshalpatternFlowIpv4TosDelayCounter) 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 *marshalpatternFlowIpv4TosDelayCounter) 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 *unMarshalpatternFlowIpv4TosDelayCounter) 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 *marshalpatternFlowIpv4TosDelayCounter) 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 *unMarshalpatternFlowIpv4TosDelayCounter) 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 *patternFlowIpv4TosDelayCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosDelayCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosDelayCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosDelayCounter) Clone() (PatternFlowIpv4TosDelayCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosDelayCounter() + 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 +} + +// PatternFlowIpv4TosDelayCounter is integer counter pattern +type PatternFlowIpv4TosDelayCounter interface { + Validation + // msg marshals PatternFlowIpv4TosDelayCounter to protobuf object *otg.PatternFlowIpv4TosDelayCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosDelayCounter + // setMsg unmarshals PatternFlowIpv4TosDelayCounter from protobuf object *otg.PatternFlowIpv4TosDelayCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosDelayCounter) PatternFlowIpv4TosDelayCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosDelayCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosDelayCounter + // validate validates PatternFlowIpv4TosDelayCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosDelayCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4TosDelayCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4TosDelayCounter + SetStart(value uint32) PatternFlowIpv4TosDelayCounter + // HasStart checks if Start has been set in PatternFlowIpv4TosDelayCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4TosDelayCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4TosDelayCounter + SetStep(value uint32) PatternFlowIpv4TosDelayCounter + // HasStep checks if Step has been set in PatternFlowIpv4TosDelayCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4TosDelayCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4TosDelayCounter + SetCount(value uint32) PatternFlowIpv4TosDelayCounter + // HasCount checks if Count has been set in PatternFlowIpv4TosDelayCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TosDelayCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TosDelayCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4TosDelayCounter object +func (obj *patternFlowIpv4TosDelayCounter) SetStart(value uint32) PatternFlowIpv4TosDelayCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TosDelayCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TosDelayCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4TosDelayCounter object +func (obj *patternFlowIpv4TosDelayCounter) SetStep(value uint32) PatternFlowIpv4TosDelayCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TosDelayCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TosDelayCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4TosDelayCounter object +func (obj *patternFlowIpv4TosDelayCounter) SetCount(value uint32) PatternFlowIpv4TosDelayCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4TosDelayCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosDelayCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosDelayCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosDelayCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4TosDelayCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_delay_metric_tag.go b/gosnappi/pattern_flow_ipv4_tos_delay_metric_tag.go new file mode 100644 index 00000000..31c9978a --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_delay_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4TosDelayMetricTag ***** +type patternFlowIpv4TosDelayMetricTag struct { + validation + obj *otg.PatternFlowIpv4TosDelayMetricTag + marshaller marshalPatternFlowIpv4TosDelayMetricTag + unMarshaller unMarshalPatternFlowIpv4TosDelayMetricTag +} + +func NewPatternFlowIpv4TosDelayMetricTag() PatternFlowIpv4TosDelayMetricTag { + obj := patternFlowIpv4TosDelayMetricTag{obj: &otg.PatternFlowIpv4TosDelayMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosDelayMetricTag) msg() *otg.PatternFlowIpv4TosDelayMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4TosDelayMetricTag) setMsg(msg *otg.PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosDelayMetricTag struct { + obj *patternFlowIpv4TosDelayMetricTag +} + +type marshalPatternFlowIpv4TosDelayMetricTag interface { + // ToProto marshals PatternFlowIpv4TosDelayMetricTag to protobuf object *otg.PatternFlowIpv4TosDelayMetricTag + ToProto() (*otg.PatternFlowIpv4TosDelayMetricTag, error) + // ToPbText marshals PatternFlowIpv4TosDelayMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosDelayMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosDelayMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosDelayMetricTag struct { + obj *patternFlowIpv4TosDelayMetricTag +} + +type unMarshalPatternFlowIpv4TosDelayMetricTag interface { + // FromProto unmarshals PatternFlowIpv4TosDelayMetricTag from protobuf object *otg.PatternFlowIpv4TosDelayMetricTag + FromProto(msg *otg.PatternFlowIpv4TosDelayMetricTag) (PatternFlowIpv4TosDelayMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4TosDelayMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosDelayMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosDelayMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosDelayMetricTag) Marshal() marshalPatternFlowIpv4TosDelayMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosDelayMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosDelayMetricTag) Unmarshal() unMarshalPatternFlowIpv4TosDelayMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosDelayMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosDelayMetricTag) ToProto() (*otg.PatternFlowIpv4TosDelayMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosDelayMetricTag) FromProto(msg *otg.PatternFlowIpv4TosDelayMetricTag) (PatternFlowIpv4TosDelayMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosDelayMetricTag) 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 *unMarshalpatternFlowIpv4TosDelayMetricTag) 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 *marshalpatternFlowIpv4TosDelayMetricTag) 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 *unMarshalpatternFlowIpv4TosDelayMetricTag) 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 *marshalpatternFlowIpv4TosDelayMetricTag) 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 *unMarshalpatternFlowIpv4TosDelayMetricTag) 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 *patternFlowIpv4TosDelayMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosDelayMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosDelayMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosDelayMetricTag) Clone() (PatternFlowIpv4TosDelayMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosDelayMetricTag() + 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 +} + +// PatternFlowIpv4TosDelayMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4TosDelayMetricTag interface { + Validation + // msg marshals PatternFlowIpv4TosDelayMetricTag to protobuf object *otg.PatternFlowIpv4TosDelayMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosDelayMetricTag + // setMsg unmarshals PatternFlowIpv4TosDelayMetricTag from protobuf object *otg.PatternFlowIpv4TosDelayMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosDelayMetricTag) PatternFlowIpv4TosDelayMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosDelayMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosDelayMetricTag + // validate validates PatternFlowIpv4TosDelayMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosDelayMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4TosDelayMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4TosDelayMetricTag + SetName(value string) PatternFlowIpv4TosDelayMetricTag + // Offset returns uint32, set in PatternFlowIpv4TosDelayMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4TosDelayMetricTag + SetOffset(value uint32) PatternFlowIpv4TosDelayMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4TosDelayMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4TosDelayMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4TosDelayMetricTag + SetLength(value uint32) PatternFlowIpv4TosDelayMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4TosDelayMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4TosDelayMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4TosDelayMetricTag object +func (obj *patternFlowIpv4TosDelayMetricTag) SetName(value string) PatternFlowIpv4TosDelayMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TosDelayMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TosDelayMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4TosDelayMetricTag object +func (obj *patternFlowIpv4TosDelayMetricTag) SetOffset(value uint32) PatternFlowIpv4TosDelayMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TosDelayMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TosDelayMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4TosDelayMetricTag object +func (obj *patternFlowIpv4TosDelayMetricTag) SetLength(value uint32) PatternFlowIpv4TosDelayMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4TosDelayMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TosDelayMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosDelayMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4TosDelayMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4TosDelayMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_monetary.go b/gosnappi/pattern_flow_ipv4_tos_monetary.go new file mode 100644 index 00000000..b11085b0 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_monetary.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4TosMonetary ***** +type patternFlowIpv4TosMonetary struct { + validation + obj *otg.PatternFlowIpv4TosMonetary + marshaller marshalPatternFlowIpv4TosMonetary + unMarshaller unMarshalPatternFlowIpv4TosMonetary + incrementHolder PatternFlowIpv4TosMonetaryCounter + decrementHolder PatternFlowIpv4TosMonetaryCounter + metricTagsHolder PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter +} + +func NewPatternFlowIpv4TosMonetary() PatternFlowIpv4TosMonetary { + obj := patternFlowIpv4TosMonetary{obj: &otg.PatternFlowIpv4TosMonetary{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosMonetary) msg() *otg.PatternFlowIpv4TosMonetary { + return obj.obj +} + +func (obj *patternFlowIpv4TosMonetary) setMsg(msg *otg.PatternFlowIpv4TosMonetary) PatternFlowIpv4TosMonetary { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosMonetary struct { + obj *patternFlowIpv4TosMonetary +} + +type marshalPatternFlowIpv4TosMonetary interface { + // ToProto marshals PatternFlowIpv4TosMonetary to protobuf object *otg.PatternFlowIpv4TosMonetary + ToProto() (*otg.PatternFlowIpv4TosMonetary, error) + // ToPbText marshals PatternFlowIpv4TosMonetary to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosMonetary to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosMonetary to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosMonetary struct { + obj *patternFlowIpv4TosMonetary +} + +type unMarshalPatternFlowIpv4TosMonetary interface { + // FromProto unmarshals PatternFlowIpv4TosMonetary from protobuf object *otg.PatternFlowIpv4TosMonetary + FromProto(msg *otg.PatternFlowIpv4TosMonetary) (PatternFlowIpv4TosMonetary, error) + // FromPbText unmarshals PatternFlowIpv4TosMonetary from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosMonetary from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosMonetary from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosMonetary) Marshal() marshalPatternFlowIpv4TosMonetary { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosMonetary{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosMonetary) Unmarshal() unMarshalPatternFlowIpv4TosMonetary { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosMonetary{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosMonetary) ToProto() (*otg.PatternFlowIpv4TosMonetary, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosMonetary) FromProto(msg *otg.PatternFlowIpv4TosMonetary) (PatternFlowIpv4TosMonetary, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosMonetary) 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 *unMarshalpatternFlowIpv4TosMonetary) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4TosMonetary) 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 *unMarshalpatternFlowIpv4TosMonetary) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4TosMonetary) 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 *unMarshalpatternFlowIpv4TosMonetary) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4TosMonetary) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosMonetary) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosMonetary) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosMonetary) Clone() (PatternFlowIpv4TosMonetary, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosMonetary() + 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 +} + +func (obj *patternFlowIpv4TosMonetary) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4TosMonetary is monetary +type PatternFlowIpv4TosMonetary interface { + Validation + // msg marshals PatternFlowIpv4TosMonetary to protobuf object *otg.PatternFlowIpv4TosMonetary + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosMonetary + // setMsg unmarshals PatternFlowIpv4TosMonetary from protobuf object *otg.PatternFlowIpv4TosMonetary + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosMonetary) PatternFlowIpv4TosMonetary + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosMonetary + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosMonetary + // validate validates PatternFlowIpv4TosMonetary + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosMonetary, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4TosMonetaryChoiceEnum, set in PatternFlowIpv4TosMonetary + Choice() PatternFlowIpv4TosMonetaryChoiceEnum + // setChoice assigns PatternFlowIpv4TosMonetaryChoiceEnum provided by user to PatternFlowIpv4TosMonetary + setChoice(value PatternFlowIpv4TosMonetaryChoiceEnum) PatternFlowIpv4TosMonetary + // HasChoice checks if Choice has been set in PatternFlowIpv4TosMonetary + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4TosMonetary. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4TosMonetary + SetValue(value uint32) PatternFlowIpv4TosMonetary + // HasValue checks if Value has been set in PatternFlowIpv4TosMonetary + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4TosMonetary. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4TosMonetary + SetValues(value []uint32) PatternFlowIpv4TosMonetary + // Increment returns PatternFlowIpv4TosMonetaryCounter, set in PatternFlowIpv4TosMonetary. + // PatternFlowIpv4TosMonetaryCounter is integer counter pattern + Increment() PatternFlowIpv4TosMonetaryCounter + // SetIncrement assigns PatternFlowIpv4TosMonetaryCounter provided by user to PatternFlowIpv4TosMonetary. + // PatternFlowIpv4TosMonetaryCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4TosMonetaryCounter) PatternFlowIpv4TosMonetary + // HasIncrement checks if Increment has been set in PatternFlowIpv4TosMonetary + HasIncrement() bool + // Decrement returns PatternFlowIpv4TosMonetaryCounter, set in PatternFlowIpv4TosMonetary. + // PatternFlowIpv4TosMonetaryCounter is integer counter pattern + Decrement() PatternFlowIpv4TosMonetaryCounter + // SetDecrement assigns PatternFlowIpv4TosMonetaryCounter provided by user to PatternFlowIpv4TosMonetary. + // PatternFlowIpv4TosMonetaryCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4TosMonetaryCounter) PatternFlowIpv4TosMonetary + // HasDecrement checks if Decrement has been set in PatternFlowIpv4TosMonetary + HasDecrement() bool + // MetricTags returns PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIterIter, set in PatternFlowIpv4TosMonetary + MetricTags() PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter + setNil() +} + +type PatternFlowIpv4TosMonetaryChoiceEnum string + +// Enum of Choice on PatternFlowIpv4TosMonetary +var PatternFlowIpv4TosMonetaryChoice = struct { + VALUE PatternFlowIpv4TosMonetaryChoiceEnum + VALUES PatternFlowIpv4TosMonetaryChoiceEnum + INCREMENT PatternFlowIpv4TosMonetaryChoiceEnum + DECREMENT PatternFlowIpv4TosMonetaryChoiceEnum +}{ + VALUE: PatternFlowIpv4TosMonetaryChoiceEnum("value"), + VALUES: PatternFlowIpv4TosMonetaryChoiceEnum("values"), + INCREMENT: PatternFlowIpv4TosMonetaryChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4TosMonetaryChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4TosMonetary) Choice() PatternFlowIpv4TosMonetaryChoiceEnum { + return PatternFlowIpv4TosMonetaryChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4TosMonetary) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4TosMonetary) setChoice(value PatternFlowIpv4TosMonetaryChoiceEnum) PatternFlowIpv4TosMonetary { + intValue, ok := otg.PatternFlowIpv4TosMonetary_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4TosMonetaryChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4TosMonetary_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4TosMonetaryChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4TosMonetaryChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4TosMonetaryChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4TosMonetaryCounter().msg() + } + + if value == PatternFlowIpv4TosMonetaryChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4TosMonetaryCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TosMonetary) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4TosMonetaryChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TosMonetary) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4TosMonetary object +func (obj *patternFlowIpv4TosMonetary) SetValue(value uint32) PatternFlowIpv4TosMonetary { + obj.setChoice(PatternFlowIpv4TosMonetaryChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4TosMonetary) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4TosMonetary object +func (obj *patternFlowIpv4TosMonetary) SetValues(value []uint32) PatternFlowIpv4TosMonetary { + obj.setChoice(PatternFlowIpv4TosMonetaryChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4TosMonetaryCounter +func (obj *patternFlowIpv4TosMonetary) Increment() PatternFlowIpv4TosMonetaryCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4TosMonetaryChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4TosMonetaryCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4TosMonetaryCounter +func (obj *patternFlowIpv4TosMonetary) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4TosMonetaryCounter value in the PatternFlowIpv4TosMonetary object +func (obj *patternFlowIpv4TosMonetary) SetIncrement(value PatternFlowIpv4TosMonetaryCounter) PatternFlowIpv4TosMonetary { + obj.setChoice(PatternFlowIpv4TosMonetaryChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TosMonetaryCounter +func (obj *patternFlowIpv4TosMonetary) Decrement() PatternFlowIpv4TosMonetaryCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4TosMonetaryChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4TosMonetaryCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TosMonetaryCounter +func (obj *patternFlowIpv4TosMonetary) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4TosMonetaryCounter value in the PatternFlowIpv4TosMonetary object +func (obj *patternFlowIpv4TosMonetary) SetDecrement(value PatternFlowIpv4TosMonetaryCounter) PatternFlowIpv4TosMonetary { + obj.setChoice(PatternFlowIpv4TosMonetaryChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4TosMonetaryMetricTag +func (obj *patternFlowIpv4TosMonetary) MetricTags() PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4TosMonetaryMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter struct { + obj *patternFlowIpv4TosMonetary + patternFlowIpv4TosMonetaryMetricTagSlice []PatternFlowIpv4TosMonetaryMetricTag + fieldPtr *[]*otg.PatternFlowIpv4TosMonetaryMetricTag +} + +func newPatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter(ptr *[]*otg.PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { + return &patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter interface { + setMsg(*patternFlowIpv4TosMonetary) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter + Items() []PatternFlowIpv4TosMonetaryMetricTag + Add() PatternFlowIpv4TosMonetaryMetricTag + Append(items ...PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter + Set(index int, newObj PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter + Clear() PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter + clearHolderSlice() PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter + appendHolderSlice(item PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter +} + +func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) setMsg(msg *patternFlowIpv4TosMonetary) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4TosMonetaryMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) Items() []PatternFlowIpv4TosMonetaryMetricTag { + return obj.patternFlowIpv4TosMonetaryMetricTagSlice +} + +func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) Add() PatternFlowIpv4TosMonetaryMetricTag { + newObj := &otg.PatternFlowIpv4TosMonetaryMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4TosMonetaryMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4TosMonetaryMetricTagSlice = append(obj.patternFlowIpv4TosMonetaryMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) Append(items ...PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4TosMonetaryMetricTagSlice = append(obj.patternFlowIpv4TosMonetaryMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) Set(index int, newObj PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4TosMonetaryMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) Clear() PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4TosMonetaryMetricTag{} + obj.patternFlowIpv4TosMonetaryMetricTagSlice = []PatternFlowIpv4TosMonetaryMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) clearHolderSlice() PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { + if len(obj.patternFlowIpv4TosMonetaryMetricTagSlice) > 0 { + obj.patternFlowIpv4TosMonetaryMetricTagSlice = []PatternFlowIpv4TosMonetaryMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter) appendHolderSlice(item PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryPatternFlowIpv4TosMonetaryMetricTagIter { + obj.patternFlowIpv4TosMonetaryMetricTagSlice = append(obj.patternFlowIpv4TosMonetaryMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4TosMonetary) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosMonetary.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4TosMonetary.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4TosMonetaryMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4TosMonetary) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4TosMonetaryChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4TosMonetaryChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4TosMonetaryChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4TosMonetaryChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4TosMonetaryChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4TosMonetaryChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TosMonetary") + } + } else { + intVal := otg.PatternFlowIpv4TosMonetary_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4TosMonetary_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_monetary_counter.go b/gosnappi/pattern_flow_ipv4_tos_monetary_counter.go new file mode 100644 index 00000000..72491de0 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_monetary_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4TosMonetaryCounter ***** +type patternFlowIpv4TosMonetaryCounter struct { + validation + obj *otg.PatternFlowIpv4TosMonetaryCounter + marshaller marshalPatternFlowIpv4TosMonetaryCounter + unMarshaller unMarshalPatternFlowIpv4TosMonetaryCounter +} + +func NewPatternFlowIpv4TosMonetaryCounter() PatternFlowIpv4TosMonetaryCounter { + obj := patternFlowIpv4TosMonetaryCounter{obj: &otg.PatternFlowIpv4TosMonetaryCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosMonetaryCounter) msg() *otg.PatternFlowIpv4TosMonetaryCounter { + return obj.obj +} + +func (obj *patternFlowIpv4TosMonetaryCounter) setMsg(msg *otg.PatternFlowIpv4TosMonetaryCounter) PatternFlowIpv4TosMonetaryCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosMonetaryCounter struct { + obj *patternFlowIpv4TosMonetaryCounter +} + +type marshalPatternFlowIpv4TosMonetaryCounter interface { + // ToProto marshals PatternFlowIpv4TosMonetaryCounter to protobuf object *otg.PatternFlowIpv4TosMonetaryCounter + ToProto() (*otg.PatternFlowIpv4TosMonetaryCounter, error) + // ToPbText marshals PatternFlowIpv4TosMonetaryCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosMonetaryCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosMonetaryCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosMonetaryCounter struct { + obj *patternFlowIpv4TosMonetaryCounter +} + +type unMarshalPatternFlowIpv4TosMonetaryCounter interface { + // FromProto unmarshals PatternFlowIpv4TosMonetaryCounter from protobuf object *otg.PatternFlowIpv4TosMonetaryCounter + FromProto(msg *otg.PatternFlowIpv4TosMonetaryCounter) (PatternFlowIpv4TosMonetaryCounter, error) + // FromPbText unmarshals PatternFlowIpv4TosMonetaryCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosMonetaryCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosMonetaryCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosMonetaryCounter) Marshal() marshalPatternFlowIpv4TosMonetaryCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosMonetaryCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosMonetaryCounter) Unmarshal() unMarshalPatternFlowIpv4TosMonetaryCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosMonetaryCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosMonetaryCounter) ToProto() (*otg.PatternFlowIpv4TosMonetaryCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosMonetaryCounter) FromProto(msg *otg.PatternFlowIpv4TosMonetaryCounter) (PatternFlowIpv4TosMonetaryCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosMonetaryCounter) 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 *unMarshalpatternFlowIpv4TosMonetaryCounter) 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 *marshalpatternFlowIpv4TosMonetaryCounter) 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 *unMarshalpatternFlowIpv4TosMonetaryCounter) 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 *marshalpatternFlowIpv4TosMonetaryCounter) 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 *unMarshalpatternFlowIpv4TosMonetaryCounter) 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 *patternFlowIpv4TosMonetaryCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosMonetaryCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosMonetaryCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosMonetaryCounter) Clone() (PatternFlowIpv4TosMonetaryCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosMonetaryCounter() + 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 +} + +// PatternFlowIpv4TosMonetaryCounter is integer counter pattern +type PatternFlowIpv4TosMonetaryCounter interface { + Validation + // msg marshals PatternFlowIpv4TosMonetaryCounter to protobuf object *otg.PatternFlowIpv4TosMonetaryCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosMonetaryCounter + // setMsg unmarshals PatternFlowIpv4TosMonetaryCounter from protobuf object *otg.PatternFlowIpv4TosMonetaryCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosMonetaryCounter) PatternFlowIpv4TosMonetaryCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosMonetaryCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosMonetaryCounter + // validate validates PatternFlowIpv4TosMonetaryCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosMonetaryCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4TosMonetaryCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4TosMonetaryCounter + SetStart(value uint32) PatternFlowIpv4TosMonetaryCounter + // HasStart checks if Start has been set in PatternFlowIpv4TosMonetaryCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4TosMonetaryCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4TosMonetaryCounter + SetStep(value uint32) PatternFlowIpv4TosMonetaryCounter + // HasStep checks if Step has been set in PatternFlowIpv4TosMonetaryCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4TosMonetaryCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4TosMonetaryCounter + SetCount(value uint32) PatternFlowIpv4TosMonetaryCounter + // HasCount checks if Count has been set in PatternFlowIpv4TosMonetaryCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TosMonetaryCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TosMonetaryCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4TosMonetaryCounter object +func (obj *patternFlowIpv4TosMonetaryCounter) SetStart(value uint32) PatternFlowIpv4TosMonetaryCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TosMonetaryCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TosMonetaryCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4TosMonetaryCounter object +func (obj *patternFlowIpv4TosMonetaryCounter) SetStep(value uint32) PatternFlowIpv4TosMonetaryCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TosMonetaryCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TosMonetaryCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4TosMonetaryCounter object +func (obj *patternFlowIpv4TosMonetaryCounter) SetCount(value uint32) PatternFlowIpv4TosMonetaryCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4TosMonetaryCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosMonetaryCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosMonetaryCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosMonetaryCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4TosMonetaryCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_monetary_metric_tag.go b/gosnappi/pattern_flow_ipv4_tos_monetary_metric_tag.go new file mode 100644 index 00000000..8386b365 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_monetary_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4TosMonetaryMetricTag ***** +type patternFlowIpv4TosMonetaryMetricTag struct { + validation + obj *otg.PatternFlowIpv4TosMonetaryMetricTag + marshaller marshalPatternFlowIpv4TosMonetaryMetricTag + unMarshaller unMarshalPatternFlowIpv4TosMonetaryMetricTag +} + +func NewPatternFlowIpv4TosMonetaryMetricTag() PatternFlowIpv4TosMonetaryMetricTag { + obj := patternFlowIpv4TosMonetaryMetricTag{obj: &otg.PatternFlowIpv4TosMonetaryMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosMonetaryMetricTag) msg() *otg.PatternFlowIpv4TosMonetaryMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4TosMonetaryMetricTag) setMsg(msg *otg.PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosMonetaryMetricTag struct { + obj *patternFlowIpv4TosMonetaryMetricTag +} + +type marshalPatternFlowIpv4TosMonetaryMetricTag interface { + // ToProto marshals PatternFlowIpv4TosMonetaryMetricTag to protobuf object *otg.PatternFlowIpv4TosMonetaryMetricTag + ToProto() (*otg.PatternFlowIpv4TosMonetaryMetricTag, error) + // ToPbText marshals PatternFlowIpv4TosMonetaryMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosMonetaryMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosMonetaryMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosMonetaryMetricTag struct { + obj *patternFlowIpv4TosMonetaryMetricTag +} + +type unMarshalPatternFlowIpv4TosMonetaryMetricTag interface { + // FromProto unmarshals PatternFlowIpv4TosMonetaryMetricTag from protobuf object *otg.PatternFlowIpv4TosMonetaryMetricTag + FromProto(msg *otg.PatternFlowIpv4TosMonetaryMetricTag) (PatternFlowIpv4TosMonetaryMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4TosMonetaryMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosMonetaryMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosMonetaryMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosMonetaryMetricTag) Marshal() marshalPatternFlowIpv4TosMonetaryMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosMonetaryMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosMonetaryMetricTag) Unmarshal() unMarshalPatternFlowIpv4TosMonetaryMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosMonetaryMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosMonetaryMetricTag) ToProto() (*otg.PatternFlowIpv4TosMonetaryMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosMonetaryMetricTag) FromProto(msg *otg.PatternFlowIpv4TosMonetaryMetricTag) (PatternFlowIpv4TosMonetaryMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosMonetaryMetricTag) 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 *unMarshalpatternFlowIpv4TosMonetaryMetricTag) 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 *marshalpatternFlowIpv4TosMonetaryMetricTag) 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 *unMarshalpatternFlowIpv4TosMonetaryMetricTag) 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 *marshalpatternFlowIpv4TosMonetaryMetricTag) 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 *unMarshalpatternFlowIpv4TosMonetaryMetricTag) 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 *patternFlowIpv4TosMonetaryMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosMonetaryMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosMonetaryMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosMonetaryMetricTag) Clone() (PatternFlowIpv4TosMonetaryMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosMonetaryMetricTag() + 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 +} + +// PatternFlowIpv4TosMonetaryMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4TosMonetaryMetricTag interface { + Validation + // msg marshals PatternFlowIpv4TosMonetaryMetricTag to protobuf object *otg.PatternFlowIpv4TosMonetaryMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosMonetaryMetricTag + // setMsg unmarshals PatternFlowIpv4TosMonetaryMetricTag from protobuf object *otg.PatternFlowIpv4TosMonetaryMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosMonetaryMetricTag) PatternFlowIpv4TosMonetaryMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosMonetaryMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosMonetaryMetricTag + // validate validates PatternFlowIpv4TosMonetaryMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosMonetaryMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4TosMonetaryMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4TosMonetaryMetricTag + SetName(value string) PatternFlowIpv4TosMonetaryMetricTag + // Offset returns uint32, set in PatternFlowIpv4TosMonetaryMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4TosMonetaryMetricTag + SetOffset(value uint32) PatternFlowIpv4TosMonetaryMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4TosMonetaryMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4TosMonetaryMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4TosMonetaryMetricTag + SetLength(value uint32) PatternFlowIpv4TosMonetaryMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4TosMonetaryMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4TosMonetaryMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4TosMonetaryMetricTag object +func (obj *patternFlowIpv4TosMonetaryMetricTag) SetName(value string) PatternFlowIpv4TosMonetaryMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TosMonetaryMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TosMonetaryMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4TosMonetaryMetricTag object +func (obj *patternFlowIpv4TosMonetaryMetricTag) SetOffset(value uint32) PatternFlowIpv4TosMonetaryMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TosMonetaryMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TosMonetaryMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4TosMonetaryMetricTag object +func (obj *patternFlowIpv4TosMonetaryMetricTag) SetLength(value uint32) PatternFlowIpv4TosMonetaryMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4TosMonetaryMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TosMonetaryMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosMonetaryMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4TosMonetaryMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4TosMonetaryMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_precedence.go b/gosnappi/pattern_flow_ipv4_tos_precedence.go new file mode 100644 index 00000000..ce53dff6 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_precedence.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4TosPrecedence ***** +type patternFlowIpv4TosPrecedence struct { + validation + obj *otg.PatternFlowIpv4TosPrecedence + marshaller marshalPatternFlowIpv4TosPrecedence + unMarshaller unMarshalPatternFlowIpv4TosPrecedence + incrementHolder PatternFlowIpv4TosPrecedenceCounter + decrementHolder PatternFlowIpv4TosPrecedenceCounter + metricTagsHolder PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter +} + +func NewPatternFlowIpv4TosPrecedence() PatternFlowIpv4TosPrecedence { + obj := patternFlowIpv4TosPrecedence{obj: &otg.PatternFlowIpv4TosPrecedence{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosPrecedence) msg() *otg.PatternFlowIpv4TosPrecedence { + return obj.obj +} + +func (obj *patternFlowIpv4TosPrecedence) setMsg(msg *otg.PatternFlowIpv4TosPrecedence) PatternFlowIpv4TosPrecedence { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosPrecedence struct { + obj *patternFlowIpv4TosPrecedence +} + +type marshalPatternFlowIpv4TosPrecedence interface { + // ToProto marshals PatternFlowIpv4TosPrecedence to protobuf object *otg.PatternFlowIpv4TosPrecedence + ToProto() (*otg.PatternFlowIpv4TosPrecedence, error) + // ToPbText marshals PatternFlowIpv4TosPrecedence to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosPrecedence to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosPrecedence to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosPrecedence struct { + obj *patternFlowIpv4TosPrecedence +} + +type unMarshalPatternFlowIpv4TosPrecedence interface { + // FromProto unmarshals PatternFlowIpv4TosPrecedence from protobuf object *otg.PatternFlowIpv4TosPrecedence + FromProto(msg *otg.PatternFlowIpv4TosPrecedence) (PatternFlowIpv4TosPrecedence, error) + // FromPbText unmarshals PatternFlowIpv4TosPrecedence from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosPrecedence from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosPrecedence from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosPrecedence) Marshal() marshalPatternFlowIpv4TosPrecedence { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosPrecedence{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosPrecedence) Unmarshal() unMarshalPatternFlowIpv4TosPrecedence { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosPrecedence{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosPrecedence) ToProto() (*otg.PatternFlowIpv4TosPrecedence, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosPrecedence) FromProto(msg *otg.PatternFlowIpv4TosPrecedence) (PatternFlowIpv4TosPrecedence, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosPrecedence) 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 *unMarshalpatternFlowIpv4TosPrecedence) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4TosPrecedence) 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 *unMarshalpatternFlowIpv4TosPrecedence) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4TosPrecedence) 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 *unMarshalpatternFlowIpv4TosPrecedence) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4TosPrecedence) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosPrecedence) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosPrecedence) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosPrecedence) Clone() (PatternFlowIpv4TosPrecedence, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosPrecedence() + 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 +} + +func (obj *patternFlowIpv4TosPrecedence) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4TosPrecedence is precedence +type PatternFlowIpv4TosPrecedence interface { + Validation + // msg marshals PatternFlowIpv4TosPrecedence to protobuf object *otg.PatternFlowIpv4TosPrecedence + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosPrecedence + // setMsg unmarshals PatternFlowIpv4TosPrecedence from protobuf object *otg.PatternFlowIpv4TosPrecedence + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosPrecedence) PatternFlowIpv4TosPrecedence + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosPrecedence + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosPrecedence + // validate validates PatternFlowIpv4TosPrecedence + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosPrecedence, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4TosPrecedenceChoiceEnum, set in PatternFlowIpv4TosPrecedence + Choice() PatternFlowIpv4TosPrecedenceChoiceEnum + // setChoice assigns PatternFlowIpv4TosPrecedenceChoiceEnum provided by user to PatternFlowIpv4TosPrecedence + setChoice(value PatternFlowIpv4TosPrecedenceChoiceEnum) PatternFlowIpv4TosPrecedence + // HasChoice checks if Choice has been set in PatternFlowIpv4TosPrecedence + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4TosPrecedence. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4TosPrecedence + SetValue(value uint32) PatternFlowIpv4TosPrecedence + // HasValue checks if Value has been set in PatternFlowIpv4TosPrecedence + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4TosPrecedence. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4TosPrecedence + SetValues(value []uint32) PatternFlowIpv4TosPrecedence + // Increment returns PatternFlowIpv4TosPrecedenceCounter, set in PatternFlowIpv4TosPrecedence. + // PatternFlowIpv4TosPrecedenceCounter is integer counter pattern + Increment() PatternFlowIpv4TosPrecedenceCounter + // SetIncrement assigns PatternFlowIpv4TosPrecedenceCounter provided by user to PatternFlowIpv4TosPrecedence. + // PatternFlowIpv4TosPrecedenceCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4TosPrecedenceCounter) PatternFlowIpv4TosPrecedence + // HasIncrement checks if Increment has been set in PatternFlowIpv4TosPrecedence + HasIncrement() bool + // Decrement returns PatternFlowIpv4TosPrecedenceCounter, set in PatternFlowIpv4TosPrecedence. + // PatternFlowIpv4TosPrecedenceCounter is integer counter pattern + Decrement() PatternFlowIpv4TosPrecedenceCounter + // SetDecrement assigns PatternFlowIpv4TosPrecedenceCounter provided by user to PatternFlowIpv4TosPrecedence. + // PatternFlowIpv4TosPrecedenceCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4TosPrecedenceCounter) PatternFlowIpv4TosPrecedence + // HasDecrement checks if Decrement has been set in PatternFlowIpv4TosPrecedence + HasDecrement() bool + // MetricTags returns PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIterIter, set in PatternFlowIpv4TosPrecedence + MetricTags() PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter + setNil() +} + +type PatternFlowIpv4TosPrecedenceChoiceEnum string + +// Enum of Choice on PatternFlowIpv4TosPrecedence +var PatternFlowIpv4TosPrecedenceChoice = struct { + VALUE PatternFlowIpv4TosPrecedenceChoiceEnum + VALUES PatternFlowIpv4TosPrecedenceChoiceEnum + INCREMENT PatternFlowIpv4TosPrecedenceChoiceEnum + DECREMENT PatternFlowIpv4TosPrecedenceChoiceEnum +}{ + VALUE: PatternFlowIpv4TosPrecedenceChoiceEnum("value"), + VALUES: PatternFlowIpv4TosPrecedenceChoiceEnum("values"), + INCREMENT: PatternFlowIpv4TosPrecedenceChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4TosPrecedenceChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4TosPrecedence) Choice() PatternFlowIpv4TosPrecedenceChoiceEnum { + return PatternFlowIpv4TosPrecedenceChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4TosPrecedence) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4TosPrecedence) setChoice(value PatternFlowIpv4TosPrecedenceChoiceEnum) PatternFlowIpv4TosPrecedence { + intValue, ok := otg.PatternFlowIpv4TosPrecedence_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4TosPrecedenceChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4TosPrecedence_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4TosPrecedenceChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4TosPrecedenceChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4TosPrecedenceChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4TosPrecedenceCounter().msg() + } + + if value == PatternFlowIpv4TosPrecedenceChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4TosPrecedenceCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TosPrecedence) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TosPrecedence) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4TosPrecedence object +func (obj *patternFlowIpv4TosPrecedence) SetValue(value uint32) PatternFlowIpv4TosPrecedence { + obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4TosPrecedence) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4TosPrecedence object +func (obj *patternFlowIpv4TosPrecedence) SetValues(value []uint32) PatternFlowIpv4TosPrecedence { + obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4TosPrecedenceCounter +func (obj *patternFlowIpv4TosPrecedence) Increment() PatternFlowIpv4TosPrecedenceCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4TosPrecedenceCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4TosPrecedenceCounter +func (obj *patternFlowIpv4TosPrecedence) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4TosPrecedenceCounter value in the PatternFlowIpv4TosPrecedence object +func (obj *patternFlowIpv4TosPrecedence) SetIncrement(value PatternFlowIpv4TosPrecedenceCounter) PatternFlowIpv4TosPrecedence { + obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TosPrecedenceCounter +func (obj *patternFlowIpv4TosPrecedence) Decrement() PatternFlowIpv4TosPrecedenceCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4TosPrecedenceCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TosPrecedenceCounter +func (obj *patternFlowIpv4TosPrecedence) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4TosPrecedenceCounter value in the PatternFlowIpv4TosPrecedence object +func (obj *patternFlowIpv4TosPrecedence) SetDecrement(value PatternFlowIpv4TosPrecedenceCounter) PatternFlowIpv4TosPrecedence { + obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4TosPrecedenceMetricTag +func (obj *patternFlowIpv4TosPrecedence) MetricTags() PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4TosPrecedenceMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter struct { + obj *patternFlowIpv4TosPrecedence + patternFlowIpv4TosPrecedenceMetricTagSlice []PatternFlowIpv4TosPrecedenceMetricTag + fieldPtr *[]*otg.PatternFlowIpv4TosPrecedenceMetricTag +} + +func newPatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter(ptr *[]*otg.PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { + return &patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter interface { + setMsg(*patternFlowIpv4TosPrecedence) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter + Items() []PatternFlowIpv4TosPrecedenceMetricTag + Add() PatternFlowIpv4TosPrecedenceMetricTag + Append(items ...PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter + Set(index int, newObj PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter + Clear() PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter + clearHolderSlice() PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter + appendHolderSlice(item PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter +} + +func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) setMsg(msg *patternFlowIpv4TosPrecedence) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4TosPrecedenceMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) Items() []PatternFlowIpv4TosPrecedenceMetricTag { + return obj.patternFlowIpv4TosPrecedenceMetricTagSlice +} + +func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) Add() PatternFlowIpv4TosPrecedenceMetricTag { + newObj := &otg.PatternFlowIpv4TosPrecedenceMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4TosPrecedenceMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4TosPrecedenceMetricTagSlice = append(obj.patternFlowIpv4TosPrecedenceMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) Append(items ...PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4TosPrecedenceMetricTagSlice = append(obj.patternFlowIpv4TosPrecedenceMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) Set(index int, newObj PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4TosPrecedenceMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) Clear() PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4TosPrecedenceMetricTag{} + obj.patternFlowIpv4TosPrecedenceMetricTagSlice = []PatternFlowIpv4TosPrecedenceMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) clearHolderSlice() PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { + if len(obj.patternFlowIpv4TosPrecedenceMetricTagSlice) > 0 { + obj.patternFlowIpv4TosPrecedenceMetricTagSlice = []PatternFlowIpv4TosPrecedenceMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter) appendHolderSlice(item PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedencePatternFlowIpv4TosPrecedenceMetricTagIter { + obj.patternFlowIpv4TosPrecedenceMetricTagSlice = append(obj.patternFlowIpv4TosPrecedenceMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4TosPrecedence) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosPrecedence.Value <= 7 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4TosPrecedence.Values <= 7 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4TosPrecedenceMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4TosPrecedence) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4TosPrecedenceChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4TosPrecedenceChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4TosPrecedenceChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4TosPrecedenceChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4TosPrecedenceChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4TosPrecedenceChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TosPrecedence") + } + } else { + intVal := otg.PatternFlowIpv4TosPrecedence_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4TosPrecedence_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_precedence_counter.go b/gosnappi/pattern_flow_ipv4_tos_precedence_counter.go new file mode 100644 index 00000000..e0c2482f --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_precedence_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4TosPrecedenceCounter ***** +type patternFlowIpv4TosPrecedenceCounter struct { + validation + obj *otg.PatternFlowIpv4TosPrecedenceCounter + marshaller marshalPatternFlowIpv4TosPrecedenceCounter + unMarshaller unMarshalPatternFlowIpv4TosPrecedenceCounter +} + +func NewPatternFlowIpv4TosPrecedenceCounter() PatternFlowIpv4TosPrecedenceCounter { + obj := patternFlowIpv4TosPrecedenceCounter{obj: &otg.PatternFlowIpv4TosPrecedenceCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosPrecedenceCounter) msg() *otg.PatternFlowIpv4TosPrecedenceCounter { + return obj.obj +} + +func (obj *patternFlowIpv4TosPrecedenceCounter) setMsg(msg *otg.PatternFlowIpv4TosPrecedenceCounter) PatternFlowIpv4TosPrecedenceCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosPrecedenceCounter struct { + obj *patternFlowIpv4TosPrecedenceCounter +} + +type marshalPatternFlowIpv4TosPrecedenceCounter interface { + // ToProto marshals PatternFlowIpv4TosPrecedenceCounter to protobuf object *otg.PatternFlowIpv4TosPrecedenceCounter + ToProto() (*otg.PatternFlowIpv4TosPrecedenceCounter, error) + // ToPbText marshals PatternFlowIpv4TosPrecedenceCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosPrecedenceCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosPrecedenceCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosPrecedenceCounter struct { + obj *patternFlowIpv4TosPrecedenceCounter +} + +type unMarshalPatternFlowIpv4TosPrecedenceCounter interface { + // FromProto unmarshals PatternFlowIpv4TosPrecedenceCounter from protobuf object *otg.PatternFlowIpv4TosPrecedenceCounter + FromProto(msg *otg.PatternFlowIpv4TosPrecedenceCounter) (PatternFlowIpv4TosPrecedenceCounter, error) + // FromPbText unmarshals PatternFlowIpv4TosPrecedenceCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosPrecedenceCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosPrecedenceCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosPrecedenceCounter) Marshal() marshalPatternFlowIpv4TosPrecedenceCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosPrecedenceCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosPrecedenceCounter) Unmarshal() unMarshalPatternFlowIpv4TosPrecedenceCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosPrecedenceCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosPrecedenceCounter) ToProto() (*otg.PatternFlowIpv4TosPrecedenceCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosPrecedenceCounter) FromProto(msg *otg.PatternFlowIpv4TosPrecedenceCounter) (PatternFlowIpv4TosPrecedenceCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosPrecedenceCounter) 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 *unMarshalpatternFlowIpv4TosPrecedenceCounter) 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 *marshalpatternFlowIpv4TosPrecedenceCounter) 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 *unMarshalpatternFlowIpv4TosPrecedenceCounter) 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 *marshalpatternFlowIpv4TosPrecedenceCounter) 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 *unMarshalpatternFlowIpv4TosPrecedenceCounter) 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 *patternFlowIpv4TosPrecedenceCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosPrecedenceCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosPrecedenceCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosPrecedenceCounter) Clone() (PatternFlowIpv4TosPrecedenceCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosPrecedenceCounter() + 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 +} + +// PatternFlowIpv4TosPrecedenceCounter is integer counter pattern +type PatternFlowIpv4TosPrecedenceCounter interface { + Validation + // msg marshals PatternFlowIpv4TosPrecedenceCounter to protobuf object *otg.PatternFlowIpv4TosPrecedenceCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosPrecedenceCounter + // setMsg unmarshals PatternFlowIpv4TosPrecedenceCounter from protobuf object *otg.PatternFlowIpv4TosPrecedenceCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosPrecedenceCounter) PatternFlowIpv4TosPrecedenceCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosPrecedenceCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosPrecedenceCounter + // validate validates PatternFlowIpv4TosPrecedenceCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosPrecedenceCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4TosPrecedenceCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4TosPrecedenceCounter + SetStart(value uint32) PatternFlowIpv4TosPrecedenceCounter + // HasStart checks if Start has been set in PatternFlowIpv4TosPrecedenceCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4TosPrecedenceCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4TosPrecedenceCounter + SetStep(value uint32) PatternFlowIpv4TosPrecedenceCounter + // HasStep checks if Step has been set in PatternFlowIpv4TosPrecedenceCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4TosPrecedenceCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4TosPrecedenceCounter + SetCount(value uint32) PatternFlowIpv4TosPrecedenceCounter + // HasCount checks if Count has been set in PatternFlowIpv4TosPrecedenceCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TosPrecedenceCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TosPrecedenceCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4TosPrecedenceCounter object +func (obj *patternFlowIpv4TosPrecedenceCounter) SetStart(value uint32) PatternFlowIpv4TosPrecedenceCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TosPrecedenceCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TosPrecedenceCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4TosPrecedenceCounter object +func (obj *patternFlowIpv4TosPrecedenceCounter) SetStep(value uint32) PatternFlowIpv4TosPrecedenceCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TosPrecedenceCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TosPrecedenceCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4TosPrecedenceCounter object +func (obj *patternFlowIpv4TosPrecedenceCounter) SetCount(value uint32) PatternFlowIpv4TosPrecedenceCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4TosPrecedenceCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosPrecedenceCounter.Start <= 7 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosPrecedenceCounter.Step <= 7 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosPrecedenceCounter.Count <= 7 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4TosPrecedenceCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_precedence_metric_tag.go b/gosnappi/pattern_flow_ipv4_tos_precedence_metric_tag.go new file mode 100644 index 00000000..549d462d --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_precedence_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4TosPrecedenceMetricTag ***** +type patternFlowIpv4TosPrecedenceMetricTag struct { + validation + obj *otg.PatternFlowIpv4TosPrecedenceMetricTag + marshaller marshalPatternFlowIpv4TosPrecedenceMetricTag + unMarshaller unMarshalPatternFlowIpv4TosPrecedenceMetricTag +} + +func NewPatternFlowIpv4TosPrecedenceMetricTag() PatternFlowIpv4TosPrecedenceMetricTag { + obj := patternFlowIpv4TosPrecedenceMetricTag{obj: &otg.PatternFlowIpv4TosPrecedenceMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosPrecedenceMetricTag) msg() *otg.PatternFlowIpv4TosPrecedenceMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4TosPrecedenceMetricTag) setMsg(msg *otg.PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedenceMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosPrecedenceMetricTag struct { + obj *patternFlowIpv4TosPrecedenceMetricTag +} + +type marshalPatternFlowIpv4TosPrecedenceMetricTag interface { + // ToProto marshals PatternFlowIpv4TosPrecedenceMetricTag to protobuf object *otg.PatternFlowIpv4TosPrecedenceMetricTag + ToProto() (*otg.PatternFlowIpv4TosPrecedenceMetricTag, error) + // ToPbText marshals PatternFlowIpv4TosPrecedenceMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosPrecedenceMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosPrecedenceMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosPrecedenceMetricTag struct { + obj *patternFlowIpv4TosPrecedenceMetricTag +} + +type unMarshalPatternFlowIpv4TosPrecedenceMetricTag interface { + // FromProto unmarshals PatternFlowIpv4TosPrecedenceMetricTag from protobuf object *otg.PatternFlowIpv4TosPrecedenceMetricTag + FromProto(msg *otg.PatternFlowIpv4TosPrecedenceMetricTag) (PatternFlowIpv4TosPrecedenceMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4TosPrecedenceMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosPrecedenceMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosPrecedenceMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosPrecedenceMetricTag) Marshal() marshalPatternFlowIpv4TosPrecedenceMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosPrecedenceMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosPrecedenceMetricTag) Unmarshal() unMarshalPatternFlowIpv4TosPrecedenceMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosPrecedenceMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosPrecedenceMetricTag) ToProto() (*otg.PatternFlowIpv4TosPrecedenceMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosPrecedenceMetricTag) FromProto(msg *otg.PatternFlowIpv4TosPrecedenceMetricTag) (PatternFlowIpv4TosPrecedenceMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosPrecedenceMetricTag) 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 *unMarshalpatternFlowIpv4TosPrecedenceMetricTag) 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 *marshalpatternFlowIpv4TosPrecedenceMetricTag) 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 *unMarshalpatternFlowIpv4TosPrecedenceMetricTag) 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 *marshalpatternFlowIpv4TosPrecedenceMetricTag) 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 *unMarshalpatternFlowIpv4TosPrecedenceMetricTag) 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 *patternFlowIpv4TosPrecedenceMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosPrecedenceMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosPrecedenceMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosPrecedenceMetricTag) Clone() (PatternFlowIpv4TosPrecedenceMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosPrecedenceMetricTag() + 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 +} + +// PatternFlowIpv4TosPrecedenceMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4TosPrecedenceMetricTag interface { + Validation + // msg marshals PatternFlowIpv4TosPrecedenceMetricTag to protobuf object *otg.PatternFlowIpv4TosPrecedenceMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosPrecedenceMetricTag + // setMsg unmarshals PatternFlowIpv4TosPrecedenceMetricTag from protobuf object *otg.PatternFlowIpv4TosPrecedenceMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosPrecedenceMetricTag) PatternFlowIpv4TosPrecedenceMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosPrecedenceMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosPrecedenceMetricTag + // validate validates PatternFlowIpv4TosPrecedenceMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosPrecedenceMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4TosPrecedenceMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4TosPrecedenceMetricTag + SetName(value string) PatternFlowIpv4TosPrecedenceMetricTag + // Offset returns uint32, set in PatternFlowIpv4TosPrecedenceMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4TosPrecedenceMetricTag + SetOffset(value uint32) PatternFlowIpv4TosPrecedenceMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4TosPrecedenceMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4TosPrecedenceMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4TosPrecedenceMetricTag + SetLength(value uint32) PatternFlowIpv4TosPrecedenceMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4TosPrecedenceMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4TosPrecedenceMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4TosPrecedenceMetricTag object +func (obj *patternFlowIpv4TosPrecedenceMetricTag) SetName(value string) PatternFlowIpv4TosPrecedenceMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TosPrecedenceMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TosPrecedenceMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4TosPrecedenceMetricTag object +func (obj *patternFlowIpv4TosPrecedenceMetricTag) SetOffset(value uint32) PatternFlowIpv4TosPrecedenceMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TosPrecedenceMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TosPrecedenceMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4TosPrecedenceMetricTag object +func (obj *patternFlowIpv4TosPrecedenceMetricTag) SetLength(value uint32) PatternFlowIpv4TosPrecedenceMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4TosPrecedenceMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TosPrecedenceMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 2 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosPrecedenceMetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4TosPrecedenceMetricTag.Length <= 3 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4TosPrecedenceMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(3) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_reliability.go b/gosnappi/pattern_flow_ipv4_tos_reliability.go new file mode 100644 index 00000000..6bb0cd28 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_reliability.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4TosReliability ***** +type patternFlowIpv4TosReliability struct { + validation + obj *otg.PatternFlowIpv4TosReliability + marshaller marshalPatternFlowIpv4TosReliability + unMarshaller unMarshalPatternFlowIpv4TosReliability + incrementHolder PatternFlowIpv4TosReliabilityCounter + decrementHolder PatternFlowIpv4TosReliabilityCounter + metricTagsHolder PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter +} + +func NewPatternFlowIpv4TosReliability() PatternFlowIpv4TosReliability { + obj := patternFlowIpv4TosReliability{obj: &otg.PatternFlowIpv4TosReliability{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosReliability) msg() *otg.PatternFlowIpv4TosReliability { + return obj.obj +} + +func (obj *patternFlowIpv4TosReliability) setMsg(msg *otg.PatternFlowIpv4TosReliability) PatternFlowIpv4TosReliability { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosReliability struct { + obj *patternFlowIpv4TosReliability +} + +type marshalPatternFlowIpv4TosReliability interface { + // ToProto marshals PatternFlowIpv4TosReliability to protobuf object *otg.PatternFlowIpv4TosReliability + ToProto() (*otg.PatternFlowIpv4TosReliability, error) + // ToPbText marshals PatternFlowIpv4TosReliability to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosReliability to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosReliability to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosReliability struct { + obj *patternFlowIpv4TosReliability +} + +type unMarshalPatternFlowIpv4TosReliability interface { + // FromProto unmarshals PatternFlowIpv4TosReliability from protobuf object *otg.PatternFlowIpv4TosReliability + FromProto(msg *otg.PatternFlowIpv4TosReliability) (PatternFlowIpv4TosReliability, error) + // FromPbText unmarshals PatternFlowIpv4TosReliability from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosReliability from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosReliability from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosReliability) Marshal() marshalPatternFlowIpv4TosReliability { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosReliability{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosReliability) Unmarshal() unMarshalPatternFlowIpv4TosReliability { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosReliability{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosReliability) ToProto() (*otg.PatternFlowIpv4TosReliability, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosReliability) FromProto(msg *otg.PatternFlowIpv4TosReliability) (PatternFlowIpv4TosReliability, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosReliability) 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 *unMarshalpatternFlowIpv4TosReliability) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4TosReliability) 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 *unMarshalpatternFlowIpv4TosReliability) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4TosReliability) 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 *unMarshalpatternFlowIpv4TosReliability) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4TosReliability) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosReliability) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosReliability) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosReliability) Clone() (PatternFlowIpv4TosReliability, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosReliability() + 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 +} + +func (obj *patternFlowIpv4TosReliability) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4TosReliability is reliability +type PatternFlowIpv4TosReliability interface { + Validation + // msg marshals PatternFlowIpv4TosReliability to protobuf object *otg.PatternFlowIpv4TosReliability + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosReliability + // setMsg unmarshals PatternFlowIpv4TosReliability from protobuf object *otg.PatternFlowIpv4TosReliability + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosReliability) PatternFlowIpv4TosReliability + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosReliability + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosReliability + // validate validates PatternFlowIpv4TosReliability + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosReliability, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4TosReliabilityChoiceEnum, set in PatternFlowIpv4TosReliability + Choice() PatternFlowIpv4TosReliabilityChoiceEnum + // setChoice assigns PatternFlowIpv4TosReliabilityChoiceEnum provided by user to PatternFlowIpv4TosReliability + setChoice(value PatternFlowIpv4TosReliabilityChoiceEnum) PatternFlowIpv4TosReliability + // HasChoice checks if Choice has been set in PatternFlowIpv4TosReliability + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4TosReliability. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4TosReliability + SetValue(value uint32) PatternFlowIpv4TosReliability + // HasValue checks if Value has been set in PatternFlowIpv4TosReliability + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4TosReliability. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4TosReliability + SetValues(value []uint32) PatternFlowIpv4TosReliability + // Increment returns PatternFlowIpv4TosReliabilityCounter, set in PatternFlowIpv4TosReliability. + // PatternFlowIpv4TosReliabilityCounter is integer counter pattern + Increment() PatternFlowIpv4TosReliabilityCounter + // SetIncrement assigns PatternFlowIpv4TosReliabilityCounter provided by user to PatternFlowIpv4TosReliability. + // PatternFlowIpv4TosReliabilityCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4TosReliabilityCounter) PatternFlowIpv4TosReliability + // HasIncrement checks if Increment has been set in PatternFlowIpv4TosReliability + HasIncrement() bool + // Decrement returns PatternFlowIpv4TosReliabilityCounter, set in PatternFlowIpv4TosReliability. + // PatternFlowIpv4TosReliabilityCounter is integer counter pattern + Decrement() PatternFlowIpv4TosReliabilityCounter + // SetDecrement assigns PatternFlowIpv4TosReliabilityCounter provided by user to PatternFlowIpv4TosReliability. + // PatternFlowIpv4TosReliabilityCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4TosReliabilityCounter) PatternFlowIpv4TosReliability + // HasDecrement checks if Decrement has been set in PatternFlowIpv4TosReliability + HasDecrement() bool + // MetricTags returns PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIterIter, set in PatternFlowIpv4TosReliability + MetricTags() PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter + setNil() +} + +type PatternFlowIpv4TosReliabilityChoiceEnum string + +// Enum of Choice on PatternFlowIpv4TosReliability +var PatternFlowIpv4TosReliabilityChoice = struct { + VALUE PatternFlowIpv4TosReliabilityChoiceEnum + VALUES PatternFlowIpv4TosReliabilityChoiceEnum + INCREMENT PatternFlowIpv4TosReliabilityChoiceEnum + DECREMENT PatternFlowIpv4TosReliabilityChoiceEnum +}{ + VALUE: PatternFlowIpv4TosReliabilityChoiceEnum("value"), + VALUES: PatternFlowIpv4TosReliabilityChoiceEnum("values"), + INCREMENT: PatternFlowIpv4TosReliabilityChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4TosReliabilityChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4TosReliability) Choice() PatternFlowIpv4TosReliabilityChoiceEnum { + return PatternFlowIpv4TosReliabilityChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4TosReliability) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4TosReliability) setChoice(value PatternFlowIpv4TosReliabilityChoiceEnum) PatternFlowIpv4TosReliability { + intValue, ok := otg.PatternFlowIpv4TosReliability_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4TosReliabilityChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4TosReliability_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4TosReliabilityChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4TosReliabilityChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4TosReliabilityChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4TosReliabilityCounter().msg() + } + + if value == PatternFlowIpv4TosReliabilityChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4TosReliabilityCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TosReliability) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4TosReliabilityChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TosReliability) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4TosReliability object +func (obj *patternFlowIpv4TosReliability) SetValue(value uint32) PatternFlowIpv4TosReliability { + obj.setChoice(PatternFlowIpv4TosReliabilityChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4TosReliability) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4TosReliability object +func (obj *patternFlowIpv4TosReliability) SetValues(value []uint32) PatternFlowIpv4TosReliability { + obj.setChoice(PatternFlowIpv4TosReliabilityChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4TosReliabilityCounter +func (obj *patternFlowIpv4TosReliability) Increment() PatternFlowIpv4TosReliabilityCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4TosReliabilityChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4TosReliabilityCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4TosReliabilityCounter +func (obj *patternFlowIpv4TosReliability) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4TosReliabilityCounter value in the PatternFlowIpv4TosReliability object +func (obj *patternFlowIpv4TosReliability) SetIncrement(value PatternFlowIpv4TosReliabilityCounter) PatternFlowIpv4TosReliability { + obj.setChoice(PatternFlowIpv4TosReliabilityChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TosReliabilityCounter +func (obj *patternFlowIpv4TosReliability) Decrement() PatternFlowIpv4TosReliabilityCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4TosReliabilityChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4TosReliabilityCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TosReliabilityCounter +func (obj *patternFlowIpv4TosReliability) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4TosReliabilityCounter value in the PatternFlowIpv4TosReliability object +func (obj *patternFlowIpv4TosReliability) SetDecrement(value PatternFlowIpv4TosReliabilityCounter) PatternFlowIpv4TosReliability { + obj.setChoice(PatternFlowIpv4TosReliabilityChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4TosReliabilityMetricTag +func (obj *patternFlowIpv4TosReliability) MetricTags() PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4TosReliabilityMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter struct { + obj *patternFlowIpv4TosReliability + patternFlowIpv4TosReliabilityMetricTagSlice []PatternFlowIpv4TosReliabilityMetricTag + fieldPtr *[]*otg.PatternFlowIpv4TosReliabilityMetricTag +} + +func newPatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter(ptr *[]*otg.PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { + return &patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter interface { + setMsg(*patternFlowIpv4TosReliability) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter + Items() []PatternFlowIpv4TosReliabilityMetricTag + Add() PatternFlowIpv4TosReliabilityMetricTag + Append(items ...PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter + Set(index int, newObj PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter + Clear() PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter + clearHolderSlice() PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter + appendHolderSlice(item PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter +} + +func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) setMsg(msg *patternFlowIpv4TosReliability) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4TosReliabilityMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) Items() []PatternFlowIpv4TosReliabilityMetricTag { + return obj.patternFlowIpv4TosReliabilityMetricTagSlice +} + +func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) Add() PatternFlowIpv4TosReliabilityMetricTag { + newObj := &otg.PatternFlowIpv4TosReliabilityMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4TosReliabilityMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4TosReliabilityMetricTagSlice = append(obj.patternFlowIpv4TosReliabilityMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) Append(items ...PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4TosReliabilityMetricTagSlice = append(obj.patternFlowIpv4TosReliabilityMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) Set(index int, newObj PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4TosReliabilityMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) Clear() PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4TosReliabilityMetricTag{} + obj.patternFlowIpv4TosReliabilityMetricTagSlice = []PatternFlowIpv4TosReliabilityMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) clearHolderSlice() PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { + if len(obj.patternFlowIpv4TosReliabilityMetricTagSlice) > 0 { + obj.patternFlowIpv4TosReliabilityMetricTagSlice = []PatternFlowIpv4TosReliabilityMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter) appendHolderSlice(item PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityPatternFlowIpv4TosReliabilityMetricTagIter { + obj.patternFlowIpv4TosReliabilityMetricTagSlice = append(obj.patternFlowIpv4TosReliabilityMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4TosReliability) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosReliability.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4TosReliability.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4TosReliabilityMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4TosReliability) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4TosReliabilityChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4TosReliabilityChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4TosReliabilityChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4TosReliabilityChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4TosReliabilityChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4TosReliabilityChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TosReliability") + } + } else { + intVal := otg.PatternFlowIpv4TosReliability_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4TosReliability_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_reliability_counter.go b/gosnappi/pattern_flow_ipv4_tos_reliability_counter.go new file mode 100644 index 00000000..f8274654 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_reliability_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4TosReliabilityCounter ***** +type patternFlowIpv4TosReliabilityCounter struct { + validation + obj *otg.PatternFlowIpv4TosReliabilityCounter + marshaller marshalPatternFlowIpv4TosReliabilityCounter + unMarshaller unMarshalPatternFlowIpv4TosReliabilityCounter +} + +func NewPatternFlowIpv4TosReliabilityCounter() PatternFlowIpv4TosReliabilityCounter { + obj := patternFlowIpv4TosReliabilityCounter{obj: &otg.PatternFlowIpv4TosReliabilityCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosReliabilityCounter) msg() *otg.PatternFlowIpv4TosReliabilityCounter { + return obj.obj +} + +func (obj *patternFlowIpv4TosReliabilityCounter) setMsg(msg *otg.PatternFlowIpv4TosReliabilityCounter) PatternFlowIpv4TosReliabilityCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosReliabilityCounter struct { + obj *patternFlowIpv4TosReliabilityCounter +} + +type marshalPatternFlowIpv4TosReliabilityCounter interface { + // ToProto marshals PatternFlowIpv4TosReliabilityCounter to protobuf object *otg.PatternFlowIpv4TosReliabilityCounter + ToProto() (*otg.PatternFlowIpv4TosReliabilityCounter, error) + // ToPbText marshals PatternFlowIpv4TosReliabilityCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosReliabilityCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosReliabilityCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosReliabilityCounter struct { + obj *patternFlowIpv4TosReliabilityCounter +} + +type unMarshalPatternFlowIpv4TosReliabilityCounter interface { + // FromProto unmarshals PatternFlowIpv4TosReliabilityCounter from protobuf object *otg.PatternFlowIpv4TosReliabilityCounter + FromProto(msg *otg.PatternFlowIpv4TosReliabilityCounter) (PatternFlowIpv4TosReliabilityCounter, error) + // FromPbText unmarshals PatternFlowIpv4TosReliabilityCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosReliabilityCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosReliabilityCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosReliabilityCounter) Marshal() marshalPatternFlowIpv4TosReliabilityCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosReliabilityCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosReliabilityCounter) Unmarshal() unMarshalPatternFlowIpv4TosReliabilityCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosReliabilityCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosReliabilityCounter) ToProto() (*otg.PatternFlowIpv4TosReliabilityCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosReliabilityCounter) FromProto(msg *otg.PatternFlowIpv4TosReliabilityCounter) (PatternFlowIpv4TosReliabilityCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosReliabilityCounter) 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 *unMarshalpatternFlowIpv4TosReliabilityCounter) 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 *marshalpatternFlowIpv4TosReliabilityCounter) 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 *unMarshalpatternFlowIpv4TosReliabilityCounter) 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 *marshalpatternFlowIpv4TosReliabilityCounter) 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 *unMarshalpatternFlowIpv4TosReliabilityCounter) 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 *patternFlowIpv4TosReliabilityCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosReliabilityCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosReliabilityCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosReliabilityCounter) Clone() (PatternFlowIpv4TosReliabilityCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosReliabilityCounter() + 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 +} + +// PatternFlowIpv4TosReliabilityCounter is integer counter pattern +type PatternFlowIpv4TosReliabilityCounter interface { + Validation + // msg marshals PatternFlowIpv4TosReliabilityCounter to protobuf object *otg.PatternFlowIpv4TosReliabilityCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosReliabilityCounter + // setMsg unmarshals PatternFlowIpv4TosReliabilityCounter from protobuf object *otg.PatternFlowIpv4TosReliabilityCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosReliabilityCounter) PatternFlowIpv4TosReliabilityCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosReliabilityCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosReliabilityCounter + // validate validates PatternFlowIpv4TosReliabilityCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosReliabilityCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4TosReliabilityCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4TosReliabilityCounter + SetStart(value uint32) PatternFlowIpv4TosReliabilityCounter + // HasStart checks if Start has been set in PatternFlowIpv4TosReliabilityCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4TosReliabilityCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4TosReliabilityCounter + SetStep(value uint32) PatternFlowIpv4TosReliabilityCounter + // HasStep checks if Step has been set in PatternFlowIpv4TosReliabilityCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4TosReliabilityCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4TosReliabilityCounter + SetCount(value uint32) PatternFlowIpv4TosReliabilityCounter + // HasCount checks if Count has been set in PatternFlowIpv4TosReliabilityCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TosReliabilityCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TosReliabilityCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4TosReliabilityCounter object +func (obj *patternFlowIpv4TosReliabilityCounter) SetStart(value uint32) PatternFlowIpv4TosReliabilityCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TosReliabilityCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TosReliabilityCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4TosReliabilityCounter object +func (obj *patternFlowIpv4TosReliabilityCounter) SetStep(value uint32) PatternFlowIpv4TosReliabilityCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TosReliabilityCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TosReliabilityCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4TosReliabilityCounter object +func (obj *patternFlowIpv4TosReliabilityCounter) SetCount(value uint32) PatternFlowIpv4TosReliabilityCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4TosReliabilityCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosReliabilityCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosReliabilityCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosReliabilityCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4TosReliabilityCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_reliability_metric_tag.go b/gosnappi/pattern_flow_ipv4_tos_reliability_metric_tag.go new file mode 100644 index 00000000..69711eed --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_reliability_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4TosReliabilityMetricTag ***** +type patternFlowIpv4TosReliabilityMetricTag struct { + validation + obj *otg.PatternFlowIpv4TosReliabilityMetricTag + marshaller marshalPatternFlowIpv4TosReliabilityMetricTag + unMarshaller unMarshalPatternFlowIpv4TosReliabilityMetricTag +} + +func NewPatternFlowIpv4TosReliabilityMetricTag() PatternFlowIpv4TosReliabilityMetricTag { + obj := patternFlowIpv4TosReliabilityMetricTag{obj: &otg.PatternFlowIpv4TosReliabilityMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosReliabilityMetricTag) msg() *otg.PatternFlowIpv4TosReliabilityMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4TosReliabilityMetricTag) setMsg(msg *otg.PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosReliabilityMetricTag struct { + obj *patternFlowIpv4TosReliabilityMetricTag +} + +type marshalPatternFlowIpv4TosReliabilityMetricTag interface { + // ToProto marshals PatternFlowIpv4TosReliabilityMetricTag to protobuf object *otg.PatternFlowIpv4TosReliabilityMetricTag + ToProto() (*otg.PatternFlowIpv4TosReliabilityMetricTag, error) + // ToPbText marshals PatternFlowIpv4TosReliabilityMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosReliabilityMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosReliabilityMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosReliabilityMetricTag struct { + obj *patternFlowIpv4TosReliabilityMetricTag +} + +type unMarshalPatternFlowIpv4TosReliabilityMetricTag interface { + // FromProto unmarshals PatternFlowIpv4TosReliabilityMetricTag from protobuf object *otg.PatternFlowIpv4TosReliabilityMetricTag + FromProto(msg *otg.PatternFlowIpv4TosReliabilityMetricTag) (PatternFlowIpv4TosReliabilityMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4TosReliabilityMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosReliabilityMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosReliabilityMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosReliabilityMetricTag) Marshal() marshalPatternFlowIpv4TosReliabilityMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosReliabilityMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosReliabilityMetricTag) Unmarshal() unMarshalPatternFlowIpv4TosReliabilityMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosReliabilityMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosReliabilityMetricTag) ToProto() (*otg.PatternFlowIpv4TosReliabilityMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosReliabilityMetricTag) FromProto(msg *otg.PatternFlowIpv4TosReliabilityMetricTag) (PatternFlowIpv4TosReliabilityMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosReliabilityMetricTag) 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 *unMarshalpatternFlowIpv4TosReliabilityMetricTag) 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 *marshalpatternFlowIpv4TosReliabilityMetricTag) 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 *unMarshalpatternFlowIpv4TosReliabilityMetricTag) 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 *marshalpatternFlowIpv4TosReliabilityMetricTag) 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 *unMarshalpatternFlowIpv4TosReliabilityMetricTag) 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 *patternFlowIpv4TosReliabilityMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosReliabilityMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosReliabilityMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosReliabilityMetricTag) Clone() (PatternFlowIpv4TosReliabilityMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosReliabilityMetricTag() + 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 +} + +// PatternFlowIpv4TosReliabilityMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4TosReliabilityMetricTag interface { + Validation + // msg marshals PatternFlowIpv4TosReliabilityMetricTag to protobuf object *otg.PatternFlowIpv4TosReliabilityMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosReliabilityMetricTag + // setMsg unmarshals PatternFlowIpv4TosReliabilityMetricTag from protobuf object *otg.PatternFlowIpv4TosReliabilityMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosReliabilityMetricTag) PatternFlowIpv4TosReliabilityMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosReliabilityMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosReliabilityMetricTag + // validate validates PatternFlowIpv4TosReliabilityMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosReliabilityMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4TosReliabilityMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4TosReliabilityMetricTag + SetName(value string) PatternFlowIpv4TosReliabilityMetricTag + // Offset returns uint32, set in PatternFlowIpv4TosReliabilityMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4TosReliabilityMetricTag + SetOffset(value uint32) PatternFlowIpv4TosReliabilityMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4TosReliabilityMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4TosReliabilityMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4TosReliabilityMetricTag + SetLength(value uint32) PatternFlowIpv4TosReliabilityMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4TosReliabilityMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4TosReliabilityMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4TosReliabilityMetricTag object +func (obj *patternFlowIpv4TosReliabilityMetricTag) SetName(value string) PatternFlowIpv4TosReliabilityMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TosReliabilityMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TosReliabilityMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4TosReliabilityMetricTag object +func (obj *patternFlowIpv4TosReliabilityMetricTag) SetOffset(value uint32) PatternFlowIpv4TosReliabilityMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TosReliabilityMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TosReliabilityMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4TosReliabilityMetricTag object +func (obj *patternFlowIpv4TosReliabilityMetricTag) SetLength(value uint32) PatternFlowIpv4TosReliabilityMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4TosReliabilityMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TosReliabilityMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosReliabilityMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4TosReliabilityMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4TosReliabilityMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_throughput.go b/gosnappi/pattern_flow_ipv4_tos_throughput.go new file mode 100644 index 00000000..6ba234de --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_throughput.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4TosThroughput ***** +type patternFlowIpv4TosThroughput struct { + validation + obj *otg.PatternFlowIpv4TosThroughput + marshaller marshalPatternFlowIpv4TosThroughput + unMarshaller unMarshalPatternFlowIpv4TosThroughput + incrementHolder PatternFlowIpv4TosThroughputCounter + decrementHolder PatternFlowIpv4TosThroughputCounter + metricTagsHolder PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter +} + +func NewPatternFlowIpv4TosThroughput() PatternFlowIpv4TosThroughput { + obj := patternFlowIpv4TosThroughput{obj: &otg.PatternFlowIpv4TosThroughput{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosThroughput) msg() *otg.PatternFlowIpv4TosThroughput { + return obj.obj +} + +func (obj *patternFlowIpv4TosThroughput) setMsg(msg *otg.PatternFlowIpv4TosThroughput) PatternFlowIpv4TosThroughput { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosThroughput struct { + obj *patternFlowIpv4TosThroughput +} + +type marshalPatternFlowIpv4TosThroughput interface { + // ToProto marshals PatternFlowIpv4TosThroughput to protobuf object *otg.PatternFlowIpv4TosThroughput + ToProto() (*otg.PatternFlowIpv4TosThroughput, error) + // ToPbText marshals PatternFlowIpv4TosThroughput to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosThroughput to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosThroughput to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosThroughput struct { + obj *patternFlowIpv4TosThroughput +} + +type unMarshalPatternFlowIpv4TosThroughput interface { + // FromProto unmarshals PatternFlowIpv4TosThroughput from protobuf object *otg.PatternFlowIpv4TosThroughput + FromProto(msg *otg.PatternFlowIpv4TosThroughput) (PatternFlowIpv4TosThroughput, error) + // FromPbText unmarshals PatternFlowIpv4TosThroughput from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosThroughput from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosThroughput from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosThroughput) Marshal() marshalPatternFlowIpv4TosThroughput { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosThroughput{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosThroughput) Unmarshal() unMarshalPatternFlowIpv4TosThroughput { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosThroughput{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosThroughput) ToProto() (*otg.PatternFlowIpv4TosThroughput, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosThroughput) FromProto(msg *otg.PatternFlowIpv4TosThroughput) (PatternFlowIpv4TosThroughput, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosThroughput) 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 *unMarshalpatternFlowIpv4TosThroughput) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4TosThroughput) 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 *unMarshalpatternFlowIpv4TosThroughput) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4TosThroughput) 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 *unMarshalpatternFlowIpv4TosThroughput) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4TosThroughput) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosThroughput) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosThroughput) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosThroughput) Clone() (PatternFlowIpv4TosThroughput, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosThroughput() + 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 +} + +func (obj *patternFlowIpv4TosThroughput) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4TosThroughput is throughput +type PatternFlowIpv4TosThroughput interface { + Validation + // msg marshals PatternFlowIpv4TosThroughput to protobuf object *otg.PatternFlowIpv4TosThroughput + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosThroughput + // setMsg unmarshals PatternFlowIpv4TosThroughput from protobuf object *otg.PatternFlowIpv4TosThroughput + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosThroughput) PatternFlowIpv4TosThroughput + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosThroughput + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosThroughput + // validate validates PatternFlowIpv4TosThroughput + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosThroughput, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4TosThroughputChoiceEnum, set in PatternFlowIpv4TosThroughput + Choice() PatternFlowIpv4TosThroughputChoiceEnum + // setChoice assigns PatternFlowIpv4TosThroughputChoiceEnum provided by user to PatternFlowIpv4TosThroughput + setChoice(value PatternFlowIpv4TosThroughputChoiceEnum) PatternFlowIpv4TosThroughput + // HasChoice checks if Choice has been set in PatternFlowIpv4TosThroughput + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4TosThroughput. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4TosThroughput + SetValue(value uint32) PatternFlowIpv4TosThroughput + // HasValue checks if Value has been set in PatternFlowIpv4TosThroughput + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4TosThroughput. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4TosThroughput + SetValues(value []uint32) PatternFlowIpv4TosThroughput + // Increment returns PatternFlowIpv4TosThroughputCounter, set in PatternFlowIpv4TosThroughput. + // PatternFlowIpv4TosThroughputCounter is integer counter pattern + Increment() PatternFlowIpv4TosThroughputCounter + // SetIncrement assigns PatternFlowIpv4TosThroughputCounter provided by user to PatternFlowIpv4TosThroughput. + // PatternFlowIpv4TosThroughputCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4TosThroughputCounter) PatternFlowIpv4TosThroughput + // HasIncrement checks if Increment has been set in PatternFlowIpv4TosThroughput + HasIncrement() bool + // Decrement returns PatternFlowIpv4TosThroughputCounter, set in PatternFlowIpv4TosThroughput. + // PatternFlowIpv4TosThroughputCounter is integer counter pattern + Decrement() PatternFlowIpv4TosThroughputCounter + // SetDecrement assigns PatternFlowIpv4TosThroughputCounter provided by user to PatternFlowIpv4TosThroughput. + // PatternFlowIpv4TosThroughputCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4TosThroughputCounter) PatternFlowIpv4TosThroughput + // HasDecrement checks if Decrement has been set in PatternFlowIpv4TosThroughput + HasDecrement() bool + // MetricTags returns PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIterIter, set in PatternFlowIpv4TosThroughput + MetricTags() PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter + setNil() +} + +type PatternFlowIpv4TosThroughputChoiceEnum string + +// Enum of Choice on PatternFlowIpv4TosThroughput +var PatternFlowIpv4TosThroughputChoice = struct { + VALUE PatternFlowIpv4TosThroughputChoiceEnum + VALUES PatternFlowIpv4TosThroughputChoiceEnum + INCREMENT PatternFlowIpv4TosThroughputChoiceEnum + DECREMENT PatternFlowIpv4TosThroughputChoiceEnum +}{ + VALUE: PatternFlowIpv4TosThroughputChoiceEnum("value"), + VALUES: PatternFlowIpv4TosThroughputChoiceEnum("values"), + INCREMENT: PatternFlowIpv4TosThroughputChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4TosThroughputChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4TosThroughput) Choice() PatternFlowIpv4TosThroughputChoiceEnum { + return PatternFlowIpv4TosThroughputChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4TosThroughput) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4TosThroughput) setChoice(value PatternFlowIpv4TosThroughputChoiceEnum) PatternFlowIpv4TosThroughput { + intValue, ok := otg.PatternFlowIpv4TosThroughput_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4TosThroughputChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4TosThroughput_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4TosThroughputChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4TosThroughputChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4TosThroughputChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4TosThroughputCounter().msg() + } + + if value == PatternFlowIpv4TosThroughputChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4TosThroughputCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TosThroughput) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4TosThroughputChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TosThroughput) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4TosThroughput object +func (obj *patternFlowIpv4TosThroughput) SetValue(value uint32) PatternFlowIpv4TosThroughput { + obj.setChoice(PatternFlowIpv4TosThroughputChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4TosThroughput) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4TosThroughput object +func (obj *patternFlowIpv4TosThroughput) SetValues(value []uint32) PatternFlowIpv4TosThroughput { + obj.setChoice(PatternFlowIpv4TosThroughputChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4TosThroughputCounter +func (obj *patternFlowIpv4TosThroughput) Increment() PatternFlowIpv4TosThroughputCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4TosThroughputChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4TosThroughputCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4TosThroughputCounter +func (obj *patternFlowIpv4TosThroughput) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4TosThroughputCounter value in the PatternFlowIpv4TosThroughput object +func (obj *patternFlowIpv4TosThroughput) SetIncrement(value PatternFlowIpv4TosThroughputCounter) PatternFlowIpv4TosThroughput { + obj.setChoice(PatternFlowIpv4TosThroughputChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TosThroughputCounter +func (obj *patternFlowIpv4TosThroughput) Decrement() PatternFlowIpv4TosThroughputCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4TosThroughputChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4TosThroughputCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TosThroughputCounter +func (obj *patternFlowIpv4TosThroughput) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4TosThroughputCounter value in the PatternFlowIpv4TosThroughput object +func (obj *patternFlowIpv4TosThroughput) SetDecrement(value PatternFlowIpv4TosThroughputCounter) PatternFlowIpv4TosThroughput { + obj.setChoice(PatternFlowIpv4TosThroughputChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4TosThroughputMetricTag +func (obj *patternFlowIpv4TosThroughput) MetricTags() PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4TosThroughputMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter struct { + obj *patternFlowIpv4TosThroughput + patternFlowIpv4TosThroughputMetricTagSlice []PatternFlowIpv4TosThroughputMetricTag + fieldPtr *[]*otg.PatternFlowIpv4TosThroughputMetricTag +} + +func newPatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter(ptr *[]*otg.PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { + return &patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter interface { + setMsg(*patternFlowIpv4TosThroughput) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter + Items() []PatternFlowIpv4TosThroughputMetricTag + Add() PatternFlowIpv4TosThroughputMetricTag + Append(items ...PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter + Set(index int, newObj PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter + Clear() PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter + clearHolderSlice() PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter + appendHolderSlice(item PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter +} + +func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) setMsg(msg *patternFlowIpv4TosThroughput) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4TosThroughputMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) Items() []PatternFlowIpv4TosThroughputMetricTag { + return obj.patternFlowIpv4TosThroughputMetricTagSlice +} + +func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) Add() PatternFlowIpv4TosThroughputMetricTag { + newObj := &otg.PatternFlowIpv4TosThroughputMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4TosThroughputMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4TosThroughputMetricTagSlice = append(obj.patternFlowIpv4TosThroughputMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) Append(items ...PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4TosThroughputMetricTagSlice = append(obj.patternFlowIpv4TosThroughputMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) Set(index int, newObj PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4TosThroughputMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) Clear() PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4TosThroughputMetricTag{} + obj.patternFlowIpv4TosThroughputMetricTagSlice = []PatternFlowIpv4TosThroughputMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) clearHolderSlice() PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { + if len(obj.patternFlowIpv4TosThroughputMetricTagSlice) > 0 { + obj.patternFlowIpv4TosThroughputMetricTagSlice = []PatternFlowIpv4TosThroughputMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter) appendHolderSlice(item PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputPatternFlowIpv4TosThroughputMetricTagIter { + obj.patternFlowIpv4TosThroughputMetricTagSlice = append(obj.patternFlowIpv4TosThroughputMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4TosThroughput) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosThroughput.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4TosThroughput.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4TosThroughputMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4TosThroughput) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4TosThroughputChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4TosThroughputChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4TosThroughputChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4TosThroughputChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4TosThroughputChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4TosThroughputChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TosThroughput") + } + } else { + intVal := otg.PatternFlowIpv4TosThroughput_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4TosThroughput_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_throughput_counter.go b/gosnappi/pattern_flow_ipv4_tos_throughput_counter.go new file mode 100644 index 00000000..69c48d39 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_throughput_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4TosThroughputCounter ***** +type patternFlowIpv4TosThroughputCounter struct { + validation + obj *otg.PatternFlowIpv4TosThroughputCounter + marshaller marshalPatternFlowIpv4TosThroughputCounter + unMarshaller unMarshalPatternFlowIpv4TosThroughputCounter +} + +func NewPatternFlowIpv4TosThroughputCounter() PatternFlowIpv4TosThroughputCounter { + obj := patternFlowIpv4TosThroughputCounter{obj: &otg.PatternFlowIpv4TosThroughputCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosThroughputCounter) msg() *otg.PatternFlowIpv4TosThroughputCounter { + return obj.obj +} + +func (obj *patternFlowIpv4TosThroughputCounter) setMsg(msg *otg.PatternFlowIpv4TosThroughputCounter) PatternFlowIpv4TosThroughputCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosThroughputCounter struct { + obj *patternFlowIpv4TosThroughputCounter +} + +type marshalPatternFlowIpv4TosThroughputCounter interface { + // ToProto marshals PatternFlowIpv4TosThroughputCounter to protobuf object *otg.PatternFlowIpv4TosThroughputCounter + ToProto() (*otg.PatternFlowIpv4TosThroughputCounter, error) + // ToPbText marshals PatternFlowIpv4TosThroughputCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosThroughputCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosThroughputCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosThroughputCounter struct { + obj *patternFlowIpv4TosThroughputCounter +} + +type unMarshalPatternFlowIpv4TosThroughputCounter interface { + // FromProto unmarshals PatternFlowIpv4TosThroughputCounter from protobuf object *otg.PatternFlowIpv4TosThroughputCounter + FromProto(msg *otg.PatternFlowIpv4TosThroughputCounter) (PatternFlowIpv4TosThroughputCounter, error) + // FromPbText unmarshals PatternFlowIpv4TosThroughputCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosThroughputCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosThroughputCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosThroughputCounter) Marshal() marshalPatternFlowIpv4TosThroughputCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosThroughputCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosThroughputCounter) Unmarshal() unMarshalPatternFlowIpv4TosThroughputCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosThroughputCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosThroughputCounter) ToProto() (*otg.PatternFlowIpv4TosThroughputCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosThroughputCounter) FromProto(msg *otg.PatternFlowIpv4TosThroughputCounter) (PatternFlowIpv4TosThroughputCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosThroughputCounter) 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 *unMarshalpatternFlowIpv4TosThroughputCounter) 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 *marshalpatternFlowIpv4TosThroughputCounter) 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 *unMarshalpatternFlowIpv4TosThroughputCounter) 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 *marshalpatternFlowIpv4TosThroughputCounter) 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 *unMarshalpatternFlowIpv4TosThroughputCounter) 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 *patternFlowIpv4TosThroughputCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosThroughputCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosThroughputCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosThroughputCounter) Clone() (PatternFlowIpv4TosThroughputCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosThroughputCounter() + 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 +} + +// PatternFlowIpv4TosThroughputCounter is integer counter pattern +type PatternFlowIpv4TosThroughputCounter interface { + Validation + // msg marshals PatternFlowIpv4TosThroughputCounter to protobuf object *otg.PatternFlowIpv4TosThroughputCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosThroughputCounter + // setMsg unmarshals PatternFlowIpv4TosThroughputCounter from protobuf object *otg.PatternFlowIpv4TosThroughputCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosThroughputCounter) PatternFlowIpv4TosThroughputCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosThroughputCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosThroughputCounter + // validate validates PatternFlowIpv4TosThroughputCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosThroughputCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4TosThroughputCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4TosThroughputCounter + SetStart(value uint32) PatternFlowIpv4TosThroughputCounter + // HasStart checks if Start has been set in PatternFlowIpv4TosThroughputCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4TosThroughputCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4TosThroughputCounter + SetStep(value uint32) PatternFlowIpv4TosThroughputCounter + // HasStep checks if Step has been set in PatternFlowIpv4TosThroughputCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4TosThroughputCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4TosThroughputCounter + SetCount(value uint32) PatternFlowIpv4TosThroughputCounter + // HasCount checks if Count has been set in PatternFlowIpv4TosThroughputCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TosThroughputCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TosThroughputCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4TosThroughputCounter object +func (obj *patternFlowIpv4TosThroughputCounter) SetStart(value uint32) PatternFlowIpv4TosThroughputCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TosThroughputCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TosThroughputCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4TosThroughputCounter object +func (obj *patternFlowIpv4TosThroughputCounter) SetStep(value uint32) PatternFlowIpv4TosThroughputCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TosThroughputCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TosThroughputCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4TosThroughputCounter object +func (obj *patternFlowIpv4TosThroughputCounter) SetCount(value uint32) PatternFlowIpv4TosThroughputCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4TosThroughputCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosThroughputCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosThroughputCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosThroughputCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4TosThroughputCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_throughput_metric_tag.go b/gosnappi/pattern_flow_ipv4_tos_throughput_metric_tag.go new file mode 100644 index 00000000..8c5df93b --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_throughput_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4TosThroughputMetricTag ***** +type patternFlowIpv4TosThroughputMetricTag struct { + validation + obj *otg.PatternFlowIpv4TosThroughputMetricTag + marshaller marshalPatternFlowIpv4TosThroughputMetricTag + unMarshaller unMarshalPatternFlowIpv4TosThroughputMetricTag +} + +func NewPatternFlowIpv4TosThroughputMetricTag() PatternFlowIpv4TosThroughputMetricTag { + obj := patternFlowIpv4TosThroughputMetricTag{obj: &otg.PatternFlowIpv4TosThroughputMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosThroughputMetricTag) msg() *otg.PatternFlowIpv4TosThroughputMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4TosThroughputMetricTag) setMsg(msg *otg.PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosThroughputMetricTag struct { + obj *patternFlowIpv4TosThroughputMetricTag +} + +type marshalPatternFlowIpv4TosThroughputMetricTag interface { + // ToProto marshals PatternFlowIpv4TosThroughputMetricTag to protobuf object *otg.PatternFlowIpv4TosThroughputMetricTag + ToProto() (*otg.PatternFlowIpv4TosThroughputMetricTag, error) + // ToPbText marshals PatternFlowIpv4TosThroughputMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosThroughputMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosThroughputMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosThroughputMetricTag struct { + obj *patternFlowIpv4TosThroughputMetricTag +} + +type unMarshalPatternFlowIpv4TosThroughputMetricTag interface { + // FromProto unmarshals PatternFlowIpv4TosThroughputMetricTag from protobuf object *otg.PatternFlowIpv4TosThroughputMetricTag + FromProto(msg *otg.PatternFlowIpv4TosThroughputMetricTag) (PatternFlowIpv4TosThroughputMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4TosThroughputMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosThroughputMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosThroughputMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosThroughputMetricTag) Marshal() marshalPatternFlowIpv4TosThroughputMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosThroughputMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosThroughputMetricTag) Unmarshal() unMarshalPatternFlowIpv4TosThroughputMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosThroughputMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosThroughputMetricTag) ToProto() (*otg.PatternFlowIpv4TosThroughputMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosThroughputMetricTag) FromProto(msg *otg.PatternFlowIpv4TosThroughputMetricTag) (PatternFlowIpv4TosThroughputMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosThroughputMetricTag) 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 *unMarshalpatternFlowIpv4TosThroughputMetricTag) 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 *marshalpatternFlowIpv4TosThroughputMetricTag) 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 *unMarshalpatternFlowIpv4TosThroughputMetricTag) 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 *marshalpatternFlowIpv4TosThroughputMetricTag) 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 *unMarshalpatternFlowIpv4TosThroughputMetricTag) 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 *patternFlowIpv4TosThroughputMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosThroughputMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosThroughputMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosThroughputMetricTag) Clone() (PatternFlowIpv4TosThroughputMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosThroughputMetricTag() + 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 +} + +// PatternFlowIpv4TosThroughputMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4TosThroughputMetricTag interface { + Validation + // msg marshals PatternFlowIpv4TosThroughputMetricTag to protobuf object *otg.PatternFlowIpv4TosThroughputMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosThroughputMetricTag + // setMsg unmarshals PatternFlowIpv4TosThroughputMetricTag from protobuf object *otg.PatternFlowIpv4TosThroughputMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosThroughputMetricTag) PatternFlowIpv4TosThroughputMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosThroughputMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosThroughputMetricTag + // validate validates PatternFlowIpv4TosThroughputMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosThroughputMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4TosThroughputMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4TosThroughputMetricTag + SetName(value string) PatternFlowIpv4TosThroughputMetricTag + // Offset returns uint32, set in PatternFlowIpv4TosThroughputMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4TosThroughputMetricTag + SetOffset(value uint32) PatternFlowIpv4TosThroughputMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4TosThroughputMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4TosThroughputMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4TosThroughputMetricTag + SetLength(value uint32) PatternFlowIpv4TosThroughputMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4TosThroughputMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4TosThroughputMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4TosThroughputMetricTag object +func (obj *patternFlowIpv4TosThroughputMetricTag) SetName(value string) PatternFlowIpv4TosThroughputMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TosThroughputMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TosThroughputMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4TosThroughputMetricTag object +func (obj *patternFlowIpv4TosThroughputMetricTag) SetOffset(value uint32) PatternFlowIpv4TosThroughputMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TosThroughputMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TosThroughputMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4TosThroughputMetricTag object +func (obj *patternFlowIpv4TosThroughputMetricTag) SetLength(value uint32) PatternFlowIpv4TosThroughputMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4TosThroughputMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TosThroughputMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosThroughputMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4TosThroughputMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4TosThroughputMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_unused.go b/gosnappi/pattern_flow_ipv4_tos_unused.go new file mode 100644 index 00000000..4dec3ffa --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_unused.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4TosUnused ***** +type patternFlowIpv4TosUnused struct { + validation + obj *otg.PatternFlowIpv4TosUnused + marshaller marshalPatternFlowIpv4TosUnused + unMarshaller unMarshalPatternFlowIpv4TosUnused + incrementHolder PatternFlowIpv4TosUnusedCounter + decrementHolder PatternFlowIpv4TosUnusedCounter + metricTagsHolder PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter +} + +func NewPatternFlowIpv4TosUnused() PatternFlowIpv4TosUnused { + obj := patternFlowIpv4TosUnused{obj: &otg.PatternFlowIpv4TosUnused{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosUnused) msg() *otg.PatternFlowIpv4TosUnused { + return obj.obj +} + +func (obj *patternFlowIpv4TosUnused) setMsg(msg *otg.PatternFlowIpv4TosUnused) PatternFlowIpv4TosUnused { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosUnused struct { + obj *patternFlowIpv4TosUnused +} + +type marshalPatternFlowIpv4TosUnused interface { + // ToProto marshals PatternFlowIpv4TosUnused to protobuf object *otg.PatternFlowIpv4TosUnused + ToProto() (*otg.PatternFlowIpv4TosUnused, error) + // ToPbText marshals PatternFlowIpv4TosUnused to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosUnused to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosUnused to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosUnused struct { + obj *patternFlowIpv4TosUnused +} + +type unMarshalPatternFlowIpv4TosUnused interface { + // FromProto unmarshals PatternFlowIpv4TosUnused from protobuf object *otg.PatternFlowIpv4TosUnused + FromProto(msg *otg.PatternFlowIpv4TosUnused) (PatternFlowIpv4TosUnused, error) + // FromPbText unmarshals PatternFlowIpv4TosUnused from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosUnused from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosUnused from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosUnused) Marshal() marshalPatternFlowIpv4TosUnused { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosUnused{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosUnused) Unmarshal() unMarshalPatternFlowIpv4TosUnused { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosUnused{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosUnused) ToProto() (*otg.PatternFlowIpv4TosUnused, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosUnused) FromProto(msg *otg.PatternFlowIpv4TosUnused) (PatternFlowIpv4TosUnused, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosUnused) 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 *unMarshalpatternFlowIpv4TosUnused) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4TosUnused) 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 *unMarshalpatternFlowIpv4TosUnused) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4TosUnused) 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 *unMarshalpatternFlowIpv4TosUnused) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4TosUnused) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosUnused) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosUnused) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosUnused) Clone() (PatternFlowIpv4TosUnused, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosUnused() + 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 +} + +func (obj *patternFlowIpv4TosUnused) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4TosUnused is unused +type PatternFlowIpv4TosUnused interface { + Validation + // msg marshals PatternFlowIpv4TosUnused to protobuf object *otg.PatternFlowIpv4TosUnused + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosUnused + // setMsg unmarshals PatternFlowIpv4TosUnused from protobuf object *otg.PatternFlowIpv4TosUnused + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosUnused) PatternFlowIpv4TosUnused + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosUnused + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosUnused + // validate validates PatternFlowIpv4TosUnused + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosUnused, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4TosUnusedChoiceEnum, set in PatternFlowIpv4TosUnused + Choice() PatternFlowIpv4TosUnusedChoiceEnum + // setChoice assigns PatternFlowIpv4TosUnusedChoiceEnum provided by user to PatternFlowIpv4TosUnused + setChoice(value PatternFlowIpv4TosUnusedChoiceEnum) PatternFlowIpv4TosUnused + // HasChoice checks if Choice has been set in PatternFlowIpv4TosUnused + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4TosUnused. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4TosUnused + SetValue(value uint32) PatternFlowIpv4TosUnused + // HasValue checks if Value has been set in PatternFlowIpv4TosUnused + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4TosUnused. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4TosUnused + SetValues(value []uint32) PatternFlowIpv4TosUnused + // Increment returns PatternFlowIpv4TosUnusedCounter, set in PatternFlowIpv4TosUnused. + // PatternFlowIpv4TosUnusedCounter is integer counter pattern + Increment() PatternFlowIpv4TosUnusedCounter + // SetIncrement assigns PatternFlowIpv4TosUnusedCounter provided by user to PatternFlowIpv4TosUnused. + // PatternFlowIpv4TosUnusedCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4TosUnusedCounter) PatternFlowIpv4TosUnused + // HasIncrement checks if Increment has been set in PatternFlowIpv4TosUnused + HasIncrement() bool + // Decrement returns PatternFlowIpv4TosUnusedCounter, set in PatternFlowIpv4TosUnused. + // PatternFlowIpv4TosUnusedCounter is integer counter pattern + Decrement() PatternFlowIpv4TosUnusedCounter + // SetDecrement assigns PatternFlowIpv4TosUnusedCounter provided by user to PatternFlowIpv4TosUnused. + // PatternFlowIpv4TosUnusedCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4TosUnusedCounter) PatternFlowIpv4TosUnused + // HasDecrement checks if Decrement has been set in PatternFlowIpv4TosUnused + HasDecrement() bool + // MetricTags returns PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIterIter, set in PatternFlowIpv4TosUnused + MetricTags() PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter + setNil() +} + +type PatternFlowIpv4TosUnusedChoiceEnum string + +// Enum of Choice on PatternFlowIpv4TosUnused +var PatternFlowIpv4TosUnusedChoice = struct { + VALUE PatternFlowIpv4TosUnusedChoiceEnum + VALUES PatternFlowIpv4TosUnusedChoiceEnum + INCREMENT PatternFlowIpv4TosUnusedChoiceEnum + DECREMENT PatternFlowIpv4TosUnusedChoiceEnum +}{ + VALUE: PatternFlowIpv4TosUnusedChoiceEnum("value"), + VALUES: PatternFlowIpv4TosUnusedChoiceEnum("values"), + INCREMENT: PatternFlowIpv4TosUnusedChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4TosUnusedChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4TosUnused) Choice() PatternFlowIpv4TosUnusedChoiceEnum { + return PatternFlowIpv4TosUnusedChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4TosUnused) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4TosUnused) setChoice(value PatternFlowIpv4TosUnusedChoiceEnum) PatternFlowIpv4TosUnused { + intValue, ok := otg.PatternFlowIpv4TosUnused_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4TosUnusedChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4TosUnused_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4TosUnusedChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4TosUnusedChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4TosUnusedChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4TosUnusedCounter().msg() + } + + if value == PatternFlowIpv4TosUnusedChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4TosUnusedCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TosUnused) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4TosUnusedChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TosUnused) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4TosUnused object +func (obj *patternFlowIpv4TosUnused) SetValue(value uint32) PatternFlowIpv4TosUnused { + obj.setChoice(PatternFlowIpv4TosUnusedChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4TosUnused) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4TosUnused object +func (obj *patternFlowIpv4TosUnused) SetValues(value []uint32) PatternFlowIpv4TosUnused { + obj.setChoice(PatternFlowIpv4TosUnusedChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4TosUnusedCounter +func (obj *patternFlowIpv4TosUnused) Increment() PatternFlowIpv4TosUnusedCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4TosUnusedChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4TosUnusedCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4TosUnusedCounter +func (obj *patternFlowIpv4TosUnused) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4TosUnusedCounter value in the PatternFlowIpv4TosUnused object +func (obj *patternFlowIpv4TosUnused) SetIncrement(value PatternFlowIpv4TosUnusedCounter) PatternFlowIpv4TosUnused { + obj.setChoice(PatternFlowIpv4TosUnusedChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TosUnusedCounter +func (obj *patternFlowIpv4TosUnused) Decrement() PatternFlowIpv4TosUnusedCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4TosUnusedChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4TosUnusedCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TosUnusedCounter +func (obj *patternFlowIpv4TosUnused) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4TosUnusedCounter value in the PatternFlowIpv4TosUnused object +func (obj *patternFlowIpv4TosUnused) SetDecrement(value PatternFlowIpv4TosUnusedCounter) PatternFlowIpv4TosUnused { + obj.setChoice(PatternFlowIpv4TosUnusedChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4TosUnusedMetricTag +func (obj *patternFlowIpv4TosUnused) MetricTags() PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4TosUnusedMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter struct { + obj *patternFlowIpv4TosUnused + patternFlowIpv4TosUnusedMetricTagSlice []PatternFlowIpv4TosUnusedMetricTag + fieldPtr *[]*otg.PatternFlowIpv4TosUnusedMetricTag +} + +func newPatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter(ptr *[]*otg.PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { + return &patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter interface { + setMsg(*patternFlowIpv4TosUnused) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter + Items() []PatternFlowIpv4TosUnusedMetricTag + Add() PatternFlowIpv4TosUnusedMetricTag + Append(items ...PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter + Set(index int, newObj PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter + Clear() PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter + clearHolderSlice() PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter + appendHolderSlice(item PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter +} + +func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) setMsg(msg *patternFlowIpv4TosUnused) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4TosUnusedMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) Items() []PatternFlowIpv4TosUnusedMetricTag { + return obj.patternFlowIpv4TosUnusedMetricTagSlice +} + +func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) Add() PatternFlowIpv4TosUnusedMetricTag { + newObj := &otg.PatternFlowIpv4TosUnusedMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4TosUnusedMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4TosUnusedMetricTagSlice = append(obj.patternFlowIpv4TosUnusedMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) Append(items ...PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4TosUnusedMetricTagSlice = append(obj.patternFlowIpv4TosUnusedMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) Set(index int, newObj PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4TosUnusedMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) Clear() PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4TosUnusedMetricTag{} + obj.patternFlowIpv4TosUnusedMetricTagSlice = []PatternFlowIpv4TosUnusedMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) clearHolderSlice() PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { + if len(obj.patternFlowIpv4TosUnusedMetricTagSlice) > 0 { + obj.patternFlowIpv4TosUnusedMetricTagSlice = []PatternFlowIpv4TosUnusedMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter) appendHolderSlice(item PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedPatternFlowIpv4TosUnusedMetricTagIter { + obj.patternFlowIpv4TosUnusedMetricTagSlice = append(obj.patternFlowIpv4TosUnusedMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4TosUnused) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosUnused.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4TosUnused.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4TosUnusedMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4TosUnused) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4TosUnusedChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4TosUnusedChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4TosUnusedChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4TosUnusedChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4TosUnusedChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4TosUnusedChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TosUnused") + } + } else { + intVal := otg.PatternFlowIpv4TosUnused_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4TosUnused_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_unused_counter.go b/gosnappi/pattern_flow_ipv4_tos_unused_counter.go new file mode 100644 index 00000000..c140897d --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_unused_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4TosUnusedCounter ***** +type patternFlowIpv4TosUnusedCounter struct { + validation + obj *otg.PatternFlowIpv4TosUnusedCounter + marshaller marshalPatternFlowIpv4TosUnusedCounter + unMarshaller unMarshalPatternFlowIpv4TosUnusedCounter +} + +func NewPatternFlowIpv4TosUnusedCounter() PatternFlowIpv4TosUnusedCounter { + obj := patternFlowIpv4TosUnusedCounter{obj: &otg.PatternFlowIpv4TosUnusedCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosUnusedCounter) msg() *otg.PatternFlowIpv4TosUnusedCounter { + return obj.obj +} + +func (obj *patternFlowIpv4TosUnusedCounter) setMsg(msg *otg.PatternFlowIpv4TosUnusedCounter) PatternFlowIpv4TosUnusedCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosUnusedCounter struct { + obj *patternFlowIpv4TosUnusedCounter +} + +type marshalPatternFlowIpv4TosUnusedCounter interface { + // ToProto marshals PatternFlowIpv4TosUnusedCounter to protobuf object *otg.PatternFlowIpv4TosUnusedCounter + ToProto() (*otg.PatternFlowIpv4TosUnusedCounter, error) + // ToPbText marshals PatternFlowIpv4TosUnusedCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosUnusedCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosUnusedCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosUnusedCounter struct { + obj *patternFlowIpv4TosUnusedCounter +} + +type unMarshalPatternFlowIpv4TosUnusedCounter interface { + // FromProto unmarshals PatternFlowIpv4TosUnusedCounter from protobuf object *otg.PatternFlowIpv4TosUnusedCounter + FromProto(msg *otg.PatternFlowIpv4TosUnusedCounter) (PatternFlowIpv4TosUnusedCounter, error) + // FromPbText unmarshals PatternFlowIpv4TosUnusedCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosUnusedCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosUnusedCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosUnusedCounter) Marshal() marshalPatternFlowIpv4TosUnusedCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosUnusedCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosUnusedCounter) Unmarshal() unMarshalPatternFlowIpv4TosUnusedCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosUnusedCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosUnusedCounter) ToProto() (*otg.PatternFlowIpv4TosUnusedCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosUnusedCounter) FromProto(msg *otg.PatternFlowIpv4TosUnusedCounter) (PatternFlowIpv4TosUnusedCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosUnusedCounter) 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 *unMarshalpatternFlowIpv4TosUnusedCounter) 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 *marshalpatternFlowIpv4TosUnusedCounter) 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 *unMarshalpatternFlowIpv4TosUnusedCounter) 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 *marshalpatternFlowIpv4TosUnusedCounter) 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 *unMarshalpatternFlowIpv4TosUnusedCounter) 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 *patternFlowIpv4TosUnusedCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosUnusedCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosUnusedCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosUnusedCounter) Clone() (PatternFlowIpv4TosUnusedCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosUnusedCounter() + 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 +} + +// PatternFlowIpv4TosUnusedCounter is integer counter pattern +type PatternFlowIpv4TosUnusedCounter interface { + Validation + // msg marshals PatternFlowIpv4TosUnusedCounter to protobuf object *otg.PatternFlowIpv4TosUnusedCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosUnusedCounter + // setMsg unmarshals PatternFlowIpv4TosUnusedCounter from protobuf object *otg.PatternFlowIpv4TosUnusedCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosUnusedCounter) PatternFlowIpv4TosUnusedCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosUnusedCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosUnusedCounter + // validate validates PatternFlowIpv4TosUnusedCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosUnusedCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4TosUnusedCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4TosUnusedCounter + SetStart(value uint32) PatternFlowIpv4TosUnusedCounter + // HasStart checks if Start has been set in PatternFlowIpv4TosUnusedCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4TosUnusedCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4TosUnusedCounter + SetStep(value uint32) PatternFlowIpv4TosUnusedCounter + // HasStep checks if Step has been set in PatternFlowIpv4TosUnusedCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4TosUnusedCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4TosUnusedCounter + SetCount(value uint32) PatternFlowIpv4TosUnusedCounter + // HasCount checks if Count has been set in PatternFlowIpv4TosUnusedCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TosUnusedCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TosUnusedCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4TosUnusedCounter object +func (obj *patternFlowIpv4TosUnusedCounter) SetStart(value uint32) PatternFlowIpv4TosUnusedCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TosUnusedCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TosUnusedCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4TosUnusedCounter object +func (obj *patternFlowIpv4TosUnusedCounter) SetStep(value uint32) PatternFlowIpv4TosUnusedCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TosUnusedCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TosUnusedCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4TosUnusedCounter object +func (obj *patternFlowIpv4TosUnusedCounter) SetCount(value uint32) PatternFlowIpv4TosUnusedCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4TosUnusedCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosUnusedCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosUnusedCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosUnusedCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4TosUnusedCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_tos_unused_metric_tag.go b/gosnappi/pattern_flow_ipv4_tos_unused_metric_tag.go new file mode 100644 index 00000000..10a38833 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_tos_unused_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4TosUnusedMetricTag ***** +type patternFlowIpv4TosUnusedMetricTag struct { + validation + obj *otg.PatternFlowIpv4TosUnusedMetricTag + marshaller marshalPatternFlowIpv4TosUnusedMetricTag + unMarshaller unMarshalPatternFlowIpv4TosUnusedMetricTag +} + +func NewPatternFlowIpv4TosUnusedMetricTag() PatternFlowIpv4TosUnusedMetricTag { + obj := patternFlowIpv4TosUnusedMetricTag{obj: &otg.PatternFlowIpv4TosUnusedMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TosUnusedMetricTag) msg() *otg.PatternFlowIpv4TosUnusedMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4TosUnusedMetricTag) setMsg(msg *otg.PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TosUnusedMetricTag struct { + obj *patternFlowIpv4TosUnusedMetricTag +} + +type marshalPatternFlowIpv4TosUnusedMetricTag interface { + // ToProto marshals PatternFlowIpv4TosUnusedMetricTag to protobuf object *otg.PatternFlowIpv4TosUnusedMetricTag + ToProto() (*otg.PatternFlowIpv4TosUnusedMetricTag, error) + // ToPbText marshals PatternFlowIpv4TosUnusedMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TosUnusedMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TosUnusedMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TosUnusedMetricTag struct { + obj *patternFlowIpv4TosUnusedMetricTag +} + +type unMarshalPatternFlowIpv4TosUnusedMetricTag interface { + // FromProto unmarshals PatternFlowIpv4TosUnusedMetricTag from protobuf object *otg.PatternFlowIpv4TosUnusedMetricTag + FromProto(msg *otg.PatternFlowIpv4TosUnusedMetricTag) (PatternFlowIpv4TosUnusedMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4TosUnusedMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TosUnusedMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TosUnusedMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TosUnusedMetricTag) Marshal() marshalPatternFlowIpv4TosUnusedMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TosUnusedMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TosUnusedMetricTag) Unmarshal() unMarshalPatternFlowIpv4TosUnusedMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TosUnusedMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TosUnusedMetricTag) ToProto() (*otg.PatternFlowIpv4TosUnusedMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TosUnusedMetricTag) FromProto(msg *otg.PatternFlowIpv4TosUnusedMetricTag) (PatternFlowIpv4TosUnusedMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TosUnusedMetricTag) 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 *unMarshalpatternFlowIpv4TosUnusedMetricTag) 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 *marshalpatternFlowIpv4TosUnusedMetricTag) 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 *unMarshalpatternFlowIpv4TosUnusedMetricTag) 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 *marshalpatternFlowIpv4TosUnusedMetricTag) 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 *unMarshalpatternFlowIpv4TosUnusedMetricTag) 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 *patternFlowIpv4TosUnusedMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosUnusedMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TosUnusedMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TosUnusedMetricTag) Clone() (PatternFlowIpv4TosUnusedMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TosUnusedMetricTag() + 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 +} + +// PatternFlowIpv4TosUnusedMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4TosUnusedMetricTag interface { + Validation + // msg marshals PatternFlowIpv4TosUnusedMetricTag to protobuf object *otg.PatternFlowIpv4TosUnusedMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TosUnusedMetricTag + // setMsg unmarshals PatternFlowIpv4TosUnusedMetricTag from protobuf object *otg.PatternFlowIpv4TosUnusedMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TosUnusedMetricTag) PatternFlowIpv4TosUnusedMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4TosUnusedMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TosUnusedMetricTag + // validate validates PatternFlowIpv4TosUnusedMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TosUnusedMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4TosUnusedMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4TosUnusedMetricTag + SetName(value string) PatternFlowIpv4TosUnusedMetricTag + // Offset returns uint32, set in PatternFlowIpv4TosUnusedMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4TosUnusedMetricTag + SetOffset(value uint32) PatternFlowIpv4TosUnusedMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4TosUnusedMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4TosUnusedMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4TosUnusedMetricTag + SetLength(value uint32) PatternFlowIpv4TosUnusedMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4TosUnusedMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4TosUnusedMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4TosUnusedMetricTag object +func (obj *patternFlowIpv4TosUnusedMetricTag) SetName(value string) PatternFlowIpv4TosUnusedMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TosUnusedMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TosUnusedMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4TosUnusedMetricTag object +func (obj *patternFlowIpv4TosUnusedMetricTag) SetOffset(value uint32) PatternFlowIpv4TosUnusedMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TosUnusedMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TosUnusedMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4TosUnusedMetricTag object +func (obj *patternFlowIpv4TosUnusedMetricTag) SetLength(value uint32) PatternFlowIpv4TosUnusedMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4TosUnusedMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TosUnusedMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TosUnusedMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4TosUnusedMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4TosUnusedMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_total_length.go b/gosnappi/pattern_flow_ipv4_total_length.go new file mode 100644 index 00000000..6a90c1a9 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_total_length.go @@ -0,0 +1,712 @@ +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" +) + +// ***** PatternFlowIpv4TotalLength ***** +type patternFlowIpv4TotalLength struct { + validation + obj *otg.PatternFlowIpv4TotalLength + marshaller marshalPatternFlowIpv4TotalLength + unMarshaller unMarshalPatternFlowIpv4TotalLength + incrementHolder PatternFlowIpv4TotalLengthCounter + decrementHolder PatternFlowIpv4TotalLengthCounter + metricTagsHolder PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter +} + +func NewPatternFlowIpv4TotalLength() PatternFlowIpv4TotalLength { + obj := patternFlowIpv4TotalLength{obj: &otg.PatternFlowIpv4TotalLength{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TotalLength) msg() *otg.PatternFlowIpv4TotalLength { + return obj.obj +} + +func (obj *patternFlowIpv4TotalLength) setMsg(msg *otg.PatternFlowIpv4TotalLength) PatternFlowIpv4TotalLength { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TotalLength struct { + obj *patternFlowIpv4TotalLength +} + +type marshalPatternFlowIpv4TotalLength interface { + // ToProto marshals PatternFlowIpv4TotalLength to protobuf object *otg.PatternFlowIpv4TotalLength + ToProto() (*otg.PatternFlowIpv4TotalLength, error) + // ToPbText marshals PatternFlowIpv4TotalLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TotalLength to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TotalLength to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TotalLength struct { + obj *patternFlowIpv4TotalLength +} + +type unMarshalPatternFlowIpv4TotalLength interface { + // FromProto unmarshals PatternFlowIpv4TotalLength from protobuf object *otg.PatternFlowIpv4TotalLength + FromProto(msg *otg.PatternFlowIpv4TotalLength) (PatternFlowIpv4TotalLength, error) + // FromPbText unmarshals PatternFlowIpv4TotalLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TotalLength from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TotalLength from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TotalLength) Marshal() marshalPatternFlowIpv4TotalLength { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TotalLength{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TotalLength) Unmarshal() unMarshalPatternFlowIpv4TotalLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TotalLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TotalLength) ToProto() (*otg.PatternFlowIpv4TotalLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TotalLength) FromProto(msg *otg.PatternFlowIpv4TotalLength) (PatternFlowIpv4TotalLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TotalLength) 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 *unMarshalpatternFlowIpv4TotalLength) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4TotalLength) 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 *unMarshalpatternFlowIpv4TotalLength) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4TotalLength) 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 *unMarshalpatternFlowIpv4TotalLength) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4TotalLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TotalLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TotalLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TotalLength) Clone() (PatternFlowIpv4TotalLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TotalLength() + 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 +} + +func (obj *patternFlowIpv4TotalLength) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4TotalLength is total length +type PatternFlowIpv4TotalLength interface { + Validation + // msg marshals PatternFlowIpv4TotalLength to protobuf object *otg.PatternFlowIpv4TotalLength + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TotalLength + // setMsg unmarshals PatternFlowIpv4TotalLength from protobuf object *otg.PatternFlowIpv4TotalLength + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TotalLength) PatternFlowIpv4TotalLength + // provides marshal interface + Marshal() marshalPatternFlowIpv4TotalLength + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TotalLength + // validate validates PatternFlowIpv4TotalLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TotalLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4TotalLengthChoiceEnum, set in PatternFlowIpv4TotalLength + Choice() PatternFlowIpv4TotalLengthChoiceEnum + // setChoice assigns PatternFlowIpv4TotalLengthChoiceEnum provided by user to PatternFlowIpv4TotalLength + setChoice(value PatternFlowIpv4TotalLengthChoiceEnum) PatternFlowIpv4TotalLength + // HasChoice checks if Choice has been set in PatternFlowIpv4TotalLength + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4TotalLength. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4TotalLength + SetValue(value uint32) PatternFlowIpv4TotalLength + // HasValue checks if Value has been set in PatternFlowIpv4TotalLength + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4TotalLength. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4TotalLength + SetValues(value []uint32) PatternFlowIpv4TotalLength + // Auto returns uint32, set in PatternFlowIpv4TotalLength. + Auto() uint32 + // HasAuto checks if Auto has been set in PatternFlowIpv4TotalLength + HasAuto() bool + // Increment returns PatternFlowIpv4TotalLengthCounter, set in PatternFlowIpv4TotalLength. + // PatternFlowIpv4TotalLengthCounter is integer counter pattern + Increment() PatternFlowIpv4TotalLengthCounter + // SetIncrement assigns PatternFlowIpv4TotalLengthCounter provided by user to PatternFlowIpv4TotalLength. + // PatternFlowIpv4TotalLengthCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4TotalLengthCounter) PatternFlowIpv4TotalLength + // HasIncrement checks if Increment has been set in PatternFlowIpv4TotalLength + HasIncrement() bool + // Decrement returns PatternFlowIpv4TotalLengthCounter, set in PatternFlowIpv4TotalLength. + // PatternFlowIpv4TotalLengthCounter is integer counter pattern + Decrement() PatternFlowIpv4TotalLengthCounter + // SetDecrement assigns PatternFlowIpv4TotalLengthCounter provided by user to PatternFlowIpv4TotalLength. + // PatternFlowIpv4TotalLengthCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4TotalLengthCounter) PatternFlowIpv4TotalLength + // HasDecrement checks if Decrement has been set in PatternFlowIpv4TotalLength + HasDecrement() bool + // MetricTags returns PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIterIter, set in PatternFlowIpv4TotalLength + MetricTags() PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter + setNil() +} + +type PatternFlowIpv4TotalLengthChoiceEnum string + +// Enum of Choice on PatternFlowIpv4TotalLength +var PatternFlowIpv4TotalLengthChoice = struct { + VALUE PatternFlowIpv4TotalLengthChoiceEnum + VALUES PatternFlowIpv4TotalLengthChoiceEnum + AUTO PatternFlowIpv4TotalLengthChoiceEnum + INCREMENT PatternFlowIpv4TotalLengthChoiceEnum + DECREMENT PatternFlowIpv4TotalLengthChoiceEnum +}{ + VALUE: PatternFlowIpv4TotalLengthChoiceEnum("value"), + VALUES: PatternFlowIpv4TotalLengthChoiceEnum("values"), + AUTO: PatternFlowIpv4TotalLengthChoiceEnum("auto"), + INCREMENT: PatternFlowIpv4TotalLengthChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4TotalLengthChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4TotalLength) Choice() PatternFlowIpv4TotalLengthChoiceEnum { + return PatternFlowIpv4TotalLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4TotalLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4TotalLength) setChoice(value PatternFlowIpv4TotalLengthChoiceEnum) PatternFlowIpv4TotalLength { + intValue, ok := otg.PatternFlowIpv4TotalLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4TotalLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4TotalLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Auto = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4TotalLengthChoice.VALUE { + defaultValue := uint32(46) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4TotalLengthChoice.VALUES { + defaultValue := []uint32{46} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4TotalLengthChoice.AUTO { + defaultValue := uint32(46) + obj.obj.Auto = &defaultValue + } + + if value == PatternFlowIpv4TotalLengthChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4TotalLengthCounter().msg() + } + + if value == PatternFlowIpv4TotalLengthChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4TotalLengthCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TotalLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4TotalLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4TotalLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4TotalLength object +func (obj *patternFlowIpv4TotalLength) SetValue(value uint32) PatternFlowIpv4TotalLength { + obj.setChoice(PatternFlowIpv4TotalLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4TotalLength) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{46}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4TotalLength object +func (obj *patternFlowIpv4TotalLength) SetValues(value []uint32) PatternFlowIpv4TotalLength { + obj.setChoice(PatternFlowIpv4TotalLengthChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowIpv4TotalLength) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(PatternFlowIpv4TotalLengthChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowIpv4TotalLength) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Increment returns a PatternFlowIpv4TotalLengthCounter +func (obj *patternFlowIpv4TotalLength) Increment() PatternFlowIpv4TotalLengthCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4TotalLengthChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4TotalLengthCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4TotalLengthCounter +func (obj *patternFlowIpv4TotalLength) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4TotalLengthCounter value in the PatternFlowIpv4TotalLength object +func (obj *patternFlowIpv4TotalLength) SetIncrement(value PatternFlowIpv4TotalLengthCounter) PatternFlowIpv4TotalLength { + obj.setChoice(PatternFlowIpv4TotalLengthChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TotalLengthCounter +func (obj *patternFlowIpv4TotalLength) Decrement() PatternFlowIpv4TotalLengthCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4TotalLengthChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4TotalLengthCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4TotalLengthCounter +func (obj *patternFlowIpv4TotalLength) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4TotalLengthCounter value in the PatternFlowIpv4TotalLength object +func (obj *patternFlowIpv4TotalLength) SetDecrement(value PatternFlowIpv4TotalLengthCounter) PatternFlowIpv4TotalLength { + obj.setChoice(PatternFlowIpv4TotalLengthChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4TotalLengthMetricTag +func (obj *patternFlowIpv4TotalLength) MetricTags() PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4TotalLengthMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter struct { + obj *patternFlowIpv4TotalLength + patternFlowIpv4TotalLengthMetricTagSlice []PatternFlowIpv4TotalLengthMetricTag + fieldPtr *[]*otg.PatternFlowIpv4TotalLengthMetricTag +} + +func newPatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter(ptr *[]*otg.PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { + return &patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter interface { + setMsg(*patternFlowIpv4TotalLength) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter + Items() []PatternFlowIpv4TotalLengthMetricTag + Add() PatternFlowIpv4TotalLengthMetricTag + Append(items ...PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter + Set(index int, newObj PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter + Clear() PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter + clearHolderSlice() PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter + appendHolderSlice(item PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter +} + +func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) setMsg(msg *patternFlowIpv4TotalLength) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4TotalLengthMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) Items() []PatternFlowIpv4TotalLengthMetricTag { + return obj.patternFlowIpv4TotalLengthMetricTagSlice +} + +func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) Add() PatternFlowIpv4TotalLengthMetricTag { + newObj := &otg.PatternFlowIpv4TotalLengthMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4TotalLengthMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4TotalLengthMetricTagSlice = append(obj.patternFlowIpv4TotalLengthMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) Append(items ...PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4TotalLengthMetricTagSlice = append(obj.patternFlowIpv4TotalLengthMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) Set(index int, newObj PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4TotalLengthMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) Clear() PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4TotalLengthMetricTag{} + obj.patternFlowIpv4TotalLengthMetricTagSlice = []PatternFlowIpv4TotalLengthMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) clearHolderSlice() PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { + if len(obj.patternFlowIpv4TotalLengthMetricTagSlice) > 0 { + obj.patternFlowIpv4TotalLengthMetricTagSlice = []PatternFlowIpv4TotalLengthMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter) appendHolderSlice(item PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthPatternFlowIpv4TotalLengthMetricTagIter { + obj.patternFlowIpv4TotalLengthMetricTagSlice = append(obj.patternFlowIpv4TotalLengthMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4TotalLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TotalLength.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4TotalLength.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Auto != nil { + + if *obj.obj.Auto > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TotalLength.Auto <= 65535 but Got %d", *obj.obj.Auto)) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4TotalLengthMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4TotalLength) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4TotalLengthChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4TotalLengthChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4TotalLengthChoice.VALUES + } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowIpv4TotalLengthChoice.AUTO + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4TotalLengthChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4TotalLengthChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4TotalLengthChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4TotalLength") + } + } else { + intVal := otg.PatternFlowIpv4TotalLength_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4TotalLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_total_length_counter.go b/gosnappi/pattern_flow_ipv4_total_length_counter.go new file mode 100644 index 00000000..a08dd3de --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_total_length_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4TotalLengthCounter ***** +type patternFlowIpv4TotalLengthCounter struct { + validation + obj *otg.PatternFlowIpv4TotalLengthCounter + marshaller marshalPatternFlowIpv4TotalLengthCounter + unMarshaller unMarshalPatternFlowIpv4TotalLengthCounter +} + +func NewPatternFlowIpv4TotalLengthCounter() PatternFlowIpv4TotalLengthCounter { + obj := patternFlowIpv4TotalLengthCounter{obj: &otg.PatternFlowIpv4TotalLengthCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TotalLengthCounter) msg() *otg.PatternFlowIpv4TotalLengthCounter { + return obj.obj +} + +func (obj *patternFlowIpv4TotalLengthCounter) setMsg(msg *otg.PatternFlowIpv4TotalLengthCounter) PatternFlowIpv4TotalLengthCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TotalLengthCounter struct { + obj *patternFlowIpv4TotalLengthCounter +} + +type marshalPatternFlowIpv4TotalLengthCounter interface { + // ToProto marshals PatternFlowIpv4TotalLengthCounter to protobuf object *otg.PatternFlowIpv4TotalLengthCounter + ToProto() (*otg.PatternFlowIpv4TotalLengthCounter, error) + // ToPbText marshals PatternFlowIpv4TotalLengthCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TotalLengthCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TotalLengthCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TotalLengthCounter struct { + obj *patternFlowIpv4TotalLengthCounter +} + +type unMarshalPatternFlowIpv4TotalLengthCounter interface { + // FromProto unmarshals PatternFlowIpv4TotalLengthCounter from protobuf object *otg.PatternFlowIpv4TotalLengthCounter + FromProto(msg *otg.PatternFlowIpv4TotalLengthCounter) (PatternFlowIpv4TotalLengthCounter, error) + // FromPbText unmarshals PatternFlowIpv4TotalLengthCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TotalLengthCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TotalLengthCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TotalLengthCounter) Marshal() marshalPatternFlowIpv4TotalLengthCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TotalLengthCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TotalLengthCounter) Unmarshal() unMarshalPatternFlowIpv4TotalLengthCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TotalLengthCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TotalLengthCounter) ToProto() (*otg.PatternFlowIpv4TotalLengthCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TotalLengthCounter) FromProto(msg *otg.PatternFlowIpv4TotalLengthCounter) (PatternFlowIpv4TotalLengthCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TotalLengthCounter) 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 *unMarshalpatternFlowIpv4TotalLengthCounter) 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 *marshalpatternFlowIpv4TotalLengthCounter) 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 *unMarshalpatternFlowIpv4TotalLengthCounter) 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 *marshalpatternFlowIpv4TotalLengthCounter) 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 *unMarshalpatternFlowIpv4TotalLengthCounter) 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 *patternFlowIpv4TotalLengthCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TotalLengthCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TotalLengthCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TotalLengthCounter) Clone() (PatternFlowIpv4TotalLengthCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TotalLengthCounter() + 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 +} + +// PatternFlowIpv4TotalLengthCounter is integer counter pattern +type PatternFlowIpv4TotalLengthCounter interface { + Validation + // msg marshals PatternFlowIpv4TotalLengthCounter to protobuf object *otg.PatternFlowIpv4TotalLengthCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TotalLengthCounter + // setMsg unmarshals PatternFlowIpv4TotalLengthCounter from protobuf object *otg.PatternFlowIpv4TotalLengthCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TotalLengthCounter) PatternFlowIpv4TotalLengthCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4TotalLengthCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TotalLengthCounter + // validate validates PatternFlowIpv4TotalLengthCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TotalLengthCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4TotalLengthCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4TotalLengthCounter + SetStart(value uint32) PatternFlowIpv4TotalLengthCounter + // HasStart checks if Start has been set in PatternFlowIpv4TotalLengthCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4TotalLengthCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4TotalLengthCounter + SetStep(value uint32) PatternFlowIpv4TotalLengthCounter + // HasStep checks if Step has been set in PatternFlowIpv4TotalLengthCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4TotalLengthCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4TotalLengthCounter + SetCount(value uint32) PatternFlowIpv4TotalLengthCounter + // HasCount checks if Count has been set in PatternFlowIpv4TotalLengthCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TotalLengthCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4TotalLengthCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4TotalLengthCounter object +func (obj *patternFlowIpv4TotalLengthCounter) SetStart(value uint32) PatternFlowIpv4TotalLengthCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TotalLengthCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4TotalLengthCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4TotalLengthCounter object +func (obj *patternFlowIpv4TotalLengthCounter) SetStep(value uint32) PatternFlowIpv4TotalLengthCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TotalLengthCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4TotalLengthCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4TotalLengthCounter object +func (obj *patternFlowIpv4TotalLengthCounter) SetCount(value uint32) PatternFlowIpv4TotalLengthCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4TotalLengthCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TotalLengthCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TotalLengthCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TotalLengthCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4TotalLengthCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(46) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_total_length_metric_tag.go b/gosnappi/pattern_flow_ipv4_total_length_metric_tag.go new file mode 100644 index 00000000..0e7550d2 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_total_length_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4TotalLengthMetricTag ***** +type patternFlowIpv4TotalLengthMetricTag struct { + validation + obj *otg.PatternFlowIpv4TotalLengthMetricTag + marshaller marshalPatternFlowIpv4TotalLengthMetricTag + unMarshaller unMarshalPatternFlowIpv4TotalLengthMetricTag +} + +func NewPatternFlowIpv4TotalLengthMetricTag() PatternFlowIpv4TotalLengthMetricTag { + obj := patternFlowIpv4TotalLengthMetricTag{obj: &otg.PatternFlowIpv4TotalLengthMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4TotalLengthMetricTag) msg() *otg.PatternFlowIpv4TotalLengthMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4TotalLengthMetricTag) setMsg(msg *otg.PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4TotalLengthMetricTag struct { + obj *patternFlowIpv4TotalLengthMetricTag +} + +type marshalPatternFlowIpv4TotalLengthMetricTag interface { + // ToProto marshals PatternFlowIpv4TotalLengthMetricTag to protobuf object *otg.PatternFlowIpv4TotalLengthMetricTag + ToProto() (*otg.PatternFlowIpv4TotalLengthMetricTag, error) + // ToPbText marshals PatternFlowIpv4TotalLengthMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4TotalLengthMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4TotalLengthMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4TotalLengthMetricTag struct { + obj *patternFlowIpv4TotalLengthMetricTag +} + +type unMarshalPatternFlowIpv4TotalLengthMetricTag interface { + // FromProto unmarshals PatternFlowIpv4TotalLengthMetricTag from protobuf object *otg.PatternFlowIpv4TotalLengthMetricTag + FromProto(msg *otg.PatternFlowIpv4TotalLengthMetricTag) (PatternFlowIpv4TotalLengthMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4TotalLengthMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4TotalLengthMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4TotalLengthMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4TotalLengthMetricTag) Marshal() marshalPatternFlowIpv4TotalLengthMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4TotalLengthMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4TotalLengthMetricTag) Unmarshal() unMarshalPatternFlowIpv4TotalLengthMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4TotalLengthMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4TotalLengthMetricTag) ToProto() (*otg.PatternFlowIpv4TotalLengthMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4TotalLengthMetricTag) FromProto(msg *otg.PatternFlowIpv4TotalLengthMetricTag) (PatternFlowIpv4TotalLengthMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4TotalLengthMetricTag) 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 *unMarshalpatternFlowIpv4TotalLengthMetricTag) 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 *marshalpatternFlowIpv4TotalLengthMetricTag) 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 *unMarshalpatternFlowIpv4TotalLengthMetricTag) 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 *marshalpatternFlowIpv4TotalLengthMetricTag) 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 *unMarshalpatternFlowIpv4TotalLengthMetricTag) 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 *patternFlowIpv4TotalLengthMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TotalLengthMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4TotalLengthMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4TotalLengthMetricTag) Clone() (PatternFlowIpv4TotalLengthMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4TotalLengthMetricTag() + 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 +} + +// PatternFlowIpv4TotalLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4TotalLengthMetricTag interface { + Validation + // msg marshals PatternFlowIpv4TotalLengthMetricTag to protobuf object *otg.PatternFlowIpv4TotalLengthMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4TotalLengthMetricTag + // setMsg unmarshals PatternFlowIpv4TotalLengthMetricTag from protobuf object *otg.PatternFlowIpv4TotalLengthMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4TotalLengthMetricTag) PatternFlowIpv4TotalLengthMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4TotalLengthMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4TotalLengthMetricTag + // validate validates PatternFlowIpv4TotalLengthMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4TotalLengthMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4TotalLengthMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4TotalLengthMetricTag + SetName(value string) PatternFlowIpv4TotalLengthMetricTag + // Offset returns uint32, set in PatternFlowIpv4TotalLengthMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4TotalLengthMetricTag + SetOffset(value uint32) PatternFlowIpv4TotalLengthMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4TotalLengthMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4TotalLengthMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4TotalLengthMetricTag + SetLength(value uint32) PatternFlowIpv4TotalLengthMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4TotalLengthMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4TotalLengthMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4TotalLengthMetricTag object +func (obj *patternFlowIpv4TotalLengthMetricTag) SetName(value string) PatternFlowIpv4TotalLengthMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TotalLengthMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4TotalLengthMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4TotalLengthMetricTag object +func (obj *patternFlowIpv4TotalLengthMetricTag) SetOffset(value uint32) PatternFlowIpv4TotalLengthMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TotalLengthMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4TotalLengthMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4TotalLengthMetricTag object +func (obj *patternFlowIpv4TotalLengthMetricTag) SetLength(value uint32) PatternFlowIpv4TotalLengthMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4TotalLengthMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4TotalLengthMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4TotalLengthMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4TotalLengthMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4TotalLengthMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_version.go b/gosnappi/pattern_flow_ipv4_version.go new file mode 100644 index 00000000..3f6d3ff2 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_version.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv4Version ***** +type patternFlowIpv4Version struct { + validation + obj *otg.PatternFlowIpv4Version + marshaller marshalPatternFlowIpv4Version + unMarshaller unMarshalPatternFlowIpv4Version + incrementHolder PatternFlowIpv4VersionCounter + decrementHolder PatternFlowIpv4VersionCounter + metricTagsHolder PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter +} + +func NewPatternFlowIpv4Version() PatternFlowIpv4Version { + obj := patternFlowIpv4Version{obj: &otg.PatternFlowIpv4Version{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4Version) msg() *otg.PatternFlowIpv4Version { + return obj.obj +} + +func (obj *patternFlowIpv4Version) setMsg(msg *otg.PatternFlowIpv4Version) PatternFlowIpv4Version { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4Version struct { + obj *patternFlowIpv4Version +} + +type marshalPatternFlowIpv4Version interface { + // ToProto marshals PatternFlowIpv4Version to protobuf object *otg.PatternFlowIpv4Version + ToProto() (*otg.PatternFlowIpv4Version, error) + // ToPbText marshals PatternFlowIpv4Version to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4Version to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4Version to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4Version struct { + obj *patternFlowIpv4Version +} + +type unMarshalPatternFlowIpv4Version interface { + // FromProto unmarshals PatternFlowIpv4Version from protobuf object *otg.PatternFlowIpv4Version + FromProto(msg *otg.PatternFlowIpv4Version) (PatternFlowIpv4Version, error) + // FromPbText unmarshals PatternFlowIpv4Version from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4Version from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4Version from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4Version) Marshal() marshalPatternFlowIpv4Version { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4Version{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4Version) Unmarshal() unMarshalPatternFlowIpv4Version { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4Version{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4Version) ToProto() (*otg.PatternFlowIpv4Version, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4Version) FromProto(msg *otg.PatternFlowIpv4Version) (PatternFlowIpv4Version, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4Version) 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 *unMarshalpatternFlowIpv4Version) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv4Version) 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 *unMarshalpatternFlowIpv4Version) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv4Version) 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 *unMarshalpatternFlowIpv4Version) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv4Version) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4Version) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4Version) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4Version) Clone() (PatternFlowIpv4Version, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4Version() + 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 +} + +func (obj *patternFlowIpv4Version) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv4Version is version +type PatternFlowIpv4Version interface { + Validation + // msg marshals PatternFlowIpv4Version to protobuf object *otg.PatternFlowIpv4Version + // and doesn't set defaults + msg() *otg.PatternFlowIpv4Version + // setMsg unmarshals PatternFlowIpv4Version from protobuf object *otg.PatternFlowIpv4Version + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4Version) PatternFlowIpv4Version + // provides marshal interface + Marshal() marshalPatternFlowIpv4Version + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4Version + // validate validates PatternFlowIpv4Version + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4Version, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv4VersionChoiceEnum, set in PatternFlowIpv4Version + Choice() PatternFlowIpv4VersionChoiceEnum + // setChoice assigns PatternFlowIpv4VersionChoiceEnum provided by user to PatternFlowIpv4Version + setChoice(value PatternFlowIpv4VersionChoiceEnum) PatternFlowIpv4Version + // HasChoice checks if Choice has been set in PatternFlowIpv4Version + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv4Version. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv4Version + SetValue(value uint32) PatternFlowIpv4Version + // HasValue checks if Value has been set in PatternFlowIpv4Version + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv4Version. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv4Version + SetValues(value []uint32) PatternFlowIpv4Version + // Increment returns PatternFlowIpv4VersionCounter, set in PatternFlowIpv4Version. + // PatternFlowIpv4VersionCounter is integer counter pattern + Increment() PatternFlowIpv4VersionCounter + // SetIncrement assigns PatternFlowIpv4VersionCounter provided by user to PatternFlowIpv4Version. + // PatternFlowIpv4VersionCounter is integer counter pattern + SetIncrement(value PatternFlowIpv4VersionCounter) PatternFlowIpv4Version + // HasIncrement checks if Increment has been set in PatternFlowIpv4Version + HasIncrement() bool + // Decrement returns PatternFlowIpv4VersionCounter, set in PatternFlowIpv4Version. + // PatternFlowIpv4VersionCounter is integer counter pattern + Decrement() PatternFlowIpv4VersionCounter + // SetDecrement assigns PatternFlowIpv4VersionCounter provided by user to PatternFlowIpv4Version. + // PatternFlowIpv4VersionCounter is integer counter pattern + SetDecrement(value PatternFlowIpv4VersionCounter) PatternFlowIpv4Version + // HasDecrement checks if Decrement has been set in PatternFlowIpv4Version + HasDecrement() bool + // MetricTags returns PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIterIter, set in PatternFlowIpv4Version + MetricTags() PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter + setNil() +} + +type PatternFlowIpv4VersionChoiceEnum string + +// Enum of Choice on PatternFlowIpv4Version +var PatternFlowIpv4VersionChoice = struct { + VALUE PatternFlowIpv4VersionChoiceEnum + VALUES PatternFlowIpv4VersionChoiceEnum + INCREMENT PatternFlowIpv4VersionChoiceEnum + DECREMENT PatternFlowIpv4VersionChoiceEnum +}{ + VALUE: PatternFlowIpv4VersionChoiceEnum("value"), + VALUES: PatternFlowIpv4VersionChoiceEnum("values"), + INCREMENT: PatternFlowIpv4VersionChoiceEnum("increment"), + DECREMENT: PatternFlowIpv4VersionChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv4Version) Choice() PatternFlowIpv4VersionChoiceEnum { + return PatternFlowIpv4VersionChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv4Version) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv4Version) setChoice(value PatternFlowIpv4VersionChoiceEnum) PatternFlowIpv4Version { + intValue, ok := otg.PatternFlowIpv4Version_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv4VersionChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv4Version_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv4VersionChoice.VALUE { + defaultValue := uint32(4) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv4VersionChoice.VALUES { + defaultValue := []uint32{4} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv4VersionChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv4VersionCounter().msg() + } + + if value == PatternFlowIpv4VersionChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv4VersionCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4Version) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv4VersionChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv4Version) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv4Version object +func (obj *patternFlowIpv4Version) SetValue(value uint32) PatternFlowIpv4Version { + obj.setChoice(PatternFlowIpv4VersionChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv4Version) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{4}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv4Version object +func (obj *patternFlowIpv4Version) SetValues(value []uint32) PatternFlowIpv4Version { + obj.setChoice(PatternFlowIpv4VersionChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv4VersionCounter +func (obj *patternFlowIpv4Version) Increment() PatternFlowIpv4VersionCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv4VersionChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv4VersionCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv4VersionCounter +func (obj *patternFlowIpv4Version) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv4VersionCounter value in the PatternFlowIpv4Version object +func (obj *patternFlowIpv4Version) SetIncrement(value PatternFlowIpv4VersionCounter) PatternFlowIpv4Version { + obj.setChoice(PatternFlowIpv4VersionChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv4VersionCounter +func (obj *patternFlowIpv4Version) Decrement() PatternFlowIpv4VersionCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv4VersionChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv4VersionCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv4VersionCounter +func (obj *patternFlowIpv4Version) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv4VersionCounter value in the PatternFlowIpv4Version object +func (obj *patternFlowIpv4Version) SetDecrement(value PatternFlowIpv4VersionCounter) PatternFlowIpv4Version { + obj.setChoice(PatternFlowIpv4VersionChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv4VersionMetricTag +func (obj *patternFlowIpv4Version) MetricTags() PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv4VersionMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter struct { + obj *patternFlowIpv4Version + patternFlowIpv4VersionMetricTagSlice []PatternFlowIpv4VersionMetricTag + fieldPtr *[]*otg.PatternFlowIpv4VersionMetricTag +} + +func newPatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter(ptr *[]*otg.PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { + return &patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter interface { + setMsg(*patternFlowIpv4Version) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter + Items() []PatternFlowIpv4VersionMetricTag + Add() PatternFlowIpv4VersionMetricTag + Append(items ...PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter + Set(index int, newObj PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter + Clear() PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter + clearHolderSlice() PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter + appendHolderSlice(item PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter +} + +func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) setMsg(msg *patternFlowIpv4Version) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv4VersionMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) Items() []PatternFlowIpv4VersionMetricTag { + return obj.patternFlowIpv4VersionMetricTagSlice +} + +func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) Add() PatternFlowIpv4VersionMetricTag { + newObj := &otg.PatternFlowIpv4VersionMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv4VersionMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv4VersionMetricTagSlice = append(obj.patternFlowIpv4VersionMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) Append(items ...PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv4VersionMetricTagSlice = append(obj.patternFlowIpv4VersionMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) Set(index int, newObj PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv4VersionMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) Clear() PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv4VersionMetricTag{} + obj.patternFlowIpv4VersionMetricTagSlice = []PatternFlowIpv4VersionMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) clearHolderSlice() PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { + if len(obj.patternFlowIpv4VersionMetricTagSlice) > 0 { + obj.patternFlowIpv4VersionMetricTagSlice = []PatternFlowIpv4VersionMetricTag{} + } + return obj +} +func (obj *patternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter) appendHolderSlice(item PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionPatternFlowIpv4VersionMetricTagIter { + obj.patternFlowIpv4VersionMetricTagSlice = append(obj.patternFlowIpv4VersionMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv4Version) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4Version.Value <= 15 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv4Version.Values <= 15 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv4VersionMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv4Version) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv4VersionChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv4VersionChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv4VersionChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv4VersionChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv4VersionChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv4VersionChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv4Version") + } + } else { + intVal := otg.PatternFlowIpv4Version_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv4Version_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv4_version_counter.go b/gosnappi/pattern_flow_ipv4_version_counter.go new file mode 100644 index 00000000..ec9e1a64 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_version_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv4VersionCounter ***** +type patternFlowIpv4VersionCounter struct { + validation + obj *otg.PatternFlowIpv4VersionCounter + marshaller marshalPatternFlowIpv4VersionCounter + unMarshaller unMarshalPatternFlowIpv4VersionCounter +} + +func NewPatternFlowIpv4VersionCounter() PatternFlowIpv4VersionCounter { + obj := patternFlowIpv4VersionCounter{obj: &otg.PatternFlowIpv4VersionCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4VersionCounter) msg() *otg.PatternFlowIpv4VersionCounter { + return obj.obj +} + +func (obj *patternFlowIpv4VersionCounter) setMsg(msg *otg.PatternFlowIpv4VersionCounter) PatternFlowIpv4VersionCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4VersionCounter struct { + obj *patternFlowIpv4VersionCounter +} + +type marshalPatternFlowIpv4VersionCounter interface { + // ToProto marshals PatternFlowIpv4VersionCounter to protobuf object *otg.PatternFlowIpv4VersionCounter + ToProto() (*otg.PatternFlowIpv4VersionCounter, error) + // ToPbText marshals PatternFlowIpv4VersionCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4VersionCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4VersionCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4VersionCounter struct { + obj *patternFlowIpv4VersionCounter +} + +type unMarshalPatternFlowIpv4VersionCounter interface { + // FromProto unmarshals PatternFlowIpv4VersionCounter from protobuf object *otg.PatternFlowIpv4VersionCounter + FromProto(msg *otg.PatternFlowIpv4VersionCounter) (PatternFlowIpv4VersionCounter, error) + // FromPbText unmarshals PatternFlowIpv4VersionCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4VersionCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4VersionCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4VersionCounter) Marshal() marshalPatternFlowIpv4VersionCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4VersionCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4VersionCounter) Unmarshal() unMarshalPatternFlowIpv4VersionCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4VersionCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4VersionCounter) ToProto() (*otg.PatternFlowIpv4VersionCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4VersionCounter) FromProto(msg *otg.PatternFlowIpv4VersionCounter) (PatternFlowIpv4VersionCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4VersionCounter) 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 *unMarshalpatternFlowIpv4VersionCounter) 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 *marshalpatternFlowIpv4VersionCounter) 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 *unMarshalpatternFlowIpv4VersionCounter) 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 *marshalpatternFlowIpv4VersionCounter) 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 *unMarshalpatternFlowIpv4VersionCounter) 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 *patternFlowIpv4VersionCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4VersionCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4VersionCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4VersionCounter) Clone() (PatternFlowIpv4VersionCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4VersionCounter() + 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 +} + +// PatternFlowIpv4VersionCounter is integer counter pattern +type PatternFlowIpv4VersionCounter interface { + Validation + // msg marshals PatternFlowIpv4VersionCounter to protobuf object *otg.PatternFlowIpv4VersionCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv4VersionCounter + // setMsg unmarshals PatternFlowIpv4VersionCounter from protobuf object *otg.PatternFlowIpv4VersionCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4VersionCounter) PatternFlowIpv4VersionCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv4VersionCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4VersionCounter + // validate validates PatternFlowIpv4VersionCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4VersionCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv4VersionCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv4VersionCounter + SetStart(value uint32) PatternFlowIpv4VersionCounter + // HasStart checks if Start has been set in PatternFlowIpv4VersionCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv4VersionCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv4VersionCounter + SetStep(value uint32) PatternFlowIpv4VersionCounter + // HasStep checks if Step has been set in PatternFlowIpv4VersionCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv4VersionCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv4VersionCounter + SetCount(value uint32) PatternFlowIpv4VersionCounter + // HasCount checks if Count has been set in PatternFlowIpv4VersionCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4VersionCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv4VersionCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv4VersionCounter object +func (obj *patternFlowIpv4VersionCounter) SetStart(value uint32) PatternFlowIpv4VersionCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4VersionCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv4VersionCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv4VersionCounter object +func (obj *patternFlowIpv4VersionCounter) SetStep(value uint32) PatternFlowIpv4VersionCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4VersionCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv4VersionCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv4VersionCounter object +func (obj *patternFlowIpv4VersionCounter) SetCount(value uint32) PatternFlowIpv4VersionCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv4VersionCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4VersionCounter.Start <= 15 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4VersionCounter.Step <= 15 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4VersionCounter.Count <= 15 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv4VersionCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(4) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv4_version_metric_tag.go b/gosnappi/pattern_flow_ipv4_version_metric_tag.go new file mode 100644 index 00000000..97692140 --- /dev/null +++ b/gosnappi/pattern_flow_ipv4_version_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv4VersionMetricTag ***** +type patternFlowIpv4VersionMetricTag struct { + validation + obj *otg.PatternFlowIpv4VersionMetricTag + marshaller marshalPatternFlowIpv4VersionMetricTag + unMarshaller unMarshalPatternFlowIpv4VersionMetricTag +} + +func NewPatternFlowIpv4VersionMetricTag() PatternFlowIpv4VersionMetricTag { + obj := patternFlowIpv4VersionMetricTag{obj: &otg.PatternFlowIpv4VersionMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv4VersionMetricTag) msg() *otg.PatternFlowIpv4VersionMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv4VersionMetricTag) setMsg(msg *otg.PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv4VersionMetricTag struct { + obj *patternFlowIpv4VersionMetricTag +} + +type marshalPatternFlowIpv4VersionMetricTag interface { + // ToProto marshals PatternFlowIpv4VersionMetricTag to protobuf object *otg.PatternFlowIpv4VersionMetricTag + ToProto() (*otg.PatternFlowIpv4VersionMetricTag, error) + // ToPbText marshals PatternFlowIpv4VersionMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv4VersionMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv4VersionMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv4VersionMetricTag struct { + obj *patternFlowIpv4VersionMetricTag +} + +type unMarshalPatternFlowIpv4VersionMetricTag interface { + // FromProto unmarshals PatternFlowIpv4VersionMetricTag from protobuf object *otg.PatternFlowIpv4VersionMetricTag + FromProto(msg *otg.PatternFlowIpv4VersionMetricTag) (PatternFlowIpv4VersionMetricTag, error) + // FromPbText unmarshals PatternFlowIpv4VersionMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv4VersionMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv4VersionMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv4VersionMetricTag) Marshal() marshalPatternFlowIpv4VersionMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv4VersionMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv4VersionMetricTag) Unmarshal() unMarshalPatternFlowIpv4VersionMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv4VersionMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv4VersionMetricTag) ToProto() (*otg.PatternFlowIpv4VersionMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv4VersionMetricTag) FromProto(msg *otg.PatternFlowIpv4VersionMetricTag) (PatternFlowIpv4VersionMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv4VersionMetricTag) 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 *unMarshalpatternFlowIpv4VersionMetricTag) 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 *marshalpatternFlowIpv4VersionMetricTag) 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 *unMarshalpatternFlowIpv4VersionMetricTag) 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 *marshalpatternFlowIpv4VersionMetricTag) 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 *unMarshalpatternFlowIpv4VersionMetricTag) 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 *patternFlowIpv4VersionMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv4VersionMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv4VersionMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv4VersionMetricTag) Clone() (PatternFlowIpv4VersionMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv4VersionMetricTag() + 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 +} + +// PatternFlowIpv4VersionMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv4VersionMetricTag interface { + Validation + // msg marshals PatternFlowIpv4VersionMetricTag to protobuf object *otg.PatternFlowIpv4VersionMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv4VersionMetricTag + // setMsg unmarshals PatternFlowIpv4VersionMetricTag from protobuf object *otg.PatternFlowIpv4VersionMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv4VersionMetricTag) PatternFlowIpv4VersionMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv4VersionMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv4VersionMetricTag + // validate validates PatternFlowIpv4VersionMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv4VersionMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv4VersionMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv4VersionMetricTag + SetName(value string) PatternFlowIpv4VersionMetricTag + // Offset returns uint32, set in PatternFlowIpv4VersionMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv4VersionMetricTag + SetOffset(value uint32) PatternFlowIpv4VersionMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv4VersionMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv4VersionMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv4VersionMetricTag + SetLength(value uint32) PatternFlowIpv4VersionMetricTag + // HasLength checks if Length has been set in PatternFlowIpv4VersionMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv4VersionMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv4VersionMetricTag object +func (obj *patternFlowIpv4VersionMetricTag) SetName(value string) PatternFlowIpv4VersionMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4VersionMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv4VersionMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv4VersionMetricTag object +func (obj *patternFlowIpv4VersionMetricTag) SetOffset(value uint32) PatternFlowIpv4VersionMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4VersionMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv4VersionMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv4VersionMetricTag object +func (obj *patternFlowIpv4VersionMetricTag) SetLength(value uint32) PatternFlowIpv4VersionMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv4VersionMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv4VersionMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv4VersionMetricTag.Offset <= 3 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 4 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv4VersionMetricTag.Length <= 4 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv4VersionMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(4) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_dst.go b/gosnappi/pattern_flow_ipv6_dst.go new file mode 100644 index 00000000..9402e680 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_dst.go @@ -0,0 +1,658 @@ +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" +) + +// ***** PatternFlowIpv6Dst ***** +type patternFlowIpv6Dst struct { + validation + obj *otg.PatternFlowIpv6Dst + marshaller marshalPatternFlowIpv6Dst + unMarshaller unMarshalPatternFlowIpv6Dst + incrementHolder PatternFlowIpv6DstCounter + decrementHolder PatternFlowIpv6DstCounter + metricTagsHolder PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter +} + +func NewPatternFlowIpv6Dst() PatternFlowIpv6Dst { + obj := patternFlowIpv6Dst{obj: &otg.PatternFlowIpv6Dst{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6Dst) msg() *otg.PatternFlowIpv6Dst { + return obj.obj +} + +func (obj *patternFlowIpv6Dst) setMsg(msg *otg.PatternFlowIpv6Dst) PatternFlowIpv6Dst { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6Dst struct { + obj *patternFlowIpv6Dst +} + +type marshalPatternFlowIpv6Dst interface { + // ToProto marshals PatternFlowIpv6Dst to protobuf object *otg.PatternFlowIpv6Dst + ToProto() (*otg.PatternFlowIpv6Dst, error) + // ToPbText marshals PatternFlowIpv6Dst to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6Dst to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6Dst to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6Dst struct { + obj *patternFlowIpv6Dst +} + +type unMarshalPatternFlowIpv6Dst interface { + // FromProto unmarshals PatternFlowIpv6Dst from protobuf object *otg.PatternFlowIpv6Dst + FromProto(msg *otg.PatternFlowIpv6Dst) (PatternFlowIpv6Dst, error) + // FromPbText unmarshals PatternFlowIpv6Dst from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6Dst from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6Dst from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6Dst) Marshal() marshalPatternFlowIpv6Dst { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6Dst{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6Dst) Unmarshal() unMarshalPatternFlowIpv6Dst { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6Dst{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6Dst) ToProto() (*otg.PatternFlowIpv6Dst, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6Dst) FromProto(msg *otg.PatternFlowIpv6Dst) (PatternFlowIpv6Dst, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6Dst) 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 *unMarshalpatternFlowIpv6Dst) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv6Dst) 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 *unMarshalpatternFlowIpv6Dst) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv6Dst) 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 *unMarshalpatternFlowIpv6Dst) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv6Dst) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6Dst) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6Dst) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6Dst) Clone() (PatternFlowIpv6Dst, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6Dst() + 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 +} + +func (obj *patternFlowIpv6Dst) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv6Dst is destination address +type PatternFlowIpv6Dst interface { + Validation + // msg marshals PatternFlowIpv6Dst to protobuf object *otg.PatternFlowIpv6Dst + // and doesn't set defaults + msg() *otg.PatternFlowIpv6Dst + // setMsg unmarshals PatternFlowIpv6Dst from protobuf object *otg.PatternFlowIpv6Dst + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6Dst) PatternFlowIpv6Dst + // provides marshal interface + Marshal() marshalPatternFlowIpv6Dst + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6Dst + // validate validates PatternFlowIpv6Dst + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6Dst, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv6DstChoiceEnum, set in PatternFlowIpv6Dst + Choice() PatternFlowIpv6DstChoiceEnum + // setChoice assigns PatternFlowIpv6DstChoiceEnum provided by user to PatternFlowIpv6Dst + setChoice(value PatternFlowIpv6DstChoiceEnum) PatternFlowIpv6Dst + // HasChoice checks if Choice has been set in PatternFlowIpv6Dst + HasChoice() bool + // Value returns string, set in PatternFlowIpv6Dst. + Value() string + // SetValue assigns string provided by user to PatternFlowIpv6Dst + SetValue(value string) PatternFlowIpv6Dst + // HasValue checks if Value has been set in PatternFlowIpv6Dst + HasValue() bool + // Values returns []string, set in PatternFlowIpv6Dst. + Values() []string + // SetValues assigns []string provided by user to PatternFlowIpv6Dst + SetValues(value []string) PatternFlowIpv6Dst + // Increment returns PatternFlowIpv6DstCounter, set in PatternFlowIpv6Dst. + // PatternFlowIpv6DstCounter is ipv6 counter pattern + Increment() PatternFlowIpv6DstCounter + // SetIncrement assigns PatternFlowIpv6DstCounter provided by user to PatternFlowIpv6Dst. + // PatternFlowIpv6DstCounter is ipv6 counter pattern + SetIncrement(value PatternFlowIpv6DstCounter) PatternFlowIpv6Dst + // HasIncrement checks if Increment has been set in PatternFlowIpv6Dst + HasIncrement() bool + // Decrement returns PatternFlowIpv6DstCounter, set in PatternFlowIpv6Dst. + // PatternFlowIpv6DstCounter is ipv6 counter pattern + Decrement() PatternFlowIpv6DstCounter + // SetDecrement assigns PatternFlowIpv6DstCounter provided by user to PatternFlowIpv6Dst. + // PatternFlowIpv6DstCounter is ipv6 counter pattern + SetDecrement(value PatternFlowIpv6DstCounter) PatternFlowIpv6Dst + // HasDecrement checks if Decrement has been set in PatternFlowIpv6Dst + HasDecrement() bool + // MetricTags returns PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIterIter, set in PatternFlowIpv6Dst + MetricTags() PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter + setNil() +} + +type PatternFlowIpv6DstChoiceEnum string + +// Enum of Choice on PatternFlowIpv6Dst +var PatternFlowIpv6DstChoice = struct { + VALUE PatternFlowIpv6DstChoiceEnum + VALUES PatternFlowIpv6DstChoiceEnum + INCREMENT PatternFlowIpv6DstChoiceEnum + DECREMENT PatternFlowIpv6DstChoiceEnum +}{ + VALUE: PatternFlowIpv6DstChoiceEnum("value"), + VALUES: PatternFlowIpv6DstChoiceEnum("values"), + INCREMENT: PatternFlowIpv6DstChoiceEnum("increment"), + DECREMENT: PatternFlowIpv6DstChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv6Dst) Choice() PatternFlowIpv6DstChoiceEnum { + return PatternFlowIpv6DstChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv6Dst) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv6Dst) setChoice(value PatternFlowIpv6DstChoiceEnum) PatternFlowIpv6Dst { + intValue, ok := otg.PatternFlowIpv6Dst_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv6DstChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv6Dst_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv6DstChoice.VALUE { + defaultValue := "::0" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv6DstChoice.VALUES { + defaultValue := []string{"::0"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv6DstChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv6DstCounter().msg() + } + + if value == PatternFlowIpv6DstChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv6DstCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowIpv6Dst) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv6DstChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowIpv6Dst) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowIpv6Dst object +func (obj *patternFlowIpv6Dst) SetValue(value string) PatternFlowIpv6Dst { + obj.setChoice(PatternFlowIpv6DstChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowIpv6Dst) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"::0"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowIpv6Dst object +func (obj *patternFlowIpv6Dst) SetValues(value []string) PatternFlowIpv6Dst { + obj.setChoice(PatternFlowIpv6DstChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv6DstCounter +func (obj *patternFlowIpv6Dst) Increment() PatternFlowIpv6DstCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv6DstChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv6DstCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv6DstCounter +func (obj *patternFlowIpv6Dst) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv6DstCounter value in the PatternFlowIpv6Dst object +func (obj *patternFlowIpv6Dst) SetIncrement(value PatternFlowIpv6DstCounter) PatternFlowIpv6Dst { + obj.setChoice(PatternFlowIpv6DstChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv6DstCounter +func (obj *patternFlowIpv6Dst) Decrement() PatternFlowIpv6DstCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv6DstChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv6DstCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv6DstCounter +func (obj *patternFlowIpv6Dst) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv6DstCounter value in the PatternFlowIpv6Dst object +func (obj *patternFlowIpv6Dst) SetDecrement(value PatternFlowIpv6DstCounter) PatternFlowIpv6Dst { + obj.setChoice(PatternFlowIpv6DstChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv6DstMetricTag +func (obj *patternFlowIpv6Dst) MetricTags() PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv6DstMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter struct { + obj *patternFlowIpv6Dst + patternFlowIpv6DstMetricTagSlice []PatternFlowIpv6DstMetricTag + fieldPtr *[]*otg.PatternFlowIpv6DstMetricTag +} + +func newPatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter(ptr *[]*otg.PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { + return &patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter interface { + setMsg(*patternFlowIpv6Dst) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter + Items() []PatternFlowIpv6DstMetricTag + Add() PatternFlowIpv6DstMetricTag + Append(items ...PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter + Set(index int, newObj PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter + Clear() PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter + clearHolderSlice() PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter + appendHolderSlice(item PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter +} + +func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) setMsg(msg *patternFlowIpv6Dst) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv6DstMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) Items() []PatternFlowIpv6DstMetricTag { + return obj.patternFlowIpv6DstMetricTagSlice +} + +func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) Add() PatternFlowIpv6DstMetricTag { + newObj := &otg.PatternFlowIpv6DstMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv6DstMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv6DstMetricTagSlice = append(obj.patternFlowIpv6DstMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) Append(items ...PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv6DstMetricTagSlice = append(obj.patternFlowIpv6DstMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) Set(index int, newObj PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv6DstMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) Clear() PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv6DstMetricTag{} + obj.patternFlowIpv6DstMetricTagSlice = []PatternFlowIpv6DstMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) clearHolderSlice() PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { + if len(obj.patternFlowIpv6DstMetricTagSlice) > 0 { + obj.patternFlowIpv6DstMetricTagSlice = []PatternFlowIpv6DstMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6DstPatternFlowIpv6DstMetricTagIter) appendHolderSlice(item PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstPatternFlowIpv6DstMetricTagIter { + obj.patternFlowIpv6DstMetricTagSlice = append(obj.patternFlowIpv6DstMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv6Dst) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv6(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6Dst.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateIpv6Slice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6Dst.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv6DstMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv6Dst) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv6DstChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv6DstChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv6DstChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv6DstChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv6DstChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv6DstChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6Dst") + } + } else { + intVal := otg.PatternFlowIpv6Dst_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv6Dst_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv6_dst_counter.go b/gosnappi/pattern_flow_ipv6_dst_counter.go new file mode 100644 index 00000000..024e1531 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_dst_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowIpv6DstCounter ***** +type patternFlowIpv6DstCounter struct { + validation + obj *otg.PatternFlowIpv6DstCounter + marshaller marshalPatternFlowIpv6DstCounter + unMarshaller unMarshalPatternFlowIpv6DstCounter +} + +func NewPatternFlowIpv6DstCounter() PatternFlowIpv6DstCounter { + obj := patternFlowIpv6DstCounter{obj: &otg.PatternFlowIpv6DstCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6DstCounter) msg() *otg.PatternFlowIpv6DstCounter { + return obj.obj +} + +func (obj *patternFlowIpv6DstCounter) setMsg(msg *otg.PatternFlowIpv6DstCounter) PatternFlowIpv6DstCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6DstCounter struct { + obj *patternFlowIpv6DstCounter +} + +type marshalPatternFlowIpv6DstCounter interface { + // ToProto marshals PatternFlowIpv6DstCounter to protobuf object *otg.PatternFlowIpv6DstCounter + ToProto() (*otg.PatternFlowIpv6DstCounter, error) + // ToPbText marshals PatternFlowIpv6DstCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6DstCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6DstCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6DstCounter struct { + obj *patternFlowIpv6DstCounter +} + +type unMarshalPatternFlowIpv6DstCounter interface { + // FromProto unmarshals PatternFlowIpv6DstCounter from protobuf object *otg.PatternFlowIpv6DstCounter + FromProto(msg *otg.PatternFlowIpv6DstCounter) (PatternFlowIpv6DstCounter, error) + // FromPbText unmarshals PatternFlowIpv6DstCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6DstCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6DstCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6DstCounter) Marshal() marshalPatternFlowIpv6DstCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6DstCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6DstCounter) Unmarshal() unMarshalPatternFlowIpv6DstCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6DstCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6DstCounter) ToProto() (*otg.PatternFlowIpv6DstCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6DstCounter) FromProto(msg *otg.PatternFlowIpv6DstCounter) (PatternFlowIpv6DstCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6DstCounter) 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 *unMarshalpatternFlowIpv6DstCounter) 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 *marshalpatternFlowIpv6DstCounter) 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 *unMarshalpatternFlowIpv6DstCounter) 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 *marshalpatternFlowIpv6DstCounter) 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 *unMarshalpatternFlowIpv6DstCounter) 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 *patternFlowIpv6DstCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6DstCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6DstCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6DstCounter) Clone() (PatternFlowIpv6DstCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6DstCounter() + 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 +} + +// PatternFlowIpv6DstCounter is ipv6 counter pattern +type PatternFlowIpv6DstCounter interface { + Validation + // msg marshals PatternFlowIpv6DstCounter to protobuf object *otg.PatternFlowIpv6DstCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv6DstCounter + // setMsg unmarshals PatternFlowIpv6DstCounter from protobuf object *otg.PatternFlowIpv6DstCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6DstCounter) PatternFlowIpv6DstCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv6DstCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6DstCounter + // validate validates PatternFlowIpv6DstCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6DstCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowIpv6DstCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowIpv6DstCounter + SetStart(value string) PatternFlowIpv6DstCounter + // HasStart checks if Start has been set in PatternFlowIpv6DstCounter + HasStart() bool + // Step returns string, set in PatternFlowIpv6DstCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowIpv6DstCounter + SetStep(value string) PatternFlowIpv6DstCounter + // HasStep checks if Step has been set in PatternFlowIpv6DstCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv6DstCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv6DstCounter + SetCount(value uint32) PatternFlowIpv6DstCounter + // HasCount checks if Count has been set in PatternFlowIpv6DstCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowIpv6DstCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowIpv6DstCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowIpv6DstCounter object +func (obj *patternFlowIpv6DstCounter) SetStart(value string) PatternFlowIpv6DstCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowIpv6DstCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowIpv6DstCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowIpv6DstCounter object +func (obj *patternFlowIpv6DstCounter) SetStep(value string) PatternFlowIpv6DstCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6DstCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6DstCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv6DstCounter object +func (obj *patternFlowIpv6DstCounter) SetCount(value uint32) PatternFlowIpv6DstCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv6DstCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateIpv6(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6DstCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateIpv6(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6DstCounter.Step")) + } + + } + +} + +func (obj *patternFlowIpv6DstCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("::0") + } + if obj.obj.Step == nil { + obj.SetStep("::1") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_dst_metric_tag.go b/gosnappi/pattern_flow_ipv6_dst_metric_tag.go new file mode 100644 index 00000000..0a75d61c --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_dst_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv6DstMetricTag ***** +type patternFlowIpv6DstMetricTag struct { + validation + obj *otg.PatternFlowIpv6DstMetricTag + marshaller marshalPatternFlowIpv6DstMetricTag + unMarshaller unMarshalPatternFlowIpv6DstMetricTag +} + +func NewPatternFlowIpv6DstMetricTag() PatternFlowIpv6DstMetricTag { + obj := patternFlowIpv6DstMetricTag{obj: &otg.PatternFlowIpv6DstMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6DstMetricTag) msg() *otg.PatternFlowIpv6DstMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv6DstMetricTag) setMsg(msg *otg.PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6DstMetricTag struct { + obj *patternFlowIpv6DstMetricTag +} + +type marshalPatternFlowIpv6DstMetricTag interface { + // ToProto marshals PatternFlowIpv6DstMetricTag to protobuf object *otg.PatternFlowIpv6DstMetricTag + ToProto() (*otg.PatternFlowIpv6DstMetricTag, error) + // ToPbText marshals PatternFlowIpv6DstMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6DstMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6DstMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6DstMetricTag struct { + obj *patternFlowIpv6DstMetricTag +} + +type unMarshalPatternFlowIpv6DstMetricTag interface { + // FromProto unmarshals PatternFlowIpv6DstMetricTag from protobuf object *otg.PatternFlowIpv6DstMetricTag + FromProto(msg *otg.PatternFlowIpv6DstMetricTag) (PatternFlowIpv6DstMetricTag, error) + // FromPbText unmarshals PatternFlowIpv6DstMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6DstMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6DstMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6DstMetricTag) Marshal() marshalPatternFlowIpv6DstMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6DstMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6DstMetricTag) Unmarshal() unMarshalPatternFlowIpv6DstMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6DstMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6DstMetricTag) ToProto() (*otg.PatternFlowIpv6DstMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6DstMetricTag) FromProto(msg *otg.PatternFlowIpv6DstMetricTag) (PatternFlowIpv6DstMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6DstMetricTag) 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 *unMarshalpatternFlowIpv6DstMetricTag) 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 *marshalpatternFlowIpv6DstMetricTag) 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 *unMarshalpatternFlowIpv6DstMetricTag) 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 *marshalpatternFlowIpv6DstMetricTag) 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 *unMarshalpatternFlowIpv6DstMetricTag) 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 *patternFlowIpv6DstMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6DstMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6DstMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6DstMetricTag) Clone() (PatternFlowIpv6DstMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6DstMetricTag() + 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 +} + +// PatternFlowIpv6DstMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv6DstMetricTag interface { + Validation + // msg marshals PatternFlowIpv6DstMetricTag to protobuf object *otg.PatternFlowIpv6DstMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv6DstMetricTag + // setMsg unmarshals PatternFlowIpv6DstMetricTag from protobuf object *otg.PatternFlowIpv6DstMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6DstMetricTag) PatternFlowIpv6DstMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv6DstMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6DstMetricTag + // validate validates PatternFlowIpv6DstMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6DstMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv6DstMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv6DstMetricTag + SetName(value string) PatternFlowIpv6DstMetricTag + // Offset returns uint32, set in PatternFlowIpv6DstMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv6DstMetricTag + SetOffset(value uint32) PatternFlowIpv6DstMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv6DstMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv6DstMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv6DstMetricTag + SetLength(value uint32) PatternFlowIpv6DstMetricTag + // HasLength checks if Length has been set in PatternFlowIpv6DstMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv6DstMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv6DstMetricTag object +func (obj *patternFlowIpv6DstMetricTag) SetName(value string) PatternFlowIpv6DstMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6DstMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6DstMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv6DstMetricTag object +func (obj *patternFlowIpv6DstMetricTag) SetOffset(value uint32) PatternFlowIpv6DstMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6DstMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6DstMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv6DstMetricTag object +func (obj *patternFlowIpv6DstMetricTag) SetLength(value uint32) PatternFlowIpv6DstMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv6DstMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6DstMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 127 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6DstMetricTag.Offset <= 127 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv6DstMetricTag.Length <= 128 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv6DstMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(128) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_flow_label.go b/gosnappi/pattern_flow_ipv6_flow_label.go new file mode 100644 index 00000000..921c0927 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_flow_label.go @@ -0,0 +1,719 @@ +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" +) + +// ***** PatternFlowIpv6FlowLabel ***** +type patternFlowIpv6FlowLabel struct { + validation + obj *otg.PatternFlowIpv6FlowLabel + marshaller marshalPatternFlowIpv6FlowLabel + unMarshaller unMarshalPatternFlowIpv6FlowLabel + incrementHolder PatternFlowIpv6FlowLabelCounter + decrementHolder PatternFlowIpv6FlowLabelCounter + metricTagsHolder PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter + randomHolder PatternFlowIpv6FlowLabelRandom +} + +func NewPatternFlowIpv6FlowLabel() PatternFlowIpv6FlowLabel { + obj := patternFlowIpv6FlowLabel{obj: &otg.PatternFlowIpv6FlowLabel{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6FlowLabel) msg() *otg.PatternFlowIpv6FlowLabel { + return obj.obj +} + +func (obj *patternFlowIpv6FlowLabel) setMsg(msg *otg.PatternFlowIpv6FlowLabel) PatternFlowIpv6FlowLabel { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6FlowLabel struct { + obj *patternFlowIpv6FlowLabel +} + +type marshalPatternFlowIpv6FlowLabel interface { + // ToProto marshals PatternFlowIpv6FlowLabel to protobuf object *otg.PatternFlowIpv6FlowLabel + ToProto() (*otg.PatternFlowIpv6FlowLabel, error) + // ToPbText marshals PatternFlowIpv6FlowLabel to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6FlowLabel to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6FlowLabel to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6FlowLabel struct { + obj *patternFlowIpv6FlowLabel +} + +type unMarshalPatternFlowIpv6FlowLabel interface { + // FromProto unmarshals PatternFlowIpv6FlowLabel from protobuf object *otg.PatternFlowIpv6FlowLabel + FromProto(msg *otg.PatternFlowIpv6FlowLabel) (PatternFlowIpv6FlowLabel, error) + // FromPbText unmarshals PatternFlowIpv6FlowLabel from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6FlowLabel from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6FlowLabel from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6FlowLabel) Marshal() marshalPatternFlowIpv6FlowLabel { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6FlowLabel{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6FlowLabel) Unmarshal() unMarshalPatternFlowIpv6FlowLabel { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6FlowLabel{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6FlowLabel) ToProto() (*otg.PatternFlowIpv6FlowLabel, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6FlowLabel) FromProto(msg *otg.PatternFlowIpv6FlowLabel) (PatternFlowIpv6FlowLabel, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6FlowLabel) 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 *unMarshalpatternFlowIpv6FlowLabel) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv6FlowLabel) 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 *unMarshalpatternFlowIpv6FlowLabel) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv6FlowLabel) 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 *unMarshalpatternFlowIpv6FlowLabel) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv6FlowLabel) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6FlowLabel) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6FlowLabel) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6FlowLabel) Clone() (PatternFlowIpv6FlowLabel, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6FlowLabel() + 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 +} + +func (obj *patternFlowIpv6FlowLabel) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.randomHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv6FlowLabel is flow label +type PatternFlowIpv6FlowLabel interface { + Validation + // msg marshals PatternFlowIpv6FlowLabel to protobuf object *otg.PatternFlowIpv6FlowLabel + // and doesn't set defaults + msg() *otg.PatternFlowIpv6FlowLabel + // setMsg unmarshals PatternFlowIpv6FlowLabel from protobuf object *otg.PatternFlowIpv6FlowLabel + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6FlowLabel) PatternFlowIpv6FlowLabel + // provides marshal interface + Marshal() marshalPatternFlowIpv6FlowLabel + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6FlowLabel + // validate validates PatternFlowIpv6FlowLabel + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6FlowLabel, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv6FlowLabelChoiceEnum, set in PatternFlowIpv6FlowLabel + Choice() PatternFlowIpv6FlowLabelChoiceEnum + // setChoice assigns PatternFlowIpv6FlowLabelChoiceEnum provided by user to PatternFlowIpv6FlowLabel + setChoice(value PatternFlowIpv6FlowLabelChoiceEnum) PatternFlowIpv6FlowLabel + // HasChoice checks if Choice has been set in PatternFlowIpv6FlowLabel + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv6FlowLabel. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv6FlowLabel + SetValue(value uint32) PatternFlowIpv6FlowLabel + // HasValue checks if Value has been set in PatternFlowIpv6FlowLabel + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv6FlowLabel. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv6FlowLabel + SetValues(value []uint32) PatternFlowIpv6FlowLabel + // Increment returns PatternFlowIpv6FlowLabelCounter, set in PatternFlowIpv6FlowLabel. + // PatternFlowIpv6FlowLabelCounter is integer counter pattern + Increment() PatternFlowIpv6FlowLabelCounter + // SetIncrement assigns PatternFlowIpv6FlowLabelCounter provided by user to PatternFlowIpv6FlowLabel. + // PatternFlowIpv6FlowLabelCounter is integer counter pattern + SetIncrement(value PatternFlowIpv6FlowLabelCounter) PatternFlowIpv6FlowLabel + // HasIncrement checks if Increment has been set in PatternFlowIpv6FlowLabel + HasIncrement() bool + // Decrement returns PatternFlowIpv6FlowLabelCounter, set in PatternFlowIpv6FlowLabel. + // PatternFlowIpv6FlowLabelCounter is integer counter pattern + Decrement() PatternFlowIpv6FlowLabelCounter + // SetDecrement assigns PatternFlowIpv6FlowLabelCounter provided by user to PatternFlowIpv6FlowLabel. + // PatternFlowIpv6FlowLabelCounter is integer counter pattern + SetDecrement(value PatternFlowIpv6FlowLabelCounter) PatternFlowIpv6FlowLabel + // HasDecrement checks if Decrement has been set in PatternFlowIpv6FlowLabel + HasDecrement() bool + // MetricTags returns PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIterIter, set in PatternFlowIpv6FlowLabel + MetricTags() PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter + // Random returns PatternFlowIpv6FlowLabelRandom, set in PatternFlowIpv6FlowLabel. + // PatternFlowIpv6FlowLabelRandom is integer random pattern + Random() PatternFlowIpv6FlowLabelRandom + // SetRandom assigns PatternFlowIpv6FlowLabelRandom provided by user to PatternFlowIpv6FlowLabel. + // PatternFlowIpv6FlowLabelRandom is integer random pattern + SetRandom(value PatternFlowIpv6FlowLabelRandom) PatternFlowIpv6FlowLabel + // HasRandom checks if Random has been set in PatternFlowIpv6FlowLabel + HasRandom() bool + setNil() +} + +type PatternFlowIpv6FlowLabelChoiceEnum string + +// Enum of Choice on PatternFlowIpv6FlowLabel +var PatternFlowIpv6FlowLabelChoice = struct { + VALUE PatternFlowIpv6FlowLabelChoiceEnum + VALUES PatternFlowIpv6FlowLabelChoiceEnum + INCREMENT PatternFlowIpv6FlowLabelChoiceEnum + DECREMENT PatternFlowIpv6FlowLabelChoiceEnum + RANDOM PatternFlowIpv6FlowLabelChoiceEnum +}{ + VALUE: PatternFlowIpv6FlowLabelChoiceEnum("value"), + VALUES: PatternFlowIpv6FlowLabelChoiceEnum("values"), + INCREMENT: PatternFlowIpv6FlowLabelChoiceEnum("increment"), + DECREMENT: PatternFlowIpv6FlowLabelChoiceEnum("decrement"), + RANDOM: PatternFlowIpv6FlowLabelChoiceEnum("random"), +} + +func (obj *patternFlowIpv6FlowLabel) Choice() PatternFlowIpv6FlowLabelChoiceEnum { + return PatternFlowIpv6FlowLabelChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv6FlowLabel) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv6FlowLabel) setChoice(value PatternFlowIpv6FlowLabelChoiceEnum) PatternFlowIpv6FlowLabel { + intValue, ok := otg.PatternFlowIpv6FlowLabel_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv6FlowLabelChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv6FlowLabel_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Random = nil + obj.randomHolder = nil + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv6FlowLabelChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv6FlowLabelChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv6FlowLabelChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv6FlowLabelCounter().msg() + } + + if value == PatternFlowIpv6FlowLabelChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv6FlowLabelCounter().msg() + } + + if value == PatternFlowIpv6FlowLabelChoice.RANDOM { + obj.obj.Random = NewPatternFlowIpv6FlowLabelRandom().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv6FlowLabel) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv6FlowLabelChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv6FlowLabel) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv6FlowLabel object +func (obj *patternFlowIpv6FlowLabel) SetValue(value uint32) PatternFlowIpv6FlowLabel { + obj.setChoice(PatternFlowIpv6FlowLabelChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv6FlowLabel) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv6FlowLabel object +func (obj *patternFlowIpv6FlowLabel) SetValues(value []uint32) PatternFlowIpv6FlowLabel { + obj.setChoice(PatternFlowIpv6FlowLabelChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv6FlowLabelCounter +func (obj *patternFlowIpv6FlowLabel) Increment() PatternFlowIpv6FlowLabelCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv6FlowLabelChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv6FlowLabelCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv6FlowLabelCounter +func (obj *patternFlowIpv6FlowLabel) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv6FlowLabelCounter value in the PatternFlowIpv6FlowLabel object +func (obj *patternFlowIpv6FlowLabel) SetIncrement(value PatternFlowIpv6FlowLabelCounter) PatternFlowIpv6FlowLabel { + obj.setChoice(PatternFlowIpv6FlowLabelChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv6FlowLabelCounter +func (obj *patternFlowIpv6FlowLabel) Decrement() PatternFlowIpv6FlowLabelCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv6FlowLabelChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv6FlowLabelCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv6FlowLabelCounter +func (obj *patternFlowIpv6FlowLabel) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv6FlowLabelCounter value in the PatternFlowIpv6FlowLabel object +func (obj *patternFlowIpv6FlowLabel) SetDecrement(value PatternFlowIpv6FlowLabelCounter) PatternFlowIpv6FlowLabel { + obj.setChoice(PatternFlowIpv6FlowLabelChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv6FlowLabelMetricTag +func (obj *patternFlowIpv6FlowLabel) MetricTags() PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv6FlowLabelMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter struct { + obj *patternFlowIpv6FlowLabel + patternFlowIpv6FlowLabelMetricTagSlice []PatternFlowIpv6FlowLabelMetricTag + fieldPtr *[]*otg.PatternFlowIpv6FlowLabelMetricTag +} + +func newPatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter(ptr *[]*otg.PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { + return &patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter interface { + setMsg(*patternFlowIpv6FlowLabel) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter + Items() []PatternFlowIpv6FlowLabelMetricTag + Add() PatternFlowIpv6FlowLabelMetricTag + Append(items ...PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter + Set(index int, newObj PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter + Clear() PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter + clearHolderSlice() PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter + appendHolderSlice(item PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter +} + +func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) setMsg(msg *patternFlowIpv6FlowLabel) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv6FlowLabelMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) Items() []PatternFlowIpv6FlowLabelMetricTag { + return obj.patternFlowIpv6FlowLabelMetricTagSlice +} + +func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) Add() PatternFlowIpv6FlowLabelMetricTag { + newObj := &otg.PatternFlowIpv6FlowLabelMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv6FlowLabelMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv6FlowLabelMetricTagSlice = append(obj.patternFlowIpv6FlowLabelMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) Append(items ...PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv6FlowLabelMetricTagSlice = append(obj.patternFlowIpv6FlowLabelMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) Set(index int, newObj PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv6FlowLabelMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) Clear() PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv6FlowLabelMetricTag{} + obj.patternFlowIpv6FlowLabelMetricTagSlice = []PatternFlowIpv6FlowLabelMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) clearHolderSlice() PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { + if len(obj.patternFlowIpv6FlowLabelMetricTagSlice) > 0 { + obj.patternFlowIpv6FlowLabelMetricTagSlice = []PatternFlowIpv6FlowLabelMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter) appendHolderSlice(item PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelPatternFlowIpv6FlowLabelMetricTagIter { + obj.patternFlowIpv6FlowLabelMetricTagSlice = append(obj.patternFlowIpv6FlowLabelMetricTagSlice, item) + return obj +} + +// description is TBD +// Random returns a PatternFlowIpv6FlowLabelRandom +func (obj *patternFlowIpv6FlowLabel) Random() PatternFlowIpv6FlowLabelRandom { + if obj.obj.Random == nil { + obj.setChoice(PatternFlowIpv6FlowLabelChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &patternFlowIpv6FlowLabelRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a PatternFlowIpv6FlowLabelRandom +func (obj *patternFlowIpv6FlowLabel) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the PatternFlowIpv6FlowLabelRandom value in the PatternFlowIpv6FlowLabel object +func (obj *patternFlowIpv6FlowLabel) SetRandom(value PatternFlowIpv6FlowLabelRandom) PatternFlowIpv6FlowLabel { + obj.setChoice(PatternFlowIpv6FlowLabelChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + +func (obj *patternFlowIpv6FlowLabel) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6FlowLabel.Value <= 1048575 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv6FlowLabel.Values <= 1048575 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv6FlowLabelMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowIpv6FlowLabel) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv6FlowLabelChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv6FlowLabelChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv6FlowLabelChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv6FlowLabelChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv6FlowLabelChoice.DECREMENT + } + + if obj.obj.Random != nil { + choices_set += 1 + choice = PatternFlowIpv6FlowLabelChoice.RANDOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv6FlowLabelChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6FlowLabel") + } + } else { + intVal := otg.PatternFlowIpv6FlowLabel_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv6FlowLabel_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv6_flow_label_counter.go b/gosnappi/pattern_flow_ipv6_flow_label_counter.go new file mode 100644 index 00000000..f1f8788a --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_flow_label_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv6FlowLabelCounter ***** +type patternFlowIpv6FlowLabelCounter struct { + validation + obj *otg.PatternFlowIpv6FlowLabelCounter + marshaller marshalPatternFlowIpv6FlowLabelCounter + unMarshaller unMarshalPatternFlowIpv6FlowLabelCounter +} + +func NewPatternFlowIpv6FlowLabelCounter() PatternFlowIpv6FlowLabelCounter { + obj := patternFlowIpv6FlowLabelCounter{obj: &otg.PatternFlowIpv6FlowLabelCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6FlowLabelCounter) msg() *otg.PatternFlowIpv6FlowLabelCounter { + return obj.obj +} + +func (obj *patternFlowIpv6FlowLabelCounter) setMsg(msg *otg.PatternFlowIpv6FlowLabelCounter) PatternFlowIpv6FlowLabelCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6FlowLabelCounter struct { + obj *patternFlowIpv6FlowLabelCounter +} + +type marshalPatternFlowIpv6FlowLabelCounter interface { + // ToProto marshals PatternFlowIpv6FlowLabelCounter to protobuf object *otg.PatternFlowIpv6FlowLabelCounter + ToProto() (*otg.PatternFlowIpv6FlowLabelCounter, error) + // ToPbText marshals PatternFlowIpv6FlowLabelCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6FlowLabelCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6FlowLabelCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6FlowLabelCounter struct { + obj *patternFlowIpv6FlowLabelCounter +} + +type unMarshalPatternFlowIpv6FlowLabelCounter interface { + // FromProto unmarshals PatternFlowIpv6FlowLabelCounter from protobuf object *otg.PatternFlowIpv6FlowLabelCounter + FromProto(msg *otg.PatternFlowIpv6FlowLabelCounter) (PatternFlowIpv6FlowLabelCounter, error) + // FromPbText unmarshals PatternFlowIpv6FlowLabelCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6FlowLabelCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6FlowLabelCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6FlowLabelCounter) Marshal() marshalPatternFlowIpv6FlowLabelCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6FlowLabelCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6FlowLabelCounter) Unmarshal() unMarshalPatternFlowIpv6FlowLabelCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6FlowLabelCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6FlowLabelCounter) ToProto() (*otg.PatternFlowIpv6FlowLabelCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6FlowLabelCounter) FromProto(msg *otg.PatternFlowIpv6FlowLabelCounter) (PatternFlowIpv6FlowLabelCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6FlowLabelCounter) 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 *unMarshalpatternFlowIpv6FlowLabelCounter) 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 *marshalpatternFlowIpv6FlowLabelCounter) 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 *unMarshalpatternFlowIpv6FlowLabelCounter) 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 *marshalpatternFlowIpv6FlowLabelCounter) 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 *unMarshalpatternFlowIpv6FlowLabelCounter) 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 *patternFlowIpv6FlowLabelCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6FlowLabelCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6FlowLabelCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6FlowLabelCounter) Clone() (PatternFlowIpv6FlowLabelCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6FlowLabelCounter() + 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 +} + +// PatternFlowIpv6FlowLabelCounter is integer counter pattern +type PatternFlowIpv6FlowLabelCounter interface { + Validation + // msg marshals PatternFlowIpv6FlowLabelCounter to protobuf object *otg.PatternFlowIpv6FlowLabelCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv6FlowLabelCounter + // setMsg unmarshals PatternFlowIpv6FlowLabelCounter from protobuf object *otg.PatternFlowIpv6FlowLabelCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6FlowLabelCounter) PatternFlowIpv6FlowLabelCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv6FlowLabelCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6FlowLabelCounter + // validate validates PatternFlowIpv6FlowLabelCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6FlowLabelCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv6FlowLabelCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv6FlowLabelCounter + SetStart(value uint32) PatternFlowIpv6FlowLabelCounter + // HasStart checks if Start has been set in PatternFlowIpv6FlowLabelCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv6FlowLabelCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv6FlowLabelCounter + SetStep(value uint32) PatternFlowIpv6FlowLabelCounter + // HasStep checks if Step has been set in PatternFlowIpv6FlowLabelCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv6FlowLabelCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv6FlowLabelCounter + SetCount(value uint32) PatternFlowIpv6FlowLabelCounter + // HasCount checks if Count has been set in PatternFlowIpv6FlowLabelCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv6FlowLabelCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv6FlowLabelCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv6FlowLabelCounter object +func (obj *patternFlowIpv6FlowLabelCounter) SetStart(value uint32) PatternFlowIpv6FlowLabelCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv6FlowLabelCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv6FlowLabelCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv6FlowLabelCounter object +func (obj *patternFlowIpv6FlowLabelCounter) SetStep(value uint32) PatternFlowIpv6FlowLabelCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6FlowLabelCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6FlowLabelCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv6FlowLabelCounter object +func (obj *patternFlowIpv6FlowLabelCounter) SetCount(value uint32) PatternFlowIpv6FlowLabelCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv6FlowLabelCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6FlowLabelCounter.Start <= 1048575 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6FlowLabelCounter.Step <= 1048575 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6FlowLabelCounter.Count <= 1048575 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv6FlowLabelCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_flow_label_metric_tag.go b/gosnappi/pattern_flow_ipv6_flow_label_metric_tag.go new file mode 100644 index 00000000..c2530b64 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_flow_label_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv6FlowLabelMetricTag ***** +type patternFlowIpv6FlowLabelMetricTag struct { + validation + obj *otg.PatternFlowIpv6FlowLabelMetricTag + marshaller marshalPatternFlowIpv6FlowLabelMetricTag + unMarshaller unMarshalPatternFlowIpv6FlowLabelMetricTag +} + +func NewPatternFlowIpv6FlowLabelMetricTag() PatternFlowIpv6FlowLabelMetricTag { + obj := patternFlowIpv6FlowLabelMetricTag{obj: &otg.PatternFlowIpv6FlowLabelMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6FlowLabelMetricTag) msg() *otg.PatternFlowIpv6FlowLabelMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv6FlowLabelMetricTag) setMsg(msg *otg.PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6FlowLabelMetricTag struct { + obj *patternFlowIpv6FlowLabelMetricTag +} + +type marshalPatternFlowIpv6FlowLabelMetricTag interface { + // ToProto marshals PatternFlowIpv6FlowLabelMetricTag to protobuf object *otg.PatternFlowIpv6FlowLabelMetricTag + ToProto() (*otg.PatternFlowIpv6FlowLabelMetricTag, error) + // ToPbText marshals PatternFlowIpv6FlowLabelMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6FlowLabelMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6FlowLabelMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6FlowLabelMetricTag struct { + obj *patternFlowIpv6FlowLabelMetricTag +} + +type unMarshalPatternFlowIpv6FlowLabelMetricTag interface { + // FromProto unmarshals PatternFlowIpv6FlowLabelMetricTag from protobuf object *otg.PatternFlowIpv6FlowLabelMetricTag + FromProto(msg *otg.PatternFlowIpv6FlowLabelMetricTag) (PatternFlowIpv6FlowLabelMetricTag, error) + // FromPbText unmarshals PatternFlowIpv6FlowLabelMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6FlowLabelMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6FlowLabelMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6FlowLabelMetricTag) Marshal() marshalPatternFlowIpv6FlowLabelMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6FlowLabelMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6FlowLabelMetricTag) Unmarshal() unMarshalPatternFlowIpv6FlowLabelMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6FlowLabelMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6FlowLabelMetricTag) ToProto() (*otg.PatternFlowIpv6FlowLabelMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6FlowLabelMetricTag) FromProto(msg *otg.PatternFlowIpv6FlowLabelMetricTag) (PatternFlowIpv6FlowLabelMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6FlowLabelMetricTag) 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 *unMarshalpatternFlowIpv6FlowLabelMetricTag) 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 *marshalpatternFlowIpv6FlowLabelMetricTag) 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 *unMarshalpatternFlowIpv6FlowLabelMetricTag) 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 *marshalpatternFlowIpv6FlowLabelMetricTag) 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 *unMarshalpatternFlowIpv6FlowLabelMetricTag) 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 *patternFlowIpv6FlowLabelMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6FlowLabelMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6FlowLabelMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6FlowLabelMetricTag) Clone() (PatternFlowIpv6FlowLabelMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6FlowLabelMetricTag() + 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 +} + +// PatternFlowIpv6FlowLabelMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv6FlowLabelMetricTag interface { + Validation + // msg marshals PatternFlowIpv6FlowLabelMetricTag to protobuf object *otg.PatternFlowIpv6FlowLabelMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv6FlowLabelMetricTag + // setMsg unmarshals PatternFlowIpv6FlowLabelMetricTag from protobuf object *otg.PatternFlowIpv6FlowLabelMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6FlowLabelMetricTag) PatternFlowIpv6FlowLabelMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv6FlowLabelMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6FlowLabelMetricTag + // validate validates PatternFlowIpv6FlowLabelMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6FlowLabelMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv6FlowLabelMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv6FlowLabelMetricTag + SetName(value string) PatternFlowIpv6FlowLabelMetricTag + // Offset returns uint32, set in PatternFlowIpv6FlowLabelMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv6FlowLabelMetricTag + SetOffset(value uint32) PatternFlowIpv6FlowLabelMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv6FlowLabelMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv6FlowLabelMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv6FlowLabelMetricTag + SetLength(value uint32) PatternFlowIpv6FlowLabelMetricTag + // HasLength checks if Length has been set in PatternFlowIpv6FlowLabelMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv6FlowLabelMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv6FlowLabelMetricTag object +func (obj *patternFlowIpv6FlowLabelMetricTag) SetName(value string) PatternFlowIpv6FlowLabelMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6FlowLabelMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6FlowLabelMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv6FlowLabelMetricTag object +func (obj *patternFlowIpv6FlowLabelMetricTag) SetOffset(value uint32) PatternFlowIpv6FlowLabelMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6FlowLabelMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6FlowLabelMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv6FlowLabelMetricTag object +func (obj *patternFlowIpv6FlowLabelMetricTag) SetLength(value uint32) PatternFlowIpv6FlowLabelMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv6FlowLabelMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6FlowLabelMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 19 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6FlowLabelMetricTag.Offset <= 19 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 20 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv6FlowLabelMetricTag.Length <= 20 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv6FlowLabelMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(20) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_flow_label_random.go b/gosnappi/pattern_flow_ipv6_flow_label_random.go new file mode 100644 index 00000000..4421ea41 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_flow_label_random.go @@ -0,0 +1,422 @@ +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" +) + +// ***** PatternFlowIpv6FlowLabelRandom ***** +type patternFlowIpv6FlowLabelRandom struct { + validation + obj *otg.PatternFlowIpv6FlowLabelRandom + marshaller marshalPatternFlowIpv6FlowLabelRandom + unMarshaller unMarshalPatternFlowIpv6FlowLabelRandom +} + +func NewPatternFlowIpv6FlowLabelRandom() PatternFlowIpv6FlowLabelRandom { + obj := patternFlowIpv6FlowLabelRandom{obj: &otg.PatternFlowIpv6FlowLabelRandom{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6FlowLabelRandom) msg() *otg.PatternFlowIpv6FlowLabelRandom { + return obj.obj +} + +func (obj *patternFlowIpv6FlowLabelRandom) setMsg(msg *otg.PatternFlowIpv6FlowLabelRandom) PatternFlowIpv6FlowLabelRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6FlowLabelRandom struct { + obj *patternFlowIpv6FlowLabelRandom +} + +type marshalPatternFlowIpv6FlowLabelRandom interface { + // ToProto marshals PatternFlowIpv6FlowLabelRandom to protobuf object *otg.PatternFlowIpv6FlowLabelRandom + ToProto() (*otg.PatternFlowIpv6FlowLabelRandom, error) + // ToPbText marshals PatternFlowIpv6FlowLabelRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6FlowLabelRandom to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6FlowLabelRandom to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6FlowLabelRandom struct { + obj *patternFlowIpv6FlowLabelRandom +} + +type unMarshalPatternFlowIpv6FlowLabelRandom interface { + // FromProto unmarshals PatternFlowIpv6FlowLabelRandom from protobuf object *otg.PatternFlowIpv6FlowLabelRandom + FromProto(msg *otg.PatternFlowIpv6FlowLabelRandom) (PatternFlowIpv6FlowLabelRandom, error) + // FromPbText unmarshals PatternFlowIpv6FlowLabelRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6FlowLabelRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6FlowLabelRandom from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6FlowLabelRandom) Marshal() marshalPatternFlowIpv6FlowLabelRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6FlowLabelRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6FlowLabelRandom) Unmarshal() unMarshalPatternFlowIpv6FlowLabelRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6FlowLabelRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6FlowLabelRandom) ToProto() (*otg.PatternFlowIpv6FlowLabelRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6FlowLabelRandom) FromProto(msg *otg.PatternFlowIpv6FlowLabelRandom) (PatternFlowIpv6FlowLabelRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6FlowLabelRandom) 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 *unMarshalpatternFlowIpv6FlowLabelRandom) 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 *marshalpatternFlowIpv6FlowLabelRandom) 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 *unMarshalpatternFlowIpv6FlowLabelRandom) 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 *marshalpatternFlowIpv6FlowLabelRandom) 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 *unMarshalpatternFlowIpv6FlowLabelRandom) 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 *patternFlowIpv6FlowLabelRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6FlowLabelRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6FlowLabelRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6FlowLabelRandom) Clone() (PatternFlowIpv6FlowLabelRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6FlowLabelRandom() + 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 +} + +// PatternFlowIpv6FlowLabelRandom is integer random pattern +type PatternFlowIpv6FlowLabelRandom interface { + Validation + // msg marshals PatternFlowIpv6FlowLabelRandom to protobuf object *otg.PatternFlowIpv6FlowLabelRandom + // and doesn't set defaults + msg() *otg.PatternFlowIpv6FlowLabelRandom + // setMsg unmarshals PatternFlowIpv6FlowLabelRandom from protobuf object *otg.PatternFlowIpv6FlowLabelRandom + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6FlowLabelRandom) PatternFlowIpv6FlowLabelRandom + // provides marshal interface + Marshal() marshalPatternFlowIpv6FlowLabelRandom + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6FlowLabelRandom + // validate validates PatternFlowIpv6FlowLabelRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6FlowLabelRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns uint32, set in PatternFlowIpv6FlowLabelRandom. + Min() uint32 + // SetMin assigns uint32 provided by user to PatternFlowIpv6FlowLabelRandom + SetMin(value uint32) PatternFlowIpv6FlowLabelRandom + // HasMin checks if Min has been set in PatternFlowIpv6FlowLabelRandom + HasMin() bool + // Max returns uint32, set in PatternFlowIpv6FlowLabelRandom. + Max() uint32 + // SetMax assigns uint32 provided by user to PatternFlowIpv6FlowLabelRandom + SetMax(value uint32) PatternFlowIpv6FlowLabelRandom + // HasMax checks if Max has been set in PatternFlowIpv6FlowLabelRandom + HasMax() bool + // Seed returns uint32, set in PatternFlowIpv6FlowLabelRandom. + Seed() uint32 + // SetSeed assigns uint32 provided by user to PatternFlowIpv6FlowLabelRandom + SetSeed(value uint32) PatternFlowIpv6FlowLabelRandom + // HasSeed checks if Seed has been set in PatternFlowIpv6FlowLabelRandom + HasSeed() bool + // Count returns uint32, set in PatternFlowIpv6FlowLabelRandom. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv6FlowLabelRandom + SetCount(value uint32) PatternFlowIpv6FlowLabelRandom + // HasCount checks if Count has been set in PatternFlowIpv6FlowLabelRandom + HasCount() bool +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) Min() uint32 { + + return *obj.obj.Min + +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// The minimum possible value generated by the random value generator. +// SetMin sets the uint32 value in the PatternFlowIpv6FlowLabelRandom object +func (obj *patternFlowIpv6FlowLabelRandom) SetMin(value uint32) PatternFlowIpv6FlowLabelRandom { + + obj.obj.Min = &value + return obj +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) Max() uint32 { + + return *obj.obj.Max + +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// The maximum possible value generated by the random value generator. +// SetMax sets the uint32 value in the PatternFlowIpv6FlowLabelRandom object +func (obj *patternFlowIpv6FlowLabelRandom) SetMax(value uint32) PatternFlowIpv6FlowLabelRandom { + + obj.obj.Max = &value + return obj +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) Seed() uint32 { + + return *obj.obj.Seed + +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) HasSeed() bool { + return obj.obj.Seed != nil +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// SetSeed sets the uint32 value in the PatternFlowIpv6FlowLabelRandom object +func (obj *patternFlowIpv6FlowLabelRandom) SetSeed(value uint32) PatternFlowIpv6FlowLabelRandom { + + obj.obj.Seed = &value + return obj +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowIpv6FlowLabelRandom) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of values to be generated by the random value generator. +// SetCount sets the uint32 value in the PatternFlowIpv6FlowLabelRandom object +func (obj *patternFlowIpv6FlowLabelRandom) SetCount(value uint32) PatternFlowIpv6FlowLabelRandom { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv6FlowLabelRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Min != nil { + + if *obj.obj.Min > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6FlowLabelRandom.Min <= 1048575 but Got %d", *obj.obj.Min)) + } + + } + + if obj.obj.Max != nil { + + if *obj.obj.Max > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6FlowLabelRandom.Max <= 1048575 but Got %d", *obj.obj.Max)) + } + + } + +} + +func (obj *patternFlowIpv6FlowLabelRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin(0) + } + if obj.obj.Max == nil { + obj.SetMax(1048575) + } + if obj.obj.Seed == nil { + obj.SetSeed(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_hop_limit.go b/gosnappi/pattern_flow_ipv6_hop_limit.go new file mode 100644 index 00000000..e71099b8 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_hop_limit.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv6HopLimit ***** +type patternFlowIpv6HopLimit struct { + validation + obj *otg.PatternFlowIpv6HopLimit + marshaller marshalPatternFlowIpv6HopLimit + unMarshaller unMarshalPatternFlowIpv6HopLimit + incrementHolder PatternFlowIpv6HopLimitCounter + decrementHolder PatternFlowIpv6HopLimitCounter + metricTagsHolder PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter +} + +func NewPatternFlowIpv6HopLimit() PatternFlowIpv6HopLimit { + obj := patternFlowIpv6HopLimit{obj: &otg.PatternFlowIpv6HopLimit{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6HopLimit) msg() *otg.PatternFlowIpv6HopLimit { + return obj.obj +} + +func (obj *patternFlowIpv6HopLimit) setMsg(msg *otg.PatternFlowIpv6HopLimit) PatternFlowIpv6HopLimit { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6HopLimit struct { + obj *patternFlowIpv6HopLimit +} + +type marshalPatternFlowIpv6HopLimit interface { + // ToProto marshals PatternFlowIpv6HopLimit to protobuf object *otg.PatternFlowIpv6HopLimit + ToProto() (*otg.PatternFlowIpv6HopLimit, error) + // ToPbText marshals PatternFlowIpv6HopLimit to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6HopLimit to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6HopLimit to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6HopLimit struct { + obj *patternFlowIpv6HopLimit +} + +type unMarshalPatternFlowIpv6HopLimit interface { + // FromProto unmarshals PatternFlowIpv6HopLimit from protobuf object *otg.PatternFlowIpv6HopLimit + FromProto(msg *otg.PatternFlowIpv6HopLimit) (PatternFlowIpv6HopLimit, error) + // FromPbText unmarshals PatternFlowIpv6HopLimit from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6HopLimit from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6HopLimit from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6HopLimit) Marshal() marshalPatternFlowIpv6HopLimit { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6HopLimit{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6HopLimit) Unmarshal() unMarshalPatternFlowIpv6HopLimit { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6HopLimit{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6HopLimit) ToProto() (*otg.PatternFlowIpv6HopLimit, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6HopLimit) FromProto(msg *otg.PatternFlowIpv6HopLimit) (PatternFlowIpv6HopLimit, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6HopLimit) 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 *unMarshalpatternFlowIpv6HopLimit) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv6HopLimit) 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 *unMarshalpatternFlowIpv6HopLimit) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv6HopLimit) 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 *unMarshalpatternFlowIpv6HopLimit) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv6HopLimit) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6HopLimit) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6HopLimit) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6HopLimit) Clone() (PatternFlowIpv6HopLimit, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6HopLimit() + 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 +} + +func (obj *patternFlowIpv6HopLimit) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv6HopLimit is hop limit +type PatternFlowIpv6HopLimit interface { + Validation + // msg marshals PatternFlowIpv6HopLimit to protobuf object *otg.PatternFlowIpv6HopLimit + // and doesn't set defaults + msg() *otg.PatternFlowIpv6HopLimit + // setMsg unmarshals PatternFlowIpv6HopLimit from protobuf object *otg.PatternFlowIpv6HopLimit + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6HopLimit) PatternFlowIpv6HopLimit + // provides marshal interface + Marshal() marshalPatternFlowIpv6HopLimit + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6HopLimit + // validate validates PatternFlowIpv6HopLimit + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6HopLimit, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv6HopLimitChoiceEnum, set in PatternFlowIpv6HopLimit + Choice() PatternFlowIpv6HopLimitChoiceEnum + // setChoice assigns PatternFlowIpv6HopLimitChoiceEnum provided by user to PatternFlowIpv6HopLimit + setChoice(value PatternFlowIpv6HopLimitChoiceEnum) PatternFlowIpv6HopLimit + // HasChoice checks if Choice has been set in PatternFlowIpv6HopLimit + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv6HopLimit. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv6HopLimit + SetValue(value uint32) PatternFlowIpv6HopLimit + // HasValue checks if Value has been set in PatternFlowIpv6HopLimit + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv6HopLimit. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv6HopLimit + SetValues(value []uint32) PatternFlowIpv6HopLimit + // Increment returns PatternFlowIpv6HopLimitCounter, set in PatternFlowIpv6HopLimit. + // PatternFlowIpv6HopLimitCounter is integer counter pattern + Increment() PatternFlowIpv6HopLimitCounter + // SetIncrement assigns PatternFlowIpv6HopLimitCounter provided by user to PatternFlowIpv6HopLimit. + // PatternFlowIpv6HopLimitCounter is integer counter pattern + SetIncrement(value PatternFlowIpv6HopLimitCounter) PatternFlowIpv6HopLimit + // HasIncrement checks if Increment has been set in PatternFlowIpv6HopLimit + HasIncrement() bool + // Decrement returns PatternFlowIpv6HopLimitCounter, set in PatternFlowIpv6HopLimit. + // PatternFlowIpv6HopLimitCounter is integer counter pattern + Decrement() PatternFlowIpv6HopLimitCounter + // SetDecrement assigns PatternFlowIpv6HopLimitCounter provided by user to PatternFlowIpv6HopLimit. + // PatternFlowIpv6HopLimitCounter is integer counter pattern + SetDecrement(value PatternFlowIpv6HopLimitCounter) PatternFlowIpv6HopLimit + // HasDecrement checks if Decrement has been set in PatternFlowIpv6HopLimit + HasDecrement() bool + // MetricTags returns PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIterIter, set in PatternFlowIpv6HopLimit + MetricTags() PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter + setNil() +} + +type PatternFlowIpv6HopLimitChoiceEnum string + +// Enum of Choice on PatternFlowIpv6HopLimit +var PatternFlowIpv6HopLimitChoice = struct { + VALUE PatternFlowIpv6HopLimitChoiceEnum + VALUES PatternFlowIpv6HopLimitChoiceEnum + INCREMENT PatternFlowIpv6HopLimitChoiceEnum + DECREMENT PatternFlowIpv6HopLimitChoiceEnum +}{ + VALUE: PatternFlowIpv6HopLimitChoiceEnum("value"), + VALUES: PatternFlowIpv6HopLimitChoiceEnum("values"), + INCREMENT: PatternFlowIpv6HopLimitChoiceEnum("increment"), + DECREMENT: PatternFlowIpv6HopLimitChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv6HopLimit) Choice() PatternFlowIpv6HopLimitChoiceEnum { + return PatternFlowIpv6HopLimitChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv6HopLimit) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv6HopLimit) setChoice(value PatternFlowIpv6HopLimitChoiceEnum) PatternFlowIpv6HopLimit { + intValue, ok := otg.PatternFlowIpv6HopLimit_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv6HopLimitChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv6HopLimit_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv6HopLimitChoice.VALUE { + defaultValue := uint32(64) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv6HopLimitChoice.VALUES { + defaultValue := []uint32{64} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv6HopLimitChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv6HopLimitCounter().msg() + } + + if value == PatternFlowIpv6HopLimitChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv6HopLimitCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv6HopLimit) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv6HopLimitChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv6HopLimit) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv6HopLimit object +func (obj *patternFlowIpv6HopLimit) SetValue(value uint32) PatternFlowIpv6HopLimit { + obj.setChoice(PatternFlowIpv6HopLimitChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv6HopLimit) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{64}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv6HopLimit object +func (obj *patternFlowIpv6HopLimit) SetValues(value []uint32) PatternFlowIpv6HopLimit { + obj.setChoice(PatternFlowIpv6HopLimitChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv6HopLimitCounter +func (obj *patternFlowIpv6HopLimit) Increment() PatternFlowIpv6HopLimitCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv6HopLimitChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv6HopLimitCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv6HopLimitCounter +func (obj *patternFlowIpv6HopLimit) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv6HopLimitCounter value in the PatternFlowIpv6HopLimit object +func (obj *patternFlowIpv6HopLimit) SetIncrement(value PatternFlowIpv6HopLimitCounter) PatternFlowIpv6HopLimit { + obj.setChoice(PatternFlowIpv6HopLimitChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv6HopLimitCounter +func (obj *patternFlowIpv6HopLimit) Decrement() PatternFlowIpv6HopLimitCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv6HopLimitChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv6HopLimitCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv6HopLimitCounter +func (obj *patternFlowIpv6HopLimit) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv6HopLimitCounter value in the PatternFlowIpv6HopLimit object +func (obj *patternFlowIpv6HopLimit) SetDecrement(value PatternFlowIpv6HopLimitCounter) PatternFlowIpv6HopLimit { + obj.setChoice(PatternFlowIpv6HopLimitChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv6HopLimitMetricTag +func (obj *patternFlowIpv6HopLimit) MetricTags() PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv6HopLimitMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter struct { + obj *patternFlowIpv6HopLimit + patternFlowIpv6HopLimitMetricTagSlice []PatternFlowIpv6HopLimitMetricTag + fieldPtr *[]*otg.PatternFlowIpv6HopLimitMetricTag +} + +func newPatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter(ptr *[]*otg.PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { + return &patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter interface { + setMsg(*patternFlowIpv6HopLimit) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter + Items() []PatternFlowIpv6HopLimitMetricTag + Add() PatternFlowIpv6HopLimitMetricTag + Append(items ...PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter + Set(index int, newObj PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter + Clear() PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter + clearHolderSlice() PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter + appendHolderSlice(item PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter +} + +func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) setMsg(msg *patternFlowIpv6HopLimit) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv6HopLimitMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) Items() []PatternFlowIpv6HopLimitMetricTag { + return obj.patternFlowIpv6HopLimitMetricTagSlice +} + +func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) Add() PatternFlowIpv6HopLimitMetricTag { + newObj := &otg.PatternFlowIpv6HopLimitMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv6HopLimitMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv6HopLimitMetricTagSlice = append(obj.patternFlowIpv6HopLimitMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) Append(items ...PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv6HopLimitMetricTagSlice = append(obj.patternFlowIpv6HopLimitMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) Set(index int, newObj PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv6HopLimitMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) Clear() PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv6HopLimitMetricTag{} + obj.patternFlowIpv6HopLimitMetricTagSlice = []PatternFlowIpv6HopLimitMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) clearHolderSlice() PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { + if len(obj.patternFlowIpv6HopLimitMetricTagSlice) > 0 { + obj.patternFlowIpv6HopLimitMetricTagSlice = []PatternFlowIpv6HopLimitMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter) appendHolderSlice(item PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitPatternFlowIpv6HopLimitMetricTagIter { + obj.patternFlowIpv6HopLimitMetricTagSlice = append(obj.patternFlowIpv6HopLimitMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv6HopLimit) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6HopLimit.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv6HopLimit.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv6HopLimitMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv6HopLimit) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv6HopLimitChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv6HopLimitChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv6HopLimitChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv6HopLimitChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv6HopLimitChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv6HopLimitChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6HopLimit") + } + } else { + intVal := otg.PatternFlowIpv6HopLimit_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv6HopLimit_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv6_hop_limit_counter.go b/gosnappi/pattern_flow_ipv6_hop_limit_counter.go new file mode 100644 index 00000000..351d9ad5 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_hop_limit_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv6HopLimitCounter ***** +type patternFlowIpv6HopLimitCounter struct { + validation + obj *otg.PatternFlowIpv6HopLimitCounter + marshaller marshalPatternFlowIpv6HopLimitCounter + unMarshaller unMarshalPatternFlowIpv6HopLimitCounter +} + +func NewPatternFlowIpv6HopLimitCounter() PatternFlowIpv6HopLimitCounter { + obj := patternFlowIpv6HopLimitCounter{obj: &otg.PatternFlowIpv6HopLimitCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6HopLimitCounter) msg() *otg.PatternFlowIpv6HopLimitCounter { + return obj.obj +} + +func (obj *patternFlowIpv6HopLimitCounter) setMsg(msg *otg.PatternFlowIpv6HopLimitCounter) PatternFlowIpv6HopLimitCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6HopLimitCounter struct { + obj *patternFlowIpv6HopLimitCounter +} + +type marshalPatternFlowIpv6HopLimitCounter interface { + // ToProto marshals PatternFlowIpv6HopLimitCounter to protobuf object *otg.PatternFlowIpv6HopLimitCounter + ToProto() (*otg.PatternFlowIpv6HopLimitCounter, error) + // ToPbText marshals PatternFlowIpv6HopLimitCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6HopLimitCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6HopLimitCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6HopLimitCounter struct { + obj *patternFlowIpv6HopLimitCounter +} + +type unMarshalPatternFlowIpv6HopLimitCounter interface { + // FromProto unmarshals PatternFlowIpv6HopLimitCounter from protobuf object *otg.PatternFlowIpv6HopLimitCounter + FromProto(msg *otg.PatternFlowIpv6HopLimitCounter) (PatternFlowIpv6HopLimitCounter, error) + // FromPbText unmarshals PatternFlowIpv6HopLimitCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6HopLimitCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6HopLimitCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6HopLimitCounter) Marshal() marshalPatternFlowIpv6HopLimitCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6HopLimitCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6HopLimitCounter) Unmarshal() unMarshalPatternFlowIpv6HopLimitCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6HopLimitCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6HopLimitCounter) ToProto() (*otg.PatternFlowIpv6HopLimitCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6HopLimitCounter) FromProto(msg *otg.PatternFlowIpv6HopLimitCounter) (PatternFlowIpv6HopLimitCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6HopLimitCounter) 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 *unMarshalpatternFlowIpv6HopLimitCounter) 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 *marshalpatternFlowIpv6HopLimitCounter) 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 *unMarshalpatternFlowIpv6HopLimitCounter) 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 *marshalpatternFlowIpv6HopLimitCounter) 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 *unMarshalpatternFlowIpv6HopLimitCounter) 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 *patternFlowIpv6HopLimitCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6HopLimitCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6HopLimitCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6HopLimitCounter) Clone() (PatternFlowIpv6HopLimitCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6HopLimitCounter() + 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 +} + +// PatternFlowIpv6HopLimitCounter is integer counter pattern +type PatternFlowIpv6HopLimitCounter interface { + Validation + // msg marshals PatternFlowIpv6HopLimitCounter to protobuf object *otg.PatternFlowIpv6HopLimitCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv6HopLimitCounter + // setMsg unmarshals PatternFlowIpv6HopLimitCounter from protobuf object *otg.PatternFlowIpv6HopLimitCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6HopLimitCounter) PatternFlowIpv6HopLimitCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv6HopLimitCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6HopLimitCounter + // validate validates PatternFlowIpv6HopLimitCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6HopLimitCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv6HopLimitCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv6HopLimitCounter + SetStart(value uint32) PatternFlowIpv6HopLimitCounter + // HasStart checks if Start has been set in PatternFlowIpv6HopLimitCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv6HopLimitCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv6HopLimitCounter + SetStep(value uint32) PatternFlowIpv6HopLimitCounter + // HasStep checks if Step has been set in PatternFlowIpv6HopLimitCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv6HopLimitCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv6HopLimitCounter + SetCount(value uint32) PatternFlowIpv6HopLimitCounter + // HasCount checks if Count has been set in PatternFlowIpv6HopLimitCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv6HopLimitCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv6HopLimitCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv6HopLimitCounter object +func (obj *patternFlowIpv6HopLimitCounter) SetStart(value uint32) PatternFlowIpv6HopLimitCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv6HopLimitCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv6HopLimitCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv6HopLimitCounter object +func (obj *patternFlowIpv6HopLimitCounter) SetStep(value uint32) PatternFlowIpv6HopLimitCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6HopLimitCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6HopLimitCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv6HopLimitCounter object +func (obj *patternFlowIpv6HopLimitCounter) SetCount(value uint32) PatternFlowIpv6HopLimitCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv6HopLimitCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6HopLimitCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6HopLimitCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6HopLimitCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv6HopLimitCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(64) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_hop_limit_metric_tag.go b/gosnappi/pattern_flow_ipv6_hop_limit_metric_tag.go new file mode 100644 index 00000000..b1d8a9d0 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_hop_limit_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv6HopLimitMetricTag ***** +type patternFlowIpv6HopLimitMetricTag struct { + validation + obj *otg.PatternFlowIpv6HopLimitMetricTag + marshaller marshalPatternFlowIpv6HopLimitMetricTag + unMarshaller unMarshalPatternFlowIpv6HopLimitMetricTag +} + +func NewPatternFlowIpv6HopLimitMetricTag() PatternFlowIpv6HopLimitMetricTag { + obj := patternFlowIpv6HopLimitMetricTag{obj: &otg.PatternFlowIpv6HopLimitMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6HopLimitMetricTag) msg() *otg.PatternFlowIpv6HopLimitMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv6HopLimitMetricTag) setMsg(msg *otg.PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6HopLimitMetricTag struct { + obj *patternFlowIpv6HopLimitMetricTag +} + +type marshalPatternFlowIpv6HopLimitMetricTag interface { + // ToProto marshals PatternFlowIpv6HopLimitMetricTag to protobuf object *otg.PatternFlowIpv6HopLimitMetricTag + ToProto() (*otg.PatternFlowIpv6HopLimitMetricTag, error) + // ToPbText marshals PatternFlowIpv6HopLimitMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6HopLimitMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6HopLimitMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6HopLimitMetricTag struct { + obj *patternFlowIpv6HopLimitMetricTag +} + +type unMarshalPatternFlowIpv6HopLimitMetricTag interface { + // FromProto unmarshals PatternFlowIpv6HopLimitMetricTag from protobuf object *otg.PatternFlowIpv6HopLimitMetricTag + FromProto(msg *otg.PatternFlowIpv6HopLimitMetricTag) (PatternFlowIpv6HopLimitMetricTag, error) + // FromPbText unmarshals PatternFlowIpv6HopLimitMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6HopLimitMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6HopLimitMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6HopLimitMetricTag) Marshal() marshalPatternFlowIpv6HopLimitMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6HopLimitMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6HopLimitMetricTag) Unmarshal() unMarshalPatternFlowIpv6HopLimitMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6HopLimitMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6HopLimitMetricTag) ToProto() (*otg.PatternFlowIpv6HopLimitMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6HopLimitMetricTag) FromProto(msg *otg.PatternFlowIpv6HopLimitMetricTag) (PatternFlowIpv6HopLimitMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6HopLimitMetricTag) 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 *unMarshalpatternFlowIpv6HopLimitMetricTag) 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 *marshalpatternFlowIpv6HopLimitMetricTag) 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 *unMarshalpatternFlowIpv6HopLimitMetricTag) 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 *marshalpatternFlowIpv6HopLimitMetricTag) 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 *unMarshalpatternFlowIpv6HopLimitMetricTag) 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 *patternFlowIpv6HopLimitMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6HopLimitMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6HopLimitMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6HopLimitMetricTag) Clone() (PatternFlowIpv6HopLimitMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6HopLimitMetricTag() + 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 +} + +// PatternFlowIpv6HopLimitMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv6HopLimitMetricTag interface { + Validation + // msg marshals PatternFlowIpv6HopLimitMetricTag to protobuf object *otg.PatternFlowIpv6HopLimitMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv6HopLimitMetricTag + // setMsg unmarshals PatternFlowIpv6HopLimitMetricTag from protobuf object *otg.PatternFlowIpv6HopLimitMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6HopLimitMetricTag) PatternFlowIpv6HopLimitMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv6HopLimitMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6HopLimitMetricTag + // validate validates PatternFlowIpv6HopLimitMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6HopLimitMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv6HopLimitMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv6HopLimitMetricTag + SetName(value string) PatternFlowIpv6HopLimitMetricTag + // Offset returns uint32, set in PatternFlowIpv6HopLimitMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv6HopLimitMetricTag + SetOffset(value uint32) PatternFlowIpv6HopLimitMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv6HopLimitMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv6HopLimitMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv6HopLimitMetricTag + SetLength(value uint32) PatternFlowIpv6HopLimitMetricTag + // HasLength checks if Length has been set in PatternFlowIpv6HopLimitMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv6HopLimitMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv6HopLimitMetricTag object +func (obj *patternFlowIpv6HopLimitMetricTag) SetName(value string) PatternFlowIpv6HopLimitMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6HopLimitMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6HopLimitMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv6HopLimitMetricTag object +func (obj *patternFlowIpv6HopLimitMetricTag) SetOffset(value uint32) PatternFlowIpv6HopLimitMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6HopLimitMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6HopLimitMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv6HopLimitMetricTag object +func (obj *patternFlowIpv6HopLimitMetricTag) SetLength(value uint32) PatternFlowIpv6HopLimitMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv6HopLimitMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6HopLimitMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6HopLimitMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv6HopLimitMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv6HopLimitMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_next_header.go b/gosnappi/pattern_flow_ipv6_next_header.go new file mode 100644 index 00000000..16289e7c --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_next_header.go @@ -0,0 +1,712 @@ +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" +) + +// ***** PatternFlowIpv6NextHeader ***** +type patternFlowIpv6NextHeader struct { + validation + obj *otg.PatternFlowIpv6NextHeader + marshaller marshalPatternFlowIpv6NextHeader + unMarshaller unMarshalPatternFlowIpv6NextHeader + incrementHolder PatternFlowIpv6NextHeaderCounter + decrementHolder PatternFlowIpv6NextHeaderCounter + metricTagsHolder PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter +} + +func NewPatternFlowIpv6NextHeader() PatternFlowIpv6NextHeader { + obj := patternFlowIpv6NextHeader{obj: &otg.PatternFlowIpv6NextHeader{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6NextHeader) msg() *otg.PatternFlowIpv6NextHeader { + return obj.obj +} + +func (obj *patternFlowIpv6NextHeader) setMsg(msg *otg.PatternFlowIpv6NextHeader) PatternFlowIpv6NextHeader { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6NextHeader struct { + obj *patternFlowIpv6NextHeader +} + +type marshalPatternFlowIpv6NextHeader interface { + // ToProto marshals PatternFlowIpv6NextHeader to protobuf object *otg.PatternFlowIpv6NextHeader + ToProto() (*otg.PatternFlowIpv6NextHeader, error) + // ToPbText marshals PatternFlowIpv6NextHeader to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6NextHeader to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6NextHeader to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6NextHeader struct { + obj *patternFlowIpv6NextHeader +} + +type unMarshalPatternFlowIpv6NextHeader interface { + // FromProto unmarshals PatternFlowIpv6NextHeader from protobuf object *otg.PatternFlowIpv6NextHeader + FromProto(msg *otg.PatternFlowIpv6NextHeader) (PatternFlowIpv6NextHeader, error) + // FromPbText unmarshals PatternFlowIpv6NextHeader from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6NextHeader from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6NextHeader from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6NextHeader) Marshal() marshalPatternFlowIpv6NextHeader { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6NextHeader{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6NextHeader) Unmarshal() unMarshalPatternFlowIpv6NextHeader { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6NextHeader{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6NextHeader) ToProto() (*otg.PatternFlowIpv6NextHeader, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6NextHeader) FromProto(msg *otg.PatternFlowIpv6NextHeader) (PatternFlowIpv6NextHeader, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6NextHeader) 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 *unMarshalpatternFlowIpv6NextHeader) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv6NextHeader) 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 *unMarshalpatternFlowIpv6NextHeader) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv6NextHeader) 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 *unMarshalpatternFlowIpv6NextHeader) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv6NextHeader) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6NextHeader) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6NextHeader) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6NextHeader) Clone() (PatternFlowIpv6NextHeader, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6NextHeader() + 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 +} + +func (obj *patternFlowIpv6NextHeader) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv6NextHeader is next header +type PatternFlowIpv6NextHeader interface { + Validation + // msg marshals PatternFlowIpv6NextHeader to protobuf object *otg.PatternFlowIpv6NextHeader + // and doesn't set defaults + msg() *otg.PatternFlowIpv6NextHeader + // setMsg unmarshals PatternFlowIpv6NextHeader from protobuf object *otg.PatternFlowIpv6NextHeader + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6NextHeader) PatternFlowIpv6NextHeader + // provides marshal interface + Marshal() marshalPatternFlowIpv6NextHeader + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6NextHeader + // validate validates PatternFlowIpv6NextHeader + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6NextHeader, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv6NextHeaderChoiceEnum, set in PatternFlowIpv6NextHeader + Choice() PatternFlowIpv6NextHeaderChoiceEnum + // setChoice assigns PatternFlowIpv6NextHeaderChoiceEnum provided by user to PatternFlowIpv6NextHeader + setChoice(value PatternFlowIpv6NextHeaderChoiceEnum) PatternFlowIpv6NextHeader + // HasChoice checks if Choice has been set in PatternFlowIpv6NextHeader + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv6NextHeader. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv6NextHeader + SetValue(value uint32) PatternFlowIpv6NextHeader + // HasValue checks if Value has been set in PatternFlowIpv6NextHeader + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv6NextHeader. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv6NextHeader + SetValues(value []uint32) PatternFlowIpv6NextHeader + // Auto returns uint32, set in PatternFlowIpv6NextHeader. + Auto() uint32 + // HasAuto checks if Auto has been set in PatternFlowIpv6NextHeader + HasAuto() bool + // Increment returns PatternFlowIpv6NextHeaderCounter, set in PatternFlowIpv6NextHeader. + // PatternFlowIpv6NextHeaderCounter is integer counter pattern + Increment() PatternFlowIpv6NextHeaderCounter + // SetIncrement assigns PatternFlowIpv6NextHeaderCounter provided by user to PatternFlowIpv6NextHeader. + // PatternFlowIpv6NextHeaderCounter is integer counter pattern + SetIncrement(value PatternFlowIpv6NextHeaderCounter) PatternFlowIpv6NextHeader + // HasIncrement checks if Increment has been set in PatternFlowIpv6NextHeader + HasIncrement() bool + // Decrement returns PatternFlowIpv6NextHeaderCounter, set in PatternFlowIpv6NextHeader. + // PatternFlowIpv6NextHeaderCounter is integer counter pattern + Decrement() PatternFlowIpv6NextHeaderCounter + // SetDecrement assigns PatternFlowIpv6NextHeaderCounter provided by user to PatternFlowIpv6NextHeader. + // PatternFlowIpv6NextHeaderCounter is integer counter pattern + SetDecrement(value PatternFlowIpv6NextHeaderCounter) PatternFlowIpv6NextHeader + // HasDecrement checks if Decrement has been set in PatternFlowIpv6NextHeader + HasDecrement() bool + // MetricTags returns PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIterIter, set in PatternFlowIpv6NextHeader + MetricTags() PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter + setNil() +} + +type PatternFlowIpv6NextHeaderChoiceEnum string + +// Enum of Choice on PatternFlowIpv6NextHeader +var PatternFlowIpv6NextHeaderChoice = struct { + VALUE PatternFlowIpv6NextHeaderChoiceEnum + VALUES PatternFlowIpv6NextHeaderChoiceEnum + AUTO PatternFlowIpv6NextHeaderChoiceEnum + INCREMENT PatternFlowIpv6NextHeaderChoiceEnum + DECREMENT PatternFlowIpv6NextHeaderChoiceEnum +}{ + VALUE: PatternFlowIpv6NextHeaderChoiceEnum("value"), + VALUES: PatternFlowIpv6NextHeaderChoiceEnum("values"), + AUTO: PatternFlowIpv6NextHeaderChoiceEnum("auto"), + INCREMENT: PatternFlowIpv6NextHeaderChoiceEnum("increment"), + DECREMENT: PatternFlowIpv6NextHeaderChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv6NextHeader) Choice() PatternFlowIpv6NextHeaderChoiceEnum { + return PatternFlowIpv6NextHeaderChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv6NextHeader) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv6NextHeader) setChoice(value PatternFlowIpv6NextHeaderChoiceEnum) PatternFlowIpv6NextHeader { + intValue, ok := otg.PatternFlowIpv6NextHeader_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv6NextHeaderChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv6NextHeader_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Auto = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv6NextHeaderChoice.VALUE { + defaultValue := uint32(59) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv6NextHeaderChoice.VALUES { + defaultValue := []uint32{59} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv6NextHeaderChoice.AUTO { + defaultValue := uint32(59) + obj.obj.Auto = &defaultValue + } + + if value == PatternFlowIpv6NextHeaderChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv6NextHeaderCounter().msg() + } + + if value == PatternFlowIpv6NextHeaderChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv6NextHeaderCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv6NextHeader) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv6NextHeaderChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv6NextHeader) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv6NextHeader object +func (obj *patternFlowIpv6NextHeader) SetValue(value uint32) PatternFlowIpv6NextHeader { + obj.setChoice(PatternFlowIpv6NextHeaderChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv6NextHeader) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{59}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv6NextHeader object +func (obj *patternFlowIpv6NextHeader) SetValues(value []uint32) PatternFlowIpv6NextHeader { + obj.setChoice(PatternFlowIpv6NextHeaderChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowIpv6NextHeader) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(PatternFlowIpv6NextHeaderChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowIpv6NextHeader) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Increment returns a PatternFlowIpv6NextHeaderCounter +func (obj *patternFlowIpv6NextHeader) Increment() PatternFlowIpv6NextHeaderCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv6NextHeaderChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv6NextHeaderCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv6NextHeaderCounter +func (obj *patternFlowIpv6NextHeader) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv6NextHeaderCounter value in the PatternFlowIpv6NextHeader object +func (obj *patternFlowIpv6NextHeader) SetIncrement(value PatternFlowIpv6NextHeaderCounter) PatternFlowIpv6NextHeader { + obj.setChoice(PatternFlowIpv6NextHeaderChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv6NextHeaderCounter +func (obj *patternFlowIpv6NextHeader) Decrement() PatternFlowIpv6NextHeaderCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv6NextHeaderChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv6NextHeaderCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv6NextHeaderCounter +func (obj *patternFlowIpv6NextHeader) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv6NextHeaderCounter value in the PatternFlowIpv6NextHeader object +func (obj *patternFlowIpv6NextHeader) SetDecrement(value PatternFlowIpv6NextHeaderCounter) PatternFlowIpv6NextHeader { + obj.setChoice(PatternFlowIpv6NextHeaderChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv6NextHeaderMetricTag +func (obj *patternFlowIpv6NextHeader) MetricTags() PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv6NextHeaderMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter struct { + obj *patternFlowIpv6NextHeader + patternFlowIpv6NextHeaderMetricTagSlice []PatternFlowIpv6NextHeaderMetricTag + fieldPtr *[]*otg.PatternFlowIpv6NextHeaderMetricTag +} + +func newPatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter(ptr *[]*otg.PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { + return &patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter interface { + setMsg(*patternFlowIpv6NextHeader) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter + Items() []PatternFlowIpv6NextHeaderMetricTag + Add() PatternFlowIpv6NextHeaderMetricTag + Append(items ...PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter + Set(index int, newObj PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter + Clear() PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter + clearHolderSlice() PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter + appendHolderSlice(item PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter +} + +func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) setMsg(msg *patternFlowIpv6NextHeader) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv6NextHeaderMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) Items() []PatternFlowIpv6NextHeaderMetricTag { + return obj.patternFlowIpv6NextHeaderMetricTagSlice +} + +func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) Add() PatternFlowIpv6NextHeaderMetricTag { + newObj := &otg.PatternFlowIpv6NextHeaderMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv6NextHeaderMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv6NextHeaderMetricTagSlice = append(obj.patternFlowIpv6NextHeaderMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) Append(items ...PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv6NextHeaderMetricTagSlice = append(obj.patternFlowIpv6NextHeaderMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) Set(index int, newObj PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv6NextHeaderMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) Clear() PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv6NextHeaderMetricTag{} + obj.patternFlowIpv6NextHeaderMetricTagSlice = []PatternFlowIpv6NextHeaderMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) clearHolderSlice() PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { + if len(obj.patternFlowIpv6NextHeaderMetricTagSlice) > 0 { + obj.patternFlowIpv6NextHeaderMetricTagSlice = []PatternFlowIpv6NextHeaderMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter) appendHolderSlice(item PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderPatternFlowIpv6NextHeaderMetricTagIter { + obj.patternFlowIpv6NextHeaderMetricTagSlice = append(obj.patternFlowIpv6NextHeaderMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv6NextHeader) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6NextHeader.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv6NextHeader.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Auto != nil { + + if *obj.obj.Auto > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6NextHeader.Auto <= 255 but Got %d", *obj.obj.Auto)) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv6NextHeaderMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv6NextHeader) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv6NextHeaderChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv6NextHeaderChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv6NextHeaderChoice.VALUES + } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowIpv6NextHeaderChoice.AUTO + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv6NextHeaderChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv6NextHeaderChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv6NextHeaderChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6NextHeader") + } + } else { + intVal := otg.PatternFlowIpv6NextHeader_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv6NextHeader_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv6_next_header_counter.go b/gosnappi/pattern_flow_ipv6_next_header_counter.go new file mode 100644 index 00000000..28eb1216 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_next_header_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv6NextHeaderCounter ***** +type patternFlowIpv6NextHeaderCounter struct { + validation + obj *otg.PatternFlowIpv6NextHeaderCounter + marshaller marshalPatternFlowIpv6NextHeaderCounter + unMarshaller unMarshalPatternFlowIpv6NextHeaderCounter +} + +func NewPatternFlowIpv6NextHeaderCounter() PatternFlowIpv6NextHeaderCounter { + obj := patternFlowIpv6NextHeaderCounter{obj: &otg.PatternFlowIpv6NextHeaderCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6NextHeaderCounter) msg() *otg.PatternFlowIpv6NextHeaderCounter { + return obj.obj +} + +func (obj *patternFlowIpv6NextHeaderCounter) setMsg(msg *otg.PatternFlowIpv6NextHeaderCounter) PatternFlowIpv6NextHeaderCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6NextHeaderCounter struct { + obj *patternFlowIpv6NextHeaderCounter +} + +type marshalPatternFlowIpv6NextHeaderCounter interface { + // ToProto marshals PatternFlowIpv6NextHeaderCounter to protobuf object *otg.PatternFlowIpv6NextHeaderCounter + ToProto() (*otg.PatternFlowIpv6NextHeaderCounter, error) + // ToPbText marshals PatternFlowIpv6NextHeaderCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6NextHeaderCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6NextHeaderCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6NextHeaderCounter struct { + obj *patternFlowIpv6NextHeaderCounter +} + +type unMarshalPatternFlowIpv6NextHeaderCounter interface { + // FromProto unmarshals PatternFlowIpv6NextHeaderCounter from protobuf object *otg.PatternFlowIpv6NextHeaderCounter + FromProto(msg *otg.PatternFlowIpv6NextHeaderCounter) (PatternFlowIpv6NextHeaderCounter, error) + // FromPbText unmarshals PatternFlowIpv6NextHeaderCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6NextHeaderCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6NextHeaderCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6NextHeaderCounter) Marshal() marshalPatternFlowIpv6NextHeaderCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6NextHeaderCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6NextHeaderCounter) Unmarshal() unMarshalPatternFlowIpv6NextHeaderCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6NextHeaderCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6NextHeaderCounter) ToProto() (*otg.PatternFlowIpv6NextHeaderCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6NextHeaderCounter) FromProto(msg *otg.PatternFlowIpv6NextHeaderCounter) (PatternFlowIpv6NextHeaderCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6NextHeaderCounter) 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 *unMarshalpatternFlowIpv6NextHeaderCounter) 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 *marshalpatternFlowIpv6NextHeaderCounter) 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 *unMarshalpatternFlowIpv6NextHeaderCounter) 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 *marshalpatternFlowIpv6NextHeaderCounter) 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 *unMarshalpatternFlowIpv6NextHeaderCounter) 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 *patternFlowIpv6NextHeaderCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6NextHeaderCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6NextHeaderCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6NextHeaderCounter) Clone() (PatternFlowIpv6NextHeaderCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6NextHeaderCounter() + 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 +} + +// PatternFlowIpv6NextHeaderCounter is integer counter pattern +type PatternFlowIpv6NextHeaderCounter interface { + Validation + // msg marshals PatternFlowIpv6NextHeaderCounter to protobuf object *otg.PatternFlowIpv6NextHeaderCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv6NextHeaderCounter + // setMsg unmarshals PatternFlowIpv6NextHeaderCounter from protobuf object *otg.PatternFlowIpv6NextHeaderCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6NextHeaderCounter) PatternFlowIpv6NextHeaderCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv6NextHeaderCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6NextHeaderCounter + // validate validates PatternFlowIpv6NextHeaderCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6NextHeaderCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv6NextHeaderCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv6NextHeaderCounter + SetStart(value uint32) PatternFlowIpv6NextHeaderCounter + // HasStart checks if Start has been set in PatternFlowIpv6NextHeaderCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv6NextHeaderCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv6NextHeaderCounter + SetStep(value uint32) PatternFlowIpv6NextHeaderCounter + // HasStep checks if Step has been set in PatternFlowIpv6NextHeaderCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv6NextHeaderCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv6NextHeaderCounter + SetCount(value uint32) PatternFlowIpv6NextHeaderCounter + // HasCount checks if Count has been set in PatternFlowIpv6NextHeaderCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv6NextHeaderCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv6NextHeaderCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv6NextHeaderCounter object +func (obj *patternFlowIpv6NextHeaderCounter) SetStart(value uint32) PatternFlowIpv6NextHeaderCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv6NextHeaderCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv6NextHeaderCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv6NextHeaderCounter object +func (obj *patternFlowIpv6NextHeaderCounter) SetStep(value uint32) PatternFlowIpv6NextHeaderCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6NextHeaderCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6NextHeaderCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv6NextHeaderCounter object +func (obj *patternFlowIpv6NextHeaderCounter) SetCount(value uint32) PatternFlowIpv6NextHeaderCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv6NextHeaderCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6NextHeaderCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6NextHeaderCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6NextHeaderCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv6NextHeaderCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(59) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_next_header_metric_tag.go b/gosnappi/pattern_flow_ipv6_next_header_metric_tag.go new file mode 100644 index 00000000..ccb404d2 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_next_header_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv6NextHeaderMetricTag ***** +type patternFlowIpv6NextHeaderMetricTag struct { + validation + obj *otg.PatternFlowIpv6NextHeaderMetricTag + marshaller marshalPatternFlowIpv6NextHeaderMetricTag + unMarshaller unMarshalPatternFlowIpv6NextHeaderMetricTag +} + +func NewPatternFlowIpv6NextHeaderMetricTag() PatternFlowIpv6NextHeaderMetricTag { + obj := patternFlowIpv6NextHeaderMetricTag{obj: &otg.PatternFlowIpv6NextHeaderMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6NextHeaderMetricTag) msg() *otg.PatternFlowIpv6NextHeaderMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv6NextHeaderMetricTag) setMsg(msg *otg.PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6NextHeaderMetricTag struct { + obj *patternFlowIpv6NextHeaderMetricTag +} + +type marshalPatternFlowIpv6NextHeaderMetricTag interface { + // ToProto marshals PatternFlowIpv6NextHeaderMetricTag to protobuf object *otg.PatternFlowIpv6NextHeaderMetricTag + ToProto() (*otg.PatternFlowIpv6NextHeaderMetricTag, error) + // ToPbText marshals PatternFlowIpv6NextHeaderMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6NextHeaderMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6NextHeaderMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6NextHeaderMetricTag struct { + obj *patternFlowIpv6NextHeaderMetricTag +} + +type unMarshalPatternFlowIpv6NextHeaderMetricTag interface { + // FromProto unmarshals PatternFlowIpv6NextHeaderMetricTag from protobuf object *otg.PatternFlowIpv6NextHeaderMetricTag + FromProto(msg *otg.PatternFlowIpv6NextHeaderMetricTag) (PatternFlowIpv6NextHeaderMetricTag, error) + // FromPbText unmarshals PatternFlowIpv6NextHeaderMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6NextHeaderMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6NextHeaderMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6NextHeaderMetricTag) Marshal() marshalPatternFlowIpv6NextHeaderMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6NextHeaderMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6NextHeaderMetricTag) Unmarshal() unMarshalPatternFlowIpv6NextHeaderMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6NextHeaderMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6NextHeaderMetricTag) ToProto() (*otg.PatternFlowIpv6NextHeaderMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6NextHeaderMetricTag) FromProto(msg *otg.PatternFlowIpv6NextHeaderMetricTag) (PatternFlowIpv6NextHeaderMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6NextHeaderMetricTag) 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 *unMarshalpatternFlowIpv6NextHeaderMetricTag) 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 *marshalpatternFlowIpv6NextHeaderMetricTag) 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 *unMarshalpatternFlowIpv6NextHeaderMetricTag) 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 *marshalpatternFlowIpv6NextHeaderMetricTag) 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 *unMarshalpatternFlowIpv6NextHeaderMetricTag) 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 *patternFlowIpv6NextHeaderMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6NextHeaderMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6NextHeaderMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6NextHeaderMetricTag) Clone() (PatternFlowIpv6NextHeaderMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6NextHeaderMetricTag() + 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 +} + +// PatternFlowIpv6NextHeaderMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv6NextHeaderMetricTag interface { + Validation + // msg marshals PatternFlowIpv6NextHeaderMetricTag to protobuf object *otg.PatternFlowIpv6NextHeaderMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv6NextHeaderMetricTag + // setMsg unmarshals PatternFlowIpv6NextHeaderMetricTag from protobuf object *otg.PatternFlowIpv6NextHeaderMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6NextHeaderMetricTag) PatternFlowIpv6NextHeaderMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv6NextHeaderMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6NextHeaderMetricTag + // validate validates PatternFlowIpv6NextHeaderMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6NextHeaderMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv6NextHeaderMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv6NextHeaderMetricTag + SetName(value string) PatternFlowIpv6NextHeaderMetricTag + // Offset returns uint32, set in PatternFlowIpv6NextHeaderMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv6NextHeaderMetricTag + SetOffset(value uint32) PatternFlowIpv6NextHeaderMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv6NextHeaderMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv6NextHeaderMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv6NextHeaderMetricTag + SetLength(value uint32) PatternFlowIpv6NextHeaderMetricTag + // HasLength checks if Length has been set in PatternFlowIpv6NextHeaderMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv6NextHeaderMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv6NextHeaderMetricTag object +func (obj *patternFlowIpv6NextHeaderMetricTag) SetName(value string) PatternFlowIpv6NextHeaderMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6NextHeaderMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6NextHeaderMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv6NextHeaderMetricTag object +func (obj *patternFlowIpv6NextHeaderMetricTag) SetOffset(value uint32) PatternFlowIpv6NextHeaderMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6NextHeaderMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6NextHeaderMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv6NextHeaderMetricTag object +func (obj *patternFlowIpv6NextHeaderMetricTag) SetLength(value uint32) PatternFlowIpv6NextHeaderMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv6NextHeaderMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6NextHeaderMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6NextHeaderMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv6NextHeaderMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv6NextHeaderMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_payload_length.go b/gosnappi/pattern_flow_ipv6_payload_length.go new file mode 100644 index 00000000..de24fc7f --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_payload_length.go @@ -0,0 +1,712 @@ +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" +) + +// ***** PatternFlowIpv6PayloadLength ***** +type patternFlowIpv6PayloadLength struct { + validation + obj *otg.PatternFlowIpv6PayloadLength + marshaller marshalPatternFlowIpv6PayloadLength + unMarshaller unMarshalPatternFlowIpv6PayloadLength + incrementHolder PatternFlowIpv6PayloadLengthCounter + decrementHolder PatternFlowIpv6PayloadLengthCounter + metricTagsHolder PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter +} + +func NewPatternFlowIpv6PayloadLength() PatternFlowIpv6PayloadLength { + obj := patternFlowIpv6PayloadLength{obj: &otg.PatternFlowIpv6PayloadLength{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6PayloadLength) msg() *otg.PatternFlowIpv6PayloadLength { + return obj.obj +} + +func (obj *patternFlowIpv6PayloadLength) setMsg(msg *otg.PatternFlowIpv6PayloadLength) PatternFlowIpv6PayloadLength { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6PayloadLength struct { + obj *patternFlowIpv6PayloadLength +} + +type marshalPatternFlowIpv6PayloadLength interface { + // ToProto marshals PatternFlowIpv6PayloadLength to protobuf object *otg.PatternFlowIpv6PayloadLength + ToProto() (*otg.PatternFlowIpv6PayloadLength, error) + // ToPbText marshals PatternFlowIpv6PayloadLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6PayloadLength to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6PayloadLength to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6PayloadLength struct { + obj *patternFlowIpv6PayloadLength +} + +type unMarshalPatternFlowIpv6PayloadLength interface { + // FromProto unmarshals PatternFlowIpv6PayloadLength from protobuf object *otg.PatternFlowIpv6PayloadLength + FromProto(msg *otg.PatternFlowIpv6PayloadLength) (PatternFlowIpv6PayloadLength, error) + // FromPbText unmarshals PatternFlowIpv6PayloadLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6PayloadLength from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6PayloadLength from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6PayloadLength) Marshal() marshalPatternFlowIpv6PayloadLength { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6PayloadLength{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6PayloadLength) Unmarshal() unMarshalPatternFlowIpv6PayloadLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6PayloadLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6PayloadLength) ToProto() (*otg.PatternFlowIpv6PayloadLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6PayloadLength) FromProto(msg *otg.PatternFlowIpv6PayloadLength) (PatternFlowIpv6PayloadLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6PayloadLength) 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 *unMarshalpatternFlowIpv6PayloadLength) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv6PayloadLength) 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 *unMarshalpatternFlowIpv6PayloadLength) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv6PayloadLength) 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 *unMarshalpatternFlowIpv6PayloadLength) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv6PayloadLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6PayloadLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6PayloadLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6PayloadLength) Clone() (PatternFlowIpv6PayloadLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6PayloadLength() + 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 +} + +func (obj *patternFlowIpv6PayloadLength) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv6PayloadLength is payload length +type PatternFlowIpv6PayloadLength interface { + Validation + // msg marshals PatternFlowIpv6PayloadLength to protobuf object *otg.PatternFlowIpv6PayloadLength + // and doesn't set defaults + msg() *otg.PatternFlowIpv6PayloadLength + // setMsg unmarshals PatternFlowIpv6PayloadLength from protobuf object *otg.PatternFlowIpv6PayloadLength + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6PayloadLength) PatternFlowIpv6PayloadLength + // provides marshal interface + Marshal() marshalPatternFlowIpv6PayloadLength + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6PayloadLength + // validate validates PatternFlowIpv6PayloadLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6PayloadLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv6PayloadLengthChoiceEnum, set in PatternFlowIpv6PayloadLength + Choice() PatternFlowIpv6PayloadLengthChoiceEnum + // setChoice assigns PatternFlowIpv6PayloadLengthChoiceEnum provided by user to PatternFlowIpv6PayloadLength + setChoice(value PatternFlowIpv6PayloadLengthChoiceEnum) PatternFlowIpv6PayloadLength + // HasChoice checks if Choice has been set in PatternFlowIpv6PayloadLength + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv6PayloadLength. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv6PayloadLength + SetValue(value uint32) PatternFlowIpv6PayloadLength + // HasValue checks if Value has been set in PatternFlowIpv6PayloadLength + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv6PayloadLength. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv6PayloadLength + SetValues(value []uint32) PatternFlowIpv6PayloadLength + // Auto returns uint32, set in PatternFlowIpv6PayloadLength. + Auto() uint32 + // HasAuto checks if Auto has been set in PatternFlowIpv6PayloadLength + HasAuto() bool + // Increment returns PatternFlowIpv6PayloadLengthCounter, set in PatternFlowIpv6PayloadLength. + // PatternFlowIpv6PayloadLengthCounter is integer counter pattern + Increment() PatternFlowIpv6PayloadLengthCounter + // SetIncrement assigns PatternFlowIpv6PayloadLengthCounter provided by user to PatternFlowIpv6PayloadLength. + // PatternFlowIpv6PayloadLengthCounter is integer counter pattern + SetIncrement(value PatternFlowIpv6PayloadLengthCounter) PatternFlowIpv6PayloadLength + // HasIncrement checks if Increment has been set in PatternFlowIpv6PayloadLength + HasIncrement() bool + // Decrement returns PatternFlowIpv6PayloadLengthCounter, set in PatternFlowIpv6PayloadLength. + // PatternFlowIpv6PayloadLengthCounter is integer counter pattern + Decrement() PatternFlowIpv6PayloadLengthCounter + // SetDecrement assigns PatternFlowIpv6PayloadLengthCounter provided by user to PatternFlowIpv6PayloadLength. + // PatternFlowIpv6PayloadLengthCounter is integer counter pattern + SetDecrement(value PatternFlowIpv6PayloadLengthCounter) PatternFlowIpv6PayloadLength + // HasDecrement checks if Decrement has been set in PatternFlowIpv6PayloadLength + HasDecrement() bool + // MetricTags returns PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIterIter, set in PatternFlowIpv6PayloadLength + MetricTags() PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter + setNil() +} + +type PatternFlowIpv6PayloadLengthChoiceEnum string + +// Enum of Choice on PatternFlowIpv6PayloadLength +var PatternFlowIpv6PayloadLengthChoice = struct { + VALUE PatternFlowIpv6PayloadLengthChoiceEnum + VALUES PatternFlowIpv6PayloadLengthChoiceEnum + AUTO PatternFlowIpv6PayloadLengthChoiceEnum + INCREMENT PatternFlowIpv6PayloadLengthChoiceEnum + DECREMENT PatternFlowIpv6PayloadLengthChoiceEnum +}{ + VALUE: PatternFlowIpv6PayloadLengthChoiceEnum("value"), + VALUES: PatternFlowIpv6PayloadLengthChoiceEnum("values"), + AUTO: PatternFlowIpv6PayloadLengthChoiceEnum("auto"), + INCREMENT: PatternFlowIpv6PayloadLengthChoiceEnum("increment"), + DECREMENT: PatternFlowIpv6PayloadLengthChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv6PayloadLength) Choice() PatternFlowIpv6PayloadLengthChoiceEnum { + return PatternFlowIpv6PayloadLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv6PayloadLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv6PayloadLength) setChoice(value PatternFlowIpv6PayloadLengthChoiceEnum) PatternFlowIpv6PayloadLength { + intValue, ok := otg.PatternFlowIpv6PayloadLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv6PayloadLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv6PayloadLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Auto = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv6PayloadLengthChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv6PayloadLengthChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv6PayloadLengthChoice.AUTO { + defaultValue := uint32(0) + obj.obj.Auto = &defaultValue + } + + if value == PatternFlowIpv6PayloadLengthChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv6PayloadLengthCounter().msg() + } + + if value == PatternFlowIpv6PayloadLengthChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv6PayloadLengthCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv6PayloadLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv6PayloadLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv6PayloadLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv6PayloadLength object +func (obj *patternFlowIpv6PayloadLength) SetValue(value uint32) PatternFlowIpv6PayloadLength { + obj.setChoice(PatternFlowIpv6PayloadLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv6PayloadLength) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv6PayloadLength object +func (obj *patternFlowIpv6PayloadLength) SetValues(value []uint32) PatternFlowIpv6PayloadLength { + obj.setChoice(PatternFlowIpv6PayloadLengthChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowIpv6PayloadLength) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(PatternFlowIpv6PayloadLengthChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowIpv6PayloadLength) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Increment returns a PatternFlowIpv6PayloadLengthCounter +func (obj *patternFlowIpv6PayloadLength) Increment() PatternFlowIpv6PayloadLengthCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv6PayloadLengthChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv6PayloadLengthCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv6PayloadLengthCounter +func (obj *patternFlowIpv6PayloadLength) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv6PayloadLengthCounter value in the PatternFlowIpv6PayloadLength object +func (obj *patternFlowIpv6PayloadLength) SetIncrement(value PatternFlowIpv6PayloadLengthCounter) PatternFlowIpv6PayloadLength { + obj.setChoice(PatternFlowIpv6PayloadLengthChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv6PayloadLengthCounter +func (obj *patternFlowIpv6PayloadLength) Decrement() PatternFlowIpv6PayloadLengthCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv6PayloadLengthChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv6PayloadLengthCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv6PayloadLengthCounter +func (obj *patternFlowIpv6PayloadLength) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv6PayloadLengthCounter value in the PatternFlowIpv6PayloadLength object +func (obj *patternFlowIpv6PayloadLength) SetDecrement(value PatternFlowIpv6PayloadLengthCounter) PatternFlowIpv6PayloadLength { + obj.setChoice(PatternFlowIpv6PayloadLengthChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv6PayloadLengthMetricTag +func (obj *patternFlowIpv6PayloadLength) MetricTags() PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv6PayloadLengthMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter struct { + obj *patternFlowIpv6PayloadLength + patternFlowIpv6PayloadLengthMetricTagSlice []PatternFlowIpv6PayloadLengthMetricTag + fieldPtr *[]*otg.PatternFlowIpv6PayloadLengthMetricTag +} + +func newPatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter(ptr *[]*otg.PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { + return &patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter interface { + setMsg(*patternFlowIpv6PayloadLength) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter + Items() []PatternFlowIpv6PayloadLengthMetricTag + Add() PatternFlowIpv6PayloadLengthMetricTag + Append(items ...PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter + Set(index int, newObj PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter + Clear() PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter + clearHolderSlice() PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter + appendHolderSlice(item PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter +} + +func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) setMsg(msg *patternFlowIpv6PayloadLength) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv6PayloadLengthMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) Items() []PatternFlowIpv6PayloadLengthMetricTag { + return obj.patternFlowIpv6PayloadLengthMetricTagSlice +} + +func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) Add() PatternFlowIpv6PayloadLengthMetricTag { + newObj := &otg.PatternFlowIpv6PayloadLengthMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv6PayloadLengthMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv6PayloadLengthMetricTagSlice = append(obj.patternFlowIpv6PayloadLengthMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) Append(items ...PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv6PayloadLengthMetricTagSlice = append(obj.patternFlowIpv6PayloadLengthMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) Set(index int, newObj PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv6PayloadLengthMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) Clear() PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv6PayloadLengthMetricTag{} + obj.patternFlowIpv6PayloadLengthMetricTagSlice = []PatternFlowIpv6PayloadLengthMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) clearHolderSlice() PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { + if len(obj.patternFlowIpv6PayloadLengthMetricTagSlice) > 0 { + obj.patternFlowIpv6PayloadLengthMetricTagSlice = []PatternFlowIpv6PayloadLengthMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter) appendHolderSlice(item PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthPatternFlowIpv6PayloadLengthMetricTagIter { + obj.patternFlowIpv6PayloadLengthMetricTagSlice = append(obj.patternFlowIpv6PayloadLengthMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv6PayloadLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6PayloadLength.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv6PayloadLength.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Auto != nil { + + if *obj.obj.Auto > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6PayloadLength.Auto <= 65535 but Got %d", *obj.obj.Auto)) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv6PayloadLengthMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv6PayloadLength) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv6PayloadLengthChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv6PayloadLengthChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv6PayloadLengthChoice.VALUES + } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowIpv6PayloadLengthChoice.AUTO + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv6PayloadLengthChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv6PayloadLengthChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv6PayloadLengthChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6PayloadLength") + } + } else { + intVal := otg.PatternFlowIpv6PayloadLength_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv6PayloadLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv6_payload_length_counter.go b/gosnappi/pattern_flow_ipv6_payload_length_counter.go new file mode 100644 index 00000000..f92bb2a9 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_payload_length_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv6PayloadLengthCounter ***** +type patternFlowIpv6PayloadLengthCounter struct { + validation + obj *otg.PatternFlowIpv6PayloadLengthCounter + marshaller marshalPatternFlowIpv6PayloadLengthCounter + unMarshaller unMarshalPatternFlowIpv6PayloadLengthCounter +} + +func NewPatternFlowIpv6PayloadLengthCounter() PatternFlowIpv6PayloadLengthCounter { + obj := patternFlowIpv6PayloadLengthCounter{obj: &otg.PatternFlowIpv6PayloadLengthCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6PayloadLengthCounter) msg() *otg.PatternFlowIpv6PayloadLengthCounter { + return obj.obj +} + +func (obj *patternFlowIpv6PayloadLengthCounter) setMsg(msg *otg.PatternFlowIpv6PayloadLengthCounter) PatternFlowIpv6PayloadLengthCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6PayloadLengthCounter struct { + obj *patternFlowIpv6PayloadLengthCounter +} + +type marshalPatternFlowIpv6PayloadLengthCounter interface { + // ToProto marshals PatternFlowIpv6PayloadLengthCounter to protobuf object *otg.PatternFlowIpv6PayloadLengthCounter + ToProto() (*otg.PatternFlowIpv6PayloadLengthCounter, error) + // ToPbText marshals PatternFlowIpv6PayloadLengthCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6PayloadLengthCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6PayloadLengthCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6PayloadLengthCounter struct { + obj *patternFlowIpv6PayloadLengthCounter +} + +type unMarshalPatternFlowIpv6PayloadLengthCounter interface { + // FromProto unmarshals PatternFlowIpv6PayloadLengthCounter from protobuf object *otg.PatternFlowIpv6PayloadLengthCounter + FromProto(msg *otg.PatternFlowIpv6PayloadLengthCounter) (PatternFlowIpv6PayloadLengthCounter, error) + // FromPbText unmarshals PatternFlowIpv6PayloadLengthCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6PayloadLengthCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6PayloadLengthCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6PayloadLengthCounter) Marshal() marshalPatternFlowIpv6PayloadLengthCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6PayloadLengthCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6PayloadLengthCounter) Unmarshal() unMarshalPatternFlowIpv6PayloadLengthCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6PayloadLengthCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6PayloadLengthCounter) ToProto() (*otg.PatternFlowIpv6PayloadLengthCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6PayloadLengthCounter) FromProto(msg *otg.PatternFlowIpv6PayloadLengthCounter) (PatternFlowIpv6PayloadLengthCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6PayloadLengthCounter) 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 *unMarshalpatternFlowIpv6PayloadLengthCounter) 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 *marshalpatternFlowIpv6PayloadLengthCounter) 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 *unMarshalpatternFlowIpv6PayloadLengthCounter) 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 *marshalpatternFlowIpv6PayloadLengthCounter) 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 *unMarshalpatternFlowIpv6PayloadLengthCounter) 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 *patternFlowIpv6PayloadLengthCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6PayloadLengthCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6PayloadLengthCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6PayloadLengthCounter) Clone() (PatternFlowIpv6PayloadLengthCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6PayloadLengthCounter() + 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 +} + +// PatternFlowIpv6PayloadLengthCounter is integer counter pattern +type PatternFlowIpv6PayloadLengthCounter interface { + Validation + // msg marshals PatternFlowIpv6PayloadLengthCounter to protobuf object *otg.PatternFlowIpv6PayloadLengthCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv6PayloadLengthCounter + // setMsg unmarshals PatternFlowIpv6PayloadLengthCounter from protobuf object *otg.PatternFlowIpv6PayloadLengthCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6PayloadLengthCounter) PatternFlowIpv6PayloadLengthCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv6PayloadLengthCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6PayloadLengthCounter + // validate validates PatternFlowIpv6PayloadLengthCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6PayloadLengthCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv6PayloadLengthCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv6PayloadLengthCounter + SetStart(value uint32) PatternFlowIpv6PayloadLengthCounter + // HasStart checks if Start has been set in PatternFlowIpv6PayloadLengthCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv6PayloadLengthCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv6PayloadLengthCounter + SetStep(value uint32) PatternFlowIpv6PayloadLengthCounter + // HasStep checks if Step has been set in PatternFlowIpv6PayloadLengthCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv6PayloadLengthCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv6PayloadLengthCounter + SetCount(value uint32) PatternFlowIpv6PayloadLengthCounter + // HasCount checks if Count has been set in PatternFlowIpv6PayloadLengthCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv6PayloadLengthCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv6PayloadLengthCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv6PayloadLengthCounter object +func (obj *patternFlowIpv6PayloadLengthCounter) SetStart(value uint32) PatternFlowIpv6PayloadLengthCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv6PayloadLengthCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv6PayloadLengthCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv6PayloadLengthCounter object +func (obj *patternFlowIpv6PayloadLengthCounter) SetStep(value uint32) PatternFlowIpv6PayloadLengthCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6PayloadLengthCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6PayloadLengthCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv6PayloadLengthCounter object +func (obj *patternFlowIpv6PayloadLengthCounter) SetCount(value uint32) PatternFlowIpv6PayloadLengthCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv6PayloadLengthCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6PayloadLengthCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6PayloadLengthCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6PayloadLengthCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv6PayloadLengthCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_payload_length_metric_tag.go b/gosnappi/pattern_flow_ipv6_payload_length_metric_tag.go new file mode 100644 index 00000000..0e25d464 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_payload_length_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv6PayloadLengthMetricTag ***** +type patternFlowIpv6PayloadLengthMetricTag struct { + validation + obj *otg.PatternFlowIpv6PayloadLengthMetricTag + marshaller marshalPatternFlowIpv6PayloadLengthMetricTag + unMarshaller unMarshalPatternFlowIpv6PayloadLengthMetricTag +} + +func NewPatternFlowIpv6PayloadLengthMetricTag() PatternFlowIpv6PayloadLengthMetricTag { + obj := patternFlowIpv6PayloadLengthMetricTag{obj: &otg.PatternFlowIpv6PayloadLengthMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6PayloadLengthMetricTag) msg() *otg.PatternFlowIpv6PayloadLengthMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv6PayloadLengthMetricTag) setMsg(msg *otg.PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6PayloadLengthMetricTag struct { + obj *patternFlowIpv6PayloadLengthMetricTag +} + +type marshalPatternFlowIpv6PayloadLengthMetricTag interface { + // ToProto marshals PatternFlowIpv6PayloadLengthMetricTag to protobuf object *otg.PatternFlowIpv6PayloadLengthMetricTag + ToProto() (*otg.PatternFlowIpv6PayloadLengthMetricTag, error) + // ToPbText marshals PatternFlowIpv6PayloadLengthMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6PayloadLengthMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6PayloadLengthMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6PayloadLengthMetricTag struct { + obj *patternFlowIpv6PayloadLengthMetricTag +} + +type unMarshalPatternFlowIpv6PayloadLengthMetricTag interface { + // FromProto unmarshals PatternFlowIpv6PayloadLengthMetricTag from protobuf object *otg.PatternFlowIpv6PayloadLengthMetricTag + FromProto(msg *otg.PatternFlowIpv6PayloadLengthMetricTag) (PatternFlowIpv6PayloadLengthMetricTag, error) + // FromPbText unmarshals PatternFlowIpv6PayloadLengthMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6PayloadLengthMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6PayloadLengthMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6PayloadLengthMetricTag) Marshal() marshalPatternFlowIpv6PayloadLengthMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6PayloadLengthMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6PayloadLengthMetricTag) Unmarshal() unMarshalPatternFlowIpv6PayloadLengthMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6PayloadLengthMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6PayloadLengthMetricTag) ToProto() (*otg.PatternFlowIpv6PayloadLengthMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6PayloadLengthMetricTag) FromProto(msg *otg.PatternFlowIpv6PayloadLengthMetricTag) (PatternFlowIpv6PayloadLengthMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6PayloadLengthMetricTag) 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 *unMarshalpatternFlowIpv6PayloadLengthMetricTag) 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 *marshalpatternFlowIpv6PayloadLengthMetricTag) 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 *unMarshalpatternFlowIpv6PayloadLengthMetricTag) 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 *marshalpatternFlowIpv6PayloadLengthMetricTag) 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 *unMarshalpatternFlowIpv6PayloadLengthMetricTag) 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 *patternFlowIpv6PayloadLengthMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6PayloadLengthMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6PayloadLengthMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6PayloadLengthMetricTag) Clone() (PatternFlowIpv6PayloadLengthMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6PayloadLengthMetricTag() + 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 +} + +// PatternFlowIpv6PayloadLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv6PayloadLengthMetricTag interface { + Validation + // msg marshals PatternFlowIpv6PayloadLengthMetricTag to protobuf object *otg.PatternFlowIpv6PayloadLengthMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv6PayloadLengthMetricTag + // setMsg unmarshals PatternFlowIpv6PayloadLengthMetricTag from protobuf object *otg.PatternFlowIpv6PayloadLengthMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6PayloadLengthMetricTag) PatternFlowIpv6PayloadLengthMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv6PayloadLengthMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6PayloadLengthMetricTag + // validate validates PatternFlowIpv6PayloadLengthMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6PayloadLengthMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv6PayloadLengthMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv6PayloadLengthMetricTag + SetName(value string) PatternFlowIpv6PayloadLengthMetricTag + // Offset returns uint32, set in PatternFlowIpv6PayloadLengthMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv6PayloadLengthMetricTag + SetOffset(value uint32) PatternFlowIpv6PayloadLengthMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv6PayloadLengthMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv6PayloadLengthMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv6PayloadLengthMetricTag + SetLength(value uint32) PatternFlowIpv6PayloadLengthMetricTag + // HasLength checks if Length has been set in PatternFlowIpv6PayloadLengthMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv6PayloadLengthMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv6PayloadLengthMetricTag object +func (obj *patternFlowIpv6PayloadLengthMetricTag) SetName(value string) PatternFlowIpv6PayloadLengthMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6PayloadLengthMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6PayloadLengthMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv6PayloadLengthMetricTag object +func (obj *patternFlowIpv6PayloadLengthMetricTag) SetOffset(value uint32) PatternFlowIpv6PayloadLengthMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6PayloadLengthMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6PayloadLengthMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv6PayloadLengthMetricTag object +func (obj *patternFlowIpv6PayloadLengthMetricTag) SetLength(value uint32) PatternFlowIpv6PayloadLengthMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv6PayloadLengthMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6PayloadLengthMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6PayloadLengthMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv6PayloadLengthMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv6PayloadLengthMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_src.go b/gosnappi/pattern_flow_ipv6_src.go new file mode 100644 index 00000000..871f32cf --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_src.go @@ -0,0 +1,658 @@ +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" +) + +// ***** PatternFlowIpv6Src ***** +type patternFlowIpv6Src struct { + validation + obj *otg.PatternFlowIpv6Src + marshaller marshalPatternFlowIpv6Src + unMarshaller unMarshalPatternFlowIpv6Src + incrementHolder PatternFlowIpv6SrcCounter + decrementHolder PatternFlowIpv6SrcCounter + metricTagsHolder PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter +} + +func NewPatternFlowIpv6Src() PatternFlowIpv6Src { + obj := patternFlowIpv6Src{obj: &otg.PatternFlowIpv6Src{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6Src) msg() *otg.PatternFlowIpv6Src { + return obj.obj +} + +func (obj *patternFlowIpv6Src) setMsg(msg *otg.PatternFlowIpv6Src) PatternFlowIpv6Src { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6Src struct { + obj *patternFlowIpv6Src +} + +type marshalPatternFlowIpv6Src interface { + // ToProto marshals PatternFlowIpv6Src to protobuf object *otg.PatternFlowIpv6Src + ToProto() (*otg.PatternFlowIpv6Src, error) + // ToPbText marshals PatternFlowIpv6Src to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6Src to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6Src to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6Src struct { + obj *patternFlowIpv6Src +} + +type unMarshalPatternFlowIpv6Src interface { + // FromProto unmarshals PatternFlowIpv6Src from protobuf object *otg.PatternFlowIpv6Src + FromProto(msg *otg.PatternFlowIpv6Src) (PatternFlowIpv6Src, error) + // FromPbText unmarshals PatternFlowIpv6Src from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6Src from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6Src from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6Src) Marshal() marshalPatternFlowIpv6Src { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6Src{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6Src) Unmarshal() unMarshalPatternFlowIpv6Src { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6Src{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6Src) ToProto() (*otg.PatternFlowIpv6Src, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6Src) FromProto(msg *otg.PatternFlowIpv6Src) (PatternFlowIpv6Src, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6Src) 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 *unMarshalpatternFlowIpv6Src) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv6Src) 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 *unMarshalpatternFlowIpv6Src) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv6Src) 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 *unMarshalpatternFlowIpv6Src) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv6Src) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6Src) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6Src) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6Src) Clone() (PatternFlowIpv6Src, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6Src() + 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 +} + +func (obj *patternFlowIpv6Src) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv6Src is source address +type PatternFlowIpv6Src interface { + Validation + // msg marshals PatternFlowIpv6Src to protobuf object *otg.PatternFlowIpv6Src + // and doesn't set defaults + msg() *otg.PatternFlowIpv6Src + // setMsg unmarshals PatternFlowIpv6Src from protobuf object *otg.PatternFlowIpv6Src + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6Src) PatternFlowIpv6Src + // provides marshal interface + Marshal() marshalPatternFlowIpv6Src + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6Src + // validate validates PatternFlowIpv6Src + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6Src, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv6SrcChoiceEnum, set in PatternFlowIpv6Src + Choice() PatternFlowIpv6SrcChoiceEnum + // setChoice assigns PatternFlowIpv6SrcChoiceEnum provided by user to PatternFlowIpv6Src + setChoice(value PatternFlowIpv6SrcChoiceEnum) PatternFlowIpv6Src + // HasChoice checks if Choice has been set in PatternFlowIpv6Src + HasChoice() bool + // Value returns string, set in PatternFlowIpv6Src. + Value() string + // SetValue assigns string provided by user to PatternFlowIpv6Src + SetValue(value string) PatternFlowIpv6Src + // HasValue checks if Value has been set in PatternFlowIpv6Src + HasValue() bool + // Values returns []string, set in PatternFlowIpv6Src. + Values() []string + // SetValues assigns []string provided by user to PatternFlowIpv6Src + SetValues(value []string) PatternFlowIpv6Src + // Increment returns PatternFlowIpv6SrcCounter, set in PatternFlowIpv6Src. + // PatternFlowIpv6SrcCounter is ipv6 counter pattern + Increment() PatternFlowIpv6SrcCounter + // SetIncrement assigns PatternFlowIpv6SrcCounter provided by user to PatternFlowIpv6Src. + // PatternFlowIpv6SrcCounter is ipv6 counter pattern + SetIncrement(value PatternFlowIpv6SrcCounter) PatternFlowIpv6Src + // HasIncrement checks if Increment has been set in PatternFlowIpv6Src + HasIncrement() bool + // Decrement returns PatternFlowIpv6SrcCounter, set in PatternFlowIpv6Src. + // PatternFlowIpv6SrcCounter is ipv6 counter pattern + Decrement() PatternFlowIpv6SrcCounter + // SetDecrement assigns PatternFlowIpv6SrcCounter provided by user to PatternFlowIpv6Src. + // PatternFlowIpv6SrcCounter is ipv6 counter pattern + SetDecrement(value PatternFlowIpv6SrcCounter) PatternFlowIpv6Src + // HasDecrement checks if Decrement has been set in PatternFlowIpv6Src + HasDecrement() bool + // MetricTags returns PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIterIter, set in PatternFlowIpv6Src + MetricTags() PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter + setNil() +} + +type PatternFlowIpv6SrcChoiceEnum string + +// Enum of Choice on PatternFlowIpv6Src +var PatternFlowIpv6SrcChoice = struct { + VALUE PatternFlowIpv6SrcChoiceEnum + VALUES PatternFlowIpv6SrcChoiceEnum + INCREMENT PatternFlowIpv6SrcChoiceEnum + DECREMENT PatternFlowIpv6SrcChoiceEnum +}{ + VALUE: PatternFlowIpv6SrcChoiceEnum("value"), + VALUES: PatternFlowIpv6SrcChoiceEnum("values"), + INCREMENT: PatternFlowIpv6SrcChoiceEnum("increment"), + DECREMENT: PatternFlowIpv6SrcChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv6Src) Choice() PatternFlowIpv6SrcChoiceEnum { + return PatternFlowIpv6SrcChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv6Src) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv6Src) setChoice(value PatternFlowIpv6SrcChoiceEnum) PatternFlowIpv6Src { + intValue, ok := otg.PatternFlowIpv6Src_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv6SrcChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv6Src_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv6SrcChoice.VALUE { + defaultValue := "::0" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv6SrcChoice.VALUES { + defaultValue := []string{"::0"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv6SrcChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv6SrcCounter().msg() + } + + if value == PatternFlowIpv6SrcChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv6SrcCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowIpv6Src) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv6SrcChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowIpv6Src) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowIpv6Src object +func (obj *patternFlowIpv6Src) SetValue(value string) PatternFlowIpv6Src { + obj.setChoice(PatternFlowIpv6SrcChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowIpv6Src) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"::0"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowIpv6Src object +func (obj *patternFlowIpv6Src) SetValues(value []string) PatternFlowIpv6Src { + obj.setChoice(PatternFlowIpv6SrcChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv6SrcCounter +func (obj *patternFlowIpv6Src) Increment() PatternFlowIpv6SrcCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv6SrcChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv6SrcCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv6SrcCounter +func (obj *patternFlowIpv6Src) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv6SrcCounter value in the PatternFlowIpv6Src object +func (obj *patternFlowIpv6Src) SetIncrement(value PatternFlowIpv6SrcCounter) PatternFlowIpv6Src { + obj.setChoice(PatternFlowIpv6SrcChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv6SrcCounter +func (obj *patternFlowIpv6Src) Decrement() PatternFlowIpv6SrcCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv6SrcChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv6SrcCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv6SrcCounter +func (obj *patternFlowIpv6Src) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv6SrcCounter value in the PatternFlowIpv6Src object +func (obj *patternFlowIpv6Src) SetDecrement(value PatternFlowIpv6SrcCounter) PatternFlowIpv6Src { + obj.setChoice(PatternFlowIpv6SrcChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv6SrcMetricTag +func (obj *patternFlowIpv6Src) MetricTags() PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv6SrcMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter struct { + obj *patternFlowIpv6Src + patternFlowIpv6SrcMetricTagSlice []PatternFlowIpv6SrcMetricTag + fieldPtr *[]*otg.PatternFlowIpv6SrcMetricTag +} + +func newPatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter(ptr *[]*otg.PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { + return &patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter interface { + setMsg(*patternFlowIpv6Src) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter + Items() []PatternFlowIpv6SrcMetricTag + Add() PatternFlowIpv6SrcMetricTag + Append(items ...PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter + Set(index int, newObj PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter + Clear() PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter + clearHolderSlice() PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter + appendHolderSlice(item PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter +} + +func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) setMsg(msg *patternFlowIpv6Src) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv6SrcMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) Items() []PatternFlowIpv6SrcMetricTag { + return obj.patternFlowIpv6SrcMetricTagSlice +} + +func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) Add() PatternFlowIpv6SrcMetricTag { + newObj := &otg.PatternFlowIpv6SrcMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv6SrcMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv6SrcMetricTagSlice = append(obj.patternFlowIpv6SrcMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) Append(items ...PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv6SrcMetricTagSlice = append(obj.patternFlowIpv6SrcMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) Set(index int, newObj PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv6SrcMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) Clear() PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv6SrcMetricTag{} + obj.patternFlowIpv6SrcMetricTagSlice = []PatternFlowIpv6SrcMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) clearHolderSlice() PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { + if len(obj.patternFlowIpv6SrcMetricTagSlice) > 0 { + obj.patternFlowIpv6SrcMetricTagSlice = []PatternFlowIpv6SrcMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter) appendHolderSlice(item PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcPatternFlowIpv6SrcMetricTagIter { + obj.patternFlowIpv6SrcMetricTagSlice = append(obj.patternFlowIpv6SrcMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv6Src) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv6(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6Src.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateIpv6Slice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6Src.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv6SrcMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv6Src) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv6SrcChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv6SrcChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv6SrcChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv6SrcChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv6SrcChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv6SrcChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6Src") + } + } else { + intVal := otg.PatternFlowIpv6Src_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv6Src_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv6_src_counter.go b/gosnappi/pattern_flow_ipv6_src_counter.go new file mode 100644 index 00000000..3c8ae424 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_src_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowIpv6SrcCounter ***** +type patternFlowIpv6SrcCounter struct { + validation + obj *otg.PatternFlowIpv6SrcCounter + marshaller marshalPatternFlowIpv6SrcCounter + unMarshaller unMarshalPatternFlowIpv6SrcCounter +} + +func NewPatternFlowIpv6SrcCounter() PatternFlowIpv6SrcCounter { + obj := patternFlowIpv6SrcCounter{obj: &otg.PatternFlowIpv6SrcCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6SrcCounter) msg() *otg.PatternFlowIpv6SrcCounter { + return obj.obj +} + +func (obj *patternFlowIpv6SrcCounter) setMsg(msg *otg.PatternFlowIpv6SrcCounter) PatternFlowIpv6SrcCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6SrcCounter struct { + obj *patternFlowIpv6SrcCounter +} + +type marshalPatternFlowIpv6SrcCounter interface { + // ToProto marshals PatternFlowIpv6SrcCounter to protobuf object *otg.PatternFlowIpv6SrcCounter + ToProto() (*otg.PatternFlowIpv6SrcCounter, error) + // ToPbText marshals PatternFlowIpv6SrcCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6SrcCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6SrcCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6SrcCounter struct { + obj *patternFlowIpv6SrcCounter +} + +type unMarshalPatternFlowIpv6SrcCounter interface { + // FromProto unmarshals PatternFlowIpv6SrcCounter from protobuf object *otg.PatternFlowIpv6SrcCounter + FromProto(msg *otg.PatternFlowIpv6SrcCounter) (PatternFlowIpv6SrcCounter, error) + // FromPbText unmarshals PatternFlowIpv6SrcCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6SrcCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6SrcCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6SrcCounter) Marshal() marshalPatternFlowIpv6SrcCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6SrcCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6SrcCounter) Unmarshal() unMarshalPatternFlowIpv6SrcCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6SrcCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6SrcCounter) ToProto() (*otg.PatternFlowIpv6SrcCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6SrcCounter) FromProto(msg *otg.PatternFlowIpv6SrcCounter) (PatternFlowIpv6SrcCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6SrcCounter) 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 *unMarshalpatternFlowIpv6SrcCounter) 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 *marshalpatternFlowIpv6SrcCounter) 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 *unMarshalpatternFlowIpv6SrcCounter) 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 *marshalpatternFlowIpv6SrcCounter) 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 *unMarshalpatternFlowIpv6SrcCounter) 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 *patternFlowIpv6SrcCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6SrcCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6SrcCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6SrcCounter) Clone() (PatternFlowIpv6SrcCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6SrcCounter() + 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 +} + +// PatternFlowIpv6SrcCounter is ipv6 counter pattern +type PatternFlowIpv6SrcCounter interface { + Validation + // msg marshals PatternFlowIpv6SrcCounter to protobuf object *otg.PatternFlowIpv6SrcCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv6SrcCounter + // setMsg unmarshals PatternFlowIpv6SrcCounter from protobuf object *otg.PatternFlowIpv6SrcCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6SrcCounter) PatternFlowIpv6SrcCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv6SrcCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6SrcCounter + // validate validates PatternFlowIpv6SrcCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6SrcCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowIpv6SrcCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowIpv6SrcCounter + SetStart(value string) PatternFlowIpv6SrcCounter + // HasStart checks if Start has been set in PatternFlowIpv6SrcCounter + HasStart() bool + // Step returns string, set in PatternFlowIpv6SrcCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowIpv6SrcCounter + SetStep(value string) PatternFlowIpv6SrcCounter + // HasStep checks if Step has been set in PatternFlowIpv6SrcCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv6SrcCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv6SrcCounter + SetCount(value uint32) PatternFlowIpv6SrcCounter + // HasCount checks if Count has been set in PatternFlowIpv6SrcCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowIpv6SrcCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowIpv6SrcCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowIpv6SrcCounter object +func (obj *patternFlowIpv6SrcCounter) SetStart(value string) PatternFlowIpv6SrcCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowIpv6SrcCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowIpv6SrcCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowIpv6SrcCounter object +func (obj *patternFlowIpv6SrcCounter) SetStep(value string) PatternFlowIpv6SrcCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6SrcCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6SrcCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv6SrcCounter object +func (obj *patternFlowIpv6SrcCounter) SetCount(value uint32) PatternFlowIpv6SrcCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv6SrcCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateIpv6(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6SrcCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateIpv6(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowIpv6SrcCounter.Step")) + } + + } + +} + +func (obj *patternFlowIpv6SrcCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("::0") + } + if obj.obj.Step == nil { + obj.SetStep("::1") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_src_metric_tag.go b/gosnappi/pattern_flow_ipv6_src_metric_tag.go new file mode 100644 index 00000000..e4efd717 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_src_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv6SrcMetricTag ***** +type patternFlowIpv6SrcMetricTag struct { + validation + obj *otg.PatternFlowIpv6SrcMetricTag + marshaller marshalPatternFlowIpv6SrcMetricTag + unMarshaller unMarshalPatternFlowIpv6SrcMetricTag +} + +func NewPatternFlowIpv6SrcMetricTag() PatternFlowIpv6SrcMetricTag { + obj := patternFlowIpv6SrcMetricTag{obj: &otg.PatternFlowIpv6SrcMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6SrcMetricTag) msg() *otg.PatternFlowIpv6SrcMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv6SrcMetricTag) setMsg(msg *otg.PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6SrcMetricTag struct { + obj *patternFlowIpv6SrcMetricTag +} + +type marshalPatternFlowIpv6SrcMetricTag interface { + // ToProto marshals PatternFlowIpv6SrcMetricTag to protobuf object *otg.PatternFlowIpv6SrcMetricTag + ToProto() (*otg.PatternFlowIpv6SrcMetricTag, error) + // ToPbText marshals PatternFlowIpv6SrcMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6SrcMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6SrcMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6SrcMetricTag struct { + obj *patternFlowIpv6SrcMetricTag +} + +type unMarshalPatternFlowIpv6SrcMetricTag interface { + // FromProto unmarshals PatternFlowIpv6SrcMetricTag from protobuf object *otg.PatternFlowIpv6SrcMetricTag + FromProto(msg *otg.PatternFlowIpv6SrcMetricTag) (PatternFlowIpv6SrcMetricTag, error) + // FromPbText unmarshals PatternFlowIpv6SrcMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6SrcMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6SrcMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6SrcMetricTag) Marshal() marshalPatternFlowIpv6SrcMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6SrcMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6SrcMetricTag) Unmarshal() unMarshalPatternFlowIpv6SrcMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6SrcMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6SrcMetricTag) ToProto() (*otg.PatternFlowIpv6SrcMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6SrcMetricTag) FromProto(msg *otg.PatternFlowIpv6SrcMetricTag) (PatternFlowIpv6SrcMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6SrcMetricTag) 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 *unMarshalpatternFlowIpv6SrcMetricTag) 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 *marshalpatternFlowIpv6SrcMetricTag) 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 *unMarshalpatternFlowIpv6SrcMetricTag) 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 *marshalpatternFlowIpv6SrcMetricTag) 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 *unMarshalpatternFlowIpv6SrcMetricTag) 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 *patternFlowIpv6SrcMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6SrcMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6SrcMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6SrcMetricTag) Clone() (PatternFlowIpv6SrcMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6SrcMetricTag() + 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 +} + +// PatternFlowIpv6SrcMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv6SrcMetricTag interface { + Validation + // msg marshals PatternFlowIpv6SrcMetricTag to protobuf object *otg.PatternFlowIpv6SrcMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv6SrcMetricTag + // setMsg unmarshals PatternFlowIpv6SrcMetricTag from protobuf object *otg.PatternFlowIpv6SrcMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6SrcMetricTag) PatternFlowIpv6SrcMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv6SrcMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6SrcMetricTag + // validate validates PatternFlowIpv6SrcMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6SrcMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv6SrcMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv6SrcMetricTag + SetName(value string) PatternFlowIpv6SrcMetricTag + // Offset returns uint32, set in PatternFlowIpv6SrcMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv6SrcMetricTag + SetOffset(value uint32) PatternFlowIpv6SrcMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv6SrcMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv6SrcMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv6SrcMetricTag + SetLength(value uint32) PatternFlowIpv6SrcMetricTag + // HasLength checks if Length has been set in PatternFlowIpv6SrcMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv6SrcMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv6SrcMetricTag object +func (obj *patternFlowIpv6SrcMetricTag) SetName(value string) PatternFlowIpv6SrcMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6SrcMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6SrcMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv6SrcMetricTag object +func (obj *patternFlowIpv6SrcMetricTag) SetOffset(value uint32) PatternFlowIpv6SrcMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6SrcMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6SrcMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv6SrcMetricTag object +func (obj *patternFlowIpv6SrcMetricTag) SetLength(value uint32) PatternFlowIpv6SrcMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv6SrcMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6SrcMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 127 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6SrcMetricTag.Offset <= 127 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv6SrcMetricTag.Length <= 128 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv6SrcMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(128) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_traffic_class.go b/gosnappi/pattern_flow_ipv6_traffic_class.go new file mode 100644 index 00000000..8af2010d --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_traffic_class.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv6TrafficClass ***** +type patternFlowIpv6TrafficClass struct { + validation + obj *otg.PatternFlowIpv6TrafficClass + marshaller marshalPatternFlowIpv6TrafficClass + unMarshaller unMarshalPatternFlowIpv6TrafficClass + incrementHolder PatternFlowIpv6TrafficClassCounter + decrementHolder PatternFlowIpv6TrafficClassCounter + metricTagsHolder PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter +} + +func NewPatternFlowIpv6TrafficClass() PatternFlowIpv6TrafficClass { + obj := patternFlowIpv6TrafficClass{obj: &otg.PatternFlowIpv6TrafficClass{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6TrafficClass) msg() *otg.PatternFlowIpv6TrafficClass { + return obj.obj +} + +func (obj *patternFlowIpv6TrafficClass) setMsg(msg *otg.PatternFlowIpv6TrafficClass) PatternFlowIpv6TrafficClass { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6TrafficClass struct { + obj *patternFlowIpv6TrafficClass +} + +type marshalPatternFlowIpv6TrafficClass interface { + // ToProto marshals PatternFlowIpv6TrafficClass to protobuf object *otg.PatternFlowIpv6TrafficClass + ToProto() (*otg.PatternFlowIpv6TrafficClass, error) + // ToPbText marshals PatternFlowIpv6TrafficClass to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6TrafficClass to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6TrafficClass to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6TrafficClass struct { + obj *patternFlowIpv6TrafficClass +} + +type unMarshalPatternFlowIpv6TrafficClass interface { + // FromProto unmarshals PatternFlowIpv6TrafficClass from protobuf object *otg.PatternFlowIpv6TrafficClass + FromProto(msg *otg.PatternFlowIpv6TrafficClass) (PatternFlowIpv6TrafficClass, error) + // FromPbText unmarshals PatternFlowIpv6TrafficClass from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6TrafficClass from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6TrafficClass from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6TrafficClass) Marshal() marshalPatternFlowIpv6TrafficClass { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6TrafficClass{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6TrafficClass) Unmarshal() unMarshalPatternFlowIpv6TrafficClass { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6TrafficClass{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6TrafficClass) ToProto() (*otg.PatternFlowIpv6TrafficClass, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6TrafficClass) FromProto(msg *otg.PatternFlowIpv6TrafficClass) (PatternFlowIpv6TrafficClass, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6TrafficClass) 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 *unMarshalpatternFlowIpv6TrafficClass) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv6TrafficClass) 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 *unMarshalpatternFlowIpv6TrafficClass) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv6TrafficClass) 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 *unMarshalpatternFlowIpv6TrafficClass) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv6TrafficClass) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6TrafficClass) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6TrafficClass) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6TrafficClass) Clone() (PatternFlowIpv6TrafficClass, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6TrafficClass() + 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 +} + +func (obj *patternFlowIpv6TrafficClass) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv6TrafficClass is traffic class +type PatternFlowIpv6TrafficClass interface { + Validation + // msg marshals PatternFlowIpv6TrafficClass to protobuf object *otg.PatternFlowIpv6TrafficClass + // and doesn't set defaults + msg() *otg.PatternFlowIpv6TrafficClass + // setMsg unmarshals PatternFlowIpv6TrafficClass from protobuf object *otg.PatternFlowIpv6TrafficClass + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6TrafficClass) PatternFlowIpv6TrafficClass + // provides marshal interface + Marshal() marshalPatternFlowIpv6TrafficClass + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6TrafficClass + // validate validates PatternFlowIpv6TrafficClass + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6TrafficClass, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv6TrafficClassChoiceEnum, set in PatternFlowIpv6TrafficClass + Choice() PatternFlowIpv6TrafficClassChoiceEnum + // setChoice assigns PatternFlowIpv6TrafficClassChoiceEnum provided by user to PatternFlowIpv6TrafficClass + setChoice(value PatternFlowIpv6TrafficClassChoiceEnum) PatternFlowIpv6TrafficClass + // HasChoice checks if Choice has been set in PatternFlowIpv6TrafficClass + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv6TrafficClass. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv6TrafficClass + SetValue(value uint32) PatternFlowIpv6TrafficClass + // HasValue checks if Value has been set in PatternFlowIpv6TrafficClass + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv6TrafficClass. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv6TrafficClass + SetValues(value []uint32) PatternFlowIpv6TrafficClass + // Increment returns PatternFlowIpv6TrafficClassCounter, set in PatternFlowIpv6TrafficClass. + // PatternFlowIpv6TrafficClassCounter is integer counter pattern + Increment() PatternFlowIpv6TrafficClassCounter + // SetIncrement assigns PatternFlowIpv6TrafficClassCounter provided by user to PatternFlowIpv6TrafficClass. + // PatternFlowIpv6TrafficClassCounter is integer counter pattern + SetIncrement(value PatternFlowIpv6TrafficClassCounter) PatternFlowIpv6TrafficClass + // HasIncrement checks if Increment has been set in PatternFlowIpv6TrafficClass + HasIncrement() bool + // Decrement returns PatternFlowIpv6TrafficClassCounter, set in PatternFlowIpv6TrafficClass. + // PatternFlowIpv6TrafficClassCounter is integer counter pattern + Decrement() PatternFlowIpv6TrafficClassCounter + // SetDecrement assigns PatternFlowIpv6TrafficClassCounter provided by user to PatternFlowIpv6TrafficClass. + // PatternFlowIpv6TrafficClassCounter is integer counter pattern + SetDecrement(value PatternFlowIpv6TrafficClassCounter) PatternFlowIpv6TrafficClass + // HasDecrement checks if Decrement has been set in PatternFlowIpv6TrafficClass + HasDecrement() bool + // MetricTags returns PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIterIter, set in PatternFlowIpv6TrafficClass + MetricTags() PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter + setNil() +} + +type PatternFlowIpv6TrafficClassChoiceEnum string + +// Enum of Choice on PatternFlowIpv6TrafficClass +var PatternFlowIpv6TrafficClassChoice = struct { + VALUE PatternFlowIpv6TrafficClassChoiceEnum + VALUES PatternFlowIpv6TrafficClassChoiceEnum + INCREMENT PatternFlowIpv6TrafficClassChoiceEnum + DECREMENT PatternFlowIpv6TrafficClassChoiceEnum +}{ + VALUE: PatternFlowIpv6TrafficClassChoiceEnum("value"), + VALUES: PatternFlowIpv6TrafficClassChoiceEnum("values"), + INCREMENT: PatternFlowIpv6TrafficClassChoiceEnum("increment"), + DECREMENT: PatternFlowIpv6TrafficClassChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv6TrafficClass) Choice() PatternFlowIpv6TrafficClassChoiceEnum { + return PatternFlowIpv6TrafficClassChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv6TrafficClass) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv6TrafficClass) setChoice(value PatternFlowIpv6TrafficClassChoiceEnum) PatternFlowIpv6TrafficClass { + intValue, ok := otg.PatternFlowIpv6TrafficClass_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv6TrafficClassChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv6TrafficClass_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv6TrafficClassChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv6TrafficClassChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv6TrafficClassChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv6TrafficClassCounter().msg() + } + + if value == PatternFlowIpv6TrafficClassChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv6TrafficClassCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv6TrafficClass) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv6TrafficClassChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv6TrafficClass) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv6TrafficClass object +func (obj *patternFlowIpv6TrafficClass) SetValue(value uint32) PatternFlowIpv6TrafficClass { + obj.setChoice(PatternFlowIpv6TrafficClassChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv6TrafficClass) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv6TrafficClass object +func (obj *patternFlowIpv6TrafficClass) SetValues(value []uint32) PatternFlowIpv6TrafficClass { + obj.setChoice(PatternFlowIpv6TrafficClassChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv6TrafficClassCounter +func (obj *patternFlowIpv6TrafficClass) Increment() PatternFlowIpv6TrafficClassCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv6TrafficClassChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv6TrafficClassCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv6TrafficClassCounter +func (obj *patternFlowIpv6TrafficClass) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv6TrafficClassCounter value in the PatternFlowIpv6TrafficClass object +func (obj *patternFlowIpv6TrafficClass) SetIncrement(value PatternFlowIpv6TrafficClassCounter) PatternFlowIpv6TrafficClass { + obj.setChoice(PatternFlowIpv6TrafficClassChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv6TrafficClassCounter +func (obj *patternFlowIpv6TrafficClass) Decrement() PatternFlowIpv6TrafficClassCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv6TrafficClassChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv6TrafficClassCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv6TrafficClassCounter +func (obj *patternFlowIpv6TrafficClass) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv6TrafficClassCounter value in the PatternFlowIpv6TrafficClass object +func (obj *patternFlowIpv6TrafficClass) SetDecrement(value PatternFlowIpv6TrafficClassCounter) PatternFlowIpv6TrafficClass { + obj.setChoice(PatternFlowIpv6TrafficClassChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv6TrafficClassMetricTag +func (obj *patternFlowIpv6TrafficClass) MetricTags() PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv6TrafficClassMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter struct { + obj *patternFlowIpv6TrafficClass + patternFlowIpv6TrafficClassMetricTagSlice []PatternFlowIpv6TrafficClassMetricTag + fieldPtr *[]*otg.PatternFlowIpv6TrafficClassMetricTag +} + +func newPatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter(ptr *[]*otg.PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { + return &patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter interface { + setMsg(*patternFlowIpv6TrafficClass) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter + Items() []PatternFlowIpv6TrafficClassMetricTag + Add() PatternFlowIpv6TrafficClassMetricTag + Append(items ...PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter + Set(index int, newObj PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter + Clear() PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter + clearHolderSlice() PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter + appendHolderSlice(item PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter +} + +func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) setMsg(msg *patternFlowIpv6TrafficClass) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv6TrafficClassMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) Items() []PatternFlowIpv6TrafficClassMetricTag { + return obj.patternFlowIpv6TrafficClassMetricTagSlice +} + +func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) Add() PatternFlowIpv6TrafficClassMetricTag { + newObj := &otg.PatternFlowIpv6TrafficClassMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv6TrafficClassMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv6TrafficClassMetricTagSlice = append(obj.patternFlowIpv6TrafficClassMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) Append(items ...PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv6TrafficClassMetricTagSlice = append(obj.patternFlowIpv6TrafficClassMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) Set(index int, newObj PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv6TrafficClassMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) Clear() PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv6TrafficClassMetricTag{} + obj.patternFlowIpv6TrafficClassMetricTagSlice = []PatternFlowIpv6TrafficClassMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) clearHolderSlice() PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { + if len(obj.patternFlowIpv6TrafficClassMetricTagSlice) > 0 { + obj.patternFlowIpv6TrafficClassMetricTagSlice = []PatternFlowIpv6TrafficClassMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter) appendHolderSlice(item PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassPatternFlowIpv6TrafficClassMetricTagIter { + obj.patternFlowIpv6TrafficClassMetricTagSlice = append(obj.patternFlowIpv6TrafficClassMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv6TrafficClass) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6TrafficClass.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv6TrafficClass.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv6TrafficClassMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv6TrafficClass) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv6TrafficClassChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv6TrafficClassChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv6TrafficClassChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv6TrafficClassChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv6TrafficClassChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv6TrafficClassChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6TrafficClass") + } + } else { + intVal := otg.PatternFlowIpv6TrafficClass_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv6TrafficClass_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv6_traffic_class_counter.go b/gosnappi/pattern_flow_ipv6_traffic_class_counter.go new file mode 100644 index 00000000..d193b0de --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_traffic_class_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv6TrafficClassCounter ***** +type patternFlowIpv6TrafficClassCounter struct { + validation + obj *otg.PatternFlowIpv6TrafficClassCounter + marshaller marshalPatternFlowIpv6TrafficClassCounter + unMarshaller unMarshalPatternFlowIpv6TrafficClassCounter +} + +func NewPatternFlowIpv6TrafficClassCounter() PatternFlowIpv6TrafficClassCounter { + obj := patternFlowIpv6TrafficClassCounter{obj: &otg.PatternFlowIpv6TrafficClassCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6TrafficClassCounter) msg() *otg.PatternFlowIpv6TrafficClassCounter { + return obj.obj +} + +func (obj *patternFlowIpv6TrafficClassCounter) setMsg(msg *otg.PatternFlowIpv6TrafficClassCounter) PatternFlowIpv6TrafficClassCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6TrafficClassCounter struct { + obj *patternFlowIpv6TrafficClassCounter +} + +type marshalPatternFlowIpv6TrafficClassCounter interface { + // ToProto marshals PatternFlowIpv6TrafficClassCounter to protobuf object *otg.PatternFlowIpv6TrafficClassCounter + ToProto() (*otg.PatternFlowIpv6TrafficClassCounter, error) + // ToPbText marshals PatternFlowIpv6TrafficClassCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6TrafficClassCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6TrafficClassCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6TrafficClassCounter struct { + obj *patternFlowIpv6TrafficClassCounter +} + +type unMarshalPatternFlowIpv6TrafficClassCounter interface { + // FromProto unmarshals PatternFlowIpv6TrafficClassCounter from protobuf object *otg.PatternFlowIpv6TrafficClassCounter + FromProto(msg *otg.PatternFlowIpv6TrafficClassCounter) (PatternFlowIpv6TrafficClassCounter, error) + // FromPbText unmarshals PatternFlowIpv6TrafficClassCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6TrafficClassCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6TrafficClassCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6TrafficClassCounter) Marshal() marshalPatternFlowIpv6TrafficClassCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6TrafficClassCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6TrafficClassCounter) Unmarshal() unMarshalPatternFlowIpv6TrafficClassCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6TrafficClassCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6TrafficClassCounter) ToProto() (*otg.PatternFlowIpv6TrafficClassCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6TrafficClassCounter) FromProto(msg *otg.PatternFlowIpv6TrafficClassCounter) (PatternFlowIpv6TrafficClassCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6TrafficClassCounter) 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 *unMarshalpatternFlowIpv6TrafficClassCounter) 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 *marshalpatternFlowIpv6TrafficClassCounter) 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 *unMarshalpatternFlowIpv6TrafficClassCounter) 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 *marshalpatternFlowIpv6TrafficClassCounter) 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 *unMarshalpatternFlowIpv6TrafficClassCounter) 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 *patternFlowIpv6TrafficClassCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6TrafficClassCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6TrafficClassCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6TrafficClassCounter) Clone() (PatternFlowIpv6TrafficClassCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6TrafficClassCounter() + 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 +} + +// PatternFlowIpv6TrafficClassCounter is integer counter pattern +type PatternFlowIpv6TrafficClassCounter interface { + Validation + // msg marshals PatternFlowIpv6TrafficClassCounter to protobuf object *otg.PatternFlowIpv6TrafficClassCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv6TrafficClassCounter + // setMsg unmarshals PatternFlowIpv6TrafficClassCounter from protobuf object *otg.PatternFlowIpv6TrafficClassCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6TrafficClassCounter) PatternFlowIpv6TrafficClassCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv6TrafficClassCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6TrafficClassCounter + // validate validates PatternFlowIpv6TrafficClassCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6TrafficClassCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv6TrafficClassCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv6TrafficClassCounter + SetStart(value uint32) PatternFlowIpv6TrafficClassCounter + // HasStart checks if Start has been set in PatternFlowIpv6TrafficClassCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv6TrafficClassCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv6TrafficClassCounter + SetStep(value uint32) PatternFlowIpv6TrafficClassCounter + // HasStep checks if Step has been set in PatternFlowIpv6TrafficClassCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv6TrafficClassCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv6TrafficClassCounter + SetCount(value uint32) PatternFlowIpv6TrafficClassCounter + // HasCount checks if Count has been set in PatternFlowIpv6TrafficClassCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv6TrafficClassCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv6TrafficClassCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv6TrafficClassCounter object +func (obj *patternFlowIpv6TrafficClassCounter) SetStart(value uint32) PatternFlowIpv6TrafficClassCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv6TrafficClassCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv6TrafficClassCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv6TrafficClassCounter object +func (obj *patternFlowIpv6TrafficClassCounter) SetStep(value uint32) PatternFlowIpv6TrafficClassCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6TrafficClassCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6TrafficClassCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv6TrafficClassCounter object +func (obj *patternFlowIpv6TrafficClassCounter) SetCount(value uint32) PatternFlowIpv6TrafficClassCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv6TrafficClassCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6TrafficClassCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6TrafficClassCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6TrafficClassCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv6TrafficClassCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_traffic_class_metric_tag.go b/gosnappi/pattern_flow_ipv6_traffic_class_metric_tag.go new file mode 100644 index 00000000..6f9a71d3 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_traffic_class_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv6TrafficClassMetricTag ***** +type patternFlowIpv6TrafficClassMetricTag struct { + validation + obj *otg.PatternFlowIpv6TrafficClassMetricTag + marshaller marshalPatternFlowIpv6TrafficClassMetricTag + unMarshaller unMarshalPatternFlowIpv6TrafficClassMetricTag +} + +func NewPatternFlowIpv6TrafficClassMetricTag() PatternFlowIpv6TrafficClassMetricTag { + obj := patternFlowIpv6TrafficClassMetricTag{obj: &otg.PatternFlowIpv6TrafficClassMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6TrafficClassMetricTag) msg() *otg.PatternFlowIpv6TrafficClassMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv6TrafficClassMetricTag) setMsg(msg *otg.PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6TrafficClassMetricTag struct { + obj *patternFlowIpv6TrafficClassMetricTag +} + +type marshalPatternFlowIpv6TrafficClassMetricTag interface { + // ToProto marshals PatternFlowIpv6TrafficClassMetricTag to protobuf object *otg.PatternFlowIpv6TrafficClassMetricTag + ToProto() (*otg.PatternFlowIpv6TrafficClassMetricTag, error) + // ToPbText marshals PatternFlowIpv6TrafficClassMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6TrafficClassMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6TrafficClassMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6TrafficClassMetricTag struct { + obj *patternFlowIpv6TrafficClassMetricTag +} + +type unMarshalPatternFlowIpv6TrafficClassMetricTag interface { + // FromProto unmarshals PatternFlowIpv6TrafficClassMetricTag from protobuf object *otg.PatternFlowIpv6TrafficClassMetricTag + FromProto(msg *otg.PatternFlowIpv6TrafficClassMetricTag) (PatternFlowIpv6TrafficClassMetricTag, error) + // FromPbText unmarshals PatternFlowIpv6TrafficClassMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6TrafficClassMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6TrafficClassMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6TrafficClassMetricTag) Marshal() marshalPatternFlowIpv6TrafficClassMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6TrafficClassMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6TrafficClassMetricTag) Unmarshal() unMarshalPatternFlowIpv6TrafficClassMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6TrafficClassMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6TrafficClassMetricTag) ToProto() (*otg.PatternFlowIpv6TrafficClassMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6TrafficClassMetricTag) FromProto(msg *otg.PatternFlowIpv6TrafficClassMetricTag) (PatternFlowIpv6TrafficClassMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6TrafficClassMetricTag) 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 *unMarshalpatternFlowIpv6TrafficClassMetricTag) 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 *marshalpatternFlowIpv6TrafficClassMetricTag) 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 *unMarshalpatternFlowIpv6TrafficClassMetricTag) 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 *marshalpatternFlowIpv6TrafficClassMetricTag) 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 *unMarshalpatternFlowIpv6TrafficClassMetricTag) 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 *patternFlowIpv6TrafficClassMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6TrafficClassMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6TrafficClassMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6TrafficClassMetricTag) Clone() (PatternFlowIpv6TrafficClassMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6TrafficClassMetricTag() + 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 +} + +// PatternFlowIpv6TrafficClassMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv6TrafficClassMetricTag interface { + Validation + // msg marshals PatternFlowIpv6TrafficClassMetricTag to protobuf object *otg.PatternFlowIpv6TrafficClassMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv6TrafficClassMetricTag + // setMsg unmarshals PatternFlowIpv6TrafficClassMetricTag from protobuf object *otg.PatternFlowIpv6TrafficClassMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6TrafficClassMetricTag) PatternFlowIpv6TrafficClassMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv6TrafficClassMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6TrafficClassMetricTag + // validate validates PatternFlowIpv6TrafficClassMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6TrafficClassMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv6TrafficClassMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv6TrafficClassMetricTag + SetName(value string) PatternFlowIpv6TrafficClassMetricTag + // Offset returns uint32, set in PatternFlowIpv6TrafficClassMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv6TrafficClassMetricTag + SetOffset(value uint32) PatternFlowIpv6TrafficClassMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv6TrafficClassMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv6TrafficClassMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv6TrafficClassMetricTag + SetLength(value uint32) PatternFlowIpv6TrafficClassMetricTag + // HasLength checks if Length has been set in PatternFlowIpv6TrafficClassMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv6TrafficClassMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv6TrafficClassMetricTag object +func (obj *patternFlowIpv6TrafficClassMetricTag) SetName(value string) PatternFlowIpv6TrafficClassMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6TrafficClassMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6TrafficClassMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv6TrafficClassMetricTag object +func (obj *patternFlowIpv6TrafficClassMetricTag) SetOffset(value uint32) PatternFlowIpv6TrafficClassMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6TrafficClassMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6TrafficClassMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv6TrafficClassMetricTag object +func (obj *patternFlowIpv6TrafficClassMetricTag) SetLength(value uint32) PatternFlowIpv6TrafficClassMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv6TrafficClassMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6TrafficClassMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6TrafficClassMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv6TrafficClassMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv6TrafficClassMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_version.go b/gosnappi/pattern_flow_ipv6_version.go new file mode 100644 index 00000000..12ff05df --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_version.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowIpv6Version ***** +type patternFlowIpv6Version struct { + validation + obj *otg.PatternFlowIpv6Version + marshaller marshalPatternFlowIpv6Version + unMarshaller unMarshalPatternFlowIpv6Version + incrementHolder PatternFlowIpv6VersionCounter + decrementHolder PatternFlowIpv6VersionCounter + metricTagsHolder PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter +} + +func NewPatternFlowIpv6Version() PatternFlowIpv6Version { + obj := patternFlowIpv6Version{obj: &otg.PatternFlowIpv6Version{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6Version) msg() *otg.PatternFlowIpv6Version { + return obj.obj +} + +func (obj *patternFlowIpv6Version) setMsg(msg *otg.PatternFlowIpv6Version) PatternFlowIpv6Version { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6Version struct { + obj *patternFlowIpv6Version +} + +type marshalPatternFlowIpv6Version interface { + // ToProto marshals PatternFlowIpv6Version to protobuf object *otg.PatternFlowIpv6Version + ToProto() (*otg.PatternFlowIpv6Version, error) + // ToPbText marshals PatternFlowIpv6Version to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6Version to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6Version to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6Version struct { + obj *patternFlowIpv6Version +} + +type unMarshalPatternFlowIpv6Version interface { + // FromProto unmarshals PatternFlowIpv6Version from protobuf object *otg.PatternFlowIpv6Version + FromProto(msg *otg.PatternFlowIpv6Version) (PatternFlowIpv6Version, error) + // FromPbText unmarshals PatternFlowIpv6Version from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6Version from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6Version from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6Version) Marshal() marshalPatternFlowIpv6Version { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6Version{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6Version) Unmarshal() unMarshalPatternFlowIpv6Version { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6Version{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6Version) ToProto() (*otg.PatternFlowIpv6Version, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6Version) FromProto(msg *otg.PatternFlowIpv6Version) (PatternFlowIpv6Version, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6Version) 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 *unMarshalpatternFlowIpv6Version) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowIpv6Version) 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 *unMarshalpatternFlowIpv6Version) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowIpv6Version) 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 *unMarshalpatternFlowIpv6Version) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowIpv6Version) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6Version) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6Version) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6Version) Clone() (PatternFlowIpv6Version, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6Version() + 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 +} + +func (obj *patternFlowIpv6Version) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowIpv6Version is version number +type PatternFlowIpv6Version interface { + Validation + // msg marshals PatternFlowIpv6Version to protobuf object *otg.PatternFlowIpv6Version + // and doesn't set defaults + msg() *otg.PatternFlowIpv6Version + // setMsg unmarshals PatternFlowIpv6Version from protobuf object *otg.PatternFlowIpv6Version + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6Version) PatternFlowIpv6Version + // provides marshal interface + Marshal() marshalPatternFlowIpv6Version + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6Version + // validate validates PatternFlowIpv6Version + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6Version, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowIpv6VersionChoiceEnum, set in PatternFlowIpv6Version + Choice() PatternFlowIpv6VersionChoiceEnum + // setChoice assigns PatternFlowIpv6VersionChoiceEnum provided by user to PatternFlowIpv6Version + setChoice(value PatternFlowIpv6VersionChoiceEnum) PatternFlowIpv6Version + // HasChoice checks if Choice has been set in PatternFlowIpv6Version + HasChoice() bool + // Value returns uint32, set in PatternFlowIpv6Version. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowIpv6Version + SetValue(value uint32) PatternFlowIpv6Version + // HasValue checks if Value has been set in PatternFlowIpv6Version + HasValue() bool + // Values returns []uint32, set in PatternFlowIpv6Version. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowIpv6Version + SetValues(value []uint32) PatternFlowIpv6Version + // Increment returns PatternFlowIpv6VersionCounter, set in PatternFlowIpv6Version. + // PatternFlowIpv6VersionCounter is integer counter pattern + Increment() PatternFlowIpv6VersionCounter + // SetIncrement assigns PatternFlowIpv6VersionCounter provided by user to PatternFlowIpv6Version. + // PatternFlowIpv6VersionCounter is integer counter pattern + SetIncrement(value PatternFlowIpv6VersionCounter) PatternFlowIpv6Version + // HasIncrement checks if Increment has been set in PatternFlowIpv6Version + HasIncrement() bool + // Decrement returns PatternFlowIpv6VersionCounter, set in PatternFlowIpv6Version. + // PatternFlowIpv6VersionCounter is integer counter pattern + Decrement() PatternFlowIpv6VersionCounter + // SetDecrement assigns PatternFlowIpv6VersionCounter provided by user to PatternFlowIpv6Version. + // PatternFlowIpv6VersionCounter is integer counter pattern + SetDecrement(value PatternFlowIpv6VersionCounter) PatternFlowIpv6Version + // HasDecrement checks if Decrement has been set in PatternFlowIpv6Version + HasDecrement() bool + // MetricTags returns PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIterIter, set in PatternFlowIpv6Version + MetricTags() PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter + setNil() +} + +type PatternFlowIpv6VersionChoiceEnum string + +// Enum of Choice on PatternFlowIpv6Version +var PatternFlowIpv6VersionChoice = struct { + VALUE PatternFlowIpv6VersionChoiceEnum + VALUES PatternFlowIpv6VersionChoiceEnum + INCREMENT PatternFlowIpv6VersionChoiceEnum + DECREMENT PatternFlowIpv6VersionChoiceEnum +}{ + VALUE: PatternFlowIpv6VersionChoiceEnum("value"), + VALUES: PatternFlowIpv6VersionChoiceEnum("values"), + INCREMENT: PatternFlowIpv6VersionChoiceEnum("increment"), + DECREMENT: PatternFlowIpv6VersionChoiceEnum("decrement"), +} + +func (obj *patternFlowIpv6Version) Choice() PatternFlowIpv6VersionChoiceEnum { + return PatternFlowIpv6VersionChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowIpv6Version) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowIpv6Version) setChoice(value PatternFlowIpv6VersionChoiceEnum) PatternFlowIpv6Version { + intValue, ok := otg.PatternFlowIpv6Version_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowIpv6VersionChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowIpv6Version_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowIpv6VersionChoice.VALUE { + defaultValue := uint32(6) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowIpv6VersionChoice.VALUES { + defaultValue := []uint32{6} + obj.obj.Values = defaultValue + } + + if value == PatternFlowIpv6VersionChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowIpv6VersionCounter().msg() + } + + if value == PatternFlowIpv6VersionChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowIpv6VersionCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv6Version) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowIpv6VersionChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowIpv6Version) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowIpv6Version object +func (obj *patternFlowIpv6Version) SetValue(value uint32) PatternFlowIpv6Version { + obj.setChoice(PatternFlowIpv6VersionChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowIpv6Version) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{6}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowIpv6Version object +func (obj *patternFlowIpv6Version) SetValues(value []uint32) PatternFlowIpv6Version { + obj.setChoice(PatternFlowIpv6VersionChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowIpv6VersionCounter +func (obj *patternFlowIpv6Version) Increment() PatternFlowIpv6VersionCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowIpv6VersionChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowIpv6VersionCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowIpv6VersionCounter +func (obj *patternFlowIpv6Version) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowIpv6VersionCounter value in the PatternFlowIpv6Version object +func (obj *patternFlowIpv6Version) SetIncrement(value PatternFlowIpv6VersionCounter) PatternFlowIpv6Version { + obj.setChoice(PatternFlowIpv6VersionChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowIpv6VersionCounter +func (obj *patternFlowIpv6Version) Decrement() PatternFlowIpv6VersionCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowIpv6VersionChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowIpv6VersionCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowIpv6VersionCounter +func (obj *patternFlowIpv6Version) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowIpv6VersionCounter value in the PatternFlowIpv6Version object +func (obj *patternFlowIpv6Version) SetDecrement(value PatternFlowIpv6VersionCounter) PatternFlowIpv6Version { + obj.setChoice(PatternFlowIpv6VersionChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowIpv6VersionMetricTag +func (obj *patternFlowIpv6Version) MetricTags() PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowIpv6VersionMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter struct { + obj *patternFlowIpv6Version + patternFlowIpv6VersionMetricTagSlice []PatternFlowIpv6VersionMetricTag + fieldPtr *[]*otg.PatternFlowIpv6VersionMetricTag +} + +func newPatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter(ptr *[]*otg.PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { + return &patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter interface { + setMsg(*patternFlowIpv6Version) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter + Items() []PatternFlowIpv6VersionMetricTag + Add() PatternFlowIpv6VersionMetricTag + Append(items ...PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter + Set(index int, newObj PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter + Clear() PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter + clearHolderSlice() PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter + appendHolderSlice(item PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter +} + +func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) setMsg(msg *patternFlowIpv6Version) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowIpv6VersionMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) Items() []PatternFlowIpv6VersionMetricTag { + return obj.patternFlowIpv6VersionMetricTagSlice +} + +func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) Add() PatternFlowIpv6VersionMetricTag { + newObj := &otg.PatternFlowIpv6VersionMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowIpv6VersionMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowIpv6VersionMetricTagSlice = append(obj.patternFlowIpv6VersionMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) Append(items ...PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowIpv6VersionMetricTagSlice = append(obj.patternFlowIpv6VersionMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) Set(index int, newObj PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowIpv6VersionMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) Clear() PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowIpv6VersionMetricTag{} + obj.patternFlowIpv6VersionMetricTagSlice = []PatternFlowIpv6VersionMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) clearHolderSlice() PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { + if len(obj.patternFlowIpv6VersionMetricTagSlice) > 0 { + obj.patternFlowIpv6VersionMetricTagSlice = []PatternFlowIpv6VersionMetricTag{} + } + return obj +} +func (obj *patternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter) appendHolderSlice(item PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionPatternFlowIpv6VersionMetricTagIter { + obj.patternFlowIpv6VersionMetricTagSlice = append(obj.patternFlowIpv6VersionMetricTagSlice, item) + return obj +} + +func (obj *patternFlowIpv6Version) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6Version.Value <= 15 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowIpv6Version.Values <= 15 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowIpv6VersionMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowIpv6Version) setDefault() { + var choices_set int = 0 + var choice PatternFlowIpv6VersionChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowIpv6VersionChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowIpv6VersionChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowIpv6VersionChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowIpv6VersionChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowIpv6VersionChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowIpv6Version") + } + } else { + intVal := otg.PatternFlowIpv6Version_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowIpv6Version_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ipv6_version_counter.go b/gosnappi/pattern_flow_ipv6_version_counter.go new file mode 100644 index 00000000..8993e32e --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_version_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowIpv6VersionCounter ***** +type patternFlowIpv6VersionCounter struct { + validation + obj *otg.PatternFlowIpv6VersionCounter + marshaller marshalPatternFlowIpv6VersionCounter + unMarshaller unMarshalPatternFlowIpv6VersionCounter +} + +func NewPatternFlowIpv6VersionCounter() PatternFlowIpv6VersionCounter { + obj := patternFlowIpv6VersionCounter{obj: &otg.PatternFlowIpv6VersionCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6VersionCounter) msg() *otg.PatternFlowIpv6VersionCounter { + return obj.obj +} + +func (obj *patternFlowIpv6VersionCounter) setMsg(msg *otg.PatternFlowIpv6VersionCounter) PatternFlowIpv6VersionCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6VersionCounter struct { + obj *patternFlowIpv6VersionCounter +} + +type marshalPatternFlowIpv6VersionCounter interface { + // ToProto marshals PatternFlowIpv6VersionCounter to protobuf object *otg.PatternFlowIpv6VersionCounter + ToProto() (*otg.PatternFlowIpv6VersionCounter, error) + // ToPbText marshals PatternFlowIpv6VersionCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6VersionCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6VersionCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6VersionCounter struct { + obj *patternFlowIpv6VersionCounter +} + +type unMarshalPatternFlowIpv6VersionCounter interface { + // FromProto unmarshals PatternFlowIpv6VersionCounter from protobuf object *otg.PatternFlowIpv6VersionCounter + FromProto(msg *otg.PatternFlowIpv6VersionCounter) (PatternFlowIpv6VersionCounter, error) + // FromPbText unmarshals PatternFlowIpv6VersionCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6VersionCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6VersionCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6VersionCounter) Marshal() marshalPatternFlowIpv6VersionCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6VersionCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6VersionCounter) Unmarshal() unMarshalPatternFlowIpv6VersionCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6VersionCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6VersionCounter) ToProto() (*otg.PatternFlowIpv6VersionCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6VersionCounter) FromProto(msg *otg.PatternFlowIpv6VersionCounter) (PatternFlowIpv6VersionCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6VersionCounter) 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 *unMarshalpatternFlowIpv6VersionCounter) 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 *marshalpatternFlowIpv6VersionCounter) 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 *unMarshalpatternFlowIpv6VersionCounter) 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 *marshalpatternFlowIpv6VersionCounter) 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 *unMarshalpatternFlowIpv6VersionCounter) 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 *patternFlowIpv6VersionCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6VersionCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6VersionCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6VersionCounter) Clone() (PatternFlowIpv6VersionCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6VersionCounter() + 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 +} + +// PatternFlowIpv6VersionCounter is integer counter pattern +type PatternFlowIpv6VersionCounter interface { + Validation + // msg marshals PatternFlowIpv6VersionCounter to protobuf object *otg.PatternFlowIpv6VersionCounter + // and doesn't set defaults + msg() *otg.PatternFlowIpv6VersionCounter + // setMsg unmarshals PatternFlowIpv6VersionCounter from protobuf object *otg.PatternFlowIpv6VersionCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6VersionCounter) PatternFlowIpv6VersionCounter + // provides marshal interface + Marshal() marshalPatternFlowIpv6VersionCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6VersionCounter + // validate validates PatternFlowIpv6VersionCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6VersionCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowIpv6VersionCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowIpv6VersionCounter + SetStart(value uint32) PatternFlowIpv6VersionCounter + // HasStart checks if Start has been set in PatternFlowIpv6VersionCounter + HasStart() bool + // Step returns uint32, set in PatternFlowIpv6VersionCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowIpv6VersionCounter + SetStep(value uint32) PatternFlowIpv6VersionCounter + // HasStep checks if Step has been set in PatternFlowIpv6VersionCounter + HasStep() bool + // Count returns uint32, set in PatternFlowIpv6VersionCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowIpv6VersionCounter + SetCount(value uint32) PatternFlowIpv6VersionCounter + // HasCount checks if Count has been set in PatternFlowIpv6VersionCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv6VersionCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowIpv6VersionCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowIpv6VersionCounter object +func (obj *patternFlowIpv6VersionCounter) SetStart(value uint32) PatternFlowIpv6VersionCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv6VersionCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowIpv6VersionCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowIpv6VersionCounter object +func (obj *patternFlowIpv6VersionCounter) SetStep(value uint32) PatternFlowIpv6VersionCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6VersionCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowIpv6VersionCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowIpv6VersionCounter object +func (obj *patternFlowIpv6VersionCounter) SetCount(value uint32) PatternFlowIpv6VersionCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowIpv6VersionCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6VersionCounter.Start <= 15 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6VersionCounter.Step <= 15 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6VersionCounter.Count <= 15 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowIpv6VersionCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(6) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ipv6_version_metric_tag.go b/gosnappi/pattern_flow_ipv6_version_metric_tag.go new file mode 100644 index 00000000..e7ea99f0 --- /dev/null +++ b/gosnappi/pattern_flow_ipv6_version_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowIpv6VersionMetricTag ***** +type patternFlowIpv6VersionMetricTag struct { + validation + obj *otg.PatternFlowIpv6VersionMetricTag + marshaller marshalPatternFlowIpv6VersionMetricTag + unMarshaller unMarshalPatternFlowIpv6VersionMetricTag +} + +func NewPatternFlowIpv6VersionMetricTag() PatternFlowIpv6VersionMetricTag { + obj := patternFlowIpv6VersionMetricTag{obj: &otg.PatternFlowIpv6VersionMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowIpv6VersionMetricTag) msg() *otg.PatternFlowIpv6VersionMetricTag { + return obj.obj +} + +func (obj *patternFlowIpv6VersionMetricTag) setMsg(msg *otg.PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowIpv6VersionMetricTag struct { + obj *patternFlowIpv6VersionMetricTag +} + +type marshalPatternFlowIpv6VersionMetricTag interface { + // ToProto marshals PatternFlowIpv6VersionMetricTag to protobuf object *otg.PatternFlowIpv6VersionMetricTag + ToProto() (*otg.PatternFlowIpv6VersionMetricTag, error) + // ToPbText marshals PatternFlowIpv6VersionMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowIpv6VersionMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowIpv6VersionMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowIpv6VersionMetricTag struct { + obj *patternFlowIpv6VersionMetricTag +} + +type unMarshalPatternFlowIpv6VersionMetricTag interface { + // FromProto unmarshals PatternFlowIpv6VersionMetricTag from protobuf object *otg.PatternFlowIpv6VersionMetricTag + FromProto(msg *otg.PatternFlowIpv6VersionMetricTag) (PatternFlowIpv6VersionMetricTag, error) + // FromPbText unmarshals PatternFlowIpv6VersionMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowIpv6VersionMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowIpv6VersionMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowIpv6VersionMetricTag) Marshal() marshalPatternFlowIpv6VersionMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowIpv6VersionMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowIpv6VersionMetricTag) Unmarshal() unMarshalPatternFlowIpv6VersionMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowIpv6VersionMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowIpv6VersionMetricTag) ToProto() (*otg.PatternFlowIpv6VersionMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowIpv6VersionMetricTag) FromProto(msg *otg.PatternFlowIpv6VersionMetricTag) (PatternFlowIpv6VersionMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowIpv6VersionMetricTag) 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 *unMarshalpatternFlowIpv6VersionMetricTag) 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 *marshalpatternFlowIpv6VersionMetricTag) 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 *unMarshalpatternFlowIpv6VersionMetricTag) 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 *marshalpatternFlowIpv6VersionMetricTag) 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 *unMarshalpatternFlowIpv6VersionMetricTag) 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 *patternFlowIpv6VersionMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowIpv6VersionMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowIpv6VersionMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowIpv6VersionMetricTag) Clone() (PatternFlowIpv6VersionMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowIpv6VersionMetricTag() + 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 +} + +// PatternFlowIpv6VersionMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowIpv6VersionMetricTag interface { + Validation + // msg marshals PatternFlowIpv6VersionMetricTag to protobuf object *otg.PatternFlowIpv6VersionMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowIpv6VersionMetricTag + // setMsg unmarshals PatternFlowIpv6VersionMetricTag from protobuf object *otg.PatternFlowIpv6VersionMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowIpv6VersionMetricTag) PatternFlowIpv6VersionMetricTag + // provides marshal interface + Marshal() marshalPatternFlowIpv6VersionMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowIpv6VersionMetricTag + // validate validates PatternFlowIpv6VersionMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowIpv6VersionMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowIpv6VersionMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowIpv6VersionMetricTag + SetName(value string) PatternFlowIpv6VersionMetricTag + // Offset returns uint32, set in PatternFlowIpv6VersionMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowIpv6VersionMetricTag + SetOffset(value uint32) PatternFlowIpv6VersionMetricTag + // HasOffset checks if Offset has been set in PatternFlowIpv6VersionMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowIpv6VersionMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowIpv6VersionMetricTag + SetLength(value uint32) PatternFlowIpv6VersionMetricTag + // HasLength checks if Length has been set in PatternFlowIpv6VersionMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowIpv6VersionMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowIpv6VersionMetricTag object +func (obj *patternFlowIpv6VersionMetricTag) SetName(value string) PatternFlowIpv6VersionMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6VersionMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowIpv6VersionMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowIpv6VersionMetricTag object +func (obj *patternFlowIpv6VersionMetricTag) SetOffset(value uint32) PatternFlowIpv6VersionMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6VersionMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowIpv6VersionMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowIpv6VersionMetricTag object +func (obj *patternFlowIpv6VersionMetricTag) SetLength(value uint32) PatternFlowIpv6VersionMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowIpv6VersionMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowIpv6VersionMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowIpv6VersionMetricTag.Offset <= 3 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 4 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowIpv6VersionMetricTag.Length <= 4 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowIpv6VersionMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(4) + } + +} diff --git a/gosnappi/pattern_flow_mpls_bottom_of_stack.go b/gosnappi/pattern_flow_mpls_bottom_of_stack.go new file mode 100644 index 00000000..18f5f1a5 --- /dev/null +++ b/gosnappi/pattern_flow_mpls_bottom_of_stack.go @@ -0,0 +1,712 @@ +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" +) + +// ***** PatternFlowMplsBottomOfStack ***** +type patternFlowMplsBottomOfStack struct { + validation + obj *otg.PatternFlowMplsBottomOfStack + marshaller marshalPatternFlowMplsBottomOfStack + unMarshaller unMarshalPatternFlowMplsBottomOfStack + incrementHolder PatternFlowMplsBottomOfStackCounter + decrementHolder PatternFlowMplsBottomOfStackCounter + metricTagsHolder PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter +} + +func NewPatternFlowMplsBottomOfStack() PatternFlowMplsBottomOfStack { + obj := patternFlowMplsBottomOfStack{obj: &otg.PatternFlowMplsBottomOfStack{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowMplsBottomOfStack) msg() *otg.PatternFlowMplsBottomOfStack { + return obj.obj +} + +func (obj *patternFlowMplsBottomOfStack) setMsg(msg *otg.PatternFlowMplsBottomOfStack) PatternFlowMplsBottomOfStack { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowMplsBottomOfStack struct { + obj *patternFlowMplsBottomOfStack +} + +type marshalPatternFlowMplsBottomOfStack interface { + // ToProto marshals PatternFlowMplsBottomOfStack to protobuf object *otg.PatternFlowMplsBottomOfStack + ToProto() (*otg.PatternFlowMplsBottomOfStack, error) + // ToPbText marshals PatternFlowMplsBottomOfStack to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowMplsBottomOfStack to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowMplsBottomOfStack to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowMplsBottomOfStack struct { + obj *patternFlowMplsBottomOfStack +} + +type unMarshalPatternFlowMplsBottomOfStack interface { + // FromProto unmarshals PatternFlowMplsBottomOfStack from protobuf object *otg.PatternFlowMplsBottomOfStack + FromProto(msg *otg.PatternFlowMplsBottomOfStack) (PatternFlowMplsBottomOfStack, error) + // FromPbText unmarshals PatternFlowMplsBottomOfStack from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowMplsBottomOfStack from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowMplsBottomOfStack from JSON text + FromJson(value string) error +} + +func (obj *patternFlowMplsBottomOfStack) Marshal() marshalPatternFlowMplsBottomOfStack { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowMplsBottomOfStack{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowMplsBottomOfStack) Unmarshal() unMarshalPatternFlowMplsBottomOfStack { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowMplsBottomOfStack{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowMplsBottomOfStack) ToProto() (*otg.PatternFlowMplsBottomOfStack, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowMplsBottomOfStack) FromProto(msg *otg.PatternFlowMplsBottomOfStack) (PatternFlowMplsBottomOfStack, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowMplsBottomOfStack) 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 *unMarshalpatternFlowMplsBottomOfStack) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowMplsBottomOfStack) 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 *unMarshalpatternFlowMplsBottomOfStack) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowMplsBottomOfStack) 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 *unMarshalpatternFlowMplsBottomOfStack) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowMplsBottomOfStack) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowMplsBottomOfStack) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowMplsBottomOfStack) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowMplsBottomOfStack) Clone() (PatternFlowMplsBottomOfStack, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowMplsBottomOfStack() + 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 +} + +func (obj *patternFlowMplsBottomOfStack) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowMplsBottomOfStack is bottom of stack +type PatternFlowMplsBottomOfStack interface { + Validation + // msg marshals PatternFlowMplsBottomOfStack to protobuf object *otg.PatternFlowMplsBottomOfStack + // and doesn't set defaults + msg() *otg.PatternFlowMplsBottomOfStack + // setMsg unmarshals PatternFlowMplsBottomOfStack from protobuf object *otg.PatternFlowMplsBottomOfStack + // and doesn't set defaults + setMsg(*otg.PatternFlowMplsBottomOfStack) PatternFlowMplsBottomOfStack + // provides marshal interface + Marshal() marshalPatternFlowMplsBottomOfStack + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowMplsBottomOfStack + // validate validates PatternFlowMplsBottomOfStack + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowMplsBottomOfStack, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowMplsBottomOfStackChoiceEnum, set in PatternFlowMplsBottomOfStack + Choice() PatternFlowMplsBottomOfStackChoiceEnum + // setChoice assigns PatternFlowMplsBottomOfStackChoiceEnum provided by user to PatternFlowMplsBottomOfStack + setChoice(value PatternFlowMplsBottomOfStackChoiceEnum) PatternFlowMplsBottomOfStack + // HasChoice checks if Choice has been set in PatternFlowMplsBottomOfStack + HasChoice() bool + // Value returns uint32, set in PatternFlowMplsBottomOfStack. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowMplsBottomOfStack + SetValue(value uint32) PatternFlowMplsBottomOfStack + // HasValue checks if Value has been set in PatternFlowMplsBottomOfStack + HasValue() bool + // Values returns []uint32, set in PatternFlowMplsBottomOfStack. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowMplsBottomOfStack + SetValues(value []uint32) PatternFlowMplsBottomOfStack + // Auto returns uint32, set in PatternFlowMplsBottomOfStack. + Auto() uint32 + // HasAuto checks if Auto has been set in PatternFlowMplsBottomOfStack + HasAuto() bool + // Increment returns PatternFlowMplsBottomOfStackCounter, set in PatternFlowMplsBottomOfStack. + // PatternFlowMplsBottomOfStackCounter is integer counter pattern + Increment() PatternFlowMplsBottomOfStackCounter + // SetIncrement assigns PatternFlowMplsBottomOfStackCounter provided by user to PatternFlowMplsBottomOfStack. + // PatternFlowMplsBottomOfStackCounter is integer counter pattern + SetIncrement(value PatternFlowMplsBottomOfStackCounter) PatternFlowMplsBottomOfStack + // HasIncrement checks if Increment has been set in PatternFlowMplsBottomOfStack + HasIncrement() bool + // Decrement returns PatternFlowMplsBottomOfStackCounter, set in PatternFlowMplsBottomOfStack. + // PatternFlowMplsBottomOfStackCounter is integer counter pattern + Decrement() PatternFlowMplsBottomOfStackCounter + // SetDecrement assigns PatternFlowMplsBottomOfStackCounter provided by user to PatternFlowMplsBottomOfStack. + // PatternFlowMplsBottomOfStackCounter is integer counter pattern + SetDecrement(value PatternFlowMplsBottomOfStackCounter) PatternFlowMplsBottomOfStack + // HasDecrement checks if Decrement has been set in PatternFlowMplsBottomOfStack + HasDecrement() bool + // MetricTags returns PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIterIter, set in PatternFlowMplsBottomOfStack + MetricTags() PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter + setNil() +} + +type PatternFlowMplsBottomOfStackChoiceEnum string + +// Enum of Choice on PatternFlowMplsBottomOfStack +var PatternFlowMplsBottomOfStackChoice = struct { + VALUE PatternFlowMplsBottomOfStackChoiceEnum + VALUES PatternFlowMplsBottomOfStackChoiceEnum + AUTO PatternFlowMplsBottomOfStackChoiceEnum + INCREMENT PatternFlowMplsBottomOfStackChoiceEnum + DECREMENT PatternFlowMplsBottomOfStackChoiceEnum +}{ + VALUE: PatternFlowMplsBottomOfStackChoiceEnum("value"), + VALUES: PatternFlowMplsBottomOfStackChoiceEnum("values"), + AUTO: PatternFlowMplsBottomOfStackChoiceEnum("auto"), + INCREMENT: PatternFlowMplsBottomOfStackChoiceEnum("increment"), + DECREMENT: PatternFlowMplsBottomOfStackChoiceEnum("decrement"), +} + +func (obj *patternFlowMplsBottomOfStack) Choice() PatternFlowMplsBottomOfStackChoiceEnum { + return PatternFlowMplsBottomOfStackChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowMplsBottomOfStack) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowMplsBottomOfStack) setChoice(value PatternFlowMplsBottomOfStackChoiceEnum) PatternFlowMplsBottomOfStack { + intValue, ok := otg.PatternFlowMplsBottomOfStack_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowMplsBottomOfStackChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowMplsBottomOfStack_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Auto = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowMplsBottomOfStackChoice.VALUE { + defaultValue := uint32(1) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowMplsBottomOfStackChoice.VALUES { + defaultValue := []uint32{1} + obj.obj.Values = defaultValue + } + + if value == PatternFlowMplsBottomOfStackChoice.AUTO { + defaultValue := uint32(1) + obj.obj.Auto = &defaultValue + } + + if value == PatternFlowMplsBottomOfStackChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowMplsBottomOfStackCounter().msg() + } + + if value == PatternFlowMplsBottomOfStackChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowMplsBottomOfStackCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowMplsBottomOfStack) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowMplsBottomOfStackChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowMplsBottomOfStack) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowMplsBottomOfStack object +func (obj *patternFlowMplsBottomOfStack) SetValue(value uint32) PatternFlowMplsBottomOfStack { + obj.setChoice(PatternFlowMplsBottomOfStackChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowMplsBottomOfStack) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{1}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowMplsBottomOfStack object +func (obj *patternFlowMplsBottomOfStack) SetValues(value []uint32) PatternFlowMplsBottomOfStack { + obj.setChoice(PatternFlowMplsBottomOfStackChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowMplsBottomOfStack) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(PatternFlowMplsBottomOfStackChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowMplsBottomOfStack) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Increment returns a PatternFlowMplsBottomOfStackCounter +func (obj *patternFlowMplsBottomOfStack) Increment() PatternFlowMplsBottomOfStackCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowMplsBottomOfStackChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowMplsBottomOfStackCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowMplsBottomOfStackCounter +func (obj *patternFlowMplsBottomOfStack) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowMplsBottomOfStackCounter value in the PatternFlowMplsBottomOfStack object +func (obj *patternFlowMplsBottomOfStack) SetIncrement(value PatternFlowMplsBottomOfStackCounter) PatternFlowMplsBottomOfStack { + obj.setChoice(PatternFlowMplsBottomOfStackChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowMplsBottomOfStackCounter +func (obj *patternFlowMplsBottomOfStack) Decrement() PatternFlowMplsBottomOfStackCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowMplsBottomOfStackChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowMplsBottomOfStackCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowMplsBottomOfStackCounter +func (obj *patternFlowMplsBottomOfStack) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowMplsBottomOfStackCounter value in the PatternFlowMplsBottomOfStack object +func (obj *patternFlowMplsBottomOfStack) SetDecrement(value PatternFlowMplsBottomOfStackCounter) PatternFlowMplsBottomOfStack { + obj.setChoice(PatternFlowMplsBottomOfStackChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowMplsBottomOfStackMetricTag +func (obj *patternFlowMplsBottomOfStack) MetricTags() PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowMplsBottomOfStackMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter struct { + obj *patternFlowMplsBottomOfStack + patternFlowMplsBottomOfStackMetricTagSlice []PatternFlowMplsBottomOfStackMetricTag + fieldPtr *[]*otg.PatternFlowMplsBottomOfStackMetricTag +} + +func newPatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter(ptr *[]*otg.PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { + return &patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter interface { + setMsg(*patternFlowMplsBottomOfStack) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter + Items() []PatternFlowMplsBottomOfStackMetricTag + Add() PatternFlowMplsBottomOfStackMetricTag + Append(items ...PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter + Set(index int, newObj PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter + Clear() PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter + clearHolderSlice() PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter + appendHolderSlice(item PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter +} + +func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) setMsg(msg *patternFlowMplsBottomOfStack) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowMplsBottomOfStackMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) Items() []PatternFlowMplsBottomOfStackMetricTag { + return obj.patternFlowMplsBottomOfStackMetricTagSlice +} + +func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) Add() PatternFlowMplsBottomOfStackMetricTag { + newObj := &otg.PatternFlowMplsBottomOfStackMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowMplsBottomOfStackMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowMplsBottomOfStackMetricTagSlice = append(obj.patternFlowMplsBottomOfStackMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) Append(items ...PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowMplsBottomOfStackMetricTagSlice = append(obj.patternFlowMplsBottomOfStackMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) Set(index int, newObj PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowMplsBottomOfStackMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) Clear() PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowMplsBottomOfStackMetricTag{} + obj.patternFlowMplsBottomOfStackMetricTagSlice = []PatternFlowMplsBottomOfStackMetricTag{} + } + return obj +} +func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) clearHolderSlice() PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { + if len(obj.patternFlowMplsBottomOfStackMetricTagSlice) > 0 { + obj.patternFlowMplsBottomOfStackMetricTagSlice = []PatternFlowMplsBottomOfStackMetricTag{} + } + return obj +} +func (obj *patternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter) appendHolderSlice(item PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackPatternFlowMplsBottomOfStackMetricTagIter { + obj.patternFlowMplsBottomOfStackMetricTagSlice = append(obj.patternFlowMplsBottomOfStackMetricTagSlice, item) + return obj +} + +func (obj *patternFlowMplsBottomOfStack) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsBottomOfStack.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowMplsBottomOfStack.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Auto != nil { + + if *obj.obj.Auto > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsBottomOfStack.Auto <= 1 but Got %d", *obj.obj.Auto)) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowMplsBottomOfStackMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowMplsBottomOfStack) setDefault() { + var choices_set int = 0 + var choice PatternFlowMplsBottomOfStackChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowMplsBottomOfStackChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowMplsBottomOfStackChoice.VALUES + } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowMplsBottomOfStackChoice.AUTO + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowMplsBottomOfStackChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowMplsBottomOfStackChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowMplsBottomOfStackChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowMplsBottomOfStack") + } + } else { + intVal := otg.PatternFlowMplsBottomOfStack_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowMplsBottomOfStack_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_mpls_bottom_of_stack_counter.go b/gosnappi/pattern_flow_mpls_bottom_of_stack_counter.go new file mode 100644 index 00000000..6491f406 --- /dev/null +++ b/gosnappi/pattern_flow_mpls_bottom_of_stack_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowMplsBottomOfStackCounter ***** +type patternFlowMplsBottomOfStackCounter struct { + validation + obj *otg.PatternFlowMplsBottomOfStackCounter + marshaller marshalPatternFlowMplsBottomOfStackCounter + unMarshaller unMarshalPatternFlowMplsBottomOfStackCounter +} + +func NewPatternFlowMplsBottomOfStackCounter() PatternFlowMplsBottomOfStackCounter { + obj := patternFlowMplsBottomOfStackCounter{obj: &otg.PatternFlowMplsBottomOfStackCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowMplsBottomOfStackCounter) msg() *otg.PatternFlowMplsBottomOfStackCounter { + return obj.obj +} + +func (obj *patternFlowMplsBottomOfStackCounter) setMsg(msg *otg.PatternFlowMplsBottomOfStackCounter) PatternFlowMplsBottomOfStackCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowMplsBottomOfStackCounter struct { + obj *patternFlowMplsBottomOfStackCounter +} + +type marshalPatternFlowMplsBottomOfStackCounter interface { + // ToProto marshals PatternFlowMplsBottomOfStackCounter to protobuf object *otg.PatternFlowMplsBottomOfStackCounter + ToProto() (*otg.PatternFlowMplsBottomOfStackCounter, error) + // ToPbText marshals PatternFlowMplsBottomOfStackCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowMplsBottomOfStackCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowMplsBottomOfStackCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowMplsBottomOfStackCounter struct { + obj *patternFlowMplsBottomOfStackCounter +} + +type unMarshalPatternFlowMplsBottomOfStackCounter interface { + // FromProto unmarshals PatternFlowMplsBottomOfStackCounter from protobuf object *otg.PatternFlowMplsBottomOfStackCounter + FromProto(msg *otg.PatternFlowMplsBottomOfStackCounter) (PatternFlowMplsBottomOfStackCounter, error) + // FromPbText unmarshals PatternFlowMplsBottomOfStackCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowMplsBottomOfStackCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowMplsBottomOfStackCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowMplsBottomOfStackCounter) Marshal() marshalPatternFlowMplsBottomOfStackCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowMplsBottomOfStackCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowMplsBottomOfStackCounter) Unmarshal() unMarshalPatternFlowMplsBottomOfStackCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowMplsBottomOfStackCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowMplsBottomOfStackCounter) ToProto() (*otg.PatternFlowMplsBottomOfStackCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowMplsBottomOfStackCounter) FromProto(msg *otg.PatternFlowMplsBottomOfStackCounter) (PatternFlowMplsBottomOfStackCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowMplsBottomOfStackCounter) 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 *unMarshalpatternFlowMplsBottomOfStackCounter) 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 *marshalpatternFlowMplsBottomOfStackCounter) 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 *unMarshalpatternFlowMplsBottomOfStackCounter) 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 *marshalpatternFlowMplsBottomOfStackCounter) 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 *unMarshalpatternFlowMplsBottomOfStackCounter) 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 *patternFlowMplsBottomOfStackCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowMplsBottomOfStackCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowMplsBottomOfStackCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowMplsBottomOfStackCounter) Clone() (PatternFlowMplsBottomOfStackCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowMplsBottomOfStackCounter() + 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 +} + +// PatternFlowMplsBottomOfStackCounter is integer counter pattern +type PatternFlowMplsBottomOfStackCounter interface { + Validation + // msg marshals PatternFlowMplsBottomOfStackCounter to protobuf object *otg.PatternFlowMplsBottomOfStackCounter + // and doesn't set defaults + msg() *otg.PatternFlowMplsBottomOfStackCounter + // setMsg unmarshals PatternFlowMplsBottomOfStackCounter from protobuf object *otg.PatternFlowMplsBottomOfStackCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowMplsBottomOfStackCounter) PatternFlowMplsBottomOfStackCounter + // provides marshal interface + Marshal() marshalPatternFlowMplsBottomOfStackCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowMplsBottomOfStackCounter + // validate validates PatternFlowMplsBottomOfStackCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowMplsBottomOfStackCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowMplsBottomOfStackCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowMplsBottomOfStackCounter + SetStart(value uint32) PatternFlowMplsBottomOfStackCounter + // HasStart checks if Start has been set in PatternFlowMplsBottomOfStackCounter + HasStart() bool + // Step returns uint32, set in PatternFlowMplsBottomOfStackCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowMplsBottomOfStackCounter + SetStep(value uint32) PatternFlowMplsBottomOfStackCounter + // HasStep checks if Step has been set in PatternFlowMplsBottomOfStackCounter + HasStep() bool + // Count returns uint32, set in PatternFlowMplsBottomOfStackCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowMplsBottomOfStackCounter + SetCount(value uint32) PatternFlowMplsBottomOfStackCounter + // HasCount checks if Count has been set in PatternFlowMplsBottomOfStackCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowMplsBottomOfStackCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowMplsBottomOfStackCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowMplsBottomOfStackCounter object +func (obj *patternFlowMplsBottomOfStackCounter) SetStart(value uint32) PatternFlowMplsBottomOfStackCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowMplsBottomOfStackCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowMplsBottomOfStackCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowMplsBottomOfStackCounter object +func (obj *patternFlowMplsBottomOfStackCounter) SetStep(value uint32) PatternFlowMplsBottomOfStackCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowMplsBottomOfStackCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowMplsBottomOfStackCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowMplsBottomOfStackCounter object +func (obj *patternFlowMplsBottomOfStackCounter) SetCount(value uint32) PatternFlowMplsBottomOfStackCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowMplsBottomOfStackCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsBottomOfStackCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsBottomOfStackCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsBottomOfStackCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowMplsBottomOfStackCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_mpls_bottom_of_stack_metric_tag.go b/gosnappi/pattern_flow_mpls_bottom_of_stack_metric_tag.go new file mode 100644 index 00000000..851a284d --- /dev/null +++ b/gosnappi/pattern_flow_mpls_bottom_of_stack_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowMplsBottomOfStackMetricTag ***** +type patternFlowMplsBottomOfStackMetricTag struct { + validation + obj *otg.PatternFlowMplsBottomOfStackMetricTag + marshaller marshalPatternFlowMplsBottomOfStackMetricTag + unMarshaller unMarshalPatternFlowMplsBottomOfStackMetricTag +} + +func NewPatternFlowMplsBottomOfStackMetricTag() PatternFlowMplsBottomOfStackMetricTag { + obj := patternFlowMplsBottomOfStackMetricTag{obj: &otg.PatternFlowMplsBottomOfStackMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowMplsBottomOfStackMetricTag) msg() *otg.PatternFlowMplsBottomOfStackMetricTag { + return obj.obj +} + +func (obj *patternFlowMplsBottomOfStackMetricTag) setMsg(msg *otg.PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowMplsBottomOfStackMetricTag struct { + obj *patternFlowMplsBottomOfStackMetricTag +} + +type marshalPatternFlowMplsBottomOfStackMetricTag interface { + // ToProto marshals PatternFlowMplsBottomOfStackMetricTag to protobuf object *otg.PatternFlowMplsBottomOfStackMetricTag + ToProto() (*otg.PatternFlowMplsBottomOfStackMetricTag, error) + // ToPbText marshals PatternFlowMplsBottomOfStackMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowMplsBottomOfStackMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowMplsBottomOfStackMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowMplsBottomOfStackMetricTag struct { + obj *patternFlowMplsBottomOfStackMetricTag +} + +type unMarshalPatternFlowMplsBottomOfStackMetricTag interface { + // FromProto unmarshals PatternFlowMplsBottomOfStackMetricTag from protobuf object *otg.PatternFlowMplsBottomOfStackMetricTag + FromProto(msg *otg.PatternFlowMplsBottomOfStackMetricTag) (PatternFlowMplsBottomOfStackMetricTag, error) + // FromPbText unmarshals PatternFlowMplsBottomOfStackMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowMplsBottomOfStackMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowMplsBottomOfStackMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowMplsBottomOfStackMetricTag) Marshal() marshalPatternFlowMplsBottomOfStackMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowMplsBottomOfStackMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowMplsBottomOfStackMetricTag) Unmarshal() unMarshalPatternFlowMplsBottomOfStackMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowMplsBottomOfStackMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowMplsBottomOfStackMetricTag) ToProto() (*otg.PatternFlowMplsBottomOfStackMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowMplsBottomOfStackMetricTag) FromProto(msg *otg.PatternFlowMplsBottomOfStackMetricTag) (PatternFlowMplsBottomOfStackMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowMplsBottomOfStackMetricTag) 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 *unMarshalpatternFlowMplsBottomOfStackMetricTag) 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 *marshalpatternFlowMplsBottomOfStackMetricTag) 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 *unMarshalpatternFlowMplsBottomOfStackMetricTag) 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 *marshalpatternFlowMplsBottomOfStackMetricTag) 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 *unMarshalpatternFlowMplsBottomOfStackMetricTag) 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 *patternFlowMplsBottomOfStackMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowMplsBottomOfStackMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowMplsBottomOfStackMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowMplsBottomOfStackMetricTag) Clone() (PatternFlowMplsBottomOfStackMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowMplsBottomOfStackMetricTag() + 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 +} + +// PatternFlowMplsBottomOfStackMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowMplsBottomOfStackMetricTag interface { + Validation + // msg marshals PatternFlowMplsBottomOfStackMetricTag to protobuf object *otg.PatternFlowMplsBottomOfStackMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowMplsBottomOfStackMetricTag + // setMsg unmarshals PatternFlowMplsBottomOfStackMetricTag from protobuf object *otg.PatternFlowMplsBottomOfStackMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowMplsBottomOfStackMetricTag) PatternFlowMplsBottomOfStackMetricTag + // provides marshal interface + Marshal() marshalPatternFlowMplsBottomOfStackMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowMplsBottomOfStackMetricTag + // validate validates PatternFlowMplsBottomOfStackMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowMplsBottomOfStackMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowMplsBottomOfStackMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowMplsBottomOfStackMetricTag + SetName(value string) PatternFlowMplsBottomOfStackMetricTag + // Offset returns uint32, set in PatternFlowMplsBottomOfStackMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowMplsBottomOfStackMetricTag + SetOffset(value uint32) PatternFlowMplsBottomOfStackMetricTag + // HasOffset checks if Offset has been set in PatternFlowMplsBottomOfStackMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowMplsBottomOfStackMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowMplsBottomOfStackMetricTag + SetLength(value uint32) PatternFlowMplsBottomOfStackMetricTag + // HasLength checks if Length has been set in PatternFlowMplsBottomOfStackMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowMplsBottomOfStackMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowMplsBottomOfStackMetricTag object +func (obj *patternFlowMplsBottomOfStackMetricTag) SetName(value string) PatternFlowMplsBottomOfStackMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowMplsBottomOfStackMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowMplsBottomOfStackMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowMplsBottomOfStackMetricTag object +func (obj *patternFlowMplsBottomOfStackMetricTag) SetOffset(value uint32) PatternFlowMplsBottomOfStackMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowMplsBottomOfStackMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowMplsBottomOfStackMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowMplsBottomOfStackMetricTag object +func (obj *patternFlowMplsBottomOfStackMetricTag) SetLength(value uint32) PatternFlowMplsBottomOfStackMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowMplsBottomOfStackMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowMplsBottomOfStackMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsBottomOfStackMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowMplsBottomOfStackMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowMplsBottomOfStackMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_mpls_label.go b/gosnappi/pattern_flow_mpls_label.go new file mode 100644 index 00000000..109d0544 --- /dev/null +++ b/gosnappi/pattern_flow_mpls_label.go @@ -0,0 +1,712 @@ +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" +) + +// ***** PatternFlowMplsLabel ***** +type patternFlowMplsLabel struct { + validation + obj *otg.PatternFlowMplsLabel + marshaller marshalPatternFlowMplsLabel + unMarshaller unMarshalPatternFlowMplsLabel + incrementHolder PatternFlowMplsLabelCounter + decrementHolder PatternFlowMplsLabelCounter + metricTagsHolder PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter +} + +func NewPatternFlowMplsLabel() PatternFlowMplsLabel { + obj := patternFlowMplsLabel{obj: &otg.PatternFlowMplsLabel{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowMplsLabel) msg() *otg.PatternFlowMplsLabel { + return obj.obj +} + +func (obj *patternFlowMplsLabel) setMsg(msg *otg.PatternFlowMplsLabel) PatternFlowMplsLabel { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowMplsLabel struct { + obj *patternFlowMplsLabel +} + +type marshalPatternFlowMplsLabel interface { + // ToProto marshals PatternFlowMplsLabel to protobuf object *otg.PatternFlowMplsLabel + ToProto() (*otg.PatternFlowMplsLabel, error) + // ToPbText marshals PatternFlowMplsLabel to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowMplsLabel to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowMplsLabel to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowMplsLabel struct { + obj *patternFlowMplsLabel +} + +type unMarshalPatternFlowMplsLabel interface { + // FromProto unmarshals PatternFlowMplsLabel from protobuf object *otg.PatternFlowMplsLabel + FromProto(msg *otg.PatternFlowMplsLabel) (PatternFlowMplsLabel, error) + // FromPbText unmarshals PatternFlowMplsLabel from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowMplsLabel from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowMplsLabel from JSON text + FromJson(value string) error +} + +func (obj *patternFlowMplsLabel) Marshal() marshalPatternFlowMplsLabel { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowMplsLabel{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowMplsLabel) Unmarshal() unMarshalPatternFlowMplsLabel { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowMplsLabel{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowMplsLabel) ToProto() (*otg.PatternFlowMplsLabel, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowMplsLabel) FromProto(msg *otg.PatternFlowMplsLabel) (PatternFlowMplsLabel, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowMplsLabel) 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 *unMarshalpatternFlowMplsLabel) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowMplsLabel) 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 *unMarshalpatternFlowMplsLabel) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowMplsLabel) 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 *unMarshalpatternFlowMplsLabel) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowMplsLabel) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowMplsLabel) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowMplsLabel) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowMplsLabel) Clone() (PatternFlowMplsLabel, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowMplsLabel() + 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 +} + +func (obj *patternFlowMplsLabel) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowMplsLabel is label of routers +type PatternFlowMplsLabel interface { + Validation + // msg marshals PatternFlowMplsLabel to protobuf object *otg.PatternFlowMplsLabel + // and doesn't set defaults + msg() *otg.PatternFlowMplsLabel + // setMsg unmarshals PatternFlowMplsLabel from protobuf object *otg.PatternFlowMplsLabel + // and doesn't set defaults + setMsg(*otg.PatternFlowMplsLabel) PatternFlowMplsLabel + // provides marshal interface + Marshal() marshalPatternFlowMplsLabel + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowMplsLabel + // validate validates PatternFlowMplsLabel + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowMplsLabel, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowMplsLabelChoiceEnum, set in PatternFlowMplsLabel + Choice() PatternFlowMplsLabelChoiceEnum + // setChoice assigns PatternFlowMplsLabelChoiceEnum provided by user to PatternFlowMplsLabel + setChoice(value PatternFlowMplsLabelChoiceEnum) PatternFlowMplsLabel + // HasChoice checks if Choice has been set in PatternFlowMplsLabel + HasChoice() bool + // Value returns uint32, set in PatternFlowMplsLabel. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowMplsLabel + SetValue(value uint32) PatternFlowMplsLabel + // HasValue checks if Value has been set in PatternFlowMplsLabel + HasValue() bool + // Values returns []uint32, set in PatternFlowMplsLabel. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowMplsLabel + SetValues(value []uint32) PatternFlowMplsLabel + // Auto returns uint32, set in PatternFlowMplsLabel. + Auto() uint32 + // HasAuto checks if Auto has been set in PatternFlowMplsLabel + HasAuto() bool + // Increment returns PatternFlowMplsLabelCounter, set in PatternFlowMplsLabel. + // PatternFlowMplsLabelCounter is integer counter pattern + Increment() PatternFlowMplsLabelCounter + // SetIncrement assigns PatternFlowMplsLabelCounter provided by user to PatternFlowMplsLabel. + // PatternFlowMplsLabelCounter is integer counter pattern + SetIncrement(value PatternFlowMplsLabelCounter) PatternFlowMplsLabel + // HasIncrement checks if Increment has been set in PatternFlowMplsLabel + HasIncrement() bool + // Decrement returns PatternFlowMplsLabelCounter, set in PatternFlowMplsLabel. + // PatternFlowMplsLabelCounter is integer counter pattern + Decrement() PatternFlowMplsLabelCounter + // SetDecrement assigns PatternFlowMplsLabelCounter provided by user to PatternFlowMplsLabel. + // PatternFlowMplsLabelCounter is integer counter pattern + SetDecrement(value PatternFlowMplsLabelCounter) PatternFlowMplsLabel + // HasDecrement checks if Decrement has been set in PatternFlowMplsLabel + HasDecrement() bool + // MetricTags returns PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIterIter, set in PatternFlowMplsLabel + MetricTags() PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter + setNil() +} + +type PatternFlowMplsLabelChoiceEnum string + +// Enum of Choice on PatternFlowMplsLabel +var PatternFlowMplsLabelChoice = struct { + VALUE PatternFlowMplsLabelChoiceEnum + VALUES PatternFlowMplsLabelChoiceEnum + AUTO PatternFlowMplsLabelChoiceEnum + INCREMENT PatternFlowMplsLabelChoiceEnum + DECREMENT PatternFlowMplsLabelChoiceEnum +}{ + VALUE: PatternFlowMplsLabelChoiceEnum("value"), + VALUES: PatternFlowMplsLabelChoiceEnum("values"), + AUTO: PatternFlowMplsLabelChoiceEnum("auto"), + INCREMENT: PatternFlowMplsLabelChoiceEnum("increment"), + DECREMENT: PatternFlowMplsLabelChoiceEnum("decrement"), +} + +func (obj *patternFlowMplsLabel) Choice() PatternFlowMplsLabelChoiceEnum { + return PatternFlowMplsLabelChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowMplsLabel) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowMplsLabel) setChoice(value PatternFlowMplsLabelChoiceEnum) PatternFlowMplsLabel { + intValue, ok := otg.PatternFlowMplsLabel_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowMplsLabelChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowMplsLabel_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Auto = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowMplsLabelChoice.VALUE { + defaultValue := uint32(16) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowMplsLabelChoice.VALUES { + defaultValue := []uint32{16} + obj.obj.Values = defaultValue + } + + if value == PatternFlowMplsLabelChoice.AUTO { + defaultValue := uint32(16) + obj.obj.Auto = &defaultValue + } + + if value == PatternFlowMplsLabelChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowMplsLabelCounter().msg() + } + + if value == PatternFlowMplsLabelChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowMplsLabelCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowMplsLabel) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowMplsLabelChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowMplsLabel) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowMplsLabel object +func (obj *patternFlowMplsLabel) SetValue(value uint32) PatternFlowMplsLabel { + obj.setChoice(PatternFlowMplsLabelChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowMplsLabel) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{16}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowMplsLabel object +func (obj *patternFlowMplsLabel) SetValues(value []uint32) PatternFlowMplsLabel { + obj.setChoice(PatternFlowMplsLabelChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowMplsLabel) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(PatternFlowMplsLabelChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowMplsLabel) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Increment returns a PatternFlowMplsLabelCounter +func (obj *patternFlowMplsLabel) Increment() PatternFlowMplsLabelCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowMplsLabelChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowMplsLabelCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowMplsLabelCounter +func (obj *patternFlowMplsLabel) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowMplsLabelCounter value in the PatternFlowMplsLabel object +func (obj *patternFlowMplsLabel) SetIncrement(value PatternFlowMplsLabelCounter) PatternFlowMplsLabel { + obj.setChoice(PatternFlowMplsLabelChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowMplsLabelCounter +func (obj *patternFlowMplsLabel) Decrement() PatternFlowMplsLabelCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowMplsLabelChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowMplsLabelCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowMplsLabelCounter +func (obj *patternFlowMplsLabel) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowMplsLabelCounter value in the PatternFlowMplsLabel object +func (obj *patternFlowMplsLabel) SetDecrement(value PatternFlowMplsLabelCounter) PatternFlowMplsLabel { + obj.setChoice(PatternFlowMplsLabelChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowMplsLabelMetricTag +func (obj *patternFlowMplsLabel) MetricTags() PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowMplsLabelMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter struct { + obj *patternFlowMplsLabel + patternFlowMplsLabelMetricTagSlice []PatternFlowMplsLabelMetricTag + fieldPtr *[]*otg.PatternFlowMplsLabelMetricTag +} + +func newPatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter(ptr *[]*otg.PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { + return &patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter interface { + setMsg(*patternFlowMplsLabel) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter + Items() []PatternFlowMplsLabelMetricTag + Add() PatternFlowMplsLabelMetricTag + Append(items ...PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter + Set(index int, newObj PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter + Clear() PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter + clearHolderSlice() PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter + appendHolderSlice(item PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter +} + +func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) setMsg(msg *patternFlowMplsLabel) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowMplsLabelMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) Items() []PatternFlowMplsLabelMetricTag { + return obj.patternFlowMplsLabelMetricTagSlice +} + +func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) Add() PatternFlowMplsLabelMetricTag { + newObj := &otg.PatternFlowMplsLabelMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowMplsLabelMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowMplsLabelMetricTagSlice = append(obj.patternFlowMplsLabelMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) Append(items ...PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowMplsLabelMetricTagSlice = append(obj.patternFlowMplsLabelMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) Set(index int, newObj PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowMplsLabelMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) Clear() PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowMplsLabelMetricTag{} + obj.patternFlowMplsLabelMetricTagSlice = []PatternFlowMplsLabelMetricTag{} + } + return obj +} +func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) clearHolderSlice() PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { + if len(obj.patternFlowMplsLabelMetricTagSlice) > 0 { + obj.patternFlowMplsLabelMetricTagSlice = []PatternFlowMplsLabelMetricTag{} + } + return obj +} +func (obj *patternFlowMplsLabelPatternFlowMplsLabelMetricTagIter) appendHolderSlice(item PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelPatternFlowMplsLabelMetricTagIter { + obj.patternFlowMplsLabelMetricTagSlice = append(obj.patternFlowMplsLabelMetricTagSlice, item) + return obj +} + +func (obj *patternFlowMplsLabel) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsLabel.Value <= 1048575 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowMplsLabel.Values <= 1048575 but Got %d", item)) + } + + } + + } + + if obj.obj.Auto != nil { + + if *obj.obj.Auto > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsLabel.Auto <= 1048575 but Got %d", *obj.obj.Auto)) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowMplsLabelMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowMplsLabel) setDefault() { + var choices_set int = 0 + var choice PatternFlowMplsLabelChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowMplsLabelChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowMplsLabelChoice.VALUES + } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowMplsLabelChoice.AUTO + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowMplsLabelChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowMplsLabelChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowMplsLabelChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowMplsLabel") + } + } else { + intVal := otg.PatternFlowMplsLabel_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowMplsLabel_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_mpls_label_counter.go b/gosnappi/pattern_flow_mpls_label_counter.go new file mode 100644 index 00000000..1f79cebe --- /dev/null +++ b/gosnappi/pattern_flow_mpls_label_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowMplsLabelCounter ***** +type patternFlowMplsLabelCounter struct { + validation + obj *otg.PatternFlowMplsLabelCounter + marshaller marshalPatternFlowMplsLabelCounter + unMarshaller unMarshalPatternFlowMplsLabelCounter +} + +func NewPatternFlowMplsLabelCounter() PatternFlowMplsLabelCounter { + obj := patternFlowMplsLabelCounter{obj: &otg.PatternFlowMplsLabelCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowMplsLabelCounter) msg() *otg.PatternFlowMplsLabelCounter { + return obj.obj +} + +func (obj *patternFlowMplsLabelCounter) setMsg(msg *otg.PatternFlowMplsLabelCounter) PatternFlowMplsLabelCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowMplsLabelCounter struct { + obj *patternFlowMplsLabelCounter +} + +type marshalPatternFlowMplsLabelCounter interface { + // ToProto marshals PatternFlowMplsLabelCounter to protobuf object *otg.PatternFlowMplsLabelCounter + ToProto() (*otg.PatternFlowMplsLabelCounter, error) + // ToPbText marshals PatternFlowMplsLabelCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowMplsLabelCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowMplsLabelCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowMplsLabelCounter struct { + obj *patternFlowMplsLabelCounter +} + +type unMarshalPatternFlowMplsLabelCounter interface { + // FromProto unmarshals PatternFlowMplsLabelCounter from protobuf object *otg.PatternFlowMplsLabelCounter + FromProto(msg *otg.PatternFlowMplsLabelCounter) (PatternFlowMplsLabelCounter, error) + // FromPbText unmarshals PatternFlowMplsLabelCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowMplsLabelCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowMplsLabelCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowMplsLabelCounter) Marshal() marshalPatternFlowMplsLabelCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowMplsLabelCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowMplsLabelCounter) Unmarshal() unMarshalPatternFlowMplsLabelCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowMplsLabelCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowMplsLabelCounter) ToProto() (*otg.PatternFlowMplsLabelCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowMplsLabelCounter) FromProto(msg *otg.PatternFlowMplsLabelCounter) (PatternFlowMplsLabelCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowMplsLabelCounter) 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 *unMarshalpatternFlowMplsLabelCounter) 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 *marshalpatternFlowMplsLabelCounter) 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 *unMarshalpatternFlowMplsLabelCounter) 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 *marshalpatternFlowMplsLabelCounter) 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 *unMarshalpatternFlowMplsLabelCounter) 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 *patternFlowMplsLabelCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowMplsLabelCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowMplsLabelCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowMplsLabelCounter) Clone() (PatternFlowMplsLabelCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowMplsLabelCounter() + 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 +} + +// PatternFlowMplsLabelCounter is integer counter pattern +type PatternFlowMplsLabelCounter interface { + Validation + // msg marshals PatternFlowMplsLabelCounter to protobuf object *otg.PatternFlowMplsLabelCounter + // and doesn't set defaults + msg() *otg.PatternFlowMplsLabelCounter + // setMsg unmarshals PatternFlowMplsLabelCounter from protobuf object *otg.PatternFlowMplsLabelCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowMplsLabelCounter) PatternFlowMplsLabelCounter + // provides marshal interface + Marshal() marshalPatternFlowMplsLabelCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowMplsLabelCounter + // validate validates PatternFlowMplsLabelCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowMplsLabelCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowMplsLabelCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowMplsLabelCounter + SetStart(value uint32) PatternFlowMplsLabelCounter + // HasStart checks if Start has been set in PatternFlowMplsLabelCounter + HasStart() bool + // Step returns uint32, set in PatternFlowMplsLabelCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowMplsLabelCounter + SetStep(value uint32) PatternFlowMplsLabelCounter + // HasStep checks if Step has been set in PatternFlowMplsLabelCounter + HasStep() bool + // Count returns uint32, set in PatternFlowMplsLabelCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowMplsLabelCounter + SetCount(value uint32) PatternFlowMplsLabelCounter + // HasCount checks if Count has been set in PatternFlowMplsLabelCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowMplsLabelCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowMplsLabelCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowMplsLabelCounter object +func (obj *patternFlowMplsLabelCounter) SetStart(value uint32) PatternFlowMplsLabelCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowMplsLabelCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowMplsLabelCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowMplsLabelCounter object +func (obj *patternFlowMplsLabelCounter) SetStep(value uint32) PatternFlowMplsLabelCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowMplsLabelCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowMplsLabelCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowMplsLabelCounter object +func (obj *patternFlowMplsLabelCounter) SetCount(value uint32) PatternFlowMplsLabelCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowMplsLabelCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsLabelCounter.Start <= 1048575 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsLabelCounter.Step <= 1048575 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsLabelCounter.Count <= 1048575 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowMplsLabelCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(16) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_mpls_label_metric_tag.go b/gosnappi/pattern_flow_mpls_label_metric_tag.go new file mode 100644 index 00000000..b4565019 --- /dev/null +++ b/gosnappi/pattern_flow_mpls_label_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowMplsLabelMetricTag ***** +type patternFlowMplsLabelMetricTag struct { + validation + obj *otg.PatternFlowMplsLabelMetricTag + marshaller marshalPatternFlowMplsLabelMetricTag + unMarshaller unMarshalPatternFlowMplsLabelMetricTag +} + +func NewPatternFlowMplsLabelMetricTag() PatternFlowMplsLabelMetricTag { + obj := patternFlowMplsLabelMetricTag{obj: &otg.PatternFlowMplsLabelMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowMplsLabelMetricTag) msg() *otg.PatternFlowMplsLabelMetricTag { + return obj.obj +} + +func (obj *patternFlowMplsLabelMetricTag) setMsg(msg *otg.PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowMplsLabelMetricTag struct { + obj *patternFlowMplsLabelMetricTag +} + +type marshalPatternFlowMplsLabelMetricTag interface { + // ToProto marshals PatternFlowMplsLabelMetricTag to protobuf object *otg.PatternFlowMplsLabelMetricTag + ToProto() (*otg.PatternFlowMplsLabelMetricTag, error) + // ToPbText marshals PatternFlowMplsLabelMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowMplsLabelMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowMplsLabelMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowMplsLabelMetricTag struct { + obj *patternFlowMplsLabelMetricTag +} + +type unMarshalPatternFlowMplsLabelMetricTag interface { + // FromProto unmarshals PatternFlowMplsLabelMetricTag from protobuf object *otg.PatternFlowMplsLabelMetricTag + FromProto(msg *otg.PatternFlowMplsLabelMetricTag) (PatternFlowMplsLabelMetricTag, error) + // FromPbText unmarshals PatternFlowMplsLabelMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowMplsLabelMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowMplsLabelMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowMplsLabelMetricTag) Marshal() marshalPatternFlowMplsLabelMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowMplsLabelMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowMplsLabelMetricTag) Unmarshal() unMarshalPatternFlowMplsLabelMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowMplsLabelMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowMplsLabelMetricTag) ToProto() (*otg.PatternFlowMplsLabelMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowMplsLabelMetricTag) FromProto(msg *otg.PatternFlowMplsLabelMetricTag) (PatternFlowMplsLabelMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowMplsLabelMetricTag) 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 *unMarshalpatternFlowMplsLabelMetricTag) 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 *marshalpatternFlowMplsLabelMetricTag) 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 *unMarshalpatternFlowMplsLabelMetricTag) 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 *marshalpatternFlowMplsLabelMetricTag) 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 *unMarshalpatternFlowMplsLabelMetricTag) 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 *patternFlowMplsLabelMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowMplsLabelMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowMplsLabelMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowMplsLabelMetricTag) Clone() (PatternFlowMplsLabelMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowMplsLabelMetricTag() + 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 +} + +// PatternFlowMplsLabelMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowMplsLabelMetricTag interface { + Validation + // msg marshals PatternFlowMplsLabelMetricTag to protobuf object *otg.PatternFlowMplsLabelMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowMplsLabelMetricTag + // setMsg unmarshals PatternFlowMplsLabelMetricTag from protobuf object *otg.PatternFlowMplsLabelMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowMplsLabelMetricTag) PatternFlowMplsLabelMetricTag + // provides marshal interface + Marshal() marshalPatternFlowMplsLabelMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowMplsLabelMetricTag + // validate validates PatternFlowMplsLabelMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowMplsLabelMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowMplsLabelMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowMplsLabelMetricTag + SetName(value string) PatternFlowMplsLabelMetricTag + // Offset returns uint32, set in PatternFlowMplsLabelMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowMplsLabelMetricTag + SetOffset(value uint32) PatternFlowMplsLabelMetricTag + // HasOffset checks if Offset has been set in PatternFlowMplsLabelMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowMplsLabelMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowMplsLabelMetricTag + SetLength(value uint32) PatternFlowMplsLabelMetricTag + // HasLength checks if Length has been set in PatternFlowMplsLabelMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowMplsLabelMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowMplsLabelMetricTag object +func (obj *patternFlowMplsLabelMetricTag) SetName(value string) PatternFlowMplsLabelMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowMplsLabelMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowMplsLabelMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowMplsLabelMetricTag object +func (obj *patternFlowMplsLabelMetricTag) SetOffset(value uint32) PatternFlowMplsLabelMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowMplsLabelMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowMplsLabelMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowMplsLabelMetricTag object +func (obj *patternFlowMplsLabelMetricTag) SetLength(value uint32) PatternFlowMplsLabelMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowMplsLabelMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowMplsLabelMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 19 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsLabelMetricTag.Offset <= 19 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 20 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowMplsLabelMetricTag.Length <= 20 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowMplsLabelMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(20) + } + +} diff --git a/gosnappi/pattern_flow_mpls_time_to_live.go b/gosnappi/pattern_flow_mpls_time_to_live.go new file mode 100644 index 00000000..9c487092 --- /dev/null +++ b/gosnappi/pattern_flow_mpls_time_to_live.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowMplsTimeToLive ***** +type patternFlowMplsTimeToLive struct { + validation + obj *otg.PatternFlowMplsTimeToLive + marshaller marshalPatternFlowMplsTimeToLive + unMarshaller unMarshalPatternFlowMplsTimeToLive + incrementHolder PatternFlowMplsTimeToLiveCounter + decrementHolder PatternFlowMplsTimeToLiveCounter + metricTagsHolder PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter +} + +func NewPatternFlowMplsTimeToLive() PatternFlowMplsTimeToLive { + obj := patternFlowMplsTimeToLive{obj: &otg.PatternFlowMplsTimeToLive{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowMplsTimeToLive) msg() *otg.PatternFlowMplsTimeToLive { + return obj.obj +} + +func (obj *patternFlowMplsTimeToLive) setMsg(msg *otg.PatternFlowMplsTimeToLive) PatternFlowMplsTimeToLive { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowMplsTimeToLive struct { + obj *patternFlowMplsTimeToLive +} + +type marshalPatternFlowMplsTimeToLive interface { + // ToProto marshals PatternFlowMplsTimeToLive to protobuf object *otg.PatternFlowMplsTimeToLive + ToProto() (*otg.PatternFlowMplsTimeToLive, error) + // ToPbText marshals PatternFlowMplsTimeToLive to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowMplsTimeToLive to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowMplsTimeToLive to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowMplsTimeToLive struct { + obj *patternFlowMplsTimeToLive +} + +type unMarshalPatternFlowMplsTimeToLive interface { + // FromProto unmarshals PatternFlowMplsTimeToLive from protobuf object *otg.PatternFlowMplsTimeToLive + FromProto(msg *otg.PatternFlowMplsTimeToLive) (PatternFlowMplsTimeToLive, error) + // FromPbText unmarshals PatternFlowMplsTimeToLive from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowMplsTimeToLive from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowMplsTimeToLive from JSON text + FromJson(value string) error +} + +func (obj *patternFlowMplsTimeToLive) Marshal() marshalPatternFlowMplsTimeToLive { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowMplsTimeToLive{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowMplsTimeToLive) Unmarshal() unMarshalPatternFlowMplsTimeToLive { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowMplsTimeToLive{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowMplsTimeToLive) ToProto() (*otg.PatternFlowMplsTimeToLive, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowMplsTimeToLive) FromProto(msg *otg.PatternFlowMplsTimeToLive) (PatternFlowMplsTimeToLive, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowMplsTimeToLive) 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 *unMarshalpatternFlowMplsTimeToLive) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowMplsTimeToLive) 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 *unMarshalpatternFlowMplsTimeToLive) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowMplsTimeToLive) 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 *unMarshalpatternFlowMplsTimeToLive) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowMplsTimeToLive) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowMplsTimeToLive) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowMplsTimeToLive) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowMplsTimeToLive) Clone() (PatternFlowMplsTimeToLive, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowMplsTimeToLive() + 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 +} + +func (obj *patternFlowMplsTimeToLive) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowMplsTimeToLive is time to live +type PatternFlowMplsTimeToLive interface { + Validation + // msg marshals PatternFlowMplsTimeToLive to protobuf object *otg.PatternFlowMplsTimeToLive + // and doesn't set defaults + msg() *otg.PatternFlowMplsTimeToLive + // setMsg unmarshals PatternFlowMplsTimeToLive from protobuf object *otg.PatternFlowMplsTimeToLive + // and doesn't set defaults + setMsg(*otg.PatternFlowMplsTimeToLive) PatternFlowMplsTimeToLive + // provides marshal interface + Marshal() marshalPatternFlowMplsTimeToLive + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowMplsTimeToLive + // validate validates PatternFlowMplsTimeToLive + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowMplsTimeToLive, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowMplsTimeToLiveChoiceEnum, set in PatternFlowMplsTimeToLive + Choice() PatternFlowMplsTimeToLiveChoiceEnum + // setChoice assigns PatternFlowMplsTimeToLiveChoiceEnum provided by user to PatternFlowMplsTimeToLive + setChoice(value PatternFlowMplsTimeToLiveChoiceEnum) PatternFlowMplsTimeToLive + // HasChoice checks if Choice has been set in PatternFlowMplsTimeToLive + HasChoice() bool + // Value returns uint32, set in PatternFlowMplsTimeToLive. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowMplsTimeToLive + SetValue(value uint32) PatternFlowMplsTimeToLive + // HasValue checks if Value has been set in PatternFlowMplsTimeToLive + HasValue() bool + // Values returns []uint32, set in PatternFlowMplsTimeToLive. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowMplsTimeToLive + SetValues(value []uint32) PatternFlowMplsTimeToLive + // Increment returns PatternFlowMplsTimeToLiveCounter, set in PatternFlowMplsTimeToLive. + // PatternFlowMplsTimeToLiveCounter is integer counter pattern + Increment() PatternFlowMplsTimeToLiveCounter + // SetIncrement assigns PatternFlowMplsTimeToLiveCounter provided by user to PatternFlowMplsTimeToLive. + // PatternFlowMplsTimeToLiveCounter is integer counter pattern + SetIncrement(value PatternFlowMplsTimeToLiveCounter) PatternFlowMplsTimeToLive + // HasIncrement checks if Increment has been set in PatternFlowMplsTimeToLive + HasIncrement() bool + // Decrement returns PatternFlowMplsTimeToLiveCounter, set in PatternFlowMplsTimeToLive. + // PatternFlowMplsTimeToLiveCounter is integer counter pattern + Decrement() PatternFlowMplsTimeToLiveCounter + // SetDecrement assigns PatternFlowMplsTimeToLiveCounter provided by user to PatternFlowMplsTimeToLive. + // PatternFlowMplsTimeToLiveCounter is integer counter pattern + SetDecrement(value PatternFlowMplsTimeToLiveCounter) PatternFlowMplsTimeToLive + // HasDecrement checks if Decrement has been set in PatternFlowMplsTimeToLive + HasDecrement() bool + // MetricTags returns PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIterIter, set in PatternFlowMplsTimeToLive + MetricTags() PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter + setNil() +} + +type PatternFlowMplsTimeToLiveChoiceEnum string + +// Enum of Choice on PatternFlowMplsTimeToLive +var PatternFlowMplsTimeToLiveChoice = struct { + VALUE PatternFlowMplsTimeToLiveChoiceEnum + VALUES PatternFlowMplsTimeToLiveChoiceEnum + INCREMENT PatternFlowMplsTimeToLiveChoiceEnum + DECREMENT PatternFlowMplsTimeToLiveChoiceEnum +}{ + VALUE: PatternFlowMplsTimeToLiveChoiceEnum("value"), + VALUES: PatternFlowMplsTimeToLiveChoiceEnum("values"), + INCREMENT: PatternFlowMplsTimeToLiveChoiceEnum("increment"), + DECREMENT: PatternFlowMplsTimeToLiveChoiceEnum("decrement"), +} + +func (obj *patternFlowMplsTimeToLive) Choice() PatternFlowMplsTimeToLiveChoiceEnum { + return PatternFlowMplsTimeToLiveChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowMplsTimeToLive) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowMplsTimeToLive) setChoice(value PatternFlowMplsTimeToLiveChoiceEnum) PatternFlowMplsTimeToLive { + intValue, ok := otg.PatternFlowMplsTimeToLive_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowMplsTimeToLiveChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowMplsTimeToLive_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowMplsTimeToLiveChoice.VALUE { + defaultValue := uint32(64) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowMplsTimeToLiveChoice.VALUES { + defaultValue := []uint32{64} + obj.obj.Values = defaultValue + } + + if value == PatternFlowMplsTimeToLiveChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowMplsTimeToLiveCounter().msg() + } + + if value == PatternFlowMplsTimeToLiveChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowMplsTimeToLiveCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowMplsTimeToLive) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowMplsTimeToLiveChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowMplsTimeToLive) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowMplsTimeToLive object +func (obj *patternFlowMplsTimeToLive) SetValue(value uint32) PatternFlowMplsTimeToLive { + obj.setChoice(PatternFlowMplsTimeToLiveChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowMplsTimeToLive) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{64}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowMplsTimeToLive object +func (obj *patternFlowMplsTimeToLive) SetValues(value []uint32) PatternFlowMplsTimeToLive { + obj.setChoice(PatternFlowMplsTimeToLiveChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowMplsTimeToLiveCounter +func (obj *patternFlowMplsTimeToLive) Increment() PatternFlowMplsTimeToLiveCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowMplsTimeToLiveChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowMplsTimeToLiveCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowMplsTimeToLiveCounter +func (obj *patternFlowMplsTimeToLive) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowMplsTimeToLiveCounter value in the PatternFlowMplsTimeToLive object +func (obj *patternFlowMplsTimeToLive) SetIncrement(value PatternFlowMplsTimeToLiveCounter) PatternFlowMplsTimeToLive { + obj.setChoice(PatternFlowMplsTimeToLiveChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowMplsTimeToLiveCounter +func (obj *patternFlowMplsTimeToLive) Decrement() PatternFlowMplsTimeToLiveCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowMplsTimeToLiveChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowMplsTimeToLiveCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowMplsTimeToLiveCounter +func (obj *patternFlowMplsTimeToLive) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowMplsTimeToLiveCounter value in the PatternFlowMplsTimeToLive object +func (obj *patternFlowMplsTimeToLive) SetDecrement(value PatternFlowMplsTimeToLiveCounter) PatternFlowMplsTimeToLive { + obj.setChoice(PatternFlowMplsTimeToLiveChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowMplsTimeToLiveMetricTag +func (obj *patternFlowMplsTimeToLive) MetricTags() PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowMplsTimeToLiveMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter struct { + obj *patternFlowMplsTimeToLive + patternFlowMplsTimeToLiveMetricTagSlice []PatternFlowMplsTimeToLiveMetricTag + fieldPtr *[]*otg.PatternFlowMplsTimeToLiveMetricTag +} + +func newPatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter(ptr *[]*otg.PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { + return &patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter interface { + setMsg(*patternFlowMplsTimeToLive) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter + Items() []PatternFlowMplsTimeToLiveMetricTag + Add() PatternFlowMplsTimeToLiveMetricTag + Append(items ...PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter + Set(index int, newObj PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter + Clear() PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter + clearHolderSlice() PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter + appendHolderSlice(item PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter +} + +func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) setMsg(msg *patternFlowMplsTimeToLive) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowMplsTimeToLiveMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) Items() []PatternFlowMplsTimeToLiveMetricTag { + return obj.patternFlowMplsTimeToLiveMetricTagSlice +} + +func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) Add() PatternFlowMplsTimeToLiveMetricTag { + newObj := &otg.PatternFlowMplsTimeToLiveMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowMplsTimeToLiveMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowMplsTimeToLiveMetricTagSlice = append(obj.patternFlowMplsTimeToLiveMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) Append(items ...PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowMplsTimeToLiveMetricTagSlice = append(obj.patternFlowMplsTimeToLiveMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) Set(index int, newObj PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowMplsTimeToLiveMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) Clear() PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowMplsTimeToLiveMetricTag{} + obj.patternFlowMplsTimeToLiveMetricTagSlice = []PatternFlowMplsTimeToLiveMetricTag{} + } + return obj +} +func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) clearHolderSlice() PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { + if len(obj.patternFlowMplsTimeToLiveMetricTagSlice) > 0 { + obj.patternFlowMplsTimeToLiveMetricTagSlice = []PatternFlowMplsTimeToLiveMetricTag{} + } + return obj +} +func (obj *patternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter) appendHolderSlice(item PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLivePatternFlowMplsTimeToLiveMetricTagIter { + obj.patternFlowMplsTimeToLiveMetricTagSlice = append(obj.patternFlowMplsTimeToLiveMetricTagSlice, item) + return obj +} + +func (obj *patternFlowMplsTimeToLive) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsTimeToLive.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowMplsTimeToLive.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowMplsTimeToLiveMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowMplsTimeToLive) setDefault() { + var choices_set int = 0 + var choice PatternFlowMplsTimeToLiveChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowMplsTimeToLiveChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowMplsTimeToLiveChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowMplsTimeToLiveChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowMplsTimeToLiveChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowMplsTimeToLiveChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowMplsTimeToLive") + } + } else { + intVal := otg.PatternFlowMplsTimeToLive_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowMplsTimeToLive_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_mpls_time_to_live_counter.go b/gosnappi/pattern_flow_mpls_time_to_live_counter.go new file mode 100644 index 00000000..e54e1ddf --- /dev/null +++ b/gosnappi/pattern_flow_mpls_time_to_live_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowMplsTimeToLiveCounter ***** +type patternFlowMplsTimeToLiveCounter struct { + validation + obj *otg.PatternFlowMplsTimeToLiveCounter + marshaller marshalPatternFlowMplsTimeToLiveCounter + unMarshaller unMarshalPatternFlowMplsTimeToLiveCounter +} + +func NewPatternFlowMplsTimeToLiveCounter() PatternFlowMplsTimeToLiveCounter { + obj := patternFlowMplsTimeToLiveCounter{obj: &otg.PatternFlowMplsTimeToLiveCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowMplsTimeToLiveCounter) msg() *otg.PatternFlowMplsTimeToLiveCounter { + return obj.obj +} + +func (obj *patternFlowMplsTimeToLiveCounter) setMsg(msg *otg.PatternFlowMplsTimeToLiveCounter) PatternFlowMplsTimeToLiveCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowMplsTimeToLiveCounter struct { + obj *patternFlowMplsTimeToLiveCounter +} + +type marshalPatternFlowMplsTimeToLiveCounter interface { + // ToProto marshals PatternFlowMplsTimeToLiveCounter to protobuf object *otg.PatternFlowMplsTimeToLiveCounter + ToProto() (*otg.PatternFlowMplsTimeToLiveCounter, error) + // ToPbText marshals PatternFlowMplsTimeToLiveCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowMplsTimeToLiveCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowMplsTimeToLiveCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowMplsTimeToLiveCounter struct { + obj *patternFlowMplsTimeToLiveCounter +} + +type unMarshalPatternFlowMplsTimeToLiveCounter interface { + // FromProto unmarshals PatternFlowMplsTimeToLiveCounter from protobuf object *otg.PatternFlowMplsTimeToLiveCounter + FromProto(msg *otg.PatternFlowMplsTimeToLiveCounter) (PatternFlowMplsTimeToLiveCounter, error) + // FromPbText unmarshals PatternFlowMplsTimeToLiveCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowMplsTimeToLiveCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowMplsTimeToLiveCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowMplsTimeToLiveCounter) Marshal() marshalPatternFlowMplsTimeToLiveCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowMplsTimeToLiveCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowMplsTimeToLiveCounter) Unmarshal() unMarshalPatternFlowMplsTimeToLiveCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowMplsTimeToLiveCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowMplsTimeToLiveCounter) ToProto() (*otg.PatternFlowMplsTimeToLiveCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowMplsTimeToLiveCounter) FromProto(msg *otg.PatternFlowMplsTimeToLiveCounter) (PatternFlowMplsTimeToLiveCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowMplsTimeToLiveCounter) 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 *unMarshalpatternFlowMplsTimeToLiveCounter) 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 *marshalpatternFlowMplsTimeToLiveCounter) 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 *unMarshalpatternFlowMplsTimeToLiveCounter) 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 *marshalpatternFlowMplsTimeToLiveCounter) 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 *unMarshalpatternFlowMplsTimeToLiveCounter) 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 *patternFlowMplsTimeToLiveCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowMplsTimeToLiveCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowMplsTimeToLiveCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowMplsTimeToLiveCounter) Clone() (PatternFlowMplsTimeToLiveCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowMplsTimeToLiveCounter() + 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 +} + +// PatternFlowMplsTimeToLiveCounter is integer counter pattern +type PatternFlowMplsTimeToLiveCounter interface { + Validation + // msg marshals PatternFlowMplsTimeToLiveCounter to protobuf object *otg.PatternFlowMplsTimeToLiveCounter + // and doesn't set defaults + msg() *otg.PatternFlowMplsTimeToLiveCounter + // setMsg unmarshals PatternFlowMplsTimeToLiveCounter from protobuf object *otg.PatternFlowMplsTimeToLiveCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowMplsTimeToLiveCounter) PatternFlowMplsTimeToLiveCounter + // provides marshal interface + Marshal() marshalPatternFlowMplsTimeToLiveCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowMplsTimeToLiveCounter + // validate validates PatternFlowMplsTimeToLiveCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowMplsTimeToLiveCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowMplsTimeToLiveCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowMplsTimeToLiveCounter + SetStart(value uint32) PatternFlowMplsTimeToLiveCounter + // HasStart checks if Start has been set in PatternFlowMplsTimeToLiveCounter + HasStart() bool + // Step returns uint32, set in PatternFlowMplsTimeToLiveCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowMplsTimeToLiveCounter + SetStep(value uint32) PatternFlowMplsTimeToLiveCounter + // HasStep checks if Step has been set in PatternFlowMplsTimeToLiveCounter + HasStep() bool + // Count returns uint32, set in PatternFlowMplsTimeToLiveCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowMplsTimeToLiveCounter + SetCount(value uint32) PatternFlowMplsTimeToLiveCounter + // HasCount checks if Count has been set in PatternFlowMplsTimeToLiveCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowMplsTimeToLiveCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowMplsTimeToLiveCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowMplsTimeToLiveCounter object +func (obj *patternFlowMplsTimeToLiveCounter) SetStart(value uint32) PatternFlowMplsTimeToLiveCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowMplsTimeToLiveCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowMplsTimeToLiveCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowMplsTimeToLiveCounter object +func (obj *patternFlowMplsTimeToLiveCounter) SetStep(value uint32) PatternFlowMplsTimeToLiveCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowMplsTimeToLiveCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowMplsTimeToLiveCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowMplsTimeToLiveCounter object +func (obj *patternFlowMplsTimeToLiveCounter) SetCount(value uint32) PatternFlowMplsTimeToLiveCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowMplsTimeToLiveCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsTimeToLiveCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsTimeToLiveCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsTimeToLiveCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowMplsTimeToLiveCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(64) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_mpls_time_to_live_metric_tag.go b/gosnappi/pattern_flow_mpls_time_to_live_metric_tag.go new file mode 100644 index 00000000..8454f753 --- /dev/null +++ b/gosnappi/pattern_flow_mpls_time_to_live_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowMplsTimeToLiveMetricTag ***** +type patternFlowMplsTimeToLiveMetricTag struct { + validation + obj *otg.PatternFlowMplsTimeToLiveMetricTag + marshaller marshalPatternFlowMplsTimeToLiveMetricTag + unMarshaller unMarshalPatternFlowMplsTimeToLiveMetricTag +} + +func NewPatternFlowMplsTimeToLiveMetricTag() PatternFlowMplsTimeToLiveMetricTag { + obj := patternFlowMplsTimeToLiveMetricTag{obj: &otg.PatternFlowMplsTimeToLiveMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowMplsTimeToLiveMetricTag) msg() *otg.PatternFlowMplsTimeToLiveMetricTag { + return obj.obj +} + +func (obj *patternFlowMplsTimeToLiveMetricTag) setMsg(msg *otg.PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLiveMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowMplsTimeToLiveMetricTag struct { + obj *patternFlowMplsTimeToLiveMetricTag +} + +type marshalPatternFlowMplsTimeToLiveMetricTag interface { + // ToProto marshals PatternFlowMplsTimeToLiveMetricTag to protobuf object *otg.PatternFlowMplsTimeToLiveMetricTag + ToProto() (*otg.PatternFlowMplsTimeToLiveMetricTag, error) + // ToPbText marshals PatternFlowMplsTimeToLiveMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowMplsTimeToLiveMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowMplsTimeToLiveMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowMplsTimeToLiveMetricTag struct { + obj *patternFlowMplsTimeToLiveMetricTag +} + +type unMarshalPatternFlowMplsTimeToLiveMetricTag interface { + // FromProto unmarshals PatternFlowMplsTimeToLiveMetricTag from protobuf object *otg.PatternFlowMplsTimeToLiveMetricTag + FromProto(msg *otg.PatternFlowMplsTimeToLiveMetricTag) (PatternFlowMplsTimeToLiveMetricTag, error) + // FromPbText unmarshals PatternFlowMplsTimeToLiveMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowMplsTimeToLiveMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowMplsTimeToLiveMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowMplsTimeToLiveMetricTag) Marshal() marshalPatternFlowMplsTimeToLiveMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowMplsTimeToLiveMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowMplsTimeToLiveMetricTag) Unmarshal() unMarshalPatternFlowMplsTimeToLiveMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowMplsTimeToLiveMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowMplsTimeToLiveMetricTag) ToProto() (*otg.PatternFlowMplsTimeToLiveMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowMplsTimeToLiveMetricTag) FromProto(msg *otg.PatternFlowMplsTimeToLiveMetricTag) (PatternFlowMplsTimeToLiveMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowMplsTimeToLiveMetricTag) 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 *unMarshalpatternFlowMplsTimeToLiveMetricTag) 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 *marshalpatternFlowMplsTimeToLiveMetricTag) 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 *unMarshalpatternFlowMplsTimeToLiveMetricTag) 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 *marshalpatternFlowMplsTimeToLiveMetricTag) 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 *unMarshalpatternFlowMplsTimeToLiveMetricTag) 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 *patternFlowMplsTimeToLiveMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowMplsTimeToLiveMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowMplsTimeToLiveMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowMplsTimeToLiveMetricTag) Clone() (PatternFlowMplsTimeToLiveMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowMplsTimeToLiveMetricTag() + 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 +} + +// PatternFlowMplsTimeToLiveMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowMplsTimeToLiveMetricTag interface { + Validation + // msg marshals PatternFlowMplsTimeToLiveMetricTag to protobuf object *otg.PatternFlowMplsTimeToLiveMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowMplsTimeToLiveMetricTag + // setMsg unmarshals PatternFlowMplsTimeToLiveMetricTag from protobuf object *otg.PatternFlowMplsTimeToLiveMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowMplsTimeToLiveMetricTag) PatternFlowMplsTimeToLiveMetricTag + // provides marshal interface + Marshal() marshalPatternFlowMplsTimeToLiveMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowMplsTimeToLiveMetricTag + // validate validates PatternFlowMplsTimeToLiveMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowMplsTimeToLiveMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowMplsTimeToLiveMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowMplsTimeToLiveMetricTag + SetName(value string) PatternFlowMplsTimeToLiveMetricTag + // Offset returns uint32, set in PatternFlowMplsTimeToLiveMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowMplsTimeToLiveMetricTag + SetOffset(value uint32) PatternFlowMplsTimeToLiveMetricTag + // HasOffset checks if Offset has been set in PatternFlowMplsTimeToLiveMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowMplsTimeToLiveMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowMplsTimeToLiveMetricTag + SetLength(value uint32) PatternFlowMplsTimeToLiveMetricTag + // HasLength checks if Length has been set in PatternFlowMplsTimeToLiveMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowMplsTimeToLiveMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowMplsTimeToLiveMetricTag object +func (obj *patternFlowMplsTimeToLiveMetricTag) SetName(value string) PatternFlowMplsTimeToLiveMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowMplsTimeToLiveMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowMplsTimeToLiveMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowMplsTimeToLiveMetricTag object +func (obj *patternFlowMplsTimeToLiveMetricTag) SetOffset(value uint32) PatternFlowMplsTimeToLiveMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowMplsTimeToLiveMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowMplsTimeToLiveMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowMplsTimeToLiveMetricTag object +func (obj *patternFlowMplsTimeToLiveMetricTag) SetLength(value uint32) PatternFlowMplsTimeToLiveMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowMplsTimeToLiveMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowMplsTimeToLiveMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsTimeToLiveMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowMplsTimeToLiveMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowMplsTimeToLiveMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_mpls_traffic_class.go b/gosnappi/pattern_flow_mpls_traffic_class.go new file mode 100644 index 00000000..7e4046fb --- /dev/null +++ b/gosnappi/pattern_flow_mpls_traffic_class.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowMplsTrafficClass ***** +type patternFlowMplsTrafficClass struct { + validation + obj *otg.PatternFlowMplsTrafficClass + marshaller marshalPatternFlowMplsTrafficClass + unMarshaller unMarshalPatternFlowMplsTrafficClass + incrementHolder PatternFlowMplsTrafficClassCounter + decrementHolder PatternFlowMplsTrafficClassCounter + metricTagsHolder PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter +} + +func NewPatternFlowMplsTrafficClass() PatternFlowMplsTrafficClass { + obj := patternFlowMplsTrafficClass{obj: &otg.PatternFlowMplsTrafficClass{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowMplsTrafficClass) msg() *otg.PatternFlowMplsTrafficClass { + return obj.obj +} + +func (obj *patternFlowMplsTrafficClass) setMsg(msg *otg.PatternFlowMplsTrafficClass) PatternFlowMplsTrafficClass { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowMplsTrafficClass struct { + obj *patternFlowMplsTrafficClass +} + +type marshalPatternFlowMplsTrafficClass interface { + // ToProto marshals PatternFlowMplsTrafficClass to protobuf object *otg.PatternFlowMplsTrafficClass + ToProto() (*otg.PatternFlowMplsTrafficClass, error) + // ToPbText marshals PatternFlowMplsTrafficClass to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowMplsTrafficClass to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowMplsTrafficClass to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowMplsTrafficClass struct { + obj *patternFlowMplsTrafficClass +} + +type unMarshalPatternFlowMplsTrafficClass interface { + // FromProto unmarshals PatternFlowMplsTrafficClass from protobuf object *otg.PatternFlowMplsTrafficClass + FromProto(msg *otg.PatternFlowMplsTrafficClass) (PatternFlowMplsTrafficClass, error) + // FromPbText unmarshals PatternFlowMplsTrafficClass from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowMplsTrafficClass from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowMplsTrafficClass from JSON text + FromJson(value string) error +} + +func (obj *patternFlowMplsTrafficClass) Marshal() marshalPatternFlowMplsTrafficClass { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowMplsTrafficClass{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowMplsTrafficClass) Unmarshal() unMarshalPatternFlowMplsTrafficClass { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowMplsTrafficClass{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowMplsTrafficClass) ToProto() (*otg.PatternFlowMplsTrafficClass, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowMplsTrafficClass) FromProto(msg *otg.PatternFlowMplsTrafficClass) (PatternFlowMplsTrafficClass, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowMplsTrafficClass) 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 *unMarshalpatternFlowMplsTrafficClass) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowMplsTrafficClass) 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 *unMarshalpatternFlowMplsTrafficClass) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowMplsTrafficClass) 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 *unMarshalpatternFlowMplsTrafficClass) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowMplsTrafficClass) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowMplsTrafficClass) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowMplsTrafficClass) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowMplsTrafficClass) Clone() (PatternFlowMplsTrafficClass, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowMplsTrafficClass() + 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 +} + +func (obj *patternFlowMplsTrafficClass) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowMplsTrafficClass is traffic class +type PatternFlowMplsTrafficClass interface { + Validation + // msg marshals PatternFlowMplsTrafficClass to protobuf object *otg.PatternFlowMplsTrafficClass + // and doesn't set defaults + msg() *otg.PatternFlowMplsTrafficClass + // setMsg unmarshals PatternFlowMplsTrafficClass from protobuf object *otg.PatternFlowMplsTrafficClass + // and doesn't set defaults + setMsg(*otg.PatternFlowMplsTrafficClass) PatternFlowMplsTrafficClass + // provides marshal interface + Marshal() marshalPatternFlowMplsTrafficClass + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowMplsTrafficClass + // validate validates PatternFlowMplsTrafficClass + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowMplsTrafficClass, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowMplsTrafficClassChoiceEnum, set in PatternFlowMplsTrafficClass + Choice() PatternFlowMplsTrafficClassChoiceEnum + // setChoice assigns PatternFlowMplsTrafficClassChoiceEnum provided by user to PatternFlowMplsTrafficClass + setChoice(value PatternFlowMplsTrafficClassChoiceEnum) PatternFlowMplsTrafficClass + // HasChoice checks if Choice has been set in PatternFlowMplsTrafficClass + HasChoice() bool + // Value returns uint32, set in PatternFlowMplsTrafficClass. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowMplsTrafficClass + SetValue(value uint32) PatternFlowMplsTrafficClass + // HasValue checks if Value has been set in PatternFlowMplsTrafficClass + HasValue() bool + // Values returns []uint32, set in PatternFlowMplsTrafficClass. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowMplsTrafficClass + SetValues(value []uint32) PatternFlowMplsTrafficClass + // Increment returns PatternFlowMplsTrafficClassCounter, set in PatternFlowMplsTrafficClass. + // PatternFlowMplsTrafficClassCounter is integer counter pattern + Increment() PatternFlowMplsTrafficClassCounter + // SetIncrement assigns PatternFlowMplsTrafficClassCounter provided by user to PatternFlowMplsTrafficClass. + // PatternFlowMplsTrafficClassCounter is integer counter pattern + SetIncrement(value PatternFlowMplsTrafficClassCounter) PatternFlowMplsTrafficClass + // HasIncrement checks if Increment has been set in PatternFlowMplsTrafficClass + HasIncrement() bool + // Decrement returns PatternFlowMplsTrafficClassCounter, set in PatternFlowMplsTrafficClass. + // PatternFlowMplsTrafficClassCounter is integer counter pattern + Decrement() PatternFlowMplsTrafficClassCounter + // SetDecrement assigns PatternFlowMplsTrafficClassCounter provided by user to PatternFlowMplsTrafficClass. + // PatternFlowMplsTrafficClassCounter is integer counter pattern + SetDecrement(value PatternFlowMplsTrafficClassCounter) PatternFlowMplsTrafficClass + // HasDecrement checks if Decrement has been set in PatternFlowMplsTrafficClass + HasDecrement() bool + // MetricTags returns PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIterIter, set in PatternFlowMplsTrafficClass + MetricTags() PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter + setNil() +} + +type PatternFlowMplsTrafficClassChoiceEnum string + +// Enum of Choice on PatternFlowMplsTrafficClass +var PatternFlowMplsTrafficClassChoice = struct { + VALUE PatternFlowMplsTrafficClassChoiceEnum + VALUES PatternFlowMplsTrafficClassChoiceEnum + INCREMENT PatternFlowMplsTrafficClassChoiceEnum + DECREMENT PatternFlowMplsTrafficClassChoiceEnum +}{ + VALUE: PatternFlowMplsTrafficClassChoiceEnum("value"), + VALUES: PatternFlowMplsTrafficClassChoiceEnum("values"), + INCREMENT: PatternFlowMplsTrafficClassChoiceEnum("increment"), + DECREMENT: PatternFlowMplsTrafficClassChoiceEnum("decrement"), +} + +func (obj *patternFlowMplsTrafficClass) Choice() PatternFlowMplsTrafficClassChoiceEnum { + return PatternFlowMplsTrafficClassChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowMplsTrafficClass) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowMplsTrafficClass) setChoice(value PatternFlowMplsTrafficClassChoiceEnum) PatternFlowMplsTrafficClass { + intValue, ok := otg.PatternFlowMplsTrafficClass_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowMplsTrafficClassChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowMplsTrafficClass_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowMplsTrafficClassChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowMplsTrafficClassChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowMplsTrafficClassChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowMplsTrafficClassCounter().msg() + } + + if value == PatternFlowMplsTrafficClassChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowMplsTrafficClassCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowMplsTrafficClass) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowMplsTrafficClassChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowMplsTrafficClass) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowMplsTrafficClass object +func (obj *patternFlowMplsTrafficClass) SetValue(value uint32) PatternFlowMplsTrafficClass { + obj.setChoice(PatternFlowMplsTrafficClassChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowMplsTrafficClass) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowMplsTrafficClass object +func (obj *patternFlowMplsTrafficClass) SetValues(value []uint32) PatternFlowMplsTrafficClass { + obj.setChoice(PatternFlowMplsTrafficClassChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowMplsTrafficClassCounter +func (obj *patternFlowMplsTrafficClass) Increment() PatternFlowMplsTrafficClassCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowMplsTrafficClassChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowMplsTrafficClassCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowMplsTrafficClassCounter +func (obj *patternFlowMplsTrafficClass) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowMplsTrafficClassCounter value in the PatternFlowMplsTrafficClass object +func (obj *patternFlowMplsTrafficClass) SetIncrement(value PatternFlowMplsTrafficClassCounter) PatternFlowMplsTrafficClass { + obj.setChoice(PatternFlowMplsTrafficClassChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowMplsTrafficClassCounter +func (obj *patternFlowMplsTrafficClass) Decrement() PatternFlowMplsTrafficClassCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowMplsTrafficClassChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowMplsTrafficClassCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowMplsTrafficClassCounter +func (obj *patternFlowMplsTrafficClass) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowMplsTrafficClassCounter value in the PatternFlowMplsTrafficClass object +func (obj *patternFlowMplsTrafficClass) SetDecrement(value PatternFlowMplsTrafficClassCounter) PatternFlowMplsTrafficClass { + obj.setChoice(PatternFlowMplsTrafficClassChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowMplsTrafficClassMetricTag +func (obj *patternFlowMplsTrafficClass) MetricTags() PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowMplsTrafficClassMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter struct { + obj *patternFlowMplsTrafficClass + patternFlowMplsTrafficClassMetricTagSlice []PatternFlowMplsTrafficClassMetricTag + fieldPtr *[]*otg.PatternFlowMplsTrafficClassMetricTag +} + +func newPatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter(ptr *[]*otg.PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { + return &patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter interface { + setMsg(*patternFlowMplsTrafficClass) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter + Items() []PatternFlowMplsTrafficClassMetricTag + Add() PatternFlowMplsTrafficClassMetricTag + Append(items ...PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter + Set(index int, newObj PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter + Clear() PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter + clearHolderSlice() PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter + appendHolderSlice(item PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter +} + +func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) setMsg(msg *patternFlowMplsTrafficClass) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowMplsTrafficClassMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) Items() []PatternFlowMplsTrafficClassMetricTag { + return obj.patternFlowMplsTrafficClassMetricTagSlice +} + +func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) Add() PatternFlowMplsTrafficClassMetricTag { + newObj := &otg.PatternFlowMplsTrafficClassMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowMplsTrafficClassMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowMplsTrafficClassMetricTagSlice = append(obj.patternFlowMplsTrafficClassMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) Append(items ...PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowMplsTrafficClassMetricTagSlice = append(obj.patternFlowMplsTrafficClassMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) Set(index int, newObj PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowMplsTrafficClassMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) Clear() PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowMplsTrafficClassMetricTag{} + obj.patternFlowMplsTrafficClassMetricTagSlice = []PatternFlowMplsTrafficClassMetricTag{} + } + return obj +} +func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) clearHolderSlice() PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { + if len(obj.patternFlowMplsTrafficClassMetricTagSlice) > 0 { + obj.patternFlowMplsTrafficClassMetricTagSlice = []PatternFlowMplsTrafficClassMetricTag{} + } + return obj +} +func (obj *patternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter) appendHolderSlice(item PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassPatternFlowMplsTrafficClassMetricTagIter { + obj.patternFlowMplsTrafficClassMetricTagSlice = append(obj.patternFlowMplsTrafficClassMetricTagSlice, item) + return obj +} + +func (obj *patternFlowMplsTrafficClass) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsTrafficClass.Value <= 7 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowMplsTrafficClass.Values <= 7 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowMplsTrafficClassMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowMplsTrafficClass) setDefault() { + var choices_set int = 0 + var choice PatternFlowMplsTrafficClassChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowMplsTrafficClassChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowMplsTrafficClassChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowMplsTrafficClassChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowMplsTrafficClassChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowMplsTrafficClassChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowMplsTrafficClass") + } + } else { + intVal := otg.PatternFlowMplsTrafficClass_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowMplsTrafficClass_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_mpls_traffic_class_counter.go b/gosnappi/pattern_flow_mpls_traffic_class_counter.go new file mode 100644 index 00000000..5266e3ab --- /dev/null +++ b/gosnappi/pattern_flow_mpls_traffic_class_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowMplsTrafficClassCounter ***** +type patternFlowMplsTrafficClassCounter struct { + validation + obj *otg.PatternFlowMplsTrafficClassCounter + marshaller marshalPatternFlowMplsTrafficClassCounter + unMarshaller unMarshalPatternFlowMplsTrafficClassCounter +} + +func NewPatternFlowMplsTrafficClassCounter() PatternFlowMplsTrafficClassCounter { + obj := patternFlowMplsTrafficClassCounter{obj: &otg.PatternFlowMplsTrafficClassCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowMplsTrafficClassCounter) msg() *otg.PatternFlowMplsTrafficClassCounter { + return obj.obj +} + +func (obj *patternFlowMplsTrafficClassCounter) setMsg(msg *otg.PatternFlowMplsTrafficClassCounter) PatternFlowMplsTrafficClassCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowMplsTrafficClassCounter struct { + obj *patternFlowMplsTrafficClassCounter +} + +type marshalPatternFlowMplsTrafficClassCounter interface { + // ToProto marshals PatternFlowMplsTrafficClassCounter to protobuf object *otg.PatternFlowMplsTrafficClassCounter + ToProto() (*otg.PatternFlowMplsTrafficClassCounter, error) + // ToPbText marshals PatternFlowMplsTrafficClassCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowMplsTrafficClassCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowMplsTrafficClassCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowMplsTrafficClassCounter struct { + obj *patternFlowMplsTrafficClassCounter +} + +type unMarshalPatternFlowMplsTrafficClassCounter interface { + // FromProto unmarshals PatternFlowMplsTrafficClassCounter from protobuf object *otg.PatternFlowMplsTrafficClassCounter + FromProto(msg *otg.PatternFlowMplsTrafficClassCounter) (PatternFlowMplsTrafficClassCounter, error) + // FromPbText unmarshals PatternFlowMplsTrafficClassCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowMplsTrafficClassCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowMplsTrafficClassCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowMplsTrafficClassCounter) Marshal() marshalPatternFlowMplsTrafficClassCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowMplsTrafficClassCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowMplsTrafficClassCounter) Unmarshal() unMarshalPatternFlowMplsTrafficClassCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowMplsTrafficClassCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowMplsTrafficClassCounter) ToProto() (*otg.PatternFlowMplsTrafficClassCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowMplsTrafficClassCounter) FromProto(msg *otg.PatternFlowMplsTrafficClassCounter) (PatternFlowMplsTrafficClassCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowMplsTrafficClassCounter) 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 *unMarshalpatternFlowMplsTrafficClassCounter) 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 *marshalpatternFlowMplsTrafficClassCounter) 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 *unMarshalpatternFlowMplsTrafficClassCounter) 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 *marshalpatternFlowMplsTrafficClassCounter) 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 *unMarshalpatternFlowMplsTrafficClassCounter) 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 *patternFlowMplsTrafficClassCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowMplsTrafficClassCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowMplsTrafficClassCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowMplsTrafficClassCounter) Clone() (PatternFlowMplsTrafficClassCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowMplsTrafficClassCounter() + 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 +} + +// PatternFlowMplsTrafficClassCounter is integer counter pattern +type PatternFlowMplsTrafficClassCounter interface { + Validation + // msg marshals PatternFlowMplsTrafficClassCounter to protobuf object *otg.PatternFlowMplsTrafficClassCounter + // and doesn't set defaults + msg() *otg.PatternFlowMplsTrafficClassCounter + // setMsg unmarshals PatternFlowMplsTrafficClassCounter from protobuf object *otg.PatternFlowMplsTrafficClassCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowMplsTrafficClassCounter) PatternFlowMplsTrafficClassCounter + // provides marshal interface + Marshal() marshalPatternFlowMplsTrafficClassCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowMplsTrafficClassCounter + // validate validates PatternFlowMplsTrafficClassCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowMplsTrafficClassCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowMplsTrafficClassCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowMplsTrafficClassCounter + SetStart(value uint32) PatternFlowMplsTrafficClassCounter + // HasStart checks if Start has been set in PatternFlowMplsTrafficClassCounter + HasStart() bool + // Step returns uint32, set in PatternFlowMplsTrafficClassCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowMplsTrafficClassCounter + SetStep(value uint32) PatternFlowMplsTrafficClassCounter + // HasStep checks if Step has been set in PatternFlowMplsTrafficClassCounter + HasStep() bool + // Count returns uint32, set in PatternFlowMplsTrafficClassCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowMplsTrafficClassCounter + SetCount(value uint32) PatternFlowMplsTrafficClassCounter + // HasCount checks if Count has been set in PatternFlowMplsTrafficClassCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowMplsTrafficClassCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowMplsTrafficClassCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowMplsTrafficClassCounter object +func (obj *patternFlowMplsTrafficClassCounter) SetStart(value uint32) PatternFlowMplsTrafficClassCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowMplsTrafficClassCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowMplsTrafficClassCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowMplsTrafficClassCounter object +func (obj *patternFlowMplsTrafficClassCounter) SetStep(value uint32) PatternFlowMplsTrafficClassCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowMplsTrafficClassCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowMplsTrafficClassCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowMplsTrafficClassCounter object +func (obj *patternFlowMplsTrafficClassCounter) SetCount(value uint32) PatternFlowMplsTrafficClassCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowMplsTrafficClassCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsTrafficClassCounter.Start <= 7 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsTrafficClassCounter.Step <= 7 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsTrafficClassCounter.Count <= 7 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowMplsTrafficClassCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_mpls_traffic_class_metric_tag.go b/gosnappi/pattern_flow_mpls_traffic_class_metric_tag.go new file mode 100644 index 00000000..f0b1cc09 --- /dev/null +++ b/gosnappi/pattern_flow_mpls_traffic_class_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowMplsTrafficClassMetricTag ***** +type patternFlowMplsTrafficClassMetricTag struct { + validation + obj *otg.PatternFlowMplsTrafficClassMetricTag + marshaller marshalPatternFlowMplsTrafficClassMetricTag + unMarshaller unMarshalPatternFlowMplsTrafficClassMetricTag +} + +func NewPatternFlowMplsTrafficClassMetricTag() PatternFlowMplsTrafficClassMetricTag { + obj := patternFlowMplsTrafficClassMetricTag{obj: &otg.PatternFlowMplsTrafficClassMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowMplsTrafficClassMetricTag) msg() *otg.PatternFlowMplsTrafficClassMetricTag { + return obj.obj +} + +func (obj *patternFlowMplsTrafficClassMetricTag) setMsg(msg *otg.PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowMplsTrafficClassMetricTag struct { + obj *patternFlowMplsTrafficClassMetricTag +} + +type marshalPatternFlowMplsTrafficClassMetricTag interface { + // ToProto marshals PatternFlowMplsTrafficClassMetricTag to protobuf object *otg.PatternFlowMplsTrafficClassMetricTag + ToProto() (*otg.PatternFlowMplsTrafficClassMetricTag, error) + // ToPbText marshals PatternFlowMplsTrafficClassMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowMplsTrafficClassMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowMplsTrafficClassMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowMplsTrafficClassMetricTag struct { + obj *patternFlowMplsTrafficClassMetricTag +} + +type unMarshalPatternFlowMplsTrafficClassMetricTag interface { + // FromProto unmarshals PatternFlowMplsTrafficClassMetricTag from protobuf object *otg.PatternFlowMplsTrafficClassMetricTag + FromProto(msg *otg.PatternFlowMplsTrafficClassMetricTag) (PatternFlowMplsTrafficClassMetricTag, error) + // FromPbText unmarshals PatternFlowMplsTrafficClassMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowMplsTrafficClassMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowMplsTrafficClassMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowMplsTrafficClassMetricTag) Marshal() marshalPatternFlowMplsTrafficClassMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowMplsTrafficClassMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowMplsTrafficClassMetricTag) Unmarshal() unMarshalPatternFlowMplsTrafficClassMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowMplsTrafficClassMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowMplsTrafficClassMetricTag) ToProto() (*otg.PatternFlowMplsTrafficClassMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowMplsTrafficClassMetricTag) FromProto(msg *otg.PatternFlowMplsTrafficClassMetricTag) (PatternFlowMplsTrafficClassMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowMplsTrafficClassMetricTag) 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 *unMarshalpatternFlowMplsTrafficClassMetricTag) 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 *marshalpatternFlowMplsTrafficClassMetricTag) 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 *unMarshalpatternFlowMplsTrafficClassMetricTag) 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 *marshalpatternFlowMplsTrafficClassMetricTag) 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 *unMarshalpatternFlowMplsTrafficClassMetricTag) 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 *patternFlowMplsTrafficClassMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowMplsTrafficClassMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowMplsTrafficClassMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowMplsTrafficClassMetricTag) Clone() (PatternFlowMplsTrafficClassMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowMplsTrafficClassMetricTag() + 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 +} + +// PatternFlowMplsTrafficClassMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowMplsTrafficClassMetricTag interface { + Validation + // msg marshals PatternFlowMplsTrafficClassMetricTag to protobuf object *otg.PatternFlowMplsTrafficClassMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowMplsTrafficClassMetricTag + // setMsg unmarshals PatternFlowMplsTrafficClassMetricTag from protobuf object *otg.PatternFlowMplsTrafficClassMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowMplsTrafficClassMetricTag) PatternFlowMplsTrafficClassMetricTag + // provides marshal interface + Marshal() marshalPatternFlowMplsTrafficClassMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowMplsTrafficClassMetricTag + // validate validates PatternFlowMplsTrafficClassMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowMplsTrafficClassMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowMplsTrafficClassMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowMplsTrafficClassMetricTag + SetName(value string) PatternFlowMplsTrafficClassMetricTag + // Offset returns uint32, set in PatternFlowMplsTrafficClassMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowMplsTrafficClassMetricTag + SetOffset(value uint32) PatternFlowMplsTrafficClassMetricTag + // HasOffset checks if Offset has been set in PatternFlowMplsTrafficClassMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowMplsTrafficClassMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowMplsTrafficClassMetricTag + SetLength(value uint32) PatternFlowMplsTrafficClassMetricTag + // HasLength checks if Length has been set in PatternFlowMplsTrafficClassMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowMplsTrafficClassMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowMplsTrafficClassMetricTag object +func (obj *patternFlowMplsTrafficClassMetricTag) SetName(value string) PatternFlowMplsTrafficClassMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowMplsTrafficClassMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowMplsTrafficClassMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowMplsTrafficClassMetricTag object +func (obj *patternFlowMplsTrafficClassMetricTag) SetOffset(value uint32) PatternFlowMplsTrafficClassMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowMplsTrafficClassMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowMplsTrafficClassMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowMplsTrafficClassMetricTag object +func (obj *patternFlowMplsTrafficClassMetricTag) SetLength(value uint32) PatternFlowMplsTrafficClassMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowMplsTrafficClassMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowMplsTrafficClassMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 2 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowMplsTrafficClassMetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowMplsTrafficClassMetricTag.Length <= 3 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowMplsTrafficClassMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(3) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_class_enable_vector.go b/gosnappi/pattern_flow_pfc_pause_class_enable_vector.go new file mode 100644 index 00000000..8efb459b --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_class_enable_vector.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowPfcPauseClassEnableVector ***** +type patternFlowPfcPauseClassEnableVector struct { + validation + obj *otg.PatternFlowPfcPauseClassEnableVector + marshaller marshalPatternFlowPfcPauseClassEnableVector + unMarshaller unMarshalPatternFlowPfcPauseClassEnableVector + incrementHolder PatternFlowPfcPauseClassEnableVectorCounter + decrementHolder PatternFlowPfcPauseClassEnableVectorCounter + metricTagsHolder PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter +} + +func NewPatternFlowPfcPauseClassEnableVector() PatternFlowPfcPauseClassEnableVector { + obj := patternFlowPfcPauseClassEnableVector{obj: &otg.PatternFlowPfcPauseClassEnableVector{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseClassEnableVector) msg() *otg.PatternFlowPfcPauseClassEnableVector { + return obj.obj +} + +func (obj *patternFlowPfcPauseClassEnableVector) setMsg(msg *otg.PatternFlowPfcPauseClassEnableVector) PatternFlowPfcPauseClassEnableVector { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseClassEnableVector struct { + obj *patternFlowPfcPauseClassEnableVector +} + +type marshalPatternFlowPfcPauseClassEnableVector interface { + // ToProto marshals PatternFlowPfcPauseClassEnableVector to protobuf object *otg.PatternFlowPfcPauseClassEnableVector + ToProto() (*otg.PatternFlowPfcPauseClassEnableVector, error) + // ToPbText marshals PatternFlowPfcPauseClassEnableVector to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseClassEnableVector to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseClassEnableVector to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseClassEnableVector struct { + obj *patternFlowPfcPauseClassEnableVector +} + +type unMarshalPatternFlowPfcPauseClassEnableVector interface { + // FromProto unmarshals PatternFlowPfcPauseClassEnableVector from protobuf object *otg.PatternFlowPfcPauseClassEnableVector + FromProto(msg *otg.PatternFlowPfcPauseClassEnableVector) (PatternFlowPfcPauseClassEnableVector, error) + // FromPbText unmarshals PatternFlowPfcPauseClassEnableVector from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseClassEnableVector from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseClassEnableVector from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseClassEnableVector) Marshal() marshalPatternFlowPfcPauseClassEnableVector { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseClassEnableVector{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseClassEnableVector) Unmarshal() unMarshalPatternFlowPfcPauseClassEnableVector { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseClassEnableVector{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseClassEnableVector) ToProto() (*otg.PatternFlowPfcPauseClassEnableVector, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseClassEnableVector) FromProto(msg *otg.PatternFlowPfcPauseClassEnableVector) (PatternFlowPfcPauseClassEnableVector, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseClassEnableVector) 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 *unMarshalpatternFlowPfcPauseClassEnableVector) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPfcPauseClassEnableVector) 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 *unMarshalpatternFlowPfcPauseClassEnableVector) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPfcPauseClassEnableVector) 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 *unMarshalpatternFlowPfcPauseClassEnableVector) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPfcPauseClassEnableVector) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseClassEnableVector) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseClassEnableVector) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseClassEnableVector) Clone() (PatternFlowPfcPauseClassEnableVector, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseClassEnableVector() + 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 +} + +func (obj *patternFlowPfcPauseClassEnableVector) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPfcPauseClassEnableVector is destination +type PatternFlowPfcPauseClassEnableVector interface { + Validation + // msg marshals PatternFlowPfcPauseClassEnableVector to protobuf object *otg.PatternFlowPfcPauseClassEnableVector + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseClassEnableVector + // setMsg unmarshals PatternFlowPfcPauseClassEnableVector from protobuf object *otg.PatternFlowPfcPauseClassEnableVector + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseClassEnableVector) PatternFlowPfcPauseClassEnableVector + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseClassEnableVector + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseClassEnableVector + // validate validates PatternFlowPfcPauseClassEnableVector + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseClassEnableVector, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPfcPauseClassEnableVectorChoiceEnum, set in PatternFlowPfcPauseClassEnableVector + Choice() PatternFlowPfcPauseClassEnableVectorChoiceEnum + // setChoice assigns PatternFlowPfcPauseClassEnableVectorChoiceEnum provided by user to PatternFlowPfcPauseClassEnableVector + setChoice(value PatternFlowPfcPauseClassEnableVectorChoiceEnum) PatternFlowPfcPauseClassEnableVector + // HasChoice checks if Choice has been set in PatternFlowPfcPauseClassEnableVector + HasChoice() bool + // Value returns uint32, set in PatternFlowPfcPauseClassEnableVector. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowPfcPauseClassEnableVector + SetValue(value uint32) PatternFlowPfcPauseClassEnableVector + // HasValue checks if Value has been set in PatternFlowPfcPauseClassEnableVector + HasValue() bool + // Values returns []uint32, set in PatternFlowPfcPauseClassEnableVector. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowPfcPauseClassEnableVector + SetValues(value []uint32) PatternFlowPfcPauseClassEnableVector + // Increment returns PatternFlowPfcPauseClassEnableVectorCounter, set in PatternFlowPfcPauseClassEnableVector. + // PatternFlowPfcPauseClassEnableVectorCounter is integer counter pattern + Increment() PatternFlowPfcPauseClassEnableVectorCounter + // SetIncrement assigns PatternFlowPfcPauseClassEnableVectorCounter provided by user to PatternFlowPfcPauseClassEnableVector. + // PatternFlowPfcPauseClassEnableVectorCounter is integer counter pattern + SetIncrement(value PatternFlowPfcPauseClassEnableVectorCounter) PatternFlowPfcPauseClassEnableVector + // HasIncrement checks if Increment has been set in PatternFlowPfcPauseClassEnableVector + HasIncrement() bool + // Decrement returns PatternFlowPfcPauseClassEnableVectorCounter, set in PatternFlowPfcPauseClassEnableVector. + // PatternFlowPfcPauseClassEnableVectorCounter is integer counter pattern + Decrement() PatternFlowPfcPauseClassEnableVectorCounter + // SetDecrement assigns PatternFlowPfcPauseClassEnableVectorCounter provided by user to PatternFlowPfcPauseClassEnableVector. + // PatternFlowPfcPauseClassEnableVectorCounter is integer counter pattern + SetDecrement(value PatternFlowPfcPauseClassEnableVectorCounter) PatternFlowPfcPauseClassEnableVector + // HasDecrement checks if Decrement has been set in PatternFlowPfcPauseClassEnableVector + HasDecrement() bool + // MetricTags returns PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIterIter, set in PatternFlowPfcPauseClassEnableVector + MetricTags() PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter + setNil() +} + +type PatternFlowPfcPauseClassEnableVectorChoiceEnum string + +// Enum of Choice on PatternFlowPfcPauseClassEnableVector +var PatternFlowPfcPauseClassEnableVectorChoice = struct { + VALUE PatternFlowPfcPauseClassEnableVectorChoiceEnum + VALUES PatternFlowPfcPauseClassEnableVectorChoiceEnum + INCREMENT PatternFlowPfcPauseClassEnableVectorChoiceEnum + DECREMENT PatternFlowPfcPauseClassEnableVectorChoiceEnum +}{ + VALUE: PatternFlowPfcPauseClassEnableVectorChoiceEnum("value"), + VALUES: PatternFlowPfcPauseClassEnableVectorChoiceEnum("values"), + INCREMENT: PatternFlowPfcPauseClassEnableVectorChoiceEnum("increment"), + DECREMENT: PatternFlowPfcPauseClassEnableVectorChoiceEnum("decrement"), +} + +func (obj *patternFlowPfcPauseClassEnableVector) Choice() PatternFlowPfcPauseClassEnableVectorChoiceEnum { + return PatternFlowPfcPauseClassEnableVectorChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPfcPauseClassEnableVector) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPfcPauseClassEnableVector) setChoice(value PatternFlowPfcPauseClassEnableVectorChoiceEnum) PatternFlowPfcPauseClassEnableVector { + intValue, ok := otg.PatternFlowPfcPauseClassEnableVector_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPfcPauseClassEnableVectorChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPfcPauseClassEnableVector_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPfcPauseClassEnableVectorChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPfcPauseClassEnableVectorChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPfcPauseClassEnableVectorChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowPfcPauseClassEnableVectorCounter().msg() + } + + if value == PatternFlowPfcPauseClassEnableVectorChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPfcPauseClassEnableVectorCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPauseClassEnableVector) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPauseClassEnableVector) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowPfcPauseClassEnableVector object +func (obj *patternFlowPfcPauseClassEnableVector) SetValue(value uint32) PatternFlowPfcPauseClassEnableVector { + obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowPfcPauseClassEnableVector) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowPfcPauseClassEnableVector object +func (obj *patternFlowPfcPauseClassEnableVector) SetValues(value []uint32) PatternFlowPfcPauseClassEnableVector { + obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPfcPauseClassEnableVectorCounter +func (obj *patternFlowPfcPauseClassEnableVector) Increment() PatternFlowPfcPauseClassEnableVectorCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPfcPauseClassEnableVectorCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPfcPauseClassEnableVectorCounter +func (obj *patternFlowPfcPauseClassEnableVector) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPfcPauseClassEnableVectorCounter value in the PatternFlowPfcPauseClassEnableVector object +func (obj *patternFlowPfcPauseClassEnableVector) SetIncrement(value PatternFlowPfcPauseClassEnableVectorCounter) PatternFlowPfcPauseClassEnableVector { + obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPfcPauseClassEnableVectorCounter +func (obj *patternFlowPfcPauseClassEnableVector) Decrement() PatternFlowPfcPauseClassEnableVectorCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPfcPauseClassEnableVectorCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPfcPauseClassEnableVectorCounter +func (obj *patternFlowPfcPauseClassEnableVector) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPfcPauseClassEnableVectorCounter value in the PatternFlowPfcPauseClassEnableVector object +func (obj *patternFlowPfcPauseClassEnableVector) SetDecrement(value PatternFlowPfcPauseClassEnableVectorCounter) PatternFlowPfcPauseClassEnableVector { + obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPfcPauseClassEnableVectorMetricTag +func (obj *patternFlowPfcPauseClassEnableVector) MetricTags() PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPfcPauseClassEnableVectorMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter struct { + obj *patternFlowPfcPauseClassEnableVector + patternFlowPfcPauseClassEnableVectorMetricTagSlice []PatternFlowPfcPauseClassEnableVectorMetricTag + fieldPtr *[]*otg.PatternFlowPfcPauseClassEnableVectorMetricTag +} + +func newPatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter(ptr *[]*otg.PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { + return &patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter interface { + setMsg(*patternFlowPfcPauseClassEnableVector) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter + Items() []PatternFlowPfcPauseClassEnableVectorMetricTag + Add() PatternFlowPfcPauseClassEnableVectorMetricTag + Append(items ...PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter + Set(index int, newObj PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter + Clear() PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter + clearHolderSlice() PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter + appendHolderSlice(item PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter +} + +func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) setMsg(msg *patternFlowPfcPauseClassEnableVector) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPfcPauseClassEnableVectorMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) Items() []PatternFlowPfcPauseClassEnableVectorMetricTag { + return obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice +} + +func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) Add() PatternFlowPfcPauseClassEnableVectorMetricTag { + newObj := &otg.PatternFlowPfcPauseClassEnableVectorMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPfcPauseClassEnableVectorMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice = append(obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) Append(items ...PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice = append(obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) Set(index int, newObj PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) Clear() PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPfcPauseClassEnableVectorMetricTag{} + obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice = []PatternFlowPfcPauseClassEnableVectorMetricTag{} + } + return obj +} +func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) clearHolderSlice() PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { + if len(obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice) > 0 { + obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice = []PatternFlowPfcPauseClassEnableVectorMetricTag{} + } + return obj +} +func (obj *patternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter) appendHolderSlice(item PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorPatternFlowPfcPauseClassEnableVectorMetricTagIter { + obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice = append(obj.patternFlowPfcPauseClassEnableVectorMetricTagSlice, item) + return obj +} + +func (obj *patternFlowPfcPauseClassEnableVector) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseClassEnableVector.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowPfcPauseClassEnableVector.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPfcPauseClassEnableVectorMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPfcPauseClassEnableVector) setDefault() { + var choices_set int = 0 + var choice PatternFlowPfcPauseClassEnableVectorChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPfcPauseClassEnableVectorChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPfcPauseClassEnableVectorChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPfcPauseClassEnableVectorChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPfcPauseClassEnableVectorChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPfcPauseClassEnableVectorChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPauseClassEnableVector") + } + } else { + intVal := otg.PatternFlowPfcPauseClassEnableVector_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPfcPauseClassEnableVector_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_class_enable_vector_counter.go b/gosnappi/pattern_flow_pfc_pause_class_enable_vector_counter.go new file mode 100644 index 00000000..f9728e5d --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_class_enable_vector_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowPfcPauseClassEnableVectorCounter ***** +type patternFlowPfcPauseClassEnableVectorCounter struct { + validation + obj *otg.PatternFlowPfcPauseClassEnableVectorCounter + marshaller marshalPatternFlowPfcPauseClassEnableVectorCounter + unMarshaller unMarshalPatternFlowPfcPauseClassEnableVectorCounter +} + +func NewPatternFlowPfcPauseClassEnableVectorCounter() PatternFlowPfcPauseClassEnableVectorCounter { + obj := patternFlowPfcPauseClassEnableVectorCounter{obj: &otg.PatternFlowPfcPauseClassEnableVectorCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseClassEnableVectorCounter) msg() *otg.PatternFlowPfcPauseClassEnableVectorCounter { + return obj.obj +} + +func (obj *patternFlowPfcPauseClassEnableVectorCounter) setMsg(msg *otg.PatternFlowPfcPauseClassEnableVectorCounter) PatternFlowPfcPauseClassEnableVectorCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseClassEnableVectorCounter struct { + obj *patternFlowPfcPauseClassEnableVectorCounter +} + +type marshalPatternFlowPfcPauseClassEnableVectorCounter interface { + // ToProto marshals PatternFlowPfcPauseClassEnableVectorCounter to protobuf object *otg.PatternFlowPfcPauseClassEnableVectorCounter + ToProto() (*otg.PatternFlowPfcPauseClassEnableVectorCounter, error) + // ToPbText marshals PatternFlowPfcPauseClassEnableVectorCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseClassEnableVectorCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseClassEnableVectorCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseClassEnableVectorCounter struct { + obj *patternFlowPfcPauseClassEnableVectorCounter +} + +type unMarshalPatternFlowPfcPauseClassEnableVectorCounter interface { + // FromProto unmarshals PatternFlowPfcPauseClassEnableVectorCounter from protobuf object *otg.PatternFlowPfcPauseClassEnableVectorCounter + FromProto(msg *otg.PatternFlowPfcPauseClassEnableVectorCounter) (PatternFlowPfcPauseClassEnableVectorCounter, error) + // FromPbText unmarshals PatternFlowPfcPauseClassEnableVectorCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseClassEnableVectorCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseClassEnableVectorCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseClassEnableVectorCounter) Marshal() marshalPatternFlowPfcPauseClassEnableVectorCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseClassEnableVectorCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseClassEnableVectorCounter) Unmarshal() unMarshalPatternFlowPfcPauseClassEnableVectorCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseClassEnableVectorCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseClassEnableVectorCounter) ToProto() (*otg.PatternFlowPfcPauseClassEnableVectorCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseClassEnableVectorCounter) FromProto(msg *otg.PatternFlowPfcPauseClassEnableVectorCounter) (PatternFlowPfcPauseClassEnableVectorCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseClassEnableVectorCounter) 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 *unMarshalpatternFlowPfcPauseClassEnableVectorCounter) 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 *marshalpatternFlowPfcPauseClassEnableVectorCounter) 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 *unMarshalpatternFlowPfcPauseClassEnableVectorCounter) 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 *marshalpatternFlowPfcPauseClassEnableVectorCounter) 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 *unMarshalpatternFlowPfcPauseClassEnableVectorCounter) 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 *patternFlowPfcPauseClassEnableVectorCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseClassEnableVectorCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseClassEnableVectorCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseClassEnableVectorCounter) Clone() (PatternFlowPfcPauseClassEnableVectorCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseClassEnableVectorCounter() + 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 +} + +// PatternFlowPfcPauseClassEnableVectorCounter is integer counter pattern +type PatternFlowPfcPauseClassEnableVectorCounter interface { + Validation + // msg marshals PatternFlowPfcPauseClassEnableVectorCounter to protobuf object *otg.PatternFlowPfcPauseClassEnableVectorCounter + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseClassEnableVectorCounter + // setMsg unmarshals PatternFlowPfcPauseClassEnableVectorCounter from protobuf object *otg.PatternFlowPfcPauseClassEnableVectorCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseClassEnableVectorCounter) PatternFlowPfcPauseClassEnableVectorCounter + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseClassEnableVectorCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseClassEnableVectorCounter + // validate validates PatternFlowPfcPauseClassEnableVectorCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseClassEnableVectorCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowPfcPauseClassEnableVectorCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowPfcPauseClassEnableVectorCounter + SetStart(value uint32) PatternFlowPfcPauseClassEnableVectorCounter + // HasStart checks if Start has been set in PatternFlowPfcPauseClassEnableVectorCounter + HasStart() bool + // Step returns uint32, set in PatternFlowPfcPauseClassEnableVectorCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowPfcPauseClassEnableVectorCounter + SetStep(value uint32) PatternFlowPfcPauseClassEnableVectorCounter + // HasStep checks if Step has been set in PatternFlowPfcPauseClassEnableVectorCounter + HasStep() bool + // Count returns uint32, set in PatternFlowPfcPauseClassEnableVectorCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPfcPauseClassEnableVectorCounter + SetCount(value uint32) PatternFlowPfcPauseClassEnableVectorCounter + // HasCount checks if Count has been set in PatternFlowPfcPauseClassEnableVectorCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPauseClassEnableVectorCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPauseClassEnableVectorCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowPfcPauseClassEnableVectorCounter object +func (obj *patternFlowPfcPauseClassEnableVectorCounter) SetStart(value uint32) PatternFlowPfcPauseClassEnableVectorCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPauseClassEnableVectorCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPauseClassEnableVectorCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowPfcPauseClassEnableVectorCounter object +func (obj *patternFlowPfcPauseClassEnableVectorCounter) SetStep(value uint32) PatternFlowPfcPauseClassEnableVectorCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPauseClassEnableVectorCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPauseClassEnableVectorCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPfcPauseClassEnableVectorCounter object +func (obj *patternFlowPfcPauseClassEnableVectorCounter) SetCount(value uint32) PatternFlowPfcPauseClassEnableVectorCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPfcPauseClassEnableVectorCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseClassEnableVectorCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseClassEnableVectorCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseClassEnableVectorCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowPfcPauseClassEnableVectorCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_class_enable_vector_metric_tag.go b/gosnappi/pattern_flow_pfc_pause_class_enable_vector_metric_tag.go new file mode 100644 index 00000000..bf458b25 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_class_enable_vector_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPfcPauseClassEnableVectorMetricTag ***** +type patternFlowPfcPauseClassEnableVectorMetricTag struct { + validation + obj *otg.PatternFlowPfcPauseClassEnableVectorMetricTag + marshaller marshalPatternFlowPfcPauseClassEnableVectorMetricTag + unMarshaller unMarshalPatternFlowPfcPauseClassEnableVectorMetricTag +} + +func NewPatternFlowPfcPauseClassEnableVectorMetricTag() PatternFlowPfcPauseClassEnableVectorMetricTag { + obj := patternFlowPfcPauseClassEnableVectorMetricTag{obj: &otg.PatternFlowPfcPauseClassEnableVectorMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) msg() *otg.PatternFlowPfcPauseClassEnableVectorMetricTag { + return obj.obj +} + +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) setMsg(msg *otg.PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseClassEnableVectorMetricTag struct { + obj *patternFlowPfcPauseClassEnableVectorMetricTag +} + +type marshalPatternFlowPfcPauseClassEnableVectorMetricTag interface { + // ToProto marshals PatternFlowPfcPauseClassEnableVectorMetricTag to protobuf object *otg.PatternFlowPfcPauseClassEnableVectorMetricTag + ToProto() (*otg.PatternFlowPfcPauseClassEnableVectorMetricTag, error) + // ToPbText marshals PatternFlowPfcPauseClassEnableVectorMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseClassEnableVectorMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseClassEnableVectorMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseClassEnableVectorMetricTag struct { + obj *patternFlowPfcPauseClassEnableVectorMetricTag +} + +type unMarshalPatternFlowPfcPauseClassEnableVectorMetricTag interface { + // FromProto unmarshals PatternFlowPfcPauseClassEnableVectorMetricTag from protobuf object *otg.PatternFlowPfcPauseClassEnableVectorMetricTag + FromProto(msg *otg.PatternFlowPfcPauseClassEnableVectorMetricTag) (PatternFlowPfcPauseClassEnableVectorMetricTag, error) + // FromPbText unmarshals PatternFlowPfcPauseClassEnableVectorMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseClassEnableVectorMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseClassEnableVectorMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) Marshal() marshalPatternFlowPfcPauseClassEnableVectorMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseClassEnableVectorMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) Unmarshal() unMarshalPatternFlowPfcPauseClassEnableVectorMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseClassEnableVectorMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseClassEnableVectorMetricTag) ToProto() (*otg.PatternFlowPfcPauseClassEnableVectorMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseClassEnableVectorMetricTag) FromProto(msg *otg.PatternFlowPfcPauseClassEnableVectorMetricTag) (PatternFlowPfcPauseClassEnableVectorMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseClassEnableVectorMetricTag) 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 *unMarshalpatternFlowPfcPauseClassEnableVectorMetricTag) 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 *marshalpatternFlowPfcPauseClassEnableVectorMetricTag) 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 *unMarshalpatternFlowPfcPauseClassEnableVectorMetricTag) 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 *marshalpatternFlowPfcPauseClassEnableVectorMetricTag) 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 *unMarshalpatternFlowPfcPauseClassEnableVectorMetricTag) 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 *patternFlowPfcPauseClassEnableVectorMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) Clone() (PatternFlowPfcPauseClassEnableVectorMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseClassEnableVectorMetricTag() + 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 +} + +// PatternFlowPfcPauseClassEnableVectorMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPfcPauseClassEnableVectorMetricTag interface { + Validation + // msg marshals PatternFlowPfcPauseClassEnableVectorMetricTag to protobuf object *otg.PatternFlowPfcPauseClassEnableVectorMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseClassEnableVectorMetricTag + // setMsg unmarshals PatternFlowPfcPauseClassEnableVectorMetricTag from protobuf object *otg.PatternFlowPfcPauseClassEnableVectorMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseClassEnableVectorMetricTag) PatternFlowPfcPauseClassEnableVectorMetricTag + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseClassEnableVectorMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseClassEnableVectorMetricTag + // validate validates PatternFlowPfcPauseClassEnableVectorMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseClassEnableVectorMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPfcPauseClassEnableVectorMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPfcPauseClassEnableVectorMetricTag + SetName(value string) PatternFlowPfcPauseClassEnableVectorMetricTag + // Offset returns uint32, set in PatternFlowPfcPauseClassEnableVectorMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPfcPauseClassEnableVectorMetricTag + SetOffset(value uint32) PatternFlowPfcPauseClassEnableVectorMetricTag + // HasOffset checks if Offset has been set in PatternFlowPfcPauseClassEnableVectorMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPfcPauseClassEnableVectorMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPfcPauseClassEnableVectorMetricTag + SetLength(value uint32) PatternFlowPfcPauseClassEnableVectorMetricTag + // HasLength checks if Length has been set in PatternFlowPfcPauseClassEnableVectorMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPfcPauseClassEnableVectorMetricTag object +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) SetName(value string) PatternFlowPfcPauseClassEnableVectorMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPfcPauseClassEnableVectorMetricTag object +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) SetOffset(value uint32) PatternFlowPfcPauseClassEnableVectorMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPfcPauseClassEnableVectorMetricTag object +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) SetLength(value uint32) PatternFlowPfcPauseClassEnableVectorMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPauseClassEnableVectorMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseClassEnableVectorMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPfcPauseClassEnableVectorMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPfcPauseClassEnableVectorMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_control_op_code.go b/gosnappi/pattern_flow_pfc_pause_control_op_code.go new file mode 100644 index 00000000..f8dd7eff --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_control_op_code.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowPfcPauseControlOpCode ***** +type patternFlowPfcPauseControlOpCode struct { + validation + obj *otg.PatternFlowPfcPauseControlOpCode + marshaller marshalPatternFlowPfcPauseControlOpCode + unMarshaller unMarshalPatternFlowPfcPauseControlOpCode + incrementHolder PatternFlowPfcPauseControlOpCodeCounter + decrementHolder PatternFlowPfcPauseControlOpCodeCounter + metricTagsHolder PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter +} + +func NewPatternFlowPfcPauseControlOpCode() PatternFlowPfcPauseControlOpCode { + obj := patternFlowPfcPauseControlOpCode{obj: &otg.PatternFlowPfcPauseControlOpCode{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseControlOpCode) msg() *otg.PatternFlowPfcPauseControlOpCode { + return obj.obj +} + +func (obj *patternFlowPfcPauseControlOpCode) setMsg(msg *otg.PatternFlowPfcPauseControlOpCode) PatternFlowPfcPauseControlOpCode { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseControlOpCode struct { + obj *patternFlowPfcPauseControlOpCode +} + +type marshalPatternFlowPfcPauseControlOpCode interface { + // ToProto marshals PatternFlowPfcPauseControlOpCode to protobuf object *otg.PatternFlowPfcPauseControlOpCode + ToProto() (*otg.PatternFlowPfcPauseControlOpCode, error) + // ToPbText marshals PatternFlowPfcPauseControlOpCode to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseControlOpCode to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseControlOpCode to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseControlOpCode struct { + obj *patternFlowPfcPauseControlOpCode +} + +type unMarshalPatternFlowPfcPauseControlOpCode interface { + // FromProto unmarshals PatternFlowPfcPauseControlOpCode from protobuf object *otg.PatternFlowPfcPauseControlOpCode + FromProto(msg *otg.PatternFlowPfcPauseControlOpCode) (PatternFlowPfcPauseControlOpCode, error) + // FromPbText unmarshals PatternFlowPfcPauseControlOpCode from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseControlOpCode from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseControlOpCode from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseControlOpCode) Marshal() marshalPatternFlowPfcPauseControlOpCode { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseControlOpCode{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseControlOpCode) Unmarshal() unMarshalPatternFlowPfcPauseControlOpCode { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseControlOpCode{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseControlOpCode) ToProto() (*otg.PatternFlowPfcPauseControlOpCode, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseControlOpCode) FromProto(msg *otg.PatternFlowPfcPauseControlOpCode) (PatternFlowPfcPauseControlOpCode, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseControlOpCode) 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 *unMarshalpatternFlowPfcPauseControlOpCode) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPfcPauseControlOpCode) 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 *unMarshalpatternFlowPfcPauseControlOpCode) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPfcPauseControlOpCode) 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 *unMarshalpatternFlowPfcPauseControlOpCode) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPfcPauseControlOpCode) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseControlOpCode) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseControlOpCode) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseControlOpCode) Clone() (PatternFlowPfcPauseControlOpCode, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseControlOpCode() + 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 +} + +func (obj *patternFlowPfcPauseControlOpCode) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPfcPauseControlOpCode is control operation code +type PatternFlowPfcPauseControlOpCode interface { + Validation + // msg marshals PatternFlowPfcPauseControlOpCode to protobuf object *otg.PatternFlowPfcPauseControlOpCode + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseControlOpCode + // setMsg unmarshals PatternFlowPfcPauseControlOpCode from protobuf object *otg.PatternFlowPfcPauseControlOpCode + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseControlOpCode) PatternFlowPfcPauseControlOpCode + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseControlOpCode + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseControlOpCode + // validate validates PatternFlowPfcPauseControlOpCode + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseControlOpCode, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPfcPauseControlOpCodeChoiceEnum, set in PatternFlowPfcPauseControlOpCode + Choice() PatternFlowPfcPauseControlOpCodeChoiceEnum + // setChoice assigns PatternFlowPfcPauseControlOpCodeChoiceEnum provided by user to PatternFlowPfcPauseControlOpCode + setChoice(value PatternFlowPfcPauseControlOpCodeChoiceEnum) PatternFlowPfcPauseControlOpCode + // HasChoice checks if Choice has been set in PatternFlowPfcPauseControlOpCode + HasChoice() bool + // Value returns uint32, set in PatternFlowPfcPauseControlOpCode. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowPfcPauseControlOpCode + SetValue(value uint32) PatternFlowPfcPauseControlOpCode + // HasValue checks if Value has been set in PatternFlowPfcPauseControlOpCode + HasValue() bool + // Values returns []uint32, set in PatternFlowPfcPauseControlOpCode. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowPfcPauseControlOpCode + SetValues(value []uint32) PatternFlowPfcPauseControlOpCode + // Increment returns PatternFlowPfcPauseControlOpCodeCounter, set in PatternFlowPfcPauseControlOpCode. + // PatternFlowPfcPauseControlOpCodeCounter is integer counter pattern + Increment() PatternFlowPfcPauseControlOpCodeCounter + // SetIncrement assigns PatternFlowPfcPauseControlOpCodeCounter provided by user to PatternFlowPfcPauseControlOpCode. + // PatternFlowPfcPauseControlOpCodeCounter is integer counter pattern + SetIncrement(value PatternFlowPfcPauseControlOpCodeCounter) PatternFlowPfcPauseControlOpCode + // HasIncrement checks if Increment has been set in PatternFlowPfcPauseControlOpCode + HasIncrement() bool + // Decrement returns PatternFlowPfcPauseControlOpCodeCounter, set in PatternFlowPfcPauseControlOpCode. + // PatternFlowPfcPauseControlOpCodeCounter is integer counter pattern + Decrement() PatternFlowPfcPauseControlOpCodeCounter + // SetDecrement assigns PatternFlowPfcPauseControlOpCodeCounter provided by user to PatternFlowPfcPauseControlOpCode. + // PatternFlowPfcPauseControlOpCodeCounter is integer counter pattern + SetDecrement(value PatternFlowPfcPauseControlOpCodeCounter) PatternFlowPfcPauseControlOpCode + // HasDecrement checks if Decrement has been set in PatternFlowPfcPauseControlOpCode + HasDecrement() bool + // MetricTags returns PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIterIter, set in PatternFlowPfcPauseControlOpCode + MetricTags() PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter + setNil() +} + +type PatternFlowPfcPauseControlOpCodeChoiceEnum string + +// Enum of Choice on PatternFlowPfcPauseControlOpCode +var PatternFlowPfcPauseControlOpCodeChoice = struct { + VALUE PatternFlowPfcPauseControlOpCodeChoiceEnum + VALUES PatternFlowPfcPauseControlOpCodeChoiceEnum + INCREMENT PatternFlowPfcPauseControlOpCodeChoiceEnum + DECREMENT PatternFlowPfcPauseControlOpCodeChoiceEnum +}{ + VALUE: PatternFlowPfcPauseControlOpCodeChoiceEnum("value"), + VALUES: PatternFlowPfcPauseControlOpCodeChoiceEnum("values"), + INCREMENT: PatternFlowPfcPauseControlOpCodeChoiceEnum("increment"), + DECREMENT: PatternFlowPfcPauseControlOpCodeChoiceEnum("decrement"), +} + +func (obj *patternFlowPfcPauseControlOpCode) Choice() PatternFlowPfcPauseControlOpCodeChoiceEnum { + return PatternFlowPfcPauseControlOpCodeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPfcPauseControlOpCode) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPfcPauseControlOpCode) setChoice(value PatternFlowPfcPauseControlOpCodeChoiceEnum) PatternFlowPfcPauseControlOpCode { + intValue, ok := otg.PatternFlowPfcPauseControlOpCode_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPfcPauseControlOpCodeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPfcPauseControlOpCode_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPfcPauseControlOpCodeChoice.VALUE { + defaultValue := uint32(257) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPfcPauseControlOpCodeChoice.VALUES { + defaultValue := []uint32{257} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPfcPauseControlOpCodeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowPfcPauseControlOpCodeCounter().msg() + } + + if value == PatternFlowPfcPauseControlOpCodeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPfcPauseControlOpCodeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPauseControlOpCode) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPauseControlOpCode) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowPfcPauseControlOpCode object +func (obj *patternFlowPfcPauseControlOpCode) SetValue(value uint32) PatternFlowPfcPauseControlOpCode { + obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowPfcPauseControlOpCode) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{257}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowPfcPauseControlOpCode object +func (obj *patternFlowPfcPauseControlOpCode) SetValues(value []uint32) PatternFlowPfcPauseControlOpCode { + obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPfcPauseControlOpCodeCounter +func (obj *patternFlowPfcPauseControlOpCode) Increment() PatternFlowPfcPauseControlOpCodeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPfcPauseControlOpCodeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPfcPauseControlOpCodeCounter +func (obj *patternFlowPfcPauseControlOpCode) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPfcPauseControlOpCodeCounter value in the PatternFlowPfcPauseControlOpCode object +func (obj *patternFlowPfcPauseControlOpCode) SetIncrement(value PatternFlowPfcPauseControlOpCodeCounter) PatternFlowPfcPauseControlOpCode { + obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPfcPauseControlOpCodeCounter +func (obj *patternFlowPfcPauseControlOpCode) Decrement() PatternFlowPfcPauseControlOpCodeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPfcPauseControlOpCodeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPfcPauseControlOpCodeCounter +func (obj *patternFlowPfcPauseControlOpCode) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPfcPauseControlOpCodeCounter value in the PatternFlowPfcPauseControlOpCode object +func (obj *patternFlowPfcPauseControlOpCode) SetDecrement(value PatternFlowPfcPauseControlOpCodeCounter) PatternFlowPfcPauseControlOpCode { + obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPfcPauseControlOpCodeMetricTag +func (obj *patternFlowPfcPauseControlOpCode) MetricTags() PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPfcPauseControlOpCodeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter struct { + obj *patternFlowPfcPauseControlOpCode + patternFlowPfcPauseControlOpCodeMetricTagSlice []PatternFlowPfcPauseControlOpCodeMetricTag + fieldPtr *[]*otg.PatternFlowPfcPauseControlOpCodeMetricTag +} + +func newPatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter(ptr *[]*otg.PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { + return &patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter interface { + setMsg(*patternFlowPfcPauseControlOpCode) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter + Items() []PatternFlowPfcPauseControlOpCodeMetricTag + Add() PatternFlowPfcPauseControlOpCodeMetricTag + Append(items ...PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter + Set(index int, newObj PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter + Clear() PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter + clearHolderSlice() PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter + appendHolderSlice(item PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter +} + +func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) setMsg(msg *patternFlowPfcPauseControlOpCode) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPfcPauseControlOpCodeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) Items() []PatternFlowPfcPauseControlOpCodeMetricTag { + return obj.patternFlowPfcPauseControlOpCodeMetricTagSlice +} + +func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) Add() PatternFlowPfcPauseControlOpCodeMetricTag { + newObj := &otg.PatternFlowPfcPauseControlOpCodeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPfcPauseControlOpCodeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPfcPauseControlOpCodeMetricTagSlice = append(obj.patternFlowPfcPauseControlOpCodeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) Append(items ...PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPfcPauseControlOpCodeMetricTagSlice = append(obj.patternFlowPfcPauseControlOpCodeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) Set(index int, newObj PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPfcPauseControlOpCodeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) Clear() PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPfcPauseControlOpCodeMetricTag{} + obj.patternFlowPfcPauseControlOpCodeMetricTagSlice = []PatternFlowPfcPauseControlOpCodeMetricTag{} + } + return obj +} +func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) clearHolderSlice() PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { + if len(obj.patternFlowPfcPauseControlOpCodeMetricTagSlice) > 0 { + obj.patternFlowPfcPauseControlOpCodeMetricTagSlice = []PatternFlowPfcPauseControlOpCodeMetricTag{} + } + return obj +} +func (obj *patternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter) appendHolderSlice(item PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodePatternFlowPfcPauseControlOpCodeMetricTagIter { + obj.patternFlowPfcPauseControlOpCodeMetricTagSlice = append(obj.patternFlowPfcPauseControlOpCodeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowPfcPauseControlOpCode) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseControlOpCode.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowPfcPauseControlOpCode.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPfcPauseControlOpCodeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPfcPauseControlOpCode) setDefault() { + var choices_set int = 0 + var choice PatternFlowPfcPauseControlOpCodeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPfcPauseControlOpCodeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPfcPauseControlOpCodeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPfcPauseControlOpCodeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPfcPauseControlOpCodeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPfcPauseControlOpCodeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPauseControlOpCode") + } + } else { + intVal := otg.PatternFlowPfcPauseControlOpCode_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPfcPauseControlOpCode_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_control_op_code_counter.go b/gosnappi/pattern_flow_pfc_pause_control_op_code_counter.go new file mode 100644 index 00000000..85262210 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_control_op_code_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowPfcPauseControlOpCodeCounter ***** +type patternFlowPfcPauseControlOpCodeCounter struct { + validation + obj *otg.PatternFlowPfcPauseControlOpCodeCounter + marshaller marshalPatternFlowPfcPauseControlOpCodeCounter + unMarshaller unMarshalPatternFlowPfcPauseControlOpCodeCounter +} + +func NewPatternFlowPfcPauseControlOpCodeCounter() PatternFlowPfcPauseControlOpCodeCounter { + obj := patternFlowPfcPauseControlOpCodeCounter{obj: &otg.PatternFlowPfcPauseControlOpCodeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseControlOpCodeCounter) msg() *otg.PatternFlowPfcPauseControlOpCodeCounter { + return obj.obj +} + +func (obj *patternFlowPfcPauseControlOpCodeCounter) setMsg(msg *otg.PatternFlowPfcPauseControlOpCodeCounter) PatternFlowPfcPauseControlOpCodeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseControlOpCodeCounter struct { + obj *patternFlowPfcPauseControlOpCodeCounter +} + +type marshalPatternFlowPfcPauseControlOpCodeCounter interface { + // ToProto marshals PatternFlowPfcPauseControlOpCodeCounter to protobuf object *otg.PatternFlowPfcPauseControlOpCodeCounter + ToProto() (*otg.PatternFlowPfcPauseControlOpCodeCounter, error) + // ToPbText marshals PatternFlowPfcPauseControlOpCodeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseControlOpCodeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseControlOpCodeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseControlOpCodeCounter struct { + obj *patternFlowPfcPauseControlOpCodeCounter +} + +type unMarshalPatternFlowPfcPauseControlOpCodeCounter interface { + // FromProto unmarshals PatternFlowPfcPauseControlOpCodeCounter from protobuf object *otg.PatternFlowPfcPauseControlOpCodeCounter + FromProto(msg *otg.PatternFlowPfcPauseControlOpCodeCounter) (PatternFlowPfcPauseControlOpCodeCounter, error) + // FromPbText unmarshals PatternFlowPfcPauseControlOpCodeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseControlOpCodeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseControlOpCodeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseControlOpCodeCounter) Marshal() marshalPatternFlowPfcPauseControlOpCodeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseControlOpCodeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseControlOpCodeCounter) Unmarshal() unMarshalPatternFlowPfcPauseControlOpCodeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseControlOpCodeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseControlOpCodeCounter) ToProto() (*otg.PatternFlowPfcPauseControlOpCodeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseControlOpCodeCounter) FromProto(msg *otg.PatternFlowPfcPauseControlOpCodeCounter) (PatternFlowPfcPauseControlOpCodeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseControlOpCodeCounter) 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 *unMarshalpatternFlowPfcPauseControlOpCodeCounter) 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 *marshalpatternFlowPfcPauseControlOpCodeCounter) 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 *unMarshalpatternFlowPfcPauseControlOpCodeCounter) 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 *marshalpatternFlowPfcPauseControlOpCodeCounter) 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 *unMarshalpatternFlowPfcPauseControlOpCodeCounter) 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 *patternFlowPfcPauseControlOpCodeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseControlOpCodeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseControlOpCodeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseControlOpCodeCounter) Clone() (PatternFlowPfcPauseControlOpCodeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseControlOpCodeCounter() + 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 +} + +// PatternFlowPfcPauseControlOpCodeCounter is integer counter pattern +type PatternFlowPfcPauseControlOpCodeCounter interface { + Validation + // msg marshals PatternFlowPfcPauseControlOpCodeCounter to protobuf object *otg.PatternFlowPfcPauseControlOpCodeCounter + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseControlOpCodeCounter + // setMsg unmarshals PatternFlowPfcPauseControlOpCodeCounter from protobuf object *otg.PatternFlowPfcPauseControlOpCodeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseControlOpCodeCounter) PatternFlowPfcPauseControlOpCodeCounter + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseControlOpCodeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseControlOpCodeCounter + // validate validates PatternFlowPfcPauseControlOpCodeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseControlOpCodeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowPfcPauseControlOpCodeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowPfcPauseControlOpCodeCounter + SetStart(value uint32) PatternFlowPfcPauseControlOpCodeCounter + // HasStart checks if Start has been set in PatternFlowPfcPauseControlOpCodeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowPfcPauseControlOpCodeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowPfcPauseControlOpCodeCounter + SetStep(value uint32) PatternFlowPfcPauseControlOpCodeCounter + // HasStep checks if Step has been set in PatternFlowPfcPauseControlOpCodeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowPfcPauseControlOpCodeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPfcPauseControlOpCodeCounter + SetCount(value uint32) PatternFlowPfcPauseControlOpCodeCounter + // HasCount checks if Count has been set in PatternFlowPfcPauseControlOpCodeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPauseControlOpCodeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPauseControlOpCodeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowPfcPauseControlOpCodeCounter object +func (obj *patternFlowPfcPauseControlOpCodeCounter) SetStart(value uint32) PatternFlowPfcPauseControlOpCodeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPauseControlOpCodeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPauseControlOpCodeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowPfcPauseControlOpCodeCounter object +func (obj *patternFlowPfcPauseControlOpCodeCounter) SetStep(value uint32) PatternFlowPfcPauseControlOpCodeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPauseControlOpCodeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPauseControlOpCodeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPfcPauseControlOpCodeCounter object +func (obj *patternFlowPfcPauseControlOpCodeCounter) SetCount(value uint32) PatternFlowPfcPauseControlOpCodeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPfcPauseControlOpCodeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseControlOpCodeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseControlOpCodeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseControlOpCodeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowPfcPauseControlOpCodeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(257) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_control_op_code_metric_tag.go b/gosnappi/pattern_flow_pfc_pause_control_op_code_metric_tag.go new file mode 100644 index 00000000..4c2fc4b3 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_control_op_code_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPfcPauseControlOpCodeMetricTag ***** +type patternFlowPfcPauseControlOpCodeMetricTag struct { + validation + obj *otg.PatternFlowPfcPauseControlOpCodeMetricTag + marshaller marshalPatternFlowPfcPauseControlOpCodeMetricTag + unMarshaller unMarshalPatternFlowPfcPauseControlOpCodeMetricTag +} + +func NewPatternFlowPfcPauseControlOpCodeMetricTag() PatternFlowPfcPauseControlOpCodeMetricTag { + obj := patternFlowPfcPauseControlOpCodeMetricTag{obj: &otg.PatternFlowPfcPauseControlOpCodeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) msg() *otg.PatternFlowPfcPauseControlOpCodeMetricTag { + return obj.obj +} + +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) setMsg(msg *otg.PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseControlOpCodeMetricTag struct { + obj *patternFlowPfcPauseControlOpCodeMetricTag +} + +type marshalPatternFlowPfcPauseControlOpCodeMetricTag interface { + // ToProto marshals PatternFlowPfcPauseControlOpCodeMetricTag to protobuf object *otg.PatternFlowPfcPauseControlOpCodeMetricTag + ToProto() (*otg.PatternFlowPfcPauseControlOpCodeMetricTag, error) + // ToPbText marshals PatternFlowPfcPauseControlOpCodeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseControlOpCodeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseControlOpCodeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseControlOpCodeMetricTag struct { + obj *patternFlowPfcPauseControlOpCodeMetricTag +} + +type unMarshalPatternFlowPfcPauseControlOpCodeMetricTag interface { + // FromProto unmarshals PatternFlowPfcPauseControlOpCodeMetricTag from protobuf object *otg.PatternFlowPfcPauseControlOpCodeMetricTag + FromProto(msg *otg.PatternFlowPfcPauseControlOpCodeMetricTag) (PatternFlowPfcPauseControlOpCodeMetricTag, error) + // FromPbText unmarshals PatternFlowPfcPauseControlOpCodeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseControlOpCodeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseControlOpCodeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) Marshal() marshalPatternFlowPfcPauseControlOpCodeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseControlOpCodeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) Unmarshal() unMarshalPatternFlowPfcPauseControlOpCodeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseControlOpCodeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseControlOpCodeMetricTag) ToProto() (*otg.PatternFlowPfcPauseControlOpCodeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseControlOpCodeMetricTag) FromProto(msg *otg.PatternFlowPfcPauseControlOpCodeMetricTag) (PatternFlowPfcPauseControlOpCodeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseControlOpCodeMetricTag) 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 *unMarshalpatternFlowPfcPauseControlOpCodeMetricTag) 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 *marshalpatternFlowPfcPauseControlOpCodeMetricTag) 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 *unMarshalpatternFlowPfcPauseControlOpCodeMetricTag) 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 *marshalpatternFlowPfcPauseControlOpCodeMetricTag) 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 *unMarshalpatternFlowPfcPauseControlOpCodeMetricTag) 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 *patternFlowPfcPauseControlOpCodeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) Clone() (PatternFlowPfcPauseControlOpCodeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseControlOpCodeMetricTag() + 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 +} + +// PatternFlowPfcPauseControlOpCodeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPfcPauseControlOpCodeMetricTag interface { + Validation + // msg marshals PatternFlowPfcPauseControlOpCodeMetricTag to protobuf object *otg.PatternFlowPfcPauseControlOpCodeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseControlOpCodeMetricTag + // setMsg unmarshals PatternFlowPfcPauseControlOpCodeMetricTag from protobuf object *otg.PatternFlowPfcPauseControlOpCodeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseControlOpCodeMetricTag) PatternFlowPfcPauseControlOpCodeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseControlOpCodeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseControlOpCodeMetricTag + // validate validates PatternFlowPfcPauseControlOpCodeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseControlOpCodeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPfcPauseControlOpCodeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPfcPauseControlOpCodeMetricTag + SetName(value string) PatternFlowPfcPauseControlOpCodeMetricTag + // Offset returns uint32, set in PatternFlowPfcPauseControlOpCodeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPfcPauseControlOpCodeMetricTag + SetOffset(value uint32) PatternFlowPfcPauseControlOpCodeMetricTag + // HasOffset checks if Offset has been set in PatternFlowPfcPauseControlOpCodeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPfcPauseControlOpCodeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPfcPauseControlOpCodeMetricTag + SetLength(value uint32) PatternFlowPfcPauseControlOpCodeMetricTag + // HasLength checks if Length has been set in PatternFlowPfcPauseControlOpCodeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPfcPauseControlOpCodeMetricTag object +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) SetName(value string) PatternFlowPfcPauseControlOpCodeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPfcPauseControlOpCodeMetricTag object +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) SetOffset(value uint32) PatternFlowPfcPauseControlOpCodeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPfcPauseControlOpCodeMetricTag object +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) SetLength(value uint32) PatternFlowPfcPauseControlOpCodeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPauseControlOpCodeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseControlOpCodeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPfcPauseControlOpCodeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPfcPauseControlOpCodeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_dst.go b/gosnappi/pattern_flow_pfc_pause_dst.go new file mode 100644 index 00000000..a4eab4d6 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_dst.go @@ -0,0 +1,658 @@ +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" +) + +// ***** PatternFlowPfcPauseDst ***** +type patternFlowPfcPauseDst struct { + validation + obj *otg.PatternFlowPfcPauseDst + marshaller marshalPatternFlowPfcPauseDst + unMarshaller unMarshalPatternFlowPfcPauseDst + incrementHolder PatternFlowPfcPauseDstCounter + decrementHolder PatternFlowPfcPauseDstCounter + metricTagsHolder PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter +} + +func NewPatternFlowPfcPauseDst() PatternFlowPfcPauseDst { + obj := patternFlowPfcPauseDst{obj: &otg.PatternFlowPfcPauseDst{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseDst) msg() *otg.PatternFlowPfcPauseDst { + return obj.obj +} + +func (obj *patternFlowPfcPauseDst) setMsg(msg *otg.PatternFlowPfcPauseDst) PatternFlowPfcPauseDst { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseDst struct { + obj *patternFlowPfcPauseDst +} + +type marshalPatternFlowPfcPauseDst interface { + // ToProto marshals PatternFlowPfcPauseDst to protobuf object *otg.PatternFlowPfcPauseDst + ToProto() (*otg.PatternFlowPfcPauseDst, error) + // ToPbText marshals PatternFlowPfcPauseDst to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseDst to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseDst to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseDst struct { + obj *patternFlowPfcPauseDst +} + +type unMarshalPatternFlowPfcPauseDst interface { + // FromProto unmarshals PatternFlowPfcPauseDst from protobuf object *otg.PatternFlowPfcPauseDst + FromProto(msg *otg.PatternFlowPfcPauseDst) (PatternFlowPfcPauseDst, error) + // FromPbText unmarshals PatternFlowPfcPauseDst from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseDst from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseDst from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseDst) Marshal() marshalPatternFlowPfcPauseDst { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseDst{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseDst) Unmarshal() unMarshalPatternFlowPfcPauseDst { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseDst{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseDst) ToProto() (*otg.PatternFlowPfcPauseDst, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseDst) FromProto(msg *otg.PatternFlowPfcPauseDst) (PatternFlowPfcPauseDst, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseDst) 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 *unMarshalpatternFlowPfcPauseDst) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPfcPauseDst) 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 *unMarshalpatternFlowPfcPauseDst) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPfcPauseDst) 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 *unMarshalpatternFlowPfcPauseDst) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPfcPauseDst) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseDst) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseDst) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseDst) Clone() (PatternFlowPfcPauseDst, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseDst() + 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 +} + +func (obj *patternFlowPfcPauseDst) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPfcPauseDst is destination MAC address +type PatternFlowPfcPauseDst interface { + Validation + // msg marshals PatternFlowPfcPauseDst to protobuf object *otg.PatternFlowPfcPauseDst + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseDst + // setMsg unmarshals PatternFlowPfcPauseDst from protobuf object *otg.PatternFlowPfcPauseDst + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseDst) PatternFlowPfcPauseDst + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseDst + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseDst + // validate validates PatternFlowPfcPauseDst + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseDst, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPfcPauseDstChoiceEnum, set in PatternFlowPfcPauseDst + Choice() PatternFlowPfcPauseDstChoiceEnum + // setChoice assigns PatternFlowPfcPauseDstChoiceEnum provided by user to PatternFlowPfcPauseDst + setChoice(value PatternFlowPfcPauseDstChoiceEnum) PatternFlowPfcPauseDst + // HasChoice checks if Choice has been set in PatternFlowPfcPauseDst + HasChoice() bool + // Value returns string, set in PatternFlowPfcPauseDst. + Value() string + // SetValue assigns string provided by user to PatternFlowPfcPauseDst + SetValue(value string) PatternFlowPfcPauseDst + // HasValue checks if Value has been set in PatternFlowPfcPauseDst + HasValue() bool + // Values returns []string, set in PatternFlowPfcPauseDst. + Values() []string + // SetValues assigns []string provided by user to PatternFlowPfcPauseDst + SetValues(value []string) PatternFlowPfcPauseDst + // Increment returns PatternFlowPfcPauseDstCounter, set in PatternFlowPfcPauseDst. + // PatternFlowPfcPauseDstCounter is mac counter pattern + Increment() PatternFlowPfcPauseDstCounter + // SetIncrement assigns PatternFlowPfcPauseDstCounter provided by user to PatternFlowPfcPauseDst. + // PatternFlowPfcPauseDstCounter is mac counter pattern + SetIncrement(value PatternFlowPfcPauseDstCounter) PatternFlowPfcPauseDst + // HasIncrement checks if Increment has been set in PatternFlowPfcPauseDst + HasIncrement() bool + // Decrement returns PatternFlowPfcPauseDstCounter, set in PatternFlowPfcPauseDst. + // PatternFlowPfcPauseDstCounter is mac counter pattern + Decrement() PatternFlowPfcPauseDstCounter + // SetDecrement assigns PatternFlowPfcPauseDstCounter provided by user to PatternFlowPfcPauseDst. + // PatternFlowPfcPauseDstCounter is mac counter pattern + SetDecrement(value PatternFlowPfcPauseDstCounter) PatternFlowPfcPauseDst + // HasDecrement checks if Decrement has been set in PatternFlowPfcPauseDst + HasDecrement() bool + // MetricTags returns PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIterIter, set in PatternFlowPfcPauseDst + MetricTags() PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter + setNil() +} + +type PatternFlowPfcPauseDstChoiceEnum string + +// Enum of Choice on PatternFlowPfcPauseDst +var PatternFlowPfcPauseDstChoice = struct { + VALUE PatternFlowPfcPauseDstChoiceEnum + VALUES PatternFlowPfcPauseDstChoiceEnum + INCREMENT PatternFlowPfcPauseDstChoiceEnum + DECREMENT PatternFlowPfcPauseDstChoiceEnum +}{ + VALUE: PatternFlowPfcPauseDstChoiceEnum("value"), + VALUES: PatternFlowPfcPauseDstChoiceEnum("values"), + INCREMENT: PatternFlowPfcPauseDstChoiceEnum("increment"), + DECREMENT: PatternFlowPfcPauseDstChoiceEnum("decrement"), +} + +func (obj *patternFlowPfcPauseDst) Choice() PatternFlowPfcPauseDstChoiceEnum { + return PatternFlowPfcPauseDstChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPfcPauseDst) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPfcPauseDst) setChoice(value PatternFlowPfcPauseDstChoiceEnum) PatternFlowPfcPauseDst { + intValue, ok := otg.PatternFlowPfcPauseDst_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPfcPauseDstChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPfcPauseDst_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPfcPauseDstChoice.VALUE { + defaultValue := "01:80:c2:00:00:01" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPfcPauseDstChoice.VALUES { + defaultValue := []string{"01:80:c2:00:00:01"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPfcPauseDstChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowPfcPauseDstCounter().msg() + } + + if value == PatternFlowPfcPauseDstChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPfcPauseDstCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowPfcPauseDst) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPfcPauseDstChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowPfcPauseDst) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowPfcPauseDst object +func (obj *patternFlowPfcPauseDst) SetValue(value string) PatternFlowPfcPauseDst { + obj.setChoice(PatternFlowPfcPauseDstChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowPfcPauseDst) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"01:80:c2:00:00:01"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowPfcPauseDst object +func (obj *patternFlowPfcPauseDst) SetValues(value []string) PatternFlowPfcPauseDst { + obj.setChoice(PatternFlowPfcPauseDstChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPfcPauseDstCounter +func (obj *patternFlowPfcPauseDst) Increment() PatternFlowPfcPauseDstCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPfcPauseDstChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPfcPauseDstCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPfcPauseDstCounter +func (obj *patternFlowPfcPauseDst) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPfcPauseDstCounter value in the PatternFlowPfcPauseDst object +func (obj *patternFlowPfcPauseDst) SetIncrement(value PatternFlowPfcPauseDstCounter) PatternFlowPfcPauseDst { + obj.setChoice(PatternFlowPfcPauseDstChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPfcPauseDstCounter +func (obj *patternFlowPfcPauseDst) Decrement() PatternFlowPfcPauseDstCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPfcPauseDstChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPfcPauseDstCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPfcPauseDstCounter +func (obj *patternFlowPfcPauseDst) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPfcPauseDstCounter value in the PatternFlowPfcPauseDst object +func (obj *patternFlowPfcPauseDst) SetDecrement(value PatternFlowPfcPauseDstCounter) PatternFlowPfcPauseDst { + obj.setChoice(PatternFlowPfcPauseDstChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPfcPauseDstMetricTag +func (obj *patternFlowPfcPauseDst) MetricTags() PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPfcPauseDstMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter struct { + obj *patternFlowPfcPauseDst + patternFlowPfcPauseDstMetricTagSlice []PatternFlowPfcPauseDstMetricTag + fieldPtr *[]*otg.PatternFlowPfcPauseDstMetricTag +} + +func newPatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter(ptr *[]*otg.PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { + return &patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter interface { + setMsg(*patternFlowPfcPauseDst) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter + Items() []PatternFlowPfcPauseDstMetricTag + Add() PatternFlowPfcPauseDstMetricTag + Append(items ...PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter + Set(index int, newObj PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter + Clear() PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter + clearHolderSlice() PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter + appendHolderSlice(item PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter +} + +func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) setMsg(msg *patternFlowPfcPauseDst) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPfcPauseDstMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) Items() []PatternFlowPfcPauseDstMetricTag { + return obj.patternFlowPfcPauseDstMetricTagSlice +} + +func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) Add() PatternFlowPfcPauseDstMetricTag { + newObj := &otg.PatternFlowPfcPauseDstMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPfcPauseDstMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPfcPauseDstMetricTagSlice = append(obj.patternFlowPfcPauseDstMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) Append(items ...PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPfcPauseDstMetricTagSlice = append(obj.patternFlowPfcPauseDstMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) Set(index int, newObj PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPfcPauseDstMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) Clear() PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPfcPauseDstMetricTag{} + obj.patternFlowPfcPauseDstMetricTagSlice = []PatternFlowPfcPauseDstMetricTag{} + } + return obj +} +func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) clearHolderSlice() PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { + if len(obj.patternFlowPfcPauseDstMetricTagSlice) > 0 { + obj.patternFlowPfcPauseDstMetricTagSlice = []PatternFlowPfcPauseDstMetricTag{} + } + return obj +} +func (obj *patternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter) appendHolderSlice(item PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstPatternFlowPfcPauseDstMetricTagIter { + obj.patternFlowPfcPauseDstMetricTagSlice = append(obj.patternFlowPfcPauseDstMetricTagSlice, item) + return obj +} + +func (obj *patternFlowPfcPauseDst) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateMac(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseDst.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateMacSlice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseDst.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPfcPauseDstMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPfcPauseDst) setDefault() { + var choices_set int = 0 + var choice PatternFlowPfcPauseDstChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPfcPauseDstChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPfcPauseDstChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPfcPauseDstChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPfcPauseDstChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPfcPauseDstChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPauseDst") + } + } else { + intVal := otg.PatternFlowPfcPauseDst_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPfcPauseDst_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_dst_counter.go b/gosnappi/pattern_flow_pfc_pause_dst_counter.go new file mode 100644 index 00000000..acaa86ed --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_dst_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowPfcPauseDstCounter ***** +type patternFlowPfcPauseDstCounter struct { + validation + obj *otg.PatternFlowPfcPauseDstCounter + marshaller marshalPatternFlowPfcPauseDstCounter + unMarshaller unMarshalPatternFlowPfcPauseDstCounter +} + +func NewPatternFlowPfcPauseDstCounter() PatternFlowPfcPauseDstCounter { + obj := patternFlowPfcPauseDstCounter{obj: &otg.PatternFlowPfcPauseDstCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseDstCounter) msg() *otg.PatternFlowPfcPauseDstCounter { + return obj.obj +} + +func (obj *patternFlowPfcPauseDstCounter) setMsg(msg *otg.PatternFlowPfcPauseDstCounter) PatternFlowPfcPauseDstCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseDstCounter struct { + obj *patternFlowPfcPauseDstCounter +} + +type marshalPatternFlowPfcPauseDstCounter interface { + // ToProto marshals PatternFlowPfcPauseDstCounter to protobuf object *otg.PatternFlowPfcPauseDstCounter + ToProto() (*otg.PatternFlowPfcPauseDstCounter, error) + // ToPbText marshals PatternFlowPfcPauseDstCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseDstCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseDstCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseDstCounter struct { + obj *patternFlowPfcPauseDstCounter +} + +type unMarshalPatternFlowPfcPauseDstCounter interface { + // FromProto unmarshals PatternFlowPfcPauseDstCounter from protobuf object *otg.PatternFlowPfcPauseDstCounter + FromProto(msg *otg.PatternFlowPfcPauseDstCounter) (PatternFlowPfcPauseDstCounter, error) + // FromPbText unmarshals PatternFlowPfcPauseDstCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseDstCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseDstCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseDstCounter) Marshal() marshalPatternFlowPfcPauseDstCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseDstCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseDstCounter) Unmarshal() unMarshalPatternFlowPfcPauseDstCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseDstCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseDstCounter) ToProto() (*otg.PatternFlowPfcPauseDstCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseDstCounter) FromProto(msg *otg.PatternFlowPfcPauseDstCounter) (PatternFlowPfcPauseDstCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseDstCounter) 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 *unMarshalpatternFlowPfcPauseDstCounter) 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 *marshalpatternFlowPfcPauseDstCounter) 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 *unMarshalpatternFlowPfcPauseDstCounter) 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 *marshalpatternFlowPfcPauseDstCounter) 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 *unMarshalpatternFlowPfcPauseDstCounter) 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 *patternFlowPfcPauseDstCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseDstCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseDstCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseDstCounter) Clone() (PatternFlowPfcPauseDstCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseDstCounter() + 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 +} + +// PatternFlowPfcPauseDstCounter is mac counter pattern +type PatternFlowPfcPauseDstCounter interface { + Validation + // msg marshals PatternFlowPfcPauseDstCounter to protobuf object *otg.PatternFlowPfcPauseDstCounter + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseDstCounter + // setMsg unmarshals PatternFlowPfcPauseDstCounter from protobuf object *otg.PatternFlowPfcPauseDstCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseDstCounter) PatternFlowPfcPauseDstCounter + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseDstCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseDstCounter + // validate validates PatternFlowPfcPauseDstCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseDstCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowPfcPauseDstCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowPfcPauseDstCounter + SetStart(value string) PatternFlowPfcPauseDstCounter + // HasStart checks if Start has been set in PatternFlowPfcPauseDstCounter + HasStart() bool + // Step returns string, set in PatternFlowPfcPauseDstCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowPfcPauseDstCounter + SetStep(value string) PatternFlowPfcPauseDstCounter + // HasStep checks if Step has been set in PatternFlowPfcPauseDstCounter + HasStep() bool + // Count returns uint32, set in PatternFlowPfcPauseDstCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPfcPauseDstCounter + SetCount(value uint32) PatternFlowPfcPauseDstCounter + // HasCount checks if Count has been set in PatternFlowPfcPauseDstCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowPfcPauseDstCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowPfcPauseDstCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowPfcPauseDstCounter object +func (obj *patternFlowPfcPauseDstCounter) SetStart(value string) PatternFlowPfcPauseDstCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowPfcPauseDstCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowPfcPauseDstCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowPfcPauseDstCounter object +func (obj *patternFlowPfcPauseDstCounter) SetStep(value string) PatternFlowPfcPauseDstCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPauseDstCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPauseDstCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPfcPauseDstCounter object +func (obj *patternFlowPfcPauseDstCounter) SetCount(value uint32) PatternFlowPfcPauseDstCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPfcPauseDstCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateMac(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseDstCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateMac(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseDstCounter.Step")) + } + + } + +} + +func (obj *patternFlowPfcPauseDstCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("01:80:c2:00:00:01") + } + if obj.obj.Step == nil { + obj.SetStep("00:00:00:00:00:01") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_dst_metric_tag.go b/gosnappi/pattern_flow_pfc_pause_dst_metric_tag.go new file mode 100644 index 00000000..67a90a8f --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_dst_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPfcPauseDstMetricTag ***** +type patternFlowPfcPauseDstMetricTag struct { + validation + obj *otg.PatternFlowPfcPauseDstMetricTag + marshaller marshalPatternFlowPfcPauseDstMetricTag + unMarshaller unMarshalPatternFlowPfcPauseDstMetricTag +} + +func NewPatternFlowPfcPauseDstMetricTag() PatternFlowPfcPauseDstMetricTag { + obj := patternFlowPfcPauseDstMetricTag{obj: &otg.PatternFlowPfcPauseDstMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseDstMetricTag) msg() *otg.PatternFlowPfcPauseDstMetricTag { + return obj.obj +} + +func (obj *patternFlowPfcPauseDstMetricTag) setMsg(msg *otg.PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseDstMetricTag struct { + obj *patternFlowPfcPauseDstMetricTag +} + +type marshalPatternFlowPfcPauseDstMetricTag interface { + // ToProto marshals PatternFlowPfcPauseDstMetricTag to protobuf object *otg.PatternFlowPfcPauseDstMetricTag + ToProto() (*otg.PatternFlowPfcPauseDstMetricTag, error) + // ToPbText marshals PatternFlowPfcPauseDstMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseDstMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseDstMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseDstMetricTag struct { + obj *patternFlowPfcPauseDstMetricTag +} + +type unMarshalPatternFlowPfcPauseDstMetricTag interface { + // FromProto unmarshals PatternFlowPfcPauseDstMetricTag from protobuf object *otg.PatternFlowPfcPauseDstMetricTag + FromProto(msg *otg.PatternFlowPfcPauseDstMetricTag) (PatternFlowPfcPauseDstMetricTag, error) + // FromPbText unmarshals PatternFlowPfcPauseDstMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseDstMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseDstMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseDstMetricTag) Marshal() marshalPatternFlowPfcPauseDstMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseDstMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseDstMetricTag) Unmarshal() unMarshalPatternFlowPfcPauseDstMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseDstMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseDstMetricTag) ToProto() (*otg.PatternFlowPfcPauseDstMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseDstMetricTag) FromProto(msg *otg.PatternFlowPfcPauseDstMetricTag) (PatternFlowPfcPauseDstMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseDstMetricTag) 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 *unMarshalpatternFlowPfcPauseDstMetricTag) 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 *marshalpatternFlowPfcPauseDstMetricTag) 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 *unMarshalpatternFlowPfcPauseDstMetricTag) 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 *marshalpatternFlowPfcPauseDstMetricTag) 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 *unMarshalpatternFlowPfcPauseDstMetricTag) 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 *patternFlowPfcPauseDstMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseDstMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseDstMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseDstMetricTag) Clone() (PatternFlowPfcPauseDstMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseDstMetricTag() + 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 +} + +// PatternFlowPfcPauseDstMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPfcPauseDstMetricTag interface { + Validation + // msg marshals PatternFlowPfcPauseDstMetricTag to protobuf object *otg.PatternFlowPfcPauseDstMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseDstMetricTag + // setMsg unmarshals PatternFlowPfcPauseDstMetricTag from protobuf object *otg.PatternFlowPfcPauseDstMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseDstMetricTag) PatternFlowPfcPauseDstMetricTag + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseDstMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseDstMetricTag + // validate validates PatternFlowPfcPauseDstMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseDstMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPfcPauseDstMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPfcPauseDstMetricTag + SetName(value string) PatternFlowPfcPauseDstMetricTag + // Offset returns uint32, set in PatternFlowPfcPauseDstMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPfcPauseDstMetricTag + SetOffset(value uint32) PatternFlowPfcPauseDstMetricTag + // HasOffset checks if Offset has been set in PatternFlowPfcPauseDstMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPfcPauseDstMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPfcPauseDstMetricTag + SetLength(value uint32) PatternFlowPfcPauseDstMetricTag + // HasLength checks if Length has been set in PatternFlowPfcPauseDstMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPfcPauseDstMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPfcPauseDstMetricTag object +func (obj *patternFlowPfcPauseDstMetricTag) SetName(value string) PatternFlowPfcPauseDstMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPauseDstMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPauseDstMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPfcPauseDstMetricTag object +func (obj *patternFlowPfcPauseDstMetricTag) SetOffset(value uint32) PatternFlowPfcPauseDstMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPauseDstMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPauseDstMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPfcPauseDstMetricTag object +func (obj *patternFlowPfcPauseDstMetricTag) SetLength(value uint32) PatternFlowPfcPauseDstMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPfcPauseDstMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPauseDstMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 47 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseDstMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 48 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPfcPauseDstMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPfcPauseDstMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(48) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_ether_type.go b/gosnappi/pattern_flow_pfc_pause_ether_type.go new file mode 100644 index 00000000..de9dac1d --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_ether_type.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowPfcPauseEtherType ***** +type patternFlowPfcPauseEtherType struct { + validation + obj *otg.PatternFlowPfcPauseEtherType + marshaller marshalPatternFlowPfcPauseEtherType + unMarshaller unMarshalPatternFlowPfcPauseEtherType + incrementHolder PatternFlowPfcPauseEtherTypeCounter + decrementHolder PatternFlowPfcPauseEtherTypeCounter + metricTagsHolder PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter +} + +func NewPatternFlowPfcPauseEtherType() PatternFlowPfcPauseEtherType { + obj := patternFlowPfcPauseEtherType{obj: &otg.PatternFlowPfcPauseEtherType{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseEtherType) msg() *otg.PatternFlowPfcPauseEtherType { + return obj.obj +} + +func (obj *patternFlowPfcPauseEtherType) setMsg(msg *otg.PatternFlowPfcPauseEtherType) PatternFlowPfcPauseEtherType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseEtherType struct { + obj *patternFlowPfcPauseEtherType +} + +type marshalPatternFlowPfcPauseEtherType interface { + // ToProto marshals PatternFlowPfcPauseEtherType to protobuf object *otg.PatternFlowPfcPauseEtherType + ToProto() (*otg.PatternFlowPfcPauseEtherType, error) + // ToPbText marshals PatternFlowPfcPauseEtherType to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseEtherType to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseEtherType to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseEtherType struct { + obj *patternFlowPfcPauseEtherType +} + +type unMarshalPatternFlowPfcPauseEtherType interface { + // FromProto unmarshals PatternFlowPfcPauseEtherType from protobuf object *otg.PatternFlowPfcPauseEtherType + FromProto(msg *otg.PatternFlowPfcPauseEtherType) (PatternFlowPfcPauseEtherType, error) + // FromPbText unmarshals PatternFlowPfcPauseEtherType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseEtherType from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseEtherType from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseEtherType) Marshal() marshalPatternFlowPfcPauseEtherType { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseEtherType{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseEtherType) Unmarshal() unMarshalPatternFlowPfcPauseEtherType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseEtherType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseEtherType) ToProto() (*otg.PatternFlowPfcPauseEtherType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseEtherType) FromProto(msg *otg.PatternFlowPfcPauseEtherType) (PatternFlowPfcPauseEtherType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseEtherType) 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 *unMarshalpatternFlowPfcPauseEtherType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPfcPauseEtherType) 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 *unMarshalpatternFlowPfcPauseEtherType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPfcPauseEtherType) 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 *unMarshalpatternFlowPfcPauseEtherType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPfcPauseEtherType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseEtherType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseEtherType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseEtherType) Clone() (PatternFlowPfcPauseEtherType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseEtherType() + 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 +} + +func (obj *patternFlowPfcPauseEtherType) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPfcPauseEtherType is ethernet type +type PatternFlowPfcPauseEtherType interface { + Validation + // msg marshals PatternFlowPfcPauseEtherType to protobuf object *otg.PatternFlowPfcPauseEtherType + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseEtherType + // setMsg unmarshals PatternFlowPfcPauseEtherType from protobuf object *otg.PatternFlowPfcPauseEtherType + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseEtherType) PatternFlowPfcPauseEtherType + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseEtherType + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseEtherType + // validate validates PatternFlowPfcPauseEtherType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseEtherType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPfcPauseEtherTypeChoiceEnum, set in PatternFlowPfcPauseEtherType + Choice() PatternFlowPfcPauseEtherTypeChoiceEnum + // setChoice assigns PatternFlowPfcPauseEtherTypeChoiceEnum provided by user to PatternFlowPfcPauseEtherType + setChoice(value PatternFlowPfcPauseEtherTypeChoiceEnum) PatternFlowPfcPauseEtherType + // HasChoice checks if Choice has been set in PatternFlowPfcPauseEtherType + HasChoice() bool + // Value returns uint32, set in PatternFlowPfcPauseEtherType. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowPfcPauseEtherType + SetValue(value uint32) PatternFlowPfcPauseEtherType + // HasValue checks if Value has been set in PatternFlowPfcPauseEtherType + HasValue() bool + // Values returns []uint32, set in PatternFlowPfcPauseEtherType. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowPfcPauseEtherType + SetValues(value []uint32) PatternFlowPfcPauseEtherType + // Increment returns PatternFlowPfcPauseEtherTypeCounter, set in PatternFlowPfcPauseEtherType. + // PatternFlowPfcPauseEtherTypeCounter is integer counter pattern + Increment() PatternFlowPfcPauseEtherTypeCounter + // SetIncrement assigns PatternFlowPfcPauseEtherTypeCounter provided by user to PatternFlowPfcPauseEtherType. + // PatternFlowPfcPauseEtherTypeCounter is integer counter pattern + SetIncrement(value PatternFlowPfcPauseEtherTypeCounter) PatternFlowPfcPauseEtherType + // HasIncrement checks if Increment has been set in PatternFlowPfcPauseEtherType + HasIncrement() bool + // Decrement returns PatternFlowPfcPauseEtherTypeCounter, set in PatternFlowPfcPauseEtherType. + // PatternFlowPfcPauseEtherTypeCounter is integer counter pattern + Decrement() PatternFlowPfcPauseEtherTypeCounter + // SetDecrement assigns PatternFlowPfcPauseEtherTypeCounter provided by user to PatternFlowPfcPauseEtherType. + // PatternFlowPfcPauseEtherTypeCounter is integer counter pattern + SetDecrement(value PatternFlowPfcPauseEtherTypeCounter) PatternFlowPfcPauseEtherType + // HasDecrement checks if Decrement has been set in PatternFlowPfcPauseEtherType + HasDecrement() bool + // MetricTags returns PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIterIter, set in PatternFlowPfcPauseEtherType + MetricTags() PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter + setNil() +} + +type PatternFlowPfcPauseEtherTypeChoiceEnum string + +// Enum of Choice on PatternFlowPfcPauseEtherType +var PatternFlowPfcPauseEtherTypeChoice = struct { + VALUE PatternFlowPfcPauseEtherTypeChoiceEnum + VALUES PatternFlowPfcPauseEtherTypeChoiceEnum + INCREMENT PatternFlowPfcPauseEtherTypeChoiceEnum + DECREMENT PatternFlowPfcPauseEtherTypeChoiceEnum +}{ + VALUE: PatternFlowPfcPauseEtherTypeChoiceEnum("value"), + VALUES: PatternFlowPfcPauseEtherTypeChoiceEnum("values"), + INCREMENT: PatternFlowPfcPauseEtherTypeChoiceEnum("increment"), + DECREMENT: PatternFlowPfcPauseEtherTypeChoiceEnum("decrement"), +} + +func (obj *patternFlowPfcPauseEtherType) Choice() PatternFlowPfcPauseEtherTypeChoiceEnum { + return PatternFlowPfcPauseEtherTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPfcPauseEtherType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPfcPauseEtherType) setChoice(value PatternFlowPfcPauseEtherTypeChoiceEnum) PatternFlowPfcPauseEtherType { + intValue, ok := otg.PatternFlowPfcPauseEtherType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPfcPauseEtherTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPfcPauseEtherType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPfcPauseEtherTypeChoice.VALUE { + defaultValue := uint32(34824) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPfcPauseEtherTypeChoice.VALUES { + defaultValue := []uint32{34824} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPfcPauseEtherTypeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowPfcPauseEtherTypeCounter().msg() + } + + if value == PatternFlowPfcPauseEtherTypeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPfcPauseEtherTypeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPauseEtherType) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPauseEtherType) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowPfcPauseEtherType object +func (obj *patternFlowPfcPauseEtherType) SetValue(value uint32) PatternFlowPfcPauseEtherType { + obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowPfcPauseEtherType) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{34824}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowPfcPauseEtherType object +func (obj *patternFlowPfcPauseEtherType) SetValues(value []uint32) PatternFlowPfcPauseEtherType { + obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPfcPauseEtherTypeCounter +func (obj *patternFlowPfcPauseEtherType) Increment() PatternFlowPfcPauseEtherTypeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPfcPauseEtherTypeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPfcPauseEtherTypeCounter +func (obj *patternFlowPfcPauseEtherType) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPfcPauseEtherTypeCounter value in the PatternFlowPfcPauseEtherType object +func (obj *patternFlowPfcPauseEtherType) SetIncrement(value PatternFlowPfcPauseEtherTypeCounter) PatternFlowPfcPauseEtherType { + obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPfcPauseEtherTypeCounter +func (obj *patternFlowPfcPauseEtherType) Decrement() PatternFlowPfcPauseEtherTypeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPfcPauseEtherTypeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPfcPauseEtherTypeCounter +func (obj *patternFlowPfcPauseEtherType) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPfcPauseEtherTypeCounter value in the PatternFlowPfcPauseEtherType object +func (obj *patternFlowPfcPauseEtherType) SetDecrement(value PatternFlowPfcPauseEtherTypeCounter) PatternFlowPfcPauseEtherType { + obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPfcPauseEtherTypeMetricTag +func (obj *patternFlowPfcPauseEtherType) MetricTags() PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPfcPauseEtherTypeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter struct { + obj *patternFlowPfcPauseEtherType + patternFlowPfcPauseEtherTypeMetricTagSlice []PatternFlowPfcPauseEtherTypeMetricTag + fieldPtr *[]*otg.PatternFlowPfcPauseEtherTypeMetricTag +} + +func newPatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter(ptr *[]*otg.PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { + return &patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter interface { + setMsg(*patternFlowPfcPauseEtherType) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter + Items() []PatternFlowPfcPauseEtherTypeMetricTag + Add() PatternFlowPfcPauseEtherTypeMetricTag + Append(items ...PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter + Set(index int, newObj PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter + Clear() PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter + clearHolderSlice() PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter + appendHolderSlice(item PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter +} + +func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) setMsg(msg *patternFlowPfcPauseEtherType) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPfcPauseEtherTypeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) Items() []PatternFlowPfcPauseEtherTypeMetricTag { + return obj.patternFlowPfcPauseEtherTypeMetricTagSlice +} + +func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) Add() PatternFlowPfcPauseEtherTypeMetricTag { + newObj := &otg.PatternFlowPfcPauseEtherTypeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPfcPauseEtherTypeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPfcPauseEtherTypeMetricTagSlice = append(obj.patternFlowPfcPauseEtherTypeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) Append(items ...PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPfcPauseEtherTypeMetricTagSlice = append(obj.patternFlowPfcPauseEtherTypeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) Set(index int, newObj PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPfcPauseEtherTypeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) Clear() PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPfcPauseEtherTypeMetricTag{} + obj.patternFlowPfcPauseEtherTypeMetricTagSlice = []PatternFlowPfcPauseEtherTypeMetricTag{} + } + return obj +} +func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) clearHolderSlice() PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { + if len(obj.patternFlowPfcPauseEtherTypeMetricTagSlice) > 0 { + obj.patternFlowPfcPauseEtherTypeMetricTagSlice = []PatternFlowPfcPauseEtherTypeMetricTag{} + } + return obj +} +func (obj *patternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter) appendHolderSlice(item PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypePatternFlowPfcPauseEtherTypeMetricTagIter { + obj.patternFlowPfcPauseEtherTypeMetricTagSlice = append(obj.patternFlowPfcPauseEtherTypeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowPfcPauseEtherType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseEtherType.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowPfcPauseEtherType.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPfcPauseEtherTypeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPfcPauseEtherType) setDefault() { + var choices_set int = 0 + var choice PatternFlowPfcPauseEtherTypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPfcPauseEtherTypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPfcPauseEtherTypeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPfcPauseEtherTypeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPfcPauseEtherTypeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPfcPauseEtherTypeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPauseEtherType") + } + } else { + intVal := otg.PatternFlowPfcPauseEtherType_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPfcPauseEtherType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_ether_type_counter.go b/gosnappi/pattern_flow_pfc_pause_ether_type_counter.go new file mode 100644 index 00000000..836d62b5 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_ether_type_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowPfcPauseEtherTypeCounter ***** +type patternFlowPfcPauseEtherTypeCounter struct { + validation + obj *otg.PatternFlowPfcPauseEtherTypeCounter + marshaller marshalPatternFlowPfcPauseEtherTypeCounter + unMarshaller unMarshalPatternFlowPfcPauseEtherTypeCounter +} + +func NewPatternFlowPfcPauseEtherTypeCounter() PatternFlowPfcPauseEtherTypeCounter { + obj := patternFlowPfcPauseEtherTypeCounter{obj: &otg.PatternFlowPfcPauseEtherTypeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseEtherTypeCounter) msg() *otg.PatternFlowPfcPauseEtherTypeCounter { + return obj.obj +} + +func (obj *patternFlowPfcPauseEtherTypeCounter) setMsg(msg *otg.PatternFlowPfcPauseEtherTypeCounter) PatternFlowPfcPauseEtherTypeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseEtherTypeCounter struct { + obj *patternFlowPfcPauseEtherTypeCounter +} + +type marshalPatternFlowPfcPauseEtherTypeCounter interface { + // ToProto marshals PatternFlowPfcPauseEtherTypeCounter to protobuf object *otg.PatternFlowPfcPauseEtherTypeCounter + ToProto() (*otg.PatternFlowPfcPauseEtherTypeCounter, error) + // ToPbText marshals PatternFlowPfcPauseEtherTypeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseEtherTypeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseEtherTypeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseEtherTypeCounter struct { + obj *patternFlowPfcPauseEtherTypeCounter +} + +type unMarshalPatternFlowPfcPauseEtherTypeCounter interface { + // FromProto unmarshals PatternFlowPfcPauseEtherTypeCounter from protobuf object *otg.PatternFlowPfcPauseEtherTypeCounter + FromProto(msg *otg.PatternFlowPfcPauseEtherTypeCounter) (PatternFlowPfcPauseEtherTypeCounter, error) + // FromPbText unmarshals PatternFlowPfcPauseEtherTypeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseEtherTypeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseEtherTypeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseEtherTypeCounter) Marshal() marshalPatternFlowPfcPauseEtherTypeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseEtherTypeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseEtherTypeCounter) Unmarshal() unMarshalPatternFlowPfcPauseEtherTypeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseEtherTypeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseEtherTypeCounter) ToProto() (*otg.PatternFlowPfcPauseEtherTypeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseEtherTypeCounter) FromProto(msg *otg.PatternFlowPfcPauseEtherTypeCounter) (PatternFlowPfcPauseEtherTypeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseEtherTypeCounter) 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 *unMarshalpatternFlowPfcPauseEtherTypeCounter) 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 *marshalpatternFlowPfcPauseEtherTypeCounter) 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 *unMarshalpatternFlowPfcPauseEtherTypeCounter) 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 *marshalpatternFlowPfcPauseEtherTypeCounter) 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 *unMarshalpatternFlowPfcPauseEtherTypeCounter) 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 *patternFlowPfcPauseEtherTypeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseEtherTypeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseEtherTypeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseEtherTypeCounter) Clone() (PatternFlowPfcPauseEtherTypeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseEtherTypeCounter() + 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 +} + +// PatternFlowPfcPauseEtherTypeCounter is integer counter pattern +type PatternFlowPfcPauseEtherTypeCounter interface { + Validation + // msg marshals PatternFlowPfcPauseEtherTypeCounter to protobuf object *otg.PatternFlowPfcPauseEtherTypeCounter + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseEtherTypeCounter + // setMsg unmarshals PatternFlowPfcPauseEtherTypeCounter from protobuf object *otg.PatternFlowPfcPauseEtherTypeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseEtherTypeCounter) PatternFlowPfcPauseEtherTypeCounter + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseEtherTypeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseEtherTypeCounter + // validate validates PatternFlowPfcPauseEtherTypeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseEtherTypeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowPfcPauseEtherTypeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowPfcPauseEtherTypeCounter + SetStart(value uint32) PatternFlowPfcPauseEtherTypeCounter + // HasStart checks if Start has been set in PatternFlowPfcPauseEtherTypeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowPfcPauseEtherTypeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowPfcPauseEtherTypeCounter + SetStep(value uint32) PatternFlowPfcPauseEtherTypeCounter + // HasStep checks if Step has been set in PatternFlowPfcPauseEtherTypeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowPfcPauseEtherTypeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPfcPauseEtherTypeCounter + SetCount(value uint32) PatternFlowPfcPauseEtherTypeCounter + // HasCount checks if Count has been set in PatternFlowPfcPauseEtherTypeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPauseEtherTypeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPauseEtherTypeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowPfcPauseEtherTypeCounter object +func (obj *patternFlowPfcPauseEtherTypeCounter) SetStart(value uint32) PatternFlowPfcPauseEtherTypeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPauseEtherTypeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPauseEtherTypeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowPfcPauseEtherTypeCounter object +func (obj *patternFlowPfcPauseEtherTypeCounter) SetStep(value uint32) PatternFlowPfcPauseEtherTypeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPauseEtherTypeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPauseEtherTypeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPfcPauseEtherTypeCounter object +func (obj *patternFlowPfcPauseEtherTypeCounter) SetCount(value uint32) PatternFlowPfcPauseEtherTypeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPfcPauseEtherTypeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseEtherTypeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseEtherTypeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseEtherTypeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowPfcPauseEtherTypeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(34824) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_ether_type_metric_tag.go b/gosnappi/pattern_flow_pfc_pause_ether_type_metric_tag.go new file mode 100644 index 00000000..f5ea2f1b --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_ether_type_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPfcPauseEtherTypeMetricTag ***** +type patternFlowPfcPauseEtherTypeMetricTag struct { + validation + obj *otg.PatternFlowPfcPauseEtherTypeMetricTag + marshaller marshalPatternFlowPfcPauseEtherTypeMetricTag + unMarshaller unMarshalPatternFlowPfcPauseEtherTypeMetricTag +} + +func NewPatternFlowPfcPauseEtherTypeMetricTag() PatternFlowPfcPauseEtherTypeMetricTag { + obj := patternFlowPfcPauseEtherTypeMetricTag{obj: &otg.PatternFlowPfcPauseEtherTypeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseEtherTypeMetricTag) msg() *otg.PatternFlowPfcPauseEtherTypeMetricTag { + return obj.obj +} + +func (obj *patternFlowPfcPauseEtherTypeMetricTag) setMsg(msg *otg.PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseEtherTypeMetricTag struct { + obj *patternFlowPfcPauseEtherTypeMetricTag +} + +type marshalPatternFlowPfcPauseEtherTypeMetricTag interface { + // ToProto marshals PatternFlowPfcPauseEtherTypeMetricTag to protobuf object *otg.PatternFlowPfcPauseEtherTypeMetricTag + ToProto() (*otg.PatternFlowPfcPauseEtherTypeMetricTag, error) + // ToPbText marshals PatternFlowPfcPauseEtherTypeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseEtherTypeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseEtherTypeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseEtherTypeMetricTag struct { + obj *patternFlowPfcPauseEtherTypeMetricTag +} + +type unMarshalPatternFlowPfcPauseEtherTypeMetricTag interface { + // FromProto unmarshals PatternFlowPfcPauseEtherTypeMetricTag from protobuf object *otg.PatternFlowPfcPauseEtherTypeMetricTag + FromProto(msg *otg.PatternFlowPfcPauseEtherTypeMetricTag) (PatternFlowPfcPauseEtherTypeMetricTag, error) + // FromPbText unmarshals PatternFlowPfcPauseEtherTypeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseEtherTypeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseEtherTypeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseEtherTypeMetricTag) Marshal() marshalPatternFlowPfcPauseEtherTypeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseEtherTypeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseEtherTypeMetricTag) Unmarshal() unMarshalPatternFlowPfcPauseEtherTypeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseEtherTypeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseEtherTypeMetricTag) ToProto() (*otg.PatternFlowPfcPauseEtherTypeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseEtherTypeMetricTag) FromProto(msg *otg.PatternFlowPfcPauseEtherTypeMetricTag) (PatternFlowPfcPauseEtherTypeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseEtherTypeMetricTag) 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 *unMarshalpatternFlowPfcPauseEtherTypeMetricTag) 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 *marshalpatternFlowPfcPauseEtherTypeMetricTag) 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 *unMarshalpatternFlowPfcPauseEtherTypeMetricTag) 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 *marshalpatternFlowPfcPauseEtherTypeMetricTag) 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 *unMarshalpatternFlowPfcPauseEtherTypeMetricTag) 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 *patternFlowPfcPauseEtherTypeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseEtherTypeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseEtherTypeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseEtherTypeMetricTag) Clone() (PatternFlowPfcPauseEtherTypeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseEtherTypeMetricTag() + 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 +} + +// PatternFlowPfcPauseEtherTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPfcPauseEtherTypeMetricTag interface { + Validation + // msg marshals PatternFlowPfcPauseEtherTypeMetricTag to protobuf object *otg.PatternFlowPfcPauseEtherTypeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseEtherTypeMetricTag + // setMsg unmarshals PatternFlowPfcPauseEtherTypeMetricTag from protobuf object *otg.PatternFlowPfcPauseEtherTypeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseEtherTypeMetricTag) PatternFlowPfcPauseEtherTypeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseEtherTypeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseEtherTypeMetricTag + // validate validates PatternFlowPfcPauseEtherTypeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseEtherTypeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPfcPauseEtherTypeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPfcPauseEtherTypeMetricTag + SetName(value string) PatternFlowPfcPauseEtherTypeMetricTag + // Offset returns uint32, set in PatternFlowPfcPauseEtherTypeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPfcPauseEtherTypeMetricTag + SetOffset(value uint32) PatternFlowPfcPauseEtherTypeMetricTag + // HasOffset checks if Offset has been set in PatternFlowPfcPauseEtherTypeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPfcPauseEtherTypeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPfcPauseEtherTypeMetricTag + SetLength(value uint32) PatternFlowPfcPauseEtherTypeMetricTag + // HasLength checks if Length has been set in PatternFlowPfcPauseEtherTypeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPfcPauseEtherTypeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPfcPauseEtherTypeMetricTag object +func (obj *patternFlowPfcPauseEtherTypeMetricTag) SetName(value string) PatternFlowPfcPauseEtherTypeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPauseEtherTypeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPauseEtherTypeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPfcPauseEtherTypeMetricTag object +func (obj *patternFlowPfcPauseEtherTypeMetricTag) SetOffset(value uint32) PatternFlowPfcPauseEtherTypeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPauseEtherTypeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPauseEtherTypeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPfcPauseEtherTypeMetricTag object +func (obj *patternFlowPfcPauseEtherTypeMetricTag) SetLength(value uint32) PatternFlowPfcPauseEtherTypeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPfcPauseEtherTypeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPauseEtherTypeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseEtherTypeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPfcPauseEtherTypeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPfcPauseEtherTypeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class0.go b/gosnappi/pattern_flow_pfc_pause_pause_class0.go new file mode 100644 index 00000000..59b6b542 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class0.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass0 ***** +type patternFlowPfcPausePauseClass0 struct { + validation + obj *otg.PatternFlowPfcPausePauseClass0 + marshaller marshalPatternFlowPfcPausePauseClass0 + unMarshaller unMarshalPatternFlowPfcPausePauseClass0 + incrementHolder PatternFlowPfcPausePauseClass0Counter + decrementHolder PatternFlowPfcPausePauseClass0Counter + metricTagsHolder PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter +} + +func NewPatternFlowPfcPausePauseClass0() PatternFlowPfcPausePauseClass0 { + obj := patternFlowPfcPausePauseClass0{obj: &otg.PatternFlowPfcPausePauseClass0{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass0) msg() *otg.PatternFlowPfcPausePauseClass0 { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass0) setMsg(msg *otg.PatternFlowPfcPausePauseClass0) PatternFlowPfcPausePauseClass0 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass0 struct { + obj *patternFlowPfcPausePauseClass0 +} + +type marshalPatternFlowPfcPausePauseClass0 interface { + // ToProto marshals PatternFlowPfcPausePauseClass0 to protobuf object *otg.PatternFlowPfcPausePauseClass0 + ToProto() (*otg.PatternFlowPfcPausePauseClass0, error) + // ToPbText marshals PatternFlowPfcPausePauseClass0 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass0 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass0 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass0 struct { + obj *patternFlowPfcPausePauseClass0 +} + +type unMarshalPatternFlowPfcPausePauseClass0 interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass0 from protobuf object *otg.PatternFlowPfcPausePauseClass0 + FromProto(msg *otg.PatternFlowPfcPausePauseClass0) (PatternFlowPfcPausePauseClass0, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass0 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass0 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass0 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass0) Marshal() marshalPatternFlowPfcPausePauseClass0 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass0{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass0) Unmarshal() unMarshalPatternFlowPfcPausePauseClass0 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass0{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass0) ToProto() (*otg.PatternFlowPfcPausePauseClass0, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass0) FromProto(msg *otg.PatternFlowPfcPausePauseClass0) (PatternFlowPfcPausePauseClass0, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass0) 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 *unMarshalpatternFlowPfcPausePauseClass0) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPfcPausePauseClass0) 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 *unMarshalpatternFlowPfcPausePauseClass0) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPfcPausePauseClass0) 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 *unMarshalpatternFlowPfcPausePauseClass0) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPfcPausePauseClass0) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass0) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass0) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass0) Clone() (PatternFlowPfcPausePauseClass0, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass0() + 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 +} + +func (obj *patternFlowPfcPausePauseClass0) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPfcPausePauseClass0 is pause class 0 +type PatternFlowPfcPausePauseClass0 interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass0 to protobuf object *otg.PatternFlowPfcPausePauseClass0 + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass0 + // setMsg unmarshals PatternFlowPfcPausePauseClass0 from protobuf object *otg.PatternFlowPfcPausePauseClass0 + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass0) PatternFlowPfcPausePauseClass0 + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass0 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass0 + // validate validates PatternFlowPfcPausePauseClass0 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass0, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPfcPausePauseClass0ChoiceEnum, set in PatternFlowPfcPausePauseClass0 + Choice() PatternFlowPfcPausePauseClass0ChoiceEnum + // setChoice assigns PatternFlowPfcPausePauseClass0ChoiceEnum provided by user to PatternFlowPfcPausePauseClass0 + setChoice(value PatternFlowPfcPausePauseClass0ChoiceEnum) PatternFlowPfcPausePauseClass0 + // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass0 + HasChoice() bool + // Value returns uint32, set in PatternFlowPfcPausePauseClass0. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass0 + SetValue(value uint32) PatternFlowPfcPausePauseClass0 + // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass0 + HasValue() bool + // Values returns []uint32, set in PatternFlowPfcPausePauseClass0. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass0 + SetValues(value []uint32) PatternFlowPfcPausePauseClass0 + // Increment returns PatternFlowPfcPausePauseClass0Counter, set in PatternFlowPfcPausePauseClass0. + // PatternFlowPfcPausePauseClass0Counter is integer counter pattern + Increment() PatternFlowPfcPausePauseClass0Counter + // SetIncrement assigns PatternFlowPfcPausePauseClass0Counter provided by user to PatternFlowPfcPausePauseClass0. + // PatternFlowPfcPausePauseClass0Counter is integer counter pattern + SetIncrement(value PatternFlowPfcPausePauseClass0Counter) PatternFlowPfcPausePauseClass0 + // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass0 + HasIncrement() bool + // Decrement returns PatternFlowPfcPausePauseClass0Counter, set in PatternFlowPfcPausePauseClass0. + // PatternFlowPfcPausePauseClass0Counter is integer counter pattern + Decrement() PatternFlowPfcPausePauseClass0Counter + // SetDecrement assigns PatternFlowPfcPausePauseClass0Counter provided by user to PatternFlowPfcPausePauseClass0. + // PatternFlowPfcPausePauseClass0Counter is integer counter pattern + SetDecrement(value PatternFlowPfcPausePauseClass0Counter) PatternFlowPfcPausePauseClass0 + // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass0 + HasDecrement() bool + // MetricTags returns PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIterIter, set in PatternFlowPfcPausePauseClass0 + MetricTags() PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter + setNil() +} + +type PatternFlowPfcPausePauseClass0ChoiceEnum string + +// Enum of Choice on PatternFlowPfcPausePauseClass0 +var PatternFlowPfcPausePauseClass0Choice = struct { + VALUE PatternFlowPfcPausePauseClass0ChoiceEnum + VALUES PatternFlowPfcPausePauseClass0ChoiceEnum + INCREMENT PatternFlowPfcPausePauseClass0ChoiceEnum + DECREMENT PatternFlowPfcPausePauseClass0ChoiceEnum +}{ + VALUE: PatternFlowPfcPausePauseClass0ChoiceEnum("value"), + VALUES: PatternFlowPfcPausePauseClass0ChoiceEnum("values"), + INCREMENT: PatternFlowPfcPausePauseClass0ChoiceEnum("increment"), + DECREMENT: PatternFlowPfcPausePauseClass0ChoiceEnum("decrement"), +} + +func (obj *patternFlowPfcPausePauseClass0) Choice() PatternFlowPfcPausePauseClass0ChoiceEnum { + return PatternFlowPfcPausePauseClass0ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPfcPausePauseClass0) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPfcPausePauseClass0) setChoice(value PatternFlowPfcPausePauseClass0ChoiceEnum) PatternFlowPfcPausePauseClass0 { + intValue, ok := otg.PatternFlowPfcPausePauseClass0_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPfcPausePauseClass0ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPfcPausePauseClass0_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPfcPausePauseClass0Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPfcPausePauseClass0Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPfcPausePauseClass0Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowPfcPausePauseClass0Counter().msg() + } + + if value == PatternFlowPfcPausePauseClass0Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPfcPausePauseClass0Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass0) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPfcPausePauseClass0Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass0) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass0 object +func (obj *patternFlowPfcPausePauseClass0) SetValue(value uint32) PatternFlowPfcPausePauseClass0 { + obj.setChoice(PatternFlowPfcPausePauseClass0Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowPfcPausePauseClass0) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass0 object +func (obj *patternFlowPfcPausePauseClass0) SetValues(value []uint32) PatternFlowPfcPausePauseClass0 { + obj.setChoice(PatternFlowPfcPausePauseClass0Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass0Counter +func (obj *patternFlowPfcPausePauseClass0) Increment() PatternFlowPfcPausePauseClass0Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPfcPausePauseClass0Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPfcPausePauseClass0Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass0Counter +func (obj *patternFlowPfcPausePauseClass0) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPfcPausePauseClass0Counter value in the PatternFlowPfcPausePauseClass0 object +func (obj *patternFlowPfcPausePauseClass0) SetIncrement(value PatternFlowPfcPausePauseClass0Counter) PatternFlowPfcPausePauseClass0 { + obj.setChoice(PatternFlowPfcPausePauseClass0Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass0Counter +func (obj *patternFlowPfcPausePauseClass0) Decrement() PatternFlowPfcPausePauseClass0Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPfcPausePauseClass0Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPfcPausePauseClass0Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass0Counter +func (obj *patternFlowPfcPausePauseClass0) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPfcPausePauseClass0Counter value in the PatternFlowPfcPausePauseClass0 object +func (obj *patternFlowPfcPausePauseClass0) SetDecrement(value PatternFlowPfcPausePauseClass0Counter) PatternFlowPfcPausePauseClass0 { + obj.setChoice(PatternFlowPfcPausePauseClass0Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPfcPausePauseClass0MetricTag +func (obj *patternFlowPfcPausePauseClass0) MetricTags() PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass0MetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter struct { + obj *patternFlowPfcPausePauseClass0 + patternFlowPfcPausePauseClass0MetricTagSlice []PatternFlowPfcPausePauseClass0MetricTag + fieldPtr *[]*otg.PatternFlowPfcPausePauseClass0MetricTag +} + +func newPatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { + return &patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter interface { + setMsg(*patternFlowPfcPausePauseClass0) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter + Items() []PatternFlowPfcPausePauseClass0MetricTag + Add() PatternFlowPfcPausePauseClass0MetricTag + Append(items ...PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter + Set(index int, newObj PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter + Clear() PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter + clearHolderSlice() PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter + appendHolderSlice(item PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter +} + +func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass0) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPfcPausePauseClass0MetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) Items() []PatternFlowPfcPausePauseClass0MetricTag { + return obj.patternFlowPfcPausePauseClass0MetricTagSlice +} + +func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) Add() PatternFlowPfcPausePauseClass0MetricTag { + newObj := &otg.PatternFlowPfcPausePauseClass0MetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPfcPausePauseClass0MetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPfcPausePauseClass0MetricTagSlice = append(obj.patternFlowPfcPausePauseClass0MetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPfcPausePauseClass0MetricTagSlice = append(obj.patternFlowPfcPausePauseClass0MetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPfcPausePauseClass0MetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) Clear() PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass0MetricTag{} + obj.patternFlowPfcPausePauseClass0MetricTagSlice = []PatternFlowPfcPausePauseClass0MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { + if len(obj.patternFlowPfcPausePauseClass0MetricTagSlice) > 0 { + obj.patternFlowPfcPausePauseClass0MetricTagSlice = []PatternFlowPfcPausePauseClass0MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0PatternFlowPfcPausePauseClass0MetricTagIter { + obj.patternFlowPfcPausePauseClass0MetricTagSlice = append(obj.patternFlowPfcPausePauseClass0MetricTagSlice, item) + return obj +} + +func (obj *patternFlowPfcPausePauseClass0) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass0.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass0.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass0MetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass0) setDefault() { + var choices_set int = 0 + var choice PatternFlowPfcPausePauseClass0ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass0Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass0Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass0Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass0Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPfcPausePauseClass0Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass0") + } + } else { + intVal := otg.PatternFlowPfcPausePauseClass0_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPfcPausePauseClass0_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class0_counter.go b/gosnappi/pattern_flow_pfc_pause_pause_class0_counter.go new file mode 100644 index 00000000..8891cd7f --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class0_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass0Counter ***** +type patternFlowPfcPausePauseClass0Counter struct { + validation + obj *otg.PatternFlowPfcPausePauseClass0Counter + marshaller marshalPatternFlowPfcPausePauseClass0Counter + unMarshaller unMarshalPatternFlowPfcPausePauseClass0Counter +} + +func NewPatternFlowPfcPausePauseClass0Counter() PatternFlowPfcPausePauseClass0Counter { + obj := patternFlowPfcPausePauseClass0Counter{obj: &otg.PatternFlowPfcPausePauseClass0Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass0Counter) msg() *otg.PatternFlowPfcPausePauseClass0Counter { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass0Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass0Counter) PatternFlowPfcPausePauseClass0Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass0Counter struct { + obj *patternFlowPfcPausePauseClass0Counter +} + +type marshalPatternFlowPfcPausePauseClass0Counter interface { + // ToProto marshals PatternFlowPfcPausePauseClass0Counter to protobuf object *otg.PatternFlowPfcPausePauseClass0Counter + ToProto() (*otg.PatternFlowPfcPausePauseClass0Counter, error) + // ToPbText marshals PatternFlowPfcPausePauseClass0Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass0Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass0Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass0Counter struct { + obj *patternFlowPfcPausePauseClass0Counter +} + +type unMarshalPatternFlowPfcPausePauseClass0Counter interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass0Counter from protobuf object *otg.PatternFlowPfcPausePauseClass0Counter + FromProto(msg *otg.PatternFlowPfcPausePauseClass0Counter) (PatternFlowPfcPausePauseClass0Counter, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass0Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass0Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass0Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass0Counter) Marshal() marshalPatternFlowPfcPausePauseClass0Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass0Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass0Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass0Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass0Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass0Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass0Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass0Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass0Counter) (PatternFlowPfcPausePauseClass0Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass0Counter) 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 *unMarshalpatternFlowPfcPausePauseClass0Counter) 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 *marshalpatternFlowPfcPausePauseClass0Counter) 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 *unMarshalpatternFlowPfcPausePauseClass0Counter) 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 *marshalpatternFlowPfcPausePauseClass0Counter) 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 *unMarshalpatternFlowPfcPausePauseClass0Counter) 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 *patternFlowPfcPausePauseClass0Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass0Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass0Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass0Counter) Clone() (PatternFlowPfcPausePauseClass0Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass0Counter() + 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 +} + +// PatternFlowPfcPausePauseClass0Counter is integer counter pattern +type PatternFlowPfcPausePauseClass0Counter interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass0Counter to protobuf object *otg.PatternFlowPfcPausePauseClass0Counter + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass0Counter + // setMsg unmarshals PatternFlowPfcPausePauseClass0Counter from protobuf object *otg.PatternFlowPfcPausePauseClass0Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass0Counter) PatternFlowPfcPausePauseClass0Counter + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass0Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass0Counter + // validate validates PatternFlowPfcPausePauseClass0Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass0Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowPfcPausePauseClass0Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass0Counter + SetStart(value uint32) PatternFlowPfcPausePauseClass0Counter + // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass0Counter + HasStart() bool + // Step returns uint32, set in PatternFlowPfcPausePauseClass0Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass0Counter + SetStep(value uint32) PatternFlowPfcPausePauseClass0Counter + // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass0Counter + HasStep() bool + // Count returns uint32, set in PatternFlowPfcPausePauseClass0Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass0Counter + SetCount(value uint32) PatternFlowPfcPausePauseClass0Counter + // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass0Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass0Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass0Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass0Counter object +func (obj *patternFlowPfcPausePauseClass0Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass0Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass0Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass0Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass0Counter object +func (obj *patternFlowPfcPausePauseClass0Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass0Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass0Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass0Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass0Counter object +func (obj *patternFlowPfcPausePauseClass0Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass0Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass0Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass0Counter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass0Counter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass0Counter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass0Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class0_metric_tag.go b/gosnappi/pattern_flow_pfc_pause_pause_class0_metric_tag.go new file mode 100644 index 00000000..9be0240e --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class0_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass0MetricTag ***** +type patternFlowPfcPausePauseClass0MetricTag struct { + validation + obj *otg.PatternFlowPfcPausePauseClass0MetricTag + marshaller marshalPatternFlowPfcPausePauseClass0MetricTag + unMarshaller unMarshalPatternFlowPfcPausePauseClass0MetricTag +} + +func NewPatternFlowPfcPausePauseClass0MetricTag() PatternFlowPfcPausePauseClass0MetricTag { + obj := patternFlowPfcPausePauseClass0MetricTag{obj: &otg.PatternFlowPfcPausePauseClass0MetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass0MetricTag) msg() *otg.PatternFlowPfcPausePauseClass0MetricTag { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass0MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0MetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass0MetricTag struct { + obj *patternFlowPfcPausePauseClass0MetricTag +} + +type marshalPatternFlowPfcPausePauseClass0MetricTag interface { + // ToProto marshals PatternFlowPfcPausePauseClass0MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass0MetricTag + ToProto() (*otg.PatternFlowPfcPausePauseClass0MetricTag, error) + // ToPbText marshals PatternFlowPfcPausePauseClass0MetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass0MetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass0MetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass0MetricTag struct { + obj *patternFlowPfcPausePauseClass0MetricTag +} + +type unMarshalPatternFlowPfcPausePauseClass0MetricTag interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass0MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass0MetricTag + FromProto(msg *otg.PatternFlowPfcPausePauseClass0MetricTag) (PatternFlowPfcPausePauseClass0MetricTag, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass0MetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass0MetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass0MetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass0MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass0MetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass0MetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass0MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass0MetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass0MetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass0MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass0MetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass0MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass0MetricTag) (PatternFlowPfcPausePauseClass0MetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass0MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass0MetricTag) 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 *marshalpatternFlowPfcPausePauseClass0MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass0MetricTag) 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 *marshalpatternFlowPfcPausePauseClass0MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass0MetricTag) 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 *patternFlowPfcPausePauseClass0MetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass0MetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass0MetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass0MetricTag) Clone() (PatternFlowPfcPausePauseClass0MetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass0MetricTag() + 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 +} + +// PatternFlowPfcPausePauseClass0MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPfcPausePauseClass0MetricTag interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass0MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass0MetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass0MetricTag + // setMsg unmarshals PatternFlowPfcPausePauseClass0MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass0MetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass0MetricTag) PatternFlowPfcPausePauseClass0MetricTag + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass0MetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass0MetricTag + // validate validates PatternFlowPfcPausePauseClass0MetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass0MetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPfcPausePauseClass0MetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPfcPausePauseClass0MetricTag + SetName(value string) PatternFlowPfcPausePauseClass0MetricTag + // Offset returns uint32, set in PatternFlowPfcPausePauseClass0MetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass0MetricTag + SetOffset(value uint32) PatternFlowPfcPausePauseClass0MetricTag + // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass0MetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPfcPausePauseClass0MetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass0MetricTag + SetLength(value uint32) PatternFlowPfcPausePauseClass0MetricTag + // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass0MetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPfcPausePauseClass0MetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPfcPausePauseClass0MetricTag object +func (obj *patternFlowPfcPausePauseClass0MetricTag) SetName(value string) PatternFlowPfcPausePauseClass0MetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass0MetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass0MetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass0MetricTag object +func (obj *patternFlowPfcPausePauseClass0MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass0MetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass0MetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass0MetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass0MetricTag object +func (obj *patternFlowPfcPausePauseClass0MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass0MetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass0MetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass0MetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass0MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass0MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass0MetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class1.go b/gosnappi/pattern_flow_pfc_pause_pause_class1.go new file mode 100644 index 00000000..7b7b35df --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class1.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass1 ***** +type patternFlowPfcPausePauseClass1 struct { + validation + obj *otg.PatternFlowPfcPausePauseClass1 + marshaller marshalPatternFlowPfcPausePauseClass1 + unMarshaller unMarshalPatternFlowPfcPausePauseClass1 + incrementHolder PatternFlowPfcPausePauseClass1Counter + decrementHolder PatternFlowPfcPausePauseClass1Counter + metricTagsHolder PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter +} + +func NewPatternFlowPfcPausePauseClass1() PatternFlowPfcPausePauseClass1 { + obj := patternFlowPfcPausePauseClass1{obj: &otg.PatternFlowPfcPausePauseClass1{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass1) msg() *otg.PatternFlowPfcPausePauseClass1 { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass1) setMsg(msg *otg.PatternFlowPfcPausePauseClass1) PatternFlowPfcPausePauseClass1 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass1 struct { + obj *patternFlowPfcPausePauseClass1 +} + +type marshalPatternFlowPfcPausePauseClass1 interface { + // ToProto marshals PatternFlowPfcPausePauseClass1 to protobuf object *otg.PatternFlowPfcPausePauseClass1 + ToProto() (*otg.PatternFlowPfcPausePauseClass1, error) + // ToPbText marshals PatternFlowPfcPausePauseClass1 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass1 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass1 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass1 struct { + obj *patternFlowPfcPausePauseClass1 +} + +type unMarshalPatternFlowPfcPausePauseClass1 interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass1 from protobuf object *otg.PatternFlowPfcPausePauseClass1 + FromProto(msg *otg.PatternFlowPfcPausePauseClass1) (PatternFlowPfcPausePauseClass1, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass1 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass1 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass1 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass1) Marshal() marshalPatternFlowPfcPausePauseClass1 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass1{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass1) Unmarshal() unMarshalPatternFlowPfcPausePauseClass1 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass1{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass1) ToProto() (*otg.PatternFlowPfcPausePauseClass1, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass1) FromProto(msg *otg.PatternFlowPfcPausePauseClass1) (PatternFlowPfcPausePauseClass1, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass1) 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 *unMarshalpatternFlowPfcPausePauseClass1) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPfcPausePauseClass1) 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 *unMarshalpatternFlowPfcPausePauseClass1) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPfcPausePauseClass1) 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 *unMarshalpatternFlowPfcPausePauseClass1) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPfcPausePauseClass1) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass1) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass1) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass1) Clone() (PatternFlowPfcPausePauseClass1, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass1() + 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 +} + +func (obj *patternFlowPfcPausePauseClass1) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPfcPausePauseClass1 is pause class 1 +type PatternFlowPfcPausePauseClass1 interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass1 to protobuf object *otg.PatternFlowPfcPausePauseClass1 + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass1 + // setMsg unmarshals PatternFlowPfcPausePauseClass1 from protobuf object *otg.PatternFlowPfcPausePauseClass1 + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass1) PatternFlowPfcPausePauseClass1 + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass1 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass1 + // validate validates PatternFlowPfcPausePauseClass1 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass1, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPfcPausePauseClass1ChoiceEnum, set in PatternFlowPfcPausePauseClass1 + Choice() PatternFlowPfcPausePauseClass1ChoiceEnum + // setChoice assigns PatternFlowPfcPausePauseClass1ChoiceEnum provided by user to PatternFlowPfcPausePauseClass1 + setChoice(value PatternFlowPfcPausePauseClass1ChoiceEnum) PatternFlowPfcPausePauseClass1 + // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass1 + HasChoice() bool + // Value returns uint32, set in PatternFlowPfcPausePauseClass1. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass1 + SetValue(value uint32) PatternFlowPfcPausePauseClass1 + // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass1 + HasValue() bool + // Values returns []uint32, set in PatternFlowPfcPausePauseClass1. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass1 + SetValues(value []uint32) PatternFlowPfcPausePauseClass1 + // Increment returns PatternFlowPfcPausePauseClass1Counter, set in PatternFlowPfcPausePauseClass1. + // PatternFlowPfcPausePauseClass1Counter is integer counter pattern + Increment() PatternFlowPfcPausePauseClass1Counter + // SetIncrement assigns PatternFlowPfcPausePauseClass1Counter provided by user to PatternFlowPfcPausePauseClass1. + // PatternFlowPfcPausePauseClass1Counter is integer counter pattern + SetIncrement(value PatternFlowPfcPausePauseClass1Counter) PatternFlowPfcPausePauseClass1 + // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass1 + HasIncrement() bool + // Decrement returns PatternFlowPfcPausePauseClass1Counter, set in PatternFlowPfcPausePauseClass1. + // PatternFlowPfcPausePauseClass1Counter is integer counter pattern + Decrement() PatternFlowPfcPausePauseClass1Counter + // SetDecrement assigns PatternFlowPfcPausePauseClass1Counter provided by user to PatternFlowPfcPausePauseClass1. + // PatternFlowPfcPausePauseClass1Counter is integer counter pattern + SetDecrement(value PatternFlowPfcPausePauseClass1Counter) PatternFlowPfcPausePauseClass1 + // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass1 + HasDecrement() bool + // MetricTags returns PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIterIter, set in PatternFlowPfcPausePauseClass1 + MetricTags() PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter + setNil() +} + +type PatternFlowPfcPausePauseClass1ChoiceEnum string + +// Enum of Choice on PatternFlowPfcPausePauseClass1 +var PatternFlowPfcPausePauseClass1Choice = struct { + VALUE PatternFlowPfcPausePauseClass1ChoiceEnum + VALUES PatternFlowPfcPausePauseClass1ChoiceEnum + INCREMENT PatternFlowPfcPausePauseClass1ChoiceEnum + DECREMENT PatternFlowPfcPausePauseClass1ChoiceEnum +}{ + VALUE: PatternFlowPfcPausePauseClass1ChoiceEnum("value"), + VALUES: PatternFlowPfcPausePauseClass1ChoiceEnum("values"), + INCREMENT: PatternFlowPfcPausePauseClass1ChoiceEnum("increment"), + DECREMENT: PatternFlowPfcPausePauseClass1ChoiceEnum("decrement"), +} + +func (obj *patternFlowPfcPausePauseClass1) Choice() PatternFlowPfcPausePauseClass1ChoiceEnum { + return PatternFlowPfcPausePauseClass1ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPfcPausePauseClass1) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPfcPausePauseClass1) setChoice(value PatternFlowPfcPausePauseClass1ChoiceEnum) PatternFlowPfcPausePauseClass1 { + intValue, ok := otg.PatternFlowPfcPausePauseClass1_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPfcPausePauseClass1ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPfcPausePauseClass1_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPfcPausePauseClass1Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPfcPausePauseClass1Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPfcPausePauseClass1Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowPfcPausePauseClass1Counter().msg() + } + + if value == PatternFlowPfcPausePauseClass1Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPfcPausePauseClass1Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass1) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPfcPausePauseClass1Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass1) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass1 object +func (obj *patternFlowPfcPausePauseClass1) SetValue(value uint32) PatternFlowPfcPausePauseClass1 { + obj.setChoice(PatternFlowPfcPausePauseClass1Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowPfcPausePauseClass1) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass1 object +func (obj *patternFlowPfcPausePauseClass1) SetValues(value []uint32) PatternFlowPfcPausePauseClass1 { + obj.setChoice(PatternFlowPfcPausePauseClass1Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass1Counter +func (obj *patternFlowPfcPausePauseClass1) Increment() PatternFlowPfcPausePauseClass1Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPfcPausePauseClass1Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPfcPausePauseClass1Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass1Counter +func (obj *patternFlowPfcPausePauseClass1) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPfcPausePauseClass1Counter value in the PatternFlowPfcPausePauseClass1 object +func (obj *patternFlowPfcPausePauseClass1) SetIncrement(value PatternFlowPfcPausePauseClass1Counter) PatternFlowPfcPausePauseClass1 { + obj.setChoice(PatternFlowPfcPausePauseClass1Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass1Counter +func (obj *patternFlowPfcPausePauseClass1) Decrement() PatternFlowPfcPausePauseClass1Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPfcPausePauseClass1Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPfcPausePauseClass1Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass1Counter +func (obj *patternFlowPfcPausePauseClass1) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPfcPausePauseClass1Counter value in the PatternFlowPfcPausePauseClass1 object +func (obj *patternFlowPfcPausePauseClass1) SetDecrement(value PatternFlowPfcPausePauseClass1Counter) PatternFlowPfcPausePauseClass1 { + obj.setChoice(PatternFlowPfcPausePauseClass1Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPfcPausePauseClass1MetricTag +func (obj *patternFlowPfcPausePauseClass1) MetricTags() PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass1MetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter struct { + obj *patternFlowPfcPausePauseClass1 + patternFlowPfcPausePauseClass1MetricTagSlice []PatternFlowPfcPausePauseClass1MetricTag + fieldPtr *[]*otg.PatternFlowPfcPausePauseClass1MetricTag +} + +func newPatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { + return &patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter interface { + setMsg(*patternFlowPfcPausePauseClass1) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter + Items() []PatternFlowPfcPausePauseClass1MetricTag + Add() PatternFlowPfcPausePauseClass1MetricTag + Append(items ...PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter + Set(index int, newObj PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter + Clear() PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter + clearHolderSlice() PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter + appendHolderSlice(item PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter +} + +func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass1) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPfcPausePauseClass1MetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) Items() []PatternFlowPfcPausePauseClass1MetricTag { + return obj.patternFlowPfcPausePauseClass1MetricTagSlice +} + +func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) Add() PatternFlowPfcPausePauseClass1MetricTag { + newObj := &otg.PatternFlowPfcPausePauseClass1MetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPfcPausePauseClass1MetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPfcPausePauseClass1MetricTagSlice = append(obj.patternFlowPfcPausePauseClass1MetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPfcPausePauseClass1MetricTagSlice = append(obj.patternFlowPfcPausePauseClass1MetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPfcPausePauseClass1MetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) Clear() PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass1MetricTag{} + obj.patternFlowPfcPausePauseClass1MetricTagSlice = []PatternFlowPfcPausePauseClass1MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { + if len(obj.patternFlowPfcPausePauseClass1MetricTagSlice) > 0 { + obj.patternFlowPfcPausePauseClass1MetricTagSlice = []PatternFlowPfcPausePauseClass1MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1PatternFlowPfcPausePauseClass1MetricTagIter { + obj.patternFlowPfcPausePauseClass1MetricTagSlice = append(obj.patternFlowPfcPausePauseClass1MetricTagSlice, item) + return obj +} + +func (obj *patternFlowPfcPausePauseClass1) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass1.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass1.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass1MetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass1) setDefault() { + var choices_set int = 0 + var choice PatternFlowPfcPausePauseClass1ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass1Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass1Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass1Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass1Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPfcPausePauseClass1Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass1") + } + } else { + intVal := otg.PatternFlowPfcPausePauseClass1_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPfcPausePauseClass1_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class1_counter.go b/gosnappi/pattern_flow_pfc_pause_pause_class1_counter.go new file mode 100644 index 00000000..a5d154d3 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class1_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass1Counter ***** +type patternFlowPfcPausePauseClass1Counter struct { + validation + obj *otg.PatternFlowPfcPausePauseClass1Counter + marshaller marshalPatternFlowPfcPausePauseClass1Counter + unMarshaller unMarshalPatternFlowPfcPausePauseClass1Counter +} + +func NewPatternFlowPfcPausePauseClass1Counter() PatternFlowPfcPausePauseClass1Counter { + obj := patternFlowPfcPausePauseClass1Counter{obj: &otg.PatternFlowPfcPausePauseClass1Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass1Counter) msg() *otg.PatternFlowPfcPausePauseClass1Counter { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass1Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass1Counter) PatternFlowPfcPausePauseClass1Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass1Counter struct { + obj *patternFlowPfcPausePauseClass1Counter +} + +type marshalPatternFlowPfcPausePauseClass1Counter interface { + // ToProto marshals PatternFlowPfcPausePauseClass1Counter to protobuf object *otg.PatternFlowPfcPausePauseClass1Counter + ToProto() (*otg.PatternFlowPfcPausePauseClass1Counter, error) + // ToPbText marshals PatternFlowPfcPausePauseClass1Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass1Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass1Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass1Counter struct { + obj *patternFlowPfcPausePauseClass1Counter +} + +type unMarshalPatternFlowPfcPausePauseClass1Counter interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass1Counter from protobuf object *otg.PatternFlowPfcPausePauseClass1Counter + FromProto(msg *otg.PatternFlowPfcPausePauseClass1Counter) (PatternFlowPfcPausePauseClass1Counter, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass1Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass1Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass1Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass1Counter) Marshal() marshalPatternFlowPfcPausePauseClass1Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass1Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass1Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass1Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass1Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass1Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass1Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass1Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass1Counter) (PatternFlowPfcPausePauseClass1Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass1Counter) 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 *unMarshalpatternFlowPfcPausePauseClass1Counter) 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 *marshalpatternFlowPfcPausePauseClass1Counter) 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 *unMarshalpatternFlowPfcPausePauseClass1Counter) 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 *marshalpatternFlowPfcPausePauseClass1Counter) 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 *unMarshalpatternFlowPfcPausePauseClass1Counter) 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 *patternFlowPfcPausePauseClass1Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass1Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass1Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass1Counter) Clone() (PatternFlowPfcPausePauseClass1Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass1Counter() + 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 +} + +// PatternFlowPfcPausePauseClass1Counter is integer counter pattern +type PatternFlowPfcPausePauseClass1Counter interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass1Counter to protobuf object *otg.PatternFlowPfcPausePauseClass1Counter + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass1Counter + // setMsg unmarshals PatternFlowPfcPausePauseClass1Counter from protobuf object *otg.PatternFlowPfcPausePauseClass1Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass1Counter) PatternFlowPfcPausePauseClass1Counter + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass1Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass1Counter + // validate validates PatternFlowPfcPausePauseClass1Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass1Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowPfcPausePauseClass1Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass1Counter + SetStart(value uint32) PatternFlowPfcPausePauseClass1Counter + // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass1Counter + HasStart() bool + // Step returns uint32, set in PatternFlowPfcPausePauseClass1Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass1Counter + SetStep(value uint32) PatternFlowPfcPausePauseClass1Counter + // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass1Counter + HasStep() bool + // Count returns uint32, set in PatternFlowPfcPausePauseClass1Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass1Counter + SetCount(value uint32) PatternFlowPfcPausePauseClass1Counter + // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass1Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass1Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass1Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass1Counter object +func (obj *patternFlowPfcPausePauseClass1Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass1Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass1Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass1Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass1Counter object +func (obj *patternFlowPfcPausePauseClass1Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass1Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass1Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass1Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass1Counter object +func (obj *patternFlowPfcPausePauseClass1Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass1Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass1Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass1Counter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass1Counter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass1Counter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass1Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class1_metric_tag.go b/gosnappi/pattern_flow_pfc_pause_pause_class1_metric_tag.go new file mode 100644 index 00000000..dd878414 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class1_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass1MetricTag ***** +type patternFlowPfcPausePauseClass1MetricTag struct { + validation + obj *otg.PatternFlowPfcPausePauseClass1MetricTag + marshaller marshalPatternFlowPfcPausePauseClass1MetricTag + unMarshaller unMarshalPatternFlowPfcPausePauseClass1MetricTag +} + +func NewPatternFlowPfcPausePauseClass1MetricTag() PatternFlowPfcPausePauseClass1MetricTag { + obj := patternFlowPfcPausePauseClass1MetricTag{obj: &otg.PatternFlowPfcPausePauseClass1MetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass1MetricTag) msg() *otg.PatternFlowPfcPausePauseClass1MetricTag { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass1MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1MetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass1MetricTag struct { + obj *patternFlowPfcPausePauseClass1MetricTag +} + +type marshalPatternFlowPfcPausePauseClass1MetricTag interface { + // ToProto marshals PatternFlowPfcPausePauseClass1MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass1MetricTag + ToProto() (*otg.PatternFlowPfcPausePauseClass1MetricTag, error) + // ToPbText marshals PatternFlowPfcPausePauseClass1MetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass1MetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass1MetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass1MetricTag struct { + obj *patternFlowPfcPausePauseClass1MetricTag +} + +type unMarshalPatternFlowPfcPausePauseClass1MetricTag interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass1MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass1MetricTag + FromProto(msg *otg.PatternFlowPfcPausePauseClass1MetricTag) (PatternFlowPfcPausePauseClass1MetricTag, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass1MetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass1MetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass1MetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass1MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass1MetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass1MetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass1MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass1MetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass1MetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass1MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass1MetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass1MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass1MetricTag) (PatternFlowPfcPausePauseClass1MetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass1MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass1MetricTag) 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 *marshalpatternFlowPfcPausePauseClass1MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass1MetricTag) 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 *marshalpatternFlowPfcPausePauseClass1MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass1MetricTag) 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 *patternFlowPfcPausePauseClass1MetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass1MetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass1MetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass1MetricTag) Clone() (PatternFlowPfcPausePauseClass1MetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass1MetricTag() + 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 +} + +// PatternFlowPfcPausePauseClass1MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPfcPausePauseClass1MetricTag interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass1MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass1MetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass1MetricTag + // setMsg unmarshals PatternFlowPfcPausePauseClass1MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass1MetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass1MetricTag) PatternFlowPfcPausePauseClass1MetricTag + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass1MetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass1MetricTag + // validate validates PatternFlowPfcPausePauseClass1MetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass1MetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPfcPausePauseClass1MetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPfcPausePauseClass1MetricTag + SetName(value string) PatternFlowPfcPausePauseClass1MetricTag + // Offset returns uint32, set in PatternFlowPfcPausePauseClass1MetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass1MetricTag + SetOffset(value uint32) PatternFlowPfcPausePauseClass1MetricTag + // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass1MetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPfcPausePauseClass1MetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass1MetricTag + SetLength(value uint32) PatternFlowPfcPausePauseClass1MetricTag + // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass1MetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPfcPausePauseClass1MetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPfcPausePauseClass1MetricTag object +func (obj *patternFlowPfcPausePauseClass1MetricTag) SetName(value string) PatternFlowPfcPausePauseClass1MetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass1MetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass1MetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass1MetricTag object +func (obj *patternFlowPfcPausePauseClass1MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass1MetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass1MetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass1MetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass1MetricTag object +func (obj *patternFlowPfcPausePauseClass1MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass1MetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass1MetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass1MetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass1MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass1MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass1MetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class2.go b/gosnappi/pattern_flow_pfc_pause_pause_class2.go new file mode 100644 index 00000000..7847611b --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class2.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass2 ***** +type patternFlowPfcPausePauseClass2 struct { + validation + obj *otg.PatternFlowPfcPausePauseClass2 + marshaller marshalPatternFlowPfcPausePauseClass2 + unMarshaller unMarshalPatternFlowPfcPausePauseClass2 + incrementHolder PatternFlowPfcPausePauseClass2Counter + decrementHolder PatternFlowPfcPausePauseClass2Counter + metricTagsHolder PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter +} + +func NewPatternFlowPfcPausePauseClass2() PatternFlowPfcPausePauseClass2 { + obj := patternFlowPfcPausePauseClass2{obj: &otg.PatternFlowPfcPausePauseClass2{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass2) msg() *otg.PatternFlowPfcPausePauseClass2 { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass2) setMsg(msg *otg.PatternFlowPfcPausePauseClass2) PatternFlowPfcPausePauseClass2 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass2 struct { + obj *patternFlowPfcPausePauseClass2 +} + +type marshalPatternFlowPfcPausePauseClass2 interface { + // ToProto marshals PatternFlowPfcPausePauseClass2 to protobuf object *otg.PatternFlowPfcPausePauseClass2 + ToProto() (*otg.PatternFlowPfcPausePauseClass2, error) + // ToPbText marshals PatternFlowPfcPausePauseClass2 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass2 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass2 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass2 struct { + obj *patternFlowPfcPausePauseClass2 +} + +type unMarshalPatternFlowPfcPausePauseClass2 interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass2 from protobuf object *otg.PatternFlowPfcPausePauseClass2 + FromProto(msg *otg.PatternFlowPfcPausePauseClass2) (PatternFlowPfcPausePauseClass2, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass2 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass2 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass2 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass2) Marshal() marshalPatternFlowPfcPausePauseClass2 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass2{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass2) Unmarshal() unMarshalPatternFlowPfcPausePauseClass2 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass2{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass2) ToProto() (*otg.PatternFlowPfcPausePauseClass2, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass2) FromProto(msg *otg.PatternFlowPfcPausePauseClass2) (PatternFlowPfcPausePauseClass2, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass2) 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 *unMarshalpatternFlowPfcPausePauseClass2) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPfcPausePauseClass2) 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 *unMarshalpatternFlowPfcPausePauseClass2) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPfcPausePauseClass2) 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 *unMarshalpatternFlowPfcPausePauseClass2) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPfcPausePauseClass2) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass2) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass2) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass2) Clone() (PatternFlowPfcPausePauseClass2, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass2() + 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 +} + +func (obj *patternFlowPfcPausePauseClass2) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPfcPausePauseClass2 is pause class 2 +type PatternFlowPfcPausePauseClass2 interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass2 to protobuf object *otg.PatternFlowPfcPausePauseClass2 + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass2 + // setMsg unmarshals PatternFlowPfcPausePauseClass2 from protobuf object *otg.PatternFlowPfcPausePauseClass2 + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass2) PatternFlowPfcPausePauseClass2 + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass2 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass2 + // validate validates PatternFlowPfcPausePauseClass2 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass2, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPfcPausePauseClass2ChoiceEnum, set in PatternFlowPfcPausePauseClass2 + Choice() PatternFlowPfcPausePauseClass2ChoiceEnum + // setChoice assigns PatternFlowPfcPausePauseClass2ChoiceEnum provided by user to PatternFlowPfcPausePauseClass2 + setChoice(value PatternFlowPfcPausePauseClass2ChoiceEnum) PatternFlowPfcPausePauseClass2 + // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass2 + HasChoice() bool + // Value returns uint32, set in PatternFlowPfcPausePauseClass2. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass2 + SetValue(value uint32) PatternFlowPfcPausePauseClass2 + // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass2 + HasValue() bool + // Values returns []uint32, set in PatternFlowPfcPausePauseClass2. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass2 + SetValues(value []uint32) PatternFlowPfcPausePauseClass2 + // Increment returns PatternFlowPfcPausePauseClass2Counter, set in PatternFlowPfcPausePauseClass2. + // PatternFlowPfcPausePauseClass2Counter is integer counter pattern + Increment() PatternFlowPfcPausePauseClass2Counter + // SetIncrement assigns PatternFlowPfcPausePauseClass2Counter provided by user to PatternFlowPfcPausePauseClass2. + // PatternFlowPfcPausePauseClass2Counter is integer counter pattern + SetIncrement(value PatternFlowPfcPausePauseClass2Counter) PatternFlowPfcPausePauseClass2 + // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass2 + HasIncrement() bool + // Decrement returns PatternFlowPfcPausePauseClass2Counter, set in PatternFlowPfcPausePauseClass2. + // PatternFlowPfcPausePauseClass2Counter is integer counter pattern + Decrement() PatternFlowPfcPausePauseClass2Counter + // SetDecrement assigns PatternFlowPfcPausePauseClass2Counter provided by user to PatternFlowPfcPausePauseClass2. + // PatternFlowPfcPausePauseClass2Counter is integer counter pattern + SetDecrement(value PatternFlowPfcPausePauseClass2Counter) PatternFlowPfcPausePauseClass2 + // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass2 + HasDecrement() bool + // MetricTags returns PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIterIter, set in PatternFlowPfcPausePauseClass2 + MetricTags() PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter + setNil() +} + +type PatternFlowPfcPausePauseClass2ChoiceEnum string + +// Enum of Choice on PatternFlowPfcPausePauseClass2 +var PatternFlowPfcPausePauseClass2Choice = struct { + VALUE PatternFlowPfcPausePauseClass2ChoiceEnum + VALUES PatternFlowPfcPausePauseClass2ChoiceEnum + INCREMENT PatternFlowPfcPausePauseClass2ChoiceEnum + DECREMENT PatternFlowPfcPausePauseClass2ChoiceEnum +}{ + VALUE: PatternFlowPfcPausePauseClass2ChoiceEnum("value"), + VALUES: PatternFlowPfcPausePauseClass2ChoiceEnum("values"), + INCREMENT: PatternFlowPfcPausePauseClass2ChoiceEnum("increment"), + DECREMENT: PatternFlowPfcPausePauseClass2ChoiceEnum("decrement"), +} + +func (obj *patternFlowPfcPausePauseClass2) Choice() PatternFlowPfcPausePauseClass2ChoiceEnum { + return PatternFlowPfcPausePauseClass2ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPfcPausePauseClass2) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPfcPausePauseClass2) setChoice(value PatternFlowPfcPausePauseClass2ChoiceEnum) PatternFlowPfcPausePauseClass2 { + intValue, ok := otg.PatternFlowPfcPausePauseClass2_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPfcPausePauseClass2ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPfcPausePauseClass2_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPfcPausePauseClass2Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPfcPausePauseClass2Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPfcPausePauseClass2Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowPfcPausePauseClass2Counter().msg() + } + + if value == PatternFlowPfcPausePauseClass2Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPfcPausePauseClass2Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass2) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPfcPausePauseClass2Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass2) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass2 object +func (obj *patternFlowPfcPausePauseClass2) SetValue(value uint32) PatternFlowPfcPausePauseClass2 { + obj.setChoice(PatternFlowPfcPausePauseClass2Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowPfcPausePauseClass2) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass2 object +func (obj *patternFlowPfcPausePauseClass2) SetValues(value []uint32) PatternFlowPfcPausePauseClass2 { + obj.setChoice(PatternFlowPfcPausePauseClass2Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass2Counter +func (obj *patternFlowPfcPausePauseClass2) Increment() PatternFlowPfcPausePauseClass2Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPfcPausePauseClass2Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPfcPausePauseClass2Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass2Counter +func (obj *patternFlowPfcPausePauseClass2) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPfcPausePauseClass2Counter value in the PatternFlowPfcPausePauseClass2 object +func (obj *patternFlowPfcPausePauseClass2) SetIncrement(value PatternFlowPfcPausePauseClass2Counter) PatternFlowPfcPausePauseClass2 { + obj.setChoice(PatternFlowPfcPausePauseClass2Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass2Counter +func (obj *patternFlowPfcPausePauseClass2) Decrement() PatternFlowPfcPausePauseClass2Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPfcPausePauseClass2Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPfcPausePauseClass2Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass2Counter +func (obj *patternFlowPfcPausePauseClass2) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPfcPausePauseClass2Counter value in the PatternFlowPfcPausePauseClass2 object +func (obj *patternFlowPfcPausePauseClass2) SetDecrement(value PatternFlowPfcPausePauseClass2Counter) PatternFlowPfcPausePauseClass2 { + obj.setChoice(PatternFlowPfcPausePauseClass2Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPfcPausePauseClass2MetricTag +func (obj *patternFlowPfcPausePauseClass2) MetricTags() PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass2MetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter struct { + obj *patternFlowPfcPausePauseClass2 + patternFlowPfcPausePauseClass2MetricTagSlice []PatternFlowPfcPausePauseClass2MetricTag + fieldPtr *[]*otg.PatternFlowPfcPausePauseClass2MetricTag +} + +func newPatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { + return &patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter interface { + setMsg(*patternFlowPfcPausePauseClass2) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter + Items() []PatternFlowPfcPausePauseClass2MetricTag + Add() PatternFlowPfcPausePauseClass2MetricTag + Append(items ...PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter + Set(index int, newObj PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter + Clear() PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter + clearHolderSlice() PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter + appendHolderSlice(item PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter +} + +func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass2) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPfcPausePauseClass2MetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) Items() []PatternFlowPfcPausePauseClass2MetricTag { + return obj.patternFlowPfcPausePauseClass2MetricTagSlice +} + +func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) Add() PatternFlowPfcPausePauseClass2MetricTag { + newObj := &otg.PatternFlowPfcPausePauseClass2MetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPfcPausePauseClass2MetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPfcPausePauseClass2MetricTagSlice = append(obj.patternFlowPfcPausePauseClass2MetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPfcPausePauseClass2MetricTagSlice = append(obj.patternFlowPfcPausePauseClass2MetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPfcPausePauseClass2MetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) Clear() PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass2MetricTag{} + obj.patternFlowPfcPausePauseClass2MetricTagSlice = []PatternFlowPfcPausePauseClass2MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { + if len(obj.patternFlowPfcPausePauseClass2MetricTagSlice) > 0 { + obj.patternFlowPfcPausePauseClass2MetricTagSlice = []PatternFlowPfcPausePauseClass2MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2PatternFlowPfcPausePauseClass2MetricTagIter { + obj.patternFlowPfcPausePauseClass2MetricTagSlice = append(obj.patternFlowPfcPausePauseClass2MetricTagSlice, item) + return obj +} + +func (obj *patternFlowPfcPausePauseClass2) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass2.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass2.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass2MetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass2) setDefault() { + var choices_set int = 0 + var choice PatternFlowPfcPausePauseClass2ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass2Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass2Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass2Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass2Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPfcPausePauseClass2Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass2") + } + } else { + intVal := otg.PatternFlowPfcPausePauseClass2_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPfcPausePauseClass2_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class2_counter.go b/gosnappi/pattern_flow_pfc_pause_pause_class2_counter.go new file mode 100644 index 00000000..df4012ba --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class2_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass2Counter ***** +type patternFlowPfcPausePauseClass2Counter struct { + validation + obj *otg.PatternFlowPfcPausePauseClass2Counter + marshaller marshalPatternFlowPfcPausePauseClass2Counter + unMarshaller unMarshalPatternFlowPfcPausePauseClass2Counter +} + +func NewPatternFlowPfcPausePauseClass2Counter() PatternFlowPfcPausePauseClass2Counter { + obj := patternFlowPfcPausePauseClass2Counter{obj: &otg.PatternFlowPfcPausePauseClass2Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass2Counter) msg() *otg.PatternFlowPfcPausePauseClass2Counter { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass2Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass2Counter) PatternFlowPfcPausePauseClass2Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass2Counter struct { + obj *patternFlowPfcPausePauseClass2Counter +} + +type marshalPatternFlowPfcPausePauseClass2Counter interface { + // ToProto marshals PatternFlowPfcPausePauseClass2Counter to protobuf object *otg.PatternFlowPfcPausePauseClass2Counter + ToProto() (*otg.PatternFlowPfcPausePauseClass2Counter, error) + // ToPbText marshals PatternFlowPfcPausePauseClass2Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass2Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass2Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass2Counter struct { + obj *patternFlowPfcPausePauseClass2Counter +} + +type unMarshalPatternFlowPfcPausePauseClass2Counter interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass2Counter from protobuf object *otg.PatternFlowPfcPausePauseClass2Counter + FromProto(msg *otg.PatternFlowPfcPausePauseClass2Counter) (PatternFlowPfcPausePauseClass2Counter, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass2Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass2Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass2Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass2Counter) Marshal() marshalPatternFlowPfcPausePauseClass2Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass2Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass2Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass2Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass2Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass2Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass2Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass2Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass2Counter) (PatternFlowPfcPausePauseClass2Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass2Counter) 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 *unMarshalpatternFlowPfcPausePauseClass2Counter) 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 *marshalpatternFlowPfcPausePauseClass2Counter) 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 *unMarshalpatternFlowPfcPausePauseClass2Counter) 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 *marshalpatternFlowPfcPausePauseClass2Counter) 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 *unMarshalpatternFlowPfcPausePauseClass2Counter) 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 *patternFlowPfcPausePauseClass2Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass2Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass2Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass2Counter) Clone() (PatternFlowPfcPausePauseClass2Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass2Counter() + 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 +} + +// PatternFlowPfcPausePauseClass2Counter is integer counter pattern +type PatternFlowPfcPausePauseClass2Counter interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass2Counter to protobuf object *otg.PatternFlowPfcPausePauseClass2Counter + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass2Counter + // setMsg unmarshals PatternFlowPfcPausePauseClass2Counter from protobuf object *otg.PatternFlowPfcPausePauseClass2Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass2Counter) PatternFlowPfcPausePauseClass2Counter + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass2Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass2Counter + // validate validates PatternFlowPfcPausePauseClass2Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass2Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowPfcPausePauseClass2Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass2Counter + SetStart(value uint32) PatternFlowPfcPausePauseClass2Counter + // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass2Counter + HasStart() bool + // Step returns uint32, set in PatternFlowPfcPausePauseClass2Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass2Counter + SetStep(value uint32) PatternFlowPfcPausePauseClass2Counter + // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass2Counter + HasStep() bool + // Count returns uint32, set in PatternFlowPfcPausePauseClass2Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass2Counter + SetCount(value uint32) PatternFlowPfcPausePauseClass2Counter + // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass2Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass2Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass2Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass2Counter object +func (obj *patternFlowPfcPausePauseClass2Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass2Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass2Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass2Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass2Counter object +func (obj *patternFlowPfcPausePauseClass2Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass2Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass2Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass2Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass2Counter object +func (obj *patternFlowPfcPausePauseClass2Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass2Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass2Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass2Counter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass2Counter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass2Counter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass2Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class2_metric_tag.go b/gosnappi/pattern_flow_pfc_pause_pause_class2_metric_tag.go new file mode 100644 index 00000000..e57c971c --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class2_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass2MetricTag ***** +type patternFlowPfcPausePauseClass2MetricTag struct { + validation + obj *otg.PatternFlowPfcPausePauseClass2MetricTag + marshaller marshalPatternFlowPfcPausePauseClass2MetricTag + unMarshaller unMarshalPatternFlowPfcPausePauseClass2MetricTag +} + +func NewPatternFlowPfcPausePauseClass2MetricTag() PatternFlowPfcPausePauseClass2MetricTag { + obj := patternFlowPfcPausePauseClass2MetricTag{obj: &otg.PatternFlowPfcPausePauseClass2MetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass2MetricTag) msg() *otg.PatternFlowPfcPausePauseClass2MetricTag { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass2MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2MetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass2MetricTag struct { + obj *patternFlowPfcPausePauseClass2MetricTag +} + +type marshalPatternFlowPfcPausePauseClass2MetricTag interface { + // ToProto marshals PatternFlowPfcPausePauseClass2MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass2MetricTag + ToProto() (*otg.PatternFlowPfcPausePauseClass2MetricTag, error) + // ToPbText marshals PatternFlowPfcPausePauseClass2MetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass2MetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass2MetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass2MetricTag struct { + obj *patternFlowPfcPausePauseClass2MetricTag +} + +type unMarshalPatternFlowPfcPausePauseClass2MetricTag interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass2MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass2MetricTag + FromProto(msg *otg.PatternFlowPfcPausePauseClass2MetricTag) (PatternFlowPfcPausePauseClass2MetricTag, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass2MetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass2MetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass2MetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass2MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass2MetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass2MetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass2MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass2MetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass2MetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass2MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass2MetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass2MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass2MetricTag) (PatternFlowPfcPausePauseClass2MetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass2MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass2MetricTag) 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 *marshalpatternFlowPfcPausePauseClass2MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass2MetricTag) 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 *marshalpatternFlowPfcPausePauseClass2MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass2MetricTag) 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 *patternFlowPfcPausePauseClass2MetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass2MetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass2MetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass2MetricTag) Clone() (PatternFlowPfcPausePauseClass2MetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass2MetricTag() + 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 +} + +// PatternFlowPfcPausePauseClass2MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPfcPausePauseClass2MetricTag interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass2MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass2MetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass2MetricTag + // setMsg unmarshals PatternFlowPfcPausePauseClass2MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass2MetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass2MetricTag) PatternFlowPfcPausePauseClass2MetricTag + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass2MetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass2MetricTag + // validate validates PatternFlowPfcPausePauseClass2MetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass2MetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPfcPausePauseClass2MetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPfcPausePauseClass2MetricTag + SetName(value string) PatternFlowPfcPausePauseClass2MetricTag + // Offset returns uint32, set in PatternFlowPfcPausePauseClass2MetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass2MetricTag + SetOffset(value uint32) PatternFlowPfcPausePauseClass2MetricTag + // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass2MetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPfcPausePauseClass2MetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass2MetricTag + SetLength(value uint32) PatternFlowPfcPausePauseClass2MetricTag + // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass2MetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPfcPausePauseClass2MetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPfcPausePauseClass2MetricTag object +func (obj *patternFlowPfcPausePauseClass2MetricTag) SetName(value string) PatternFlowPfcPausePauseClass2MetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass2MetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass2MetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass2MetricTag object +func (obj *patternFlowPfcPausePauseClass2MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass2MetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass2MetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass2MetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass2MetricTag object +func (obj *patternFlowPfcPausePauseClass2MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass2MetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass2MetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass2MetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass2MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass2MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass2MetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class3.go b/gosnappi/pattern_flow_pfc_pause_pause_class3.go new file mode 100644 index 00000000..ec94728b --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class3.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass3 ***** +type patternFlowPfcPausePauseClass3 struct { + validation + obj *otg.PatternFlowPfcPausePauseClass3 + marshaller marshalPatternFlowPfcPausePauseClass3 + unMarshaller unMarshalPatternFlowPfcPausePauseClass3 + incrementHolder PatternFlowPfcPausePauseClass3Counter + decrementHolder PatternFlowPfcPausePauseClass3Counter + metricTagsHolder PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter +} + +func NewPatternFlowPfcPausePauseClass3() PatternFlowPfcPausePauseClass3 { + obj := patternFlowPfcPausePauseClass3{obj: &otg.PatternFlowPfcPausePauseClass3{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass3) msg() *otg.PatternFlowPfcPausePauseClass3 { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass3) setMsg(msg *otg.PatternFlowPfcPausePauseClass3) PatternFlowPfcPausePauseClass3 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass3 struct { + obj *patternFlowPfcPausePauseClass3 +} + +type marshalPatternFlowPfcPausePauseClass3 interface { + // ToProto marshals PatternFlowPfcPausePauseClass3 to protobuf object *otg.PatternFlowPfcPausePauseClass3 + ToProto() (*otg.PatternFlowPfcPausePauseClass3, error) + // ToPbText marshals PatternFlowPfcPausePauseClass3 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass3 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass3 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass3 struct { + obj *patternFlowPfcPausePauseClass3 +} + +type unMarshalPatternFlowPfcPausePauseClass3 interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass3 from protobuf object *otg.PatternFlowPfcPausePauseClass3 + FromProto(msg *otg.PatternFlowPfcPausePauseClass3) (PatternFlowPfcPausePauseClass3, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass3 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass3 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass3 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass3) Marshal() marshalPatternFlowPfcPausePauseClass3 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass3{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass3) Unmarshal() unMarshalPatternFlowPfcPausePauseClass3 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass3{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass3) ToProto() (*otg.PatternFlowPfcPausePauseClass3, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass3) FromProto(msg *otg.PatternFlowPfcPausePauseClass3) (PatternFlowPfcPausePauseClass3, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass3) 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 *unMarshalpatternFlowPfcPausePauseClass3) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPfcPausePauseClass3) 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 *unMarshalpatternFlowPfcPausePauseClass3) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPfcPausePauseClass3) 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 *unMarshalpatternFlowPfcPausePauseClass3) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPfcPausePauseClass3) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass3) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass3) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass3) Clone() (PatternFlowPfcPausePauseClass3, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass3() + 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 +} + +func (obj *patternFlowPfcPausePauseClass3) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPfcPausePauseClass3 is pause class 3 +type PatternFlowPfcPausePauseClass3 interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass3 to protobuf object *otg.PatternFlowPfcPausePauseClass3 + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass3 + // setMsg unmarshals PatternFlowPfcPausePauseClass3 from protobuf object *otg.PatternFlowPfcPausePauseClass3 + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass3) PatternFlowPfcPausePauseClass3 + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass3 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass3 + // validate validates PatternFlowPfcPausePauseClass3 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass3, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPfcPausePauseClass3ChoiceEnum, set in PatternFlowPfcPausePauseClass3 + Choice() PatternFlowPfcPausePauseClass3ChoiceEnum + // setChoice assigns PatternFlowPfcPausePauseClass3ChoiceEnum provided by user to PatternFlowPfcPausePauseClass3 + setChoice(value PatternFlowPfcPausePauseClass3ChoiceEnum) PatternFlowPfcPausePauseClass3 + // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass3 + HasChoice() bool + // Value returns uint32, set in PatternFlowPfcPausePauseClass3. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass3 + SetValue(value uint32) PatternFlowPfcPausePauseClass3 + // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass3 + HasValue() bool + // Values returns []uint32, set in PatternFlowPfcPausePauseClass3. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass3 + SetValues(value []uint32) PatternFlowPfcPausePauseClass3 + // Increment returns PatternFlowPfcPausePauseClass3Counter, set in PatternFlowPfcPausePauseClass3. + // PatternFlowPfcPausePauseClass3Counter is integer counter pattern + Increment() PatternFlowPfcPausePauseClass3Counter + // SetIncrement assigns PatternFlowPfcPausePauseClass3Counter provided by user to PatternFlowPfcPausePauseClass3. + // PatternFlowPfcPausePauseClass3Counter is integer counter pattern + SetIncrement(value PatternFlowPfcPausePauseClass3Counter) PatternFlowPfcPausePauseClass3 + // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass3 + HasIncrement() bool + // Decrement returns PatternFlowPfcPausePauseClass3Counter, set in PatternFlowPfcPausePauseClass3. + // PatternFlowPfcPausePauseClass3Counter is integer counter pattern + Decrement() PatternFlowPfcPausePauseClass3Counter + // SetDecrement assigns PatternFlowPfcPausePauseClass3Counter provided by user to PatternFlowPfcPausePauseClass3. + // PatternFlowPfcPausePauseClass3Counter is integer counter pattern + SetDecrement(value PatternFlowPfcPausePauseClass3Counter) PatternFlowPfcPausePauseClass3 + // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass3 + HasDecrement() bool + // MetricTags returns PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIterIter, set in PatternFlowPfcPausePauseClass3 + MetricTags() PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter + setNil() +} + +type PatternFlowPfcPausePauseClass3ChoiceEnum string + +// Enum of Choice on PatternFlowPfcPausePauseClass3 +var PatternFlowPfcPausePauseClass3Choice = struct { + VALUE PatternFlowPfcPausePauseClass3ChoiceEnum + VALUES PatternFlowPfcPausePauseClass3ChoiceEnum + INCREMENT PatternFlowPfcPausePauseClass3ChoiceEnum + DECREMENT PatternFlowPfcPausePauseClass3ChoiceEnum +}{ + VALUE: PatternFlowPfcPausePauseClass3ChoiceEnum("value"), + VALUES: PatternFlowPfcPausePauseClass3ChoiceEnum("values"), + INCREMENT: PatternFlowPfcPausePauseClass3ChoiceEnum("increment"), + DECREMENT: PatternFlowPfcPausePauseClass3ChoiceEnum("decrement"), +} + +func (obj *patternFlowPfcPausePauseClass3) Choice() PatternFlowPfcPausePauseClass3ChoiceEnum { + return PatternFlowPfcPausePauseClass3ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPfcPausePauseClass3) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPfcPausePauseClass3) setChoice(value PatternFlowPfcPausePauseClass3ChoiceEnum) PatternFlowPfcPausePauseClass3 { + intValue, ok := otg.PatternFlowPfcPausePauseClass3_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPfcPausePauseClass3ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPfcPausePauseClass3_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPfcPausePauseClass3Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPfcPausePauseClass3Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPfcPausePauseClass3Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowPfcPausePauseClass3Counter().msg() + } + + if value == PatternFlowPfcPausePauseClass3Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPfcPausePauseClass3Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass3) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPfcPausePauseClass3Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass3) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass3 object +func (obj *patternFlowPfcPausePauseClass3) SetValue(value uint32) PatternFlowPfcPausePauseClass3 { + obj.setChoice(PatternFlowPfcPausePauseClass3Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowPfcPausePauseClass3) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass3 object +func (obj *patternFlowPfcPausePauseClass3) SetValues(value []uint32) PatternFlowPfcPausePauseClass3 { + obj.setChoice(PatternFlowPfcPausePauseClass3Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass3Counter +func (obj *patternFlowPfcPausePauseClass3) Increment() PatternFlowPfcPausePauseClass3Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPfcPausePauseClass3Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPfcPausePauseClass3Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass3Counter +func (obj *patternFlowPfcPausePauseClass3) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPfcPausePauseClass3Counter value in the PatternFlowPfcPausePauseClass3 object +func (obj *patternFlowPfcPausePauseClass3) SetIncrement(value PatternFlowPfcPausePauseClass3Counter) PatternFlowPfcPausePauseClass3 { + obj.setChoice(PatternFlowPfcPausePauseClass3Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass3Counter +func (obj *patternFlowPfcPausePauseClass3) Decrement() PatternFlowPfcPausePauseClass3Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPfcPausePauseClass3Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPfcPausePauseClass3Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass3Counter +func (obj *patternFlowPfcPausePauseClass3) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPfcPausePauseClass3Counter value in the PatternFlowPfcPausePauseClass3 object +func (obj *patternFlowPfcPausePauseClass3) SetDecrement(value PatternFlowPfcPausePauseClass3Counter) PatternFlowPfcPausePauseClass3 { + obj.setChoice(PatternFlowPfcPausePauseClass3Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPfcPausePauseClass3MetricTag +func (obj *patternFlowPfcPausePauseClass3) MetricTags() PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass3MetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter struct { + obj *patternFlowPfcPausePauseClass3 + patternFlowPfcPausePauseClass3MetricTagSlice []PatternFlowPfcPausePauseClass3MetricTag + fieldPtr *[]*otg.PatternFlowPfcPausePauseClass3MetricTag +} + +func newPatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { + return &patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter interface { + setMsg(*patternFlowPfcPausePauseClass3) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter + Items() []PatternFlowPfcPausePauseClass3MetricTag + Add() PatternFlowPfcPausePauseClass3MetricTag + Append(items ...PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter + Set(index int, newObj PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter + Clear() PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter + clearHolderSlice() PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter + appendHolderSlice(item PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter +} + +func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass3) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPfcPausePauseClass3MetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) Items() []PatternFlowPfcPausePauseClass3MetricTag { + return obj.patternFlowPfcPausePauseClass3MetricTagSlice +} + +func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) Add() PatternFlowPfcPausePauseClass3MetricTag { + newObj := &otg.PatternFlowPfcPausePauseClass3MetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPfcPausePauseClass3MetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPfcPausePauseClass3MetricTagSlice = append(obj.patternFlowPfcPausePauseClass3MetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPfcPausePauseClass3MetricTagSlice = append(obj.patternFlowPfcPausePauseClass3MetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPfcPausePauseClass3MetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) Clear() PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass3MetricTag{} + obj.patternFlowPfcPausePauseClass3MetricTagSlice = []PatternFlowPfcPausePauseClass3MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { + if len(obj.patternFlowPfcPausePauseClass3MetricTagSlice) > 0 { + obj.patternFlowPfcPausePauseClass3MetricTagSlice = []PatternFlowPfcPausePauseClass3MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3PatternFlowPfcPausePauseClass3MetricTagIter { + obj.patternFlowPfcPausePauseClass3MetricTagSlice = append(obj.patternFlowPfcPausePauseClass3MetricTagSlice, item) + return obj +} + +func (obj *patternFlowPfcPausePauseClass3) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass3.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass3.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass3MetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass3) setDefault() { + var choices_set int = 0 + var choice PatternFlowPfcPausePauseClass3ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass3Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass3Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass3Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass3Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPfcPausePauseClass3Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass3") + } + } else { + intVal := otg.PatternFlowPfcPausePauseClass3_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPfcPausePauseClass3_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class3_counter.go b/gosnappi/pattern_flow_pfc_pause_pause_class3_counter.go new file mode 100644 index 00000000..296e2e7d --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class3_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass3Counter ***** +type patternFlowPfcPausePauseClass3Counter struct { + validation + obj *otg.PatternFlowPfcPausePauseClass3Counter + marshaller marshalPatternFlowPfcPausePauseClass3Counter + unMarshaller unMarshalPatternFlowPfcPausePauseClass3Counter +} + +func NewPatternFlowPfcPausePauseClass3Counter() PatternFlowPfcPausePauseClass3Counter { + obj := patternFlowPfcPausePauseClass3Counter{obj: &otg.PatternFlowPfcPausePauseClass3Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass3Counter) msg() *otg.PatternFlowPfcPausePauseClass3Counter { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass3Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass3Counter) PatternFlowPfcPausePauseClass3Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass3Counter struct { + obj *patternFlowPfcPausePauseClass3Counter +} + +type marshalPatternFlowPfcPausePauseClass3Counter interface { + // ToProto marshals PatternFlowPfcPausePauseClass3Counter to protobuf object *otg.PatternFlowPfcPausePauseClass3Counter + ToProto() (*otg.PatternFlowPfcPausePauseClass3Counter, error) + // ToPbText marshals PatternFlowPfcPausePauseClass3Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass3Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass3Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass3Counter struct { + obj *patternFlowPfcPausePauseClass3Counter +} + +type unMarshalPatternFlowPfcPausePauseClass3Counter interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass3Counter from protobuf object *otg.PatternFlowPfcPausePauseClass3Counter + FromProto(msg *otg.PatternFlowPfcPausePauseClass3Counter) (PatternFlowPfcPausePauseClass3Counter, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass3Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass3Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass3Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass3Counter) Marshal() marshalPatternFlowPfcPausePauseClass3Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass3Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass3Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass3Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass3Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass3Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass3Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass3Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass3Counter) (PatternFlowPfcPausePauseClass3Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass3Counter) 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 *unMarshalpatternFlowPfcPausePauseClass3Counter) 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 *marshalpatternFlowPfcPausePauseClass3Counter) 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 *unMarshalpatternFlowPfcPausePauseClass3Counter) 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 *marshalpatternFlowPfcPausePauseClass3Counter) 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 *unMarshalpatternFlowPfcPausePauseClass3Counter) 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 *patternFlowPfcPausePauseClass3Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass3Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass3Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass3Counter) Clone() (PatternFlowPfcPausePauseClass3Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass3Counter() + 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 +} + +// PatternFlowPfcPausePauseClass3Counter is integer counter pattern +type PatternFlowPfcPausePauseClass3Counter interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass3Counter to protobuf object *otg.PatternFlowPfcPausePauseClass3Counter + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass3Counter + // setMsg unmarshals PatternFlowPfcPausePauseClass3Counter from protobuf object *otg.PatternFlowPfcPausePauseClass3Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass3Counter) PatternFlowPfcPausePauseClass3Counter + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass3Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass3Counter + // validate validates PatternFlowPfcPausePauseClass3Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass3Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowPfcPausePauseClass3Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass3Counter + SetStart(value uint32) PatternFlowPfcPausePauseClass3Counter + // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass3Counter + HasStart() bool + // Step returns uint32, set in PatternFlowPfcPausePauseClass3Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass3Counter + SetStep(value uint32) PatternFlowPfcPausePauseClass3Counter + // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass3Counter + HasStep() bool + // Count returns uint32, set in PatternFlowPfcPausePauseClass3Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass3Counter + SetCount(value uint32) PatternFlowPfcPausePauseClass3Counter + // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass3Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass3Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass3Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass3Counter object +func (obj *patternFlowPfcPausePauseClass3Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass3Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass3Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass3Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass3Counter object +func (obj *patternFlowPfcPausePauseClass3Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass3Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass3Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass3Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass3Counter object +func (obj *patternFlowPfcPausePauseClass3Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass3Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass3Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass3Counter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass3Counter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass3Counter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass3Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class3_metric_tag.go b/gosnappi/pattern_flow_pfc_pause_pause_class3_metric_tag.go new file mode 100644 index 00000000..c1c9e655 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class3_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass3MetricTag ***** +type patternFlowPfcPausePauseClass3MetricTag struct { + validation + obj *otg.PatternFlowPfcPausePauseClass3MetricTag + marshaller marshalPatternFlowPfcPausePauseClass3MetricTag + unMarshaller unMarshalPatternFlowPfcPausePauseClass3MetricTag +} + +func NewPatternFlowPfcPausePauseClass3MetricTag() PatternFlowPfcPausePauseClass3MetricTag { + obj := patternFlowPfcPausePauseClass3MetricTag{obj: &otg.PatternFlowPfcPausePauseClass3MetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass3MetricTag) msg() *otg.PatternFlowPfcPausePauseClass3MetricTag { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass3MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3MetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass3MetricTag struct { + obj *patternFlowPfcPausePauseClass3MetricTag +} + +type marshalPatternFlowPfcPausePauseClass3MetricTag interface { + // ToProto marshals PatternFlowPfcPausePauseClass3MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass3MetricTag + ToProto() (*otg.PatternFlowPfcPausePauseClass3MetricTag, error) + // ToPbText marshals PatternFlowPfcPausePauseClass3MetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass3MetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass3MetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass3MetricTag struct { + obj *patternFlowPfcPausePauseClass3MetricTag +} + +type unMarshalPatternFlowPfcPausePauseClass3MetricTag interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass3MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass3MetricTag + FromProto(msg *otg.PatternFlowPfcPausePauseClass3MetricTag) (PatternFlowPfcPausePauseClass3MetricTag, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass3MetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass3MetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass3MetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass3MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass3MetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass3MetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass3MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass3MetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass3MetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass3MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass3MetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass3MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass3MetricTag) (PatternFlowPfcPausePauseClass3MetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass3MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass3MetricTag) 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 *marshalpatternFlowPfcPausePauseClass3MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass3MetricTag) 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 *marshalpatternFlowPfcPausePauseClass3MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass3MetricTag) 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 *patternFlowPfcPausePauseClass3MetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass3MetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass3MetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass3MetricTag) Clone() (PatternFlowPfcPausePauseClass3MetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass3MetricTag() + 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 +} + +// PatternFlowPfcPausePauseClass3MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPfcPausePauseClass3MetricTag interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass3MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass3MetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass3MetricTag + // setMsg unmarshals PatternFlowPfcPausePauseClass3MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass3MetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass3MetricTag) PatternFlowPfcPausePauseClass3MetricTag + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass3MetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass3MetricTag + // validate validates PatternFlowPfcPausePauseClass3MetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass3MetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPfcPausePauseClass3MetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPfcPausePauseClass3MetricTag + SetName(value string) PatternFlowPfcPausePauseClass3MetricTag + // Offset returns uint32, set in PatternFlowPfcPausePauseClass3MetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass3MetricTag + SetOffset(value uint32) PatternFlowPfcPausePauseClass3MetricTag + // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass3MetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPfcPausePauseClass3MetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass3MetricTag + SetLength(value uint32) PatternFlowPfcPausePauseClass3MetricTag + // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass3MetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPfcPausePauseClass3MetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPfcPausePauseClass3MetricTag object +func (obj *patternFlowPfcPausePauseClass3MetricTag) SetName(value string) PatternFlowPfcPausePauseClass3MetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass3MetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass3MetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass3MetricTag object +func (obj *patternFlowPfcPausePauseClass3MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass3MetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass3MetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass3MetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass3MetricTag object +func (obj *patternFlowPfcPausePauseClass3MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass3MetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass3MetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass3MetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass3MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass3MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass3MetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class4.go b/gosnappi/pattern_flow_pfc_pause_pause_class4.go new file mode 100644 index 00000000..020fc9de --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class4.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass4 ***** +type patternFlowPfcPausePauseClass4 struct { + validation + obj *otg.PatternFlowPfcPausePauseClass4 + marshaller marshalPatternFlowPfcPausePauseClass4 + unMarshaller unMarshalPatternFlowPfcPausePauseClass4 + incrementHolder PatternFlowPfcPausePauseClass4Counter + decrementHolder PatternFlowPfcPausePauseClass4Counter + metricTagsHolder PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter +} + +func NewPatternFlowPfcPausePauseClass4() PatternFlowPfcPausePauseClass4 { + obj := patternFlowPfcPausePauseClass4{obj: &otg.PatternFlowPfcPausePauseClass4{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass4) msg() *otg.PatternFlowPfcPausePauseClass4 { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass4) setMsg(msg *otg.PatternFlowPfcPausePauseClass4) PatternFlowPfcPausePauseClass4 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass4 struct { + obj *patternFlowPfcPausePauseClass4 +} + +type marshalPatternFlowPfcPausePauseClass4 interface { + // ToProto marshals PatternFlowPfcPausePauseClass4 to protobuf object *otg.PatternFlowPfcPausePauseClass4 + ToProto() (*otg.PatternFlowPfcPausePauseClass4, error) + // ToPbText marshals PatternFlowPfcPausePauseClass4 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass4 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass4 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass4 struct { + obj *patternFlowPfcPausePauseClass4 +} + +type unMarshalPatternFlowPfcPausePauseClass4 interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass4 from protobuf object *otg.PatternFlowPfcPausePauseClass4 + FromProto(msg *otg.PatternFlowPfcPausePauseClass4) (PatternFlowPfcPausePauseClass4, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass4 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass4 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass4 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass4) Marshal() marshalPatternFlowPfcPausePauseClass4 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass4{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass4) Unmarshal() unMarshalPatternFlowPfcPausePauseClass4 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass4{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass4) ToProto() (*otg.PatternFlowPfcPausePauseClass4, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass4) FromProto(msg *otg.PatternFlowPfcPausePauseClass4) (PatternFlowPfcPausePauseClass4, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass4) 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 *unMarshalpatternFlowPfcPausePauseClass4) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPfcPausePauseClass4) 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 *unMarshalpatternFlowPfcPausePauseClass4) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPfcPausePauseClass4) 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 *unMarshalpatternFlowPfcPausePauseClass4) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPfcPausePauseClass4) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass4) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass4) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass4) Clone() (PatternFlowPfcPausePauseClass4, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass4() + 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 +} + +func (obj *patternFlowPfcPausePauseClass4) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPfcPausePauseClass4 is pause class 4 +type PatternFlowPfcPausePauseClass4 interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass4 to protobuf object *otg.PatternFlowPfcPausePauseClass4 + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass4 + // setMsg unmarshals PatternFlowPfcPausePauseClass4 from protobuf object *otg.PatternFlowPfcPausePauseClass4 + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass4) PatternFlowPfcPausePauseClass4 + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass4 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass4 + // validate validates PatternFlowPfcPausePauseClass4 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass4, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPfcPausePauseClass4ChoiceEnum, set in PatternFlowPfcPausePauseClass4 + Choice() PatternFlowPfcPausePauseClass4ChoiceEnum + // setChoice assigns PatternFlowPfcPausePauseClass4ChoiceEnum provided by user to PatternFlowPfcPausePauseClass4 + setChoice(value PatternFlowPfcPausePauseClass4ChoiceEnum) PatternFlowPfcPausePauseClass4 + // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass4 + HasChoice() bool + // Value returns uint32, set in PatternFlowPfcPausePauseClass4. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass4 + SetValue(value uint32) PatternFlowPfcPausePauseClass4 + // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass4 + HasValue() bool + // Values returns []uint32, set in PatternFlowPfcPausePauseClass4. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass4 + SetValues(value []uint32) PatternFlowPfcPausePauseClass4 + // Increment returns PatternFlowPfcPausePauseClass4Counter, set in PatternFlowPfcPausePauseClass4. + // PatternFlowPfcPausePauseClass4Counter is integer counter pattern + Increment() PatternFlowPfcPausePauseClass4Counter + // SetIncrement assigns PatternFlowPfcPausePauseClass4Counter provided by user to PatternFlowPfcPausePauseClass4. + // PatternFlowPfcPausePauseClass4Counter is integer counter pattern + SetIncrement(value PatternFlowPfcPausePauseClass4Counter) PatternFlowPfcPausePauseClass4 + // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass4 + HasIncrement() bool + // Decrement returns PatternFlowPfcPausePauseClass4Counter, set in PatternFlowPfcPausePauseClass4. + // PatternFlowPfcPausePauseClass4Counter is integer counter pattern + Decrement() PatternFlowPfcPausePauseClass4Counter + // SetDecrement assigns PatternFlowPfcPausePauseClass4Counter provided by user to PatternFlowPfcPausePauseClass4. + // PatternFlowPfcPausePauseClass4Counter is integer counter pattern + SetDecrement(value PatternFlowPfcPausePauseClass4Counter) PatternFlowPfcPausePauseClass4 + // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass4 + HasDecrement() bool + // MetricTags returns PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIterIter, set in PatternFlowPfcPausePauseClass4 + MetricTags() PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter + setNil() +} + +type PatternFlowPfcPausePauseClass4ChoiceEnum string + +// Enum of Choice on PatternFlowPfcPausePauseClass4 +var PatternFlowPfcPausePauseClass4Choice = struct { + VALUE PatternFlowPfcPausePauseClass4ChoiceEnum + VALUES PatternFlowPfcPausePauseClass4ChoiceEnum + INCREMENT PatternFlowPfcPausePauseClass4ChoiceEnum + DECREMENT PatternFlowPfcPausePauseClass4ChoiceEnum +}{ + VALUE: PatternFlowPfcPausePauseClass4ChoiceEnum("value"), + VALUES: PatternFlowPfcPausePauseClass4ChoiceEnum("values"), + INCREMENT: PatternFlowPfcPausePauseClass4ChoiceEnum("increment"), + DECREMENT: PatternFlowPfcPausePauseClass4ChoiceEnum("decrement"), +} + +func (obj *patternFlowPfcPausePauseClass4) Choice() PatternFlowPfcPausePauseClass4ChoiceEnum { + return PatternFlowPfcPausePauseClass4ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPfcPausePauseClass4) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPfcPausePauseClass4) setChoice(value PatternFlowPfcPausePauseClass4ChoiceEnum) PatternFlowPfcPausePauseClass4 { + intValue, ok := otg.PatternFlowPfcPausePauseClass4_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPfcPausePauseClass4ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPfcPausePauseClass4_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPfcPausePauseClass4Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPfcPausePauseClass4Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPfcPausePauseClass4Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowPfcPausePauseClass4Counter().msg() + } + + if value == PatternFlowPfcPausePauseClass4Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPfcPausePauseClass4Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass4) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPfcPausePauseClass4Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass4) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass4 object +func (obj *patternFlowPfcPausePauseClass4) SetValue(value uint32) PatternFlowPfcPausePauseClass4 { + obj.setChoice(PatternFlowPfcPausePauseClass4Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowPfcPausePauseClass4) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass4 object +func (obj *patternFlowPfcPausePauseClass4) SetValues(value []uint32) PatternFlowPfcPausePauseClass4 { + obj.setChoice(PatternFlowPfcPausePauseClass4Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass4Counter +func (obj *patternFlowPfcPausePauseClass4) Increment() PatternFlowPfcPausePauseClass4Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPfcPausePauseClass4Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPfcPausePauseClass4Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass4Counter +func (obj *patternFlowPfcPausePauseClass4) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPfcPausePauseClass4Counter value in the PatternFlowPfcPausePauseClass4 object +func (obj *patternFlowPfcPausePauseClass4) SetIncrement(value PatternFlowPfcPausePauseClass4Counter) PatternFlowPfcPausePauseClass4 { + obj.setChoice(PatternFlowPfcPausePauseClass4Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass4Counter +func (obj *patternFlowPfcPausePauseClass4) Decrement() PatternFlowPfcPausePauseClass4Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPfcPausePauseClass4Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPfcPausePauseClass4Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass4Counter +func (obj *patternFlowPfcPausePauseClass4) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPfcPausePauseClass4Counter value in the PatternFlowPfcPausePauseClass4 object +func (obj *patternFlowPfcPausePauseClass4) SetDecrement(value PatternFlowPfcPausePauseClass4Counter) PatternFlowPfcPausePauseClass4 { + obj.setChoice(PatternFlowPfcPausePauseClass4Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPfcPausePauseClass4MetricTag +func (obj *patternFlowPfcPausePauseClass4) MetricTags() PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass4MetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter struct { + obj *patternFlowPfcPausePauseClass4 + patternFlowPfcPausePauseClass4MetricTagSlice []PatternFlowPfcPausePauseClass4MetricTag + fieldPtr *[]*otg.PatternFlowPfcPausePauseClass4MetricTag +} + +func newPatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { + return &patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter interface { + setMsg(*patternFlowPfcPausePauseClass4) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter + Items() []PatternFlowPfcPausePauseClass4MetricTag + Add() PatternFlowPfcPausePauseClass4MetricTag + Append(items ...PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter + Set(index int, newObj PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter + Clear() PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter + clearHolderSlice() PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter + appendHolderSlice(item PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter +} + +func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass4) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPfcPausePauseClass4MetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) Items() []PatternFlowPfcPausePauseClass4MetricTag { + return obj.patternFlowPfcPausePauseClass4MetricTagSlice +} + +func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) Add() PatternFlowPfcPausePauseClass4MetricTag { + newObj := &otg.PatternFlowPfcPausePauseClass4MetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPfcPausePauseClass4MetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPfcPausePauseClass4MetricTagSlice = append(obj.patternFlowPfcPausePauseClass4MetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPfcPausePauseClass4MetricTagSlice = append(obj.patternFlowPfcPausePauseClass4MetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPfcPausePauseClass4MetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) Clear() PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass4MetricTag{} + obj.patternFlowPfcPausePauseClass4MetricTagSlice = []PatternFlowPfcPausePauseClass4MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { + if len(obj.patternFlowPfcPausePauseClass4MetricTagSlice) > 0 { + obj.patternFlowPfcPausePauseClass4MetricTagSlice = []PatternFlowPfcPausePauseClass4MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4PatternFlowPfcPausePauseClass4MetricTagIter { + obj.patternFlowPfcPausePauseClass4MetricTagSlice = append(obj.patternFlowPfcPausePauseClass4MetricTagSlice, item) + return obj +} + +func (obj *patternFlowPfcPausePauseClass4) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass4.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass4.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass4MetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass4) setDefault() { + var choices_set int = 0 + var choice PatternFlowPfcPausePauseClass4ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass4Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass4Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass4Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass4Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPfcPausePauseClass4Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass4") + } + } else { + intVal := otg.PatternFlowPfcPausePauseClass4_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPfcPausePauseClass4_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class4_counter.go b/gosnappi/pattern_flow_pfc_pause_pause_class4_counter.go new file mode 100644 index 00000000..3a8f819f --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class4_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass4Counter ***** +type patternFlowPfcPausePauseClass4Counter struct { + validation + obj *otg.PatternFlowPfcPausePauseClass4Counter + marshaller marshalPatternFlowPfcPausePauseClass4Counter + unMarshaller unMarshalPatternFlowPfcPausePauseClass4Counter +} + +func NewPatternFlowPfcPausePauseClass4Counter() PatternFlowPfcPausePauseClass4Counter { + obj := patternFlowPfcPausePauseClass4Counter{obj: &otg.PatternFlowPfcPausePauseClass4Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass4Counter) msg() *otg.PatternFlowPfcPausePauseClass4Counter { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass4Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass4Counter) PatternFlowPfcPausePauseClass4Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass4Counter struct { + obj *patternFlowPfcPausePauseClass4Counter +} + +type marshalPatternFlowPfcPausePauseClass4Counter interface { + // ToProto marshals PatternFlowPfcPausePauseClass4Counter to protobuf object *otg.PatternFlowPfcPausePauseClass4Counter + ToProto() (*otg.PatternFlowPfcPausePauseClass4Counter, error) + // ToPbText marshals PatternFlowPfcPausePauseClass4Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass4Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass4Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass4Counter struct { + obj *patternFlowPfcPausePauseClass4Counter +} + +type unMarshalPatternFlowPfcPausePauseClass4Counter interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass4Counter from protobuf object *otg.PatternFlowPfcPausePauseClass4Counter + FromProto(msg *otg.PatternFlowPfcPausePauseClass4Counter) (PatternFlowPfcPausePauseClass4Counter, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass4Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass4Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass4Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass4Counter) Marshal() marshalPatternFlowPfcPausePauseClass4Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass4Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass4Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass4Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass4Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass4Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass4Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass4Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass4Counter) (PatternFlowPfcPausePauseClass4Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass4Counter) 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 *unMarshalpatternFlowPfcPausePauseClass4Counter) 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 *marshalpatternFlowPfcPausePauseClass4Counter) 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 *unMarshalpatternFlowPfcPausePauseClass4Counter) 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 *marshalpatternFlowPfcPausePauseClass4Counter) 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 *unMarshalpatternFlowPfcPausePauseClass4Counter) 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 *patternFlowPfcPausePauseClass4Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass4Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass4Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass4Counter) Clone() (PatternFlowPfcPausePauseClass4Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass4Counter() + 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 +} + +// PatternFlowPfcPausePauseClass4Counter is integer counter pattern +type PatternFlowPfcPausePauseClass4Counter interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass4Counter to protobuf object *otg.PatternFlowPfcPausePauseClass4Counter + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass4Counter + // setMsg unmarshals PatternFlowPfcPausePauseClass4Counter from protobuf object *otg.PatternFlowPfcPausePauseClass4Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass4Counter) PatternFlowPfcPausePauseClass4Counter + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass4Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass4Counter + // validate validates PatternFlowPfcPausePauseClass4Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass4Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowPfcPausePauseClass4Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass4Counter + SetStart(value uint32) PatternFlowPfcPausePauseClass4Counter + // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass4Counter + HasStart() bool + // Step returns uint32, set in PatternFlowPfcPausePauseClass4Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass4Counter + SetStep(value uint32) PatternFlowPfcPausePauseClass4Counter + // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass4Counter + HasStep() bool + // Count returns uint32, set in PatternFlowPfcPausePauseClass4Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass4Counter + SetCount(value uint32) PatternFlowPfcPausePauseClass4Counter + // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass4Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass4Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass4Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass4Counter object +func (obj *patternFlowPfcPausePauseClass4Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass4Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass4Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass4Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass4Counter object +func (obj *patternFlowPfcPausePauseClass4Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass4Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass4Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass4Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass4Counter object +func (obj *patternFlowPfcPausePauseClass4Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass4Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass4Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass4Counter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass4Counter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass4Counter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass4Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class4_metric_tag.go b/gosnappi/pattern_flow_pfc_pause_pause_class4_metric_tag.go new file mode 100644 index 00000000..658750fe --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class4_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass4MetricTag ***** +type patternFlowPfcPausePauseClass4MetricTag struct { + validation + obj *otg.PatternFlowPfcPausePauseClass4MetricTag + marshaller marshalPatternFlowPfcPausePauseClass4MetricTag + unMarshaller unMarshalPatternFlowPfcPausePauseClass4MetricTag +} + +func NewPatternFlowPfcPausePauseClass4MetricTag() PatternFlowPfcPausePauseClass4MetricTag { + obj := patternFlowPfcPausePauseClass4MetricTag{obj: &otg.PatternFlowPfcPausePauseClass4MetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass4MetricTag) msg() *otg.PatternFlowPfcPausePauseClass4MetricTag { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass4MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4MetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass4MetricTag struct { + obj *patternFlowPfcPausePauseClass4MetricTag +} + +type marshalPatternFlowPfcPausePauseClass4MetricTag interface { + // ToProto marshals PatternFlowPfcPausePauseClass4MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass4MetricTag + ToProto() (*otg.PatternFlowPfcPausePauseClass4MetricTag, error) + // ToPbText marshals PatternFlowPfcPausePauseClass4MetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass4MetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass4MetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass4MetricTag struct { + obj *patternFlowPfcPausePauseClass4MetricTag +} + +type unMarshalPatternFlowPfcPausePauseClass4MetricTag interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass4MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass4MetricTag + FromProto(msg *otg.PatternFlowPfcPausePauseClass4MetricTag) (PatternFlowPfcPausePauseClass4MetricTag, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass4MetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass4MetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass4MetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass4MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass4MetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass4MetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass4MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass4MetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass4MetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass4MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass4MetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass4MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass4MetricTag) (PatternFlowPfcPausePauseClass4MetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass4MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass4MetricTag) 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 *marshalpatternFlowPfcPausePauseClass4MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass4MetricTag) 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 *marshalpatternFlowPfcPausePauseClass4MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass4MetricTag) 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 *patternFlowPfcPausePauseClass4MetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass4MetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass4MetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass4MetricTag) Clone() (PatternFlowPfcPausePauseClass4MetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass4MetricTag() + 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 +} + +// PatternFlowPfcPausePauseClass4MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPfcPausePauseClass4MetricTag interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass4MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass4MetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass4MetricTag + // setMsg unmarshals PatternFlowPfcPausePauseClass4MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass4MetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass4MetricTag) PatternFlowPfcPausePauseClass4MetricTag + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass4MetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass4MetricTag + // validate validates PatternFlowPfcPausePauseClass4MetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass4MetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPfcPausePauseClass4MetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPfcPausePauseClass4MetricTag + SetName(value string) PatternFlowPfcPausePauseClass4MetricTag + // Offset returns uint32, set in PatternFlowPfcPausePauseClass4MetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass4MetricTag + SetOffset(value uint32) PatternFlowPfcPausePauseClass4MetricTag + // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass4MetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPfcPausePauseClass4MetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass4MetricTag + SetLength(value uint32) PatternFlowPfcPausePauseClass4MetricTag + // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass4MetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPfcPausePauseClass4MetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPfcPausePauseClass4MetricTag object +func (obj *patternFlowPfcPausePauseClass4MetricTag) SetName(value string) PatternFlowPfcPausePauseClass4MetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass4MetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass4MetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass4MetricTag object +func (obj *patternFlowPfcPausePauseClass4MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass4MetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass4MetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass4MetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass4MetricTag object +func (obj *patternFlowPfcPausePauseClass4MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass4MetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass4MetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass4MetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass4MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass4MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass4MetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class5.go b/gosnappi/pattern_flow_pfc_pause_pause_class5.go new file mode 100644 index 00000000..2f7e56d6 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class5.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass5 ***** +type patternFlowPfcPausePauseClass5 struct { + validation + obj *otg.PatternFlowPfcPausePauseClass5 + marshaller marshalPatternFlowPfcPausePauseClass5 + unMarshaller unMarshalPatternFlowPfcPausePauseClass5 + incrementHolder PatternFlowPfcPausePauseClass5Counter + decrementHolder PatternFlowPfcPausePauseClass5Counter + metricTagsHolder PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter +} + +func NewPatternFlowPfcPausePauseClass5() PatternFlowPfcPausePauseClass5 { + obj := patternFlowPfcPausePauseClass5{obj: &otg.PatternFlowPfcPausePauseClass5{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass5) msg() *otg.PatternFlowPfcPausePauseClass5 { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass5) setMsg(msg *otg.PatternFlowPfcPausePauseClass5) PatternFlowPfcPausePauseClass5 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass5 struct { + obj *patternFlowPfcPausePauseClass5 +} + +type marshalPatternFlowPfcPausePauseClass5 interface { + // ToProto marshals PatternFlowPfcPausePauseClass5 to protobuf object *otg.PatternFlowPfcPausePauseClass5 + ToProto() (*otg.PatternFlowPfcPausePauseClass5, error) + // ToPbText marshals PatternFlowPfcPausePauseClass5 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass5 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass5 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass5 struct { + obj *patternFlowPfcPausePauseClass5 +} + +type unMarshalPatternFlowPfcPausePauseClass5 interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass5 from protobuf object *otg.PatternFlowPfcPausePauseClass5 + FromProto(msg *otg.PatternFlowPfcPausePauseClass5) (PatternFlowPfcPausePauseClass5, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass5 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass5 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass5 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass5) Marshal() marshalPatternFlowPfcPausePauseClass5 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass5{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass5) Unmarshal() unMarshalPatternFlowPfcPausePauseClass5 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass5{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass5) ToProto() (*otg.PatternFlowPfcPausePauseClass5, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass5) FromProto(msg *otg.PatternFlowPfcPausePauseClass5) (PatternFlowPfcPausePauseClass5, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass5) 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 *unMarshalpatternFlowPfcPausePauseClass5) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPfcPausePauseClass5) 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 *unMarshalpatternFlowPfcPausePauseClass5) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPfcPausePauseClass5) 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 *unMarshalpatternFlowPfcPausePauseClass5) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPfcPausePauseClass5) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass5) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass5) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass5) Clone() (PatternFlowPfcPausePauseClass5, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass5() + 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 +} + +func (obj *patternFlowPfcPausePauseClass5) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPfcPausePauseClass5 is pause class 5 +type PatternFlowPfcPausePauseClass5 interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass5 to protobuf object *otg.PatternFlowPfcPausePauseClass5 + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass5 + // setMsg unmarshals PatternFlowPfcPausePauseClass5 from protobuf object *otg.PatternFlowPfcPausePauseClass5 + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass5) PatternFlowPfcPausePauseClass5 + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass5 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass5 + // validate validates PatternFlowPfcPausePauseClass5 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass5, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPfcPausePauseClass5ChoiceEnum, set in PatternFlowPfcPausePauseClass5 + Choice() PatternFlowPfcPausePauseClass5ChoiceEnum + // setChoice assigns PatternFlowPfcPausePauseClass5ChoiceEnum provided by user to PatternFlowPfcPausePauseClass5 + setChoice(value PatternFlowPfcPausePauseClass5ChoiceEnum) PatternFlowPfcPausePauseClass5 + // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass5 + HasChoice() bool + // Value returns uint32, set in PatternFlowPfcPausePauseClass5. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass5 + SetValue(value uint32) PatternFlowPfcPausePauseClass5 + // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass5 + HasValue() bool + // Values returns []uint32, set in PatternFlowPfcPausePauseClass5. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass5 + SetValues(value []uint32) PatternFlowPfcPausePauseClass5 + // Increment returns PatternFlowPfcPausePauseClass5Counter, set in PatternFlowPfcPausePauseClass5. + // PatternFlowPfcPausePauseClass5Counter is integer counter pattern + Increment() PatternFlowPfcPausePauseClass5Counter + // SetIncrement assigns PatternFlowPfcPausePauseClass5Counter provided by user to PatternFlowPfcPausePauseClass5. + // PatternFlowPfcPausePauseClass5Counter is integer counter pattern + SetIncrement(value PatternFlowPfcPausePauseClass5Counter) PatternFlowPfcPausePauseClass5 + // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass5 + HasIncrement() bool + // Decrement returns PatternFlowPfcPausePauseClass5Counter, set in PatternFlowPfcPausePauseClass5. + // PatternFlowPfcPausePauseClass5Counter is integer counter pattern + Decrement() PatternFlowPfcPausePauseClass5Counter + // SetDecrement assigns PatternFlowPfcPausePauseClass5Counter provided by user to PatternFlowPfcPausePauseClass5. + // PatternFlowPfcPausePauseClass5Counter is integer counter pattern + SetDecrement(value PatternFlowPfcPausePauseClass5Counter) PatternFlowPfcPausePauseClass5 + // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass5 + HasDecrement() bool + // MetricTags returns PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIterIter, set in PatternFlowPfcPausePauseClass5 + MetricTags() PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter + setNil() +} + +type PatternFlowPfcPausePauseClass5ChoiceEnum string + +// Enum of Choice on PatternFlowPfcPausePauseClass5 +var PatternFlowPfcPausePauseClass5Choice = struct { + VALUE PatternFlowPfcPausePauseClass5ChoiceEnum + VALUES PatternFlowPfcPausePauseClass5ChoiceEnum + INCREMENT PatternFlowPfcPausePauseClass5ChoiceEnum + DECREMENT PatternFlowPfcPausePauseClass5ChoiceEnum +}{ + VALUE: PatternFlowPfcPausePauseClass5ChoiceEnum("value"), + VALUES: PatternFlowPfcPausePauseClass5ChoiceEnum("values"), + INCREMENT: PatternFlowPfcPausePauseClass5ChoiceEnum("increment"), + DECREMENT: PatternFlowPfcPausePauseClass5ChoiceEnum("decrement"), +} + +func (obj *patternFlowPfcPausePauseClass5) Choice() PatternFlowPfcPausePauseClass5ChoiceEnum { + return PatternFlowPfcPausePauseClass5ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPfcPausePauseClass5) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPfcPausePauseClass5) setChoice(value PatternFlowPfcPausePauseClass5ChoiceEnum) PatternFlowPfcPausePauseClass5 { + intValue, ok := otg.PatternFlowPfcPausePauseClass5_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPfcPausePauseClass5ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPfcPausePauseClass5_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPfcPausePauseClass5Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPfcPausePauseClass5Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPfcPausePauseClass5Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowPfcPausePauseClass5Counter().msg() + } + + if value == PatternFlowPfcPausePauseClass5Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPfcPausePauseClass5Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass5) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPfcPausePauseClass5Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass5) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass5 object +func (obj *patternFlowPfcPausePauseClass5) SetValue(value uint32) PatternFlowPfcPausePauseClass5 { + obj.setChoice(PatternFlowPfcPausePauseClass5Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowPfcPausePauseClass5) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass5 object +func (obj *patternFlowPfcPausePauseClass5) SetValues(value []uint32) PatternFlowPfcPausePauseClass5 { + obj.setChoice(PatternFlowPfcPausePauseClass5Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass5Counter +func (obj *patternFlowPfcPausePauseClass5) Increment() PatternFlowPfcPausePauseClass5Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPfcPausePauseClass5Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPfcPausePauseClass5Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass5Counter +func (obj *patternFlowPfcPausePauseClass5) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPfcPausePauseClass5Counter value in the PatternFlowPfcPausePauseClass5 object +func (obj *patternFlowPfcPausePauseClass5) SetIncrement(value PatternFlowPfcPausePauseClass5Counter) PatternFlowPfcPausePauseClass5 { + obj.setChoice(PatternFlowPfcPausePauseClass5Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass5Counter +func (obj *patternFlowPfcPausePauseClass5) Decrement() PatternFlowPfcPausePauseClass5Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPfcPausePauseClass5Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPfcPausePauseClass5Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass5Counter +func (obj *patternFlowPfcPausePauseClass5) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPfcPausePauseClass5Counter value in the PatternFlowPfcPausePauseClass5 object +func (obj *patternFlowPfcPausePauseClass5) SetDecrement(value PatternFlowPfcPausePauseClass5Counter) PatternFlowPfcPausePauseClass5 { + obj.setChoice(PatternFlowPfcPausePauseClass5Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPfcPausePauseClass5MetricTag +func (obj *patternFlowPfcPausePauseClass5) MetricTags() PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass5MetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter struct { + obj *patternFlowPfcPausePauseClass5 + patternFlowPfcPausePauseClass5MetricTagSlice []PatternFlowPfcPausePauseClass5MetricTag + fieldPtr *[]*otg.PatternFlowPfcPausePauseClass5MetricTag +} + +func newPatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { + return &patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter interface { + setMsg(*patternFlowPfcPausePauseClass5) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter + Items() []PatternFlowPfcPausePauseClass5MetricTag + Add() PatternFlowPfcPausePauseClass5MetricTag + Append(items ...PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter + Set(index int, newObj PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter + Clear() PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter + clearHolderSlice() PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter + appendHolderSlice(item PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter +} + +func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass5) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPfcPausePauseClass5MetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) Items() []PatternFlowPfcPausePauseClass5MetricTag { + return obj.patternFlowPfcPausePauseClass5MetricTagSlice +} + +func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) Add() PatternFlowPfcPausePauseClass5MetricTag { + newObj := &otg.PatternFlowPfcPausePauseClass5MetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPfcPausePauseClass5MetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPfcPausePauseClass5MetricTagSlice = append(obj.patternFlowPfcPausePauseClass5MetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPfcPausePauseClass5MetricTagSlice = append(obj.patternFlowPfcPausePauseClass5MetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPfcPausePauseClass5MetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) Clear() PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass5MetricTag{} + obj.patternFlowPfcPausePauseClass5MetricTagSlice = []PatternFlowPfcPausePauseClass5MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { + if len(obj.patternFlowPfcPausePauseClass5MetricTagSlice) > 0 { + obj.patternFlowPfcPausePauseClass5MetricTagSlice = []PatternFlowPfcPausePauseClass5MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5PatternFlowPfcPausePauseClass5MetricTagIter { + obj.patternFlowPfcPausePauseClass5MetricTagSlice = append(obj.patternFlowPfcPausePauseClass5MetricTagSlice, item) + return obj +} + +func (obj *patternFlowPfcPausePauseClass5) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass5.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass5.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass5MetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass5) setDefault() { + var choices_set int = 0 + var choice PatternFlowPfcPausePauseClass5ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass5Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass5Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass5Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass5Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPfcPausePauseClass5Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass5") + } + } else { + intVal := otg.PatternFlowPfcPausePauseClass5_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPfcPausePauseClass5_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class5_counter.go b/gosnappi/pattern_flow_pfc_pause_pause_class5_counter.go new file mode 100644 index 00000000..5ee96401 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class5_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass5Counter ***** +type patternFlowPfcPausePauseClass5Counter struct { + validation + obj *otg.PatternFlowPfcPausePauseClass5Counter + marshaller marshalPatternFlowPfcPausePauseClass5Counter + unMarshaller unMarshalPatternFlowPfcPausePauseClass5Counter +} + +func NewPatternFlowPfcPausePauseClass5Counter() PatternFlowPfcPausePauseClass5Counter { + obj := patternFlowPfcPausePauseClass5Counter{obj: &otg.PatternFlowPfcPausePauseClass5Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass5Counter) msg() *otg.PatternFlowPfcPausePauseClass5Counter { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass5Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass5Counter) PatternFlowPfcPausePauseClass5Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass5Counter struct { + obj *patternFlowPfcPausePauseClass5Counter +} + +type marshalPatternFlowPfcPausePauseClass5Counter interface { + // ToProto marshals PatternFlowPfcPausePauseClass5Counter to protobuf object *otg.PatternFlowPfcPausePauseClass5Counter + ToProto() (*otg.PatternFlowPfcPausePauseClass5Counter, error) + // ToPbText marshals PatternFlowPfcPausePauseClass5Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass5Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass5Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass5Counter struct { + obj *patternFlowPfcPausePauseClass5Counter +} + +type unMarshalPatternFlowPfcPausePauseClass5Counter interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass5Counter from protobuf object *otg.PatternFlowPfcPausePauseClass5Counter + FromProto(msg *otg.PatternFlowPfcPausePauseClass5Counter) (PatternFlowPfcPausePauseClass5Counter, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass5Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass5Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass5Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass5Counter) Marshal() marshalPatternFlowPfcPausePauseClass5Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass5Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass5Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass5Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass5Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass5Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass5Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass5Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass5Counter) (PatternFlowPfcPausePauseClass5Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass5Counter) 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 *unMarshalpatternFlowPfcPausePauseClass5Counter) 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 *marshalpatternFlowPfcPausePauseClass5Counter) 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 *unMarshalpatternFlowPfcPausePauseClass5Counter) 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 *marshalpatternFlowPfcPausePauseClass5Counter) 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 *unMarshalpatternFlowPfcPausePauseClass5Counter) 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 *patternFlowPfcPausePauseClass5Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass5Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass5Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass5Counter) Clone() (PatternFlowPfcPausePauseClass5Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass5Counter() + 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 +} + +// PatternFlowPfcPausePauseClass5Counter is integer counter pattern +type PatternFlowPfcPausePauseClass5Counter interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass5Counter to protobuf object *otg.PatternFlowPfcPausePauseClass5Counter + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass5Counter + // setMsg unmarshals PatternFlowPfcPausePauseClass5Counter from protobuf object *otg.PatternFlowPfcPausePauseClass5Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass5Counter) PatternFlowPfcPausePauseClass5Counter + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass5Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass5Counter + // validate validates PatternFlowPfcPausePauseClass5Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass5Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowPfcPausePauseClass5Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass5Counter + SetStart(value uint32) PatternFlowPfcPausePauseClass5Counter + // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass5Counter + HasStart() bool + // Step returns uint32, set in PatternFlowPfcPausePauseClass5Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass5Counter + SetStep(value uint32) PatternFlowPfcPausePauseClass5Counter + // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass5Counter + HasStep() bool + // Count returns uint32, set in PatternFlowPfcPausePauseClass5Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass5Counter + SetCount(value uint32) PatternFlowPfcPausePauseClass5Counter + // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass5Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass5Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass5Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass5Counter object +func (obj *patternFlowPfcPausePauseClass5Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass5Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass5Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass5Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass5Counter object +func (obj *patternFlowPfcPausePauseClass5Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass5Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass5Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass5Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass5Counter object +func (obj *patternFlowPfcPausePauseClass5Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass5Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass5Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass5Counter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass5Counter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass5Counter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass5Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class5_metric_tag.go b/gosnappi/pattern_flow_pfc_pause_pause_class5_metric_tag.go new file mode 100644 index 00000000..452edd00 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class5_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass5MetricTag ***** +type patternFlowPfcPausePauseClass5MetricTag struct { + validation + obj *otg.PatternFlowPfcPausePauseClass5MetricTag + marshaller marshalPatternFlowPfcPausePauseClass5MetricTag + unMarshaller unMarshalPatternFlowPfcPausePauseClass5MetricTag +} + +func NewPatternFlowPfcPausePauseClass5MetricTag() PatternFlowPfcPausePauseClass5MetricTag { + obj := patternFlowPfcPausePauseClass5MetricTag{obj: &otg.PatternFlowPfcPausePauseClass5MetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass5MetricTag) msg() *otg.PatternFlowPfcPausePauseClass5MetricTag { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass5MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5MetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass5MetricTag struct { + obj *patternFlowPfcPausePauseClass5MetricTag +} + +type marshalPatternFlowPfcPausePauseClass5MetricTag interface { + // ToProto marshals PatternFlowPfcPausePauseClass5MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass5MetricTag + ToProto() (*otg.PatternFlowPfcPausePauseClass5MetricTag, error) + // ToPbText marshals PatternFlowPfcPausePauseClass5MetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass5MetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass5MetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass5MetricTag struct { + obj *patternFlowPfcPausePauseClass5MetricTag +} + +type unMarshalPatternFlowPfcPausePauseClass5MetricTag interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass5MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass5MetricTag + FromProto(msg *otg.PatternFlowPfcPausePauseClass5MetricTag) (PatternFlowPfcPausePauseClass5MetricTag, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass5MetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass5MetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass5MetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass5MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass5MetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass5MetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass5MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass5MetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass5MetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass5MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass5MetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass5MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass5MetricTag) (PatternFlowPfcPausePauseClass5MetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass5MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass5MetricTag) 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 *marshalpatternFlowPfcPausePauseClass5MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass5MetricTag) 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 *marshalpatternFlowPfcPausePauseClass5MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass5MetricTag) 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 *patternFlowPfcPausePauseClass5MetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass5MetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass5MetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass5MetricTag) Clone() (PatternFlowPfcPausePauseClass5MetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass5MetricTag() + 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 +} + +// PatternFlowPfcPausePauseClass5MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPfcPausePauseClass5MetricTag interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass5MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass5MetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass5MetricTag + // setMsg unmarshals PatternFlowPfcPausePauseClass5MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass5MetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass5MetricTag) PatternFlowPfcPausePauseClass5MetricTag + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass5MetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass5MetricTag + // validate validates PatternFlowPfcPausePauseClass5MetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass5MetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPfcPausePauseClass5MetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPfcPausePauseClass5MetricTag + SetName(value string) PatternFlowPfcPausePauseClass5MetricTag + // Offset returns uint32, set in PatternFlowPfcPausePauseClass5MetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass5MetricTag + SetOffset(value uint32) PatternFlowPfcPausePauseClass5MetricTag + // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass5MetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPfcPausePauseClass5MetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass5MetricTag + SetLength(value uint32) PatternFlowPfcPausePauseClass5MetricTag + // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass5MetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPfcPausePauseClass5MetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPfcPausePauseClass5MetricTag object +func (obj *patternFlowPfcPausePauseClass5MetricTag) SetName(value string) PatternFlowPfcPausePauseClass5MetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass5MetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass5MetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass5MetricTag object +func (obj *patternFlowPfcPausePauseClass5MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass5MetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass5MetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass5MetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass5MetricTag object +func (obj *patternFlowPfcPausePauseClass5MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass5MetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass5MetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass5MetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass5MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass5MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass5MetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class6.go b/gosnappi/pattern_flow_pfc_pause_pause_class6.go new file mode 100644 index 00000000..36645b93 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class6.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass6 ***** +type patternFlowPfcPausePauseClass6 struct { + validation + obj *otg.PatternFlowPfcPausePauseClass6 + marshaller marshalPatternFlowPfcPausePauseClass6 + unMarshaller unMarshalPatternFlowPfcPausePauseClass6 + incrementHolder PatternFlowPfcPausePauseClass6Counter + decrementHolder PatternFlowPfcPausePauseClass6Counter + metricTagsHolder PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter +} + +func NewPatternFlowPfcPausePauseClass6() PatternFlowPfcPausePauseClass6 { + obj := patternFlowPfcPausePauseClass6{obj: &otg.PatternFlowPfcPausePauseClass6{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass6) msg() *otg.PatternFlowPfcPausePauseClass6 { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass6) setMsg(msg *otg.PatternFlowPfcPausePauseClass6) PatternFlowPfcPausePauseClass6 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass6 struct { + obj *patternFlowPfcPausePauseClass6 +} + +type marshalPatternFlowPfcPausePauseClass6 interface { + // ToProto marshals PatternFlowPfcPausePauseClass6 to protobuf object *otg.PatternFlowPfcPausePauseClass6 + ToProto() (*otg.PatternFlowPfcPausePauseClass6, error) + // ToPbText marshals PatternFlowPfcPausePauseClass6 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass6 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass6 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass6 struct { + obj *patternFlowPfcPausePauseClass6 +} + +type unMarshalPatternFlowPfcPausePauseClass6 interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass6 from protobuf object *otg.PatternFlowPfcPausePauseClass6 + FromProto(msg *otg.PatternFlowPfcPausePauseClass6) (PatternFlowPfcPausePauseClass6, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass6 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass6 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass6 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass6) Marshal() marshalPatternFlowPfcPausePauseClass6 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass6{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass6) Unmarshal() unMarshalPatternFlowPfcPausePauseClass6 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass6{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass6) ToProto() (*otg.PatternFlowPfcPausePauseClass6, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass6) FromProto(msg *otg.PatternFlowPfcPausePauseClass6) (PatternFlowPfcPausePauseClass6, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass6) 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 *unMarshalpatternFlowPfcPausePauseClass6) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPfcPausePauseClass6) 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 *unMarshalpatternFlowPfcPausePauseClass6) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPfcPausePauseClass6) 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 *unMarshalpatternFlowPfcPausePauseClass6) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPfcPausePauseClass6) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass6) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass6) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass6) Clone() (PatternFlowPfcPausePauseClass6, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass6() + 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 +} + +func (obj *patternFlowPfcPausePauseClass6) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPfcPausePauseClass6 is pause class 6 +type PatternFlowPfcPausePauseClass6 interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass6 to protobuf object *otg.PatternFlowPfcPausePauseClass6 + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass6 + // setMsg unmarshals PatternFlowPfcPausePauseClass6 from protobuf object *otg.PatternFlowPfcPausePauseClass6 + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass6) PatternFlowPfcPausePauseClass6 + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass6 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass6 + // validate validates PatternFlowPfcPausePauseClass6 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass6, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPfcPausePauseClass6ChoiceEnum, set in PatternFlowPfcPausePauseClass6 + Choice() PatternFlowPfcPausePauseClass6ChoiceEnum + // setChoice assigns PatternFlowPfcPausePauseClass6ChoiceEnum provided by user to PatternFlowPfcPausePauseClass6 + setChoice(value PatternFlowPfcPausePauseClass6ChoiceEnum) PatternFlowPfcPausePauseClass6 + // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass6 + HasChoice() bool + // Value returns uint32, set in PatternFlowPfcPausePauseClass6. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass6 + SetValue(value uint32) PatternFlowPfcPausePauseClass6 + // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass6 + HasValue() bool + // Values returns []uint32, set in PatternFlowPfcPausePauseClass6. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass6 + SetValues(value []uint32) PatternFlowPfcPausePauseClass6 + // Increment returns PatternFlowPfcPausePauseClass6Counter, set in PatternFlowPfcPausePauseClass6. + // PatternFlowPfcPausePauseClass6Counter is integer counter pattern + Increment() PatternFlowPfcPausePauseClass6Counter + // SetIncrement assigns PatternFlowPfcPausePauseClass6Counter provided by user to PatternFlowPfcPausePauseClass6. + // PatternFlowPfcPausePauseClass6Counter is integer counter pattern + SetIncrement(value PatternFlowPfcPausePauseClass6Counter) PatternFlowPfcPausePauseClass6 + // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass6 + HasIncrement() bool + // Decrement returns PatternFlowPfcPausePauseClass6Counter, set in PatternFlowPfcPausePauseClass6. + // PatternFlowPfcPausePauseClass6Counter is integer counter pattern + Decrement() PatternFlowPfcPausePauseClass6Counter + // SetDecrement assigns PatternFlowPfcPausePauseClass6Counter provided by user to PatternFlowPfcPausePauseClass6. + // PatternFlowPfcPausePauseClass6Counter is integer counter pattern + SetDecrement(value PatternFlowPfcPausePauseClass6Counter) PatternFlowPfcPausePauseClass6 + // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass6 + HasDecrement() bool + // MetricTags returns PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIterIter, set in PatternFlowPfcPausePauseClass6 + MetricTags() PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter + setNil() +} + +type PatternFlowPfcPausePauseClass6ChoiceEnum string + +// Enum of Choice on PatternFlowPfcPausePauseClass6 +var PatternFlowPfcPausePauseClass6Choice = struct { + VALUE PatternFlowPfcPausePauseClass6ChoiceEnum + VALUES PatternFlowPfcPausePauseClass6ChoiceEnum + INCREMENT PatternFlowPfcPausePauseClass6ChoiceEnum + DECREMENT PatternFlowPfcPausePauseClass6ChoiceEnum +}{ + VALUE: PatternFlowPfcPausePauseClass6ChoiceEnum("value"), + VALUES: PatternFlowPfcPausePauseClass6ChoiceEnum("values"), + INCREMENT: PatternFlowPfcPausePauseClass6ChoiceEnum("increment"), + DECREMENT: PatternFlowPfcPausePauseClass6ChoiceEnum("decrement"), +} + +func (obj *patternFlowPfcPausePauseClass6) Choice() PatternFlowPfcPausePauseClass6ChoiceEnum { + return PatternFlowPfcPausePauseClass6ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPfcPausePauseClass6) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPfcPausePauseClass6) setChoice(value PatternFlowPfcPausePauseClass6ChoiceEnum) PatternFlowPfcPausePauseClass6 { + intValue, ok := otg.PatternFlowPfcPausePauseClass6_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPfcPausePauseClass6ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPfcPausePauseClass6_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPfcPausePauseClass6Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPfcPausePauseClass6Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPfcPausePauseClass6Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowPfcPausePauseClass6Counter().msg() + } + + if value == PatternFlowPfcPausePauseClass6Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPfcPausePauseClass6Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass6) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPfcPausePauseClass6Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass6) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass6 object +func (obj *patternFlowPfcPausePauseClass6) SetValue(value uint32) PatternFlowPfcPausePauseClass6 { + obj.setChoice(PatternFlowPfcPausePauseClass6Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowPfcPausePauseClass6) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass6 object +func (obj *patternFlowPfcPausePauseClass6) SetValues(value []uint32) PatternFlowPfcPausePauseClass6 { + obj.setChoice(PatternFlowPfcPausePauseClass6Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass6Counter +func (obj *patternFlowPfcPausePauseClass6) Increment() PatternFlowPfcPausePauseClass6Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPfcPausePauseClass6Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPfcPausePauseClass6Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass6Counter +func (obj *patternFlowPfcPausePauseClass6) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPfcPausePauseClass6Counter value in the PatternFlowPfcPausePauseClass6 object +func (obj *patternFlowPfcPausePauseClass6) SetIncrement(value PatternFlowPfcPausePauseClass6Counter) PatternFlowPfcPausePauseClass6 { + obj.setChoice(PatternFlowPfcPausePauseClass6Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass6Counter +func (obj *patternFlowPfcPausePauseClass6) Decrement() PatternFlowPfcPausePauseClass6Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPfcPausePauseClass6Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPfcPausePauseClass6Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass6Counter +func (obj *patternFlowPfcPausePauseClass6) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPfcPausePauseClass6Counter value in the PatternFlowPfcPausePauseClass6 object +func (obj *patternFlowPfcPausePauseClass6) SetDecrement(value PatternFlowPfcPausePauseClass6Counter) PatternFlowPfcPausePauseClass6 { + obj.setChoice(PatternFlowPfcPausePauseClass6Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPfcPausePauseClass6MetricTag +func (obj *patternFlowPfcPausePauseClass6) MetricTags() PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass6MetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter struct { + obj *patternFlowPfcPausePauseClass6 + patternFlowPfcPausePauseClass6MetricTagSlice []PatternFlowPfcPausePauseClass6MetricTag + fieldPtr *[]*otg.PatternFlowPfcPausePauseClass6MetricTag +} + +func newPatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { + return &patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter interface { + setMsg(*patternFlowPfcPausePauseClass6) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter + Items() []PatternFlowPfcPausePauseClass6MetricTag + Add() PatternFlowPfcPausePauseClass6MetricTag + Append(items ...PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter + Set(index int, newObj PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter + Clear() PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter + clearHolderSlice() PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter + appendHolderSlice(item PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter +} + +func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass6) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPfcPausePauseClass6MetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) Items() []PatternFlowPfcPausePauseClass6MetricTag { + return obj.patternFlowPfcPausePauseClass6MetricTagSlice +} + +func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) Add() PatternFlowPfcPausePauseClass6MetricTag { + newObj := &otg.PatternFlowPfcPausePauseClass6MetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPfcPausePauseClass6MetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPfcPausePauseClass6MetricTagSlice = append(obj.patternFlowPfcPausePauseClass6MetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPfcPausePauseClass6MetricTagSlice = append(obj.patternFlowPfcPausePauseClass6MetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPfcPausePauseClass6MetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) Clear() PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass6MetricTag{} + obj.patternFlowPfcPausePauseClass6MetricTagSlice = []PatternFlowPfcPausePauseClass6MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { + if len(obj.patternFlowPfcPausePauseClass6MetricTagSlice) > 0 { + obj.patternFlowPfcPausePauseClass6MetricTagSlice = []PatternFlowPfcPausePauseClass6MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6PatternFlowPfcPausePauseClass6MetricTagIter { + obj.patternFlowPfcPausePauseClass6MetricTagSlice = append(obj.patternFlowPfcPausePauseClass6MetricTagSlice, item) + return obj +} + +func (obj *patternFlowPfcPausePauseClass6) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass6.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass6.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass6MetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass6) setDefault() { + var choices_set int = 0 + var choice PatternFlowPfcPausePauseClass6ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass6Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass6Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass6Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass6Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPfcPausePauseClass6Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass6") + } + } else { + intVal := otg.PatternFlowPfcPausePauseClass6_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPfcPausePauseClass6_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class6_counter.go b/gosnappi/pattern_flow_pfc_pause_pause_class6_counter.go new file mode 100644 index 00000000..47023254 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class6_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass6Counter ***** +type patternFlowPfcPausePauseClass6Counter struct { + validation + obj *otg.PatternFlowPfcPausePauseClass6Counter + marshaller marshalPatternFlowPfcPausePauseClass6Counter + unMarshaller unMarshalPatternFlowPfcPausePauseClass6Counter +} + +func NewPatternFlowPfcPausePauseClass6Counter() PatternFlowPfcPausePauseClass6Counter { + obj := patternFlowPfcPausePauseClass6Counter{obj: &otg.PatternFlowPfcPausePauseClass6Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass6Counter) msg() *otg.PatternFlowPfcPausePauseClass6Counter { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass6Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass6Counter) PatternFlowPfcPausePauseClass6Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass6Counter struct { + obj *patternFlowPfcPausePauseClass6Counter +} + +type marshalPatternFlowPfcPausePauseClass6Counter interface { + // ToProto marshals PatternFlowPfcPausePauseClass6Counter to protobuf object *otg.PatternFlowPfcPausePauseClass6Counter + ToProto() (*otg.PatternFlowPfcPausePauseClass6Counter, error) + // ToPbText marshals PatternFlowPfcPausePauseClass6Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass6Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass6Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass6Counter struct { + obj *patternFlowPfcPausePauseClass6Counter +} + +type unMarshalPatternFlowPfcPausePauseClass6Counter interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass6Counter from protobuf object *otg.PatternFlowPfcPausePauseClass6Counter + FromProto(msg *otg.PatternFlowPfcPausePauseClass6Counter) (PatternFlowPfcPausePauseClass6Counter, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass6Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass6Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass6Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass6Counter) Marshal() marshalPatternFlowPfcPausePauseClass6Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass6Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass6Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass6Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass6Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass6Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass6Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass6Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass6Counter) (PatternFlowPfcPausePauseClass6Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass6Counter) 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 *unMarshalpatternFlowPfcPausePauseClass6Counter) 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 *marshalpatternFlowPfcPausePauseClass6Counter) 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 *unMarshalpatternFlowPfcPausePauseClass6Counter) 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 *marshalpatternFlowPfcPausePauseClass6Counter) 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 *unMarshalpatternFlowPfcPausePauseClass6Counter) 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 *patternFlowPfcPausePauseClass6Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass6Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass6Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass6Counter) Clone() (PatternFlowPfcPausePauseClass6Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass6Counter() + 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 +} + +// PatternFlowPfcPausePauseClass6Counter is integer counter pattern +type PatternFlowPfcPausePauseClass6Counter interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass6Counter to protobuf object *otg.PatternFlowPfcPausePauseClass6Counter + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass6Counter + // setMsg unmarshals PatternFlowPfcPausePauseClass6Counter from protobuf object *otg.PatternFlowPfcPausePauseClass6Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass6Counter) PatternFlowPfcPausePauseClass6Counter + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass6Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass6Counter + // validate validates PatternFlowPfcPausePauseClass6Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass6Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowPfcPausePauseClass6Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass6Counter + SetStart(value uint32) PatternFlowPfcPausePauseClass6Counter + // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass6Counter + HasStart() bool + // Step returns uint32, set in PatternFlowPfcPausePauseClass6Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass6Counter + SetStep(value uint32) PatternFlowPfcPausePauseClass6Counter + // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass6Counter + HasStep() bool + // Count returns uint32, set in PatternFlowPfcPausePauseClass6Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass6Counter + SetCount(value uint32) PatternFlowPfcPausePauseClass6Counter + // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass6Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass6Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass6Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass6Counter object +func (obj *patternFlowPfcPausePauseClass6Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass6Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass6Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass6Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass6Counter object +func (obj *patternFlowPfcPausePauseClass6Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass6Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass6Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass6Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass6Counter object +func (obj *patternFlowPfcPausePauseClass6Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass6Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass6Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass6Counter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass6Counter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass6Counter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass6Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class6_metric_tag.go b/gosnappi/pattern_flow_pfc_pause_pause_class6_metric_tag.go new file mode 100644 index 00000000..eb4a0371 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class6_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass6MetricTag ***** +type patternFlowPfcPausePauseClass6MetricTag struct { + validation + obj *otg.PatternFlowPfcPausePauseClass6MetricTag + marshaller marshalPatternFlowPfcPausePauseClass6MetricTag + unMarshaller unMarshalPatternFlowPfcPausePauseClass6MetricTag +} + +func NewPatternFlowPfcPausePauseClass6MetricTag() PatternFlowPfcPausePauseClass6MetricTag { + obj := patternFlowPfcPausePauseClass6MetricTag{obj: &otg.PatternFlowPfcPausePauseClass6MetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass6MetricTag) msg() *otg.PatternFlowPfcPausePauseClass6MetricTag { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass6MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6MetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass6MetricTag struct { + obj *patternFlowPfcPausePauseClass6MetricTag +} + +type marshalPatternFlowPfcPausePauseClass6MetricTag interface { + // ToProto marshals PatternFlowPfcPausePauseClass6MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass6MetricTag + ToProto() (*otg.PatternFlowPfcPausePauseClass6MetricTag, error) + // ToPbText marshals PatternFlowPfcPausePauseClass6MetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass6MetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass6MetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass6MetricTag struct { + obj *patternFlowPfcPausePauseClass6MetricTag +} + +type unMarshalPatternFlowPfcPausePauseClass6MetricTag interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass6MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass6MetricTag + FromProto(msg *otg.PatternFlowPfcPausePauseClass6MetricTag) (PatternFlowPfcPausePauseClass6MetricTag, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass6MetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass6MetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass6MetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass6MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass6MetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass6MetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass6MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass6MetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass6MetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass6MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass6MetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass6MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass6MetricTag) (PatternFlowPfcPausePauseClass6MetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass6MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass6MetricTag) 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 *marshalpatternFlowPfcPausePauseClass6MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass6MetricTag) 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 *marshalpatternFlowPfcPausePauseClass6MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass6MetricTag) 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 *patternFlowPfcPausePauseClass6MetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass6MetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass6MetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass6MetricTag) Clone() (PatternFlowPfcPausePauseClass6MetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass6MetricTag() + 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 +} + +// PatternFlowPfcPausePauseClass6MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPfcPausePauseClass6MetricTag interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass6MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass6MetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass6MetricTag + // setMsg unmarshals PatternFlowPfcPausePauseClass6MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass6MetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass6MetricTag) PatternFlowPfcPausePauseClass6MetricTag + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass6MetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass6MetricTag + // validate validates PatternFlowPfcPausePauseClass6MetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass6MetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPfcPausePauseClass6MetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPfcPausePauseClass6MetricTag + SetName(value string) PatternFlowPfcPausePauseClass6MetricTag + // Offset returns uint32, set in PatternFlowPfcPausePauseClass6MetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass6MetricTag + SetOffset(value uint32) PatternFlowPfcPausePauseClass6MetricTag + // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass6MetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPfcPausePauseClass6MetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass6MetricTag + SetLength(value uint32) PatternFlowPfcPausePauseClass6MetricTag + // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass6MetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPfcPausePauseClass6MetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPfcPausePauseClass6MetricTag object +func (obj *patternFlowPfcPausePauseClass6MetricTag) SetName(value string) PatternFlowPfcPausePauseClass6MetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass6MetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass6MetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass6MetricTag object +func (obj *patternFlowPfcPausePauseClass6MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass6MetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass6MetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass6MetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass6MetricTag object +func (obj *patternFlowPfcPausePauseClass6MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass6MetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass6MetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass6MetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass6MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass6MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass6MetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class7.go b/gosnappi/pattern_flow_pfc_pause_pause_class7.go new file mode 100644 index 00000000..feceb320 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class7.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass7 ***** +type patternFlowPfcPausePauseClass7 struct { + validation + obj *otg.PatternFlowPfcPausePauseClass7 + marshaller marshalPatternFlowPfcPausePauseClass7 + unMarshaller unMarshalPatternFlowPfcPausePauseClass7 + incrementHolder PatternFlowPfcPausePauseClass7Counter + decrementHolder PatternFlowPfcPausePauseClass7Counter + metricTagsHolder PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter +} + +func NewPatternFlowPfcPausePauseClass7() PatternFlowPfcPausePauseClass7 { + obj := patternFlowPfcPausePauseClass7{obj: &otg.PatternFlowPfcPausePauseClass7{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass7) msg() *otg.PatternFlowPfcPausePauseClass7 { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass7) setMsg(msg *otg.PatternFlowPfcPausePauseClass7) PatternFlowPfcPausePauseClass7 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass7 struct { + obj *patternFlowPfcPausePauseClass7 +} + +type marshalPatternFlowPfcPausePauseClass7 interface { + // ToProto marshals PatternFlowPfcPausePauseClass7 to protobuf object *otg.PatternFlowPfcPausePauseClass7 + ToProto() (*otg.PatternFlowPfcPausePauseClass7, error) + // ToPbText marshals PatternFlowPfcPausePauseClass7 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass7 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass7 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass7 struct { + obj *patternFlowPfcPausePauseClass7 +} + +type unMarshalPatternFlowPfcPausePauseClass7 interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass7 from protobuf object *otg.PatternFlowPfcPausePauseClass7 + FromProto(msg *otg.PatternFlowPfcPausePauseClass7) (PatternFlowPfcPausePauseClass7, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass7 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass7 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass7 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass7) Marshal() marshalPatternFlowPfcPausePauseClass7 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass7{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass7) Unmarshal() unMarshalPatternFlowPfcPausePauseClass7 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass7{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass7) ToProto() (*otg.PatternFlowPfcPausePauseClass7, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass7) FromProto(msg *otg.PatternFlowPfcPausePauseClass7) (PatternFlowPfcPausePauseClass7, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass7) 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 *unMarshalpatternFlowPfcPausePauseClass7) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPfcPausePauseClass7) 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 *unMarshalpatternFlowPfcPausePauseClass7) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPfcPausePauseClass7) 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 *unMarshalpatternFlowPfcPausePauseClass7) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPfcPausePauseClass7) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass7) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass7) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass7) Clone() (PatternFlowPfcPausePauseClass7, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass7() + 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 +} + +func (obj *patternFlowPfcPausePauseClass7) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPfcPausePauseClass7 is pause class 7 +type PatternFlowPfcPausePauseClass7 interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass7 to protobuf object *otg.PatternFlowPfcPausePauseClass7 + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass7 + // setMsg unmarshals PatternFlowPfcPausePauseClass7 from protobuf object *otg.PatternFlowPfcPausePauseClass7 + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass7) PatternFlowPfcPausePauseClass7 + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass7 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass7 + // validate validates PatternFlowPfcPausePauseClass7 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass7, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPfcPausePauseClass7ChoiceEnum, set in PatternFlowPfcPausePauseClass7 + Choice() PatternFlowPfcPausePauseClass7ChoiceEnum + // setChoice assigns PatternFlowPfcPausePauseClass7ChoiceEnum provided by user to PatternFlowPfcPausePauseClass7 + setChoice(value PatternFlowPfcPausePauseClass7ChoiceEnum) PatternFlowPfcPausePauseClass7 + // HasChoice checks if Choice has been set in PatternFlowPfcPausePauseClass7 + HasChoice() bool + // Value returns uint32, set in PatternFlowPfcPausePauseClass7. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowPfcPausePauseClass7 + SetValue(value uint32) PatternFlowPfcPausePauseClass7 + // HasValue checks if Value has been set in PatternFlowPfcPausePauseClass7 + HasValue() bool + // Values returns []uint32, set in PatternFlowPfcPausePauseClass7. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowPfcPausePauseClass7 + SetValues(value []uint32) PatternFlowPfcPausePauseClass7 + // Increment returns PatternFlowPfcPausePauseClass7Counter, set in PatternFlowPfcPausePauseClass7. + // PatternFlowPfcPausePauseClass7Counter is integer counter pattern + Increment() PatternFlowPfcPausePauseClass7Counter + // SetIncrement assigns PatternFlowPfcPausePauseClass7Counter provided by user to PatternFlowPfcPausePauseClass7. + // PatternFlowPfcPausePauseClass7Counter is integer counter pattern + SetIncrement(value PatternFlowPfcPausePauseClass7Counter) PatternFlowPfcPausePauseClass7 + // HasIncrement checks if Increment has been set in PatternFlowPfcPausePauseClass7 + HasIncrement() bool + // Decrement returns PatternFlowPfcPausePauseClass7Counter, set in PatternFlowPfcPausePauseClass7. + // PatternFlowPfcPausePauseClass7Counter is integer counter pattern + Decrement() PatternFlowPfcPausePauseClass7Counter + // SetDecrement assigns PatternFlowPfcPausePauseClass7Counter provided by user to PatternFlowPfcPausePauseClass7. + // PatternFlowPfcPausePauseClass7Counter is integer counter pattern + SetDecrement(value PatternFlowPfcPausePauseClass7Counter) PatternFlowPfcPausePauseClass7 + // HasDecrement checks if Decrement has been set in PatternFlowPfcPausePauseClass7 + HasDecrement() bool + // MetricTags returns PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIterIter, set in PatternFlowPfcPausePauseClass7 + MetricTags() PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter + setNil() +} + +type PatternFlowPfcPausePauseClass7ChoiceEnum string + +// Enum of Choice on PatternFlowPfcPausePauseClass7 +var PatternFlowPfcPausePauseClass7Choice = struct { + VALUE PatternFlowPfcPausePauseClass7ChoiceEnum + VALUES PatternFlowPfcPausePauseClass7ChoiceEnum + INCREMENT PatternFlowPfcPausePauseClass7ChoiceEnum + DECREMENT PatternFlowPfcPausePauseClass7ChoiceEnum +}{ + VALUE: PatternFlowPfcPausePauseClass7ChoiceEnum("value"), + VALUES: PatternFlowPfcPausePauseClass7ChoiceEnum("values"), + INCREMENT: PatternFlowPfcPausePauseClass7ChoiceEnum("increment"), + DECREMENT: PatternFlowPfcPausePauseClass7ChoiceEnum("decrement"), +} + +func (obj *patternFlowPfcPausePauseClass7) Choice() PatternFlowPfcPausePauseClass7ChoiceEnum { + return PatternFlowPfcPausePauseClass7ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPfcPausePauseClass7) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPfcPausePauseClass7) setChoice(value PatternFlowPfcPausePauseClass7ChoiceEnum) PatternFlowPfcPausePauseClass7 { + intValue, ok := otg.PatternFlowPfcPausePauseClass7_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPfcPausePauseClass7ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPfcPausePauseClass7_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPfcPausePauseClass7Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPfcPausePauseClass7Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPfcPausePauseClass7Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowPfcPausePauseClass7Counter().msg() + } + + if value == PatternFlowPfcPausePauseClass7Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPfcPausePauseClass7Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass7) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPfcPausePauseClass7Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPfcPausePauseClass7) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowPfcPausePauseClass7 object +func (obj *patternFlowPfcPausePauseClass7) SetValue(value uint32) PatternFlowPfcPausePauseClass7 { + obj.setChoice(PatternFlowPfcPausePauseClass7Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowPfcPausePauseClass7) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowPfcPausePauseClass7 object +func (obj *patternFlowPfcPausePauseClass7) SetValues(value []uint32) PatternFlowPfcPausePauseClass7 { + obj.setChoice(PatternFlowPfcPausePauseClass7Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass7Counter +func (obj *patternFlowPfcPausePauseClass7) Increment() PatternFlowPfcPausePauseClass7Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPfcPausePauseClass7Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPfcPausePauseClass7Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPfcPausePauseClass7Counter +func (obj *patternFlowPfcPausePauseClass7) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPfcPausePauseClass7Counter value in the PatternFlowPfcPausePauseClass7 object +func (obj *patternFlowPfcPausePauseClass7) SetIncrement(value PatternFlowPfcPausePauseClass7Counter) PatternFlowPfcPausePauseClass7 { + obj.setChoice(PatternFlowPfcPausePauseClass7Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass7Counter +func (obj *patternFlowPfcPausePauseClass7) Decrement() PatternFlowPfcPausePauseClass7Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPfcPausePauseClass7Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPfcPausePauseClass7Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPfcPausePauseClass7Counter +func (obj *patternFlowPfcPausePauseClass7) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPfcPausePauseClass7Counter value in the PatternFlowPfcPausePauseClass7 object +func (obj *patternFlowPfcPausePauseClass7) SetDecrement(value PatternFlowPfcPausePauseClass7Counter) PatternFlowPfcPausePauseClass7 { + obj.setChoice(PatternFlowPfcPausePauseClass7Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPfcPausePauseClass7MetricTag +func (obj *patternFlowPfcPausePauseClass7) MetricTags() PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPfcPausePauseClass7MetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter struct { + obj *patternFlowPfcPausePauseClass7 + patternFlowPfcPausePauseClass7MetricTagSlice []PatternFlowPfcPausePauseClass7MetricTag + fieldPtr *[]*otg.PatternFlowPfcPausePauseClass7MetricTag +} + +func newPatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter(ptr *[]*otg.PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { + return &patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter interface { + setMsg(*patternFlowPfcPausePauseClass7) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter + Items() []PatternFlowPfcPausePauseClass7MetricTag + Add() PatternFlowPfcPausePauseClass7MetricTag + Append(items ...PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter + Set(index int, newObj PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter + Clear() PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter + clearHolderSlice() PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter + appendHolderSlice(item PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter +} + +func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) setMsg(msg *patternFlowPfcPausePauseClass7) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPfcPausePauseClass7MetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) Items() []PatternFlowPfcPausePauseClass7MetricTag { + return obj.patternFlowPfcPausePauseClass7MetricTagSlice +} + +func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) Add() PatternFlowPfcPausePauseClass7MetricTag { + newObj := &otg.PatternFlowPfcPausePauseClass7MetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPfcPausePauseClass7MetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPfcPausePauseClass7MetricTagSlice = append(obj.patternFlowPfcPausePauseClass7MetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) Append(items ...PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPfcPausePauseClass7MetricTagSlice = append(obj.patternFlowPfcPausePauseClass7MetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) Set(index int, newObj PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPfcPausePauseClass7MetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) Clear() PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPfcPausePauseClass7MetricTag{} + obj.patternFlowPfcPausePauseClass7MetricTagSlice = []PatternFlowPfcPausePauseClass7MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) clearHolderSlice() PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { + if len(obj.patternFlowPfcPausePauseClass7MetricTagSlice) > 0 { + obj.patternFlowPfcPausePauseClass7MetricTagSlice = []PatternFlowPfcPausePauseClass7MetricTag{} + } + return obj +} +func (obj *patternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter) appendHolderSlice(item PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7PatternFlowPfcPausePauseClass7MetricTagIter { + obj.patternFlowPfcPausePauseClass7MetricTagSlice = append(obj.patternFlowPfcPausePauseClass7MetricTagSlice, item) + return obj +} + +func (obj *patternFlowPfcPausePauseClass7) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass7.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowPfcPausePauseClass7.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPfcPausePauseClass7MetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass7) setDefault() { + var choices_set int = 0 + var choice PatternFlowPfcPausePauseClass7ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass7Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass7Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass7Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPfcPausePauseClass7Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPfcPausePauseClass7Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPausePauseClass7") + } + } else { + intVal := otg.PatternFlowPfcPausePauseClass7_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPfcPausePauseClass7_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class7_counter.go b/gosnappi/pattern_flow_pfc_pause_pause_class7_counter.go new file mode 100644 index 00000000..fbc235c3 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class7_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass7Counter ***** +type patternFlowPfcPausePauseClass7Counter struct { + validation + obj *otg.PatternFlowPfcPausePauseClass7Counter + marshaller marshalPatternFlowPfcPausePauseClass7Counter + unMarshaller unMarshalPatternFlowPfcPausePauseClass7Counter +} + +func NewPatternFlowPfcPausePauseClass7Counter() PatternFlowPfcPausePauseClass7Counter { + obj := patternFlowPfcPausePauseClass7Counter{obj: &otg.PatternFlowPfcPausePauseClass7Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass7Counter) msg() *otg.PatternFlowPfcPausePauseClass7Counter { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass7Counter) setMsg(msg *otg.PatternFlowPfcPausePauseClass7Counter) PatternFlowPfcPausePauseClass7Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass7Counter struct { + obj *patternFlowPfcPausePauseClass7Counter +} + +type marshalPatternFlowPfcPausePauseClass7Counter interface { + // ToProto marshals PatternFlowPfcPausePauseClass7Counter to protobuf object *otg.PatternFlowPfcPausePauseClass7Counter + ToProto() (*otg.PatternFlowPfcPausePauseClass7Counter, error) + // ToPbText marshals PatternFlowPfcPausePauseClass7Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass7Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass7Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass7Counter struct { + obj *patternFlowPfcPausePauseClass7Counter +} + +type unMarshalPatternFlowPfcPausePauseClass7Counter interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass7Counter from protobuf object *otg.PatternFlowPfcPausePauseClass7Counter + FromProto(msg *otg.PatternFlowPfcPausePauseClass7Counter) (PatternFlowPfcPausePauseClass7Counter, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass7Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass7Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass7Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass7Counter) Marshal() marshalPatternFlowPfcPausePauseClass7Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass7Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass7Counter) Unmarshal() unMarshalPatternFlowPfcPausePauseClass7Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass7Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass7Counter) ToProto() (*otg.PatternFlowPfcPausePauseClass7Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass7Counter) FromProto(msg *otg.PatternFlowPfcPausePauseClass7Counter) (PatternFlowPfcPausePauseClass7Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass7Counter) 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 *unMarshalpatternFlowPfcPausePauseClass7Counter) 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 *marshalpatternFlowPfcPausePauseClass7Counter) 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 *unMarshalpatternFlowPfcPausePauseClass7Counter) 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 *marshalpatternFlowPfcPausePauseClass7Counter) 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 *unMarshalpatternFlowPfcPausePauseClass7Counter) 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 *patternFlowPfcPausePauseClass7Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass7Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass7Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass7Counter) Clone() (PatternFlowPfcPausePauseClass7Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass7Counter() + 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 +} + +// PatternFlowPfcPausePauseClass7Counter is integer counter pattern +type PatternFlowPfcPausePauseClass7Counter interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass7Counter to protobuf object *otg.PatternFlowPfcPausePauseClass7Counter + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass7Counter + // setMsg unmarshals PatternFlowPfcPausePauseClass7Counter from protobuf object *otg.PatternFlowPfcPausePauseClass7Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass7Counter) PatternFlowPfcPausePauseClass7Counter + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass7Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass7Counter + // validate validates PatternFlowPfcPausePauseClass7Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass7Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowPfcPausePauseClass7Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowPfcPausePauseClass7Counter + SetStart(value uint32) PatternFlowPfcPausePauseClass7Counter + // HasStart checks if Start has been set in PatternFlowPfcPausePauseClass7Counter + HasStart() bool + // Step returns uint32, set in PatternFlowPfcPausePauseClass7Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowPfcPausePauseClass7Counter + SetStep(value uint32) PatternFlowPfcPausePauseClass7Counter + // HasStep checks if Step has been set in PatternFlowPfcPausePauseClass7Counter + HasStep() bool + // Count returns uint32, set in PatternFlowPfcPausePauseClass7Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPfcPausePauseClass7Counter + SetCount(value uint32) PatternFlowPfcPausePauseClass7Counter + // HasCount checks if Count has been set in PatternFlowPfcPausePauseClass7Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass7Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPfcPausePauseClass7Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowPfcPausePauseClass7Counter object +func (obj *patternFlowPfcPausePauseClass7Counter) SetStart(value uint32) PatternFlowPfcPausePauseClass7Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass7Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPfcPausePauseClass7Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowPfcPausePauseClass7Counter object +func (obj *patternFlowPfcPausePauseClass7Counter) SetStep(value uint32) PatternFlowPfcPausePauseClass7Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass7Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPausePauseClass7Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPfcPausePauseClass7Counter object +func (obj *patternFlowPfcPausePauseClass7Counter) SetCount(value uint32) PatternFlowPfcPausePauseClass7Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass7Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass7Counter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass7Counter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass7Counter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass7Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_pause_class7_metric_tag.go b/gosnappi/pattern_flow_pfc_pause_pause_class7_metric_tag.go new file mode 100644 index 00000000..2452b078 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_pause_class7_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPfcPausePauseClass7MetricTag ***** +type patternFlowPfcPausePauseClass7MetricTag struct { + validation + obj *otg.PatternFlowPfcPausePauseClass7MetricTag + marshaller marshalPatternFlowPfcPausePauseClass7MetricTag + unMarshaller unMarshalPatternFlowPfcPausePauseClass7MetricTag +} + +func NewPatternFlowPfcPausePauseClass7MetricTag() PatternFlowPfcPausePauseClass7MetricTag { + obj := patternFlowPfcPausePauseClass7MetricTag{obj: &otg.PatternFlowPfcPausePauseClass7MetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPausePauseClass7MetricTag) msg() *otg.PatternFlowPfcPausePauseClass7MetricTag { + return obj.obj +} + +func (obj *patternFlowPfcPausePauseClass7MetricTag) setMsg(msg *otg.PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7MetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPausePauseClass7MetricTag struct { + obj *patternFlowPfcPausePauseClass7MetricTag +} + +type marshalPatternFlowPfcPausePauseClass7MetricTag interface { + // ToProto marshals PatternFlowPfcPausePauseClass7MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass7MetricTag + ToProto() (*otg.PatternFlowPfcPausePauseClass7MetricTag, error) + // ToPbText marshals PatternFlowPfcPausePauseClass7MetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPausePauseClass7MetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPausePauseClass7MetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPausePauseClass7MetricTag struct { + obj *patternFlowPfcPausePauseClass7MetricTag +} + +type unMarshalPatternFlowPfcPausePauseClass7MetricTag interface { + // FromProto unmarshals PatternFlowPfcPausePauseClass7MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass7MetricTag + FromProto(msg *otg.PatternFlowPfcPausePauseClass7MetricTag) (PatternFlowPfcPausePauseClass7MetricTag, error) + // FromPbText unmarshals PatternFlowPfcPausePauseClass7MetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPausePauseClass7MetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPausePauseClass7MetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPausePauseClass7MetricTag) Marshal() marshalPatternFlowPfcPausePauseClass7MetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPausePauseClass7MetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPausePauseClass7MetricTag) Unmarshal() unMarshalPatternFlowPfcPausePauseClass7MetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPausePauseClass7MetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPausePauseClass7MetricTag) ToProto() (*otg.PatternFlowPfcPausePauseClass7MetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPausePauseClass7MetricTag) FromProto(msg *otg.PatternFlowPfcPausePauseClass7MetricTag) (PatternFlowPfcPausePauseClass7MetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPausePauseClass7MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass7MetricTag) 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 *marshalpatternFlowPfcPausePauseClass7MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass7MetricTag) 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 *marshalpatternFlowPfcPausePauseClass7MetricTag) 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 *unMarshalpatternFlowPfcPausePauseClass7MetricTag) 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 *patternFlowPfcPausePauseClass7MetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass7MetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPausePauseClass7MetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPausePauseClass7MetricTag) Clone() (PatternFlowPfcPausePauseClass7MetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPausePauseClass7MetricTag() + 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 +} + +// PatternFlowPfcPausePauseClass7MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPfcPausePauseClass7MetricTag interface { + Validation + // msg marshals PatternFlowPfcPausePauseClass7MetricTag to protobuf object *otg.PatternFlowPfcPausePauseClass7MetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPfcPausePauseClass7MetricTag + // setMsg unmarshals PatternFlowPfcPausePauseClass7MetricTag from protobuf object *otg.PatternFlowPfcPausePauseClass7MetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPausePauseClass7MetricTag) PatternFlowPfcPausePauseClass7MetricTag + // provides marshal interface + Marshal() marshalPatternFlowPfcPausePauseClass7MetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPausePauseClass7MetricTag + // validate validates PatternFlowPfcPausePauseClass7MetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPausePauseClass7MetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPfcPausePauseClass7MetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPfcPausePauseClass7MetricTag + SetName(value string) PatternFlowPfcPausePauseClass7MetricTag + // Offset returns uint32, set in PatternFlowPfcPausePauseClass7MetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPfcPausePauseClass7MetricTag + SetOffset(value uint32) PatternFlowPfcPausePauseClass7MetricTag + // HasOffset checks if Offset has been set in PatternFlowPfcPausePauseClass7MetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPfcPausePauseClass7MetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPfcPausePauseClass7MetricTag + SetLength(value uint32) PatternFlowPfcPausePauseClass7MetricTag + // HasLength checks if Length has been set in PatternFlowPfcPausePauseClass7MetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPfcPausePauseClass7MetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPfcPausePauseClass7MetricTag object +func (obj *patternFlowPfcPausePauseClass7MetricTag) SetName(value string) PatternFlowPfcPausePauseClass7MetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass7MetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPausePauseClass7MetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPfcPausePauseClass7MetricTag object +func (obj *patternFlowPfcPausePauseClass7MetricTag) SetOffset(value uint32) PatternFlowPfcPausePauseClass7MetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass7MetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPausePauseClass7MetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPfcPausePauseClass7MetricTag object +func (obj *patternFlowPfcPausePauseClass7MetricTag) SetLength(value uint32) PatternFlowPfcPausePauseClass7MetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPfcPausePauseClass7MetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPausePauseClass7MetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPausePauseClass7MetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPfcPausePauseClass7MetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPfcPausePauseClass7MetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_src.go b/gosnappi/pattern_flow_pfc_pause_src.go new file mode 100644 index 00000000..680da33a --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_src.go @@ -0,0 +1,658 @@ +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" +) + +// ***** PatternFlowPfcPauseSrc ***** +type patternFlowPfcPauseSrc struct { + validation + obj *otg.PatternFlowPfcPauseSrc + marshaller marshalPatternFlowPfcPauseSrc + unMarshaller unMarshalPatternFlowPfcPauseSrc + incrementHolder PatternFlowPfcPauseSrcCounter + decrementHolder PatternFlowPfcPauseSrcCounter + metricTagsHolder PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter +} + +func NewPatternFlowPfcPauseSrc() PatternFlowPfcPauseSrc { + obj := patternFlowPfcPauseSrc{obj: &otg.PatternFlowPfcPauseSrc{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseSrc) msg() *otg.PatternFlowPfcPauseSrc { + return obj.obj +} + +func (obj *patternFlowPfcPauseSrc) setMsg(msg *otg.PatternFlowPfcPauseSrc) PatternFlowPfcPauseSrc { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseSrc struct { + obj *patternFlowPfcPauseSrc +} + +type marshalPatternFlowPfcPauseSrc interface { + // ToProto marshals PatternFlowPfcPauseSrc to protobuf object *otg.PatternFlowPfcPauseSrc + ToProto() (*otg.PatternFlowPfcPauseSrc, error) + // ToPbText marshals PatternFlowPfcPauseSrc to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseSrc to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseSrc to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseSrc struct { + obj *patternFlowPfcPauseSrc +} + +type unMarshalPatternFlowPfcPauseSrc interface { + // FromProto unmarshals PatternFlowPfcPauseSrc from protobuf object *otg.PatternFlowPfcPauseSrc + FromProto(msg *otg.PatternFlowPfcPauseSrc) (PatternFlowPfcPauseSrc, error) + // FromPbText unmarshals PatternFlowPfcPauseSrc from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseSrc from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseSrc from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseSrc) Marshal() marshalPatternFlowPfcPauseSrc { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseSrc{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseSrc) Unmarshal() unMarshalPatternFlowPfcPauseSrc { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseSrc{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseSrc) ToProto() (*otg.PatternFlowPfcPauseSrc, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseSrc) FromProto(msg *otg.PatternFlowPfcPauseSrc) (PatternFlowPfcPauseSrc, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseSrc) 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 *unMarshalpatternFlowPfcPauseSrc) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPfcPauseSrc) 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 *unMarshalpatternFlowPfcPauseSrc) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPfcPauseSrc) 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 *unMarshalpatternFlowPfcPauseSrc) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPfcPauseSrc) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseSrc) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseSrc) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseSrc) Clone() (PatternFlowPfcPauseSrc, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseSrc() + 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 +} + +func (obj *patternFlowPfcPauseSrc) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPfcPauseSrc is source MAC address +type PatternFlowPfcPauseSrc interface { + Validation + // msg marshals PatternFlowPfcPauseSrc to protobuf object *otg.PatternFlowPfcPauseSrc + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseSrc + // setMsg unmarshals PatternFlowPfcPauseSrc from protobuf object *otg.PatternFlowPfcPauseSrc + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseSrc) PatternFlowPfcPauseSrc + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseSrc + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseSrc + // validate validates PatternFlowPfcPauseSrc + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseSrc, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPfcPauseSrcChoiceEnum, set in PatternFlowPfcPauseSrc + Choice() PatternFlowPfcPauseSrcChoiceEnum + // setChoice assigns PatternFlowPfcPauseSrcChoiceEnum provided by user to PatternFlowPfcPauseSrc + setChoice(value PatternFlowPfcPauseSrcChoiceEnum) PatternFlowPfcPauseSrc + // HasChoice checks if Choice has been set in PatternFlowPfcPauseSrc + HasChoice() bool + // Value returns string, set in PatternFlowPfcPauseSrc. + Value() string + // SetValue assigns string provided by user to PatternFlowPfcPauseSrc + SetValue(value string) PatternFlowPfcPauseSrc + // HasValue checks if Value has been set in PatternFlowPfcPauseSrc + HasValue() bool + // Values returns []string, set in PatternFlowPfcPauseSrc. + Values() []string + // SetValues assigns []string provided by user to PatternFlowPfcPauseSrc + SetValues(value []string) PatternFlowPfcPauseSrc + // Increment returns PatternFlowPfcPauseSrcCounter, set in PatternFlowPfcPauseSrc. + // PatternFlowPfcPauseSrcCounter is mac counter pattern + Increment() PatternFlowPfcPauseSrcCounter + // SetIncrement assigns PatternFlowPfcPauseSrcCounter provided by user to PatternFlowPfcPauseSrc. + // PatternFlowPfcPauseSrcCounter is mac counter pattern + SetIncrement(value PatternFlowPfcPauseSrcCounter) PatternFlowPfcPauseSrc + // HasIncrement checks if Increment has been set in PatternFlowPfcPauseSrc + HasIncrement() bool + // Decrement returns PatternFlowPfcPauseSrcCounter, set in PatternFlowPfcPauseSrc. + // PatternFlowPfcPauseSrcCounter is mac counter pattern + Decrement() PatternFlowPfcPauseSrcCounter + // SetDecrement assigns PatternFlowPfcPauseSrcCounter provided by user to PatternFlowPfcPauseSrc. + // PatternFlowPfcPauseSrcCounter is mac counter pattern + SetDecrement(value PatternFlowPfcPauseSrcCounter) PatternFlowPfcPauseSrc + // HasDecrement checks if Decrement has been set in PatternFlowPfcPauseSrc + HasDecrement() bool + // MetricTags returns PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIterIter, set in PatternFlowPfcPauseSrc + MetricTags() PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter + setNil() +} + +type PatternFlowPfcPauseSrcChoiceEnum string + +// Enum of Choice on PatternFlowPfcPauseSrc +var PatternFlowPfcPauseSrcChoice = struct { + VALUE PatternFlowPfcPauseSrcChoiceEnum + VALUES PatternFlowPfcPauseSrcChoiceEnum + INCREMENT PatternFlowPfcPauseSrcChoiceEnum + DECREMENT PatternFlowPfcPauseSrcChoiceEnum +}{ + VALUE: PatternFlowPfcPauseSrcChoiceEnum("value"), + VALUES: PatternFlowPfcPauseSrcChoiceEnum("values"), + INCREMENT: PatternFlowPfcPauseSrcChoiceEnum("increment"), + DECREMENT: PatternFlowPfcPauseSrcChoiceEnum("decrement"), +} + +func (obj *patternFlowPfcPauseSrc) Choice() PatternFlowPfcPauseSrcChoiceEnum { + return PatternFlowPfcPauseSrcChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPfcPauseSrc) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPfcPauseSrc) setChoice(value PatternFlowPfcPauseSrcChoiceEnum) PatternFlowPfcPauseSrc { + intValue, ok := otg.PatternFlowPfcPauseSrc_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPfcPauseSrcChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPfcPauseSrc_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPfcPauseSrcChoice.VALUE { + defaultValue := "00:00:00:00:00:00" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPfcPauseSrcChoice.VALUES { + defaultValue := []string{"00:00:00:00:00:00"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPfcPauseSrcChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowPfcPauseSrcCounter().msg() + } + + if value == PatternFlowPfcPauseSrcChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPfcPauseSrcCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowPfcPauseSrc) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPfcPauseSrcChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowPfcPauseSrc) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowPfcPauseSrc object +func (obj *patternFlowPfcPauseSrc) SetValue(value string) PatternFlowPfcPauseSrc { + obj.setChoice(PatternFlowPfcPauseSrcChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowPfcPauseSrc) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"00:00:00:00:00:00"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowPfcPauseSrc object +func (obj *patternFlowPfcPauseSrc) SetValues(value []string) PatternFlowPfcPauseSrc { + obj.setChoice(PatternFlowPfcPauseSrcChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPfcPauseSrcCounter +func (obj *patternFlowPfcPauseSrc) Increment() PatternFlowPfcPauseSrcCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPfcPauseSrcChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPfcPauseSrcCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPfcPauseSrcCounter +func (obj *patternFlowPfcPauseSrc) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPfcPauseSrcCounter value in the PatternFlowPfcPauseSrc object +func (obj *patternFlowPfcPauseSrc) SetIncrement(value PatternFlowPfcPauseSrcCounter) PatternFlowPfcPauseSrc { + obj.setChoice(PatternFlowPfcPauseSrcChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPfcPauseSrcCounter +func (obj *patternFlowPfcPauseSrc) Decrement() PatternFlowPfcPauseSrcCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPfcPauseSrcChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPfcPauseSrcCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPfcPauseSrcCounter +func (obj *patternFlowPfcPauseSrc) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPfcPauseSrcCounter value in the PatternFlowPfcPauseSrc object +func (obj *patternFlowPfcPauseSrc) SetDecrement(value PatternFlowPfcPauseSrcCounter) PatternFlowPfcPauseSrc { + obj.setChoice(PatternFlowPfcPauseSrcChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPfcPauseSrcMetricTag +func (obj *patternFlowPfcPauseSrc) MetricTags() PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPfcPauseSrcMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter struct { + obj *patternFlowPfcPauseSrc + patternFlowPfcPauseSrcMetricTagSlice []PatternFlowPfcPauseSrcMetricTag + fieldPtr *[]*otg.PatternFlowPfcPauseSrcMetricTag +} + +func newPatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter(ptr *[]*otg.PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { + return &patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter interface { + setMsg(*patternFlowPfcPauseSrc) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter + Items() []PatternFlowPfcPauseSrcMetricTag + Add() PatternFlowPfcPauseSrcMetricTag + Append(items ...PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter + Set(index int, newObj PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter + Clear() PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter + clearHolderSlice() PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter + appendHolderSlice(item PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter +} + +func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) setMsg(msg *patternFlowPfcPauseSrc) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPfcPauseSrcMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) Items() []PatternFlowPfcPauseSrcMetricTag { + return obj.patternFlowPfcPauseSrcMetricTagSlice +} + +func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) Add() PatternFlowPfcPauseSrcMetricTag { + newObj := &otg.PatternFlowPfcPauseSrcMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPfcPauseSrcMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPfcPauseSrcMetricTagSlice = append(obj.patternFlowPfcPauseSrcMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) Append(items ...PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPfcPauseSrcMetricTagSlice = append(obj.patternFlowPfcPauseSrcMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) Set(index int, newObj PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPfcPauseSrcMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) Clear() PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPfcPauseSrcMetricTag{} + obj.patternFlowPfcPauseSrcMetricTagSlice = []PatternFlowPfcPauseSrcMetricTag{} + } + return obj +} +func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) clearHolderSlice() PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { + if len(obj.patternFlowPfcPauseSrcMetricTagSlice) > 0 { + obj.patternFlowPfcPauseSrcMetricTagSlice = []PatternFlowPfcPauseSrcMetricTag{} + } + return obj +} +func (obj *patternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter) appendHolderSlice(item PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcPatternFlowPfcPauseSrcMetricTagIter { + obj.patternFlowPfcPauseSrcMetricTagSlice = append(obj.patternFlowPfcPauseSrcMetricTagSlice, item) + return obj +} + +func (obj *patternFlowPfcPauseSrc) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateMac(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseSrc.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateMacSlice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseSrc.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPfcPauseSrcMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPfcPauseSrc) setDefault() { + var choices_set int = 0 + var choice PatternFlowPfcPauseSrcChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPfcPauseSrcChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPfcPauseSrcChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPfcPauseSrcChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPfcPauseSrcChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPfcPauseSrcChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPfcPauseSrc") + } + } else { + intVal := otg.PatternFlowPfcPauseSrc_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPfcPauseSrc_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_src_counter.go b/gosnappi/pattern_flow_pfc_pause_src_counter.go new file mode 100644 index 00000000..2e8c9abf --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_src_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowPfcPauseSrcCounter ***** +type patternFlowPfcPauseSrcCounter struct { + validation + obj *otg.PatternFlowPfcPauseSrcCounter + marshaller marshalPatternFlowPfcPauseSrcCounter + unMarshaller unMarshalPatternFlowPfcPauseSrcCounter +} + +func NewPatternFlowPfcPauseSrcCounter() PatternFlowPfcPauseSrcCounter { + obj := patternFlowPfcPauseSrcCounter{obj: &otg.PatternFlowPfcPauseSrcCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseSrcCounter) msg() *otg.PatternFlowPfcPauseSrcCounter { + return obj.obj +} + +func (obj *patternFlowPfcPauseSrcCounter) setMsg(msg *otg.PatternFlowPfcPauseSrcCounter) PatternFlowPfcPauseSrcCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseSrcCounter struct { + obj *patternFlowPfcPauseSrcCounter +} + +type marshalPatternFlowPfcPauseSrcCounter interface { + // ToProto marshals PatternFlowPfcPauseSrcCounter to protobuf object *otg.PatternFlowPfcPauseSrcCounter + ToProto() (*otg.PatternFlowPfcPauseSrcCounter, error) + // ToPbText marshals PatternFlowPfcPauseSrcCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseSrcCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseSrcCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseSrcCounter struct { + obj *patternFlowPfcPauseSrcCounter +} + +type unMarshalPatternFlowPfcPauseSrcCounter interface { + // FromProto unmarshals PatternFlowPfcPauseSrcCounter from protobuf object *otg.PatternFlowPfcPauseSrcCounter + FromProto(msg *otg.PatternFlowPfcPauseSrcCounter) (PatternFlowPfcPauseSrcCounter, error) + // FromPbText unmarshals PatternFlowPfcPauseSrcCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseSrcCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseSrcCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseSrcCounter) Marshal() marshalPatternFlowPfcPauseSrcCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseSrcCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseSrcCounter) Unmarshal() unMarshalPatternFlowPfcPauseSrcCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseSrcCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseSrcCounter) ToProto() (*otg.PatternFlowPfcPauseSrcCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseSrcCounter) FromProto(msg *otg.PatternFlowPfcPauseSrcCounter) (PatternFlowPfcPauseSrcCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseSrcCounter) 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 *unMarshalpatternFlowPfcPauseSrcCounter) 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 *marshalpatternFlowPfcPauseSrcCounter) 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 *unMarshalpatternFlowPfcPauseSrcCounter) 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 *marshalpatternFlowPfcPauseSrcCounter) 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 *unMarshalpatternFlowPfcPauseSrcCounter) 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 *patternFlowPfcPauseSrcCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseSrcCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseSrcCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseSrcCounter) Clone() (PatternFlowPfcPauseSrcCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseSrcCounter() + 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 +} + +// PatternFlowPfcPauseSrcCounter is mac counter pattern +type PatternFlowPfcPauseSrcCounter interface { + Validation + // msg marshals PatternFlowPfcPauseSrcCounter to protobuf object *otg.PatternFlowPfcPauseSrcCounter + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseSrcCounter + // setMsg unmarshals PatternFlowPfcPauseSrcCounter from protobuf object *otg.PatternFlowPfcPauseSrcCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseSrcCounter) PatternFlowPfcPauseSrcCounter + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseSrcCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseSrcCounter + // validate validates PatternFlowPfcPauseSrcCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseSrcCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowPfcPauseSrcCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowPfcPauseSrcCounter + SetStart(value string) PatternFlowPfcPauseSrcCounter + // HasStart checks if Start has been set in PatternFlowPfcPauseSrcCounter + HasStart() bool + // Step returns string, set in PatternFlowPfcPauseSrcCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowPfcPauseSrcCounter + SetStep(value string) PatternFlowPfcPauseSrcCounter + // HasStep checks if Step has been set in PatternFlowPfcPauseSrcCounter + HasStep() bool + // Count returns uint32, set in PatternFlowPfcPauseSrcCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPfcPauseSrcCounter + SetCount(value uint32) PatternFlowPfcPauseSrcCounter + // HasCount checks if Count has been set in PatternFlowPfcPauseSrcCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowPfcPauseSrcCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowPfcPauseSrcCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowPfcPauseSrcCounter object +func (obj *patternFlowPfcPauseSrcCounter) SetStart(value string) PatternFlowPfcPauseSrcCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowPfcPauseSrcCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowPfcPauseSrcCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowPfcPauseSrcCounter object +func (obj *patternFlowPfcPauseSrcCounter) SetStep(value string) PatternFlowPfcPauseSrcCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPauseSrcCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPfcPauseSrcCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPfcPauseSrcCounter object +func (obj *patternFlowPfcPauseSrcCounter) SetCount(value uint32) PatternFlowPfcPauseSrcCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPfcPauseSrcCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateMac(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseSrcCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateMac(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowPfcPauseSrcCounter.Step")) + } + + } + +} + +func (obj *patternFlowPfcPauseSrcCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("00:00:00:00:00:00") + } + if obj.obj.Step == nil { + obj.SetStep("00:00:00:00:00:01") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_pfc_pause_src_metric_tag.go b/gosnappi/pattern_flow_pfc_pause_src_metric_tag.go new file mode 100644 index 00000000..afbda394 --- /dev/null +++ b/gosnappi/pattern_flow_pfc_pause_src_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPfcPauseSrcMetricTag ***** +type patternFlowPfcPauseSrcMetricTag struct { + validation + obj *otg.PatternFlowPfcPauseSrcMetricTag + marshaller marshalPatternFlowPfcPauseSrcMetricTag + unMarshaller unMarshalPatternFlowPfcPauseSrcMetricTag +} + +func NewPatternFlowPfcPauseSrcMetricTag() PatternFlowPfcPauseSrcMetricTag { + obj := patternFlowPfcPauseSrcMetricTag{obj: &otg.PatternFlowPfcPauseSrcMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPfcPauseSrcMetricTag) msg() *otg.PatternFlowPfcPauseSrcMetricTag { + return obj.obj +} + +func (obj *patternFlowPfcPauseSrcMetricTag) setMsg(msg *otg.PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPfcPauseSrcMetricTag struct { + obj *patternFlowPfcPauseSrcMetricTag +} + +type marshalPatternFlowPfcPauseSrcMetricTag interface { + // ToProto marshals PatternFlowPfcPauseSrcMetricTag to protobuf object *otg.PatternFlowPfcPauseSrcMetricTag + ToProto() (*otg.PatternFlowPfcPauseSrcMetricTag, error) + // ToPbText marshals PatternFlowPfcPauseSrcMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPfcPauseSrcMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPfcPauseSrcMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPfcPauseSrcMetricTag struct { + obj *patternFlowPfcPauseSrcMetricTag +} + +type unMarshalPatternFlowPfcPauseSrcMetricTag interface { + // FromProto unmarshals PatternFlowPfcPauseSrcMetricTag from protobuf object *otg.PatternFlowPfcPauseSrcMetricTag + FromProto(msg *otg.PatternFlowPfcPauseSrcMetricTag) (PatternFlowPfcPauseSrcMetricTag, error) + // FromPbText unmarshals PatternFlowPfcPauseSrcMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPfcPauseSrcMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPfcPauseSrcMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPfcPauseSrcMetricTag) Marshal() marshalPatternFlowPfcPauseSrcMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPfcPauseSrcMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPfcPauseSrcMetricTag) Unmarshal() unMarshalPatternFlowPfcPauseSrcMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPfcPauseSrcMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPfcPauseSrcMetricTag) ToProto() (*otg.PatternFlowPfcPauseSrcMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPfcPauseSrcMetricTag) FromProto(msg *otg.PatternFlowPfcPauseSrcMetricTag) (PatternFlowPfcPauseSrcMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPfcPauseSrcMetricTag) 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 *unMarshalpatternFlowPfcPauseSrcMetricTag) 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 *marshalpatternFlowPfcPauseSrcMetricTag) 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 *unMarshalpatternFlowPfcPauseSrcMetricTag) 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 *marshalpatternFlowPfcPauseSrcMetricTag) 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 *unMarshalpatternFlowPfcPauseSrcMetricTag) 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 *patternFlowPfcPauseSrcMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseSrcMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPfcPauseSrcMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPfcPauseSrcMetricTag) Clone() (PatternFlowPfcPauseSrcMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPfcPauseSrcMetricTag() + 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 +} + +// PatternFlowPfcPauseSrcMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPfcPauseSrcMetricTag interface { + Validation + // msg marshals PatternFlowPfcPauseSrcMetricTag to protobuf object *otg.PatternFlowPfcPauseSrcMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPfcPauseSrcMetricTag + // setMsg unmarshals PatternFlowPfcPauseSrcMetricTag from protobuf object *otg.PatternFlowPfcPauseSrcMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPfcPauseSrcMetricTag) PatternFlowPfcPauseSrcMetricTag + // provides marshal interface + Marshal() marshalPatternFlowPfcPauseSrcMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPfcPauseSrcMetricTag + // validate validates PatternFlowPfcPauseSrcMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPfcPauseSrcMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPfcPauseSrcMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPfcPauseSrcMetricTag + SetName(value string) PatternFlowPfcPauseSrcMetricTag + // Offset returns uint32, set in PatternFlowPfcPauseSrcMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPfcPauseSrcMetricTag + SetOffset(value uint32) PatternFlowPfcPauseSrcMetricTag + // HasOffset checks if Offset has been set in PatternFlowPfcPauseSrcMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPfcPauseSrcMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPfcPauseSrcMetricTag + SetLength(value uint32) PatternFlowPfcPauseSrcMetricTag + // HasLength checks if Length has been set in PatternFlowPfcPauseSrcMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPfcPauseSrcMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPfcPauseSrcMetricTag object +func (obj *patternFlowPfcPauseSrcMetricTag) SetName(value string) PatternFlowPfcPauseSrcMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPauseSrcMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPfcPauseSrcMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPfcPauseSrcMetricTag object +func (obj *patternFlowPfcPauseSrcMetricTag) SetOffset(value uint32) PatternFlowPfcPauseSrcMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPauseSrcMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPfcPauseSrcMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPfcPauseSrcMetricTag object +func (obj *patternFlowPfcPauseSrcMetricTag) SetLength(value uint32) PatternFlowPfcPauseSrcMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPfcPauseSrcMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPfcPauseSrcMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 47 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPfcPauseSrcMetricTag.Offset <= 47 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 48 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPfcPauseSrcMetricTag.Length <= 48 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPfcPauseSrcMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(48) + } + +} diff --git a/gosnappi/pattern_flow_ppp_address.go b/gosnappi/pattern_flow_ppp_address.go new file mode 100644 index 00000000..343d2329 --- /dev/null +++ b/gosnappi/pattern_flow_ppp_address.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowPppAddress ***** +type patternFlowPppAddress struct { + validation + obj *otg.PatternFlowPppAddress + marshaller marshalPatternFlowPppAddress + unMarshaller unMarshalPatternFlowPppAddress + incrementHolder PatternFlowPppAddressCounter + decrementHolder PatternFlowPppAddressCounter + metricTagsHolder PatternFlowPppAddressPatternFlowPppAddressMetricTagIter +} + +func NewPatternFlowPppAddress() PatternFlowPppAddress { + obj := patternFlowPppAddress{obj: &otg.PatternFlowPppAddress{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPppAddress) msg() *otg.PatternFlowPppAddress { + return obj.obj +} + +func (obj *patternFlowPppAddress) setMsg(msg *otg.PatternFlowPppAddress) PatternFlowPppAddress { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPppAddress struct { + obj *patternFlowPppAddress +} + +type marshalPatternFlowPppAddress interface { + // ToProto marshals PatternFlowPppAddress to protobuf object *otg.PatternFlowPppAddress + ToProto() (*otg.PatternFlowPppAddress, error) + // ToPbText marshals PatternFlowPppAddress to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPppAddress to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPppAddress to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPppAddress struct { + obj *patternFlowPppAddress +} + +type unMarshalPatternFlowPppAddress interface { + // FromProto unmarshals PatternFlowPppAddress from protobuf object *otg.PatternFlowPppAddress + FromProto(msg *otg.PatternFlowPppAddress) (PatternFlowPppAddress, error) + // FromPbText unmarshals PatternFlowPppAddress from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPppAddress from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPppAddress from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPppAddress) Marshal() marshalPatternFlowPppAddress { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPppAddress{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPppAddress) Unmarshal() unMarshalPatternFlowPppAddress { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPppAddress{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPppAddress) ToProto() (*otg.PatternFlowPppAddress, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPppAddress) FromProto(msg *otg.PatternFlowPppAddress) (PatternFlowPppAddress, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPppAddress) 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 *unMarshalpatternFlowPppAddress) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPppAddress) 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 *unMarshalpatternFlowPppAddress) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPppAddress) 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 *unMarshalpatternFlowPppAddress) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPppAddress) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPppAddress) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPppAddress) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPppAddress) Clone() (PatternFlowPppAddress, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPppAddress() + 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 +} + +func (obj *patternFlowPppAddress) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPppAddress is pPP address +type PatternFlowPppAddress interface { + Validation + // msg marshals PatternFlowPppAddress to protobuf object *otg.PatternFlowPppAddress + // and doesn't set defaults + msg() *otg.PatternFlowPppAddress + // setMsg unmarshals PatternFlowPppAddress from protobuf object *otg.PatternFlowPppAddress + // and doesn't set defaults + setMsg(*otg.PatternFlowPppAddress) PatternFlowPppAddress + // provides marshal interface + Marshal() marshalPatternFlowPppAddress + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPppAddress + // validate validates PatternFlowPppAddress + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPppAddress, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPppAddressChoiceEnum, set in PatternFlowPppAddress + Choice() PatternFlowPppAddressChoiceEnum + // setChoice assigns PatternFlowPppAddressChoiceEnum provided by user to PatternFlowPppAddress + setChoice(value PatternFlowPppAddressChoiceEnum) PatternFlowPppAddress + // HasChoice checks if Choice has been set in PatternFlowPppAddress + HasChoice() bool + // Value returns uint32, set in PatternFlowPppAddress. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowPppAddress + SetValue(value uint32) PatternFlowPppAddress + // HasValue checks if Value has been set in PatternFlowPppAddress + HasValue() bool + // Values returns []uint32, set in PatternFlowPppAddress. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowPppAddress + SetValues(value []uint32) PatternFlowPppAddress + // Increment returns PatternFlowPppAddressCounter, set in PatternFlowPppAddress. + // PatternFlowPppAddressCounter is integer counter pattern + Increment() PatternFlowPppAddressCounter + // SetIncrement assigns PatternFlowPppAddressCounter provided by user to PatternFlowPppAddress. + // PatternFlowPppAddressCounter is integer counter pattern + SetIncrement(value PatternFlowPppAddressCounter) PatternFlowPppAddress + // HasIncrement checks if Increment has been set in PatternFlowPppAddress + HasIncrement() bool + // Decrement returns PatternFlowPppAddressCounter, set in PatternFlowPppAddress. + // PatternFlowPppAddressCounter is integer counter pattern + Decrement() PatternFlowPppAddressCounter + // SetDecrement assigns PatternFlowPppAddressCounter provided by user to PatternFlowPppAddress. + // PatternFlowPppAddressCounter is integer counter pattern + SetDecrement(value PatternFlowPppAddressCounter) PatternFlowPppAddress + // HasDecrement checks if Decrement has been set in PatternFlowPppAddress + HasDecrement() bool + // MetricTags returns PatternFlowPppAddressPatternFlowPppAddressMetricTagIterIter, set in PatternFlowPppAddress + MetricTags() PatternFlowPppAddressPatternFlowPppAddressMetricTagIter + setNil() +} + +type PatternFlowPppAddressChoiceEnum string + +// Enum of Choice on PatternFlowPppAddress +var PatternFlowPppAddressChoice = struct { + VALUE PatternFlowPppAddressChoiceEnum + VALUES PatternFlowPppAddressChoiceEnum + INCREMENT PatternFlowPppAddressChoiceEnum + DECREMENT PatternFlowPppAddressChoiceEnum +}{ + VALUE: PatternFlowPppAddressChoiceEnum("value"), + VALUES: PatternFlowPppAddressChoiceEnum("values"), + INCREMENT: PatternFlowPppAddressChoiceEnum("increment"), + DECREMENT: PatternFlowPppAddressChoiceEnum("decrement"), +} + +func (obj *patternFlowPppAddress) Choice() PatternFlowPppAddressChoiceEnum { + return PatternFlowPppAddressChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPppAddress) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPppAddress) setChoice(value PatternFlowPppAddressChoiceEnum) PatternFlowPppAddress { + intValue, ok := otg.PatternFlowPppAddress_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPppAddressChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPppAddress_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPppAddressChoice.VALUE { + defaultValue := uint32(255) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPppAddressChoice.VALUES { + defaultValue := []uint32{255} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPppAddressChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowPppAddressCounter().msg() + } + + if value == PatternFlowPppAddressChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPppAddressCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPppAddress) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPppAddressChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPppAddress) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowPppAddress object +func (obj *patternFlowPppAddress) SetValue(value uint32) PatternFlowPppAddress { + obj.setChoice(PatternFlowPppAddressChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowPppAddress) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{255}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowPppAddress object +func (obj *patternFlowPppAddress) SetValues(value []uint32) PatternFlowPppAddress { + obj.setChoice(PatternFlowPppAddressChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPppAddressCounter +func (obj *patternFlowPppAddress) Increment() PatternFlowPppAddressCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPppAddressChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPppAddressCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPppAddressCounter +func (obj *patternFlowPppAddress) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPppAddressCounter value in the PatternFlowPppAddress object +func (obj *patternFlowPppAddress) SetIncrement(value PatternFlowPppAddressCounter) PatternFlowPppAddress { + obj.setChoice(PatternFlowPppAddressChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPppAddressCounter +func (obj *patternFlowPppAddress) Decrement() PatternFlowPppAddressCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPppAddressChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPppAddressCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPppAddressCounter +func (obj *patternFlowPppAddress) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPppAddressCounter value in the PatternFlowPppAddress object +func (obj *patternFlowPppAddress) SetDecrement(value PatternFlowPppAddressCounter) PatternFlowPppAddress { + obj.setChoice(PatternFlowPppAddressChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPppAddressMetricTag +func (obj *patternFlowPppAddress) MetricTags() PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPppAddressMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPppAddressPatternFlowPppAddressMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPppAddressPatternFlowPppAddressMetricTagIter struct { + obj *patternFlowPppAddress + patternFlowPppAddressMetricTagSlice []PatternFlowPppAddressMetricTag + fieldPtr *[]*otg.PatternFlowPppAddressMetricTag +} + +func newPatternFlowPppAddressPatternFlowPppAddressMetricTagIter(ptr *[]*otg.PatternFlowPppAddressMetricTag) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { + return &patternFlowPppAddressPatternFlowPppAddressMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPppAddressPatternFlowPppAddressMetricTagIter interface { + setMsg(*patternFlowPppAddress) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter + Items() []PatternFlowPppAddressMetricTag + Add() PatternFlowPppAddressMetricTag + Append(items ...PatternFlowPppAddressMetricTag) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter + Set(index int, newObj PatternFlowPppAddressMetricTag) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter + Clear() PatternFlowPppAddressPatternFlowPppAddressMetricTagIter + clearHolderSlice() PatternFlowPppAddressPatternFlowPppAddressMetricTagIter + appendHolderSlice(item PatternFlowPppAddressMetricTag) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter +} + +func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) setMsg(msg *patternFlowPppAddress) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPppAddressMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) Items() []PatternFlowPppAddressMetricTag { + return obj.patternFlowPppAddressMetricTagSlice +} + +func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) Add() PatternFlowPppAddressMetricTag { + newObj := &otg.PatternFlowPppAddressMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPppAddressMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPppAddressMetricTagSlice = append(obj.patternFlowPppAddressMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) Append(items ...PatternFlowPppAddressMetricTag) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPppAddressMetricTagSlice = append(obj.patternFlowPppAddressMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) Set(index int, newObj PatternFlowPppAddressMetricTag) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPppAddressMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) Clear() PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPppAddressMetricTag{} + obj.patternFlowPppAddressMetricTagSlice = []PatternFlowPppAddressMetricTag{} + } + return obj +} +func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) clearHolderSlice() PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { + if len(obj.patternFlowPppAddressMetricTagSlice) > 0 { + obj.patternFlowPppAddressMetricTagSlice = []PatternFlowPppAddressMetricTag{} + } + return obj +} +func (obj *patternFlowPppAddressPatternFlowPppAddressMetricTagIter) appendHolderSlice(item PatternFlowPppAddressMetricTag) PatternFlowPppAddressPatternFlowPppAddressMetricTagIter { + obj.patternFlowPppAddressMetricTagSlice = append(obj.patternFlowPppAddressMetricTagSlice, item) + return obj +} + +func (obj *patternFlowPppAddress) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppAddress.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowPppAddress.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPppAddressMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPppAddress) setDefault() { + var choices_set int = 0 + var choice PatternFlowPppAddressChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPppAddressChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPppAddressChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPppAddressChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPppAddressChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPppAddressChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPppAddress") + } + } else { + intVal := otg.PatternFlowPppAddress_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPppAddress_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ppp_address_counter.go b/gosnappi/pattern_flow_ppp_address_counter.go new file mode 100644 index 00000000..25e96f89 --- /dev/null +++ b/gosnappi/pattern_flow_ppp_address_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowPppAddressCounter ***** +type patternFlowPppAddressCounter struct { + validation + obj *otg.PatternFlowPppAddressCounter + marshaller marshalPatternFlowPppAddressCounter + unMarshaller unMarshalPatternFlowPppAddressCounter +} + +func NewPatternFlowPppAddressCounter() PatternFlowPppAddressCounter { + obj := patternFlowPppAddressCounter{obj: &otg.PatternFlowPppAddressCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPppAddressCounter) msg() *otg.PatternFlowPppAddressCounter { + return obj.obj +} + +func (obj *patternFlowPppAddressCounter) setMsg(msg *otg.PatternFlowPppAddressCounter) PatternFlowPppAddressCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPppAddressCounter struct { + obj *patternFlowPppAddressCounter +} + +type marshalPatternFlowPppAddressCounter interface { + // ToProto marshals PatternFlowPppAddressCounter to protobuf object *otg.PatternFlowPppAddressCounter + ToProto() (*otg.PatternFlowPppAddressCounter, error) + // ToPbText marshals PatternFlowPppAddressCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPppAddressCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPppAddressCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPppAddressCounter struct { + obj *patternFlowPppAddressCounter +} + +type unMarshalPatternFlowPppAddressCounter interface { + // FromProto unmarshals PatternFlowPppAddressCounter from protobuf object *otg.PatternFlowPppAddressCounter + FromProto(msg *otg.PatternFlowPppAddressCounter) (PatternFlowPppAddressCounter, error) + // FromPbText unmarshals PatternFlowPppAddressCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPppAddressCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPppAddressCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPppAddressCounter) Marshal() marshalPatternFlowPppAddressCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPppAddressCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPppAddressCounter) Unmarshal() unMarshalPatternFlowPppAddressCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPppAddressCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPppAddressCounter) ToProto() (*otg.PatternFlowPppAddressCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPppAddressCounter) FromProto(msg *otg.PatternFlowPppAddressCounter) (PatternFlowPppAddressCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPppAddressCounter) 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 *unMarshalpatternFlowPppAddressCounter) 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 *marshalpatternFlowPppAddressCounter) 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 *unMarshalpatternFlowPppAddressCounter) 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 *marshalpatternFlowPppAddressCounter) 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 *unMarshalpatternFlowPppAddressCounter) 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 *patternFlowPppAddressCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPppAddressCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPppAddressCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPppAddressCounter) Clone() (PatternFlowPppAddressCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPppAddressCounter() + 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 +} + +// PatternFlowPppAddressCounter is integer counter pattern +type PatternFlowPppAddressCounter interface { + Validation + // msg marshals PatternFlowPppAddressCounter to protobuf object *otg.PatternFlowPppAddressCounter + // and doesn't set defaults + msg() *otg.PatternFlowPppAddressCounter + // setMsg unmarshals PatternFlowPppAddressCounter from protobuf object *otg.PatternFlowPppAddressCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowPppAddressCounter) PatternFlowPppAddressCounter + // provides marshal interface + Marshal() marshalPatternFlowPppAddressCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPppAddressCounter + // validate validates PatternFlowPppAddressCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPppAddressCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowPppAddressCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowPppAddressCounter + SetStart(value uint32) PatternFlowPppAddressCounter + // HasStart checks if Start has been set in PatternFlowPppAddressCounter + HasStart() bool + // Step returns uint32, set in PatternFlowPppAddressCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowPppAddressCounter + SetStep(value uint32) PatternFlowPppAddressCounter + // HasStep checks if Step has been set in PatternFlowPppAddressCounter + HasStep() bool + // Count returns uint32, set in PatternFlowPppAddressCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPppAddressCounter + SetCount(value uint32) PatternFlowPppAddressCounter + // HasCount checks if Count has been set in PatternFlowPppAddressCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPppAddressCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPppAddressCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowPppAddressCounter object +func (obj *patternFlowPppAddressCounter) SetStart(value uint32) PatternFlowPppAddressCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPppAddressCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPppAddressCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowPppAddressCounter object +func (obj *patternFlowPppAddressCounter) SetStep(value uint32) PatternFlowPppAddressCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPppAddressCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPppAddressCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPppAddressCounter object +func (obj *patternFlowPppAddressCounter) SetCount(value uint32) PatternFlowPppAddressCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPppAddressCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppAddressCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppAddressCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppAddressCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowPppAddressCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(255) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ppp_address_metric_tag.go b/gosnappi/pattern_flow_ppp_address_metric_tag.go new file mode 100644 index 00000000..f58ee7af --- /dev/null +++ b/gosnappi/pattern_flow_ppp_address_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPppAddressMetricTag ***** +type patternFlowPppAddressMetricTag struct { + validation + obj *otg.PatternFlowPppAddressMetricTag + marshaller marshalPatternFlowPppAddressMetricTag + unMarshaller unMarshalPatternFlowPppAddressMetricTag +} + +func NewPatternFlowPppAddressMetricTag() PatternFlowPppAddressMetricTag { + obj := patternFlowPppAddressMetricTag{obj: &otg.PatternFlowPppAddressMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPppAddressMetricTag) msg() *otg.PatternFlowPppAddressMetricTag { + return obj.obj +} + +func (obj *patternFlowPppAddressMetricTag) setMsg(msg *otg.PatternFlowPppAddressMetricTag) PatternFlowPppAddressMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPppAddressMetricTag struct { + obj *patternFlowPppAddressMetricTag +} + +type marshalPatternFlowPppAddressMetricTag interface { + // ToProto marshals PatternFlowPppAddressMetricTag to protobuf object *otg.PatternFlowPppAddressMetricTag + ToProto() (*otg.PatternFlowPppAddressMetricTag, error) + // ToPbText marshals PatternFlowPppAddressMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPppAddressMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPppAddressMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPppAddressMetricTag struct { + obj *patternFlowPppAddressMetricTag +} + +type unMarshalPatternFlowPppAddressMetricTag interface { + // FromProto unmarshals PatternFlowPppAddressMetricTag from protobuf object *otg.PatternFlowPppAddressMetricTag + FromProto(msg *otg.PatternFlowPppAddressMetricTag) (PatternFlowPppAddressMetricTag, error) + // FromPbText unmarshals PatternFlowPppAddressMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPppAddressMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPppAddressMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPppAddressMetricTag) Marshal() marshalPatternFlowPppAddressMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPppAddressMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPppAddressMetricTag) Unmarshal() unMarshalPatternFlowPppAddressMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPppAddressMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPppAddressMetricTag) ToProto() (*otg.PatternFlowPppAddressMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPppAddressMetricTag) FromProto(msg *otg.PatternFlowPppAddressMetricTag) (PatternFlowPppAddressMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPppAddressMetricTag) 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 *unMarshalpatternFlowPppAddressMetricTag) 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 *marshalpatternFlowPppAddressMetricTag) 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 *unMarshalpatternFlowPppAddressMetricTag) 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 *marshalpatternFlowPppAddressMetricTag) 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 *unMarshalpatternFlowPppAddressMetricTag) 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 *patternFlowPppAddressMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPppAddressMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPppAddressMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPppAddressMetricTag) Clone() (PatternFlowPppAddressMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPppAddressMetricTag() + 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 +} + +// PatternFlowPppAddressMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPppAddressMetricTag interface { + Validation + // msg marshals PatternFlowPppAddressMetricTag to protobuf object *otg.PatternFlowPppAddressMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPppAddressMetricTag + // setMsg unmarshals PatternFlowPppAddressMetricTag from protobuf object *otg.PatternFlowPppAddressMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPppAddressMetricTag) PatternFlowPppAddressMetricTag + // provides marshal interface + Marshal() marshalPatternFlowPppAddressMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPppAddressMetricTag + // validate validates PatternFlowPppAddressMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPppAddressMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPppAddressMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPppAddressMetricTag + SetName(value string) PatternFlowPppAddressMetricTag + // Offset returns uint32, set in PatternFlowPppAddressMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPppAddressMetricTag + SetOffset(value uint32) PatternFlowPppAddressMetricTag + // HasOffset checks if Offset has been set in PatternFlowPppAddressMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPppAddressMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPppAddressMetricTag + SetLength(value uint32) PatternFlowPppAddressMetricTag + // HasLength checks if Length has been set in PatternFlowPppAddressMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPppAddressMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPppAddressMetricTag object +func (obj *patternFlowPppAddressMetricTag) SetName(value string) PatternFlowPppAddressMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPppAddressMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPppAddressMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPppAddressMetricTag object +func (obj *patternFlowPppAddressMetricTag) SetOffset(value uint32) PatternFlowPppAddressMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPppAddressMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPppAddressMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPppAddressMetricTag object +func (obj *patternFlowPppAddressMetricTag) SetLength(value uint32) PatternFlowPppAddressMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPppAddressMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPppAddressMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppAddressMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPppAddressMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPppAddressMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_ppp_control.go b/gosnappi/pattern_flow_ppp_control.go new file mode 100644 index 00000000..f65d3cb4 --- /dev/null +++ b/gosnappi/pattern_flow_ppp_control.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowPppControl ***** +type patternFlowPppControl struct { + validation + obj *otg.PatternFlowPppControl + marshaller marshalPatternFlowPppControl + unMarshaller unMarshalPatternFlowPppControl + incrementHolder PatternFlowPppControlCounter + decrementHolder PatternFlowPppControlCounter + metricTagsHolder PatternFlowPppControlPatternFlowPppControlMetricTagIter +} + +func NewPatternFlowPppControl() PatternFlowPppControl { + obj := patternFlowPppControl{obj: &otg.PatternFlowPppControl{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPppControl) msg() *otg.PatternFlowPppControl { + return obj.obj +} + +func (obj *patternFlowPppControl) setMsg(msg *otg.PatternFlowPppControl) PatternFlowPppControl { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPppControl struct { + obj *patternFlowPppControl +} + +type marshalPatternFlowPppControl interface { + // ToProto marshals PatternFlowPppControl to protobuf object *otg.PatternFlowPppControl + ToProto() (*otg.PatternFlowPppControl, error) + // ToPbText marshals PatternFlowPppControl to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPppControl to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPppControl to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPppControl struct { + obj *patternFlowPppControl +} + +type unMarshalPatternFlowPppControl interface { + // FromProto unmarshals PatternFlowPppControl from protobuf object *otg.PatternFlowPppControl + FromProto(msg *otg.PatternFlowPppControl) (PatternFlowPppControl, error) + // FromPbText unmarshals PatternFlowPppControl from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPppControl from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPppControl from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPppControl) Marshal() marshalPatternFlowPppControl { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPppControl{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPppControl) Unmarshal() unMarshalPatternFlowPppControl { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPppControl{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPppControl) ToProto() (*otg.PatternFlowPppControl, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPppControl) FromProto(msg *otg.PatternFlowPppControl) (PatternFlowPppControl, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPppControl) 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 *unMarshalpatternFlowPppControl) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPppControl) 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 *unMarshalpatternFlowPppControl) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPppControl) 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 *unMarshalpatternFlowPppControl) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPppControl) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPppControl) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPppControl) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPppControl) Clone() (PatternFlowPppControl, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPppControl() + 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 +} + +func (obj *patternFlowPppControl) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPppControl is pPP control +type PatternFlowPppControl interface { + Validation + // msg marshals PatternFlowPppControl to protobuf object *otg.PatternFlowPppControl + // and doesn't set defaults + msg() *otg.PatternFlowPppControl + // setMsg unmarshals PatternFlowPppControl from protobuf object *otg.PatternFlowPppControl + // and doesn't set defaults + setMsg(*otg.PatternFlowPppControl) PatternFlowPppControl + // provides marshal interface + Marshal() marshalPatternFlowPppControl + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPppControl + // validate validates PatternFlowPppControl + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPppControl, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPppControlChoiceEnum, set in PatternFlowPppControl + Choice() PatternFlowPppControlChoiceEnum + // setChoice assigns PatternFlowPppControlChoiceEnum provided by user to PatternFlowPppControl + setChoice(value PatternFlowPppControlChoiceEnum) PatternFlowPppControl + // HasChoice checks if Choice has been set in PatternFlowPppControl + HasChoice() bool + // Value returns uint32, set in PatternFlowPppControl. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowPppControl + SetValue(value uint32) PatternFlowPppControl + // HasValue checks if Value has been set in PatternFlowPppControl + HasValue() bool + // Values returns []uint32, set in PatternFlowPppControl. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowPppControl + SetValues(value []uint32) PatternFlowPppControl + // Increment returns PatternFlowPppControlCounter, set in PatternFlowPppControl. + // PatternFlowPppControlCounter is integer counter pattern + Increment() PatternFlowPppControlCounter + // SetIncrement assigns PatternFlowPppControlCounter provided by user to PatternFlowPppControl. + // PatternFlowPppControlCounter is integer counter pattern + SetIncrement(value PatternFlowPppControlCounter) PatternFlowPppControl + // HasIncrement checks if Increment has been set in PatternFlowPppControl + HasIncrement() bool + // Decrement returns PatternFlowPppControlCounter, set in PatternFlowPppControl. + // PatternFlowPppControlCounter is integer counter pattern + Decrement() PatternFlowPppControlCounter + // SetDecrement assigns PatternFlowPppControlCounter provided by user to PatternFlowPppControl. + // PatternFlowPppControlCounter is integer counter pattern + SetDecrement(value PatternFlowPppControlCounter) PatternFlowPppControl + // HasDecrement checks if Decrement has been set in PatternFlowPppControl + HasDecrement() bool + // MetricTags returns PatternFlowPppControlPatternFlowPppControlMetricTagIterIter, set in PatternFlowPppControl + MetricTags() PatternFlowPppControlPatternFlowPppControlMetricTagIter + setNil() +} + +type PatternFlowPppControlChoiceEnum string + +// Enum of Choice on PatternFlowPppControl +var PatternFlowPppControlChoice = struct { + VALUE PatternFlowPppControlChoiceEnum + VALUES PatternFlowPppControlChoiceEnum + INCREMENT PatternFlowPppControlChoiceEnum + DECREMENT PatternFlowPppControlChoiceEnum +}{ + VALUE: PatternFlowPppControlChoiceEnum("value"), + VALUES: PatternFlowPppControlChoiceEnum("values"), + INCREMENT: PatternFlowPppControlChoiceEnum("increment"), + DECREMENT: PatternFlowPppControlChoiceEnum("decrement"), +} + +func (obj *patternFlowPppControl) Choice() PatternFlowPppControlChoiceEnum { + return PatternFlowPppControlChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPppControl) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPppControl) setChoice(value PatternFlowPppControlChoiceEnum) PatternFlowPppControl { + intValue, ok := otg.PatternFlowPppControl_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPppControlChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPppControl_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPppControlChoice.VALUE { + defaultValue := uint32(3) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPppControlChoice.VALUES { + defaultValue := []uint32{3} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPppControlChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowPppControlCounter().msg() + } + + if value == PatternFlowPppControlChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPppControlCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPppControl) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPppControlChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPppControl) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowPppControl object +func (obj *patternFlowPppControl) SetValue(value uint32) PatternFlowPppControl { + obj.setChoice(PatternFlowPppControlChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowPppControl) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{3}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowPppControl object +func (obj *patternFlowPppControl) SetValues(value []uint32) PatternFlowPppControl { + obj.setChoice(PatternFlowPppControlChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowPppControlCounter +func (obj *patternFlowPppControl) Increment() PatternFlowPppControlCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPppControlChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPppControlCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPppControlCounter +func (obj *patternFlowPppControl) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPppControlCounter value in the PatternFlowPppControl object +func (obj *patternFlowPppControl) SetIncrement(value PatternFlowPppControlCounter) PatternFlowPppControl { + obj.setChoice(PatternFlowPppControlChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPppControlCounter +func (obj *patternFlowPppControl) Decrement() PatternFlowPppControlCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPppControlChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPppControlCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPppControlCounter +func (obj *patternFlowPppControl) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPppControlCounter value in the PatternFlowPppControl object +func (obj *patternFlowPppControl) SetDecrement(value PatternFlowPppControlCounter) PatternFlowPppControl { + obj.setChoice(PatternFlowPppControlChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPppControlMetricTag +func (obj *patternFlowPppControl) MetricTags() PatternFlowPppControlPatternFlowPppControlMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPppControlMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPppControlPatternFlowPppControlMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPppControlPatternFlowPppControlMetricTagIter struct { + obj *patternFlowPppControl + patternFlowPppControlMetricTagSlice []PatternFlowPppControlMetricTag + fieldPtr *[]*otg.PatternFlowPppControlMetricTag +} + +func newPatternFlowPppControlPatternFlowPppControlMetricTagIter(ptr *[]*otg.PatternFlowPppControlMetricTag) PatternFlowPppControlPatternFlowPppControlMetricTagIter { + return &patternFlowPppControlPatternFlowPppControlMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPppControlPatternFlowPppControlMetricTagIter interface { + setMsg(*patternFlowPppControl) PatternFlowPppControlPatternFlowPppControlMetricTagIter + Items() []PatternFlowPppControlMetricTag + Add() PatternFlowPppControlMetricTag + Append(items ...PatternFlowPppControlMetricTag) PatternFlowPppControlPatternFlowPppControlMetricTagIter + Set(index int, newObj PatternFlowPppControlMetricTag) PatternFlowPppControlPatternFlowPppControlMetricTagIter + Clear() PatternFlowPppControlPatternFlowPppControlMetricTagIter + clearHolderSlice() PatternFlowPppControlPatternFlowPppControlMetricTagIter + appendHolderSlice(item PatternFlowPppControlMetricTag) PatternFlowPppControlPatternFlowPppControlMetricTagIter +} + +func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) setMsg(msg *patternFlowPppControl) PatternFlowPppControlPatternFlowPppControlMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPppControlMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) Items() []PatternFlowPppControlMetricTag { + return obj.patternFlowPppControlMetricTagSlice +} + +func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) Add() PatternFlowPppControlMetricTag { + newObj := &otg.PatternFlowPppControlMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPppControlMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPppControlMetricTagSlice = append(obj.patternFlowPppControlMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) Append(items ...PatternFlowPppControlMetricTag) PatternFlowPppControlPatternFlowPppControlMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPppControlMetricTagSlice = append(obj.patternFlowPppControlMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) Set(index int, newObj PatternFlowPppControlMetricTag) PatternFlowPppControlPatternFlowPppControlMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPppControlMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) Clear() PatternFlowPppControlPatternFlowPppControlMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPppControlMetricTag{} + obj.patternFlowPppControlMetricTagSlice = []PatternFlowPppControlMetricTag{} + } + return obj +} +func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) clearHolderSlice() PatternFlowPppControlPatternFlowPppControlMetricTagIter { + if len(obj.patternFlowPppControlMetricTagSlice) > 0 { + obj.patternFlowPppControlMetricTagSlice = []PatternFlowPppControlMetricTag{} + } + return obj +} +func (obj *patternFlowPppControlPatternFlowPppControlMetricTagIter) appendHolderSlice(item PatternFlowPppControlMetricTag) PatternFlowPppControlPatternFlowPppControlMetricTagIter { + obj.patternFlowPppControlMetricTagSlice = append(obj.patternFlowPppControlMetricTagSlice, item) + return obj +} + +func (obj *patternFlowPppControl) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppControl.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowPppControl.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPppControlMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPppControl) setDefault() { + var choices_set int = 0 + var choice PatternFlowPppControlChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPppControlChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPppControlChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPppControlChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPppControlChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPppControlChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPppControl") + } + } else { + intVal := otg.PatternFlowPppControl_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPppControl_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ppp_control_counter.go b/gosnappi/pattern_flow_ppp_control_counter.go new file mode 100644 index 00000000..60ef8bbb --- /dev/null +++ b/gosnappi/pattern_flow_ppp_control_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowPppControlCounter ***** +type patternFlowPppControlCounter struct { + validation + obj *otg.PatternFlowPppControlCounter + marshaller marshalPatternFlowPppControlCounter + unMarshaller unMarshalPatternFlowPppControlCounter +} + +func NewPatternFlowPppControlCounter() PatternFlowPppControlCounter { + obj := patternFlowPppControlCounter{obj: &otg.PatternFlowPppControlCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPppControlCounter) msg() *otg.PatternFlowPppControlCounter { + return obj.obj +} + +func (obj *patternFlowPppControlCounter) setMsg(msg *otg.PatternFlowPppControlCounter) PatternFlowPppControlCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPppControlCounter struct { + obj *patternFlowPppControlCounter +} + +type marshalPatternFlowPppControlCounter interface { + // ToProto marshals PatternFlowPppControlCounter to protobuf object *otg.PatternFlowPppControlCounter + ToProto() (*otg.PatternFlowPppControlCounter, error) + // ToPbText marshals PatternFlowPppControlCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPppControlCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPppControlCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPppControlCounter struct { + obj *patternFlowPppControlCounter +} + +type unMarshalPatternFlowPppControlCounter interface { + // FromProto unmarshals PatternFlowPppControlCounter from protobuf object *otg.PatternFlowPppControlCounter + FromProto(msg *otg.PatternFlowPppControlCounter) (PatternFlowPppControlCounter, error) + // FromPbText unmarshals PatternFlowPppControlCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPppControlCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPppControlCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPppControlCounter) Marshal() marshalPatternFlowPppControlCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPppControlCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPppControlCounter) Unmarshal() unMarshalPatternFlowPppControlCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPppControlCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPppControlCounter) ToProto() (*otg.PatternFlowPppControlCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPppControlCounter) FromProto(msg *otg.PatternFlowPppControlCounter) (PatternFlowPppControlCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPppControlCounter) 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 *unMarshalpatternFlowPppControlCounter) 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 *marshalpatternFlowPppControlCounter) 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 *unMarshalpatternFlowPppControlCounter) 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 *marshalpatternFlowPppControlCounter) 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 *unMarshalpatternFlowPppControlCounter) 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 *patternFlowPppControlCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPppControlCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPppControlCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPppControlCounter) Clone() (PatternFlowPppControlCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPppControlCounter() + 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 +} + +// PatternFlowPppControlCounter is integer counter pattern +type PatternFlowPppControlCounter interface { + Validation + // msg marshals PatternFlowPppControlCounter to protobuf object *otg.PatternFlowPppControlCounter + // and doesn't set defaults + msg() *otg.PatternFlowPppControlCounter + // setMsg unmarshals PatternFlowPppControlCounter from protobuf object *otg.PatternFlowPppControlCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowPppControlCounter) PatternFlowPppControlCounter + // provides marshal interface + Marshal() marshalPatternFlowPppControlCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPppControlCounter + // validate validates PatternFlowPppControlCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPppControlCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowPppControlCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowPppControlCounter + SetStart(value uint32) PatternFlowPppControlCounter + // HasStart checks if Start has been set in PatternFlowPppControlCounter + HasStart() bool + // Step returns uint32, set in PatternFlowPppControlCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowPppControlCounter + SetStep(value uint32) PatternFlowPppControlCounter + // HasStep checks if Step has been set in PatternFlowPppControlCounter + HasStep() bool + // Count returns uint32, set in PatternFlowPppControlCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPppControlCounter + SetCount(value uint32) PatternFlowPppControlCounter + // HasCount checks if Count has been set in PatternFlowPppControlCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPppControlCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPppControlCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowPppControlCounter object +func (obj *patternFlowPppControlCounter) SetStart(value uint32) PatternFlowPppControlCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPppControlCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPppControlCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowPppControlCounter object +func (obj *patternFlowPppControlCounter) SetStep(value uint32) PatternFlowPppControlCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPppControlCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPppControlCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPppControlCounter object +func (obj *patternFlowPppControlCounter) SetCount(value uint32) PatternFlowPppControlCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPppControlCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppControlCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppControlCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppControlCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowPppControlCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(3) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ppp_control_metric_tag.go b/gosnappi/pattern_flow_ppp_control_metric_tag.go new file mode 100644 index 00000000..a928cb33 --- /dev/null +++ b/gosnappi/pattern_flow_ppp_control_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPppControlMetricTag ***** +type patternFlowPppControlMetricTag struct { + validation + obj *otg.PatternFlowPppControlMetricTag + marshaller marshalPatternFlowPppControlMetricTag + unMarshaller unMarshalPatternFlowPppControlMetricTag +} + +func NewPatternFlowPppControlMetricTag() PatternFlowPppControlMetricTag { + obj := patternFlowPppControlMetricTag{obj: &otg.PatternFlowPppControlMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPppControlMetricTag) msg() *otg.PatternFlowPppControlMetricTag { + return obj.obj +} + +func (obj *patternFlowPppControlMetricTag) setMsg(msg *otg.PatternFlowPppControlMetricTag) PatternFlowPppControlMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPppControlMetricTag struct { + obj *patternFlowPppControlMetricTag +} + +type marshalPatternFlowPppControlMetricTag interface { + // ToProto marshals PatternFlowPppControlMetricTag to protobuf object *otg.PatternFlowPppControlMetricTag + ToProto() (*otg.PatternFlowPppControlMetricTag, error) + // ToPbText marshals PatternFlowPppControlMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPppControlMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPppControlMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPppControlMetricTag struct { + obj *patternFlowPppControlMetricTag +} + +type unMarshalPatternFlowPppControlMetricTag interface { + // FromProto unmarshals PatternFlowPppControlMetricTag from protobuf object *otg.PatternFlowPppControlMetricTag + FromProto(msg *otg.PatternFlowPppControlMetricTag) (PatternFlowPppControlMetricTag, error) + // FromPbText unmarshals PatternFlowPppControlMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPppControlMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPppControlMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPppControlMetricTag) Marshal() marshalPatternFlowPppControlMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPppControlMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPppControlMetricTag) Unmarshal() unMarshalPatternFlowPppControlMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPppControlMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPppControlMetricTag) ToProto() (*otg.PatternFlowPppControlMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPppControlMetricTag) FromProto(msg *otg.PatternFlowPppControlMetricTag) (PatternFlowPppControlMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPppControlMetricTag) 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 *unMarshalpatternFlowPppControlMetricTag) 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 *marshalpatternFlowPppControlMetricTag) 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 *unMarshalpatternFlowPppControlMetricTag) 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 *marshalpatternFlowPppControlMetricTag) 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 *unMarshalpatternFlowPppControlMetricTag) 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 *patternFlowPppControlMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPppControlMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPppControlMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPppControlMetricTag) Clone() (PatternFlowPppControlMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPppControlMetricTag() + 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 +} + +// PatternFlowPppControlMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPppControlMetricTag interface { + Validation + // msg marshals PatternFlowPppControlMetricTag to protobuf object *otg.PatternFlowPppControlMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPppControlMetricTag + // setMsg unmarshals PatternFlowPppControlMetricTag from protobuf object *otg.PatternFlowPppControlMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPppControlMetricTag) PatternFlowPppControlMetricTag + // provides marshal interface + Marshal() marshalPatternFlowPppControlMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPppControlMetricTag + // validate validates PatternFlowPppControlMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPppControlMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPppControlMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPppControlMetricTag + SetName(value string) PatternFlowPppControlMetricTag + // Offset returns uint32, set in PatternFlowPppControlMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPppControlMetricTag + SetOffset(value uint32) PatternFlowPppControlMetricTag + // HasOffset checks if Offset has been set in PatternFlowPppControlMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPppControlMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPppControlMetricTag + SetLength(value uint32) PatternFlowPppControlMetricTag + // HasLength checks if Length has been set in PatternFlowPppControlMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPppControlMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPppControlMetricTag object +func (obj *patternFlowPppControlMetricTag) SetName(value string) PatternFlowPppControlMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPppControlMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPppControlMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPppControlMetricTag object +func (obj *patternFlowPppControlMetricTag) SetOffset(value uint32) PatternFlowPppControlMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPppControlMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPppControlMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPppControlMetricTag object +func (obj *patternFlowPppControlMetricTag) SetLength(value uint32) PatternFlowPppControlMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPppControlMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPppControlMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppControlMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPppControlMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPppControlMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_ppp_protocol_type.go b/gosnappi/pattern_flow_ppp_protocol_type.go new file mode 100644 index 00000000..b407fdac --- /dev/null +++ b/gosnappi/pattern_flow_ppp_protocol_type.go @@ -0,0 +1,712 @@ +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" +) + +// ***** PatternFlowPppProtocolType ***** +type patternFlowPppProtocolType struct { + validation + obj *otg.PatternFlowPppProtocolType + marshaller marshalPatternFlowPppProtocolType + unMarshaller unMarshalPatternFlowPppProtocolType + incrementHolder PatternFlowPppProtocolTypeCounter + decrementHolder PatternFlowPppProtocolTypeCounter + metricTagsHolder PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter +} + +func NewPatternFlowPppProtocolType() PatternFlowPppProtocolType { + obj := patternFlowPppProtocolType{obj: &otg.PatternFlowPppProtocolType{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPppProtocolType) msg() *otg.PatternFlowPppProtocolType { + return obj.obj +} + +func (obj *patternFlowPppProtocolType) setMsg(msg *otg.PatternFlowPppProtocolType) PatternFlowPppProtocolType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPppProtocolType struct { + obj *patternFlowPppProtocolType +} + +type marshalPatternFlowPppProtocolType interface { + // ToProto marshals PatternFlowPppProtocolType to protobuf object *otg.PatternFlowPppProtocolType + ToProto() (*otg.PatternFlowPppProtocolType, error) + // ToPbText marshals PatternFlowPppProtocolType to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPppProtocolType to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPppProtocolType to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPppProtocolType struct { + obj *patternFlowPppProtocolType +} + +type unMarshalPatternFlowPppProtocolType interface { + // FromProto unmarshals PatternFlowPppProtocolType from protobuf object *otg.PatternFlowPppProtocolType + FromProto(msg *otg.PatternFlowPppProtocolType) (PatternFlowPppProtocolType, error) + // FromPbText unmarshals PatternFlowPppProtocolType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPppProtocolType from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPppProtocolType from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPppProtocolType) Marshal() marshalPatternFlowPppProtocolType { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPppProtocolType{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPppProtocolType) Unmarshal() unMarshalPatternFlowPppProtocolType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPppProtocolType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPppProtocolType) ToProto() (*otg.PatternFlowPppProtocolType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPppProtocolType) FromProto(msg *otg.PatternFlowPppProtocolType) (PatternFlowPppProtocolType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPppProtocolType) 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 *unMarshalpatternFlowPppProtocolType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowPppProtocolType) 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 *unMarshalpatternFlowPppProtocolType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowPppProtocolType) 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 *unMarshalpatternFlowPppProtocolType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowPppProtocolType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPppProtocolType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPppProtocolType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPppProtocolType) Clone() (PatternFlowPppProtocolType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPppProtocolType() + 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 +} + +func (obj *patternFlowPppProtocolType) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowPppProtocolType is pPP protocol type +type PatternFlowPppProtocolType interface { + Validation + // msg marshals PatternFlowPppProtocolType to protobuf object *otg.PatternFlowPppProtocolType + // and doesn't set defaults + msg() *otg.PatternFlowPppProtocolType + // setMsg unmarshals PatternFlowPppProtocolType from protobuf object *otg.PatternFlowPppProtocolType + // and doesn't set defaults + setMsg(*otg.PatternFlowPppProtocolType) PatternFlowPppProtocolType + // provides marshal interface + Marshal() marshalPatternFlowPppProtocolType + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPppProtocolType + // validate validates PatternFlowPppProtocolType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPppProtocolType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowPppProtocolTypeChoiceEnum, set in PatternFlowPppProtocolType + Choice() PatternFlowPppProtocolTypeChoiceEnum + // setChoice assigns PatternFlowPppProtocolTypeChoiceEnum provided by user to PatternFlowPppProtocolType + setChoice(value PatternFlowPppProtocolTypeChoiceEnum) PatternFlowPppProtocolType + // HasChoice checks if Choice has been set in PatternFlowPppProtocolType + HasChoice() bool + // Value returns uint32, set in PatternFlowPppProtocolType. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowPppProtocolType + SetValue(value uint32) PatternFlowPppProtocolType + // HasValue checks if Value has been set in PatternFlowPppProtocolType + HasValue() bool + // Values returns []uint32, set in PatternFlowPppProtocolType. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowPppProtocolType + SetValues(value []uint32) PatternFlowPppProtocolType + // Auto returns uint32, set in PatternFlowPppProtocolType. + Auto() uint32 + // HasAuto checks if Auto has been set in PatternFlowPppProtocolType + HasAuto() bool + // Increment returns PatternFlowPppProtocolTypeCounter, set in PatternFlowPppProtocolType. + // PatternFlowPppProtocolTypeCounter is integer counter pattern + Increment() PatternFlowPppProtocolTypeCounter + // SetIncrement assigns PatternFlowPppProtocolTypeCounter provided by user to PatternFlowPppProtocolType. + // PatternFlowPppProtocolTypeCounter is integer counter pattern + SetIncrement(value PatternFlowPppProtocolTypeCounter) PatternFlowPppProtocolType + // HasIncrement checks if Increment has been set in PatternFlowPppProtocolType + HasIncrement() bool + // Decrement returns PatternFlowPppProtocolTypeCounter, set in PatternFlowPppProtocolType. + // PatternFlowPppProtocolTypeCounter is integer counter pattern + Decrement() PatternFlowPppProtocolTypeCounter + // SetDecrement assigns PatternFlowPppProtocolTypeCounter provided by user to PatternFlowPppProtocolType. + // PatternFlowPppProtocolTypeCounter is integer counter pattern + SetDecrement(value PatternFlowPppProtocolTypeCounter) PatternFlowPppProtocolType + // HasDecrement checks if Decrement has been set in PatternFlowPppProtocolType + HasDecrement() bool + // MetricTags returns PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIterIter, set in PatternFlowPppProtocolType + MetricTags() PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter + setNil() +} + +type PatternFlowPppProtocolTypeChoiceEnum string + +// Enum of Choice on PatternFlowPppProtocolType +var PatternFlowPppProtocolTypeChoice = struct { + VALUE PatternFlowPppProtocolTypeChoiceEnum + VALUES PatternFlowPppProtocolTypeChoiceEnum + AUTO PatternFlowPppProtocolTypeChoiceEnum + INCREMENT PatternFlowPppProtocolTypeChoiceEnum + DECREMENT PatternFlowPppProtocolTypeChoiceEnum +}{ + VALUE: PatternFlowPppProtocolTypeChoiceEnum("value"), + VALUES: PatternFlowPppProtocolTypeChoiceEnum("values"), + AUTO: PatternFlowPppProtocolTypeChoiceEnum("auto"), + INCREMENT: PatternFlowPppProtocolTypeChoiceEnum("increment"), + DECREMENT: PatternFlowPppProtocolTypeChoiceEnum("decrement"), +} + +func (obj *patternFlowPppProtocolType) Choice() PatternFlowPppProtocolTypeChoiceEnum { + return PatternFlowPppProtocolTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowPppProtocolType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowPppProtocolType) setChoice(value PatternFlowPppProtocolTypeChoiceEnum) PatternFlowPppProtocolType { + intValue, ok := otg.PatternFlowPppProtocolType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowPppProtocolTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowPppProtocolType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Auto = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowPppProtocolTypeChoice.VALUE { + defaultValue := uint32(33) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowPppProtocolTypeChoice.VALUES { + defaultValue := []uint32{33} + obj.obj.Values = defaultValue + } + + if value == PatternFlowPppProtocolTypeChoice.AUTO { + defaultValue := uint32(33) + obj.obj.Auto = &defaultValue + } + + if value == PatternFlowPppProtocolTypeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowPppProtocolTypeCounter().msg() + } + + if value == PatternFlowPppProtocolTypeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowPppProtocolTypeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPppProtocolType) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowPppProtocolTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowPppProtocolType) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowPppProtocolType object +func (obj *patternFlowPppProtocolType) SetValue(value uint32) PatternFlowPppProtocolType { + obj.setChoice(PatternFlowPppProtocolTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowPppProtocolType) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{33}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowPppProtocolType object +func (obj *patternFlowPppProtocolType) SetValues(value []uint32) PatternFlowPppProtocolType { + obj.setChoice(PatternFlowPppProtocolTypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowPppProtocolType) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(PatternFlowPppProtocolTypeChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowPppProtocolType) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Increment returns a PatternFlowPppProtocolTypeCounter +func (obj *patternFlowPppProtocolType) Increment() PatternFlowPppProtocolTypeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowPppProtocolTypeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowPppProtocolTypeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowPppProtocolTypeCounter +func (obj *patternFlowPppProtocolType) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowPppProtocolTypeCounter value in the PatternFlowPppProtocolType object +func (obj *patternFlowPppProtocolType) SetIncrement(value PatternFlowPppProtocolTypeCounter) PatternFlowPppProtocolType { + obj.setChoice(PatternFlowPppProtocolTypeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowPppProtocolTypeCounter +func (obj *patternFlowPppProtocolType) Decrement() PatternFlowPppProtocolTypeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowPppProtocolTypeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowPppProtocolTypeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowPppProtocolTypeCounter +func (obj *patternFlowPppProtocolType) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowPppProtocolTypeCounter value in the PatternFlowPppProtocolType object +func (obj *patternFlowPppProtocolType) SetDecrement(value PatternFlowPppProtocolTypeCounter) PatternFlowPppProtocolType { + obj.setChoice(PatternFlowPppProtocolTypeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowPppProtocolTypeMetricTag +func (obj *patternFlowPppProtocolType) MetricTags() PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowPppProtocolTypeMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter struct { + obj *patternFlowPppProtocolType + patternFlowPppProtocolTypeMetricTagSlice []PatternFlowPppProtocolTypeMetricTag + fieldPtr *[]*otg.PatternFlowPppProtocolTypeMetricTag +} + +func newPatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter(ptr *[]*otg.PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { + return &patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter interface { + setMsg(*patternFlowPppProtocolType) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter + Items() []PatternFlowPppProtocolTypeMetricTag + Add() PatternFlowPppProtocolTypeMetricTag + Append(items ...PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter + Set(index int, newObj PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter + Clear() PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter + clearHolderSlice() PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter + appendHolderSlice(item PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter +} + +func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) setMsg(msg *patternFlowPppProtocolType) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowPppProtocolTypeMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) Items() []PatternFlowPppProtocolTypeMetricTag { + return obj.patternFlowPppProtocolTypeMetricTagSlice +} + +func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) Add() PatternFlowPppProtocolTypeMetricTag { + newObj := &otg.PatternFlowPppProtocolTypeMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowPppProtocolTypeMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowPppProtocolTypeMetricTagSlice = append(obj.patternFlowPppProtocolTypeMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) Append(items ...PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowPppProtocolTypeMetricTagSlice = append(obj.patternFlowPppProtocolTypeMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) Set(index int, newObj PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowPppProtocolTypeMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) Clear() PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowPppProtocolTypeMetricTag{} + obj.patternFlowPppProtocolTypeMetricTagSlice = []PatternFlowPppProtocolTypeMetricTag{} + } + return obj +} +func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) clearHolderSlice() PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { + if len(obj.patternFlowPppProtocolTypeMetricTagSlice) > 0 { + obj.patternFlowPppProtocolTypeMetricTagSlice = []PatternFlowPppProtocolTypeMetricTag{} + } + return obj +} +func (obj *patternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter) appendHolderSlice(item PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypePatternFlowPppProtocolTypeMetricTagIter { + obj.patternFlowPppProtocolTypeMetricTagSlice = append(obj.patternFlowPppProtocolTypeMetricTagSlice, item) + return obj +} + +func (obj *patternFlowPppProtocolType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppProtocolType.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowPppProtocolType.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Auto != nil { + + if *obj.obj.Auto > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppProtocolType.Auto <= 65535 but Got %d", *obj.obj.Auto)) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowPppProtocolTypeMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowPppProtocolType) setDefault() { + var choices_set int = 0 + var choice PatternFlowPppProtocolTypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowPppProtocolTypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowPppProtocolTypeChoice.VALUES + } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowPppProtocolTypeChoice.AUTO + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowPppProtocolTypeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowPppProtocolTypeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowPppProtocolTypeChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowPppProtocolType") + } + } else { + intVal := otg.PatternFlowPppProtocolType_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowPppProtocolType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_ppp_protocol_type_counter.go b/gosnappi/pattern_flow_ppp_protocol_type_counter.go new file mode 100644 index 00000000..d9733dc1 --- /dev/null +++ b/gosnappi/pattern_flow_ppp_protocol_type_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowPppProtocolTypeCounter ***** +type patternFlowPppProtocolTypeCounter struct { + validation + obj *otg.PatternFlowPppProtocolTypeCounter + marshaller marshalPatternFlowPppProtocolTypeCounter + unMarshaller unMarshalPatternFlowPppProtocolTypeCounter +} + +func NewPatternFlowPppProtocolTypeCounter() PatternFlowPppProtocolTypeCounter { + obj := patternFlowPppProtocolTypeCounter{obj: &otg.PatternFlowPppProtocolTypeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPppProtocolTypeCounter) msg() *otg.PatternFlowPppProtocolTypeCounter { + return obj.obj +} + +func (obj *patternFlowPppProtocolTypeCounter) setMsg(msg *otg.PatternFlowPppProtocolTypeCounter) PatternFlowPppProtocolTypeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPppProtocolTypeCounter struct { + obj *patternFlowPppProtocolTypeCounter +} + +type marshalPatternFlowPppProtocolTypeCounter interface { + // ToProto marshals PatternFlowPppProtocolTypeCounter to protobuf object *otg.PatternFlowPppProtocolTypeCounter + ToProto() (*otg.PatternFlowPppProtocolTypeCounter, error) + // ToPbText marshals PatternFlowPppProtocolTypeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPppProtocolTypeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPppProtocolTypeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPppProtocolTypeCounter struct { + obj *patternFlowPppProtocolTypeCounter +} + +type unMarshalPatternFlowPppProtocolTypeCounter interface { + // FromProto unmarshals PatternFlowPppProtocolTypeCounter from protobuf object *otg.PatternFlowPppProtocolTypeCounter + FromProto(msg *otg.PatternFlowPppProtocolTypeCounter) (PatternFlowPppProtocolTypeCounter, error) + // FromPbText unmarshals PatternFlowPppProtocolTypeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPppProtocolTypeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPppProtocolTypeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPppProtocolTypeCounter) Marshal() marshalPatternFlowPppProtocolTypeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPppProtocolTypeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPppProtocolTypeCounter) Unmarshal() unMarshalPatternFlowPppProtocolTypeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPppProtocolTypeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPppProtocolTypeCounter) ToProto() (*otg.PatternFlowPppProtocolTypeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPppProtocolTypeCounter) FromProto(msg *otg.PatternFlowPppProtocolTypeCounter) (PatternFlowPppProtocolTypeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPppProtocolTypeCounter) 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 *unMarshalpatternFlowPppProtocolTypeCounter) 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 *marshalpatternFlowPppProtocolTypeCounter) 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 *unMarshalpatternFlowPppProtocolTypeCounter) 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 *marshalpatternFlowPppProtocolTypeCounter) 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 *unMarshalpatternFlowPppProtocolTypeCounter) 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 *patternFlowPppProtocolTypeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPppProtocolTypeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPppProtocolTypeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPppProtocolTypeCounter) Clone() (PatternFlowPppProtocolTypeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPppProtocolTypeCounter() + 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 +} + +// PatternFlowPppProtocolTypeCounter is integer counter pattern +type PatternFlowPppProtocolTypeCounter interface { + Validation + // msg marshals PatternFlowPppProtocolTypeCounter to protobuf object *otg.PatternFlowPppProtocolTypeCounter + // and doesn't set defaults + msg() *otg.PatternFlowPppProtocolTypeCounter + // setMsg unmarshals PatternFlowPppProtocolTypeCounter from protobuf object *otg.PatternFlowPppProtocolTypeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowPppProtocolTypeCounter) PatternFlowPppProtocolTypeCounter + // provides marshal interface + Marshal() marshalPatternFlowPppProtocolTypeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPppProtocolTypeCounter + // validate validates PatternFlowPppProtocolTypeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPppProtocolTypeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowPppProtocolTypeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowPppProtocolTypeCounter + SetStart(value uint32) PatternFlowPppProtocolTypeCounter + // HasStart checks if Start has been set in PatternFlowPppProtocolTypeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowPppProtocolTypeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowPppProtocolTypeCounter + SetStep(value uint32) PatternFlowPppProtocolTypeCounter + // HasStep checks if Step has been set in PatternFlowPppProtocolTypeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowPppProtocolTypeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowPppProtocolTypeCounter + SetCount(value uint32) PatternFlowPppProtocolTypeCounter + // HasCount checks if Count has been set in PatternFlowPppProtocolTypeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPppProtocolTypeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowPppProtocolTypeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowPppProtocolTypeCounter object +func (obj *patternFlowPppProtocolTypeCounter) SetStart(value uint32) PatternFlowPppProtocolTypeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPppProtocolTypeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowPppProtocolTypeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowPppProtocolTypeCounter object +func (obj *patternFlowPppProtocolTypeCounter) SetStep(value uint32) PatternFlowPppProtocolTypeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPppProtocolTypeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowPppProtocolTypeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowPppProtocolTypeCounter object +func (obj *patternFlowPppProtocolTypeCounter) SetCount(value uint32) PatternFlowPppProtocolTypeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowPppProtocolTypeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppProtocolTypeCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppProtocolTypeCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppProtocolTypeCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowPppProtocolTypeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(33) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_ppp_protocol_type_metric_tag.go b/gosnappi/pattern_flow_ppp_protocol_type_metric_tag.go new file mode 100644 index 00000000..3de3b9ec --- /dev/null +++ b/gosnappi/pattern_flow_ppp_protocol_type_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowPppProtocolTypeMetricTag ***** +type patternFlowPppProtocolTypeMetricTag struct { + validation + obj *otg.PatternFlowPppProtocolTypeMetricTag + marshaller marshalPatternFlowPppProtocolTypeMetricTag + unMarshaller unMarshalPatternFlowPppProtocolTypeMetricTag +} + +func NewPatternFlowPppProtocolTypeMetricTag() PatternFlowPppProtocolTypeMetricTag { + obj := patternFlowPppProtocolTypeMetricTag{obj: &otg.PatternFlowPppProtocolTypeMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowPppProtocolTypeMetricTag) msg() *otg.PatternFlowPppProtocolTypeMetricTag { + return obj.obj +} + +func (obj *patternFlowPppProtocolTypeMetricTag) setMsg(msg *otg.PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypeMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowPppProtocolTypeMetricTag struct { + obj *patternFlowPppProtocolTypeMetricTag +} + +type marshalPatternFlowPppProtocolTypeMetricTag interface { + // ToProto marshals PatternFlowPppProtocolTypeMetricTag to protobuf object *otg.PatternFlowPppProtocolTypeMetricTag + ToProto() (*otg.PatternFlowPppProtocolTypeMetricTag, error) + // ToPbText marshals PatternFlowPppProtocolTypeMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowPppProtocolTypeMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowPppProtocolTypeMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowPppProtocolTypeMetricTag struct { + obj *patternFlowPppProtocolTypeMetricTag +} + +type unMarshalPatternFlowPppProtocolTypeMetricTag interface { + // FromProto unmarshals PatternFlowPppProtocolTypeMetricTag from protobuf object *otg.PatternFlowPppProtocolTypeMetricTag + FromProto(msg *otg.PatternFlowPppProtocolTypeMetricTag) (PatternFlowPppProtocolTypeMetricTag, error) + // FromPbText unmarshals PatternFlowPppProtocolTypeMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowPppProtocolTypeMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowPppProtocolTypeMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowPppProtocolTypeMetricTag) Marshal() marshalPatternFlowPppProtocolTypeMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowPppProtocolTypeMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowPppProtocolTypeMetricTag) Unmarshal() unMarshalPatternFlowPppProtocolTypeMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowPppProtocolTypeMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowPppProtocolTypeMetricTag) ToProto() (*otg.PatternFlowPppProtocolTypeMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowPppProtocolTypeMetricTag) FromProto(msg *otg.PatternFlowPppProtocolTypeMetricTag) (PatternFlowPppProtocolTypeMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowPppProtocolTypeMetricTag) 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 *unMarshalpatternFlowPppProtocolTypeMetricTag) 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 *marshalpatternFlowPppProtocolTypeMetricTag) 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 *unMarshalpatternFlowPppProtocolTypeMetricTag) 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 *marshalpatternFlowPppProtocolTypeMetricTag) 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 *unMarshalpatternFlowPppProtocolTypeMetricTag) 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 *patternFlowPppProtocolTypeMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowPppProtocolTypeMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowPppProtocolTypeMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowPppProtocolTypeMetricTag) Clone() (PatternFlowPppProtocolTypeMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowPppProtocolTypeMetricTag() + 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 +} + +// PatternFlowPppProtocolTypeMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowPppProtocolTypeMetricTag interface { + Validation + // msg marshals PatternFlowPppProtocolTypeMetricTag to protobuf object *otg.PatternFlowPppProtocolTypeMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowPppProtocolTypeMetricTag + // setMsg unmarshals PatternFlowPppProtocolTypeMetricTag from protobuf object *otg.PatternFlowPppProtocolTypeMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowPppProtocolTypeMetricTag) PatternFlowPppProtocolTypeMetricTag + // provides marshal interface + Marshal() marshalPatternFlowPppProtocolTypeMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowPppProtocolTypeMetricTag + // validate validates PatternFlowPppProtocolTypeMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowPppProtocolTypeMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowPppProtocolTypeMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowPppProtocolTypeMetricTag + SetName(value string) PatternFlowPppProtocolTypeMetricTag + // Offset returns uint32, set in PatternFlowPppProtocolTypeMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowPppProtocolTypeMetricTag + SetOffset(value uint32) PatternFlowPppProtocolTypeMetricTag + // HasOffset checks if Offset has been set in PatternFlowPppProtocolTypeMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowPppProtocolTypeMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowPppProtocolTypeMetricTag + SetLength(value uint32) PatternFlowPppProtocolTypeMetricTag + // HasLength checks if Length has been set in PatternFlowPppProtocolTypeMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowPppProtocolTypeMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowPppProtocolTypeMetricTag object +func (obj *patternFlowPppProtocolTypeMetricTag) SetName(value string) PatternFlowPppProtocolTypeMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPppProtocolTypeMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowPppProtocolTypeMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowPppProtocolTypeMetricTag object +func (obj *patternFlowPppProtocolTypeMetricTag) SetOffset(value uint32) PatternFlowPppProtocolTypeMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPppProtocolTypeMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowPppProtocolTypeMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowPppProtocolTypeMetricTag object +func (obj *patternFlowPppProtocolTypeMetricTag) SetLength(value uint32) PatternFlowPppProtocolTypeMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowPppProtocolTypeMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowPppProtocolTypeMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowPppProtocolTypeMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowPppProtocolTypeMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowPppProtocolTypeMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_as_number_l_bit.go b/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_as_number_l_bit.go new file mode 100644 index 00000000..5300a186 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_as_number_l_bit.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathExplicitRouteType1ASNumberLBit ***** +type patternFlowRSVPPathExplicitRouteType1ASNumberLBit struct { + validation + obj *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + marshaller marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit + unMarshaller unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit + incrementHolder PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + decrementHolder PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter +} + +func NewPatternFlowRSVPPathExplicitRouteType1ASNumberLBit() PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { + obj := patternFlowRSVPPathExplicitRouteType1ASNumberLBit{obj: &otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) msg() *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { + return obj.obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) setMsg(msg *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit struct { + obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit +} + +type marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit interface { + // ToProto marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit, error) + // ToPbText marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit struct { + obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit +} + +type unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit interface { + // FromProto unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) (PatternFlowRSVPPathExplicitRouteType1ASNumberLBit, error) + // FromPbText unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Marshal() marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) (PatternFlowRSVPPathExplicitRouteType1ASNumberLBit, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBit) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Clone() (PatternFlowRSVPPathExplicitRouteType1ASNumberLBit, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathExplicitRouteType1ASNumberLBit() + 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 +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathExplicitRouteType1ASNumberLBit is the L bit is an attribute of the subobject. The L bit is set if the subobject represents a loose hop in the explicit route. If the bit is not set, the subobject represents a strict hop in the explicit route. +type PatternFlowRSVPPathExplicitRouteType1ASNumberLBit interface { + Validation + // msg marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + // setMsg unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBit from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBit + // validate validates PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathExplicitRouteType1ASNumberLBit, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + Choice() PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum + // setChoice assigns PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + setChoice(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + // HasChoice checks if Choice has been set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + SetValue(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + // HasValue checks if Value has been set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + SetValues(value []uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + // Increment returns PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit. + // PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter is integer counter pattern + Increment() PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + // SetIncrement assigns PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBit. + // PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit. + // PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter is integer counter pattern + Decrement() PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + // SetDecrement assigns PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBit. + // PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathExplicitRouteType1ASNumberLBit +var PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice = struct { + VALUE PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum + VALUES PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum + INCREMENT PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum + DECREMENT PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum +}{ + VALUE: PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum("value"), + VALUES: PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Choice() PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum { + return PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) setChoice(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { + intValue, ok := otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter().msg() + } + + if value == PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1ASNumberLBit object +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) SetValue(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathExplicitRouteType1ASNumberLBit object +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) SetValues(value []uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Increment() PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter value in the PatternFlowRSVPPathExplicitRouteType1ASNumberLBit object +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) SetIncrement(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) Decrement() PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter value in the PatternFlowRSVPPathExplicitRouteType1ASNumberLBit object +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) SetDecrement(value PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) PatternFlowRSVPPathExplicitRouteType1ASNumberLBit { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathExplicitRouteType1ASNumberLBit.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBit) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1ASNumberLBitChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathExplicitRouteType1ASNumberLBit") + } + } else { + intVal := otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBit_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_as_number_l_bit_counter.go b/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_as_number_l_bit_counter.go new file mode 100644 index 00000000..7ec0f593 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_as_number_l_bit_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter ***** +type patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter struct { + validation + obj *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + marshaller marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + unMarshaller unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter +} + +func NewPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter() PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { + obj := patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter{obj: &otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) msg() *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) setMsg(msg *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter struct { + obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter +} + +type marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter interface { + // ToProto marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, error) + // ToPbText marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter struct { + obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter +} + +type unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter interface { + // FromProto unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) (PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) Marshal() marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) (PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) 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 *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) 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 *marshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) 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 *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) Clone() (PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter() + 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 +} + +// PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter is integer counter pattern +type PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter interface { + Validation + // msg marshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + // setMsg unmarshals PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + // validate validates PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + SetStart(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + SetStep(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + SetCount(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter object +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) SetStart(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter object +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) SetStep(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter object +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) SetCount(value uint32) PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathExplicitRouteType1ASNumberLBitCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_ipv4_address.go b/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_ipv4_address.go new file mode 100644 index 00000000..bbdb0735 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_ipv4_address.go @@ -0,0 +1,553 @@ +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" +) + +// ***** PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address ***** +type patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address struct { + validation + obj *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + marshaller marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + unMarshaller unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + incrementHolder PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + decrementHolder PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter +} + +func NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { + obj := patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address{obj: &otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { + return obj.obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) setMsg(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address struct { + obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address +} + +type marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address interface { + // ToProto marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address, error) + // ToPbText marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address struct { + obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address +} + +type unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address interface { + // FromProto unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address, error) + // FromPbText unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address() + 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 +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address is this IPv4 address is treated as a prefix based on the prefix length value below. Bits beyond the prefix are ignored on receipt and SHOULD be set to zero on transmission. +type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address interface { + Validation + // msg marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + // setMsg unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + // validate validates PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + Choice() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum + // setChoice assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + setChoice(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + // HasChoice checks if Choice has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + HasChoice() bool + // Value returns string, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address. + Value() string + // SetValue assigns string provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + SetValue(value string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + // HasValue checks if Value has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + HasValue() bool + // Values returns []string, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address. + Values() []string + // SetValues assigns []string provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + SetValues(value []string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + // Increment returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address. + // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter is ipv4 counter pattern + Increment() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + // SetIncrement assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address. + // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter is ipv4 counter pattern + SetIncrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address. + // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter is ipv4 counter pattern + Decrement() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + // SetDecrement assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address. + // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter is ipv4 counter pattern + SetDecrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address +var PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice = struct { + VALUE PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum + VALUES PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum + INCREMENT PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum + DECREMENT PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum +}{ + VALUE: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum("value"), + VALUES: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Choice() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum { + return PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) setChoice(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { + intValue, ok := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUE { + defaultValue := "0.0.0.0" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUES { + defaultValue := []string{"0.0.0.0"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter().msg() + } + + if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address object +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) SetValue(value string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"0.0.0.0"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address object +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) SetValues(value []string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Increment() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address object +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) SetIncrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) Decrement() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address object +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) SetDecrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv4(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateIpv4Slice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address") + } + } else { + intVal := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4Address_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_ipv4_address_counter.go b/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_ipv4_address_counter.go new file mode 100644 index 00000000..41352d5d --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_ipv4_address_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter ***** +type patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter struct { + validation + obj *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + marshaller marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + unMarshaller unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter +} + +func NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { + obj := patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter{obj: &otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) setMsg(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter struct { + obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter +} + +type marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter interface { + // ToProto marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, error) + // ToPbText marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter struct { + obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter +} + +type unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter interface { + // FromProto unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) 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 *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) 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 *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) 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 *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter() + 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 +} + +// PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter is ipv4 counter pattern +type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter interface { + Validation + // msg marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + // setMsg unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + // validate validates PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + SetStart(value string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + HasStart() bool + // Step returns string, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + SetStep(value string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + SetCount(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter object +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) SetStart(value string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter object +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) SetStep(value string) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter object +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) SetCount(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateIpv4(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateIpv4(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter.Step")) + } + + } + +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixIpv4AddressCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("0.0.0.0") + } + if obj.obj.Step == nil { + obj.SetStep("0.0.0.1") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_l_bit.go b/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_l_bit.go new file mode 100644 index 00000000..b9df0d4d --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_l_bit.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit ***** +type patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit struct { + validation + obj *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + marshaller marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + unMarshaller unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + incrementHolder PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + decrementHolder PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter +} + +func NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { + obj := patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit{obj: &otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { + return obj.obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) setMsg(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit struct { + obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit +} + +type marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit interface { + // ToProto marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit, error) + // ToPbText marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit struct { + obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit +} + +type unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit interface { + // FromProto unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit, error) + // FromPbText unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit() + 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 +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit is the L bit is an attribute of the subobject. The L bit is set if the subobject represents a loose hop in the explicit route. If the bit is not set, the subobject represents a strict hop in the explicit route. +type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit interface { + Validation + // msg marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + // setMsg unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + // validate validates PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + Choice() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum + // setChoice assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + setChoice(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + // HasChoice checks if Choice has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + SetValue(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + // HasValue checks if Value has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + SetValues(value []uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + // Increment returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit. + // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter is integer counter pattern + Increment() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + // SetIncrement assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit. + // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit. + // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter is integer counter pattern + Decrement() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + // SetDecrement assigns PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit. + // PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit +var PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice = struct { + VALUE PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum + VALUES PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum + INCREMENT PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum + DECREMENT PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum +}{ + VALUE: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum("value"), + VALUES: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Choice() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum { + return PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) setChoice(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { + intValue, ok := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter().msg() + } + + if value == PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit object +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) SetValue(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit object +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) SetValues(value []uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Increment() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit object +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) SetIncrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) Decrement() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit object +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) SetDecrement(value PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit") + } + } else { + intVal := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBit_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_l_bit_counter.go b/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_l_bit_counter.go new file mode 100644 index 00000000..1347218d --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_explicit_route_type1_ipv4_prefix_l_bit_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter ***** +type patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter struct { + validation + obj *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + marshaller marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + unMarshaller unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter +} + +func NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter() PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { + obj := patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter{obj: &otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) setMsg(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter struct { + obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter +} + +type marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter interface { + // ToProto marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, error) + // ToPbText marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter struct { + obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter +} + +type unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter interface { + // FromProto unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) ToProto() (*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) FromProto(msg *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) 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 *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) 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 *marshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) 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 *unMarshalpatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) 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 *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter() + 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 +} + +// PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter is integer counter pattern +type PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter interface { + Validation + // msg marshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter to protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + // setMsg unmarshals PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter from protobuf object *otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + // validate validates PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + SetStart(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + SetStep(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + SetCount(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter object +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) SetStart(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter object +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) SetStep(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter object +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) SetCount(value uint32) PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathExplicitRouteType1Ipv4PrefixLBitCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_l3_pid.go b/gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_l3_pid.go new file mode 100644 index 00000000..c0836330 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_l3_pid.go @@ -0,0 +1,554 @@ +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" +) + +// ***** PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid ***** +type patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid struct { + validation + obj *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + marshaller marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + unMarshaller unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + incrementHolder PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + decrementHolder PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter +} + +func NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { + obj := patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid{obj: &otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { + return obj.obj +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) setMsg(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid struct { + obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid +} + +type marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid interface { + // ToProto marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid, error) + // ToPbText marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid struct { + obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid +} + +type unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid interface { + // FromProto unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid, error) + // FromPbText unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid() + 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 +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid is an identifier of the layer 3 protocol using this path. Standard Ethertype values are used e.g. The default value of 2048 ( 0x0800 ) represents Ethertype for IPv4. +type PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid interface { + Validation + // msg marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + // setMsg unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + // validate validates PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + Choice() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum + // setChoice assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + setChoice(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + // HasChoice checks if Choice has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + SetValue(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + // HasValue checks if Value has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + SetValues(value []uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + // Increment returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid. + Increment() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + // SetIncrement assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid. + SetIncrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid. + Decrement() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + // SetDecrement assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid. + SetDecrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid +var PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice = struct { + VALUE PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum + VALUES PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum + INCREMENT PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum + DECREMENT PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum +}{ + VALUE: PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum("value"), + VALUES: PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Choice() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum { + return PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) setChoice(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { + intValue, ok := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUE { + defaultValue := uint32(2048) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUES { + defaultValue := []uint32{2048} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter().msg() + } + + if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid object +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) SetValue(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{2048}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid object +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) SetValues(value []uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Increment() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid object +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) SetIncrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) Decrement() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid object +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) SetDecrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid") + } + } else { + intVal := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3Pid_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_l3_pid_counter.go b/gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_l3_pid_counter.go new file mode 100644 index 00000000..9cf35295 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_l3_pid_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter ***** +type patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter struct { + validation + obj *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + marshaller marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + unMarshaller unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter +} + +func NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter() PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { + obj := patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter{obj: &otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) setMsg(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter struct { + obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter +} + +type marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter interface { + // ToProto marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, error) + // ToPbText marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter struct { + obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter +} + +type unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter interface { + // FromProto unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) 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 *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) 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 *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) 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 *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter() + 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 +} + +// PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter is integer counter pattern +type PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter interface { + Validation + // msg marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + // setMsg unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + // validate validates PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + SetStart(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + SetStep(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + SetCount(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter object +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) SetStart(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter object +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) SetStep(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter object +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) SetCount(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeL3PidCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(2048) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_reserved.go b/gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_reserved.go new file mode 100644 index 00000000..835d10d0 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_reserved.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved ***** +type patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved struct { + validation + obj *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + marshaller marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + unMarshaller unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + incrementHolder PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + decrementHolder PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter +} + +func NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { + obj := patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved{obj: &otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { + return obj.obj +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) setMsg(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved struct { + obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved +} + +type marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved interface { + // ToProto marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved, error) + // ToPbText marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved struct { + obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved +} + +type unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved interface { + // FromProto unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved, error) + // FromPbText unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved() + 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 +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved is this field is reserved. It MUST be set to zero on transmission and MUST be ignored on receipt. +type PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved interface { + Validation + // msg marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + // setMsg unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + // validate validates PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + Choice() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum + // setChoice assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + setChoice(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + // HasChoice checks if Choice has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + SetValue(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + // HasValue checks if Value has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + SetValues(value []uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + // Increment returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved. + // PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter is integer counter pattern + Increment() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + // SetIncrement assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved. + // PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved. + // PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter is integer counter pattern + Decrement() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + // SetDecrement assigns PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved. + // PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved +var PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice = struct { + VALUE PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum + VALUES PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum + INCREMENT PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum + DECREMENT PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum +}{ + VALUE: PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum("value"), + VALUES: PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Choice() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum { + return PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) setChoice(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { + intValue, ok := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter().msg() + } + + if value == PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved object +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) SetValue(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved object +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) SetValues(value []uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Increment() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved object +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) SetIncrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) Decrement() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved object +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) SetDecrement(value PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReserved) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved") + } + } else { + intVal := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReserved_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_reserved_counter.go b/gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_reserved_counter.go new file mode 100644 index 00000000..d0284d08 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_label_request_without_label_range_reserved_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter ***** +type patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter struct { + validation + obj *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + marshaller marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + unMarshaller unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter +} + +func NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter() PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { + obj := patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter{obj: &otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) setMsg(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter struct { + obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter +} + +type marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter interface { + // ToProto marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, error) + // ToPbText marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter struct { + obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter +} + +type unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter interface { + // FromProto unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) ToProto() (*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) FromProto(msg *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) 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 *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) 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 *marshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) 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 *unMarshalpatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) 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 *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter() + 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 +} + +// PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter is integer counter pattern +type PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter interface { + Validation + // msg marshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter to protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + // setMsg unmarshals PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter from protobuf object *otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + // validate validates PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + SetStart(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + SetStep(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + SetCount(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter object +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) SetStart(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter object +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) SetStep(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter object +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) SetCount(value uint32) PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathLabelRequestWithoutLabelRangeReservedCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_objects_custom_type.go b/gosnappi/pattern_flow_rsvp_path_objects_custom_type.go new file mode 100644 index 00000000..5ebc769a --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_objects_custom_type.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathObjectsCustomType ***** +type patternFlowRSVPPathObjectsCustomType struct { + validation + obj *otg.PatternFlowRSVPPathObjectsCustomType + marshaller marshalPatternFlowRSVPPathObjectsCustomType + unMarshaller unMarshalPatternFlowRSVPPathObjectsCustomType + incrementHolder PatternFlowRSVPPathObjectsCustomTypeCounter + decrementHolder PatternFlowRSVPPathObjectsCustomTypeCounter +} + +func NewPatternFlowRSVPPathObjectsCustomType() PatternFlowRSVPPathObjectsCustomType { + obj := patternFlowRSVPPathObjectsCustomType{obj: &otg.PatternFlowRSVPPathObjectsCustomType{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathObjectsCustomType) msg() *otg.PatternFlowRSVPPathObjectsCustomType { + return obj.obj +} + +func (obj *patternFlowRSVPPathObjectsCustomType) setMsg(msg *otg.PatternFlowRSVPPathObjectsCustomType) PatternFlowRSVPPathObjectsCustomType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathObjectsCustomType struct { + obj *patternFlowRSVPPathObjectsCustomType +} + +type marshalPatternFlowRSVPPathObjectsCustomType interface { + // ToProto marshals PatternFlowRSVPPathObjectsCustomType to protobuf object *otg.PatternFlowRSVPPathObjectsCustomType + ToProto() (*otg.PatternFlowRSVPPathObjectsCustomType, error) + // ToPbText marshals PatternFlowRSVPPathObjectsCustomType to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathObjectsCustomType to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathObjectsCustomType to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathObjectsCustomType struct { + obj *patternFlowRSVPPathObjectsCustomType +} + +type unMarshalPatternFlowRSVPPathObjectsCustomType interface { + // FromProto unmarshals PatternFlowRSVPPathObjectsCustomType from protobuf object *otg.PatternFlowRSVPPathObjectsCustomType + FromProto(msg *otg.PatternFlowRSVPPathObjectsCustomType) (PatternFlowRSVPPathObjectsCustomType, error) + // FromPbText unmarshals PatternFlowRSVPPathObjectsCustomType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathObjectsCustomType from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathObjectsCustomType from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathObjectsCustomType) Marshal() marshalPatternFlowRSVPPathObjectsCustomType { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathObjectsCustomType{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathObjectsCustomType) Unmarshal() unMarshalPatternFlowRSVPPathObjectsCustomType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathObjectsCustomType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathObjectsCustomType) ToProto() (*otg.PatternFlowRSVPPathObjectsCustomType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathObjectsCustomType) FromProto(msg *otg.PatternFlowRSVPPathObjectsCustomType) (PatternFlowRSVPPathObjectsCustomType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathObjectsCustomType) 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 *unMarshalpatternFlowRSVPPathObjectsCustomType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathObjectsCustomType) 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 *unMarshalpatternFlowRSVPPathObjectsCustomType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathObjectsCustomType) 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 *unMarshalpatternFlowRSVPPathObjectsCustomType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathObjectsCustomType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathObjectsCustomType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathObjectsCustomType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathObjectsCustomType) Clone() (PatternFlowRSVPPathObjectsCustomType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathObjectsCustomType() + 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 +} + +func (obj *patternFlowRSVPPathObjectsCustomType) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathObjectsCustomType is user defined object type. +type PatternFlowRSVPPathObjectsCustomType interface { + Validation + // msg marshals PatternFlowRSVPPathObjectsCustomType to protobuf object *otg.PatternFlowRSVPPathObjectsCustomType + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathObjectsCustomType + // setMsg unmarshals PatternFlowRSVPPathObjectsCustomType from protobuf object *otg.PatternFlowRSVPPathObjectsCustomType + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathObjectsCustomType) PatternFlowRSVPPathObjectsCustomType + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathObjectsCustomType + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathObjectsCustomType + // validate validates PatternFlowRSVPPathObjectsCustomType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathObjectsCustomType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathObjectsCustomTypeChoiceEnum, set in PatternFlowRSVPPathObjectsCustomType + Choice() PatternFlowRSVPPathObjectsCustomTypeChoiceEnum + // setChoice assigns PatternFlowRSVPPathObjectsCustomTypeChoiceEnum provided by user to PatternFlowRSVPPathObjectsCustomType + setChoice(value PatternFlowRSVPPathObjectsCustomTypeChoiceEnum) PatternFlowRSVPPathObjectsCustomType + // HasChoice checks if Choice has been set in PatternFlowRSVPPathObjectsCustomType + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathObjectsCustomType. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathObjectsCustomType + SetValue(value uint32) PatternFlowRSVPPathObjectsCustomType + // HasValue checks if Value has been set in PatternFlowRSVPPathObjectsCustomType + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathObjectsCustomType. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathObjectsCustomType + SetValues(value []uint32) PatternFlowRSVPPathObjectsCustomType + // Increment returns PatternFlowRSVPPathObjectsCustomTypeCounter, set in PatternFlowRSVPPathObjectsCustomType. + // PatternFlowRSVPPathObjectsCustomTypeCounter is integer counter pattern + Increment() PatternFlowRSVPPathObjectsCustomTypeCounter + // SetIncrement assigns PatternFlowRSVPPathObjectsCustomTypeCounter provided by user to PatternFlowRSVPPathObjectsCustomType. + // PatternFlowRSVPPathObjectsCustomTypeCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathObjectsCustomTypeCounter) PatternFlowRSVPPathObjectsCustomType + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathObjectsCustomType + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathObjectsCustomTypeCounter, set in PatternFlowRSVPPathObjectsCustomType. + // PatternFlowRSVPPathObjectsCustomTypeCounter is integer counter pattern + Decrement() PatternFlowRSVPPathObjectsCustomTypeCounter + // SetDecrement assigns PatternFlowRSVPPathObjectsCustomTypeCounter provided by user to PatternFlowRSVPPathObjectsCustomType. + // PatternFlowRSVPPathObjectsCustomTypeCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathObjectsCustomTypeCounter) PatternFlowRSVPPathObjectsCustomType + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathObjectsCustomType + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathObjectsCustomTypeChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathObjectsCustomType +var PatternFlowRSVPPathObjectsCustomTypeChoice = struct { + VALUE PatternFlowRSVPPathObjectsCustomTypeChoiceEnum + VALUES PatternFlowRSVPPathObjectsCustomTypeChoiceEnum + INCREMENT PatternFlowRSVPPathObjectsCustomTypeChoiceEnum + DECREMENT PatternFlowRSVPPathObjectsCustomTypeChoiceEnum +}{ + VALUE: PatternFlowRSVPPathObjectsCustomTypeChoiceEnum("value"), + VALUES: PatternFlowRSVPPathObjectsCustomTypeChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathObjectsCustomTypeChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathObjectsCustomTypeChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathObjectsCustomType) Choice() PatternFlowRSVPPathObjectsCustomTypeChoiceEnum { + return PatternFlowRSVPPathObjectsCustomTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathObjectsCustomType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathObjectsCustomType) setChoice(value PatternFlowRSVPPathObjectsCustomTypeChoiceEnum) PatternFlowRSVPPathObjectsCustomType { + intValue, ok := otg.PatternFlowRSVPPathObjectsCustomType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathObjectsCustomTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathObjectsCustomType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathObjectsCustomTypeChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathObjectsCustomTypeChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathObjectsCustomTypeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathObjectsCustomTypeCounter().msg() + } + + if value == PatternFlowRSVPPathObjectsCustomTypeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathObjectsCustomTypeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathObjectsCustomType) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathObjectsCustomType) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathObjectsCustomType object +func (obj *patternFlowRSVPPathObjectsCustomType) SetValue(value uint32) PatternFlowRSVPPathObjectsCustomType { + obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathObjectsCustomType) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathObjectsCustomType object +func (obj *patternFlowRSVPPathObjectsCustomType) SetValues(value []uint32) PatternFlowRSVPPathObjectsCustomType { + obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathObjectsCustomTypeCounter +func (obj *patternFlowRSVPPathObjectsCustomType) Increment() PatternFlowRSVPPathObjectsCustomTypeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathObjectsCustomTypeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathObjectsCustomTypeCounter +func (obj *patternFlowRSVPPathObjectsCustomType) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathObjectsCustomTypeCounter value in the PatternFlowRSVPPathObjectsCustomType object +func (obj *patternFlowRSVPPathObjectsCustomType) SetIncrement(value PatternFlowRSVPPathObjectsCustomTypeCounter) PatternFlowRSVPPathObjectsCustomType { + obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathObjectsCustomTypeCounter +func (obj *patternFlowRSVPPathObjectsCustomType) Decrement() PatternFlowRSVPPathObjectsCustomTypeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathObjectsCustomTypeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathObjectsCustomTypeCounter +func (obj *patternFlowRSVPPathObjectsCustomType) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathObjectsCustomTypeCounter value in the PatternFlowRSVPPathObjectsCustomType object +func (obj *patternFlowRSVPPathObjectsCustomType) SetDecrement(value PatternFlowRSVPPathObjectsCustomTypeCounter) PatternFlowRSVPPathObjectsCustomType { + obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathObjectsCustomType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathObjectsCustomType.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathObjectsCustomType.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathObjectsCustomType) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathObjectsCustomTypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathObjectsCustomTypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathObjectsCustomTypeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathObjectsCustomTypeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathObjectsCustomTypeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathObjectsCustomTypeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathObjectsCustomType") + } + } else { + intVal := otg.PatternFlowRSVPPathObjectsCustomType_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathObjectsCustomType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_objects_custom_type_counter.go b/gosnappi/pattern_flow_rsvp_path_objects_custom_type_counter.go new file mode 100644 index 00000000..473f07db --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_objects_custom_type_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathObjectsCustomTypeCounter ***** +type patternFlowRSVPPathObjectsCustomTypeCounter struct { + validation + obj *otg.PatternFlowRSVPPathObjectsCustomTypeCounter + marshaller marshalPatternFlowRSVPPathObjectsCustomTypeCounter + unMarshaller unMarshalPatternFlowRSVPPathObjectsCustomTypeCounter +} + +func NewPatternFlowRSVPPathObjectsCustomTypeCounter() PatternFlowRSVPPathObjectsCustomTypeCounter { + obj := patternFlowRSVPPathObjectsCustomTypeCounter{obj: &otg.PatternFlowRSVPPathObjectsCustomTypeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) msg() *otg.PatternFlowRSVPPathObjectsCustomTypeCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) setMsg(msg *otg.PatternFlowRSVPPathObjectsCustomTypeCounter) PatternFlowRSVPPathObjectsCustomTypeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathObjectsCustomTypeCounter struct { + obj *patternFlowRSVPPathObjectsCustomTypeCounter +} + +type marshalPatternFlowRSVPPathObjectsCustomTypeCounter interface { + // ToProto marshals PatternFlowRSVPPathObjectsCustomTypeCounter to protobuf object *otg.PatternFlowRSVPPathObjectsCustomTypeCounter + ToProto() (*otg.PatternFlowRSVPPathObjectsCustomTypeCounter, error) + // ToPbText marshals PatternFlowRSVPPathObjectsCustomTypeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathObjectsCustomTypeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathObjectsCustomTypeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathObjectsCustomTypeCounter struct { + obj *patternFlowRSVPPathObjectsCustomTypeCounter +} + +type unMarshalPatternFlowRSVPPathObjectsCustomTypeCounter interface { + // FromProto unmarshals PatternFlowRSVPPathObjectsCustomTypeCounter from protobuf object *otg.PatternFlowRSVPPathObjectsCustomTypeCounter + FromProto(msg *otg.PatternFlowRSVPPathObjectsCustomTypeCounter) (PatternFlowRSVPPathObjectsCustomTypeCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathObjectsCustomTypeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathObjectsCustomTypeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathObjectsCustomTypeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) Marshal() marshalPatternFlowRSVPPathObjectsCustomTypeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathObjectsCustomTypeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) Unmarshal() unMarshalPatternFlowRSVPPathObjectsCustomTypeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathObjectsCustomTypeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathObjectsCustomTypeCounter) ToProto() (*otg.PatternFlowRSVPPathObjectsCustomTypeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathObjectsCustomTypeCounter) FromProto(msg *otg.PatternFlowRSVPPathObjectsCustomTypeCounter) (PatternFlowRSVPPathObjectsCustomTypeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathObjectsCustomTypeCounter) 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 *unMarshalpatternFlowRSVPPathObjectsCustomTypeCounter) 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 *marshalpatternFlowRSVPPathObjectsCustomTypeCounter) 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 *unMarshalpatternFlowRSVPPathObjectsCustomTypeCounter) 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 *marshalpatternFlowRSVPPathObjectsCustomTypeCounter) 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 *unMarshalpatternFlowRSVPPathObjectsCustomTypeCounter) 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 *patternFlowRSVPPathObjectsCustomTypeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) Clone() (PatternFlowRSVPPathObjectsCustomTypeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathObjectsCustomTypeCounter() + 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 +} + +// PatternFlowRSVPPathObjectsCustomTypeCounter is integer counter pattern +type PatternFlowRSVPPathObjectsCustomTypeCounter interface { + Validation + // msg marshals PatternFlowRSVPPathObjectsCustomTypeCounter to protobuf object *otg.PatternFlowRSVPPathObjectsCustomTypeCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathObjectsCustomTypeCounter + // setMsg unmarshals PatternFlowRSVPPathObjectsCustomTypeCounter from protobuf object *otg.PatternFlowRSVPPathObjectsCustomTypeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathObjectsCustomTypeCounter) PatternFlowRSVPPathObjectsCustomTypeCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathObjectsCustomTypeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathObjectsCustomTypeCounter + // validate validates PatternFlowRSVPPathObjectsCustomTypeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathObjectsCustomTypeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathObjectsCustomTypeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathObjectsCustomTypeCounter + SetStart(value uint32) PatternFlowRSVPPathObjectsCustomTypeCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathObjectsCustomTypeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathObjectsCustomTypeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathObjectsCustomTypeCounter + SetStep(value uint32) PatternFlowRSVPPathObjectsCustomTypeCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathObjectsCustomTypeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathObjectsCustomTypeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathObjectsCustomTypeCounter + SetCount(value uint32) PatternFlowRSVPPathObjectsCustomTypeCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathObjectsCustomTypeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathObjectsCustomTypeCounter object +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) SetStart(value uint32) PatternFlowRSVPPathObjectsCustomTypeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathObjectsCustomTypeCounter object +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) SetStep(value uint32) PatternFlowRSVPPathObjectsCustomTypeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathObjectsCustomTypeCounter object +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) SetCount(value uint32) PatternFlowRSVPPathObjectsCustomTypeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathObjectsCustomTypeCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathObjectsCustomTypeCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathObjectsCustomTypeCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathObjectsCustomTypeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_ipv4_address.go b/gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_ipv4_address.go new file mode 100644 index 00000000..b35de500 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_ipv4_address.go @@ -0,0 +1,553 @@ +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" +) + +// ***** PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address ***** +type patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address struct { + validation + obj *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + marshaller marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + unMarshaller unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + incrementHolder PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + decrementHolder PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter +} + +func NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { + obj := patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address{obj: &otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { + return obj.obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) setMsg(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address struct { + obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address +} + +type marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address interface { + // ToProto marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address, error) + // ToPbText marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address struct { + obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address +} + +type unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address interface { + // FromProto unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address, error) + // FromPbText unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address() + 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 +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address is a 32-bit unicast, host address. Any network-reachable interface address is allowed here. Illegal addresses, such as certain loopback addresses, SHOULD NOT be used. +type PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address interface { + Validation + // msg marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + // setMsg unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + // validate validates PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + Choice() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum + // setChoice assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + setChoice(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + // HasChoice checks if Choice has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + HasChoice() bool + // Value returns string, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address. + Value() string + // SetValue assigns string provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + SetValue(value string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + // HasValue checks if Value has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + HasValue() bool + // Values returns []string, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address. + Values() []string + // SetValues assigns []string provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + SetValues(value []string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + // Increment returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address. + // PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter is ipv4 counter pattern + Increment() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + // SetIncrement assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address. + // PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter is ipv4 counter pattern + SetIncrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address. + // PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter is ipv4 counter pattern + Decrement() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + // SetDecrement assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address. + // PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter is ipv4 counter pattern + SetDecrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address +var PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice = struct { + VALUE PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum + VALUES PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum + INCREMENT PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum + DECREMENT PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum +}{ + VALUE: PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum("value"), + VALUES: PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Choice() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum { + return PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) setChoice(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { + intValue, ok := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUE { + defaultValue := "0.0.0.0" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUES { + defaultValue := []string{"0.0.0.0"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter().msg() + } + + if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address object +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) SetValue(value string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"0.0.0.0"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address object +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) SetValues(value []string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Increment() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address object +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) SetIncrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) Decrement() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address object +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) SetDecrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv4(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateIpv4Slice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address") + } + } else { + intVal := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4Address_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_ipv4_address_counter.go b/gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_ipv4_address_counter.go new file mode 100644 index 00000000..208fd7d4 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_ipv4_address_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter ***** +type patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter struct { + validation + obj *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + marshaller marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + unMarshaller unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter +} + +func NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter() PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { + obj := patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter{obj: &otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) setMsg(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter struct { + obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter +} + +type marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter interface { + // ToProto marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, error) + // ToPbText marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter struct { + obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter +} + +type unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter interface { + // FromProto unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) 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 *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) 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 *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) 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 *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter() + 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 +} + +// PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter is ipv4 counter pattern +type PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter interface { + Validation + // msg marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + // setMsg unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + // validate validates PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + SetStart(value string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + HasStart() bool + // Step returns string, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + SetStep(value string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + SetCount(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter object +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) SetStart(value string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter object +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) SetStep(value string) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter object +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) SetCount(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateIpv4(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateIpv4(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter.Step")) + } + + } + +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressIpv4AddressCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("0.0.0.0") + } + if obj.obj.Step == nil { + obj.SetStep("0.0.0.1") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_prefix_length.go b/gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_prefix_length.go new file mode 100644 index 00000000..851c8312 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_prefix_length.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength ***** +type patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength struct { + validation + obj *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + marshaller marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + unMarshaller unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + incrementHolder PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + decrementHolder PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter +} + +func NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { + obj := patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength{obj: &otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { + return obj.obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) setMsg(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength struct { + obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength +} + +type marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength interface { + // ToProto marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength, error) + // ToPbText marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength struct { + obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength +} + +type unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength interface { + // FromProto unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength, error) + // FromPbText unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength() + 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 +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength is prefix-length of IPv4 address. +type PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength interface { + Validation + // msg marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + // setMsg unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + // validate validates PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + Choice() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum + // setChoice assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + setChoice(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + // HasChoice checks if Choice has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + SetValue(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + // HasValue checks if Value has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + SetValues(value []uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + // Increment returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength. + // PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter is integer counter pattern + Increment() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + // SetIncrement assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength. + // PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength. + // PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter is integer counter pattern + Decrement() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + // SetDecrement assigns PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength. + // PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength +var PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice = struct { + VALUE PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum + VALUES PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum + INCREMENT PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum + DECREMENT PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum +}{ + VALUE: PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum("value"), + VALUES: PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Choice() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum { + return PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) setChoice(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { + intValue, ok := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUE { + defaultValue := uint32(32) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUES { + defaultValue := []uint32{32} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter().msg() + } + + if value == PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength object +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) SetValue(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{32}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength object +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) SetValues(value []uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Increment() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength object +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) SetIncrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) Decrement() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength object +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) SetDecrement(value PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength") + } + } else { + intVal := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_prefix_length_counter.go b/gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_prefix_length_counter.go new file mode 100644 index 00000000..88047e0a --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_record_route_type1_ipv4_address_prefix_length_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter ***** +type patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter struct { + validation + obj *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + marshaller marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + unMarshaller unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter +} + +func NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter() PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { + obj := patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter{obj: &otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) setMsg(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter struct { + obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter +} + +type marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter interface { + // ToProto marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, error) + // ToPbText marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter struct { + obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter +} + +type unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter interface { + // FromProto unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) 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 *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) 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 *marshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) 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 *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter() + 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 +} + +// PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter is integer counter pattern +type PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter interface { + Validation + // msg marshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + // setMsg unmarshals PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + // validate validates PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + SetStart(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + SetStep(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + SetCount(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter object +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) SetStart(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter object +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) SetStep(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter object +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) SetCount(value uint32) PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathRecordRouteType1Ipv4AddressPrefixLengthCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(32) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_record_route_type1_label_c_type.go b/gosnappi/pattern_flow_rsvp_path_record_route_type1_label_c_type.go new file mode 100644 index 00000000..593682bf --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_record_route_type1_label_c_type.go @@ -0,0 +1,439 @@ +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" +) + +// ***** PatternFlowRSVPPathRecordRouteType1LabelCType ***** +type patternFlowRSVPPathRecordRouteType1LabelCType struct { + validation + obj *otg.PatternFlowRSVPPathRecordRouteType1LabelCType + marshaller marshalPatternFlowRSVPPathRecordRouteType1LabelCType + unMarshaller unMarshalPatternFlowRSVPPathRecordRouteType1LabelCType +} + +func NewPatternFlowRSVPPathRecordRouteType1LabelCType() PatternFlowRSVPPathRecordRouteType1LabelCType { + obj := patternFlowRSVPPathRecordRouteType1LabelCType{obj: &otg.PatternFlowRSVPPathRecordRouteType1LabelCType{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) msg() *otg.PatternFlowRSVPPathRecordRouteType1LabelCType { + return obj.obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) setMsg(msg *otg.PatternFlowRSVPPathRecordRouteType1LabelCType) PatternFlowRSVPPathRecordRouteType1LabelCType { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathRecordRouteType1LabelCType struct { + obj *patternFlowRSVPPathRecordRouteType1LabelCType +} + +type marshalPatternFlowRSVPPathRecordRouteType1LabelCType interface { + // ToProto marshals PatternFlowRSVPPathRecordRouteType1LabelCType to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelCType + ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1LabelCType, error) + // ToPbText marshals PatternFlowRSVPPathRecordRouteType1LabelCType to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathRecordRouteType1LabelCType to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathRecordRouteType1LabelCType to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathRecordRouteType1LabelCType struct { + obj *patternFlowRSVPPathRecordRouteType1LabelCType +} + +type unMarshalPatternFlowRSVPPathRecordRouteType1LabelCType interface { + // FromProto unmarshals PatternFlowRSVPPathRecordRouteType1LabelCType from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelCType + FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1LabelCType) (PatternFlowRSVPPathRecordRouteType1LabelCType, error) + // FromPbText unmarshals PatternFlowRSVPPathRecordRouteType1LabelCType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathRecordRouteType1LabelCType from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathRecordRouteType1LabelCType from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) Marshal() marshalPatternFlowRSVPPathRecordRouteType1LabelCType { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathRecordRouteType1LabelCType{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1LabelCType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathRecordRouteType1LabelCType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1LabelCType) ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1LabelCType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathRecordRouteType1LabelCType) FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1LabelCType) (PatternFlowRSVPPathRecordRouteType1LabelCType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1LabelCType) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1LabelCType) 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 *marshalpatternFlowRSVPPathRecordRouteType1LabelCType) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1LabelCType) 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 *marshalpatternFlowRSVPPathRecordRouteType1LabelCType) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1LabelCType) 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 *patternFlowRSVPPathRecordRouteType1LabelCType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) Clone() (PatternFlowRSVPPathRecordRouteType1LabelCType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathRecordRouteType1LabelCType() + 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 +} + +// PatternFlowRSVPPathRecordRouteType1LabelCType is the C-Type of the included Label Object. Copied from the Label object. +type PatternFlowRSVPPathRecordRouteType1LabelCType interface { + Validation + // msg marshals PatternFlowRSVPPathRecordRouteType1LabelCType to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelCType + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathRecordRouteType1LabelCType + // setMsg unmarshals PatternFlowRSVPPathRecordRouteType1LabelCType from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelCType + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathRecordRouteType1LabelCType) PatternFlowRSVPPathRecordRouteType1LabelCType + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathRecordRouteType1LabelCType + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1LabelCType + // validate validates PatternFlowRSVPPathRecordRouteType1LabelCType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathRecordRouteType1LabelCType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum, set in PatternFlowRSVPPathRecordRouteType1LabelCType + Choice() PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum + // setChoice assigns PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum provided by user to PatternFlowRSVPPathRecordRouteType1LabelCType + setChoice(value PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum) PatternFlowRSVPPathRecordRouteType1LabelCType + // HasChoice checks if Choice has been set in PatternFlowRSVPPathRecordRouteType1LabelCType + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathRecordRouteType1LabelCType. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathRecordRouteType1LabelCType + SetValue(value uint32) PatternFlowRSVPPathRecordRouteType1LabelCType + // HasValue checks if Value has been set in PatternFlowRSVPPathRecordRouteType1LabelCType + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathRecordRouteType1LabelCType. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathRecordRouteType1LabelCType + SetValues(value []uint32) PatternFlowRSVPPathRecordRouteType1LabelCType +} + +type PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathRecordRouteType1LabelCType +var PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice = struct { + VALUE PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum + VALUES PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum +}{ + VALUE: PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum("value"), + VALUES: PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum("values"), +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) Choice() PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum { + return PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) setChoice(value PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum) PatternFlowRSVPPathRecordRouteType1LabelCType { + intValue, ok := otg.PatternFlowRSVPPathRecordRouteType1LabelCType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathRecordRouteType1LabelCType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUE { + defaultValue := uint32(1) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUES { + defaultValue := []uint32{1} + obj.obj.Values = defaultValue + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathRecordRouteType1LabelCType object +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) SetValue(value uint32) PatternFlowRSVPPathRecordRouteType1LabelCType { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{1}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathRecordRouteType1LabelCType object +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) SetValues(value []uint32) PatternFlowRSVPPathRecordRouteType1LabelCType { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathRecordRouteType1LabelCType.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathRecordRouteType1LabelCType.Values <= 255 but Got %d", item)) + } + + } + + } + +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelCType) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathRecordRouteType1LabelCTypeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUES + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelCTypeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathRecordRouteType1LabelCType") + } + } else { + intVal := otg.PatternFlowRSVPPathRecordRouteType1LabelCType_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathRecordRouteType1LabelCType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_record_route_type1_label_flags.go b/gosnappi/pattern_flow_rsvp_path_record_route_type1_label_flags.go new file mode 100644 index 00000000..9eaeae0a --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_record_route_type1_label_flags.go @@ -0,0 +1,439 @@ +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" +) + +// ***** PatternFlowRSVPPathRecordRouteType1LabelFlags ***** +type patternFlowRSVPPathRecordRouteType1LabelFlags struct { + validation + obj *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags + marshaller marshalPatternFlowRSVPPathRecordRouteType1LabelFlags + unMarshaller unMarshalPatternFlowRSVPPathRecordRouteType1LabelFlags +} + +func NewPatternFlowRSVPPathRecordRouteType1LabelFlags() PatternFlowRSVPPathRecordRouteType1LabelFlags { + obj := patternFlowRSVPPathRecordRouteType1LabelFlags{obj: &otg.PatternFlowRSVPPathRecordRouteType1LabelFlags{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) msg() *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags { + return obj.obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) setMsg(msg *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags) PatternFlowRSVPPathRecordRouteType1LabelFlags { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathRecordRouteType1LabelFlags struct { + obj *patternFlowRSVPPathRecordRouteType1LabelFlags +} + +type marshalPatternFlowRSVPPathRecordRouteType1LabelFlags interface { + // ToProto marshals PatternFlowRSVPPathRecordRouteType1LabelFlags to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags + ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1LabelFlags, error) + // ToPbText marshals PatternFlowRSVPPathRecordRouteType1LabelFlags to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathRecordRouteType1LabelFlags to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathRecordRouteType1LabelFlags to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathRecordRouteType1LabelFlags struct { + obj *patternFlowRSVPPathRecordRouteType1LabelFlags +} + +type unMarshalPatternFlowRSVPPathRecordRouteType1LabelFlags interface { + // FromProto unmarshals PatternFlowRSVPPathRecordRouteType1LabelFlags from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags + FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags) (PatternFlowRSVPPathRecordRouteType1LabelFlags, error) + // FromPbText unmarshals PatternFlowRSVPPathRecordRouteType1LabelFlags from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathRecordRouteType1LabelFlags from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathRecordRouteType1LabelFlags from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) Marshal() marshalPatternFlowRSVPPathRecordRouteType1LabelFlags { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathRecordRouteType1LabelFlags{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1LabelFlags { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathRecordRouteType1LabelFlags{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1LabelFlags) ToProto() (*otg.PatternFlowRSVPPathRecordRouteType1LabelFlags, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathRecordRouteType1LabelFlags) FromProto(msg *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags) (PatternFlowRSVPPathRecordRouteType1LabelFlags, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathRecordRouteType1LabelFlags) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1LabelFlags) 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 *marshalpatternFlowRSVPPathRecordRouteType1LabelFlags) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1LabelFlags) 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 *marshalpatternFlowRSVPPathRecordRouteType1LabelFlags) 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 *unMarshalpatternFlowRSVPPathRecordRouteType1LabelFlags) 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 *patternFlowRSVPPathRecordRouteType1LabelFlags) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) Clone() (PatternFlowRSVPPathRecordRouteType1LabelFlags, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathRecordRouteType1LabelFlags() + 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 +} + +// PatternFlowRSVPPathRecordRouteType1LabelFlags is 0x01 = Global label. This flag indicates that the label will be understood if received on any interface. +type PatternFlowRSVPPathRecordRouteType1LabelFlags interface { + Validation + // msg marshals PatternFlowRSVPPathRecordRouteType1LabelFlags to protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags + // setMsg unmarshals PatternFlowRSVPPathRecordRouteType1LabelFlags from protobuf object *otg.PatternFlowRSVPPathRecordRouteType1LabelFlags + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathRecordRouteType1LabelFlags) PatternFlowRSVPPathRecordRouteType1LabelFlags + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathRecordRouteType1LabelFlags + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathRecordRouteType1LabelFlags + // validate validates PatternFlowRSVPPathRecordRouteType1LabelFlags + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathRecordRouteType1LabelFlags, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum, set in PatternFlowRSVPPathRecordRouteType1LabelFlags + Choice() PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum + // setChoice assigns PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum provided by user to PatternFlowRSVPPathRecordRouteType1LabelFlags + setChoice(value PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum) PatternFlowRSVPPathRecordRouteType1LabelFlags + // HasChoice checks if Choice has been set in PatternFlowRSVPPathRecordRouteType1LabelFlags + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathRecordRouteType1LabelFlags. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathRecordRouteType1LabelFlags + SetValue(value uint32) PatternFlowRSVPPathRecordRouteType1LabelFlags + // HasValue checks if Value has been set in PatternFlowRSVPPathRecordRouteType1LabelFlags + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathRecordRouteType1LabelFlags. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathRecordRouteType1LabelFlags + SetValues(value []uint32) PatternFlowRSVPPathRecordRouteType1LabelFlags +} + +type PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathRecordRouteType1LabelFlags +var PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice = struct { + VALUE PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum + VALUES PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum +}{ + VALUE: PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum("value"), + VALUES: PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum("values"), +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) Choice() PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum { + return PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) setChoice(value PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum) PatternFlowRSVPPathRecordRouteType1LabelFlags { + intValue, ok := otg.PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUE { + defaultValue := uint32(1) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUES { + defaultValue := []uint32{1} + obj.obj.Values = defaultValue + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathRecordRouteType1LabelFlags object +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) SetValue(value uint32) PatternFlowRSVPPathRecordRouteType1LabelFlags { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{1}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathRecordRouteType1LabelFlags object +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) SetValues(value []uint32) PatternFlowRSVPPathRecordRouteType1LabelFlags { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathRecordRouteType1LabelFlags.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathRecordRouteType1LabelFlags.Values <= 255 but Got %d", item)) + } + + } + + } + +} + +func (obj *patternFlowRSVPPathRecordRouteType1LabelFlags) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathRecordRouteType1LabelFlagsChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUES + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathRecordRouteType1LabelFlagsChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathRecordRouteType1LabelFlags") + } + } else { + intVal := otg.PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathRecordRouteType1LabelFlags_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_ipv4_address.go b/gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_ipv4_address.go new file mode 100644 index 00000000..ccd33e78 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_ipv4_address.go @@ -0,0 +1,553 @@ +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" +) + +// ***** PatternFlowRSVPPathRsvpHopIpv4Ipv4Address ***** +type patternFlowRSVPPathRsvpHopIpv4Ipv4Address struct { + validation + obj *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + marshaller marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address + unMarshaller unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address + incrementHolder PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + decrementHolder PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter +} + +func NewPatternFlowRSVPPathRsvpHopIpv4Ipv4Address() PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { + obj := patternFlowRSVPPathRsvpHopIpv4Ipv4Address{obj: &otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) msg() *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { + return obj.obj +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) setMsg(msg *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address struct { + obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address +} + +type marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address interface { + // ToProto marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address, error) + // ToPbText marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address struct { + obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address +} + +type unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address interface { + // FromProto unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) (PatternFlowRSVPPathRsvpHopIpv4Ipv4Address, error) + // FromPbText unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) (PatternFlowRSVPPathRsvpHopIpv4Ipv4Address, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4Address) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Clone() (PatternFlowRSVPPathRsvpHopIpv4Ipv4Address, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathRsvpHopIpv4Ipv4Address() + 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 +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathRsvpHopIpv4Ipv4Address is the IPv4 address of the interface through which the last RSVP-knowledgeable hop forwarded this message. +type PatternFlowRSVPPathRsvpHopIpv4Ipv4Address interface { + Validation + // msg marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + // setMsg unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4Address from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4Address + // validate validates PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathRsvpHopIpv4Ipv4Address, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + Choice() PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum + // setChoice assigns PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + setChoice(value PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + // HasChoice checks if Choice has been set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + HasChoice() bool + // Value returns string, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address. + Value() string + // SetValue assigns string provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + SetValue(value string) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + // HasValue checks if Value has been set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + HasValue() bool + // Values returns []string, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address. + Values() []string + // SetValues assigns []string provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + SetValues(value []string) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + // Increment returns PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address. + // PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter is ipv4 counter pattern + Increment() PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + // SetIncrement assigns PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4Address. + // PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter is ipv4 counter pattern + SetIncrement(value PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address. + // PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter is ipv4 counter pattern + Decrement() PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + // SetDecrement assigns PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4Address. + // PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter is ipv4 counter pattern + SetDecrement(value PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathRsvpHopIpv4Ipv4Address +var PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice = struct { + VALUE PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum + VALUES PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum + INCREMENT PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum + DECREMENT PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum +}{ + VALUE: PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum("value"), + VALUES: PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Choice() PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum { + return PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) setChoice(value PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { + intValue, ok := otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUE { + defaultValue := "0.0.0.0" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUES { + defaultValue := []string{"0.0.0.0"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter().msg() + } + + if value == PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowRSVPPathRsvpHopIpv4Ipv4Address object +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) SetValue(value string) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"0.0.0.0"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowRSVPPathRsvpHopIpv4Ipv4Address object +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) SetValues(value []string) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Increment() PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter value in the PatternFlowRSVPPathRsvpHopIpv4Ipv4Address object +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) SetIncrement(value PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) Decrement() PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter value in the PatternFlowRSVPPathRsvpHopIpv4Ipv4Address object +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) SetDecrement(value PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) PatternFlowRSVPPathRsvpHopIpv4Ipv4Address { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv4(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateIpv4Slice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRsvpHopIpv4Ipv4Address.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4Address) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathRsvpHopIpv4Ipv4Address") + } + } else { + intVal := otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4Address_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_ipv4_address_counter.go b/gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_ipv4_address_counter.go new file mode 100644 index 00000000..57b2241f --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_ipv4_address_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter ***** +type patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter struct { + validation + obj *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + marshaller marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + unMarshaller unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter +} + +func NewPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter() PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { + obj := patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter{obj: &otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) msg() *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) setMsg(msg *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter struct { + obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter +} + +type marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter interface { + // ToProto marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, error) + // ToPbText marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter struct { + obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter +} + +type unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter interface { + // FromProto unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) (PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) (PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) 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 *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) 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 *marshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) 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 *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) Clone() (PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter() + 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 +} + +// PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter is ipv4 counter pattern +type PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter interface { + Validation + // msg marshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + // setMsg unmarshals PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + // validate validates PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + SetStart(value string) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + HasStart() bool + // Step returns string, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + SetStep(value string) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + SetCount(value uint32) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter object +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) SetStart(value string) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter object +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) SetStep(value string) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter object +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) SetCount(value uint32) PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateIpv4(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateIpv4(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter.Step")) + } + + } + +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4Ipv4AddressCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("0.0.0.0") + } + if obj.obj.Step == nil { + obj.SetStep("0.0.0.1") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_logical_interface_handle.go b/gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_logical_interface_handle.go new file mode 100644 index 00000000..0fc2f8ee --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_logical_interface_handle.go @@ -0,0 +1,535 @@ +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" +) + +// ***** PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle ***** +type patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle struct { + validation + obj *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + marshaller marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + unMarshaller unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + incrementHolder PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + decrementHolder PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter +} + +func NewPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { + obj := patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle{obj: &otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) msg() *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { + return obj.obj +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) setMsg(msg *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle struct { + obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle +} + +type marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle interface { + // ToProto marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle, error) + // ToPbText marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle struct { + obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle +} + +type unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle interface { + // FromProto unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle, error) + // FromPbText unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Clone() (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle() + 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 +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle is logical Interface Handle (LIH) is used to distinguish logical outgoing interfaces. A node receiving an LIH in a Path message saves its value and returns it in the HOP objects of subsequent Resv messages sent to the node that originated the LIH. The LIH should be identically zero if there is no logical interface handle. +type PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle interface { + Validation + // msg marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + // setMsg unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + // validate validates PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + Choice() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum + // setChoice assigns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + setChoice(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + // HasChoice checks if Choice has been set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + SetValue(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + // HasValue checks if Value has been set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + SetValues(value []uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + // Increment returns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle. + // PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter is integer counter pattern + Increment() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + // SetIncrement assigns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle. + // PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle. + // PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter is integer counter pattern + Decrement() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + // SetDecrement assigns PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle. + // PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle +var PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice = struct { + VALUE PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum + VALUES PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum + INCREMENT PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum + DECREMENT PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum +}{ + VALUE: PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum("value"), + VALUES: PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Choice() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum { + return PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) setChoice(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { + intValue, ok := otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter().msg() + } + + if value == PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle object +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) SetValue(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle object +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) SetValues(value []uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Increment() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter value in the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle object +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) SetIncrement(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) Decrement() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter value in the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle object +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) SetDecrement(value PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle") + } + } else { + intVal := otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandle_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_logical_interface_handle_counter.go b/gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_logical_interface_handle_counter.go new file mode 100644 index 00000000..2f366c97 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_rsvp_hop_ipv4_logical_interface_handle_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter ***** +type patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter struct { + validation + obj *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + marshaller marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + unMarshaller unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter +} + +func NewPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter() PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { + obj := patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter{obj: &otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) msg() *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) setMsg(msg *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter struct { + obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter +} + +type marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter interface { + // ToProto marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, error) + // ToPbText marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter struct { + obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter +} + +type unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter interface { + // FromProto unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) ToProto() (*otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) FromProto(msg *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) 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 *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) 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 *marshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) 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 *unMarshalpatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) 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 *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) Clone() (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter() + 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 +} + +// PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter is integer counter pattern +type PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter interface { + Validation + // msg marshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter to protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + // setMsg unmarshals PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter from protobuf object *otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + // validate validates PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + SetStart(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + SetStep(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + SetCount(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter object +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) SetStart(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter object +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) SetStep(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter object +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) SetCount(value uint32) PatternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowRSVPPathRsvpHopIpv4LogicalInterfaceHandleCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_ipv4_tunnel_sender_address.go b/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_ipv4_tunnel_sender_address.go new file mode 100644 index 00000000..9469f553 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_ipv4_tunnel_sender_address.go @@ -0,0 +1,553 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress ***** +type patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress struct { + validation + obj *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + marshaller marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + unMarshaller unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + incrementHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + decrementHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter +} + +func NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { + obj := patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress{obj: &otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) setMsg(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress struct { + obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress +} + +type marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress interface { + // ToProto marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress, error) + // ToPbText marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress struct { + obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress +} + +type unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress() + 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 +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress is iPv4 address for a sender node. +type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + // setMsg unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + // validate validates PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + Choice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + setChoice(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + HasChoice() bool + // Value returns string, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress. + Value() string + // SetValue assigns string provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + SetValue(value string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + HasValue() bool + // Values returns []string, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress. + Values() []string + // SetValues assigns []string provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + SetValues(value []string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + // Increment returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter is ipv4 counter pattern + Increment() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + // SetIncrement assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter is ipv4 counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter is ipv4 counter pattern + Decrement() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + // SetDecrement assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter is ipv4 counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress +var PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice = struct { + VALUE PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum + VALUES PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Choice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum { + return PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) setChoice(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { + intValue, ok := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUE { + defaultValue := "0.0.0.0" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUES { + defaultValue := []string{"0.0.0.0"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter().msg() + } + + if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) SetValue(value string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"0.0.0.0"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) SetValues(value []string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Increment() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) SetIncrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) Decrement() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) SetDecrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv4(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateIpv4Slice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddress_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_ipv4_tunnel_sender_address_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_ipv4_tunnel_sender_address_counter.go new file mode 100644 index 00000000..e6dfe349 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_ipv4_tunnel_sender_address_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter ***** +type patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + marshaller marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + unMarshaller unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter +} + +func NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { + obj := patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter{obj: &otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter struct { + obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter +} + +type marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter interface { + // ToProto marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter struct { + obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter +} + +type unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) 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 *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) 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 *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) 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 *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter() + 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 +} + +// PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter is ipv4 counter pattern +type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + // setMsg unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + // validate validates PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + SetStart(value string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + HasStart() bool + // Step returns string, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + SetStep(value string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + SetCount(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) SetStart(value string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) SetStep(value string) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateIpv4(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateIpv4(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter.Step")) + } + + } + +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Ipv4TunnelSenderAddressCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("0.0.0.0") + } + if obj.obj.Step == nil { + obj.SetStep("0.0.0.1") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_lsp_id.go b/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_lsp_id.go new file mode 100644 index 00000000..a63239af --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_lsp_id.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId ***** +type patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId struct { + validation + obj *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + marshaller marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + unMarshaller unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + incrementHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + decrementHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter +} + +func NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { + obj := patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId{obj: &otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) setMsg(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId struct { + obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId +} + +type marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId interface { + // ToProto marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId, error) + // ToPbText marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId struct { + obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId +} + +type unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId() + 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 +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId is a 16-bit identifier used in the SENDER_TEMPLATE that can be changed to allow a sender to share resources with itself. +type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + // setMsg unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + // validate validates PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + Choice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + setChoice(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + SetValue(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + SetValues(value []uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + // Increment returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter is integer counter pattern + Increment() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + // SetIncrement assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + // SetDecrement assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId +var PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice = struct { + VALUE PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum + VALUES PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Choice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum { + return PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) setChoice(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { + intValue, ok := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUE { + defaultValue := uint32(1) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUES { + defaultValue := []uint32{1} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter().msg() + } + + if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) SetValue(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{1}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) SetValues(value []uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Increment() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) SetIncrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) Decrement() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) SetDecrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspId_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_lsp_id_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_lsp_id_counter.go new file mode 100644 index 00000000..b23cef53 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_lsp_id_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter ***** +type patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + marshaller marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + unMarshaller unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter +} + +func NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { + obj := patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter{obj: &otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter struct { + obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter +} + +type marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter interface { + // ToProto marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter struct { + obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter +} + +type unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) 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 *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) 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 *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) 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 *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter() + 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 +} + +// PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter is integer counter pattern +type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + // setMsg unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + // validate validates PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + SetStart(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + SetStep(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + SetCount(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4LspIdCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_reserved.go b/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_reserved.go new file mode 100644 index 00000000..0208e855 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_reserved.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved ***** +type patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved struct { + validation + obj *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + marshaller marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + unMarshaller unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + incrementHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + decrementHolder PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter +} + +func NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { + obj := patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved{obj: &otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) setMsg(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved struct { + obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved +} + +type marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved interface { + // ToProto marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved, error) + // ToPbText marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved struct { + obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved +} + +type unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved() + 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 +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved is reserved field, MUST be zero. +type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + // setMsg unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + // validate validates PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + Choice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + setChoice(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + SetValue(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + SetValues(value []uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + // Increment returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter is integer counter pattern + Increment() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + // SetIncrement assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + // SetDecrement assigns PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved. + // PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved +var PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice = struct { + VALUE PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum + VALUES PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Choice() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum { + return PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) setChoice(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { + intValue, ok := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter().msg() + } + + if value == PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) SetValue(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) SetValues(value []uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Increment() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) SetIncrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) Decrement() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) SetDecrement(value PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4Reserved_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_reserved_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_reserved_counter.go new file mode 100644 index 00000000..f1437b5c --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_template_lsp_tunnel_ipv4_reserved_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter ***** +type patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + marshaller marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + unMarshaller unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter +} + +func NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter() PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { + obj := patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter{obj: &otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter struct { + obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter +} + +type marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter interface { + // ToProto marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter struct { + obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter +} + +type unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) 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 *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) 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 *marshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) 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 *unMarshalpatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) 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 *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter() + 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 +} + +// PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter is integer counter pattern +type PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter to protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + // setMsg unmarshals PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter from protobuf object *otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + // validate validates PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + SetStart(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + SetStep(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + SetCount(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter object +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathSenderTemplateLspTunnelIpv4ReservedCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_length_of_service_data.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_length_of_service_data.go new file mode 100644 index 00000000..09a754f3 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_length_of_service_data.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData ***** +type patternFlowRSVPPathSenderTspecIntServLengthOfServiceData struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + marshaller marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + incrementHolder PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + decrementHolder PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { + obj := patternFlowRSVPPathSenderTspecIntServLengthOfServiceData{obj: &otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) msg() *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData struct { + obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData +} + +type marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData struct { + obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Clone() (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData() + 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 +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData is length of service data, 6 words not including per-service header. +type PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + // validate validates PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + Choice() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + setChoice(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + // Increment returns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData. + // PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter is integer counter pattern + Increment() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData. + // PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData. + // PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData. + // PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData +var PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice = struct { + VALUE PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum + VALUES PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Choice() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum { + return PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) setChoice(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { + intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUE { + defaultValue := uint32(6) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUES { + defaultValue := []uint32{6} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter().msg() + } + + if value == PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData object +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{6}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData object +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Increment() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter value in the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData object +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) Decrement() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter value in the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData object +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceData) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceData_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_length_of_service_data_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_length_of_service_data_counter.go new file mode 100644 index 00000000..74415e78 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_length_of_service_data_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter ***** +type patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + marshaller marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter() PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { + obj := patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter +} + +type marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) 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 *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter() + 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 +} + +// PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter is integer counter pattern +type PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + // validate validates PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServLengthOfServiceDataCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(6) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_maximum_packet_size.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_maximum_packet_size.go new file mode 100644 index 00000000..6d21b7ba --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_maximum_packet_size.go @@ -0,0 +1,535 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize ***** +type patternFlowRSVPPathSenderTspecIntServMaximumPacketSize struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + marshaller marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + incrementHolder PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + decrementHolder PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { + obj := patternFlowRSVPPathSenderTspecIntServMaximumPacketSize{obj: &otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) msg() *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize struct { + obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize +} + +type marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize struct { + obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Clone() (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize() + 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 +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize is the maximum packet size parameter should be set to the size of the largest packet the application might wish to generate. This value must, by definition, be equal to or larger than the value of The minimum policed unit. +type PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + // validate validates PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + Choice() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + setChoice(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + // Increment returns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize. + // PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter is integer counter pattern + Increment() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize. + // PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize. + // PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize. + // PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize +var PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice = struct { + VALUE PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum + VALUES PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Choice() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum { + return PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) setChoice(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { + intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter().msg() + } + + if value == PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize object +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize object +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Increment() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter value in the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize object +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) Decrement() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter value in the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize object +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSize) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSize_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_maximum_packet_size_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_maximum_packet_size_counter.go new file mode 100644 index 00000000..476792b7 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_maximum_packet_size_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter ***** +type patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + marshaller marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter() PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { + obj := patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter +} + +type marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) 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 *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter() + 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 +} + +// PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter is integer counter pattern +type PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + // validate validates PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMaximumPacketSizeCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_minimum_policed_unit.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_minimum_policed_unit.go new file mode 100644 index 00000000..7fbcb4c9 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_minimum_policed_unit.go @@ -0,0 +1,535 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit ***** +type patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + marshaller marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + incrementHolder PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + decrementHolder PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { + obj := patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit{obj: &otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) msg() *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit struct { + obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit +} + +type marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit struct { + obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Clone() (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit() + 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 +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit is the minimum policed unit parameter should generally be set equal to the size of the smallest packet generated by the application. +type PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + // validate validates PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + Choice() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + setChoice(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + // Increment returns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit. + // PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter is integer counter pattern + Increment() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit. + // PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit. + // PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit. + // PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit +var PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice = struct { + VALUE PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum + VALUES PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Choice() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum { + return PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) setChoice(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { + intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter().msg() + } + + if value == PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit object +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit object +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Increment() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter value in the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit object +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) Decrement() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter value in the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit object +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnit_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_minimum_policed_unit_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_minimum_policed_unit_counter.go new file mode 100644 index 00000000..40743587 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_minimum_policed_unit_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter ***** +type patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + marshaller marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter() PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { + obj := patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter +} + +type marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) 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 *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter() + 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 +} + +// PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter is integer counter pattern +type PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + // validate validates PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServMinimumPolicedUnitCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_overall_length.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_overall_length.go new file mode 100644 index 00000000..3b8c637f --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_overall_length.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServOverallLength ***** +type patternFlowRSVPPathSenderTspecIntServOverallLength struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength + marshaller marshalPatternFlowRSVPPathSenderTspecIntServOverallLength + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLength + incrementHolder PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + decrementHolder PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServOverallLength() PatternFlowRSVPPathSenderTspecIntServOverallLength { + obj := patternFlowRSVPPathSenderTspecIntServOverallLength{obj: &otg.PatternFlowRSVPPathSenderTspecIntServOverallLength{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) msg() *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength) PatternFlowRSVPPathSenderTspecIntServOverallLength { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServOverallLength struct { + obj *patternFlowRSVPPathSenderTspecIntServOverallLength +} + +type marshalPatternFlowRSVPPathSenderTspecIntServOverallLength interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServOverallLength to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServOverallLength, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServOverallLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServOverallLength to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServOverallLength to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLength struct { + obj *patternFlowRSVPPathSenderTspecIntServOverallLength +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLength interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLength from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength) (PatternFlowRSVPPathSenderTspecIntServOverallLength, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLength from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLength from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServOverallLength { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServOverallLength{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServOverallLength) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServOverallLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLength) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength) (PatternFlowRSVPPathSenderTspecIntServOverallLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServOverallLength) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLength) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServOverallLength) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLength) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServOverallLength) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLength) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Clone() (PatternFlowRSVPPathSenderTspecIntServOverallLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServOverallLength() + 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 +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTspecIntServOverallLength is overall length (7 words not including header). +type PatternFlowRSVPPathSenderTspecIntServOverallLength interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServOverallLength to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLength from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLength + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServOverallLength) PatternFlowRSVPPathSenderTspecIntServOverallLength + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServOverallLength + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLength + // validate validates PatternFlowRSVPPathSenderTspecIntServOverallLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServOverallLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServOverallLength + Choice() PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLength + setChoice(value PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum) PatternFlowRSVPPathSenderTspecIntServOverallLength + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServOverallLength + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServOverallLength. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLength + SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLength + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServOverallLength + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServOverallLength. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLength + SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServOverallLength + // Increment returns PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, set in PatternFlowRSVPPathSenderTspecIntServOverallLength. + // PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter is integer counter pattern + Increment() PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLength. + // PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) PatternFlowRSVPPathSenderTspecIntServOverallLength + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServOverallLength + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, set in PatternFlowRSVPPathSenderTspecIntServOverallLength. + // PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLength. + // PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) PatternFlowRSVPPathSenderTspecIntServOverallLength + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServOverallLength + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServOverallLength +var PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice = struct { + VALUE PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum + VALUES PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Choice() PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum { + return PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) setChoice(value PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum) PatternFlowRSVPPathSenderTspecIntServOverallLength { + intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUE { + defaultValue := uint32(7) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUES { + defaultValue := []uint32{7} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter().msg() + } + + if value == PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServOverallLength object +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLength { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{7}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServOverallLength object +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServOverallLength { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Increment() PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServOverallLengthCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter value in the PatternFlowRSVPPathSenderTspecIntServOverallLength object +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) PatternFlowRSVPPathSenderTspecIntServOverallLength { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) Decrement() PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServOverallLengthCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter value in the PatternFlowRSVPPathSenderTspecIntServOverallLength object +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) PatternFlowRSVPPathSenderTspecIntServOverallLength { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServOverallLength.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServOverallLength.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLength) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTspecIntServOverallLengthChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServOverallLengthChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServOverallLength") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServOverallLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_overall_length_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_overall_length_counter.go new file mode 100644 index 00000000..dddb895c --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_overall_length_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter ***** +type patternFlowRSVPPathSenderTspecIntServOverallLengthCounter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + marshaller marshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter() PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { + obj := patternFlowRSVPPathSenderTspecIntServOverallLengthCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter +} + +type marshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) (PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) (PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) 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 *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter() + 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 +} + +// PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter is integer counter pattern +type PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + // validate validates PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServOverallLengthCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServOverallLengthCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(7) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_flag.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_flag.go new file mode 100644 index 00000000..8213ae10 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_flag.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServParameter127Flag ***** +type patternFlowRSVPPathSenderTspecIntServParameter127Flag struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag + marshaller marshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag + incrementHolder PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + decrementHolder PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServParameter127Flag() PatternFlowRSVPPathSenderTspecIntServParameter127Flag { + obj := patternFlowRSVPPathSenderTspecIntServParameter127Flag{obj: &otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag) PatternFlowRSVPPathSenderTspecIntServParameter127Flag { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag struct { + obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag +} + +type marshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag struct { + obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag) (PatternFlowRSVPPathSenderTspecIntServParameter127Flag, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag) (PatternFlowRSVPPathSenderTspecIntServParameter127Flag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Flag) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127Flag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServParameter127Flag() + 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 +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTspecIntServParameter127Flag is parameter 127 flags (none set) +type PatternFlowRSVPPathSenderTspecIntServParameter127Flag interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Flag from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag) PatternFlowRSVPPathSenderTspecIntServParameter127Flag + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Flag + // validate validates PatternFlowRSVPPathSenderTspecIntServParameter127Flag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127Flag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag + Choice() PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Flag + setChoice(value PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum) PatternFlowRSVPPathSenderTspecIntServParameter127Flag + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Flag + SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Flag + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Flag + SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Flag + // Increment returns PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag. + // PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter is integer counter pattern + Increment() PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Flag. + // PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Flag + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag. + // PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Flag. + // PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Flag + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Flag + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServParameter127Flag +var PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice = struct { + VALUE PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum + VALUES PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Choice() PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum { + return PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) setChoice(value PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum) PatternFlowRSVPPathSenderTspecIntServParameter127Flag { + intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter().msg() + } + + if value == PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127Flag object +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Flag { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127Flag object +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Flag { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Increment() PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter value in the PatternFlowRSVPPathSenderTspecIntServParameter127Flag object +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Flag { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) Decrement() PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter value in the PatternFlowRSVPPathSenderTspecIntServParameter127Flag object +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Flag { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127Flag.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServParameter127Flag.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Flag) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127FlagChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServParameter127Flag") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Flag_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_flag_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_flag_counter.go new file mode 100644 index 00000000..c67fc565 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_flag_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter ***** +type patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + marshaller marshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter() PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { + obj := patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter +} + +type marshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) (PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) (PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) 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 *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter() + 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 +} + +// PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter is integer counter pattern +type PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + // validate validates PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127FlagCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127FlagCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_length.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_length.go new file mode 100644 index 00000000..15513070 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_length.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServParameter127Length ***** +type patternFlowRSVPPathSenderTspecIntServParameter127Length struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length + marshaller marshalPatternFlowRSVPPathSenderTspecIntServParameter127Length + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Length + incrementHolder PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + decrementHolder PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServParameter127Length() PatternFlowRSVPPathSenderTspecIntServParameter127Length { + obj := patternFlowRSVPPathSenderTspecIntServParameter127Length{obj: &otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length) PatternFlowRSVPPathSenderTspecIntServParameter127Length { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServParameter127Length struct { + obj *patternFlowRSVPPathSenderTspecIntServParameter127Length +} + +type marshalPatternFlowRSVPPathSenderTspecIntServParameter127Length interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServParameter127Length to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServParameter127Length to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServParameter127Length to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServParameter127Length to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Length struct { + obj *patternFlowRSVPPathSenderTspecIntServParameter127Length +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Length interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Length from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length) (PatternFlowRSVPPathSenderTspecIntServParameter127Length, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Length from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Length from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Length from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127Length { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServParameter127Length{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Length { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Length{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length) (PatternFlowRSVPPathSenderTspecIntServParameter127Length, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127Length) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127Length, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServParameter127Length() + 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 +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTspecIntServParameter127Length is parameter 127 length, 5 words not including per-service header +type PatternFlowRSVPPathSenderTspecIntServParameter127Length interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServParameter127Length to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127Length from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length) PatternFlowRSVPPathSenderTspecIntServParameter127Length + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127Length + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127Length + // validate validates PatternFlowRSVPPathSenderTspecIntServParameter127Length + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127Length, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServParameter127Length + Choice() PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Length + setChoice(value PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum) PatternFlowRSVPPathSenderTspecIntServParameter127Length + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Length + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127Length. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Length + SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Length + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Length + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127Length. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Length + SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Length + // Increment returns PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, set in PatternFlowRSVPPathSenderTspecIntServParameter127Length. + // PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter is integer counter pattern + Increment() PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Length. + // PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Length + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Length + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, set in PatternFlowRSVPPathSenderTspecIntServParameter127Length. + // PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127Length. + // PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Length + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServParameter127Length + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServParameter127Length +var PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice = struct { + VALUE PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum + VALUES PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Choice() PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum { + return PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) setChoice(value PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum) PatternFlowRSVPPathSenderTspecIntServParameter127Length { + intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUE { + defaultValue := uint32(5) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUES { + defaultValue := []uint32{5} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter().msg() + } + + if value == PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127Length object +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Length { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{5}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127Length object +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServParameter127Length { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Increment() PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter value in the PatternFlowRSVPPathSenderTspecIntServParameter127Length object +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Length { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) Decrement() PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter value in the PatternFlowRSVPPathSenderTspecIntServParameter127Length object +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) PatternFlowRSVPPathSenderTspecIntServParameter127Length { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127Length.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServParameter127Length.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127Length) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameter127LengthChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServParameter127Length") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServParameter127Length_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_length_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_length_counter.go new file mode 100644 index 00000000..7b810e0d --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter127_length_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter ***** +type patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + marshaller marshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter() PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { + obj := patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter +} + +type marshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) (PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) (PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) 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 *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter() + 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 +} + +// PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter is integer counter pattern +type PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + // validate validates PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameter127LengthCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameter127LengthCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(5) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter_id_token_bucket_tspec.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter_id_token_bucket_tspec.go new file mode 100644 index 00000000..43ef3c89 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter_id_token_bucket_tspec.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec ***** +type patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + marshaller marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + incrementHolder PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + decrementHolder PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { + obj := patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec{obj: &otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec struct { + obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec +} + +type marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec struct { + obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Clone() (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec() + 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 +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec is parameter ID, parameter 127 (Token Bucket TSpec) +type PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + // validate validates PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + Choice() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + setChoice(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + // Increment returns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec. + // PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter is integer counter pattern + Increment() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec. + // PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec. + // PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec. + // PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec +var PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice = struct { + VALUE PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum + VALUES PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Choice() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum { + return PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) setChoice(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { + intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUE { + defaultValue := uint32(127) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUES { + defaultValue := []uint32{127} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter().msg() + } + + if value == PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec object +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{127}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec object +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Increment() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter value in the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec object +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) Decrement() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter value in the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec object +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspec_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter_id_token_bucket_tspec_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter_id_token_bucket_tspec_counter.go new file mode 100644 index 00000000..a9773782 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_parameter_id_token_bucket_tspec_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter ***** +type patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + marshaller marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter() PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { + obj := patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter +} + +type marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) 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 *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter() + 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 +} + +// PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter is integer counter pattern +type PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + // validate validates PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServParameterIdTokenBucketTspecCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(127) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved1.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved1.go new file mode 100644 index 00000000..e41a4b62 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved1.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServReserved1 ***** +type patternFlowRSVPPathSenderTspecIntServReserved1 struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServReserved1 + marshaller marshalPatternFlowRSVPPathSenderTspecIntServReserved1 + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1 + incrementHolder PatternFlowRSVPPathSenderTspecIntServReserved1Counter + decrementHolder PatternFlowRSVPPathSenderTspecIntServReserved1Counter +} + +func NewPatternFlowRSVPPathSenderTspecIntServReserved1() PatternFlowRSVPPathSenderTspecIntServReserved1 { + obj := patternFlowRSVPPathSenderTspecIntServReserved1{obj: &otg.PatternFlowRSVPPathSenderTspecIntServReserved1{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved1 { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved1) PatternFlowRSVPPathSenderTspecIntServReserved1 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServReserved1 struct { + obj *patternFlowRSVPPathSenderTspecIntServReserved1 +} + +type marshalPatternFlowRSVPPathSenderTspecIntServReserved1 interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServReserved1 to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1 + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved1, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServReserved1 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServReserved1 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServReserved1 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1 struct { + obj *patternFlowRSVPPathSenderTspecIntServReserved1 +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1 interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1 from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1 + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved1) (PatternFlowRSVPPathSenderTspecIntServReserved1, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved1 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServReserved1{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved1) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved1, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved1) (PatternFlowRSVPPathSenderTspecIntServReserved1, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved1) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved1) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved1) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Clone() (PatternFlowRSVPPathSenderTspecIntServReserved1, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServReserved1() + 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 +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTspecIntServReserved1 is reserved. +type PatternFlowRSVPPathSenderTspecIntServReserved1 interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServReserved1 to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1 + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved1 + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1 from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1 + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServReserved1) PatternFlowRSVPPathSenderTspecIntServReserved1 + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved1 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1 + // validate validates PatternFlowRSVPPathSenderTspecIntServReserved1 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServReserved1, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServReserved1 + Choice() PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1 + setChoice(value PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum) PatternFlowRSVPPathSenderTspecIntServReserved1 + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServReserved1 + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved1. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1 + SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1 + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServReserved1 + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved1. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1 + SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServReserved1 + // Increment returns PatternFlowRSVPPathSenderTspecIntServReserved1Counter, set in PatternFlowRSVPPathSenderTspecIntServReserved1. + // PatternFlowRSVPPathSenderTspecIntServReserved1Counter is integer counter pattern + Increment() PatternFlowRSVPPathSenderTspecIntServReserved1Counter + // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServReserved1Counter provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1. + // PatternFlowRSVPPathSenderTspecIntServReserved1Counter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTspecIntServReserved1Counter) PatternFlowRSVPPathSenderTspecIntServReserved1 + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServReserved1 + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTspecIntServReserved1Counter, set in PatternFlowRSVPPathSenderTspecIntServReserved1. + // PatternFlowRSVPPathSenderTspecIntServReserved1Counter is integer counter pattern + Decrement() PatternFlowRSVPPathSenderTspecIntServReserved1Counter + // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServReserved1Counter provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1. + // PatternFlowRSVPPathSenderTspecIntServReserved1Counter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTspecIntServReserved1Counter) PatternFlowRSVPPathSenderTspecIntServReserved1 + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServReserved1 + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServReserved1 +var PatternFlowRSVPPathSenderTspecIntServReserved1Choice = struct { + VALUE PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum + VALUES PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Choice() PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum { + return PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) setChoice(value PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum) PatternFlowRSVPPathSenderTspecIntServReserved1 { + intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServReserved1_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServReserved1_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServReserved1Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServReserved1Counter().msg() + } + + if value == PatternFlowRSVPPathSenderTspecIntServReserved1Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServReserved1Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved1 object +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1 { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved1 object +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServReserved1 { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServReserved1Counter +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Increment() PatternFlowRSVPPathSenderTspecIntServReserved1Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServReserved1Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServReserved1Counter +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServReserved1Counter value in the PatternFlowRSVPPathSenderTspecIntServReserved1 object +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServReserved1Counter) PatternFlowRSVPPathSenderTspecIntServReserved1 { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServReserved1Counter +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) Decrement() PatternFlowRSVPPathSenderTspecIntServReserved1Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServReserved1Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServReserved1Counter +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServReserved1Counter value in the PatternFlowRSVPPathSenderTspecIntServReserved1 object +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServReserved1Counter) PatternFlowRSVPPathSenderTspecIntServReserved1 { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved1.Value <= 4095 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServReserved1.Values <= 4095 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTspecIntServReserved1ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServReserved1Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServReserved1Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved1Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServReserved1") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTspecIntServReserved1_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServReserved1_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved1_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved1_counter.go new file mode 100644 index 00000000..3be67fa8 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved1_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServReserved1Counter ***** +type patternFlowRSVPPathSenderTspecIntServReserved1Counter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter + marshaller marshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter +} + +func NewPatternFlowRSVPPathSenderTspecIntServReserved1Counter() PatternFlowRSVPPathSenderTspecIntServReserved1Counter { + obj := patternFlowRSVPPathSenderTspecIntServReserved1Counter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter) PatternFlowRSVPPathSenderTspecIntServReserved1Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter struct { + obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter +} + +type marshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter struct { + obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter) (PatternFlowRSVPPathSenderTspecIntServReserved1Counter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter) (PatternFlowRSVPPathSenderTspecIntServReserved1Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved1Counter) 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 *patternFlowRSVPPathSenderTspecIntServReserved1Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) Clone() (PatternFlowRSVPPathSenderTspecIntServReserved1Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServReserved1Counter() + 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 +} + +// PatternFlowRSVPPathSenderTspecIntServReserved1Counter is integer counter pattern +type PatternFlowRSVPPathSenderTspecIntServReserved1Counter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServReserved1Counter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServReserved1Counter) PatternFlowRSVPPathSenderTspecIntServReserved1Counter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved1Counter + // validate validates PatternFlowRSVPPathSenderTspecIntServReserved1Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServReserved1Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved1Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1Counter + SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1Counter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServReserved1Counter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved1Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1Counter + SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1Counter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServReserved1Counter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved1Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved1Counter + SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1Counter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServReserved1Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved1Counter object +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved1Counter object +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved1Counter object +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved1Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved1Counter.Start <= 4095 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved1Counter.Step <= 4095 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved1Counter.Count <= 4095 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved1Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved2.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved2.go new file mode 100644 index 00000000..1a4fa3a5 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved2.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServReserved2 ***** +type patternFlowRSVPPathSenderTspecIntServReserved2 struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServReserved2 + marshaller marshalPatternFlowRSVPPathSenderTspecIntServReserved2 + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2 + incrementHolder PatternFlowRSVPPathSenderTspecIntServReserved2Counter + decrementHolder PatternFlowRSVPPathSenderTspecIntServReserved2Counter +} + +func NewPatternFlowRSVPPathSenderTspecIntServReserved2() PatternFlowRSVPPathSenderTspecIntServReserved2 { + obj := patternFlowRSVPPathSenderTspecIntServReserved2{obj: &otg.PatternFlowRSVPPathSenderTspecIntServReserved2{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved2 { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved2) PatternFlowRSVPPathSenderTspecIntServReserved2 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServReserved2 struct { + obj *patternFlowRSVPPathSenderTspecIntServReserved2 +} + +type marshalPatternFlowRSVPPathSenderTspecIntServReserved2 interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServReserved2 to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2 + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved2, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServReserved2 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServReserved2 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServReserved2 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2 struct { + obj *patternFlowRSVPPathSenderTspecIntServReserved2 +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2 interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2 from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2 + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved2) (PatternFlowRSVPPathSenderTspecIntServReserved2, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved2 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServReserved2{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved2) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved2, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved2) (PatternFlowRSVPPathSenderTspecIntServReserved2, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved2) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved2) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved2) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Clone() (PatternFlowRSVPPathSenderTspecIntServReserved2, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServReserved2() + 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 +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTspecIntServReserved2 is reserved. +type PatternFlowRSVPPathSenderTspecIntServReserved2 interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServReserved2 to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2 + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved2 + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2 from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2 + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServReserved2) PatternFlowRSVPPathSenderTspecIntServReserved2 + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved2 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2 + // validate validates PatternFlowRSVPPathSenderTspecIntServReserved2 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServReserved2, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServReserved2 + Choice() PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2 + setChoice(value PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum) PatternFlowRSVPPathSenderTspecIntServReserved2 + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServReserved2 + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved2. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2 + SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2 + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServReserved2 + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved2. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2 + SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServReserved2 + // Increment returns PatternFlowRSVPPathSenderTspecIntServReserved2Counter, set in PatternFlowRSVPPathSenderTspecIntServReserved2. + // PatternFlowRSVPPathSenderTspecIntServReserved2Counter is integer counter pattern + Increment() PatternFlowRSVPPathSenderTspecIntServReserved2Counter + // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServReserved2Counter provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2. + // PatternFlowRSVPPathSenderTspecIntServReserved2Counter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTspecIntServReserved2Counter) PatternFlowRSVPPathSenderTspecIntServReserved2 + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServReserved2 + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTspecIntServReserved2Counter, set in PatternFlowRSVPPathSenderTspecIntServReserved2. + // PatternFlowRSVPPathSenderTspecIntServReserved2Counter is integer counter pattern + Decrement() PatternFlowRSVPPathSenderTspecIntServReserved2Counter + // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServReserved2Counter provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2. + // PatternFlowRSVPPathSenderTspecIntServReserved2Counter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTspecIntServReserved2Counter) PatternFlowRSVPPathSenderTspecIntServReserved2 + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServReserved2 + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServReserved2 +var PatternFlowRSVPPathSenderTspecIntServReserved2Choice = struct { + VALUE PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum + VALUES PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Choice() PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum { + return PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) setChoice(value PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum) PatternFlowRSVPPathSenderTspecIntServReserved2 { + intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServReserved2_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServReserved2_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServReserved2Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServReserved2Counter().msg() + } + + if value == PatternFlowRSVPPathSenderTspecIntServReserved2Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServReserved2Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved2 object +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2 { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved2 object +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServReserved2 { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServReserved2Counter +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Increment() PatternFlowRSVPPathSenderTspecIntServReserved2Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServReserved2Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServReserved2Counter +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServReserved2Counter value in the PatternFlowRSVPPathSenderTspecIntServReserved2 object +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServReserved2Counter) PatternFlowRSVPPathSenderTspecIntServReserved2 { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServReserved2Counter +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) Decrement() PatternFlowRSVPPathSenderTspecIntServReserved2Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServReserved2Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServReserved2Counter +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServReserved2Counter value in the PatternFlowRSVPPathSenderTspecIntServReserved2 object +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServReserved2Counter) PatternFlowRSVPPathSenderTspecIntServReserved2 { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 127 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved2.Value <= 127 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 127 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServReserved2.Values <= 127 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTspecIntServReserved2ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServReserved2Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServReserved2Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServReserved2Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServReserved2") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTspecIntServReserved2_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServReserved2_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved2_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved2_counter.go new file mode 100644 index 00000000..e01444b8 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_reserved2_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServReserved2Counter ***** +type patternFlowRSVPPathSenderTspecIntServReserved2Counter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter + marshaller marshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter +} + +func NewPatternFlowRSVPPathSenderTspecIntServReserved2Counter() PatternFlowRSVPPathSenderTspecIntServReserved2Counter { + obj := patternFlowRSVPPathSenderTspecIntServReserved2Counter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter) PatternFlowRSVPPathSenderTspecIntServReserved2Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter struct { + obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter +} + +type marshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter struct { + obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter) (PatternFlowRSVPPathSenderTspecIntServReserved2Counter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter) (PatternFlowRSVPPathSenderTspecIntServReserved2Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServReserved2Counter) 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 *patternFlowRSVPPathSenderTspecIntServReserved2Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) Clone() (PatternFlowRSVPPathSenderTspecIntServReserved2Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServReserved2Counter() + 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 +} + +// PatternFlowRSVPPathSenderTspecIntServReserved2Counter is integer counter pattern +type PatternFlowRSVPPathSenderTspecIntServReserved2Counter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServReserved2Counter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServReserved2Counter) PatternFlowRSVPPathSenderTspecIntServReserved2Counter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServReserved2Counter + // validate validates PatternFlowRSVPPathSenderTspecIntServReserved2Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServReserved2Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved2Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2Counter + SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2Counter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServReserved2Counter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved2Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2Counter + SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2Counter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServReserved2Counter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServReserved2Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServReserved2Counter + SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2Counter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServReserved2Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved2Counter object +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved2Counter object +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServReserved2Counter object +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServReserved2Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 127 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved2Counter.Start <= 127 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 127 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved2Counter.Step <= 127 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 127 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServReserved2Counter.Count <= 127 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServReserved2Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_service_header.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_service_header.go new file mode 100644 index 00000000..71ea962a --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_service_header.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServServiceHeader ***** +type patternFlowRSVPPathSenderTspecIntServServiceHeader struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader + marshaller marshalPatternFlowRSVPPathSenderTspecIntServServiceHeader + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeader + incrementHolder PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + decrementHolder PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServServiceHeader() PatternFlowRSVPPathSenderTspecIntServServiceHeader { + obj := patternFlowRSVPPathSenderTspecIntServServiceHeader{obj: &otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) msg() *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader) PatternFlowRSVPPathSenderTspecIntServServiceHeader { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServServiceHeader struct { + obj *patternFlowRSVPPathSenderTspecIntServServiceHeader +} + +type marshalPatternFlowRSVPPathSenderTspecIntServServiceHeader interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServServiceHeader to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServServiceHeader to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServServiceHeader to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServServiceHeader to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeader struct { + obj *patternFlowRSVPPathSenderTspecIntServServiceHeader +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeader interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeader from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader) (PatternFlowRSVPPathSenderTspecIntServServiceHeader, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeader from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeader from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeader from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServServiceHeader { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServServiceHeader{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeader { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeader{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader) (PatternFlowRSVPPathSenderTspecIntServServiceHeader, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeader) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Clone() (PatternFlowRSVPPathSenderTspecIntServServiceHeader, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServServiceHeader() + 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 +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTspecIntServServiceHeader is service header, service number - '1' (Generic information) if in a PATH message. +type PatternFlowRSVPPathSenderTspecIntServServiceHeader interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServServiceHeader to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeader from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader) PatternFlowRSVPPathSenderTspecIntServServiceHeader + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServServiceHeader + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeader + // validate validates PatternFlowRSVPPathSenderTspecIntServServiceHeader + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServServiceHeader, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServServiceHeader + Choice() PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeader + setChoice(value PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum) PatternFlowRSVPPathSenderTspecIntServServiceHeader + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServServiceHeader + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServServiceHeader. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeader + SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeader + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServServiceHeader + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServServiceHeader. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeader + SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeader + // Increment returns PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, set in PatternFlowRSVPPathSenderTspecIntServServiceHeader. + // PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter is integer counter pattern + Increment() PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeader. + // PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) PatternFlowRSVPPathSenderTspecIntServServiceHeader + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServServiceHeader + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, set in PatternFlowRSVPPathSenderTspecIntServServiceHeader. + // PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeader. + // PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) PatternFlowRSVPPathSenderTspecIntServServiceHeader + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServServiceHeader + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServServiceHeader +var PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice = struct { + VALUE PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum + VALUES PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Choice() PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum { + return PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) setChoice(value PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum) PatternFlowRSVPPathSenderTspecIntServServiceHeader { + intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUE { + defaultValue := uint32(1) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUES { + defaultValue := []uint32{1} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter().msg() + } + + if value == PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServServiceHeader object +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeader { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{1}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServServiceHeader object +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeader { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Increment() PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter value in the PatternFlowRSVPPathSenderTspecIntServServiceHeader object +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) PatternFlowRSVPPathSenderTspecIntServServiceHeader { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) Decrement() PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter value in the PatternFlowRSVPPathSenderTspecIntServServiceHeader object +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) PatternFlowRSVPPathSenderTspecIntServServiceHeader { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServServiceHeader.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServServiceHeader.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeader) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServServiceHeaderChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServServiceHeader") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServServiceHeader_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_service_header_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_service_header_counter.go new file mode 100644 index 00000000..d07d7358 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_service_header_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter ***** +type patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + marshaller marshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter() PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { + obj := patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter +} + +type marshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) (PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) (PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) 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 *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter() + 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 +} + +// PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter is integer counter pattern +type PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + // validate validates PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServServiceHeaderCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServServiceHeaderCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_version.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_version.go new file mode 100644 index 00000000..abd78795 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_version.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServVersion ***** +type patternFlowRSVPPathSenderTspecIntServVersion struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServVersion + marshaller marshalPatternFlowRSVPPathSenderTspecIntServVersion + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServVersion + incrementHolder PatternFlowRSVPPathSenderTspecIntServVersionCounter + decrementHolder PatternFlowRSVPPathSenderTspecIntServVersionCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServVersion() PatternFlowRSVPPathSenderTspecIntServVersion { + obj := patternFlowRSVPPathSenderTspecIntServVersion{obj: &otg.PatternFlowRSVPPathSenderTspecIntServVersion{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) msg() *otg.PatternFlowRSVPPathSenderTspecIntServVersion { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServVersion) PatternFlowRSVPPathSenderTspecIntServVersion { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServVersion struct { + obj *patternFlowRSVPPathSenderTspecIntServVersion +} + +type marshalPatternFlowRSVPPathSenderTspecIntServVersion interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServVersion to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersion + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServVersion, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServVersion to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServVersion to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServVersion to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServVersion struct { + obj *patternFlowRSVPPathSenderTspecIntServVersion +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServVersion interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServVersion from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersion + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServVersion) (PatternFlowRSVPPathSenderTspecIntServVersion, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServVersion from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServVersion from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServVersion from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServVersion { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServVersion{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServVersion { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServVersion{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServVersion) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServVersion, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServVersion) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServVersion) (PatternFlowRSVPPathSenderTspecIntServVersion, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServVersion) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServVersion) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServVersion) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServVersion) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServVersion) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServVersion) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Clone() (PatternFlowRSVPPathSenderTspecIntServVersion, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServVersion() + 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 +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTspecIntServVersion is message format version number. +type PatternFlowRSVPPathSenderTspecIntServVersion interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServVersion to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersion + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServVersion + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServVersion from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersion + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServVersion) PatternFlowRSVPPathSenderTspecIntServVersion + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServVersion + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServVersion + // validate validates PatternFlowRSVPPathSenderTspecIntServVersion + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServVersion, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServVersion + Choice() PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServVersion + setChoice(value PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum) PatternFlowRSVPPathSenderTspecIntServVersion + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServVersion + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServVersion. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServVersion + SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServVersion + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServVersion + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServVersion. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServVersion + SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServVersion + // Increment returns PatternFlowRSVPPathSenderTspecIntServVersionCounter, set in PatternFlowRSVPPathSenderTspecIntServVersion. + // PatternFlowRSVPPathSenderTspecIntServVersionCounter is integer counter pattern + Increment() PatternFlowRSVPPathSenderTspecIntServVersionCounter + // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServVersionCounter provided by user to PatternFlowRSVPPathSenderTspecIntServVersion. + // PatternFlowRSVPPathSenderTspecIntServVersionCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTspecIntServVersionCounter) PatternFlowRSVPPathSenderTspecIntServVersion + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServVersion + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTspecIntServVersionCounter, set in PatternFlowRSVPPathSenderTspecIntServVersion. + // PatternFlowRSVPPathSenderTspecIntServVersionCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSenderTspecIntServVersionCounter + // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServVersionCounter provided by user to PatternFlowRSVPPathSenderTspecIntServVersion. + // PatternFlowRSVPPathSenderTspecIntServVersionCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTspecIntServVersionCounter) PatternFlowRSVPPathSenderTspecIntServVersion + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServVersion + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServVersion +var PatternFlowRSVPPathSenderTspecIntServVersionChoice = struct { + VALUE PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum + VALUES PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Choice() PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum { + return PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) setChoice(value PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum) PatternFlowRSVPPathSenderTspecIntServVersion { + intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServVersion_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServVersion_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServVersionChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServVersionCounter().msg() + } + + if value == PatternFlowRSVPPathSenderTspecIntServVersionChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServVersionCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServVersion object +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServVersion { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServVersion object +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServVersion { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServVersionCounter +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Increment() PatternFlowRSVPPathSenderTspecIntServVersionCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServVersionCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServVersionCounter +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServVersionCounter value in the PatternFlowRSVPPathSenderTspecIntServVersion object +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServVersionCounter) PatternFlowRSVPPathSenderTspecIntServVersion { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServVersionCounter +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) Decrement() PatternFlowRSVPPathSenderTspecIntServVersionCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServVersionCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServVersionCounter +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServVersionCounter value in the PatternFlowRSVPPathSenderTspecIntServVersion object +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServVersionCounter) PatternFlowRSVPPathSenderTspecIntServVersion { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServVersion.Value <= 15 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServVersion.Values <= 15 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersion) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTspecIntServVersionChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServVersionChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServVersionChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServVersionChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServVersion") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTspecIntServVersion_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServVersion_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_version_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_version_counter.go new file mode 100644 index 00000000..18f2ab46 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_version_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServVersionCounter ***** +type patternFlowRSVPPathSenderTspecIntServVersionCounter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter + marshaller marshalPatternFlowRSVPPathSenderTspecIntServVersionCounter + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServVersionCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServVersionCounter() PatternFlowRSVPPathSenderTspecIntServVersionCounter { + obj := patternFlowRSVPPathSenderTspecIntServVersionCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter) PatternFlowRSVPPathSenderTspecIntServVersionCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServVersionCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServVersionCounter +} + +type marshalPatternFlowRSVPPathSenderTspecIntServVersionCounter interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServVersionCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServVersionCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServVersionCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServVersionCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServVersionCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServVersionCounter +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServVersionCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServVersionCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter) (PatternFlowRSVPPathSenderTspecIntServVersionCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServVersionCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServVersionCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServVersionCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServVersionCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServVersionCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServVersionCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServVersionCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter) (PatternFlowRSVPPathSenderTspecIntServVersionCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServVersionCounter) 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 *patternFlowRSVPPathSenderTspecIntServVersionCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServVersionCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServVersionCounter() + 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 +} + +// PatternFlowRSVPPathSenderTspecIntServVersionCounter is integer counter pattern +type PatternFlowRSVPPathSenderTspecIntServVersionCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServVersionCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServVersionCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServVersionCounter) PatternFlowRSVPPathSenderTspecIntServVersionCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServVersionCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServVersionCounter + // validate validates PatternFlowRSVPPathSenderTspecIntServVersionCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServVersionCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServVersionCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServVersionCounter + SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServVersionCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServVersionCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServVersionCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServVersionCounter + SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServVersionCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServVersionCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServVersionCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServVersionCounter + SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServVersionCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServVersionCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServVersionCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServVersionCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServVersionCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServVersionCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServVersionCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServVersionCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServVersionCounter.Start <= 15 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServVersionCounter.Step <= 15 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServVersionCounter.Count <= 15 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServVersionCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_zero_bit.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_zero_bit.go new file mode 100644 index 00000000..c337d45c --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_zero_bit.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServZeroBit ***** +type patternFlowRSVPPathSenderTspecIntServZeroBit struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit + marshaller marshalPatternFlowRSVPPathSenderTspecIntServZeroBit + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBit + incrementHolder PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + decrementHolder PatternFlowRSVPPathSenderTspecIntServZeroBitCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServZeroBit() PatternFlowRSVPPathSenderTspecIntServZeroBit { + obj := patternFlowRSVPPathSenderTspecIntServZeroBit{obj: &otg.PatternFlowRSVPPathSenderTspecIntServZeroBit{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) msg() *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit) PatternFlowRSVPPathSenderTspecIntServZeroBit { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServZeroBit struct { + obj *patternFlowRSVPPathSenderTspecIntServZeroBit +} + +type marshalPatternFlowRSVPPathSenderTspecIntServZeroBit interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServZeroBit to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServZeroBit, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServZeroBit to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServZeroBit to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServZeroBit to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBit struct { + obj *patternFlowRSVPPathSenderTspecIntServZeroBit +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBit interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBit from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit) (PatternFlowRSVPPathSenderTspecIntServZeroBit, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBit from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBit from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBit from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServZeroBit { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServZeroBit{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBit { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBit{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServZeroBit) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServZeroBit, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBit) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit) (PatternFlowRSVPPathSenderTspecIntServZeroBit, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServZeroBit) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBit) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServZeroBit) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBit) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServZeroBit) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBit) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Clone() (PatternFlowRSVPPathSenderTspecIntServZeroBit, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServZeroBit() + 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 +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSenderTspecIntServZeroBit is mUST be 0. +type PatternFlowRSVPPathSenderTspecIntServZeroBit interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServZeroBit to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBit from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBit + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServZeroBit) PatternFlowRSVPPathSenderTspecIntServZeroBit + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServZeroBit + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBit + // validate validates PatternFlowRSVPPathSenderTspecIntServZeroBit + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServZeroBit, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum, set in PatternFlowRSVPPathSenderTspecIntServZeroBit + Choice() PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum + // setChoice assigns PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBit + setChoice(value PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum) PatternFlowRSVPPathSenderTspecIntServZeroBit + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSenderTspecIntServZeroBit + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSenderTspecIntServZeroBit. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBit + SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBit + // HasValue checks if Value has been set in PatternFlowRSVPPathSenderTspecIntServZeroBit + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSenderTspecIntServZeroBit. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBit + SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServZeroBit + // Increment returns PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, set in PatternFlowRSVPPathSenderTspecIntServZeroBit. + // PatternFlowRSVPPathSenderTspecIntServZeroBitCounter is integer counter pattern + Increment() PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + // SetIncrement assigns PatternFlowRSVPPathSenderTspecIntServZeroBitCounter provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBit. + // PatternFlowRSVPPathSenderTspecIntServZeroBitCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) PatternFlowRSVPPathSenderTspecIntServZeroBit + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSenderTspecIntServZeroBit + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, set in PatternFlowRSVPPathSenderTspecIntServZeroBit. + // PatternFlowRSVPPathSenderTspecIntServZeroBitCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + // SetDecrement assigns PatternFlowRSVPPathSenderTspecIntServZeroBitCounter provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBit. + // PatternFlowRSVPPathSenderTspecIntServZeroBitCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) PatternFlowRSVPPathSenderTspecIntServZeroBit + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSenderTspecIntServZeroBit + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSenderTspecIntServZeroBit +var PatternFlowRSVPPathSenderTspecIntServZeroBitChoice = struct { + VALUE PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum + VALUES PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum + INCREMENT PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum + DECREMENT PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Choice() PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum { + return PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) setChoice(value PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum) PatternFlowRSVPPathSenderTspecIntServZeroBit { + intValue, ok := otg.PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSenderTspecIntServZeroBitCounter().msg() + } + + if value == PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSenderTspecIntServZeroBitCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServZeroBit object +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) SetValue(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBit { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSenderTspecIntServZeroBit object +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) SetValues(value []uint32) PatternFlowRSVPPathSenderTspecIntServZeroBit { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServZeroBitCounter +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Increment() PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSenderTspecIntServZeroBitCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSenderTspecIntServZeroBitCounter +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSenderTspecIntServZeroBitCounter value in the PatternFlowRSVPPathSenderTspecIntServZeroBit object +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) SetIncrement(value PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) PatternFlowRSVPPathSenderTspecIntServZeroBit { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServZeroBitCounter +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) Decrement() PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSenderTspecIntServZeroBitCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSenderTspecIntServZeroBitCounter +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSenderTspecIntServZeroBitCounter value in the PatternFlowRSVPPathSenderTspecIntServZeroBit object +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) SetDecrement(value PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) PatternFlowRSVPPathSenderTspecIntServZeroBit { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServZeroBit.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSenderTspecIntServZeroBit.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBit) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSenderTspecIntServZeroBitChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSenderTspecIntServZeroBitChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSenderTspecIntServZeroBit") + } + } else { + intVal := otg.PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSenderTspecIntServZeroBit_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_zero_bit_counter.go b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_zero_bit_counter.go new file mode 100644 index 00000000..0ba53d28 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_sender_tspec_int_serv_zero_bit_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathSenderTspecIntServZeroBitCounter ***** +type patternFlowRSVPPathSenderTspecIntServZeroBitCounter struct { + validation + obj *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + marshaller marshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter + unMarshaller unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter +} + +func NewPatternFlowRSVPPathSenderTspecIntServZeroBitCounter() PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { + obj := patternFlowRSVPPathSenderTspecIntServZeroBitCounter{obj: &otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) msg() *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) setMsg(msg *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter +} + +type marshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter interface { + // ToProto marshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, error) + // ToPbText marshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter struct { + obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter +} + +type unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) (PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) Marshal() marshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) ToProto() (*otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) FromProto(msg *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) (PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) 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 *marshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) 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 *unMarshalpatternFlowRSVPPathSenderTspecIntServZeroBitCounter) 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 *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) Clone() (PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSenderTspecIntServZeroBitCounter() + 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 +} + +// PatternFlowRSVPPathSenderTspecIntServZeroBitCounter is integer counter pattern +type PatternFlowRSVPPathSenderTspecIntServZeroBitCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter to protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + // setMsg unmarshals PatternFlowRSVPPathSenderTspecIntServZeroBitCounter from protobuf object *otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSenderTspecIntServZeroBitCounter) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSenderTspecIntServZeroBitCounter + // validate validates PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSenderTspecIntServZeroBitCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSenderTspecIntServZeroBitCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSenderTspecIntServZeroBitCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSenderTspecIntServZeroBitCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSenderTspecIntServZeroBitCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServZeroBitCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) SetStart(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServZeroBitCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) SetStep(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSenderTspecIntServZeroBitCounter object +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) SetCount(value uint32) PatternFlowRSVPPathSenderTspecIntServZeroBitCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServZeroBitCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServZeroBitCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSenderTspecIntServZeroBitCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathSenderTspecIntServZeroBitCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_integer.go b/gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_integer.go new file mode 100644 index 00000000..b8688755 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_integer.go @@ -0,0 +1,535 @@ +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" +) + +// ***** PatternFlowRSVPPathSessionExtTunnelIdAsInteger ***** +type patternFlowRSVPPathSessionExtTunnelIdAsInteger struct { + validation + obj *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger + marshaller marshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger + unMarshaller unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger + incrementHolder PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + decrementHolder PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter +} + +func NewPatternFlowRSVPPathSessionExtTunnelIdAsInteger() PatternFlowRSVPPathSessionExtTunnelIdAsInteger { + obj := patternFlowRSVPPathSessionExtTunnelIdAsInteger{obj: &otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger { + return obj.obj +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) setMsg(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger) PatternFlowRSVPPathSessionExtTunnelIdAsInteger { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger struct { + obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger +} + +type marshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger interface { + // ToProto marshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger + ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger, error) + // ToPbText marshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger struct { + obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger +} + +type unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger interface { + // FromProto unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger + FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger) (PatternFlowRSVPPathSessionExtTunnelIdAsInteger, error) + // FromPbText unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger) (PatternFlowRSVPPathSessionExtTunnelIdAsInteger, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsInteger) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsInteger, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSessionExtTunnelIdAsInteger() + 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 +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSessionExtTunnelIdAsInteger is tBD +type PatternFlowRSVPPathSessionExtTunnelIdAsInteger interface { + Validation + // msg marshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger + // setMsg unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsInteger from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger) PatternFlowRSVPPathSessionExtTunnelIdAsInteger + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsInteger + // validate validates PatternFlowRSVPPathSessionExtTunnelIdAsInteger + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsInteger, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum, set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger + Choice() PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum + // setChoice assigns PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsInteger + setChoice(value PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum) PatternFlowRSVPPathSessionExtTunnelIdAsInteger + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsInteger + SetValue(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsInteger + // HasValue checks if Value has been set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsInteger + SetValues(value []uint32) PatternFlowRSVPPathSessionExtTunnelIdAsInteger + // Increment returns PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger. + // PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter is integer counter pattern + Increment() PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + // SetIncrement assigns PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsInteger. + // PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) PatternFlowRSVPPathSessionExtTunnelIdAsInteger + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger. + // PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + // SetDecrement assigns PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsInteger. + // PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) PatternFlowRSVPPathSessionExtTunnelIdAsInteger + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSessionExtTunnelIdAsInteger + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSessionExtTunnelIdAsInteger +var PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice = struct { + VALUE PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum + VALUES PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum + INCREMENT PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum + DECREMENT PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Choice() PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum { + return PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) setChoice(value PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum) PatternFlowRSVPPathSessionExtTunnelIdAsInteger { + intValue, ok := otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter().msg() + } + + if value == PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSessionExtTunnelIdAsInteger object +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) SetValue(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsInteger { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSessionExtTunnelIdAsInteger object +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) SetValues(value []uint32) PatternFlowRSVPPathSessionExtTunnelIdAsInteger { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Increment() PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter value in the PatternFlowRSVPPathSessionExtTunnelIdAsInteger object +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) SetIncrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) PatternFlowRSVPPathSessionExtTunnelIdAsInteger { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) Decrement() PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter value in the PatternFlowRSVPPathSessionExtTunnelIdAsInteger object +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) SetDecrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) PatternFlowRSVPPathSessionExtTunnelIdAsInteger { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsInteger) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIntegerChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSessionExtTunnelIdAsInteger") + } + } else { + intVal := otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSessionExtTunnelIdAsInteger_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_integer_counter.go b/gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_integer_counter.go new file mode 100644 index 00000000..73cbb8fc --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_integer_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter ***** +type patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter struct { + validation + obj *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + marshaller marshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + unMarshaller unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter +} + +func NewPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter() PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { + obj := patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter{obj: &otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) setMsg(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter struct { + obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter +} + +type marshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter interface { + // ToProto marshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, error) + // ToPbText marshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter struct { + obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter +} + +type unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) (PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) (PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) 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 *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) 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 *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) 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 *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter() + 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 +} + +// PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter is integer counter pattern +type PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + // setMsg unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + // validate validates PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + SetStart(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + SetStep(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + SetCount(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter object +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) SetStart(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter object +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) SetStep(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter object +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) SetCount(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIntegerCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_ipv4.go b/gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_ipv4.go new file mode 100644 index 00000000..8e6bb95d --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_ipv4.go @@ -0,0 +1,553 @@ +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" +) + +// ***** PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 ***** +type patternFlowRSVPPathSessionExtTunnelIdAsIpv4 struct { + validation + obj *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + marshaller marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + unMarshaller unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + incrementHolder PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + decrementHolder PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter +} + +func NewPatternFlowRSVPPathSessionExtTunnelIdAsIpv4() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { + obj := patternFlowRSVPPathSessionExtTunnelIdAsIpv4{obj: &otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { + return obj.obj +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) setMsg(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4 struct { + obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4 +} + +type marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 interface { + // ToProto marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4, error) + // ToPbText marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4 struct { + obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4 +} + +type unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 interface { + // FromProto unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4, error) + // FromPbText unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSessionExtTunnelIdAsIpv4() + 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 +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 is iPv4 address of the ingress endpoint for the tunnel. +type PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 interface { + Validation + // msg marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + // setMsg unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + // validate validates PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + Choice() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum + // setChoice assigns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + setChoice(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + HasChoice() bool + // Value returns string, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4. + Value() string + // SetValue assigns string provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + SetValue(value string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + // HasValue checks if Value has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + HasValue() bool + // Values returns []string, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4. + Values() []string + // SetValues assigns []string provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + SetValues(value []string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + // Increment returns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4. + // PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter is ipv4 counter pattern + Increment() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + // SetIncrement assigns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4. + // PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter is ipv4 counter pattern + SetIncrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4. + // PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter is ipv4 counter pattern + Decrement() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + // SetDecrement assigns PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4. + // PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter is ipv4 counter pattern + SetDecrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 +var PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice = struct { + VALUE PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum + VALUES PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum + INCREMENT PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum + DECREMENT PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Choice() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum { + return PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) setChoice(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { + intValue, ok := otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUE { + defaultValue := "0.0.0.0" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUES { + defaultValue := []string{"0.0.0.0"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter().msg() + } + + if value == PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 object +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) SetValue(value string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"0.0.0.0"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 object +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) SetValues(value []string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Increment() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter value in the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 object +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) SetIncrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) Decrement() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter value in the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 object +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) SetDecrement(value PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4 { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv4(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateIpv4Slice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionExtTunnelIdAsIpv4.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSessionExtTunnelIdAsIpv4ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4") + } + } else { + intVal := otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_ipv4_counter.go b/gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_ipv4_counter.go new file mode 100644 index 00000000..064e6a5e --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_session_ext_tunnel_id_as_ipv4_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter ***** +type patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter struct { + validation + obj *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + marshaller marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + unMarshaller unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter +} + +func NewPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter() PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { + obj := patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter{obj: &otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) setMsg(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter struct { + obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter +} + +type marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter interface { + // ToProto marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, error) + // ToPbText marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter struct { + obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter +} + +type unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter interface { + // FromProto unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, error) + // FromPbText unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) ToProto() (*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) FromProto(msg *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) 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 *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) 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 *marshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) 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 *unMarshalpatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) 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 *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter() + 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 +} + +// PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter is ipv4 counter pattern +type PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter interface { + Validation + // msg marshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter to protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + // setMsg unmarshals PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter from protobuf object *otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + // validate validates PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter. + Start() string + // SetStart assigns string provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + SetStart(value string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + // HasStart checks if Start has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + HasStart() bool + // Step returns string, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter. + Step() string + // SetStep assigns string provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + SetStep(value string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + // HasStep checks if Step has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + SetCount(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + // HasCount checks if Count has been set in PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter object +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) SetStart(value string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter object +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) SetStep(value string) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter object +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) SetCount(value uint32) PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateIpv4(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateIpv4(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter.Step")) + } + + } + +} + +func (obj *patternFlowRSVPPathSessionExtTunnelIdAsIpv4Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("0.0.0.0") + } + if obj.obj.Step == nil { + obj.SetStep("0.0.0.1") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_ipv4_tunnel_end_point_address.go b/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_ipv4_tunnel_end_point_address.go new file mode 100644 index 00000000..61ac961a --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_ipv4_tunnel_end_point_address.go @@ -0,0 +1,553 @@ +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" +) + +// ***** PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress ***** +type patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress struct { + validation + obj *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + marshaller marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + unMarshaller unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + incrementHolder PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + decrementHolder PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter +} + +func NewPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { + obj := patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress{obj: &otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { + return obj.obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) setMsg(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress struct { + obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress +} + +type marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress interface { + // ToProto marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress, error) + // ToPbText marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress struct { + obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress +} + +type unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress interface { + // FromProto unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress, error) + // FromPbText unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress() + 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 +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress is iPv4 address of the egress node for the tunnel. +type PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress interface { + Validation + // msg marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + // setMsg unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + // validate validates PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + Choice() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum + // setChoice assigns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + setChoice(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + HasChoice() bool + // Value returns string, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress. + Value() string + // SetValue assigns string provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + SetValue(value string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + // HasValue checks if Value has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + HasValue() bool + // Values returns []string, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress. + Values() []string + // SetValues assigns []string provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + SetValues(value []string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + // Increment returns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress. + // PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter is ipv4 counter pattern + Increment() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + // SetIncrement assigns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress. + // PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter is ipv4 counter pattern + SetIncrement(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress. + // PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter is ipv4 counter pattern + Decrement() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + // SetDecrement assigns PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress. + // PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter is ipv4 counter pattern + SetDecrement(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress +var PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice = struct { + VALUE PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum + VALUES PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum + INCREMENT PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum + DECREMENT PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Choice() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum { + return PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) setChoice(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { + intValue, ok := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUE { + defaultValue := "0.0.0.0" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUES { + defaultValue := []string{"0.0.0.0"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter().msg() + } + + if value == PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) SetValue(value string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"0.0.0.0"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) SetValues(value []string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Increment() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter value in the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) SetIncrement(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) Decrement() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter value in the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) SetDecrement(value PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv4(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateIpv4Slice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress") + } + } else { + intVal := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddress_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_ipv4_tunnel_end_point_address_counter.go b/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_ipv4_tunnel_end_point_address_counter.go new file mode 100644 index 00000000..842df7fc --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_ipv4_tunnel_end_point_address_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter ***** +type patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter struct { + validation + obj *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + marshaller marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + unMarshaller unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter +} + +func NewPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter() PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { + obj := patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter{obj: &otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) setMsg(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter struct { + obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter +} + +type marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter interface { + // ToProto marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, error) + // ToPbText marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter struct { + obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter +} + +type unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) 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 *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) 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 *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) 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 *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter() + 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 +} + +// PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter is ipv4 counter pattern +type PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + // setMsg unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + // validate validates PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + SetStart(value string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + HasStart() bool + // Step returns string, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + SetStep(value string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + SetCount(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) SetStart(value string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) SetStep(value string) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) SetCount(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateIpv4(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateIpv4(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter.Step")) + } + + } + +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Ipv4TunnelEndPointAddressCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("0.0.0.0") + } + if obj.obj.Step == nil { + obj.SetStep("0.0.0.1") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_reserved.go b/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_reserved.go new file mode 100644 index 00000000..ee87d1c6 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_reserved.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathSessionLspTunnelIpv4Reserved ***** +type patternFlowRSVPPathSessionLspTunnelIpv4Reserved struct { + validation + obj *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + marshaller marshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved + unMarshaller unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved + incrementHolder PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + decrementHolder PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter +} + +func NewPatternFlowRSVPPathSessionLspTunnelIpv4Reserved() PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { + obj := patternFlowRSVPPathSessionLspTunnelIpv4Reserved{obj: &otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { + return obj.obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) setMsg(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved struct { + obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved +} + +type marshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved interface { + // ToProto marshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved, error) + // ToPbText marshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved struct { + obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved +} + +type unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved interface { + // FromProto unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) (PatternFlowRSVPPathSessionLspTunnelIpv4Reserved, error) + // FromPbText unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) (PatternFlowRSVPPathSessionLspTunnelIpv4Reserved, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4Reserved) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4Reserved, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSessionLspTunnelIpv4Reserved() + 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 +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSessionLspTunnelIpv4Reserved is reserved field, MUST be zero. +type PatternFlowRSVPPathSessionLspTunnelIpv4Reserved interface { + Validation + // msg marshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + // setMsg unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4Reserved from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4Reserved + // validate validates PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4Reserved, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum, set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + Choice() PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum + // setChoice assigns PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + setChoice(value PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + SetValue(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + // HasValue checks if Value has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + SetValues(value []uint32) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + // Increment returns PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved. + // PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter is integer counter pattern + Increment() PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + // SetIncrement assigns PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Reserved. + // PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved. + // PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + // SetDecrement assigns PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4Reserved. + // PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSessionLspTunnelIpv4Reserved +var PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice = struct { + VALUE PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum + VALUES PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum + INCREMENT PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum + DECREMENT PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Choice() PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum { + return PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) setChoice(value PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { + intValue, ok := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter().msg() + } + + if value == PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4Reserved object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) SetValue(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4Reserved object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) SetValues(value []uint32) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Increment() PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter value in the PatternFlowRSVPPathSessionLspTunnelIpv4Reserved object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) SetIncrement(value PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) Decrement() PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter value in the PatternFlowRSVPPathSessionLspTunnelIpv4Reserved object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) SetDecrement(value PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSessionLspTunnelIpv4Reserved { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSessionLspTunnelIpv4Reserved.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4Reserved) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4ReservedChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSessionLspTunnelIpv4Reserved") + } + } else { + intVal := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSessionLspTunnelIpv4Reserved_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_reserved_counter.go b/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_reserved_counter.go new file mode 100644 index 00000000..f0846502 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_reserved_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter ***** +type patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter struct { + validation + obj *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + marshaller marshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + unMarshaller unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter +} + +func NewPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter() PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { + obj := patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter{obj: &otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) setMsg(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter struct { + obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter +} + +type marshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter interface { + // ToProto marshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, error) + // ToPbText marshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter struct { + obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter +} + +type unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) (PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) (PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) 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 *marshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) 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 *marshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) 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 *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter() + 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 +} + +// PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter is integer counter pattern +type PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + // setMsg unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + // validate validates PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + SetStart(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + SetStep(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + SetCount(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) SetStart(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) SetStep(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) SetCount(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4ReservedCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_tunnel_id.go b/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_tunnel_id.go new file mode 100644 index 00000000..b79a16d5 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_tunnel_id.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId ***** +type patternFlowRSVPPathSessionLspTunnelIpv4TunnelId struct { + validation + obj *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + marshaller marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + unMarshaller unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + incrementHolder PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + decrementHolder PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter +} + +func NewPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { + obj := patternFlowRSVPPathSessionLspTunnelIpv4TunnelId{obj: &otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { + return obj.obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) setMsg(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId struct { + obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId +} + +type marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId interface { + // ToProto marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId, error) + // ToPbText marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId struct { + obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId +} + +type unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId interface { + // FromProto unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId, error) + // FromPbText unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId() + 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 +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId is a 16-bit identifier used in the SESSION that remains constant over the life of the tunnel. +type PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId interface { + Validation + // msg marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + // setMsg unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + // validate validates PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + Choice() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum + // setChoice assigns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + setChoice(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + // HasChoice checks if Choice has been set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + SetValue(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + // HasValue checks if Value has been set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + SetValues(value []uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + // Increment returns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId. + // PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter is integer counter pattern + Increment() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + // SetIncrement assigns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId. + // PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId. + // PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter is integer counter pattern + Decrement() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + // SetDecrement assigns PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId. + // PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId +var PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice = struct { + VALUE PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum + VALUES PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum + INCREMENT PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum + DECREMENT PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum +}{ + VALUE: PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum("value"), + VALUES: PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Choice() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum { + return PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) setChoice(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { + intValue, ok := otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUE { + defaultValue := uint32(1) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUES { + defaultValue := []uint32{1} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter().msg() + } + + if value == PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) SetValue(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{1}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) SetValues(value []uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Increment() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter value in the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) SetIncrement(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) Decrement() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter value in the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) SetDecrement(value PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelId) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId") + } + } else { + intVal := otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelId_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_tunnel_id_counter.go b/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_tunnel_id_counter.go new file mode 100644 index 00000000..fe53686d --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_session_lsp_tunnel_ipv4_tunnel_id_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter ***** +type patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter struct { + validation + obj *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + marshaller marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + unMarshaller unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter +} + +func NewPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter() PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { + obj := patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter{obj: &otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) setMsg(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter struct { + obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter +} + +type marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter interface { + // ToProto marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, error) + // ToPbText marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter struct { + obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter +} + +type unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter interface { + // FromProto unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) ToProto() (*otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) FromProto(msg *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) 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 *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) 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 *marshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) 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 *unMarshalpatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) 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 *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter() + 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 +} + +// PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter is integer counter pattern +type PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter interface { + Validation + // msg marshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter to protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + // setMsg unmarshals PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter from protobuf object *otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + // validate validates PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + SetStart(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + SetStep(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + SetCount(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) SetStart(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) SetStep(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter object +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) SetCount(value uint32) PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRSVPPathSessionLspTunnelIpv4TunnelIdCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_time_values_type1_refresh_period_r.go b/gosnappi/pattern_flow_rsvp_path_time_values_type1_refresh_period_r.go new file mode 100644 index 00000000..b715d25f --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_time_values_type1_refresh_period_r.go @@ -0,0 +1,535 @@ +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" +) + +// ***** PatternFlowRSVPPathTimeValuesType1RefreshPeriodR ***** +type patternFlowRSVPPathTimeValuesType1RefreshPeriodR struct { + validation + obj *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + marshaller marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR + unMarshaller unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR + incrementHolder PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + decrementHolder PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter +} + +func NewPatternFlowRSVPPathTimeValuesType1RefreshPeriodR() PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { + obj := patternFlowRSVPPathTimeValuesType1RefreshPeriodR{obj: &otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) msg() *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { + return obj.obj +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) setMsg(msg *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR struct { + obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR +} + +type marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR interface { + // ToProto marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR to protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + ToProto() (*otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR, error) + // ToPbText marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR struct { + obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR +} + +type unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR interface { + // FromProto unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR from protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + FromProto(msg *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) (PatternFlowRSVPPathTimeValuesType1RefreshPeriodR, error) + // FromPbText unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Marshal() marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Unmarshal() unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) ToProto() (*otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) FromProto(msg *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) (PatternFlowRSVPPathTimeValuesType1RefreshPeriodR, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) 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 *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) 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 *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) 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 *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodR) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Clone() (PatternFlowRSVPPathTimeValuesType1RefreshPeriodR, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathTimeValuesType1RefreshPeriodR() + 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 +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRSVPPathTimeValuesType1RefreshPeriodR is the refresh timeout period R used to generate this message;in milliseconds. +type PatternFlowRSVPPathTimeValuesType1RefreshPeriodR interface { + Validation + // msg marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR to protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + // setMsg unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodR from protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodR + // validate validates PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathTimeValuesType1RefreshPeriodR, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + Choice() PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum + // setChoice assigns PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + setChoice(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + // HasChoice checks if Choice has been set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + HasChoice() bool + // Value returns uint32, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + SetValue(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + // HasValue checks if Value has been set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + HasValue() bool + // Values returns []uint32, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + SetValues(value []uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + // Increment returns PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR. + // PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter is integer counter pattern + Increment() PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + // SetIncrement assigns PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodR. + // PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter is integer counter pattern + SetIncrement(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + // HasIncrement checks if Increment has been set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + HasIncrement() bool + // Decrement returns PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR. + // PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter is integer counter pattern + Decrement() PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + // SetDecrement assigns PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodR. + // PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter is integer counter pattern + SetDecrement(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + // HasDecrement checks if Decrement has been set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR + HasDecrement() bool + setNil() +} + +type PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum string + +// Enum of Choice on PatternFlowRSVPPathTimeValuesType1RefreshPeriodR +var PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice = struct { + VALUE PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum + VALUES PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum + INCREMENT PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum + DECREMENT PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum +}{ + VALUE: PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum("value"), + VALUES: PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum("values"), + INCREMENT: PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum("increment"), + DECREMENT: PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum("decrement"), +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Choice() PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum { + return PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) setChoice(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { + intValue, ok := otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUE { + defaultValue := uint32(30000) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUES { + defaultValue := []uint32{30000} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter().msg() + } + + if value == PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRSVPPathTimeValuesType1RefreshPeriodR object +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) SetValue(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { + obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{30000}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRSVPPathTimeValuesType1RefreshPeriodR object +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) SetValues(value []uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { + obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Increment() PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter value in the PatternFlowRSVPPathTimeValuesType1RefreshPeriodR object +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) SetIncrement(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { + obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) Decrement() PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter value in the PatternFlowRSVPPathTimeValuesType1RefreshPeriodR object +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) SetDecrement(value PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) PatternFlowRSVPPathTimeValuesType1RefreshPeriodR { + obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodR) setDefault() { + var choices_set int = 0 + var choice PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRSVPPathTimeValuesType1RefreshPeriodRChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRSVPPathTimeValuesType1RefreshPeriodR") + } + } else { + intVal := otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodR_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_path_time_values_type1_refresh_period_r_counter.go b/gosnappi/pattern_flow_rsvp_path_time_values_type1_refresh_period_r_counter.go new file mode 100644 index 00000000..83b363e5 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_path_time_values_type1_refresh_period_r_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter ***** +type patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter struct { + validation + obj *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + marshaller marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + unMarshaller unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter +} + +func NewPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter() PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { + obj := patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter{obj: &otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) msg() *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { + return obj.obj +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) setMsg(msg *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter struct { + obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter +} + +type marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter interface { + // ToProto marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter to protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + ToProto() (*otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, error) + // ToPbText marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter struct { + obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter +} + +type unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter interface { + // FromProto unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter from protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + FromProto(msg *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) (PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, error) + // FromPbText unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) Marshal() marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) Unmarshal() unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) ToProto() (*otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) FromProto(msg *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) (PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) 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 *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) 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 *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) 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 *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) 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 *marshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) 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 *unMarshalpatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) 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 *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) Clone() (PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter() + 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 +} + +// PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter is integer counter pattern +type PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter interface { + Validation + // msg marshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter to protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + // and doesn't set defaults + msg() *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + // setMsg unmarshals PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter from protobuf object *otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + // provides marshal interface + Marshal() marshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + // validate validates PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + SetStart(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + // HasStart checks if Start has been set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + SetStep(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + // HasStep checks if Step has been set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + SetCount(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + // HasCount checks if Count has been set in PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter object +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) SetStart(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter object +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) SetStep(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter object +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) SetCount(value uint32) PatternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowRSVPPathTimeValuesType1RefreshPeriodRCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(30000) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_reserved.go b/gosnappi/pattern_flow_rsvp_reserved.go new file mode 100644 index 00000000..a7fa6f74 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_reserved.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRsvpReserved ***** +type patternFlowRsvpReserved struct { + validation + obj *otg.PatternFlowRsvpReserved + marshaller marshalPatternFlowRsvpReserved + unMarshaller unMarshalPatternFlowRsvpReserved + incrementHolder PatternFlowRsvpReservedCounter + decrementHolder PatternFlowRsvpReservedCounter +} + +func NewPatternFlowRsvpReserved() PatternFlowRsvpReserved { + obj := patternFlowRsvpReserved{obj: &otg.PatternFlowRsvpReserved{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRsvpReserved) msg() *otg.PatternFlowRsvpReserved { + return obj.obj +} + +func (obj *patternFlowRsvpReserved) setMsg(msg *otg.PatternFlowRsvpReserved) PatternFlowRsvpReserved { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRsvpReserved struct { + obj *patternFlowRsvpReserved +} + +type marshalPatternFlowRsvpReserved interface { + // ToProto marshals PatternFlowRsvpReserved to protobuf object *otg.PatternFlowRsvpReserved + ToProto() (*otg.PatternFlowRsvpReserved, error) + // ToPbText marshals PatternFlowRsvpReserved to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRsvpReserved to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRsvpReserved to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRsvpReserved struct { + obj *patternFlowRsvpReserved +} + +type unMarshalPatternFlowRsvpReserved interface { + // FromProto unmarshals PatternFlowRsvpReserved from protobuf object *otg.PatternFlowRsvpReserved + FromProto(msg *otg.PatternFlowRsvpReserved) (PatternFlowRsvpReserved, error) + // FromPbText unmarshals PatternFlowRsvpReserved from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRsvpReserved from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRsvpReserved from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRsvpReserved) Marshal() marshalPatternFlowRsvpReserved { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRsvpReserved{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRsvpReserved) Unmarshal() unMarshalPatternFlowRsvpReserved { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRsvpReserved{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRsvpReserved) ToProto() (*otg.PatternFlowRsvpReserved, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRsvpReserved) FromProto(msg *otg.PatternFlowRsvpReserved) (PatternFlowRsvpReserved, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRsvpReserved) 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 *unMarshalpatternFlowRsvpReserved) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRsvpReserved) 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 *unMarshalpatternFlowRsvpReserved) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRsvpReserved) 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 *unMarshalpatternFlowRsvpReserved) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRsvpReserved) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRsvpReserved) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRsvpReserved) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRsvpReserved) Clone() (PatternFlowRsvpReserved, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRsvpReserved() + 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 +} + +func (obj *patternFlowRsvpReserved) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRsvpReserved is reserved +type PatternFlowRsvpReserved interface { + Validation + // msg marshals PatternFlowRsvpReserved to protobuf object *otg.PatternFlowRsvpReserved + // and doesn't set defaults + msg() *otg.PatternFlowRsvpReserved + // setMsg unmarshals PatternFlowRsvpReserved from protobuf object *otg.PatternFlowRsvpReserved + // and doesn't set defaults + setMsg(*otg.PatternFlowRsvpReserved) PatternFlowRsvpReserved + // provides marshal interface + Marshal() marshalPatternFlowRsvpReserved + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRsvpReserved + // validate validates PatternFlowRsvpReserved + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRsvpReserved, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRsvpReservedChoiceEnum, set in PatternFlowRsvpReserved + Choice() PatternFlowRsvpReservedChoiceEnum + // setChoice assigns PatternFlowRsvpReservedChoiceEnum provided by user to PatternFlowRsvpReserved + setChoice(value PatternFlowRsvpReservedChoiceEnum) PatternFlowRsvpReserved + // HasChoice checks if Choice has been set in PatternFlowRsvpReserved + HasChoice() bool + // Value returns uint32, set in PatternFlowRsvpReserved. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRsvpReserved + SetValue(value uint32) PatternFlowRsvpReserved + // HasValue checks if Value has been set in PatternFlowRsvpReserved + HasValue() bool + // Values returns []uint32, set in PatternFlowRsvpReserved. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRsvpReserved + SetValues(value []uint32) PatternFlowRsvpReserved + // Increment returns PatternFlowRsvpReservedCounter, set in PatternFlowRsvpReserved. + // PatternFlowRsvpReservedCounter is integer counter pattern + Increment() PatternFlowRsvpReservedCounter + // SetIncrement assigns PatternFlowRsvpReservedCounter provided by user to PatternFlowRsvpReserved. + // PatternFlowRsvpReservedCounter is integer counter pattern + SetIncrement(value PatternFlowRsvpReservedCounter) PatternFlowRsvpReserved + // HasIncrement checks if Increment has been set in PatternFlowRsvpReserved + HasIncrement() bool + // Decrement returns PatternFlowRsvpReservedCounter, set in PatternFlowRsvpReserved. + // PatternFlowRsvpReservedCounter is integer counter pattern + Decrement() PatternFlowRsvpReservedCounter + // SetDecrement assigns PatternFlowRsvpReservedCounter provided by user to PatternFlowRsvpReserved. + // PatternFlowRsvpReservedCounter is integer counter pattern + SetDecrement(value PatternFlowRsvpReservedCounter) PatternFlowRsvpReserved + // HasDecrement checks if Decrement has been set in PatternFlowRsvpReserved + HasDecrement() bool + setNil() +} + +type PatternFlowRsvpReservedChoiceEnum string + +// Enum of Choice on PatternFlowRsvpReserved +var PatternFlowRsvpReservedChoice = struct { + VALUE PatternFlowRsvpReservedChoiceEnum + VALUES PatternFlowRsvpReservedChoiceEnum + INCREMENT PatternFlowRsvpReservedChoiceEnum + DECREMENT PatternFlowRsvpReservedChoiceEnum +}{ + VALUE: PatternFlowRsvpReservedChoiceEnum("value"), + VALUES: PatternFlowRsvpReservedChoiceEnum("values"), + INCREMENT: PatternFlowRsvpReservedChoiceEnum("increment"), + DECREMENT: PatternFlowRsvpReservedChoiceEnum("decrement"), +} + +func (obj *patternFlowRsvpReserved) Choice() PatternFlowRsvpReservedChoiceEnum { + return PatternFlowRsvpReservedChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRsvpReserved) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRsvpReserved) setChoice(value PatternFlowRsvpReservedChoiceEnum) PatternFlowRsvpReserved { + intValue, ok := otg.PatternFlowRsvpReserved_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRsvpReservedChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRsvpReserved_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRsvpReservedChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRsvpReservedChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRsvpReservedChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRsvpReservedCounter().msg() + } + + if value == PatternFlowRsvpReservedChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRsvpReservedCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRsvpReserved) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRsvpReservedChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRsvpReserved) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRsvpReserved object +func (obj *patternFlowRsvpReserved) SetValue(value uint32) PatternFlowRsvpReserved { + obj.setChoice(PatternFlowRsvpReservedChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRsvpReserved) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRsvpReserved object +func (obj *patternFlowRsvpReserved) SetValues(value []uint32) PatternFlowRsvpReserved { + obj.setChoice(PatternFlowRsvpReservedChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRsvpReservedCounter +func (obj *patternFlowRsvpReserved) Increment() PatternFlowRsvpReservedCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRsvpReservedChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRsvpReservedCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRsvpReservedCounter +func (obj *patternFlowRsvpReserved) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRsvpReservedCounter value in the PatternFlowRsvpReserved object +func (obj *patternFlowRsvpReserved) SetIncrement(value PatternFlowRsvpReservedCounter) PatternFlowRsvpReserved { + obj.setChoice(PatternFlowRsvpReservedChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRsvpReservedCounter +func (obj *patternFlowRsvpReserved) Decrement() PatternFlowRsvpReservedCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRsvpReservedChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRsvpReservedCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRsvpReservedCounter +func (obj *patternFlowRsvpReserved) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRsvpReservedCounter value in the PatternFlowRsvpReserved object +func (obj *patternFlowRsvpReserved) SetDecrement(value PatternFlowRsvpReservedCounter) PatternFlowRsvpReserved { + obj.setChoice(PatternFlowRsvpReservedChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRsvpReserved) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRsvpReserved.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRsvpReserved.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRsvpReserved) setDefault() { + var choices_set int = 0 + var choice PatternFlowRsvpReservedChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRsvpReservedChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRsvpReservedChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRsvpReservedChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRsvpReservedChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRsvpReservedChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRsvpReserved") + } + } else { + intVal := otg.PatternFlowRsvpReserved_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRsvpReserved_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_reserved_counter.go b/gosnappi/pattern_flow_rsvp_reserved_counter.go new file mode 100644 index 00000000..739b4de8 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_reserved_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRsvpReservedCounter ***** +type patternFlowRsvpReservedCounter struct { + validation + obj *otg.PatternFlowRsvpReservedCounter + marshaller marshalPatternFlowRsvpReservedCounter + unMarshaller unMarshalPatternFlowRsvpReservedCounter +} + +func NewPatternFlowRsvpReservedCounter() PatternFlowRsvpReservedCounter { + obj := patternFlowRsvpReservedCounter{obj: &otg.PatternFlowRsvpReservedCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRsvpReservedCounter) msg() *otg.PatternFlowRsvpReservedCounter { + return obj.obj +} + +func (obj *patternFlowRsvpReservedCounter) setMsg(msg *otg.PatternFlowRsvpReservedCounter) PatternFlowRsvpReservedCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRsvpReservedCounter struct { + obj *patternFlowRsvpReservedCounter +} + +type marshalPatternFlowRsvpReservedCounter interface { + // ToProto marshals PatternFlowRsvpReservedCounter to protobuf object *otg.PatternFlowRsvpReservedCounter + ToProto() (*otg.PatternFlowRsvpReservedCounter, error) + // ToPbText marshals PatternFlowRsvpReservedCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRsvpReservedCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRsvpReservedCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRsvpReservedCounter struct { + obj *patternFlowRsvpReservedCounter +} + +type unMarshalPatternFlowRsvpReservedCounter interface { + // FromProto unmarshals PatternFlowRsvpReservedCounter from protobuf object *otg.PatternFlowRsvpReservedCounter + FromProto(msg *otg.PatternFlowRsvpReservedCounter) (PatternFlowRsvpReservedCounter, error) + // FromPbText unmarshals PatternFlowRsvpReservedCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRsvpReservedCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRsvpReservedCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRsvpReservedCounter) Marshal() marshalPatternFlowRsvpReservedCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRsvpReservedCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRsvpReservedCounter) Unmarshal() unMarshalPatternFlowRsvpReservedCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRsvpReservedCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRsvpReservedCounter) ToProto() (*otg.PatternFlowRsvpReservedCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRsvpReservedCounter) FromProto(msg *otg.PatternFlowRsvpReservedCounter) (PatternFlowRsvpReservedCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRsvpReservedCounter) 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 *unMarshalpatternFlowRsvpReservedCounter) 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 *marshalpatternFlowRsvpReservedCounter) 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 *unMarshalpatternFlowRsvpReservedCounter) 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 *marshalpatternFlowRsvpReservedCounter) 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 *unMarshalpatternFlowRsvpReservedCounter) 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 *patternFlowRsvpReservedCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRsvpReservedCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRsvpReservedCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRsvpReservedCounter) Clone() (PatternFlowRsvpReservedCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRsvpReservedCounter() + 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 +} + +// PatternFlowRsvpReservedCounter is integer counter pattern +type PatternFlowRsvpReservedCounter interface { + Validation + // msg marshals PatternFlowRsvpReservedCounter to protobuf object *otg.PatternFlowRsvpReservedCounter + // and doesn't set defaults + msg() *otg.PatternFlowRsvpReservedCounter + // setMsg unmarshals PatternFlowRsvpReservedCounter from protobuf object *otg.PatternFlowRsvpReservedCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRsvpReservedCounter) PatternFlowRsvpReservedCounter + // provides marshal interface + Marshal() marshalPatternFlowRsvpReservedCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRsvpReservedCounter + // validate validates PatternFlowRsvpReservedCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRsvpReservedCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRsvpReservedCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRsvpReservedCounter + SetStart(value uint32) PatternFlowRsvpReservedCounter + // HasStart checks if Start has been set in PatternFlowRsvpReservedCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRsvpReservedCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRsvpReservedCounter + SetStep(value uint32) PatternFlowRsvpReservedCounter + // HasStep checks if Step has been set in PatternFlowRsvpReservedCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRsvpReservedCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRsvpReservedCounter + SetCount(value uint32) PatternFlowRsvpReservedCounter + // HasCount checks if Count has been set in PatternFlowRsvpReservedCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRsvpReservedCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRsvpReservedCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRsvpReservedCounter object +func (obj *patternFlowRsvpReservedCounter) SetStart(value uint32) PatternFlowRsvpReservedCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRsvpReservedCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRsvpReservedCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRsvpReservedCounter object +func (obj *patternFlowRsvpReservedCounter) SetStep(value uint32) PatternFlowRsvpReservedCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRsvpReservedCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRsvpReservedCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRsvpReservedCounter object +func (obj *patternFlowRsvpReservedCounter) SetCount(value uint32) PatternFlowRsvpReservedCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRsvpReservedCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRsvpReservedCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRsvpReservedCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRsvpReservedCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRsvpReservedCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_rsvp_rsvp_checksum.go b/gosnappi/pattern_flow_rsvp_rsvp_checksum.go new file mode 100644 index 00000000..12d98b57 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_rsvp_checksum.go @@ -0,0 +1,434 @@ +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" +) + +// ***** PatternFlowRsvpRsvpChecksum ***** +type patternFlowRsvpRsvpChecksum struct { + validation + obj *otg.PatternFlowRsvpRsvpChecksum + marshaller marshalPatternFlowRsvpRsvpChecksum + unMarshaller unMarshalPatternFlowRsvpRsvpChecksum +} + +func NewPatternFlowRsvpRsvpChecksum() PatternFlowRsvpRsvpChecksum { + obj := patternFlowRsvpRsvpChecksum{obj: &otg.PatternFlowRsvpRsvpChecksum{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRsvpRsvpChecksum) msg() *otg.PatternFlowRsvpRsvpChecksum { + return obj.obj +} + +func (obj *patternFlowRsvpRsvpChecksum) setMsg(msg *otg.PatternFlowRsvpRsvpChecksum) PatternFlowRsvpRsvpChecksum { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRsvpRsvpChecksum struct { + obj *patternFlowRsvpRsvpChecksum +} + +type marshalPatternFlowRsvpRsvpChecksum interface { + // ToProto marshals PatternFlowRsvpRsvpChecksum to protobuf object *otg.PatternFlowRsvpRsvpChecksum + ToProto() (*otg.PatternFlowRsvpRsvpChecksum, error) + // ToPbText marshals PatternFlowRsvpRsvpChecksum to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRsvpRsvpChecksum to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRsvpRsvpChecksum to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRsvpRsvpChecksum struct { + obj *patternFlowRsvpRsvpChecksum +} + +type unMarshalPatternFlowRsvpRsvpChecksum interface { + // FromProto unmarshals PatternFlowRsvpRsvpChecksum from protobuf object *otg.PatternFlowRsvpRsvpChecksum + FromProto(msg *otg.PatternFlowRsvpRsvpChecksum) (PatternFlowRsvpRsvpChecksum, error) + // FromPbText unmarshals PatternFlowRsvpRsvpChecksum from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRsvpRsvpChecksum from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRsvpRsvpChecksum from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRsvpRsvpChecksum) Marshal() marshalPatternFlowRsvpRsvpChecksum { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRsvpRsvpChecksum{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRsvpRsvpChecksum) Unmarshal() unMarshalPatternFlowRsvpRsvpChecksum { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRsvpRsvpChecksum{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRsvpRsvpChecksum) ToProto() (*otg.PatternFlowRsvpRsvpChecksum, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRsvpRsvpChecksum) FromProto(msg *otg.PatternFlowRsvpRsvpChecksum) (PatternFlowRsvpRsvpChecksum, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRsvpRsvpChecksum) 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 *unMarshalpatternFlowRsvpRsvpChecksum) 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 *marshalpatternFlowRsvpRsvpChecksum) 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 *unMarshalpatternFlowRsvpRsvpChecksum) 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 *marshalpatternFlowRsvpRsvpChecksum) 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 *unMarshalpatternFlowRsvpRsvpChecksum) 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 *patternFlowRsvpRsvpChecksum) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRsvpRsvpChecksum) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRsvpRsvpChecksum) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRsvpRsvpChecksum) Clone() (PatternFlowRsvpRsvpChecksum, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRsvpRsvpChecksum() + 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 +} + +// PatternFlowRsvpRsvpChecksum is the one's complement of the one's complement sum of the message, with the checksum field replaced by zero for the purpose of computing the checksum. An all-zero value means that no checksum was transmitted. +type PatternFlowRsvpRsvpChecksum interface { + Validation + // msg marshals PatternFlowRsvpRsvpChecksum to protobuf object *otg.PatternFlowRsvpRsvpChecksum + // and doesn't set defaults + msg() *otg.PatternFlowRsvpRsvpChecksum + // setMsg unmarshals PatternFlowRsvpRsvpChecksum from protobuf object *otg.PatternFlowRsvpRsvpChecksum + // and doesn't set defaults + setMsg(*otg.PatternFlowRsvpRsvpChecksum) PatternFlowRsvpRsvpChecksum + // provides marshal interface + Marshal() marshalPatternFlowRsvpRsvpChecksum + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRsvpRsvpChecksum + // validate validates PatternFlowRsvpRsvpChecksum + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRsvpRsvpChecksum, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRsvpRsvpChecksumChoiceEnum, set in PatternFlowRsvpRsvpChecksum + Choice() PatternFlowRsvpRsvpChecksumChoiceEnum + // setChoice assigns PatternFlowRsvpRsvpChecksumChoiceEnum provided by user to PatternFlowRsvpRsvpChecksum + setChoice(value PatternFlowRsvpRsvpChecksumChoiceEnum) PatternFlowRsvpRsvpChecksum + // HasChoice checks if Choice has been set in PatternFlowRsvpRsvpChecksum + HasChoice() bool + // Generated returns PatternFlowRsvpRsvpChecksumGeneratedEnum, set in PatternFlowRsvpRsvpChecksum + Generated() PatternFlowRsvpRsvpChecksumGeneratedEnum + // SetGenerated assigns PatternFlowRsvpRsvpChecksumGeneratedEnum provided by user to PatternFlowRsvpRsvpChecksum + SetGenerated(value PatternFlowRsvpRsvpChecksumGeneratedEnum) PatternFlowRsvpRsvpChecksum + // HasGenerated checks if Generated has been set in PatternFlowRsvpRsvpChecksum + HasGenerated() bool + // Custom returns uint32, set in PatternFlowRsvpRsvpChecksum. + Custom() uint32 + // SetCustom assigns uint32 provided by user to PatternFlowRsvpRsvpChecksum + SetCustom(value uint32) PatternFlowRsvpRsvpChecksum + // HasCustom checks if Custom has been set in PatternFlowRsvpRsvpChecksum + HasCustom() bool +} + +type PatternFlowRsvpRsvpChecksumChoiceEnum string + +// Enum of Choice on PatternFlowRsvpRsvpChecksum +var PatternFlowRsvpRsvpChecksumChoice = struct { + GENERATED PatternFlowRsvpRsvpChecksumChoiceEnum + CUSTOM PatternFlowRsvpRsvpChecksumChoiceEnum +}{ + GENERATED: PatternFlowRsvpRsvpChecksumChoiceEnum("generated"), + CUSTOM: PatternFlowRsvpRsvpChecksumChoiceEnum("custom"), +} + +func (obj *patternFlowRsvpRsvpChecksum) Choice() PatternFlowRsvpRsvpChecksumChoiceEnum { + return PatternFlowRsvpRsvpChecksumChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The type of checksum +// Choice returns a string +func (obj *patternFlowRsvpRsvpChecksum) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRsvpRsvpChecksum) setChoice(value PatternFlowRsvpRsvpChecksumChoiceEnum) PatternFlowRsvpRsvpChecksum { + intValue, ok := otg.PatternFlowRsvpRsvpChecksum_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRsvpRsvpChecksumChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRsvpRsvpChecksum_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Custom = nil + obj.obj.Generated = otg.PatternFlowRsvpRsvpChecksum_Generated_unspecified.Enum() + return obj +} + +type PatternFlowRsvpRsvpChecksumGeneratedEnum string + +// Enum of Generated on PatternFlowRsvpRsvpChecksum +var PatternFlowRsvpRsvpChecksumGenerated = struct { + GOOD PatternFlowRsvpRsvpChecksumGeneratedEnum + BAD PatternFlowRsvpRsvpChecksumGeneratedEnum +}{ + GOOD: PatternFlowRsvpRsvpChecksumGeneratedEnum("good"), + BAD: PatternFlowRsvpRsvpChecksumGeneratedEnum("bad"), +} + +func (obj *patternFlowRsvpRsvpChecksum) Generated() PatternFlowRsvpRsvpChecksumGeneratedEnum { + return PatternFlowRsvpRsvpChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) +} + +// A system generated checksum value +// Generated returns a string +func (obj *patternFlowRsvpRsvpChecksum) HasGenerated() bool { + return obj.obj.Generated != nil +} + +func (obj *patternFlowRsvpRsvpChecksum) SetGenerated(value PatternFlowRsvpRsvpChecksumGeneratedEnum) PatternFlowRsvpRsvpChecksum { + intValue, ok := otg.PatternFlowRsvpRsvpChecksum_Generated_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRsvpRsvpChecksumGeneratedEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRsvpRsvpChecksum_Generated_Enum(intValue) + obj.obj.Generated = &enumValue + + return obj +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowRsvpRsvpChecksum) Custom() uint32 { + + if obj.obj.Custom == nil { + obj.setChoice(PatternFlowRsvpRsvpChecksumChoice.CUSTOM) + } + + return *obj.obj.Custom + +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowRsvpRsvpChecksum) HasCustom() bool { + return obj.obj.Custom != nil +} + +// A custom checksum value +// SetCustom sets the uint32 value in the PatternFlowRsvpRsvpChecksum object +func (obj *patternFlowRsvpRsvpChecksum) SetCustom(value uint32) PatternFlowRsvpRsvpChecksum { + obj.setChoice(PatternFlowRsvpRsvpChecksumChoice.CUSTOM) + obj.obj.Custom = &value + return obj +} + +func (obj *patternFlowRsvpRsvpChecksum) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Custom != nil { + + if *obj.obj.Custom > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRsvpRsvpChecksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) + } + + } + +} + +func (obj *patternFlowRsvpRsvpChecksum) setDefault() { + var choices_set int = 0 + var choice PatternFlowRsvpRsvpChecksumChoiceEnum + + if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { + choices_set += 1 + choice = PatternFlowRsvpRsvpChecksumChoice.GENERATED + } + + if obj.obj.Custom != nil { + choices_set += 1 + choice = PatternFlowRsvpRsvpChecksumChoice.CUSTOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRsvpRsvpChecksumChoice.GENERATED) + if obj.obj.Generated.Number() == 0 { + obj.SetGenerated(PatternFlowRsvpRsvpChecksumGenerated.GOOD) + + } + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRsvpRsvpChecksum") + } + } else { + intVal := otg.PatternFlowRsvpRsvpChecksum_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRsvpRsvpChecksum_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_time_to_live.go b/gosnappi/pattern_flow_rsvp_time_to_live.go new file mode 100644 index 00000000..13b58f67 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_time_to_live.go @@ -0,0 +1,558 @@ +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" +) + +// ***** PatternFlowRsvpTimeToLive ***** +type patternFlowRsvpTimeToLive struct { + validation + obj *otg.PatternFlowRsvpTimeToLive + marshaller marshalPatternFlowRsvpTimeToLive + unMarshaller unMarshalPatternFlowRsvpTimeToLive + incrementHolder PatternFlowRsvpTimeToLiveCounter + decrementHolder PatternFlowRsvpTimeToLiveCounter +} + +func NewPatternFlowRsvpTimeToLive() PatternFlowRsvpTimeToLive { + obj := patternFlowRsvpTimeToLive{obj: &otg.PatternFlowRsvpTimeToLive{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRsvpTimeToLive) msg() *otg.PatternFlowRsvpTimeToLive { + return obj.obj +} + +func (obj *patternFlowRsvpTimeToLive) setMsg(msg *otg.PatternFlowRsvpTimeToLive) PatternFlowRsvpTimeToLive { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRsvpTimeToLive struct { + obj *patternFlowRsvpTimeToLive +} + +type marshalPatternFlowRsvpTimeToLive interface { + // ToProto marshals PatternFlowRsvpTimeToLive to protobuf object *otg.PatternFlowRsvpTimeToLive + ToProto() (*otg.PatternFlowRsvpTimeToLive, error) + // ToPbText marshals PatternFlowRsvpTimeToLive to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRsvpTimeToLive to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRsvpTimeToLive to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRsvpTimeToLive struct { + obj *patternFlowRsvpTimeToLive +} + +type unMarshalPatternFlowRsvpTimeToLive interface { + // FromProto unmarshals PatternFlowRsvpTimeToLive from protobuf object *otg.PatternFlowRsvpTimeToLive + FromProto(msg *otg.PatternFlowRsvpTimeToLive) (PatternFlowRsvpTimeToLive, error) + // FromPbText unmarshals PatternFlowRsvpTimeToLive from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRsvpTimeToLive from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRsvpTimeToLive from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRsvpTimeToLive) Marshal() marshalPatternFlowRsvpTimeToLive { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRsvpTimeToLive{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRsvpTimeToLive) Unmarshal() unMarshalPatternFlowRsvpTimeToLive { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRsvpTimeToLive{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRsvpTimeToLive) ToProto() (*otg.PatternFlowRsvpTimeToLive, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRsvpTimeToLive) FromProto(msg *otg.PatternFlowRsvpTimeToLive) (PatternFlowRsvpTimeToLive, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRsvpTimeToLive) 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 *unMarshalpatternFlowRsvpTimeToLive) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowRsvpTimeToLive) 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 *unMarshalpatternFlowRsvpTimeToLive) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowRsvpTimeToLive) 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 *unMarshalpatternFlowRsvpTimeToLive) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowRsvpTimeToLive) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRsvpTimeToLive) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRsvpTimeToLive) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRsvpTimeToLive) Clone() (PatternFlowRsvpTimeToLive, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRsvpTimeToLive() + 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 +} + +func (obj *patternFlowRsvpTimeToLive) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowRsvpTimeToLive is the IP time-to-live(TTL) value with which the message was sent. +type PatternFlowRsvpTimeToLive interface { + Validation + // msg marshals PatternFlowRsvpTimeToLive to protobuf object *otg.PatternFlowRsvpTimeToLive + // and doesn't set defaults + msg() *otg.PatternFlowRsvpTimeToLive + // setMsg unmarshals PatternFlowRsvpTimeToLive from protobuf object *otg.PatternFlowRsvpTimeToLive + // and doesn't set defaults + setMsg(*otg.PatternFlowRsvpTimeToLive) PatternFlowRsvpTimeToLive + // provides marshal interface + Marshal() marshalPatternFlowRsvpTimeToLive + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRsvpTimeToLive + // validate validates PatternFlowRsvpTimeToLive + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRsvpTimeToLive, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowRsvpTimeToLiveChoiceEnum, set in PatternFlowRsvpTimeToLive + Choice() PatternFlowRsvpTimeToLiveChoiceEnum + // setChoice assigns PatternFlowRsvpTimeToLiveChoiceEnum provided by user to PatternFlowRsvpTimeToLive + setChoice(value PatternFlowRsvpTimeToLiveChoiceEnum) PatternFlowRsvpTimeToLive + // HasChoice checks if Choice has been set in PatternFlowRsvpTimeToLive + HasChoice() bool + // Value returns uint32, set in PatternFlowRsvpTimeToLive. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowRsvpTimeToLive + SetValue(value uint32) PatternFlowRsvpTimeToLive + // HasValue checks if Value has been set in PatternFlowRsvpTimeToLive + HasValue() bool + // Values returns []uint32, set in PatternFlowRsvpTimeToLive. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowRsvpTimeToLive + SetValues(value []uint32) PatternFlowRsvpTimeToLive + // Increment returns PatternFlowRsvpTimeToLiveCounter, set in PatternFlowRsvpTimeToLive. + // PatternFlowRsvpTimeToLiveCounter is integer counter pattern + Increment() PatternFlowRsvpTimeToLiveCounter + // SetIncrement assigns PatternFlowRsvpTimeToLiveCounter provided by user to PatternFlowRsvpTimeToLive. + // PatternFlowRsvpTimeToLiveCounter is integer counter pattern + SetIncrement(value PatternFlowRsvpTimeToLiveCounter) PatternFlowRsvpTimeToLive + // HasIncrement checks if Increment has been set in PatternFlowRsvpTimeToLive + HasIncrement() bool + // Decrement returns PatternFlowRsvpTimeToLiveCounter, set in PatternFlowRsvpTimeToLive. + // PatternFlowRsvpTimeToLiveCounter is integer counter pattern + Decrement() PatternFlowRsvpTimeToLiveCounter + // SetDecrement assigns PatternFlowRsvpTimeToLiveCounter provided by user to PatternFlowRsvpTimeToLive. + // PatternFlowRsvpTimeToLiveCounter is integer counter pattern + SetDecrement(value PatternFlowRsvpTimeToLiveCounter) PatternFlowRsvpTimeToLive + // HasDecrement checks if Decrement has been set in PatternFlowRsvpTimeToLive + HasDecrement() bool + setNil() +} + +type PatternFlowRsvpTimeToLiveChoiceEnum string + +// Enum of Choice on PatternFlowRsvpTimeToLive +var PatternFlowRsvpTimeToLiveChoice = struct { + VALUE PatternFlowRsvpTimeToLiveChoiceEnum + VALUES PatternFlowRsvpTimeToLiveChoiceEnum + INCREMENT PatternFlowRsvpTimeToLiveChoiceEnum + DECREMENT PatternFlowRsvpTimeToLiveChoiceEnum +}{ + VALUE: PatternFlowRsvpTimeToLiveChoiceEnum("value"), + VALUES: PatternFlowRsvpTimeToLiveChoiceEnum("values"), + INCREMENT: PatternFlowRsvpTimeToLiveChoiceEnum("increment"), + DECREMENT: PatternFlowRsvpTimeToLiveChoiceEnum("decrement"), +} + +func (obj *patternFlowRsvpTimeToLive) Choice() PatternFlowRsvpTimeToLiveChoiceEnum { + return PatternFlowRsvpTimeToLiveChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowRsvpTimeToLive) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowRsvpTimeToLive) setChoice(value PatternFlowRsvpTimeToLiveChoiceEnum) PatternFlowRsvpTimeToLive { + intValue, ok := otg.PatternFlowRsvpTimeToLive_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowRsvpTimeToLiveChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowRsvpTimeToLive_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowRsvpTimeToLiveChoice.VALUE { + defaultValue := uint32(64) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowRsvpTimeToLiveChoice.VALUES { + defaultValue := []uint32{64} + obj.obj.Values = defaultValue + } + + if value == PatternFlowRsvpTimeToLiveChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowRsvpTimeToLiveCounter().msg() + } + + if value == PatternFlowRsvpTimeToLiveChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowRsvpTimeToLiveCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRsvpTimeToLive) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowRsvpTimeToLiveChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowRsvpTimeToLive) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowRsvpTimeToLive object +func (obj *patternFlowRsvpTimeToLive) SetValue(value uint32) PatternFlowRsvpTimeToLive { + obj.setChoice(PatternFlowRsvpTimeToLiveChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowRsvpTimeToLive) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{64}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowRsvpTimeToLive object +func (obj *patternFlowRsvpTimeToLive) SetValues(value []uint32) PatternFlowRsvpTimeToLive { + obj.setChoice(PatternFlowRsvpTimeToLiveChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowRsvpTimeToLiveCounter +func (obj *patternFlowRsvpTimeToLive) Increment() PatternFlowRsvpTimeToLiveCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowRsvpTimeToLiveChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowRsvpTimeToLiveCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowRsvpTimeToLiveCounter +func (obj *patternFlowRsvpTimeToLive) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowRsvpTimeToLiveCounter value in the PatternFlowRsvpTimeToLive object +func (obj *patternFlowRsvpTimeToLive) SetIncrement(value PatternFlowRsvpTimeToLiveCounter) PatternFlowRsvpTimeToLive { + obj.setChoice(PatternFlowRsvpTimeToLiveChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowRsvpTimeToLiveCounter +func (obj *patternFlowRsvpTimeToLive) Decrement() PatternFlowRsvpTimeToLiveCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowRsvpTimeToLiveChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowRsvpTimeToLiveCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowRsvpTimeToLiveCounter +func (obj *patternFlowRsvpTimeToLive) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowRsvpTimeToLiveCounter value in the PatternFlowRsvpTimeToLive object +func (obj *patternFlowRsvpTimeToLive) SetDecrement(value PatternFlowRsvpTimeToLiveCounter) PatternFlowRsvpTimeToLive { + obj.setChoice(PatternFlowRsvpTimeToLiveChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowRsvpTimeToLive) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRsvpTimeToLive.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowRsvpTimeToLive.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowRsvpTimeToLive) setDefault() { + var choices_set int = 0 + var choice PatternFlowRsvpTimeToLiveChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowRsvpTimeToLiveChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowRsvpTimeToLiveChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowRsvpTimeToLiveChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowRsvpTimeToLiveChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowRsvpTimeToLiveChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowRsvpTimeToLive") + } + } else { + intVal := otg.PatternFlowRsvpTimeToLive_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowRsvpTimeToLive_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_rsvp_time_to_live_counter.go b/gosnappi/pattern_flow_rsvp_time_to_live_counter.go new file mode 100644 index 00000000..7e4e6640 --- /dev/null +++ b/gosnappi/pattern_flow_rsvp_time_to_live_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowRsvpTimeToLiveCounter ***** +type patternFlowRsvpTimeToLiveCounter struct { + validation + obj *otg.PatternFlowRsvpTimeToLiveCounter + marshaller marshalPatternFlowRsvpTimeToLiveCounter + unMarshaller unMarshalPatternFlowRsvpTimeToLiveCounter +} + +func NewPatternFlowRsvpTimeToLiveCounter() PatternFlowRsvpTimeToLiveCounter { + obj := patternFlowRsvpTimeToLiveCounter{obj: &otg.PatternFlowRsvpTimeToLiveCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowRsvpTimeToLiveCounter) msg() *otg.PatternFlowRsvpTimeToLiveCounter { + return obj.obj +} + +func (obj *patternFlowRsvpTimeToLiveCounter) setMsg(msg *otg.PatternFlowRsvpTimeToLiveCounter) PatternFlowRsvpTimeToLiveCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowRsvpTimeToLiveCounter struct { + obj *patternFlowRsvpTimeToLiveCounter +} + +type marshalPatternFlowRsvpTimeToLiveCounter interface { + // ToProto marshals PatternFlowRsvpTimeToLiveCounter to protobuf object *otg.PatternFlowRsvpTimeToLiveCounter + ToProto() (*otg.PatternFlowRsvpTimeToLiveCounter, error) + // ToPbText marshals PatternFlowRsvpTimeToLiveCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowRsvpTimeToLiveCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowRsvpTimeToLiveCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowRsvpTimeToLiveCounter struct { + obj *patternFlowRsvpTimeToLiveCounter +} + +type unMarshalPatternFlowRsvpTimeToLiveCounter interface { + // FromProto unmarshals PatternFlowRsvpTimeToLiveCounter from protobuf object *otg.PatternFlowRsvpTimeToLiveCounter + FromProto(msg *otg.PatternFlowRsvpTimeToLiveCounter) (PatternFlowRsvpTimeToLiveCounter, error) + // FromPbText unmarshals PatternFlowRsvpTimeToLiveCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowRsvpTimeToLiveCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowRsvpTimeToLiveCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowRsvpTimeToLiveCounter) Marshal() marshalPatternFlowRsvpTimeToLiveCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowRsvpTimeToLiveCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowRsvpTimeToLiveCounter) Unmarshal() unMarshalPatternFlowRsvpTimeToLiveCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowRsvpTimeToLiveCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowRsvpTimeToLiveCounter) ToProto() (*otg.PatternFlowRsvpTimeToLiveCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowRsvpTimeToLiveCounter) FromProto(msg *otg.PatternFlowRsvpTimeToLiveCounter) (PatternFlowRsvpTimeToLiveCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowRsvpTimeToLiveCounter) 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 *unMarshalpatternFlowRsvpTimeToLiveCounter) 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 *marshalpatternFlowRsvpTimeToLiveCounter) 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 *unMarshalpatternFlowRsvpTimeToLiveCounter) 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 *marshalpatternFlowRsvpTimeToLiveCounter) 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 *unMarshalpatternFlowRsvpTimeToLiveCounter) 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 *patternFlowRsvpTimeToLiveCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowRsvpTimeToLiveCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowRsvpTimeToLiveCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowRsvpTimeToLiveCounter) Clone() (PatternFlowRsvpTimeToLiveCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowRsvpTimeToLiveCounter() + 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 +} + +// PatternFlowRsvpTimeToLiveCounter is integer counter pattern +type PatternFlowRsvpTimeToLiveCounter interface { + Validation + // msg marshals PatternFlowRsvpTimeToLiveCounter to protobuf object *otg.PatternFlowRsvpTimeToLiveCounter + // and doesn't set defaults + msg() *otg.PatternFlowRsvpTimeToLiveCounter + // setMsg unmarshals PatternFlowRsvpTimeToLiveCounter from protobuf object *otg.PatternFlowRsvpTimeToLiveCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowRsvpTimeToLiveCounter) PatternFlowRsvpTimeToLiveCounter + // provides marshal interface + Marshal() marshalPatternFlowRsvpTimeToLiveCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowRsvpTimeToLiveCounter + // validate validates PatternFlowRsvpTimeToLiveCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowRsvpTimeToLiveCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowRsvpTimeToLiveCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowRsvpTimeToLiveCounter + SetStart(value uint32) PatternFlowRsvpTimeToLiveCounter + // HasStart checks if Start has been set in PatternFlowRsvpTimeToLiveCounter + HasStart() bool + // Step returns uint32, set in PatternFlowRsvpTimeToLiveCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowRsvpTimeToLiveCounter + SetStep(value uint32) PatternFlowRsvpTimeToLiveCounter + // HasStep checks if Step has been set in PatternFlowRsvpTimeToLiveCounter + HasStep() bool + // Count returns uint32, set in PatternFlowRsvpTimeToLiveCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowRsvpTimeToLiveCounter + SetCount(value uint32) PatternFlowRsvpTimeToLiveCounter + // HasCount checks if Count has been set in PatternFlowRsvpTimeToLiveCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRsvpTimeToLiveCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowRsvpTimeToLiveCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowRsvpTimeToLiveCounter object +func (obj *patternFlowRsvpTimeToLiveCounter) SetStart(value uint32) PatternFlowRsvpTimeToLiveCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRsvpTimeToLiveCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowRsvpTimeToLiveCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowRsvpTimeToLiveCounter object +func (obj *patternFlowRsvpTimeToLiveCounter) SetStep(value uint32) PatternFlowRsvpTimeToLiveCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRsvpTimeToLiveCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowRsvpTimeToLiveCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowRsvpTimeToLiveCounter object +func (obj *patternFlowRsvpTimeToLiveCounter) SetCount(value uint32) PatternFlowRsvpTimeToLiveCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowRsvpTimeToLiveCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRsvpTimeToLiveCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRsvpTimeToLiveCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowRsvpTimeToLiveCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowRsvpTimeToLiveCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(64) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_max_repetitions.go b/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_max_repetitions.go new file mode 100644 index 00000000..b3f0df8a --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_max_repetitions.go @@ -0,0 +1,531 @@ +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" +) + +// ***** PatternFlowSnmpv2CBulkPDUMaxRepetitions ***** +type patternFlowSnmpv2CBulkPDUMaxRepetitions struct { + validation + obj *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions + marshaller marshalPatternFlowSnmpv2CBulkPDUMaxRepetitions + unMarshaller unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitions + incrementHolder PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + decrementHolder PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter +} + +func NewPatternFlowSnmpv2CBulkPDUMaxRepetitions() PatternFlowSnmpv2CBulkPDUMaxRepetitions { + obj := patternFlowSnmpv2CBulkPDUMaxRepetitions{obj: &otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) msg() *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions { + return obj.obj +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) setMsg(msg *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions) PatternFlowSnmpv2CBulkPDUMaxRepetitions { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CBulkPDUMaxRepetitions struct { + obj *patternFlowSnmpv2CBulkPDUMaxRepetitions +} + +type marshalPatternFlowSnmpv2CBulkPDUMaxRepetitions interface { + // ToProto marshals PatternFlowSnmpv2CBulkPDUMaxRepetitions to protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions + ToProto() (*otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions, error) + // ToPbText marshals PatternFlowSnmpv2CBulkPDUMaxRepetitions to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CBulkPDUMaxRepetitions to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CBulkPDUMaxRepetitions to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitions struct { + obj *patternFlowSnmpv2CBulkPDUMaxRepetitions +} + +type unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitions interface { + // FromProto unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitions from protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions + FromProto(msg *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions) (PatternFlowSnmpv2CBulkPDUMaxRepetitions, error) + // FromPbText unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitions from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitions from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitions from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Marshal() marshalPatternFlowSnmpv2CBulkPDUMaxRepetitions { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CBulkPDUMaxRepetitions{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitions { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitions{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) ToProto() (*otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) FromProto(msg *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions) (PatternFlowSnmpv2CBulkPDUMaxRepetitions, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) 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 *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) 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 *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) 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 *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitions) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Clone() (PatternFlowSnmpv2CBulkPDUMaxRepetitions, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CBulkPDUMaxRepetitions() + 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 +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowSnmpv2CBulkPDUMaxRepetitions is a maximum of max_repetitions variable bindings are requested in the Response-PDU for each of the remaining variable bindings in the GetBulkRequest after the non_repeaters variable bindings. +type PatternFlowSnmpv2CBulkPDUMaxRepetitions interface { + Validation + // msg marshals PatternFlowSnmpv2CBulkPDUMaxRepetitions to protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions + // setMsg unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitions from protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions) PatternFlowSnmpv2CBulkPDUMaxRepetitions + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CBulkPDUMaxRepetitions + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitions + // validate validates PatternFlowSnmpv2CBulkPDUMaxRepetitions + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CBulkPDUMaxRepetitions, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum, set in PatternFlowSnmpv2CBulkPDUMaxRepetitions + Choice() PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum + // setChoice assigns PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitions + setChoice(value PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum) PatternFlowSnmpv2CBulkPDUMaxRepetitions + // HasChoice checks if Choice has been set in PatternFlowSnmpv2CBulkPDUMaxRepetitions + HasChoice() bool + // Value returns uint32, set in PatternFlowSnmpv2CBulkPDUMaxRepetitions. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitions + SetValue(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitions + // HasValue checks if Value has been set in PatternFlowSnmpv2CBulkPDUMaxRepetitions + HasValue() bool + // Values returns []uint32, set in PatternFlowSnmpv2CBulkPDUMaxRepetitions. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitions + SetValues(value []uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitions + // Increment returns PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, set in PatternFlowSnmpv2CBulkPDUMaxRepetitions. + Increment() PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + // SetIncrement assigns PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitions. + SetIncrement(value PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) PatternFlowSnmpv2CBulkPDUMaxRepetitions + // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CBulkPDUMaxRepetitions + HasIncrement() bool + // Decrement returns PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, set in PatternFlowSnmpv2CBulkPDUMaxRepetitions. + Decrement() PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + // SetDecrement assigns PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitions. + SetDecrement(value PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) PatternFlowSnmpv2CBulkPDUMaxRepetitions + // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CBulkPDUMaxRepetitions + HasDecrement() bool + setNil() +} + +type PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum string + +// Enum of Choice on PatternFlowSnmpv2CBulkPDUMaxRepetitions +var PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice = struct { + VALUE PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum + VALUES PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum + INCREMENT PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum + DECREMENT PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum +}{ + VALUE: PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum("value"), + VALUES: PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum("values"), + INCREMENT: PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum("increment"), + DECREMENT: PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum("decrement"), +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Choice() PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum { + return PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) setChoice(value PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum) PatternFlowSnmpv2CBulkPDUMaxRepetitions { + intValue, ok := otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter().msg() + } + + if value == PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowSnmpv2CBulkPDUMaxRepetitions object +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) SetValue(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitions { + obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowSnmpv2CBulkPDUMaxRepetitions object +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) SetValues(value []uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitions { + obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Increment() PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter value in the PatternFlowSnmpv2CBulkPDUMaxRepetitions object +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) SetIncrement(value PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) PatternFlowSnmpv2CBulkPDUMaxRepetitions { + obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) Decrement() PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter value in the PatternFlowSnmpv2CBulkPDUMaxRepetitions object +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) SetDecrement(value PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) PatternFlowSnmpv2CBulkPDUMaxRepetitions { + obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitions) setDefault() { + var choices_set int = 0 + var choice PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowSnmpv2CBulkPDUMaxRepetitionsChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CBulkPDUMaxRepetitions") + } + } else { + intVal := otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowSnmpv2CBulkPDUMaxRepetitions_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_max_repetitions_counter.go b/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_max_repetitions_counter.go new file mode 100644 index 00000000..4501fed1 --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_max_repetitions_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter ***** +type patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter struct { + validation + obj *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + marshaller marshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + unMarshaller unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter +} + +func NewPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter() PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { + obj := patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter{obj: &otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) msg() *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { + return obj.obj +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) setMsg(msg *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter struct { + obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter +} + +type marshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter interface { + // ToProto marshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter to protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + ToProto() (*otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, error) + // ToPbText marshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter struct { + obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter +} + +type unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter interface { + // FromProto unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter from protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + FromProto(msg *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) (PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, error) + // FromPbText unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) Marshal() marshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) ToProto() (*otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) FromProto(msg *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) (PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) 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 *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) 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 *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) 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 *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) 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 *marshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) 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 *unMarshalpatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) 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 *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) Clone() (PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter() + 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 +} + +// PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter is integer counter pattern +type PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter interface { + Validation + // msg marshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter to protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + // setMsg unmarshals PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter from protobuf object *otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + // validate validates PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + SetStart(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + // HasStart checks if Start has been set in PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + HasStart() bool + // Step returns uint32, set in PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + SetStep(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + // HasStep checks if Step has been set in PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + HasStep() bool + // Count returns uint32, set in PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + SetCount(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + // HasCount checks if Count has been set in PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter object +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) SetStart(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter object +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) SetStep(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter object +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) SetCount(value uint32) PatternFlowSnmpv2CBulkPDUMaxRepetitionsCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowSnmpv2CBulkPDUMaxRepetitionsCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_non_repeaters.go b/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_non_repeaters.go new file mode 100644 index 00000000..90a39a2d --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_non_repeaters.go @@ -0,0 +1,416 @@ +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" +) + +// ***** PatternFlowSnmpv2CBulkPDUNonRepeaters ***** +type patternFlowSnmpv2CBulkPDUNonRepeaters struct { + validation + obj *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters + marshaller marshalPatternFlowSnmpv2CBulkPDUNonRepeaters + unMarshaller unMarshalPatternFlowSnmpv2CBulkPDUNonRepeaters +} + +func NewPatternFlowSnmpv2CBulkPDUNonRepeaters() PatternFlowSnmpv2CBulkPDUNonRepeaters { + obj := patternFlowSnmpv2CBulkPDUNonRepeaters{obj: &otg.PatternFlowSnmpv2CBulkPDUNonRepeaters{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) msg() *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters { + return obj.obj +} + +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) setMsg(msg *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters) PatternFlowSnmpv2CBulkPDUNonRepeaters { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CBulkPDUNonRepeaters struct { + obj *patternFlowSnmpv2CBulkPDUNonRepeaters +} + +type marshalPatternFlowSnmpv2CBulkPDUNonRepeaters interface { + // ToProto marshals PatternFlowSnmpv2CBulkPDUNonRepeaters to protobuf object *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters + ToProto() (*otg.PatternFlowSnmpv2CBulkPDUNonRepeaters, error) + // ToPbText marshals PatternFlowSnmpv2CBulkPDUNonRepeaters to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CBulkPDUNonRepeaters to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CBulkPDUNonRepeaters to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CBulkPDUNonRepeaters struct { + obj *patternFlowSnmpv2CBulkPDUNonRepeaters +} + +type unMarshalPatternFlowSnmpv2CBulkPDUNonRepeaters interface { + // FromProto unmarshals PatternFlowSnmpv2CBulkPDUNonRepeaters from protobuf object *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters + FromProto(msg *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters) (PatternFlowSnmpv2CBulkPDUNonRepeaters, error) + // FromPbText unmarshals PatternFlowSnmpv2CBulkPDUNonRepeaters from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CBulkPDUNonRepeaters from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CBulkPDUNonRepeaters from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) Marshal() marshalPatternFlowSnmpv2CBulkPDUNonRepeaters { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CBulkPDUNonRepeaters{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDUNonRepeaters { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CBulkPDUNonRepeaters{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CBulkPDUNonRepeaters) ToProto() (*otg.PatternFlowSnmpv2CBulkPDUNonRepeaters, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CBulkPDUNonRepeaters) FromProto(msg *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters) (PatternFlowSnmpv2CBulkPDUNonRepeaters, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CBulkPDUNonRepeaters) 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 *unMarshalpatternFlowSnmpv2CBulkPDUNonRepeaters) 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 *marshalpatternFlowSnmpv2CBulkPDUNonRepeaters) 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 *unMarshalpatternFlowSnmpv2CBulkPDUNonRepeaters) 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 *marshalpatternFlowSnmpv2CBulkPDUNonRepeaters) 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 *unMarshalpatternFlowSnmpv2CBulkPDUNonRepeaters) 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 *patternFlowSnmpv2CBulkPDUNonRepeaters) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) Clone() (PatternFlowSnmpv2CBulkPDUNonRepeaters, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CBulkPDUNonRepeaters() + 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 +} + +// PatternFlowSnmpv2CBulkPDUNonRepeaters is one variable binding in the Response-PDU is requested for the first non_repeaters variable bindings in the GetBulkRequest. +type PatternFlowSnmpv2CBulkPDUNonRepeaters interface { + Validation + // msg marshals PatternFlowSnmpv2CBulkPDUNonRepeaters to protobuf object *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters + // setMsg unmarshals PatternFlowSnmpv2CBulkPDUNonRepeaters from protobuf object *otg.PatternFlowSnmpv2CBulkPDUNonRepeaters + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CBulkPDUNonRepeaters) PatternFlowSnmpv2CBulkPDUNonRepeaters + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CBulkPDUNonRepeaters + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDUNonRepeaters + // validate validates PatternFlowSnmpv2CBulkPDUNonRepeaters + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CBulkPDUNonRepeaters, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum, set in PatternFlowSnmpv2CBulkPDUNonRepeaters + Choice() PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum + // setChoice assigns PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum provided by user to PatternFlowSnmpv2CBulkPDUNonRepeaters + setChoice(value PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum) PatternFlowSnmpv2CBulkPDUNonRepeaters + // HasChoice checks if Choice has been set in PatternFlowSnmpv2CBulkPDUNonRepeaters + HasChoice() bool + // Value returns uint32, set in PatternFlowSnmpv2CBulkPDUNonRepeaters. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowSnmpv2CBulkPDUNonRepeaters + SetValue(value uint32) PatternFlowSnmpv2CBulkPDUNonRepeaters + // HasValue checks if Value has been set in PatternFlowSnmpv2CBulkPDUNonRepeaters + HasValue() bool + // Values returns []uint32, set in PatternFlowSnmpv2CBulkPDUNonRepeaters. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowSnmpv2CBulkPDUNonRepeaters + SetValues(value []uint32) PatternFlowSnmpv2CBulkPDUNonRepeaters +} + +type PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum string + +// Enum of Choice on PatternFlowSnmpv2CBulkPDUNonRepeaters +var PatternFlowSnmpv2CBulkPDUNonRepeatersChoice = struct { + VALUE PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum + VALUES PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum +}{ + VALUE: PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum("value"), + VALUES: PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum("values"), +} + +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) Choice() PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum { + return PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) setChoice(value PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum) PatternFlowSnmpv2CBulkPDUNonRepeaters { + intValue, ok := otg.PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowSnmpv2CBulkPDUNonRepeaters object +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) SetValue(value uint32) PatternFlowSnmpv2CBulkPDUNonRepeaters { + obj.setChoice(PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowSnmpv2CBulkPDUNonRepeaters object +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) SetValues(value []uint32) PatternFlowSnmpv2CBulkPDUNonRepeaters { + obj.setChoice(PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowSnmpv2CBulkPDUNonRepeaters) setDefault() { + var choices_set int = 0 + var choice PatternFlowSnmpv2CBulkPDUNonRepeatersChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUES + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowSnmpv2CBulkPDUNonRepeatersChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CBulkPDUNonRepeaters") + } + } else { + intVal := otg.PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowSnmpv2CBulkPDUNonRepeaters_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_request_id.go b/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_request_id.go new file mode 100644 index 00000000..e364bf4c --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_request_id.go @@ -0,0 +1,536 @@ +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" +) + +// ***** PatternFlowSnmpv2CBulkPDURequestId ***** +type patternFlowSnmpv2CBulkPDURequestId struct { + validation + obj *otg.PatternFlowSnmpv2CBulkPDURequestId + marshaller marshalPatternFlowSnmpv2CBulkPDURequestId + unMarshaller unMarshalPatternFlowSnmpv2CBulkPDURequestId + incrementHolder PatternFlowSnmpv2CBulkPDURequestIdCounter + decrementHolder PatternFlowSnmpv2CBulkPDURequestIdCounter +} + +func NewPatternFlowSnmpv2CBulkPDURequestId() PatternFlowSnmpv2CBulkPDURequestId { + obj := patternFlowSnmpv2CBulkPDURequestId{obj: &otg.PatternFlowSnmpv2CBulkPDURequestId{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CBulkPDURequestId) msg() *otg.PatternFlowSnmpv2CBulkPDURequestId { + return obj.obj +} + +func (obj *patternFlowSnmpv2CBulkPDURequestId) setMsg(msg *otg.PatternFlowSnmpv2CBulkPDURequestId) PatternFlowSnmpv2CBulkPDURequestId { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CBulkPDURequestId struct { + obj *patternFlowSnmpv2CBulkPDURequestId +} + +type marshalPatternFlowSnmpv2CBulkPDURequestId interface { + // ToProto marshals PatternFlowSnmpv2CBulkPDURequestId to protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestId + ToProto() (*otg.PatternFlowSnmpv2CBulkPDURequestId, error) + // ToPbText marshals PatternFlowSnmpv2CBulkPDURequestId to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CBulkPDURequestId to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CBulkPDURequestId to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CBulkPDURequestId struct { + obj *patternFlowSnmpv2CBulkPDURequestId +} + +type unMarshalPatternFlowSnmpv2CBulkPDURequestId interface { + // FromProto unmarshals PatternFlowSnmpv2CBulkPDURequestId from protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestId + FromProto(msg *otg.PatternFlowSnmpv2CBulkPDURequestId) (PatternFlowSnmpv2CBulkPDURequestId, error) + // FromPbText unmarshals PatternFlowSnmpv2CBulkPDURequestId from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CBulkPDURequestId from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CBulkPDURequestId from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CBulkPDURequestId) Marshal() marshalPatternFlowSnmpv2CBulkPDURequestId { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CBulkPDURequestId{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CBulkPDURequestId) Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDURequestId { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CBulkPDURequestId{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CBulkPDURequestId) ToProto() (*otg.PatternFlowSnmpv2CBulkPDURequestId, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CBulkPDURequestId) FromProto(msg *otg.PatternFlowSnmpv2CBulkPDURequestId) (PatternFlowSnmpv2CBulkPDURequestId, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CBulkPDURequestId) 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 *unMarshalpatternFlowSnmpv2CBulkPDURequestId) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowSnmpv2CBulkPDURequestId) 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 *unMarshalpatternFlowSnmpv2CBulkPDURequestId) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowSnmpv2CBulkPDURequestId) 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 *unMarshalpatternFlowSnmpv2CBulkPDURequestId) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowSnmpv2CBulkPDURequestId) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CBulkPDURequestId) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CBulkPDURequestId) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CBulkPDURequestId) Clone() (PatternFlowSnmpv2CBulkPDURequestId, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CBulkPDURequestId() + 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 +} + +func (obj *patternFlowSnmpv2CBulkPDURequestId) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowSnmpv2CBulkPDURequestId is identifies a particular SNMP request. +// This index is echoed back in the response from the SNMP agent, +// allowing the SNMP manager to match an incoming response to the appropriate request. +// +// - Encoding of this field follows ASN.1 X.690(section 8.3) specification. +// Refer: http://www.itu.int/ITU-T/asn1 +type PatternFlowSnmpv2CBulkPDURequestId interface { + Validation + // msg marshals PatternFlowSnmpv2CBulkPDURequestId to protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestId + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CBulkPDURequestId + // setMsg unmarshals PatternFlowSnmpv2CBulkPDURequestId from protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestId + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CBulkPDURequestId) PatternFlowSnmpv2CBulkPDURequestId + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CBulkPDURequestId + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDURequestId + // validate validates PatternFlowSnmpv2CBulkPDURequestId + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CBulkPDURequestId, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum, set in PatternFlowSnmpv2CBulkPDURequestId + Choice() PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum + // setChoice assigns PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum provided by user to PatternFlowSnmpv2CBulkPDURequestId + setChoice(value PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum) PatternFlowSnmpv2CBulkPDURequestId + // HasChoice checks if Choice has been set in PatternFlowSnmpv2CBulkPDURequestId + HasChoice() bool + // Value returns int32, set in PatternFlowSnmpv2CBulkPDURequestId. + Value() int32 + // SetValue assigns int32 provided by user to PatternFlowSnmpv2CBulkPDURequestId + SetValue(value int32) PatternFlowSnmpv2CBulkPDURequestId + // HasValue checks if Value has been set in PatternFlowSnmpv2CBulkPDURequestId + HasValue() bool + // Values returns []int32, set in PatternFlowSnmpv2CBulkPDURequestId. + Values() []int32 + // SetValues assigns []int32 provided by user to PatternFlowSnmpv2CBulkPDURequestId + SetValues(value []int32) PatternFlowSnmpv2CBulkPDURequestId + // Increment returns PatternFlowSnmpv2CBulkPDURequestIdCounter, set in PatternFlowSnmpv2CBulkPDURequestId. + Increment() PatternFlowSnmpv2CBulkPDURequestIdCounter + // SetIncrement assigns PatternFlowSnmpv2CBulkPDURequestIdCounter provided by user to PatternFlowSnmpv2CBulkPDURequestId. + SetIncrement(value PatternFlowSnmpv2CBulkPDURequestIdCounter) PatternFlowSnmpv2CBulkPDURequestId + // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CBulkPDURequestId + HasIncrement() bool + // Decrement returns PatternFlowSnmpv2CBulkPDURequestIdCounter, set in PatternFlowSnmpv2CBulkPDURequestId. + Decrement() PatternFlowSnmpv2CBulkPDURequestIdCounter + // SetDecrement assigns PatternFlowSnmpv2CBulkPDURequestIdCounter provided by user to PatternFlowSnmpv2CBulkPDURequestId. + SetDecrement(value PatternFlowSnmpv2CBulkPDURequestIdCounter) PatternFlowSnmpv2CBulkPDURequestId + // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CBulkPDURequestId + HasDecrement() bool + setNil() +} + +type PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum string + +// Enum of Choice on PatternFlowSnmpv2CBulkPDURequestId +var PatternFlowSnmpv2CBulkPDURequestIdChoice = struct { + VALUE PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum + VALUES PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum + INCREMENT PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum + DECREMENT PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum +}{ + VALUE: PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum("value"), + VALUES: PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum("values"), + INCREMENT: PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum("increment"), + DECREMENT: PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum("decrement"), +} + +func (obj *patternFlowSnmpv2CBulkPDURequestId) Choice() PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum { + return PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowSnmpv2CBulkPDURequestId) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowSnmpv2CBulkPDURequestId) setChoice(value PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum) PatternFlowSnmpv2CBulkPDURequestId { + intValue, ok := otg.PatternFlowSnmpv2CBulkPDURequestId_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowSnmpv2CBulkPDURequestId_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUE { + defaultValue := int32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUES { + defaultValue := []int32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowSnmpv2CBulkPDURequestIdChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowSnmpv2CBulkPDURequestIdCounter().msg() + } + + if value == PatternFlowSnmpv2CBulkPDURequestIdChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowSnmpv2CBulkPDURequestIdCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a int32 +func (obj *patternFlowSnmpv2CBulkPDURequestId) Value() int32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a int32 +func (obj *patternFlowSnmpv2CBulkPDURequestId) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the int32 value in the PatternFlowSnmpv2CBulkPDURequestId object +func (obj *patternFlowSnmpv2CBulkPDURequestId) SetValue(value int32) PatternFlowSnmpv2CBulkPDURequestId { + obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []int32 +func (obj *patternFlowSnmpv2CBulkPDURequestId) Values() []int32 { + if obj.obj.Values == nil { + obj.SetValues([]int32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []int32 value in the PatternFlowSnmpv2CBulkPDURequestId object +func (obj *patternFlowSnmpv2CBulkPDURequestId) SetValues(value []int32) PatternFlowSnmpv2CBulkPDURequestId { + obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]int32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CBulkPDURequestIdCounter +func (obj *patternFlowSnmpv2CBulkPDURequestId) Increment() PatternFlowSnmpv2CBulkPDURequestIdCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowSnmpv2CBulkPDURequestIdCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CBulkPDURequestIdCounter +func (obj *patternFlowSnmpv2CBulkPDURequestId) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowSnmpv2CBulkPDURequestIdCounter value in the PatternFlowSnmpv2CBulkPDURequestId object +func (obj *patternFlowSnmpv2CBulkPDURequestId) SetIncrement(value PatternFlowSnmpv2CBulkPDURequestIdCounter) PatternFlowSnmpv2CBulkPDURequestId { + obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CBulkPDURequestIdCounter +func (obj *patternFlowSnmpv2CBulkPDURequestId) Decrement() PatternFlowSnmpv2CBulkPDURequestIdCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowSnmpv2CBulkPDURequestIdCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CBulkPDURequestIdCounter +func (obj *patternFlowSnmpv2CBulkPDURequestId) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowSnmpv2CBulkPDURequestIdCounter value in the PatternFlowSnmpv2CBulkPDURequestId object +func (obj *patternFlowSnmpv2CBulkPDURequestId) SetDecrement(value PatternFlowSnmpv2CBulkPDURequestIdCounter) PatternFlowSnmpv2CBulkPDURequestId { + obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowSnmpv2CBulkPDURequestId) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowSnmpv2CBulkPDURequestId) setDefault() { + var choices_set int = 0 + var choice PatternFlowSnmpv2CBulkPDURequestIdChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CBulkPDURequestIdChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CBulkPDURequestIdChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowSnmpv2CBulkPDURequestIdChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CBulkPDURequestId") + } + } else { + intVal := otg.PatternFlowSnmpv2CBulkPDURequestId_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowSnmpv2CBulkPDURequestId_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_request_id_counter.go b/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_request_id_counter.go new file mode 100644 index 00000000..6df2930f --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_bulk_pdu_request_id_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowSnmpv2CBulkPDURequestIdCounter ***** +type patternFlowSnmpv2CBulkPDURequestIdCounter struct { + validation + obj *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter + marshaller marshalPatternFlowSnmpv2CBulkPDURequestIdCounter + unMarshaller unMarshalPatternFlowSnmpv2CBulkPDURequestIdCounter +} + +func NewPatternFlowSnmpv2CBulkPDURequestIdCounter() PatternFlowSnmpv2CBulkPDURequestIdCounter { + obj := patternFlowSnmpv2CBulkPDURequestIdCounter{obj: &otg.PatternFlowSnmpv2CBulkPDURequestIdCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) msg() *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter { + return obj.obj +} + +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) setMsg(msg *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter) PatternFlowSnmpv2CBulkPDURequestIdCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CBulkPDURequestIdCounter struct { + obj *patternFlowSnmpv2CBulkPDURequestIdCounter +} + +type marshalPatternFlowSnmpv2CBulkPDURequestIdCounter interface { + // ToProto marshals PatternFlowSnmpv2CBulkPDURequestIdCounter to protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter + ToProto() (*otg.PatternFlowSnmpv2CBulkPDURequestIdCounter, error) + // ToPbText marshals PatternFlowSnmpv2CBulkPDURequestIdCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CBulkPDURequestIdCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CBulkPDURequestIdCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CBulkPDURequestIdCounter struct { + obj *patternFlowSnmpv2CBulkPDURequestIdCounter +} + +type unMarshalPatternFlowSnmpv2CBulkPDURequestIdCounter interface { + // FromProto unmarshals PatternFlowSnmpv2CBulkPDURequestIdCounter from protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter + FromProto(msg *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter) (PatternFlowSnmpv2CBulkPDURequestIdCounter, error) + // FromPbText unmarshals PatternFlowSnmpv2CBulkPDURequestIdCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CBulkPDURequestIdCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CBulkPDURequestIdCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) Marshal() marshalPatternFlowSnmpv2CBulkPDURequestIdCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CBulkPDURequestIdCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDURequestIdCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CBulkPDURequestIdCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CBulkPDURequestIdCounter) ToProto() (*otg.PatternFlowSnmpv2CBulkPDURequestIdCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CBulkPDURequestIdCounter) FromProto(msg *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter) (PatternFlowSnmpv2CBulkPDURequestIdCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CBulkPDURequestIdCounter) 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 *unMarshalpatternFlowSnmpv2CBulkPDURequestIdCounter) 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 *marshalpatternFlowSnmpv2CBulkPDURequestIdCounter) 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 *unMarshalpatternFlowSnmpv2CBulkPDURequestIdCounter) 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 *marshalpatternFlowSnmpv2CBulkPDURequestIdCounter) 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 *unMarshalpatternFlowSnmpv2CBulkPDURequestIdCounter) 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 *patternFlowSnmpv2CBulkPDURequestIdCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) Clone() (PatternFlowSnmpv2CBulkPDURequestIdCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CBulkPDURequestIdCounter() + 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 +} + +// PatternFlowSnmpv2CBulkPDURequestIdCounter is integer counter pattern +type PatternFlowSnmpv2CBulkPDURequestIdCounter interface { + Validation + // msg marshals PatternFlowSnmpv2CBulkPDURequestIdCounter to protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter + // setMsg unmarshals PatternFlowSnmpv2CBulkPDURequestIdCounter from protobuf object *otg.PatternFlowSnmpv2CBulkPDURequestIdCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CBulkPDURequestIdCounter) PatternFlowSnmpv2CBulkPDURequestIdCounter + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CBulkPDURequestIdCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CBulkPDURequestIdCounter + // validate validates PatternFlowSnmpv2CBulkPDURequestIdCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CBulkPDURequestIdCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns int32, set in PatternFlowSnmpv2CBulkPDURequestIdCounter. + Start() int32 + // SetStart assigns int32 provided by user to PatternFlowSnmpv2CBulkPDURequestIdCounter + SetStart(value int32) PatternFlowSnmpv2CBulkPDURequestIdCounter + // HasStart checks if Start has been set in PatternFlowSnmpv2CBulkPDURequestIdCounter + HasStart() bool + // Step returns int32, set in PatternFlowSnmpv2CBulkPDURequestIdCounter. + Step() int32 + // SetStep assigns int32 provided by user to PatternFlowSnmpv2CBulkPDURequestIdCounter + SetStep(value int32) PatternFlowSnmpv2CBulkPDURequestIdCounter + // HasStep checks if Step has been set in PatternFlowSnmpv2CBulkPDURequestIdCounter + HasStep() bool + // Count returns int32, set in PatternFlowSnmpv2CBulkPDURequestIdCounter. + Count() int32 + // SetCount assigns int32 provided by user to PatternFlowSnmpv2CBulkPDURequestIdCounter + SetCount(value int32) PatternFlowSnmpv2CBulkPDURequestIdCounter + // HasCount checks if Count has been set in PatternFlowSnmpv2CBulkPDURequestIdCounter + HasCount() bool +} + +// description is TBD +// Start returns a int32 +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) Start() int32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a int32 +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the int32 value in the PatternFlowSnmpv2CBulkPDURequestIdCounter object +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) SetStart(value int32) PatternFlowSnmpv2CBulkPDURequestIdCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a int32 +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) Step() int32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a int32 +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the int32 value in the PatternFlowSnmpv2CBulkPDURequestIdCounter object +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) SetStep(value int32) PatternFlowSnmpv2CBulkPDURequestIdCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a int32 +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) Count() int32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a int32 +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the int32 value in the PatternFlowSnmpv2CBulkPDURequestIdCounter object +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) SetCount(value int32) PatternFlowSnmpv2CBulkPDURequestIdCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowSnmpv2CBulkPDURequestIdCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_big_counter_value.go b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_big_counter_value.go new file mode 100644 index 00000000..1e50ce2c --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_big_counter_value.go @@ -0,0 +1,531 @@ +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" +) + +// ***** PatternFlowSnmpv2CVariableBindingValueBigCounterValue ***** +type patternFlowSnmpv2CVariableBindingValueBigCounterValue struct { + validation + obj *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue + marshaller marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue + unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue + incrementHolder PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + decrementHolder PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter +} + +func NewPatternFlowSnmpv2CVariableBindingValueBigCounterValue() PatternFlowSnmpv2CVariableBindingValueBigCounterValue { + obj := patternFlowSnmpv2CVariableBindingValueBigCounterValue{obj: &otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) msg() *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue { + return obj.obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue) PatternFlowSnmpv2CVariableBindingValueBigCounterValue { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue struct { + obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue +} + +type marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue interface { + // ToProto marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue + ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue, error) + // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue struct { + obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue +} + +type unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue interface { + // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue + FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue) (PatternFlowSnmpv2CVariableBindingValueBigCounterValue, error) + // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue) (PatternFlowSnmpv2CVariableBindingValueBigCounterValue, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValue) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Clone() (PatternFlowSnmpv2CVariableBindingValueBigCounterValue, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CVariableBindingValueBigCounterValue() + 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 +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowSnmpv2CVariableBindingValueBigCounterValue is big counter returned for the requested OID. +type PatternFlowSnmpv2CVariableBindingValueBigCounterValue interface { + Validation + // msg marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue + // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue) PatternFlowSnmpv2CVariableBindingValueBigCounterValue + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValue + // validate validates PatternFlowSnmpv2CVariableBindingValueBigCounterValue + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CVariableBindingValueBigCounterValue, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue + Choice() PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum + // setChoice assigns PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValue + setChoice(value PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueBigCounterValue + // HasChoice checks if Choice has been set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue + HasChoice() bool + // Value returns uint64, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue. + Value() uint64 + // SetValue assigns uint64 provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValue + SetValue(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValue + // HasValue checks if Value has been set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue + HasValue() bool + // Values returns []uint64, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue. + Values() []uint64 + // SetValues assigns []uint64 provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValue + SetValues(value []uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValue + // Increment returns PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue. + Increment() PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + // SetIncrement assigns PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValue. + SetIncrement(value PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueBigCounterValue + // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue + HasIncrement() bool + // Decrement returns PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue. + Decrement() PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + // SetDecrement assigns PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValue. + SetDecrement(value PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueBigCounterValue + // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CVariableBindingValueBigCounterValue + HasDecrement() bool + setNil() +} + +type PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum string + +// Enum of Choice on PatternFlowSnmpv2CVariableBindingValueBigCounterValue +var PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice = struct { + VALUE PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum + VALUES PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum + INCREMENT PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum + DECREMENT PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum +}{ + VALUE: PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum("value"), + VALUES: PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum("values"), + INCREMENT: PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum("increment"), + DECREMENT: PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum("decrement"), +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Choice() PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum { + return PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) setChoice(value PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueBigCounterValue { + intValue, ok := otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUE { + defaultValue := uint64(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUES { + defaultValue := []uint64{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter().msg() + } + + if value == PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint64 +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Value() uint64 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint64 +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint64 value in the PatternFlowSnmpv2CVariableBindingValueBigCounterValue object +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) SetValue(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint64 +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Values() []uint64 { + if obj.obj.Values == nil { + obj.SetValues([]uint64{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint64 value in the PatternFlowSnmpv2CVariableBindingValueBigCounterValue object +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) SetValues(value []uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint64, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Increment() PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter value in the PatternFlowSnmpv2CVariableBindingValueBigCounterValue object +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) SetIncrement(value PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueBigCounterValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) Decrement() PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter value in the PatternFlowSnmpv2CVariableBindingValueBigCounterValue object +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) SetDecrement(value PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueBigCounterValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValue) setDefault() { + var choices_set int = 0 + var choice PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueBigCounterValueChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CVariableBindingValueBigCounterValue") + } + } else { + intVal := otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValue_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_big_counter_value_counter.go b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_big_counter_value_counter.go new file mode 100644 index 00000000..201a73a7 --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_big_counter_value_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter ***** +type patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter struct { + validation + obj *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + marshaller marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter +} + +func NewPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter() PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { + obj := patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter{obj: &otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) msg() *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { + return obj.obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter struct { + obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter +} + +type marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter interface { + // ToProto marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, error) + // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter struct { + obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter +} + +type unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter interface { + // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) (PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, error) + // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) (PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) 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 *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) Clone() (PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter() + 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 +} + +// PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter is integer counter pattern +type PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter interface { + Validation + // msg marshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + // validate validates PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint64, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter. + Start() uint64 + // SetStart assigns uint64 provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + SetStart(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + // HasStart checks if Start has been set in PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + HasStart() bool + // Step returns uint64, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter. + Step() uint64 + // SetStep assigns uint64 provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + SetStep(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + // HasStep checks if Step has been set in PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + HasStep() bool + // Count returns uint64, set in PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter. + Count() uint64 + // SetCount assigns uint64 provided by user to PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + SetCount(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + // HasCount checks if Count has been set in PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint64 +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) Start() uint64 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint64 +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint64 value in the PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) SetStart(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint64 +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) Step() uint64 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint64 +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint64 value in the PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) SetStep(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint64 +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) Count() uint64 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint64 +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint64 value in the PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) SetCount(value uint64) PatternFlowSnmpv2CVariableBindingValueBigCounterValueCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowSnmpv2CVariableBindingValueBigCounterValueCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_counter_value.go b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_counter_value.go new file mode 100644 index 00000000..06dd8710 --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_counter_value.go @@ -0,0 +1,531 @@ +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" +) + +// ***** PatternFlowSnmpv2CVariableBindingValueCounterValue ***** +type patternFlowSnmpv2CVariableBindingValueCounterValue struct { + validation + obj *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue + marshaller marshalPatternFlowSnmpv2CVariableBindingValueCounterValue + unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValue + incrementHolder PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + decrementHolder PatternFlowSnmpv2CVariableBindingValueCounterValueCounter +} + +func NewPatternFlowSnmpv2CVariableBindingValueCounterValue() PatternFlowSnmpv2CVariableBindingValueCounterValue { + obj := patternFlowSnmpv2CVariableBindingValueCounterValue{obj: &otg.PatternFlowSnmpv2CVariableBindingValueCounterValue{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) msg() *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue { + return obj.obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue) PatternFlowSnmpv2CVariableBindingValueCounterValue { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CVariableBindingValueCounterValue struct { + obj *patternFlowSnmpv2CVariableBindingValueCounterValue +} + +type marshalPatternFlowSnmpv2CVariableBindingValueCounterValue interface { + // ToProto marshals PatternFlowSnmpv2CVariableBindingValueCounterValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue + ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueCounterValue, error) + // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueCounterValue to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueCounterValue to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CVariableBindingValueCounterValue to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValue struct { + obj *patternFlowSnmpv2CVariableBindingValueCounterValue +} + +type unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValue interface { + // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue + FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue) (PatternFlowSnmpv2CVariableBindingValueCounterValue, error) + // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValue from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValue from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValue from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueCounterValue { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueCounterValue{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValue { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValue{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueCounterValue) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueCounterValue, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValue) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue) (PatternFlowSnmpv2CVariableBindingValueCounterValue, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueCounterValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValue) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueCounterValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValue) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueCounterValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValue) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Clone() (PatternFlowSnmpv2CVariableBindingValueCounterValue, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CVariableBindingValueCounterValue() + 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 +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowSnmpv2CVariableBindingValueCounterValue is counter returned for the requested OID. +type PatternFlowSnmpv2CVariableBindingValueCounterValue interface { + Validation + // msg marshals PatternFlowSnmpv2CVariableBindingValueCounterValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue + // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValue + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueCounterValue) PatternFlowSnmpv2CVariableBindingValueCounterValue + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CVariableBindingValueCounterValue + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValue + // validate validates PatternFlowSnmpv2CVariableBindingValueCounterValue + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CVariableBindingValueCounterValue, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum, set in PatternFlowSnmpv2CVariableBindingValueCounterValue + Choice() PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum + // setChoice assigns PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValue + setChoice(value PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueCounterValue + // HasChoice checks if Choice has been set in PatternFlowSnmpv2CVariableBindingValueCounterValue + HasChoice() bool + // Value returns uint32, set in PatternFlowSnmpv2CVariableBindingValueCounterValue. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValue + SetValue(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValue + // HasValue checks if Value has been set in PatternFlowSnmpv2CVariableBindingValueCounterValue + HasValue() bool + // Values returns []uint32, set in PatternFlowSnmpv2CVariableBindingValueCounterValue. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValue + SetValues(value []uint32) PatternFlowSnmpv2CVariableBindingValueCounterValue + // Increment returns PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, set in PatternFlowSnmpv2CVariableBindingValueCounterValue. + Increment() PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + // SetIncrement assigns PatternFlowSnmpv2CVariableBindingValueCounterValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValue. + SetIncrement(value PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueCounterValue + // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CVariableBindingValueCounterValue + HasIncrement() bool + // Decrement returns PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, set in PatternFlowSnmpv2CVariableBindingValueCounterValue. + Decrement() PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + // SetDecrement assigns PatternFlowSnmpv2CVariableBindingValueCounterValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValue. + SetDecrement(value PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueCounterValue + // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CVariableBindingValueCounterValue + HasDecrement() bool + setNil() +} + +type PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum string + +// Enum of Choice on PatternFlowSnmpv2CVariableBindingValueCounterValue +var PatternFlowSnmpv2CVariableBindingValueCounterValueChoice = struct { + VALUE PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum + VALUES PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum + INCREMENT PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum + DECREMENT PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum +}{ + VALUE: PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum("value"), + VALUES: PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum("values"), + INCREMENT: PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum("increment"), + DECREMENT: PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum("decrement"), +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Choice() PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum { + return PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) setChoice(value PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueCounterValue { + intValue, ok := otg.PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowSnmpv2CVariableBindingValueCounterValueCounter().msg() + } + + if value == PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowSnmpv2CVariableBindingValueCounterValueCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueCounterValue object +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) SetValue(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowSnmpv2CVariableBindingValueCounterValue object +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) SetValues(value []uint32) PatternFlowSnmpv2CVariableBindingValueCounterValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CVariableBindingValueCounterValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Increment() PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowSnmpv2CVariableBindingValueCounterValueCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CVariableBindingValueCounterValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowSnmpv2CVariableBindingValueCounterValueCounter value in the PatternFlowSnmpv2CVariableBindingValueCounterValue object +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) SetIncrement(value PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueCounterValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CVariableBindingValueCounterValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) Decrement() PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowSnmpv2CVariableBindingValueCounterValueCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CVariableBindingValueCounterValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowSnmpv2CVariableBindingValueCounterValueCounter value in the PatternFlowSnmpv2CVariableBindingValueCounterValue object +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) SetDecrement(value PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueCounterValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValue) setDefault() { + var choices_set int = 0 + var choice PatternFlowSnmpv2CVariableBindingValueCounterValueChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueCounterValueChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CVariableBindingValueCounterValue") + } + } else { + intVal := otg.PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowSnmpv2CVariableBindingValueCounterValue_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_counter_value_counter.go b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_counter_value_counter.go new file mode 100644 index 00000000..2dad6c14 --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_counter_value_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowSnmpv2CVariableBindingValueCounterValueCounter ***** +type patternFlowSnmpv2CVariableBindingValueCounterValueCounter struct { + validation + obj *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + marshaller marshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter + unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter +} + +func NewPatternFlowSnmpv2CVariableBindingValueCounterValueCounter() PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { + obj := patternFlowSnmpv2CVariableBindingValueCounterValueCounter{obj: &otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) msg() *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { + return obj.obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter struct { + obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter +} + +type marshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter interface { + // ToProto marshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, error) + // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter struct { + obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter +} + +type unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter interface { + // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) (PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, error) + // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) (PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueCounterValueCounter) 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 *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) Clone() (PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CVariableBindingValueCounterValueCounter() + 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 +} + +// PatternFlowSnmpv2CVariableBindingValueCounterValueCounter is integer counter pattern +type PatternFlowSnmpv2CVariableBindingValueCounterValueCounter interface { + Validation + // msg marshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueCounterValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueCounterValueCounter) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueCounterValueCounter + // validate validates PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CVariableBindingValueCounterValueCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowSnmpv2CVariableBindingValueCounterValueCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + SetStart(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + // HasStart checks if Start has been set in PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + HasStart() bool + // Step returns uint32, set in PatternFlowSnmpv2CVariableBindingValueCounterValueCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + SetStep(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + // HasStep checks if Step has been set in PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + HasStep() bool + // Count returns uint32, set in PatternFlowSnmpv2CVariableBindingValueCounterValueCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + // HasCount checks if Count has been set in PatternFlowSnmpv2CVariableBindingValueCounterValueCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueCounterValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) SetStart(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueCounterValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) SetStep(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueCounterValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueCounterValueCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowSnmpv2CVariableBindingValueCounterValueCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_integer_value.go b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_integer_value.go new file mode 100644 index 00000000..37690938 --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_integer_value.go @@ -0,0 +1,531 @@ +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" +) + +// ***** PatternFlowSnmpv2CVariableBindingValueIntegerValue ***** +type patternFlowSnmpv2CVariableBindingValueIntegerValue struct { + validation + obj *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue + marshaller marshalPatternFlowSnmpv2CVariableBindingValueIntegerValue + unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValue + incrementHolder PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + decrementHolder PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter +} + +func NewPatternFlowSnmpv2CVariableBindingValueIntegerValue() PatternFlowSnmpv2CVariableBindingValueIntegerValue { + obj := patternFlowSnmpv2CVariableBindingValueIntegerValue{obj: &otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) msg() *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue { + return obj.obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue) PatternFlowSnmpv2CVariableBindingValueIntegerValue { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CVariableBindingValueIntegerValue struct { + obj *patternFlowSnmpv2CVariableBindingValueIntegerValue +} + +type marshalPatternFlowSnmpv2CVariableBindingValueIntegerValue interface { + // ToProto marshals PatternFlowSnmpv2CVariableBindingValueIntegerValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue + ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue, error) + // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueIntegerValue to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueIntegerValue to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CVariableBindingValueIntegerValue to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValue struct { + obj *patternFlowSnmpv2CVariableBindingValueIntegerValue +} + +type unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValue interface { + // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue + FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue) (PatternFlowSnmpv2CVariableBindingValueIntegerValue, error) + // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValue from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValue from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValue from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIntegerValue { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueIntegerValue{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValue { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValue{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue) (PatternFlowSnmpv2CVariableBindingValueIntegerValue, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValue) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Clone() (PatternFlowSnmpv2CVariableBindingValueIntegerValue, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CVariableBindingValueIntegerValue() + 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 +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowSnmpv2CVariableBindingValueIntegerValue is integer value returned for the requested OID. +type PatternFlowSnmpv2CVariableBindingValueIntegerValue interface { + Validation + // msg marshals PatternFlowSnmpv2CVariableBindingValueIntegerValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue + // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue) PatternFlowSnmpv2CVariableBindingValueIntegerValue + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIntegerValue + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValue + // validate validates PatternFlowSnmpv2CVariableBindingValueIntegerValue + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CVariableBindingValueIntegerValue, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum, set in PatternFlowSnmpv2CVariableBindingValueIntegerValue + Choice() PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum + // setChoice assigns PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValue + setChoice(value PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueIntegerValue + // HasChoice checks if Choice has been set in PatternFlowSnmpv2CVariableBindingValueIntegerValue + HasChoice() bool + // Value returns int32, set in PatternFlowSnmpv2CVariableBindingValueIntegerValue. + Value() int32 + // SetValue assigns int32 provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValue + SetValue(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValue + // HasValue checks if Value has been set in PatternFlowSnmpv2CVariableBindingValueIntegerValue + HasValue() bool + // Values returns []int32, set in PatternFlowSnmpv2CVariableBindingValueIntegerValue. + Values() []int32 + // SetValues assigns []int32 provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValue + SetValues(value []int32) PatternFlowSnmpv2CVariableBindingValueIntegerValue + // Increment returns PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, set in PatternFlowSnmpv2CVariableBindingValueIntegerValue. + Increment() PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + // SetIncrement assigns PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValue. + SetIncrement(value PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueIntegerValue + // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CVariableBindingValueIntegerValue + HasIncrement() bool + // Decrement returns PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, set in PatternFlowSnmpv2CVariableBindingValueIntegerValue. + Decrement() PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + // SetDecrement assigns PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValue. + SetDecrement(value PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueIntegerValue + // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CVariableBindingValueIntegerValue + HasDecrement() bool + setNil() +} + +type PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum string + +// Enum of Choice on PatternFlowSnmpv2CVariableBindingValueIntegerValue +var PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice = struct { + VALUE PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum + VALUES PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum + INCREMENT PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum + DECREMENT PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum +}{ + VALUE: PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum("value"), + VALUES: PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum("values"), + INCREMENT: PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum("increment"), + DECREMENT: PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum("decrement"), +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Choice() PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum { + return PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) setChoice(value PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueIntegerValue { + intValue, ok := otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUE { + defaultValue := int32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUES { + defaultValue := []int32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter().msg() + } + + if value == PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a int32 +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Value() int32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a int32 +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the int32 value in the PatternFlowSnmpv2CVariableBindingValueIntegerValue object +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) SetValue(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []int32 +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Values() []int32 { + if obj.obj.Values == nil { + obj.SetValues([]int32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []int32 value in the PatternFlowSnmpv2CVariableBindingValueIntegerValue object +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) SetValues(value []int32) PatternFlowSnmpv2CVariableBindingValueIntegerValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]int32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Increment() PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowSnmpv2CVariableBindingValueIntegerValueCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter value in the PatternFlowSnmpv2CVariableBindingValueIntegerValue object +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) SetIncrement(value PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueIntegerValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) Decrement() PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowSnmpv2CVariableBindingValueIntegerValueCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter value in the PatternFlowSnmpv2CVariableBindingValueIntegerValue object +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) SetDecrement(value PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueIntegerValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValue) setDefault() { + var choices_set int = 0 + var choice PatternFlowSnmpv2CVariableBindingValueIntegerValueChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIntegerValueChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CVariableBindingValueIntegerValue") + } + } else { + intVal := otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowSnmpv2CVariableBindingValueIntegerValue_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_integer_value_counter.go b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_integer_value_counter.go new file mode 100644 index 00000000..9413a4a6 --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_integer_value_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter ***** +type patternFlowSnmpv2CVariableBindingValueIntegerValueCounter struct { + validation + obj *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + marshaller marshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter +} + +func NewPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter() PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { + obj := patternFlowSnmpv2CVariableBindingValueIntegerValueCounter{obj: &otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) msg() *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { + return obj.obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter struct { + obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter +} + +type marshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter interface { + // ToProto marshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, error) + // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter struct { + obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter +} + +type unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter interface { + // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) (PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, error) + // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) (PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) 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 *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) Clone() (PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter() + 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 +} + +// PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter is integer counter pattern +type PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter interface { + Validation + // msg marshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + // validate validates PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns int32, set in PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter. + Start() int32 + // SetStart assigns int32 provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + SetStart(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + // HasStart checks if Start has been set in PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + HasStart() bool + // Step returns int32, set in PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter. + Step() int32 + // SetStep assigns int32 provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + SetStep(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + // HasStep checks if Step has been set in PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + HasStep() bool + // Count returns int32, set in PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter. + Count() int32 + // SetCount assigns int32 provided by user to PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + SetCount(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + // HasCount checks if Count has been set in PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter + HasCount() bool +} + +// description is TBD +// Start returns a int32 +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) Start() int32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a int32 +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the int32 value in the PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) SetStart(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a int32 +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) Step() int32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a int32 +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the int32 value in the PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) SetStep(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a int32 +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) Count() int32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a int32 +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the int32 value in the PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) SetCount(value int32) PatternFlowSnmpv2CVariableBindingValueIntegerValueCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIntegerValueCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_ip_address_value.go b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_ip_address_value.go new file mode 100644 index 00000000..611456e6 --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_ip_address_value.go @@ -0,0 +1,549 @@ +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" +) + +// ***** PatternFlowSnmpv2CVariableBindingValueIpAddressValue ***** +type patternFlowSnmpv2CVariableBindingValueIpAddressValue struct { + validation + obj *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue + marshaller marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue + unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue + incrementHolder PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + decrementHolder PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter +} + +func NewPatternFlowSnmpv2CVariableBindingValueIpAddressValue() PatternFlowSnmpv2CVariableBindingValueIpAddressValue { + obj := patternFlowSnmpv2CVariableBindingValueIpAddressValue{obj: &otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) msg() *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue { + return obj.obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue) PatternFlowSnmpv2CVariableBindingValueIpAddressValue { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue struct { + obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue +} + +type marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue interface { + // ToProto marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue + ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue, error) + // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue struct { + obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue +} + +type unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue interface { + // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue + FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue) (PatternFlowSnmpv2CVariableBindingValueIpAddressValue, error) + // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue) (PatternFlowSnmpv2CVariableBindingValueIpAddressValue, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValue) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Clone() (PatternFlowSnmpv2CVariableBindingValueIpAddressValue, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CVariableBindingValueIpAddressValue() + 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 +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowSnmpv2CVariableBindingValueIpAddressValue is iPv4 address returned for the requested OID. +type PatternFlowSnmpv2CVariableBindingValueIpAddressValue interface { + Validation + // msg marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue + // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue) PatternFlowSnmpv2CVariableBindingValueIpAddressValue + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValue + // validate validates PatternFlowSnmpv2CVariableBindingValueIpAddressValue + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CVariableBindingValueIpAddressValue, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue + Choice() PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum + // setChoice assigns PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValue + setChoice(value PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueIpAddressValue + // HasChoice checks if Choice has been set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue + HasChoice() bool + // Value returns string, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue. + Value() string + // SetValue assigns string provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValue + SetValue(value string) PatternFlowSnmpv2CVariableBindingValueIpAddressValue + // HasValue checks if Value has been set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue + HasValue() bool + // Values returns []string, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue. + Values() []string + // SetValues assigns []string provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValue + SetValues(value []string) PatternFlowSnmpv2CVariableBindingValueIpAddressValue + // Increment returns PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue. + Increment() PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + // SetIncrement assigns PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValue. + SetIncrement(value PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) PatternFlowSnmpv2CVariableBindingValueIpAddressValue + // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue + HasIncrement() bool + // Decrement returns PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue. + Decrement() PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + // SetDecrement assigns PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValue. + SetDecrement(value PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) PatternFlowSnmpv2CVariableBindingValueIpAddressValue + // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CVariableBindingValueIpAddressValue + HasDecrement() bool + setNil() +} + +type PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum string + +// Enum of Choice on PatternFlowSnmpv2CVariableBindingValueIpAddressValue +var PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice = struct { + VALUE PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum + VALUES PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum + INCREMENT PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum + DECREMENT PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum +}{ + VALUE: PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum("value"), + VALUES: PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum("values"), + INCREMENT: PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum("increment"), + DECREMENT: PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum("decrement"), +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Choice() PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum { + return PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) setChoice(value PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueIpAddressValue { + intValue, ok := otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUE { + defaultValue := "0.0.0.0" + obj.obj.Value = &defaultValue + } + + if value == PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUES { + defaultValue := []string{"0.0.0.0"} + obj.obj.Values = defaultValue + } + + if value == PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter().msg() + } + + if value == PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a string +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Value() string { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a string +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the string value in the PatternFlowSnmpv2CVariableBindingValueIpAddressValue object +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) SetValue(value string) PatternFlowSnmpv2CVariableBindingValueIpAddressValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []string +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Values() []string { + if obj.obj.Values == nil { + obj.SetValues([]string{"0.0.0.0"}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []string value in the PatternFlowSnmpv2CVariableBindingValueIpAddressValue object +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) SetValues(value []string) PatternFlowSnmpv2CVariableBindingValueIpAddressValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]string, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Increment() PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter value in the PatternFlowSnmpv2CVariableBindingValueIpAddressValue object +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) SetIncrement(value PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) PatternFlowSnmpv2CVariableBindingValueIpAddressValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) Decrement() PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter value in the PatternFlowSnmpv2CVariableBindingValueIpAddressValue object +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) SetDecrement(value PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) PatternFlowSnmpv2CVariableBindingValueIpAddressValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + err := obj.validateIpv4(obj.Value()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowSnmpv2CVariableBindingValueIpAddressValue.Value")) + } + + } + + if obj.obj.Values != nil { + + err := obj.validateIpv4Slice(obj.Values()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowSnmpv2CVariableBindingValueIpAddressValue.Values")) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValue) setDefault() { + var choices_set int = 0 + var choice PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueIpAddressValueChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CVariableBindingValueIpAddressValue") + } + } else { + intVal := otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValue_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_ip_address_value_counter.go b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_ip_address_value_counter.go new file mode 100644 index 00000000..d47f94ce --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_ip_address_value_counter.go @@ -0,0 +1,389 @@ +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" +) + +// ***** PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter ***** +type patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter struct { + validation + obj *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + marshaller marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter +} + +func NewPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter() PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { + obj := patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter{obj: &otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) msg() *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { + return obj.obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter struct { + obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter +} + +type marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter interface { + // ToProto marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, error) + // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter struct { + obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter +} + +type unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter interface { + // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) (PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, error) + // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) (PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) 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 *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) Clone() (PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter() + 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 +} + +// PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter is ipv4 counter pattern +type PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter interface { + Validation + // msg marshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + // validate validates PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns string, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter. + Start() string + // SetStart assigns string provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + SetStart(value string) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + // HasStart checks if Start has been set in PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + HasStart() bool + // Step returns string, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter. + Step() string + // SetStep assigns string provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + SetStep(value string) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + // HasStep checks if Step has been set in PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + HasStep() bool + // Count returns uint32, set in PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + // HasCount checks if Count has been set in PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter + HasCount() bool +} + +// description is TBD +// Start returns a string +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) Start() string { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a string +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the string value in the PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) SetStart(value string) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a string +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) Step() string { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a string +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the string value in the PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) SetStep(value string) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + err := obj.validateIpv4(obj.Start()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter.Start")) + } + + } + + if obj.obj.Step != nil { + + err := obj.validateIpv4(obj.Step()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on PatternFlowSnmpv2CVariableBindingValueIpAddressValueCounter.Step")) + } + + } + +} + +func (obj *patternFlowSnmpv2CVariableBindingValueIpAddressValueCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart("0.0.0.0") + } + if obj.obj.Step == nil { + obj.SetStep("0.0.0.1") + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_timeticks_value.go b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_timeticks_value.go new file mode 100644 index 00000000..6fdb5e44 --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_timeticks_value.go @@ -0,0 +1,531 @@ +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" +) + +// ***** PatternFlowSnmpv2CVariableBindingValueTimeticksValue ***** +type patternFlowSnmpv2CVariableBindingValueTimeticksValue struct { + validation + obj *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue + marshaller marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue + unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue + incrementHolder PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + decrementHolder PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter +} + +func NewPatternFlowSnmpv2CVariableBindingValueTimeticksValue() PatternFlowSnmpv2CVariableBindingValueTimeticksValue { + obj := patternFlowSnmpv2CVariableBindingValueTimeticksValue{obj: &otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) msg() *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue { + return obj.obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue) PatternFlowSnmpv2CVariableBindingValueTimeticksValue { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue struct { + obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue +} + +type marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue interface { + // ToProto marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue + ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue, error) + // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue struct { + obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue +} + +type unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue interface { + // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue + FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue) (PatternFlowSnmpv2CVariableBindingValueTimeticksValue, error) + // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue) (PatternFlowSnmpv2CVariableBindingValueTimeticksValue, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValue) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Clone() (PatternFlowSnmpv2CVariableBindingValueTimeticksValue, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CVariableBindingValueTimeticksValue() + 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 +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowSnmpv2CVariableBindingValueTimeticksValue is timeticks returned for the requested OID. +type PatternFlowSnmpv2CVariableBindingValueTimeticksValue interface { + Validation + // msg marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue + // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue) PatternFlowSnmpv2CVariableBindingValueTimeticksValue + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValue + // validate validates PatternFlowSnmpv2CVariableBindingValueTimeticksValue + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CVariableBindingValueTimeticksValue, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue + Choice() PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum + // setChoice assigns PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValue + setChoice(value PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueTimeticksValue + // HasChoice checks if Choice has been set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue + HasChoice() bool + // Value returns uint32, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValue + SetValue(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValue + // HasValue checks if Value has been set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue + HasValue() bool + // Values returns []uint32, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValue + SetValues(value []uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValue + // Increment returns PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue. + Increment() PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + // SetIncrement assigns PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValue. + SetIncrement(value PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) PatternFlowSnmpv2CVariableBindingValueTimeticksValue + // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue + HasIncrement() bool + // Decrement returns PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue. + Decrement() PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + // SetDecrement assigns PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValue. + SetDecrement(value PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) PatternFlowSnmpv2CVariableBindingValueTimeticksValue + // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CVariableBindingValueTimeticksValue + HasDecrement() bool + setNil() +} + +type PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum string + +// Enum of Choice on PatternFlowSnmpv2CVariableBindingValueTimeticksValue +var PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice = struct { + VALUE PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum + VALUES PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum + INCREMENT PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum + DECREMENT PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum +}{ + VALUE: PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum("value"), + VALUES: PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum("values"), + INCREMENT: PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum("increment"), + DECREMENT: PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum("decrement"), +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Choice() PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum { + return PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) setChoice(value PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueTimeticksValue { + intValue, ok := otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter().msg() + } + + if value == PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueTimeticksValue object +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) SetValue(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowSnmpv2CVariableBindingValueTimeticksValue object +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) SetValues(value []uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Increment() PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter value in the PatternFlowSnmpv2CVariableBindingValueTimeticksValue object +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) SetIncrement(value PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) PatternFlowSnmpv2CVariableBindingValueTimeticksValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) Decrement() PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter value in the PatternFlowSnmpv2CVariableBindingValueTimeticksValue object +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) SetDecrement(value PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) PatternFlowSnmpv2CVariableBindingValueTimeticksValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValue) setDefault() { + var choices_set int = 0 + var choice PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueTimeticksValueChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CVariableBindingValueTimeticksValue") + } + } else { + intVal := otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValue_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_timeticks_value_counter.go b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_timeticks_value_counter.go new file mode 100644 index 00000000..c9cdb909 --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_timeticks_value_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter ***** +type patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter struct { + validation + obj *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + marshaller marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter +} + +func NewPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter() PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { + obj := patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter{obj: &otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) msg() *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { + return obj.obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter struct { + obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter +} + +type marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter interface { + // ToProto marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, error) + // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter struct { + obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter +} + +type unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter interface { + // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) (PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, error) + // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) (PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) 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 *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) Clone() (PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter() + 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 +} + +// PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter is integer counter pattern +type PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter interface { + Validation + // msg marshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + // validate validates PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + SetStart(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + // HasStart checks if Start has been set in PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + HasStart() bool + // Step returns uint32, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + SetStep(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + // HasStep checks if Step has been set in PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + HasStep() bool + // Count returns uint32, set in PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + // HasCount checks if Count has been set in PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) SetStart(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) SetStep(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueTimeticksValueCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowSnmpv2CVariableBindingValueTimeticksValueCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_unsigned_integer_value.go b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_unsigned_integer_value.go new file mode 100644 index 00000000..ede2f18c --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_unsigned_integer_value.go @@ -0,0 +1,531 @@ +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" +) + +// ***** PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue ***** +type patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue struct { + validation + obj *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + marshaller marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + incrementHolder PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + decrementHolder PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter +} + +func NewPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { + obj := patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue{obj: &otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) msg() *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { + return obj.obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue struct { + obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue +} + +type marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue interface { + // ToProto marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue, error) + // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue struct { + obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue +} + +type unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue interface { + // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue, error) + // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Clone() (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue() + 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 +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue is unsigned integer value returned for the requested OID. +type PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue interface { + Validation + // msg marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + // validate validates PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + Choice() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum + // setChoice assigns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + setChoice(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + // HasChoice checks if Choice has been set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + HasChoice() bool + // Value returns uint32, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + SetValue(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + // HasValue checks if Value has been set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + HasValue() bool + // Values returns []uint32, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + SetValues(value []uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + // Increment returns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue. + Increment() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + // SetIncrement assigns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue. + SetIncrement(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + HasIncrement() bool + // Decrement returns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue. + Decrement() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + // SetDecrement assigns PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue. + SetDecrement(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue + HasDecrement() bool + setNil() +} + +type PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum string + +// Enum of Choice on PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue +var PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice = struct { + VALUE PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum + VALUES PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum + INCREMENT PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum + DECREMENT PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum +}{ + VALUE: PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum("value"), + VALUES: PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum("values"), + INCREMENT: PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum("increment"), + DECREMENT: PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum("decrement"), +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Choice() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum { + return PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) setChoice(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { + intValue, ok := otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter().msg() + } + + if value == PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue object +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) SetValue(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue object +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) SetValues(value []uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Increment() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter value in the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue object +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) SetIncrement(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) Decrement() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter value in the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue object +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) SetDecrement(value PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue) setDefault() { + var choices_set int = 0 + var choice PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue") + } + } else { + intVal := otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValue_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_unsigned_integer_value_counter.go b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_unsigned_integer_value_counter.go new file mode 100644 index 00000000..131086ff --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_variable_binding_value_unsigned_integer_value_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter ***** +type patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter struct { + validation + obj *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + marshaller marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + unMarshaller unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter +} + +func NewPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter() PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { + obj := patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter{obj: &otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) msg() *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { + return obj.obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) setMsg(msg *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter struct { + obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter +} + +type marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter interface { + // ToProto marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, error) + // ToPbText marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter struct { + obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter +} + +type unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter interface { + // FromProto unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, error) + // FromPbText unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Marshal() marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) ToProto() (*otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) FromProto(msg *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) 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 *marshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) 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 *unMarshalpatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) 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 *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Clone() (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter() + 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 +} + +// PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter is integer counter pattern +type PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter interface { + Validation + // msg marshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter to protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + // setMsg unmarshals PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter from protobuf object *otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + // validate validates PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + SetStart(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + // HasStart checks if Start has been set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + HasStart() bool + // Step returns uint32, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + SetStep(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + // HasStep checks if Step has been set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + HasStep() bool + // Count returns uint32, set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + // HasCount checks if Count has been set in PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) SetStart(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) SetStep(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter object +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) SetCount(value uint32) PatternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowSnmpv2CVariableBindingValueUnsignedIntegerValueCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_version.go b/gosnappi/pattern_flow_snmpv2_c_version.go new file mode 100644 index 00000000..28b27638 --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_version.go @@ -0,0 +1,554 @@ +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" +) + +// ***** PatternFlowSnmpv2CVersion ***** +type patternFlowSnmpv2CVersion struct { + validation + obj *otg.PatternFlowSnmpv2CVersion + marshaller marshalPatternFlowSnmpv2CVersion + unMarshaller unMarshalPatternFlowSnmpv2CVersion + incrementHolder PatternFlowSnmpv2CVersionCounter + decrementHolder PatternFlowSnmpv2CVersionCounter +} + +func NewPatternFlowSnmpv2CVersion() PatternFlowSnmpv2CVersion { + obj := patternFlowSnmpv2CVersion{obj: &otg.PatternFlowSnmpv2CVersion{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CVersion) msg() *otg.PatternFlowSnmpv2CVersion { + return obj.obj +} + +func (obj *patternFlowSnmpv2CVersion) setMsg(msg *otg.PatternFlowSnmpv2CVersion) PatternFlowSnmpv2CVersion { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CVersion struct { + obj *patternFlowSnmpv2CVersion +} + +type marshalPatternFlowSnmpv2CVersion interface { + // ToProto marshals PatternFlowSnmpv2CVersion to protobuf object *otg.PatternFlowSnmpv2CVersion + ToProto() (*otg.PatternFlowSnmpv2CVersion, error) + // ToPbText marshals PatternFlowSnmpv2CVersion to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CVersion to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CVersion to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CVersion struct { + obj *patternFlowSnmpv2CVersion +} + +type unMarshalPatternFlowSnmpv2CVersion interface { + // FromProto unmarshals PatternFlowSnmpv2CVersion from protobuf object *otg.PatternFlowSnmpv2CVersion + FromProto(msg *otg.PatternFlowSnmpv2CVersion) (PatternFlowSnmpv2CVersion, error) + // FromPbText unmarshals PatternFlowSnmpv2CVersion from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CVersion from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CVersion from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CVersion) Marshal() marshalPatternFlowSnmpv2CVersion { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CVersion{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CVersion) Unmarshal() unMarshalPatternFlowSnmpv2CVersion { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVersion{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CVersion) ToProto() (*otg.PatternFlowSnmpv2CVersion, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CVersion) FromProto(msg *otg.PatternFlowSnmpv2CVersion) (PatternFlowSnmpv2CVersion, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CVersion) 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 *unMarshalpatternFlowSnmpv2CVersion) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowSnmpv2CVersion) 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 *unMarshalpatternFlowSnmpv2CVersion) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowSnmpv2CVersion) 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 *unMarshalpatternFlowSnmpv2CVersion) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowSnmpv2CVersion) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVersion) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVersion) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CVersion) Clone() (PatternFlowSnmpv2CVersion, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CVersion() + 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 +} + +func (obj *patternFlowSnmpv2CVersion) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowSnmpv2CVersion is version +type PatternFlowSnmpv2CVersion interface { + Validation + // msg marshals PatternFlowSnmpv2CVersion to protobuf object *otg.PatternFlowSnmpv2CVersion + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CVersion + // setMsg unmarshals PatternFlowSnmpv2CVersion from protobuf object *otg.PatternFlowSnmpv2CVersion + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CVersion) PatternFlowSnmpv2CVersion + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CVersion + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CVersion + // validate validates PatternFlowSnmpv2CVersion + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CVersion, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowSnmpv2CVersionChoiceEnum, set in PatternFlowSnmpv2CVersion + Choice() PatternFlowSnmpv2CVersionChoiceEnum + // setChoice assigns PatternFlowSnmpv2CVersionChoiceEnum provided by user to PatternFlowSnmpv2CVersion + setChoice(value PatternFlowSnmpv2CVersionChoiceEnum) PatternFlowSnmpv2CVersion + // HasChoice checks if Choice has been set in PatternFlowSnmpv2CVersion + HasChoice() bool + // Value returns uint32, set in PatternFlowSnmpv2CVersion. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowSnmpv2CVersion + SetValue(value uint32) PatternFlowSnmpv2CVersion + // HasValue checks if Value has been set in PatternFlowSnmpv2CVersion + HasValue() bool + // Values returns []uint32, set in PatternFlowSnmpv2CVersion. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowSnmpv2CVersion + SetValues(value []uint32) PatternFlowSnmpv2CVersion + // Increment returns PatternFlowSnmpv2CVersionCounter, set in PatternFlowSnmpv2CVersion. + Increment() PatternFlowSnmpv2CVersionCounter + // SetIncrement assigns PatternFlowSnmpv2CVersionCounter provided by user to PatternFlowSnmpv2CVersion. + SetIncrement(value PatternFlowSnmpv2CVersionCounter) PatternFlowSnmpv2CVersion + // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CVersion + HasIncrement() bool + // Decrement returns PatternFlowSnmpv2CVersionCounter, set in PatternFlowSnmpv2CVersion. + Decrement() PatternFlowSnmpv2CVersionCounter + // SetDecrement assigns PatternFlowSnmpv2CVersionCounter provided by user to PatternFlowSnmpv2CVersion. + SetDecrement(value PatternFlowSnmpv2CVersionCounter) PatternFlowSnmpv2CVersion + // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CVersion + HasDecrement() bool + setNil() +} + +type PatternFlowSnmpv2CVersionChoiceEnum string + +// Enum of Choice on PatternFlowSnmpv2CVersion +var PatternFlowSnmpv2CVersionChoice = struct { + VALUE PatternFlowSnmpv2CVersionChoiceEnum + VALUES PatternFlowSnmpv2CVersionChoiceEnum + INCREMENT PatternFlowSnmpv2CVersionChoiceEnum + DECREMENT PatternFlowSnmpv2CVersionChoiceEnum +}{ + VALUE: PatternFlowSnmpv2CVersionChoiceEnum("value"), + VALUES: PatternFlowSnmpv2CVersionChoiceEnum("values"), + INCREMENT: PatternFlowSnmpv2CVersionChoiceEnum("increment"), + DECREMENT: PatternFlowSnmpv2CVersionChoiceEnum("decrement"), +} + +func (obj *patternFlowSnmpv2CVersion) Choice() PatternFlowSnmpv2CVersionChoiceEnum { + return PatternFlowSnmpv2CVersionChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowSnmpv2CVersion) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowSnmpv2CVersion) setChoice(value PatternFlowSnmpv2CVersionChoiceEnum) PatternFlowSnmpv2CVersion { + intValue, ok := otg.PatternFlowSnmpv2CVersion_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowSnmpv2CVersionChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowSnmpv2CVersion_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowSnmpv2CVersionChoice.VALUE { + defaultValue := uint32(1) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowSnmpv2CVersionChoice.VALUES { + defaultValue := []uint32{1} + obj.obj.Values = defaultValue + } + + if value == PatternFlowSnmpv2CVersionChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowSnmpv2CVersionCounter().msg() + } + + if value == PatternFlowSnmpv2CVersionChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowSnmpv2CVersionCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowSnmpv2CVersion) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowSnmpv2CVersionChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowSnmpv2CVersion) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowSnmpv2CVersion object +func (obj *patternFlowSnmpv2CVersion) SetValue(value uint32) PatternFlowSnmpv2CVersion { + obj.setChoice(PatternFlowSnmpv2CVersionChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowSnmpv2CVersion) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{1}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowSnmpv2CVersion object +func (obj *patternFlowSnmpv2CVersion) SetValues(value []uint32) PatternFlowSnmpv2CVersion { + obj.setChoice(PatternFlowSnmpv2CVersionChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CVersionCounter +func (obj *patternFlowSnmpv2CVersion) Increment() PatternFlowSnmpv2CVersionCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowSnmpv2CVersionChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowSnmpv2CVersionCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CVersionCounter +func (obj *patternFlowSnmpv2CVersion) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowSnmpv2CVersionCounter value in the PatternFlowSnmpv2CVersion object +func (obj *patternFlowSnmpv2CVersion) SetIncrement(value PatternFlowSnmpv2CVersionCounter) PatternFlowSnmpv2CVersion { + obj.setChoice(PatternFlowSnmpv2CVersionChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CVersionCounter +func (obj *patternFlowSnmpv2CVersion) Decrement() PatternFlowSnmpv2CVersionCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowSnmpv2CVersionChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowSnmpv2CVersionCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CVersionCounter +func (obj *patternFlowSnmpv2CVersion) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowSnmpv2CVersionCounter value in the PatternFlowSnmpv2CVersion object +func (obj *patternFlowSnmpv2CVersion) SetDecrement(value PatternFlowSnmpv2CVersionCounter) PatternFlowSnmpv2CVersion { + obj.setChoice(PatternFlowSnmpv2CVersionChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowSnmpv2CVersion) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowSnmpv2CVersion.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowSnmpv2CVersion.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowSnmpv2CVersion) setDefault() { + var choices_set int = 0 + var choice PatternFlowSnmpv2CVersionChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVersionChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowSnmpv2CVersionChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVersionChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CVersionChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowSnmpv2CVersionChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CVersion") + } + } else { + intVal := otg.PatternFlowSnmpv2CVersion_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowSnmpv2CVersion_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_c_version_counter.go b/gosnappi/pattern_flow_snmpv2_c_version_counter.go new file mode 100644 index 00000000..0b68a43b --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_c_version_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowSnmpv2CVersionCounter ***** +type patternFlowSnmpv2CVersionCounter struct { + validation + obj *otg.PatternFlowSnmpv2CVersionCounter + marshaller marshalPatternFlowSnmpv2CVersionCounter + unMarshaller unMarshalPatternFlowSnmpv2CVersionCounter +} + +func NewPatternFlowSnmpv2CVersionCounter() PatternFlowSnmpv2CVersionCounter { + obj := patternFlowSnmpv2CVersionCounter{obj: &otg.PatternFlowSnmpv2CVersionCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CVersionCounter) msg() *otg.PatternFlowSnmpv2CVersionCounter { + return obj.obj +} + +func (obj *patternFlowSnmpv2CVersionCounter) setMsg(msg *otg.PatternFlowSnmpv2CVersionCounter) PatternFlowSnmpv2CVersionCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CVersionCounter struct { + obj *patternFlowSnmpv2CVersionCounter +} + +type marshalPatternFlowSnmpv2CVersionCounter interface { + // ToProto marshals PatternFlowSnmpv2CVersionCounter to protobuf object *otg.PatternFlowSnmpv2CVersionCounter + ToProto() (*otg.PatternFlowSnmpv2CVersionCounter, error) + // ToPbText marshals PatternFlowSnmpv2CVersionCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CVersionCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CVersionCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CVersionCounter struct { + obj *patternFlowSnmpv2CVersionCounter +} + +type unMarshalPatternFlowSnmpv2CVersionCounter interface { + // FromProto unmarshals PatternFlowSnmpv2CVersionCounter from protobuf object *otg.PatternFlowSnmpv2CVersionCounter + FromProto(msg *otg.PatternFlowSnmpv2CVersionCounter) (PatternFlowSnmpv2CVersionCounter, error) + // FromPbText unmarshals PatternFlowSnmpv2CVersionCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CVersionCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CVersionCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CVersionCounter) Marshal() marshalPatternFlowSnmpv2CVersionCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CVersionCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CVersionCounter) Unmarshal() unMarshalPatternFlowSnmpv2CVersionCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CVersionCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CVersionCounter) ToProto() (*otg.PatternFlowSnmpv2CVersionCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CVersionCounter) FromProto(msg *otg.PatternFlowSnmpv2CVersionCounter) (PatternFlowSnmpv2CVersionCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CVersionCounter) 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 *unMarshalpatternFlowSnmpv2CVersionCounter) 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 *marshalpatternFlowSnmpv2CVersionCounter) 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 *unMarshalpatternFlowSnmpv2CVersionCounter) 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 *marshalpatternFlowSnmpv2CVersionCounter) 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 *unMarshalpatternFlowSnmpv2CVersionCounter) 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 *patternFlowSnmpv2CVersionCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVersionCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CVersionCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CVersionCounter) Clone() (PatternFlowSnmpv2CVersionCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CVersionCounter() + 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 +} + +// PatternFlowSnmpv2CVersionCounter is integer counter pattern +type PatternFlowSnmpv2CVersionCounter interface { + Validation + // msg marshals PatternFlowSnmpv2CVersionCounter to protobuf object *otg.PatternFlowSnmpv2CVersionCounter + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CVersionCounter + // setMsg unmarshals PatternFlowSnmpv2CVersionCounter from protobuf object *otg.PatternFlowSnmpv2CVersionCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CVersionCounter) PatternFlowSnmpv2CVersionCounter + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CVersionCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CVersionCounter + // validate validates PatternFlowSnmpv2CVersionCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CVersionCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowSnmpv2CVersionCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowSnmpv2CVersionCounter + SetStart(value uint32) PatternFlowSnmpv2CVersionCounter + // HasStart checks if Start has been set in PatternFlowSnmpv2CVersionCounter + HasStart() bool + // Step returns uint32, set in PatternFlowSnmpv2CVersionCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowSnmpv2CVersionCounter + SetStep(value uint32) PatternFlowSnmpv2CVersionCounter + // HasStep checks if Step has been set in PatternFlowSnmpv2CVersionCounter + HasStep() bool + // Count returns uint32, set in PatternFlowSnmpv2CVersionCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowSnmpv2CVersionCounter + SetCount(value uint32) PatternFlowSnmpv2CVersionCounter + // HasCount checks if Count has been set in PatternFlowSnmpv2CVersionCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowSnmpv2CVersionCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowSnmpv2CVersionCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowSnmpv2CVersionCounter object +func (obj *patternFlowSnmpv2CVersionCounter) SetStart(value uint32) PatternFlowSnmpv2CVersionCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowSnmpv2CVersionCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowSnmpv2CVersionCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowSnmpv2CVersionCounter object +func (obj *patternFlowSnmpv2CVersionCounter) SetStep(value uint32) PatternFlowSnmpv2CVersionCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowSnmpv2CVersionCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowSnmpv2CVersionCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowSnmpv2CVersionCounter object +func (obj *patternFlowSnmpv2CVersionCounter) SetCount(value uint32) PatternFlowSnmpv2CVersionCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowSnmpv2CVersionCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowSnmpv2CVersionCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowSnmpv2CVersionCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowSnmpv2CVersionCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowSnmpv2CVersionCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_cpdu_error_index.go b/gosnappi/pattern_flow_snmpv2_cpdu_error_index.go new file mode 100644 index 00000000..dd67ce4b --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_cpdu_error_index.go @@ -0,0 +1,531 @@ +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" +) + +// ***** PatternFlowSnmpv2CPDUErrorIndex ***** +type patternFlowSnmpv2CPDUErrorIndex struct { + validation + obj *otg.PatternFlowSnmpv2CPDUErrorIndex + marshaller marshalPatternFlowSnmpv2CPDUErrorIndex + unMarshaller unMarshalPatternFlowSnmpv2CPDUErrorIndex + incrementHolder PatternFlowSnmpv2CPDUErrorIndexCounter + decrementHolder PatternFlowSnmpv2CPDUErrorIndexCounter +} + +func NewPatternFlowSnmpv2CPDUErrorIndex() PatternFlowSnmpv2CPDUErrorIndex { + obj := patternFlowSnmpv2CPDUErrorIndex{obj: &otg.PatternFlowSnmpv2CPDUErrorIndex{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CPDUErrorIndex) msg() *otg.PatternFlowSnmpv2CPDUErrorIndex { + return obj.obj +} + +func (obj *patternFlowSnmpv2CPDUErrorIndex) setMsg(msg *otg.PatternFlowSnmpv2CPDUErrorIndex) PatternFlowSnmpv2CPDUErrorIndex { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CPDUErrorIndex struct { + obj *patternFlowSnmpv2CPDUErrorIndex +} + +type marshalPatternFlowSnmpv2CPDUErrorIndex interface { + // ToProto marshals PatternFlowSnmpv2CPDUErrorIndex to protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndex + ToProto() (*otg.PatternFlowSnmpv2CPDUErrorIndex, error) + // ToPbText marshals PatternFlowSnmpv2CPDUErrorIndex to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CPDUErrorIndex to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CPDUErrorIndex to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CPDUErrorIndex struct { + obj *patternFlowSnmpv2CPDUErrorIndex +} + +type unMarshalPatternFlowSnmpv2CPDUErrorIndex interface { + // FromProto unmarshals PatternFlowSnmpv2CPDUErrorIndex from protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndex + FromProto(msg *otg.PatternFlowSnmpv2CPDUErrorIndex) (PatternFlowSnmpv2CPDUErrorIndex, error) + // FromPbText unmarshals PatternFlowSnmpv2CPDUErrorIndex from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CPDUErrorIndex from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CPDUErrorIndex from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CPDUErrorIndex) Marshal() marshalPatternFlowSnmpv2CPDUErrorIndex { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CPDUErrorIndex{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CPDUErrorIndex) Unmarshal() unMarshalPatternFlowSnmpv2CPDUErrorIndex { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CPDUErrorIndex{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CPDUErrorIndex) ToProto() (*otg.PatternFlowSnmpv2CPDUErrorIndex, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CPDUErrorIndex) FromProto(msg *otg.PatternFlowSnmpv2CPDUErrorIndex) (PatternFlowSnmpv2CPDUErrorIndex, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CPDUErrorIndex) 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 *unMarshalpatternFlowSnmpv2CPDUErrorIndex) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowSnmpv2CPDUErrorIndex) 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 *unMarshalpatternFlowSnmpv2CPDUErrorIndex) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowSnmpv2CPDUErrorIndex) 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 *unMarshalpatternFlowSnmpv2CPDUErrorIndex) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowSnmpv2CPDUErrorIndex) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CPDUErrorIndex) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CPDUErrorIndex) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CPDUErrorIndex) Clone() (PatternFlowSnmpv2CPDUErrorIndex, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CPDUErrorIndex() + 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 +} + +func (obj *patternFlowSnmpv2CPDUErrorIndex) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowSnmpv2CPDUErrorIndex is when Error Status is non-zero, this field contains a pointer that specifies which object generated the error. Always zero in a request. +type PatternFlowSnmpv2CPDUErrorIndex interface { + Validation + // msg marshals PatternFlowSnmpv2CPDUErrorIndex to protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndex + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CPDUErrorIndex + // setMsg unmarshals PatternFlowSnmpv2CPDUErrorIndex from protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndex + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CPDUErrorIndex) PatternFlowSnmpv2CPDUErrorIndex + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CPDUErrorIndex + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CPDUErrorIndex + // validate validates PatternFlowSnmpv2CPDUErrorIndex + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CPDUErrorIndex, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowSnmpv2CPDUErrorIndexChoiceEnum, set in PatternFlowSnmpv2CPDUErrorIndex + Choice() PatternFlowSnmpv2CPDUErrorIndexChoiceEnum + // setChoice assigns PatternFlowSnmpv2CPDUErrorIndexChoiceEnum provided by user to PatternFlowSnmpv2CPDUErrorIndex + setChoice(value PatternFlowSnmpv2CPDUErrorIndexChoiceEnum) PatternFlowSnmpv2CPDUErrorIndex + // HasChoice checks if Choice has been set in PatternFlowSnmpv2CPDUErrorIndex + HasChoice() bool + // Value returns uint32, set in PatternFlowSnmpv2CPDUErrorIndex. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowSnmpv2CPDUErrorIndex + SetValue(value uint32) PatternFlowSnmpv2CPDUErrorIndex + // HasValue checks if Value has been set in PatternFlowSnmpv2CPDUErrorIndex + HasValue() bool + // Values returns []uint32, set in PatternFlowSnmpv2CPDUErrorIndex. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowSnmpv2CPDUErrorIndex + SetValues(value []uint32) PatternFlowSnmpv2CPDUErrorIndex + // Increment returns PatternFlowSnmpv2CPDUErrorIndexCounter, set in PatternFlowSnmpv2CPDUErrorIndex. + Increment() PatternFlowSnmpv2CPDUErrorIndexCounter + // SetIncrement assigns PatternFlowSnmpv2CPDUErrorIndexCounter provided by user to PatternFlowSnmpv2CPDUErrorIndex. + SetIncrement(value PatternFlowSnmpv2CPDUErrorIndexCounter) PatternFlowSnmpv2CPDUErrorIndex + // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CPDUErrorIndex + HasIncrement() bool + // Decrement returns PatternFlowSnmpv2CPDUErrorIndexCounter, set in PatternFlowSnmpv2CPDUErrorIndex. + Decrement() PatternFlowSnmpv2CPDUErrorIndexCounter + // SetDecrement assigns PatternFlowSnmpv2CPDUErrorIndexCounter provided by user to PatternFlowSnmpv2CPDUErrorIndex. + SetDecrement(value PatternFlowSnmpv2CPDUErrorIndexCounter) PatternFlowSnmpv2CPDUErrorIndex + // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CPDUErrorIndex + HasDecrement() bool + setNil() +} + +type PatternFlowSnmpv2CPDUErrorIndexChoiceEnum string + +// Enum of Choice on PatternFlowSnmpv2CPDUErrorIndex +var PatternFlowSnmpv2CPDUErrorIndexChoice = struct { + VALUE PatternFlowSnmpv2CPDUErrorIndexChoiceEnum + VALUES PatternFlowSnmpv2CPDUErrorIndexChoiceEnum + INCREMENT PatternFlowSnmpv2CPDUErrorIndexChoiceEnum + DECREMENT PatternFlowSnmpv2CPDUErrorIndexChoiceEnum +}{ + VALUE: PatternFlowSnmpv2CPDUErrorIndexChoiceEnum("value"), + VALUES: PatternFlowSnmpv2CPDUErrorIndexChoiceEnum("values"), + INCREMENT: PatternFlowSnmpv2CPDUErrorIndexChoiceEnum("increment"), + DECREMENT: PatternFlowSnmpv2CPDUErrorIndexChoiceEnum("decrement"), +} + +func (obj *patternFlowSnmpv2CPDUErrorIndex) Choice() PatternFlowSnmpv2CPDUErrorIndexChoiceEnum { + return PatternFlowSnmpv2CPDUErrorIndexChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowSnmpv2CPDUErrorIndex) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowSnmpv2CPDUErrorIndex) setChoice(value PatternFlowSnmpv2CPDUErrorIndexChoiceEnum) PatternFlowSnmpv2CPDUErrorIndex { + intValue, ok := otg.PatternFlowSnmpv2CPDUErrorIndex_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowSnmpv2CPDUErrorIndexChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowSnmpv2CPDUErrorIndex_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowSnmpv2CPDUErrorIndexChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowSnmpv2CPDUErrorIndexChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowSnmpv2CPDUErrorIndexChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowSnmpv2CPDUErrorIndexCounter().msg() + } + + if value == PatternFlowSnmpv2CPDUErrorIndexChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowSnmpv2CPDUErrorIndexCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowSnmpv2CPDUErrorIndex) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowSnmpv2CPDUErrorIndex) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowSnmpv2CPDUErrorIndex object +func (obj *patternFlowSnmpv2CPDUErrorIndex) SetValue(value uint32) PatternFlowSnmpv2CPDUErrorIndex { + obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowSnmpv2CPDUErrorIndex) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowSnmpv2CPDUErrorIndex object +func (obj *patternFlowSnmpv2CPDUErrorIndex) SetValues(value []uint32) PatternFlowSnmpv2CPDUErrorIndex { + obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CPDUErrorIndexCounter +func (obj *patternFlowSnmpv2CPDUErrorIndex) Increment() PatternFlowSnmpv2CPDUErrorIndexCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowSnmpv2CPDUErrorIndexCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CPDUErrorIndexCounter +func (obj *patternFlowSnmpv2CPDUErrorIndex) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowSnmpv2CPDUErrorIndexCounter value in the PatternFlowSnmpv2CPDUErrorIndex object +func (obj *patternFlowSnmpv2CPDUErrorIndex) SetIncrement(value PatternFlowSnmpv2CPDUErrorIndexCounter) PatternFlowSnmpv2CPDUErrorIndex { + obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CPDUErrorIndexCounter +func (obj *patternFlowSnmpv2CPDUErrorIndex) Decrement() PatternFlowSnmpv2CPDUErrorIndexCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowSnmpv2CPDUErrorIndexCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CPDUErrorIndexCounter +func (obj *patternFlowSnmpv2CPDUErrorIndex) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowSnmpv2CPDUErrorIndexCounter value in the PatternFlowSnmpv2CPDUErrorIndex object +func (obj *patternFlowSnmpv2CPDUErrorIndex) SetDecrement(value PatternFlowSnmpv2CPDUErrorIndexCounter) PatternFlowSnmpv2CPDUErrorIndex { + obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowSnmpv2CPDUErrorIndex) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowSnmpv2CPDUErrorIndex) setDefault() { + var choices_set int = 0 + var choice PatternFlowSnmpv2CPDUErrorIndexChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CPDUErrorIndexChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowSnmpv2CPDUErrorIndexChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CPDUErrorIndexChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CPDUErrorIndexChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowSnmpv2CPDUErrorIndexChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CPDUErrorIndex") + } + } else { + intVal := otg.PatternFlowSnmpv2CPDUErrorIndex_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowSnmpv2CPDUErrorIndex_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_cpdu_error_index_counter.go b/gosnappi/pattern_flow_snmpv2_cpdu_error_index_counter.go new file mode 100644 index 00000000..753e9f1b --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_cpdu_error_index_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowSnmpv2CPDUErrorIndexCounter ***** +type patternFlowSnmpv2CPDUErrorIndexCounter struct { + validation + obj *otg.PatternFlowSnmpv2CPDUErrorIndexCounter + marshaller marshalPatternFlowSnmpv2CPDUErrorIndexCounter + unMarshaller unMarshalPatternFlowSnmpv2CPDUErrorIndexCounter +} + +func NewPatternFlowSnmpv2CPDUErrorIndexCounter() PatternFlowSnmpv2CPDUErrorIndexCounter { + obj := patternFlowSnmpv2CPDUErrorIndexCounter{obj: &otg.PatternFlowSnmpv2CPDUErrorIndexCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) msg() *otg.PatternFlowSnmpv2CPDUErrorIndexCounter { + return obj.obj +} + +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) setMsg(msg *otg.PatternFlowSnmpv2CPDUErrorIndexCounter) PatternFlowSnmpv2CPDUErrorIndexCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CPDUErrorIndexCounter struct { + obj *patternFlowSnmpv2CPDUErrorIndexCounter +} + +type marshalPatternFlowSnmpv2CPDUErrorIndexCounter interface { + // ToProto marshals PatternFlowSnmpv2CPDUErrorIndexCounter to protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndexCounter + ToProto() (*otg.PatternFlowSnmpv2CPDUErrorIndexCounter, error) + // ToPbText marshals PatternFlowSnmpv2CPDUErrorIndexCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CPDUErrorIndexCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CPDUErrorIndexCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CPDUErrorIndexCounter struct { + obj *patternFlowSnmpv2CPDUErrorIndexCounter +} + +type unMarshalPatternFlowSnmpv2CPDUErrorIndexCounter interface { + // FromProto unmarshals PatternFlowSnmpv2CPDUErrorIndexCounter from protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndexCounter + FromProto(msg *otg.PatternFlowSnmpv2CPDUErrorIndexCounter) (PatternFlowSnmpv2CPDUErrorIndexCounter, error) + // FromPbText unmarshals PatternFlowSnmpv2CPDUErrorIndexCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CPDUErrorIndexCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CPDUErrorIndexCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) Marshal() marshalPatternFlowSnmpv2CPDUErrorIndexCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CPDUErrorIndexCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) Unmarshal() unMarshalPatternFlowSnmpv2CPDUErrorIndexCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CPDUErrorIndexCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CPDUErrorIndexCounter) ToProto() (*otg.PatternFlowSnmpv2CPDUErrorIndexCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CPDUErrorIndexCounter) FromProto(msg *otg.PatternFlowSnmpv2CPDUErrorIndexCounter) (PatternFlowSnmpv2CPDUErrorIndexCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CPDUErrorIndexCounter) 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 *unMarshalpatternFlowSnmpv2CPDUErrorIndexCounter) 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 *marshalpatternFlowSnmpv2CPDUErrorIndexCounter) 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 *unMarshalpatternFlowSnmpv2CPDUErrorIndexCounter) 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 *marshalpatternFlowSnmpv2CPDUErrorIndexCounter) 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 *unMarshalpatternFlowSnmpv2CPDUErrorIndexCounter) 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 *patternFlowSnmpv2CPDUErrorIndexCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) Clone() (PatternFlowSnmpv2CPDUErrorIndexCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CPDUErrorIndexCounter() + 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 +} + +// PatternFlowSnmpv2CPDUErrorIndexCounter is integer counter pattern +type PatternFlowSnmpv2CPDUErrorIndexCounter interface { + Validation + // msg marshals PatternFlowSnmpv2CPDUErrorIndexCounter to protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndexCounter + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CPDUErrorIndexCounter + // setMsg unmarshals PatternFlowSnmpv2CPDUErrorIndexCounter from protobuf object *otg.PatternFlowSnmpv2CPDUErrorIndexCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CPDUErrorIndexCounter) PatternFlowSnmpv2CPDUErrorIndexCounter + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CPDUErrorIndexCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CPDUErrorIndexCounter + // validate validates PatternFlowSnmpv2CPDUErrorIndexCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CPDUErrorIndexCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowSnmpv2CPDUErrorIndexCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowSnmpv2CPDUErrorIndexCounter + SetStart(value uint32) PatternFlowSnmpv2CPDUErrorIndexCounter + // HasStart checks if Start has been set in PatternFlowSnmpv2CPDUErrorIndexCounter + HasStart() bool + // Step returns uint32, set in PatternFlowSnmpv2CPDUErrorIndexCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowSnmpv2CPDUErrorIndexCounter + SetStep(value uint32) PatternFlowSnmpv2CPDUErrorIndexCounter + // HasStep checks if Step has been set in PatternFlowSnmpv2CPDUErrorIndexCounter + HasStep() bool + // Count returns uint32, set in PatternFlowSnmpv2CPDUErrorIndexCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowSnmpv2CPDUErrorIndexCounter + SetCount(value uint32) PatternFlowSnmpv2CPDUErrorIndexCounter + // HasCount checks if Count has been set in PatternFlowSnmpv2CPDUErrorIndexCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowSnmpv2CPDUErrorIndexCounter object +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) SetStart(value uint32) PatternFlowSnmpv2CPDUErrorIndexCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowSnmpv2CPDUErrorIndexCounter object +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) SetStep(value uint32) PatternFlowSnmpv2CPDUErrorIndexCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowSnmpv2CPDUErrorIndexCounter object +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) SetCount(value uint32) PatternFlowSnmpv2CPDUErrorIndexCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowSnmpv2CPDUErrorIndexCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_cpdu_request_id.go b/gosnappi/pattern_flow_snmpv2_cpdu_request_id.go new file mode 100644 index 00000000..b59149a1 --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_cpdu_request_id.go @@ -0,0 +1,536 @@ +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" +) + +// ***** PatternFlowSnmpv2CPDURequestId ***** +type patternFlowSnmpv2CPDURequestId struct { + validation + obj *otg.PatternFlowSnmpv2CPDURequestId + marshaller marshalPatternFlowSnmpv2CPDURequestId + unMarshaller unMarshalPatternFlowSnmpv2CPDURequestId + incrementHolder PatternFlowSnmpv2CPDURequestIdCounter + decrementHolder PatternFlowSnmpv2CPDURequestIdCounter +} + +func NewPatternFlowSnmpv2CPDURequestId() PatternFlowSnmpv2CPDURequestId { + obj := patternFlowSnmpv2CPDURequestId{obj: &otg.PatternFlowSnmpv2CPDURequestId{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CPDURequestId) msg() *otg.PatternFlowSnmpv2CPDURequestId { + return obj.obj +} + +func (obj *patternFlowSnmpv2CPDURequestId) setMsg(msg *otg.PatternFlowSnmpv2CPDURequestId) PatternFlowSnmpv2CPDURequestId { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CPDURequestId struct { + obj *patternFlowSnmpv2CPDURequestId +} + +type marshalPatternFlowSnmpv2CPDURequestId interface { + // ToProto marshals PatternFlowSnmpv2CPDURequestId to protobuf object *otg.PatternFlowSnmpv2CPDURequestId + ToProto() (*otg.PatternFlowSnmpv2CPDURequestId, error) + // ToPbText marshals PatternFlowSnmpv2CPDURequestId to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CPDURequestId to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CPDURequestId to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CPDURequestId struct { + obj *patternFlowSnmpv2CPDURequestId +} + +type unMarshalPatternFlowSnmpv2CPDURequestId interface { + // FromProto unmarshals PatternFlowSnmpv2CPDURequestId from protobuf object *otg.PatternFlowSnmpv2CPDURequestId + FromProto(msg *otg.PatternFlowSnmpv2CPDURequestId) (PatternFlowSnmpv2CPDURequestId, error) + // FromPbText unmarshals PatternFlowSnmpv2CPDURequestId from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CPDURequestId from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CPDURequestId from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CPDURequestId) Marshal() marshalPatternFlowSnmpv2CPDURequestId { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CPDURequestId{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CPDURequestId) Unmarshal() unMarshalPatternFlowSnmpv2CPDURequestId { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CPDURequestId{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CPDURequestId) ToProto() (*otg.PatternFlowSnmpv2CPDURequestId, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CPDURequestId) FromProto(msg *otg.PatternFlowSnmpv2CPDURequestId) (PatternFlowSnmpv2CPDURequestId, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CPDURequestId) 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 *unMarshalpatternFlowSnmpv2CPDURequestId) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowSnmpv2CPDURequestId) 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 *unMarshalpatternFlowSnmpv2CPDURequestId) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowSnmpv2CPDURequestId) 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 *unMarshalpatternFlowSnmpv2CPDURequestId) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowSnmpv2CPDURequestId) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CPDURequestId) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CPDURequestId) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CPDURequestId) Clone() (PatternFlowSnmpv2CPDURequestId, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CPDURequestId() + 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 +} + +func (obj *patternFlowSnmpv2CPDURequestId) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowSnmpv2CPDURequestId is identifies a particular SNMP request. +// This index is echoed back in the response from the SNMP agent, +// allowing the SNMP manager to match an incoming response to the appropriate request. +// +// - Encoding of this field follows ASN.1 X.690(section 8.3) specification. +// Refer: http://www.itu.int/ITU-T/asn1 +type PatternFlowSnmpv2CPDURequestId interface { + Validation + // msg marshals PatternFlowSnmpv2CPDURequestId to protobuf object *otg.PatternFlowSnmpv2CPDURequestId + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CPDURequestId + // setMsg unmarshals PatternFlowSnmpv2CPDURequestId from protobuf object *otg.PatternFlowSnmpv2CPDURequestId + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CPDURequestId) PatternFlowSnmpv2CPDURequestId + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CPDURequestId + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CPDURequestId + // validate validates PatternFlowSnmpv2CPDURequestId + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CPDURequestId, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowSnmpv2CPDURequestIdChoiceEnum, set in PatternFlowSnmpv2CPDURequestId + Choice() PatternFlowSnmpv2CPDURequestIdChoiceEnum + // setChoice assigns PatternFlowSnmpv2CPDURequestIdChoiceEnum provided by user to PatternFlowSnmpv2CPDURequestId + setChoice(value PatternFlowSnmpv2CPDURequestIdChoiceEnum) PatternFlowSnmpv2CPDURequestId + // HasChoice checks if Choice has been set in PatternFlowSnmpv2CPDURequestId + HasChoice() bool + // Value returns int32, set in PatternFlowSnmpv2CPDURequestId. + Value() int32 + // SetValue assigns int32 provided by user to PatternFlowSnmpv2CPDURequestId + SetValue(value int32) PatternFlowSnmpv2CPDURequestId + // HasValue checks if Value has been set in PatternFlowSnmpv2CPDURequestId + HasValue() bool + // Values returns []int32, set in PatternFlowSnmpv2CPDURequestId. + Values() []int32 + // SetValues assigns []int32 provided by user to PatternFlowSnmpv2CPDURequestId + SetValues(value []int32) PatternFlowSnmpv2CPDURequestId + // Increment returns PatternFlowSnmpv2CPDURequestIdCounter, set in PatternFlowSnmpv2CPDURequestId. + Increment() PatternFlowSnmpv2CPDURequestIdCounter + // SetIncrement assigns PatternFlowSnmpv2CPDURequestIdCounter provided by user to PatternFlowSnmpv2CPDURequestId. + SetIncrement(value PatternFlowSnmpv2CPDURequestIdCounter) PatternFlowSnmpv2CPDURequestId + // HasIncrement checks if Increment has been set in PatternFlowSnmpv2CPDURequestId + HasIncrement() bool + // Decrement returns PatternFlowSnmpv2CPDURequestIdCounter, set in PatternFlowSnmpv2CPDURequestId. + Decrement() PatternFlowSnmpv2CPDURequestIdCounter + // SetDecrement assigns PatternFlowSnmpv2CPDURequestIdCounter provided by user to PatternFlowSnmpv2CPDURequestId. + SetDecrement(value PatternFlowSnmpv2CPDURequestIdCounter) PatternFlowSnmpv2CPDURequestId + // HasDecrement checks if Decrement has been set in PatternFlowSnmpv2CPDURequestId + HasDecrement() bool + setNil() +} + +type PatternFlowSnmpv2CPDURequestIdChoiceEnum string + +// Enum of Choice on PatternFlowSnmpv2CPDURequestId +var PatternFlowSnmpv2CPDURequestIdChoice = struct { + VALUE PatternFlowSnmpv2CPDURequestIdChoiceEnum + VALUES PatternFlowSnmpv2CPDURequestIdChoiceEnum + INCREMENT PatternFlowSnmpv2CPDURequestIdChoiceEnum + DECREMENT PatternFlowSnmpv2CPDURequestIdChoiceEnum +}{ + VALUE: PatternFlowSnmpv2CPDURequestIdChoiceEnum("value"), + VALUES: PatternFlowSnmpv2CPDURequestIdChoiceEnum("values"), + INCREMENT: PatternFlowSnmpv2CPDURequestIdChoiceEnum("increment"), + DECREMENT: PatternFlowSnmpv2CPDURequestIdChoiceEnum("decrement"), +} + +func (obj *patternFlowSnmpv2CPDURequestId) Choice() PatternFlowSnmpv2CPDURequestIdChoiceEnum { + return PatternFlowSnmpv2CPDURequestIdChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowSnmpv2CPDURequestId) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowSnmpv2CPDURequestId) setChoice(value PatternFlowSnmpv2CPDURequestIdChoiceEnum) PatternFlowSnmpv2CPDURequestId { + intValue, ok := otg.PatternFlowSnmpv2CPDURequestId_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowSnmpv2CPDURequestIdChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowSnmpv2CPDURequestId_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowSnmpv2CPDURequestIdChoice.VALUE { + defaultValue := int32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowSnmpv2CPDURequestIdChoice.VALUES { + defaultValue := []int32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowSnmpv2CPDURequestIdChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowSnmpv2CPDURequestIdCounter().msg() + } + + if value == PatternFlowSnmpv2CPDURequestIdChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowSnmpv2CPDURequestIdCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a int32 +func (obj *patternFlowSnmpv2CPDURequestId) Value() int32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a int32 +func (obj *patternFlowSnmpv2CPDURequestId) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the int32 value in the PatternFlowSnmpv2CPDURequestId object +func (obj *patternFlowSnmpv2CPDURequestId) SetValue(value int32) PatternFlowSnmpv2CPDURequestId { + obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []int32 +func (obj *patternFlowSnmpv2CPDURequestId) Values() []int32 { + if obj.obj.Values == nil { + obj.SetValues([]int32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []int32 value in the PatternFlowSnmpv2CPDURequestId object +func (obj *patternFlowSnmpv2CPDURequestId) SetValues(value []int32) PatternFlowSnmpv2CPDURequestId { + obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]int32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CPDURequestIdCounter +func (obj *patternFlowSnmpv2CPDURequestId) Increment() PatternFlowSnmpv2CPDURequestIdCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowSnmpv2CPDURequestIdCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowSnmpv2CPDURequestIdCounter +func (obj *patternFlowSnmpv2CPDURequestId) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowSnmpv2CPDURequestIdCounter value in the PatternFlowSnmpv2CPDURequestId object +func (obj *patternFlowSnmpv2CPDURequestId) SetIncrement(value PatternFlowSnmpv2CPDURequestIdCounter) PatternFlowSnmpv2CPDURequestId { + obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CPDURequestIdCounter +func (obj *patternFlowSnmpv2CPDURequestId) Decrement() PatternFlowSnmpv2CPDURequestIdCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowSnmpv2CPDURequestIdCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowSnmpv2CPDURequestIdCounter +func (obj *patternFlowSnmpv2CPDURequestId) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowSnmpv2CPDURequestIdCounter value in the PatternFlowSnmpv2CPDURequestId object +func (obj *patternFlowSnmpv2CPDURequestId) SetDecrement(value PatternFlowSnmpv2CPDURequestIdCounter) PatternFlowSnmpv2CPDURequestId { + obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +func (obj *patternFlowSnmpv2CPDURequestId) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowSnmpv2CPDURequestId) setDefault() { + var choices_set int = 0 + var choice PatternFlowSnmpv2CPDURequestIdChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CPDURequestIdChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowSnmpv2CPDURequestIdChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CPDURequestIdChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowSnmpv2CPDURequestIdChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowSnmpv2CPDURequestIdChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowSnmpv2CPDURequestId") + } + } else { + intVal := otg.PatternFlowSnmpv2CPDURequestId_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowSnmpv2CPDURequestId_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_snmpv2_cpdu_request_id_counter.go b/gosnappi/pattern_flow_snmpv2_cpdu_request_id_counter.go new file mode 100644 index 00000000..2a49db1e --- /dev/null +++ b/gosnappi/pattern_flow_snmpv2_cpdu_request_id_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowSnmpv2CPDURequestIdCounter ***** +type patternFlowSnmpv2CPDURequestIdCounter struct { + validation + obj *otg.PatternFlowSnmpv2CPDURequestIdCounter + marshaller marshalPatternFlowSnmpv2CPDURequestIdCounter + unMarshaller unMarshalPatternFlowSnmpv2CPDURequestIdCounter +} + +func NewPatternFlowSnmpv2CPDURequestIdCounter() PatternFlowSnmpv2CPDURequestIdCounter { + obj := patternFlowSnmpv2CPDURequestIdCounter{obj: &otg.PatternFlowSnmpv2CPDURequestIdCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowSnmpv2CPDURequestIdCounter) msg() *otg.PatternFlowSnmpv2CPDURequestIdCounter { + return obj.obj +} + +func (obj *patternFlowSnmpv2CPDURequestIdCounter) setMsg(msg *otg.PatternFlowSnmpv2CPDURequestIdCounter) PatternFlowSnmpv2CPDURequestIdCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowSnmpv2CPDURequestIdCounter struct { + obj *patternFlowSnmpv2CPDURequestIdCounter +} + +type marshalPatternFlowSnmpv2CPDURequestIdCounter interface { + // ToProto marshals PatternFlowSnmpv2CPDURequestIdCounter to protobuf object *otg.PatternFlowSnmpv2CPDURequestIdCounter + ToProto() (*otg.PatternFlowSnmpv2CPDURequestIdCounter, error) + // ToPbText marshals PatternFlowSnmpv2CPDURequestIdCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowSnmpv2CPDURequestIdCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowSnmpv2CPDURequestIdCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowSnmpv2CPDURequestIdCounter struct { + obj *patternFlowSnmpv2CPDURequestIdCounter +} + +type unMarshalPatternFlowSnmpv2CPDURequestIdCounter interface { + // FromProto unmarshals PatternFlowSnmpv2CPDURequestIdCounter from protobuf object *otg.PatternFlowSnmpv2CPDURequestIdCounter + FromProto(msg *otg.PatternFlowSnmpv2CPDURequestIdCounter) (PatternFlowSnmpv2CPDURequestIdCounter, error) + // FromPbText unmarshals PatternFlowSnmpv2CPDURequestIdCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowSnmpv2CPDURequestIdCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowSnmpv2CPDURequestIdCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowSnmpv2CPDURequestIdCounter) Marshal() marshalPatternFlowSnmpv2CPDURequestIdCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowSnmpv2CPDURequestIdCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowSnmpv2CPDURequestIdCounter) Unmarshal() unMarshalPatternFlowSnmpv2CPDURequestIdCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowSnmpv2CPDURequestIdCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowSnmpv2CPDURequestIdCounter) ToProto() (*otg.PatternFlowSnmpv2CPDURequestIdCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowSnmpv2CPDURequestIdCounter) FromProto(msg *otg.PatternFlowSnmpv2CPDURequestIdCounter) (PatternFlowSnmpv2CPDURequestIdCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowSnmpv2CPDURequestIdCounter) 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 *unMarshalpatternFlowSnmpv2CPDURequestIdCounter) 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 *marshalpatternFlowSnmpv2CPDURequestIdCounter) 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 *unMarshalpatternFlowSnmpv2CPDURequestIdCounter) 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 *marshalpatternFlowSnmpv2CPDURequestIdCounter) 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 *unMarshalpatternFlowSnmpv2CPDURequestIdCounter) 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 *patternFlowSnmpv2CPDURequestIdCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CPDURequestIdCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowSnmpv2CPDURequestIdCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowSnmpv2CPDURequestIdCounter) Clone() (PatternFlowSnmpv2CPDURequestIdCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowSnmpv2CPDURequestIdCounter() + 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 +} + +// PatternFlowSnmpv2CPDURequestIdCounter is integer counter pattern +type PatternFlowSnmpv2CPDURequestIdCounter interface { + Validation + // msg marshals PatternFlowSnmpv2CPDURequestIdCounter to protobuf object *otg.PatternFlowSnmpv2CPDURequestIdCounter + // and doesn't set defaults + msg() *otg.PatternFlowSnmpv2CPDURequestIdCounter + // setMsg unmarshals PatternFlowSnmpv2CPDURequestIdCounter from protobuf object *otg.PatternFlowSnmpv2CPDURequestIdCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowSnmpv2CPDURequestIdCounter) PatternFlowSnmpv2CPDURequestIdCounter + // provides marshal interface + Marshal() marshalPatternFlowSnmpv2CPDURequestIdCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowSnmpv2CPDURequestIdCounter + // validate validates PatternFlowSnmpv2CPDURequestIdCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowSnmpv2CPDURequestIdCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns int32, set in PatternFlowSnmpv2CPDURequestIdCounter. + Start() int32 + // SetStart assigns int32 provided by user to PatternFlowSnmpv2CPDURequestIdCounter + SetStart(value int32) PatternFlowSnmpv2CPDURequestIdCounter + // HasStart checks if Start has been set in PatternFlowSnmpv2CPDURequestIdCounter + HasStart() bool + // Step returns int32, set in PatternFlowSnmpv2CPDURequestIdCounter. + Step() int32 + // SetStep assigns int32 provided by user to PatternFlowSnmpv2CPDURequestIdCounter + SetStep(value int32) PatternFlowSnmpv2CPDURequestIdCounter + // HasStep checks if Step has been set in PatternFlowSnmpv2CPDURequestIdCounter + HasStep() bool + // Count returns int32, set in PatternFlowSnmpv2CPDURequestIdCounter. + Count() int32 + // SetCount assigns int32 provided by user to PatternFlowSnmpv2CPDURequestIdCounter + SetCount(value int32) PatternFlowSnmpv2CPDURequestIdCounter + // HasCount checks if Count has been set in PatternFlowSnmpv2CPDURequestIdCounter + HasCount() bool +} + +// description is TBD +// Start returns a int32 +func (obj *patternFlowSnmpv2CPDURequestIdCounter) Start() int32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a int32 +func (obj *patternFlowSnmpv2CPDURequestIdCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the int32 value in the PatternFlowSnmpv2CPDURequestIdCounter object +func (obj *patternFlowSnmpv2CPDURequestIdCounter) SetStart(value int32) PatternFlowSnmpv2CPDURequestIdCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a int32 +func (obj *patternFlowSnmpv2CPDURequestIdCounter) Step() int32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a int32 +func (obj *patternFlowSnmpv2CPDURequestIdCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the int32 value in the PatternFlowSnmpv2CPDURequestIdCounter object +func (obj *patternFlowSnmpv2CPDURequestIdCounter) SetStep(value int32) PatternFlowSnmpv2CPDURequestIdCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a int32 +func (obj *patternFlowSnmpv2CPDURequestIdCounter) Count() int32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a int32 +func (obj *patternFlowSnmpv2CPDURequestIdCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the int32 value in the PatternFlowSnmpv2CPDURequestIdCounter object +func (obj *patternFlowSnmpv2CPDURequestIdCounter) SetCount(value int32) PatternFlowSnmpv2CPDURequestIdCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowSnmpv2CPDURequestIdCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowSnmpv2CPDURequestIdCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ack_num.go b/gosnappi/pattern_flow_tcp_ack_num.go new file mode 100644 index 00000000..25fde4f2 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ack_num.go @@ -0,0 +1,640 @@ +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" +) + +// ***** PatternFlowTcpAckNum ***** +type patternFlowTcpAckNum struct { + validation + obj *otg.PatternFlowTcpAckNum + marshaller marshalPatternFlowTcpAckNum + unMarshaller unMarshalPatternFlowTcpAckNum + incrementHolder PatternFlowTcpAckNumCounter + decrementHolder PatternFlowTcpAckNumCounter + metricTagsHolder PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter +} + +func NewPatternFlowTcpAckNum() PatternFlowTcpAckNum { + obj := patternFlowTcpAckNum{obj: &otg.PatternFlowTcpAckNum{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpAckNum) msg() *otg.PatternFlowTcpAckNum { + return obj.obj +} + +func (obj *patternFlowTcpAckNum) setMsg(msg *otg.PatternFlowTcpAckNum) PatternFlowTcpAckNum { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpAckNum struct { + obj *patternFlowTcpAckNum +} + +type marshalPatternFlowTcpAckNum interface { + // ToProto marshals PatternFlowTcpAckNum to protobuf object *otg.PatternFlowTcpAckNum + ToProto() (*otg.PatternFlowTcpAckNum, error) + // ToPbText marshals PatternFlowTcpAckNum to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpAckNum to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpAckNum to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpAckNum struct { + obj *patternFlowTcpAckNum +} + +type unMarshalPatternFlowTcpAckNum interface { + // FromProto unmarshals PatternFlowTcpAckNum from protobuf object *otg.PatternFlowTcpAckNum + FromProto(msg *otg.PatternFlowTcpAckNum) (PatternFlowTcpAckNum, error) + // FromPbText unmarshals PatternFlowTcpAckNum from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpAckNum from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpAckNum from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpAckNum) Marshal() marshalPatternFlowTcpAckNum { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpAckNum{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpAckNum) Unmarshal() unMarshalPatternFlowTcpAckNum { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpAckNum{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpAckNum) ToProto() (*otg.PatternFlowTcpAckNum, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpAckNum) FromProto(msg *otg.PatternFlowTcpAckNum) (PatternFlowTcpAckNum, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpAckNum) 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 *unMarshalpatternFlowTcpAckNum) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpAckNum) 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 *unMarshalpatternFlowTcpAckNum) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpAckNum) 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 *unMarshalpatternFlowTcpAckNum) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpAckNum) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpAckNum) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpAckNum) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpAckNum) Clone() (PatternFlowTcpAckNum, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpAckNum() + 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 +} + +func (obj *patternFlowTcpAckNum) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpAckNum is acknowledgement number +type PatternFlowTcpAckNum interface { + Validation + // msg marshals PatternFlowTcpAckNum to protobuf object *otg.PatternFlowTcpAckNum + // and doesn't set defaults + msg() *otg.PatternFlowTcpAckNum + // setMsg unmarshals PatternFlowTcpAckNum from protobuf object *otg.PatternFlowTcpAckNum + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpAckNum) PatternFlowTcpAckNum + // provides marshal interface + Marshal() marshalPatternFlowTcpAckNum + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpAckNum + // validate validates PatternFlowTcpAckNum + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpAckNum, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpAckNumChoiceEnum, set in PatternFlowTcpAckNum + Choice() PatternFlowTcpAckNumChoiceEnum + // setChoice assigns PatternFlowTcpAckNumChoiceEnum provided by user to PatternFlowTcpAckNum + setChoice(value PatternFlowTcpAckNumChoiceEnum) PatternFlowTcpAckNum + // HasChoice checks if Choice has been set in PatternFlowTcpAckNum + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpAckNum. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpAckNum + SetValue(value uint32) PatternFlowTcpAckNum + // HasValue checks if Value has been set in PatternFlowTcpAckNum + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpAckNum. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpAckNum + SetValues(value []uint32) PatternFlowTcpAckNum + // Increment returns PatternFlowTcpAckNumCounter, set in PatternFlowTcpAckNum. + // PatternFlowTcpAckNumCounter is integer counter pattern + Increment() PatternFlowTcpAckNumCounter + // SetIncrement assigns PatternFlowTcpAckNumCounter provided by user to PatternFlowTcpAckNum. + // PatternFlowTcpAckNumCounter is integer counter pattern + SetIncrement(value PatternFlowTcpAckNumCounter) PatternFlowTcpAckNum + // HasIncrement checks if Increment has been set in PatternFlowTcpAckNum + HasIncrement() bool + // Decrement returns PatternFlowTcpAckNumCounter, set in PatternFlowTcpAckNum. + // PatternFlowTcpAckNumCounter is integer counter pattern + Decrement() PatternFlowTcpAckNumCounter + // SetDecrement assigns PatternFlowTcpAckNumCounter provided by user to PatternFlowTcpAckNum. + // PatternFlowTcpAckNumCounter is integer counter pattern + SetDecrement(value PatternFlowTcpAckNumCounter) PatternFlowTcpAckNum + // HasDecrement checks if Decrement has been set in PatternFlowTcpAckNum + HasDecrement() bool + // MetricTags returns PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIterIter, set in PatternFlowTcpAckNum + MetricTags() PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter + setNil() +} + +type PatternFlowTcpAckNumChoiceEnum string + +// Enum of Choice on PatternFlowTcpAckNum +var PatternFlowTcpAckNumChoice = struct { + VALUE PatternFlowTcpAckNumChoiceEnum + VALUES PatternFlowTcpAckNumChoiceEnum + INCREMENT PatternFlowTcpAckNumChoiceEnum + DECREMENT PatternFlowTcpAckNumChoiceEnum +}{ + VALUE: PatternFlowTcpAckNumChoiceEnum("value"), + VALUES: PatternFlowTcpAckNumChoiceEnum("values"), + INCREMENT: PatternFlowTcpAckNumChoiceEnum("increment"), + DECREMENT: PatternFlowTcpAckNumChoiceEnum("decrement"), +} + +func (obj *patternFlowTcpAckNum) Choice() PatternFlowTcpAckNumChoiceEnum { + return PatternFlowTcpAckNumChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpAckNum) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpAckNum) setChoice(value PatternFlowTcpAckNumChoiceEnum) PatternFlowTcpAckNum { + intValue, ok := otg.PatternFlowTcpAckNum_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpAckNumChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpAckNum_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpAckNumChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpAckNumChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpAckNumChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpAckNumCounter().msg() + } + + if value == PatternFlowTcpAckNumChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpAckNumCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpAckNum) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpAckNumChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpAckNum) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpAckNum object +func (obj *patternFlowTcpAckNum) SetValue(value uint32) PatternFlowTcpAckNum { + obj.setChoice(PatternFlowTcpAckNumChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpAckNum) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpAckNum object +func (obj *patternFlowTcpAckNum) SetValues(value []uint32) PatternFlowTcpAckNum { + obj.setChoice(PatternFlowTcpAckNumChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpAckNumCounter +func (obj *patternFlowTcpAckNum) Increment() PatternFlowTcpAckNumCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpAckNumChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpAckNumCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpAckNumCounter +func (obj *patternFlowTcpAckNum) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpAckNumCounter value in the PatternFlowTcpAckNum object +func (obj *patternFlowTcpAckNum) SetIncrement(value PatternFlowTcpAckNumCounter) PatternFlowTcpAckNum { + obj.setChoice(PatternFlowTcpAckNumChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpAckNumCounter +func (obj *patternFlowTcpAckNum) Decrement() PatternFlowTcpAckNumCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpAckNumChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpAckNumCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpAckNumCounter +func (obj *patternFlowTcpAckNum) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpAckNumCounter value in the PatternFlowTcpAckNum object +func (obj *patternFlowTcpAckNum) SetDecrement(value PatternFlowTcpAckNumCounter) PatternFlowTcpAckNum { + obj.setChoice(PatternFlowTcpAckNumChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpAckNumMetricTag +func (obj *patternFlowTcpAckNum) MetricTags() PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpAckNumMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter struct { + obj *patternFlowTcpAckNum + patternFlowTcpAckNumMetricTagSlice []PatternFlowTcpAckNumMetricTag + fieldPtr *[]*otg.PatternFlowTcpAckNumMetricTag +} + +func newPatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter(ptr *[]*otg.PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { + return &patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter interface { + setMsg(*patternFlowTcpAckNum) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter + Items() []PatternFlowTcpAckNumMetricTag + Add() PatternFlowTcpAckNumMetricTag + Append(items ...PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter + Set(index int, newObj PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter + Clear() PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter + clearHolderSlice() PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter + appendHolderSlice(item PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter +} + +func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) setMsg(msg *patternFlowTcpAckNum) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpAckNumMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) Items() []PatternFlowTcpAckNumMetricTag { + return obj.patternFlowTcpAckNumMetricTagSlice +} + +func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) Add() PatternFlowTcpAckNumMetricTag { + newObj := &otg.PatternFlowTcpAckNumMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpAckNumMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpAckNumMetricTagSlice = append(obj.patternFlowTcpAckNumMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) Append(items ...PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpAckNumMetricTagSlice = append(obj.patternFlowTcpAckNumMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) Set(index int, newObj PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpAckNumMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) Clear() PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpAckNumMetricTag{} + obj.patternFlowTcpAckNumMetricTagSlice = []PatternFlowTcpAckNumMetricTag{} + } + return obj +} +func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) clearHolderSlice() PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { + if len(obj.patternFlowTcpAckNumMetricTagSlice) > 0 { + obj.patternFlowTcpAckNumMetricTagSlice = []PatternFlowTcpAckNumMetricTag{} + } + return obj +} +func (obj *patternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter) appendHolderSlice(item PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumPatternFlowTcpAckNumMetricTagIter { + obj.patternFlowTcpAckNumMetricTagSlice = append(obj.patternFlowTcpAckNumMetricTagSlice, item) + return obj +} + +func (obj *patternFlowTcpAckNum) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpAckNumMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowTcpAckNum) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpAckNumChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpAckNumChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpAckNumChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpAckNumChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpAckNumChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpAckNumChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpAckNum") + } + } else { + intVal := otg.PatternFlowTcpAckNum_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpAckNum_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_ack_num_counter.go b/gosnappi/pattern_flow_tcp_ack_num_counter.go new file mode 100644 index 00000000..ec8ec19a --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ack_num_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowTcpAckNumCounter ***** +type patternFlowTcpAckNumCounter struct { + validation + obj *otg.PatternFlowTcpAckNumCounter + marshaller marshalPatternFlowTcpAckNumCounter + unMarshaller unMarshalPatternFlowTcpAckNumCounter +} + +func NewPatternFlowTcpAckNumCounter() PatternFlowTcpAckNumCounter { + obj := patternFlowTcpAckNumCounter{obj: &otg.PatternFlowTcpAckNumCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpAckNumCounter) msg() *otg.PatternFlowTcpAckNumCounter { + return obj.obj +} + +func (obj *patternFlowTcpAckNumCounter) setMsg(msg *otg.PatternFlowTcpAckNumCounter) PatternFlowTcpAckNumCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpAckNumCounter struct { + obj *patternFlowTcpAckNumCounter +} + +type marshalPatternFlowTcpAckNumCounter interface { + // ToProto marshals PatternFlowTcpAckNumCounter to protobuf object *otg.PatternFlowTcpAckNumCounter + ToProto() (*otg.PatternFlowTcpAckNumCounter, error) + // ToPbText marshals PatternFlowTcpAckNumCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpAckNumCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpAckNumCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpAckNumCounter struct { + obj *patternFlowTcpAckNumCounter +} + +type unMarshalPatternFlowTcpAckNumCounter interface { + // FromProto unmarshals PatternFlowTcpAckNumCounter from protobuf object *otg.PatternFlowTcpAckNumCounter + FromProto(msg *otg.PatternFlowTcpAckNumCounter) (PatternFlowTcpAckNumCounter, error) + // FromPbText unmarshals PatternFlowTcpAckNumCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpAckNumCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpAckNumCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpAckNumCounter) Marshal() marshalPatternFlowTcpAckNumCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpAckNumCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpAckNumCounter) Unmarshal() unMarshalPatternFlowTcpAckNumCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpAckNumCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpAckNumCounter) ToProto() (*otg.PatternFlowTcpAckNumCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpAckNumCounter) FromProto(msg *otg.PatternFlowTcpAckNumCounter) (PatternFlowTcpAckNumCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpAckNumCounter) 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 *unMarshalpatternFlowTcpAckNumCounter) 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 *marshalpatternFlowTcpAckNumCounter) 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 *unMarshalpatternFlowTcpAckNumCounter) 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 *marshalpatternFlowTcpAckNumCounter) 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 *unMarshalpatternFlowTcpAckNumCounter) 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 *patternFlowTcpAckNumCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpAckNumCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpAckNumCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpAckNumCounter) Clone() (PatternFlowTcpAckNumCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpAckNumCounter() + 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 +} + +// PatternFlowTcpAckNumCounter is integer counter pattern +type PatternFlowTcpAckNumCounter interface { + Validation + // msg marshals PatternFlowTcpAckNumCounter to protobuf object *otg.PatternFlowTcpAckNumCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpAckNumCounter + // setMsg unmarshals PatternFlowTcpAckNumCounter from protobuf object *otg.PatternFlowTcpAckNumCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpAckNumCounter) PatternFlowTcpAckNumCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpAckNumCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpAckNumCounter + // validate validates PatternFlowTcpAckNumCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpAckNumCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpAckNumCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpAckNumCounter + SetStart(value uint32) PatternFlowTcpAckNumCounter + // HasStart checks if Start has been set in PatternFlowTcpAckNumCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpAckNumCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpAckNumCounter + SetStep(value uint32) PatternFlowTcpAckNumCounter + // HasStep checks if Step has been set in PatternFlowTcpAckNumCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpAckNumCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpAckNumCounter + SetCount(value uint32) PatternFlowTcpAckNumCounter + // HasCount checks if Count has been set in PatternFlowTcpAckNumCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpAckNumCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpAckNumCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpAckNumCounter object +func (obj *patternFlowTcpAckNumCounter) SetStart(value uint32) PatternFlowTcpAckNumCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpAckNumCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpAckNumCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpAckNumCounter object +func (obj *patternFlowTcpAckNumCounter) SetStep(value uint32) PatternFlowTcpAckNumCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpAckNumCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpAckNumCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpAckNumCounter object +func (obj *patternFlowTcpAckNumCounter) SetCount(value uint32) PatternFlowTcpAckNumCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpAckNumCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowTcpAckNumCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ack_num_metric_tag.go b/gosnappi/pattern_flow_tcp_ack_num_metric_tag.go new file mode 100644 index 00000000..b7dc562d --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ack_num_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpAckNumMetricTag ***** +type patternFlowTcpAckNumMetricTag struct { + validation + obj *otg.PatternFlowTcpAckNumMetricTag + marshaller marshalPatternFlowTcpAckNumMetricTag + unMarshaller unMarshalPatternFlowTcpAckNumMetricTag +} + +func NewPatternFlowTcpAckNumMetricTag() PatternFlowTcpAckNumMetricTag { + obj := patternFlowTcpAckNumMetricTag{obj: &otg.PatternFlowTcpAckNumMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpAckNumMetricTag) msg() *otg.PatternFlowTcpAckNumMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpAckNumMetricTag) setMsg(msg *otg.PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpAckNumMetricTag struct { + obj *patternFlowTcpAckNumMetricTag +} + +type marshalPatternFlowTcpAckNumMetricTag interface { + // ToProto marshals PatternFlowTcpAckNumMetricTag to protobuf object *otg.PatternFlowTcpAckNumMetricTag + ToProto() (*otg.PatternFlowTcpAckNumMetricTag, error) + // ToPbText marshals PatternFlowTcpAckNumMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpAckNumMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpAckNumMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpAckNumMetricTag struct { + obj *patternFlowTcpAckNumMetricTag +} + +type unMarshalPatternFlowTcpAckNumMetricTag interface { + // FromProto unmarshals PatternFlowTcpAckNumMetricTag from protobuf object *otg.PatternFlowTcpAckNumMetricTag + FromProto(msg *otg.PatternFlowTcpAckNumMetricTag) (PatternFlowTcpAckNumMetricTag, error) + // FromPbText unmarshals PatternFlowTcpAckNumMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpAckNumMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpAckNumMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpAckNumMetricTag) Marshal() marshalPatternFlowTcpAckNumMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpAckNumMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpAckNumMetricTag) Unmarshal() unMarshalPatternFlowTcpAckNumMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpAckNumMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpAckNumMetricTag) ToProto() (*otg.PatternFlowTcpAckNumMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpAckNumMetricTag) FromProto(msg *otg.PatternFlowTcpAckNumMetricTag) (PatternFlowTcpAckNumMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpAckNumMetricTag) 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 *unMarshalpatternFlowTcpAckNumMetricTag) 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 *marshalpatternFlowTcpAckNumMetricTag) 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 *unMarshalpatternFlowTcpAckNumMetricTag) 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 *marshalpatternFlowTcpAckNumMetricTag) 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 *unMarshalpatternFlowTcpAckNumMetricTag) 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 *patternFlowTcpAckNumMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpAckNumMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpAckNumMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpAckNumMetricTag) Clone() (PatternFlowTcpAckNumMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpAckNumMetricTag() + 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 +} + +// PatternFlowTcpAckNumMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpAckNumMetricTag interface { + Validation + // msg marshals PatternFlowTcpAckNumMetricTag to protobuf object *otg.PatternFlowTcpAckNumMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpAckNumMetricTag + // setMsg unmarshals PatternFlowTcpAckNumMetricTag from protobuf object *otg.PatternFlowTcpAckNumMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpAckNumMetricTag) PatternFlowTcpAckNumMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpAckNumMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpAckNumMetricTag + // validate validates PatternFlowTcpAckNumMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpAckNumMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpAckNumMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpAckNumMetricTag + SetName(value string) PatternFlowTcpAckNumMetricTag + // Offset returns uint32, set in PatternFlowTcpAckNumMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpAckNumMetricTag + SetOffset(value uint32) PatternFlowTcpAckNumMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpAckNumMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpAckNumMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpAckNumMetricTag + SetLength(value uint32) PatternFlowTcpAckNumMetricTag + // HasLength checks if Length has been set in PatternFlowTcpAckNumMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpAckNumMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpAckNumMetricTag object +func (obj *patternFlowTcpAckNumMetricTag) SetName(value string) PatternFlowTcpAckNumMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpAckNumMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpAckNumMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpAckNumMetricTag object +func (obj *patternFlowTcpAckNumMetricTag) SetOffset(value uint32) PatternFlowTcpAckNumMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpAckNumMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpAckNumMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpAckNumMetricTag object +func (obj *patternFlowTcpAckNumMetricTag) SetLength(value uint32) PatternFlowTcpAckNumMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpAckNumMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpAckNumMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpAckNumMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpAckNumMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpAckNumMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(32) + } + +} diff --git a/gosnappi/pattern_flow_tcp_checksum.go b/gosnappi/pattern_flow_tcp_checksum.go new file mode 100644 index 00000000..293db4db --- /dev/null +++ b/gosnappi/pattern_flow_tcp_checksum.go @@ -0,0 +1,434 @@ +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" +) + +// ***** PatternFlowTcpChecksum ***** +type patternFlowTcpChecksum struct { + validation + obj *otg.PatternFlowTcpChecksum + marshaller marshalPatternFlowTcpChecksum + unMarshaller unMarshalPatternFlowTcpChecksum +} + +func NewPatternFlowTcpChecksum() PatternFlowTcpChecksum { + obj := patternFlowTcpChecksum{obj: &otg.PatternFlowTcpChecksum{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpChecksum) msg() *otg.PatternFlowTcpChecksum { + return obj.obj +} + +func (obj *patternFlowTcpChecksum) setMsg(msg *otg.PatternFlowTcpChecksum) PatternFlowTcpChecksum { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpChecksum struct { + obj *patternFlowTcpChecksum +} + +type marshalPatternFlowTcpChecksum interface { + // ToProto marshals PatternFlowTcpChecksum to protobuf object *otg.PatternFlowTcpChecksum + ToProto() (*otg.PatternFlowTcpChecksum, error) + // ToPbText marshals PatternFlowTcpChecksum to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpChecksum to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpChecksum to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpChecksum struct { + obj *patternFlowTcpChecksum +} + +type unMarshalPatternFlowTcpChecksum interface { + // FromProto unmarshals PatternFlowTcpChecksum from protobuf object *otg.PatternFlowTcpChecksum + FromProto(msg *otg.PatternFlowTcpChecksum) (PatternFlowTcpChecksum, error) + // FromPbText unmarshals PatternFlowTcpChecksum from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpChecksum from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpChecksum from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpChecksum) Marshal() marshalPatternFlowTcpChecksum { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpChecksum{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpChecksum) Unmarshal() unMarshalPatternFlowTcpChecksum { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpChecksum{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpChecksum) ToProto() (*otg.PatternFlowTcpChecksum, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpChecksum) FromProto(msg *otg.PatternFlowTcpChecksum) (PatternFlowTcpChecksum, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpChecksum) 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 *unMarshalpatternFlowTcpChecksum) 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 *marshalpatternFlowTcpChecksum) 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 *unMarshalpatternFlowTcpChecksum) 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 *marshalpatternFlowTcpChecksum) 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 *unMarshalpatternFlowTcpChecksum) 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 *patternFlowTcpChecksum) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpChecksum) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpChecksum) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpChecksum) Clone() (PatternFlowTcpChecksum, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpChecksum() + 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 +} + +// PatternFlowTcpChecksum is the one's complement of the one's complement sum of all 16 bit words in header and text. An all-zero value means that no checksum will be transmitted. While computing the checksum, the checksum field itself is replaced with zeros. +type PatternFlowTcpChecksum interface { + Validation + // msg marshals PatternFlowTcpChecksum to protobuf object *otg.PatternFlowTcpChecksum + // and doesn't set defaults + msg() *otg.PatternFlowTcpChecksum + // setMsg unmarshals PatternFlowTcpChecksum from protobuf object *otg.PatternFlowTcpChecksum + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpChecksum) PatternFlowTcpChecksum + // provides marshal interface + Marshal() marshalPatternFlowTcpChecksum + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpChecksum + // validate validates PatternFlowTcpChecksum + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpChecksum, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpChecksumChoiceEnum, set in PatternFlowTcpChecksum + Choice() PatternFlowTcpChecksumChoiceEnum + // setChoice assigns PatternFlowTcpChecksumChoiceEnum provided by user to PatternFlowTcpChecksum + setChoice(value PatternFlowTcpChecksumChoiceEnum) PatternFlowTcpChecksum + // HasChoice checks if Choice has been set in PatternFlowTcpChecksum + HasChoice() bool + // Generated returns PatternFlowTcpChecksumGeneratedEnum, set in PatternFlowTcpChecksum + Generated() PatternFlowTcpChecksumGeneratedEnum + // SetGenerated assigns PatternFlowTcpChecksumGeneratedEnum provided by user to PatternFlowTcpChecksum + SetGenerated(value PatternFlowTcpChecksumGeneratedEnum) PatternFlowTcpChecksum + // HasGenerated checks if Generated has been set in PatternFlowTcpChecksum + HasGenerated() bool + // Custom returns uint32, set in PatternFlowTcpChecksum. + Custom() uint32 + // SetCustom assigns uint32 provided by user to PatternFlowTcpChecksum + SetCustom(value uint32) PatternFlowTcpChecksum + // HasCustom checks if Custom has been set in PatternFlowTcpChecksum + HasCustom() bool +} + +type PatternFlowTcpChecksumChoiceEnum string + +// Enum of Choice on PatternFlowTcpChecksum +var PatternFlowTcpChecksumChoice = struct { + GENERATED PatternFlowTcpChecksumChoiceEnum + CUSTOM PatternFlowTcpChecksumChoiceEnum +}{ + GENERATED: PatternFlowTcpChecksumChoiceEnum("generated"), + CUSTOM: PatternFlowTcpChecksumChoiceEnum("custom"), +} + +func (obj *patternFlowTcpChecksum) Choice() PatternFlowTcpChecksumChoiceEnum { + return PatternFlowTcpChecksumChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The type of checksum +// Choice returns a string +func (obj *patternFlowTcpChecksum) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpChecksum) setChoice(value PatternFlowTcpChecksumChoiceEnum) PatternFlowTcpChecksum { + intValue, ok := otg.PatternFlowTcpChecksum_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpChecksumChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpChecksum_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Custom = nil + obj.obj.Generated = otg.PatternFlowTcpChecksum_Generated_unspecified.Enum() + return obj +} + +type PatternFlowTcpChecksumGeneratedEnum string + +// Enum of Generated on PatternFlowTcpChecksum +var PatternFlowTcpChecksumGenerated = struct { + GOOD PatternFlowTcpChecksumGeneratedEnum + BAD PatternFlowTcpChecksumGeneratedEnum +}{ + GOOD: PatternFlowTcpChecksumGeneratedEnum("good"), + BAD: PatternFlowTcpChecksumGeneratedEnum("bad"), +} + +func (obj *patternFlowTcpChecksum) Generated() PatternFlowTcpChecksumGeneratedEnum { + return PatternFlowTcpChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) +} + +// A system generated checksum value +// Generated returns a string +func (obj *patternFlowTcpChecksum) HasGenerated() bool { + return obj.obj.Generated != nil +} + +func (obj *patternFlowTcpChecksum) SetGenerated(value PatternFlowTcpChecksumGeneratedEnum) PatternFlowTcpChecksum { + intValue, ok := otg.PatternFlowTcpChecksum_Generated_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpChecksumGeneratedEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpChecksum_Generated_Enum(intValue) + obj.obj.Generated = &enumValue + + return obj +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowTcpChecksum) Custom() uint32 { + + if obj.obj.Custom == nil { + obj.setChoice(PatternFlowTcpChecksumChoice.CUSTOM) + } + + return *obj.obj.Custom + +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowTcpChecksum) HasCustom() bool { + return obj.obj.Custom != nil +} + +// A custom checksum value +// SetCustom sets the uint32 value in the PatternFlowTcpChecksum object +func (obj *patternFlowTcpChecksum) SetCustom(value uint32) PatternFlowTcpChecksum { + obj.setChoice(PatternFlowTcpChecksumChoice.CUSTOM) + obj.obj.Custom = &value + return obj +} + +func (obj *patternFlowTcpChecksum) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Custom != nil { + + if *obj.obj.Custom > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpChecksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) + } + + } + +} + +func (obj *patternFlowTcpChecksum) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpChecksumChoiceEnum + + if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { + choices_set += 1 + choice = PatternFlowTcpChecksumChoice.GENERATED + } + + if obj.obj.Custom != nil { + choices_set += 1 + choice = PatternFlowTcpChecksumChoice.CUSTOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpChecksumChoice.GENERATED) + if obj.obj.Generated.Number() == 0 { + obj.SetGenerated(PatternFlowTcpChecksumGenerated.GOOD) + + } + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpChecksum") + } + } else { + intVal := otg.PatternFlowTcpChecksum_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpChecksum_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_ack.go b/gosnappi/pattern_flow_tcp_ctl_ack.go new file mode 100644 index 00000000..a880b381 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_ack.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowTcpCtlAck ***** +type patternFlowTcpCtlAck struct { + validation + obj *otg.PatternFlowTcpCtlAck + marshaller marshalPatternFlowTcpCtlAck + unMarshaller unMarshalPatternFlowTcpCtlAck + incrementHolder PatternFlowTcpCtlAckCounter + decrementHolder PatternFlowTcpCtlAckCounter + metricTagsHolder PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter +} + +func NewPatternFlowTcpCtlAck() PatternFlowTcpCtlAck { + obj := patternFlowTcpCtlAck{obj: &otg.PatternFlowTcpCtlAck{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlAck) msg() *otg.PatternFlowTcpCtlAck { + return obj.obj +} + +func (obj *patternFlowTcpCtlAck) setMsg(msg *otg.PatternFlowTcpCtlAck) PatternFlowTcpCtlAck { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlAck struct { + obj *patternFlowTcpCtlAck +} + +type marshalPatternFlowTcpCtlAck interface { + // ToProto marshals PatternFlowTcpCtlAck to protobuf object *otg.PatternFlowTcpCtlAck + ToProto() (*otg.PatternFlowTcpCtlAck, error) + // ToPbText marshals PatternFlowTcpCtlAck to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlAck to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlAck to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlAck struct { + obj *patternFlowTcpCtlAck +} + +type unMarshalPatternFlowTcpCtlAck interface { + // FromProto unmarshals PatternFlowTcpCtlAck from protobuf object *otg.PatternFlowTcpCtlAck + FromProto(msg *otg.PatternFlowTcpCtlAck) (PatternFlowTcpCtlAck, error) + // FromPbText unmarshals PatternFlowTcpCtlAck from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlAck from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlAck from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlAck) Marshal() marshalPatternFlowTcpCtlAck { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlAck{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlAck) Unmarshal() unMarshalPatternFlowTcpCtlAck { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlAck{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlAck) ToProto() (*otg.PatternFlowTcpCtlAck, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlAck) FromProto(msg *otg.PatternFlowTcpCtlAck) (PatternFlowTcpCtlAck, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlAck) 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 *unMarshalpatternFlowTcpCtlAck) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpCtlAck) 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 *unMarshalpatternFlowTcpCtlAck) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpCtlAck) 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 *unMarshalpatternFlowTcpCtlAck) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpCtlAck) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlAck) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlAck) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlAck) Clone() (PatternFlowTcpCtlAck, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlAck() + 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 +} + +func (obj *patternFlowTcpCtlAck) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpCtlAck is a value of 1 indicates that the ackknowledgment field is significant. +type PatternFlowTcpCtlAck interface { + Validation + // msg marshals PatternFlowTcpCtlAck to protobuf object *otg.PatternFlowTcpCtlAck + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlAck + // setMsg unmarshals PatternFlowTcpCtlAck from protobuf object *otg.PatternFlowTcpCtlAck + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlAck) PatternFlowTcpCtlAck + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlAck + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlAck + // validate validates PatternFlowTcpCtlAck + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlAck, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpCtlAckChoiceEnum, set in PatternFlowTcpCtlAck + Choice() PatternFlowTcpCtlAckChoiceEnum + // setChoice assigns PatternFlowTcpCtlAckChoiceEnum provided by user to PatternFlowTcpCtlAck + setChoice(value PatternFlowTcpCtlAckChoiceEnum) PatternFlowTcpCtlAck + // HasChoice checks if Choice has been set in PatternFlowTcpCtlAck + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpCtlAck. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpCtlAck + SetValue(value uint32) PatternFlowTcpCtlAck + // HasValue checks if Value has been set in PatternFlowTcpCtlAck + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpCtlAck. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpCtlAck + SetValues(value []uint32) PatternFlowTcpCtlAck + // Increment returns PatternFlowTcpCtlAckCounter, set in PatternFlowTcpCtlAck. + // PatternFlowTcpCtlAckCounter is integer counter pattern + Increment() PatternFlowTcpCtlAckCounter + // SetIncrement assigns PatternFlowTcpCtlAckCounter provided by user to PatternFlowTcpCtlAck. + // PatternFlowTcpCtlAckCounter is integer counter pattern + SetIncrement(value PatternFlowTcpCtlAckCounter) PatternFlowTcpCtlAck + // HasIncrement checks if Increment has been set in PatternFlowTcpCtlAck + HasIncrement() bool + // Decrement returns PatternFlowTcpCtlAckCounter, set in PatternFlowTcpCtlAck. + // PatternFlowTcpCtlAckCounter is integer counter pattern + Decrement() PatternFlowTcpCtlAckCounter + // SetDecrement assigns PatternFlowTcpCtlAckCounter provided by user to PatternFlowTcpCtlAck. + // PatternFlowTcpCtlAckCounter is integer counter pattern + SetDecrement(value PatternFlowTcpCtlAckCounter) PatternFlowTcpCtlAck + // HasDecrement checks if Decrement has been set in PatternFlowTcpCtlAck + HasDecrement() bool + // MetricTags returns PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIterIter, set in PatternFlowTcpCtlAck + MetricTags() PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter + setNil() +} + +type PatternFlowTcpCtlAckChoiceEnum string + +// Enum of Choice on PatternFlowTcpCtlAck +var PatternFlowTcpCtlAckChoice = struct { + VALUE PatternFlowTcpCtlAckChoiceEnum + VALUES PatternFlowTcpCtlAckChoiceEnum + INCREMENT PatternFlowTcpCtlAckChoiceEnum + DECREMENT PatternFlowTcpCtlAckChoiceEnum +}{ + VALUE: PatternFlowTcpCtlAckChoiceEnum("value"), + VALUES: PatternFlowTcpCtlAckChoiceEnum("values"), + INCREMENT: PatternFlowTcpCtlAckChoiceEnum("increment"), + DECREMENT: PatternFlowTcpCtlAckChoiceEnum("decrement"), +} + +func (obj *patternFlowTcpCtlAck) Choice() PatternFlowTcpCtlAckChoiceEnum { + return PatternFlowTcpCtlAckChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpCtlAck) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpCtlAck) setChoice(value PatternFlowTcpCtlAckChoiceEnum) PatternFlowTcpCtlAck { + intValue, ok := otg.PatternFlowTcpCtlAck_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpCtlAckChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpCtlAck_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpCtlAckChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpCtlAckChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpCtlAckChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpCtlAckCounter().msg() + } + + if value == PatternFlowTcpCtlAckChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpCtlAckCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpCtlAck) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpCtlAckChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpCtlAck) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpCtlAck object +func (obj *patternFlowTcpCtlAck) SetValue(value uint32) PatternFlowTcpCtlAck { + obj.setChoice(PatternFlowTcpCtlAckChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpCtlAck) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpCtlAck object +func (obj *patternFlowTcpCtlAck) SetValues(value []uint32) PatternFlowTcpCtlAck { + obj.setChoice(PatternFlowTcpCtlAckChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpCtlAckCounter +func (obj *patternFlowTcpCtlAck) Increment() PatternFlowTcpCtlAckCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpCtlAckChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpCtlAckCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpCtlAckCounter +func (obj *patternFlowTcpCtlAck) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpCtlAckCounter value in the PatternFlowTcpCtlAck object +func (obj *patternFlowTcpCtlAck) SetIncrement(value PatternFlowTcpCtlAckCounter) PatternFlowTcpCtlAck { + obj.setChoice(PatternFlowTcpCtlAckChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpCtlAckCounter +func (obj *patternFlowTcpCtlAck) Decrement() PatternFlowTcpCtlAckCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpCtlAckChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpCtlAckCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpCtlAckCounter +func (obj *patternFlowTcpCtlAck) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpCtlAckCounter value in the PatternFlowTcpCtlAck object +func (obj *patternFlowTcpCtlAck) SetDecrement(value PatternFlowTcpCtlAckCounter) PatternFlowTcpCtlAck { + obj.setChoice(PatternFlowTcpCtlAckChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpCtlAckMetricTag +func (obj *patternFlowTcpCtlAck) MetricTags() PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpCtlAckMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter struct { + obj *patternFlowTcpCtlAck + patternFlowTcpCtlAckMetricTagSlice []PatternFlowTcpCtlAckMetricTag + fieldPtr *[]*otg.PatternFlowTcpCtlAckMetricTag +} + +func newPatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter(ptr *[]*otg.PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { + return &patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter interface { + setMsg(*patternFlowTcpCtlAck) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter + Items() []PatternFlowTcpCtlAckMetricTag + Add() PatternFlowTcpCtlAckMetricTag + Append(items ...PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter + Set(index int, newObj PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter + Clear() PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter + clearHolderSlice() PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter + appendHolderSlice(item PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter +} + +func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) setMsg(msg *patternFlowTcpCtlAck) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpCtlAckMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) Items() []PatternFlowTcpCtlAckMetricTag { + return obj.patternFlowTcpCtlAckMetricTagSlice +} + +func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) Add() PatternFlowTcpCtlAckMetricTag { + newObj := &otg.PatternFlowTcpCtlAckMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpCtlAckMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpCtlAckMetricTagSlice = append(obj.patternFlowTcpCtlAckMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) Append(items ...PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpCtlAckMetricTagSlice = append(obj.patternFlowTcpCtlAckMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) Set(index int, newObj PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpCtlAckMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) Clear() PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpCtlAckMetricTag{} + obj.patternFlowTcpCtlAckMetricTagSlice = []PatternFlowTcpCtlAckMetricTag{} + } + return obj +} +func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) clearHolderSlice() PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { + if len(obj.patternFlowTcpCtlAckMetricTagSlice) > 0 { + obj.patternFlowTcpCtlAckMetricTagSlice = []PatternFlowTcpCtlAckMetricTag{} + } + return obj +} +func (obj *patternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter) appendHolderSlice(item PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckPatternFlowTcpCtlAckMetricTagIter { + obj.patternFlowTcpCtlAckMetricTagSlice = append(obj.patternFlowTcpCtlAckMetricTagSlice, item) + return obj +} + +func (obj *patternFlowTcpCtlAck) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlAck.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowTcpCtlAck.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpCtlAckMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowTcpCtlAck) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpCtlAckChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpCtlAckChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpCtlAckChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpCtlAckChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpCtlAckChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpCtlAckChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpCtlAck") + } + } else { + intVal := otg.PatternFlowTcpCtlAck_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpCtlAck_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_ack_counter.go b/gosnappi/pattern_flow_tcp_ctl_ack_counter.go new file mode 100644 index 00000000..5cd36639 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_ack_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowTcpCtlAckCounter ***** +type patternFlowTcpCtlAckCounter struct { + validation + obj *otg.PatternFlowTcpCtlAckCounter + marshaller marshalPatternFlowTcpCtlAckCounter + unMarshaller unMarshalPatternFlowTcpCtlAckCounter +} + +func NewPatternFlowTcpCtlAckCounter() PatternFlowTcpCtlAckCounter { + obj := patternFlowTcpCtlAckCounter{obj: &otg.PatternFlowTcpCtlAckCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlAckCounter) msg() *otg.PatternFlowTcpCtlAckCounter { + return obj.obj +} + +func (obj *patternFlowTcpCtlAckCounter) setMsg(msg *otg.PatternFlowTcpCtlAckCounter) PatternFlowTcpCtlAckCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlAckCounter struct { + obj *patternFlowTcpCtlAckCounter +} + +type marshalPatternFlowTcpCtlAckCounter interface { + // ToProto marshals PatternFlowTcpCtlAckCounter to protobuf object *otg.PatternFlowTcpCtlAckCounter + ToProto() (*otg.PatternFlowTcpCtlAckCounter, error) + // ToPbText marshals PatternFlowTcpCtlAckCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlAckCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlAckCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlAckCounter struct { + obj *patternFlowTcpCtlAckCounter +} + +type unMarshalPatternFlowTcpCtlAckCounter interface { + // FromProto unmarshals PatternFlowTcpCtlAckCounter from protobuf object *otg.PatternFlowTcpCtlAckCounter + FromProto(msg *otg.PatternFlowTcpCtlAckCounter) (PatternFlowTcpCtlAckCounter, error) + // FromPbText unmarshals PatternFlowTcpCtlAckCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlAckCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlAckCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlAckCounter) Marshal() marshalPatternFlowTcpCtlAckCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlAckCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlAckCounter) Unmarshal() unMarshalPatternFlowTcpCtlAckCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlAckCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlAckCounter) ToProto() (*otg.PatternFlowTcpCtlAckCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlAckCounter) FromProto(msg *otg.PatternFlowTcpCtlAckCounter) (PatternFlowTcpCtlAckCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlAckCounter) 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 *unMarshalpatternFlowTcpCtlAckCounter) 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 *marshalpatternFlowTcpCtlAckCounter) 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 *unMarshalpatternFlowTcpCtlAckCounter) 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 *marshalpatternFlowTcpCtlAckCounter) 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 *unMarshalpatternFlowTcpCtlAckCounter) 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 *patternFlowTcpCtlAckCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlAckCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlAckCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlAckCounter) Clone() (PatternFlowTcpCtlAckCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlAckCounter() + 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 +} + +// PatternFlowTcpCtlAckCounter is integer counter pattern +type PatternFlowTcpCtlAckCounter interface { + Validation + // msg marshals PatternFlowTcpCtlAckCounter to protobuf object *otg.PatternFlowTcpCtlAckCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlAckCounter + // setMsg unmarshals PatternFlowTcpCtlAckCounter from protobuf object *otg.PatternFlowTcpCtlAckCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlAckCounter) PatternFlowTcpCtlAckCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlAckCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlAckCounter + // validate validates PatternFlowTcpCtlAckCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlAckCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpCtlAckCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpCtlAckCounter + SetStart(value uint32) PatternFlowTcpCtlAckCounter + // HasStart checks if Start has been set in PatternFlowTcpCtlAckCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpCtlAckCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpCtlAckCounter + SetStep(value uint32) PatternFlowTcpCtlAckCounter + // HasStep checks if Step has been set in PatternFlowTcpCtlAckCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpCtlAckCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpCtlAckCounter + SetCount(value uint32) PatternFlowTcpCtlAckCounter + // HasCount checks if Count has been set in PatternFlowTcpCtlAckCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpCtlAckCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpCtlAckCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpCtlAckCounter object +func (obj *patternFlowTcpCtlAckCounter) SetStart(value uint32) PatternFlowTcpCtlAckCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpCtlAckCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpCtlAckCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpCtlAckCounter object +func (obj *patternFlowTcpCtlAckCounter) SetStep(value uint32) PatternFlowTcpCtlAckCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpCtlAckCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpCtlAckCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpCtlAckCounter object +func (obj *patternFlowTcpCtlAckCounter) SetCount(value uint32) PatternFlowTcpCtlAckCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpCtlAckCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlAckCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlAckCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlAckCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowTcpCtlAckCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_ack_metric_tag.go b/gosnappi/pattern_flow_tcp_ctl_ack_metric_tag.go new file mode 100644 index 00000000..6d9c8889 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_ack_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpCtlAckMetricTag ***** +type patternFlowTcpCtlAckMetricTag struct { + validation + obj *otg.PatternFlowTcpCtlAckMetricTag + marshaller marshalPatternFlowTcpCtlAckMetricTag + unMarshaller unMarshalPatternFlowTcpCtlAckMetricTag +} + +func NewPatternFlowTcpCtlAckMetricTag() PatternFlowTcpCtlAckMetricTag { + obj := patternFlowTcpCtlAckMetricTag{obj: &otg.PatternFlowTcpCtlAckMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlAckMetricTag) msg() *otg.PatternFlowTcpCtlAckMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpCtlAckMetricTag) setMsg(msg *otg.PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlAckMetricTag struct { + obj *patternFlowTcpCtlAckMetricTag +} + +type marshalPatternFlowTcpCtlAckMetricTag interface { + // ToProto marshals PatternFlowTcpCtlAckMetricTag to protobuf object *otg.PatternFlowTcpCtlAckMetricTag + ToProto() (*otg.PatternFlowTcpCtlAckMetricTag, error) + // ToPbText marshals PatternFlowTcpCtlAckMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlAckMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlAckMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlAckMetricTag struct { + obj *patternFlowTcpCtlAckMetricTag +} + +type unMarshalPatternFlowTcpCtlAckMetricTag interface { + // FromProto unmarshals PatternFlowTcpCtlAckMetricTag from protobuf object *otg.PatternFlowTcpCtlAckMetricTag + FromProto(msg *otg.PatternFlowTcpCtlAckMetricTag) (PatternFlowTcpCtlAckMetricTag, error) + // FromPbText unmarshals PatternFlowTcpCtlAckMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlAckMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlAckMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlAckMetricTag) Marshal() marshalPatternFlowTcpCtlAckMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlAckMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlAckMetricTag) Unmarshal() unMarshalPatternFlowTcpCtlAckMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlAckMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlAckMetricTag) ToProto() (*otg.PatternFlowTcpCtlAckMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlAckMetricTag) FromProto(msg *otg.PatternFlowTcpCtlAckMetricTag) (PatternFlowTcpCtlAckMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlAckMetricTag) 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 *unMarshalpatternFlowTcpCtlAckMetricTag) 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 *marshalpatternFlowTcpCtlAckMetricTag) 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 *unMarshalpatternFlowTcpCtlAckMetricTag) 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 *marshalpatternFlowTcpCtlAckMetricTag) 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 *unMarshalpatternFlowTcpCtlAckMetricTag) 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 *patternFlowTcpCtlAckMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlAckMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlAckMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlAckMetricTag) Clone() (PatternFlowTcpCtlAckMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlAckMetricTag() + 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 +} + +// PatternFlowTcpCtlAckMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpCtlAckMetricTag interface { + Validation + // msg marshals PatternFlowTcpCtlAckMetricTag to protobuf object *otg.PatternFlowTcpCtlAckMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlAckMetricTag + // setMsg unmarshals PatternFlowTcpCtlAckMetricTag from protobuf object *otg.PatternFlowTcpCtlAckMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlAckMetricTag) PatternFlowTcpCtlAckMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlAckMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlAckMetricTag + // validate validates PatternFlowTcpCtlAckMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlAckMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpCtlAckMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpCtlAckMetricTag + SetName(value string) PatternFlowTcpCtlAckMetricTag + // Offset returns uint32, set in PatternFlowTcpCtlAckMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpCtlAckMetricTag + SetOffset(value uint32) PatternFlowTcpCtlAckMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpCtlAckMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpCtlAckMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpCtlAckMetricTag + SetLength(value uint32) PatternFlowTcpCtlAckMetricTag + // HasLength checks if Length has been set in PatternFlowTcpCtlAckMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpCtlAckMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpCtlAckMetricTag object +func (obj *patternFlowTcpCtlAckMetricTag) SetName(value string) PatternFlowTcpCtlAckMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpCtlAckMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpCtlAckMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpCtlAckMetricTag object +func (obj *patternFlowTcpCtlAckMetricTag) SetOffset(value uint32) PatternFlowTcpCtlAckMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpCtlAckMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpCtlAckMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpCtlAckMetricTag object +func (obj *patternFlowTcpCtlAckMetricTag) SetLength(value uint32) PatternFlowTcpCtlAckMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpCtlAckMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpCtlAckMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlAckMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpCtlAckMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpCtlAckMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_fin.go b/gosnappi/pattern_flow_tcp_ctl_fin.go new file mode 100644 index 00000000..d2178041 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_fin.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowTcpCtlFin ***** +type patternFlowTcpCtlFin struct { + validation + obj *otg.PatternFlowTcpCtlFin + marshaller marshalPatternFlowTcpCtlFin + unMarshaller unMarshalPatternFlowTcpCtlFin + incrementHolder PatternFlowTcpCtlFinCounter + decrementHolder PatternFlowTcpCtlFinCounter + metricTagsHolder PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter +} + +func NewPatternFlowTcpCtlFin() PatternFlowTcpCtlFin { + obj := patternFlowTcpCtlFin{obj: &otg.PatternFlowTcpCtlFin{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlFin) msg() *otg.PatternFlowTcpCtlFin { + return obj.obj +} + +func (obj *patternFlowTcpCtlFin) setMsg(msg *otg.PatternFlowTcpCtlFin) PatternFlowTcpCtlFin { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlFin struct { + obj *patternFlowTcpCtlFin +} + +type marshalPatternFlowTcpCtlFin interface { + // ToProto marshals PatternFlowTcpCtlFin to protobuf object *otg.PatternFlowTcpCtlFin + ToProto() (*otg.PatternFlowTcpCtlFin, error) + // ToPbText marshals PatternFlowTcpCtlFin to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlFin to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlFin to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlFin struct { + obj *patternFlowTcpCtlFin +} + +type unMarshalPatternFlowTcpCtlFin interface { + // FromProto unmarshals PatternFlowTcpCtlFin from protobuf object *otg.PatternFlowTcpCtlFin + FromProto(msg *otg.PatternFlowTcpCtlFin) (PatternFlowTcpCtlFin, error) + // FromPbText unmarshals PatternFlowTcpCtlFin from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlFin from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlFin from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlFin) Marshal() marshalPatternFlowTcpCtlFin { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlFin{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlFin) Unmarshal() unMarshalPatternFlowTcpCtlFin { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlFin{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlFin) ToProto() (*otg.PatternFlowTcpCtlFin, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlFin) FromProto(msg *otg.PatternFlowTcpCtlFin) (PatternFlowTcpCtlFin, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlFin) 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 *unMarshalpatternFlowTcpCtlFin) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpCtlFin) 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 *unMarshalpatternFlowTcpCtlFin) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpCtlFin) 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 *unMarshalpatternFlowTcpCtlFin) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpCtlFin) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlFin) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlFin) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlFin) Clone() (PatternFlowTcpCtlFin, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlFin() + 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 +} + +func (obj *patternFlowTcpCtlFin) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpCtlFin is last packet from the sender. +type PatternFlowTcpCtlFin interface { + Validation + // msg marshals PatternFlowTcpCtlFin to protobuf object *otg.PatternFlowTcpCtlFin + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlFin + // setMsg unmarshals PatternFlowTcpCtlFin from protobuf object *otg.PatternFlowTcpCtlFin + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlFin) PatternFlowTcpCtlFin + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlFin + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlFin + // validate validates PatternFlowTcpCtlFin + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlFin, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpCtlFinChoiceEnum, set in PatternFlowTcpCtlFin + Choice() PatternFlowTcpCtlFinChoiceEnum + // setChoice assigns PatternFlowTcpCtlFinChoiceEnum provided by user to PatternFlowTcpCtlFin + setChoice(value PatternFlowTcpCtlFinChoiceEnum) PatternFlowTcpCtlFin + // HasChoice checks if Choice has been set in PatternFlowTcpCtlFin + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpCtlFin. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpCtlFin + SetValue(value uint32) PatternFlowTcpCtlFin + // HasValue checks if Value has been set in PatternFlowTcpCtlFin + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpCtlFin. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpCtlFin + SetValues(value []uint32) PatternFlowTcpCtlFin + // Increment returns PatternFlowTcpCtlFinCounter, set in PatternFlowTcpCtlFin. + // PatternFlowTcpCtlFinCounter is integer counter pattern + Increment() PatternFlowTcpCtlFinCounter + // SetIncrement assigns PatternFlowTcpCtlFinCounter provided by user to PatternFlowTcpCtlFin. + // PatternFlowTcpCtlFinCounter is integer counter pattern + SetIncrement(value PatternFlowTcpCtlFinCounter) PatternFlowTcpCtlFin + // HasIncrement checks if Increment has been set in PatternFlowTcpCtlFin + HasIncrement() bool + // Decrement returns PatternFlowTcpCtlFinCounter, set in PatternFlowTcpCtlFin. + // PatternFlowTcpCtlFinCounter is integer counter pattern + Decrement() PatternFlowTcpCtlFinCounter + // SetDecrement assigns PatternFlowTcpCtlFinCounter provided by user to PatternFlowTcpCtlFin. + // PatternFlowTcpCtlFinCounter is integer counter pattern + SetDecrement(value PatternFlowTcpCtlFinCounter) PatternFlowTcpCtlFin + // HasDecrement checks if Decrement has been set in PatternFlowTcpCtlFin + HasDecrement() bool + // MetricTags returns PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIterIter, set in PatternFlowTcpCtlFin + MetricTags() PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter + setNil() +} + +type PatternFlowTcpCtlFinChoiceEnum string + +// Enum of Choice on PatternFlowTcpCtlFin +var PatternFlowTcpCtlFinChoice = struct { + VALUE PatternFlowTcpCtlFinChoiceEnum + VALUES PatternFlowTcpCtlFinChoiceEnum + INCREMENT PatternFlowTcpCtlFinChoiceEnum + DECREMENT PatternFlowTcpCtlFinChoiceEnum +}{ + VALUE: PatternFlowTcpCtlFinChoiceEnum("value"), + VALUES: PatternFlowTcpCtlFinChoiceEnum("values"), + INCREMENT: PatternFlowTcpCtlFinChoiceEnum("increment"), + DECREMENT: PatternFlowTcpCtlFinChoiceEnum("decrement"), +} + +func (obj *patternFlowTcpCtlFin) Choice() PatternFlowTcpCtlFinChoiceEnum { + return PatternFlowTcpCtlFinChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpCtlFin) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpCtlFin) setChoice(value PatternFlowTcpCtlFinChoiceEnum) PatternFlowTcpCtlFin { + intValue, ok := otg.PatternFlowTcpCtlFin_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpCtlFinChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpCtlFin_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpCtlFinChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpCtlFinChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpCtlFinChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpCtlFinCounter().msg() + } + + if value == PatternFlowTcpCtlFinChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpCtlFinCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpCtlFin) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpCtlFinChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpCtlFin) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpCtlFin object +func (obj *patternFlowTcpCtlFin) SetValue(value uint32) PatternFlowTcpCtlFin { + obj.setChoice(PatternFlowTcpCtlFinChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpCtlFin) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpCtlFin object +func (obj *patternFlowTcpCtlFin) SetValues(value []uint32) PatternFlowTcpCtlFin { + obj.setChoice(PatternFlowTcpCtlFinChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpCtlFinCounter +func (obj *patternFlowTcpCtlFin) Increment() PatternFlowTcpCtlFinCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpCtlFinChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpCtlFinCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpCtlFinCounter +func (obj *patternFlowTcpCtlFin) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpCtlFinCounter value in the PatternFlowTcpCtlFin object +func (obj *patternFlowTcpCtlFin) SetIncrement(value PatternFlowTcpCtlFinCounter) PatternFlowTcpCtlFin { + obj.setChoice(PatternFlowTcpCtlFinChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpCtlFinCounter +func (obj *patternFlowTcpCtlFin) Decrement() PatternFlowTcpCtlFinCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpCtlFinChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpCtlFinCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpCtlFinCounter +func (obj *patternFlowTcpCtlFin) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpCtlFinCounter value in the PatternFlowTcpCtlFin object +func (obj *patternFlowTcpCtlFin) SetDecrement(value PatternFlowTcpCtlFinCounter) PatternFlowTcpCtlFin { + obj.setChoice(PatternFlowTcpCtlFinChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpCtlFinMetricTag +func (obj *patternFlowTcpCtlFin) MetricTags() PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpCtlFinMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter struct { + obj *patternFlowTcpCtlFin + patternFlowTcpCtlFinMetricTagSlice []PatternFlowTcpCtlFinMetricTag + fieldPtr *[]*otg.PatternFlowTcpCtlFinMetricTag +} + +func newPatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter(ptr *[]*otg.PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { + return &patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter interface { + setMsg(*patternFlowTcpCtlFin) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter + Items() []PatternFlowTcpCtlFinMetricTag + Add() PatternFlowTcpCtlFinMetricTag + Append(items ...PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter + Set(index int, newObj PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter + Clear() PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter + clearHolderSlice() PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter + appendHolderSlice(item PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter +} + +func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) setMsg(msg *patternFlowTcpCtlFin) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpCtlFinMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) Items() []PatternFlowTcpCtlFinMetricTag { + return obj.patternFlowTcpCtlFinMetricTagSlice +} + +func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) Add() PatternFlowTcpCtlFinMetricTag { + newObj := &otg.PatternFlowTcpCtlFinMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpCtlFinMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpCtlFinMetricTagSlice = append(obj.patternFlowTcpCtlFinMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) Append(items ...PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpCtlFinMetricTagSlice = append(obj.patternFlowTcpCtlFinMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) Set(index int, newObj PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpCtlFinMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) Clear() PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpCtlFinMetricTag{} + obj.patternFlowTcpCtlFinMetricTagSlice = []PatternFlowTcpCtlFinMetricTag{} + } + return obj +} +func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) clearHolderSlice() PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { + if len(obj.patternFlowTcpCtlFinMetricTagSlice) > 0 { + obj.patternFlowTcpCtlFinMetricTagSlice = []PatternFlowTcpCtlFinMetricTag{} + } + return obj +} +func (obj *patternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter) appendHolderSlice(item PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinPatternFlowTcpCtlFinMetricTagIter { + obj.patternFlowTcpCtlFinMetricTagSlice = append(obj.patternFlowTcpCtlFinMetricTagSlice, item) + return obj +} + +func (obj *patternFlowTcpCtlFin) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlFin.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowTcpCtlFin.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpCtlFinMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowTcpCtlFin) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpCtlFinChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpCtlFinChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpCtlFinChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpCtlFinChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpCtlFinChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpCtlFinChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpCtlFin") + } + } else { + intVal := otg.PatternFlowTcpCtlFin_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpCtlFin_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_fin_counter.go b/gosnappi/pattern_flow_tcp_ctl_fin_counter.go new file mode 100644 index 00000000..cd4d08a3 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_fin_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowTcpCtlFinCounter ***** +type patternFlowTcpCtlFinCounter struct { + validation + obj *otg.PatternFlowTcpCtlFinCounter + marshaller marshalPatternFlowTcpCtlFinCounter + unMarshaller unMarshalPatternFlowTcpCtlFinCounter +} + +func NewPatternFlowTcpCtlFinCounter() PatternFlowTcpCtlFinCounter { + obj := patternFlowTcpCtlFinCounter{obj: &otg.PatternFlowTcpCtlFinCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlFinCounter) msg() *otg.PatternFlowTcpCtlFinCounter { + return obj.obj +} + +func (obj *patternFlowTcpCtlFinCounter) setMsg(msg *otg.PatternFlowTcpCtlFinCounter) PatternFlowTcpCtlFinCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlFinCounter struct { + obj *patternFlowTcpCtlFinCounter +} + +type marshalPatternFlowTcpCtlFinCounter interface { + // ToProto marshals PatternFlowTcpCtlFinCounter to protobuf object *otg.PatternFlowTcpCtlFinCounter + ToProto() (*otg.PatternFlowTcpCtlFinCounter, error) + // ToPbText marshals PatternFlowTcpCtlFinCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlFinCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlFinCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlFinCounter struct { + obj *patternFlowTcpCtlFinCounter +} + +type unMarshalPatternFlowTcpCtlFinCounter interface { + // FromProto unmarshals PatternFlowTcpCtlFinCounter from protobuf object *otg.PatternFlowTcpCtlFinCounter + FromProto(msg *otg.PatternFlowTcpCtlFinCounter) (PatternFlowTcpCtlFinCounter, error) + // FromPbText unmarshals PatternFlowTcpCtlFinCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlFinCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlFinCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlFinCounter) Marshal() marshalPatternFlowTcpCtlFinCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlFinCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlFinCounter) Unmarshal() unMarshalPatternFlowTcpCtlFinCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlFinCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlFinCounter) ToProto() (*otg.PatternFlowTcpCtlFinCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlFinCounter) FromProto(msg *otg.PatternFlowTcpCtlFinCounter) (PatternFlowTcpCtlFinCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlFinCounter) 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 *unMarshalpatternFlowTcpCtlFinCounter) 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 *marshalpatternFlowTcpCtlFinCounter) 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 *unMarshalpatternFlowTcpCtlFinCounter) 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 *marshalpatternFlowTcpCtlFinCounter) 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 *unMarshalpatternFlowTcpCtlFinCounter) 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 *patternFlowTcpCtlFinCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlFinCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlFinCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlFinCounter) Clone() (PatternFlowTcpCtlFinCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlFinCounter() + 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 +} + +// PatternFlowTcpCtlFinCounter is integer counter pattern +type PatternFlowTcpCtlFinCounter interface { + Validation + // msg marshals PatternFlowTcpCtlFinCounter to protobuf object *otg.PatternFlowTcpCtlFinCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlFinCounter + // setMsg unmarshals PatternFlowTcpCtlFinCounter from protobuf object *otg.PatternFlowTcpCtlFinCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlFinCounter) PatternFlowTcpCtlFinCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlFinCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlFinCounter + // validate validates PatternFlowTcpCtlFinCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlFinCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpCtlFinCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpCtlFinCounter + SetStart(value uint32) PatternFlowTcpCtlFinCounter + // HasStart checks if Start has been set in PatternFlowTcpCtlFinCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpCtlFinCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpCtlFinCounter + SetStep(value uint32) PatternFlowTcpCtlFinCounter + // HasStep checks if Step has been set in PatternFlowTcpCtlFinCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpCtlFinCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpCtlFinCounter + SetCount(value uint32) PatternFlowTcpCtlFinCounter + // HasCount checks if Count has been set in PatternFlowTcpCtlFinCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpCtlFinCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpCtlFinCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpCtlFinCounter object +func (obj *patternFlowTcpCtlFinCounter) SetStart(value uint32) PatternFlowTcpCtlFinCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpCtlFinCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpCtlFinCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpCtlFinCounter object +func (obj *patternFlowTcpCtlFinCounter) SetStep(value uint32) PatternFlowTcpCtlFinCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpCtlFinCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpCtlFinCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpCtlFinCounter object +func (obj *patternFlowTcpCtlFinCounter) SetCount(value uint32) PatternFlowTcpCtlFinCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpCtlFinCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlFinCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlFinCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlFinCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowTcpCtlFinCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_fin_metric_tag.go b/gosnappi/pattern_flow_tcp_ctl_fin_metric_tag.go new file mode 100644 index 00000000..c74b62b9 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_fin_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpCtlFinMetricTag ***** +type patternFlowTcpCtlFinMetricTag struct { + validation + obj *otg.PatternFlowTcpCtlFinMetricTag + marshaller marshalPatternFlowTcpCtlFinMetricTag + unMarshaller unMarshalPatternFlowTcpCtlFinMetricTag +} + +func NewPatternFlowTcpCtlFinMetricTag() PatternFlowTcpCtlFinMetricTag { + obj := patternFlowTcpCtlFinMetricTag{obj: &otg.PatternFlowTcpCtlFinMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlFinMetricTag) msg() *otg.PatternFlowTcpCtlFinMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpCtlFinMetricTag) setMsg(msg *otg.PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlFinMetricTag struct { + obj *patternFlowTcpCtlFinMetricTag +} + +type marshalPatternFlowTcpCtlFinMetricTag interface { + // ToProto marshals PatternFlowTcpCtlFinMetricTag to protobuf object *otg.PatternFlowTcpCtlFinMetricTag + ToProto() (*otg.PatternFlowTcpCtlFinMetricTag, error) + // ToPbText marshals PatternFlowTcpCtlFinMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlFinMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlFinMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlFinMetricTag struct { + obj *patternFlowTcpCtlFinMetricTag +} + +type unMarshalPatternFlowTcpCtlFinMetricTag interface { + // FromProto unmarshals PatternFlowTcpCtlFinMetricTag from protobuf object *otg.PatternFlowTcpCtlFinMetricTag + FromProto(msg *otg.PatternFlowTcpCtlFinMetricTag) (PatternFlowTcpCtlFinMetricTag, error) + // FromPbText unmarshals PatternFlowTcpCtlFinMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlFinMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlFinMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlFinMetricTag) Marshal() marshalPatternFlowTcpCtlFinMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlFinMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlFinMetricTag) Unmarshal() unMarshalPatternFlowTcpCtlFinMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlFinMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlFinMetricTag) ToProto() (*otg.PatternFlowTcpCtlFinMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlFinMetricTag) FromProto(msg *otg.PatternFlowTcpCtlFinMetricTag) (PatternFlowTcpCtlFinMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlFinMetricTag) 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 *unMarshalpatternFlowTcpCtlFinMetricTag) 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 *marshalpatternFlowTcpCtlFinMetricTag) 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 *unMarshalpatternFlowTcpCtlFinMetricTag) 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 *marshalpatternFlowTcpCtlFinMetricTag) 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 *unMarshalpatternFlowTcpCtlFinMetricTag) 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 *patternFlowTcpCtlFinMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlFinMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlFinMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlFinMetricTag) Clone() (PatternFlowTcpCtlFinMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlFinMetricTag() + 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 +} + +// PatternFlowTcpCtlFinMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpCtlFinMetricTag interface { + Validation + // msg marshals PatternFlowTcpCtlFinMetricTag to protobuf object *otg.PatternFlowTcpCtlFinMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlFinMetricTag + // setMsg unmarshals PatternFlowTcpCtlFinMetricTag from protobuf object *otg.PatternFlowTcpCtlFinMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlFinMetricTag) PatternFlowTcpCtlFinMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlFinMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlFinMetricTag + // validate validates PatternFlowTcpCtlFinMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlFinMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpCtlFinMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpCtlFinMetricTag + SetName(value string) PatternFlowTcpCtlFinMetricTag + // Offset returns uint32, set in PatternFlowTcpCtlFinMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpCtlFinMetricTag + SetOffset(value uint32) PatternFlowTcpCtlFinMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpCtlFinMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpCtlFinMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpCtlFinMetricTag + SetLength(value uint32) PatternFlowTcpCtlFinMetricTag + // HasLength checks if Length has been set in PatternFlowTcpCtlFinMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpCtlFinMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpCtlFinMetricTag object +func (obj *patternFlowTcpCtlFinMetricTag) SetName(value string) PatternFlowTcpCtlFinMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpCtlFinMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpCtlFinMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpCtlFinMetricTag object +func (obj *patternFlowTcpCtlFinMetricTag) SetOffset(value uint32) PatternFlowTcpCtlFinMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpCtlFinMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpCtlFinMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpCtlFinMetricTag object +func (obj *patternFlowTcpCtlFinMetricTag) SetLength(value uint32) PatternFlowTcpCtlFinMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpCtlFinMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpCtlFinMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlFinMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpCtlFinMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpCtlFinMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_psh.go b/gosnappi/pattern_flow_tcp_ctl_psh.go new file mode 100644 index 00000000..b0a571d3 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_psh.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowTcpCtlPsh ***** +type patternFlowTcpCtlPsh struct { + validation + obj *otg.PatternFlowTcpCtlPsh + marshaller marshalPatternFlowTcpCtlPsh + unMarshaller unMarshalPatternFlowTcpCtlPsh + incrementHolder PatternFlowTcpCtlPshCounter + decrementHolder PatternFlowTcpCtlPshCounter + metricTagsHolder PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter +} + +func NewPatternFlowTcpCtlPsh() PatternFlowTcpCtlPsh { + obj := patternFlowTcpCtlPsh{obj: &otg.PatternFlowTcpCtlPsh{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlPsh) msg() *otg.PatternFlowTcpCtlPsh { + return obj.obj +} + +func (obj *patternFlowTcpCtlPsh) setMsg(msg *otg.PatternFlowTcpCtlPsh) PatternFlowTcpCtlPsh { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlPsh struct { + obj *patternFlowTcpCtlPsh +} + +type marshalPatternFlowTcpCtlPsh interface { + // ToProto marshals PatternFlowTcpCtlPsh to protobuf object *otg.PatternFlowTcpCtlPsh + ToProto() (*otg.PatternFlowTcpCtlPsh, error) + // ToPbText marshals PatternFlowTcpCtlPsh to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlPsh to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlPsh to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlPsh struct { + obj *patternFlowTcpCtlPsh +} + +type unMarshalPatternFlowTcpCtlPsh interface { + // FromProto unmarshals PatternFlowTcpCtlPsh from protobuf object *otg.PatternFlowTcpCtlPsh + FromProto(msg *otg.PatternFlowTcpCtlPsh) (PatternFlowTcpCtlPsh, error) + // FromPbText unmarshals PatternFlowTcpCtlPsh from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlPsh from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlPsh from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlPsh) Marshal() marshalPatternFlowTcpCtlPsh { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlPsh{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlPsh) Unmarshal() unMarshalPatternFlowTcpCtlPsh { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlPsh{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlPsh) ToProto() (*otg.PatternFlowTcpCtlPsh, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlPsh) FromProto(msg *otg.PatternFlowTcpCtlPsh) (PatternFlowTcpCtlPsh, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlPsh) 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 *unMarshalpatternFlowTcpCtlPsh) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpCtlPsh) 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 *unMarshalpatternFlowTcpCtlPsh) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpCtlPsh) 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 *unMarshalpatternFlowTcpCtlPsh) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpCtlPsh) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlPsh) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlPsh) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlPsh) Clone() (PatternFlowTcpCtlPsh, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlPsh() + 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 +} + +func (obj *patternFlowTcpCtlPsh) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpCtlPsh is asks to push the buffered data to the receiving application. +type PatternFlowTcpCtlPsh interface { + Validation + // msg marshals PatternFlowTcpCtlPsh to protobuf object *otg.PatternFlowTcpCtlPsh + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlPsh + // setMsg unmarshals PatternFlowTcpCtlPsh from protobuf object *otg.PatternFlowTcpCtlPsh + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlPsh) PatternFlowTcpCtlPsh + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlPsh + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlPsh + // validate validates PatternFlowTcpCtlPsh + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlPsh, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpCtlPshChoiceEnum, set in PatternFlowTcpCtlPsh + Choice() PatternFlowTcpCtlPshChoiceEnum + // setChoice assigns PatternFlowTcpCtlPshChoiceEnum provided by user to PatternFlowTcpCtlPsh + setChoice(value PatternFlowTcpCtlPshChoiceEnum) PatternFlowTcpCtlPsh + // HasChoice checks if Choice has been set in PatternFlowTcpCtlPsh + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpCtlPsh. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpCtlPsh + SetValue(value uint32) PatternFlowTcpCtlPsh + // HasValue checks if Value has been set in PatternFlowTcpCtlPsh + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpCtlPsh. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpCtlPsh + SetValues(value []uint32) PatternFlowTcpCtlPsh + // Increment returns PatternFlowTcpCtlPshCounter, set in PatternFlowTcpCtlPsh. + // PatternFlowTcpCtlPshCounter is integer counter pattern + Increment() PatternFlowTcpCtlPshCounter + // SetIncrement assigns PatternFlowTcpCtlPshCounter provided by user to PatternFlowTcpCtlPsh. + // PatternFlowTcpCtlPshCounter is integer counter pattern + SetIncrement(value PatternFlowTcpCtlPshCounter) PatternFlowTcpCtlPsh + // HasIncrement checks if Increment has been set in PatternFlowTcpCtlPsh + HasIncrement() bool + // Decrement returns PatternFlowTcpCtlPshCounter, set in PatternFlowTcpCtlPsh. + // PatternFlowTcpCtlPshCounter is integer counter pattern + Decrement() PatternFlowTcpCtlPshCounter + // SetDecrement assigns PatternFlowTcpCtlPshCounter provided by user to PatternFlowTcpCtlPsh. + // PatternFlowTcpCtlPshCounter is integer counter pattern + SetDecrement(value PatternFlowTcpCtlPshCounter) PatternFlowTcpCtlPsh + // HasDecrement checks if Decrement has been set in PatternFlowTcpCtlPsh + HasDecrement() bool + // MetricTags returns PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIterIter, set in PatternFlowTcpCtlPsh + MetricTags() PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter + setNil() +} + +type PatternFlowTcpCtlPshChoiceEnum string + +// Enum of Choice on PatternFlowTcpCtlPsh +var PatternFlowTcpCtlPshChoice = struct { + VALUE PatternFlowTcpCtlPshChoiceEnum + VALUES PatternFlowTcpCtlPshChoiceEnum + INCREMENT PatternFlowTcpCtlPshChoiceEnum + DECREMENT PatternFlowTcpCtlPshChoiceEnum +}{ + VALUE: PatternFlowTcpCtlPshChoiceEnum("value"), + VALUES: PatternFlowTcpCtlPshChoiceEnum("values"), + INCREMENT: PatternFlowTcpCtlPshChoiceEnum("increment"), + DECREMENT: PatternFlowTcpCtlPshChoiceEnum("decrement"), +} + +func (obj *patternFlowTcpCtlPsh) Choice() PatternFlowTcpCtlPshChoiceEnum { + return PatternFlowTcpCtlPshChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpCtlPsh) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpCtlPsh) setChoice(value PatternFlowTcpCtlPshChoiceEnum) PatternFlowTcpCtlPsh { + intValue, ok := otg.PatternFlowTcpCtlPsh_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpCtlPshChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpCtlPsh_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpCtlPshChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpCtlPshChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpCtlPshChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpCtlPshCounter().msg() + } + + if value == PatternFlowTcpCtlPshChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpCtlPshCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpCtlPsh) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpCtlPshChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpCtlPsh) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpCtlPsh object +func (obj *patternFlowTcpCtlPsh) SetValue(value uint32) PatternFlowTcpCtlPsh { + obj.setChoice(PatternFlowTcpCtlPshChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpCtlPsh) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpCtlPsh object +func (obj *patternFlowTcpCtlPsh) SetValues(value []uint32) PatternFlowTcpCtlPsh { + obj.setChoice(PatternFlowTcpCtlPshChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpCtlPshCounter +func (obj *patternFlowTcpCtlPsh) Increment() PatternFlowTcpCtlPshCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpCtlPshChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpCtlPshCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpCtlPshCounter +func (obj *patternFlowTcpCtlPsh) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpCtlPshCounter value in the PatternFlowTcpCtlPsh object +func (obj *patternFlowTcpCtlPsh) SetIncrement(value PatternFlowTcpCtlPshCounter) PatternFlowTcpCtlPsh { + obj.setChoice(PatternFlowTcpCtlPshChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpCtlPshCounter +func (obj *patternFlowTcpCtlPsh) Decrement() PatternFlowTcpCtlPshCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpCtlPshChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpCtlPshCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpCtlPshCounter +func (obj *patternFlowTcpCtlPsh) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpCtlPshCounter value in the PatternFlowTcpCtlPsh object +func (obj *patternFlowTcpCtlPsh) SetDecrement(value PatternFlowTcpCtlPshCounter) PatternFlowTcpCtlPsh { + obj.setChoice(PatternFlowTcpCtlPshChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpCtlPshMetricTag +func (obj *patternFlowTcpCtlPsh) MetricTags() PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpCtlPshMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter struct { + obj *patternFlowTcpCtlPsh + patternFlowTcpCtlPshMetricTagSlice []PatternFlowTcpCtlPshMetricTag + fieldPtr *[]*otg.PatternFlowTcpCtlPshMetricTag +} + +func newPatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter(ptr *[]*otg.PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { + return &patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter interface { + setMsg(*patternFlowTcpCtlPsh) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter + Items() []PatternFlowTcpCtlPshMetricTag + Add() PatternFlowTcpCtlPshMetricTag + Append(items ...PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter + Set(index int, newObj PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter + Clear() PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter + clearHolderSlice() PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter + appendHolderSlice(item PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter +} + +func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) setMsg(msg *patternFlowTcpCtlPsh) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpCtlPshMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) Items() []PatternFlowTcpCtlPshMetricTag { + return obj.patternFlowTcpCtlPshMetricTagSlice +} + +func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) Add() PatternFlowTcpCtlPshMetricTag { + newObj := &otg.PatternFlowTcpCtlPshMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpCtlPshMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpCtlPshMetricTagSlice = append(obj.patternFlowTcpCtlPshMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) Append(items ...PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpCtlPshMetricTagSlice = append(obj.patternFlowTcpCtlPshMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) Set(index int, newObj PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpCtlPshMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) Clear() PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpCtlPshMetricTag{} + obj.patternFlowTcpCtlPshMetricTagSlice = []PatternFlowTcpCtlPshMetricTag{} + } + return obj +} +func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) clearHolderSlice() PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { + if len(obj.patternFlowTcpCtlPshMetricTagSlice) > 0 { + obj.patternFlowTcpCtlPshMetricTagSlice = []PatternFlowTcpCtlPshMetricTag{} + } + return obj +} +func (obj *patternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter) appendHolderSlice(item PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshPatternFlowTcpCtlPshMetricTagIter { + obj.patternFlowTcpCtlPshMetricTagSlice = append(obj.patternFlowTcpCtlPshMetricTagSlice, item) + return obj +} + +func (obj *patternFlowTcpCtlPsh) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlPsh.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowTcpCtlPsh.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpCtlPshMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowTcpCtlPsh) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpCtlPshChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpCtlPshChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpCtlPshChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpCtlPshChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpCtlPshChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpCtlPshChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpCtlPsh") + } + } else { + intVal := otg.PatternFlowTcpCtlPsh_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpCtlPsh_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_psh_counter.go b/gosnappi/pattern_flow_tcp_ctl_psh_counter.go new file mode 100644 index 00000000..eced55ab --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_psh_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowTcpCtlPshCounter ***** +type patternFlowTcpCtlPshCounter struct { + validation + obj *otg.PatternFlowTcpCtlPshCounter + marshaller marshalPatternFlowTcpCtlPshCounter + unMarshaller unMarshalPatternFlowTcpCtlPshCounter +} + +func NewPatternFlowTcpCtlPshCounter() PatternFlowTcpCtlPshCounter { + obj := patternFlowTcpCtlPshCounter{obj: &otg.PatternFlowTcpCtlPshCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlPshCounter) msg() *otg.PatternFlowTcpCtlPshCounter { + return obj.obj +} + +func (obj *patternFlowTcpCtlPshCounter) setMsg(msg *otg.PatternFlowTcpCtlPshCounter) PatternFlowTcpCtlPshCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlPshCounter struct { + obj *patternFlowTcpCtlPshCounter +} + +type marshalPatternFlowTcpCtlPshCounter interface { + // ToProto marshals PatternFlowTcpCtlPshCounter to protobuf object *otg.PatternFlowTcpCtlPshCounter + ToProto() (*otg.PatternFlowTcpCtlPshCounter, error) + // ToPbText marshals PatternFlowTcpCtlPshCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlPshCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlPshCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlPshCounter struct { + obj *patternFlowTcpCtlPshCounter +} + +type unMarshalPatternFlowTcpCtlPshCounter interface { + // FromProto unmarshals PatternFlowTcpCtlPshCounter from protobuf object *otg.PatternFlowTcpCtlPshCounter + FromProto(msg *otg.PatternFlowTcpCtlPshCounter) (PatternFlowTcpCtlPshCounter, error) + // FromPbText unmarshals PatternFlowTcpCtlPshCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlPshCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlPshCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlPshCounter) Marshal() marshalPatternFlowTcpCtlPshCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlPshCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlPshCounter) Unmarshal() unMarshalPatternFlowTcpCtlPshCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlPshCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlPshCounter) ToProto() (*otg.PatternFlowTcpCtlPshCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlPshCounter) FromProto(msg *otg.PatternFlowTcpCtlPshCounter) (PatternFlowTcpCtlPshCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlPshCounter) 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 *unMarshalpatternFlowTcpCtlPshCounter) 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 *marshalpatternFlowTcpCtlPshCounter) 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 *unMarshalpatternFlowTcpCtlPshCounter) 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 *marshalpatternFlowTcpCtlPshCounter) 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 *unMarshalpatternFlowTcpCtlPshCounter) 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 *patternFlowTcpCtlPshCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlPshCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlPshCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlPshCounter) Clone() (PatternFlowTcpCtlPshCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlPshCounter() + 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 +} + +// PatternFlowTcpCtlPshCounter is integer counter pattern +type PatternFlowTcpCtlPshCounter interface { + Validation + // msg marshals PatternFlowTcpCtlPshCounter to protobuf object *otg.PatternFlowTcpCtlPshCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlPshCounter + // setMsg unmarshals PatternFlowTcpCtlPshCounter from protobuf object *otg.PatternFlowTcpCtlPshCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlPshCounter) PatternFlowTcpCtlPshCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlPshCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlPshCounter + // validate validates PatternFlowTcpCtlPshCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlPshCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpCtlPshCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpCtlPshCounter + SetStart(value uint32) PatternFlowTcpCtlPshCounter + // HasStart checks if Start has been set in PatternFlowTcpCtlPshCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpCtlPshCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpCtlPshCounter + SetStep(value uint32) PatternFlowTcpCtlPshCounter + // HasStep checks if Step has been set in PatternFlowTcpCtlPshCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpCtlPshCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpCtlPshCounter + SetCount(value uint32) PatternFlowTcpCtlPshCounter + // HasCount checks if Count has been set in PatternFlowTcpCtlPshCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpCtlPshCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpCtlPshCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpCtlPshCounter object +func (obj *patternFlowTcpCtlPshCounter) SetStart(value uint32) PatternFlowTcpCtlPshCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpCtlPshCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpCtlPshCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpCtlPshCounter object +func (obj *patternFlowTcpCtlPshCounter) SetStep(value uint32) PatternFlowTcpCtlPshCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpCtlPshCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpCtlPshCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpCtlPshCounter object +func (obj *patternFlowTcpCtlPshCounter) SetCount(value uint32) PatternFlowTcpCtlPshCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpCtlPshCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlPshCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlPshCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlPshCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowTcpCtlPshCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_psh_metric_tag.go b/gosnappi/pattern_flow_tcp_ctl_psh_metric_tag.go new file mode 100644 index 00000000..4c80f53b --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_psh_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpCtlPshMetricTag ***** +type patternFlowTcpCtlPshMetricTag struct { + validation + obj *otg.PatternFlowTcpCtlPshMetricTag + marshaller marshalPatternFlowTcpCtlPshMetricTag + unMarshaller unMarshalPatternFlowTcpCtlPshMetricTag +} + +func NewPatternFlowTcpCtlPshMetricTag() PatternFlowTcpCtlPshMetricTag { + obj := patternFlowTcpCtlPshMetricTag{obj: &otg.PatternFlowTcpCtlPshMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlPshMetricTag) msg() *otg.PatternFlowTcpCtlPshMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpCtlPshMetricTag) setMsg(msg *otg.PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlPshMetricTag struct { + obj *patternFlowTcpCtlPshMetricTag +} + +type marshalPatternFlowTcpCtlPshMetricTag interface { + // ToProto marshals PatternFlowTcpCtlPshMetricTag to protobuf object *otg.PatternFlowTcpCtlPshMetricTag + ToProto() (*otg.PatternFlowTcpCtlPshMetricTag, error) + // ToPbText marshals PatternFlowTcpCtlPshMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlPshMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlPshMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlPshMetricTag struct { + obj *patternFlowTcpCtlPshMetricTag +} + +type unMarshalPatternFlowTcpCtlPshMetricTag interface { + // FromProto unmarshals PatternFlowTcpCtlPshMetricTag from protobuf object *otg.PatternFlowTcpCtlPshMetricTag + FromProto(msg *otg.PatternFlowTcpCtlPshMetricTag) (PatternFlowTcpCtlPshMetricTag, error) + // FromPbText unmarshals PatternFlowTcpCtlPshMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlPshMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlPshMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlPshMetricTag) Marshal() marshalPatternFlowTcpCtlPshMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlPshMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlPshMetricTag) Unmarshal() unMarshalPatternFlowTcpCtlPshMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlPshMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlPshMetricTag) ToProto() (*otg.PatternFlowTcpCtlPshMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlPshMetricTag) FromProto(msg *otg.PatternFlowTcpCtlPshMetricTag) (PatternFlowTcpCtlPshMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlPshMetricTag) 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 *unMarshalpatternFlowTcpCtlPshMetricTag) 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 *marshalpatternFlowTcpCtlPshMetricTag) 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 *unMarshalpatternFlowTcpCtlPshMetricTag) 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 *marshalpatternFlowTcpCtlPshMetricTag) 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 *unMarshalpatternFlowTcpCtlPshMetricTag) 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 *patternFlowTcpCtlPshMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlPshMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlPshMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlPshMetricTag) Clone() (PatternFlowTcpCtlPshMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlPshMetricTag() + 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 +} + +// PatternFlowTcpCtlPshMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpCtlPshMetricTag interface { + Validation + // msg marshals PatternFlowTcpCtlPshMetricTag to protobuf object *otg.PatternFlowTcpCtlPshMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlPshMetricTag + // setMsg unmarshals PatternFlowTcpCtlPshMetricTag from protobuf object *otg.PatternFlowTcpCtlPshMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlPshMetricTag) PatternFlowTcpCtlPshMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlPshMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlPshMetricTag + // validate validates PatternFlowTcpCtlPshMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlPshMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpCtlPshMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpCtlPshMetricTag + SetName(value string) PatternFlowTcpCtlPshMetricTag + // Offset returns uint32, set in PatternFlowTcpCtlPshMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpCtlPshMetricTag + SetOffset(value uint32) PatternFlowTcpCtlPshMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpCtlPshMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpCtlPshMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpCtlPshMetricTag + SetLength(value uint32) PatternFlowTcpCtlPshMetricTag + // HasLength checks if Length has been set in PatternFlowTcpCtlPshMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpCtlPshMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpCtlPshMetricTag object +func (obj *patternFlowTcpCtlPshMetricTag) SetName(value string) PatternFlowTcpCtlPshMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpCtlPshMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpCtlPshMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpCtlPshMetricTag object +func (obj *patternFlowTcpCtlPshMetricTag) SetOffset(value uint32) PatternFlowTcpCtlPshMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpCtlPshMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpCtlPshMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpCtlPshMetricTag object +func (obj *patternFlowTcpCtlPshMetricTag) SetLength(value uint32) PatternFlowTcpCtlPshMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpCtlPshMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpCtlPshMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlPshMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpCtlPshMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpCtlPshMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_rst.go b/gosnappi/pattern_flow_tcp_ctl_rst.go new file mode 100644 index 00000000..467da200 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_rst.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowTcpCtlRst ***** +type patternFlowTcpCtlRst struct { + validation + obj *otg.PatternFlowTcpCtlRst + marshaller marshalPatternFlowTcpCtlRst + unMarshaller unMarshalPatternFlowTcpCtlRst + incrementHolder PatternFlowTcpCtlRstCounter + decrementHolder PatternFlowTcpCtlRstCounter + metricTagsHolder PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter +} + +func NewPatternFlowTcpCtlRst() PatternFlowTcpCtlRst { + obj := patternFlowTcpCtlRst{obj: &otg.PatternFlowTcpCtlRst{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlRst) msg() *otg.PatternFlowTcpCtlRst { + return obj.obj +} + +func (obj *patternFlowTcpCtlRst) setMsg(msg *otg.PatternFlowTcpCtlRst) PatternFlowTcpCtlRst { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlRst struct { + obj *patternFlowTcpCtlRst +} + +type marshalPatternFlowTcpCtlRst interface { + // ToProto marshals PatternFlowTcpCtlRst to protobuf object *otg.PatternFlowTcpCtlRst + ToProto() (*otg.PatternFlowTcpCtlRst, error) + // ToPbText marshals PatternFlowTcpCtlRst to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlRst to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlRst to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlRst struct { + obj *patternFlowTcpCtlRst +} + +type unMarshalPatternFlowTcpCtlRst interface { + // FromProto unmarshals PatternFlowTcpCtlRst from protobuf object *otg.PatternFlowTcpCtlRst + FromProto(msg *otg.PatternFlowTcpCtlRst) (PatternFlowTcpCtlRst, error) + // FromPbText unmarshals PatternFlowTcpCtlRst from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlRst from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlRst from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlRst) Marshal() marshalPatternFlowTcpCtlRst { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlRst{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlRst) Unmarshal() unMarshalPatternFlowTcpCtlRst { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlRst{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlRst) ToProto() (*otg.PatternFlowTcpCtlRst, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlRst) FromProto(msg *otg.PatternFlowTcpCtlRst) (PatternFlowTcpCtlRst, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlRst) 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 *unMarshalpatternFlowTcpCtlRst) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpCtlRst) 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 *unMarshalpatternFlowTcpCtlRst) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpCtlRst) 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 *unMarshalpatternFlowTcpCtlRst) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpCtlRst) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlRst) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlRst) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlRst) Clone() (PatternFlowTcpCtlRst, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlRst() + 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 +} + +func (obj *patternFlowTcpCtlRst) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpCtlRst is reset the connection. +type PatternFlowTcpCtlRst interface { + Validation + // msg marshals PatternFlowTcpCtlRst to protobuf object *otg.PatternFlowTcpCtlRst + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlRst + // setMsg unmarshals PatternFlowTcpCtlRst from protobuf object *otg.PatternFlowTcpCtlRst + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlRst) PatternFlowTcpCtlRst + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlRst + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlRst + // validate validates PatternFlowTcpCtlRst + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlRst, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpCtlRstChoiceEnum, set in PatternFlowTcpCtlRst + Choice() PatternFlowTcpCtlRstChoiceEnum + // setChoice assigns PatternFlowTcpCtlRstChoiceEnum provided by user to PatternFlowTcpCtlRst + setChoice(value PatternFlowTcpCtlRstChoiceEnum) PatternFlowTcpCtlRst + // HasChoice checks if Choice has been set in PatternFlowTcpCtlRst + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpCtlRst. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpCtlRst + SetValue(value uint32) PatternFlowTcpCtlRst + // HasValue checks if Value has been set in PatternFlowTcpCtlRst + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpCtlRst. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpCtlRst + SetValues(value []uint32) PatternFlowTcpCtlRst + // Increment returns PatternFlowTcpCtlRstCounter, set in PatternFlowTcpCtlRst. + // PatternFlowTcpCtlRstCounter is integer counter pattern + Increment() PatternFlowTcpCtlRstCounter + // SetIncrement assigns PatternFlowTcpCtlRstCounter provided by user to PatternFlowTcpCtlRst. + // PatternFlowTcpCtlRstCounter is integer counter pattern + SetIncrement(value PatternFlowTcpCtlRstCounter) PatternFlowTcpCtlRst + // HasIncrement checks if Increment has been set in PatternFlowTcpCtlRst + HasIncrement() bool + // Decrement returns PatternFlowTcpCtlRstCounter, set in PatternFlowTcpCtlRst. + // PatternFlowTcpCtlRstCounter is integer counter pattern + Decrement() PatternFlowTcpCtlRstCounter + // SetDecrement assigns PatternFlowTcpCtlRstCounter provided by user to PatternFlowTcpCtlRst. + // PatternFlowTcpCtlRstCounter is integer counter pattern + SetDecrement(value PatternFlowTcpCtlRstCounter) PatternFlowTcpCtlRst + // HasDecrement checks if Decrement has been set in PatternFlowTcpCtlRst + HasDecrement() bool + // MetricTags returns PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIterIter, set in PatternFlowTcpCtlRst + MetricTags() PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter + setNil() +} + +type PatternFlowTcpCtlRstChoiceEnum string + +// Enum of Choice on PatternFlowTcpCtlRst +var PatternFlowTcpCtlRstChoice = struct { + VALUE PatternFlowTcpCtlRstChoiceEnum + VALUES PatternFlowTcpCtlRstChoiceEnum + INCREMENT PatternFlowTcpCtlRstChoiceEnum + DECREMENT PatternFlowTcpCtlRstChoiceEnum +}{ + VALUE: PatternFlowTcpCtlRstChoiceEnum("value"), + VALUES: PatternFlowTcpCtlRstChoiceEnum("values"), + INCREMENT: PatternFlowTcpCtlRstChoiceEnum("increment"), + DECREMENT: PatternFlowTcpCtlRstChoiceEnum("decrement"), +} + +func (obj *patternFlowTcpCtlRst) Choice() PatternFlowTcpCtlRstChoiceEnum { + return PatternFlowTcpCtlRstChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpCtlRst) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpCtlRst) setChoice(value PatternFlowTcpCtlRstChoiceEnum) PatternFlowTcpCtlRst { + intValue, ok := otg.PatternFlowTcpCtlRst_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpCtlRstChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpCtlRst_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpCtlRstChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpCtlRstChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpCtlRstChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpCtlRstCounter().msg() + } + + if value == PatternFlowTcpCtlRstChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpCtlRstCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpCtlRst) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpCtlRstChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpCtlRst) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpCtlRst object +func (obj *patternFlowTcpCtlRst) SetValue(value uint32) PatternFlowTcpCtlRst { + obj.setChoice(PatternFlowTcpCtlRstChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpCtlRst) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpCtlRst object +func (obj *patternFlowTcpCtlRst) SetValues(value []uint32) PatternFlowTcpCtlRst { + obj.setChoice(PatternFlowTcpCtlRstChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpCtlRstCounter +func (obj *patternFlowTcpCtlRst) Increment() PatternFlowTcpCtlRstCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpCtlRstChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpCtlRstCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpCtlRstCounter +func (obj *patternFlowTcpCtlRst) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpCtlRstCounter value in the PatternFlowTcpCtlRst object +func (obj *patternFlowTcpCtlRst) SetIncrement(value PatternFlowTcpCtlRstCounter) PatternFlowTcpCtlRst { + obj.setChoice(PatternFlowTcpCtlRstChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpCtlRstCounter +func (obj *patternFlowTcpCtlRst) Decrement() PatternFlowTcpCtlRstCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpCtlRstChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpCtlRstCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpCtlRstCounter +func (obj *patternFlowTcpCtlRst) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpCtlRstCounter value in the PatternFlowTcpCtlRst object +func (obj *patternFlowTcpCtlRst) SetDecrement(value PatternFlowTcpCtlRstCounter) PatternFlowTcpCtlRst { + obj.setChoice(PatternFlowTcpCtlRstChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpCtlRstMetricTag +func (obj *patternFlowTcpCtlRst) MetricTags() PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpCtlRstMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter struct { + obj *patternFlowTcpCtlRst + patternFlowTcpCtlRstMetricTagSlice []PatternFlowTcpCtlRstMetricTag + fieldPtr *[]*otg.PatternFlowTcpCtlRstMetricTag +} + +func newPatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter(ptr *[]*otg.PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { + return &patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter interface { + setMsg(*patternFlowTcpCtlRst) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter + Items() []PatternFlowTcpCtlRstMetricTag + Add() PatternFlowTcpCtlRstMetricTag + Append(items ...PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter + Set(index int, newObj PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter + Clear() PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter + clearHolderSlice() PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter + appendHolderSlice(item PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter +} + +func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) setMsg(msg *patternFlowTcpCtlRst) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpCtlRstMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) Items() []PatternFlowTcpCtlRstMetricTag { + return obj.patternFlowTcpCtlRstMetricTagSlice +} + +func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) Add() PatternFlowTcpCtlRstMetricTag { + newObj := &otg.PatternFlowTcpCtlRstMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpCtlRstMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpCtlRstMetricTagSlice = append(obj.patternFlowTcpCtlRstMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) Append(items ...PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpCtlRstMetricTagSlice = append(obj.patternFlowTcpCtlRstMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) Set(index int, newObj PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpCtlRstMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) Clear() PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpCtlRstMetricTag{} + obj.patternFlowTcpCtlRstMetricTagSlice = []PatternFlowTcpCtlRstMetricTag{} + } + return obj +} +func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) clearHolderSlice() PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { + if len(obj.patternFlowTcpCtlRstMetricTagSlice) > 0 { + obj.patternFlowTcpCtlRstMetricTagSlice = []PatternFlowTcpCtlRstMetricTag{} + } + return obj +} +func (obj *patternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter) appendHolderSlice(item PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstPatternFlowTcpCtlRstMetricTagIter { + obj.patternFlowTcpCtlRstMetricTagSlice = append(obj.patternFlowTcpCtlRstMetricTagSlice, item) + return obj +} + +func (obj *patternFlowTcpCtlRst) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlRst.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowTcpCtlRst.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpCtlRstMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowTcpCtlRst) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpCtlRstChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpCtlRstChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpCtlRstChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpCtlRstChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpCtlRstChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpCtlRstChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpCtlRst") + } + } else { + intVal := otg.PatternFlowTcpCtlRst_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpCtlRst_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_rst_counter.go b/gosnappi/pattern_flow_tcp_ctl_rst_counter.go new file mode 100644 index 00000000..088f6530 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_rst_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowTcpCtlRstCounter ***** +type patternFlowTcpCtlRstCounter struct { + validation + obj *otg.PatternFlowTcpCtlRstCounter + marshaller marshalPatternFlowTcpCtlRstCounter + unMarshaller unMarshalPatternFlowTcpCtlRstCounter +} + +func NewPatternFlowTcpCtlRstCounter() PatternFlowTcpCtlRstCounter { + obj := patternFlowTcpCtlRstCounter{obj: &otg.PatternFlowTcpCtlRstCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlRstCounter) msg() *otg.PatternFlowTcpCtlRstCounter { + return obj.obj +} + +func (obj *patternFlowTcpCtlRstCounter) setMsg(msg *otg.PatternFlowTcpCtlRstCounter) PatternFlowTcpCtlRstCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlRstCounter struct { + obj *patternFlowTcpCtlRstCounter +} + +type marshalPatternFlowTcpCtlRstCounter interface { + // ToProto marshals PatternFlowTcpCtlRstCounter to protobuf object *otg.PatternFlowTcpCtlRstCounter + ToProto() (*otg.PatternFlowTcpCtlRstCounter, error) + // ToPbText marshals PatternFlowTcpCtlRstCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlRstCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlRstCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlRstCounter struct { + obj *patternFlowTcpCtlRstCounter +} + +type unMarshalPatternFlowTcpCtlRstCounter interface { + // FromProto unmarshals PatternFlowTcpCtlRstCounter from protobuf object *otg.PatternFlowTcpCtlRstCounter + FromProto(msg *otg.PatternFlowTcpCtlRstCounter) (PatternFlowTcpCtlRstCounter, error) + // FromPbText unmarshals PatternFlowTcpCtlRstCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlRstCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlRstCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlRstCounter) Marshal() marshalPatternFlowTcpCtlRstCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlRstCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlRstCounter) Unmarshal() unMarshalPatternFlowTcpCtlRstCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlRstCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlRstCounter) ToProto() (*otg.PatternFlowTcpCtlRstCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlRstCounter) FromProto(msg *otg.PatternFlowTcpCtlRstCounter) (PatternFlowTcpCtlRstCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlRstCounter) 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 *unMarshalpatternFlowTcpCtlRstCounter) 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 *marshalpatternFlowTcpCtlRstCounter) 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 *unMarshalpatternFlowTcpCtlRstCounter) 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 *marshalpatternFlowTcpCtlRstCounter) 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 *unMarshalpatternFlowTcpCtlRstCounter) 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 *patternFlowTcpCtlRstCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlRstCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlRstCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlRstCounter) Clone() (PatternFlowTcpCtlRstCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlRstCounter() + 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 +} + +// PatternFlowTcpCtlRstCounter is integer counter pattern +type PatternFlowTcpCtlRstCounter interface { + Validation + // msg marshals PatternFlowTcpCtlRstCounter to protobuf object *otg.PatternFlowTcpCtlRstCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlRstCounter + // setMsg unmarshals PatternFlowTcpCtlRstCounter from protobuf object *otg.PatternFlowTcpCtlRstCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlRstCounter) PatternFlowTcpCtlRstCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlRstCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlRstCounter + // validate validates PatternFlowTcpCtlRstCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlRstCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpCtlRstCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpCtlRstCounter + SetStart(value uint32) PatternFlowTcpCtlRstCounter + // HasStart checks if Start has been set in PatternFlowTcpCtlRstCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpCtlRstCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpCtlRstCounter + SetStep(value uint32) PatternFlowTcpCtlRstCounter + // HasStep checks if Step has been set in PatternFlowTcpCtlRstCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpCtlRstCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpCtlRstCounter + SetCount(value uint32) PatternFlowTcpCtlRstCounter + // HasCount checks if Count has been set in PatternFlowTcpCtlRstCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpCtlRstCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpCtlRstCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpCtlRstCounter object +func (obj *patternFlowTcpCtlRstCounter) SetStart(value uint32) PatternFlowTcpCtlRstCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpCtlRstCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpCtlRstCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpCtlRstCounter object +func (obj *patternFlowTcpCtlRstCounter) SetStep(value uint32) PatternFlowTcpCtlRstCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpCtlRstCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpCtlRstCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpCtlRstCounter object +func (obj *patternFlowTcpCtlRstCounter) SetCount(value uint32) PatternFlowTcpCtlRstCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpCtlRstCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlRstCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlRstCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlRstCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowTcpCtlRstCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_rst_metric_tag.go b/gosnappi/pattern_flow_tcp_ctl_rst_metric_tag.go new file mode 100644 index 00000000..5ba282cb --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_rst_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpCtlRstMetricTag ***** +type patternFlowTcpCtlRstMetricTag struct { + validation + obj *otg.PatternFlowTcpCtlRstMetricTag + marshaller marshalPatternFlowTcpCtlRstMetricTag + unMarshaller unMarshalPatternFlowTcpCtlRstMetricTag +} + +func NewPatternFlowTcpCtlRstMetricTag() PatternFlowTcpCtlRstMetricTag { + obj := patternFlowTcpCtlRstMetricTag{obj: &otg.PatternFlowTcpCtlRstMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlRstMetricTag) msg() *otg.PatternFlowTcpCtlRstMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpCtlRstMetricTag) setMsg(msg *otg.PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlRstMetricTag struct { + obj *patternFlowTcpCtlRstMetricTag +} + +type marshalPatternFlowTcpCtlRstMetricTag interface { + // ToProto marshals PatternFlowTcpCtlRstMetricTag to protobuf object *otg.PatternFlowTcpCtlRstMetricTag + ToProto() (*otg.PatternFlowTcpCtlRstMetricTag, error) + // ToPbText marshals PatternFlowTcpCtlRstMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlRstMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlRstMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlRstMetricTag struct { + obj *patternFlowTcpCtlRstMetricTag +} + +type unMarshalPatternFlowTcpCtlRstMetricTag interface { + // FromProto unmarshals PatternFlowTcpCtlRstMetricTag from protobuf object *otg.PatternFlowTcpCtlRstMetricTag + FromProto(msg *otg.PatternFlowTcpCtlRstMetricTag) (PatternFlowTcpCtlRstMetricTag, error) + // FromPbText unmarshals PatternFlowTcpCtlRstMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlRstMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlRstMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlRstMetricTag) Marshal() marshalPatternFlowTcpCtlRstMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlRstMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlRstMetricTag) Unmarshal() unMarshalPatternFlowTcpCtlRstMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlRstMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlRstMetricTag) ToProto() (*otg.PatternFlowTcpCtlRstMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlRstMetricTag) FromProto(msg *otg.PatternFlowTcpCtlRstMetricTag) (PatternFlowTcpCtlRstMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlRstMetricTag) 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 *unMarshalpatternFlowTcpCtlRstMetricTag) 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 *marshalpatternFlowTcpCtlRstMetricTag) 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 *unMarshalpatternFlowTcpCtlRstMetricTag) 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 *marshalpatternFlowTcpCtlRstMetricTag) 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 *unMarshalpatternFlowTcpCtlRstMetricTag) 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 *patternFlowTcpCtlRstMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlRstMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlRstMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlRstMetricTag) Clone() (PatternFlowTcpCtlRstMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlRstMetricTag() + 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 +} + +// PatternFlowTcpCtlRstMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpCtlRstMetricTag interface { + Validation + // msg marshals PatternFlowTcpCtlRstMetricTag to protobuf object *otg.PatternFlowTcpCtlRstMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlRstMetricTag + // setMsg unmarshals PatternFlowTcpCtlRstMetricTag from protobuf object *otg.PatternFlowTcpCtlRstMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlRstMetricTag) PatternFlowTcpCtlRstMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlRstMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlRstMetricTag + // validate validates PatternFlowTcpCtlRstMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlRstMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpCtlRstMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpCtlRstMetricTag + SetName(value string) PatternFlowTcpCtlRstMetricTag + // Offset returns uint32, set in PatternFlowTcpCtlRstMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpCtlRstMetricTag + SetOffset(value uint32) PatternFlowTcpCtlRstMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpCtlRstMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpCtlRstMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpCtlRstMetricTag + SetLength(value uint32) PatternFlowTcpCtlRstMetricTag + // HasLength checks if Length has been set in PatternFlowTcpCtlRstMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpCtlRstMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpCtlRstMetricTag object +func (obj *patternFlowTcpCtlRstMetricTag) SetName(value string) PatternFlowTcpCtlRstMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpCtlRstMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpCtlRstMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpCtlRstMetricTag object +func (obj *patternFlowTcpCtlRstMetricTag) SetOffset(value uint32) PatternFlowTcpCtlRstMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpCtlRstMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpCtlRstMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpCtlRstMetricTag object +func (obj *patternFlowTcpCtlRstMetricTag) SetLength(value uint32) PatternFlowTcpCtlRstMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpCtlRstMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpCtlRstMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlRstMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpCtlRstMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpCtlRstMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_syn.go b/gosnappi/pattern_flow_tcp_ctl_syn.go new file mode 100644 index 00000000..83446229 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_syn.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowTcpCtlSyn ***** +type patternFlowTcpCtlSyn struct { + validation + obj *otg.PatternFlowTcpCtlSyn + marshaller marshalPatternFlowTcpCtlSyn + unMarshaller unMarshalPatternFlowTcpCtlSyn + incrementHolder PatternFlowTcpCtlSynCounter + decrementHolder PatternFlowTcpCtlSynCounter + metricTagsHolder PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter +} + +func NewPatternFlowTcpCtlSyn() PatternFlowTcpCtlSyn { + obj := patternFlowTcpCtlSyn{obj: &otg.PatternFlowTcpCtlSyn{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlSyn) msg() *otg.PatternFlowTcpCtlSyn { + return obj.obj +} + +func (obj *patternFlowTcpCtlSyn) setMsg(msg *otg.PatternFlowTcpCtlSyn) PatternFlowTcpCtlSyn { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlSyn struct { + obj *patternFlowTcpCtlSyn +} + +type marshalPatternFlowTcpCtlSyn interface { + // ToProto marshals PatternFlowTcpCtlSyn to protobuf object *otg.PatternFlowTcpCtlSyn + ToProto() (*otg.PatternFlowTcpCtlSyn, error) + // ToPbText marshals PatternFlowTcpCtlSyn to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlSyn to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlSyn to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlSyn struct { + obj *patternFlowTcpCtlSyn +} + +type unMarshalPatternFlowTcpCtlSyn interface { + // FromProto unmarshals PatternFlowTcpCtlSyn from protobuf object *otg.PatternFlowTcpCtlSyn + FromProto(msg *otg.PatternFlowTcpCtlSyn) (PatternFlowTcpCtlSyn, error) + // FromPbText unmarshals PatternFlowTcpCtlSyn from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlSyn from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlSyn from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlSyn) Marshal() marshalPatternFlowTcpCtlSyn { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlSyn{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlSyn) Unmarshal() unMarshalPatternFlowTcpCtlSyn { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlSyn{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlSyn) ToProto() (*otg.PatternFlowTcpCtlSyn, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlSyn) FromProto(msg *otg.PatternFlowTcpCtlSyn) (PatternFlowTcpCtlSyn, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlSyn) 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 *unMarshalpatternFlowTcpCtlSyn) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpCtlSyn) 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 *unMarshalpatternFlowTcpCtlSyn) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpCtlSyn) 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 *unMarshalpatternFlowTcpCtlSyn) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpCtlSyn) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlSyn) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlSyn) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlSyn) Clone() (PatternFlowTcpCtlSyn, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlSyn() + 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 +} + +func (obj *patternFlowTcpCtlSyn) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpCtlSyn is synchronize sequenece numbers. +type PatternFlowTcpCtlSyn interface { + Validation + // msg marshals PatternFlowTcpCtlSyn to protobuf object *otg.PatternFlowTcpCtlSyn + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlSyn + // setMsg unmarshals PatternFlowTcpCtlSyn from protobuf object *otg.PatternFlowTcpCtlSyn + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlSyn) PatternFlowTcpCtlSyn + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlSyn + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlSyn + // validate validates PatternFlowTcpCtlSyn + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlSyn, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpCtlSynChoiceEnum, set in PatternFlowTcpCtlSyn + Choice() PatternFlowTcpCtlSynChoiceEnum + // setChoice assigns PatternFlowTcpCtlSynChoiceEnum provided by user to PatternFlowTcpCtlSyn + setChoice(value PatternFlowTcpCtlSynChoiceEnum) PatternFlowTcpCtlSyn + // HasChoice checks if Choice has been set in PatternFlowTcpCtlSyn + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpCtlSyn. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpCtlSyn + SetValue(value uint32) PatternFlowTcpCtlSyn + // HasValue checks if Value has been set in PatternFlowTcpCtlSyn + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpCtlSyn. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpCtlSyn + SetValues(value []uint32) PatternFlowTcpCtlSyn + // Increment returns PatternFlowTcpCtlSynCounter, set in PatternFlowTcpCtlSyn. + // PatternFlowTcpCtlSynCounter is integer counter pattern + Increment() PatternFlowTcpCtlSynCounter + // SetIncrement assigns PatternFlowTcpCtlSynCounter provided by user to PatternFlowTcpCtlSyn. + // PatternFlowTcpCtlSynCounter is integer counter pattern + SetIncrement(value PatternFlowTcpCtlSynCounter) PatternFlowTcpCtlSyn + // HasIncrement checks if Increment has been set in PatternFlowTcpCtlSyn + HasIncrement() bool + // Decrement returns PatternFlowTcpCtlSynCounter, set in PatternFlowTcpCtlSyn. + // PatternFlowTcpCtlSynCounter is integer counter pattern + Decrement() PatternFlowTcpCtlSynCounter + // SetDecrement assigns PatternFlowTcpCtlSynCounter provided by user to PatternFlowTcpCtlSyn. + // PatternFlowTcpCtlSynCounter is integer counter pattern + SetDecrement(value PatternFlowTcpCtlSynCounter) PatternFlowTcpCtlSyn + // HasDecrement checks if Decrement has been set in PatternFlowTcpCtlSyn + HasDecrement() bool + // MetricTags returns PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIterIter, set in PatternFlowTcpCtlSyn + MetricTags() PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter + setNil() +} + +type PatternFlowTcpCtlSynChoiceEnum string + +// Enum of Choice on PatternFlowTcpCtlSyn +var PatternFlowTcpCtlSynChoice = struct { + VALUE PatternFlowTcpCtlSynChoiceEnum + VALUES PatternFlowTcpCtlSynChoiceEnum + INCREMENT PatternFlowTcpCtlSynChoiceEnum + DECREMENT PatternFlowTcpCtlSynChoiceEnum +}{ + VALUE: PatternFlowTcpCtlSynChoiceEnum("value"), + VALUES: PatternFlowTcpCtlSynChoiceEnum("values"), + INCREMENT: PatternFlowTcpCtlSynChoiceEnum("increment"), + DECREMENT: PatternFlowTcpCtlSynChoiceEnum("decrement"), +} + +func (obj *patternFlowTcpCtlSyn) Choice() PatternFlowTcpCtlSynChoiceEnum { + return PatternFlowTcpCtlSynChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpCtlSyn) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpCtlSyn) setChoice(value PatternFlowTcpCtlSynChoiceEnum) PatternFlowTcpCtlSyn { + intValue, ok := otg.PatternFlowTcpCtlSyn_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpCtlSynChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpCtlSyn_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpCtlSynChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpCtlSynChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpCtlSynChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpCtlSynCounter().msg() + } + + if value == PatternFlowTcpCtlSynChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpCtlSynCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpCtlSyn) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpCtlSynChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpCtlSyn) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpCtlSyn object +func (obj *patternFlowTcpCtlSyn) SetValue(value uint32) PatternFlowTcpCtlSyn { + obj.setChoice(PatternFlowTcpCtlSynChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpCtlSyn) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpCtlSyn object +func (obj *patternFlowTcpCtlSyn) SetValues(value []uint32) PatternFlowTcpCtlSyn { + obj.setChoice(PatternFlowTcpCtlSynChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpCtlSynCounter +func (obj *patternFlowTcpCtlSyn) Increment() PatternFlowTcpCtlSynCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpCtlSynChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpCtlSynCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpCtlSynCounter +func (obj *patternFlowTcpCtlSyn) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpCtlSynCounter value in the PatternFlowTcpCtlSyn object +func (obj *patternFlowTcpCtlSyn) SetIncrement(value PatternFlowTcpCtlSynCounter) PatternFlowTcpCtlSyn { + obj.setChoice(PatternFlowTcpCtlSynChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpCtlSynCounter +func (obj *patternFlowTcpCtlSyn) Decrement() PatternFlowTcpCtlSynCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpCtlSynChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpCtlSynCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpCtlSynCounter +func (obj *patternFlowTcpCtlSyn) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpCtlSynCounter value in the PatternFlowTcpCtlSyn object +func (obj *patternFlowTcpCtlSyn) SetDecrement(value PatternFlowTcpCtlSynCounter) PatternFlowTcpCtlSyn { + obj.setChoice(PatternFlowTcpCtlSynChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpCtlSynMetricTag +func (obj *patternFlowTcpCtlSyn) MetricTags() PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpCtlSynMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter struct { + obj *patternFlowTcpCtlSyn + patternFlowTcpCtlSynMetricTagSlice []PatternFlowTcpCtlSynMetricTag + fieldPtr *[]*otg.PatternFlowTcpCtlSynMetricTag +} + +func newPatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter(ptr *[]*otg.PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { + return &patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter interface { + setMsg(*patternFlowTcpCtlSyn) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter + Items() []PatternFlowTcpCtlSynMetricTag + Add() PatternFlowTcpCtlSynMetricTag + Append(items ...PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter + Set(index int, newObj PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter + Clear() PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter + clearHolderSlice() PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter + appendHolderSlice(item PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter +} + +func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) setMsg(msg *patternFlowTcpCtlSyn) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpCtlSynMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) Items() []PatternFlowTcpCtlSynMetricTag { + return obj.patternFlowTcpCtlSynMetricTagSlice +} + +func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) Add() PatternFlowTcpCtlSynMetricTag { + newObj := &otg.PatternFlowTcpCtlSynMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpCtlSynMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpCtlSynMetricTagSlice = append(obj.patternFlowTcpCtlSynMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) Append(items ...PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpCtlSynMetricTagSlice = append(obj.patternFlowTcpCtlSynMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) Set(index int, newObj PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpCtlSynMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) Clear() PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpCtlSynMetricTag{} + obj.patternFlowTcpCtlSynMetricTagSlice = []PatternFlowTcpCtlSynMetricTag{} + } + return obj +} +func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) clearHolderSlice() PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { + if len(obj.patternFlowTcpCtlSynMetricTagSlice) > 0 { + obj.patternFlowTcpCtlSynMetricTagSlice = []PatternFlowTcpCtlSynMetricTag{} + } + return obj +} +func (obj *patternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter) appendHolderSlice(item PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynPatternFlowTcpCtlSynMetricTagIter { + obj.patternFlowTcpCtlSynMetricTagSlice = append(obj.patternFlowTcpCtlSynMetricTagSlice, item) + return obj +} + +func (obj *patternFlowTcpCtlSyn) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlSyn.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowTcpCtlSyn.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpCtlSynMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowTcpCtlSyn) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpCtlSynChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpCtlSynChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpCtlSynChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpCtlSynChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpCtlSynChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpCtlSynChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpCtlSyn") + } + } else { + intVal := otg.PatternFlowTcpCtlSyn_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpCtlSyn_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_syn_counter.go b/gosnappi/pattern_flow_tcp_ctl_syn_counter.go new file mode 100644 index 00000000..3539f039 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_syn_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowTcpCtlSynCounter ***** +type patternFlowTcpCtlSynCounter struct { + validation + obj *otg.PatternFlowTcpCtlSynCounter + marshaller marshalPatternFlowTcpCtlSynCounter + unMarshaller unMarshalPatternFlowTcpCtlSynCounter +} + +func NewPatternFlowTcpCtlSynCounter() PatternFlowTcpCtlSynCounter { + obj := patternFlowTcpCtlSynCounter{obj: &otg.PatternFlowTcpCtlSynCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlSynCounter) msg() *otg.PatternFlowTcpCtlSynCounter { + return obj.obj +} + +func (obj *patternFlowTcpCtlSynCounter) setMsg(msg *otg.PatternFlowTcpCtlSynCounter) PatternFlowTcpCtlSynCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlSynCounter struct { + obj *patternFlowTcpCtlSynCounter +} + +type marshalPatternFlowTcpCtlSynCounter interface { + // ToProto marshals PatternFlowTcpCtlSynCounter to protobuf object *otg.PatternFlowTcpCtlSynCounter + ToProto() (*otg.PatternFlowTcpCtlSynCounter, error) + // ToPbText marshals PatternFlowTcpCtlSynCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlSynCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlSynCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlSynCounter struct { + obj *patternFlowTcpCtlSynCounter +} + +type unMarshalPatternFlowTcpCtlSynCounter interface { + // FromProto unmarshals PatternFlowTcpCtlSynCounter from protobuf object *otg.PatternFlowTcpCtlSynCounter + FromProto(msg *otg.PatternFlowTcpCtlSynCounter) (PatternFlowTcpCtlSynCounter, error) + // FromPbText unmarshals PatternFlowTcpCtlSynCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlSynCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlSynCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlSynCounter) Marshal() marshalPatternFlowTcpCtlSynCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlSynCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlSynCounter) Unmarshal() unMarshalPatternFlowTcpCtlSynCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlSynCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlSynCounter) ToProto() (*otg.PatternFlowTcpCtlSynCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlSynCounter) FromProto(msg *otg.PatternFlowTcpCtlSynCounter) (PatternFlowTcpCtlSynCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlSynCounter) 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 *unMarshalpatternFlowTcpCtlSynCounter) 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 *marshalpatternFlowTcpCtlSynCounter) 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 *unMarshalpatternFlowTcpCtlSynCounter) 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 *marshalpatternFlowTcpCtlSynCounter) 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 *unMarshalpatternFlowTcpCtlSynCounter) 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 *patternFlowTcpCtlSynCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlSynCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlSynCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlSynCounter) Clone() (PatternFlowTcpCtlSynCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlSynCounter() + 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 +} + +// PatternFlowTcpCtlSynCounter is integer counter pattern +type PatternFlowTcpCtlSynCounter interface { + Validation + // msg marshals PatternFlowTcpCtlSynCounter to protobuf object *otg.PatternFlowTcpCtlSynCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlSynCounter + // setMsg unmarshals PatternFlowTcpCtlSynCounter from protobuf object *otg.PatternFlowTcpCtlSynCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlSynCounter) PatternFlowTcpCtlSynCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlSynCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlSynCounter + // validate validates PatternFlowTcpCtlSynCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlSynCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpCtlSynCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpCtlSynCounter + SetStart(value uint32) PatternFlowTcpCtlSynCounter + // HasStart checks if Start has been set in PatternFlowTcpCtlSynCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpCtlSynCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpCtlSynCounter + SetStep(value uint32) PatternFlowTcpCtlSynCounter + // HasStep checks if Step has been set in PatternFlowTcpCtlSynCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpCtlSynCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpCtlSynCounter + SetCount(value uint32) PatternFlowTcpCtlSynCounter + // HasCount checks if Count has been set in PatternFlowTcpCtlSynCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpCtlSynCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpCtlSynCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpCtlSynCounter object +func (obj *patternFlowTcpCtlSynCounter) SetStart(value uint32) PatternFlowTcpCtlSynCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpCtlSynCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpCtlSynCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpCtlSynCounter object +func (obj *patternFlowTcpCtlSynCounter) SetStep(value uint32) PatternFlowTcpCtlSynCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpCtlSynCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpCtlSynCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpCtlSynCounter object +func (obj *patternFlowTcpCtlSynCounter) SetCount(value uint32) PatternFlowTcpCtlSynCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpCtlSynCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlSynCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlSynCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlSynCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowTcpCtlSynCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_syn_metric_tag.go b/gosnappi/pattern_flow_tcp_ctl_syn_metric_tag.go new file mode 100644 index 00000000..4db8adf7 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_syn_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpCtlSynMetricTag ***** +type patternFlowTcpCtlSynMetricTag struct { + validation + obj *otg.PatternFlowTcpCtlSynMetricTag + marshaller marshalPatternFlowTcpCtlSynMetricTag + unMarshaller unMarshalPatternFlowTcpCtlSynMetricTag +} + +func NewPatternFlowTcpCtlSynMetricTag() PatternFlowTcpCtlSynMetricTag { + obj := patternFlowTcpCtlSynMetricTag{obj: &otg.PatternFlowTcpCtlSynMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlSynMetricTag) msg() *otg.PatternFlowTcpCtlSynMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpCtlSynMetricTag) setMsg(msg *otg.PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlSynMetricTag struct { + obj *patternFlowTcpCtlSynMetricTag +} + +type marshalPatternFlowTcpCtlSynMetricTag interface { + // ToProto marshals PatternFlowTcpCtlSynMetricTag to protobuf object *otg.PatternFlowTcpCtlSynMetricTag + ToProto() (*otg.PatternFlowTcpCtlSynMetricTag, error) + // ToPbText marshals PatternFlowTcpCtlSynMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlSynMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlSynMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlSynMetricTag struct { + obj *patternFlowTcpCtlSynMetricTag +} + +type unMarshalPatternFlowTcpCtlSynMetricTag interface { + // FromProto unmarshals PatternFlowTcpCtlSynMetricTag from protobuf object *otg.PatternFlowTcpCtlSynMetricTag + FromProto(msg *otg.PatternFlowTcpCtlSynMetricTag) (PatternFlowTcpCtlSynMetricTag, error) + // FromPbText unmarshals PatternFlowTcpCtlSynMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlSynMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlSynMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlSynMetricTag) Marshal() marshalPatternFlowTcpCtlSynMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlSynMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlSynMetricTag) Unmarshal() unMarshalPatternFlowTcpCtlSynMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlSynMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlSynMetricTag) ToProto() (*otg.PatternFlowTcpCtlSynMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlSynMetricTag) FromProto(msg *otg.PatternFlowTcpCtlSynMetricTag) (PatternFlowTcpCtlSynMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlSynMetricTag) 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 *unMarshalpatternFlowTcpCtlSynMetricTag) 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 *marshalpatternFlowTcpCtlSynMetricTag) 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 *unMarshalpatternFlowTcpCtlSynMetricTag) 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 *marshalpatternFlowTcpCtlSynMetricTag) 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 *unMarshalpatternFlowTcpCtlSynMetricTag) 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 *patternFlowTcpCtlSynMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlSynMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlSynMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlSynMetricTag) Clone() (PatternFlowTcpCtlSynMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlSynMetricTag() + 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 +} + +// PatternFlowTcpCtlSynMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpCtlSynMetricTag interface { + Validation + // msg marshals PatternFlowTcpCtlSynMetricTag to protobuf object *otg.PatternFlowTcpCtlSynMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlSynMetricTag + // setMsg unmarshals PatternFlowTcpCtlSynMetricTag from protobuf object *otg.PatternFlowTcpCtlSynMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlSynMetricTag) PatternFlowTcpCtlSynMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlSynMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlSynMetricTag + // validate validates PatternFlowTcpCtlSynMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlSynMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpCtlSynMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpCtlSynMetricTag + SetName(value string) PatternFlowTcpCtlSynMetricTag + // Offset returns uint32, set in PatternFlowTcpCtlSynMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpCtlSynMetricTag + SetOffset(value uint32) PatternFlowTcpCtlSynMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpCtlSynMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpCtlSynMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpCtlSynMetricTag + SetLength(value uint32) PatternFlowTcpCtlSynMetricTag + // HasLength checks if Length has been set in PatternFlowTcpCtlSynMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpCtlSynMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpCtlSynMetricTag object +func (obj *patternFlowTcpCtlSynMetricTag) SetName(value string) PatternFlowTcpCtlSynMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpCtlSynMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpCtlSynMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpCtlSynMetricTag object +func (obj *patternFlowTcpCtlSynMetricTag) SetOffset(value uint32) PatternFlowTcpCtlSynMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpCtlSynMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpCtlSynMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpCtlSynMetricTag object +func (obj *patternFlowTcpCtlSynMetricTag) SetLength(value uint32) PatternFlowTcpCtlSynMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpCtlSynMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpCtlSynMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlSynMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpCtlSynMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpCtlSynMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_urg.go b/gosnappi/pattern_flow_tcp_ctl_urg.go new file mode 100644 index 00000000..bc61450b --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_urg.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowTcpCtlUrg ***** +type patternFlowTcpCtlUrg struct { + validation + obj *otg.PatternFlowTcpCtlUrg + marshaller marshalPatternFlowTcpCtlUrg + unMarshaller unMarshalPatternFlowTcpCtlUrg + incrementHolder PatternFlowTcpCtlUrgCounter + decrementHolder PatternFlowTcpCtlUrgCounter + metricTagsHolder PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter +} + +func NewPatternFlowTcpCtlUrg() PatternFlowTcpCtlUrg { + obj := patternFlowTcpCtlUrg{obj: &otg.PatternFlowTcpCtlUrg{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlUrg) msg() *otg.PatternFlowTcpCtlUrg { + return obj.obj +} + +func (obj *patternFlowTcpCtlUrg) setMsg(msg *otg.PatternFlowTcpCtlUrg) PatternFlowTcpCtlUrg { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlUrg struct { + obj *patternFlowTcpCtlUrg +} + +type marshalPatternFlowTcpCtlUrg interface { + // ToProto marshals PatternFlowTcpCtlUrg to protobuf object *otg.PatternFlowTcpCtlUrg + ToProto() (*otg.PatternFlowTcpCtlUrg, error) + // ToPbText marshals PatternFlowTcpCtlUrg to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlUrg to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlUrg to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlUrg struct { + obj *patternFlowTcpCtlUrg +} + +type unMarshalPatternFlowTcpCtlUrg interface { + // FromProto unmarshals PatternFlowTcpCtlUrg from protobuf object *otg.PatternFlowTcpCtlUrg + FromProto(msg *otg.PatternFlowTcpCtlUrg) (PatternFlowTcpCtlUrg, error) + // FromPbText unmarshals PatternFlowTcpCtlUrg from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlUrg from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlUrg from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlUrg) Marshal() marshalPatternFlowTcpCtlUrg { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlUrg{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlUrg) Unmarshal() unMarshalPatternFlowTcpCtlUrg { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlUrg{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlUrg) ToProto() (*otg.PatternFlowTcpCtlUrg, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlUrg) FromProto(msg *otg.PatternFlowTcpCtlUrg) (PatternFlowTcpCtlUrg, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlUrg) 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 *unMarshalpatternFlowTcpCtlUrg) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpCtlUrg) 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 *unMarshalpatternFlowTcpCtlUrg) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpCtlUrg) 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 *unMarshalpatternFlowTcpCtlUrg) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpCtlUrg) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlUrg) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlUrg) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlUrg) Clone() (PatternFlowTcpCtlUrg, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlUrg() + 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 +} + +func (obj *patternFlowTcpCtlUrg) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpCtlUrg is a value of 1 indicates that the urgent pointer field is significant. +type PatternFlowTcpCtlUrg interface { + Validation + // msg marshals PatternFlowTcpCtlUrg to protobuf object *otg.PatternFlowTcpCtlUrg + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlUrg + // setMsg unmarshals PatternFlowTcpCtlUrg from protobuf object *otg.PatternFlowTcpCtlUrg + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlUrg) PatternFlowTcpCtlUrg + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlUrg + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlUrg + // validate validates PatternFlowTcpCtlUrg + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlUrg, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpCtlUrgChoiceEnum, set in PatternFlowTcpCtlUrg + Choice() PatternFlowTcpCtlUrgChoiceEnum + // setChoice assigns PatternFlowTcpCtlUrgChoiceEnum provided by user to PatternFlowTcpCtlUrg + setChoice(value PatternFlowTcpCtlUrgChoiceEnum) PatternFlowTcpCtlUrg + // HasChoice checks if Choice has been set in PatternFlowTcpCtlUrg + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpCtlUrg. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpCtlUrg + SetValue(value uint32) PatternFlowTcpCtlUrg + // HasValue checks if Value has been set in PatternFlowTcpCtlUrg + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpCtlUrg. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpCtlUrg + SetValues(value []uint32) PatternFlowTcpCtlUrg + // Increment returns PatternFlowTcpCtlUrgCounter, set in PatternFlowTcpCtlUrg. + // PatternFlowTcpCtlUrgCounter is integer counter pattern + Increment() PatternFlowTcpCtlUrgCounter + // SetIncrement assigns PatternFlowTcpCtlUrgCounter provided by user to PatternFlowTcpCtlUrg. + // PatternFlowTcpCtlUrgCounter is integer counter pattern + SetIncrement(value PatternFlowTcpCtlUrgCounter) PatternFlowTcpCtlUrg + // HasIncrement checks if Increment has been set in PatternFlowTcpCtlUrg + HasIncrement() bool + // Decrement returns PatternFlowTcpCtlUrgCounter, set in PatternFlowTcpCtlUrg. + // PatternFlowTcpCtlUrgCounter is integer counter pattern + Decrement() PatternFlowTcpCtlUrgCounter + // SetDecrement assigns PatternFlowTcpCtlUrgCounter provided by user to PatternFlowTcpCtlUrg. + // PatternFlowTcpCtlUrgCounter is integer counter pattern + SetDecrement(value PatternFlowTcpCtlUrgCounter) PatternFlowTcpCtlUrg + // HasDecrement checks if Decrement has been set in PatternFlowTcpCtlUrg + HasDecrement() bool + // MetricTags returns PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIterIter, set in PatternFlowTcpCtlUrg + MetricTags() PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter + setNil() +} + +type PatternFlowTcpCtlUrgChoiceEnum string + +// Enum of Choice on PatternFlowTcpCtlUrg +var PatternFlowTcpCtlUrgChoice = struct { + VALUE PatternFlowTcpCtlUrgChoiceEnum + VALUES PatternFlowTcpCtlUrgChoiceEnum + INCREMENT PatternFlowTcpCtlUrgChoiceEnum + DECREMENT PatternFlowTcpCtlUrgChoiceEnum +}{ + VALUE: PatternFlowTcpCtlUrgChoiceEnum("value"), + VALUES: PatternFlowTcpCtlUrgChoiceEnum("values"), + INCREMENT: PatternFlowTcpCtlUrgChoiceEnum("increment"), + DECREMENT: PatternFlowTcpCtlUrgChoiceEnum("decrement"), +} + +func (obj *patternFlowTcpCtlUrg) Choice() PatternFlowTcpCtlUrgChoiceEnum { + return PatternFlowTcpCtlUrgChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpCtlUrg) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpCtlUrg) setChoice(value PatternFlowTcpCtlUrgChoiceEnum) PatternFlowTcpCtlUrg { + intValue, ok := otg.PatternFlowTcpCtlUrg_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpCtlUrgChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpCtlUrg_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpCtlUrgChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpCtlUrgChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpCtlUrgChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpCtlUrgCounter().msg() + } + + if value == PatternFlowTcpCtlUrgChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpCtlUrgCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpCtlUrg) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpCtlUrgChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpCtlUrg) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpCtlUrg object +func (obj *patternFlowTcpCtlUrg) SetValue(value uint32) PatternFlowTcpCtlUrg { + obj.setChoice(PatternFlowTcpCtlUrgChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpCtlUrg) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpCtlUrg object +func (obj *patternFlowTcpCtlUrg) SetValues(value []uint32) PatternFlowTcpCtlUrg { + obj.setChoice(PatternFlowTcpCtlUrgChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpCtlUrgCounter +func (obj *patternFlowTcpCtlUrg) Increment() PatternFlowTcpCtlUrgCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpCtlUrgChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpCtlUrgCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpCtlUrgCounter +func (obj *patternFlowTcpCtlUrg) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpCtlUrgCounter value in the PatternFlowTcpCtlUrg object +func (obj *patternFlowTcpCtlUrg) SetIncrement(value PatternFlowTcpCtlUrgCounter) PatternFlowTcpCtlUrg { + obj.setChoice(PatternFlowTcpCtlUrgChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpCtlUrgCounter +func (obj *patternFlowTcpCtlUrg) Decrement() PatternFlowTcpCtlUrgCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpCtlUrgChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpCtlUrgCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpCtlUrgCounter +func (obj *patternFlowTcpCtlUrg) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpCtlUrgCounter value in the PatternFlowTcpCtlUrg object +func (obj *patternFlowTcpCtlUrg) SetDecrement(value PatternFlowTcpCtlUrgCounter) PatternFlowTcpCtlUrg { + obj.setChoice(PatternFlowTcpCtlUrgChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpCtlUrgMetricTag +func (obj *patternFlowTcpCtlUrg) MetricTags() PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpCtlUrgMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter struct { + obj *patternFlowTcpCtlUrg + patternFlowTcpCtlUrgMetricTagSlice []PatternFlowTcpCtlUrgMetricTag + fieldPtr *[]*otg.PatternFlowTcpCtlUrgMetricTag +} + +func newPatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter(ptr *[]*otg.PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { + return &patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter interface { + setMsg(*patternFlowTcpCtlUrg) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter + Items() []PatternFlowTcpCtlUrgMetricTag + Add() PatternFlowTcpCtlUrgMetricTag + Append(items ...PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter + Set(index int, newObj PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter + Clear() PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter + clearHolderSlice() PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter + appendHolderSlice(item PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter +} + +func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) setMsg(msg *patternFlowTcpCtlUrg) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpCtlUrgMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) Items() []PatternFlowTcpCtlUrgMetricTag { + return obj.patternFlowTcpCtlUrgMetricTagSlice +} + +func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) Add() PatternFlowTcpCtlUrgMetricTag { + newObj := &otg.PatternFlowTcpCtlUrgMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpCtlUrgMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpCtlUrgMetricTagSlice = append(obj.patternFlowTcpCtlUrgMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) Append(items ...PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpCtlUrgMetricTagSlice = append(obj.patternFlowTcpCtlUrgMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) Set(index int, newObj PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpCtlUrgMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) Clear() PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpCtlUrgMetricTag{} + obj.patternFlowTcpCtlUrgMetricTagSlice = []PatternFlowTcpCtlUrgMetricTag{} + } + return obj +} +func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) clearHolderSlice() PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { + if len(obj.patternFlowTcpCtlUrgMetricTagSlice) > 0 { + obj.patternFlowTcpCtlUrgMetricTagSlice = []PatternFlowTcpCtlUrgMetricTag{} + } + return obj +} +func (obj *patternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter) appendHolderSlice(item PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgPatternFlowTcpCtlUrgMetricTagIter { + obj.patternFlowTcpCtlUrgMetricTagSlice = append(obj.patternFlowTcpCtlUrgMetricTagSlice, item) + return obj +} + +func (obj *patternFlowTcpCtlUrg) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlUrg.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowTcpCtlUrg.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpCtlUrgMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowTcpCtlUrg) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpCtlUrgChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpCtlUrgChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpCtlUrgChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpCtlUrgChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpCtlUrgChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpCtlUrgChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpCtlUrg") + } + } else { + intVal := otg.PatternFlowTcpCtlUrg_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpCtlUrg_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_urg_counter.go b/gosnappi/pattern_flow_tcp_ctl_urg_counter.go new file mode 100644 index 00000000..ae3ac109 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_urg_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowTcpCtlUrgCounter ***** +type patternFlowTcpCtlUrgCounter struct { + validation + obj *otg.PatternFlowTcpCtlUrgCounter + marshaller marshalPatternFlowTcpCtlUrgCounter + unMarshaller unMarshalPatternFlowTcpCtlUrgCounter +} + +func NewPatternFlowTcpCtlUrgCounter() PatternFlowTcpCtlUrgCounter { + obj := patternFlowTcpCtlUrgCounter{obj: &otg.PatternFlowTcpCtlUrgCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlUrgCounter) msg() *otg.PatternFlowTcpCtlUrgCounter { + return obj.obj +} + +func (obj *patternFlowTcpCtlUrgCounter) setMsg(msg *otg.PatternFlowTcpCtlUrgCounter) PatternFlowTcpCtlUrgCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlUrgCounter struct { + obj *patternFlowTcpCtlUrgCounter +} + +type marshalPatternFlowTcpCtlUrgCounter interface { + // ToProto marshals PatternFlowTcpCtlUrgCounter to protobuf object *otg.PatternFlowTcpCtlUrgCounter + ToProto() (*otg.PatternFlowTcpCtlUrgCounter, error) + // ToPbText marshals PatternFlowTcpCtlUrgCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlUrgCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlUrgCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlUrgCounter struct { + obj *patternFlowTcpCtlUrgCounter +} + +type unMarshalPatternFlowTcpCtlUrgCounter interface { + // FromProto unmarshals PatternFlowTcpCtlUrgCounter from protobuf object *otg.PatternFlowTcpCtlUrgCounter + FromProto(msg *otg.PatternFlowTcpCtlUrgCounter) (PatternFlowTcpCtlUrgCounter, error) + // FromPbText unmarshals PatternFlowTcpCtlUrgCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlUrgCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlUrgCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlUrgCounter) Marshal() marshalPatternFlowTcpCtlUrgCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlUrgCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlUrgCounter) Unmarshal() unMarshalPatternFlowTcpCtlUrgCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlUrgCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlUrgCounter) ToProto() (*otg.PatternFlowTcpCtlUrgCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlUrgCounter) FromProto(msg *otg.PatternFlowTcpCtlUrgCounter) (PatternFlowTcpCtlUrgCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlUrgCounter) 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 *unMarshalpatternFlowTcpCtlUrgCounter) 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 *marshalpatternFlowTcpCtlUrgCounter) 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 *unMarshalpatternFlowTcpCtlUrgCounter) 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 *marshalpatternFlowTcpCtlUrgCounter) 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 *unMarshalpatternFlowTcpCtlUrgCounter) 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 *patternFlowTcpCtlUrgCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlUrgCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlUrgCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlUrgCounter) Clone() (PatternFlowTcpCtlUrgCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlUrgCounter() + 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 +} + +// PatternFlowTcpCtlUrgCounter is integer counter pattern +type PatternFlowTcpCtlUrgCounter interface { + Validation + // msg marshals PatternFlowTcpCtlUrgCounter to protobuf object *otg.PatternFlowTcpCtlUrgCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlUrgCounter + // setMsg unmarshals PatternFlowTcpCtlUrgCounter from protobuf object *otg.PatternFlowTcpCtlUrgCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlUrgCounter) PatternFlowTcpCtlUrgCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlUrgCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlUrgCounter + // validate validates PatternFlowTcpCtlUrgCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlUrgCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpCtlUrgCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpCtlUrgCounter + SetStart(value uint32) PatternFlowTcpCtlUrgCounter + // HasStart checks if Start has been set in PatternFlowTcpCtlUrgCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpCtlUrgCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpCtlUrgCounter + SetStep(value uint32) PatternFlowTcpCtlUrgCounter + // HasStep checks if Step has been set in PatternFlowTcpCtlUrgCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpCtlUrgCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpCtlUrgCounter + SetCount(value uint32) PatternFlowTcpCtlUrgCounter + // HasCount checks if Count has been set in PatternFlowTcpCtlUrgCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpCtlUrgCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpCtlUrgCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpCtlUrgCounter object +func (obj *patternFlowTcpCtlUrgCounter) SetStart(value uint32) PatternFlowTcpCtlUrgCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpCtlUrgCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpCtlUrgCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpCtlUrgCounter object +func (obj *patternFlowTcpCtlUrgCounter) SetStep(value uint32) PatternFlowTcpCtlUrgCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpCtlUrgCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpCtlUrgCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpCtlUrgCounter object +func (obj *patternFlowTcpCtlUrgCounter) SetCount(value uint32) PatternFlowTcpCtlUrgCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpCtlUrgCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlUrgCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlUrgCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlUrgCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowTcpCtlUrgCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ctl_urg_metric_tag.go b/gosnappi/pattern_flow_tcp_ctl_urg_metric_tag.go new file mode 100644 index 00000000..7bfee731 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ctl_urg_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpCtlUrgMetricTag ***** +type patternFlowTcpCtlUrgMetricTag struct { + validation + obj *otg.PatternFlowTcpCtlUrgMetricTag + marshaller marshalPatternFlowTcpCtlUrgMetricTag + unMarshaller unMarshalPatternFlowTcpCtlUrgMetricTag +} + +func NewPatternFlowTcpCtlUrgMetricTag() PatternFlowTcpCtlUrgMetricTag { + obj := patternFlowTcpCtlUrgMetricTag{obj: &otg.PatternFlowTcpCtlUrgMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpCtlUrgMetricTag) msg() *otg.PatternFlowTcpCtlUrgMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpCtlUrgMetricTag) setMsg(msg *otg.PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpCtlUrgMetricTag struct { + obj *patternFlowTcpCtlUrgMetricTag +} + +type marshalPatternFlowTcpCtlUrgMetricTag interface { + // ToProto marshals PatternFlowTcpCtlUrgMetricTag to protobuf object *otg.PatternFlowTcpCtlUrgMetricTag + ToProto() (*otg.PatternFlowTcpCtlUrgMetricTag, error) + // ToPbText marshals PatternFlowTcpCtlUrgMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpCtlUrgMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpCtlUrgMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpCtlUrgMetricTag struct { + obj *patternFlowTcpCtlUrgMetricTag +} + +type unMarshalPatternFlowTcpCtlUrgMetricTag interface { + // FromProto unmarshals PatternFlowTcpCtlUrgMetricTag from protobuf object *otg.PatternFlowTcpCtlUrgMetricTag + FromProto(msg *otg.PatternFlowTcpCtlUrgMetricTag) (PatternFlowTcpCtlUrgMetricTag, error) + // FromPbText unmarshals PatternFlowTcpCtlUrgMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpCtlUrgMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpCtlUrgMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpCtlUrgMetricTag) Marshal() marshalPatternFlowTcpCtlUrgMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpCtlUrgMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpCtlUrgMetricTag) Unmarshal() unMarshalPatternFlowTcpCtlUrgMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpCtlUrgMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpCtlUrgMetricTag) ToProto() (*otg.PatternFlowTcpCtlUrgMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpCtlUrgMetricTag) FromProto(msg *otg.PatternFlowTcpCtlUrgMetricTag) (PatternFlowTcpCtlUrgMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpCtlUrgMetricTag) 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 *unMarshalpatternFlowTcpCtlUrgMetricTag) 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 *marshalpatternFlowTcpCtlUrgMetricTag) 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 *unMarshalpatternFlowTcpCtlUrgMetricTag) 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 *marshalpatternFlowTcpCtlUrgMetricTag) 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 *unMarshalpatternFlowTcpCtlUrgMetricTag) 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 *patternFlowTcpCtlUrgMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlUrgMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpCtlUrgMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpCtlUrgMetricTag) Clone() (PatternFlowTcpCtlUrgMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpCtlUrgMetricTag() + 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 +} + +// PatternFlowTcpCtlUrgMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpCtlUrgMetricTag interface { + Validation + // msg marshals PatternFlowTcpCtlUrgMetricTag to protobuf object *otg.PatternFlowTcpCtlUrgMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpCtlUrgMetricTag + // setMsg unmarshals PatternFlowTcpCtlUrgMetricTag from protobuf object *otg.PatternFlowTcpCtlUrgMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpCtlUrgMetricTag) PatternFlowTcpCtlUrgMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpCtlUrgMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpCtlUrgMetricTag + // validate validates PatternFlowTcpCtlUrgMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpCtlUrgMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpCtlUrgMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpCtlUrgMetricTag + SetName(value string) PatternFlowTcpCtlUrgMetricTag + // Offset returns uint32, set in PatternFlowTcpCtlUrgMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpCtlUrgMetricTag + SetOffset(value uint32) PatternFlowTcpCtlUrgMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpCtlUrgMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpCtlUrgMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpCtlUrgMetricTag + SetLength(value uint32) PatternFlowTcpCtlUrgMetricTag + // HasLength checks if Length has been set in PatternFlowTcpCtlUrgMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpCtlUrgMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpCtlUrgMetricTag object +func (obj *patternFlowTcpCtlUrgMetricTag) SetName(value string) PatternFlowTcpCtlUrgMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpCtlUrgMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpCtlUrgMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpCtlUrgMetricTag object +func (obj *patternFlowTcpCtlUrgMetricTag) SetOffset(value uint32) PatternFlowTcpCtlUrgMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpCtlUrgMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpCtlUrgMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpCtlUrgMetricTag object +func (obj *patternFlowTcpCtlUrgMetricTag) SetLength(value uint32) PatternFlowTcpCtlUrgMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpCtlUrgMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpCtlUrgMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpCtlUrgMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpCtlUrgMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpCtlUrgMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_data_offset.go b/gosnappi/pattern_flow_tcp_data_offset.go new file mode 100644 index 00000000..0b1cc4f4 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_data_offset.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowTcpDataOffset ***** +type patternFlowTcpDataOffset struct { + validation + obj *otg.PatternFlowTcpDataOffset + marshaller marshalPatternFlowTcpDataOffset + unMarshaller unMarshalPatternFlowTcpDataOffset + incrementHolder PatternFlowTcpDataOffsetCounter + decrementHolder PatternFlowTcpDataOffsetCounter + metricTagsHolder PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter +} + +func NewPatternFlowTcpDataOffset() PatternFlowTcpDataOffset { + obj := patternFlowTcpDataOffset{obj: &otg.PatternFlowTcpDataOffset{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpDataOffset) msg() *otg.PatternFlowTcpDataOffset { + return obj.obj +} + +func (obj *patternFlowTcpDataOffset) setMsg(msg *otg.PatternFlowTcpDataOffset) PatternFlowTcpDataOffset { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpDataOffset struct { + obj *patternFlowTcpDataOffset +} + +type marshalPatternFlowTcpDataOffset interface { + // ToProto marshals PatternFlowTcpDataOffset to protobuf object *otg.PatternFlowTcpDataOffset + ToProto() (*otg.PatternFlowTcpDataOffset, error) + // ToPbText marshals PatternFlowTcpDataOffset to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpDataOffset to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpDataOffset to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpDataOffset struct { + obj *patternFlowTcpDataOffset +} + +type unMarshalPatternFlowTcpDataOffset interface { + // FromProto unmarshals PatternFlowTcpDataOffset from protobuf object *otg.PatternFlowTcpDataOffset + FromProto(msg *otg.PatternFlowTcpDataOffset) (PatternFlowTcpDataOffset, error) + // FromPbText unmarshals PatternFlowTcpDataOffset from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpDataOffset from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpDataOffset from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpDataOffset) Marshal() marshalPatternFlowTcpDataOffset { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpDataOffset{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpDataOffset) Unmarshal() unMarshalPatternFlowTcpDataOffset { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpDataOffset{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpDataOffset) ToProto() (*otg.PatternFlowTcpDataOffset, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpDataOffset) FromProto(msg *otg.PatternFlowTcpDataOffset) (PatternFlowTcpDataOffset, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpDataOffset) 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 *unMarshalpatternFlowTcpDataOffset) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpDataOffset) 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 *unMarshalpatternFlowTcpDataOffset) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpDataOffset) 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 *unMarshalpatternFlowTcpDataOffset) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpDataOffset) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpDataOffset) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpDataOffset) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpDataOffset) Clone() (PatternFlowTcpDataOffset, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpDataOffset() + 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 +} + +func (obj *patternFlowTcpDataOffset) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpDataOffset is the number of 32 bit words in the TCP header. This indicates where the data begins. +type PatternFlowTcpDataOffset interface { + Validation + // msg marshals PatternFlowTcpDataOffset to protobuf object *otg.PatternFlowTcpDataOffset + // and doesn't set defaults + msg() *otg.PatternFlowTcpDataOffset + // setMsg unmarshals PatternFlowTcpDataOffset from protobuf object *otg.PatternFlowTcpDataOffset + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpDataOffset) PatternFlowTcpDataOffset + // provides marshal interface + Marshal() marshalPatternFlowTcpDataOffset + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpDataOffset + // validate validates PatternFlowTcpDataOffset + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpDataOffset, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpDataOffsetChoiceEnum, set in PatternFlowTcpDataOffset + Choice() PatternFlowTcpDataOffsetChoiceEnum + // setChoice assigns PatternFlowTcpDataOffsetChoiceEnum provided by user to PatternFlowTcpDataOffset + setChoice(value PatternFlowTcpDataOffsetChoiceEnum) PatternFlowTcpDataOffset + // HasChoice checks if Choice has been set in PatternFlowTcpDataOffset + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpDataOffset. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpDataOffset + SetValue(value uint32) PatternFlowTcpDataOffset + // HasValue checks if Value has been set in PatternFlowTcpDataOffset + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpDataOffset. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpDataOffset + SetValues(value []uint32) PatternFlowTcpDataOffset + // Increment returns PatternFlowTcpDataOffsetCounter, set in PatternFlowTcpDataOffset. + // PatternFlowTcpDataOffsetCounter is integer counter pattern + Increment() PatternFlowTcpDataOffsetCounter + // SetIncrement assigns PatternFlowTcpDataOffsetCounter provided by user to PatternFlowTcpDataOffset. + // PatternFlowTcpDataOffsetCounter is integer counter pattern + SetIncrement(value PatternFlowTcpDataOffsetCounter) PatternFlowTcpDataOffset + // HasIncrement checks if Increment has been set in PatternFlowTcpDataOffset + HasIncrement() bool + // Decrement returns PatternFlowTcpDataOffsetCounter, set in PatternFlowTcpDataOffset. + // PatternFlowTcpDataOffsetCounter is integer counter pattern + Decrement() PatternFlowTcpDataOffsetCounter + // SetDecrement assigns PatternFlowTcpDataOffsetCounter provided by user to PatternFlowTcpDataOffset. + // PatternFlowTcpDataOffsetCounter is integer counter pattern + SetDecrement(value PatternFlowTcpDataOffsetCounter) PatternFlowTcpDataOffset + // HasDecrement checks if Decrement has been set in PatternFlowTcpDataOffset + HasDecrement() bool + // MetricTags returns PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIterIter, set in PatternFlowTcpDataOffset + MetricTags() PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter + setNil() +} + +type PatternFlowTcpDataOffsetChoiceEnum string + +// Enum of Choice on PatternFlowTcpDataOffset +var PatternFlowTcpDataOffsetChoice = struct { + VALUE PatternFlowTcpDataOffsetChoiceEnum + VALUES PatternFlowTcpDataOffsetChoiceEnum + INCREMENT PatternFlowTcpDataOffsetChoiceEnum + DECREMENT PatternFlowTcpDataOffsetChoiceEnum +}{ + VALUE: PatternFlowTcpDataOffsetChoiceEnum("value"), + VALUES: PatternFlowTcpDataOffsetChoiceEnum("values"), + INCREMENT: PatternFlowTcpDataOffsetChoiceEnum("increment"), + DECREMENT: PatternFlowTcpDataOffsetChoiceEnum("decrement"), +} + +func (obj *patternFlowTcpDataOffset) Choice() PatternFlowTcpDataOffsetChoiceEnum { + return PatternFlowTcpDataOffsetChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpDataOffset) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpDataOffset) setChoice(value PatternFlowTcpDataOffsetChoiceEnum) PatternFlowTcpDataOffset { + intValue, ok := otg.PatternFlowTcpDataOffset_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpDataOffsetChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpDataOffset_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpDataOffsetChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpDataOffsetChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpDataOffsetChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpDataOffsetCounter().msg() + } + + if value == PatternFlowTcpDataOffsetChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpDataOffsetCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpDataOffset) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpDataOffsetChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpDataOffset) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpDataOffset object +func (obj *patternFlowTcpDataOffset) SetValue(value uint32) PatternFlowTcpDataOffset { + obj.setChoice(PatternFlowTcpDataOffsetChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpDataOffset) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpDataOffset object +func (obj *patternFlowTcpDataOffset) SetValues(value []uint32) PatternFlowTcpDataOffset { + obj.setChoice(PatternFlowTcpDataOffsetChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpDataOffsetCounter +func (obj *patternFlowTcpDataOffset) Increment() PatternFlowTcpDataOffsetCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpDataOffsetChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpDataOffsetCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpDataOffsetCounter +func (obj *patternFlowTcpDataOffset) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpDataOffsetCounter value in the PatternFlowTcpDataOffset object +func (obj *patternFlowTcpDataOffset) SetIncrement(value PatternFlowTcpDataOffsetCounter) PatternFlowTcpDataOffset { + obj.setChoice(PatternFlowTcpDataOffsetChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpDataOffsetCounter +func (obj *patternFlowTcpDataOffset) Decrement() PatternFlowTcpDataOffsetCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpDataOffsetChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpDataOffsetCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpDataOffsetCounter +func (obj *patternFlowTcpDataOffset) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpDataOffsetCounter value in the PatternFlowTcpDataOffset object +func (obj *patternFlowTcpDataOffset) SetDecrement(value PatternFlowTcpDataOffsetCounter) PatternFlowTcpDataOffset { + obj.setChoice(PatternFlowTcpDataOffsetChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpDataOffsetMetricTag +func (obj *patternFlowTcpDataOffset) MetricTags() PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpDataOffsetMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter struct { + obj *patternFlowTcpDataOffset + patternFlowTcpDataOffsetMetricTagSlice []PatternFlowTcpDataOffsetMetricTag + fieldPtr *[]*otg.PatternFlowTcpDataOffsetMetricTag +} + +func newPatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter(ptr *[]*otg.PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { + return &patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter interface { + setMsg(*patternFlowTcpDataOffset) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter + Items() []PatternFlowTcpDataOffsetMetricTag + Add() PatternFlowTcpDataOffsetMetricTag + Append(items ...PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter + Set(index int, newObj PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter + Clear() PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter + clearHolderSlice() PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter + appendHolderSlice(item PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter +} + +func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) setMsg(msg *patternFlowTcpDataOffset) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpDataOffsetMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) Items() []PatternFlowTcpDataOffsetMetricTag { + return obj.patternFlowTcpDataOffsetMetricTagSlice +} + +func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) Add() PatternFlowTcpDataOffsetMetricTag { + newObj := &otg.PatternFlowTcpDataOffsetMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpDataOffsetMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpDataOffsetMetricTagSlice = append(obj.patternFlowTcpDataOffsetMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) Append(items ...PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpDataOffsetMetricTagSlice = append(obj.patternFlowTcpDataOffsetMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) Set(index int, newObj PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpDataOffsetMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) Clear() PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpDataOffsetMetricTag{} + obj.patternFlowTcpDataOffsetMetricTagSlice = []PatternFlowTcpDataOffsetMetricTag{} + } + return obj +} +func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) clearHolderSlice() PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { + if len(obj.patternFlowTcpDataOffsetMetricTagSlice) > 0 { + obj.patternFlowTcpDataOffsetMetricTagSlice = []PatternFlowTcpDataOffsetMetricTag{} + } + return obj +} +func (obj *patternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter) appendHolderSlice(item PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetPatternFlowTcpDataOffsetMetricTagIter { + obj.patternFlowTcpDataOffsetMetricTagSlice = append(obj.patternFlowTcpDataOffsetMetricTagSlice, item) + return obj +} + +func (obj *patternFlowTcpDataOffset) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpDataOffset.Value <= 15 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowTcpDataOffset.Values <= 15 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpDataOffsetMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowTcpDataOffset) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpDataOffsetChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpDataOffsetChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpDataOffsetChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpDataOffsetChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpDataOffsetChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpDataOffsetChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpDataOffset") + } + } else { + intVal := otg.PatternFlowTcpDataOffset_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpDataOffset_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_data_offset_counter.go b/gosnappi/pattern_flow_tcp_data_offset_counter.go new file mode 100644 index 00000000..da68bc2f --- /dev/null +++ b/gosnappi/pattern_flow_tcp_data_offset_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowTcpDataOffsetCounter ***** +type patternFlowTcpDataOffsetCounter struct { + validation + obj *otg.PatternFlowTcpDataOffsetCounter + marshaller marshalPatternFlowTcpDataOffsetCounter + unMarshaller unMarshalPatternFlowTcpDataOffsetCounter +} + +func NewPatternFlowTcpDataOffsetCounter() PatternFlowTcpDataOffsetCounter { + obj := patternFlowTcpDataOffsetCounter{obj: &otg.PatternFlowTcpDataOffsetCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpDataOffsetCounter) msg() *otg.PatternFlowTcpDataOffsetCounter { + return obj.obj +} + +func (obj *patternFlowTcpDataOffsetCounter) setMsg(msg *otg.PatternFlowTcpDataOffsetCounter) PatternFlowTcpDataOffsetCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpDataOffsetCounter struct { + obj *patternFlowTcpDataOffsetCounter +} + +type marshalPatternFlowTcpDataOffsetCounter interface { + // ToProto marshals PatternFlowTcpDataOffsetCounter to protobuf object *otg.PatternFlowTcpDataOffsetCounter + ToProto() (*otg.PatternFlowTcpDataOffsetCounter, error) + // ToPbText marshals PatternFlowTcpDataOffsetCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpDataOffsetCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpDataOffsetCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpDataOffsetCounter struct { + obj *patternFlowTcpDataOffsetCounter +} + +type unMarshalPatternFlowTcpDataOffsetCounter interface { + // FromProto unmarshals PatternFlowTcpDataOffsetCounter from protobuf object *otg.PatternFlowTcpDataOffsetCounter + FromProto(msg *otg.PatternFlowTcpDataOffsetCounter) (PatternFlowTcpDataOffsetCounter, error) + // FromPbText unmarshals PatternFlowTcpDataOffsetCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpDataOffsetCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpDataOffsetCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpDataOffsetCounter) Marshal() marshalPatternFlowTcpDataOffsetCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpDataOffsetCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpDataOffsetCounter) Unmarshal() unMarshalPatternFlowTcpDataOffsetCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpDataOffsetCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpDataOffsetCounter) ToProto() (*otg.PatternFlowTcpDataOffsetCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpDataOffsetCounter) FromProto(msg *otg.PatternFlowTcpDataOffsetCounter) (PatternFlowTcpDataOffsetCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpDataOffsetCounter) 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 *unMarshalpatternFlowTcpDataOffsetCounter) 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 *marshalpatternFlowTcpDataOffsetCounter) 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 *unMarshalpatternFlowTcpDataOffsetCounter) 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 *marshalpatternFlowTcpDataOffsetCounter) 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 *unMarshalpatternFlowTcpDataOffsetCounter) 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 *patternFlowTcpDataOffsetCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpDataOffsetCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpDataOffsetCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpDataOffsetCounter) Clone() (PatternFlowTcpDataOffsetCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpDataOffsetCounter() + 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 +} + +// PatternFlowTcpDataOffsetCounter is integer counter pattern +type PatternFlowTcpDataOffsetCounter interface { + Validation + // msg marshals PatternFlowTcpDataOffsetCounter to protobuf object *otg.PatternFlowTcpDataOffsetCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpDataOffsetCounter + // setMsg unmarshals PatternFlowTcpDataOffsetCounter from protobuf object *otg.PatternFlowTcpDataOffsetCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpDataOffsetCounter) PatternFlowTcpDataOffsetCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpDataOffsetCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpDataOffsetCounter + // validate validates PatternFlowTcpDataOffsetCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpDataOffsetCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpDataOffsetCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpDataOffsetCounter + SetStart(value uint32) PatternFlowTcpDataOffsetCounter + // HasStart checks if Start has been set in PatternFlowTcpDataOffsetCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpDataOffsetCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpDataOffsetCounter + SetStep(value uint32) PatternFlowTcpDataOffsetCounter + // HasStep checks if Step has been set in PatternFlowTcpDataOffsetCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpDataOffsetCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpDataOffsetCounter + SetCount(value uint32) PatternFlowTcpDataOffsetCounter + // HasCount checks if Count has been set in PatternFlowTcpDataOffsetCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpDataOffsetCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpDataOffsetCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpDataOffsetCounter object +func (obj *patternFlowTcpDataOffsetCounter) SetStart(value uint32) PatternFlowTcpDataOffsetCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpDataOffsetCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpDataOffsetCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpDataOffsetCounter object +func (obj *patternFlowTcpDataOffsetCounter) SetStep(value uint32) PatternFlowTcpDataOffsetCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpDataOffsetCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpDataOffsetCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpDataOffsetCounter object +func (obj *patternFlowTcpDataOffsetCounter) SetCount(value uint32) PatternFlowTcpDataOffsetCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpDataOffsetCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpDataOffsetCounter.Start <= 15 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpDataOffsetCounter.Step <= 15 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpDataOffsetCounter.Count <= 15 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowTcpDataOffsetCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_data_offset_metric_tag.go b/gosnappi/pattern_flow_tcp_data_offset_metric_tag.go new file mode 100644 index 00000000..44711d7f --- /dev/null +++ b/gosnappi/pattern_flow_tcp_data_offset_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpDataOffsetMetricTag ***** +type patternFlowTcpDataOffsetMetricTag struct { + validation + obj *otg.PatternFlowTcpDataOffsetMetricTag + marshaller marshalPatternFlowTcpDataOffsetMetricTag + unMarshaller unMarshalPatternFlowTcpDataOffsetMetricTag +} + +func NewPatternFlowTcpDataOffsetMetricTag() PatternFlowTcpDataOffsetMetricTag { + obj := patternFlowTcpDataOffsetMetricTag{obj: &otg.PatternFlowTcpDataOffsetMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpDataOffsetMetricTag) msg() *otg.PatternFlowTcpDataOffsetMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpDataOffsetMetricTag) setMsg(msg *otg.PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpDataOffsetMetricTag struct { + obj *patternFlowTcpDataOffsetMetricTag +} + +type marshalPatternFlowTcpDataOffsetMetricTag interface { + // ToProto marshals PatternFlowTcpDataOffsetMetricTag to protobuf object *otg.PatternFlowTcpDataOffsetMetricTag + ToProto() (*otg.PatternFlowTcpDataOffsetMetricTag, error) + // ToPbText marshals PatternFlowTcpDataOffsetMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpDataOffsetMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpDataOffsetMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpDataOffsetMetricTag struct { + obj *patternFlowTcpDataOffsetMetricTag +} + +type unMarshalPatternFlowTcpDataOffsetMetricTag interface { + // FromProto unmarshals PatternFlowTcpDataOffsetMetricTag from protobuf object *otg.PatternFlowTcpDataOffsetMetricTag + FromProto(msg *otg.PatternFlowTcpDataOffsetMetricTag) (PatternFlowTcpDataOffsetMetricTag, error) + // FromPbText unmarshals PatternFlowTcpDataOffsetMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpDataOffsetMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpDataOffsetMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpDataOffsetMetricTag) Marshal() marshalPatternFlowTcpDataOffsetMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpDataOffsetMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpDataOffsetMetricTag) Unmarshal() unMarshalPatternFlowTcpDataOffsetMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpDataOffsetMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpDataOffsetMetricTag) ToProto() (*otg.PatternFlowTcpDataOffsetMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpDataOffsetMetricTag) FromProto(msg *otg.PatternFlowTcpDataOffsetMetricTag) (PatternFlowTcpDataOffsetMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpDataOffsetMetricTag) 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 *unMarshalpatternFlowTcpDataOffsetMetricTag) 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 *marshalpatternFlowTcpDataOffsetMetricTag) 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 *unMarshalpatternFlowTcpDataOffsetMetricTag) 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 *marshalpatternFlowTcpDataOffsetMetricTag) 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 *unMarshalpatternFlowTcpDataOffsetMetricTag) 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 *patternFlowTcpDataOffsetMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpDataOffsetMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpDataOffsetMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpDataOffsetMetricTag) Clone() (PatternFlowTcpDataOffsetMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpDataOffsetMetricTag() + 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 +} + +// PatternFlowTcpDataOffsetMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpDataOffsetMetricTag interface { + Validation + // msg marshals PatternFlowTcpDataOffsetMetricTag to protobuf object *otg.PatternFlowTcpDataOffsetMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpDataOffsetMetricTag + // setMsg unmarshals PatternFlowTcpDataOffsetMetricTag from protobuf object *otg.PatternFlowTcpDataOffsetMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpDataOffsetMetricTag) PatternFlowTcpDataOffsetMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpDataOffsetMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpDataOffsetMetricTag + // validate validates PatternFlowTcpDataOffsetMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpDataOffsetMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpDataOffsetMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpDataOffsetMetricTag + SetName(value string) PatternFlowTcpDataOffsetMetricTag + // Offset returns uint32, set in PatternFlowTcpDataOffsetMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpDataOffsetMetricTag + SetOffset(value uint32) PatternFlowTcpDataOffsetMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpDataOffsetMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpDataOffsetMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpDataOffsetMetricTag + SetLength(value uint32) PatternFlowTcpDataOffsetMetricTag + // HasLength checks if Length has been set in PatternFlowTcpDataOffsetMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpDataOffsetMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpDataOffsetMetricTag object +func (obj *patternFlowTcpDataOffsetMetricTag) SetName(value string) PatternFlowTcpDataOffsetMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpDataOffsetMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpDataOffsetMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpDataOffsetMetricTag object +func (obj *patternFlowTcpDataOffsetMetricTag) SetOffset(value uint32) PatternFlowTcpDataOffsetMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpDataOffsetMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpDataOffsetMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpDataOffsetMetricTag object +func (obj *patternFlowTcpDataOffsetMetricTag) SetLength(value uint32) PatternFlowTcpDataOffsetMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpDataOffsetMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpDataOffsetMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpDataOffsetMetricTag.Offset <= 3 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 4 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpDataOffsetMetricTag.Length <= 4 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpDataOffsetMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(4) + } + +} diff --git a/gosnappi/pattern_flow_tcp_dst_port.go b/gosnappi/pattern_flow_tcp_dst_port.go new file mode 100644 index 00000000..987d2118 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_dst_port.go @@ -0,0 +1,719 @@ +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" +) + +// ***** PatternFlowTcpDstPort ***** +type patternFlowTcpDstPort struct { + validation + obj *otg.PatternFlowTcpDstPort + marshaller marshalPatternFlowTcpDstPort + unMarshaller unMarshalPatternFlowTcpDstPort + incrementHolder PatternFlowTcpDstPortCounter + decrementHolder PatternFlowTcpDstPortCounter + metricTagsHolder PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter + randomHolder PatternFlowTcpDstPortRandom +} + +func NewPatternFlowTcpDstPort() PatternFlowTcpDstPort { + obj := patternFlowTcpDstPort{obj: &otg.PatternFlowTcpDstPort{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpDstPort) msg() *otg.PatternFlowTcpDstPort { + return obj.obj +} + +func (obj *patternFlowTcpDstPort) setMsg(msg *otg.PatternFlowTcpDstPort) PatternFlowTcpDstPort { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpDstPort struct { + obj *patternFlowTcpDstPort +} + +type marshalPatternFlowTcpDstPort interface { + // ToProto marshals PatternFlowTcpDstPort to protobuf object *otg.PatternFlowTcpDstPort + ToProto() (*otg.PatternFlowTcpDstPort, error) + // ToPbText marshals PatternFlowTcpDstPort to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpDstPort to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpDstPort to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpDstPort struct { + obj *patternFlowTcpDstPort +} + +type unMarshalPatternFlowTcpDstPort interface { + // FromProto unmarshals PatternFlowTcpDstPort from protobuf object *otg.PatternFlowTcpDstPort + FromProto(msg *otg.PatternFlowTcpDstPort) (PatternFlowTcpDstPort, error) + // FromPbText unmarshals PatternFlowTcpDstPort from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpDstPort from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpDstPort from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpDstPort) Marshal() marshalPatternFlowTcpDstPort { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpDstPort{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpDstPort) Unmarshal() unMarshalPatternFlowTcpDstPort { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpDstPort{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpDstPort) ToProto() (*otg.PatternFlowTcpDstPort, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpDstPort) FromProto(msg *otg.PatternFlowTcpDstPort) (PatternFlowTcpDstPort, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpDstPort) 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 *unMarshalpatternFlowTcpDstPort) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpDstPort) 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 *unMarshalpatternFlowTcpDstPort) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpDstPort) 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 *unMarshalpatternFlowTcpDstPort) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpDstPort) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpDstPort) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpDstPort) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpDstPort) Clone() (PatternFlowTcpDstPort, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpDstPort() + 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 +} + +func (obj *patternFlowTcpDstPort) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.randomHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpDstPort is destination port +type PatternFlowTcpDstPort interface { + Validation + // msg marshals PatternFlowTcpDstPort to protobuf object *otg.PatternFlowTcpDstPort + // and doesn't set defaults + msg() *otg.PatternFlowTcpDstPort + // setMsg unmarshals PatternFlowTcpDstPort from protobuf object *otg.PatternFlowTcpDstPort + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpDstPort) PatternFlowTcpDstPort + // provides marshal interface + Marshal() marshalPatternFlowTcpDstPort + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpDstPort + // validate validates PatternFlowTcpDstPort + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpDstPort, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpDstPortChoiceEnum, set in PatternFlowTcpDstPort + Choice() PatternFlowTcpDstPortChoiceEnum + // setChoice assigns PatternFlowTcpDstPortChoiceEnum provided by user to PatternFlowTcpDstPort + setChoice(value PatternFlowTcpDstPortChoiceEnum) PatternFlowTcpDstPort + // HasChoice checks if Choice has been set in PatternFlowTcpDstPort + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpDstPort. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpDstPort + SetValue(value uint32) PatternFlowTcpDstPort + // HasValue checks if Value has been set in PatternFlowTcpDstPort + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpDstPort. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpDstPort + SetValues(value []uint32) PatternFlowTcpDstPort + // Increment returns PatternFlowTcpDstPortCounter, set in PatternFlowTcpDstPort. + // PatternFlowTcpDstPortCounter is integer counter pattern + Increment() PatternFlowTcpDstPortCounter + // SetIncrement assigns PatternFlowTcpDstPortCounter provided by user to PatternFlowTcpDstPort. + // PatternFlowTcpDstPortCounter is integer counter pattern + SetIncrement(value PatternFlowTcpDstPortCounter) PatternFlowTcpDstPort + // HasIncrement checks if Increment has been set in PatternFlowTcpDstPort + HasIncrement() bool + // Decrement returns PatternFlowTcpDstPortCounter, set in PatternFlowTcpDstPort. + // PatternFlowTcpDstPortCounter is integer counter pattern + Decrement() PatternFlowTcpDstPortCounter + // SetDecrement assigns PatternFlowTcpDstPortCounter provided by user to PatternFlowTcpDstPort. + // PatternFlowTcpDstPortCounter is integer counter pattern + SetDecrement(value PatternFlowTcpDstPortCounter) PatternFlowTcpDstPort + // HasDecrement checks if Decrement has been set in PatternFlowTcpDstPort + HasDecrement() bool + // MetricTags returns PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIterIter, set in PatternFlowTcpDstPort + MetricTags() PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter + // Random returns PatternFlowTcpDstPortRandom, set in PatternFlowTcpDstPort. + // PatternFlowTcpDstPortRandom is integer random pattern + Random() PatternFlowTcpDstPortRandom + // SetRandom assigns PatternFlowTcpDstPortRandom provided by user to PatternFlowTcpDstPort. + // PatternFlowTcpDstPortRandom is integer random pattern + SetRandom(value PatternFlowTcpDstPortRandom) PatternFlowTcpDstPort + // HasRandom checks if Random has been set in PatternFlowTcpDstPort + HasRandom() bool + setNil() +} + +type PatternFlowTcpDstPortChoiceEnum string + +// Enum of Choice on PatternFlowTcpDstPort +var PatternFlowTcpDstPortChoice = struct { + VALUE PatternFlowTcpDstPortChoiceEnum + VALUES PatternFlowTcpDstPortChoiceEnum + INCREMENT PatternFlowTcpDstPortChoiceEnum + DECREMENT PatternFlowTcpDstPortChoiceEnum + RANDOM PatternFlowTcpDstPortChoiceEnum +}{ + VALUE: PatternFlowTcpDstPortChoiceEnum("value"), + VALUES: PatternFlowTcpDstPortChoiceEnum("values"), + INCREMENT: PatternFlowTcpDstPortChoiceEnum("increment"), + DECREMENT: PatternFlowTcpDstPortChoiceEnum("decrement"), + RANDOM: PatternFlowTcpDstPortChoiceEnum("random"), +} + +func (obj *patternFlowTcpDstPort) Choice() PatternFlowTcpDstPortChoiceEnum { + return PatternFlowTcpDstPortChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpDstPort) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpDstPort) setChoice(value PatternFlowTcpDstPortChoiceEnum) PatternFlowTcpDstPort { + intValue, ok := otg.PatternFlowTcpDstPort_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpDstPortChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpDstPort_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Random = nil + obj.randomHolder = nil + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpDstPortChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpDstPortChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpDstPortChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpDstPortCounter().msg() + } + + if value == PatternFlowTcpDstPortChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpDstPortCounter().msg() + } + + if value == PatternFlowTcpDstPortChoice.RANDOM { + obj.obj.Random = NewPatternFlowTcpDstPortRandom().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpDstPort) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpDstPortChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpDstPort) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpDstPort object +func (obj *patternFlowTcpDstPort) SetValue(value uint32) PatternFlowTcpDstPort { + obj.setChoice(PatternFlowTcpDstPortChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpDstPort) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpDstPort object +func (obj *patternFlowTcpDstPort) SetValues(value []uint32) PatternFlowTcpDstPort { + obj.setChoice(PatternFlowTcpDstPortChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpDstPortCounter +func (obj *patternFlowTcpDstPort) Increment() PatternFlowTcpDstPortCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpDstPortChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpDstPortCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpDstPortCounter +func (obj *patternFlowTcpDstPort) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpDstPortCounter value in the PatternFlowTcpDstPort object +func (obj *patternFlowTcpDstPort) SetIncrement(value PatternFlowTcpDstPortCounter) PatternFlowTcpDstPort { + obj.setChoice(PatternFlowTcpDstPortChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpDstPortCounter +func (obj *patternFlowTcpDstPort) Decrement() PatternFlowTcpDstPortCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpDstPortChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpDstPortCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpDstPortCounter +func (obj *patternFlowTcpDstPort) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpDstPortCounter value in the PatternFlowTcpDstPort object +func (obj *patternFlowTcpDstPort) SetDecrement(value PatternFlowTcpDstPortCounter) PatternFlowTcpDstPort { + obj.setChoice(PatternFlowTcpDstPortChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpDstPortMetricTag +func (obj *patternFlowTcpDstPort) MetricTags() PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpDstPortMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter struct { + obj *patternFlowTcpDstPort + patternFlowTcpDstPortMetricTagSlice []PatternFlowTcpDstPortMetricTag + fieldPtr *[]*otg.PatternFlowTcpDstPortMetricTag +} + +func newPatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter(ptr *[]*otg.PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { + return &patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter interface { + setMsg(*patternFlowTcpDstPort) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter + Items() []PatternFlowTcpDstPortMetricTag + Add() PatternFlowTcpDstPortMetricTag + Append(items ...PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter + Set(index int, newObj PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter + Clear() PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter + clearHolderSlice() PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter + appendHolderSlice(item PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter +} + +func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) setMsg(msg *patternFlowTcpDstPort) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpDstPortMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) Items() []PatternFlowTcpDstPortMetricTag { + return obj.patternFlowTcpDstPortMetricTagSlice +} + +func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) Add() PatternFlowTcpDstPortMetricTag { + newObj := &otg.PatternFlowTcpDstPortMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpDstPortMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpDstPortMetricTagSlice = append(obj.patternFlowTcpDstPortMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) Append(items ...PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpDstPortMetricTagSlice = append(obj.patternFlowTcpDstPortMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) Set(index int, newObj PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpDstPortMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) Clear() PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpDstPortMetricTag{} + obj.patternFlowTcpDstPortMetricTagSlice = []PatternFlowTcpDstPortMetricTag{} + } + return obj +} +func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) clearHolderSlice() PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { + if len(obj.patternFlowTcpDstPortMetricTagSlice) > 0 { + obj.patternFlowTcpDstPortMetricTagSlice = []PatternFlowTcpDstPortMetricTag{} + } + return obj +} +func (obj *patternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter) appendHolderSlice(item PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortPatternFlowTcpDstPortMetricTagIter { + obj.patternFlowTcpDstPortMetricTagSlice = append(obj.patternFlowTcpDstPortMetricTagSlice, item) + return obj +} + +// description is TBD +// Random returns a PatternFlowTcpDstPortRandom +func (obj *patternFlowTcpDstPort) Random() PatternFlowTcpDstPortRandom { + if obj.obj.Random == nil { + obj.setChoice(PatternFlowTcpDstPortChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &patternFlowTcpDstPortRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a PatternFlowTcpDstPortRandom +func (obj *patternFlowTcpDstPort) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the PatternFlowTcpDstPortRandom value in the PatternFlowTcpDstPort object +func (obj *patternFlowTcpDstPort) SetRandom(value PatternFlowTcpDstPortRandom) PatternFlowTcpDstPort { + obj.setChoice(PatternFlowTcpDstPortChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + +func (obj *patternFlowTcpDstPort) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpDstPort.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowTcpDstPort.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpDstPortMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowTcpDstPort) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpDstPortChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpDstPortChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpDstPortChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpDstPortChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpDstPortChoice.DECREMENT + } + + if obj.obj.Random != nil { + choices_set += 1 + choice = PatternFlowTcpDstPortChoice.RANDOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpDstPortChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpDstPort") + } + } else { + intVal := otg.PatternFlowTcpDstPort_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpDstPort_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_dst_port_counter.go b/gosnappi/pattern_flow_tcp_dst_port_counter.go new file mode 100644 index 00000000..139d0aee --- /dev/null +++ b/gosnappi/pattern_flow_tcp_dst_port_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowTcpDstPortCounter ***** +type patternFlowTcpDstPortCounter struct { + validation + obj *otg.PatternFlowTcpDstPortCounter + marshaller marshalPatternFlowTcpDstPortCounter + unMarshaller unMarshalPatternFlowTcpDstPortCounter +} + +func NewPatternFlowTcpDstPortCounter() PatternFlowTcpDstPortCounter { + obj := patternFlowTcpDstPortCounter{obj: &otg.PatternFlowTcpDstPortCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpDstPortCounter) msg() *otg.PatternFlowTcpDstPortCounter { + return obj.obj +} + +func (obj *patternFlowTcpDstPortCounter) setMsg(msg *otg.PatternFlowTcpDstPortCounter) PatternFlowTcpDstPortCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpDstPortCounter struct { + obj *patternFlowTcpDstPortCounter +} + +type marshalPatternFlowTcpDstPortCounter interface { + // ToProto marshals PatternFlowTcpDstPortCounter to protobuf object *otg.PatternFlowTcpDstPortCounter + ToProto() (*otg.PatternFlowTcpDstPortCounter, error) + // ToPbText marshals PatternFlowTcpDstPortCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpDstPortCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpDstPortCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpDstPortCounter struct { + obj *patternFlowTcpDstPortCounter +} + +type unMarshalPatternFlowTcpDstPortCounter interface { + // FromProto unmarshals PatternFlowTcpDstPortCounter from protobuf object *otg.PatternFlowTcpDstPortCounter + FromProto(msg *otg.PatternFlowTcpDstPortCounter) (PatternFlowTcpDstPortCounter, error) + // FromPbText unmarshals PatternFlowTcpDstPortCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpDstPortCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpDstPortCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpDstPortCounter) Marshal() marshalPatternFlowTcpDstPortCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpDstPortCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpDstPortCounter) Unmarshal() unMarshalPatternFlowTcpDstPortCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpDstPortCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpDstPortCounter) ToProto() (*otg.PatternFlowTcpDstPortCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpDstPortCounter) FromProto(msg *otg.PatternFlowTcpDstPortCounter) (PatternFlowTcpDstPortCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpDstPortCounter) 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 *unMarshalpatternFlowTcpDstPortCounter) 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 *marshalpatternFlowTcpDstPortCounter) 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 *unMarshalpatternFlowTcpDstPortCounter) 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 *marshalpatternFlowTcpDstPortCounter) 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 *unMarshalpatternFlowTcpDstPortCounter) 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 *patternFlowTcpDstPortCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpDstPortCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpDstPortCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpDstPortCounter) Clone() (PatternFlowTcpDstPortCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpDstPortCounter() + 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 +} + +// PatternFlowTcpDstPortCounter is integer counter pattern +type PatternFlowTcpDstPortCounter interface { + Validation + // msg marshals PatternFlowTcpDstPortCounter to protobuf object *otg.PatternFlowTcpDstPortCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpDstPortCounter + // setMsg unmarshals PatternFlowTcpDstPortCounter from protobuf object *otg.PatternFlowTcpDstPortCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpDstPortCounter) PatternFlowTcpDstPortCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpDstPortCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpDstPortCounter + // validate validates PatternFlowTcpDstPortCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpDstPortCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpDstPortCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpDstPortCounter + SetStart(value uint32) PatternFlowTcpDstPortCounter + // HasStart checks if Start has been set in PatternFlowTcpDstPortCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpDstPortCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpDstPortCounter + SetStep(value uint32) PatternFlowTcpDstPortCounter + // HasStep checks if Step has been set in PatternFlowTcpDstPortCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpDstPortCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpDstPortCounter + SetCount(value uint32) PatternFlowTcpDstPortCounter + // HasCount checks if Count has been set in PatternFlowTcpDstPortCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpDstPortCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpDstPortCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpDstPortCounter object +func (obj *patternFlowTcpDstPortCounter) SetStart(value uint32) PatternFlowTcpDstPortCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpDstPortCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpDstPortCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpDstPortCounter object +func (obj *patternFlowTcpDstPortCounter) SetStep(value uint32) PatternFlowTcpDstPortCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpDstPortCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpDstPortCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpDstPortCounter object +func (obj *patternFlowTcpDstPortCounter) SetCount(value uint32) PatternFlowTcpDstPortCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpDstPortCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpDstPortCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpDstPortCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpDstPortCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowTcpDstPortCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_dst_port_metric_tag.go b/gosnappi/pattern_flow_tcp_dst_port_metric_tag.go new file mode 100644 index 00000000..635c1bb4 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_dst_port_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpDstPortMetricTag ***** +type patternFlowTcpDstPortMetricTag struct { + validation + obj *otg.PatternFlowTcpDstPortMetricTag + marshaller marshalPatternFlowTcpDstPortMetricTag + unMarshaller unMarshalPatternFlowTcpDstPortMetricTag +} + +func NewPatternFlowTcpDstPortMetricTag() PatternFlowTcpDstPortMetricTag { + obj := patternFlowTcpDstPortMetricTag{obj: &otg.PatternFlowTcpDstPortMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpDstPortMetricTag) msg() *otg.PatternFlowTcpDstPortMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpDstPortMetricTag) setMsg(msg *otg.PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpDstPortMetricTag struct { + obj *patternFlowTcpDstPortMetricTag +} + +type marshalPatternFlowTcpDstPortMetricTag interface { + // ToProto marshals PatternFlowTcpDstPortMetricTag to protobuf object *otg.PatternFlowTcpDstPortMetricTag + ToProto() (*otg.PatternFlowTcpDstPortMetricTag, error) + // ToPbText marshals PatternFlowTcpDstPortMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpDstPortMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpDstPortMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpDstPortMetricTag struct { + obj *patternFlowTcpDstPortMetricTag +} + +type unMarshalPatternFlowTcpDstPortMetricTag interface { + // FromProto unmarshals PatternFlowTcpDstPortMetricTag from protobuf object *otg.PatternFlowTcpDstPortMetricTag + FromProto(msg *otg.PatternFlowTcpDstPortMetricTag) (PatternFlowTcpDstPortMetricTag, error) + // FromPbText unmarshals PatternFlowTcpDstPortMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpDstPortMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpDstPortMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpDstPortMetricTag) Marshal() marshalPatternFlowTcpDstPortMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpDstPortMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpDstPortMetricTag) Unmarshal() unMarshalPatternFlowTcpDstPortMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpDstPortMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpDstPortMetricTag) ToProto() (*otg.PatternFlowTcpDstPortMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpDstPortMetricTag) FromProto(msg *otg.PatternFlowTcpDstPortMetricTag) (PatternFlowTcpDstPortMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpDstPortMetricTag) 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 *unMarshalpatternFlowTcpDstPortMetricTag) 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 *marshalpatternFlowTcpDstPortMetricTag) 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 *unMarshalpatternFlowTcpDstPortMetricTag) 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 *marshalpatternFlowTcpDstPortMetricTag) 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 *unMarshalpatternFlowTcpDstPortMetricTag) 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 *patternFlowTcpDstPortMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpDstPortMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpDstPortMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpDstPortMetricTag) Clone() (PatternFlowTcpDstPortMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpDstPortMetricTag() + 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 +} + +// PatternFlowTcpDstPortMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpDstPortMetricTag interface { + Validation + // msg marshals PatternFlowTcpDstPortMetricTag to protobuf object *otg.PatternFlowTcpDstPortMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpDstPortMetricTag + // setMsg unmarshals PatternFlowTcpDstPortMetricTag from protobuf object *otg.PatternFlowTcpDstPortMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpDstPortMetricTag) PatternFlowTcpDstPortMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpDstPortMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpDstPortMetricTag + // validate validates PatternFlowTcpDstPortMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpDstPortMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpDstPortMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpDstPortMetricTag + SetName(value string) PatternFlowTcpDstPortMetricTag + // Offset returns uint32, set in PatternFlowTcpDstPortMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpDstPortMetricTag + SetOffset(value uint32) PatternFlowTcpDstPortMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpDstPortMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpDstPortMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpDstPortMetricTag + SetLength(value uint32) PatternFlowTcpDstPortMetricTag + // HasLength checks if Length has been set in PatternFlowTcpDstPortMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpDstPortMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpDstPortMetricTag object +func (obj *patternFlowTcpDstPortMetricTag) SetName(value string) PatternFlowTcpDstPortMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpDstPortMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpDstPortMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpDstPortMetricTag object +func (obj *patternFlowTcpDstPortMetricTag) SetOffset(value uint32) PatternFlowTcpDstPortMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpDstPortMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpDstPortMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpDstPortMetricTag object +func (obj *patternFlowTcpDstPortMetricTag) SetLength(value uint32) PatternFlowTcpDstPortMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpDstPortMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpDstPortMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpDstPortMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpDstPortMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpDstPortMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_tcp_dst_port_random.go b/gosnappi/pattern_flow_tcp_dst_port_random.go new file mode 100644 index 00000000..b65d7e8e --- /dev/null +++ b/gosnappi/pattern_flow_tcp_dst_port_random.go @@ -0,0 +1,422 @@ +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" +) + +// ***** PatternFlowTcpDstPortRandom ***** +type patternFlowTcpDstPortRandom struct { + validation + obj *otg.PatternFlowTcpDstPortRandom + marshaller marshalPatternFlowTcpDstPortRandom + unMarshaller unMarshalPatternFlowTcpDstPortRandom +} + +func NewPatternFlowTcpDstPortRandom() PatternFlowTcpDstPortRandom { + obj := patternFlowTcpDstPortRandom{obj: &otg.PatternFlowTcpDstPortRandom{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpDstPortRandom) msg() *otg.PatternFlowTcpDstPortRandom { + return obj.obj +} + +func (obj *patternFlowTcpDstPortRandom) setMsg(msg *otg.PatternFlowTcpDstPortRandom) PatternFlowTcpDstPortRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpDstPortRandom struct { + obj *patternFlowTcpDstPortRandom +} + +type marshalPatternFlowTcpDstPortRandom interface { + // ToProto marshals PatternFlowTcpDstPortRandom to protobuf object *otg.PatternFlowTcpDstPortRandom + ToProto() (*otg.PatternFlowTcpDstPortRandom, error) + // ToPbText marshals PatternFlowTcpDstPortRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpDstPortRandom to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpDstPortRandom to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpDstPortRandom struct { + obj *patternFlowTcpDstPortRandom +} + +type unMarshalPatternFlowTcpDstPortRandom interface { + // FromProto unmarshals PatternFlowTcpDstPortRandom from protobuf object *otg.PatternFlowTcpDstPortRandom + FromProto(msg *otg.PatternFlowTcpDstPortRandom) (PatternFlowTcpDstPortRandom, error) + // FromPbText unmarshals PatternFlowTcpDstPortRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpDstPortRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpDstPortRandom from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpDstPortRandom) Marshal() marshalPatternFlowTcpDstPortRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpDstPortRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpDstPortRandom) Unmarshal() unMarshalPatternFlowTcpDstPortRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpDstPortRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpDstPortRandom) ToProto() (*otg.PatternFlowTcpDstPortRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpDstPortRandom) FromProto(msg *otg.PatternFlowTcpDstPortRandom) (PatternFlowTcpDstPortRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpDstPortRandom) 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 *unMarshalpatternFlowTcpDstPortRandom) 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 *marshalpatternFlowTcpDstPortRandom) 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 *unMarshalpatternFlowTcpDstPortRandom) 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 *marshalpatternFlowTcpDstPortRandom) 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 *unMarshalpatternFlowTcpDstPortRandom) 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 *patternFlowTcpDstPortRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpDstPortRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpDstPortRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpDstPortRandom) Clone() (PatternFlowTcpDstPortRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpDstPortRandom() + 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 +} + +// PatternFlowTcpDstPortRandom is integer random pattern +type PatternFlowTcpDstPortRandom interface { + Validation + // msg marshals PatternFlowTcpDstPortRandom to protobuf object *otg.PatternFlowTcpDstPortRandom + // and doesn't set defaults + msg() *otg.PatternFlowTcpDstPortRandom + // setMsg unmarshals PatternFlowTcpDstPortRandom from protobuf object *otg.PatternFlowTcpDstPortRandom + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpDstPortRandom) PatternFlowTcpDstPortRandom + // provides marshal interface + Marshal() marshalPatternFlowTcpDstPortRandom + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpDstPortRandom + // validate validates PatternFlowTcpDstPortRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpDstPortRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns uint32, set in PatternFlowTcpDstPortRandom. + Min() uint32 + // SetMin assigns uint32 provided by user to PatternFlowTcpDstPortRandom + SetMin(value uint32) PatternFlowTcpDstPortRandom + // HasMin checks if Min has been set in PatternFlowTcpDstPortRandom + HasMin() bool + // Max returns uint32, set in PatternFlowTcpDstPortRandom. + Max() uint32 + // SetMax assigns uint32 provided by user to PatternFlowTcpDstPortRandom + SetMax(value uint32) PatternFlowTcpDstPortRandom + // HasMax checks if Max has been set in PatternFlowTcpDstPortRandom + HasMax() bool + // Seed returns uint32, set in PatternFlowTcpDstPortRandom. + Seed() uint32 + // SetSeed assigns uint32 provided by user to PatternFlowTcpDstPortRandom + SetSeed(value uint32) PatternFlowTcpDstPortRandom + // HasSeed checks if Seed has been set in PatternFlowTcpDstPortRandom + HasSeed() bool + // Count returns uint32, set in PatternFlowTcpDstPortRandom. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpDstPortRandom + SetCount(value uint32) PatternFlowTcpDstPortRandom + // HasCount checks if Count has been set in PatternFlowTcpDstPortRandom + HasCount() bool +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowTcpDstPortRandom) Min() uint32 { + + return *obj.obj.Min + +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowTcpDstPortRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// The minimum possible value generated by the random value generator. +// SetMin sets the uint32 value in the PatternFlowTcpDstPortRandom object +func (obj *patternFlowTcpDstPortRandom) SetMin(value uint32) PatternFlowTcpDstPortRandom { + + obj.obj.Min = &value + return obj +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowTcpDstPortRandom) Max() uint32 { + + return *obj.obj.Max + +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowTcpDstPortRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// The maximum possible value generated by the random value generator. +// SetMax sets the uint32 value in the PatternFlowTcpDstPortRandom object +func (obj *patternFlowTcpDstPortRandom) SetMax(value uint32) PatternFlowTcpDstPortRandom { + + obj.obj.Max = &value + return obj +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowTcpDstPortRandom) Seed() uint32 { + + return *obj.obj.Seed + +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowTcpDstPortRandom) HasSeed() bool { + return obj.obj.Seed != nil +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// SetSeed sets the uint32 value in the PatternFlowTcpDstPortRandom object +func (obj *patternFlowTcpDstPortRandom) SetSeed(value uint32) PatternFlowTcpDstPortRandom { + + obj.obj.Seed = &value + return obj +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowTcpDstPortRandom) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowTcpDstPortRandom) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of values to be generated by the random value generator. +// SetCount sets the uint32 value in the PatternFlowTcpDstPortRandom object +func (obj *patternFlowTcpDstPortRandom) SetCount(value uint32) PatternFlowTcpDstPortRandom { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpDstPortRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Min != nil { + + if *obj.obj.Min > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpDstPortRandom.Min <= 65535 but Got %d", *obj.obj.Min)) + } + + } + + if obj.obj.Max != nil { + + if *obj.obj.Max > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpDstPortRandom.Max <= 65535 but Got %d", *obj.obj.Max)) + } + + } + +} + +func (obj *patternFlowTcpDstPortRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin(0) + } + if obj.obj.Max == nil { + obj.SetMax(65535) + } + if obj.obj.Seed == nil { + obj.SetSeed(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ecn_cwr.go b/gosnappi/pattern_flow_tcp_ecn_cwr.go new file mode 100644 index 00000000..285edc5d --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ecn_cwr.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowTcpEcnCwr ***** +type patternFlowTcpEcnCwr struct { + validation + obj *otg.PatternFlowTcpEcnCwr + marshaller marshalPatternFlowTcpEcnCwr + unMarshaller unMarshalPatternFlowTcpEcnCwr + incrementHolder PatternFlowTcpEcnCwrCounter + decrementHolder PatternFlowTcpEcnCwrCounter + metricTagsHolder PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter +} + +func NewPatternFlowTcpEcnCwr() PatternFlowTcpEcnCwr { + obj := patternFlowTcpEcnCwr{obj: &otg.PatternFlowTcpEcnCwr{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpEcnCwr) msg() *otg.PatternFlowTcpEcnCwr { + return obj.obj +} + +func (obj *patternFlowTcpEcnCwr) setMsg(msg *otg.PatternFlowTcpEcnCwr) PatternFlowTcpEcnCwr { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpEcnCwr struct { + obj *patternFlowTcpEcnCwr +} + +type marshalPatternFlowTcpEcnCwr interface { + // ToProto marshals PatternFlowTcpEcnCwr to protobuf object *otg.PatternFlowTcpEcnCwr + ToProto() (*otg.PatternFlowTcpEcnCwr, error) + // ToPbText marshals PatternFlowTcpEcnCwr to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpEcnCwr to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpEcnCwr to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpEcnCwr struct { + obj *patternFlowTcpEcnCwr +} + +type unMarshalPatternFlowTcpEcnCwr interface { + // FromProto unmarshals PatternFlowTcpEcnCwr from protobuf object *otg.PatternFlowTcpEcnCwr + FromProto(msg *otg.PatternFlowTcpEcnCwr) (PatternFlowTcpEcnCwr, error) + // FromPbText unmarshals PatternFlowTcpEcnCwr from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpEcnCwr from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpEcnCwr from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpEcnCwr) Marshal() marshalPatternFlowTcpEcnCwr { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpEcnCwr{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpEcnCwr) Unmarshal() unMarshalPatternFlowTcpEcnCwr { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpEcnCwr{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpEcnCwr) ToProto() (*otg.PatternFlowTcpEcnCwr, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpEcnCwr) FromProto(msg *otg.PatternFlowTcpEcnCwr) (PatternFlowTcpEcnCwr, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpEcnCwr) 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 *unMarshalpatternFlowTcpEcnCwr) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpEcnCwr) 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 *unMarshalpatternFlowTcpEcnCwr) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpEcnCwr) 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 *unMarshalpatternFlowTcpEcnCwr) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpEcnCwr) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnCwr) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnCwr) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpEcnCwr) Clone() (PatternFlowTcpEcnCwr, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpEcnCwr() + 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 +} + +func (obj *patternFlowTcpEcnCwr) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpEcnCwr is explicit congestion notification, congestion window reduced. +type PatternFlowTcpEcnCwr interface { + Validation + // msg marshals PatternFlowTcpEcnCwr to protobuf object *otg.PatternFlowTcpEcnCwr + // and doesn't set defaults + msg() *otg.PatternFlowTcpEcnCwr + // setMsg unmarshals PatternFlowTcpEcnCwr from protobuf object *otg.PatternFlowTcpEcnCwr + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpEcnCwr) PatternFlowTcpEcnCwr + // provides marshal interface + Marshal() marshalPatternFlowTcpEcnCwr + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpEcnCwr + // validate validates PatternFlowTcpEcnCwr + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpEcnCwr, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpEcnCwrChoiceEnum, set in PatternFlowTcpEcnCwr + Choice() PatternFlowTcpEcnCwrChoiceEnum + // setChoice assigns PatternFlowTcpEcnCwrChoiceEnum provided by user to PatternFlowTcpEcnCwr + setChoice(value PatternFlowTcpEcnCwrChoiceEnum) PatternFlowTcpEcnCwr + // HasChoice checks if Choice has been set in PatternFlowTcpEcnCwr + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpEcnCwr. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpEcnCwr + SetValue(value uint32) PatternFlowTcpEcnCwr + // HasValue checks if Value has been set in PatternFlowTcpEcnCwr + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpEcnCwr. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpEcnCwr + SetValues(value []uint32) PatternFlowTcpEcnCwr + // Increment returns PatternFlowTcpEcnCwrCounter, set in PatternFlowTcpEcnCwr. + // PatternFlowTcpEcnCwrCounter is integer counter pattern + Increment() PatternFlowTcpEcnCwrCounter + // SetIncrement assigns PatternFlowTcpEcnCwrCounter provided by user to PatternFlowTcpEcnCwr. + // PatternFlowTcpEcnCwrCounter is integer counter pattern + SetIncrement(value PatternFlowTcpEcnCwrCounter) PatternFlowTcpEcnCwr + // HasIncrement checks if Increment has been set in PatternFlowTcpEcnCwr + HasIncrement() bool + // Decrement returns PatternFlowTcpEcnCwrCounter, set in PatternFlowTcpEcnCwr. + // PatternFlowTcpEcnCwrCounter is integer counter pattern + Decrement() PatternFlowTcpEcnCwrCounter + // SetDecrement assigns PatternFlowTcpEcnCwrCounter provided by user to PatternFlowTcpEcnCwr. + // PatternFlowTcpEcnCwrCounter is integer counter pattern + SetDecrement(value PatternFlowTcpEcnCwrCounter) PatternFlowTcpEcnCwr + // HasDecrement checks if Decrement has been set in PatternFlowTcpEcnCwr + HasDecrement() bool + // MetricTags returns PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIterIter, set in PatternFlowTcpEcnCwr + MetricTags() PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter + setNil() +} + +type PatternFlowTcpEcnCwrChoiceEnum string + +// Enum of Choice on PatternFlowTcpEcnCwr +var PatternFlowTcpEcnCwrChoice = struct { + VALUE PatternFlowTcpEcnCwrChoiceEnum + VALUES PatternFlowTcpEcnCwrChoiceEnum + INCREMENT PatternFlowTcpEcnCwrChoiceEnum + DECREMENT PatternFlowTcpEcnCwrChoiceEnum +}{ + VALUE: PatternFlowTcpEcnCwrChoiceEnum("value"), + VALUES: PatternFlowTcpEcnCwrChoiceEnum("values"), + INCREMENT: PatternFlowTcpEcnCwrChoiceEnum("increment"), + DECREMENT: PatternFlowTcpEcnCwrChoiceEnum("decrement"), +} + +func (obj *patternFlowTcpEcnCwr) Choice() PatternFlowTcpEcnCwrChoiceEnum { + return PatternFlowTcpEcnCwrChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpEcnCwr) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpEcnCwr) setChoice(value PatternFlowTcpEcnCwrChoiceEnum) PatternFlowTcpEcnCwr { + intValue, ok := otg.PatternFlowTcpEcnCwr_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpEcnCwrChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpEcnCwr_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpEcnCwrChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpEcnCwrChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpEcnCwrChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpEcnCwrCounter().msg() + } + + if value == PatternFlowTcpEcnCwrChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpEcnCwrCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpEcnCwr) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpEcnCwrChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpEcnCwr) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpEcnCwr object +func (obj *patternFlowTcpEcnCwr) SetValue(value uint32) PatternFlowTcpEcnCwr { + obj.setChoice(PatternFlowTcpEcnCwrChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpEcnCwr) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpEcnCwr object +func (obj *patternFlowTcpEcnCwr) SetValues(value []uint32) PatternFlowTcpEcnCwr { + obj.setChoice(PatternFlowTcpEcnCwrChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpEcnCwrCounter +func (obj *patternFlowTcpEcnCwr) Increment() PatternFlowTcpEcnCwrCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpEcnCwrChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpEcnCwrCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpEcnCwrCounter +func (obj *patternFlowTcpEcnCwr) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpEcnCwrCounter value in the PatternFlowTcpEcnCwr object +func (obj *patternFlowTcpEcnCwr) SetIncrement(value PatternFlowTcpEcnCwrCounter) PatternFlowTcpEcnCwr { + obj.setChoice(PatternFlowTcpEcnCwrChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpEcnCwrCounter +func (obj *patternFlowTcpEcnCwr) Decrement() PatternFlowTcpEcnCwrCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpEcnCwrChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpEcnCwrCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpEcnCwrCounter +func (obj *patternFlowTcpEcnCwr) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpEcnCwrCounter value in the PatternFlowTcpEcnCwr object +func (obj *patternFlowTcpEcnCwr) SetDecrement(value PatternFlowTcpEcnCwrCounter) PatternFlowTcpEcnCwr { + obj.setChoice(PatternFlowTcpEcnCwrChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpEcnCwrMetricTag +func (obj *patternFlowTcpEcnCwr) MetricTags() PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpEcnCwrMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter struct { + obj *patternFlowTcpEcnCwr + patternFlowTcpEcnCwrMetricTagSlice []PatternFlowTcpEcnCwrMetricTag + fieldPtr *[]*otg.PatternFlowTcpEcnCwrMetricTag +} + +func newPatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter(ptr *[]*otg.PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { + return &patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter interface { + setMsg(*patternFlowTcpEcnCwr) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter + Items() []PatternFlowTcpEcnCwrMetricTag + Add() PatternFlowTcpEcnCwrMetricTag + Append(items ...PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter + Set(index int, newObj PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter + Clear() PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter + clearHolderSlice() PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter + appendHolderSlice(item PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter +} + +func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) setMsg(msg *patternFlowTcpEcnCwr) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpEcnCwrMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) Items() []PatternFlowTcpEcnCwrMetricTag { + return obj.patternFlowTcpEcnCwrMetricTagSlice +} + +func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) Add() PatternFlowTcpEcnCwrMetricTag { + newObj := &otg.PatternFlowTcpEcnCwrMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpEcnCwrMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpEcnCwrMetricTagSlice = append(obj.patternFlowTcpEcnCwrMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) Append(items ...PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpEcnCwrMetricTagSlice = append(obj.patternFlowTcpEcnCwrMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) Set(index int, newObj PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpEcnCwrMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) Clear() PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpEcnCwrMetricTag{} + obj.patternFlowTcpEcnCwrMetricTagSlice = []PatternFlowTcpEcnCwrMetricTag{} + } + return obj +} +func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) clearHolderSlice() PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { + if len(obj.patternFlowTcpEcnCwrMetricTagSlice) > 0 { + obj.patternFlowTcpEcnCwrMetricTagSlice = []PatternFlowTcpEcnCwrMetricTag{} + } + return obj +} +func (obj *patternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter) appendHolderSlice(item PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrPatternFlowTcpEcnCwrMetricTagIter { + obj.patternFlowTcpEcnCwrMetricTagSlice = append(obj.patternFlowTcpEcnCwrMetricTagSlice, item) + return obj +} + +func (obj *patternFlowTcpEcnCwr) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnCwr.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowTcpEcnCwr.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpEcnCwrMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowTcpEcnCwr) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpEcnCwrChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpEcnCwrChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpEcnCwrChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpEcnCwrChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpEcnCwrChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpEcnCwrChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpEcnCwr") + } + } else { + intVal := otg.PatternFlowTcpEcnCwr_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpEcnCwr_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_ecn_cwr_counter.go b/gosnappi/pattern_flow_tcp_ecn_cwr_counter.go new file mode 100644 index 00000000..5840841a --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ecn_cwr_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowTcpEcnCwrCounter ***** +type patternFlowTcpEcnCwrCounter struct { + validation + obj *otg.PatternFlowTcpEcnCwrCounter + marshaller marshalPatternFlowTcpEcnCwrCounter + unMarshaller unMarshalPatternFlowTcpEcnCwrCounter +} + +func NewPatternFlowTcpEcnCwrCounter() PatternFlowTcpEcnCwrCounter { + obj := patternFlowTcpEcnCwrCounter{obj: &otg.PatternFlowTcpEcnCwrCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpEcnCwrCounter) msg() *otg.PatternFlowTcpEcnCwrCounter { + return obj.obj +} + +func (obj *patternFlowTcpEcnCwrCounter) setMsg(msg *otg.PatternFlowTcpEcnCwrCounter) PatternFlowTcpEcnCwrCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpEcnCwrCounter struct { + obj *patternFlowTcpEcnCwrCounter +} + +type marshalPatternFlowTcpEcnCwrCounter interface { + // ToProto marshals PatternFlowTcpEcnCwrCounter to protobuf object *otg.PatternFlowTcpEcnCwrCounter + ToProto() (*otg.PatternFlowTcpEcnCwrCounter, error) + // ToPbText marshals PatternFlowTcpEcnCwrCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpEcnCwrCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpEcnCwrCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpEcnCwrCounter struct { + obj *patternFlowTcpEcnCwrCounter +} + +type unMarshalPatternFlowTcpEcnCwrCounter interface { + // FromProto unmarshals PatternFlowTcpEcnCwrCounter from protobuf object *otg.PatternFlowTcpEcnCwrCounter + FromProto(msg *otg.PatternFlowTcpEcnCwrCounter) (PatternFlowTcpEcnCwrCounter, error) + // FromPbText unmarshals PatternFlowTcpEcnCwrCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpEcnCwrCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpEcnCwrCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpEcnCwrCounter) Marshal() marshalPatternFlowTcpEcnCwrCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpEcnCwrCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpEcnCwrCounter) Unmarshal() unMarshalPatternFlowTcpEcnCwrCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpEcnCwrCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpEcnCwrCounter) ToProto() (*otg.PatternFlowTcpEcnCwrCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpEcnCwrCounter) FromProto(msg *otg.PatternFlowTcpEcnCwrCounter) (PatternFlowTcpEcnCwrCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpEcnCwrCounter) 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 *unMarshalpatternFlowTcpEcnCwrCounter) 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 *marshalpatternFlowTcpEcnCwrCounter) 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 *unMarshalpatternFlowTcpEcnCwrCounter) 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 *marshalpatternFlowTcpEcnCwrCounter) 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 *unMarshalpatternFlowTcpEcnCwrCounter) 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 *patternFlowTcpEcnCwrCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnCwrCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnCwrCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpEcnCwrCounter) Clone() (PatternFlowTcpEcnCwrCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpEcnCwrCounter() + 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 +} + +// PatternFlowTcpEcnCwrCounter is integer counter pattern +type PatternFlowTcpEcnCwrCounter interface { + Validation + // msg marshals PatternFlowTcpEcnCwrCounter to protobuf object *otg.PatternFlowTcpEcnCwrCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpEcnCwrCounter + // setMsg unmarshals PatternFlowTcpEcnCwrCounter from protobuf object *otg.PatternFlowTcpEcnCwrCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpEcnCwrCounter) PatternFlowTcpEcnCwrCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpEcnCwrCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpEcnCwrCounter + // validate validates PatternFlowTcpEcnCwrCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpEcnCwrCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpEcnCwrCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpEcnCwrCounter + SetStart(value uint32) PatternFlowTcpEcnCwrCounter + // HasStart checks if Start has been set in PatternFlowTcpEcnCwrCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpEcnCwrCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpEcnCwrCounter + SetStep(value uint32) PatternFlowTcpEcnCwrCounter + // HasStep checks if Step has been set in PatternFlowTcpEcnCwrCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpEcnCwrCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpEcnCwrCounter + SetCount(value uint32) PatternFlowTcpEcnCwrCounter + // HasCount checks if Count has been set in PatternFlowTcpEcnCwrCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpEcnCwrCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpEcnCwrCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpEcnCwrCounter object +func (obj *patternFlowTcpEcnCwrCounter) SetStart(value uint32) PatternFlowTcpEcnCwrCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpEcnCwrCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpEcnCwrCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpEcnCwrCounter object +func (obj *patternFlowTcpEcnCwrCounter) SetStep(value uint32) PatternFlowTcpEcnCwrCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpEcnCwrCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpEcnCwrCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpEcnCwrCounter object +func (obj *patternFlowTcpEcnCwrCounter) SetCount(value uint32) PatternFlowTcpEcnCwrCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpEcnCwrCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnCwrCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnCwrCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnCwrCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowTcpEcnCwrCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ecn_cwr_metric_tag.go b/gosnappi/pattern_flow_tcp_ecn_cwr_metric_tag.go new file mode 100644 index 00000000..32d7e304 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ecn_cwr_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpEcnCwrMetricTag ***** +type patternFlowTcpEcnCwrMetricTag struct { + validation + obj *otg.PatternFlowTcpEcnCwrMetricTag + marshaller marshalPatternFlowTcpEcnCwrMetricTag + unMarshaller unMarshalPatternFlowTcpEcnCwrMetricTag +} + +func NewPatternFlowTcpEcnCwrMetricTag() PatternFlowTcpEcnCwrMetricTag { + obj := patternFlowTcpEcnCwrMetricTag{obj: &otg.PatternFlowTcpEcnCwrMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpEcnCwrMetricTag) msg() *otg.PatternFlowTcpEcnCwrMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpEcnCwrMetricTag) setMsg(msg *otg.PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpEcnCwrMetricTag struct { + obj *patternFlowTcpEcnCwrMetricTag +} + +type marshalPatternFlowTcpEcnCwrMetricTag interface { + // ToProto marshals PatternFlowTcpEcnCwrMetricTag to protobuf object *otg.PatternFlowTcpEcnCwrMetricTag + ToProto() (*otg.PatternFlowTcpEcnCwrMetricTag, error) + // ToPbText marshals PatternFlowTcpEcnCwrMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpEcnCwrMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpEcnCwrMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpEcnCwrMetricTag struct { + obj *patternFlowTcpEcnCwrMetricTag +} + +type unMarshalPatternFlowTcpEcnCwrMetricTag interface { + // FromProto unmarshals PatternFlowTcpEcnCwrMetricTag from protobuf object *otg.PatternFlowTcpEcnCwrMetricTag + FromProto(msg *otg.PatternFlowTcpEcnCwrMetricTag) (PatternFlowTcpEcnCwrMetricTag, error) + // FromPbText unmarshals PatternFlowTcpEcnCwrMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpEcnCwrMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpEcnCwrMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpEcnCwrMetricTag) Marshal() marshalPatternFlowTcpEcnCwrMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpEcnCwrMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpEcnCwrMetricTag) Unmarshal() unMarshalPatternFlowTcpEcnCwrMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpEcnCwrMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpEcnCwrMetricTag) ToProto() (*otg.PatternFlowTcpEcnCwrMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpEcnCwrMetricTag) FromProto(msg *otg.PatternFlowTcpEcnCwrMetricTag) (PatternFlowTcpEcnCwrMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpEcnCwrMetricTag) 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 *unMarshalpatternFlowTcpEcnCwrMetricTag) 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 *marshalpatternFlowTcpEcnCwrMetricTag) 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 *unMarshalpatternFlowTcpEcnCwrMetricTag) 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 *marshalpatternFlowTcpEcnCwrMetricTag) 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 *unMarshalpatternFlowTcpEcnCwrMetricTag) 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 *patternFlowTcpEcnCwrMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnCwrMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnCwrMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpEcnCwrMetricTag) Clone() (PatternFlowTcpEcnCwrMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpEcnCwrMetricTag() + 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 +} + +// PatternFlowTcpEcnCwrMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpEcnCwrMetricTag interface { + Validation + // msg marshals PatternFlowTcpEcnCwrMetricTag to protobuf object *otg.PatternFlowTcpEcnCwrMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpEcnCwrMetricTag + // setMsg unmarshals PatternFlowTcpEcnCwrMetricTag from protobuf object *otg.PatternFlowTcpEcnCwrMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpEcnCwrMetricTag) PatternFlowTcpEcnCwrMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpEcnCwrMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpEcnCwrMetricTag + // validate validates PatternFlowTcpEcnCwrMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpEcnCwrMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpEcnCwrMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpEcnCwrMetricTag + SetName(value string) PatternFlowTcpEcnCwrMetricTag + // Offset returns uint32, set in PatternFlowTcpEcnCwrMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpEcnCwrMetricTag + SetOffset(value uint32) PatternFlowTcpEcnCwrMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpEcnCwrMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpEcnCwrMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpEcnCwrMetricTag + SetLength(value uint32) PatternFlowTcpEcnCwrMetricTag + // HasLength checks if Length has been set in PatternFlowTcpEcnCwrMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpEcnCwrMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpEcnCwrMetricTag object +func (obj *patternFlowTcpEcnCwrMetricTag) SetName(value string) PatternFlowTcpEcnCwrMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpEcnCwrMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpEcnCwrMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpEcnCwrMetricTag object +func (obj *patternFlowTcpEcnCwrMetricTag) SetOffset(value uint32) PatternFlowTcpEcnCwrMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpEcnCwrMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpEcnCwrMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpEcnCwrMetricTag object +func (obj *patternFlowTcpEcnCwrMetricTag) SetLength(value uint32) PatternFlowTcpEcnCwrMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpEcnCwrMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpEcnCwrMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnCwrMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpEcnCwrMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpEcnCwrMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ecn_echo.go b/gosnappi/pattern_flow_tcp_ecn_echo.go new file mode 100644 index 00000000..b726bb47 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ecn_echo.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowTcpEcnEcho ***** +type patternFlowTcpEcnEcho struct { + validation + obj *otg.PatternFlowTcpEcnEcho + marshaller marshalPatternFlowTcpEcnEcho + unMarshaller unMarshalPatternFlowTcpEcnEcho + incrementHolder PatternFlowTcpEcnEchoCounter + decrementHolder PatternFlowTcpEcnEchoCounter + metricTagsHolder PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter +} + +func NewPatternFlowTcpEcnEcho() PatternFlowTcpEcnEcho { + obj := patternFlowTcpEcnEcho{obj: &otg.PatternFlowTcpEcnEcho{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpEcnEcho) msg() *otg.PatternFlowTcpEcnEcho { + return obj.obj +} + +func (obj *patternFlowTcpEcnEcho) setMsg(msg *otg.PatternFlowTcpEcnEcho) PatternFlowTcpEcnEcho { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpEcnEcho struct { + obj *patternFlowTcpEcnEcho +} + +type marshalPatternFlowTcpEcnEcho interface { + // ToProto marshals PatternFlowTcpEcnEcho to protobuf object *otg.PatternFlowTcpEcnEcho + ToProto() (*otg.PatternFlowTcpEcnEcho, error) + // ToPbText marshals PatternFlowTcpEcnEcho to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpEcnEcho to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpEcnEcho to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpEcnEcho struct { + obj *patternFlowTcpEcnEcho +} + +type unMarshalPatternFlowTcpEcnEcho interface { + // FromProto unmarshals PatternFlowTcpEcnEcho from protobuf object *otg.PatternFlowTcpEcnEcho + FromProto(msg *otg.PatternFlowTcpEcnEcho) (PatternFlowTcpEcnEcho, error) + // FromPbText unmarshals PatternFlowTcpEcnEcho from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpEcnEcho from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpEcnEcho from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpEcnEcho) Marshal() marshalPatternFlowTcpEcnEcho { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpEcnEcho{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpEcnEcho) Unmarshal() unMarshalPatternFlowTcpEcnEcho { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpEcnEcho{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpEcnEcho) ToProto() (*otg.PatternFlowTcpEcnEcho, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpEcnEcho) FromProto(msg *otg.PatternFlowTcpEcnEcho) (PatternFlowTcpEcnEcho, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpEcnEcho) 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 *unMarshalpatternFlowTcpEcnEcho) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpEcnEcho) 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 *unMarshalpatternFlowTcpEcnEcho) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpEcnEcho) 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 *unMarshalpatternFlowTcpEcnEcho) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpEcnEcho) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnEcho) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnEcho) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpEcnEcho) Clone() (PatternFlowTcpEcnEcho, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpEcnEcho() + 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 +} + +func (obj *patternFlowTcpEcnEcho) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpEcnEcho is explicit congestion notification, echo. 1 indicates the peer is ecn capable. 0 indicates that a packet with ipv4.ecn = 11 in the ip header was received during normal transmission. +type PatternFlowTcpEcnEcho interface { + Validation + // msg marshals PatternFlowTcpEcnEcho to protobuf object *otg.PatternFlowTcpEcnEcho + // and doesn't set defaults + msg() *otg.PatternFlowTcpEcnEcho + // setMsg unmarshals PatternFlowTcpEcnEcho from protobuf object *otg.PatternFlowTcpEcnEcho + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpEcnEcho) PatternFlowTcpEcnEcho + // provides marshal interface + Marshal() marshalPatternFlowTcpEcnEcho + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpEcnEcho + // validate validates PatternFlowTcpEcnEcho + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpEcnEcho, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpEcnEchoChoiceEnum, set in PatternFlowTcpEcnEcho + Choice() PatternFlowTcpEcnEchoChoiceEnum + // setChoice assigns PatternFlowTcpEcnEchoChoiceEnum provided by user to PatternFlowTcpEcnEcho + setChoice(value PatternFlowTcpEcnEchoChoiceEnum) PatternFlowTcpEcnEcho + // HasChoice checks if Choice has been set in PatternFlowTcpEcnEcho + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpEcnEcho. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpEcnEcho + SetValue(value uint32) PatternFlowTcpEcnEcho + // HasValue checks if Value has been set in PatternFlowTcpEcnEcho + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpEcnEcho. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpEcnEcho + SetValues(value []uint32) PatternFlowTcpEcnEcho + // Increment returns PatternFlowTcpEcnEchoCounter, set in PatternFlowTcpEcnEcho. + // PatternFlowTcpEcnEchoCounter is integer counter pattern + Increment() PatternFlowTcpEcnEchoCounter + // SetIncrement assigns PatternFlowTcpEcnEchoCounter provided by user to PatternFlowTcpEcnEcho. + // PatternFlowTcpEcnEchoCounter is integer counter pattern + SetIncrement(value PatternFlowTcpEcnEchoCounter) PatternFlowTcpEcnEcho + // HasIncrement checks if Increment has been set in PatternFlowTcpEcnEcho + HasIncrement() bool + // Decrement returns PatternFlowTcpEcnEchoCounter, set in PatternFlowTcpEcnEcho. + // PatternFlowTcpEcnEchoCounter is integer counter pattern + Decrement() PatternFlowTcpEcnEchoCounter + // SetDecrement assigns PatternFlowTcpEcnEchoCounter provided by user to PatternFlowTcpEcnEcho. + // PatternFlowTcpEcnEchoCounter is integer counter pattern + SetDecrement(value PatternFlowTcpEcnEchoCounter) PatternFlowTcpEcnEcho + // HasDecrement checks if Decrement has been set in PatternFlowTcpEcnEcho + HasDecrement() bool + // MetricTags returns PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIterIter, set in PatternFlowTcpEcnEcho + MetricTags() PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter + setNil() +} + +type PatternFlowTcpEcnEchoChoiceEnum string + +// Enum of Choice on PatternFlowTcpEcnEcho +var PatternFlowTcpEcnEchoChoice = struct { + VALUE PatternFlowTcpEcnEchoChoiceEnum + VALUES PatternFlowTcpEcnEchoChoiceEnum + INCREMENT PatternFlowTcpEcnEchoChoiceEnum + DECREMENT PatternFlowTcpEcnEchoChoiceEnum +}{ + VALUE: PatternFlowTcpEcnEchoChoiceEnum("value"), + VALUES: PatternFlowTcpEcnEchoChoiceEnum("values"), + INCREMENT: PatternFlowTcpEcnEchoChoiceEnum("increment"), + DECREMENT: PatternFlowTcpEcnEchoChoiceEnum("decrement"), +} + +func (obj *patternFlowTcpEcnEcho) Choice() PatternFlowTcpEcnEchoChoiceEnum { + return PatternFlowTcpEcnEchoChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpEcnEcho) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpEcnEcho) setChoice(value PatternFlowTcpEcnEchoChoiceEnum) PatternFlowTcpEcnEcho { + intValue, ok := otg.PatternFlowTcpEcnEcho_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpEcnEchoChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpEcnEcho_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpEcnEchoChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpEcnEchoChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpEcnEchoChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpEcnEchoCounter().msg() + } + + if value == PatternFlowTcpEcnEchoChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpEcnEchoCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpEcnEcho) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpEcnEchoChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpEcnEcho) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpEcnEcho object +func (obj *patternFlowTcpEcnEcho) SetValue(value uint32) PatternFlowTcpEcnEcho { + obj.setChoice(PatternFlowTcpEcnEchoChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpEcnEcho) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpEcnEcho object +func (obj *patternFlowTcpEcnEcho) SetValues(value []uint32) PatternFlowTcpEcnEcho { + obj.setChoice(PatternFlowTcpEcnEchoChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpEcnEchoCounter +func (obj *patternFlowTcpEcnEcho) Increment() PatternFlowTcpEcnEchoCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpEcnEchoChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpEcnEchoCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpEcnEchoCounter +func (obj *patternFlowTcpEcnEcho) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpEcnEchoCounter value in the PatternFlowTcpEcnEcho object +func (obj *patternFlowTcpEcnEcho) SetIncrement(value PatternFlowTcpEcnEchoCounter) PatternFlowTcpEcnEcho { + obj.setChoice(PatternFlowTcpEcnEchoChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpEcnEchoCounter +func (obj *patternFlowTcpEcnEcho) Decrement() PatternFlowTcpEcnEchoCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpEcnEchoChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpEcnEchoCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpEcnEchoCounter +func (obj *patternFlowTcpEcnEcho) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpEcnEchoCounter value in the PatternFlowTcpEcnEcho object +func (obj *patternFlowTcpEcnEcho) SetDecrement(value PatternFlowTcpEcnEchoCounter) PatternFlowTcpEcnEcho { + obj.setChoice(PatternFlowTcpEcnEchoChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpEcnEchoMetricTag +func (obj *patternFlowTcpEcnEcho) MetricTags() PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpEcnEchoMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter struct { + obj *patternFlowTcpEcnEcho + patternFlowTcpEcnEchoMetricTagSlice []PatternFlowTcpEcnEchoMetricTag + fieldPtr *[]*otg.PatternFlowTcpEcnEchoMetricTag +} + +func newPatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter(ptr *[]*otg.PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { + return &patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter interface { + setMsg(*patternFlowTcpEcnEcho) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter + Items() []PatternFlowTcpEcnEchoMetricTag + Add() PatternFlowTcpEcnEchoMetricTag + Append(items ...PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter + Set(index int, newObj PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter + Clear() PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter + clearHolderSlice() PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter + appendHolderSlice(item PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter +} + +func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) setMsg(msg *patternFlowTcpEcnEcho) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpEcnEchoMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) Items() []PatternFlowTcpEcnEchoMetricTag { + return obj.patternFlowTcpEcnEchoMetricTagSlice +} + +func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) Add() PatternFlowTcpEcnEchoMetricTag { + newObj := &otg.PatternFlowTcpEcnEchoMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpEcnEchoMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpEcnEchoMetricTagSlice = append(obj.patternFlowTcpEcnEchoMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) Append(items ...PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpEcnEchoMetricTagSlice = append(obj.patternFlowTcpEcnEchoMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) Set(index int, newObj PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpEcnEchoMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) Clear() PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpEcnEchoMetricTag{} + obj.patternFlowTcpEcnEchoMetricTagSlice = []PatternFlowTcpEcnEchoMetricTag{} + } + return obj +} +func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) clearHolderSlice() PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { + if len(obj.patternFlowTcpEcnEchoMetricTagSlice) > 0 { + obj.patternFlowTcpEcnEchoMetricTagSlice = []PatternFlowTcpEcnEchoMetricTag{} + } + return obj +} +func (obj *patternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter) appendHolderSlice(item PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoPatternFlowTcpEcnEchoMetricTagIter { + obj.patternFlowTcpEcnEchoMetricTagSlice = append(obj.patternFlowTcpEcnEchoMetricTagSlice, item) + return obj +} + +func (obj *patternFlowTcpEcnEcho) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnEcho.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowTcpEcnEcho.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpEcnEchoMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowTcpEcnEcho) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpEcnEchoChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpEcnEchoChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpEcnEchoChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpEcnEchoChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpEcnEchoChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpEcnEchoChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpEcnEcho") + } + } else { + intVal := otg.PatternFlowTcpEcnEcho_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpEcnEcho_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_ecn_echo_counter.go b/gosnappi/pattern_flow_tcp_ecn_echo_counter.go new file mode 100644 index 00000000..6ffc16ef --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ecn_echo_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowTcpEcnEchoCounter ***** +type patternFlowTcpEcnEchoCounter struct { + validation + obj *otg.PatternFlowTcpEcnEchoCounter + marshaller marshalPatternFlowTcpEcnEchoCounter + unMarshaller unMarshalPatternFlowTcpEcnEchoCounter +} + +func NewPatternFlowTcpEcnEchoCounter() PatternFlowTcpEcnEchoCounter { + obj := patternFlowTcpEcnEchoCounter{obj: &otg.PatternFlowTcpEcnEchoCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpEcnEchoCounter) msg() *otg.PatternFlowTcpEcnEchoCounter { + return obj.obj +} + +func (obj *patternFlowTcpEcnEchoCounter) setMsg(msg *otg.PatternFlowTcpEcnEchoCounter) PatternFlowTcpEcnEchoCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpEcnEchoCounter struct { + obj *patternFlowTcpEcnEchoCounter +} + +type marshalPatternFlowTcpEcnEchoCounter interface { + // ToProto marshals PatternFlowTcpEcnEchoCounter to protobuf object *otg.PatternFlowTcpEcnEchoCounter + ToProto() (*otg.PatternFlowTcpEcnEchoCounter, error) + // ToPbText marshals PatternFlowTcpEcnEchoCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpEcnEchoCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpEcnEchoCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpEcnEchoCounter struct { + obj *patternFlowTcpEcnEchoCounter +} + +type unMarshalPatternFlowTcpEcnEchoCounter interface { + // FromProto unmarshals PatternFlowTcpEcnEchoCounter from protobuf object *otg.PatternFlowTcpEcnEchoCounter + FromProto(msg *otg.PatternFlowTcpEcnEchoCounter) (PatternFlowTcpEcnEchoCounter, error) + // FromPbText unmarshals PatternFlowTcpEcnEchoCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpEcnEchoCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpEcnEchoCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpEcnEchoCounter) Marshal() marshalPatternFlowTcpEcnEchoCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpEcnEchoCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpEcnEchoCounter) Unmarshal() unMarshalPatternFlowTcpEcnEchoCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpEcnEchoCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpEcnEchoCounter) ToProto() (*otg.PatternFlowTcpEcnEchoCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpEcnEchoCounter) FromProto(msg *otg.PatternFlowTcpEcnEchoCounter) (PatternFlowTcpEcnEchoCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpEcnEchoCounter) 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 *unMarshalpatternFlowTcpEcnEchoCounter) 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 *marshalpatternFlowTcpEcnEchoCounter) 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 *unMarshalpatternFlowTcpEcnEchoCounter) 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 *marshalpatternFlowTcpEcnEchoCounter) 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 *unMarshalpatternFlowTcpEcnEchoCounter) 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 *patternFlowTcpEcnEchoCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnEchoCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnEchoCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpEcnEchoCounter) Clone() (PatternFlowTcpEcnEchoCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpEcnEchoCounter() + 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 +} + +// PatternFlowTcpEcnEchoCounter is integer counter pattern +type PatternFlowTcpEcnEchoCounter interface { + Validation + // msg marshals PatternFlowTcpEcnEchoCounter to protobuf object *otg.PatternFlowTcpEcnEchoCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpEcnEchoCounter + // setMsg unmarshals PatternFlowTcpEcnEchoCounter from protobuf object *otg.PatternFlowTcpEcnEchoCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpEcnEchoCounter) PatternFlowTcpEcnEchoCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpEcnEchoCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpEcnEchoCounter + // validate validates PatternFlowTcpEcnEchoCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpEcnEchoCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpEcnEchoCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpEcnEchoCounter + SetStart(value uint32) PatternFlowTcpEcnEchoCounter + // HasStart checks if Start has been set in PatternFlowTcpEcnEchoCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpEcnEchoCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpEcnEchoCounter + SetStep(value uint32) PatternFlowTcpEcnEchoCounter + // HasStep checks if Step has been set in PatternFlowTcpEcnEchoCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpEcnEchoCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpEcnEchoCounter + SetCount(value uint32) PatternFlowTcpEcnEchoCounter + // HasCount checks if Count has been set in PatternFlowTcpEcnEchoCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpEcnEchoCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpEcnEchoCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpEcnEchoCounter object +func (obj *patternFlowTcpEcnEchoCounter) SetStart(value uint32) PatternFlowTcpEcnEchoCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpEcnEchoCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpEcnEchoCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpEcnEchoCounter object +func (obj *patternFlowTcpEcnEchoCounter) SetStep(value uint32) PatternFlowTcpEcnEchoCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpEcnEchoCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpEcnEchoCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpEcnEchoCounter object +func (obj *patternFlowTcpEcnEchoCounter) SetCount(value uint32) PatternFlowTcpEcnEchoCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpEcnEchoCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnEchoCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnEchoCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnEchoCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowTcpEcnEchoCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ecn_echo_metric_tag.go b/gosnappi/pattern_flow_tcp_ecn_echo_metric_tag.go new file mode 100644 index 00000000..89f278a8 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ecn_echo_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpEcnEchoMetricTag ***** +type patternFlowTcpEcnEchoMetricTag struct { + validation + obj *otg.PatternFlowTcpEcnEchoMetricTag + marshaller marshalPatternFlowTcpEcnEchoMetricTag + unMarshaller unMarshalPatternFlowTcpEcnEchoMetricTag +} + +func NewPatternFlowTcpEcnEchoMetricTag() PatternFlowTcpEcnEchoMetricTag { + obj := patternFlowTcpEcnEchoMetricTag{obj: &otg.PatternFlowTcpEcnEchoMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpEcnEchoMetricTag) msg() *otg.PatternFlowTcpEcnEchoMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpEcnEchoMetricTag) setMsg(msg *otg.PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpEcnEchoMetricTag struct { + obj *patternFlowTcpEcnEchoMetricTag +} + +type marshalPatternFlowTcpEcnEchoMetricTag interface { + // ToProto marshals PatternFlowTcpEcnEchoMetricTag to protobuf object *otg.PatternFlowTcpEcnEchoMetricTag + ToProto() (*otg.PatternFlowTcpEcnEchoMetricTag, error) + // ToPbText marshals PatternFlowTcpEcnEchoMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpEcnEchoMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpEcnEchoMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpEcnEchoMetricTag struct { + obj *patternFlowTcpEcnEchoMetricTag +} + +type unMarshalPatternFlowTcpEcnEchoMetricTag interface { + // FromProto unmarshals PatternFlowTcpEcnEchoMetricTag from protobuf object *otg.PatternFlowTcpEcnEchoMetricTag + FromProto(msg *otg.PatternFlowTcpEcnEchoMetricTag) (PatternFlowTcpEcnEchoMetricTag, error) + // FromPbText unmarshals PatternFlowTcpEcnEchoMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpEcnEchoMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpEcnEchoMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpEcnEchoMetricTag) Marshal() marshalPatternFlowTcpEcnEchoMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpEcnEchoMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpEcnEchoMetricTag) Unmarshal() unMarshalPatternFlowTcpEcnEchoMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpEcnEchoMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpEcnEchoMetricTag) ToProto() (*otg.PatternFlowTcpEcnEchoMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpEcnEchoMetricTag) FromProto(msg *otg.PatternFlowTcpEcnEchoMetricTag) (PatternFlowTcpEcnEchoMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpEcnEchoMetricTag) 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 *unMarshalpatternFlowTcpEcnEchoMetricTag) 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 *marshalpatternFlowTcpEcnEchoMetricTag) 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 *unMarshalpatternFlowTcpEcnEchoMetricTag) 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 *marshalpatternFlowTcpEcnEchoMetricTag) 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 *unMarshalpatternFlowTcpEcnEchoMetricTag) 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 *patternFlowTcpEcnEchoMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnEchoMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnEchoMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpEcnEchoMetricTag) Clone() (PatternFlowTcpEcnEchoMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpEcnEchoMetricTag() + 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 +} + +// PatternFlowTcpEcnEchoMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpEcnEchoMetricTag interface { + Validation + // msg marshals PatternFlowTcpEcnEchoMetricTag to protobuf object *otg.PatternFlowTcpEcnEchoMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpEcnEchoMetricTag + // setMsg unmarshals PatternFlowTcpEcnEchoMetricTag from protobuf object *otg.PatternFlowTcpEcnEchoMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpEcnEchoMetricTag) PatternFlowTcpEcnEchoMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpEcnEchoMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpEcnEchoMetricTag + // validate validates PatternFlowTcpEcnEchoMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpEcnEchoMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpEcnEchoMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpEcnEchoMetricTag + SetName(value string) PatternFlowTcpEcnEchoMetricTag + // Offset returns uint32, set in PatternFlowTcpEcnEchoMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpEcnEchoMetricTag + SetOffset(value uint32) PatternFlowTcpEcnEchoMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpEcnEchoMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpEcnEchoMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpEcnEchoMetricTag + SetLength(value uint32) PatternFlowTcpEcnEchoMetricTag + // HasLength checks if Length has been set in PatternFlowTcpEcnEchoMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpEcnEchoMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpEcnEchoMetricTag object +func (obj *patternFlowTcpEcnEchoMetricTag) SetName(value string) PatternFlowTcpEcnEchoMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpEcnEchoMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpEcnEchoMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpEcnEchoMetricTag object +func (obj *patternFlowTcpEcnEchoMetricTag) SetOffset(value uint32) PatternFlowTcpEcnEchoMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpEcnEchoMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpEcnEchoMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpEcnEchoMetricTag object +func (obj *patternFlowTcpEcnEchoMetricTag) SetLength(value uint32) PatternFlowTcpEcnEchoMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpEcnEchoMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpEcnEchoMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnEchoMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpEcnEchoMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpEcnEchoMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ecn_ns.go b/gosnappi/pattern_flow_tcp_ecn_ns.go new file mode 100644 index 00000000..f44ebca9 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ecn_ns.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowTcpEcnNs ***** +type patternFlowTcpEcnNs struct { + validation + obj *otg.PatternFlowTcpEcnNs + marshaller marshalPatternFlowTcpEcnNs + unMarshaller unMarshalPatternFlowTcpEcnNs + incrementHolder PatternFlowTcpEcnNsCounter + decrementHolder PatternFlowTcpEcnNsCounter + metricTagsHolder PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter +} + +func NewPatternFlowTcpEcnNs() PatternFlowTcpEcnNs { + obj := patternFlowTcpEcnNs{obj: &otg.PatternFlowTcpEcnNs{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpEcnNs) msg() *otg.PatternFlowTcpEcnNs { + return obj.obj +} + +func (obj *patternFlowTcpEcnNs) setMsg(msg *otg.PatternFlowTcpEcnNs) PatternFlowTcpEcnNs { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpEcnNs struct { + obj *patternFlowTcpEcnNs +} + +type marshalPatternFlowTcpEcnNs interface { + // ToProto marshals PatternFlowTcpEcnNs to protobuf object *otg.PatternFlowTcpEcnNs + ToProto() (*otg.PatternFlowTcpEcnNs, error) + // ToPbText marshals PatternFlowTcpEcnNs to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpEcnNs to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpEcnNs to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpEcnNs struct { + obj *patternFlowTcpEcnNs +} + +type unMarshalPatternFlowTcpEcnNs interface { + // FromProto unmarshals PatternFlowTcpEcnNs from protobuf object *otg.PatternFlowTcpEcnNs + FromProto(msg *otg.PatternFlowTcpEcnNs) (PatternFlowTcpEcnNs, error) + // FromPbText unmarshals PatternFlowTcpEcnNs from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpEcnNs from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpEcnNs from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpEcnNs) Marshal() marshalPatternFlowTcpEcnNs { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpEcnNs{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpEcnNs) Unmarshal() unMarshalPatternFlowTcpEcnNs { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpEcnNs{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpEcnNs) ToProto() (*otg.PatternFlowTcpEcnNs, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpEcnNs) FromProto(msg *otg.PatternFlowTcpEcnNs) (PatternFlowTcpEcnNs, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpEcnNs) 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 *unMarshalpatternFlowTcpEcnNs) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpEcnNs) 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 *unMarshalpatternFlowTcpEcnNs) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpEcnNs) 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 *unMarshalpatternFlowTcpEcnNs) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpEcnNs) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnNs) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnNs) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpEcnNs) Clone() (PatternFlowTcpEcnNs, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpEcnNs() + 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 +} + +func (obj *patternFlowTcpEcnNs) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpEcnNs is explicit congestion notification, concealment protection. +type PatternFlowTcpEcnNs interface { + Validation + // msg marshals PatternFlowTcpEcnNs to protobuf object *otg.PatternFlowTcpEcnNs + // and doesn't set defaults + msg() *otg.PatternFlowTcpEcnNs + // setMsg unmarshals PatternFlowTcpEcnNs from protobuf object *otg.PatternFlowTcpEcnNs + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpEcnNs) PatternFlowTcpEcnNs + // provides marshal interface + Marshal() marshalPatternFlowTcpEcnNs + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpEcnNs + // validate validates PatternFlowTcpEcnNs + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpEcnNs, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpEcnNsChoiceEnum, set in PatternFlowTcpEcnNs + Choice() PatternFlowTcpEcnNsChoiceEnum + // setChoice assigns PatternFlowTcpEcnNsChoiceEnum provided by user to PatternFlowTcpEcnNs + setChoice(value PatternFlowTcpEcnNsChoiceEnum) PatternFlowTcpEcnNs + // HasChoice checks if Choice has been set in PatternFlowTcpEcnNs + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpEcnNs. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpEcnNs + SetValue(value uint32) PatternFlowTcpEcnNs + // HasValue checks if Value has been set in PatternFlowTcpEcnNs + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpEcnNs. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpEcnNs + SetValues(value []uint32) PatternFlowTcpEcnNs + // Increment returns PatternFlowTcpEcnNsCounter, set in PatternFlowTcpEcnNs. + // PatternFlowTcpEcnNsCounter is integer counter pattern + Increment() PatternFlowTcpEcnNsCounter + // SetIncrement assigns PatternFlowTcpEcnNsCounter provided by user to PatternFlowTcpEcnNs. + // PatternFlowTcpEcnNsCounter is integer counter pattern + SetIncrement(value PatternFlowTcpEcnNsCounter) PatternFlowTcpEcnNs + // HasIncrement checks if Increment has been set in PatternFlowTcpEcnNs + HasIncrement() bool + // Decrement returns PatternFlowTcpEcnNsCounter, set in PatternFlowTcpEcnNs. + // PatternFlowTcpEcnNsCounter is integer counter pattern + Decrement() PatternFlowTcpEcnNsCounter + // SetDecrement assigns PatternFlowTcpEcnNsCounter provided by user to PatternFlowTcpEcnNs. + // PatternFlowTcpEcnNsCounter is integer counter pattern + SetDecrement(value PatternFlowTcpEcnNsCounter) PatternFlowTcpEcnNs + // HasDecrement checks if Decrement has been set in PatternFlowTcpEcnNs + HasDecrement() bool + // MetricTags returns PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIterIter, set in PatternFlowTcpEcnNs + MetricTags() PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter + setNil() +} + +type PatternFlowTcpEcnNsChoiceEnum string + +// Enum of Choice on PatternFlowTcpEcnNs +var PatternFlowTcpEcnNsChoice = struct { + VALUE PatternFlowTcpEcnNsChoiceEnum + VALUES PatternFlowTcpEcnNsChoiceEnum + INCREMENT PatternFlowTcpEcnNsChoiceEnum + DECREMENT PatternFlowTcpEcnNsChoiceEnum +}{ + VALUE: PatternFlowTcpEcnNsChoiceEnum("value"), + VALUES: PatternFlowTcpEcnNsChoiceEnum("values"), + INCREMENT: PatternFlowTcpEcnNsChoiceEnum("increment"), + DECREMENT: PatternFlowTcpEcnNsChoiceEnum("decrement"), +} + +func (obj *patternFlowTcpEcnNs) Choice() PatternFlowTcpEcnNsChoiceEnum { + return PatternFlowTcpEcnNsChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpEcnNs) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpEcnNs) setChoice(value PatternFlowTcpEcnNsChoiceEnum) PatternFlowTcpEcnNs { + intValue, ok := otg.PatternFlowTcpEcnNs_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpEcnNsChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpEcnNs_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpEcnNsChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpEcnNsChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpEcnNsChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpEcnNsCounter().msg() + } + + if value == PatternFlowTcpEcnNsChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpEcnNsCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpEcnNs) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpEcnNsChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpEcnNs) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpEcnNs object +func (obj *patternFlowTcpEcnNs) SetValue(value uint32) PatternFlowTcpEcnNs { + obj.setChoice(PatternFlowTcpEcnNsChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpEcnNs) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpEcnNs object +func (obj *patternFlowTcpEcnNs) SetValues(value []uint32) PatternFlowTcpEcnNs { + obj.setChoice(PatternFlowTcpEcnNsChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpEcnNsCounter +func (obj *patternFlowTcpEcnNs) Increment() PatternFlowTcpEcnNsCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpEcnNsChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpEcnNsCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpEcnNsCounter +func (obj *patternFlowTcpEcnNs) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpEcnNsCounter value in the PatternFlowTcpEcnNs object +func (obj *patternFlowTcpEcnNs) SetIncrement(value PatternFlowTcpEcnNsCounter) PatternFlowTcpEcnNs { + obj.setChoice(PatternFlowTcpEcnNsChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpEcnNsCounter +func (obj *patternFlowTcpEcnNs) Decrement() PatternFlowTcpEcnNsCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpEcnNsChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpEcnNsCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpEcnNsCounter +func (obj *patternFlowTcpEcnNs) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpEcnNsCounter value in the PatternFlowTcpEcnNs object +func (obj *patternFlowTcpEcnNs) SetDecrement(value PatternFlowTcpEcnNsCounter) PatternFlowTcpEcnNs { + obj.setChoice(PatternFlowTcpEcnNsChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpEcnNsMetricTag +func (obj *patternFlowTcpEcnNs) MetricTags() PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpEcnNsMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter struct { + obj *patternFlowTcpEcnNs + patternFlowTcpEcnNsMetricTagSlice []PatternFlowTcpEcnNsMetricTag + fieldPtr *[]*otg.PatternFlowTcpEcnNsMetricTag +} + +func newPatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter(ptr *[]*otg.PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { + return &patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter interface { + setMsg(*patternFlowTcpEcnNs) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter + Items() []PatternFlowTcpEcnNsMetricTag + Add() PatternFlowTcpEcnNsMetricTag + Append(items ...PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter + Set(index int, newObj PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter + Clear() PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter + clearHolderSlice() PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter + appendHolderSlice(item PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter +} + +func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) setMsg(msg *patternFlowTcpEcnNs) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpEcnNsMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) Items() []PatternFlowTcpEcnNsMetricTag { + return obj.patternFlowTcpEcnNsMetricTagSlice +} + +func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) Add() PatternFlowTcpEcnNsMetricTag { + newObj := &otg.PatternFlowTcpEcnNsMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpEcnNsMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpEcnNsMetricTagSlice = append(obj.patternFlowTcpEcnNsMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) Append(items ...PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpEcnNsMetricTagSlice = append(obj.patternFlowTcpEcnNsMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) Set(index int, newObj PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpEcnNsMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) Clear() PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpEcnNsMetricTag{} + obj.patternFlowTcpEcnNsMetricTagSlice = []PatternFlowTcpEcnNsMetricTag{} + } + return obj +} +func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) clearHolderSlice() PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { + if len(obj.patternFlowTcpEcnNsMetricTagSlice) > 0 { + obj.patternFlowTcpEcnNsMetricTagSlice = []PatternFlowTcpEcnNsMetricTag{} + } + return obj +} +func (obj *patternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter) appendHolderSlice(item PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsPatternFlowTcpEcnNsMetricTagIter { + obj.patternFlowTcpEcnNsMetricTagSlice = append(obj.patternFlowTcpEcnNsMetricTagSlice, item) + return obj +} + +func (obj *patternFlowTcpEcnNs) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnNs.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowTcpEcnNs.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpEcnNsMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowTcpEcnNs) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpEcnNsChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpEcnNsChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpEcnNsChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpEcnNsChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpEcnNsChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpEcnNsChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpEcnNs") + } + } else { + intVal := otg.PatternFlowTcpEcnNs_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpEcnNs_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_ecn_ns_counter.go b/gosnappi/pattern_flow_tcp_ecn_ns_counter.go new file mode 100644 index 00000000..ccb661c3 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ecn_ns_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowTcpEcnNsCounter ***** +type patternFlowTcpEcnNsCounter struct { + validation + obj *otg.PatternFlowTcpEcnNsCounter + marshaller marshalPatternFlowTcpEcnNsCounter + unMarshaller unMarshalPatternFlowTcpEcnNsCounter +} + +func NewPatternFlowTcpEcnNsCounter() PatternFlowTcpEcnNsCounter { + obj := patternFlowTcpEcnNsCounter{obj: &otg.PatternFlowTcpEcnNsCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpEcnNsCounter) msg() *otg.PatternFlowTcpEcnNsCounter { + return obj.obj +} + +func (obj *patternFlowTcpEcnNsCounter) setMsg(msg *otg.PatternFlowTcpEcnNsCounter) PatternFlowTcpEcnNsCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpEcnNsCounter struct { + obj *patternFlowTcpEcnNsCounter +} + +type marshalPatternFlowTcpEcnNsCounter interface { + // ToProto marshals PatternFlowTcpEcnNsCounter to protobuf object *otg.PatternFlowTcpEcnNsCounter + ToProto() (*otg.PatternFlowTcpEcnNsCounter, error) + // ToPbText marshals PatternFlowTcpEcnNsCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpEcnNsCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpEcnNsCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpEcnNsCounter struct { + obj *patternFlowTcpEcnNsCounter +} + +type unMarshalPatternFlowTcpEcnNsCounter interface { + // FromProto unmarshals PatternFlowTcpEcnNsCounter from protobuf object *otg.PatternFlowTcpEcnNsCounter + FromProto(msg *otg.PatternFlowTcpEcnNsCounter) (PatternFlowTcpEcnNsCounter, error) + // FromPbText unmarshals PatternFlowTcpEcnNsCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpEcnNsCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpEcnNsCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpEcnNsCounter) Marshal() marshalPatternFlowTcpEcnNsCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpEcnNsCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpEcnNsCounter) Unmarshal() unMarshalPatternFlowTcpEcnNsCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpEcnNsCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpEcnNsCounter) ToProto() (*otg.PatternFlowTcpEcnNsCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpEcnNsCounter) FromProto(msg *otg.PatternFlowTcpEcnNsCounter) (PatternFlowTcpEcnNsCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpEcnNsCounter) 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 *unMarshalpatternFlowTcpEcnNsCounter) 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 *marshalpatternFlowTcpEcnNsCounter) 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 *unMarshalpatternFlowTcpEcnNsCounter) 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 *marshalpatternFlowTcpEcnNsCounter) 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 *unMarshalpatternFlowTcpEcnNsCounter) 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 *patternFlowTcpEcnNsCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnNsCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnNsCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpEcnNsCounter) Clone() (PatternFlowTcpEcnNsCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpEcnNsCounter() + 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 +} + +// PatternFlowTcpEcnNsCounter is integer counter pattern +type PatternFlowTcpEcnNsCounter interface { + Validation + // msg marshals PatternFlowTcpEcnNsCounter to protobuf object *otg.PatternFlowTcpEcnNsCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpEcnNsCounter + // setMsg unmarshals PatternFlowTcpEcnNsCounter from protobuf object *otg.PatternFlowTcpEcnNsCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpEcnNsCounter) PatternFlowTcpEcnNsCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpEcnNsCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpEcnNsCounter + // validate validates PatternFlowTcpEcnNsCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpEcnNsCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpEcnNsCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpEcnNsCounter + SetStart(value uint32) PatternFlowTcpEcnNsCounter + // HasStart checks if Start has been set in PatternFlowTcpEcnNsCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpEcnNsCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpEcnNsCounter + SetStep(value uint32) PatternFlowTcpEcnNsCounter + // HasStep checks if Step has been set in PatternFlowTcpEcnNsCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpEcnNsCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpEcnNsCounter + SetCount(value uint32) PatternFlowTcpEcnNsCounter + // HasCount checks if Count has been set in PatternFlowTcpEcnNsCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpEcnNsCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpEcnNsCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpEcnNsCounter object +func (obj *patternFlowTcpEcnNsCounter) SetStart(value uint32) PatternFlowTcpEcnNsCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpEcnNsCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpEcnNsCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpEcnNsCounter object +func (obj *patternFlowTcpEcnNsCounter) SetStep(value uint32) PatternFlowTcpEcnNsCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpEcnNsCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpEcnNsCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpEcnNsCounter object +func (obj *patternFlowTcpEcnNsCounter) SetCount(value uint32) PatternFlowTcpEcnNsCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpEcnNsCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnNsCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnNsCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnNsCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowTcpEcnNsCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_ecn_ns_metric_tag.go b/gosnappi/pattern_flow_tcp_ecn_ns_metric_tag.go new file mode 100644 index 00000000..add72ca2 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_ecn_ns_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpEcnNsMetricTag ***** +type patternFlowTcpEcnNsMetricTag struct { + validation + obj *otg.PatternFlowTcpEcnNsMetricTag + marshaller marshalPatternFlowTcpEcnNsMetricTag + unMarshaller unMarshalPatternFlowTcpEcnNsMetricTag +} + +func NewPatternFlowTcpEcnNsMetricTag() PatternFlowTcpEcnNsMetricTag { + obj := patternFlowTcpEcnNsMetricTag{obj: &otg.PatternFlowTcpEcnNsMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpEcnNsMetricTag) msg() *otg.PatternFlowTcpEcnNsMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpEcnNsMetricTag) setMsg(msg *otg.PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpEcnNsMetricTag struct { + obj *patternFlowTcpEcnNsMetricTag +} + +type marshalPatternFlowTcpEcnNsMetricTag interface { + // ToProto marshals PatternFlowTcpEcnNsMetricTag to protobuf object *otg.PatternFlowTcpEcnNsMetricTag + ToProto() (*otg.PatternFlowTcpEcnNsMetricTag, error) + // ToPbText marshals PatternFlowTcpEcnNsMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpEcnNsMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpEcnNsMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpEcnNsMetricTag struct { + obj *patternFlowTcpEcnNsMetricTag +} + +type unMarshalPatternFlowTcpEcnNsMetricTag interface { + // FromProto unmarshals PatternFlowTcpEcnNsMetricTag from protobuf object *otg.PatternFlowTcpEcnNsMetricTag + FromProto(msg *otg.PatternFlowTcpEcnNsMetricTag) (PatternFlowTcpEcnNsMetricTag, error) + // FromPbText unmarshals PatternFlowTcpEcnNsMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpEcnNsMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpEcnNsMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpEcnNsMetricTag) Marshal() marshalPatternFlowTcpEcnNsMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpEcnNsMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpEcnNsMetricTag) Unmarshal() unMarshalPatternFlowTcpEcnNsMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpEcnNsMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpEcnNsMetricTag) ToProto() (*otg.PatternFlowTcpEcnNsMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpEcnNsMetricTag) FromProto(msg *otg.PatternFlowTcpEcnNsMetricTag) (PatternFlowTcpEcnNsMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpEcnNsMetricTag) 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 *unMarshalpatternFlowTcpEcnNsMetricTag) 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 *marshalpatternFlowTcpEcnNsMetricTag) 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 *unMarshalpatternFlowTcpEcnNsMetricTag) 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 *marshalpatternFlowTcpEcnNsMetricTag) 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 *unMarshalpatternFlowTcpEcnNsMetricTag) 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 *patternFlowTcpEcnNsMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnNsMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpEcnNsMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpEcnNsMetricTag) Clone() (PatternFlowTcpEcnNsMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpEcnNsMetricTag() + 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 +} + +// PatternFlowTcpEcnNsMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpEcnNsMetricTag interface { + Validation + // msg marshals PatternFlowTcpEcnNsMetricTag to protobuf object *otg.PatternFlowTcpEcnNsMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpEcnNsMetricTag + // setMsg unmarshals PatternFlowTcpEcnNsMetricTag from protobuf object *otg.PatternFlowTcpEcnNsMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpEcnNsMetricTag) PatternFlowTcpEcnNsMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpEcnNsMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpEcnNsMetricTag + // validate validates PatternFlowTcpEcnNsMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpEcnNsMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpEcnNsMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpEcnNsMetricTag + SetName(value string) PatternFlowTcpEcnNsMetricTag + // Offset returns uint32, set in PatternFlowTcpEcnNsMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpEcnNsMetricTag + SetOffset(value uint32) PatternFlowTcpEcnNsMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpEcnNsMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpEcnNsMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpEcnNsMetricTag + SetLength(value uint32) PatternFlowTcpEcnNsMetricTag + // HasLength checks if Length has been set in PatternFlowTcpEcnNsMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpEcnNsMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpEcnNsMetricTag object +func (obj *patternFlowTcpEcnNsMetricTag) SetName(value string) PatternFlowTcpEcnNsMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpEcnNsMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpEcnNsMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpEcnNsMetricTag object +func (obj *patternFlowTcpEcnNsMetricTag) SetOffset(value uint32) PatternFlowTcpEcnNsMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpEcnNsMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpEcnNsMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpEcnNsMetricTag object +func (obj *patternFlowTcpEcnNsMetricTag) SetLength(value uint32) PatternFlowTcpEcnNsMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpEcnNsMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpEcnNsMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpEcnNsMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpEcnNsMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpEcnNsMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_seq_num.go b/gosnappi/pattern_flow_tcp_seq_num.go new file mode 100644 index 00000000..b5bd1618 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_seq_num.go @@ -0,0 +1,640 @@ +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" +) + +// ***** PatternFlowTcpSeqNum ***** +type patternFlowTcpSeqNum struct { + validation + obj *otg.PatternFlowTcpSeqNum + marshaller marshalPatternFlowTcpSeqNum + unMarshaller unMarshalPatternFlowTcpSeqNum + incrementHolder PatternFlowTcpSeqNumCounter + decrementHolder PatternFlowTcpSeqNumCounter + metricTagsHolder PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter +} + +func NewPatternFlowTcpSeqNum() PatternFlowTcpSeqNum { + obj := patternFlowTcpSeqNum{obj: &otg.PatternFlowTcpSeqNum{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpSeqNum) msg() *otg.PatternFlowTcpSeqNum { + return obj.obj +} + +func (obj *patternFlowTcpSeqNum) setMsg(msg *otg.PatternFlowTcpSeqNum) PatternFlowTcpSeqNum { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpSeqNum struct { + obj *patternFlowTcpSeqNum +} + +type marshalPatternFlowTcpSeqNum interface { + // ToProto marshals PatternFlowTcpSeqNum to protobuf object *otg.PatternFlowTcpSeqNum + ToProto() (*otg.PatternFlowTcpSeqNum, error) + // ToPbText marshals PatternFlowTcpSeqNum to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpSeqNum to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpSeqNum to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpSeqNum struct { + obj *patternFlowTcpSeqNum +} + +type unMarshalPatternFlowTcpSeqNum interface { + // FromProto unmarshals PatternFlowTcpSeqNum from protobuf object *otg.PatternFlowTcpSeqNum + FromProto(msg *otg.PatternFlowTcpSeqNum) (PatternFlowTcpSeqNum, error) + // FromPbText unmarshals PatternFlowTcpSeqNum from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpSeqNum from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpSeqNum from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpSeqNum) Marshal() marshalPatternFlowTcpSeqNum { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpSeqNum{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpSeqNum) Unmarshal() unMarshalPatternFlowTcpSeqNum { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpSeqNum{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpSeqNum) ToProto() (*otg.PatternFlowTcpSeqNum, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpSeqNum) FromProto(msg *otg.PatternFlowTcpSeqNum) (PatternFlowTcpSeqNum, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpSeqNum) 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 *unMarshalpatternFlowTcpSeqNum) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpSeqNum) 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 *unMarshalpatternFlowTcpSeqNum) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpSeqNum) 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 *unMarshalpatternFlowTcpSeqNum) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpSeqNum) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpSeqNum) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpSeqNum) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpSeqNum) Clone() (PatternFlowTcpSeqNum, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpSeqNum() + 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 +} + +func (obj *patternFlowTcpSeqNum) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpSeqNum is sequence number +type PatternFlowTcpSeqNum interface { + Validation + // msg marshals PatternFlowTcpSeqNum to protobuf object *otg.PatternFlowTcpSeqNum + // and doesn't set defaults + msg() *otg.PatternFlowTcpSeqNum + // setMsg unmarshals PatternFlowTcpSeqNum from protobuf object *otg.PatternFlowTcpSeqNum + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpSeqNum) PatternFlowTcpSeqNum + // provides marshal interface + Marshal() marshalPatternFlowTcpSeqNum + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpSeqNum + // validate validates PatternFlowTcpSeqNum + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpSeqNum, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpSeqNumChoiceEnum, set in PatternFlowTcpSeqNum + Choice() PatternFlowTcpSeqNumChoiceEnum + // setChoice assigns PatternFlowTcpSeqNumChoiceEnum provided by user to PatternFlowTcpSeqNum + setChoice(value PatternFlowTcpSeqNumChoiceEnum) PatternFlowTcpSeqNum + // HasChoice checks if Choice has been set in PatternFlowTcpSeqNum + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpSeqNum. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpSeqNum + SetValue(value uint32) PatternFlowTcpSeqNum + // HasValue checks if Value has been set in PatternFlowTcpSeqNum + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpSeqNum. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpSeqNum + SetValues(value []uint32) PatternFlowTcpSeqNum + // Increment returns PatternFlowTcpSeqNumCounter, set in PatternFlowTcpSeqNum. + // PatternFlowTcpSeqNumCounter is integer counter pattern + Increment() PatternFlowTcpSeqNumCounter + // SetIncrement assigns PatternFlowTcpSeqNumCounter provided by user to PatternFlowTcpSeqNum. + // PatternFlowTcpSeqNumCounter is integer counter pattern + SetIncrement(value PatternFlowTcpSeqNumCounter) PatternFlowTcpSeqNum + // HasIncrement checks if Increment has been set in PatternFlowTcpSeqNum + HasIncrement() bool + // Decrement returns PatternFlowTcpSeqNumCounter, set in PatternFlowTcpSeqNum. + // PatternFlowTcpSeqNumCounter is integer counter pattern + Decrement() PatternFlowTcpSeqNumCounter + // SetDecrement assigns PatternFlowTcpSeqNumCounter provided by user to PatternFlowTcpSeqNum. + // PatternFlowTcpSeqNumCounter is integer counter pattern + SetDecrement(value PatternFlowTcpSeqNumCounter) PatternFlowTcpSeqNum + // HasDecrement checks if Decrement has been set in PatternFlowTcpSeqNum + HasDecrement() bool + // MetricTags returns PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIterIter, set in PatternFlowTcpSeqNum + MetricTags() PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter + setNil() +} + +type PatternFlowTcpSeqNumChoiceEnum string + +// Enum of Choice on PatternFlowTcpSeqNum +var PatternFlowTcpSeqNumChoice = struct { + VALUE PatternFlowTcpSeqNumChoiceEnum + VALUES PatternFlowTcpSeqNumChoiceEnum + INCREMENT PatternFlowTcpSeqNumChoiceEnum + DECREMENT PatternFlowTcpSeqNumChoiceEnum +}{ + VALUE: PatternFlowTcpSeqNumChoiceEnum("value"), + VALUES: PatternFlowTcpSeqNumChoiceEnum("values"), + INCREMENT: PatternFlowTcpSeqNumChoiceEnum("increment"), + DECREMENT: PatternFlowTcpSeqNumChoiceEnum("decrement"), +} + +func (obj *patternFlowTcpSeqNum) Choice() PatternFlowTcpSeqNumChoiceEnum { + return PatternFlowTcpSeqNumChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpSeqNum) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpSeqNum) setChoice(value PatternFlowTcpSeqNumChoiceEnum) PatternFlowTcpSeqNum { + intValue, ok := otg.PatternFlowTcpSeqNum_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpSeqNumChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpSeqNum_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpSeqNumChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpSeqNumChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpSeqNumChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpSeqNumCounter().msg() + } + + if value == PatternFlowTcpSeqNumChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpSeqNumCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpSeqNum) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpSeqNumChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpSeqNum) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpSeqNum object +func (obj *patternFlowTcpSeqNum) SetValue(value uint32) PatternFlowTcpSeqNum { + obj.setChoice(PatternFlowTcpSeqNumChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpSeqNum) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpSeqNum object +func (obj *patternFlowTcpSeqNum) SetValues(value []uint32) PatternFlowTcpSeqNum { + obj.setChoice(PatternFlowTcpSeqNumChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpSeqNumCounter +func (obj *patternFlowTcpSeqNum) Increment() PatternFlowTcpSeqNumCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpSeqNumChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpSeqNumCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpSeqNumCounter +func (obj *patternFlowTcpSeqNum) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpSeqNumCounter value in the PatternFlowTcpSeqNum object +func (obj *patternFlowTcpSeqNum) SetIncrement(value PatternFlowTcpSeqNumCounter) PatternFlowTcpSeqNum { + obj.setChoice(PatternFlowTcpSeqNumChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpSeqNumCounter +func (obj *patternFlowTcpSeqNum) Decrement() PatternFlowTcpSeqNumCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpSeqNumChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpSeqNumCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpSeqNumCounter +func (obj *patternFlowTcpSeqNum) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpSeqNumCounter value in the PatternFlowTcpSeqNum object +func (obj *patternFlowTcpSeqNum) SetDecrement(value PatternFlowTcpSeqNumCounter) PatternFlowTcpSeqNum { + obj.setChoice(PatternFlowTcpSeqNumChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpSeqNumMetricTag +func (obj *patternFlowTcpSeqNum) MetricTags() PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpSeqNumMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter struct { + obj *patternFlowTcpSeqNum + patternFlowTcpSeqNumMetricTagSlice []PatternFlowTcpSeqNumMetricTag + fieldPtr *[]*otg.PatternFlowTcpSeqNumMetricTag +} + +func newPatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter(ptr *[]*otg.PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { + return &patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter interface { + setMsg(*patternFlowTcpSeqNum) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter + Items() []PatternFlowTcpSeqNumMetricTag + Add() PatternFlowTcpSeqNumMetricTag + Append(items ...PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter + Set(index int, newObj PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter + Clear() PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter + clearHolderSlice() PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter + appendHolderSlice(item PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter +} + +func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) setMsg(msg *patternFlowTcpSeqNum) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpSeqNumMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) Items() []PatternFlowTcpSeqNumMetricTag { + return obj.patternFlowTcpSeqNumMetricTagSlice +} + +func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) Add() PatternFlowTcpSeqNumMetricTag { + newObj := &otg.PatternFlowTcpSeqNumMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpSeqNumMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpSeqNumMetricTagSlice = append(obj.patternFlowTcpSeqNumMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) Append(items ...PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpSeqNumMetricTagSlice = append(obj.patternFlowTcpSeqNumMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) Set(index int, newObj PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpSeqNumMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) Clear() PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpSeqNumMetricTag{} + obj.patternFlowTcpSeqNumMetricTagSlice = []PatternFlowTcpSeqNumMetricTag{} + } + return obj +} +func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) clearHolderSlice() PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { + if len(obj.patternFlowTcpSeqNumMetricTagSlice) > 0 { + obj.patternFlowTcpSeqNumMetricTagSlice = []PatternFlowTcpSeqNumMetricTag{} + } + return obj +} +func (obj *patternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter) appendHolderSlice(item PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumPatternFlowTcpSeqNumMetricTagIter { + obj.patternFlowTcpSeqNumMetricTagSlice = append(obj.patternFlowTcpSeqNumMetricTagSlice, item) + return obj +} + +func (obj *patternFlowTcpSeqNum) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpSeqNumMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowTcpSeqNum) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpSeqNumChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpSeqNumChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpSeqNumChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpSeqNumChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpSeqNumChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpSeqNumChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpSeqNum") + } + } else { + intVal := otg.PatternFlowTcpSeqNum_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpSeqNum_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_seq_num_counter.go b/gosnappi/pattern_flow_tcp_seq_num_counter.go new file mode 100644 index 00000000..ad62b46b --- /dev/null +++ b/gosnappi/pattern_flow_tcp_seq_num_counter.go @@ -0,0 +1,371 @@ +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" +) + +// ***** PatternFlowTcpSeqNumCounter ***** +type patternFlowTcpSeqNumCounter struct { + validation + obj *otg.PatternFlowTcpSeqNumCounter + marshaller marshalPatternFlowTcpSeqNumCounter + unMarshaller unMarshalPatternFlowTcpSeqNumCounter +} + +func NewPatternFlowTcpSeqNumCounter() PatternFlowTcpSeqNumCounter { + obj := patternFlowTcpSeqNumCounter{obj: &otg.PatternFlowTcpSeqNumCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpSeqNumCounter) msg() *otg.PatternFlowTcpSeqNumCounter { + return obj.obj +} + +func (obj *patternFlowTcpSeqNumCounter) setMsg(msg *otg.PatternFlowTcpSeqNumCounter) PatternFlowTcpSeqNumCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpSeqNumCounter struct { + obj *patternFlowTcpSeqNumCounter +} + +type marshalPatternFlowTcpSeqNumCounter interface { + // ToProto marshals PatternFlowTcpSeqNumCounter to protobuf object *otg.PatternFlowTcpSeqNumCounter + ToProto() (*otg.PatternFlowTcpSeqNumCounter, error) + // ToPbText marshals PatternFlowTcpSeqNumCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpSeqNumCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpSeqNumCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpSeqNumCounter struct { + obj *patternFlowTcpSeqNumCounter +} + +type unMarshalPatternFlowTcpSeqNumCounter interface { + // FromProto unmarshals PatternFlowTcpSeqNumCounter from protobuf object *otg.PatternFlowTcpSeqNumCounter + FromProto(msg *otg.PatternFlowTcpSeqNumCounter) (PatternFlowTcpSeqNumCounter, error) + // FromPbText unmarshals PatternFlowTcpSeqNumCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpSeqNumCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpSeqNumCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpSeqNumCounter) Marshal() marshalPatternFlowTcpSeqNumCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpSeqNumCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpSeqNumCounter) Unmarshal() unMarshalPatternFlowTcpSeqNumCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpSeqNumCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpSeqNumCounter) ToProto() (*otg.PatternFlowTcpSeqNumCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpSeqNumCounter) FromProto(msg *otg.PatternFlowTcpSeqNumCounter) (PatternFlowTcpSeqNumCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpSeqNumCounter) 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 *unMarshalpatternFlowTcpSeqNumCounter) 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 *marshalpatternFlowTcpSeqNumCounter) 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 *unMarshalpatternFlowTcpSeqNumCounter) 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 *marshalpatternFlowTcpSeqNumCounter) 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 *unMarshalpatternFlowTcpSeqNumCounter) 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 *patternFlowTcpSeqNumCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpSeqNumCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpSeqNumCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpSeqNumCounter) Clone() (PatternFlowTcpSeqNumCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpSeqNumCounter() + 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 +} + +// PatternFlowTcpSeqNumCounter is integer counter pattern +type PatternFlowTcpSeqNumCounter interface { + Validation + // msg marshals PatternFlowTcpSeqNumCounter to protobuf object *otg.PatternFlowTcpSeqNumCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpSeqNumCounter + // setMsg unmarshals PatternFlowTcpSeqNumCounter from protobuf object *otg.PatternFlowTcpSeqNumCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpSeqNumCounter) PatternFlowTcpSeqNumCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpSeqNumCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpSeqNumCounter + // validate validates PatternFlowTcpSeqNumCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpSeqNumCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpSeqNumCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpSeqNumCounter + SetStart(value uint32) PatternFlowTcpSeqNumCounter + // HasStart checks if Start has been set in PatternFlowTcpSeqNumCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpSeqNumCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpSeqNumCounter + SetStep(value uint32) PatternFlowTcpSeqNumCounter + // HasStep checks if Step has been set in PatternFlowTcpSeqNumCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpSeqNumCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpSeqNumCounter + SetCount(value uint32) PatternFlowTcpSeqNumCounter + // HasCount checks if Count has been set in PatternFlowTcpSeqNumCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpSeqNumCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpSeqNumCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpSeqNumCounter object +func (obj *patternFlowTcpSeqNumCounter) SetStart(value uint32) PatternFlowTcpSeqNumCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpSeqNumCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpSeqNumCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpSeqNumCounter object +func (obj *patternFlowTcpSeqNumCounter) SetStep(value uint32) PatternFlowTcpSeqNumCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpSeqNumCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpSeqNumCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpSeqNumCounter object +func (obj *patternFlowTcpSeqNumCounter) SetCount(value uint32) PatternFlowTcpSeqNumCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpSeqNumCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *patternFlowTcpSeqNumCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_seq_num_metric_tag.go b/gosnappi/pattern_flow_tcp_seq_num_metric_tag.go new file mode 100644 index 00000000..89bc780f --- /dev/null +++ b/gosnappi/pattern_flow_tcp_seq_num_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpSeqNumMetricTag ***** +type patternFlowTcpSeqNumMetricTag struct { + validation + obj *otg.PatternFlowTcpSeqNumMetricTag + marshaller marshalPatternFlowTcpSeqNumMetricTag + unMarshaller unMarshalPatternFlowTcpSeqNumMetricTag +} + +func NewPatternFlowTcpSeqNumMetricTag() PatternFlowTcpSeqNumMetricTag { + obj := patternFlowTcpSeqNumMetricTag{obj: &otg.PatternFlowTcpSeqNumMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpSeqNumMetricTag) msg() *otg.PatternFlowTcpSeqNumMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpSeqNumMetricTag) setMsg(msg *otg.PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpSeqNumMetricTag struct { + obj *patternFlowTcpSeqNumMetricTag +} + +type marshalPatternFlowTcpSeqNumMetricTag interface { + // ToProto marshals PatternFlowTcpSeqNumMetricTag to protobuf object *otg.PatternFlowTcpSeqNumMetricTag + ToProto() (*otg.PatternFlowTcpSeqNumMetricTag, error) + // ToPbText marshals PatternFlowTcpSeqNumMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpSeqNumMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpSeqNumMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpSeqNumMetricTag struct { + obj *patternFlowTcpSeqNumMetricTag +} + +type unMarshalPatternFlowTcpSeqNumMetricTag interface { + // FromProto unmarshals PatternFlowTcpSeqNumMetricTag from protobuf object *otg.PatternFlowTcpSeqNumMetricTag + FromProto(msg *otg.PatternFlowTcpSeqNumMetricTag) (PatternFlowTcpSeqNumMetricTag, error) + // FromPbText unmarshals PatternFlowTcpSeqNumMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpSeqNumMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpSeqNumMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpSeqNumMetricTag) Marshal() marshalPatternFlowTcpSeqNumMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpSeqNumMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpSeqNumMetricTag) Unmarshal() unMarshalPatternFlowTcpSeqNumMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpSeqNumMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpSeqNumMetricTag) ToProto() (*otg.PatternFlowTcpSeqNumMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpSeqNumMetricTag) FromProto(msg *otg.PatternFlowTcpSeqNumMetricTag) (PatternFlowTcpSeqNumMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpSeqNumMetricTag) 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 *unMarshalpatternFlowTcpSeqNumMetricTag) 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 *marshalpatternFlowTcpSeqNumMetricTag) 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 *unMarshalpatternFlowTcpSeqNumMetricTag) 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 *marshalpatternFlowTcpSeqNumMetricTag) 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 *unMarshalpatternFlowTcpSeqNumMetricTag) 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 *patternFlowTcpSeqNumMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpSeqNumMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpSeqNumMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpSeqNumMetricTag) Clone() (PatternFlowTcpSeqNumMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpSeqNumMetricTag() + 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 +} + +// PatternFlowTcpSeqNumMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpSeqNumMetricTag interface { + Validation + // msg marshals PatternFlowTcpSeqNumMetricTag to protobuf object *otg.PatternFlowTcpSeqNumMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpSeqNumMetricTag + // setMsg unmarshals PatternFlowTcpSeqNumMetricTag from protobuf object *otg.PatternFlowTcpSeqNumMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpSeqNumMetricTag) PatternFlowTcpSeqNumMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpSeqNumMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpSeqNumMetricTag + // validate validates PatternFlowTcpSeqNumMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpSeqNumMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpSeqNumMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpSeqNumMetricTag + SetName(value string) PatternFlowTcpSeqNumMetricTag + // Offset returns uint32, set in PatternFlowTcpSeqNumMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpSeqNumMetricTag + SetOffset(value uint32) PatternFlowTcpSeqNumMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpSeqNumMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpSeqNumMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpSeqNumMetricTag + SetLength(value uint32) PatternFlowTcpSeqNumMetricTag + // HasLength checks if Length has been set in PatternFlowTcpSeqNumMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpSeqNumMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpSeqNumMetricTag object +func (obj *patternFlowTcpSeqNumMetricTag) SetName(value string) PatternFlowTcpSeqNumMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpSeqNumMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpSeqNumMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpSeqNumMetricTag object +func (obj *patternFlowTcpSeqNumMetricTag) SetOffset(value uint32) PatternFlowTcpSeqNumMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpSeqNumMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpSeqNumMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpSeqNumMetricTag object +func (obj *patternFlowTcpSeqNumMetricTag) SetLength(value uint32) PatternFlowTcpSeqNumMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpSeqNumMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpSeqNumMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 31 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpSeqNumMetricTag.Offset <= 31 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpSeqNumMetricTag.Length <= 32 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpSeqNumMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(32) + } + +} diff --git a/gosnappi/pattern_flow_tcp_src_port.go b/gosnappi/pattern_flow_tcp_src_port.go new file mode 100644 index 00000000..011e0a7f --- /dev/null +++ b/gosnappi/pattern_flow_tcp_src_port.go @@ -0,0 +1,719 @@ +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" +) + +// ***** PatternFlowTcpSrcPort ***** +type patternFlowTcpSrcPort struct { + validation + obj *otg.PatternFlowTcpSrcPort + marshaller marshalPatternFlowTcpSrcPort + unMarshaller unMarshalPatternFlowTcpSrcPort + incrementHolder PatternFlowTcpSrcPortCounter + decrementHolder PatternFlowTcpSrcPortCounter + metricTagsHolder PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter + randomHolder PatternFlowTcpSrcPortRandom +} + +func NewPatternFlowTcpSrcPort() PatternFlowTcpSrcPort { + obj := patternFlowTcpSrcPort{obj: &otg.PatternFlowTcpSrcPort{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpSrcPort) msg() *otg.PatternFlowTcpSrcPort { + return obj.obj +} + +func (obj *patternFlowTcpSrcPort) setMsg(msg *otg.PatternFlowTcpSrcPort) PatternFlowTcpSrcPort { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpSrcPort struct { + obj *patternFlowTcpSrcPort +} + +type marshalPatternFlowTcpSrcPort interface { + // ToProto marshals PatternFlowTcpSrcPort to protobuf object *otg.PatternFlowTcpSrcPort + ToProto() (*otg.PatternFlowTcpSrcPort, error) + // ToPbText marshals PatternFlowTcpSrcPort to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpSrcPort to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpSrcPort to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpSrcPort struct { + obj *patternFlowTcpSrcPort +} + +type unMarshalPatternFlowTcpSrcPort interface { + // FromProto unmarshals PatternFlowTcpSrcPort from protobuf object *otg.PatternFlowTcpSrcPort + FromProto(msg *otg.PatternFlowTcpSrcPort) (PatternFlowTcpSrcPort, error) + // FromPbText unmarshals PatternFlowTcpSrcPort from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpSrcPort from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpSrcPort from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpSrcPort) Marshal() marshalPatternFlowTcpSrcPort { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpSrcPort{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpSrcPort) Unmarshal() unMarshalPatternFlowTcpSrcPort { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpSrcPort{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpSrcPort) ToProto() (*otg.PatternFlowTcpSrcPort, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpSrcPort) FromProto(msg *otg.PatternFlowTcpSrcPort) (PatternFlowTcpSrcPort, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpSrcPort) 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 *unMarshalpatternFlowTcpSrcPort) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpSrcPort) 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 *unMarshalpatternFlowTcpSrcPort) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpSrcPort) 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 *unMarshalpatternFlowTcpSrcPort) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpSrcPort) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpSrcPort) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpSrcPort) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpSrcPort) Clone() (PatternFlowTcpSrcPort, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpSrcPort() + 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 +} + +func (obj *patternFlowTcpSrcPort) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.randomHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpSrcPort is source port +type PatternFlowTcpSrcPort interface { + Validation + // msg marshals PatternFlowTcpSrcPort to protobuf object *otg.PatternFlowTcpSrcPort + // and doesn't set defaults + msg() *otg.PatternFlowTcpSrcPort + // setMsg unmarshals PatternFlowTcpSrcPort from protobuf object *otg.PatternFlowTcpSrcPort + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpSrcPort) PatternFlowTcpSrcPort + // provides marshal interface + Marshal() marshalPatternFlowTcpSrcPort + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpSrcPort + // validate validates PatternFlowTcpSrcPort + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpSrcPort, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpSrcPortChoiceEnum, set in PatternFlowTcpSrcPort + Choice() PatternFlowTcpSrcPortChoiceEnum + // setChoice assigns PatternFlowTcpSrcPortChoiceEnum provided by user to PatternFlowTcpSrcPort + setChoice(value PatternFlowTcpSrcPortChoiceEnum) PatternFlowTcpSrcPort + // HasChoice checks if Choice has been set in PatternFlowTcpSrcPort + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpSrcPort. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpSrcPort + SetValue(value uint32) PatternFlowTcpSrcPort + // HasValue checks if Value has been set in PatternFlowTcpSrcPort + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpSrcPort. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpSrcPort + SetValues(value []uint32) PatternFlowTcpSrcPort + // Increment returns PatternFlowTcpSrcPortCounter, set in PatternFlowTcpSrcPort. + // PatternFlowTcpSrcPortCounter is integer counter pattern + Increment() PatternFlowTcpSrcPortCounter + // SetIncrement assigns PatternFlowTcpSrcPortCounter provided by user to PatternFlowTcpSrcPort. + // PatternFlowTcpSrcPortCounter is integer counter pattern + SetIncrement(value PatternFlowTcpSrcPortCounter) PatternFlowTcpSrcPort + // HasIncrement checks if Increment has been set in PatternFlowTcpSrcPort + HasIncrement() bool + // Decrement returns PatternFlowTcpSrcPortCounter, set in PatternFlowTcpSrcPort. + // PatternFlowTcpSrcPortCounter is integer counter pattern + Decrement() PatternFlowTcpSrcPortCounter + // SetDecrement assigns PatternFlowTcpSrcPortCounter provided by user to PatternFlowTcpSrcPort. + // PatternFlowTcpSrcPortCounter is integer counter pattern + SetDecrement(value PatternFlowTcpSrcPortCounter) PatternFlowTcpSrcPort + // HasDecrement checks if Decrement has been set in PatternFlowTcpSrcPort + HasDecrement() bool + // MetricTags returns PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIterIter, set in PatternFlowTcpSrcPort + MetricTags() PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter + // Random returns PatternFlowTcpSrcPortRandom, set in PatternFlowTcpSrcPort. + // PatternFlowTcpSrcPortRandom is integer random pattern + Random() PatternFlowTcpSrcPortRandom + // SetRandom assigns PatternFlowTcpSrcPortRandom provided by user to PatternFlowTcpSrcPort. + // PatternFlowTcpSrcPortRandom is integer random pattern + SetRandom(value PatternFlowTcpSrcPortRandom) PatternFlowTcpSrcPort + // HasRandom checks if Random has been set in PatternFlowTcpSrcPort + HasRandom() bool + setNil() +} + +type PatternFlowTcpSrcPortChoiceEnum string + +// Enum of Choice on PatternFlowTcpSrcPort +var PatternFlowTcpSrcPortChoice = struct { + VALUE PatternFlowTcpSrcPortChoiceEnum + VALUES PatternFlowTcpSrcPortChoiceEnum + INCREMENT PatternFlowTcpSrcPortChoiceEnum + DECREMENT PatternFlowTcpSrcPortChoiceEnum + RANDOM PatternFlowTcpSrcPortChoiceEnum +}{ + VALUE: PatternFlowTcpSrcPortChoiceEnum("value"), + VALUES: PatternFlowTcpSrcPortChoiceEnum("values"), + INCREMENT: PatternFlowTcpSrcPortChoiceEnum("increment"), + DECREMENT: PatternFlowTcpSrcPortChoiceEnum("decrement"), + RANDOM: PatternFlowTcpSrcPortChoiceEnum("random"), +} + +func (obj *patternFlowTcpSrcPort) Choice() PatternFlowTcpSrcPortChoiceEnum { + return PatternFlowTcpSrcPortChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpSrcPort) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpSrcPort) setChoice(value PatternFlowTcpSrcPortChoiceEnum) PatternFlowTcpSrcPort { + intValue, ok := otg.PatternFlowTcpSrcPort_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpSrcPortChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpSrcPort_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Random = nil + obj.randomHolder = nil + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpSrcPortChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpSrcPortChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpSrcPortChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpSrcPortCounter().msg() + } + + if value == PatternFlowTcpSrcPortChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpSrcPortCounter().msg() + } + + if value == PatternFlowTcpSrcPortChoice.RANDOM { + obj.obj.Random = NewPatternFlowTcpSrcPortRandom().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpSrcPort) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpSrcPortChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpSrcPort) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpSrcPort object +func (obj *patternFlowTcpSrcPort) SetValue(value uint32) PatternFlowTcpSrcPort { + obj.setChoice(PatternFlowTcpSrcPortChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpSrcPort) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpSrcPort object +func (obj *patternFlowTcpSrcPort) SetValues(value []uint32) PatternFlowTcpSrcPort { + obj.setChoice(PatternFlowTcpSrcPortChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpSrcPortCounter +func (obj *patternFlowTcpSrcPort) Increment() PatternFlowTcpSrcPortCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpSrcPortChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpSrcPortCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpSrcPortCounter +func (obj *patternFlowTcpSrcPort) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpSrcPortCounter value in the PatternFlowTcpSrcPort object +func (obj *patternFlowTcpSrcPort) SetIncrement(value PatternFlowTcpSrcPortCounter) PatternFlowTcpSrcPort { + obj.setChoice(PatternFlowTcpSrcPortChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpSrcPortCounter +func (obj *patternFlowTcpSrcPort) Decrement() PatternFlowTcpSrcPortCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpSrcPortChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpSrcPortCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpSrcPortCounter +func (obj *patternFlowTcpSrcPort) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpSrcPortCounter value in the PatternFlowTcpSrcPort object +func (obj *patternFlowTcpSrcPort) SetDecrement(value PatternFlowTcpSrcPortCounter) PatternFlowTcpSrcPort { + obj.setChoice(PatternFlowTcpSrcPortChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpSrcPortMetricTag +func (obj *patternFlowTcpSrcPort) MetricTags() PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpSrcPortMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter struct { + obj *patternFlowTcpSrcPort + patternFlowTcpSrcPortMetricTagSlice []PatternFlowTcpSrcPortMetricTag + fieldPtr *[]*otg.PatternFlowTcpSrcPortMetricTag +} + +func newPatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter(ptr *[]*otg.PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { + return &patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter interface { + setMsg(*patternFlowTcpSrcPort) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter + Items() []PatternFlowTcpSrcPortMetricTag + Add() PatternFlowTcpSrcPortMetricTag + Append(items ...PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter + Set(index int, newObj PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter + Clear() PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter + clearHolderSlice() PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter + appendHolderSlice(item PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter +} + +func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) setMsg(msg *patternFlowTcpSrcPort) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpSrcPortMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) Items() []PatternFlowTcpSrcPortMetricTag { + return obj.patternFlowTcpSrcPortMetricTagSlice +} + +func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) Add() PatternFlowTcpSrcPortMetricTag { + newObj := &otg.PatternFlowTcpSrcPortMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpSrcPortMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpSrcPortMetricTagSlice = append(obj.patternFlowTcpSrcPortMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) Append(items ...PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpSrcPortMetricTagSlice = append(obj.patternFlowTcpSrcPortMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) Set(index int, newObj PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpSrcPortMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) Clear() PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpSrcPortMetricTag{} + obj.patternFlowTcpSrcPortMetricTagSlice = []PatternFlowTcpSrcPortMetricTag{} + } + return obj +} +func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) clearHolderSlice() PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { + if len(obj.patternFlowTcpSrcPortMetricTagSlice) > 0 { + obj.patternFlowTcpSrcPortMetricTagSlice = []PatternFlowTcpSrcPortMetricTag{} + } + return obj +} +func (obj *patternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter) appendHolderSlice(item PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortPatternFlowTcpSrcPortMetricTagIter { + obj.patternFlowTcpSrcPortMetricTagSlice = append(obj.patternFlowTcpSrcPortMetricTagSlice, item) + return obj +} + +// description is TBD +// Random returns a PatternFlowTcpSrcPortRandom +func (obj *patternFlowTcpSrcPort) Random() PatternFlowTcpSrcPortRandom { + if obj.obj.Random == nil { + obj.setChoice(PatternFlowTcpSrcPortChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &patternFlowTcpSrcPortRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a PatternFlowTcpSrcPortRandom +func (obj *patternFlowTcpSrcPort) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the PatternFlowTcpSrcPortRandom value in the PatternFlowTcpSrcPort object +func (obj *patternFlowTcpSrcPort) SetRandom(value PatternFlowTcpSrcPortRandom) PatternFlowTcpSrcPort { + obj.setChoice(PatternFlowTcpSrcPortChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + +func (obj *patternFlowTcpSrcPort) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpSrcPort.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowTcpSrcPort.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpSrcPortMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowTcpSrcPort) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpSrcPortChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpSrcPortChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpSrcPortChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpSrcPortChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpSrcPortChoice.DECREMENT + } + + if obj.obj.Random != nil { + choices_set += 1 + choice = PatternFlowTcpSrcPortChoice.RANDOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpSrcPortChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpSrcPort") + } + } else { + intVal := otg.PatternFlowTcpSrcPort_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpSrcPort_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_src_port_counter.go b/gosnappi/pattern_flow_tcp_src_port_counter.go new file mode 100644 index 00000000..8fd9f769 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_src_port_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowTcpSrcPortCounter ***** +type patternFlowTcpSrcPortCounter struct { + validation + obj *otg.PatternFlowTcpSrcPortCounter + marshaller marshalPatternFlowTcpSrcPortCounter + unMarshaller unMarshalPatternFlowTcpSrcPortCounter +} + +func NewPatternFlowTcpSrcPortCounter() PatternFlowTcpSrcPortCounter { + obj := patternFlowTcpSrcPortCounter{obj: &otg.PatternFlowTcpSrcPortCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpSrcPortCounter) msg() *otg.PatternFlowTcpSrcPortCounter { + return obj.obj +} + +func (obj *patternFlowTcpSrcPortCounter) setMsg(msg *otg.PatternFlowTcpSrcPortCounter) PatternFlowTcpSrcPortCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpSrcPortCounter struct { + obj *patternFlowTcpSrcPortCounter +} + +type marshalPatternFlowTcpSrcPortCounter interface { + // ToProto marshals PatternFlowTcpSrcPortCounter to protobuf object *otg.PatternFlowTcpSrcPortCounter + ToProto() (*otg.PatternFlowTcpSrcPortCounter, error) + // ToPbText marshals PatternFlowTcpSrcPortCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpSrcPortCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpSrcPortCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpSrcPortCounter struct { + obj *patternFlowTcpSrcPortCounter +} + +type unMarshalPatternFlowTcpSrcPortCounter interface { + // FromProto unmarshals PatternFlowTcpSrcPortCounter from protobuf object *otg.PatternFlowTcpSrcPortCounter + FromProto(msg *otg.PatternFlowTcpSrcPortCounter) (PatternFlowTcpSrcPortCounter, error) + // FromPbText unmarshals PatternFlowTcpSrcPortCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpSrcPortCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpSrcPortCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpSrcPortCounter) Marshal() marshalPatternFlowTcpSrcPortCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpSrcPortCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpSrcPortCounter) Unmarshal() unMarshalPatternFlowTcpSrcPortCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpSrcPortCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpSrcPortCounter) ToProto() (*otg.PatternFlowTcpSrcPortCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpSrcPortCounter) FromProto(msg *otg.PatternFlowTcpSrcPortCounter) (PatternFlowTcpSrcPortCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpSrcPortCounter) 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 *unMarshalpatternFlowTcpSrcPortCounter) 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 *marshalpatternFlowTcpSrcPortCounter) 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 *unMarshalpatternFlowTcpSrcPortCounter) 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 *marshalpatternFlowTcpSrcPortCounter) 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 *unMarshalpatternFlowTcpSrcPortCounter) 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 *patternFlowTcpSrcPortCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpSrcPortCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpSrcPortCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpSrcPortCounter) Clone() (PatternFlowTcpSrcPortCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpSrcPortCounter() + 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 +} + +// PatternFlowTcpSrcPortCounter is integer counter pattern +type PatternFlowTcpSrcPortCounter interface { + Validation + // msg marshals PatternFlowTcpSrcPortCounter to protobuf object *otg.PatternFlowTcpSrcPortCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpSrcPortCounter + // setMsg unmarshals PatternFlowTcpSrcPortCounter from protobuf object *otg.PatternFlowTcpSrcPortCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpSrcPortCounter) PatternFlowTcpSrcPortCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpSrcPortCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpSrcPortCounter + // validate validates PatternFlowTcpSrcPortCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpSrcPortCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpSrcPortCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpSrcPortCounter + SetStart(value uint32) PatternFlowTcpSrcPortCounter + // HasStart checks if Start has been set in PatternFlowTcpSrcPortCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpSrcPortCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpSrcPortCounter + SetStep(value uint32) PatternFlowTcpSrcPortCounter + // HasStep checks if Step has been set in PatternFlowTcpSrcPortCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpSrcPortCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpSrcPortCounter + SetCount(value uint32) PatternFlowTcpSrcPortCounter + // HasCount checks if Count has been set in PatternFlowTcpSrcPortCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpSrcPortCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpSrcPortCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpSrcPortCounter object +func (obj *patternFlowTcpSrcPortCounter) SetStart(value uint32) PatternFlowTcpSrcPortCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpSrcPortCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpSrcPortCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpSrcPortCounter object +func (obj *patternFlowTcpSrcPortCounter) SetStep(value uint32) PatternFlowTcpSrcPortCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpSrcPortCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpSrcPortCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpSrcPortCounter object +func (obj *patternFlowTcpSrcPortCounter) SetCount(value uint32) PatternFlowTcpSrcPortCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpSrcPortCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpSrcPortCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpSrcPortCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpSrcPortCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowTcpSrcPortCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_src_port_metric_tag.go b/gosnappi/pattern_flow_tcp_src_port_metric_tag.go new file mode 100644 index 00000000..c149e3a3 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_src_port_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpSrcPortMetricTag ***** +type patternFlowTcpSrcPortMetricTag struct { + validation + obj *otg.PatternFlowTcpSrcPortMetricTag + marshaller marshalPatternFlowTcpSrcPortMetricTag + unMarshaller unMarshalPatternFlowTcpSrcPortMetricTag +} + +func NewPatternFlowTcpSrcPortMetricTag() PatternFlowTcpSrcPortMetricTag { + obj := patternFlowTcpSrcPortMetricTag{obj: &otg.PatternFlowTcpSrcPortMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpSrcPortMetricTag) msg() *otg.PatternFlowTcpSrcPortMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpSrcPortMetricTag) setMsg(msg *otg.PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpSrcPortMetricTag struct { + obj *patternFlowTcpSrcPortMetricTag +} + +type marshalPatternFlowTcpSrcPortMetricTag interface { + // ToProto marshals PatternFlowTcpSrcPortMetricTag to protobuf object *otg.PatternFlowTcpSrcPortMetricTag + ToProto() (*otg.PatternFlowTcpSrcPortMetricTag, error) + // ToPbText marshals PatternFlowTcpSrcPortMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpSrcPortMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpSrcPortMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpSrcPortMetricTag struct { + obj *patternFlowTcpSrcPortMetricTag +} + +type unMarshalPatternFlowTcpSrcPortMetricTag interface { + // FromProto unmarshals PatternFlowTcpSrcPortMetricTag from protobuf object *otg.PatternFlowTcpSrcPortMetricTag + FromProto(msg *otg.PatternFlowTcpSrcPortMetricTag) (PatternFlowTcpSrcPortMetricTag, error) + // FromPbText unmarshals PatternFlowTcpSrcPortMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpSrcPortMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpSrcPortMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpSrcPortMetricTag) Marshal() marshalPatternFlowTcpSrcPortMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpSrcPortMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpSrcPortMetricTag) Unmarshal() unMarshalPatternFlowTcpSrcPortMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpSrcPortMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpSrcPortMetricTag) ToProto() (*otg.PatternFlowTcpSrcPortMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpSrcPortMetricTag) FromProto(msg *otg.PatternFlowTcpSrcPortMetricTag) (PatternFlowTcpSrcPortMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpSrcPortMetricTag) 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 *unMarshalpatternFlowTcpSrcPortMetricTag) 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 *marshalpatternFlowTcpSrcPortMetricTag) 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 *unMarshalpatternFlowTcpSrcPortMetricTag) 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 *marshalpatternFlowTcpSrcPortMetricTag) 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 *unMarshalpatternFlowTcpSrcPortMetricTag) 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 *patternFlowTcpSrcPortMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpSrcPortMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpSrcPortMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpSrcPortMetricTag) Clone() (PatternFlowTcpSrcPortMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpSrcPortMetricTag() + 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 +} + +// PatternFlowTcpSrcPortMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpSrcPortMetricTag interface { + Validation + // msg marshals PatternFlowTcpSrcPortMetricTag to protobuf object *otg.PatternFlowTcpSrcPortMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpSrcPortMetricTag + // setMsg unmarshals PatternFlowTcpSrcPortMetricTag from protobuf object *otg.PatternFlowTcpSrcPortMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpSrcPortMetricTag) PatternFlowTcpSrcPortMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpSrcPortMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpSrcPortMetricTag + // validate validates PatternFlowTcpSrcPortMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpSrcPortMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpSrcPortMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpSrcPortMetricTag + SetName(value string) PatternFlowTcpSrcPortMetricTag + // Offset returns uint32, set in PatternFlowTcpSrcPortMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpSrcPortMetricTag + SetOffset(value uint32) PatternFlowTcpSrcPortMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpSrcPortMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpSrcPortMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpSrcPortMetricTag + SetLength(value uint32) PatternFlowTcpSrcPortMetricTag + // HasLength checks if Length has been set in PatternFlowTcpSrcPortMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpSrcPortMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpSrcPortMetricTag object +func (obj *patternFlowTcpSrcPortMetricTag) SetName(value string) PatternFlowTcpSrcPortMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpSrcPortMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpSrcPortMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpSrcPortMetricTag object +func (obj *patternFlowTcpSrcPortMetricTag) SetOffset(value uint32) PatternFlowTcpSrcPortMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpSrcPortMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpSrcPortMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpSrcPortMetricTag object +func (obj *patternFlowTcpSrcPortMetricTag) SetLength(value uint32) PatternFlowTcpSrcPortMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpSrcPortMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpSrcPortMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpSrcPortMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpSrcPortMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpSrcPortMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_tcp_src_port_random.go b/gosnappi/pattern_flow_tcp_src_port_random.go new file mode 100644 index 00000000..a3bf88a1 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_src_port_random.go @@ -0,0 +1,422 @@ +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" +) + +// ***** PatternFlowTcpSrcPortRandom ***** +type patternFlowTcpSrcPortRandom struct { + validation + obj *otg.PatternFlowTcpSrcPortRandom + marshaller marshalPatternFlowTcpSrcPortRandom + unMarshaller unMarshalPatternFlowTcpSrcPortRandom +} + +func NewPatternFlowTcpSrcPortRandom() PatternFlowTcpSrcPortRandom { + obj := patternFlowTcpSrcPortRandom{obj: &otg.PatternFlowTcpSrcPortRandom{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpSrcPortRandom) msg() *otg.PatternFlowTcpSrcPortRandom { + return obj.obj +} + +func (obj *patternFlowTcpSrcPortRandom) setMsg(msg *otg.PatternFlowTcpSrcPortRandom) PatternFlowTcpSrcPortRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpSrcPortRandom struct { + obj *patternFlowTcpSrcPortRandom +} + +type marshalPatternFlowTcpSrcPortRandom interface { + // ToProto marshals PatternFlowTcpSrcPortRandom to protobuf object *otg.PatternFlowTcpSrcPortRandom + ToProto() (*otg.PatternFlowTcpSrcPortRandom, error) + // ToPbText marshals PatternFlowTcpSrcPortRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpSrcPortRandom to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpSrcPortRandom to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpSrcPortRandom struct { + obj *patternFlowTcpSrcPortRandom +} + +type unMarshalPatternFlowTcpSrcPortRandom interface { + // FromProto unmarshals PatternFlowTcpSrcPortRandom from protobuf object *otg.PatternFlowTcpSrcPortRandom + FromProto(msg *otg.PatternFlowTcpSrcPortRandom) (PatternFlowTcpSrcPortRandom, error) + // FromPbText unmarshals PatternFlowTcpSrcPortRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpSrcPortRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpSrcPortRandom from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpSrcPortRandom) Marshal() marshalPatternFlowTcpSrcPortRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpSrcPortRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpSrcPortRandom) Unmarshal() unMarshalPatternFlowTcpSrcPortRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpSrcPortRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpSrcPortRandom) ToProto() (*otg.PatternFlowTcpSrcPortRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpSrcPortRandom) FromProto(msg *otg.PatternFlowTcpSrcPortRandom) (PatternFlowTcpSrcPortRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpSrcPortRandom) 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 *unMarshalpatternFlowTcpSrcPortRandom) 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 *marshalpatternFlowTcpSrcPortRandom) 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 *unMarshalpatternFlowTcpSrcPortRandom) 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 *marshalpatternFlowTcpSrcPortRandom) 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 *unMarshalpatternFlowTcpSrcPortRandom) 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 *patternFlowTcpSrcPortRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpSrcPortRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpSrcPortRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpSrcPortRandom) Clone() (PatternFlowTcpSrcPortRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpSrcPortRandom() + 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 +} + +// PatternFlowTcpSrcPortRandom is integer random pattern +type PatternFlowTcpSrcPortRandom interface { + Validation + // msg marshals PatternFlowTcpSrcPortRandom to protobuf object *otg.PatternFlowTcpSrcPortRandom + // and doesn't set defaults + msg() *otg.PatternFlowTcpSrcPortRandom + // setMsg unmarshals PatternFlowTcpSrcPortRandom from protobuf object *otg.PatternFlowTcpSrcPortRandom + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpSrcPortRandom) PatternFlowTcpSrcPortRandom + // provides marshal interface + Marshal() marshalPatternFlowTcpSrcPortRandom + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpSrcPortRandom + // validate validates PatternFlowTcpSrcPortRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpSrcPortRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns uint32, set in PatternFlowTcpSrcPortRandom. + Min() uint32 + // SetMin assigns uint32 provided by user to PatternFlowTcpSrcPortRandom + SetMin(value uint32) PatternFlowTcpSrcPortRandom + // HasMin checks if Min has been set in PatternFlowTcpSrcPortRandom + HasMin() bool + // Max returns uint32, set in PatternFlowTcpSrcPortRandom. + Max() uint32 + // SetMax assigns uint32 provided by user to PatternFlowTcpSrcPortRandom + SetMax(value uint32) PatternFlowTcpSrcPortRandom + // HasMax checks if Max has been set in PatternFlowTcpSrcPortRandom + HasMax() bool + // Seed returns uint32, set in PatternFlowTcpSrcPortRandom. + Seed() uint32 + // SetSeed assigns uint32 provided by user to PatternFlowTcpSrcPortRandom + SetSeed(value uint32) PatternFlowTcpSrcPortRandom + // HasSeed checks if Seed has been set in PatternFlowTcpSrcPortRandom + HasSeed() bool + // Count returns uint32, set in PatternFlowTcpSrcPortRandom. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpSrcPortRandom + SetCount(value uint32) PatternFlowTcpSrcPortRandom + // HasCount checks if Count has been set in PatternFlowTcpSrcPortRandom + HasCount() bool +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) Min() uint32 { + + return *obj.obj.Min + +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// The minimum possible value generated by the random value generator. +// SetMin sets the uint32 value in the PatternFlowTcpSrcPortRandom object +func (obj *patternFlowTcpSrcPortRandom) SetMin(value uint32) PatternFlowTcpSrcPortRandom { + + obj.obj.Min = &value + return obj +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) Max() uint32 { + + return *obj.obj.Max + +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// The maximum possible value generated by the random value generator. +// SetMax sets the uint32 value in the PatternFlowTcpSrcPortRandom object +func (obj *patternFlowTcpSrcPortRandom) SetMax(value uint32) PatternFlowTcpSrcPortRandom { + + obj.obj.Max = &value + return obj +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) Seed() uint32 { + + return *obj.obj.Seed + +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) HasSeed() bool { + return obj.obj.Seed != nil +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// SetSeed sets the uint32 value in the PatternFlowTcpSrcPortRandom object +func (obj *patternFlowTcpSrcPortRandom) SetSeed(value uint32) PatternFlowTcpSrcPortRandom { + + obj.obj.Seed = &value + return obj +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowTcpSrcPortRandom) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of values to be generated by the random value generator. +// SetCount sets the uint32 value in the PatternFlowTcpSrcPortRandom object +func (obj *patternFlowTcpSrcPortRandom) SetCount(value uint32) PatternFlowTcpSrcPortRandom { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpSrcPortRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Min != nil { + + if *obj.obj.Min > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpSrcPortRandom.Min <= 65535 but Got %d", *obj.obj.Min)) + } + + } + + if obj.obj.Max != nil { + + if *obj.obj.Max > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpSrcPortRandom.Max <= 65535 but Got %d", *obj.obj.Max)) + } + + } + +} + +func (obj *patternFlowTcpSrcPortRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin(0) + } + if obj.obj.Max == nil { + obj.SetMax(65535) + } + if obj.obj.Seed == nil { + obj.SetSeed(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_window.go b/gosnappi/pattern_flow_tcp_window.go new file mode 100644 index 00000000..dc32a439 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_window.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowTcpWindow ***** +type patternFlowTcpWindow struct { + validation + obj *otg.PatternFlowTcpWindow + marshaller marshalPatternFlowTcpWindow + unMarshaller unMarshalPatternFlowTcpWindow + incrementHolder PatternFlowTcpWindowCounter + decrementHolder PatternFlowTcpWindowCounter + metricTagsHolder PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter +} + +func NewPatternFlowTcpWindow() PatternFlowTcpWindow { + obj := patternFlowTcpWindow{obj: &otg.PatternFlowTcpWindow{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpWindow) msg() *otg.PatternFlowTcpWindow { + return obj.obj +} + +func (obj *patternFlowTcpWindow) setMsg(msg *otg.PatternFlowTcpWindow) PatternFlowTcpWindow { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpWindow struct { + obj *patternFlowTcpWindow +} + +type marshalPatternFlowTcpWindow interface { + // ToProto marshals PatternFlowTcpWindow to protobuf object *otg.PatternFlowTcpWindow + ToProto() (*otg.PatternFlowTcpWindow, error) + // ToPbText marshals PatternFlowTcpWindow to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpWindow to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpWindow to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpWindow struct { + obj *patternFlowTcpWindow +} + +type unMarshalPatternFlowTcpWindow interface { + // FromProto unmarshals PatternFlowTcpWindow from protobuf object *otg.PatternFlowTcpWindow + FromProto(msg *otg.PatternFlowTcpWindow) (PatternFlowTcpWindow, error) + // FromPbText unmarshals PatternFlowTcpWindow from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpWindow from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpWindow from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpWindow) Marshal() marshalPatternFlowTcpWindow { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpWindow{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpWindow) Unmarshal() unMarshalPatternFlowTcpWindow { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpWindow{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpWindow) ToProto() (*otg.PatternFlowTcpWindow, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpWindow) FromProto(msg *otg.PatternFlowTcpWindow) (PatternFlowTcpWindow, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpWindow) 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 *unMarshalpatternFlowTcpWindow) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowTcpWindow) 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 *unMarshalpatternFlowTcpWindow) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowTcpWindow) 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 *unMarshalpatternFlowTcpWindow) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowTcpWindow) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpWindow) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpWindow) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpWindow) Clone() (PatternFlowTcpWindow, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpWindow() + 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 +} + +func (obj *patternFlowTcpWindow) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowTcpWindow is tcp connection window. +type PatternFlowTcpWindow interface { + Validation + // msg marshals PatternFlowTcpWindow to protobuf object *otg.PatternFlowTcpWindow + // and doesn't set defaults + msg() *otg.PatternFlowTcpWindow + // setMsg unmarshals PatternFlowTcpWindow from protobuf object *otg.PatternFlowTcpWindow + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpWindow) PatternFlowTcpWindow + // provides marshal interface + Marshal() marshalPatternFlowTcpWindow + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpWindow + // validate validates PatternFlowTcpWindow + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpWindow, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowTcpWindowChoiceEnum, set in PatternFlowTcpWindow + Choice() PatternFlowTcpWindowChoiceEnum + // setChoice assigns PatternFlowTcpWindowChoiceEnum provided by user to PatternFlowTcpWindow + setChoice(value PatternFlowTcpWindowChoiceEnum) PatternFlowTcpWindow + // HasChoice checks if Choice has been set in PatternFlowTcpWindow + HasChoice() bool + // Value returns uint32, set in PatternFlowTcpWindow. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowTcpWindow + SetValue(value uint32) PatternFlowTcpWindow + // HasValue checks if Value has been set in PatternFlowTcpWindow + HasValue() bool + // Values returns []uint32, set in PatternFlowTcpWindow. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowTcpWindow + SetValues(value []uint32) PatternFlowTcpWindow + // Increment returns PatternFlowTcpWindowCounter, set in PatternFlowTcpWindow. + // PatternFlowTcpWindowCounter is integer counter pattern + Increment() PatternFlowTcpWindowCounter + // SetIncrement assigns PatternFlowTcpWindowCounter provided by user to PatternFlowTcpWindow. + // PatternFlowTcpWindowCounter is integer counter pattern + SetIncrement(value PatternFlowTcpWindowCounter) PatternFlowTcpWindow + // HasIncrement checks if Increment has been set in PatternFlowTcpWindow + HasIncrement() bool + // Decrement returns PatternFlowTcpWindowCounter, set in PatternFlowTcpWindow. + // PatternFlowTcpWindowCounter is integer counter pattern + Decrement() PatternFlowTcpWindowCounter + // SetDecrement assigns PatternFlowTcpWindowCounter provided by user to PatternFlowTcpWindow. + // PatternFlowTcpWindowCounter is integer counter pattern + SetDecrement(value PatternFlowTcpWindowCounter) PatternFlowTcpWindow + // HasDecrement checks if Decrement has been set in PatternFlowTcpWindow + HasDecrement() bool + // MetricTags returns PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIterIter, set in PatternFlowTcpWindow + MetricTags() PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter + setNil() +} + +type PatternFlowTcpWindowChoiceEnum string + +// Enum of Choice on PatternFlowTcpWindow +var PatternFlowTcpWindowChoice = struct { + VALUE PatternFlowTcpWindowChoiceEnum + VALUES PatternFlowTcpWindowChoiceEnum + INCREMENT PatternFlowTcpWindowChoiceEnum + DECREMENT PatternFlowTcpWindowChoiceEnum +}{ + VALUE: PatternFlowTcpWindowChoiceEnum("value"), + VALUES: PatternFlowTcpWindowChoiceEnum("values"), + INCREMENT: PatternFlowTcpWindowChoiceEnum("increment"), + DECREMENT: PatternFlowTcpWindowChoiceEnum("decrement"), +} + +func (obj *patternFlowTcpWindow) Choice() PatternFlowTcpWindowChoiceEnum { + return PatternFlowTcpWindowChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowTcpWindow) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowTcpWindow) setChoice(value PatternFlowTcpWindowChoiceEnum) PatternFlowTcpWindow { + intValue, ok := otg.PatternFlowTcpWindow_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowTcpWindowChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowTcpWindow_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowTcpWindowChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowTcpWindowChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowTcpWindowChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowTcpWindowCounter().msg() + } + + if value == PatternFlowTcpWindowChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowTcpWindowCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpWindow) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowTcpWindowChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowTcpWindow) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowTcpWindow object +func (obj *patternFlowTcpWindow) SetValue(value uint32) PatternFlowTcpWindow { + obj.setChoice(PatternFlowTcpWindowChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowTcpWindow) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowTcpWindow object +func (obj *patternFlowTcpWindow) SetValues(value []uint32) PatternFlowTcpWindow { + obj.setChoice(PatternFlowTcpWindowChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowTcpWindowCounter +func (obj *patternFlowTcpWindow) Increment() PatternFlowTcpWindowCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowTcpWindowChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowTcpWindowCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowTcpWindowCounter +func (obj *patternFlowTcpWindow) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowTcpWindowCounter value in the PatternFlowTcpWindow object +func (obj *patternFlowTcpWindow) SetIncrement(value PatternFlowTcpWindowCounter) PatternFlowTcpWindow { + obj.setChoice(PatternFlowTcpWindowChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowTcpWindowCounter +func (obj *patternFlowTcpWindow) Decrement() PatternFlowTcpWindowCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowTcpWindowChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowTcpWindowCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowTcpWindowCounter +func (obj *patternFlowTcpWindow) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowTcpWindowCounter value in the PatternFlowTcpWindow object +func (obj *patternFlowTcpWindow) SetDecrement(value PatternFlowTcpWindowCounter) PatternFlowTcpWindow { + obj.setChoice(PatternFlowTcpWindowChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowTcpWindowMetricTag +func (obj *patternFlowTcpWindow) MetricTags() PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowTcpWindowMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter struct { + obj *patternFlowTcpWindow + patternFlowTcpWindowMetricTagSlice []PatternFlowTcpWindowMetricTag + fieldPtr *[]*otg.PatternFlowTcpWindowMetricTag +} + +func newPatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter(ptr *[]*otg.PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { + return &patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter interface { + setMsg(*patternFlowTcpWindow) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter + Items() []PatternFlowTcpWindowMetricTag + Add() PatternFlowTcpWindowMetricTag + Append(items ...PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter + Set(index int, newObj PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter + Clear() PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter + clearHolderSlice() PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter + appendHolderSlice(item PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter +} + +func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) setMsg(msg *patternFlowTcpWindow) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowTcpWindowMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) Items() []PatternFlowTcpWindowMetricTag { + return obj.patternFlowTcpWindowMetricTagSlice +} + +func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) Add() PatternFlowTcpWindowMetricTag { + newObj := &otg.PatternFlowTcpWindowMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowTcpWindowMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowTcpWindowMetricTagSlice = append(obj.patternFlowTcpWindowMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) Append(items ...PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowTcpWindowMetricTagSlice = append(obj.patternFlowTcpWindowMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) Set(index int, newObj PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowTcpWindowMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) Clear() PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowTcpWindowMetricTag{} + obj.patternFlowTcpWindowMetricTagSlice = []PatternFlowTcpWindowMetricTag{} + } + return obj +} +func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) clearHolderSlice() PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { + if len(obj.patternFlowTcpWindowMetricTagSlice) > 0 { + obj.patternFlowTcpWindowMetricTagSlice = []PatternFlowTcpWindowMetricTag{} + } + return obj +} +func (obj *patternFlowTcpWindowPatternFlowTcpWindowMetricTagIter) appendHolderSlice(item PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowPatternFlowTcpWindowMetricTagIter { + obj.patternFlowTcpWindowMetricTagSlice = append(obj.patternFlowTcpWindowMetricTagSlice, item) + return obj +} + +func (obj *patternFlowTcpWindow) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpWindow.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowTcpWindow.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowTcpWindowMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowTcpWindow) setDefault() { + var choices_set int = 0 + var choice PatternFlowTcpWindowChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowTcpWindowChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowTcpWindowChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowTcpWindowChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowTcpWindowChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowTcpWindowChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowTcpWindow") + } + } else { + intVal := otg.PatternFlowTcpWindow_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowTcpWindow_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_tcp_window_counter.go b/gosnappi/pattern_flow_tcp_window_counter.go new file mode 100644 index 00000000..6efdfc64 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_window_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowTcpWindowCounter ***** +type patternFlowTcpWindowCounter struct { + validation + obj *otg.PatternFlowTcpWindowCounter + marshaller marshalPatternFlowTcpWindowCounter + unMarshaller unMarshalPatternFlowTcpWindowCounter +} + +func NewPatternFlowTcpWindowCounter() PatternFlowTcpWindowCounter { + obj := patternFlowTcpWindowCounter{obj: &otg.PatternFlowTcpWindowCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpWindowCounter) msg() *otg.PatternFlowTcpWindowCounter { + return obj.obj +} + +func (obj *patternFlowTcpWindowCounter) setMsg(msg *otg.PatternFlowTcpWindowCounter) PatternFlowTcpWindowCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpWindowCounter struct { + obj *patternFlowTcpWindowCounter +} + +type marshalPatternFlowTcpWindowCounter interface { + // ToProto marshals PatternFlowTcpWindowCounter to protobuf object *otg.PatternFlowTcpWindowCounter + ToProto() (*otg.PatternFlowTcpWindowCounter, error) + // ToPbText marshals PatternFlowTcpWindowCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpWindowCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpWindowCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpWindowCounter struct { + obj *patternFlowTcpWindowCounter +} + +type unMarshalPatternFlowTcpWindowCounter interface { + // FromProto unmarshals PatternFlowTcpWindowCounter from protobuf object *otg.PatternFlowTcpWindowCounter + FromProto(msg *otg.PatternFlowTcpWindowCounter) (PatternFlowTcpWindowCounter, error) + // FromPbText unmarshals PatternFlowTcpWindowCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpWindowCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpWindowCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpWindowCounter) Marshal() marshalPatternFlowTcpWindowCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpWindowCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpWindowCounter) Unmarshal() unMarshalPatternFlowTcpWindowCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpWindowCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpWindowCounter) ToProto() (*otg.PatternFlowTcpWindowCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpWindowCounter) FromProto(msg *otg.PatternFlowTcpWindowCounter) (PatternFlowTcpWindowCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpWindowCounter) 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 *unMarshalpatternFlowTcpWindowCounter) 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 *marshalpatternFlowTcpWindowCounter) 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 *unMarshalpatternFlowTcpWindowCounter) 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 *marshalpatternFlowTcpWindowCounter) 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 *unMarshalpatternFlowTcpWindowCounter) 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 *patternFlowTcpWindowCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpWindowCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpWindowCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpWindowCounter) Clone() (PatternFlowTcpWindowCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpWindowCounter() + 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 +} + +// PatternFlowTcpWindowCounter is integer counter pattern +type PatternFlowTcpWindowCounter interface { + Validation + // msg marshals PatternFlowTcpWindowCounter to protobuf object *otg.PatternFlowTcpWindowCounter + // and doesn't set defaults + msg() *otg.PatternFlowTcpWindowCounter + // setMsg unmarshals PatternFlowTcpWindowCounter from protobuf object *otg.PatternFlowTcpWindowCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpWindowCounter) PatternFlowTcpWindowCounter + // provides marshal interface + Marshal() marshalPatternFlowTcpWindowCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpWindowCounter + // validate validates PatternFlowTcpWindowCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpWindowCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowTcpWindowCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowTcpWindowCounter + SetStart(value uint32) PatternFlowTcpWindowCounter + // HasStart checks if Start has been set in PatternFlowTcpWindowCounter + HasStart() bool + // Step returns uint32, set in PatternFlowTcpWindowCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowTcpWindowCounter + SetStep(value uint32) PatternFlowTcpWindowCounter + // HasStep checks if Step has been set in PatternFlowTcpWindowCounter + HasStep() bool + // Count returns uint32, set in PatternFlowTcpWindowCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowTcpWindowCounter + SetCount(value uint32) PatternFlowTcpWindowCounter + // HasCount checks if Count has been set in PatternFlowTcpWindowCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpWindowCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowTcpWindowCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowTcpWindowCounter object +func (obj *patternFlowTcpWindowCounter) SetStart(value uint32) PatternFlowTcpWindowCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpWindowCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowTcpWindowCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowTcpWindowCounter object +func (obj *patternFlowTcpWindowCounter) SetStep(value uint32) PatternFlowTcpWindowCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpWindowCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowTcpWindowCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowTcpWindowCounter object +func (obj *patternFlowTcpWindowCounter) SetCount(value uint32) PatternFlowTcpWindowCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowTcpWindowCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpWindowCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpWindowCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpWindowCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowTcpWindowCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_tcp_window_metric_tag.go b/gosnappi/pattern_flow_tcp_window_metric_tag.go new file mode 100644 index 00000000..6b324fa6 --- /dev/null +++ b/gosnappi/pattern_flow_tcp_window_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowTcpWindowMetricTag ***** +type patternFlowTcpWindowMetricTag struct { + validation + obj *otg.PatternFlowTcpWindowMetricTag + marshaller marshalPatternFlowTcpWindowMetricTag + unMarshaller unMarshalPatternFlowTcpWindowMetricTag +} + +func NewPatternFlowTcpWindowMetricTag() PatternFlowTcpWindowMetricTag { + obj := patternFlowTcpWindowMetricTag{obj: &otg.PatternFlowTcpWindowMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowTcpWindowMetricTag) msg() *otg.PatternFlowTcpWindowMetricTag { + return obj.obj +} + +func (obj *patternFlowTcpWindowMetricTag) setMsg(msg *otg.PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowTcpWindowMetricTag struct { + obj *patternFlowTcpWindowMetricTag +} + +type marshalPatternFlowTcpWindowMetricTag interface { + // ToProto marshals PatternFlowTcpWindowMetricTag to protobuf object *otg.PatternFlowTcpWindowMetricTag + ToProto() (*otg.PatternFlowTcpWindowMetricTag, error) + // ToPbText marshals PatternFlowTcpWindowMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowTcpWindowMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowTcpWindowMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowTcpWindowMetricTag struct { + obj *patternFlowTcpWindowMetricTag +} + +type unMarshalPatternFlowTcpWindowMetricTag interface { + // FromProto unmarshals PatternFlowTcpWindowMetricTag from protobuf object *otg.PatternFlowTcpWindowMetricTag + FromProto(msg *otg.PatternFlowTcpWindowMetricTag) (PatternFlowTcpWindowMetricTag, error) + // FromPbText unmarshals PatternFlowTcpWindowMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowTcpWindowMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowTcpWindowMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowTcpWindowMetricTag) Marshal() marshalPatternFlowTcpWindowMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowTcpWindowMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowTcpWindowMetricTag) Unmarshal() unMarshalPatternFlowTcpWindowMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowTcpWindowMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowTcpWindowMetricTag) ToProto() (*otg.PatternFlowTcpWindowMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowTcpWindowMetricTag) FromProto(msg *otg.PatternFlowTcpWindowMetricTag) (PatternFlowTcpWindowMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowTcpWindowMetricTag) 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 *unMarshalpatternFlowTcpWindowMetricTag) 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 *marshalpatternFlowTcpWindowMetricTag) 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 *unMarshalpatternFlowTcpWindowMetricTag) 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 *marshalpatternFlowTcpWindowMetricTag) 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 *unMarshalpatternFlowTcpWindowMetricTag) 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 *patternFlowTcpWindowMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowTcpWindowMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowTcpWindowMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowTcpWindowMetricTag) Clone() (PatternFlowTcpWindowMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowTcpWindowMetricTag() + 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 +} + +// PatternFlowTcpWindowMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowTcpWindowMetricTag interface { + Validation + // msg marshals PatternFlowTcpWindowMetricTag to protobuf object *otg.PatternFlowTcpWindowMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowTcpWindowMetricTag + // setMsg unmarshals PatternFlowTcpWindowMetricTag from protobuf object *otg.PatternFlowTcpWindowMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowTcpWindowMetricTag) PatternFlowTcpWindowMetricTag + // provides marshal interface + Marshal() marshalPatternFlowTcpWindowMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowTcpWindowMetricTag + // validate validates PatternFlowTcpWindowMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowTcpWindowMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowTcpWindowMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowTcpWindowMetricTag + SetName(value string) PatternFlowTcpWindowMetricTag + // Offset returns uint32, set in PatternFlowTcpWindowMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowTcpWindowMetricTag + SetOffset(value uint32) PatternFlowTcpWindowMetricTag + // HasOffset checks if Offset has been set in PatternFlowTcpWindowMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowTcpWindowMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowTcpWindowMetricTag + SetLength(value uint32) PatternFlowTcpWindowMetricTag + // HasLength checks if Length has been set in PatternFlowTcpWindowMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowTcpWindowMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowTcpWindowMetricTag object +func (obj *patternFlowTcpWindowMetricTag) SetName(value string) PatternFlowTcpWindowMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpWindowMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowTcpWindowMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowTcpWindowMetricTag object +func (obj *patternFlowTcpWindowMetricTag) SetOffset(value uint32) PatternFlowTcpWindowMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpWindowMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowTcpWindowMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowTcpWindowMetricTag object +func (obj *patternFlowTcpWindowMetricTag) SetLength(value uint32) PatternFlowTcpWindowMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowTcpWindowMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowTcpWindowMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowTcpWindowMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowTcpWindowMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowTcpWindowMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_udp_checksum.go b/gosnappi/pattern_flow_udp_checksum.go new file mode 100644 index 00000000..dd0d7cea --- /dev/null +++ b/gosnappi/pattern_flow_udp_checksum.go @@ -0,0 +1,434 @@ +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" +) + +// ***** PatternFlowUdpChecksum ***** +type patternFlowUdpChecksum struct { + validation + obj *otg.PatternFlowUdpChecksum + marshaller marshalPatternFlowUdpChecksum + unMarshaller unMarshalPatternFlowUdpChecksum +} + +func NewPatternFlowUdpChecksum() PatternFlowUdpChecksum { + obj := patternFlowUdpChecksum{obj: &otg.PatternFlowUdpChecksum{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowUdpChecksum) msg() *otg.PatternFlowUdpChecksum { + return obj.obj +} + +func (obj *patternFlowUdpChecksum) setMsg(msg *otg.PatternFlowUdpChecksum) PatternFlowUdpChecksum { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowUdpChecksum struct { + obj *patternFlowUdpChecksum +} + +type marshalPatternFlowUdpChecksum interface { + // ToProto marshals PatternFlowUdpChecksum to protobuf object *otg.PatternFlowUdpChecksum + ToProto() (*otg.PatternFlowUdpChecksum, error) + // ToPbText marshals PatternFlowUdpChecksum to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowUdpChecksum to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowUdpChecksum to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowUdpChecksum struct { + obj *patternFlowUdpChecksum +} + +type unMarshalPatternFlowUdpChecksum interface { + // FromProto unmarshals PatternFlowUdpChecksum from protobuf object *otg.PatternFlowUdpChecksum + FromProto(msg *otg.PatternFlowUdpChecksum) (PatternFlowUdpChecksum, error) + // FromPbText unmarshals PatternFlowUdpChecksum from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowUdpChecksum from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowUdpChecksum from JSON text + FromJson(value string) error +} + +func (obj *patternFlowUdpChecksum) Marshal() marshalPatternFlowUdpChecksum { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowUdpChecksum{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowUdpChecksum) Unmarshal() unMarshalPatternFlowUdpChecksum { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowUdpChecksum{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowUdpChecksum) ToProto() (*otg.PatternFlowUdpChecksum, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowUdpChecksum) FromProto(msg *otg.PatternFlowUdpChecksum) (PatternFlowUdpChecksum, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowUdpChecksum) 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 *unMarshalpatternFlowUdpChecksum) 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 *marshalpatternFlowUdpChecksum) 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 *unMarshalpatternFlowUdpChecksum) 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 *marshalpatternFlowUdpChecksum) 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 *unMarshalpatternFlowUdpChecksum) 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 *patternFlowUdpChecksum) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowUdpChecksum) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowUdpChecksum) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowUdpChecksum) Clone() (PatternFlowUdpChecksum, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowUdpChecksum() + 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 +} + +// PatternFlowUdpChecksum is uDP checksum +type PatternFlowUdpChecksum interface { + Validation + // msg marshals PatternFlowUdpChecksum to protobuf object *otg.PatternFlowUdpChecksum + // and doesn't set defaults + msg() *otg.PatternFlowUdpChecksum + // setMsg unmarshals PatternFlowUdpChecksum from protobuf object *otg.PatternFlowUdpChecksum + // and doesn't set defaults + setMsg(*otg.PatternFlowUdpChecksum) PatternFlowUdpChecksum + // provides marshal interface + Marshal() marshalPatternFlowUdpChecksum + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowUdpChecksum + // validate validates PatternFlowUdpChecksum + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowUdpChecksum, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowUdpChecksumChoiceEnum, set in PatternFlowUdpChecksum + Choice() PatternFlowUdpChecksumChoiceEnum + // setChoice assigns PatternFlowUdpChecksumChoiceEnum provided by user to PatternFlowUdpChecksum + setChoice(value PatternFlowUdpChecksumChoiceEnum) PatternFlowUdpChecksum + // HasChoice checks if Choice has been set in PatternFlowUdpChecksum + HasChoice() bool + // Generated returns PatternFlowUdpChecksumGeneratedEnum, set in PatternFlowUdpChecksum + Generated() PatternFlowUdpChecksumGeneratedEnum + // SetGenerated assigns PatternFlowUdpChecksumGeneratedEnum provided by user to PatternFlowUdpChecksum + SetGenerated(value PatternFlowUdpChecksumGeneratedEnum) PatternFlowUdpChecksum + // HasGenerated checks if Generated has been set in PatternFlowUdpChecksum + HasGenerated() bool + // Custom returns uint32, set in PatternFlowUdpChecksum. + Custom() uint32 + // SetCustom assigns uint32 provided by user to PatternFlowUdpChecksum + SetCustom(value uint32) PatternFlowUdpChecksum + // HasCustom checks if Custom has been set in PatternFlowUdpChecksum + HasCustom() bool +} + +type PatternFlowUdpChecksumChoiceEnum string + +// Enum of Choice on PatternFlowUdpChecksum +var PatternFlowUdpChecksumChoice = struct { + GENERATED PatternFlowUdpChecksumChoiceEnum + CUSTOM PatternFlowUdpChecksumChoiceEnum +}{ + GENERATED: PatternFlowUdpChecksumChoiceEnum("generated"), + CUSTOM: PatternFlowUdpChecksumChoiceEnum("custom"), +} + +func (obj *patternFlowUdpChecksum) Choice() PatternFlowUdpChecksumChoiceEnum { + return PatternFlowUdpChecksumChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// The type of checksum +// Choice returns a string +func (obj *patternFlowUdpChecksum) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowUdpChecksum) setChoice(value PatternFlowUdpChecksumChoiceEnum) PatternFlowUdpChecksum { + intValue, ok := otg.PatternFlowUdpChecksum_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowUdpChecksumChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowUdpChecksum_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Custom = nil + obj.obj.Generated = otg.PatternFlowUdpChecksum_Generated_unspecified.Enum() + return obj +} + +type PatternFlowUdpChecksumGeneratedEnum string + +// Enum of Generated on PatternFlowUdpChecksum +var PatternFlowUdpChecksumGenerated = struct { + GOOD PatternFlowUdpChecksumGeneratedEnum + BAD PatternFlowUdpChecksumGeneratedEnum +}{ + GOOD: PatternFlowUdpChecksumGeneratedEnum("good"), + BAD: PatternFlowUdpChecksumGeneratedEnum("bad"), +} + +func (obj *patternFlowUdpChecksum) Generated() PatternFlowUdpChecksumGeneratedEnum { + return PatternFlowUdpChecksumGeneratedEnum(obj.obj.Generated.Enum().String()) +} + +// A system generated checksum value +// Generated returns a string +func (obj *patternFlowUdpChecksum) HasGenerated() bool { + return obj.obj.Generated != nil +} + +func (obj *patternFlowUdpChecksum) SetGenerated(value PatternFlowUdpChecksumGeneratedEnum) PatternFlowUdpChecksum { + intValue, ok := otg.PatternFlowUdpChecksum_Generated_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowUdpChecksumGeneratedEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowUdpChecksum_Generated_Enum(intValue) + obj.obj.Generated = &enumValue + + return obj +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowUdpChecksum) Custom() uint32 { + + if obj.obj.Custom == nil { + obj.setChoice(PatternFlowUdpChecksumChoice.CUSTOM) + } + + return *obj.obj.Custom + +} + +// A custom checksum value +// Custom returns a uint32 +func (obj *patternFlowUdpChecksum) HasCustom() bool { + return obj.obj.Custom != nil +} + +// A custom checksum value +// SetCustom sets the uint32 value in the PatternFlowUdpChecksum object +func (obj *patternFlowUdpChecksum) SetCustom(value uint32) PatternFlowUdpChecksum { + obj.setChoice(PatternFlowUdpChecksumChoice.CUSTOM) + obj.obj.Custom = &value + return obj +} + +func (obj *patternFlowUdpChecksum) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Custom != nil { + + if *obj.obj.Custom > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpChecksum.Custom <= 65535 but Got %d", *obj.obj.Custom)) + } + + } + +} + +func (obj *patternFlowUdpChecksum) setDefault() { + var choices_set int = 0 + var choice PatternFlowUdpChecksumChoiceEnum + + if obj.obj.Generated != nil && obj.obj.Generated.Number() != 0 { + choices_set += 1 + choice = PatternFlowUdpChecksumChoice.GENERATED + } + + if obj.obj.Custom != nil { + choices_set += 1 + choice = PatternFlowUdpChecksumChoice.CUSTOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowUdpChecksumChoice.GENERATED) + if obj.obj.Generated.Number() == 0 { + obj.SetGenerated(PatternFlowUdpChecksumGenerated.GOOD) + + } + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowUdpChecksum") + } + } else { + intVal := otg.PatternFlowUdpChecksum_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowUdpChecksum_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_udp_dst_port.go b/gosnappi/pattern_flow_udp_dst_port.go new file mode 100644 index 00000000..6fdce343 --- /dev/null +++ b/gosnappi/pattern_flow_udp_dst_port.go @@ -0,0 +1,719 @@ +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" +) + +// ***** PatternFlowUdpDstPort ***** +type patternFlowUdpDstPort struct { + validation + obj *otg.PatternFlowUdpDstPort + marshaller marshalPatternFlowUdpDstPort + unMarshaller unMarshalPatternFlowUdpDstPort + incrementHolder PatternFlowUdpDstPortCounter + decrementHolder PatternFlowUdpDstPortCounter + metricTagsHolder PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter + randomHolder PatternFlowUdpDstPortRandom +} + +func NewPatternFlowUdpDstPort() PatternFlowUdpDstPort { + obj := patternFlowUdpDstPort{obj: &otg.PatternFlowUdpDstPort{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowUdpDstPort) msg() *otg.PatternFlowUdpDstPort { + return obj.obj +} + +func (obj *patternFlowUdpDstPort) setMsg(msg *otg.PatternFlowUdpDstPort) PatternFlowUdpDstPort { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowUdpDstPort struct { + obj *patternFlowUdpDstPort +} + +type marshalPatternFlowUdpDstPort interface { + // ToProto marshals PatternFlowUdpDstPort to protobuf object *otg.PatternFlowUdpDstPort + ToProto() (*otg.PatternFlowUdpDstPort, error) + // ToPbText marshals PatternFlowUdpDstPort to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowUdpDstPort to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowUdpDstPort to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowUdpDstPort struct { + obj *patternFlowUdpDstPort +} + +type unMarshalPatternFlowUdpDstPort interface { + // FromProto unmarshals PatternFlowUdpDstPort from protobuf object *otg.PatternFlowUdpDstPort + FromProto(msg *otg.PatternFlowUdpDstPort) (PatternFlowUdpDstPort, error) + // FromPbText unmarshals PatternFlowUdpDstPort from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowUdpDstPort from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowUdpDstPort from JSON text + FromJson(value string) error +} + +func (obj *patternFlowUdpDstPort) Marshal() marshalPatternFlowUdpDstPort { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowUdpDstPort{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowUdpDstPort) Unmarshal() unMarshalPatternFlowUdpDstPort { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowUdpDstPort{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowUdpDstPort) ToProto() (*otg.PatternFlowUdpDstPort, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowUdpDstPort) FromProto(msg *otg.PatternFlowUdpDstPort) (PatternFlowUdpDstPort, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowUdpDstPort) 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 *unMarshalpatternFlowUdpDstPort) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowUdpDstPort) 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 *unMarshalpatternFlowUdpDstPort) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowUdpDstPort) 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 *unMarshalpatternFlowUdpDstPort) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowUdpDstPort) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowUdpDstPort) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowUdpDstPort) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowUdpDstPort) Clone() (PatternFlowUdpDstPort, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowUdpDstPort() + 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 +} + +func (obj *patternFlowUdpDstPort) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.randomHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowUdpDstPort is destination port +type PatternFlowUdpDstPort interface { + Validation + // msg marshals PatternFlowUdpDstPort to protobuf object *otg.PatternFlowUdpDstPort + // and doesn't set defaults + msg() *otg.PatternFlowUdpDstPort + // setMsg unmarshals PatternFlowUdpDstPort from protobuf object *otg.PatternFlowUdpDstPort + // and doesn't set defaults + setMsg(*otg.PatternFlowUdpDstPort) PatternFlowUdpDstPort + // provides marshal interface + Marshal() marshalPatternFlowUdpDstPort + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowUdpDstPort + // validate validates PatternFlowUdpDstPort + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowUdpDstPort, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowUdpDstPortChoiceEnum, set in PatternFlowUdpDstPort + Choice() PatternFlowUdpDstPortChoiceEnum + // setChoice assigns PatternFlowUdpDstPortChoiceEnum provided by user to PatternFlowUdpDstPort + setChoice(value PatternFlowUdpDstPortChoiceEnum) PatternFlowUdpDstPort + // HasChoice checks if Choice has been set in PatternFlowUdpDstPort + HasChoice() bool + // Value returns uint32, set in PatternFlowUdpDstPort. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowUdpDstPort + SetValue(value uint32) PatternFlowUdpDstPort + // HasValue checks if Value has been set in PatternFlowUdpDstPort + HasValue() bool + // Values returns []uint32, set in PatternFlowUdpDstPort. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowUdpDstPort + SetValues(value []uint32) PatternFlowUdpDstPort + // Increment returns PatternFlowUdpDstPortCounter, set in PatternFlowUdpDstPort. + // PatternFlowUdpDstPortCounter is integer counter pattern + Increment() PatternFlowUdpDstPortCounter + // SetIncrement assigns PatternFlowUdpDstPortCounter provided by user to PatternFlowUdpDstPort. + // PatternFlowUdpDstPortCounter is integer counter pattern + SetIncrement(value PatternFlowUdpDstPortCounter) PatternFlowUdpDstPort + // HasIncrement checks if Increment has been set in PatternFlowUdpDstPort + HasIncrement() bool + // Decrement returns PatternFlowUdpDstPortCounter, set in PatternFlowUdpDstPort. + // PatternFlowUdpDstPortCounter is integer counter pattern + Decrement() PatternFlowUdpDstPortCounter + // SetDecrement assigns PatternFlowUdpDstPortCounter provided by user to PatternFlowUdpDstPort. + // PatternFlowUdpDstPortCounter is integer counter pattern + SetDecrement(value PatternFlowUdpDstPortCounter) PatternFlowUdpDstPort + // HasDecrement checks if Decrement has been set in PatternFlowUdpDstPort + HasDecrement() bool + // MetricTags returns PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIterIter, set in PatternFlowUdpDstPort + MetricTags() PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter + // Random returns PatternFlowUdpDstPortRandom, set in PatternFlowUdpDstPort. + // PatternFlowUdpDstPortRandom is integer random pattern + Random() PatternFlowUdpDstPortRandom + // SetRandom assigns PatternFlowUdpDstPortRandom provided by user to PatternFlowUdpDstPort. + // PatternFlowUdpDstPortRandom is integer random pattern + SetRandom(value PatternFlowUdpDstPortRandom) PatternFlowUdpDstPort + // HasRandom checks if Random has been set in PatternFlowUdpDstPort + HasRandom() bool + setNil() +} + +type PatternFlowUdpDstPortChoiceEnum string + +// Enum of Choice on PatternFlowUdpDstPort +var PatternFlowUdpDstPortChoice = struct { + VALUE PatternFlowUdpDstPortChoiceEnum + VALUES PatternFlowUdpDstPortChoiceEnum + INCREMENT PatternFlowUdpDstPortChoiceEnum + DECREMENT PatternFlowUdpDstPortChoiceEnum + RANDOM PatternFlowUdpDstPortChoiceEnum +}{ + VALUE: PatternFlowUdpDstPortChoiceEnum("value"), + VALUES: PatternFlowUdpDstPortChoiceEnum("values"), + INCREMENT: PatternFlowUdpDstPortChoiceEnum("increment"), + DECREMENT: PatternFlowUdpDstPortChoiceEnum("decrement"), + RANDOM: PatternFlowUdpDstPortChoiceEnum("random"), +} + +func (obj *patternFlowUdpDstPort) Choice() PatternFlowUdpDstPortChoiceEnum { + return PatternFlowUdpDstPortChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowUdpDstPort) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowUdpDstPort) setChoice(value PatternFlowUdpDstPortChoiceEnum) PatternFlowUdpDstPort { + intValue, ok := otg.PatternFlowUdpDstPort_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowUdpDstPortChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowUdpDstPort_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Random = nil + obj.randomHolder = nil + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowUdpDstPortChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowUdpDstPortChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowUdpDstPortChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowUdpDstPortCounter().msg() + } + + if value == PatternFlowUdpDstPortChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowUdpDstPortCounter().msg() + } + + if value == PatternFlowUdpDstPortChoice.RANDOM { + obj.obj.Random = NewPatternFlowUdpDstPortRandom().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowUdpDstPort) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowUdpDstPortChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowUdpDstPort) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowUdpDstPort object +func (obj *patternFlowUdpDstPort) SetValue(value uint32) PatternFlowUdpDstPort { + obj.setChoice(PatternFlowUdpDstPortChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowUdpDstPort) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowUdpDstPort object +func (obj *patternFlowUdpDstPort) SetValues(value []uint32) PatternFlowUdpDstPort { + obj.setChoice(PatternFlowUdpDstPortChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowUdpDstPortCounter +func (obj *patternFlowUdpDstPort) Increment() PatternFlowUdpDstPortCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowUdpDstPortChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowUdpDstPortCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowUdpDstPortCounter +func (obj *patternFlowUdpDstPort) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowUdpDstPortCounter value in the PatternFlowUdpDstPort object +func (obj *patternFlowUdpDstPort) SetIncrement(value PatternFlowUdpDstPortCounter) PatternFlowUdpDstPort { + obj.setChoice(PatternFlowUdpDstPortChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowUdpDstPortCounter +func (obj *patternFlowUdpDstPort) Decrement() PatternFlowUdpDstPortCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowUdpDstPortChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowUdpDstPortCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowUdpDstPortCounter +func (obj *patternFlowUdpDstPort) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowUdpDstPortCounter value in the PatternFlowUdpDstPort object +func (obj *patternFlowUdpDstPort) SetDecrement(value PatternFlowUdpDstPortCounter) PatternFlowUdpDstPort { + obj.setChoice(PatternFlowUdpDstPortChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowUdpDstPortMetricTag +func (obj *patternFlowUdpDstPort) MetricTags() PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowUdpDstPortMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter struct { + obj *patternFlowUdpDstPort + patternFlowUdpDstPortMetricTagSlice []PatternFlowUdpDstPortMetricTag + fieldPtr *[]*otg.PatternFlowUdpDstPortMetricTag +} + +func newPatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter(ptr *[]*otg.PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { + return &patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter interface { + setMsg(*patternFlowUdpDstPort) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter + Items() []PatternFlowUdpDstPortMetricTag + Add() PatternFlowUdpDstPortMetricTag + Append(items ...PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter + Set(index int, newObj PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter + Clear() PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter + clearHolderSlice() PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter + appendHolderSlice(item PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter +} + +func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) setMsg(msg *patternFlowUdpDstPort) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowUdpDstPortMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) Items() []PatternFlowUdpDstPortMetricTag { + return obj.patternFlowUdpDstPortMetricTagSlice +} + +func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) Add() PatternFlowUdpDstPortMetricTag { + newObj := &otg.PatternFlowUdpDstPortMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowUdpDstPortMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowUdpDstPortMetricTagSlice = append(obj.patternFlowUdpDstPortMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) Append(items ...PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowUdpDstPortMetricTagSlice = append(obj.patternFlowUdpDstPortMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) Set(index int, newObj PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowUdpDstPortMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) Clear() PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowUdpDstPortMetricTag{} + obj.patternFlowUdpDstPortMetricTagSlice = []PatternFlowUdpDstPortMetricTag{} + } + return obj +} +func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) clearHolderSlice() PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { + if len(obj.patternFlowUdpDstPortMetricTagSlice) > 0 { + obj.patternFlowUdpDstPortMetricTagSlice = []PatternFlowUdpDstPortMetricTag{} + } + return obj +} +func (obj *patternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter) appendHolderSlice(item PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortPatternFlowUdpDstPortMetricTagIter { + obj.patternFlowUdpDstPortMetricTagSlice = append(obj.patternFlowUdpDstPortMetricTagSlice, item) + return obj +} + +// description is TBD +// Random returns a PatternFlowUdpDstPortRandom +func (obj *patternFlowUdpDstPort) Random() PatternFlowUdpDstPortRandom { + if obj.obj.Random == nil { + obj.setChoice(PatternFlowUdpDstPortChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &patternFlowUdpDstPortRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a PatternFlowUdpDstPortRandom +func (obj *patternFlowUdpDstPort) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the PatternFlowUdpDstPortRandom value in the PatternFlowUdpDstPort object +func (obj *patternFlowUdpDstPort) SetRandom(value PatternFlowUdpDstPortRandom) PatternFlowUdpDstPort { + obj.setChoice(PatternFlowUdpDstPortChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + +func (obj *patternFlowUdpDstPort) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpDstPort.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowUdpDstPort.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowUdpDstPortMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowUdpDstPort) setDefault() { + var choices_set int = 0 + var choice PatternFlowUdpDstPortChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowUdpDstPortChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowUdpDstPortChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowUdpDstPortChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowUdpDstPortChoice.DECREMENT + } + + if obj.obj.Random != nil { + choices_set += 1 + choice = PatternFlowUdpDstPortChoice.RANDOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowUdpDstPortChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowUdpDstPort") + } + } else { + intVal := otg.PatternFlowUdpDstPort_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowUdpDstPort_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_udp_dst_port_counter.go b/gosnappi/pattern_flow_udp_dst_port_counter.go new file mode 100644 index 00000000..51ae8aa4 --- /dev/null +++ b/gosnappi/pattern_flow_udp_dst_port_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowUdpDstPortCounter ***** +type patternFlowUdpDstPortCounter struct { + validation + obj *otg.PatternFlowUdpDstPortCounter + marshaller marshalPatternFlowUdpDstPortCounter + unMarshaller unMarshalPatternFlowUdpDstPortCounter +} + +func NewPatternFlowUdpDstPortCounter() PatternFlowUdpDstPortCounter { + obj := patternFlowUdpDstPortCounter{obj: &otg.PatternFlowUdpDstPortCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowUdpDstPortCounter) msg() *otg.PatternFlowUdpDstPortCounter { + return obj.obj +} + +func (obj *patternFlowUdpDstPortCounter) setMsg(msg *otg.PatternFlowUdpDstPortCounter) PatternFlowUdpDstPortCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowUdpDstPortCounter struct { + obj *patternFlowUdpDstPortCounter +} + +type marshalPatternFlowUdpDstPortCounter interface { + // ToProto marshals PatternFlowUdpDstPortCounter to protobuf object *otg.PatternFlowUdpDstPortCounter + ToProto() (*otg.PatternFlowUdpDstPortCounter, error) + // ToPbText marshals PatternFlowUdpDstPortCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowUdpDstPortCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowUdpDstPortCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowUdpDstPortCounter struct { + obj *patternFlowUdpDstPortCounter +} + +type unMarshalPatternFlowUdpDstPortCounter interface { + // FromProto unmarshals PatternFlowUdpDstPortCounter from protobuf object *otg.PatternFlowUdpDstPortCounter + FromProto(msg *otg.PatternFlowUdpDstPortCounter) (PatternFlowUdpDstPortCounter, error) + // FromPbText unmarshals PatternFlowUdpDstPortCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowUdpDstPortCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowUdpDstPortCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowUdpDstPortCounter) Marshal() marshalPatternFlowUdpDstPortCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowUdpDstPortCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowUdpDstPortCounter) Unmarshal() unMarshalPatternFlowUdpDstPortCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowUdpDstPortCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowUdpDstPortCounter) ToProto() (*otg.PatternFlowUdpDstPortCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowUdpDstPortCounter) FromProto(msg *otg.PatternFlowUdpDstPortCounter) (PatternFlowUdpDstPortCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowUdpDstPortCounter) 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 *unMarshalpatternFlowUdpDstPortCounter) 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 *marshalpatternFlowUdpDstPortCounter) 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 *unMarshalpatternFlowUdpDstPortCounter) 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 *marshalpatternFlowUdpDstPortCounter) 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 *unMarshalpatternFlowUdpDstPortCounter) 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 *patternFlowUdpDstPortCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowUdpDstPortCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowUdpDstPortCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowUdpDstPortCounter) Clone() (PatternFlowUdpDstPortCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowUdpDstPortCounter() + 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 +} + +// PatternFlowUdpDstPortCounter is integer counter pattern +type PatternFlowUdpDstPortCounter interface { + Validation + // msg marshals PatternFlowUdpDstPortCounter to protobuf object *otg.PatternFlowUdpDstPortCounter + // and doesn't set defaults + msg() *otg.PatternFlowUdpDstPortCounter + // setMsg unmarshals PatternFlowUdpDstPortCounter from protobuf object *otg.PatternFlowUdpDstPortCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowUdpDstPortCounter) PatternFlowUdpDstPortCounter + // provides marshal interface + Marshal() marshalPatternFlowUdpDstPortCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowUdpDstPortCounter + // validate validates PatternFlowUdpDstPortCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowUdpDstPortCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowUdpDstPortCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowUdpDstPortCounter + SetStart(value uint32) PatternFlowUdpDstPortCounter + // HasStart checks if Start has been set in PatternFlowUdpDstPortCounter + HasStart() bool + // Step returns uint32, set in PatternFlowUdpDstPortCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowUdpDstPortCounter + SetStep(value uint32) PatternFlowUdpDstPortCounter + // HasStep checks if Step has been set in PatternFlowUdpDstPortCounter + HasStep() bool + // Count returns uint32, set in PatternFlowUdpDstPortCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowUdpDstPortCounter + SetCount(value uint32) PatternFlowUdpDstPortCounter + // HasCount checks if Count has been set in PatternFlowUdpDstPortCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowUdpDstPortCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowUdpDstPortCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowUdpDstPortCounter object +func (obj *patternFlowUdpDstPortCounter) SetStart(value uint32) PatternFlowUdpDstPortCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowUdpDstPortCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowUdpDstPortCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowUdpDstPortCounter object +func (obj *patternFlowUdpDstPortCounter) SetStep(value uint32) PatternFlowUdpDstPortCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowUdpDstPortCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowUdpDstPortCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowUdpDstPortCounter object +func (obj *patternFlowUdpDstPortCounter) SetCount(value uint32) PatternFlowUdpDstPortCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowUdpDstPortCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpDstPortCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpDstPortCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpDstPortCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowUdpDstPortCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_udp_dst_port_metric_tag.go b/gosnappi/pattern_flow_udp_dst_port_metric_tag.go new file mode 100644 index 00000000..bf85fb90 --- /dev/null +++ b/gosnappi/pattern_flow_udp_dst_port_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowUdpDstPortMetricTag ***** +type patternFlowUdpDstPortMetricTag struct { + validation + obj *otg.PatternFlowUdpDstPortMetricTag + marshaller marshalPatternFlowUdpDstPortMetricTag + unMarshaller unMarshalPatternFlowUdpDstPortMetricTag +} + +func NewPatternFlowUdpDstPortMetricTag() PatternFlowUdpDstPortMetricTag { + obj := patternFlowUdpDstPortMetricTag{obj: &otg.PatternFlowUdpDstPortMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowUdpDstPortMetricTag) msg() *otg.PatternFlowUdpDstPortMetricTag { + return obj.obj +} + +func (obj *patternFlowUdpDstPortMetricTag) setMsg(msg *otg.PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowUdpDstPortMetricTag struct { + obj *patternFlowUdpDstPortMetricTag +} + +type marshalPatternFlowUdpDstPortMetricTag interface { + // ToProto marshals PatternFlowUdpDstPortMetricTag to protobuf object *otg.PatternFlowUdpDstPortMetricTag + ToProto() (*otg.PatternFlowUdpDstPortMetricTag, error) + // ToPbText marshals PatternFlowUdpDstPortMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowUdpDstPortMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowUdpDstPortMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowUdpDstPortMetricTag struct { + obj *patternFlowUdpDstPortMetricTag +} + +type unMarshalPatternFlowUdpDstPortMetricTag interface { + // FromProto unmarshals PatternFlowUdpDstPortMetricTag from protobuf object *otg.PatternFlowUdpDstPortMetricTag + FromProto(msg *otg.PatternFlowUdpDstPortMetricTag) (PatternFlowUdpDstPortMetricTag, error) + // FromPbText unmarshals PatternFlowUdpDstPortMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowUdpDstPortMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowUdpDstPortMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowUdpDstPortMetricTag) Marshal() marshalPatternFlowUdpDstPortMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowUdpDstPortMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowUdpDstPortMetricTag) Unmarshal() unMarshalPatternFlowUdpDstPortMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowUdpDstPortMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowUdpDstPortMetricTag) ToProto() (*otg.PatternFlowUdpDstPortMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowUdpDstPortMetricTag) FromProto(msg *otg.PatternFlowUdpDstPortMetricTag) (PatternFlowUdpDstPortMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowUdpDstPortMetricTag) 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 *unMarshalpatternFlowUdpDstPortMetricTag) 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 *marshalpatternFlowUdpDstPortMetricTag) 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 *unMarshalpatternFlowUdpDstPortMetricTag) 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 *marshalpatternFlowUdpDstPortMetricTag) 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 *unMarshalpatternFlowUdpDstPortMetricTag) 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 *patternFlowUdpDstPortMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowUdpDstPortMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowUdpDstPortMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowUdpDstPortMetricTag) Clone() (PatternFlowUdpDstPortMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowUdpDstPortMetricTag() + 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 +} + +// PatternFlowUdpDstPortMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowUdpDstPortMetricTag interface { + Validation + // msg marshals PatternFlowUdpDstPortMetricTag to protobuf object *otg.PatternFlowUdpDstPortMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowUdpDstPortMetricTag + // setMsg unmarshals PatternFlowUdpDstPortMetricTag from protobuf object *otg.PatternFlowUdpDstPortMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowUdpDstPortMetricTag) PatternFlowUdpDstPortMetricTag + // provides marshal interface + Marshal() marshalPatternFlowUdpDstPortMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowUdpDstPortMetricTag + // validate validates PatternFlowUdpDstPortMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowUdpDstPortMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowUdpDstPortMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowUdpDstPortMetricTag + SetName(value string) PatternFlowUdpDstPortMetricTag + // Offset returns uint32, set in PatternFlowUdpDstPortMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowUdpDstPortMetricTag + SetOffset(value uint32) PatternFlowUdpDstPortMetricTag + // HasOffset checks if Offset has been set in PatternFlowUdpDstPortMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowUdpDstPortMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowUdpDstPortMetricTag + SetLength(value uint32) PatternFlowUdpDstPortMetricTag + // HasLength checks if Length has been set in PatternFlowUdpDstPortMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowUdpDstPortMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowUdpDstPortMetricTag object +func (obj *patternFlowUdpDstPortMetricTag) SetName(value string) PatternFlowUdpDstPortMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowUdpDstPortMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowUdpDstPortMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowUdpDstPortMetricTag object +func (obj *patternFlowUdpDstPortMetricTag) SetOffset(value uint32) PatternFlowUdpDstPortMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowUdpDstPortMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowUdpDstPortMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowUdpDstPortMetricTag object +func (obj *patternFlowUdpDstPortMetricTag) SetLength(value uint32) PatternFlowUdpDstPortMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowUdpDstPortMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowUdpDstPortMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpDstPortMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowUdpDstPortMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowUdpDstPortMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_udp_dst_port_random.go b/gosnappi/pattern_flow_udp_dst_port_random.go new file mode 100644 index 00000000..bfbbd856 --- /dev/null +++ b/gosnappi/pattern_flow_udp_dst_port_random.go @@ -0,0 +1,422 @@ +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" +) + +// ***** PatternFlowUdpDstPortRandom ***** +type patternFlowUdpDstPortRandom struct { + validation + obj *otg.PatternFlowUdpDstPortRandom + marshaller marshalPatternFlowUdpDstPortRandom + unMarshaller unMarshalPatternFlowUdpDstPortRandom +} + +func NewPatternFlowUdpDstPortRandom() PatternFlowUdpDstPortRandom { + obj := patternFlowUdpDstPortRandom{obj: &otg.PatternFlowUdpDstPortRandom{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowUdpDstPortRandom) msg() *otg.PatternFlowUdpDstPortRandom { + return obj.obj +} + +func (obj *patternFlowUdpDstPortRandom) setMsg(msg *otg.PatternFlowUdpDstPortRandom) PatternFlowUdpDstPortRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowUdpDstPortRandom struct { + obj *patternFlowUdpDstPortRandom +} + +type marshalPatternFlowUdpDstPortRandom interface { + // ToProto marshals PatternFlowUdpDstPortRandom to protobuf object *otg.PatternFlowUdpDstPortRandom + ToProto() (*otg.PatternFlowUdpDstPortRandom, error) + // ToPbText marshals PatternFlowUdpDstPortRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowUdpDstPortRandom to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowUdpDstPortRandom to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowUdpDstPortRandom struct { + obj *patternFlowUdpDstPortRandom +} + +type unMarshalPatternFlowUdpDstPortRandom interface { + // FromProto unmarshals PatternFlowUdpDstPortRandom from protobuf object *otg.PatternFlowUdpDstPortRandom + FromProto(msg *otg.PatternFlowUdpDstPortRandom) (PatternFlowUdpDstPortRandom, error) + // FromPbText unmarshals PatternFlowUdpDstPortRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowUdpDstPortRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowUdpDstPortRandom from JSON text + FromJson(value string) error +} + +func (obj *patternFlowUdpDstPortRandom) Marshal() marshalPatternFlowUdpDstPortRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowUdpDstPortRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowUdpDstPortRandom) Unmarshal() unMarshalPatternFlowUdpDstPortRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowUdpDstPortRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowUdpDstPortRandom) ToProto() (*otg.PatternFlowUdpDstPortRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowUdpDstPortRandom) FromProto(msg *otg.PatternFlowUdpDstPortRandom) (PatternFlowUdpDstPortRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowUdpDstPortRandom) 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 *unMarshalpatternFlowUdpDstPortRandom) 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 *marshalpatternFlowUdpDstPortRandom) 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 *unMarshalpatternFlowUdpDstPortRandom) 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 *marshalpatternFlowUdpDstPortRandom) 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 *unMarshalpatternFlowUdpDstPortRandom) 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 *patternFlowUdpDstPortRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowUdpDstPortRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowUdpDstPortRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowUdpDstPortRandom) Clone() (PatternFlowUdpDstPortRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowUdpDstPortRandom() + 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 +} + +// PatternFlowUdpDstPortRandom is integer random pattern +type PatternFlowUdpDstPortRandom interface { + Validation + // msg marshals PatternFlowUdpDstPortRandom to protobuf object *otg.PatternFlowUdpDstPortRandom + // and doesn't set defaults + msg() *otg.PatternFlowUdpDstPortRandom + // setMsg unmarshals PatternFlowUdpDstPortRandom from protobuf object *otg.PatternFlowUdpDstPortRandom + // and doesn't set defaults + setMsg(*otg.PatternFlowUdpDstPortRandom) PatternFlowUdpDstPortRandom + // provides marshal interface + Marshal() marshalPatternFlowUdpDstPortRandom + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowUdpDstPortRandom + // validate validates PatternFlowUdpDstPortRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowUdpDstPortRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns uint32, set in PatternFlowUdpDstPortRandom. + Min() uint32 + // SetMin assigns uint32 provided by user to PatternFlowUdpDstPortRandom + SetMin(value uint32) PatternFlowUdpDstPortRandom + // HasMin checks if Min has been set in PatternFlowUdpDstPortRandom + HasMin() bool + // Max returns uint32, set in PatternFlowUdpDstPortRandom. + Max() uint32 + // SetMax assigns uint32 provided by user to PatternFlowUdpDstPortRandom + SetMax(value uint32) PatternFlowUdpDstPortRandom + // HasMax checks if Max has been set in PatternFlowUdpDstPortRandom + HasMax() bool + // Seed returns uint32, set in PatternFlowUdpDstPortRandom. + Seed() uint32 + // SetSeed assigns uint32 provided by user to PatternFlowUdpDstPortRandom + SetSeed(value uint32) PatternFlowUdpDstPortRandom + // HasSeed checks if Seed has been set in PatternFlowUdpDstPortRandom + HasSeed() bool + // Count returns uint32, set in PatternFlowUdpDstPortRandom. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowUdpDstPortRandom + SetCount(value uint32) PatternFlowUdpDstPortRandom + // HasCount checks if Count has been set in PatternFlowUdpDstPortRandom + HasCount() bool +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowUdpDstPortRandom) Min() uint32 { + + return *obj.obj.Min + +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowUdpDstPortRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// The minimum possible value generated by the random value generator. +// SetMin sets the uint32 value in the PatternFlowUdpDstPortRandom object +func (obj *patternFlowUdpDstPortRandom) SetMin(value uint32) PatternFlowUdpDstPortRandom { + + obj.obj.Min = &value + return obj +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowUdpDstPortRandom) Max() uint32 { + + return *obj.obj.Max + +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowUdpDstPortRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// The maximum possible value generated by the random value generator. +// SetMax sets the uint32 value in the PatternFlowUdpDstPortRandom object +func (obj *patternFlowUdpDstPortRandom) SetMax(value uint32) PatternFlowUdpDstPortRandom { + + obj.obj.Max = &value + return obj +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowUdpDstPortRandom) Seed() uint32 { + + return *obj.obj.Seed + +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowUdpDstPortRandom) HasSeed() bool { + return obj.obj.Seed != nil +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// SetSeed sets the uint32 value in the PatternFlowUdpDstPortRandom object +func (obj *patternFlowUdpDstPortRandom) SetSeed(value uint32) PatternFlowUdpDstPortRandom { + + obj.obj.Seed = &value + return obj +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowUdpDstPortRandom) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowUdpDstPortRandom) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of values to be generated by the random value generator. +// SetCount sets the uint32 value in the PatternFlowUdpDstPortRandom object +func (obj *patternFlowUdpDstPortRandom) SetCount(value uint32) PatternFlowUdpDstPortRandom { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowUdpDstPortRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Min != nil { + + if *obj.obj.Min > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpDstPortRandom.Min <= 65535 but Got %d", *obj.obj.Min)) + } + + } + + if obj.obj.Max != nil { + + if *obj.obj.Max > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpDstPortRandom.Max <= 65535 but Got %d", *obj.obj.Max)) + } + + } + +} + +func (obj *patternFlowUdpDstPortRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin(0) + } + if obj.obj.Max == nil { + obj.SetMax(65535) + } + if obj.obj.Seed == nil { + obj.SetSeed(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_udp_length.go b/gosnappi/pattern_flow_udp_length.go new file mode 100644 index 00000000..07facbbe --- /dev/null +++ b/gosnappi/pattern_flow_udp_length.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowUdpLength ***** +type patternFlowUdpLength struct { + validation + obj *otg.PatternFlowUdpLength + marshaller marshalPatternFlowUdpLength + unMarshaller unMarshalPatternFlowUdpLength + incrementHolder PatternFlowUdpLengthCounter + decrementHolder PatternFlowUdpLengthCounter + metricTagsHolder PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter +} + +func NewPatternFlowUdpLength() PatternFlowUdpLength { + obj := patternFlowUdpLength{obj: &otg.PatternFlowUdpLength{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowUdpLength) msg() *otg.PatternFlowUdpLength { + return obj.obj +} + +func (obj *patternFlowUdpLength) setMsg(msg *otg.PatternFlowUdpLength) PatternFlowUdpLength { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowUdpLength struct { + obj *patternFlowUdpLength +} + +type marshalPatternFlowUdpLength interface { + // ToProto marshals PatternFlowUdpLength to protobuf object *otg.PatternFlowUdpLength + ToProto() (*otg.PatternFlowUdpLength, error) + // ToPbText marshals PatternFlowUdpLength to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowUdpLength to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowUdpLength to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowUdpLength struct { + obj *patternFlowUdpLength +} + +type unMarshalPatternFlowUdpLength interface { + // FromProto unmarshals PatternFlowUdpLength from protobuf object *otg.PatternFlowUdpLength + FromProto(msg *otg.PatternFlowUdpLength) (PatternFlowUdpLength, error) + // FromPbText unmarshals PatternFlowUdpLength from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowUdpLength from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowUdpLength from JSON text + FromJson(value string) error +} + +func (obj *patternFlowUdpLength) Marshal() marshalPatternFlowUdpLength { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowUdpLength{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowUdpLength) Unmarshal() unMarshalPatternFlowUdpLength { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowUdpLength{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowUdpLength) ToProto() (*otg.PatternFlowUdpLength, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowUdpLength) FromProto(msg *otg.PatternFlowUdpLength) (PatternFlowUdpLength, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowUdpLength) 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 *unMarshalpatternFlowUdpLength) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowUdpLength) 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 *unMarshalpatternFlowUdpLength) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowUdpLength) 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 *unMarshalpatternFlowUdpLength) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowUdpLength) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowUdpLength) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowUdpLength) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowUdpLength) Clone() (PatternFlowUdpLength, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowUdpLength() + 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 +} + +func (obj *patternFlowUdpLength) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowUdpLength is length +type PatternFlowUdpLength interface { + Validation + // msg marshals PatternFlowUdpLength to protobuf object *otg.PatternFlowUdpLength + // and doesn't set defaults + msg() *otg.PatternFlowUdpLength + // setMsg unmarshals PatternFlowUdpLength from protobuf object *otg.PatternFlowUdpLength + // and doesn't set defaults + setMsg(*otg.PatternFlowUdpLength) PatternFlowUdpLength + // provides marshal interface + Marshal() marshalPatternFlowUdpLength + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowUdpLength + // validate validates PatternFlowUdpLength + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowUdpLength, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowUdpLengthChoiceEnum, set in PatternFlowUdpLength + Choice() PatternFlowUdpLengthChoiceEnum + // setChoice assigns PatternFlowUdpLengthChoiceEnum provided by user to PatternFlowUdpLength + setChoice(value PatternFlowUdpLengthChoiceEnum) PatternFlowUdpLength + // HasChoice checks if Choice has been set in PatternFlowUdpLength + HasChoice() bool + // Value returns uint32, set in PatternFlowUdpLength. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowUdpLength + SetValue(value uint32) PatternFlowUdpLength + // HasValue checks if Value has been set in PatternFlowUdpLength + HasValue() bool + // Values returns []uint32, set in PatternFlowUdpLength. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowUdpLength + SetValues(value []uint32) PatternFlowUdpLength + // Increment returns PatternFlowUdpLengthCounter, set in PatternFlowUdpLength. + // PatternFlowUdpLengthCounter is integer counter pattern + Increment() PatternFlowUdpLengthCounter + // SetIncrement assigns PatternFlowUdpLengthCounter provided by user to PatternFlowUdpLength. + // PatternFlowUdpLengthCounter is integer counter pattern + SetIncrement(value PatternFlowUdpLengthCounter) PatternFlowUdpLength + // HasIncrement checks if Increment has been set in PatternFlowUdpLength + HasIncrement() bool + // Decrement returns PatternFlowUdpLengthCounter, set in PatternFlowUdpLength. + // PatternFlowUdpLengthCounter is integer counter pattern + Decrement() PatternFlowUdpLengthCounter + // SetDecrement assigns PatternFlowUdpLengthCounter provided by user to PatternFlowUdpLength. + // PatternFlowUdpLengthCounter is integer counter pattern + SetDecrement(value PatternFlowUdpLengthCounter) PatternFlowUdpLength + // HasDecrement checks if Decrement has been set in PatternFlowUdpLength + HasDecrement() bool + // MetricTags returns PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIterIter, set in PatternFlowUdpLength + MetricTags() PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter + setNil() +} + +type PatternFlowUdpLengthChoiceEnum string + +// Enum of Choice on PatternFlowUdpLength +var PatternFlowUdpLengthChoice = struct { + VALUE PatternFlowUdpLengthChoiceEnum + VALUES PatternFlowUdpLengthChoiceEnum + INCREMENT PatternFlowUdpLengthChoiceEnum + DECREMENT PatternFlowUdpLengthChoiceEnum +}{ + VALUE: PatternFlowUdpLengthChoiceEnum("value"), + VALUES: PatternFlowUdpLengthChoiceEnum("values"), + INCREMENT: PatternFlowUdpLengthChoiceEnum("increment"), + DECREMENT: PatternFlowUdpLengthChoiceEnum("decrement"), +} + +func (obj *patternFlowUdpLength) Choice() PatternFlowUdpLengthChoiceEnum { + return PatternFlowUdpLengthChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowUdpLength) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowUdpLength) setChoice(value PatternFlowUdpLengthChoiceEnum) PatternFlowUdpLength { + intValue, ok := otg.PatternFlowUdpLength_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowUdpLengthChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowUdpLength_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowUdpLengthChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowUdpLengthChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowUdpLengthChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowUdpLengthCounter().msg() + } + + if value == PatternFlowUdpLengthChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowUdpLengthCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowUdpLength) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowUdpLengthChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowUdpLength) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowUdpLength object +func (obj *patternFlowUdpLength) SetValue(value uint32) PatternFlowUdpLength { + obj.setChoice(PatternFlowUdpLengthChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowUdpLength) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowUdpLength object +func (obj *patternFlowUdpLength) SetValues(value []uint32) PatternFlowUdpLength { + obj.setChoice(PatternFlowUdpLengthChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowUdpLengthCounter +func (obj *patternFlowUdpLength) Increment() PatternFlowUdpLengthCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowUdpLengthChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowUdpLengthCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowUdpLengthCounter +func (obj *patternFlowUdpLength) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowUdpLengthCounter value in the PatternFlowUdpLength object +func (obj *patternFlowUdpLength) SetIncrement(value PatternFlowUdpLengthCounter) PatternFlowUdpLength { + obj.setChoice(PatternFlowUdpLengthChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowUdpLengthCounter +func (obj *patternFlowUdpLength) Decrement() PatternFlowUdpLengthCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowUdpLengthChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowUdpLengthCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowUdpLengthCounter +func (obj *patternFlowUdpLength) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowUdpLengthCounter value in the PatternFlowUdpLength object +func (obj *patternFlowUdpLength) SetDecrement(value PatternFlowUdpLengthCounter) PatternFlowUdpLength { + obj.setChoice(PatternFlowUdpLengthChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowUdpLengthMetricTag +func (obj *patternFlowUdpLength) MetricTags() PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowUdpLengthMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter struct { + obj *patternFlowUdpLength + patternFlowUdpLengthMetricTagSlice []PatternFlowUdpLengthMetricTag + fieldPtr *[]*otg.PatternFlowUdpLengthMetricTag +} + +func newPatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter(ptr *[]*otg.PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { + return &patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter interface { + setMsg(*patternFlowUdpLength) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter + Items() []PatternFlowUdpLengthMetricTag + Add() PatternFlowUdpLengthMetricTag + Append(items ...PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter + Set(index int, newObj PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter + Clear() PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter + clearHolderSlice() PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter + appendHolderSlice(item PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter +} + +func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) setMsg(msg *patternFlowUdpLength) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowUdpLengthMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) Items() []PatternFlowUdpLengthMetricTag { + return obj.patternFlowUdpLengthMetricTagSlice +} + +func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) Add() PatternFlowUdpLengthMetricTag { + newObj := &otg.PatternFlowUdpLengthMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowUdpLengthMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowUdpLengthMetricTagSlice = append(obj.patternFlowUdpLengthMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) Append(items ...PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowUdpLengthMetricTagSlice = append(obj.patternFlowUdpLengthMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) Set(index int, newObj PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowUdpLengthMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) Clear() PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowUdpLengthMetricTag{} + obj.patternFlowUdpLengthMetricTagSlice = []PatternFlowUdpLengthMetricTag{} + } + return obj +} +func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) clearHolderSlice() PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { + if len(obj.patternFlowUdpLengthMetricTagSlice) > 0 { + obj.patternFlowUdpLengthMetricTagSlice = []PatternFlowUdpLengthMetricTag{} + } + return obj +} +func (obj *patternFlowUdpLengthPatternFlowUdpLengthMetricTagIter) appendHolderSlice(item PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthPatternFlowUdpLengthMetricTagIter { + obj.patternFlowUdpLengthMetricTagSlice = append(obj.patternFlowUdpLengthMetricTagSlice, item) + return obj +} + +func (obj *patternFlowUdpLength) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpLength.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowUdpLength.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowUdpLengthMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowUdpLength) setDefault() { + var choices_set int = 0 + var choice PatternFlowUdpLengthChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowUdpLengthChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowUdpLengthChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowUdpLengthChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowUdpLengthChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowUdpLengthChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowUdpLength") + } + } else { + intVal := otg.PatternFlowUdpLength_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowUdpLength_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_udp_length_counter.go b/gosnappi/pattern_flow_udp_length_counter.go new file mode 100644 index 00000000..606f2552 --- /dev/null +++ b/gosnappi/pattern_flow_udp_length_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowUdpLengthCounter ***** +type patternFlowUdpLengthCounter struct { + validation + obj *otg.PatternFlowUdpLengthCounter + marshaller marshalPatternFlowUdpLengthCounter + unMarshaller unMarshalPatternFlowUdpLengthCounter +} + +func NewPatternFlowUdpLengthCounter() PatternFlowUdpLengthCounter { + obj := patternFlowUdpLengthCounter{obj: &otg.PatternFlowUdpLengthCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowUdpLengthCounter) msg() *otg.PatternFlowUdpLengthCounter { + return obj.obj +} + +func (obj *patternFlowUdpLengthCounter) setMsg(msg *otg.PatternFlowUdpLengthCounter) PatternFlowUdpLengthCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowUdpLengthCounter struct { + obj *patternFlowUdpLengthCounter +} + +type marshalPatternFlowUdpLengthCounter interface { + // ToProto marshals PatternFlowUdpLengthCounter to protobuf object *otg.PatternFlowUdpLengthCounter + ToProto() (*otg.PatternFlowUdpLengthCounter, error) + // ToPbText marshals PatternFlowUdpLengthCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowUdpLengthCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowUdpLengthCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowUdpLengthCounter struct { + obj *patternFlowUdpLengthCounter +} + +type unMarshalPatternFlowUdpLengthCounter interface { + // FromProto unmarshals PatternFlowUdpLengthCounter from protobuf object *otg.PatternFlowUdpLengthCounter + FromProto(msg *otg.PatternFlowUdpLengthCounter) (PatternFlowUdpLengthCounter, error) + // FromPbText unmarshals PatternFlowUdpLengthCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowUdpLengthCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowUdpLengthCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowUdpLengthCounter) Marshal() marshalPatternFlowUdpLengthCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowUdpLengthCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowUdpLengthCounter) Unmarshal() unMarshalPatternFlowUdpLengthCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowUdpLengthCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowUdpLengthCounter) ToProto() (*otg.PatternFlowUdpLengthCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowUdpLengthCounter) FromProto(msg *otg.PatternFlowUdpLengthCounter) (PatternFlowUdpLengthCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowUdpLengthCounter) 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 *unMarshalpatternFlowUdpLengthCounter) 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 *marshalpatternFlowUdpLengthCounter) 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 *unMarshalpatternFlowUdpLengthCounter) 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 *marshalpatternFlowUdpLengthCounter) 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 *unMarshalpatternFlowUdpLengthCounter) 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 *patternFlowUdpLengthCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowUdpLengthCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowUdpLengthCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowUdpLengthCounter) Clone() (PatternFlowUdpLengthCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowUdpLengthCounter() + 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 +} + +// PatternFlowUdpLengthCounter is integer counter pattern +type PatternFlowUdpLengthCounter interface { + Validation + // msg marshals PatternFlowUdpLengthCounter to protobuf object *otg.PatternFlowUdpLengthCounter + // and doesn't set defaults + msg() *otg.PatternFlowUdpLengthCounter + // setMsg unmarshals PatternFlowUdpLengthCounter from protobuf object *otg.PatternFlowUdpLengthCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowUdpLengthCounter) PatternFlowUdpLengthCounter + // provides marshal interface + Marshal() marshalPatternFlowUdpLengthCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowUdpLengthCounter + // validate validates PatternFlowUdpLengthCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowUdpLengthCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowUdpLengthCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowUdpLengthCounter + SetStart(value uint32) PatternFlowUdpLengthCounter + // HasStart checks if Start has been set in PatternFlowUdpLengthCounter + HasStart() bool + // Step returns uint32, set in PatternFlowUdpLengthCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowUdpLengthCounter + SetStep(value uint32) PatternFlowUdpLengthCounter + // HasStep checks if Step has been set in PatternFlowUdpLengthCounter + HasStep() bool + // Count returns uint32, set in PatternFlowUdpLengthCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowUdpLengthCounter + SetCount(value uint32) PatternFlowUdpLengthCounter + // HasCount checks if Count has been set in PatternFlowUdpLengthCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowUdpLengthCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowUdpLengthCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowUdpLengthCounter object +func (obj *patternFlowUdpLengthCounter) SetStart(value uint32) PatternFlowUdpLengthCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowUdpLengthCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowUdpLengthCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowUdpLengthCounter object +func (obj *patternFlowUdpLengthCounter) SetStep(value uint32) PatternFlowUdpLengthCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowUdpLengthCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowUdpLengthCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowUdpLengthCounter object +func (obj *patternFlowUdpLengthCounter) SetCount(value uint32) PatternFlowUdpLengthCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowUdpLengthCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpLengthCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpLengthCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpLengthCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowUdpLengthCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_udp_length_metric_tag.go b/gosnappi/pattern_flow_udp_length_metric_tag.go new file mode 100644 index 00000000..ccaf598f --- /dev/null +++ b/gosnappi/pattern_flow_udp_length_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowUdpLengthMetricTag ***** +type patternFlowUdpLengthMetricTag struct { + validation + obj *otg.PatternFlowUdpLengthMetricTag + marshaller marshalPatternFlowUdpLengthMetricTag + unMarshaller unMarshalPatternFlowUdpLengthMetricTag +} + +func NewPatternFlowUdpLengthMetricTag() PatternFlowUdpLengthMetricTag { + obj := patternFlowUdpLengthMetricTag{obj: &otg.PatternFlowUdpLengthMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowUdpLengthMetricTag) msg() *otg.PatternFlowUdpLengthMetricTag { + return obj.obj +} + +func (obj *patternFlowUdpLengthMetricTag) setMsg(msg *otg.PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowUdpLengthMetricTag struct { + obj *patternFlowUdpLengthMetricTag +} + +type marshalPatternFlowUdpLengthMetricTag interface { + // ToProto marshals PatternFlowUdpLengthMetricTag to protobuf object *otg.PatternFlowUdpLengthMetricTag + ToProto() (*otg.PatternFlowUdpLengthMetricTag, error) + // ToPbText marshals PatternFlowUdpLengthMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowUdpLengthMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowUdpLengthMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowUdpLengthMetricTag struct { + obj *patternFlowUdpLengthMetricTag +} + +type unMarshalPatternFlowUdpLengthMetricTag interface { + // FromProto unmarshals PatternFlowUdpLengthMetricTag from protobuf object *otg.PatternFlowUdpLengthMetricTag + FromProto(msg *otg.PatternFlowUdpLengthMetricTag) (PatternFlowUdpLengthMetricTag, error) + // FromPbText unmarshals PatternFlowUdpLengthMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowUdpLengthMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowUdpLengthMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowUdpLengthMetricTag) Marshal() marshalPatternFlowUdpLengthMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowUdpLengthMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowUdpLengthMetricTag) Unmarshal() unMarshalPatternFlowUdpLengthMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowUdpLengthMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowUdpLengthMetricTag) ToProto() (*otg.PatternFlowUdpLengthMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowUdpLengthMetricTag) FromProto(msg *otg.PatternFlowUdpLengthMetricTag) (PatternFlowUdpLengthMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowUdpLengthMetricTag) 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 *unMarshalpatternFlowUdpLengthMetricTag) 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 *marshalpatternFlowUdpLengthMetricTag) 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 *unMarshalpatternFlowUdpLengthMetricTag) 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 *marshalpatternFlowUdpLengthMetricTag) 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 *unMarshalpatternFlowUdpLengthMetricTag) 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 *patternFlowUdpLengthMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowUdpLengthMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowUdpLengthMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowUdpLengthMetricTag) Clone() (PatternFlowUdpLengthMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowUdpLengthMetricTag() + 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 +} + +// PatternFlowUdpLengthMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowUdpLengthMetricTag interface { + Validation + // msg marshals PatternFlowUdpLengthMetricTag to protobuf object *otg.PatternFlowUdpLengthMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowUdpLengthMetricTag + // setMsg unmarshals PatternFlowUdpLengthMetricTag from protobuf object *otg.PatternFlowUdpLengthMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowUdpLengthMetricTag) PatternFlowUdpLengthMetricTag + // provides marshal interface + Marshal() marshalPatternFlowUdpLengthMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowUdpLengthMetricTag + // validate validates PatternFlowUdpLengthMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowUdpLengthMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowUdpLengthMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowUdpLengthMetricTag + SetName(value string) PatternFlowUdpLengthMetricTag + // Offset returns uint32, set in PatternFlowUdpLengthMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowUdpLengthMetricTag + SetOffset(value uint32) PatternFlowUdpLengthMetricTag + // HasOffset checks if Offset has been set in PatternFlowUdpLengthMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowUdpLengthMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowUdpLengthMetricTag + SetLength(value uint32) PatternFlowUdpLengthMetricTag + // HasLength checks if Length has been set in PatternFlowUdpLengthMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowUdpLengthMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowUdpLengthMetricTag object +func (obj *patternFlowUdpLengthMetricTag) SetName(value string) PatternFlowUdpLengthMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowUdpLengthMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowUdpLengthMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowUdpLengthMetricTag object +func (obj *patternFlowUdpLengthMetricTag) SetOffset(value uint32) PatternFlowUdpLengthMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowUdpLengthMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowUdpLengthMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowUdpLengthMetricTag object +func (obj *patternFlowUdpLengthMetricTag) SetLength(value uint32) PatternFlowUdpLengthMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowUdpLengthMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowUdpLengthMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpLengthMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowUdpLengthMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowUdpLengthMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_udp_src_port.go b/gosnappi/pattern_flow_udp_src_port.go new file mode 100644 index 00000000..86c04bd6 --- /dev/null +++ b/gosnappi/pattern_flow_udp_src_port.go @@ -0,0 +1,719 @@ +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" +) + +// ***** PatternFlowUdpSrcPort ***** +type patternFlowUdpSrcPort struct { + validation + obj *otg.PatternFlowUdpSrcPort + marshaller marshalPatternFlowUdpSrcPort + unMarshaller unMarshalPatternFlowUdpSrcPort + incrementHolder PatternFlowUdpSrcPortCounter + decrementHolder PatternFlowUdpSrcPortCounter + metricTagsHolder PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter + randomHolder PatternFlowUdpSrcPortRandom +} + +func NewPatternFlowUdpSrcPort() PatternFlowUdpSrcPort { + obj := patternFlowUdpSrcPort{obj: &otg.PatternFlowUdpSrcPort{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowUdpSrcPort) msg() *otg.PatternFlowUdpSrcPort { + return obj.obj +} + +func (obj *patternFlowUdpSrcPort) setMsg(msg *otg.PatternFlowUdpSrcPort) PatternFlowUdpSrcPort { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowUdpSrcPort struct { + obj *patternFlowUdpSrcPort +} + +type marshalPatternFlowUdpSrcPort interface { + // ToProto marshals PatternFlowUdpSrcPort to protobuf object *otg.PatternFlowUdpSrcPort + ToProto() (*otg.PatternFlowUdpSrcPort, error) + // ToPbText marshals PatternFlowUdpSrcPort to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowUdpSrcPort to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowUdpSrcPort to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowUdpSrcPort struct { + obj *patternFlowUdpSrcPort +} + +type unMarshalPatternFlowUdpSrcPort interface { + // FromProto unmarshals PatternFlowUdpSrcPort from protobuf object *otg.PatternFlowUdpSrcPort + FromProto(msg *otg.PatternFlowUdpSrcPort) (PatternFlowUdpSrcPort, error) + // FromPbText unmarshals PatternFlowUdpSrcPort from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowUdpSrcPort from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowUdpSrcPort from JSON text + FromJson(value string) error +} + +func (obj *patternFlowUdpSrcPort) Marshal() marshalPatternFlowUdpSrcPort { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowUdpSrcPort{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowUdpSrcPort) Unmarshal() unMarshalPatternFlowUdpSrcPort { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowUdpSrcPort{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowUdpSrcPort) ToProto() (*otg.PatternFlowUdpSrcPort, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowUdpSrcPort) FromProto(msg *otg.PatternFlowUdpSrcPort) (PatternFlowUdpSrcPort, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowUdpSrcPort) 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 *unMarshalpatternFlowUdpSrcPort) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowUdpSrcPort) 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 *unMarshalpatternFlowUdpSrcPort) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowUdpSrcPort) 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 *unMarshalpatternFlowUdpSrcPort) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowUdpSrcPort) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowUdpSrcPort) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowUdpSrcPort) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowUdpSrcPort) Clone() (PatternFlowUdpSrcPort, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowUdpSrcPort() + 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 +} + +func (obj *patternFlowUdpSrcPort) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.randomHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowUdpSrcPort is source port +type PatternFlowUdpSrcPort interface { + Validation + // msg marshals PatternFlowUdpSrcPort to protobuf object *otg.PatternFlowUdpSrcPort + // and doesn't set defaults + msg() *otg.PatternFlowUdpSrcPort + // setMsg unmarshals PatternFlowUdpSrcPort from protobuf object *otg.PatternFlowUdpSrcPort + // and doesn't set defaults + setMsg(*otg.PatternFlowUdpSrcPort) PatternFlowUdpSrcPort + // provides marshal interface + Marshal() marshalPatternFlowUdpSrcPort + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowUdpSrcPort + // validate validates PatternFlowUdpSrcPort + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowUdpSrcPort, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowUdpSrcPortChoiceEnum, set in PatternFlowUdpSrcPort + Choice() PatternFlowUdpSrcPortChoiceEnum + // setChoice assigns PatternFlowUdpSrcPortChoiceEnum provided by user to PatternFlowUdpSrcPort + setChoice(value PatternFlowUdpSrcPortChoiceEnum) PatternFlowUdpSrcPort + // HasChoice checks if Choice has been set in PatternFlowUdpSrcPort + HasChoice() bool + // Value returns uint32, set in PatternFlowUdpSrcPort. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowUdpSrcPort + SetValue(value uint32) PatternFlowUdpSrcPort + // HasValue checks if Value has been set in PatternFlowUdpSrcPort + HasValue() bool + // Values returns []uint32, set in PatternFlowUdpSrcPort. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowUdpSrcPort + SetValues(value []uint32) PatternFlowUdpSrcPort + // Increment returns PatternFlowUdpSrcPortCounter, set in PatternFlowUdpSrcPort. + // PatternFlowUdpSrcPortCounter is integer counter pattern + Increment() PatternFlowUdpSrcPortCounter + // SetIncrement assigns PatternFlowUdpSrcPortCounter provided by user to PatternFlowUdpSrcPort. + // PatternFlowUdpSrcPortCounter is integer counter pattern + SetIncrement(value PatternFlowUdpSrcPortCounter) PatternFlowUdpSrcPort + // HasIncrement checks if Increment has been set in PatternFlowUdpSrcPort + HasIncrement() bool + // Decrement returns PatternFlowUdpSrcPortCounter, set in PatternFlowUdpSrcPort. + // PatternFlowUdpSrcPortCounter is integer counter pattern + Decrement() PatternFlowUdpSrcPortCounter + // SetDecrement assigns PatternFlowUdpSrcPortCounter provided by user to PatternFlowUdpSrcPort. + // PatternFlowUdpSrcPortCounter is integer counter pattern + SetDecrement(value PatternFlowUdpSrcPortCounter) PatternFlowUdpSrcPort + // HasDecrement checks if Decrement has been set in PatternFlowUdpSrcPort + HasDecrement() bool + // MetricTags returns PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIterIter, set in PatternFlowUdpSrcPort + MetricTags() PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter + // Random returns PatternFlowUdpSrcPortRandom, set in PatternFlowUdpSrcPort. + // PatternFlowUdpSrcPortRandom is integer random pattern + Random() PatternFlowUdpSrcPortRandom + // SetRandom assigns PatternFlowUdpSrcPortRandom provided by user to PatternFlowUdpSrcPort. + // PatternFlowUdpSrcPortRandom is integer random pattern + SetRandom(value PatternFlowUdpSrcPortRandom) PatternFlowUdpSrcPort + // HasRandom checks if Random has been set in PatternFlowUdpSrcPort + HasRandom() bool + setNil() +} + +type PatternFlowUdpSrcPortChoiceEnum string + +// Enum of Choice on PatternFlowUdpSrcPort +var PatternFlowUdpSrcPortChoice = struct { + VALUE PatternFlowUdpSrcPortChoiceEnum + VALUES PatternFlowUdpSrcPortChoiceEnum + INCREMENT PatternFlowUdpSrcPortChoiceEnum + DECREMENT PatternFlowUdpSrcPortChoiceEnum + RANDOM PatternFlowUdpSrcPortChoiceEnum +}{ + VALUE: PatternFlowUdpSrcPortChoiceEnum("value"), + VALUES: PatternFlowUdpSrcPortChoiceEnum("values"), + INCREMENT: PatternFlowUdpSrcPortChoiceEnum("increment"), + DECREMENT: PatternFlowUdpSrcPortChoiceEnum("decrement"), + RANDOM: PatternFlowUdpSrcPortChoiceEnum("random"), +} + +func (obj *patternFlowUdpSrcPort) Choice() PatternFlowUdpSrcPortChoiceEnum { + return PatternFlowUdpSrcPortChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowUdpSrcPort) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowUdpSrcPort) setChoice(value PatternFlowUdpSrcPortChoiceEnum) PatternFlowUdpSrcPort { + intValue, ok := otg.PatternFlowUdpSrcPort_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowUdpSrcPortChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowUdpSrcPort_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Random = nil + obj.randomHolder = nil + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowUdpSrcPortChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowUdpSrcPortChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowUdpSrcPortChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowUdpSrcPortCounter().msg() + } + + if value == PatternFlowUdpSrcPortChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowUdpSrcPortCounter().msg() + } + + if value == PatternFlowUdpSrcPortChoice.RANDOM { + obj.obj.Random = NewPatternFlowUdpSrcPortRandom().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowUdpSrcPort) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowUdpSrcPortChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowUdpSrcPort) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowUdpSrcPort object +func (obj *patternFlowUdpSrcPort) SetValue(value uint32) PatternFlowUdpSrcPort { + obj.setChoice(PatternFlowUdpSrcPortChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowUdpSrcPort) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowUdpSrcPort object +func (obj *patternFlowUdpSrcPort) SetValues(value []uint32) PatternFlowUdpSrcPort { + obj.setChoice(PatternFlowUdpSrcPortChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowUdpSrcPortCounter +func (obj *patternFlowUdpSrcPort) Increment() PatternFlowUdpSrcPortCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowUdpSrcPortChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowUdpSrcPortCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowUdpSrcPortCounter +func (obj *patternFlowUdpSrcPort) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowUdpSrcPortCounter value in the PatternFlowUdpSrcPort object +func (obj *patternFlowUdpSrcPort) SetIncrement(value PatternFlowUdpSrcPortCounter) PatternFlowUdpSrcPort { + obj.setChoice(PatternFlowUdpSrcPortChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowUdpSrcPortCounter +func (obj *patternFlowUdpSrcPort) Decrement() PatternFlowUdpSrcPortCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowUdpSrcPortChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowUdpSrcPortCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowUdpSrcPortCounter +func (obj *patternFlowUdpSrcPort) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowUdpSrcPortCounter value in the PatternFlowUdpSrcPort object +func (obj *patternFlowUdpSrcPort) SetDecrement(value PatternFlowUdpSrcPortCounter) PatternFlowUdpSrcPort { + obj.setChoice(PatternFlowUdpSrcPortChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowUdpSrcPortMetricTag +func (obj *patternFlowUdpSrcPort) MetricTags() PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowUdpSrcPortMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter struct { + obj *patternFlowUdpSrcPort + patternFlowUdpSrcPortMetricTagSlice []PatternFlowUdpSrcPortMetricTag + fieldPtr *[]*otg.PatternFlowUdpSrcPortMetricTag +} + +func newPatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter(ptr *[]*otg.PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { + return &patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter interface { + setMsg(*patternFlowUdpSrcPort) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter + Items() []PatternFlowUdpSrcPortMetricTag + Add() PatternFlowUdpSrcPortMetricTag + Append(items ...PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter + Set(index int, newObj PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter + Clear() PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter + clearHolderSlice() PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter + appendHolderSlice(item PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter +} + +func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) setMsg(msg *patternFlowUdpSrcPort) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowUdpSrcPortMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) Items() []PatternFlowUdpSrcPortMetricTag { + return obj.patternFlowUdpSrcPortMetricTagSlice +} + +func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) Add() PatternFlowUdpSrcPortMetricTag { + newObj := &otg.PatternFlowUdpSrcPortMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowUdpSrcPortMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowUdpSrcPortMetricTagSlice = append(obj.patternFlowUdpSrcPortMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) Append(items ...PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowUdpSrcPortMetricTagSlice = append(obj.patternFlowUdpSrcPortMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) Set(index int, newObj PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowUdpSrcPortMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) Clear() PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowUdpSrcPortMetricTag{} + obj.patternFlowUdpSrcPortMetricTagSlice = []PatternFlowUdpSrcPortMetricTag{} + } + return obj +} +func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) clearHolderSlice() PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { + if len(obj.patternFlowUdpSrcPortMetricTagSlice) > 0 { + obj.patternFlowUdpSrcPortMetricTagSlice = []PatternFlowUdpSrcPortMetricTag{} + } + return obj +} +func (obj *patternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter) appendHolderSlice(item PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortPatternFlowUdpSrcPortMetricTagIter { + obj.patternFlowUdpSrcPortMetricTagSlice = append(obj.patternFlowUdpSrcPortMetricTagSlice, item) + return obj +} + +// description is TBD +// Random returns a PatternFlowUdpSrcPortRandom +func (obj *patternFlowUdpSrcPort) Random() PatternFlowUdpSrcPortRandom { + if obj.obj.Random == nil { + obj.setChoice(PatternFlowUdpSrcPortChoice.RANDOM) + } + if obj.randomHolder == nil { + obj.randomHolder = &patternFlowUdpSrcPortRandom{obj: obj.obj.Random} + } + return obj.randomHolder +} + +// description is TBD +// Random returns a PatternFlowUdpSrcPortRandom +func (obj *patternFlowUdpSrcPort) HasRandom() bool { + return obj.obj.Random != nil +} + +// description is TBD +// SetRandom sets the PatternFlowUdpSrcPortRandom value in the PatternFlowUdpSrcPort object +func (obj *patternFlowUdpSrcPort) SetRandom(value PatternFlowUdpSrcPortRandom) PatternFlowUdpSrcPort { + obj.setChoice(PatternFlowUdpSrcPortChoice.RANDOM) + obj.randomHolder = nil + obj.obj.Random = value.msg() + + return obj +} + +func (obj *patternFlowUdpSrcPort) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpSrcPort.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowUdpSrcPort.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowUdpSrcPortMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + + if obj.obj.Random != nil { + + obj.Random().validateObj(vObj, set_default) + } + +} + +func (obj *patternFlowUdpSrcPort) setDefault() { + var choices_set int = 0 + var choice PatternFlowUdpSrcPortChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowUdpSrcPortChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowUdpSrcPortChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowUdpSrcPortChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowUdpSrcPortChoice.DECREMENT + } + + if obj.obj.Random != nil { + choices_set += 1 + choice = PatternFlowUdpSrcPortChoice.RANDOM + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowUdpSrcPortChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowUdpSrcPort") + } + } else { + intVal := otg.PatternFlowUdpSrcPort_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowUdpSrcPort_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_udp_src_port_counter.go b/gosnappi/pattern_flow_udp_src_port_counter.go new file mode 100644 index 00000000..f3770157 --- /dev/null +++ b/gosnappi/pattern_flow_udp_src_port_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowUdpSrcPortCounter ***** +type patternFlowUdpSrcPortCounter struct { + validation + obj *otg.PatternFlowUdpSrcPortCounter + marshaller marshalPatternFlowUdpSrcPortCounter + unMarshaller unMarshalPatternFlowUdpSrcPortCounter +} + +func NewPatternFlowUdpSrcPortCounter() PatternFlowUdpSrcPortCounter { + obj := patternFlowUdpSrcPortCounter{obj: &otg.PatternFlowUdpSrcPortCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowUdpSrcPortCounter) msg() *otg.PatternFlowUdpSrcPortCounter { + return obj.obj +} + +func (obj *patternFlowUdpSrcPortCounter) setMsg(msg *otg.PatternFlowUdpSrcPortCounter) PatternFlowUdpSrcPortCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowUdpSrcPortCounter struct { + obj *patternFlowUdpSrcPortCounter +} + +type marshalPatternFlowUdpSrcPortCounter interface { + // ToProto marshals PatternFlowUdpSrcPortCounter to protobuf object *otg.PatternFlowUdpSrcPortCounter + ToProto() (*otg.PatternFlowUdpSrcPortCounter, error) + // ToPbText marshals PatternFlowUdpSrcPortCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowUdpSrcPortCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowUdpSrcPortCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowUdpSrcPortCounter struct { + obj *patternFlowUdpSrcPortCounter +} + +type unMarshalPatternFlowUdpSrcPortCounter interface { + // FromProto unmarshals PatternFlowUdpSrcPortCounter from protobuf object *otg.PatternFlowUdpSrcPortCounter + FromProto(msg *otg.PatternFlowUdpSrcPortCounter) (PatternFlowUdpSrcPortCounter, error) + // FromPbText unmarshals PatternFlowUdpSrcPortCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowUdpSrcPortCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowUdpSrcPortCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowUdpSrcPortCounter) Marshal() marshalPatternFlowUdpSrcPortCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowUdpSrcPortCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowUdpSrcPortCounter) Unmarshal() unMarshalPatternFlowUdpSrcPortCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowUdpSrcPortCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowUdpSrcPortCounter) ToProto() (*otg.PatternFlowUdpSrcPortCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowUdpSrcPortCounter) FromProto(msg *otg.PatternFlowUdpSrcPortCounter) (PatternFlowUdpSrcPortCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowUdpSrcPortCounter) 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 *unMarshalpatternFlowUdpSrcPortCounter) 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 *marshalpatternFlowUdpSrcPortCounter) 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 *unMarshalpatternFlowUdpSrcPortCounter) 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 *marshalpatternFlowUdpSrcPortCounter) 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 *unMarshalpatternFlowUdpSrcPortCounter) 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 *patternFlowUdpSrcPortCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowUdpSrcPortCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowUdpSrcPortCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowUdpSrcPortCounter) Clone() (PatternFlowUdpSrcPortCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowUdpSrcPortCounter() + 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 +} + +// PatternFlowUdpSrcPortCounter is integer counter pattern +type PatternFlowUdpSrcPortCounter interface { + Validation + // msg marshals PatternFlowUdpSrcPortCounter to protobuf object *otg.PatternFlowUdpSrcPortCounter + // and doesn't set defaults + msg() *otg.PatternFlowUdpSrcPortCounter + // setMsg unmarshals PatternFlowUdpSrcPortCounter from protobuf object *otg.PatternFlowUdpSrcPortCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowUdpSrcPortCounter) PatternFlowUdpSrcPortCounter + // provides marshal interface + Marshal() marshalPatternFlowUdpSrcPortCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowUdpSrcPortCounter + // validate validates PatternFlowUdpSrcPortCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowUdpSrcPortCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowUdpSrcPortCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowUdpSrcPortCounter + SetStart(value uint32) PatternFlowUdpSrcPortCounter + // HasStart checks if Start has been set in PatternFlowUdpSrcPortCounter + HasStart() bool + // Step returns uint32, set in PatternFlowUdpSrcPortCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowUdpSrcPortCounter + SetStep(value uint32) PatternFlowUdpSrcPortCounter + // HasStep checks if Step has been set in PatternFlowUdpSrcPortCounter + HasStep() bool + // Count returns uint32, set in PatternFlowUdpSrcPortCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowUdpSrcPortCounter + SetCount(value uint32) PatternFlowUdpSrcPortCounter + // HasCount checks if Count has been set in PatternFlowUdpSrcPortCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowUdpSrcPortCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowUdpSrcPortCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowUdpSrcPortCounter object +func (obj *patternFlowUdpSrcPortCounter) SetStart(value uint32) PatternFlowUdpSrcPortCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowUdpSrcPortCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowUdpSrcPortCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowUdpSrcPortCounter object +func (obj *patternFlowUdpSrcPortCounter) SetStep(value uint32) PatternFlowUdpSrcPortCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowUdpSrcPortCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowUdpSrcPortCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowUdpSrcPortCounter object +func (obj *patternFlowUdpSrcPortCounter) SetCount(value uint32) PatternFlowUdpSrcPortCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowUdpSrcPortCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpSrcPortCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpSrcPortCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpSrcPortCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowUdpSrcPortCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_udp_src_port_metric_tag.go b/gosnappi/pattern_flow_udp_src_port_metric_tag.go new file mode 100644 index 00000000..783c16bc --- /dev/null +++ b/gosnappi/pattern_flow_udp_src_port_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowUdpSrcPortMetricTag ***** +type patternFlowUdpSrcPortMetricTag struct { + validation + obj *otg.PatternFlowUdpSrcPortMetricTag + marshaller marshalPatternFlowUdpSrcPortMetricTag + unMarshaller unMarshalPatternFlowUdpSrcPortMetricTag +} + +func NewPatternFlowUdpSrcPortMetricTag() PatternFlowUdpSrcPortMetricTag { + obj := patternFlowUdpSrcPortMetricTag{obj: &otg.PatternFlowUdpSrcPortMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowUdpSrcPortMetricTag) msg() *otg.PatternFlowUdpSrcPortMetricTag { + return obj.obj +} + +func (obj *patternFlowUdpSrcPortMetricTag) setMsg(msg *otg.PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowUdpSrcPortMetricTag struct { + obj *patternFlowUdpSrcPortMetricTag +} + +type marshalPatternFlowUdpSrcPortMetricTag interface { + // ToProto marshals PatternFlowUdpSrcPortMetricTag to protobuf object *otg.PatternFlowUdpSrcPortMetricTag + ToProto() (*otg.PatternFlowUdpSrcPortMetricTag, error) + // ToPbText marshals PatternFlowUdpSrcPortMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowUdpSrcPortMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowUdpSrcPortMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowUdpSrcPortMetricTag struct { + obj *patternFlowUdpSrcPortMetricTag +} + +type unMarshalPatternFlowUdpSrcPortMetricTag interface { + // FromProto unmarshals PatternFlowUdpSrcPortMetricTag from protobuf object *otg.PatternFlowUdpSrcPortMetricTag + FromProto(msg *otg.PatternFlowUdpSrcPortMetricTag) (PatternFlowUdpSrcPortMetricTag, error) + // FromPbText unmarshals PatternFlowUdpSrcPortMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowUdpSrcPortMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowUdpSrcPortMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowUdpSrcPortMetricTag) Marshal() marshalPatternFlowUdpSrcPortMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowUdpSrcPortMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowUdpSrcPortMetricTag) Unmarshal() unMarshalPatternFlowUdpSrcPortMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowUdpSrcPortMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowUdpSrcPortMetricTag) ToProto() (*otg.PatternFlowUdpSrcPortMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowUdpSrcPortMetricTag) FromProto(msg *otg.PatternFlowUdpSrcPortMetricTag) (PatternFlowUdpSrcPortMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowUdpSrcPortMetricTag) 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 *unMarshalpatternFlowUdpSrcPortMetricTag) 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 *marshalpatternFlowUdpSrcPortMetricTag) 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 *unMarshalpatternFlowUdpSrcPortMetricTag) 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 *marshalpatternFlowUdpSrcPortMetricTag) 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 *unMarshalpatternFlowUdpSrcPortMetricTag) 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 *patternFlowUdpSrcPortMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowUdpSrcPortMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowUdpSrcPortMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowUdpSrcPortMetricTag) Clone() (PatternFlowUdpSrcPortMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowUdpSrcPortMetricTag() + 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 +} + +// PatternFlowUdpSrcPortMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowUdpSrcPortMetricTag interface { + Validation + // msg marshals PatternFlowUdpSrcPortMetricTag to protobuf object *otg.PatternFlowUdpSrcPortMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowUdpSrcPortMetricTag + // setMsg unmarshals PatternFlowUdpSrcPortMetricTag from protobuf object *otg.PatternFlowUdpSrcPortMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowUdpSrcPortMetricTag) PatternFlowUdpSrcPortMetricTag + // provides marshal interface + Marshal() marshalPatternFlowUdpSrcPortMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowUdpSrcPortMetricTag + // validate validates PatternFlowUdpSrcPortMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowUdpSrcPortMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowUdpSrcPortMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowUdpSrcPortMetricTag + SetName(value string) PatternFlowUdpSrcPortMetricTag + // Offset returns uint32, set in PatternFlowUdpSrcPortMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowUdpSrcPortMetricTag + SetOffset(value uint32) PatternFlowUdpSrcPortMetricTag + // HasOffset checks if Offset has been set in PatternFlowUdpSrcPortMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowUdpSrcPortMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowUdpSrcPortMetricTag + SetLength(value uint32) PatternFlowUdpSrcPortMetricTag + // HasLength checks if Length has been set in PatternFlowUdpSrcPortMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowUdpSrcPortMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowUdpSrcPortMetricTag object +func (obj *patternFlowUdpSrcPortMetricTag) SetName(value string) PatternFlowUdpSrcPortMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowUdpSrcPortMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowUdpSrcPortMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowUdpSrcPortMetricTag object +func (obj *patternFlowUdpSrcPortMetricTag) SetOffset(value uint32) PatternFlowUdpSrcPortMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowUdpSrcPortMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowUdpSrcPortMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowUdpSrcPortMetricTag object +func (obj *patternFlowUdpSrcPortMetricTag) SetLength(value uint32) PatternFlowUdpSrcPortMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowUdpSrcPortMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowUdpSrcPortMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpSrcPortMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowUdpSrcPortMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowUdpSrcPortMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_udp_src_port_random.go b/gosnappi/pattern_flow_udp_src_port_random.go new file mode 100644 index 00000000..1db16a2c --- /dev/null +++ b/gosnappi/pattern_flow_udp_src_port_random.go @@ -0,0 +1,422 @@ +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" +) + +// ***** PatternFlowUdpSrcPortRandom ***** +type patternFlowUdpSrcPortRandom struct { + validation + obj *otg.PatternFlowUdpSrcPortRandom + marshaller marshalPatternFlowUdpSrcPortRandom + unMarshaller unMarshalPatternFlowUdpSrcPortRandom +} + +func NewPatternFlowUdpSrcPortRandom() PatternFlowUdpSrcPortRandom { + obj := patternFlowUdpSrcPortRandom{obj: &otg.PatternFlowUdpSrcPortRandom{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowUdpSrcPortRandom) msg() *otg.PatternFlowUdpSrcPortRandom { + return obj.obj +} + +func (obj *patternFlowUdpSrcPortRandom) setMsg(msg *otg.PatternFlowUdpSrcPortRandom) PatternFlowUdpSrcPortRandom { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowUdpSrcPortRandom struct { + obj *patternFlowUdpSrcPortRandom +} + +type marshalPatternFlowUdpSrcPortRandom interface { + // ToProto marshals PatternFlowUdpSrcPortRandom to protobuf object *otg.PatternFlowUdpSrcPortRandom + ToProto() (*otg.PatternFlowUdpSrcPortRandom, error) + // ToPbText marshals PatternFlowUdpSrcPortRandom to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowUdpSrcPortRandom to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowUdpSrcPortRandom to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowUdpSrcPortRandom struct { + obj *patternFlowUdpSrcPortRandom +} + +type unMarshalPatternFlowUdpSrcPortRandom interface { + // FromProto unmarshals PatternFlowUdpSrcPortRandom from protobuf object *otg.PatternFlowUdpSrcPortRandom + FromProto(msg *otg.PatternFlowUdpSrcPortRandom) (PatternFlowUdpSrcPortRandom, error) + // FromPbText unmarshals PatternFlowUdpSrcPortRandom from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowUdpSrcPortRandom from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowUdpSrcPortRandom from JSON text + FromJson(value string) error +} + +func (obj *patternFlowUdpSrcPortRandom) Marshal() marshalPatternFlowUdpSrcPortRandom { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowUdpSrcPortRandom{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowUdpSrcPortRandom) Unmarshal() unMarshalPatternFlowUdpSrcPortRandom { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowUdpSrcPortRandom{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowUdpSrcPortRandom) ToProto() (*otg.PatternFlowUdpSrcPortRandom, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowUdpSrcPortRandom) FromProto(msg *otg.PatternFlowUdpSrcPortRandom) (PatternFlowUdpSrcPortRandom, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowUdpSrcPortRandom) 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 *unMarshalpatternFlowUdpSrcPortRandom) 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 *marshalpatternFlowUdpSrcPortRandom) 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 *unMarshalpatternFlowUdpSrcPortRandom) 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 *marshalpatternFlowUdpSrcPortRandom) 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 *unMarshalpatternFlowUdpSrcPortRandom) 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 *patternFlowUdpSrcPortRandom) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowUdpSrcPortRandom) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowUdpSrcPortRandom) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowUdpSrcPortRandom) Clone() (PatternFlowUdpSrcPortRandom, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowUdpSrcPortRandom() + 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 +} + +// PatternFlowUdpSrcPortRandom is integer random pattern +type PatternFlowUdpSrcPortRandom interface { + Validation + // msg marshals PatternFlowUdpSrcPortRandom to protobuf object *otg.PatternFlowUdpSrcPortRandom + // and doesn't set defaults + msg() *otg.PatternFlowUdpSrcPortRandom + // setMsg unmarshals PatternFlowUdpSrcPortRandom from protobuf object *otg.PatternFlowUdpSrcPortRandom + // and doesn't set defaults + setMsg(*otg.PatternFlowUdpSrcPortRandom) PatternFlowUdpSrcPortRandom + // provides marshal interface + Marshal() marshalPatternFlowUdpSrcPortRandom + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowUdpSrcPortRandom + // validate validates PatternFlowUdpSrcPortRandom + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowUdpSrcPortRandom, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Min returns uint32, set in PatternFlowUdpSrcPortRandom. + Min() uint32 + // SetMin assigns uint32 provided by user to PatternFlowUdpSrcPortRandom + SetMin(value uint32) PatternFlowUdpSrcPortRandom + // HasMin checks if Min has been set in PatternFlowUdpSrcPortRandom + HasMin() bool + // Max returns uint32, set in PatternFlowUdpSrcPortRandom. + Max() uint32 + // SetMax assigns uint32 provided by user to PatternFlowUdpSrcPortRandom + SetMax(value uint32) PatternFlowUdpSrcPortRandom + // HasMax checks if Max has been set in PatternFlowUdpSrcPortRandom + HasMax() bool + // Seed returns uint32, set in PatternFlowUdpSrcPortRandom. + Seed() uint32 + // SetSeed assigns uint32 provided by user to PatternFlowUdpSrcPortRandom + SetSeed(value uint32) PatternFlowUdpSrcPortRandom + // HasSeed checks if Seed has been set in PatternFlowUdpSrcPortRandom + HasSeed() bool + // Count returns uint32, set in PatternFlowUdpSrcPortRandom. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowUdpSrcPortRandom + SetCount(value uint32) PatternFlowUdpSrcPortRandom + // HasCount checks if Count has been set in PatternFlowUdpSrcPortRandom + HasCount() bool +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) Min() uint32 { + + return *obj.obj.Min + +} + +// The minimum possible value generated by the random value generator. +// Min returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) HasMin() bool { + return obj.obj.Min != nil +} + +// The minimum possible value generated by the random value generator. +// SetMin sets the uint32 value in the PatternFlowUdpSrcPortRandom object +func (obj *patternFlowUdpSrcPortRandom) SetMin(value uint32) PatternFlowUdpSrcPortRandom { + + obj.obj.Min = &value + return obj +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) Max() uint32 { + + return *obj.obj.Max + +} + +// The maximum possible value generated by the random value generator. +// Max returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) HasMax() bool { + return obj.obj.Max != nil +} + +// The maximum possible value generated by the random value generator. +// SetMax sets the uint32 value in the PatternFlowUdpSrcPortRandom object +func (obj *patternFlowUdpSrcPortRandom) SetMax(value uint32) PatternFlowUdpSrcPortRandom { + + obj.obj.Max = &value + return obj +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) Seed() uint32 { + + return *obj.obj.Seed + +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// Seed returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) HasSeed() bool { + return obj.obj.Seed != nil +} + +// The seed value is used to initialize the random number generator to a deterministic state. If the user provides a seed value of 0, the implementation will generate a sequence of non-deterministic random values. For any other seed value, the sequence of random numbers will be generated in a deterministic manner (specific to the implementation). +// SetSeed sets the uint32 value in the PatternFlowUdpSrcPortRandom object +func (obj *patternFlowUdpSrcPortRandom) SetSeed(value uint32) PatternFlowUdpSrcPortRandom { + + obj.obj.Seed = &value + return obj +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of values to be generated by the random value generator. +// Count returns a uint32 +func (obj *patternFlowUdpSrcPortRandom) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of values to be generated by the random value generator. +// SetCount sets the uint32 value in the PatternFlowUdpSrcPortRandom object +func (obj *patternFlowUdpSrcPortRandom) SetCount(value uint32) PatternFlowUdpSrcPortRandom { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowUdpSrcPortRandom) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Min != nil { + + if *obj.obj.Min > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpSrcPortRandom.Min <= 65535 but Got %d", *obj.obj.Min)) + } + + } + + if obj.obj.Max != nil { + + if *obj.obj.Max > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowUdpSrcPortRandom.Max <= 65535 but Got %d", *obj.obj.Max)) + } + + } + +} + +func (obj *patternFlowUdpSrcPortRandom) setDefault() { + if obj.obj.Min == nil { + obj.SetMin(0) + } + if obj.obj.Max == nil { + obj.SetMax(65535) + } + if obj.obj.Seed == nil { + obj.SetSeed(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_vlan_cfi.go b/gosnappi/pattern_flow_vlan_cfi.go new file mode 100644 index 00000000..d0bb6631 --- /dev/null +++ b/gosnappi/pattern_flow_vlan_cfi.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowVlanCfi ***** +type patternFlowVlanCfi struct { + validation + obj *otg.PatternFlowVlanCfi + marshaller marshalPatternFlowVlanCfi + unMarshaller unMarshalPatternFlowVlanCfi + incrementHolder PatternFlowVlanCfiCounter + decrementHolder PatternFlowVlanCfiCounter + metricTagsHolder PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter +} + +func NewPatternFlowVlanCfi() PatternFlowVlanCfi { + obj := patternFlowVlanCfi{obj: &otg.PatternFlowVlanCfi{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVlanCfi) msg() *otg.PatternFlowVlanCfi { + return obj.obj +} + +func (obj *patternFlowVlanCfi) setMsg(msg *otg.PatternFlowVlanCfi) PatternFlowVlanCfi { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVlanCfi struct { + obj *patternFlowVlanCfi +} + +type marshalPatternFlowVlanCfi interface { + // ToProto marshals PatternFlowVlanCfi to protobuf object *otg.PatternFlowVlanCfi + ToProto() (*otg.PatternFlowVlanCfi, error) + // ToPbText marshals PatternFlowVlanCfi to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVlanCfi to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVlanCfi to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVlanCfi struct { + obj *patternFlowVlanCfi +} + +type unMarshalPatternFlowVlanCfi interface { + // FromProto unmarshals PatternFlowVlanCfi from protobuf object *otg.PatternFlowVlanCfi + FromProto(msg *otg.PatternFlowVlanCfi) (PatternFlowVlanCfi, error) + // FromPbText unmarshals PatternFlowVlanCfi from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVlanCfi from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVlanCfi from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVlanCfi) Marshal() marshalPatternFlowVlanCfi { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVlanCfi{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVlanCfi) Unmarshal() unMarshalPatternFlowVlanCfi { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVlanCfi{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVlanCfi) ToProto() (*otg.PatternFlowVlanCfi, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVlanCfi) FromProto(msg *otg.PatternFlowVlanCfi) (PatternFlowVlanCfi, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVlanCfi) 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 *unMarshalpatternFlowVlanCfi) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowVlanCfi) 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 *unMarshalpatternFlowVlanCfi) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowVlanCfi) 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 *unMarshalpatternFlowVlanCfi) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowVlanCfi) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVlanCfi) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVlanCfi) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVlanCfi) Clone() (PatternFlowVlanCfi, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVlanCfi() + 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 +} + +func (obj *patternFlowVlanCfi) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowVlanCfi is canonical format indicator or drop elegible indicator +type PatternFlowVlanCfi interface { + Validation + // msg marshals PatternFlowVlanCfi to protobuf object *otg.PatternFlowVlanCfi + // and doesn't set defaults + msg() *otg.PatternFlowVlanCfi + // setMsg unmarshals PatternFlowVlanCfi from protobuf object *otg.PatternFlowVlanCfi + // and doesn't set defaults + setMsg(*otg.PatternFlowVlanCfi) PatternFlowVlanCfi + // provides marshal interface + Marshal() marshalPatternFlowVlanCfi + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVlanCfi + // validate validates PatternFlowVlanCfi + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVlanCfi, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowVlanCfiChoiceEnum, set in PatternFlowVlanCfi + Choice() PatternFlowVlanCfiChoiceEnum + // setChoice assigns PatternFlowVlanCfiChoiceEnum provided by user to PatternFlowVlanCfi + setChoice(value PatternFlowVlanCfiChoiceEnum) PatternFlowVlanCfi + // HasChoice checks if Choice has been set in PatternFlowVlanCfi + HasChoice() bool + // Value returns uint32, set in PatternFlowVlanCfi. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowVlanCfi + SetValue(value uint32) PatternFlowVlanCfi + // HasValue checks if Value has been set in PatternFlowVlanCfi + HasValue() bool + // Values returns []uint32, set in PatternFlowVlanCfi. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowVlanCfi + SetValues(value []uint32) PatternFlowVlanCfi + // Increment returns PatternFlowVlanCfiCounter, set in PatternFlowVlanCfi. + // PatternFlowVlanCfiCounter is integer counter pattern + Increment() PatternFlowVlanCfiCounter + // SetIncrement assigns PatternFlowVlanCfiCounter provided by user to PatternFlowVlanCfi. + // PatternFlowVlanCfiCounter is integer counter pattern + SetIncrement(value PatternFlowVlanCfiCounter) PatternFlowVlanCfi + // HasIncrement checks if Increment has been set in PatternFlowVlanCfi + HasIncrement() bool + // Decrement returns PatternFlowVlanCfiCounter, set in PatternFlowVlanCfi. + // PatternFlowVlanCfiCounter is integer counter pattern + Decrement() PatternFlowVlanCfiCounter + // SetDecrement assigns PatternFlowVlanCfiCounter provided by user to PatternFlowVlanCfi. + // PatternFlowVlanCfiCounter is integer counter pattern + SetDecrement(value PatternFlowVlanCfiCounter) PatternFlowVlanCfi + // HasDecrement checks if Decrement has been set in PatternFlowVlanCfi + HasDecrement() bool + // MetricTags returns PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIterIter, set in PatternFlowVlanCfi + MetricTags() PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter + setNil() +} + +type PatternFlowVlanCfiChoiceEnum string + +// Enum of Choice on PatternFlowVlanCfi +var PatternFlowVlanCfiChoice = struct { + VALUE PatternFlowVlanCfiChoiceEnum + VALUES PatternFlowVlanCfiChoiceEnum + INCREMENT PatternFlowVlanCfiChoiceEnum + DECREMENT PatternFlowVlanCfiChoiceEnum +}{ + VALUE: PatternFlowVlanCfiChoiceEnum("value"), + VALUES: PatternFlowVlanCfiChoiceEnum("values"), + INCREMENT: PatternFlowVlanCfiChoiceEnum("increment"), + DECREMENT: PatternFlowVlanCfiChoiceEnum("decrement"), +} + +func (obj *patternFlowVlanCfi) Choice() PatternFlowVlanCfiChoiceEnum { + return PatternFlowVlanCfiChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowVlanCfi) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowVlanCfi) setChoice(value PatternFlowVlanCfiChoiceEnum) PatternFlowVlanCfi { + intValue, ok := otg.PatternFlowVlanCfi_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowVlanCfiChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowVlanCfi_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowVlanCfiChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowVlanCfiChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowVlanCfiChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowVlanCfiCounter().msg() + } + + if value == PatternFlowVlanCfiChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowVlanCfiCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVlanCfi) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowVlanCfiChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVlanCfi) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowVlanCfi object +func (obj *patternFlowVlanCfi) SetValue(value uint32) PatternFlowVlanCfi { + obj.setChoice(PatternFlowVlanCfiChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowVlanCfi) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowVlanCfi object +func (obj *patternFlowVlanCfi) SetValues(value []uint32) PatternFlowVlanCfi { + obj.setChoice(PatternFlowVlanCfiChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowVlanCfiCounter +func (obj *patternFlowVlanCfi) Increment() PatternFlowVlanCfiCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowVlanCfiChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowVlanCfiCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowVlanCfiCounter +func (obj *patternFlowVlanCfi) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowVlanCfiCounter value in the PatternFlowVlanCfi object +func (obj *patternFlowVlanCfi) SetIncrement(value PatternFlowVlanCfiCounter) PatternFlowVlanCfi { + obj.setChoice(PatternFlowVlanCfiChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowVlanCfiCounter +func (obj *patternFlowVlanCfi) Decrement() PatternFlowVlanCfiCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowVlanCfiChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowVlanCfiCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowVlanCfiCounter +func (obj *patternFlowVlanCfi) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowVlanCfiCounter value in the PatternFlowVlanCfi object +func (obj *patternFlowVlanCfi) SetDecrement(value PatternFlowVlanCfiCounter) PatternFlowVlanCfi { + obj.setChoice(PatternFlowVlanCfiChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowVlanCfiMetricTag +func (obj *patternFlowVlanCfi) MetricTags() PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowVlanCfiMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter struct { + obj *patternFlowVlanCfi + patternFlowVlanCfiMetricTagSlice []PatternFlowVlanCfiMetricTag + fieldPtr *[]*otg.PatternFlowVlanCfiMetricTag +} + +func newPatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter(ptr *[]*otg.PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { + return &patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter interface { + setMsg(*patternFlowVlanCfi) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter + Items() []PatternFlowVlanCfiMetricTag + Add() PatternFlowVlanCfiMetricTag + Append(items ...PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter + Set(index int, newObj PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter + Clear() PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter + clearHolderSlice() PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter + appendHolderSlice(item PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter +} + +func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) setMsg(msg *patternFlowVlanCfi) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowVlanCfiMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) Items() []PatternFlowVlanCfiMetricTag { + return obj.patternFlowVlanCfiMetricTagSlice +} + +func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) Add() PatternFlowVlanCfiMetricTag { + newObj := &otg.PatternFlowVlanCfiMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowVlanCfiMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowVlanCfiMetricTagSlice = append(obj.patternFlowVlanCfiMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) Append(items ...PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowVlanCfiMetricTagSlice = append(obj.patternFlowVlanCfiMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) Set(index int, newObj PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowVlanCfiMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) Clear() PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowVlanCfiMetricTag{} + obj.patternFlowVlanCfiMetricTagSlice = []PatternFlowVlanCfiMetricTag{} + } + return obj +} +func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) clearHolderSlice() PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { + if len(obj.patternFlowVlanCfiMetricTagSlice) > 0 { + obj.patternFlowVlanCfiMetricTagSlice = []PatternFlowVlanCfiMetricTag{} + } + return obj +} +func (obj *patternFlowVlanCfiPatternFlowVlanCfiMetricTagIter) appendHolderSlice(item PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiPatternFlowVlanCfiMetricTagIter { + obj.patternFlowVlanCfiMetricTagSlice = append(obj.patternFlowVlanCfiMetricTagSlice, item) + return obj +} + +func (obj *patternFlowVlanCfi) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanCfi.Value <= 1 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowVlanCfi.Values <= 1 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowVlanCfiMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowVlanCfi) setDefault() { + var choices_set int = 0 + var choice PatternFlowVlanCfiChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowVlanCfiChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowVlanCfiChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowVlanCfiChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowVlanCfiChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowVlanCfiChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVlanCfi") + } + } else { + intVal := otg.PatternFlowVlanCfi_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowVlanCfi_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_vlan_cfi_counter.go b/gosnappi/pattern_flow_vlan_cfi_counter.go new file mode 100644 index 00000000..370eaf37 --- /dev/null +++ b/gosnappi/pattern_flow_vlan_cfi_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowVlanCfiCounter ***** +type patternFlowVlanCfiCounter struct { + validation + obj *otg.PatternFlowVlanCfiCounter + marshaller marshalPatternFlowVlanCfiCounter + unMarshaller unMarshalPatternFlowVlanCfiCounter +} + +func NewPatternFlowVlanCfiCounter() PatternFlowVlanCfiCounter { + obj := patternFlowVlanCfiCounter{obj: &otg.PatternFlowVlanCfiCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVlanCfiCounter) msg() *otg.PatternFlowVlanCfiCounter { + return obj.obj +} + +func (obj *patternFlowVlanCfiCounter) setMsg(msg *otg.PatternFlowVlanCfiCounter) PatternFlowVlanCfiCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVlanCfiCounter struct { + obj *patternFlowVlanCfiCounter +} + +type marshalPatternFlowVlanCfiCounter interface { + // ToProto marshals PatternFlowVlanCfiCounter to protobuf object *otg.PatternFlowVlanCfiCounter + ToProto() (*otg.PatternFlowVlanCfiCounter, error) + // ToPbText marshals PatternFlowVlanCfiCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVlanCfiCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVlanCfiCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVlanCfiCounter struct { + obj *patternFlowVlanCfiCounter +} + +type unMarshalPatternFlowVlanCfiCounter interface { + // FromProto unmarshals PatternFlowVlanCfiCounter from protobuf object *otg.PatternFlowVlanCfiCounter + FromProto(msg *otg.PatternFlowVlanCfiCounter) (PatternFlowVlanCfiCounter, error) + // FromPbText unmarshals PatternFlowVlanCfiCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVlanCfiCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVlanCfiCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVlanCfiCounter) Marshal() marshalPatternFlowVlanCfiCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVlanCfiCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVlanCfiCounter) Unmarshal() unMarshalPatternFlowVlanCfiCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVlanCfiCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVlanCfiCounter) ToProto() (*otg.PatternFlowVlanCfiCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVlanCfiCounter) FromProto(msg *otg.PatternFlowVlanCfiCounter) (PatternFlowVlanCfiCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVlanCfiCounter) 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 *unMarshalpatternFlowVlanCfiCounter) 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 *marshalpatternFlowVlanCfiCounter) 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 *unMarshalpatternFlowVlanCfiCounter) 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 *marshalpatternFlowVlanCfiCounter) 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 *unMarshalpatternFlowVlanCfiCounter) 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 *patternFlowVlanCfiCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVlanCfiCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVlanCfiCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVlanCfiCounter) Clone() (PatternFlowVlanCfiCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVlanCfiCounter() + 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 +} + +// PatternFlowVlanCfiCounter is integer counter pattern +type PatternFlowVlanCfiCounter interface { + Validation + // msg marshals PatternFlowVlanCfiCounter to protobuf object *otg.PatternFlowVlanCfiCounter + // and doesn't set defaults + msg() *otg.PatternFlowVlanCfiCounter + // setMsg unmarshals PatternFlowVlanCfiCounter from protobuf object *otg.PatternFlowVlanCfiCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowVlanCfiCounter) PatternFlowVlanCfiCounter + // provides marshal interface + Marshal() marshalPatternFlowVlanCfiCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVlanCfiCounter + // validate validates PatternFlowVlanCfiCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVlanCfiCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowVlanCfiCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowVlanCfiCounter + SetStart(value uint32) PatternFlowVlanCfiCounter + // HasStart checks if Start has been set in PatternFlowVlanCfiCounter + HasStart() bool + // Step returns uint32, set in PatternFlowVlanCfiCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowVlanCfiCounter + SetStep(value uint32) PatternFlowVlanCfiCounter + // HasStep checks if Step has been set in PatternFlowVlanCfiCounter + HasStep() bool + // Count returns uint32, set in PatternFlowVlanCfiCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowVlanCfiCounter + SetCount(value uint32) PatternFlowVlanCfiCounter + // HasCount checks if Count has been set in PatternFlowVlanCfiCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVlanCfiCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVlanCfiCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowVlanCfiCounter object +func (obj *patternFlowVlanCfiCounter) SetStart(value uint32) PatternFlowVlanCfiCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVlanCfiCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVlanCfiCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowVlanCfiCounter object +func (obj *patternFlowVlanCfiCounter) SetStep(value uint32) PatternFlowVlanCfiCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVlanCfiCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVlanCfiCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowVlanCfiCounter object +func (obj *patternFlowVlanCfiCounter) SetCount(value uint32) PatternFlowVlanCfiCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowVlanCfiCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanCfiCounter.Start <= 1 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanCfiCounter.Step <= 1 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanCfiCounter.Count <= 1 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowVlanCfiCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_vlan_cfi_metric_tag.go b/gosnappi/pattern_flow_vlan_cfi_metric_tag.go new file mode 100644 index 00000000..f3976ac3 --- /dev/null +++ b/gosnappi/pattern_flow_vlan_cfi_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowVlanCfiMetricTag ***** +type patternFlowVlanCfiMetricTag struct { + validation + obj *otg.PatternFlowVlanCfiMetricTag + marshaller marshalPatternFlowVlanCfiMetricTag + unMarshaller unMarshalPatternFlowVlanCfiMetricTag +} + +func NewPatternFlowVlanCfiMetricTag() PatternFlowVlanCfiMetricTag { + obj := patternFlowVlanCfiMetricTag{obj: &otg.PatternFlowVlanCfiMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVlanCfiMetricTag) msg() *otg.PatternFlowVlanCfiMetricTag { + return obj.obj +} + +func (obj *patternFlowVlanCfiMetricTag) setMsg(msg *otg.PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVlanCfiMetricTag struct { + obj *patternFlowVlanCfiMetricTag +} + +type marshalPatternFlowVlanCfiMetricTag interface { + // ToProto marshals PatternFlowVlanCfiMetricTag to protobuf object *otg.PatternFlowVlanCfiMetricTag + ToProto() (*otg.PatternFlowVlanCfiMetricTag, error) + // ToPbText marshals PatternFlowVlanCfiMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVlanCfiMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVlanCfiMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVlanCfiMetricTag struct { + obj *patternFlowVlanCfiMetricTag +} + +type unMarshalPatternFlowVlanCfiMetricTag interface { + // FromProto unmarshals PatternFlowVlanCfiMetricTag from protobuf object *otg.PatternFlowVlanCfiMetricTag + FromProto(msg *otg.PatternFlowVlanCfiMetricTag) (PatternFlowVlanCfiMetricTag, error) + // FromPbText unmarshals PatternFlowVlanCfiMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVlanCfiMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVlanCfiMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVlanCfiMetricTag) Marshal() marshalPatternFlowVlanCfiMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVlanCfiMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVlanCfiMetricTag) Unmarshal() unMarshalPatternFlowVlanCfiMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVlanCfiMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVlanCfiMetricTag) ToProto() (*otg.PatternFlowVlanCfiMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVlanCfiMetricTag) FromProto(msg *otg.PatternFlowVlanCfiMetricTag) (PatternFlowVlanCfiMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVlanCfiMetricTag) 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 *unMarshalpatternFlowVlanCfiMetricTag) 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 *marshalpatternFlowVlanCfiMetricTag) 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 *unMarshalpatternFlowVlanCfiMetricTag) 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 *marshalpatternFlowVlanCfiMetricTag) 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 *unMarshalpatternFlowVlanCfiMetricTag) 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 *patternFlowVlanCfiMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVlanCfiMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVlanCfiMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVlanCfiMetricTag) Clone() (PatternFlowVlanCfiMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVlanCfiMetricTag() + 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 +} + +// PatternFlowVlanCfiMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowVlanCfiMetricTag interface { + Validation + // msg marshals PatternFlowVlanCfiMetricTag to protobuf object *otg.PatternFlowVlanCfiMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowVlanCfiMetricTag + // setMsg unmarshals PatternFlowVlanCfiMetricTag from protobuf object *otg.PatternFlowVlanCfiMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowVlanCfiMetricTag) PatternFlowVlanCfiMetricTag + // provides marshal interface + Marshal() marshalPatternFlowVlanCfiMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVlanCfiMetricTag + // validate validates PatternFlowVlanCfiMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVlanCfiMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowVlanCfiMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowVlanCfiMetricTag + SetName(value string) PatternFlowVlanCfiMetricTag + // Offset returns uint32, set in PatternFlowVlanCfiMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowVlanCfiMetricTag + SetOffset(value uint32) PatternFlowVlanCfiMetricTag + // HasOffset checks if Offset has been set in PatternFlowVlanCfiMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowVlanCfiMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowVlanCfiMetricTag + SetLength(value uint32) PatternFlowVlanCfiMetricTag + // HasLength checks if Length has been set in PatternFlowVlanCfiMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowVlanCfiMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowVlanCfiMetricTag object +func (obj *patternFlowVlanCfiMetricTag) SetName(value string) PatternFlowVlanCfiMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVlanCfiMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVlanCfiMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowVlanCfiMetricTag object +func (obj *patternFlowVlanCfiMetricTag) SetOffset(value uint32) PatternFlowVlanCfiMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVlanCfiMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVlanCfiMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowVlanCfiMetricTag object +func (obj *patternFlowVlanCfiMetricTag) SetLength(value uint32) PatternFlowVlanCfiMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowVlanCfiMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVlanCfiMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 0 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanCfiMetricTag.Offset <= 0 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 1 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowVlanCfiMetricTag.Length <= 1 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowVlanCfiMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(1) + } + +} diff --git a/gosnappi/pattern_flow_vlan_id.go b/gosnappi/pattern_flow_vlan_id.go new file mode 100644 index 00000000..8cb8bf53 --- /dev/null +++ b/gosnappi/pattern_flow_vlan_id.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowVlanId ***** +type patternFlowVlanId struct { + validation + obj *otg.PatternFlowVlanId + marshaller marshalPatternFlowVlanId + unMarshaller unMarshalPatternFlowVlanId + incrementHolder PatternFlowVlanIdCounter + decrementHolder PatternFlowVlanIdCounter + metricTagsHolder PatternFlowVlanIdPatternFlowVlanIdMetricTagIter +} + +func NewPatternFlowVlanId() PatternFlowVlanId { + obj := patternFlowVlanId{obj: &otg.PatternFlowVlanId{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVlanId) msg() *otg.PatternFlowVlanId { + return obj.obj +} + +func (obj *patternFlowVlanId) setMsg(msg *otg.PatternFlowVlanId) PatternFlowVlanId { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVlanId struct { + obj *patternFlowVlanId +} + +type marshalPatternFlowVlanId interface { + // ToProto marshals PatternFlowVlanId to protobuf object *otg.PatternFlowVlanId + ToProto() (*otg.PatternFlowVlanId, error) + // ToPbText marshals PatternFlowVlanId to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVlanId to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVlanId to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVlanId struct { + obj *patternFlowVlanId +} + +type unMarshalPatternFlowVlanId interface { + // FromProto unmarshals PatternFlowVlanId from protobuf object *otg.PatternFlowVlanId + FromProto(msg *otg.PatternFlowVlanId) (PatternFlowVlanId, error) + // FromPbText unmarshals PatternFlowVlanId from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVlanId from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVlanId from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVlanId) Marshal() marshalPatternFlowVlanId { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVlanId{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVlanId) Unmarshal() unMarshalPatternFlowVlanId { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVlanId{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVlanId) ToProto() (*otg.PatternFlowVlanId, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVlanId) FromProto(msg *otg.PatternFlowVlanId) (PatternFlowVlanId, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVlanId) 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 *unMarshalpatternFlowVlanId) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowVlanId) 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 *unMarshalpatternFlowVlanId) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowVlanId) 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 *unMarshalpatternFlowVlanId) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowVlanId) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVlanId) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVlanId) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVlanId) Clone() (PatternFlowVlanId, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVlanId() + 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 +} + +func (obj *patternFlowVlanId) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowVlanId is vlan identifier +type PatternFlowVlanId interface { + Validation + // msg marshals PatternFlowVlanId to protobuf object *otg.PatternFlowVlanId + // and doesn't set defaults + msg() *otg.PatternFlowVlanId + // setMsg unmarshals PatternFlowVlanId from protobuf object *otg.PatternFlowVlanId + // and doesn't set defaults + setMsg(*otg.PatternFlowVlanId) PatternFlowVlanId + // provides marshal interface + Marshal() marshalPatternFlowVlanId + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVlanId + // validate validates PatternFlowVlanId + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVlanId, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowVlanIdChoiceEnum, set in PatternFlowVlanId + Choice() PatternFlowVlanIdChoiceEnum + // setChoice assigns PatternFlowVlanIdChoiceEnum provided by user to PatternFlowVlanId + setChoice(value PatternFlowVlanIdChoiceEnum) PatternFlowVlanId + // HasChoice checks if Choice has been set in PatternFlowVlanId + HasChoice() bool + // Value returns uint32, set in PatternFlowVlanId. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowVlanId + SetValue(value uint32) PatternFlowVlanId + // HasValue checks if Value has been set in PatternFlowVlanId + HasValue() bool + // Values returns []uint32, set in PatternFlowVlanId. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowVlanId + SetValues(value []uint32) PatternFlowVlanId + // Increment returns PatternFlowVlanIdCounter, set in PatternFlowVlanId. + // PatternFlowVlanIdCounter is integer counter pattern + Increment() PatternFlowVlanIdCounter + // SetIncrement assigns PatternFlowVlanIdCounter provided by user to PatternFlowVlanId. + // PatternFlowVlanIdCounter is integer counter pattern + SetIncrement(value PatternFlowVlanIdCounter) PatternFlowVlanId + // HasIncrement checks if Increment has been set in PatternFlowVlanId + HasIncrement() bool + // Decrement returns PatternFlowVlanIdCounter, set in PatternFlowVlanId. + // PatternFlowVlanIdCounter is integer counter pattern + Decrement() PatternFlowVlanIdCounter + // SetDecrement assigns PatternFlowVlanIdCounter provided by user to PatternFlowVlanId. + // PatternFlowVlanIdCounter is integer counter pattern + SetDecrement(value PatternFlowVlanIdCounter) PatternFlowVlanId + // HasDecrement checks if Decrement has been set in PatternFlowVlanId + HasDecrement() bool + // MetricTags returns PatternFlowVlanIdPatternFlowVlanIdMetricTagIterIter, set in PatternFlowVlanId + MetricTags() PatternFlowVlanIdPatternFlowVlanIdMetricTagIter + setNil() +} + +type PatternFlowVlanIdChoiceEnum string + +// Enum of Choice on PatternFlowVlanId +var PatternFlowVlanIdChoice = struct { + VALUE PatternFlowVlanIdChoiceEnum + VALUES PatternFlowVlanIdChoiceEnum + INCREMENT PatternFlowVlanIdChoiceEnum + DECREMENT PatternFlowVlanIdChoiceEnum +}{ + VALUE: PatternFlowVlanIdChoiceEnum("value"), + VALUES: PatternFlowVlanIdChoiceEnum("values"), + INCREMENT: PatternFlowVlanIdChoiceEnum("increment"), + DECREMENT: PatternFlowVlanIdChoiceEnum("decrement"), +} + +func (obj *patternFlowVlanId) Choice() PatternFlowVlanIdChoiceEnum { + return PatternFlowVlanIdChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowVlanId) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowVlanId) setChoice(value PatternFlowVlanIdChoiceEnum) PatternFlowVlanId { + intValue, ok := otg.PatternFlowVlanId_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowVlanIdChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowVlanId_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowVlanIdChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowVlanIdChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowVlanIdChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowVlanIdCounter().msg() + } + + if value == PatternFlowVlanIdChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowVlanIdCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVlanId) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowVlanIdChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVlanId) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowVlanId object +func (obj *patternFlowVlanId) SetValue(value uint32) PatternFlowVlanId { + obj.setChoice(PatternFlowVlanIdChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowVlanId) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowVlanId object +func (obj *patternFlowVlanId) SetValues(value []uint32) PatternFlowVlanId { + obj.setChoice(PatternFlowVlanIdChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowVlanIdCounter +func (obj *patternFlowVlanId) Increment() PatternFlowVlanIdCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowVlanIdChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowVlanIdCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowVlanIdCounter +func (obj *patternFlowVlanId) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowVlanIdCounter value in the PatternFlowVlanId object +func (obj *patternFlowVlanId) SetIncrement(value PatternFlowVlanIdCounter) PatternFlowVlanId { + obj.setChoice(PatternFlowVlanIdChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowVlanIdCounter +func (obj *patternFlowVlanId) Decrement() PatternFlowVlanIdCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowVlanIdChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowVlanIdCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowVlanIdCounter +func (obj *patternFlowVlanId) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowVlanIdCounter value in the PatternFlowVlanId object +func (obj *patternFlowVlanId) SetDecrement(value PatternFlowVlanIdCounter) PatternFlowVlanId { + obj.setChoice(PatternFlowVlanIdChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowVlanIdMetricTag +func (obj *patternFlowVlanId) MetricTags() PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowVlanIdMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowVlanIdPatternFlowVlanIdMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowVlanIdPatternFlowVlanIdMetricTagIter struct { + obj *patternFlowVlanId + patternFlowVlanIdMetricTagSlice []PatternFlowVlanIdMetricTag + fieldPtr *[]*otg.PatternFlowVlanIdMetricTag +} + +func newPatternFlowVlanIdPatternFlowVlanIdMetricTagIter(ptr *[]*otg.PatternFlowVlanIdMetricTag) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { + return &patternFlowVlanIdPatternFlowVlanIdMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowVlanIdPatternFlowVlanIdMetricTagIter interface { + setMsg(*patternFlowVlanId) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter + Items() []PatternFlowVlanIdMetricTag + Add() PatternFlowVlanIdMetricTag + Append(items ...PatternFlowVlanIdMetricTag) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter + Set(index int, newObj PatternFlowVlanIdMetricTag) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter + Clear() PatternFlowVlanIdPatternFlowVlanIdMetricTagIter + clearHolderSlice() PatternFlowVlanIdPatternFlowVlanIdMetricTagIter + appendHolderSlice(item PatternFlowVlanIdMetricTag) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter +} + +func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) setMsg(msg *patternFlowVlanId) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowVlanIdMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) Items() []PatternFlowVlanIdMetricTag { + return obj.patternFlowVlanIdMetricTagSlice +} + +func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) Add() PatternFlowVlanIdMetricTag { + newObj := &otg.PatternFlowVlanIdMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowVlanIdMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowVlanIdMetricTagSlice = append(obj.patternFlowVlanIdMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) Append(items ...PatternFlowVlanIdMetricTag) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowVlanIdMetricTagSlice = append(obj.patternFlowVlanIdMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) Set(index int, newObj PatternFlowVlanIdMetricTag) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowVlanIdMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) Clear() PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowVlanIdMetricTag{} + obj.patternFlowVlanIdMetricTagSlice = []PatternFlowVlanIdMetricTag{} + } + return obj +} +func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) clearHolderSlice() PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { + if len(obj.patternFlowVlanIdMetricTagSlice) > 0 { + obj.patternFlowVlanIdMetricTagSlice = []PatternFlowVlanIdMetricTag{} + } + return obj +} +func (obj *patternFlowVlanIdPatternFlowVlanIdMetricTagIter) appendHolderSlice(item PatternFlowVlanIdMetricTag) PatternFlowVlanIdPatternFlowVlanIdMetricTagIter { + obj.patternFlowVlanIdMetricTagSlice = append(obj.patternFlowVlanIdMetricTagSlice, item) + return obj +} + +func (obj *patternFlowVlanId) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanId.Value <= 4095 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowVlanId.Values <= 4095 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowVlanIdMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowVlanId) setDefault() { + var choices_set int = 0 + var choice PatternFlowVlanIdChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowVlanIdChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowVlanIdChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowVlanIdChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowVlanIdChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowVlanIdChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVlanId") + } + } else { + intVal := otg.PatternFlowVlanId_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowVlanId_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_vlan_id_counter.go b/gosnappi/pattern_flow_vlan_id_counter.go new file mode 100644 index 00000000..0a1a71e9 --- /dev/null +++ b/gosnappi/pattern_flow_vlan_id_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowVlanIdCounter ***** +type patternFlowVlanIdCounter struct { + validation + obj *otg.PatternFlowVlanIdCounter + marshaller marshalPatternFlowVlanIdCounter + unMarshaller unMarshalPatternFlowVlanIdCounter +} + +func NewPatternFlowVlanIdCounter() PatternFlowVlanIdCounter { + obj := patternFlowVlanIdCounter{obj: &otg.PatternFlowVlanIdCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVlanIdCounter) msg() *otg.PatternFlowVlanIdCounter { + return obj.obj +} + +func (obj *patternFlowVlanIdCounter) setMsg(msg *otg.PatternFlowVlanIdCounter) PatternFlowVlanIdCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVlanIdCounter struct { + obj *patternFlowVlanIdCounter +} + +type marshalPatternFlowVlanIdCounter interface { + // ToProto marshals PatternFlowVlanIdCounter to protobuf object *otg.PatternFlowVlanIdCounter + ToProto() (*otg.PatternFlowVlanIdCounter, error) + // ToPbText marshals PatternFlowVlanIdCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVlanIdCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVlanIdCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVlanIdCounter struct { + obj *patternFlowVlanIdCounter +} + +type unMarshalPatternFlowVlanIdCounter interface { + // FromProto unmarshals PatternFlowVlanIdCounter from protobuf object *otg.PatternFlowVlanIdCounter + FromProto(msg *otg.PatternFlowVlanIdCounter) (PatternFlowVlanIdCounter, error) + // FromPbText unmarshals PatternFlowVlanIdCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVlanIdCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVlanIdCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVlanIdCounter) Marshal() marshalPatternFlowVlanIdCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVlanIdCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVlanIdCounter) Unmarshal() unMarshalPatternFlowVlanIdCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVlanIdCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVlanIdCounter) ToProto() (*otg.PatternFlowVlanIdCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVlanIdCounter) FromProto(msg *otg.PatternFlowVlanIdCounter) (PatternFlowVlanIdCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVlanIdCounter) 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 *unMarshalpatternFlowVlanIdCounter) 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 *marshalpatternFlowVlanIdCounter) 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 *unMarshalpatternFlowVlanIdCounter) 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 *marshalpatternFlowVlanIdCounter) 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 *unMarshalpatternFlowVlanIdCounter) 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 *patternFlowVlanIdCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVlanIdCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVlanIdCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVlanIdCounter) Clone() (PatternFlowVlanIdCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVlanIdCounter() + 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 +} + +// PatternFlowVlanIdCounter is integer counter pattern +type PatternFlowVlanIdCounter interface { + Validation + // msg marshals PatternFlowVlanIdCounter to protobuf object *otg.PatternFlowVlanIdCounter + // and doesn't set defaults + msg() *otg.PatternFlowVlanIdCounter + // setMsg unmarshals PatternFlowVlanIdCounter from protobuf object *otg.PatternFlowVlanIdCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowVlanIdCounter) PatternFlowVlanIdCounter + // provides marshal interface + Marshal() marshalPatternFlowVlanIdCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVlanIdCounter + // validate validates PatternFlowVlanIdCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVlanIdCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowVlanIdCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowVlanIdCounter + SetStart(value uint32) PatternFlowVlanIdCounter + // HasStart checks if Start has been set in PatternFlowVlanIdCounter + HasStart() bool + // Step returns uint32, set in PatternFlowVlanIdCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowVlanIdCounter + SetStep(value uint32) PatternFlowVlanIdCounter + // HasStep checks if Step has been set in PatternFlowVlanIdCounter + HasStep() bool + // Count returns uint32, set in PatternFlowVlanIdCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowVlanIdCounter + SetCount(value uint32) PatternFlowVlanIdCounter + // HasCount checks if Count has been set in PatternFlowVlanIdCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVlanIdCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVlanIdCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowVlanIdCounter object +func (obj *patternFlowVlanIdCounter) SetStart(value uint32) PatternFlowVlanIdCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVlanIdCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVlanIdCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowVlanIdCounter object +func (obj *patternFlowVlanIdCounter) SetStep(value uint32) PatternFlowVlanIdCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVlanIdCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVlanIdCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowVlanIdCounter object +func (obj *patternFlowVlanIdCounter) SetCount(value uint32) PatternFlowVlanIdCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowVlanIdCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanIdCounter.Start <= 4095 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanIdCounter.Step <= 4095 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 4095 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanIdCounter.Count <= 4095 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowVlanIdCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_vlan_id_metric_tag.go b/gosnappi/pattern_flow_vlan_id_metric_tag.go new file mode 100644 index 00000000..330c3214 --- /dev/null +++ b/gosnappi/pattern_flow_vlan_id_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowVlanIdMetricTag ***** +type patternFlowVlanIdMetricTag struct { + validation + obj *otg.PatternFlowVlanIdMetricTag + marshaller marshalPatternFlowVlanIdMetricTag + unMarshaller unMarshalPatternFlowVlanIdMetricTag +} + +func NewPatternFlowVlanIdMetricTag() PatternFlowVlanIdMetricTag { + obj := patternFlowVlanIdMetricTag{obj: &otg.PatternFlowVlanIdMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVlanIdMetricTag) msg() *otg.PatternFlowVlanIdMetricTag { + return obj.obj +} + +func (obj *patternFlowVlanIdMetricTag) setMsg(msg *otg.PatternFlowVlanIdMetricTag) PatternFlowVlanIdMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVlanIdMetricTag struct { + obj *patternFlowVlanIdMetricTag +} + +type marshalPatternFlowVlanIdMetricTag interface { + // ToProto marshals PatternFlowVlanIdMetricTag to protobuf object *otg.PatternFlowVlanIdMetricTag + ToProto() (*otg.PatternFlowVlanIdMetricTag, error) + // ToPbText marshals PatternFlowVlanIdMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVlanIdMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVlanIdMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVlanIdMetricTag struct { + obj *patternFlowVlanIdMetricTag +} + +type unMarshalPatternFlowVlanIdMetricTag interface { + // FromProto unmarshals PatternFlowVlanIdMetricTag from protobuf object *otg.PatternFlowVlanIdMetricTag + FromProto(msg *otg.PatternFlowVlanIdMetricTag) (PatternFlowVlanIdMetricTag, error) + // FromPbText unmarshals PatternFlowVlanIdMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVlanIdMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVlanIdMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVlanIdMetricTag) Marshal() marshalPatternFlowVlanIdMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVlanIdMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVlanIdMetricTag) Unmarshal() unMarshalPatternFlowVlanIdMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVlanIdMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVlanIdMetricTag) ToProto() (*otg.PatternFlowVlanIdMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVlanIdMetricTag) FromProto(msg *otg.PatternFlowVlanIdMetricTag) (PatternFlowVlanIdMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVlanIdMetricTag) 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 *unMarshalpatternFlowVlanIdMetricTag) 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 *marshalpatternFlowVlanIdMetricTag) 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 *unMarshalpatternFlowVlanIdMetricTag) 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 *marshalpatternFlowVlanIdMetricTag) 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 *unMarshalpatternFlowVlanIdMetricTag) 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 *patternFlowVlanIdMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVlanIdMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVlanIdMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVlanIdMetricTag) Clone() (PatternFlowVlanIdMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVlanIdMetricTag() + 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 +} + +// PatternFlowVlanIdMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowVlanIdMetricTag interface { + Validation + // msg marshals PatternFlowVlanIdMetricTag to protobuf object *otg.PatternFlowVlanIdMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowVlanIdMetricTag + // setMsg unmarshals PatternFlowVlanIdMetricTag from protobuf object *otg.PatternFlowVlanIdMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowVlanIdMetricTag) PatternFlowVlanIdMetricTag + // provides marshal interface + Marshal() marshalPatternFlowVlanIdMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVlanIdMetricTag + // validate validates PatternFlowVlanIdMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVlanIdMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowVlanIdMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowVlanIdMetricTag + SetName(value string) PatternFlowVlanIdMetricTag + // Offset returns uint32, set in PatternFlowVlanIdMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowVlanIdMetricTag + SetOffset(value uint32) PatternFlowVlanIdMetricTag + // HasOffset checks if Offset has been set in PatternFlowVlanIdMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowVlanIdMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowVlanIdMetricTag + SetLength(value uint32) PatternFlowVlanIdMetricTag + // HasLength checks if Length has been set in PatternFlowVlanIdMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowVlanIdMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowVlanIdMetricTag object +func (obj *patternFlowVlanIdMetricTag) SetName(value string) PatternFlowVlanIdMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVlanIdMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVlanIdMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowVlanIdMetricTag object +func (obj *patternFlowVlanIdMetricTag) SetOffset(value uint32) PatternFlowVlanIdMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVlanIdMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVlanIdMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowVlanIdMetricTag object +func (obj *patternFlowVlanIdMetricTag) SetLength(value uint32) PatternFlowVlanIdMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowVlanIdMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVlanIdMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 11 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanIdMetricTag.Offset <= 11 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 12 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowVlanIdMetricTag.Length <= 12 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowVlanIdMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(12) + } + +} diff --git a/gosnappi/pattern_flow_vlan_priority.go b/gosnappi/pattern_flow_vlan_priority.go new file mode 100644 index 00000000..5e9ea667 --- /dev/null +++ b/gosnappi/pattern_flow_vlan_priority.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowVlanPriority ***** +type patternFlowVlanPriority struct { + validation + obj *otg.PatternFlowVlanPriority + marshaller marshalPatternFlowVlanPriority + unMarshaller unMarshalPatternFlowVlanPriority + incrementHolder PatternFlowVlanPriorityCounter + decrementHolder PatternFlowVlanPriorityCounter + metricTagsHolder PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter +} + +func NewPatternFlowVlanPriority() PatternFlowVlanPriority { + obj := patternFlowVlanPriority{obj: &otg.PatternFlowVlanPriority{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVlanPriority) msg() *otg.PatternFlowVlanPriority { + return obj.obj +} + +func (obj *patternFlowVlanPriority) setMsg(msg *otg.PatternFlowVlanPriority) PatternFlowVlanPriority { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVlanPriority struct { + obj *patternFlowVlanPriority +} + +type marshalPatternFlowVlanPriority interface { + // ToProto marshals PatternFlowVlanPriority to protobuf object *otg.PatternFlowVlanPriority + ToProto() (*otg.PatternFlowVlanPriority, error) + // ToPbText marshals PatternFlowVlanPriority to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVlanPriority to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVlanPriority to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVlanPriority struct { + obj *patternFlowVlanPriority +} + +type unMarshalPatternFlowVlanPriority interface { + // FromProto unmarshals PatternFlowVlanPriority from protobuf object *otg.PatternFlowVlanPriority + FromProto(msg *otg.PatternFlowVlanPriority) (PatternFlowVlanPriority, error) + // FromPbText unmarshals PatternFlowVlanPriority from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVlanPriority from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVlanPriority from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVlanPriority) Marshal() marshalPatternFlowVlanPriority { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVlanPriority{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVlanPriority) Unmarshal() unMarshalPatternFlowVlanPriority { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVlanPriority{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVlanPriority) ToProto() (*otg.PatternFlowVlanPriority, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVlanPriority) FromProto(msg *otg.PatternFlowVlanPriority) (PatternFlowVlanPriority, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVlanPriority) 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 *unMarshalpatternFlowVlanPriority) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowVlanPriority) 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 *unMarshalpatternFlowVlanPriority) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowVlanPriority) 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 *unMarshalpatternFlowVlanPriority) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowVlanPriority) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVlanPriority) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVlanPriority) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVlanPriority) Clone() (PatternFlowVlanPriority, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVlanPriority() + 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 +} + +func (obj *patternFlowVlanPriority) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowVlanPriority is priority code point +type PatternFlowVlanPriority interface { + Validation + // msg marshals PatternFlowVlanPriority to protobuf object *otg.PatternFlowVlanPriority + // and doesn't set defaults + msg() *otg.PatternFlowVlanPriority + // setMsg unmarshals PatternFlowVlanPriority from protobuf object *otg.PatternFlowVlanPriority + // and doesn't set defaults + setMsg(*otg.PatternFlowVlanPriority) PatternFlowVlanPriority + // provides marshal interface + Marshal() marshalPatternFlowVlanPriority + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVlanPriority + // validate validates PatternFlowVlanPriority + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVlanPriority, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowVlanPriorityChoiceEnum, set in PatternFlowVlanPriority + Choice() PatternFlowVlanPriorityChoiceEnum + // setChoice assigns PatternFlowVlanPriorityChoiceEnum provided by user to PatternFlowVlanPriority + setChoice(value PatternFlowVlanPriorityChoiceEnum) PatternFlowVlanPriority + // HasChoice checks if Choice has been set in PatternFlowVlanPriority + HasChoice() bool + // Value returns uint32, set in PatternFlowVlanPriority. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowVlanPriority + SetValue(value uint32) PatternFlowVlanPriority + // HasValue checks if Value has been set in PatternFlowVlanPriority + HasValue() bool + // Values returns []uint32, set in PatternFlowVlanPriority. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowVlanPriority + SetValues(value []uint32) PatternFlowVlanPriority + // Increment returns PatternFlowVlanPriorityCounter, set in PatternFlowVlanPriority. + // PatternFlowVlanPriorityCounter is integer counter pattern + Increment() PatternFlowVlanPriorityCounter + // SetIncrement assigns PatternFlowVlanPriorityCounter provided by user to PatternFlowVlanPriority. + // PatternFlowVlanPriorityCounter is integer counter pattern + SetIncrement(value PatternFlowVlanPriorityCounter) PatternFlowVlanPriority + // HasIncrement checks if Increment has been set in PatternFlowVlanPriority + HasIncrement() bool + // Decrement returns PatternFlowVlanPriorityCounter, set in PatternFlowVlanPriority. + // PatternFlowVlanPriorityCounter is integer counter pattern + Decrement() PatternFlowVlanPriorityCounter + // SetDecrement assigns PatternFlowVlanPriorityCounter provided by user to PatternFlowVlanPriority. + // PatternFlowVlanPriorityCounter is integer counter pattern + SetDecrement(value PatternFlowVlanPriorityCounter) PatternFlowVlanPriority + // HasDecrement checks if Decrement has been set in PatternFlowVlanPriority + HasDecrement() bool + // MetricTags returns PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIterIter, set in PatternFlowVlanPriority + MetricTags() PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter + setNil() +} + +type PatternFlowVlanPriorityChoiceEnum string + +// Enum of Choice on PatternFlowVlanPriority +var PatternFlowVlanPriorityChoice = struct { + VALUE PatternFlowVlanPriorityChoiceEnum + VALUES PatternFlowVlanPriorityChoiceEnum + INCREMENT PatternFlowVlanPriorityChoiceEnum + DECREMENT PatternFlowVlanPriorityChoiceEnum +}{ + VALUE: PatternFlowVlanPriorityChoiceEnum("value"), + VALUES: PatternFlowVlanPriorityChoiceEnum("values"), + INCREMENT: PatternFlowVlanPriorityChoiceEnum("increment"), + DECREMENT: PatternFlowVlanPriorityChoiceEnum("decrement"), +} + +func (obj *patternFlowVlanPriority) Choice() PatternFlowVlanPriorityChoiceEnum { + return PatternFlowVlanPriorityChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowVlanPriority) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowVlanPriority) setChoice(value PatternFlowVlanPriorityChoiceEnum) PatternFlowVlanPriority { + intValue, ok := otg.PatternFlowVlanPriority_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowVlanPriorityChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowVlanPriority_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowVlanPriorityChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowVlanPriorityChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowVlanPriorityChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowVlanPriorityCounter().msg() + } + + if value == PatternFlowVlanPriorityChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowVlanPriorityCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVlanPriority) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowVlanPriorityChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVlanPriority) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowVlanPriority object +func (obj *patternFlowVlanPriority) SetValue(value uint32) PatternFlowVlanPriority { + obj.setChoice(PatternFlowVlanPriorityChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowVlanPriority) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowVlanPriority object +func (obj *patternFlowVlanPriority) SetValues(value []uint32) PatternFlowVlanPriority { + obj.setChoice(PatternFlowVlanPriorityChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowVlanPriorityCounter +func (obj *patternFlowVlanPriority) Increment() PatternFlowVlanPriorityCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowVlanPriorityChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowVlanPriorityCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowVlanPriorityCounter +func (obj *patternFlowVlanPriority) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowVlanPriorityCounter value in the PatternFlowVlanPriority object +func (obj *patternFlowVlanPriority) SetIncrement(value PatternFlowVlanPriorityCounter) PatternFlowVlanPriority { + obj.setChoice(PatternFlowVlanPriorityChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowVlanPriorityCounter +func (obj *patternFlowVlanPriority) Decrement() PatternFlowVlanPriorityCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowVlanPriorityChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowVlanPriorityCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowVlanPriorityCounter +func (obj *patternFlowVlanPriority) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowVlanPriorityCounter value in the PatternFlowVlanPriority object +func (obj *patternFlowVlanPriority) SetDecrement(value PatternFlowVlanPriorityCounter) PatternFlowVlanPriority { + obj.setChoice(PatternFlowVlanPriorityChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowVlanPriorityMetricTag +func (obj *patternFlowVlanPriority) MetricTags() PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowVlanPriorityMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter struct { + obj *patternFlowVlanPriority + patternFlowVlanPriorityMetricTagSlice []PatternFlowVlanPriorityMetricTag + fieldPtr *[]*otg.PatternFlowVlanPriorityMetricTag +} + +func newPatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter(ptr *[]*otg.PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { + return &patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter interface { + setMsg(*patternFlowVlanPriority) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter + Items() []PatternFlowVlanPriorityMetricTag + Add() PatternFlowVlanPriorityMetricTag + Append(items ...PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter + Set(index int, newObj PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter + Clear() PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter + clearHolderSlice() PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter + appendHolderSlice(item PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter +} + +func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) setMsg(msg *patternFlowVlanPriority) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowVlanPriorityMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) Items() []PatternFlowVlanPriorityMetricTag { + return obj.patternFlowVlanPriorityMetricTagSlice +} + +func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) Add() PatternFlowVlanPriorityMetricTag { + newObj := &otg.PatternFlowVlanPriorityMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowVlanPriorityMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowVlanPriorityMetricTagSlice = append(obj.patternFlowVlanPriorityMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) Append(items ...PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowVlanPriorityMetricTagSlice = append(obj.patternFlowVlanPriorityMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) Set(index int, newObj PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowVlanPriorityMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) Clear() PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowVlanPriorityMetricTag{} + obj.patternFlowVlanPriorityMetricTagSlice = []PatternFlowVlanPriorityMetricTag{} + } + return obj +} +func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) clearHolderSlice() PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { + if len(obj.patternFlowVlanPriorityMetricTagSlice) > 0 { + obj.patternFlowVlanPriorityMetricTagSlice = []PatternFlowVlanPriorityMetricTag{} + } + return obj +} +func (obj *patternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter) appendHolderSlice(item PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityPatternFlowVlanPriorityMetricTagIter { + obj.patternFlowVlanPriorityMetricTagSlice = append(obj.patternFlowVlanPriorityMetricTagSlice, item) + return obj +} + +func (obj *patternFlowVlanPriority) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanPriority.Value <= 7 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowVlanPriority.Values <= 7 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowVlanPriorityMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowVlanPriority) setDefault() { + var choices_set int = 0 + var choice PatternFlowVlanPriorityChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowVlanPriorityChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowVlanPriorityChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowVlanPriorityChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowVlanPriorityChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowVlanPriorityChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVlanPriority") + } + } else { + intVal := otg.PatternFlowVlanPriority_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowVlanPriority_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_vlan_priority_counter.go b/gosnappi/pattern_flow_vlan_priority_counter.go new file mode 100644 index 00000000..f0f0a740 --- /dev/null +++ b/gosnappi/pattern_flow_vlan_priority_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowVlanPriorityCounter ***** +type patternFlowVlanPriorityCounter struct { + validation + obj *otg.PatternFlowVlanPriorityCounter + marshaller marshalPatternFlowVlanPriorityCounter + unMarshaller unMarshalPatternFlowVlanPriorityCounter +} + +func NewPatternFlowVlanPriorityCounter() PatternFlowVlanPriorityCounter { + obj := patternFlowVlanPriorityCounter{obj: &otg.PatternFlowVlanPriorityCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVlanPriorityCounter) msg() *otg.PatternFlowVlanPriorityCounter { + return obj.obj +} + +func (obj *patternFlowVlanPriorityCounter) setMsg(msg *otg.PatternFlowVlanPriorityCounter) PatternFlowVlanPriorityCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVlanPriorityCounter struct { + obj *patternFlowVlanPriorityCounter +} + +type marshalPatternFlowVlanPriorityCounter interface { + // ToProto marshals PatternFlowVlanPriorityCounter to protobuf object *otg.PatternFlowVlanPriorityCounter + ToProto() (*otg.PatternFlowVlanPriorityCounter, error) + // ToPbText marshals PatternFlowVlanPriorityCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVlanPriorityCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVlanPriorityCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVlanPriorityCounter struct { + obj *patternFlowVlanPriorityCounter +} + +type unMarshalPatternFlowVlanPriorityCounter interface { + // FromProto unmarshals PatternFlowVlanPriorityCounter from protobuf object *otg.PatternFlowVlanPriorityCounter + FromProto(msg *otg.PatternFlowVlanPriorityCounter) (PatternFlowVlanPriorityCounter, error) + // FromPbText unmarshals PatternFlowVlanPriorityCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVlanPriorityCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVlanPriorityCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVlanPriorityCounter) Marshal() marshalPatternFlowVlanPriorityCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVlanPriorityCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVlanPriorityCounter) Unmarshal() unMarshalPatternFlowVlanPriorityCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVlanPriorityCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVlanPriorityCounter) ToProto() (*otg.PatternFlowVlanPriorityCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVlanPriorityCounter) FromProto(msg *otg.PatternFlowVlanPriorityCounter) (PatternFlowVlanPriorityCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVlanPriorityCounter) 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 *unMarshalpatternFlowVlanPriorityCounter) 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 *marshalpatternFlowVlanPriorityCounter) 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 *unMarshalpatternFlowVlanPriorityCounter) 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 *marshalpatternFlowVlanPriorityCounter) 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 *unMarshalpatternFlowVlanPriorityCounter) 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 *patternFlowVlanPriorityCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVlanPriorityCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVlanPriorityCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVlanPriorityCounter) Clone() (PatternFlowVlanPriorityCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVlanPriorityCounter() + 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 +} + +// PatternFlowVlanPriorityCounter is integer counter pattern +type PatternFlowVlanPriorityCounter interface { + Validation + // msg marshals PatternFlowVlanPriorityCounter to protobuf object *otg.PatternFlowVlanPriorityCounter + // and doesn't set defaults + msg() *otg.PatternFlowVlanPriorityCounter + // setMsg unmarshals PatternFlowVlanPriorityCounter from protobuf object *otg.PatternFlowVlanPriorityCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowVlanPriorityCounter) PatternFlowVlanPriorityCounter + // provides marshal interface + Marshal() marshalPatternFlowVlanPriorityCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVlanPriorityCounter + // validate validates PatternFlowVlanPriorityCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVlanPriorityCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowVlanPriorityCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowVlanPriorityCounter + SetStart(value uint32) PatternFlowVlanPriorityCounter + // HasStart checks if Start has been set in PatternFlowVlanPriorityCounter + HasStart() bool + // Step returns uint32, set in PatternFlowVlanPriorityCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowVlanPriorityCounter + SetStep(value uint32) PatternFlowVlanPriorityCounter + // HasStep checks if Step has been set in PatternFlowVlanPriorityCounter + HasStep() bool + // Count returns uint32, set in PatternFlowVlanPriorityCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowVlanPriorityCounter + SetCount(value uint32) PatternFlowVlanPriorityCounter + // HasCount checks if Count has been set in PatternFlowVlanPriorityCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVlanPriorityCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVlanPriorityCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowVlanPriorityCounter object +func (obj *patternFlowVlanPriorityCounter) SetStart(value uint32) PatternFlowVlanPriorityCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVlanPriorityCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVlanPriorityCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowVlanPriorityCounter object +func (obj *patternFlowVlanPriorityCounter) SetStep(value uint32) PatternFlowVlanPriorityCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVlanPriorityCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVlanPriorityCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowVlanPriorityCounter object +func (obj *patternFlowVlanPriorityCounter) SetCount(value uint32) PatternFlowVlanPriorityCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowVlanPriorityCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanPriorityCounter.Start <= 7 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanPriorityCounter.Step <= 7 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanPriorityCounter.Count <= 7 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowVlanPriorityCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_vlan_priority_metric_tag.go b/gosnappi/pattern_flow_vlan_priority_metric_tag.go new file mode 100644 index 00000000..7d6a726c --- /dev/null +++ b/gosnappi/pattern_flow_vlan_priority_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowVlanPriorityMetricTag ***** +type patternFlowVlanPriorityMetricTag struct { + validation + obj *otg.PatternFlowVlanPriorityMetricTag + marshaller marshalPatternFlowVlanPriorityMetricTag + unMarshaller unMarshalPatternFlowVlanPriorityMetricTag +} + +func NewPatternFlowVlanPriorityMetricTag() PatternFlowVlanPriorityMetricTag { + obj := patternFlowVlanPriorityMetricTag{obj: &otg.PatternFlowVlanPriorityMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVlanPriorityMetricTag) msg() *otg.PatternFlowVlanPriorityMetricTag { + return obj.obj +} + +func (obj *patternFlowVlanPriorityMetricTag) setMsg(msg *otg.PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVlanPriorityMetricTag struct { + obj *patternFlowVlanPriorityMetricTag +} + +type marshalPatternFlowVlanPriorityMetricTag interface { + // ToProto marshals PatternFlowVlanPriorityMetricTag to protobuf object *otg.PatternFlowVlanPriorityMetricTag + ToProto() (*otg.PatternFlowVlanPriorityMetricTag, error) + // ToPbText marshals PatternFlowVlanPriorityMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVlanPriorityMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVlanPriorityMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVlanPriorityMetricTag struct { + obj *patternFlowVlanPriorityMetricTag +} + +type unMarshalPatternFlowVlanPriorityMetricTag interface { + // FromProto unmarshals PatternFlowVlanPriorityMetricTag from protobuf object *otg.PatternFlowVlanPriorityMetricTag + FromProto(msg *otg.PatternFlowVlanPriorityMetricTag) (PatternFlowVlanPriorityMetricTag, error) + // FromPbText unmarshals PatternFlowVlanPriorityMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVlanPriorityMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVlanPriorityMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVlanPriorityMetricTag) Marshal() marshalPatternFlowVlanPriorityMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVlanPriorityMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVlanPriorityMetricTag) Unmarshal() unMarshalPatternFlowVlanPriorityMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVlanPriorityMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVlanPriorityMetricTag) ToProto() (*otg.PatternFlowVlanPriorityMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVlanPriorityMetricTag) FromProto(msg *otg.PatternFlowVlanPriorityMetricTag) (PatternFlowVlanPriorityMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVlanPriorityMetricTag) 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 *unMarshalpatternFlowVlanPriorityMetricTag) 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 *marshalpatternFlowVlanPriorityMetricTag) 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 *unMarshalpatternFlowVlanPriorityMetricTag) 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 *marshalpatternFlowVlanPriorityMetricTag) 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 *unMarshalpatternFlowVlanPriorityMetricTag) 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 *patternFlowVlanPriorityMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVlanPriorityMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVlanPriorityMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVlanPriorityMetricTag) Clone() (PatternFlowVlanPriorityMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVlanPriorityMetricTag() + 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 +} + +// PatternFlowVlanPriorityMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowVlanPriorityMetricTag interface { + Validation + // msg marshals PatternFlowVlanPriorityMetricTag to protobuf object *otg.PatternFlowVlanPriorityMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowVlanPriorityMetricTag + // setMsg unmarshals PatternFlowVlanPriorityMetricTag from protobuf object *otg.PatternFlowVlanPriorityMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowVlanPriorityMetricTag) PatternFlowVlanPriorityMetricTag + // provides marshal interface + Marshal() marshalPatternFlowVlanPriorityMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVlanPriorityMetricTag + // validate validates PatternFlowVlanPriorityMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVlanPriorityMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowVlanPriorityMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowVlanPriorityMetricTag + SetName(value string) PatternFlowVlanPriorityMetricTag + // Offset returns uint32, set in PatternFlowVlanPriorityMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowVlanPriorityMetricTag + SetOffset(value uint32) PatternFlowVlanPriorityMetricTag + // HasOffset checks if Offset has been set in PatternFlowVlanPriorityMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowVlanPriorityMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowVlanPriorityMetricTag + SetLength(value uint32) PatternFlowVlanPriorityMetricTag + // HasLength checks if Length has been set in PatternFlowVlanPriorityMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowVlanPriorityMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowVlanPriorityMetricTag object +func (obj *patternFlowVlanPriorityMetricTag) SetName(value string) PatternFlowVlanPriorityMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVlanPriorityMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVlanPriorityMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowVlanPriorityMetricTag object +func (obj *patternFlowVlanPriorityMetricTag) SetOffset(value uint32) PatternFlowVlanPriorityMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVlanPriorityMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVlanPriorityMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowVlanPriorityMetricTag object +func (obj *patternFlowVlanPriorityMetricTag) SetLength(value uint32) PatternFlowVlanPriorityMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowVlanPriorityMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVlanPriorityMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 2 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanPriorityMetricTag.Offset <= 2 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 3 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowVlanPriorityMetricTag.Length <= 3 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowVlanPriorityMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(3) + } + +} diff --git a/gosnappi/pattern_flow_vlan_tpid.go b/gosnappi/pattern_flow_vlan_tpid.go new file mode 100644 index 00000000..b8fbb785 --- /dev/null +++ b/gosnappi/pattern_flow_vlan_tpid.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowVlanTpid ***** +type patternFlowVlanTpid struct { + validation + obj *otg.PatternFlowVlanTpid + marshaller marshalPatternFlowVlanTpid + unMarshaller unMarshalPatternFlowVlanTpid + incrementHolder PatternFlowVlanTpidCounter + decrementHolder PatternFlowVlanTpidCounter + metricTagsHolder PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter +} + +func NewPatternFlowVlanTpid() PatternFlowVlanTpid { + obj := patternFlowVlanTpid{obj: &otg.PatternFlowVlanTpid{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVlanTpid) msg() *otg.PatternFlowVlanTpid { + return obj.obj +} + +func (obj *patternFlowVlanTpid) setMsg(msg *otg.PatternFlowVlanTpid) PatternFlowVlanTpid { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVlanTpid struct { + obj *patternFlowVlanTpid +} + +type marshalPatternFlowVlanTpid interface { + // ToProto marshals PatternFlowVlanTpid to protobuf object *otg.PatternFlowVlanTpid + ToProto() (*otg.PatternFlowVlanTpid, error) + // ToPbText marshals PatternFlowVlanTpid to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVlanTpid to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVlanTpid to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVlanTpid struct { + obj *patternFlowVlanTpid +} + +type unMarshalPatternFlowVlanTpid interface { + // FromProto unmarshals PatternFlowVlanTpid from protobuf object *otg.PatternFlowVlanTpid + FromProto(msg *otg.PatternFlowVlanTpid) (PatternFlowVlanTpid, error) + // FromPbText unmarshals PatternFlowVlanTpid from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVlanTpid from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVlanTpid from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVlanTpid) Marshal() marshalPatternFlowVlanTpid { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVlanTpid{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVlanTpid) Unmarshal() unMarshalPatternFlowVlanTpid { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVlanTpid{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVlanTpid) ToProto() (*otg.PatternFlowVlanTpid, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVlanTpid) FromProto(msg *otg.PatternFlowVlanTpid) (PatternFlowVlanTpid, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVlanTpid) 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 *unMarshalpatternFlowVlanTpid) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowVlanTpid) 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 *unMarshalpatternFlowVlanTpid) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowVlanTpid) 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 *unMarshalpatternFlowVlanTpid) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowVlanTpid) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVlanTpid) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVlanTpid) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVlanTpid) Clone() (PatternFlowVlanTpid, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVlanTpid() + 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 +} + +func (obj *patternFlowVlanTpid) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowVlanTpid is protocol identifier +type PatternFlowVlanTpid interface { + Validation + // msg marshals PatternFlowVlanTpid to protobuf object *otg.PatternFlowVlanTpid + // and doesn't set defaults + msg() *otg.PatternFlowVlanTpid + // setMsg unmarshals PatternFlowVlanTpid from protobuf object *otg.PatternFlowVlanTpid + // and doesn't set defaults + setMsg(*otg.PatternFlowVlanTpid) PatternFlowVlanTpid + // provides marshal interface + Marshal() marshalPatternFlowVlanTpid + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVlanTpid + // validate validates PatternFlowVlanTpid + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVlanTpid, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowVlanTpidChoiceEnum, set in PatternFlowVlanTpid + Choice() PatternFlowVlanTpidChoiceEnum + // setChoice assigns PatternFlowVlanTpidChoiceEnum provided by user to PatternFlowVlanTpid + setChoice(value PatternFlowVlanTpidChoiceEnum) PatternFlowVlanTpid + // HasChoice checks if Choice has been set in PatternFlowVlanTpid + HasChoice() bool + // Value returns uint32, set in PatternFlowVlanTpid. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowVlanTpid + SetValue(value uint32) PatternFlowVlanTpid + // HasValue checks if Value has been set in PatternFlowVlanTpid + HasValue() bool + // Values returns []uint32, set in PatternFlowVlanTpid. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowVlanTpid + SetValues(value []uint32) PatternFlowVlanTpid + // Increment returns PatternFlowVlanTpidCounter, set in PatternFlowVlanTpid. + // PatternFlowVlanTpidCounter is integer counter pattern + Increment() PatternFlowVlanTpidCounter + // SetIncrement assigns PatternFlowVlanTpidCounter provided by user to PatternFlowVlanTpid. + // PatternFlowVlanTpidCounter is integer counter pattern + SetIncrement(value PatternFlowVlanTpidCounter) PatternFlowVlanTpid + // HasIncrement checks if Increment has been set in PatternFlowVlanTpid + HasIncrement() bool + // Decrement returns PatternFlowVlanTpidCounter, set in PatternFlowVlanTpid. + // PatternFlowVlanTpidCounter is integer counter pattern + Decrement() PatternFlowVlanTpidCounter + // SetDecrement assigns PatternFlowVlanTpidCounter provided by user to PatternFlowVlanTpid. + // PatternFlowVlanTpidCounter is integer counter pattern + SetDecrement(value PatternFlowVlanTpidCounter) PatternFlowVlanTpid + // HasDecrement checks if Decrement has been set in PatternFlowVlanTpid + HasDecrement() bool + // MetricTags returns PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIterIter, set in PatternFlowVlanTpid + MetricTags() PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter + setNil() +} + +type PatternFlowVlanTpidChoiceEnum string + +// Enum of Choice on PatternFlowVlanTpid +var PatternFlowVlanTpidChoice = struct { + VALUE PatternFlowVlanTpidChoiceEnum + VALUES PatternFlowVlanTpidChoiceEnum + INCREMENT PatternFlowVlanTpidChoiceEnum + DECREMENT PatternFlowVlanTpidChoiceEnum +}{ + VALUE: PatternFlowVlanTpidChoiceEnum("value"), + VALUES: PatternFlowVlanTpidChoiceEnum("values"), + INCREMENT: PatternFlowVlanTpidChoiceEnum("increment"), + DECREMENT: PatternFlowVlanTpidChoiceEnum("decrement"), +} + +func (obj *patternFlowVlanTpid) Choice() PatternFlowVlanTpidChoiceEnum { + return PatternFlowVlanTpidChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowVlanTpid) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowVlanTpid) setChoice(value PatternFlowVlanTpidChoiceEnum) PatternFlowVlanTpid { + intValue, ok := otg.PatternFlowVlanTpid_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowVlanTpidChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowVlanTpid_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowVlanTpidChoice.VALUE { + defaultValue := uint32(65535) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowVlanTpidChoice.VALUES { + defaultValue := []uint32{65535} + obj.obj.Values = defaultValue + } + + if value == PatternFlowVlanTpidChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowVlanTpidCounter().msg() + } + + if value == PatternFlowVlanTpidChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowVlanTpidCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVlanTpid) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowVlanTpidChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVlanTpid) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowVlanTpid object +func (obj *patternFlowVlanTpid) SetValue(value uint32) PatternFlowVlanTpid { + obj.setChoice(PatternFlowVlanTpidChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowVlanTpid) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{65535}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowVlanTpid object +func (obj *patternFlowVlanTpid) SetValues(value []uint32) PatternFlowVlanTpid { + obj.setChoice(PatternFlowVlanTpidChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowVlanTpidCounter +func (obj *patternFlowVlanTpid) Increment() PatternFlowVlanTpidCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowVlanTpidChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowVlanTpidCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowVlanTpidCounter +func (obj *patternFlowVlanTpid) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowVlanTpidCounter value in the PatternFlowVlanTpid object +func (obj *patternFlowVlanTpid) SetIncrement(value PatternFlowVlanTpidCounter) PatternFlowVlanTpid { + obj.setChoice(PatternFlowVlanTpidChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowVlanTpidCounter +func (obj *patternFlowVlanTpid) Decrement() PatternFlowVlanTpidCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowVlanTpidChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowVlanTpidCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowVlanTpidCounter +func (obj *patternFlowVlanTpid) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowVlanTpidCounter value in the PatternFlowVlanTpid object +func (obj *patternFlowVlanTpid) SetDecrement(value PatternFlowVlanTpidCounter) PatternFlowVlanTpid { + obj.setChoice(PatternFlowVlanTpidChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowVlanTpidMetricTag +func (obj *patternFlowVlanTpid) MetricTags() PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowVlanTpidMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter struct { + obj *patternFlowVlanTpid + patternFlowVlanTpidMetricTagSlice []PatternFlowVlanTpidMetricTag + fieldPtr *[]*otg.PatternFlowVlanTpidMetricTag +} + +func newPatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter(ptr *[]*otg.PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { + return &patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter interface { + setMsg(*patternFlowVlanTpid) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter + Items() []PatternFlowVlanTpidMetricTag + Add() PatternFlowVlanTpidMetricTag + Append(items ...PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter + Set(index int, newObj PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter + Clear() PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter + clearHolderSlice() PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter + appendHolderSlice(item PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter +} + +func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) setMsg(msg *patternFlowVlanTpid) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowVlanTpidMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) Items() []PatternFlowVlanTpidMetricTag { + return obj.patternFlowVlanTpidMetricTagSlice +} + +func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) Add() PatternFlowVlanTpidMetricTag { + newObj := &otg.PatternFlowVlanTpidMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowVlanTpidMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowVlanTpidMetricTagSlice = append(obj.patternFlowVlanTpidMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) Append(items ...PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowVlanTpidMetricTagSlice = append(obj.patternFlowVlanTpidMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) Set(index int, newObj PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowVlanTpidMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) Clear() PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowVlanTpidMetricTag{} + obj.patternFlowVlanTpidMetricTagSlice = []PatternFlowVlanTpidMetricTag{} + } + return obj +} +func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) clearHolderSlice() PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { + if len(obj.patternFlowVlanTpidMetricTagSlice) > 0 { + obj.patternFlowVlanTpidMetricTagSlice = []PatternFlowVlanTpidMetricTag{} + } + return obj +} +func (obj *patternFlowVlanTpidPatternFlowVlanTpidMetricTagIter) appendHolderSlice(item PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidPatternFlowVlanTpidMetricTagIter { + obj.patternFlowVlanTpidMetricTagSlice = append(obj.patternFlowVlanTpidMetricTagSlice, item) + return obj +} + +func (obj *patternFlowVlanTpid) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanTpid.Value <= 65535 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowVlanTpid.Values <= 65535 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowVlanTpidMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowVlanTpid) setDefault() { + var choices_set int = 0 + var choice PatternFlowVlanTpidChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowVlanTpidChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowVlanTpidChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowVlanTpidChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowVlanTpidChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowVlanTpidChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVlanTpid") + } + } else { + intVal := otg.PatternFlowVlanTpid_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowVlanTpid_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_vlan_tpid_counter.go b/gosnappi/pattern_flow_vlan_tpid_counter.go new file mode 100644 index 00000000..187d079f --- /dev/null +++ b/gosnappi/pattern_flow_vlan_tpid_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowVlanTpidCounter ***** +type patternFlowVlanTpidCounter struct { + validation + obj *otg.PatternFlowVlanTpidCounter + marshaller marshalPatternFlowVlanTpidCounter + unMarshaller unMarshalPatternFlowVlanTpidCounter +} + +func NewPatternFlowVlanTpidCounter() PatternFlowVlanTpidCounter { + obj := patternFlowVlanTpidCounter{obj: &otg.PatternFlowVlanTpidCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVlanTpidCounter) msg() *otg.PatternFlowVlanTpidCounter { + return obj.obj +} + +func (obj *patternFlowVlanTpidCounter) setMsg(msg *otg.PatternFlowVlanTpidCounter) PatternFlowVlanTpidCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVlanTpidCounter struct { + obj *patternFlowVlanTpidCounter +} + +type marshalPatternFlowVlanTpidCounter interface { + // ToProto marshals PatternFlowVlanTpidCounter to protobuf object *otg.PatternFlowVlanTpidCounter + ToProto() (*otg.PatternFlowVlanTpidCounter, error) + // ToPbText marshals PatternFlowVlanTpidCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVlanTpidCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVlanTpidCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVlanTpidCounter struct { + obj *patternFlowVlanTpidCounter +} + +type unMarshalPatternFlowVlanTpidCounter interface { + // FromProto unmarshals PatternFlowVlanTpidCounter from protobuf object *otg.PatternFlowVlanTpidCounter + FromProto(msg *otg.PatternFlowVlanTpidCounter) (PatternFlowVlanTpidCounter, error) + // FromPbText unmarshals PatternFlowVlanTpidCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVlanTpidCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVlanTpidCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVlanTpidCounter) Marshal() marshalPatternFlowVlanTpidCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVlanTpidCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVlanTpidCounter) Unmarshal() unMarshalPatternFlowVlanTpidCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVlanTpidCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVlanTpidCounter) ToProto() (*otg.PatternFlowVlanTpidCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVlanTpidCounter) FromProto(msg *otg.PatternFlowVlanTpidCounter) (PatternFlowVlanTpidCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVlanTpidCounter) 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 *unMarshalpatternFlowVlanTpidCounter) 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 *marshalpatternFlowVlanTpidCounter) 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 *unMarshalpatternFlowVlanTpidCounter) 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 *marshalpatternFlowVlanTpidCounter) 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 *unMarshalpatternFlowVlanTpidCounter) 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 *patternFlowVlanTpidCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVlanTpidCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVlanTpidCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVlanTpidCounter) Clone() (PatternFlowVlanTpidCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVlanTpidCounter() + 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 +} + +// PatternFlowVlanTpidCounter is integer counter pattern +type PatternFlowVlanTpidCounter interface { + Validation + // msg marshals PatternFlowVlanTpidCounter to protobuf object *otg.PatternFlowVlanTpidCounter + // and doesn't set defaults + msg() *otg.PatternFlowVlanTpidCounter + // setMsg unmarshals PatternFlowVlanTpidCounter from protobuf object *otg.PatternFlowVlanTpidCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowVlanTpidCounter) PatternFlowVlanTpidCounter + // provides marshal interface + Marshal() marshalPatternFlowVlanTpidCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVlanTpidCounter + // validate validates PatternFlowVlanTpidCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVlanTpidCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowVlanTpidCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowVlanTpidCounter + SetStart(value uint32) PatternFlowVlanTpidCounter + // HasStart checks if Start has been set in PatternFlowVlanTpidCounter + HasStart() bool + // Step returns uint32, set in PatternFlowVlanTpidCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowVlanTpidCounter + SetStep(value uint32) PatternFlowVlanTpidCounter + // HasStep checks if Step has been set in PatternFlowVlanTpidCounter + HasStep() bool + // Count returns uint32, set in PatternFlowVlanTpidCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowVlanTpidCounter + SetCount(value uint32) PatternFlowVlanTpidCounter + // HasCount checks if Count has been set in PatternFlowVlanTpidCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVlanTpidCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVlanTpidCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowVlanTpidCounter object +func (obj *patternFlowVlanTpidCounter) SetStart(value uint32) PatternFlowVlanTpidCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVlanTpidCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVlanTpidCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowVlanTpidCounter object +func (obj *patternFlowVlanTpidCounter) SetStep(value uint32) PatternFlowVlanTpidCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVlanTpidCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVlanTpidCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowVlanTpidCounter object +func (obj *patternFlowVlanTpidCounter) SetCount(value uint32) PatternFlowVlanTpidCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowVlanTpidCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanTpidCounter.Start <= 65535 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanTpidCounter.Step <= 65535 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanTpidCounter.Count <= 65535 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowVlanTpidCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(65535) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_vlan_tpid_metric_tag.go b/gosnappi/pattern_flow_vlan_tpid_metric_tag.go new file mode 100644 index 00000000..dbdfec55 --- /dev/null +++ b/gosnappi/pattern_flow_vlan_tpid_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowVlanTpidMetricTag ***** +type patternFlowVlanTpidMetricTag struct { + validation + obj *otg.PatternFlowVlanTpidMetricTag + marshaller marshalPatternFlowVlanTpidMetricTag + unMarshaller unMarshalPatternFlowVlanTpidMetricTag +} + +func NewPatternFlowVlanTpidMetricTag() PatternFlowVlanTpidMetricTag { + obj := patternFlowVlanTpidMetricTag{obj: &otg.PatternFlowVlanTpidMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVlanTpidMetricTag) msg() *otg.PatternFlowVlanTpidMetricTag { + return obj.obj +} + +func (obj *patternFlowVlanTpidMetricTag) setMsg(msg *otg.PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVlanTpidMetricTag struct { + obj *patternFlowVlanTpidMetricTag +} + +type marshalPatternFlowVlanTpidMetricTag interface { + // ToProto marshals PatternFlowVlanTpidMetricTag to protobuf object *otg.PatternFlowVlanTpidMetricTag + ToProto() (*otg.PatternFlowVlanTpidMetricTag, error) + // ToPbText marshals PatternFlowVlanTpidMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVlanTpidMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVlanTpidMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVlanTpidMetricTag struct { + obj *patternFlowVlanTpidMetricTag +} + +type unMarshalPatternFlowVlanTpidMetricTag interface { + // FromProto unmarshals PatternFlowVlanTpidMetricTag from protobuf object *otg.PatternFlowVlanTpidMetricTag + FromProto(msg *otg.PatternFlowVlanTpidMetricTag) (PatternFlowVlanTpidMetricTag, error) + // FromPbText unmarshals PatternFlowVlanTpidMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVlanTpidMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVlanTpidMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVlanTpidMetricTag) Marshal() marshalPatternFlowVlanTpidMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVlanTpidMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVlanTpidMetricTag) Unmarshal() unMarshalPatternFlowVlanTpidMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVlanTpidMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVlanTpidMetricTag) ToProto() (*otg.PatternFlowVlanTpidMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVlanTpidMetricTag) FromProto(msg *otg.PatternFlowVlanTpidMetricTag) (PatternFlowVlanTpidMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVlanTpidMetricTag) 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 *unMarshalpatternFlowVlanTpidMetricTag) 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 *marshalpatternFlowVlanTpidMetricTag) 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 *unMarshalpatternFlowVlanTpidMetricTag) 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 *marshalpatternFlowVlanTpidMetricTag) 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 *unMarshalpatternFlowVlanTpidMetricTag) 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 *patternFlowVlanTpidMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVlanTpidMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVlanTpidMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVlanTpidMetricTag) Clone() (PatternFlowVlanTpidMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVlanTpidMetricTag() + 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 +} + +// PatternFlowVlanTpidMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowVlanTpidMetricTag interface { + Validation + // msg marshals PatternFlowVlanTpidMetricTag to protobuf object *otg.PatternFlowVlanTpidMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowVlanTpidMetricTag + // setMsg unmarshals PatternFlowVlanTpidMetricTag from protobuf object *otg.PatternFlowVlanTpidMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowVlanTpidMetricTag) PatternFlowVlanTpidMetricTag + // provides marshal interface + Marshal() marshalPatternFlowVlanTpidMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVlanTpidMetricTag + // validate validates PatternFlowVlanTpidMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVlanTpidMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowVlanTpidMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowVlanTpidMetricTag + SetName(value string) PatternFlowVlanTpidMetricTag + // Offset returns uint32, set in PatternFlowVlanTpidMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowVlanTpidMetricTag + SetOffset(value uint32) PatternFlowVlanTpidMetricTag + // HasOffset checks if Offset has been set in PatternFlowVlanTpidMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowVlanTpidMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowVlanTpidMetricTag + SetLength(value uint32) PatternFlowVlanTpidMetricTag + // HasLength checks if Length has been set in PatternFlowVlanTpidMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowVlanTpidMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowVlanTpidMetricTag object +func (obj *patternFlowVlanTpidMetricTag) SetName(value string) PatternFlowVlanTpidMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVlanTpidMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVlanTpidMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowVlanTpidMetricTag object +func (obj *patternFlowVlanTpidMetricTag) SetOffset(value uint32) PatternFlowVlanTpidMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVlanTpidMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVlanTpidMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowVlanTpidMetricTag object +func (obj *patternFlowVlanTpidMetricTag) SetLength(value uint32) PatternFlowVlanTpidMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowVlanTpidMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVlanTpidMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 15 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVlanTpidMetricTag.Offset <= 15 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowVlanTpidMetricTag.Length <= 16 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowVlanTpidMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(16) + } + +} diff --git a/gosnappi/pattern_flow_vxlan_flags.go b/gosnappi/pattern_flow_vxlan_flags.go new file mode 100644 index 00000000..6825bae1 --- /dev/null +++ b/gosnappi/pattern_flow_vxlan_flags.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowVxlanFlags ***** +type patternFlowVxlanFlags struct { + validation + obj *otg.PatternFlowVxlanFlags + marshaller marshalPatternFlowVxlanFlags + unMarshaller unMarshalPatternFlowVxlanFlags + incrementHolder PatternFlowVxlanFlagsCounter + decrementHolder PatternFlowVxlanFlagsCounter + metricTagsHolder PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter +} + +func NewPatternFlowVxlanFlags() PatternFlowVxlanFlags { + obj := patternFlowVxlanFlags{obj: &otg.PatternFlowVxlanFlags{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVxlanFlags) msg() *otg.PatternFlowVxlanFlags { + return obj.obj +} + +func (obj *patternFlowVxlanFlags) setMsg(msg *otg.PatternFlowVxlanFlags) PatternFlowVxlanFlags { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVxlanFlags struct { + obj *patternFlowVxlanFlags +} + +type marshalPatternFlowVxlanFlags interface { + // ToProto marshals PatternFlowVxlanFlags to protobuf object *otg.PatternFlowVxlanFlags + ToProto() (*otg.PatternFlowVxlanFlags, error) + // ToPbText marshals PatternFlowVxlanFlags to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVxlanFlags to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVxlanFlags to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVxlanFlags struct { + obj *patternFlowVxlanFlags +} + +type unMarshalPatternFlowVxlanFlags interface { + // FromProto unmarshals PatternFlowVxlanFlags from protobuf object *otg.PatternFlowVxlanFlags + FromProto(msg *otg.PatternFlowVxlanFlags) (PatternFlowVxlanFlags, error) + // FromPbText unmarshals PatternFlowVxlanFlags from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVxlanFlags from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVxlanFlags from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVxlanFlags) Marshal() marshalPatternFlowVxlanFlags { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVxlanFlags{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVxlanFlags) Unmarshal() unMarshalPatternFlowVxlanFlags { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVxlanFlags{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVxlanFlags) ToProto() (*otg.PatternFlowVxlanFlags, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVxlanFlags) FromProto(msg *otg.PatternFlowVxlanFlags) (PatternFlowVxlanFlags, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVxlanFlags) 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 *unMarshalpatternFlowVxlanFlags) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowVxlanFlags) 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 *unMarshalpatternFlowVxlanFlags) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowVxlanFlags) 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 *unMarshalpatternFlowVxlanFlags) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowVxlanFlags) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVxlanFlags) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVxlanFlags) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVxlanFlags) Clone() (PatternFlowVxlanFlags, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVxlanFlags() + 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 +} + +func (obj *patternFlowVxlanFlags) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowVxlanFlags is flags field with a bit format of RRRRIRRR. The I flag MUST be set to 1 for a valid vxlan network id (VNI). The other 7 bits (designated "R") are reserved fields and MUST be set to zero on transmission and ignored on receipt. +type PatternFlowVxlanFlags interface { + Validation + // msg marshals PatternFlowVxlanFlags to protobuf object *otg.PatternFlowVxlanFlags + // and doesn't set defaults + msg() *otg.PatternFlowVxlanFlags + // setMsg unmarshals PatternFlowVxlanFlags from protobuf object *otg.PatternFlowVxlanFlags + // and doesn't set defaults + setMsg(*otg.PatternFlowVxlanFlags) PatternFlowVxlanFlags + // provides marshal interface + Marshal() marshalPatternFlowVxlanFlags + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVxlanFlags + // validate validates PatternFlowVxlanFlags + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVxlanFlags, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowVxlanFlagsChoiceEnum, set in PatternFlowVxlanFlags + Choice() PatternFlowVxlanFlagsChoiceEnum + // setChoice assigns PatternFlowVxlanFlagsChoiceEnum provided by user to PatternFlowVxlanFlags + setChoice(value PatternFlowVxlanFlagsChoiceEnum) PatternFlowVxlanFlags + // HasChoice checks if Choice has been set in PatternFlowVxlanFlags + HasChoice() bool + // Value returns uint32, set in PatternFlowVxlanFlags. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowVxlanFlags + SetValue(value uint32) PatternFlowVxlanFlags + // HasValue checks if Value has been set in PatternFlowVxlanFlags + HasValue() bool + // Values returns []uint32, set in PatternFlowVxlanFlags. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowVxlanFlags + SetValues(value []uint32) PatternFlowVxlanFlags + // Increment returns PatternFlowVxlanFlagsCounter, set in PatternFlowVxlanFlags. + // PatternFlowVxlanFlagsCounter is integer counter pattern + Increment() PatternFlowVxlanFlagsCounter + // SetIncrement assigns PatternFlowVxlanFlagsCounter provided by user to PatternFlowVxlanFlags. + // PatternFlowVxlanFlagsCounter is integer counter pattern + SetIncrement(value PatternFlowVxlanFlagsCounter) PatternFlowVxlanFlags + // HasIncrement checks if Increment has been set in PatternFlowVxlanFlags + HasIncrement() bool + // Decrement returns PatternFlowVxlanFlagsCounter, set in PatternFlowVxlanFlags. + // PatternFlowVxlanFlagsCounter is integer counter pattern + Decrement() PatternFlowVxlanFlagsCounter + // SetDecrement assigns PatternFlowVxlanFlagsCounter provided by user to PatternFlowVxlanFlags. + // PatternFlowVxlanFlagsCounter is integer counter pattern + SetDecrement(value PatternFlowVxlanFlagsCounter) PatternFlowVxlanFlags + // HasDecrement checks if Decrement has been set in PatternFlowVxlanFlags + HasDecrement() bool + // MetricTags returns PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIterIter, set in PatternFlowVxlanFlags + MetricTags() PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter + setNil() +} + +type PatternFlowVxlanFlagsChoiceEnum string + +// Enum of Choice on PatternFlowVxlanFlags +var PatternFlowVxlanFlagsChoice = struct { + VALUE PatternFlowVxlanFlagsChoiceEnum + VALUES PatternFlowVxlanFlagsChoiceEnum + INCREMENT PatternFlowVxlanFlagsChoiceEnum + DECREMENT PatternFlowVxlanFlagsChoiceEnum +}{ + VALUE: PatternFlowVxlanFlagsChoiceEnum("value"), + VALUES: PatternFlowVxlanFlagsChoiceEnum("values"), + INCREMENT: PatternFlowVxlanFlagsChoiceEnum("increment"), + DECREMENT: PatternFlowVxlanFlagsChoiceEnum("decrement"), +} + +func (obj *patternFlowVxlanFlags) Choice() PatternFlowVxlanFlagsChoiceEnum { + return PatternFlowVxlanFlagsChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowVxlanFlags) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowVxlanFlags) setChoice(value PatternFlowVxlanFlagsChoiceEnum) PatternFlowVxlanFlags { + intValue, ok := otg.PatternFlowVxlanFlags_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowVxlanFlagsChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowVxlanFlags_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowVxlanFlagsChoice.VALUE { + defaultValue := uint32(8) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowVxlanFlagsChoice.VALUES { + defaultValue := []uint32{8} + obj.obj.Values = defaultValue + } + + if value == PatternFlowVxlanFlagsChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowVxlanFlagsCounter().msg() + } + + if value == PatternFlowVxlanFlagsChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowVxlanFlagsCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVxlanFlags) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowVxlanFlagsChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVxlanFlags) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowVxlanFlags object +func (obj *patternFlowVxlanFlags) SetValue(value uint32) PatternFlowVxlanFlags { + obj.setChoice(PatternFlowVxlanFlagsChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowVxlanFlags) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{8}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowVxlanFlags object +func (obj *patternFlowVxlanFlags) SetValues(value []uint32) PatternFlowVxlanFlags { + obj.setChoice(PatternFlowVxlanFlagsChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowVxlanFlagsCounter +func (obj *patternFlowVxlanFlags) Increment() PatternFlowVxlanFlagsCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowVxlanFlagsChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowVxlanFlagsCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowVxlanFlagsCounter +func (obj *patternFlowVxlanFlags) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowVxlanFlagsCounter value in the PatternFlowVxlanFlags object +func (obj *patternFlowVxlanFlags) SetIncrement(value PatternFlowVxlanFlagsCounter) PatternFlowVxlanFlags { + obj.setChoice(PatternFlowVxlanFlagsChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowVxlanFlagsCounter +func (obj *patternFlowVxlanFlags) Decrement() PatternFlowVxlanFlagsCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowVxlanFlagsChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowVxlanFlagsCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowVxlanFlagsCounter +func (obj *patternFlowVxlanFlags) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowVxlanFlagsCounter value in the PatternFlowVxlanFlags object +func (obj *patternFlowVxlanFlags) SetDecrement(value PatternFlowVxlanFlagsCounter) PatternFlowVxlanFlags { + obj.setChoice(PatternFlowVxlanFlagsChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowVxlanFlagsMetricTag +func (obj *patternFlowVxlanFlags) MetricTags() PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowVxlanFlagsMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter struct { + obj *patternFlowVxlanFlags + patternFlowVxlanFlagsMetricTagSlice []PatternFlowVxlanFlagsMetricTag + fieldPtr *[]*otg.PatternFlowVxlanFlagsMetricTag +} + +func newPatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter(ptr *[]*otg.PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { + return &patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter interface { + setMsg(*patternFlowVxlanFlags) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter + Items() []PatternFlowVxlanFlagsMetricTag + Add() PatternFlowVxlanFlagsMetricTag + Append(items ...PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter + Set(index int, newObj PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter + Clear() PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter + clearHolderSlice() PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter + appendHolderSlice(item PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter +} + +func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) setMsg(msg *patternFlowVxlanFlags) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowVxlanFlagsMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) Items() []PatternFlowVxlanFlagsMetricTag { + return obj.patternFlowVxlanFlagsMetricTagSlice +} + +func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) Add() PatternFlowVxlanFlagsMetricTag { + newObj := &otg.PatternFlowVxlanFlagsMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowVxlanFlagsMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowVxlanFlagsMetricTagSlice = append(obj.patternFlowVxlanFlagsMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) Append(items ...PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowVxlanFlagsMetricTagSlice = append(obj.patternFlowVxlanFlagsMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) Set(index int, newObj PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowVxlanFlagsMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) Clear() PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowVxlanFlagsMetricTag{} + obj.patternFlowVxlanFlagsMetricTagSlice = []PatternFlowVxlanFlagsMetricTag{} + } + return obj +} +func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) clearHolderSlice() PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { + if len(obj.patternFlowVxlanFlagsMetricTagSlice) > 0 { + obj.patternFlowVxlanFlagsMetricTagSlice = []PatternFlowVxlanFlagsMetricTag{} + } + return obj +} +func (obj *patternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter) appendHolderSlice(item PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsPatternFlowVxlanFlagsMetricTagIter { + obj.patternFlowVxlanFlagsMetricTagSlice = append(obj.patternFlowVxlanFlagsMetricTagSlice, item) + return obj +} + +func (obj *patternFlowVxlanFlags) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanFlags.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowVxlanFlags.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowVxlanFlagsMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowVxlanFlags) setDefault() { + var choices_set int = 0 + var choice PatternFlowVxlanFlagsChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowVxlanFlagsChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowVxlanFlagsChoice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowVxlanFlagsChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowVxlanFlagsChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowVxlanFlagsChoice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVxlanFlags") + } + } else { + intVal := otg.PatternFlowVxlanFlags_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowVxlanFlags_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_vxlan_flags_counter.go b/gosnappi/pattern_flow_vxlan_flags_counter.go new file mode 100644 index 00000000..b29afc08 --- /dev/null +++ b/gosnappi/pattern_flow_vxlan_flags_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowVxlanFlagsCounter ***** +type patternFlowVxlanFlagsCounter struct { + validation + obj *otg.PatternFlowVxlanFlagsCounter + marshaller marshalPatternFlowVxlanFlagsCounter + unMarshaller unMarshalPatternFlowVxlanFlagsCounter +} + +func NewPatternFlowVxlanFlagsCounter() PatternFlowVxlanFlagsCounter { + obj := patternFlowVxlanFlagsCounter{obj: &otg.PatternFlowVxlanFlagsCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVxlanFlagsCounter) msg() *otg.PatternFlowVxlanFlagsCounter { + return obj.obj +} + +func (obj *patternFlowVxlanFlagsCounter) setMsg(msg *otg.PatternFlowVxlanFlagsCounter) PatternFlowVxlanFlagsCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVxlanFlagsCounter struct { + obj *patternFlowVxlanFlagsCounter +} + +type marshalPatternFlowVxlanFlagsCounter interface { + // ToProto marshals PatternFlowVxlanFlagsCounter to protobuf object *otg.PatternFlowVxlanFlagsCounter + ToProto() (*otg.PatternFlowVxlanFlagsCounter, error) + // ToPbText marshals PatternFlowVxlanFlagsCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVxlanFlagsCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVxlanFlagsCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVxlanFlagsCounter struct { + obj *patternFlowVxlanFlagsCounter +} + +type unMarshalPatternFlowVxlanFlagsCounter interface { + // FromProto unmarshals PatternFlowVxlanFlagsCounter from protobuf object *otg.PatternFlowVxlanFlagsCounter + FromProto(msg *otg.PatternFlowVxlanFlagsCounter) (PatternFlowVxlanFlagsCounter, error) + // FromPbText unmarshals PatternFlowVxlanFlagsCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVxlanFlagsCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVxlanFlagsCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVxlanFlagsCounter) Marshal() marshalPatternFlowVxlanFlagsCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVxlanFlagsCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVxlanFlagsCounter) Unmarshal() unMarshalPatternFlowVxlanFlagsCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVxlanFlagsCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVxlanFlagsCounter) ToProto() (*otg.PatternFlowVxlanFlagsCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVxlanFlagsCounter) FromProto(msg *otg.PatternFlowVxlanFlagsCounter) (PatternFlowVxlanFlagsCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVxlanFlagsCounter) 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 *unMarshalpatternFlowVxlanFlagsCounter) 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 *marshalpatternFlowVxlanFlagsCounter) 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 *unMarshalpatternFlowVxlanFlagsCounter) 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 *marshalpatternFlowVxlanFlagsCounter) 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 *unMarshalpatternFlowVxlanFlagsCounter) 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 *patternFlowVxlanFlagsCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVxlanFlagsCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVxlanFlagsCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVxlanFlagsCounter) Clone() (PatternFlowVxlanFlagsCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVxlanFlagsCounter() + 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 +} + +// PatternFlowVxlanFlagsCounter is integer counter pattern +type PatternFlowVxlanFlagsCounter interface { + Validation + // msg marshals PatternFlowVxlanFlagsCounter to protobuf object *otg.PatternFlowVxlanFlagsCounter + // and doesn't set defaults + msg() *otg.PatternFlowVxlanFlagsCounter + // setMsg unmarshals PatternFlowVxlanFlagsCounter from protobuf object *otg.PatternFlowVxlanFlagsCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowVxlanFlagsCounter) PatternFlowVxlanFlagsCounter + // provides marshal interface + Marshal() marshalPatternFlowVxlanFlagsCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVxlanFlagsCounter + // validate validates PatternFlowVxlanFlagsCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVxlanFlagsCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowVxlanFlagsCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowVxlanFlagsCounter + SetStart(value uint32) PatternFlowVxlanFlagsCounter + // HasStart checks if Start has been set in PatternFlowVxlanFlagsCounter + HasStart() bool + // Step returns uint32, set in PatternFlowVxlanFlagsCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowVxlanFlagsCounter + SetStep(value uint32) PatternFlowVxlanFlagsCounter + // HasStep checks if Step has been set in PatternFlowVxlanFlagsCounter + HasStep() bool + // Count returns uint32, set in PatternFlowVxlanFlagsCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowVxlanFlagsCounter + SetCount(value uint32) PatternFlowVxlanFlagsCounter + // HasCount checks if Count has been set in PatternFlowVxlanFlagsCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVxlanFlagsCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVxlanFlagsCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowVxlanFlagsCounter object +func (obj *patternFlowVxlanFlagsCounter) SetStart(value uint32) PatternFlowVxlanFlagsCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVxlanFlagsCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVxlanFlagsCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowVxlanFlagsCounter object +func (obj *patternFlowVxlanFlagsCounter) SetStep(value uint32) PatternFlowVxlanFlagsCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVxlanFlagsCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVxlanFlagsCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowVxlanFlagsCounter object +func (obj *patternFlowVxlanFlagsCounter) SetCount(value uint32) PatternFlowVxlanFlagsCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowVxlanFlagsCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanFlagsCounter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanFlagsCounter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanFlagsCounter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowVxlanFlagsCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(8) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_vxlan_flags_metric_tag.go b/gosnappi/pattern_flow_vxlan_flags_metric_tag.go new file mode 100644 index 00000000..476cfd6e --- /dev/null +++ b/gosnappi/pattern_flow_vxlan_flags_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowVxlanFlagsMetricTag ***** +type patternFlowVxlanFlagsMetricTag struct { + validation + obj *otg.PatternFlowVxlanFlagsMetricTag + marshaller marshalPatternFlowVxlanFlagsMetricTag + unMarshaller unMarshalPatternFlowVxlanFlagsMetricTag +} + +func NewPatternFlowVxlanFlagsMetricTag() PatternFlowVxlanFlagsMetricTag { + obj := patternFlowVxlanFlagsMetricTag{obj: &otg.PatternFlowVxlanFlagsMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVxlanFlagsMetricTag) msg() *otg.PatternFlowVxlanFlagsMetricTag { + return obj.obj +} + +func (obj *patternFlowVxlanFlagsMetricTag) setMsg(msg *otg.PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVxlanFlagsMetricTag struct { + obj *patternFlowVxlanFlagsMetricTag +} + +type marshalPatternFlowVxlanFlagsMetricTag interface { + // ToProto marshals PatternFlowVxlanFlagsMetricTag to protobuf object *otg.PatternFlowVxlanFlagsMetricTag + ToProto() (*otg.PatternFlowVxlanFlagsMetricTag, error) + // ToPbText marshals PatternFlowVxlanFlagsMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVxlanFlagsMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVxlanFlagsMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVxlanFlagsMetricTag struct { + obj *patternFlowVxlanFlagsMetricTag +} + +type unMarshalPatternFlowVxlanFlagsMetricTag interface { + // FromProto unmarshals PatternFlowVxlanFlagsMetricTag from protobuf object *otg.PatternFlowVxlanFlagsMetricTag + FromProto(msg *otg.PatternFlowVxlanFlagsMetricTag) (PatternFlowVxlanFlagsMetricTag, error) + // FromPbText unmarshals PatternFlowVxlanFlagsMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVxlanFlagsMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVxlanFlagsMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVxlanFlagsMetricTag) Marshal() marshalPatternFlowVxlanFlagsMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVxlanFlagsMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVxlanFlagsMetricTag) Unmarshal() unMarshalPatternFlowVxlanFlagsMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVxlanFlagsMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVxlanFlagsMetricTag) ToProto() (*otg.PatternFlowVxlanFlagsMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVxlanFlagsMetricTag) FromProto(msg *otg.PatternFlowVxlanFlagsMetricTag) (PatternFlowVxlanFlagsMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVxlanFlagsMetricTag) 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 *unMarshalpatternFlowVxlanFlagsMetricTag) 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 *marshalpatternFlowVxlanFlagsMetricTag) 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 *unMarshalpatternFlowVxlanFlagsMetricTag) 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 *marshalpatternFlowVxlanFlagsMetricTag) 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 *unMarshalpatternFlowVxlanFlagsMetricTag) 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 *patternFlowVxlanFlagsMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVxlanFlagsMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVxlanFlagsMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVxlanFlagsMetricTag) Clone() (PatternFlowVxlanFlagsMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVxlanFlagsMetricTag() + 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 +} + +// PatternFlowVxlanFlagsMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowVxlanFlagsMetricTag interface { + Validation + // msg marshals PatternFlowVxlanFlagsMetricTag to protobuf object *otg.PatternFlowVxlanFlagsMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowVxlanFlagsMetricTag + // setMsg unmarshals PatternFlowVxlanFlagsMetricTag from protobuf object *otg.PatternFlowVxlanFlagsMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowVxlanFlagsMetricTag) PatternFlowVxlanFlagsMetricTag + // provides marshal interface + Marshal() marshalPatternFlowVxlanFlagsMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVxlanFlagsMetricTag + // validate validates PatternFlowVxlanFlagsMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVxlanFlagsMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowVxlanFlagsMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowVxlanFlagsMetricTag + SetName(value string) PatternFlowVxlanFlagsMetricTag + // Offset returns uint32, set in PatternFlowVxlanFlagsMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowVxlanFlagsMetricTag + SetOffset(value uint32) PatternFlowVxlanFlagsMetricTag + // HasOffset checks if Offset has been set in PatternFlowVxlanFlagsMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowVxlanFlagsMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowVxlanFlagsMetricTag + SetLength(value uint32) PatternFlowVxlanFlagsMetricTag + // HasLength checks if Length has been set in PatternFlowVxlanFlagsMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowVxlanFlagsMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowVxlanFlagsMetricTag object +func (obj *patternFlowVxlanFlagsMetricTag) SetName(value string) PatternFlowVxlanFlagsMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVxlanFlagsMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVxlanFlagsMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowVxlanFlagsMetricTag object +func (obj *patternFlowVxlanFlagsMetricTag) SetOffset(value uint32) PatternFlowVxlanFlagsMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVxlanFlagsMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVxlanFlagsMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowVxlanFlagsMetricTag object +func (obj *patternFlowVxlanFlagsMetricTag) SetLength(value uint32) PatternFlowVxlanFlagsMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowVxlanFlagsMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVxlanFlagsMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanFlagsMetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowVxlanFlagsMetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowVxlanFlagsMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_vxlan_reserved0.go b/gosnappi/pattern_flow_vxlan_reserved0.go new file mode 100644 index 00000000..ceeca14d --- /dev/null +++ b/gosnappi/pattern_flow_vxlan_reserved0.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowVxlanReserved0 ***** +type patternFlowVxlanReserved0 struct { + validation + obj *otg.PatternFlowVxlanReserved0 + marshaller marshalPatternFlowVxlanReserved0 + unMarshaller unMarshalPatternFlowVxlanReserved0 + incrementHolder PatternFlowVxlanReserved0Counter + decrementHolder PatternFlowVxlanReserved0Counter + metricTagsHolder PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter +} + +func NewPatternFlowVxlanReserved0() PatternFlowVxlanReserved0 { + obj := patternFlowVxlanReserved0{obj: &otg.PatternFlowVxlanReserved0{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVxlanReserved0) msg() *otg.PatternFlowVxlanReserved0 { + return obj.obj +} + +func (obj *patternFlowVxlanReserved0) setMsg(msg *otg.PatternFlowVxlanReserved0) PatternFlowVxlanReserved0 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVxlanReserved0 struct { + obj *patternFlowVxlanReserved0 +} + +type marshalPatternFlowVxlanReserved0 interface { + // ToProto marshals PatternFlowVxlanReserved0 to protobuf object *otg.PatternFlowVxlanReserved0 + ToProto() (*otg.PatternFlowVxlanReserved0, error) + // ToPbText marshals PatternFlowVxlanReserved0 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVxlanReserved0 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVxlanReserved0 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVxlanReserved0 struct { + obj *patternFlowVxlanReserved0 +} + +type unMarshalPatternFlowVxlanReserved0 interface { + // FromProto unmarshals PatternFlowVxlanReserved0 from protobuf object *otg.PatternFlowVxlanReserved0 + FromProto(msg *otg.PatternFlowVxlanReserved0) (PatternFlowVxlanReserved0, error) + // FromPbText unmarshals PatternFlowVxlanReserved0 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVxlanReserved0 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVxlanReserved0 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVxlanReserved0) Marshal() marshalPatternFlowVxlanReserved0 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVxlanReserved0{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVxlanReserved0) Unmarshal() unMarshalPatternFlowVxlanReserved0 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVxlanReserved0{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVxlanReserved0) ToProto() (*otg.PatternFlowVxlanReserved0, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVxlanReserved0) FromProto(msg *otg.PatternFlowVxlanReserved0) (PatternFlowVxlanReserved0, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVxlanReserved0) 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 *unMarshalpatternFlowVxlanReserved0) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowVxlanReserved0) 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 *unMarshalpatternFlowVxlanReserved0) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowVxlanReserved0) 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 *unMarshalpatternFlowVxlanReserved0) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowVxlanReserved0) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVxlanReserved0) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVxlanReserved0) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVxlanReserved0) Clone() (PatternFlowVxlanReserved0, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVxlanReserved0() + 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 +} + +func (obj *patternFlowVxlanReserved0) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowVxlanReserved0 is reserved field +type PatternFlowVxlanReserved0 interface { + Validation + // msg marshals PatternFlowVxlanReserved0 to protobuf object *otg.PatternFlowVxlanReserved0 + // and doesn't set defaults + msg() *otg.PatternFlowVxlanReserved0 + // setMsg unmarshals PatternFlowVxlanReserved0 from protobuf object *otg.PatternFlowVxlanReserved0 + // and doesn't set defaults + setMsg(*otg.PatternFlowVxlanReserved0) PatternFlowVxlanReserved0 + // provides marshal interface + Marshal() marshalPatternFlowVxlanReserved0 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVxlanReserved0 + // validate validates PatternFlowVxlanReserved0 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVxlanReserved0, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowVxlanReserved0ChoiceEnum, set in PatternFlowVxlanReserved0 + Choice() PatternFlowVxlanReserved0ChoiceEnum + // setChoice assigns PatternFlowVxlanReserved0ChoiceEnum provided by user to PatternFlowVxlanReserved0 + setChoice(value PatternFlowVxlanReserved0ChoiceEnum) PatternFlowVxlanReserved0 + // HasChoice checks if Choice has been set in PatternFlowVxlanReserved0 + HasChoice() bool + // Value returns uint32, set in PatternFlowVxlanReserved0. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowVxlanReserved0 + SetValue(value uint32) PatternFlowVxlanReserved0 + // HasValue checks if Value has been set in PatternFlowVxlanReserved0 + HasValue() bool + // Values returns []uint32, set in PatternFlowVxlanReserved0. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowVxlanReserved0 + SetValues(value []uint32) PatternFlowVxlanReserved0 + // Increment returns PatternFlowVxlanReserved0Counter, set in PatternFlowVxlanReserved0. + // PatternFlowVxlanReserved0Counter is integer counter pattern + Increment() PatternFlowVxlanReserved0Counter + // SetIncrement assigns PatternFlowVxlanReserved0Counter provided by user to PatternFlowVxlanReserved0. + // PatternFlowVxlanReserved0Counter is integer counter pattern + SetIncrement(value PatternFlowVxlanReserved0Counter) PatternFlowVxlanReserved0 + // HasIncrement checks if Increment has been set in PatternFlowVxlanReserved0 + HasIncrement() bool + // Decrement returns PatternFlowVxlanReserved0Counter, set in PatternFlowVxlanReserved0. + // PatternFlowVxlanReserved0Counter is integer counter pattern + Decrement() PatternFlowVxlanReserved0Counter + // SetDecrement assigns PatternFlowVxlanReserved0Counter provided by user to PatternFlowVxlanReserved0. + // PatternFlowVxlanReserved0Counter is integer counter pattern + SetDecrement(value PatternFlowVxlanReserved0Counter) PatternFlowVxlanReserved0 + // HasDecrement checks if Decrement has been set in PatternFlowVxlanReserved0 + HasDecrement() bool + // MetricTags returns PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIterIter, set in PatternFlowVxlanReserved0 + MetricTags() PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter + setNil() +} + +type PatternFlowVxlanReserved0ChoiceEnum string + +// Enum of Choice on PatternFlowVxlanReserved0 +var PatternFlowVxlanReserved0Choice = struct { + VALUE PatternFlowVxlanReserved0ChoiceEnum + VALUES PatternFlowVxlanReserved0ChoiceEnum + INCREMENT PatternFlowVxlanReserved0ChoiceEnum + DECREMENT PatternFlowVxlanReserved0ChoiceEnum +}{ + VALUE: PatternFlowVxlanReserved0ChoiceEnum("value"), + VALUES: PatternFlowVxlanReserved0ChoiceEnum("values"), + INCREMENT: PatternFlowVxlanReserved0ChoiceEnum("increment"), + DECREMENT: PatternFlowVxlanReserved0ChoiceEnum("decrement"), +} + +func (obj *patternFlowVxlanReserved0) Choice() PatternFlowVxlanReserved0ChoiceEnum { + return PatternFlowVxlanReserved0ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowVxlanReserved0) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowVxlanReserved0) setChoice(value PatternFlowVxlanReserved0ChoiceEnum) PatternFlowVxlanReserved0 { + intValue, ok := otg.PatternFlowVxlanReserved0_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowVxlanReserved0ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowVxlanReserved0_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowVxlanReserved0Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowVxlanReserved0Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowVxlanReserved0Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowVxlanReserved0Counter().msg() + } + + if value == PatternFlowVxlanReserved0Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowVxlanReserved0Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVxlanReserved0) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowVxlanReserved0Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVxlanReserved0) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowVxlanReserved0 object +func (obj *patternFlowVxlanReserved0) SetValue(value uint32) PatternFlowVxlanReserved0 { + obj.setChoice(PatternFlowVxlanReserved0Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowVxlanReserved0) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowVxlanReserved0 object +func (obj *patternFlowVxlanReserved0) SetValues(value []uint32) PatternFlowVxlanReserved0 { + obj.setChoice(PatternFlowVxlanReserved0Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowVxlanReserved0Counter +func (obj *patternFlowVxlanReserved0) Increment() PatternFlowVxlanReserved0Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowVxlanReserved0Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowVxlanReserved0Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowVxlanReserved0Counter +func (obj *patternFlowVxlanReserved0) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowVxlanReserved0Counter value in the PatternFlowVxlanReserved0 object +func (obj *patternFlowVxlanReserved0) SetIncrement(value PatternFlowVxlanReserved0Counter) PatternFlowVxlanReserved0 { + obj.setChoice(PatternFlowVxlanReserved0Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowVxlanReserved0Counter +func (obj *patternFlowVxlanReserved0) Decrement() PatternFlowVxlanReserved0Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowVxlanReserved0Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowVxlanReserved0Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowVxlanReserved0Counter +func (obj *patternFlowVxlanReserved0) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowVxlanReserved0Counter value in the PatternFlowVxlanReserved0 object +func (obj *patternFlowVxlanReserved0) SetDecrement(value PatternFlowVxlanReserved0Counter) PatternFlowVxlanReserved0 { + obj.setChoice(PatternFlowVxlanReserved0Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowVxlanReserved0MetricTag +func (obj *patternFlowVxlanReserved0) MetricTags() PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowVxlanReserved0MetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter struct { + obj *patternFlowVxlanReserved0 + patternFlowVxlanReserved0MetricTagSlice []PatternFlowVxlanReserved0MetricTag + fieldPtr *[]*otg.PatternFlowVxlanReserved0MetricTag +} + +func newPatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter(ptr *[]*otg.PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { + return &patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter{fieldPtr: ptr} +} + +type PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter interface { + setMsg(*patternFlowVxlanReserved0) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter + Items() []PatternFlowVxlanReserved0MetricTag + Add() PatternFlowVxlanReserved0MetricTag + Append(items ...PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter + Set(index int, newObj PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter + Clear() PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter + clearHolderSlice() PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter + appendHolderSlice(item PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter +} + +func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) setMsg(msg *patternFlowVxlanReserved0) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowVxlanReserved0MetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) Items() []PatternFlowVxlanReserved0MetricTag { + return obj.patternFlowVxlanReserved0MetricTagSlice +} + +func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) Add() PatternFlowVxlanReserved0MetricTag { + newObj := &otg.PatternFlowVxlanReserved0MetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowVxlanReserved0MetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowVxlanReserved0MetricTagSlice = append(obj.patternFlowVxlanReserved0MetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) Append(items ...PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowVxlanReserved0MetricTagSlice = append(obj.patternFlowVxlanReserved0MetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) Set(index int, newObj PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowVxlanReserved0MetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) Clear() PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowVxlanReserved0MetricTag{} + obj.patternFlowVxlanReserved0MetricTagSlice = []PatternFlowVxlanReserved0MetricTag{} + } + return obj +} +func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) clearHolderSlice() PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { + if len(obj.patternFlowVxlanReserved0MetricTagSlice) > 0 { + obj.patternFlowVxlanReserved0MetricTagSlice = []PatternFlowVxlanReserved0MetricTag{} + } + return obj +} +func (obj *patternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter) appendHolderSlice(item PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0PatternFlowVxlanReserved0MetricTagIter { + obj.patternFlowVxlanReserved0MetricTagSlice = append(obj.patternFlowVxlanReserved0MetricTagSlice, item) + return obj +} + +func (obj *patternFlowVxlanReserved0) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanReserved0.Value <= 16777215 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowVxlanReserved0.Values <= 16777215 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowVxlanReserved0MetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowVxlanReserved0) setDefault() { + var choices_set int = 0 + var choice PatternFlowVxlanReserved0ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowVxlanReserved0Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowVxlanReserved0Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowVxlanReserved0Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowVxlanReserved0Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowVxlanReserved0Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVxlanReserved0") + } + } else { + intVal := otg.PatternFlowVxlanReserved0_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowVxlanReserved0_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_vxlan_reserved0_counter.go b/gosnappi/pattern_flow_vxlan_reserved0_counter.go new file mode 100644 index 00000000..17394c70 --- /dev/null +++ b/gosnappi/pattern_flow_vxlan_reserved0_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowVxlanReserved0Counter ***** +type patternFlowVxlanReserved0Counter struct { + validation + obj *otg.PatternFlowVxlanReserved0Counter + marshaller marshalPatternFlowVxlanReserved0Counter + unMarshaller unMarshalPatternFlowVxlanReserved0Counter +} + +func NewPatternFlowVxlanReserved0Counter() PatternFlowVxlanReserved0Counter { + obj := patternFlowVxlanReserved0Counter{obj: &otg.PatternFlowVxlanReserved0Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVxlanReserved0Counter) msg() *otg.PatternFlowVxlanReserved0Counter { + return obj.obj +} + +func (obj *patternFlowVxlanReserved0Counter) setMsg(msg *otg.PatternFlowVxlanReserved0Counter) PatternFlowVxlanReserved0Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVxlanReserved0Counter struct { + obj *patternFlowVxlanReserved0Counter +} + +type marshalPatternFlowVxlanReserved0Counter interface { + // ToProto marshals PatternFlowVxlanReserved0Counter to protobuf object *otg.PatternFlowVxlanReserved0Counter + ToProto() (*otg.PatternFlowVxlanReserved0Counter, error) + // ToPbText marshals PatternFlowVxlanReserved0Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVxlanReserved0Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVxlanReserved0Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVxlanReserved0Counter struct { + obj *patternFlowVxlanReserved0Counter +} + +type unMarshalPatternFlowVxlanReserved0Counter interface { + // FromProto unmarshals PatternFlowVxlanReserved0Counter from protobuf object *otg.PatternFlowVxlanReserved0Counter + FromProto(msg *otg.PatternFlowVxlanReserved0Counter) (PatternFlowVxlanReserved0Counter, error) + // FromPbText unmarshals PatternFlowVxlanReserved0Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVxlanReserved0Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVxlanReserved0Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVxlanReserved0Counter) Marshal() marshalPatternFlowVxlanReserved0Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVxlanReserved0Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVxlanReserved0Counter) Unmarshal() unMarshalPatternFlowVxlanReserved0Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVxlanReserved0Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVxlanReserved0Counter) ToProto() (*otg.PatternFlowVxlanReserved0Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVxlanReserved0Counter) FromProto(msg *otg.PatternFlowVxlanReserved0Counter) (PatternFlowVxlanReserved0Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVxlanReserved0Counter) 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 *unMarshalpatternFlowVxlanReserved0Counter) 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 *marshalpatternFlowVxlanReserved0Counter) 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 *unMarshalpatternFlowVxlanReserved0Counter) 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 *marshalpatternFlowVxlanReserved0Counter) 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 *unMarshalpatternFlowVxlanReserved0Counter) 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 *patternFlowVxlanReserved0Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVxlanReserved0Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVxlanReserved0Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVxlanReserved0Counter) Clone() (PatternFlowVxlanReserved0Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVxlanReserved0Counter() + 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 +} + +// PatternFlowVxlanReserved0Counter is integer counter pattern +type PatternFlowVxlanReserved0Counter interface { + Validation + // msg marshals PatternFlowVxlanReserved0Counter to protobuf object *otg.PatternFlowVxlanReserved0Counter + // and doesn't set defaults + msg() *otg.PatternFlowVxlanReserved0Counter + // setMsg unmarshals PatternFlowVxlanReserved0Counter from protobuf object *otg.PatternFlowVxlanReserved0Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowVxlanReserved0Counter) PatternFlowVxlanReserved0Counter + // provides marshal interface + Marshal() marshalPatternFlowVxlanReserved0Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVxlanReserved0Counter + // validate validates PatternFlowVxlanReserved0Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVxlanReserved0Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowVxlanReserved0Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowVxlanReserved0Counter + SetStart(value uint32) PatternFlowVxlanReserved0Counter + // HasStart checks if Start has been set in PatternFlowVxlanReserved0Counter + HasStart() bool + // Step returns uint32, set in PatternFlowVxlanReserved0Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowVxlanReserved0Counter + SetStep(value uint32) PatternFlowVxlanReserved0Counter + // HasStep checks if Step has been set in PatternFlowVxlanReserved0Counter + HasStep() bool + // Count returns uint32, set in PatternFlowVxlanReserved0Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowVxlanReserved0Counter + SetCount(value uint32) PatternFlowVxlanReserved0Counter + // HasCount checks if Count has been set in PatternFlowVxlanReserved0Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVxlanReserved0Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVxlanReserved0Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowVxlanReserved0Counter object +func (obj *patternFlowVxlanReserved0Counter) SetStart(value uint32) PatternFlowVxlanReserved0Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVxlanReserved0Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVxlanReserved0Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowVxlanReserved0Counter object +func (obj *patternFlowVxlanReserved0Counter) SetStep(value uint32) PatternFlowVxlanReserved0Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVxlanReserved0Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVxlanReserved0Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowVxlanReserved0Counter object +func (obj *patternFlowVxlanReserved0Counter) SetCount(value uint32) PatternFlowVxlanReserved0Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowVxlanReserved0Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanReserved0Counter.Start <= 16777215 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanReserved0Counter.Step <= 16777215 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanReserved0Counter.Count <= 16777215 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowVxlanReserved0Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_vxlan_reserved0_metric_tag.go b/gosnappi/pattern_flow_vxlan_reserved0_metric_tag.go new file mode 100644 index 00000000..cdd29a97 --- /dev/null +++ b/gosnappi/pattern_flow_vxlan_reserved0_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowVxlanReserved0MetricTag ***** +type patternFlowVxlanReserved0MetricTag struct { + validation + obj *otg.PatternFlowVxlanReserved0MetricTag + marshaller marshalPatternFlowVxlanReserved0MetricTag + unMarshaller unMarshalPatternFlowVxlanReserved0MetricTag +} + +func NewPatternFlowVxlanReserved0MetricTag() PatternFlowVxlanReserved0MetricTag { + obj := patternFlowVxlanReserved0MetricTag{obj: &otg.PatternFlowVxlanReserved0MetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVxlanReserved0MetricTag) msg() *otg.PatternFlowVxlanReserved0MetricTag { + return obj.obj +} + +func (obj *patternFlowVxlanReserved0MetricTag) setMsg(msg *otg.PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0MetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVxlanReserved0MetricTag struct { + obj *patternFlowVxlanReserved0MetricTag +} + +type marshalPatternFlowVxlanReserved0MetricTag interface { + // ToProto marshals PatternFlowVxlanReserved0MetricTag to protobuf object *otg.PatternFlowVxlanReserved0MetricTag + ToProto() (*otg.PatternFlowVxlanReserved0MetricTag, error) + // ToPbText marshals PatternFlowVxlanReserved0MetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVxlanReserved0MetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVxlanReserved0MetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVxlanReserved0MetricTag struct { + obj *patternFlowVxlanReserved0MetricTag +} + +type unMarshalPatternFlowVxlanReserved0MetricTag interface { + // FromProto unmarshals PatternFlowVxlanReserved0MetricTag from protobuf object *otg.PatternFlowVxlanReserved0MetricTag + FromProto(msg *otg.PatternFlowVxlanReserved0MetricTag) (PatternFlowVxlanReserved0MetricTag, error) + // FromPbText unmarshals PatternFlowVxlanReserved0MetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVxlanReserved0MetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVxlanReserved0MetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVxlanReserved0MetricTag) Marshal() marshalPatternFlowVxlanReserved0MetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVxlanReserved0MetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVxlanReserved0MetricTag) Unmarshal() unMarshalPatternFlowVxlanReserved0MetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVxlanReserved0MetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVxlanReserved0MetricTag) ToProto() (*otg.PatternFlowVxlanReserved0MetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVxlanReserved0MetricTag) FromProto(msg *otg.PatternFlowVxlanReserved0MetricTag) (PatternFlowVxlanReserved0MetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVxlanReserved0MetricTag) 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 *unMarshalpatternFlowVxlanReserved0MetricTag) 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 *marshalpatternFlowVxlanReserved0MetricTag) 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 *unMarshalpatternFlowVxlanReserved0MetricTag) 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 *marshalpatternFlowVxlanReserved0MetricTag) 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 *unMarshalpatternFlowVxlanReserved0MetricTag) 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 *patternFlowVxlanReserved0MetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVxlanReserved0MetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVxlanReserved0MetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVxlanReserved0MetricTag) Clone() (PatternFlowVxlanReserved0MetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVxlanReserved0MetricTag() + 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 +} + +// PatternFlowVxlanReserved0MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowVxlanReserved0MetricTag interface { + Validation + // msg marshals PatternFlowVxlanReserved0MetricTag to protobuf object *otg.PatternFlowVxlanReserved0MetricTag + // and doesn't set defaults + msg() *otg.PatternFlowVxlanReserved0MetricTag + // setMsg unmarshals PatternFlowVxlanReserved0MetricTag from protobuf object *otg.PatternFlowVxlanReserved0MetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowVxlanReserved0MetricTag) PatternFlowVxlanReserved0MetricTag + // provides marshal interface + Marshal() marshalPatternFlowVxlanReserved0MetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVxlanReserved0MetricTag + // validate validates PatternFlowVxlanReserved0MetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVxlanReserved0MetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowVxlanReserved0MetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowVxlanReserved0MetricTag + SetName(value string) PatternFlowVxlanReserved0MetricTag + // Offset returns uint32, set in PatternFlowVxlanReserved0MetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowVxlanReserved0MetricTag + SetOffset(value uint32) PatternFlowVxlanReserved0MetricTag + // HasOffset checks if Offset has been set in PatternFlowVxlanReserved0MetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowVxlanReserved0MetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowVxlanReserved0MetricTag + SetLength(value uint32) PatternFlowVxlanReserved0MetricTag + // HasLength checks if Length has been set in PatternFlowVxlanReserved0MetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowVxlanReserved0MetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowVxlanReserved0MetricTag object +func (obj *patternFlowVxlanReserved0MetricTag) SetName(value string) PatternFlowVxlanReserved0MetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVxlanReserved0MetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVxlanReserved0MetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowVxlanReserved0MetricTag object +func (obj *patternFlowVxlanReserved0MetricTag) SetOffset(value uint32) PatternFlowVxlanReserved0MetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVxlanReserved0MetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVxlanReserved0MetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowVxlanReserved0MetricTag object +func (obj *patternFlowVxlanReserved0MetricTag) SetLength(value uint32) PatternFlowVxlanReserved0MetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowVxlanReserved0MetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVxlanReserved0MetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 23 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanReserved0MetricTag.Offset <= 23 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 24 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowVxlanReserved0MetricTag.Length <= 24 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowVxlanReserved0MetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(24) + } + +} diff --git a/gosnappi/pattern_flow_vxlan_reserved1.go b/gosnappi/pattern_flow_vxlan_reserved1.go new file mode 100644 index 00000000..ad6da0d7 --- /dev/null +++ b/gosnappi/pattern_flow_vxlan_reserved1.go @@ -0,0 +1,663 @@ +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" +) + +// ***** PatternFlowVxlanReserved1 ***** +type patternFlowVxlanReserved1 struct { + validation + obj *otg.PatternFlowVxlanReserved1 + marshaller marshalPatternFlowVxlanReserved1 + unMarshaller unMarshalPatternFlowVxlanReserved1 + incrementHolder PatternFlowVxlanReserved1Counter + decrementHolder PatternFlowVxlanReserved1Counter + metricTagsHolder PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter +} + +func NewPatternFlowVxlanReserved1() PatternFlowVxlanReserved1 { + obj := patternFlowVxlanReserved1{obj: &otg.PatternFlowVxlanReserved1{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVxlanReserved1) msg() *otg.PatternFlowVxlanReserved1 { + return obj.obj +} + +func (obj *patternFlowVxlanReserved1) setMsg(msg *otg.PatternFlowVxlanReserved1) PatternFlowVxlanReserved1 { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVxlanReserved1 struct { + obj *patternFlowVxlanReserved1 +} + +type marshalPatternFlowVxlanReserved1 interface { + // ToProto marshals PatternFlowVxlanReserved1 to protobuf object *otg.PatternFlowVxlanReserved1 + ToProto() (*otg.PatternFlowVxlanReserved1, error) + // ToPbText marshals PatternFlowVxlanReserved1 to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVxlanReserved1 to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVxlanReserved1 to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVxlanReserved1 struct { + obj *patternFlowVxlanReserved1 +} + +type unMarshalPatternFlowVxlanReserved1 interface { + // FromProto unmarshals PatternFlowVxlanReserved1 from protobuf object *otg.PatternFlowVxlanReserved1 + FromProto(msg *otg.PatternFlowVxlanReserved1) (PatternFlowVxlanReserved1, error) + // FromPbText unmarshals PatternFlowVxlanReserved1 from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVxlanReserved1 from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVxlanReserved1 from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVxlanReserved1) Marshal() marshalPatternFlowVxlanReserved1 { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVxlanReserved1{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVxlanReserved1) Unmarshal() unMarshalPatternFlowVxlanReserved1 { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVxlanReserved1{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVxlanReserved1) ToProto() (*otg.PatternFlowVxlanReserved1, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVxlanReserved1) FromProto(msg *otg.PatternFlowVxlanReserved1) (PatternFlowVxlanReserved1, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVxlanReserved1) 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 *unMarshalpatternFlowVxlanReserved1) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowVxlanReserved1) 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 *unMarshalpatternFlowVxlanReserved1) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowVxlanReserved1) 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 *unMarshalpatternFlowVxlanReserved1) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowVxlanReserved1) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVxlanReserved1) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVxlanReserved1) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVxlanReserved1) Clone() (PatternFlowVxlanReserved1, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVxlanReserved1() + 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 +} + +func (obj *patternFlowVxlanReserved1) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowVxlanReserved1 is reserved field +type PatternFlowVxlanReserved1 interface { + Validation + // msg marshals PatternFlowVxlanReserved1 to protobuf object *otg.PatternFlowVxlanReserved1 + // and doesn't set defaults + msg() *otg.PatternFlowVxlanReserved1 + // setMsg unmarshals PatternFlowVxlanReserved1 from protobuf object *otg.PatternFlowVxlanReserved1 + // and doesn't set defaults + setMsg(*otg.PatternFlowVxlanReserved1) PatternFlowVxlanReserved1 + // provides marshal interface + Marshal() marshalPatternFlowVxlanReserved1 + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVxlanReserved1 + // validate validates PatternFlowVxlanReserved1 + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVxlanReserved1, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowVxlanReserved1ChoiceEnum, set in PatternFlowVxlanReserved1 + Choice() PatternFlowVxlanReserved1ChoiceEnum + // setChoice assigns PatternFlowVxlanReserved1ChoiceEnum provided by user to PatternFlowVxlanReserved1 + setChoice(value PatternFlowVxlanReserved1ChoiceEnum) PatternFlowVxlanReserved1 + // HasChoice checks if Choice has been set in PatternFlowVxlanReserved1 + HasChoice() bool + // Value returns uint32, set in PatternFlowVxlanReserved1. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowVxlanReserved1 + SetValue(value uint32) PatternFlowVxlanReserved1 + // HasValue checks if Value has been set in PatternFlowVxlanReserved1 + HasValue() bool + // Values returns []uint32, set in PatternFlowVxlanReserved1. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowVxlanReserved1 + SetValues(value []uint32) PatternFlowVxlanReserved1 + // Increment returns PatternFlowVxlanReserved1Counter, set in PatternFlowVxlanReserved1. + // PatternFlowVxlanReserved1Counter is integer counter pattern + Increment() PatternFlowVxlanReserved1Counter + // SetIncrement assigns PatternFlowVxlanReserved1Counter provided by user to PatternFlowVxlanReserved1. + // PatternFlowVxlanReserved1Counter is integer counter pattern + SetIncrement(value PatternFlowVxlanReserved1Counter) PatternFlowVxlanReserved1 + // HasIncrement checks if Increment has been set in PatternFlowVxlanReserved1 + HasIncrement() bool + // Decrement returns PatternFlowVxlanReserved1Counter, set in PatternFlowVxlanReserved1. + // PatternFlowVxlanReserved1Counter is integer counter pattern + Decrement() PatternFlowVxlanReserved1Counter + // SetDecrement assigns PatternFlowVxlanReserved1Counter provided by user to PatternFlowVxlanReserved1. + // PatternFlowVxlanReserved1Counter is integer counter pattern + SetDecrement(value PatternFlowVxlanReserved1Counter) PatternFlowVxlanReserved1 + // HasDecrement checks if Decrement has been set in PatternFlowVxlanReserved1 + HasDecrement() bool + // MetricTags returns PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIterIter, set in PatternFlowVxlanReserved1 + MetricTags() PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter + setNil() +} + +type PatternFlowVxlanReserved1ChoiceEnum string + +// Enum of Choice on PatternFlowVxlanReserved1 +var PatternFlowVxlanReserved1Choice = struct { + VALUE PatternFlowVxlanReserved1ChoiceEnum + VALUES PatternFlowVxlanReserved1ChoiceEnum + INCREMENT PatternFlowVxlanReserved1ChoiceEnum + DECREMENT PatternFlowVxlanReserved1ChoiceEnum +}{ + VALUE: PatternFlowVxlanReserved1ChoiceEnum("value"), + VALUES: PatternFlowVxlanReserved1ChoiceEnum("values"), + INCREMENT: PatternFlowVxlanReserved1ChoiceEnum("increment"), + DECREMENT: PatternFlowVxlanReserved1ChoiceEnum("decrement"), +} + +func (obj *patternFlowVxlanReserved1) Choice() PatternFlowVxlanReserved1ChoiceEnum { + return PatternFlowVxlanReserved1ChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowVxlanReserved1) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowVxlanReserved1) setChoice(value PatternFlowVxlanReserved1ChoiceEnum) PatternFlowVxlanReserved1 { + intValue, ok := otg.PatternFlowVxlanReserved1_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowVxlanReserved1ChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowVxlanReserved1_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowVxlanReserved1Choice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowVxlanReserved1Choice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowVxlanReserved1Choice.INCREMENT { + obj.obj.Increment = NewPatternFlowVxlanReserved1Counter().msg() + } + + if value == PatternFlowVxlanReserved1Choice.DECREMENT { + obj.obj.Decrement = NewPatternFlowVxlanReserved1Counter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVxlanReserved1) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowVxlanReserved1Choice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVxlanReserved1) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowVxlanReserved1 object +func (obj *patternFlowVxlanReserved1) SetValue(value uint32) PatternFlowVxlanReserved1 { + obj.setChoice(PatternFlowVxlanReserved1Choice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowVxlanReserved1) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowVxlanReserved1 object +func (obj *patternFlowVxlanReserved1) SetValues(value []uint32) PatternFlowVxlanReserved1 { + obj.setChoice(PatternFlowVxlanReserved1Choice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// description is TBD +// Increment returns a PatternFlowVxlanReserved1Counter +func (obj *patternFlowVxlanReserved1) Increment() PatternFlowVxlanReserved1Counter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowVxlanReserved1Choice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowVxlanReserved1Counter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowVxlanReserved1Counter +func (obj *patternFlowVxlanReserved1) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowVxlanReserved1Counter value in the PatternFlowVxlanReserved1 object +func (obj *patternFlowVxlanReserved1) SetIncrement(value PatternFlowVxlanReserved1Counter) PatternFlowVxlanReserved1 { + obj.setChoice(PatternFlowVxlanReserved1Choice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowVxlanReserved1Counter +func (obj *patternFlowVxlanReserved1) Decrement() PatternFlowVxlanReserved1Counter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowVxlanReserved1Choice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowVxlanReserved1Counter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowVxlanReserved1Counter +func (obj *patternFlowVxlanReserved1) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowVxlanReserved1Counter value in the PatternFlowVxlanReserved1 object +func (obj *patternFlowVxlanReserved1) SetDecrement(value PatternFlowVxlanReserved1Counter) PatternFlowVxlanReserved1 { + obj.setChoice(PatternFlowVxlanReserved1Choice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowVxlanReserved1MetricTag +func (obj *patternFlowVxlanReserved1) MetricTags() PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowVxlanReserved1MetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter struct { + obj *patternFlowVxlanReserved1 + patternFlowVxlanReserved1MetricTagSlice []PatternFlowVxlanReserved1MetricTag + fieldPtr *[]*otg.PatternFlowVxlanReserved1MetricTag +} + +func newPatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter(ptr *[]*otg.PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { + return &patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter{fieldPtr: ptr} +} + +type PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter interface { + setMsg(*patternFlowVxlanReserved1) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter + Items() []PatternFlowVxlanReserved1MetricTag + Add() PatternFlowVxlanReserved1MetricTag + Append(items ...PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter + Set(index int, newObj PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter + Clear() PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter + clearHolderSlice() PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter + appendHolderSlice(item PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter +} + +func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) setMsg(msg *patternFlowVxlanReserved1) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowVxlanReserved1MetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) Items() []PatternFlowVxlanReserved1MetricTag { + return obj.patternFlowVxlanReserved1MetricTagSlice +} + +func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) Add() PatternFlowVxlanReserved1MetricTag { + newObj := &otg.PatternFlowVxlanReserved1MetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowVxlanReserved1MetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowVxlanReserved1MetricTagSlice = append(obj.patternFlowVxlanReserved1MetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) Append(items ...PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowVxlanReserved1MetricTagSlice = append(obj.patternFlowVxlanReserved1MetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) Set(index int, newObj PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowVxlanReserved1MetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) Clear() PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowVxlanReserved1MetricTag{} + obj.patternFlowVxlanReserved1MetricTagSlice = []PatternFlowVxlanReserved1MetricTag{} + } + return obj +} +func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) clearHolderSlice() PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { + if len(obj.patternFlowVxlanReserved1MetricTagSlice) > 0 { + obj.patternFlowVxlanReserved1MetricTagSlice = []PatternFlowVxlanReserved1MetricTag{} + } + return obj +} +func (obj *patternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter) appendHolderSlice(item PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1PatternFlowVxlanReserved1MetricTagIter { + obj.patternFlowVxlanReserved1MetricTagSlice = append(obj.patternFlowVxlanReserved1MetricTagSlice, item) + return obj +} + +func (obj *patternFlowVxlanReserved1) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanReserved1.Value <= 255 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowVxlanReserved1.Values <= 255 but Got %d", item)) + } + + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowVxlanReserved1MetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowVxlanReserved1) setDefault() { + var choices_set int = 0 + var choice PatternFlowVxlanReserved1ChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowVxlanReserved1Choice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowVxlanReserved1Choice.VALUES + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowVxlanReserved1Choice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowVxlanReserved1Choice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowVxlanReserved1Choice.VALUE) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVxlanReserved1") + } + } else { + intVal := otg.PatternFlowVxlanReserved1_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowVxlanReserved1_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_vxlan_reserved1_counter.go b/gosnappi/pattern_flow_vxlan_reserved1_counter.go new file mode 100644 index 00000000..260ddae3 --- /dev/null +++ b/gosnappi/pattern_flow_vxlan_reserved1_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowVxlanReserved1Counter ***** +type patternFlowVxlanReserved1Counter struct { + validation + obj *otg.PatternFlowVxlanReserved1Counter + marshaller marshalPatternFlowVxlanReserved1Counter + unMarshaller unMarshalPatternFlowVxlanReserved1Counter +} + +func NewPatternFlowVxlanReserved1Counter() PatternFlowVxlanReserved1Counter { + obj := patternFlowVxlanReserved1Counter{obj: &otg.PatternFlowVxlanReserved1Counter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVxlanReserved1Counter) msg() *otg.PatternFlowVxlanReserved1Counter { + return obj.obj +} + +func (obj *patternFlowVxlanReserved1Counter) setMsg(msg *otg.PatternFlowVxlanReserved1Counter) PatternFlowVxlanReserved1Counter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVxlanReserved1Counter struct { + obj *patternFlowVxlanReserved1Counter +} + +type marshalPatternFlowVxlanReserved1Counter interface { + // ToProto marshals PatternFlowVxlanReserved1Counter to protobuf object *otg.PatternFlowVxlanReserved1Counter + ToProto() (*otg.PatternFlowVxlanReserved1Counter, error) + // ToPbText marshals PatternFlowVxlanReserved1Counter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVxlanReserved1Counter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVxlanReserved1Counter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVxlanReserved1Counter struct { + obj *patternFlowVxlanReserved1Counter +} + +type unMarshalPatternFlowVxlanReserved1Counter interface { + // FromProto unmarshals PatternFlowVxlanReserved1Counter from protobuf object *otg.PatternFlowVxlanReserved1Counter + FromProto(msg *otg.PatternFlowVxlanReserved1Counter) (PatternFlowVxlanReserved1Counter, error) + // FromPbText unmarshals PatternFlowVxlanReserved1Counter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVxlanReserved1Counter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVxlanReserved1Counter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVxlanReserved1Counter) Marshal() marshalPatternFlowVxlanReserved1Counter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVxlanReserved1Counter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVxlanReserved1Counter) Unmarshal() unMarshalPatternFlowVxlanReserved1Counter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVxlanReserved1Counter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVxlanReserved1Counter) ToProto() (*otg.PatternFlowVxlanReserved1Counter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVxlanReserved1Counter) FromProto(msg *otg.PatternFlowVxlanReserved1Counter) (PatternFlowVxlanReserved1Counter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVxlanReserved1Counter) 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 *unMarshalpatternFlowVxlanReserved1Counter) 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 *marshalpatternFlowVxlanReserved1Counter) 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 *unMarshalpatternFlowVxlanReserved1Counter) 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 *marshalpatternFlowVxlanReserved1Counter) 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 *unMarshalpatternFlowVxlanReserved1Counter) 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 *patternFlowVxlanReserved1Counter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVxlanReserved1Counter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVxlanReserved1Counter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVxlanReserved1Counter) Clone() (PatternFlowVxlanReserved1Counter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVxlanReserved1Counter() + 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 +} + +// PatternFlowVxlanReserved1Counter is integer counter pattern +type PatternFlowVxlanReserved1Counter interface { + Validation + // msg marshals PatternFlowVxlanReserved1Counter to protobuf object *otg.PatternFlowVxlanReserved1Counter + // and doesn't set defaults + msg() *otg.PatternFlowVxlanReserved1Counter + // setMsg unmarshals PatternFlowVxlanReserved1Counter from protobuf object *otg.PatternFlowVxlanReserved1Counter + // and doesn't set defaults + setMsg(*otg.PatternFlowVxlanReserved1Counter) PatternFlowVxlanReserved1Counter + // provides marshal interface + Marshal() marshalPatternFlowVxlanReserved1Counter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVxlanReserved1Counter + // validate validates PatternFlowVxlanReserved1Counter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVxlanReserved1Counter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowVxlanReserved1Counter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowVxlanReserved1Counter + SetStart(value uint32) PatternFlowVxlanReserved1Counter + // HasStart checks if Start has been set in PatternFlowVxlanReserved1Counter + HasStart() bool + // Step returns uint32, set in PatternFlowVxlanReserved1Counter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowVxlanReserved1Counter + SetStep(value uint32) PatternFlowVxlanReserved1Counter + // HasStep checks if Step has been set in PatternFlowVxlanReserved1Counter + HasStep() bool + // Count returns uint32, set in PatternFlowVxlanReserved1Counter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowVxlanReserved1Counter + SetCount(value uint32) PatternFlowVxlanReserved1Counter + // HasCount checks if Count has been set in PatternFlowVxlanReserved1Counter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVxlanReserved1Counter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVxlanReserved1Counter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowVxlanReserved1Counter object +func (obj *patternFlowVxlanReserved1Counter) SetStart(value uint32) PatternFlowVxlanReserved1Counter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVxlanReserved1Counter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVxlanReserved1Counter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowVxlanReserved1Counter object +func (obj *patternFlowVxlanReserved1Counter) SetStep(value uint32) PatternFlowVxlanReserved1Counter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVxlanReserved1Counter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVxlanReserved1Counter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowVxlanReserved1Counter object +func (obj *patternFlowVxlanReserved1Counter) SetCount(value uint32) PatternFlowVxlanReserved1Counter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowVxlanReserved1Counter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanReserved1Counter.Start <= 255 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanReserved1Counter.Step <= 255 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanReserved1Counter.Count <= 255 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowVxlanReserved1Counter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_vxlan_reserved1_metric_tag.go b/gosnappi/pattern_flow_vxlan_reserved1_metric_tag.go new file mode 100644 index 00000000..1a9ae0b0 --- /dev/null +++ b/gosnappi/pattern_flow_vxlan_reserved1_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowVxlanReserved1MetricTag ***** +type patternFlowVxlanReserved1MetricTag struct { + validation + obj *otg.PatternFlowVxlanReserved1MetricTag + marshaller marshalPatternFlowVxlanReserved1MetricTag + unMarshaller unMarshalPatternFlowVxlanReserved1MetricTag +} + +func NewPatternFlowVxlanReserved1MetricTag() PatternFlowVxlanReserved1MetricTag { + obj := patternFlowVxlanReserved1MetricTag{obj: &otg.PatternFlowVxlanReserved1MetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVxlanReserved1MetricTag) msg() *otg.PatternFlowVxlanReserved1MetricTag { + return obj.obj +} + +func (obj *patternFlowVxlanReserved1MetricTag) setMsg(msg *otg.PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1MetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVxlanReserved1MetricTag struct { + obj *patternFlowVxlanReserved1MetricTag +} + +type marshalPatternFlowVxlanReserved1MetricTag interface { + // ToProto marshals PatternFlowVxlanReserved1MetricTag to protobuf object *otg.PatternFlowVxlanReserved1MetricTag + ToProto() (*otg.PatternFlowVxlanReserved1MetricTag, error) + // ToPbText marshals PatternFlowVxlanReserved1MetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVxlanReserved1MetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVxlanReserved1MetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVxlanReserved1MetricTag struct { + obj *patternFlowVxlanReserved1MetricTag +} + +type unMarshalPatternFlowVxlanReserved1MetricTag interface { + // FromProto unmarshals PatternFlowVxlanReserved1MetricTag from protobuf object *otg.PatternFlowVxlanReserved1MetricTag + FromProto(msg *otg.PatternFlowVxlanReserved1MetricTag) (PatternFlowVxlanReserved1MetricTag, error) + // FromPbText unmarshals PatternFlowVxlanReserved1MetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVxlanReserved1MetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVxlanReserved1MetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVxlanReserved1MetricTag) Marshal() marshalPatternFlowVxlanReserved1MetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVxlanReserved1MetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVxlanReserved1MetricTag) Unmarshal() unMarshalPatternFlowVxlanReserved1MetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVxlanReserved1MetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVxlanReserved1MetricTag) ToProto() (*otg.PatternFlowVxlanReserved1MetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVxlanReserved1MetricTag) FromProto(msg *otg.PatternFlowVxlanReserved1MetricTag) (PatternFlowVxlanReserved1MetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVxlanReserved1MetricTag) 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 *unMarshalpatternFlowVxlanReserved1MetricTag) 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 *marshalpatternFlowVxlanReserved1MetricTag) 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 *unMarshalpatternFlowVxlanReserved1MetricTag) 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 *marshalpatternFlowVxlanReserved1MetricTag) 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 *unMarshalpatternFlowVxlanReserved1MetricTag) 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 *patternFlowVxlanReserved1MetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVxlanReserved1MetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVxlanReserved1MetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVxlanReserved1MetricTag) Clone() (PatternFlowVxlanReserved1MetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVxlanReserved1MetricTag() + 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 +} + +// PatternFlowVxlanReserved1MetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowVxlanReserved1MetricTag interface { + Validation + // msg marshals PatternFlowVxlanReserved1MetricTag to protobuf object *otg.PatternFlowVxlanReserved1MetricTag + // and doesn't set defaults + msg() *otg.PatternFlowVxlanReserved1MetricTag + // setMsg unmarshals PatternFlowVxlanReserved1MetricTag from protobuf object *otg.PatternFlowVxlanReserved1MetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowVxlanReserved1MetricTag) PatternFlowVxlanReserved1MetricTag + // provides marshal interface + Marshal() marshalPatternFlowVxlanReserved1MetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVxlanReserved1MetricTag + // validate validates PatternFlowVxlanReserved1MetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVxlanReserved1MetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowVxlanReserved1MetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowVxlanReserved1MetricTag + SetName(value string) PatternFlowVxlanReserved1MetricTag + // Offset returns uint32, set in PatternFlowVxlanReserved1MetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowVxlanReserved1MetricTag + SetOffset(value uint32) PatternFlowVxlanReserved1MetricTag + // HasOffset checks if Offset has been set in PatternFlowVxlanReserved1MetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowVxlanReserved1MetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowVxlanReserved1MetricTag + SetLength(value uint32) PatternFlowVxlanReserved1MetricTag + // HasLength checks if Length has been set in PatternFlowVxlanReserved1MetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowVxlanReserved1MetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowVxlanReserved1MetricTag object +func (obj *patternFlowVxlanReserved1MetricTag) SetName(value string) PatternFlowVxlanReserved1MetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVxlanReserved1MetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVxlanReserved1MetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowVxlanReserved1MetricTag object +func (obj *patternFlowVxlanReserved1MetricTag) SetOffset(value uint32) PatternFlowVxlanReserved1MetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVxlanReserved1MetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVxlanReserved1MetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowVxlanReserved1MetricTag object +func (obj *patternFlowVxlanReserved1MetricTag) SetLength(value uint32) PatternFlowVxlanReserved1MetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowVxlanReserved1MetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVxlanReserved1MetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanReserved1MetricTag.Offset <= 7 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowVxlanReserved1MetricTag.Length <= 8 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowVxlanReserved1MetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(8) + } + +} diff --git a/gosnappi/pattern_flow_vxlan_vni.go b/gosnappi/pattern_flow_vxlan_vni.go new file mode 100644 index 00000000..17ae9567 --- /dev/null +++ b/gosnappi/pattern_flow_vxlan_vni.go @@ -0,0 +1,712 @@ +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" +) + +// ***** PatternFlowVxlanVni ***** +type patternFlowVxlanVni struct { + validation + obj *otg.PatternFlowVxlanVni + marshaller marshalPatternFlowVxlanVni + unMarshaller unMarshalPatternFlowVxlanVni + incrementHolder PatternFlowVxlanVniCounter + decrementHolder PatternFlowVxlanVniCounter + metricTagsHolder PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter +} + +func NewPatternFlowVxlanVni() PatternFlowVxlanVni { + obj := patternFlowVxlanVni{obj: &otg.PatternFlowVxlanVni{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVxlanVni) msg() *otg.PatternFlowVxlanVni { + return obj.obj +} + +func (obj *patternFlowVxlanVni) setMsg(msg *otg.PatternFlowVxlanVni) PatternFlowVxlanVni { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVxlanVni struct { + obj *patternFlowVxlanVni +} + +type marshalPatternFlowVxlanVni interface { + // ToProto marshals PatternFlowVxlanVni to protobuf object *otg.PatternFlowVxlanVni + ToProto() (*otg.PatternFlowVxlanVni, error) + // ToPbText marshals PatternFlowVxlanVni to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVxlanVni to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVxlanVni to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVxlanVni struct { + obj *patternFlowVxlanVni +} + +type unMarshalPatternFlowVxlanVni interface { + // FromProto unmarshals PatternFlowVxlanVni from protobuf object *otg.PatternFlowVxlanVni + FromProto(msg *otg.PatternFlowVxlanVni) (PatternFlowVxlanVni, error) + // FromPbText unmarshals PatternFlowVxlanVni from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVxlanVni from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVxlanVni from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVxlanVni) Marshal() marshalPatternFlowVxlanVni { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVxlanVni{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVxlanVni) Unmarshal() unMarshalPatternFlowVxlanVni { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVxlanVni{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVxlanVni) ToProto() (*otg.PatternFlowVxlanVni, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVxlanVni) FromProto(msg *otg.PatternFlowVxlanVni) (PatternFlowVxlanVni, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVxlanVni) 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 *unMarshalpatternFlowVxlanVni) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalpatternFlowVxlanVni) 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 *unMarshalpatternFlowVxlanVni) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalpatternFlowVxlanVni) 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 *unMarshalpatternFlowVxlanVni) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *patternFlowVxlanVni) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVxlanVni) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVxlanVni) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVxlanVni) Clone() (PatternFlowVxlanVni, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVxlanVni() + 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 +} + +func (obj *patternFlowVxlanVni) setNil() { + obj.incrementHolder = nil + obj.decrementHolder = nil + obj.metricTagsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// PatternFlowVxlanVni is vXLAN network id +type PatternFlowVxlanVni interface { + Validation + // msg marshals PatternFlowVxlanVni to protobuf object *otg.PatternFlowVxlanVni + // and doesn't set defaults + msg() *otg.PatternFlowVxlanVni + // setMsg unmarshals PatternFlowVxlanVni from protobuf object *otg.PatternFlowVxlanVni + // and doesn't set defaults + setMsg(*otg.PatternFlowVxlanVni) PatternFlowVxlanVni + // provides marshal interface + Marshal() marshalPatternFlowVxlanVni + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVxlanVni + // validate validates PatternFlowVxlanVni + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVxlanVni, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns PatternFlowVxlanVniChoiceEnum, set in PatternFlowVxlanVni + Choice() PatternFlowVxlanVniChoiceEnum + // setChoice assigns PatternFlowVxlanVniChoiceEnum provided by user to PatternFlowVxlanVni + setChoice(value PatternFlowVxlanVniChoiceEnum) PatternFlowVxlanVni + // HasChoice checks if Choice has been set in PatternFlowVxlanVni + HasChoice() bool + // Value returns uint32, set in PatternFlowVxlanVni. + Value() uint32 + // SetValue assigns uint32 provided by user to PatternFlowVxlanVni + SetValue(value uint32) PatternFlowVxlanVni + // HasValue checks if Value has been set in PatternFlowVxlanVni + HasValue() bool + // Values returns []uint32, set in PatternFlowVxlanVni. + Values() []uint32 + // SetValues assigns []uint32 provided by user to PatternFlowVxlanVni + SetValues(value []uint32) PatternFlowVxlanVni + // Auto returns uint32, set in PatternFlowVxlanVni. + Auto() uint32 + // HasAuto checks if Auto has been set in PatternFlowVxlanVni + HasAuto() bool + // Increment returns PatternFlowVxlanVniCounter, set in PatternFlowVxlanVni. + // PatternFlowVxlanVniCounter is integer counter pattern + Increment() PatternFlowVxlanVniCounter + // SetIncrement assigns PatternFlowVxlanVniCounter provided by user to PatternFlowVxlanVni. + // PatternFlowVxlanVniCounter is integer counter pattern + SetIncrement(value PatternFlowVxlanVniCounter) PatternFlowVxlanVni + // HasIncrement checks if Increment has been set in PatternFlowVxlanVni + HasIncrement() bool + // Decrement returns PatternFlowVxlanVniCounter, set in PatternFlowVxlanVni. + // PatternFlowVxlanVniCounter is integer counter pattern + Decrement() PatternFlowVxlanVniCounter + // SetDecrement assigns PatternFlowVxlanVniCounter provided by user to PatternFlowVxlanVni. + // PatternFlowVxlanVniCounter is integer counter pattern + SetDecrement(value PatternFlowVxlanVniCounter) PatternFlowVxlanVni + // HasDecrement checks if Decrement has been set in PatternFlowVxlanVni + HasDecrement() bool + // MetricTags returns PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIterIter, set in PatternFlowVxlanVni + MetricTags() PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter + setNil() +} + +type PatternFlowVxlanVniChoiceEnum string + +// Enum of Choice on PatternFlowVxlanVni +var PatternFlowVxlanVniChoice = struct { + VALUE PatternFlowVxlanVniChoiceEnum + VALUES PatternFlowVxlanVniChoiceEnum + AUTO PatternFlowVxlanVniChoiceEnum + INCREMENT PatternFlowVxlanVniChoiceEnum + DECREMENT PatternFlowVxlanVniChoiceEnum +}{ + VALUE: PatternFlowVxlanVniChoiceEnum("value"), + VALUES: PatternFlowVxlanVniChoiceEnum("values"), + AUTO: PatternFlowVxlanVniChoiceEnum("auto"), + INCREMENT: PatternFlowVxlanVniChoiceEnum("increment"), + DECREMENT: PatternFlowVxlanVniChoiceEnum("decrement"), +} + +func (obj *patternFlowVxlanVni) Choice() PatternFlowVxlanVniChoiceEnum { + return PatternFlowVxlanVniChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *patternFlowVxlanVni) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *patternFlowVxlanVni) setChoice(value PatternFlowVxlanVniChoiceEnum) PatternFlowVxlanVni { + intValue, ok := otg.PatternFlowVxlanVni_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PatternFlowVxlanVniChoiceEnum", string(value))) + return obj + } + enumValue := otg.PatternFlowVxlanVni_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Decrement = nil + obj.decrementHolder = nil + obj.obj.Increment = nil + obj.incrementHolder = nil + obj.obj.Auto = nil + obj.obj.Values = nil + obj.obj.Value = nil + + if value == PatternFlowVxlanVniChoice.VALUE { + defaultValue := uint32(0) + obj.obj.Value = &defaultValue + } + + if value == PatternFlowVxlanVniChoice.VALUES { + defaultValue := []uint32{0} + obj.obj.Values = defaultValue + } + + if value == PatternFlowVxlanVniChoice.AUTO { + defaultValue := uint32(0) + obj.obj.Auto = &defaultValue + } + + if value == PatternFlowVxlanVniChoice.INCREMENT { + obj.obj.Increment = NewPatternFlowVxlanVniCounter().msg() + } + + if value == PatternFlowVxlanVniChoice.DECREMENT { + obj.obj.Decrement = NewPatternFlowVxlanVniCounter().msg() + } + + return obj +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVxlanVni) Value() uint32 { + + if obj.obj.Value == nil { + obj.setChoice(PatternFlowVxlanVniChoice.VALUE) + } + + return *obj.obj.Value + +} + +// description is TBD +// Value returns a uint32 +func (obj *patternFlowVxlanVni) HasValue() bool { + return obj.obj.Value != nil +} + +// description is TBD +// SetValue sets the uint32 value in the PatternFlowVxlanVni object +func (obj *patternFlowVxlanVni) SetValue(value uint32) PatternFlowVxlanVni { + obj.setChoice(PatternFlowVxlanVniChoice.VALUE) + obj.obj.Value = &value + return obj +} + +// description is TBD +// Values returns a []uint32 +func (obj *patternFlowVxlanVni) Values() []uint32 { + if obj.obj.Values == nil { + obj.SetValues([]uint32{0}) + } + return obj.obj.Values +} + +// description is TBD +// SetValues sets the []uint32 value in the PatternFlowVxlanVni object +func (obj *patternFlowVxlanVni) SetValues(value []uint32) PatternFlowVxlanVni { + obj.setChoice(PatternFlowVxlanVniChoice.VALUES) + if obj.obj.Values == nil { + obj.obj.Values = make([]uint32, 0) + } + obj.obj.Values = value + + return obj +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowVxlanVni) Auto() uint32 { + + if obj.obj.Auto == nil { + obj.setChoice(PatternFlowVxlanVniChoice.AUTO) + } + + return *obj.obj.Auto + +} + +// The OTG implementation can provide a system generated +// value for this property. If the OTG is unable to generate a value +// the default value must be used. +// Auto returns a uint32 +func (obj *patternFlowVxlanVni) HasAuto() bool { + return obj.obj.Auto != nil +} + +// description is TBD +// Increment returns a PatternFlowVxlanVniCounter +func (obj *patternFlowVxlanVni) Increment() PatternFlowVxlanVniCounter { + if obj.obj.Increment == nil { + obj.setChoice(PatternFlowVxlanVniChoice.INCREMENT) + } + if obj.incrementHolder == nil { + obj.incrementHolder = &patternFlowVxlanVniCounter{obj: obj.obj.Increment} + } + return obj.incrementHolder +} + +// description is TBD +// Increment returns a PatternFlowVxlanVniCounter +func (obj *patternFlowVxlanVni) HasIncrement() bool { + return obj.obj.Increment != nil +} + +// description is TBD +// SetIncrement sets the PatternFlowVxlanVniCounter value in the PatternFlowVxlanVni object +func (obj *patternFlowVxlanVni) SetIncrement(value PatternFlowVxlanVniCounter) PatternFlowVxlanVni { + obj.setChoice(PatternFlowVxlanVniChoice.INCREMENT) + obj.incrementHolder = nil + obj.obj.Increment = value.msg() + + return obj +} + +// description is TBD +// Decrement returns a PatternFlowVxlanVniCounter +func (obj *patternFlowVxlanVni) Decrement() PatternFlowVxlanVniCounter { + if obj.obj.Decrement == nil { + obj.setChoice(PatternFlowVxlanVniChoice.DECREMENT) + } + if obj.decrementHolder == nil { + obj.decrementHolder = &patternFlowVxlanVniCounter{obj: obj.obj.Decrement} + } + return obj.decrementHolder +} + +// description is TBD +// Decrement returns a PatternFlowVxlanVniCounter +func (obj *patternFlowVxlanVni) HasDecrement() bool { + return obj.obj.Decrement != nil +} + +// description is TBD +// SetDecrement sets the PatternFlowVxlanVniCounter value in the PatternFlowVxlanVni object +func (obj *patternFlowVxlanVni) SetDecrement(value PatternFlowVxlanVniCounter) PatternFlowVxlanVni { + obj.setChoice(PatternFlowVxlanVniChoice.DECREMENT) + obj.decrementHolder = nil + obj.obj.Decrement = value.msg() + + return obj +} + +// One or more metric tags can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +// MetricTags returns a []PatternFlowVxlanVniMetricTag +func (obj *patternFlowVxlanVni) MetricTags() PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { + if len(obj.obj.MetricTags) == 0 { + obj.obj.MetricTags = []*otg.PatternFlowVxlanVniMetricTag{} + } + if obj.metricTagsHolder == nil { + obj.metricTagsHolder = newPatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter(&obj.obj.MetricTags).setMsg(obj) + } + return obj.metricTagsHolder +} + +type patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter struct { + obj *patternFlowVxlanVni + patternFlowVxlanVniMetricTagSlice []PatternFlowVxlanVniMetricTag + fieldPtr *[]*otg.PatternFlowVxlanVniMetricTag +} + +func newPatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter(ptr *[]*otg.PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { + return &patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter{fieldPtr: ptr} +} + +type PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter interface { + setMsg(*patternFlowVxlanVni) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter + Items() []PatternFlowVxlanVniMetricTag + Add() PatternFlowVxlanVniMetricTag + Append(items ...PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter + Set(index int, newObj PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter + Clear() PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter + clearHolderSlice() PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter + appendHolderSlice(item PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter +} + +func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) setMsg(msg *patternFlowVxlanVni) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&patternFlowVxlanVniMetricTag{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) Items() []PatternFlowVxlanVniMetricTag { + return obj.patternFlowVxlanVniMetricTagSlice +} + +func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) Add() PatternFlowVxlanVniMetricTag { + newObj := &otg.PatternFlowVxlanVniMetricTag{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &patternFlowVxlanVniMetricTag{obj: newObj} + newLibObj.setDefault() + obj.patternFlowVxlanVniMetricTagSlice = append(obj.patternFlowVxlanVniMetricTagSlice, newLibObj) + return newLibObj +} + +func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) Append(items ...PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.patternFlowVxlanVniMetricTagSlice = append(obj.patternFlowVxlanVniMetricTagSlice, item) + } + return obj +} + +func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) Set(index int, newObj PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.patternFlowVxlanVniMetricTagSlice[index] = newObj + return obj +} +func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) Clear() PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.PatternFlowVxlanVniMetricTag{} + obj.patternFlowVxlanVniMetricTagSlice = []PatternFlowVxlanVniMetricTag{} + } + return obj +} +func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) clearHolderSlice() PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { + if len(obj.patternFlowVxlanVniMetricTagSlice) > 0 { + obj.patternFlowVxlanVniMetricTagSlice = []PatternFlowVxlanVniMetricTag{} + } + return obj +} +func (obj *patternFlowVxlanVniPatternFlowVxlanVniMetricTagIter) appendHolderSlice(item PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniPatternFlowVxlanVniMetricTagIter { + obj.patternFlowVxlanVniMetricTagSlice = append(obj.patternFlowVxlanVniMetricTagSlice, item) + return obj +} + +func (obj *patternFlowVxlanVni) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Value != nil { + + if *obj.obj.Value > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanVni.Value <= 16777215 but Got %d", *obj.obj.Value)) + } + + } + + if obj.obj.Values != nil { + + for _, item := range obj.obj.Values { + if item > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("min(uint32) <= PatternFlowVxlanVni.Values <= 16777215 but Got %d", item)) + } + + } + + } + + if obj.obj.Auto != nil { + + if *obj.obj.Auto > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanVni.Auto <= 16777215 but Got %d", *obj.obj.Auto)) + } + + } + + if obj.obj.Increment != nil { + + obj.Increment().validateObj(vObj, set_default) + } + + if obj.obj.Decrement != nil { + + obj.Decrement().validateObj(vObj, set_default) + } + + if len(obj.obj.MetricTags) != 0 { + + if set_default { + obj.MetricTags().clearHolderSlice() + for _, item := range obj.obj.MetricTags { + obj.MetricTags().appendHolderSlice(&patternFlowVxlanVniMetricTag{obj: item}) + } + } + for _, item := range obj.MetricTags().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *patternFlowVxlanVni) setDefault() { + var choices_set int = 0 + var choice PatternFlowVxlanVniChoiceEnum + + if obj.obj.Value != nil { + choices_set += 1 + choice = PatternFlowVxlanVniChoice.VALUE + } + + if len(obj.obj.Values) > 0 { + choices_set += 1 + choice = PatternFlowVxlanVniChoice.VALUES + } + + if obj.obj.Auto != nil { + choices_set += 1 + choice = PatternFlowVxlanVniChoice.AUTO + } + + if obj.obj.Increment != nil { + choices_set += 1 + choice = PatternFlowVxlanVniChoice.INCREMENT + } + + if obj.obj.Decrement != nil { + choices_set += 1 + choice = PatternFlowVxlanVniChoice.DECREMENT + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(PatternFlowVxlanVniChoice.AUTO) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in PatternFlowVxlanVni") + } + } else { + intVal := otg.PatternFlowVxlanVni_Choice_Enum_value[string(choice)] + enumValue := otg.PatternFlowVxlanVni_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/pattern_flow_vxlan_vni_counter.go b/gosnappi/pattern_flow_vxlan_vni_counter.go new file mode 100644 index 00000000..5a381749 --- /dev/null +++ b/gosnappi/pattern_flow_vxlan_vni_counter.go @@ -0,0 +1,401 @@ +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" +) + +// ***** PatternFlowVxlanVniCounter ***** +type patternFlowVxlanVniCounter struct { + validation + obj *otg.PatternFlowVxlanVniCounter + marshaller marshalPatternFlowVxlanVniCounter + unMarshaller unMarshalPatternFlowVxlanVniCounter +} + +func NewPatternFlowVxlanVniCounter() PatternFlowVxlanVniCounter { + obj := patternFlowVxlanVniCounter{obj: &otg.PatternFlowVxlanVniCounter{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVxlanVniCounter) msg() *otg.PatternFlowVxlanVniCounter { + return obj.obj +} + +func (obj *patternFlowVxlanVniCounter) setMsg(msg *otg.PatternFlowVxlanVniCounter) PatternFlowVxlanVniCounter { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVxlanVniCounter struct { + obj *patternFlowVxlanVniCounter +} + +type marshalPatternFlowVxlanVniCounter interface { + // ToProto marshals PatternFlowVxlanVniCounter to protobuf object *otg.PatternFlowVxlanVniCounter + ToProto() (*otg.PatternFlowVxlanVniCounter, error) + // ToPbText marshals PatternFlowVxlanVniCounter to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVxlanVniCounter to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVxlanVniCounter to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVxlanVniCounter struct { + obj *patternFlowVxlanVniCounter +} + +type unMarshalPatternFlowVxlanVniCounter interface { + // FromProto unmarshals PatternFlowVxlanVniCounter from protobuf object *otg.PatternFlowVxlanVniCounter + FromProto(msg *otg.PatternFlowVxlanVniCounter) (PatternFlowVxlanVniCounter, error) + // FromPbText unmarshals PatternFlowVxlanVniCounter from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVxlanVniCounter from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVxlanVniCounter from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVxlanVniCounter) Marshal() marshalPatternFlowVxlanVniCounter { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVxlanVniCounter{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVxlanVniCounter) Unmarshal() unMarshalPatternFlowVxlanVniCounter { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVxlanVniCounter{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVxlanVniCounter) ToProto() (*otg.PatternFlowVxlanVniCounter, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVxlanVniCounter) FromProto(msg *otg.PatternFlowVxlanVniCounter) (PatternFlowVxlanVniCounter, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVxlanVniCounter) 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 *unMarshalpatternFlowVxlanVniCounter) 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 *marshalpatternFlowVxlanVniCounter) 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 *unMarshalpatternFlowVxlanVniCounter) 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 *marshalpatternFlowVxlanVniCounter) 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 *unMarshalpatternFlowVxlanVniCounter) 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 *patternFlowVxlanVniCounter) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVxlanVniCounter) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVxlanVniCounter) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVxlanVniCounter) Clone() (PatternFlowVxlanVniCounter, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVxlanVniCounter() + 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 +} + +// PatternFlowVxlanVniCounter is integer counter pattern +type PatternFlowVxlanVniCounter interface { + Validation + // msg marshals PatternFlowVxlanVniCounter to protobuf object *otg.PatternFlowVxlanVniCounter + // and doesn't set defaults + msg() *otg.PatternFlowVxlanVniCounter + // setMsg unmarshals PatternFlowVxlanVniCounter from protobuf object *otg.PatternFlowVxlanVniCounter + // and doesn't set defaults + setMsg(*otg.PatternFlowVxlanVniCounter) PatternFlowVxlanVniCounter + // provides marshal interface + Marshal() marshalPatternFlowVxlanVniCounter + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVxlanVniCounter + // validate validates PatternFlowVxlanVniCounter + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVxlanVniCounter, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Start returns uint32, set in PatternFlowVxlanVniCounter. + Start() uint32 + // SetStart assigns uint32 provided by user to PatternFlowVxlanVniCounter + SetStart(value uint32) PatternFlowVxlanVniCounter + // HasStart checks if Start has been set in PatternFlowVxlanVniCounter + HasStart() bool + // Step returns uint32, set in PatternFlowVxlanVniCounter. + Step() uint32 + // SetStep assigns uint32 provided by user to PatternFlowVxlanVniCounter + SetStep(value uint32) PatternFlowVxlanVniCounter + // HasStep checks if Step has been set in PatternFlowVxlanVniCounter + HasStep() bool + // Count returns uint32, set in PatternFlowVxlanVniCounter. + Count() uint32 + // SetCount assigns uint32 provided by user to PatternFlowVxlanVniCounter + SetCount(value uint32) PatternFlowVxlanVniCounter + // HasCount checks if Count has been set in PatternFlowVxlanVniCounter + HasCount() bool +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVxlanVniCounter) Start() uint32 { + + return *obj.obj.Start + +} + +// description is TBD +// Start returns a uint32 +func (obj *patternFlowVxlanVniCounter) HasStart() bool { + return obj.obj.Start != nil +} + +// description is TBD +// SetStart sets the uint32 value in the PatternFlowVxlanVniCounter object +func (obj *patternFlowVxlanVniCounter) SetStart(value uint32) PatternFlowVxlanVniCounter { + + obj.obj.Start = &value + return obj +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVxlanVniCounter) Step() uint32 { + + return *obj.obj.Step + +} + +// description is TBD +// Step returns a uint32 +func (obj *patternFlowVxlanVniCounter) HasStep() bool { + return obj.obj.Step != nil +} + +// description is TBD +// SetStep sets the uint32 value in the PatternFlowVxlanVniCounter object +func (obj *patternFlowVxlanVniCounter) SetStep(value uint32) PatternFlowVxlanVniCounter { + + obj.obj.Step = &value + return obj +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVxlanVniCounter) Count() uint32 { + + return *obj.obj.Count + +} + +// description is TBD +// Count returns a uint32 +func (obj *patternFlowVxlanVniCounter) HasCount() bool { + return obj.obj.Count != nil +} + +// description is TBD +// SetCount sets the uint32 value in the PatternFlowVxlanVniCounter object +func (obj *patternFlowVxlanVniCounter) SetCount(value uint32) PatternFlowVxlanVniCounter { + + obj.obj.Count = &value + return obj +} + +func (obj *patternFlowVxlanVniCounter) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Start != nil { + + if *obj.obj.Start > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanVniCounter.Start <= 16777215 but Got %d", *obj.obj.Start)) + } + + } + + if obj.obj.Step != nil { + + if *obj.obj.Step > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanVniCounter.Step <= 16777215 but Got %d", *obj.obj.Step)) + } + + } + + if obj.obj.Count != nil { + + if *obj.obj.Count > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanVniCounter.Count <= 16777215 but Got %d", *obj.obj.Count)) + } + + } + +} + +func (obj *patternFlowVxlanVniCounter) setDefault() { + if obj.obj.Start == nil { + obj.SetStart(0) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + +} diff --git a/gosnappi/pattern_flow_vxlan_vni_metric_tag.go b/gosnappi/pattern_flow_vxlan_vni_metric_tag.go new file mode 100644 index 00000000..1c67c848 --- /dev/null +++ b/gosnappi/pattern_flow_vxlan_vni_metric_tag.go @@ -0,0 +1,385 @@ +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" +) + +// ***** PatternFlowVxlanVniMetricTag ***** +type patternFlowVxlanVniMetricTag struct { + validation + obj *otg.PatternFlowVxlanVniMetricTag + marshaller marshalPatternFlowVxlanVniMetricTag + unMarshaller unMarshalPatternFlowVxlanVniMetricTag +} + +func NewPatternFlowVxlanVniMetricTag() PatternFlowVxlanVniMetricTag { + obj := patternFlowVxlanVniMetricTag{obj: &otg.PatternFlowVxlanVniMetricTag{}} + obj.setDefault() + return &obj +} + +func (obj *patternFlowVxlanVniMetricTag) msg() *otg.PatternFlowVxlanVniMetricTag { + return obj.obj +} + +func (obj *patternFlowVxlanVniMetricTag) setMsg(msg *otg.PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniMetricTag { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalpatternFlowVxlanVniMetricTag struct { + obj *patternFlowVxlanVniMetricTag +} + +type marshalPatternFlowVxlanVniMetricTag interface { + // ToProto marshals PatternFlowVxlanVniMetricTag to protobuf object *otg.PatternFlowVxlanVniMetricTag + ToProto() (*otg.PatternFlowVxlanVniMetricTag, error) + // ToPbText marshals PatternFlowVxlanVniMetricTag to protobuf text + ToPbText() (string, error) + // ToYaml marshals PatternFlowVxlanVniMetricTag to YAML text + ToYaml() (string, error) + // ToJson marshals PatternFlowVxlanVniMetricTag to JSON text + ToJson() (string, error) +} + +type unMarshalpatternFlowVxlanVniMetricTag struct { + obj *patternFlowVxlanVniMetricTag +} + +type unMarshalPatternFlowVxlanVniMetricTag interface { + // FromProto unmarshals PatternFlowVxlanVniMetricTag from protobuf object *otg.PatternFlowVxlanVniMetricTag + FromProto(msg *otg.PatternFlowVxlanVniMetricTag) (PatternFlowVxlanVniMetricTag, error) + // FromPbText unmarshals PatternFlowVxlanVniMetricTag from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PatternFlowVxlanVniMetricTag from YAML text + FromYaml(value string) error + // FromJson unmarshals PatternFlowVxlanVniMetricTag from JSON text + FromJson(value string) error +} + +func (obj *patternFlowVxlanVniMetricTag) Marshal() marshalPatternFlowVxlanVniMetricTag { + if obj.marshaller == nil { + obj.marshaller = &marshalpatternFlowVxlanVniMetricTag{obj: obj} + } + return obj.marshaller +} + +func (obj *patternFlowVxlanVniMetricTag) Unmarshal() unMarshalPatternFlowVxlanVniMetricTag { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalpatternFlowVxlanVniMetricTag{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalpatternFlowVxlanVniMetricTag) ToProto() (*otg.PatternFlowVxlanVniMetricTag, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalpatternFlowVxlanVniMetricTag) FromProto(msg *otg.PatternFlowVxlanVniMetricTag) (PatternFlowVxlanVniMetricTag, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalpatternFlowVxlanVniMetricTag) 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 *unMarshalpatternFlowVxlanVniMetricTag) 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 *marshalpatternFlowVxlanVniMetricTag) 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 *unMarshalpatternFlowVxlanVniMetricTag) 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 *marshalpatternFlowVxlanVniMetricTag) 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 *unMarshalpatternFlowVxlanVniMetricTag) 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 *patternFlowVxlanVniMetricTag) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *patternFlowVxlanVniMetricTag) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *patternFlowVxlanVniMetricTag) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *patternFlowVxlanVniMetricTag) Clone() (PatternFlowVxlanVniMetricTag, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPatternFlowVxlanVniMetricTag() + 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 +} + +// PatternFlowVxlanVniMetricTag is metric tag can be used to enable tracking portion of or all bits in a corresponding header field for metrics per each applicable value. These would appear as tagged metrics in corresponding flow metrics. +type PatternFlowVxlanVniMetricTag interface { + Validation + // msg marshals PatternFlowVxlanVniMetricTag to protobuf object *otg.PatternFlowVxlanVniMetricTag + // and doesn't set defaults + msg() *otg.PatternFlowVxlanVniMetricTag + // setMsg unmarshals PatternFlowVxlanVniMetricTag from protobuf object *otg.PatternFlowVxlanVniMetricTag + // and doesn't set defaults + setMsg(*otg.PatternFlowVxlanVniMetricTag) PatternFlowVxlanVniMetricTag + // provides marshal interface + Marshal() marshalPatternFlowVxlanVniMetricTag + // provides unmarshal interface + Unmarshal() unMarshalPatternFlowVxlanVniMetricTag + // validate validates PatternFlowVxlanVniMetricTag + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PatternFlowVxlanVniMetricTag, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PatternFlowVxlanVniMetricTag. + Name() string + // SetName assigns string provided by user to PatternFlowVxlanVniMetricTag + SetName(value string) PatternFlowVxlanVniMetricTag + // Offset returns uint32, set in PatternFlowVxlanVniMetricTag. + Offset() uint32 + // SetOffset assigns uint32 provided by user to PatternFlowVxlanVniMetricTag + SetOffset(value uint32) PatternFlowVxlanVniMetricTag + // HasOffset checks if Offset has been set in PatternFlowVxlanVniMetricTag + HasOffset() bool + // Length returns uint32, set in PatternFlowVxlanVniMetricTag. + Length() uint32 + // SetLength assigns uint32 provided by user to PatternFlowVxlanVniMetricTag + SetLength(value uint32) PatternFlowVxlanVniMetricTag + // HasLength checks if Length has been set in PatternFlowVxlanVniMetricTag + HasLength() bool +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// Name returns a string +func (obj *patternFlowVxlanVniMetricTag) Name() string { + + return *obj.obj.Name + +} + +// Name used to identify the metrics associated with the values applicable for configured offset and length inside corresponding header field +// SetName sets the string value in the PatternFlowVxlanVniMetricTag object +func (obj *patternFlowVxlanVniMetricTag) SetName(value string) PatternFlowVxlanVniMetricTag { + + obj.obj.Name = &value + return obj +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVxlanVniMetricTag) Offset() uint32 { + + return *obj.obj.Offset + +} + +// Offset in bits relative to start of corresponding header field +// Offset returns a uint32 +func (obj *patternFlowVxlanVniMetricTag) HasOffset() bool { + return obj.obj.Offset != nil +} + +// Offset in bits relative to start of corresponding header field +// SetOffset sets the uint32 value in the PatternFlowVxlanVniMetricTag object +func (obj *patternFlowVxlanVniMetricTag) SetOffset(value uint32) PatternFlowVxlanVniMetricTag { + + obj.obj.Offset = &value + return obj +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVxlanVniMetricTag) Length() uint32 { + + return *obj.obj.Length + +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// Length returns a uint32 +func (obj *patternFlowVxlanVniMetricTag) HasLength() bool { + return obj.obj.Length != nil +} + +// Number of bits to track for metrics starting from configured offset of corresponding header field +// SetLength sets the uint32 value in the PatternFlowVxlanVniMetricTag object +func (obj *patternFlowVxlanVniMetricTag) SetLength(value uint32) PatternFlowVxlanVniMetricTag { + + obj.obj.Length = &value + return obj +} + +func (obj *patternFlowVxlanVniMetricTag) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface PatternFlowVxlanVniMetricTag") + } + + if obj.obj.Offset != nil { + + if *obj.obj.Offset > 23 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= PatternFlowVxlanVniMetricTag.Offset <= 23 but Got %d", *obj.obj.Offset)) + } + + } + + if obj.obj.Length != nil { + + if *obj.obj.Length < 1 || *obj.obj.Length > 24 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= PatternFlowVxlanVniMetricTag.Length <= 24 but Got %d", *obj.obj.Length)) + } + + } + +} + +func (obj *patternFlowVxlanVniMetricTag) setDefault() { + if obj.obj.Offset == nil { + obj.SetOffset(0) + } + if obj.obj.Length == nil { + obj.SetLength(24) + } + +} diff --git a/gosnappi/port.go b/gosnappi/port.go new file mode 100644 index 00000000..620e7e1b --- /dev/null +++ b/gosnappi/port.go @@ -0,0 +1,354 @@ +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" +) + +// ***** Port ***** +type port struct { + validation + obj *otg.Port + marshaller marshalPort + unMarshaller unMarshalPort +} + +func NewPort() Port { + obj := port{obj: &otg.Port{}} + obj.setDefault() + return &obj +} + +func (obj *port) msg() *otg.Port { + return obj.obj +} + +func (obj *port) setMsg(msg *otg.Port) Port { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalport struct { + obj *port +} + +type marshalPort interface { + // ToProto marshals Port to protobuf object *otg.Port + ToProto() (*otg.Port, error) + // ToPbText marshals Port to protobuf text + ToPbText() (string, error) + // ToYaml marshals Port to YAML text + ToYaml() (string, error) + // ToJson marshals Port to JSON text + ToJson() (string, error) +} + +type unMarshalport struct { + obj *port +} + +type unMarshalPort interface { + // FromProto unmarshals Port from protobuf object *otg.Port + FromProto(msg *otg.Port) (Port, error) + // FromPbText unmarshals Port from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Port from YAML text + FromYaml(value string) error + // FromJson unmarshals Port from JSON text + FromJson(value string) error +} + +func (obj *port) Marshal() marshalPort { + if obj.marshaller == nil { + obj.marshaller = &marshalport{obj: obj} + } + return obj.marshaller +} + +func (obj *port) Unmarshal() unMarshalPort { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalport{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalport) ToProto() (*otg.Port, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalport) FromProto(msg *otg.Port) (Port, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalport) 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 *unMarshalport) 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 *marshalport) 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 *unMarshalport) 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 *marshalport) 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 *unMarshalport) 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 *port) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *port) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *port) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *port) Clone() (Port, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPort() + 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 +} + +// Port is an abstract test port. +type Port interface { + Validation + // msg marshals Port to protobuf object *otg.Port + // and doesn't set defaults + msg() *otg.Port + // setMsg unmarshals Port from protobuf object *otg.Port + // and doesn't set defaults + setMsg(*otg.Port) Port + // provides marshal interface + Marshal() marshalPort + // provides unmarshal interface + Unmarshal() unMarshalPort + // validate validates Port + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Port, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Location returns string, set in Port. + Location() string + // SetLocation assigns string provided by user to Port + SetLocation(value string) Port + // HasLocation checks if Location has been set in Port + HasLocation() bool + // Name returns string, set in Port. + Name() string + // SetName assigns string provided by user to Port + SetName(value string) Port +} + +// The location of a test port. It is the endpoint where packets will emit from. +// Test port locations can be the following: +// - physical appliance with multiple ports +// - physical chassis with multiple cards and ports +// - local interface +// - virtual machine, docker container, kubernetes cluster +// +// The test port location format is implementation specific. Use the /results/capabilities API to determine what formats an implementation supports for the location property. +// Get the configured location state by using the /results/port API. +// Location returns a string +func (obj *port) Location() string { + + return *obj.obj.Location + +} + +// The location of a test port. It is the endpoint where packets will emit from. +// Test port locations can be the following: +// - physical appliance with multiple ports +// - physical chassis with multiple cards and ports +// - local interface +// - virtual machine, docker container, kubernetes cluster +// +// The test port location format is implementation specific. Use the /results/capabilities API to determine what formats an implementation supports for the location property. +// Get the configured location state by using the /results/port API. +// Location returns a string +func (obj *port) HasLocation() bool { + return obj.obj.Location != nil +} + +// The location of a test port. It is the endpoint where packets will emit from. +// Test port locations can be the following: +// - physical appliance with multiple ports +// - physical chassis with multiple cards and ports +// - local interface +// - virtual machine, docker container, kubernetes cluster +// +// The test port location format is implementation specific. Use the /results/capabilities API to determine what formats an implementation supports for the location property. +// Get the configured location state by using the /results/port API. +// SetLocation sets the string value in the Port object +func (obj *port) SetLocation(value string) Port { + + obj.obj.Location = &value + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *port) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the Port object +func (obj *port) SetName(value string) Port { + + obj.obj.Name = &value + return obj +} + +func (obj *port) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface Port") + } +} + +func (obj *port) setDefault() { + +} diff --git a/gosnappi/port_metric.go b/gosnappi/port_metric.go new file mode 100644 index 00000000..c03a394c --- /dev/null +++ b/gosnappi/port_metric.go @@ -0,0 +1,699 @@ +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" +) + +// ***** PortMetric ***** +type portMetric struct { + validation + obj *otg.PortMetric + marshaller marshalPortMetric + unMarshaller unMarshalPortMetric +} + +func NewPortMetric() PortMetric { + obj := portMetric{obj: &otg.PortMetric{}} + obj.setDefault() + return &obj +} + +func (obj *portMetric) msg() *otg.PortMetric { + return obj.obj +} + +func (obj *portMetric) setMsg(msg *otg.PortMetric) PortMetric { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalportMetric struct { + obj *portMetric +} + +type marshalPortMetric interface { + // ToProto marshals PortMetric to protobuf object *otg.PortMetric + ToProto() (*otg.PortMetric, error) + // ToPbText marshals PortMetric to protobuf text + ToPbText() (string, error) + // ToYaml marshals PortMetric to YAML text + ToYaml() (string, error) + // ToJson marshals PortMetric to JSON text + ToJson() (string, error) +} + +type unMarshalportMetric struct { + obj *portMetric +} + +type unMarshalPortMetric interface { + // FromProto unmarshals PortMetric from protobuf object *otg.PortMetric + FromProto(msg *otg.PortMetric) (PortMetric, error) + // FromPbText unmarshals PortMetric from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PortMetric from YAML text + FromYaml(value string) error + // FromJson unmarshals PortMetric from JSON text + FromJson(value string) error +} + +func (obj *portMetric) Marshal() marshalPortMetric { + if obj.marshaller == nil { + obj.marshaller = &marshalportMetric{obj: obj} + } + return obj.marshaller +} + +func (obj *portMetric) Unmarshal() unMarshalPortMetric { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalportMetric{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalportMetric) ToProto() (*otg.PortMetric, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalportMetric) FromProto(msg *otg.PortMetric) (PortMetric, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalportMetric) 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 *unMarshalportMetric) 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 *marshalportMetric) 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 *unMarshalportMetric) 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 *marshalportMetric) 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 *unMarshalportMetric) 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 *portMetric) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *portMetric) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *portMetric) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *portMetric) Clone() (PortMetric, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPortMetric() + 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 +} + +// PortMetric is description is TBD +type PortMetric interface { + Validation + // msg marshals PortMetric to protobuf object *otg.PortMetric + // and doesn't set defaults + msg() *otg.PortMetric + // setMsg unmarshals PortMetric from protobuf object *otg.PortMetric + // and doesn't set defaults + setMsg(*otg.PortMetric) PortMetric + // provides marshal interface + Marshal() marshalPortMetric + // provides unmarshal interface + Unmarshal() unMarshalPortMetric + // validate validates PortMetric + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PortMetric, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in PortMetric. + Name() string + // SetName assigns string provided by user to PortMetric + SetName(value string) PortMetric + // HasName checks if Name has been set in PortMetric + HasName() bool + // Location returns string, set in PortMetric. + Location() string + // SetLocation assigns string provided by user to PortMetric + SetLocation(value string) PortMetric + // HasLocation checks if Location has been set in PortMetric + HasLocation() bool + // Link returns PortMetricLinkEnum, set in PortMetric + Link() PortMetricLinkEnum + // SetLink assigns PortMetricLinkEnum provided by user to PortMetric + SetLink(value PortMetricLinkEnum) PortMetric + // HasLink checks if Link has been set in PortMetric + HasLink() bool + // Capture returns PortMetricCaptureEnum, set in PortMetric + Capture() PortMetricCaptureEnum + // SetCapture assigns PortMetricCaptureEnum provided by user to PortMetric + SetCapture(value PortMetricCaptureEnum) PortMetric + // HasCapture checks if Capture has been set in PortMetric + HasCapture() bool + // FramesTx returns uint64, set in PortMetric. + FramesTx() uint64 + // SetFramesTx assigns uint64 provided by user to PortMetric + SetFramesTx(value uint64) PortMetric + // HasFramesTx checks if FramesTx has been set in PortMetric + HasFramesTx() bool + // FramesRx returns uint64, set in PortMetric. + FramesRx() uint64 + // SetFramesRx assigns uint64 provided by user to PortMetric + SetFramesRx(value uint64) PortMetric + // HasFramesRx checks if FramesRx has been set in PortMetric + HasFramesRx() bool + // BytesTx returns uint64, set in PortMetric. + BytesTx() uint64 + // SetBytesTx assigns uint64 provided by user to PortMetric + SetBytesTx(value uint64) PortMetric + // HasBytesTx checks if BytesTx has been set in PortMetric + HasBytesTx() bool + // BytesRx returns uint64, set in PortMetric. + BytesRx() uint64 + // SetBytesRx assigns uint64 provided by user to PortMetric + SetBytesRx(value uint64) PortMetric + // HasBytesRx checks if BytesRx has been set in PortMetric + HasBytesRx() bool + // FramesTxRate returns float32, set in PortMetric. + FramesTxRate() float32 + // SetFramesTxRate assigns float32 provided by user to PortMetric + SetFramesTxRate(value float32) PortMetric + // HasFramesTxRate checks if FramesTxRate has been set in PortMetric + HasFramesTxRate() bool + // FramesRxRate returns float32, set in PortMetric. + FramesRxRate() float32 + // SetFramesRxRate assigns float32 provided by user to PortMetric + SetFramesRxRate(value float32) PortMetric + // HasFramesRxRate checks if FramesRxRate has been set in PortMetric + HasFramesRxRate() bool + // BytesTxRate returns float32, set in PortMetric. + BytesTxRate() float32 + // SetBytesTxRate assigns float32 provided by user to PortMetric + SetBytesTxRate(value float32) PortMetric + // HasBytesTxRate checks if BytesTxRate has been set in PortMetric + HasBytesTxRate() bool + // BytesRxRate returns float32, set in PortMetric. + BytesRxRate() float32 + // SetBytesRxRate assigns float32 provided by user to PortMetric + SetBytesRxRate(value float32) PortMetric + // HasBytesRxRate checks if BytesRxRate has been set in PortMetric + HasBytesRxRate() bool + // Transmit returns PortMetricTransmitEnum, set in PortMetric + Transmit() PortMetricTransmitEnum + // SetTransmit assigns PortMetricTransmitEnum provided by user to PortMetric + SetTransmit(value PortMetricTransmitEnum) PortMetric + // HasTransmit checks if Transmit has been set in PortMetric + HasTransmit() bool +} + +// The name of a configured port +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// Name returns a string +func (obj *portMetric) Name() string { + + return *obj.obj.Name + +} + +// The name of a configured port +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// Name returns a string +func (obj *portMetric) HasName() bool { + return obj.obj.Name != nil +} + +// The name of a configured port +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// SetName sets the string value in the PortMetric object +func (obj *portMetric) SetName(value string) PortMetric { + + obj.obj.Name = &value + return obj +} + +// The state of the connection to the test port location. The format should be the configured port location along with any custom connection state message. +// Location returns a string +func (obj *portMetric) Location() string { + + return *obj.obj.Location + +} + +// The state of the connection to the test port location. The format should be the configured port location along with any custom connection state message. +// Location returns a string +func (obj *portMetric) HasLocation() bool { + return obj.obj.Location != nil +} + +// The state of the connection to the test port location. The format should be the configured port location along with any custom connection state message. +// SetLocation sets the string value in the PortMetric object +func (obj *portMetric) SetLocation(value string) PortMetric { + + obj.obj.Location = &value + return obj +} + +type PortMetricLinkEnum string + +// Enum of Link on PortMetric +var PortMetricLink = struct { + UP PortMetricLinkEnum + DOWN PortMetricLinkEnum +}{ + UP: PortMetricLinkEnum("up"), + DOWN: PortMetricLinkEnum("down"), +} + +func (obj *portMetric) Link() PortMetricLinkEnum { + return PortMetricLinkEnum(obj.obj.Link.Enum().String()) +} + +// The state of the test port link The string can be up, down or a custom error message. +// Link returns a string +func (obj *portMetric) HasLink() bool { + return obj.obj.Link != nil +} + +func (obj *portMetric) SetLink(value PortMetricLinkEnum) PortMetric { + intValue, ok := otg.PortMetric_Link_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PortMetricLinkEnum", string(value))) + return obj + } + enumValue := otg.PortMetric_Link_Enum(intValue) + obj.obj.Link = &enumValue + + return obj +} + +type PortMetricCaptureEnum string + +// Enum of Capture on PortMetric +var PortMetricCapture = struct { + STARTED PortMetricCaptureEnum + STOPPED PortMetricCaptureEnum +}{ + STARTED: PortMetricCaptureEnum("started"), + STOPPED: PortMetricCaptureEnum("stopped"), +} + +func (obj *portMetric) Capture() PortMetricCaptureEnum { + return PortMetricCaptureEnum(obj.obj.Capture.Enum().String()) +} + +// The state of the test port capture infrastructure. The string can be started, stopped or a custom error message. +// Capture returns a string +func (obj *portMetric) HasCapture() bool { + return obj.obj.Capture != nil +} + +func (obj *portMetric) SetCapture(value PortMetricCaptureEnum) PortMetric { + intValue, ok := otg.PortMetric_Capture_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PortMetricCaptureEnum", string(value))) + return obj + } + enumValue := otg.PortMetric_Capture_Enum(intValue) + obj.obj.Capture = &enumValue + + return obj +} + +// The current total number of frames transmitted +// FramesTx returns a uint64 +func (obj *portMetric) FramesTx() uint64 { + + return *obj.obj.FramesTx + +} + +// The current total number of frames transmitted +// FramesTx returns a uint64 +func (obj *portMetric) HasFramesTx() bool { + return obj.obj.FramesTx != nil +} + +// The current total number of frames transmitted +// SetFramesTx sets the uint64 value in the PortMetric object +func (obj *portMetric) SetFramesTx(value uint64) PortMetric { + + obj.obj.FramesTx = &value + return obj +} + +// The current total number of valid frames received +// FramesRx returns a uint64 +func (obj *portMetric) FramesRx() uint64 { + + return *obj.obj.FramesRx + +} + +// The current total number of valid frames received +// FramesRx returns a uint64 +func (obj *portMetric) HasFramesRx() bool { + return obj.obj.FramesRx != nil +} + +// The current total number of valid frames received +// SetFramesRx sets the uint64 value in the PortMetric object +func (obj *portMetric) SetFramesRx(value uint64) PortMetric { + + obj.obj.FramesRx = &value + return obj +} + +// The current total number of bytes transmitted +// BytesTx returns a uint64 +func (obj *portMetric) BytesTx() uint64 { + + return *obj.obj.BytesTx + +} + +// The current total number of bytes transmitted +// BytesTx returns a uint64 +func (obj *portMetric) HasBytesTx() bool { + return obj.obj.BytesTx != nil +} + +// The current total number of bytes transmitted +// SetBytesTx sets the uint64 value in the PortMetric object +func (obj *portMetric) SetBytesTx(value uint64) PortMetric { + + obj.obj.BytesTx = &value + return obj +} + +// The current total number of valid bytes received +// BytesRx returns a uint64 +func (obj *portMetric) BytesRx() uint64 { + + return *obj.obj.BytesRx + +} + +// The current total number of valid bytes received +// BytesRx returns a uint64 +func (obj *portMetric) HasBytesRx() bool { + return obj.obj.BytesRx != nil +} + +// The current total number of valid bytes received +// SetBytesRx sets the uint64 value in the PortMetric object +func (obj *portMetric) SetBytesRx(value uint64) PortMetric { + + obj.obj.BytesRx = &value + return obj +} + +// The current rate of frames transmitted +// FramesTxRate returns a float32 +func (obj *portMetric) FramesTxRate() float32 { + + return *obj.obj.FramesTxRate + +} + +// The current rate of frames transmitted +// FramesTxRate returns a float32 +func (obj *portMetric) HasFramesTxRate() bool { + return obj.obj.FramesTxRate != nil +} + +// The current rate of frames transmitted +// SetFramesTxRate sets the float32 value in the PortMetric object +func (obj *portMetric) SetFramesTxRate(value float32) PortMetric { + + obj.obj.FramesTxRate = &value + return obj +} + +// The current rate of valid frames received +// FramesRxRate returns a float32 +func (obj *portMetric) FramesRxRate() float32 { + + return *obj.obj.FramesRxRate + +} + +// The current rate of valid frames received +// FramesRxRate returns a float32 +func (obj *portMetric) HasFramesRxRate() bool { + return obj.obj.FramesRxRate != nil +} + +// The current rate of valid frames received +// SetFramesRxRate sets the float32 value in the PortMetric object +func (obj *portMetric) SetFramesRxRate(value float32) PortMetric { + + obj.obj.FramesRxRate = &value + return obj +} + +// The current rate of bytes transmitted +// BytesTxRate returns a float32 +func (obj *portMetric) BytesTxRate() float32 { + + return *obj.obj.BytesTxRate + +} + +// The current rate of bytes transmitted +// BytesTxRate returns a float32 +func (obj *portMetric) HasBytesTxRate() bool { + return obj.obj.BytesTxRate != nil +} + +// The current rate of bytes transmitted +// SetBytesTxRate sets the float32 value in the PortMetric object +func (obj *portMetric) SetBytesTxRate(value float32) PortMetric { + + obj.obj.BytesTxRate = &value + return obj +} + +// The current rate of bytes received +// BytesRxRate returns a float32 +func (obj *portMetric) BytesRxRate() float32 { + + return *obj.obj.BytesRxRate + +} + +// The current rate of bytes received +// BytesRxRate returns a float32 +func (obj *portMetric) HasBytesRxRate() bool { + return obj.obj.BytesRxRate != nil +} + +// The current rate of bytes received +// SetBytesRxRate sets the float32 value in the PortMetric object +func (obj *portMetric) SetBytesRxRate(value float32) PortMetric { + + obj.obj.BytesRxRate = &value + return obj +} + +type PortMetricTransmitEnum string + +// Enum of Transmit on PortMetric +var PortMetricTransmit = struct { + STARTED PortMetricTransmitEnum + STOPPED PortMetricTransmitEnum +}{ + STARTED: PortMetricTransmitEnum("started"), + STOPPED: PortMetricTransmitEnum("stopped"), +} + +func (obj *portMetric) Transmit() PortMetricTransmitEnum { + return PortMetricTransmitEnum(obj.obj.Transmit.Enum().String()) +} + +// The transmit state of the flow. +// Transmit returns a string +func (obj *portMetric) HasTransmit() bool { + return obj.obj.Transmit != nil +} + +func (obj *portMetric) SetTransmit(value PortMetricTransmitEnum) PortMetric { + intValue, ok := otg.PortMetric_Transmit_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on PortMetricTransmitEnum", string(value))) + return obj + } + enumValue := otg.PortMetric_Transmit_Enum(intValue) + obj.obj.Transmit = &enumValue + + return obj +} + +func (obj *portMetric) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *portMetric) setDefault() { + +} diff --git a/gosnappi/port_metrics_request.go b/gosnappi/port_metrics_request.go new file mode 100644 index 00000000..254415cd --- /dev/null +++ b/gosnappi/port_metrics_request.go @@ -0,0 +1,373 @@ +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" +) + +// ***** PortMetricsRequest ***** +type portMetricsRequest struct { + validation + obj *otg.PortMetricsRequest + marshaller marshalPortMetricsRequest + unMarshaller unMarshalPortMetricsRequest +} + +func NewPortMetricsRequest() PortMetricsRequest { + obj := portMetricsRequest{obj: &otg.PortMetricsRequest{}} + obj.setDefault() + return &obj +} + +func (obj *portMetricsRequest) msg() *otg.PortMetricsRequest { + return obj.obj +} + +func (obj *portMetricsRequest) setMsg(msg *otg.PortMetricsRequest) PortMetricsRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalportMetricsRequest struct { + obj *portMetricsRequest +} + +type marshalPortMetricsRequest interface { + // ToProto marshals PortMetricsRequest to protobuf object *otg.PortMetricsRequest + ToProto() (*otg.PortMetricsRequest, error) + // ToPbText marshals PortMetricsRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals PortMetricsRequest to YAML text + ToYaml() (string, error) + // ToJson marshals PortMetricsRequest to JSON text + ToJson() (string, error) +} + +type unMarshalportMetricsRequest struct { + obj *portMetricsRequest +} + +type unMarshalPortMetricsRequest interface { + // FromProto unmarshals PortMetricsRequest from protobuf object *otg.PortMetricsRequest + FromProto(msg *otg.PortMetricsRequest) (PortMetricsRequest, error) + // FromPbText unmarshals PortMetricsRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PortMetricsRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals PortMetricsRequest from JSON text + FromJson(value string) error +} + +func (obj *portMetricsRequest) Marshal() marshalPortMetricsRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalportMetricsRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *portMetricsRequest) Unmarshal() unMarshalPortMetricsRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalportMetricsRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalportMetricsRequest) ToProto() (*otg.PortMetricsRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalportMetricsRequest) FromProto(msg *otg.PortMetricsRequest) (PortMetricsRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalportMetricsRequest) 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 *unMarshalportMetricsRequest) 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 *marshalportMetricsRequest) 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 *unMarshalportMetricsRequest) 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 *marshalportMetricsRequest) 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 *unMarshalportMetricsRequest) 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 *portMetricsRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *portMetricsRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *portMetricsRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *portMetricsRequest) Clone() (PortMetricsRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPortMetricsRequest() + 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 +} + +// PortMetricsRequest is the port result request to the traffic generator +type PortMetricsRequest interface { + Validation + // msg marshals PortMetricsRequest to protobuf object *otg.PortMetricsRequest + // and doesn't set defaults + msg() *otg.PortMetricsRequest + // setMsg unmarshals PortMetricsRequest from protobuf object *otg.PortMetricsRequest + // and doesn't set defaults + setMsg(*otg.PortMetricsRequest) PortMetricsRequest + // provides marshal interface + Marshal() marshalPortMetricsRequest + // provides unmarshal interface + Unmarshal() unMarshalPortMetricsRequest + // validate validates PortMetricsRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PortMetricsRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PortNames returns []string, set in PortMetricsRequest. + PortNames() []string + // SetPortNames assigns []string provided by user to PortMetricsRequest + SetPortNames(value []string) PortMetricsRequest + // ColumnNames returns []PortMetricsRequestColumnNamesEnum, set in PortMetricsRequest + ColumnNames() []PortMetricsRequestColumnNamesEnum + // SetColumnNames assigns []PortMetricsRequestColumnNamesEnum provided by user to PortMetricsRequest + SetColumnNames(value []PortMetricsRequestColumnNamesEnum) PortMetricsRequest +} + +// The names of objects to return results for. An empty list will return all port row results. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// PortNames returns a []string +func (obj *portMetricsRequest) PortNames() []string { + if obj.obj.PortNames == nil { + obj.obj.PortNames = make([]string, 0) + } + return obj.obj.PortNames +} + +// The names of objects to return results for. An empty list will return all port row results. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// SetPortNames sets the []string value in the PortMetricsRequest object +func (obj *portMetricsRequest) SetPortNames(value []string) PortMetricsRequest { + + if obj.obj.PortNames == nil { + obj.obj.PortNames = make([]string, 0) + } + obj.obj.PortNames = value + + return obj +} + +type PortMetricsRequestColumnNamesEnum string + +// Enum of ColumnNames on PortMetricsRequest +var PortMetricsRequestColumnNames = struct { + TRANSMIT PortMetricsRequestColumnNamesEnum + LOCATION PortMetricsRequestColumnNamesEnum + LINK PortMetricsRequestColumnNamesEnum + CAPTURE PortMetricsRequestColumnNamesEnum + FRAMES_TX PortMetricsRequestColumnNamesEnum + FRAMES_RX PortMetricsRequestColumnNamesEnum + BYTES_TX PortMetricsRequestColumnNamesEnum + BYTES_RX PortMetricsRequestColumnNamesEnum + FRAMES_TX_RATE PortMetricsRequestColumnNamesEnum + FRAMES_RX_RATE PortMetricsRequestColumnNamesEnum + BYTES_TX_RATE PortMetricsRequestColumnNamesEnum + BYTES_RX_RATE PortMetricsRequestColumnNamesEnum +}{ + TRANSMIT: PortMetricsRequestColumnNamesEnum("transmit"), + LOCATION: PortMetricsRequestColumnNamesEnum("location"), + LINK: PortMetricsRequestColumnNamesEnum("link"), + CAPTURE: PortMetricsRequestColumnNamesEnum("capture"), + FRAMES_TX: PortMetricsRequestColumnNamesEnum("frames_tx"), + FRAMES_RX: PortMetricsRequestColumnNamesEnum("frames_rx"), + BYTES_TX: PortMetricsRequestColumnNamesEnum("bytes_tx"), + BYTES_RX: PortMetricsRequestColumnNamesEnum("bytes_rx"), + FRAMES_TX_RATE: PortMetricsRequestColumnNamesEnum("frames_tx_rate"), + FRAMES_RX_RATE: PortMetricsRequestColumnNamesEnum("frames_rx_rate"), + BYTES_TX_RATE: PortMetricsRequestColumnNamesEnum("bytes_tx_rate"), + BYTES_RX_RATE: PortMetricsRequestColumnNamesEnum("bytes_rx_rate"), +} + +func (obj *portMetricsRequest) ColumnNames() []PortMetricsRequestColumnNamesEnum { + items := []PortMetricsRequestColumnNamesEnum{} + for _, item := range obj.obj.ColumnNames { + items = append(items, PortMetricsRequestColumnNamesEnum(item.String())) + } + return items +} + +// The list of column names that the returned result set will contain. If the list is empty then all columns will be returned. The name of the port cannot be excluded. +// SetColumnNames sets the []string value in the PortMetricsRequest object +func (obj *portMetricsRequest) SetColumnNames(value []PortMetricsRequestColumnNamesEnum) PortMetricsRequest { + + items := []otg.PortMetricsRequest_ColumnNames_Enum{} + for _, item := range value { + intValue := otg.PortMetricsRequest_ColumnNames_Enum_value[string(item)] + items = append(items, otg.PortMetricsRequest_ColumnNames_Enum(intValue)) + } + obj.obj.ColumnNames = items + return obj +} + +func (obj *portMetricsRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *portMetricsRequest) setDefault() { + +} diff --git a/gosnappi/port_options.go b/gosnappi/port_options.go new file mode 100644 index 00000000..92d3c3d3 --- /dev/null +++ b/gosnappi/port_options.go @@ -0,0 +1,309 @@ +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" +) + +// ***** PortOptions ***** +type portOptions struct { + validation + obj *otg.PortOptions + marshaller marshalPortOptions + unMarshaller unMarshalPortOptions +} + +func NewPortOptions() PortOptions { + obj := portOptions{obj: &otg.PortOptions{}} + obj.setDefault() + return &obj +} + +func (obj *portOptions) msg() *otg.PortOptions { + return obj.obj +} + +func (obj *portOptions) setMsg(msg *otg.PortOptions) PortOptions { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalportOptions struct { + obj *portOptions +} + +type marshalPortOptions interface { + // ToProto marshals PortOptions to protobuf object *otg.PortOptions + ToProto() (*otg.PortOptions, error) + // ToPbText marshals PortOptions to protobuf text + ToPbText() (string, error) + // ToYaml marshals PortOptions to YAML text + ToYaml() (string, error) + // ToJson marshals PortOptions to JSON text + ToJson() (string, error) +} + +type unMarshalportOptions struct { + obj *portOptions +} + +type unMarshalPortOptions interface { + // FromProto unmarshals PortOptions from protobuf object *otg.PortOptions + FromProto(msg *otg.PortOptions) (PortOptions, error) + // FromPbText unmarshals PortOptions from protobuf text + FromPbText(value string) error + // FromYaml unmarshals PortOptions from YAML text + FromYaml(value string) error + // FromJson unmarshals PortOptions from JSON text + FromJson(value string) error +} + +func (obj *portOptions) Marshal() marshalPortOptions { + if obj.marshaller == nil { + obj.marshaller = &marshalportOptions{obj: obj} + } + return obj.marshaller +} + +func (obj *portOptions) Unmarshal() unMarshalPortOptions { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalportOptions{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalportOptions) ToProto() (*otg.PortOptions, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalportOptions) FromProto(msg *otg.PortOptions) (PortOptions, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalportOptions) 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 *unMarshalportOptions) 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 *marshalportOptions) 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 *unMarshalportOptions) 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 *marshalportOptions) 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 *unMarshalportOptions) 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 *portOptions) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *portOptions) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *portOptions) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *portOptions) Clone() (PortOptions, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewPortOptions() + 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 +} + +// PortOptions is common port options that apply to all configured Port objects. +type PortOptions interface { + Validation + // msg marshals PortOptions to protobuf object *otg.PortOptions + // and doesn't set defaults + msg() *otg.PortOptions + // setMsg unmarshals PortOptions from protobuf object *otg.PortOptions + // and doesn't set defaults + setMsg(*otg.PortOptions) PortOptions + // provides marshal interface + Marshal() marshalPortOptions + // provides unmarshal interface + Unmarshal() unMarshalPortOptions + // validate validates PortOptions + validate() error + // A stringer function + String() string + // Clones the object + Clone() (PortOptions, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // LocationPreemption returns bool, set in PortOptions. + LocationPreemption() bool + // SetLocationPreemption assigns bool provided by user to PortOptions + SetLocationPreemption(value bool) PortOptions + // HasLocationPreemption checks if LocationPreemption has been set in PortOptions + HasLocationPreemption() bool +} + +// Preempt all the test port locations as defined by the Port.Port.properties.location. If the test ports defined by their location values are in use and this value is true, the test ports will be preempted. +// LocationPreemption returns a bool +func (obj *portOptions) LocationPreemption() bool { + + return *obj.obj.LocationPreemption + +} + +// Preempt all the test port locations as defined by the Port.Port.properties.location. If the test ports defined by their location values are in use and this value is true, the test ports will be preempted. +// LocationPreemption returns a bool +func (obj *portOptions) HasLocationPreemption() bool { + return obj.obj.LocationPreemption != nil +} + +// Preempt all the test port locations as defined by the Port.Port.properties.location. If the test ports defined by their location values are in use and this value is true, the test ports will be preempted. +// SetLocationPreemption sets the bool value in the PortOptions object +func (obj *portOptions) SetLocationPreemption(value bool) PortOptions { + + obj.obj.LocationPreemption = &value + return obj +} + +func (obj *portOptions) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *portOptions) setDefault() { + if obj.obj.LocationPreemption == nil { + obj.SetLocationPreemption(false) + } + +} diff --git a/gosnappi/protocol_options.go b/gosnappi/protocol_options.go new file mode 100644 index 00000000..552a1c08 --- /dev/null +++ b/gosnappi/protocol_options.go @@ -0,0 +1,309 @@ +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" +) + +// ***** ProtocolOptions ***** +type protocolOptions struct { + validation + obj *otg.ProtocolOptions + marshaller marshalProtocolOptions + unMarshaller unMarshalProtocolOptions +} + +func NewProtocolOptions() ProtocolOptions { + obj := protocolOptions{obj: &otg.ProtocolOptions{}} + obj.setDefault() + return &obj +} + +func (obj *protocolOptions) msg() *otg.ProtocolOptions { + return obj.obj +} + +func (obj *protocolOptions) setMsg(msg *otg.ProtocolOptions) ProtocolOptions { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalprotocolOptions struct { + obj *protocolOptions +} + +type marshalProtocolOptions interface { + // ToProto marshals ProtocolOptions to protobuf object *otg.ProtocolOptions + ToProto() (*otg.ProtocolOptions, error) + // ToPbText marshals ProtocolOptions to protobuf text + ToPbText() (string, error) + // ToYaml marshals ProtocolOptions to YAML text + ToYaml() (string, error) + // ToJson marshals ProtocolOptions to JSON text + ToJson() (string, error) +} + +type unMarshalprotocolOptions struct { + obj *protocolOptions +} + +type unMarshalProtocolOptions interface { + // FromProto unmarshals ProtocolOptions from protobuf object *otg.ProtocolOptions + FromProto(msg *otg.ProtocolOptions) (ProtocolOptions, error) + // FromPbText unmarshals ProtocolOptions from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ProtocolOptions from YAML text + FromYaml(value string) error + // FromJson unmarshals ProtocolOptions from JSON text + FromJson(value string) error +} + +func (obj *protocolOptions) Marshal() marshalProtocolOptions { + if obj.marshaller == nil { + obj.marshaller = &marshalprotocolOptions{obj: obj} + } + return obj.marshaller +} + +func (obj *protocolOptions) Unmarshal() unMarshalProtocolOptions { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalprotocolOptions{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalprotocolOptions) ToProto() (*otg.ProtocolOptions, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalprotocolOptions) FromProto(msg *otg.ProtocolOptions) (ProtocolOptions, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalprotocolOptions) 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 *unMarshalprotocolOptions) 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 *marshalprotocolOptions) 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 *unMarshalprotocolOptions) 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 *marshalprotocolOptions) 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 *unMarshalprotocolOptions) 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 *protocolOptions) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *protocolOptions) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *protocolOptions) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *protocolOptions) Clone() (ProtocolOptions, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewProtocolOptions() + 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 +} + +// ProtocolOptions is common options that apply to all configured protocols and interfaces. +type ProtocolOptions interface { + Validation + // msg marshals ProtocolOptions to protobuf object *otg.ProtocolOptions + // and doesn't set defaults + msg() *otg.ProtocolOptions + // setMsg unmarshals ProtocolOptions from protobuf object *otg.ProtocolOptions + // and doesn't set defaults + setMsg(*otg.ProtocolOptions) ProtocolOptions + // provides marshal interface + Marshal() marshalProtocolOptions + // provides unmarshal interface + Unmarshal() unMarshalProtocolOptions + // validate validates ProtocolOptions + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ProtocolOptions, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // AutoStartAll returns bool, set in ProtocolOptions. + AutoStartAll() bool + // SetAutoStartAll assigns bool provided by user to ProtocolOptions + SetAutoStartAll(value bool) ProtocolOptions + // HasAutoStartAll checks if AutoStartAll has been set in ProtocolOptions + HasAutoStartAll() bool +} + +// When set to true, all underlying resources for configured protocols and interfaces shall be created and corresponding protocol session negotiation shall be initiated. Otherwise, when set to false, corresponding protocol session negotiation will need to be initiated using a separate set_protocol_state API call. +// AutoStartAll returns a bool +func (obj *protocolOptions) AutoStartAll() bool { + + return *obj.obj.AutoStartAll + +} + +// When set to true, all underlying resources for configured protocols and interfaces shall be created and corresponding protocol session negotiation shall be initiated. Otherwise, when set to false, corresponding protocol session negotiation will need to be initiated using a separate set_protocol_state API call. +// AutoStartAll returns a bool +func (obj *protocolOptions) HasAutoStartAll() bool { + return obj.obj.AutoStartAll != nil +} + +// When set to true, all underlying resources for configured protocols and interfaces shall be created and corresponding protocol session negotiation shall be initiated. Otherwise, when set to false, corresponding protocol session negotiation will need to be initiated using a separate set_protocol_state API call. +// SetAutoStartAll sets the bool value in the ProtocolOptions object +func (obj *protocolOptions) SetAutoStartAll(value bool) ProtocolOptions { + + obj.obj.AutoStartAll = &value + return obj +} + +func (obj *protocolOptions) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *protocolOptions) setDefault() { + if obj.obj.AutoStartAll == nil { + obj.SetAutoStartAll(true) + } + +} diff --git a/gosnappi/result_bgp_as_path.go b/gosnappi/result_bgp_as_path.go new file mode 100644 index 00000000..1b5c8a04 --- /dev/null +++ b/gosnappi/result_bgp_as_path.go @@ -0,0 +1,390 @@ +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" +) + +// ***** ResultBgpAsPath ***** +type resultBgpAsPath struct { + validation + obj *otg.ResultBgpAsPath + marshaller marshalResultBgpAsPath + unMarshaller unMarshalResultBgpAsPath + segmentsHolder ResultBgpAsPathResultBgpAsPathSegmentIter +} + +func NewResultBgpAsPath() ResultBgpAsPath { + obj := resultBgpAsPath{obj: &otg.ResultBgpAsPath{}} + obj.setDefault() + return &obj +} + +func (obj *resultBgpAsPath) msg() *otg.ResultBgpAsPath { + return obj.obj +} + +func (obj *resultBgpAsPath) setMsg(msg *otg.ResultBgpAsPath) ResultBgpAsPath { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultBgpAsPath struct { + obj *resultBgpAsPath +} + +type marshalResultBgpAsPath interface { + // ToProto marshals ResultBgpAsPath to protobuf object *otg.ResultBgpAsPath + ToProto() (*otg.ResultBgpAsPath, error) + // ToPbText marshals ResultBgpAsPath to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultBgpAsPath to YAML text + ToYaml() (string, error) + // ToJson marshals ResultBgpAsPath to JSON text + ToJson() (string, error) +} + +type unMarshalresultBgpAsPath struct { + obj *resultBgpAsPath +} + +type unMarshalResultBgpAsPath interface { + // FromProto unmarshals ResultBgpAsPath from protobuf object *otg.ResultBgpAsPath + FromProto(msg *otg.ResultBgpAsPath) (ResultBgpAsPath, error) + // FromPbText unmarshals ResultBgpAsPath from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultBgpAsPath from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultBgpAsPath from JSON text + FromJson(value string) error +} + +func (obj *resultBgpAsPath) Marshal() marshalResultBgpAsPath { + if obj.marshaller == nil { + obj.marshaller = &marshalresultBgpAsPath{obj: obj} + } + return obj.marshaller +} + +func (obj *resultBgpAsPath) Unmarshal() unMarshalResultBgpAsPath { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultBgpAsPath{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultBgpAsPath) ToProto() (*otg.ResultBgpAsPath, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultBgpAsPath) FromProto(msg *otg.ResultBgpAsPath) (ResultBgpAsPath, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultBgpAsPath) 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 *unMarshalresultBgpAsPath) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalresultBgpAsPath) 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 *unMarshalresultBgpAsPath) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalresultBgpAsPath) 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 *unMarshalresultBgpAsPath) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *resultBgpAsPath) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultBgpAsPath) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultBgpAsPath) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultBgpAsPath) Clone() (ResultBgpAsPath, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultBgpAsPath() + 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 +} + +func (obj *resultBgpAsPath) setNil() { + obj.segmentsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ResultBgpAsPath is this attribute identifies the autonomous systems through which routing information carried in this UPDATE message has passed. +type ResultBgpAsPath interface { + Validation + // msg marshals ResultBgpAsPath to protobuf object *otg.ResultBgpAsPath + // and doesn't set defaults + msg() *otg.ResultBgpAsPath + // setMsg unmarshals ResultBgpAsPath from protobuf object *otg.ResultBgpAsPath + // and doesn't set defaults + setMsg(*otg.ResultBgpAsPath) ResultBgpAsPath + // provides marshal interface + Marshal() marshalResultBgpAsPath + // provides unmarshal interface + Unmarshal() unMarshalResultBgpAsPath + // validate validates ResultBgpAsPath + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultBgpAsPath, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Segments returns ResultBgpAsPathResultBgpAsPathSegmentIterIter, set in ResultBgpAsPath + Segments() ResultBgpAsPathResultBgpAsPathSegmentIter + setNil() +} + +// AS Path segments present in the received AS Path attribute. +// Segments returns a []ResultBgpAsPathSegment +func (obj *resultBgpAsPath) Segments() ResultBgpAsPathResultBgpAsPathSegmentIter { + if len(obj.obj.Segments) == 0 { + obj.obj.Segments = []*otg.ResultBgpAsPathSegment{} + } + if obj.segmentsHolder == nil { + obj.segmentsHolder = newResultBgpAsPathResultBgpAsPathSegmentIter(&obj.obj.Segments).setMsg(obj) + } + return obj.segmentsHolder +} + +type resultBgpAsPathResultBgpAsPathSegmentIter struct { + obj *resultBgpAsPath + resultBgpAsPathSegmentSlice []ResultBgpAsPathSegment + fieldPtr *[]*otg.ResultBgpAsPathSegment +} + +func newResultBgpAsPathResultBgpAsPathSegmentIter(ptr *[]*otg.ResultBgpAsPathSegment) ResultBgpAsPathResultBgpAsPathSegmentIter { + return &resultBgpAsPathResultBgpAsPathSegmentIter{fieldPtr: ptr} +} + +type ResultBgpAsPathResultBgpAsPathSegmentIter interface { + setMsg(*resultBgpAsPath) ResultBgpAsPathResultBgpAsPathSegmentIter + Items() []ResultBgpAsPathSegment + Add() ResultBgpAsPathSegment + Append(items ...ResultBgpAsPathSegment) ResultBgpAsPathResultBgpAsPathSegmentIter + Set(index int, newObj ResultBgpAsPathSegment) ResultBgpAsPathResultBgpAsPathSegmentIter + Clear() ResultBgpAsPathResultBgpAsPathSegmentIter + clearHolderSlice() ResultBgpAsPathResultBgpAsPathSegmentIter + appendHolderSlice(item ResultBgpAsPathSegment) ResultBgpAsPathResultBgpAsPathSegmentIter +} + +func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) setMsg(msg *resultBgpAsPath) ResultBgpAsPathResultBgpAsPathSegmentIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&resultBgpAsPathSegment{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) Items() []ResultBgpAsPathSegment { + return obj.resultBgpAsPathSegmentSlice +} + +func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) Add() ResultBgpAsPathSegment { + newObj := &otg.ResultBgpAsPathSegment{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &resultBgpAsPathSegment{obj: newObj} + newLibObj.setDefault() + obj.resultBgpAsPathSegmentSlice = append(obj.resultBgpAsPathSegmentSlice, newLibObj) + return newLibObj +} + +func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) Append(items ...ResultBgpAsPathSegment) ResultBgpAsPathResultBgpAsPathSegmentIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.resultBgpAsPathSegmentSlice = append(obj.resultBgpAsPathSegmentSlice, item) + } + return obj +} + +func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) Set(index int, newObj ResultBgpAsPathSegment) ResultBgpAsPathResultBgpAsPathSegmentIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.resultBgpAsPathSegmentSlice[index] = newObj + return obj +} +func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) Clear() ResultBgpAsPathResultBgpAsPathSegmentIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.ResultBgpAsPathSegment{} + obj.resultBgpAsPathSegmentSlice = []ResultBgpAsPathSegment{} + } + return obj +} +func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) clearHolderSlice() ResultBgpAsPathResultBgpAsPathSegmentIter { + if len(obj.resultBgpAsPathSegmentSlice) > 0 { + obj.resultBgpAsPathSegmentSlice = []ResultBgpAsPathSegment{} + } + return obj +} +func (obj *resultBgpAsPathResultBgpAsPathSegmentIter) appendHolderSlice(item ResultBgpAsPathSegment) ResultBgpAsPathResultBgpAsPathSegmentIter { + obj.resultBgpAsPathSegmentSlice = append(obj.resultBgpAsPathSegmentSlice, item) + return obj +} + +func (obj *resultBgpAsPath) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Segments) != 0 { + + if set_default { + obj.Segments().clearHolderSlice() + for _, item := range obj.obj.Segments { + obj.Segments().appendHolderSlice(&resultBgpAsPathSegment{obj: item}) + } + } + for _, item := range obj.Segments().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *resultBgpAsPath) setDefault() { + +} diff --git a/gosnappi/result_bgp_as_path_segment.go b/gosnappi/result_bgp_as_path_segment.go new file mode 100644 index 00000000..94b9df01 --- /dev/null +++ b/gosnappi/result_bgp_as_path_segment.go @@ -0,0 +1,348 @@ +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" +) + +// ***** ResultBgpAsPathSegment ***** +type resultBgpAsPathSegment struct { + validation + obj *otg.ResultBgpAsPathSegment + marshaller marshalResultBgpAsPathSegment + unMarshaller unMarshalResultBgpAsPathSegment +} + +func NewResultBgpAsPathSegment() ResultBgpAsPathSegment { + obj := resultBgpAsPathSegment{obj: &otg.ResultBgpAsPathSegment{}} + obj.setDefault() + return &obj +} + +func (obj *resultBgpAsPathSegment) msg() *otg.ResultBgpAsPathSegment { + return obj.obj +} + +func (obj *resultBgpAsPathSegment) setMsg(msg *otg.ResultBgpAsPathSegment) ResultBgpAsPathSegment { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultBgpAsPathSegment struct { + obj *resultBgpAsPathSegment +} + +type marshalResultBgpAsPathSegment interface { + // ToProto marshals ResultBgpAsPathSegment to protobuf object *otg.ResultBgpAsPathSegment + ToProto() (*otg.ResultBgpAsPathSegment, error) + // ToPbText marshals ResultBgpAsPathSegment to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultBgpAsPathSegment to YAML text + ToYaml() (string, error) + // ToJson marshals ResultBgpAsPathSegment to JSON text + ToJson() (string, error) +} + +type unMarshalresultBgpAsPathSegment struct { + obj *resultBgpAsPathSegment +} + +type unMarshalResultBgpAsPathSegment interface { + // FromProto unmarshals ResultBgpAsPathSegment from protobuf object *otg.ResultBgpAsPathSegment + FromProto(msg *otg.ResultBgpAsPathSegment) (ResultBgpAsPathSegment, error) + // FromPbText unmarshals ResultBgpAsPathSegment from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultBgpAsPathSegment from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultBgpAsPathSegment from JSON text + FromJson(value string) error +} + +func (obj *resultBgpAsPathSegment) Marshal() marshalResultBgpAsPathSegment { + if obj.marshaller == nil { + obj.marshaller = &marshalresultBgpAsPathSegment{obj: obj} + } + return obj.marshaller +} + +func (obj *resultBgpAsPathSegment) Unmarshal() unMarshalResultBgpAsPathSegment { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultBgpAsPathSegment{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultBgpAsPathSegment) ToProto() (*otg.ResultBgpAsPathSegment, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultBgpAsPathSegment) FromProto(msg *otg.ResultBgpAsPathSegment) (ResultBgpAsPathSegment, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultBgpAsPathSegment) 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 *unMarshalresultBgpAsPathSegment) 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 *marshalresultBgpAsPathSegment) 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 *unMarshalresultBgpAsPathSegment) 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 *marshalresultBgpAsPathSegment) 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 *unMarshalresultBgpAsPathSegment) 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 *resultBgpAsPathSegment) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultBgpAsPathSegment) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultBgpAsPathSegment) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultBgpAsPathSegment) Clone() (ResultBgpAsPathSegment, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultBgpAsPathSegment() + 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 +} + +// ResultBgpAsPathSegment is configuration for a single BGP AS path segment +type ResultBgpAsPathSegment interface { + Validation + // msg marshals ResultBgpAsPathSegment to protobuf object *otg.ResultBgpAsPathSegment + // and doesn't set defaults + msg() *otg.ResultBgpAsPathSegment + // setMsg unmarshals ResultBgpAsPathSegment from protobuf object *otg.ResultBgpAsPathSegment + // and doesn't set defaults + setMsg(*otg.ResultBgpAsPathSegment) ResultBgpAsPathSegment + // provides marshal interface + Marshal() marshalResultBgpAsPathSegment + // provides unmarshal interface + Unmarshal() unMarshalResultBgpAsPathSegment + // validate validates ResultBgpAsPathSegment + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultBgpAsPathSegment, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Type returns ResultBgpAsPathSegmentTypeEnum, set in ResultBgpAsPathSegment + Type() ResultBgpAsPathSegmentTypeEnum + // SetType assigns ResultBgpAsPathSegmentTypeEnum provided by user to ResultBgpAsPathSegment + SetType(value ResultBgpAsPathSegmentTypeEnum) ResultBgpAsPathSegment + // HasType checks if Type has been set in ResultBgpAsPathSegment + HasType() bool + // AsNumbers returns []uint32, set in ResultBgpAsPathSegment. + AsNumbers() []uint32 + // SetAsNumbers assigns []uint32 provided by user to ResultBgpAsPathSegment + SetAsNumbers(value []uint32) ResultBgpAsPathSegment +} + +type ResultBgpAsPathSegmentTypeEnum string + +// Enum of Type on ResultBgpAsPathSegment +var ResultBgpAsPathSegmentType = struct { + AS_SEQ ResultBgpAsPathSegmentTypeEnum + AS_SET ResultBgpAsPathSegmentTypeEnum + AS_CONFED_SEQ ResultBgpAsPathSegmentTypeEnum + AS_CONFED_SET ResultBgpAsPathSegmentTypeEnum +}{ + AS_SEQ: ResultBgpAsPathSegmentTypeEnum("as_seq"), + AS_SET: ResultBgpAsPathSegmentTypeEnum("as_set"), + AS_CONFED_SEQ: ResultBgpAsPathSegmentTypeEnum("as_confed_seq"), + AS_CONFED_SET: ResultBgpAsPathSegmentTypeEnum("as_confed_set"), +} + +func (obj *resultBgpAsPathSegment) Type() ResultBgpAsPathSegmentTypeEnum { + return ResultBgpAsPathSegmentTypeEnum(obj.obj.Type.Enum().String()) +} + +// AS sequence is the most common type of AS_PATH, it contains the list of ASNs starting with the most recent ASN being added read from left to right. +// The other three AS_PATH types are used for Confederations - AS_SET is the type of AS_PATH attribute that summarizes routes using using the aggregate-address command, allowing AS_PATHs to be summarized in the update as well. - AS_CONFED_SEQ gives the list of ASNs in the path starting with the most recent ASN to be added reading left to right - AS_CONFED_SET will allow summarization of multiple AS PATHs to be sent in BGP Updates. +// Type returns a string +func (obj *resultBgpAsPathSegment) HasType() bool { + return obj.obj.Type != nil +} + +func (obj *resultBgpAsPathSegment) SetType(value ResultBgpAsPathSegmentTypeEnum) ResultBgpAsPathSegment { + intValue, ok := otg.ResultBgpAsPathSegment_Type_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ResultBgpAsPathSegmentTypeEnum", string(value))) + return obj + } + enumValue := otg.ResultBgpAsPathSegment_Type_Enum(intValue) + obj.obj.Type = &enumValue + + return obj +} + +// The AS numbers in this AS path segment. +// AsNumbers returns a []uint32 +func (obj *resultBgpAsPathSegment) AsNumbers() []uint32 { + if obj.obj.AsNumbers == nil { + obj.obj.AsNumbers = make([]uint32, 0) + } + return obj.obj.AsNumbers +} + +// The AS numbers in this AS path segment. +// SetAsNumbers sets the []uint32 value in the ResultBgpAsPathSegment object +func (obj *resultBgpAsPathSegment) SetAsNumbers(value []uint32) ResultBgpAsPathSegment { + + if obj.obj.AsNumbers == nil { + obj.obj.AsNumbers = make([]uint32, 0) + } + obj.obj.AsNumbers = value + + return obj +} + +func (obj *resultBgpAsPathSegment) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *resultBgpAsPathSegment) setDefault() { + +} diff --git a/gosnappi/result_bgp_community.go b/gosnappi/result_bgp_community.go new file mode 100644 index 00000000..add08e88 --- /dev/null +++ b/gosnappi/result_bgp_community.go @@ -0,0 +1,402 @@ +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" +) + +// ***** ResultBgpCommunity ***** +type resultBgpCommunity struct { + validation + obj *otg.ResultBgpCommunity + marshaller marshalResultBgpCommunity + unMarshaller unMarshalResultBgpCommunity +} + +func NewResultBgpCommunity() ResultBgpCommunity { + obj := resultBgpCommunity{obj: &otg.ResultBgpCommunity{}} + obj.setDefault() + return &obj +} + +func (obj *resultBgpCommunity) msg() *otg.ResultBgpCommunity { + return obj.obj +} + +func (obj *resultBgpCommunity) setMsg(msg *otg.ResultBgpCommunity) ResultBgpCommunity { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultBgpCommunity struct { + obj *resultBgpCommunity +} + +type marshalResultBgpCommunity interface { + // ToProto marshals ResultBgpCommunity to protobuf object *otg.ResultBgpCommunity + ToProto() (*otg.ResultBgpCommunity, error) + // ToPbText marshals ResultBgpCommunity to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultBgpCommunity to YAML text + ToYaml() (string, error) + // ToJson marshals ResultBgpCommunity to JSON text + ToJson() (string, error) +} + +type unMarshalresultBgpCommunity struct { + obj *resultBgpCommunity +} + +type unMarshalResultBgpCommunity interface { + // FromProto unmarshals ResultBgpCommunity from protobuf object *otg.ResultBgpCommunity + FromProto(msg *otg.ResultBgpCommunity) (ResultBgpCommunity, error) + // FromPbText unmarshals ResultBgpCommunity from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultBgpCommunity from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultBgpCommunity from JSON text + FromJson(value string) error +} + +func (obj *resultBgpCommunity) Marshal() marshalResultBgpCommunity { + if obj.marshaller == nil { + obj.marshaller = &marshalresultBgpCommunity{obj: obj} + } + return obj.marshaller +} + +func (obj *resultBgpCommunity) Unmarshal() unMarshalResultBgpCommunity { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultBgpCommunity{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultBgpCommunity) ToProto() (*otg.ResultBgpCommunity, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultBgpCommunity) FromProto(msg *otg.ResultBgpCommunity) (ResultBgpCommunity, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultBgpCommunity) 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 *unMarshalresultBgpCommunity) 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 *marshalresultBgpCommunity) 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 *unMarshalresultBgpCommunity) 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 *marshalresultBgpCommunity) 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 *unMarshalresultBgpCommunity) 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 *resultBgpCommunity) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultBgpCommunity) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultBgpCommunity) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultBgpCommunity) Clone() (ResultBgpCommunity, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultBgpCommunity() + 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 +} + +// ResultBgpCommunity is bGP communities provide additional capability for tagging routes and for modifying BGP routing policy on upstream and downstream routers. BGP community is a 32-bit number which is broken into 16-bit AS number and a 16-bit custom value. +type ResultBgpCommunity interface { + Validation + // msg marshals ResultBgpCommunity to protobuf object *otg.ResultBgpCommunity + // and doesn't set defaults + msg() *otg.ResultBgpCommunity + // setMsg unmarshals ResultBgpCommunity from protobuf object *otg.ResultBgpCommunity + // and doesn't set defaults + setMsg(*otg.ResultBgpCommunity) ResultBgpCommunity + // provides marshal interface + Marshal() marshalResultBgpCommunity + // provides unmarshal interface + Unmarshal() unMarshalResultBgpCommunity + // validate validates ResultBgpCommunity + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultBgpCommunity, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Type returns ResultBgpCommunityTypeEnum, set in ResultBgpCommunity + Type() ResultBgpCommunityTypeEnum + // SetType assigns ResultBgpCommunityTypeEnum provided by user to ResultBgpCommunity + SetType(value ResultBgpCommunityTypeEnum) ResultBgpCommunity + // HasType checks if Type has been set in ResultBgpCommunity + HasType() bool + // AsNumber returns uint32, set in ResultBgpCommunity. + AsNumber() uint32 + // SetAsNumber assigns uint32 provided by user to ResultBgpCommunity + SetAsNumber(value uint32) ResultBgpCommunity + // HasAsNumber checks if AsNumber has been set in ResultBgpCommunity + HasAsNumber() bool + // AsCustom returns uint32, set in ResultBgpCommunity. + AsCustom() uint32 + // SetAsCustom assigns uint32 provided by user to ResultBgpCommunity + SetAsCustom(value uint32) ResultBgpCommunity + // HasAsCustom checks if AsCustom has been set in ResultBgpCommunity + HasAsCustom() bool +} + +type ResultBgpCommunityTypeEnum string + +// Enum of Type on ResultBgpCommunity +var ResultBgpCommunityType = struct { + MANUAL_AS_NUMBER ResultBgpCommunityTypeEnum + NO_EXPORT ResultBgpCommunityTypeEnum + NO_ADVERTISED ResultBgpCommunityTypeEnum + NO_EXPORT_SUBCONFED ResultBgpCommunityTypeEnum + LLGR_STALE ResultBgpCommunityTypeEnum + NO_LLGR ResultBgpCommunityTypeEnum +}{ + MANUAL_AS_NUMBER: ResultBgpCommunityTypeEnum("manual_as_number"), + NO_EXPORT: ResultBgpCommunityTypeEnum("no_export"), + NO_ADVERTISED: ResultBgpCommunityTypeEnum("no_advertised"), + NO_EXPORT_SUBCONFED: ResultBgpCommunityTypeEnum("no_export_subconfed"), + LLGR_STALE: ResultBgpCommunityTypeEnum("llgr_stale"), + NO_LLGR: ResultBgpCommunityTypeEnum("no_llgr"), +} + +func (obj *resultBgpCommunity) Type() ResultBgpCommunityTypeEnum { + return ResultBgpCommunityTypeEnum(obj.obj.Type.Enum().String()) +} + +// The type of community AS number. If community type is manual_as_number then as_number and as_custom will be available. +// Type returns a string +func (obj *resultBgpCommunity) HasType() bool { + return obj.obj.Type != nil +} + +func (obj *resultBgpCommunity) SetType(value ResultBgpCommunityTypeEnum) ResultBgpCommunity { + intValue, ok := otg.ResultBgpCommunity_Type_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ResultBgpCommunityTypeEnum", string(value))) + return obj + } + enumValue := otg.ResultBgpCommunity_Type_Enum(intValue) + obj.obj.Type = &enumValue + + return obj +} + +// First two octets of 32 bit community AS number. +// AsNumber returns a uint32 +func (obj *resultBgpCommunity) AsNumber() uint32 { + + return *obj.obj.AsNumber + +} + +// First two octets of 32 bit community AS number. +// AsNumber returns a uint32 +func (obj *resultBgpCommunity) HasAsNumber() bool { + return obj.obj.AsNumber != nil +} + +// First two octets of 32 bit community AS number. +// SetAsNumber sets the uint32 value in the ResultBgpCommunity object +func (obj *resultBgpCommunity) SetAsNumber(value uint32) ResultBgpCommunity { + + obj.obj.AsNumber = &value + return obj +} + +// Last two octets of the community value. +// AsCustom returns a uint32 +func (obj *resultBgpCommunity) AsCustom() uint32 { + + return *obj.obj.AsCustom + +} + +// Last two octets of the community value. +// AsCustom returns a uint32 +func (obj *resultBgpCommunity) HasAsCustom() bool { + return obj.obj.AsCustom != nil +} + +// Last two octets of the community value. +// SetAsCustom sets the uint32 value in the ResultBgpCommunity object +func (obj *resultBgpCommunity) SetAsCustom(value uint32) ResultBgpCommunity { + + obj.obj.AsCustom = &value + return obj +} + +func (obj *resultBgpCommunity) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.AsNumber != nil { + + if *obj.obj.AsNumber > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= ResultBgpCommunity.AsNumber <= 65535 but Got %d", *obj.obj.AsNumber)) + } + + } + + if obj.obj.AsCustom != nil { + + if *obj.obj.AsCustom > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= ResultBgpCommunity.AsCustom <= 65535 but Got %d", *obj.obj.AsCustom)) + } + + } + +} + +func (obj *resultBgpCommunity) setDefault() { + +} diff --git a/gosnappi/result_extended_community.go b/gosnappi/result_extended_community.go new file mode 100644 index 00000000..38fbfc93 --- /dev/null +++ b/gosnappi/result_extended_community.go @@ -0,0 +1,376 @@ +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" +) + +// ***** ResultExtendedCommunity ***** +type resultExtendedCommunity struct { + validation + obj *otg.ResultExtendedCommunity + marshaller marshalResultExtendedCommunity + unMarshaller unMarshalResultExtendedCommunity + structuredHolder ResultExtendedCommunityStructured +} + +func NewResultExtendedCommunity() ResultExtendedCommunity { + obj := resultExtendedCommunity{obj: &otg.ResultExtendedCommunity{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunity) msg() *otg.ResultExtendedCommunity { + return obj.obj +} + +func (obj *resultExtendedCommunity) setMsg(msg *otg.ResultExtendedCommunity) ResultExtendedCommunity { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunity struct { + obj *resultExtendedCommunity +} + +type marshalResultExtendedCommunity interface { + // ToProto marshals ResultExtendedCommunity to protobuf object *otg.ResultExtendedCommunity + ToProto() (*otg.ResultExtendedCommunity, error) + // ToPbText marshals ResultExtendedCommunity to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunity to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunity to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunity struct { + obj *resultExtendedCommunity +} + +type unMarshalResultExtendedCommunity interface { + // FromProto unmarshals ResultExtendedCommunity from protobuf object *otg.ResultExtendedCommunity + FromProto(msg *otg.ResultExtendedCommunity) (ResultExtendedCommunity, error) + // FromPbText unmarshals ResultExtendedCommunity from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunity from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunity from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunity) Marshal() marshalResultExtendedCommunity { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunity{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunity) Unmarshal() unMarshalResultExtendedCommunity { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunity{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunity) ToProto() (*otg.ResultExtendedCommunity, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunity) FromProto(msg *otg.ResultExtendedCommunity) (ResultExtendedCommunity, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunity) 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 *unMarshalresultExtendedCommunity) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalresultExtendedCommunity) 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 *unMarshalresultExtendedCommunity) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalresultExtendedCommunity) 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 *unMarshalresultExtendedCommunity) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *resultExtendedCommunity) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunity) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunity) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunity) Clone() (ResultExtendedCommunity, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunity() + 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 +} + +func (obj *resultExtendedCommunity) setNil() { + obj.structuredHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ResultExtendedCommunity is each received Extended Community attribute is available for retrieval in two forms. Support of the 'raw' format in which all 8 bytes (16 hex characters) is always present and available for use. In addition, if supported by the implementation, the Extended Community attribute may also be retrieved in the 'structured' format which is an optional field. +type ResultExtendedCommunity interface { + Validation + // msg marshals ResultExtendedCommunity to protobuf object *otg.ResultExtendedCommunity + // and doesn't set defaults + msg() *otg.ResultExtendedCommunity + // setMsg unmarshals ResultExtendedCommunity from protobuf object *otg.ResultExtendedCommunity + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunity) ResultExtendedCommunity + // provides marshal interface + Marshal() marshalResultExtendedCommunity + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunity + // validate validates ResultExtendedCommunity + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunity, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Raw returns string, set in ResultExtendedCommunity. + Raw() string + // SetRaw assigns string provided by user to ResultExtendedCommunity + SetRaw(value string) ResultExtendedCommunity + // HasRaw checks if Raw has been set in ResultExtendedCommunity + HasRaw() bool + // Structured returns ResultExtendedCommunityStructured, set in ResultExtendedCommunity. + // ResultExtendedCommunityStructured is the Extended Communities Attribute is a optional BGP attribute,defined in RFC4360 with the Type Code 16. + // Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. + // An extended community is an 8-bytes value. It is divided into two main parts. The first 2 bytes of the community encode a type and optonal sub-type field. + // The last 6 bytes (or 7 bytes for types without a sub-type) carry a unique set of data in a format defined by the type and optional sub-type field. + // Extended communities provide a larger range for grouping or categorizing communities. + Structured() ResultExtendedCommunityStructured + // SetStructured assigns ResultExtendedCommunityStructured provided by user to ResultExtendedCommunity. + // ResultExtendedCommunityStructured is the Extended Communities Attribute is a optional BGP attribute,defined in RFC4360 with the Type Code 16. + // Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. + // An extended community is an 8-bytes value. It is divided into two main parts. The first 2 bytes of the community encode a type and optonal sub-type field. + // The last 6 bytes (or 7 bytes for types without a sub-type) carry a unique set of data in a format defined by the type and optional sub-type field. + // Extended communities provide a larger range for grouping or categorizing communities. + SetStructured(value ResultExtendedCommunityStructured) ResultExtendedCommunity + // HasStructured checks if Structured has been set in ResultExtendedCommunity + HasStructured() bool + setNil() +} + +// The raw byte contents of the 8 bytes received in the Extended Community as 16 hex characters. +// Raw returns a string +func (obj *resultExtendedCommunity) Raw() string { + + return *obj.obj.Raw + +} + +// The raw byte contents of the 8 bytes received in the Extended Community as 16 hex characters. +// Raw returns a string +func (obj *resultExtendedCommunity) HasRaw() bool { + return obj.obj.Raw != nil +} + +// The raw byte contents of the 8 bytes received in the Extended Community as 16 hex characters. +// SetRaw sets the string value in the ResultExtendedCommunity object +func (obj *resultExtendedCommunity) SetRaw(value string) ResultExtendedCommunity { + + obj.obj.Raw = &value + return obj +} + +// description is TBD +// Structured returns a ResultExtendedCommunityStructured +func (obj *resultExtendedCommunity) Structured() ResultExtendedCommunityStructured { + if obj.obj.Structured == nil { + obj.obj.Structured = NewResultExtendedCommunityStructured().msg() + } + if obj.structuredHolder == nil { + obj.structuredHolder = &resultExtendedCommunityStructured{obj: obj.obj.Structured} + } + return obj.structuredHolder +} + +// description is TBD +// Structured returns a ResultExtendedCommunityStructured +func (obj *resultExtendedCommunity) HasStructured() bool { + return obj.obj.Structured != nil +} + +// description is TBD +// SetStructured sets the ResultExtendedCommunityStructured value in the ResultExtendedCommunity object +func (obj *resultExtendedCommunity) SetStructured(value ResultExtendedCommunityStructured) ResultExtendedCommunity { + + obj.structuredHolder = nil + obj.obj.Structured = value.msg() + + return obj +} + +func (obj *resultExtendedCommunity) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Raw != nil { + + if len(*obj.obj.Raw) > 16 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "None <= length of ResultExtendedCommunity.Raw <= 16 but Got %d", + len(*obj.obj.Raw))) + } + + } + + if obj.obj.Structured != nil { + + obj.Structured().validateObj(vObj, set_default) + } + +} + +func (obj *resultExtendedCommunity) setDefault() { + +} diff --git a/gosnappi/result_extended_community_non_transitive2_octet_as_type.go b/gosnappi/result_extended_community_non_transitive2_octet_as_type.go new file mode 100644 index 00000000..e707f746 --- /dev/null +++ b/gosnappi/result_extended_community_non_transitive2_octet_as_type.go @@ -0,0 +1,390 @@ +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" +) + +// ***** ResultExtendedCommunityNonTransitive2OctetAsType ***** +type resultExtendedCommunityNonTransitive2OctetAsType struct { + validation + obj *otg.ResultExtendedCommunityNonTransitive2OctetAsType + marshaller marshalResultExtendedCommunityNonTransitive2OctetAsType + unMarshaller unMarshalResultExtendedCommunityNonTransitive2OctetAsType + linkBandwidthSubtypeHolder ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth +} + +func NewResultExtendedCommunityNonTransitive2OctetAsType() ResultExtendedCommunityNonTransitive2OctetAsType { + obj := resultExtendedCommunityNonTransitive2OctetAsType{obj: &otg.ResultExtendedCommunityNonTransitive2OctetAsType{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) msg() *otg.ResultExtendedCommunityNonTransitive2OctetAsType { + return obj.obj +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) setMsg(msg *otg.ResultExtendedCommunityNonTransitive2OctetAsType) ResultExtendedCommunityNonTransitive2OctetAsType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityNonTransitive2OctetAsType struct { + obj *resultExtendedCommunityNonTransitive2OctetAsType +} + +type marshalResultExtendedCommunityNonTransitive2OctetAsType interface { + // ToProto marshals ResultExtendedCommunityNonTransitive2OctetAsType to protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsType + ToProto() (*otg.ResultExtendedCommunityNonTransitive2OctetAsType, error) + // ToPbText marshals ResultExtendedCommunityNonTransitive2OctetAsType to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityNonTransitive2OctetAsType to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityNonTransitive2OctetAsType to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityNonTransitive2OctetAsType struct { + obj *resultExtendedCommunityNonTransitive2OctetAsType +} + +type unMarshalResultExtendedCommunityNonTransitive2OctetAsType interface { + // FromProto unmarshals ResultExtendedCommunityNonTransitive2OctetAsType from protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsType + FromProto(msg *otg.ResultExtendedCommunityNonTransitive2OctetAsType) (ResultExtendedCommunityNonTransitive2OctetAsType, error) + // FromPbText unmarshals ResultExtendedCommunityNonTransitive2OctetAsType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityNonTransitive2OctetAsType from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityNonTransitive2OctetAsType from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) Marshal() marshalResultExtendedCommunityNonTransitive2OctetAsType { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityNonTransitive2OctetAsType{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) Unmarshal() unMarshalResultExtendedCommunityNonTransitive2OctetAsType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityNonTransitive2OctetAsType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityNonTransitive2OctetAsType) ToProto() (*otg.ResultExtendedCommunityNonTransitive2OctetAsType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityNonTransitive2OctetAsType) FromProto(msg *otg.ResultExtendedCommunityNonTransitive2OctetAsType) (ResultExtendedCommunityNonTransitive2OctetAsType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityNonTransitive2OctetAsType) 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 *unMarshalresultExtendedCommunityNonTransitive2OctetAsType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalresultExtendedCommunityNonTransitive2OctetAsType) 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 *unMarshalresultExtendedCommunityNonTransitive2OctetAsType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalresultExtendedCommunityNonTransitive2OctetAsType) 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 *unMarshalresultExtendedCommunityNonTransitive2OctetAsType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) Clone() (ResultExtendedCommunityNonTransitive2OctetAsType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityNonTransitive2OctetAsType() + 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 +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) setNil() { + obj.linkBandwidthSubtypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ResultExtendedCommunityNonTransitive2OctetAsType is the Non-Transitive Two-Octet AS-Specific Extended Community is sent as type 0x40. +type ResultExtendedCommunityNonTransitive2OctetAsType interface { + Validation + // msg marshals ResultExtendedCommunityNonTransitive2OctetAsType to protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsType + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityNonTransitive2OctetAsType + // setMsg unmarshals ResultExtendedCommunityNonTransitive2OctetAsType from protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsType + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityNonTransitive2OctetAsType) ResultExtendedCommunityNonTransitive2OctetAsType + // provides marshal interface + Marshal() marshalResultExtendedCommunityNonTransitive2OctetAsType + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityNonTransitive2OctetAsType + // validate validates ResultExtendedCommunityNonTransitive2OctetAsType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityNonTransitive2OctetAsType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum, set in ResultExtendedCommunityNonTransitive2OctetAsType + Choice() ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum + // setChoice assigns ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum provided by user to ResultExtendedCommunityNonTransitive2OctetAsType + setChoice(value ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum) ResultExtendedCommunityNonTransitive2OctetAsType + // HasChoice checks if Choice has been set in ResultExtendedCommunityNonTransitive2OctetAsType + HasChoice() bool + // LinkBandwidthSubtype returns ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, set in ResultExtendedCommunityNonTransitive2OctetAsType. + // ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth is the Link Bandwidth Extended Community attribute is defined in draft-ietf-idr-link-bandwidth. It is sent with sub-type as 0x04. + LinkBandwidthSubtype() ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // SetLinkBandwidthSubtype assigns ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth provided by user to ResultExtendedCommunityNonTransitive2OctetAsType. + // ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth is the Link Bandwidth Extended Community attribute is defined in draft-ietf-idr-link-bandwidth. It is sent with sub-type as 0x04. + SetLinkBandwidthSubtype(value ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) ResultExtendedCommunityNonTransitive2OctetAsType + // HasLinkBandwidthSubtype checks if LinkBandwidthSubtype has been set in ResultExtendedCommunityNonTransitive2OctetAsType + HasLinkBandwidthSubtype() bool + setNil() +} + +type ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum string + +// Enum of Choice on ResultExtendedCommunityNonTransitive2OctetAsType +var ResultExtendedCommunityNonTransitive2OctetAsTypeChoice = struct { + LINK_BANDWIDTH_SUBTYPE ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum +}{ + LINK_BANDWIDTH_SUBTYPE: ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum("link_bandwidth_subtype"), +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) Choice() ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum { + return ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) setChoice(value ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum) ResultExtendedCommunityNonTransitive2OctetAsType { + intValue, ok := otg.ResultExtendedCommunityNonTransitive2OctetAsType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.ResultExtendedCommunityNonTransitive2OctetAsType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.LinkBandwidthSubtype = nil + obj.linkBandwidthSubtypeHolder = nil + + if value == ResultExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE { + obj.obj.LinkBandwidthSubtype = NewResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth().msg() + } + + return obj +} + +// description is TBD +// LinkBandwidthSubtype returns a ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) LinkBandwidthSubtype() ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + if obj.obj.LinkBandwidthSubtype == nil { + obj.setChoice(ResultExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE) + } + if obj.linkBandwidthSubtypeHolder == nil { + obj.linkBandwidthSubtypeHolder = &resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: obj.obj.LinkBandwidthSubtype} + } + return obj.linkBandwidthSubtypeHolder +} + +// description is TBD +// LinkBandwidthSubtype returns a ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) HasLinkBandwidthSubtype() bool { + return obj.obj.LinkBandwidthSubtype != nil +} + +// description is TBD +// SetLinkBandwidthSubtype sets the ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth value in the ResultExtendedCommunityNonTransitive2OctetAsType object +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) SetLinkBandwidthSubtype(value ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) ResultExtendedCommunityNonTransitive2OctetAsType { + obj.setChoice(ResultExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE) + obj.linkBandwidthSubtypeHolder = nil + obj.obj.LinkBandwidthSubtype = value.msg() + + return obj +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.LinkBandwidthSubtype != nil { + + obj.LinkBandwidthSubtype().validateObj(vObj, set_default) + } + +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsType) setDefault() { + var choices_set int = 0 + var choice ResultExtendedCommunityNonTransitive2OctetAsTypeChoiceEnum + + if obj.obj.LinkBandwidthSubtype != nil { + choices_set += 1 + choice = ResultExtendedCommunityNonTransitive2OctetAsTypeChoice.LINK_BANDWIDTH_SUBTYPE + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ResultExtendedCommunityNonTransitive2OctetAsType") + } + } else { + intVal := otg.ResultExtendedCommunityNonTransitive2OctetAsType_Choice_Enum_value[string(choice)] + enumValue := otg.ResultExtendedCommunityNonTransitive2OctetAsType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/result_extended_community_non_transitive2_octet_as_type_link_bandwidth.go b/gosnappi/result_extended_community_non_transitive2_octet_as_type_link_bandwidth.go new file mode 100644 index 00000000..166be8d8 --- /dev/null +++ b/gosnappi/result_extended_community_non_transitive2_octet_as_type_link_bandwidth.go @@ -0,0 +1,344 @@ +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" +) + +// ***** ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth ***** +type resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth struct { + validation + obj *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + marshaller marshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + unMarshaller unMarshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth +} + +func NewResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth() ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + obj := resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: &otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) msg() *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + return obj.obj +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) setMsg(msg *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth struct { + obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth +} + +type marshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth interface { + // ToProto marshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + ToProto() (*otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) + // ToPbText marshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth struct { + obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth +} + +type unMarshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth interface { + // FromProto unmarshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + FromProto(msg *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) (ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) + // FromPbText unmarshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Marshal() marshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Unmarshal() unMarshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) ToProto() (*otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) FromProto(msg *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) (ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *unMarshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *marshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *unMarshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *marshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *unMarshalresultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) 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 *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Clone() (ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth() + 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 +} + +// ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth is the Link Bandwidth Extended Community attribute is defined in draft-ietf-idr-link-bandwidth. It is sent with sub-type as 0x04. +type ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth interface { + Validation + // msg marshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth to protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // setMsg unmarshals ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth from protobuf object *otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // provides marshal interface + Marshal() marshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // validate validates ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Global2ByteAs returns uint32, set in ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth. + Global2ByteAs() uint32 + // SetGlobal2ByteAs assigns uint32 provided by user to ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + SetGlobal2ByteAs(value uint32) ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // HasGlobal2ByteAs checks if Global2ByteAs has been set in ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + HasGlobal2ByteAs() bool + // Bandwidth returns float32, set in ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth. + Bandwidth() float32 + // SetBandwidth assigns float32 provided by user to ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + SetBandwidth(value float32) ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + // HasBandwidth checks if Bandwidth has been set in ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth + HasBandwidth() bool +} + +// The value of the Global Administrator subfield should represent the Autonomous System of the router that attaches the Link Bandwidth Community. If four octet AS numbering scheme is used, AS_TRANS (23456) should be used. +// Global2ByteAs returns a uint32 +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Global2ByteAs() uint32 { + + return *obj.obj.Global_2ByteAs + +} + +// The value of the Global Administrator subfield should represent the Autonomous System of the router that attaches the Link Bandwidth Community. If four octet AS numbering scheme is used, AS_TRANS (23456) should be used. +// Global2ByteAs returns a uint32 +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) HasGlobal2ByteAs() bool { + return obj.obj.Global_2ByteAs != nil +} + +// The value of the Global Administrator subfield should represent the Autonomous System of the router that attaches the Link Bandwidth Community. If four octet AS numbering scheme is used, AS_TRANS (23456) should be used. +// SetGlobal2ByteAs sets the uint32 value in the ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth object +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) SetGlobal2ByteAs(value uint32) ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + + obj.obj.Global_2ByteAs = &value + return obj +} + +// Bandwidth of the link in bytes per second. ( 1 Kbps is 1000 bytes per second and 1 Mbps is 1000 Kbps per second ) +// Bandwidth returns a float32 +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) Bandwidth() float32 { + + return *obj.obj.Bandwidth + +} + +// Bandwidth of the link in bytes per second. ( 1 Kbps is 1000 bytes per second and 1 Mbps is 1000 Kbps per second ) +// Bandwidth returns a float32 +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) HasBandwidth() bool { + return obj.obj.Bandwidth != nil +} + +// Bandwidth of the link in bytes per second. ( 1 Kbps is 1000 bytes per second and 1 Mbps is 1000 Kbps per second ) +// SetBandwidth sets the float32 value in the ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth object +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) SetBandwidth(value float32) ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth { + + obj.obj.Bandwidth = &value + return obj +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Global_2ByteAs != nil { + + if *obj.obj.Global_2ByteAs > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= ResultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth.Global_2ByteAs <= 65535 but Got %d", *obj.obj.Global_2ByteAs)) + } + + } + +} + +func (obj *resultExtendedCommunityNonTransitive2OctetAsTypeLinkBandwidth) setDefault() { + +} diff --git a/gosnappi/result_extended_community_structured.go b/gosnappi/result_extended_community_structured.go new file mode 100644 index 00000000..2b321a62 --- /dev/null +++ b/gosnappi/result_extended_community_structured.go @@ -0,0 +1,618 @@ +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" +) + +// ***** ResultExtendedCommunityStructured ***** +type resultExtendedCommunityStructured struct { + validation + obj *otg.ResultExtendedCommunityStructured + marshaller marshalResultExtendedCommunityStructured + unMarshaller unMarshalResultExtendedCommunityStructured + transitive_2OctetAsTypeHolder ResultExtendedCommunityTransitive2OctetAsType + transitiveIpv4AddressTypeHolder ResultExtendedCommunityTransitiveIpv4AddressType + transitive_4OctetAsTypeHolder ResultExtendedCommunityTransitive4OctetAsType + transitiveOpaqueTypeHolder ResultExtendedCommunityTransitiveOpaqueType + nonTransitive_2OctetAsTypeHolder ResultExtendedCommunityNonTransitive2OctetAsType +} + +func NewResultExtendedCommunityStructured() ResultExtendedCommunityStructured { + obj := resultExtendedCommunityStructured{obj: &otg.ResultExtendedCommunityStructured{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityStructured) msg() *otg.ResultExtendedCommunityStructured { + return obj.obj +} + +func (obj *resultExtendedCommunityStructured) setMsg(msg *otg.ResultExtendedCommunityStructured) ResultExtendedCommunityStructured { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityStructured struct { + obj *resultExtendedCommunityStructured +} + +type marshalResultExtendedCommunityStructured interface { + // ToProto marshals ResultExtendedCommunityStructured to protobuf object *otg.ResultExtendedCommunityStructured + ToProto() (*otg.ResultExtendedCommunityStructured, error) + // ToPbText marshals ResultExtendedCommunityStructured to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityStructured to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityStructured to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityStructured struct { + obj *resultExtendedCommunityStructured +} + +type unMarshalResultExtendedCommunityStructured interface { + // FromProto unmarshals ResultExtendedCommunityStructured from protobuf object *otg.ResultExtendedCommunityStructured + FromProto(msg *otg.ResultExtendedCommunityStructured) (ResultExtendedCommunityStructured, error) + // FromPbText unmarshals ResultExtendedCommunityStructured from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityStructured from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityStructured from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityStructured) Marshal() marshalResultExtendedCommunityStructured { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityStructured{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityStructured) Unmarshal() unMarshalResultExtendedCommunityStructured { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityStructured{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityStructured) ToProto() (*otg.ResultExtendedCommunityStructured, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityStructured) FromProto(msg *otg.ResultExtendedCommunityStructured) (ResultExtendedCommunityStructured, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityStructured) 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 *unMarshalresultExtendedCommunityStructured) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalresultExtendedCommunityStructured) 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 *unMarshalresultExtendedCommunityStructured) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalresultExtendedCommunityStructured) 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 *unMarshalresultExtendedCommunityStructured) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *resultExtendedCommunityStructured) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityStructured) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityStructured) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityStructured) Clone() (ResultExtendedCommunityStructured, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityStructured() + 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 +} + +func (obj *resultExtendedCommunityStructured) setNil() { + obj.transitive_2OctetAsTypeHolder = nil + obj.transitiveIpv4AddressTypeHolder = nil + obj.transitive_4OctetAsTypeHolder = nil + obj.transitiveOpaqueTypeHolder = nil + obj.nonTransitive_2OctetAsTypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ResultExtendedCommunityStructured is the Extended Communities Attribute is a optional BGP attribute,defined in RFC4360 with the Type Code 16. +// Community and Extended Communities attributes are utilized to trigger routing decisions, such as acceptance, rejection, preference, or redistribution. +// An extended community is an 8-bytes value. It is divided into two main parts. The first 2 bytes of the community encode a type and optonal sub-type field. +// The last 6 bytes (or 7 bytes for types without a sub-type) carry a unique set of data in a format defined by the type and optional sub-type field. +// Extended communities provide a larger range for grouping or categorizing communities. +type ResultExtendedCommunityStructured interface { + Validation + // msg marshals ResultExtendedCommunityStructured to protobuf object *otg.ResultExtendedCommunityStructured + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityStructured + // setMsg unmarshals ResultExtendedCommunityStructured from protobuf object *otg.ResultExtendedCommunityStructured + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityStructured) ResultExtendedCommunityStructured + // provides marshal interface + Marshal() marshalResultExtendedCommunityStructured + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityStructured + // validate validates ResultExtendedCommunityStructured + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityStructured, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ResultExtendedCommunityStructuredChoiceEnum, set in ResultExtendedCommunityStructured + Choice() ResultExtendedCommunityStructuredChoiceEnum + // setChoice assigns ResultExtendedCommunityStructuredChoiceEnum provided by user to ResultExtendedCommunityStructured + setChoice(value ResultExtendedCommunityStructuredChoiceEnum) ResultExtendedCommunityStructured + // HasChoice checks if Choice has been set in ResultExtendedCommunityStructured + HasChoice() bool + // Transitive2OctetAsType returns ResultExtendedCommunityTransitive2OctetAsType, set in ResultExtendedCommunityStructured. + // ResultExtendedCommunityTransitive2OctetAsType is the Transitive Two-Octet AS-Specific Extended Community is sent as type 0x00 . + Transitive2OctetAsType() ResultExtendedCommunityTransitive2OctetAsType + // SetTransitive2OctetAsType assigns ResultExtendedCommunityTransitive2OctetAsType provided by user to ResultExtendedCommunityStructured. + // ResultExtendedCommunityTransitive2OctetAsType is the Transitive Two-Octet AS-Specific Extended Community is sent as type 0x00 . + SetTransitive2OctetAsType(value ResultExtendedCommunityTransitive2OctetAsType) ResultExtendedCommunityStructured + // HasTransitive2OctetAsType checks if Transitive2OctetAsType has been set in ResultExtendedCommunityStructured + HasTransitive2OctetAsType() bool + // TransitiveIpv4AddressType returns ResultExtendedCommunityTransitiveIpv4AddressType, set in ResultExtendedCommunityStructured. + // ResultExtendedCommunityTransitiveIpv4AddressType is the Transitive IPv4 Address Specific Extended Community is sent as type 0x01. + TransitiveIpv4AddressType() ResultExtendedCommunityTransitiveIpv4AddressType + // SetTransitiveIpv4AddressType assigns ResultExtendedCommunityTransitiveIpv4AddressType provided by user to ResultExtendedCommunityStructured. + // ResultExtendedCommunityTransitiveIpv4AddressType is the Transitive IPv4 Address Specific Extended Community is sent as type 0x01. + SetTransitiveIpv4AddressType(value ResultExtendedCommunityTransitiveIpv4AddressType) ResultExtendedCommunityStructured + // HasTransitiveIpv4AddressType checks if TransitiveIpv4AddressType has been set in ResultExtendedCommunityStructured + HasTransitiveIpv4AddressType() bool + // Transitive4OctetAsType returns ResultExtendedCommunityTransitive4OctetAsType, set in ResultExtendedCommunityStructured. + // ResultExtendedCommunityTransitive4OctetAsType is the Transitive Four-Octet AS-Specific Extended Community is sent as type 0x02. It is defined in RFC 5668. + Transitive4OctetAsType() ResultExtendedCommunityTransitive4OctetAsType + // SetTransitive4OctetAsType assigns ResultExtendedCommunityTransitive4OctetAsType provided by user to ResultExtendedCommunityStructured. + // ResultExtendedCommunityTransitive4OctetAsType is the Transitive Four-Octet AS-Specific Extended Community is sent as type 0x02. It is defined in RFC 5668. + SetTransitive4OctetAsType(value ResultExtendedCommunityTransitive4OctetAsType) ResultExtendedCommunityStructured + // HasTransitive4OctetAsType checks if Transitive4OctetAsType has been set in ResultExtendedCommunityStructured + HasTransitive4OctetAsType() bool + // TransitiveOpaqueType returns ResultExtendedCommunityTransitiveOpaqueType, set in ResultExtendedCommunityStructured. + // ResultExtendedCommunityTransitiveOpaqueType is the Transitive Opaque Extended Community is sent as type 0x03. + TransitiveOpaqueType() ResultExtendedCommunityTransitiveOpaqueType + // SetTransitiveOpaqueType assigns ResultExtendedCommunityTransitiveOpaqueType provided by user to ResultExtendedCommunityStructured. + // ResultExtendedCommunityTransitiveOpaqueType is the Transitive Opaque Extended Community is sent as type 0x03. + SetTransitiveOpaqueType(value ResultExtendedCommunityTransitiveOpaqueType) ResultExtendedCommunityStructured + // HasTransitiveOpaqueType checks if TransitiveOpaqueType has been set in ResultExtendedCommunityStructured + HasTransitiveOpaqueType() bool + // NonTransitive2OctetAsType returns ResultExtendedCommunityNonTransitive2OctetAsType, set in ResultExtendedCommunityStructured. + // ResultExtendedCommunityNonTransitive2OctetAsType is the Non-Transitive Two-Octet AS-Specific Extended Community is sent as type 0x40. + NonTransitive2OctetAsType() ResultExtendedCommunityNonTransitive2OctetAsType + // SetNonTransitive2OctetAsType assigns ResultExtendedCommunityNonTransitive2OctetAsType provided by user to ResultExtendedCommunityStructured. + // ResultExtendedCommunityNonTransitive2OctetAsType is the Non-Transitive Two-Octet AS-Specific Extended Community is sent as type 0x40. + SetNonTransitive2OctetAsType(value ResultExtendedCommunityNonTransitive2OctetAsType) ResultExtendedCommunityStructured + // HasNonTransitive2OctetAsType checks if NonTransitive2OctetAsType has been set in ResultExtendedCommunityStructured + HasNonTransitive2OctetAsType() bool + setNil() +} + +type ResultExtendedCommunityStructuredChoiceEnum string + +// Enum of Choice on ResultExtendedCommunityStructured +var ResultExtendedCommunityStructuredChoice = struct { + TRANSITIVE_2OCTET_AS_TYPE ResultExtendedCommunityStructuredChoiceEnum + TRANSITIVE_IPV4_ADDRESS_TYPE ResultExtendedCommunityStructuredChoiceEnum + TRANSITIVE_4OCTET_AS_TYPE ResultExtendedCommunityStructuredChoiceEnum + TRANSITIVE_OPAQUE_TYPE ResultExtendedCommunityStructuredChoiceEnum + NON_TRANSITIVE_2OCTET_AS_TYPE ResultExtendedCommunityStructuredChoiceEnum +}{ + TRANSITIVE_2OCTET_AS_TYPE: ResultExtendedCommunityStructuredChoiceEnum("transitive_2octet_as_type"), + TRANSITIVE_IPV4_ADDRESS_TYPE: ResultExtendedCommunityStructuredChoiceEnum("transitive_ipv4_address_type"), + TRANSITIVE_4OCTET_AS_TYPE: ResultExtendedCommunityStructuredChoiceEnum("transitive_4octet_as_type"), + TRANSITIVE_OPAQUE_TYPE: ResultExtendedCommunityStructuredChoiceEnum("transitive_opaque_type"), + NON_TRANSITIVE_2OCTET_AS_TYPE: ResultExtendedCommunityStructuredChoiceEnum("non_transitive_2octet_as_type"), +} + +func (obj *resultExtendedCommunityStructured) Choice() ResultExtendedCommunityStructuredChoiceEnum { + return ResultExtendedCommunityStructuredChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *resultExtendedCommunityStructured) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *resultExtendedCommunityStructured) setChoice(value ResultExtendedCommunityStructuredChoiceEnum) ResultExtendedCommunityStructured { + intValue, ok := otg.ResultExtendedCommunityStructured_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ResultExtendedCommunityStructuredChoiceEnum", string(value))) + return obj + } + enumValue := otg.ResultExtendedCommunityStructured_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.NonTransitive_2OctetAsType = nil + obj.nonTransitive_2OctetAsTypeHolder = nil + obj.obj.TransitiveOpaqueType = nil + obj.transitiveOpaqueTypeHolder = nil + obj.obj.Transitive_4OctetAsType = nil + obj.transitive_4OctetAsTypeHolder = nil + obj.obj.TransitiveIpv4AddressType = nil + obj.transitiveIpv4AddressTypeHolder = nil + obj.obj.Transitive_2OctetAsType = nil + obj.transitive_2OctetAsTypeHolder = nil + + if value == ResultExtendedCommunityStructuredChoice.TRANSITIVE_2OCTET_AS_TYPE { + obj.obj.Transitive_2OctetAsType = NewResultExtendedCommunityTransitive2OctetAsType().msg() + } + + if value == ResultExtendedCommunityStructuredChoice.TRANSITIVE_IPV4_ADDRESS_TYPE { + obj.obj.TransitiveIpv4AddressType = NewResultExtendedCommunityTransitiveIpv4AddressType().msg() + } + + if value == ResultExtendedCommunityStructuredChoice.TRANSITIVE_4OCTET_AS_TYPE { + obj.obj.Transitive_4OctetAsType = NewResultExtendedCommunityTransitive4OctetAsType().msg() + } + + if value == ResultExtendedCommunityStructuredChoice.TRANSITIVE_OPAQUE_TYPE { + obj.obj.TransitiveOpaqueType = NewResultExtendedCommunityTransitiveOpaqueType().msg() + } + + if value == ResultExtendedCommunityStructuredChoice.NON_TRANSITIVE_2OCTET_AS_TYPE { + obj.obj.NonTransitive_2OctetAsType = NewResultExtendedCommunityNonTransitive2OctetAsType().msg() + } + + return obj +} + +// description is TBD +// Transitive2OctetAsType returns a ResultExtendedCommunityTransitive2OctetAsType +func (obj *resultExtendedCommunityStructured) Transitive2OctetAsType() ResultExtendedCommunityTransitive2OctetAsType { + if obj.obj.Transitive_2OctetAsType == nil { + obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_2OCTET_AS_TYPE) + } + if obj.transitive_2OctetAsTypeHolder == nil { + obj.transitive_2OctetAsTypeHolder = &resultExtendedCommunityTransitive2OctetAsType{obj: obj.obj.Transitive_2OctetAsType} + } + return obj.transitive_2OctetAsTypeHolder +} + +// description is TBD +// Transitive2OctetAsType returns a ResultExtendedCommunityTransitive2OctetAsType +func (obj *resultExtendedCommunityStructured) HasTransitive2OctetAsType() bool { + return obj.obj.Transitive_2OctetAsType != nil +} + +// description is TBD +// SetTransitive2OctetAsType sets the ResultExtendedCommunityTransitive2OctetAsType value in the ResultExtendedCommunityStructured object +func (obj *resultExtendedCommunityStructured) SetTransitive2OctetAsType(value ResultExtendedCommunityTransitive2OctetAsType) ResultExtendedCommunityStructured { + obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_2OCTET_AS_TYPE) + obj.transitive_2OctetAsTypeHolder = nil + obj.obj.Transitive_2OctetAsType = value.msg() + + return obj +} + +// description is TBD +// TransitiveIpv4AddressType returns a ResultExtendedCommunityTransitiveIpv4AddressType +func (obj *resultExtendedCommunityStructured) TransitiveIpv4AddressType() ResultExtendedCommunityTransitiveIpv4AddressType { + if obj.obj.TransitiveIpv4AddressType == nil { + obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_IPV4_ADDRESS_TYPE) + } + if obj.transitiveIpv4AddressTypeHolder == nil { + obj.transitiveIpv4AddressTypeHolder = &resultExtendedCommunityTransitiveIpv4AddressType{obj: obj.obj.TransitiveIpv4AddressType} + } + return obj.transitiveIpv4AddressTypeHolder +} + +// description is TBD +// TransitiveIpv4AddressType returns a ResultExtendedCommunityTransitiveIpv4AddressType +func (obj *resultExtendedCommunityStructured) HasTransitiveIpv4AddressType() bool { + return obj.obj.TransitiveIpv4AddressType != nil +} + +// description is TBD +// SetTransitiveIpv4AddressType sets the ResultExtendedCommunityTransitiveIpv4AddressType value in the ResultExtendedCommunityStructured object +func (obj *resultExtendedCommunityStructured) SetTransitiveIpv4AddressType(value ResultExtendedCommunityTransitiveIpv4AddressType) ResultExtendedCommunityStructured { + obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_IPV4_ADDRESS_TYPE) + obj.transitiveIpv4AddressTypeHolder = nil + obj.obj.TransitiveIpv4AddressType = value.msg() + + return obj +} + +// description is TBD +// Transitive4OctetAsType returns a ResultExtendedCommunityTransitive4OctetAsType +func (obj *resultExtendedCommunityStructured) Transitive4OctetAsType() ResultExtendedCommunityTransitive4OctetAsType { + if obj.obj.Transitive_4OctetAsType == nil { + obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_4OCTET_AS_TYPE) + } + if obj.transitive_4OctetAsTypeHolder == nil { + obj.transitive_4OctetAsTypeHolder = &resultExtendedCommunityTransitive4OctetAsType{obj: obj.obj.Transitive_4OctetAsType} + } + return obj.transitive_4OctetAsTypeHolder +} + +// description is TBD +// Transitive4OctetAsType returns a ResultExtendedCommunityTransitive4OctetAsType +func (obj *resultExtendedCommunityStructured) HasTransitive4OctetAsType() bool { + return obj.obj.Transitive_4OctetAsType != nil +} + +// description is TBD +// SetTransitive4OctetAsType sets the ResultExtendedCommunityTransitive4OctetAsType value in the ResultExtendedCommunityStructured object +func (obj *resultExtendedCommunityStructured) SetTransitive4OctetAsType(value ResultExtendedCommunityTransitive4OctetAsType) ResultExtendedCommunityStructured { + obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_4OCTET_AS_TYPE) + obj.transitive_4OctetAsTypeHolder = nil + obj.obj.Transitive_4OctetAsType = value.msg() + + return obj +} + +// description is TBD +// TransitiveOpaqueType returns a ResultExtendedCommunityTransitiveOpaqueType +func (obj *resultExtendedCommunityStructured) TransitiveOpaqueType() ResultExtendedCommunityTransitiveOpaqueType { + if obj.obj.TransitiveOpaqueType == nil { + obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_OPAQUE_TYPE) + } + if obj.transitiveOpaqueTypeHolder == nil { + obj.transitiveOpaqueTypeHolder = &resultExtendedCommunityTransitiveOpaqueType{obj: obj.obj.TransitiveOpaqueType} + } + return obj.transitiveOpaqueTypeHolder +} + +// description is TBD +// TransitiveOpaqueType returns a ResultExtendedCommunityTransitiveOpaqueType +func (obj *resultExtendedCommunityStructured) HasTransitiveOpaqueType() bool { + return obj.obj.TransitiveOpaqueType != nil +} + +// description is TBD +// SetTransitiveOpaqueType sets the ResultExtendedCommunityTransitiveOpaqueType value in the ResultExtendedCommunityStructured object +func (obj *resultExtendedCommunityStructured) SetTransitiveOpaqueType(value ResultExtendedCommunityTransitiveOpaqueType) ResultExtendedCommunityStructured { + obj.setChoice(ResultExtendedCommunityStructuredChoice.TRANSITIVE_OPAQUE_TYPE) + obj.transitiveOpaqueTypeHolder = nil + obj.obj.TransitiveOpaqueType = value.msg() + + return obj +} + +// description is TBD +// NonTransitive2OctetAsType returns a ResultExtendedCommunityNonTransitive2OctetAsType +func (obj *resultExtendedCommunityStructured) NonTransitive2OctetAsType() ResultExtendedCommunityNonTransitive2OctetAsType { + if obj.obj.NonTransitive_2OctetAsType == nil { + obj.setChoice(ResultExtendedCommunityStructuredChoice.NON_TRANSITIVE_2OCTET_AS_TYPE) + } + if obj.nonTransitive_2OctetAsTypeHolder == nil { + obj.nonTransitive_2OctetAsTypeHolder = &resultExtendedCommunityNonTransitive2OctetAsType{obj: obj.obj.NonTransitive_2OctetAsType} + } + return obj.nonTransitive_2OctetAsTypeHolder +} + +// description is TBD +// NonTransitive2OctetAsType returns a ResultExtendedCommunityNonTransitive2OctetAsType +func (obj *resultExtendedCommunityStructured) HasNonTransitive2OctetAsType() bool { + return obj.obj.NonTransitive_2OctetAsType != nil +} + +// description is TBD +// SetNonTransitive2OctetAsType sets the ResultExtendedCommunityNonTransitive2OctetAsType value in the ResultExtendedCommunityStructured object +func (obj *resultExtendedCommunityStructured) SetNonTransitive2OctetAsType(value ResultExtendedCommunityNonTransitive2OctetAsType) ResultExtendedCommunityStructured { + obj.setChoice(ResultExtendedCommunityStructuredChoice.NON_TRANSITIVE_2OCTET_AS_TYPE) + obj.nonTransitive_2OctetAsTypeHolder = nil + obj.obj.NonTransitive_2OctetAsType = value.msg() + + return obj +} + +func (obj *resultExtendedCommunityStructured) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Transitive_2OctetAsType != nil { + + obj.Transitive2OctetAsType().validateObj(vObj, set_default) + } + + if obj.obj.TransitiveIpv4AddressType != nil { + + obj.TransitiveIpv4AddressType().validateObj(vObj, set_default) + } + + if obj.obj.Transitive_4OctetAsType != nil { + + obj.Transitive4OctetAsType().validateObj(vObj, set_default) + } + + if obj.obj.TransitiveOpaqueType != nil { + + obj.TransitiveOpaqueType().validateObj(vObj, set_default) + } + + if obj.obj.NonTransitive_2OctetAsType != nil { + + obj.NonTransitive2OctetAsType().validateObj(vObj, set_default) + } + +} + +func (obj *resultExtendedCommunityStructured) setDefault() { + var choices_set int = 0 + var choice ResultExtendedCommunityStructuredChoiceEnum + + if obj.obj.TransitiveIpv4AddressType != nil { + choices_set += 1 + choice = ResultExtendedCommunityStructuredChoice.TRANSITIVE_IPV4_ADDRESS_TYPE + } + + if obj.obj.TransitiveOpaqueType != nil { + choices_set += 1 + choice = ResultExtendedCommunityStructuredChoice.TRANSITIVE_OPAQUE_TYPE + } + + if obj.obj.Transitive_2OctetAsType != nil { + choices_set += 1 + choice = ResultExtendedCommunityStructuredChoice.TRANSITIVE_2OCTET_AS_TYPE + } + + if obj.obj.Transitive_4OctetAsType != nil { + choices_set += 1 + choice = ResultExtendedCommunityStructuredChoice.TRANSITIVE_4OCTET_AS_TYPE + } + + if obj.obj.NonTransitive_2OctetAsType != nil { + choices_set += 1 + choice = ResultExtendedCommunityStructuredChoice.NON_TRANSITIVE_2OCTET_AS_TYPE + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ResultExtendedCommunityStructured") + } + } else { + intVal := otg.ResultExtendedCommunityStructured_Choice_Enum_value[string(choice)] + enumValue := otg.ResultExtendedCommunityStructured_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/result_extended_community_transitive2_octet_as_type.go b/gosnappi/result_extended_community_transitive2_octet_as_type.go new file mode 100644 index 00000000..9a4fd923 --- /dev/null +++ b/gosnappi/result_extended_community_transitive2_octet_as_type.go @@ -0,0 +1,446 @@ +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" +) + +// ***** ResultExtendedCommunityTransitive2OctetAsType ***** +type resultExtendedCommunityTransitive2OctetAsType struct { + validation + obj *otg.ResultExtendedCommunityTransitive2OctetAsType + marshaller marshalResultExtendedCommunityTransitive2OctetAsType + unMarshaller unMarshalResultExtendedCommunityTransitive2OctetAsType + routeTargetSubtypeHolder ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + routeOriginSubtypeHolder ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin +} + +func NewResultExtendedCommunityTransitive2OctetAsType() ResultExtendedCommunityTransitive2OctetAsType { + obj := resultExtendedCommunityTransitive2OctetAsType{obj: &otg.ResultExtendedCommunityTransitive2OctetAsType{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityTransitive2OctetAsType) msg() *otg.ResultExtendedCommunityTransitive2OctetAsType { + return obj.obj +} + +func (obj *resultExtendedCommunityTransitive2OctetAsType) setMsg(msg *otg.ResultExtendedCommunityTransitive2OctetAsType) ResultExtendedCommunityTransitive2OctetAsType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityTransitive2OctetAsType struct { + obj *resultExtendedCommunityTransitive2OctetAsType +} + +type marshalResultExtendedCommunityTransitive2OctetAsType interface { + // ToProto marshals ResultExtendedCommunityTransitive2OctetAsType to protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsType + ToProto() (*otg.ResultExtendedCommunityTransitive2OctetAsType, error) + // ToPbText marshals ResultExtendedCommunityTransitive2OctetAsType to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityTransitive2OctetAsType to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityTransitive2OctetAsType to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityTransitive2OctetAsType struct { + obj *resultExtendedCommunityTransitive2OctetAsType +} + +type unMarshalResultExtendedCommunityTransitive2OctetAsType interface { + // FromProto unmarshals ResultExtendedCommunityTransitive2OctetAsType from protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsType + FromProto(msg *otg.ResultExtendedCommunityTransitive2OctetAsType) (ResultExtendedCommunityTransitive2OctetAsType, error) + // FromPbText unmarshals ResultExtendedCommunityTransitive2OctetAsType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityTransitive2OctetAsType from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityTransitive2OctetAsType from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityTransitive2OctetAsType) Marshal() marshalResultExtendedCommunityTransitive2OctetAsType { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityTransitive2OctetAsType{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityTransitive2OctetAsType) Unmarshal() unMarshalResultExtendedCommunityTransitive2OctetAsType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityTransitive2OctetAsType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityTransitive2OctetAsType) ToProto() (*otg.ResultExtendedCommunityTransitive2OctetAsType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityTransitive2OctetAsType) FromProto(msg *otg.ResultExtendedCommunityTransitive2OctetAsType) (ResultExtendedCommunityTransitive2OctetAsType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityTransitive2OctetAsType) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalresultExtendedCommunityTransitive2OctetAsType) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalresultExtendedCommunityTransitive2OctetAsType) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *resultExtendedCommunityTransitive2OctetAsType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitive2OctetAsType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitive2OctetAsType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityTransitive2OctetAsType) Clone() (ResultExtendedCommunityTransitive2OctetAsType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityTransitive2OctetAsType() + 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 +} + +func (obj *resultExtendedCommunityTransitive2OctetAsType) setNil() { + obj.routeTargetSubtypeHolder = nil + obj.routeOriginSubtypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ResultExtendedCommunityTransitive2OctetAsType is the Transitive Two-Octet AS-Specific Extended Community is sent as type 0x00 . +type ResultExtendedCommunityTransitive2OctetAsType interface { + Validation + // msg marshals ResultExtendedCommunityTransitive2OctetAsType to protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsType + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityTransitive2OctetAsType + // setMsg unmarshals ResultExtendedCommunityTransitive2OctetAsType from protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsType + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityTransitive2OctetAsType) ResultExtendedCommunityTransitive2OctetAsType + // provides marshal interface + Marshal() marshalResultExtendedCommunityTransitive2OctetAsType + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityTransitive2OctetAsType + // validate validates ResultExtendedCommunityTransitive2OctetAsType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityTransitive2OctetAsType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum, set in ResultExtendedCommunityTransitive2OctetAsType + Choice() ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum + // setChoice assigns ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum provided by user to ResultExtendedCommunityTransitive2OctetAsType + setChoice(value ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum) ResultExtendedCommunityTransitive2OctetAsType + // HasChoice checks if Choice has been set in ResultExtendedCommunityTransitive2OctetAsType + HasChoice() bool + // RouteTargetSubtype returns ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget, set in ResultExtendedCommunityTransitive2OctetAsType. + // ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP Update message. It is sent with sub-type as 0x02. + RouteTargetSubtype() ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + // SetRouteTargetSubtype assigns ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget provided by user to ResultExtendedCommunityTransitive2OctetAsType. + // ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP Update message. It is sent with sub-type as 0x02. + SetRouteTargetSubtype(value ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive2OctetAsType + // HasRouteTargetSubtype checks if RouteTargetSubtype has been set in ResultExtendedCommunityTransitive2OctetAsType + HasRouteTargetSubtype() bool + // RouteOriginSubtype returns ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin, set in ResultExtendedCommunityTransitive2OctetAsType. + // ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03 . + RouteOriginSubtype() ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // SetRouteOriginSubtype assigns ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin provided by user to ResultExtendedCommunityTransitive2OctetAsType. + // ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03 . + SetRouteOriginSubtype(value ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive2OctetAsType + // HasRouteOriginSubtype checks if RouteOriginSubtype has been set in ResultExtendedCommunityTransitive2OctetAsType + HasRouteOriginSubtype() bool + setNil() +} + +type ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum string + +// Enum of Choice on ResultExtendedCommunityTransitive2OctetAsType +var ResultExtendedCommunityTransitive2OctetAsTypeChoice = struct { + ROUTE_TARGET_SUBTYPE ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum + ROUTE_ORIGIN_SUBTYPE ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum +}{ + ROUTE_TARGET_SUBTYPE: ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum("route_target_subtype"), + ROUTE_ORIGIN_SUBTYPE: ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum("route_origin_subtype"), +} + +func (obj *resultExtendedCommunityTransitive2OctetAsType) Choice() ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum { + return ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *resultExtendedCommunityTransitive2OctetAsType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *resultExtendedCommunityTransitive2OctetAsType) setChoice(value ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum) ResultExtendedCommunityTransitive2OctetAsType { + intValue, ok := otg.ResultExtendedCommunityTransitive2OctetAsType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.ResultExtendedCommunityTransitive2OctetAsType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.RouteOriginSubtype = nil + obj.routeOriginSubtypeHolder = nil + obj.obj.RouteTargetSubtype = nil + obj.routeTargetSubtypeHolder = nil + + if value == ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE { + obj.obj.RouteTargetSubtype = NewResultExtendedCommunityTransitive2OctetAsTypeRouteTarget().msg() + } + + if value == ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE { + obj.obj.RouteOriginSubtype = NewResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin().msg() + } + + return obj +} + +// description is TBD +// RouteTargetSubtype returns a ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget +func (obj *resultExtendedCommunityTransitive2OctetAsType) RouteTargetSubtype() ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { + if obj.obj.RouteTargetSubtype == nil { + obj.setChoice(ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) + } + if obj.routeTargetSubtypeHolder == nil { + obj.routeTargetSubtypeHolder = &resultExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: obj.obj.RouteTargetSubtype} + } + return obj.routeTargetSubtypeHolder +} + +// description is TBD +// RouteTargetSubtype returns a ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget +func (obj *resultExtendedCommunityTransitive2OctetAsType) HasRouteTargetSubtype() bool { + return obj.obj.RouteTargetSubtype != nil +} + +// description is TBD +// SetRouteTargetSubtype sets the ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget value in the ResultExtendedCommunityTransitive2OctetAsType object +func (obj *resultExtendedCommunityTransitive2OctetAsType) SetRouteTargetSubtype(value ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive2OctetAsType { + obj.setChoice(ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) + obj.routeTargetSubtypeHolder = nil + obj.obj.RouteTargetSubtype = value.msg() + + return obj +} + +// description is TBD +// RouteOriginSubtype returns a ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin +func (obj *resultExtendedCommunityTransitive2OctetAsType) RouteOriginSubtype() ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + if obj.obj.RouteOriginSubtype == nil { + obj.setChoice(ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) + } + if obj.routeOriginSubtypeHolder == nil { + obj.routeOriginSubtypeHolder = &resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: obj.obj.RouteOriginSubtype} + } + return obj.routeOriginSubtypeHolder +} + +// description is TBD +// RouteOriginSubtype returns a ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin +func (obj *resultExtendedCommunityTransitive2OctetAsType) HasRouteOriginSubtype() bool { + return obj.obj.RouteOriginSubtype != nil +} + +// description is TBD +// SetRouteOriginSubtype sets the ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin value in the ResultExtendedCommunityTransitive2OctetAsType object +func (obj *resultExtendedCommunityTransitive2OctetAsType) SetRouteOriginSubtype(value ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive2OctetAsType { + obj.setChoice(ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) + obj.routeOriginSubtypeHolder = nil + obj.obj.RouteOriginSubtype = value.msg() + + return obj +} + +func (obj *resultExtendedCommunityTransitive2OctetAsType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RouteTargetSubtype != nil { + + obj.RouteTargetSubtype().validateObj(vObj, set_default) + } + + if obj.obj.RouteOriginSubtype != nil { + + obj.RouteOriginSubtype().validateObj(vObj, set_default) + } + +} + +func (obj *resultExtendedCommunityTransitive2OctetAsType) setDefault() { + var choices_set int = 0 + var choice ResultExtendedCommunityTransitive2OctetAsTypeChoiceEnum + + if obj.obj.RouteTargetSubtype != nil { + choices_set += 1 + choice = ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE + } + + if obj.obj.RouteOriginSubtype != nil { + choices_set += 1 + choice = ResultExtendedCommunityTransitive2OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ResultExtendedCommunityTransitive2OctetAsType") + } + } else { + intVal := otg.ResultExtendedCommunityTransitive2OctetAsType_Choice_Enum_value[string(choice)] + enumValue := otg.ResultExtendedCommunityTransitive2OctetAsType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/result_extended_community_transitive2_octet_as_type_route_origin.go b/gosnappi/result_extended_community_transitive2_octet_as_type_route_origin.go new file mode 100644 index 00000000..d8c076d0 --- /dev/null +++ b/gosnappi/result_extended_community_transitive2_octet_as_type_route_origin.go @@ -0,0 +1,344 @@ +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" +) + +// ***** ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin ***** +type resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin struct { + validation + obj *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + marshaller marshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + unMarshaller unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin +} + +func NewResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin() ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + obj := resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: &otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) msg() *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + return obj.obj +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) setMsg(msg *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin struct { + obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin +} + +type marshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin interface { + // ToProto marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin to protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + ToProto() (*otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) + // ToPbText marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin struct { + obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin +} + +type unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin interface { + // FromProto unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin from protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + FromProto(msg *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) (ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) + // FromPbText unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Marshal() marshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Unmarshal() unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) ToProto() (*otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) FromProto(msg *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) (ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) 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 *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Clone() (ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin() + 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 +} + +// ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03 . +type ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin interface { + Validation + // msg marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin to protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // setMsg unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin from protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // provides marshal interface + Marshal() marshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // validate validates ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Global2ByteAs returns uint32, set in ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin. + Global2ByteAs() uint32 + // SetGlobal2ByteAs assigns uint32 provided by user to ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + SetGlobal2ByteAs(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // HasGlobal2ByteAs checks if Global2ByteAs has been set in ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + HasGlobal2ByteAs() bool + // Local4ByteAdmin returns uint32, set in ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin. + Local4ByteAdmin() uint32 + // SetLocal4ByteAdmin assigns uint32 provided by user to ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + SetLocal4ByteAdmin(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + // HasLocal4ByteAdmin checks if Local4ByteAdmin has been set in ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin + HasLocal4ByteAdmin() bool +} + +// The two octet IANA assigned AS value assigned to the Autonomous System. +// Global2ByteAs returns a uint32 +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Global2ByteAs() uint32 { + + return *obj.obj.Global_2ByteAs + +} + +// The two octet IANA assigned AS value assigned to the Autonomous System. +// Global2ByteAs returns a uint32 +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) HasGlobal2ByteAs() bool { + return obj.obj.Global_2ByteAs != nil +} + +// The two octet IANA assigned AS value assigned to the Autonomous System. +// SetGlobal2ByteAs sets the uint32 value in the ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin object +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) SetGlobal2ByteAs(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + + obj.obj.Global_2ByteAs = &value + return obj +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local4ByteAdmin returns a uint32 +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) Local4ByteAdmin() uint32 { + + return *obj.obj.Local_4ByteAdmin + +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local4ByteAdmin returns a uint32 +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) HasLocal4ByteAdmin() bool { + return obj.obj.Local_4ByteAdmin != nil +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// SetLocal4ByteAdmin sets the uint32 value in the ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin object +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) SetLocal4ByteAdmin(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin { + + obj.obj.Local_4ByteAdmin = &value + return obj +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Global_2ByteAs != nil { + + if *obj.obj.Global_2ByteAs > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= ResultExtendedCommunityTransitive2OctetAsTypeRouteOrigin.Global_2ByteAs <= 65535 but Got %d", *obj.obj.Global_2ByteAs)) + } + + } + +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteOrigin) setDefault() { + +} diff --git a/gosnappi/result_extended_community_transitive2_octet_as_type_route_target.go b/gosnappi/result_extended_community_transitive2_octet_as_type_route_target.go new file mode 100644 index 00000000..f6830bce --- /dev/null +++ b/gosnappi/result_extended_community_transitive2_octet_as_type_route_target.go @@ -0,0 +1,344 @@ +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" +) + +// ***** ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget ***** +type resultExtendedCommunityTransitive2OctetAsTypeRouteTarget struct { + validation + obj *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + marshaller marshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + unMarshaller unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget +} + +func NewResultExtendedCommunityTransitive2OctetAsTypeRouteTarget() ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { + obj := resultExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: &otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) msg() *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { + return obj.obj +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) setMsg(msg *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget struct { + obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget +} + +type marshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget interface { + // ToProto marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget to protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + ToProto() (*otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) + // ToPbText marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget struct { + obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget +} + +type unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget interface { + // FromProto unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget from protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + FromProto(msg *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget) (ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) + // FromPbText unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) Marshal() marshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) Unmarshal() unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) ToProto() (*otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) FromProto(msg *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget) (ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *marshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitive2OctetAsTypeRouteTarget) 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 *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) Clone() (ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityTransitive2OctetAsTypeRouteTarget() + 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 +} + +// ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP Update message. It is sent with sub-type as 0x02. +type ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget interface { + Validation + // msg marshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget to protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + // setMsg unmarshals ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget from protobuf object *otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + // provides marshal interface + Marshal() marshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + // validate validates ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Global2ByteAs returns uint32, set in ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget. + Global2ByteAs() uint32 + // SetGlobal2ByteAs assigns uint32 provided by user to ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + SetGlobal2ByteAs(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + // HasGlobal2ByteAs checks if Global2ByteAs has been set in ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + HasGlobal2ByteAs() bool + // Local4ByteAdmin returns uint32, set in ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget. + Local4ByteAdmin() uint32 + // SetLocal4ByteAdmin assigns uint32 provided by user to ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + SetLocal4ByteAdmin(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + // HasLocal4ByteAdmin checks if Local4ByteAdmin has been set in ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget + HasLocal4ByteAdmin() bool +} + +// The two octet IANA assigned AS value assigned to the Autonomous System. +// Global2ByteAs returns a uint32 +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) Global2ByteAs() uint32 { + + return *obj.obj.Global_2ByteAs + +} + +// The two octet IANA assigned AS value assigned to the Autonomous System. +// Global2ByteAs returns a uint32 +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) HasGlobal2ByteAs() bool { + return obj.obj.Global_2ByteAs != nil +} + +// The two octet IANA assigned AS value assigned to the Autonomous System. +// SetGlobal2ByteAs sets the uint32 value in the ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget object +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) SetGlobal2ByteAs(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { + + obj.obj.Global_2ByteAs = &value + return obj +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local4ByteAdmin returns a uint32 +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) Local4ByteAdmin() uint32 { + + return *obj.obj.Local_4ByteAdmin + +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local4ByteAdmin returns a uint32 +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) HasLocal4ByteAdmin() bool { + return obj.obj.Local_4ByteAdmin != nil +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// SetLocal4ByteAdmin sets the uint32 value in the ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget object +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) SetLocal4ByteAdmin(value uint32) ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget { + + obj.obj.Local_4ByteAdmin = &value + return obj +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Global_2ByteAs != nil { + + if *obj.obj.Global_2ByteAs > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= ResultExtendedCommunityTransitive2OctetAsTypeRouteTarget.Global_2ByteAs <= 65535 but Got %d", *obj.obj.Global_2ByteAs)) + } + + } + +} + +func (obj *resultExtendedCommunityTransitive2OctetAsTypeRouteTarget) setDefault() { + +} diff --git a/gosnappi/result_extended_community_transitive4_octet_as_type.go b/gosnappi/result_extended_community_transitive4_octet_as_type.go new file mode 100644 index 00000000..213689d0 --- /dev/null +++ b/gosnappi/result_extended_community_transitive4_octet_as_type.go @@ -0,0 +1,446 @@ +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" +) + +// ***** ResultExtendedCommunityTransitive4OctetAsType ***** +type resultExtendedCommunityTransitive4OctetAsType struct { + validation + obj *otg.ResultExtendedCommunityTransitive4OctetAsType + marshaller marshalResultExtendedCommunityTransitive4OctetAsType + unMarshaller unMarshalResultExtendedCommunityTransitive4OctetAsType + routeTargetSubtypeHolder ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + routeOriginSubtypeHolder ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin +} + +func NewResultExtendedCommunityTransitive4OctetAsType() ResultExtendedCommunityTransitive4OctetAsType { + obj := resultExtendedCommunityTransitive4OctetAsType{obj: &otg.ResultExtendedCommunityTransitive4OctetAsType{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityTransitive4OctetAsType) msg() *otg.ResultExtendedCommunityTransitive4OctetAsType { + return obj.obj +} + +func (obj *resultExtendedCommunityTransitive4OctetAsType) setMsg(msg *otg.ResultExtendedCommunityTransitive4OctetAsType) ResultExtendedCommunityTransitive4OctetAsType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityTransitive4OctetAsType struct { + obj *resultExtendedCommunityTransitive4OctetAsType +} + +type marshalResultExtendedCommunityTransitive4OctetAsType interface { + // ToProto marshals ResultExtendedCommunityTransitive4OctetAsType to protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsType + ToProto() (*otg.ResultExtendedCommunityTransitive4OctetAsType, error) + // ToPbText marshals ResultExtendedCommunityTransitive4OctetAsType to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityTransitive4OctetAsType to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityTransitive4OctetAsType to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityTransitive4OctetAsType struct { + obj *resultExtendedCommunityTransitive4OctetAsType +} + +type unMarshalResultExtendedCommunityTransitive4OctetAsType interface { + // FromProto unmarshals ResultExtendedCommunityTransitive4OctetAsType from protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsType + FromProto(msg *otg.ResultExtendedCommunityTransitive4OctetAsType) (ResultExtendedCommunityTransitive4OctetAsType, error) + // FromPbText unmarshals ResultExtendedCommunityTransitive4OctetAsType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityTransitive4OctetAsType from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityTransitive4OctetAsType from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityTransitive4OctetAsType) Marshal() marshalResultExtendedCommunityTransitive4OctetAsType { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityTransitive4OctetAsType{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityTransitive4OctetAsType) Unmarshal() unMarshalResultExtendedCommunityTransitive4OctetAsType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityTransitive4OctetAsType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityTransitive4OctetAsType) ToProto() (*otg.ResultExtendedCommunityTransitive4OctetAsType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityTransitive4OctetAsType) FromProto(msg *otg.ResultExtendedCommunityTransitive4OctetAsType) (ResultExtendedCommunityTransitive4OctetAsType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityTransitive4OctetAsType) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalresultExtendedCommunityTransitive4OctetAsType) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalresultExtendedCommunityTransitive4OctetAsType) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *resultExtendedCommunityTransitive4OctetAsType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitive4OctetAsType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitive4OctetAsType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityTransitive4OctetAsType) Clone() (ResultExtendedCommunityTransitive4OctetAsType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityTransitive4OctetAsType() + 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 +} + +func (obj *resultExtendedCommunityTransitive4OctetAsType) setNil() { + obj.routeTargetSubtypeHolder = nil + obj.routeOriginSubtypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ResultExtendedCommunityTransitive4OctetAsType is the Transitive Four-Octet AS-Specific Extended Community is sent as type 0x02. It is defined in RFC 5668. +type ResultExtendedCommunityTransitive4OctetAsType interface { + Validation + // msg marshals ResultExtendedCommunityTransitive4OctetAsType to protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsType + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityTransitive4OctetAsType + // setMsg unmarshals ResultExtendedCommunityTransitive4OctetAsType from protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsType + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityTransitive4OctetAsType) ResultExtendedCommunityTransitive4OctetAsType + // provides marshal interface + Marshal() marshalResultExtendedCommunityTransitive4OctetAsType + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityTransitive4OctetAsType + // validate validates ResultExtendedCommunityTransitive4OctetAsType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityTransitive4OctetAsType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum, set in ResultExtendedCommunityTransitive4OctetAsType + Choice() ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum + // setChoice assigns ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum provided by user to ResultExtendedCommunityTransitive4OctetAsType + setChoice(value ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum) ResultExtendedCommunityTransitive4OctetAsType + // HasChoice checks if Choice has been set in ResultExtendedCommunityTransitive4OctetAsType + HasChoice() bool + // RouteTargetSubtype returns ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget, set in ResultExtendedCommunityTransitive4OctetAsType. + // ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02 + RouteTargetSubtype() ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + // SetRouteTargetSubtype assigns ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget provided by user to ResultExtendedCommunityTransitive4OctetAsType. + // ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02 + SetRouteTargetSubtype(value ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive4OctetAsType + // HasRouteTargetSubtype checks if RouteTargetSubtype has been set in ResultExtendedCommunityTransitive4OctetAsType + HasRouteTargetSubtype() bool + // RouteOriginSubtype returns ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin, set in ResultExtendedCommunityTransitive4OctetAsType. + // ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03. + RouteOriginSubtype() ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // SetRouteOriginSubtype assigns ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin provided by user to ResultExtendedCommunityTransitive4OctetAsType. + // ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03. + SetRouteOriginSubtype(value ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive4OctetAsType + // HasRouteOriginSubtype checks if RouteOriginSubtype has been set in ResultExtendedCommunityTransitive4OctetAsType + HasRouteOriginSubtype() bool + setNil() +} + +type ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum string + +// Enum of Choice on ResultExtendedCommunityTransitive4OctetAsType +var ResultExtendedCommunityTransitive4OctetAsTypeChoice = struct { + ROUTE_TARGET_SUBTYPE ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum + ROUTE_ORIGIN_SUBTYPE ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum +}{ + ROUTE_TARGET_SUBTYPE: ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum("route_target_subtype"), + ROUTE_ORIGIN_SUBTYPE: ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum("route_origin_subtype"), +} + +func (obj *resultExtendedCommunityTransitive4OctetAsType) Choice() ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum { + return ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *resultExtendedCommunityTransitive4OctetAsType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *resultExtendedCommunityTransitive4OctetAsType) setChoice(value ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum) ResultExtendedCommunityTransitive4OctetAsType { + intValue, ok := otg.ResultExtendedCommunityTransitive4OctetAsType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.ResultExtendedCommunityTransitive4OctetAsType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.RouteOriginSubtype = nil + obj.routeOriginSubtypeHolder = nil + obj.obj.RouteTargetSubtype = nil + obj.routeTargetSubtypeHolder = nil + + if value == ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE { + obj.obj.RouteTargetSubtype = NewResultExtendedCommunityTransitive4OctetAsTypeRouteTarget().msg() + } + + if value == ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE { + obj.obj.RouteOriginSubtype = NewResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin().msg() + } + + return obj +} + +// description is TBD +// RouteTargetSubtype returns a ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget +func (obj *resultExtendedCommunityTransitive4OctetAsType) RouteTargetSubtype() ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { + if obj.obj.RouteTargetSubtype == nil { + obj.setChoice(ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) + } + if obj.routeTargetSubtypeHolder == nil { + obj.routeTargetSubtypeHolder = &resultExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: obj.obj.RouteTargetSubtype} + } + return obj.routeTargetSubtypeHolder +} + +// description is TBD +// RouteTargetSubtype returns a ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget +func (obj *resultExtendedCommunityTransitive4OctetAsType) HasRouteTargetSubtype() bool { + return obj.obj.RouteTargetSubtype != nil +} + +// description is TBD +// SetRouteTargetSubtype sets the ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget value in the ResultExtendedCommunityTransitive4OctetAsType object +func (obj *resultExtendedCommunityTransitive4OctetAsType) SetRouteTargetSubtype(value ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive4OctetAsType { + obj.setChoice(ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE) + obj.routeTargetSubtypeHolder = nil + obj.obj.RouteTargetSubtype = value.msg() + + return obj +} + +// description is TBD +// RouteOriginSubtype returns a ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin +func (obj *resultExtendedCommunityTransitive4OctetAsType) RouteOriginSubtype() ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + if obj.obj.RouteOriginSubtype == nil { + obj.setChoice(ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) + } + if obj.routeOriginSubtypeHolder == nil { + obj.routeOriginSubtypeHolder = &resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: obj.obj.RouteOriginSubtype} + } + return obj.routeOriginSubtypeHolder +} + +// description is TBD +// RouteOriginSubtype returns a ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin +func (obj *resultExtendedCommunityTransitive4OctetAsType) HasRouteOriginSubtype() bool { + return obj.obj.RouteOriginSubtype != nil +} + +// description is TBD +// SetRouteOriginSubtype sets the ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin value in the ResultExtendedCommunityTransitive4OctetAsType object +func (obj *resultExtendedCommunityTransitive4OctetAsType) SetRouteOriginSubtype(value ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive4OctetAsType { + obj.setChoice(ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE) + obj.routeOriginSubtypeHolder = nil + obj.obj.RouteOriginSubtype = value.msg() + + return obj +} + +func (obj *resultExtendedCommunityTransitive4OctetAsType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RouteTargetSubtype != nil { + + obj.RouteTargetSubtype().validateObj(vObj, set_default) + } + + if obj.obj.RouteOriginSubtype != nil { + + obj.RouteOriginSubtype().validateObj(vObj, set_default) + } + +} + +func (obj *resultExtendedCommunityTransitive4OctetAsType) setDefault() { + var choices_set int = 0 + var choice ResultExtendedCommunityTransitive4OctetAsTypeChoiceEnum + + if obj.obj.RouteTargetSubtype != nil { + choices_set += 1 + choice = ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_TARGET_SUBTYPE + } + + if obj.obj.RouteOriginSubtype != nil { + choices_set += 1 + choice = ResultExtendedCommunityTransitive4OctetAsTypeChoice.ROUTE_ORIGIN_SUBTYPE + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ResultExtendedCommunityTransitive4OctetAsType") + } + } else { + intVal := otg.ResultExtendedCommunityTransitive4OctetAsType_Choice_Enum_value[string(choice)] + enumValue := otg.ResultExtendedCommunityTransitive4OctetAsType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/result_extended_community_transitive4_octet_as_type_route_origin.go b/gosnappi/result_extended_community_transitive4_octet_as_type_route_origin.go new file mode 100644 index 00000000..6e139fec --- /dev/null +++ b/gosnappi/result_extended_community_transitive4_octet_as_type_route_origin.go @@ -0,0 +1,344 @@ +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" +) + +// ***** ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin ***** +type resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin struct { + validation + obj *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + marshaller marshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + unMarshaller unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin +} + +func NewResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin() ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + obj := resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: &otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) msg() *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + return obj.obj +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) setMsg(msg *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin struct { + obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin +} + +type marshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin interface { + // ToProto marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin to protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + ToProto() (*otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) + // ToPbText marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin struct { + obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin +} + +type unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin interface { + // FromProto unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin from protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + FromProto(msg *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) (ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) + // FromPbText unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Marshal() marshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Unmarshal() unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) ToProto() (*otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) FromProto(msg *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) (ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) 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 *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Clone() (ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin() + 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 +} + +// ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP. It is sent with sub-type as 0x03. +type ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin interface { + Validation + // msg marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin to protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // setMsg unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin from protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // provides marshal interface + Marshal() marshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // validate validates ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Global4ByteAs returns uint32, set in ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin. + Global4ByteAs() uint32 + // SetGlobal4ByteAs assigns uint32 provided by user to ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + SetGlobal4ByteAs(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // HasGlobal4ByteAs checks if Global4ByteAs has been set in ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + HasGlobal4ByteAs() bool + // Local2ByteAdmin returns uint32, set in ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin. + Local2ByteAdmin() uint32 + // SetLocal2ByteAdmin assigns uint32 provided by user to ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin + HasLocal2ByteAdmin() bool +} + +// The four octet IANA assigned AS value assigned to the Autonomous System. +// Global4ByteAs returns a uint32 +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Global4ByteAs() uint32 { + + return *obj.obj.Global_4ByteAs + +} + +// The four octet IANA assigned AS value assigned to the Autonomous System. +// Global4ByteAs returns a uint32 +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) HasGlobal4ByteAs() bool { + return obj.obj.Global_4ByteAs != nil +} + +// The four octet IANA assigned AS value assigned to the Autonomous System. +// SetGlobal4ByteAs sets the uint32 value in the ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin object +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) SetGlobal4ByteAs(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + + obj.obj.Global_4ByteAs = &value + return obj +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) Local2ByteAdmin() uint32 { + + return *obj.obj.Local_2ByteAdmin + +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) HasLocal2ByteAdmin() bool { + return obj.obj.Local_2ByteAdmin != nil +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// SetLocal2ByteAdmin sets the uint32 value in the ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin object +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin { + + obj.obj.Local_2ByteAdmin = &value + return obj +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Local_2ByteAdmin != nil { + + if *obj.obj.Local_2ByteAdmin > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= ResultExtendedCommunityTransitive4OctetAsTypeRouteOrigin.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) + } + + } + +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteOrigin) setDefault() { + +} diff --git a/gosnappi/result_extended_community_transitive4_octet_as_type_route_target.go b/gosnappi/result_extended_community_transitive4_octet_as_type_route_target.go new file mode 100644 index 00000000..46c8519a --- /dev/null +++ b/gosnappi/result_extended_community_transitive4_octet_as_type_route_target.go @@ -0,0 +1,344 @@ +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" +) + +// ***** ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget ***** +type resultExtendedCommunityTransitive4OctetAsTypeRouteTarget struct { + validation + obj *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + marshaller marshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + unMarshaller unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget +} + +func NewResultExtendedCommunityTransitive4OctetAsTypeRouteTarget() ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { + obj := resultExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: &otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) msg() *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { + return obj.obj +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) setMsg(msg *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget struct { + obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget +} + +type marshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget interface { + // ToProto marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget to protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + ToProto() (*otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) + // ToPbText marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget struct { + obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget +} + +type unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget interface { + // FromProto unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget from protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + FromProto(msg *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget) (ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) + // FromPbText unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) Marshal() marshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) Unmarshal() unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) ToProto() (*otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) FromProto(msg *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget) (ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *marshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitive4OctetAsTypeRouteTarget) 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 *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) Clone() (ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityTransitive4OctetAsTypeRouteTarget() + 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 +} + +// ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02 +type ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget interface { + Validation + // msg marshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget to protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + // setMsg unmarshals ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget from protobuf object *otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget) ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + // provides marshal interface + Marshal() marshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + // validate validates ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Global4ByteAs returns uint32, set in ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget. + Global4ByteAs() uint32 + // SetGlobal4ByteAs assigns uint32 provided by user to ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + SetGlobal4ByteAs(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + // HasGlobal4ByteAs checks if Global4ByteAs has been set in ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + HasGlobal4ByteAs() bool + // Local2ByteAdmin returns uint32, set in ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget. + Local2ByteAdmin() uint32 + // SetLocal2ByteAdmin assigns uint32 provided by user to ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget + HasLocal2ByteAdmin() bool +} + +// The four octet IANA assigned AS value assigned to the Autonomous System. +// Global4ByteAs returns a uint32 +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) Global4ByteAs() uint32 { + + return *obj.obj.Global_4ByteAs + +} + +// The four octet IANA assigned AS value assigned to the Autonomous System. +// Global4ByteAs returns a uint32 +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) HasGlobal4ByteAs() bool { + return obj.obj.Global_4ByteAs != nil +} + +// The four octet IANA assigned AS value assigned to the Autonomous System. +// SetGlobal4ByteAs sets the uint32 value in the ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget object +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) SetGlobal4ByteAs(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { + + obj.obj.Global_4ByteAs = &value + return obj +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) Local2ByteAdmin() uint32 { + + return *obj.obj.Local_2ByteAdmin + +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) HasLocal2ByteAdmin() bool { + return obj.obj.Local_2ByteAdmin != nil +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the Autonomous System number carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// SetLocal2ByteAdmin sets the uint32 value in the ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget object +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget { + + obj.obj.Local_2ByteAdmin = &value + return obj +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Local_2ByteAdmin != nil { + + if *obj.obj.Local_2ByteAdmin > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= ResultExtendedCommunityTransitive4OctetAsTypeRouteTarget.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) + } + + } + +} + +func (obj *resultExtendedCommunityTransitive4OctetAsTypeRouteTarget) setDefault() { + +} diff --git a/gosnappi/result_extended_community_transitive_ipv4_address_type.go b/gosnappi/result_extended_community_transitive_ipv4_address_type.go new file mode 100644 index 00000000..a912e3bf --- /dev/null +++ b/gosnappi/result_extended_community_transitive_ipv4_address_type.go @@ -0,0 +1,446 @@ +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" +) + +// ***** ResultExtendedCommunityTransitiveIpv4AddressType ***** +type resultExtendedCommunityTransitiveIpv4AddressType struct { + validation + obj *otg.ResultExtendedCommunityTransitiveIpv4AddressType + marshaller marshalResultExtendedCommunityTransitiveIpv4AddressType + unMarshaller unMarshalResultExtendedCommunityTransitiveIpv4AddressType + routeTargetSubtypeHolder ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + routeOriginSubtypeHolder ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin +} + +func NewResultExtendedCommunityTransitiveIpv4AddressType() ResultExtendedCommunityTransitiveIpv4AddressType { + obj := resultExtendedCommunityTransitiveIpv4AddressType{obj: &otg.ResultExtendedCommunityTransitiveIpv4AddressType{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) msg() *otg.ResultExtendedCommunityTransitiveIpv4AddressType { + return obj.obj +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) setMsg(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressType) ResultExtendedCommunityTransitiveIpv4AddressType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityTransitiveIpv4AddressType struct { + obj *resultExtendedCommunityTransitiveIpv4AddressType +} + +type marshalResultExtendedCommunityTransitiveIpv4AddressType interface { + // ToProto marshals ResultExtendedCommunityTransitiveIpv4AddressType to protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressType + ToProto() (*otg.ResultExtendedCommunityTransitiveIpv4AddressType, error) + // ToPbText marshals ResultExtendedCommunityTransitiveIpv4AddressType to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityTransitiveIpv4AddressType to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityTransitiveIpv4AddressType to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityTransitiveIpv4AddressType struct { + obj *resultExtendedCommunityTransitiveIpv4AddressType +} + +type unMarshalResultExtendedCommunityTransitiveIpv4AddressType interface { + // FromProto unmarshals ResultExtendedCommunityTransitiveIpv4AddressType from protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressType + FromProto(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressType) (ResultExtendedCommunityTransitiveIpv4AddressType, error) + // FromPbText unmarshals ResultExtendedCommunityTransitiveIpv4AddressType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityTransitiveIpv4AddressType from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityTransitiveIpv4AddressType from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) Marshal() marshalResultExtendedCommunityTransitiveIpv4AddressType { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityTransitiveIpv4AddressType{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) Unmarshal() unMarshalResultExtendedCommunityTransitiveIpv4AddressType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityTransitiveIpv4AddressType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityTransitiveIpv4AddressType) ToProto() (*otg.ResultExtendedCommunityTransitiveIpv4AddressType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityTransitiveIpv4AddressType) FromProto(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressType) (ResultExtendedCommunityTransitiveIpv4AddressType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityTransitiveIpv4AddressType) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalresultExtendedCommunityTransitiveIpv4AddressType) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalresultExtendedCommunityTransitiveIpv4AddressType) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) Clone() (ResultExtendedCommunityTransitiveIpv4AddressType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityTransitiveIpv4AddressType() + 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 +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) setNil() { + obj.routeTargetSubtypeHolder = nil + obj.routeOriginSubtypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ResultExtendedCommunityTransitiveIpv4AddressType is the Transitive IPv4 Address Specific Extended Community is sent as type 0x01. +type ResultExtendedCommunityTransitiveIpv4AddressType interface { + Validation + // msg marshals ResultExtendedCommunityTransitiveIpv4AddressType to protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressType + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityTransitiveIpv4AddressType + // setMsg unmarshals ResultExtendedCommunityTransitiveIpv4AddressType from protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressType + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityTransitiveIpv4AddressType) ResultExtendedCommunityTransitiveIpv4AddressType + // provides marshal interface + Marshal() marshalResultExtendedCommunityTransitiveIpv4AddressType + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityTransitiveIpv4AddressType + // validate validates ResultExtendedCommunityTransitiveIpv4AddressType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityTransitiveIpv4AddressType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum, set in ResultExtendedCommunityTransitiveIpv4AddressType + Choice() ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum + // setChoice assigns ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum provided by user to ResultExtendedCommunityTransitiveIpv4AddressType + setChoice(value ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum) ResultExtendedCommunityTransitiveIpv4AddressType + // HasChoice checks if Choice has been set in ResultExtendedCommunityTransitiveIpv4AddressType + HasChoice() bool + // RouteTargetSubtype returns ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, set in ResultExtendedCommunityTransitiveIpv4AddressType. + // ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. + RouteTargetSubtype() ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // SetRouteTargetSubtype assigns ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget provided by user to ResultExtendedCommunityTransitiveIpv4AddressType. + // ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. + SetRouteTargetSubtype(value ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) ResultExtendedCommunityTransitiveIpv4AddressType + // HasRouteTargetSubtype checks if RouteTargetSubtype has been set in ResultExtendedCommunityTransitiveIpv4AddressType + HasRouteTargetSubtype() bool + // RouteOriginSubtype returns ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, set in ResultExtendedCommunityTransitiveIpv4AddressType. + // ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP It is sent with sub-type as 0x03. + RouteOriginSubtype() ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // SetRouteOriginSubtype assigns ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin provided by user to ResultExtendedCommunityTransitiveIpv4AddressType. + // ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP It is sent with sub-type as 0x03. + SetRouteOriginSubtype(value ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) ResultExtendedCommunityTransitiveIpv4AddressType + // HasRouteOriginSubtype checks if RouteOriginSubtype has been set in ResultExtendedCommunityTransitiveIpv4AddressType + HasRouteOriginSubtype() bool + setNil() +} + +type ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum string + +// Enum of Choice on ResultExtendedCommunityTransitiveIpv4AddressType +var ResultExtendedCommunityTransitiveIpv4AddressTypeChoice = struct { + ROUTE_TARGET_SUBTYPE ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum + ROUTE_ORIGIN_SUBTYPE ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum +}{ + ROUTE_TARGET_SUBTYPE: ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum("route_target_subtype"), + ROUTE_ORIGIN_SUBTYPE: ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum("route_origin_subtype"), +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) Choice() ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum { + return ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) setChoice(value ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum) ResultExtendedCommunityTransitiveIpv4AddressType { + intValue, ok := otg.ResultExtendedCommunityTransitiveIpv4AddressType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.ResultExtendedCommunityTransitiveIpv4AddressType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.RouteOriginSubtype = nil + obj.routeOriginSubtypeHolder = nil + obj.obj.RouteTargetSubtype = nil + obj.routeTargetSubtypeHolder = nil + + if value == ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE { + obj.obj.RouteTargetSubtype = NewResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget().msg() + } + + if value == ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE { + obj.obj.RouteOriginSubtype = NewResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin().msg() + } + + return obj +} + +// description is TBD +// RouteTargetSubtype returns a ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) RouteTargetSubtype() ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + if obj.obj.RouteTargetSubtype == nil { + obj.setChoice(ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE) + } + if obj.routeTargetSubtypeHolder == nil { + obj.routeTargetSubtypeHolder = &resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: obj.obj.RouteTargetSubtype} + } + return obj.routeTargetSubtypeHolder +} + +// description is TBD +// RouteTargetSubtype returns a ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) HasRouteTargetSubtype() bool { + return obj.obj.RouteTargetSubtype != nil +} + +// description is TBD +// SetRouteTargetSubtype sets the ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget value in the ResultExtendedCommunityTransitiveIpv4AddressType object +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) SetRouteTargetSubtype(value ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) ResultExtendedCommunityTransitiveIpv4AddressType { + obj.setChoice(ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE) + obj.routeTargetSubtypeHolder = nil + obj.obj.RouteTargetSubtype = value.msg() + + return obj +} + +// description is TBD +// RouteOriginSubtype returns a ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) RouteOriginSubtype() ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + if obj.obj.RouteOriginSubtype == nil { + obj.setChoice(ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE) + } + if obj.routeOriginSubtypeHolder == nil { + obj.routeOriginSubtypeHolder = &resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: obj.obj.RouteOriginSubtype} + } + return obj.routeOriginSubtypeHolder +} + +// description is TBD +// RouteOriginSubtype returns a ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) HasRouteOriginSubtype() bool { + return obj.obj.RouteOriginSubtype != nil +} + +// description is TBD +// SetRouteOriginSubtype sets the ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin value in the ResultExtendedCommunityTransitiveIpv4AddressType object +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) SetRouteOriginSubtype(value ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) ResultExtendedCommunityTransitiveIpv4AddressType { + obj.setChoice(ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE) + obj.routeOriginSubtypeHolder = nil + obj.obj.RouteOriginSubtype = value.msg() + + return obj +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RouteTargetSubtype != nil { + + obj.RouteTargetSubtype().validateObj(vObj, set_default) + } + + if obj.obj.RouteOriginSubtype != nil { + + obj.RouteOriginSubtype().validateObj(vObj, set_default) + } + +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressType) setDefault() { + var choices_set int = 0 + var choice ResultExtendedCommunityTransitiveIpv4AddressTypeChoiceEnum + + if obj.obj.RouteTargetSubtype != nil { + choices_set += 1 + choice = ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_TARGET_SUBTYPE + } + + if obj.obj.RouteOriginSubtype != nil { + choices_set += 1 + choice = ResultExtendedCommunityTransitiveIpv4AddressTypeChoice.ROUTE_ORIGIN_SUBTYPE + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ResultExtendedCommunityTransitiveIpv4AddressType") + } + } else { + intVal := otg.ResultExtendedCommunityTransitiveIpv4AddressType_Choice_Enum_value[string(choice)] + enumValue := otg.ResultExtendedCommunityTransitiveIpv4AddressType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/result_extended_community_transitive_ipv4_address_type_route_origin.go b/gosnappi/result_extended_community_transitive_ipv4_address_type_route_origin.go new file mode 100644 index 00000000..019ea03c --- /dev/null +++ b/gosnappi/result_extended_community_transitive_ipv4_address_type_route_origin.go @@ -0,0 +1,353 @@ +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" +) + +// ***** ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin ***** +type resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin struct { + validation + obj *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + marshaller marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + unMarshaller unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin +} + +func NewResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin() ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + obj := resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: &otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) msg() *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + return obj.obj +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) setMsg(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin struct { + obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin +} + +type marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin interface { + // ToProto marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + ToProto() (*otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) + // ToPbText marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin struct { + obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin +} + +type unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin interface { + // FromProto unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + FromProto(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) + // FromPbText unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Marshal() marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Unmarshal() unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) ToProto() (*otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) FromProto(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) 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 *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Clone() (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin() + 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 +} + +// ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin is the Route Origin Community identifies one or more routers that inject a set of routes (that carry this Community) into BGP It is sent with sub-type as 0x03. +type ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin interface { + Validation + // msg marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin to protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // setMsg unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin from protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // provides marshal interface + Marshal() marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // validate validates ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // GlobalIpv4Admin returns string, set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin. + GlobalIpv4Admin() string + // SetGlobalIpv4Admin assigns string provided by user to ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + SetGlobalIpv4Admin(value string) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // HasGlobalIpv4Admin checks if GlobalIpv4Admin has been set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + HasGlobalIpv4Admin() bool + // Local2ByteAdmin returns uint32, set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin. + Local2ByteAdmin() uint32 + // SetLocal2ByteAdmin assigns uint32 provided by user to ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin + HasLocal2ByteAdmin() bool +} + +// An IPv4 unicast address assigned by one of the Internet registries. +// GlobalIpv4Admin returns a string +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) GlobalIpv4Admin() string { + + return *obj.obj.GlobalIpv4Admin + +} + +// An IPv4 unicast address assigned by one of the Internet registries. +// GlobalIpv4Admin returns a string +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) HasGlobalIpv4Admin() bool { + return obj.obj.GlobalIpv4Admin != nil +} + +// An IPv4 unicast address assigned by one of the Internet registries. +// SetGlobalIpv4Admin sets the string value in the ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin object +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) SetGlobalIpv4Admin(value string) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + + obj.obj.GlobalIpv4Admin = &value + return obj +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) Local2ByteAdmin() uint32 { + + return *obj.obj.Local_2ByteAdmin + +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) HasLocal2ByteAdmin() bool { + return obj.obj.Local_2ByteAdmin != nil +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// SetLocal2ByteAdmin sets the uint32 value in the ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin object +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin { + + obj.obj.Local_2ByteAdmin = &value + return obj +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.GlobalIpv4Admin != nil { + + err := obj.validateIpv4(obj.GlobalIpv4Admin()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin.GlobalIpv4Admin")) + } + + } + + if obj.obj.Local_2ByteAdmin != nil { + + if *obj.obj.Local_2ByteAdmin > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= ResultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) + } + + } + +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteOrigin) setDefault() { + +} diff --git a/gosnappi/result_extended_community_transitive_ipv4_address_type_route_target.go b/gosnappi/result_extended_community_transitive_ipv4_address_type_route_target.go new file mode 100644 index 00000000..b1f68076 --- /dev/null +++ b/gosnappi/result_extended_community_transitive_ipv4_address_type_route_target.go @@ -0,0 +1,353 @@ +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" +) + +// ***** ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget ***** +type resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget struct { + validation + obj *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + marshaller marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + unMarshaller unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget +} + +func NewResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget() ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + obj := resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: &otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) msg() *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + return obj.obj +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) setMsg(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget struct { + obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget +} + +type marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget interface { + // ToProto marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + ToProto() (*otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) + // ToPbText marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget struct { + obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget +} + +type unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget interface { + // FromProto unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + FromProto(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) + // FromPbText unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Marshal() marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Unmarshal() unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) ToProto() (*otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) FromProto(msg *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *marshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *unMarshalresultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) 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 *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Clone() (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget() + 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 +} + +// ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget is the Route Target Community identifies one or more routers that may receive a set of routes (that carry this Community) carried by BGP. It is sent with sub-type as 0x02. +type ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget interface { + Validation + // msg marshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget to protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // setMsg unmarshals ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget from protobuf object *otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // provides marshal interface + Marshal() marshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // validate validates ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // GlobalIpv4Admin returns string, set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget. + GlobalIpv4Admin() string + // SetGlobalIpv4Admin assigns string provided by user to ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + SetGlobalIpv4Admin(value string) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // HasGlobalIpv4Admin checks if GlobalIpv4Admin has been set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + HasGlobalIpv4Admin() bool + // Local2ByteAdmin returns uint32, set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget. + Local2ByteAdmin() uint32 + // SetLocal2ByteAdmin assigns uint32 provided by user to ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + // HasLocal2ByteAdmin checks if Local2ByteAdmin has been set in ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget + HasLocal2ByteAdmin() bool +} + +// An IPv4 unicast address assigned by one of the Internet registries. +// GlobalIpv4Admin returns a string +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) GlobalIpv4Admin() string { + + return *obj.obj.GlobalIpv4Admin + +} + +// An IPv4 unicast address assigned by one of the Internet registries. +// GlobalIpv4Admin returns a string +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) HasGlobalIpv4Admin() bool { + return obj.obj.GlobalIpv4Admin != nil +} + +// An IPv4 unicast address assigned by one of the Internet registries. +// SetGlobalIpv4Admin sets the string value in the ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget object +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) SetGlobalIpv4Admin(value string) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + + obj.obj.GlobalIpv4Admin = &value + return obj +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) Local2ByteAdmin() uint32 { + + return *obj.obj.Local_2ByteAdmin + +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// Local2ByteAdmin returns a uint32 +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) HasLocal2ByteAdmin() bool { + return obj.obj.Local_2ByteAdmin != nil +} + +// The Local Administrator sub-field contains a number from a numbering space that is administered by the organization to which the IP address carried in the Global Administrator sub-field has been assigned by an appropriate authority. +// SetLocal2ByteAdmin sets the uint32 value in the ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget object +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) SetLocal2ByteAdmin(value uint32) ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget { + + obj.obj.Local_2ByteAdmin = &value + return obj +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.GlobalIpv4Admin != nil { + + err := obj.validateIpv4(obj.GlobalIpv4Admin()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget.GlobalIpv4Admin")) + } + + } + + if obj.obj.Local_2ByteAdmin != nil { + + if *obj.obj.Local_2ByteAdmin > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= ResultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget.Local_2ByteAdmin <= 65535 but Got %d", *obj.obj.Local_2ByteAdmin)) + } + + } + +} + +func (obj *resultExtendedCommunityTransitiveIpv4AddressTypeRouteTarget) setDefault() { + +} diff --git a/gosnappi/result_extended_community_transitive_opaque_type.go b/gosnappi/result_extended_community_transitive_opaque_type.go new file mode 100644 index 00000000..168325d2 --- /dev/null +++ b/gosnappi/result_extended_community_transitive_opaque_type.go @@ -0,0 +1,446 @@ +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" +) + +// ***** ResultExtendedCommunityTransitiveOpaqueType ***** +type resultExtendedCommunityTransitiveOpaqueType struct { + validation + obj *otg.ResultExtendedCommunityTransitiveOpaqueType + marshaller marshalResultExtendedCommunityTransitiveOpaqueType + unMarshaller unMarshalResultExtendedCommunityTransitiveOpaqueType + colorSubtypeHolder ResultExtendedCommunityTransitiveOpaqueTypeColor + encapsulationSubtypeHolder ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation +} + +func NewResultExtendedCommunityTransitiveOpaqueType() ResultExtendedCommunityTransitiveOpaqueType { + obj := resultExtendedCommunityTransitiveOpaqueType{obj: &otg.ResultExtendedCommunityTransitiveOpaqueType{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityTransitiveOpaqueType) msg() *otg.ResultExtendedCommunityTransitiveOpaqueType { + return obj.obj +} + +func (obj *resultExtendedCommunityTransitiveOpaqueType) setMsg(msg *otg.ResultExtendedCommunityTransitiveOpaqueType) ResultExtendedCommunityTransitiveOpaqueType { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityTransitiveOpaqueType struct { + obj *resultExtendedCommunityTransitiveOpaqueType +} + +type marshalResultExtendedCommunityTransitiveOpaqueType interface { + // ToProto marshals ResultExtendedCommunityTransitiveOpaqueType to protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueType + ToProto() (*otg.ResultExtendedCommunityTransitiveOpaqueType, error) + // ToPbText marshals ResultExtendedCommunityTransitiveOpaqueType to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityTransitiveOpaqueType to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityTransitiveOpaqueType to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityTransitiveOpaqueType struct { + obj *resultExtendedCommunityTransitiveOpaqueType +} + +type unMarshalResultExtendedCommunityTransitiveOpaqueType interface { + // FromProto unmarshals ResultExtendedCommunityTransitiveOpaqueType from protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueType + FromProto(msg *otg.ResultExtendedCommunityTransitiveOpaqueType) (ResultExtendedCommunityTransitiveOpaqueType, error) + // FromPbText unmarshals ResultExtendedCommunityTransitiveOpaqueType from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityTransitiveOpaqueType from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityTransitiveOpaqueType from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityTransitiveOpaqueType) Marshal() marshalResultExtendedCommunityTransitiveOpaqueType { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityTransitiveOpaqueType{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityTransitiveOpaqueType) Unmarshal() unMarshalResultExtendedCommunityTransitiveOpaqueType { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityTransitiveOpaqueType{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityTransitiveOpaqueType) ToProto() (*otg.ResultExtendedCommunityTransitiveOpaqueType, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityTransitiveOpaqueType) FromProto(msg *otg.ResultExtendedCommunityTransitiveOpaqueType) (ResultExtendedCommunityTransitiveOpaqueType, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityTransitiveOpaqueType) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueType) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalresultExtendedCommunityTransitiveOpaqueType) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueType) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalresultExtendedCommunityTransitiveOpaqueType) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueType) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *resultExtendedCommunityTransitiveOpaqueType) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitiveOpaqueType) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitiveOpaqueType) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityTransitiveOpaqueType) Clone() (ResultExtendedCommunityTransitiveOpaqueType, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityTransitiveOpaqueType() + 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 +} + +func (obj *resultExtendedCommunityTransitiveOpaqueType) setNil() { + obj.colorSubtypeHolder = nil + obj.encapsulationSubtypeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// ResultExtendedCommunityTransitiveOpaqueType is the Transitive Opaque Extended Community is sent as type 0x03. +type ResultExtendedCommunityTransitiveOpaqueType interface { + Validation + // msg marshals ResultExtendedCommunityTransitiveOpaqueType to protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueType + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityTransitiveOpaqueType + // setMsg unmarshals ResultExtendedCommunityTransitiveOpaqueType from protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueType + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityTransitiveOpaqueType) ResultExtendedCommunityTransitiveOpaqueType + // provides marshal interface + Marshal() marshalResultExtendedCommunityTransitiveOpaqueType + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityTransitiveOpaqueType + // validate validates ResultExtendedCommunityTransitiveOpaqueType + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityTransitiveOpaqueType, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum, set in ResultExtendedCommunityTransitiveOpaqueType + Choice() ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum + // setChoice assigns ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum provided by user to ResultExtendedCommunityTransitiveOpaqueType + setChoice(value ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum) ResultExtendedCommunityTransitiveOpaqueType + // HasChoice checks if Choice has been set in ResultExtendedCommunityTransitiveOpaqueType + HasChoice() bool + // ColorSubtype returns ResultExtendedCommunityTransitiveOpaqueTypeColor, set in ResultExtendedCommunityTransitiveOpaqueType. + // ResultExtendedCommunityTransitiveOpaqueTypeColor is the Color Community contains locally administrator defined 'color' value which is used in conjunction with Encapsulation attribute to decide whether a data packet can be transmitted on a certain tunnel or not. It is defined in RFC9012 and sent with sub-type as 0x0b. + ColorSubtype() ResultExtendedCommunityTransitiveOpaqueTypeColor + // SetColorSubtype assigns ResultExtendedCommunityTransitiveOpaqueTypeColor provided by user to ResultExtendedCommunityTransitiveOpaqueType. + // ResultExtendedCommunityTransitiveOpaqueTypeColor is the Color Community contains locally administrator defined 'color' value which is used in conjunction with Encapsulation attribute to decide whether a data packet can be transmitted on a certain tunnel or not. It is defined in RFC9012 and sent with sub-type as 0x0b. + SetColorSubtype(value ResultExtendedCommunityTransitiveOpaqueTypeColor) ResultExtendedCommunityTransitiveOpaqueType + // HasColorSubtype checks if ColorSubtype has been set in ResultExtendedCommunityTransitiveOpaqueType + HasColorSubtype() bool + // EncapsulationSubtype returns ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation, set in ResultExtendedCommunityTransitiveOpaqueType. + // ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation is this identifies the type of tunneling technology being signalled. It is defined in RFC9012 and sent with sub-type as 0x0c. + EncapsulationSubtype() ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + // SetEncapsulationSubtype assigns ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation provided by user to ResultExtendedCommunityTransitiveOpaqueType. + // ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation is this identifies the type of tunneling technology being signalled. It is defined in RFC9012 and sent with sub-type as 0x0c. + SetEncapsulationSubtype(value ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation) ResultExtendedCommunityTransitiveOpaqueType + // HasEncapsulationSubtype checks if EncapsulationSubtype has been set in ResultExtendedCommunityTransitiveOpaqueType + HasEncapsulationSubtype() bool + setNil() +} + +type ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum string + +// Enum of Choice on ResultExtendedCommunityTransitiveOpaqueType +var ResultExtendedCommunityTransitiveOpaqueTypeChoice = struct { + COLOR_SUBTYPE ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum + ENCAPSULATION_SUBTYPE ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum +}{ + COLOR_SUBTYPE: ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum("color_subtype"), + ENCAPSULATION_SUBTYPE: ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum("encapsulation_subtype"), +} + +func (obj *resultExtendedCommunityTransitiveOpaqueType) Choice() ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum { + return ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *resultExtendedCommunityTransitiveOpaqueType) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *resultExtendedCommunityTransitiveOpaqueType) setChoice(value ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum) ResultExtendedCommunityTransitiveOpaqueType { + intValue, ok := otg.ResultExtendedCommunityTransitiveOpaqueType_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum", string(value))) + return obj + } + enumValue := otg.ResultExtendedCommunityTransitiveOpaqueType_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.EncapsulationSubtype = nil + obj.encapsulationSubtypeHolder = nil + obj.obj.ColorSubtype = nil + obj.colorSubtypeHolder = nil + + if value == ResultExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE { + obj.obj.ColorSubtype = NewResultExtendedCommunityTransitiveOpaqueTypeColor().msg() + } + + if value == ResultExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE { + obj.obj.EncapsulationSubtype = NewResultExtendedCommunityTransitiveOpaqueTypeEncapsulation().msg() + } + + return obj +} + +// description is TBD +// ColorSubtype returns a ResultExtendedCommunityTransitiveOpaqueTypeColor +func (obj *resultExtendedCommunityTransitiveOpaqueType) ColorSubtype() ResultExtendedCommunityTransitiveOpaqueTypeColor { + if obj.obj.ColorSubtype == nil { + obj.setChoice(ResultExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE) + } + if obj.colorSubtypeHolder == nil { + obj.colorSubtypeHolder = &resultExtendedCommunityTransitiveOpaqueTypeColor{obj: obj.obj.ColorSubtype} + } + return obj.colorSubtypeHolder +} + +// description is TBD +// ColorSubtype returns a ResultExtendedCommunityTransitiveOpaqueTypeColor +func (obj *resultExtendedCommunityTransitiveOpaqueType) HasColorSubtype() bool { + return obj.obj.ColorSubtype != nil +} + +// description is TBD +// SetColorSubtype sets the ResultExtendedCommunityTransitiveOpaqueTypeColor value in the ResultExtendedCommunityTransitiveOpaqueType object +func (obj *resultExtendedCommunityTransitiveOpaqueType) SetColorSubtype(value ResultExtendedCommunityTransitiveOpaqueTypeColor) ResultExtendedCommunityTransitiveOpaqueType { + obj.setChoice(ResultExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE) + obj.colorSubtypeHolder = nil + obj.obj.ColorSubtype = value.msg() + + return obj +} + +// description is TBD +// EncapsulationSubtype returns a ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation +func (obj *resultExtendedCommunityTransitiveOpaqueType) EncapsulationSubtype() ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { + if obj.obj.EncapsulationSubtype == nil { + obj.setChoice(ResultExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE) + } + if obj.encapsulationSubtypeHolder == nil { + obj.encapsulationSubtypeHolder = &resultExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: obj.obj.EncapsulationSubtype} + } + return obj.encapsulationSubtypeHolder +} + +// description is TBD +// EncapsulationSubtype returns a ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation +func (obj *resultExtendedCommunityTransitiveOpaqueType) HasEncapsulationSubtype() bool { + return obj.obj.EncapsulationSubtype != nil +} + +// description is TBD +// SetEncapsulationSubtype sets the ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation value in the ResultExtendedCommunityTransitiveOpaqueType object +func (obj *resultExtendedCommunityTransitiveOpaqueType) SetEncapsulationSubtype(value ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation) ResultExtendedCommunityTransitiveOpaqueType { + obj.setChoice(ResultExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE) + obj.encapsulationSubtypeHolder = nil + obj.obj.EncapsulationSubtype = value.msg() + + return obj +} + +func (obj *resultExtendedCommunityTransitiveOpaqueType) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.ColorSubtype != nil { + + obj.ColorSubtype().validateObj(vObj, set_default) + } + + if obj.obj.EncapsulationSubtype != nil { + + obj.EncapsulationSubtype().validateObj(vObj, set_default) + } + +} + +func (obj *resultExtendedCommunityTransitiveOpaqueType) setDefault() { + var choices_set int = 0 + var choice ResultExtendedCommunityTransitiveOpaqueTypeChoiceEnum + + if obj.obj.ColorSubtype != nil { + choices_set += 1 + choice = ResultExtendedCommunityTransitiveOpaqueTypeChoice.COLOR_SUBTYPE + } + + if obj.obj.EncapsulationSubtype != nil { + choices_set += 1 + choice = ResultExtendedCommunityTransitiveOpaqueTypeChoice.ENCAPSULATION_SUBTYPE + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in ResultExtendedCommunityTransitiveOpaqueType") + } + } else { + intVal := otg.ResultExtendedCommunityTransitiveOpaqueType_Choice_Enum_value[string(choice)] + enumValue := otg.ResultExtendedCommunityTransitiveOpaqueType_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/result_extended_community_transitive_opaque_type_color.go b/gosnappi/result_extended_community_transitive_opaque_type_color.go new file mode 100644 index 00000000..0390936a --- /dev/null +++ b/gosnappi/result_extended_community_transitive_opaque_type_color.go @@ -0,0 +1,347 @@ +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" +) + +// ***** ResultExtendedCommunityTransitiveOpaqueTypeColor ***** +type resultExtendedCommunityTransitiveOpaqueTypeColor struct { + validation + obj *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor + marshaller marshalResultExtendedCommunityTransitiveOpaqueTypeColor + unMarshaller unMarshalResultExtendedCommunityTransitiveOpaqueTypeColor +} + +func NewResultExtendedCommunityTransitiveOpaqueTypeColor() ResultExtendedCommunityTransitiveOpaqueTypeColor { + obj := resultExtendedCommunityTransitiveOpaqueTypeColor{obj: &otg.ResultExtendedCommunityTransitiveOpaqueTypeColor{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) msg() *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor { + return obj.obj +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) setMsg(msg *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor) ResultExtendedCommunityTransitiveOpaqueTypeColor { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityTransitiveOpaqueTypeColor struct { + obj *resultExtendedCommunityTransitiveOpaqueTypeColor +} + +type marshalResultExtendedCommunityTransitiveOpaqueTypeColor interface { + // ToProto marshals ResultExtendedCommunityTransitiveOpaqueTypeColor to protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor + ToProto() (*otg.ResultExtendedCommunityTransitiveOpaqueTypeColor, error) + // ToPbText marshals ResultExtendedCommunityTransitiveOpaqueTypeColor to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityTransitiveOpaqueTypeColor to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityTransitiveOpaqueTypeColor to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityTransitiveOpaqueTypeColor struct { + obj *resultExtendedCommunityTransitiveOpaqueTypeColor +} + +type unMarshalResultExtendedCommunityTransitiveOpaqueTypeColor interface { + // FromProto unmarshals ResultExtendedCommunityTransitiveOpaqueTypeColor from protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor + FromProto(msg *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor) (ResultExtendedCommunityTransitiveOpaqueTypeColor, error) + // FromPbText unmarshals ResultExtendedCommunityTransitiveOpaqueTypeColor from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityTransitiveOpaqueTypeColor from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityTransitiveOpaqueTypeColor from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) Marshal() marshalResultExtendedCommunityTransitiveOpaqueTypeColor { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityTransitiveOpaqueTypeColor{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) Unmarshal() unMarshalResultExtendedCommunityTransitiveOpaqueTypeColor { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityTransitiveOpaqueTypeColor{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityTransitiveOpaqueTypeColor) ToProto() (*otg.ResultExtendedCommunityTransitiveOpaqueTypeColor, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityTransitiveOpaqueTypeColor) FromProto(msg *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor) (ResultExtendedCommunityTransitiveOpaqueTypeColor, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityTransitiveOpaqueTypeColor) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueTypeColor) 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 *marshalresultExtendedCommunityTransitiveOpaqueTypeColor) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueTypeColor) 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 *marshalresultExtendedCommunityTransitiveOpaqueTypeColor) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueTypeColor) 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 *resultExtendedCommunityTransitiveOpaqueTypeColor) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) Clone() (ResultExtendedCommunityTransitiveOpaqueTypeColor, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityTransitiveOpaqueTypeColor() + 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 +} + +// ResultExtendedCommunityTransitiveOpaqueTypeColor is the Color Community contains locally administrator defined 'color' value which is used in conjunction with Encapsulation attribute to decide whether a data packet can be transmitted on a certain tunnel or not. It is defined in RFC9012 and sent with sub-type as 0x0b. +type ResultExtendedCommunityTransitiveOpaqueTypeColor interface { + Validation + // msg marshals ResultExtendedCommunityTransitiveOpaqueTypeColor to protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor + // setMsg unmarshals ResultExtendedCommunityTransitiveOpaqueTypeColor from protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeColor + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityTransitiveOpaqueTypeColor) ResultExtendedCommunityTransitiveOpaqueTypeColor + // provides marshal interface + Marshal() marshalResultExtendedCommunityTransitiveOpaqueTypeColor + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityTransitiveOpaqueTypeColor + // validate validates ResultExtendedCommunityTransitiveOpaqueTypeColor + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityTransitiveOpaqueTypeColor, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Flags returns uint32, set in ResultExtendedCommunityTransitiveOpaqueTypeColor. + Flags() uint32 + // SetFlags assigns uint32 provided by user to ResultExtendedCommunityTransitiveOpaqueTypeColor + SetFlags(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeColor + // HasFlags checks if Flags has been set in ResultExtendedCommunityTransitiveOpaqueTypeColor + HasFlags() bool + // Color returns uint32, set in ResultExtendedCommunityTransitiveOpaqueTypeColor. + Color() uint32 + // SetColor assigns uint32 provided by user to ResultExtendedCommunityTransitiveOpaqueTypeColor + SetColor(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeColor + // HasColor checks if Color has been set in ResultExtendedCommunityTransitiveOpaqueTypeColor + HasColor() bool +} + +// Two octet flag values. +// Flags returns a uint32 +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) Flags() uint32 { + + return *obj.obj.Flags + +} + +// Two octet flag values. +// Flags returns a uint32 +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) HasFlags() bool { + return obj.obj.Flags != nil +} + +// Two octet flag values. +// SetFlags sets the uint32 value in the ResultExtendedCommunityTransitiveOpaqueTypeColor object +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) SetFlags(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeColor { + + obj.obj.Flags = &value + return obj +} + +// The color value is user defined and configured locally and used to determine whether a data packet can be transmitted on a certain tunnel or not +// in conjunction with the Encapsulation attribute. It is defined in RFC9012. +// Color returns a uint32 +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) Color() uint32 { + + return *obj.obj.Color + +} + +// The color value is user defined and configured locally and used to determine whether a data packet can be transmitted on a certain tunnel or not +// in conjunction with the Encapsulation attribute. It is defined in RFC9012. +// Color returns a uint32 +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) HasColor() bool { + return obj.obj.Color != nil +} + +// The color value is user defined and configured locally and used to determine whether a data packet can be transmitted on a certain tunnel or not +// in conjunction with the Encapsulation attribute. It is defined in RFC9012. +// SetColor sets the uint32 value in the ResultExtendedCommunityTransitiveOpaqueTypeColor object +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) SetColor(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeColor { + + obj.obj.Color = &value + return obj +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Flags != nil { + + if *obj.obj.Flags > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= ResultExtendedCommunityTransitiveOpaqueTypeColor.Flags <= 65535 but Got %d", *obj.obj.Flags)) + } + + } + +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeColor) setDefault() { + +} diff --git a/gosnappi/result_extended_community_transitive_opaque_type_encapsulation.go b/gosnappi/result_extended_community_transitive_opaque_type_encapsulation.go new file mode 100644 index 00000000..ea889de1 --- /dev/null +++ b/gosnappi/result_extended_community_transitive_opaque_type_encapsulation.go @@ -0,0 +1,371 @@ +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" +) + +// ***** ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation ***** +type resultExtendedCommunityTransitiveOpaqueTypeEncapsulation struct { + validation + obj *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + marshaller marshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + unMarshaller unMarshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation +} + +func NewResultExtendedCommunityTransitiveOpaqueTypeEncapsulation() ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { + obj := resultExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: &otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation{}} + obj.setDefault() + return &obj +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) msg() *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { + return obj.obj +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) setMsg(msg *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation) ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation struct { + obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation +} + +type marshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation interface { + // ToProto marshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation to protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + ToProto() (*otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) + // ToPbText marshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation to protobuf text + ToPbText() (string, error) + // ToYaml marshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation to YAML text + ToYaml() (string, error) + // ToJson marshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation to JSON text + ToJson() (string, error) +} + +type unMarshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation struct { + obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation +} + +type unMarshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation interface { + // FromProto unmarshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation from protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + FromProto(msg *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation) (ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) + // FromPbText unmarshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation from protobuf text + FromPbText(value string) error + // FromYaml unmarshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation from YAML text + FromYaml(value string) error + // FromJson unmarshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation from JSON text + FromJson(value string) error +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) Marshal() marshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { + if obj.marshaller == nil { + obj.marshaller = &marshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: obj} + } + return obj.marshaller +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) Unmarshal() unMarshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) ToProto() (*otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) FromProto(msg *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation) (ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *marshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *marshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *unMarshalresultExtendedCommunityTransitiveOpaqueTypeEncapsulation) 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 *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) Clone() (ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewResultExtendedCommunityTransitiveOpaqueTypeEncapsulation() + 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 +} + +// ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation is this identifies the type of tunneling technology being signalled. It is defined in RFC9012 and sent with sub-type as 0x0c. +type ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation interface { + Validation + // msg marshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation to protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + // and doesn't set defaults + msg() *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + // setMsg unmarshals ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation from protobuf object *otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + // and doesn't set defaults + setMsg(*otg.ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation) ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + // provides marshal interface + Marshal() marshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + // provides unmarshal interface + Unmarshal() unMarshalResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + // validate validates ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + validate() error + // A stringer function + String() string + // Clones the object + Clone() (ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Reserved returns uint32, set in ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation. + Reserved() uint32 + // SetReserved assigns uint32 provided by user to ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + SetReserved(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + // HasReserved checks if Reserved has been set in ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + HasReserved() bool + // TunnelType returns uint32, set in ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation. + TunnelType() uint32 + // SetTunnelType assigns uint32 provided by user to ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + SetTunnelType(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + // HasTunnelType checks if TunnelType has been set in ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation + HasTunnelType() bool +} + +// Four bytes of reserved values. Normally set to 0 on transmit and ignored on receive. +// Reserved returns a uint32 +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) Reserved() uint32 { + + return *obj.obj.Reserved + +} + +// Four bytes of reserved values. Normally set to 0 on transmit and ignored on receive. +// Reserved returns a uint32 +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) HasReserved() bool { + return obj.obj.Reserved != nil +} + +// Four bytes of reserved values. Normally set to 0 on transmit and ignored on receive. +// SetReserved sets the uint32 value in the ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation object +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) SetReserved(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { + + obj.obj.Reserved = &value + return obj +} + +// Identifies the type of tunneling technology being signalled. Initially defined in RFC5512 and extended in RFC9012. +// Some of the important tunnel types include +// - 1 L2TPv3 over IP [RFC9012], +// - 2 GRE [RFC9012], +// - 7 IP in IP [RFC9012], +// - 8 VXLAN Encapsulation [RFC8365], +// - 9 NVGRE Encapsulation [RFC8365], +// - 10 MPLS Encapsulation [RFC8365], +// - 15 SR TE Policy Type [draft-ietf-idr-segment-routing-te-policy], +// - 19 Geneve Encapsulation [RFC8926] +// TunnelType returns a uint32 +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) TunnelType() uint32 { + + return *obj.obj.TunnelType + +} + +// Identifies the type of tunneling technology being signalled. Initially defined in RFC5512 and extended in RFC9012. +// Some of the important tunnel types include +// - 1 L2TPv3 over IP [RFC9012], +// - 2 GRE [RFC9012], +// - 7 IP in IP [RFC9012], +// - 8 VXLAN Encapsulation [RFC8365], +// - 9 NVGRE Encapsulation [RFC8365], +// - 10 MPLS Encapsulation [RFC8365], +// - 15 SR TE Policy Type [draft-ietf-idr-segment-routing-te-policy], +// - 19 Geneve Encapsulation [RFC8926] +// TunnelType returns a uint32 +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) HasTunnelType() bool { + return obj.obj.TunnelType != nil +} + +// Identifies the type of tunneling technology being signalled. Initially defined in RFC5512 and extended in RFC9012. +// Some of the important tunnel types include +// - 1 L2TPv3 over IP [RFC9012], +// - 2 GRE [RFC9012], +// - 7 IP in IP [RFC9012], +// - 8 VXLAN Encapsulation [RFC8365], +// - 9 NVGRE Encapsulation [RFC8365], +// - 10 MPLS Encapsulation [RFC8365], +// - 15 SR TE Policy Type [draft-ietf-idr-segment-routing-te-policy], +// - 19 Geneve Encapsulation [RFC8926] +// SetTunnelType sets the uint32 value in the ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation object +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) SetTunnelType(value uint32) ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation { + + obj.obj.TunnelType = &value + return obj +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.TunnelType != nil { + + if *obj.obj.TunnelType > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= ResultExtendedCommunityTransitiveOpaqueTypeEncapsulation.TunnelType <= 65535 but Got %d", *obj.obj.TunnelType)) + } + + } + +} + +func (obj *resultExtendedCommunityTransitiveOpaqueTypeEncapsulation) setDefault() { + +} diff --git a/gosnappi/rsvp_ero.go b/gosnappi/rsvp_ero.go new file mode 100644 index 00000000..72500694 --- /dev/null +++ b/gosnappi/rsvp_ero.go @@ -0,0 +1,477 @@ +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" +) + +// ***** RsvpEro ***** +type rsvpEro struct { + validation + obj *otg.RsvpEro + marshaller marshalRsvpEro + unMarshaller unMarshalRsvpEro + subobjectsHolder RsvpEroRsvpEroSubobjectIter +} + +func NewRsvpEro() RsvpEro { + obj := rsvpEro{obj: &otg.RsvpEro{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpEro) msg() *otg.RsvpEro { + return obj.obj +} + +func (obj *rsvpEro) setMsg(msg *otg.RsvpEro) RsvpEro { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpEro struct { + obj *rsvpEro +} + +type marshalRsvpEro interface { + // ToProto marshals RsvpEro to protobuf object *otg.RsvpEro + ToProto() (*otg.RsvpEro, error) + // ToPbText marshals RsvpEro to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpEro to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpEro to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpEro struct { + obj *rsvpEro +} + +type unMarshalRsvpEro interface { + // FromProto unmarshals RsvpEro from protobuf object *otg.RsvpEro + FromProto(msg *otg.RsvpEro) (RsvpEro, error) + // FromPbText unmarshals RsvpEro from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpEro from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpEro from JSON text + FromJson(value string) error +} + +func (obj *rsvpEro) Marshal() marshalRsvpEro { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpEro{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpEro) Unmarshal() unMarshalRsvpEro { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpEro{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpEro) ToProto() (*otg.RsvpEro, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpEro) FromProto(msg *otg.RsvpEro) (RsvpEro, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpEro) 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 *unMarshalrsvpEro) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalrsvpEro) 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 *unMarshalrsvpEro) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalrsvpEro) 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 *unMarshalrsvpEro) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *rsvpEro) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpEro) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpEro) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpEro) Clone() (RsvpEro, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpEro() + 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 +} + +func (obj *rsvpEro) setNil() { + obj.subobjectsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// RsvpEro is configuration for the optional RSVP-TE explicit route object(ERO) object included in Path Messages. +type RsvpEro interface { + Validation + // msg marshals RsvpEro to protobuf object *otg.RsvpEro + // and doesn't set defaults + msg() *otg.RsvpEro + // setMsg unmarshals RsvpEro from protobuf object *otg.RsvpEro + // and doesn't set defaults + setMsg(*otg.RsvpEro) RsvpEro + // provides marshal interface + Marshal() marshalRsvpEro + // provides unmarshal interface + Unmarshal() unMarshalRsvpEro + // validate validates RsvpEro + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpEro, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PrependNeighborIp returns RsvpEroPrependNeighborIpEnum, set in RsvpEro + PrependNeighborIp() RsvpEroPrependNeighborIpEnum + // SetPrependNeighborIp assigns RsvpEroPrependNeighborIpEnum provided by user to RsvpEro + SetPrependNeighborIp(value RsvpEroPrependNeighborIpEnum) RsvpEro + // HasPrependNeighborIp checks if PrependNeighborIp has been set in RsvpEro + HasPrependNeighborIp() bool + // PrefixLength returns uint32, set in RsvpEro. + PrefixLength() uint32 + // SetPrefixLength assigns uint32 provided by user to RsvpEro + SetPrefixLength(value uint32) RsvpEro + // HasPrefixLength checks if PrefixLength has been set in RsvpEro + HasPrefixLength() bool + // Subobjects returns RsvpEroRsvpEroSubobjectIterIter, set in RsvpEro + Subobjects() RsvpEroRsvpEroSubobjectIter + setNil() +} + +type RsvpEroPrependNeighborIpEnum string + +// Enum of PrependNeighborIp on RsvpEro +var RsvpEroPrependNeighborIp = struct { + DONT_PREPEND RsvpEroPrependNeighborIpEnum + PREPEND_LOOSE RsvpEroPrependNeighborIpEnum + PREPEND_STRICT RsvpEroPrependNeighborIpEnum +}{ + DONT_PREPEND: RsvpEroPrependNeighborIpEnum("dont_prepend"), + PREPEND_LOOSE: RsvpEroPrependNeighborIpEnum("prepend_loose"), + PREPEND_STRICT: RsvpEroPrependNeighborIpEnum("prepend_strict"), +} + +func (obj *rsvpEro) PrependNeighborIp() RsvpEroPrependNeighborIpEnum { + return RsvpEroPrependNeighborIpEnum(obj.obj.PrependNeighborIp.Enum().String()) +} + +// Determines whether the IP address of the RSVP neighbor should be added as an ERO sub-object. If it is to be included, it can be included as a Loose hop or as a Strict hop. +// PrependNeighborIp returns a string +func (obj *rsvpEro) HasPrependNeighborIp() bool { + return obj.obj.PrependNeighborIp != nil +} + +func (obj *rsvpEro) SetPrependNeighborIp(value RsvpEroPrependNeighborIpEnum) RsvpEro { + intValue, ok := otg.RsvpEro_PrependNeighborIp_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on RsvpEroPrependNeighborIpEnum", string(value))) + return obj + } + enumValue := otg.RsvpEro_PrependNeighborIp_Enum(intValue) + obj.obj.PrependNeighborIp = &enumValue + + return obj +} + +// If prepend_egress_ip is set to one of 'prepend_loose' or 'prepend_strict', then set this value as the prefix length of the ERO sub-object containing egress IP address. +// PrefixLength returns a uint32 +func (obj *rsvpEro) PrefixLength() uint32 { + + return *obj.obj.PrefixLength + +} + +// If prepend_egress_ip is set to one of 'prepend_loose' or 'prepend_strict', then set this value as the prefix length of the ERO sub-object containing egress IP address. +// PrefixLength returns a uint32 +func (obj *rsvpEro) HasPrefixLength() bool { + return obj.obj.PrefixLength != nil +} + +// If prepend_egress_ip is set to one of 'prepend_loose' or 'prepend_strict', then set this value as the prefix length of the ERO sub-object containing egress IP address. +// SetPrefixLength sets the uint32 value in the RsvpEro object +func (obj *rsvpEro) SetPrefixLength(value uint32) RsvpEro { + + obj.obj.PrefixLength = &value + return obj +} + +// Array of sub-objects to be included in the ERO. These sub-objects contain the intermediate hops to be traversed by the LSP while being forwarded towards the egress endpoint. These sub-objects are included after the optional sub-object containing IP address of egress endpoint of the LSP (when present). +// Subobjects returns a []RsvpEroSubobject +func (obj *rsvpEro) Subobjects() RsvpEroRsvpEroSubobjectIter { + if len(obj.obj.Subobjects) == 0 { + obj.obj.Subobjects = []*otg.RsvpEroSubobject{} + } + if obj.subobjectsHolder == nil { + obj.subobjectsHolder = newRsvpEroRsvpEroSubobjectIter(&obj.obj.Subobjects).setMsg(obj) + } + return obj.subobjectsHolder +} + +type rsvpEroRsvpEroSubobjectIter struct { + obj *rsvpEro + rsvpEroSubobjectSlice []RsvpEroSubobject + fieldPtr *[]*otg.RsvpEroSubobject +} + +func newRsvpEroRsvpEroSubobjectIter(ptr *[]*otg.RsvpEroSubobject) RsvpEroRsvpEroSubobjectIter { + return &rsvpEroRsvpEroSubobjectIter{fieldPtr: ptr} +} + +type RsvpEroRsvpEroSubobjectIter interface { + setMsg(*rsvpEro) RsvpEroRsvpEroSubobjectIter + Items() []RsvpEroSubobject + Add() RsvpEroSubobject + Append(items ...RsvpEroSubobject) RsvpEroRsvpEroSubobjectIter + Set(index int, newObj RsvpEroSubobject) RsvpEroRsvpEroSubobjectIter + Clear() RsvpEroRsvpEroSubobjectIter + clearHolderSlice() RsvpEroRsvpEroSubobjectIter + appendHolderSlice(item RsvpEroSubobject) RsvpEroRsvpEroSubobjectIter +} + +func (obj *rsvpEroRsvpEroSubobjectIter) setMsg(msg *rsvpEro) RsvpEroRsvpEroSubobjectIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&rsvpEroSubobject{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *rsvpEroRsvpEroSubobjectIter) Items() []RsvpEroSubobject { + return obj.rsvpEroSubobjectSlice +} + +func (obj *rsvpEroRsvpEroSubobjectIter) Add() RsvpEroSubobject { + newObj := &otg.RsvpEroSubobject{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &rsvpEroSubobject{obj: newObj} + newLibObj.setDefault() + obj.rsvpEroSubobjectSlice = append(obj.rsvpEroSubobjectSlice, newLibObj) + return newLibObj +} + +func (obj *rsvpEroRsvpEroSubobjectIter) Append(items ...RsvpEroSubobject) RsvpEroRsvpEroSubobjectIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.rsvpEroSubobjectSlice = append(obj.rsvpEroSubobjectSlice, item) + } + return obj +} + +func (obj *rsvpEroRsvpEroSubobjectIter) Set(index int, newObj RsvpEroSubobject) RsvpEroRsvpEroSubobjectIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.rsvpEroSubobjectSlice[index] = newObj + return obj +} +func (obj *rsvpEroRsvpEroSubobjectIter) Clear() RsvpEroRsvpEroSubobjectIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.RsvpEroSubobject{} + obj.rsvpEroSubobjectSlice = []RsvpEroSubobject{} + } + return obj +} +func (obj *rsvpEroRsvpEroSubobjectIter) clearHolderSlice() RsvpEroRsvpEroSubobjectIter { + if len(obj.rsvpEroSubobjectSlice) > 0 { + obj.rsvpEroSubobjectSlice = []RsvpEroSubobject{} + } + return obj +} +func (obj *rsvpEroRsvpEroSubobjectIter) appendHolderSlice(item RsvpEroSubobject) RsvpEroRsvpEroSubobjectIter { + obj.rsvpEroSubobjectSlice = append(obj.rsvpEroSubobjectSlice, item) + return obj +} + +func (obj *rsvpEro) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.PrefixLength != nil { + + if *obj.obj.PrefixLength > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpEro.PrefixLength <= 32 but Got %d", *obj.obj.PrefixLength)) + } + + } + + if len(obj.obj.Subobjects) != 0 { + + if set_default { + obj.Subobjects().clearHolderSlice() + for _, item := range obj.obj.Subobjects { + obj.Subobjects().appendHolderSlice(&rsvpEroSubobject{obj: item}) + } + } + for _, item := range obj.Subobjects().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *rsvpEro) setDefault() { + if obj.obj.PrependNeighborIp == nil { + obj.SetPrependNeighborIp(RsvpEroPrependNeighborIp.PREPEND_LOOSE) + + } + if obj.obj.PrefixLength == nil { + obj.SetPrefixLength(32) + } + +} diff --git a/gosnappi/rsvp_ero_subobject.go b/gosnappi/rsvp_ero_subobject.go new file mode 100644 index 00000000..5b540627 --- /dev/null +++ b/gosnappi/rsvp_ero_subobject.go @@ -0,0 +1,488 @@ +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" +) + +// ***** RsvpEroSubobject ***** +type rsvpEroSubobject struct { + validation + obj *otg.RsvpEroSubobject + marshaller marshalRsvpEroSubobject + unMarshaller unMarshalRsvpEroSubobject +} + +func NewRsvpEroSubobject() RsvpEroSubobject { + obj := rsvpEroSubobject{obj: &otg.RsvpEroSubobject{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpEroSubobject) msg() *otg.RsvpEroSubobject { + return obj.obj +} + +func (obj *rsvpEroSubobject) setMsg(msg *otg.RsvpEroSubobject) RsvpEroSubobject { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpEroSubobject struct { + obj *rsvpEroSubobject +} + +type marshalRsvpEroSubobject interface { + // ToProto marshals RsvpEroSubobject to protobuf object *otg.RsvpEroSubobject + ToProto() (*otg.RsvpEroSubobject, error) + // ToPbText marshals RsvpEroSubobject to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpEroSubobject to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpEroSubobject to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpEroSubobject struct { + obj *rsvpEroSubobject +} + +type unMarshalRsvpEroSubobject interface { + // FromProto unmarshals RsvpEroSubobject from protobuf object *otg.RsvpEroSubobject + FromProto(msg *otg.RsvpEroSubobject) (RsvpEroSubobject, error) + // FromPbText unmarshals RsvpEroSubobject from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpEroSubobject from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpEroSubobject from JSON text + FromJson(value string) error +} + +func (obj *rsvpEroSubobject) Marshal() marshalRsvpEroSubobject { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpEroSubobject{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpEroSubobject) Unmarshal() unMarshalRsvpEroSubobject { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpEroSubobject{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpEroSubobject) ToProto() (*otg.RsvpEroSubobject, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpEroSubobject) FromProto(msg *otg.RsvpEroSubobject) (RsvpEroSubobject, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpEroSubobject) 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 *unMarshalrsvpEroSubobject) 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 *marshalrsvpEroSubobject) 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 *unMarshalrsvpEroSubobject) 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 *marshalrsvpEroSubobject) 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 *unMarshalrsvpEroSubobject) 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 *rsvpEroSubobject) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpEroSubobject) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpEroSubobject) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpEroSubobject) Clone() (RsvpEroSubobject, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpEroSubobject() + 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 +} + +// RsvpEroSubobject is configuration for the ERO sub-object. +type RsvpEroSubobject interface { + Validation + // msg marshals RsvpEroSubobject to protobuf object *otg.RsvpEroSubobject + // and doesn't set defaults + msg() *otg.RsvpEroSubobject + // setMsg unmarshals RsvpEroSubobject from protobuf object *otg.RsvpEroSubobject + // and doesn't set defaults + setMsg(*otg.RsvpEroSubobject) RsvpEroSubobject + // provides marshal interface + Marshal() marshalRsvpEroSubobject + // provides unmarshal interface + Unmarshal() unMarshalRsvpEroSubobject + // validate validates RsvpEroSubobject + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpEroSubobject, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Type returns RsvpEroSubobjectTypeEnum, set in RsvpEroSubobject + Type() RsvpEroSubobjectTypeEnum + // SetType assigns RsvpEroSubobjectTypeEnum provided by user to RsvpEroSubobject + SetType(value RsvpEroSubobjectTypeEnum) RsvpEroSubobject + // HasType checks if Type has been set in RsvpEroSubobject + HasType() bool + // Ipv4Address returns string, set in RsvpEroSubobject. + Ipv4Address() string + // SetIpv4Address assigns string provided by user to RsvpEroSubobject + SetIpv4Address(value string) RsvpEroSubobject + // HasIpv4Address checks if Ipv4Address has been set in RsvpEroSubobject + HasIpv4Address() bool + // PrefixLength returns uint32, set in RsvpEroSubobject. + PrefixLength() uint32 + // SetPrefixLength assigns uint32 provided by user to RsvpEroSubobject + SetPrefixLength(value uint32) RsvpEroSubobject + // HasPrefixLength checks if PrefixLength has been set in RsvpEroSubobject + HasPrefixLength() bool + // AsNumber returns uint32, set in RsvpEroSubobject. + AsNumber() uint32 + // SetAsNumber assigns uint32 provided by user to RsvpEroSubobject + SetAsNumber(value uint32) RsvpEroSubobject + // HasAsNumber checks if AsNumber has been set in RsvpEroSubobject + HasAsNumber() bool + // HopType returns RsvpEroSubobjectHopTypeEnum, set in RsvpEroSubobject + HopType() RsvpEroSubobjectHopTypeEnum + // SetHopType assigns RsvpEroSubobjectHopTypeEnum provided by user to RsvpEroSubobject + SetHopType(value RsvpEroSubobjectHopTypeEnum) RsvpEroSubobject + // HasHopType checks if HopType has been set in RsvpEroSubobject + HasHopType() bool +} + +type RsvpEroSubobjectTypeEnum string + +// Enum of Type on RsvpEroSubobject +var RsvpEroSubobjectType = struct { + IPV4 RsvpEroSubobjectTypeEnum + AS_NUMBER RsvpEroSubobjectTypeEnum +}{ + IPV4: RsvpEroSubobjectTypeEnum("ipv4"), + AS_NUMBER: RsvpEroSubobjectTypeEnum("as_number"), +} + +func (obj *rsvpEroSubobject) Type() RsvpEroSubobjectTypeEnum { + return RsvpEroSubobjectTypeEnum(obj.obj.Type.Enum().String()) +} + +// The type of the ERO sub-object, one of IPv4 Address or AS Number. +// Type returns a string +func (obj *rsvpEroSubobject) HasType() bool { + return obj.obj.Type != nil +} + +func (obj *rsvpEroSubobject) SetType(value RsvpEroSubobjectTypeEnum) RsvpEroSubobject { + intValue, ok := otg.RsvpEroSubobject_Type_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on RsvpEroSubobjectTypeEnum", string(value))) + return obj + } + enumValue := otg.RsvpEroSubobject_Type_Enum(intValue) + obj.obj.Type = &enumValue + + return obj +} + +// IPv4 address that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'ipv4'. +// Ipv4Address returns a string +func (obj *rsvpEroSubobject) Ipv4Address() string { + + return *obj.obj.Ipv4Address + +} + +// IPv4 address that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'ipv4'. +// Ipv4Address returns a string +func (obj *rsvpEroSubobject) HasIpv4Address() bool { + return obj.obj.Ipv4Address != nil +} + +// IPv4 address that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'ipv4'. +// SetIpv4Address sets the string value in the RsvpEroSubobject object +func (obj *rsvpEroSubobject) SetIpv4Address(value string) RsvpEroSubobject { + + obj.obj.Ipv4Address = &value + return obj +} + +// Prefix length for the IPv4 address in the ERO sub-object. This field is applicable only if the value of 'type' is set to 'ipv4'. +// PrefixLength returns a uint32 +func (obj *rsvpEroSubobject) PrefixLength() uint32 { + + return *obj.obj.PrefixLength + +} + +// Prefix length for the IPv4 address in the ERO sub-object. This field is applicable only if the value of 'type' is set to 'ipv4'. +// PrefixLength returns a uint32 +func (obj *rsvpEroSubobject) HasPrefixLength() bool { + return obj.obj.PrefixLength != nil +} + +// Prefix length for the IPv4 address in the ERO sub-object. This field is applicable only if the value of 'type' is set to 'ipv4'. +// SetPrefixLength sets the uint32 value in the RsvpEroSubobject object +func (obj *rsvpEroSubobject) SetPrefixLength(value uint32) RsvpEroSubobject { + + obj.obj.PrefixLength = &value + return obj +} + +// Autonomous System number to be set in the ERO sub-object that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'as_number'. Note that as per RFC3209, 4-byte AS encoding is not supported. +// AsNumber returns a uint32 +func (obj *rsvpEroSubobject) AsNumber() uint32 { + + return *obj.obj.AsNumber + +} + +// Autonomous System number to be set in the ERO sub-object that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'as_number'. Note that as per RFC3209, 4-byte AS encoding is not supported. +// AsNumber returns a uint32 +func (obj *rsvpEroSubobject) HasAsNumber() bool { + return obj.obj.AsNumber != nil +} + +// Autonomous System number to be set in the ERO sub-object that this LSP should traverse through. This field is applicable only if the value of 'type' is set to 'as_number'. Note that as per RFC3209, 4-byte AS encoding is not supported. +// SetAsNumber sets the uint32 value in the RsvpEroSubobject object +func (obj *rsvpEroSubobject) SetAsNumber(value uint32) RsvpEroSubobject { + + obj.obj.AsNumber = &value + return obj +} + +type RsvpEroSubobjectHopTypeEnum string + +// Enum of HopType on RsvpEroSubobject +var RsvpEroSubobjectHopType = struct { + STRICT RsvpEroSubobjectHopTypeEnum + LOOSE RsvpEroSubobjectHopTypeEnum +}{ + STRICT: RsvpEroSubobjectHopTypeEnum("strict"), + LOOSE: RsvpEroSubobjectHopTypeEnum("loose"), +} + +func (obj *rsvpEroSubobject) HopType() RsvpEroSubobjectHopTypeEnum { + return RsvpEroSubobjectHopTypeEnum(obj.obj.HopType.Enum().String()) +} + +// The hop type of the ERO sub-object, one of Strict or Loose. +// HopType returns a string +func (obj *rsvpEroSubobject) HasHopType() bool { + return obj.obj.HopType != nil +} + +func (obj *rsvpEroSubobject) SetHopType(value RsvpEroSubobjectHopTypeEnum) RsvpEroSubobject { + intValue, ok := otg.RsvpEroSubobject_HopType_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on RsvpEroSubobjectHopTypeEnum", string(value))) + return obj + } + enumValue := otg.RsvpEroSubobject_HopType_Enum(intValue) + obj.obj.HopType = &enumValue + + return obj +} + +func (obj *rsvpEroSubobject) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv4Address != nil { + + err := obj.validateIpv4(obj.Ipv4Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on RsvpEroSubobject.Ipv4Address")) + } + + } + + if obj.obj.PrefixLength != nil { + + if *obj.obj.PrefixLength > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpEroSubobject.PrefixLength <= 32 but Got %d", *obj.obj.PrefixLength)) + } + + } + + if obj.obj.AsNumber != nil { + + if *obj.obj.AsNumber > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpEroSubobject.AsNumber <= 65535 but Got %d", *obj.obj.AsNumber)) + } + + } + +} + +func (obj *rsvpEroSubobject) setDefault() { + if obj.obj.Type == nil { + obj.SetType(RsvpEroSubobjectType.IPV4) + + } + if obj.obj.Ipv4Address == nil { + obj.SetIpv4Address("0.0.0.0") + } + if obj.obj.PrefixLength == nil { + obj.SetPrefixLength(32) + } + if obj.obj.AsNumber == nil { + obj.SetAsNumber(0) + } + if obj.obj.HopType == nil { + obj.SetHopType(RsvpEroSubobjectHopType.LOOSE) + + } + +} diff --git a/gosnappi/rsvp_fast_reroute.go b/gosnappi/rsvp_fast_reroute.go new file mode 100644 index 00000000..35ebb432 --- /dev/null +++ b/gosnappi/rsvp_fast_reroute.go @@ -0,0 +1,623 @@ +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" +) + +// ***** RsvpFastReroute ***** +type rsvpFastReroute struct { + validation + obj *otg.RsvpFastReroute + marshaller marshalRsvpFastReroute + unMarshaller unMarshalRsvpFastReroute +} + +func NewRsvpFastReroute() RsvpFastReroute { + obj := rsvpFastReroute{obj: &otg.RsvpFastReroute{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpFastReroute) msg() *otg.RsvpFastReroute { + return obj.obj +} + +func (obj *rsvpFastReroute) setMsg(msg *otg.RsvpFastReroute) RsvpFastReroute { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpFastReroute struct { + obj *rsvpFastReroute +} + +type marshalRsvpFastReroute interface { + // ToProto marshals RsvpFastReroute to protobuf object *otg.RsvpFastReroute + ToProto() (*otg.RsvpFastReroute, error) + // ToPbText marshals RsvpFastReroute to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpFastReroute to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpFastReroute to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpFastReroute struct { + obj *rsvpFastReroute +} + +type unMarshalRsvpFastReroute interface { + // FromProto unmarshals RsvpFastReroute from protobuf object *otg.RsvpFastReroute + FromProto(msg *otg.RsvpFastReroute) (RsvpFastReroute, error) + // FromPbText unmarshals RsvpFastReroute from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpFastReroute from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpFastReroute from JSON text + FromJson(value string) error +} + +func (obj *rsvpFastReroute) Marshal() marshalRsvpFastReroute { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpFastReroute{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpFastReroute) Unmarshal() unMarshalRsvpFastReroute { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpFastReroute{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpFastReroute) ToProto() (*otg.RsvpFastReroute, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpFastReroute) FromProto(msg *otg.RsvpFastReroute) (RsvpFastReroute, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpFastReroute) 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 *unMarshalrsvpFastReroute) 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 *marshalrsvpFastReroute) 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 *unMarshalrsvpFastReroute) 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 *marshalrsvpFastReroute) 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 *unMarshalrsvpFastReroute) 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 *rsvpFastReroute) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpFastReroute) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpFastReroute) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpFastReroute) Clone() (RsvpFastReroute, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpFastReroute() + 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 +} + +// RsvpFastReroute is configuration for the optional RSVP-TE FAST_REROUTE object included in Path Messages as defined in RFC4090. +type RsvpFastReroute interface { + Validation + // msg marshals RsvpFastReroute to protobuf object *otg.RsvpFastReroute + // and doesn't set defaults + msg() *otg.RsvpFastReroute + // setMsg unmarshals RsvpFastReroute from protobuf object *otg.RsvpFastReroute + // and doesn't set defaults + setMsg(*otg.RsvpFastReroute) RsvpFastReroute + // provides marshal interface + Marshal() marshalRsvpFastReroute + // provides unmarshal interface + Unmarshal() unMarshalRsvpFastReroute + // validate validates RsvpFastReroute + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpFastReroute, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // SetupPriority returns uint32, set in RsvpFastReroute. + SetupPriority() uint32 + // SetSetupPriority assigns uint32 provided by user to RsvpFastReroute + SetSetupPriority(value uint32) RsvpFastReroute + // HasSetupPriority checks if SetupPriority has been set in RsvpFastReroute + HasSetupPriority() bool + // HoldingPriority returns uint32, set in RsvpFastReroute. + HoldingPriority() uint32 + // SetHoldingPriority assigns uint32 provided by user to RsvpFastReroute + SetHoldingPriority(value uint32) RsvpFastReroute + // HasHoldingPriority checks if HoldingPriority has been set in RsvpFastReroute + HasHoldingPriority() bool + // HopLimit returns uint32, set in RsvpFastReroute. + HopLimit() uint32 + // SetHopLimit assigns uint32 provided by user to RsvpFastReroute + SetHopLimit(value uint32) RsvpFastReroute + // HasHopLimit checks if HopLimit has been set in RsvpFastReroute + HasHopLimit() bool + // Bandwidth returns float32, set in RsvpFastReroute. + Bandwidth() float32 + // SetBandwidth assigns float32 provided by user to RsvpFastReroute + SetBandwidth(value float32) RsvpFastReroute + // HasBandwidth checks if Bandwidth has been set in RsvpFastReroute + HasBandwidth() bool + // ExcludeAny returns string, set in RsvpFastReroute. + ExcludeAny() string + // SetExcludeAny assigns string provided by user to RsvpFastReroute + SetExcludeAny(value string) RsvpFastReroute + // HasExcludeAny checks if ExcludeAny has been set in RsvpFastReroute + HasExcludeAny() bool + // IncludeAny returns string, set in RsvpFastReroute. + IncludeAny() string + // SetIncludeAny assigns string provided by user to RsvpFastReroute + SetIncludeAny(value string) RsvpFastReroute + // HasIncludeAny checks if IncludeAny has been set in RsvpFastReroute + HasIncludeAny() bool + // IncludeAll returns string, set in RsvpFastReroute. + IncludeAll() string + // SetIncludeAll assigns string provided by user to RsvpFastReroute + SetIncludeAll(value string) RsvpFastReroute + // HasIncludeAll checks if IncludeAll has been set in RsvpFastReroute + HasIncludeAll() bool + // OneToOneBackupDesired returns bool, set in RsvpFastReroute. + OneToOneBackupDesired() bool + // SetOneToOneBackupDesired assigns bool provided by user to RsvpFastReroute + SetOneToOneBackupDesired(value bool) RsvpFastReroute + // HasOneToOneBackupDesired checks if OneToOneBackupDesired has been set in RsvpFastReroute + HasOneToOneBackupDesired() bool + // FacilityBackupDesired returns bool, set in RsvpFastReroute. + FacilityBackupDesired() bool + // SetFacilityBackupDesired assigns bool provided by user to RsvpFastReroute + SetFacilityBackupDesired(value bool) RsvpFastReroute + // HasFacilityBackupDesired checks if FacilityBackupDesired has been set in RsvpFastReroute + HasFacilityBackupDesired() bool +} + +// Specifies the value of the Setup Priority field. This controls whether the backup LSP should pre-empt existing LSP that is setup with certain Holding Priority. While setting up a backup LSP, preemption of existing LSP can happen if resource limitation is encountered (e.g bandwidth availability). +// SetupPriority returns a uint32 +func (obj *rsvpFastReroute) SetupPriority() uint32 { + + return *obj.obj.SetupPriority + +} + +// Specifies the value of the Setup Priority field. This controls whether the backup LSP should pre-empt existing LSP that is setup with certain Holding Priority. While setting up a backup LSP, preemption of existing LSP can happen if resource limitation is encountered (e.g bandwidth availability). +// SetupPriority returns a uint32 +func (obj *rsvpFastReroute) HasSetupPriority() bool { + return obj.obj.SetupPriority != nil +} + +// Specifies the value of the Setup Priority field. This controls whether the backup LSP should pre-empt existing LSP that is setup with certain Holding Priority. While setting up a backup LSP, preemption of existing LSP can happen if resource limitation is encountered (e.g bandwidth availability). +// SetSetupPriority sets the uint32 value in the RsvpFastReroute object +func (obj *rsvpFastReroute) SetSetupPriority(value uint32) RsvpFastReroute { + + obj.obj.SetupPriority = &value + return obj +} + +// Specifies the value of the Holding Priority field. This controls whether a new LSP being created with certain Setup Priority should pre-empt this LSP set up with this Holding Priority. While setting up a new LSP, preemption of existing LSP can happen if resource limitation is encountered (e.g bandwidth availability). +// HoldingPriority returns a uint32 +func (obj *rsvpFastReroute) HoldingPriority() uint32 { + + return *obj.obj.HoldingPriority + +} + +// Specifies the value of the Holding Priority field. This controls whether a new LSP being created with certain Setup Priority should pre-empt this LSP set up with this Holding Priority. While setting up a new LSP, preemption of existing LSP can happen if resource limitation is encountered (e.g bandwidth availability). +// HoldingPriority returns a uint32 +func (obj *rsvpFastReroute) HasHoldingPriority() bool { + return obj.obj.HoldingPriority != nil +} + +// Specifies the value of the Holding Priority field. This controls whether a new LSP being created with certain Setup Priority should pre-empt this LSP set up with this Holding Priority. While setting up a new LSP, preemption of existing LSP can happen if resource limitation is encountered (e.g bandwidth availability). +// SetHoldingPriority sets the uint32 value in the RsvpFastReroute object +func (obj *rsvpFastReroute) SetHoldingPriority(value uint32) RsvpFastReroute { + + obj.obj.HoldingPriority = &value + return obj +} + +// Specifies the value of the Hop Limit field. This controls the maximum number of hops the LSP should traverse to reach the LSP end-point. +// HopLimit returns a uint32 +func (obj *rsvpFastReroute) HopLimit() uint32 { + + return *obj.obj.HopLimit + +} + +// Specifies the value of the Hop Limit field. This controls the maximum number of hops the LSP should traverse to reach the LSP end-point. +// HopLimit returns a uint32 +func (obj *rsvpFastReroute) HasHopLimit() bool { + return obj.obj.HopLimit != nil +} + +// Specifies the value of the Hop Limit field. This controls the maximum number of hops the LSP should traverse to reach the LSP end-point. +// SetHopLimit sets the uint32 value in the RsvpFastReroute object +func (obj *rsvpFastReroute) SetHopLimit(value uint32) RsvpFastReroute { + + obj.obj.HopLimit = &value + return obj +} + +// Specifies the value of the Bandwidth field as a 32-bit IEEE floating point integer, in bytes per second, as desired for the LSP. +// Bandwidth returns a float32 +func (obj *rsvpFastReroute) Bandwidth() float32 { + + return *obj.obj.Bandwidth + +} + +// Specifies the value of the Bandwidth field as a 32-bit IEEE floating point integer, in bytes per second, as desired for the LSP. +// Bandwidth returns a float32 +func (obj *rsvpFastReroute) HasBandwidth() bool { + return obj.obj.Bandwidth != nil +} + +// Specifies the value of the Bandwidth field as a 32-bit IEEE floating point integer, in bytes per second, as desired for the LSP. +// SetBandwidth sets the float32 value in the RsvpFastReroute object +func (obj *rsvpFastReroute) SetBandwidth(value float32) RsvpFastReroute { + + obj.obj.Bandwidth = &value + return obj +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// ExcludeAny returns a string +func (obj *rsvpFastReroute) ExcludeAny() string { + + return *obj.obj.ExcludeAny + +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// ExcludeAny returns a string +func (obj *rsvpFastReroute) HasExcludeAny() bool { + return obj.obj.ExcludeAny != nil +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// SetExcludeAny sets the string value in the RsvpFastReroute object +func (obj *rsvpFastReroute) SetExcludeAny(value string) RsvpFastReroute { + + obj.obj.ExcludeAny = &value + return obj +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// IncludeAny returns a string +func (obj *rsvpFastReroute) IncludeAny() string { + + return *obj.obj.IncludeAny + +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// IncludeAny returns a string +func (obj *rsvpFastReroute) HasIncludeAny() bool { + return obj.obj.IncludeAny != nil +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// SetIncludeAny sets the string value in the RsvpFastReroute object +func (obj *rsvpFastReroute) SetIncludeAny(value string) RsvpFastReroute { + + obj.obj.IncludeAny = &value + return obj +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// IncludeAll returns a string +func (obj *rsvpFastReroute) IncludeAll() string { + + return *obj.obj.IncludeAll + +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// IncludeAll returns a string +func (obj *rsvpFastReroute) HasIncludeAll() bool { + return obj.obj.IncludeAll != nil +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// SetIncludeAll sets the string value in the RsvpFastReroute object +func (obj *rsvpFastReroute) SetIncludeAll(value string) RsvpFastReroute { + + obj.obj.IncludeAll = &value + return obj +} + +// Requests protection via the one-to-one backup method. +// OneToOneBackupDesired returns a bool +func (obj *rsvpFastReroute) OneToOneBackupDesired() bool { + + return *obj.obj.OneToOneBackupDesired + +} + +// Requests protection via the one-to-one backup method. +// OneToOneBackupDesired returns a bool +func (obj *rsvpFastReroute) HasOneToOneBackupDesired() bool { + return obj.obj.OneToOneBackupDesired != nil +} + +// Requests protection via the one-to-one backup method. +// SetOneToOneBackupDesired sets the bool value in the RsvpFastReroute object +func (obj *rsvpFastReroute) SetOneToOneBackupDesired(value bool) RsvpFastReroute { + + obj.obj.OneToOneBackupDesired = &value + return obj +} + +// Requests protection via the facility backup method. +// FacilityBackupDesired returns a bool +func (obj *rsvpFastReroute) FacilityBackupDesired() bool { + + return *obj.obj.FacilityBackupDesired + +} + +// Requests protection via the facility backup method. +// FacilityBackupDesired returns a bool +func (obj *rsvpFastReroute) HasFacilityBackupDesired() bool { + return obj.obj.FacilityBackupDesired != nil +} + +// Requests protection via the facility backup method. +// SetFacilityBackupDesired sets the bool value in the RsvpFastReroute object +func (obj *rsvpFastReroute) SetFacilityBackupDesired(value bool) RsvpFastReroute { + + obj.obj.FacilityBackupDesired = &value + return obj +} + +func (obj *rsvpFastReroute) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.SetupPriority != nil { + + if *obj.obj.SetupPriority > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpFastReroute.SetupPriority <= 7 but Got %d", *obj.obj.SetupPriority)) + } + + } + + if obj.obj.HoldingPriority != nil { + + if *obj.obj.HoldingPriority > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpFastReroute.HoldingPriority <= 7 but Got %d", *obj.obj.HoldingPriority)) + } + + } + + if obj.obj.HopLimit != nil { + + if *obj.obj.HopLimit > 255 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpFastReroute.HopLimit <= 255 but Got %d", *obj.obj.HopLimit)) + } + + } + + if obj.obj.ExcludeAny != nil { + + if len(*obj.obj.ExcludeAny) < 0 || len(*obj.obj.ExcludeAny) > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of RsvpFastReroute.ExcludeAny <= 8 but Got %d", + len(*obj.obj.ExcludeAny))) + } + + } + + if obj.obj.IncludeAny != nil { + + if len(*obj.obj.IncludeAny) < 0 || len(*obj.obj.IncludeAny) > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of RsvpFastReroute.IncludeAny <= 8 but Got %d", + len(*obj.obj.IncludeAny))) + } + + } + + if obj.obj.IncludeAll != nil { + + if len(*obj.obj.IncludeAll) < 0 || len(*obj.obj.IncludeAll) > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of RsvpFastReroute.IncludeAll <= 8 but Got %d", + len(*obj.obj.IncludeAll))) + } + + } + +} + +func (obj *rsvpFastReroute) setDefault() { + if obj.obj.SetupPriority == nil { + obj.SetSetupPriority(7) + } + if obj.obj.HoldingPriority == nil { + obj.SetHoldingPriority(7) + } + if obj.obj.HopLimit == nil { + obj.SetHopLimit(3) + } + if obj.obj.Bandwidth == nil { + obj.SetBandwidth(0) + } + if obj.obj.ExcludeAny == nil { + obj.SetExcludeAny("0") + } + if obj.obj.IncludeAny == nil { + obj.SetIncludeAny("0") + } + if obj.obj.IncludeAll == nil { + obj.SetIncludeAll("0") + } + if obj.obj.OneToOneBackupDesired == nil { + obj.SetOneToOneBackupDesired(false) + } + if obj.obj.FacilityBackupDesired == nil { + obj.SetFacilityBackupDesired(false) + } + +} diff --git a/gosnappi/rsvp_i_pv4_lsp_state.go b/gosnappi/rsvp_i_pv4_lsp_state.go new file mode 100644 index 00000000..a5d22194 --- /dev/null +++ b/gosnappi/rsvp_i_pv4_lsp_state.go @@ -0,0 +1,612 @@ +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" +) + +// ***** RsvpIPv4LspState ***** +type rsvpIPv4LspState struct { + validation + obj *otg.RsvpIPv4LspState + marshaller marshalRsvpIPv4LspState + unMarshaller unMarshalRsvpIPv4LspState + lspHolder RsvpLspState + rrosHolder RsvpIPv4LspStateRsvpLspIpv4RroIter + erosHolder RsvpIPv4LspStateRsvpLspIpv4EroIter +} + +func NewRsvpIPv4LspState() RsvpIPv4LspState { + obj := rsvpIPv4LspState{obj: &otg.RsvpIPv4LspState{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpIPv4LspState) msg() *otg.RsvpIPv4LspState { + return obj.obj +} + +func (obj *rsvpIPv4LspState) setMsg(msg *otg.RsvpIPv4LspState) RsvpIPv4LspState { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpIPv4LspState struct { + obj *rsvpIPv4LspState +} + +type marshalRsvpIPv4LspState interface { + // ToProto marshals RsvpIPv4LspState to protobuf object *otg.RsvpIPv4LspState + ToProto() (*otg.RsvpIPv4LspState, error) + // ToPbText marshals RsvpIPv4LspState to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpIPv4LspState to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpIPv4LspState to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpIPv4LspState struct { + obj *rsvpIPv4LspState +} + +type unMarshalRsvpIPv4LspState interface { + // FromProto unmarshals RsvpIPv4LspState from protobuf object *otg.RsvpIPv4LspState + FromProto(msg *otg.RsvpIPv4LspState) (RsvpIPv4LspState, error) + // FromPbText unmarshals RsvpIPv4LspState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpIPv4LspState from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpIPv4LspState from JSON text + FromJson(value string) error +} + +func (obj *rsvpIPv4LspState) Marshal() marshalRsvpIPv4LspState { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpIPv4LspState{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpIPv4LspState) Unmarshal() unMarshalRsvpIPv4LspState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpIPv4LspState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpIPv4LspState) ToProto() (*otg.RsvpIPv4LspState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpIPv4LspState) FromProto(msg *otg.RsvpIPv4LspState) (RsvpIPv4LspState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpIPv4LspState) 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 *unMarshalrsvpIPv4LspState) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalrsvpIPv4LspState) 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 *unMarshalrsvpIPv4LspState) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalrsvpIPv4LspState) 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 *unMarshalrsvpIPv4LspState) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *rsvpIPv4LspState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpIPv4LspState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpIPv4LspState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpIPv4LspState) Clone() (RsvpIPv4LspState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpIPv4LspState() + 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 +} + +func (obj *rsvpIPv4LspState) setNil() { + obj.lspHolder = nil + obj.rrosHolder = nil + obj.erosHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// RsvpIPv4LspState is iPv4 RSVP-TE Discovered LSPs. +type RsvpIPv4LspState interface { + Validation + // msg marshals RsvpIPv4LspState to protobuf object *otg.RsvpIPv4LspState + // and doesn't set defaults + msg() *otg.RsvpIPv4LspState + // setMsg unmarshals RsvpIPv4LspState from protobuf object *otg.RsvpIPv4LspState + // and doesn't set defaults + setMsg(*otg.RsvpIPv4LspState) RsvpIPv4LspState + // provides marshal interface + Marshal() marshalRsvpIPv4LspState + // provides unmarshal interface + Unmarshal() unMarshalRsvpIPv4LspState + // validate validates RsvpIPv4LspState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpIPv4LspState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // SourceAddress returns string, set in RsvpIPv4LspState. + SourceAddress() string + // SetSourceAddress assigns string provided by user to RsvpIPv4LspState + SetSourceAddress(value string) RsvpIPv4LspState + // HasSourceAddress checks if SourceAddress has been set in RsvpIPv4LspState + HasSourceAddress() bool + // DestinationAddress returns string, set in RsvpIPv4LspState. + DestinationAddress() string + // SetDestinationAddress assigns string provided by user to RsvpIPv4LspState + SetDestinationAddress(value string) RsvpIPv4LspState + // HasDestinationAddress checks if DestinationAddress has been set in RsvpIPv4LspState + HasDestinationAddress() bool + // Lsp returns RsvpLspState, set in RsvpIPv4LspState. + // RsvpLspState is iPv4 RSVP-TE Discovered LSPs. + Lsp() RsvpLspState + // SetLsp assigns RsvpLspState provided by user to RsvpIPv4LspState. + // RsvpLspState is iPv4 RSVP-TE Discovered LSPs. + SetLsp(value RsvpLspState) RsvpIPv4LspState + // HasLsp checks if Lsp has been set in RsvpIPv4LspState + HasLsp() bool + // Rros returns RsvpIPv4LspStateRsvpLspIpv4RroIterIter, set in RsvpIPv4LspState + Rros() RsvpIPv4LspStateRsvpLspIpv4RroIter + // Eros returns RsvpIPv4LspStateRsvpLspIpv4EroIterIter, set in RsvpIPv4LspState + Eros() RsvpIPv4LspStateRsvpLspIpv4EroIter + setNil() +} + +// The origin IPv4 address of RSVP session. +// SourceAddress returns a string +func (obj *rsvpIPv4LspState) SourceAddress() string { + + return *obj.obj.SourceAddress + +} + +// The origin IPv4 address of RSVP session. +// SourceAddress returns a string +func (obj *rsvpIPv4LspState) HasSourceAddress() bool { + return obj.obj.SourceAddress != nil +} + +// The origin IPv4 address of RSVP session. +// SetSourceAddress sets the string value in the RsvpIPv4LspState object +func (obj *rsvpIPv4LspState) SetSourceAddress(value string) RsvpIPv4LspState { + + obj.obj.SourceAddress = &value + return obj +} + +// The IPv4 destination address of RSVP session. +// DestinationAddress returns a string +func (obj *rsvpIPv4LspState) DestinationAddress() string { + + return *obj.obj.DestinationAddress + +} + +// The IPv4 destination address of RSVP session. +// DestinationAddress returns a string +func (obj *rsvpIPv4LspState) HasDestinationAddress() bool { + return obj.obj.DestinationAddress != nil +} + +// The IPv4 destination address of RSVP session. +// SetDestinationAddress sets the string value in the RsvpIPv4LspState object +func (obj *rsvpIPv4LspState) SetDestinationAddress(value string) RsvpIPv4LspState { + + obj.obj.DestinationAddress = &value + return obj +} + +// It refers to the RSVP LSP properties. +// Lsp returns a RsvpLspState +func (obj *rsvpIPv4LspState) Lsp() RsvpLspState { + if obj.obj.Lsp == nil { + obj.obj.Lsp = NewRsvpLspState().msg() + } + if obj.lspHolder == nil { + obj.lspHolder = &rsvpLspState{obj: obj.obj.Lsp} + } + return obj.lspHolder +} + +// It refers to the RSVP LSP properties. +// Lsp returns a RsvpLspState +func (obj *rsvpIPv4LspState) HasLsp() bool { + return obj.obj.Lsp != nil +} + +// It refers to the RSVP LSP properties. +// SetLsp sets the RsvpLspState value in the RsvpIPv4LspState object +func (obj *rsvpIPv4LspState) SetLsp(value RsvpLspState) RsvpIPv4LspState { + + obj.lspHolder = nil + obj.obj.Lsp = value.msg() + + return obj +} + +// It refers to RSVP RRO objects container. +// Rros returns a []RsvpLspIpv4Rro +func (obj *rsvpIPv4LspState) Rros() RsvpIPv4LspStateRsvpLspIpv4RroIter { + if len(obj.obj.Rros) == 0 { + obj.obj.Rros = []*otg.RsvpLspIpv4Rro{} + } + if obj.rrosHolder == nil { + obj.rrosHolder = newRsvpIPv4LspStateRsvpLspIpv4RroIter(&obj.obj.Rros).setMsg(obj) + } + return obj.rrosHolder +} + +type rsvpIPv4LspStateRsvpLspIpv4RroIter struct { + obj *rsvpIPv4LspState + rsvpLspIpv4RroSlice []RsvpLspIpv4Rro + fieldPtr *[]*otg.RsvpLspIpv4Rro +} + +func newRsvpIPv4LspStateRsvpLspIpv4RroIter(ptr *[]*otg.RsvpLspIpv4Rro) RsvpIPv4LspStateRsvpLspIpv4RroIter { + return &rsvpIPv4LspStateRsvpLspIpv4RroIter{fieldPtr: ptr} +} + +type RsvpIPv4LspStateRsvpLspIpv4RroIter interface { + setMsg(*rsvpIPv4LspState) RsvpIPv4LspStateRsvpLspIpv4RroIter + Items() []RsvpLspIpv4Rro + Add() RsvpLspIpv4Rro + Append(items ...RsvpLspIpv4Rro) RsvpIPv4LspStateRsvpLspIpv4RroIter + Set(index int, newObj RsvpLspIpv4Rro) RsvpIPv4LspStateRsvpLspIpv4RroIter + Clear() RsvpIPv4LspStateRsvpLspIpv4RroIter + clearHolderSlice() RsvpIPv4LspStateRsvpLspIpv4RroIter + appendHolderSlice(item RsvpLspIpv4Rro) RsvpIPv4LspStateRsvpLspIpv4RroIter +} + +func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) setMsg(msg *rsvpIPv4LspState) RsvpIPv4LspStateRsvpLspIpv4RroIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&rsvpLspIpv4Rro{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) Items() []RsvpLspIpv4Rro { + return obj.rsvpLspIpv4RroSlice +} + +func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) Add() RsvpLspIpv4Rro { + newObj := &otg.RsvpLspIpv4Rro{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &rsvpLspIpv4Rro{obj: newObj} + newLibObj.setDefault() + obj.rsvpLspIpv4RroSlice = append(obj.rsvpLspIpv4RroSlice, newLibObj) + return newLibObj +} + +func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) Append(items ...RsvpLspIpv4Rro) RsvpIPv4LspStateRsvpLspIpv4RroIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.rsvpLspIpv4RroSlice = append(obj.rsvpLspIpv4RroSlice, item) + } + return obj +} + +func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) Set(index int, newObj RsvpLspIpv4Rro) RsvpIPv4LspStateRsvpLspIpv4RroIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.rsvpLspIpv4RroSlice[index] = newObj + return obj +} +func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) Clear() RsvpIPv4LspStateRsvpLspIpv4RroIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.RsvpLspIpv4Rro{} + obj.rsvpLspIpv4RroSlice = []RsvpLspIpv4Rro{} + } + return obj +} +func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) clearHolderSlice() RsvpIPv4LspStateRsvpLspIpv4RroIter { + if len(obj.rsvpLspIpv4RroSlice) > 0 { + obj.rsvpLspIpv4RroSlice = []RsvpLspIpv4Rro{} + } + return obj +} +func (obj *rsvpIPv4LspStateRsvpLspIpv4RroIter) appendHolderSlice(item RsvpLspIpv4Rro) RsvpIPv4LspStateRsvpLspIpv4RroIter { + obj.rsvpLspIpv4RroSlice = append(obj.rsvpLspIpv4RroSlice, item) + return obj +} + +// It refers to RSVP ERO objects container. +// Eros returns a []RsvpLspIpv4Ero +func (obj *rsvpIPv4LspState) Eros() RsvpIPv4LspStateRsvpLspIpv4EroIter { + if len(obj.obj.Eros) == 0 { + obj.obj.Eros = []*otg.RsvpLspIpv4Ero{} + } + if obj.erosHolder == nil { + obj.erosHolder = newRsvpIPv4LspStateRsvpLspIpv4EroIter(&obj.obj.Eros).setMsg(obj) + } + return obj.erosHolder +} + +type rsvpIPv4LspStateRsvpLspIpv4EroIter struct { + obj *rsvpIPv4LspState + rsvpLspIpv4EroSlice []RsvpLspIpv4Ero + fieldPtr *[]*otg.RsvpLspIpv4Ero +} + +func newRsvpIPv4LspStateRsvpLspIpv4EroIter(ptr *[]*otg.RsvpLspIpv4Ero) RsvpIPv4LspStateRsvpLspIpv4EroIter { + return &rsvpIPv4LspStateRsvpLspIpv4EroIter{fieldPtr: ptr} +} + +type RsvpIPv4LspStateRsvpLspIpv4EroIter interface { + setMsg(*rsvpIPv4LspState) RsvpIPv4LspStateRsvpLspIpv4EroIter + Items() []RsvpLspIpv4Ero + Add() RsvpLspIpv4Ero + Append(items ...RsvpLspIpv4Ero) RsvpIPv4LspStateRsvpLspIpv4EroIter + Set(index int, newObj RsvpLspIpv4Ero) RsvpIPv4LspStateRsvpLspIpv4EroIter + Clear() RsvpIPv4LspStateRsvpLspIpv4EroIter + clearHolderSlice() RsvpIPv4LspStateRsvpLspIpv4EroIter + appendHolderSlice(item RsvpLspIpv4Ero) RsvpIPv4LspStateRsvpLspIpv4EroIter +} + +func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) setMsg(msg *rsvpIPv4LspState) RsvpIPv4LspStateRsvpLspIpv4EroIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&rsvpLspIpv4Ero{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) Items() []RsvpLspIpv4Ero { + return obj.rsvpLspIpv4EroSlice +} + +func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) Add() RsvpLspIpv4Ero { + newObj := &otg.RsvpLspIpv4Ero{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &rsvpLspIpv4Ero{obj: newObj} + newLibObj.setDefault() + obj.rsvpLspIpv4EroSlice = append(obj.rsvpLspIpv4EroSlice, newLibObj) + return newLibObj +} + +func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) Append(items ...RsvpLspIpv4Ero) RsvpIPv4LspStateRsvpLspIpv4EroIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.rsvpLspIpv4EroSlice = append(obj.rsvpLspIpv4EroSlice, item) + } + return obj +} + +func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) Set(index int, newObj RsvpLspIpv4Ero) RsvpIPv4LspStateRsvpLspIpv4EroIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.rsvpLspIpv4EroSlice[index] = newObj + return obj +} +func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) Clear() RsvpIPv4LspStateRsvpLspIpv4EroIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.RsvpLspIpv4Ero{} + obj.rsvpLspIpv4EroSlice = []RsvpLspIpv4Ero{} + } + return obj +} +func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) clearHolderSlice() RsvpIPv4LspStateRsvpLspIpv4EroIter { + if len(obj.rsvpLspIpv4EroSlice) > 0 { + obj.rsvpLspIpv4EroSlice = []RsvpLspIpv4Ero{} + } + return obj +} +func (obj *rsvpIPv4LspStateRsvpLspIpv4EroIter) appendHolderSlice(item RsvpLspIpv4Ero) RsvpIPv4LspStateRsvpLspIpv4EroIter { + obj.rsvpLspIpv4EroSlice = append(obj.rsvpLspIpv4EroSlice, item) + return obj +} + +func (obj *rsvpIPv4LspState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.SourceAddress != nil { + + err := obj.validateIpv4(obj.SourceAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on RsvpIPv4LspState.SourceAddress")) + } + + } + + if obj.obj.DestinationAddress != nil { + + err := obj.validateIpv4(obj.DestinationAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on RsvpIPv4LspState.DestinationAddress")) + } + + } + + if obj.obj.Lsp != nil { + + obj.Lsp().validateObj(vObj, set_default) + } + + if len(obj.obj.Rros) != 0 { + + if set_default { + obj.Rros().clearHolderSlice() + for _, item := range obj.obj.Rros { + obj.Rros().appendHolderSlice(&rsvpLspIpv4Rro{obj: item}) + } + } + for _, item := range obj.Rros().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Eros) != 0 { + + if set_default { + obj.Eros().clearHolderSlice() + for _, item := range obj.obj.Eros { + obj.Eros().appendHolderSlice(&rsvpLspIpv4Ero{obj: item}) + } + } + for _, item := range obj.Eros().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *rsvpIPv4LspState) setDefault() { + +} diff --git a/gosnappi/rsvp_ipv4_interface.go b/gosnappi/rsvp_ipv4_interface.go new file mode 100644 index 00000000..1f8ccd8d --- /dev/null +++ b/gosnappi/rsvp_ipv4_interface.go @@ -0,0 +1,689 @@ +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" +) + +// ***** RsvpIpv4Interface ***** +type rsvpIpv4Interface struct { + validation + obj *otg.RsvpIpv4Interface + marshaller marshalRsvpIpv4Interface + unMarshaller unMarshalRsvpIpv4Interface +} + +func NewRsvpIpv4Interface() RsvpIpv4Interface { + obj := rsvpIpv4Interface{obj: &otg.RsvpIpv4Interface{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpIpv4Interface) msg() *otg.RsvpIpv4Interface { + return obj.obj +} + +func (obj *rsvpIpv4Interface) setMsg(msg *otg.RsvpIpv4Interface) RsvpIpv4Interface { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpIpv4Interface struct { + obj *rsvpIpv4Interface +} + +type marshalRsvpIpv4Interface interface { + // ToProto marshals RsvpIpv4Interface to protobuf object *otg.RsvpIpv4Interface + ToProto() (*otg.RsvpIpv4Interface, error) + // ToPbText marshals RsvpIpv4Interface to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpIpv4Interface to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpIpv4Interface to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpIpv4Interface struct { + obj *rsvpIpv4Interface +} + +type unMarshalRsvpIpv4Interface interface { + // FromProto unmarshals RsvpIpv4Interface from protobuf object *otg.RsvpIpv4Interface + FromProto(msg *otg.RsvpIpv4Interface) (RsvpIpv4Interface, error) + // FromPbText unmarshals RsvpIpv4Interface from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpIpv4Interface from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpIpv4Interface from JSON text + FromJson(value string) error +} + +func (obj *rsvpIpv4Interface) Marshal() marshalRsvpIpv4Interface { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpIpv4Interface{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpIpv4Interface) Unmarshal() unMarshalRsvpIpv4Interface { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpIpv4Interface{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpIpv4Interface) ToProto() (*otg.RsvpIpv4Interface, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpIpv4Interface) FromProto(msg *otg.RsvpIpv4Interface) (RsvpIpv4Interface, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpIpv4Interface) 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 *unMarshalrsvpIpv4Interface) 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 *marshalrsvpIpv4Interface) 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 *unMarshalrsvpIpv4Interface) 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 *marshalrsvpIpv4Interface) 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 *unMarshalrsvpIpv4Interface) 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 *rsvpIpv4Interface) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpIpv4Interface) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpIpv4Interface) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpIpv4Interface) Clone() (RsvpIpv4Interface, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpIpv4Interface() + 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 +} + +// RsvpIpv4Interface is configuration for RSVP Interface. +type RsvpIpv4Interface interface { + Validation + // msg marshals RsvpIpv4Interface to protobuf object *otg.RsvpIpv4Interface + // and doesn't set defaults + msg() *otg.RsvpIpv4Interface + // setMsg unmarshals RsvpIpv4Interface from protobuf object *otg.RsvpIpv4Interface + // and doesn't set defaults + setMsg(*otg.RsvpIpv4Interface) RsvpIpv4Interface + // provides marshal interface + Marshal() marshalRsvpIpv4Interface + // provides unmarshal interface + Unmarshal() unMarshalRsvpIpv4Interface + // validate validates RsvpIpv4Interface + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpIpv4Interface, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv4Name returns string, set in RsvpIpv4Interface. + Ipv4Name() string + // SetIpv4Name assigns string provided by user to RsvpIpv4Interface + SetIpv4Name(value string) RsvpIpv4Interface + // NeighborIp returns string, set in RsvpIpv4Interface. + NeighborIp() string + // SetNeighborIp assigns string provided by user to RsvpIpv4Interface + SetNeighborIp(value string) RsvpIpv4Interface + // LabelSpaceStart returns uint32, set in RsvpIpv4Interface. + LabelSpaceStart() uint32 + // SetLabelSpaceStart assigns uint32 provided by user to RsvpIpv4Interface + SetLabelSpaceStart(value uint32) RsvpIpv4Interface + // HasLabelSpaceStart checks if LabelSpaceStart has been set in RsvpIpv4Interface + HasLabelSpaceStart() bool + // LabelSpaceEnd returns uint32, set in RsvpIpv4Interface. + LabelSpaceEnd() uint32 + // SetLabelSpaceEnd assigns uint32 provided by user to RsvpIpv4Interface + SetLabelSpaceEnd(value uint32) RsvpIpv4Interface + // HasLabelSpaceEnd checks if LabelSpaceEnd has been set in RsvpIpv4Interface + HasLabelSpaceEnd() bool + // EnableRefreshReduction returns bool, set in RsvpIpv4Interface. + EnableRefreshReduction() bool + // SetEnableRefreshReduction assigns bool provided by user to RsvpIpv4Interface + SetEnableRefreshReduction(value bool) RsvpIpv4Interface + // HasEnableRefreshReduction checks if EnableRefreshReduction has been set in RsvpIpv4Interface + HasEnableRefreshReduction() bool + // SummaryRefreshInterval returns uint32, set in RsvpIpv4Interface. + SummaryRefreshInterval() uint32 + // SetSummaryRefreshInterval assigns uint32 provided by user to RsvpIpv4Interface + SetSummaryRefreshInterval(value uint32) RsvpIpv4Interface + // HasSummaryRefreshInterval checks if SummaryRefreshInterval has been set in RsvpIpv4Interface + HasSummaryRefreshInterval() bool + // SendBundle returns bool, set in RsvpIpv4Interface. + SendBundle() bool + // SetSendBundle assigns bool provided by user to RsvpIpv4Interface + SetSendBundle(value bool) RsvpIpv4Interface + // HasSendBundle checks if SendBundle has been set in RsvpIpv4Interface + HasSendBundle() bool + // BundleThreshold returns uint32, set in RsvpIpv4Interface. + BundleThreshold() uint32 + // SetBundleThreshold assigns uint32 provided by user to RsvpIpv4Interface + SetBundleThreshold(value uint32) RsvpIpv4Interface + // HasBundleThreshold checks if BundleThreshold has been set in RsvpIpv4Interface + HasBundleThreshold() bool + // EnableHello returns bool, set in RsvpIpv4Interface. + EnableHello() bool + // SetEnableHello assigns bool provided by user to RsvpIpv4Interface + SetEnableHello(value bool) RsvpIpv4Interface + // HasEnableHello checks if EnableHello has been set in RsvpIpv4Interface + HasEnableHello() bool + // HelloInterval returns uint32, set in RsvpIpv4Interface. + HelloInterval() uint32 + // SetHelloInterval assigns uint32 provided by user to RsvpIpv4Interface + SetHelloInterval(value uint32) RsvpIpv4Interface + // HasHelloInterval checks if HelloInterval has been set in RsvpIpv4Interface + HasHelloInterval() bool + // TimeoutMultiplier returns uint32, set in RsvpIpv4Interface. + TimeoutMultiplier() uint32 + // SetTimeoutMultiplier assigns uint32 provided by user to RsvpIpv4Interface + SetTimeoutMultiplier(value uint32) RsvpIpv4Interface + // HasTimeoutMultiplier checks if TimeoutMultiplier has been set in RsvpIpv4Interface + HasTimeoutMultiplier() bool +} + +// The globally unique name of the IPv4 interface connected to the DUT. This name must match the "name" field of the "ipv4_addresses" on top which this RSVP interface is configured. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// Ipv4Name returns a string +func (obj *rsvpIpv4Interface) Ipv4Name() string { + + return *obj.obj.Ipv4Name + +} + +// The globally unique name of the IPv4 interface connected to the DUT. This name must match the "name" field of the "ipv4_addresses" on top which this RSVP interface is configured. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// +// SetIpv4Name sets the string value in the RsvpIpv4Interface object +func (obj *rsvpIpv4Interface) SetIpv4Name(value string) RsvpIpv4Interface { + + obj.obj.Ipv4Name = &value + return obj +} + +// IPv4 address of the RSVP neighbor on this interface. +// NeighborIp returns a string +func (obj *rsvpIpv4Interface) NeighborIp() string { + + return *obj.obj.NeighborIp + +} + +// IPv4 address of the RSVP neighbor on this interface. +// SetNeighborIp sets the string value in the RsvpIpv4Interface object +func (obj *rsvpIpv4Interface) SetNeighborIp(value string) RsvpIpv4Interface { + + obj.obj.NeighborIp = &value + return obj +} + +// The user-defined label space start value. The LSPs for which this router acts as a egress are assigned labels from this label pool.The"label_space_start" and "label_space_end" together defines this label-pool. +// LabelSpaceStart returns a uint32 +func (obj *rsvpIpv4Interface) LabelSpaceStart() uint32 { + + return *obj.obj.LabelSpaceStart + +} + +// The user-defined label space start value. The LSPs for which this router acts as a egress are assigned labels from this label pool.The"label_space_start" and "label_space_end" together defines this label-pool. +// LabelSpaceStart returns a uint32 +func (obj *rsvpIpv4Interface) HasLabelSpaceStart() bool { + return obj.obj.LabelSpaceStart != nil +} + +// The user-defined label space start value. The LSPs for which this router acts as a egress are assigned labels from this label pool.The"label_space_start" and "label_space_end" together defines this label-pool. +// SetLabelSpaceStart sets the uint32 value in the RsvpIpv4Interface object +func (obj *rsvpIpv4Interface) SetLabelSpaceStart(value uint32) RsvpIpv4Interface { + + obj.obj.LabelSpaceStart = &value + return obj +} + +// The user-defined label space end value.The last label value that can be assigned to the LSPs for which this router acts as egress. +// LabelSpaceEnd returns a uint32 +func (obj *rsvpIpv4Interface) LabelSpaceEnd() uint32 { + + return *obj.obj.LabelSpaceEnd + +} + +// The user-defined label space end value.The last label value that can be assigned to the LSPs for which this router acts as egress. +// LabelSpaceEnd returns a uint32 +func (obj *rsvpIpv4Interface) HasLabelSpaceEnd() bool { + return obj.obj.LabelSpaceEnd != nil +} + +// The user-defined label space end value.The last label value that can be assigned to the LSPs for which this router acts as egress. +// SetLabelSpaceEnd sets the uint32 value in the RsvpIpv4Interface object +func (obj *rsvpIpv4Interface) SetLabelSpaceEnd(value uint32) RsvpIpv4Interface { + + obj.obj.LabelSpaceEnd = &value + return obj +} + +// Enables sending of Refresh Reduction as described in RFC2961. +// EnableRefreshReduction returns a bool +func (obj *rsvpIpv4Interface) EnableRefreshReduction() bool { + + return *obj.obj.EnableRefreshReduction + +} + +// Enables sending of Refresh Reduction as described in RFC2961. +// EnableRefreshReduction returns a bool +func (obj *rsvpIpv4Interface) HasEnableRefreshReduction() bool { + return obj.obj.EnableRefreshReduction != nil +} + +// Enables sending of Refresh Reduction as described in RFC2961. +// SetEnableRefreshReduction sets the bool value in the RsvpIpv4Interface object +func (obj *rsvpIpv4Interface) SetEnableRefreshReduction(value bool) RsvpIpv4Interface { + + obj.obj.EnableRefreshReduction = &value + return obj +} + +// The number of seconds between transmissions of successive Summary Refreshes. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. +// SummaryRefreshInterval returns a uint32 +func (obj *rsvpIpv4Interface) SummaryRefreshInterval() uint32 { + + return *obj.obj.SummaryRefreshInterval + +} + +// The number of seconds between transmissions of successive Summary Refreshes. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. +// SummaryRefreshInterval returns a uint32 +func (obj *rsvpIpv4Interface) HasSummaryRefreshInterval() bool { + return obj.obj.SummaryRefreshInterval != nil +} + +// The number of seconds between transmissions of successive Summary Refreshes. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. +// SetSummaryRefreshInterval sets the uint32 value in the RsvpIpv4Interface object +func (obj *rsvpIpv4Interface) SetSummaryRefreshInterval(value uint32) RsvpIpv4Interface { + + obj.obj.SummaryRefreshInterval = &value + return obj +} + +// Enables aggregration of different RSVP messages within a single PDU. +// SendBundle returns a bool +func (obj *rsvpIpv4Interface) SendBundle() bool { + + return *obj.obj.SendBundle + +} + +// Enables aggregration of different RSVP messages within a single PDU. +// SendBundle returns a bool +func (obj *rsvpIpv4Interface) HasSendBundle() bool { + return obj.obj.SendBundle != nil +} + +// Enables aggregration of different RSVP messages within a single PDU. +// SetSendBundle sets the bool value in the RsvpIpv4Interface object +func (obj *rsvpIpv4Interface) SetSendBundle(value bool) RsvpIpv4Interface { + + obj.obj.SendBundle = &value + return obj +} + +// The number of milliseconds to wait after which RSVP will bundle different RSVP messages and transmit Bundle messages. +// BundleThreshold returns a uint32 +func (obj *rsvpIpv4Interface) BundleThreshold() uint32 { + + return *obj.obj.BundleThreshold + +} + +// The number of milliseconds to wait after which RSVP will bundle different RSVP messages and transmit Bundle messages. +// BundleThreshold returns a uint32 +func (obj *rsvpIpv4Interface) HasBundleThreshold() bool { + return obj.obj.BundleThreshold != nil +} + +// The number of milliseconds to wait after which RSVP will bundle different RSVP messages and transmit Bundle messages. +// SetBundleThreshold sets the uint32 value in the RsvpIpv4Interface object +func (obj *rsvpIpv4Interface) SetBundleThreshold(value uint32) RsvpIpv4Interface { + + obj.obj.BundleThreshold = &value + return obj +} + +// Enables sending of Hello Messages as per RFC3209. +// EnableHello returns a bool +func (obj *rsvpIpv4Interface) EnableHello() bool { + + return *obj.obj.EnableHello + +} + +// Enables sending of Hello Messages as per RFC3209. +// EnableHello returns a bool +func (obj *rsvpIpv4Interface) HasEnableHello() bool { + return obj.obj.EnableHello != nil +} + +// Enables sending of Hello Messages as per RFC3209. +// SetEnableHello sets the bool value in the RsvpIpv4Interface object +func (obj *rsvpIpv4Interface) SetEnableHello(value bool) RsvpIpv4Interface { + + obj.obj.EnableHello = &value + return obj +} + +// If enable_hello is set to 'true', this specifies the minimum hello interval in seconds at which successive Hello Messages are sent as per RFC3209. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. +// HelloInterval returns a uint32 +func (obj *rsvpIpv4Interface) HelloInterval() uint32 { + + return *obj.obj.HelloInterval + +} + +// If enable_hello is set to 'true', this specifies the minimum hello interval in seconds at which successive Hello Messages are sent as per RFC3209. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. +// HelloInterval returns a uint32 +func (obj *rsvpIpv4Interface) HasHelloInterval() bool { + return obj.obj.HelloInterval != nil +} + +// If enable_hello is set to 'true', this specifies the minimum hello interval in seconds at which successive Hello Messages are sent as per RFC3209. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. +// SetHelloInterval sets the uint32 value in the RsvpIpv4Interface object +func (obj *rsvpIpv4Interface) SetHelloInterval(value uint32) RsvpIpv4Interface { + + obj.obj.HelloInterval = &value + return obj +} + +// The number of missed hellos after which the node should consider RSVP Neighbor to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. +// TimeoutMultiplier returns a uint32 +func (obj *rsvpIpv4Interface) TimeoutMultiplier() uint32 { + + return *obj.obj.TimeoutMultiplier + +} + +// The number of missed hellos after which the node should consider RSVP Neighbor to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. +// TimeoutMultiplier returns a uint32 +func (obj *rsvpIpv4Interface) HasTimeoutMultiplier() bool { + return obj.obj.TimeoutMultiplier != nil +} + +// The number of missed hellos after which the node should consider RSVP Neighbor to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. +// SetTimeoutMultiplier sets the uint32 value in the RsvpIpv4Interface object +func (obj *rsvpIpv4Interface) SetTimeoutMultiplier(value uint32) RsvpIpv4Interface { + + obj.obj.TimeoutMultiplier = &value + return obj +} + +func (obj *rsvpIpv4Interface) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Ipv4Name is required + if obj.obj.Ipv4Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Ipv4Name is required field on interface RsvpIpv4Interface") + } + + // NeighborIp is required + if obj.obj.NeighborIp == nil { + vObj.validationErrors = append(vObj.validationErrors, "NeighborIp is required field on interface RsvpIpv4Interface") + } + if obj.obj.NeighborIp != nil { + + err := obj.validateIpv4(obj.NeighborIp()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on RsvpIpv4Interface.NeighborIp")) + } + + } + + if obj.obj.LabelSpaceStart != nil { + + if *obj.obj.LabelSpaceStart > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpIpv4Interface.LabelSpaceStart <= 1048575 but Got %d", *obj.obj.LabelSpaceStart)) + } + + } + + if obj.obj.LabelSpaceEnd != nil { + + if *obj.obj.LabelSpaceEnd > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpIpv4Interface.LabelSpaceEnd <= 1048575 but Got %d", *obj.obj.LabelSpaceEnd)) + } + + } + + if obj.obj.SummaryRefreshInterval != nil { + + if *obj.obj.SummaryRefreshInterval > 3600 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpIpv4Interface.SummaryRefreshInterval <= 3600 but Got %d", *obj.obj.SummaryRefreshInterval)) + } + + } + + if obj.obj.BundleThreshold != nil { + + if *obj.obj.BundleThreshold > 1000 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpIpv4Interface.BundleThreshold <= 1000 but Got %d", *obj.obj.BundleThreshold)) + } + + } + + if obj.obj.HelloInterval != nil { + + if *obj.obj.HelloInterval > 3600 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpIpv4Interface.HelloInterval <= 3600 but Got %d", *obj.obj.HelloInterval)) + } + + } + + if obj.obj.TimeoutMultiplier != nil { + + if *obj.obj.TimeoutMultiplier > 10 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpIpv4Interface.TimeoutMultiplier <= 10 but Got %d", *obj.obj.TimeoutMultiplier)) + } + + } + +} + +func (obj *rsvpIpv4Interface) setDefault() { + if obj.obj.LabelSpaceStart == nil { + obj.SetLabelSpaceStart(1000) + } + if obj.obj.LabelSpaceEnd == nil { + obj.SetLabelSpaceEnd(100000) + } + if obj.obj.EnableRefreshReduction == nil { + obj.SetEnableRefreshReduction(false) + } + if obj.obj.SummaryRefreshInterval == nil { + obj.SetSummaryRefreshInterval(30) + } + if obj.obj.SendBundle == nil { + obj.SetSendBundle(false) + } + if obj.obj.BundleThreshold == nil { + obj.SetBundleThreshold(50) + } + if obj.obj.EnableHello == nil { + obj.SetEnableHello(false) + } + if obj.obj.HelloInterval == nil { + obj.SetHelloInterval(9) + } + if obj.obj.TimeoutMultiplier == nil { + obj.SetTimeoutMultiplier(3) + } + +} diff --git a/gosnappi/rsvp_lsp_ipv4_ero.go b/gosnappi/rsvp_lsp_ipv4_ero.go new file mode 100644 index 00000000..9ffeaff0 --- /dev/null +++ b/gosnappi/rsvp_lsp_ipv4_ero.go @@ -0,0 +1,391 @@ +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" +) + +// ***** RsvpLspIpv4Ero ***** +type rsvpLspIpv4Ero struct { + validation + obj *otg.RsvpLspIpv4Ero + marshaller marshalRsvpLspIpv4Ero + unMarshaller unMarshalRsvpLspIpv4Ero +} + +func NewRsvpLspIpv4Ero() RsvpLspIpv4Ero { + obj := rsvpLspIpv4Ero{obj: &otg.RsvpLspIpv4Ero{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpLspIpv4Ero) msg() *otg.RsvpLspIpv4Ero { + return obj.obj +} + +func (obj *rsvpLspIpv4Ero) setMsg(msg *otg.RsvpLspIpv4Ero) RsvpLspIpv4Ero { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpLspIpv4Ero struct { + obj *rsvpLspIpv4Ero +} + +type marshalRsvpLspIpv4Ero interface { + // ToProto marshals RsvpLspIpv4Ero to protobuf object *otg.RsvpLspIpv4Ero + ToProto() (*otg.RsvpLspIpv4Ero, error) + // ToPbText marshals RsvpLspIpv4Ero to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpLspIpv4Ero to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpLspIpv4Ero to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpLspIpv4Ero struct { + obj *rsvpLspIpv4Ero +} + +type unMarshalRsvpLspIpv4Ero interface { + // FromProto unmarshals RsvpLspIpv4Ero from protobuf object *otg.RsvpLspIpv4Ero + FromProto(msg *otg.RsvpLspIpv4Ero) (RsvpLspIpv4Ero, error) + // FromPbText unmarshals RsvpLspIpv4Ero from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpLspIpv4Ero from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpLspIpv4Ero from JSON text + FromJson(value string) error +} + +func (obj *rsvpLspIpv4Ero) Marshal() marshalRsvpLspIpv4Ero { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpLspIpv4Ero{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpLspIpv4Ero) Unmarshal() unMarshalRsvpLspIpv4Ero { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpLspIpv4Ero{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpLspIpv4Ero) ToProto() (*otg.RsvpLspIpv4Ero, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpLspIpv4Ero) FromProto(msg *otg.RsvpLspIpv4Ero) (RsvpLspIpv4Ero, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpLspIpv4Ero) 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 *unMarshalrsvpLspIpv4Ero) 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 *marshalrsvpLspIpv4Ero) 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 *unMarshalrsvpLspIpv4Ero) 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 *marshalrsvpLspIpv4Ero) 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 *unMarshalrsvpLspIpv4Ero) 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 *rsvpLspIpv4Ero) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpLspIpv4Ero) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpLspIpv4Ero) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpLspIpv4Ero) Clone() (RsvpLspIpv4Ero, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpLspIpv4Ero() + 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 +} + +// RsvpLspIpv4Ero is this contains the list of sub-objects included in the Explicit Route Object(ERO) object send in the PATH message from the ingress. These sub-objects contain the intermediate hops to be traversed by the LSP while being forwarded towards the egress endpoint. +type RsvpLspIpv4Ero interface { + Validation + // msg marshals RsvpLspIpv4Ero to protobuf object *otg.RsvpLspIpv4Ero + // and doesn't set defaults + msg() *otg.RsvpLspIpv4Ero + // setMsg unmarshals RsvpLspIpv4Ero from protobuf object *otg.RsvpLspIpv4Ero + // and doesn't set defaults + setMsg(*otg.RsvpLspIpv4Ero) RsvpLspIpv4Ero + // provides marshal interface + Marshal() marshalRsvpLspIpv4Ero + // provides unmarshal interface + Unmarshal() unMarshalRsvpLspIpv4Ero + // validate validates RsvpLspIpv4Ero + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpLspIpv4Ero, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Prefix returns string, set in RsvpLspIpv4Ero. + Prefix() string + // SetPrefix assigns string provided by user to RsvpLspIpv4Ero + SetPrefix(value string) RsvpLspIpv4Ero + // HasPrefix checks if Prefix has been set in RsvpLspIpv4Ero + HasPrefix() bool + // Asn returns uint32, set in RsvpLspIpv4Ero. + Asn() uint32 + // SetAsn assigns uint32 provided by user to RsvpLspIpv4Ero + SetAsn(value uint32) RsvpLspIpv4Ero + // HasAsn checks if Asn has been set in RsvpLspIpv4Ero + HasAsn() bool + // Type returns RsvpLspIpv4EroTypeEnum, set in RsvpLspIpv4Ero + Type() RsvpLspIpv4EroTypeEnum + // SetType assigns RsvpLspIpv4EroTypeEnum provided by user to RsvpLspIpv4Ero + SetType(value RsvpLspIpv4EroTypeEnum) RsvpLspIpv4Ero + // HasType checks if Type has been set in RsvpLspIpv4Ero + HasType() bool +} + +// The IPv4 prefix indicated by the ERO. Specified only when the ERO hop is an IPv4 prefix. +// Prefix returns a string +func (obj *rsvpLspIpv4Ero) Prefix() string { + + return *obj.obj.Prefix + +} + +// The IPv4 prefix indicated by the ERO. Specified only when the ERO hop is an IPv4 prefix. +// Prefix returns a string +func (obj *rsvpLspIpv4Ero) HasPrefix() bool { + return obj.obj.Prefix != nil +} + +// The IPv4 prefix indicated by the ERO. Specified only when the ERO hop is an IPv4 prefix. +// SetPrefix sets the string value in the RsvpLspIpv4Ero object +func (obj *rsvpLspIpv4Ero) SetPrefix(value string) RsvpLspIpv4Ero { + + obj.obj.Prefix = &value + return obj +} + +// The autonomous system number indicated by the ERO. Specified only when the ERO hop is an 2 or 4-byte AS number. +// Asn returns a uint32 +func (obj *rsvpLspIpv4Ero) Asn() uint32 { + + return *obj.obj.Asn + +} + +// The autonomous system number indicated by the ERO. Specified only when the ERO hop is an 2 or 4-byte AS number. +// Asn returns a uint32 +func (obj *rsvpLspIpv4Ero) HasAsn() bool { + return obj.obj.Asn != nil +} + +// The autonomous system number indicated by the ERO. Specified only when the ERO hop is an 2 or 4-byte AS number. +// SetAsn sets the uint32 value in the RsvpLspIpv4Ero object +func (obj *rsvpLspIpv4Ero) SetAsn(value uint32) RsvpLspIpv4Ero { + + obj.obj.Asn = &value + return obj +} + +type RsvpLspIpv4EroTypeEnum string + +// Enum of Type on RsvpLspIpv4Ero +var RsvpLspIpv4EroType = struct { + IPV4 RsvpLspIpv4EroTypeEnum + IPV6 RsvpLspIpv4EroTypeEnum + ASN RsvpLspIpv4EroTypeEnum + ASN4 RsvpLspIpv4EroTypeEnum + LABEL RsvpLspIpv4EroTypeEnum + UNNUMBERED_INTERFACE RsvpLspIpv4EroTypeEnum +}{ + IPV4: RsvpLspIpv4EroTypeEnum("ipv4"), + IPV6: RsvpLspIpv4EroTypeEnum("ipv6"), + ASN: RsvpLspIpv4EroTypeEnum("asn"), + ASN4: RsvpLspIpv4EroTypeEnum("asn4"), + LABEL: RsvpLspIpv4EroTypeEnum("label"), + UNNUMBERED_INTERFACE: RsvpLspIpv4EroTypeEnum("unnumbered_interface"), +} + +func (obj *rsvpLspIpv4Ero) Type() RsvpLspIpv4EroTypeEnum { + return RsvpLspIpv4EroTypeEnum(obj.obj.Type.Enum().String()) +} + +// The type indicated by the ERO. +// Type returns a string +func (obj *rsvpLspIpv4Ero) HasType() bool { + return obj.obj.Type != nil +} + +func (obj *rsvpLspIpv4Ero) SetType(value RsvpLspIpv4EroTypeEnum) RsvpLspIpv4Ero { + intValue, ok := otg.RsvpLspIpv4Ero_Type_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on RsvpLspIpv4EroTypeEnum", string(value))) + return obj + } + enumValue := otg.RsvpLspIpv4Ero_Type_Enum(intValue) + obj.obj.Type = &enumValue + + return obj +} + +func (obj *rsvpLspIpv4Ero) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Prefix != nil { + + err := obj.validateIpv4(obj.Prefix()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on RsvpLspIpv4Ero.Prefix")) + } + + } + +} + +func (obj *rsvpLspIpv4Ero) setDefault() { + +} diff --git a/gosnappi/rsvp_lsp_ipv4_interface.go b/gosnappi/rsvp_lsp_ipv4_interface.go new file mode 100644 index 00000000..3c01ee7d --- /dev/null +++ b/gosnappi/rsvp_lsp_ipv4_interface.go @@ -0,0 +1,476 @@ +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" +) + +// ***** RsvpLspIpv4Interface ***** +type rsvpLspIpv4Interface struct { + validation + obj *otg.RsvpLspIpv4Interface + marshaller marshalRsvpLspIpv4Interface + unMarshaller unMarshalRsvpLspIpv4Interface + p2PEgressIpv4LspsHolder RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + p2PIngressIpv4LspsHolder RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter +} + +func NewRsvpLspIpv4Interface() RsvpLspIpv4Interface { + obj := rsvpLspIpv4Interface{obj: &otg.RsvpLspIpv4Interface{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpLspIpv4Interface) msg() *otg.RsvpLspIpv4Interface { + return obj.obj +} + +func (obj *rsvpLspIpv4Interface) setMsg(msg *otg.RsvpLspIpv4Interface) RsvpLspIpv4Interface { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpLspIpv4Interface struct { + obj *rsvpLspIpv4Interface +} + +type marshalRsvpLspIpv4Interface interface { + // ToProto marshals RsvpLspIpv4Interface to protobuf object *otg.RsvpLspIpv4Interface + ToProto() (*otg.RsvpLspIpv4Interface, error) + // ToPbText marshals RsvpLspIpv4Interface to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpLspIpv4Interface to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpLspIpv4Interface to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpLspIpv4Interface struct { + obj *rsvpLspIpv4Interface +} + +type unMarshalRsvpLspIpv4Interface interface { + // FromProto unmarshals RsvpLspIpv4Interface from protobuf object *otg.RsvpLspIpv4Interface + FromProto(msg *otg.RsvpLspIpv4Interface) (RsvpLspIpv4Interface, error) + // FromPbText unmarshals RsvpLspIpv4Interface from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpLspIpv4Interface from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpLspIpv4Interface from JSON text + FromJson(value string) error +} + +func (obj *rsvpLspIpv4Interface) Marshal() marshalRsvpLspIpv4Interface { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpLspIpv4Interface{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpLspIpv4Interface) Unmarshal() unMarshalRsvpLspIpv4Interface { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpLspIpv4Interface{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpLspIpv4Interface) ToProto() (*otg.RsvpLspIpv4Interface, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpLspIpv4Interface) FromProto(msg *otg.RsvpLspIpv4Interface) (RsvpLspIpv4Interface, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpLspIpv4Interface) 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 *unMarshalrsvpLspIpv4Interface) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalrsvpLspIpv4Interface) 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 *unMarshalrsvpLspIpv4Interface) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalrsvpLspIpv4Interface) 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 *unMarshalrsvpLspIpv4Interface) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *rsvpLspIpv4Interface) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpLspIpv4Interface) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpLspIpv4Interface) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpLspIpv4Interface) Clone() (RsvpLspIpv4Interface, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpLspIpv4Interface() + 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 +} + +func (obj *rsvpLspIpv4Interface) setNil() { + obj.p2PEgressIpv4LspsHolder = nil + obj.p2PIngressIpv4LspsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// RsvpLspIpv4Interface is configuration for RSVP LSP IPv4 Interface. +type RsvpLspIpv4Interface interface { + Validation + // msg marshals RsvpLspIpv4Interface to protobuf object *otg.RsvpLspIpv4Interface + // and doesn't set defaults + msg() *otg.RsvpLspIpv4Interface + // setMsg unmarshals RsvpLspIpv4Interface from protobuf object *otg.RsvpLspIpv4Interface + // and doesn't set defaults + setMsg(*otg.RsvpLspIpv4Interface) RsvpLspIpv4Interface + // provides marshal interface + Marshal() marshalRsvpLspIpv4Interface + // provides unmarshal interface + Unmarshal() unMarshalRsvpLspIpv4Interface + // validate validates RsvpLspIpv4Interface + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpLspIpv4Interface, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Ipv4Name returns string, set in RsvpLspIpv4Interface. + Ipv4Name() string + // SetIpv4Name assigns string provided by user to RsvpLspIpv4Interface + SetIpv4Name(value string) RsvpLspIpv4Interface + // P2PEgressIpv4Lsps returns RsvpLspIpv4InterfaceP2PEgressIpv4Lsp, set in RsvpLspIpv4Interface. + // RsvpLspIpv4InterfaceP2PEgressIpv4Lsp is configuration for RSVP Egress Point-to-Point(P2P) IPv4 LSPs. + P2PEgressIpv4Lsps() RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + // SetP2PEgressIpv4Lsps assigns RsvpLspIpv4InterfaceP2PEgressIpv4Lsp provided by user to RsvpLspIpv4Interface. + // RsvpLspIpv4InterfaceP2PEgressIpv4Lsp is configuration for RSVP Egress Point-to-Point(P2P) IPv4 LSPs. + SetP2PEgressIpv4Lsps(value RsvpLspIpv4InterfaceP2PEgressIpv4Lsp) RsvpLspIpv4Interface + // HasP2PEgressIpv4Lsps checks if P2PEgressIpv4Lsps has been set in RsvpLspIpv4Interface + HasP2PEgressIpv4Lsps() bool + // P2PIngressIpv4Lsps returns RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIterIter, set in RsvpLspIpv4Interface + P2PIngressIpv4Lsps() RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter + setNil() +} + +// The globally unique name of the IPv4 or Loopback IPv4 interface acting as the RSVP ingress and egress endpoint for the LSPs configured on this interface. This must match the "name" field of either "ipv4_addresses" or "ipv4_loopbacks" on which this LSP interface is configured. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv4Loopback/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv4Loopback/properties/name +// +// Ipv4Name returns a string +func (obj *rsvpLspIpv4Interface) Ipv4Name() string { + + return *obj.obj.Ipv4Name + +} + +// The globally unique name of the IPv4 or Loopback IPv4 interface acting as the RSVP ingress and egress endpoint for the LSPs configured on this interface. This must match the "name" field of either "ipv4_addresses" or "ipv4_loopbacks" on which this LSP interface is configured. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv4Loopback/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv4Loopback/properties/name +// +// SetIpv4Name sets the string value in the RsvpLspIpv4Interface object +func (obj *rsvpLspIpv4Interface) SetIpv4Name(value string) RsvpLspIpv4Interface { + + obj.obj.Ipv4Name = &value + return obj +} + +// Contains properties of Tail(Egress) LSPs. +// P2PEgressIpv4Lsps returns a RsvpLspIpv4InterfaceP2PEgressIpv4Lsp +func (obj *rsvpLspIpv4Interface) P2PEgressIpv4Lsps() RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { + if obj.obj.P2PEgressIpv4Lsps == nil { + obj.obj.P2PEgressIpv4Lsps = NewRsvpLspIpv4InterfaceP2PEgressIpv4Lsp().msg() + } + if obj.p2PEgressIpv4LspsHolder == nil { + obj.p2PEgressIpv4LspsHolder = &rsvpLspIpv4InterfaceP2PEgressIpv4Lsp{obj: obj.obj.P2PEgressIpv4Lsps} + } + return obj.p2PEgressIpv4LspsHolder +} + +// Contains properties of Tail(Egress) LSPs. +// P2PEgressIpv4Lsps returns a RsvpLspIpv4InterfaceP2PEgressIpv4Lsp +func (obj *rsvpLspIpv4Interface) HasP2PEgressIpv4Lsps() bool { + return obj.obj.P2PEgressIpv4Lsps != nil +} + +// Contains properties of Tail(Egress) LSPs. +// SetP2PEgressIpv4Lsps sets the RsvpLspIpv4InterfaceP2PEgressIpv4Lsp value in the RsvpLspIpv4Interface object +func (obj *rsvpLspIpv4Interface) SetP2PEgressIpv4Lsps(value RsvpLspIpv4InterfaceP2PEgressIpv4Lsp) RsvpLspIpv4Interface { + + obj.p2PEgressIpv4LspsHolder = nil + obj.obj.P2PEgressIpv4Lsps = value.msg() + + return obj +} + +// Array of point-to-point RSVP-TE P2P LSPs originating from this interface. +// P2PIngressIpv4Lsps returns a []RsvpLspIpv4InterfaceP2PIngressIpv4Lsp +func (obj *rsvpLspIpv4Interface) P2PIngressIpv4Lsps() RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { + if len(obj.obj.P2PIngressIpv4Lsps) == 0 { + obj.obj.P2PIngressIpv4Lsps = []*otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp{} + } + if obj.p2PIngressIpv4LspsHolder == nil { + obj.p2PIngressIpv4LspsHolder = newRsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter(&obj.obj.P2PIngressIpv4Lsps).setMsg(obj) + } + return obj.p2PIngressIpv4LspsHolder +} + +type rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter struct { + obj *rsvpLspIpv4Interface + rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice []RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + fieldPtr *[]*otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp +} + +func newRsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter(ptr *[]*otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { + return &rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter{fieldPtr: ptr} +} + +type RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter interface { + setMsg(*rsvpLspIpv4Interface) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter + Items() []RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + Add() RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + Append(items ...RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter + Set(index int, newObj RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter + Clear() RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter + clearHolderSlice() RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter + appendHolderSlice(item RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter +} + +func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) setMsg(msg *rsvpLspIpv4Interface) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&rsvpLspIpv4InterfaceP2PIngressIpv4Lsp{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) Items() []RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + return obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice +} + +func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) Add() RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + newObj := &otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &rsvpLspIpv4InterfaceP2PIngressIpv4Lsp{obj: newObj} + newLibObj.setDefault() + obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice = append(obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice, newLibObj) + return newLibObj +} + +func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) Append(items ...RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice = append(obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice, item) + } + return obj +} + +func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) Set(index int, newObj RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice[index] = newObj + return obj +} +func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) Clear() RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp{} + obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice = []RsvpLspIpv4InterfaceP2PIngressIpv4Lsp{} + } + return obj +} +func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) clearHolderSlice() RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { + if len(obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice) > 0 { + obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice = []RsvpLspIpv4InterfaceP2PIngressIpv4Lsp{} + } + return obj +} +func (obj *rsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter) appendHolderSlice(item RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceRsvpLspIpv4InterfaceP2PIngressIpv4LspIter { + obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice = append(obj.rsvpLspIpv4InterfaceP2PIngressIpv4LspSlice, item) + return obj +} + +func (obj *rsvpLspIpv4Interface) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Ipv4Name is required + if obj.obj.Ipv4Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Ipv4Name is required field on interface RsvpLspIpv4Interface") + } + + if obj.obj.P2PEgressIpv4Lsps != nil { + + obj.P2PEgressIpv4Lsps().validateObj(vObj, set_default) + } + + if len(obj.obj.P2PIngressIpv4Lsps) != 0 { + + if set_default { + obj.P2PIngressIpv4Lsps().clearHolderSlice() + for _, item := range obj.obj.P2PIngressIpv4Lsps { + obj.P2PIngressIpv4Lsps().appendHolderSlice(&rsvpLspIpv4InterfaceP2PIngressIpv4Lsp{obj: item}) + } + } + for _, item := range obj.P2PIngressIpv4Lsps().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *rsvpLspIpv4Interface) setDefault() { + +} diff --git a/gosnappi/rsvp_lsp_ipv4_interface_p2p_egress_ipv4_lsp.go b/gosnappi/rsvp_lsp_ipv4_interface_p2p_egress_ipv4_lsp.go new file mode 100644 index 00000000..a2cdfe52 --- /dev/null +++ b/gosnappi/rsvp_lsp_ipv4_interface_p2p_egress_ipv4_lsp.go @@ -0,0 +1,503 @@ +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" +) + +// ***** RsvpLspIpv4InterfaceP2PEgressIpv4Lsp ***** +type rsvpLspIpv4InterfaceP2PEgressIpv4Lsp struct { + validation + obj *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + marshaller marshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp + unMarshaller unMarshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp +} + +func NewRsvpLspIpv4InterfaceP2PEgressIpv4Lsp() RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { + obj := rsvpLspIpv4InterfaceP2PEgressIpv4Lsp{obj: &otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) msg() *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { + return obj.obj +} + +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) setMsg(msg *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp struct { + obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp +} + +type marshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp interface { + // ToProto marshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp to protobuf object *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + ToProto() (*otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp, error) + // ToPbText marshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp struct { + obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp +} + +type unMarshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp interface { + // FromProto unmarshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp from protobuf object *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + FromProto(msg *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp) (RsvpLspIpv4InterfaceP2PEgressIpv4Lsp, error) + // FromPbText unmarshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp from JSON text + FromJson(value string) error +} + +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) Marshal() marshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) Unmarshal() unMarshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) ToProto() (*otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) FromProto(msg *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp) (RsvpLspIpv4InterfaceP2PEgressIpv4Lsp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) 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 *unMarshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) 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 *marshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) 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 *unMarshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) 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 *marshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) 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 *unMarshalrsvpLspIpv4InterfaceP2PEgressIpv4Lsp) 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 *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) Clone() (RsvpLspIpv4InterfaceP2PEgressIpv4Lsp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpLspIpv4InterfaceP2PEgressIpv4Lsp() + 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 +} + +// RsvpLspIpv4InterfaceP2PEgressIpv4Lsp is configuration for RSVP Egress Point-to-Point(P2P) IPv4 LSPs. +type RsvpLspIpv4InterfaceP2PEgressIpv4Lsp interface { + Validation + // msg marshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp to protobuf object *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + // and doesn't set defaults + msg() *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + // setMsg unmarshals RsvpLspIpv4InterfaceP2PEgressIpv4Lsp from protobuf object *otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + // and doesn't set defaults + setMsg(*otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + // provides marshal interface + Marshal() marshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp + // provides unmarshal interface + Unmarshal() unMarshalRsvpLspIpv4InterfaceP2PEgressIpv4Lsp + // validate validates RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpLspIpv4InterfaceP2PEgressIpv4Lsp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp. + Name() string + // SetName assigns string provided by user to RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + SetName(value string) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + // RefreshInterval returns uint32, set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp. + RefreshInterval() uint32 + // SetRefreshInterval assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + SetRefreshInterval(value uint32) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + // HasRefreshInterval checks if RefreshInterval has been set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + HasRefreshInterval() bool + // TimeoutMultiplier returns uint32, set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp. + TimeoutMultiplier() uint32 + // SetTimeoutMultiplier assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + SetTimeoutMultiplier(value uint32) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + // HasTimeoutMultiplier checks if TimeoutMultiplier has been set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + HasTimeoutMultiplier() bool + // ReservationStyle returns RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum, set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + ReservationStyle() RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum + // SetReservationStyle assigns RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum provided by user to RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + SetReservationStyle(value RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + // HasReservationStyle checks if ReservationStyle has been set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + HasReservationStyle() bool + // EnableFixedLabel returns bool, set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp. + EnableFixedLabel() bool + // SetEnableFixedLabel assigns bool provided by user to RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + SetEnableFixedLabel(value bool) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + // HasEnableFixedLabel checks if EnableFixedLabel has been set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + HasEnableFixedLabel() bool + // FixedLabelValue returns uint32, set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp. + FixedLabelValue() uint32 + // SetFixedLabelValue assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + SetFixedLabelValue(value uint32) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + // HasFixedLabelValue checks if FixedLabelValue has been set in RsvpLspIpv4InterfaceP2PEgressIpv4Lsp + HasFixedLabelValue() bool +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the RsvpLspIpv4InterfaceP2PEgressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) SetName(value string) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { + + obj.obj.Name = &value + return obj +} + +// The time in seconds between successive transmissions of RESV Refreshes. The actual refresh interval is jittered by upto 50%. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. +// RefreshInterval returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) RefreshInterval() uint32 { + + return *obj.obj.RefreshInterval + +} + +// The time in seconds between successive transmissions of RESV Refreshes. The actual refresh interval is jittered by upto 50%. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. +// RefreshInterval returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) HasRefreshInterval() bool { + return obj.obj.RefreshInterval != nil +} + +// The time in seconds between successive transmissions of RESV Refreshes. The actual refresh interval is jittered by upto 50%. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. +// SetRefreshInterval sets the uint32 value in the RsvpLspIpv4InterfaceP2PEgressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) SetRefreshInterval(value uint32) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { + + obj.obj.RefreshInterval = &value + return obj +} + +// The number of missed PATH refreshes after which a recieving node should consider the LSP state to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. +// TimeoutMultiplier returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) TimeoutMultiplier() uint32 { + + return *obj.obj.TimeoutMultiplier + +} + +// The number of missed PATH refreshes after which a recieving node should consider the LSP state to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. +// TimeoutMultiplier returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) HasTimeoutMultiplier() bool { + return obj.obj.TimeoutMultiplier != nil +} + +// The number of missed PATH refreshes after which a recieving node should consider the LSP state to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. +// SetTimeoutMultiplier sets the uint32 value in the RsvpLspIpv4InterfaceP2PEgressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) SetTimeoutMultiplier(value uint32) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { + + obj.obj.TimeoutMultiplier = &value + return obj +} + +type RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum string + +// Enum of ReservationStyle on RsvpLspIpv4InterfaceP2PEgressIpv4Lsp +var RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyle = struct { + SHARED_EXPLICIT RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum + FIXED_FILTER RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum + AUTO RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum +}{ + SHARED_EXPLICIT: RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum("shared_explicit"), + FIXED_FILTER: RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum("fixed_filter"), + AUTO: RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum("auto"), +} + +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) ReservationStyle() RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum { + return RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum(obj.obj.ReservationStyle.Enum().String()) +} + +// It determines how RSVP-TE enabled network devices set up reservations along the path between an end-to-end QOS-enabled connection. If 'auto' is enabled, the style is chosen based on whether the incoming Path has 'SE Desired' flag set. Otherwise, the style is chosen based on the value selected for this attribute. +// ReservationStyle returns a string +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) HasReservationStyle() bool { + return obj.obj.ReservationStyle != nil +} + +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) SetReservationStyle(value RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { + intValue, ok := otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp_ReservationStyle_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyleEnum", string(value))) + return obj + } + enumValue := otg.RsvpLspIpv4InterfaceP2PEgressIpv4Lsp_ReservationStyle_Enum(intValue) + obj.obj.ReservationStyle = &enumValue + + return obj +} + +// If enabled, a specific fixed label will be advertised by the egress or tail end for all Path messages received by this egress. This can be leveraged to advertise Explicit or Implicit null labels. +// EnableFixedLabel returns a bool +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) EnableFixedLabel() bool { + + return *obj.obj.EnableFixedLabel + +} + +// If enabled, a specific fixed label will be advertised by the egress or tail end for all Path messages received by this egress. This can be leveraged to advertise Explicit or Implicit null labels. +// EnableFixedLabel returns a bool +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) HasEnableFixedLabel() bool { + return obj.obj.EnableFixedLabel != nil +} + +// If enabled, a specific fixed label will be advertised by the egress or tail end for all Path messages received by this egress. This can be leveraged to advertise Explicit or Implicit null labels. +// SetEnableFixedLabel sets the bool value in the RsvpLspIpv4InterfaceP2PEgressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) SetEnableFixedLabel(value bool) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { + + obj.obj.EnableFixedLabel = &value + return obj +} + +// The fixed label value as advertised by egress in RESV message. Applicable only if 'fixed_label' is set to 'true'. Special values are '0 - IPv4 Explicit NULL', '2 - IPv6 Explicit NULL' and '3 - Implicit NULL'. Outside of this, labels are expected to have a minimum value of 16. +// FixedLabelValue returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) FixedLabelValue() uint32 { + + return *obj.obj.FixedLabelValue + +} + +// The fixed label value as advertised by egress in RESV message. Applicable only if 'fixed_label' is set to 'true'. Special values are '0 - IPv4 Explicit NULL', '2 - IPv6 Explicit NULL' and '3 - Implicit NULL'. Outside of this, labels are expected to have a minimum value of 16. +// FixedLabelValue returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) HasFixedLabelValue() bool { + return obj.obj.FixedLabelValue != nil +} + +// The fixed label value as advertised by egress in RESV message. Applicable only if 'fixed_label' is set to 'true'. Special values are '0 - IPv4 Explicit NULL', '2 - IPv6 Explicit NULL' and '3 - Implicit NULL'. Outside of this, labels are expected to have a minimum value of 16. +// SetFixedLabelValue sets the uint32 value in the RsvpLspIpv4InterfaceP2PEgressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) SetFixedLabelValue(value uint32) RsvpLspIpv4InterfaceP2PEgressIpv4Lsp { + + obj.obj.FixedLabelValue = &value + return obj +} + +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface RsvpLspIpv4InterfaceP2PEgressIpv4Lsp") + } + + if obj.obj.RefreshInterval != nil { + + if *obj.obj.RefreshInterval > 3600 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpLspIpv4InterfaceP2PEgressIpv4Lsp.RefreshInterval <= 3600 but Got %d", *obj.obj.RefreshInterval)) + } + + } + + if obj.obj.TimeoutMultiplier != nil { + + if *obj.obj.TimeoutMultiplier > 10 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpLspIpv4InterfaceP2PEgressIpv4Lsp.TimeoutMultiplier <= 10 but Got %d", *obj.obj.TimeoutMultiplier)) + } + + } + + if obj.obj.FixedLabelValue != nil { + + if *obj.obj.FixedLabelValue > 1048575 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpLspIpv4InterfaceP2PEgressIpv4Lsp.FixedLabelValue <= 1048575 but Got %d", *obj.obj.FixedLabelValue)) + } + + } + +} + +func (obj *rsvpLspIpv4InterfaceP2PEgressIpv4Lsp) setDefault() { + if obj.obj.RefreshInterval == nil { + obj.SetRefreshInterval(30) + } + if obj.obj.TimeoutMultiplier == nil { + obj.SetTimeoutMultiplier(3) + } + if obj.obj.ReservationStyle == nil { + obj.SetReservationStyle(RsvpLspIpv4InterfaceP2PEgressIpv4LspReservationStyle.SHARED_EXPLICIT) + + } + if obj.obj.EnableFixedLabel == nil { + obj.SetEnableFixedLabel(false) + } + if obj.obj.FixedLabelValue == nil { + obj.SetFixedLabelValue(0) + } + +} diff --git a/gosnappi/rsvp_lsp_ipv4_interface_p2p_ingress_ipv4_lsp.go b/gosnappi/rsvp_lsp_ipv4_interface_p2p_ingress_ipv4_lsp.go new file mode 100644 index 00000000..cda29704 --- /dev/null +++ b/gosnappi/rsvp_lsp_ipv4_interface_p2p_ingress_ipv4_lsp.go @@ -0,0 +1,767 @@ +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" +) + +// ***** RsvpLspIpv4InterfaceP2PIngressIpv4Lsp ***** +type rsvpLspIpv4InterfaceP2PIngressIpv4Lsp struct { + validation + obj *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + marshaller marshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp + unMarshaller unMarshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp + sessionAttributeHolder RsvpSessionAttribute + tspecHolder RsvpTspec + fastRerouteHolder RsvpFastReroute + eroHolder RsvpEro +} + +func NewRsvpLspIpv4InterfaceP2PIngressIpv4Lsp() RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + obj := rsvpLspIpv4InterfaceP2PIngressIpv4Lsp{obj: &otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) msg() *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + return obj.obj +} + +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) setMsg(msg *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp struct { + obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp +} + +type marshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp interface { + // ToProto marshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp to protobuf object *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + ToProto() (*otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp, error) + // ToPbText marshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp struct { + obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp +} + +type unMarshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp interface { + // FromProto unmarshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp from protobuf object *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + FromProto(msg *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) (RsvpLspIpv4InterfaceP2PIngressIpv4Lsp, error) + // FromPbText unmarshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp from JSON text + FromJson(value string) error +} + +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) Marshal() marshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) Unmarshal() unMarshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) ToProto() (*otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) FromProto(msg *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) (RsvpLspIpv4InterfaceP2PIngressIpv4Lsp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) 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 *unMarshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) 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 *unMarshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) 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 *unMarshalrsvpLspIpv4InterfaceP2PIngressIpv4Lsp) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) Clone() (RsvpLspIpv4InterfaceP2PIngressIpv4Lsp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpLspIpv4InterfaceP2PIngressIpv4Lsp() + 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 +} + +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) setNil() { + obj.sessionAttributeHolder = nil + obj.tspecHolder = nil + obj.fastRerouteHolder = nil + obj.eroHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// RsvpLspIpv4InterfaceP2PIngressIpv4Lsp is configuration for an RSVP Ingress point-to-point LSP. +type RsvpLspIpv4InterfaceP2PIngressIpv4Lsp interface { + Validation + // msg marshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp to protobuf object *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // and doesn't set defaults + msg() *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // setMsg unmarshals RsvpLspIpv4InterfaceP2PIngressIpv4Lsp from protobuf object *otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // and doesn't set defaults + setMsg(*otg.RsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // provides marshal interface + Marshal() marshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // provides unmarshal interface + Unmarshal() unMarshalRsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // validate validates RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpLspIpv4InterfaceP2PIngressIpv4Lsp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + Name() string + // SetName assigns string provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + SetName(value string) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // RemoteAddress returns string, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + RemoteAddress() string + // SetRemoteAddress assigns string provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + SetRemoteAddress(value string) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // TunnelId returns uint32, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + TunnelId() uint32 + // SetTunnelId assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + SetTunnelId(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // HasTunnelId checks if TunnelId has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + HasTunnelId() bool + // LspId returns uint32, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + LspId() uint32 + // SetLspId assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + SetLspId(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // HasLspId checks if LspId has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + HasLspId() bool + // RefreshInterval returns uint32, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + RefreshInterval() uint32 + // SetRefreshInterval assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + SetRefreshInterval(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // HasRefreshInterval checks if RefreshInterval has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + HasRefreshInterval() bool + // TimeoutMultiplier returns uint32, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + TimeoutMultiplier() uint32 + // SetTimeoutMultiplier assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + SetTimeoutMultiplier(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // HasTimeoutMultiplier checks if TimeoutMultiplier has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + HasTimeoutMultiplier() bool + // BackupLspId returns uint32, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + BackupLspId() uint32 + // SetBackupLspId assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + SetBackupLspId(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // HasBackupLspId checks if BackupLspId has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + HasBackupLspId() bool + // LspSwitchoverDelay returns uint32, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + LspSwitchoverDelay() uint32 + // SetLspSwitchoverDelay assigns uint32 provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + SetLspSwitchoverDelay(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // HasLspSwitchoverDelay checks if LspSwitchoverDelay has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + HasLspSwitchoverDelay() bool + // SessionAttribute returns RsvpSessionAttribute, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + // RsvpSessionAttribute is configuration for RSVP-TE SESSION_ATTRIBUTE object included in Path Messages as defined in RFC3209. The bandwidth_protection_desired and node_protection_desired flags are defined in RFC4090 (Fast Reroute). + SessionAttribute() RsvpSessionAttribute + // SetSessionAttribute assigns RsvpSessionAttribute provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + // RsvpSessionAttribute is configuration for RSVP-TE SESSION_ATTRIBUTE object included in Path Messages as defined in RFC3209. The bandwidth_protection_desired and node_protection_desired flags are defined in RFC4090 (Fast Reroute). + SetSessionAttribute(value RsvpSessionAttribute) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // HasSessionAttribute checks if SessionAttribute has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + HasSessionAttribute() bool + // Tspec returns RsvpTspec, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + // RsvpTspec is configuration for RSVP-TE TSPEC object included in Path Messages. The usage of these parameters is defined in RFC2215. + Tspec() RsvpTspec + // SetTspec assigns RsvpTspec provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + // RsvpTspec is configuration for RSVP-TE TSPEC object included in Path Messages. The usage of these parameters is defined in RFC2215. + SetTspec(value RsvpTspec) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // HasTspec checks if Tspec has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + HasTspec() bool + // FastReroute returns RsvpFastReroute, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + // RsvpFastReroute is configuration for the optional RSVP-TE FAST_REROUTE object included in Path Messages as defined in RFC4090. + FastReroute() RsvpFastReroute + // SetFastReroute assigns RsvpFastReroute provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + // RsvpFastReroute is configuration for the optional RSVP-TE FAST_REROUTE object included in Path Messages as defined in RFC4090. + SetFastReroute(value RsvpFastReroute) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // HasFastReroute checks if FastReroute has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + HasFastReroute() bool + // Ero returns RsvpEro, set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + // RsvpEro is configuration for the optional RSVP-TE explicit route object(ERO) object included in Path Messages. + Ero() RsvpEro + // SetEro assigns RsvpEro provided by user to RsvpLspIpv4InterfaceP2PIngressIpv4Lsp. + // RsvpEro is configuration for the optional RSVP-TE explicit route object(ERO) object included in Path Messages. + SetEro(value RsvpEro) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + // HasEro checks if Ero has been set in RsvpLspIpv4InterfaceP2PIngressIpv4Lsp + HasEro() bool + setNil() +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetName(value string) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + + obj.obj.Name = &value + return obj +} + +// IPv4 address of the remote endpoint of the LSP. +// RemoteAddress returns a string +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RemoteAddress() string { + + return *obj.obj.RemoteAddress + +} + +// IPv4 address of the remote endpoint of the LSP. +// SetRemoteAddress sets the string value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetRemoteAddress(value string) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + + obj.obj.RemoteAddress = &value + return obj +} + +// The Tunnel ID of the RSVP LSP. Carried in the SESSION object in Path Messages. +// TunnelId returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) TunnelId() uint32 { + + return *obj.obj.TunnelId + +} + +// The Tunnel ID of the RSVP LSP. Carried in the SESSION object in Path Messages. +// TunnelId returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasTunnelId() bool { + return obj.obj.TunnelId != nil +} + +// The Tunnel ID of the RSVP LSP. Carried in the SESSION object in Path Messages. +// SetTunnelId sets the uint32 value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetTunnelId(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + + obj.obj.TunnelId = &value + return obj +} + +// The LSP ID of the RSVP LSP. Carried in the SENDER_TEMPLATE object in Path Messages. +// LspId returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) LspId() uint32 { + + return *obj.obj.LspId + +} + +// The LSP ID of the RSVP LSP. Carried in the SENDER_TEMPLATE object in Path Messages. +// LspId returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasLspId() bool { + return obj.obj.LspId != nil +} + +// The LSP ID of the RSVP LSP. Carried in the SENDER_TEMPLATE object in Path Messages. +// SetLspId sets the uint32 value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetLspId(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + + obj.obj.LspId = &value + return obj +} + +// The time in seconds between successive transmissions of PATH Refreshes. The actual refresh interval is jittered by upto 50%. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. +// RefreshInterval returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) RefreshInterval() uint32 { + + return *obj.obj.RefreshInterval + +} + +// The time in seconds between successive transmissions of PATH Refreshes. The actual refresh interval is jittered by upto 50%. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. +// RefreshInterval returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasRefreshInterval() bool { + return obj.obj.RefreshInterval != nil +} + +// The time in seconds between successive transmissions of PATH Refreshes. The actual refresh interval is jittered by upto 50%. There is no specification specified maximum value. For clarity, setting the maximum to 1 hour. +// SetRefreshInterval sets the uint32 value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetRefreshInterval(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + + obj.obj.RefreshInterval = &value + return obj +} + +// The number of missed RESV refreshes after which a recieving node should consider the LSP state to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. +// TimeoutMultiplier returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) TimeoutMultiplier() uint32 { + + return *obj.obj.TimeoutMultiplier + +} + +// The number of missed RESV refreshes after which a recieving node should consider the LSP state to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. +// TimeoutMultiplier returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasTimeoutMultiplier() bool { + return obj.obj.TimeoutMultiplier != nil +} + +// The number of missed RESV refreshes after which a recieving node should consider the LSP state to have timed out. There is no specification specified maximum value. Setting the maximum allowed value to 10. +// SetTimeoutMultiplier sets the uint32 value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetTimeoutMultiplier(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + + obj.obj.TimeoutMultiplier = &value + return obj +} + +// The LSP id that will be used when creating a Make-Before-Break LSP when the active LSP is using lsp_id. If the active LSP on which Make-Before-Break is being done is using the backup_lsp_id, the new LSP created will toggle to use the lsp_id instead. +// BackupLspId returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) BackupLspId() uint32 { + + return *obj.obj.BackupLspId + +} + +// The LSP id that will be used when creating a Make-Before-Break LSP when the active LSP is using lsp_id. If the active LSP on which Make-Before-Break is being done is using the backup_lsp_id, the new LSP created will toggle to use the lsp_id instead. +// BackupLspId returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasBackupLspId() bool { + return obj.obj.BackupLspId != nil +} + +// The LSP id that will be used when creating a Make-Before-Break LSP when the active LSP is using lsp_id. If the active LSP on which Make-Before-Break is being done is using the backup_lsp_id, the new LSP created will toggle to use the lsp_id instead. +// SetBackupLspId sets the uint32 value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetBackupLspId(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + + obj.obj.BackupLspId = &value + return obj +} + +// The amount of delay in milliseconds that an implementation should wait for before switching traffic to the new LSP created after a Make-Before-Break is done on an LSP. The default value is 0 which means to switch immediately. An implementation should support a minimum delay value of at least 50ms . There is no specification specified maximum value. Setting maximum allowed value to 1 minute. If a delay value is supplied which is lesser than the minimum delay value supported, a warning should be provided indicating that the minimum value of LSP switchover delay is automatically increased to the supported minimum value. This warning should be included in the list of warnings in the 'Response.Warning' attribute sent in the SetConfig 'Success' Response. +// LspSwitchoverDelay returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) LspSwitchoverDelay() uint32 { + + return *obj.obj.LspSwitchoverDelay + +} + +// The amount of delay in milliseconds that an implementation should wait for before switching traffic to the new LSP created after a Make-Before-Break is done on an LSP. The default value is 0 which means to switch immediately. An implementation should support a minimum delay value of at least 50ms . There is no specification specified maximum value. Setting maximum allowed value to 1 minute. If a delay value is supplied which is lesser than the minimum delay value supported, a warning should be provided indicating that the minimum value of LSP switchover delay is automatically increased to the supported minimum value. This warning should be included in the list of warnings in the 'Response.Warning' attribute sent in the SetConfig 'Success' Response. +// LspSwitchoverDelay returns a uint32 +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasLspSwitchoverDelay() bool { + return obj.obj.LspSwitchoverDelay != nil +} + +// The amount of delay in milliseconds that an implementation should wait for before switching traffic to the new LSP created after a Make-Before-Break is done on an LSP. The default value is 0 which means to switch immediately. An implementation should support a minimum delay value of at least 50ms . There is no specification specified maximum value. Setting maximum allowed value to 1 minute. If a delay value is supplied which is lesser than the minimum delay value supported, a warning should be provided indicating that the minimum value of LSP switchover delay is automatically increased to the supported minimum value. This warning should be included in the list of warnings in the 'Response.Warning' attribute sent in the SetConfig 'Success' Response. +// SetLspSwitchoverDelay sets the uint32 value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetLspSwitchoverDelay(value uint32) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + + obj.obj.LspSwitchoverDelay = &value + return obj +} + +// This contains the values of the fields to be included in the SESSION_ATTRIBUTE object in the Path Message sent for the LSP. +// SessionAttribute returns a RsvpSessionAttribute +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SessionAttribute() RsvpSessionAttribute { + if obj.obj.SessionAttribute == nil { + obj.obj.SessionAttribute = NewRsvpSessionAttribute().msg() + } + if obj.sessionAttributeHolder == nil { + obj.sessionAttributeHolder = &rsvpSessionAttribute{obj: obj.obj.SessionAttribute} + } + return obj.sessionAttributeHolder +} + +// This contains the values of the fields to be included in the SESSION_ATTRIBUTE object in the Path Message sent for the LSP. +// SessionAttribute returns a RsvpSessionAttribute +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasSessionAttribute() bool { + return obj.obj.SessionAttribute != nil +} + +// This contains the values of the fields to be included in the SESSION_ATTRIBUTE object in the Path Message sent for the LSP. +// SetSessionAttribute sets the RsvpSessionAttribute value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetSessionAttribute(value RsvpSessionAttribute) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + + obj.sessionAttributeHolder = nil + obj.obj.SessionAttribute = value.msg() + + return obj +} + +// This contains the values of the fields to be included in the TSPEC object in the Path Message sent for the LSP. +// Tspec returns a RsvpTspec +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) Tspec() RsvpTspec { + if obj.obj.Tspec == nil { + obj.obj.Tspec = NewRsvpTspec().msg() + } + if obj.tspecHolder == nil { + obj.tspecHolder = &rsvpTspec{obj: obj.obj.Tspec} + } + return obj.tspecHolder +} + +// This contains the values of the fields to be included in the TSPEC object in the Path Message sent for the LSP. +// Tspec returns a RsvpTspec +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasTspec() bool { + return obj.obj.Tspec != nil +} + +// This contains the values of the fields to be included in the TSPEC object in the Path Message sent for the LSP. +// SetTspec sets the RsvpTspec value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetTspec(value RsvpTspec) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + + obj.tspecHolder = nil + obj.obj.Tspec = value.msg() + + return obj +} + +// This contains the values of the fields to be included in the FAST_REROUTE object in the Path Message sent for the LSP. +// This is an optional object . If this attribute is not included , the FAST_REROUTE object will not be included. +// FastReroute returns a RsvpFastReroute +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) FastReroute() RsvpFastReroute { + if obj.obj.FastReroute == nil { + obj.obj.FastReroute = NewRsvpFastReroute().msg() + } + if obj.fastRerouteHolder == nil { + obj.fastRerouteHolder = &rsvpFastReroute{obj: obj.obj.FastReroute} + } + return obj.fastRerouteHolder +} + +// This contains the values of the fields to be included in the FAST_REROUTE object in the Path Message sent for the LSP. +// This is an optional object . If this attribute is not included , the FAST_REROUTE object will not be included. +// FastReroute returns a RsvpFastReroute +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasFastReroute() bool { + return obj.obj.FastReroute != nil +} + +// This contains the values of the fields to be included in the FAST_REROUTE object in the Path Message sent for the LSP. +// This is an optional object . If this attribute is not included , the FAST_REROUTE object will not be included. +// SetFastReroute sets the RsvpFastReroute value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetFastReroute(value RsvpFastReroute) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + + obj.fastRerouteHolder = nil + obj.obj.FastReroute = value.msg() + + return obj +} + +// This contains the values of the fields to be included in the ERO object in the Path Message sent for the LSP. +// This is an optional object . If this attribute is not included , the ERO object will not be included. +// Ero returns a RsvpEro +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) Ero() RsvpEro { + if obj.obj.Ero == nil { + obj.obj.Ero = NewRsvpEro().msg() + } + if obj.eroHolder == nil { + obj.eroHolder = &rsvpEro{obj: obj.obj.Ero} + } + return obj.eroHolder +} + +// This contains the values of the fields to be included in the ERO object in the Path Message sent for the LSP. +// This is an optional object . If this attribute is not included , the ERO object will not be included. +// Ero returns a RsvpEro +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) HasEro() bool { + return obj.obj.Ero != nil +} + +// This contains the values of the fields to be included in the ERO object in the Path Message sent for the LSP. +// This is an optional object . If this attribute is not included , the ERO object will not be included. +// SetEro sets the RsvpEro value in the RsvpLspIpv4InterfaceP2PIngressIpv4Lsp object +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) SetEro(value RsvpEro) RsvpLspIpv4InterfaceP2PIngressIpv4Lsp { + + obj.eroHolder = nil + obj.obj.Ero = value.msg() + + return obj +} + +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface RsvpLspIpv4InterfaceP2PIngressIpv4Lsp") + } + + // RemoteAddress is required + if obj.obj.RemoteAddress == nil { + vObj.validationErrors = append(vObj.validationErrors, "RemoteAddress is required field on interface RsvpLspIpv4InterfaceP2PIngressIpv4Lsp") + } + if obj.obj.RemoteAddress != nil { + + err := obj.validateIpv4(obj.RemoteAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on RsvpLspIpv4InterfaceP2PIngressIpv4Lsp.RemoteAddress")) + } + + } + + if obj.obj.TunnelId != nil { + + if *obj.obj.TunnelId < 1 || *obj.obj.TunnelId > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= RsvpLspIpv4InterfaceP2PIngressIpv4Lsp.TunnelId <= 65535 but Got %d", *obj.obj.TunnelId)) + } + + } + + if obj.obj.LspId != nil { + + if *obj.obj.LspId < 1 || *obj.obj.LspId > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= RsvpLspIpv4InterfaceP2PIngressIpv4Lsp.LspId <= 65535 but Got %d", *obj.obj.LspId)) + } + + } + + if obj.obj.RefreshInterval != nil { + + if *obj.obj.RefreshInterval < 1 || *obj.obj.RefreshInterval > 3600 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= RsvpLspIpv4InterfaceP2PIngressIpv4Lsp.RefreshInterval <= 3600 but Got %d", *obj.obj.RefreshInterval)) + } + + } + + if obj.obj.TimeoutMultiplier != nil { + + if *obj.obj.TimeoutMultiplier < 1 || *obj.obj.TimeoutMultiplier > 10 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= RsvpLspIpv4InterfaceP2PIngressIpv4Lsp.TimeoutMultiplier <= 10 but Got %d", *obj.obj.TimeoutMultiplier)) + } + + } + + if obj.obj.BackupLspId != nil { + + if *obj.obj.BackupLspId < 1 || *obj.obj.BackupLspId > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= RsvpLspIpv4InterfaceP2PIngressIpv4Lsp.BackupLspId <= 65535 but Got %d", *obj.obj.BackupLspId)) + } + + } + + if obj.obj.LspSwitchoverDelay != nil { + + if *obj.obj.LspSwitchoverDelay > 60000 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpLspIpv4InterfaceP2PIngressIpv4Lsp.LspSwitchoverDelay <= 60000 but Got %d", *obj.obj.LspSwitchoverDelay)) + } + + } + + if obj.obj.SessionAttribute != nil { + + obj.SessionAttribute().validateObj(vObj, set_default) + } + + if obj.obj.Tspec != nil { + + obj.Tspec().validateObj(vObj, set_default) + } + + if obj.obj.FastReroute != nil { + + obj.FastReroute().validateObj(vObj, set_default) + } + + if obj.obj.Ero != nil { + + obj.Ero().validateObj(vObj, set_default) + } + +} + +func (obj *rsvpLspIpv4InterfaceP2PIngressIpv4Lsp) setDefault() { + if obj.obj.TunnelId == nil { + obj.SetTunnelId(1) + } + if obj.obj.LspId == nil { + obj.SetLspId(1) + } + if obj.obj.RefreshInterval == nil { + obj.SetRefreshInterval(30) + } + if obj.obj.TimeoutMultiplier == nil { + obj.SetTimeoutMultiplier(3) + } + if obj.obj.BackupLspId == nil { + obj.SetBackupLspId(2) + } + if obj.obj.LspSwitchoverDelay == nil { + obj.SetLspSwitchoverDelay(0) + } + +} diff --git a/gosnappi/rsvp_lsp_ipv4_rro.go b/gosnappi/rsvp_lsp_ipv4_rro.go new file mode 100644 index 00000000..1d32a836 --- /dev/null +++ b/gosnappi/rsvp_lsp_ipv4_rro.go @@ -0,0 +1,343 @@ +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" +) + +// ***** RsvpLspIpv4Rro ***** +type rsvpLspIpv4Rro struct { + validation + obj *otg.RsvpLspIpv4Rro + marshaller marshalRsvpLspIpv4Rro + unMarshaller unMarshalRsvpLspIpv4Rro +} + +func NewRsvpLspIpv4Rro() RsvpLspIpv4Rro { + obj := rsvpLspIpv4Rro{obj: &otg.RsvpLspIpv4Rro{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpLspIpv4Rro) msg() *otg.RsvpLspIpv4Rro { + return obj.obj +} + +func (obj *rsvpLspIpv4Rro) setMsg(msg *otg.RsvpLspIpv4Rro) RsvpLspIpv4Rro { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpLspIpv4Rro struct { + obj *rsvpLspIpv4Rro +} + +type marshalRsvpLspIpv4Rro interface { + // ToProto marshals RsvpLspIpv4Rro to protobuf object *otg.RsvpLspIpv4Rro + ToProto() (*otg.RsvpLspIpv4Rro, error) + // ToPbText marshals RsvpLspIpv4Rro to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpLspIpv4Rro to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpLspIpv4Rro to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpLspIpv4Rro struct { + obj *rsvpLspIpv4Rro +} + +type unMarshalRsvpLspIpv4Rro interface { + // FromProto unmarshals RsvpLspIpv4Rro from protobuf object *otg.RsvpLspIpv4Rro + FromProto(msg *otg.RsvpLspIpv4Rro) (RsvpLspIpv4Rro, error) + // FromPbText unmarshals RsvpLspIpv4Rro from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpLspIpv4Rro from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpLspIpv4Rro from JSON text + FromJson(value string) error +} + +func (obj *rsvpLspIpv4Rro) Marshal() marshalRsvpLspIpv4Rro { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpLspIpv4Rro{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpLspIpv4Rro) Unmarshal() unMarshalRsvpLspIpv4Rro { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpLspIpv4Rro{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpLspIpv4Rro) ToProto() (*otg.RsvpLspIpv4Rro, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpLspIpv4Rro) FromProto(msg *otg.RsvpLspIpv4Rro) (RsvpLspIpv4Rro, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpLspIpv4Rro) 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 *unMarshalrsvpLspIpv4Rro) 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 *marshalrsvpLspIpv4Rro) 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 *unMarshalrsvpLspIpv4Rro) 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 *marshalrsvpLspIpv4Rro) 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 *unMarshalrsvpLspIpv4Rro) 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 *rsvpLspIpv4Rro) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpLspIpv4Rro) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpLspIpv4Rro) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpLspIpv4Rro) Clone() (RsvpLspIpv4Rro, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpLspIpv4Rro() + 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 +} + +// RsvpLspIpv4Rro is this contains the list of Record Route Object(RRO) objects associated with the traffic engineering tunnel. The Record Route Object(RRO) is used in RSVP-TE to record the route traversed by the LSP. The RRO might be present in both Path message and Resv message, the RRO stores the IP addresses of the routers that the traffic engineering tunnel traversed and also the label generated and distributed by the routers. The RROs in the Resv message mirrors that of the Path message, the only difference is that the RRO in a Resv message records the path information in the reverse direction. +type RsvpLspIpv4Rro interface { + Validation + // msg marshals RsvpLspIpv4Rro to protobuf object *otg.RsvpLspIpv4Rro + // and doesn't set defaults + msg() *otg.RsvpLspIpv4Rro + // setMsg unmarshals RsvpLspIpv4Rro from protobuf object *otg.RsvpLspIpv4Rro + // and doesn't set defaults + setMsg(*otg.RsvpLspIpv4Rro) RsvpLspIpv4Rro + // provides marshal interface + Marshal() marshalRsvpLspIpv4Rro + // provides unmarshal interface + Unmarshal() unMarshalRsvpLspIpv4Rro + // validate validates RsvpLspIpv4Rro + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpLspIpv4Rro, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Address returns string, set in RsvpLspIpv4Rro. + Address() string + // SetAddress assigns string provided by user to RsvpLspIpv4Rro + SetAddress(value string) RsvpLspIpv4Rro + // HasAddress checks if Address has been set in RsvpLspIpv4Rro + HasAddress() bool + // ReportedLabel returns uint32, set in RsvpLspIpv4Rro. + ReportedLabel() uint32 + // SetReportedLabel assigns uint32 provided by user to RsvpLspIpv4Rro + SetReportedLabel(value uint32) RsvpLspIpv4Rro + // HasReportedLabel checks if ReportedLabel has been set in RsvpLspIpv4Rro + HasReportedLabel() bool +} + +// The IPv4 addresses of the routers that the traffic engineering tunnel traversed. +// Address returns a string +func (obj *rsvpLspIpv4Rro) Address() string { + + return *obj.obj.Address + +} + +// The IPv4 addresses of the routers that the traffic engineering tunnel traversed. +// Address returns a string +func (obj *rsvpLspIpv4Rro) HasAddress() bool { + return obj.obj.Address != nil +} + +// The IPv4 addresses of the routers that the traffic engineering tunnel traversed. +// SetAddress sets the string value in the RsvpLspIpv4Rro object +func (obj *rsvpLspIpv4Rro) SetAddress(value string) RsvpLspIpv4Rro { + + obj.obj.Address = &value + return obj +} + +// Label reported for RRO hop. When the Label_Recording flag is set in the Session Attribute object, nodes doing route recording should include the Label Record subobject containing the reported label. +// ReportedLabel returns a uint32 +func (obj *rsvpLspIpv4Rro) ReportedLabel() uint32 { + + return *obj.obj.ReportedLabel + +} + +// Label reported for RRO hop. When the Label_Recording flag is set in the Session Attribute object, nodes doing route recording should include the Label Record subobject containing the reported label. +// ReportedLabel returns a uint32 +func (obj *rsvpLspIpv4Rro) HasReportedLabel() bool { + return obj.obj.ReportedLabel != nil +} + +// Label reported for RRO hop. When the Label_Recording flag is set in the Session Attribute object, nodes doing route recording should include the Label Record subobject containing the reported label. +// SetReportedLabel sets the uint32 value in the RsvpLspIpv4Rro object +func (obj *rsvpLspIpv4Rro) SetReportedLabel(value uint32) RsvpLspIpv4Rro { + + obj.obj.ReportedLabel = &value + return obj +} + +func (obj *rsvpLspIpv4Rro) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Address != nil { + + err := obj.validateIpv4(obj.Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on RsvpLspIpv4Rro.Address")) + } + + } + +} + +func (obj *rsvpLspIpv4Rro) setDefault() { + +} diff --git a/gosnappi/rsvp_lsp_state.go b/gosnappi/rsvp_lsp_state.go new file mode 100644 index 00000000..ef48dd0c --- /dev/null +++ b/gosnappi/rsvp_lsp_state.go @@ -0,0 +1,528 @@ +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" +) + +// ***** RsvpLspState ***** +type rsvpLspState struct { + validation + obj *otg.RsvpLspState + marshaller marshalRsvpLspState + unMarshaller unMarshalRsvpLspState +} + +func NewRsvpLspState() RsvpLspState { + obj := rsvpLspState{obj: &otg.RsvpLspState{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpLspState) msg() *otg.RsvpLspState { + return obj.obj +} + +func (obj *rsvpLspState) setMsg(msg *otg.RsvpLspState) RsvpLspState { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpLspState struct { + obj *rsvpLspState +} + +type marshalRsvpLspState interface { + // ToProto marshals RsvpLspState to protobuf object *otg.RsvpLspState + ToProto() (*otg.RsvpLspState, error) + // ToPbText marshals RsvpLspState to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpLspState to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpLspState to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpLspState struct { + obj *rsvpLspState +} + +type unMarshalRsvpLspState interface { + // FromProto unmarshals RsvpLspState from protobuf object *otg.RsvpLspState + FromProto(msg *otg.RsvpLspState) (RsvpLspState, error) + // FromPbText unmarshals RsvpLspState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpLspState from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpLspState from JSON text + FromJson(value string) error +} + +func (obj *rsvpLspState) Marshal() marshalRsvpLspState { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpLspState{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpLspState) Unmarshal() unMarshalRsvpLspState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpLspState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpLspState) ToProto() (*otg.RsvpLspState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpLspState) FromProto(msg *otg.RsvpLspState) (RsvpLspState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpLspState) 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 *unMarshalrsvpLspState) 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 *marshalrsvpLspState) 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 *unMarshalrsvpLspState) 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 *marshalrsvpLspState) 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 *unMarshalrsvpLspState) 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 *rsvpLspState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpLspState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpLspState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpLspState) Clone() (RsvpLspState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpLspState() + 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 +} + +// RsvpLspState is iPv4 RSVP-TE Discovered LSPs. +type RsvpLspState interface { + Validation + // msg marshals RsvpLspState to protobuf object *otg.RsvpLspState + // and doesn't set defaults + msg() *otg.RsvpLspState + // setMsg unmarshals RsvpLspState from protobuf object *otg.RsvpLspState + // and doesn't set defaults + setMsg(*otg.RsvpLspState) RsvpLspState + // provides marshal interface + Marshal() marshalRsvpLspState + // provides unmarshal interface + Unmarshal() unMarshalRsvpLspState + // validate validates RsvpLspState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpLspState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // TunnelId returns uint32, set in RsvpLspState. + TunnelId() uint32 + // SetTunnelId assigns uint32 provided by user to RsvpLspState + SetTunnelId(value uint32) RsvpLspState + // HasTunnelId checks if TunnelId has been set in RsvpLspState + HasTunnelId() bool + // LspId returns uint32, set in RsvpLspState. + LspId() uint32 + // SetLspId assigns uint32 provided by user to RsvpLspState + SetLspId(value uint32) RsvpLspState + // HasLspId checks if LspId has been set in RsvpLspState + HasLspId() bool + // SessionName returns string, set in RsvpLspState. + SessionName() string + // SetSessionName assigns string provided by user to RsvpLspState + SetSessionName(value string) RsvpLspState + // HasSessionName checks if SessionName has been set in RsvpLspState + HasSessionName() bool + // LabelIn returns uint32, set in RsvpLspState. + LabelIn() uint32 + // SetLabelIn assigns uint32 provided by user to RsvpLspState + SetLabelIn(value uint32) RsvpLspState + // HasLabelIn checks if LabelIn has been set in RsvpLspState + HasLabelIn() bool + // LabelOut returns uint32, set in RsvpLspState. + LabelOut() uint32 + // SetLabelOut assigns uint32 provided by user to RsvpLspState + SetLabelOut(value uint32) RsvpLspState + // HasLabelOut checks if LabelOut has been set in RsvpLspState + HasLabelOut() bool + // SessionStatus returns RsvpLspStateSessionStatusEnum, set in RsvpLspState + SessionStatus() RsvpLspStateSessionStatusEnum + // SetSessionStatus assigns RsvpLspStateSessionStatusEnum provided by user to RsvpLspState + SetSessionStatus(value RsvpLspStateSessionStatusEnum) RsvpLspState + // HasSessionStatus checks if SessionStatus has been set in RsvpLspState + HasSessionStatus() bool + // LastFlapReason returns RsvpLspStateLastFlapReasonEnum, set in RsvpLspState + LastFlapReason() RsvpLspStateLastFlapReasonEnum + // SetLastFlapReason assigns RsvpLspStateLastFlapReasonEnum provided by user to RsvpLspState + SetLastFlapReason(value RsvpLspStateLastFlapReasonEnum) RsvpLspState + // HasLastFlapReason checks if LastFlapReason has been set in RsvpLspState + HasLastFlapReason() bool + // UpTime returns uint64, set in RsvpLspState. + UpTime() uint64 + // SetUpTime assigns uint64 provided by user to RsvpLspState + SetUpTime(value uint64) RsvpLspState + // HasUpTime checks if UpTime has been set in RsvpLspState + HasUpTime() bool +} + +// The tunnel id of RSVP session which acts as an identifier that remains constant over the life of the tunnel. +// TunnelId returns a uint32 +func (obj *rsvpLspState) TunnelId() uint32 { + + return *obj.obj.TunnelId + +} + +// The tunnel id of RSVP session which acts as an identifier that remains constant over the life of the tunnel. +// TunnelId returns a uint32 +func (obj *rsvpLspState) HasTunnelId() bool { + return obj.obj.TunnelId != nil +} + +// The tunnel id of RSVP session which acts as an identifier that remains constant over the life of the tunnel. +// SetTunnelId sets the uint32 value in the RsvpLspState object +func (obj *rsvpLspState) SetTunnelId(value uint32) RsvpLspState { + + obj.obj.TunnelId = &value + return obj +} + +// The lsp-id of RSVP session which acts as a differentiator for two lsps originating from the same headend, commonly used to distinguish RSVP sessions during make before break operations. +// LspId returns a uint32 +func (obj *rsvpLspState) LspId() uint32 { + + return *obj.obj.LspId + +} + +// The lsp-id of RSVP session which acts as a differentiator for two lsps originating from the same headend, commonly used to distinguish RSVP sessions during make before break operations. +// LspId returns a uint32 +func (obj *rsvpLspState) HasLspId() bool { + return obj.obj.LspId != nil +} + +// The lsp-id of RSVP session which acts as a differentiator for two lsps originating from the same headend, commonly used to distinguish RSVP sessions during make before break operations. +// SetLspId sets the uint32 value in the RsvpLspState object +func (obj *rsvpLspState) SetLspId(value uint32) RsvpLspState { + + obj.obj.LspId = &value + return obj +} + +// The value of RSVP-TE Session Name field of the Session Attribute object. +// SessionName returns a string +func (obj *rsvpLspState) SessionName() string { + + return *obj.obj.SessionName + +} + +// The value of RSVP-TE Session Name field of the Session Attribute object. +// SessionName returns a string +func (obj *rsvpLspState) HasSessionName() bool { + return obj.obj.SessionName != nil +} + +// The value of RSVP-TE Session Name field of the Session Attribute object. +// SetSessionName sets the string value in the RsvpLspState object +func (obj *rsvpLspState) SetSessionName(value string) RsvpLspState { + + obj.obj.SessionName = &value + return obj +} + +// The label received by RSVP-TE ingress. +// LabelIn returns a uint32 +func (obj *rsvpLspState) LabelIn() uint32 { + + return *obj.obj.LabelIn + +} + +// The label received by RSVP-TE ingress. +// LabelIn returns a uint32 +func (obj *rsvpLspState) HasLabelIn() bool { + return obj.obj.LabelIn != nil +} + +// The label received by RSVP-TE ingress. +// SetLabelIn sets the uint32 value in the RsvpLspState object +func (obj *rsvpLspState) SetLabelIn(value uint32) RsvpLspState { + + obj.obj.LabelIn = &value + return obj +} + +// The label assigned by RSVP-TE egress. +// LabelOut returns a uint32 +func (obj *rsvpLspState) LabelOut() uint32 { + + return *obj.obj.LabelOut + +} + +// The label assigned by RSVP-TE egress. +// LabelOut returns a uint32 +func (obj *rsvpLspState) HasLabelOut() bool { + return obj.obj.LabelOut != nil +} + +// The label assigned by RSVP-TE egress. +// SetLabelOut sets the uint32 value in the RsvpLspState object +func (obj *rsvpLspState) SetLabelOut(value uint32) RsvpLspState { + + obj.obj.LabelOut = &value + return obj +} + +type RsvpLspStateSessionStatusEnum string + +// Enum of SessionStatus on RsvpLspState +var RsvpLspStateSessionStatus = struct { + UP RsvpLspStateSessionStatusEnum + DOWN RsvpLspStateSessionStatusEnum +}{ + UP: RsvpLspStateSessionStatusEnum("up"), + DOWN: RsvpLspStateSessionStatusEnum("down"), +} + +func (obj *rsvpLspState) SessionStatus() RsvpLspStateSessionStatusEnum { + return RsvpLspStateSessionStatusEnum(obj.obj.SessionStatus.Enum().String()) +} + +// Operational state of the RSVP LSP. +// SessionStatus returns a string +func (obj *rsvpLspState) HasSessionStatus() bool { + return obj.obj.SessionStatus != nil +} + +func (obj *rsvpLspState) SetSessionStatus(value RsvpLspStateSessionStatusEnum) RsvpLspState { + intValue, ok := otg.RsvpLspState_SessionStatus_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on RsvpLspStateSessionStatusEnum", string(value))) + return obj + } + enumValue := otg.RsvpLspState_SessionStatus_Enum(intValue) + obj.obj.SessionStatus = &enumValue + + return obj +} + +type RsvpLspStateLastFlapReasonEnum string + +// Enum of LastFlapReason on RsvpLspState +var RsvpLspStateLastFlapReason = struct { + RESV_TEAR RsvpLspStateLastFlapReasonEnum + PATH_TEAR RsvpLspStateLastFlapReasonEnum + PATH_TIMEOUT RsvpLspStateLastFlapReasonEnum +}{ + RESV_TEAR: RsvpLspStateLastFlapReasonEnum("resv_tear"), + PATH_TEAR: RsvpLspStateLastFlapReasonEnum("path_tear"), + PATH_TIMEOUT: RsvpLspStateLastFlapReasonEnum("path_timeout"), +} + +func (obj *rsvpLspState) LastFlapReason() RsvpLspStateLastFlapReasonEnum { + return RsvpLspStateLastFlapReasonEnum(obj.obj.LastFlapReason.Enum().String()) +} + +// The reason for the last flap of this RSVP session. +// LastFlapReason returns a string +func (obj *rsvpLspState) HasLastFlapReason() bool { + return obj.obj.LastFlapReason != nil +} + +func (obj *rsvpLspState) SetLastFlapReason(value RsvpLspStateLastFlapReasonEnum) RsvpLspState { + intValue, ok := otg.RsvpLspState_LastFlapReason_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on RsvpLspStateLastFlapReasonEnum", string(value))) + return obj + } + enumValue := otg.RsvpLspState_LastFlapReason_Enum(intValue) + obj.obj.LastFlapReason = &enumValue + + return obj +} + +// The tunnel UP time in milli seconds. If the tunnel is DOWN the UP time will be zero. +// UpTime returns a uint64 +func (obj *rsvpLspState) UpTime() uint64 { + + return *obj.obj.UpTime + +} + +// The tunnel UP time in milli seconds. If the tunnel is DOWN the UP time will be zero. +// UpTime returns a uint64 +func (obj *rsvpLspState) HasUpTime() bool { + return obj.obj.UpTime != nil +} + +// The tunnel UP time in milli seconds. If the tunnel is DOWN the UP time will be zero. +// SetUpTime sets the uint64 value in the RsvpLspState object +func (obj *rsvpLspState) SetUpTime(value uint64) RsvpLspState { + + obj.obj.UpTime = &value + return obj +} + +func (obj *rsvpLspState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *rsvpLspState) setDefault() { + +} diff --git a/gosnappi/rsvp_lsps_state.go b/gosnappi/rsvp_lsps_state.go new file mode 100644 index 00000000..6189adfb --- /dev/null +++ b/gosnappi/rsvp_lsps_state.go @@ -0,0 +1,418 @@ +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" +) + +// ***** RsvpLspsState ***** +type rsvpLspsState struct { + validation + obj *otg.RsvpLspsState + marshaller marshalRsvpLspsState + unMarshaller unMarshalRsvpLspsState + ipv4LspsHolder RsvpLspsStateRsvpIPv4LspStateIter +} + +func NewRsvpLspsState() RsvpLspsState { + obj := rsvpLspsState{obj: &otg.RsvpLspsState{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpLspsState) msg() *otg.RsvpLspsState { + return obj.obj +} + +func (obj *rsvpLspsState) setMsg(msg *otg.RsvpLspsState) RsvpLspsState { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpLspsState struct { + obj *rsvpLspsState +} + +type marshalRsvpLspsState interface { + // ToProto marshals RsvpLspsState to protobuf object *otg.RsvpLspsState + ToProto() (*otg.RsvpLspsState, error) + // ToPbText marshals RsvpLspsState to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpLspsState to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpLspsState to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpLspsState struct { + obj *rsvpLspsState +} + +type unMarshalRsvpLspsState interface { + // FromProto unmarshals RsvpLspsState from protobuf object *otg.RsvpLspsState + FromProto(msg *otg.RsvpLspsState) (RsvpLspsState, error) + // FromPbText unmarshals RsvpLspsState from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpLspsState from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpLspsState from JSON text + FromJson(value string) error +} + +func (obj *rsvpLspsState) Marshal() marshalRsvpLspsState { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpLspsState{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpLspsState) Unmarshal() unMarshalRsvpLspsState { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpLspsState{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpLspsState) ToProto() (*otg.RsvpLspsState, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpLspsState) FromProto(msg *otg.RsvpLspsState) (RsvpLspsState, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpLspsState) 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 *unMarshalrsvpLspsState) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalrsvpLspsState) 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 *unMarshalrsvpLspsState) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalrsvpLspsState) 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 *unMarshalrsvpLspsState) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *rsvpLspsState) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpLspsState) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpLspsState) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpLspsState) Clone() (RsvpLspsState, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpLspsState() + 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 +} + +func (obj *rsvpLspsState) setNil() { + obj.ipv4LspsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// RsvpLspsState is discovered IPv4 Point-to-Point LSPs of a RSVP-TE router. +type RsvpLspsState interface { + Validation + // msg marshals RsvpLspsState to protobuf object *otg.RsvpLspsState + // and doesn't set defaults + msg() *otg.RsvpLspsState + // setMsg unmarshals RsvpLspsState from protobuf object *otg.RsvpLspsState + // and doesn't set defaults + setMsg(*otg.RsvpLspsState) RsvpLspsState + // provides marshal interface + Marshal() marshalRsvpLspsState + // provides unmarshal interface + Unmarshal() unMarshalRsvpLspsState + // validate validates RsvpLspsState + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpLspsState, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RsvpRouterName returns string, set in RsvpLspsState. + RsvpRouterName() string + // SetRsvpRouterName assigns string provided by user to RsvpLspsState + SetRsvpRouterName(value string) RsvpLspsState + // HasRsvpRouterName checks if RsvpRouterName has been set in RsvpLspsState + HasRsvpRouterName() bool + // Ipv4Lsps returns RsvpLspsStateRsvpIPv4LspStateIterIter, set in RsvpLspsState + Ipv4Lsps() RsvpLspsStateRsvpIPv4LspStateIter + setNil() +} + +// The name of the RSVP-TE Router. +// RsvpRouterName returns a string +func (obj *rsvpLspsState) RsvpRouterName() string { + + return *obj.obj.RsvpRouterName + +} + +// The name of the RSVP-TE Router. +// RsvpRouterName returns a string +func (obj *rsvpLspsState) HasRsvpRouterName() bool { + return obj.obj.RsvpRouterName != nil +} + +// The name of the RSVP-TE Router. +// SetRsvpRouterName sets the string value in the RsvpLspsState object +func (obj *rsvpLspsState) SetRsvpRouterName(value string) RsvpLspsState { + + obj.obj.RsvpRouterName = &value + return obj +} + +// IPv4 Point-to-Point RSVP-TE Discovered LSPs. +// Ipv4Lsps returns a []RsvpIPv4LspState +func (obj *rsvpLspsState) Ipv4Lsps() RsvpLspsStateRsvpIPv4LspStateIter { + if len(obj.obj.Ipv4Lsps) == 0 { + obj.obj.Ipv4Lsps = []*otg.RsvpIPv4LspState{} + } + if obj.ipv4LspsHolder == nil { + obj.ipv4LspsHolder = newRsvpLspsStateRsvpIPv4LspStateIter(&obj.obj.Ipv4Lsps).setMsg(obj) + } + return obj.ipv4LspsHolder +} + +type rsvpLspsStateRsvpIPv4LspStateIter struct { + obj *rsvpLspsState + rsvpIPv4LspStateSlice []RsvpIPv4LspState + fieldPtr *[]*otg.RsvpIPv4LspState +} + +func newRsvpLspsStateRsvpIPv4LspStateIter(ptr *[]*otg.RsvpIPv4LspState) RsvpLspsStateRsvpIPv4LspStateIter { + return &rsvpLspsStateRsvpIPv4LspStateIter{fieldPtr: ptr} +} + +type RsvpLspsStateRsvpIPv4LspStateIter interface { + setMsg(*rsvpLspsState) RsvpLspsStateRsvpIPv4LspStateIter + Items() []RsvpIPv4LspState + Add() RsvpIPv4LspState + Append(items ...RsvpIPv4LspState) RsvpLspsStateRsvpIPv4LspStateIter + Set(index int, newObj RsvpIPv4LspState) RsvpLspsStateRsvpIPv4LspStateIter + Clear() RsvpLspsStateRsvpIPv4LspStateIter + clearHolderSlice() RsvpLspsStateRsvpIPv4LspStateIter + appendHolderSlice(item RsvpIPv4LspState) RsvpLspsStateRsvpIPv4LspStateIter +} + +func (obj *rsvpLspsStateRsvpIPv4LspStateIter) setMsg(msg *rsvpLspsState) RsvpLspsStateRsvpIPv4LspStateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&rsvpIPv4LspState{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *rsvpLspsStateRsvpIPv4LspStateIter) Items() []RsvpIPv4LspState { + return obj.rsvpIPv4LspStateSlice +} + +func (obj *rsvpLspsStateRsvpIPv4LspStateIter) Add() RsvpIPv4LspState { + newObj := &otg.RsvpIPv4LspState{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &rsvpIPv4LspState{obj: newObj} + newLibObj.setDefault() + obj.rsvpIPv4LspStateSlice = append(obj.rsvpIPv4LspStateSlice, newLibObj) + return newLibObj +} + +func (obj *rsvpLspsStateRsvpIPv4LspStateIter) Append(items ...RsvpIPv4LspState) RsvpLspsStateRsvpIPv4LspStateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.rsvpIPv4LspStateSlice = append(obj.rsvpIPv4LspStateSlice, item) + } + return obj +} + +func (obj *rsvpLspsStateRsvpIPv4LspStateIter) Set(index int, newObj RsvpIPv4LspState) RsvpLspsStateRsvpIPv4LspStateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.rsvpIPv4LspStateSlice[index] = newObj + return obj +} +func (obj *rsvpLspsStateRsvpIPv4LspStateIter) Clear() RsvpLspsStateRsvpIPv4LspStateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.RsvpIPv4LspState{} + obj.rsvpIPv4LspStateSlice = []RsvpIPv4LspState{} + } + return obj +} +func (obj *rsvpLspsStateRsvpIPv4LspStateIter) clearHolderSlice() RsvpLspsStateRsvpIPv4LspStateIter { + if len(obj.rsvpIPv4LspStateSlice) > 0 { + obj.rsvpIPv4LspStateSlice = []RsvpIPv4LspState{} + } + return obj +} +func (obj *rsvpLspsStateRsvpIPv4LspStateIter) appendHolderSlice(item RsvpIPv4LspState) RsvpLspsStateRsvpIPv4LspStateIter { + obj.rsvpIPv4LspStateSlice = append(obj.rsvpIPv4LspStateSlice, item) + return obj +} + +func (obj *rsvpLspsState) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Ipv4Lsps) != 0 { + + if set_default { + obj.Ipv4Lsps().clearHolderSlice() + for _, item := range obj.obj.Ipv4Lsps { + obj.Ipv4Lsps().appendHolderSlice(&rsvpIPv4LspState{obj: item}) + } + } + for _, item := range obj.Ipv4Lsps().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *rsvpLspsState) setDefault() { + +} diff --git a/gosnappi/rsvp_lsps_state_request.go b/gosnappi/rsvp_lsps_state_request.go new file mode 100644 index 00000000..99828c9c --- /dev/null +++ b/gosnappi/rsvp_lsps_state_request.go @@ -0,0 +1,317 @@ +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" +) + +// ***** RsvpLspsStateRequest ***** +type rsvpLspsStateRequest struct { + validation + obj *otg.RsvpLspsStateRequest + marshaller marshalRsvpLspsStateRequest + unMarshaller unMarshalRsvpLspsStateRequest +} + +func NewRsvpLspsStateRequest() RsvpLspsStateRequest { + obj := rsvpLspsStateRequest{obj: &otg.RsvpLspsStateRequest{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpLspsStateRequest) msg() *otg.RsvpLspsStateRequest { + return obj.obj +} + +func (obj *rsvpLspsStateRequest) setMsg(msg *otg.RsvpLspsStateRequest) RsvpLspsStateRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpLspsStateRequest struct { + obj *rsvpLspsStateRequest +} + +type marshalRsvpLspsStateRequest interface { + // ToProto marshals RsvpLspsStateRequest to protobuf object *otg.RsvpLspsStateRequest + ToProto() (*otg.RsvpLspsStateRequest, error) + // ToPbText marshals RsvpLspsStateRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpLspsStateRequest to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpLspsStateRequest to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpLspsStateRequest struct { + obj *rsvpLspsStateRequest +} + +type unMarshalRsvpLspsStateRequest interface { + // FromProto unmarshals RsvpLspsStateRequest from protobuf object *otg.RsvpLspsStateRequest + FromProto(msg *otg.RsvpLspsStateRequest) (RsvpLspsStateRequest, error) + // FromPbText unmarshals RsvpLspsStateRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpLspsStateRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpLspsStateRequest from JSON text + FromJson(value string) error +} + +func (obj *rsvpLspsStateRequest) Marshal() marshalRsvpLspsStateRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpLspsStateRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpLspsStateRequest) Unmarshal() unMarshalRsvpLspsStateRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpLspsStateRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpLspsStateRequest) ToProto() (*otg.RsvpLspsStateRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpLspsStateRequest) FromProto(msg *otg.RsvpLspsStateRequest) (RsvpLspsStateRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpLspsStateRequest) 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 *unMarshalrsvpLspsStateRequest) 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 *marshalrsvpLspsStateRequest) 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 *unMarshalrsvpLspsStateRequest) 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 *marshalrsvpLspsStateRequest) 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 *unMarshalrsvpLspsStateRequest) 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 *rsvpLspsStateRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpLspsStateRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpLspsStateRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpLspsStateRequest) Clone() (RsvpLspsStateRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpLspsStateRequest() + 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 +} + +// RsvpLspsStateRequest is the request to retrieve RSVP Label Switched Path (LSP) information learned by the router. +type RsvpLspsStateRequest interface { + Validation + // msg marshals RsvpLspsStateRequest to protobuf object *otg.RsvpLspsStateRequest + // and doesn't set defaults + msg() *otg.RsvpLspsStateRequest + // setMsg unmarshals RsvpLspsStateRequest from protobuf object *otg.RsvpLspsStateRequest + // and doesn't set defaults + setMsg(*otg.RsvpLspsStateRequest) RsvpLspsStateRequest + // provides marshal interface + Marshal() marshalRsvpLspsStateRequest + // provides unmarshal interface + Unmarshal() unMarshalRsvpLspsStateRequest + // validate validates RsvpLspsStateRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpLspsStateRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RsvpRouterNames returns []string, set in RsvpLspsStateRequest. + RsvpRouterNames() []string + // SetRsvpRouterNames assigns []string provided by user to RsvpLspsStateRequest + SetRsvpRouterNames(value []string) RsvpLspsStateRequest +} + +// The names of RSVP-TE routers for which learned information is requested. An empty list will return results for all RSVP=TE routers. +// +// x-constraint: +// - /components/schemas/Device.Rsvp/properties/name +// +// x-constraint: +// - /components/schemas/Device.Rsvp/properties/name +// +// RsvpRouterNames returns a []string +func (obj *rsvpLspsStateRequest) RsvpRouterNames() []string { + if obj.obj.RsvpRouterNames == nil { + obj.obj.RsvpRouterNames = make([]string, 0) + } + return obj.obj.RsvpRouterNames +} + +// The names of RSVP-TE routers for which learned information is requested. An empty list will return results for all RSVP=TE routers. +// +// x-constraint: +// - /components/schemas/Device.Rsvp/properties/name +// +// x-constraint: +// - /components/schemas/Device.Rsvp/properties/name +// +// SetRsvpRouterNames sets the []string value in the RsvpLspsStateRequest object +func (obj *rsvpLspsStateRequest) SetRsvpRouterNames(value []string) RsvpLspsStateRequest { + + if obj.obj.RsvpRouterNames == nil { + obj.obj.RsvpRouterNames = make([]string, 0) + } + obj.obj.RsvpRouterNames = value + + return obj +} + +func (obj *rsvpLspsStateRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *rsvpLspsStateRequest) setDefault() { + +} diff --git a/gosnappi/rsvp_metric.go b/gosnappi/rsvp_metric.go new file mode 100644 index 00000000..3efc0753 --- /dev/null +++ b/gosnappi/rsvp_metric.go @@ -0,0 +1,1146 @@ +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" +) + +// ***** RsvpMetric ***** +type rsvpMetric struct { + validation + obj *otg.RsvpMetric + marshaller marshalRsvpMetric + unMarshaller unMarshalRsvpMetric +} + +func NewRsvpMetric() RsvpMetric { + obj := rsvpMetric{obj: &otg.RsvpMetric{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpMetric) msg() *otg.RsvpMetric { + return obj.obj +} + +func (obj *rsvpMetric) setMsg(msg *otg.RsvpMetric) RsvpMetric { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpMetric struct { + obj *rsvpMetric +} + +type marshalRsvpMetric interface { + // ToProto marshals RsvpMetric to protobuf object *otg.RsvpMetric + ToProto() (*otg.RsvpMetric, error) + // ToPbText marshals RsvpMetric to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpMetric to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpMetric to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpMetric struct { + obj *rsvpMetric +} + +type unMarshalRsvpMetric interface { + // FromProto unmarshals RsvpMetric from protobuf object *otg.RsvpMetric + FromProto(msg *otg.RsvpMetric) (RsvpMetric, error) + // FromPbText unmarshals RsvpMetric from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpMetric from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpMetric from JSON text + FromJson(value string) error +} + +func (obj *rsvpMetric) Marshal() marshalRsvpMetric { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpMetric{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpMetric) Unmarshal() unMarshalRsvpMetric { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpMetric{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpMetric) ToProto() (*otg.RsvpMetric, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpMetric) FromProto(msg *otg.RsvpMetric) (RsvpMetric, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpMetric) 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 *unMarshalrsvpMetric) 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 *marshalrsvpMetric) 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 *unMarshalrsvpMetric) 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 *marshalrsvpMetric) 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 *unMarshalrsvpMetric) 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 *rsvpMetric) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpMetric) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpMetric) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpMetric) Clone() (RsvpMetric, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpMetric() + 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 +} + +// RsvpMetric is rSVP-TE per router statistics information. +type RsvpMetric interface { + Validation + // msg marshals RsvpMetric to protobuf object *otg.RsvpMetric + // and doesn't set defaults + msg() *otg.RsvpMetric + // setMsg unmarshals RsvpMetric from protobuf object *otg.RsvpMetric + // and doesn't set defaults + setMsg(*otg.RsvpMetric) RsvpMetric + // provides marshal interface + Marshal() marshalRsvpMetric + // provides unmarshal interface + Unmarshal() unMarshalRsvpMetric + // validate validates RsvpMetric + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpMetric, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Name returns string, set in RsvpMetric. + Name() string + // SetName assigns string provided by user to RsvpMetric + SetName(value string) RsvpMetric + // HasName checks if Name has been set in RsvpMetric + HasName() bool + // IngressP2PLspsConfigured returns uint32, set in RsvpMetric. + IngressP2PLspsConfigured() uint32 + // SetIngressP2PLspsConfigured assigns uint32 provided by user to RsvpMetric + SetIngressP2PLspsConfigured(value uint32) RsvpMetric + // HasIngressP2PLspsConfigured checks if IngressP2PLspsConfigured has been set in RsvpMetric + HasIngressP2PLspsConfigured() bool + // IngressP2PLspsUp returns uint32, set in RsvpMetric. + IngressP2PLspsUp() uint32 + // SetIngressP2PLspsUp assigns uint32 provided by user to RsvpMetric + SetIngressP2PLspsUp(value uint32) RsvpMetric + // HasIngressP2PLspsUp checks if IngressP2PLspsUp has been set in RsvpMetric + HasIngressP2PLspsUp() bool + // EgressP2PLspsUp returns uint32, set in RsvpMetric. + EgressP2PLspsUp() uint32 + // SetEgressP2PLspsUp assigns uint32 provided by user to RsvpMetric + SetEgressP2PLspsUp(value uint32) RsvpMetric + // HasEgressP2PLspsUp checks if EgressP2PLspsUp has been set in RsvpMetric + HasEgressP2PLspsUp() bool + // LspFlapCount returns uint64, set in RsvpMetric. + LspFlapCount() uint64 + // SetLspFlapCount assigns uint64 provided by user to RsvpMetric + SetLspFlapCount(value uint64) RsvpMetric + // HasLspFlapCount checks if LspFlapCount has been set in RsvpMetric + HasLspFlapCount() bool + // PathsTx returns uint64, set in RsvpMetric. + PathsTx() uint64 + // SetPathsTx assigns uint64 provided by user to RsvpMetric + SetPathsTx(value uint64) RsvpMetric + // HasPathsTx checks if PathsTx has been set in RsvpMetric + HasPathsTx() bool + // PathsRx returns uint64, set in RsvpMetric. + PathsRx() uint64 + // SetPathsRx assigns uint64 provided by user to RsvpMetric + SetPathsRx(value uint64) RsvpMetric + // HasPathsRx checks if PathsRx has been set in RsvpMetric + HasPathsRx() bool + // ResvsTx returns uint64, set in RsvpMetric. + ResvsTx() uint64 + // SetResvsTx assigns uint64 provided by user to RsvpMetric + SetResvsTx(value uint64) RsvpMetric + // HasResvsTx checks if ResvsTx has been set in RsvpMetric + HasResvsTx() bool + // ResvsRx returns uint64, set in RsvpMetric. + ResvsRx() uint64 + // SetResvsRx assigns uint64 provided by user to RsvpMetric + SetResvsRx(value uint64) RsvpMetric + // HasResvsRx checks if ResvsRx has been set in RsvpMetric + HasResvsRx() bool + // PathTearsTx returns uint64, set in RsvpMetric. + PathTearsTx() uint64 + // SetPathTearsTx assigns uint64 provided by user to RsvpMetric + SetPathTearsTx(value uint64) RsvpMetric + // HasPathTearsTx checks if PathTearsTx has been set in RsvpMetric + HasPathTearsTx() bool + // PathTearsRx returns uint64, set in RsvpMetric. + PathTearsRx() uint64 + // SetPathTearsRx assigns uint64 provided by user to RsvpMetric + SetPathTearsRx(value uint64) RsvpMetric + // HasPathTearsRx checks if PathTearsRx has been set in RsvpMetric + HasPathTearsRx() bool + // ResvTearsTx returns uint64, set in RsvpMetric. + ResvTearsTx() uint64 + // SetResvTearsTx assigns uint64 provided by user to RsvpMetric + SetResvTearsTx(value uint64) RsvpMetric + // HasResvTearsTx checks if ResvTearsTx has been set in RsvpMetric + HasResvTearsTx() bool + // ResvTearsRx returns uint64, set in RsvpMetric. + ResvTearsRx() uint64 + // SetResvTearsRx assigns uint64 provided by user to RsvpMetric + SetResvTearsRx(value uint64) RsvpMetric + // HasResvTearsRx checks if ResvTearsRx has been set in RsvpMetric + HasResvTearsRx() bool + // PathErrorsTx returns uint64, set in RsvpMetric. + PathErrorsTx() uint64 + // SetPathErrorsTx assigns uint64 provided by user to RsvpMetric + SetPathErrorsTx(value uint64) RsvpMetric + // HasPathErrorsTx checks if PathErrorsTx has been set in RsvpMetric + HasPathErrorsTx() bool + // PathErrorsRx returns uint64, set in RsvpMetric. + PathErrorsRx() uint64 + // SetPathErrorsRx assigns uint64 provided by user to RsvpMetric + SetPathErrorsRx(value uint64) RsvpMetric + // HasPathErrorsRx checks if PathErrorsRx has been set in RsvpMetric + HasPathErrorsRx() bool + // ResvErrorsTx returns uint64, set in RsvpMetric. + ResvErrorsTx() uint64 + // SetResvErrorsTx assigns uint64 provided by user to RsvpMetric + SetResvErrorsTx(value uint64) RsvpMetric + // HasResvErrorsTx checks if ResvErrorsTx has been set in RsvpMetric + HasResvErrorsTx() bool + // ResvErrorsRx returns uint64, set in RsvpMetric. + ResvErrorsRx() uint64 + // SetResvErrorsRx assigns uint64 provided by user to RsvpMetric + SetResvErrorsRx(value uint64) RsvpMetric + // HasResvErrorsRx checks if ResvErrorsRx has been set in RsvpMetric + HasResvErrorsRx() bool + // ResvConfTx returns uint64, set in RsvpMetric. + ResvConfTx() uint64 + // SetResvConfTx assigns uint64 provided by user to RsvpMetric + SetResvConfTx(value uint64) RsvpMetric + // HasResvConfTx checks if ResvConfTx has been set in RsvpMetric + HasResvConfTx() bool + // ResvConfRx returns uint64, set in RsvpMetric. + ResvConfRx() uint64 + // SetResvConfRx assigns uint64 provided by user to RsvpMetric + SetResvConfRx(value uint64) RsvpMetric + // HasResvConfRx checks if ResvConfRx has been set in RsvpMetric + HasResvConfRx() bool + // HellosTx returns uint64, set in RsvpMetric. + HellosTx() uint64 + // SetHellosTx assigns uint64 provided by user to RsvpMetric + SetHellosTx(value uint64) RsvpMetric + // HasHellosTx checks if HellosTx has been set in RsvpMetric + HasHellosTx() bool + // HellosRx returns uint64, set in RsvpMetric. + HellosRx() uint64 + // SetHellosRx assigns uint64 provided by user to RsvpMetric + SetHellosRx(value uint64) RsvpMetric + // HasHellosRx checks if HellosRx has been set in RsvpMetric + HasHellosRx() bool + // AcksTx returns uint64, set in RsvpMetric. + AcksTx() uint64 + // SetAcksTx assigns uint64 provided by user to RsvpMetric + SetAcksTx(value uint64) RsvpMetric + // HasAcksTx checks if AcksTx has been set in RsvpMetric + HasAcksTx() bool + // AcksRx returns uint64, set in RsvpMetric. + AcksRx() uint64 + // SetAcksRx assigns uint64 provided by user to RsvpMetric + SetAcksRx(value uint64) RsvpMetric + // HasAcksRx checks if AcksRx has been set in RsvpMetric + HasAcksRx() bool + // NacksTx returns uint64, set in RsvpMetric. + NacksTx() uint64 + // SetNacksTx assigns uint64 provided by user to RsvpMetric + SetNacksTx(value uint64) RsvpMetric + // HasNacksTx checks if NacksTx has been set in RsvpMetric + HasNacksTx() bool + // NacksRx returns uint64, set in RsvpMetric. + NacksRx() uint64 + // SetNacksRx assigns uint64 provided by user to RsvpMetric + SetNacksRx(value uint64) RsvpMetric + // HasNacksRx checks if NacksRx has been set in RsvpMetric + HasNacksRx() bool + // SrefreshTx returns uint64, set in RsvpMetric. + SrefreshTx() uint64 + // SetSrefreshTx assigns uint64 provided by user to RsvpMetric + SetSrefreshTx(value uint64) RsvpMetric + // HasSrefreshTx checks if SrefreshTx has been set in RsvpMetric + HasSrefreshTx() bool + // SrefreshRx returns uint64, set in RsvpMetric. + SrefreshRx() uint64 + // SetSrefreshRx assigns uint64 provided by user to RsvpMetric + SetSrefreshRx(value uint64) RsvpMetric + // HasSrefreshRx checks if SrefreshRx has been set in RsvpMetric + HasSrefreshRx() bool + // BundleTx returns uint64, set in RsvpMetric. + BundleTx() uint64 + // SetBundleTx assigns uint64 provided by user to RsvpMetric + SetBundleTx(value uint64) RsvpMetric + // HasBundleTx checks if BundleTx has been set in RsvpMetric + HasBundleTx() bool + // BundleRx returns uint64, set in RsvpMetric. + BundleRx() uint64 + // SetBundleRx assigns uint64 provided by user to RsvpMetric + SetBundleRx(value uint64) RsvpMetric + // HasBundleRx checks if BundleRx has been set in RsvpMetric + HasBundleRx() bool + // PathReevaluationRequestTx returns uint64, set in RsvpMetric. + PathReevaluationRequestTx() uint64 + // SetPathReevaluationRequestTx assigns uint64 provided by user to RsvpMetric + SetPathReevaluationRequestTx(value uint64) RsvpMetric + // HasPathReevaluationRequestTx checks if PathReevaluationRequestTx has been set in RsvpMetric + HasPathReevaluationRequestTx() bool + // PathReoptimizations returns uint64, set in RsvpMetric. + PathReoptimizations() uint64 + // SetPathReoptimizations assigns uint64 provided by user to RsvpMetric + SetPathReoptimizations(value uint64) RsvpMetric + // HasPathReoptimizations checks if PathReoptimizations has been set in RsvpMetric + HasPathReoptimizations() bool +} + +// The name of a configured RSVP router. +// Name returns a string +func (obj *rsvpMetric) Name() string { + + return *obj.obj.Name + +} + +// The name of a configured RSVP router. +// Name returns a string +func (obj *rsvpMetric) HasName() bool { + return obj.obj.Name != nil +} + +// The name of a configured RSVP router. +// SetName sets the string value in the RsvpMetric object +func (obj *rsvpMetric) SetName(value string) RsvpMetric { + + obj.obj.Name = &value + return obj +} + +// The number of ingress point-to-point LSPs configured or transiting through the RSVP router which have been initated from the test port. +// IngressP2PLspsConfigured returns a uint32 +func (obj *rsvpMetric) IngressP2PLspsConfigured() uint32 { + + return *obj.obj.IngressP2PLspsConfigured + +} + +// The number of ingress point-to-point LSPs configured or transiting through the RSVP router which have been initated from the test port. +// IngressP2PLspsConfigured returns a uint32 +func (obj *rsvpMetric) HasIngressP2PLspsConfigured() bool { + return obj.obj.IngressP2PLspsConfigured != nil +} + +// The number of ingress point-to-point LSPs configured or transiting through the RSVP router which have been initated from the test port. +// SetIngressP2PLspsConfigured sets the uint32 value in the RsvpMetric object +func (obj *rsvpMetric) SetIngressP2PLspsConfigured(value uint32) RsvpMetric { + + obj.obj.IngressP2PLspsConfigured = &value + return obj +} + +// The number of ingress point-to-point LSPs for which Resv has been received and is currently up. +// IngressP2PLspsUp returns a uint32 +func (obj *rsvpMetric) IngressP2PLspsUp() uint32 { + + return *obj.obj.IngressP2PLspsUp + +} + +// The number of ingress point-to-point LSPs for which Resv has been received and is currently up. +// IngressP2PLspsUp returns a uint32 +func (obj *rsvpMetric) HasIngressP2PLspsUp() bool { + return obj.obj.IngressP2PLspsUp != nil +} + +// The number of ingress point-to-point LSPs for which Resv has been received and is currently up. +// SetIngressP2PLspsUp sets the uint32 value in the RsvpMetric object +func (obj *rsvpMetric) SetIngressP2PLspsUp(value uint32) RsvpMetric { + + obj.obj.IngressP2PLspsUp = &value + return obj +} + +// The number of egress point-to-point LSPs for which Path requests were successfully processed and is currently up. +// EgressP2PLspsUp returns a uint32 +func (obj *rsvpMetric) EgressP2PLspsUp() uint32 { + + return *obj.obj.EgressP2PLspsUp + +} + +// The number of egress point-to-point LSPs for which Path requests were successfully processed and is currently up. +// EgressP2PLspsUp returns a uint32 +func (obj *rsvpMetric) HasEgressP2PLspsUp() bool { + return obj.obj.EgressP2PLspsUp != nil +} + +// The number of egress point-to-point LSPs for which Path requests were successfully processed and is currently up. +// SetEgressP2PLspsUp sets the uint32 value in the RsvpMetric object +func (obj *rsvpMetric) SetEgressP2PLspsUp(value uint32) RsvpMetric { + + obj.obj.EgressP2PLspsUp = &value + return obj +} + +// The number of times an LSP went from up to down state either because it timed out while waiting for Refreshes or a PathTear or ResvTear message was received which caused the LSP to flap. +// LspFlapCount returns a uint64 +func (obj *rsvpMetric) LspFlapCount() uint64 { + + return *obj.obj.LspFlapCount + +} + +// The number of times an LSP went from up to down state either because it timed out while waiting for Refreshes or a PathTear or ResvTear message was received which caused the LSP to flap. +// LspFlapCount returns a uint64 +func (obj *rsvpMetric) HasLspFlapCount() bool { + return obj.obj.LspFlapCount != nil +} + +// The number of times an LSP went from up to down state either because it timed out while waiting for Refreshes or a PathTear or ResvTear message was received which caused the LSP to flap. +// SetLspFlapCount sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetLspFlapCount(value uint64) RsvpMetric { + + obj.obj.LspFlapCount = &value + return obj +} + +// The number of Path messages sent by this RSVP router. +// PathsTx returns a uint64 +func (obj *rsvpMetric) PathsTx() uint64 { + + return *obj.obj.PathsTx + +} + +// The number of Path messages sent by this RSVP router. +// PathsTx returns a uint64 +func (obj *rsvpMetric) HasPathsTx() bool { + return obj.obj.PathsTx != nil +} + +// The number of Path messages sent by this RSVP router. +// SetPathsTx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetPathsTx(value uint64) RsvpMetric { + + obj.obj.PathsTx = &value + return obj +} + +// The number of Path messages received by this RSVP router. +// PathsRx returns a uint64 +func (obj *rsvpMetric) PathsRx() uint64 { + + return *obj.obj.PathsRx + +} + +// The number of Path messages received by this RSVP router. +// PathsRx returns a uint64 +func (obj *rsvpMetric) HasPathsRx() bool { + return obj.obj.PathsRx != nil +} + +// The number of Path messages received by this RSVP router. +// SetPathsRx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetPathsRx(value uint64) RsvpMetric { + + obj.obj.PathsRx = &value + return obj +} + +// The number of Resv messages sent by this RSVP router. +// ResvsTx returns a uint64 +func (obj *rsvpMetric) ResvsTx() uint64 { + + return *obj.obj.ResvsTx + +} + +// The number of Resv messages sent by this RSVP router. +// ResvsTx returns a uint64 +func (obj *rsvpMetric) HasResvsTx() bool { + return obj.obj.ResvsTx != nil +} + +// The number of Resv messages sent by this RSVP router. +// SetResvsTx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetResvsTx(value uint64) RsvpMetric { + + obj.obj.ResvsTx = &value + return obj +} + +// The number of Resv messages received by this RSVP router. +// ResvsRx returns a uint64 +func (obj *rsvpMetric) ResvsRx() uint64 { + + return *obj.obj.ResvsRx + +} + +// The number of Resv messages received by this RSVP router. +// ResvsRx returns a uint64 +func (obj *rsvpMetric) HasResvsRx() bool { + return obj.obj.ResvsRx != nil +} + +// The number of Resv messages received by this RSVP router. +// SetResvsRx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetResvsRx(value uint64) RsvpMetric { + + obj.obj.ResvsRx = &value + return obj +} + +// The number of Path Tear messages sent by this RSVP router. +// PathTearsTx returns a uint64 +func (obj *rsvpMetric) PathTearsTx() uint64 { + + return *obj.obj.PathTearsTx + +} + +// The number of Path Tear messages sent by this RSVP router. +// PathTearsTx returns a uint64 +func (obj *rsvpMetric) HasPathTearsTx() bool { + return obj.obj.PathTearsTx != nil +} + +// The number of Path Tear messages sent by this RSVP router. +// SetPathTearsTx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetPathTearsTx(value uint64) RsvpMetric { + + obj.obj.PathTearsTx = &value + return obj +} + +// The number of Path Tear messages received by this RSVP router. +// PathTearsRx returns a uint64 +func (obj *rsvpMetric) PathTearsRx() uint64 { + + return *obj.obj.PathTearsRx + +} + +// The number of Path Tear messages received by this RSVP router. +// PathTearsRx returns a uint64 +func (obj *rsvpMetric) HasPathTearsRx() bool { + return obj.obj.PathTearsRx != nil +} + +// The number of Path Tear messages received by this RSVP router. +// SetPathTearsRx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetPathTearsRx(value uint64) RsvpMetric { + + obj.obj.PathTearsRx = &value + return obj +} + +// The number of Resv Tear messages sent by this RSVP router. +// ResvTearsTx returns a uint64 +func (obj *rsvpMetric) ResvTearsTx() uint64 { + + return *obj.obj.ResvTearsTx + +} + +// The number of Resv Tear messages sent by this RSVP router. +// ResvTearsTx returns a uint64 +func (obj *rsvpMetric) HasResvTearsTx() bool { + return obj.obj.ResvTearsTx != nil +} + +// The number of Resv Tear messages sent by this RSVP router. +// SetResvTearsTx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetResvTearsTx(value uint64) RsvpMetric { + + obj.obj.ResvTearsTx = &value + return obj +} + +// The number of Resv Tear messages received by this RSVP router. +// ResvTearsRx returns a uint64 +func (obj *rsvpMetric) ResvTearsRx() uint64 { + + return *obj.obj.ResvTearsRx + +} + +// The number of Resv Tear messages received by this RSVP router. +// ResvTearsRx returns a uint64 +func (obj *rsvpMetric) HasResvTearsRx() bool { + return obj.obj.ResvTearsRx != nil +} + +// The number of Resv Tear messages received by this RSVP router. +// SetResvTearsRx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetResvTearsRx(value uint64) RsvpMetric { + + obj.obj.ResvTearsRx = &value + return obj +} + +// The number of Path Error messages sent by this RSVP router. +// PathErrorsTx returns a uint64 +func (obj *rsvpMetric) PathErrorsTx() uint64 { + + return *obj.obj.PathErrorsTx + +} + +// The number of Path Error messages sent by this RSVP router. +// PathErrorsTx returns a uint64 +func (obj *rsvpMetric) HasPathErrorsTx() bool { + return obj.obj.PathErrorsTx != nil +} + +// The number of Path Error messages sent by this RSVP router. +// SetPathErrorsTx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetPathErrorsTx(value uint64) RsvpMetric { + + obj.obj.PathErrorsTx = &value + return obj +} + +// The number of Path Error messages received by this RSVP router. +// PathErrorsRx returns a uint64 +func (obj *rsvpMetric) PathErrorsRx() uint64 { + + return *obj.obj.PathErrorsRx + +} + +// The number of Path Error messages received by this RSVP router. +// PathErrorsRx returns a uint64 +func (obj *rsvpMetric) HasPathErrorsRx() bool { + return obj.obj.PathErrorsRx != nil +} + +// The number of Path Error messages received by this RSVP router. +// SetPathErrorsRx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetPathErrorsRx(value uint64) RsvpMetric { + + obj.obj.PathErrorsRx = &value + return obj +} + +// The number of Resv Error messages sent by this RSVP router. +// ResvErrorsTx returns a uint64 +func (obj *rsvpMetric) ResvErrorsTx() uint64 { + + return *obj.obj.ResvErrorsTx + +} + +// The number of Resv Error messages sent by this RSVP router. +// ResvErrorsTx returns a uint64 +func (obj *rsvpMetric) HasResvErrorsTx() bool { + return obj.obj.ResvErrorsTx != nil +} + +// The number of Resv Error messages sent by this RSVP router. +// SetResvErrorsTx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetResvErrorsTx(value uint64) RsvpMetric { + + obj.obj.ResvErrorsTx = &value + return obj +} + +// The number of Resv Error messages received by this RSVP router. +// ResvErrorsRx returns a uint64 +func (obj *rsvpMetric) ResvErrorsRx() uint64 { + + return *obj.obj.ResvErrorsRx + +} + +// The number of Resv Error messages received by this RSVP router. +// ResvErrorsRx returns a uint64 +func (obj *rsvpMetric) HasResvErrorsRx() bool { + return obj.obj.ResvErrorsRx != nil +} + +// The number of Resv Error messages received by this RSVP router. +// SetResvErrorsRx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetResvErrorsRx(value uint64) RsvpMetric { + + obj.obj.ResvErrorsRx = &value + return obj +} + +// The number of ResvConf messages sent by this RSVP router. +// ResvConfTx returns a uint64 +func (obj *rsvpMetric) ResvConfTx() uint64 { + + return *obj.obj.ResvConfTx + +} + +// The number of ResvConf messages sent by this RSVP router. +// ResvConfTx returns a uint64 +func (obj *rsvpMetric) HasResvConfTx() bool { + return obj.obj.ResvConfTx != nil +} + +// The number of ResvConf messages sent by this RSVP router. +// SetResvConfTx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetResvConfTx(value uint64) RsvpMetric { + + obj.obj.ResvConfTx = &value + return obj +} + +// The number of ResvConf messages received by this RSVP router. +// ResvConfRx returns a uint64 +func (obj *rsvpMetric) ResvConfRx() uint64 { + + return *obj.obj.ResvConfRx + +} + +// The number of ResvConf messages received by this RSVP router. +// ResvConfRx returns a uint64 +func (obj *rsvpMetric) HasResvConfRx() bool { + return obj.obj.ResvConfRx != nil +} + +// The number of ResvConf messages received by this RSVP router. +// SetResvConfRx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetResvConfRx(value uint64) RsvpMetric { + + obj.obj.ResvConfRx = &value + return obj +} + +// The number of Hello messages sent by this RSVP router. +// HellosTx returns a uint64 +func (obj *rsvpMetric) HellosTx() uint64 { + + return *obj.obj.HellosTx + +} + +// The number of Hello messages sent by this RSVP router. +// HellosTx returns a uint64 +func (obj *rsvpMetric) HasHellosTx() bool { + return obj.obj.HellosTx != nil +} + +// The number of Hello messages sent by this RSVP router. +// SetHellosTx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetHellosTx(value uint64) RsvpMetric { + + obj.obj.HellosTx = &value + return obj +} + +// The number of Hello messages received by this RSVP router. +// HellosRx returns a uint64 +func (obj *rsvpMetric) HellosRx() uint64 { + + return *obj.obj.HellosRx + +} + +// The number of Hello messages received by this RSVP router. +// HellosRx returns a uint64 +func (obj *rsvpMetric) HasHellosRx() bool { + return obj.obj.HellosRx != nil +} + +// The number of Hello messages received by this RSVP router. +// SetHellosRx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetHellosRx(value uint64) RsvpMetric { + + obj.obj.HellosRx = &value + return obj +} + +// The number of Ack messages sent by this RSVP router. +// AcksTx returns a uint64 +func (obj *rsvpMetric) AcksTx() uint64 { + + return *obj.obj.AcksTx + +} + +// The number of Ack messages sent by this RSVP router. +// AcksTx returns a uint64 +func (obj *rsvpMetric) HasAcksTx() bool { + return obj.obj.AcksTx != nil +} + +// The number of Ack messages sent by this RSVP router. +// SetAcksTx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetAcksTx(value uint64) RsvpMetric { + + obj.obj.AcksTx = &value + return obj +} + +// The number of Ack messages received by this RSVP router. +// AcksRx returns a uint64 +func (obj *rsvpMetric) AcksRx() uint64 { + + return *obj.obj.AcksRx + +} + +// The number of Ack messages received by this RSVP router. +// AcksRx returns a uint64 +func (obj *rsvpMetric) HasAcksRx() bool { + return obj.obj.AcksRx != nil +} + +// The number of Ack messages received by this RSVP router. +// SetAcksRx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetAcksRx(value uint64) RsvpMetric { + + obj.obj.AcksRx = &value + return obj +} + +// The number of Nack messages sent by this RSVP router. +// NacksTx returns a uint64 +func (obj *rsvpMetric) NacksTx() uint64 { + + return *obj.obj.NacksTx + +} + +// The number of Nack messages sent by this RSVP router. +// NacksTx returns a uint64 +func (obj *rsvpMetric) HasNacksTx() bool { + return obj.obj.NacksTx != nil +} + +// The number of Nack messages sent by this RSVP router. +// SetNacksTx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetNacksTx(value uint64) RsvpMetric { + + obj.obj.NacksTx = &value + return obj +} + +// The number of Nack messages received by this RSVP router. +// NacksRx returns a uint64 +func (obj *rsvpMetric) NacksRx() uint64 { + + return *obj.obj.NacksRx + +} + +// The number of Nack messages received by this RSVP router. +// NacksRx returns a uint64 +func (obj *rsvpMetric) HasNacksRx() bool { + return obj.obj.NacksRx != nil +} + +// The number of Nack messages received by this RSVP router. +// SetNacksRx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetNacksRx(value uint64) RsvpMetric { + + obj.obj.NacksRx = &value + return obj +} + +// The number of SRefresh messages sent by this RSVP router. +// SrefreshTx returns a uint64 +func (obj *rsvpMetric) SrefreshTx() uint64 { + + return *obj.obj.SrefreshTx + +} + +// The number of SRefresh messages sent by this RSVP router. +// SrefreshTx returns a uint64 +func (obj *rsvpMetric) HasSrefreshTx() bool { + return obj.obj.SrefreshTx != nil +} + +// The number of SRefresh messages sent by this RSVP router. +// SetSrefreshTx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetSrefreshTx(value uint64) RsvpMetric { + + obj.obj.SrefreshTx = &value + return obj +} + +// The number of SRefresh messages received by this RSVP router. +// SrefreshRx returns a uint64 +func (obj *rsvpMetric) SrefreshRx() uint64 { + + return *obj.obj.SrefreshRx + +} + +// The number of SRefresh messages received by this RSVP router. +// SrefreshRx returns a uint64 +func (obj *rsvpMetric) HasSrefreshRx() bool { + return obj.obj.SrefreshRx != nil +} + +// The number of SRefresh messages received by this RSVP router. +// SetSrefreshRx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetSrefreshRx(value uint64) RsvpMetric { + + obj.obj.SrefreshRx = &value + return obj +} + +// The number of Bundle messages sent by this RSVP router. +// BundleTx returns a uint64 +func (obj *rsvpMetric) BundleTx() uint64 { + + return *obj.obj.BundleTx + +} + +// The number of Bundle messages sent by this RSVP router. +// BundleTx returns a uint64 +func (obj *rsvpMetric) HasBundleTx() bool { + return obj.obj.BundleTx != nil +} + +// The number of Bundle messages sent by this RSVP router. +// SetBundleTx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetBundleTx(value uint64) RsvpMetric { + + obj.obj.BundleTx = &value + return obj +} + +// The number of Bundle messages received by this RSVP router. +// BundleRx returns a uint64 +func (obj *rsvpMetric) BundleRx() uint64 { + + return *obj.obj.BundleRx + +} + +// The number of Bundle messages received by this RSVP router. +// BundleRx returns a uint64 +func (obj *rsvpMetric) HasBundleRx() bool { + return obj.obj.BundleRx != nil +} + +// The number of Bundle messages received by this RSVP router. +// SetBundleRx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetBundleRx(value uint64) RsvpMetric { + + obj.obj.BundleRx = &value + return obj +} + +// The number of Path messages with Path Re-evaluation Request enabled sent by this RSVP router. +// PathReevaluationRequestTx returns a uint64 +func (obj *rsvpMetric) PathReevaluationRequestTx() uint64 { + + return *obj.obj.PathReevaluationRequestTx + +} + +// The number of Path messages with Path Re-evaluation Request enabled sent by this RSVP router. +// PathReevaluationRequestTx returns a uint64 +func (obj *rsvpMetric) HasPathReevaluationRequestTx() bool { + return obj.obj.PathReevaluationRequestTx != nil +} + +// The number of Path messages with Path Re-evaluation Request enabled sent by this RSVP router. +// SetPathReevaluationRequestTx sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetPathReevaluationRequestTx(value uint64) RsvpMetric { + + obj.obj.PathReevaluationRequestTx = &value + return obj +} + +// The number of successfully completed Make-Before-Break operations on LSPs on this RSVP router. +// PathReoptimizations returns a uint64 +func (obj *rsvpMetric) PathReoptimizations() uint64 { + + return *obj.obj.PathReoptimizations + +} + +// The number of successfully completed Make-Before-Break operations on LSPs on this RSVP router. +// PathReoptimizations returns a uint64 +func (obj *rsvpMetric) HasPathReoptimizations() bool { + return obj.obj.PathReoptimizations != nil +} + +// The number of successfully completed Make-Before-Break operations on LSPs on this RSVP router. +// SetPathReoptimizations sets the uint64 value in the RsvpMetric object +func (obj *rsvpMetric) SetPathReoptimizations(value uint64) RsvpMetric { + + obj.obj.PathReoptimizations = &value + return obj +} + +func (obj *rsvpMetric) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *rsvpMetric) setDefault() { + +} diff --git a/gosnappi/rsvp_metrics_request.go b/gosnappi/rsvp_metrics_request.go new file mode 100644 index 00000000..eb703d8e --- /dev/null +++ b/gosnappi/rsvp_metrics_request.go @@ -0,0 +1,409 @@ +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" +) + +// ***** RsvpMetricsRequest ***** +type rsvpMetricsRequest struct { + validation + obj *otg.RsvpMetricsRequest + marshaller marshalRsvpMetricsRequest + unMarshaller unMarshalRsvpMetricsRequest +} + +func NewRsvpMetricsRequest() RsvpMetricsRequest { + obj := rsvpMetricsRequest{obj: &otg.RsvpMetricsRequest{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpMetricsRequest) msg() *otg.RsvpMetricsRequest { + return obj.obj +} + +func (obj *rsvpMetricsRequest) setMsg(msg *otg.RsvpMetricsRequest) RsvpMetricsRequest { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpMetricsRequest struct { + obj *rsvpMetricsRequest +} + +type marshalRsvpMetricsRequest interface { + // ToProto marshals RsvpMetricsRequest to protobuf object *otg.RsvpMetricsRequest + ToProto() (*otg.RsvpMetricsRequest, error) + // ToPbText marshals RsvpMetricsRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpMetricsRequest to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpMetricsRequest to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpMetricsRequest struct { + obj *rsvpMetricsRequest +} + +type unMarshalRsvpMetricsRequest interface { + // FromProto unmarshals RsvpMetricsRequest from protobuf object *otg.RsvpMetricsRequest + FromProto(msg *otg.RsvpMetricsRequest) (RsvpMetricsRequest, error) + // FromPbText unmarshals RsvpMetricsRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpMetricsRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpMetricsRequest from JSON text + FromJson(value string) error +} + +func (obj *rsvpMetricsRequest) Marshal() marshalRsvpMetricsRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpMetricsRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpMetricsRequest) Unmarshal() unMarshalRsvpMetricsRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpMetricsRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpMetricsRequest) ToProto() (*otg.RsvpMetricsRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpMetricsRequest) FromProto(msg *otg.RsvpMetricsRequest) (RsvpMetricsRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpMetricsRequest) 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 *unMarshalrsvpMetricsRequest) 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 *marshalrsvpMetricsRequest) 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 *unMarshalrsvpMetricsRequest) 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 *marshalrsvpMetricsRequest) 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 *unMarshalrsvpMetricsRequest) 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 *rsvpMetricsRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpMetricsRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpMetricsRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpMetricsRequest) Clone() (RsvpMetricsRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpMetricsRequest() + 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 +} + +// RsvpMetricsRequest is the request to retrieve RSVP-TE per Router metrics/statistics. +type RsvpMetricsRequest interface { + Validation + // msg marshals RsvpMetricsRequest to protobuf object *otg.RsvpMetricsRequest + // and doesn't set defaults + msg() *otg.RsvpMetricsRequest + // setMsg unmarshals RsvpMetricsRequest from protobuf object *otg.RsvpMetricsRequest + // and doesn't set defaults + setMsg(*otg.RsvpMetricsRequest) RsvpMetricsRequest + // provides marshal interface + Marshal() marshalRsvpMetricsRequest + // provides unmarshal interface + Unmarshal() unMarshalRsvpMetricsRequest + // validate validates RsvpMetricsRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpMetricsRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RouterNames returns []string, set in RsvpMetricsRequest. + RouterNames() []string + // SetRouterNames assigns []string provided by user to RsvpMetricsRequest + SetRouterNames(value []string) RsvpMetricsRequest + // ColumnNames returns []RsvpMetricsRequestColumnNamesEnum, set in RsvpMetricsRequest + ColumnNames() []RsvpMetricsRequestColumnNamesEnum + // SetColumnNames assigns []RsvpMetricsRequestColumnNamesEnum provided by user to RsvpMetricsRequest + SetColumnNames(value []RsvpMetricsRequestColumnNamesEnum) RsvpMetricsRequest +} + +// The names of RSVP-TE Routers to return results for. An empty list as input will return results for all RSVP-TE routers. +// +// x-constraint: +// - /components/schemas/Device.Rsvp/properties/name +// +// x-constraint: +// - /components/schemas/Device.Rsvp/properties/name +// +// RouterNames returns a []string +func (obj *rsvpMetricsRequest) RouterNames() []string { + if obj.obj.RouterNames == nil { + obj.obj.RouterNames = make([]string, 0) + } + return obj.obj.RouterNames +} + +// The names of RSVP-TE Routers to return results for. An empty list as input will return results for all RSVP-TE routers. +// +// x-constraint: +// - /components/schemas/Device.Rsvp/properties/name +// +// x-constraint: +// - /components/schemas/Device.Rsvp/properties/name +// +// SetRouterNames sets the []string value in the RsvpMetricsRequest object +func (obj *rsvpMetricsRequest) SetRouterNames(value []string) RsvpMetricsRequest { + + if obj.obj.RouterNames == nil { + obj.obj.RouterNames = make([]string, 0) + } + obj.obj.RouterNames = value + + return obj +} + +type RsvpMetricsRequestColumnNamesEnum string + +// Enum of ColumnNames on RsvpMetricsRequest +var RsvpMetricsRequestColumnNames = struct { + INGRESS_P2P_LSPS_CONFIGURED RsvpMetricsRequestColumnNamesEnum + INGRESS_P2P_LSPS_UP RsvpMetricsRequestColumnNamesEnum + EGRESS_P2P_LSPS_UP RsvpMetricsRequestColumnNamesEnum + LSP_FLAP_COUNT RsvpMetricsRequestColumnNamesEnum + PATHS_TX RsvpMetricsRequestColumnNamesEnum + PATHS_RX RsvpMetricsRequestColumnNamesEnum + RESVS_TX RsvpMetricsRequestColumnNamesEnum + RESVS_RX RsvpMetricsRequestColumnNamesEnum + PATH_TEARS_TX RsvpMetricsRequestColumnNamesEnum + PATH_TEARS_RX RsvpMetricsRequestColumnNamesEnum + RESV_TEARS_TX RsvpMetricsRequestColumnNamesEnum + RESV_TEARS_RX RsvpMetricsRequestColumnNamesEnum + PATH_ERRORS_TX RsvpMetricsRequestColumnNamesEnum + PATH_ERRORS_RX RsvpMetricsRequestColumnNamesEnum + RESV_ERRORS_TX RsvpMetricsRequestColumnNamesEnum + RESV_ERRORS_RX RsvpMetricsRequestColumnNamesEnum + RESV_CONF_TX RsvpMetricsRequestColumnNamesEnum + RESV_CONF_RX RsvpMetricsRequestColumnNamesEnum + HELLOS_TX RsvpMetricsRequestColumnNamesEnum + HELLOS_RX RsvpMetricsRequestColumnNamesEnum + ACKS_TX RsvpMetricsRequestColumnNamesEnum + ACKS_RX RsvpMetricsRequestColumnNamesEnum + NACKS_TX RsvpMetricsRequestColumnNamesEnum + NACKS_RX RsvpMetricsRequestColumnNamesEnum + SREFRESH_TX RsvpMetricsRequestColumnNamesEnum + SREFRESH_RX RsvpMetricsRequestColumnNamesEnum + BUNDLE_TX RsvpMetricsRequestColumnNamesEnum + BUNDLE_RX RsvpMetricsRequestColumnNamesEnum + PATH_REEVALUATION_REQUEST_TX RsvpMetricsRequestColumnNamesEnum + PATH_REOPTIMIZATIONS RsvpMetricsRequestColumnNamesEnum +}{ + INGRESS_P2P_LSPS_CONFIGURED: RsvpMetricsRequestColumnNamesEnum("ingress_p2p_lsps_configured"), + INGRESS_P2P_LSPS_UP: RsvpMetricsRequestColumnNamesEnum("ingress_p2p_lsps_up"), + EGRESS_P2P_LSPS_UP: RsvpMetricsRequestColumnNamesEnum("egress_p2p_lsps_up"), + LSP_FLAP_COUNT: RsvpMetricsRequestColumnNamesEnum("lsp_flap_count"), + PATHS_TX: RsvpMetricsRequestColumnNamesEnum("paths_tx"), + PATHS_RX: RsvpMetricsRequestColumnNamesEnum("paths_rx"), + RESVS_TX: RsvpMetricsRequestColumnNamesEnum("resvs_tx"), + RESVS_RX: RsvpMetricsRequestColumnNamesEnum("resvs_rx"), + PATH_TEARS_TX: RsvpMetricsRequestColumnNamesEnum("path_tears_tx"), + PATH_TEARS_RX: RsvpMetricsRequestColumnNamesEnum("path_tears_rx"), + RESV_TEARS_TX: RsvpMetricsRequestColumnNamesEnum("resv_tears_tx"), + RESV_TEARS_RX: RsvpMetricsRequestColumnNamesEnum("resv_tears_rx"), + PATH_ERRORS_TX: RsvpMetricsRequestColumnNamesEnum("path_errors_tx"), + PATH_ERRORS_RX: RsvpMetricsRequestColumnNamesEnum("path_errors_rx"), + RESV_ERRORS_TX: RsvpMetricsRequestColumnNamesEnum("resv_errors_tx"), + RESV_ERRORS_RX: RsvpMetricsRequestColumnNamesEnum("resv_errors_rx"), + RESV_CONF_TX: RsvpMetricsRequestColumnNamesEnum("resv_conf_tx"), + RESV_CONF_RX: RsvpMetricsRequestColumnNamesEnum("resv_conf_rx"), + HELLOS_TX: RsvpMetricsRequestColumnNamesEnum("hellos_tx"), + HELLOS_RX: RsvpMetricsRequestColumnNamesEnum("hellos_rx"), + ACKS_TX: RsvpMetricsRequestColumnNamesEnum("acks_tx"), + ACKS_RX: RsvpMetricsRequestColumnNamesEnum("acks_rx"), + NACKS_TX: RsvpMetricsRequestColumnNamesEnum("nacks_tx"), + NACKS_RX: RsvpMetricsRequestColumnNamesEnum("nacks_rx"), + SREFRESH_TX: RsvpMetricsRequestColumnNamesEnum("srefresh_tx"), + SREFRESH_RX: RsvpMetricsRequestColumnNamesEnum("srefresh_rx"), + BUNDLE_TX: RsvpMetricsRequestColumnNamesEnum("bundle_tx"), + BUNDLE_RX: RsvpMetricsRequestColumnNamesEnum("bundle_rx"), + PATH_REEVALUATION_REQUEST_TX: RsvpMetricsRequestColumnNamesEnum("path_reevaluation_request_tx"), + PATH_REOPTIMIZATIONS: RsvpMetricsRequestColumnNamesEnum("path_reoptimizations"), +} + +func (obj *rsvpMetricsRequest) ColumnNames() []RsvpMetricsRequestColumnNamesEnum { + items := []RsvpMetricsRequestColumnNamesEnum{} + for _, item := range obj.obj.ColumnNames { + items = append(items, RsvpMetricsRequestColumnNamesEnum(item.String())) + } + return items +} + +// The list of column names that the returned result set will contain. If the input list is empty then all columns will be returned except for any result_groups. +// SetColumnNames sets the []string value in the RsvpMetricsRequest object +func (obj *rsvpMetricsRequest) SetColumnNames(value []RsvpMetricsRequestColumnNamesEnum) RsvpMetricsRequest { + + items := []otg.RsvpMetricsRequest_ColumnNames_Enum{} + for _, item := range value { + intValue := otg.RsvpMetricsRequest_ColumnNames_Enum_value[string(item)] + items = append(items, otg.RsvpMetricsRequest_ColumnNames_Enum(intValue)) + } + obj.obj.ColumnNames = items + return obj +} + +func (obj *rsvpMetricsRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *rsvpMetricsRequest) setDefault() { + +} diff --git a/gosnappi/rsvp_resource_affinities.go b/gosnappi/rsvp_resource_affinities.go new file mode 100644 index 00000000..2693df24 --- /dev/null +++ b/gosnappi/rsvp_resource_affinities.go @@ -0,0 +1,409 @@ +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" +) + +// ***** RsvpResourceAffinities ***** +type rsvpResourceAffinities struct { + validation + obj *otg.RsvpResourceAffinities + marshaller marshalRsvpResourceAffinities + unMarshaller unMarshalRsvpResourceAffinities +} + +func NewRsvpResourceAffinities() RsvpResourceAffinities { + obj := rsvpResourceAffinities{obj: &otg.RsvpResourceAffinities{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpResourceAffinities) msg() *otg.RsvpResourceAffinities { + return obj.obj +} + +func (obj *rsvpResourceAffinities) setMsg(msg *otg.RsvpResourceAffinities) RsvpResourceAffinities { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpResourceAffinities struct { + obj *rsvpResourceAffinities +} + +type marshalRsvpResourceAffinities interface { + // ToProto marshals RsvpResourceAffinities to protobuf object *otg.RsvpResourceAffinities + ToProto() (*otg.RsvpResourceAffinities, error) + // ToPbText marshals RsvpResourceAffinities to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpResourceAffinities to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpResourceAffinities to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpResourceAffinities struct { + obj *rsvpResourceAffinities +} + +type unMarshalRsvpResourceAffinities interface { + // FromProto unmarshals RsvpResourceAffinities from protobuf object *otg.RsvpResourceAffinities + FromProto(msg *otg.RsvpResourceAffinities) (RsvpResourceAffinities, error) + // FromPbText unmarshals RsvpResourceAffinities from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpResourceAffinities from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpResourceAffinities from JSON text + FromJson(value string) error +} + +func (obj *rsvpResourceAffinities) Marshal() marshalRsvpResourceAffinities { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpResourceAffinities{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpResourceAffinities) Unmarshal() unMarshalRsvpResourceAffinities { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpResourceAffinities{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpResourceAffinities) ToProto() (*otg.RsvpResourceAffinities, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpResourceAffinities) FromProto(msg *otg.RsvpResourceAffinities) (RsvpResourceAffinities, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpResourceAffinities) 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 *unMarshalrsvpResourceAffinities) 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 *marshalrsvpResourceAffinities) 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 *unMarshalrsvpResourceAffinities) 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 *marshalrsvpResourceAffinities) 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 *unMarshalrsvpResourceAffinities) 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 *rsvpResourceAffinities) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpResourceAffinities) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpResourceAffinities) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpResourceAffinities) Clone() (RsvpResourceAffinities, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpResourceAffinities() + 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 +} + +// RsvpResourceAffinities is this is an optional object. If included, the extended SESSION_ATTRIBUTE object is sent in the Path message containing +// the additional fields included in this object. This contains a set of three bitmaps using which further constraints can be +// set on the path calculated for the LSP based on the Admin Group settings in the IGP (e.g ISIS or OSPF interface). +type RsvpResourceAffinities interface { + Validation + // msg marshals RsvpResourceAffinities to protobuf object *otg.RsvpResourceAffinities + // and doesn't set defaults + msg() *otg.RsvpResourceAffinities + // setMsg unmarshals RsvpResourceAffinities from protobuf object *otg.RsvpResourceAffinities + // and doesn't set defaults + setMsg(*otg.RsvpResourceAffinities) RsvpResourceAffinities + // provides marshal interface + Marshal() marshalRsvpResourceAffinities + // provides unmarshal interface + Unmarshal() unMarshalRsvpResourceAffinities + // validate validates RsvpResourceAffinities + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpResourceAffinities, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ExcludeAny returns string, set in RsvpResourceAffinities. + ExcludeAny() string + // SetExcludeAny assigns string provided by user to RsvpResourceAffinities + SetExcludeAny(value string) RsvpResourceAffinities + // HasExcludeAny checks if ExcludeAny has been set in RsvpResourceAffinities + HasExcludeAny() bool + // IncludeAny returns string, set in RsvpResourceAffinities. + IncludeAny() string + // SetIncludeAny assigns string provided by user to RsvpResourceAffinities + SetIncludeAny(value string) RsvpResourceAffinities + // HasIncludeAny checks if IncludeAny has been set in RsvpResourceAffinities + HasIncludeAny() bool + // IncludeAll returns string, set in RsvpResourceAffinities. + IncludeAll() string + // SetIncludeAll assigns string provided by user to RsvpResourceAffinities + SetIncludeAll(value string) RsvpResourceAffinities + // HasIncludeAll checks if IncludeAll has been set in RsvpResourceAffinities + HasIncludeAll() bool +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// ExcludeAny returns a string +func (obj *rsvpResourceAffinities) ExcludeAny() string { + + return *obj.obj.ExcludeAny + +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// ExcludeAny returns a string +func (obj *rsvpResourceAffinities) HasExcludeAny() bool { + return obj.obj.ExcludeAny != nil +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link unacceptable. A null set (all bits set to zero) doesn't render the link unacceptable. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// SetExcludeAny sets the string value in the RsvpResourceAffinities object +func (obj *rsvpResourceAffinities) SetExcludeAny(value string) RsvpResourceAffinities { + + obj.obj.ExcludeAny = &value + return obj +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// IncludeAny returns a string +func (obj *rsvpResourceAffinities) IncludeAny() string { + + return *obj.obj.IncludeAny + +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// IncludeAny returns a string +func (obj *rsvpResourceAffinities) HasIncludeAny() bool { + return obj.obj.IncludeAny != nil +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel any of which renders a link acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// SetIncludeAny sets the string value in the RsvpResourceAffinities object +func (obj *rsvpResourceAffinities) SetIncludeAny(value string) RsvpResourceAffinities { + + obj.obj.IncludeAny = &value + return obj +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// IncludeAll returns a string +func (obj *rsvpResourceAffinities) IncludeAll() string { + + return *obj.obj.IncludeAll + +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// IncludeAll returns a string +func (obj *rsvpResourceAffinities) HasIncludeAll() bool { + return obj.obj.IncludeAll != nil +} + +// A 32-bit vector representing a set of attribute filters associated with a tunnel all of which must be present for a link to be acceptable. A null set (all bits set to zero) automatically passes. The most significant byte in the hex-string is the farthest to the left in the byte sequence. Leading zero bytes in the configured value may be omitted for brevity. +// SetIncludeAll sets the string value in the RsvpResourceAffinities object +func (obj *rsvpResourceAffinities) SetIncludeAll(value string) RsvpResourceAffinities { + + obj.obj.IncludeAll = &value + return obj +} + +func (obj *rsvpResourceAffinities) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.ExcludeAny != nil { + + if len(*obj.obj.ExcludeAny) < 0 || len(*obj.obj.ExcludeAny) > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of RsvpResourceAffinities.ExcludeAny <= 8 but Got %d", + len(*obj.obj.ExcludeAny))) + } + + } + + if obj.obj.IncludeAny != nil { + + if len(*obj.obj.IncludeAny) < 0 || len(*obj.obj.IncludeAny) > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of RsvpResourceAffinities.IncludeAny <= 8 but Got %d", + len(*obj.obj.IncludeAny))) + } + + } + + if obj.obj.IncludeAll != nil { + + if len(*obj.obj.IncludeAll) < 0 || len(*obj.obj.IncludeAll) > 8 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of RsvpResourceAffinities.IncludeAll <= 8 but Got %d", + len(*obj.obj.IncludeAll))) + } + + } + +} + +func (obj *rsvpResourceAffinities) setDefault() { + if obj.obj.ExcludeAny == nil { + obj.SetExcludeAny("0") + } + if obj.obj.IncludeAny == nil { + obj.SetIncludeAny("0") + } + if obj.obj.IncludeAll == nil { + obj.SetIncludeAll("0") + } + +} diff --git a/gosnappi/rsvp_session_attribute.go b/gosnappi/rsvp_session_attribute.go new file mode 100644 index 00000000..d1dc8251 --- /dev/null +++ b/gosnappi/rsvp_session_attribute.go @@ -0,0 +1,646 @@ +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" +) + +// ***** RsvpSessionAttribute ***** +type rsvpSessionAttribute struct { + validation + obj *otg.RsvpSessionAttribute + marshaller marshalRsvpSessionAttribute + unMarshaller unMarshalRsvpSessionAttribute + resourceAffinitiesHolder RsvpResourceAffinities +} + +func NewRsvpSessionAttribute() RsvpSessionAttribute { + obj := rsvpSessionAttribute{obj: &otg.RsvpSessionAttribute{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpSessionAttribute) msg() *otg.RsvpSessionAttribute { + return obj.obj +} + +func (obj *rsvpSessionAttribute) setMsg(msg *otg.RsvpSessionAttribute) RsvpSessionAttribute { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpSessionAttribute struct { + obj *rsvpSessionAttribute +} + +type marshalRsvpSessionAttribute interface { + // ToProto marshals RsvpSessionAttribute to protobuf object *otg.RsvpSessionAttribute + ToProto() (*otg.RsvpSessionAttribute, error) + // ToPbText marshals RsvpSessionAttribute to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpSessionAttribute to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpSessionAttribute to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpSessionAttribute struct { + obj *rsvpSessionAttribute +} + +type unMarshalRsvpSessionAttribute interface { + // FromProto unmarshals RsvpSessionAttribute from protobuf object *otg.RsvpSessionAttribute + FromProto(msg *otg.RsvpSessionAttribute) (RsvpSessionAttribute, error) + // FromPbText unmarshals RsvpSessionAttribute from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpSessionAttribute from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpSessionAttribute from JSON text + FromJson(value string) error +} + +func (obj *rsvpSessionAttribute) Marshal() marshalRsvpSessionAttribute { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpSessionAttribute{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpSessionAttribute) Unmarshal() unMarshalRsvpSessionAttribute { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpSessionAttribute{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpSessionAttribute) ToProto() (*otg.RsvpSessionAttribute, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpSessionAttribute) FromProto(msg *otg.RsvpSessionAttribute) (RsvpSessionAttribute, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpSessionAttribute) 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 *unMarshalrsvpSessionAttribute) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalrsvpSessionAttribute) 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 *unMarshalrsvpSessionAttribute) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalrsvpSessionAttribute) 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 *unMarshalrsvpSessionAttribute) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *rsvpSessionAttribute) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpSessionAttribute) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpSessionAttribute) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpSessionAttribute) Clone() (RsvpSessionAttribute, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpSessionAttribute() + 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 +} + +func (obj *rsvpSessionAttribute) setNil() { + obj.resourceAffinitiesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// RsvpSessionAttribute is configuration for RSVP-TE SESSION_ATTRIBUTE object included in Path Messages as defined in RFC3209. The bandwidth_protection_desired and node_protection_desired flags are defined in RFC4090 (Fast Reroute). +type RsvpSessionAttribute interface { + Validation + // msg marshals RsvpSessionAttribute to protobuf object *otg.RsvpSessionAttribute + // and doesn't set defaults + msg() *otg.RsvpSessionAttribute + // setMsg unmarshals RsvpSessionAttribute from protobuf object *otg.RsvpSessionAttribute + // and doesn't set defaults + setMsg(*otg.RsvpSessionAttribute) RsvpSessionAttribute + // provides marshal interface + Marshal() marshalRsvpSessionAttribute + // provides unmarshal interface + Unmarshal() unMarshalRsvpSessionAttribute + // validate validates RsvpSessionAttribute + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpSessionAttribute, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // AutoGenerateSessionName returns bool, set in RsvpSessionAttribute. + AutoGenerateSessionName() bool + // SetAutoGenerateSessionName assigns bool provided by user to RsvpSessionAttribute + SetAutoGenerateSessionName(value bool) RsvpSessionAttribute + // HasAutoGenerateSessionName checks if AutoGenerateSessionName has been set in RsvpSessionAttribute + HasAutoGenerateSessionName() bool + // SessionName returns string, set in RsvpSessionAttribute. + SessionName() string + // SetSessionName assigns string provided by user to RsvpSessionAttribute + SetSessionName(value string) RsvpSessionAttribute + // HasSessionName checks if SessionName has been set in RsvpSessionAttribute + HasSessionName() bool + // SetupPriority returns uint32, set in RsvpSessionAttribute. + SetupPriority() uint32 + // SetSetupPriority assigns uint32 provided by user to RsvpSessionAttribute + SetSetupPriority(value uint32) RsvpSessionAttribute + // HasSetupPriority checks if SetupPriority has been set in RsvpSessionAttribute + HasSetupPriority() bool + // HoldingPriority returns uint32, set in RsvpSessionAttribute. + HoldingPriority() uint32 + // SetHoldingPriority assigns uint32 provided by user to RsvpSessionAttribute + SetHoldingPriority(value uint32) RsvpSessionAttribute + // HasHoldingPriority checks if HoldingPriority has been set in RsvpSessionAttribute + HasHoldingPriority() bool + // LocalProtectionDesired returns bool, set in RsvpSessionAttribute. + LocalProtectionDesired() bool + // SetLocalProtectionDesired assigns bool provided by user to RsvpSessionAttribute + SetLocalProtectionDesired(value bool) RsvpSessionAttribute + // HasLocalProtectionDesired checks if LocalProtectionDesired has been set in RsvpSessionAttribute + HasLocalProtectionDesired() bool + // LabelRecordingDesired returns bool, set in RsvpSessionAttribute. + LabelRecordingDesired() bool + // SetLabelRecordingDesired assigns bool provided by user to RsvpSessionAttribute + SetLabelRecordingDesired(value bool) RsvpSessionAttribute + // HasLabelRecordingDesired checks if LabelRecordingDesired has been set in RsvpSessionAttribute + HasLabelRecordingDesired() bool + // SeStyleDesired returns bool, set in RsvpSessionAttribute. + SeStyleDesired() bool + // SetSeStyleDesired assigns bool provided by user to RsvpSessionAttribute + SetSeStyleDesired(value bool) RsvpSessionAttribute + // HasSeStyleDesired checks if SeStyleDesired has been set in RsvpSessionAttribute + HasSeStyleDesired() bool + // BandwidthProtectionDesired returns bool, set in RsvpSessionAttribute. + BandwidthProtectionDesired() bool + // SetBandwidthProtectionDesired assigns bool provided by user to RsvpSessionAttribute + SetBandwidthProtectionDesired(value bool) RsvpSessionAttribute + // HasBandwidthProtectionDesired checks if BandwidthProtectionDesired has been set in RsvpSessionAttribute + HasBandwidthProtectionDesired() bool + // NodeProtectionDesired returns bool, set in RsvpSessionAttribute. + NodeProtectionDesired() bool + // SetNodeProtectionDesired assigns bool provided by user to RsvpSessionAttribute + SetNodeProtectionDesired(value bool) RsvpSessionAttribute + // HasNodeProtectionDesired checks if NodeProtectionDesired has been set in RsvpSessionAttribute + HasNodeProtectionDesired() bool + // ResourceAffinities returns RsvpResourceAffinities, set in RsvpSessionAttribute. + // RsvpResourceAffinities is this is an optional object. If included, the extended SESSION_ATTRIBUTE object is sent in the Path message containing + // the additional fields included in this object. This contains a set of three bitmaps using which further constraints can be + // set on the path calculated for the LSP based on the Admin Group settings in the IGP (e.g ISIS or OSPF interface). + ResourceAffinities() RsvpResourceAffinities + // SetResourceAffinities assigns RsvpResourceAffinities provided by user to RsvpSessionAttribute. + // RsvpResourceAffinities is this is an optional object. If included, the extended SESSION_ATTRIBUTE object is sent in the Path message containing + // the additional fields included in this object. This contains a set of three bitmaps using which further constraints can be + // set on the path calculated for the LSP based on the Admin Group settings in the IGP (e.g ISIS or OSPF interface). + SetResourceAffinities(value RsvpResourceAffinities) RsvpSessionAttribute + // HasResourceAffinities checks if ResourceAffinities has been set in RsvpSessionAttribute + HasResourceAffinities() bool + setNil() +} + +// If this is enabled, an auto-generated Session Name is included in the SESSION_ATTRIBUTE object in the Path Message for this LSP. +// AutoGenerateSessionName returns a bool +func (obj *rsvpSessionAttribute) AutoGenerateSessionName() bool { + + return *obj.obj.AutoGenerateSessionName + +} + +// If this is enabled, an auto-generated Session Name is included in the SESSION_ATTRIBUTE object in the Path Message for this LSP. +// AutoGenerateSessionName returns a bool +func (obj *rsvpSessionAttribute) HasAutoGenerateSessionName() bool { + return obj.obj.AutoGenerateSessionName != nil +} + +// If this is enabled, an auto-generated Session Name is included in the SESSION_ATTRIBUTE object in the Path Message for this LSP. +// SetAutoGenerateSessionName sets the bool value in the RsvpSessionAttribute object +func (obj *rsvpSessionAttribute) SetAutoGenerateSessionName(value bool) RsvpSessionAttribute { + + obj.obj.AutoGenerateSessionName = &value + return obj +} + +// If auto_generate_session_name is set to 'false', then the value of this field is used to fill the Session Name field of the SESSION_ATTRIBUTE object in the Path Message for this LSP. It is suggested to include the Local IP, Remote IP, Tunnel ID and LSP ID in the auto-generated Session Name to ensure uniqueness of the name in the test. The maximum length of session name is 254 bytes. +// SessionName returns a string +func (obj *rsvpSessionAttribute) SessionName() string { + + return *obj.obj.SessionName + +} + +// If auto_generate_session_name is set to 'false', then the value of this field is used to fill the Session Name field of the SESSION_ATTRIBUTE object in the Path Message for this LSP. It is suggested to include the Local IP, Remote IP, Tunnel ID and LSP ID in the auto-generated Session Name to ensure uniqueness of the name in the test. The maximum length of session name is 254 bytes. +// SessionName returns a string +func (obj *rsvpSessionAttribute) HasSessionName() bool { + return obj.obj.SessionName != nil +} + +// If auto_generate_session_name is set to 'false', then the value of this field is used to fill the Session Name field of the SESSION_ATTRIBUTE object in the Path Message for this LSP. It is suggested to include the Local IP, Remote IP, Tunnel ID and LSP ID in the auto-generated Session Name to ensure uniqueness of the name in the test. The maximum length of session name is 254 bytes. +// SetSessionName sets the string value in the RsvpSessionAttribute object +func (obj *rsvpSessionAttribute) SetSessionName(value string) RsvpSessionAttribute { + + obj.obj.SessionName = &value + return obj +} + +// Specifies the value of the Setup Priority field. This controls whether the LSP should pre-empt existing LSP setup with certain Holding Priority if resource limitation is encountered when setting up the LSP. (e.g. bandwidth availability). The value 0 is the highest priority while 7 is the lowest. +// SetupPriority returns a uint32 +func (obj *rsvpSessionAttribute) SetupPriority() uint32 { + + return *obj.obj.SetupPriority + +} + +// Specifies the value of the Setup Priority field. This controls whether the LSP should pre-empt existing LSP setup with certain Holding Priority if resource limitation is encountered when setting up the LSP. (e.g. bandwidth availability). The value 0 is the highest priority while 7 is the lowest. +// SetupPriority returns a uint32 +func (obj *rsvpSessionAttribute) HasSetupPriority() bool { + return obj.obj.SetupPriority != nil +} + +// Specifies the value of the Setup Priority field. This controls whether the LSP should pre-empt existing LSP setup with certain Holding Priority if resource limitation is encountered when setting up the LSP. (e.g. bandwidth availability). The value 0 is the highest priority while 7 is the lowest. +// SetSetupPriority sets the uint32 value in the RsvpSessionAttribute object +func (obj *rsvpSessionAttribute) SetSetupPriority(value uint32) RsvpSessionAttribute { + + obj.obj.SetupPriority = &value + return obj +} + +// Specifies the value of the Holding Priority field. This controls whether a new LSP being created with certain Setup Priority should pre-empt this LSP if resource limitation is encountered when setting up the LSP. (e.g. bandwidth availability). The value 0 is the highest priority while 7 is the lowest. +// HoldingPriority returns a uint32 +func (obj *rsvpSessionAttribute) HoldingPriority() uint32 { + + return *obj.obj.HoldingPriority + +} + +// Specifies the value of the Holding Priority field. This controls whether a new LSP being created with certain Setup Priority should pre-empt this LSP if resource limitation is encountered when setting up the LSP. (e.g. bandwidth availability). The value 0 is the highest priority while 7 is the lowest. +// HoldingPriority returns a uint32 +func (obj *rsvpSessionAttribute) HasHoldingPriority() bool { + return obj.obj.HoldingPriority != nil +} + +// Specifies the value of the Holding Priority field. This controls whether a new LSP being created with certain Setup Priority should pre-empt this LSP if resource limitation is encountered when setting up the LSP. (e.g. bandwidth availability). The value 0 is the highest priority while 7 is the lowest. +// SetHoldingPriority sets the uint32 value in the RsvpSessionAttribute object +func (obj *rsvpSessionAttribute) SetHoldingPriority(value uint32) RsvpSessionAttribute { + + obj.obj.HoldingPriority = &value + return obj +} + +// This flag permits transit routers to use a local repair mechanism which may result in violation of the explicit route object. When a fault is detected on an adjacent downstream link or node, a transit router can reroute traffic for fast service restoration. +// LocalProtectionDesired returns a bool +func (obj *rsvpSessionAttribute) LocalProtectionDesired() bool { + + return *obj.obj.LocalProtectionDesired + +} + +// This flag permits transit routers to use a local repair mechanism which may result in violation of the explicit route object. When a fault is detected on an adjacent downstream link or node, a transit router can reroute traffic for fast service restoration. +// LocalProtectionDesired returns a bool +func (obj *rsvpSessionAttribute) HasLocalProtectionDesired() bool { + return obj.obj.LocalProtectionDesired != nil +} + +// This flag permits transit routers to use a local repair mechanism which may result in violation of the explicit route object. When a fault is detected on an adjacent downstream link or node, a transit router can reroute traffic for fast service restoration. +// SetLocalProtectionDesired sets the bool value in the RsvpSessionAttribute object +func (obj *rsvpSessionAttribute) SetLocalProtectionDesired(value bool) RsvpSessionAttribute { + + obj.obj.LocalProtectionDesired = &value + return obj +} + +// This flag indicates that label information should be included when doing a route record. +// LabelRecordingDesired returns a bool +func (obj *rsvpSessionAttribute) LabelRecordingDesired() bool { + + return *obj.obj.LabelRecordingDesired + +} + +// This flag indicates that label information should be included when doing a route record. +// LabelRecordingDesired returns a bool +func (obj *rsvpSessionAttribute) HasLabelRecordingDesired() bool { + return obj.obj.LabelRecordingDesired != nil +} + +// This flag indicates that label information should be included when doing a route record. +// SetLabelRecordingDesired sets the bool value in the RsvpSessionAttribute object +func (obj *rsvpSessionAttribute) SetLabelRecordingDesired(value bool) RsvpSessionAttribute { + + obj.obj.LabelRecordingDesired = &value + return obj +} + +// This flag indicates that the tunnel ingress node may choose to reroute this tunnel without tearing it down. A tunnel egress node SHOULD use the Shared Explicit(SE) Style when responding with a Resv message. +// SeStyleDesired returns a bool +func (obj *rsvpSessionAttribute) SeStyleDesired() bool { + + return *obj.obj.SeStyleDesired + +} + +// This flag indicates that the tunnel ingress node may choose to reroute this tunnel without tearing it down. A tunnel egress node SHOULD use the Shared Explicit(SE) Style when responding with a Resv message. +// SeStyleDesired returns a bool +func (obj *rsvpSessionAttribute) HasSeStyleDesired() bool { + return obj.obj.SeStyleDesired != nil +} + +// This flag indicates that the tunnel ingress node may choose to reroute this tunnel without tearing it down. A tunnel egress node SHOULD use the Shared Explicit(SE) Style when responding with a Resv message. +// SetSeStyleDesired sets the bool value in the RsvpSessionAttribute object +func (obj *rsvpSessionAttribute) SetSeStyleDesired(value bool) RsvpSessionAttribute { + + obj.obj.SeStyleDesired = &value + return obj +} + +// This flag in the SESSION_ATTRIBUTE object in the Path Message indicates to the PLRs along the protected LSP path that a backup path with a bandwidth guarantee is desired. This bandwidth has to be guaranteed for the protected LSP, if no FAST_REROUTE object is included in the PATH message. If a FAST_REROUTE object is present in the Path message, then the bandwidth specified therein is to be guaranteed. +// BandwidthProtectionDesired returns a bool +func (obj *rsvpSessionAttribute) BandwidthProtectionDesired() bool { + + return *obj.obj.BandwidthProtectionDesired + +} + +// This flag in the SESSION_ATTRIBUTE object in the Path Message indicates to the PLRs along the protected LSP path that a backup path with a bandwidth guarantee is desired. This bandwidth has to be guaranteed for the protected LSP, if no FAST_REROUTE object is included in the PATH message. If a FAST_REROUTE object is present in the Path message, then the bandwidth specified therein is to be guaranteed. +// BandwidthProtectionDesired returns a bool +func (obj *rsvpSessionAttribute) HasBandwidthProtectionDesired() bool { + return obj.obj.BandwidthProtectionDesired != nil +} + +// This flag in the SESSION_ATTRIBUTE object in the Path Message indicates to the PLRs along the protected LSP path that a backup path with a bandwidth guarantee is desired. This bandwidth has to be guaranteed for the protected LSP, if no FAST_REROUTE object is included in the PATH message. If a FAST_REROUTE object is present in the Path message, then the bandwidth specified therein is to be guaranteed. +// SetBandwidthProtectionDesired sets the bool value in the RsvpSessionAttribute object +func (obj *rsvpSessionAttribute) SetBandwidthProtectionDesired(value bool) RsvpSessionAttribute { + + obj.obj.BandwidthProtectionDesired = &value + return obj +} + +// This flag in the SESSION_ATTRIBUTE object in the Path Message indicates to the PLRs along a protected LSP path that it is desired to have a backup path that bypasses at least the next node of the protected LSP. +// NodeProtectionDesired returns a bool +func (obj *rsvpSessionAttribute) NodeProtectionDesired() bool { + + return *obj.obj.NodeProtectionDesired + +} + +// This flag in the SESSION_ATTRIBUTE object in the Path Message indicates to the PLRs along a protected LSP path that it is desired to have a backup path that bypasses at least the next node of the protected LSP. +// NodeProtectionDesired returns a bool +func (obj *rsvpSessionAttribute) HasNodeProtectionDesired() bool { + return obj.obj.NodeProtectionDesired != nil +} + +// This flag in the SESSION_ATTRIBUTE object in the Path Message indicates to the PLRs along a protected LSP path that it is desired to have a backup path that bypasses at least the next node of the protected LSP. +// SetNodeProtectionDesired sets the bool value in the RsvpSessionAttribute object +func (obj *rsvpSessionAttribute) SetNodeProtectionDesired(value bool) RsvpSessionAttribute { + + obj.obj.NodeProtectionDesired = &value + return obj +} + +// This is an optional object. If included the extended SESSION_ATTRIBUTE object is sent in the Path message containing +// the additional fields included in this object. This contains a set of three bitmaps using which further constraints can be +// set on the path calculated for the LSP based on the Admin Group settings in the IGP (e.g ISIS or OSPF interface). +// ResourceAffinities returns a RsvpResourceAffinities +func (obj *rsvpSessionAttribute) ResourceAffinities() RsvpResourceAffinities { + if obj.obj.ResourceAffinities == nil { + obj.obj.ResourceAffinities = NewRsvpResourceAffinities().msg() + } + if obj.resourceAffinitiesHolder == nil { + obj.resourceAffinitiesHolder = &rsvpResourceAffinities{obj: obj.obj.ResourceAffinities} + } + return obj.resourceAffinitiesHolder +} + +// This is an optional object. If included the extended SESSION_ATTRIBUTE object is sent in the Path message containing +// the additional fields included in this object. This contains a set of three bitmaps using which further constraints can be +// set on the path calculated for the LSP based on the Admin Group settings in the IGP (e.g ISIS or OSPF interface). +// ResourceAffinities returns a RsvpResourceAffinities +func (obj *rsvpSessionAttribute) HasResourceAffinities() bool { + return obj.obj.ResourceAffinities != nil +} + +// This is an optional object. If included the extended SESSION_ATTRIBUTE object is sent in the Path message containing +// the additional fields included in this object. This contains a set of three bitmaps using which further constraints can be +// set on the path calculated for the LSP based on the Admin Group settings in the IGP (e.g ISIS or OSPF interface). +// SetResourceAffinities sets the RsvpResourceAffinities value in the RsvpSessionAttribute object +func (obj *rsvpSessionAttribute) SetResourceAffinities(value RsvpResourceAffinities) RsvpSessionAttribute { + + obj.resourceAffinitiesHolder = nil + obj.obj.ResourceAffinities = value.msg() + + return obj +} + +func (obj *rsvpSessionAttribute) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.SessionName != nil { + + if len(*obj.obj.SessionName) < 0 || len(*obj.obj.SessionName) > 254 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf( + "0 <= length of RsvpSessionAttribute.SessionName <= 254 but Got %d", + len(*obj.obj.SessionName))) + } + + } + + if obj.obj.SetupPriority != nil { + + if *obj.obj.SetupPriority > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpSessionAttribute.SetupPriority <= 7 but Got %d", *obj.obj.SetupPriority)) + } + + } + + if obj.obj.HoldingPriority != nil { + + if *obj.obj.HoldingPriority > 7 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpSessionAttribute.HoldingPriority <= 7 but Got %d", *obj.obj.HoldingPriority)) + } + + } + + if obj.obj.ResourceAffinities != nil { + + obj.ResourceAffinities().validateObj(vObj, set_default) + } + +} + +func (obj *rsvpSessionAttribute) setDefault() { + if obj.obj.AutoGenerateSessionName == nil { + obj.SetAutoGenerateSessionName(true) + } + if obj.obj.SetupPriority == nil { + obj.SetSetupPriority(7) + } + if obj.obj.HoldingPriority == nil { + obj.SetHoldingPriority(7) + } + if obj.obj.LocalProtectionDesired == nil { + obj.SetLocalProtectionDesired(false) + } + if obj.obj.LabelRecordingDesired == nil { + obj.SetLabelRecordingDesired(false) + } + if obj.obj.SeStyleDesired == nil { + obj.SetSeStyleDesired(false) + } + if obj.obj.BandwidthProtectionDesired == nil { + obj.SetBandwidthProtectionDesired(false) + } + if obj.obj.NodeProtectionDesired == nil { + obj.SetNodeProtectionDesired(false) + } + +} diff --git a/gosnappi/rsvp_tspec.go b/gosnappi/rsvp_tspec.go new file mode 100644 index 00000000..f02175b3 --- /dev/null +++ b/gosnappi/rsvp_tspec.go @@ -0,0 +1,453 @@ +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" +) + +// ***** RsvpTspec ***** +type rsvpTspec struct { + validation + obj *otg.RsvpTspec + marshaller marshalRsvpTspec + unMarshaller unMarshalRsvpTspec +} + +func NewRsvpTspec() RsvpTspec { + obj := rsvpTspec{obj: &otg.RsvpTspec{}} + obj.setDefault() + return &obj +} + +func (obj *rsvpTspec) msg() *otg.RsvpTspec { + return obj.obj +} + +func (obj *rsvpTspec) setMsg(msg *otg.RsvpTspec) RsvpTspec { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalrsvpTspec struct { + obj *rsvpTspec +} + +type marshalRsvpTspec interface { + // ToProto marshals RsvpTspec to protobuf object *otg.RsvpTspec + ToProto() (*otg.RsvpTspec, error) + // ToPbText marshals RsvpTspec to protobuf text + ToPbText() (string, error) + // ToYaml marshals RsvpTspec to YAML text + ToYaml() (string, error) + // ToJson marshals RsvpTspec to JSON text + ToJson() (string, error) +} + +type unMarshalrsvpTspec struct { + obj *rsvpTspec +} + +type unMarshalRsvpTspec interface { + // FromProto unmarshals RsvpTspec from protobuf object *otg.RsvpTspec + FromProto(msg *otg.RsvpTspec) (RsvpTspec, error) + // FromPbText unmarshals RsvpTspec from protobuf text + FromPbText(value string) error + // FromYaml unmarshals RsvpTspec from YAML text + FromYaml(value string) error + // FromJson unmarshals RsvpTspec from JSON text + FromJson(value string) error +} + +func (obj *rsvpTspec) Marshal() marshalRsvpTspec { + if obj.marshaller == nil { + obj.marshaller = &marshalrsvpTspec{obj: obj} + } + return obj.marshaller +} + +func (obj *rsvpTspec) Unmarshal() unMarshalRsvpTspec { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalrsvpTspec{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalrsvpTspec) ToProto() (*otg.RsvpTspec, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalrsvpTspec) FromProto(msg *otg.RsvpTspec) (RsvpTspec, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalrsvpTspec) 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 *unMarshalrsvpTspec) 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 *marshalrsvpTspec) 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 *unMarshalrsvpTspec) 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 *marshalrsvpTspec) 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 *unMarshalrsvpTspec) 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 *rsvpTspec) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *rsvpTspec) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *rsvpTspec) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *rsvpTspec) Clone() (RsvpTspec, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewRsvpTspec() + 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 +} + +// RsvpTspec is configuration for RSVP-TE TSPEC object included in Path Messages. The usage of these parameters is defined in RFC2215. +type RsvpTspec interface { + Validation + // msg marshals RsvpTspec to protobuf object *otg.RsvpTspec + // and doesn't set defaults + msg() *otg.RsvpTspec + // setMsg unmarshals RsvpTspec from protobuf object *otg.RsvpTspec + // and doesn't set defaults + setMsg(*otg.RsvpTspec) RsvpTspec + // provides marshal interface + Marshal() marshalRsvpTspec + // provides unmarshal interface + Unmarshal() unMarshalRsvpTspec + // validate validates RsvpTspec + validate() error + // A stringer function + String() string + // Clones the object + Clone() (RsvpTspec, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // TokenBucketRate returns float32, set in RsvpTspec. + TokenBucketRate() float32 + // SetTokenBucketRate assigns float32 provided by user to RsvpTspec + SetTokenBucketRate(value float32) RsvpTspec + // HasTokenBucketRate checks if TokenBucketRate has been set in RsvpTspec + HasTokenBucketRate() bool + // TokenBucketSize returns float32, set in RsvpTspec. + TokenBucketSize() float32 + // SetTokenBucketSize assigns float32 provided by user to RsvpTspec + SetTokenBucketSize(value float32) RsvpTspec + // HasTokenBucketSize checks if TokenBucketSize has been set in RsvpTspec + HasTokenBucketSize() bool + // PeakDataRate returns float32, set in RsvpTspec. + PeakDataRate() float32 + // SetPeakDataRate assigns float32 provided by user to RsvpTspec + SetPeakDataRate(value float32) RsvpTspec + // HasPeakDataRate checks if PeakDataRate has been set in RsvpTspec + HasPeakDataRate() bool + // MinimumPolicedUnit returns uint32, set in RsvpTspec. + MinimumPolicedUnit() uint32 + // SetMinimumPolicedUnit assigns uint32 provided by user to RsvpTspec + SetMinimumPolicedUnit(value uint32) RsvpTspec + // HasMinimumPolicedUnit checks if MinimumPolicedUnit has been set in RsvpTspec + HasMinimumPolicedUnit() bool + // MaximumPolicedUnit returns uint32, set in RsvpTspec. + MaximumPolicedUnit() uint32 + // SetMaximumPolicedUnit assigns uint32 provided by user to RsvpTspec + SetMaximumPolicedUnit(value uint32) RsvpTspec + // HasMaximumPolicedUnit checks if MaximumPolicedUnit has been set in RsvpTspec + HasMaximumPolicedUnit() bool +} + +// The rate of the traffic to be carried in this LSP in bytes per second. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. +// TokenBucketRate returns a float32 +func (obj *rsvpTspec) TokenBucketRate() float32 { + + return *obj.obj.TokenBucketRate + +} + +// The rate of the traffic to be carried in this LSP in bytes per second. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. +// TokenBucketRate returns a float32 +func (obj *rsvpTspec) HasTokenBucketRate() bool { + return obj.obj.TokenBucketRate != nil +} + +// The rate of the traffic to be carried in this LSP in bytes per second. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. +// SetTokenBucketRate sets the float32 value in the RsvpTspec object +func (obj *rsvpTspec) SetTokenBucketRate(value float32) RsvpTspec { + + obj.obj.TokenBucketRate = &value + return obj +} + +// The depth of the token bucket in bytes used to specify the Token Bucket characteristics of the traffic to be carried in the LSP. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. +// TokenBucketSize returns a float32 +func (obj *rsvpTspec) TokenBucketSize() float32 { + + return *obj.obj.TokenBucketSize + +} + +// The depth of the token bucket in bytes used to specify the Token Bucket characteristics of the traffic to be carried in the LSP. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. +// TokenBucketSize returns a float32 +func (obj *rsvpTspec) HasTokenBucketSize() bool { + return obj.obj.TokenBucketSize != nil +} + +// The depth of the token bucket in bytes used to specify the Token Bucket characteristics of the traffic to be carried in the LSP. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. +// SetTokenBucketSize sets the float32 value in the RsvpTspec object +func (obj *rsvpTspec) SetTokenBucketSize(value float32) RsvpTspec { + + obj.obj.TokenBucketSize = &value + return obj +} + +// The peak data rate of the traffic in bytes per second used to specify the Token Bucket characteristics of the traffic to be carried in the LSP. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. +// PeakDataRate returns a float32 +func (obj *rsvpTspec) PeakDataRate() float32 { + + return *obj.obj.PeakDataRate + +} + +// The peak data rate of the traffic in bytes per second used to specify the Token Bucket characteristics of the traffic to be carried in the LSP. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. +// PeakDataRate returns a float32 +func (obj *rsvpTspec) HasPeakDataRate() bool { + return obj.obj.PeakDataRate != nil +} + +// The peak data rate of the traffic in bytes per second used to specify the Token Bucket characteristics of the traffic to be carried in the LSP. This is part of the Token Bucket specification defined for a traffic flow defined in RFC2215. +// SetPeakDataRate sets the float32 value in the RsvpTspec object +func (obj *rsvpTspec) SetPeakDataRate(value float32) RsvpTspec { + + obj.obj.PeakDataRate = &value + return obj +} + +// Specifies the minium length of packet frames that will be policed. +// MinimumPolicedUnit returns a uint32 +func (obj *rsvpTspec) MinimumPolicedUnit() uint32 { + + return *obj.obj.MinimumPolicedUnit + +} + +// Specifies the minium length of packet frames that will be policed. +// MinimumPolicedUnit returns a uint32 +func (obj *rsvpTspec) HasMinimumPolicedUnit() bool { + return obj.obj.MinimumPolicedUnit != nil +} + +// Specifies the minium length of packet frames that will be policed. +// SetMinimumPolicedUnit sets the uint32 value in the RsvpTspec object +func (obj *rsvpTspec) SetMinimumPolicedUnit(value uint32) RsvpTspec { + + obj.obj.MinimumPolicedUnit = &value + return obj +} + +// Specifies the maximum length of packet frames that will be policed. +// MaximumPolicedUnit returns a uint32 +func (obj *rsvpTspec) MaximumPolicedUnit() uint32 { + + return *obj.obj.MaximumPolicedUnit + +} + +// Specifies the maximum length of packet frames that will be policed. +// MaximumPolicedUnit returns a uint32 +func (obj *rsvpTspec) HasMaximumPolicedUnit() bool { + return obj.obj.MaximumPolicedUnit != nil +} + +// Specifies the maximum length of packet frames that will be policed. +// SetMaximumPolicedUnit sets the uint32 value in the RsvpTspec object +func (obj *rsvpTspec) SetMaximumPolicedUnit(value uint32) RsvpTspec { + + obj.obj.MaximumPolicedUnit = &value + return obj +} + +func (obj *rsvpTspec) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.MinimumPolicedUnit != nil { + + if *obj.obj.MinimumPolicedUnit > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpTspec.MinimumPolicedUnit <= 65535 but Got %d", *obj.obj.MinimumPolicedUnit)) + } + + } + + if obj.obj.MaximumPolicedUnit != nil { + + if *obj.obj.MaximumPolicedUnit > 65535 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= RsvpTspec.MaximumPolicedUnit <= 65535 but Got %d", *obj.obj.MaximumPolicedUnit)) + } + + } + +} + +func (obj *rsvpTspec) setDefault() { + if obj.obj.TokenBucketRate == nil { + obj.SetTokenBucketRate(0) + } + if obj.obj.TokenBucketSize == nil { + obj.SetTokenBucketSize(0) + } + if obj.obj.PeakDataRate == nil { + obj.SetPeakDataRate(0) + } + if obj.obj.MinimumPolicedUnit == nil { + obj.SetMinimumPolicedUnit(0) + } + if obj.obj.MaximumPolicedUnit == nil { + obj.SetMaximumPolicedUnit(0) + } + +} diff --git a/gosnappi/set_config_response.go b/gosnappi/set_config_response.go new file mode 100644 index 00000000..b78b6751 --- /dev/null +++ b/gosnappi/set_config_response.go @@ -0,0 +1,328 @@ +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" +) + +// ***** SetConfigResponse ***** +type setConfigResponse struct { + validation + obj *otg.SetConfigResponse + marshaller marshalSetConfigResponse + unMarshaller unMarshalSetConfigResponse + warningHolder Warning +} + +func NewSetConfigResponse() SetConfigResponse { + obj := setConfigResponse{obj: &otg.SetConfigResponse{}} + obj.setDefault() + return &obj +} + +func (obj *setConfigResponse) msg() *otg.SetConfigResponse { + return obj.obj +} + +func (obj *setConfigResponse) setMsg(msg *otg.SetConfigResponse) SetConfigResponse { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalsetConfigResponse struct { + obj *setConfigResponse +} + +type marshalSetConfigResponse interface { + // ToProto marshals SetConfigResponse to protobuf object *otg.SetConfigResponse + ToProto() (*otg.SetConfigResponse, error) + // ToPbText marshals SetConfigResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals SetConfigResponse to YAML text + ToYaml() (string, error) + // ToJson marshals SetConfigResponse to JSON text + ToJson() (string, error) +} + +type unMarshalsetConfigResponse struct { + obj *setConfigResponse +} + +type unMarshalSetConfigResponse interface { + // FromProto unmarshals SetConfigResponse from protobuf object *otg.SetConfigResponse + FromProto(msg *otg.SetConfigResponse) (SetConfigResponse, error) + // FromPbText unmarshals SetConfigResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals SetConfigResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals SetConfigResponse from JSON text + FromJson(value string) error +} + +func (obj *setConfigResponse) Marshal() marshalSetConfigResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalsetConfigResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *setConfigResponse) Unmarshal() unMarshalSetConfigResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalsetConfigResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalsetConfigResponse) ToProto() (*otg.SetConfigResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalsetConfigResponse) FromProto(msg *otg.SetConfigResponse) (SetConfigResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalsetConfigResponse) 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 *unMarshalsetConfigResponse) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalsetConfigResponse) 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 *unMarshalsetConfigResponse) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalsetConfigResponse) 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 *unMarshalsetConfigResponse) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *setConfigResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *setConfigResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *setConfigResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *setConfigResponse) Clone() (SetConfigResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewSetConfigResponse() + 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 +} + +func (obj *setConfigResponse) setNil() { + obj.warningHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// SetConfigResponse is description is TBD +type SetConfigResponse interface { + Validation + // msg marshals SetConfigResponse to protobuf object *otg.SetConfigResponse + // and doesn't set defaults + msg() *otg.SetConfigResponse + // setMsg unmarshals SetConfigResponse from protobuf object *otg.SetConfigResponse + // and doesn't set defaults + setMsg(*otg.SetConfigResponse) SetConfigResponse + // provides marshal interface + Marshal() marshalSetConfigResponse + // provides unmarshal interface + Unmarshal() unMarshalSetConfigResponse + // validate validates SetConfigResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (SetConfigResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Warning returns Warning, set in SetConfigResponse. + // Warning is a list of warnings that have occurred while executing the request. + Warning() Warning + // SetWarning assigns Warning provided by user to SetConfigResponse. + // Warning is a list of warnings that have occurred while executing the request. + SetWarning(value Warning) SetConfigResponse + // HasWarning checks if Warning has been set in SetConfigResponse + HasWarning() bool + setNil() +} + +// description is TBD +// Warning returns a Warning +func (obj *setConfigResponse) Warning() Warning { + if obj.obj.Warning == nil { + obj.obj.Warning = NewWarning().msg() + } + if obj.warningHolder == nil { + obj.warningHolder = &warning{obj: obj.obj.Warning} + } + return obj.warningHolder +} + +// description is TBD +// Warning returns a Warning +func (obj *setConfigResponse) HasWarning() bool { + return obj.obj.Warning != nil +} + +// description is TBD +// SetWarning sets the Warning value in the SetConfigResponse object +func (obj *setConfigResponse) SetWarning(value Warning) SetConfigResponse { + + obj.warningHolder = nil + obj.obj.Warning = value.msg() + + return obj +} + +func (obj *setConfigResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Warning != nil { + + obj.Warning().validateObj(vObj, set_default) + } + +} + +func (obj *setConfigResponse) setDefault() { + +} diff --git a/gosnappi/set_control_action_response.go b/gosnappi/set_control_action_response.go new file mode 100644 index 00000000..f855c711 --- /dev/null +++ b/gosnappi/set_control_action_response.go @@ -0,0 +1,328 @@ +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" +) + +// ***** SetControlActionResponse ***** +type setControlActionResponse struct { + validation + obj *otg.SetControlActionResponse + marshaller marshalSetControlActionResponse + unMarshaller unMarshalSetControlActionResponse + controlActionResponseHolder ControlActionResponse +} + +func NewSetControlActionResponse() SetControlActionResponse { + obj := setControlActionResponse{obj: &otg.SetControlActionResponse{}} + obj.setDefault() + return &obj +} + +func (obj *setControlActionResponse) msg() *otg.SetControlActionResponse { + return obj.obj +} + +func (obj *setControlActionResponse) setMsg(msg *otg.SetControlActionResponse) SetControlActionResponse { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalsetControlActionResponse struct { + obj *setControlActionResponse +} + +type marshalSetControlActionResponse interface { + // ToProto marshals SetControlActionResponse to protobuf object *otg.SetControlActionResponse + ToProto() (*otg.SetControlActionResponse, error) + // ToPbText marshals SetControlActionResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals SetControlActionResponse to YAML text + ToYaml() (string, error) + // ToJson marshals SetControlActionResponse to JSON text + ToJson() (string, error) +} + +type unMarshalsetControlActionResponse struct { + obj *setControlActionResponse +} + +type unMarshalSetControlActionResponse interface { + // FromProto unmarshals SetControlActionResponse from protobuf object *otg.SetControlActionResponse + FromProto(msg *otg.SetControlActionResponse) (SetControlActionResponse, error) + // FromPbText unmarshals SetControlActionResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals SetControlActionResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals SetControlActionResponse from JSON text + FromJson(value string) error +} + +func (obj *setControlActionResponse) Marshal() marshalSetControlActionResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalsetControlActionResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *setControlActionResponse) Unmarshal() unMarshalSetControlActionResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalsetControlActionResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalsetControlActionResponse) ToProto() (*otg.SetControlActionResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalsetControlActionResponse) FromProto(msg *otg.SetControlActionResponse) (SetControlActionResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalsetControlActionResponse) 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 *unMarshalsetControlActionResponse) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalsetControlActionResponse) 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 *unMarshalsetControlActionResponse) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalsetControlActionResponse) 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 *unMarshalsetControlActionResponse) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *setControlActionResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *setControlActionResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *setControlActionResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *setControlActionResponse) Clone() (SetControlActionResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewSetControlActionResponse() + 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 +} + +func (obj *setControlActionResponse) setNil() { + obj.controlActionResponseHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// SetControlActionResponse is description is TBD +type SetControlActionResponse interface { + Validation + // msg marshals SetControlActionResponse to protobuf object *otg.SetControlActionResponse + // and doesn't set defaults + msg() *otg.SetControlActionResponse + // setMsg unmarshals SetControlActionResponse from protobuf object *otg.SetControlActionResponse + // and doesn't set defaults + setMsg(*otg.SetControlActionResponse) SetControlActionResponse + // provides marshal interface + Marshal() marshalSetControlActionResponse + // provides unmarshal interface + Unmarshal() unMarshalSetControlActionResponse + // validate validates SetControlActionResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (SetControlActionResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ControlActionResponse returns ControlActionResponse, set in SetControlActionResponse. + // ControlActionResponse is response for action triggered against configured resources along with warnings. + ControlActionResponse() ControlActionResponse + // SetControlActionResponse assigns ControlActionResponse provided by user to SetControlActionResponse. + // ControlActionResponse is response for action triggered against configured resources along with warnings. + SetControlActionResponse(value ControlActionResponse) SetControlActionResponse + // HasControlActionResponse checks if ControlActionResponse has been set in SetControlActionResponse + HasControlActionResponse() bool + setNil() +} + +// description is TBD +// ControlActionResponse returns a ControlActionResponse +func (obj *setControlActionResponse) ControlActionResponse() ControlActionResponse { + if obj.obj.ControlActionResponse == nil { + obj.obj.ControlActionResponse = NewControlActionResponse().msg() + } + if obj.controlActionResponseHolder == nil { + obj.controlActionResponseHolder = &controlActionResponse{obj: obj.obj.ControlActionResponse} + } + return obj.controlActionResponseHolder +} + +// description is TBD +// ControlActionResponse returns a ControlActionResponse +func (obj *setControlActionResponse) HasControlActionResponse() bool { + return obj.obj.ControlActionResponse != nil +} + +// description is TBD +// SetControlActionResponse sets the ControlActionResponse value in the SetControlActionResponse object +func (obj *setControlActionResponse) SetControlActionResponse(value ControlActionResponse) SetControlActionResponse { + + obj.controlActionResponseHolder = nil + obj.obj.ControlActionResponse = value.msg() + + return obj +} + +func (obj *setControlActionResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.ControlActionResponse != nil { + + obj.ControlActionResponse().validateObj(vObj, set_default) + } + +} + +func (obj *setControlActionResponse) setDefault() { + +} diff --git a/gosnappi/set_control_state_response.go b/gosnappi/set_control_state_response.go new file mode 100644 index 00000000..8fb04c16 --- /dev/null +++ b/gosnappi/set_control_state_response.go @@ -0,0 +1,328 @@ +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" +) + +// ***** SetControlStateResponse ***** +type setControlStateResponse struct { + validation + obj *otg.SetControlStateResponse + marshaller marshalSetControlStateResponse + unMarshaller unMarshalSetControlStateResponse + warningHolder Warning +} + +func NewSetControlStateResponse() SetControlStateResponse { + obj := setControlStateResponse{obj: &otg.SetControlStateResponse{}} + obj.setDefault() + return &obj +} + +func (obj *setControlStateResponse) msg() *otg.SetControlStateResponse { + return obj.obj +} + +func (obj *setControlStateResponse) setMsg(msg *otg.SetControlStateResponse) SetControlStateResponse { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalsetControlStateResponse struct { + obj *setControlStateResponse +} + +type marshalSetControlStateResponse interface { + // ToProto marshals SetControlStateResponse to protobuf object *otg.SetControlStateResponse + ToProto() (*otg.SetControlStateResponse, error) + // ToPbText marshals SetControlStateResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals SetControlStateResponse to YAML text + ToYaml() (string, error) + // ToJson marshals SetControlStateResponse to JSON text + ToJson() (string, error) +} + +type unMarshalsetControlStateResponse struct { + obj *setControlStateResponse +} + +type unMarshalSetControlStateResponse interface { + // FromProto unmarshals SetControlStateResponse from protobuf object *otg.SetControlStateResponse + FromProto(msg *otg.SetControlStateResponse) (SetControlStateResponse, error) + // FromPbText unmarshals SetControlStateResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals SetControlStateResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals SetControlStateResponse from JSON text + FromJson(value string) error +} + +func (obj *setControlStateResponse) Marshal() marshalSetControlStateResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalsetControlStateResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *setControlStateResponse) Unmarshal() unMarshalSetControlStateResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalsetControlStateResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalsetControlStateResponse) ToProto() (*otg.SetControlStateResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalsetControlStateResponse) FromProto(msg *otg.SetControlStateResponse) (SetControlStateResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalsetControlStateResponse) 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 *unMarshalsetControlStateResponse) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalsetControlStateResponse) 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 *unMarshalsetControlStateResponse) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalsetControlStateResponse) 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 *unMarshalsetControlStateResponse) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *setControlStateResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *setControlStateResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *setControlStateResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *setControlStateResponse) Clone() (SetControlStateResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewSetControlStateResponse() + 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 +} + +func (obj *setControlStateResponse) setNil() { + obj.warningHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// SetControlStateResponse is description is TBD +type SetControlStateResponse interface { + Validation + // msg marshals SetControlStateResponse to protobuf object *otg.SetControlStateResponse + // and doesn't set defaults + msg() *otg.SetControlStateResponse + // setMsg unmarshals SetControlStateResponse from protobuf object *otg.SetControlStateResponse + // and doesn't set defaults + setMsg(*otg.SetControlStateResponse) SetControlStateResponse + // provides marshal interface + Marshal() marshalSetControlStateResponse + // provides unmarshal interface + Unmarshal() unMarshalSetControlStateResponse + // validate validates SetControlStateResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (SetControlStateResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Warning returns Warning, set in SetControlStateResponse. + // Warning is a list of warnings that have occurred while executing the request. + Warning() Warning + // SetWarning assigns Warning provided by user to SetControlStateResponse. + // Warning is a list of warnings that have occurred while executing the request. + SetWarning(value Warning) SetControlStateResponse + // HasWarning checks if Warning has been set in SetControlStateResponse + HasWarning() bool + setNil() +} + +// description is TBD +// Warning returns a Warning +func (obj *setControlStateResponse) Warning() Warning { + if obj.obj.Warning == nil { + obj.obj.Warning = NewWarning().msg() + } + if obj.warningHolder == nil { + obj.warningHolder = &warning{obj: obj.obj.Warning} + } + return obj.warningHolder +} + +// description is TBD +// Warning returns a Warning +func (obj *setControlStateResponse) HasWarning() bool { + return obj.obj.Warning != nil +} + +// description is TBD +// SetWarning sets the Warning value in the SetControlStateResponse object +func (obj *setControlStateResponse) SetWarning(value Warning) SetControlStateResponse { + + obj.warningHolder = nil + obj.obj.Warning = value.msg() + + return obj +} + +func (obj *setControlStateResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Warning != nil { + + obj.Warning().validateObj(vObj, set_default) + } + +} + +func (obj *setControlStateResponse) setDefault() { + +} diff --git a/gosnappi/state_port.go b/gosnappi/state_port.go new file mode 100644 index 00000000..a1640044 --- /dev/null +++ b/gosnappi/state_port.go @@ -0,0 +1,443 @@ +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" +) + +// ***** StatePort ***** +type statePort struct { + validation + obj *otg.StatePort + marshaller marshalStatePort + unMarshaller unMarshalStatePort + linkHolder StatePortLink + captureHolder StatePortCapture +} + +func NewStatePort() StatePort { + obj := statePort{obj: &otg.StatePort{}} + obj.setDefault() + return &obj +} + +func (obj *statePort) msg() *otg.StatePort { + return obj.obj +} + +func (obj *statePort) setMsg(msg *otg.StatePort) StatePort { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstatePort struct { + obj *statePort +} + +type marshalStatePort interface { + // ToProto marshals StatePort to protobuf object *otg.StatePort + ToProto() (*otg.StatePort, error) + // ToPbText marshals StatePort to protobuf text + ToPbText() (string, error) + // ToYaml marshals StatePort to YAML text + ToYaml() (string, error) + // ToJson marshals StatePort to JSON text + ToJson() (string, error) +} + +type unMarshalstatePort struct { + obj *statePort +} + +type unMarshalStatePort interface { + // FromProto unmarshals StatePort from protobuf object *otg.StatePort + FromProto(msg *otg.StatePort) (StatePort, error) + // FromPbText unmarshals StatePort from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StatePort from YAML text + FromYaml(value string) error + // FromJson unmarshals StatePort from JSON text + FromJson(value string) error +} + +func (obj *statePort) Marshal() marshalStatePort { + if obj.marshaller == nil { + obj.marshaller = &marshalstatePort{obj: obj} + } + return obj.marshaller +} + +func (obj *statePort) Unmarshal() unMarshalStatePort { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstatePort{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstatePort) ToProto() (*otg.StatePort, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstatePort) FromProto(msg *otg.StatePort) (StatePort, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstatePort) 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 *unMarshalstatePort) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalstatePort) 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 *unMarshalstatePort) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalstatePort) 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 *unMarshalstatePort) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *statePort) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *statePort) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *statePort) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *statePort) Clone() (StatePort, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStatePort() + 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 +} + +func (obj *statePort) setNil() { + obj.linkHolder = nil + obj.captureHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// StatePort is states associated with configured ports. +type StatePort interface { + Validation + // msg marshals StatePort to protobuf object *otg.StatePort + // and doesn't set defaults + msg() *otg.StatePort + // setMsg unmarshals StatePort from protobuf object *otg.StatePort + // and doesn't set defaults + setMsg(*otg.StatePort) StatePort + // provides marshal interface + Marshal() marshalStatePort + // provides unmarshal interface + Unmarshal() unMarshalStatePort + // validate validates StatePort + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StatePort, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns StatePortChoiceEnum, set in StatePort + Choice() StatePortChoiceEnum + // setChoice assigns StatePortChoiceEnum provided by user to StatePort + setChoice(value StatePortChoiceEnum) StatePort + // Link returns StatePortLink, set in StatePort. + // StatePortLink is sets the link of configured ports. + Link() StatePortLink + // SetLink assigns StatePortLink provided by user to StatePort. + // StatePortLink is sets the link of configured ports. + SetLink(value StatePortLink) StatePort + // HasLink checks if Link has been set in StatePort + HasLink() bool + // Capture returns StatePortCapture, set in StatePort. + // StatePortCapture is sets the capture state of configured ports + Capture() StatePortCapture + // SetCapture assigns StatePortCapture provided by user to StatePort. + // StatePortCapture is sets the capture state of configured ports + SetCapture(value StatePortCapture) StatePort + // HasCapture checks if Capture has been set in StatePort + HasCapture() bool + setNil() +} + +type StatePortChoiceEnum string + +// Enum of Choice on StatePort +var StatePortChoice = struct { + LINK StatePortChoiceEnum + CAPTURE StatePortChoiceEnum +}{ + LINK: StatePortChoiceEnum("link"), + CAPTURE: StatePortChoiceEnum("capture"), +} + +func (obj *statePort) Choice() StatePortChoiceEnum { + return StatePortChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *statePort) setChoice(value StatePortChoiceEnum) StatePort { + intValue, ok := otg.StatePort_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StatePortChoiceEnum", string(value))) + return obj + } + enumValue := otg.StatePort_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Capture = nil + obj.captureHolder = nil + obj.obj.Link = nil + obj.linkHolder = nil + + if value == StatePortChoice.LINK { + obj.obj.Link = NewStatePortLink().msg() + } + + if value == StatePortChoice.CAPTURE { + obj.obj.Capture = NewStatePortCapture().msg() + } + + return obj +} + +// description is TBD +// Link returns a StatePortLink +func (obj *statePort) Link() StatePortLink { + if obj.obj.Link == nil { + obj.setChoice(StatePortChoice.LINK) + } + if obj.linkHolder == nil { + obj.linkHolder = &statePortLink{obj: obj.obj.Link} + } + return obj.linkHolder +} + +// description is TBD +// Link returns a StatePortLink +func (obj *statePort) HasLink() bool { + return obj.obj.Link != nil +} + +// description is TBD +// SetLink sets the StatePortLink value in the StatePort object +func (obj *statePort) SetLink(value StatePortLink) StatePort { + obj.setChoice(StatePortChoice.LINK) + obj.linkHolder = nil + obj.obj.Link = value.msg() + + return obj +} + +// description is TBD +// Capture returns a StatePortCapture +func (obj *statePort) Capture() StatePortCapture { + if obj.obj.Capture == nil { + obj.setChoice(StatePortChoice.CAPTURE) + } + if obj.captureHolder == nil { + obj.captureHolder = &statePortCapture{obj: obj.obj.Capture} + } + return obj.captureHolder +} + +// description is TBD +// Capture returns a StatePortCapture +func (obj *statePort) HasCapture() bool { + return obj.obj.Capture != nil +} + +// description is TBD +// SetCapture sets the StatePortCapture value in the StatePort object +func (obj *statePort) SetCapture(value StatePortCapture) StatePort { + obj.setChoice(StatePortChoice.CAPTURE) + obj.captureHolder = nil + obj.obj.Capture = value.msg() + + return obj +} + +func (obj *statePort) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface StatePort") + } + + if obj.obj.Link != nil { + + obj.Link().validateObj(vObj, set_default) + } + + if obj.obj.Capture != nil { + + obj.Capture().validateObj(vObj, set_default) + } + +} + +func (obj *statePort) setDefault() { + var choices_set int = 0 + var choice StatePortChoiceEnum + + if obj.obj.Link != nil { + choices_set += 1 + choice = StatePortChoice.LINK + } + + if obj.obj.Capture != nil { + choices_set += 1 + choice = StatePortChoice.CAPTURE + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StatePort") + } + } else { + intVal := otg.StatePort_Choice_Enum_value[string(choice)] + enumValue := otg.StatePort_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/state_port_capture.go b/gosnappi/state_port_capture.go new file mode 100644 index 00000000..11da66e4 --- /dev/null +++ b/gosnappi/state_port_capture.go @@ -0,0 +1,355 @@ +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" +) + +// ***** StatePortCapture ***** +type statePortCapture struct { + validation + obj *otg.StatePortCapture + marshaller marshalStatePortCapture + unMarshaller unMarshalStatePortCapture +} + +func NewStatePortCapture() StatePortCapture { + obj := statePortCapture{obj: &otg.StatePortCapture{}} + obj.setDefault() + return &obj +} + +func (obj *statePortCapture) msg() *otg.StatePortCapture { + return obj.obj +} + +func (obj *statePortCapture) setMsg(msg *otg.StatePortCapture) StatePortCapture { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstatePortCapture struct { + obj *statePortCapture +} + +type marshalStatePortCapture interface { + // ToProto marshals StatePortCapture to protobuf object *otg.StatePortCapture + ToProto() (*otg.StatePortCapture, error) + // ToPbText marshals StatePortCapture to protobuf text + ToPbText() (string, error) + // ToYaml marshals StatePortCapture to YAML text + ToYaml() (string, error) + // ToJson marshals StatePortCapture to JSON text + ToJson() (string, error) +} + +type unMarshalstatePortCapture struct { + obj *statePortCapture +} + +type unMarshalStatePortCapture interface { + // FromProto unmarshals StatePortCapture from protobuf object *otg.StatePortCapture + FromProto(msg *otg.StatePortCapture) (StatePortCapture, error) + // FromPbText unmarshals StatePortCapture from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StatePortCapture from YAML text + FromYaml(value string) error + // FromJson unmarshals StatePortCapture from JSON text + FromJson(value string) error +} + +func (obj *statePortCapture) Marshal() marshalStatePortCapture { + if obj.marshaller == nil { + obj.marshaller = &marshalstatePortCapture{obj: obj} + } + return obj.marshaller +} + +func (obj *statePortCapture) Unmarshal() unMarshalStatePortCapture { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstatePortCapture{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstatePortCapture) ToProto() (*otg.StatePortCapture, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstatePortCapture) FromProto(msg *otg.StatePortCapture) (StatePortCapture, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstatePortCapture) 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 *unMarshalstatePortCapture) 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 *marshalstatePortCapture) 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 *unMarshalstatePortCapture) 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 *marshalstatePortCapture) 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 *unMarshalstatePortCapture) 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 *statePortCapture) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *statePortCapture) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *statePortCapture) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *statePortCapture) Clone() (StatePortCapture, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStatePortCapture() + 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 +} + +// StatePortCapture is sets the capture state of configured ports +type StatePortCapture interface { + Validation + // msg marshals StatePortCapture to protobuf object *otg.StatePortCapture + // and doesn't set defaults + msg() *otg.StatePortCapture + // setMsg unmarshals StatePortCapture from protobuf object *otg.StatePortCapture + // and doesn't set defaults + setMsg(*otg.StatePortCapture) StatePortCapture + // provides marshal interface + Marshal() marshalStatePortCapture + // provides unmarshal interface + Unmarshal() unMarshalStatePortCapture + // validate validates StatePortCapture + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StatePortCapture, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PortNames returns []string, set in StatePortCapture. + PortNames() []string + // SetPortNames assigns []string provided by user to StatePortCapture + SetPortNames(value []string) StatePortCapture + // State returns StatePortCaptureStateEnum, set in StatePortCapture + State() StatePortCaptureStateEnum + // SetState assigns StatePortCaptureStateEnum provided by user to StatePortCapture + SetState(value StatePortCaptureStateEnum) StatePortCapture +} + +// The names of ports to which the capture state will be applied to. If the list of port_names is empty or null the state will be applied to all configured ports. +// If the list is not empty any port that is not included in the list of port_names MUST be ignored and not included in the state change. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// PortNames returns a []string +func (obj *statePortCapture) PortNames() []string { + if obj.obj.PortNames == nil { + obj.obj.PortNames = make([]string, 0) + } + return obj.obj.PortNames +} + +// The names of ports to which the capture state will be applied to. If the list of port_names is empty or null the state will be applied to all configured ports. +// If the list is not empty any port that is not included in the list of port_names MUST be ignored and not included in the state change. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// SetPortNames sets the []string value in the StatePortCapture object +func (obj *statePortCapture) SetPortNames(value []string) StatePortCapture { + + if obj.obj.PortNames == nil { + obj.obj.PortNames = make([]string, 0) + } + obj.obj.PortNames = value + + return obj +} + +type StatePortCaptureStateEnum string + +// Enum of State on StatePortCapture +var StatePortCaptureState = struct { + START StatePortCaptureStateEnum + STOP StatePortCaptureStateEnum +}{ + START: StatePortCaptureStateEnum("start"), + STOP: StatePortCaptureStateEnum("stop"), +} + +func (obj *statePortCapture) State() StatePortCaptureStateEnum { + return StatePortCaptureStateEnum(obj.obj.State.Enum().String()) +} + +func (obj *statePortCapture) SetState(value StatePortCaptureStateEnum) StatePortCapture { + intValue, ok := otg.StatePortCapture_State_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StatePortCaptureStateEnum", string(value))) + return obj + } + enumValue := otg.StatePortCapture_State_Enum(intValue) + obj.obj.State = &enumValue + + return obj +} + +func (obj *statePortCapture) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // State is required + if obj.obj.State == nil { + vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StatePortCapture") + } +} + +func (obj *statePortCapture) setDefault() { + +} diff --git a/gosnappi/state_port_link.go b/gosnappi/state_port_link.go new file mode 100644 index 00000000..ce76a379 --- /dev/null +++ b/gosnappi/state_port_link.go @@ -0,0 +1,353 @@ +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" +) + +// ***** StatePortLink ***** +type statePortLink struct { + validation + obj *otg.StatePortLink + marshaller marshalStatePortLink + unMarshaller unMarshalStatePortLink +} + +func NewStatePortLink() StatePortLink { + obj := statePortLink{obj: &otg.StatePortLink{}} + obj.setDefault() + return &obj +} + +func (obj *statePortLink) msg() *otg.StatePortLink { + return obj.obj +} + +func (obj *statePortLink) setMsg(msg *otg.StatePortLink) StatePortLink { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstatePortLink struct { + obj *statePortLink +} + +type marshalStatePortLink interface { + // ToProto marshals StatePortLink to protobuf object *otg.StatePortLink + ToProto() (*otg.StatePortLink, error) + // ToPbText marshals StatePortLink to protobuf text + ToPbText() (string, error) + // ToYaml marshals StatePortLink to YAML text + ToYaml() (string, error) + // ToJson marshals StatePortLink to JSON text + ToJson() (string, error) +} + +type unMarshalstatePortLink struct { + obj *statePortLink +} + +type unMarshalStatePortLink interface { + // FromProto unmarshals StatePortLink from protobuf object *otg.StatePortLink + FromProto(msg *otg.StatePortLink) (StatePortLink, error) + // FromPbText unmarshals StatePortLink from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StatePortLink from YAML text + FromYaml(value string) error + // FromJson unmarshals StatePortLink from JSON text + FromJson(value string) error +} + +func (obj *statePortLink) Marshal() marshalStatePortLink { + if obj.marshaller == nil { + obj.marshaller = &marshalstatePortLink{obj: obj} + } + return obj.marshaller +} + +func (obj *statePortLink) Unmarshal() unMarshalStatePortLink { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstatePortLink{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstatePortLink) ToProto() (*otg.StatePortLink, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstatePortLink) FromProto(msg *otg.StatePortLink) (StatePortLink, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstatePortLink) 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 *unMarshalstatePortLink) 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 *marshalstatePortLink) 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 *unMarshalstatePortLink) 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 *marshalstatePortLink) 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 *unMarshalstatePortLink) 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 *statePortLink) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *statePortLink) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *statePortLink) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *statePortLink) Clone() (StatePortLink, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStatePortLink() + 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 +} + +// StatePortLink is sets the link of configured ports. +type StatePortLink interface { + Validation + // msg marshals StatePortLink to protobuf object *otg.StatePortLink + // and doesn't set defaults + msg() *otg.StatePortLink + // setMsg unmarshals StatePortLink from protobuf object *otg.StatePortLink + // and doesn't set defaults + setMsg(*otg.StatePortLink) StatePortLink + // provides marshal interface + Marshal() marshalStatePortLink + // provides unmarshal interface + Unmarshal() unMarshalStatePortLink + // validate validates StatePortLink + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StatePortLink, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PortNames returns []string, set in StatePortLink. + PortNames() []string + // SetPortNames assigns []string provided by user to StatePortLink + SetPortNames(value []string) StatePortLink + // State returns StatePortLinkStateEnum, set in StatePortLink + State() StatePortLinkStateEnum + // SetState assigns StatePortLinkStateEnum provided by user to StatePortLink + SetState(value StatePortLinkStateEnum) StatePortLink +} + +// The names of target ports. An empty or null list will target all ports. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// PortNames returns a []string +func (obj *statePortLink) PortNames() []string { + if obj.obj.PortNames == nil { + obj.obj.PortNames = make([]string, 0) + } + return obj.obj.PortNames +} + +// The names of target ports. An empty or null list will target all ports. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// SetPortNames sets the []string value in the StatePortLink object +func (obj *statePortLink) SetPortNames(value []string) StatePortLink { + + if obj.obj.PortNames == nil { + obj.obj.PortNames = make([]string, 0) + } + obj.obj.PortNames = value + + return obj +} + +type StatePortLinkStateEnum string + +// Enum of State on StatePortLink +var StatePortLinkState = struct { + UP StatePortLinkStateEnum + DOWN StatePortLinkStateEnum +}{ + UP: StatePortLinkStateEnum("up"), + DOWN: StatePortLinkStateEnum("down"), +} + +func (obj *statePortLink) State() StatePortLinkStateEnum { + return StatePortLinkStateEnum(obj.obj.State.Enum().String()) +} + +func (obj *statePortLink) SetState(value StatePortLinkStateEnum) StatePortLink { + intValue, ok := otg.StatePortLink_State_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StatePortLinkStateEnum", string(value))) + return obj + } + enumValue := otg.StatePortLink_State_Enum(intValue) + obj.obj.State = &enumValue + + return obj +} + +func (obj *statePortLink) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // State is required + if obj.obj.State == nil { + vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StatePortLink") + } +} + +func (obj *statePortLink) setDefault() { + +} diff --git a/gosnappi/state_protocol.go b/gosnappi/state_protocol.go new file mode 100644 index 00000000..376f6a26 --- /dev/null +++ b/gosnappi/state_protocol.go @@ -0,0 +1,613 @@ +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" +) + +// ***** StateProtocol ***** +type stateProtocol struct { + validation + obj *otg.StateProtocol + marshaller marshalStateProtocol + unMarshaller unMarshalStateProtocol + allHolder StateProtocolAll + routeHolder StateProtocolRoute + lacpHolder StateProtocolLacp + bgpHolder StateProtocolBgp + isisHolder StateProtocolIsis +} + +func NewStateProtocol() StateProtocol { + obj := stateProtocol{obj: &otg.StateProtocol{}} + obj.setDefault() + return &obj +} + +func (obj *stateProtocol) msg() *otg.StateProtocol { + return obj.obj +} + +func (obj *stateProtocol) setMsg(msg *otg.StateProtocol) StateProtocol { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstateProtocol struct { + obj *stateProtocol +} + +type marshalStateProtocol interface { + // ToProto marshals StateProtocol to protobuf object *otg.StateProtocol + ToProto() (*otg.StateProtocol, error) + // ToPbText marshals StateProtocol to protobuf text + ToPbText() (string, error) + // ToYaml marshals StateProtocol to YAML text + ToYaml() (string, error) + // ToJson marshals StateProtocol to JSON text + ToJson() (string, error) +} + +type unMarshalstateProtocol struct { + obj *stateProtocol +} + +type unMarshalStateProtocol interface { + // FromProto unmarshals StateProtocol from protobuf object *otg.StateProtocol + FromProto(msg *otg.StateProtocol) (StateProtocol, error) + // FromPbText unmarshals StateProtocol from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StateProtocol from YAML text + FromYaml(value string) error + // FromJson unmarshals StateProtocol from JSON text + FromJson(value string) error +} + +func (obj *stateProtocol) Marshal() marshalStateProtocol { + if obj.marshaller == nil { + obj.marshaller = &marshalstateProtocol{obj: obj} + } + return obj.marshaller +} + +func (obj *stateProtocol) Unmarshal() unMarshalStateProtocol { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstateProtocol{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstateProtocol) ToProto() (*otg.StateProtocol, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstateProtocol) FromProto(msg *otg.StateProtocol) (StateProtocol, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstateProtocol) 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 *unMarshalstateProtocol) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalstateProtocol) 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 *unMarshalstateProtocol) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalstateProtocol) 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 *unMarshalstateProtocol) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *stateProtocol) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *stateProtocol) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *stateProtocol) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *stateProtocol) Clone() (StateProtocol, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStateProtocol() + 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 +} + +func (obj *stateProtocol) setNil() { + obj.allHolder = nil + obj.routeHolder = nil + obj.lacpHolder = nil + obj.bgpHolder = nil + obj.isisHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// StateProtocol is states associated with protocols on configured resources. +type StateProtocol interface { + Validation + // msg marshals StateProtocol to protobuf object *otg.StateProtocol + // and doesn't set defaults + msg() *otg.StateProtocol + // setMsg unmarshals StateProtocol from protobuf object *otg.StateProtocol + // and doesn't set defaults + setMsg(*otg.StateProtocol) StateProtocol + // provides marshal interface + Marshal() marshalStateProtocol + // provides unmarshal interface + Unmarshal() unMarshalStateProtocol + // validate validates StateProtocol + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StateProtocol, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns StateProtocolChoiceEnum, set in StateProtocol + Choice() StateProtocolChoiceEnum + // setChoice assigns StateProtocolChoiceEnum provided by user to StateProtocol + setChoice(value StateProtocolChoiceEnum) StateProtocol + // All returns StateProtocolAll, set in StateProtocol. + // StateProtocolAll is sets all configured protocols to `start` or `stop` state. + // Setting protocol state to `start` shall be a no-op if preceding `set_config` API call was made with `config.options.protocol_options.auto_start_all` set to `true` or if all the configured protocols are already started. + All() StateProtocolAll + // SetAll assigns StateProtocolAll provided by user to StateProtocol. + // StateProtocolAll is sets all configured protocols to `start` or `stop` state. + // Setting protocol state to `start` shall be a no-op if preceding `set_config` API call was made with `config.options.protocol_options.auto_start_all` set to `true` or if all the configured protocols are already started. + SetAll(value StateProtocolAll) StateProtocol + // HasAll checks if All has been set in StateProtocol + HasAll() bool + // Route returns StateProtocolRoute, set in StateProtocol. + // StateProtocolRoute is sets the state of configured routes + Route() StateProtocolRoute + // SetRoute assigns StateProtocolRoute provided by user to StateProtocol. + // StateProtocolRoute is sets the state of configured routes + SetRoute(value StateProtocolRoute) StateProtocol + // HasRoute checks if Route has been set in StateProtocol + HasRoute() bool + // Lacp returns StateProtocolLacp, set in StateProtocol. + // StateProtocolLacp is sets state of configured LACP + Lacp() StateProtocolLacp + // SetLacp assigns StateProtocolLacp provided by user to StateProtocol. + // StateProtocolLacp is sets state of configured LACP + SetLacp(value StateProtocolLacp) StateProtocol + // HasLacp checks if Lacp has been set in StateProtocol + HasLacp() bool + // Bgp returns StateProtocolBgp, set in StateProtocol. + // StateProtocolBgp is sets state of configured BGP peers. + Bgp() StateProtocolBgp + // SetBgp assigns StateProtocolBgp provided by user to StateProtocol. + // StateProtocolBgp is sets state of configured BGP peers. + SetBgp(value StateProtocolBgp) StateProtocol + // HasBgp checks if Bgp has been set in StateProtocol + HasBgp() bool + // Isis returns StateProtocolIsis, set in StateProtocol. + // StateProtocolIsis is sets state of configured ISIS routers. + Isis() StateProtocolIsis + // SetIsis assigns StateProtocolIsis provided by user to StateProtocol. + // StateProtocolIsis is sets state of configured ISIS routers. + SetIsis(value StateProtocolIsis) StateProtocol + // HasIsis checks if Isis has been set in StateProtocol + HasIsis() bool + setNil() +} + +type StateProtocolChoiceEnum string + +// Enum of Choice on StateProtocol +var StateProtocolChoice = struct { + ALL StateProtocolChoiceEnum + ROUTE StateProtocolChoiceEnum + LACP StateProtocolChoiceEnum + BGP StateProtocolChoiceEnum + ISIS StateProtocolChoiceEnum +}{ + ALL: StateProtocolChoiceEnum("all"), + ROUTE: StateProtocolChoiceEnum("route"), + LACP: StateProtocolChoiceEnum("lacp"), + BGP: StateProtocolChoiceEnum("bgp"), + ISIS: StateProtocolChoiceEnum("isis"), +} + +func (obj *stateProtocol) Choice() StateProtocolChoiceEnum { + return StateProtocolChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *stateProtocol) setChoice(value StateProtocolChoiceEnum) StateProtocol { + intValue, ok := otg.StateProtocol_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StateProtocolChoiceEnum", string(value))) + return obj + } + enumValue := otg.StateProtocol_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Isis = nil + obj.isisHolder = nil + obj.obj.Bgp = nil + obj.bgpHolder = nil + obj.obj.Lacp = nil + obj.lacpHolder = nil + obj.obj.Route = nil + obj.routeHolder = nil + obj.obj.All = nil + obj.allHolder = nil + + if value == StateProtocolChoice.ALL { + obj.obj.All = NewStateProtocolAll().msg() + } + + if value == StateProtocolChoice.ROUTE { + obj.obj.Route = NewStateProtocolRoute().msg() + } + + if value == StateProtocolChoice.LACP { + obj.obj.Lacp = NewStateProtocolLacp().msg() + } + + if value == StateProtocolChoice.BGP { + obj.obj.Bgp = NewStateProtocolBgp().msg() + } + + if value == StateProtocolChoice.ISIS { + obj.obj.Isis = NewStateProtocolIsis().msg() + } + + return obj +} + +// description is TBD +// All returns a StateProtocolAll +func (obj *stateProtocol) All() StateProtocolAll { + if obj.obj.All == nil { + obj.setChoice(StateProtocolChoice.ALL) + } + if obj.allHolder == nil { + obj.allHolder = &stateProtocolAll{obj: obj.obj.All} + } + return obj.allHolder +} + +// description is TBD +// All returns a StateProtocolAll +func (obj *stateProtocol) HasAll() bool { + return obj.obj.All != nil +} + +// description is TBD +// SetAll sets the StateProtocolAll value in the StateProtocol object +func (obj *stateProtocol) SetAll(value StateProtocolAll) StateProtocol { + obj.setChoice(StateProtocolChoice.ALL) + obj.allHolder = nil + obj.obj.All = value.msg() + + return obj +} + +// description is TBD +// Route returns a StateProtocolRoute +func (obj *stateProtocol) Route() StateProtocolRoute { + if obj.obj.Route == nil { + obj.setChoice(StateProtocolChoice.ROUTE) + } + if obj.routeHolder == nil { + obj.routeHolder = &stateProtocolRoute{obj: obj.obj.Route} + } + return obj.routeHolder +} + +// description is TBD +// Route returns a StateProtocolRoute +func (obj *stateProtocol) HasRoute() bool { + return obj.obj.Route != nil +} + +// description is TBD +// SetRoute sets the StateProtocolRoute value in the StateProtocol object +func (obj *stateProtocol) SetRoute(value StateProtocolRoute) StateProtocol { + obj.setChoice(StateProtocolChoice.ROUTE) + obj.routeHolder = nil + obj.obj.Route = value.msg() + + return obj +} + +// description is TBD +// Lacp returns a StateProtocolLacp +func (obj *stateProtocol) Lacp() StateProtocolLacp { + if obj.obj.Lacp == nil { + obj.setChoice(StateProtocolChoice.LACP) + } + if obj.lacpHolder == nil { + obj.lacpHolder = &stateProtocolLacp{obj: obj.obj.Lacp} + } + return obj.lacpHolder +} + +// description is TBD +// Lacp returns a StateProtocolLacp +func (obj *stateProtocol) HasLacp() bool { + return obj.obj.Lacp != nil +} + +// description is TBD +// SetLacp sets the StateProtocolLacp value in the StateProtocol object +func (obj *stateProtocol) SetLacp(value StateProtocolLacp) StateProtocol { + obj.setChoice(StateProtocolChoice.LACP) + obj.lacpHolder = nil + obj.obj.Lacp = value.msg() + + return obj +} + +// description is TBD +// Bgp returns a StateProtocolBgp +func (obj *stateProtocol) Bgp() StateProtocolBgp { + if obj.obj.Bgp == nil { + obj.setChoice(StateProtocolChoice.BGP) + } + if obj.bgpHolder == nil { + obj.bgpHolder = &stateProtocolBgp{obj: obj.obj.Bgp} + } + return obj.bgpHolder +} + +// description is TBD +// Bgp returns a StateProtocolBgp +func (obj *stateProtocol) HasBgp() bool { + return obj.obj.Bgp != nil +} + +// description is TBD +// SetBgp sets the StateProtocolBgp value in the StateProtocol object +func (obj *stateProtocol) SetBgp(value StateProtocolBgp) StateProtocol { + obj.setChoice(StateProtocolChoice.BGP) + obj.bgpHolder = nil + obj.obj.Bgp = value.msg() + + return obj +} + +// description is TBD +// Isis returns a StateProtocolIsis +func (obj *stateProtocol) Isis() StateProtocolIsis { + if obj.obj.Isis == nil { + obj.setChoice(StateProtocolChoice.ISIS) + } + if obj.isisHolder == nil { + obj.isisHolder = &stateProtocolIsis{obj: obj.obj.Isis} + } + return obj.isisHolder +} + +// description is TBD +// Isis returns a StateProtocolIsis +func (obj *stateProtocol) HasIsis() bool { + return obj.obj.Isis != nil +} + +// description is TBD +// SetIsis sets the StateProtocolIsis value in the StateProtocol object +func (obj *stateProtocol) SetIsis(value StateProtocolIsis) StateProtocol { + obj.setChoice(StateProtocolChoice.ISIS) + obj.isisHolder = nil + obj.obj.Isis = value.msg() + + return obj +} + +func (obj *stateProtocol) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface StateProtocol") + } + + if obj.obj.All != nil { + + obj.All().validateObj(vObj, set_default) + } + + if obj.obj.Route != nil { + + obj.Route().validateObj(vObj, set_default) + } + + if obj.obj.Lacp != nil { + + obj.Lacp().validateObj(vObj, set_default) + } + + if obj.obj.Bgp != nil { + + obj.Bgp().validateObj(vObj, set_default) + } + + if obj.obj.Isis != nil { + + obj.Isis().validateObj(vObj, set_default) + } + +} + +func (obj *stateProtocol) setDefault() { + var choices_set int = 0 + var choice StateProtocolChoiceEnum + + if obj.obj.All != nil { + choices_set += 1 + choice = StateProtocolChoice.ALL + } + + if obj.obj.Route != nil { + choices_set += 1 + choice = StateProtocolChoice.ROUTE + } + + if obj.obj.Lacp != nil { + choices_set += 1 + choice = StateProtocolChoice.LACP + } + + if obj.obj.Bgp != nil { + choices_set += 1 + choice = StateProtocolChoice.BGP + } + + if obj.obj.Isis != nil { + choices_set += 1 + choice = StateProtocolChoice.ISIS + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StateProtocol") + } + } else { + intVal := otg.StateProtocol_Choice_Enum_value[string(choice)] + enumValue := otg.StateProtocol_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/state_protocol_all.go b/gosnappi/state_protocol_all.go new file mode 100644 index 00000000..d0a1c18b --- /dev/null +++ b/gosnappi/state_protocol_all.go @@ -0,0 +1,315 @@ +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" +) + +// ***** StateProtocolAll ***** +type stateProtocolAll struct { + validation + obj *otg.StateProtocolAll + marshaller marshalStateProtocolAll + unMarshaller unMarshalStateProtocolAll +} + +func NewStateProtocolAll() StateProtocolAll { + obj := stateProtocolAll{obj: &otg.StateProtocolAll{}} + obj.setDefault() + return &obj +} + +func (obj *stateProtocolAll) msg() *otg.StateProtocolAll { + return obj.obj +} + +func (obj *stateProtocolAll) setMsg(msg *otg.StateProtocolAll) StateProtocolAll { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstateProtocolAll struct { + obj *stateProtocolAll +} + +type marshalStateProtocolAll interface { + // ToProto marshals StateProtocolAll to protobuf object *otg.StateProtocolAll + ToProto() (*otg.StateProtocolAll, error) + // ToPbText marshals StateProtocolAll to protobuf text + ToPbText() (string, error) + // ToYaml marshals StateProtocolAll to YAML text + ToYaml() (string, error) + // ToJson marshals StateProtocolAll to JSON text + ToJson() (string, error) +} + +type unMarshalstateProtocolAll struct { + obj *stateProtocolAll +} + +type unMarshalStateProtocolAll interface { + // FromProto unmarshals StateProtocolAll from protobuf object *otg.StateProtocolAll + FromProto(msg *otg.StateProtocolAll) (StateProtocolAll, error) + // FromPbText unmarshals StateProtocolAll from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StateProtocolAll from YAML text + FromYaml(value string) error + // FromJson unmarshals StateProtocolAll from JSON text + FromJson(value string) error +} + +func (obj *stateProtocolAll) Marshal() marshalStateProtocolAll { + if obj.marshaller == nil { + obj.marshaller = &marshalstateProtocolAll{obj: obj} + } + return obj.marshaller +} + +func (obj *stateProtocolAll) Unmarshal() unMarshalStateProtocolAll { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstateProtocolAll{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstateProtocolAll) ToProto() (*otg.StateProtocolAll, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstateProtocolAll) FromProto(msg *otg.StateProtocolAll) (StateProtocolAll, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstateProtocolAll) 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 *unMarshalstateProtocolAll) 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 *marshalstateProtocolAll) 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 *unMarshalstateProtocolAll) 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 *marshalstateProtocolAll) 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 *unMarshalstateProtocolAll) 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 *stateProtocolAll) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *stateProtocolAll) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *stateProtocolAll) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *stateProtocolAll) Clone() (StateProtocolAll, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStateProtocolAll() + 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 +} + +// StateProtocolAll is sets all configured protocols to `start` or `stop` state. +// Setting protocol state to `start` shall be a no-op if preceding `set_config` API call was made with `config.options.protocol_options.auto_start_all` set to `true` or if all the configured protocols are already started. +type StateProtocolAll interface { + Validation + // msg marshals StateProtocolAll to protobuf object *otg.StateProtocolAll + // and doesn't set defaults + msg() *otg.StateProtocolAll + // setMsg unmarshals StateProtocolAll from protobuf object *otg.StateProtocolAll + // and doesn't set defaults + setMsg(*otg.StateProtocolAll) StateProtocolAll + // provides marshal interface + Marshal() marshalStateProtocolAll + // provides unmarshal interface + Unmarshal() unMarshalStateProtocolAll + // validate validates StateProtocolAll + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StateProtocolAll, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // State returns StateProtocolAllStateEnum, set in StateProtocolAll + State() StateProtocolAllStateEnum + // SetState assigns StateProtocolAllStateEnum provided by user to StateProtocolAll + SetState(value StateProtocolAllStateEnum) StateProtocolAll +} + +type StateProtocolAllStateEnum string + +// Enum of State on StateProtocolAll +var StateProtocolAllState = struct { + START StateProtocolAllStateEnum + STOP StateProtocolAllStateEnum +}{ + START: StateProtocolAllStateEnum("start"), + STOP: StateProtocolAllStateEnum("stop"), +} + +func (obj *stateProtocolAll) State() StateProtocolAllStateEnum { + return StateProtocolAllStateEnum(obj.obj.State.Enum().String()) +} + +func (obj *stateProtocolAll) SetState(value StateProtocolAllStateEnum) StateProtocolAll { + intValue, ok := otg.StateProtocolAll_State_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StateProtocolAllStateEnum", string(value))) + return obj + } + enumValue := otg.StateProtocolAll_State_Enum(intValue) + obj.obj.State = &enumValue + + return obj +} + +func (obj *stateProtocolAll) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // State is required + if obj.obj.State == nil { + vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StateProtocolAll") + } +} + +func (obj *stateProtocolAll) setDefault() { + +} diff --git a/gosnappi/state_protocol_bgp.go b/gosnappi/state_protocol_bgp.go new file mode 100644 index 00000000..844ad134 --- /dev/null +++ b/gosnappi/state_protocol_bgp.go @@ -0,0 +1,387 @@ +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" +) + +// ***** StateProtocolBgp ***** +type stateProtocolBgp struct { + validation + obj *otg.StateProtocolBgp + marshaller marshalStateProtocolBgp + unMarshaller unMarshalStateProtocolBgp + peersHolder StateProtocolBgpPeers +} + +func NewStateProtocolBgp() StateProtocolBgp { + obj := stateProtocolBgp{obj: &otg.StateProtocolBgp{}} + obj.setDefault() + return &obj +} + +func (obj *stateProtocolBgp) msg() *otg.StateProtocolBgp { + return obj.obj +} + +func (obj *stateProtocolBgp) setMsg(msg *otg.StateProtocolBgp) StateProtocolBgp { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstateProtocolBgp struct { + obj *stateProtocolBgp +} + +type marshalStateProtocolBgp interface { + // ToProto marshals StateProtocolBgp to protobuf object *otg.StateProtocolBgp + ToProto() (*otg.StateProtocolBgp, error) + // ToPbText marshals StateProtocolBgp to protobuf text + ToPbText() (string, error) + // ToYaml marshals StateProtocolBgp to YAML text + ToYaml() (string, error) + // ToJson marshals StateProtocolBgp to JSON text + ToJson() (string, error) +} + +type unMarshalstateProtocolBgp struct { + obj *stateProtocolBgp +} + +type unMarshalStateProtocolBgp interface { + // FromProto unmarshals StateProtocolBgp from protobuf object *otg.StateProtocolBgp + FromProto(msg *otg.StateProtocolBgp) (StateProtocolBgp, error) + // FromPbText unmarshals StateProtocolBgp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StateProtocolBgp from YAML text + FromYaml(value string) error + // FromJson unmarshals StateProtocolBgp from JSON text + FromJson(value string) error +} + +func (obj *stateProtocolBgp) Marshal() marshalStateProtocolBgp { + if obj.marshaller == nil { + obj.marshaller = &marshalstateProtocolBgp{obj: obj} + } + return obj.marshaller +} + +func (obj *stateProtocolBgp) Unmarshal() unMarshalStateProtocolBgp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstateProtocolBgp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstateProtocolBgp) ToProto() (*otg.StateProtocolBgp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstateProtocolBgp) FromProto(msg *otg.StateProtocolBgp) (StateProtocolBgp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstateProtocolBgp) 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 *unMarshalstateProtocolBgp) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalstateProtocolBgp) 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 *unMarshalstateProtocolBgp) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalstateProtocolBgp) 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 *unMarshalstateProtocolBgp) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *stateProtocolBgp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *stateProtocolBgp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *stateProtocolBgp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *stateProtocolBgp) Clone() (StateProtocolBgp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStateProtocolBgp() + 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 +} + +func (obj *stateProtocolBgp) setNil() { + obj.peersHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// StateProtocolBgp is sets state of configured BGP peers. +type StateProtocolBgp interface { + Validation + // msg marshals StateProtocolBgp to protobuf object *otg.StateProtocolBgp + // and doesn't set defaults + msg() *otg.StateProtocolBgp + // setMsg unmarshals StateProtocolBgp from protobuf object *otg.StateProtocolBgp + // and doesn't set defaults + setMsg(*otg.StateProtocolBgp) StateProtocolBgp + // provides marshal interface + Marshal() marshalStateProtocolBgp + // provides unmarshal interface + Unmarshal() unMarshalStateProtocolBgp + // validate validates StateProtocolBgp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StateProtocolBgp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns StateProtocolBgpChoiceEnum, set in StateProtocolBgp + Choice() StateProtocolBgpChoiceEnum + // setChoice assigns StateProtocolBgpChoiceEnum provided by user to StateProtocolBgp + setChoice(value StateProtocolBgpChoiceEnum) StateProtocolBgp + // Peers returns StateProtocolBgpPeers, set in StateProtocolBgp. + // StateProtocolBgpPeers is sets state of configured BGP peers. + Peers() StateProtocolBgpPeers + // SetPeers assigns StateProtocolBgpPeers provided by user to StateProtocolBgp. + // StateProtocolBgpPeers is sets state of configured BGP peers. + SetPeers(value StateProtocolBgpPeers) StateProtocolBgp + // HasPeers checks if Peers has been set in StateProtocolBgp + HasPeers() bool + setNil() +} + +type StateProtocolBgpChoiceEnum string + +// Enum of Choice on StateProtocolBgp +var StateProtocolBgpChoice = struct { + PEERS StateProtocolBgpChoiceEnum +}{ + PEERS: StateProtocolBgpChoiceEnum("peers"), +} + +func (obj *stateProtocolBgp) Choice() StateProtocolBgpChoiceEnum { + return StateProtocolBgpChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *stateProtocolBgp) setChoice(value StateProtocolBgpChoiceEnum) StateProtocolBgp { + intValue, ok := otg.StateProtocolBgp_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StateProtocolBgpChoiceEnum", string(value))) + return obj + } + enumValue := otg.StateProtocolBgp_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Peers = nil + obj.peersHolder = nil + + if value == StateProtocolBgpChoice.PEERS { + obj.obj.Peers = NewStateProtocolBgpPeers().msg() + } + + return obj +} + +// description is TBD +// Peers returns a StateProtocolBgpPeers +func (obj *stateProtocolBgp) Peers() StateProtocolBgpPeers { + if obj.obj.Peers == nil { + obj.setChoice(StateProtocolBgpChoice.PEERS) + } + if obj.peersHolder == nil { + obj.peersHolder = &stateProtocolBgpPeers{obj: obj.obj.Peers} + } + return obj.peersHolder +} + +// description is TBD +// Peers returns a StateProtocolBgpPeers +func (obj *stateProtocolBgp) HasPeers() bool { + return obj.obj.Peers != nil +} + +// description is TBD +// SetPeers sets the StateProtocolBgpPeers value in the StateProtocolBgp object +func (obj *stateProtocolBgp) SetPeers(value StateProtocolBgpPeers) StateProtocolBgp { + obj.setChoice(StateProtocolBgpChoice.PEERS) + obj.peersHolder = nil + obj.obj.Peers = value.msg() + + return obj +} + +func (obj *stateProtocolBgp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface StateProtocolBgp") + } + + if obj.obj.Peers != nil { + + obj.Peers().validateObj(vObj, set_default) + } + +} + +func (obj *stateProtocolBgp) setDefault() { + var choices_set int = 0 + var choice StateProtocolBgpChoiceEnum + + if obj.obj.Peers != nil { + choices_set += 1 + choice = StateProtocolBgpChoice.PEERS + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StateProtocolBgp") + } + } else { + intVal := otg.StateProtocolBgp_Choice_Enum_value[string(choice)] + enumValue := otg.StateProtocolBgp_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/state_protocol_bgp_peers.go b/gosnappi/state_protocol_bgp_peers.go new file mode 100644 index 00000000..4765569f --- /dev/null +++ b/gosnappi/state_protocol_bgp_peers.go @@ -0,0 +1,357 @@ +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" +) + +// ***** StateProtocolBgpPeers ***** +type stateProtocolBgpPeers struct { + validation + obj *otg.StateProtocolBgpPeers + marshaller marshalStateProtocolBgpPeers + unMarshaller unMarshalStateProtocolBgpPeers +} + +func NewStateProtocolBgpPeers() StateProtocolBgpPeers { + obj := stateProtocolBgpPeers{obj: &otg.StateProtocolBgpPeers{}} + obj.setDefault() + return &obj +} + +func (obj *stateProtocolBgpPeers) msg() *otg.StateProtocolBgpPeers { + return obj.obj +} + +func (obj *stateProtocolBgpPeers) setMsg(msg *otg.StateProtocolBgpPeers) StateProtocolBgpPeers { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstateProtocolBgpPeers struct { + obj *stateProtocolBgpPeers +} + +type marshalStateProtocolBgpPeers interface { + // ToProto marshals StateProtocolBgpPeers to protobuf object *otg.StateProtocolBgpPeers + ToProto() (*otg.StateProtocolBgpPeers, error) + // ToPbText marshals StateProtocolBgpPeers to protobuf text + ToPbText() (string, error) + // ToYaml marshals StateProtocolBgpPeers to YAML text + ToYaml() (string, error) + // ToJson marshals StateProtocolBgpPeers to JSON text + ToJson() (string, error) +} + +type unMarshalstateProtocolBgpPeers struct { + obj *stateProtocolBgpPeers +} + +type unMarshalStateProtocolBgpPeers interface { + // FromProto unmarshals StateProtocolBgpPeers from protobuf object *otg.StateProtocolBgpPeers + FromProto(msg *otg.StateProtocolBgpPeers) (StateProtocolBgpPeers, error) + // FromPbText unmarshals StateProtocolBgpPeers from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StateProtocolBgpPeers from YAML text + FromYaml(value string) error + // FromJson unmarshals StateProtocolBgpPeers from JSON text + FromJson(value string) error +} + +func (obj *stateProtocolBgpPeers) Marshal() marshalStateProtocolBgpPeers { + if obj.marshaller == nil { + obj.marshaller = &marshalstateProtocolBgpPeers{obj: obj} + } + return obj.marshaller +} + +func (obj *stateProtocolBgpPeers) Unmarshal() unMarshalStateProtocolBgpPeers { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstateProtocolBgpPeers{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstateProtocolBgpPeers) ToProto() (*otg.StateProtocolBgpPeers, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstateProtocolBgpPeers) FromProto(msg *otg.StateProtocolBgpPeers) (StateProtocolBgpPeers, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstateProtocolBgpPeers) 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 *unMarshalstateProtocolBgpPeers) 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 *marshalstateProtocolBgpPeers) 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 *unMarshalstateProtocolBgpPeers) 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 *marshalstateProtocolBgpPeers) 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 *unMarshalstateProtocolBgpPeers) 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 *stateProtocolBgpPeers) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *stateProtocolBgpPeers) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *stateProtocolBgpPeers) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *stateProtocolBgpPeers) Clone() (StateProtocolBgpPeers, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStateProtocolBgpPeers() + 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 +} + +// StateProtocolBgpPeers is sets state of configured BGP peers. +type StateProtocolBgpPeers interface { + Validation + // msg marshals StateProtocolBgpPeers to protobuf object *otg.StateProtocolBgpPeers + // and doesn't set defaults + msg() *otg.StateProtocolBgpPeers + // setMsg unmarshals StateProtocolBgpPeers from protobuf object *otg.StateProtocolBgpPeers + // and doesn't set defaults + setMsg(*otg.StateProtocolBgpPeers) StateProtocolBgpPeers + // provides marshal interface + Marshal() marshalStateProtocolBgpPeers + // provides unmarshal interface + Unmarshal() unMarshalStateProtocolBgpPeers + // validate validates StateProtocolBgpPeers + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StateProtocolBgpPeers, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // PeerNames returns []string, set in StateProtocolBgpPeers. + PeerNames() []string + // SetPeerNames assigns []string provided by user to StateProtocolBgpPeers + SetPeerNames(value []string) StateProtocolBgpPeers + // State returns StateProtocolBgpPeersStateEnum, set in StateProtocolBgpPeers + State() StateProtocolBgpPeersStateEnum + // SetState assigns StateProtocolBgpPeersStateEnum provided by user to StateProtocolBgpPeers + SetState(value StateProtocolBgpPeersStateEnum) StateProtocolBgpPeers +} + +// The names of BGP peers for which the state has to be applied. An empty or null list will control all BGP peers. +// +// x-constraint: +// - /components/schemas/Bgp.V4Peer/properties/name +// - /components/schemas/Bgp.V6Peer/properties/name +// +// x-constraint: +// - /components/schemas/Bgp.V4Peer/properties/name +// - /components/schemas/Bgp.V6Peer/properties/name +// +// PeerNames returns a []string +func (obj *stateProtocolBgpPeers) PeerNames() []string { + if obj.obj.PeerNames == nil { + obj.obj.PeerNames = make([]string, 0) + } + return obj.obj.PeerNames +} + +// The names of BGP peers for which the state has to be applied. An empty or null list will control all BGP peers. +// +// x-constraint: +// - /components/schemas/Bgp.V4Peer/properties/name +// - /components/schemas/Bgp.V6Peer/properties/name +// +// x-constraint: +// - /components/schemas/Bgp.V4Peer/properties/name +// - /components/schemas/Bgp.V6Peer/properties/name +// +// SetPeerNames sets the []string value in the StateProtocolBgpPeers object +func (obj *stateProtocolBgpPeers) SetPeerNames(value []string) StateProtocolBgpPeers { + + if obj.obj.PeerNames == nil { + obj.obj.PeerNames = make([]string, 0) + } + obj.obj.PeerNames = value + + return obj +} + +type StateProtocolBgpPeersStateEnum string + +// Enum of State on StateProtocolBgpPeers +var StateProtocolBgpPeersState = struct { + UP StateProtocolBgpPeersStateEnum + DOWN StateProtocolBgpPeersStateEnum +}{ + UP: StateProtocolBgpPeersStateEnum("up"), + DOWN: StateProtocolBgpPeersStateEnum("down"), +} + +func (obj *stateProtocolBgpPeers) State() StateProtocolBgpPeersStateEnum { + return StateProtocolBgpPeersStateEnum(obj.obj.State.Enum().String()) +} + +func (obj *stateProtocolBgpPeers) SetState(value StateProtocolBgpPeersStateEnum) StateProtocolBgpPeers { + intValue, ok := otg.StateProtocolBgpPeers_State_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StateProtocolBgpPeersStateEnum", string(value))) + return obj + } + enumValue := otg.StateProtocolBgpPeers_State_Enum(intValue) + obj.obj.State = &enumValue + + return obj +} + +func (obj *stateProtocolBgpPeers) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // State is required + if obj.obj.State == nil { + vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StateProtocolBgpPeers") + } +} + +func (obj *stateProtocolBgpPeers) setDefault() { + +} diff --git a/gosnappi/state_protocol_isis.go b/gosnappi/state_protocol_isis.go new file mode 100644 index 00000000..5bfcedcc --- /dev/null +++ b/gosnappi/state_protocol_isis.go @@ -0,0 +1,387 @@ +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" +) + +// ***** StateProtocolIsis ***** +type stateProtocolIsis struct { + validation + obj *otg.StateProtocolIsis + marshaller marshalStateProtocolIsis + unMarshaller unMarshalStateProtocolIsis + routersHolder StateProtocolIsisRouters +} + +func NewStateProtocolIsis() StateProtocolIsis { + obj := stateProtocolIsis{obj: &otg.StateProtocolIsis{}} + obj.setDefault() + return &obj +} + +func (obj *stateProtocolIsis) msg() *otg.StateProtocolIsis { + return obj.obj +} + +func (obj *stateProtocolIsis) setMsg(msg *otg.StateProtocolIsis) StateProtocolIsis { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstateProtocolIsis struct { + obj *stateProtocolIsis +} + +type marshalStateProtocolIsis interface { + // ToProto marshals StateProtocolIsis to protobuf object *otg.StateProtocolIsis + ToProto() (*otg.StateProtocolIsis, error) + // ToPbText marshals StateProtocolIsis to protobuf text + ToPbText() (string, error) + // ToYaml marshals StateProtocolIsis to YAML text + ToYaml() (string, error) + // ToJson marshals StateProtocolIsis to JSON text + ToJson() (string, error) +} + +type unMarshalstateProtocolIsis struct { + obj *stateProtocolIsis +} + +type unMarshalStateProtocolIsis interface { + // FromProto unmarshals StateProtocolIsis from protobuf object *otg.StateProtocolIsis + FromProto(msg *otg.StateProtocolIsis) (StateProtocolIsis, error) + // FromPbText unmarshals StateProtocolIsis from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StateProtocolIsis from YAML text + FromYaml(value string) error + // FromJson unmarshals StateProtocolIsis from JSON text + FromJson(value string) error +} + +func (obj *stateProtocolIsis) Marshal() marshalStateProtocolIsis { + if obj.marshaller == nil { + obj.marshaller = &marshalstateProtocolIsis{obj: obj} + } + return obj.marshaller +} + +func (obj *stateProtocolIsis) Unmarshal() unMarshalStateProtocolIsis { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstateProtocolIsis{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstateProtocolIsis) ToProto() (*otg.StateProtocolIsis, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstateProtocolIsis) FromProto(msg *otg.StateProtocolIsis) (StateProtocolIsis, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstateProtocolIsis) 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 *unMarshalstateProtocolIsis) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalstateProtocolIsis) 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 *unMarshalstateProtocolIsis) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalstateProtocolIsis) 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 *unMarshalstateProtocolIsis) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *stateProtocolIsis) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *stateProtocolIsis) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *stateProtocolIsis) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *stateProtocolIsis) Clone() (StateProtocolIsis, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStateProtocolIsis() + 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 +} + +func (obj *stateProtocolIsis) setNil() { + obj.routersHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// StateProtocolIsis is sets state of configured ISIS routers. +type StateProtocolIsis interface { + Validation + // msg marshals StateProtocolIsis to protobuf object *otg.StateProtocolIsis + // and doesn't set defaults + msg() *otg.StateProtocolIsis + // setMsg unmarshals StateProtocolIsis from protobuf object *otg.StateProtocolIsis + // and doesn't set defaults + setMsg(*otg.StateProtocolIsis) StateProtocolIsis + // provides marshal interface + Marshal() marshalStateProtocolIsis + // provides unmarshal interface + Unmarshal() unMarshalStateProtocolIsis + // validate validates StateProtocolIsis + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StateProtocolIsis, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns StateProtocolIsisChoiceEnum, set in StateProtocolIsis + Choice() StateProtocolIsisChoiceEnum + // setChoice assigns StateProtocolIsisChoiceEnum provided by user to StateProtocolIsis + setChoice(value StateProtocolIsisChoiceEnum) StateProtocolIsis + // Routers returns StateProtocolIsisRouters, set in StateProtocolIsis. + // StateProtocolIsisRouters is sets state of configured ISIS routers. + Routers() StateProtocolIsisRouters + // SetRouters assigns StateProtocolIsisRouters provided by user to StateProtocolIsis. + // StateProtocolIsisRouters is sets state of configured ISIS routers. + SetRouters(value StateProtocolIsisRouters) StateProtocolIsis + // HasRouters checks if Routers has been set in StateProtocolIsis + HasRouters() bool + setNil() +} + +type StateProtocolIsisChoiceEnum string + +// Enum of Choice on StateProtocolIsis +var StateProtocolIsisChoice = struct { + ROUTERS StateProtocolIsisChoiceEnum +}{ + ROUTERS: StateProtocolIsisChoiceEnum("routers"), +} + +func (obj *stateProtocolIsis) Choice() StateProtocolIsisChoiceEnum { + return StateProtocolIsisChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *stateProtocolIsis) setChoice(value StateProtocolIsisChoiceEnum) StateProtocolIsis { + intValue, ok := otg.StateProtocolIsis_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StateProtocolIsisChoiceEnum", string(value))) + return obj + } + enumValue := otg.StateProtocolIsis_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Routers = nil + obj.routersHolder = nil + + if value == StateProtocolIsisChoice.ROUTERS { + obj.obj.Routers = NewStateProtocolIsisRouters().msg() + } + + return obj +} + +// description is TBD +// Routers returns a StateProtocolIsisRouters +func (obj *stateProtocolIsis) Routers() StateProtocolIsisRouters { + if obj.obj.Routers == nil { + obj.setChoice(StateProtocolIsisChoice.ROUTERS) + } + if obj.routersHolder == nil { + obj.routersHolder = &stateProtocolIsisRouters{obj: obj.obj.Routers} + } + return obj.routersHolder +} + +// description is TBD +// Routers returns a StateProtocolIsisRouters +func (obj *stateProtocolIsis) HasRouters() bool { + return obj.obj.Routers != nil +} + +// description is TBD +// SetRouters sets the StateProtocolIsisRouters value in the StateProtocolIsis object +func (obj *stateProtocolIsis) SetRouters(value StateProtocolIsisRouters) StateProtocolIsis { + obj.setChoice(StateProtocolIsisChoice.ROUTERS) + obj.routersHolder = nil + obj.obj.Routers = value.msg() + + return obj +} + +func (obj *stateProtocolIsis) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface StateProtocolIsis") + } + + if obj.obj.Routers != nil { + + obj.Routers().validateObj(vObj, set_default) + } + +} + +func (obj *stateProtocolIsis) setDefault() { + var choices_set int = 0 + var choice StateProtocolIsisChoiceEnum + + if obj.obj.Routers != nil { + choices_set += 1 + choice = StateProtocolIsisChoice.ROUTERS + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StateProtocolIsis") + } + } else { + intVal := otg.StateProtocolIsis_Choice_Enum_value[string(choice)] + enumValue := otg.StateProtocolIsis_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/state_protocol_isis_routers.go b/gosnappi/state_protocol_isis_routers.go new file mode 100644 index 00000000..09abbe34 --- /dev/null +++ b/gosnappi/state_protocol_isis_routers.go @@ -0,0 +1,353 @@ +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" +) + +// ***** StateProtocolIsisRouters ***** +type stateProtocolIsisRouters struct { + validation + obj *otg.StateProtocolIsisRouters + marshaller marshalStateProtocolIsisRouters + unMarshaller unMarshalStateProtocolIsisRouters +} + +func NewStateProtocolIsisRouters() StateProtocolIsisRouters { + obj := stateProtocolIsisRouters{obj: &otg.StateProtocolIsisRouters{}} + obj.setDefault() + return &obj +} + +func (obj *stateProtocolIsisRouters) msg() *otg.StateProtocolIsisRouters { + return obj.obj +} + +func (obj *stateProtocolIsisRouters) setMsg(msg *otg.StateProtocolIsisRouters) StateProtocolIsisRouters { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstateProtocolIsisRouters struct { + obj *stateProtocolIsisRouters +} + +type marshalStateProtocolIsisRouters interface { + // ToProto marshals StateProtocolIsisRouters to protobuf object *otg.StateProtocolIsisRouters + ToProto() (*otg.StateProtocolIsisRouters, error) + // ToPbText marshals StateProtocolIsisRouters to protobuf text + ToPbText() (string, error) + // ToYaml marshals StateProtocolIsisRouters to YAML text + ToYaml() (string, error) + // ToJson marshals StateProtocolIsisRouters to JSON text + ToJson() (string, error) +} + +type unMarshalstateProtocolIsisRouters struct { + obj *stateProtocolIsisRouters +} + +type unMarshalStateProtocolIsisRouters interface { + // FromProto unmarshals StateProtocolIsisRouters from protobuf object *otg.StateProtocolIsisRouters + FromProto(msg *otg.StateProtocolIsisRouters) (StateProtocolIsisRouters, error) + // FromPbText unmarshals StateProtocolIsisRouters from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StateProtocolIsisRouters from YAML text + FromYaml(value string) error + // FromJson unmarshals StateProtocolIsisRouters from JSON text + FromJson(value string) error +} + +func (obj *stateProtocolIsisRouters) Marshal() marshalStateProtocolIsisRouters { + if obj.marshaller == nil { + obj.marshaller = &marshalstateProtocolIsisRouters{obj: obj} + } + return obj.marshaller +} + +func (obj *stateProtocolIsisRouters) Unmarshal() unMarshalStateProtocolIsisRouters { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstateProtocolIsisRouters{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstateProtocolIsisRouters) ToProto() (*otg.StateProtocolIsisRouters, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstateProtocolIsisRouters) FromProto(msg *otg.StateProtocolIsisRouters) (StateProtocolIsisRouters, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstateProtocolIsisRouters) 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 *unMarshalstateProtocolIsisRouters) 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 *marshalstateProtocolIsisRouters) 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 *unMarshalstateProtocolIsisRouters) 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 *marshalstateProtocolIsisRouters) 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 *unMarshalstateProtocolIsisRouters) 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 *stateProtocolIsisRouters) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *stateProtocolIsisRouters) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *stateProtocolIsisRouters) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *stateProtocolIsisRouters) Clone() (StateProtocolIsisRouters, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStateProtocolIsisRouters() + 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 +} + +// StateProtocolIsisRouters is sets state of configured ISIS routers. +type StateProtocolIsisRouters interface { + Validation + // msg marshals StateProtocolIsisRouters to protobuf object *otg.StateProtocolIsisRouters + // and doesn't set defaults + msg() *otg.StateProtocolIsisRouters + // setMsg unmarshals StateProtocolIsisRouters from protobuf object *otg.StateProtocolIsisRouters + // and doesn't set defaults + setMsg(*otg.StateProtocolIsisRouters) StateProtocolIsisRouters + // provides marshal interface + Marshal() marshalStateProtocolIsisRouters + // provides unmarshal interface + Unmarshal() unMarshalStateProtocolIsisRouters + // validate validates StateProtocolIsisRouters + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StateProtocolIsisRouters, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RouterNames returns []string, set in StateProtocolIsisRouters. + RouterNames() []string + // SetRouterNames assigns []string provided by user to StateProtocolIsisRouters + SetRouterNames(value []string) StateProtocolIsisRouters + // State returns StateProtocolIsisRoutersStateEnum, set in StateProtocolIsisRouters + State() StateProtocolIsisRoutersStateEnum + // SetState assigns StateProtocolIsisRoutersStateEnum provided by user to StateProtocolIsisRouters + SetState(value StateProtocolIsisRoutersStateEnum) StateProtocolIsisRouters +} + +// The names of ISIS routers for which the state has to be applied. An empty or null list will control all ISIS routers. +// +// x-constraint: +// - /components/schemas/Device.IsisRouter/properties/name +// +// x-constraint: +// - /components/schemas/Device.IsisRouter/properties/name +// +// RouterNames returns a []string +func (obj *stateProtocolIsisRouters) RouterNames() []string { + if obj.obj.RouterNames == nil { + obj.obj.RouterNames = make([]string, 0) + } + return obj.obj.RouterNames +} + +// The names of ISIS routers for which the state has to be applied. An empty or null list will control all ISIS routers. +// +// x-constraint: +// - /components/schemas/Device.IsisRouter/properties/name +// +// x-constraint: +// - /components/schemas/Device.IsisRouter/properties/name +// +// SetRouterNames sets the []string value in the StateProtocolIsisRouters object +func (obj *stateProtocolIsisRouters) SetRouterNames(value []string) StateProtocolIsisRouters { + + if obj.obj.RouterNames == nil { + obj.obj.RouterNames = make([]string, 0) + } + obj.obj.RouterNames = value + + return obj +} + +type StateProtocolIsisRoutersStateEnum string + +// Enum of State on StateProtocolIsisRouters +var StateProtocolIsisRoutersState = struct { + UP StateProtocolIsisRoutersStateEnum + DOWN StateProtocolIsisRoutersStateEnum +}{ + UP: StateProtocolIsisRoutersStateEnum("up"), + DOWN: StateProtocolIsisRoutersStateEnum("down"), +} + +func (obj *stateProtocolIsisRouters) State() StateProtocolIsisRoutersStateEnum { + return StateProtocolIsisRoutersStateEnum(obj.obj.State.Enum().String()) +} + +func (obj *stateProtocolIsisRouters) SetState(value StateProtocolIsisRoutersStateEnum) StateProtocolIsisRouters { + intValue, ok := otg.StateProtocolIsisRouters_State_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StateProtocolIsisRoutersStateEnum", string(value))) + return obj + } + enumValue := otg.StateProtocolIsisRouters_State_Enum(intValue) + obj.obj.State = &enumValue + + return obj +} + +func (obj *stateProtocolIsisRouters) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // State is required + if obj.obj.State == nil { + vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StateProtocolIsisRouters") + } +} + +func (obj *stateProtocolIsisRouters) setDefault() { + +} diff --git a/gosnappi/state_protocol_lacp.go b/gosnappi/state_protocol_lacp.go new file mode 100644 index 00000000..da775e20 --- /dev/null +++ b/gosnappi/state_protocol_lacp.go @@ -0,0 +1,443 @@ +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" +) + +// ***** StateProtocolLacp ***** +type stateProtocolLacp struct { + validation + obj *otg.StateProtocolLacp + marshaller marshalStateProtocolLacp + unMarshaller unMarshalStateProtocolLacp + adminHolder StateProtocolLacpAdmin + memberPortsHolder StateProtocolLacpMemberPorts +} + +func NewStateProtocolLacp() StateProtocolLacp { + obj := stateProtocolLacp{obj: &otg.StateProtocolLacp{}} + obj.setDefault() + return &obj +} + +func (obj *stateProtocolLacp) msg() *otg.StateProtocolLacp { + return obj.obj +} + +func (obj *stateProtocolLacp) setMsg(msg *otg.StateProtocolLacp) StateProtocolLacp { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstateProtocolLacp struct { + obj *stateProtocolLacp +} + +type marshalStateProtocolLacp interface { + // ToProto marshals StateProtocolLacp to protobuf object *otg.StateProtocolLacp + ToProto() (*otg.StateProtocolLacp, error) + // ToPbText marshals StateProtocolLacp to protobuf text + ToPbText() (string, error) + // ToYaml marshals StateProtocolLacp to YAML text + ToYaml() (string, error) + // ToJson marshals StateProtocolLacp to JSON text + ToJson() (string, error) +} + +type unMarshalstateProtocolLacp struct { + obj *stateProtocolLacp +} + +type unMarshalStateProtocolLacp interface { + // FromProto unmarshals StateProtocolLacp from protobuf object *otg.StateProtocolLacp + FromProto(msg *otg.StateProtocolLacp) (StateProtocolLacp, error) + // FromPbText unmarshals StateProtocolLacp from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StateProtocolLacp from YAML text + FromYaml(value string) error + // FromJson unmarshals StateProtocolLacp from JSON text + FromJson(value string) error +} + +func (obj *stateProtocolLacp) Marshal() marshalStateProtocolLacp { + if obj.marshaller == nil { + obj.marshaller = &marshalstateProtocolLacp{obj: obj} + } + return obj.marshaller +} + +func (obj *stateProtocolLacp) Unmarshal() unMarshalStateProtocolLacp { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstateProtocolLacp{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstateProtocolLacp) ToProto() (*otg.StateProtocolLacp, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstateProtocolLacp) FromProto(msg *otg.StateProtocolLacp) (StateProtocolLacp, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstateProtocolLacp) 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 *unMarshalstateProtocolLacp) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalstateProtocolLacp) 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 *unMarshalstateProtocolLacp) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalstateProtocolLacp) 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 *unMarshalstateProtocolLacp) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *stateProtocolLacp) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *stateProtocolLacp) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *stateProtocolLacp) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *stateProtocolLacp) Clone() (StateProtocolLacp, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStateProtocolLacp() + 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 +} + +func (obj *stateProtocolLacp) setNil() { + obj.adminHolder = nil + obj.memberPortsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// StateProtocolLacp is sets state of configured LACP +type StateProtocolLacp interface { + Validation + // msg marshals StateProtocolLacp to protobuf object *otg.StateProtocolLacp + // and doesn't set defaults + msg() *otg.StateProtocolLacp + // setMsg unmarshals StateProtocolLacp from protobuf object *otg.StateProtocolLacp + // and doesn't set defaults + setMsg(*otg.StateProtocolLacp) StateProtocolLacp + // provides marshal interface + Marshal() marshalStateProtocolLacp + // provides unmarshal interface + Unmarshal() unMarshalStateProtocolLacp + // validate validates StateProtocolLacp + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StateProtocolLacp, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns StateProtocolLacpChoiceEnum, set in StateProtocolLacp + Choice() StateProtocolLacpChoiceEnum + // setChoice assigns StateProtocolLacpChoiceEnum provided by user to StateProtocolLacp + setChoice(value StateProtocolLacpChoiceEnum) StateProtocolLacp + // Admin returns StateProtocolLacpAdmin, set in StateProtocolLacp. + // StateProtocolLacpAdmin is sets admin state of LACP configured on LAG members + Admin() StateProtocolLacpAdmin + // SetAdmin assigns StateProtocolLacpAdmin provided by user to StateProtocolLacp. + // StateProtocolLacpAdmin is sets admin state of LACP configured on LAG members + SetAdmin(value StateProtocolLacpAdmin) StateProtocolLacp + // HasAdmin checks if Admin has been set in StateProtocolLacp + HasAdmin() bool + // MemberPorts returns StateProtocolLacpMemberPorts, set in StateProtocolLacp. + // StateProtocolLacpMemberPorts is sets state of LACP member ports configured on LAG. + MemberPorts() StateProtocolLacpMemberPorts + // SetMemberPorts assigns StateProtocolLacpMemberPorts provided by user to StateProtocolLacp. + // StateProtocolLacpMemberPorts is sets state of LACP member ports configured on LAG. + SetMemberPorts(value StateProtocolLacpMemberPorts) StateProtocolLacp + // HasMemberPorts checks if MemberPorts has been set in StateProtocolLacp + HasMemberPorts() bool + setNil() +} + +type StateProtocolLacpChoiceEnum string + +// Enum of Choice on StateProtocolLacp +var StateProtocolLacpChoice = struct { + ADMIN StateProtocolLacpChoiceEnum + MEMBER_PORTS StateProtocolLacpChoiceEnum +}{ + ADMIN: StateProtocolLacpChoiceEnum("admin"), + MEMBER_PORTS: StateProtocolLacpChoiceEnum("member_ports"), +} + +func (obj *stateProtocolLacp) Choice() StateProtocolLacpChoiceEnum { + return StateProtocolLacpChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *stateProtocolLacp) setChoice(value StateProtocolLacpChoiceEnum) StateProtocolLacp { + intValue, ok := otg.StateProtocolLacp_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StateProtocolLacpChoiceEnum", string(value))) + return obj + } + enumValue := otg.StateProtocolLacp_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.MemberPorts = nil + obj.memberPortsHolder = nil + obj.obj.Admin = nil + obj.adminHolder = nil + + if value == StateProtocolLacpChoice.ADMIN { + obj.obj.Admin = NewStateProtocolLacpAdmin().msg() + } + + if value == StateProtocolLacpChoice.MEMBER_PORTS { + obj.obj.MemberPorts = NewStateProtocolLacpMemberPorts().msg() + } + + return obj +} + +// description is TBD +// Admin returns a StateProtocolLacpAdmin +func (obj *stateProtocolLacp) Admin() StateProtocolLacpAdmin { + if obj.obj.Admin == nil { + obj.setChoice(StateProtocolLacpChoice.ADMIN) + } + if obj.adminHolder == nil { + obj.adminHolder = &stateProtocolLacpAdmin{obj: obj.obj.Admin} + } + return obj.adminHolder +} + +// description is TBD +// Admin returns a StateProtocolLacpAdmin +func (obj *stateProtocolLacp) HasAdmin() bool { + return obj.obj.Admin != nil +} + +// description is TBD +// SetAdmin sets the StateProtocolLacpAdmin value in the StateProtocolLacp object +func (obj *stateProtocolLacp) SetAdmin(value StateProtocolLacpAdmin) StateProtocolLacp { + obj.setChoice(StateProtocolLacpChoice.ADMIN) + obj.adminHolder = nil + obj.obj.Admin = value.msg() + + return obj +} + +// description is TBD +// MemberPorts returns a StateProtocolLacpMemberPorts +func (obj *stateProtocolLacp) MemberPorts() StateProtocolLacpMemberPorts { + if obj.obj.MemberPorts == nil { + obj.setChoice(StateProtocolLacpChoice.MEMBER_PORTS) + } + if obj.memberPortsHolder == nil { + obj.memberPortsHolder = &stateProtocolLacpMemberPorts{obj: obj.obj.MemberPorts} + } + return obj.memberPortsHolder +} + +// description is TBD +// MemberPorts returns a StateProtocolLacpMemberPorts +func (obj *stateProtocolLacp) HasMemberPorts() bool { + return obj.obj.MemberPorts != nil +} + +// description is TBD +// SetMemberPorts sets the StateProtocolLacpMemberPorts value in the StateProtocolLacp object +func (obj *stateProtocolLacp) SetMemberPorts(value StateProtocolLacpMemberPorts) StateProtocolLacp { + obj.setChoice(StateProtocolLacpChoice.MEMBER_PORTS) + obj.memberPortsHolder = nil + obj.obj.MemberPorts = value.msg() + + return obj +} + +func (obj *stateProtocolLacp) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface StateProtocolLacp") + } + + if obj.obj.Admin != nil { + + obj.Admin().validateObj(vObj, set_default) + } + + if obj.obj.MemberPorts != nil { + + obj.MemberPorts().validateObj(vObj, set_default) + } + +} + +func (obj *stateProtocolLacp) setDefault() { + var choices_set int = 0 + var choice StateProtocolLacpChoiceEnum + + if obj.obj.Admin != nil { + choices_set += 1 + choice = StateProtocolLacpChoice.ADMIN + } + + if obj.obj.MemberPorts != nil { + choices_set += 1 + choice = StateProtocolLacpChoice.MEMBER_PORTS + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StateProtocolLacp") + } + } else { + intVal := otg.StateProtocolLacp_Choice_Enum_value[string(choice)] + enumValue := otg.StateProtocolLacp_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/state_protocol_lacp_admin.go b/gosnappi/state_protocol_lacp_admin.go new file mode 100644 index 00000000..1b9df76f --- /dev/null +++ b/gosnappi/state_protocol_lacp_admin.go @@ -0,0 +1,353 @@ +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" +) + +// ***** StateProtocolLacpAdmin ***** +type stateProtocolLacpAdmin struct { + validation + obj *otg.StateProtocolLacpAdmin + marshaller marshalStateProtocolLacpAdmin + unMarshaller unMarshalStateProtocolLacpAdmin +} + +func NewStateProtocolLacpAdmin() StateProtocolLacpAdmin { + obj := stateProtocolLacpAdmin{obj: &otg.StateProtocolLacpAdmin{}} + obj.setDefault() + return &obj +} + +func (obj *stateProtocolLacpAdmin) msg() *otg.StateProtocolLacpAdmin { + return obj.obj +} + +func (obj *stateProtocolLacpAdmin) setMsg(msg *otg.StateProtocolLacpAdmin) StateProtocolLacpAdmin { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstateProtocolLacpAdmin struct { + obj *stateProtocolLacpAdmin +} + +type marshalStateProtocolLacpAdmin interface { + // ToProto marshals StateProtocolLacpAdmin to protobuf object *otg.StateProtocolLacpAdmin + ToProto() (*otg.StateProtocolLacpAdmin, error) + // ToPbText marshals StateProtocolLacpAdmin to protobuf text + ToPbText() (string, error) + // ToYaml marshals StateProtocolLacpAdmin to YAML text + ToYaml() (string, error) + // ToJson marshals StateProtocolLacpAdmin to JSON text + ToJson() (string, error) +} + +type unMarshalstateProtocolLacpAdmin struct { + obj *stateProtocolLacpAdmin +} + +type unMarshalStateProtocolLacpAdmin interface { + // FromProto unmarshals StateProtocolLacpAdmin from protobuf object *otg.StateProtocolLacpAdmin + FromProto(msg *otg.StateProtocolLacpAdmin) (StateProtocolLacpAdmin, error) + // FromPbText unmarshals StateProtocolLacpAdmin from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StateProtocolLacpAdmin from YAML text + FromYaml(value string) error + // FromJson unmarshals StateProtocolLacpAdmin from JSON text + FromJson(value string) error +} + +func (obj *stateProtocolLacpAdmin) Marshal() marshalStateProtocolLacpAdmin { + if obj.marshaller == nil { + obj.marshaller = &marshalstateProtocolLacpAdmin{obj: obj} + } + return obj.marshaller +} + +func (obj *stateProtocolLacpAdmin) Unmarshal() unMarshalStateProtocolLacpAdmin { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstateProtocolLacpAdmin{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstateProtocolLacpAdmin) ToProto() (*otg.StateProtocolLacpAdmin, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstateProtocolLacpAdmin) FromProto(msg *otg.StateProtocolLacpAdmin) (StateProtocolLacpAdmin, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstateProtocolLacpAdmin) 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 *unMarshalstateProtocolLacpAdmin) 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 *marshalstateProtocolLacpAdmin) 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 *unMarshalstateProtocolLacpAdmin) 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 *marshalstateProtocolLacpAdmin) 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 *unMarshalstateProtocolLacpAdmin) 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 *stateProtocolLacpAdmin) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *stateProtocolLacpAdmin) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *stateProtocolLacpAdmin) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *stateProtocolLacpAdmin) Clone() (StateProtocolLacpAdmin, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStateProtocolLacpAdmin() + 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 +} + +// StateProtocolLacpAdmin is sets admin state of LACP configured on LAG members +type StateProtocolLacpAdmin interface { + Validation + // msg marshals StateProtocolLacpAdmin to protobuf object *otg.StateProtocolLacpAdmin + // and doesn't set defaults + msg() *otg.StateProtocolLacpAdmin + // setMsg unmarshals StateProtocolLacpAdmin from protobuf object *otg.StateProtocolLacpAdmin + // and doesn't set defaults + setMsg(*otg.StateProtocolLacpAdmin) StateProtocolLacpAdmin + // provides marshal interface + Marshal() marshalStateProtocolLacpAdmin + // provides unmarshal interface + Unmarshal() unMarshalStateProtocolLacpAdmin + // validate validates StateProtocolLacpAdmin + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StateProtocolLacpAdmin, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // LagMemberNames returns []string, set in StateProtocolLacpAdmin. + LagMemberNames() []string + // SetLagMemberNames assigns []string provided by user to StateProtocolLacpAdmin + SetLagMemberNames(value []string) StateProtocolLacpAdmin + // State returns StateProtocolLacpAdminStateEnum, set in StateProtocolLacpAdmin + State() StateProtocolLacpAdminStateEnum + // SetState assigns StateProtocolLacpAdminStateEnum provided by user to StateProtocolLacpAdmin + SetState(value StateProtocolLacpAdminStateEnum) StateProtocolLacpAdmin +} + +// The names of LAG members (ports) for which the state has to be applied. An empty or null list will control all LAG members. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// LagMemberNames returns a []string +func (obj *stateProtocolLacpAdmin) LagMemberNames() []string { + if obj.obj.LagMemberNames == nil { + obj.obj.LagMemberNames = make([]string, 0) + } + return obj.obj.LagMemberNames +} + +// The names of LAG members (ports) for which the state has to be applied. An empty or null list will control all LAG members. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// SetLagMemberNames sets the []string value in the StateProtocolLacpAdmin object +func (obj *stateProtocolLacpAdmin) SetLagMemberNames(value []string) StateProtocolLacpAdmin { + + if obj.obj.LagMemberNames == nil { + obj.obj.LagMemberNames = make([]string, 0) + } + obj.obj.LagMemberNames = value + + return obj +} + +type StateProtocolLacpAdminStateEnum string + +// Enum of State on StateProtocolLacpAdmin +var StateProtocolLacpAdminState = struct { + UP StateProtocolLacpAdminStateEnum + DOWN StateProtocolLacpAdminStateEnum +}{ + UP: StateProtocolLacpAdminStateEnum("up"), + DOWN: StateProtocolLacpAdminStateEnum("down"), +} + +func (obj *stateProtocolLacpAdmin) State() StateProtocolLacpAdminStateEnum { + return StateProtocolLacpAdminStateEnum(obj.obj.State.Enum().String()) +} + +func (obj *stateProtocolLacpAdmin) SetState(value StateProtocolLacpAdminStateEnum) StateProtocolLacpAdmin { + intValue, ok := otg.StateProtocolLacpAdmin_State_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StateProtocolLacpAdminStateEnum", string(value))) + return obj + } + enumValue := otg.StateProtocolLacpAdmin_State_Enum(intValue) + obj.obj.State = &enumValue + + return obj +} + +func (obj *stateProtocolLacpAdmin) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // State is required + if obj.obj.State == nil { + vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StateProtocolLacpAdmin") + } +} + +func (obj *stateProtocolLacpAdmin) setDefault() { + +} diff --git a/gosnappi/state_protocol_lacp_member_ports.go b/gosnappi/state_protocol_lacp_member_ports.go new file mode 100644 index 00000000..20137ab1 --- /dev/null +++ b/gosnappi/state_protocol_lacp_member_ports.go @@ -0,0 +1,353 @@ +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" +) + +// ***** StateProtocolLacpMemberPorts ***** +type stateProtocolLacpMemberPorts struct { + validation + obj *otg.StateProtocolLacpMemberPorts + marshaller marshalStateProtocolLacpMemberPorts + unMarshaller unMarshalStateProtocolLacpMemberPorts +} + +func NewStateProtocolLacpMemberPorts() StateProtocolLacpMemberPorts { + obj := stateProtocolLacpMemberPorts{obj: &otg.StateProtocolLacpMemberPorts{}} + obj.setDefault() + return &obj +} + +func (obj *stateProtocolLacpMemberPorts) msg() *otg.StateProtocolLacpMemberPorts { + return obj.obj +} + +func (obj *stateProtocolLacpMemberPorts) setMsg(msg *otg.StateProtocolLacpMemberPorts) StateProtocolLacpMemberPorts { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstateProtocolLacpMemberPorts struct { + obj *stateProtocolLacpMemberPorts +} + +type marshalStateProtocolLacpMemberPorts interface { + // ToProto marshals StateProtocolLacpMemberPorts to protobuf object *otg.StateProtocolLacpMemberPorts + ToProto() (*otg.StateProtocolLacpMemberPorts, error) + // ToPbText marshals StateProtocolLacpMemberPorts to protobuf text + ToPbText() (string, error) + // ToYaml marshals StateProtocolLacpMemberPorts to YAML text + ToYaml() (string, error) + // ToJson marshals StateProtocolLacpMemberPorts to JSON text + ToJson() (string, error) +} + +type unMarshalstateProtocolLacpMemberPorts struct { + obj *stateProtocolLacpMemberPorts +} + +type unMarshalStateProtocolLacpMemberPorts interface { + // FromProto unmarshals StateProtocolLacpMemberPorts from protobuf object *otg.StateProtocolLacpMemberPorts + FromProto(msg *otg.StateProtocolLacpMemberPorts) (StateProtocolLacpMemberPorts, error) + // FromPbText unmarshals StateProtocolLacpMemberPorts from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StateProtocolLacpMemberPorts from YAML text + FromYaml(value string) error + // FromJson unmarshals StateProtocolLacpMemberPorts from JSON text + FromJson(value string) error +} + +func (obj *stateProtocolLacpMemberPorts) Marshal() marshalStateProtocolLacpMemberPorts { + if obj.marshaller == nil { + obj.marshaller = &marshalstateProtocolLacpMemberPorts{obj: obj} + } + return obj.marshaller +} + +func (obj *stateProtocolLacpMemberPorts) Unmarshal() unMarshalStateProtocolLacpMemberPorts { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstateProtocolLacpMemberPorts{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstateProtocolLacpMemberPorts) ToProto() (*otg.StateProtocolLacpMemberPorts, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstateProtocolLacpMemberPorts) FromProto(msg *otg.StateProtocolLacpMemberPorts) (StateProtocolLacpMemberPorts, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstateProtocolLacpMemberPorts) 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 *unMarshalstateProtocolLacpMemberPorts) 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 *marshalstateProtocolLacpMemberPorts) 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 *unMarshalstateProtocolLacpMemberPorts) 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 *marshalstateProtocolLacpMemberPorts) 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 *unMarshalstateProtocolLacpMemberPorts) 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 *stateProtocolLacpMemberPorts) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *stateProtocolLacpMemberPorts) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *stateProtocolLacpMemberPorts) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *stateProtocolLacpMemberPorts) Clone() (StateProtocolLacpMemberPorts, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStateProtocolLacpMemberPorts() + 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 +} + +// StateProtocolLacpMemberPorts is sets state of LACP member ports configured on LAG. +type StateProtocolLacpMemberPorts interface { + Validation + // msg marshals StateProtocolLacpMemberPorts to protobuf object *otg.StateProtocolLacpMemberPorts + // and doesn't set defaults + msg() *otg.StateProtocolLacpMemberPorts + // setMsg unmarshals StateProtocolLacpMemberPorts from protobuf object *otg.StateProtocolLacpMemberPorts + // and doesn't set defaults + setMsg(*otg.StateProtocolLacpMemberPorts) StateProtocolLacpMemberPorts + // provides marshal interface + Marshal() marshalStateProtocolLacpMemberPorts + // provides unmarshal interface + Unmarshal() unMarshalStateProtocolLacpMemberPorts + // validate validates StateProtocolLacpMemberPorts + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StateProtocolLacpMemberPorts, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // LagMemberNames returns []string, set in StateProtocolLacpMemberPorts. + LagMemberNames() []string + // SetLagMemberNames assigns []string provided by user to StateProtocolLacpMemberPorts + SetLagMemberNames(value []string) StateProtocolLacpMemberPorts + // State returns StateProtocolLacpMemberPortsStateEnum, set in StateProtocolLacpMemberPorts + State() StateProtocolLacpMemberPortsStateEnum + // SetState assigns StateProtocolLacpMemberPortsStateEnum provided by user to StateProtocolLacpMemberPorts + SetState(value StateProtocolLacpMemberPortsStateEnum) StateProtocolLacpMemberPorts +} + +// The names of LAG members (ports) for which the state has to be applied. An empty or null list will control all LAG members. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// LagMemberNames returns a []string +func (obj *stateProtocolLacpMemberPorts) LagMemberNames() []string { + if obj.obj.LagMemberNames == nil { + obj.obj.LagMemberNames = make([]string, 0) + } + return obj.obj.LagMemberNames +} + +// The names of LAG members (ports) for which the state has to be applied. An empty or null list will control all LAG members. +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// x-constraint: +// - /components/schemas/Port/properties/name +// +// SetLagMemberNames sets the []string value in the StateProtocolLacpMemberPorts object +func (obj *stateProtocolLacpMemberPorts) SetLagMemberNames(value []string) StateProtocolLacpMemberPorts { + + if obj.obj.LagMemberNames == nil { + obj.obj.LagMemberNames = make([]string, 0) + } + obj.obj.LagMemberNames = value + + return obj +} + +type StateProtocolLacpMemberPortsStateEnum string + +// Enum of State on StateProtocolLacpMemberPorts +var StateProtocolLacpMemberPortsState = struct { + UP StateProtocolLacpMemberPortsStateEnum + DOWN StateProtocolLacpMemberPortsStateEnum +}{ + UP: StateProtocolLacpMemberPortsStateEnum("up"), + DOWN: StateProtocolLacpMemberPortsStateEnum("down"), +} + +func (obj *stateProtocolLacpMemberPorts) State() StateProtocolLacpMemberPortsStateEnum { + return StateProtocolLacpMemberPortsStateEnum(obj.obj.State.Enum().String()) +} + +func (obj *stateProtocolLacpMemberPorts) SetState(value StateProtocolLacpMemberPortsStateEnum) StateProtocolLacpMemberPorts { + intValue, ok := otg.StateProtocolLacpMemberPorts_State_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StateProtocolLacpMemberPortsStateEnum", string(value))) + return obj + } + enumValue := otg.StateProtocolLacpMemberPorts_State_Enum(intValue) + obj.obj.State = &enumValue + + return obj +} + +func (obj *stateProtocolLacpMemberPorts) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // State is required + if obj.obj.State == nil { + vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StateProtocolLacpMemberPorts") + } +} + +func (obj *stateProtocolLacpMemberPorts) setDefault() { + +} diff --git a/gosnappi/state_protocol_route.go b/gosnappi/state_protocol_route.go new file mode 100644 index 00000000..6e076d0a --- /dev/null +++ b/gosnappi/state_protocol_route.go @@ -0,0 +1,365 @@ +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" +) + +// ***** StateProtocolRoute ***** +type stateProtocolRoute struct { + validation + obj *otg.StateProtocolRoute + marshaller marshalStateProtocolRoute + unMarshaller unMarshalStateProtocolRoute +} + +func NewStateProtocolRoute() StateProtocolRoute { + obj := stateProtocolRoute{obj: &otg.StateProtocolRoute{}} + obj.setDefault() + return &obj +} + +func (obj *stateProtocolRoute) msg() *otg.StateProtocolRoute { + return obj.obj +} + +func (obj *stateProtocolRoute) setMsg(msg *otg.StateProtocolRoute) StateProtocolRoute { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstateProtocolRoute struct { + obj *stateProtocolRoute +} + +type marshalStateProtocolRoute interface { + // ToProto marshals StateProtocolRoute to protobuf object *otg.StateProtocolRoute + ToProto() (*otg.StateProtocolRoute, error) + // ToPbText marshals StateProtocolRoute to protobuf text + ToPbText() (string, error) + // ToYaml marshals StateProtocolRoute to YAML text + ToYaml() (string, error) + // ToJson marshals StateProtocolRoute to JSON text + ToJson() (string, error) +} + +type unMarshalstateProtocolRoute struct { + obj *stateProtocolRoute +} + +type unMarshalStateProtocolRoute interface { + // FromProto unmarshals StateProtocolRoute from protobuf object *otg.StateProtocolRoute + FromProto(msg *otg.StateProtocolRoute) (StateProtocolRoute, error) + // FromPbText unmarshals StateProtocolRoute from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StateProtocolRoute from YAML text + FromYaml(value string) error + // FromJson unmarshals StateProtocolRoute from JSON text + FromJson(value string) error +} + +func (obj *stateProtocolRoute) Marshal() marshalStateProtocolRoute { + if obj.marshaller == nil { + obj.marshaller = &marshalstateProtocolRoute{obj: obj} + } + return obj.marshaller +} + +func (obj *stateProtocolRoute) Unmarshal() unMarshalStateProtocolRoute { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstateProtocolRoute{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstateProtocolRoute) ToProto() (*otg.StateProtocolRoute, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstateProtocolRoute) FromProto(msg *otg.StateProtocolRoute) (StateProtocolRoute, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstateProtocolRoute) 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 *unMarshalstateProtocolRoute) 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 *marshalstateProtocolRoute) 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 *unMarshalstateProtocolRoute) 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 *marshalstateProtocolRoute) 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 *unMarshalstateProtocolRoute) 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 *stateProtocolRoute) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *stateProtocolRoute) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *stateProtocolRoute) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *stateProtocolRoute) Clone() (StateProtocolRoute, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStateProtocolRoute() + 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 +} + +// StateProtocolRoute is sets the state of configured routes +type StateProtocolRoute interface { + Validation + // msg marshals StateProtocolRoute to protobuf object *otg.StateProtocolRoute + // and doesn't set defaults + msg() *otg.StateProtocolRoute + // setMsg unmarshals StateProtocolRoute from protobuf object *otg.StateProtocolRoute + // and doesn't set defaults + setMsg(*otg.StateProtocolRoute) StateProtocolRoute + // provides marshal interface + Marshal() marshalStateProtocolRoute + // provides unmarshal interface + Unmarshal() unMarshalStateProtocolRoute + // validate validates StateProtocolRoute + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StateProtocolRoute, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Names returns []string, set in StateProtocolRoute. + Names() []string + // SetNames assigns []string provided by user to StateProtocolRoute + SetNames(value []string) StateProtocolRoute + // State returns StateProtocolRouteStateEnum, set in StateProtocolRoute + State() StateProtocolRouteStateEnum + // SetState assigns StateProtocolRouteStateEnum provided by user to StateProtocolRoute + SetState(value StateProtocolRouteStateEnum) StateProtocolRoute +} + +// The names of device route objects to control. If no names are specified then all route objects that match the x-constraint will be affected. +// +// x-constraint: +// - /components/schemas/Bgp.V4RouteRange/properties/name +// - /components/schemas/Bgp.V6RouteRange/properties/name +// - /components/schemas/Isis.V4RouteRange/properties/name +// - /components/schemas/Isis.V6RouteRange/properties/name +// +// x-constraint: +// - /components/schemas/Bgp.V4RouteRange/properties/name +// - /components/schemas/Bgp.V6RouteRange/properties/name +// - /components/schemas/Isis.V4RouteRange/properties/name +// - /components/schemas/Isis.V6RouteRange/properties/name +// +// Names returns a []string +func (obj *stateProtocolRoute) Names() []string { + if obj.obj.Names == nil { + obj.obj.Names = make([]string, 0) + } + return obj.obj.Names +} + +// The names of device route objects to control. If no names are specified then all route objects that match the x-constraint will be affected. +// +// x-constraint: +// - /components/schemas/Bgp.V4RouteRange/properties/name +// - /components/schemas/Bgp.V6RouteRange/properties/name +// - /components/schemas/Isis.V4RouteRange/properties/name +// - /components/schemas/Isis.V6RouteRange/properties/name +// +// x-constraint: +// - /components/schemas/Bgp.V4RouteRange/properties/name +// - /components/schemas/Bgp.V6RouteRange/properties/name +// - /components/schemas/Isis.V4RouteRange/properties/name +// - /components/schemas/Isis.V6RouteRange/properties/name +// +// SetNames sets the []string value in the StateProtocolRoute object +func (obj *stateProtocolRoute) SetNames(value []string) StateProtocolRoute { + + if obj.obj.Names == nil { + obj.obj.Names = make([]string, 0) + } + obj.obj.Names = value + + return obj +} + +type StateProtocolRouteStateEnum string + +// Enum of State on StateProtocolRoute +var StateProtocolRouteState = struct { + WITHDRAW StateProtocolRouteStateEnum + ADVERTISE StateProtocolRouteStateEnum +}{ + WITHDRAW: StateProtocolRouteStateEnum("withdraw"), + ADVERTISE: StateProtocolRouteStateEnum("advertise"), +} + +func (obj *stateProtocolRoute) State() StateProtocolRouteStateEnum { + return StateProtocolRouteStateEnum(obj.obj.State.Enum().String()) +} + +func (obj *stateProtocolRoute) SetState(value StateProtocolRouteStateEnum) StateProtocolRoute { + intValue, ok := otg.StateProtocolRoute_State_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StateProtocolRouteStateEnum", string(value))) + return obj + } + enumValue := otg.StateProtocolRoute_State_Enum(intValue) + obj.obj.State = &enumValue + + return obj +} + +func (obj *stateProtocolRoute) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // State is required + if obj.obj.State == nil { + vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StateProtocolRoute") + } +} + +func (obj *stateProtocolRoute) setDefault() { + +} diff --git a/gosnappi/state_traffic.go b/gosnappi/state_traffic.go new file mode 100644 index 00000000..6d25f083 --- /dev/null +++ b/gosnappi/state_traffic.go @@ -0,0 +1,387 @@ +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" +) + +// ***** StateTraffic ***** +type stateTraffic struct { + validation + obj *otg.StateTraffic + marshaller marshalStateTraffic + unMarshaller unMarshalStateTraffic + flowTransmitHolder StateTrafficFlowTransmit +} + +func NewStateTraffic() StateTraffic { + obj := stateTraffic{obj: &otg.StateTraffic{}} + obj.setDefault() + return &obj +} + +func (obj *stateTraffic) msg() *otg.StateTraffic { + return obj.obj +} + +func (obj *stateTraffic) setMsg(msg *otg.StateTraffic) StateTraffic { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstateTraffic struct { + obj *stateTraffic +} + +type marshalStateTraffic interface { + // ToProto marshals StateTraffic to protobuf object *otg.StateTraffic + ToProto() (*otg.StateTraffic, error) + // ToPbText marshals StateTraffic to protobuf text + ToPbText() (string, error) + // ToYaml marshals StateTraffic to YAML text + ToYaml() (string, error) + // ToJson marshals StateTraffic to JSON text + ToJson() (string, error) +} + +type unMarshalstateTraffic struct { + obj *stateTraffic +} + +type unMarshalStateTraffic interface { + // FromProto unmarshals StateTraffic from protobuf object *otg.StateTraffic + FromProto(msg *otg.StateTraffic) (StateTraffic, error) + // FromPbText unmarshals StateTraffic from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StateTraffic from YAML text + FromYaml(value string) error + // FromJson unmarshals StateTraffic from JSON text + FromJson(value string) error +} + +func (obj *stateTraffic) Marshal() marshalStateTraffic { + if obj.marshaller == nil { + obj.marshaller = &marshalstateTraffic{obj: obj} + } + return obj.marshaller +} + +func (obj *stateTraffic) Unmarshal() unMarshalStateTraffic { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstateTraffic{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstateTraffic) ToProto() (*otg.StateTraffic, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstateTraffic) FromProto(msg *otg.StateTraffic) (StateTraffic, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstateTraffic) 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 *unMarshalstateTraffic) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalstateTraffic) 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 *unMarshalstateTraffic) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalstateTraffic) 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 *unMarshalstateTraffic) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *stateTraffic) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *stateTraffic) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *stateTraffic) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *stateTraffic) Clone() (StateTraffic, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStateTraffic() + 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 +} + +func (obj *stateTraffic) setNil() { + obj.flowTransmitHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// StateTraffic is states associated with configured flows +type StateTraffic interface { + Validation + // msg marshals StateTraffic to protobuf object *otg.StateTraffic + // and doesn't set defaults + msg() *otg.StateTraffic + // setMsg unmarshals StateTraffic from protobuf object *otg.StateTraffic + // and doesn't set defaults + setMsg(*otg.StateTraffic) StateTraffic + // provides marshal interface + Marshal() marshalStateTraffic + // provides unmarshal interface + Unmarshal() unMarshalStateTraffic + // validate validates StateTraffic + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StateTraffic, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns StateTrafficChoiceEnum, set in StateTraffic + Choice() StateTrafficChoiceEnum + // setChoice assigns StateTrafficChoiceEnum provided by user to StateTraffic + setChoice(value StateTrafficChoiceEnum) StateTraffic + // FlowTransmit returns StateTrafficFlowTransmit, set in StateTraffic. + // StateTrafficFlowTransmit is provides state control of flow transmission. + FlowTransmit() StateTrafficFlowTransmit + // SetFlowTransmit assigns StateTrafficFlowTransmit provided by user to StateTraffic. + // StateTrafficFlowTransmit is provides state control of flow transmission. + SetFlowTransmit(value StateTrafficFlowTransmit) StateTraffic + // HasFlowTransmit checks if FlowTransmit has been set in StateTraffic + HasFlowTransmit() bool + setNil() +} + +type StateTrafficChoiceEnum string + +// Enum of Choice on StateTraffic +var StateTrafficChoice = struct { + FLOW_TRANSMIT StateTrafficChoiceEnum +}{ + FLOW_TRANSMIT: StateTrafficChoiceEnum("flow_transmit"), +} + +func (obj *stateTraffic) Choice() StateTrafficChoiceEnum { + return StateTrafficChoiceEnum(obj.obj.Choice.Enum().String()) +} + +func (obj *stateTraffic) setChoice(value StateTrafficChoiceEnum) StateTraffic { + intValue, ok := otg.StateTraffic_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StateTrafficChoiceEnum", string(value))) + return obj + } + enumValue := otg.StateTraffic_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.FlowTransmit = nil + obj.flowTransmitHolder = nil + + if value == StateTrafficChoice.FLOW_TRANSMIT { + obj.obj.FlowTransmit = NewStateTrafficFlowTransmit().msg() + } + + return obj +} + +// description is TBD +// FlowTransmit returns a StateTrafficFlowTransmit +func (obj *stateTraffic) FlowTransmit() StateTrafficFlowTransmit { + if obj.obj.FlowTransmit == nil { + obj.setChoice(StateTrafficChoice.FLOW_TRANSMIT) + } + if obj.flowTransmitHolder == nil { + obj.flowTransmitHolder = &stateTrafficFlowTransmit{obj: obj.obj.FlowTransmit} + } + return obj.flowTransmitHolder +} + +// description is TBD +// FlowTransmit returns a StateTrafficFlowTransmit +func (obj *stateTraffic) HasFlowTransmit() bool { + return obj.obj.FlowTransmit != nil +} + +// description is TBD +// SetFlowTransmit sets the StateTrafficFlowTransmit value in the StateTraffic object +func (obj *stateTraffic) SetFlowTransmit(value StateTrafficFlowTransmit) StateTraffic { + obj.setChoice(StateTrafficChoice.FLOW_TRANSMIT) + obj.flowTransmitHolder = nil + obj.obj.FlowTransmit = value.msg() + + return obj +} + +func (obj *stateTraffic) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // Choice is required + if obj.obj.Choice == nil { + vObj.validationErrors = append(vObj.validationErrors, "Choice is required field on interface StateTraffic") + } + + if obj.obj.FlowTransmit != nil { + + obj.FlowTransmit().validateObj(vObj, set_default) + } + +} + +func (obj *stateTraffic) setDefault() { + var choices_set int = 0 + var choice StateTrafficChoiceEnum + + if obj.obj.FlowTransmit != nil { + choices_set += 1 + choice = StateTrafficChoice.FLOW_TRANSMIT + } + if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StateTraffic") + } + } else { + intVal := otg.StateTraffic_Choice_Enum_value[string(choice)] + enumValue := otg.StateTraffic_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/state_traffic_flow_transmit.go b/gosnappi/state_traffic_flow_transmit.go new file mode 100644 index 00000000..500df684 --- /dev/null +++ b/gosnappi/state_traffic_flow_transmit.go @@ -0,0 +1,359 @@ +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" +) + +// ***** StateTrafficFlowTransmit ***** +type stateTrafficFlowTransmit struct { + validation + obj *otg.StateTrafficFlowTransmit + marshaller marshalStateTrafficFlowTransmit + unMarshaller unMarshalStateTrafficFlowTransmit +} + +func NewStateTrafficFlowTransmit() StateTrafficFlowTransmit { + obj := stateTrafficFlowTransmit{obj: &otg.StateTrafficFlowTransmit{}} + obj.setDefault() + return &obj +} + +func (obj *stateTrafficFlowTransmit) msg() *otg.StateTrafficFlowTransmit { + return obj.obj +} + +func (obj *stateTrafficFlowTransmit) setMsg(msg *otg.StateTrafficFlowTransmit) StateTrafficFlowTransmit { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstateTrafficFlowTransmit struct { + obj *stateTrafficFlowTransmit +} + +type marshalStateTrafficFlowTransmit interface { + // ToProto marshals StateTrafficFlowTransmit to protobuf object *otg.StateTrafficFlowTransmit + ToProto() (*otg.StateTrafficFlowTransmit, error) + // ToPbText marshals StateTrafficFlowTransmit to protobuf text + ToPbText() (string, error) + // ToYaml marshals StateTrafficFlowTransmit to YAML text + ToYaml() (string, error) + // ToJson marshals StateTrafficFlowTransmit to JSON text + ToJson() (string, error) +} + +type unMarshalstateTrafficFlowTransmit struct { + obj *stateTrafficFlowTransmit +} + +type unMarshalStateTrafficFlowTransmit interface { + // FromProto unmarshals StateTrafficFlowTransmit from protobuf object *otg.StateTrafficFlowTransmit + FromProto(msg *otg.StateTrafficFlowTransmit) (StateTrafficFlowTransmit, error) + // FromPbText unmarshals StateTrafficFlowTransmit from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StateTrafficFlowTransmit from YAML text + FromYaml(value string) error + // FromJson unmarshals StateTrafficFlowTransmit from JSON text + FromJson(value string) error +} + +func (obj *stateTrafficFlowTransmit) Marshal() marshalStateTrafficFlowTransmit { + if obj.marshaller == nil { + obj.marshaller = &marshalstateTrafficFlowTransmit{obj: obj} + } + return obj.marshaller +} + +func (obj *stateTrafficFlowTransmit) Unmarshal() unMarshalStateTrafficFlowTransmit { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstateTrafficFlowTransmit{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstateTrafficFlowTransmit) ToProto() (*otg.StateTrafficFlowTransmit, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstateTrafficFlowTransmit) FromProto(msg *otg.StateTrafficFlowTransmit) (StateTrafficFlowTransmit, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstateTrafficFlowTransmit) 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 *unMarshalstateTrafficFlowTransmit) 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 *marshalstateTrafficFlowTransmit) 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 *unMarshalstateTrafficFlowTransmit) 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 *marshalstateTrafficFlowTransmit) 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 *unMarshalstateTrafficFlowTransmit) 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 *stateTrafficFlowTransmit) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *stateTrafficFlowTransmit) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *stateTrafficFlowTransmit) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *stateTrafficFlowTransmit) Clone() (StateTrafficFlowTransmit, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStateTrafficFlowTransmit() + 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 +} + +// StateTrafficFlowTransmit is provides state control of flow transmission. +type StateTrafficFlowTransmit interface { + Validation + // msg marshals StateTrafficFlowTransmit to protobuf object *otg.StateTrafficFlowTransmit + // and doesn't set defaults + msg() *otg.StateTrafficFlowTransmit + // setMsg unmarshals StateTrafficFlowTransmit from protobuf object *otg.StateTrafficFlowTransmit + // and doesn't set defaults + setMsg(*otg.StateTrafficFlowTransmit) StateTrafficFlowTransmit + // provides marshal interface + Marshal() marshalStateTrafficFlowTransmit + // provides unmarshal interface + Unmarshal() unMarshalStateTrafficFlowTransmit + // validate validates StateTrafficFlowTransmit + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StateTrafficFlowTransmit, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // FlowNames returns []string, set in StateTrafficFlowTransmit. + FlowNames() []string + // SetFlowNames assigns []string provided by user to StateTrafficFlowTransmit + SetFlowNames(value []string) StateTrafficFlowTransmit + // State returns StateTrafficFlowTransmitStateEnum, set in StateTrafficFlowTransmit + State() StateTrafficFlowTransmitStateEnum + // SetState assigns StateTrafficFlowTransmitStateEnum provided by user to StateTrafficFlowTransmit + SetState(value StateTrafficFlowTransmitStateEnum) StateTrafficFlowTransmit +} + +// The names of flows to which the transmit state will be applied to. If the list of flow_names is empty or null the state will be applied to all configured flows. +// If the list is not empty any flow that is not included in the list of flow_names MUST be ignored and not included in the state change. +// +// x-constraint: +// - /components/schemas/Flow/properties/name +// +// x-constraint: +// - /components/schemas/Flow/properties/name +// +// FlowNames returns a []string +func (obj *stateTrafficFlowTransmit) FlowNames() []string { + if obj.obj.FlowNames == nil { + obj.obj.FlowNames = make([]string, 0) + } + return obj.obj.FlowNames +} + +// The names of flows to which the transmit state will be applied to. If the list of flow_names is empty or null the state will be applied to all configured flows. +// If the list is not empty any flow that is not included in the list of flow_names MUST be ignored and not included in the state change. +// +// x-constraint: +// - /components/schemas/Flow/properties/name +// +// x-constraint: +// - /components/schemas/Flow/properties/name +// +// SetFlowNames sets the []string value in the StateTrafficFlowTransmit object +func (obj *stateTrafficFlowTransmit) SetFlowNames(value []string) StateTrafficFlowTransmit { + + if obj.obj.FlowNames == nil { + obj.obj.FlowNames = make([]string, 0) + } + obj.obj.FlowNames = value + + return obj +} + +type StateTrafficFlowTransmitStateEnum string + +// Enum of State on StateTrafficFlowTransmit +var StateTrafficFlowTransmitState = struct { + START StateTrafficFlowTransmitStateEnum + STOP StateTrafficFlowTransmitStateEnum + PAUSE StateTrafficFlowTransmitStateEnum + RESUME StateTrafficFlowTransmitStateEnum +}{ + START: StateTrafficFlowTransmitStateEnum("start"), + STOP: StateTrafficFlowTransmitStateEnum("stop"), + PAUSE: StateTrafficFlowTransmitStateEnum("pause"), + RESUME: StateTrafficFlowTransmitStateEnum("resume"), +} + +func (obj *stateTrafficFlowTransmit) State() StateTrafficFlowTransmitStateEnum { + return StateTrafficFlowTransmitStateEnum(obj.obj.State.Enum().String()) +} + +func (obj *stateTrafficFlowTransmit) SetState(value StateTrafficFlowTransmitStateEnum) StateTrafficFlowTransmit { + intValue, ok := otg.StateTrafficFlowTransmit_State_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StateTrafficFlowTransmitStateEnum", string(value))) + return obj + } + enumValue := otg.StateTrafficFlowTransmit_State_Enum(intValue) + obj.obj.State = &enumValue + + return obj +} + +func (obj *stateTrafficFlowTransmit) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // State is required + if obj.obj.State == nil { + vObj.validationErrors = append(vObj.validationErrors, "State is required field on interface StateTrafficFlowTransmit") + } +} + +func (obj *stateTrafficFlowTransmit) setDefault() { + +} diff --git a/gosnappi/states_request.go b/gosnappi/states_request.go new file mode 100644 index 00000000..df7a342e --- /dev/null +++ b/gosnappi/states_request.go @@ -0,0 +1,788 @@ +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" +) + +// ***** StatesRequest ***** +type statesRequest struct { + validation + obj *otg.StatesRequest + marshaller marshalStatesRequest + unMarshaller unMarshalStatesRequest + ipv4NeighborsHolder Neighborsv4StatesRequest + ipv6NeighborsHolder Neighborsv6StatesRequest + bgpPrefixesHolder BgpPrefixStateRequest + isisLspsHolder IsisLspsStateRequest + lldpNeighborsHolder LldpNeighborsStateRequest + rsvpLspsHolder RsvpLspsStateRequest + dhcpv4InterfacesHolder Dhcpv4InterfaceStateRequest + dhcpv4LeasesHolder Dhcpv4LeaseStateRequest +} + +func NewStatesRequest() StatesRequest { + obj := statesRequest{obj: &otg.StatesRequest{}} + obj.setDefault() + return &obj +} + +func (obj *statesRequest) msg() *otg.StatesRequest { + return obj.obj +} + +func (obj *statesRequest) setMsg(msg *otg.StatesRequest) StatesRequest { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstatesRequest struct { + obj *statesRequest +} + +type marshalStatesRequest interface { + // ToProto marshals StatesRequest to protobuf object *otg.StatesRequest + ToProto() (*otg.StatesRequest, error) + // ToPbText marshals StatesRequest to protobuf text + ToPbText() (string, error) + // ToYaml marshals StatesRequest to YAML text + ToYaml() (string, error) + // ToJson marshals StatesRequest to JSON text + ToJson() (string, error) +} + +type unMarshalstatesRequest struct { + obj *statesRequest +} + +type unMarshalStatesRequest interface { + // FromProto unmarshals StatesRequest from protobuf object *otg.StatesRequest + FromProto(msg *otg.StatesRequest) (StatesRequest, error) + // FromPbText unmarshals StatesRequest from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StatesRequest from YAML text + FromYaml(value string) error + // FromJson unmarshals StatesRequest from JSON text + FromJson(value string) error +} + +func (obj *statesRequest) Marshal() marshalStatesRequest { + if obj.marshaller == nil { + obj.marshaller = &marshalstatesRequest{obj: obj} + } + return obj.marshaller +} + +func (obj *statesRequest) Unmarshal() unMarshalStatesRequest { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstatesRequest{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstatesRequest) ToProto() (*otg.StatesRequest, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstatesRequest) FromProto(msg *otg.StatesRequest) (StatesRequest, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstatesRequest) 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 *unMarshalstatesRequest) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalstatesRequest) 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 *unMarshalstatesRequest) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalstatesRequest) 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 *unMarshalstatesRequest) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *statesRequest) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *statesRequest) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *statesRequest) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *statesRequest) Clone() (StatesRequest, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStatesRequest() + 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 +} + +func (obj *statesRequest) setNil() { + obj.ipv4NeighborsHolder = nil + obj.ipv6NeighborsHolder = nil + obj.bgpPrefixesHolder = nil + obj.isisLspsHolder = nil + obj.lldpNeighborsHolder = nil + obj.rsvpLspsHolder = nil + obj.dhcpv4InterfacesHolder = nil + obj.dhcpv4LeasesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// StatesRequest is request to traffic generator for states of choice +type StatesRequest interface { + Validation + // msg marshals StatesRequest to protobuf object *otg.StatesRequest + // and doesn't set defaults + msg() *otg.StatesRequest + // setMsg unmarshals StatesRequest from protobuf object *otg.StatesRequest + // and doesn't set defaults + setMsg(*otg.StatesRequest) StatesRequest + // provides marshal interface + Marshal() marshalStatesRequest + // provides unmarshal interface + Unmarshal() unMarshalStatesRequest + // validate validates StatesRequest + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StatesRequest, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns StatesRequestChoiceEnum, set in StatesRequest + Choice() StatesRequestChoiceEnum + // setChoice assigns StatesRequestChoiceEnum provided by user to StatesRequest + setChoice(value StatesRequestChoiceEnum) StatesRequest + // HasChoice checks if Choice has been set in StatesRequest + HasChoice() bool + // Ipv4Neighbors returns Neighborsv4StatesRequest, set in StatesRequest. + // Neighborsv4StatesRequest is the request to retrieve IPv4 Neighbor state (ARP cache entries) of a network interface(s). + Ipv4Neighbors() Neighborsv4StatesRequest + // SetIpv4Neighbors assigns Neighborsv4StatesRequest provided by user to StatesRequest. + // Neighborsv4StatesRequest is the request to retrieve IPv4 Neighbor state (ARP cache entries) of a network interface(s). + SetIpv4Neighbors(value Neighborsv4StatesRequest) StatesRequest + // HasIpv4Neighbors checks if Ipv4Neighbors has been set in StatesRequest + HasIpv4Neighbors() bool + // Ipv6Neighbors returns Neighborsv6StatesRequest, set in StatesRequest. + // Neighborsv6StatesRequest is the request to retrieve IPv6 Neighbor state (NDISC cache entries) of a network interface(s). + Ipv6Neighbors() Neighborsv6StatesRequest + // SetIpv6Neighbors assigns Neighborsv6StatesRequest provided by user to StatesRequest. + // Neighborsv6StatesRequest is the request to retrieve IPv6 Neighbor state (NDISC cache entries) of a network interface(s). + SetIpv6Neighbors(value Neighborsv6StatesRequest) StatesRequest + // HasIpv6Neighbors checks if Ipv6Neighbors has been set in StatesRequest + HasIpv6Neighbors() bool + // BgpPrefixes returns BgpPrefixStateRequest, set in StatesRequest. + // BgpPrefixStateRequest is the request to retrieve BGP peer prefix information. + BgpPrefixes() BgpPrefixStateRequest + // SetBgpPrefixes assigns BgpPrefixStateRequest provided by user to StatesRequest. + // BgpPrefixStateRequest is the request to retrieve BGP peer prefix information. + SetBgpPrefixes(value BgpPrefixStateRequest) StatesRequest + // HasBgpPrefixes checks if BgpPrefixes has been set in StatesRequest + HasBgpPrefixes() bool + // IsisLsps returns IsisLspsStateRequest, set in StatesRequest. + // IsisLspsStateRequest is the request to retrieve ISIS Link State PDU (LSP) information learned by the router. + IsisLsps() IsisLspsStateRequest + // SetIsisLsps assigns IsisLspsStateRequest provided by user to StatesRequest. + // IsisLspsStateRequest is the request to retrieve ISIS Link State PDU (LSP) information learned by the router. + SetIsisLsps(value IsisLspsStateRequest) StatesRequest + // HasIsisLsps checks if IsisLsps has been set in StatesRequest + HasIsisLsps() bool + // LldpNeighbors returns LldpNeighborsStateRequest, set in StatesRequest. + // LldpNeighborsStateRequest is the request to retrieve LLDP neighbor information for a given instance. + LldpNeighbors() LldpNeighborsStateRequest + // SetLldpNeighbors assigns LldpNeighborsStateRequest provided by user to StatesRequest. + // LldpNeighborsStateRequest is the request to retrieve LLDP neighbor information for a given instance. + SetLldpNeighbors(value LldpNeighborsStateRequest) StatesRequest + // HasLldpNeighbors checks if LldpNeighbors has been set in StatesRequest + HasLldpNeighbors() bool + // RsvpLsps returns RsvpLspsStateRequest, set in StatesRequest. + // RsvpLspsStateRequest is the request to retrieve RSVP Label Switched Path (LSP) information learned by the router. + RsvpLsps() RsvpLspsStateRequest + // SetRsvpLsps assigns RsvpLspsStateRequest provided by user to StatesRequest. + // RsvpLspsStateRequest is the request to retrieve RSVP Label Switched Path (LSP) information learned by the router. + SetRsvpLsps(value RsvpLspsStateRequest) StatesRequest + // HasRsvpLsps checks if RsvpLsps has been set in StatesRequest + HasRsvpLsps() bool + // Dhcpv4Interfaces returns Dhcpv4InterfaceStateRequest, set in StatesRequest. + // Dhcpv4InterfaceStateRequest is the request for assigned IPv4 address information associated with DHCP Client sessions. + Dhcpv4Interfaces() Dhcpv4InterfaceStateRequest + // SetDhcpv4Interfaces assigns Dhcpv4InterfaceStateRequest provided by user to StatesRequest. + // Dhcpv4InterfaceStateRequest is the request for assigned IPv4 address information associated with DHCP Client sessions. + SetDhcpv4Interfaces(value Dhcpv4InterfaceStateRequest) StatesRequest + // HasDhcpv4Interfaces checks if Dhcpv4Interfaces has been set in StatesRequest + HasDhcpv4Interfaces() bool + // Dhcpv4Leases returns Dhcpv4LeaseStateRequest, set in StatesRequest. + // Dhcpv4LeaseStateRequest is the request to retrieve DHCP Server host allocated status. + Dhcpv4Leases() Dhcpv4LeaseStateRequest + // SetDhcpv4Leases assigns Dhcpv4LeaseStateRequest provided by user to StatesRequest. + // Dhcpv4LeaseStateRequest is the request to retrieve DHCP Server host allocated status. + SetDhcpv4Leases(value Dhcpv4LeaseStateRequest) StatesRequest + // HasDhcpv4Leases checks if Dhcpv4Leases has been set in StatesRequest + HasDhcpv4Leases() bool + setNil() +} + +type StatesRequestChoiceEnum string + +// Enum of Choice on StatesRequest +var StatesRequestChoice = struct { + IPV4_NEIGHBORS StatesRequestChoiceEnum + IPV6_NEIGHBORS StatesRequestChoiceEnum + BGP_PREFIXES StatesRequestChoiceEnum + ISIS_LSPS StatesRequestChoiceEnum + LLDP_NEIGHBORS StatesRequestChoiceEnum + RSVP_LSPS StatesRequestChoiceEnum + DHCPV4_INTERFACES StatesRequestChoiceEnum + DHCPV4_LEASES StatesRequestChoiceEnum +}{ + IPV4_NEIGHBORS: StatesRequestChoiceEnum("ipv4_neighbors"), + IPV6_NEIGHBORS: StatesRequestChoiceEnum("ipv6_neighbors"), + BGP_PREFIXES: StatesRequestChoiceEnum("bgp_prefixes"), + ISIS_LSPS: StatesRequestChoiceEnum("isis_lsps"), + LLDP_NEIGHBORS: StatesRequestChoiceEnum("lldp_neighbors"), + RSVP_LSPS: StatesRequestChoiceEnum("rsvp_lsps"), + DHCPV4_INTERFACES: StatesRequestChoiceEnum("dhcpv4_interfaces"), + DHCPV4_LEASES: StatesRequestChoiceEnum("dhcpv4_leases"), +} + +func (obj *statesRequest) Choice() StatesRequestChoiceEnum { + return StatesRequestChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *statesRequest) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *statesRequest) setChoice(value StatesRequestChoiceEnum) StatesRequest { + intValue, ok := otg.StatesRequest_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StatesRequestChoiceEnum", string(value))) + return obj + } + enumValue := otg.StatesRequest_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Dhcpv4Leases = nil + obj.dhcpv4LeasesHolder = nil + obj.obj.Dhcpv4Interfaces = nil + obj.dhcpv4InterfacesHolder = nil + obj.obj.RsvpLsps = nil + obj.rsvpLspsHolder = nil + obj.obj.LldpNeighbors = nil + obj.lldpNeighborsHolder = nil + obj.obj.IsisLsps = nil + obj.isisLspsHolder = nil + obj.obj.BgpPrefixes = nil + obj.bgpPrefixesHolder = nil + obj.obj.Ipv6Neighbors = nil + obj.ipv6NeighborsHolder = nil + obj.obj.Ipv4Neighbors = nil + obj.ipv4NeighborsHolder = nil + + if value == StatesRequestChoice.IPV4_NEIGHBORS { + obj.obj.Ipv4Neighbors = NewNeighborsv4StatesRequest().msg() + } + + if value == StatesRequestChoice.IPV6_NEIGHBORS { + obj.obj.Ipv6Neighbors = NewNeighborsv6StatesRequest().msg() + } + + if value == StatesRequestChoice.BGP_PREFIXES { + obj.obj.BgpPrefixes = NewBgpPrefixStateRequest().msg() + } + + if value == StatesRequestChoice.ISIS_LSPS { + obj.obj.IsisLsps = NewIsisLspsStateRequest().msg() + } + + if value == StatesRequestChoice.LLDP_NEIGHBORS { + obj.obj.LldpNeighbors = NewLldpNeighborsStateRequest().msg() + } + + if value == StatesRequestChoice.RSVP_LSPS { + obj.obj.RsvpLsps = NewRsvpLspsStateRequest().msg() + } + + if value == StatesRequestChoice.DHCPV4_INTERFACES { + obj.obj.Dhcpv4Interfaces = NewDhcpv4InterfaceStateRequest().msg() + } + + if value == StatesRequestChoice.DHCPV4_LEASES { + obj.obj.Dhcpv4Leases = NewDhcpv4LeaseStateRequest().msg() + } + + return obj +} + +// description is TBD +// Ipv4Neighbors returns a Neighborsv4StatesRequest +func (obj *statesRequest) Ipv4Neighbors() Neighborsv4StatesRequest { + if obj.obj.Ipv4Neighbors == nil { + obj.setChoice(StatesRequestChoice.IPV4_NEIGHBORS) + } + if obj.ipv4NeighborsHolder == nil { + obj.ipv4NeighborsHolder = &neighborsv4StatesRequest{obj: obj.obj.Ipv4Neighbors} + } + return obj.ipv4NeighborsHolder +} + +// description is TBD +// Ipv4Neighbors returns a Neighborsv4StatesRequest +func (obj *statesRequest) HasIpv4Neighbors() bool { + return obj.obj.Ipv4Neighbors != nil +} + +// description is TBD +// SetIpv4Neighbors sets the Neighborsv4StatesRequest value in the StatesRequest object +func (obj *statesRequest) SetIpv4Neighbors(value Neighborsv4StatesRequest) StatesRequest { + obj.setChoice(StatesRequestChoice.IPV4_NEIGHBORS) + obj.ipv4NeighborsHolder = nil + obj.obj.Ipv4Neighbors = value.msg() + + return obj +} + +// description is TBD +// Ipv6Neighbors returns a Neighborsv6StatesRequest +func (obj *statesRequest) Ipv6Neighbors() Neighborsv6StatesRequest { + if obj.obj.Ipv6Neighbors == nil { + obj.setChoice(StatesRequestChoice.IPV6_NEIGHBORS) + } + if obj.ipv6NeighborsHolder == nil { + obj.ipv6NeighborsHolder = &neighborsv6StatesRequest{obj: obj.obj.Ipv6Neighbors} + } + return obj.ipv6NeighborsHolder +} + +// description is TBD +// Ipv6Neighbors returns a Neighborsv6StatesRequest +func (obj *statesRequest) HasIpv6Neighbors() bool { + return obj.obj.Ipv6Neighbors != nil +} + +// description is TBD +// SetIpv6Neighbors sets the Neighborsv6StatesRequest value in the StatesRequest object +func (obj *statesRequest) SetIpv6Neighbors(value Neighborsv6StatesRequest) StatesRequest { + obj.setChoice(StatesRequestChoice.IPV6_NEIGHBORS) + obj.ipv6NeighborsHolder = nil + obj.obj.Ipv6Neighbors = value.msg() + + return obj +} + +// description is TBD +// BgpPrefixes returns a BgpPrefixStateRequest +func (obj *statesRequest) BgpPrefixes() BgpPrefixStateRequest { + if obj.obj.BgpPrefixes == nil { + obj.setChoice(StatesRequestChoice.BGP_PREFIXES) + } + if obj.bgpPrefixesHolder == nil { + obj.bgpPrefixesHolder = &bgpPrefixStateRequest{obj: obj.obj.BgpPrefixes} + } + return obj.bgpPrefixesHolder +} + +// description is TBD +// BgpPrefixes returns a BgpPrefixStateRequest +func (obj *statesRequest) HasBgpPrefixes() bool { + return obj.obj.BgpPrefixes != nil +} + +// description is TBD +// SetBgpPrefixes sets the BgpPrefixStateRequest value in the StatesRequest object +func (obj *statesRequest) SetBgpPrefixes(value BgpPrefixStateRequest) StatesRequest { + obj.setChoice(StatesRequestChoice.BGP_PREFIXES) + obj.bgpPrefixesHolder = nil + obj.obj.BgpPrefixes = value.msg() + + return obj +} + +// description is TBD +// IsisLsps returns a IsisLspsStateRequest +func (obj *statesRequest) IsisLsps() IsisLspsStateRequest { + if obj.obj.IsisLsps == nil { + obj.setChoice(StatesRequestChoice.ISIS_LSPS) + } + if obj.isisLspsHolder == nil { + obj.isisLspsHolder = &isisLspsStateRequest{obj: obj.obj.IsisLsps} + } + return obj.isisLspsHolder +} + +// description is TBD +// IsisLsps returns a IsisLspsStateRequest +func (obj *statesRequest) HasIsisLsps() bool { + return obj.obj.IsisLsps != nil +} + +// description is TBD +// SetIsisLsps sets the IsisLspsStateRequest value in the StatesRequest object +func (obj *statesRequest) SetIsisLsps(value IsisLspsStateRequest) StatesRequest { + obj.setChoice(StatesRequestChoice.ISIS_LSPS) + obj.isisLspsHolder = nil + obj.obj.IsisLsps = value.msg() + + return obj +} + +// description is TBD +// LldpNeighbors returns a LldpNeighborsStateRequest +func (obj *statesRequest) LldpNeighbors() LldpNeighborsStateRequest { + if obj.obj.LldpNeighbors == nil { + obj.setChoice(StatesRequestChoice.LLDP_NEIGHBORS) + } + if obj.lldpNeighborsHolder == nil { + obj.lldpNeighborsHolder = &lldpNeighborsStateRequest{obj: obj.obj.LldpNeighbors} + } + return obj.lldpNeighborsHolder +} + +// description is TBD +// LldpNeighbors returns a LldpNeighborsStateRequest +func (obj *statesRequest) HasLldpNeighbors() bool { + return obj.obj.LldpNeighbors != nil +} + +// description is TBD +// SetLldpNeighbors sets the LldpNeighborsStateRequest value in the StatesRequest object +func (obj *statesRequest) SetLldpNeighbors(value LldpNeighborsStateRequest) StatesRequest { + obj.setChoice(StatesRequestChoice.LLDP_NEIGHBORS) + obj.lldpNeighborsHolder = nil + obj.obj.LldpNeighbors = value.msg() + + return obj +} + +// description is TBD +// RsvpLsps returns a RsvpLspsStateRequest +func (obj *statesRequest) RsvpLsps() RsvpLspsStateRequest { + if obj.obj.RsvpLsps == nil { + obj.setChoice(StatesRequestChoice.RSVP_LSPS) + } + if obj.rsvpLspsHolder == nil { + obj.rsvpLspsHolder = &rsvpLspsStateRequest{obj: obj.obj.RsvpLsps} + } + return obj.rsvpLspsHolder +} + +// description is TBD +// RsvpLsps returns a RsvpLspsStateRequest +func (obj *statesRequest) HasRsvpLsps() bool { + return obj.obj.RsvpLsps != nil +} + +// description is TBD +// SetRsvpLsps sets the RsvpLspsStateRequest value in the StatesRequest object +func (obj *statesRequest) SetRsvpLsps(value RsvpLspsStateRequest) StatesRequest { + obj.setChoice(StatesRequestChoice.RSVP_LSPS) + obj.rsvpLspsHolder = nil + obj.obj.RsvpLsps = value.msg() + + return obj +} + +// description is TBD +// Dhcpv4Interfaces returns a Dhcpv4InterfaceStateRequest +func (obj *statesRequest) Dhcpv4Interfaces() Dhcpv4InterfaceStateRequest { + if obj.obj.Dhcpv4Interfaces == nil { + obj.setChoice(StatesRequestChoice.DHCPV4_INTERFACES) + } + if obj.dhcpv4InterfacesHolder == nil { + obj.dhcpv4InterfacesHolder = &dhcpv4InterfaceStateRequest{obj: obj.obj.Dhcpv4Interfaces} + } + return obj.dhcpv4InterfacesHolder +} + +// description is TBD +// Dhcpv4Interfaces returns a Dhcpv4InterfaceStateRequest +func (obj *statesRequest) HasDhcpv4Interfaces() bool { + return obj.obj.Dhcpv4Interfaces != nil +} + +// description is TBD +// SetDhcpv4Interfaces sets the Dhcpv4InterfaceStateRequest value in the StatesRequest object +func (obj *statesRequest) SetDhcpv4Interfaces(value Dhcpv4InterfaceStateRequest) StatesRequest { + obj.setChoice(StatesRequestChoice.DHCPV4_INTERFACES) + obj.dhcpv4InterfacesHolder = nil + obj.obj.Dhcpv4Interfaces = value.msg() + + return obj +} + +// description is TBD +// Dhcpv4Leases returns a Dhcpv4LeaseStateRequest +func (obj *statesRequest) Dhcpv4Leases() Dhcpv4LeaseStateRequest { + if obj.obj.Dhcpv4Leases == nil { + obj.setChoice(StatesRequestChoice.DHCPV4_LEASES) + } + if obj.dhcpv4LeasesHolder == nil { + obj.dhcpv4LeasesHolder = &dhcpv4LeaseStateRequest{obj: obj.obj.Dhcpv4Leases} + } + return obj.dhcpv4LeasesHolder +} + +// description is TBD +// Dhcpv4Leases returns a Dhcpv4LeaseStateRequest +func (obj *statesRequest) HasDhcpv4Leases() bool { + return obj.obj.Dhcpv4Leases != nil +} + +// description is TBD +// SetDhcpv4Leases sets the Dhcpv4LeaseStateRequest value in the StatesRequest object +func (obj *statesRequest) SetDhcpv4Leases(value Dhcpv4LeaseStateRequest) StatesRequest { + obj.setChoice(StatesRequestChoice.DHCPV4_LEASES) + obj.dhcpv4LeasesHolder = nil + obj.obj.Dhcpv4Leases = value.msg() + + return obj +} + +func (obj *statesRequest) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Ipv4Neighbors != nil { + + obj.Ipv4Neighbors().validateObj(vObj, set_default) + } + + if obj.obj.Ipv6Neighbors != nil { + + obj.Ipv6Neighbors().validateObj(vObj, set_default) + } + + if obj.obj.BgpPrefixes != nil { + + obj.BgpPrefixes().validateObj(vObj, set_default) + } + + if obj.obj.IsisLsps != nil { + + obj.IsisLsps().validateObj(vObj, set_default) + } + + if obj.obj.LldpNeighbors != nil { + + obj.LldpNeighbors().validateObj(vObj, set_default) + } + + if obj.obj.RsvpLsps != nil { + + obj.RsvpLsps().validateObj(vObj, set_default) + } + + if obj.obj.Dhcpv4Interfaces != nil { + + obj.Dhcpv4Interfaces().validateObj(vObj, set_default) + } + + if obj.obj.Dhcpv4Leases != nil { + + obj.Dhcpv4Leases().validateObj(vObj, set_default) + } + +} + +func (obj *statesRequest) setDefault() { + var choices_set int = 0 + var choice StatesRequestChoiceEnum + + if obj.obj.Ipv4Neighbors != nil { + choices_set += 1 + choice = StatesRequestChoice.IPV4_NEIGHBORS + } + + if obj.obj.Ipv6Neighbors != nil { + choices_set += 1 + choice = StatesRequestChoice.IPV6_NEIGHBORS + } + + if obj.obj.BgpPrefixes != nil { + choices_set += 1 + choice = StatesRequestChoice.BGP_PREFIXES + } + + if obj.obj.IsisLsps != nil { + choices_set += 1 + choice = StatesRequestChoice.ISIS_LSPS + } + + if obj.obj.LldpNeighbors != nil { + choices_set += 1 + choice = StatesRequestChoice.LLDP_NEIGHBORS + } + + if obj.obj.RsvpLsps != nil { + choices_set += 1 + choice = StatesRequestChoice.RSVP_LSPS + } + + if obj.obj.Dhcpv4Interfaces != nil { + choices_set += 1 + choice = StatesRequestChoice.DHCPV4_INTERFACES + } + + if obj.obj.Dhcpv4Leases != nil { + choices_set += 1 + choice = StatesRequestChoice.DHCPV4_LEASES + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(StatesRequestChoice.IPV4_NEIGHBORS) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StatesRequest") + } + } else { + intVal := otg.StatesRequest_Choice_Enum_value[string(choice)] + enumValue := otg.StatesRequest_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/states_response.go b/gosnappi/states_response.go new file mode 100644 index 00000000..e14c346d --- /dev/null +++ b/gosnappi/states_response.go @@ -0,0 +1,1284 @@ +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" +) + +// ***** StatesResponse ***** +type statesResponse struct { + validation + obj *otg.StatesResponse + marshaller marshalStatesResponse + unMarshaller unMarshalStatesResponse + ipv4NeighborsHolder StatesResponseNeighborsv4StateIter + ipv6NeighborsHolder StatesResponseNeighborsv6StateIter + bgpPrefixesHolder StatesResponseBgpPrefixesStateIter + isisLspsHolder StatesResponseIsisLspsStateIter + lldpNeighborsHolder StatesResponseLldpNeighborsStateIter + rsvpLspsHolder StatesResponseRsvpLspsStateIter + dhcpv4InterfacesHolder StatesResponseDhcpv4InterfaceStateIter + dhcpv4LeasesHolder StatesResponseDhcpv4LeasesStateIter +} + +func NewStatesResponse() StatesResponse { + obj := statesResponse{obj: &otg.StatesResponse{}} + obj.setDefault() + return &obj +} + +func (obj *statesResponse) msg() *otg.StatesResponse { + return obj.obj +} + +func (obj *statesResponse) setMsg(msg *otg.StatesResponse) StatesResponse { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalstatesResponse struct { + obj *statesResponse +} + +type marshalStatesResponse interface { + // ToProto marshals StatesResponse to protobuf object *otg.StatesResponse + ToProto() (*otg.StatesResponse, error) + // ToPbText marshals StatesResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals StatesResponse to YAML text + ToYaml() (string, error) + // ToJson marshals StatesResponse to JSON text + ToJson() (string, error) +} + +type unMarshalstatesResponse struct { + obj *statesResponse +} + +type unMarshalStatesResponse interface { + // FromProto unmarshals StatesResponse from protobuf object *otg.StatesResponse + FromProto(msg *otg.StatesResponse) (StatesResponse, error) + // FromPbText unmarshals StatesResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals StatesResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals StatesResponse from JSON text + FromJson(value string) error +} + +func (obj *statesResponse) Marshal() marshalStatesResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalstatesResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *statesResponse) Unmarshal() unMarshalStatesResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalstatesResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalstatesResponse) ToProto() (*otg.StatesResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalstatesResponse) FromProto(msg *otg.StatesResponse) (StatesResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalstatesResponse) 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 *unMarshalstatesResponse) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalstatesResponse) 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 *unMarshalstatesResponse) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalstatesResponse) 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 *unMarshalstatesResponse) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *statesResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *statesResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *statesResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *statesResponse) Clone() (StatesResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewStatesResponse() + 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 +} + +func (obj *statesResponse) setNil() { + obj.ipv4NeighborsHolder = nil + obj.ipv6NeighborsHolder = nil + obj.bgpPrefixesHolder = nil + obj.isisLspsHolder = nil + obj.lldpNeighborsHolder = nil + obj.rsvpLspsHolder = nil + obj.dhcpv4InterfacesHolder = nil + obj.dhcpv4LeasesHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// StatesResponse is response containing chosen traffic generator states +type StatesResponse interface { + Validation + // msg marshals StatesResponse to protobuf object *otg.StatesResponse + // and doesn't set defaults + msg() *otg.StatesResponse + // setMsg unmarshals StatesResponse from protobuf object *otg.StatesResponse + // and doesn't set defaults + setMsg(*otg.StatesResponse) StatesResponse + // provides marshal interface + Marshal() marshalStatesResponse + // provides unmarshal interface + Unmarshal() unMarshalStatesResponse + // validate validates StatesResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (StatesResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns StatesResponseChoiceEnum, set in StatesResponse + Choice() StatesResponseChoiceEnum + // setChoice assigns StatesResponseChoiceEnum provided by user to StatesResponse + setChoice(value StatesResponseChoiceEnum) StatesResponse + // HasChoice checks if Choice has been set in StatesResponse + HasChoice() bool + // Ipv4Neighbors returns StatesResponseNeighborsv4StateIterIter, set in StatesResponse + Ipv4Neighbors() StatesResponseNeighborsv4StateIter + // Ipv6Neighbors returns StatesResponseNeighborsv6StateIterIter, set in StatesResponse + Ipv6Neighbors() StatesResponseNeighborsv6StateIter + // BgpPrefixes returns StatesResponseBgpPrefixesStateIterIter, set in StatesResponse + BgpPrefixes() StatesResponseBgpPrefixesStateIter + // IsisLsps returns StatesResponseIsisLspsStateIterIter, set in StatesResponse + IsisLsps() StatesResponseIsisLspsStateIter + // LldpNeighbors returns StatesResponseLldpNeighborsStateIterIter, set in StatesResponse + LldpNeighbors() StatesResponseLldpNeighborsStateIter + // RsvpLsps returns StatesResponseRsvpLspsStateIterIter, set in StatesResponse + RsvpLsps() StatesResponseRsvpLspsStateIter + // Dhcpv4Interfaces returns StatesResponseDhcpv4InterfaceStateIterIter, set in StatesResponse + Dhcpv4Interfaces() StatesResponseDhcpv4InterfaceStateIter + // Dhcpv4Leases returns StatesResponseDhcpv4LeasesStateIterIter, set in StatesResponse + Dhcpv4Leases() StatesResponseDhcpv4LeasesStateIter + setNil() +} + +type StatesResponseChoiceEnum string + +// Enum of Choice on StatesResponse +var StatesResponseChoice = struct { + IPV4_NEIGHBORS StatesResponseChoiceEnum + IPV6_NEIGHBORS StatesResponseChoiceEnum + BGP_PREFIXES StatesResponseChoiceEnum + ISIS_LSPS StatesResponseChoiceEnum + LLDP_NEIGHBORS StatesResponseChoiceEnum + RSVP_LSPS StatesResponseChoiceEnum + DHCPV4_INTERFACES StatesResponseChoiceEnum + DHCPV4_LEASES StatesResponseChoiceEnum +}{ + IPV4_NEIGHBORS: StatesResponseChoiceEnum("ipv4_neighbors"), + IPV6_NEIGHBORS: StatesResponseChoiceEnum("ipv6_neighbors"), + BGP_PREFIXES: StatesResponseChoiceEnum("bgp_prefixes"), + ISIS_LSPS: StatesResponseChoiceEnum("isis_lsps"), + LLDP_NEIGHBORS: StatesResponseChoiceEnum("lldp_neighbors"), + RSVP_LSPS: StatesResponseChoiceEnum("rsvp_lsps"), + DHCPV4_INTERFACES: StatesResponseChoiceEnum("dhcpv4_interfaces"), + DHCPV4_LEASES: StatesResponseChoiceEnum("dhcpv4_leases"), +} + +func (obj *statesResponse) Choice() StatesResponseChoiceEnum { + return StatesResponseChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// description is TBD +// Choice returns a string +func (obj *statesResponse) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *statesResponse) setChoice(value StatesResponseChoiceEnum) StatesResponse { + intValue, ok := otg.StatesResponse_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on StatesResponseChoiceEnum", string(value))) + return obj + } + enumValue := otg.StatesResponse_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Dhcpv4Leases = nil + obj.dhcpv4LeasesHolder = nil + obj.obj.Dhcpv4Interfaces = nil + obj.dhcpv4InterfacesHolder = nil + obj.obj.RsvpLsps = nil + obj.rsvpLspsHolder = nil + obj.obj.LldpNeighbors = nil + obj.lldpNeighborsHolder = nil + obj.obj.IsisLsps = nil + obj.isisLspsHolder = nil + obj.obj.BgpPrefixes = nil + obj.bgpPrefixesHolder = nil + obj.obj.Ipv6Neighbors = nil + obj.ipv6NeighborsHolder = nil + obj.obj.Ipv4Neighbors = nil + obj.ipv4NeighborsHolder = nil + + if value == StatesResponseChoice.IPV4_NEIGHBORS { + obj.obj.Ipv4Neighbors = []*otg.Neighborsv4State{} + } + + if value == StatesResponseChoice.IPV6_NEIGHBORS { + obj.obj.Ipv6Neighbors = []*otg.Neighborsv6State{} + } + + if value == StatesResponseChoice.BGP_PREFIXES { + obj.obj.BgpPrefixes = []*otg.BgpPrefixesState{} + } + + if value == StatesResponseChoice.ISIS_LSPS { + obj.obj.IsisLsps = []*otg.IsisLspsState{} + } + + if value == StatesResponseChoice.LLDP_NEIGHBORS { + obj.obj.LldpNeighbors = []*otg.LldpNeighborsState{} + } + + if value == StatesResponseChoice.RSVP_LSPS { + obj.obj.RsvpLsps = []*otg.RsvpLspsState{} + } + + if value == StatesResponseChoice.DHCPV4_INTERFACES { + obj.obj.Dhcpv4Interfaces = []*otg.Dhcpv4InterfaceState{} + } + + if value == StatesResponseChoice.DHCPV4_LEASES { + obj.obj.Dhcpv4Leases = []*otg.Dhcpv4LeasesState{} + } + + return obj +} + +// description is TBD +// Ipv4Neighbors returns a []Neighborsv4State +func (obj *statesResponse) Ipv4Neighbors() StatesResponseNeighborsv4StateIter { + if len(obj.obj.Ipv4Neighbors) == 0 { + obj.setChoice(StatesResponseChoice.IPV4_NEIGHBORS) + } + if obj.ipv4NeighborsHolder == nil { + obj.ipv4NeighborsHolder = newStatesResponseNeighborsv4StateIter(&obj.obj.Ipv4Neighbors).setMsg(obj) + } + return obj.ipv4NeighborsHolder +} + +type statesResponseNeighborsv4StateIter struct { + obj *statesResponse + neighborsv4StateSlice []Neighborsv4State + fieldPtr *[]*otg.Neighborsv4State +} + +func newStatesResponseNeighborsv4StateIter(ptr *[]*otg.Neighborsv4State) StatesResponseNeighborsv4StateIter { + return &statesResponseNeighborsv4StateIter{fieldPtr: ptr} +} + +type StatesResponseNeighborsv4StateIter interface { + setMsg(*statesResponse) StatesResponseNeighborsv4StateIter + Items() []Neighborsv4State + Add() Neighborsv4State + Append(items ...Neighborsv4State) StatesResponseNeighborsv4StateIter + Set(index int, newObj Neighborsv4State) StatesResponseNeighborsv4StateIter + Clear() StatesResponseNeighborsv4StateIter + clearHolderSlice() StatesResponseNeighborsv4StateIter + appendHolderSlice(item Neighborsv4State) StatesResponseNeighborsv4StateIter +} + +func (obj *statesResponseNeighborsv4StateIter) setMsg(msg *statesResponse) StatesResponseNeighborsv4StateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&neighborsv4State{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *statesResponseNeighborsv4StateIter) Items() []Neighborsv4State { + return obj.neighborsv4StateSlice +} + +func (obj *statesResponseNeighborsv4StateIter) Add() Neighborsv4State { + newObj := &otg.Neighborsv4State{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &neighborsv4State{obj: newObj} + newLibObj.setDefault() + obj.neighborsv4StateSlice = append(obj.neighborsv4StateSlice, newLibObj) + return newLibObj +} + +func (obj *statesResponseNeighborsv4StateIter) Append(items ...Neighborsv4State) StatesResponseNeighborsv4StateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.neighborsv4StateSlice = append(obj.neighborsv4StateSlice, item) + } + return obj +} + +func (obj *statesResponseNeighborsv4StateIter) Set(index int, newObj Neighborsv4State) StatesResponseNeighborsv4StateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.neighborsv4StateSlice[index] = newObj + return obj +} +func (obj *statesResponseNeighborsv4StateIter) Clear() StatesResponseNeighborsv4StateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Neighborsv4State{} + obj.neighborsv4StateSlice = []Neighborsv4State{} + } + return obj +} +func (obj *statesResponseNeighborsv4StateIter) clearHolderSlice() StatesResponseNeighborsv4StateIter { + if len(obj.neighborsv4StateSlice) > 0 { + obj.neighborsv4StateSlice = []Neighborsv4State{} + } + return obj +} +func (obj *statesResponseNeighborsv4StateIter) appendHolderSlice(item Neighborsv4State) StatesResponseNeighborsv4StateIter { + obj.neighborsv4StateSlice = append(obj.neighborsv4StateSlice, item) + return obj +} + +// description is TBD +// Ipv6Neighbors returns a []Neighborsv6State +func (obj *statesResponse) Ipv6Neighbors() StatesResponseNeighborsv6StateIter { + if len(obj.obj.Ipv6Neighbors) == 0 { + obj.setChoice(StatesResponseChoice.IPV6_NEIGHBORS) + } + if obj.ipv6NeighborsHolder == nil { + obj.ipv6NeighborsHolder = newStatesResponseNeighborsv6StateIter(&obj.obj.Ipv6Neighbors).setMsg(obj) + } + return obj.ipv6NeighborsHolder +} + +type statesResponseNeighborsv6StateIter struct { + obj *statesResponse + neighborsv6StateSlice []Neighborsv6State + fieldPtr *[]*otg.Neighborsv6State +} + +func newStatesResponseNeighborsv6StateIter(ptr *[]*otg.Neighborsv6State) StatesResponseNeighborsv6StateIter { + return &statesResponseNeighborsv6StateIter{fieldPtr: ptr} +} + +type StatesResponseNeighborsv6StateIter interface { + setMsg(*statesResponse) StatesResponseNeighborsv6StateIter + Items() []Neighborsv6State + Add() Neighborsv6State + Append(items ...Neighborsv6State) StatesResponseNeighborsv6StateIter + Set(index int, newObj Neighborsv6State) StatesResponseNeighborsv6StateIter + Clear() StatesResponseNeighborsv6StateIter + clearHolderSlice() StatesResponseNeighborsv6StateIter + appendHolderSlice(item Neighborsv6State) StatesResponseNeighborsv6StateIter +} + +func (obj *statesResponseNeighborsv6StateIter) setMsg(msg *statesResponse) StatesResponseNeighborsv6StateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&neighborsv6State{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *statesResponseNeighborsv6StateIter) Items() []Neighborsv6State { + return obj.neighborsv6StateSlice +} + +func (obj *statesResponseNeighborsv6StateIter) Add() Neighborsv6State { + newObj := &otg.Neighborsv6State{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &neighborsv6State{obj: newObj} + newLibObj.setDefault() + obj.neighborsv6StateSlice = append(obj.neighborsv6StateSlice, newLibObj) + return newLibObj +} + +func (obj *statesResponseNeighborsv6StateIter) Append(items ...Neighborsv6State) StatesResponseNeighborsv6StateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.neighborsv6StateSlice = append(obj.neighborsv6StateSlice, item) + } + return obj +} + +func (obj *statesResponseNeighborsv6StateIter) Set(index int, newObj Neighborsv6State) StatesResponseNeighborsv6StateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.neighborsv6StateSlice[index] = newObj + return obj +} +func (obj *statesResponseNeighborsv6StateIter) Clear() StatesResponseNeighborsv6StateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Neighborsv6State{} + obj.neighborsv6StateSlice = []Neighborsv6State{} + } + return obj +} +func (obj *statesResponseNeighborsv6StateIter) clearHolderSlice() StatesResponseNeighborsv6StateIter { + if len(obj.neighborsv6StateSlice) > 0 { + obj.neighborsv6StateSlice = []Neighborsv6State{} + } + return obj +} +func (obj *statesResponseNeighborsv6StateIter) appendHolderSlice(item Neighborsv6State) StatesResponseNeighborsv6StateIter { + obj.neighborsv6StateSlice = append(obj.neighborsv6StateSlice, item) + return obj +} + +// description is TBD +// BgpPrefixes returns a []BgpPrefixesState +func (obj *statesResponse) BgpPrefixes() StatesResponseBgpPrefixesStateIter { + if len(obj.obj.BgpPrefixes) == 0 { + obj.setChoice(StatesResponseChoice.BGP_PREFIXES) + } + if obj.bgpPrefixesHolder == nil { + obj.bgpPrefixesHolder = newStatesResponseBgpPrefixesStateIter(&obj.obj.BgpPrefixes).setMsg(obj) + } + return obj.bgpPrefixesHolder +} + +type statesResponseBgpPrefixesStateIter struct { + obj *statesResponse + bgpPrefixesStateSlice []BgpPrefixesState + fieldPtr *[]*otg.BgpPrefixesState +} + +func newStatesResponseBgpPrefixesStateIter(ptr *[]*otg.BgpPrefixesState) StatesResponseBgpPrefixesStateIter { + return &statesResponseBgpPrefixesStateIter{fieldPtr: ptr} +} + +type StatesResponseBgpPrefixesStateIter interface { + setMsg(*statesResponse) StatesResponseBgpPrefixesStateIter + Items() []BgpPrefixesState + Add() BgpPrefixesState + Append(items ...BgpPrefixesState) StatesResponseBgpPrefixesStateIter + Set(index int, newObj BgpPrefixesState) StatesResponseBgpPrefixesStateIter + Clear() StatesResponseBgpPrefixesStateIter + clearHolderSlice() StatesResponseBgpPrefixesStateIter + appendHolderSlice(item BgpPrefixesState) StatesResponseBgpPrefixesStateIter +} + +func (obj *statesResponseBgpPrefixesStateIter) setMsg(msg *statesResponse) StatesResponseBgpPrefixesStateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&bgpPrefixesState{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *statesResponseBgpPrefixesStateIter) Items() []BgpPrefixesState { + return obj.bgpPrefixesStateSlice +} + +func (obj *statesResponseBgpPrefixesStateIter) Add() BgpPrefixesState { + newObj := &otg.BgpPrefixesState{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &bgpPrefixesState{obj: newObj} + newLibObj.setDefault() + obj.bgpPrefixesStateSlice = append(obj.bgpPrefixesStateSlice, newLibObj) + return newLibObj +} + +func (obj *statesResponseBgpPrefixesStateIter) Append(items ...BgpPrefixesState) StatesResponseBgpPrefixesStateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.bgpPrefixesStateSlice = append(obj.bgpPrefixesStateSlice, item) + } + return obj +} + +func (obj *statesResponseBgpPrefixesStateIter) Set(index int, newObj BgpPrefixesState) StatesResponseBgpPrefixesStateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.bgpPrefixesStateSlice[index] = newObj + return obj +} +func (obj *statesResponseBgpPrefixesStateIter) Clear() StatesResponseBgpPrefixesStateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.BgpPrefixesState{} + obj.bgpPrefixesStateSlice = []BgpPrefixesState{} + } + return obj +} +func (obj *statesResponseBgpPrefixesStateIter) clearHolderSlice() StatesResponseBgpPrefixesStateIter { + if len(obj.bgpPrefixesStateSlice) > 0 { + obj.bgpPrefixesStateSlice = []BgpPrefixesState{} + } + return obj +} +func (obj *statesResponseBgpPrefixesStateIter) appendHolderSlice(item BgpPrefixesState) StatesResponseBgpPrefixesStateIter { + obj.bgpPrefixesStateSlice = append(obj.bgpPrefixesStateSlice, item) + return obj +} + +// description is TBD +// IsisLsps returns a []IsisLspsState +func (obj *statesResponse) IsisLsps() StatesResponseIsisLspsStateIter { + if len(obj.obj.IsisLsps) == 0 { + obj.setChoice(StatesResponseChoice.ISIS_LSPS) + } + if obj.isisLspsHolder == nil { + obj.isisLspsHolder = newStatesResponseIsisLspsStateIter(&obj.obj.IsisLsps).setMsg(obj) + } + return obj.isisLspsHolder +} + +type statesResponseIsisLspsStateIter struct { + obj *statesResponse + isisLspsStateSlice []IsisLspsState + fieldPtr *[]*otg.IsisLspsState +} + +func newStatesResponseIsisLspsStateIter(ptr *[]*otg.IsisLspsState) StatesResponseIsisLspsStateIter { + return &statesResponseIsisLspsStateIter{fieldPtr: ptr} +} + +type StatesResponseIsisLspsStateIter interface { + setMsg(*statesResponse) StatesResponseIsisLspsStateIter + Items() []IsisLspsState + Add() IsisLspsState + Append(items ...IsisLspsState) StatesResponseIsisLspsStateIter + Set(index int, newObj IsisLspsState) StatesResponseIsisLspsStateIter + Clear() StatesResponseIsisLspsStateIter + clearHolderSlice() StatesResponseIsisLspsStateIter + appendHolderSlice(item IsisLspsState) StatesResponseIsisLspsStateIter +} + +func (obj *statesResponseIsisLspsStateIter) setMsg(msg *statesResponse) StatesResponseIsisLspsStateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&isisLspsState{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *statesResponseIsisLspsStateIter) Items() []IsisLspsState { + return obj.isisLspsStateSlice +} + +func (obj *statesResponseIsisLspsStateIter) Add() IsisLspsState { + newObj := &otg.IsisLspsState{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &isisLspsState{obj: newObj} + newLibObj.setDefault() + obj.isisLspsStateSlice = append(obj.isisLspsStateSlice, newLibObj) + return newLibObj +} + +func (obj *statesResponseIsisLspsStateIter) Append(items ...IsisLspsState) StatesResponseIsisLspsStateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.isisLspsStateSlice = append(obj.isisLspsStateSlice, item) + } + return obj +} + +func (obj *statesResponseIsisLspsStateIter) Set(index int, newObj IsisLspsState) StatesResponseIsisLspsStateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.isisLspsStateSlice[index] = newObj + return obj +} +func (obj *statesResponseIsisLspsStateIter) Clear() StatesResponseIsisLspsStateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.IsisLspsState{} + obj.isisLspsStateSlice = []IsisLspsState{} + } + return obj +} +func (obj *statesResponseIsisLspsStateIter) clearHolderSlice() StatesResponseIsisLspsStateIter { + if len(obj.isisLspsStateSlice) > 0 { + obj.isisLspsStateSlice = []IsisLspsState{} + } + return obj +} +func (obj *statesResponseIsisLspsStateIter) appendHolderSlice(item IsisLspsState) StatesResponseIsisLspsStateIter { + obj.isisLspsStateSlice = append(obj.isisLspsStateSlice, item) + return obj +} + +// description is TBD +// LldpNeighbors returns a []LldpNeighborsState +func (obj *statesResponse) LldpNeighbors() StatesResponseLldpNeighborsStateIter { + if len(obj.obj.LldpNeighbors) == 0 { + obj.setChoice(StatesResponseChoice.LLDP_NEIGHBORS) + } + if obj.lldpNeighborsHolder == nil { + obj.lldpNeighborsHolder = newStatesResponseLldpNeighborsStateIter(&obj.obj.LldpNeighbors).setMsg(obj) + } + return obj.lldpNeighborsHolder +} + +type statesResponseLldpNeighborsStateIter struct { + obj *statesResponse + lldpNeighborsStateSlice []LldpNeighborsState + fieldPtr *[]*otg.LldpNeighborsState +} + +func newStatesResponseLldpNeighborsStateIter(ptr *[]*otg.LldpNeighborsState) StatesResponseLldpNeighborsStateIter { + return &statesResponseLldpNeighborsStateIter{fieldPtr: ptr} +} + +type StatesResponseLldpNeighborsStateIter interface { + setMsg(*statesResponse) StatesResponseLldpNeighborsStateIter + Items() []LldpNeighborsState + Add() LldpNeighborsState + Append(items ...LldpNeighborsState) StatesResponseLldpNeighborsStateIter + Set(index int, newObj LldpNeighborsState) StatesResponseLldpNeighborsStateIter + Clear() StatesResponseLldpNeighborsStateIter + clearHolderSlice() StatesResponseLldpNeighborsStateIter + appendHolderSlice(item LldpNeighborsState) StatesResponseLldpNeighborsStateIter +} + +func (obj *statesResponseLldpNeighborsStateIter) setMsg(msg *statesResponse) StatesResponseLldpNeighborsStateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&lldpNeighborsState{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *statesResponseLldpNeighborsStateIter) Items() []LldpNeighborsState { + return obj.lldpNeighborsStateSlice +} + +func (obj *statesResponseLldpNeighborsStateIter) Add() LldpNeighborsState { + newObj := &otg.LldpNeighborsState{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &lldpNeighborsState{obj: newObj} + newLibObj.setDefault() + obj.lldpNeighborsStateSlice = append(obj.lldpNeighborsStateSlice, newLibObj) + return newLibObj +} + +func (obj *statesResponseLldpNeighborsStateIter) Append(items ...LldpNeighborsState) StatesResponseLldpNeighborsStateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.lldpNeighborsStateSlice = append(obj.lldpNeighborsStateSlice, item) + } + return obj +} + +func (obj *statesResponseLldpNeighborsStateIter) Set(index int, newObj LldpNeighborsState) StatesResponseLldpNeighborsStateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.lldpNeighborsStateSlice[index] = newObj + return obj +} +func (obj *statesResponseLldpNeighborsStateIter) Clear() StatesResponseLldpNeighborsStateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.LldpNeighborsState{} + obj.lldpNeighborsStateSlice = []LldpNeighborsState{} + } + return obj +} +func (obj *statesResponseLldpNeighborsStateIter) clearHolderSlice() StatesResponseLldpNeighborsStateIter { + if len(obj.lldpNeighborsStateSlice) > 0 { + obj.lldpNeighborsStateSlice = []LldpNeighborsState{} + } + return obj +} +func (obj *statesResponseLldpNeighborsStateIter) appendHolderSlice(item LldpNeighborsState) StatesResponseLldpNeighborsStateIter { + obj.lldpNeighborsStateSlice = append(obj.lldpNeighborsStateSlice, item) + return obj +} + +// description is TBD +// RsvpLsps returns a []RsvpLspsState +func (obj *statesResponse) RsvpLsps() StatesResponseRsvpLspsStateIter { + if len(obj.obj.RsvpLsps) == 0 { + obj.setChoice(StatesResponseChoice.RSVP_LSPS) + } + if obj.rsvpLspsHolder == nil { + obj.rsvpLspsHolder = newStatesResponseRsvpLspsStateIter(&obj.obj.RsvpLsps).setMsg(obj) + } + return obj.rsvpLspsHolder +} + +type statesResponseRsvpLspsStateIter struct { + obj *statesResponse + rsvpLspsStateSlice []RsvpLspsState + fieldPtr *[]*otg.RsvpLspsState +} + +func newStatesResponseRsvpLspsStateIter(ptr *[]*otg.RsvpLspsState) StatesResponseRsvpLspsStateIter { + return &statesResponseRsvpLspsStateIter{fieldPtr: ptr} +} + +type StatesResponseRsvpLspsStateIter interface { + setMsg(*statesResponse) StatesResponseRsvpLspsStateIter + Items() []RsvpLspsState + Add() RsvpLspsState + Append(items ...RsvpLspsState) StatesResponseRsvpLspsStateIter + Set(index int, newObj RsvpLspsState) StatesResponseRsvpLspsStateIter + Clear() StatesResponseRsvpLspsStateIter + clearHolderSlice() StatesResponseRsvpLspsStateIter + appendHolderSlice(item RsvpLspsState) StatesResponseRsvpLspsStateIter +} + +func (obj *statesResponseRsvpLspsStateIter) setMsg(msg *statesResponse) StatesResponseRsvpLspsStateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&rsvpLspsState{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *statesResponseRsvpLspsStateIter) Items() []RsvpLspsState { + return obj.rsvpLspsStateSlice +} + +func (obj *statesResponseRsvpLspsStateIter) Add() RsvpLspsState { + newObj := &otg.RsvpLspsState{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &rsvpLspsState{obj: newObj} + newLibObj.setDefault() + obj.rsvpLspsStateSlice = append(obj.rsvpLspsStateSlice, newLibObj) + return newLibObj +} + +func (obj *statesResponseRsvpLspsStateIter) Append(items ...RsvpLspsState) StatesResponseRsvpLspsStateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.rsvpLspsStateSlice = append(obj.rsvpLspsStateSlice, item) + } + return obj +} + +func (obj *statesResponseRsvpLspsStateIter) Set(index int, newObj RsvpLspsState) StatesResponseRsvpLspsStateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.rsvpLspsStateSlice[index] = newObj + return obj +} +func (obj *statesResponseRsvpLspsStateIter) Clear() StatesResponseRsvpLspsStateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.RsvpLspsState{} + obj.rsvpLspsStateSlice = []RsvpLspsState{} + } + return obj +} +func (obj *statesResponseRsvpLspsStateIter) clearHolderSlice() StatesResponseRsvpLspsStateIter { + if len(obj.rsvpLspsStateSlice) > 0 { + obj.rsvpLspsStateSlice = []RsvpLspsState{} + } + return obj +} +func (obj *statesResponseRsvpLspsStateIter) appendHolderSlice(item RsvpLspsState) StatesResponseRsvpLspsStateIter { + obj.rsvpLspsStateSlice = append(obj.rsvpLspsStateSlice, item) + return obj +} + +// description is TBD +// Dhcpv4Interfaces returns a []Dhcpv4InterfaceState +func (obj *statesResponse) Dhcpv4Interfaces() StatesResponseDhcpv4InterfaceStateIter { + if len(obj.obj.Dhcpv4Interfaces) == 0 { + obj.setChoice(StatesResponseChoice.DHCPV4_INTERFACES) + } + if obj.dhcpv4InterfacesHolder == nil { + obj.dhcpv4InterfacesHolder = newStatesResponseDhcpv4InterfaceStateIter(&obj.obj.Dhcpv4Interfaces).setMsg(obj) + } + return obj.dhcpv4InterfacesHolder +} + +type statesResponseDhcpv4InterfaceStateIter struct { + obj *statesResponse + dhcpv4InterfaceStateSlice []Dhcpv4InterfaceState + fieldPtr *[]*otg.Dhcpv4InterfaceState +} + +func newStatesResponseDhcpv4InterfaceStateIter(ptr *[]*otg.Dhcpv4InterfaceState) StatesResponseDhcpv4InterfaceStateIter { + return &statesResponseDhcpv4InterfaceStateIter{fieldPtr: ptr} +} + +type StatesResponseDhcpv4InterfaceStateIter interface { + setMsg(*statesResponse) StatesResponseDhcpv4InterfaceStateIter + Items() []Dhcpv4InterfaceState + Add() Dhcpv4InterfaceState + Append(items ...Dhcpv4InterfaceState) StatesResponseDhcpv4InterfaceStateIter + Set(index int, newObj Dhcpv4InterfaceState) StatesResponseDhcpv4InterfaceStateIter + Clear() StatesResponseDhcpv4InterfaceStateIter + clearHolderSlice() StatesResponseDhcpv4InterfaceStateIter + appendHolderSlice(item Dhcpv4InterfaceState) StatesResponseDhcpv4InterfaceStateIter +} + +func (obj *statesResponseDhcpv4InterfaceStateIter) setMsg(msg *statesResponse) StatesResponseDhcpv4InterfaceStateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&dhcpv4InterfaceState{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *statesResponseDhcpv4InterfaceStateIter) Items() []Dhcpv4InterfaceState { + return obj.dhcpv4InterfaceStateSlice +} + +func (obj *statesResponseDhcpv4InterfaceStateIter) Add() Dhcpv4InterfaceState { + newObj := &otg.Dhcpv4InterfaceState{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &dhcpv4InterfaceState{obj: newObj} + newLibObj.setDefault() + obj.dhcpv4InterfaceStateSlice = append(obj.dhcpv4InterfaceStateSlice, newLibObj) + return newLibObj +} + +func (obj *statesResponseDhcpv4InterfaceStateIter) Append(items ...Dhcpv4InterfaceState) StatesResponseDhcpv4InterfaceStateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.dhcpv4InterfaceStateSlice = append(obj.dhcpv4InterfaceStateSlice, item) + } + return obj +} + +func (obj *statesResponseDhcpv4InterfaceStateIter) Set(index int, newObj Dhcpv4InterfaceState) StatesResponseDhcpv4InterfaceStateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.dhcpv4InterfaceStateSlice[index] = newObj + return obj +} +func (obj *statesResponseDhcpv4InterfaceStateIter) Clear() StatesResponseDhcpv4InterfaceStateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Dhcpv4InterfaceState{} + obj.dhcpv4InterfaceStateSlice = []Dhcpv4InterfaceState{} + } + return obj +} +func (obj *statesResponseDhcpv4InterfaceStateIter) clearHolderSlice() StatesResponseDhcpv4InterfaceStateIter { + if len(obj.dhcpv4InterfaceStateSlice) > 0 { + obj.dhcpv4InterfaceStateSlice = []Dhcpv4InterfaceState{} + } + return obj +} +func (obj *statesResponseDhcpv4InterfaceStateIter) appendHolderSlice(item Dhcpv4InterfaceState) StatesResponseDhcpv4InterfaceStateIter { + obj.dhcpv4InterfaceStateSlice = append(obj.dhcpv4InterfaceStateSlice, item) + return obj +} + +// description is TBD +// Dhcpv4Leases returns a []Dhcpv4LeasesState +func (obj *statesResponse) Dhcpv4Leases() StatesResponseDhcpv4LeasesStateIter { + if len(obj.obj.Dhcpv4Leases) == 0 { + obj.setChoice(StatesResponseChoice.DHCPV4_LEASES) + } + if obj.dhcpv4LeasesHolder == nil { + obj.dhcpv4LeasesHolder = newStatesResponseDhcpv4LeasesStateIter(&obj.obj.Dhcpv4Leases).setMsg(obj) + } + return obj.dhcpv4LeasesHolder +} + +type statesResponseDhcpv4LeasesStateIter struct { + obj *statesResponse + dhcpv4LeasesStateSlice []Dhcpv4LeasesState + fieldPtr *[]*otg.Dhcpv4LeasesState +} + +func newStatesResponseDhcpv4LeasesStateIter(ptr *[]*otg.Dhcpv4LeasesState) StatesResponseDhcpv4LeasesStateIter { + return &statesResponseDhcpv4LeasesStateIter{fieldPtr: ptr} +} + +type StatesResponseDhcpv4LeasesStateIter interface { + setMsg(*statesResponse) StatesResponseDhcpv4LeasesStateIter + Items() []Dhcpv4LeasesState + Add() Dhcpv4LeasesState + Append(items ...Dhcpv4LeasesState) StatesResponseDhcpv4LeasesStateIter + Set(index int, newObj Dhcpv4LeasesState) StatesResponseDhcpv4LeasesStateIter + Clear() StatesResponseDhcpv4LeasesStateIter + clearHolderSlice() StatesResponseDhcpv4LeasesStateIter + appendHolderSlice(item Dhcpv4LeasesState) StatesResponseDhcpv4LeasesStateIter +} + +func (obj *statesResponseDhcpv4LeasesStateIter) setMsg(msg *statesResponse) StatesResponseDhcpv4LeasesStateIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&dhcpv4LeasesState{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *statesResponseDhcpv4LeasesStateIter) Items() []Dhcpv4LeasesState { + return obj.dhcpv4LeasesStateSlice +} + +func (obj *statesResponseDhcpv4LeasesStateIter) Add() Dhcpv4LeasesState { + newObj := &otg.Dhcpv4LeasesState{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &dhcpv4LeasesState{obj: newObj} + newLibObj.setDefault() + obj.dhcpv4LeasesStateSlice = append(obj.dhcpv4LeasesStateSlice, newLibObj) + return newLibObj +} + +func (obj *statesResponseDhcpv4LeasesStateIter) Append(items ...Dhcpv4LeasesState) StatesResponseDhcpv4LeasesStateIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.dhcpv4LeasesStateSlice = append(obj.dhcpv4LeasesStateSlice, item) + } + return obj +} + +func (obj *statesResponseDhcpv4LeasesStateIter) Set(index int, newObj Dhcpv4LeasesState) StatesResponseDhcpv4LeasesStateIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.dhcpv4LeasesStateSlice[index] = newObj + return obj +} +func (obj *statesResponseDhcpv4LeasesStateIter) Clear() StatesResponseDhcpv4LeasesStateIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.Dhcpv4LeasesState{} + obj.dhcpv4LeasesStateSlice = []Dhcpv4LeasesState{} + } + return obj +} +func (obj *statesResponseDhcpv4LeasesStateIter) clearHolderSlice() StatesResponseDhcpv4LeasesStateIter { + if len(obj.dhcpv4LeasesStateSlice) > 0 { + obj.dhcpv4LeasesStateSlice = []Dhcpv4LeasesState{} + } + return obj +} +func (obj *statesResponseDhcpv4LeasesStateIter) appendHolderSlice(item Dhcpv4LeasesState) StatesResponseDhcpv4LeasesStateIter { + obj.dhcpv4LeasesStateSlice = append(obj.dhcpv4LeasesStateSlice, item) + return obj +} + +func (obj *statesResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Ipv4Neighbors) != 0 { + + if set_default { + obj.Ipv4Neighbors().clearHolderSlice() + for _, item := range obj.obj.Ipv4Neighbors { + obj.Ipv4Neighbors().appendHolderSlice(&neighborsv4State{obj: item}) + } + } + for _, item := range obj.Ipv4Neighbors().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Ipv6Neighbors) != 0 { + + if set_default { + obj.Ipv6Neighbors().clearHolderSlice() + for _, item := range obj.obj.Ipv6Neighbors { + obj.Ipv6Neighbors().appendHolderSlice(&neighborsv6State{obj: item}) + } + } + for _, item := range obj.Ipv6Neighbors().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.BgpPrefixes) != 0 { + + if set_default { + obj.BgpPrefixes().clearHolderSlice() + for _, item := range obj.obj.BgpPrefixes { + obj.BgpPrefixes().appendHolderSlice(&bgpPrefixesState{obj: item}) + } + } + for _, item := range obj.BgpPrefixes().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.IsisLsps) != 0 { + + if set_default { + obj.IsisLsps().clearHolderSlice() + for _, item := range obj.obj.IsisLsps { + obj.IsisLsps().appendHolderSlice(&isisLspsState{obj: item}) + } + } + for _, item := range obj.IsisLsps().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.LldpNeighbors) != 0 { + + if set_default { + obj.LldpNeighbors().clearHolderSlice() + for _, item := range obj.obj.LldpNeighbors { + obj.LldpNeighbors().appendHolderSlice(&lldpNeighborsState{obj: item}) + } + } + for _, item := range obj.LldpNeighbors().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.RsvpLsps) != 0 { + + if set_default { + obj.RsvpLsps().clearHolderSlice() + for _, item := range obj.obj.RsvpLsps { + obj.RsvpLsps().appendHolderSlice(&rsvpLspsState{obj: item}) + } + } + for _, item := range obj.RsvpLsps().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Dhcpv4Interfaces) != 0 { + + if set_default { + obj.Dhcpv4Interfaces().clearHolderSlice() + for _, item := range obj.obj.Dhcpv4Interfaces { + obj.Dhcpv4Interfaces().appendHolderSlice(&dhcpv4InterfaceState{obj: item}) + } + } + for _, item := range obj.Dhcpv4Interfaces().Items() { + item.validateObj(vObj, set_default) + } + + } + + if len(obj.obj.Dhcpv4Leases) != 0 { + + if set_default { + obj.Dhcpv4Leases().clearHolderSlice() + for _, item := range obj.obj.Dhcpv4Leases { + obj.Dhcpv4Leases().appendHolderSlice(&dhcpv4LeasesState{obj: item}) + } + } + for _, item := range obj.Dhcpv4Leases().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *statesResponse) setDefault() { + var choices_set int = 0 + var choice StatesResponseChoiceEnum + + if len(obj.obj.Ipv4Neighbors) > 0 { + choices_set += 1 + choice = StatesResponseChoice.IPV4_NEIGHBORS + } + + if len(obj.obj.Ipv6Neighbors) > 0 { + choices_set += 1 + choice = StatesResponseChoice.IPV6_NEIGHBORS + } + + if len(obj.obj.BgpPrefixes) > 0 { + choices_set += 1 + choice = StatesResponseChoice.BGP_PREFIXES + } + + if len(obj.obj.IsisLsps) > 0 { + choices_set += 1 + choice = StatesResponseChoice.ISIS_LSPS + } + + if len(obj.obj.LldpNeighbors) > 0 { + choices_set += 1 + choice = StatesResponseChoice.LLDP_NEIGHBORS + } + + if len(obj.obj.RsvpLsps) > 0 { + choices_set += 1 + choice = StatesResponseChoice.RSVP_LSPS + } + + if len(obj.obj.Dhcpv4Interfaces) > 0 { + choices_set += 1 + choice = StatesResponseChoice.DHCPV4_INTERFACES + } + + if len(obj.obj.Dhcpv4Leases) > 0 { + choices_set += 1 + choice = StatesResponseChoice.DHCPV4_LEASES + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(StatesResponseChoice.IPV4_NEIGHBORS) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in StatesResponse") + } + } else { + intVal := otg.StatesResponse_Choice_Enum_value[string(choice)] + enumValue := otg.StatesResponse_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/update_config_response.go b/gosnappi/update_config_response.go new file mode 100644 index 00000000..cd41964a --- /dev/null +++ b/gosnappi/update_config_response.go @@ -0,0 +1,328 @@ +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" +) + +// ***** UpdateConfigResponse ***** +type updateConfigResponse struct { + validation + obj *otg.UpdateConfigResponse + marshaller marshalUpdateConfigResponse + unMarshaller unMarshalUpdateConfigResponse + warningHolder Warning +} + +func NewUpdateConfigResponse() UpdateConfigResponse { + obj := updateConfigResponse{obj: &otg.UpdateConfigResponse{}} + obj.setDefault() + return &obj +} + +func (obj *updateConfigResponse) msg() *otg.UpdateConfigResponse { + return obj.obj +} + +func (obj *updateConfigResponse) setMsg(msg *otg.UpdateConfigResponse) UpdateConfigResponse { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalupdateConfigResponse struct { + obj *updateConfigResponse +} + +type marshalUpdateConfigResponse interface { + // ToProto marshals UpdateConfigResponse to protobuf object *otg.UpdateConfigResponse + ToProto() (*otg.UpdateConfigResponse, error) + // ToPbText marshals UpdateConfigResponse to protobuf text + ToPbText() (string, error) + // ToYaml marshals UpdateConfigResponse to YAML text + ToYaml() (string, error) + // ToJson marshals UpdateConfigResponse to JSON text + ToJson() (string, error) +} + +type unMarshalupdateConfigResponse struct { + obj *updateConfigResponse +} + +type unMarshalUpdateConfigResponse interface { + // FromProto unmarshals UpdateConfigResponse from protobuf object *otg.UpdateConfigResponse + FromProto(msg *otg.UpdateConfigResponse) (UpdateConfigResponse, error) + // FromPbText unmarshals UpdateConfigResponse from protobuf text + FromPbText(value string) error + // FromYaml unmarshals UpdateConfigResponse from YAML text + FromYaml(value string) error + // FromJson unmarshals UpdateConfigResponse from JSON text + FromJson(value string) error +} + +func (obj *updateConfigResponse) Marshal() marshalUpdateConfigResponse { + if obj.marshaller == nil { + obj.marshaller = &marshalupdateConfigResponse{obj: obj} + } + return obj.marshaller +} + +func (obj *updateConfigResponse) Unmarshal() unMarshalUpdateConfigResponse { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalupdateConfigResponse{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalupdateConfigResponse) ToProto() (*otg.UpdateConfigResponse, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalupdateConfigResponse) FromProto(msg *otg.UpdateConfigResponse) (UpdateConfigResponse, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalupdateConfigResponse) 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 *unMarshalupdateConfigResponse) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalupdateConfigResponse) 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 *unMarshalupdateConfigResponse) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalupdateConfigResponse) 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 *unMarshalupdateConfigResponse) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *updateConfigResponse) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *updateConfigResponse) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *updateConfigResponse) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *updateConfigResponse) Clone() (UpdateConfigResponse, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewUpdateConfigResponse() + 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 +} + +func (obj *updateConfigResponse) setNil() { + obj.warningHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// UpdateConfigResponse is description is TBD +type UpdateConfigResponse interface { + Validation + // msg marshals UpdateConfigResponse to protobuf object *otg.UpdateConfigResponse + // and doesn't set defaults + msg() *otg.UpdateConfigResponse + // setMsg unmarshals UpdateConfigResponse from protobuf object *otg.UpdateConfigResponse + // and doesn't set defaults + setMsg(*otg.UpdateConfigResponse) UpdateConfigResponse + // provides marshal interface + Marshal() marshalUpdateConfigResponse + // provides unmarshal interface + Unmarshal() unMarshalUpdateConfigResponse + // validate validates UpdateConfigResponse + validate() error + // A stringer function + String() string + // Clones the object + Clone() (UpdateConfigResponse, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Warning returns Warning, set in UpdateConfigResponse. + // Warning is a list of warnings that have occurred while executing the request. + Warning() Warning + // SetWarning assigns Warning provided by user to UpdateConfigResponse. + // Warning is a list of warnings that have occurred while executing the request. + SetWarning(value Warning) UpdateConfigResponse + // HasWarning checks if Warning has been set in UpdateConfigResponse + HasWarning() bool + setNil() +} + +// description is TBD +// Warning returns a Warning +func (obj *updateConfigResponse) Warning() Warning { + if obj.obj.Warning == nil { + obj.obj.Warning = NewWarning().msg() + } + if obj.warningHolder == nil { + obj.warningHolder = &warning{obj: obj.obj.Warning} + } + return obj.warningHolder +} + +// description is TBD +// Warning returns a Warning +func (obj *updateConfigResponse) HasWarning() bool { + return obj.obj.Warning != nil +} + +// description is TBD +// SetWarning sets the Warning value in the UpdateConfigResponse object +func (obj *updateConfigResponse) SetWarning(value Warning) UpdateConfigResponse { + + obj.warningHolder = nil + obj.obj.Warning = value.msg() + + return obj +} + +func (obj *updateConfigResponse) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Warning != nil { + + obj.Warning().validateObj(vObj, set_default) + } + +} + +func (obj *updateConfigResponse) setDefault() { + +} diff --git a/gosnappi/v4_route_address.go b/gosnappi/v4_route_address.go new file mode 100644 index 00000000..85945ee3 --- /dev/null +++ b/gosnappi/v4_route_address.go @@ -0,0 +1,434 @@ +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" +) + +// ***** V4RouteAddress ***** +type v4RouteAddress struct { + validation + obj *otg.V4RouteAddress + marshaller marshalV4RouteAddress + unMarshaller unMarshalV4RouteAddress +} + +func NewV4RouteAddress() V4RouteAddress { + obj := v4RouteAddress{obj: &otg.V4RouteAddress{}} + obj.setDefault() + return &obj +} + +func (obj *v4RouteAddress) msg() *otg.V4RouteAddress { + return obj.obj +} + +func (obj *v4RouteAddress) setMsg(msg *otg.V4RouteAddress) V4RouteAddress { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalv4RouteAddress struct { + obj *v4RouteAddress +} + +type marshalV4RouteAddress interface { + // ToProto marshals V4RouteAddress to protobuf object *otg.V4RouteAddress + ToProto() (*otg.V4RouteAddress, error) + // ToPbText marshals V4RouteAddress to protobuf text + ToPbText() (string, error) + // ToYaml marshals V4RouteAddress to YAML text + ToYaml() (string, error) + // ToJson marshals V4RouteAddress to JSON text + ToJson() (string, error) +} + +type unMarshalv4RouteAddress struct { + obj *v4RouteAddress +} + +type unMarshalV4RouteAddress interface { + // FromProto unmarshals V4RouteAddress from protobuf object *otg.V4RouteAddress + FromProto(msg *otg.V4RouteAddress) (V4RouteAddress, error) + // FromPbText unmarshals V4RouteAddress from protobuf text + FromPbText(value string) error + // FromYaml unmarshals V4RouteAddress from YAML text + FromYaml(value string) error + // FromJson unmarshals V4RouteAddress from JSON text + FromJson(value string) error +} + +func (obj *v4RouteAddress) Marshal() marshalV4RouteAddress { + if obj.marshaller == nil { + obj.marshaller = &marshalv4RouteAddress{obj: obj} + } + return obj.marshaller +} + +func (obj *v4RouteAddress) Unmarshal() unMarshalV4RouteAddress { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalv4RouteAddress{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalv4RouteAddress) ToProto() (*otg.V4RouteAddress, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalv4RouteAddress) FromProto(msg *otg.V4RouteAddress) (V4RouteAddress, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalv4RouteAddress) 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 *unMarshalv4RouteAddress) 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 *marshalv4RouteAddress) 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 *unMarshalv4RouteAddress) 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 *marshalv4RouteAddress) 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 *unMarshalv4RouteAddress) 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 *v4RouteAddress) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *v4RouteAddress) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *v4RouteAddress) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *v4RouteAddress) Clone() (V4RouteAddress, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewV4RouteAddress() + 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 +} + +// V4RouteAddress is a container for IPv4 route addresses. +type V4RouteAddress interface { + Validation + // msg marshals V4RouteAddress to protobuf object *otg.V4RouteAddress + // and doesn't set defaults + msg() *otg.V4RouteAddress + // setMsg unmarshals V4RouteAddress from protobuf object *otg.V4RouteAddress + // and doesn't set defaults + setMsg(*otg.V4RouteAddress) V4RouteAddress + // provides marshal interface + Marshal() marshalV4RouteAddress + // provides unmarshal interface + Unmarshal() unMarshalV4RouteAddress + // validate validates V4RouteAddress + validate() error + // A stringer function + String() string + // Clones the object + Clone() (V4RouteAddress, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Address returns string, set in V4RouteAddress. + Address() string + // SetAddress assigns string provided by user to V4RouteAddress + SetAddress(value string) V4RouteAddress + // Prefix returns uint32, set in V4RouteAddress. + Prefix() uint32 + // SetPrefix assigns uint32 provided by user to V4RouteAddress + SetPrefix(value uint32) V4RouteAddress + // HasPrefix checks if Prefix has been set in V4RouteAddress + HasPrefix() bool + // Count returns uint32, set in V4RouteAddress. + Count() uint32 + // SetCount assigns uint32 provided by user to V4RouteAddress + SetCount(value uint32) V4RouteAddress + // HasCount checks if Count has been set in V4RouteAddress + HasCount() bool + // Step returns uint32, set in V4RouteAddress. + Step() uint32 + // SetStep assigns uint32 provided by user to V4RouteAddress + SetStep(value uint32) V4RouteAddress + // HasStep checks if Step has been set in V4RouteAddress + HasStep() bool +} + +// The starting address of the network. +// Address returns a string +func (obj *v4RouteAddress) Address() string { + + return *obj.obj.Address + +} + +// The starting address of the network. +// SetAddress sets the string value in the V4RouteAddress object +func (obj *v4RouteAddress) SetAddress(value string) V4RouteAddress { + + obj.obj.Address = &value + return obj +} + +// The IPv4 network prefix length to be applied to the address. +// Prefix returns a uint32 +func (obj *v4RouteAddress) Prefix() uint32 { + + return *obj.obj.Prefix + +} + +// The IPv4 network prefix length to be applied to the address. +// Prefix returns a uint32 +func (obj *v4RouteAddress) HasPrefix() bool { + return obj.obj.Prefix != nil +} + +// The IPv4 network prefix length to be applied to the address. +// SetPrefix sets the uint32 value in the V4RouteAddress object +func (obj *v4RouteAddress) SetPrefix(value uint32) V4RouteAddress { + + obj.obj.Prefix = &value + return obj +} + +// The total number of addresses in the range. +// Count returns a uint32 +func (obj *v4RouteAddress) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of addresses in the range. +// Count returns a uint32 +func (obj *v4RouteAddress) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of addresses in the range. +// SetCount sets the uint32 value in the V4RouteAddress object +func (obj *v4RouteAddress) SetCount(value uint32) V4RouteAddress { + + obj.obj.Count = &value + return obj +} + +// Increments the network address prefixes within a route range where multiple routes are present. The value is incremented according to the Prefix Length and Step. +// Step returns a uint32 +func (obj *v4RouteAddress) Step() uint32 { + + return *obj.obj.Step + +} + +// Increments the network address prefixes within a route range where multiple routes are present. The value is incremented according to the Prefix Length and Step. +// Step returns a uint32 +func (obj *v4RouteAddress) HasStep() bool { + return obj.obj.Step != nil +} + +// Increments the network address prefixes within a route range where multiple routes are present. The value is incremented according to the Prefix Length and Step. +// SetStep sets the uint32 value in the V4RouteAddress object +func (obj *v4RouteAddress) SetStep(value uint32) V4RouteAddress { + + obj.obj.Step = &value + return obj +} + +func (obj *v4RouteAddress) 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 V4RouteAddress") + } + if obj.obj.Address != nil { + + err := obj.validateIpv4(obj.Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on V4RouteAddress.Address")) + } + + } + + if obj.obj.Prefix != nil { + + if *obj.obj.Prefix > 32 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= V4RouteAddress.Prefix <= 32 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 <= V4RouteAddress.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 <= V4RouteAddress.Step <= 4294967295 but Got %d", *obj.obj.Step)) + } + + } + +} + +func (obj *v4RouteAddress) setDefault() { + if obj.obj.Prefix == nil { + obj.SetPrefix(24) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + +} diff --git a/gosnappi/v6_route_address.go b/gosnappi/v6_route_address.go new file mode 100644 index 00000000..b1195771 --- /dev/null +++ b/gosnappi/v6_route_address.go @@ -0,0 +1,434 @@ +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" +) + +// ***** V6RouteAddress ***** +type v6RouteAddress struct { + validation + obj *otg.V6RouteAddress + marshaller marshalV6RouteAddress + unMarshaller unMarshalV6RouteAddress +} + +func NewV6RouteAddress() V6RouteAddress { + obj := v6RouteAddress{obj: &otg.V6RouteAddress{}} + obj.setDefault() + return &obj +} + +func (obj *v6RouteAddress) msg() *otg.V6RouteAddress { + return obj.obj +} + +func (obj *v6RouteAddress) setMsg(msg *otg.V6RouteAddress) V6RouteAddress { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalv6RouteAddress struct { + obj *v6RouteAddress +} + +type marshalV6RouteAddress interface { + // ToProto marshals V6RouteAddress to protobuf object *otg.V6RouteAddress + ToProto() (*otg.V6RouteAddress, error) + // ToPbText marshals V6RouteAddress to protobuf text + ToPbText() (string, error) + // ToYaml marshals V6RouteAddress to YAML text + ToYaml() (string, error) + // ToJson marshals V6RouteAddress to JSON text + ToJson() (string, error) +} + +type unMarshalv6RouteAddress struct { + obj *v6RouteAddress +} + +type unMarshalV6RouteAddress interface { + // FromProto unmarshals V6RouteAddress from protobuf object *otg.V6RouteAddress + FromProto(msg *otg.V6RouteAddress) (V6RouteAddress, error) + // FromPbText unmarshals V6RouteAddress from protobuf text + FromPbText(value string) error + // FromYaml unmarshals V6RouteAddress from YAML text + FromYaml(value string) error + // FromJson unmarshals V6RouteAddress from JSON text + FromJson(value string) error +} + +func (obj *v6RouteAddress) Marshal() marshalV6RouteAddress { + if obj.marshaller == nil { + obj.marshaller = &marshalv6RouteAddress{obj: obj} + } + return obj.marshaller +} + +func (obj *v6RouteAddress) Unmarshal() unMarshalV6RouteAddress { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalv6RouteAddress{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalv6RouteAddress) ToProto() (*otg.V6RouteAddress, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalv6RouteAddress) FromProto(msg *otg.V6RouteAddress) (V6RouteAddress, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalv6RouteAddress) 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 *unMarshalv6RouteAddress) 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 *marshalv6RouteAddress) 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 *unMarshalv6RouteAddress) 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 *marshalv6RouteAddress) 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 *unMarshalv6RouteAddress) 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 *v6RouteAddress) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *v6RouteAddress) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *v6RouteAddress) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *v6RouteAddress) Clone() (V6RouteAddress, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewV6RouteAddress() + 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 +} + +// V6RouteAddress is a container for IPv6 route addresses. +type V6RouteAddress interface { + Validation + // msg marshals V6RouteAddress to protobuf object *otg.V6RouteAddress + // and doesn't set defaults + msg() *otg.V6RouteAddress + // setMsg unmarshals V6RouteAddress from protobuf object *otg.V6RouteAddress + // and doesn't set defaults + setMsg(*otg.V6RouteAddress) V6RouteAddress + // provides marshal interface + Marshal() marshalV6RouteAddress + // provides unmarshal interface + Unmarshal() unMarshalV6RouteAddress + // validate validates V6RouteAddress + validate() error + // A stringer function + String() string + // Clones the object + Clone() (V6RouteAddress, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Address returns string, set in V6RouteAddress. + Address() string + // SetAddress assigns string provided by user to V6RouteAddress + SetAddress(value string) V6RouteAddress + // Prefix returns uint32, set in V6RouteAddress. + Prefix() uint32 + // SetPrefix assigns uint32 provided by user to V6RouteAddress + SetPrefix(value uint32) V6RouteAddress + // HasPrefix checks if Prefix has been set in V6RouteAddress + HasPrefix() bool + // Count returns uint32, set in V6RouteAddress. + Count() uint32 + // SetCount assigns uint32 provided by user to V6RouteAddress + SetCount(value uint32) V6RouteAddress + // HasCount checks if Count has been set in V6RouteAddress + HasCount() bool + // Step returns uint32, set in V6RouteAddress. + Step() uint32 + // SetStep assigns uint32 provided by user to V6RouteAddress + SetStep(value uint32) V6RouteAddress + // HasStep checks if Step has been set in V6RouteAddress + HasStep() bool +} + +// The starting address of the network. +// Address returns a string +func (obj *v6RouteAddress) Address() string { + + return *obj.obj.Address + +} + +// The starting address of the network. +// SetAddress sets the string value in the V6RouteAddress object +func (obj *v6RouteAddress) SetAddress(value string) V6RouteAddress { + + obj.obj.Address = &value + return obj +} + +// The IPv6 network prefix length to be applied to the address. +// Prefix returns a uint32 +func (obj *v6RouteAddress) Prefix() uint32 { + + return *obj.obj.Prefix + +} + +// The IPv6 network prefix length to be applied to the address. +// Prefix returns a uint32 +func (obj *v6RouteAddress) HasPrefix() bool { + return obj.obj.Prefix != nil +} + +// The IPv6 network prefix length to be applied to the address. +// SetPrefix sets the uint32 value in the V6RouteAddress object +func (obj *v6RouteAddress) SetPrefix(value uint32) V6RouteAddress { + + obj.obj.Prefix = &value + return obj +} + +// The total number of addresses in the range. +// Count returns a uint32 +func (obj *v6RouteAddress) Count() uint32 { + + return *obj.obj.Count + +} + +// The total number of addresses in the range. +// Count returns a uint32 +func (obj *v6RouteAddress) HasCount() bool { + return obj.obj.Count != nil +} + +// The total number of addresses in the range. +// SetCount sets the uint32 value in the V6RouteAddress object +func (obj *v6RouteAddress) SetCount(value uint32) V6RouteAddress { + + obj.obj.Count = &value + return obj +} + +// Increments the network address prefixes within a route range where multiple routes are present. The value is incremented according to the Prefix Length and Step. +// Step returns a uint32 +func (obj *v6RouteAddress) Step() uint32 { + + return *obj.obj.Step + +} + +// Increments the network address prefixes within a route range where multiple routes are present. The value is incremented according to the Prefix Length and Step. +// Step returns a uint32 +func (obj *v6RouteAddress) HasStep() bool { + return obj.obj.Step != nil +} + +// Increments the network address prefixes within a route range where multiple routes are present. The value is incremented according to the Prefix Length and Step. +// SetStep sets the uint32 value in the V6RouteAddress object +func (obj *v6RouteAddress) SetStep(value uint32) V6RouteAddress { + + obj.obj.Step = &value + return obj +} + +func (obj *v6RouteAddress) 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 V6RouteAddress") + } + if obj.obj.Address != nil { + + err := obj.validateIpv6(obj.Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on V6RouteAddress.Address")) + } + + } + + if obj.obj.Prefix != nil { + + if *obj.obj.Prefix > 128 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("0 <= V6RouteAddress.Prefix <= 128 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 <= V6RouteAddress.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 <= V6RouteAddress.Step <= 4294967295 but Got %d", *obj.obj.Step)) + } + + } + +} + +func (obj *v6RouteAddress) setDefault() { + if obj.obj.Prefix == nil { + obj.SetPrefix(64) + } + if obj.obj.Count == nil { + obj.SetCount(1) + } + if obj.obj.Step == nil { + obj.SetStep(1) + } + +} diff --git a/gosnappi/version.go b/gosnappi/version.go new file mode 100644 index 00000000..38b80778 --- /dev/null +++ b/gosnappi/version.go @@ -0,0 +1,371 @@ +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" +) + +// ***** Version ***** +type version struct { + validation + obj *otg.Version + marshaller marshalVersion + unMarshaller unMarshalVersion +} + +func NewVersion() Version { + obj := version{obj: &otg.Version{}} + obj.setDefault() + return &obj +} + +func (obj *version) msg() *otg.Version { + return obj.obj +} + +func (obj *version) setMsg(msg *otg.Version) Version { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalversion struct { + obj *version +} + +type marshalVersion interface { + // ToProto marshals Version to protobuf object *otg.Version + ToProto() (*otg.Version, error) + // ToPbText marshals Version to protobuf text + ToPbText() (string, error) + // ToYaml marshals Version to YAML text + ToYaml() (string, error) + // ToJson marshals Version to JSON text + ToJson() (string, error) +} + +type unMarshalversion struct { + obj *version +} + +type unMarshalVersion interface { + // FromProto unmarshals Version from protobuf object *otg.Version + FromProto(msg *otg.Version) (Version, error) + // FromPbText unmarshals Version from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Version from YAML text + FromYaml(value string) error + // FromJson unmarshals Version from JSON text + FromJson(value string) error +} + +func (obj *version) Marshal() marshalVersion { + if obj.marshaller == nil { + obj.marshaller = &marshalversion{obj: obj} + } + return obj.marshaller +} + +func (obj *version) Unmarshal() unMarshalVersion { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalversion{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalversion) ToProto() (*otg.Version, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalversion) FromProto(msg *otg.Version) (Version, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalversion) 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 *unMarshalversion) 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 *marshalversion) 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 *unMarshalversion) 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 *marshalversion) 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 *unMarshalversion) 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 *version) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *version) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *version) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *version) Clone() (Version, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewVersion() + 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 +} + +// Version is version details +type Version interface { + Validation + // msg marshals Version to protobuf object *otg.Version + // and doesn't set defaults + msg() *otg.Version + // setMsg unmarshals Version from protobuf object *otg.Version + // and doesn't set defaults + setMsg(*otg.Version) Version + // provides marshal interface + Marshal() marshalVersion + // provides unmarshal interface + Unmarshal() unMarshalVersion + // validate validates Version + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Version, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // ApiSpecVersion returns string, set in Version. + ApiSpecVersion() string + // SetApiSpecVersion assigns string provided by user to Version + SetApiSpecVersion(value string) Version + // HasApiSpecVersion checks if ApiSpecVersion has been set in Version + HasApiSpecVersion() bool + // SdkVersion returns string, set in Version. + SdkVersion() string + // SetSdkVersion assigns string provided by user to Version + SetSdkVersion(value string) Version + // HasSdkVersion checks if SdkVersion has been set in Version + HasSdkVersion() bool + // AppVersion returns string, set in Version. + AppVersion() string + // SetAppVersion assigns string provided by user to Version + SetAppVersion(value string) Version + // HasAppVersion checks if AppVersion has been set in Version + HasAppVersion() bool +} + +// Version of API specification +// ApiSpecVersion returns a string +func (obj *version) ApiSpecVersion() string { + + return *obj.obj.ApiSpecVersion + +} + +// Version of API specification +// ApiSpecVersion returns a string +func (obj *version) HasApiSpecVersion() bool { + return obj.obj.ApiSpecVersion != nil +} + +// Version of API specification +// SetApiSpecVersion sets the string value in the Version object +func (obj *version) SetApiSpecVersion(value string) Version { + + obj.obj.ApiSpecVersion = &value + return obj +} + +// Version of SDK generated from API specification +// SdkVersion returns a string +func (obj *version) SdkVersion() string { + + return *obj.obj.SdkVersion + +} + +// Version of SDK generated from API specification +// SdkVersion returns a string +func (obj *version) HasSdkVersion() bool { + return obj.obj.SdkVersion != nil +} + +// Version of SDK generated from API specification +// SetSdkVersion sets the string value in the Version object +func (obj *version) SetSdkVersion(value string) Version { + + obj.obj.SdkVersion = &value + return obj +} + +// Version of application consuming or serving the API +// AppVersion returns a string +func (obj *version) AppVersion() string { + + return *obj.obj.AppVersion + +} + +// Version of application consuming or serving the API +// AppVersion returns a string +func (obj *version) HasAppVersion() bool { + return obj.obj.AppVersion != nil +} + +// Version of application consuming or serving the API +// SetAppVersion sets the string value in the Version object +func (obj *version) SetAppVersion(value string) Version { + + obj.obj.AppVersion = &value + return obj +} + +func (obj *version) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *version) setDefault() { + if obj.obj.ApiSpecVersion == nil { + obj.SetApiSpecVersion("") + } + if obj.obj.SdkVersion == nil { + obj.SetSdkVersion("") + } + if obj.obj.AppVersion == nil { + obj.SetAppVersion("") + } + +} diff --git a/gosnappi/vxlan_tunnel_destination_ip_mode_unicast_arp_suppression_cache.go b/gosnappi/vxlan_tunnel_destination_ip_mode_unicast_arp_suppression_cache.go new file mode 100644 index 00000000..a3d924bd --- /dev/null +++ b/gosnappi/vxlan_tunnel_destination_ip_mode_unicast_arp_suppression_cache.go @@ -0,0 +1,352 @@ +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" +) + +// ***** VxlanTunnelDestinationIPModeUnicastArpSuppressionCache ***** +type vxlanTunnelDestinationIPModeUnicastArpSuppressionCache struct { + validation + obj *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + marshaller marshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache + unMarshaller unMarshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache +} + +func NewVxlanTunnelDestinationIPModeUnicastArpSuppressionCache() VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { + obj := vxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: &otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{}} + obj.setDefault() + return &obj +} + +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) msg() *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { + return obj.obj +} + +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) setMsg(msg *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache struct { + obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache +} + +type marshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache interface { + // ToProto marshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache to protobuf object *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + ToProto() (*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache, error) + // ToPbText marshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache to protobuf text + ToPbText() (string, error) + // ToYaml marshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache to YAML text + ToYaml() (string, error) + // ToJson marshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache to JSON text + ToJson() (string, error) +} + +type unMarshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache struct { + obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache +} + +type unMarshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache interface { + // FromProto unmarshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache from protobuf object *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + FromProto(msg *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) (VxlanTunnelDestinationIPModeUnicastArpSuppressionCache, error) + // FromPbText unmarshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache from protobuf text + FromPbText(value string) error + // FromYaml unmarshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache from YAML text + FromYaml(value string) error + // FromJson unmarshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache from JSON text + FromJson(value string) error +} + +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) Marshal() marshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache { + if obj.marshaller == nil { + obj.marshaller = &marshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: obj} + } + return obj.marshaller +} + +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) Unmarshal() unMarshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) ToProto() (*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) FromProto(msg *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) (VxlanTunnelDestinationIPModeUnicastArpSuppressionCache, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) 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 *unMarshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) 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 *marshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) 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 *unMarshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) 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 *marshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) 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 *unMarshalvxlanTunnelDestinationIPModeUnicastArpSuppressionCache) 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 *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) Clone() (VxlanTunnelDestinationIPModeUnicastArpSuppressionCache, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewVxlanTunnelDestinationIPModeUnicastArpSuppressionCache() + 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 +} + +// VxlanTunnelDestinationIPModeUnicastArpSuppressionCache is each VTEP maintains an ARP suppression cache table for known IP hosts and their associated MAC addresses in the VNI segment. When an end host in the VNI sends an ARP request for another end-host IP address, its local VTEP intercepts the ARP request and checks for the ARP-resolved IP address in its ARP suppression cache table. If it finds a match, the local VTEP sends an ARP response on behalf of the remote end host. +type VxlanTunnelDestinationIPModeUnicastArpSuppressionCache interface { + Validation + // msg marshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache to protobuf object *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + // and doesn't set defaults + msg() *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + // setMsg unmarshals VxlanTunnelDestinationIPModeUnicastArpSuppressionCache from protobuf object *otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + // and doesn't set defaults + setMsg(*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + // provides marshal interface + Marshal() marshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache + // provides unmarshal interface + Unmarshal() unMarshalVxlanTunnelDestinationIPModeUnicastArpSuppressionCache + // validate validates VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + validate() error + // A stringer function + String() string + // Clones the object + Clone() (VxlanTunnelDestinationIPModeUnicastArpSuppressionCache, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RemoteVmMac returns string, set in VxlanTunnelDestinationIPModeUnicastArpSuppressionCache. + RemoteVmMac() string + // SetRemoteVmMac assigns string provided by user to VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + SetRemoteVmMac(value string) VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + // HasRemoteVmMac checks if RemoteVmMac has been set in VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + HasRemoteVmMac() bool + // RemoteVmIpv4 returns string, set in VxlanTunnelDestinationIPModeUnicastArpSuppressionCache. + RemoteVmIpv4() string + // SetRemoteVmIpv4 assigns string provided by user to VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + SetRemoteVmIpv4(value string) VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + // HasRemoteVmIpv4 checks if RemoteVmIpv4 has been set in VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + HasRemoteVmIpv4() bool +} + +// Remote VM MAC address bound to Remote VM IPv4 address +// RemoteVmMac returns a string +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) RemoteVmMac() string { + + return *obj.obj.RemoteVmMac + +} + +// Remote VM MAC address bound to Remote VM IPv4 address +// RemoteVmMac returns a string +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) HasRemoteVmMac() bool { + return obj.obj.RemoteVmMac != nil +} + +// Remote VM MAC address bound to Remote VM IPv4 address +// SetRemoteVmMac sets the string value in the VxlanTunnelDestinationIPModeUnicastArpSuppressionCache object +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) SetRemoteVmMac(value string) VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { + + obj.obj.RemoteVmMac = &value + return obj +} + +// Remote VM IPv4 address +// RemoteVmIpv4 returns a string +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) RemoteVmIpv4() string { + + return *obj.obj.RemoteVmIpv4 + +} + +// Remote VM IPv4 address +// RemoteVmIpv4 returns a string +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) HasRemoteVmIpv4() bool { + return obj.obj.RemoteVmIpv4 != nil +} + +// Remote VM IPv4 address +// SetRemoteVmIpv4 sets the string value in the VxlanTunnelDestinationIPModeUnicastArpSuppressionCache object +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) SetRemoteVmIpv4(value string) VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { + + obj.obj.RemoteVmIpv4 = &value + return obj +} + +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RemoteVmMac != nil { + + err := obj.validateMac(obj.RemoteVmMac()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on VxlanTunnelDestinationIPModeUnicastArpSuppressionCache.RemoteVmMac")) + } + + } + + if obj.obj.RemoteVmIpv4 != nil { + + err := obj.validateIpv4(obj.RemoteVmIpv4()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on VxlanTunnelDestinationIPModeUnicastArpSuppressionCache.RemoteVmIpv4")) + } + + } + +} + +func (obj *vxlanTunnelDestinationIPModeUnicastArpSuppressionCache) setDefault() { + +} diff --git a/gosnappi/vxlan_v4_tunnel.go b/gosnappi/vxlan_v4_tunnel.go new file mode 100644 index 00000000..02c7fb24 --- /dev/null +++ b/gosnappi/vxlan_v4_tunnel.go @@ -0,0 +1,431 @@ +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" +) + +// ***** VxlanV4Tunnel ***** +type vxlanV4Tunnel struct { + validation + obj *otg.VxlanV4Tunnel + marshaller marshalVxlanV4Tunnel + unMarshaller unMarshalVxlanV4Tunnel + destinationIpModeHolder VxlanV4TunnelDestinationIPMode +} + +func NewVxlanV4Tunnel() VxlanV4Tunnel { + obj := vxlanV4Tunnel{obj: &otg.VxlanV4Tunnel{}} + obj.setDefault() + return &obj +} + +func (obj *vxlanV4Tunnel) msg() *otg.VxlanV4Tunnel { + return obj.obj +} + +func (obj *vxlanV4Tunnel) setMsg(msg *otg.VxlanV4Tunnel) VxlanV4Tunnel { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalvxlanV4Tunnel struct { + obj *vxlanV4Tunnel +} + +type marshalVxlanV4Tunnel interface { + // ToProto marshals VxlanV4Tunnel to protobuf object *otg.VxlanV4Tunnel + ToProto() (*otg.VxlanV4Tunnel, error) + // ToPbText marshals VxlanV4Tunnel to protobuf text + ToPbText() (string, error) + // ToYaml marshals VxlanV4Tunnel to YAML text + ToYaml() (string, error) + // ToJson marshals VxlanV4Tunnel to JSON text + ToJson() (string, error) +} + +type unMarshalvxlanV4Tunnel struct { + obj *vxlanV4Tunnel +} + +type unMarshalVxlanV4Tunnel interface { + // FromProto unmarshals VxlanV4Tunnel from protobuf object *otg.VxlanV4Tunnel + FromProto(msg *otg.VxlanV4Tunnel) (VxlanV4Tunnel, error) + // FromPbText unmarshals VxlanV4Tunnel from protobuf text + FromPbText(value string) error + // FromYaml unmarshals VxlanV4Tunnel from YAML text + FromYaml(value string) error + // FromJson unmarshals VxlanV4Tunnel from JSON text + FromJson(value string) error +} + +func (obj *vxlanV4Tunnel) Marshal() marshalVxlanV4Tunnel { + if obj.marshaller == nil { + obj.marshaller = &marshalvxlanV4Tunnel{obj: obj} + } + return obj.marshaller +} + +func (obj *vxlanV4Tunnel) Unmarshal() unMarshalVxlanV4Tunnel { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalvxlanV4Tunnel{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalvxlanV4Tunnel) ToProto() (*otg.VxlanV4Tunnel, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalvxlanV4Tunnel) FromProto(msg *otg.VxlanV4Tunnel) (VxlanV4Tunnel, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalvxlanV4Tunnel) 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 *unMarshalvxlanV4Tunnel) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalvxlanV4Tunnel) 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 *unMarshalvxlanV4Tunnel) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalvxlanV4Tunnel) 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 *unMarshalvxlanV4Tunnel) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *vxlanV4Tunnel) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *vxlanV4Tunnel) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *vxlanV4Tunnel) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *vxlanV4Tunnel) Clone() (VxlanV4Tunnel, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewVxlanV4Tunnel() + 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 +} + +func (obj *vxlanV4Tunnel) setNil() { + obj.destinationIpModeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// VxlanV4Tunnel is configuration and operational state parameters relating to IPv4 VXLAN tunnel end-point interface. +type VxlanV4Tunnel interface { + Validation + // msg marshals VxlanV4Tunnel to protobuf object *otg.VxlanV4Tunnel + // and doesn't set defaults + msg() *otg.VxlanV4Tunnel + // setMsg unmarshals VxlanV4Tunnel from protobuf object *otg.VxlanV4Tunnel + // and doesn't set defaults + setMsg(*otg.VxlanV4Tunnel) VxlanV4Tunnel + // provides marshal interface + Marshal() marshalVxlanV4Tunnel + // provides unmarshal interface + Unmarshal() unMarshalVxlanV4Tunnel + // validate validates VxlanV4Tunnel + validate() error + // A stringer function + String() string + // Clones the object + Clone() (VxlanV4Tunnel, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // SourceInterface returns string, set in VxlanV4Tunnel. + SourceInterface() string + // SetSourceInterface assigns string provided by user to VxlanV4Tunnel + SetSourceInterface(value string) VxlanV4Tunnel + // DestinationIpMode returns VxlanV4TunnelDestinationIPMode, set in VxlanV4Tunnel. + // VxlanV4TunnelDestinationIPMode is communication mode between the VTEPs, either unicast or multicast. + DestinationIpMode() VxlanV4TunnelDestinationIPMode + // SetDestinationIpMode assigns VxlanV4TunnelDestinationIPMode provided by user to VxlanV4Tunnel. + // VxlanV4TunnelDestinationIPMode is communication mode between the VTEPs, either unicast or multicast. + SetDestinationIpMode(value VxlanV4TunnelDestinationIPMode) VxlanV4Tunnel + // HasDestinationIpMode checks if DestinationIpMode has been set in VxlanV4Tunnel + HasDestinationIpMode() bool + // Vni returns uint32, set in VxlanV4Tunnel. + Vni() uint32 + // SetVni assigns uint32 provided by user to VxlanV4Tunnel + SetVni(value uint32) VxlanV4Tunnel + // Name returns string, set in VxlanV4Tunnel. + Name() string + // SetName assigns string provided by user to VxlanV4Tunnel + SetName(value string) VxlanV4Tunnel + setNil() +} + +// Determines the source interface. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv4Loopback/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv4Loopback/properties/name +// +// SourceInterface returns a string +func (obj *vxlanV4Tunnel) SourceInterface() string { + + return *obj.obj.SourceInterface + +} + +// Determines the source interface. +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv4Loopback/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv4/properties/name +// - /components/schemas/Device.Ipv4Loopback/properties/name +// +// SetSourceInterface sets the string value in the VxlanV4Tunnel object +func (obj *vxlanV4Tunnel) SetSourceInterface(value string) VxlanV4Tunnel { + + obj.obj.SourceInterface = &value + return obj +} + +// description is TBD +// DestinationIpMode returns a VxlanV4TunnelDestinationIPMode +func (obj *vxlanV4Tunnel) DestinationIpMode() VxlanV4TunnelDestinationIPMode { + if obj.obj.DestinationIpMode == nil { + obj.obj.DestinationIpMode = NewVxlanV4TunnelDestinationIPMode().msg() + } + if obj.destinationIpModeHolder == nil { + obj.destinationIpModeHolder = &vxlanV4TunnelDestinationIPMode{obj: obj.obj.DestinationIpMode} + } + return obj.destinationIpModeHolder +} + +// description is TBD +// DestinationIpMode returns a VxlanV4TunnelDestinationIPMode +func (obj *vxlanV4Tunnel) HasDestinationIpMode() bool { + return obj.obj.DestinationIpMode != nil +} + +// description is TBD +// SetDestinationIpMode sets the VxlanV4TunnelDestinationIPMode value in the VxlanV4Tunnel object +func (obj *vxlanV4Tunnel) SetDestinationIpMode(value VxlanV4TunnelDestinationIPMode) VxlanV4Tunnel { + + obj.destinationIpModeHolder = nil + obj.obj.DestinationIpMode = value.msg() + + return obj +} + +// VXLAN Network Identifier (VNI) to distinguish network instances on the wire +// Vni returns a uint32 +func (obj *vxlanV4Tunnel) Vni() uint32 { + + return *obj.obj.Vni + +} + +// VXLAN Network Identifier (VNI) to distinguish network instances on the wire +// SetVni sets the uint32 value in the VxlanV4Tunnel object +func (obj *vxlanV4Tunnel) SetVni(value uint32) VxlanV4Tunnel { + + obj.obj.Vni = &value + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *vxlanV4Tunnel) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the VxlanV4Tunnel object +func (obj *vxlanV4Tunnel) SetName(value string) VxlanV4Tunnel { + + obj.obj.Name = &value + return obj +} + +func (obj *vxlanV4Tunnel) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // SourceInterface is required + if obj.obj.SourceInterface == nil { + vObj.validationErrors = append(vObj.validationErrors, "SourceInterface is required field on interface VxlanV4Tunnel") + } + + if obj.obj.DestinationIpMode != nil { + + obj.DestinationIpMode().validateObj(vObj, set_default) + } + + // Vni is required + if obj.obj.Vni == nil { + vObj.validationErrors = append(vObj.validationErrors, "Vni is required field on interface VxlanV4Tunnel") + } + if obj.obj.Vni != nil { + + if *obj.obj.Vni < 1 || *obj.obj.Vni > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= VxlanV4Tunnel.Vni <= 16777215 but Got %d", *obj.obj.Vni)) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface VxlanV4Tunnel") + } +} + +func (obj *vxlanV4Tunnel) setDefault() { + +} diff --git a/gosnappi/vxlan_v4_tunnel_destination_ip_mode.go b/gosnappi/vxlan_v4_tunnel_destination_ip_mode.go new file mode 100644 index 00000000..adff9c96 --- /dev/null +++ b/gosnappi/vxlan_v4_tunnel_destination_ip_mode.go @@ -0,0 +1,452 @@ +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" +) + +// ***** VxlanV4TunnelDestinationIPMode ***** +type vxlanV4TunnelDestinationIPMode struct { + validation + obj *otg.VxlanV4TunnelDestinationIPMode + marshaller marshalVxlanV4TunnelDestinationIPMode + unMarshaller unMarshalVxlanV4TunnelDestinationIPMode + unicastHolder VxlanV4TunnelDestinationIPModeUnicast + multicastHolder VxlanV4TunnelDestinationIPModeMulticast +} + +func NewVxlanV4TunnelDestinationIPMode() VxlanV4TunnelDestinationIPMode { + obj := vxlanV4TunnelDestinationIPMode{obj: &otg.VxlanV4TunnelDestinationIPMode{}} + obj.setDefault() + return &obj +} + +func (obj *vxlanV4TunnelDestinationIPMode) msg() *otg.VxlanV4TunnelDestinationIPMode { + return obj.obj +} + +func (obj *vxlanV4TunnelDestinationIPMode) setMsg(msg *otg.VxlanV4TunnelDestinationIPMode) VxlanV4TunnelDestinationIPMode { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalvxlanV4TunnelDestinationIPMode struct { + obj *vxlanV4TunnelDestinationIPMode +} + +type marshalVxlanV4TunnelDestinationIPMode interface { + // ToProto marshals VxlanV4TunnelDestinationIPMode to protobuf object *otg.VxlanV4TunnelDestinationIPMode + ToProto() (*otg.VxlanV4TunnelDestinationIPMode, error) + // ToPbText marshals VxlanV4TunnelDestinationIPMode to protobuf text + ToPbText() (string, error) + // ToYaml marshals VxlanV4TunnelDestinationIPMode to YAML text + ToYaml() (string, error) + // ToJson marshals VxlanV4TunnelDestinationIPMode to JSON text + ToJson() (string, error) +} + +type unMarshalvxlanV4TunnelDestinationIPMode struct { + obj *vxlanV4TunnelDestinationIPMode +} + +type unMarshalVxlanV4TunnelDestinationIPMode interface { + // FromProto unmarshals VxlanV4TunnelDestinationIPMode from protobuf object *otg.VxlanV4TunnelDestinationIPMode + FromProto(msg *otg.VxlanV4TunnelDestinationIPMode) (VxlanV4TunnelDestinationIPMode, error) + // FromPbText unmarshals VxlanV4TunnelDestinationIPMode from protobuf text + FromPbText(value string) error + // FromYaml unmarshals VxlanV4TunnelDestinationIPMode from YAML text + FromYaml(value string) error + // FromJson unmarshals VxlanV4TunnelDestinationIPMode from JSON text + FromJson(value string) error +} + +func (obj *vxlanV4TunnelDestinationIPMode) Marshal() marshalVxlanV4TunnelDestinationIPMode { + if obj.marshaller == nil { + obj.marshaller = &marshalvxlanV4TunnelDestinationIPMode{obj: obj} + } + return obj.marshaller +} + +func (obj *vxlanV4TunnelDestinationIPMode) Unmarshal() unMarshalVxlanV4TunnelDestinationIPMode { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalvxlanV4TunnelDestinationIPMode{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalvxlanV4TunnelDestinationIPMode) ToProto() (*otg.VxlanV4TunnelDestinationIPMode, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalvxlanV4TunnelDestinationIPMode) FromProto(msg *otg.VxlanV4TunnelDestinationIPMode) (VxlanV4TunnelDestinationIPMode, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalvxlanV4TunnelDestinationIPMode) 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 *unMarshalvxlanV4TunnelDestinationIPMode) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalvxlanV4TunnelDestinationIPMode) 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 *unMarshalvxlanV4TunnelDestinationIPMode) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalvxlanV4TunnelDestinationIPMode) 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 *unMarshalvxlanV4TunnelDestinationIPMode) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *vxlanV4TunnelDestinationIPMode) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *vxlanV4TunnelDestinationIPMode) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *vxlanV4TunnelDestinationIPMode) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *vxlanV4TunnelDestinationIPMode) Clone() (VxlanV4TunnelDestinationIPMode, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewVxlanV4TunnelDestinationIPMode() + 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 +} + +func (obj *vxlanV4TunnelDestinationIPMode) setNil() { + obj.unicastHolder = nil + obj.multicastHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// VxlanV4TunnelDestinationIPMode is communication mode between the VTEPs, either unicast or multicast. +type VxlanV4TunnelDestinationIPMode interface { + Validation + // msg marshals VxlanV4TunnelDestinationIPMode to protobuf object *otg.VxlanV4TunnelDestinationIPMode + // and doesn't set defaults + msg() *otg.VxlanV4TunnelDestinationIPMode + // setMsg unmarshals VxlanV4TunnelDestinationIPMode from protobuf object *otg.VxlanV4TunnelDestinationIPMode + // and doesn't set defaults + setMsg(*otg.VxlanV4TunnelDestinationIPMode) VxlanV4TunnelDestinationIPMode + // provides marshal interface + Marshal() marshalVxlanV4TunnelDestinationIPMode + // provides unmarshal interface + Unmarshal() unMarshalVxlanV4TunnelDestinationIPMode + // validate validates VxlanV4TunnelDestinationIPMode + validate() error + // A stringer function + String() string + // Clones the object + Clone() (VxlanV4TunnelDestinationIPMode, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns VxlanV4TunnelDestinationIPModeChoiceEnum, set in VxlanV4TunnelDestinationIPMode + Choice() VxlanV4TunnelDestinationIPModeChoiceEnum + // setChoice assigns VxlanV4TunnelDestinationIPModeChoiceEnum provided by user to VxlanV4TunnelDestinationIPMode + setChoice(value VxlanV4TunnelDestinationIPModeChoiceEnum) VxlanV4TunnelDestinationIPMode + // HasChoice checks if Choice has been set in VxlanV4TunnelDestinationIPMode + HasChoice() bool + // Unicast returns VxlanV4TunnelDestinationIPModeUnicast, set in VxlanV4TunnelDestinationIPMode. + // VxlanV4TunnelDestinationIPModeUnicast is description is TBD + Unicast() VxlanV4TunnelDestinationIPModeUnicast + // SetUnicast assigns VxlanV4TunnelDestinationIPModeUnicast provided by user to VxlanV4TunnelDestinationIPMode. + // VxlanV4TunnelDestinationIPModeUnicast is description is TBD + SetUnicast(value VxlanV4TunnelDestinationIPModeUnicast) VxlanV4TunnelDestinationIPMode + // HasUnicast checks if Unicast has been set in VxlanV4TunnelDestinationIPMode + HasUnicast() bool + // Multicast returns VxlanV4TunnelDestinationIPModeMulticast, set in VxlanV4TunnelDestinationIPMode. + // VxlanV4TunnelDestinationIPModeMulticast is multicast Group address for member VNI(VXLAN Network Identifier) + Multicast() VxlanV4TunnelDestinationIPModeMulticast + // SetMulticast assigns VxlanV4TunnelDestinationIPModeMulticast provided by user to VxlanV4TunnelDestinationIPMode. + // VxlanV4TunnelDestinationIPModeMulticast is multicast Group address for member VNI(VXLAN Network Identifier) + SetMulticast(value VxlanV4TunnelDestinationIPModeMulticast) VxlanV4TunnelDestinationIPMode + // HasMulticast checks if Multicast has been set in VxlanV4TunnelDestinationIPMode + HasMulticast() bool + setNil() +} + +type VxlanV4TunnelDestinationIPModeChoiceEnum string + +// Enum of Choice on VxlanV4TunnelDestinationIPMode +var VxlanV4TunnelDestinationIPModeChoice = struct { + UNICAST VxlanV4TunnelDestinationIPModeChoiceEnum + MULTICAST VxlanV4TunnelDestinationIPModeChoiceEnum +}{ + UNICAST: VxlanV4TunnelDestinationIPModeChoiceEnum("unicast"), + MULTICAST: VxlanV4TunnelDestinationIPModeChoiceEnum("multicast"), +} + +func (obj *vxlanV4TunnelDestinationIPMode) Choice() VxlanV4TunnelDestinationIPModeChoiceEnum { + return VxlanV4TunnelDestinationIPModeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// unicast or multicast +// Choice returns a string +func (obj *vxlanV4TunnelDestinationIPMode) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *vxlanV4TunnelDestinationIPMode) setChoice(value VxlanV4TunnelDestinationIPModeChoiceEnum) VxlanV4TunnelDestinationIPMode { + intValue, ok := otg.VxlanV4TunnelDestinationIPMode_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on VxlanV4TunnelDestinationIPModeChoiceEnum", string(value))) + return obj + } + enumValue := otg.VxlanV4TunnelDestinationIPMode_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Multicast = nil + obj.multicastHolder = nil + obj.obj.Unicast = nil + obj.unicastHolder = nil + + if value == VxlanV4TunnelDestinationIPModeChoice.UNICAST { + obj.obj.Unicast = NewVxlanV4TunnelDestinationIPModeUnicast().msg() + } + + if value == VxlanV4TunnelDestinationIPModeChoice.MULTICAST { + obj.obj.Multicast = NewVxlanV4TunnelDestinationIPModeMulticast().msg() + } + + return obj +} + +// description is TBD +// Unicast returns a VxlanV4TunnelDestinationIPModeUnicast +func (obj *vxlanV4TunnelDestinationIPMode) Unicast() VxlanV4TunnelDestinationIPModeUnicast { + if obj.obj.Unicast == nil { + obj.setChoice(VxlanV4TunnelDestinationIPModeChoice.UNICAST) + } + if obj.unicastHolder == nil { + obj.unicastHolder = &vxlanV4TunnelDestinationIPModeUnicast{obj: obj.obj.Unicast} + } + return obj.unicastHolder +} + +// description is TBD +// Unicast returns a VxlanV4TunnelDestinationIPModeUnicast +func (obj *vxlanV4TunnelDestinationIPMode) HasUnicast() bool { + return obj.obj.Unicast != nil +} + +// description is TBD +// SetUnicast sets the VxlanV4TunnelDestinationIPModeUnicast value in the VxlanV4TunnelDestinationIPMode object +func (obj *vxlanV4TunnelDestinationIPMode) SetUnicast(value VxlanV4TunnelDestinationIPModeUnicast) VxlanV4TunnelDestinationIPMode { + obj.setChoice(VxlanV4TunnelDestinationIPModeChoice.UNICAST) + obj.unicastHolder = nil + obj.obj.Unicast = value.msg() + + return obj +} + +// description is TBD +// Multicast returns a VxlanV4TunnelDestinationIPModeMulticast +func (obj *vxlanV4TunnelDestinationIPMode) Multicast() VxlanV4TunnelDestinationIPModeMulticast { + if obj.obj.Multicast == nil { + obj.setChoice(VxlanV4TunnelDestinationIPModeChoice.MULTICAST) + } + if obj.multicastHolder == nil { + obj.multicastHolder = &vxlanV4TunnelDestinationIPModeMulticast{obj: obj.obj.Multicast} + } + return obj.multicastHolder +} + +// description is TBD +// Multicast returns a VxlanV4TunnelDestinationIPModeMulticast +func (obj *vxlanV4TunnelDestinationIPMode) HasMulticast() bool { + return obj.obj.Multicast != nil +} + +// description is TBD +// SetMulticast sets the VxlanV4TunnelDestinationIPModeMulticast value in the VxlanV4TunnelDestinationIPMode object +func (obj *vxlanV4TunnelDestinationIPMode) SetMulticast(value VxlanV4TunnelDestinationIPModeMulticast) VxlanV4TunnelDestinationIPMode { + obj.setChoice(VxlanV4TunnelDestinationIPModeChoice.MULTICAST) + obj.multicastHolder = nil + obj.obj.Multicast = value.msg() + + return obj +} + +func (obj *vxlanV4TunnelDestinationIPMode) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Unicast != nil { + + obj.Unicast().validateObj(vObj, set_default) + } + + if obj.obj.Multicast != nil { + + obj.Multicast().validateObj(vObj, set_default) + } + +} + +func (obj *vxlanV4TunnelDestinationIPMode) setDefault() { + var choices_set int = 0 + var choice VxlanV4TunnelDestinationIPModeChoiceEnum + + if obj.obj.Unicast != nil { + choices_set += 1 + choice = VxlanV4TunnelDestinationIPModeChoice.UNICAST + } + + if obj.obj.Multicast != nil { + choices_set += 1 + choice = VxlanV4TunnelDestinationIPModeChoice.MULTICAST + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(VxlanV4TunnelDestinationIPModeChoice.MULTICAST) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in VxlanV4TunnelDestinationIPMode") + } + } else { + intVal := otg.VxlanV4TunnelDestinationIPMode_Choice_Enum_value[string(choice)] + enumValue := otg.VxlanV4TunnelDestinationIPMode_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/vxlan_v4_tunnel_destination_ip_mode_multicast.go b/gosnappi/vxlan_v4_tunnel_destination_ip_mode_multicast.go new file mode 100644 index 00000000..f69ad643 --- /dev/null +++ b/gosnappi/vxlan_v4_tunnel_destination_ip_mode_multicast.go @@ -0,0 +1,315 @@ +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" +) + +// ***** VxlanV4TunnelDestinationIPModeMulticast ***** +type vxlanV4TunnelDestinationIPModeMulticast struct { + validation + obj *otg.VxlanV4TunnelDestinationIPModeMulticast + marshaller marshalVxlanV4TunnelDestinationIPModeMulticast + unMarshaller unMarshalVxlanV4TunnelDestinationIPModeMulticast +} + +func NewVxlanV4TunnelDestinationIPModeMulticast() VxlanV4TunnelDestinationIPModeMulticast { + obj := vxlanV4TunnelDestinationIPModeMulticast{obj: &otg.VxlanV4TunnelDestinationIPModeMulticast{}} + obj.setDefault() + return &obj +} + +func (obj *vxlanV4TunnelDestinationIPModeMulticast) msg() *otg.VxlanV4TunnelDestinationIPModeMulticast { + return obj.obj +} + +func (obj *vxlanV4TunnelDestinationIPModeMulticast) setMsg(msg *otg.VxlanV4TunnelDestinationIPModeMulticast) VxlanV4TunnelDestinationIPModeMulticast { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalvxlanV4TunnelDestinationIPModeMulticast struct { + obj *vxlanV4TunnelDestinationIPModeMulticast +} + +type marshalVxlanV4TunnelDestinationIPModeMulticast interface { + // ToProto marshals VxlanV4TunnelDestinationIPModeMulticast to protobuf object *otg.VxlanV4TunnelDestinationIPModeMulticast + ToProto() (*otg.VxlanV4TunnelDestinationIPModeMulticast, error) + // ToPbText marshals VxlanV4TunnelDestinationIPModeMulticast to protobuf text + ToPbText() (string, error) + // ToYaml marshals VxlanV4TunnelDestinationIPModeMulticast to YAML text + ToYaml() (string, error) + // ToJson marshals VxlanV4TunnelDestinationIPModeMulticast to JSON text + ToJson() (string, error) +} + +type unMarshalvxlanV4TunnelDestinationIPModeMulticast struct { + obj *vxlanV4TunnelDestinationIPModeMulticast +} + +type unMarshalVxlanV4TunnelDestinationIPModeMulticast interface { + // FromProto unmarshals VxlanV4TunnelDestinationIPModeMulticast from protobuf object *otg.VxlanV4TunnelDestinationIPModeMulticast + FromProto(msg *otg.VxlanV4TunnelDestinationIPModeMulticast) (VxlanV4TunnelDestinationIPModeMulticast, error) + // FromPbText unmarshals VxlanV4TunnelDestinationIPModeMulticast from protobuf text + FromPbText(value string) error + // FromYaml unmarshals VxlanV4TunnelDestinationIPModeMulticast from YAML text + FromYaml(value string) error + // FromJson unmarshals VxlanV4TunnelDestinationIPModeMulticast from JSON text + FromJson(value string) error +} + +func (obj *vxlanV4TunnelDestinationIPModeMulticast) Marshal() marshalVxlanV4TunnelDestinationIPModeMulticast { + if obj.marshaller == nil { + obj.marshaller = &marshalvxlanV4TunnelDestinationIPModeMulticast{obj: obj} + } + return obj.marshaller +} + +func (obj *vxlanV4TunnelDestinationIPModeMulticast) Unmarshal() unMarshalVxlanV4TunnelDestinationIPModeMulticast { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalvxlanV4TunnelDestinationIPModeMulticast{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalvxlanV4TunnelDestinationIPModeMulticast) ToProto() (*otg.VxlanV4TunnelDestinationIPModeMulticast, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalvxlanV4TunnelDestinationIPModeMulticast) FromProto(msg *otg.VxlanV4TunnelDestinationIPModeMulticast) (VxlanV4TunnelDestinationIPModeMulticast, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalvxlanV4TunnelDestinationIPModeMulticast) 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 *unMarshalvxlanV4TunnelDestinationIPModeMulticast) 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 *marshalvxlanV4TunnelDestinationIPModeMulticast) 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 *unMarshalvxlanV4TunnelDestinationIPModeMulticast) 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 *marshalvxlanV4TunnelDestinationIPModeMulticast) 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 *unMarshalvxlanV4TunnelDestinationIPModeMulticast) 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 *vxlanV4TunnelDestinationIPModeMulticast) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *vxlanV4TunnelDestinationIPModeMulticast) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *vxlanV4TunnelDestinationIPModeMulticast) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *vxlanV4TunnelDestinationIPModeMulticast) Clone() (VxlanV4TunnelDestinationIPModeMulticast, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewVxlanV4TunnelDestinationIPModeMulticast() + 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 +} + +// VxlanV4TunnelDestinationIPModeMulticast is multicast Group address for member VNI(VXLAN Network Identifier) +type VxlanV4TunnelDestinationIPModeMulticast interface { + Validation + // msg marshals VxlanV4TunnelDestinationIPModeMulticast to protobuf object *otg.VxlanV4TunnelDestinationIPModeMulticast + // and doesn't set defaults + msg() *otg.VxlanV4TunnelDestinationIPModeMulticast + // setMsg unmarshals VxlanV4TunnelDestinationIPModeMulticast from protobuf object *otg.VxlanV4TunnelDestinationIPModeMulticast + // and doesn't set defaults + setMsg(*otg.VxlanV4TunnelDestinationIPModeMulticast) VxlanV4TunnelDestinationIPModeMulticast + // provides marshal interface + Marshal() marshalVxlanV4TunnelDestinationIPModeMulticast + // provides unmarshal interface + Unmarshal() unMarshalVxlanV4TunnelDestinationIPModeMulticast + // validate validates VxlanV4TunnelDestinationIPModeMulticast + validate() error + // A stringer function + String() string + // Clones the object + Clone() (VxlanV4TunnelDestinationIPModeMulticast, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Address returns string, set in VxlanV4TunnelDestinationIPModeMulticast. + Address() string + // SetAddress assigns string provided by user to VxlanV4TunnelDestinationIPModeMulticast + SetAddress(value string) VxlanV4TunnelDestinationIPModeMulticast + // HasAddress checks if Address has been set in VxlanV4TunnelDestinationIPModeMulticast + HasAddress() bool +} + +// IPv4 Multicast address +// Address returns a string +func (obj *vxlanV4TunnelDestinationIPModeMulticast) Address() string { + + return *obj.obj.Address + +} + +// IPv4 Multicast address +// Address returns a string +func (obj *vxlanV4TunnelDestinationIPModeMulticast) HasAddress() bool { + return obj.obj.Address != nil +} + +// IPv4 Multicast address +// SetAddress sets the string value in the VxlanV4TunnelDestinationIPModeMulticast object +func (obj *vxlanV4TunnelDestinationIPModeMulticast) SetAddress(value string) VxlanV4TunnelDestinationIPModeMulticast { + + obj.obj.Address = &value + return obj +} + +func (obj *vxlanV4TunnelDestinationIPModeMulticast) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Address != nil { + + err := obj.validateIpv4(obj.Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on VxlanV4TunnelDestinationIPModeMulticast.Address")) + } + + } + +} + +func (obj *vxlanV4TunnelDestinationIPModeMulticast) setDefault() { + +} diff --git a/gosnappi/vxlan_v4_tunnel_destination_ip_mode_unicast.go b/gosnappi/vxlan_v4_tunnel_destination_ip_mode_unicast.go new file mode 100644 index 00000000..5495818d --- /dev/null +++ b/gosnappi/vxlan_v4_tunnel_destination_ip_mode_unicast.go @@ -0,0 +1,390 @@ +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" +) + +// ***** VxlanV4TunnelDestinationIPModeUnicast ***** +type vxlanV4TunnelDestinationIPModeUnicast struct { + validation + obj *otg.VxlanV4TunnelDestinationIPModeUnicast + marshaller marshalVxlanV4TunnelDestinationIPModeUnicast + unMarshaller unMarshalVxlanV4TunnelDestinationIPModeUnicast + vtepsHolder VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter +} + +func NewVxlanV4TunnelDestinationIPModeUnicast() VxlanV4TunnelDestinationIPModeUnicast { + obj := vxlanV4TunnelDestinationIPModeUnicast{obj: &otg.VxlanV4TunnelDestinationIPModeUnicast{}} + obj.setDefault() + return &obj +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicast) msg() *otg.VxlanV4TunnelDestinationIPModeUnicast { + return obj.obj +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicast) setMsg(msg *otg.VxlanV4TunnelDestinationIPModeUnicast) VxlanV4TunnelDestinationIPModeUnicast { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalvxlanV4TunnelDestinationIPModeUnicast struct { + obj *vxlanV4TunnelDestinationIPModeUnicast +} + +type marshalVxlanV4TunnelDestinationIPModeUnicast interface { + // ToProto marshals VxlanV4TunnelDestinationIPModeUnicast to protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicast + ToProto() (*otg.VxlanV4TunnelDestinationIPModeUnicast, error) + // ToPbText marshals VxlanV4TunnelDestinationIPModeUnicast to protobuf text + ToPbText() (string, error) + // ToYaml marshals VxlanV4TunnelDestinationIPModeUnicast to YAML text + ToYaml() (string, error) + // ToJson marshals VxlanV4TunnelDestinationIPModeUnicast to JSON text + ToJson() (string, error) +} + +type unMarshalvxlanV4TunnelDestinationIPModeUnicast struct { + obj *vxlanV4TunnelDestinationIPModeUnicast +} + +type unMarshalVxlanV4TunnelDestinationIPModeUnicast interface { + // FromProto unmarshals VxlanV4TunnelDestinationIPModeUnicast from protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicast + FromProto(msg *otg.VxlanV4TunnelDestinationIPModeUnicast) (VxlanV4TunnelDestinationIPModeUnicast, error) + // FromPbText unmarshals VxlanV4TunnelDestinationIPModeUnicast from protobuf text + FromPbText(value string) error + // FromYaml unmarshals VxlanV4TunnelDestinationIPModeUnicast from YAML text + FromYaml(value string) error + // FromJson unmarshals VxlanV4TunnelDestinationIPModeUnicast from JSON text + FromJson(value string) error +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicast) Marshal() marshalVxlanV4TunnelDestinationIPModeUnicast { + if obj.marshaller == nil { + obj.marshaller = &marshalvxlanV4TunnelDestinationIPModeUnicast{obj: obj} + } + return obj.marshaller +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicast) Unmarshal() unMarshalVxlanV4TunnelDestinationIPModeUnicast { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalvxlanV4TunnelDestinationIPModeUnicast{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalvxlanV4TunnelDestinationIPModeUnicast) ToProto() (*otg.VxlanV4TunnelDestinationIPModeUnicast, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalvxlanV4TunnelDestinationIPModeUnicast) FromProto(msg *otg.VxlanV4TunnelDestinationIPModeUnicast) (VxlanV4TunnelDestinationIPModeUnicast, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalvxlanV4TunnelDestinationIPModeUnicast) 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 *unMarshalvxlanV4TunnelDestinationIPModeUnicast) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalvxlanV4TunnelDestinationIPModeUnicast) 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 *unMarshalvxlanV4TunnelDestinationIPModeUnicast) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalvxlanV4TunnelDestinationIPModeUnicast) 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 *unMarshalvxlanV4TunnelDestinationIPModeUnicast) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicast) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicast) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicast) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicast) Clone() (VxlanV4TunnelDestinationIPModeUnicast, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewVxlanV4TunnelDestinationIPModeUnicast() + 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 +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicast) setNil() { + obj.vtepsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// VxlanV4TunnelDestinationIPModeUnicast is description is TBD +type VxlanV4TunnelDestinationIPModeUnicast interface { + Validation + // msg marshals VxlanV4TunnelDestinationIPModeUnicast to protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicast + // and doesn't set defaults + msg() *otg.VxlanV4TunnelDestinationIPModeUnicast + // setMsg unmarshals VxlanV4TunnelDestinationIPModeUnicast from protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicast + // and doesn't set defaults + setMsg(*otg.VxlanV4TunnelDestinationIPModeUnicast) VxlanV4TunnelDestinationIPModeUnicast + // provides marshal interface + Marshal() marshalVxlanV4TunnelDestinationIPModeUnicast + // provides unmarshal interface + Unmarshal() unMarshalVxlanV4TunnelDestinationIPModeUnicast + // validate validates VxlanV4TunnelDestinationIPModeUnicast + validate() error + // A stringer function + String() string + // Clones the object + Clone() (VxlanV4TunnelDestinationIPModeUnicast, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Vteps returns VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIterIter, set in VxlanV4TunnelDestinationIPModeUnicast + Vteps() VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter + setNil() +} + +// List of VTEPs for member VNI(VXLAN Network Identifier) +// Vteps returns a []VxlanV4TunnelDestinationIPModeUnicastVtep +func (obj *vxlanV4TunnelDestinationIPModeUnicast) Vteps() VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { + if len(obj.obj.Vteps) == 0 { + obj.obj.Vteps = []*otg.VxlanV4TunnelDestinationIPModeUnicastVtep{} + } + if obj.vtepsHolder == nil { + obj.vtepsHolder = newVxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter(&obj.obj.Vteps).setMsg(obj) + } + return obj.vtepsHolder +} + +type vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter struct { + obj *vxlanV4TunnelDestinationIPModeUnicast + vxlanV4TunnelDestinationIPModeUnicastVtepSlice []VxlanV4TunnelDestinationIPModeUnicastVtep + fieldPtr *[]*otg.VxlanV4TunnelDestinationIPModeUnicastVtep +} + +func newVxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter(ptr *[]*otg.VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { + return &vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter{fieldPtr: ptr} +} + +type VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter interface { + setMsg(*vxlanV4TunnelDestinationIPModeUnicast) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter + Items() []VxlanV4TunnelDestinationIPModeUnicastVtep + Add() VxlanV4TunnelDestinationIPModeUnicastVtep + Append(items ...VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter + Set(index int, newObj VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter + Clear() VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter + clearHolderSlice() VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter + appendHolderSlice(item VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) setMsg(msg *vxlanV4TunnelDestinationIPModeUnicast) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&vxlanV4TunnelDestinationIPModeUnicastVtep{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) Items() []VxlanV4TunnelDestinationIPModeUnicastVtep { + return obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) Add() VxlanV4TunnelDestinationIPModeUnicastVtep { + newObj := &otg.VxlanV4TunnelDestinationIPModeUnicastVtep{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &vxlanV4TunnelDestinationIPModeUnicastVtep{obj: newObj} + newLibObj.setDefault() + obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice = append(obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice, newLibObj) + return newLibObj +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) Append(items ...VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice = append(obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice, item) + } + return obj +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) Set(index int, newObj VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice[index] = newObj + return obj +} +func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) Clear() VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.VxlanV4TunnelDestinationIPModeUnicastVtep{} + obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice = []VxlanV4TunnelDestinationIPModeUnicastVtep{} + } + return obj +} +func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) clearHolderSlice() VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { + if len(obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice) > 0 { + obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice = []VxlanV4TunnelDestinationIPModeUnicastVtep{} + } + return obj +} +func (obj *vxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter) appendHolderSlice(item VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVxlanV4TunnelDestinationIPModeUnicastVtepIter { + obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice = append(obj.vxlanV4TunnelDestinationIPModeUnicastVtepSlice, item) + return obj +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicast) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Vteps) != 0 { + + if set_default { + obj.Vteps().clearHolderSlice() + for _, item := range obj.obj.Vteps { + obj.Vteps().appendHolderSlice(&vxlanV4TunnelDestinationIPModeUnicastVtep{obj: item}) + } + } + for _, item := range obj.Vteps().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicast) setDefault() { + +} diff --git a/gosnappi/vxlan_v4_tunnel_destination_ip_mode_unicast_vtep.go b/gosnappi/vxlan_v4_tunnel_destination_ip_mode_unicast_vtep.go new file mode 100644 index 00000000..53f0be11 --- /dev/null +++ b/gosnappi/vxlan_v4_tunnel_destination_ip_mode_unicast_vtep.go @@ -0,0 +1,427 @@ +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" +) + +// ***** VxlanV4TunnelDestinationIPModeUnicastVtep ***** +type vxlanV4TunnelDestinationIPModeUnicastVtep struct { + validation + obj *otg.VxlanV4TunnelDestinationIPModeUnicastVtep + marshaller marshalVxlanV4TunnelDestinationIPModeUnicastVtep + unMarshaller unMarshalVxlanV4TunnelDestinationIPModeUnicastVtep + arpSuppressionCacheHolder VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter +} + +func NewVxlanV4TunnelDestinationIPModeUnicastVtep() VxlanV4TunnelDestinationIPModeUnicastVtep { + obj := vxlanV4TunnelDestinationIPModeUnicastVtep{obj: &otg.VxlanV4TunnelDestinationIPModeUnicastVtep{}} + obj.setDefault() + return &obj +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) msg() *otg.VxlanV4TunnelDestinationIPModeUnicastVtep { + return obj.obj +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) setMsg(msg *otg.VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVtep { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalvxlanV4TunnelDestinationIPModeUnicastVtep struct { + obj *vxlanV4TunnelDestinationIPModeUnicastVtep +} + +type marshalVxlanV4TunnelDestinationIPModeUnicastVtep interface { + // ToProto marshals VxlanV4TunnelDestinationIPModeUnicastVtep to protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicastVtep + ToProto() (*otg.VxlanV4TunnelDestinationIPModeUnicastVtep, error) + // ToPbText marshals VxlanV4TunnelDestinationIPModeUnicastVtep to protobuf text + ToPbText() (string, error) + // ToYaml marshals VxlanV4TunnelDestinationIPModeUnicastVtep to YAML text + ToYaml() (string, error) + // ToJson marshals VxlanV4TunnelDestinationIPModeUnicastVtep to JSON text + ToJson() (string, error) +} + +type unMarshalvxlanV4TunnelDestinationIPModeUnicastVtep struct { + obj *vxlanV4TunnelDestinationIPModeUnicastVtep +} + +type unMarshalVxlanV4TunnelDestinationIPModeUnicastVtep interface { + // FromProto unmarshals VxlanV4TunnelDestinationIPModeUnicastVtep from protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicastVtep + FromProto(msg *otg.VxlanV4TunnelDestinationIPModeUnicastVtep) (VxlanV4TunnelDestinationIPModeUnicastVtep, error) + // FromPbText unmarshals VxlanV4TunnelDestinationIPModeUnicastVtep from protobuf text + FromPbText(value string) error + // FromYaml unmarshals VxlanV4TunnelDestinationIPModeUnicastVtep from YAML text + FromYaml(value string) error + // FromJson unmarshals VxlanV4TunnelDestinationIPModeUnicastVtep from JSON text + FromJson(value string) error +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) Marshal() marshalVxlanV4TunnelDestinationIPModeUnicastVtep { + if obj.marshaller == nil { + obj.marshaller = &marshalvxlanV4TunnelDestinationIPModeUnicastVtep{obj: obj} + } + return obj.marshaller +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) Unmarshal() unMarshalVxlanV4TunnelDestinationIPModeUnicastVtep { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalvxlanV4TunnelDestinationIPModeUnicastVtep{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalvxlanV4TunnelDestinationIPModeUnicastVtep) ToProto() (*otg.VxlanV4TunnelDestinationIPModeUnicastVtep, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalvxlanV4TunnelDestinationIPModeUnicastVtep) FromProto(msg *otg.VxlanV4TunnelDestinationIPModeUnicastVtep) (VxlanV4TunnelDestinationIPModeUnicastVtep, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalvxlanV4TunnelDestinationIPModeUnicastVtep) 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 *unMarshalvxlanV4TunnelDestinationIPModeUnicastVtep) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalvxlanV4TunnelDestinationIPModeUnicastVtep) 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 *unMarshalvxlanV4TunnelDestinationIPModeUnicastVtep) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalvxlanV4TunnelDestinationIPModeUnicastVtep) 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 *unMarshalvxlanV4TunnelDestinationIPModeUnicastVtep) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) Clone() (VxlanV4TunnelDestinationIPModeUnicastVtep, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewVxlanV4TunnelDestinationIPModeUnicastVtep() + 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 +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) setNil() { + obj.arpSuppressionCacheHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// VxlanV4TunnelDestinationIPModeUnicastVtep is vTEP (VXLAN Tunnel End Point (VTEP)) parameters +type VxlanV4TunnelDestinationIPModeUnicastVtep interface { + Validation + // msg marshals VxlanV4TunnelDestinationIPModeUnicastVtep to protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicastVtep + // and doesn't set defaults + msg() *otg.VxlanV4TunnelDestinationIPModeUnicastVtep + // setMsg unmarshals VxlanV4TunnelDestinationIPModeUnicastVtep from protobuf object *otg.VxlanV4TunnelDestinationIPModeUnicastVtep + // and doesn't set defaults + setMsg(*otg.VxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVtep + // provides marshal interface + Marshal() marshalVxlanV4TunnelDestinationIPModeUnicastVtep + // provides unmarshal interface + Unmarshal() unMarshalVxlanV4TunnelDestinationIPModeUnicastVtep + // validate validates VxlanV4TunnelDestinationIPModeUnicastVtep + validate() error + // A stringer function + String() string + // Clones the object + Clone() (VxlanV4TunnelDestinationIPModeUnicastVtep, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RemoteVtepAddress returns string, set in VxlanV4TunnelDestinationIPModeUnicastVtep. + RemoteVtepAddress() string + // SetRemoteVtepAddress assigns string provided by user to VxlanV4TunnelDestinationIPModeUnicastVtep + SetRemoteVtepAddress(value string) VxlanV4TunnelDestinationIPModeUnicastVtep + // HasRemoteVtepAddress checks if RemoteVtepAddress has been set in VxlanV4TunnelDestinationIPModeUnicastVtep + HasRemoteVtepAddress() bool + // ArpSuppressionCache returns VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIterIter, set in VxlanV4TunnelDestinationIPModeUnicastVtep + ArpSuppressionCache() VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter + setNil() +} + +// Remote VXLAN Tunnel End Point address +// RemoteVtepAddress returns a string +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) RemoteVtepAddress() string { + + return *obj.obj.RemoteVtepAddress + +} + +// Remote VXLAN Tunnel End Point address +// RemoteVtepAddress returns a string +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) HasRemoteVtepAddress() bool { + return obj.obj.RemoteVtepAddress != nil +} + +// Remote VXLAN Tunnel End Point address +// SetRemoteVtepAddress sets the string value in the VxlanV4TunnelDestinationIPModeUnicastVtep object +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) SetRemoteVtepAddress(value string) VxlanV4TunnelDestinationIPModeUnicastVtep { + + obj.obj.RemoteVtepAddress = &value + return obj +} + +// Each VTEP maintains an ARP suppression cache table for known IP hosts and their associated MAC addresses in the VNI segment. When an end host in the VNI sends an ARP request for another end-host IP address, its local VTEP intercepts the ARP request and checks for the ARP-resolved IP address in its ARP suppression cache table. If it finds a match, the local VTEP sends an ARP response on behalf of the remote end host. +// ArpSuppressionCache returns a []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) ArpSuppressionCache() VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + if len(obj.obj.ArpSuppressionCache) == 0 { + obj.obj.ArpSuppressionCache = []*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} + } + if obj.arpSuppressionCacheHolder == nil { + obj.arpSuppressionCacheHolder = newVxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter(&obj.obj.ArpSuppressionCache).setMsg(obj) + } + return obj.arpSuppressionCacheHolder +} + +type vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter struct { + obj *vxlanV4TunnelDestinationIPModeUnicastVtep + vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + fieldPtr *[]*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache +} + +func newVxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter(ptr *[]*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + return &vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter{fieldPtr: ptr} +} + +type VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter interface { + setMsg(*vxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter + Items() []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + Add() VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + Append(items ...VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter + Set(index int, newObj VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter + Clear() VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter + clearHolderSlice() VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter + appendHolderSlice(item VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) setMsg(msg *vxlanV4TunnelDestinationIPModeUnicastVtep) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&vxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Items() []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { + return obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Add() VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { + newObj := &otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &vxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: newObj} + newLibObj.setDefault() + obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = append(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice, newLibObj) + return newLibObj +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Append(items ...VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = append(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice, item) + } + return obj +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Set(index int, newObj VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice[index] = newObj + return obj +} +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Clear() VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} + obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} + } + return obj +} +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) clearHolderSlice() VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + if len(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice) > 0 { + obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} + } + return obj +} +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) appendHolderSlice(item VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV4TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = append(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice, item) + return obj +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RemoteVtepAddress != nil { + + err := obj.validateIpv4(obj.RemoteVtepAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on VxlanV4TunnelDestinationIPModeUnicastVtep.RemoteVtepAddress")) + } + + } + + if len(obj.obj.ArpSuppressionCache) != 0 { + + if set_default { + obj.ArpSuppressionCache().clearHolderSlice() + for _, item := range obj.obj.ArpSuppressionCache { + obj.ArpSuppressionCache().appendHolderSlice(&vxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: item}) + } + } + for _, item := range obj.ArpSuppressionCache().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *vxlanV4TunnelDestinationIPModeUnicastVtep) setDefault() { + +} diff --git a/gosnappi/vxlan_v6_tunnel.go b/gosnappi/vxlan_v6_tunnel.go new file mode 100644 index 00000000..b1516190 --- /dev/null +++ b/gosnappi/vxlan_v6_tunnel.go @@ -0,0 +1,431 @@ +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" +) + +// ***** VxlanV6Tunnel ***** +type vxlanV6Tunnel struct { + validation + obj *otg.VxlanV6Tunnel + marshaller marshalVxlanV6Tunnel + unMarshaller unMarshalVxlanV6Tunnel + destinationIpModeHolder VxlanV6TunnelDestinationIPMode +} + +func NewVxlanV6Tunnel() VxlanV6Tunnel { + obj := vxlanV6Tunnel{obj: &otg.VxlanV6Tunnel{}} + obj.setDefault() + return &obj +} + +func (obj *vxlanV6Tunnel) msg() *otg.VxlanV6Tunnel { + return obj.obj +} + +func (obj *vxlanV6Tunnel) setMsg(msg *otg.VxlanV6Tunnel) VxlanV6Tunnel { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalvxlanV6Tunnel struct { + obj *vxlanV6Tunnel +} + +type marshalVxlanV6Tunnel interface { + // ToProto marshals VxlanV6Tunnel to protobuf object *otg.VxlanV6Tunnel + ToProto() (*otg.VxlanV6Tunnel, error) + // ToPbText marshals VxlanV6Tunnel to protobuf text + ToPbText() (string, error) + // ToYaml marshals VxlanV6Tunnel to YAML text + ToYaml() (string, error) + // ToJson marshals VxlanV6Tunnel to JSON text + ToJson() (string, error) +} + +type unMarshalvxlanV6Tunnel struct { + obj *vxlanV6Tunnel +} + +type unMarshalVxlanV6Tunnel interface { + // FromProto unmarshals VxlanV6Tunnel from protobuf object *otg.VxlanV6Tunnel + FromProto(msg *otg.VxlanV6Tunnel) (VxlanV6Tunnel, error) + // FromPbText unmarshals VxlanV6Tunnel from protobuf text + FromPbText(value string) error + // FromYaml unmarshals VxlanV6Tunnel from YAML text + FromYaml(value string) error + // FromJson unmarshals VxlanV6Tunnel from JSON text + FromJson(value string) error +} + +func (obj *vxlanV6Tunnel) Marshal() marshalVxlanV6Tunnel { + if obj.marshaller == nil { + obj.marshaller = &marshalvxlanV6Tunnel{obj: obj} + } + return obj.marshaller +} + +func (obj *vxlanV6Tunnel) Unmarshal() unMarshalVxlanV6Tunnel { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalvxlanV6Tunnel{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalvxlanV6Tunnel) ToProto() (*otg.VxlanV6Tunnel, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalvxlanV6Tunnel) FromProto(msg *otg.VxlanV6Tunnel) (VxlanV6Tunnel, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalvxlanV6Tunnel) 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 *unMarshalvxlanV6Tunnel) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalvxlanV6Tunnel) 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 *unMarshalvxlanV6Tunnel) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalvxlanV6Tunnel) 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 *unMarshalvxlanV6Tunnel) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *vxlanV6Tunnel) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *vxlanV6Tunnel) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *vxlanV6Tunnel) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *vxlanV6Tunnel) Clone() (VxlanV6Tunnel, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewVxlanV6Tunnel() + 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 +} + +func (obj *vxlanV6Tunnel) setNil() { + obj.destinationIpModeHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// VxlanV6Tunnel is configuration and operational state parameters relating to IPv6 VXLAN tunnel end-point interface. +type VxlanV6Tunnel interface { + Validation + // msg marshals VxlanV6Tunnel to protobuf object *otg.VxlanV6Tunnel + // and doesn't set defaults + msg() *otg.VxlanV6Tunnel + // setMsg unmarshals VxlanV6Tunnel from protobuf object *otg.VxlanV6Tunnel + // and doesn't set defaults + setMsg(*otg.VxlanV6Tunnel) VxlanV6Tunnel + // provides marshal interface + Marshal() marshalVxlanV6Tunnel + // provides unmarshal interface + Unmarshal() unMarshalVxlanV6Tunnel + // validate validates VxlanV6Tunnel + validate() error + // A stringer function + String() string + // Clones the object + Clone() (VxlanV6Tunnel, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // SourceInterface returns string, set in VxlanV6Tunnel. + SourceInterface() string + // SetSourceInterface assigns string provided by user to VxlanV6Tunnel + SetSourceInterface(value string) VxlanV6Tunnel + // DestinationIpMode returns VxlanV6TunnelDestinationIPMode, set in VxlanV6Tunnel. + // VxlanV6TunnelDestinationIPMode is communication mode between the VTEPs, either unicast or multicast. + DestinationIpMode() VxlanV6TunnelDestinationIPMode + // SetDestinationIpMode assigns VxlanV6TunnelDestinationIPMode provided by user to VxlanV6Tunnel. + // VxlanV6TunnelDestinationIPMode is communication mode between the VTEPs, either unicast or multicast. + SetDestinationIpMode(value VxlanV6TunnelDestinationIPMode) VxlanV6Tunnel + // HasDestinationIpMode checks if DestinationIpMode has been set in VxlanV6Tunnel + HasDestinationIpMode() bool + // Vni returns uint32, set in VxlanV6Tunnel. + Vni() uint32 + // SetVni assigns uint32 provided by user to VxlanV6Tunnel + SetVni(value uint32) VxlanV6Tunnel + // Name returns string, set in VxlanV6Tunnel. + Name() string + // SetName assigns string provided by user to VxlanV6Tunnel + SetName(value string) VxlanV6Tunnel + setNil() +} + +// Determines the source interface. +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Device.Ipv6Loopback/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Device.Ipv6Loopback/properties/name +// +// SourceInterface returns a string +func (obj *vxlanV6Tunnel) SourceInterface() string { + + return *obj.obj.SourceInterface + +} + +// Determines the source interface. +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Device.Ipv6Loopback/properties/name +// +// x-constraint: +// - /components/schemas/Device.Ipv6/properties/name +// - /components/schemas/Device.Ipv6Loopback/properties/name +// +// SetSourceInterface sets the string value in the VxlanV6Tunnel object +func (obj *vxlanV6Tunnel) SetSourceInterface(value string) VxlanV6Tunnel { + + obj.obj.SourceInterface = &value + return obj +} + +// description is TBD +// DestinationIpMode returns a VxlanV6TunnelDestinationIPMode +func (obj *vxlanV6Tunnel) DestinationIpMode() VxlanV6TunnelDestinationIPMode { + if obj.obj.DestinationIpMode == nil { + obj.obj.DestinationIpMode = NewVxlanV6TunnelDestinationIPMode().msg() + } + if obj.destinationIpModeHolder == nil { + obj.destinationIpModeHolder = &vxlanV6TunnelDestinationIPMode{obj: obj.obj.DestinationIpMode} + } + return obj.destinationIpModeHolder +} + +// description is TBD +// DestinationIpMode returns a VxlanV6TunnelDestinationIPMode +func (obj *vxlanV6Tunnel) HasDestinationIpMode() bool { + return obj.obj.DestinationIpMode != nil +} + +// description is TBD +// SetDestinationIpMode sets the VxlanV6TunnelDestinationIPMode value in the VxlanV6Tunnel object +func (obj *vxlanV6Tunnel) SetDestinationIpMode(value VxlanV6TunnelDestinationIPMode) VxlanV6Tunnel { + + obj.destinationIpModeHolder = nil + obj.obj.DestinationIpMode = value.msg() + + return obj +} + +// VXLAN Network Identifier (VNI) to distinguish network instances on the wire +// Vni returns a uint32 +func (obj *vxlanV6Tunnel) Vni() uint32 { + + return *obj.obj.Vni + +} + +// VXLAN Network Identifier (VNI) to distinguish network instances on the wire +// SetVni sets the uint32 value in the VxlanV6Tunnel object +func (obj *vxlanV6Tunnel) SetVni(value uint32) VxlanV6Tunnel { + + obj.obj.Vni = &value + return obj +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Name returns a string +func (obj *vxlanV6Tunnel) Name() string { + + return *obj.obj.Name + +} + +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// Globally unique name of an object. It also serves as the primary key for arrays of objects. +// SetName sets the string value in the VxlanV6Tunnel object +func (obj *vxlanV6Tunnel) SetName(value string) VxlanV6Tunnel { + + obj.obj.Name = &value + return obj +} + +func (obj *vxlanV6Tunnel) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + // SourceInterface is required + if obj.obj.SourceInterface == nil { + vObj.validationErrors = append(vObj.validationErrors, "SourceInterface is required field on interface VxlanV6Tunnel") + } + + if obj.obj.DestinationIpMode != nil { + + obj.DestinationIpMode().validateObj(vObj, set_default) + } + + // Vni is required + if obj.obj.Vni == nil { + vObj.validationErrors = append(vObj.validationErrors, "Vni is required field on interface VxlanV6Tunnel") + } + if obj.obj.Vni != nil { + + if *obj.obj.Vni < 1 || *obj.obj.Vni > 16777215 { + vObj.validationErrors = append( + vObj.validationErrors, + fmt.Sprintf("1 <= VxlanV6Tunnel.Vni <= 16777215 but Got %d", *obj.obj.Vni)) + } + + } + + // Name is required + if obj.obj.Name == nil { + vObj.validationErrors = append(vObj.validationErrors, "Name is required field on interface VxlanV6Tunnel") + } +} + +func (obj *vxlanV6Tunnel) setDefault() { + +} diff --git a/gosnappi/vxlan_v6_tunnel_destination_ip_mode.go b/gosnappi/vxlan_v6_tunnel_destination_ip_mode.go new file mode 100644 index 00000000..63bb6842 --- /dev/null +++ b/gosnappi/vxlan_v6_tunnel_destination_ip_mode.go @@ -0,0 +1,452 @@ +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" +) + +// ***** VxlanV6TunnelDestinationIPMode ***** +type vxlanV6TunnelDestinationIPMode struct { + validation + obj *otg.VxlanV6TunnelDestinationIPMode + marshaller marshalVxlanV6TunnelDestinationIPMode + unMarshaller unMarshalVxlanV6TunnelDestinationIPMode + unicastHolder VxlanV6TunnelDestinationIPModeUnicast + multicastHolder VxlanV6TunnelDestinationIPModeMulticast +} + +func NewVxlanV6TunnelDestinationIPMode() VxlanV6TunnelDestinationIPMode { + obj := vxlanV6TunnelDestinationIPMode{obj: &otg.VxlanV6TunnelDestinationIPMode{}} + obj.setDefault() + return &obj +} + +func (obj *vxlanV6TunnelDestinationIPMode) msg() *otg.VxlanV6TunnelDestinationIPMode { + return obj.obj +} + +func (obj *vxlanV6TunnelDestinationIPMode) setMsg(msg *otg.VxlanV6TunnelDestinationIPMode) VxlanV6TunnelDestinationIPMode { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalvxlanV6TunnelDestinationIPMode struct { + obj *vxlanV6TunnelDestinationIPMode +} + +type marshalVxlanV6TunnelDestinationIPMode interface { + // ToProto marshals VxlanV6TunnelDestinationIPMode to protobuf object *otg.VxlanV6TunnelDestinationIPMode + ToProto() (*otg.VxlanV6TunnelDestinationIPMode, error) + // ToPbText marshals VxlanV6TunnelDestinationIPMode to protobuf text + ToPbText() (string, error) + // ToYaml marshals VxlanV6TunnelDestinationIPMode to YAML text + ToYaml() (string, error) + // ToJson marshals VxlanV6TunnelDestinationIPMode to JSON text + ToJson() (string, error) +} + +type unMarshalvxlanV6TunnelDestinationIPMode struct { + obj *vxlanV6TunnelDestinationIPMode +} + +type unMarshalVxlanV6TunnelDestinationIPMode interface { + // FromProto unmarshals VxlanV6TunnelDestinationIPMode from protobuf object *otg.VxlanV6TunnelDestinationIPMode + FromProto(msg *otg.VxlanV6TunnelDestinationIPMode) (VxlanV6TunnelDestinationIPMode, error) + // FromPbText unmarshals VxlanV6TunnelDestinationIPMode from protobuf text + FromPbText(value string) error + // FromYaml unmarshals VxlanV6TunnelDestinationIPMode from YAML text + FromYaml(value string) error + // FromJson unmarshals VxlanV6TunnelDestinationIPMode from JSON text + FromJson(value string) error +} + +func (obj *vxlanV6TunnelDestinationIPMode) Marshal() marshalVxlanV6TunnelDestinationIPMode { + if obj.marshaller == nil { + obj.marshaller = &marshalvxlanV6TunnelDestinationIPMode{obj: obj} + } + return obj.marshaller +} + +func (obj *vxlanV6TunnelDestinationIPMode) Unmarshal() unMarshalVxlanV6TunnelDestinationIPMode { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalvxlanV6TunnelDestinationIPMode{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalvxlanV6TunnelDestinationIPMode) ToProto() (*otg.VxlanV6TunnelDestinationIPMode, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalvxlanV6TunnelDestinationIPMode) FromProto(msg *otg.VxlanV6TunnelDestinationIPMode) (VxlanV6TunnelDestinationIPMode, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalvxlanV6TunnelDestinationIPMode) 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 *unMarshalvxlanV6TunnelDestinationIPMode) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalvxlanV6TunnelDestinationIPMode) 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 *unMarshalvxlanV6TunnelDestinationIPMode) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalvxlanV6TunnelDestinationIPMode) 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 *unMarshalvxlanV6TunnelDestinationIPMode) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *vxlanV6TunnelDestinationIPMode) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *vxlanV6TunnelDestinationIPMode) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *vxlanV6TunnelDestinationIPMode) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *vxlanV6TunnelDestinationIPMode) Clone() (VxlanV6TunnelDestinationIPMode, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewVxlanV6TunnelDestinationIPMode() + 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 +} + +func (obj *vxlanV6TunnelDestinationIPMode) setNil() { + obj.unicastHolder = nil + obj.multicastHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// VxlanV6TunnelDestinationIPMode is communication mode between the VTEPs, either unicast or multicast. +type VxlanV6TunnelDestinationIPMode interface { + Validation + // msg marshals VxlanV6TunnelDestinationIPMode to protobuf object *otg.VxlanV6TunnelDestinationIPMode + // and doesn't set defaults + msg() *otg.VxlanV6TunnelDestinationIPMode + // setMsg unmarshals VxlanV6TunnelDestinationIPMode from protobuf object *otg.VxlanV6TunnelDestinationIPMode + // and doesn't set defaults + setMsg(*otg.VxlanV6TunnelDestinationIPMode) VxlanV6TunnelDestinationIPMode + // provides marshal interface + Marshal() marshalVxlanV6TunnelDestinationIPMode + // provides unmarshal interface + Unmarshal() unMarshalVxlanV6TunnelDestinationIPMode + // validate validates VxlanV6TunnelDestinationIPMode + validate() error + // A stringer function + String() string + // Clones the object + Clone() (VxlanV6TunnelDestinationIPMode, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Choice returns VxlanV6TunnelDestinationIPModeChoiceEnum, set in VxlanV6TunnelDestinationIPMode + Choice() VxlanV6TunnelDestinationIPModeChoiceEnum + // setChoice assigns VxlanV6TunnelDestinationIPModeChoiceEnum provided by user to VxlanV6TunnelDestinationIPMode + setChoice(value VxlanV6TunnelDestinationIPModeChoiceEnum) VxlanV6TunnelDestinationIPMode + // HasChoice checks if Choice has been set in VxlanV6TunnelDestinationIPMode + HasChoice() bool + // Unicast returns VxlanV6TunnelDestinationIPModeUnicast, set in VxlanV6TunnelDestinationIPMode. + // VxlanV6TunnelDestinationIPModeUnicast is description is TBD + Unicast() VxlanV6TunnelDestinationIPModeUnicast + // SetUnicast assigns VxlanV6TunnelDestinationIPModeUnicast provided by user to VxlanV6TunnelDestinationIPMode. + // VxlanV6TunnelDestinationIPModeUnicast is description is TBD + SetUnicast(value VxlanV6TunnelDestinationIPModeUnicast) VxlanV6TunnelDestinationIPMode + // HasUnicast checks if Unicast has been set in VxlanV6TunnelDestinationIPMode + HasUnicast() bool + // Multicast returns VxlanV6TunnelDestinationIPModeMulticast, set in VxlanV6TunnelDestinationIPMode. + // VxlanV6TunnelDestinationIPModeMulticast is multicast Group address for member VNI(VXLAN Network Identifier) + Multicast() VxlanV6TunnelDestinationIPModeMulticast + // SetMulticast assigns VxlanV6TunnelDestinationIPModeMulticast provided by user to VxlanV6TunnelDestinationIPMode. + // VxlanV6TunnelDestinationIPModeMulticast is multicast Group address for member VNI(VXLAN Network Identifier) + SetMulticast(value VxlanV6TunnelDestinationIPModeMulticast) VxlanV6TunnelDestinationIPMode + // HasMulticast checks if Multicast has been set in VxlanV6TunnelDestinationIPMode + HasMulticast() bool + setNil() +} + +type VxlanV6TunnelDestinationIPModeChoiceEnum string + +// Enum of Choice on VxlanV6TunnelDestinationIPMode +var VxlanV6TunnelDestinationIPModeChoice = struct { + UNICAST VxlanV6TunnelDestinationIPModeChoiceEnum + MULTICAST VxlanV6TunnelDestinationIPModeChoiceEnum +}{ + UNICAST: VxlanV6TunnelDestinationIPModeChoiceEnum("unicast"), + MULTICAST: VxlanV6TunnelDestinationIPModeChoiceEnum("multicast"), +} + +func (obj *vxlanV6TunnelDestinationIPMode) Choice() VxlanV6TunnelDestinationIPModeChoiceEnum { + return VxlanV6TunnelDestinationIPModeChoiceEnum(obj.obj.Choice.Enum().String()) +} + +// unicast or multicast +// Choice returns a string +func (obj *vxlanV6TunnelDestinationIPMode) HasChoice() bool { + return obj.obj.Choice != nil +} + +func (obj *vxlanV6TunnelDestinationIPMode) setChoice(value VxlanV6TunnelDestinationIPModeChoiceEnum) VxlanV6TunnelDestinationIPMode { + intValue, ok := otg.VxlanV6TunnelDestinationIPMode_Choice_Enum_value[string(value)] + if !ok { + obj.validationErrors = append(obj.validationErrors, fmt.Sprintf( + "%s is not a valid choice on VxlanV6TunnelDestinationIPModeChoiceEnum", string(value))) + return obj + } + enumValue := otg.VxlanV6TunnelDestinationIPMode_Choice_Enum(intValue) + obj.obj.Choice = &enumValue + obj.obj.Multicast = nil + obj.multicastHolder = nil + obj.obj.Unicast = nil + obj.unicastHolder = nil + + if value == VxlanV6TunnelDestinationIPModeChoice.UNICAST { + obj.obj.Unicast = NewVxlanV6TunnelDestinationIPModeUnicast().msg() + } + + if value == VxlanV6TunnelDestinationIPModeChoice.MULTICAST { + obj.obj.Multicast = NewVxlanV6TunnelDestinationIPModeMulticast().msg() + } + + return obj +} + +// description is TBD +// Unicast returns a VxlanV6TunnelDestinationIPModeUnicast +func (obj *vxlanV6TunnelDestinationIPMode) Unicast() VxlanV6TunnelDestinationIPModeUnicast { + if obj.obj.Unicast == nil { + obj.setChoice(VxlanV6TunnelDestinationIPModeChoice.UNICAST) + } + if obj.unicastHolder == nil { + obj.unicastHolder = &vxlanV6TunnelDestinationIPModeUnicast{obj: obj.obj.Unicast} + } + return obj.unicastHolder +} + +// description is TBD +// Unicast returns a VxlanV6TunnelDestinationIPModeUnicast +func (obj *vxlanV6TunnelDestinationIPMode) HasUnicast() bool { + return obj.obj.Unicast != nil +} + +// description is TBD +// SetUnicast sets the VxlanV6TunnelDestinationIPModeUnicast value in the VxlanV6TunnelDestinationIPMode object +func (obj *vxlanV6TunnelDestinationIPMode) SetUnicast(value VxlanV6TunnelDestinationIPModeUnicast) VxlanV6TunnelDestinationIPMode { + obj.setChoice(VxlanV6TunnelDestinationIPModeChoice.UNICAST) + obj.unicastHolder = nil + obj.obj.Unicast = value.msg() + + return obj +} + +// description is TBD +// Multicast returns a VxlanV6TunnelDestinationIPModeMulticast +func (obj *vxlanV6TunnelDestinationIPMode) Multicast() VxlanV6TunnelDestinationIPModeMulticast { + if obj.obj.Multicast == nil { + obj.setChoice(VxlanV6TunnelDestinationIPModeChoice.MULTICAST) + } + if obj.multicastHolder == nil { + obj.multicastHolder = &vxlanV6TunnelDestinationIPModeMulticast{obj: obj.obj.Multicast} + } + return obj.multicastHolder +} + +// description is TBD +// Multicast returns a VxlanV6TunnelDestinationIPModeMulticast +func (obj *vxlanV6TunnelDestinationIPMode) HasMulticast() bool { + return obj.obj.Multicast != nil +} + +// description is TBD +// SetMulticast sets the VxlanV6TunnelDestinationIPModeMulticast value in the VxlanV6TunnelDestinationIPMode object +func (obj *vxlanV6TunnelDestinationIPMode) SetMulticast(value VxlanV6TunnelDestinationIPModeMulticast) VxlanV6TunnelDestinationIPMode { + obj.setChoice(VxlanV6TunnelDestinationIPModeChoice.MULTICAST) + obj.multicastHolder = nil + obj.obj.Multicast = value.msg() + + return obj +} + +func (obj *vxlanV6TunnelDestinationIPMode) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Unicast != nil { + + obj.Unicast().validateObj(vObj, set_default) + } + + if obj.obj.Multicast != nil { + + obj.Multicast().validateObj(vObj, set_default) + } + +} + +func (obj *vxlanV6TunnelDestinationIPMode) setDefault() { + var choices_set int = 0 + var choice VxlanV6TunnelDestinationIPModeChoiceEnum + + if obj.obj.Unicast != nil { + choices_set += 1 + choice = VxlanV6TunnelDestinationIPModeChoice.UNICAST + } + + if obj.obj.Multicast != nil { + choices_set += 1 + choice = VxlanV6TunnelDestinationIPModeChoice.MULTICAST + } + if choices_set == 0 { + if obj.obj.Choice == nil { + obj.setChoice(VxlanV6TunnelDestinationIPModeChoice.MULTICAST) + + } + + } else if choices_set == 1 && choice != "" { + if obj.obj.Choice != nil { + if obj.Choice() != choice { + obj.validationErrors = append(obj.validationErrors, "choice not matching with property in VxlanV6TunnelDestinationIPMode") + } + } else { + intVal := otg.VxlanV6TunnelDestinationIPMode_Choice_Enum_value[string(choice)] + enumValue := otg.VxlanV6TunnelDestinationIPMode_Choice_Enum(intVal) + obj.obj.Choice = &enumValue + } + } + +} diff --git a/gosnappi/vxlan_v6_tunnel_destination_ip_mode_multicast.go b/gosnappi/vxlan_v6_tunnel_destination_ip_mode_multicast.go new file mode 100644 index 00000000..22ecec3d --- /dev/null +++ b/gosnappi/vxlan_v6_tunnel_destination_ip_mode_multicast.go @@ -0,0 +1,315 @@ +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" +) + +// ***** VxlanV6TunnelDestinationIPModeMulticast ***** +type vxlanV6TunnelDestinationIPModeMulticast struct { + validation + obj *otg.VxlanV6TunnelDestinationIPModeMulticast + marshaller marshalVxlanV6TunnelDestinationIPModeMulticast + unMarshaller unMarshalVxlanV6TunnelDestinationIPModeMulticast +} + +func NewVxlanV6TunnelDestinationIPModeMulticast() VxlanV6TunnelDestinationIPModeMulticast { + obj := vxlanV6TunnelDestinationIPModeMulticast{obj: &otg.VxlanV6TunnelDestinationIPModeMulticast{}} + obj.setDefault() + return &obj +} + +func (obj *vxlanV6TunnelDestinationIPModeMulticast) msg() *otg.VxlanV6TunnelDestinationIPModeMulticast { + return obj.obj +} + +func (obj *vxlanV6TunnelDestinationIPModeMulticast) setMsg(msg *otg.VxlanV6TunnelDestinationIPModeMulticast) VxlanV6TunnelDestinationIPModeMulticast { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalvxlanV6TunnelDestinationIPModeMulticast struct { + obj *vxlanV6TunnelDestinationIPModeMulticast +} + +type marshalVxlanV6TunnelDestinationIPModeMulticast interface { + // ToProto marshals VxlanV6TunnelDestinationIPModeMulticast to protobuf object *otg.VxlanV6TunnelDestinationIPModeMulticast + ToProto() (*otg.VxlanV6TunnelDestinationIPModeMulticast, error) + // ToPbText marshals VxlanV6TunnelDestinationIPModeMulticast to protobuf text + ToPbText() (string, error) + // ToYaml marshals VxlanV6TunnelDestinationIPModeMulticast to YAML text + ToYaml() (string, error) + // ToJson marshals VxlanV6TunnelDestinationIPModeMulticast to JSON text + ToJson() (string, error) +} + +type unMarshalvxlanV6TunnelDestinationIPModeMulticast struct { + obj *vxlanV6TunnelDestinationIPModeMulticast +} + +type unMarshalVxlanV6TunnelDestinationIPModeMulticast interface { + // FromProto unmarshals VxlanV6TunnelDestinationIPModeMulticast from protobuf object *otg.VxlanV6TunnelDestinationIPModeMulticast + FromProto(msg *otg.VxlanV6TunnelDestinationIPModeMulticast) (VxlanV6TunnelDestinationIPModeMulticast, error) + // FromPbText unmarshals VxlanV6TunnelDestinationIPModeMulticast from protobuf text + FromPbText(value string) error + // FromYaml unmarshals VxlanV6TunnelDestinationIPModeMulticast from YAML text + FromYaml(value string) error + // FromJson unmarshals VxlanV6TunnelDestinationIPModeMulticast from JSON text + FromJson(value string) error +} + +func (obj *vxlanV6TunnelDestinationIPModeMulticast) Marshal() marshalVxlanV6TunnelDestinationIPModeMulticast { + if obj.marshaller == nil { + obj.marshaller = &marshalvxlanV6TunnelDestinationIPModeMulticast{obj: obj} + } + return obj.marshaller +} + +func (obj *vxlanV6TunnelDestinationIPModeMulticast) Unmarshal() unMarshalVxlanV6TunnelDestinationIPModeMulticast { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalvxlanV6TunnelDestinationIPModeMulticast{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalvxlanV6TunnelDestinationIPModeMulticast) ToProto() (*otg.VxlanV6TunnelDestinationIPModeMulticast, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalvxlanV6TunnelDestinationIPModeMulticast) FromProto(msg *otg.VxlanV6TunnelDestinationIPModeMulticast) (VxlanV6TunnelDestinationIPModeMulticast, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalvxlanV6TunnelDestinationIPModeMulticast) 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 *unMarshalvxlanV6TunnelDestinationIPModeMulticast) 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 *marshalvxlanV6TunnelDestinationIPModeMulticast) 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 *unMarshalvxlanV6TunnelDestinationIPModeMulticast) 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 *marshalvxlanV6TunnelDestinationIPModeMulticast) 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 *unMarshalvxlanV6TunnelDestinationIPModeMulticast) 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 *vxlanV6TunnelDestinationIPModeMulticast) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *vxlanV6TunnelDestinationIPModeMulticast) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *vxlanV6TunnelDestinationIPModeMulticast) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *vxlanV6TunnelDestinationIPModeMulticast) Clone() (VxlanV6TunnelDestinationIPModeMulticast, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewVxlanV6TunnelDestinationIPModeMulticast() + 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 +} + +// VxlanV6TunnelDestinationIPModeMulticast is multicast Group address for member VNI(VXLAN Network Identifier) +type VxlanV6TunnelDestinationIPModeMulticast interface { + Validation + // msg marshals VxlanV6TunnelDestinationIPModeMulticast to protobuf object *otg.VxlanV6TunnelDestinationIPModeMulticast + // and doesn't set defaults + msg() *otg.VxlanV6TunnelDestinationIPModeMulticast + // setMsg unmarshals VxlanV6TunnelDestinationIPModeMulticast from protobuf object *otg.VxlanV6TunnelDestinationIPModeMulticast + // and doesn't set defaults + setMsg(*otg.VxlanV6TunnelDestinationIPModeMulticast) VxlanV6TunnelDestinationIPModeMulticast + // provides marshal interface + Marshal() marshalVxlanV6TunnelDestinationIPModeMulticast + // provides unmarshal interface + Unmarshal() unMarshalVxlanV6TunnelDestinationIPModeMulticast + // validate validates VxlanV6TunnelDestinationIPModeMulticast + validate() error + // A stringer function + String() string + // Clones the object + Clone() (VxlanV6TunnelDestinationIPModeMulticast, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Address returns string, set in VxlanV6TunnelDestinationIPModeMulticast. + Address() string + // SetAddress assigns string provided by user to VxlanV6TunnelDestinationIPModeMulticast + SetAddress(value string) VxlanV6TunnelDestinationIPModeMulticast + // HasAddress checks if Address has been set in VxlanV6TunnelDestinationIPModeMulticast + HasAddress() bool +} + +// IPv6 Multicast address +// Address returns a string +func (obj *vxlanV6TunnelDestinationIPModeMulticast) Address() string { + + return *obj.obj.Address + +} + +// IPv6 Multicast address +// Address returns a string +func (obj *vxlanV6TunnelDestinationIPModeMulticast) HasAddress() bool { + return obj.obj.Address != nil +} + +// IPv6 Multicast address +// SetAddress sets the string value in the VxlanV6TunnelDestinationIPModeMulticast object +func (obj *vxlanV6TunnelDestinationIPModeMulticast) SetAddress(value string) VxlanV6TunnelDestinationIPModeMulticast { + + obj.obj.Address = &value + return obj +} + +func (obj *vxlanV6TunnelDestinationIPModeMulticast) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.Address != nil { + + err := obj.validateIpv6(obj.Address()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on VxlanV6TunnelDestinationIPModeMulticast.Address")) + } + + } + +} + +func (obj *vxlanV6TunnelDestinationIPModeMulticast) setDefault() { + +} diff --git a/gosnappi/vxlan_v6_tunnel_destination_ip_mode_unicast.go b/gosnappi/vxlan_v6_tunnel_destination_ip_mode_unicast.go new file mode 100644 index 00000000..530ec0e4 --- /dev/null +++ b/gosnappi/vxlan_v6_tunnel_destination_ip_mode_unicast.go @@ -0,0 +1,390 @@ +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" +) + +// ***** VxlanV6TunnelDestinationIPModeUnicast ***** +type vxlanV6TunnelDestinationIPModeUnicast struct { + validation + obj *otg.VxlanV6TunnelDestinationIPModeUnicast + marshaller marshalVxlanV6TunnelDestinationIPModeUnicast + unMarshaller unMarshalVxlanV6TunnelDestinationIPModeUnicast + vtepsHolder VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter +} + +func NewVxlanV6TunnelDestinationIPModeUnicast() VxlanV6TunnelDestinationIPModeUnicast { + obj := vxlanV6TunnelDestinationIPModeUnicast{obj: &otg.VxlanV6TunnelDestinationIPModeUnicast{}} + obj.setDefault() + return &obj +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicast) msg() *otg.VxlanV6TunnelDestinationIPModeUnicast { + return obj.obj +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicast) setMsg(msg *otg.VxlanV6TunnelDestinationIPModeUnicast) VxlanV6TunnelDestinationIPModeUnicast { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalvxlanV6TunnelDestinationIPModeUnicast struct { + obj *vxlanV6TunnelDestinationIPModeUnicast +} + +type marshalVxlanV6TunnelDestinationIPModeUnicast interface { + // ToProto marshals VxlanV6TunnelDestinationIPModeUnicast to protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicast + ToProto() (*otg.VxlanV6TunnelDestinationIPModeUnicast, error) + // ToPbText marshals VxlanV6TunnelDestinationIPModeUnicast to protobuf text + ToPbText() (string, error) + // ToYaml marshals VxlanV6TunnelDestinationIPModeUnicast to YAML text + ToYaml() (string, error) + // ToJson marshals VxlanV6TunnelDestinationIPModeUnicast to JSON text + ToJson() (string, error) +} + +type unMarshalvxlanV6TunnelDestinationIPModeUnicast struct { + obj *vxlanV6TunnelDestinationIPModeUnicast +} + +type unMarshalVxlanV6TunnelDestinationIPModeUnicast interface { + // FromProto unmarshals VxlanV6TunnelDestinationIPModeUnicast from protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicast + FromProto(msg *otg.VxlanV6TunnelDestinationIPModeUnicast) (VxlanV6TunnelDestinationIPModeUnicast, error) + // FromPbText unmarshals VxlanV6TunnelDestinationIPModeUnicast from protobuf text + FromPbText(value string) error + // FromYaml unmarshals VxlanV6TunnelDestinationIPModeUnicast from YAML text + FromYaml(value string) error + // FromJson unmarshals VxlanV6TunnelDestinationIPModeUnicast from JSON text + FromJson(value string) error +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicast) Marshal() marshalVxlanV6TunnelDestinationIPModeUnicast { + if obj.marshaller == nil { + obj.marshaller = &marshalvxlanV6TunnelDestinationIPModeUnicast{obj: obj} + } + return obj.marshaller +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicast) Unmarshal() unMarshalVxlanV6TunnelDestinationIPModeUnicast { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalvxlanV6TunnelDestinationIPModeUnicast{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalvxlanV6TunnelDestinationIPModeUnicast) ToProto() (*otg.VxlanV6TunnelDestinationIPModeUnicast, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalvxlanV6TunnelDestinationIPModeUnicast) FromProto(msg *otg.VxlanV6TunnelDestinationIPModeUnicast) (VxlanV6TunnelDestinationIPModeUnicast, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalvxlanV6TunnelDestinationIPModeUnicast) 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 *unMarshalvxlanV6TunnelDestinationIPModeUnicast) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalvxlanV6TunnelDestinationIPModeUnicast) 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 *unMarshalvxlanV6TunnelDestinationIPModeUnicast) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalvxlanV6TunnelDestinationIPModeUnicast) 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 *unMarshalvxlanV6TunnelDestinationIPModeUnicast) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicast) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicast) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicast) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicast) Clone() (VxlanV6TunnelDestinationIPModeUnicast, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewVxlanV6TunnelDestinationIPModeUnicast() + 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 +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicast) setNil() { + obj.vtepsHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// VxlanV6TunnelDestinationIPModeUnicast is description is TBD +type VxlanV6TunnelDestinationIPModeUnicast interface { + Validation + // msg marshals VxlanV6TunnelDestinationIPModeUnicast to protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicast + // and doesn't set defaults + msg() *otg.VxlanV6TunnelDestinationIPModeUnicast + // setMsg unmarshals VxlanV6TunnelDestinationIPModeUnicast from protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicast + // and doesn't set defaults + setMsg(*otg.VxlanV6TunnelDestinationIPModeUnicast) VxlanV6TunnelDestinationIPModeUnicast + // provides marshal interface + Marshal() marshalVxlanV6TunnelDestinationIPModeUnicast + // provides unmarshal interface + Unmarshal() unMarshalVxlanV6TunnelDestinationIPModeUnicast + // validate validates VxlanV6TunnelDestinationIPModeUnicast + validate() error + // A stringer function + String() string + // Clones the object + Clone() (VxlanV6TunnelDestinationIPModeUnicast, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Vteps returns VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIterIter, set in VxlanV6TunnelDestinationIPModeUnicast + Vteps() VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter + setNil() +} + +// List of VTEPs for member VNI(VXLAN Network Identifier) +// Vteps returns a []VxlanV6TunnelDestinationIPModeUnicastVtep +func (obj *vxlanV6TunnelDestinationIPModeUnicast) Vteps() VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { + if len(obj.obj.Vteps) == 0 { + obj.obj.Vteps = []*otg.VxlanV6TunnelDestinationIPModeUnicastVtep{} + } + if obj.vtepsHolder == nil { + obj.vtepsHolder = newVxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter(&obj.obj.Vteps).setMsg(obj) + } + return obj.vtepsHolder +} + +type vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter struct { + obj *vxlanV6TunnelDestinationIPModeUnicast + vxlanV6TunnelDestinationIPModeUnicastVtepSlice []VxlanV6TunnelDestinationIPModeUnicastVtep + fieldPtr *[]*otg.VxlanV6TunnelDestinationIPModeUnicastVtep +} + +func newVxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter(ptr *[]*otg.VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { + return &vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter{fieldPtr: ptr} +} + +type VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter interface { + setMsg(*vxlanV6TunnelDestinationIPModeUnicast) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter + Items() []VxlanV6TunnelDestinationIPModeUnicastVtep + Add() VxlanV6TunnelDestinationIPModeUnicastVtep + Append(items ...VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter + Set(index int, newObj VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter + Clear() VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter + clearHolderSlice() VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter + appendHolderSlice(item VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) setMsg(msg *vxlanV6TunnelDestinationIPModeUnicast) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&vxlanV6TunnelDestinationIPModeUnicastVtep{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) Items() []VxlanV6TunnelDestinationIPModeUnicastVtep { + return obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) Add() VxlanV6TunnelDestinationIPModeUnicastVtep { + newObj := &otg.VxlanV6TunnelDestinationIPModeUnicastVtep{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &vxlanV6TunnelDestinationIPModeUnicastVtep{obj: newObj} + newLibObj.setDefault() + obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice = append(obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice, newLibObj) + return newLibObj +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) Append(items ...VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice = append(obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice, item) + } + return obj +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) Set(index int, newObj VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice[index] = newObj + return obj +} +func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) Clear() VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.VxlanV6TunnelDestinationIPModeUnicastVtep{} + obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice = []VxlanV6TunnelDestinationIPModeUnicastVtep{} + } + return obj +} +func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) clearHolderSlice() VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { + if len(obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice) > 0 { + obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice = []VxlanV6TunnelDestinationIPModeUnicastVtep{} + } + return obj +} +func (obj *vxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter) appendHolderSlice(item VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVxlanV6TunnelDestinationIPModeUnicastVtepIter { + obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice = append(obj.vxlanV6TunnelDestinationIPModeUnicastVtepSlice, item) + return obj +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicast) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if len(obj.obj.Vteps) != 0 { + + if set_default { + obj.Vteps().clearHolderSlice() + for _, item := range obj.obj.Vteps { + obj.Vteps().appendHolderSlice(&vxlanV6TunnelDestinationIPModeUnicastVtep{obj: item}) + } + } + for _, item := range obj.Vteps().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicast) setDefault() { + +} diff --git a/gosnappi/vxlan_v6_tunnel_destination_ip_mode_unicast_vtep.go b/gosnappi/vxlan_v6_tunnel_destination_ip_mode_unicast_vtep.go new file mode 100644 index 00000000..781cf82e --- /dev/null +++ b/gosnappi/vxlan_v6_tunnel_destination_ip_mode_unicast_vtep.go @@ -0,0 +1,427 @@ +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" +) + +// ***** VxlanV6TunnelDestinationIPModeUnicastVtep ***** +type vxlanV6TunnelDestinationIPModeUnicastVtep struct { + validation + obj *otg.VxlanV6TunnelDestinationIPModeUnicastVtep + marshaller marshalVxlanV6TunnelDestinationIPModeUnicastVtep + unMarshaller unMarshalVxlanV6TunnelDestinationIPModeUnicastVtep + arpSuppressionCacheHolder VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter +} + +func NewVxlanV6TunnelDestinationIPModeUnicastVtep() VxlanV6TunnelDestinationIPModeUnicastVtep { + obj := vxlanV6TunnelDestinationIPModeUnicastVtep{obj: &otg.VxlanV6TunnelDestinationIPModeUnicastVtep{}} + obj.setDefault() + return &obj +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) msg() *otg.VxlanV6TunnelDestinationIPModeUnicastVtep { + return obj.obj +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) setMsg(msg *otg.VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVtep { + obj.setNil() + proto.Merge(obj.obj, msg) + return obj +} + +type marshalvxlanV6TunnelDestinationIPModeUnicastVtep struct { + obj *vxlanV6TunnelDestinationIPModeUnicastVtep +} + +type marshalVxlanV6TunnelDestinationIPModeUnicastVtep interface { + // ToProto marshals VxlanV6TunnelDestinationIPModeUnicastVtep to protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicastVtep + ToProto() (*otg.VxlanV6TunnelDestinationIPModeUnicastVtep, error) + // ToPbText marshals VxlanV6TunnelDestinationIPModeUnicastVtep to protobuf text + ToPbText() (string, error) + // ToYaml marshals VxlanV6TunnelDestinationIPModeUnicastVtep to YAML text + ToYaml() (string, error) + // ToJson marshals VxlanV6TunnelDestinationIPModeUnicastVtep to JSON text + ToJson() (string, error) +} + +type unMarshalvxlanV6TunnelDestinationIPModeUnicastVtep struct { + obj *vxlanV6TunnelDestinationIPModeUnicastVtep +} + +type unMarshalVxlanV6TunnelDestinationIPModeUnicastVtep interface { + // FromProto unmarshals VxlanV6TunnelDestinationIPModeUnicastVtep from protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicastVtep + FromProto(msg *otg.VxlanV6TunnelDestinationIPModeUnicastVtep) (VxlanV6TunnelDestinationIPModeUnicastVtep, error) + // FromPbText unmarshals VxlanV6TunnelDestinationIPModeUnicastVtep from protobuf text + FromPbText(value string) error + // FromYaml unmarshals VxlanV6TunnelDestinationIPModeUnicastVtep from YAML text + FromYaml(value string) error + // FromJson unmarshals VxlanV6TunnelDestinationIPModeUnicastVtep from JSON text + FromJson(value string) error +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) Marshal() marshalVxlanV6TunnelDestinationIPModeUnicastVtep { + if obj.marshaller == nil { + obj.marshaller = &marshalvxlanV6TunnelDestinationIPModeUnicastVtep{obj: obj} + } + return obj.marshaller +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) Unmarshal() unMarshalVxlanV6TunnelDestinationIPModeUnicastVtep { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalvxlanV6TunnelDestinationIPModeUnicastVtep{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalvxlanV6TunnelDestinationIPModeUnicastVtep) ToProto() (*otg.VxlanV6TunnelDestinationIPModeUnicastVtep, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalvxlanV6TunnelDestinationIPModeUnicastVtep) FromProto(msg *otg.VxlanV6TunnelDestinationIPModeUnicastVtep) (VxlanV6TunnelDestinationIPModeUnicastVtep, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalvxlanV6TunnelDestinationIPModeUnicastVtep) 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 *unMarshalvxlanV6TunnelDestinationIPModeUnicastVtep) FromPbText(value string) error { + retObj := proto.Unmarshal([]byte(value), m.obj.msg()) + if retObj != nil { + return retObj + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return retObj +} + +func (m *marshalvxlanV6TunnelDestinationIPModeUnicastVtep) 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 *unMarshalvxlanV6TunnelDestinationIPModeUnicastVtep) 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:]) + } + m.obj.setNil() + vErr := m.obj.validateToAndFrom() + if vErr != nil { + return vErr + } + return nil +} + +func (m *marshalvxlanV6TunnelDestinationIPModeUnicastVtep) 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 *unMarshalvxlanV6TunnelDestinationIPModeUnicastVtep) 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:]) + } + m.obj.setNil() + err := m.obj.validateToAndFrom() + if err != nil { + return err + } + return nil +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) Clone() (VxlanV6TunnelDestinationIPModeUnicastVtep, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewVxlanV6TunnelDestinationIPModeUnicastVtep() + 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 +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) setNil() { + obj.arpSuppressionCacheHolder = nil + obj.validationErrors = nil + obj.warnings = nil + obj.constraints = make(map[string]map[string]Constraints) +} + +// VxlanV6TunnelDestinationIPModeUnicastVtep is vTEP (VXLAN Tunnel End Point (VTEP)) parameters +type VxlanV6TunnelDestinationIPModeUnicastVtep interface { + Validation + // msg marshals VxlanV6TunnelDestinationIPModeUnicastVtep to protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicastVtep + // and doesn't set defaults + msg() *otg.VxlanV6TunnelDestinationIPModeUnicastVtep + // setMsg unmarshals VxlanV6TunnelDestinationIPModeUnicastVtep from protobuf object *otg.VxlanV6TunnelDestinationIPModeUnicastVtep + // and doesn't set defaults + setMsg(*otg.VxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVtep + // provides marshal interface + Marshal() marshalVxlanV6TunnelDestinationIPModeUnicastVtep + // provides unmarshal interface + Unmarshal() unMarshalVxlanV6TunnelDestinationIPModeUnicastVtep + // validate validates VxlanV6TunnelDestinationIPModeUnicastVtep + validate() error + // A stringer function + String() string + // Clones the object + Clone() (VxlanV6TunnelDestinationIPModeUnicastVtep, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // RemoteVtepAddress returns string, set in VxlanV6TunnelDestinationIPModeUnicastVtep. + RemoteVtepAddress() string + // SetRemoteVtepAddress assigns string provided by user to VxlanV6TunnelDestinationIPModeUnicastVtep + SetRemoteVtepAddress(value string) VxlanV6TunnelDestinationIPModeUnicastVtep + // HasRemoteVtepAddress checks if RemoteVtepAddress has been set in VxlanV6TunnelDestinationIPModeUnicastVtep + HasRemoteVtepAddress() bool + // ArpSuppressionCache returns VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIterIter, set in VxlanV6TunnelDestinationIPModeUnicastVtep + ArpSuppressionCache() VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter + setNil() +} + +// Remote VXLAN Tunnel End Point address +// RemoteVtepAddress returns a string +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) RemoteVtepAddress() string { + + return *obj.obj.RemoteVtepAddress + +} + +// Remote VXLAN Tunnel End Point address +// RemoteVtepAddress returns a string +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) HasRemoteVtepAddress() bool { + return obj.obj.RemoteVtepAddress != nil +} + +// Remote VXLAN Tunnel End Point address +// SetRemoteVtepAddress sets the string value in the VxlanV6TunnelDestinationIPModeUnicastVtep object +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) SetRemoteVtepAddress(value string) VxlanV6TunnelDestinationIPModeUnicastVtep { + + obj.obj.RemoteVtepAddress = &value + return obj +} + +// Each VTEP maintains an ARP suppression cache table for known IP hosts and their associated MAC addresses in the VNI segment. When an end host in the VNI sends an ARP request for another end-host IP address, its local VTEP intercepts the ARP request and checks for the ARP-resolved IP address in its ARP suppression cache table. If it finds a match, the local VTEP sends an ARP response on behalf of the remote end host. +// ArpSuppressionCache returns a []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) ArpSuppressionCache() VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + if len(obj.obj.ArpSuppressionCache) == 0 { + obj.obj.ArpSuppressionCache = []*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} + } + if obj.arpSuppressionCacheHolder == nil { + obj.arpSuppressionCacheHolder = newVxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter(&obj.obj.ArpSuppressionCache).setMsg(obj) + } + return obj.arpSuppressionCacheHolder +} + +type vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter struct { + obj *vxlanV6TunnelDestinationIPModeUnicastVtep + vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + fieldPtr *[]*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache +} + +func newVxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter(ptr *[]*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + return &vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter{fieldPtr: ptr} +} + +type VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter interface { + setMsg(*vxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter + Items() []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + Add() VxlanTunnelDestinationIPModeUnicastArpSuppressionCache + Append(items ...VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter + Set(index int, newObj VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter + Clear() VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter + clearHolderSlice() VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter + appendHolderSlice(item VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) setMsg(msg *vxlanV6TunnelDestinationIPModeUnicastVtep) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + obj.clearHolderSlice() + for _, val := range *obj.fieldPtr { + obj.appendHolderSlice(&vxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: val}) + } + obj.obj = msg + return obj +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Items() []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { + return obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Add() VxlanTunnelDestinationIPModeUnicastArpSuppressionCache { + newObj := &otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + newLibObj := &vxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: newObj} + newLibObj.setDefault() + obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = append(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice, newLibObj) + return newLibObj +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Append(items ...VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + for _, item := range items { + newObj := item.msg() + *obj.fieldPtr = append(*obj.fieldPtr, newObj) + obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = append(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice, item) + } + return obj +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Set(index int, newObj VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + (*obj.fieldPtr)[index] = newObj.msg() + obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice[index] = newObj + return obj +} +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) Clear() VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + if len(*obj.fieldPtr) > 0 { + *obj.fieldPtr = []*otg.VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} + obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} + } + return obj +} +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) clearHolderSlice() VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + if len(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice) > 0 { + obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = []VxlanTunnelDestinationIPModeUnicastArpSuppressionCache{} + } + return obj +} +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter) appendHolderSlice(item VxlanTunnelDestinationIPModeUnicastArpSuppressionCache) VxlanV6TunnelDestinationIPModeUnicastVtepVxlanTunnelDestinationIPModeUnicastArpSuppressionCacheIter { + obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice = append(obj.vxlanTunnelDestinationIPModeUnicastArpSuppressionCacheSlice, item) + return obj +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + + if obj.obj.RemoteVtepAddress != nil { + + err := obj.validateIpv6(obj.RemoteVtepAddress()) + if err != nil { + vObj.validationErrors = append(vObj.validationErrors, fmt.Sprintf("%s %s", err.Error(), "on VxlanV6TunnelDestinationIPModeUnicastVtep.RemoteVtepAddress")) + } + + } + + if len(obj.obj.ArpSuppressionCache) != 0 { + + if set_default { + obj.ArpSuppressionCache().clearHolderSlice() + for _, item := range obj.obj.ArpSuppressionCache { + obj.ArpSuppressionCache().appendHolderSlice(&vxlanTunnelDestinationIPModeUnicastArpSuppressionCache{obj: item}) + } + } + for _, item := range obj.ArpSuppressionCache().Items() { + item.validateObj(vObj, set_default) + } + + } + +} + +func (obj *vxlanV6TunnelDestinationIPModeUnicastVtep) setDefault() { + +} diff --git a/gosnappi/warning.go b/gosnappi/warning.go new file mode 100644 index 00000000..074cd0f1 --- /dev/null +++ b/gosnappi/warning.go @@ -0,0 +1,305 @@ +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" +) + +// ***** Warning ***** +type warning struct { + validation + obj *otg.Warning + marshaller marshalWarning + unMarshaller unMarshalWarning +} + +func NewWarning() Warning { + obj := warning{obj: &otg.Warning{}} + obj.setDefault() + return &obj +} + +func (obj *warning) msg() *otg.Warning { + return obj.obj +} + +func (obj *warning) setMsg(msg *otg.Warning) Warning { + + proto.Merge(obj.obj, msg) + return obj +} + +type marshalwarning struct { + obj *warning +} + +type marshalWarning interface { + // ToProto marshals Warning to protobuf object *otg.Warning + ToProto() (*otg.Warning, error) + // ToPbText marshals Warning to protobuf text + ToPbText() (string, error) + // ToYaml marshals Warning to YAML text + ToYaml() (string, error) + // ToJson marshals Warning to JSON text + ToJson() (string, error) +} + +type unMarshalwarning struct { + obj *warning +} + +type unMarshalWarning interface { + // FromProto unmarshals Warning from protobuf object *otg.Warning + FromProto(msg *otg.Warning) (Warning, error) + // FromPbText unmarshals Warning from protobuf text + FromPbText(value string) error + // FromYaml unmarshals Warning from YAML text + FromYaml(value string) error + // FromJson unmarshals Warning from JSON text + FromJson(value string) error +} + +func (obj *warning) Marshal() marshalWarning { + if obj.marshaller == nil { + obj.marshaller = &marshalwarning{obj: obj} + } + return obj.marshaller +} + +func (obj *warning) Unmarshal() unMarshalWarning { + if obj.unMarshaller == nil { + obj.unMarshaller = &unMarshalwarning{obj: obj} + } + return obj.unMarshaller +} + +func (m *marshalwarning) ToProto() (*otg.Warning, error) { + err := m.obj.validateToAndFrom() + if err != nil { + return nil, err + } + return m.obj.msg(), nil +} + +func (m *unMarshalwarning) FromProto(msg *otg.Warning) (Warning, error) { + newObj := m.obj.setMsg(msg) + err := newObj.validateToAndFrom() + if err != nil { + return nil, err + } + return newObj, nil +} + +func (m *marshalwarning) 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 *unMarshalwarning) 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 *marshalwarning) 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 *unMarshalwarning) 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 *marshalwarning) 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 *unMarshalwarning) 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 *warning) validateToAndFrom() error { + // emptyVars() + obj.validateObj(&obj.validation, true) + return obj.validationResult() +} + +func (obj *warning) validate() error { + // emptyVars() + obj.validateObj(&obj.validation, false) + return obj.validationResult() +} + +func (obj *warning) String() string { + str, err := obj.Marshal().ToYaml() + if err != nil { + return err.Error() + } + return str +} + +func (obj *warning) Clone() (Warning, error) { + vErr := obj.validate() + if vErr != nil { + return nil, vErr + } + newObj := NewWarning() + 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 +} + +// Warning is a list of warnings that have occurred while executing the request. +type Warning interface { + Validation + // msg marshals Warning to protobuf object *otg.Warning + // and doesn't set defaults + msg() *otg.Warning + // setMsg unmarshals Warning from protobuf object *otg.Warning + // and doesn't set defaults + setMsg(*otg.Warning) Warning + // provides marshal interface + Marshal() marshalWarning + // provides unmarshal interface + Unmarshal() unMarshalWarning + // validate validates Warning + validate() error + // A stringer function + String() string + // Clones the object + Clone() (Warning, error) + validateToAndFrom() error + validateObj(vObj *validation, set_default bool) + setDefault() + // Warnings returns []string, set in Warning. + Warnings() []string + // SetWarnings assigns []string provided by user to Warning + SetWarnings(value []string) Warning +} + +// A list of any system specific warnings that have occurred while +// executing the request. +// Warnings returns a []string +func (obj *warning) Warnings() []string { + if obj.obj.Warnings == nil { + obj.obj.Warnings = make([]string, 0) + } + return obj.obj.Warnings +} + +// A list of any system specific warnings that have occurred while +// executing the request. +// SetWarnings sets the []string value in the Warning object +func (obj *warning) SetWarnings(value []string) Warning { + + if obj.obj.Warnings == nil { + obj.obj.Warnings = make([]string, 0) + } + obj.obj.Warnings = value + + return obj +} + +func (obj *warning) validateObj(vObj *validation, set_default bool) { + if set_default { + obj.setDefault() + } + +} + +func (obj *warning) setDefault() { + +} diff --git a/requirements.txt b/requirements.txt index 657af094..a4695b9d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ --prefer-binary -protobuf~=4.24.4 ; python_version > '3.6' -protobuf~=3.15.0 ; python_version <= '3.6' requests -grpcio-tools~=1.35.0 ; python_version <= '3.6' +protobuf~=3.15.0 ; python_version <= '3.6' +protobuf~=4.24.4 ; python_version > '3.6' grpcio-tools~=1.59.0 ; python_version > '3.6' +grpcio-tools~=1.35.0 ; python_version <= '3.6' grpcio~=1.59.0 ; python_version > '3.6' grpcio~=1.35.0 ; python_version <= '3.6' PyYAML From ba812dfc5ad23bd87dbc31a150de7deb34d2d1a8 Mon Sep 17 00:00:00 2001 From: Apratim Mukherjee <78898747+apratimmukherjee@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:02:32 +0530 Subject: [PATCH 09/10] v1.7.2 gosnappi split support. --- version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.py b/version.py index 2b0d6fc2..8dece77b 100644 --- a/version.py +++ b/version.py @@ -2,8 +2,8 @@ class Version: - models_version = "1.7.0" - version = "1.7.1" + models_version = "1.7.1" + version = "1.7.2" package_name = "snappi" protobuf_name = "otg" go_package_name = "gosnappi" From ec7ded70794401f4f741e6c15f3551f238c01459 Mon Sep 17 00:00:00 2001 From: Github Actions Bot Date: Fri, 26 Jul 2024 06:44:58 +0000 Subject: [PATCH 10/10] Update auto generated go snappi --- gosnappi/bgp_attributes_community.go | 14 +++++----- ...tributes_sr_policy_explicit_null_policy.go | 28 +++++++++---------- gosnappi/gosnappi.go | 4 +-- gosnappi/otg/otg.pb.go | 2 +- gosnappi/otg/otg.proto | 2 +- requirements.txt | 10 +++---- snappi/docs/openapi.yaml | 2 +- snappi/snappi.py | 6 ++-- 8 files changed, 34 insertions(+), 34 deletions(-) diff --git a/gosnappi/bgp_attributes_community.go b/gosnappi/bgp_attributes_community.go index bb405dd5..7838417e 100644 --- a/gosnappi/bgp_attributes_community.go +++ b/gosnappi/bgp_attributes_community.go @@ -278,14 +278,14 @@ type BgpAttributesCommunity interface { Choice() BgpAttributesCommunityChoiceEnum // setChoice assigns BgpAttributesCommunityChoiceEnum provided by user to BgpAttributesCommunity setChoice(value BgpAttributesCommunityChoiceEnum) BgpAttributesCommunity - // getter for NoAdvertised to set choice. - NoAdvertised() // getter for NoExportSubconfed to set choice. NoExportSubconfed() // 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. @@ -322,11 +322,6 @@ func (obj *bgpAttributesCommunity) Choice() BgpAttributesCommunityChoiceEnum { return BgpAttributesCommunityChoiceEnum(obj.obj.Choice.Enum().String()) } -// 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) @@ -342,6 +337,11 @@ func (obj *bgpAttributesCommunity) NoLlgr() { obj.setChoice(BgpAttributesCommunityChoice.NO_LLGR) } +// 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) diff --git a/gosnappi/bgp_attributes_sr_policy_explicit_null_policy.go b/gosnappi/bgp_attributes_sr_policy_explicit_null_policy.go index 72b89a14..959f2f55 100644 --- a/gosnappi/bgp_attributes_sr_policy_explicit_null_policy.go +++ b/gosnappi/bgp_attributes_sr_policy_explicit_null_policy.go @@ -274,14 +274,14 @@ type BgpAttributesSrPolicyExplicitNullPolicy interface { HasChoice() bool // getter for DonotPush to set choice. DonotPush() - // getter for PushIpv4AndIpv6 to set choice. - PushIpv4AndIpv6() // getter for Unknown to set choice. Unknown() - // getter for PushIpv4 to set choice. - PushIpv4() // getter for PushIpv6 to set choice. PushIpv6() + // getter for PushIpv4AndIpv6 to set choice. + PushIpv4AndIpv6() + // getter for PushIpv4 to set choice. + PushIpv4() } type BgpAttributesSrPolicyExplicitNullPolicyChoiceEnum string @@ -310,26 +310,26 @@ 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 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 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) +} + // The Explicit NULL Label policy. // Choice returns a string func (obj *bgpAttributesSrPolicyExplicitNullPolicy) HasChoice() bool { diff --git a/gosnappi/gosnappi.go b/gosnappi/gosnappi.go index 6dcded0c..9ae1e236 100644 --- a/gosnappi/gosnappi.go +++ b/gosnappi/gosnappi.go @@ -1,4 +1,4 @@ -/* Open Traffic Generator API 1.7.0 +/* Open Traffic Generator API 1.7.1 * Open Traffic Generator API defines a model-driven, vendor-neutral and standard * interface for emulating layer 2-7 network devices and generating test traffic. * @@ -246,7 +246,7 @@ type Api interface { func (api *gosnappiApi) GetLocalVersion() Version { if api.versionMeta.localVersion == nil { - api.versionMeta.localVersion = NewVersion().SetApiSpecVersion("1.7.0").SetSdkVersion("1.7.1") + api.versionMeta.localVersion = NewVersion().SetApiSpecVersion("1.7.1").SetSdkVersion("1.7.2") } return api.versionMeta.localVersion diff --git a/gosnappi/otg/otg.pb.go b/gosnappi/otg/otg.pb.go index 8361f219..1ae42c79 100644 --- a/gosnappi/otg/otg.pb.go +++ b/gosnappi/otg/otg.pb.go @@ -1,4 +1,4 @@ -// Open Traffic Generator API 1.7.0 +// Open Traffic Generator API 1.7.1 // Open Traffic Generator API defines a model-driven, vendor-neutral and standard // interface for emulating layer 2-7 network devices and generating test traffic. // diff --git a/gosnappi/otg/otg.proto b/gosnappi/otg/otg.proto index 7f2bc11b..edffd780 100644 --- a/gosnappi/otg/otg.proto +++ b/gosnappi/otg/otg.proto @@ -1,4 +1,4 @@ -/* Open Traffic Generator API 1.7.0 +/* Open Traffic Generator API 1.7.1 * Open Traffic Generator API defines a model-driven, vendor-neutral and standard * interface for emulating layer 2-7 network devices and generating test traffic. * diff --git a/requirements.txt b/requirements.txt index a4695b9d..9074c28c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,11 @@ --prefer-binary +grpcio~=1.59.0 ; python_version > '3.6' +grpcio-tools~=1.59.0 ; python_version > '3.6' +grpcio~=1.35.0 ; python_version <= '3.6' +grpcio-tools~=1.35.0 ; python_version <= '3.6' requests protobuf~=3.15.0 ; python_version <= '3.6' protobuf~=4.24.4 ; python_version > '3.6' -grpcio-tools~=1.59.0 ; python_version > '3.6' -grpcio-tools~=1.35.0 ; python_version <= '3.6' -grpcio~=1.59.0 ; python_version > '3.6' -grpcio~=1.35.0 ; python_version <= '3.6' PyYAML -semantic_version urllib3 +semantic_version diff --git a/snappi/docs/openapi.yaml b/snappi/docs/openapi.yaml index 30a1d3f6..5b90382e 100644 --- a/snappi/docs/openapi.yaml +++ b/snappi/docs/openapi.yaml @@ -7,7 +7,7 @@ info: \ issue](https://github.com/open-traffic-generator/models/issues) in the models\ \ repository\n- [fork the models repository](https://github.com/open-traffic-generator/models)\ \ and submit a PR" - version: 1.7.0 + version: 1.7.1 contact: url: https://github.com/open-traffic-generator/models license: diff --git a/snappi/snappi.py b/snappi/snappi.py index 6a9c8b44..466b1630 100644 --- a/snappi/snappi.py +++ b/snappi/snappi.py @@ -1,4 +1,4 @@ -# Open Traffic Generator API 1.7.0 +# Open Traffic Generator API 1.7.1 # License: MIT import importlib @@ -142592,8 +142592,8 @@ class Api(object): def __init__(self, **kwargs): self._version_meta = self.version() - self._version_meta.api_spec_version = "1.7.0" - self._version_meta.sdk_version = "1.7.1" + self._version_meta.api_spec_version = "1.7.1" + self._version_meta.sdk_version = "1.7.2" self._version_check = kwargs.get("version_check") if self._version_check is None: self._version_check = False